Main Page

WinCvs 1.3b6 Source Doc Documentation

Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


File Index

WinCvs 1.3b6 Source Doc File List

Here is a list of all files with brief descriptions:
common/AdminOptionDlg.cpp [code]
common/AdminOptionDlg.h [code]
common/AnnotateDlg.cpp [code]
common/AnnotateDlg.h [code]
common/AppConsole.cpp [code]
common/AppConsole.h [code]
common/AppGlue.cpp [code]
common/AppGlue.h [code]
common/AppGlue.mac.cpp [code]
common/AppGlue.mac.h [code]
common/AskYesNo.cpp [code]
common/AskYesNo.h [code]
common/Authen.cpp [code]
common/Authen.h [code]
common/BrowseViewColumn.cpp [code]
common/BrowseViewColumn.h [code]
common/BrowseViewHandlers.h [code]
common/BrowseViewModel.cpp [code]
common/BrowseViewModel.h [code]
common/CheckoutDlg.cpp [code]
common/CheckoutDlg.h [code]
common/CommitDlg.cpp [code]
common/CommitDlg.h [code]
common/CPStr.cpp [code]
common/CPStr.h [code]
common/CTCP2Parse.cpp [code]
common/CTCP2Parse.hpp [code]
common/CvsAlert.cpp [code]
common/CvsAlert.h [code]
common/CvsArgs.cpp [code]
common/CvsArgs.h [code]
common/CvsCommands.cpp [code]
common/CvsCommands.h [code]
common/CvsEntries.cpp [code]
common/CvsEntries.h [code]
common/cvsgui.c [code]
common/cvsgui.h [code]
common/cvsgui_process.cpp [code]
common/cvsgui_process.h [code]
common/cvsgui_protocol.h [code]
common/cvsgui_wire.cpp [code]
common/cvsgui_wire.h [code]
common/CvsIgnore.cpp [code]
common/CvsIgnore.h [code]
common/CvsPrefs.cpp [code]
common/CvsPrefs.h [code]
common/DiffDlg.cpp [code]
common/DiffDlg.h [code]
common/dll_garbage.c [code]
common/dll_garbage.h [code]
common/dll_glue.c [code]
common/dll_glue.h [code]
common/dll_loader.c [code]
common/dll_loader.h [code]
common/dll_process.h [code]
common/EditorMonDlg.cpp [code]
common/EditorMonDlg.h [code]
common/FileTraversal.cpp [code]
common/FileTraversal.h [code]
common/fnmatch.c [code]
common/fnmatch.h [code]
common/getline.c [code]
common/getline.h [code]
common/getopt.c [code]
common/getopt.h [code]
common/getopt1.c [code]
common/GetPassword.cpp [code]
common/GetPassword.h [code]
common/GetPrefs.cpp [code]
common/GetPrefs.h [code]
common/GetValue.cpp [code]
common/GetValue.h [code]
common/GraphOptDlg.cpp [code]
common/GraphOptDlg.h [code]
common/ImportDlg.cpp [code]
common/ImportDlg.h [code]
common/ImportFilter.cpp [code]
common/ImportFilter.h [code]
common/ImportFilterDlg.cpp [code]
common/ImportFilterDlg.h [code]
common/InitDlg.cpp [code]
common/InitDlg.h [code]
common/LineCmd.cpp [code]
common/LineCmd.h [code]
common/LogDlg.cpp [code]
common/LogDlg.h [code]
common/LogParse.cpp [code]
common/LogParse.h [code]
common/MacBinEncoding.cpp [code]
common/MacBinEncoding.h [code]
common/MacBinMaps.cpp [code]
common/MacBinMaps.h [code]
common/MacMisc.cpp [code]
common/MacMisc.h [code]
common/MacrosSetup.cpp [code]
common/MacrosSetup.h [code]
common/MakeSurePathExists.cpp [code]
common/MakeSurePathExists.h [code]
common/MoveToTrash.cpp [code]
common/MoveToTrash.h [code]
common/MultiFiles.cpp [code]
common/MultiFiles.h [code]
common/MultiString.cpp [code]
common/MultiString.h [code]
common/OptionalPropertySheet.cpp [code]
common/OptionalPropertySheet.h [code]
common/Persistent.cpp [code]
common/Persistent.h [code]
common/PromptFiles.cpp [code]
common/PromptFiles.h [code]
common/PythonContainer.cpp [code]
common/PythonContainer.h [code]
common/PythonGlue.cpp [code]
common/PythonGlue.h [code]
common/PythonGlue.impl.h [code]
common/PythonImpl.cpp [code]
common/PythonImpl.h [code]
common/PythonMacros.h [code]
common/ReleaseDlg.cpp [code]
common/ReleaseDlg.h [code]
common/RtagDlg.cpp [code]
common/RtagDlg.h [code]
common/SortList.h [code]
common/TagDlg.cpp [code]
common/TagDlg.h [code]
common/TclGlue.cpp [code]
common/TclGlue.h [code]
common/TclGlue.mac.cpp [code]
common/TclGlue.mac.h [code]
common/TextBinary.cpp [code]
common/TextBinary.h [code]
common/UCvsApp.cpp [code]
common/UCvsApp.h [code]
common/UCvsCommands.h [code]
common/UCvsConsole.cpp [code]
common/UCvsConsole.h [code]
common/UCvsDialogs.h [code]
common/UCvsFiles.cpp [code]
common/UCvsFiles.h [code]
common/UCvsFolders.cpp [code]
common/UCvsFolders.h [code]
common/UCvsFrame.cpp [code]
common/UCvsFrame.h [code]
common/UCvsGraph.cpp [code]
common/UCvsGraph.h [code]
common/UCvsMenubar.cpp [code]
common/UCvsMenubar.h [code]
common/UCvsToolbar.cpp [code]
common/UCvsToolbar.h [code]
common/UpdateDlg.cpp [code]
common/UpdateDlg.h [code]
common/VolsPaths.c [code]
common/VolsPaths.h [code]
cvs-1.10/acconfig.h [code]
cvs-1.10/diff/analyze.c [code]
cvs-1.10/diff/cmpbuf.c [code]
cvs-1.10/diff/cmpbuf.h [code]
cvs-1.10/diff/context.c [code]
cvs-1.10/diff/diff.c [code]
cvs-1.10/diff/diff.h [code]
cvs-1.10/diff/diff3.c [code]
cvs-1.10/diff/diffrun.h [code]
cvs-1.10/diff/dir.c [code]
cvs-1.10/diff/ed.c [code]
cvs-1.10/diff/ifdef.c [code]
cvs-1.10/diff/io.c [code]
cvs-1.10/diff/normal.c [code]
cvs-1.10/diff/side.c [code]
cvs-1.10/diff/system.h [code]
cvs-1.10/diff/util.c [code]
cvs-1.10/diff/version.c [code]
cvs-1.10/emx/config.h [code]
cvs-1.10/emx/filesubr.c [code]
cvs-1.10/emx/options.h [code]
cvs-1.10/emx/rcmd.h [code]
cvs-1.10/emx/savecwd.c [code]
cvs-1.10/emx/startserver.c [code]
cvs-1.10/emx/stripslash.c [code]
cvs-1.10/emx/system.c [code]
cvs-1.10/lib/argmatch.c [code]
cvs-1.10/lib/dup2.c [code]
cvs-1.10/lib/fncase.c [code]
cvs-1.10/lib/fnmatch.c [code]
cvs-1.10/lib/fnmatch.h [code]
cvs-1.10/lib/ftruncate.c [code]
cvs-1.10/lib/getdate.c [code]
cvs-1.10/lib/getdate.y [code]
cvs-1.10/lib/getline.c [code]
cvs-1.10/lib/getline.h [code]
cvs-1.10/lib/getopt.c [code]
cvs-1.10/lib/getopt.h [code]
cvs-1.10/lib/getopt1.c [code]
cvs-1.10/lib/hostname.c [code]
cvs-1.10/lib/md5.c [code]
cvs-1.10/lib/md5.h [code]
cvs-1.10/lib/memmove.c [code]
cvs-1.10/lib/mkdir.c [code]
cvs-1.10/lib/regex.c [code]
cvs-1.10/lib/regex.h [code]
cvs-1.10/lib/rename.c [code]
cvs-1.10/lib/savecwd.c [code]
cvs-1.10/lib/savecwd.h [code]
cvs-1.10/lib/sighandle.c [code]
cvs-1.10/lib/strerror.c [code]
cvs-1.10/lib/stripslash.c [code]
cvs-1.10/lib/strstr.c [code]
cvs-1.10/lib/strtoul.c [code]
cvs-1.10/lib/system.h [code]
cvs-1.10/lib/valloc.c [code]
cvs-1.10/lib/vasprintf.c [code]
cvs-1.10/lib/wait.h [code]
cvs-1.10/lib/waitpid.c [code]
cvs-1.10/lib/xgetwd.c [code]
cvs-1.10/lib/yesno.c [code]
cvs-1.10/macintosh/apsingle.c [code]
cvs-1.10/macintosh/apsingle.h [code]
cvs-1.10/macintosh/config.h [code]
cvs-1.10/macintosh/cvs_hqx.cpp [code]
cvs-1.10/macintosh/cvs_hqx.h [code]
cvs-1.10/macintosh/GUSIlsh.h [code]
cvs-1.10/macintosh/hqx.c [code]
cvs-1.10/macintosh/hqx.h [code]
cvs-1.10/macintosh/kclient_if.c [code]
cvs-1.10/macintosh/kclient_if.h [code]
cvs-1.10/macintosh/lsh_dll.h [code]
cvs-1.10/macintosh/mac_filesubr.c [code]
cvs-1.10/macintosh/mac_run.c [code]
cvs-1.10/macintosh/macos_filesys.c [code]
cvs-1.10/macintosh/options.h [code]
cvs-1.10/macintosh/pwd.c [code]
cvs-1.10/macintosh/pwd.h [code]
cvs-1.10/macintosh/rcmd.c [code]
cvs-1.10/macintosh/server_if.c [code]
cvs-1.10/os2/config.h [code]
cvs-1.10/os2/dirent.c [code]
cvs-1.10/os2/dirent.h [code]
cvs-1.10/os2/filesubr.c [code]
cvs-1.10/os2/getdate.c [code]
cvs-1.10/os2/getpass.c [code]
cvs-1.10/os2/mkdir.c [code]
cvs-1.10/os2/options.h [code]
cvs-1.10/os2/os2inc.h [code]
cvs-1.10/os2/popen.c [code]
cvs-1.10/os2/popen.h [code]
cvs-1.10/os2/porttcp.c [code]
cvs-1.10/os2/pwd.c [code]
cvs-1.10/os2/pwd.h [code]
cvs-1.10/os2/rcmd.c [code]
cvs-1.10/os2/rcmd.h [code]
cvs-1.10/os2/run.c [code]
cvs-1.10/os2/stripslash.c [code]
cvs-1.10/os2/tcpip.h [code]
cvs-1.10/os2/waitpid.c [code]
cvs-1.10/src/add.c [code]
cvs-1.10/src/admin.c [code]
cvs-1.10/src/buffer.c [code]
cvs-1.10/src/buffer.h [code]
cvs-1.10/src/checkin.c [code]
cvs-1.10/src/checkout.c [code]
cvs-1.10/src/classify.c [code]
cvs-1.10/src/client.c [code]
cvs-1.10/src/client.h [code]
cvs-1.10/src/commit.c [code]
cvs-1.10/src/create_adm.c [code]
cvs-1.10/src/cvs.h [code]
cvs-1.10/src/cvsrc.c [code]
cvs-1.10/src/diff.c [code]
cvs-1.10/src/edit.c [code]
cvs-1.10/src/edit.h [code]
cvs-1.10/src/entries.c [code]
cvs-1.10/src/error.c [code]
cvs-1.10/src/error.h [code]
cvs-1.10/src/expand_path.c [code]
cvs-1.10/src/fileattr.c [code]
cvs-1.10/src/fileattr.h [code]
cvs-1.10/src/filesubr.c [code]
cvs-1.10/src/find_names.c [code]
cvs-1.10/src/hardlink.c [code]
cvs-1.10/src/hardlink.h [code]
cvs-1.10/src/hash.c [code]
cvs-1.10/src/hash.h [code]
cvs-1.10/src/history.c [code]
cvs-1.10/src/ignore.c [code]
cvs-1.10/src/import.c [code]
cvs-1.10/src/lock.c [code]
cvs-1.10/src/log.c [code]
cvs-1.10/src/login.c [code]
cvs-1.10/src/logmsg.c [code]
cvs-1.10/src/main.c [code]
cvs-1.10/src/mkmodules.c [code]
cvs-1.10/src/modules.c [code]
cvs-1.10/src/myndbm.c [code]
cvs-1.10/src/myndbm.h [code]
cvs-1.10/src/no_diff.c [code]
cvs-1.10/src/parseinfo.c [code]
cvs-1.10/src/patch.c [code]
cvs-1.10/src/rcs.c [code]
cvs-1.10/src/rcs.h [code]
cvs-1.10/src/rcscmds.c [code]
cvs-1.10/src/recurse.c [code]
cvs-1.10/src/release.c [code]
cvs-1.10/src/remove.c [code]
cvs-1.10/src/repos.c [code]
cvs-1.10/src/root.c [code]
cvs-1.10/src/rtag.c [code]
cvs-1.10/src/run.c [code]
cvs-1.10/src/scramble.c [code]
cvs-1.10/src/server.c [code]
cvs-1.10/src/server.h [code]
cvs-1.10/src/status.c [code]
cvs-1.10/src/subr.c [code]
cvs-1.10/src/tag.c [code]
cvs-1.10/src/update.c [code]
cvs-1.10/src/update.h [code]
cvs-1.10/src/vers_ts.c [code]
cvs-1.10/src/version.c [code]
cvs-1.10/src/watch.c [code]
cvs-1.10/src/watch.h [code]
cvs-1.10/src/wrapper.c [code]
cvs-1.10/src/zlib.c [code]
cvs-1.10/vms/config.h [code]
cvs-1.10/vms/dir.h [code]
cvs-1.10/vms/filesubr.c [code]
cvs-1.10/vms/filutils.c [code]
cvs-1.10/vms/filutils.h [code]
cvs-1.10/vms/getpass.c [code]
cvs-1.10/vms/getwd.c [code]
cvs-1.10/vms/misc.c [code]
cvs-1.10/vms/misc.h [code]
cvs-1.10/vms/ndir.c [code]
cvs-1.10/vms/ndir.h [code]
cvs-1.10/vms/options.h [code]
cvs-1.10/vms/pathnames.h [code]
cvs-1.10/vms/pc.c [code]
cvs-1.10/vms/pipe.c [code]
cvs-1.10/vms/pipe.h [code]
cvs-1.10/vms/piped_child.c [code]
cvs-1.10/vms/pwd.c [code]
cvs-1.10/vms/pwd.h [code]
cvs-1.10/vms/rcmd.c [code]
cvs-1.10/vms/readlink.c [code]
cvs-1.10/vms/rmdir.c [code]
cvs-1.10/vms/startserver.c [code]
cvs-1.10/vms/stat.c [code]
cvs-1.10/vms/unlink.c [code]
cvs-1.10/vms/utime.c [code]
cvs-1.10/vms/vms-types.h [code]
cvs-1.10/vms/vms.h [code]
cvs-1.10/vms/vmsmunch.c [code]
cvs-1.10/vms/vmsmunch.h [code]
cvs-1.10/vms/vmsmunch_private.h [code]
cvs-1.10/vms/waitpid.c [code]
cvs-1.10/windows-NT/config.h [code]
cvs-1.10/windows-NT/filesubr.c [code]
cvs-1.10/windows-NT/mkdir.c [code]
cvs-1.10/windows-NT/ndir.c [code]
cvs-1.10/windows-NT/ndir.h [code]
cvs-1.10/windows-NT/options.h [code]
cvs-1.10/windows-NT/pwd.c [code]
cvs-1.10/windows-NT/pwd.h [code]
cvs-1.10/windows-NT/rcmd.c [code]
cvs-1.10/windows-NT/rcmd.h [code]
cvs-1.10/windows-NT/run.c [code]
cvs-1.10/windows-NT/sockerror.c [code]
cvs-1.10/windows-NT/startserver.c [code]
cvs-1.10/windows-NT/stripslash.c [code]
cvs-1.10/windows-NT/waitpid.c [code]
cvs-1.10/windows-NT/win32.c [code]
cvs-1.10/windows-NT/SCC/pubscc.h [code]
cvs-1.10/windows-NT/SCC/scc.c [code]
cvs-1.10/zlib/adler32.c [code]
cvs-1.10/zlib/compress.c [code]
cvs-1.10/zlib/crc32.c [code]
cvs-1.10/zlib/deflate.c [code]
cvs-1.10/zlib/deflate.h [code]
cvs-1.10/zlib/example.c [code]
cvs-1.10/zlib/gzio.c [code]
cvs-1.10/zlib/infblock.c [code]
cvs-1.10/zlib/infblock.h [code]
cvs-1.10/zlib/infcodes.c [code]
cvs-1.10/zlib/infcodes.h [code]
cvs-1.10/zlib/inffast.c [code]
cvs-1.10/zlib/inffast.h [code]
cvs-1.10/zlib/inflate.c [code]
cvs-1.10/zlib/inftrees.c [code]
cvs-1.10/zlib/inftrees.h [code]
cvs-1.10/zlib/infutil.c [code]
cvs-1.10/zlib/infutil.h [code]
cvs-1.10/zlib/minigzip.c [code]
cvs-1.10/zlib/trees.c [code]
cvs-1.10/zlib/uncompr.c [code]
cvs-1.10/zlib/zconf.h [code]
cvs-1.10/zlib/zlib.h [code]
cvs-1.10/zlib/zutil.c [code]
cvs-1.10/zlib/zutil.h [code]
cvstree/common.h [code]
cvstree/CvsLog.cpp [code]
cvstree/CvsLog.h [code]
cvstree/lexer.cc [code]
cvstree/lexer.cpp [code]
cvstree/main.cpp [code]
cvstree/parser.cc [code]
cvstree/parser.cpp [code]
cvstree/parser.h [code]
cvstree/compat/unistd.h [code]
rf/uconfig.h [code]
rf/uconsole.cpp [code]
rf/uconsole.h [code]
rf/udraw.cpp [code]
rf/udraw.h [code]
rf/uevent.cpp [code]
rf/umain.h [code]
rf/umenu.cpp [code]
rf/umenu.h [code]
rf/uobject.cpp [code]
rf/uobject.h [code]
rf/ustr.cpp [code]
rf/ustr.h [code]
rf/utoolbar.cpp [code]
rf/utoolbar.h [code]
rf/uwidget.cpp [code]
rf/uwidget.h [code]
rf/support/gtk/stdafx.h [code]
rf/support/macapp/stdafx.h [code]
rf/support/macapp/UPseudoSupport.cpp [code]
rf/support/macapp/UPseudoSupport.h [code]
rf/support/mfc/dib.c [code]
rf/support/mfc/dib.h [code]
rf/support/mfc/PseudoButton.cpp [code]
rf/support/mfc/PseudoButton.h [code]
rf/support/mfc/PseudoDlg.cpp [code]
rf/support/mfc/PseudoDlg.h [code]
rf/support/mfc/PseudoDraw.cpp [code]
rf/support/mfc/PseudoDraw.h [code]
rf/support/mfc/PseudoList.cpp [code]
rf/support/mfc/pseudolist.h [code]
rf/support/mfc/StdAfx.cpp [code]
rf/support/mfc/StdAfx.h [code]
rf/support/powerplant/stdafx.h [code]
rf/support/powerplant/UPseudoSupport.cpp [code]
rf/support/powerplant/UPseudoSupport.h [code]
WinCvs/BrowseFileView.cpp [code]
WinCvs/BrowseFileView.h [code]
WinCvs/BrowserBar.cpp [code]
WinCvs/BrowserBar.h [code]
WinCvs/ColorStatic.cpp [code]
WinCvs/ColorStatic.h [code]
WinCvs/ConsoleBar.cpp [code]
WinCvs/ConsoleBar.h [code]
WinCvs/CustomizeMenus.cpp [code]
WinCvs/CustomizeMenus.h [code]
WinCvs/CvsStatusBar.cpp [code]
WinCvs/CvsStatusBar.h [code]
WinCvs/ExploreBar.cpp [code]
WinCvs/ExploreBar.h [code]
WinCvs/FileViewWatcher.cpp [code]
WinCvs/FileViewWatcher.h [code]
WinCvs/findtcl.cpp [code]
WinCvs/GraphDoc.cpp [code]
WinCvs/GraphDoc.h [code]
WinCvs/GraphFrm.cpp [code]
WinCvs/GraphFrm.h [code]
WinCvs/GraphView.cpp [code]
WinCvs/GraphView.h [code]
WinCvs/HistComboBoxEx.cpp [code]
WinCvs/HistComboBoxEx.h [code]
WinCvs/LogFrm.cpp [code]
WinCvs/LogFrm.h [code]
WinCvs/MainFrm.cpp [code]
WinCvs/MainFrm.h [code]
WinCvs/ndir.c [code]
WinCvs/ndir.h [code]
WinCvs/NoPython.cpp [code]
WinCvs/NoPython.h [code]
WinCvs/ProgressDialog.cpp [code]
WinCvs/ProgressDialog.h [code]
WinCvs/resource.h [code]
WinCvs/SortHeaderCtrl.cpp [code]
WinCvs/SortHeaderCtrl.h [code]
WinCvs/Splash.cpp [code]
WinCvs/Splash.h [code]
WinCvs/Stat.cpp [code]
WinCvs/StdAfx.cpp [code]
WinCvs/StdAfx.h [code]
WinCvs/TbEdit.cpp [code]
WinCvs/TbEdit.h [code]
WinCvs/TipDlg.cpp [code]
WinCvs/TipDlg.h [code]
WinCvs/ToolbarCombo.cpp [code]
WinCvs/ToolbarCombo.h [code]
WinCvs/version_fu.h [code]
WinCvs/version_no.h [code]
WinCvs/Win32wstring.hpp [code]
WinCvs/wincvs.cpp [code]
WinCvs/wincvs.h [code]
WinCvs/wincvs_winutil.cpp [code]
WinCvs/wincvs_winutil.h [code]
WinCvs/WinCvsBrowser.cpp [code]
WinCvs/WinCvsBrowser.h [code]
WinCvs/WinCvsDebug.cpp [code]
WinCvs/WinCvsDebug.h [code]
WinCvs/wincvsDoc.cpp [code]
WinCvs/wincvsDoc.h [code]
WinCvs/wincvsView.cpp [code]
WinCvs/wincvsView.h [code]
WinCvs/CJLib/CJLibrary/CJBrowseEdit.cpp [code]
WinCvs/CJLib/CJLibrary/CJCaption.cpp [code]
WinCvs/CJLib/CJLibrary/CJCaptionPopupWnd.cpp [code]
WinCvs/CJLib/CJLibrary/CJColorPicker.cpp [code]
WinCvs/CJLib/CJLibrary/CJColorPopup.cpp [code]
WinCvs/CJLib/CJLibrary/CJComboBoxEx.cpp [code]
WinCvs/CJLib/CJLibrary/CJControlBar.cpp [code]
WinCvs/CJLib/CJLibrary/CJDateTimeCtrl.cpp [code]
WinCvs/CJLib/CJLibrary/CJDockBar.cpp [code]
WinCvs/CJLib/CJLibrary/CJDockContext.cpp [code]
WinCvs/CJLib/CJLibrary/CJExplorerBar.cpp [code]
WinCvs/CJLib/CJLibrary/CJFlatButton.cpp [code]
WinCvs/CJLib/CJLibrary/CJFlatComboBox.cpp [code]
WinCvs/CJLib/CJLibrary/CJFlatHeaderCtrl.cpp [code]
WinCvs/CJLib/CJLibrary/CJFlatSplitterWnd.cpp [code]
WinCvs/CJLib/CJLibrary/CJFlatTabCtrl.cpp [code]
WinCvs/CJLib/CJLibrary/CJFontCombo.cpp [code]
WinCvs/CJLib/CJLibrary/CJFrameWnd.cpp [code]
WinCvs/CJLib/CJLibrary/CJHexEdit.cpp [code]
WinCvs/CJLib/CJLibrary/CJHtmlView.cpp [code]
WinCvs/CJLib/CJLibrary/CJHyperLink.cpp [code]
WinCvs/CJLib/CJLibrary/CJLibrary.cpp [code]
WinCvs/CJLib/CJLibrary/CJListBox.cpp [code]
WinCvs/CJLib/CJLibrary/CJListCtrl.cpp [code]
WinCvs/CJLib/CJLibrary/CJListView.cpp [code]
WinCvs/CJLib/CJLibrary/CJLogoPane.cpp [code]
WinCvs/CJLib/CJLibrary/CJMaskEdit.cpp [code]
WinCvs/CJLib/CJLibrary/CJMDIChildWnd.cpp [code]
WinCvs/CJLib/CJLibrary/CJMDIFrameWnd.cpp [code]
WinCvs/CJLib/CJLibrary/CJMemFile.cpp [code]
WinCvs/CJLib/CJLibrary/CJMenu.cpp [code]
WinCvs/CJLib/CJLibrary/CJMenuBar.cpp [code]
WinCvs/CJLib/CJLibrary/CJMetaFileButton.cpp [code]
WinCvs/CJLib/CJLibrary/CJMiniDockFrameWnd.cpp [code]
WinCvs/CJLib/CJLibrary/CJOutlookBar.cpp [code]
WinCvs/CJLib/CJLibrary/CJPagerCtrl.cpp [code]
WinCvs/CJLib/CJLibrary/CJReBar.cpp [code]
WinCvs/CJLib/CJLibrary/CJReBarCtrl.cpp [code]
WinCvs/CJLib/CJLibrary/CJShell.cpp [code]
WinCvs/CJLib/CJLibrary/CJShellList.cpp [code]
WinCvs/CJLib/CJLibrary/CJShellTree.cpp [code]
WinCvs/CJLib/CJLibrary/CJSizeDockBar.cpp [code]
WinCvs/CJLib/CJLibrary/CJSortClass.cpp [code]
WinCvs/CJLib/CJLibrary/CJStatusBar.cpp [code]
WinCvs/CJLib/CJLibrary/CJTabCtrl.cpp [code]
WinCvs/CJLib/CJLibrary/CJTabCtrlBar.cpp [code]
WinCvs/CJLib/CJLibrary/CJTabView.cpp [code]
WinCvs/CJLib/CJLibrary/CJToolBar.cpp [code]
WinCvs/CJLib/CJLibrary/CJToolBarBase.cpp [code]
WinCvs/CJLib/CJLibrary/CJToolBarCtrl.cpp [code]
WinCvs/CJLib/CJLibrary/CJTreeCtrl.cpp [code]
WinCvs/CJLib/CJLibrary/CJWindowPlacement.cpp [code]
WinCvs/CJLib/CJLibrary/GfxGroupEdit.cpp [code]
WinCvs/CJLib/CJLibrary/GfxOutBarCtrl.cpp [code]
WinCvs/CJLib/CJLibrary/GfxSplitterWnd.cpp [code]
WinCvs/CJLib/CJLibrary/Resource.h [code]
WinCvs/CJLib/CJLibrary/StdAfx.cpp [code]
WinCvs/CJLib/CJLibrary/StdAfx.h [code]
WinCvs/CJLib/CJLibrary/Subclass.cpp [code]
WinCvs/CJLib/Include/CJBrowseEdit.h [code]
WinCvs/CJLib/Include/CJCaption.h [code]
WinCvs/CJLib/Include/CJCaptionPopupWnd.h [code]
WinCvs/CJLib/Include/CJColorPicker.h [code]
WinCvs/CJLib/Include/CJColorPopup.h [code]
WinCvs/CJLib/Include/CJComboBoxEx.h [code]
WinCvs/CJLib/Include/CJControlBar.h [code]
WinCvs/CJLib/Include/CJDateTimeCtrl.h [code]
WinCvs/CJLib/Include/CJDockBar.h [code]
WinCvs/CJLib/Include/CJDockContext.h [code]
WinCvs/CJLib/Include/CJExplorerBar.h [code]
WinCvs/CJLib/Include/CJFlatButton.h [code]
WinCvs/CJLib/Include/CJFlatComboBox.h [code]
WinCvs/CJLib/Include/CJFlatHeaderCtrl.h [code]
WinCvs/CJLib/Include/CJFlatSplitterWnd.h [code]
WinCvs/CJLib/Include/CJFlatTabCtrl.h [code]
WinCvs/CJLib/Include/CJFontCombo.h [code]
WinCvs/CJLib/Include/CJFrameWnd.h [code]
WinCvs/CJLib/Include/CJHexEdit.h [code]
WinCvs/CJLib/Include/CJHtmlView.h [code]
WinCvs/CJLib/Include/CJHyperLink.h [code]
WinCvs/CJLib/Include/CJLibrary.h [code]
WinCvs/CJLib/Include/CJListBox.h [code]
WinCvs/CJLib/Include/CJListCtrl.h [code]
WinCvs/CJLib/Include/CJListView.h [code]
WinCvs/CJLib/Include/CJLogoPane.h [code]
WinCvs/CJLib/Include/CJMaskEdit.h [code]
WinCvs/CJLib/Include/CJMDIChildWnd.h [code]
WinCvs/CJLib/Include/CJMDIFrameWnd.h [code]
WinCvs/CJLib/Include/CJMemFile.h [code]
WinCvs/CJLib/Include/CJMenu.h [code]
WinCvs/CJLib/Include/CJMenuBar.h [code]
WinCvs/CJLib/Include/CJMetaFileButton.h [code]
WinCvs/CJLib/Include/CJMiniDockFrameWnd.h [code]
WinCvs/CJLib/Include/CJOutlookBar.h [code]
WinCvs/CJLib/Include/CJPagerCtrl.h [code]
WinCvs/CJLib/Include/CJReBar.h [code]
WinCvs/CJLib/Include/CJReBarCtrl.h [code]
WinCvs/CJLib/Include/CJResource.h [code]
WinCvs/CJLib/Include/CJShell.h [code]
WinCvs/CJLib/Include/CJShellList.h [code]
WinCvs/CJLib/Include/CJShellTree.h [code]
WinCvs/CJLib/Include/CJSizeDockBar.h [code]
WinCvs/CJLib/Include/CJSortClass.h [code]
WinCvs/CJLib/Include/CJStatusBar.h [code]
WinCvs/CJLib/Include/CJTabCtrl.h [code]
WinCvs/CJLib/Include/CJTabCtrlBar.h [code]
WinCvs/CJLib/Include/CJTabView.h [code]
WinCvs/CJLib/Include/CJToolBar.h [code]
WinCvs/CJLib/Include/CJToolBarBase.h [code]
WinCvs/CJLib/Include/CJToolBarCtrl.h [code]
WinCvs/CJLib/Include/CJTreeCtrl.h [code]
WinCvs/CJLib/Include/CJWindowPlacement.h [code]
WinCvs/CJLib/Include/GfxGroupEdit.h [code]
WinCvs/CJLib/Include/GfxOutBarCtrl.h [code]
WinCvs/CJLib/Include/GfxSplitterWnd.h [code]
WinCvs/CJLib/Include/Subclass.h [code]
WinCvs/CoWorker/cvs_coworker.h [code]
WinCvs/CoWorker/CVS_Coworker_i.c [code]
WinCvs/CoWorker/CVS_Coworker_i.h [code]
WinCvs/CoWorker/CVS_Coworker_p.c [code]
WinCvs/CoWorker/CvsCoworker.cpp [code]
WinCvs/CoWorker/CvsCoworker.h [code]
WinCvs/CoWorker/CvsCoworkerErrors.h [code]
WinCvs/CoWorker/CvsFilenames.cpp [code]
WinCvs/CoWorker/CvsFilenames.h [code]
WinCvs/CoWorker/CvsProject.cpp [code]
WinCvs/CoWorker/CvsProject.h [code]
WinCvs/CoWorker/CvsString.cpp [code]
WinCvs/CoWorker/CvsString.h [code]
WinCvs/CoWorker/CvsTrace.cpp [code]
WinCvs/CoWorker/CvsTrace.h [code]
WinCvs/CoWorker/dlldata.c [code]
WinCvs/res/resrc1.h [code]
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AdminOptionDlg.cpp File Reference

common/AdminOptionDlg.cpp File Reference

#include "stdafx.h"

Include dependency graph for AdminOptionDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool CompatGetAdminOptions (kAdminOptionDlgType type, CPStr &optionString)

Function Documentation

bool CompatGetAdminOptions | ( | kAdminOptionDlgType | type,
 |  | CPStr & | optionString
 | ) |

Definition at line 153 of file AdminOptionDlg.cpp.

00154 {
00155     bool userHitOK = false;
00156
00157 #ifdef WIN32
00158     CAdminOptionDlg adminOptionDlg(type);
00159     adminOptionDlg.m_optionString = (const char*)optionString;
00160     if( adminOptionDlg.DoModal() == IDOK )
00161     {
00162         optionString = (const char*)adminOptionDlg.m_optionString;
00163         userHitOK = true;
00164     }
00165 #endif /* WIN32 */
00166 #ifdef qMacCvsPP
00167 #endif /* qMacCvsPP */
00168 #if qUnix
00169 #endif // qUnix
00170
00171     return userHitOK;
00172 }

Generated on Sun Oct 21 12:41:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AdminOptionDlg.h File Reference

common/AdminOptionDlg.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_ADMINOPTIONDLG_H__C9A89564_F0A4_4294_8C6C_18469D18BCB3__INCLUDED_

Enumerations

enum | kAdminOptionDlgType { kChangeLog, kSetState, kSetDescription }

Functions

bool | CompatGetAdminOptions (kAdminOptionDlgType type, CPStr &optionString)

Define Documentation

#define AFX_ADMINOPTIONDLG_H__C9A89564_F0A4_4294_8C6C_18469D18BCB3__INCLUDED_

Definition at line 26 of file AdminOptionDlg.h.

Enumeration Type Documentation

enum kAdminOptionDlgType

Enumeration values:
kChangeLog
kSetState
kSetDescription

Definition at line 34 of file AdminOptionDlg.h.

00035 {
00036     kChangeLog,
00037     kSetState,
00038     kSetDescription
00039 } kAdminOptionDlgType;

Function Documentation

bool CompatGetAdminOptions | ( | kAdminOptionDlgType | type,
 |  | CPStr & | optionString
 | ) |

Definition at line 153 of file AdminOptionDlg.cpp.

Referenced by CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), and CGraphView::OnGraphSetstate().

00154 {
00155     bool userHitOK = false;
00156
00157 #ifdef WIN32
00158     CAdminOptionDlg adminOptionDlg(type);
00159     adminOptionDlg.m_optionString = (const char*)optionString;
00160     if( adminOptionDlg.DoModal() == IDOK )
00161     {
00162         optionString = (const char*)adminOptionDlg.m_optionString;
00163         userHitOK = true;
00164     }
00165 #endif /* WIN32 */
00166 #ifdef qMacCvsPP
00167 #endif /* qMacCvsPP */
00168 #if qUnix
00169 #endif // qUnix
00170
00171     return userHitOK;
00172 }

Generated on Sun Oct 21 12:41:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AnnotateDlg.cpp File Reference

common/AnnotateDlg.cpp File Reference

#include "stdafx.h"
#include "AnnotateDlg.h"
#include "CvsPrefs.h"

Include dependency graph for AnnotateDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool CompatGetAnnotate (bool &noRecurs, bool &isDate, UPStr &rev, bool &force)

Function Documentation

bool CompatGetAnnotate | ( | bool & | noRecurs,
 |  | bool & | isDate,
 |  | UPStr & | rev,
 |  | bool & | force
 | ) |

Definition at line 145 of file AnnotateDlg.cpp.

00146 {
00147     bool userHitOK = false;
00148
00149     static CPStr sLastRev;
00150     static bool bIsDate = false;
00151
00152     rev = "";
00153     noRecurs = false;
00154     force = false;
00155     bool hasRev = false;
00156     isDate = bIsDate;
00157
00158 #ifdef WIN32
00159     COptionalPropertySheet pages(gCvsPrefs.HideCommandDlgAnnotate(), "Annotate settings");
00160     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00161     CAnnotate_MAIN page1(sLastRev, isDate);
00162     CGetPrefs_GLOBALS page2;
00163     pages.AddPage(&page1);
00164     pages.AddPage(&page2);
00165     if(pages.DoModal() == IDOK)
00166     {
00167         noRecurs = page1.m_noRecurse == TRUE;
00168
00169         sLastRev = page1.m_strRev;
00170         isDate = page1.m_isDate == TRUE;
00171         hasRev = page1.m_hasRev == TRUE;
00172         force = page1.m_force == TRUE;
00173
00174         page2.StoreValues();
00175         gCvsPrefs.SetHideCommandDlgAnnotate(pages.GetHideCommandDlg());
00176         userHitOK = true;
00177     }
00178 #endif /* WIN32 */
00179
00180 #ifdef qMacCvsPP
00181 #endif /* qMacCvsPP */
00182
00183 #if qUnix
00184 #endif // qUnix
00185
00186     if(userHitOK)
00187     {
00188         if(hasRev)
00189             rev = sLastRev;
00190         bIsDate = isDate;
00191
00192         gCvsPrefs.save();
00193     }
00194
00195     return userHitOK;
00196 }

Generated on Sun Oct 21 12:41:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AnnotateDlg.h File Reference

common/AnnotateDlg.h File Reference

#include "CPStr.h"
#include "MultiString.h"

Include dependency graph for AnnotateDlg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_ANNOTATEDLG_H__864729EE_838B_473D_8723_E1269829F781__INCLUDED_

Functions

bool | CompatGetAnnotate (bool &noRecurs, bool &isDate, UPStr &rev, bool &force)

Variables

CMString gRevNames
CMString gDateNames

Define Documentation

#define AFX_ANNOTATEDLG_H__864729EE_838B_473D_8723_E1269829F781__INCLUDED_

Definition at line 26 of file AnnotateDlg.h.

Function Documentation

bool CompatGetAnnotate | ( | bool & | noRecurs,
 |  | bool & | isDate,
 |  | UPStr & | rev,
 |  | bool & | force
 | ) |

Definition at line 145 of file AnnotateDlg.cpp.

Referenced by CvsCmdAnnotateFiles().

00146 {
00147     bool userHitOK = false;
00148
00149     static CPStr sLastRev;
00150     static bool bIsDate = false;
00151
00152     rev = "";
00153     noRecurs = false;
00154     force = false;
00155     bool hasRev = false;
00156     isDate = bIsDate;
00157
00158 #ifdef WIN32
00159     COptionalPropertySheet pages(gCvsPrefs.HideCommandDlgAnnotate(), "Annotate settings");
00160     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00161     CAnnotate_MAIN page1(sLastRev, isDate);
00162     CGetPrefs_GLOBALS page2;
00163     pages.AddPage(&page1);
00164     pages.AddPage(&page2);
00165     if(pages.DoModal() == IDOK)
00166     {
00167         noRecurs = page1.m_noRecurse == TRUE;
00168
00169         sLastRev = page1.m_strRev;
00170         isDate = page1.m_isDate == TRUE;
00171         hasRev = page1.m_hasRev == TRUE;
00172         force = page1.m_force == TRUE;
00173
00174         page2.StoreValues();
00175         gCvsPrefs.SetHideCommandDlgAnnotate(pages.GetHideCommandDlg());
00176         userHitOK = true;
00177     }
00178 #endif /* WIN32 */
00179
00180 #ifdef qMacCvsPP
00181 #endif /* qMacCvsPP */
00182
00183 #if qUnix
00184 #endif // qUnix
00185
00186     if(userHitOK)
00187     {
00188         if(hasRev)
00189             rev = sLastRev;
00190         bIsDate = isDate;
00191
00192         gCvsPrefs.save();
00193     }
00194
00195     return userHitOK;
00196 }

Variable Documentation

CMString gDateNames

Definition at line 39 of file AnnotateDlg.h.

CMString gRevNames

Definition at line 38 of file AnnotateDlg.h.

Generated on Sun Oct 21 12:41:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AppConsole.cpp File Reference

common/AppConsole.cpp File Reference

#include "stdafx.h"
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include "AppConsole.h"

Include dependency graph for AppConsole.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void | cvs_out (const char *format,...)
void | cvs_err (const char *format,...)
void | cvs_outstr (const char *str, size_t len)
void | cvs_errstr (const char *str, size_t len)

Function Documentation

void cvs_err | ( | const char * | format,
 |  | ... |
 | ) |

Definition at line 90 of file AppConsole.cpp.

00091 {
00092     va_list args;
00093     char mess[1024] = {'\0'};
00094
00095     va_start (args, format);
00096     vsprintf (mess, format, args);
00097     va_end (args);
00098
00099 #ifdef WIN32
00100     CWinApp* app = AfxGetApp();
00101     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00102     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00103     if(view == NULL)
00104         return;
00105
00106     view->OutConsole(mess, strlen(mess), true);
00107 #endif /* WIN32 */
00108 #ifdef qMacCvsPP
00109     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00110     if(log == 0L)
00111         return;
00112     log->WriteCharsToConsole(mess, strlen(mess), true);
00113 #endif /* qMacCvsPP */
00114 #ifdef qUnix
00115     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00116     if(console == 0L)
00117     {
00118         UAppConsole(mess);
00119         return;
00120     }
00121
00122     console->OutConsole(mess, strlen(mess), true);
00123 #endif /* qUnix */
00124 }

void cvs_errstr | ( | const char * | str,
 |  | size_t | len
 | ) |

Definition at line 155 of file AppConsole.cpp.

00156 {
00157 #ifdef WIN32
00158     CWinApp* app = AfxGetApp();
00159     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00160     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00161     if(view == NULL)
00162         return;
00163
00164     view->OutConsole(str, len, true);
00165 #endif /* WIN32 */
00166 #ifdef qMacCvsPP
00167     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00168     if(log == 0L)
00169         return;
00170     log->WriteCharsToConsole(str, len, true);
00171 #endif /* qMacCvsPP */
00172 #ifdef qUnix
00173     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00174     if(console == 0L)
00175     {
00176         UAppConsole(str);
00177         return;
00178     }
00179
00180     console->OutConsole(str, len, true);
00181 #endif /* qUnix */
00182 }

void cvs_out | ( | const char * | format,
 |  | ... |
 | ) |

Definition at line 54 of file AppConsole.cpp.

00055 {
00056     va_list args;
00057     char mess[1024] = {'\0'};
00058
00059     va_start (args, format);
00060     vsprintf (mess, format, args);
00061     va_end (args);
00062
00063 #ifdef WIN32
00064     CWinApp* app = AfxGetApp();
00065     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00066     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00067     if(view == NULL)
00068         return;
00069
00070     view->OutConsole(mess, strlen(mess));
00071 #endif /* WIN32 */
00072 #ifdef qMacCvsPP
00073     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00074     if(log == 0L)
00075         return;
00076     log->WriteCharsToConsole(mess, strlen(mess));
00077 #endif /* qMacCvsPP */
00078 #ifdef qUnix
00079     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00080     if(console == 0L)
00081     {
00082         UAppConsole(mess);
00083         return;
00084     }
00085
00086     console->OutConsole(mess, strlen(mess));
00087 #endif /* qUnix */
00088 }

void cvs_outstr | ( | const char * | str,
 |  | size_t | len
 | ) |

Definition at line 126 of file AppConsole.cpp.

00127 {
00128 #ifdef WIN32
00129     CWinApp* app = AfxGetApp();
00130     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00131     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00132     if(view == NULL)
00133         return;
00134
00135     view->OutConsole(str, len);
00136 #endif /* WIN32 */
00137 #ifdef qMacCvsPP
00138     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00139     if(log == 0L)
00140         return;
00141     log->WriteCharsToConsole(str, len);
00142 #endif /* qMacCvsPP */
00143 #ifdef qUnix
00144     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00145     if(console == 0L)
00146     {
00147         UAppConsole(str);
00148         return;
00149     }
00150
00151     console->OutConsole(str, len);
00152 #endif /* qUnix */
00153 }

Generated on Sun Oct 21 12:41:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AppConsole.h File Reference

common/AppConsole.h File Reference

#include <stdio.h>

Include dependency graph for AppConsole.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CColorConsole

Enumerations

enum kConsoleColor {
kNormal, kBrown, kGreen, kMagenta,
kRed, kBlue, kBold, kItalic,
kUnderline, kNL
}

Functions

void | cvs_out (const char *format,...)
void | cvs_err (const char *format,...)
void | cvs_outstr (const char *str, size_t len)
void | cvs_errstr (const char *str, size_t len)

Enumeration Type Documentation

enum kConsoleColor

Enumeration values:
kNormal
kBrown
kGreen
kMagenta
kRed
kBlue
kBold
kItalic
kUnderline
kNL

Definition at line 35 of file AppConsole.h.

Referenced by PyColorConsole::Print().

00036 {
00037     kNormal,
00038     kBrown,
00039     kGreen,
00040     kMagenta,
00041     kRed,
00042     kBlue,
00043     kBold,
00044     kItalic,
00045     kUnderline,
00046     kNL // newline
00047 } kConsoleColor;

Function Documentation

void cvs_err | ( | const char * | format,
 |  | ... |
 | ) |

Definition at line 90 of file AppConsole.cpp.

Referenced by AskCreatePersistentSettings(), BuildIgnoredList(), CPython_Interp::CPython_Interp(), CTcl_Interp::CTcl_Interp(), CompatEndMoveToTrash(), CompatMoveToTrash(), CvsCmdAddFolder(), CvsCmdLogin(), CvsCmdLogout(), CvsCmdReleaseFolder(), CvsLogParse(), CBrowseFileView::EditSel(), UCvsFiles::EditSel(), Entries_Open(), Entries_SetVisited(), FileTimeToUnixTime(), FileTraverse(), FillBuffer(), AuthenModel::GetInstance(), CWincvsApp::InitInstance(), CLogoutThread::InitInstance(), InitializeInterp(), LaunchDiff(), LaunchViewer(), CPersistent::LoadAll(), MakeTmpFile(), UCvsFolders::OnCmdExplore(), UCvsFiles::OnCmdExplore(), UCvsFiles::OnCmdTrash(), CFindSettings::OnError(), MacroTraversal::OnError(), MacroTraversal::OnFile(), KoMoveToTrashHandler::OnFiles(), CBrowseFileView::OnInitialUpdate(), CWinCvsBrowser::OnViewExplore(), CBrowseFileView::OnViewExplore(), ReadIgnoredFile(), CPersistent::SaveAll(), CWincvsApp::SaveAllModified(), CPersistent::SaveAllSettings(), UCvsApp::SayWelcome(), UCvsFolders::SetDefaultRoot(), CGraphDoc::SetNode(), SettingsGetLoc(), Tag_Open(), UCvsApp::UCvsApp(), UCvsGraph::UCvsGraph(), _loadPersistentSettings(), RemoveCvsArgs::addfile(), AddBinCvsArgs::addfile(), AddCvsArgs::addfile(), decodeCVS(), fgetentent(), glue_getenv(), launchCVS(), list_add_type(), list_add_warning(), loadCVS(), loadSettingsInternal(), mystrdup(), tclSafeRemove(), Authen::tokenToKind(), and unmodified().

00091 {
00092     va_list args;
00093     char mess[1024] = {'\0'};
00094
00095     va_start (args, format);
00096     vsprintf (mess, format, args);
00097     va_end (args);
00098
00099 #ifdef WIN32
00100     CWinApp* app = AfxGetApp();
00101     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00102     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00103     if(view == NULL)
00104         return;
00105
00106     view->OutConsole(mess, strlen(mess), true);
00107 #endif /* WIN32 */
00108 #ifdef qMacCvsPP
00109     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00110     if(log == 0L)
00111         return;
00112     log->WriteCharsToConsole(mess, strlen(mess), true);
00113 #endif /* qMacCvsPP */
00114 #ifdef qUnix
00115     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00116     if(console == 0L)
00117     {
00118         UAppConsole(mess);
00119         return;
00120     }
00121
00122     console->OutConsole(mess, strlen(mess), true);
00123 #endif /* qUnix */
00124 }

void cvs_errstr | ( | const char * | str,
 |  | size_t | len
 | ) |

Definition at line 155 of file AppConsole.cpp.

Referenced by CTcl_Interp::DoFile(), CTcl_Interp::DoScript(), CRevisionConsole::cvs_err(), CStreamConsole::cvs_err(), cvsgui_write(), glue_consoleerr(), and tclCvsErrProc().

00156 {
00157 #ifdef WIN32
00158     CWinApp* app = AfxGetApp();
00159     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00160     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00161     if(view == NULL)
00162         return;
00163
00164     view->OutConsole(str, len, true);
00165 #endif /* WIN32 */
00166 #ifdef qMacCvsPP
00167     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00168     if(log == 0L)
00169         return;
00170     log->WriteCharsToConsole(str, len, true);
00171 #endif /* qMacCvsPP */
00172 #ifdef qUnix
00173     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00174     if(console == 0L)
00175     {
00176         UAppConsole(str);
00177         return;
00178     }
00179
00180     console->OutConsole(str, len, true);
00181 #endif /* qUnix */
00182 }

void cvs_out | ( | const char * | format,
 |  | ... |
 | ) |

Definition at line 54 of file AppConsole.cpp.

Referenced by CompatEndMoveToTrash(), CompatGetPrefs(), ImportReport::EnterDirectory(), CWincvsApp::InitInstance(), CWincvsApp::OnAppCopyrights(), CWincvsApp::OnAppCredits(), UCvsFrame::OnCmdStopcvs(), UCvsFiles::OnCmdTrash(), UCvsFrame::OnCopyrights(), UCvsFrame::OnCredits(), CMainFrame::OnDropFiles(), KoMoveToTrashHandler::OnFiles(), CWincvsDoc::OnStopcvs(), CWincvsDoc::OnUsePyshell(), CWincvsDoc::OnUseTclshell(), UCvsApp::SayWelcome(), RemoveCvsArgs::addfile(), AddBinCvsArgs::addfile(), AddCvsArgs::addfile(), glue_exit(), and CvsArgs::print().

00055 {
00056     va_list args;
00057     char mess[1024] = {'\0'};
00058
00059     va_start (args, format);
00060     vsprintf (mess, format, args);
00061     va_end (args);
00062
00063 #ifdef WIN32
00064     CWinApp* app = AfxGetApp();
00065     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00066     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00067     if(view == NULL)
00068         return;
00069
00070     view->OutConsole(mess, strlen(mess));
00071 #endif /* WIN32 */
00072 #ifdef qMacCvsPP
00073     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00074     if(log == 0L)
00075         return;
00076     log->WriteCharsToConsole(mess, strlen(mess));
00077 #endif /* qMacCvsPP */
00078 #ifdef qUnix
00079     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00080     if(console == 0L)
00081     {
00082         UAppConsole(mess);
00083         return;
00084     }
00085
00086     console->OutConsole(mess, strlen(mess));
00087 #endif /* qUnix */
00088 }

void cvs_outstr | ( | const char * | str,
 |  | size_t | len
 | ) |

Definition at line 126 of file AppConsole.cpp.

Referenced by CvsLogParse(), CTcl_Interp::DoFile(), CTcl_Interp::DoScript(), LogWrite(), cvsgui_write(), glue_consoleout(), CvsArgs::print(), and tclCvsOutProc().

00127 {
00128 #ifdef WIN32
00129     CWinApp* app = AfxGetApp();
00130     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00131     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00132     if(view == NULL)
00133         return;
00134
00135     view->OutConsole(str, len);
00136 #endif /* WIN32 */
00137 #ifdef qMacCvsPP
00138     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00139     if(log == 0L)
00140         return;
00141     log->WriteCharsToConsole(str, len);
00142 #endif /* qMacCvsPP */
00143 #ifdef qUnix
00144     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00145     if(console == 0L)
00146     {
00147         UAppConsole(str);
00148         return;
00149     }
00150
00151     console->OutConsole(str, len);
00152 #endif /* qUnix */
00153 }

Generated on Sun Oct 21 12:41:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AppGlue.cpp File Reference

common/AppGlue.cpp File Reference

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <vector>
#include "Authen.h"
#include "CvsPrefs.h"
#include "AppGlue.h"
#include "AppConsole.h"
#include "GetPassword.h"
#include "AskYesNo.h"
#include "CvsArgs.h"
#include "FileTraversal.h"

Include dependency graph for AppGlue.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CAuthenSetUp
class | CStreamConsole
class | CTmpFiles

Defines

#define | CVS_EXTERN_C

Functions

void | glue_exit (int code)
long | glue_consoleout (char *txt, long len)
long | glue_consoleerr (char *txt, long len)
long | glue_consolein (char *txt, long len)
const char * | glue_getenv (char *name)
int | launchCVS (const char *path, int argc, char *const *argv, CCvsConsole *console)
FILE * | launchCVS (const char *dir, const CvsArgs &args, UStr &tmpFile, const char *prefix, const char *extension)
const char * | launchCVS (const char *dir, const CvsArgs &args, const char *prefix, const char *extension)

Variables

CCvsConsole * | gConsole = 0L
int | sLastExitCode
CTmpFiles sTmpList

Define Documentation

#define CVS_EXTERN_C

Definition at line 103 of file AppGlue.cpp.

Function Documentation

long glue_consoleerr | ( | char * | txt,
 |  | long | len
 | ) |

Definition at line 139 of file AppGlue.cpp.

00140 {
00141     if(gConsole != 0L)
00142         return gConsole->cvs_err(txt, len);
00143
00144 #ifdef macintosh
00145     // apple event output
00146     long newlen;
00147     if((newlen = ae_consoleout(txt, len)) != -1)
00148         return newlen;
00149 #endif
00150
00151     cvs_errstr(txt, len);
00152
00153     return len;
00154 }

long glue_consolein | ( | char * | txt,
 |  | long | len
 | ) |

Definition at line 156 of file AppGlue.cpp.

00157 {
00158 #ifdef macintosh
00159     // apple event input
00160     long newlen;
00161     if((newlen = ae_consolein(txt, len)) != -1)
00162         return newlen;
00163 #endif /* !macintosh */
00164
00165     return 0;
00166 }

long glue_consoleout | ( | char * | txt,
 |  | long | len
 | ) |

Definition at line 122 of file AppGlue.cpp.

00123 {
00124     if(gConsole != 0L)
00125         return gConsole->cvs_out(txt, len);
00126
00127 #ifdef macintosh
00128     // apple event output
00129     long newlen;
00130     if((newlen = ae_consoleout(txt, len)) != -1)
00131         return newlen;
00132 #endif
00133
00134     cvs_outstr(txt, len);
00135
00136     return len;
00137 }

void glue_exit ( int code )

Definition at line 115 of file AppGlue.cpp.

00116 {
00117     if(!gCvsPrefs.IsTclFileRunning())
00118         cvs_out("\n*****CVS exited normally with code %d*****\n\n", code);
00119     sLastExitCode = code;
00120 }

const char* glue_getenv ( char * name )

Definition at line 186 of file AppGlue.cpp.

00187 {
00188     if(name == NULL)
00189         return NULL;
00190
00191 #ifdef WIN32
00192     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00193     if(::GetCurrentThreadId() != app->m_nThreadID &&
00194         (strcmp(name, "CVS_GETPASS") == 0 || strcmp(name, "CVSLIB_YESNO") == 0 ||
00195         strcmp(name, "HOME") == 0))
00196     {
00197         // synchonize it since the thread calls and
00198         // we call some MFC objects in it (prompt
00199         // password, get path...)
00200         CCvsThreadLock threadLock;
00201
00202         return app->GetEnvMainThread(name);
00203     }
00204 #endif /* WIN32 */
00205
00206 #ifdef macintosh
00207     char *result;
00208     if((result = ae_getenv(name)) != (char *)-1)
00209     {
00210         if(result == 0L && isGlobalEnvVariable(name))
00211         {
00212             // in this case only we let continue
00213             // to get the MacCVS settings. So the CWCVS
00214             // users (or any AppleEvent user) can set
00215             // these variables in MacCVS but still can overide
00216             // them using Apple Events.
00217         }
00218         else
00219             return result;
00220     }
00221 #endif /* macintosh */
00222
00223     // new : give a chance for the new AuthenModel to react to the getenv
00224     // callback
00225     AuthenModel *curModel = AuthenModel::GetInstance(gAuthen.kind());
00226     std::vector<AuthenModel *> & allInstances = AuthenModel::GetAllInstances();
00227     std::vector<AuthenModel *>::const_iterator i;
00228
00229     if(curModel != 0L)
00230     {
00231         const char *res = curModel->OnGetEnv(name);
00232         if(res != 0L)
00233             return res;
00234     }
00235
00236     for(i = allInstances.begin(); i != allInstances.end(); ++i)
00237     {
00238         AuthenModel *model = *i;
00239
00240         if(model == curModel)
00241             continue;
00242
00243         const char *res = model->OnGetEnv(name);
00244         if(res != 0L)
00245             return res;
00246     }
00247
00248     if(strcmp(name, "USER") == 0
00249 #ifdef WIN32
00250         // I do that (and see the "STRATA_HACK" in
00251         // subr.c) because people get tired on Windows
00252         // to have to check their Windows login :
00253         // this is only for .rhosts authentication.
00254         || strcmp(name, "LOGNAME") == 0
00255 #endif /* WIN32 */
00256         )
00257     {
00258         static char user[64];
00259
00260         // extract from the cvsroot
00261         const char *ccvsroot = gCvsPrefs;
00262         ccvsroot = Authen::skiptoken(ccvsroot);
00263         char *login = strchr(ccvsroot, '@');
00264         if(login == NULL)
00265         {
00266             // for WIN32 this means the CVSROOT is local
00267 #ifdef macintosh
00268             cvs_err("MacCvs: Cannot extract login from cvsroot %s !\n", ccvsroot);
00269 #endif /* macintosh */
00270             return NULL;
00271         }
00272         int length = login - ccvsroot;
00273         memcpy(user, ccvsroot, length * sizeof(char));
00274         user[length] = '\0';
00275         return user;
00276     }
00277     else if(strcmp(name, "CVSROOT") == 0)
00278     {
00279         static CStr root;
00280
00281         // extract from the cvsroot
00282         const char *ccvsroot = gCvsPrefs;
00283         ccvsroot = Authen::skiptoken(ccvsroot);
00284         root = gAuthen.token();
00285         root << ccvsroot;
00286         return root;
00287     }
00288     else if(strcmp(name, "CVSREAD") == 0)
00289     {
00290         return gCvsPrefs.CheckoutRO() ? (char *)"1" : 0L;
00291     }
00292     else if(strncmp(name, "CVS_GETPASS", strlen("CVS_GETPASS")) == 0)
00293     {
00294         UStr str("Enter the password:");
00295         char *tmp;
00296         if((tmp = strchr(name, '=')) != 0L)
00297         {
00298             str = ++tmp;
00299         }
00300         return CompatGetPassword(str);
00301     }
00302     else if(strcmp(name, "CVSLIB_YESNO") == 0)
00303     {
00304         return (char *)AskYesNo();
00305     }
00306     else if(strcmp(name, "DIRTY_MCP") == 0)
00307     {
00308         return gCvsPrefs.DirtySupport() ? (char *)"yes" : (char *)"no";
00309     }
00310 #ifdef WIN32
00311     else if(strcmp(name, "HOME") == 0)
00312     {
00313         // prompt for home the first time
00314         if(gCvsPrefs.Home() == 0L)
00315         {
00316             char oldpath[512];
00317             getcwd(oldpath, 511);
00318             const char *chome = BrowserGetDirectory("Select your home directory :");
00319             if(chome == 0L)
00320             {
00321                 chdir(oldpath);
00322                 return 0L;
00323             }
00324
00325             gCvsPrefs.SetHome(chome);
00326             gCvsPrefs.save();
00327             chdir(oldpath);
00328         }
00329
00330         // Windows 98 doesn't like C:\/.cvspass
00331         static CStr home;
00332         home = gCvsPrefs.Home();
00333         if(home.endsWith(kPathDelimiter))
00334         {
00335             home[home.length() - 1] = '\0';
00336         }
00337
00338         return home;
00339     }
00340     else if(strcmp(name, "CVSUSEUNIXLF") == 0)
00341     {
00342         return gCvsPrefs.UnixLF() ? (char *)"1" : 0L;
00343     }
00344 #endif /*WIN32 */
00345 #ifdef macintosh
00346     else if(strcmp(name, "HOME") == 0)
00347     {
00348         FSSpec theFolder;
00349         static char thePath[256];
00350         Str255 aPath;
00351
00352         if(MacGetPrefsFolder(theFolder, aPath) != noErr)
00353         {
00354             cvs_err("Unable to locate the preferences folder !\n");
00355             return 0L;
00356         }
00357
00358         // We do not use any more the "@@@" trick. Instead
00359         // we let cvs convert it to a Unix path.
00360         //strcpy(thePath, "@@@");
00361         p2cstrcpy(thePath, aPath);
00362         return thePath;
00363     }
00364     else if(strcmp(name, "ISO8859") == 0)
00365     {
00366         static char iso[6];
00367
00368         if(gCvsPrefs.IsoConvert() == ISO8559_none)
00369             return 0L;
00370
00371         sprintf(iso, "%d", (int)gCvsPrefs.IsoConvert());
00372         return iso;
00373     }
00374     else if(strcmp(name, "IC_ON_TXT") == 0)
00375     {
00376         return gCvsPrefs.ICTextOption() ? (char *)"1" : 0L;
00377     }
00378     else if(strcmp(name, "MAC_DEFAULT_RESOURCE_ENCODING") == 0)
00379     {
00380         switch(gCvsPrefs.MacBinEncoding())
00381         {
00382             case MAC_HQX:
00383                 return (char *)"HQX";
00384                 break;
00385             case MAC_APPSINGLE:
00386                 return (char *)"AppleSingle";
00387                 break;
00388         }
00389         return 0L;
00390     }
00391 #   ifdef qMacCvsPP
00392     else if(strcmp(name, "MAC_BINARY_TYPES_SINGLE") == 0)
00393     {
00394         return (char *)MacBinMaps::GetEnvTypes(MAC_APPSINGLE);
00395     }
00396     else if(strcmp(name, "MAC_BINARY_TYPES_HQX") == 0)
00397     {
00398         return (char *)MacBinMaps::GetEnvTypes(MAC_HQX);
00399     }
00400     else if(strcmp(name, "MAC_BINARY_TYPES_PLAIN") == 0)
00401     {
00402         return (char *)MacBinMaps::GetEnvPlainTypes();
00403     }
00404 #   endif /* qMacCvsPP */
00405 #endif /* macintosh */
00406     else
00407         return getenv(name);
00408
00409     return NULL;
00410 }

const char* launchCVS | ( | const char * | dir,
 |  | const CvsArgs & | args,
 |  | const char * | prefix = 0L,
 |  | const char * | extension = 0L
 | ) |

Definition at line 639 of file AppGlue.cpp.

00640 {
00641     CStr filename;
00642     FILE *file = launchCVS(dir, args, filename, prefix, extension);
00643     if(file == 0L)
00644         return 0L;
00645
00646     fclose(file);
00647     return sTmpList.push_back(filename);
00648 }

FILE* launchCVS | ( | const char * | dir,
 |  | const CvsArgs & | args,
 |  | UStr & | tmpFile,
 |  | const char * | prefix = 0L,
 |  | const char * | extension = 0L
 | ) |

Definition at line 595 of file AppGlue.cpp.

00596 {
00597     if(!MakeTmpFile(tmpFile, prefix, extension))
00598         return 0L;
00599
00600     FILE * res = fopen(tmpFile, "w+");
00601     if(res == 0L)
00602     {
00603         cvs_err("Impossible to open for write the temp file '%s' (error %d)",
00604             (const char *)tmpFile, errno);
00605         return 0L;
00606     }
00607
00608     CStreamConsole myconsole(res);
00609
00610     launchCVS(dir, args.Argc(), args.Argv(), &myconsole);
00611
00612     fseek(res, 0L, SEEK_SET);
00613
00614     return res;
00615 }

int launchCVS | ( | const char * | path,
 |  | int | argc,
 |  | char *const * | argv,
 |  | CCvsConsole * | console = 0L
 | ) |

Definition at line 430 of file AppGlue.cpp.

00431 {
00432     CAuthenSetUp setupEnv;
00433
00434     gConsole = console;
00435
00436 #ifdef macintosh
00437     CompatConnectID connID;
00438
00439     if(!loadCVS(connID))
00440         return errInternal;
00441
00442     int exitc = 0;
00443
00444     // call the main
00445     if(!CompatCallLibrary3(connID, exitc, uppMainProcInfo, "dllglue_main",
00446         dllglue_main_func, path, argc, (char **)argv))
00447     {
00448         cvs_err("Error : Cannot find symbol ""dllglue_main""\n");
00449         exitc = errInternal;
00450     }
00451
00452     unloadCVS(connID, exitc);
00453
00454     return exitc;
00455 #elif qUnix
00456     CStr cvscmd;
00457
00458     sLastExitCode = 0;
00459
00460     if(UCvsApp::gApp->IsCvsRunning())
00461     {
00462         cvs_err("Error : cvs is already running !\n");
00463         return errInternal;
00464     }
00465
00466     if(path != 0L && chdir(path) != 0)
00467     {
00468         cvs_err("Error : cannot chdir to %s (error %d)!\n", path, errno);
00469     }
00470
00471     UCvsApp::gApp->SetCvsStopping(false);
00472
00473     struct stat sb;
00474     cvscmd = UCvsApp::gApp->GetAppLibFolder();
00475     if(!cvscmd.endsWith(kPathDelimiter))
00476         cvscmd << kPathDelimiter;
00477     cvscmd << "cvs";
00478     UStr firstCmd = cvscmd;
00479     if(stat(cvscmd, &sb) == -1 || !(S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode)))
00480     {
00481         cvscmd = PACKAGE_SOURCE_DIR;
00482         CStr uppath, folder;
00483         SplitPath(cvscmd, uppath, folder);
00484         cvscmd = uppath;
00485         if(!cvscmd.endsWith(kPathDelimiter))
00486             cvscmd << kPathDelimiter;
00487         cvscmd << "cvsunix/src/cvs";
00488     }
00489
00490     if(stat(cvscmd, &sb) == -1 || !(S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode)))
00491     {
00492         cvs_err("Unable to find the cvs process in : (error %d)\n", errno);
00493         cvs_err("1) %s\n", (const char *)firstCmd);
00494         cvs_err("2) %s\n", (const char *)cvscmd);
00495     }
00496
00497     CvsProcess *proc = cvs_process_open(cvscmd, argc - 1, (char **)argv + 1, &sCallTable, false, 0L);
00498     if(proc == 0L)
00499     {
00500         cvs_err("Unable to initialize the cvs process (error %d)\n", errno);
00501         cvs_err("The cvs used is : %s\n", (const char *)cvscmd);
00502     }
00503     else if(console != 0L)
00504     {
00505         while(1)
00506         {
00507             cvs_process_give_time();
00508             if(!cvs_process_is_active(proc))
00509                 break;
00510         }
00511     }
00512     else
00513     {
00514         UCvsApp::gApp->SetCvsRunning(true);
00515         UCvsApp::gCurCvs = proc;
00516     }
00517
00518     return sLastExitCode;
00519 #elif defined(WIN32)
00520     CStr cvscmd;
00521
00522     sLastExitCode = 0;
00523
00524     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00525     if(app->gCvsRunning)
00526     {
00527         cvs_err("Error : cvs is already running !\n");
00528         return -1;
00529     }
00530
00531 //Jerzy - we don't want to chdir, on windows we can use the "currentDirectory" parameter
00532 #if 0
00533     if(path != 0L && chdir(path) != 0)
00534     {
00535         cvs_err("Error : cannot chdir to %s (error %d)!\n", path, errno);
00536     }
00537 #endif
00538
00539     app->gCvsStopping = false;
00540
00541     gCvsPrefs.WhichCvs(cvscmd);
00542
00543     struct stat sb;
00544     if(stat(cvscmd, &sb) == -1 || !(S_ISREG(sb.st_mode)))
00545     {
00546         cvs_err("Unable to find the cvs process in : (error %d)\n", errno);
00547         cvs_err("1) %s\n", (const char *)cvscmd);
00548     }
00549
00550     CvsProcess *proc = cvs_process_open(cvscmd, argc - 1, (char **)argv + 1,
00551         &sCallTable, gCvsPrefs.CvsConsole(), path);
00552     if(proc == 0L)
00553     {
00554         cvs_err("Unable to initialize the cvs process (error %d)\n", errno);
00555         cvs_err("The cvs used is : %s\n", (const char *)cvscmd);
00556     }
00557     else
00558     {
00559         app->gCvsRunning = true;
00560         app->gCvsProcess = proc;
00561         if(console != 0L)
00562         {
00563             while(1)
00564             {
00565                 app->PumpMessage();
00566                 if(!cvs_process_is_active(proc))
00567                     break;
00568             }
00569         }
00570     }
00571
00572     return sLastExitCode;
00573 #endif
00574 }

Variable Documentation

CCvsConsole* gConsole = 0L

Definition at line 97 of file AppGlue.cpp.

int sLastExitCode [static]

Definition at line 98 of file AppGlue.cpp.

class CTmpFiles sTmpList

Generated on Sun Oct 21 12:41:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AppGlue.h File Reference

common/AppGlue.h File Reference

#include <stdio.h>

Include dependency graph for AppGlue.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCvsConsole

Defines

#define | errInternal -99
#define | errThreadRunning -98
#define | WaitForCvs()

Functions

int | launchCVS (const char *path, int argc, char *const *argv, CCvsConsole *console=0L)
FILE * | launchCVS (const char *dir, const CvsArgs &args, UStr &tmpFile, const char *prefix=0L, const char *extension=0L)
const char * | launchCVS (const char *dir, const CvsArgs &args, const char *prefix=0L, const char *extension=0L)
long | glue_consoleout (char *txt, long len)
long | glue_consoleerr (char *txt, long len)
long | glue_consolein (char *txt, long len)
const char * | glue_getenv (char *name)
void | glue_exit (int code)

Variables

CCvsConsole * gConsole

Define Documentation

#define WaitForCvs ( )

Definition at line 73 of file AppGlue.h.

Referenced by CvsCmdLogin(), and CWincvsApp::SaveAllModified().

#define errInternal -99

Definition at line 37 of file AppGlue.h.

#define errThreadRunning -98

Definition at line 38 of file AppGlue.h.

Function Documentation

long glue_consoleerr | ( | char * | txt,
 |  | long | len
 | ) |

Definition at line 139 of file AppGlue.cpp.

Referenced by GUSIMSL_WriteErrHook().

00140 {
00141     if(gConsole != 0L)
00142         return gConsole->cvs_err(txt, len);
00143
00144 #ifdef macintosh
00145     // apple event output
00146     long newlen;
00147     if((newlen = ae_consoleout(txt, len)) != -1)
00148         return newlen;
00149 #endif
00150
00151     cvs_errstr(txt, len);
00152
00153     return len;
00154 }

long glue_consolein | ( | char * | txt,
 |  | long | len
 | ) |

Definition at line 156 of file AppGlue.cpp.

00157 {
00158 #ifdef macintosh
00159     // apple event input
00160     long newlen;
00161     if((newlen = ae_consolein(txt, len)) != -1)
00162         return newlen;
00163 #endif /* !macintosh */
00164
00165     return 0;
00166 }

long glue_consoleout | ( | char * | txt,
 |  | long | len
 | ) |

Definition at line 122 of file AppGlue.cpp.

Referenced by GUSIMSL_WriteConsoleHook().

00123 {
00124     if(gConsole != 0L)
00125         return gConsole->cvs_out(txt, len);
00126
00127 #ifdef macintosh
00128     // apple event output
00129     long newlen;
00130     if((newlen = ae_consoleout(txt, len)) != -1)
00131         return newlen;
00132 #endif
00133
00134     cvs_outstr(txt, len);
00135
00136     return len;
00137 }

void glue_exit ( int code )

Definition at line 115 of file AppGlue.cpp.

Referenced by unloadCVS().

00116 {
00117     if(!gCvsPrefs.IsTclFileRunning())
00118         cvs_out("\n*****CVS exited normally with code %d*****\n\n", code);
00119     sLastExitCode = code;
00120 }

const char* glue_getenv ( char * name )

Definition at line 186 of file AppGlue.cpp.

Referenced by CMainFrame::OnTimer().

00187 {
00188     if(name == NULL)
00189         return NULL;
00190
00191 #ifdef WIN32
00192     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00193     if(::GetCurrentThreadId() != app->m_nThreadID &&
00194         (strcmp(name, "CVS_GETPASS") == 0 || strcmp(name, "CVSLIB_YESNO") == 0 ||
00195         strcmp(name, "HOME") == 0))
00196     {
00197         // synchonize it since the thread calls and
00198         // we call some MFC objects in it (prompt
00199         // password, get path...)
00200         CCvsThreadLock threadLock;
00201
00202         return app->GetEnvMainThread(name);
00203     }
00204 #endif /* WIN32 */
00205
00206 #ifdef macintosh
00207     char *result;
00208     if((result = ae_getenv(name)) != (char *)-1)
00209     {
00210         if(result == 0L && isGlobalEnvVariable(name))
00211         {
00212             // in this case only we let continue
00213             // to get the MacCVS settings. So the CWCVS
00214             // users (or any AppleEvent user) can set
00215             // these variables in MacCVS but still can overide
00216             // them using Apple Events.
00217         }
00218         else
00219             return result;
00220     }
00221 #endif /* macintosh */
00222
00223     // new : give a chance for the new AuthenModel to react to the getenv
00224     // callback
00225     AuthenModel *curModel = AuthenModel::GetInstance(gAuthen.kind());
00226     std::vector<AuthenModel *> & allInstances = AuthenModel::GetAllInstances();
00227     std::vector<AuthenModel *>::const_iterator i;
00228
00229     if(curModel != 0L)
00230     {
00231         const char *res = curModel->OnGetEnv(name);
00232         if(res != 0L)
00233             return res;
00234     }
00235
00236     for(i = allInstances.begin(); i != allInstances.end(); ++i)
00237     {
00238         AuthenModel *model = *i;
00239
00240         if(model == curModel)
00241             continue;
00242
00243         const char *res = model->OnGetEnv(name);
00244         if(res != 0L)
00245             return res;
00246     }
00247
00248     if(strcmp(name, "USER") == 0
00249 #ifdef WIN32
00250         // I do that (and see the "STRATA_HACK" in
00251         // subr.c) because people get tired on Windows
00252         // to have to check their Windows login :
00253         // this is only for .rhosts authentication.
00254         || strcmp(name, "LOGNAME") == 0
00255 #endif /* WIN32 */
00256         )
00257     {
00258         static char user[64];
00259
00260         // extract from the cvsroot
00261         const char *ccvsroot = gCvsPrefs;
00262         ccvsroot = Authen::skiptoken(ccvsroot);
00263         char *login = strchr(ccvsroot, '@');
00264         if(login == NULL)
00265         {
00266             // for WIN32 this means the CVSROOT is local
00267 #ifdef macintosh
00268             cvs_err("MacCvs: Cannot extract login from cvsroot %s !\n", ccvsroot);
00269 #endif /* macintosh */
00270             return NULL;
00271         }
00272         int length = login - ccvsroot;
00273         memcpy(user, ccvsroot, length * sizeof(char));
00274         user[length] = '\0';
00275         return user;
00276     }
00277     else if(strcmp(name, "CVSROOT") == 0)
00278     {
00279         static CStr root;
00280
00281         // extract from the cvsroot
00282         const char *ccvsroot = gCvsPrefs;
00283         ccvsroot = Authen::skiptoken(ccvsroot);
00284         root = gAuthen.token();
00285         root << ccvsroot;
00286         return root;
00287     }
00288     else if(strcmp(name, "CVSREAD") == 0)
00289     {
00290         return gCvsPrefs.CheckoutRO() ? (char *)"1" : 0L;
00291     }
00292     else if(strncmp(name, "CVS_GETPASS", strlen("CVS_GETPASS")) == 0)
00293     {
00294         UStr str("Enter the password:");
00295         char *tmp;
00296         if((tmp = strchr(name, '=')) != 0L)
00297         {
00298             str = ++tmp;
00299         }
00300         return CompatGetPassword(str);
00301     }
00302     else if(strcmp(name, "CVSLIB_YESNO") == 0)
00303     {
00304         return (char *)AskYesNo();
00305     }
00306     else if(strcmp(name, "DIRTY_MCP") == 0)
00307     {
00308         return gCvsPrefs.DirtySupport() ? (char *)"yes" : (char *)"no";
00309     }
00310 #ifdef WIN32
00311     else if(strcmp(name, "HOME") == 0)
00312     {
00313         // prompt for home the first time
00314         if(gCvsPrefs.Home() == 0L)
00315         {
00316             char oldpath[512];
00317             getcwd(oldpath, 511);
00318             const char *chome = BrowserGetDirectory("Select your home directory :");
00319             if(chome == 0L)
00320             {
00321                 chdir(oldpath);
00322                 return 0L;
00323             }
00324
00325             gCvsPrefs.SetHome(chome);
00326             gCvsPrefs.save();
00327             chdir(oldpath);
00328         }
00329
00330         // Windows 98 doesn't like C:\/.cvspass
00331         static CStr home;
00332         home = gCvsPrefs.Home();
00333         if(home.endsWith(kPathDelimiter))
00334         {
00335             home[home.length() - 1] = '\0';
00336         }
00337
00338         return home;
00339     }
00340     else if(strcmp(name, "CVSUSEUNIXLF") == 0)
00341     {
00342         return gCvsPrefs.UnixLF() ? (char *)"1" : 0L;
00343     }
00344 #endif /*WIN32 */
00345 #ifdef macintosh
00346     else if(strcmp(name, "HOME") == 0)
00347     {
00348         FSSpec theFolder;
00349         static char thePath[256];
00350         Str255 aPath;
00351
00352         if(MacGetPrefsFolder(theFolder, aPath) != noErr)
00353         {
00354             cvs_err("Unable to locate the preferences folder !\n");
00355             return 0L;
00356         }
00357
00358         // We do not use any more the "@@@" trick. Instead
00359         // we let cvs convert it to a Unix path.
00360         //strcpy(thePath, "@@@");
00361         p2cstrcpy(thePath, aPath);
00362         return thePath;
00363     }
00364     else if(strcmp(name, "ISO8859") == 0)
00365     {
00366         static char iso[6];
00367
00368         if(gCvsPrefs.IsoConvert() == ISO8559_none)
00369             return 0L;
00370
00371         sprintf(iso, "%d", (int)gCvsPrefs.IsoConvert());
00372         return iso;
00373     }
00374     else if(strcmp(name, "IC_ON_TXT") == 0)
00375     {
00376         return gCvsPrefs.ICTextOption() ? (char *)"1" : 0L;
00377     }
00378     else if(strcmp(name, "MAC_DEFAULT_RESOURCE_ENCODING") == 0)
00379     {
00380         switch(gCvsPrefs.MacBinEncoding())
00381         {
00382             case MAC_HQX:
00383                 return (char *)"HQX";
00384                 break;
00385             case MAC_APPSINGLE:
00386                 return (char *)"AppleSingle";
00387                 break;
00388         }
00389         return 0L;
00390     }
00391 #   ifdef qMacCvsPP
00392     else if(strcmp(name, "MAC_BINARY_TYPES_SINGLE") == 0)
00393     {
00394         return (char *)MacBinMaps::GetEnvTypes(MAC_APPSINGLE);
00395     }
00396     else if(strcmp(name, "MAC_BINARY_TYPES_HQX") == 0)
00397     {
00398         return (char *)MacBinMaps::GetEnvTypes(MAC_HQX);
00399     }
00400     else if(strcmp(name, "MAC_BINARY_TYPES_PLAIN") == 0)
00401     {
00402         return (char *)MacBinMaps::GetEnvPlainTypes();
00403     }
00404 #   endif /* qMacCvsPP */
00405 #endif /* macintosh */
00406     else
00407         return getenv(name);
00408
00409     return NULL;
00410 }

const char* launchCVS | ( | const char * | dir,
 |  | const CvsArgs & | args,
 |  | const char * | prefix = 0L,
 |  | const char * | extension = 0L
 | ) |

Definition at line 639 of file AppGlue.cpp.

Referenced by CvsCmdAddBinaryFiles(), CvsCmdAddFiles(), CvsCmdAddFolder(), CvsCmdAnnotateFiles(), CvsCmdCancelChangesFiles(), CvsCmdCheckoutModule(), CvsCmdCommitFiles(), CvsCmdCommitFolder(), CvsCmdDiffFiles(), CvsCmdDiffFolder(), CvsCmdEditFiles(), CvsCmdEditFolder(), CvsCmdEditorsFiles(), CvsCmdEditorsFolder(), CvsCmdImportModule(), CvsCmdInit(), CvsCmdLine(), CvsCmdLockFiles(), CvsCmdLockFolder(), CvsCmdLogin(), CvsCmdLogout(), CvsCmdReleaseFolder(), CvsCmdRemoveFiles(), CvsCmdRtagBranch(), CvsCmdRtagCreate(), CvsCmdRtagDelete(), CvsCmdStatusFiles(), CvsCmdStatusFolder(), CvsCmdTagBranchFiles(), CvsCmdTagBranchFolder(), CvsCmdTagCreateFiles(), CvsCmdTagCreateFolder(), CvsCmdTagDeleteFiles(), CvsCmdTagDeleteFolder(), CvsCmdUneditFiles(), CvsCmdUneditFolder(), CvsCmdUnlockFiles(), CvsCmdUnlockFolder(), CvsCmdUpdateFiles(), CvsCmdUpdateFolder(), CvsCmdWatchOffFiles(), CvsCmdWatchOffFolder(), CvsCmdWatchOnFiles(), CvsCmdWatchOnFolder(), CvsCmdWatchersFiles(), CvsCmdWatchersFolder(), CvsLogParse(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnQueryAnnotate(), CGraphView::OnViewDelrev(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewRetrieve(), CGraphView::OnViewTag(), CGraphView::OnViewUnlockf(), CGraphView::OnViewUpdate(), cvsgui_RunCvs(), launchCVS(), run_popen(), and tclCvsProc().

00640 {
00641     CStr filename;
00642     FILE *file = launchCVS(dir, args, filename, prefix, extension);
00643     if(file == 0L)
00644         return 0L;
00645
00646     fclose(file);
00647     return sTmpList.push_back(filename);
00648 }

FILE* launchCVS | ( | const char * | dir,
 |  | const CvsArgs & | args,
 |  | UStr & | tmpFile,
 |  | const char * | prefix = 0L,
 |  | const char * | extension = 0L
 | ) |

int launchCVS | ( | const char * | path,
 |  | int | argc,
 |  | char *const * | argv,
 |  | CCvsConsole * | console = 0L
 | ) |

Variable Documentation

CCvsConsole* gConsole

Definition at line 66 of file AppGlue.h.

Generated on Sun Oct 21 12:41:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AppGlue.mac.cpp File Reference

common/AppGlue.mac.cpp File Reference

#include "stdafx.h"
#include "AppGlue.mac.h"
#include "AppGlue.h"
#include "MacCvsApp.h"
#include "AppConsole.h"
#include "dll_process.h"
#include "GUSIMSLSetup.h"
#include "FileTraversal.h"

Include dependency graph for AppGlue.mac.cpp:

Include dependency graph

Go to the source code of this file.

Functions

int | glue_eventdispatcher (EventRecord *ev)
bool | loadCVS (CompatConnectID &connID)
void | unloadCVS (CompatConnectID connID, int exitc)
int | decodeCVS (char *path)
long | GUSIMSL_WriteConsoleHook (char *buffer, long n)
long | GUSIMSL_WriteErrHook (char *buffer, long n)
int | GUSIMSL_HandleEventHook (EventRecord *ev)

Function Documentation

int GUSIMSL_HandleEventHook ( EventRecord * ev )

Definition at line 217 of file AppGlue.mac.cpp.

00218 {
00219     return glue_eventdispatcher(ev);
00220 }

long GUSIMSL_WriteConsoleHook | ( | char * | buffer,
 |  | long | n
 | ) |

Definition at line 209 of file AppGlue.mac.cpp.

00210 {
00211     return glue_consoleout(buffer, n);
00212 }

long GUSIMSL_WriteErrHook | ( | char * | buffer,
 |  | long | n
 | ) |

Definition at line 213 of file AppGlue.mac.cpp.

00214 {
00215     return glue_consoleerr(buffer, n);
00216 }

int decodeCVS ( char * path )

Definition at line 185 of file AppGlue.mac.cpp.

00186 {
00187     gConsole = 0;
00188
00189     CompatConnectID connID;
00190
00191     if(!loadCVS(connID))
00192         return errInternal;
00193
00194     int exitc = 0;
00195
00196     // call the main
00197     if(!CompatCallLibrary1(connID, exitc, uppDecodeFileProcInfo, "dllglue_decode_file",
00198         dllglue_decode_file_func, path))
00199     {
00200         cvs_err("Error : Cannot find symbol ""dllglue_decode_file""\n");
00201         exitc = errInternal;
00202     }
00203
00204     unloadCVS(connID, exitc);
00205
00206     return exitc;
00207 }

int glue_eventdispatcher ( EventRecord * ev )

Definition at line 34 of file AppGlue.mac.cpp.

00035 {
00036     if(CMacCvsApp::app == 0L || !(CMacCvsApp::app->cvsLoaded || TraversalReport::gRunning))
00037         return 0;
00038
00039     EventRecord localEvent;
00040     if (!ev) {
00041         //  Spin callback
00042         UInt32  kSpinSleep = TraversalReport::gRunning ? CMacCvsApp::app->GetSleepTime() : 6;
00043             // for CWCVS, we want to go fast on background. But for a traversal operation,
00044             // we want to be smooth
00045         static  UInt32  spinTicks = 0;
00046         if ((::TickCount () - spinTicks) < kSpinSleep)
00047             return 0;
00048
00049         ev = &localEvent;
00050         ::WaitNextEvent (everyEvent, ev, kSpinSleep, nil);
00051         spinTicks = ::TickCount ();
00052     } // if
00053
00054     if(ev->what == mouseDown)
00055     {
00056         WindowPtr macWindowP;
00057         SInt16 thePart = ::FindWindow(ev->where, &macWindowP);
00058         switch (thePart)
00059         {
00060             case inDrag:
00061             case inGrow:
00062             case inZoomIn:
00063             case inZoomOut:
00064                 CMacCvsApp::app->DispatchEvent(*ev);
00065                 break;
00066             case inContent:
00067                 if (macWindowP != ::FrontWindow())
00068                 {
00069                     // Clicked Window is not the front one
00070                     LWindow *frontW = LWindow::FetchWindowObject(macWindowP);
00071                     if (frontW != nil && !UDesktop::WindowIsSelected(frontW))
00072                         CMacCvsApp::app->DispatchEvent(*ev);
00073                 }
00074                 break;
00075         }
00076         return 0;
00077     }
00078     else if(ev->what == nullEvent)
00079     {
00080         CMacCvsApp::app->DoSpinCursor();
00081     }
00082     else if(ev->what != keyDown && ev->what != keyUp && ev->what != mouseUp)
00083     {
00084         CMacCvsApp::app->DispatchEvent(*ev);
00085     }
00086     return 0;
00087 }

bool loadCVS ( CompatConnectID & connID )

Definition at line 89 of file AppGlue.mac.cpp.

00090 {
00091     int result = 0;
00092     const char *name_dll2;
00093
00094     // restore it in case it was not restored correctly by lsh
00095     GusiMSLSetWriteConsole(GUSIMSL_WriteConsoleHook);
00096     GusiMSLSetErrConsole(GUSIMSL_WriteErrHook);
00097     GusiMSLSetHandleEvent(GUSIMSL_HandleEventHook);
00098
00099     // get cvs shared library
00100 #if qCarbon
00101 #   if qCvsDebug
00102         name_dll2 = "cvsXDbgLib";
00103 #   else
00104         name_dll2 = "cvsXLib";
00105 #   endif
00106 #else
00107 #   if qCvsDebug
00108         name_dll2 = "cvs2DbgLib";
00109 #   else
00110         name_dll2 = "cvs2Lib";
00111 #   endif
00112 #endif
00113
00114     // open the library
00115     if(!CompatLoadLibrary(&connID, name_dll2))
00116     {
00117         cvs_err("Error: Unable to load the library %s\n", name_dll2);
00118         return false;
00119     }
00120
00121     // set the console out
00122     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setconsoleout",
00123         dllglue_setglue_func, CompatFuncArg(uppConsoleOutProcInfo, glue_consoleout)))
00124     {
00125         cvs_err("Error : Cannot find symbol ""dllglue_setconsoleout""\n");
00126         goto closeandfail;
00127     }
00128
00129     // set the console err
00130     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setconsoleerr",
00131         dllglue_setglue_func, CompatFuncArg(uppConsoleOutProcInfo, glue_consoleerr)))
00132     {
00133         cvs_err("Error : Cannot find symbol ""dllglue_setconsoleerr""\n");
00134         goto closeandfail;
00135     }
00136
00137     // set the console in
00138     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setconsolein",
00139         dllglue_setglue_func, CompatFuncArg(uppConsoleInProcInfo, glue_consolein)))
00140     {
00141         cvs_err("Error : Cannot find symbol ""dllglue_setconsolein""\n");
00142         goto closeandfail;
00143     }
00144
00145     // set the getenv
00146     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setgetenv",
00147         dllglue_setglue_func, CompatFuncArg(uppGetEnvProcInfo, glue_getenv)))
00148     {
00149         cvs_err("Error : Cannot find symbol ""dllglue_setgetenv""\n");
00150         goto closeandfail;
00151     }
00152
00153     // set the event dispatcher
00154     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_seteventdispatch",
00155         dllglue_setglue_func, CompatFuncArg(uppEventDispatchProcInfo, glue_eventdispatcher)))
00156     {
00157         cvs_err("Error : Cannot find symbol ""dllglue_seteventdispatch""\n");
00158         goto closeandfail;
00159     }
00160
00161     CMacCvsApp::app->cvsLoaded = true;
00162
00163     return true;
00164
00165 closeandfail:
00166     CompatCloseLibrary(&connID);
00167     return false;
00168 }

void unloadCVS | ( | CompatConnectID | connID,
 |  | int | exitc
 | ) |

Definition at line 170 of file AppGlue.mac.cpp.

00171 {
00172     // restore it in case it was not restored correctly by lsh
00173     GusiMSLSetWriteConsole(GUSIMSL_WriteConsoleHook);
00174     GusiMSLSetErrConsole(GUSIMSL_WriteErrHook);
00175     GusiMSLSetHandleEvent(GUSIMSL_HandleEventHook);
00176
00177     CompatCloseLibrary(&connID);
00178
00179     glue_exit(exitc);
00180
00181     CMacCvsApp::app->cvsLoaded = false;
00182     CMacCvsApp::app->RefreshBrowsers();
00183 }

Generated on Sun Oct 21 12:41:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AppGlue.mac.h File Reference

common/AppGlue.mac.h File Reference

#include "dll_loader.h"

Include dependency graph for AppGlue.mac.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

long | GUSIMSL_WriteConsoleHook (char *buffer, long n)
long | GUSIMSL_WriteErrHook (char *buffer, long n)
int | GUSIMSL_HandleEventHook (EventRecord *ev)
int | glue_eventdispatcher (EventRecord *ev)
bool | loadCVS (CompatConnectID &connID)
void | unloadCVS (CompatConnectID connID, int exitc)
int | decodeCVS (char *path)

Function Documentation

int GUSIMSL_HandleEventHook ( EventRecord * ev )

Definition at line 217 of file AppGlue.mac.cpp.

00218 {
00219     return glue_eventdispatcher(ev);
00220 }

long GUSIMSL_WriteConsoleHook | ( | char * | buffer,
 |  | long | n
 | ) |

Definition at line 209 of file AppGlue.mac.cpp.

00210 {
00211     return glue_consoleout(buffer, n);
00212 }

long GUSIMSL_WriteErrHook | ( | char * | buffer,
 |  | long | n
 | ) |

Definition at line 213 of file AppGlue.mac.cpp.

00214 {
00215     return glue_consoleerr(buffer, n);
00216 }

int decodeCVS ( char * path )

Definition at line 185 of file AppGlue.mac.cpp.

Referenced by CvsCmdAnnotateFiles(), and CvsCmdDiffFiles().

00186 {
00187     gConsole = 0;
00188
00189     CompatConnectID connID;
00190
00191     if(!loadCVS(connID))
00192         return errInternal;
00193
00194     int exitc = 0;
00195
00196     // call the main
00197     if(!CompatCallLibrary1(connID, exitc, uppDecodeFileProcInfo, "dllglue_decode_file",
00198         dllglue_decode_file_func, path))
00199     {
00200         cvs_err("Error : Cannot find symbol ""dllglue_decode_file""\n");
00201         exitc = errInternal;
00202     }
00203
00204     unloadCVS(connID, exitc);
00205
00206     return exitc;
00207 }

int glue_eventdispatcher ( EventRecord * ev )

Definition at line 34 of file AppGlue.mac.cpp.

Referenced by GUSIMSL_HandleEventHook().

00035 {
00036     if(CMacCvsApp::app == 0L || !(CMacCvsApp::app->cvsLoaded || TraversalReport::gRunning))
00037         return 0;
00038
00039     EventRecord localEvent;
00040     if (!ev) {
00041         //  Spin callback
00042         UInt32  kSpinSleep = TraversalReport::gRunning ? CMacCvsApp::app->GetSleepTime() : 6;
00043             // for CWCVS, we want to go fast on background. But for a traversal operation,
00044             // we want to be smooth
00045         static  UInt32  spinTicks = 0;
00046         if ((::TickCount () - spinTicks) < kSpinSleep)
00047             return 0;
00048
00049         ev = &localEvent;
00050         ::WaitNextEvent (everyEvent, ev, kSpinSleep, nil);
00051         spinTicks = ::TickCount ();
00052     } // if
00053
00054     if(ev->what == mouseDown)
00055     {
00056         WindowPtr macWindowP;
00057         SInt16 thePart = ::FindWindow(ev->where, &macWindowP);
00058         switch (thePart)
00059         {
00060             case inDrag:
00061             case inGrow:
00062             case inZoomIn:
00063             case inZoomOut:
00064                 CMacCvsApp::app->DispatchEvent(*ev);
00065                 break;
00066             case inContent:
00067                 if (macWindowP != ::FrontWindow())
00068                 {
00069                     // Clicked Window is not the front one
00070                     LWindow *frontW = LWindow::FetchWindowObject(macWindowP);
00071                     if (frontW != nil && !UDesktop::WindowIsSelected(frontW))
00072                         CMacCvsApp::app->DispatchEvent(*ev);
00073                 }
00074                 break;
00075         }
00076         return 0;
00077     }
00078     else if(ev->what == nullEvent)
00079     {
00080         CMacCvsApp::app->DoSpinCursor();
00081     }
00082     else if(ev->what != keyDown && ev->what != keyUp && ev->what != mouseUp)
00083     {
00084         CMacCvsApp::app->DispatchEvent(*ev);
00085     }
00086     return 0;
00087 }

bool loadCVS ( CompatConnectID & connID )

Definition at line 89 of file AppGlue.mac.cpp.

Referenced by decodeCVS(), and launchCVS().

00090 {
00091     int result = 0;
00092     const char *name_dll2;
00093
00094     // restore it in case it was not restored correctly by lsh
00095     GusiMSLSetWriteConsole(GUSIMSL_WriteConsoleHook);
00096     GusiMSLSetErrConsole(GUSIMSL_WriteErrHook);
00097     GusiMSLSetHandleEvent(GUSIMSL_HandleEventHook);
00098
00099     // get cvs shared library
00100 #if qCarbon
00101 #   if qCvsDebug
00102         name_dll2 = "cvsXDbgLib";
00103 #   else
00104         name_dll2 = "cvsXLib";
00105 #   endif
00106 #else
00107 #   if qCvsDebug
00108         name_dll2 = "cvs2DbgLib";
00109 #   else
00110         name_dll2 = "cvs2Lib";
00111 #   endif
00112 #endif
00113
00114     // open the library
00115     if(!CompatLoadLibrary(&connID, name_dll2))
00116     {
00117         cvs_err("Error: Unable to load the library %s\n", name_dll2);
00118         return false;
00119     }
00120
00121     // set the console out
00122     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setconsoleout",
00123         dllglue_setglue_func, CompatFuncArg(uppConsoleOutProcInfo, glue_consoleout)))
00124     {
00125         cvs_err("Error : Cannot find symbol ""dllglue_setconsoleout""\n");
00126         goto closeandfail;
00127     }
00128
00129     // set the console err
00130     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setconsoleerr",
00131         dllglue_setglue_func, CompatFuncArg(uppConsoleOutProcInfo, glue_consoleerr)))
00132     {
00133         cvs_err("Error : Cannot find symbol ""dllglue_setconsoleerr""\n");
00134         goto closeandfail;
00135     }
00136
00137     // set the console in
00138     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setconsolein",
00139         dllglue_setglue_func, CompatFuncArg(uppConsoleInProcInfo, glue_consolein)))
00140     {
00141         cvs_err("Error : Cannot find symbol ""dllglue_setconsolein""\n");
00142         goto closeandfail;
00143     }
00144
00145     // set the getenv
00146     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setgetenv",
00147         dllglue_setglue_func, CompatFuncArg(uppGetEnvProcInfo, glue_getenv)))
00148     {
00149         cvs_err("Error : Cannot find symbol ""dllglue_setgetenv""\n");
00150         goto closeandfail;
00151     }
00152
00153     // set the event dispatcher
00154     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_seteventdispatch",
00155         dllglue_setglue_func, CompatFuncArg(uppEventDispatchProcInfo, glue_eventdispatcher)))
00156     {
00157         cvs_err("Error : Cannot find symbol ""dllglue_seteventdispatch""\n");
00158         goto closeandfail;
00159     }
00160
00161     CMacCvsApp::app->cvsLoaded = true;
00162
00163     return true;
00164
00165 closeandfail:
00166     CompatCloseLibrary(&connID);
00167     return false;
00168 }

void unloadCVS | ( | CompatConnectID | connID,
 |  | int | exitc
 | ) |

Definition at line 170 of file AppGlue.mac.cpp.

Referenced by decodeCVS(), and launchCVS().

00171 {
00172     // restore it in case it was not restored correctly by lsh
00173     GusiMSLSetWriteConsole(GUSIMSL_WriteConsoleHook);
00174     GusiMSLSetErrConsole(GUSIMSL_WriteErrHook);
00175     GusiMSLSetHandleEvent(GUSIMSL_HandleEventHook);
00176
00177     CompatCloseLibrary(&connID);
00178
00179     glue_exit(exitc);
00180
00181     CMacCvsApp::app->cvsLoaded = false;
00182     CMacCvsApp::app->RefreshBrowsers();
00183 }

Generated on Sun Oct 21 12:41:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AskYesNo.cpp File Reference

common/AskYesNo.cpp File Reference

#include "stdafx.h"
#include "AskYesNo.h"
#include "uwidget.h"

Include dependency graph for AskYesNo.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | UEditMessage
class | UPromptMessage

Functions

const char * | AskYesNo (void)
bool | PromptMessage (const char *msg, const char *title, const char *def, const char *cncl)
bool | PromptEditMessage (const char *msg, UStr &edit, const char *title, const char *def, const char *cncl)

Function Documentation

const char* AskYesNo ( void )

Definition at line 80 of file AskYesNo.cpp.

Referenced by glue_getenv().

00081 {
00082 #ifdef WIN32
00083     CAskYesNo gp;
00084     return gp.DoModal() == IDOK ? "yes" : "no";
00085 #endif /* WIN32 */
00086 #ifdef qMacCvsPP
00087     if(!CMacCvsApp::app->IsFrontProcess() && CMacCvsApp::app->NotifyUser(0L))
00088     {
00089         while(!CMacCvsApp::app->IsFrontProcess())
00090         {
00091             CMacCvsApp::app->SpendSomeTime();
00092         }
00093     }
00094
00095     StDialogHandler theHandler(dlg_YesNo, LCommander::GetTopCommander());
00096     LWindow *theDialog = theHandler.GetDialog();
00097     ThrowIfNil_(theDialog);
00098
00099     theDialog->Show();
00100     MessageT hitMessage;
00101     while (true)
00102     {       // Let DialogHandler process events
00103         hitMessage = theHandler.DoDialog();
00104
00105         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00106             break;
00107     }
00108     theDialog->Hide();
00109
00110     return hitMessage == msg_OK ? "yes" : "no";
00111 #endif /* qMacCvsPP */
00112 #ifdef qUnix
00113     return CvsAlert("cvs is requiring you to answer yes or no (see the console for details)", "No", "Yes") ?
00114         "no" : "yes";
00115 #endif /* qUnix */
00116 }

bool PromptEditMessage | ( | const char * | msg,
 |  | UStr & | edit,
 |  | const char * | title = "Message",
 |  | const char * | def = "OK",
 |  | const char * | cncl = "Cancel"
 | ) |

Definition at line 239 of file AskYesNo.cpp.

00240 {
00241     std::auto_ptr<UEditMessage> dlg(new UEditMessage(msg, edit, title, def, cncl));
00242     bool res = false;
00243
00244 #ifdef WIN32
00245     res = dlg->DoModal(IDD_EDITMESSAGE);
00246 #endif
00247 #ifdef qMacCvsPP
00248     res = dlg->DoModal(dlg_PromptEditCommand);
00249 #endif
00250
00251     if(res)
00252         edit = dlg->m_edit;
00253
00254     return res;
00255 }

bool PromptMessage | ( | const char * | msg,
 |  | const char * | title = "Message",
 |  | const char * | def = "OK",
 |  | const char * | cncl = "Cancel"
 | ) |

Definition at line 179 of file AskYesNo.cpp.

00180 {
00181     std::auto_ptr<UPromptMessage> dlg(new UPromptMessage(msg, title, def, cncl));
00182     bool res = false;
00183
00184 #ifdef WIN32
00185     res = dlg->DoModal(IDD_PROMPTMESSAGE);
00186 #endif
00187 #ifdef qMacCvsPP
00188     res = dlg->DoModal(dlg_PromptCommand);
00189 #endif
00190
00191     return res;
00192 }

Generated on Sun Oct 21 12:41:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AskYesNo.h File Reference

common/AskYesNo.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_ASKYESNO_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_

Functions

const char * | AskYesNo (void)
bool | PromptMessage (const char *msg, const char *title="Message", const char *def="OK", const char *cncl="Cancel")
bool | PromptEditMessage (const char *msg, UStr &edit, const char *title="Message", const char *def="OK", const char *cncl="Cancel")

Define Documentation

#define AFX_ASKYESNO_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_

Definition at line 24 of file AskYesNo.h.

Function Documentation

const char* AskYesNo ( void )

Definition at line 80 of file AskYesNo.cpp.

00081 {
00082 #ifdef WIN32
00083     CAskYesNo gp;
00084     return gp.DoModal() == IDOK ? "yes" : "no";
00085 #endif /* WIN32 */
00086 #ifdef qMacCvsPP
00087     if(!CMacCvsApp::app->IsFrontProcess() && CMacCvsApp::app->NotifyUser(0L))
00088     {
00089         while(!CMacCvsApp::app->IsFrontProcess())
00090         {
00091             CMacCvsApp::app->SpendSomeTime();
00092         }
00093     }
00094
00095     StDialogHandler theHandler(dlg_YesNo, LCommander::GetTopCommander());
00096     LWindow *theDialog = theHandler.GetDialog();
00097     ThrowIfNil_(theDialog);
00098
00099     theDialog->Show();
00100     MessageT hitMessage;
00101     while (true)
00102     {       // Let DialogHandler process events
00103         hitMessage = theHandler.DoDialog();
00104
00105         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00106             break;
00107     }
00108     theDialog->Hide();
00109
00110     return hitMessage == msg_OK ? "yes" : "no";
00111 #endif /* qMacCvsPP */
00112 #ifdef qUnix
00113     return CvsAlert("cvs is requiring you to answer yes or no (see the console for details)", "No", "Yes") ?
00114         "no" : "yes";
00115 #endif /* qUnix */
00116 }

bool PromptEditMessage | ( | const char * | msg,
 |  | UStr & | edit,
 |  | const char * | title = "Message",
 |  | const char * | def = "OK",
 |  | const char * | cncl = "Cancel"
 | ) |

Definition at line 239 of file AskYesNo.cpp.

Referenced by cvsgui_PromptEditMessage().

00240 {
00241     std::auto_ptr<UEditMessage> dlg(new UEditMessage(msg, edit, title, def, cncl));
00242     bool res = false;
00243
00244 #ifdef WIN32
00245     res = dlg->DoModal(IDD_EDITMESSAGE);
00246 #endif
00247 #ifdef qMacCvsPP
00248     res = dlg->DoModal(dlg_PromptEditCommand);
00249 #endif
00250
00251     if(res)
00252         edit = dlg->m_edit;
00253
00254     return res;
00255 }

bool PromptMessage | ( | const char * | msg,
 |  | const char * | title = "Message",
 |  | const char * | def = "OK",
 |  | const char * | cncl = "Cancel"
 | ) |

Definition at line 179 of file AskYesNo.cpp.

Referenced by cvsgui_PromptMessage().

00180 {
00181     std::auto_ptr<UPromptMessage> dlg(new UPromptMessage(msg, title, def, cncl));
00182     bool res = false;
00183
00184 #ifdef WIN32
00185     res = dlg->DoModal(IDD_PROMPTMESSAGE);
00186 #endif
00187 #ifdef qMacCvsPP
00188     res = dlg->DoModal(dlg_PromptCommand);
00189 #endif
00190
00191     return res;
00192 }

Generated on Sun Oct 21 12:41:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Authen.cpp File Reference

common/Authen.cpp File Reference

#include "stdafx.h"
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "Authen.h"
#include "CvsPrefs.h"
#include "AppConsole.h"
#include "MultiFiles.h"
#include "PromptFiles.h"
#include "CvsArgs.h"
#include "TextBinary.h"
#include "uwidget.h"
#include <algorithm>

Include dependency graph for Authen.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | UAuthen_Kserver
class | UAuthen_Pserver
class | UAuthen_Rhosts
class | UAuthen_SSH
class | AuthenKserver
class | AuthenLocal
class | AuthenNtserver
class | AuthenPserver
class | AuthenRhosts
class | AuthenSSH

Functions

CPersistentT< AuthenKind > | gAuthenKind ("P_Authen", local, kNoClass)

Variables

Authen gAuthen
AuthenLocal localInstance
AuthenPserver pserverInstance
AuthenRhosts rhostsInstance
AuthenKserver kserverInstance
AuthenSSH sshInstance

Function Documentation

CPersistentT<AuthenKind> gAuthenKind | ( | "P_Authen" | ,
 |  | local | ,
 |  | kNoClass |
 | ) | [static]

Variable Documentation

Authen gAuthen

Definition at line 65 of file Authen.cpp.

AuthenKserver kserverInstance [static]

Definition at line 1480 of file Authen.cpp.

AuthenLocal localInstance [static]

Definition at line 1476 of file Authen.cpp.

AuthenPserver pserverInstance [static]

Definition at line 1477 of file Authen.cpp.

AuthenRhosts rhostsInstance [static]

Definition at line 1478 of file Authen.cpp.

AuthenSSH sshInstance [static]

Definition at line 1487 of file Authen.cpp.

Generated on Sun Oct 21 12:41:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Authen.h File Reference

common/Authen.h File Reference

#include "MultiString.h"

Include dependency graph for Authen.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | Authen
class | AuthenModel

Enumerations

enum AuthenKind {
rhosts, pserver, kserver, local,
ssh, ntserver
}

Variables

Authen gAuthen

Enumeration Type Documentation

enum AuthenKind

Enumeration values:
rhosts
pserver
kserver
local
ssh
ntserver

Definition at line 31 of file Authen.h.

00032 {
00033     rhosts, // rhosts file
00034     pserver, // pserver
00035     kserver, // kserver
00036     local, // mounted point
00037     ssh, // ssh
00038     ntserver // ntserver
00039 } AuthenKind;

Variable Documentation

Authen gAuthen

Definition at line 94 of file Authen.h.

Generated on Sun Oct 21 12:41:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


BrowseViewColumn.cpp File Reference

common/BrowseViewColumn.cpp File Reference

#include "stdafx.h"
#include "BrowseViewColumn.h"
#include "CvsEntries.h"
#include <time.h>

Include dependency graph for BrowseViewColumn.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | KoConflictColumn
class | KoDateColumn
class | KoNameColumn
class | KoOptionColumn
class | KoPathColumn
class | KoRecursiveModel
class | KoRegularModel
class | KoRevisionColumn
class | KoStatusColumn
class | KoTagColumn

Defines

#define | _countof(array) (sizeof(array)/sizeof(array[0]))

Functions

time_t | get_date (const char *date, struct timeb *now)
void | SafeCopy (char *buffer, const char *value, int bufferSize)
int | _Compare (void *data1, void *data2, void *data)

Variables

KoNameColumn nameColumn
KoPathColumn pathColumn
KoRevisionColumn revisionColumn
KoOptionColumn optionColumn
KoStatusColumn statusColumn
KoTagColumn tagColumn
KoDateColumn dateColumn
KoConflictColumn conflictColumn
const KiColumn * | columnsRegular []
const int | typesRegular []
const KiColumn * | columnsRecursive []
const int | typesRecursive []
KoRegularModel modelRegular
KoRecursiveModel modelRecursive

Define Documentation

#define _countof ( array ) (sizeof(array)/sizeof(array[0]))

Definition at line 36 of file BrowseViewColumn.cpp.

Referenced by KoRecursiveModel::GetCount(), KoRegularModel::GetCount(), CWincvsApp::InitInstance(), WinInitWidgets(), and _LoadSysColorBitmap().

Function Documentation

void SafeCopy | ( | char * | buffer,
 |  | const char * | value,
 |  | int | bufferSize
 | ) | [static]

Definition at line 42 of file BrowseViewColumn.cpp.

Referenced by KoConflictColumn::GetText(), KoDateColumn::GetText(), KoTagColumn::GetText(), KoStatusColumn::GetText(), KoOptionColumn::GetText(), KoRevisionColumn::GetText(), KoPathColumn::GetText(), and KoNameColumn::GetText().

00043 {
00044     if (value && *value)
00045     {
00046         strncpy(buffer, value, bufferSize);
00047     }
00048     else
00049     {
00050         *buffer = 0;
00051     }
00052 }

int _Compare | ( | void * | data1,
 |  | void * | data2,
 |  | void * | data
 | ) |

Definition at line 612 of file BrowseViewColumn.cpp.

00614 {
00615     int res = 0;
00616     bool fOneDirOnly = false;
00617
00618     EntnodeData *d1 = (EntnodeData *)data1;
00619     EntnodeData *d2 = (EntnodeData *)data2;
00620
00621     const CSortParam *pSortParam = (CSortParam*)data;
00622
00623     //  Group sub dirs ?
00624     if (pSortParam->m_fGroupSubDir)
00625     {
00626         int d1IsDir = d1->GetType()==ENT_SUBDIR;
00627         int d2IsDir = d2->GetType()==ENT_SUBDIR;
00628
00629         if( (d1IsDir + d2IsDir) == 1)
00630         {
00631             //  One (and only one of them) is a directory
00632             fOneDirOnly = true;
00633             res = d1IsDir ? -1 : 1;
00634         }
00635     }
00636
00637     if (!res)
00638     {
00639         res = pSortParam->m_column->Compare(pSortParam->m_context, d1, d2);
00640     }
00641
00642     if (res==0 && pSortParam->m_column != pSortParam->m_columnAlt)
00643         res = pSortParam->m_columnAlt->Compare(pSortParam->m_context, d1, d2);
00644     else if (!fOneDirOnly)
00645         res = pSortParam->m_fAccendant ? -res : res;
00646     return res;
00647 }

time_t get_date | ( | const char * | date,
 |  | struct timeb * | now
 | ) |

Variable Documentation

const KiColumn* columnsRecursive[] [static]

Initial value:

 {
    &nameColumn, &pathColumn, &revisionColumn, &optionColumn, &statusColumn, &tagColumn, &dateColumn, &conflictColumn
}

Definition at line 527 of file BrowseViewColumn.cpp.

const KiColumn* columnsRegular[] [static]

Initial value:

 {
    &nameColumn, &revisionColumn, &optionColumn, &statusColumn, &tagColumn, &dateColumn, &conflictColumn
}

Definition at line 518 of file BrowseViewColumn.cpp.

KoConflictColumn conflictColumn

KoDateColumn dateColumn

KoRecursiveModel modelRecursive

KoRegularModel modelRegular

KoNameColumn nameColumn

KoOptionColumn optionColumn

KoPathColumn pathColumn

KoRevisionColumn revisionColumn

KoStatusColumn statusColumn

KoTagColumn tagColumn

const int typesRecursive[] [static]

Initial value:

 {
    EntnodeData::kName, EntnodeFile::kPath, EntnodeFile::kVN, EntnodeFile::kOption, EntnodeData::kStatus,
    EntnodeFile::kTag, EntnodeFile::kTS, EntnodeFile::kConflict
}

Definition at line 531 of file BrowseViewColumn.cpp.

const int typesRegular[] [static]

Initial value:

 {
    EntnodeData::kName, EntnodeFile::kVN, EntnodeFile::kOption, EntnodeData::kStatus,
    EntnodeFile::kTag, EntnodeFile::kTS, EntnodeFile::kConflict
}

Definition at line 522 of file BrowseViewColumn.cpp.

Generated on Sun Oct 21 12:41:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


BrowseViewColumn.h File Reference

common/BrowseViewColumn.h File Reference

#include "ustr.h"

Include dependency graph for BrowseViewColumn.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | KiColumn
class | KiColumnModel
class | KoColumnContext
struct | LV_COLUMN
struct | CSortParam

Functions

int | _Compare (void *data1, void *data2, void *data)

Function Documentation

int _Compare | ( | void * | data1,
 |  | void * | data2,
 |  | void * | data
 | ) |

Definition at line 612 of file BrowseViewColumn.cpp.

00614 {
00615     int res = 0;
00616     bool fOneDirOnly = false;
00617
00618     EntnodeData *d1 = (EntnodeData *)data1;
00619     EntnodeData *d2 = (EntnodeData *)data2;
00620
00621     const CSortParam *pSortParam = (CSortParam*)data;
00622
00623     //  Group sub dirs ?
00624     if (pSortParam->m_fGroupSubDir)
00625     {
00626         int d1IsDir = d1->GetType()==ENT_SUBDIR;
00627         int d2IsDir = d2->GetType()==ENT_SUBDIR;
00628
00629         if( (d1IsDir + d2IsDir) == 1)
00630         {
00631             //  One (and only one of them) is a directory
00632             fOneDirOnly = true;
00633             res = d1IsDir ? -1 : 1;
00634         }
00635     }
00636
00637     if (!res)
00638     {
00639         res = pSortParam->m_column->Compare(pSortParam->m_context, d1, d2);
00640     }
00641
00642     if (res==0 && pSortParam->m_column != pSortParam->m_columnAlt)
00643         res = pSortParam->m_columnAlt->Compare(pSortParam->m_context, d1, d2);
00644     else if (!fOneDirOnly)
00645         res = pSortParam->m_fAccendant ? -res : res;
00646     return res;
00647 }

Generated on Sun Oct 21 12:41:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


BrowseViewHandlers.h File Reference

common/BrowseViewHandlers.h File Reference

#include "CvsAlert.h"

Include dependency graph for BrowseViewHandlers.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | KiSelectionHandler
class | KoAddBinaryHandler
class | KoAddHandler
class | KoAnnotateHandler
class | KoBranchTagHandler
class | KoCommitHandler
class | KoCreateTagHandler
class | KoDeleteTagHandler
class | KoDiffHandler
class | KoEditHandler
class | KoEditorsHandler
class | KoFileRemoveHandler
class | KoGraphHandler
class | KoLockHandler
class | KoLogHandler
class | KoMoveToTrashHandler
class | KoQueryUpdateHandler
class | KoReleaseHandler
class | KoStatusHandler
class | KoUneditHandler
class | KoUnlockHandler
class | KoUpdateHandler
class | KoUpdateMoveToTrashHandler
class | KoWatchersHandler
class | KoWatchOffHandler
class | KoWatchOnHandler

Generated on Sun Oct 21 12:42:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


BrowseViewModel.cpp File Reference

common/BrowseViewModel.cpp File Reference

#include "stdafx.h"
#include "BrowseViewModel.h"
#include "Persistent.h"
#include "CvsEntries.h"

Include dependency graph for BrowseViewModel.cpp:

Include dependency graph

Go to the source code of this file.

Functions

CPersistentBool | persistentChanged ("P_ViewChanged", false)
CPersistentBool | persistentAdded ("P_ViewAdded", false)
CPersistentBool | persistentRemoved ("P_ViewRemoved", false)
CPersistentBool | persistentConflicts ("P_ViewConflicts", false)
CPersistentBool | persistentUnknown ("P_ViewUnknown", false)
CPersistentBool | persistentHideUnknown ("P_ViewHideUnknown", false)
CPersistentBool | persistentMissing ("P_ViewMissing", false)
CPersistentBool | persistentRecursive ("P_DisplayRecursive", false)
CPersistentBool | persistentIgnore ("P_FileViewIgnore", true)

Function Documentation

CPersistentBool persistentAdded | ( | "P_ViewAdded" | ,
 |  | false |
 | ) | [static]

CPersistentBool persistentChanged | ( | "P_ViewChanged" | ,
 |  | false |
 | ) | [static]

CPersistentBool persistentConflicts | ( | "P_ViewConflicts" | ,
 |  | false |
 | ) | [static]

CPersistentBool persistentHideUnknown | ( | "P_ViewHideUnknown" | ,
 |  | false |
 | ) | [static]

CPersistentBool persistentIgnore | ( | "P_FileViewIgnore" | ,
 |  | true |
 | ) | [static]

CPersistentBool persistentMissing | ( | "P_ViewMissing" | ,
 |  | false |
 | ) | [static]

CPersistentBool persistentRecursive | ( | "P_DisplayRecursive" | ,
 |  | false |
 | ) | [static]

CPersistentBool persistentRemoved | ( | "P_ViewRemoved" | ,
 |  | false |
 | ) | [static]

CPersistentBool persistentUnknown | ( | "P_ViewUnknown" | ,
 |  | false |
 | ) | [static]

Generated on Sun Oct 21 12:42:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


BrowseViewModel.h File Reference

common/BrowseViewModel.h File Reference

#include "UStr.h"
#include <vector>

Include dependency graph for BrowseViewModel.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | KiFilterModel
class | KiIgnoreModel
class | KiRecursionModel
class | KoFilterModel
class | KoIgnoreModel
class | KoRecursionModel
struct | NotificationManager::Node
class | NotificationManager

Typedefs

typedef void(* | FNOBSERVER )(CObject *)

Typedef Documentation

typedef void(* FNOBSERVER)(CObject*)

Definition at line 31 of file BrowseViewModel.h.

Generated on Sun Oct 21 12:42:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CheckoutDlg.cpp File Reference

common/CheckoutDlg.cpp File Reference

#include "stdafx.h"
#include "CheckoutDlg.h"
#include "CvsPrefs.h"
#include "UpdateDlg.h"
#include "MultiString.h"
#include "PromptFiles.h"
#include "MakeSurePathExists.h"

Include dependency graph for CheckoutDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

CMString | gOldModules (10,"P_OldModules")
bool | CompatGetCheckout (UPStr &modname, UPStr &path, bool &norecurs, bool &toStdout, UPStr &date, UPStr &rev, bool &useMostRecent, bool &doexport, bool &forceCvsroot, bool &overrideCheckoutDir, UPStr &checkoutDir)

Function Documentation

bool CompatGetCheckout | ( | UPStr & | modname,
 |  | UPStr & | path,
 |  | bool & | norecurs,
 |  | bool & | toStdout,
 |  | UPStr & | date,
 |  | UPStr & | rev,
 |  | bool & | useMostRecent,
 |  | bool & | doexport,
 |  | bool & | forceCvsroot,
 |  | bool & | overrideCheckoutDir,
 |  | UPStr & | checkoutDir
 | ) |

Definition at line 590 of file CheckoutDlg.cpp.

00594 {
00595     bool userHitOK = false;
00596
00597     date = "";
00598     rev = "";
00599     modname = "";
00600     norecurs = false;
00601     toStdout = false;
00602     useMostRecent = false;
00603     doexport = false;
00604     forceCvsroot = false;
00605     overrideCheckoutDir = false;
00606
00607     bool hasDate = false;
00608     bool hasRev = false;
00609     static CPStr sLastModName;
00610     static CPStr sLastRev;
00611     static CPStr sLastDate;
00612
00613 #ifdef WIN32
00614     CPropertySheet pages("Checkout settings");
00615     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00616     CCheckout_MAIN page1(sLastModName, path);
00617     CCheckout_OPTIONS page2(sLastRev, sLastDate);
00618     CGetPrefs_CVSROOT page3;
00619     CGetPrefs_GLOBALS page4;
00620     pages.AddPage(&page1);
00621     pages.AddPage(&page2);
00622     pages.AddPage(&page3);
00623     pages.AddPage(&page4);
00624     if(pages.DoModal() == IDOK)
00625     {
00626         sLastModName = (const char *)page1.m_modname;
00627         path = (const char *)page1.m_path;
00628         norecurs = page1.m_norecurs == TRUE;
00629         toStdout = page1.m_stdout == TRUE;
00630         overrideCheckoutDir = page1.m_overrideCheckoutDir == TRUE;
00631         checkoutDir = (const char *)page1.m_checkoutDir;
00632
00633         sLastDate = page2.m_date;
00634         sLastRev = page2.m_rev;
00635         hasDate = page2.m_hasdate == TRUE;
00636         hasRev = page2.m_hasrev == TRUE;
00637         useMostRecent = page2.m_match == TRUE;
00638         doexport = page2.m_export == TRUE;
00639         forceCvsroot = page2.m_forceroot == TRUE;
00640
00641         page3.StoreValues();
00642         page4.StoreValues();
00643         userHitOK = true;
00644     }
00645 #endif /* WIN32 */
00646 #ifdef qMacCvsPP
00647     StDialogHandler theHandler(dlg_Checkout, LCommander::GetTopCommander());
00648     LWindow *theDialog = theHandler.GetDialog();
00649     ThrowIfNil_(theDialog);
00650     static UInt16 sRuntimePanel = 1;
00651
00652     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00653         (theDialog->FindPaneByID(item_MultiViewPrefs));
00654     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00655
00656     multiView->SwitchToPanel(3);
00657     DoDataExchange_Globals(theDialog, true);
00658     multiView->SwitchToPanel(2);
00659     DoDataExchange_CheckoutOptions(theDialog, hasDate, hasRev,
00660         sLastDate, sLastRev, useMostRecent, doexport, forceCvsroot, true);
00661     multiView->SwitchToPanel(1);
00662     DoDataExchange_CheckoutMain(theDialog, sLastModName, norecurs, toStdout, overrideCheckoutDir, checkoutDir, true);
00663     dynamic_cast<LBroadcaster*> (theDialog->FindPaneByID (item_EditPath))->AddListener (&theHandler);
00664     dynamic_cast<LBroadcaster*> (theDialog->FindPaneByID (item_CheckGroupPath))->AddListener (&theHandler);
00665
00666
00667     groupView->SetValue(sRuntimePanel);
00668     theDialog->Show();
00669     MessageT hitMessage;
00670     while (true)
00671     {       // Let DialogHandler process events
00672         hitMessage = theHandler.DoDialog();
00673
00674         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00675             break;
00676
00677         if(hitMessage == item_CheckGroupPath || hitMessage == item_EditPath)
00678         {
00679             if(theDialog->GetValueForPaneID(item_CheckGroupPath) == Button_Off)
00680             {
00681                 continue;
00682             }
00683
00684             const char* dir = BrowserGetDirectory("Select the checkout directory :");
00685             if(dir != 0L)
00686             {
00687                 CPStr tmp(dir);
00688                 theDialog->SetDescriptorForPaneID(item_EditPath, tmp);
00689             }
00690             else if(hitMessage == item_CheckGroupPath)
00691             {
00692                 theDialog->SetValueForPaneID(item_CheckGroupPath, Button_Off);
00693             }
00694         }
00695     }
00696     theDialog->Hide();
00697     sRuntimePanel = groupView->GetValue();
00698
00699     if(hitMessage == msg_OK)
00700     {
00701         multiView->SwitchToPanel(1);
00702         DoDataExchange_CheckoutMain(theDialog, sLastModName, norecurs, toStdout, overrideCheckoutDir, checkoutDir, false);
00703         multiView->SwitchToPanel(2);
00704         DoDataExchange_CheckoutOptions(theDialog, hasDate, hasRev,
00705             sLastDate, sLastRev, useMostRecent, doexport, forceCvsroot, false);
00706         multiView->SwitchToPanel(3);
00707         DoDataExchange_Globals(theDialog, false);
00708
00709         Assert_(sLastModName.length() != 0);
00710
00711         userHitOK = true;
00712     }
00713 #endif /* qMacCvsPP */
00714 #if qUnix
00715     void *wid = UCreate_CheckoutDlg();
00716
00717     UCvsCheckout *dlg = new UCvsCheckout();
00718     UCvsCheckout_MAIN *tab1 = new UCvsCheckout_MAIN(sLastModName, path);
00719     UCvsCheckout_STICKY *tab2 = new UCvsCheckout_STICKY(sLastRev, sLastDate);
00720     UCvsCheckout_OPTIONS *tab3 = new UCvsCheckout_OPTIONS();
00721     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00722     dlg->AddPage(tab1, UCvsCheckout::kTabGeneral, 0);
00723     dlg->AddPage(tab2, UCvsCheckout::kTabGeneral, 1);
00724     dlg->AddPage(tab3, UCvsCheckout::kTabGeneral, 2);
00725
00726     if(dlg->DoModal())
00727     {
00728         sLastModName = tab1->m_modname;
00729         path = tab1->m_path;
00730         norecurs = tab1->m_norecurs;
00731         toStdout = tab1->m_stdout;
00732
00733         sLastDate = tab2->m_date;
00734         sLastRev = tab2->m_rev;
00735         hasDate = tab2->m_hasdate;
00736         hasRev = tab2->m_hasrev;
00737         useMostRecent = tab2->m_match;
00738
00739         doexport = tab3->m_export;
00740         forceCvsroot = tab3->m_forceroot;
00741
00742         userHitOK = true;
00743     }
00744
00745     delete dlg;
00746 #endif // qUnix
00747
00748     if(userHitOK)
00749     {
00750         if(hasDate && !sLastDate.empty())
00751             date = sLastDate;
00752         if(hasRev && !sLastRev.empty())
00753             rev = sLastRev;
00754
00755         modname = sLastModName;
00756
00757         gCvsPrefs.save();
00758     }
00759     return userHitOK;
00760 }

CMString gOldModules | ( | 10 | ,
 |  | "P_OldModules" |
 | ) |

Generated on Sun Oct 21 12:42:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CheckoutDlg.h File Reference

common/CheckoutDlg.h File Reference

#include "CPStr.h"
#include "MultiString.h"

Include dependency graph for CheckoutDlg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_CHECKOUTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Functions

bool | CompatGetCheckout (UPStr &modname, UPStr &path, bool &norecurs, bool &toStdout, UPStr &date, UPStr &rev, bool &useMostRecent, bool &doexport, bool &forceCvsroot, bool &overrideCheckoutDir, UPStr &checkoutDir)

Variables

CMString gOldModules

Define Documentation

#define AFX_CHECKOUTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file CheckoutDlg.h.

Function Documentation

bool CompatGetCheckout | ( | UPStr & | modname,
 |  | UPStr & | path,
 |  | bool & | norecurs,
 |  | bool & | toStdout,
 |  | UPStr & | date,
 |  | UPStr & | rev,
 |  | bool & | useMostRecent,
 |  | bool & | doexport,
 |  | bool & | forceCvsroot,
 |  | bool & | overrideCheckoutDir,
 |  | UPStr & | checkoutDir
 | ) |

Definition at line 590 of file CheckoutDlg.cpp.

Referenced by CvsCmdCheckoutModule().

00594 {
00595     bool userHitOK = false;
00596
00597     date = "";
00598     rev = "";
00599     modname = "";
00600     norecurs = false;
00601     toStdout = false;
00602     useMostRecent = false;
00603     doexport = false;
00604     forceCvsroot = false;
00605     overrideCheckoutDir = false;
00606
00607     bool hasDate = false;
00608     bool hasRev = false;
00609     static CPStr sLastModName;
00610     static CPStr sLastRev;
00611     static CPStr sLastDate;
00612
00613 #ifdef WIN32
00614     CPropertySheet pages("Checkout settings");
00615     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00616     CCheckout_MAIN page1(sLastModName, path);
00617     CCheckout_OPTIONS page2(sLastRev, sLastDate);
00618     CGetPrefs_CVSROOT page3;
00619     CGetPrefs_GLOBALS page4;
00620     pages.AddPage(&page1);
00621     pages.AddPage(&page2);
00622     pages.AddPage(&page3);
00623     pages.AddPage(&page4);
00624     if(pages.DoModal() == IDOK)
00625     {
00626         sLastModName = (const char *)page1.m_modname;
00627         path = (const char *)page1.m_path;
00628         norecurs = page1.m_norecurs == TRUE;
00629         toStdout = page1.m_stdout == TRUE;
00630         overrideCheckoutDir = page1.m_overrideCheckoutDir == TRUE;
00631         checkoutDir = (const char *)page1.m_checkoutDir;
00632
00633         sLastDate = page2.m_date;
00634         sLastRev = page2.m_rev;
00635         hasDate = page2.m_hasdate == TRUE;
00636         hasRev = page2.m_hasrev == TRUE;
00637         useMostRecent = page2.m_match == TRUE;
00638         doexport = page2.m_export == TRUE;
00639         forceCvsroot = page2.m_forceroot == TRUE;
00640
00641         page3.StoreValues();
00642         page4.StoreValues();
00643         userHitOK = true;
00644     }
00645 #endif /* WIN32 */
00646 #ifdef qMacCvsPP
00647     StDialogHandler theHandler(dlg_Checkout, LCommander::GetTopCommander());
00648     LWindow *theDialog = theHandler.GetDialog();
00649     ThrowIfNil_(theDialog);
00650     static UInt16 sRuntimePanel = 1;
00651
00652     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00653         (theDialog->FindPaneByID(item_MultiViewPrefs));
00654     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00655
00656     multiView->SwitchToPanel(3);
00657     DoDataExchange_Globals(theDialog, true);
00658     multiView->SwitchToPanel(2);
00659     DoDataExchange_CheckoutOptions(theDialog, hasDate, hasRev,
00660         sLastDate, sLastRev, useMostRecent, doexport, forceCvsroot, true);
00661     multiView->SwitchToPanel(1);
00662     DoDataExchange_CheckoutMain(theDialog, sLastModName, norecurs, toStdout, overrideCheckoutDir, checkoutDir, true);
00663     dynamic_cast<LBroadcaster*> (theDialog->FindPaneByID (item_EditPath))->AddListener (&theHandler);
00664     dynamic_cast<LBroadcaster*> (theDialog->FindPaneByID (item_CheckGroupPath))->AddListener (&theHandler);
00665
00666
00667     groupView->SetValue(sRuntimePanel);
00668     theDialog->Show();
00669     MessageT hitMessage;
00670     while (true)
00671     {       // Let DialogHandler process events
00672         hitMessage = theHandler.DoDialog();
00673
00674         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00675             break;
00676
00677         if(hitMessage == item_CheckGroupPath || hitMessage == item_EditPath)
00678         {
00679             if(theDialog->GetValueForPaneID(item_CheckGroupPath) == Button_Off)
00680             {
00681                 continue;
00682             }
00683
00684             const char* dir = BrowserGetDirectory("Select the checkout directory :");
00685             if(dir != 0L)
00686             {
00687                 CPStr tmp(dir);
00688                 theDialog->SetDescriptorForPaneID(item_EditPath, tmp);
00689             }
00690             else if(hitMessage == item_CheckGroupPath)
00691             {
00692                 theDialog->SetValueForPaneID(item_CheckGroupPath, Button_Off);
00693             }
00694         }
00695     }
00696     theDialog->Hide();
00697     sRuntimePanel = groupView->GetValue();
00698
00699     if(hitMessage == msg_OK)
00700     {
00701         multiView->SwitchToPanel(1);
00702         DoDataExchange_CheckoutMain(theDialog, sLastModName, norecurs, toStdout, overrideCheckoutDir, checkoutDir, false);
00703         multiView->SwitchToPanel(2);
00704         DoDataExchange_CheckoutOptions(theDialog, hasDate, hasRev,
00705             sLastDate, sLastRev, useMostRecent, doexport, forceCvsroot, false);
00706         multiView->SwitchToPanel(3);
00707         DoDataExchange_Globals(theDialog, false);
00708
00709         Assert_(sLastModName.length() != 0);
00710
00711         userHitOK = true;
00712     }
00713 #endif /* qMacCvsPP */
00714 #if qUnix
00715     void *wid = UCreate_CheckoutDlg();
00716
00717     UCvsCheckout *dlg = new UCvsCheckout();
00718     UCvsCheckout_MAIN *tab1 = new UCvsCheckout_MAIN(sLastModName, path);
00719     UCvsCheckout_STICKY *tab2 = new UCvsCheckout_STICKY(sLastRev, sLastDate);
00720     UCvsCheckout_OPTIONS *tab3 = new UCvsCheckout_OPTIONS();
00721     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00722     dlg->AddPage(tab1, UCvsCheckout::kTabGeneral, 0);
00723     dlg->AddPage(tab2, UCvsCheckout::kTabGeneral, 1);
00724     dlg->AddPage(tab3, UCvsCheckout::kTabGeneral, 2);
00725
00726     if(dlg->DoModal())
00727     {
00728         sLastModName = tab1->m_modname;
00729         path = tab1->m_path;
00730         norecurs = tab1->m_norecurs;
00731         toStdout = tab1->m_stdout;
00732
00733         sLastDate = tab2->m_date;
00734         sLastRev = tab2->m_rev;
00735         hasDate = tab2->m_hasdate;
00736         hasRev = tab2->m_hasrev;
00737         useMostRecent = tab2->m_match;
00738
00739         doexport = tab3->m_export;
00740         forceCvsroot = tab3->m_forceroot;
00741
00742         userHitOK = true;
00743     }
00744
00745     delete dlg;
00746 #endif // qUnix
00747
00748     if(userHitOK)
00749     {
00750         if(hasDate && !sLastDate.empty())
00751             date = sLastDate;
00752         if(hasRev && !sLastRev.empty())
00753             rev = sLastRev;
00754
00755         modname = sLastModName;
00756
00757         gCvsPrefs.save();
00758     }
00759     return userHitOK;
00760 }

Variable Documentation

CMString gOldModules

Definition at line 41 of file CheckoutDlg.h.

Generated on Sun Oct 21 12:42:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CommitDlg.cpp File Reference

common/CommitDlg.cpp File Reference

#include "stdafx.h"
#include <ctype.h>
#include "CommitDlg.h"
#include "CvsPrefs.h"
#include "getline.h"
#include "TextBinary.h"
#include "MultiString.h"
#include "CvsCommands.h"
#include "EditorMonDlg.h"

Include dependency graph for CommitDlg.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | HOWMUCH_WORDS 5

Functions

CMString | gCommitLogs (10,"P_CommitLogs")
void | combozify (UStr &str)
bool | CompatGetCommit (UStr &commit, bool &norecurs, bool &forceCommit, bool &forceRecurse, UPStr &rev, bool &noModuleProgram, const char *pathTmpl, MultiFiles *mf)

Define Documentation

#define HOWMUCH_WORDS 5

Function Documentation

bool CompatGetCommit | ( | UStr & | commit,
 |  | bool & | norecurs,
 |  | bool & | forceCommit,
 |  | bool & | forceRecurse,
 |  | UPStr & | rev,
 |  | bool & | noModuleProgram,
 |  | const char * | pathTmpl = 0L,
 |  | MultiFiles * | mf = 0L
 | ) |

Definition at line 759 of file CommitDlg.cpp.

00763 {
00764     bool userHitOK = false;
00765
00766     static CStr sLastMsg;
00767     static CPStr sLastRev;
00768
00769     bool hasRev = false;
00770
00771     norecurs = false;
00772     commit = "";
00773     forceCommit = false;
00774     forceRecurse = false;
00775     rev = "";
00776     noModuleProgram = false;
00777
00778
00779 #ifdef WIN32
00780     CPropertySheet pages("Commit settings");
00781     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00782     CCommit_MAIN page1(sLastMsg, pathTmpl, mf);
00783     CCommit_OPTIONS page2;
00784     CGetPrefs_GLOBALS page3;
00785     pages.AddPage(&page1);
00786     pages.AddPage(&page2);
00787     pages.AddPage(&page3);
00788     if(pages.DoModal() == IDOK)
00789     {
00790         commit = (const char *)page1.m_logmsg;
00791         sLastMsg = (const char *)page1.m_logmsg;
00792         norecurs = page1.m_norecurs ? true : false;
00793         forceCommit = page2.m_forceCommit ? true : false;
00794         forceRecurse = page2.m_forceRecurse ? true : false;
00795         hasRev = page2.m_forceRevision ? true : false;
00796         sLastRev = page2.m_rev;
00797         noModuleProgram = page2.m_noModuleProgram ? true : false;
00798         page3.StoreValues();
00799
00800         userHitOK = true;
00801     }
00802 #endif /* WIN32 */
00803 #ifdef qMacCvsPP
00804     StDialogHandler theHandler(dlg_Commit, LCommander::GetTopCommander());
00805     LWindow *theDialog = theHandler.GetDialog();
00806     ThrowIfNil_(theDialog);
00807     static UInt16 sRuntimePanel = 1;
00808
00809     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00810         (theDialog->FindPaneByID(item_MultiViewPrefs));
00811     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00812
00813     multiView->SwitchToPanel(3);
00814     DoDataExchange_Globals(theDialog, true);
00815     multiView->SwitchToPanel(2);
00816     DoDataExchange_CommitOptions(theDialog, forceCommit, forceRecurse, hasRev, sLastRev, noModuleProgram, true);
00817     multiView->SwitchToPanel(1);
00818     DoDataExchange_Commit(theDialog, sLastMsg, norecurs, pathTmpl, true);
00819
00820     groupView->SetValue(sRuntimePanel);
00821     theDialog->Show();
00822     MessageT hitMessage;
00823     while (true)
00824     {       // Let DialogHandler process events
00825         hitMessage = theHandler.DoDialog();
00826
00827         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00828             break;
00829     }
00830     theDialog->Hide();
00831     sRuntimePanel = groupView->GetValue();
00832
00833     if(hitMessage == msg_OK)
00834     {
00835         multiView->SwitchToPanel(1);
00836         DoDataExchange_Commit(theDialog, sLastMsg, norecurs, pathTmpl, false);
00837         multiView->SwitchToPanel(2);
00838         DoDataExchange_CommitOptions(theDialog, forceCommit, forceRecurse, hasRev, sLastRev, noModuleProgram, false);
00839         multiView->SwitchToPanel(3);
00840         DoDataExchange_Globals(theDialog, false);
00841         commit = sLastMsg;
00842         commit.replace('\015', '\012');
00843         userHitOK = true;
00844     }
00845 #endif /* qMacCvsPP */
00846 #if qUnix
00847     void *wid = UCreate_CommitDlg();
00848
00849     UCvsCommit *dlg = new UCvsCommit();
00850     UCvsCommit_MAIN *tab1 = new UCvsCommit_MAIN(sLastMsg, pathTmpl);
00851     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00852     dlg->AddPage(tab1, UCvsCommit::kTabGeneral, 0);
00853
00854     if(dlg->DoModal())
00855     {
00856         commit = tab1->m_logmsg;
00857         sLastMsg = tab1->m_logmsg;
00858         norecurs = tab1->m_norecurs;
00859
00860         userHitOK = true;
00861     }
00862
00863     delete dlg;
00864 #endif // qUnix
00865
00866     if(userHitOK)
00867     {
00868         if(commit.length() == 0)
00869             commit = "no message";
00870         if(hasRev && !sLastRev.empty())
00871             rev = sLastRev;
00872         gCvsPrefs.save();
00873     }
00874     return userHitOK;
00875 }

void combozify ( UStr & str )

Definition at line 59 of file CommitDlg.cpp.

00060 {
00061     // extract the first xxx words
00062     const char *tmp = str;
00063     CStr result;
00064     int numWords = 0;
00065 #   define HOWMUCH_WORDS 5
00066     while(*tmp != '\0' && numWords < HOWMUCH_WORDS)
00067     {
00068         while(*tmp != '\0' && isspace(*tmp))
00069             tmp++;
00070
00071         while(*tmp != '\0' && !isspace(*tmp))
00072             result << *tmp ++;
00073
00074         if(*tmp != '\0')
00075             result << ' ';
00076
00077         numWords++;
00078     }
00079
00080     if(*tmp != '\0')
00081     {
00082         result << "...";
00083     }
00084     str = result;
00085 }

CMString gCommitLogs | ( | 10 | ,
 |  | "P_CommitLogs" |
 | ) | [static]

Generated on Sun Oct 21 12:42:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CommitDlg.h File Reference

common/CommitDlg.h File Reference

#include "CPStr.h"
#include "MultiString.h"
#include "MultiFiles.h"

Include dependency graph for CommitDlg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_COMMITDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Functions

bool | CompatGetCommit (UStr &commit, bool &norecurs, bool &forceCommit, bool &forceRecurse, UPStr &rev, bool &noModuleProgram, const char *pathTmpl=0L, MultiFiles *mf=0L)
void | combozify (UStr &str)

Variables

CMString gRevNames

Define Documentation

#define AFX_COMMITDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file CommitDlg.h.

Function Documentation

bool CompatGetCommit | ( | UStr & | commit,
 |  | bool & | norecurs,
 |  | bool & | forceCommit,
 |  | bool & | forceRecurse,
 |  | UPStr & | rev,
 |  | bool & | noModuleProgram,
 |  | const char * | pathTmpl = 0L,
 |  | MultiFiles * | mf = 0L
 | ) |

Definition at line 759 of file CommitDlg.cpp.

Referenced by CvsCmdCommitFiles(), and CvsCmdCommitFolder().

00763 {
00764     bool userHitOK = false;
00765
00766     static CStr sLastMsg;
00767     static CPStr sLastRev;
00768
00769     bool hasRev = false;
00770
00771     norecurs = false;
00772     commit = "";
00773     forceCommit = false;
00774     forceRecurse = false;
00775     rev = "";
00776     noModuleProgram = false;
00777
00778
00779 #ifdef WIN32
00780     CPropertySheet pages("Commit settings");
00781     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00782     CCommit_MAIN page1(sLastMsg, pathTmpl, mf);
00783     CCommit_OPTIONS page2;
00784     CGetPrefs_GLOBALS page3;
00785     pages.AddPage(&page1);
00786     pages.AddPage(&page2);
00787     pages.AddPage(&page3);
00788     if(pages.DoModal() == IDOK)
00789     {
00790         commit = (const char *)page1.m_logmsg;
00791         sLastMsg = (const char *)page1.m_logmsg;
00792         norecurs = page1.m_norecurs ? true : false;
00793         forceCommit = page2.m_forceCommit ? true : false;
00794         forceRecurse = page2.m_forceRecurse ? true : false;
00795         hasRev = page2.m_forceRevision ? true : false;
00796         sLastRev = page2.m_rev;
00797         noModuleProgram = page2.m_noModuleProgram ? true : false;
00798         page3.StoreValues();
00799
00800         userHitOK = true;
00801     }
00802 #endif /* WIN32 */
00803 #ifdef qMacCvsPP
00804     StDialogHandler theHandler(dlg_Commit, LCommander::GetTopCommander());
00805     LWindow *theDialog = theHandler.GetDialog();
00806     ThrowIfNil_(theDialog);
00807     static UInt16 sRuntimePanel = 1;
00808
00809     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00810         (theDialog->FindPaneByID(item_MultiViewPrefs));
00811     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00812
00813     multiView->SwitchToPanel(3);
00814     DoDataExchange_Globals(theDialog, true);
00815     multiView->SwitchToPanel(2);
00816     DoDataExchange_CommitOptions(theDialog, forceCommit, forceRecurse, hasRev, sLastRev, noModuleProgram, true);
00817     multiView->SwitchToPanel(1);
00818     DoDataExchange_Commit(theDialog, sLastMsg, norecurs, pathTmpl, true);
00819
00820     groupView->SetValue(sRuntimePanel);
00821     theDialog->Show();
00822     MessageT hitMessage;
00823     while (true)
00824     {       // Let DialogHandler process events
00825         hitMessage = theHandler.DoDialog();
00826
00827         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00828             break;
00829     }
00830     theDialog->Hide();
00831     sRuntimePanel = groupView->GetValue();
00832
00833     if(hitMessage == msg_OK)
00834     {
00835         multiView->SwitchToPanel(1);
00836         DoDataExchange_Commit(theDialog, sLastMsg, norecurs, pathTmpl, false);
00837         multiView->SwitchToPanel(2);
00838         DoDataExchange_CommitOptions(theDialog, forceCommit, forceRecurse, hasRev, sLastRev, noModuleProgram, false);
00839         multiView->SwitchToPanel(3);
00840         DoDataExchange_Globals(theDialog, false);
00841         commit = sLastMsg;
00842         commit.replace('\015', '\012');
00843         userHitOK = true;
00844     }
00845 #endif /* qMacCvsPP */
00846 #if qUnix
00847     void *wid = UCreate_CommitDlg();
00848
00849     UCvsCommit *dlg = new UCvsCommit();
00850     UCvsCommit_MAIN *tab1 = new UCvsCommit_MAIN(sLastMsg, pathTmpl);
00851     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00852     dlg->AddPage(tab1, UCvsCommit::kTabGeneral, 0);
00853
00854     if(dlg->DoModal())
00855     {
00856         commit = tab1->m_logmsg;
00857         sLastMsg = tab1->m_logmsg;
00858         norecurs = tab1->m_norecurs;
00859
00860         userHitOK = true;
00861     }
00862
00863     delete dlg;
00864 #endif // qUnix
00865
00866     if(userHitOK)
00867     {
00868         if(commit.length() == 0)
00869             commit = "no message";
00870         if(hasRev && !sLastRev.empty())
00871             rev = sLastRev;
00872         gCvsPrefs.save();
00873     }
00874     return userHitOK;
00875 }

void combozify ( UStr & str )

Definition at line 59 of file CommitDlg.cpp.

00060 {
00061     // extract the first xxx words
00062     const char *tmp = str;
00063     CStr result;
00064     int numWords = 0;
00065 #   define HOWMUCH_WORDS 5
00066     while(*tmp != '\0' && numWords < HOWMUCH_WORDS)
00067     {
00068         while(*tmp != '\0' && isspace(*tmp))
00069             tmp++;
00070
00071         while(*tmp != '\0' && !isspace(*tmp))
00072             result << *tmp ++;
00073
00074         if(*tmp != '\0')
00075             result << ' ';
00076
00077         numWords++;
00078     }
00079
00080     if(*tmp != '\0')
00081     {
00082         result << "...";
00083     }
00084     str = result;
00085 }

Variable Documentation

CMString gRevNames

Definition at line 47 of file CommitDlg.h.

Generated on Sun Oct 21 12:42:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPStr.cpp File Reference

common/CPStr.cpp File Reference

#include "stdafx.h"
#include "CPStr.h"

Include dependency graph for CPStr.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:42:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPStr.h File Reference

common/CPStr.h File Reference

#include <string.h>
#include <stdlib.h>
#include "Persistent.h"
#include "ustr.h"
#include <exception>

Include dependency graph for CPStr.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | PCPStr
class | PCStr
class | CStaticAllocT

Defines

#define | CPStr UPStr
#define | CStr UStr

Define Documentation

#define CPStr UPStr

Definition at line 35 of file CPStr.h.

#define CStr UStr

Definition at line 36 of file CPStr.h.

Referenced by ReportWarning::AddWarning(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnViewLockf(), CGraphView::OnViewUnlockf(), TGraphDelCmd::TraverseNode(), and ign_add().

Generated on Sun Oct 21 12:42:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTCP2Parse.cpp File Reference

common/CTCP2Parse.cpp File Reference

#include "stdafx.h"
#include "CTCP2Parse.hpp"

Include dependency graph for CTCP2Parse.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | CTCP2_TOGGLE(ch, var)
#define | CCOLOR (char)3
#define | CCTCP2 (char)6
#define | MIRC_TRANSPARENT 16
#define | isn(ch) ((ch) >= '0' && (ch) <= '9')
#define | CBOLD (char)2
#define | CCTCP2 (char)6
#define | CSTOP (char)15
#define | CREV (char)22
#define | CUNDR (char)31
#define | INVALID_SEQUENCE -1
#define | ANSI_SGM_TA_RESET 0
#define | ANSI_SGM_TA_BOLD 1
#define | ANSI_SGM_TA_FAINT 2
#define | ANSI_SGM_TA_ITALIC 3
#define | ANSI_SGM_TA_ULINE 4
#define | ANSI_SGM_TA_BLINK 5
#define | ANSI_SGM_TA_REV 7
#define | ANSI_SGM_TA_CONSEAL 8
#define | ANSI_SGM_TA_NORMAL 22
#define | ANSI_SGM_TA_ITALIC_OFF 23
#define | ANSI_SGM_TA_ULINE_OFF 24
#define | ANSI_SGM_TA_BLINK_OFF 25
#define | ANSI_SGM_TA_REV_OFF 27
#define | ANSI_SGM_FC_BLK 30
#define | ANSI_SGM_FC_RED 31
#define | ANSI_SGM_FC_GRN 32
#define | ANSI_SGM_FC_YEL 33
#define | ANSI_SGM_FC_BLU 34
#define | ANSI_SGM_FC_MAG 35
#define | ANSI_SGM_FC_CYN 36
#define | ANSI_SGM_FC_WHT 37
#define | ANSI_SGM_FC_DEFAULT 39
#define | ANSI_SGM_BC_BLK 40
#define | ANSI_SGM_BC_RED 41
#define | ANSI_SGM_BC_GRN 42
#define | ANSI_SGM_BC_YEL 43
#define | ANSI_SGM_BC_BLU 44
#define | ANSI_SGM_BC_MAG 45
#define | ANSI_SGM_BC_CYN 46
#define | ANSI_SGM_BC_WHT 47
#define | ANSI_SGM_BC_DEFAULT 49

Define Documentation

#define ANSI_SGM_BC_BLK 40

Definition at line 622 of file CTCP2Parse.cpp.

#define ANSI_SGM_BC_BLU 44

Definition at line 626 of file CTCP2Parse.cpp.

#define ANSI_SGM_BC_CYN 46

Definition at line 628 of file CTCP2Parse.cpp.

#define ANSI_SGM_BC_DEFAULT 49

Definition at line 630 of file CTCP2Parse.cpp.

#define ANSI_SGM_BC_GRN 42

Definition at line 624 of file CTCP2Parse.cpp.

#define ANSI_SGM_BC_MAG 45

Definition at line 627 of file CTCP2Parse.cpp.

#define ANSI_SGM_BC_RED 41

Definition at line 623 of file CTCP2Parse.cpp.

#define ANSI_SGM_BC_WHT 47

Definition at line 629 of file CTCP2Parse.cpp.

#define ANSI_SGM_BC_YEL 43

Definition at line 625 of file CTCP2Parse.cpp.

#define ANSI_SGM_FC_BLK 30

Definition at line 612 of file CTCP2Parse.cpp.

#define ANSI_SGM_FC_BLU 34

Definition at line 616 of file CTCP2Parse.cpp.

#define ANSI_SGM_FC_CYN 36

Definition at line 618 of file CTCP2Parse.cpp.

#define ANSI_SGM_FC_DEFAULT 39

Definition at line 620 of file CTCP2Parse.cpp.

#define ANSI_SGM_FC_GRN 32

Definition at line 614 of file CTCP2Parse.cpp.

#define ANSI_SGM_FC_MAG 35

Definition at line 617 of file CTCP2Parse.cpp.

#define ANSI_SGM_FC_RED 31

Definition at line 613 of file CTCP2Parse.cpp.

#define ANSI_SGM_FC_WHT 37

Definition at line 619 of file CTCP2Parse.cpp.

#define ANSI_SGM_FC_YEL 33

Definition at line 615 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_BLINK 5

Definition at line 603 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_BLINK_OFF 25

Definition at line 609 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_BOLD 1

Definition at line 599 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_CONSEAL 8

Definition at line 605 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_FAINT 2

Definition at line 600 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_ITALIC 3

Definition at line 601 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_ITALIC_OFF 23

Definition at line 607 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_NORMAL 22

Definition at line 606 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_RESET 0

Definition at line 598 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_REV 7

Definition at line 604 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_REV_OFF 27

Definition at line 610 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_ULINE 4

Definition at line 602 of file CTCP2Parse.cpp.

#define ANSI_SGM_TA_ULINE_OFF 24

Definition at line 608 of file CTCP2Parse.cpp.

#define CBOLD (char)2

Definition at line 495 of file CTCP2Parse.cpp.

#define CCOLOR (char)3

Definition at line 369 of file CTCP2Parse.cpp.

#define CCTCP2 (char)6

Definition at line 496 of file CTCP2Parse.cpp.

#define CCTCP2 (char)6

Definition at line 496 of file CTCP2Parse.cpp.

#define CREV (char)22

Definition at line 498 of file CTCP2Parse.cpp.

#define CSTOP (char)15

Definition at line 497 of file CTCP2Parse.cpp.

#define CTCP2_TOGGLE | ( | ch,
 |  | var | )

Value:

case (ch): \
        decodeToggle(line, &parseFrmChar, &parseEndChar, &(var)); \
            break;

Referenced by CTCP2Parse::ParseIt().

#define CUNDR (char)31

Definition at line 499 of file CTCP2Parse.cpp.

#define INVALID_SEQUENCE -1

Definition at line 552 of file CTCP2Parse.cpp.

#define MIRC_TRANSPARENT 16

Definition at line 371 of file CTCP2Parse.cpp.

#define isn ( ch ) ((ch) >= '0' && (ch) <= '9')

Definition at line 372 of file CTCP2Parse.cpp.

Referenced by mircAttrCvt::extractcolor().

Generated on Sun Oct 21 12:42:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTCP2Parse.hpp File Reference

common/CTCP2Parse.hpp File Reference

#include <string>
#include <vector>

Include dependency graph for CTCP2Parse.hpp:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | ansiAttrCvt
class | ansiAttrCvt::AnsiSeq
class | irciiAttrCvt
class | mircAttrCvt
struct | CTCP2Parse::RGBColor
class | CTCP2Parse

Generated on Sun Oct 21 12:42:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsAlert.cpp File Reference

common/CvsAlert.cpp File Reference

#include "stdafx.h"
#include "CvsAlert.h"

Include dependency graph for CvsAlert.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool CvsAlert (const char *prompt, const char *defhit, const char *cnclhit)

Function Documentation

bool CvsAlert | ( | const char * | prompt,
 |  | const char * | defhit,
 |  | const char * | cnclhit
 | ) |

Definition at line 154 of file CvsAlert.cpp.

00155 {
00156 #ifdef WIN32
00157     CCVSAlert gv(prompt, defhit, cnclhit);
00158     return gv.DoModal() == IDOK;
00159 #endif /* WIN32 */
00160 #ifdef macintosh
00161     static ModalFilterUPP filter = NULL;
00162
00163     if(filter == NULL)
00164         filter = NewModalFilterUPP(AlertModalFilter);
00165
00166     sPrompt = prompt;
00167     sDefhit = defhit;
00168     sCnclhit = cnclhit;
00169
00170     return CautionAlert(kDlgIdAlert, filter) == 1;
00171 #endif /* macintosh */
00172 #if qUnix
00173     void *wid = UCreate_AskYesNo();
00174
00175     UAskYesNo *dlg = new UAskYesNo();
00176     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00177     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, kUMainWidget, (void *)"Alert");
00178     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, UAskYesNo::kOK, (void *)defhit);
00179     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, UAskYesNo::kCancel, (void *)cnclhit);
00180     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, UAskYesNo::kText, (void *)prompt);
00181
00182     bool res = dlg->DoModal();
00183     delete dlg;
00184     return res;
00185 #endif
00186 }

Generated on Sun Oct 21 12:42:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsAlert.h File Reference

common/CvsAlert.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_CVSALERT_H__ACFE8C41_9836_11D1_AE50_00C0F0067852__INCLUDED_

Functions

bool | CvsAlert (const char *prompt, const char *defhit, const char *cnclhit)

Define Documentation

#define AFX_CVSALERT_H__ACFE8C41_9836_11D1_AE50_00C0F0067852__INCLUDED_

Definition at line 25 of file CvsAlert.h.

Function Documentation

bool CvsAlert | ( | const char * | prompt,
 |  | const char * | defhit,
 |  | const char * | cnclhit
 | ) |

Definition at line 154 of file CvsAlert.cpp.

Referenced by AskCreatePersistentSettings(), UCvsFrame::AskForQuitting(), AskYesNo(), CvsCmdAddBinaryFiles(), CvsCmdAddFiles(), KoMoveToTrashHandler::OnFiles(), and CGraphView::OnGraphSetstate().

00155 {
00156 #ifdef WIN32
00157     CCVSAlert gv(prompt, defhit, cnclhit);
00158     return gv.DoModal() == IDOK;
00159 #endif /* WIN32 */
00160 #ifdef macintosh
00161     static ModalFilterUPP filter = NULL;
00162
00163     if(filter == NULL)
00164         filter = NewModalFilterUPP(AlertModalFilter);
00165
00166     sPrompt = prompt;
00167     sDefhit = defhit;
00168     sCnclhit = cnclhit;
00169
00170     return CautionAlert(kDlgIdAlert, filter) == 1;
00171 #endif /* macintosh */
00172 #if qUnix
00173     void *wid = UCreate_AskYesNo();
00174
00175     UAskYesNo *dlg = new UAskYesNo();
00176     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00177     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, kUMainWidget, (void *)"Alert");
00178     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, UAskYesNo::kOK, (void *)defhit);
00179     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, UAskYesNo::kCancel, (void *)cnclhit);
00180     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, UAskYesNo::kText, (void *)prompt);
00181
00182     bool res = dlg->DoModal();
00183     delete dlg;
00184     return res;
00185 #endif
00186 }

Generated on Sun Oct 21 12:42:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsArgs.cpp File Reference

common/CvsArgs.cpp File Reference

#include "stdafx.h"
#include <stdlib.h>
#include <string.h>
#include "CvsPrefs.h"
#include "CvsArgs.h"
#include "AppConsole.h"
#include "Authen.h"

Include dependency graph for CvsArgs.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | MAX_PRINT_ARG 80

Functions

char * | mystrdup (const char *string)
char * | reduceString (const char *str, CStaticAllocT< char > &buf)
char * | expandLF (const char *str, CStaticAllocT< char > &buf)

Variables

CStaticAllocT< char > | buf

Define Documentation

#define MAX_PRINT_ARG 80

Definition at line 133 of file CvsArgs.cpp.

Function Documentation

char* expandLF | ( | const char * | str,
 |  | CStaticAllocT< char > & | buf
 | ) | [static]

Definition at line 156 of file CvsArgs.cpp.

Referenced by CvsArgs::print().

00157 {
00158     int numLFs = 0;
00159     const char *runner = str;
00160     while((runner = strchr(runner, '\n')) != 0L)
00161     {
00162         numLFs++;
00163         runner++;
00164     }
00165
00166     size_t len = strlen(str);
00167     buf.AdjustSize(len + numLFs + 1); // numLFs * "\n" + '\0'
00168
00169     char *tmp = buf;
00170     char c;
00171     runner = str;
00172     while((c = *runner++) != '\0')
00173     {
00174         if(c == '\n')
00175         {
00176             *tmp++ = '\\';
00177             *tmp++ = 'n';
00178         }
00179         else
00180             *tmp++ = c;
00181     }
00182     *tmp++ = '\0';
00183
00184     return buf;
00185 }

char* mystrdup ( const char * string ) [static]

Definition at line 43 of file CvsArgs.cpp.

Referenced by CvsArgs::add(), and CvsArgs::reset().

00044 {
00045     int size = strlen(string);
00046     char *result = (char *)malloc((size + 1) * sizeof(char));
00047     if(result == NULL)
00048     {
00049         cvs_err("Impossible to allocate %d bytes !\n", size + 1);
00050         exit(1);
00051     }
00052     strcpy(result, string);
00053     return result;
00054 }

char* reduceString | ( | const char * | str,
 |  | CStaticAllocT< char > & | buf
 | ) | [static]

Definition at line 134 of file CvsArgs.cpp.

Referenced by CvsArgs::print().

00135 {
00136     buf.AdjustSize(MAX_PRINT_ARG + 4); // "..." + '\0'
00137     size_t len = strlen(str);
00138     if(len < MAX_PRINT_ARG)
00139     {
00140         strcpy(buf, str);
00141     }
00142     else
00143     {
00144         memcpy((char *)buf, str, MAX_PRINT_ARG * sizeof(char));
00145         char *tmp = (char *)buf + MAX_PRINT_ARG;
00146         *tmp++ = '.';
00147         *tmp++ = '.';
00148         *tmp++ = '.';
00149         *tmp = '\0';
00150     }
00151
00152     return buf;
00153 }

Variable Documentation

CStaticAllocT<char> buf [static]

Definition at line 187 of file CvsArgs.cpp.

Generated on Sun Oct 21 12:42:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsArgs.h File Reference

common/CvsArgs.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CvsArgs

Typedefs

typedef int | FSSpec

Typedef Documentation

typedef int FSSpec

Definition at line 31 of file CvsArgs.h.

Generated on Sun Oct 21 12:42:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsCommands.cpp File Reference

common/CvsCommands.cpp File Reference

#include "stdafx.h"
#include <errno.h>
#include "CvsCommands.h"
#include "CvsPrefs.h"
#include "Authen.h"
#include "CvsArgs.h"
#include "MultiFiles.h"
#include "PromptFiles.h"
#include "AppConsole.h"
#include "AppGlue.h"
#include "MoveToTrash.h"
#include "LineCmd.h"
#include "CvsAlert.h"
#include "TextBinary.h"
#include "CommitDlg.h"
#include "ImportDlg.h"
#include "CheckoutDlg.h"
#include "TclGlue.h"
#include "ImportFilterDlg.h"
#include "UpdateDlg.h"
#include "LogDlg.h"
#include "DiffDlg.h"
#include "LogParse.h"
#include "RtagDlg.h"
#include "TagDlg.h"
#include "InitDlg.h"
#include "ReleaseDlg.h"
#include "AnnotateDlg.h"

Include dependency graph for CvsCommands.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | AddBinCvsArgs
class | AddCvsArgs
class | RemoveCvsArgs

Defines

#define | FlatenSubFolders(tmpf)

Functions

char * | cleanUpLogMsg (const char *msg)
void | CvsCmdUpdateFolder (const char *dir, bool queryOnly)
void | CvsCmdCommitFolder (const char *dir)
void | CvsCmdDiffFolder (const char *dir)
void | CvsCmdAddFolder (const char *dir)
void | CvsCmdInit (const char *dir)
void | CvsCmdImportModule (const char *dir)
void | CvsCmdCheckoutModule (const char *dir)
void | CvsCmdRtagCreate (void)
void | CvsCmdRtagDelete (void)
void | CvsCmdRtagBranch (void)
void | CvsCmdLogin (void)
void | CvsCmdLogout (void)
void | CvsCmdUpdateFiles (MultiFiles *mfarg, bool queryOnly)
void | CvsCmdCommitFiles (MultiFiles *mfarg)
void | CvsCmdDiffFiles (MultiFiles *mfarg)
void | CvsCmdLogFiles (MultiFiles *mfarg, bool outGraph, void *defWnd)
void | CvsCmdAddFiles (MultiFiles *mfarg)
void | CvsCmdAddBinaryFiles (MultiFiles *mfarg)
void | CvsCmdRemoveFiles (MultiFiles *mfarg)
void | CvsCmdStatusFiles (MultiFiles *mfarg)
void | CvsCmdCancelChangesFiles (MultiFiles *mfarg)
void | CvsCmdLine (void)
void | CvsCmdLogFolder (const char *dir)
void | CvsCmdStatusFolder (const char *dir)
void | CvsCmdLockFiles (MultiFiles *mfarg)
void | CvsCmdUnlockFiles (MultiFiles *mfarg)
void | CvsCmdTagCreateFiles (MultiFiles *mfarg)
void | CvsCmdTagDeleteFiles (MultiFiles *mfarg)
void | CvsCmdTagBranchFiles (MultiFiles *mfarg)
void | CvsCmdLockFolder (const char *dir)
void | CvsCmdUnlockFolder (const char *dir)
void | CvsCmdTagCreateFolder (const char *dir)
void | CvsCmdTagDeleteFolder (const char *dir)
void | CvsCmdTagBranchFolder (const char *dir)
void | CvsCmdEditFiles (MultiFiles *mfarg)
void | CvsCmdUneditFiles (MultiFiles *mfarg)
void | CvsCmdWatchOnFiles (MultiFiles *mfarg)
void | CvsCmdWatchOffFiles (MultiFiles *mfarg)
void | CvsCmdWatchersFiles (MultiFiles *mfarg)
void | CvsCmdEditorsFiles (MultiFiles *mfarg)
void | CvsCmdEditFolder (const char *dir)
void | CvsCmdUneditFolder (const char *dir)
void | CvsCmdWatchOnFolder (const char *dir)
void | CvsCmdWatchOffFolder (const char *dir)
void | CvsCmdReleaseFolder (const char *dir)
void | CvsCmdWatchersFolder (const char *dir)
void | CvsCmdEditorsFolder (const char *dir)
void | CvsCmdMacrosAdmin (const char *macroName)
void | CvsCmdAnnotateFiles (MultiFiles *mfarg)

Define Documentation

#define FlatenSubFolders ( tmpf )

Definition at line 819 of file CvsCommands.cpp.

Referenced by CvsCmdAnnotateFiles(), and CvsCmdDiffFiles().

Function Documentation

void CvsCmdAddBinaryFiles ( MultiFiles * mf = 0L )

Definition at line 1212 of file CvsCommands.cpp.

01213 {
01214     if(gCvsPrefs.empty())
01215         return;
01216
01217     MultiFiles mf;
01218     if(mfarg == 0L)
01219     {
01220         if(!BrowserGetMultiFiles("Select binary files to add :", mf))
01221             return;
01222         mfarg = &mf;
01223     }
01224
01225     while(mfarg->next())
01226     {
01227         AddBinCvsArgs args;
01228         args.add("add");
01229         args.add("-kb");
01230         const char *dir = mfarg->add(args);
01231
01232         if(!args.HasProblem() || !CvsAlert("Some problems have been found while adding binary files and should be corrected",
01233                 "Cancel", "Ignore"))
01234         {
01235             args.print(dir);
01236             launchCVS(dir, args.Argc(), args.Argv());
01237         }
01238     }
01239 }

void CvsCmdAddFiles ( MultiFiles * mf = 0L )

Definition at line 1120 of file CvsCommands.cpp.

01121 {
01122     if(gCvsPrefs.empty())
01123         return;
01124
01125     MultiFiles mf;
01126     if(mfarg == 0L)
01127     {
01128         if(!BrowserGetMultiFiles("Select files to add :", mf))
01129             return;
01130         mfarg = &mf;
01131     }
01132
01133     while(mfarg->next())
01134     {
01135         AddCvsArgs args;
01136         args.add("add");
01137         const char *dir = mfarg->add(args);
01138
01139         if(!args.HasProblem() || !CvsAlert("Some problems have been found while adding files and should be corrected",
01140                 "Cancel", "Ignore"))
01141         {
01142             args.print(dir);
01143             launchCVS(dir, args.Argc(), args.Argv());
01144         }
01145     }
01146 }

void CvsCmdAddFolder ( const char * dir = 0L )

Definition at line 266 of file CvsCommands.cpp.

00267 {
00268     if(gCvsPrefs.empty())
00269         return;
00270
00271     if(dir == 0L)
00272         dir = BrowserGetDirectory("Select a directory to add :");
00273     if(dir == 0L)
00274         return;
00275
00276     CStr uppath, folder;
00277     if(!SplitPath(dir, uppath, folder))
00278     {
00279         cvs_err("Unable to convert path name '%s'\n", dir);
00280         return;
00281     }
00282
00283     CvsArgs args;
00284     args.add("add");
00285     args.add(folder);
00286     args.print(uppath);
00287     launchCVS(uppath, args.Argc(), args.Argv());
00288 }

void CvsCmdAnnotateFiles ( MultiFiles * mf = 0L )

Definition at line 2039 of file CvsCommands.cpp.

02040 {
02041     if(gCvsPrefs.empty())
02042         return;
02043
02044     MultiFiles mf;
02045     if(mfarg == 0L)
02046     {
02047         if(!BrowserGetMultiFiles("Select files to annotate :", mf))
02048             return;
02049         mfarg = &mf;
02050     }
02051
02052     bool noRecurs;
02053     bool isDate;
02054     CPStr rev;
02055     bool force;
02056
02057     if(!CompatGetAnnotate(noRecurs, isDate, rev, force))
02058         return;
02059
02060     while(mfarg->next())
02061     {
02062         CStr path, filename, ext, base;
02063         CStr file;
02064         for(int i = 0; ; i++)
02065         {
02066             if(!mfarg->get(i, path, filename))
02067                 break;
02068             // note that filename can contain subfolders
02069
02070             GetExtension(filename, base, ext);
02071
02072             CvsArgs args;
02073             CStr tmpf(base);
02074             if(!rev.empty())
02075             {
02076                 tmpf << "_ann_";
02077                 tmpf << rev;
02078                 tmpf << '_';
02079             }
02080             else
02081                 tmpf << "_ann_";
02082
02083             // convert subfolder names to regular name
02084             FlatenSubFolders(tmpf);
02085
02086             args.add("annotate");
02087             if(noRecurs)
02088             {
02089                 args.add("-l");
02090             }
02091             if(force)
02092             {
02093                 args.add("-f");
02094             }
02095             if(!rev.empty())
02096             {
02097                 args.add(isDate ? "-D" : "-r");
02098                 args.add(rev);
02099             }
02100             args.add(filename);
02101             args.print(path);
02102             file = launchCVS(path, args, (const char *)tmpf, ext);
02103 #ifdef qMacCvsPP
02104             decodeCVS (file);
02105 #endif
02106
02107             if(file.empty())
02108                 continue;
02109
02110             LaunchViewer(file, true);
02111         }
02112     }
02113 }

void CvsCmdCancelChangesFiles ( MultiFiles * mf = 0L )

Definition at line 1335 of file CvsCommands.cpp.

01336 {
01337     if(gCvsPrefs.empty())
01338         return;
01339
01340     MultiFiles mf;
01341     if(mfarg == 0L)
01342     {
01343         if(!BrowserGetMultiFiles("Select files to cancel changes :", mf))
01344             return;
01345         mfarg = &mf;
01346     }
01347
01348     while(mfarg->next())
01349     {
01350         RemoveCvsArgs args;
01351         args.add("update");
01352         const char *dir = mfarg->add(args);
01353         args.print(dir);
01354         launchCVS(dir, args.Argc(), args.Argv());
01355     }
01356 }

void CvsCmdCheckoutModule ( const char * dir = 0L )

Definition at line 404 of file CvsCommands.cpp.

00405 {
00406     if(gCvsPrefs.empty())
00407         return;
00408
00409 #ifndef WIN32
00410     if(dir == 0L)
00411         dir = BrowserGetDirectory("Select a directory to checkout to :");
00412     if(dir == 0L)
00413         return;
00414 #endif
00415
00416     bool norecurs;
00417     CPStr modname;
00418     CPStr path(dir);
00419     bool toStdout;
00420     CPStr date;
00421     CPStr rev;
00422     bool useMostRecent;
00423     bool doexport;
00424     bool forceCvsroot;
00425     bool overrideCheckoutDir;
00426     CPStr checkoutDir;
00427
00428     if( !CompatGetCheckout(modname, path, norecurs,
00429         toStdout, date, rev, useMostRecent, doexport, forceCvsroot,
00430         overrideCheckoutDir, checkoutDir) )
00431     {
00432         return;
00433     }
00434
00435     CvsArgs args;
00436
00437     if(forceCvsroot)
00438     {
00439         CStr root;
00440
00441         // extract from the cvsroot
00442         const char *ccvsroot = gCvsPrefs;
00443         ccvsroot = Authen::skiptoken(ccvsroot);
00444         root = gAuthen.token();
00445         root << ccvsroot;
00446         args.add("-d");
00447         args.add(root);
00448     }
00449
00450     args.add(doexport ? "export" : "checkout");
00451
00452     if(gCvsPrefs.PruneOption() && !doexport)
00453         args.add("-P");
00454     if(norecurs)
00455         args.add("-l");
00456     if(toStdout)
00457         args.add("-p");
00458     if(useMostRecent)
00459         args.add("-f");
00460     if(!date.empty())
00461     {
00462         args.add("-D");
00463         args.add(date);
00464     }
00465     if(!rev.empty())
00466     {
00467         args.add("-r");
00468         args.add(rev);
00469     }
00470
00471     if(doexport && rev.empty() && date.empty())
00472     {
00473         args.add("-r");
00474         args.add("HEAD");
00475     }
00476
00477     if( overrideCheckoutDir )
00478     {
00479         args.add("-d");
00480         args.add(checkoutDir);
00481     }
00482
00483     args.add(modname);
00484     args.print(path);
00485     launchCVS(path, args.Argc(), args.Argv());
00486 }

void CvsCmdCommitFiles ( MultiFiles * mf = 0L )

Definition at line 735 of file CvsCommands.cpp.

00736 {
00737     if(gCvsPrefs.empty())
00738         return;
00739
00740     MultiFiles mf;
00741     if(mfarg == 0L)
00742     {
00743         if(!BrowserGetMultiFiles("Select files to commit :", mf))
00744             return;
00745         mfarg = &mf;
00746     }
00747
00748     bool firstTime = true;
00749     bool norecurs;
00750     CStr logmsg;
00751     bool forceCommit;
00752     bool forceRecurse;
00753     CPStr rev;
00754     bool noModuleProgram;
00755     while(mfarg->next())
00756     {
00757         if(firstTime)
00758         {
00759             // we have to give the path where the commit is done is
00760             // the user expects to fill the CVS/Template file. we just
00761             // grab the first one for this purpose.
00762             const char *tmplDir = 0L;
00763             CStr pathTmpl, dontCareFile;
00764             if(mfarg->get(0, pathTmpl, dontCareFile))
00765                 tmplDir = pathTmpl;
00766
00767             if(!CompatGetCommit(logmsg, norecurs, forceCommit, forceRecurse, rev, noModuleProgram, tmplDir, mfarg))
00768                 return;
00769
00770             firstTime = false;
00771         }
00772
00773         CvsArgs args;
00774         args.add("commit");
00775         if(norecurs)
00776             args.add("-l");
00777         if(noModuleProgram)
00778             args.add("-n");
00779         if(forceRecurse)
00780             args.add("-R");
00781         if(forceCommit)
00782             args.add("-f");
00783         args.add("-m");
00784         args.add(cleanUpLogMsg(logmsg));
00785         if(!rev.empty())
00786         {
00787             args.add("-r");
00788             args.add(rev);
00789         }
00790         const char *dir = mfarg->add(args);
00791         args.print(dir);
00792         launchCVS(dir, args.Argc(), args.Argv());
00793     }
00794 }

void CvsCmdCommitFolder ( const char * dir = 0L )

Definition at line 177 of file CvsCommands.cpp.

00178 {
00179     if(gCvsPrefs.empty())
00180         return;
00181
00182     if(dir == 0L)
00183         dir = BrowserGetDirectory("Select a directory to commit :");
00184     if(dir == 0L)
00185         return;
00186
00187     bool norecurs;
00188     CStr logmsg;
00189     bool forceCommit;
00190     bool forceRecurse;
00191     CPStr rev;
00192     bool noModuleProgram;
00193     if(!CompatGetCommit(logmsg, norecurs, forceCommit, forceRecurse, rev, noModuleProgram, dir))
00194         return;
00195
00196     CvsArgs args;
00197     args.add("commit");
00198     if(norecurs)
00199         args.add("-l");
00200     if(noModuleProgram)
00201         args.add("-n");
00202     if(forceRecurse)
00203         args.add("-R");
00204     if(forceCommit)
00205         args.add("-f");
00206     args.add("-m");
00207     args.add(cleanUpLogMsg(logmsg));
00208     if(!rev.empty())
00209     {
00210         args.add("-r");
00211         args.add(rev);
00212     }
00213     args.print(dir);
00214     launchCVS(dir, args.Argc(), args.Argv());
00215 }

void CvsCmdDiffFiles ( MultiFiles * mf = 0L )

Definition at line 823 of file CvsCommands.cpp.

00824 {
00825     if(gCvsPrefs.empty())
00826         return;
00827
00828     MultiFiles mf;
00829     if(mfarg == 0L)
00830     {
00831         if(!BrowserGetMultiFiles("Select files to diff :", mf))
00832             return;
00833         mfarg = &mf;
00834     }
00835
00836     bool noRecurs;
00837     bool isDate1;
00838     bool isDate2;
00839     bool useExtDiff;
00840     CPStr rev1;
00841     CPStr rev2;
00842     bool noWhiteSpace;
00843     bool ignoreCase;
00844     bool extDiffResult;
00845
00846     if(!CompatGetDiff(noRecurs, isDate1, isDate2, rev1, rev2, useExtDiff, noWhiteSpace, ignoreCase, true))
00847         return;
00848
00849     while(mfarg->next())
00850     {
00851         extDiffResult = false;
00852
00853         if (useExtDiff)
00854         {
00855             CStr path, filename, ext, base;
00856             CStr file1, file2;
00857             for(int i = 0; ; i++)
00858             {
00859                 if(!mfarg->get(i, path, filename))
00860                     break;
00861                 // note that filename can contain subfolders
00862
00863                 GetExtension(filename, base, ext);
00864
00865                 CvsArgs args;
00866                 CStr tmpf(base);
00867                 if(!rev1.empty())
00868                 {
00869                     tmpf << '_';
00870                     tmpf << rev1;
00871                     tmpf << '_';
00872                 }
00873                 else
00874                     tmpf << "_orig_";
00875
00876                 // convert subfolder names to regular name
00877                 FlatenSubFolders(tmpf);
00878
00879                 args.add("update");
00880                 args.add("-p");
00881                 if(!rev1.empty())
00882                 {
00883                     args.add(isDate1 ? "-D" : "-r");
00884                     args.add(rev1);
00885                 }
00886                 args.add(filename);
00887                 args.print(path);
00888                 file1 = launchCVS(path, args, (const char *)tmpf, ext);
00889 #ifdef qMacCvsPP
00890                 decodeCVS (file1);
00891 #endif
00892
00893                 if(rev2.empty())
00894                 {
00895                     file2 = path;
00896                     if(!file2.endsWith(kPathDelimiter))
00897                         file2 << kPathDelimiter;
00898                     file2 << filename;
00899                 }
00900                 else
00901                 {
00902                     CvsArgs args2;
00903
00904                     tmpf = base;
00905                     tmpf << '_';
00906                     tmpf << rev2;
00907                     tmpf << '_';
00908
00909                     // convert subfolder names to regular name
00910                     FlatenSubFolders(tmpf);
00911
00912                     args2.add("update");
00913                     args2.add("-p");
00914                     args2.add(isDate2 ? "-D" : "-r");
00915                     args2.add(rev2);
00916                     args2.add(filename);
00917                     args2.print(path);
00918                     file2 = launchCVS(path, args2, (const char *)tmpf, ext);
00919 #ifdef qMacCvsPP
00920                     decodeCVS (file2);
00921 #endif
00922                 }
00923
00924                 if(file1.empty() || file2.empty())
00925                     continue;
00926
00927                 extDiffResult = LaunchDiff(file1, file2);
00928             }
00929         }
00930
00931         if (!useExtDiff || !extDiffResult)
00932         {
00933             CvsArgs args;
00934             args.add("diff");
00935
00936             if(noRecurs)
00937                 args.add("-l");
00938             if(!rev1.empty())
00939             {
00940                 args.add(isDate1 ? "-D" : "-r");
00941                 args.add(rev1);
00942             }
00943             if(!rev2.empty())
00944             {
00945                 args.add(isDate2 ? "-D" : "-r");
00946                 args.add(rev2);
00947             }
00948             if(noWhiteSpace)
00949                 args.add("-w"); //--ignore-all-space
00950             if(ignoreCase)
00951                 args.add("-i"); //--ignore-case
00952
00953             const char *dir = mfarg->add(args);
00954             args.print(dir);
00955             launchCVS(dir, args.Argc(), args.Argv());
00956         }
00957     }
00958 }

void CvsCmdDiffFolder ( const char * dir = 0L )

Definition at line 218 of file CvsCommands.cpp.

00219 {
00220     if(gCvsPrefs.empty())
00221         return;
00222
00223     if(dir == 0L)
00224         dir = BrowserGetDirectory("Select a directory to diff :");
00225
00226     if(dir == 0L)
00227         return;
00228
00229     bool noRecurs;
00230     bool isDate1;
00231     bool isDate2;
00232     bool useExtDiff;
00233     CPStr rev1;
00234     CPStr rev2;
00235     bool noWhiteSpace;
00236     bool ignoreCase;
00237
00238     if(!CompatGetDiff(noRecurs, isDate1, isDate2, rev1, rev2, useExtDiff, noWhiteSpace, ignoreCase))
00239         return;
00240
00241     CvsArgs args;
00242     args.add("diff");
00243
00244     if(noRecurs)
00245         args.add("-l");
00246     if(!rev1.empty())
00247     {
00248         args.add(isDate1 ? "-D" : "-r");
00249         args.add(rev1);
00250     }
00251     if(!rev2.empty())
00252     {
00253         args.add(isDate2 ? "-D" : "-r");
00254         args.add(rev2);
00255     }
00256     if(noWhiteSpace)
00257         args.add("-w"); //--ignore-all-space
00258     if(ignoreCase)
00259         args.add("-i"); //--ignore-case
00260
00261     args.print(dir);
00262     launchCVS(dir, args.Argc(), args.Argv());
00263 }

void CvsCmdEditFiles ( MultiFiles * mf = 0L )

Definition at line 1741 of file CvsCommands.cpp.

01742 {
01743     if(gCvsPrefs.empty())
01744         return;
01745
01746     MultiFiles mf;
01747     if(mfarg == 0L)
01748     {
01749         if(!BrowserGetMultiFiles("Select the files to edit :", mf))
01750             return;
01751         mfarg = &mf;
01752     }
01753
01754     while(mfarg->next())
01755     {
01756         CvsArgs args;
01757         args.add("edit");
01758
01759         const char *dir = mfarg->add(args);
01760         args.print(dir);
01761         launchCVS(dir, args.Argc(), args.Argv());
01762     }
01763 }

void CvsCmdEditFolder ( const char * dir = 0L )

Definition at line 1887 of file CvsCommands.cpp.

01888 {
01889     if(gCvsPrefs.empty())
01890         return;
01891
01892     if(dir == 0L)
01893         dir = BrowserGetDirectory("Select a directory to edit :");
01894     if(dir == 0L)
01895         return;
01896
01897     CvsArgs args;
01898     args.add("edit");
01899
01900     args.print(dir);
01901     launchCVS(dir, args.Argc(), args.Argv());
01902 }

void CvsCmdEditorsFiles ( MultiFiles * mf = 0L )

Definition at line 1863 of file CvsCommands.cpp.

01864 {
01865     if(gCvsPrefs.empty())
01866         return;
01867
01868     MultiFiles mf;
01869     if(mfarg == 0L)
01870     {
01871         if(!BrowserGetMultiFiles("Select the files to get the editors from :", mf))
01872             return;
01873         mfarg = &mf;
01874     }
01875
01876     while(mfarg->next())
01877     {
01878         CvsArgs args;
01879         args.add("editors");
01880
01881         const char *dir = mfarg->add(args);
01882         args.print(dir);
01883         launchCVS(dir, args.Argc(), args.Argv());
01884     }
01885 }

void CvsCmdEditorsFolder ( const char * dir = 0L )

Definition at line 2010 of file CvsCommands.cpp.

02011 {
02012     if(gCvsPrefs.empty())
02013         return;
02014
02015     if(dir == 0L)
02016         dir = BrowserGetDirectory("Select a directory to get the editors from :");
02017     if(dir == 0L)
02018         return;
02019
02020     CvsArgs args;
02021     args.add("editors");
02022
02023     args.print(dir);
02024     launchCVS(dir, args.Argc(), args.Argv());
02025 }

void CvsCmdImportModule ( const char * dir = 0L )

Definition at line 322 of file CvsCommands.cpp.

00323 {
00324     if(gCvsPrefs.empty())
00325         return;
00326
00327     if(dir == 0L)
00328         dir = BrowserGetDirectory("Select a directory to import :");
00329     if(dir == 0L)
00330         return;
00331
00332     ReportConflict * entries;
00333     ReportWarning * warnings;
00334
00335     if(!CompatImportFilter(dir, entries, warnings))
00336         return;
00337
00338     CPStr modname, vendortag, reltag, path(dir);
00339     CStr logmsg;
00340     bool useDefIgnore;
00341
00342     if(!CompatGetImport(modname, logmsg, vendortag, reltag, path, useDefIgnore))
00343         return;
00344
00345     CvsArgs args;
00346     args.add("import");
00347
00348     // fill the wrappers
00349     ReportConflict * tmpentry = entries;
00350     if( !useDefIgnore )
00351     {
00352         args.add("-I"); // no default (core, *.o...)
00353         args.add("!");
00354         args.add("-I"); // but ignore the CVS folders
00355         args.add("CVS");
00356     }
00357     while(tmpentry != 0L)
00358     {
00359         if(tmpentry->HasIgnore())
00360         {
00361             CPStr ign;
00362             args.add("-I");
00363             if(tmpentry->IsExtension())
00364                 ign << '*';
00365             ign << tmpentry->GetPattern();
00366             args.add(ign);
00367         }
00368         else if(!tmpentry->HasForceText() &&
00369             (tmpentry->IsBinary() || tmpentry->HasForceBinary() || tmpentry->HasForceNoKeywords() ))
00370         {
00371             CPStr wrap;
00372             const char *pattern = tmpentry->GetPattern();
00373             bool hasSpace = strchr(pattern, ' ') != 0L;
00374             args.add("-W");
00375             if(hasSpace)
00376                 wrap << '"';
00377             if(tmpentry->IsExtension())
00378                 wrap << '*';
00379             wrap << pattern;
00380             if(hasSpace)
00381                 wrap << '"';
00382             if( tmpentry->HasForceNoKeywords() )
00383                 wrap << " -k 'o'";
00384             else
00385                 wrap << " -k 'b'";
00386
00387             args.add(wrap);
00388         }
00389         tmpentry = tmpentry->next;
00390     }
00391
00392     free_list_types(warnings, entries);
00393
00394     args.add("-m");
00395     args.add(cleanUpLogMsg(logmsg));
00396     args.add(modname);
00397     args.add(vendortag);
00398     args.add(reltag);
00399     args.print(path);
00400     launchCVS(path, args.Argc(), args.Argv());
00401 }

void CvsCmdInit ( const char * dir = 0L )

Definition at line 291 of file CvsCommands.cpp.

00292 {
00293     if(gCvsPrefs.empty())
00294         return;
00295
00296     bool forceCvsroot;
00297
00298     if(!CompatGetInit(forceCvsroot))
00299         return;
00300
00301     CvsArgs args;
00302
00303     if(forceCvsroot)
00304     {
00305         CStr root;
00306
00307         // extract from the cvsroot
00308         const char *ccvsroot = gCvsPrefs;
00309         ccvsroot = Authen::skiptoken(ccvsroot);
00310         root = gAuthen.token();
00311         root << ccvsroot;
00312         args.add("-d");
00313         args.add(root);
00314     }
00315
00316     args.add("init");
00317     args.print();
00318     launchCVS(0L, args.Argc(), args.Argv());
00319 }

void CvsCmdLine ( void )

Definition at line 1358 of file CvsCommands.cpp.

Referenced by CWincvsDoc::OnAppCmdline(), and UCvsFrame::OnCmdCmdline().

01359 {
01360     CvsArgs args(false);
01361     const char *dir;
01362     if(!CompatGetCommand(args, dir))
01363         return;
01364     args.print(dir);
01365     launchCVS(dir, args.Argc(), args.Argv());
01366 }

void CvsCmdLockFiles ( MultiFiles * mf = 0L )

Definition at line 1459 of file CvsCommands.cpp.

01460 {
01461     if(gCvsPrefs.empty())
01462         return;
01463
01464     MultiFiles mf;
01465     if(mfarg == 0L)
01466     {
01467         if(!BrowserGetMultiFiles("Select files to lock :", mf))
01468             return;
01469         mfarg = &mf;
01470     }
01471
01472     while(mfarg->next())
01473     {
01474         CvsArgs args;
01475         args.add("admin");
01476         args.add("-l");
01477
01478         const char *dir = mfarg->add(args);
01479         args.print(dir);
01480         launchCVS(dir, args.Argc(), args.Argv());
01481     }
01482 }

void CvsCmdLockFolder ( const char * dir = 0L )

Definition at line 1618 of file CvsCommands.cpp.

01619 {
01620     if(gCvsPrefs.empty())
01621         return;
01622
01623     if(dir == 0L)
01624         dir = BrowserGetDirectory("Select a directory to lock :");
01625     if(dir == 0L)
01626         return;
01627
01628     CvsArgs args;
01629     args.add("admin");
01630     args.add("-l");
01631
01632     args.print(dir);
01633     launchCVS(dir, args.Argc(), args.Argv());
01634 }

void CvsCmdLogFiles | ( | MultiFiles * | mf = 0L,
 |  | bool | outGraph = false,
 |  | void * | defWnd = 0L
 | ) |

Definition at line 961 of file CvsCommands.cpp.

00962 {
00963     if(gCvsPrefs.empty())
00964         return;
00965
00966     MultiFiles mf;
00967     if(mfarg == 0L)
00968     {
00969         if(!BrowserGetMultiFiles("Select files to log :", mf))
00970             return;
00971         mfarg = &mf;
00972     }
00973
00974     bool noRecurs;
00975     bool defBranch;
00976     CPStr date;
00977     bool headerOnly;
00978     bool noTags;
00979     bool onlyRCSfile;
00980     bool hasRev;
00981     CPStr rev;
00982     CPStr states;
00983     bool hasUser;
00984     CPStr users;
00985
00986     if( !CompatGetLog(noRecurs, defBranch, date,
00987         headerOnly, noTags, onlyRCSfile, hasRev,
00988         rev, states, hasUser, users,
00989         outGraph) )
00990     {
00991         return;
00992     }
00993
00994     while(mfarg->next())
00995     {
00996         CvsArgs args;
00997         args.add("log");
00998
00999         if(noRecurs)
01000             args.add("-l");
01001         if(defBranch)
01002             args.add("-b");
01003         if(headerOnly)
01004             args.add("-h");
01005         if(noTags)
01006             args.add("-N");
01007         if(onlyRCSfile)
01008             args.add("-R");
01009
01010         if(!date.empty())
01011         {
01012             args.add("-d");
01013             args.add(date);
01014         }
01015         if(!states.empty())
01016         {
01017             args.add("-s");
01018             args.add(states);
01019         }
01020         if(hasRev)
01021         {
01022             CPStr tmp;
01023             tmp = "-r";
01024             tmp << rev;
01025             args.add(tmp);
01026         }
01027         if(hasUser)
01028         {
01029             CPStr tmp;
01030             tmp = "-w";
01031             tmp << users;
01032             args.add(tmp);
01033         }
01034
01035         const char *dir = mfarg->add(args);
01036         args.print(dir);
01037         CvsLogParse(dir, args, outGraph, defWnd);
01038     }
01039 }

void CvsCmdLogFolder ( const char * dir = 0L )

Definition at line 1369 of file CvsCommands.cpp.

01370 {
01371     if(gCvsPrefs.empty())
01372         return;
01373
01374     if(dir == 0L)
01375         dir = BrowserGetDirectory("Select a directory to log :");
01376     if(dir == 0L)
01377         return;
01378
01379     bool noRecurs;
01380     bool defBranch;
01381     CPStr date;
01382     bool headerOnly;
01383     bool noTags;
01384     bool onlyRCSfile;
01385     bool hasRev;
01386     CPStr rev;
01387     CPStr states;
01388     bool hasUser;
01389     CPStr users;
01390
01391     if(!CompatGetLog(noRecurs, defBranch, date,
01392         headerOnly, noTags, onlyRCSfile, hasRev,
01393         rev, states, hasUser, users))
01394             return;
01395
01396     CvsArgs args;
01397     args.add("log");
01398
01399     if(noRecurs)
01400         args.add("-l");
01401     if(defBranch)
01402         args.add("-b");
01403     if(headerOnly)
01404         args.add("-h");
01405     if(noTags)
01406         args.add("-N");
01407     if(onlyRCSfile)
01408         args.add("-R");
01409
01410     if(!date.empty())
01411     {
01412         args.add("-d");
01413         args.add(date);
01414     }
01415     if(!states.empty())
01416     {
01417         args.add("-s");
01418         args.add(states);
01419     }
01420     if(hasRev)
01421     {
01422         CPStr tmp;
01423         tmp = "-r";
01424         tmp << rev;
01425         args.add(tmp);
01426     }
01427     if(hasUser)
01428     {
01429         CPStr tmp;
01430         tmp = "-w";
01431         tmp << users;
01432         args.add(tmp);
01433     }
01434
01435     args.print(dir);
01436     CvsLogParse(dir, args, false, NULL);
01437 }

void CvsCmdLogin ( void )

Definition at line 607 of file CvsCommands.cpp.

Referenced by CWincvsDoc::OnAppLogin(), and UCvsFrame::OnCmdLogin().

00608 {
00609     if(gCvsPrefs.empty())
00610         return;
00611
00612     if(gAuthen.kind() != pserver)
00613     {
00614         cvs_err("Set the password authentication first in the preferences !\n");
00615         return;
00616     }
00617
00618     if(gCvsPrefs.HasLoogedIn() && gCvsPrefs.LogoutTimeOut() > 0)
00619     {
00620         cvs_err("Making automatic logout:\n");
00621         CvsCmdLogout();
00622         WaitForCvs();
00623     }
00624     gCvsPrefs.SetHasLoogedIn(true);
00625
00626     CvsArgs args;
00627     args.add("login");
00628     args.print();
00629     launchCVS(0L, args.Argc(), args.Argv());
00630 }

void CvsCmdLogout ( void )

Definition at line 633 of file CvsCommands.cpp.

Referenced by CvsCmdLogin(), CLogoutThread::InitInstance(), CWincvsDoc::OnAppLogout(), UCvsFrame::OnCmdLogout(), and CWincvsApp::SaveAllModified().

00634 {
00635     if(gCvsPrefs.empty())
00636         return;
00637
00638     if(gAuthen.kind() != pserver)
00639     {
00640         cvs_err("Set the password authentication first in the preferences !\n");
00641         return;
00642     }
00643
00644     gCvsPrefs.SetHasLoogedIn(false);
00645
00646     CvsArgs args;
00647     args.add("logout");
00648     args.print();
00649     launchCVS(0L, args.Argc(), args.Argv());
00650 }

void CvsCmdMacrosAdmin ( const char * macroName )

Definition at line 2027 of file CvsCommands.cpp.

02028 {
02029     if(gCvsPrefs.empty() || !CTcl_Interp::IsAvail())
02030         return;
02031
02032     CTcl_Interp interp;
02033     CStr path = macroName;
02034     CTcl_Interp::Unixfy(path);
02035     interp.DoScriptVar("source \"%s\"", (const char *)path);
02036 }

void CvsCmdReleaseFolder ( const char * dir = 0L )

Definition at line 1957 of file CvsCommands.cpp.

01958 {
01959     if(gCvsPrefs.empty())
01960         return;
01961
01962     if(dir == 0L)
01963         dir = BrowserGetDirectory("Select a directory to release :");
01964     if(dir == 0L)
01965         return;
01966
01967     CStr uppath, folder;
01968     if( !SplitPath(dir, uppath, folder) )
01969     {
01970         cvs_err("Unable to convert path name '%s'\n", dir);
01971         //even thought something didn't work we will try to continue and put all the responsibility onto the user
01972         uppath = dir;
01973         folder = ".";
01974     }
01975
01976     bool removeDirectory = false;
01977
01978     if( !CompatGetRelease(dir, removeDirectory) )
01979     {
01980         return;
01981     }
01982
01983     CvsArgs args;
01984     args.add("release");
01985     if( removeDirectory )
01986         args.add("-d");
01987     args.add(folder);
01988
01989     args.print(uppath);
01990     launchCVS(uppath, args.Argc(), args.Argv());
01991 }

void CvsCmdRemoveFiles ( MultiFiles * mf = 0L )

Definition at line 1280 of file CvsCommands.cpp.

01281 {
01282     if(gCvsPrefs.empty())
01283         return;
01284
01285     MultiFiles mf;
01286     if(mfarg == 0L)
01287     {
01288         if(!BrowserGetMultiFiles("Select files to remove :", mf))
01289             return;
01290         mfarg = &mf;
01291     }
01292
01293     while(mfarg->next())
01294     {
01295         RemoveCvsArgs args;
01296
01297         CompatBeginMoveToTrash();
01298
01299         args.add("remove");
01300         const char *dir = mfarg->add(args);
01301         args.print(dir);
01302
01303         CompatEndMoveToTrash();
01304
01305         launchCVS(dir, args.Argc(), args.Argv());
01306     }
01307 }

void CvsCmdRtagBranch ( void )

Definition at line 563 of file CvsCommands.cpp.

Referenced by CWincvsDoc::OnAppRtagBranch(), and UCvsFrame::OnCmdRtagBranch().

00564 {
00565     if(gCvsPrefs.empty())
00566         return;
00567
00568     bool norecurs;
00569     bool useMostRecent;
00570     bool lookAttic;
00571     CPStr modname;
00572     CPStr branchname;
00573     CPStr date;
00574     CPStr rev;
00575
00576     if(!CompatRtagBranch(norecurs, branchname, modname, date, rev,
00577         useMostRecent, lookAttic))
00578             return;
00579
00580     CvsArgs args;
00581     args.add("rtag");
00582     args.add("-b");
00583     if(norecurs)
00584         args.add("-l");
00585     if(useMostRecent)
00586         args.add("-f");
00587     if(lookAttic)
00588         args.add("-a");
00589     if(!date.empty())
00590     {
00591         args.add("-D");
00592         args.add(date);
00593     }
00594     if(!rev.empty())
00595     {
00596         args.add("-r");
00597         args.add(rev);
00598     }
00599
00600     args.add(branchname);
00601     args.add(modname);
00602     args.print();
00603     launchCVS(0L, args.Argc(), args.Argv());
00604 }

void CvsCmdRtagCreate ( void )

Definition at line 489 of file CvsCommands.cpp.

Referenced by CWincvsDoc::OnAppRtagNew(), and UCvsFrame::OnCmdRtagNew().

00490 {
00491     if(gCvsPrefs.empty())
00492         return;
00493
00494     bool norecurs;
00495     bool useMostRecent;
00496     bool overwriteExisting;
00497     bool lookAttic;
00498     CPStr modname;
00499     CPStr tagname;
00500     CPStr date;
00501     CPStr rev;
00502
00503     if(!CompatRtagCreate(norecurs, overwriteExisting, tagname, modname, date, rev,
00504         useMostRecent, lookAttic))
00505             return;
00506
00507     CvsArgs args;
00508     args.add("rtag");
00509     if(norecurs)
00510         args.add("-l");
00511     if(useMostRecent)
00512         args.add("-f");
00513     if(overwriteExisting)
00514         args.add("-F");
00515     if(lookAttic)
00516         args.add("-a");
00517     if(!date.empty())
00518     {
00519         args.add("-D");
00520         args.add(date);
00521     }
00522     if(!rev.empty())
00523     {
00524         args.add("-r");
00525         args.add(rev);
00526     }
00527
00528     args.add(tagname);
00529     args.add(modname);
00530     args.print();
00531     launchCVS(0L, args.Argc(), args.Argv());
00532 }

void CvsCmdRtagDelete ( void )

Definition at line 535 of file CvsCommands.cpp.

Referenced by CWincvsDoc::OnAppRtagDelete(), and UCvsFrame::OnCmdRtagDelete().

00536 {
00537     if(gCvsPrefs.empty())
00538         return;
00539
00540     bool norecurs;
00541     bool lookAttic;
00542     CPStr modname;
00543     CPStr tagname;
00544
00545     if(!CompatRtagDelete(norecurs, lookAttic, tagname, modname))
00546             return;
00547
00548     CvsArgs args;
00549     args.add("rtag");
00550     args.add("-d");
00551     if(norecurs)
00552         args.add("-l");
00553     if(lookAttic)
00554         args.add("-a");
00555
00556     args.add(tagname);
00557     args.add(modname);
00558     args.print();
00559     launchCVS(0L, args.Argc(), args.Argv());
00560 }

void CvsCmdStatusFiles ( MultiFiles * mf = 0L )

Definition at line 1310 of file CvsCommands.cpp.

01311 {
01312     if(gCvsPrefs.empty())
01313         return;
01314
01315     MultiFiles mf;
01316     if(mfarg == 0L)
01317     {
01318         if(!BrowserGetMultiFiles("Select files to status :", mf))
01319             return;
01320         mfarg = &mf;
01321     }
01322
01323     while(mfarg->next())
01324     {
01325         CvsArgs args;
01326         args.add("status");
01327         args.add("-v");
01328         const char *dir = mfarg->add(args);
01329         args.print(dir);
01330         launchCVS(dir, args.Argc(), args.Argv());
01331     }
01332 }

void CvsCmdStatusFolder ( const char * dir = 0L )

Definition at line 1440 of file CvsCommands.cpp.

01441 {
01442     if(gCvsPrefs.empty())
01443         return;
01444
01445     if(dir == 0L)
01446         dir = BrowserGetDirectory("Select a directory to get status :");
01447     if(dir == 0L)
01448         return;
01449
01450     CvsArgs args;
01451     args.add("status");
01452     args.add("-v");
01453
01454     args.print(dir);
01455     launchCVS(dir, args.Argc(), args.Argv());
01456 }

void CvsCmdTagBranchFiles ( MultiFiles * mf = 0L )

Definition at line 1582 of file CvsCommands.cpp.

01583 {
01584     if(gCvsPrefs.empty())
01585         return;
01586
01587     MultiFiles mf;
01588     if(mfarg == 0L)
01589     {
01590         if(!BrowserGetMultiFiles("Select files to branch :", mf))
01591             return;
01592         mfarg = &mf;
01593     }
01594
01595     bool noRecurs, checkUnmod;
01596     CPStr branchName;
01597     if(!CompatTagBranch(noRecurs, branchName, checkUnmod))
01598         return;
01599
01600     while(mfarg->next())
01601     {
01602         CvsArgs args;
01603         args.add("tag");
01604         args.add("-b");
01605         if(noRecurs)
01606             args.add("-l");
01607         if(checkUnmod)
01608             args.add("-c");
01609         args.add(branchName);
01610
01611         const char *dir = mfarg->add(args);
01612         args.print(dir);
01613         launchCVS(dir, args.Argc(), args.Argv());
01614     }
01615 }

void CvsCmdTagBranchFolder ( const char * dir = 0L )

Definition at line 1713 of file CvsCommands.cpp.

01714 {
01715     if(gCvsPrefs.empty())
01716         return;
01717
01718     if(dir == 0L)
01719         dir = BrowserGetDirectory("Select a directory to branch :");
01720     if(dir == 0L)
01721         return;
01722
01723     bool noRecurs, checkUnmod;
01724     CPStr tagName;
01725     if(!CompatTagBranch(noRecurs, tagName, checkUnmod))
01726         return;
01727
01728     CvsArgs args;
01729     args.add("tag");
01730     args.add("-b");
01731     if(noRecurs)
01732         args.add("-l");
01733     if(checkUnmod)
01734         args.add("-c");
01735     args.add(tagName);
01736
01737     args.print(dir);
01738     launchCVS(dir, args.Argc(), args.Argv());
01739 }

void CvsCmdTagCreateFiles ( MultiFiles * mf = 0L )

Definition at line 1511 of file CvsCommands.cpp.

01512 {
01513     if(gCvsPrefs.empty())
01514         return;
01515
01516     MultiFiles mf;
01517     if(mfarg == 0L)
01518     {
01519         if(!BrowserGetMultiFiles("Select files to tag :", mf))
01520             return;
01521         mfarg = &mf;
01522     }
01523
01524     bool noRecurs, overwriteExisting, checkUnmod;
01525     CPStr tagName;
01526     if(!CompatTagCreate(noRecurs, overwriteExisting, tagName, checkUnmod))
01527         return;
01528
01529     while(mfarg->next())
01530     {
01531         CvsArgs args;
01532         args.add("tag");
01533         if(noRecurs)
01534             args.add("-l");
01535         if(overwriteExisting)
01536             args.add("-F");
01537         if(checkUnmod)
01538             args.add("-c");
01539         args.add(tagName);
01540
01541         const char *dir = mfarg->add(args);
01542         args.print(dir);
01543         launchCVS(dir, args.Argc(), args.Argv());
01544     }
01545 }

void CvsCmdTagCreateFolder ( const char * dir = 0L )

Definition at line 1656 of file CvsCommands.cpp.

01657 {
01658     if(gCvsPrefs.empty())
01659         return;
01660
01661     if(dir == 0L)
01662         dir = BrowserGetDirectory("Select a directory to tag :");
01663     if(dir == 0L)
01664         return;
01665
01666     bool noRecurs, overwriteExisting, checkUnmod;
01667     CPStr tagName;
01668     if(!CompatTagCreate(noRecurs, overwriteExisting, tagName, checkUnmod))
01669         return;
01670
01671     CvsArgs args;
01672     args.add("tag");
01673     if(noRecurs)
01674         args.add("-l");
01675     if(overwriteExisting)
01676         args.add("-F");
01677     if(checkUnmod)
01678         args.add("-c");
01679     args.add(tagName);
01680
01681     args.print(dir);
01682     launchCVS(dir, args.Argc(), args.Argv());
01683 }

void CvsCmdTagDeleteFiles ( MultiFiles * mf = 0L )

Definition at line 1548 of file CvsCommands.cpp.

01549 {
01550     if(gCvsPrefs.empty())
01551         return;
01552
01553     MultiFiles mf;
01554     if(mfarg == 0L)
01555     {
01556         if(!BrowserGetMultiFiles("Select files to untag :", mf))
01557             return;
01558         mfarg = &mf;
01559     }
01560
01561     bool noRecurs;
01562     CPStr tagName;
01563     if(!CompatTagDelete(noRecurs, tagName))
01564         return;
01565
01566     while(mfarg->next())
01567     {
01568         CvsArgs args;
01569         args.add("tag");
01570         args.add("-d");
01571         if(noRecurs)
01572             args.add("-l");
01573         args.add(tagName);
01574
01575         const char *dir = mfarg->add(args);
01576         args.print(dir);
01577         launchCVS(dir, args.Argc(), args.Argv());
01578     }
01579 }

void CvsCmdTagDeleteFolder ( const char * dir = 0L )

Definition at line 1686 of file CvsCommands.cpp.

01687 {
01688     if(gCvsPrefs.empty())
01689         return;
01690
01691     if(dir == 0L)
01692         dir = BrowserGetDirectory("Select a directory to untag :");
01693     if(dir == 0L)
01694         return;
01695
01696     bool noRecurs;
01697     CPStr tagName;
01698     if(!CompatTagDelete(noRecurs, tagName))
01699         return;
01700
01701     CvsArgs args;
01702     args.add("tag");
01703     args.add("-d");
01704     if(noRecurs)
01705         args.add("-l");
01706     args.add(tagName);
01707
01708     args.print(dir);
01709     launchCVS(dir, args.Argc(), args.Argv());
01710 }

void CvsCmdUneditFiles ( MultiFiles * mf = 0L )

Definition at line 1765 of file CvsCommands.cpp.

01766 {
01767     if(gCvsPrefs.empty())
01768         return;
01769
01770     MultiFiles mf;
01771     if(mfarg == 0L)
01772     {
01773         if(!BrowserGetMultiFiles("Select the files to unedit :", mf))
01774             return;
01775         mfarg = &mf;
01776     }
01777
01778     while(mfarg->next())
01779     {
01780         CvsArgs args;
01781         args.add("unedit");
01782
01783         const char *dir = mfarg->add(args);
01784         args.print(dir);
01785         launchCVS(dir, args.Argc(), args.Argv());
01786     }
01787 }

void CvsCmdUneditFolder ( const char * dir = 0L )

Definition at line 1904 of file CvsCommands.cpp.

01905 {
01906     if(gCvsPrefs.empty())
01907         return;
01908
01909     if(dir == 0L)
01910         dir = BrowserGetDirectory("Select a directory to unedit :");
01911     if(dir == 0L)
01912         return;
01913
01914     CvsArgs args;
01915     args.add("unedit");
01916
01917     args.print(dir);
01918     launchCVS(dir, args.Argc(), args.Argv());
01919 }

void CvsCmdUnlockFiles ( MultiFiles * mf = 0L )

Definition at line 1485 of file CvsCommands.cpp.

01486 {
01487     if(gCvsPrefs.empty())
01488         return;
01489
01490     MultiFiles mf;
01491     if(mfarg == 0L)
01492     {
01493         if(!BrowserGetMultiFiles("Select files to unlock :", mf))
01494             return;
01495         mfarg = &mf;
01496     }
01497
01498     while(mfarg->next())
01499     {
01500         CvsArgs args;
01501         args.add("admin");
01502         args.add("-u");
01503
01504         const char *dir = mfarg->add(args);
01505         args.print(dir);
01506         launchCVS(dir, args.Argc(), args.Argv());
01507     }
01508 }

void CvsCmdUnlockFolder ( const char * dir = 0L )

Definition at line 1637 of file CvsCommands.cpp.

01638 {
01639     if(gCvsPrefs.empty())
01640         return;
01641
01642     if(dir == 0L)
01643         dir = BrowserGetDirectory("Select a directory to unlock :");
01644     if(dir == 0L)
01645         return;
01646
01647     CvsArgs args;
01648     args.add("admin");
01649     args.add("-u");
01650
01651     args.print(dir);
01652     launchCVS(dir, args.Argc(), args.Argv());
01653 }

void CvsCmdUpdateFiles | ( | MultiFiles * | mf = 0L,
 |  | bool | queryOnly = false
 | ) |

Definition at line 653 of file CvsCommands.cpp.

00654 {
00655     if(gCvsPrefs.empty())
00656         return;
00657
00658     MultiFiles mf;
00659     if(mfarg == 0L)
00660     {
00661         if(!BrowserGetMultiFiles("Select files to update :", mf))
00662             return;
00663         mfarg = &mf;
00664     }
00665
00666     bool toStdout;
00667     bool noRecurs;
00668     bool resetSticky;
00669     CPStr date;
00670     CPStr rev;
00671     bool useMostRecent;
00672     CPStr rev1;
00673     CPStr rev2;
00674     bool createMissDir;
00675     bool getCleanCopy;
00676
00677     if(!queryOnly && !CompatGetUpdate(toStdout, noRecurs, resetSticky,
00678         date, rev, useMostRecent, rev1, rev2, createMissDir, getCleanCopy))
00679         return;
00680
00681     while(mfarg->next())
00682     {
00683         CvsArgs args;
00684         if(queryOnly)
00685             args.add("-n");
00686         args.add("update");
00687
00688         if(!queryOnly)
00689         {
00690             if(resetSticky)
00691                 args.add("-A");
00692             if(createMissDir)
00693                 args.add("-d");
00694             if(getCleanCopy)
00695                 args.add("-C");
00696             if(!date.empty())
00697             {
00698                 args.add("-D");
00699                 args.add(date);
00700             }
00701             if(useMostRecent)
00702                 args.add("-f");
00703             if(!rev1.empty())
00704             {
00705                 CPStr tmp;
00706                 tmp = "-j";
00707                 tmp << rev1;
00708                 args.add(tmp);
00709             }
00710             if(!rev2.empty())
00711             {
00712                 CPStr tmp;
00713                 tmp = "-j";
00714                 tmp << rev2;
00715                 args.add(tmp);
00716             }
00717             /*if(noRecurs)
00718                 args.add("-l");*/
00719             if(toStdout)
00720                 args.add("-p");
00721             if(!rev.empty())
00722             {
00723                 args.add("-r");
00724                 args.add(rev);
00725             }
00726         }
00727
00728         const char *dir = mfarg->add(args);
00729         args.print(dir);
00730         launchCVS(dir, args.Argc(), args.Argv());
00731     }
00732 }

void CvsCmdUpdateFolder | ( | const char * | dir = 0L,
 |  | bool | queryOnly = false
 | ) |

Definition at line 100 of file CvsCommands.cpp.

00101 {
00102     if(gCvsPrefs.empty())
00103         return;
00104
00105     if(dir == 0L)
00106         dir = BrowserGetDirectory("Select a directory to update :");
00107     if(dir == 0L)
00108         return;
00109
00110     bool toStdout;
00111     bool noRecurs;
00112     bool resetSticky;
00113     CPStr date;
00114     CPStr rev;
00115     bool useMostRecent;
00116     CPStr rev1;
00117     CPStr rev2;
00118     bool createMissDir;
00119     bool getCleanCopy;
00120
00121     if(!queryOnly && !CompatGetUpdate(toStdout, noRecurs, resetSticky,
00122         date, rev, useMostRecent, rev1, rev2, createMissDir, getCleanCopy))
00123         return;
00124
00125     CvsArgs args;
00126     if(queryOnly)
00127         args.add("-n");
00128     args.add("update");
00129     if(gCvsPrefs.PruneOption())
00130         args.add("-P");
00131
00132     if(!queryOnly)
00133     {
00134         if(resetSticky)
00135             args.add("-A");
00136         if(createMissDir)
00137             args.add("-d");
00138         if(getCleanCopy)
00139             args.add("-C");
00140         if(!date.empty())
00141         {
00142             args.add("-D");
00143             args.add(date);
00144         }
00145         if(useMostRecent)
00146             args.add("-f");
00147         if(!rev1.empty())
00148         {
00149             CPStr tmp;
00150             tmp = "-j";
00151             tmp << rev1;
00152             args.add(tmp);
00153         }
00154         if(!rev2.empty())
00155         {
00156             CPStr tmp;
00157             tmp = "-j";
00158             tmp << rev2;
00159             args.add(tmp);
00160         }
00161         if(noRecurs)
00162             args.add("-l");
00163         if(toStdout)
00164             args.add("-p");
00165         if(!rev.empty())
00166         {
00167             args.add("-r");
00168             args.add(rev);
00169         }
00170     }
00171
00172     args.print(dir);
00173     launchCVS(dir, args.Argc(), args.Argv());
00174 }

void CvsCmdWatchOffFiles ( MultiFiles * mf = 0L )

Definition at line 1814 of file CvsCommands.cpp.

01815 {
01816     if(gCvsPrefs.empty())
01817         return;
01818
01819     MultiFiles mf;
01820     if(mfarg == 0L)
01821     {
01822         if(!BrowserGetMultiFiles("Select the files to unwatch :", mf))
01823             return;
01824         mfarg = &mf;
01825     }
01826
01827     while(mfarg->next())
01828     {
01829         CvsArgs args;
01830         args.add("watch");
01831         args.add("remove");
01832
01833         const char *dir = mfarg->add(args);
01834         args.print(dir);
01835         launchCVS(dir, args.Argc(), args.Argv());
01836     }
01837 }

void CvsCmdWatchOffFolder ( const char * dir = 0L )

Definition at line 1939 of file CvsCommands.cpp.

01940 {
01941     if(gCvsPrefs.empty())
01942         return;
01943
01944     if(dir == 0L)
01945         dir = BrowserGetDirectory("Select a directory to unwatch :");
01946     if(dir == 0L)
01947         return;
01948
01949     CvsArgs args;
01950     args.add("watch");
01951     args.add("remove");
01952
01953     args.print(dir);
01954     launchCVS(dir, args.Argc(), args.Argv());
01955 }

void CvsCmdWatchOnFiles ( MultiFiles * mf = 0L )

Definition at line 1789 of file CvsCommands.cpp.

01790 {
01791     if(gCvsPrefs.empty())
01792         return;
01793
01794     MultiFiles mf;
01795     if(mfarg == 0L)
01796     {
01797         if(!BrowserGetMultiFiles("Select the files to watch :", mf))
01798             return;
01799         mfarg = &mf;
01800     }
01801
01802     while(mfarg->next())
01803     {
01804         CvsArgs args;
01805         args.add("watch");
01806         args.add("add");
01807
01808         const char *dir = mfarg->add(args);
01809         args.print(dir);
01810         launchCVS(dir, args.Argc(), args.Argv());
01811     }
01812 }

void CvsCmdWatchOnFolder ( const char * dir = 0L )

Definition at line 1921 of file CvsCommands.cpp.

01922 {
01923     if(gCvsPrefs.empty())
01924         return;
01925
01926     if(dir == 0L)
01927         dir = BrowserGetDirectory("Select a directory to watch :");
01928     if(dir == 0L)
01929         return;
01930
01931     CvsArgs args;
01932     args.add("watch");
01933     args.add("add");
01934
01935     args.print(dir);
01936     launchCVS(dir, args.Argc(), args.Argv());
01937 }

void CvsCmdWatchersFiles ( MultiFiles * mf = 0L )

Definition at line 1839 of file CvsCommands.cpp.

01840 {
01841     if(gCvsPrefs.empty())
01842         return;
01843
01844     MultiFiles mf;
01845     if(mfarg == 0L)
01846     {
01847         if(!BrowserGetMultiFiles("Select the files to get the watchers from :", mf))
01848             return;
01849         mfarg = &mf;
01850     }
01851
01852     while(mfarg->next())
01853     {
01854         CvsArgs args;
01855         args.add("watchers");
01856
01857         const char *dir = mfarg->add(args);
01858         args.print(dir);
01859         launchCVS(dir, args.Argc(), args.Argv());
01860     }
01861 }

void CvsCmdWatchersFolder ( const char * dir = 0L )

Definition at line 1993 of file CvsCommands.cpp.

01994 {
01995     if(gCvsPrefs.empty())
01996         return;
01997
01998     if(dir == 0L)
01999         dir = BrowserGetDirectory("Select a directory to get the watchers from :");
02000     if(dir == 0L)
02001         return;
02002
02003     CvsArgs args;
02004     args.add("watchers");
02005
02006     args.print(dir);
02007     launchCVS(dir, args.Argc(), args.Argv());
02008 }

char* cleanUpLogMsg ( const char * msg )

Definition at line 73 of file CvsCommands.cpp.

00074 {
00075     static CStaticAllocT<char> buf;
00076
00077     size_t len = strlen(msg);
00078     buf.AdjustSize(len + 1);
00079
00080     char *tmp = buf;
00081     char c;
00082     while((c = *msg++) != '\0')
00083     {
00084 #ifdef WIN32
00085         if(c == '\r')
00086             continue;
00087 #endif /* WIN32 */
00088 #ifdef macintosh
00089         if(c == '\r')
00090             c = '\n';
00091 #endif /* macintosh */
00092         *tmp++ = c;
00093     }
00094     *tmp++ = '\0';
00095
00096     return buf;
00097 }

Generated on Sun Oct 21 12:42:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsCommands.h File Reference

common/CvsCommands.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

char * | cleanUpLogMsg (const char *msg)
void | CvsCmdUpdateFolder (const char *dir=0L, bool queryOnly=false)
void | CvsCmdCommitFolder (const char *dir=0L)
void | CvsCmdDiffFolder (const char *dir=0L)
void | CvsCmdAddFolder (const char *dir=0L)
void | CvsCmdLogFolder (const char *dir=0L)
void | CvsCmdStatusFolder (const char *dir=0L)
void | CvsCmdLockFolder (const char *dir=0L)
void | CvsCmdUnlockFolder (const char *dir=0L)
void | CvsCmdTagCreateFolder (const char *dir=0L)
void | CvsCmdTagDeleteFolder (const char *dir=0L)
void | CvsCmdTagBranchFolder (const char *dir=0L)
void | CvsCmdInit (const char *dir=0L)
void | CvsCmdImportModule (const char *dir=0L)
void | CvsCmdCheckoutModule (const char *dir=0L)
void | CvsCmdRtagCreate (void)
void | CvsCmdRtagDelete (void)
void | CvsCmdRtagBranch (void)
void | CvsCmdLogin (void)
void | CvsCmdLogout (void)
void | CvsCmdUpdateFiles (MultiFiles *mf=0L, bool queryOnly=false)
void | CvsCmdCommitFiles (MultiFiles *mf=0L)
void | CvsCmdDiffFiles (MultiFiles *mf=0L)
void | CvsCmdAnnotateFiles (MultiFiles *mf=0L)
void | CvsCmdLogFiles (MultiFiles *mf=0L, bool outGraph=false, void *defWnd=0L)
void | CvsCmdAddFiles (MultiFiles *mf=0L)
void | CvsCmdAddBinaryFiles (MultiFiles *mf=0L)
void | CvsCmdRemoveFiles (MultiFiles *mf=0L)
void | CvsCmdStatusFiles (MultiFiles *mf=0L)
void | CvsCmdCancelChangesFiles (MultiFiles *mf=0L)
void | CvsCmdLockFiles (MultiFiles *mf=0L)
void | CvsCmdUnlockFiles (MultiFiles *mf=0L)
void | CvsCmdTagCreateFiles (MultiFiles *mf=0L)
void | CvsCmdTagDeleteFiles (MultiFiles *mf=0L)
void | CvsCmdTagBranchFiles (MultiFiles *mf=0L)
void | CvsCmdLine (void)
void | CvsCmdEditFiles (MultiFiles *mf=0L)
void | CvsCmdUneditFiles (MultiFiles *mf=0L)
void | CvsCmdWatchOnFiles (MultiFiles *mf=0L)
void | CvsCmdWatchOffFiles (MultiFiles *mf=0L)
void | CvsCmdWatchersFiles (MultiFiles *mf=0L)
void | CvsCmdEditorsFiles (MultiFiles *mf=0L)
void | CvsCmdEditFolder (const char *dir=0L)
void | CvsCmdUneditFolder (const char *dir=0L)
void | CvsCmdWatchOnFolder (const char *dir=0L)
void | CvsCmdWatchOffFolder (const char *dir=0L)
void | CvsCmdReleaseFolder (const char *dir=0L)
void | CvsCmdWatchersFolder (const char *dir=0L)
void | CvsCmdEditorsFolder (const char *dir=0L)
void | CvsCmdMacrosAdmin (const char *macroName)

Function Documentation

void CvsCmdAddBinaryFiles ( MultiFiles * mf = 0L )

Definition at line 1212 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdAddb(), and KoAddBinaryHandler::OnFiles().

01213 {
01214     if(gCvsPrefs.empty())
01215         return;
01216
01217     MultiFiles mf;
01218     if(mfarg == 0L)
01219     {
01220         if(!BrowserGetMultiFiles("Select binary files to add :", mf))
01221             return;
01222         mfarg = &mf;
01223     }
01224
01225     while(mfarg->next())
01226     {
01227         AddBinCvsArgs args;
01228         args.add("add");
01229         args.add("-kb");
01230         const char *dir = mfarg->add(args);
01231
01232         if(!args.HasProblem() || !CvsAlert("Some problems have been found while adding binary files and should be corrected",
01233                 "Cancel", "Ignore"))
01234         {
01235             args.print(dir);
01236             launchCVS(dir, args.Argc(), args.Argv());
01237         }
01238     }
01239 }

void CvsCmdAddFiles ( MultiFiles * mf = 0L )

Definition at line 1120 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdAdd(), and KoAddHandler::OnFiles().

01121 {
01122     if(gCvsPrefs.empty())
01123         return;
01124
01125     MultiFiles mf;
01126     if(mfarg == 0L)
01127     {
01128         if(!BrowserGetMultiFiles("Select files to add :", mf))
01129             return;
01130         mfarg = &mf;
01131     }
01132
01133     while(mfarg->next())
01134     {
01135         AddCvsArgs args;
01136         args.add("add");
01137         const char *dir = mfarg->add(args);
01138
01139         if(!args.HasProblem() || !CvsAlert("Some problems have been found while adding files and should be corrected",
01140                 "Cancel", "Ignore"))
01141         {
01142             args.print(dir);
01143             launchCVS(dir, args.Argc(), args.Argv());
01144         }
01145     }
01146 }

void CvsCmdAddFolder ( const char * dir = 0L )

Definition at line 266 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdAdd(), UCvsFiles::OnCmdAdd(), UCvsFiles::OnCmdAddb(), KoAddBinaryHandler::OnFolder(), KoAddHandler::OnFolder(), and CWinCvsBrowser::OnViewAdd().

00267 {
00268     if(gCvsPrefs.empty())
00269         return;
00270
00271     if(dir == 0L)
00272         dir = BrowserGetDirectory("Select a directory to add :");
00273     if(dir == 0L)
00274         return;
00275
00276     CStr uppath, folder;
00277     if(!SplitPath(dir, uppath, folder))
00278     {
00279         cvs_err("Unable to convert path name '%s'\n", dir);
00280         return;
00281     }
00282
00283     CvsArgs args;
00284     args.add("add");
00285     args.add(folder);
00286     args.print(uppath);
00287     launchCVS(uppath, args.Argc(), args.Argv());
00288 }

void CvsCmdAnnotateFiles ( MultiFiles * mf = 0L )

Definition at line 2039 of file CvsCommands.cpp.

Referenced by KoAnnotateHandler::OnFiles().

02040 {
02041     if(gCvsPrefs.empty())
02042         return;
02043
02044     MultiFiles mf;
02045     if(mfarg == 0L)
02046     {
02047         if(!BrowserGetMultiFiles("Select files to annotate :", mf))
02048             return;
02049         mfarg = &mf;
02050     }
02051
02052     bool noRecurs;
02053     bool isDate;
02054     CPStr rev;
02055     bool force;
02056
02057     if(!CompatGetAnnotate(noRecurs, isDate, rev, force))
02058         return;
02059
02060     while(mfarg->next())
02061     {
02062         CStr path, filename, ext, base;
02063         CStr file;
02064         for(int i = 0; ; i++)
02065         {
02066             if(!mfarg->get(i, path, filename))
02067                 break;
02068             // note that filename can contain subfolders
02069
02070             GetExtension(filename, base, ext);
02071
02072             CvsArgs args;
02073             CStr tmpf(base);
02074             if(!rev.empty())
02075             {
02076                 tmpf << "_ann_";
02077                 tmpf << rev;
02078                 tmpf << '_';
02079             }
02080             else
02081                 tmpf << "_ann_";
02082
02083             // convert subfolder names to regular name
02084             FlatenSubFolders(tmpf);
02085
02086             args.add("annotate");
02087             if(noRecurs)
02088             {
02089                 args.add("-l");
02090             }
02091             if(force)
02092             {
02093                 args.add("-f");
02094             }
02095             if(!rev.empty())
02096             {
02097                 args.add(isDate ? "-D" : "-r");
02098                 args.add(rev);
02099             }
02100             args.add(filename);
02101             args.print(path);
02102             file = launchCVS(path, args, (const char *)tmpf, ext);
02103 #ifdef qMacCvsPP
02104             decodeCVS (file);
02105 #endif
02106
02107             if(file.empty())
02108                 continue;
02109
02110             LaunchViewer(file, true);
02111         }
02112     }
02113 }

void CvsCmdCancelChangesFiles ( MultiFiles * mf = 0L )

Definition at line 1335 of file CvsCommands.cpp.

01336 {
01337     if(gCvsPrefs.empty())
01338         return;
01339
01340     MultiFiles mf;
01341     if(mfarg == 0L)
01342     {
01343         if(!BrowserGetMultiFiles("Select files to cancel changes :", mf))
01344             return;
01345         mfarg = &mf;
01346     }
01347
01348     while(mfarg->next())
01349     {
01350         RemoveCvsArgs args;
01351         args.add("update");
01352         const char *dir = mfarg->add(args);
01353         args.print(dir);
01354         launchCVS(dir, args.Argc(), args.Argv());
01355     }
01356 }

void CvsCmdCheckoutModule ( const char * dir = 0L )

Definition at line 404 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdCheckout(), CWinCvsBrowser::OnViewCheckout(), CExploreBar::OnViewCheckout(), and CBrowseFileView::OnViewCheckout().

00405 {
00406     if(gCvsPrefs.empty())
00407         return;
00408
00409 #ifndef WIN32
00410     if(dir == 0L)
00411         dir = BrowserGetDirectory("Select a directory to checkout to :");
00412     if(dir == 0L)
00413         return;
00414 #endif
00415
00416     bool norecurs;
00417     CPStr modname;
00418     CPStr path(dir);
00419     bool toStdout;
00420     CPStr date;
00421     CPStr rev;
00422     bool useMostRecent;
00423     bool doexport;
00424     bool forceCvsroot;
00425     bool overrideCheckoutDir;
00426     CPStr checkoutDir;
00427
00428     if( !CompatGetCheckout(modname, path, norecurs,
00429         toStdout, date, rev, useMostRecent, doexport, forceCvsroot,
00430         overrideCheckoutDir, checkoutDir) )
00431     {
00432         return;
00433     }
00434
00435     CvsArgs args;
00436
00437     if(forceCvsroot)
00438     {
00439         CStr root;
00440
00441         // extract from the cvsroot
00442         const char *ccvsroot = gCvsPrefs;
00443         ccvsroot = Authen::skiptoken(ccvsroot);
00444         root = gAuthen.token();
00445         root << ccvsroot;
00446         args.add("-d");
00447         args.add(root);
00448     }
00449
00450     args.add(doexport ? "export" : "checkout");
00451
00452     if(gCvsPrefs.PruneOption() && !doexport)
00453         args.add("-P");
00454     if(norecurs)
00455         args.add("-l");
00456     if(toStdout)
00457         args.add("-p");
00458     if(useMostRecent)
00459         args.add("-f");
00460     if(!date.empty())
00461     {
00462         args.add("-D");
00463         args.add(date);
00464     }
00465     if(!rev.empty())
00466     {
00467         args.add("-r");
00468         args.add(rev);
00469     }
00470
00471     if(doexport && rev.empty() && date.empty())
00472     {
00473         args.add("-r");
00474         args.add("HEAD");
00475     }
00476
00477     if( overrideCheckoutDir )
00478     {
00479         args.add("-d");
00480         args.add(checkoutDir);
00481     }
00482
00483     args.add(modname);
00484     args.print(path);
00485     launchCVS(path, args.Argc(), args.Argv());
00486 }

void CvsCmdCommitFiles ( MultiFiles * mf = 0L )

Definition at line 735 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdCommit(), and KoCommitHandler::OnFiles().

00736 {
00737     if(gCvsPrefs.empty())
00738         return;
00739
00740     MultiFiles mf;
00741     if(mfarg == 0L)
00742     {
00743         if(!BrowserGetMultiFiles("Select files to commit :", mf))
00744             return;
00745         mfarg = &mf;
00746     }
00747
00748     bool firstTime = true;
00749     bool norecurs;
00750     CStr logmsg;
00751     bool forceCommit;
00752     bool forceRecurse;
00753     CPStr rev;
00754     bool noModuleProgram;
00755     while(mfarg->next())
00756     {
00757         if(firstTime)
00758         {
00759             // we have to give the path where the commit is done is
00760             // the user expects to fill the CVS/Template file. we just
00761             // grab the first one for this purpose.
00762             const char *tmplDir = 0L;
00763             CStr pathTmpl, dontCareFile;
00764             if(mfarg->get(0, pathTmpl, dontCareFile))
00765                 tmplDir = pathTmpl;
00766
00767             if(!CompatGetCommit(logmsg, norecurs, forceCommit, forceRecurse, rev, noModuleProgram, tmplDir, mfarg))
00768                 return;
00769
00770             firstTime = false;
00771         }
00772
00773         CvsArgs args;
00774         args.add("commit");
00775         if(norecurs)
00776             args.add("-l");
00777         if(noModuleProgram)
00778             args.add("-n");
00779         if(forceRecurse)
00780             args.add("-R");
00781         if(forceCommit)
00782             args.add("-f");
00783         args.add("-m");
00784         args.add(cleanUpLogMsg(logmsg));
00785         if(!rev.empty())
00786         {
00787             args.add("-r");
00788             args.add(rev);
00789         }
00790         const char *dir = mfarg->add(args);
00791         args.print(dir);
00792         launchCVS(dir, args.Argc(), args.Argv());
00793     }
00794 }

void CvsCmdCommitFolder ( const char * dir = 0L )

Definition at line 177 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdCommit(), UCvsFiles::OnCmdCommit(), KoCommitHandler::OnFolder(), and CWinCvsBrowser::OnViewCommit().

00178 {
00179     if(gCvsPrefs.empty())
00180         return;
00181
00182     if(dir == 0L)
00183         dir = BrowserGetDirectory("Select a directory to commit :");
00184     if(dir == 0L)
00185         return;
00186
00187     bool norecurs;
00188     CStr logmsg;
00189     bool forceCommit;
00190     bool forceRecurse;
00191     CPStr rev;
00192     bool noModuleProgram;
00193     if(!CompatGetCommit(logmsg, norecurs, forceCommit, forceRecurse, rev, noModuleProgram, dir))
00194         return;
00195
00196     CvsArgs args;
00197     args.add("commit");
00198     if(norecurs)
00199         args.add("-l");
00200     if(noModuleProgram)
00201         args.add("-n");
00202     if(forceRecurse)
00203         args.add("-R");
00204     if(forceCommit)
00205         args.add("-f");
00206     args.add("-m");
00207     args.add(cleanUpLogMsg(logmsg));
00208     if(!rev.empty())
00209     {
00210         args.add("-r");
00211         args.add(rev);
00212     }
00213     args.print(dir);
00214     launchCVS(dir, args.Argc(), args.Argv());
00215 }

void CvsCmdDiffFiles ( MultiFiles * mf = 0L )

Definition at line 823 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdDiff(), and KoDiffHandler::OnFiles().

00824 {
00825     if(gCvsPrefs.empty())
00826         return;
00827
00828     MultiFiles mf;
00829     if(mfarg == 0L)
00830     {
00831         if(!BrowserGetMultiFiles("Select files to diff :", mf))
00832             return;
00833         mfarg = &mf;
00834     }
00835
00836     bool noRecurs;
00837     bool isDate1;
00838     bool isDate2;
00839     bool useExtDiff;
00840     CPStr rev1;
00841     CPStr rev2;
00842     bool noWhiteSpace;
00843     bool ignoreCase;
00844     bool extDiffResult;
00845
00846     if(!CompatGetDiff(noRecurs, isDate1, isDate2, rev1, rev2, useExtDiff, noWhiteSpace, ignoreCase, true))
00847         return;
00848
00849     while(mfarg->next())
00850     {
00851         extDiffResult = false;
00852
00853         if (useExtDiff)
00854         {
00855             CStr path, filename, ext, base;
00856             CStr file1, file2;
00857             for(int i = 0; ; i++)
00858             {
00859                 if(!mfarg->get(i, path, filename))
00860                     break;
00861                 // note that filename can contain subfolders
00862
00863                 GetExtension(filename, base, ext);
00864
00865                 CvsArgs args;
00866                 CStr tmpf(base);
00867                 if(!rev1.empty())
00868                 {
00869                     tmpf << '_';
00870                     tmpf << rev1;
00871                     tmpf << '_';
00872                 }
00873                 else
00874                     tmpf << "_orig_";
00875
00876                 // convert subfolder names to regular name
00877                 FlatenSubFolders(tmpf);
00878
00879                 args.add("update");
00880                 args.add("-p");
00881                 if(!rev1.empty())
00882                 {
00883                     args.add(isDate1 ? "-D" : "-r");
00884                     args.add(rev1);
00885                 }
00886                 args.add(filename);
00887                 args.print(path);
00888                 file1 = launchCVS(path, args, (const char *)tmpf, ext);
00889 #ifdef qMacCvsPP
00890                 decodeCVS (file1);
00891 #endif
00892
00893                 if(rev2.empty())
00894                 {
00895                     file2 = path;
00896                     if(!file2.endsWith(kPathDelimiter))
00897                         file2 << kPathDelimiter;
00898                     file2 << filename;
00899                 }
00900                 else
00901                 {
00902                     CvsArgs args2;
00903
00904                     tmpf = base;
00905                     tmpf << '_';
00906                     tmpf << rev2;
00907                     tmpf << '_';
00908
00909                     // convert subfolder names to regular name
00910                     FlatenSubFolders(tmpf);
00911
00912                     args2.add("update");
00913                     args2.add("-p");
00914                     args2.add(isDate2 ? "-D" : "-r");
00915                     args2.add(rev2);
00916                     args2.add(filename);
00917                     args2.print(path);
00918                     file2 = launchCVS(path, args2, (const char *)tmpf, ext);
00919 #ifdef qMacCvsPP
00920                     decodeCVS (file2);
00921 #endif
00922                 }
00923
00924                 if(file1.empty() || file2.empty())
00925                     continue;
00926
00927                 extDiffResult = LaunchDiff(file1, file2);
00928             }
00929         }
00930
00931         if (!useExtDiff || !extDiffResult)
00932         {
00933             CvsArgs args;
00934             args.add("diff");
00935
00936             if(noRecurs)
00937                 args.add("-l");
00938             if(!rev1.empty())
00939             {
00940                 args.add(isDate1 ? "-D" : "-r");
00941                 args.add(rev1);
00942             }
00943             if(!rev2.empty())
00944             {
00945                 args.add(isDate2 ? "-D" : "-r");
00946                 args.add(rev2);
00947             }
00948             if(noWhiteSpace)
00949                 args.add("-w"); //--ignore-all-space
00950             if(ignoreCase)
00951                 args.add("-i"); //--ignore-case
00952
00953             const char *dir = mfarg->add(args);
00954             args.print(dir);
00955             launchCVS(dir, args.Argc(), args.Argv());
00956         }
00957     }
00958 }

void CvsCmdDiffFolder ( const char * dir = 0L )

Definition at line 218 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdDiff(), UCvsFiles::OnCmdDiff(), KoDiffHandler::OnFolder(), and CWinCvsBrowser::OnViewDiff().

00219 {
00220     if(gCvsPrefs.empty())
00221         return;
00222
00223     if(dir == 0L)
00224         dir = BrowserGetDirectory("Select a directory to diff :");
00225
00226     if(dir == 0L)
00227         return;
00228
00229     bool noRecurs;
00230     bool isDate1;
00231     bool isDate2;
00232     bool useExtDiff;
00233     CPStr rev1;
00234     CPStr rev2;
00235     bool noWhiteSpace;
00236     bool ignoreCase;
00237
00238     if(!CompatGetDiff(noRecurs, isDate1, isDate2, rev1, rev2, useExtDiff, noWhiteSpace, ignoreCase))
00239         return;
00240
00241     CvsArgs args;
00242     args.add("diff");
00243
00244     if(noRecurs)
00245         args.add("-l");
00246     if(!rev1.empty())
00247     {
00248         args.add(isDate1 ? "-D" : "-r");
00249         args.add(rev1);
00250     }
00251     if(!rev2.empty())
00252     {
00253         args.add(isDate2 ? "-D" : "-r");
00254         args.add(rev2);
00255     }
00256     if(noWhiteSpace)
00257         args.add("-w"); //--ignore-all-space
00258     if(ignoreCase)
00259         args.add("-i"); //--ignore-case
00260
00261     args.print(dir);
00262     launchCVS(dir, args.Argc(), args.Argv());
00263 }

void CvsCmdEditFiles ( MultiFiles * mf = 0L )

Definition at line 1741 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdEdit(), and KoEditHandler::OnFiles().

01742 {
01743     if(gCvsPrefs.empty())
01744         return;
01745
01746     MultiFiles mf;
01747     if(mfarg == 0L)
01748     {
01749         if(!BrowserGetMultiFiles("Select the files to edit :", mf))
01750             return;
01751         mfarg = &mf;
01752     }
01753
01754     while(mfarg->next())
01755     {
01756         CvsArgs args;
01757         args.add("edit");
01758
01759         const char *dir = mfarg->add(args);
01760         args.print(dir);
01761         launchCVS(dir, args.Argc(), args.Argv());
01762     }
01763 }

void CvsCmdEditFolder ( const char * dir = 0L )

Definition at line 1887 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdEdit(), UCvsFiles::OnCmdEdit(), KoEditHandler::OnFolder(), and CWinCvsBrowser::OnViewEdit().

01888 {
01889     if(gCvsPrefs.empty())
01890         return;
01891
01892     if(dir == 0L)
01893         dir = BrowserGetDirectory("Select a directory to edit :");
01894     if(dir == 0L)
01895         return;
01896
01897     CvsArgs args;
01898     args.add("edit");
01899
01900     args.print(dir);
01901     launchCVS(dir, args.Argc(), args.Argv());
01902 }

void CvsCmdEditorsFiles ( MultiFiles * mf = 0L )

Definition at line 1863 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdEditors(), and KoEditorsHandler::OnFiles().

01864 {
01865     if(gCvsPrefs.empty())
01866         return;
01867
01868     MultiFiles mf;
01869     if(mfarg == 0L)
01870     {
01871         if(!BrowserGetMultiFiles("Select the files to get the editors from :", mf))
01872             return;
01873         mfarg = &mf;
01874     }
01875
01876     while(mfarg->next())
01877     {
01878         CvsArgs args;
01879         args.add("editors");
01880
01881         const char *dir = mfarg->add(args);
01882         args.print(dir);
01883         launchCVS(dir, args.Argc(), args.Argv());
01884     }
01885 }

void CvsCmdEditorsFolder ( const char * dir = 0L )

Definition at line 2010 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdEditors(), UCvsFiles::OnCmdEditors(), KoEditorsHandler::OnFolder(), and CWinCvsBrowser::OnViewEditors().

02011 {
02012     if(gCvsPrefs.empty())
02013         return;
02014
02015     if(dir == 0L)
02016         dir = BrowserGetDirectory("Select a directory to get the editors from :");
02017     if(dir == 0L)
02018         return;
02019
02020     CvsArgs args;
02021     args.add("editors");
02022
02023     args.print(dir);
02024     launchCVS(dir, args.Argc(), args.Argv());
02025 }

void CvsCmdImportModule ( const char * dir = 0L )

Definition at line 322 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdImport(), CWinCvsBrowser::OnViewImport(), CExploreBar::OnViewImport(), and CBrowseFileView::OnViewImport().

00323 {
00324     if(gCvsPrefs.empty())
00325         return;
00326
00327     if(dir == 0L)
00328         dir = BrowserGetDirectory("Select a directory to import :");
00329     if(dir == 0L)
00330         return;
00331
00332     ReportConflict * entries;
00333     ReportWarning * warnings;
00334
00335     if(!CompatImportFilter(dir, entries, warnings))
00336         return;
00337
00338     CPStr modname, vendortag, reltag, path(dir);
00339     CStr logmsg;
00340     bool useDefIgnore;
00341
00342     if(!CompatGetImport(modname, logmsg, vendortag, reltag, path, useDefIgnore))
00343         return;
00344
00345     CvsArgs args;
00346     args.add("import");
00347
00348     // fill the wrappers
00349     ReportConflict * tmpentry = entries;
00350     if( !useDefIgnore )
00351     {
00352         args.add("-I"); // no default (core, *.o...)
00353         args.add("!");
00354         args.add("-I"); // but ignore the CVS folders
00355         args.add("CVS");
00356     }
00357     while(tmpentry != 0L)
00358     {
00359         if(tmpentry->HasIgnore())
00360         {
00361             CPStr ign;
00362             args.add("-I");
00363             if(tmpentry->IsExtension())
00364                 ign << '*';
00365             ign << tmpentry->GetPattern();
00366             args.add(ign);
00367         }
00368         else if(!tmpentry->HasForceText() &&
00369             (tmpentry->IsBinary() || tmpentry->HasForceBinary() || tmpentry->HasForceNoKeywords() ))
00370         {
00371             CPStr wrap;
00372             const char *pattern = tmpentry->GetPattern();
00373             bool hasSpace = strchr(pattern, ' ') != 0L;
00374             args.add("-W");
00375             if(hasSpace)
00376                 wrap << '"';
00377             if(tmpentry->IsExtension())
00378                 wrap << '*';
00379             wrap << pattern;
00380             if(hasSpace)
00381                 wrap << '"';
00382             if( tmpentry->HasForceNoKeywords() )
00383                 wrap << " -k 'o'";
00384             else
00385                 wrap << " -k 'b'";
00386
00387             args.add(wrap);
00388         }
00389         tmpentry = tmpentry->next;
00390     }
00391
00392     free_list_types(warnings, entries);
00393
00394     args.add("-m");
00395     args.add(cleanUpLogMsg(logmsg));
00396     args.add(modname);
00397     args.add(vendortag);
00398     args.add(reltag);
00399     args.print(path);
00400     launchCVS(path, args.Argc(), args.Argv());
00401 }

void CvsCmdInit ( const char * dir = 0L )

Definition at line 291 of file CvsCommands.cpp.

Referenced by UCvsFrame::OnCmdInit(), and CWincvsDoc::OnViewInit().

00292 {
00293     if(gCvsPrefs.empty())
00294         return;
00295
00296     bool forceCvsroot;
00297
00298     if(!CompatGetInit(forceCvsroot))
00299         return;
00300
00301     CvsArgs args;
00302
00303     if(forceCvsroot)
00304     {
00305         CStr root;
00306
00307         // extract from the cvsroot
00308         const char *ccvsroot = gCvsPrefs;
00309         ccvsroot = Authen::skiptoken(ccvsroot);
00310         root = gAuthen.token();
00311         root << ccvsroot;
00312         args.add("-d");
00313         args.add(root);
00314     }
00315
00316     args.add("init");
00317     args.print();
00318     launchCVS(0L, args.Argc(), args.Argv());
00319 }

void CvsCmdLine ( void )

Definition at line 1358 of file CvsCommands.cpp.

01359 {
01360     CvsArgs args(false);
01361     const char *dir;
01362     if(!CompatGetCommand(args, dir))
01363         return;
01364     args.print(dir);
01365     launchCVS(dir, args.Argc(), args.Argv());
01366 }

void CvsCmdLockFiles ( MultiFiles * mf = 0L )

Definition at line 1459 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdLock(), and KoLockHandler::OnFiles().

01460 {
01461     if(gCvsPrefs.empty())
01462         return;
01463
01464     MultiFiles mf;
01465     if(mfarg == 0L)
01466     {
01467         if(!BrowserGetMultiFiles("Select files to lock :", mf))
01468             return;
01469         mfarg = &mf;
01470     }
01471
01472     while(mfarg->next())
01473     {
01474         CvsArgs args;
01475         args.add("admin");
01476         args.add("-l");
01477
01478         const char *dir = mfarg->add(args);
01479         args.print(dir);
01480         launchCVS(dir, args.Argc(), args.Argv());
01481     }
01482 }

void CvsCmdLockFolder ( const char * dir = 0L )

Definition at line 1618 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdLock(), UCvsFiles::OnCmdLock(), KoLockHandler::OnFolder(), and CWinCvsBrowser::OnViewLock().

01619 {
01620     if(gCvsPrefs.empty())
01621         return;
01622
01623     if(dir == 0L)
01624         dir = BrowserGetDirectory("Select a directory to lock :");
01625     if(dir == 0L)
01626         return;
01627
01628     CvsArgs args;
01629     args.add("admin");
01630     args.add("-l");
01631
01632     args.print(dir);
01633     launchCVS(dir, args.Argc(), args.Argv());
01634 }

void CvsCmdLogFiles | ( | MultiFiles * | mf = 0L,
 |  | bool | outGraph = false,
 |  | void * | defWnd = 0L
 | ) |

Definition at line 961 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdGraph(), UCvsFiles::OnCmdLog(), KoGraphHandler::OnFiles(), and KoLogHandler::OnFiles().

00962 {
00963     if(gCvsPrefs.empty())
00964         return;
00965
00966     MultiFiles mf;
00967     if(mfarg == 0L)
00968     {
00969         if(!BrowserGetMultiFiles("Select files to log :", mf))
00970             return;
00971         mfarg = &mf;
00972     }
00973
00974     bool noRecurs;
00975     bool defBranch;
00976     CPStr date;
00977     bool headerOnly;
00978     bool noTags;
00979     bool onlyRCSfile;
00980     bool hasRev;
00981     CPStr rev;
00982     CPStr states;
00983     bool hasUser;
00984     CPStr users;
00985
00986     if( !CompatGetLog(noRecurs, defBranch, date,
00987         headerOnly, noTags, onlyRCSfile, hasRev,
00988         rev, states, hasUser, users,
00989         outGraph) )
00990     {
00991         return;
00992     }
00993
00994     while(mfarg->next())
00995     {
00996         CvsArgs args;
00997         args.add("log");
00998
00999         if(noRecurs)
01000             args.add("-l");
01001         if(defBranch)
01002             args.add("-b");
01003         if(headerOnly)
01004             args.add("-h");
01005         if(noTags)
01006             args.add("-N");
01007         if(onlyRCSfile)
01008             args.add("-R");
01009
01010         if(!date.empty())
01011         {
01012             args.add("-d");
01013             args.add(date);
01014         }
01015         if(!states.empty())
01016         {
01017             args.add("-s");
01018             args.add(states);
01019         }
01020         if(hasRev)
01021         {
01022             CPStr tmp;
01023             tmp = "-r";
01024             tmp << rev;
01025             args.add(tmp);
01026         }
01027         if(hasUser)
01028         {
01029             CPStr tmp;
01030             tmp = "-w";
01031             tmp << users;
01032             args.add(tmp);
01033         }
01034
01035         const char *dir = mfarg->add(args);
01036         args.print(dir);
01037         CvsLogParse(dir, args, outGraph, defWnd);
01038     }
01039 }

void CvsCmdLogFolder ( const char * dir = 0L )

Definition at line 1369 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdLog(), UCvsFiles::OnCmdLog(), KoLogHandler::OnFolder(), and CWinCvsBrowser::OnViewLog().

01370 {
01371     if(gCvsPrefs.empty())
01372         return;
01373
01374     if(dir == 0L)
01375         dir = BrowserGetDirectory("Select a directory to log :");
01376     if(dir == 0L)
01377         return;
01378
01379     bool noRecurs;
01380     bool defBranch;
01381     CPStr date;
01382     bool headerOnly;
01383     bool noTags;
01384     bool onlyRCSfile;
01385     bool hasRev;
01386     CPStr rev;
01387     CPStr states;
01388     bool hasUser;
01389     CPStr users;
01390
01391     if(!CompatGetLog(noRecurs, defBranch, date,
01392         headerOnly, noTags, onlyRCSfile, hasRev,
01393         rev, states, hasUser, users))
01394             return;
01395
01396     CvsArgs args;
01397     args.add("log");
01398
01399     if(noRecurs)
01400         args.add("-l");
01401     if(defBranch)
01402         args.add("-b");
01403     if(headerOnly)
01404         args.add("-h");
01405     if(noTags)
01406         args.add("-N");
01407     if(onlyRCSfile)
01408         args.add("-R");
01409
01410     if(!date.empty())
01411     {
01412         args.add("-d");
01413         args.add(date);
01414     }
01415     if(!states.empty())
01416     {
01417         args.add("-s");
01418         args.add(states);
01419     }
01420     if(hasRev)
01421     {
01422         CPStr tmp;
01423         tmp = "-r";
01424         tmp << rev;
01425         args.add(tmp);
01426     }
01427     if(hasUser)
01428     {
01429         CPStr tmp;
01430         tmp = "-w";
01431         tmp << users;
01432         args.add(tmp);
01433     }
01434
01435     args.print(dir);
01436     CvsLogParse(dir, args, false, NULL);
01437 }

void CvsCmdLogin ( void )

Definition at line 607 of file CvsCommands.cpp.

00608 {
00609     if(gCvsPrefs.empty())
00610         return;
00611
00612     if(gAuthen.kind() != pserver)
00613     {
00614         cvs_err("Set the password authentication first in the preferences !\n");
00615         return;
00616     }
00617
00618     if(gCvsPrefs.HasLoogedIn() && gCvsPrefs.LogoutTimeOut() > 0)
00619     {
00620         cvs_err("Making automatic logout:\n");
00621         CvsCmdLogout();
00622         WaitForCvs();
00623     }
00624     gCvsPrefs.SetHasLoogedIn(true);
00625
00626     CvsArgs args;
00627     args.add("login");
00628     args.print();
00629     launchCVS(0L, args.Argc(), args.Argv());
00630 }

void CvsCmdLogout ( void )

Definition at line 633 of file CvsCommands.cpp.

00634 {
00635     if(gCvsPrefs.empty())
00636         return;
00637
00638     if(gAuthen.kind() != pserver)
00639     {
00640         cvs_err("Set the password authentication first in the preferences !\n");
00641         return;
00642     }
00643
00644     gCvsPrefs.SetHasLoogedIn(false);
00645
00646     CvsArgs args;
00647     args.add("logout");
00648     args.print();
00649     launchCVS(0L, args.Argc(), args.Argv());
00650 }

void CvsCmdMacrosAdmin ( const char * macroName )

Definition at line 2027 of file CvsCommands.cpp.

Referenced by UCvsFrame::OnCmdMacroAdmin(), and CWincvsDoc::OnMacroAdmin().

02028 {
02029     if(gCvsPrefs.empty() || !CTcl_Interp::IsAvail())
02030         return;
02031
02032     CTcl_Interp interp;
02033     CStr path = macroName;
02034     CTcl_Interp::Unixfy(path);
02035     interp.DoScriptVar("source \"%s\"", (const char *)path);
02036 }

void CvsCmdReleaseFolder ( const char * dir = 0L )

Definition at line 1957 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdRelease(), UCvsFiles::OnCmdRelease(), KoReleaseHandler::OnFolder(), and CWinCvsBrowser::OnViewRelease().

01958 {
01959     if(gCvsPrefs.empty())
01960         return;
01961
01962     if(dir == 0L)
01963         dir = BrowserGetDirectory("Select a directory to release :");
01964     if(dir == 0L)
01965         return;
01966
01967     CStr uppath, folder;
01968     if( !SplitPath(dir, uppath, folder) )
01969     {
01970         cvs_err("Unable to convert path name '%s'\n", dir);
01971         //even thought something didn't work we will try to continue and put all the responsibility onto the user
01972         uppath = dir;
01973         folder = ".";
01974     }
01975
01976     bool removeDirectory = false;
01977
01978     if( !CompatGetRelease(dir, removeDirectory) )
01979     {
01980         return;
01981     }
01982
01983     CvsArgs args;
01984     args.add("release");
01985     if( removeDirectory )
01986         args.add("-d");
01987     args.add(folder);
01988
01989     args.print(uppath);
01990     launchCVS(uppath, args.Argc(), args.Argv());
01991 }

void CvsCmdRemoveFiles ( MultiFiles * mf = 0L )

Definition at line 1280 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdRmv(), and KoFileRemoveHandler::OnFiles().

01281 {
01282     if(gCvsPrefs.empty())
01283         return;
01284
01285     MultiFiles mf;
01286     if(mfarg == 0L)
01287     {
01288         if(!BrowserGetMultiFiles("Select files to remove :", mf))
01289             return;
01290         mfarg = &mf;
01291     }
01292
01293     while(mfarg->next())
01294     {
01295         RemoveCvsArgs args;
01296
01297         CompatBeginMoveToTrash();
01298
01299         args.add("remove");
01300         const char *dir = mfarg->add(args);
01301         args.print(dir);
01302
01303         CompatEndMoveToTrash();
01304
01305         launchCVS(dir, args.Argc(), args.Argv());
01306     }
01307 }

void CvsCmdRtagBranch ( void )

Definition at line 563 of file CvsCommands.cpp.

00564 {
00565     if(gCvsPrefs.empty())
00566         return;
00567
00568     bool norecurs;
00569     bool useMostRecent;
00570     bool lookAttic;
00571     CPStr modname;
00572     CPStr branchname;
00573     CPStr date;
00574     CPStr rev;
00575
00576     if(!CompatRtagBranch(norecurs, branchname, modname, date, rev,
00577         useMostRecent, lookAttic))
00578             return;
00579
00580     CvsArgs args;
00581     args.add("rtag");
00582     args.add("-b");
00583     if(norecurs)
00584         args.add("-l");
00585     if(useMostRecent)
00586         args.add("-f");
00587     if(lookAttic)
00588         args.add("-a");
00589     if(!date.empty())
00590     {
00591         args.add("-D");
00592         args.add(date);
00593     }
00594     if(!rev.empty())
00595     {
00596         args.add("-r");
00597         args.add(rev);
00598     }
00599
00600     args.add(branchname);
00601     args.add(modname);
00602     args.print();
00603     launchCVS(0L, args.Argc(), args.Argv());
00604 }

void CvsCmdRtagCreate ( void )

Definition at line 489 of file CvsCommands.cpp.

00490 {
00491     if(gCvsPrefs.empty())
00492         return;
00493
00494     bool norecurs;
00495     bool useMostRecent;
00496     bool overwriteExisting;
00497     bool lookAttic;
00498     CPStr modname;
00499     CPStr tagname;
00500     CPStr date;
00501     CPStr rev;
00502
00503     if(!CompatRtagCreate(norecurs, overwriteExisting, tagname, modname, date, rev,
00504         useMostRecent, lookAttic))
00505             return;
00506
00507     CvsArgs args;
00508     args.add("rtag");
00509     if(norecurs)
00510         args.add("-l");
00511     if(useMostRecent)
00512         args.add("-f");
00513     if(overwriteExisting)
00514         args.add("-F");
00515     if(lookAttic)
00516         args.add("-a");
00517     if(!date.empty())
00518     {
00519         args.add("-D");
00520         args.add(date);
00521     }
00522     if(!rev.empty())
00523     {
00524         args.add("-r");
00525         args.add(rev);
00526     }
00527
00528     args.add(tagname);
00529     args.add(modname);
00530     args.print();
00531     launchCVS(0L, args.Argc(), args.Argv());
00532 }

void CvsCmdRtagDelete ( void )

Definition at line 535 of file CvsCommands.cpp.

00536 {
00537     if(gCvsPrefs.empty())
00538         return;
00539
00540     bool norecurs;
00541     bool lookAttic;
00542     CPStr modname;
00543     CPStr tagname;
00544
00545     if(!CompatRtagDelete(norecurs, lookAttic, tagname, modname))
00546             return;
00547
00548     CvsArgs args;
00549     args.add("rtag");
00550     args.add("-d");
00551     if(norecurs)
00552         args.add("-l");
00553     if(lookAttic)
00554         args.add("-a");
00555
00556     args.add(tagname);
00557     args.add(modname);
00558     args.print();
00559     launchCVS(0L, args.Argc(), args.Argv());
00560 }

void CvsCmdStatusFiles ( MultiFiles * mf = 0L )

Definition at line 1310 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdStatus(), and KoStatusHandler::OnFiles().

01311 {
01312     if(gCvsPrefs.empty())
01313         return;
01314
01315     MultiFiles mf;
01316     if(mfarg == 0L)
01317     {
01318         if(!BrowserGetMultiFiles("Select files to status :", mf))
01319             return;
01320         mfarg = &mf;
01321     }
01322
01323     while(mfarg->next())
01324     {
01325         CvsArgs args;
01326         args.add("status");
01327         args.add("-v");
01328         const char *dir = mfarg->add(args);
01329         args.print(dir);
01330         launchCVS(dir, args.Argc(), args.Argv());
01331     }
01332 }

void CvsCmdStatusFolder ( const char * dir = 0L )

Definition at line 1440 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdStatus(), UCvsFiles::OnCmdStatus(), KoStatusHandler::OnFolder(), and CWinCvsBrowser::OnViewStatus().

01441 {
01442     if(gCvsPrefs.empty())
01443         return;
01444
01445     if(dir == 0L)
01446         dir = BrowserGetDirectory("Select a directory to get status :");
01447     if(dir == 0L)
01448         return;
01449
01450     CvsArgs args;
01451     args.add("status");
01452     args.add("-v");
01453
01454     args.print(dir);
01455     launchCVS(dir, args.Argc(), args.Argv());
01456 }

void CvsCmdTagBranchFiles ( MultiFiles * mf = 0L )

Definition at line 1582 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdTagBranch(), and KoBranchTagHandler::OnFiles().

01583 {
01584     if(gCvsPrefs.empty())
01585         return;
01586
01587     MultiFiles mf;
01588     if(mfarg == 0L)
01589     {
01590         if(!BrowserGetMultiFiles("Select files to branch :", mf))
01591             return;
01592         mfarg = &mf;
01593     }
01594
01595     bool noRecurs, checkUnmod;
01596     CPStr branchName;
01597     if(!CompatTagBranch(noRecurs, branchName, checkUnmod))
01598         return;
01599
01600     while(mfarg->next())
01601     {
01602         CvsArgs args;
01603         args.add("tag");
01604         args.add("-b");
01605         if(noRecurs)
01606             args.add("-l");
01607         if(checkUnmod)
01608             args.add("-c");
01609         args.add(branchName);
01610
01611         const char *dir = mfarg->add(args);
01612         args.print(dir);
01613         launchCVS(dir, args.Argc(), args.Argv());
01614     }
01615 }

void CvsCmdTagBranchFolder ( const char * dir = 0L )

Definition at line 1713 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdTagBranch(), UCvsFiles::OnCmdTagBranch(), KoBranchTagHandler::OnFolder(), and CWinCvsBrowser::OnViewTagBranch().

01714 {
01715     if(gCvsPrefs.empty())
01716         return;
01717
01718     if(dir == 0L)
01719         dir = BrowserGetDirectory("Select a directory to branch :");
01720     if(dir == 0L)
01721         return;
01722
01723     bool noRecurs, checkUnmod;
01724     CPStr tagName;
01725     if(!CompatTagBranch(noRecurs, tagName, checkUnmod))
01726         return;
01727
01728     CvsArgs args;
01729     args.add("tag");
01730     args.add("-b");
01731     if(noRecurs)
01732         args.add("-l");
01733     if(checkUnmod)
01734         args.add("-c");
01735     args.add(tagName);
01736
01737     args.print(dir);
01738     launchCVS(dir, args.Argc(), args.Argv());
01739 }

void CvsCmdTagCreateFiles ( MultiFiles * mf = 0L )

Definition at line 1511 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdTagNew(), and KoCreateTagHandler::OnFiles().

01512 {
01513     if(gCvsPrefs.empty())
01514         return;
01515
01516     MultiFiles mf;
01517     if(mfarg == 0L)
01518     {
01519         if(!BrowserGetMultiFiles("Select files to tag :", mf))
01520             return;
01521         mfarg = &mf;
01522     }
01523
01524     bool noRecurs, overwriteExisting, checkUnmod;
01525     CPStr tagName;
01526     if(!CompatTagCreate(noRecurs, overwriteExisting, tagName, checkUnmod))
01527         return;
01528
01529     while(mfarg->next())
01530     {
01531         CvsArgs args;
01532         args.add("tag");
01533         if(noRecurs)
01534             args.add("-l");
01535         if(overwriteExisting)
01536             args.add("-F");
01537         if(checkUnmod)
01538             args.add("-c");
01539         args.add(tagName);
01540
01541         const char *dir = mfarg->add(args);
01542         args.print(dir);
01543         launchCVS(dir, args.Argc(), args.Argv());
01544     }
01545 }

void CvsCmdTagCreateFolder ( const char * dir = 0L )

Definition at line 1656 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdTagNew(), UCvsFiles::OnCmdTagNew(), KoCreateTagHandler::OnFolder(), and CWinCvsBrowser::OnViewTagNew().

01657 {
01658     if(gCvsPrefs.empty())
01659         return;
01660
01661     if(dir == 0L)
01662         dir = BrowserGetDirectory("Select a directory to tag :");
01663     if(dir == 0L)
01664         return;
01665
01666     bool noRecurs, overwriteExisting, checkUnmod;
01667     CPStr tagName;
01668     if(!CompatTagCreate(noRecurs, overwriteExisting, tagName, checkUnmod))
01669         return;
01670
01671     CvsArgs args;
01672     args.add("tag");
01673     if(noRecurs)
01674         args.add("-l");
01675     if(overwriteExisting)
01676         args.add("-F");
01677     if(checkUnmod)
01678         args.add("-c");
01679     args.add(tagName);
01680
01681     args.print(dir);
01682     launchCVS(dir, args.Argc(), args.Argv());
01683 }

void CvsCmdTagDeleteFiles ( MultiFiles * mf = 0L )

Definition at line 1548 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdTagDelete(), and KoDeleteTagHandler::OnFiles().

01549 {
01550     if(gCvsPrefs.empty())
01551         return;
01552
01553     MultiFiles mf;
01554     if(mfarg == 0L)
01555     {
01556         if(!BrowserGetMultiFiles("Select files to untag :", mf))
01557             return;
01558         mfarg = &mf;
01559     }
01560
01561     bool noRecurs;
01562     CPStr tagName;
01563     if(!CompatTagDelete(noRecurs, tagName))
01564         return;
01565
01566     while(mfarg->next())
01567     {
01568         CvsArgs args;
01569         args.add("tag");
01570         args.add("-d");
01571         if(noRecurs)
01572             args.add("-l");
01573         args.add(tagName);
01574
01575         const char *dir = mfarg->add(args);
01576         args.print(dir);
01577         launchCVS(dir, args.Argc(), args.Argv());
01578     }
01579 }

void CvsCmdTagDeleteFolder ( const char * dir = 0L )

Definition at line 1686 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdTagDelete(), UCvsFiles::OnCmdTagDelete(), KoDeleteTagHandler::OnFolder(), and CWinCvsBrowser::OnViewTagDelete().

01687 {
01688     if(gCvsPrefs.empty())
01689         return;
01690
01691     if(dir == 0L)
01692         dir = BrowserGetDirectory("Select a directory to untag :");
01693     if(dir == 0L)
01694         return;
01695
01696     bool noRecurs;
01697     CPStr tagName;
01698     if(!CompatTagDelete(noRecurs, tagName))
01699         return;
01700
01701     CvsArgs args;
01702     args.add("tag");
01703     args.add("-d");
01704     if(noRecurs)
01705         args.add("-l");
01706     args.add(tagName);
01707
01708     args.print(dir);
01709     launchCVS(dir, args.Argc(), args.Argv());
01710 }

void CvsCmdUneditFiles ( MultiFiles * mf = 0L )

Definition at line 1765 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdUnedit(), and KoUneditHandler::OnFiles().

01766 {
01767     if(gCvsPrefs.empty())
01768         return;
01769
01770     MultiFiles mf;
01771     if(mfarg == 0L)
01772     {
01773         if(!BrowserGetMultiFiles("Select the files to unedit :", mf))
01774             return;
01775         mfarg = &mf;
01776     }
01777
01778     while(mfarg->next())
01779     {
01780         CvsArgs args;
01781         args.add("unedit");
01782
01783         const char *dir = mfarg->add(args);
01784         args.print(dir);
01785         launchCVS(dir, args.Argc(), args.Argv());
01786     }
01787 }

void CvsCmdUneditFolder ( const char * dir = 0L )

Definition at line 1904 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdUnedit(), UCvsFiles::OnCmdUnedit(), KoUneditHandler::OnFolder(), and CWinCvsBrowser::OnViewUnedit().

01905 {
01906     if(gCvsPrefs.empty())
01907         return;
01908
01909     if(dir == 0L)
01910         dir = BrowserGetDirectory("Select a directory to unedit :");
01911     if(dir == 0L)
01912         return;
01913
01914     CvsArgs args;
01915     args.add("unedit");
01916
01917     args.print(dir);
01918     launchCVS(dir, args.Argc(), args.Argv());
01919 }

void CvsCmdUnlockFiles ( MultiFiles * mf = 0L )

Definition at line 1485 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdUnlock(), and KoUnlockHandler::OnFiles().

01486 {
01487     if(gCvsPrefs.empty())
01488         return;
01489
01490     MultiFiles mf;
01491     if(mfarg == 0L)
01492     {
01493         if(!BrowserGetMultiFiles("Select files to unlock :", mf))
01494             return;
01495         mfarg = &mf;
01496     }
01497
01498     while(mfarg->next())
01499     {
01500         CvsArgs args;
01501         args.add("admin");
01502         args.add("-u");
01503
01504         const char *dir = mfarg->add(args);
01505         args.print(dir);
01506         launchCVS(dir, args.Argc(), args.Argv());
01507     }
01508 }

void CvsCmdUnlockFolder ( const char * dir = 0L )

Definition at line 1637 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdUnlock(), UCvsFiles::OnCmdUnlock(), KoUnlockHandler::OnFolder(), and CWinCvsBrowser::OnViewUnlock().

01638 {
01639     if(gCvsPrefs.empty())
01640         return;
01641
01642     if(dir == 0L)
01643         dir = BrowserGetDirectory("Select a directory to unlock :");
01644     if(dir == 0L)
01645         return;
01646
01647     CvsArgs args;
01648     args.add("admin");
01649     args.add("-u");
01650
01651     args.print(dir);
01652     launchCVS(dir, args.Argc(), args.Argv());
01653 }

void CvsCmdUpdateFiles | ( | MultiFiles * | mf = 0L,
 |  | bool | queryOnly = false
 | ) |

Definition at line 653 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdQueryUpdate(), UCvsFiles::OnCmdUpdate(), KoQueryUpdateHandler::OnFiles(), and KoUpdateHandler::OnFiles().

00654 {
00655     if(gCvsPrefs.empty())
00656         return;
00657
00658     MultiFiles mf;
00659     if(mfarg == 0L)
00660     {
00661         if(!BrowserGetMultiFiles("Select files to update :", mf))
00662             return;
00663         mfarg = &mf;
00664     }
00665
00666     bool toStdout;
00667     bool noRecurs;
00668     bool resetSticky;
00669     CPStr date;
00670     CPStr rev;
00671     bool useMostRecent;
00672     CPStr rev1;
00673     CPStr rev2;
00674     bool createMissDir;
00675     bool getCleanCopy;
00676
00677     if(!queryOnly && !CompatGetUpdate(toStdout, noRecurs, resetSticky,
00678         date, rev, useMostRecent, rev1, rev2, createMissDir, getCleanCopy))
00679         return;
00680
00681     while(mfarg->next())
00682     {
00683         CvsArgs args;
00684         if(queryOnly)
00685             args.add("-n");
00686         args.add("update");
00687
00688         if(!queryOnly)
00689         {
00690             if(resetSticky)
00691                 args.add("-A");
00692             if(createMissDir)
00693                 args.add("-d");
00694             if(getCleanCopy)
00695                 args.add("-C");
00696             if(!date.empty())
00697             {
00698                 args.add("-D");
00699                 args.add(date);
00700             }
00701             if(useMostRecent)
00702                 args.add("-f");
00703             if(!rev1.empty())
00704             {
00705                 CPStr tmp;
00706                 tmp = "-j";
00707                 tmp << rev1;
00708                 args.add(tmp);
00709             }
00710             if(!rev2.empty())
00711             {
00712                 CPStr tmp;
00713                 tmp = "-j";
00714                 tmp << rev2;
00715                 args.add(tmp);
00716             }
00717             /*if(noRecurs)
00718                 args.add("-l");*/
00719             if(toStdout)
00720                 args.add("-p");
00721             if(!rev.empty())
00722             {
00723                 args.add("-r");
00724                 args.add(rev);
00725             }
00726         }
00727
00728         const char *dir = mfarg->add(args);
00729         args.print(dir);
00730         launchCVS(dir, args.Argc(), args.Argv());
00731     }
00732 }

void CvsCmdUpdateFolder | ( | const char * | dir = 0L,
 |  | bool | queryOnly = false
 | ) |

Definition at line 100 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdQueryUpdate(), UCvsFiles::OnCmdQueryUpdate(), UCvsFolders::OnCmdUpdate(), UCvsFiles::OnCmdUpdate(), KoQueryUpdateHandler::OnFolder(), KoUpdateHandler::OnFolder(), CWinCvsBrowser::OnViewQueryUpdate(), and CWinCvsBrowser::OnViewUpdate().

00101 {
00102     if(gCvsPrefs.empty())
00103         return;
00104
00105     if(dir == 0L)
00106         dir = BrowserGetDirectory("Select a directory to update :");
00107     if(dir == 0L)
00108         return;
00109
00110     bool toStdout;
00111     bool noRecurs;
00112     bool resetSticky;
00113     CPStr date;
00114     CPStr rev;
00115     bool useMostRecent;
00116     CPStr rev1;
00117     CPStr rev2;
00118     bool createMissDir;
00119     bool getCleanCopy;
00120
00121     if(!queryOnly && !CompatGetUpdate(toStdout, noRecurs, resetSticky,
00122         date, rev, useMostRecent, rev1, rev2, createMissDir, getCleanCopy))
00123         return;
00124
00125     CvsArgs args;
00126     if(queryOnly)
00127         args.add("-n");
00128     args.add("update");
00129     if(gCvsPrefs.PruneOption())
00130         args.add("-P");
00131
00132     if(!queryOnly)
00133     {
00134         if(resetSticky)
00135             args.add("-A");
00136         if(createMissDir)
00137             args.add("-d");
00138         if(getCleanCopy)
00139             args.add("-C");
00140         if(!date.empty())
00141         {
00142             args.add("-D");
00143             args.add(date);
00144         }
00145         if(useMostRecent)
00146             args.add("-f");
00147         if(!rev1.empty())
00148         {
00149             CPStr tmp;
00150             tmp = "-j";
00151             tmp << rev1;
00152             args.add(tmp);
00153         }
00154         if(!rev2.empty())
00155         {
00156             CPStr tmp;
00157             tmp = "-j";
00158             tmp << rev2;
00159             args.add(tmp);
00160         }
00161         if(noRecurs)
00162             args.add("-l");
00163         if(toStdout)
00164             args.add("-p");
00165         if(!rev.empty())
00166         {
00167             args.add("-r");
00168             args.add(rev);
00169         }
00170     }
00171
00172     args.print(dir);
00173     launchCVS(dir, args.Argc(), args.Argv());
00174 }

void CvsCmdWatchOffFiles ( MultiFiles * mf = 0L )

Definition at line 1814 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdWatchOff(), and KoWatchOffHandler::OnFiles().

01815 {
01816     if(gCvsPrefs.empty())
01817         return;
01818
01819     MultiFiles mf;
01820     if(mfarg == 0L)
01821     {
01822         if(!BrowserGetMultiFiles("Select the files to unwatch :", mf))
01823             return;
01824         mfarg = &mf;
01825     }
01826
01827     while(mfarg->next())
01828     {
01829         CvsArgs args;
01830         args.add("watch");
01831         args.add("remove");
01832
01833         const char *dir = mfarg->add(args);
01834         args.print(dir);
01835         launchCVS(dir, args.Argc(), args.Argv());
01836     }
01837 }

void CvsCmdWatchOffFolder ( const char * dir = 0L )

Definition at line 1939 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdWatchOff(), UCvsFiles::OnCmdWatchOff(), KoWatchOffHandler::OnFolder(), and CWinCvsBrowser::OnViewWatchOff().

01940 {
01941     if(gCvsPrefs.empty())
01942         return;
01943
01944     if(dir == 0L)
01945         dir = BrowserGetDirectory("Select a directory to unwatch :");
01946     if(dir == 0L)
01947         return;
01948
01949     CvsArgs args;
01950     args.add("watch");
01951     args.add("remove");
01952
01953     args.print(dir);
01954     launchCVS(dir, args.Argc(), args.Argv());
01955 }

void CvsCmdWatchOnFiles ( MultiFiles * mf = 0L )

Definition at line 1789 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdWatchOn(), and KoWatchOnHandler::OnFiles().

01790 {
01791     if(gCvsPrefs.empty())
01792         return;
01793
01794     MultiFiles mf;
01795     if(mfarg == 0L)
01796     {
01797         if(!BrowserGetMultiFiles("Select the files to watch :", mf))
01798             return;
01799         mfarg = &mf;
01800     }
01801
01802     while(mfarg->next())
01803     {
01804         CvsArgs args;
01805         args.add("watch");
01806         args.add("add");
01807
01808         const char *dir = mfarg->add(args);
01809         args.print(dir);
01810         launchCVS(dir, args.Argc(), args.Argv());
01811     }
01812 }

void CvsCmdWatchOnFolder ( const char * dir = 0L )

Definition at line 1921 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdWatchOn(), UCvsFiles::OnCmdWatchOn(), KoWatchOnHandler::OnFolder(), and CWinCvsBrowser::OnViewWatchOn().

01922 {
01923     if(gCvsPrefs.empty())
01924         return;
01925
01926     if(dir == 0L)
01927         dir = BrowserGetDirectory("Select a directory to watch :");
01928     if(dir == 0L)
01929         return;
01930
01931     CvsArgs args;
01932     args.add("watch");
01933     args.add("add");
01934
01935     args.print(dir);
01936     launchCVS(dir, args.Argc(), args.Argv());
01937 }

void CvsCmdWatchersFiles ( MultiFiles * mf = 0L )

Definition at line 1839 of file CvsCommands.cpp.

Referenced by UCvsFiles::OnCmdWatchers(), and KoWatchersHandler::OnFiles().

01840 {
01841     if(gCvsPrefs.empty())
01842         return;
01843
01844     MultiFiles mf;
01845     if(mfarg == 0L)
01846     {
01847         if(!BrowserGetMultiFiles("Select the files to get the watchers from :", mf))
01848             return;
01849         mfarg = &mf;
01850     }
01851
01852     while(mfarg->next())
01853     {
01854         CvsArgs args;
01855         args.add("watchers");
01856
01857         const char *dir = mfarg->add(args);
01858         args.print(dir);
01859         launchCVS(dir, args.Argc(), args.Argv());
01860     }
01861 }

void CvsCmdWatchersFolder ( const char * dir = 0L )

Definition at line 1993 of file CvsCommands.cpp.

Referenced by UCvsFolders::OnCmdWatchers(), UCvsFiles::OnCmdWatchers(), KoWatchersHandler::OnFolder(), and CWinCvsBrowser::OnViewWatchers().

01994 {
01995     if(gCvsPrefs.empty())
01996         return;
01997
01998     if(dir == 0L)
01999         dir = BrowserGetDirectory("Select a directory to get the watchers from :");
02000     if(dir == 0L)
02001         return;
02002
02003     CvsArgs args;
02004     args.add("watchers");
02005
02006     args.print(dir);
02007     launchCVS(dir, args.Argc(), args.Argv());
02008 }

char* cleanUpLogMsg ( const char * msg )

Definition at line 73 of file CvsCommands.cpp.

Referenced by CvsCmdCommitFiles(), CvsCmdCommitFolder(), CvsCmdImportModule(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), and CGraphView::OnGraphSetstate().

00074 {
00075     static CStaticAllocT<char> buf;
00076
00077     size_t len = strlen(msg);
00078     buf.AdjustSize(len + 1);
00079
00080     char *tmp = buf;
00081     char c;
00082     while((c = *msg++) != '\0')
00083     {
00084 #ifdef WIN32
00085         if(c == '\r')
00086             continue;
00087 #endif /* WIN32 */
00088 #ifdef macintosh
00089         if(c == '\r')
00090             c = '\n';
00091 #endif /* macintosh */
00092         *tmp++ = c;
00093     }
00094     *tmp++ = '\0';
00095
00096     return buf;
00097 }

Generated on Sun Oct 21 12:42:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsEntries.cpp File Reference

common/CvsEntries.cpp File Reference

#include "stdafx.h"
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "CvsEntries.h"
#include "AppConsole.h"
#include "getline.h"
#include "FileTraversal.h"
#include <time.h>

Include dependency graph for CvsEntries.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | NEW new

Functions

const char * | cloneStr (const char *cp)
void | disposeStr (const char *cp)
EntnodeData * | fgetentent (FILE *fpin, const char *path, char *cmd=0L)
bool | Entries_Open (CSortList< ENTNODE > &entries, const char *fullpath)
bool | unmodified (const struct stat &sb, const char *ts)
EntnodeData * | Entries_SetVisited (const char *path, CSortList< ENTNODE > &entries, const char *name, const struct stat &finfo, bool isFolder, const std::vector< UStr > *ignlist)
void | Entries_SetMissing (CSortList< ENTNODE > &entries)
bool | Tag_Open (UStr &tag, const char *fullpath)

Define Documentation

#define NEW new

Definition at line 62 of file CvsEntries.cpp.

Function Documentation

bool Entries_Open | ( | CSortList< ENTNODE > & | entries,
 |  | const char * | fullpath
 | ) |

Definition at line 286 of file CvsEntries.cpp.

00287 {
00288     EntnodeData *ent;
00289
00290     UStr adminPath(fullpath);
00291     if(!adminPath.endsWith(kPathDelimiter))
00292         adminPath << kPathDelimiter;
00293     adminPath << "CVS";
00294     adminPath << kPathDelimiter;
00295
00296     entries.Reset();
00297     UStr filename = adminPath;
00298     filename << "Entries";
00299     FILE *fpin = fopen(filename, "r");
00300     if (fpin == 0L)
00301         return false;
00302
00303     while ((ent = fgetentent (fpin, fullpath)) != 0L)
00304     {
00305         ENTNODE newnode(ent);
00306         ent->UnRef();
00307
00308         if(entries.InsideAndInsert(newnode))
00309         {
00310             cvs_err("Warning : duplicated entry in the 'CVS/Entries' file in directory '%s'\n",
00311                 fullpath);
00312         }
00313     }
00314
00315     fclose (fpin);
00316
00317     filename = adminPath;
00318     filename << "Entries.log";
00319     fpin = fopen(filename, "r");
00320     if (fpin != 0L)
00321     {
00322         char cmd;
00323
00324         while ((ent = fgetentent (fpin, &cmd)) != 0L)
00325         {
00326             ENTNODE newnode(ent);
00327             ent->UnRef();
00328
00329             switch (cmd)
00330             {
00331             case 'A':
00332                 if(entries.InsideAndInsert(newnode))
00333                 {
00334                     // dont care
00335                 }
00336                 break;
00337             case 'R':
00338                 entries.Delete(newnode);
00339                 break;
00340             default:
00341                 /* Ignore unrecognized commands.  */
00342                 break;
00343             }
00344         }
00345         fclose (fpin);
00346     }
00347     return true;
00348 }

void Entries_SetMissing ( CSortList< ENTNODE > & entries )

Definition at line 545 of file CvsEntries.cpp.

00546 {
00547     int numEntries = entries.NumOfElements();
00548     for(int i = 0; i < numEntries; i++)
00549     {
00550         const ENTNODE & theNode = entries.Get(i);
00551         EntnodeData *data = theNode.Data();
00552         if(data->IsVisited())
00553             continue;
00554
00555         data->SetMissing(true);
00556         data->SetDesc(data->IsRemoved() ? "Removed" : "Missing");
00557     }
00558 }

EntnodeData* Entries_SetVisited | ( | const char * | path,
 |  | CSortList< ENTNODE > & | entries,
 |  | const char * | name,
 |  | const struct stat & | finfo,
 |  | bool | isFolder,
 |  | const std::vector< UStr > * | ignlist = 0L
 | ) |

Definition at line 410 of file CvsEntries.cpp.

00412 {
00413     int index;
00414     bool isCvs = false;
00415
00416     EntnodePath *thePath = new EntnodePath(path);
00417
00418     if(isFolder)
00419     {
00420         EntnodeFolder *adata = NEW EntnodeFolder(name, thePath);
00421         ENTNODE anode(adata);
00422         adata->UnRef();
00423         isCvs = entries.InsideAndInsert(anode, &index);
00424     }
00425     else
00426     {
00427         EntnodeFile *adata = NEW EntnodeFile(name, thePath);
00428         ENTNODE anode(adata);
00429         adata->UnRef();
00430         isCvs = entries.InsideAndInsert(anode, &index);
00431     }
00432
00433     thePath->UnRef();
00434
00435     const ENTNODE & theNode = entries.Get(index);
00436     EntnodeData *data = theNode.Data();
00437     data->SetVisited(true);
00438     if(!isCvs)
00439     {
00440         data->SetUnknown(true);
00441         if(ignlist != 0L && MatchIgnoredList(name, *ignlist))
00442             data->SetIgnored(true);
00443
00444         // the folder may have some cvs informations in it, despite the fact
00445         // that it is not referenced by the parent directory, so try
00446         // to figure it.
00447
00448         if(!data->IsIgnored())
00449         {
00450             CStr cvsFile(path);
00451             if(!cvsFile.endsWith(kPathDelimiter))
00452                 cvsFile << kPathDelimiter;
00453             cvsFile << name;
00454             if(!cvsFile.endsWith(kPathDelimiter))
00455                 cvsFile << kPathDelimiter;
00456             cvsFile << "CVS";
00457             struct stat sb;
00458             if (stat(cvsFile, &sb) != -1 && S_ISDIR(sb.st_mode))
00459             {
00460                 data->SetUnknown(false);
00461             }
00462         }
00463     }
00464
00465     if(isFolder)
00466     {
00467         if(data->IsIgnored())
00468         {
00469             data->SetDesc("Ignored Folder");
00470         }
00471         else if(data->IsUnknown())
00472         {
00473             data->SetDesc("NonCvs Folder");
00474         }
00475         else
00476         {
00477             data->SetDesc("Folder");
00478         }
00479     }
00480     else
00481     {
00482         const char *ts = (*data)[EntnodeFile::kTS];
00483         if(ts == 0L)
00484             data->SetUnmodified(true);
00485         else
00486             data->SetUnmodified(unmodified(finfo, ts));
00487
00488 #if defined(WIN32)
00489         if (GetWinCvsDebugMaskBit(wcvsdbg_trace_modified_checks_bit))
00490         {
00491             char scratch[128];
00492
00493             /* copied from unmodified... */
00494             char *cp;
00495             struct tm *tm_p;
00496             struct tm local_tm;
00497             tm_p = gmtime (& finfo.st_mtime);
00498             if (tm_p)
00499             {
00500                 memcpy (&local_tm, tm_p, sizeof (local_tm));
00501                 cp = asctime (&local_tm);   /* copy in the modify time */
00502             }
00503             else
00504             {
00505                 cp = "NULL";
00506             }
00507
00508             _snprintf(scratch, 128,
00509                 "Checking timestamps for %s: Entries: %s, file: %s --> %s\n",
00510                 name, ts, cp,
00511                 data->IsUnmodified() ? "unmodified" : "modified");
00512             cvs_err(scratch);
00513             OutputDebugString(scratch);
00514         }
00515 #endif
00516
00517         data->SetLocked((finfo.st_mode & S_IWRITE) == 0);
00518
00519         const char *info = 0L;
00520         if(data->IsIgnored())
00521         {
00522             data->SetDesc("Ignored");
00523         }
00524         else if(data->IsUnknown())
00525         {
00526             data->SetDesc("NonCvs file");
00527         }
00528         else if(data->GetConflict() != 0L)
00529         {
00530             data->SetDesc("Conflict");
00531         }
00532         else if((info = (*data)[EntnodeFile::kOption]) != 0L && strcmp(info, "-kb") == 0)
00533         {
00534             data->SetDesc(data->IsUnmodified() ? "Binary" : "Mod. Binary");
00535         }
00536         else
00537         {
00538             data->SetDesc(data->IsUnmodified() ? "File" : "Mod. File");
00539         }
00540     }
00541
00542     return data;
00543 }

bool Tag_Open | ( | UStr & | tag,
 |  | const char * | fullpath
 | ) |

Definition at line 560 of file CvsEntries.cpp.

00561 {
00562     tag = "";
00563     CStr tagFile(fullpath);
00564     if(!tagFile.endsWith(kPathDelimiter))
00565         tagFile << kPathDelimiter;
00566     tagFile << "Tag";
00567
00568     FILE *fpin = fopen(tagFile, "r");
00569     if (fpin == 0L)
00570         return false;
00571
00572     char *line = 0L;
00573     size_t line_chars_allocated = 0;
00574     int line_length;
00575     if((line_length = getline (&line, &line_chars_allocated, fpin)) > 0)
00576     {
00577         char *tmp = strchr(line, '\n');
00578         if(tmp != 0L)
00579             *tmp = '\0';
00580         if(line[0] == 'T')
00581             tag = line + 1;
00582     }
00583     if(line != 0L)
00584         free(line);
00585     if (line_length < 0 && !feof (fpin))
00586     {
00587         cvs_err("Cannot open Tag file in '%s' (error %d)\n", fullpath, errno);
00588         return false;
00589     }
00590
00591     fclose (fpin);
00592     return !tag.empty();
00593 }

const char* cloneStr ( const char * cp ) [static]

Definition at line 65 of file CvsEntries.cpp.

Referenced by EntnodeData::EntnodeData(), EntnodeFile::EntnodeFile(), and EntnodePath::EntnodePath().

00066 {
00067     if(cp && *cp)
00068     {
00069         cp = strdup(cp);
00070         if (!cp)
00071         {
00072             throw std::bad_alloc();
00073         }
00074     }
00075     else
00076     {
00077         cp = 0L;
00078     }
00079     return cp;
00080 }

void disposeStr ( const char * cp ) [static]

Definition at line 82 of file CvsEntries.cpp.

Referenced by EntnodeData::~EntnodeData(), EntnodeFile::~EntnodeFile(), and EntnodePath::~EntnodePath().

00083 {
00084     if (cp)
00085     {
00086         free((void*)cp);
00087     }
00088 }

EntnodeData* fgetentent | ( | FILE * | fpin,
 |  | const char * | path,
 |  | char * | cmd = 0L
 | ) | [static]

Definition at line 183 of file CvsEntries.cpp.

00184 {
00185     EntnodeData *ent;
00186     char *line = 0L;
00187     size_t line_chars_allocated = 0;
00188     register char *cp;
00189     ent_type type;
00190     char *l, *user, *vn, *ts, *options;
00191     char *tag_or_date, *tag, *date, *ts_conflict;
00192     int line_length;
00193
00194     EntnodePath *thePath = new EntnodePath(path);
00195
00196     ent = 0L;
00197     while ((line_length = getline (&line, &line_chars_allocated, fpin)) > 0)
00198     {
00199         l = line;
00200
00201         /* If CMD is not NULL, we are reading an Entries.Log file.
00202         Each line in the Entries.Log file starts with a single
00203         character command followed by a space.  For backward
00204         compatibility, the absence of a space indicates an add
00205         command.  */
00206         if (cmd != 0L)
00207         {
00208             if (l[1] != ' ')
00209                 *cmd = 'A';
00210             else
00211             {
00212                 *cmd = l[0];
00213                 l += 2;
00214             }
00215         }
00216         type = ENT_FILE;
00217
00218         if (l[0] == 'D')
00219         {
00220             type = ENT_SUBDIR;
00221             ++l;
00222             /* An empty D line is permitted; it is a signal that this
00223             Entries file lists all known subdirectories.  */
00224         }
00225
00226         if (l[0] != '/')
00227             continue;
00228
00229         user = l + 1;
00230         if ((cp = strchr (user, '/')) == 0L)
00231             continue;
00232         *cp++ = '\0';
00233         vn = cp;
00234         if ((cp = strchr (vn, '/')) == 0L)
00235             continue;
00236         *cp++ = '\0';
00237         ts = cp;
00238         if ((cp = strchr (ts, '/')) == 0L)
00239             continue;
00240         *cp++ = '\0';
00241         options = cp;
00242         if ((cp = strchr (options, '/')) == 0L)
00243             continue;
00244         *cp++ = '\0';
00245         tag_or_date = cp;
00246         if ((cp = strchr (tag_or_date, '\n')) == 0L
00247 #ifdef macintosh
00248             && (cp = strchr (tag_or_date, '\r')) == 0L
00249 #endif
00250         )
00251             continue;
00252         *cp = '\0';
00253         tag = (char *) 0L;
00254         date = (char *) 0L;
00255         if (*tag_or_date == 'T')
00256             tag = tag_or_date + 1;
00257         else if (*tag_or_date == 'D')
00258             date = tag_or_date + 1;
00259
00260         if ((ts_conflict = strchr (ts, '+')))
00261             *ts_conflict++ = '\0';
00262
00263         if(type == ENT_SUBDIR)
00264             ent = NEW EntnodeFolder(user, thePath);
00265         else
00266             ent = NEW EntnodeFile(user, thePath, vn, ts, options,
00267                 tag, date, ts_conflict);
00268         break;
00269     }
00270
00271     if (line_length < 0 && !feof (fpin))
00272         cvs_err("Cannot read entries file (error %d)\n", errno);
00273
00274     free (line);
00275
00276     thePath->UnRef();
00277
00278     return ent;
00279 }

bool unmodified | ( | const struct stat & | sb,
 |  | const char * | ts
 | ) | [static]

Definition at line 351 of file CvsEntries.cpp.

Referenced by Entries_SetVisited().

00352 {
00353     char *cp;
00354     struct tm *tm_p;
00355     struct tm local_tm;
00356     /* We want to use the same timestamp format as is stored in the
00357     st_mtime.  For unix (and NT I think) this *must* be universal
00358     time (UT), so that files don't appear to be modified merely
00359     because the timezone has changed.  For VMS, or hopefully other
00360     systems where gmtime returns NULL, the modification time is
00361     stored in local time, and therefore it is not possible to cause
00362     st_mtime to be out of sync by changing the timezone.  */
00363     tm_p = gmtime (&sb.st_mtime);
00364     if (tm_p)
00365     {
00366         memcpy (&local_tm, tm_p, sizeof (local_tm));
00367         cp = asctime (&local_tm);   /* copy in the modify time */
00368     }
00369     else
00370         cp = ctime(&sb.st_mtime);
00371
00372     cp[24] = 0;
00373
00374 // [6/8/2001] Jerzy K. - the code has been replaced by the version from cvsnt
00375 //which seems simpler and giving the same effect
00376 //keep it here for a while and remove eventually
00377 #if 0
00378 // Bug 432
00379     if( cp[8]=='0') cp[8]=' ';
00380 //  The C Standard Library and the Unix/cygwin versions of CVS
00381 //  write a padding space before days 1-9; Visual C++ libraries use
00382 //  a leading 0.  This affects ctime() and asctime() calls.  Bug 432
00383 //  adopts the padding space standard.  The following allows for backward
00384 //  compatibility with a WinCVS working area checked out prior to the
00385 //  Bug 432 fix.  (cp is the timestamp from the stat of the working file;
00386 //  ts is the timestamp as read from CVS/Entries).
00387     char *ns = (char *)malloc( (strlen(ts) + 1) * sizeof( char ) );
00388     if ( ns == NULL ) {
00389         cvs_err("Could not allocate memory for string ns\n");
00390         return 1;
00391     }
00392     strcpy( ns, ts );
00393     if( ns[8]=='0') ns[8]=' ';
00394     int compare_result = strcmp(ns, cp);
00395     free( ns );
00396     return compare_result == 0;
00397 // Bug 432
00398 #else
00399
00400     /* Deal with the differences in timestamps - posix uses space filled, NT uses zero filled */
00401     if(cp[8]=='0' && ts[8]==' ')
00402         cp[8]=' ';
00403     if(cp[8]==' ' && ts[8]=='0')
00404         cp[8]='0';
00405
00406     return strcmp(cp, ts) == 0;
00407 #endif
00408 }

Generated on Sun Oct 21 12:42:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsEntries.h File Reference

common/CvsEntries.h File Reference

#include "SortList.h"
#include "CvsIgnore.h"

Include dependency graph for CvsEntries.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | ENTNODE
class | EntnodeData
class | EntnodeFile
class | EntnodeFolder
class | EntnodePath

Enumerations

enum | ent_type { ENT_FILE, ENT_SUBDIR }

Functions

bool | Entries_Open (CSortList< ENTNODE > &entries, const char *fullpath)
EntnodeData * | Entries_SetVisited (const char *path, CSortList< ENTNODE > &entries, const char *name, const struct stat &finfo, bool isFolder, const std::vector< UStr > *ignlist=0L)
void | Entries_SetMissing (CSortList< ENTNODE > &entries)
bool | Tag_Open (UStr &tag, const char *fullpath)

Enumeration Type Documentation

enum ent_type

Enumeration values:
ENT_FILE
ENT_SUBDIR

Definition at line 32 of file CvsEntries.h.

00033 {
00034     ENT_FILE,
00035     ENT_SUBDIR
00036 } ent_type;

Function Documentation

bool Entries_Open | ( | CSortList< ENTNODE > & | entries,
 |  | const char * | fullpath
 | ) |

void Entries_SetMissing ( CSortList< ENTNODE > & entries )

Definition at line 545 of file CvsEntries.cpp.

Referenced by TViewFill::ExitDirectory(), CWinCvsBrowser::OnItemexpanding(), UCvsFolders::OnTreeExpanding(), UCvsFiles::ResetView(), cvsgui_GetCvsEntries(), and tclCvsEntriesProc().

00546 {
00547     int numEntries = entries.NumOfElements();
00548     for(int i = 0; i < numEntries; i++)
00549     {
00550         const ENTNODE & theNode = entries.Get(i);
00551         EntnodeData *data = theNode.Data();
00552         if(data->IsVisited())
00553             continue;
00554
00555         data->SetMissing(true);
00556         data->SetDesc(data->IsRemoved() ? "Removed" : "Missing");
00557     }
00558 }

EntnodeData* Entries_SetVisited | ( | const char * | path,
 |  | CSortList< ENTNODE > & | entries,
 |  | const char * | name,
 |  | const struct stat & | finfo,
 |  | bool | isFolder,
 |  | const std::vector< UStr > * | ignlist = 0L
 | ) |

Definition at line 410 of file CvsEntries.cpp.

Referenced by TBrowserFill::OnDirectory(), TViewFill::OnDirectory(), CFillTclEntries::OnDirectory(), CFillPyEntries::OnDirectory(), TViewFill::OnFile(), CFillTclEntries::OnFile(), CFillPyEntries::OnFile(), CHistComboBoxEx::SetIcon(), CGraphDoc::SetNode(), and UCvsGraph::UCvsGraph().

00412 {
00413     int index;
00414     bool isCvs = false;
00415
00416     EntnodePath *thePath = new EntnodePath(path);
00417
00418     if(isFolder)
00419     {
00420         EntnodeFolder *adata = NEW EntnodeFolder(name, thePath);
00421         ENTNODE anode(adata);
00422         adata->UnRef();
00423         isCvs = entries.InsideAndInsert(anode, &index);
00424     }
00425     else
00426     {
00427         EntnodeFile *adata = NEW EntnodeFile(name, thePath);
00428         ENTNODE anode(adata);
00429         adata->UnRef();
00430         isCvs = entries.InsideAndInsert(anode, &index);
00431     }
00432
00433     thePath->UnRef();
00434
00435     const ENTNODE & theNode = entries.Get(index);
00436     EntnodeData *data = theNode.Data();
00437     data->SetVisited(true);
00438     if(!isCvs)
00439     {
00440         data->SetUnknown(true);
00441         if(ignlist != 0L && MatchIgnoredList(name, *ignlist))
00442             data->SetIgnored(true);
00443
00444         // the folder may have some cvs informations in it, despite the fact
00445         // that it is not referenced by the parent directory, so try
00446         // to figure it.
00447
00448         if(!data->IsIgnored())
00449         {
00450             CStr cvsFile(path);
00451             if(!cvsFile.endsWith(kPathDelimiter))
00452                 cvsFile << kPathDelimiter;
00453             cvsFile << name;
00454             if(!cvsFile.endsWith(kPathDelimiter))
00455                 cvsFile << kPathDelimiter;
00456             cvsFile << "CVS";
00457             struct stat sb;
00458             if (stat(cvsFile, &sb) != -1 && S_ISDIR(sb.st_mode))
00459             {
00460                 data->SetUnknown(false);
00461             }
00462         }
00463     }
00464
00465     if(isFolder)
00466     {
00467         if(data->IsIgnored())
00468         {
00469             data->SetDesc("Ignored Folder");
00470         }
00471         else if(data->IsUnknown())
00472         {
00473             data->SetDesc("NonCvs Folder");
00474         }
00475         else
00476         {
00477             data->SetDesc("Folder");
00478         }
00479     }
00480     else
00481     {
00482         const char *ts = (*data)[EntnodeFile::kTS];
00483         if(ts == 0L)
00484             data->SetUnmodified(true);
00485         else
00486             data->SetUnmodified(unmodified(finfo, ts));
00487
00488 #if defined(WIN32)
00489         if (GetWinCvsDebugMaskBit(wcvsdbg_trace_modified_checks_bit))
00490         {
00491             char scratch[128];
00492
00493             /* copied from unmodified... */
00494             char *cp;
00495             struct tm *tm_p;
00496             struct tm local_tm;
00497             tm_p = gmtime (& finfo.st_mtime);
00498             if (tm_p)
00499             {
00500                 memcpy (&local_tm, tm_p, sizeof (local_tm));
00501                 cp = asctime (&local_tm);   /* copy in the modify time */
00502             }
00503             else
00504             {
00505                 cp = "NULL";
00506             }
00507
00508             _snprintf(scratch, 128,
00509                 "Checking timestamps for %s: Entries: %s, file: %s --> %s\n",
00510                 name, ts, cp,
00511                 data->IsUnmodified() ? "unmodified" : "modified");
00512             cvs_err(scratch);
00513             OutputDebugString(scratch);
00514         }
00515 #endif
00516
00517         data->SetLocked((finfo.st_mode & S_IWRITE) == 0);
00518
00519         const char *info = 0L;
00520         if(data->IsIgnored())
00521         {
00522             data->SetDesc("Ignored");
00523         }
00524         else if(data->IsUnknown())
00525         {
00526             data->SetDesc("NonCvs file");
00527         }
00528         else if(data->GetConflict() != 0L)
00529         {
00530             data->SetDesc("Conflict");
00531         }
00532         else if((info = (*data)[EntnodeFile::kOption]) != 0L && strcmp(info, "-kb") == 0)
00533         {
00534             data->SetDesc(data->IsUnmodified() ? "Binary" : "Mod. Binary");
00535         }
00536         else
00537         {
00538             data->SetDesc(data->IsUnmodified() ? "File" : "Mod. File");
00539         }
00540     }
00541
00542     return data;
00543 }

bool Tag_Open | ( | UStr & | tag,
 |  | const char * | fullpath
 | ) |

Definition at line 560 of file CvsEntries.cpp.

Referenced by TViewFill::OnDirectory().

00561 {
00562     tag = "";
00563     CStr tagFile(fullpath);
00564     if(!tagFile.endsWith(kPathDelimiter))
00565         tagFile << kPathDelimiter;
00566     tagFile << "Tag";
00567
00568     FILE *fpin = fopen(tagFile, "r");
00569     if (fpin == 0L)
00570         return false;
00571
00572     char *line = 0L;
00573     size_t line_chars_allocated = 0;
00574     int line_length;
00575     if((line_length = getline (&line, &line_chars_allocated, fpin)) > 0)
00576     {
00577         char *tmp = strchr(line, '\n');
00578         if(tmp != 0L)
00579             *tmp = '\0';
00580         if(line[0] == 'T')
00581             tag = line + 1;
00582     }
00583     if(line != 0L)
00584         free(line);
00585     if (line_length < 0 && !feof (fpin))
00586     {
00587         cvs_err("Cannot open Tag file in '%s' (error %d)\n", fullpath, errno);
00588         return false;
00589     }
00590
00591     fclose (fpin);
00592     return !tag.empty();
00593 }

Generated on Sun Oct 21 12:42:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvsgui.c File Reference

common/cvsgui.c File Reference

#include <string.h>
#include <stdio.h>
#include "cvsgui_process.h"
#include "cvsgui_protocol.h"

Include dependency graph for cvsgui.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | BUF_SIZE 8000

Functions

char * | cvsguiglue_getenv (const char *env)
char * | cvsguiglue_getpass (const char *prompt)
void | cvsguiglue_exit (int code)
void | reopen_consoles (void)
void | close_consoles (void)
void | myflush (FILE *log, long *oldpos)
void | cvsguiglue_flushconsole (int closeit)
int | main (int argc, char *argv[])

Variables

pipe_t | _cvsgui_readfd = 0
pipe_t | _cvsgui_writefd = 0
long | outseek
long | errseek
char * | outname
char * | errname
FILE * | outlog
FILE * | errlog

Define Documentation

#define BUF_SIZE 8000

Function Documentation

void close_consoles ( void ) [static]

Definition at line 121 of file cvsgui.c.

Referenced by cvsguiglue_flushconsole().

00122 {
00123 #ifndef WIN32
00124     if(outlog != 0L)
00125         fclose(outlog);
00126     if(errlog != 0L)
00127         fclose(errlog);
00128     if(outname != 0L)
00129     {
00130         unlink(outname);
00131         free(outname);
00132     }
00133     if(errname != 0L)
00134     {
00135         unlink(errname);
00136         free(errname);
00137     }
00138 #endif
00139 }

void cvsguiglue_exit ( int code )

Definition at line 81 of file cvsgui.c.

00082 {
00083     if(_cvsgui_writefd != 0)
00084         gp_quit_write (_cvsgui_writefd, code);
00085     exit(code);
00086 }

void cvsguiglue_flushconsole ( int closeit )

Definition at line 179 of file cvsgui.c.

00180 {
00181     fflush(stdout);
00182     fflush(stderr);
00183 #ifndef WIN32
00184     if(outlog != 0L)
00185         myflush(outlog, &outseek);
00186     if(errlog != 0L)
00187         myflush(errlog, &errseek);
00188     if(closeit)
00189         close_consoles();
00190 #endif
00191 }

char* cvsguiglue_getenv ( const char * env )

Definition at line 56 of file cvsgui.c.

00057 {
00058     char *res = 0L;
00059
00060     if(_cvsgui_readfd == 0)
00061         return getenv(env);
00062
00063     cvsguiglue_flushconsole(1);
00064
00065     if(env && gp_getenv_write (_cvsgui_writefd, env))
00066     {
00067         res = gp_getenv_read(_cvsgui_readfd);;
00068     }
00069
00070     return res;
00071 }

char* cvsguiglue_getpass ( const char * prompt )

Definition at line 73 of file cvsgui.c.

00074 {
00075     if(_cvsgui_readfd == 0)
00076         return getpass(prompt);
00077
00078     return cvsguiglue_getenv("CVS_GETPASS");
00079 }

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |

Definition at line 193 of file cvsgui.c.

00194 {
00195     int res;
00196     char **tmparg = 0L;
00197
00198     if(argc >= 4 && strcmp(argv[1], "-cvsgui") == 0)
00199     {
00200         int i;
00201
00202         _cvsgui_readfd = (pipe_t)atoi (argv[2]);
00203         _cvsgui_writefd = (pipe_t)atoi (argv[3]);
00204
00205         tmparg = (char **)malloc((argc - 2) * sizeof(char *));
00206         if(tmparg == 0L)
00207             goto ignore;
00208
00209         tmparg[0] = argv[0];
00210         for(i = 4; i < argc; i++)
00211         {
00212             tmparg[i - 3] = argv[i];
00213         }
00214         tmparg[argc - 3] = 0L;
00215         argc -= 3;
00216
00217         cvs_process_init();
00218         reopen_consoles();
00219     }
00220
00221 ignore:
00222     res = cvsguiglue_main(argc, tmparg != 0L ? tmparg :  argv);
00223
00224     if(tmparg != 0L)
00225     {
00226         cvsguiglue_flushconsole(1);
00227         gp_quit_write (_cvsgui_writefd, res);
00228         free(tmparg);
00229     }
00230
00231     return res;
00232 }

void myflush | ( | FILE * | log,
 |  | long * | oldpos
 | ) | [static]

Definition at line 142 of file cvsgui.c.

Referenced by cvsguiglue_flushconsole().

00143 {
00144     long newpos, pos;
00145 #   define BUF_SIZE 8000
00146     char buf[BUF_SIZE];
00147     size_t len;
00148
00149     pos = fseek(log, *oldpos, SEEK_SET);
00150     if(pos != 0)
00151         goto fail;
00152
00153     while(!feof(log) && !ferror(log))
00154     {
00155         len = fread(buf, sizeof(char), BUF_SIZE, log);
00156         if(len > 0)
00157         {
00158             if(log == outlog)
00159                 gp_console_write (_cvsgui_writefd, buf, len, 0);
00160             if(log == errlog)
00161                 gp_console_write (_cvsgui_writefd, buf, len, 1);
00162         }
00163     }
00164
00165     if(ferror(log))
00166         goto fail;
00167
00168     newpos = ftell(log);
00169     if(newpos < 0)
00170         goto fail;
00171
00172     *oldpos = newpos;
00173     return;
00174 fail:
00175     fprintf(stderr, "Unable to redirect stdout/stderr !\n");
00176 }

void reopen_consoles ( void ) [static]

Definition at line 88 of file cvsgui.c.

Referenced by main().

00089 {
00090 #ifndef WIN32
00091     outname = tempnam(0L, 0L);
00092     if(outname == 0L)
00093     {
00094         fprintf(stderr, "Unable to open tmp file !\n");
00095         exit(1);
00096     }
00097     errname = tempnam(0L, 0L);
00098     if(errname == 0L)
00099     {
00100         fprintf(stderr, "Unable to open tmp file !\n");
00101         exit(1);
00102     }
00103     outlog = freopen(outname, "w+", stdout);
00104     if(outlog == 0L)
00105     {
00106         fprintf(stderr, "Unable to reopen stdout !\n");
00107         exit(1);
00108     }
00109     errlog = freopen(errname, "w+", stderr);
00110     if(errlog == 0L)
00111     {
00112         fprintf(stderr, "Unable to reopen stderr !\n");
00113         exit(1);
00114     }
00115     outseek = 0;
00116     errseek = 0;
00117 #endif
00118 }

Variable Documentation

pipe_t _cvsgui_readfd = 0

Definition at line 46 of file cvsgui.c.

pipe_t _cvsgui_writefd = 0

Definition at line 47 of file cvsgui.c.

FILE* errlog [static]

Definition at line 54 of file cvsgui.c.

char* errname [static]

Definition at line 52 of file cvsgui.c.

long errseek [static]

Definition at line 50 of file cvsgui.c.

FILE* outlog [static]

Definition at line 53 of file cvsgui.c.

char* outname [static]

Definition at line 51 of file cvsgui.c.

long outseek [static]

Definition at line 49 of file cvsgui.c.

Generated on Sun Oct 21 12:42:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvsgui.h File Reference

common/cvsgui.h File Reference

#include <stdlib.h>

Include dependency graph for cvsgui.h:

Include dependency graph

Go to the source code of this file.

Defines

#define | getenv cvsguiglue_getenv
#define | getpass cvsguiglue_getpass
#define | getpassphrase cvsguiglue_getpass
#define | main cvsguiglue_main
#define | exit cvsguiglue_exit

Functions

char * | cvsguiglue_getenv (const char *env)
char * | cvsguiglue_getpass (const char *prompt)
int | cvsguiglue_main (int argc, char *argv[])
void | cvsguiglue_exit (int code)
void | cvsguiglue_flushconsole (int closeit)

Define Documentation

#define exit cvsguiglue_exit

Definition at line 51 of file cvsgui.h.

Referenced by argv(), bind_and_connect(), convert_hqx_file(), cvsguiglue_exit(), dllglue_main(), error_exit(), fillSemiColonTypes(), getDefaultEncodingPolicy(), get_date(), gp_getenv_read(), init_sockets(), init_winsock(), listAddCell(), listNew(), lookup_env(), main(), mystrdup(), n(), rcmd(), rcmd_authenticate(), reopen_consoles(), resolve_address(), root_allow_size(), and usage().

#define getenv cvsguiglue_getenv

Definition at line 44 of file cvsgui.h.

Referenced by CvsPrefs::Home(), MakeTmpFile(), AuthenSSH::RsaIdentityFile(), convert_file(), cvsguiglue_getenv(), fillSemiColonTypes(), getDefaultEncodingPolicy(), getdate_yyparse(), getpass(), glue_getenv(), lookup_env(), macos_start_server(), os2_start_server(), popen(), vms_start_server(), wnt_start_server(), and yesno().

#define getpass cvsguiglue_getpass

Definition at line 45 of file cvsgui.h.

Referenced by cvsguiglue_getpass().

#define getpassphrase cvsguiglue_getpass

Definition at line 48 of file cvsgui.h.

#define main cvsguiglue_main

Definition at line 50 of file cvsgui.h.

Referenced by dllglue_main(), and get_date().

Function Documentation

void cvsguiglue_exit ( int code )

Definition at line 81 of file cvsgui.c.

00082 {
00083     if(_cvsgui_writefd != 0)
00084         gp_quit_write (_cvsgui_writefd, code);
00085     exit(code);
00086 }

void cvsguiglue_flushconsole ( int closeit )

Definition at line 179 of file cvsgui.c.

Referenced by cvsguiglue_getenv(), and main().

00180 {
00181     fflush(stdout);
00182     fflush(stderr);
00183 #ifndef WIN32
00184     if(outlog != 0L)
00185         myflush(outlog, &outseek);
00186     if(errlog != 0L)
00187         myflush(errlog, &errseek);
00188     if(closeit)
00189         close_consoles();
00190 #endif
00191 }

char* cvsguiglue_getenv ( const char * env )

Definition at line 56 of file cvsgui.c.

Referenced by cvsguiglue_getpass().

00057 {
00058     char *res = 0L;
00059
00060     if(_cvsgui_readfd == 0)
00061         return getenv(env);
00062
00063     cvsguiglue_flushconsole(1);
00064
00065     if(env && gp_getenv_write (_cvsgui_writefd, env))
00066     {
00067         res = gp_getenv_read(_cvsgui_readfd);;
00068     }
00069
00070     return res;
00071 }

char* cvsguiglue_getpass ( const char * prompt )

Definition at line 73 of file cvsgui.c.

00074 {
00075     if(_cvsgui_readfd == 0)
00076         return getpass(prompt);
00077
00078     return cvsguiglue_getenv("CVS_GETPASS");
00079 }

int cvsguiglue_main | ( | int | argc,
 |  | char * | argv[]
 | ) |

Referenced by main().

Generated on Sun Oct 21 12:42:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvsgui_process.cpp File Reference

common/cvsgui_process.cpp File Reference

#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/param.h>
#include <unistd.h>
#include <stack>
#include <vector>
#include <algorithm>
#include "cvsgui_process.h"
#include "cvsgui_protocol.h"

Include dependency graph for cvsgui_process.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

struct | CDestroyThreadLock
struct | CStackThreadLock

Functions

int | cvs_process_write (pipe_t fd, guint8 *buf, gulong count)
int | cvs_process_flush (pipe_t fd)
void | cvs_process_push (CvsProcess *cvs_process)
void | cvs_process_pop (void)
void | cvs_process_recv_message (CvsProcess *p)
void | cvs_process_handle_message (WireMessage *msg)
void | cvs_process_close (CvsProcess *cvs_process, int kill_it)
void | cvs_process_destroy (CvsProcess *cvs_process)
CvsProcess * | cvs_process_new (char *name, int argc, char **argv)
void | _gp_quit_read (pipe_t fd, WireMessage *msg)
void | _gp_quit_write (pipe_t fd, WireMessage *msg)
void | _gp_quit_destroy (WireMessage *msg)
void | _gp_getenv_read (pipe_t fd, WireMessage *msg)
void | _gp_getenv_write (pipe_t fd, WireMessage *msg)
void | _gp_getenv_destroy (WireMessage *msg)
void | _gp_console_read (pipe_t fd, WireMessage *msg)
void | _gp_console_write (pipe_t fd, WireMessage *msg)
void | _gp_console_destroy (WireMessage *msg)
void | gp_init ()
int | gp_quit_write (pipe_t fd, int code)
int | gp_getenv_write (pipe_t fd, const char *env)
char * | gp_getenv_read (pipe_t fd)
int | gp_console_write (pipe_t fd, const char *str, int len, int isStderr)
void | cvs_process_init ()
CvsProcess * | cvs_process_open (char *name, int argc, char **argv, CvsProcessCallbacks *callbacks, int hasTty, const char *currentDirectory)
int | cvs_process_is_active (CvsProcess *cvs_process)
void | cvs_process_kill (CvsProcess *cvs_process)
void | cvs_process_give_time (void)

Variables

std::deque< CvsProcess *> | cvs_process_stack
std::vector< CvsProcess *> open_cvs_process
CvsProcess * | current_cvs_process = NULL
int | current_write_buffer_index = 0
char * | current_write_buffer = NULL
char | process_write_buffer [512]

Function Documentation

void _gp_console_destroy ( WireMessage * msg ) [static]

Definition at line 251 of file cvsgui_process.cpp.

00252 {
00253     GPT_CONSOLE *t = (GPT_CONSOLE *)msg->data;
00254     free(t->str);
00255     free(t);
00256 }

void _gp_console_read | ( | pipe_t | fd,
 |  | WireMessage * | msg
 | ) | [static]

Definition at line 222 of file cvsgui_process.cpp.

00223 {
00224     GPT_CONSOLE *t = (GPT_CONSOLE *)malloc(sizeof(GPT_CONSOLE));
00225     if(t == 0L)
00226         return;
00227
00228     if (!wire_read_int8 (fd, &t->isStderr, 1))
00229         return;
00230     if (!wire_read_int32 (fd, &t->len, 1))
00231         return;
00232     if (!wire_read_string (fd, &t->str, 1))
00233         return;
00234
00235     msg->data = t;
00236 }

void _gp_console_write | ( | pipe_t | fd,
 |  | WireMessage * | msg
 | ) | [static]

Definition at line 239 of file cvsgui_process.cpp.

00240 {
00241     GPT_CONSOLE *t = (GPT_CONSOLE *)msg->data;
00242     if (!wire_write_int8 (fd, &t->isStderr, 1))
00243         return;
00244     if (!wire_write_int32 (fd, &t->len, 1))
00245         return;
00246     if (!wire_write_string (fd, &t->str, 1))
00247         return;
00248 }

void _gp_getenv_destroy ( WireMessage * msg ) [static]

Definition at line 214 of file cvsgui_process.cpp.

00215 {
00216     GPT_GETENV *t = (GPT_GETENV *)msg->data;
00217     free(t->str);
00218     free(t);
00219 }

void _gp_getenv_read | ( | pipe_t | fd,
 |  | WireMessage * | msg
 | ) | [static]

Definition at line 189 of file cvsgui_process.cpp.

00190 {
00191     GPT_GETENV *t = (GPT_GETENV *)malloc(sizeof(GPT_GETENV));
00192     if(t == 0L)
00193         return;
00194
00195     if (!wire_read_int8 (fd, &t->empty, 1))
00196         return;
00197     if (!wire_read_string (fd, &t->str, 1))
00198         return;
00199
00200     msg->data = t;
00201 }

void _gp_getenv_write | ( | pipe_t | fd,
 |  | WireMessage * | msg
 | ) | [static]

Definition at line 204 of file cvsgui_process.cpp.

00205 {
00206     GPT_GETENV *t = (GPT_GETENV *)msg->data;
00207     if (!wire_write_int8 (fd, &t->empty, 1))
00208         return;
00209     if (!wire_write_string (fd, &t->str, 1))
00210         return;
00211 }

void _gp_quit_destroy ( WireMessage * msg ) [static]

Definition at line 183 of file cvsgui_process.cpp.

00184 {
00185     free(msg->data);
00186 }

void _gp_quit_read | ( | pipe_t | fd,
 |  | WireMessage * | msg
 | ) | [static]

Definition at line 162 of file cvsgui_process.cpp.

00163 {
00164     GPT_QUIT *t = (GPT_QUIT *)malloc(sizeof(GPT_QUIT));
00165     if(t == 0L)
00166         return;
00167
00168     if (!wire_read_int32 (fd, (guint32 *)&t->code, 1))
00169         return;
00170
00171     msg->data = t;
00172 }

void _gp_quit_write | ( | pipe_t | fd,
 |  | WireMessage * | msg
 | ) | [static]

Definition at line 175 of file cvsgui_process.cpp.

00176 {
00177     GPT_QUIT *t = (GPT_QUIT *)msg->data;
00178     if (!wire_write_int32 (fd, (guint32 *)&t->code, 1))
00179         return;
00180 }

void cvs_process_close | ( | CvsProcess * | cvs_process,
 |  | int | kill_it
 | ) | [static]

Definition at line 889 of file cvsgui_process.cpp.

Referenced by cvs_process_destroy(), cvs_process_handle_message(), and cvs_process_recv_message().

00891 {
00892     CDestroyThreadLock locker;
00893
00894     if (cvs_process && cvs_process->open)
00895     {
00896 #ifdef WIN32
00897         if(GetCurrentThreadId() != cvs_process->threadsID[0])
00898         {
00899             // we wait for all the protocol to be over before we close
00900             // the process and the pipe.
00901             WaitForSingleObject(cvs_process->threads[0], 500);
00902             cvs_process->open = FALSE;
00903             WaitForSingleObject(cvs_process->threads[0], 500);
00904         }
00905 #endif
00906
00907         cvs_process->open = FALSE;
00908
00909 #ifndef WIN32
00910         int status;
00911
00912         /* If necessary, kill the filter.
00913          */
00914         if (kill_it && cvs_process->pid)
00915             status = kill (cvs_process->pid, SIGKILL);
00916
00917         /* Wait for the process to exit. This will happen
00918          *  immediately if it was just killed.
00919          */
00920         if (cvs_process->pid)
00921             waitpid (cvs_process->pid, &status, 0);
00922
00923         /* Close the pipes.
00924          */
00925         if (cvs_process->my_read)
00926             close (cvs_process->my_read);
00927         if (cvs_process->my_write)
00928             close (cvs_process->my_write);
00929         if (cvs_process->his_read)
00930             close (cvs_process->his_read);
00931         if (cvs_process->his_write)
00932             close (cvs_process->his_write);
00933 #else
00934         cvs_process->starting = TRUE;
00935
00936         // this is bad to do that, cvs won't have a chance
00937         // to raise the KILL signal (sigh...)
00938         if (kill_it && cvs_process->pid)
00939         {
00940             TerminateProcess(cvs_process->pid, -1);
00941         }
00942
00943         if (cvs_process->pid)
00944             CloseHandle(cvs_process->pid);
00945         if (cvs_process->my_read)
00946             CloseHandle(cvs_process->my_read);
00947         if (cvs_process->my_write)
00948             CloseHandle(cvs_process->my_write);
00949         if (cvs_process->his_read)
00950             CloseHandle(cvs_process->his_read);
00951         if (cvs_process->his_write)
00952             CloseHandle(cvs_process->his_write);
00953         if (cvs_process->pstdin)
00954             CloseHandle(cvs_process->pstdin);
00955         if (cvs_process->pstdout)
00956             CloseHandle(cvs_process->pstdout);
00957         if (cvs_process->pstderr)
00958             CloseHandle(cvs_process->pstderr);
00959 #endif
00960
00961         wire_clear_error();
00962
00963         /* Set the fields to null values.
00964          */
00965         cvs_process->pid = 0;
00966         cvs_process->my_read = 0;
00967         cvs_process->my_write = 0;
00968         cvs_process->his_read = 0;
00969         cvs_process->his_write = 0;
00970         cvs_process->pstdin = 0;
00971         cvs_process->pstdout = 0;
00972         cvs_process->pstderr = 0;
00973
00974         {
00975             CStackThreadLock locker;
00976
00977             std::vector<CvsProcess *>::iterator i = std::find(open_cvs_process.begin(), open_cvs_process.end(), cvs_process);
00978             if(i != open_cvs_process.end())
00979                 open_cvs_process.erase(i);
00980         }
00981     }
00982 }

void cvs_process_destroy ( CvsProcess * cvs_process ) [static]

Definition at line 414 of file cvsgui_process.cpp.

Referenced by cvs_process_kill(), cvs_process_open(), and cvs_process_recv_message().

00415 {
00416     if (cvs_process)
00417     {
00418         cvs_process_close (cvs_process, TRUE);
00419
00420         if(cvs_process->args != 0L)
00421         {
00422             for(int i = 0; i < cvs_process->argc; i++)
00423             {
00424                 if (cvs_process->args[i])
00425                 {
00426                     free (cvs_process->args[i]);
00427                     cvs_process->args[i] = 0L;
00428                 }
00429             }
00430             free(cvs_process->args);
00431             cvs_process->args = 0L;
00432         }
00433
00434         if (cvs_process == current_cvs_process)
00435             cvs_process_pop ();
00436
00437         if (!cvs_process->destroy)
00438         {
00439             cvs_process->destroy = TRUE;
00440 #ifdef WIN32
00441             // wait so the threads do not continue to use the pointer
00442             HANDLE WaitH[4];
00443             int cnt = 0;
00444             DWORD curT = GetCurrentThreadId();
00445             for(int i = 0; i < 4; i++)
00446             {
00447                 if(cvs_process->threads[i] && curT != cvs_process->threadsID[i])
00448                     WaitH[cnt++] = cvs_process->threads[i];
00449             }
00450             WaitForMultipleObjects(cnt, WaitH, TRUE, INFINITE);
00451
00452             //close the handles
00453             for(i = 0; i < 4; i++)
00454             {
00455                 if( cvs_process->threads[i] && CloseHandle(cvs_process->threads[i]) )
00456                 {
00457                     cvs_process->threads[i] = NULL;
00458                 }
00459             }
00460 #endif
00461             free (cvs_process);
00462         }
00463     }
00464 }

int cvs_process_flush ( pipe_t fd ) [static]

Definition at line 1159 of file cvsgui_process.cpp.

01160 {
01161     int count;
01162     int bytes;
01163
01164     if (current_write_buffer_index > 0)
01165     {
01166         count = 0;
01167         while (count != current_write_buffer_index)
01168         {
01169             do {
01170                 bytes = write (fd, &current_write_buffer[count],
01171                                (current_write_buffer_index - count));
01172             } while ((bytes == -1) && (errno == EAGAIN));
01173
01174             if (bytes == -1)
01175                 return FALSE;
01176
01177             count += bytes;
01178         }
01179
01180         current_write_buffer_index = 0;
01181     }
01182
01183     return TRUE;
01184 }

void cvs_process_give_time ( void )

Definition at line 1010 of file cvsgui_process.cpp.

Referenced by UCvsApp::OnMainTimer(), _CvsProcess::callbacks(), and launchCVS().

01011 {
01012 #ifndef WIN32
01013     fd_set rset;
01014     int ready;
01015     int maxfd = 0;
01016     int fd;
01017     struct timeval tv;
01018
01019     FD_ZERO (&rset);
01020
01021     std::vector<CvsProcess *>::iterator i;
01022
01023     for (i = open_cvs_process.begin(); i != open_cvs_process.end(); ++i)
01024     {
01025         fd = (*i)->my_read;
01026
01027         FD_SET (fd, &rset);
01028         if (fd > maxfd)
01029             maxfd = fd;
01030     }
01031
01032     tv.tv_sec = 0;
01033     tv.tv_usec = 100000;
01034     ready = select (maxfd + 1, &rset, 0L, 0L, &tv);
01035
01036     std::vector<CvsProcess *> toFire;
01037     if (ready > 0)
01038     {
01039         for (i = open_cvs_process.begin(); i != open_cvs_process.end(); ++i)
01040         {
01041             fd = (*i)->my_read;
01042
01043             if (FD_ISSET (fd, &rset))
01044                 toFire.push_back(*i);
01045         }
01046     }
01047
01048     for (i = toFire.begin(); i != toFire.end(); ++i)
01049     {
01050         fd = (*i)->my_read;
01051
01052         if (FD_ISSET (fd, &rset))
01053             cvs_process_recv_message (*i);
01054     }
01055 #else
01056     // we don't have to do yield since we use preemptive threads
01057 #endif
01058 }

void cvs_process_handle_message ( WireMessage * msg ) [static]

Definition at line 1092 of file cvsgui_process.cpp.

Referenced by cvs_process_recv_message().

01093 {
01094     switch (msg->type)
01095     {
01096     case GP_QUIT:
01097     {
01098         GPT_QUIT *t = (GPT_QUIT *)msg->data;
01099         current_cvs_process->callbacks->exit(t->code);
01100         cvs_process_close (current_cvs_process, FALSE);
01101         break;
01102     }
01103     case GP_GETENV:
01104     {
01105         GPT_GETENV *t = (GPT_GETENV *)msg->data;
01106         cvs_process_push (current_cvs_process);
01107         gp_getenv_write (current_cvs_process->my_write,
01108                          current_cvs_process->callbacks->getenv(t->str));
01109         cvs_process_pop ();
01110         break;
01111     }
01112     case GP_CONSOLE:
01113     {
01114         GPT_CONSOLE *t = (GPT_CONSOLE *)msg->data;
01115         if(t->isStderr)
01116             current_cvs_process->callbacks->consoleerr(t->str, t->len);
01117         else
01118             current_cvs_process->callbacks->consoleout(t->str, t->len);
01119         break;
01120     }
01121     }
01122 }

void cvs_process_init ( void )

Definition at line 358 of file cvsgui_process.cpp.

Referenced by _CvsProcess::callbacks(), cvs_process_new(), and main().

00359 {
00360     /* initialize the gimp protocol library and set the read and
00361      *  write handlers.
00362      */
00363     gp_init ();
00364     wire_set_writer (cvs_process_write);
00365     wire_set_flusher (cvs_process_flush);
00366 }

int cvs_process_is_active ( CvsProcess * cvs_process )

Definition at line 985 of file cvsgui_process.cpp.

00986 {
00987     int res;
00988
00989     {
00990         CStackThreadLock locker;
00991
00992         std::vector<CvsProcess *>::iterator i =
00993             std::find(open_cvs_process.begin(), open_cvs_process.end(), cvs_process);
00994         res = i != open_cvs_process.end() ? 1 : 0;
00995     }
00996
00997     return res;
00998 }

void cvs_process_kill ( CvsProcess * cvs_process )

Definition at line 1001 of file cvsgui_process.cpp.

01002 {
01003     if(cvs_process_is_active(cvs_process))
01004     {
01005         cvs_process_destroy(cvs_process);
01006     }
01007 }

CvsProcess * cvs_process_new | ( | char * | path,
 |  | int | argc,
 |  | char ** | argv
 | ) | [static]

Definition at line 369 of file cvsgui_process.cpp.

Referenced by cvs_process_open().

00370 {
00371     CvsProcess *cvs_process;
00372
00373     cvs_process_init();
00374
00375     cvs_process = (CvsProcess *)malloc(sizeof(CvsProcess));
00376     if(cvs_process == 0L)
00377         return 0L;
00378
00379     cvs_process->open = FALSE;
00380     cvs_process->destroy = FALSE;
00381 #ifdef WIN32
00382     cvs_process->starting = TRUE;
00383 #endif
00384     cvs_process->pid = 0;
00385     cvs_process->callbacks = 0L;
00386     cvs_process->argc = argc + 4;
00387     cvs_process->args = (char **)malloc((cvs_process->argc + 1) * sizeof(char *));
00388     cvs_process->args[0] = strdup (path);
00389     cvs_process->args[1] = strdup ("-cvsgui");
00390     cvs_process->args[2] = (char *)malloc(16 * sizeof(char));
00391     cvs_process->args[3] = (char *)malloc(16 * sizeof(char));
00392     for(int i = 0; i < argc; i++)
00393     {
00394         cvs_process->args[4 + i] = strdup(argv[i]);
00395     }
00396     cvs_process->args[cvs_process->argc] = 0L;
00397     cvs_process->my_read = 0;
00398     cvs_process->my_write = 0;
00399     cvs_process->his_read = 0;
00400     cvs_process->his_write = 0;
00401     cvs_process->write_buffer_index = 0;
00402     cvs_process->pstdin = 0;
00403     cvs_process->pstdout = 0;
00404     cvs_process->pstderr = 0;
00405 #ifdef WIN32
00406     memset(cvs_process->threads, 0, sizeof(cvs_process->threads));
00407     memset(cvs_process->threadsID, 0, sizeof(cvs_process->threadsID));
00408 #endif
00409
00410     return cvs_process;
00411 }

CvsProcess* cvs_process_open | ( | char * | name,
 |  | int | argc,
 |  | char ** | argv,
 |  | CvsProcessCallbacks * | callbacks,
 |  | int | hasTty,
 |  | const char * | currentDirectory
 | ) |

Definition at line 609 of file cvsgui_process.cpp.

00610 {
00611     CvsProcess *cvs_process = cvs_process_new(name, argc, argv);
00612
00613     if (!cvs_process)
00614         return 0L;
00615
00616     cvs_process->callbacks = callbacks;
00617
00618 #ifndef WIN32
00619     int my_read[2];
00620     int my_write[2];
00621
00622     /* Open two pipes. (Bidirectional communication).
00623          */
00624     if ((pipe (my_read) == -1) || (pipe (my_write) == -1))
00625     {
00626         fprintf(stderr, "unable to open pipe\n");
00627         cvs_process_destroy (cvs_process);
00628         return 0L;
00629     }
00630
00631     cvs_process->my_read = my_read[0];
00632     cvs_process->my_write = my_write[1];
00633     cvs_process->his_read = my_write[0];
00634     cvs_process->his_write = my_read[1];
00635
00636     /* Remember the file descriptors for the pipes.
00637          */
00638     sprintf (cvs_process->args[2], "%d", cvs_process->his_read);
00639     sprintf (cvs_process->args[3], "%d", cvs_process->his_write);
00640
00641         /* Fork another process. We'll remember the process id
00642          *  so that we can later use it to kill the filter if
00643          *  necessary.
00644          */
00645     cvs_process->pid = fork ();
00646
00647     if (cvs_process->pid == 0)
00648     {
00649         close(cvs_process->my_read);
00650         close(cvs_process->my_write);
00651         /* Execute the filter. The "_exit" call should never
00652          *  be reached, unless some strange error condition
00653          *  exists.
00654          */
00655         execvp (cvs_process->args[0], cvs_process->args);
00656         _exit (1);
00657     }
00658     else if (cvs_process->pid == -1)
00659     {
00660         cvs_process_destroy (cvs_process);
00661         return 0L;
00662     }
00663
00664     close(cvs_process->his_read);  cvs_process->his_read  = -1;
00665     close(cvs_process->his_write); cvs_process->his_write = -1;
00666 #else
00667     SECURITY_ATTRIBUTES lsa;
00668     STARTUPINFO         si;
00669     PROCESS_INFORMATION pi;
00670
00671     HANDLE dupIn = 0L, dupOut = 0L;
00672     HANDLE stdChildIn = 0L, stdChildOut = 0L, stdChildErr = 0L;
00673     HANDLE stdoldIn = 0L, stdoldOut = 0L, stdoldErr = 0L;
00674     HANDLE stddupIn = 0L, stddupOut = 0L, stddupErr = 0L;
00675     char *command = 0L;
00676     BOOL resCreate;
00677     int cnt, i;
00678     LPTHREAD_START_ROUTINE threadsFunc[4];
00679
00680     lsa.nLength=sizeof(SECURITY_ATTRIBUTES);
00681     lsa.lpSecurityDescriptor=NULL;
00682     lsa.bInheritHandle=TRUE;
00683
00684     // create the pipes used for the cvsgui protocol
00685     if (!CreatePipe(&cvs_process->his_read,&dupIn,&lsa,0))
00686         goto error;
00687     if (!CreatePipe(&dupOut,&cvs_process->his_write,&lsa,0))
00688         goto error;
00689
00690     // duplicate the App side handles so they lose the inheritance
00691     if(!DuplicateHandle(GetCurrentProcess(), dupIn,
00692         GetCurrentProcess(), &cvs_process->my_write, 0, FALSE, DUPLICATE_SAME_ACCESS))
00693             goto error;
00694     CloseHandle(dupIn);
00695     dupIn = 0;
00696     if(!DuplicateHandle(GetCurrentProcess(), dupOut,
00697         GetCurrentProcess(), &cvs_process->my_read, 0, FALSE, DUPLICATE_SAME_ACCESS))
00698             goto error;
00699     CloseHandle(dupOut);
00700     dupOut = 0;
00701
00702     if(!hasTty)
00703     {
00704         // redirect stdout, stderr, stdin
00705         if (!CreatePipe(&stdChildIn,&stddupIn,&lsa,0))
00706             goto error;
00707         if (!CreatePipe(&stddupOut,&stdChildOut,&lsa,0))
00708             goto error;
00709         if (!CreatePipe(&stddupErr,&stdChildErr, &lsa,0))
00710             goto error;
00711
00712         // same thing as above
00713         if(!DuplicateHandle(GetCurrentProcess(), stddupIn,
00714             GetCurrentProcess(), &cvs_process->pstdin, 0, FALSE, DUPLICATE_SAME_ACCESS))
00715                 goto error;
00716         CloseHandle(stddupIn);
00717         stddupIn = 0;
00718         if(!DuplicateHandle(GetCurrentProcess(), stddupOut,
00719             GetCurrentProcess(), &cvs_process->pstdout, 0, FALSE, DUPLICATE_SAME_ACCESS))
00720                 goto error;
00721         CloseHandle(stddupOut);
00722         stddupOut = 0;
00723         if(!DuplicateHandle(GetCurrentProcess(), stddupErr,
00724             GetCurrentProcess(), &cvs_process->pstderr, 0, FALSE, DUPLICATE_SAME_ACCESS))
00725                 goto error;
00726         CloseHandle(stddupErr);
00727         stddupErr = 0;
00728     }
00729
00730     // Build the arguments for cvs
00731     sprintf (cvs_process->args[2], "%d", cvs_process->his_read);
00732     sprintf (cvs_process->args[3], "%d", cvs_process->his_write);
00733
00734     command = build_command(cvs_process->argc, cvs_process->args);
00735     if(command == 0L)
00736         goto error;
00737
00738     // Lets Redirect Console StdHandles and set the start options
00739     memset(&si,0,sizeof(STARTUPINFO));
00740     si.cb=sizeof(STARTUPINFO);
00741     si.dwFlags=hasTty ? 0 : STARTF_USESTDHANDLES;
00742     si.hStdInput =stdChildIn;
00743     si.hStdOutput=stdChildOut;
00744     si.hStdError =stdChildErr;
00745     if(!hasTty)
00746     {
00747         si.dwFlags|=STARTF_USESHOWWINDOW;
00748         si.wShowWindow = SW_SHOWMINNOACTIVE;
00749     }
00750
00751     if(!hasTty)
00752     {
00753         stdoldIn = GetStdHandle(STD_INPUT_HANDLE);
00754         stdoldOut = GetStdHandle(STD_OUTPUT_HANDLE);
00755         stdoldErr = GetStdHandle(STD_ERROR_HANDLE);
00756         SetStdHandle(STD_INPUT_HANDLE, stdChildIn);
00757         SetStdHandle(STD_OUTPUT_HANDLE, stdChildOut);
00758         SetStdHandle(STD_ERROR_HANDLE, stdChildErr);
00759     }
00760
00761     //Create Child Process
00762     resCreate = CreateProcess
00763          (
00764             NULL,
00765             command,
00766             NULL,
00767             NULL,
00768             TRUE,
00769             NORMAL_PRIORITY_CLASS,
00770             NULL,
00771             currentDirectory,
00772             &si,
00773             &pi);
00774
00775     if(!hasTty)
00776     {
00777         SetStdHandle(STD_INPUT_HANDLE, stdoldIn);
00778         SetStdHandle(STD_OUTPUT_HANDLE, stdoldOut);
00779         SetStdHandle(STD_ERROR_HANDLE, stdoldErr);
00780     }
00781
00782     if(!resCreate)
00783         goto error;
00784
00785     cvs_process->pid = pi.hProcess;
00786
00787     cnt = 0;
00788
00789     // now open-up threads which will serve the pipes
00790     threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)ServeProtocol;
00791     threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)WaitChld;
00792     if(!hasTty)
00793     {
00794         threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)GetChldOutput;
00795         threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)GetChldError;
00796     }
00797
00798     for(i = 0; i < cnt; i++)
00799     {
00800         if ((cvs_process->threads[i]=::CreateThread
00801                       (
00802                          (LPSECURITY_ATTRIBUTES)NULL,           // No security attributes.
00803                          (DWORD)0,                              // Use same stack size.
00804                          (LPTHREAD_START_ROUTINE)threadsFunc[i], // Thread procedure.
00805                          (LPVOID)cvs_process,                   // Parameter to pass.
00806                          (DWORD)0,                              // Run immediately.
00807                          (LPDWORD)&cvs_process->threadsID[i])
00808                       )==NULL)
00809         {
00810             TerminateProcess(cvs_process->pid,0);
00811             goto error;
00812         }
00813     }
00814
00815     //Close unneccesary Handles
00816     CloseHandle(cvs_process->his_read);
00817     cvs_process->his_read = 0;
00818     CloseHandle(cvs_process->his_write);
00819     cvs_process->his_write = 0;
00820
00821     if(!hasTty)
00822     {
00823         CloseHandle(stdChildIn);
00824         CloseHandle(stdChildOut);
00825         CloseHandle(stdChildErr);
00826     }
00827
00828     CloseHandle(pi.hThread);
00829
00830     free(command);
00831
00832     goto goodboy;
00833
00834 error:
00835     if(cvs_process->his_read != 0L)
00836         CloseHandle(cvs_process->his_read);
00837     if(cvs_process->his_write != 0L)
00838         CloseHandle(cvs_process->his_write);
00839     if(dupIn != 0L)
00840         CloseHandle(dupIn);
00841     if(dupOut != 0L)
00842         CloseHandle(dupOut);
00843     if(cvs_process->my_read != 0L)
00844         CloseHandle(cvs_process->my_read);
00845     if(cvs_process->my_write != 0L)
00846         CloseHandle(cvs_process->my_write);
00847     if(command != 0L)
00848         free(command);
00849     if(stdChildIn != 0L)
00850         CloseHandle(stdChildIn);
00851     if(stdChildOut != 0L)
00852         CloseHandle(stdChildOut);
00853     if(stdChildErr != 0L)
00854         CloseHandle(stdChildErr);
00855     if(stddupIn != 0L)
00856         CloseHandle(stddupIn);
00857     if(stddupOut != 0L)
00858         CloseHandle(stddupOut);
00859     if(stddupErr != 0L)
00860         CloseHandle(stddupErr);
00861     if(cvs_process->pstdin != 0L)
00862         CloseHandle(cvs_process->pstdin);
00863     if(cvs_process->pstdout != 0L)
00864         CloseHandle(cvs_process->pstdout);
00865     if(cvs_process->pstderr != 0L)
00866         CloseHandle(cvs_process->pstderr);
00867
00868     cvs_process_destroy (cvs_process);
00869     return 0L;
00870
00871 goodboy:
00872 #endif
00873
00874     {
00875         CStackThreadLock locker;
00876
00877         open_cvs_process.push_back(cvs_process);
00878     }
00879
00880     cvs_process->open = TRUE;
00881 #ifdef WIN32
00882     cvs_process->starting = FALSE;
00883 #endif
00884
00885     return cvs_process;
00886 }

void cvs_process_pop ( void ) [static]

Definition at line 1208 of file cvsgui_process.cpp.

Referenced by cvs_process_destroy(), cvs_process_handle_message(), and cvs_process_recv_message().

01209 {
01210     CStackThreadLock locker;
01211
01212     if (current_cvs_process)
01213     {
01214         current_cvs_process->write_buffer_index = current_write_buffer_index;
01215
01216         cvs_process_stack.pop_back();
01217     }
01218
01219     if (!cvs_process_stack.empty())
01220     {
01221         current_cvs_process = cvs_process_stack.back();
01222         current_write_buffer_index = current_cvs_process->write_buffer_index;
01223         current_write_buffer = current_cvs_process->write_buffer;
01224     }
01225     else
01226     {
01227         current_cvs_process = NULL;
01228         current_write_buffer_index = 0;
01229         current_write_buffer = NULL;
01230     }
01231 }

void cvs_process_push ( CvsProcess * cvs_process ) [static]

Definition at line 1187 of file cvsgui_process.cpp.

Referenced by cvs_process_handle_message(), and cvs_process_recv_message().

01188 {
01189     CStackThreadLock locker;
01190
01191     if (cvs_process)
01192     {
01193         current_cvs_process = cvs_process;
01194
01195         cvs_process_stack.push_back(current_cvs_process);
01196
01197         current_write_buffer_index = current_cvs_process->write_buffer_index;
01198         current_write_buffer = current_cvs_process->write_buffer;
01199     }
01200     else
01201     {
01202         current_write_buffer_index = 0;
01203         current_write_buffer = NULL;
01204     }
01205 }

void cvs_process_recv_message ( CvsProcess * p ) [static]

Definition at line 1061 of file cvsgui_process.cpp.

Referenced by cvs_process_give_time().

01062 {
01063     WireMessage msg;
01064
01065     cvs_process_push (p);
01066
01067     memset (&msg, 0, sizeof (WireMessage));
01068     if (!wire_read_msg (p->my_read, &msg))
01069     {
01070         cvs_process_close (p, TRUE);
01071     }
01072     else
01073     {
01074         cvs_process_handle_message (&msg);
01075         wire_destroy (&msg);
01076     }
01077
01078     if(cvs_process_is_active(current_cvs_process))
01079     {
01080         if (!current_cvs_process->open)
01081         {
01082 #ifndef WIN32
01083             cvs_process_destroy (current_cvs_process);
01084 #endif
01085         }
01086         else
01087             cvs_process_pop ();
01088     }
01089 }

int cvs_process_write | ( | pipe_t | fd,
 |  | guint8 * | buf,
 |  | gulong | count
 | ) | [static]

Definition at line 1125 of file cvsgui_process.cpp.

01128 {
01129     gulong bytes;
01130
01131     if(current_write_buffer == 0L)
01132         current_write_buffer = process_write_buffer;
01133
01134     while (count > 0)
01135     {
01136         if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE)
01137         {
01138             bytes = WRITE_BUFFER_SIZE - current_write_buffer_index;
01139             memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes);
01140             current_write_buffer_index += bytes;
01141             if (!wire_flush (fd))
01142                 return FALSE;
01143         }
01144         else
01145         {
01146             bytes = count;
01147             memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes);
01148             current_write_buffer_index += bytes;
01149         }
01150
01151         buf += bytes;
01152         count -= bytes;
01153     }
01154
01155     return TRUE;
01156 }

int gp_console_write | ( | pipe_t | fd,
 |  | const char * | str,
 |  | int | len,
 |  | int | isStderr
 | ) |

Definition at line 336 of file cvsgui_process.cpp.

00337 {
00338     WireMessage msg;
00339     GPT_CONSOLE *t = (GPT_CONSOLE *)malloc(sizeof(GPT_CONSOLE));
00340
00341     msg.type = GP_CONSOLE;
00342     msg.data = t;
00343
00344     t->isStderr = isStderr;
00345     t->len = len;
00346     t->str = (char *)malloc((len + 1) * sizeof(char));
00347     memcpy(t->str, str, len * sizeof(char));
00348     t->str[len] = '\0';
00349
00350     if (!wire_write_msg (fd, &msg))
00351         return FALSE;
00352     if (!wire_flush (fd))
00353         return FALSE;
00354     return TRUE;
00355 }

char* gp_getenv_read ( pipe_t fd )

Definition at line 315 of file cvsgui_process.cpp.

00316 {
00317     WireMessage msg;
00318     char *res;
00319
00320     memset (&msg, 0, sizeof (WireMessage));
00321     if (!wire_read_msg (fd, &msg) || msg.type != GP_GETENV)
00322     {
00323         fprintf(stderr, "cvsgui protocol error !\n");
00324         exit(-1);
00325     }
00326     GPT_GETENV *t = (GPT_GETENV *)msg.data;
00327     res = t->empty ? 0L : strdup(t->str);
00328     wire_destroy (&msg);
00329
00330     return res;
00331 }

int gp_getenv_write | ( | pipe_t | fd,
 |  | const char * | env
 | ) |

Definition at line 295 of file cvsgui_process.cpp.

00296 {
00297     WireMessage msg;
00298     GPT_GETENV *t = (GPT_GETENV *)malloc(sizeof(GPT_GETENV));
00299
00300     msg.type = GP_GETENV;
00301     msg.data = t;
00302
00303     t->empty = env == 0L;
00304     t->str = strdup(env == 0L ? "" : env);
00305
00306     if (!wire_write_msg (fd, &msg))
00307         return FALSE;
00308     wire_destroy (&msg);
00309     if (!wire_flush (fd))
00310         return FALSE;
00311     return TRUE;
00312 }

void gp_init ( )

Definition at line 259 of file cvsgui_process.cpp.

Referenced by cvs_process_init().

00260 {
00261     wire_register (GP_QUIT,
00262                    _gp_quit_read,
00263                    _gp_quit_write,
00264                    _gp_quit_destroy);
00265     wire_register (GP_GETENV,
00266                    _gp_getenv_read,
00267                    _gp_getenv_write,
00268                    _gp_getenv_destroy);
00269     wire_register (GP_CONSOLE,
00270                    _gp_console_read,
00271                    _gp_console_write,
00272                    _gp_console_destroy);
00273 }

int gp_quit_write | ( | pipe_t | fd,
 |  | int | code
 | ) |

Definition at line 276 of file cvsgui_process.cpp.

00277 {
00278     WireMessage msg;
00279     GPT_QUIT *t = (GPT_QUIT *)malloc(sizeof(GPT_QUIT));
00280
00281     msg.type = GP_QUIT;
00282     msg.data = t;
00283
00284     t->code = code;
00285
00286     if (!wire_write_msg (fd, &msg))
00287         return FALSE;
00288     if (!wire_flush (fd))
00289         return FALSE;
00290
00291     return TRUE;
00292 }

Variable Documentation

CvsProcess* current_cvs_process = NULL [static]

Definition at line 69 of file cvsgui_process.cpp.

char* current_write_buffer = NULL [static]

Definition at line 71 of file cvsgui_process.cpp.

int current_write_buffer_index = 0 [static]

Definition at line 70 of file cvsgui_process.cpp.

std::deque<CvsProcess *> cvs_process_stack [static]

Definition at line 67 of file cvsgui_process.cpp.

std::vector<CvsProcess *> open_cvs_process [static]

Definition at line 68 of file cvsgui_process.cpp.

char process_write_buffer[ 512 ] [static]

Definition at line 73 of file cvsgui_process.cpp.

Generated on Sun Oct 21 12:42:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvsgui_process.h File Reference

common/cvsgui_process.h File Reference

#include <sys/types.h>
#include "cvsgui_wire.h"

Include dependency graph for cvsgui_process.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | _CvsProcess
struct | CvsProcessCallbacks

Defines

#define | WRITE_BUFFER_SIZE 512

Typedefs

typedef _CvsProcess | CvsProcess

Functions

CvsProcess * | cvs_process_open (char *name, int argc, char **argv, CvsProcessCallbacks *callbacks, int hasTty, const char *currentDirectory)
void | cvs_process_kill (CvsProcess *cvs_process)
void | cvs_process_init (void)
void | cvs_process_give_time (void)
int | cvs_process_is_active (CvsProcess *cvs_process)

Define Documentation

#define WRITE_BUFFER_SIZE 512

Definition at line 30 of file cvsgui_process.h.

Typedef Documentation

typedef struct _CvsProcess CvsProcess

Definition at line 32 of file cvsgui_process.h.

Function Documentation

void cvs_process_give_time ( void )

Definition at line 1010 of file cvsgui_process.cpp.

01011 {
01012 #ifndef WIN32
01013     fd_set rset;
01014     int ready;
01015     int maxfd = 0;
01016     int fd;
01017     struct timeval tv;
01018
01019     FD_ZERO (&rset);
01020
01021     std::vector<CvsProcess *>::iterator i;
01022
01023     for (i = open_cvs_process.begin(); i != open_cvs_process.end(); ++i)
01024     {
01025         fd = (*i)->my_read;
01026
01027         FD_SET (fd, &rset);
01028         if (fd > maxfd)
01029             maxfd = fd;
01030     }
01031
01032     tv.tv_sec = 0;
01033     tv.tv_usec = 100000;
01034     ready = select (maxfd + 1, &rset, 0L, 0L, &tv);
01035
01036     std::vector<CvsProcess *> toFire;
01037     if (ready > 0)
01038     {
01039         for (i = open_cvs_process.begin(); i != open_cvs_process.end(); ++i)
01040         {
01041             fd = (*i)->my_read;
01042
01043             if (FD_ISSET (fd, &rset))
01044                 toFire.push_back(*i);
01045         }
01046     }
01047
01048     for (i = toFire.begin(); i != toFire.end(); ++i)
01049     {
01050         fd = (*i)->my_read;
01051
01052         if (FD_ISSET (fd, &rset))
01053             cvs_process_recv_message (*i);
01054     }
01055 #else
01056     // we don't have to do yield since we use preemptive threads
01057 #endif
01058 }

void cvs_process_init ( void )

Definition at line 358 of file cvsgui_process.cpp.

00359 {
00360     /* initialize the gimp protocol library and set the read and
00361      *  write handlers.
00362      */
00363     gp_init ();
00364     wire_set_writer (cvs_process_write);
00365     wire_set_flusher (cvs_process_flush);
00366 }

int cvs_process_is_active ( CvsProcess * cvs_process )

Definition at line 985 of file cvsgui_process.cpp.

Referenced by CWincvsApp::IdleCvsProgress(), UCvsFrame::OnCmdStopcvs(), UCvsApp::OnMainTimer(), _CvsProcess::callbacks(), cvs_process_kill(), cvs_process_recv_message(), and launchCVS().

00986 {
00987     int res;
00988
00989     {
00990         CStackThreadLock locker;
00991
00992         std::vector<CvsProcess *>::iterator i =
00993             std::find(open_cvs_process.begin(), open_cvs_process.end(), cvs_process);
00994         res = i != open_cvs_process.end() ? 1 : 0;
00995     }
00996
00997     return res;
00998 }

void cvs_process_kill ( CvsProcess * cvs_process )

Definition at line 1001 of file cvsgui_process.cpp.

Referenced by UCvsFrame::OnCmdStopcvs(), CWincvsDoc::OnStopcvs(), and _CvsProcess::callbacks().

01002 {
01003     if(cvs_process_is_active(cvs_process))
01004     {
01005         cvs_process_destroy(cvs_process);
01006     }
01007 }

CvsProcess* cvs_process_open | ( | char * | name,
 |  | int | argc,
 |  | char ** | argv,
 |  | CvsProcessCallbacks * | callbacks,
 |  | int | hasTty,
 |  | const char * | currentDirectory
 | ) |

Definition at line 609 of file cvsgui_process.cpp.

Referenced by _CvsProcess::callbacks(), and launchCVS().

00610 {
00611     CvsProcess *cvs_process = cvs_process_new(name, argc, argv);
00612
00613     if (!cvs_process)
00614         return 0L;
00615
00616     cvs_process->callbacks = callbacks;
00617
00618 #ifndef WIN32
00619     int my_read[2];
00620     int my_write[2];
00621
00622     /* Open two pipes. (Bidirectional communication).
00623          */
00624     if ((pipe (my_read) == -1) || (pipe (my_write) == -1))
00625     {
00626         fprintf(stderr, "unable to open pipe\n");
00627         cvs_process_destroy (cvs_process);
00628         return 0L;
00629     }
00630
00631     cvs_process->my_read = my_read[0];
00632     cvs_process->my_write = my_write[1];
00633     cvs_process->his_read = my_write[0];
00634     cvs_process->his_write = my_read[1];
00635
00636     /* Remember the file descriptors for the pipes.
00637          */
00638     sprintf (cvs_process->args[2], "%d", cvs_process->his_read);
00639     sprintf (cvs_process->args[3], "%d", cvs_process->his_write);
00640
00641         /* Fork another process. We'll remember the process id
00642          *  so that we can later use it to kill the filter if
00643          *  necessary.
00644          */
00645     cvs_process->pid = fork ();
00646
00647     if (cvs_process->pid == 0)
00648     {
00649         close(cvs_process->my_read);
00650         close(cvs_process->my_write);
00651         /* Execute the filter. The "_exit" call should never
00652          *  be reached, unless some strange error condition
00653          *  exists.
00654          */
00655         execvp (cvs_process->args[0], cvs_process->args);
00656         _exit (1);
00657     }
00658     else if (cvs_process->pid == -1)
00659     {
00660         cvs_process_destroy (cvs_process);
00661         return 0L;
00662     }
00663
00664     close(cvs_process->his_read);  cvs_process->his_read  = -1;
00665     close(cvs_process->his_write); cvs_process->his_write = -1;
00666 #else
00667     SECURITY_ATTRIBUTES lsa;
00668     STARTUPINFO         si;
00669     PROCESS_INFORMATION pi;
00670
00671     HANDLE dupIn = 0L, dupOut = 0L;
00672     HANDLE stdChildIn = 0L, stdChildOut = 0L, stdChildErr = 0L;
00673     HANDLE stdoldIn = 0L, stdoldOut = 0L, stdoldErr = 0L;
00674     HANDLE stddupIn = 0L, stddupOut = 0L, stddupErr = 0L;
00675     char *command = 0L;
00676     BOOL resCreate;
00677     int cnt, i;
00678     LPTHREAD_START_ROUTINE threadsFunc[4];
00679
00680     lsa.nLength=sizeof(SECURITY_ATTRIBUTES);
00681     lsa.lpSecurityDescriptor=NULL;
00682     lsa.bInheritHandle=TRUE;
00683
00684     // create the pipes used for the cvsgui protocol
00685     if (!CreatePipe(&cvs_process->his_read,&dupIn,&lsa,0))
00686         goto error;
00687     if (!CreatePipe(&dupOut,&cvs_process->his_write,&lsa,0))
00688         goto error;
00689
00690     // duplicate the App side handles so they lose the inheritance
00691     if(!DuplicateHandle(GetCurrentProcess(), dupIn,
00692         GetCurrentProcess(), &cvs_process->my_write, 0, FALSE, DUPLICATE_SAME_ACCESS))
00693             goto error;
00694     CloseHandle(dupIn);
00695     dupIn = 0;
00696     if(!DuplicateHandle(GetCurrentProcess(), dupOut,
00697         GetCurrentProcess(), &cvs_process->my_read, 0, FALSE, DUPLICATE_SAME_ACCESS))
00698             goto error;
00699     CloseHandle(dupOut);
00700     dupOut = 0;
00701
00702     if(!hasTty)
00703     {
00704         // redirect stdout, stderr, stdin
00705         if (!CreatePipe(&stdChildIn,&stddupIn,&lsa,0))
00706             goto error;
00707         if (!CreatePipe(&stddupOut,&stdChildOut,&lsa,0))
00708             goto error;
00709         if (!CreatePipe(&stddupErr,&stdChildErr, &lsa,0))
00710             goto error;
00711
00712         // same thing as above
00713         if(!DuplicateHandle(GetCurrentProcess(), stddupIn,
00714             GetCurrentProcess(), &cvs_process->pstdin, 0, FALSE, DUPLICATE_SAME_ACCESS))
00715                 goto error;
00716         CloseHandle(stddupIn);
00717         stddupIn = 0;
00718         if(!DuplicateHandle(GetCurrentProcess(), stddupOut,
00719             GetCurrentProcess(), &cvs_process->pstdout, 0, FALSE, DUPLICATE_SAME_ACCESS))
00720                 goto error;
00721         CloseHandle(stddupOut);
00722         stddupOut = 0;
00723         if(!DuplicateHandle(GetCurrentProcess(), stddupErr,
00724             GetCurrentProcess(), &cvs_process->pstderr, 0, FALSE, DUPLICATE_SAME_ACCESS))
00725                 goto error;
00726         CloseHandle(stddupErr);
00727         stddupErr = 0;
00728     }
00729
00730     // Build the arguments for cvs
00731     sprintf (cvs_process->args[2], "%d", cvs_process->his_read);
00732     sprintf (cvs_process->args[3], "%d", cvs_process->his_write);
00733
00734     command = build_command(cvs_process->argc, cvs_process->args);
00735     if(command == 0L)
00736         goto error;
00737
00738     // Lets Redirect Console StdHandles and set the start options
00739     memset(&si,0,sizeof(STARTUPINFO));
00740     si.cb=sizeof(STARTUPINFO);
00741     si.dwFlags=hasTty ? 0 : STARTF_USESTDHANDLES;
00742     si.hStdInput =stdChildIn;
00743     si.hStdOutput=stdChildOut;
00744     si.hStdError =stdChildErr;
00745     if(!hasTty)
00746     {
00747         si.dwFlags|=STARTF_USESHOWWINDOW;
00748         si.wShowWindow = SW_SHOWMINNOACTIVE;
00749     }
00750
00751     if(!hasTty)
00752     {
00753         stdoldIn = GetStdHandle(STD_INPUT_HANDLE);
00754         stdoldOut = GetStdHandle(STD_OUTPUT_HANDLE);
00755         stdoldErr = GetStdHandle(STD_ERROR_HANDLE);
00756         SetStdHandle(STD_INPUT_HANDLE, stdChildIn);
00757         SetStdHandle(STD_OUTPUT_HANDLE, stdChildOut);
00758         SetStdHandle(STD_ERROR_HANDLE, stdChildErr);
00759     }
00760
00761     //Create Child Process
00762     resCreate = CreateProcess
00763          (
00764             NULL,
00765             command,
00766             NULL,
00767             NULL,
00768             TRUE,
00769             NORMAL_PRIORITY_CLASS,
00770             NULL,
00771             currentDirectory,
00772             &si,
00773             &pi);
00774
00775     if(!hasTty)
00776     {
00777         SetStdHandle(STD_INPUT_HANDLE, stdoldIn);
00778         SetStdHandle(STD_OUTPUT_HANDLE, stdoldOut);
00779         SetStdHandle(STD_ERROR_HANDLE, stdoldErr);
00780     }
00781
00782     if(!resCreate)
00783         goto error;
00784
00785     cvs_process->pid = pi.hProcess;
00786
00787     cnt = 0;
00788
00789     // now open-up threads which will serve the pipes
00790     threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)ServeProtocol;
00791     threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)WaitChld;
00792     if(!hasTty)
00793     {
00794         threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)GetChldOutput;
00795         threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)GetChldError;
00796     }
00797
00798     for(i = 0; i < cnt; i++)
00799     {
00800         if ((cvs_process->threads[i]=::CreateThread
00801                       (
00802                          (LPSECURITY_ATTRIBUTES)NULL,           // No security attributes.
00803                          (DWORD)0,                              // Use same stack size.
00804                          (LPTHREAD_START_ROUTINE)threadsFunc[i], // Thread procedure.
00805                          (LPVOID)cvs_process,                   // Parameter to pass.
00806                          (DWORD)0,                              // Run immediately.
00807                          (LPDWORD)&cvs_process->threadsID[i])
00808                       )==NULL)
00809         {
00810             TerminateProcess(cvs_process->pid,0);
00811             goto error;
00812         }
00813     }
00814
00815     //Close unneccesary Handles
00816     CloseHandle(cvs_process->his_read);
00817     cvs_process->his_read = 0;
00818     CloseHandle(cvs_process->his_write);
00819     cvs_process->his_write = 0;
00820
00821     if(!hasTty)
00822     {
00823         CloseHandle(stdChildIn);
00824         CloseHandle(stdChildOut);
00825         CloseHandle(stdChildErr);
00826     }
00827
00828     CloseHandle(pi.hThread);
00829
00830     free(command);
00831
00832     goto goodboy;
00833
00834 error:
00835     if(cvs_process->his_read != 0L)
00836         CloseHandle(cvs_process->his_read);
00837     if(cvs_process->his_write != 0L)
00838         CloseHandle(cvs_process->his_write);
00839     if(dupIn != 0L)
00840         CloseHandle(dupIn);
00841     if(dupOut != 0L)
00842         CloseHandle(dupOut);
00843     if(cvs_process->my_read != 0L)
00844         CloseHandle(cvs_process->my_read);
00845     if(cvs_process->my_write != 0L)
00846         CloseHandle(cvs_process->my_write);
00847     if(command != 0L)
00848         free(command);
00849     if(stdChildIn != 0L)
00850         CloseHandle(stdChildIn);
00851     if(stdChildOut != 0L)
00852         CloseHandle(stdChildOut);
00853     if(stdChildErr != 0L)
00854         CloseHandle(stdChildErr);
00855     if(stddupIn != 0L)
00856         CloseHandle(stddupIn);
00857     if(stddupOut != 0L)
00858         CloseHandle(stddupOut);
00859     if(stddupErr != 0L)
00860         CloseHandle(stddupErr);
00861     if(cvs_process->pstdin != 0L)
00862         CloseHandle(cvs_process->pstdin);
00863     if(cvs_process->pstdout != 0L)
00864         CloseHandle(cvs_process->pstdout);
00865     if(cvs_process->pstderr != 0L)
00866         CloseHandle(cvs_process->pstderr);
00867
00868     cvs_process_destroy (cvs_process);
00869     return 0L;
00870
00871 goodboy:
00872 #endif
00873
00874     {
00875         CStackThreadLock locker;
00876
00877         open_cvs_process.push_back(cvs_process);
00878     }
00879
00880     cvs_process->open = TRUE;
00881 #ifdef WIN32
00882     cvs_process->starting = FALSE;
00883 #endif
00884
00885     return cvs_process;
00886 }

Generated on Sun Oct 21 12:42:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvsgui_protocol.h File Reference

common/cvsgui_protocol.h File Reference

#include "cvsgui_wire.h"

Include dependency graph for cvsgui_protocol.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | GPT_CONSOLE
struct | GPT_GETENV
struct | GPT_QUIT

Enumerations

enum | { GP_QUIT, GP_GETENV, GP_CONSOLE }

Functions

int | gp_quit_write (pipe_t fd, int code)
int | gp_getenv_write (pipe_t fd, const char *env)
int | gp_console_write (pipe_t fd, const char *str, int len, int isStderr)
char * | gp_getenv_read (pipe_t fd)

Variables

pipe_t _cvsgui_readfd
pipe_t _cvsgui_writefd

Enumeration Type Documentation

anonymous enum

Enumeration values:
GP_QUIT
GP_GETENV
GP_CONSOLE

Definition at line 29 of file cvsgui_protocol.h.

00029      {
00030     GP_QUIT,
00031     GP_GETENV,
00032     GP_CONSOLE
00033 };

Function Documentation

int gp_console_write | ( | pipe_t | fd,
 |  | const char * | str,
 |  | int | len,
 |  | int | isStderr
 | ) |

Definition at line 336 of file cvsgui_process.cpp.

Referenced by myflush().

00337 {
00338     WireMessage msg;
00339     GPT_CONSOLE *t = (GPT_CONSOLE *)malloc(sizeof(GPT_CONSOLE));
00340
00341     msg.type = GP_CONSOLE;
00342     msg.data = t;
00343
00344     t->isStderr = isStderr;
00345     t->len = len;
00346     t->str = (char *)malloc((len + 1) * sizeof(char));
00347     memcpy(t->str, str, len * sizeof(char));
00348     t->str[len] = '\0';
00349
00350     if (!wire_write_msg (fd, &msg))
00351         return FALSE;
00352     if (!wire_flush (fd))
00353         return FALSE;
00354     return TRUE;
00355 }

char* gp_getenv_read ( pipe_t fd )

Definition at line 315 of file cvsgui_process.cpp.

Referenced by cvsguiglue_getenv().

00316 {
00317     WireMessage msg;
00318     char *res;
00319
00320     memset (&msg, 0, sizeof (WireMessage));
00321     if (!wire_read_msg (fd, &msg) || msg.type != GP_GETENV)
00322     {
00323         fprintf(stderr, "cvsgui protocol error !\n");
00324         exit(-1);
00325     }
00326     GPT_GETENV *t = (GPT_GETENV *)msg.data;
00327     res = t->empty ? 0L : strdup(t->str);
00328     wire_destroy (&msg);
00329
00330     return res;
00331 }

int gp_getenv_write | ( | pipe_t | fd,
 |  | const char * | env
 | ) |

Definition at line 295 of file cvsgui_process.cpp.

Referenced by cvs_process_handle_message(), and cvsguiglue_getenv().

00296 {
00297     WireMessage msg;
00298     GPT_GETENV *t = (GPT_GETENV *)malloc(sizeof(GPT_GETENV));
00299
00300     msg.type = GP_GETENV;
00301     msg.data = t;
00302
00303     t->empty = env == 0L;
00304     t->str = strdup(env == 0L ? "" : env);
00305
00306     if (!wire_write_msg (fd, &msg))
00307         return FALSE;
00308     wire_destroy (&msg);
00309     if (!wire_flush (fd))
00310         return FALSE;
00311     return TRUE;
00312 }

int gp_quit_write | ( | pipe_t | fd,
 |  | int | code
 | ) |

Definition at line 276 of file cvsgui_process.cpp.

Referenced by cvsguiglue_exit(), and main().

00277 {
00278     WireMessage msg;
00279     GPT_QUIT *t = (GPT_QUIT *)malloc(sizeof(GPT_QUIT));
00280
00281     msg.type = GP_QUIT;
00282     msg.data = t;
00283
00284     t->code = code;
00285
00286     if (!wire_write_msg (fd, &msg))
00287         return FALSE;
00288     if (!wire_flush (fd))
00289         return FALSE;
00290
00291     return TRUE;
00292 }

Variable Documentation

pipe_t _cvsgui_readfd

Definition at line 62 of file cvsgui_protocol.h.

pipe_t _cvsgui_writefd

Definition at line 63 of file cvsgui_protocol.h.

Generated on Sun Oct 21 12:42:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvsgui_wire.cpp File Reference

common/cvsgui_wire.cpp File Reference

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "cvsgui_wire.h"
#include <unistd.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <map>

Include dependency graph for cvsgui_wire.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

struct | _WireHandler
struct | CAllHandlers

Typedefs

typedef _WireHandler | WireHandler

Functions

void | wire_register (guint32 type, WireReadFunc read_func, WireWriteFunc write_func, WireDestroyFunc destroy_func)
void | wire_set_reader (WireIOFunc read_func)
void | wire_set_writer (WireIOFunc write_func)
void | wire_set_flusher (WireFlushFunc flush_func)
int | wire_read (pipe_t fd, guint8 *buf, gulong count)
int | wire_write (pipe_t fd, guint8 *buf, gulong count)
int | wire_flush (pipe_t fd)
int | wire_error ()
void | wire_clear_error ()
int | wire_read_msg (pipe_t fd, WireMessage *msg)
int | wire_write_msg (pipe_t fd, WireMessage *msg)
void | wire_destroy (WireMessage *msg)
int | wire_read_int32 (pipe_t fd, guint32 *data, gint count)
int | wire_read_int16 (pipe_t fd, guint16 *data, gint count)
int | wire_read_int8 (pipe_t fd, guint8 *data, gint count)
int | wire_read_double (pipe_t fd, gdouble *data, gint count)
int | wire_read_string (pipe_t fd, gchar **data, gint count)
int | wire_write_int32 (pipe_t fd, guint32 *data, gint count)
int | wire_write_int16 (pipe_t fd, guint16 *data, gint count)
int | wire_write_int8 (pipe_t fd, guint8 *data, gint count)
int | wire_write_double (pipe_t fd, gdouble *data, gint count)
int | wire_write_string (pipe_t fd, gchar **data, gint count)

Variables

WireIOFunc | wire_read_func = NULL
WireIOFunc | wire_write_func = NULL
WireFlushFunc | wire_flush_func = NULL
int | wire_error_val = (0)
CAllHandlers sHandlers

Typedef Documentation

typedef struct _WireHandler WireHandler

Definition at line 67 of file cvsgui_wire.cpp.

Function Documentation

void wire_clear_error ( void )

Definition at line 239 of file cvsgui_wire.cpp.

Referenced by cvs_process_close().

00240 {
00241     wire_error_val = FALSE;
00242 }

void wire_destroy ( WireMessage * msg )

Definition at line 290 of file cvsgui_wire.cpp.

00291 {
00292     WireHandler *handler;
00293
00294     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(msg->type);
00295     if(i == sHandlers.wire_ht.end())
00296         return;
00297
00298     handler = (*i).second;
00299     (* handler->destroy_func) (msg);
00300 }

int wire_error ( void )

Definition at line 233 of file cvsgui_wire.cpp.

00234 {
00235     return wire_error_val;
00236 }

int wire_flush ( pipe_t fd )

Definition at line 225 of file cvsgui_wire.cpp.

00226 {
00227     if (wire_flush_func)
00228         return (* wire_flush_func) (fd);
00229     return FALSE;
00230 }

int wire_read | ( | pipe_t | fd,
 |  | guint8 * | buf,
 |  | gulong | count
 | ) |

Definition at line 140 of file cvsgui_wire.cpp.

00143 {
00144     if (wire_read_func)
00145     {
00146         if (!(* wire_read_func) (fd, buf, count))
00147         {
00148             //g_print ("wire_read: error\n");
00149             wire_error_val = TRUE;
00150             return FALSE;
00151         }
00152     }
00153     else
00154     {
00155         int bytes;
00156
00157         while (count > 0)
00158         {
00159             do {
00160                 bytes = read (fd, (char*) buf, count);
00161             } while ((bytes == -1) && ((errno == EAGAIN) || (errno == EINTR)));
00162
00163             if (bytes == -1)
00164             {
00165                 //g_print ("wire_read: error\n");
00166                 wire_error_val = TRUE;
00167                 return FALSE;
00168             }
00169
00170             if (bytes == 0)
00171             {
00172                 //g_print ("wire_read: unexpected EOF (plug-in crashed?)\n");
00173                 wire_error_val = TRUE;
00174                 return FALSE;
00175             }
00176
00177             count -= bytes;
00178             buf += bytes;
00179         }
00180     }
00181
00182     return TRUE;
00183 }

int wire_read_double | ( | pipe_t | fd,
 |  | gdouble * | data,
 |  | gint | count
 | ) |

Definition at line 351 of file cvsgui_wire.cpp.

00354 {
00355     char *str;
00356     int i;
00357
00358     for (i = 0; i < count; i++)
00359     {
00360         if (!wire_read_string (fd, &str, 1))
00361             return FALSE;
00362         sscanf (str, "%le", &data[i]);
00363         free (str);
00364     }
00365
00366     return TRUE;
00367 }

int wire_read_int16 | ( | pipe_t | fd,
 |  | guint16 * | data,
 |  | gint | count
 | ) |

Definition at line 323 of file cvsgui_wire.cpp.

00326 {
00327     if (count > 0)
00328     {
00329         if (!wire_read_int8 (fd, (guint8*) data, count * 2))
00330             return FALSE;
00331
00332         while (count--)
00333         {
00334             *data = ntohs (*data);
00335             data++;
00336         }
00337     }
00338
00339     return TRUE;
00340 }

int wire_read_int32 | ( | pipe_t | fd,
 |  | guint32 * | data,
 |  | gint | count
 | ) |

Definition at line 303 of file cvsgui_wire.cpp.

00306 {
00307     if (count > 0)
00308     {
00309         if (!wire_read_int8 (fd, (guint8*) data, count * 4))
00310             return FALSE;
00311
00312         while (count--)
00313         {
00314             *data = ntohl (*data);
00315             data++;
00316         }
00317     }
00318
00319     return TRUE;
00320 }

int wire_read_int8 | ( | pipe_t | fd,
 |  | guint8 * | data,
 |  | gint | count
 | ) |

Definition at line 343 of file cvsgui_wire.cpp.

00346 {
00347     return wire_read (fd, data, count);
00348 }

int wire_read_msg | ( | pipe_t | fd,
 |  | WireMessage * | msg
 | ) |

Definition at line 245 of file cvsgui_wire.cpp.

00247 {
00248     WireHandler *handler;
00249
00250     if (wire_error_val)
00251         return !wire_error_val;
00252
00253     if (!wire_read_int32 (fd, &msg->type, 1))
00254         return FALSE;
00255
00256     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(msg->type);
00257     if(i == sHandlers.wire_ht.end())
00258         return FALSE;
00259
00260     handler = (*i).second;
00261     (* handler->read_func) (fd, msg);
00262
00263     return !wire_error_val;
00264 }

int wire_read_string | ( | pipe_t | fd,
 |  | gchar ** | data,
 |  | gint | count
 | ) |

Definition at line 370 of file cvsgui_wire.cpp.

00373 {
00374     guint32 tmp;
00375     int i;
00376
00377     for (i = 0; i < count; i++)
00378     {
00379         if (!wire_read_int32 (fd, &tmp, 1))
00380             return FALSE;
00381
00382         if (tmp > 0)
00383         {
00384             data[i] = (gchar *)malloc(tmp * sizeof(gchar));
00385             if (!wire_read_int8 (fd, (guint8*) data[i], tmp))
00386             {
00387                 free (data[i]);
00388                 return FALSE;
00389             }
00390         }
00391         else
00392         {
00393             data[i] = NULL;
00394         }
00395     }
00396
00397     return TRUE;
00398 }

void wire_register | ( | guint32 | type,
 |  | WireReadFunc | read_func,
 |  | WireWriteFunc | write_func,
 |  | WireDestroyFunc | destroy_func
 | ) |

Definition at line 100 of file cvsgui_wire.cpp.

00104 {
00105     WireHandler *handler;
00106
00107     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(type);
00108     if(i == sHandlers.wire_ht.end())
00109         handler = (WireHandler *)malloc(sizeof(WireHandler));
00110     else
00111         handler = (*i).second;
00112
00113     handler->type = type;
00114     handler->read_func = read_func;
00115     handler->write_func = write_func;
00116     handler->destroy_func = destroy_func;
00117
00118     sHandlers.wire_ht.insert(std::map<guint32, WireHandler *>::value_type(type, handler));
00119 }

void wire_set_flusher ( WireFlushFunc flush_func )

Definition at line 134 of file cvsgui_wire.cpp.

00135 {
00136     wire_flush_func = flush_func;
00137 }

void wire_set_reader ( WireIOFunc read_func )

Definition at line 122 of file cvsgui_wire.cpp.

00123 {
00124     wire_read_func = read_func;
00125 }

void wire_set_writer ( WireIOFunc write_func )

Definition at line 128 of file cvsgui_wire.cpp.

00129 {
00130     wire_write_func = write_func;
00131 }

int wire_write | ( | pipe_t | fd,
 |  | guint8 * | buf,
 |  | gulong | count
 | ) |

Definition at line 186 of file cvsgui_wire.cpp.

00189 {
00190     if (wire_write_func)
00191     {
00192         if (!(* wire_write_func) (fd, buf, count))
00193         {
00194             //g_print ("wire_write: error\n");
00195             wire_error_val = TRUE;
00196             return FALSE;
00197         }
00198     }
00199     else
00200     {
00201         int bytes;
00202
00203         while (count > 0)
00204         {
00205             do {
00206                 bytes = write (fd, (char*) buf, count);
00207             } while ((bytes == -1) && ((errno == EAGAIN) || (errno == EINTR)));
00208
00209             if (bytes == -1)
00210             {
00211                 //g_print ("wire_write: error\n");
00212                 wire_error_val = TRUE;
00213                 return FALSE;
00214             }
00215
00216             count -= bytes;
00217             buf += bytes;
00218         }
00219     }
00220
00221     return TRUE;
00222 }

int wire_write_double | ( | pipe_t | fd,
 |  | gdouble * | data,
 |  | gint | count
 | ) |

Definition at line 451 of file cvsgui_wire.cpp.

00454 {
00455     gchar *t, buf[128];
00456     int i;
00457
00458     t = buf;
00459     for (i = 0; i < count; i++)
00460     {
00461         sprintf (buf, "%0.50e", data[i]);
00462         if (!wire_write_string (fd, &t, 1))
00463             return FALSE;
00464     }
00465
00466     return TRUE;
00467 }

int wire_write_int16 | ( | pipe_t | fd,
 |  | guint16 * | data,
 |  | gint | count
 | ) |

Definition at line 422 of file cvsgui_wire.cpp.

00425 {
00426     guint16 tmp;
00427     int i;
00428
00429     if (count > 0)
00430     {
00431         for (i = 0; i < count; i++)
00432         {
00433             tmp = htons (data[i]);
00434             if (!wire_write_int8 (fd, (guint8*) &tmp, 2))
00435                 return FALSE;
00436         }
00437     }
00438
00439     return TRUE;
00440 }

int wire_write_int32 | ( | pipe_t | fd,
 |  | guint32 * | data,
 |  | gint | count
 | ) |

Definition at line 401 of file cvsgui_wire.cpp.

00404 {
00405     guint32 tmp;
00406     int i;
00407
00408     if (count > 0)
00409     {
00410         for (i = 0; i < count; i++)
00411         {
00412             tmp = htonl (data[i]);
00413             if (!wire_write_int8 (fd, (guint8*) &tmp, 4))
00414                 return FALSE;
00415         }
00416     }
00417
00418     return TRUE;
00419 }

int wire_write_int8 | ( | pipe_t | fd,
 |  | guint8 * | data,
 |  | gint | count
 | ) |

Definition at line 443 of file cvsgui_wire.cpp.

00446 {
00447     return wire_write (fd, data, count);
00448 }

int wire_write_msg | ( | pipe_t | fd,
 |  | WireMessage * | msg
 | ) |

Definition at line 267 of file cvsgui_wire.cpp.

00269 {
00270     WireHandler *handler;
00271
00272     if (wire_error_val)
00273         return !wire_error_val;
00274
00275     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(msg->type);
00276     if(i == sHandlers.wire_ht.end())
00277         return FALSE;
00278
00279     handler = (*i).second;
00280
00281     if (!wire_write_int32 (fd, &msg->type, 1))
00282         return FALSE;
00283
00284     (* handler->write_func) (fd, msg);
00285
00286     return !wire_error_val;
00287 }

int wire_write_string | ( | pipe_t | fd,
 |  | gchar ** | data,
 |  | gint | count
 | ) |

Definition at line 470 of file cvsgui_wire.cpp.

00473 {
00474     guint32 tmp;
00475     int i;
00476
00477     for (i = 0; i < count; i++)
00478     {
00479         if (data[i])
00480             tmp = strlen (data[i]) + 1;
00481         else
00482             tmp = 0;
00483
00484         if (!wire_write_int32 (fd, &tmp, 1))
00485             return FALSE;
00486         if (tmp > 0)
00487             if (!wire_write_int8 (fd, (guint8*) data[i], tmp))
00488                 return FALSE;
00489     }
00490
00491     return TRUE;
00492 }

Variable Documentation

struct CAllHandlers sHandlers

int wire_error_val = (0) [static]

Definition at line 80 of file cvsgui_wire.cpp.

WireFlushFunc wire_flush_func = NULL [static]

Definition at line 79 of file cvsgui_wire.cpp.

WireIOFunc wire_read_func = NULL [static]

Definition at line 77 of file cvsgui_wire.cpp.

WireIOFunc wire_write_func = NULL [static]

Definition at line 78 of file cvsgui_wire.cpp.

Generated on Sun Oct 21 12:42:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvsgui_wire.h File Reference

common/cvsgui_wire.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | _WireMessage

Defines

#define | FALSE (0)
#define | TRUE (!FALSE)

Typedefs

typedef signed char | gint8
typedef unsigned char | guint8
typedef signed short | gint16
typedef unsigned short | guint16
typedef signed int | gint32
typedef unsigned int | guint32
typedef char | gchar
typedef short | gshort
typedef long | glong
typedef int | gint
typedef gint | gboolean
typedef unsigned char | guchar
typedef unsigned short | gushort
typedef unsigned long | gulong
typedef unsigned int | guint
typedef float | gfloat
typedef double | gdouble
typedef void * | gpointer
typedef const void * | gconstpointer
typedef int | pipe_t
typedef _WireMessage | WireMessage
typedef void(* | WireReadFunc )(pipe_t fd, WireMessage *msg)
typedef void(* | WireWriteFunc )(pipe_t fd, WireMessage *msg)
typedef void(* | WireDestroyFunc )(WireMessage *msg)
typedef int(* | WireIOFunc )(pipe_t fd, guint8 *buf, gulong count)
typedef int(* | WireFlushFunc )(pipe_t fd)

Functions

void | wire_register (guint32 type, WireReadFunc read_func, WireWriteFunc write_func, WireDestroyFunc destroy_func)
void | wire_set_reader (WireIOFunc read_func)
void | wire_set_writer (WireIOFunc write_func)
void | wire_set_flusher (WireFlushFunc flush_func)
int | wire_read (pipe_t fd, guint8 *buf, gulong count)
int | wire_write (pipe_t fd, guint8 *buf, gulong count)
int | wire_flush (pipe_t fd)
int | wire_error (void)
void | wire_clear_error (void)
int | wire_read_msg (pipe_t fd, WireMessage *msg)
int | wire_write_msg (pipe_t fd, WireMessage *msg)
void | wire_destroy (WireMessage *msg)
int | wire_read_int32 (pipe_t fd, guint32 *data, gint count)
int | wire_read_int16 (pipe_t fd, guint16 *data, gint count)
int | wire_read_int8 (pipe_t fd, guint8 *data, gint count)
int | wire_read_double (pipe_t fd, gdouble *data, gint count)
int | wire_read_string (pipe_t fd, gchar **data, gint count)
int | wire_write_int32 (pipe_t fd, guint32 *data, gint count)
int | wire_write_int16 (pipe_t fd, guint16 *data, gint count)
int | wire_write_int8 (pipe_t fd, guint8 *data, gint count)
int | wire_write_double (pipe_t fd, gdouble *data, gint count)
int | wire_write_string (pipe_t fd, gchar **data, gint count)

Define Documentation

#define FALSE (0)

Definition at line 61 of file cvsgui_wire.h.

#define TRUE (!FALSE)

Definition at line 65 of file cvsgui_wire.h.

Typedef Documentation

typedef void(* WireDestroyFunc)(WireMessage *msg)

Definition at line 83 of file cvsgui_wire.h.

typedef int(* WireFlushFunc)(pipe_t fd)

Definition at line 85 of file cvsgui_wire.h.

typedef int(* WireIOFunc)(pipe_t fd, guint8 *buf, gulong count)

Definition at line 84 of file cvsgui_wire.h.

typedef struct _WireMessage WireMessage

Definition at line 79 of file cvsgui_wire.h.

typedef void(* WireReadFunc)(pipe_t fd, WireMessage *msg)

Definition at line 81 of file cvsgui_wire.h.

typedef void(* WireWriteFunc)(pipe_t fd, WireMessage *msg)

Definition at line 82 of file cvsgui_wire.h.

typedef gint gboolean

Definition at line 47 of file cvsgui_wire.h.

typedef char gchar

Definition at line 43 of file cvsgui_wire.h.

typedef const void* gconstpointer

Definition at line 58 of file cvsgui_wire.h.

typedef double gdouble

Definition at line 55 of file cvsgui_wire.h.

typedef float gfloat

Definition at line 54 of file cvsgui_wire.h.

typedef int gint

Definition at line 46 of file cvsgui_wire.h.

typedef signed short gint16

Definition at line 38 of file cvsgui_wire.h.

typedef signed int gint32

Definition at line 40 of file cvsgui_wire.h.

typedef signed char gint8

Definition at line 36 of file cvsgui_wire.h.

typedef long glong

Definition at line 45 of file cvsgui_wire.h.

typedef void* gpointer

Definition at line 57 of file cvsgui_wire.h.

typedef short gshort

Definition at line 44 of file cvsgui_wire.h.

typedef unsigned char guchar

Definition at line 49 of file cvsgui_wire.h.

typedef unsigned int guint

Definition at line 52 of file cvsgui_wire.h.

typedef unsigned short guint16

Definition at line 39 of file cvsgui_wire.h.

typedef unsigned int guint32

Definition at line 41 of file cvsgui_wire.h.

typedef unsigned char guint8

Definition at line 37 of file cvsgui_wire.h.

typedef unsigned long gulong

Definition at line 51 of file cvsgui_wire.h.

typedef unsigned short gushort

Definition at line 50 of file cvsgui_wire.h.

typedef int pipe_t

Definition at line 76 of file cvsgui_wire.h.

Function Documentation

void wire_clear_error ( void )

Definition at line 239 of file cvsgui_wire.cpp.

00240 {
00241     wire_error_val = FALSE;
00242 }

void wire_destroy ( WireMessage * msg )

Definition at line 290 of file cvsgui_wire.cpp.

Referenced by cvs_process_recv_message(), gp_getenv_read(), and gp_getenv_write().

00291 {
00292     WireHandler *handler;
00293
00294     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(msg->type);
00295     if(i == sHandlers.wire_ht.end())
00296         return;
00297
00298     handler = (*i).second;
00299     (* handler->destroy_func) (msg);
00300 }

int wire_error ( void )

Definition at line 233 of file cvsgui_wire.cpp.

00234 {
00235     return wire_error_val;
00236 }

int wire_flush ( pipe_t fd )

Definition at line 225 of file cvsgui_wire.cpp.

Referenced by cvs_process_write(), gp_console_write(), gp_getenv_write(), and gp_quit_write().

00226 {
00227     if (wire_flush_func)
00228         return (* wire_flush_func) (fd);
00229     return FALSE;
00230 }

int wire_read | ( | pipe_t | fd,
 |  | guint8 * | buf,
 |  | gulong | count
 | ) |

Definition at line 140 of file cvsgui_wire.cpp.

Referenced by wire_read_int8().

00143 {
00144     if (wire_read_func)
00145     {
00146         if (!(* wire_read_func) (fd, buf, count))
00147         {
00148             //g_print ("wire_read: error\n");
00149             wire_error_val = TRUE;
00150             return FALSE;
00151         }
00152     }
00153     else
00154     {
00155         int bytes;
00156
00157         while (count > 0)
00158         {
00159             do {
00160                 bytes = read (fd, (char*) buf, count);
00161             } while ((bytes == -1) && ((errno == EAGAIN) || (errno == EINTR)));
00162
00163             if (bytes == -1)
00164             {
00165                 //g_print ("wire_read: error\n");
00166                 wire_error_val = TRUE;
00167                 return FALSE;
00168             }
00169
00170             if (bytes == 0)
00171             {
00172                 //g_print ("wire_read: unexpected EOF (plug-in crashed?)\n");
00173                 wire_error_val = TRUE;
00174                 return FALSE;
00175             }
00176
00177             count -= bytes;
00178             buf += bytes;
00179         }
00180     }
00181
00182     return TRUE;
00183 }

int wire_read_double | ( | pipe_t | fd,
 |  | gdouble * | data,
 |  | gint | count
 | ) |

Definition at line 351 of file cvsgui_wire.cpp.

00354 {
00355     char *str;
00356     int i;
00357
00358     for (i = 0; i < count; i++)
00359     {
00360         if (!wire_read_string (fd, &str, 1))
00361             return FALSE;
00362         sscanf (str, "%le", &data[i]);
00363         free (str);
00364     }
00365
00366     return TRUE;
00367 }

int wire_read_int16 | ( | pipe_t | fd,
 |  | guint16 * | data,
 |  | gint | count
 | ) |

Definition at line 323 of file cvsgui_wire.cpp.

00326 {
00327     if (count > 0)
00328     {
00329         if (!wire_read_int8 (fd, (guint8*) data, count * 2))
00330             return FALSE;
00331
00332         while (count--)
00333         {
00334             *data = ntohs (*data);
00335             data++;
00336         }
00337     }
00338
00339     return TRUE;
00340 }

int wire_read_int32 | ( | pipe_t | fd,
 |  | guint32 * | data,
 |  | gint | count
 | ) |

Definition at line 303 of file cvsgui_wire.cpp.

Referenced by _gp_console_read(), _gp_quit_read(), wire_read_msg(), and wire_read_string().

00306 {
00307     if (count > 0)
00308     {
00309         if (!wire_read_int8 (fd, (guint8*) data, count * 4))
00310             return FALSE;
00311
00312         while (count--)
00313         {
00314             *data = ntohl (*data);
00315             data++;
00316         }
00317     }
00318
00319     return TRUE;
00320 }

int wire_read_int8 | ( | pipe_t | fd,
 |  | guint8 * | data,
 |  | gint | count
 | ) |

Definition at line 343 of file cvsgui_wire.cpp.

Referenced by _gp_console_read(), _gp_getenv_read(), wire_read_int16(), wire_read_int32(), and wire_read_string().

00346 {
00347     return wire_read (fd, data, count);
00348 }

int wire_read_msg | ( | pipe_t | fd,
 |  | WireMessage * | msg
 | ) |

Definition at line 245 of file cvsgui_wire.cpp.

Referenced by cvs_process_recv_message(), and gp_getenv_read().

00247 {
00248     WireHandler *handler;
00249
00250     if (wire_error_val)
00251         return !wire_error_val;
00252
00253     if (!wire_read_int32 (fd, &msg->type, 1))
00254         return FALSE;
00255
00256     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(msg->type);
00257     if(i == sHandlers.wire_ht.end())
00258         return FALSE;
00259
00260     handler = (*i).second;
00261     (* handler->read_func) (fd, msg);
00262
00263     return !wire_error_val;
00264 }

int wire_read_string | ( | pipe_t | fd,
 |  | gchar ** | data,
 |  | gint | count
 | ) |

Definition at line 370 of file cvsgui_wire.cpp.

Referenced by _gp_console_read(), _gp_getenv_read(), and wire_read_double().

00373 {
00374     guint32 tmp;
00375     int i;
00376
00377     for (i = 0; i < count; i++)
00378     {
00379         if (!wire_read_int32 (fd, &tmp, 1))
00380             return FALSE;
00381
00382         if (tmp > 0)
00383         {
00384             data[i] = (gchar *)malloc(tmp * sizeof(gchar));
00385             if (!wire_read_int8 (fd, (guint8*) data[i], tmp))
00386             {
00387                 free (data[i]);
00388                 return FALSE;
00389             }
00390         }
00391         else
00392         {
00393             data[i] = NULL;
00394         }
00395     }
00396
00397     return TRUE;
00398 }

void wire_register | ( | guint32 | type,
 |  | WireReadFunc | read_func,
 |  | WireWriteFunc | write_func,
 |  | WireDestroyFunc | destroy_func
 | ) |

Definition at line 100 of file cvsgui_wire.cpp.

Referenced by gp_init().

00104 {
00105     WireHandler *handler;
00106
00107     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(type);
00108     if(i == sHandlers.wire_ht.end())
00109         handler = (WireHandler *)malloc(sizeof(WireHandler));
00110     else
00111         handler = (*i).second;
00112
00113     handler->type = type;
00114     handler->read_func = read_func;
00115     handler->write_func = write_func;
00116     handler->destroy_func = destroy_func;
00117
00118     sHandlers.wire_ht.insert(std::map<guint32, WireHandler *>::value_type(type, handler));
00119 }

void wire_set_flusher ( WireFlushFunc flush_func )

Definition at line 134 of file cvsgui_wire.cpp.

Referenced by cvs_process_init().

00135 {
00136     wire_flush_func = flush_func;
00137 }

void wire_set_reader ( WireIOFunc read_func )

Definition at line 122 of file cvsgui_wire.cpp.

00123 {
00124     wire_read_func = read_func;
00125 }

void wire_set_writer ( WireIOFunc write_func )

Definition at line 128 of file cvsgui_wire.cpp.

Referenced by cvs_process_init().

00129 {
00130     wire_write_func = write_func;
00131 }

int wire_write | ( | pipe_t | fd,
 |  | guint8 * | buf,
 |  | gulong | count
 | ) |

Definition at line 186 of file cvsgui_wire.cpp.

Referenced by wire_write_int8().

00189 {
00190     if (wire_write_func)
00191     {
00192         if (!(* wire_write_func) (fd, buf, count))
00193         {
00194             //g_print ("wire_write: error\n");
00195             wire_error_val = TRUE;
00196             return FALSE;
00197         }
00198     }
00199     else
00200     {
00201         int bytes;
00202
00203         while (count > 0)
00204         {
00205             do {
00206                 bytes = write (fd, (char*) buf, count);
00207             } while ((bytes == -1) && ((errno == EAGAIN) || (errno == EINTR)));
00208
00209             if (bytes == -1)
00210             {
00211                 //g_print ("wire_write: error\n");
00212                 wire_error_val = TRUE;
00213                 return FALSE;
00214             }
00215
00216             count -= bytes;
00217             buf += bytes;
00218         }
00219     }
00220
00221     return TRUE;
00222 }

int wire_write_double | ( | pipe_t | fd,
 |  | gdouble * | data,
 |  | gint | count
 | ) |

Definition at line 451 of file cvsgui_wire.cpp.

00454 {
00455     gchar *t, buf[128];
00456     int i;
00457
00458     t = buf;
00459     for (i = 0; i < count; i++)
00460     {
00461         sprintf (buf, "%0.50e", data[i]);
00462         if (!wire_write_string (fd, &t, 1))
00463             return FALSE;
00464     }
00465
00466     return TRUE;
00467 }

int wire_write_int16 | ( | pipe_t | fd,
 |  | guint16 * | data,
 |  | gint | count
 | ) |

Definition at line 422 of file cvsgui_wire.cpp.

00425 {
00426     guint16 tmp;
00427     int i;
00428
00429     if (count > 0)
00430     {
00431         for (i = 0; i < count; i++)
00432         {
00433             tmp = htons (data[i]);
00434             if (!wire_write_int8 (fd, (guint8*) &tmp, 2))
00435                 return FALSE;
00436         }
00437     }
00438
00439     return TRUE;
00440 }

int wire_write_int32 | ( | pipe_t | fd,
 |  | guint32 * | data,
 |  | gint | count
 | ) |

Definition at line 401 of file cvsgui_wire.cpp.

Referenced by _gp_console_write(), _gp_quit_write(), and wire_write_msg().

00404 {
00405     guint32 tmp;
00406     int i;
00407
00408     if (count > 0)
00409     {
00410         for (i = 0; i < count; i++)
00411         {
00412             tmp = htonl (data[i]);
00413             if (!wire_write_int8 (fd, (guint8*) &tmp, 4))
00414                 return FALSE;
00415         }
00416     }
00417
00418     return TRUE;
00419 }

int wire_write_int8 | ( | pipe_t | fd,
 |  | guint8 * | data,
 |  | gint | count
 | ) |

Definition at line 443 of file cvsgui_wire.cpp.

Referenced by _gp_console_write(), _gp_getenv_write(), wire_write_int16(), and wire_write_int32().

00446 {
00447     return wire_write (fd, data, count);
00448 }

int wire_write_msg | ( | pipe_t | fd,
 |  | WireMessage * | msg
 | ) |

Definition at line 267 of file cvsgui_wire.cpp.

Referenced by gp_console_write(), gp_getenv_write(), and gp_quit_write().

00269 {
00270     WireHandler *handler;
00271
00272     if (wire_error_val)
00273         return !wire_error_val;
00274
00275     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(msg->type);
00276     if(i == sHandlers.wire_ht.end())
00277         return FALSE;
00278
00279     handler = (*i).second;
00280
00281     if (!wire_write_int32 (fd, &msg->type, 1))
00282         return FALSE;
00283
00284     (* handler->write_func) (fd, msg);
00285
00286     return !wire_error_val;
00287 }

int wire_write_string | ( | pipe_t | fd,
 |  | gchar ** | data,
 |  | gint | count
 | ) |

Definition at line 470 of file cvsgui_wire.cpp.

Referenced by _gp_console_write(), _gp_getenv_write(), and wire_write_double().

00473 {
00474     guint32 tmp;
00475     int i;
00476
00477     for (i = 0; i < count; i++)
00478     {
00479         if (data[i])
00480             tmp = strlen (data[i]) + 1;
00481         else
00482             tmp = 0;
00483
00484         if (!wire_write_int32 (fd, &tmp, 1))
00485             return FALSE;
00486         if (tmp > 0)
00487             if (!wire_write_int8 (fd, (guint8*) data[i], tmp))
00488                 return FALSE;
00489     }
00490
00491     return TRUE;
00492 }

Generated on Sun Oct 21 12:42:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsIgnore.cpp File Reference

common/CvsIgnore.cpp File Reference

#include "stdafx.h"
#include <stdlib.h>
#include <string.h>
#include "FileTraversal.h"
#include "AppConsole.h"
#include "CvsIgnore.h"
#include "getline.h"
#include "fnmatch.h"
#include "CvsPrefs.h"
#include <ctype.h>

Include dependency graph for CvsIgnore.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void | ign_add (char *ign, bool hold, std::vector< UStr > &ignlist)
bool | ReadIgnoredFile (const char *fileName, std::vector< UStr > &ignlist)
void | BuildIgnoredList (std::vector< UStr > &ignlist, const char *path)
bool | MatchIgnoredList (const char *filename, const std::vector< UStr > &ignlist)

Function Documentation

void BuildIgnoredList | ( | std::vector< UStr > & | ignlist,
 |  | const char * | path
 | ) |

Definition at line 147 of file CvsIgnore.cpp.

00148 {
00149     ignlist.erase(ignlist.begin(), ignlist.end());
00150
00151     static std::vector<CStr> deflist;
00152     static bool deflistparsed = false;
00153
00154     if(!deflistparsed)
00155     {
00156 #ifdef macintosh
00157         FSSpec theFolder;
00158         Str255 aPath;
00159
00160         if(MacGetPrefsFolder(theFolder, aPath) == noErr)
00161         {
00162             CStr home(aPath);
00163 #else /* !macintosh */
00164         if(gCvsPrefs.Home() != 0L)
00165         {
00166             CStr home(gCvsPrefs.Home());
00167 #endif /* !macintosh */
00168             struct stat sb;
00169             if (stat(home, &sb) != 0 || !S_ISDIR(sb.st_mode))
00170             {
00171                 cvs_err("Warning : unable to access your HOME path '%s'\n", gCvsPrefs.Home());
00172                 cvs_err("          ~/.cvsignore will not be read\n");
00173             }
00174             if(!home.empty() && !home.endsWith(kPathDelimiter))
00175                 home << kPathDelimiter;
00176             home << ".cvsignore";
00177
00178             // Read .cvsignore file from HOME directory.
00179             // If HOME dir doesn't have such a file then
00180             // try to read global file from executable path.
00181             if(ReadIgnoredFile(home, deflist) == false)
00182             {
00183                 CStr appPath;
00184
00185 #ifdef WIN32
00186                 ((CWincvsApp *)AfxGetApp())->GetAppPath(appPath);
00187 #elif defined(qUnix)
00188                 // Unix version uses only .cvsignore file in HOME dir
00189 #else
00190 #   ifdef qMacCvsPP
00191                 appPath = CMacCvsApp::GetAppPath();
00192 #   endif /* qMacCvsPP */
00193 #endif
00194                 if(!appPath.empty())
00195                 {
00196                     if(!appPath.endsWith(kPathDelimiter))
00197                         appPath << kPathDelimiter;
00198
00199                     appPath << ".cvsignore";
00200
00201                     ReadIgnoredFile(appPath, deflist);
00202                 }
00203             }
00204         }
00205         deflistparsed = true;
00206     }
00207     else
00208         ignlist = deflist;
00209
00210 #if qUnix
00211     // from cvs/src/ignore.c
00212     CStr ign_default(". .. core RCSLOG tags TAGS RCS SCCS .make.state\
00213  .nse_depinfo #* .#* cvslog.* ,* CVS CVS.adm .del-* *.a *.olb *.o *.obj\
00214  *.so *.Z *~ *.old *.elc *.ln *.bak *.BAK *.orig *.rej *.exe _$* *$");
00215     ign_add (ign_default, false, ignlist);
00216 #endif
00217
00218     UStr ignPath(path);
00219     if(!ignPath.endsWith(kPathDelimiter))
00220         ignPath << kPathDelimiter;
00221     ignPath << ".cvsignore";
00222
00223     // load the file from the current source directory
00224     ReadIgnoredFile(ignPath, ignlist);
00225 }

bool MatchIgnoredList | ( | const char * | filename,
 |  | const std::vector< UStr > & | ignlist
 | ) |

Definition at line 227 of file CvsIgnore.cpp.

00228 {
00229     std::vector<CStr>::const_iterator i;
00230     for(i = ignlist.begin(); i != ignlist.end(); ++i)
00231     {
00232         if(fnmatch (*i, filename, 0) == 0)
00233             return true;
00234     }
00235     return false;
00236 }

bool ReadIgnoredFile | ( | const char * | fileName,
 |  | std::vector< UStr > & | ignlist
 | ) | [static]

Definition at line 122 of file CvsIgnore.cpp.

Referenced by BuildIgnoredList().

00123 {
00124     FILE *fp;
00125     char *line = NULL;
00126     size_t line_allocated = 0;
00127
00128     fp = fopen(fileName, "r");
00129     if(fp != 0L)
00130     {
00131         while (getline (&line, &line_allocated, fp) >= 0)
00132             ign_add (line, false, ignlist);
00133
00134         if (ferror (fp))
00135             cvs_err("Problem while parsing '%s'", fileName);
00136
00137         fclose (fp);
00138     }
00139
00140     if(line != 0L)
00141         free (line);
00142
00143     return(fp != 0L);
00144 }

void ign_add | ( | char * | ign,
 |  | bool | hold,
 |  | std::vector< UStr > & | ignlist
 | ) | [static]

Definition at line 57 of file CvsIgnore.cpp.

00058 {
00059     if (!ign || !*ign)
00060         return;
00061
00062     int ign_hold = ignlist.size() == 0 ? -1 : (int)ignlist.size();
00063
00064     for (; *ign; ign++)
00065     {
00066         char *mark;
00067         char save;
00068
00069         /* ignore whitespace before the token */
00070         if (isspace (*ign))
00071             continue;
00072
00073         /*
00074         * if we find a single character !, we must re-set the ignore list
00075         * (saving it if necessary).  We also catch * as a special case in a
00076         * global ignore file as an optimization
00077         */
00078         if ((!*(ign+1) || isspace (*(ign+1))) && (*ign == '!' || *ign == '*'))
00079         {
00080             if (!hold)
00081             {
00082                 /* permanently reset the ignore list */
00083                 ignlist.erase(ignlist.begin(), ignlist.end());
00084
00085                 /* if we are doing a '!', continue; otherwise add the '*' */
00086                 if (*ign == '!')
00087                 {
00088                     continue;
00089                 }
00090             }
00091             else if (*ign == '!')
00092             {
00093                 /* temporarily reset the ignore list */
00094                 if (ign_hold >= 0)
00095                 {
00096                     ignlist.erase(ignlist.begin(), ignlist.begin() + ign_hold);
00097                     ign_hold = -1;
00098                 }
00099                 continue;
00100             }
00101         }
00102
00103         /* find the end of this token */
00104         for (mark = ign; *mark && !isspace (*mark); mark++)
00105             /* do nothing */ ;
00106
00107         save = *mark;
00108         *mark = '\0';
00109
00110         ignlist.push_back(CStr(ign));
00111
00112         *mark = save;
00113         if (save)
00114             ign = mark;
00115         else
00116             ign = mark - 1;
00117     }
00118 }

Generated on Sun Oct 21 12:42:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsIgnore.h File Reference

common/CvsIgnore.h File Reference

#include <vector>
#include "CPStr.h"

Include dependency graph for CvsIgnore.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void | BuildIgnoredList (std::vector< UStr > &ignlist, const char *path)
bool | MatchIgnoredList (const char *filename, const std::vector< UStr > &ignlist)

Function Documentation

void BuildIgnoredList | ( | std::vector< UStr > & | ignlist,
 |  | const char * | path
 | ) |

Definition at line 147 of file CvsIgnore.cpp.

Referenced by TBrowserFill::EnterDirectory(), TViewFill::EnterDirectory(), CFillTclEntries::EnterDirectory(), CFillPyEntries::EnterDirectory(), ImportReport::ImportReport(), and CHistComboBoxEx::SetIcon().

00148 {
00149     ignlist.erase(ignlist.begin(), ignlist.end());
00150
00151     static std::vector<CStr> deflist;
00152     static bool deflistparsed = false;
00153
00154     if(!deflistparsed)
00155     {
00156 #ifdef macintosh
00157         FSSpec theFolder;
00158         Str255 aPath;
00159
00160         if(MacGetPrefsFolder(theFolder, aPath) == noErr)
00161         {
00162             CStr home(aPath);
00163 #else /* !macintosh */
00164         if(gCvsPrefs.Home() != 0L)
00165         {
00166             CStr home(gCvsPrefs.Home());
00167 #endif /* !macintosh */
00168             struct stat sb;
00169             if (stat(home, &sb) != 0 || !S_ISDIR(sb.st_mode))
00170             {
00171                 cvs_err("Warning : unable to access your HOME path '%s'\n", gCvsPrefs.Home());
00172                 cvs_err("          ~/.cvsignore will not be read\n");
00173             }
00174             if(!home.empty() && !home.endsWith(kPathDelimiter))
00175                 home << kPathDelimiter;
00176             home << ".cvsignore";
00177
00178             // Read .cvsignore file from HOME directory.
00179             // If HOME dir doesn't have such a file then
00180             // try to read global file from executable path.
00181             if(ReadIgnoredFile(home, deflist) == false)
00182             {
00183                 CStr appPath;
00184
00185 #ifdef WIN32
00186                 ((CWincvsApp *)AfxGetApp())->GetAppPath(appPath);
00187 #elif defined(qUnix)
00188                 // Unix version uses only .cvsignore file in HOME dir
00189 #else
00190 #   ifdef qMacCvsPP
00191                 appPath = CMacCvsApp::GetAppPath();
00192 #   endif /* qMacCvsPP */
00193 #endif
00194                 if(!appPath.empty())
00195                 {
00196                     if(!appPath.endsWith(kPathDelimiter))
00197                         appPath << kPathDelimiter;
00198
00199                     appPath << ".cvsignore";
00200
00201                     ReadIgnoredFile(appPath, deflist);
00202                 }
00203             }
00204         }
00205         deflistparsed = true;
00206     }
00207     else
00208         ignlist = deflist;
00209
00210 #if qUnix
00211     // from cvs/src/ignore.c
00212     CStr ign_default(". .. core RCSLOG tags TAGS RCS SCCS .make.state\
00213  .nse_depinfo #* .#* cvslog.* ,* CVS CVS.adm .del-* *.a *.olb *.o *.obj\
00214  *.so *.Z *~ *.old *.elc *.ln *.bak *.BAK *.orig *.rej *.exe _$* *$");
00215     ign_add (ign_default, false, ignlist);
00216 #endif
00217
00218     UStr ignPath(path);
00219     if(!ignPath.endsWith(kPathDelimiter))
00220         ignPath << kPathDelimiter;
00221     ignPath << ".cvsignore";
00222
00223     // load the file from the current source directory
00224     ReadIgnoredFile(ignPath, ignlist);
00225 }

bool MatchIgnoredList | ( | const char * | filename,
 |  | const std::vector< UStr > & | ignlist
 | ) |

Definition at line 227 of file CvsIgnore.cpp.

Referenced by Entries_SetVisited(), KoFilterModel::IsMatch(), and list_add_type().

00228 {
00229     std::vector<CStr>::const_iterator i;
00230     for(i = ignlist.begin(); i != ignlist.end(); ++i)
00231     {
00232         if(fnmatch (*i, filename, 0) == 0)
00233             return true;
00234     }
00235     return false;
00236 }

Generated on Sun Oct 21 12:42:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsPrefs.cpp File Reference

common/CvsPrefs.cpp File Reference

#include "stdafx.h"
#include <string.h>
#include <stdlib.h>
#include "CvsPrefs.h"
#include "Authen.h"
#include "AppConsole.h"
#include "CvsArgs.h"
#include "MultiString.h"
#include "FileTraversal.h"

Include dependency graph for CvsPrefs.cpp:

Include dependency graph

Go to the source code of this file.

Functions

CPersistentBool | gCheckoutRO ("P_CheckoutRO", true, kAddSettings)
CPersistentBool | gZ9Option ("P_Z9Option", false, kAddSettings)
CPersistentBool | gPruneOption ("P_PruneOption", true, kAddSettings)
CPersistentBool | gQuietOption ("P_QuietOption", false)
CPersistentInt | gIsoConvert ("P_NIsoConvert", ISO8559_none, kAddSettings)
CPersistentBool | gICTextOption ("P_ICTextOption", false, kAddSettings)
CPersistentBool | gAddBinControl ("P_AddBinControl", true)
CPersistentBool | gUseViewerAlways ("P_UseViewerAlways", false, kAddSettings)
CPersistentInt | gMacBinEncoding ("P_NMacBinEncoding", MAC_HQX, kAddSettings)
CPersistentInt | gUseShell ("P_UseShell", SHELL_TCL)
PCPStr | gCvsroot ("P_Cvsroot")
PCPStr | gCvsroot1 ("P_Cvsroot1")
PCPStr | gCvsroot2 ("P_Cvsroot2")
PCPStr | gCvsroot3 ("P_Cvsroot3")
PCPStr | gCvsroot4 ("P_Cvsroot4")
PCPStr | gCvsroot5 ("P_Cvsroot5")
PCPStr | gCvsroot6 ("P_Cvsroot6")
PCPStr | gCvsroot7 ("P_Cvsroot7")
PCPStr | gCvsroot8 ("P_Cvsroot8")
PCPStr | gCvsroot9 ("P_Cvsroot9")
PCPStr | gCvsroot10 ("P_Cvsroot10")
PCPStr | gCvsroot11 ("P_Cvsroot11")
PCPStr | gCvsroot12 ("P_Cvsroot12")
PCPStr | gCvsroot13 ("P_Cvsroot13")
PCPStr | gCvsroot14 ("P_Cvsroot14")
PCPStr | gCvsroot15 ("P_Cvsroot15")
PCPStr | gCvsroot16 ("P_Cvsroot16")
PCPStr | gCvsroot17 ("P_Cvsroot17")
PCPStr | gCvsroot18 ("P_Cvsroot18")
PCPStr | gCvsroot19 ("P_Cvsroot19")
PCPStr | gCvsroot20 ("P_Cvsroot20")
CPersistentInt | gKserverPort ("P_KserverPort",-1, kAddSettings)
CPersistentInt | gPserverPort ("P_PserverPort",-1, kAddSettings)
CPersistentInt | gRhostPort ("P_RhostPort",-1, kAddSettings)
PCPStr | gServerName ("P_ServerName", 0L, kAddSettings)
PCStr | gRshName ("P_RshName", 0L, kAddSettings)
PCStr | gHome ("P_Home", 0L, kAddSettings)
PCStr | gViewer ("P_Viewer","Notepad")
PCStr | gHelper ("P_Helper","netscape")
PCStr | gBrowser ("P_Browser","gmc")
PCStr | gExtdiff ("P_Extdiff","")
CPersistentBool | gDirtySupport ("P_DirtySupport", true, kAddSettings)
CPersistentBool | gAlwaysUseCvsroot ("P_AlwaysUseCvsroot", false, kAddSettings)
CPersistentInt | gLogoutTimeOut ("P_LogoutTimeOut", 0)
PCStr | gProxyHost ("P_ProxyHost","www.mydomain", kAddSettings)
CPersistentInt | gProxyPort ("P_ProxyPort", 8888, kAddSettings)
CPersistentBool | gUseProxy ("P_UseProxy", false, kAddSettings)
CPersistentBool | gUnixLF ("P_UnixLF", false, kAddSettings)
CPersistentInt | gZLevel ("P_ZLevel", 9, kAddSettings)
CPersistentInt | gCvsVersion ("P_CvsVersion", 0, kAddSettings)
CPersistentBool | gCvsConsole ("P_CvsConsole", false, kAddSettings)
CPersistentInt | gWordWrapLogMsg ("P_WordWrapLogMsg", 0, kAddSettings)
PCStr | gLastWorkingDir ("P_LastWorkingDir", 0L, kAddSettings)
CPersistentBool | gHideCommandDlgUpdate ("P_HideCommandDlgUpdate", false)
CPersistentBool | gHideCommandDlgDiff ("P_HideCommandDlgDiff", false)
CPersistentBool | gHideCommandDlgLog ("P_HideCommandDlgLog", false)
CPersistentBool | gHideCommandDlgGraph ("P_HideCommandDlgGraph", false)
CPersistentBool | gHideCommandDlgAnnotate ("P_HideCommandDlgAnnotate", false)
CPersistentBool | gHideCommandDlgUseShift ("P_HideCommandDlgUseShift", true)
CKeyString | gWhichCvs (10,"P_WhichCvs")
bool | LaunchDiff (const char *f1, const char *f2)
bool | LaunchViewer (const char *fullpath, bool useDefault)
bool | LaunchEditor (const char *tmpFile, void *par)

Variables

CvsPrefs gCvsPrefs

Function Documentation

bool LaunchDiff | ( | const char * | file1,
 |  | const char * | file2
 | ) |

Definition at line 677 of file CvsPrefs.cpp.

00678 {
00679 #ifdef qMacCvsPP
00680     const   OSType      kBBEditDiffCreatorCode  = FOUR_CHAR_CODE('BBds');
00681     const   OSType      kResourcererCreatorCode = FOUR_CHAR_CODE('Doug');
00682
00683     //  Resourcerer's Compare suite
00684     const   DescType    kAECompareClass = 'Comp';
00685     const   DescType    kAECompareEvent = 'Comp';
00686         const   DescType    keyNewer        = 'kNew';
00687         const   DescType    keyOlder        = 'kOld';
00688         const   DescType    keyShowDiff     = 'kShD';
00689         const   DescType    keyReturnDiff   = 'kRtD';
00690
00691     OSErr               e = noErr;
00692
00693     try {
00694         //  Convert to file specs
00695         Boolean             inShowDiffs = true;
00696         FSSpec              spec1 = GUSIFileSpec (f1);
00697         FSSpec              spec2 = GUSIFileSpec (f2);
00698
00699         //  Find the file type
00700         FInfo   info;
00701         e = ::FSpGetFInfo (&spec2, &info);
00702         ThrowIfOSErr_(e);
00703
00704         //  Decide on the application
00705         OSType              applCreator = FOUR_CHAR_CODE('????');
00706         switch (info.fdType) {
00707             case 'TEXT':
00708                 applCreator = kBBEditDiffCreatorCode;
00709                 break;
00710
00711             default:
00712                 applCreator = kResourcererCreatorCode;
00713                 break;
00714             } // switch
00715
00716         //  Try to launch it
00717         LaunchFlags         launchFlags = launchContinue + launchNoFileFlags;
00718         OSType              applType = FOUR_CHAR_CODE('APPL');
00719         FSSpec              applSpec;
00720         ProcessSerialNumber applPSN;
00721         if (!UProcess::Launch (applCreator, applType, launchFlags, &applSpec, &applPSN)) Throw_(fnfErr);
00722
00723         //  Now, diff the files.  We use the Resourcerer suite and a BBEdit glue applet.
00724             //  Create the parameters
00725         StAEDescriptor  newerDesc (spec1);
00726         StAEDescriptor  olderDesc (spec2);
00727         StAEDescriptor  showDesc (inShowDiffs);
00728
00729             //  Create the event
00730         StAEDescriptor  addressDesc (typeProcessSerialNumber, &applPSN, sizeof (applPSN));
00731
00732         StAEDescriptor  diffEvent;
00733         e = ::AECreateAppleEvent (kAECompareClass, kAECompareEvent, addressDesc, kAutoGenerateReturnID, kAnyTransactionID, diffEvent);
00734         ThrowIfOSErr_(e);
00735
00736             //  Add the parameters
00737         e = ::AEPutParamDesc (diffEvent, keyNewer, newerDesc);
00738         ThrowIfOSErr_(e);
00739         e = ::AEPutParamDesc (diffEvent, keyOlder, olderDesc);
00740         ThrowIfOSErr_(e);
00741         e = ::AEPutParamDesc (diffEvent, keyShowDiff, showDesc);
00742         ThrowIfOSErr_(e);
00743
00744             //  Send the event
00745         UAppleEventsMgr::SendAppleEvent (diffEvent);
00746
00747         return true;
00748         } // try
00749
00750     catch (LException ex) {
00751         } // catch
00752 #endif
00753     if(gCvsPrefs.ExtDiff() == 0L)
00754     {
00755         cvs_err("The external diff program is not defined,\n");
00756         cvs_err("you need to set it in the preferences dialog.\n");
00757         return false;
00758     }
00759 #ifdef WIN32
00760     CString args;
00761     CStr program, file1, file2;
00762     if(strchr(gCvsPrefs.ExtDiff(), ' ') != 0L)
00763     {
00764         program << '\"';
00765         program << gCvsPrefs.ExtDiff();
00766         program << '\"';
00767     }
00768     else
00769         program = gCvsPrefs.ExtDiff();
00770
00771     if(strchr(f1, ' ') != 0L)
00772     {
00773         file1 << '\"';
00774         file1 << f1;
00775         file1 << '\"';
00776     }
00777     else
00778         file1 = f1;
00779
00780     if(strchr(f2, ' ') != 0L)
00781     {
00782         file2 << '\"';
00783         file2 << f2;
00784         file2 << '\"';
00785     }
00786     else
00787         file2 = f2;
00788
00789     args += file1;
00790     args += " ";
00791     args += file2;
00792
00793     HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), NULL, gCvsPrefs.ExtDiff(), args,
00794                         NULL, SW_SHOWDEFAULT);
00795
00796     if((UINT)hInst < 32)
00797     {
00798         // ExtDiff app was not found. Let's try to execute it from
00799         // the application path. However, this is done only when ExtDiff
00800         // value doesn't contain absolute path ("c:\subdir\" or "\subdir\").
00801         if(strchr(gCvsPrefs.ExtDiff(), ':') == 0L && (gCvsPrefs.ExtDiff()[0]) != '\\')
00802         {
00803             CStr appPath;
00804
00805             ((CWincvsApp *)AfxGetApp())->GetAppPath(appPath);
00806             if(!appPath.endsWith(kPathDelimiter))
00807                 appPath << kPathDelimiter;
00808
00809             appPath << gCvsPrefs.ExtDiff();
00810
00811             hInst = ShellExecute(*AfxGetMainWnd(), NULL, appPath, args,
00812                     NULL, SW_SHOWDEFAULT);
00813         }
00814     }
00815
00816     if((UINT)hInst < 32)
00817     {
00818         LPVOID lpMsgBuf;
00819         FormatMessage(
00820             FORMAT_MESSAGE_ALLOCATE_BUFFER |
00821             FORMAT_MESSAGE_FROM_SYSTEM |
00822             FORMAT_MESSAGE_IGNORE_INSERTS,
00823             NULL,
00824             GetLastError(),
00825             MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
00826             (LPTSTR) &lpMsgBuf,
00827             0,
00828             NULL
00829             );
00830         cvs_err("Unable to open '%s' (%s), using console instead\n",
00831             (char *)gCvsPrefs.ExtDiff(), (LPCSTR)lpMsgBuf);
00832         // Free the buffer.
00833         LocalFree( lpMsgBuf );
00834         return false;
00835     }
00836
00837     return true;
00838 #elif qUnix
00839     CvsArgs args(false);
00840     args.add(gCvsPrefs.ExtDiff());
00841     args.add(f1);
00842     args.add(f2);
00843     UCvsApp::gApp->Execute(args.Argc(), args.Argv());
00844     return true;
00845 #else
00846     return false;
00847 #endif
00848 }

bool LaunchEditor | ( | const char * | tmpFile,
 |  | void * | par = 0L
 | ) |

Definition at line 939 of file CvsPrefs.cpp.

00940 {
00941     CStr program, file;
00942     if(strchr(gCvsPrefs.Viewer(), ' ') != 0L)
00943     {
00944         program << '\"';
00945         program << gCvsPrefs.Viewer();
00946         program << '\"';
00947     }
00948     else
00949         program = gCvsPrefs.Viewer();
00950     if(strchr(tmpFile, ' ') != 0L)
00951     {
00952         file << '\"';
00953         file << tmpFile;
00954         file << '\"';
00955     }
00956     else
00957         file = tmpFile;
00958
00959     CStr command;
00960     command << program;
00961     command << " ";
00962     command << file;
00963
00964 #ifdef WIN32
00965     STARTUPINFO sStartupInfo;
00966     PROCESS_INFORMATION sProcessInformation;
00967
00968     // Execute the command with a call to the CreateProcess API call.
00969     memset( &sStartupInfo, 0, sizeof(sStartupInfo) );
00970     sStartupInfo.cb = sizeof( sStartupInfo );
00971     sStartupInfo.dwFlags = STARTF_USESHOWWINDOW;
00972     sStartupInfo.wShowWindow = SW_SHOWNORMAL;
00973
00974     if( !CreateProcess( NULL,
00975         (char*)command,
00976         NULL,
00977         NULL,
00978         FALSE,
00979         0,
00980         NULL,
00981         NULL,
00982         &sStartupInfo,
00983         &sProcessInformation) )
00984     {
00985         sProcessInformation.hProcess = INVALID_HANDLE_VALUE;
00986         sProcessInformation.hThread = INVALID_HANDLE_VALUE;
00987     }
00988
00989     *((PROCESS_INFORMATION*)par) = sProcessInformation;
00990     return sProcessInformation.hProcess != INVALID_HANDLE_VALUE;
00991 #endif /* WIN32 */
00992
00993 #ifdef qMacCvsPP
00994     return true;
00995 #endif /* qMacCvsPP */
00996
00997 #if qUnix
00998     return true;
00999 #endif // qUnix
01000 }

bool LaunchViewer | ( | const char * | fullpath,
 |  | bool | useDefault = false
 | ) |

Definition at line 850 of file CvsPrefs.cpp.

00851 {
00852 #ifdef WIN32
00853     bool done = false;
00854
00855     if( !gCvsPrefs.UseViewerAlways() )
00856     {
00857         char viewer[_MAX_PATH];
00858         UStr buf;
00859         CStr uppath, folder;
00860         SplitPath(fullpath, uppath, folder);
00861
00862         HINSTANCE hInst = FindExecutable(fullpath, folder, viewer);
00863         if(!useDefault && (UINT)hInst >= 32)
00864         {
00865             // see Article ID: Q140724 for the problem desc of FindExecutable
00866             struct stat sb;
00867             HINSTANCE hInst;
00868             if (stat(viewer, &sb) != -1 && S_ISREG(sb.st_mode))
00869             {
00870                 CStr fullpathQuote;
00871                 if(strchr(fullpath, ' ') != 0L)
00872                 {
00873                     fullpathQuote << '\"';
00874                     fullpathQuote << fullpath;
00875                     fullpathQuote << '\"';
00876                 }
00877                 else
00878                     fullpathQuote = fullpath;
00879
00880                 hInst = ShellExecute(*AfxGetMainWnd(), "open", viewer, fullpathQuote,
00881                     folder, SW_SHOWDEFAULT);
00882             }
00883             else
00884                 hInst = ShellExecute(*AfxGetMainWnd(), "open", fullpath, 0L,
00885                     folder, SW_SHOWDEFAULT);
00886
00887             if((long)hInst < 32)
00888             {
00889                 cvs_err("Unable to open '%s' (error %d), using default viewer instead\n", (char *)fullpath, GetLastError());
00890             }
00891             else
00892                 done = true;
00893         }
00894     }
00895
00896     if(!done)
00897     {
00898         if(gCvsPrefs.Viewer() == 0L)
00899         {
00900             cvs_err("You need to define a default viewer for this file in the preferences\n");
00901             return false;
00902         }
00903
00904         const char * argv[3] = {0L, 0L, 0L};
00905         CStr program, file;
00906         if(strchr(gCvsPrefs.Viewer(), ' ') != 0L)
00907         {
00908             program << '\"';
00909             program << gCvsPrefs.Viewer();
00910             program << '\"';
00911         }
00912         else
00913             program = gCvsPrefs.Viewer();
00914         if(strchr(fullpath, ' ') != 0L)
00915         {
00916             file << '\"';
00917             file << fullpath;
00918             file << '\"';
00919         }
00920         else
00921             file = fullpath;
00922         argv[0] = program;
00923         argv[1] = file;
00924         int process = _spawnvp(_P_NOWAIT, gCvsPrefs.Viewer(), argv);
00925     }
00926
00927     return true;
00928 #endif /* WIN32 */
00929
00930 #ifdef qMacCvsPP
00931     return true;
00932 #endif /* qMacCvsPP */
00933
00934 #if qUnix
00935     return true;
00936 #endif // qUnix
00937 }

CPersistentBool gAddBinControl | ( | "P_AddBinControl" | ,
 |  | true |
 | ) | [static]

CPersistentBool gAlwaysUseCvsroot | ( | "P_AlwaysUseCvsroot" | ,
 |  | false | ,
 |  | kAddSettings |
 | ) | [static]

PCStr gBrowser | ( | "P_Browser" | ,
 |  | "gmc" |
 | ) | [static]

CPersistentBool gCheckoutRO | ( | "P_CheckoutRO" | ,
 |  | true | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentBool gCvsConsole | ( | "P_CvsConsole" | ,
 |  | false | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentInt gCvsVersion | ( | "P_CvsVersion" | ,
 |  | 0 | ,
 |  | kAddSettings |
 | ) | [static]

PCPStr gCvsroot ( "P_Cvsroot" ) [static]

PCPStr gCvsroot1 ( "P_Cvsroot1" ) [static]

PCPStr gCvsroot10 ( "P_Cvsroot10" ) [static]

PCPStr gCvsroot11 ( "P_Cvsroot11" ) [static]

PCPStr gCvsroot12 ( "P_Cvsroot12" ) [static]

PCPStr gCvsroot13 ( "P_Cvsroot13" ) [static]

PCPStr gCvsroot14 ( "P_Cvsroot14" ) [static]

PCPStr gCvsroot15 ( "P_Cvsroot15" ) [static]

PCPStr gCvsroot16 ( "P_Cvsroot16" ) [static]

PCPStr gCvsroot17 ( "P_Cvsroot17" ) [static]

PCPStr gCvsroot18 ( "P_Cvsroot18" ) [static]

PCPStr gCvsroot19 ( "P_Cvsroot19" ) [static]

PCPStr gCvsroot2 ( "P_Cvsroot2" ) [static]

PCPStr gCvsroot20 ( "P_Cvsroot20" ) [static]

PCPStr gCvsroot3 ( "P_Cvsroot3" ) [static]

PCPStr gCvsroot4 ( "P_Cvsroot4" ) [static]

PCPStr gCvsroot5 ( "P_Cvsroot5" ) [static]

PCPStr gCvsroot6 ( "P_Cvsroot6" ) [static]

PCPStr gCvsroot7 ( "P_Cvsroot7" ) [static]

PCPStr gCvsroot8 ( "P_Cvsroot8" ) [static]

PCPStr gCvsroot9 ( "P_Cvsroot9" ) [static]

CPersistentBool gDirtySupport | ( | "P_DirtySupport" | ,
 |  | true | ,
 |  | kAddSettings |
 | ) | [static]

PCStr gExtdiff | ( | "P_Extdiff" | ,
 |  | "" |
 | ) | [static]

PCStr gHelper | ( | "P_Helper" | ,
 |  | "netscape" |
 | ) | [static]

CPersistentBool gHideCommandDlgAnnotate | ( | "P_HideCommandDlgAnnotate" | ,
 |  | false |
 | ) | [static]

CPersistentBool gHideCommandDlgDiff | ( | "P_HideCommandDlgDiff" | ,
 |  | false |
 | ) | [static]

CPersistentBool gHideCommandDlgGraph | ( | "P_HideCommandDlgGraph" | ,
 |  | false |
 | ) | [static]

CPersistentBool gHideCommandDlgLog | ( | "P_HideCommandDlgLog" | ,
 |  | false |
 | ) | [static]

CPersistentBool gHideCommandDlgUpdate | ( | "P_HideCommandDlgUpdate" | ,
 |  | false |
 | ) | [static]

CPersistentBool gHideCommandDlgUseShift | ( | "P_HideCommandDlgUseShift" | ,
 |  | true |
 | ) | [static]

PCStr gHome | ( | "P_Home" | ,
 |  | 0L | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentBool gICTextOption | ( | "P_ICTextOption" | ,
 |  | false | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentInt gIsoConvert | ( | "P_NIsoConvert" | ,
 |  | ISO8559_none | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentInt gKserverPort | ( | "P_KserverPort" | ,
 |  | - | 1,
 |  | kAddSettings |
 | ) | [static]

PCStr gLastWorkingDir | ( | "P_LastWorkingDir" | ,
 |  | 0L | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentInt gLogoutTimeOut | ( | "P_LogoutTimeOut" | ,
 |  | 0 |
 | ) | [static]

CPersistentInt gMacBinEncoding | ( | "P_NMacBinEncoding" | ,
 |  | MAC_HQX | ,
 |  | kAddSettings |
 | ) | [static]

PCStr gProxyHost | ( | "P_ProxyHost" | ,
 |  | "www.mydomain" | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentInt gProxyPort | ( | "P_ProxyPort" | ,
 |  | 8888 | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentBool gPruneOption | ( | "P_PruneOption" | ,
 |  | true | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentInt gPserverPort | ( | "P_PserverPort" | ,
 |  | - | 1,
 |  | kAddSettings |
 | ) | [static]

CPersistentBool gQuietOption | ( | "P_QuietOption" | ,
 |  | false |
 | ) | [static]

CPersistentInt gRhostPort | ( | "P_RhostPort" | ,
 |  | - | 1,
 |  | kAddSettings |
 | ) | [static]

PCStr gRshName | ( | "P_RshName" | ,
 |  | 0L | ,
 |  | kAddSettings |
 | ) | [static]

PCPStr gServerName | ( | "P_ServerName" | ,
 |  | 0L | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentBool gUnixLF | ( | "P_UnixLF" | ,
 |  | false | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentBool gUseProxy | ( | "P_UseProxy" | ,
 |  | false | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentInt gUseShell | ( | "P_UseShell" | ,
 |  | SHELL_TCL |
 | ) | [static]

CPersistentBool gUseViewerAlways | ( | "P_UseViewerAlways" | ,
 |  | false | ,
 |  | kAddSettings |
 | ) | [static]

PCStr gViewer | ( | "P_Viewer" | ,
 |  | "Notepad" |
 | ) | [static]

CKeyString gWhichCvs | ( | 10 | ,
 |  | "P_WhichCvs" |
 | ) | [static]

CPersistentInt gWordWrapLogMsg | ( | "P_WordWrapLogMsg" | ,
 |  | 0 | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentBool gZ9Option | ( | "P_Z9Option" | ,
 |  | false | ,
 |  | kAddSettings |
 | ) | [static]

CPersistentInt gZLevel | ( | "P_ZLevel" | ,
 |  | 9 | ,
 |  | kAddSettings |
 | ) | [static]

Variable Documentation

CvsPrefs gCvsPrefs

Definition at line 79 of file CvsPrefs.cpp.

Generated on Sun Oct 21 12:42:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsPrefs.h File Reference

common/CvsPrefs.h File Reference

#include <string.h>
#include "CPStr.h"
#include "Persistent.h"

Include dependency graph for CvsPrefs.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CvsPrefs

Defines

#define | NUM_CVSROOT 20

Enumerations

enum ISO8559 {
ISO8559_none, ISO8559_1, ISO8559_2, ISO8559_3,
ISO8559_4, ISO8559_5, ISO8559_6, ISO8559_7,
ISO8559_8, ISO8559_9, ISO8559_10
}
enum | MACENCODING { MAC_HQX, MAC_APPSINGLE }
enum | SHELL_KIND { SHELL_TCL, SHELL_PYTHON }

Functions

bool | LaunchDiff (const char *file1, const char *file2)
bool | LaunchViewer (const char *fullpath, bool useDefault=false)
bool | LaunchEditor (const char *tmpFile, void *par=0L)

Variables

CvsPrefs gCvsPrefs

Define Documentation

#define NUM_CVSROOT 20

Definition at line 64 of file CvsPrefs.h.

Enumeration Type Documentation

enum ISO8559

Enumeration values:
ISO8559_none
ISO8559_1
ISO8559_2
ISO8559_3
ISO8559_4
ISO8559_5
ISO8559_6
ISO8559_7
ISO8559_8
ISO8559_9
ISO8559_10

Definition at line 37 of file CvsPrefs.h.

00038 {
00039     ISO8559_none, // no conversion
00040     ISO8559_1, // Latin1
00041     ISO8559_2, // Latin2
00042     ISO8559_3, // Latin3
00043     ISO8559_4, // Latin4
00044     ISO8559_5, // Cyrillic
00045     ISO8559_6, // Arabic
00046     ISO8559_7, // Greek
00047     ISO8559_8, // Hebrew
00048     ISO8559_9, // Latin5 (Turkish)
00049     ISO8559_10 // Latin6 (Nordic)
00050 } ISO8559;

enum MACENCODING

Enumeration values:
MAC_HQX
MAC_APPSINGLE

Definition at line 52 of file CvsPrefs.h.

00053 {
00054     MAC_HQX, // HQX (7bits)
00055     MAC_APPSINGLE // Apple Single
00056 } MACENCODING;

enum SHELL_KIND

Enumeration values:
SHELL_TCL
SHELL_PYTHON

Definition at line 58 of file CvsPrefs.h.

00059 {
00060     SHELL_TCL,
00061     SHELL_PYTHON
00062 } SHELL_KIND;

Function Documentation

bool LaunchDiff | ( | const char * | file1,
 |  | const char * | file2
 | ) |

Definition at line 677 of file CvsPrefs.cpp.

Referenced by CvsCmdDiffFiles(), and CGraphView::OnViewDiff().

00678 {
00679 #ifdef qMacCvsPP
00680     const   OSType      kBBEditDiffCreatorCode  = FOUR_CHAR_CODE('BBds');
00681     const   OSType      kResourcererCreatorCode = FOUR_CHAR_CODE('Doug');
00682
00683     //  Resourcerer's Compare suite
00684     const   DescType    kAECompareClass = 'Comp';
00685     const   DescType    kAECompareEvent = 'Comp';
00686         const   DescType    keyNewer        = 'kNew';
00687         const   DescType    keyOlder        = 'kOld';
00688         const   DescType    keyShowDiff     = 'kShD';
00689         const   DescType    keyReturnDiff   = 'kRtD';
00690
00691     OSErr               e = noErr;
00692
00693     try {
00694         //  Convert to file specs
00695         Boolean             inShowDiffs = true;
00696         FSSpec              spec1 = GUSIFileSpec (f1);
00697         FSSpec              spec2 = GUSIFileSpec (f2);
00698
00699         //  Find the file type
00700         FInfo   info;
00701         e = ::FSpGetFInfo (&spec2, &info);
00702         ThrowIfOSErr_(e);
00703
00704         //  Decide on the application
00705         OSType              applCreator = FOUR_CHAR_CODE('????');
00706         switch (info.fdType) {
00707             case 'TEXT':
00708                 applCreator = kBBEditDiffCreatorCode;
00709                 break;
00710
00711             default:
00712                 applCreator = kResourcererCreatorCode;
00713                 break;
00714             } // switch
00715
00716         //  Try to launch it
00717         LaunchFlags         launchFlags = launchContinue + launchNoFileFlags;
00718         OSType              applType = FOUR_CHAR_CODE('APPL');
00719         FSSpec              applSpec;
00720         ProcessSerialNumber applPSN;
00721         if (!UProcess::Launch (applCreator, applType, launchFlags, &applSpec, &applPSN)) Throw_(fnfErr);
00722
00723         //  Now, diff the files.  We use the Resourcerer suite and a BBEdit glue applet.
00724             //  Create the parameters
00725         StAEDescriptor  newerDesc (spec1);
00726         StAEDescriptor  olderDesc (spec2);
00727         StAEDescriptor  showDesc (inShowDiffs);
00728
00729             //  Create the event
00730         StAEDescriptor  addressDesc (typeProcessSerialNumber, &applPSN, sizeof (applPSN));
00731
00732         StAEDescriptor  diffEvent;
00733         e = ::AECreateAppleEvent (kAECompareClass, kAECompareEvent, addressDesc, kAutoGenerateReturnID, kAnyTransactionID, diffEvent);
00734         ThrowIfOSErr_(e);
00735
00736             //  Add the parameters
00737         e = ::AEPutParamDesc (diffEvent, keyNewer, newerDesc);
00738         ThrowIfOSErr_(e);
00739         e = ::AEPutParamDesc (diffEvent, keyOlder, olderDesc);
00740         ThrowIfOSErr_(e);
00741         e = ::AEPutParamDesc (diffEvent, keyShowDiff, showDesc);
00742         ThrowIfOSErr_(e);
00743
00744             //  Send the event
00745         UAppleEventsMgr::SendAppleEvent (diffEvent);
00746
00747         return true;
00748         } // try
00749
00750     catch (LException ex) {
00751         } // catch
00752 #endif
00753     if(gCvsPrefs.ExtDiff() == 0L)
00754     {
00755         cvs_err("The external diff program is not defined,\n");
00756         cvs_err("you need to set it in the preferences dialog.\n");
00757         return false;
00758     }
00759 #ifdef WIN32
00760     CString args;
00761     CStr program, file1, file2;
00762     if(strchr(gCvsPrefs.ExtDiff(), ' ') != 0L)
00763     {
00764         program << '\"';
00765         program << gCvsPrefs.ExtDiff();
00766         program << '\"';
00767     }
00768     else
00769         program = gCvsPrefs.ExtDiff();
00770
00771     if(strchr(f1, ' ') != 0L)
00772     {
00773         file1 << '\"';
00774         file1 << f1;
00775         file1 << '\"';
00776     }
00777     else
00778         file1 = f1;
00779
00780     if(strchr(f2, ' ') != 0L)
00781     {
00782         file2 << '\"';
00783         file2 << f2;
00784         file2 << '\"';
00785     }
00786     else
00787         file2 = f2;
00788
00789     args += file1;
00790     args += " ";
00791     args += file2;
00792
00793     HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), NULL, gCvsPrefs.ExtDiff(), args,
00794                         NULL, SW_SHOWDEFAULT);
00795
00796     if((UINT)hInst < 32)
00797     {
00798         // ExtDiff app was not found. Let's try to execute it from
00799         // the application path. However, this is done only when ExtDiff
00800         // value doesn't contain absolute path ("c:\subdir\" or "\subdir\").
00801         if(strchr(gCvsPrefs.ExtDiff(), ':') == 0L && (gCvsPrefs.ExtDiff()[0]) != '\\')
00802         {
00803             CStr appPath;
00804
00805             ((CWincvsApp *)AfxGetApp())->GetAppPath(appPath);
00806             if(!appPath.endsWith(kPathDelimiter))
00807                 appPath << kPathDelimiter;
00808
00809             appPath << gCvsPrefs.ExtDiff();
00810
00811             hInst = ShellExecute(*AfxGetMainWnd(), NULL, appPath, args,
00812                     NULL, SW_SHOWDEFAULT);
00813         }
00814     }
00815
00816     if((UINT)hInst < 32)
00817     {
00818         LPVOID lpMsgBuf;
00819         FormatMessage(
00820             FORMAT_MESSAGE_ALLOCATE_BUFFER |
00821             FORMAT_MESSAGE_FROM_SYSTEM |
00822             FORMAT_MESSAGE_IGNORE_INSERTS,
00823             NULL,
00824             GetLastError(),
00825             MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
00826             (LPTSTR) &lpMsgBuf,
00827             0,
00828             NULL
00829             );
00830         cvs_err("Unable to open '%s' (%s), using console instead\n",
00831             (char *)gCvsPrefs.ExtDiff(), (LPCSTR)lpMsgBuf);
00832         // Free the buffer.
00833         LocalFree( lpMsgBuf );
00834         return false;
00835     }
00836
00837     return true;
00838 #elif qUnix
00839     CvsArgs args(false);
00840     args.add(gCvsPrefs.ExtDiff());
00841     args.add(f1);
00842     args.add(f2);
00843     UCvsApp::gApp->Execute(args.Argc(), args.Argv());
00844     return true;
00845 #else
00846     return false;
00847 #endif
00848 }

bool LaunchEditor | ( | const char * | tmpFile,
 |  | void * | par = 0L
 | ) |

Definition at line 939 of file CvsPrefs.cpp.

Referenced by CompatGetEditorMsg().

00940 {
00941     CStr program, file;
00942     if(strchr(gCvsPrefs.Viewer(), ' ') != 0L)
00943     {
00944         program << '\"';
00945         program << gCvsPrefs.Viewer();
00946         program << '\"';
00947     }
00948     else
00949         program = gCvsPrefs.Viewer();
00950     if(strchr(tmpFile, ' ') != 0L)
00951     {
00952         file << '\"';
00953         file << tmpFile;
00954         file << '\"';
00955     }
00956     else
00957         file = tmpFile;
00958
00959     CStr command;
00960     command << program;
00961     command << " ";
00962     command << file;
00963
00964 #ifdef WIN32
00965     STARTUPINFO sStartupInfo;
00966     PROCESS_INFORMATION sProcessInformation;
00967
00968     // Execute the command with a call to the CreateProcess API call.
00969     memset( &sStartupInfo, 0, sizeof(sStartupInfo) );
00970     sStartupInfo.cb = sizeof( sStartupInfo );
00971     sStartupInfo.dwFlags = STARTF_USESHOWWINDOW;
00972     sStartupInfo.wShowWindow = SW_SHOWNORMAL;
00973
00974     if( !CreateProcess( NULL,
00975         (char*)command,
00976         NULL,
00977         NULL,
00978         FALSE,
00979         0,
00980         NULL,
00981         NULL,
00982         &sStartupInfo,
00983         &sProcessInformation) )
00984     {
00985         sProcessInformation.hProcess = INVALID_HANDLE_VALUE;
00986         sProcessInformation.hThread = INVALID_HANDLE_VALUE;
00987     }
00988
00989     *((PROCESS_INFORMATION*)par) = sProcessInformation;
00990     return sProcessInformation.hProcess != INVALID_HANDLE_VALUE;
00991 #endif /* WIN32 */
00992
00993 #ifdef qMacCvsPP
00994     return true;
00995 #endif /* qMacCvsPP */
00996
00997 #if qUnix
00998     return true;
00999 #endif // qUnix
01000 }

bool LaunchViewer | ( | const char * | fullpath,
 |  | bool | useDefault = false
 | ) |

Definition at line 850 of file CvsPrefs.cpp.

Referenced by CvsCmdAnnotateFiles(), CBrowseFileView::EditSel(), and CGraphView::OnQueryAnnotate().

00851 {
00852 #ifdef WIN32
00853     bool done = false;
00854
00855     if( !gCvsPrefs.UseViewerAlways() )
00856     {
00857         char viewer[_MAX_PATH];
00858         UStr buf;
00859         CStr uppath, folder;
00860         SplitPath(fullpath, uppath, folder);
00861
00862         HINSTANCE hInst = FindExecutable(fullpath, folder, viewer);
00863         if(!useDefault && (UINT)hInst >= 32)
00864         {
00865             // see Article ID: Q140724 for the problem desc of FindExecutable
00866             struct stat sb;
00867             HINSTANCE hInst;
00868             if (stat(viewer, &sb) != -1 && S_ISREG(sb.st_mode))
00869             {
00870                 CStr fullpathQuote;
00871                 if(strchr(fullpath, ' ') != 0L)
00872                 {
00873                     fullpathQuote << '\"';
00874                     fullpathQuote << fullpath;
00875                     fullpathQuote << '\"';
00876                 }
00877                 else
00878                     fullpathQuote = fullpath;
00879
00880                 hInst = ShellExecute(*AfxGetMainWnd(), "open", viewer, fullpathQuote,
00881                     folder, SW_SHOWDEFAULT);
00882             }
00883             else
00884                 hInst = ShellExecute(*AfxGetMainWnd(), "open", fullpath, 0L,
00885                     folder, SW_SHOWDEFAULT);
00886
00887             if((long)hInst < 32)
00888             {
00889                 cvs_err("Unable to open '%s' (error %d), using default viewer instead\n", (char *)fullpath, GetLastError());
00890             }
00891             else
00892                 done = true;
00893         }
00894     }
00895
00896     if(!done)
00897     {
00898         if(gCvsPrefs.Viewer() == 0L)
00899         {
00900             cvs_err("You need to define a default viewer for this file in the preferences\n");
00901             return false;
00902         }
00903
00904         const char * argv[3] = {0L, 0L, 0L};
00905         CStr program, file;
00906         if(strchr(gCvsPrefs.Viewer(), ' ') != 0L)
00907         {
00908             program << '\"';
00909             program << gCvsPrefs.Viewer();
00910             program << '\"';
00911         }
00912         else
00913             program = gCvsPrefs.Viewer();
00914         if(strchr(fullpath, ' ') != 0L)
00915         {
00916             file << '\"';
00917             file << fullpath;
00918             file << '\"';
00919         }
00920         else
00921             file = fullpath;
00922         argv[0] = program;
00923         argv[1] = file;
00924         int process = _spawnvp(_P_NOWAIT, gCvsPrefs.Viewer(), argv);
00925     }
00926
00927     return true;
00928 #endif /* WIN32 */
00929
00930 #ifdef qMacCvsPP
00931     return true;
00932 #endif /* qMacCvsPP */
00933
00934 #if qUnix
00935     return true;
00936 #endif // qUnix
00937 }

Variable Documentation

CvsPrefs gCvsPrefs

Definition at line 220 of file CvsPrefs.h.

Generated on Sun Oct 21 12:42:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


DiffDlg.cpp File Reference

common/DiffDlg.cpp File Reference

#include "stdafx.h"
#include "DiffDlg.h"
#include "CvsPrefs.h"
#include "UpdateDlg.h"

Include dependency graph for DiffDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

CPersistentBool | gUseExtDiff ("P_DiffUseExtDiff", false)
bool | CompatGetDiff (bool &noRecurs, bool &isDate1, bool &isDate2, UPStr &rev1, UPStr &rev2, bool &useExtDiff, bool &noWhiteSpace, bool &ignoreCare, bool allowExtDiff)

Function Documentation

bool CompatGetDiff | ( | bool & | noRecurs,
 |  | bool & | isDate1,
 |  | bool & | isDate2,
 |  | UPStr & | rev1,
 |  | UPStr & | rev2,
 |  | bool & | useExtDiff,
 |  | bool & | noWhiteSpace,
 |  | bool & | ignoreCase,
 |  | bool | allowExtDiff = false
 | ) |

Definition at line 424 of file DiffDlg.cpp.

00428 {
00429     bool userHitOK = false;
00430
00431     static CPStr sLastRev1;
00432     static CPStr sLastRev2;
00433     static bool bNoWhiteSpace = false;
00434     static bool bIgnoreCare = false;
00435
00436     rev1 = "";
00437     rev2 = "";
00438     noRecurs = false;
00439     isDate1 = false;
00440     isDate2 = false;
00441     useExtDiff = (bool)gUseExtDiff;
00442     noWhiteSpace = bNoWhiteSpace;
00443     ignoreCare = bIgnoreCare;
00444     bool hasRev1 = false;
00445     bool hasRev2 = false;
00446
00447 #ifdef WIN32
00448     COptionalPropertySheet pages(gCvsPrefs.HideCommandDlgDiff(), "Diff settings");
00449     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00450     CDiff_MAIN page1(sLastRev1, sLastRev2, allowExtDiff, noWhiteSpace, ignoreCare);
00451     CGetPrefs_GLOBALS page2;
00452     pages.AddPage(&page1);
00453     pages.AddPage(&page2);
00454     if(pages.DoModal() == IDOK)
00455     {
00456         noRecurs = page1.m_norecurs == TRUE;
00457
00458         sLastRev1 = page1.m_str1;
00459         sLastRev2 = page1.m_str2;
00460         isDate1 = page1.m_check1 == TRUE;
00461         isDate2 = page1.m_check2 == TRUE;
00462         gUseExtDiff = page1.m_extdiff == TRUE;
00463         if(page1.m_diff == 0)
00464         {
00465             hasRev1 = hasRev2 = false;
00466         }
00467         else if(page1.m_diff == 1)
00468         {
00469             hasRev1 = true;
00470             hasRev2 = false;
00471         }
00472         else
00473         {
00474             hasRev1 = true;
00475             hasRev2 = true;
00476         }
00477
00478         noWhiteSpace = page1.m_noWhiteSpace == TRUE;
00479         ignoreCare = page1.m_ignoreCase == TRUE;
00480
00481         page2.StoreValues();
00482         gCvsPrefs.SetHideCommandDlgDiff(pages.GetHideCommandDlg());
00483         userHitOK = true;
00484     }
00485 #endif /* WIN32 */
00486 #ifdef qMacCvsPP
00487     StDialogHandler theHandler(dlg_Diff, LCommander::GetTopCommander());
00488     LWindow *theDialog = theHandler.GetDialog();
00489     ThrowIfNil_(theDialog);
00490     static UInt16 sRuntimePanel = 1;
00491
00492     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00493         (theDialog->FindPaneByID(item_MultiViewPrefs));
00494     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00495
00496     multiView->SwitchToPanel(2);
00497     DoDataExchange_Globals(theDialog, true);
00498     multiView->SwitchToPanel(1);
00499     DoDataExchange_DiffMain(theDialog, noRecurs, isDate1, isDate2, sLastRev1, sLastRev2,
00500         hasRev1, hasRev2, true);
00501
00502     groupView->SetValue(sRuntimePanel);
00503     theDialog->Show();
00504     MessageT hitMessage;
00505     while (true)
00506     {       // Let DialogHandler process events
00507         hitMessage = theHandler.DoDialog();
00508
00509         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00510             break;
00511     }
00512     theDialog->Hide();
00513     sRuntimePanel = groupView->GetValue();
00514
00515     if(hitMessage == msg_OK)
00516     {
00517         multiView->SwitchToPanel(1);
00518         DoDataExchange_DiffMain(theDialog, noRecurs, isDate1, isDate2, sLastRev1, sLastRev2,
00519             hasRev1, hasRev2, false);
00520         multiView->SwitchToPanel(2);
00521         DoDataExchange_Globals(theDialog, false);
00522         userHitOK = true;
00523     }
00524 #endif /* qMacCvsPP */
00525 #if qUnix
00526     void *wid = UCreate_DiffDlg();
00527
00528     UCvsDiff *dlg = new UCvsDiff();
00529     UCvsDiff_MAIN *tab1 = new UCvsDiff_MAIN(sLastRev1, sLastRev2, allowExtDiff);
00530     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00531     dlg->AddPage(tab1, UCvsDiff::kTabGeneral, 0);
00532
00533     if(dlg->DoModal())
00534     {
00535         noRecurs = tab1->m_norecurs;
00536
00537         sLastRev1 = tab1->m_str1;
00538         sLastRev2 = tab1->m_str2;
00539         isDate1 = tab1->m_check1;
00540         isDate2 = tab1->m_check2;
00541         gUseExtDiff = tab1->m_extdiff;
00542         if(tab1->m_diff == 0)
00543         {
00544             hasRev1 = hasRev2 = false;
00545         }
00546         else if(tab1->m_diff == 1)
00547         {
00548             hasRev1 = true;
00549             hasRev2 = false;
00550         }
00551         else
00552         {
00553             hasRev1 = true;
00554             hasRev2 = true;
00555         }
00556
00557         userHitOK = true;
00558     }
00559
00560     delete dlg;
00561 #endif // qUnix
00562
00563     if(userHitOK)
00564     {
00565         if(hasRev1)
00566             rev1 = sLastRev1;
00567         if(hasRev2)
00568             rev2 = sLastRev2;
00569         useExtDiff = (bool)gUseExtDiff;
00570
00571         bNoWhiteSpace = noWhiteSpace;
00572         bIgnoreCare = ignoreCare;
00573
00574         gCvsPrefs.save();
00575     }
00576
00577     return userHitOK;
00578 }

CPersistentBool gUseExtDiff | ( | "P_DiffUseExtDiff" | ,
 |  | false |
 | ) | [static]

Generated on Sun Oct 21 12:42:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


DiffDlg.h File Reference

common/DiffDlg.h File Reference

#include "CPStr.h"

Include dependency graph for DiffDlg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_DIFFDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Functions

bool | CompatGetDiff (bool &noRecurs, bool &isDate1, bool &isDate2, UPStr &rev1, UPStr &rev2, bool &useExtDiff, bool &noWhiteSpace, bool &ignoreCase, bool allowExtDiff=false)

Define Documentation

#define AFX_DIFFDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file DiffDlg.h.

Function Documentation

bool CompatGetDiff | ( | bool & | noRecurs,
 |  | bool & | isDate1,
 |  | bool & | isDate2,
 |  | UPStr & | rev1,
 |  | UPStr & | rev2,
 |  | bool & | useExtDiff,
 |  | bool & | noWhiteSpace,
 |  | bool & | ignoreCase,
 |  | bool | allowExtDiff = false
 | ) |

Definition at line 424 of file DiffDlg.cpp.

Referenced by CvsCmdDiffFiles(), and CvsCmdDiffFolder().

00428 {
00429     bool userHitOK = false;
00430
00431     static CPStr sLastRev1;
00432     static CPStr sLastRev2;
00433     static bool bNoWhiteSpace = false;
00434     static bool bIgnoreCare = false;
00435
00436     rev1 = "";
00437     rev2 = "";
00438     noRecurs = false;
00439     isDate1 = false;
00440     isDate2 = false;
00441     useExtDiff = (bool)gUseExtDiff;
00442     noWhiteSpace = bNoWhiteSpace;
00443     ignoreCare = bIgnoreCare;
00444     bool hasRev1 = false;
00445     bool hasRev2 = false;
00446
00447 #ifdef WIN32
00448     COptionalPropertySheet pages(gCvsPrefs.HideCommandDlgDiff(), "Diff settings");
00449     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00450     CDiff_MAIN page1(sLastRev1, sLastRev2, allowExtDiff, noWhiteSpace, ignoreCare);
00451     CGetPrefs_GLOBALS page2;
00452     pages.AddPage(&page1);
00453     pages.AddPage(&page2);
00454     if(pages.DoModal() == IDOK)
00455     {
00456         noRecurs = page1.m_norecurs == TRUE;
00457
00458         sLastRev1 = page1.m_str1;
00459         sLastRev2 = page1.m_str2;
00460         isDate1 = page1.m_check1 == TRUE;
00461         isDate2 = page1.m_check2 == TRUE;
00462         gUseExtDiff = page1.m_extdiff == TRUE;
00463         if(page1.m_diff == 0)
00464         {
00465             hasRev1 = hasRev2 = false;
00466         }
00467         else if(page1.m_diff == 1)
00468         {
00469             hasRev1 = true;
00470             hasRev2 = false;
00471         }
00472         else
00473         {
00474             hasRev1 = true;
00475             hasRev2 = true;
00476         }
00477
00478         noWhiteSpace = page1.m_noWhiteSpace == TRUE;
00479         ignoreCare = page1.m_ignoreCase == TRUE;
00480
00481         page2.StoreValues();
00482         gCvsPrefs.SetHideCommandDlgDiff(pages.GetHideCommandDlg());
00483         userHitOK = true;
00484     }
00485 #endif /* WIN32 */
00486 #ifdef qMacCvsPP
00487     StDialogHandler theHandler(dlg_Diff, LCommander::GetTopCommander());
00488     LWindow *theDialog = theHandler.GetDialog();
00489     ThrowIfNil_(theDialog);
00490     static UInt16 sRuntimePanel = 1;
00491
00492     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00493         (theDialog->FindPaneByID(item_MultiViewPrefs));
00494     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00495
00496     multiView->SwitchToPanel(2);
00497     DoDataExchange_Globals(theDialog, true);
00498     multiView->SwitchToPanel(1);
00499     DoDataExchange_DiffMain(theDialog, noRecurs, isDate1, isDate2, sLastRev1, sLastRev2,
00500         hasRev1, hasRev2, true);
00501
00502     groupView->SetValue(sRuntimePanel);
00503     theDialog->Show();
00504     MessageT hitMessage;
00505     while (true)
00506     {       // Let DialogHandler process events
00507         hitMessage = theHandler.DoDialog();
00508
00509         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00510             break;
00511     }
00512     theDialog->Hide();
00513     sRuntimePanel = groupView->GetValue();
00514
00515     if(hitMessage == msg_OK)
00516     {
00517         multiView->SwitchToPanel(1);
00518         DoDataExchange_DiffMain(theDialog, noRecurs, isDate1, isDate2, sLastRev1, sLastRev2,
00519             hasRev1, hasRev2, false);
00520         multiView->SwitchToPanel(2);
00521         DoDataExchange_Globals(theDialog, false);
00522         userHitOK = true;
00523     }
00524 #endif /* qMacCvsPP */
00525 #if qUnix
00526     void *wid = UCreate_DiffDlg();
00527
00528     UCvsDiff *dlg = new UCvsDiff();
00529     UCvsDiff_MAIN *tab1 = new UCvsDiff_MAIN(sLastRev1, sLastRev2, allowExtDiff);
00530     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00531     dlg->AddPage(tab1, UCvsDiff::kTabGeneral, 0);
00532
00533     if(dlg->DoModal())
00534     {
00535         noRecurs = tab1->m_norecurs;
00536
00537         sLastRev1 = tab1->m_str1;
00538         sLastRev2 = tab1->m_str2;
00539         isDate1 = tab1->m_check1;
00540         isDate2 = tab1->m_check2;
00541         gUseExtDiff = tab1->m_extdiff;
00542         if(tab1->m_diff == 0)
00543         {
00544             hasRev1 = hasRev2 = false;
00545         }
00546         else if(tab1->m_diff == 1)
00547         {
00548             hasRev1 = true;
00549             hasRev2 = false;
00550         }
00551         else
00552         {
00553             hasRev1 = true;
00554             hasRev2 = true;
00555         }
00556
00557         userHitOK = true;
00558     }
00559
00560     delete dlg;
00561 #endif // qUnix
00562
00563     if(userHitOK)
00564     {
00565         if(hasRev1)
00566             rev1 = sLastRev1;
00567         if(hasRev2)
00568             rev2 = sLastRev2;
00569         useExtDiff = (bool)gUseExtDiff;
00570
00571         bNoWhiteSpace = noWhiteSpace;
00572         bIgnoreCare = ignoreCare;
00573
00574         gCvsPrefs.save();
00575     }
00576
00577     return userHitOK;
00578 }

Generated on Sun Oct 21 12:42:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dll_garbage.c File Reference

common/dll_garbage.c File Reference

#include <stdio.h>
#include "dll_garbage.h"

Include dependency graph for dll_garbage.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | _frameRec
struct | DYN_LIST
struct | garbyRec
struct | poolRec

Defines

#define | AUTO_INITALIZE 0
#define | qRangeCheck 0
#define | platform_calloc(s1, s2) calloc(s1, s2)
#define | platform_malloc(s) malloc(s)
#define | platform_realloc(p, s) realloc(p, s)
#define | platform_free(p) free(p)
#define | GARBY_DEF_ALLOC 20
#define | GARBY_DEF_POOL 20
#define | MODULE_SIZE 8
#define | garbyFree(ptr) garby_free(ptr)
#define | garbyAlloc(ptr, line, file) garby_alloc(ptr)
#define | garbyRealloc(ptr, NewPtr, line, file) garby_realloc(ptr, NewPtr)

Typedefs

typedef _frameRec | frameRec
typedef DYN_LIST | DYN_LIST
typedef * | poolPtr
typedef * | garbyPtr

Functions

DYN_LIST * | listNew (int sizeOfCell, int numOfDefaultCell)
void | listFree (DYN_LIST *list)
void * | listAddCell (DYN_LIST *list)
void * | garby_alloc (void *ptr)
void * | garby_realloc (void *ptr, void *newptr)
void * | garby_free (void *ptr)
void * | shl_malloc (size_t size)
void * | shl_calloc (size_t nmemb, size_t size)
void * | shl_realloc (void *ptr, size_t size)
void | shl_free (void *ptr)

Variables

garbyPtr | gGarbage = NULL

Define Documentation

#define AUTO_INITALIZE 0

Definition at line 46 of file dll_garbage.c.

#define GARBY_DEF_ALLOC 20

Definition at line 261 of file dll_garbage.c.

#define GARBY_DEF_POOL 20

Definition at line 262 of file dll_garbage.c.

#define MODULE_SIZE 8

Definition at line 263 of file dll_garbage.c.

#define garbyAlloc | ( | ptr,
 |  | line,
 |  | file | ) | garby_alloc(ptr)

Definition at line 633 of file dll_garbage.c.

Referenced by shl_realloc().

#define garbyFree ( ptr ) garby_free(ptr)

Definition at line 621 of file dll_garbage.c.

Referenced by shl_free().

#define garbyRealloc | ( | ptr,
 |  | NewPtr,
 |  | line,
 |  | file | ) | garby_realloc(ptr, NewPtr)

Definition at line 634 of file dll_garbage.c.

#define platform_calloc | ( | s1,
 |  | s2 | ) | calloc(s1, s2)

Definition at line 93 of file dll_garbage.c.

#define platform_free ( p ) free(p)

Definition at line 96 of file dll_garbage.c.

Referenced by listFree(), and shl_free().

#define platform_malloc ( s ) malloc(s)

Definition at line 94 of file dll_garbage.c.

Referenced by listAddCell(), listNew(), and shl_realloc().

#define platform_realloc | ( | p,
 |  | s | ) | realloc(p, s)

Definition at line 95 of file dll_garbage.c.

#define qRangeCheck 0

Definition at line 52 of file dll_garbage.c.

Typedef Documentation

typedef struct DYN_LIST DYN_LIST

typedef struct _frameRec frameRec

typedef * garbyPtr

typedef * poolPtr

Function Documentation

void * garby_alloc ( void * ptr ) [static]

Definition at line 640 of file dll_garbage.c.

00642 {
00643 #if AUTO_INITALIZE
00644     if(gGarbage == 0L)
00645         garbyNew();
00646 #endif /* AUTO_INITALIZE */
00647
00648     if(gGarbage == NULL || ptr == NULL)
00649         return ptr;
00650
00651 #if qCvsDebug
00652     return poolAlloc(&gGarbage->pools[GARBY_KEY(ptr)], ptr, line, file);
00653 #else
00654     return poolAlloc(&gGarbage->pools[GARBY_KEY(ptr)], ptr);
00655 #endif
00656 }

void* garby_free ( void * ptr ) [static]

Definition at line 658 of file dll_garbage.c.

00659 {
00660     if(gGarbage == NULL || ptr == NULL)
00661         return ptr;
00662
00663     return poolFree(&gGarbage->pools[GARBY_KEY(ptr)], ptr);
00664 }

void * garby_realloc | ( | void * | ptr,
 |  | void * | newptr
 | ) | [static]

Definition at line 669 of file dll_garbage.c.

00671 {
00672 #if AUTO_INITALIZE
00673     if(gGarbage == 0L)
00674         garbyNew();
00675 #endif /* AUTO_INITALIZE */
00676
00677     garby_free(ptr);
00678 #if qCvsDebug
00679     return garby_alloc(newptr, line, file);
00680 #else
00681     return garby_alloc(newptr);
00682 #endif
00683 }

void* listAddCell ( DYN_LIST * list ) [static]

Definition at line 340 of file dll_garbage.c.

00341 {
00342     DYN_LIST *current;
00343
00344     current = list->current;
00345
00346     if(current->numentries == list->defaultnumcells)
00347     {
00348         current->next = (DYN_LIST *)platform_malloc(sizeof(DYN_LIST) + list->sizeofcell * list->defaultnumcells);
00349         if(current->next == NULL)
00350         {
00351             fprintf(stderr, "failed to allocate %d bytes\n", sizeof(DYN_LIST) + list->sizeofcell * list->defaultnumcells);
00352             exit(-1);
00353         }
00354
00355         current = current->next;
00356         current->numentries = 0;
00357         current->next = NULL;
00358         list->current = current;
00359         list->totpage++;
00360     }
00361
00362     return (char *)(current + 1) + current->numentries++ * list->sizeofcell;
00363 }

void listFree ( DYN_LIST * list ) [static]

Definition at line 326 of file dll_garbage.c.

00327 {
00328     DYN_LIST *ptc1, *ptc2;
00329
00330     ptc1 = list;
00331     while(ptc1 != NULL)
00332     {
00333         ptc2 = ptc1;
00334         ptc1 = ptc1->next;
00335         platform_free(ptc2);
00336     }
00337 }

DYN_LIST* listNew | ( | int | sizeOfCell,
 |  | int | numOfDefaultCell
 | ) | [static]

Definition at line 305 of file dll_garbage.c.

00306 {
00307     DYN_LIST *result;
00308
00309     result = (DYN_LIST *)platform_malloc(sizeof(DYN_LIST) + sizeOfCell * numOfDefaultCell);
00310     if(result == NULL)
00311     {
00312         fprintf(stderr, "failed to allocate %d bytes\n", sizeof(DYN_LIST) + sizeOfCell * numOfDefaultCell);
00313         exit(-1);
00314     }
00315
00316     result->numentries = result->totpage = 0;
00317     result->defaultnumcells = numOfDefaultCell;
00318     result->sizeofcell = sizeOfCell;
00319     result->next = NULL;
00320     result->current = result;
00321
00322     return result;
00323 }

void* shl_calloc | ( | size_t | nmemb,
 |  | size_t | size
 | ) |

Definition at line 703 of file dll_garbage.c.

00705 {
00706     char *ptr;
00707
00708     if (nmemb == 0 || size == 0)
00709         return NULL;
00710
00711     ptr = (char *)platform_calloc(nmemb, size);
00712     return garbyAlloc(ptr, line, file);
00713 }

void shl_free ( void * ptr )

Definition at line 742 of file dll_garbage.c.

00743 {
00744     if (ptr != NULL)
00745         platform_free (garbyFree(ptr));
00746 }

void* shl_malloc ( size_t size )

Definition at line 688 of file dll_garbage.c.

00690 {
00691     char *ptr;
00692
00693     if (size == 0)
00694         return NULL;
00695
00696     ptr = (char *)platform_malloc(size);
00697     return garbyAlloc(ptr, line, file);
00698 }

void* shl_realloc | ( | void * | ptr,
 |  | size_t | size
 | ) |

Definition at line 718 of file dll_garbage.c.

00720 {
00721     char *Newptr;
00722
00723     if (ptr == NULL)
00724     {
00725         Newptr = (char *)platform_malloc(size);
00726         return garbyAlloc(Newptr, line, file);
00727     }
00728
00729     if (size == 0)
00730     {
00731         platform_free(garbyFree(ptr));
00732         return NULL;
00733     }
00734
00735     Newptr = (char *)platform_realloc(ptr, size);
00736     if(Newptr == ptr)
00737         return ptr;
00738
00739     return garbyRealloc(ptr, Newptr, line, file);
00740 }

Variable Documentation

garbyPtr gGarbage = NULL [static]

Definition at line 302 of file dll_garbage.c.

Generated on Sun Oct 21 12:42:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dll_garbage.h File Reference

common/dll_garbage.h File Reference

#include <stdlib.h>

Include dependency graph for dll_garbage.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | malloc shl_malloc
#define | calloc shl_calloc
#define | realloc shl_realloc
#define | free shl_free

Functions

void * | shl_calloc (size_t nmemb, size_t size)
void * | shl_malloc (size_t size)
void * | shl_realloc (void *ptr, size_t size)
void | shl_free (void *ptr)
void | garbyNew (void)
void | garbyRemove (int verboseSummary, int verboseMemoryLeak)

Define Documentation

#define calloc shl_calloc

Definition at line 46 of file dll_garbage.h.

Referenced by SIG_init(), and CCJHexEdit::SelInsert().

#define free shl_free

Definition at line 53 of file dll_garbage.h.

Referenced by CvsLogParse(), FileTraverse(), InitializeInterp(), IsShellType(), MacroTraversal::OnFile(), CWincvsView::OnKeyDown(), PMacBinMaps::PMacBinMaps(), ReadIgnoredFile(), SccAddFromScc(), SccCloseProject(), SccUninitialize(), CCJHexEdit::SelDelete(), CCJHexEdit::SelInsert(), CCJHexEdit::SetData(), PMacBinMaps::SetData(), Tag_Open(), YYFREESTACK(), _gp_console_destroy(), _gp_getenv_destroy(), _gp_quit_destroy(), argvp(), attrs(), attrval(), close_consoles(), closedir(), cvs_process_destroy(), cvs_process_open(), default_branch(), depth(), disposeStr(), entries(), extra_arg(), fgetentent(), filter(), finfo(), UStr::flush(), UPStr::flush(), CLogStr::flush(), free_dircontents(), from(), getpass(), hold(), ign_setup(), ll_delete(), loadSettingsInternal(), macos_start_server(), main(), nlines(), open_module(), opendir(), UStr::operator<<(), MacBinMaps::operator=(), os2_start_server(), piped_child(), CvsArgs::reset(), rev(), rootdir(), run_argc_allocated(), run_popen(), run_setup(), sticky(), unmodified(), update_server(), vers(), vms_start_server(), wire_read_double(), wire_read_string(), wnt_start_server(), wrap_setup(), x_free(), xgetwd(), xprefix(), CAllHandlers::~CAllHandlers(), CCustInvertTable::~CCustInvertTable(), CStaticAllocT::~CStaticAllocT(), CTCLCvsConsole::~CTCLCvsConsole(), CWincvsView::~CWincvsView(), MacBinMaps::~MacBinMaps(), UCvsConsole::~UCvsConsole(), and awidget::~awidget().

#define malloc shl_malloc

Definition at line 45 of file dll_garbage.h.

Referenced by CStaticAllocT::AdjustSize(), CTCLCvsConsole::CTCLCvsConsole(), InitializeInterp(), IsShellType(), CWincvsView::OnKeyDown(), CWincvsView::OutConsole(), UCvsConsole::OutConsole(), MacBinMaps::Reset(), SccAddFromScc(), SccInitialize(), SccOpenProject(), CCJHexEdit::SelDelete(), CCJHexEdit::SetData(), PMacBinMaps::SetData(), _gp_console_read(), _gp_getenv_read(), _gp_quit_read(), CvsArgs::add(), alloca(), build_command(), cvs_process_new(), fillSemiColonTypes(), getdate_yyparse(), getstr(), gp_console_write(), gp_getenv_write(), gp_quit_write(), init_error_tables(), lookup_env(), main(), mystrdup(), opendir(), UStr::operator<<(), UStr::operator=(), UPStr::operator=(), CLogStr::operator=(), CvsArgs::reset(), root_allow_size(), UStr::set(), UPStr::set(), CLogStr::set(), strdup(), unmodified(), wire_read_string(), and wire_register().

#define realloc shl_realloc

Definition at line 47 of file dll_garbage.h.

Referenced by MacBinMaps::AddEntry(), CStaticAllocT::AdjustSize(), MacBinMaps::RemoveEntry(), CvsArgs::add(), CTCLCvsConsole::cvs_out(), fillSemiColonTypes(), getdate_yyparse(), getstr(), opendir(), UPStr::operator<<(), CLogStr::operator<<(), and root_allow_size().

Function Documentation

void garbyNew ( void )

Referenced by __cvs_initialize().

void garbyRemove | ( | int | verboseSummary,
 |  | int | verboseMemoryLeak
 | ) |

Referenced by __cvs_terminate(), and flush_all().

void* shl_calloc | ( | size_t | nmemb,
 |  | size_t | size
 | ) |

Definition at line 703 of file dll_garbage.c.

00705 {
00706     char *ptr;
00707
00708     if (nmemb == 0 || size == 0)
00709         return NULL;
00710
00711     ptr = (char *)platform_calloc(nmemb, size);
00712     return garbyAlloc(ptr, line, file);
00713 }

void shl_free ( void * ptr )

Definition at line 742 of file dll_garbage.c.

00743 {
00744     if (ptr != NULL)
00745         platform_free (garbyFree(ptr));
00746 }

void* shl_malloc ( size_t size )

Definition at line 688 of file dll_garbage.c.

00690 {
00691     char *ptr;
00692
00693     if (size == 0)
00694         return NULL;
00695
00696     ptr = (char *)platform_malloc(size);
00697     return garbyAlloc(ptr, line, file);
00698 }

void* shl_realloc | ( | void * | ptr,
 |  | size_t | size
 | ) |

Definition at line 718 of file dll_garbage.c.

00720 {
00721     char *Newptr;
00722
00723     if (ptr == NULL)
00724     {
00725         Newptr = (char *)platform_malloc(size);
00726         return garbyAlloc(Newptr, line, file);
00727     }
00728
00729     if (size == 0)
00730     {
00731         platform_free(garbyFree(ptr));
00732         return NULL;
00733     }
00734
00735     Newptr = (char *)platform_realloc(ptr, size);
00736     if(Newptr == ptr)
00737         return ptr;
00738
00739     return garbyRealloc(ptr, Newptr, line, file);
00740 }

Generated on Sun Oct 21 12:42:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dll_glue.c File Reference

common/dll_glue.c File Reference

#include <unistd.h>
#include <stdio.h>
#include <setjmp.h>
#include <errno.h>
#include "dll_glue.h"
#include "dll_garbage.h"
#include "GUSIMSLSetup.h"

Include dependency graph for dll_glue.c:

Include dependency graph

Go to the source code of this file.

Functions

int | main (int argc, char **argv)
void | dllglue_flushconsole (void)
void | initialize_all (void)
void | flush_all (void)
void | dllglue_exit (int code)
char * | dllglue_getenv (const char *name)
long | dllglue_consoleout (char *buffer, long n)
long | dllglue_consoleerr (char *buffer, long n)
long | dllglue_consolein (char *buffer, long n)
int | dllglue_dispatchevent (EventRecord *userevent)
int | dllglue_main (const char *path, int argc, char **argv)
int | dllglue_decode_file (char *infile)
int | dllglue_setgetenv (UniversalProcPtr agetenv)
int | dllglue_seteventdispatch (UniversalProcPtr aeventdispatch)
int | dllglue_setconsoleout (UniversalProcPtr aconsoleout)
int | dllglue_setconsoleerr (UniversalProcPtr aconsoleerr)
int | dllglue_setconsolein (UniversalProcPtr aconsolein)
pascal OSErr | __initialize (CFragConnectionID connID)
pascal void | __terminate (void)
pascal OSErr | __cvs_initialize (const CFragInitBlock *theInitBlock)
pascal void | __cvs_terminate (void)

Variables

UniversalProcPtr | __glue_getenv = 0L
UniversalProcPtr | __glue_consoleout = 0L
UniversalProcPtr | __glue_consoleerr = 0L
UniversalProcPtr | __glue_consolein = 0L
UniversalProcPtr | __glue_eventdispatch = 0L
int | __glue_exit_code = 0
jmp_buf | _glue_buf
FSSpec sCvsContainerFileSpec

Function Documentation

pascal OSErr __cvs_initialize ( const CFragInitBlock * theInitBlock )

Definition at line 315 of file dll_glue.c.

00316 {
00317     OSErr result = noErr;
00318
00319     if(CFragHasFileLocation(theInitBlock->fragLocator.where) &&
00320         theInitBlock->fragLocator.u.onDisk.fileSpec != 0L)
00321     {
00322         sCvsContainerFileSpec = *theInitBlock->fragLocator.u.onDisk.fileSpec;
00323     }
00324     garbyNew();
00325
00326     result = __initialize(theInitBlock->connectionID);
00327
00328     return result;
00329 }

pascal void __cvs_terminate ( void )

Definition at line 331 of file dll_glue.c.

00332 {
00333     __terminate();
00334
00335     garbyRemove(false, false);
00336 }

pascal OSErr __initialize ( CFragConnectionID connID )

Referenced by __cvs_initialize().

pascal void __terminate ( void )

Referenced by __cvs_terminate().

long dllglue_consoleerr | ( | char * | buffer,
 |  | long | n
 | ) |

Definition at line 120 of file dll_glue.c.

00121 {
00122 #if !TARGET_API_MAC_CARBON
00123     if(__glue_consoleerr != 0L)
00124     {
00125         return (int)CallUniversalProc(__glue_consoleerr, uppConsoleOutProcInfo, buffer, n);
00126     }
00127 #else
00128     if(__glue_consoleerr != 0L)
00129     {
00130         return __glue_consoleerr(buffer, n);
00131     }
00132 #endif
00133     return 0;
00134 }

long dllglue_consolein | ( | char * | buffer,
 |  | long | n
 | ) |

Definition at line 136 of file dll_glue.c.

00137 {
00138 #if !TARGET_API_MAC_CARBON
00139     if(__glue_consolein != 0L)
00140     {
00141         return (int)CallUniversalProc(__glue_consolein, uppConsoleInProcInfo, buffer, n);
00142     }
00143 #else
00144     if(__glue_consolein != 0L)
00145     {
00146         return __glue_consolein(buffer, n);
00147     }
00148 #endif
00149     return 0;
00150 }

long dllglue_consoleout | ( | char * | buffer,
 |  | long | n
 | ) |

Definition at line 104 of file dll_glue.c.

00105 {
00106 #if !TARGET_API_MAC_CARBON
00107     if(__glue_consoleout != 0L)
00108     {
00109         return (int)CallUniversalProc(__glue_consoleout, uppConsoleOutProcInfo, buffer, n);
00110     }
00111 #else
00112     if(__glue_consoleout != 0L)
00113     {
00114         return __glue_consoleout(buffer, n);
00115     }
00116 #endif
00117     return 0;
00118 }

int dllglue_decode_file ( char * infile )

Definition at line 193 of file dll_glue.c.

00194 {
00195     if(setjmp(_glue_buf) == 0)
00196     {
00197         initialize_all();
00198
00199         __glue_exit_code = decode_file (infile);
00200     }
00201     else
00202     {
00203     }
00204
00205     flush_all();
00206
00207     return __glue_exit_code;
00208 }

int dllglue_dispatchevent ( EventRecord * userevent )

Definition at line 152 of file dll_glue.c.

00153 {
00154 #if !TARGET_API_MAC_CARBON
00155     if(__glue_eventdispatch != 0L)
00156     {
00157         return (int)CallUniversalProc(__glue_eventdispatch, uppEventDispatchProcInfo, userevent);
00158     }
00159 #else
00160     if(__glue_eventdispatch != 0L)
00161     {
00162         return __glue_eventdispatch(userevent);
00163     }
00164 #endif
00165     return 0;
00166 }

void dllglue_exit ( int code )

Definition at line 84 of file dll_glue.c.

00085 {
00086     __glue_exit_code = code;
00087     longjmp(_glue_buf, 1);
00088 }

void dllglue_flushconsole ( void )

Definition at line 58 of file dll_glue.c.

Referenced by flush_all(), and yesno().

00059 {
00060     fflush(stdout);
00061     fflush(stderr);
00062 }

char* dllglue_getenv ( const char * name )

Definition at line 91 of file dll_glue.c.

00092 {
00093     if(__glue_getenv != 0L)
00094     {
00095 #if !TARGET_API_MAC_CARBON
00096         return (char *)CallUniversalProc(__glue_getenv, uppGetEnvProcInfo, name);
00097 #else /* TARGET_API_MAC_CARBON */
00098         return __glue_getenv(name);
00099 #endif /* TARGET_API_MAC_CARBON */
00100     }
00101     return 0L;
00102 }

int dllglue_main | ( | const char * | path,
 |  | int | argc,
 |  | char ** | argv
 | ) |

Definition at line 169 of file dll_glue.c.

00170 {
00171     if(setjmp(_glue_buf) == 0)
00172     {
00173         initialize_all();
00174
00175         if(path != 0L && chdir(path) != 0)
00176         {
00177             fprintf(stderr, "Error: Unable to chdir %s (error %d)\n", path, errno);
00178             exit(1);
00179         }
00180
00181         main(argc, argv);
00182     }
00183     else
00184     {
00185     }
00186
00187     flush_all();
00188
00189     return __glue_exit_code;
00190 }

int dllglue_setconsoleerr ( UniversalProcPtr aconsoleerr )

Definition at line 267 of file dll_glue.c.

00271 {
00272     if(__glue_consoleerr != 0L)
00273     {
00274 #if !TARGET_API_MAC_CARBON
00275         DisposeRoutineDescriptor(__glue_consoleerr);
00276 #endif /* !TARGET_API_MAC_CARBON */
00277         __glue_consoleerr = 0L;
00278     }
00279     __glue_consoleerr = aconsoleerr;
00280     return 0;
00281 }

int dllglue_setconsolein ( UniversalProcPtr aconsolein )

Definition at line 285 of file dll_glue.c.

00289 {
00290     if(__glue_consolein != 0L)
00291     {
00292 #if !TARGET_API_MAC_CARBON
00293         DisposeRoutineDescriptor(__glue_consolein);
00294 #endif /* !TARGET_API_MAC_CARBON */
00295         __glue_consolein = 0L;
00296     }
00297     __glue_consolein = aconsolein;
00298     return 0;
00299 }

int dllglue_setconsoleout ( UniversalProcPtr aconsoleout )

Definition at line 249 of file dll_glue.c.

00253 {
00254     if(__glue_consoleout != 0L)
00255     {
00256 #if !TARGET_API_MAC_CARBON
00257         DisposeRoutineDescriptor(__glue_consoleout);
00258 #endif /* !TARGET_API_MAC_CARBON */
00259         __glue_consoleout = 0L;
00260     }
00261     __glue_consoleout = aconsoleout;
00262     return 0;
00263 }

int dllglue_seteventdispatch ( UniversalProcPtr adispatch )

Definition at line 230 of file dll_glue.c.

00235 {
00236 #if !TARGET_API_MAC_CARBON
00237     if(__glue_eventdispatch != 0L)
00238     {
00239         DisposeRoutineDescriptor(__glue_eventdispatch);
00240         __glue_eventdispatch = 0L;
00241     }
00242 #endif
00243     __glue_eventdispatch = aeventdispatch;
00244     return 0;
00245 }

int dllglue_setgetenv ( UniversalProcPtr agetenv )

Definition at line 212 of file dll_glue.c.

00216 {
00217     if(__glue_getenv != 0L)
00218     {
00219 #if !TARGET_API_MAC_CARBON
00220         DisposeRoutineDescriptor(__glue_getenv);
00221 #endif /* !TARGET_API_MAC_CARBON */
00222         __glue_getenv = 0L;
00223     }
00224     __glue_getenv = agetenv;
00225     return 0;
00226 }

void flush_all ( void ) [static]

Definition at line 72 of file dll_glue.c.

Referenced by dllglue_decode_file(), and dllglue_main().

00073 {
00074     garbyRemove(true, false);
00075     dllglue_flushconsole();
00076     dllglue_setgetenv(0L);
00077     dllglue_setconsoleout(0L);
00078     dllglue_setconsoleerr(0L);
00079     dllglue_setconsolein(0L);
00080     dllglue_seteventdispatch(0L);
00081 }

void initialize_all ( void ) [static]

Definition at line 64 of file dll_glue.c.

Referenced by dllglue_decode_file(), and dllglue_main().

00065 {
00066     GusiMSLSetWriteConsole(dllglue_consoleout);
00067     GusiMSLSetErrConsole(dllglue_consoleerr);
00068     GusiMSLSetInConsole(dllglue_consolein);
00069     GusiMSLSetHandleEvent(dllglue_dispatchevent);
00070 }

int main | ( | int | argc,
 |  | char ** | argv
 | ) |

Definition at line 80 of file main.cpp.

00081 {
00082     int c;
00083     int option_index = 0;
00084     bool outGraph = false;
00085     CLogStr output;
00086     CLogStr input;
00087
00088 #if qCvsDebug
00089     yydebug = 0;
00090     yy_flex_debug = 0;
00091 #endif
00092
00093     while ((c = getopt_long
00094             (argc, argv, "+o:f:g123vh", long_options, &option_index))
00095            != EOF)
00096     {
00097         switch (c)
00098         {
00099         case '1':
00100 #if qCvsDebug
00101             yy_flex_debug = 1;
00102 #endif
00103             break;
00104         case '2':
00105 #if qCvsDebug
00106             yydebug = 1;
00107 #endif
00108             break;
00109         case '3':
00110 #if qCvsDebug
00111             yydebug = 1;
00112             yy_flex_debug = 1;
00113 #endif
00114             break;
00115         case 'h':
00116             usage (cmd_usage);
00117             break;
00118         case 'g':
00119             outGraph = true;
00120             break;
00121         case 'v':
00122             outGraph = false;
00123             break;
00124         case 'o':
00125             output = optarg;
00126             break;
00127         case 'f':
00128             input = optarg;
00129             break;
00130         case '*':
00131             cerr << "Version of " << argv[0] << " is $Revision: 1.2 $\n";
00132             exit(1);
00133             break;
00134         case '?':
00135         default:
00136             usage (cmd_usage);
00137         }
00138     }
00139
00140     argc -= optind;
00141     argv += optind;
00142     if (argc != 0)
00143         usage (cmd_usage);
00144
00145     if(!input.empty())
00146     {
00147         yyin = fopen(input, "r");
00148         if(yyin == 0L)
00149         {
00150             cerr << "Error while opening '" << input << "'\n";
00151             exit(errno);
00152         }
00153     }
00154     else
00155         yyin = stdin;
00156     yyreset();
00157     yyrestart(yyin);
00158     yyparse();
00159
00160     if(outGraph)
00161     {
00162         yygraph();
00163     }
00164     else
00165     {
00166         filebuf fbuf;
00167         streambuf *buf = 0L;
00168
00169         if(!output.empty())
00170         {
00171             buf = fbuf.open(output, "w");
00172             if(buf == 0L)
00173             {
00174                 cerr << "Error while opening '" << output << "'\n";
00175                 exit(errno);
00176             }
00177             ostream out(buf);
00178             yyoutput(out);
00179             fbuf.close();
00180         }
00181         else
00182             yyoutput(cout);
00183     }
00184     if(!input.empty())
00185         fclose(yyin);
00186 }

Variable Documentation

UniversalProcPtr __glue_consoleerr = 0L [static]

Definition at line 41 of file dll_glue.c.

Referenced by dllglue_consoleerr().

UniversalProcPtr __glue_consolein = 0L [static]

Definition at line 42 of file dll_glue.c.

Referenced by dllglue_consolein().

UniversalProcPtr __glue_consoleout = 0L [static]

Definition at line 40 of file dll_glue.c.

Referenced by dllglue_consoleout().

UniversalProcPtr __glue_eventdispatch = 0L [static]

Definition at line 43 of file dll_glue.c.

Referenced by dllglue_dispatchevent().

int __glue_exit_code = 0 [static]

Definition at line 52 of file dll_glue.c.

UniversalProcPtr __glue_getenv = 0L [static]

Definition at line 39 of file dll_glue.c.

Referenced by dllglue_getenv().

jmp_buf _glue_buf [static]

Definition at line 53 of file dll_glue.c.

FSSpec sCvsContainerFileSpec

Definition at line 313 of file dll_glue.c.

Generated on Sun Oct 21 12:42:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dll_glue.h File Reference

common/dll_glue.h File Reference

#include <stdlib.h>
#include "dll_process.h"
#include <Events.h>

Include dependency graph for dll_glue.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | exit dllglue_exit
#define | getenv dllglue_getenv

Functions

int | dllglue_decode_file (char *infile)
int | dllglue_main (const char *path, int argc, char **argv)
int | dllglue_setgetenv (UniversalProcPtr agetenv)
int | dllglue_setconsoleout (UniversalProcPtr aconsoleout)
int | dllglue_setconsoleerr (UniversalProcPtr aconsoleerr)
int | dllglue_setconsolein (UniversalProcPtr aconsolein)
int | dllglue_seteventdispatch (UniversalProcPtr adispatch)
void | dllglue_exit (int code)
char * | dllglue_getenv (const char *)
int | dllglue_dispatchevent (EventRecord *userevent)
long | dllglue_consoleout (char *buffer, long n)
long | dllglue_consoleerr (char *buffer, long n)
long | dllglue_consolein (char *buffer, long n)
void | dllglue_flushconsole (void)

Define Documentation

#define exit dllglue_exit

Definition at line 57 of file dll_glue.h.

#define getenv dllglue_getenv

Definition at line 58 of file dll_glue.h.

Function Documentation

long dllglue_consoleerr | ( | char * | buffer,
 |  | long | n
 | ) |

Definition at line 120 of file dll_glue.c.

00121 {
00122 #if !TARGET_API_MAC_CARBON
00123     if(__glue_consoleerr != 0L)
00124     {
00125         return (int)CallUniversalProc(__glue_consoleerr, uppConsoleOutProcInfo, buffer, n);
00126     }
00127 #else
00128     if(__glue_consoleerr != 0L)
00129     {
00130         return __glue_consoleerr(buffer, n);
00131     }
00132 #endif
00133     return 0;
00134 }

long dllglue_consolein | ( | char * | buffer,
 |  | long | n
 | ) |

Definition at line 136 of file dll_glue.c.

00137 {
00138 #if !TARGET_API_MAC_CARBON
00139     if(__glue_consolein != 0L)
00140     {
00141         return (int)CallUniversalProc(__glue_consolein, uppConsoleInProcInfo, buffer, n);
00142     }
00143 #else
00144     if(__glue_consolein != 0L)
00145     {
00146         return __glue_consolein(buffer, n);
00147     }
00148 #endif
00149     return 0;
00150 }

long dllglue_consoleout | ( | char * | buffer,
 |  | long | n
 | ) |

Definition at line 104 of file dll_glue.c.

00105 {
00106 #if !TARGET_API_MAC_CARBON
00107     if(__glue_consoleout != 0L)
00108     {
00109         return (int)CallUniversalProc(__glue_consoleout, uppConsoleOutProcInfo, buffer, n);
00110     }
00111 #else
00112     if(__glue_consoleout != 0L)
00113     {
00114         return __glue_consoleout(buffer, n);
00115     }
00116 #endif
00117     return 0;
00118 }

int dllglue_decode_file ( char * infile )

Definition at line 193 of file dll_glue.c.

00194 {
00195     if(setjmp(_glue_buf) == 0)
00196     {
00197         initialize_all();
00198
00199         __glue_exit_code = decode_file (infile);
00200     }
00201     else
00202     {
00203     }
00204
00205     flush_all();
00206
00207     return __glue_exit_code;
00208 }

int dllglue_dispatchevent ( EventRecord * userevent )

Definition at line 152 of file dll_glue.c.

00153 {
00154 #if !TARGET_API_MAC_CARBON
00155     if(__glue_eventdispatch != 0L)
00156     {
00157         return (int)CallUniversalProc(__glue_eventdispatch, uppEventDispatchProcInfo, userevent);
00158     }
00159 #else
00160     if(__glue_eventdispatch != 0L)
00161     {
00162         return __glue_eventdispatch(userevent);
00163     }
00164 #endif
00165     return 0;
00166 }

void dllglue_exit ( int code )

Definition at line 84 of file dll_glue.c.

00085 {
00086     __glue_exit_code = code;
00087     longjmp(_glue_buf, 1);
00088 }

void dllglue_flushconsole ( void )

Definition at line 58 of file dll_glue.c.

00059 {
00060     fflush(stdout);
00061     fflush(stderr);
00062 }

char* dllglue_getenv ( const char * name )

Definition at line 91 of file dll_glue.c.

00092 {
00093     if(__glue_getenv != 0L)
00094     {
00095 #if !TARGET_API_MAC_CARBON
00096         return (char *)CallUniversalProc(__glue_getenv, uppGetEnvProcInfo, name);
00097 #else /* TARGET_API_MAC_CARBON */
00098         return __glue_getenv(name);
00099 #endif /* TARGET_API_MAC_CARBON */
00100     }
00101     return 0L;
00102 }

int dllglue_main | ( | const char * | path,
 |  | int | argc,
 |  | char ** | argv
 | ) |

Definition at line 169 of file dll_glue.c.

00170 {
00171     if(setjmp(_glue_buf) == 0)
00172     {
00173         initialize_all();
00174
00175         if(path != 0L && chdir(path) != 0)
00176         {
00177             fprintf(stderr, "Error: Unable to chdir %s (error %d)\n", path, errno);
00178             exit(1);
00179         }
00180
00181         main(argc, argv);
00182     }
00183     else
00184     {
00185     }
00186
00187     flush_all();
00188
00189     return __glue_exit_code;
00190 }

int dllglue_setconsoleerr ( UniversalProcPtr aconsoleerr )

Definition at line 267 of file dll_glue.c.

Referenced by flush_all().

00271 {
00272     if(__glue_consoleerr != 0L)
00273     {
00274 #if !TARGET_API_MAC_CARBON
00275         DisposeRoutineDescriptor(__glue_consoleerr);
00276 #endif /* !TARGET_API_MAC_CARBON */
00277         __glue_consoleerr = 0L;
00278     }
00279     __glue_consoleerr = aconsoleerr;
00280     return 0;
00281 }

int dllglue_setconsolein ( UniversalProcPtr aconsolein )

Definition at line 285 of file dll_glue.c.

Referenced by flush_all().

00289 {
00290     if(__glue_consolein != 0L)
00291     {
00292 #if !TARGET_API_MAC_CARBON
00293         DisposeRoutineDescriptor(__glue_consolein);
00294 #endif /* !TARGET_API_MAC_CARBON */
00295         __glue_consolein = 0L;
00296     }
00297     __glue_consolein = aconsolein;
00298     return 0;
00299 }

int dllglue_setconsoleout ( UniversalProcPtr aconsoleout )

Definition at line 249 of file dll_glue.c.

Referenced by flush_all().

00253 {
00254     if(__glue_consoleout != 0L)
00255     {
00256 #if !TARGET_API_MAC_CARBON
00257         DisposeRoutineDescriptor(__glue_consoleout);
00258 #endif /* !TARGET_API_MAC_CARBON */
00259         __glue_consoleout = 0L;
00260     }
00261     __glue_consoleout = aconsoleout;
00262     return 0;
00263 }

int dllglue_seteventdispatch ( UniversalProcPtr adispatch )

Definition at line 230 of file dll_glue.c.

Referenced by flush_all().

00235 {
00236 #if !TARGET_API_MAC_CARBON
00237     if(__glue_eventdispatch != 0L)
00238     {
00239         DisposeRoutineDescriptor(__glue_eventdispatch);
00240         __glue_eventdispatch = 0L;
00241     }
00242 #endif
00243     __glue_eventdispatch = aeventdispatch;
00244     return 0;
00245 }

int dllglue_setgetenv ( UniversalProcPtr agetenv )

Definition at line 212 of file dll_glue.c.

Referenced by flush_all().

00216 {
00217     if(__glue_getenv != 0L)
00218     {
00219 #if !TARGET_API_MAC_CARBON
00220         DisposeRoutineDescriptor(__glue_getenv);
00221 #endif /* !TARGET_API_MAC_CARBON */
00222         __glue_getenv = 0L;
00223     }
00224     __glue_getenv = agetenv;
00225     return 0;
00226 }

Generated on Sun Oct 21 12:42:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dll_loader.c File Reference

common/dll_loader.c File Reference

#include "dynl.h"
#include <string.h>
#include "dll_loader.h"

Include dependency graph for dll_loader.c:

Include dependency graph

Go to the source code of this file.

Functions

int | CompatLoadLibrary (CompatConnectID *connID, const char *name_dll)
int | CompatCloseLibrary (CompatConnectID *connID)
void * | _CompatCallLibrary (CompatConnectID connID, const char *name_func)

Variables

void * | sCompatProc

Function Documentation

int CompatCloseLibrary ( CompatConnectID * connID )

Definition at line 103 of file dll_loader.c.

00104 {
00105     if(connID == 0L)
00106         return 0;
00107
00108 #ifdef macintosh
00109     CloseConnection(connID);
00110     return 1;
00111 #elif defined(WIN32)
00112     FreeLibrary(*connID);
00113     connID = 0L;
00114     return 1;
00115 #else /* !WIN32 && !macintosh */
00116     dynl_unlink(*connID);
00117     connID = 0L;
00118     return 1;
00119 #endif /* !WIN32 && !macintosh */
00120 }

int CompatLoadLibrary | ( | CompatConnectID * | connID,
 |  | const char * | name_dll
 | ) |

Definition at line 76 of file dll_loader.c.

00077 {
00078     if(connID == 0L)
00079         return 0;
00080
00081 #ifdef macintosh
00082     {
00083     OSErr err;
00084     Ptr mainAddr;
00085     Str255 errMessage;
00086     Str255 pname;
00087
00088     c2pstrcpy(pname, name_dll);
00089     err = GetSharedLibrary(pname, kPowerPCCFragArch, kPrivateCFragCopy, connID, &mainAddr, errMessage);
00090     return err == noErr;
00091     }
00092 #elif defined(WIN32)
00093     *connID = LoadLibrary(name_dll);
00094
00095     return (*connID) != 0L;
00096 #else /* !WIN32 && !macintosh */
00097     *connID = dynl_link(name_dll);
00098     return (*connID) != 0L;
00099 #endif /* !WIN32 && !macintosh */
00100 }

void* _CompatCallLibrary | ( | CompatConnectID | connID,
 |  | const char * | name_func
 | ) |

Definition at line 127 of file dll_loader.c.

00129 {
00130 #ifdef macintosh
00131     ProcPtr symAddr;
00132     UniversalProcPtr proc;
00133     Str255 pname;
00134
00135     c2pstrcpy(pname, name_func);
00136
00137     symAddr = getSymFunction(connID, pname);
00138 #   if TARGET_API_MAC_CARBON
00139     return symAddr;
00140 #   else
00141     if(symAddr == 0L)
00142         return 0L;
00143
00144     proc = NewRoutineDescriptor(symAddr, id_func, kPowerPCISA);
00145     return proc;
00146 #   endif
00147 #elif defined(WIN32)
00148     return GetProcAddress(connID, name_func);
00149 #else /* !WIN32 && !macintosh */
00150     return dynl_func(name_func, connID);
00151 #endif /* !WIN32 && !macintosh */
00152 }

Variable Documentation

void* sCompatProc

Definition at line 45 of file dll_loader.c.

Generated on Sun Oct 21 12:42:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dll_loader.h File Reference

common/dll_loader.h File Reference

#include <dlfcn.h>

Include dependency graph for dll_loader.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | CompatCallLibrary1(ID, res, idf, nf, tf, a1)
#define | CompatCallLibrary2(ID, res, idf, nf, tf, a1, a2)
#define | CompatCallLibrary3(ID, res, idf, nf, tf, a1, a2, a3)
#define | CompatFuncArg(funcInfo, func) func

Typedefs

typedef void * | CompatConnectID

Functions

int | CompatLoadLibrary (CompatConnectID *connID, const char *name_dll)
int | CompatCloseLibrary (CompatConnectID *connID)
void * | _CompatCallLibrary (CompatConnectID connID, const char *name_func)

Variables

void * | sCompatProc

Define Documentation

#define CompatCallLibrary1 | ( | ID,
 |  | res,
 |  | idf,
 |  | nf,
 |  | tf,
 |  | a1 | )

Value:

( \
            sCompatProc = _CompatCallLibrary(ID, nf), \
            res = sCompatProc != NULL ? \
                ((tf)sCompatProc)(a1) : res, \
            sCompatProc != NULL \
        )

Definition at line 83 of file dll_loader.h.

Referenced by decodeCVS(), and loadCVS().

#define CompatCallLibrary2 | ( | ID,
 |  | res,
 |  | idf,
 |  | nf,
 |  | tf,
 |  | a1,
 |  | a2 | )

Value:

( \
            sCompatProc = _CompatCallLibrary(ID, nf), \
            res = sCompatProc != NULL ? \
                ((tf)sCompatProc)(a1, a2) : res, \
            sCompatProc != NULL \
        )

Definition at line 90 of file dll_loader.h.

#define CompatCallLibrary3 | ( | ID,
 |  | res,
 |  | idf,
 |  | nf,
 |  | tf,
 |  | a1,
 |  | a2,
 |  | a3 | )

Value:

( \
            sCompatProc = _CompatCallLibrary(ID, nf), \
            res = sCompatProc != NULL ? \
                ((tf)sCompatProc)(a1, a2, a3) : res, \
            sCompatProc != NULL \
        )

Definition at line 97 of file dll_loader.h.

Referenced by launchCVS().

#define CompatFuncArg | ( | funcInfo,
 |  | func | ) | func

Definition at line 115 of file dll_loader.h.

Referenced by loadCVS().

Typedef Documentation

typedef void* CompatConnectID

Definition at line 35 of file dll_loader.h.

Function Documentation

int CompatCloseLibrary ( CompatConnectID * connID )

Definition at line 103 of file dll_loader.c.

Referenced by CompatConnectID(), loadCVS(), and unloadCVS().

00104 {
00105     if(connID == 0L)
00106         return 0;
00107
00108 #ifdef macintosh
00109     CloseConnection(connID);
00110     return 1;
00111 #elif defined(WIN32)
00112     FreeLibrary(*connID);
00113     connID = 0L;
00114     return 1;
00115 #else /* !WIN32 && !macintosh */
00116     dynl_unlink(*connID);
00117     connID = 0L;
00118     return 1;
00119 #endif /* !WIN32 && !macintosh */
00120 }

int CompatLoadLibrary | ( | CompatConnectID * | connID,
 |  | const char * | name_dll
 | ) |

Definition at line 76 of file dll_loader.c.

Referenced by CompatConnectID(), CTcl_Interp::IsAvail(), CPython_Interp::IsAvail(), and loadCVS().

00077 {
00078     if(connID == 0L)
00079         return 0;
00080
00081 #ifdef macintosh
00082     {
00083     OSErr err;
00084     Ptr mainAddr;
00085     Str255 errMessage;
00086     Str255 pname;
00087
00088     c2pstrcpy(pname, name_dll);
00089     err = GetSharedLibrary(pname, kPowerPCCFragArch, kPrivateCFragCopy, connID, &mainAddr, errMessage);
00090     return err == noErr;
00091     }
00092 #elif defined(WIN32)
00093     *connID = LoadLibrary(name_dll);
00094
00095     return (*connID) != 0L;
00096 #else /* !WIN32 && !macintosh */
00097     *connID = dynl_link(name_dll);
00098     return (*connID) != 0L;
00099 #endif /* !WIN32 && !macintosh */
00100 }

void* _CompatCallLibrary | ( | CompatConnectID | connID,
 |  | const char * | name_func
 | ) |

Definition at line 127 of file dll_loader.c.

Referenced by CompatConnectID().

00129 {
00130 #ifdef macintosh
00131     ProcPtr symAddr;
00132     UniversalProcPtr proc;
00133     Str255 pname;
00134
00135     c2pstrcpy(pname, name_func);
00136
00137     symAddr = getSymFunction(connID, pname);
00138 #   if TARGET_API_MAC_CARBON
00139     return symAddr;
00140 #   else
00141     if(symAddr == 0L)
00142         return 0L;
00143
00144     proc = NewRoutineDescriptor(symAddr, id_func, kPowerPCISA);
00145     return proc;
00146 #   endif
00147 #elif defined(WIN32)
00148     return GetProcAddress(connID, name_func);
00149 #else /* !WIN32 && !macintosh */
00150     return dynl_func(name_func, connID);
00151 #endif /* !WIN32 && !macintosh */
00152 }

Variable Documentation

void* sCompatProc

Definition at line 82 of file dll_loader.h.

Generated on Sun Oct 21 12:42:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dll_process.h File Reference

common/dll_process.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Typedefs

typedef char *(* | dllglue_getenv_func )(const char *)
typedef long(* | dllglue_consoleout_func )(char *, long)
typedef long(* | dllglue_consolein_func )(char *, long)
typedef int(* | dllglue_main_func )(const char *, int, char **)
typedef int(* | dllglue_setglue_func )(void *)

Typedef Documentation

typedef long(* dllglue_consolein_func)(char *, long)

Definition at line 86 of file dll_process.h.

typedef long(* dllglue_consoleout_func)(char *, long)

Definition at line 85 of file dll_process.h.

typedef char*(* dllglue_getenv_func)(const char *)

Definition at line 84 of file dll_process.h.

typedef int(* dllglue_main_func)(const char *, int, char**)

Definition at line 87 of file dll_process.h.

typedef int(* dllglue_setglue_func)(void *)

Definition at line 88 of file dll_process.h.

Generated on Sun Oct 21 12:42:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


EditorMonDlg.cpp File Reference

common/EditorMonDlg.cpp File Reference

#include "stdafx.h"
#include "CvsPrefs.h"
#include "TextBinary.h"

Include dependency graph for EditorMonDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool CompatGetEditorMsg (UStr &message)

Function Documentation

bool CompatGetEditorMsg ( UStr & message )

Definition at line 110 of file EditorMonDlg.cpp.

00111 {
00112     bool msgOK = false;
00113
00114 #ifdef WIN32
00115
00116     if(gCvsPrefs.Viewer() == 0L)
00117     {
00118         AfxMessageBox("You need to define a default viewer in the preferences", MB_OK | MB_ICONSTOP);
00119         return msgOK;
00120     }
00121
00122     CStr tmpFile;
00123     if( MakeTmpFile(tmpFile, "LogMsg", "tmp", true) )
00124     {
00125         //launch editor
00126         PROCESS_INFORMATION sProcessInformation;
00127         if( LaunchEditor( tmpFile, (void*)&sProcessInformation ) )
00128         {
00129             //we don't need the thread's handle so close it now
00130             CloseHandle( sProcessInformation.hThread );
00131
00132             //track the editor until it closes
00133             CStr uppath, folder;
00134             SplitPath(tmpFile, uppath, folder);
00135
00136             CEditorMonDlg editorMonDlg;
00137             editorMonDlg.m_hProcess = sProcessInformation.hProcess;
00138             editorMonDlg.m_tempFile = folder;
00139
00140             if( editorMonDlg.DoModal() == IDOK )
00141             {
00142                 msgOK = true;
00143             }
00144             else
00145             {
00146                 if( PostThreadMessage(sProcessInformation.dwThreadId, WM_QUIT, (WPARAM)EXIT_SUCCESS, 0) )
00147                 {
00148                     WaitForSingleObject( sProcessInformation.hProcess, 500 );
00149                 }
00150
00151                 int nStatus = WaitForSingleObject( sProcessInformation.hProcess, 0 );
00152                 if( nStatus != WAIT_OBJECT_0 )
00153                 {
00154                     TerminateProcess(sProcessInformation.hProcess, EXIT_SUCCESS);
00155                 }
00156             }
00157
00158             CloseHandle(sProcessInformation.hProcess);
00159         }
00160
00161         //copy the file into message string
00162         FILE* stream = fopen(tmpFile, "r");
00163         if( stream )
00164         {
00165             char line[100];
00166             while( fgets(line, 100, stream) )
00167             {
00168                 message << line;
00169             }
00170             fclose(stream);
00171         }
00172
00173         //cleanup
00174         ::DeleteFile(tmpFile);
00175     }
00176
00177 #if 0
00178     adminOptionDlg.m_optionString = (const char*)optionString;
00179     if( adminOptionDlg.DoModal() == IDOK )
00180     {
00181         optionString = (const char*)adminOptionDlg.m_optionString;
00182         userHitOK = true;
00183     }
00184 #endif
00185
00186 #endif /* WIN32 */
00187
00188 // the code below might help to do stuff on Unix or Mac later on
00189 #if 0
00190     const char * argv[2] = { 0L, 0L };
00191     CStr program;
00192     if(strchr(gCvsPrefs.Viewer(), ' ') != 0L)
00193     {
00194         program << '\"';
00195         program << gCvsPrefs.Viewer();
00196         program << '\"';
00197     }
00198     else
00199         program = gCvsPrefs.Viewer();
00200
00201     argv[0] = program;
00202     int process = _spawnvp(_P_NOWAIT, gCvsPrefs.Viewer(), argv);
00203 #endif
00204
00205
00206 #ifdef qMacCvsPP
00207 #endif /* qMacCvsPP */
00208 #if qUnix
00209 #endif // qUnix
00210
00211     return msgOK;
00212 }

Generated on Sun Oct 21 12:42:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


EditorMonDlg.h File Reference

common/EditorMonDlg.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_EDITORMONDLG_H__5146BF16_567B_4017_A1FD_619A7BD07906__INCLUDED_

Functions

bool | CompatGetEditorMsg (UStr &message)

Define Documentation

#define AFX_EDITORMONDLG_H__5146BF16_567B_4017_A1FD_619A7BD07906__INCLUDED_

Definition at line 26 of file EditorMonDlg.h.

Function Documentation

bool CompatGetEditorMsg ( UStr & message )

Definition at line 110 of file EditorMonDlg.cpp.

00111 {
00112     bool msgOK = false;
00113
00114 #ifdef WIN32
00115
00116     if(gCvsPrefs.Viewer() == 0L)
00117     {
00118         AfxMessageBox("You need to define a default viewer in the preferences", MB_OK | MB_ICONSTOP);
00119         return msgOK;
00120     }
00121
00122     CStr tmpFile;
00123     if( MakeTmpFile(tmpFile, "LogMsg", "tmp", true) )
00124     {
00125         //launch editor
00126         PROCESS_INFORMATION sProcessInformation;
00127         if( LaunchEditor( tmpFile, (void*)&sProcessInformation ) )
00128         {
00129             //we don't need the thread's handle so close it now
00130             CloseHandle( sProcessInformation.hThread );
00131
00132             //track the editor until it closes
00133             CStr uppath, folder;
00134             SplitPath(tmpFile, uppath, folder);
00135
00136             CEditorMonDlg editorMonDlg;
00137             editorMonDlg.m_hProcess = sProcessInformation.hProcess;
00138             editorMonDlg.m_tempFile = folder;
00139
00140             if( editorMonDlg.DoModal() == IDOK )
00141             {
00142                 msgOK = true;
00143             }
00144             else
00145             {
00146                 if( PostThreadMessage(sProcessInformation.dwThreadId, WM_QUIT, (WPARAM)EXIT_SUCCESS, 0) )
00147                 {
00148                     WaitForSingleObject( sProcessInformation.hProcess, 500 );
00149                 }
00150
00151                 int nStatus = WaitForSingleObject( sProcessInformation.hProcess, 0 );
00152                 if( nStatus != WAIT_OBJECT_0 )
00153                 {
00154                     TerminateProcess(sProcessInformation.hProcess, EXIT_SUCCESS);
00155                 }
00156             }
00157
00158             CloseHandle(sProcessInformation.hProcess);
00159         }
00160
00161         //copy the file into message string
00162         FILE* stream = fopen(tmpFile, "r");
00163         if( stream )
00164         {
00165             char line[100];
00166             while( fgets(line, 100, stream) )
00167             {
00168                 message << line;
00169             }
00170             fclose(stream);
00171         }
00172
00173         //cleanup
00174         ::DeleteFile(tmpFile);
00175     }
00176
00177 #if 0
00178     adminOptionDlg.m_optionString = (const char*)optionString;
00179     if( adminOptionDlg.DoModal() == IDOK )
00180     {
00181         optionString = (const char*)adminOptionDlg.m_optionString;
00182         userHitOK = true;
00183     }
00184 #endif
00185
00186 #endif /* WIN32 */
00187
00188 // the code below might help to do stuff on Unix or Mac later on
00189 #if 0
00190     const char * argv[2] = { 0L, 0L };
00191     CStr program;
00192     if(strchr(gCvsPrefs.Viewer(), ' ') != 0L)
00193     {
00194         program << '\"';
00195         program << gCvsPrefs.Viewer();
00196         program << '\"';
00197     }
00198     else
00199         program = gCvsPrefs.Viewer();
00200
00201     argv[0] = program;
00202     int process = _spawnvp(_P_NOWAIT, gCvsPrefs.Viewer(), argv);
00203 #endif
00204
00205
00206 #ifdef qMacCvsPP
00207 #endif /* qMacCvsPP */
00208 #if qUnix
00209 #endif // qUnix
00210
00211     return msgOK;
00212 }

Generated on Sun Oct 21 12:42:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


FileTraversal.cpp File Reference

common/FileTraversal.cpp File Reference

#include "stdafx.h"
#include "FileTraversal.h"
#include "CPStr.h"
#include "umain.h"

Include dependency graph for FileTraversal.cpp:

Include dependency graph

Go to the source code of this file.

Functions

kTraversal FileTraverse (const char *path, TraversalReport &report, const FSSpec *macDirSpec)

Function Documentation

kTraversal FileTraverse | ( | const char * | path,
 |  | TraversalReport & | report,
 |  | const FSSpec * | macDirSpec = 0L
 | ) |

Definition at line 95 of file FileTraversal.cpp.

00096 {
00097     DIR *dirp = 0L;
00098     STRUCT_DIRENT *dp;
00099     struct stat sb;
00100     CStr fullname, errstr, dirname, tmpname;
00101     kTraversal res = kContinueTraversal;
00102     char *tmp;
00103     const FSSpec *macspec = 0L;
00104 #if defined(WIN32)
00105     unsigned long dbg_mask = GetWinCvsDebugMask(false);
00106     CStr tracestr;
00107 #endif
00108
00109     // used to restore the current directory
00110     static bool getPathFlag = false;
00111     char* szOriginalPath = NULL;
00112     USemaphore policeman(getPathFlag);
00113     USemaphore runstate(TraversalReport::gRunning);
00114
00115     if(!policeman.IsEnteredTwice())
00116     {
00117         szOriginalPath = getcwd(NULL, MAX_PATH);
00118     }
00119
00120 #ifndef macintosh
00121     if(path == 0L || (dirp = opendir(path)) == 0L)
00122 #else
00123     GUSIFileSpec folderspec;
00124     FSSpec foldermacspec;
00125     if(macDirSpec != 0L)
00126         folderspec = *macDirSpec;
00127     else if(path != 0L)
00128         folderspec = path;
00129     foldermacspec = folderspec;
00130     macspec = &foldermacspec;
00131
00132     if((dirp = opendir(folderspec)) == 0L)
00133 #endif
00134     {
00135         errstr = "Error while accessing ";
00136         errstr << path;
00137         errstr << " (error " << errno << ')';
00138         res =  report.OnError(errstr, errno);
00139         goto exit;
00140     }
00141
00142     tmpname = path;
00143     tmp = tmpname;
00144     char *next;
00145     if(tmpname.endsWith(kPathDelimiter))
00146         tmp[strlen(tmp) - 1] = '\0';
00147     next = tmp;
00148     while((tmp = strchr(next, kPathDelimiter)) != 0L)
00149     {
00150         next = ++tmp;
00151     }
00152     dirname = next;
00153
00154     res = report.EnterDirectory(path, dirname, macspec);
00155     if(res != kContinueTraversal)
00156         goto abort;
00157
00158     while ((dp = readdir (dirp)) != NULL)
00159     {
00160         res = report.OnIdle(path);
00161         if(res != kContinueTraversal)
00162             goto abort;
00163
00164 #ifndef macintosh
00165         if(strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
00166             continue;
00167 #endif /* !macintosh */
00168
00169         fullname = path;
00170         if(!fullname.endsWith(kPathDelimiter))
00171             fullname << kPathDelimiter;
00172         fullname << dp->d_name;
00173
00174         macspec = 0L;
00175         int statres;
00176
00177 #ifdef macintosh
00178         GUSIFileSpec inspec(folderspec);
00179         inspec += dp->d_name;
00180         FSSpec infspec = inspec;
00181         macspec = &infspec;
00182
00183         statres = stat(inspec, &sb);
00184 #else /* macintosh */
00185 #   if defined(WIN32)
00186         if ( (dbg_mask & wcvsdbg_trace_modified_checks) && (dbg_mask & wcvsdbg_verbose) )
00187         {
00188             AppendWinCvsDebugMask(wcvsdbg_trace_dst_checks
00189                                     | wcvsdbg_trace_stat);
00190             tracestr = "Stat(";
00191             tracestr << static_cast<const char *>(fullname);
00192             tracestr << ") ...\n";
00193             cvs_err(tracestr);
00194             OutputDebugString(tracestr);
00195         }
00196 #   endif   // defined(WIN32)
00197
00198         statres = stat(fullname, &sb);
00199 #endif /* macintosh */
00200
00201         if (statres != -1)
00202         {
00203             if(S_ISDIR(sb.st_mode))
00204             {
00205                 res = report.OnDirectory(path, fullname, dp->d_name, sb, macspec);
00206
00207                 if(res == kSkipFile)
00208                     continue;
00209                 if(res != kContinueTraversal)
00210                     goto abort;
00211
00212                 res = FileTraverse(fullname, report, macspec);
00213                 if(res != kContinueTraversal)
00214                     goto abort;
00215
00216             }
00217             else if(S_ISREG(sb.st_mode))
00218             {
00219                 res = report.OnFile(path, fullname, dp->d_name, sb, macspec);
00220                 if(res == kSkipFile)
00221                     continue;
00222                 if(res != kContinueTraversal)
00223                     goto abort;
00224             }
00225 #ifdef S_ISLNK
00226             else if(S_ISLNK(sb.st_mode))
00227             {
00228                 res = report.OnAlias(path, fullname, dp->d_name, sb, macspec);
00229                 if(res == kSkipFile)
00230                     continue;
00231                 if(res != kContinueTraversal)
00232                     goto abort;
00233             }
00234 #endif /* S_ISLNK */
00235             else
00236             {
00237                 /* TODO : Unix devices */
00238                 errstr = "Error while accessing ";
00239                 errstr << fullname;
00240                 errstr << " (error " << errno << ')';
00241                 res = report.OnError(errstr, errno);
00242                 goto abort;
00243             }
00244         }
00245         else
00246         {
00247             errstr = "Error while accessing ";
00248             errstr << fullname;
00249             errstr << " (error " << errno << ')';
00250             res = report.OnError(errstr, errno);
00251             goto abort;
00252         }
00253     }
00254
00255     res = report.ExitDirectory(path);
00256
00257 abort:
00258     closedir (dirp);
00259 exit:
00260     if(0L != szOriginalPath)
00261     {
00262 #ifndef macintosh
00263         chdir(szOriginalPath);
00264 #endif
00265         free(szOriginalPath);
00266         szOriginalPath = NULL;
00267     }
00268
00269 #if defined(WIN32)
00270     SetWinCvsDebugMask(dbg_mask);
00271 #endif  // defined(WIN32)
00272
00273     return res;
00274 }

Generated on Sun Oct 21 12:42:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


FileTraversal.h File Reference

common/FileTraversal.h File Reference

#include "TextBinary.h"
#include <sys/stat.h>
#include <dirent.h>

Include dependency graph for FileTraversal.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | TraversalReport

Defines

#define | AFX_FILETRAVERSAL_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
#define | MAX_PATH 5000
#define | STRUCT_DIRENT struct dirent

Typedefs

typedef int | FSSpec

Enumerations

enum | kTraversal { kContinueTraversal, kStopTraversal, kSkipFile, kTraversalError }

Functions

kTraversal | FileTraverse (const char *path, TraversalReport &report, const FSSpec *macDirSpec=0L)

Define Documentation

#define AFX_FILETRAVERSAL_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file FileTraversal.h.

#define MAX_PATH 5000

Definition at line 70 of file FileTraversal.h.

#define STRUCT_DIRENT struct dirent

Definition at line 80 of file FileTraversal.h.

Typedef Documentation

typedef int FSSpec

Definition at line 38 of file FileTraversal.h.

Enumeration Type Documentation

enum kTraversal

Enumeration values:
kContinueTraversal
kStopTraversal
kSkipFile
kTraversalError

Definition at line 83 of file FileTraversal.h.

00084 {
00085     kContinueTraversal,
00086     kStopTraversal,
00087     kSkipFile,
00088     kTraversalError
00089 } kTraversal;

Function Documentation

kTraversal FileTraverse | ( | const char * | path,
 |  | TraversalReport & | report,
 |  | const FSSpec * | macDirSpec = 0L
 | ) |

Definition at line 95 of file FileTraversal.cpp.

Referenced by AskCreatePersistentSettings(), GetAllPersistentSettings(), HasPersistentSettings(), LoadPersistentSettings(), MacrosReloadAll(), TViewFill::OnDirectory(), TBrowserFill::OnDirectory(), CWinCvsBrowser::OnItemexpanding(), UCvsFolders::OnTreeExpanding(), CWinCvsBrowser::ResetBrowser(), UCvsFolders::ResetBrowser(), CBrowseFileView::ResetView(), UCvsFiles::ResetView(), SavePersistentSettings(), cvsgui_GetCvsEntries(), list_all_types_recur(), and tclCvsEntriesProc().

00096 {
00097     DIR *dirp = 0L;
00098     STRUCT_DIRENT *dp;
00099     struct stat sb;
00100     CStr fullname, errstr, dirname, tmpname;
00101     kTraversal res = kContinueTraversal;
00102     char *tmp;
00103     const FSSpec *macspec = 0L;
00104 #if defined(WIN32)
00105     unsigned long dbg_mask = GetWinCvsDebugMask(false);
00106     CStr tracestr;
00107 #endif
00108
00109     // used to restore the current directory
00110     static bool getPathFlag = false;
00111     char* szOriginalPath = NULL;
00112     USemaphore policeman(getPathFlag);
00113     USemaphore runstate(TraversalReport::gRunning);
00114
00115     if(!policeman.IsEnteredTwice())
00116     {
00117         szOriginalPath = getcwd(NULL, MAX_PATH);
00118     }
00119
00120 #ifndef macintosh
00121     if(path == 0L || (dirp = opendir(path)) == 0L)
00122 #else
00123     GUSIFileSpec folderspec;
00124     FSSpec foldermacspec;
00125     if(macDirSpec != 0L)
00126         folderspec = *macDirSpec;
00127     else if(path != 0L)
00128         folderspec = path;
00129     foldermacspec = folderspec;
00130     macspec = &foldermacspec;
00131
00132     if((dirp = opendir(folderspec)) == 0L)
00133 #endif
00134     {
00135         errstr = "Error while accessing ";
00136         errstr << path;
00137         errstr << " (error " << errno << ')';
00138         res =  report.OnError(errstr, errno);
00139         goto exit;
00140     }
00141
00142     tmpname = path;
00143     tmp = tmpname;
00144     char *next;
00145     if(tmpname.endsWith(kPathDelimiter))
00146         tmp[strlen(tmp) - 1] = '\0';
00147     next = tmp;
00148     while((tmp = strchr(next, kPathDelimiter)) != 0L)
00149     {
00150         next = ++tmp;
00151     }
00152     dirname = next;
00153
00154     res = report.EnterDirectory(path, dirname, macspec);
00155     if(res != kContinueTraversal)
00156         goto abort;
00157
00158     while ((dp = readdir (dirp)) != NULL)
00159     {
00160         res = report.OnIdle(path);
00161         if(res != kContinueTraversal)
00162             goto abort;
00163
00164 #ifndef macintosh
00165         if(strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
00166             continue;
00167 #endif /* !macintosh */
00168
00169         fullname = path;
00170         if(!fullname.endsWith(kPathDelimiter))
00171             fullname << kPathDelimiter;
00172         fullname << dp->d_name;
00173
00174         macspec = 0L;
00175         int statres;
00176
00177 #ifdef macintosh
00178         GUSIFileSpec inspec(folderspec);
00179         inspec += dp->d_name;
00180         FSSpec infspec = inspec;
00181         macspec = &infspec;
00182
00183         statres = stat(inspec, &sb);
00184 #else /* macintosh */
00185 #   if defined(WIN32)
00186         if ( (dbg_mask & wcvsdbg_trace_modified_checks) && (dbg_mask & wcvsdbg_verbose) )
00187         {
00188             AppendWinCvsDebugMask(wcvsdbg_trace_dst_checks
00189                                     | wcvsdbg_trace_stat);
00190             tracestr = "Stat(";
00191             tracestr << static_cast<const char *>(fullname);
00192             tracestr << ") ...\n";
00193             cvs_err(tracestr);
00194             OutputDebugString(tracestr);
00195         }
00196 #   endif   // defined(WIN32)
00197
00198         statres = stat(fullname, &sb);
00199 #endif /* macintosh */
00200
00201         if (statres != -1)
00202         {
00203             if(S_ISDIR(sb.st_mode))
00204             {
00205                 res = report.OnDirectory(path, fullname, dp->d_name, sb, macspec);
00206
00207                 if(res == kSkipFile)
00208                     continue;
00209                 if(res != kContinueTraversal)
00210                     goto abort;
00211
00212                 res = FileTraverse(fullname, report, macspec);
00213                 if(res != kContinueTraversal)
00214                     goto abort;
00215
00216             }
00217             else if(S_ISREG(sb.st_mode))
00218             {
00219                 res = report.OnFile(path, fullname, dp->d_name, sb, macspec);
00220                 if(res == kSkipFile)
00221                     continue;
00222                 if(res != kContinueTraversal)
00223                     goto abort;
00224             }
00225 #ifdef S_ISLNK
00226             else if(S_ISLNK(sb.st_mode))
00227             {
00228                 res = report.OnAlias(path, fullname, dp->d_name, sb, macspec);
00229                 if(res == kSkipFile)
00230                     continue;
00231                 if(res != kContinueTraversal)
00232                     goto abort;
00233             }
00234 #endif /* S_ISLNK */
00235             else
00236             {
00237                 /* TODO : Unix devices */
00238                 errstr = "Error while accessing ";
00239                 errstr << fullname;
00240                 errstr << " (error " << errno << ')';
00241                 res = report.OnError(errstr, errno);
00242                 goto abort;
00243             }
00244         }
00245         else
00246         {
00247             errstr = "Error while accessing ";
00248             errstr << fullname;
00249             errstr << " (error " << errno << ')';
00250             res = report.OnError(errstr, errno);
00251             goto abort;
00252         }
00253     }
00254
00255     res = report.ExitDirectory(path);
00256
00257 abort:
00258     closedir (dirp);
00259 exit:
00260     if(0L != szOriginalPath)
00261     {
00262 #ifndef macintosh
00263         chdir(szOriginalPath);
00264 #endif
00265         free(szOriginalPath);
00266         szOriginalPath = NULL;
00267     }
00268
00269 #if defined(WIN32)
00270     SetWinCvsDebugMask(dbg_mask);
00271 #endif  // defined(WIN32)
00272
00273     return res;
00274 }

Generated on Sun Oct 21 12:42:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


fnmatch.c File Reference

common/fnmatch.c File Reference

#include <errno.h>
#include "fnmatch.h"

Include dependency graph for fnmatch.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | FOLD_FN_CHAR(c) (c)

Functions

int | fnmatch (pattern, string, flags) char *pattern

Variables

int | errno
char * | string
int | flags

Define Documentation

#define FOLD_FN_CHAR ( c ) (c)

Definition at line 40 of file fnmatch.c.

Referenced by fnfold(), and void().

Function Documentation

int fnmatch | ( | pattern | ,
 |  | string | ,
 |  | flags |
 | ) |

Variable Documentation

int errno

Definition at line 44 of file fnmatch.c.

int flags

Definition at line 56 of file fnmatch.c.

char* string

Definition at line 55 of file fnmatch.c.

Generated on Sun Oct 21 12:42:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/fnmatch.c Source File

common/fnmatch.c

Go to the documentation of this file.
00001 /* Copyright (C) 1992 Free Software Foundation, Inc.
00002 This file is part of the GNU C Library.
00003
00004 The GNU C Library is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU Library General Public License as
00006 published by the Free Software Foundation; either version 2 of the
00007 License, or (at your option) any later version.
00008
00009 The GNU C Library is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 Library General Public License for more details.  */
00013
00014 /* Modified slightly by Brian Berliner <berliner@sun.com> and
00015    Jim Blandy <jimb@cyclic.com> for CVS use */
00016
00017 /*
00018  * Modified for WinCvs/MacCVS : Alexandre Parenteau <aubonbeurre@hotmail.com> --- June 1998
00019  */
00020
00021 #ifdef HAVE_CONFIG_H
00022 #include "config.h"
00023 #endif
00024
00025 /* IGNORE(@ */
00026 /* #include <ansidecl.h> */
00027 /* @) */
00028 #include <errno.h>
00029 #include "fnmatch.h"
00030 #ifdef macintosh
00031 #   define not notnot
00032 #endif /* macintosh */
00033
00034 /* Some file systems are case-insensitive.  If FOLD_FN_CHAR is
00035    #defined, it maps the character C onto its "canonical" form.  In a
00036    case-insensitive system, it would map all alphanumeric characters
00037    to lower case.  Under Windows NT, / and \ are both path component
00038    separators, so FOLD_FN_CHAR would map them both to /.  */
00039 #ifndef FOLD_FN_CHAR
00040 #define FOLD_FN_CHAR(c) (c)
00041 #endif
00042
00043 #if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS) && !defined(WIN32) && !defined(macintosh)
00044 extern int errno;
00045 #endif
00046
00047 /* Match STRING against the filename pattern PATTERN, returning zero if
00048    it matches, nonzero if not.  */
00049 int
00050 #if __STDC__
00051 fnmatch (const char *pattern, const char *string, int flags)
00052 #else
00053 fnmatch (pattern, string, flags)
00054     char *pattern;
00055     char *string;
00056     int flags;
00057 #endif
00058 {
00059   register const char *p = pattern, *n = string;
00060   register char c;
00061
00062   if ((flags & ~__FNM_FLAGS) != 0)
00063     {
00064       errno = EINVAL;
00065       return -1;
00066     }
00067
00068   while ((c = *p++) != '\0')
00069     {
00070       switch (c)
00071     {
00072     case '?':
00073       if (*n == '\0')
00074         return FNM_NOMATCH;
00075       else if ((flags & FNM_PATHNAME) && *n == '/')
00076         return FNM_NOMATCH;
00077       else if ((flags & FNM_PERIOD) && *n == '.' &&
00078            (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
00079         return FNM_NOMATCH;
00080       break;
00081
00082     case '\\':
00083       if (!(flags & FNM_NOESCAPE))
00084         c = *p++;
00085       if (*n != c)
00086         return FNM_NOMATCH;
00087       break;
00088
00089     case '*':
00090       if ((flags & FNM_PERIOD) && *n == '.' &&
00091           (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
00092         return FNM_NOMATCH;
00093
00094       for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
00095         if (((flags & FNM_PATHNAME) && *n == '/') ||
00096         (c == '?' && *n == '\0'))
00097           return FNM_NOMATCH;
00098
00099       if (c == '\0')
00100         return 0;
00101
00102       {
00103         char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
00104         for (--p; *n != '\0'; ++n)
00105           if ((c == '[' || *n == c1) &&
00106           fnmatch(p, n, flags & ~FNM_PERIOD) == 0)
00107         return 0;
00108         return FNM_NOMATCH;
00109       }
00110
00111     case '[':
00112       {
00113         /* Nonzero if the sense of the character class is inverted.  */
00114         register int not;
00115
00116         if (*n == '\0')
00117           return FNM_NOMATCH;
00118
00119         if ((flags & FNM_PERIOD) && *n == '.' &&
00120         (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
00121           return FNM_NOMATCH;
00122
00123         not = (*p == '!' || *p == '^');
00124         if (not)
00125           ++p;
00126
00127         c = *p++;
00128         for (;;)
00129           {
00130         register char cstart = c, cend = c;
00131
00132         if (!(flags & FNM_NOESCAPE) && c == '\\')
00133           cstart = cend = *p++;
00134
00135         if (c == '\0')
00136           /* [ (unterminated) loses.  */
00137           return FNM_NOMATCH;
00138
00139         c = *p++;
00140
00141         if ((flags & FNM_PATHNAME) && c == '/')
00142           /* [/] can never match.  */
00143           return FNM_NOMATCH;
00144
00145         if (c == '-' && *p != ']')
00146           {
00147             cend = *p++;
00148             if (!(flags & FNM_NOESCAPE) && cend == '\\')
00149               cend = *p++;
00150             if (cend == '\0')
00151               return FNM_NOMATCH;
00152             c = *p++;
00153           }
00154
00155         if (*n >= cstart && *n <= cend)
00156           goto matched;
00157
00158         if (c == ']')
00159           break;
00160           }
00161         if (!not)
00162           return FNM_NOMATCH;
00163         break;
00164
00165       matched:;
00166         /* Skip the rest of the [...] that already matched.  */
00167         while (c != ']')
00168           {
00169         if (c == '\0')
00170           /* [... (unterminated) loses.  */
00171           return FNM_NOMATCH;
00172
00173         c = *p++;
00174         if (!(flags & FNM_NOESCAPE) && c == '\\')
00175           /* 1003.2d11 is unclear if this is right.  %%% */
00176           ++p;
00177           }
00178         if (not)
00179           return FNM_NOMATCH;
00180       }
00181       break;
00182
00183     default:
00184       if (FOLD_FN_CHAR (c) != FOLD_FN_CHAR (*n))
00185         return FNM_NOMATCH;
00186     }
00187
00188       ++n;
00189     }
00190
00191   if (*n == '\0')
00192     return 0;
00193
00194   return FNM_NOMATCH;
00195 }
00196
00197 #if defined (__CYGWIN32__) || defined (WIN32)
00198 #if 0
00199 main ()
00200 {
00201   int c;
00202
00203   for (c = 0; c < 256; c++)
00204     {
00205       int t;
00206
00207       if (c == '\\')
00208         t = '/';
00209       else
00210         t = tolower (c);
00211
00212       if ((c & 0x7) == 0x0)
00213          printf ("    ");
00214       printf ("0x%02x,", t);
00215       if ((c & 0x7) == 0x7)
00216          putchar ('\n');
00217       else if ((c & 0x7) == 0x3)
00218          putchar (' ');
00219     }
00220 }
00221 #endif
00222
00223 unsigned char
00224 WNT_filename_classes[] =
00225 {
00226     0x00,0x01,0x02,0x03, 0x04,0x05,0x06,0x07,
00227     0x08,0x09,0x0a,0x0b, 0x0c,0x0d,0x0e,0x0f,
00228     0x10,0x11,0x12,0x13, 0x14,0x15,0x16,0x17,
00229     0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f,
00230     0x20,0x21,0x22,0x23, 0x24,0x25,0x26,0x27,
00231     0x28,0x29,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f,
00232     0x30,0x31,0x32,0x33, 0x34,0x35,0x36,0x37,
00233     0x38,0x39,0x3a,0x3b, 0x3c,0x3d,0x3e,0x3f,
00234     0x40,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
00235     0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
00236     0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
00237     0x78,0x79,0x7a,0x5b, 0x2f,0x5d,0x5e,0x5f,
00238     0x60,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
00239     0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
00240     0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
00241     0x78,0x79,0x7a,0x7b, 0x7c,0x7d,0x7e,0x7f,
00242     0x80,0x81,0x82,0x83, 0x84,0x85,0x86,0x87,
00243     0x88,0x89,0x8a,0x8b, 0x8c,0x8d,0x8e,0x8f,
00244     0x90,0x91,0x92,0x93, 0x94,0x95,0x96,0x97,
00245     0x98,0x99,0x9a,0x9b, 0x9c,0x9d,0x9e,0x9f,
00246     0xa0,0xa1,0xa2,0xa3, 0xa4,0xa5,0xa6,0xa7,
00247     0xa8,0xa9,0xaa,0xab, 0xac,0xad,0xae,0xaf,
00248     0xb0,0xb1,0xb2,0xb3, 0xb4,0xb5,0xb6,0xb7,
00249     0xb8,0xb9,0xba,0xbb, 0xbc,0xbd,0xbe,0xbf,
00250     0xc0,0xc1,0xc2,0xc3, 0xc4,0xc5,0xc6,0xc7,
00251     0xc8,0xc9,0xca,0xcb, 0xcc,0xcd,0xce,0xcf,
00252     0xd0,0xd1,0xd2,0xd3, 0xd4,0xd5,0xd6,0xd7,
00253     0xd8,0xd9,0xda,0xdb, 0xdc,0xdd,0xde,0xdf,
00254     0xe0,0xe1,0xe2,0xe3, 0xe4,0xe5,0xe6,0xe7,
00255     0xe8,0xe9,0xea,0xeb, 0xec,0xed,0xee,0xef,
00256     0xf0,0xf1,0xf2,0xf3, 0xf4,0xf5,0xf6,0xf7,
00257     0xf8,0xf9,0xfa,0xfb, 0xfc,0xfd,0xfe,0xff,
00258 };
00259 #endif /* (__CYGWIN32__) || defined (WIN32) */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


fnmatch.h File Reference

common/fnmatch.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | _FNMATCH_H 1
#define | FNM_PATHNAME (1 << 0)
#define | FNM_NOESCAPE (1 << 1)
#define | FNM_PERIOD (1 << 2)
#define | __FNM_FLAGS (FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD)
#define | FNM_NOMATCH 1

Functions

int | fnmatch ()

Define Documentation

#define FNM_NOESCAPE (1 << 1)

Definition at line 30 of file fnmatch.h.

#define FNM_NOMATCH 1

Definition at line 38 of file fnmatch.h.

#define FNM_PATHNAME (1 << 0)

Definition at line 28 of file fnmatch.h.

#define FNM_PERIOD (1 << 2)

Definition at line 32 of file fnmatch.h.

#define _FNMATCH_H 1

Definition at line 20 of file fnmatch.h.

#define __FNM_FLAGS (FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD)

Definition at line 34 of file fnmatch.h.

Function Documentation

int fnmatch ( )

Referenced by MatchIgnoredList().

Generated on Sun Oct 21 12:42:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/fnmatch.h Source File

common/fnmatch.h

Go to the documentation of this file.
00001 /* Copyright (C) 1992 Free Software Foundation, Inc.
00002 This file is part of the GNU C Library.
00003
00004 The GNU C Library is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU Library General Public License as
00006 published by the Free Software Foundation; either version 2 of the
00007 License, or (at your option) any later version.
00008
00009 The GNU C Library is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 Library General Public License for more details.  */
00013
00014 /*
00015  * Modified for WinCvs/MacCVS : Alexandre Parenteau <aubonbeurre@hotmail.com> --- June 1998
00016  */
00017
00018 #ifndef _FNMATCH_H
00019
00020 #define _FNMATCH_H  1
00021
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025
00026 /* Bits set in the FLAGS argument to `fnmatch'.  */
00027 #undef FNM_PATHNAME
00028 #define FNM_PATHNAME    (1 << 0)/* No wildcard can ever match `/'.  */
00029 #undef FNM_NOESCAPE
00030 #define FNM_NOESCAPE    (1 << 1)/* Backslashes don't quote special chars.  */
00031 #undef FNM_PERIOD
00032 #define FNM_PERIOD  (1 << 2)/* Leading `.' is matched only explicitly.  */
00033 #undef __FNM_FLAGS
00034 #define __FNM_FLAGS (FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD)
00035
00036 /* Value returned by `fnmatch' if STRING does not match PATTERN.  */
00037 #undef FNM_NOMATCH
00038 #define FNM_NOMATCH 1
00039
00040 #if !defined(__STDC__) && (defined(WIN32)|| defined(macintosh))
00041 #   define __STDC__ 1
00042 #endif
00043
00044 /* Match STRING against the filename pattern PATTERN,
00045    returning zero if it matches, FNM_NOMATCH if not.  */
00046 #if __STDC__
00047 extern int fnmatch (const char *pattern, const char *string, int flags);
00048 #else
00049 extern int fnmatch ();
00050 #endif
00051
00052 #if defined (__CYGWIN32__) || defined (WIN32)
00053     /* Under Windows NT, filenames are case-insensitive, and both / and \
00054        are path component separators.  */
00055
00056 #   define FOLD_FN_CHAR(c) (WNT_filename_classes[(unsigned char) (c)])
00057     extern unsigned char WNT_filename_classes[];
00058 #endif /* defined (__CYGWIN32__) || defined (WIN32) */
00059
00060 #ifdef __cplusplus
00061 }
00062 #endif
00063
00064 #endif  /* fnmatch.h */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getline.c File Reference

common/getline.c File Reference

#include <sys/types.h>
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include "getline.h"

Include dependency graph for getline.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | MIN_CHUNK 64

Functions

char * | malloc (),*realloc()
int | getstr (char **lineptr, size_t *n, FILE *stream, char terminator, int offset)
int | getline (char **lineptr, size_t *n, FILE *stream)

Define Documentation

#define MIN_CHUNK 64

Definition at line 40 of file getline.c.

Function Documentation

int getline | ( | char ** | lineptr,
 |  | size_t * | n,
 |  | FILE * | stream
 | ) |

Definition at line 146 of file getline.c.

00147 {
00148   return getstr (lineptr, n, stream, '\n', 0);
00149 }

int getstr | ( | char ** | _lineptr,
 |  | size_t * | _n,
 |  | FILE * | _stream,
 |  | char | _terminator,
 |  | int | _offset
 | ) |

Definition at line 51 of file getline.c.

00052 {
00053   int nchars_avail;     /* Allocated but unused chars in *LINEPTR.  */
00054   char *read_pos;       /* Where we're reading into *LINEPTR. */
00055   int ret;
00056
00057   if (!lineptr || !n || !stream)
00058     {
00059       errno = EINVAL;
00060       return -1;
00061     }
00062
00063   if (!*lineptr)
00064     {
00065       *n = MIN_CHUNK;
00066       *lineptr = (char *)malloc (*n);
00067       if (!*lineptr)
00068     {
00069       errno = ENOMEM;
00070       return -1;
00071     }
00072     }
00073
00074   nchars_avail = *n - offset;
00075   read_pos = *lineptr + offset;
00076
00077   for (;;)
00078     {
00079       int save_errno;
00080       register int c = getc (stream);
00081
00082       save_errno = errno;
00083
00084       /* We always want at least one char left in the buffer, since we
00085      always (unless we get an error while reading the first char)
00086      NUL-terminate the line buffer.  */
00087
00088       assert((*lineptr + *n) == (read_pos + nchars_avail));
00089       if (nchars_avail < 2)
00090     {
00091       if (*n > MIN_CHUNK)
00092         *n *= 2;
00093       else
00094         *n += MIN_CHUNK;
00095
00096       nchars_avail = *n + *lineptr - read_pos;
00097       *lineptr = (char *)realloc (*lineptr, *n);
00098       if (!*lineptr)
00099         {
00100           errno = ENOMEM;
00101           return -1;
00102         }
00103       read_pos = *n - nchars_avail + *lineptr;
00104       assert((*lineptr + *n) == (read_pos + nchars_avail));
00105     }
00106
00107       if (ferror (stream))
00108     {
00109       /* Might like to return partial line, but there is no
00110          place for us to store errno.  And we don't want to just
00111          lose errno.  */
00112       errno = save_errno;
00113       return -1;
00114     }
00115
00116       if (c == EOF)
00117     {
00118       /* Return partial line, if any.  */
00119       if (read_pos == *lineptr)
00120         return -1;
00121       else
00122         break;
00123     }
00124
00125       *read_pos++ = c;
00126       nchars_avail--;
00127
00128       if (c == terminator)
00129     /* Return the line.  */
00130     break;
00131 #ifdef macintosh
00132       if (terminator == '\n' && c == '\r')
00133     /* Return the line.  */
00134     break;
00135 #endif
00136    }
00137
00138   /* Done - NUL terminate and return the number of chars read.  */
00139   *read_pos = '\0';
00140
00141   ret = read_pos - (*lineptr + offset);
00142   return ret;
00143 }

char* malloc ( )

Generated on Sun Oct 21 12:42:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/getline.c Source File

common/getline.c

Go to the documentation of this file.
00001 /* getline.c -- Replacement for GNU C library function getline
00002
00003 Copyright (C) 1993 Free Software Foundation, Inc.
00004
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License as
00007 published by the Free Software Foundation; either version 2 of the
00008 License, or (at your option) any later version.
00009
00010 This program is distributed in the hope that it will be useful, but
00011 WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 General Public License for more details.  */
00014
00015 /* Written by Jan Brittenson, bson@gnu.ai.mit.edu.  */
00016
00017 /*
00018  * Modified for WinCvs/MacCVS : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024
00025 #include <sys/types.h>
00026
00027 #include <stdio.h>
00028 #include <assert.h>
00029 #include <errno.h>
00030
00031 #if STDC_HEADERS || defined(WIN32) || defined(macintosh)
00032 #include <stdlib.h>
00033 #else
00034 char *malloc (), *realloc ();
00035 #endif
00036
00037 #include "getline.h"
00038
00039 /* Always add at least this many bytes when extending the buffer.  */
00040 #define MIN_CHUNK 64
00041
00042 /* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR
00043    + OFFSET (and null-terminate it). *LINEPTR is a pointer returned from
00044    malloc (or NULL), pointing to *N characters of space.  It is realloc'd
00045    as necessary.  Return the number of characters read (not including the
00046    null terminator), or -1 on error or EOF.  On a -1 return, the caller
00047    should check feof(), if not then errno has been set to indicate
00048    the error.  */
00049
00050 int
00051 getstr (char **lineptr, size_t *n, FILE *stream, char terminator, int offset)
00052 {
00053   int nchars_avail;     /* Allocated but unused chars in *LINEPTR.  */
00054   char *read_pos;       /* Where we're reading into *LINEPTR. */
00055   int ret;
00056
00057   if (!lineptr || !n || !stream)
00058     {
00059       errno = EINVAL;
00060       return -1;
00061     }
00062
00063   if (!*lineptr)
00064     {
00065       *n = MIN_CHUNK;
00066       *lineptr = (char *)malloc (*n);
00067       if (!*lineptr)
00068     {
00069       errno = ENOMEM;
00070       return -1;
00071     }
00072     }
00073
00074   nchars_avail = *n - offset;
00075   read_pos = *lineptr + offset;
00076
00077   for (;;)
00078     {
00079       int save_errno;
00080       register int c = getc (stream);
00081
00082       save_errno = errno;
00083
00084       /* We always want at least one char left in the buffer, since we
00085      always (unless we get an error while reading the first char)
00086      NUL-terminate the line buffer.  */
00087
00088       assert((*lineptr + *n) == (read_pos + nchars_avail));
00089       if (nchars_avail < 2)
00090     {
00091       if (*n > MIN_CHUNK)
00092         *n *= 2;
00093       else
00094         *n += MIN_CHUNK;
00095
00096       nchars_avail = *n + *lineptr - read_pos;
00097       *lineptr = (char *)realloc (*lineptr, *n);
00098       if (!*lineptr)
00099         {
00100           errno = ENOMEM;
00101           return -1;
00102         }
00103       read_pos = *n - nchars_avail + *lineptr;
00104       assert((*lineptr + *n) == (read_pos + nchars_avail));
00105     }
00106
00107       if (ferror (stream))
00108     {
00109       /* Might like to return partial line, but there is no
00110          place for us to store errno.  And we don't want to just
00111          lose errno.  */
00112       errno = save_errno;
00113       return -1;
00114     }
00115
00116       if (c == EOF)
00117     {
00118       /* Return partial line, if any.  */
00119       if (read_pos == *lineptr)
00120         return -1;
00121       else
00122         break;
00123     }
00124
00125       *read_pos++ = c;
00126       nchars_avail--;
00127
00128       if (c == terminator)
00129     /* Return the line.  */
00130     break;
00131 #ifdef macintosh
00132       if (terminator == '\n' && c == '\r')
00133     /* Return the line.  */
00134     break;
00135 #endif
00136    }
00137
00138   /* Done - NUL terminate and return the number of chars read.  */
00139   *read_pos = '\0';
00140
00141   ret = read_pos - (*lineptr + offset);
00142   return ret;
00143 }
00144
00145 int
00146 getline (char **lineptr, size_t *n, FILE *stream)
00147 {
00148   return getstr (lineptr, n, stream, '\n', 0);
00149 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getline.h File Reference

common/getline.h File Reference

#include <stdio.h>

Include dependency graph for getline.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | _getline_h_ 1
#define | __PROTO(args) args

Functions

int | getline (char **_lineptr, size_t *_n, FILE *_stream)
int | getstr (char **_lineptr, size_t *_n, FILE *_stream, char _terminator, int _offset)

Define Documentation

#define __PROTO ( args ) args

Definition at line 31 of file getline.h.

#define _getline_h_ 1

Definition at line 22 of file getline.h.

Function Documentation

int getline | ( | char ** | lineptr,
 |  | size_t * | n,
 |  | FILE * | stream
 | ) |

Definition at line 152 of file getline.c.

00153 {
00154   return getstr (lineptr, n, stream, '\n', 0, GETLINE_NO_LIMIT);
00155 }

int getstr | ( | char ** | _lineptr,
 |  | size_t * | _n,
 |  | FILE * | _stream,
 |  | char | _terminator,
 |  | int | _offset
 | ) |

Generated on Sun Oct 21 12:42:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/getline.h Source File

common/getline.h

Go to the documentation of this file.
00001 /* getline.c -- Replacement for GNU C library function getline
00002
00003 Copyright (C) 1993 Free Software Foundation, Inc.
00004
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License as
00007 published by the Free Software Foundation; either version 2 of the
00008 License, or (at your option) any later version.
00009
00010 This program is distributed in the hope that it will be useful, but
00011 WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 General Public License for more details.  */
00014
00015 /* Written by Jan Brittenson, bson@gnu.ai.mit.edu.  */
00016
00017 /*
00018  * Modified for WinCvs/MacCVS : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 #ifndef _getline_h_
00022 #define _getline_h_ 1
00023
00024 #include <stdio.h>
00025
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029
00030 #if defined (__GNUC__) || (defined (__STDC__) && __STDC__) || defined(__cplusplus)
00031 #define __PROTO(args) args
00032 #else
00033 #define __PROTO(args) ()
00034 #endif  /* GCC.  */
00035
00036 int
00037   getline __PROTO ((char **_lineptr, size_t *_n, FILE *_stream));
00038 int
00039   getstr __PROTO ((char **_lineptr, size_t *_n, FILE *_stream,
00040            char _terminator, int _offset));
00041
00042 #ifdef __cplusplus
00043 }
00044 #endif
00045
00046 #endif /* _getline_h_ */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getopt.c File Reference

common/getopt.c File Reference

#include <stdio.h>
#include "getopt.h"

Include dependency graph for getopt.c:

Include dependency graph

Go to the source code of this file.

Enumerations

enum | { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER }

Functions

char * | getenv ()
char * | my_index (str, chr) char *str
void | exchange (argv) char **argv

Variables

char * | optarg = NULL
int | optind = 0
char * | nextchar
int | opterr = 1
int | optopt = '?'
enum { ... } | ordering
char * | posixly_correct
int | chr
int | last_nonopt
char ** | argv
char * | optstring
option * longopts
int * | longind
int | long_only

Enumeration Type Documentation

anonymous enum

Enumeration values:
REQUIRE_ORDER
PERMUTE
RETURN_IN_ORDER

Definition at line 164 of file getopt.c.

00165 {
00166   REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
00167 } ordering;

Function Documentation

void exchange ( argv ) [static]

char* getenv ( )

char* my_index | ( | str | ,
 |  | chr |
 | ) | [static]

Variable Documentation

char ** argv

Definition at line 483 of file watch.c.

int chr

Definition at line 192 of file getopt.c.

int last_nonopt [static]

Definition at line 228 of file getopt.c.

int long_only

Definition at line 405 of file getopt.c.

int* longind

Definition at line 404 of file getopt.c.

struct option* longopts

Definition at line 403 of file getopt.c.

char* nextchar [static]

Definition at line 122 of file getopt.c.

char* optarg = NULL

Definition at line 98 of file getopt.c.

int opterr = 1

Definition at line 127 of file getopt.c.

int optind = 0

Definition at line 113 of file getopt.c.

int optopt = '?'

Definition at line 133 of file getopt.c.

char * optstring

Definition at line 675 of file getopt.c.

enum { ... } ordering [static]

char* posixly_correct [static]

Definition at line 170 of file getopt.c.

Generated on Sun Oct 21 12:42:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/getopt.c Source File

common/getopt.c

Go to the documentation of this file.
00001 /* Getopt for GNU.
00002    NOTE: getopt is now part of the C library, so if you don't know what
00003    "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
00004    before changing it!
00005
00006    Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94
00007     Free Software Foundation, Inc.
00008
00009    This program is free software; you can redistribute it and/or modify it
00010    under the terms of the GNU General Public License as published by the
00011    Free Software Foundation; either version 2, or (at your option) any
00012    later version.
00013
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.  */
00018
00019 /*
00020  * Modified for WinCvs/MacCVS : Alexandre Parenteau <aubonbeurre@hotmail.com> --- August 1998
00021  */
00022 /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
00023    Ditto for AIX 3.2 and <stdlib.h>.  */
00024 #ifndef _NO_PROTO
00025 #define _NO_PROTO
00026 #endif
00027
00028 #ifdef HAVE_CONFIG_H
00029 #if defined (emacs) || defined (CONFIG_BROKETS)
00030 /* We use <config.h> instead of "config.h" so that a compilation
00031    using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
00032    (which it would do because it found this file in $srcdir).  */
00033 #include <config.h>
00034 #else
00035 #include "config.h"
00036 #endif
00037 #endif
00038
00039 #ifndef __STDC__
00040 /* This is a separate conditional since some stdc systems
00041    reject `defined (const)'.  */
00042 #ifndef const
00043 #define const
00044 #endif
00045 #endif
00046
00047 #include <stdio.h>
00048
00049 #ifdef HAVE_STRING_H
00050 #include <string.h>
00051 #endif
00052
00053 #if defined(macintosh) || defined(WIN32)
00054 #include <stdlib.h>
00055 #endif /* macintosh || WIN32 */
00056
00057 /* Comment out all this code if we are using the GNU C Library, and are not
00058    actually compiling the library itself.  This code is part of the GNU C
00059    Library, but also included in many other GNU distributions.  Compiling
00060    and linking in this code is a waste when using the GNU C library
00061    (especially if it is a shared library).  Rather than having every GNU
00062    program understand `configure --with-gnu-libc' and omit the object files,
00063    it is simpler to just do this in the source for each such file.  */
00064
00065 #if defined (_LIBC) || !defined (__GNU_LIBRARY__)
00066
00067
00068 /* This needs to come after some library #include
00069    to get __GNU_LIBRARY__ defined.  */
00070 #ifdef  __GNU_LIBRARY__
00071 /* Don't include stdlib.h for non-GNU C libraries because some of them
00072    contain conflicting prototypes for getopt.  */
00073 #include <stdlib.h>
00074 #endif  /* GNU C library.  */
00075
00076 /* This version of `getopt' appears to the caller like standard Unix `getopt'
00077    but it behaves differently for the user, since it allows the user
00078    to intersperse the options with the other arguments.
00079
00080    As `getopt' works, it permutes the elements of ARGV so that,
00081    when it is done, all the options precede everything else.  Thus
00082    all application programs are extended to handle flexible argument order.
00083
00084    Setting the environment variable POSIXLY_CORRECT disables permutation.
00085    Then the behavior is completely standard.
00086
00087    GNU application programs can use a third alternative mode in which
00088    they can distinguish the relative order of options and other arguments.  */
00089
00090 #include "getopt.h"
00091
00092 /* For communication from `getopt' to the caller.
00093    When `getopt' finds an option that takes an argument,
00094    the argument value is returned here.
00095    Also, when `ordering' is RETURN_IN_ORDER,
00096    each non-option ARGV-element is returned here.  */
00097
00098 char *optarg = NULL;
00099
00100 /* Index in ARGV of the next element to be scanned.
00101    This is used for communication to and from the caller
00102    and for communication between successive calls to `getopt'.
00103
00104    On entry to `getopt', zero means this is the first call; initialize.
00105
00106    When `getopt' returns EOF, this is the index of the first of the
00107    non-option elements that the caller should itself scan.
00108
00109    Otherwise, `optind' communicates from one call to the next
00110    how much of ARGV has been scanned so far.  */
00111
00112 /* XXX 1003.2 says this must be 1 before any call.  */
00113 int optind = 0;
00114
00115 /* The next char to be scanned in the option-element
00116    in which the last option character we returned was found.
00117    This allows us to pick up the scan where we left off.
00118
00119    If this is zero, or a null string, it means resume the scan
00120    by advancing to the next ARGV-element.  */
00121
00122 static char *nextchar;
00123
00124 /* Callers store zero here to inhibit the error message
00125    for unrecognized options.  */
00126
00127 int opterr = 1;
00128
00129 /* Set to an option character which was unrecognized.
00130    This must be initialized on some systems to avoid linking in the
00131    system's own getopt implementation.  */
00132
00133 int optopt = '?';
00134
00135 /* Describe how to deal with options that follow non-option ARGV-elements.
00136
00137    If the caller did not specify anything,
00138    the default is REQUIRE_ORDER if the environment variable
00139    POSIXLY_CORRECT is defined, PERMUTE otherwise.
00140
00141    REQUIRE_ORDER means don't recognize them as options;
00142    stop option processing when the first non-option is seen.
00143    This is what Unix does.
00144    This mode of operation is selected by either setting the environment
00145    variable POSIXLY_CORRECT, or using `+' as the first character
00146    of the list of option characters.
00147
00148    PERMUTE is the default.  We permute the contents of ARGV as we scan,
00149    so that eventually all the non-options are at the end.  This allows options
00150    to be given in any order, even with programs that were not written to
00151    expect this.
00152
00153    RETURN_IN_ORDER is an option available to programs that were written
00154    to expect options and other ARGV-elements in any order and that care about
00155    the ordering of the two.  We describe each non-option ARGV-element
00156    as if it were the argument of an option with character code 1.
00157    Using `-' as the first character of the list of option characters
00158    selects this mode of operation.
00159
00160    The special argument `--' forces an end of option-scanning regardless
00161    of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
00162    `--' can cause `getopt' to return EOF with `optind' != ARGC.  */
00163
00164 static enum
00165 {
00166   REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
00167 } ordering;
00168
00169 /* Value of POSIXLY_CORRECT environment variable.  */
00170 static char *posixly_correct;
00171
00172 #ifdef  __GNU_LIBRARY__
00173 /* We want to avoid inclusion of string.h with non-GNU libraries
00174    because there are many ways it can cause trouble.
00175    On some systems, it contains special magic macros that don't work
00176    in GCC.  */
00177 #include <string.h>
00178 #define my_index    strchr
00179 #else
00180
00181 /* Avoid depending on library functions or files
00182    whose names are inconsistent.  */
00183
00184 #ifndef macintosh
00185 char *getenv ();
00186 #endif /* !macintosh */
00187
00188 #ifndef __STDC__
00189 static char *
00190 my_index (str, chr)
00191      const char *str;
00192      int chr;
00193 #else /* __STDC__ */
00194 static char *
00195 my_index (const char *str, int chr)
00196 #endif /* __STDC__ */
00197 {
00198   while (*str)
00199     {
00200       if (*str == chr)
00201     return (char *) str;
00202       str++;
00203     }
00204   return 0;
00205 }
00206
00207 /* If using GCC, we can safely declare strlen this way.
00208    If not using GCC, it is ok not to declare it.  */
00209 #ifdef __GNUC__
00210 /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
00211    That was relevant to code that was here before.  */
00212 #ifndef __STDC__
00213 /* gcc with -traditional declares the built-in strlen to return int,
00214    and has done so at least since version 2.4.5. -- rms.  */
00215 extern int strlen (const char *);
00216 #endif /* not __STDC__ */
00217 #endif /* __GNUC__ */
00218
00219 #endif /* not __GNU_LIBRARY__ */
00220
00221 /* Handle permutation of arguments.  */
00222
00223 /* Describe the part of ARGV that contains non-options that have
00224    been skipped.  `first_nonopt' is the index in ARGV of the first of them;
00225    `last_nonopt' is the index after the last of them.  */
00226
00227 static int first_nonopt;
00228 static int last_nonopt;
00229
00230 /* Exchange two adjacent subsequences of ARGV.
00231    One subsequence is elements [first_nonopt,last_nonopt)
00232    which contains all the non-options that have been skipped so far.
00233    The other is elements [last_nonopt,optind), which contains all
00234    the options processed since those non-options were skipped.
00235
00236    `first_nonopt' and `last_nonopt' are relocated so that they describe
00237    the new indices of the non-options in ARGV after they are moved.  */
00238
00239 #ifndef __STDC__
00240 static void
00241 exchange (argv)
00242      char **argv;
00243 #else /* __STDC__ */
00244 static void
00245 exchange (char **argv)
00246 #endif /* __STDC__ */
00247 {
00248   int bottom = first_nonopt;
00249   int middle = last_nonopt;
00250   int top = optind;
00251   char *tem;
00252
00253   /* Exchange the shorter segment with the far end of the longer segment.
00254      That puts the shorter segment into the right place.
00255      It leaves the longer segment in the right place overall,
00256      but it consists of two parts that need to be swapped next.  */
00257
00258   while (top > middle && middle > bottom)
00259     {
00260       if (top - middle > middle - bottom)
00261     {
00262       /* Bottom segment is the short one.  */
00263       int len = middle - bottom;
00264       register int i;
00265
00266       /* Swap it with the top part of the top segment.  */
00267       for (i = 0; i < len; i++)
00268         {
00269           tem = argv[bottom + i];
00270           argv[bottom + i] = argv[top - (middle - bottom) + i];
00271           argv[top - (middle - bottom) + i] = tem;
00272         }
00273       /* Exclude the moved bottom segment from further swapping.  */
00274       top -= len;
00275     }
00276       else
00277     {
00278       /* Top segment is the short one.  */
00279       int len = top - middle;
00280       register int i;
00281
00282       /* Swap it with the bottom part of the bottom segment.  */
00283       for (i = 0; i < len; i++)
00284         {
00285           tem = argv[bottom + i];
00286           argv[bottom + i] = argv[middle + i];
00287           argv[middle + i] = tem;
00288         }
00289       /* Exclude the moved top segment from further swapping.  */
00290       bottom += len;
00291     }
00292     }
00293
00294   /* Update records for the slots the non-options now occupy.  */
00295
00296   first_nonopt += (optind - last_nonopt);
00297   last_nonopt = optind;
00298 }
00299
00300 /* Initialize the internal data when the first call is made.  */
00301
00302 #ifndef __STDC__
00303 static const char *
00304 _getopt_initialize (optstring)
00305      const char *optstring;
00306 #else /* __STDC__ */
00307 static const char *
00308 _getopt_initialize (const char *optstring)
00309 #endif /* __STDC__ */
00310 {
00311   /* Start processing options with ARGV-element 1 (since ARGV-element 0
00312      is the program name); the sequence of previously skipped
00313      non-option ARGV-elements is empty.  */
00314
00315   first_nonopt = last_nonopt = optind = 1;
00316
00317   nextchar = NULL;
00318
00319   posixly_correct = getenv ("POSIXLY_CORRECT");
00320
00321   /* Determine how to handle the ordering of options and nonoptions.  */
00322
00323   if (optstring[0] == '-')
00324     {
00325       ordering = RETURN_IN_ORDER;
00326       ++optstring;
00327     }
00328   else if (optstring[0] == '+')
00329     {
00330       ordering = REQUIRE_ORDER;
00331       ++optstring;
00332     }
00333   else if (posixly_correct != NULL)
00334     ordering = REQUIRE_ORDER;
00335   else
00336     ordering = PERMUTE;
00337
00338   return optstring;
00339 }
00340
00341 /* Scan elements of ARGV (whose length is ARGC) for option characters
00342    given in OPTSTRING.
00343
00344    If an element of ARGV starts with '-', and is not exactly "-" or "--",
00345    then it is an option element.  The characters of this element
00346    (aside from the initial '-') are option characters.  If `getopt'
00347    is called repeatedly, it returns successively each of the option characters
00348    from each of the option elements.
00349
00350    If `getopt' finds another option character, it returns that character,
00351    updating `optind' and `nextchar' so that the next call to `getopt' can
00352    resume the scan with the following option character or ARGV-element.
00353
00354    If there are no more option characters, `getopt' returns `EOF'.
00355    Then `optind' is the index in ARGV of the first ARGV-element
00356    that is not an option.  (The ARGV-elements have been permuted
00357    so that those that are not options now come last.)
00358
00359    OPTSTRING is a string containing the legitimate option characters.
00360    If an option character is seen that is not listed in OPTSTRING,
00361    return '?' after printing an error message.  If you set `opterr' to
00362    zero, the error message is suppressed but we still return '?'.
00363
00364    If a char in OPTSTRING is followed by a colon, that means it wants an arg,
00365    so the following text in the same ARGV-element, or the text of the following
00366    ARGV-element, is returned in `optarg'.  Two colons mean an option that
00367    wants an optional arg; if there is text in the current ARGV-element,
00368    it is returned in `optarg', otherwise `optarg' is set to zero.
00369
00370    If OPTSTRING starts with `-' or `+', it requests different methods of
00371    handling the non-option ARGV-elements.
00372    See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
00373
00374    Long-named options begin with `--' instead of `-'.
00375    Their names may be abbreviated as long as the abbreviation is unique
00376    or is an exact match for some defined option.  If they have an
00377    argument, it follows the option name in the same ARGV-element, separated
00378    from the option name by a `=', or else the in next ARGV-element.
00379    When `getopt' finds a long-named option, it returns 0 if that option's
00380    `flag' field is nonzero, the value of the option's `val' field
00381    if the `flag' field is zero.
00382
00383    The elements of ARGV aren't really const, because we permute them.
00384    But we pretend they're const in the prototype to be compatible
00385    with other systems.
00386
00387    LONGOPTS is a vector of `struct option' terminated by an
00388    element containing a name which is zero.
00389
00390    LONGIND returns the index in LONGOPT of the long-named option found.
00391    It is only valid when a long-named option has been found by the most
00392    recent call.
00393
00394    If LONG_ONLY is nonzero, '-' as well as '--' can introduce
00395    long-named options.  */
00396
00397 #ifndef __STDC__
00398 int
00399 _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
00400      int argc;
00401      char *const *argv;
00402      const char *optstring;
00403      const struct option *longopts;
00404      int *longind;
00405      int long_only;
00406 #else /* __STDC__ */
00407 int
00408 _getopt_internal (int argc, char *const *argv, const char *optstring,
00409      const struct option *longopts, int *longind, int long_only)
00410 #endif /* __STDC__ */
00411 {
00412   optarg = NULL;
00413
00414   if (optind == 0)
00415     optstring = _getopt_initialize (optstring);
00416
00417   if (nextchar == NULL || *nextchar == '\0')
00418     {
00419       /* Advance to the next ARGV-element.  */
00420
00421       if (ordering == PERMUTE)
00422     {
00423       /* If we have just processed some options following some non-options,
00424          exchange them so that the options come first.  */
00425
00426       if (first_nonopt != last_nonopt && last_nonopt != optind)
00427         exchange ((char **) argv);
00428       else if (last_nonopt != optind)
00429         first_nonopt = optind;
00430
00431       /* Skip any additional non-options
00432          and extend the range of non-options previously skipped.  */
00433
00434       while (optind < argc
00435          && (argv[optind][0] != '-' || argv[optind][1] == '\0'))
00436         optind++;
00437       last_nonopt = optind;
00438     }
00439
00440       /* The special ARGV-element `--' means premature end of options.
00441      Skip it like a null option,
00442      then exchange with previous non-options as if it were an option,
00443      then skip everything else like a non-option.  */
00444
00445       if (optind != argc && !strcmp (argv[optind], "--"))
00446     {
00447       optind++;
00448
00449       if (first_nonopt != last_nonopt && last_nonopt != optind)
00450         exchange ((char **) argv);
00451       else if (first_nonopt == last_nonopt)
00452         first_nonopt = optind;
00453       last_nonopt = argc;
00454
00455       optind = argc;
00456     }
00457
00458       /* If we have done all the ARGV-elements, stop the scan
00459      and back over any non-options that we skipped and permuted.  */
00460
00461       if (optind == argc)
00462     {
00463       /* Set the next-arg-index to point at the non-options
00464          that we previously skipped, so the caller will digest them.  */
00465       if (first_nonopt != last_nonopt)
00466         optind = first_nonopt;
00467       return EOF;
00468     }
00469
00470       /* If we have come to a non-option and did not permute it,
00471      either stop the scan or describe it to the caller and pass it by.  */
00472
00473       if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
00474     {
00475       if (ordering == REQUIRE_ORDER)
00476         return EOF;
00477       optarg = argv[optind++];
00478       return 1;
00479     }
00480
00481       /* We have found another option-ARGV-element.
00482      Skip the initial punctuation.  */
00483
00484       nextchar = (argv[optind] + 1
00485           + (longopts != NULL && argv[optind][1] == '-'));
00486     }
00487
00488   /* Decode the current option-ARGV-element.  */
00489
00490   /* Check whether the ARGV-element is a long option.
00491
00492      If long_only and the ARGV-element has the form "-f", where f is
00493      a valid short option, don't consider it an abbreviated form of
00494      a long option that starts with f.  Otherwise there would be no
00495      way to give the -f short option.
00496
00497      On the other hand, if there's a long option "fubar" and
00498      the ARGV-element is "-fu", do consider that an abbreviation of
00499      the long option, just like "--fu", and not "-f" with arg "u".
00500
00501      This distinction seems to be the most useful approach.  */
00502
00503   if (longopts != NULL
00504       && (argv[optind][1] == '-'
00505       || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
00506     {
00507       char *nameend;
00508       const struct option *p;
00509       const struct option *pfound = NULL;
00510       int exact = 0;
00511       int ambig = 0;
00512       int indfound;
00513       int option_index;
00514
00515       for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
00516     /* Do nothing.  */ ;
00517
00518       /* Test all long options for either exact match
00519      or abbreviated matches.  */
00520       for (p = longopts, option_index = 0; p->name; p++, option_index++)
00521     if (!strncmp (p->name, nextchar, nameend - nextchar))
00522       {
00523         if (nameend - nextchar == (int) strlen (p->name))
00524           {
00525         /* Exact match found.  */
00526         pfound = p;
00527         indfound = option_index;
00528         exact = 1;
00529         break;
00530           }
00531         else if (pfound == NULL)
00532           {
00533         /* First nonexact match found.  */
00534         pfound = p;
00535         indfound = option_index;
00536           }
00537         else
00538           /* Second or later nonexact match found.  */
00539           ambig = 1;
00540       }
00541
00542       if (ambig && !exact)
00543     {
00544       if (opterr)
00545         fprintf (stderr, "%s: option `%s' is ambiguous\n",
00546              argv[0], argv[optind]);
00547       nextchar += strlen (nextchar);
00548       optind++;
00549       return '?';
00550     }
00551
00552       if (pfound != NULL)
00553     {
00554       option_index = indfound;
00555       optind++;
00556       if (*nameend)
00557         {
00558           /* Don't test has_arg with >, because some C compilers don't
00559          allow it to be used on enums.  */
00560           if (pfound->has_arg)
00561         optarg = nameend + 1;
00562           else
00563         {
00564           if (opterr)
00565             {
00566               if (argv[optind - 1][1] == '-')
00567             /* --option */
00568             fprintf (stderr,
00569                  "%s: option `--%s' doesn't allow an argument\n",
00570                  argv[0], pfound->name);
00571               else
00572             /* +option or -option */
00573             fprintf (stderr,
00574                  "%s: option `%c%s' doesn't allow an argument\n",
00575                  argv[0], argv[optind - 1][0], pfound->name);
00576             }
00577           nextchar += strlen (nextchar);
00578           return '?';
00579         }
00580         }
00581       else if (pfound->has_arg == 1)
00582         {
00583           if (optind < argc)
00584         optarg = argv[optind++];
00585           else
00586         {
00587           if (opterr)
00588             fprintf (stderr, "%s: option `%s' requires an argument\n",
00589                  argv[0], argv[optind - 1]);
00590           nextchar += strlen (nextchar);
00591           return optstring[0] == ':' ? ':' : '?';
00592         }
00593         }
00594       nextchar += strlen (nextchar);
00595       if (longind != NULL)
00596         *longind = option_index;
00597       if (pfound->flag)
00598         {
00599           *(pfound->flag) = pfound->val;
00600           return 0;
00601         }
00602       return pfound->val;
00603     }
00604
00605       /* Can't find it as a long option.  If this is not getopt_long_only,
00606      or the option starts with '--' or is not a valid short
00607      option, then it's an error.
00608      Otherwise interpret it as a short option.  */
00609       if (!long_only || argv[optind][1] == '-'
00610       || my_index (optstring, *nextchar) == NULL)
00611     {
00612       if (opterr)
00613         {
00614           if (argv[optind][1] == '-')
00615         /* --option */
00616         fprintf (stderr, "%s: unrecognized option `--%s'\n",
00617              argv[0], nextchar);
00618           else
00619         /* +option or -option */
00620         fprintf (stderr, "%s: unrecognized option `%c%s'\n",
00621              argv[0], argv[optind][0], nextchar);
00622         }
00623       nextchar = (char *) "";
00624       optind++;
00625       return '?';
00626     }
00627     }
00628
00629   /* Look at and handle the next short option-character.  */
00630
00631   {
00632     char c = *nextchar++;
00633     char *temp = my_index (optstring, c);
00634
00635     /* Increment `optind' when we start to process its last character.  */
00636     if (*nextchar == '\0')
00637       ++optind;
00638
00639     if (temp == NULL || c == ':')
00640       {
00641     if (opterr)
00642       {
00643         if (posixly_correct)
00644           /* 1003.2 specifies the format of this message.  */
00645           fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
00646         else
00647           fprintf (stderr, "%s: invalid option -- %c\n", argv[0], c);
00648       }
00649     optopt = c;
00650     return '?';
00651       }
00652     if (temp[1] == ':')
00653       {
00654     if (temp[2] == ':')
00655       {
00656         /* This is an option that accepts an argument optionally.  */
00657         if (*nextchar != '\0')
00658           {
00659         optarg = nextchar;
00660         optind++;
00661           }
00662         else
00663           optarg = NULL;
00664         nextchar = NULL;
00665       }
00666     else
00667       {
00668         /* This is an option that requires an argument.  */
00669         if (*nextchar != '\0')
00670           {
00671         optarg = nextchar;
00672         /* If we end this ARGV-element by taking the rest as an arg,
00673            we must advance to the next element now.  */
00674         optind++;
00675           }
00676         else if (optind == argc)
00677           {
00678         if (opterr)
00679           {
00680             /* 1003.2 specifies the format of this message.  */
00681             fprintf (stderr, "%s: option requires an argument -- %c\n",
00682                  argv[0], c);
00683           }
00684         optopt = c;
00685         if (optstring[0] == ':')
00686           c = ':';
00687         else
00688           c = '?';
00689           }
00690         else
00691           /* We already incremented `optind' once;
00692          increment it again when taking next ARGV-elt as argument.  */
00693           optarg = argv[optind++];
00694         nextchar = NULL;
00695       }
00696       }
00697     return c;
00698   }
00699 }
00700
00701 #ifndef __STDC__
00702 int
00703 getopt (argc, argv, optstring)
00704      int argc;
00705      char *const *argv;
00706      const char *optstring;
00707 #else /* __STDC__ */
00708 int getopt (int argc, char *const *argv, const char *optstring)
00709 #endif /* __STDC__ */
00710 {
00711   return _getopt_internal (argc, argv, optstring,
00712                (const struct option *) 0,
00713                (int *) 0,
00714                0);
00715 }
00716
00717 #endif  /* _LIBC or not __GNU_LIBRARY__.  */
00718
00719 #ifdef TEST
00720
00721 /* Compile with -DTEST to make an executable for use in testing
00722    the above definition of `getopt'.  */
00723
00724 int
00725 main (argc, argv)
00726      int argc;
00727      char **argv;
00728 {
00729   int c;
00730   int digit_optind = 0;
00731
00732   while (1)
00733     {
00734       int this_option_optind = optind ? optind : 1;
00735
00736       c = getopt (argc, argv, "abc:d:0123456789");
00737       if (c == EOF)
00738     break;
00739
00740       switch (c)
00741     {
00742     case '0':
00743     case '1':
00744     case '2':
00745     case '3':
00746     case '4':
00747     case '5':
00748     case '6':
00749     case '7':
00750     case '8':
00751     case '9':
00752       if (digit_optind != 0 && digit_optind != this_option_optind)
00753         printf ("digits occur in two different argv-elements.\n");
00754       digit_optind = this_option_optind;
00755       printf ("option %c\n", c);
00756       break;
00757
00758     case 'a':
00759       printf ("option a\n");
00760       break;
00761
00762     case 'b':
00763       printf ("option b\n");
00764       break;
00765
00766     case 'c':
00767       printf ("option c with value `%s'\n", optarg);
00768       break;
00769
00770     case '?':
00771       break;
00772
00773     default:
00774       printf ("?? getopt returned character code 0%o ??\n", c);
00775     }
00776     }
00777
00778   if (optind < argc)
00779     {
00780       printf ("non-option ARGV-elements: ");
00781       while (optind < argc)
00782     printf ("%s ", argv[optind++]);
00783       printf ("\n");
00784     }
00785
00786   exit (0);
00787 }
00788
00789 #endif /* TEST */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getopt.h File Reference

common/getopt.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | option

Defines

#define | _GETOPT_H 1
#define | no_argument 0
#define | required_argument 1
#define | optional_argument 2

Functions

int | getopt ()
int | getopt_long ()
int | getopt_long_only ()
int | _getopt_internal ()

Variables

char * | optarg
int | optind
int | opterr
int | optopt

Define Documentation

#define _GETOPT_H 1

Definition at line 15 of file getopt.h.

#define no_argument 0

Definition at line 95 of file getopt.h.

#define optional_argument 2

Definition at line 97 of file getopt.h.

#define required_argument 1

Definition at line 96 of file getopt.h.

Function Documentation

int _getopt_internal ( )

int getopt ( )

int getopt_long ( )

int getopt_long_only ( )

Variable Documentation

char* optarg

Definition at line 33 of file getopt.h.

int opterr

Definition at line 52 of file getopt.h.

int optind

Definition at line 47 of file getopt.h.

int optopt

Definition at line 56 of file getopt.h.

Generated on Sun Oct 21 12:42:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/getopt.h Source File

common/getopt.h

Go to the documentation of this file.
00001 /* Declarations for getopt.
00002    Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify it
00005    under the terms of the GNU General Public License as published by the
00006    Free Software Foundation; either version 2, or (at your option) any
00007    later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #ifndef _GETOPT_H
00015 #define _GETOPT_H 1
00016
00017 #ifdef  __cplusplus
00018 extern "C" {
00019 #endif
00020
00021 #if !defined(__STDC__) && (defined(macintosh) || defined(WIN32))
00022 #   define __STDC__ 1
00023 #   define __GNU_LIBRARY__ 1
00024 #   define _LIBC 1
00025 #endif
00026
00027 /* For communication from `getopt' to the caller.
00028    When `getopt' finds an option that takes an argument,
00029    the argument value is returned here.
00030    Also, when `ordering' is RETURN_IN_ORDER,
00031    each non-option ARGV-element is returned here.  */
00032
00033 extern char *optarg;
00034
00035 /* Index in ARGV of the next element to be scanned.
00036    This is used for communication to and from the caller
00037    and for communication between successive calls to `getopt'.
00038
00039    On entry to `getopt', zero means this is the first call; initialize.
00040
00041    When `getopt' returns EOF, this is the index of the first of the
00042    non-option elements that the caller should itself scan.
00043
00044    Otherwise, `optind' communicates from one call to the next
00045    how much of ARGV has been scanned so far.  */
00046
00047 extern int optind;
00048
00049 /* Callers store zero here to inhibit the error message `getopt' prints
00050    for unrecognized options.  */
00051
00052 extern int opterr;
00053
00054 /* Set to an option character which was unrecognized.  */
00055
00056 extern int optopt;
00057
00058 /* Describe the long-named options requested by the application.
00059    The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
00060    of `struct option' terminated by an element containing a name which is
00061    zero.
00062
00063    The field `has_arg' is:
00064    no_argument      (or 0) if the option does not take an argument,
00065    required_argument    (or 1) if the option requires an argument,
00066    optional_argument    (or 2) if the option takes an optional argument.
00067
00068    If the field `flag' is not NULL, it points to a variable that is set
00069    to the value given in the field `val' when the option is found, but
00070    left unchanged if the option is not found.
00071
00072    To have a long-named option do something other than set an `int' to
00073    a compiled-in constant, such as set a value from `optarg', set the
00074    option's `flag' field to zero and its `val' field to a nonzero
00075    value (the equivalent single-letter option character, if there is
00076    one).  For long options that have a zero `flag' field, `getopt'
00077    returns the contents of the `val' field.  */
00078
00079 struct option
00080 {
00081 #if __STDC__
00082   const char *name;
00083 #else
00084   char *name;
00085 #endif
00086   /* has_arg can't be an enum because some compilers complain about
00087      type mismatches in all the code that assumes it is an int.  */
00088   int has_arg;
00089   int *flag;
00090   int val;
00091 };
00092
00093 /* Names for the values of the `has_arg' field of `struct option'.  */
00094
00095 #define no_argument     0
00096 #define required_argument   1
00097 #define optional_argument   2
00098
00099 #if __STDC__
00100 #if defined(__GNU_LIBRARY__)
00101 /* Many other libraries have conflicting prototypes for getopt, with
00102    differences in the consts, in stdlib.h.  To avoid compilation
00103    errors, only prototype getopt for the GNU C library.  */
00104 extern int getopt (int argc, char *const *argv, const char *shortopts);
00105 #else /* not __GNU_LIBRARY__ */
00106 extern int getopt ();
00107 #endif /* not __GNU_LIBRARY__ */
00108 extern int getopt_long (int argc, char *const *argv, const char *shortopts,
00109                 const struct option *longopts, int *longind);
00110 extern int getopt_long_only (int argc, char *const *argv,
00111                  const char *shortopts,
00112                      const struct option *longopts, int *longind);
00113
00114 /* Internal only.  Users should not call this directly.  */
00115 extern int _getopt_internal (int argc, char *const *argv,
00116                  const char *shortopts,
00117                      const struct option *longopts, int *longind,
00118                  int long_only);
00119 #else /* not __STDC__ */
00120 extern int getopt ();
00121 extern int getopt_long ();
00122 extern int getopt_long_only ();
00123
00124 extern int _getopt_internal ();
00125 #endif /* not __STDC__ */
00126
00127 #ifdef  __cplusplus
00128 }
00129 #endif
00130
00131 #endif /* _GETOPT_H */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getopt1.c File Reference

common/getopt1.c File Reference

#include "getopt.h"
#include <stdio.h>

Include dependency graph for getopt1.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | NULL 0

Functions

char * | getenv ()
int | getopt_long (argc, argv, options, long_options, opt_index) int argc

Variables

char ** | argv
char * | options
option * long_options
int * | opt_index

Define Documentation

#define NULL 0

Definition at line 58 of file getopt1.c.

Function Documentation

char* getenv ( )

int getopt_long | ( | argc | ,
 |  | argv | ,
 |  | options | ,
 |  | long_options | ,
 |  | opt_index |
 | ) |

Variable Documentation

char* * argv

Definition at line 87 of file getopt1.c.

struct option * long_options

Definition at line 82 of file getopt1.c.

int * opt_index

Definition at line 83 of file getopt1.c.

char * options

Definition at line 591 of file rcscmds.c.

Generated on Sun Oct 21 12:42:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/getopt1.c Source File

common/getopt1.c

Go to the documentation of this file.
00001 /* getopt_long and getopt_long_only entry points for GNU getopt.
00002    Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
00003     Free Software Foundation, Inc.
00004
00005    This program is free software; you can redistribute it and/or modify it
00006    under the terms of the GNU General Public License as published by the
00007    Free Software Foundation; either version 2, or (at your option) any
00008    later version.
00009
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.  */
00014
00015 #ifdef HAVE_CONFIG_H
00016 #if defined (emacs) || defined (CONFIG_BROKETS)
00017 /* We use <config.h> instead of "config.h" so that a compilation
00018    using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
00019    (which it would do because it found this file in $srcdir).  */
00020 #include <config.h>
00021 #else
00022 #include "config.h"
00023 #endif
00024 #endif
00025
00026 #include "getopt.h"
00027
00028 #ifndef __STDC__
00029 /* This is a separate conditional since some stdc systems
00030    reject `defined (const)'.  */
00031 #ifndef const
00032 #define const
00033 #endif
00034 #endif
00035
00036 #include <stdio.h>
00037
00038 /* Comment out all this code if we are using the GNU C Library, and are not
00039    actually compiling the library itself.  This code is part of the GNU C
00040    Library, but also included in many other GNU distributions.  Compiling
00041    and linking in this code is a waste when using the GNU C library
00042    (especially if it is a shared library).  Rather than having every GNU
00043    program understand `configure --with-gnu-libc' and omit the object files,
00044    it is simpler to just do this in the source for each such file.  */
00045
00046 #if defined (_LIBC) || !defined (__GNU_LIBRARY__)
00047
00048
00049 /* This needs to come after some library #include
00050    to get __GNU_LIBRARY__ defined.  */
00051 #ifdef __GNU_LIBRARY__
00052 #include <stdlib.h>
00053 #else
00054 char *getenv ();
00055 #endif
00056
00057 #ifndef NULL
00058 #define NULL 0
00059 #endif
00060
00061 #ifndef __STDC__
00062 int
00063 getopt_long (argc, argv, options, long_options, opt_index)
00064      int argc;
00065      char *const *argv;
00066      const char *options;
00067      const struct option *long_options;
00068      int *opt_index;
00069 #else /* __STDC__ */
00070 int
00071 getopt_long (int argc, char *const *argv, const char *options,
00072      const struct option *long_options, int *opt_index)
00073 #endif /* __STDC__ */
00074 {
00075   return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
00076 }
00077
00078 /* Like getopt_long, but '-' as well as '--' can indicate a long option.
00079    If an option that starts with '-' (not '--') doesn't match a long option,
00080    but does match a short option, it is parsed as a short option
00081    instead.  */
00082
00083 #ifndef __STDC__
00084 int
00085 getopt_long_only (argc, argv, options, long_options, opt_index)
00086      int argc;
00087      char *const *argv;
00088      const char *options;
00089      const struct option *long_options;
00090      int *opt_index;
00091 #else /* __STDC__ */
00092 int
00093 getopt_long_only (int argc, char *const *argv, const char *options,
00094      const struct option *long_options, int *opt_index)
00095 #endif /* __STDC__ */
00096 {
00097   return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
00098 }
00099
00100
00101 #endif  /* _LIBC or not __GNU_LIBRARY__.  */
00102
00103 #ifdef TEST
00104
00105 #include <stdio.h>
00106
00107 int
00108 main (argc, argv)
00109      int argc;
00110      char **argv;
00111 {
00112   int c;
00113   int digit_optind = 0;
00114
00115   while (1)
00116     {
00117       int this_option_optind = optind ? optind : 1;
00118       int option_index = 0;
00119       static struct option long_options[] =
00120       {
00121     {"add", 1, 0, 0},
00122     {"append", 0, 0, 0},
00123     {"delete", 1, 0, 0},
00124     {"verbose", 0, 0, 0},
00125     {"create", 0, 0, 0},
00126     {"file", 1, 0, 0},
00127     {0, 0, 0, 0}
00128       };
00129
00130       c = getopt_long (argc, argv, "abc:d:0123456789",
00131                long_options, &option_index);
00132       if (c == EOF)
00133     break;
00134
00135       switch (c)
00136     {
00137     case 0:
00138       printf ("option %s", long_options[option_index].name);
00139       if (optarg)
00140         printf (" with arg %s", optarg);
00141       printf ("\n");
00142       break;
00143
00144     case '0':
00145     case '1':
00146     case '2':
00147     case '3':
00148     case '4':
00149     case '5':
00150     case '6':
00151     case '7':
00152     case '8':
00153     case '9':
00154       if (digit_optind != 0 && digit_optind != this_option_optind)
00155         printf ("digits occur in two different argv-elements.\n");
00156       digit_optind = this_option_optind;
00157       printf ("option %c\n", c);
00158       break;
00159
00160     case 'a':
00161       printf ("option a\n");
00162       break;
00163
00164     case 'b':
00165       printf ("option b\n");
00166       break;
00167
00168     case 'c':
00169       printf ("option c with value `%s'\n", optarg);
00170       break;
00171
00172     case 'd':
00173       printf ("option d with value `%s'\n", optarg);
00174       break;
00175
00176     case '?':
00177       break;
00178
00179     default:
00180       printf ("?? getopt returned character code 0%o ??\n", c);
00181     }
00182     }
00183
00184   if (optind < argc)
00185     {
00186       printf ("non-option ARGV-elements: ");
00187       while (optind < argc)
00188     printf ("%s ", argv[optind++]);
00189       printf ("\n");
00190     }
00191
00192   exit (0);
00193 }
00194
00195 #endif /* TEST */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/GetPassword.cpp Source File

common/GetPassword.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // GetPassword.cpp : implementation file
00022 //
00023
00024 #include "stdafx.h"
00025
00026 #ifdef WIN32
00027 #   include "wincvs.h"
00028 #endif /* WIN32 */
00029
00030 #ifdef qMacCvsPP
00031 #   include <UModalDialogs.h>
00032 #   include <LEditText.h>
00033 #   include <LStaticText.h>
00034 #   include <Keychain.h>
00035
00036 #   include "MacCvsApp.h"
00037 #   include "MacCvsConstant.h"
00038 #   include "TextBinary.h"
00039 #endif /* qMacCvsPP */
00040
00041 #if qUnix
00042 #   include "UCvsDialogs.h"
00043 #endif
00044
00045 #include "GetPassword.h"
00046 #include "CPStr.h"
00047
00048 #ifdef WIN32
00049 #   ifdef _DEBUG
00050 #   define new DEBUG_NEW
00051 #   undef THIS_FILE
00052     static char THIS_FILE[] = __FILE__;
00053 #   endif
00054 #endif /* WIN32 */
00055
00056 #ifdef WIN32
00057
00058 // GetPassword dialog
00059
00060
00061 GetPassword::GetPassword(CWnd* pParent /*=NULL*/)
00062     : CDialog(GetPassword::IDD, pParent)
00063 {
00064     //{{AFX_DATA_INIT(GetPassword)
00065     m_passwd = _T("");
00066     //}}AFX_DATA_INIT
00067 }
00068
00069
00070 void GetPassword::DoDataExchange(CDataExchange* pDX)
00071 {
00072     CDialog::DoDataExchange(pDX);
00073     //{{AFX_DATA_MAP(GetPassword)
00074     DDX_Text(pDX, IDC_PASSWD, m_passwd);
00075     //}}AFX_DATA_MAP
00076 }
00077
00078
00079 BEGIN_MESSAGE_MAP(GetPassword, CDialog)
00080     //{{AFX_MSG_MAP(GetPassword)
00081     //}}AFX_MSG_MAP
00082 END_MESSAGE_MAP()
00083
00085 // GetPassword message handlers
00086
00087 BOOL GetPassword::OnInitDialog()
00088 {
00089     CDialog::OnInitDialog();
00090
00091     // Extra initialization here
00092
00093     //force the window to the foreground in case it was covered by terminal or DOS box
00094     if( !IsWindowVisible() )
00095     {
00096         SetForegroundWindow();
00097     }
00098
00099     return TRUE;  // return TRUE unless you set the focus to a control
00100     // EXCEPTION: OCX Property Pages should return FALSE
00101 }
00102
00103 #endif /* WIN32 */
00104
00105 #if qUnix
00106 class UCvsGetPasswd : public UWidget
00107 {
00108     UDECLARE_DYNAMIC(UCvsGetPasswd)
00109 public:
00110     UCvsGetPasswd() : UWidget(::UEventGetWidID()) {}
00111     virtual ~UCvsGetPasswd() {}
00112
00113     enum
00114     {
00115         kOK = EV_COMMAND_START, // 0
00116         kCancel,                // 1
00117         kPasswd                 // 2
00118     };
00119
00120     virtual void DoDataExchange(bool fill);
00121
00122     UStr m_passwd;
00123
00124 protected:
00125     ev_msg int OnOK(void);
00126     ev_msg int OnCancel(void);
00127
00128     UDECLARE_MESSAGE_MAP()
00129 };
00130
00131 UIMPLEMENT_DYNAMIC(UCvsGetPasswd, UWidget)
00132
00133 UBEGIN_MESSAGE_MAP(UCvsGetPasswd, UWidget)
00134     ON_UCOMMAND(UCvsGetPasswd::kOK, UCvsGetPasswd::OnOK)
00135     ON_UCOMMAND(UCvsGetPasswd::kCancel, UCvsGetPasswd::OnCancel)
00136 UEND_MESSAGE_MAP()
00137
00138 int UCvsGetPasswd::OnOK(void)
00139 {
00140     EndModal(true);
00141     return 0;
00142 }
00143
00144 int UCvsGetPasswd::OnCancel(void)
00145 {
00146     EndModal(false);
00147     return 0;
00148 }
00149
00150 void UCvsGetPasswd::DoDataExchange(bool fill)
00151 {
00152     if(fill)
00153     {
00154     }
00155     else
00156     {
00157         UEventSendMessage(GetWidID(), EV_GETTEXT, kPasswd, &m_passwd);
00158     }
00159 }
00160 #endif // qUnix
00161
00162 char *CompatGetPassword(const char *prompt)
00163 {
00164 #ifdef WIN32
00165     static char passwd[255];
00166     GetPassword gp;
00167     if(gp.DoModal() == IDOK)
00168     {
00169         strcpy(passwd, gp.m_passwd);
00170         return passwd;
00171     }
00172     return "";
00173 #endif /* WIN32 */
00174 #ifdef qMacCvsPP
00175     if(!CMacCvsApp::app->IsFrontProcess() && CMacCvsApp::app->NotifyUser(0L))
00176     {
00177         while(!CMacCvsApp::app->IsFrontProcess())
00178         {
00179             CMacCvsApp::app->SpendSomeTime();
00180         }
00181     }
00182
00183     static UStr thepasswd;
00184     KCItemRef theItem               = NULL;
00185
00186     LStr255 pstr;
00187     UStr realPrompt;
00188 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00189     LStr255 phost, puser;
00190     bool doUseKeyChain = false;
00191     OSStatus theStatus;
00192     UStr loopKey;
00193 #endif
00194
00195     if(GetEnvValue(prompt, "prompt", realPrompt))
00196     {
00197         pstr = realPrompt;
00198
00199 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00200         // copied from MacCvsPro::CMacCVSDoc.cpp
00201         UStr host, user, authen;
00202         if(CMacCvsApp::CanUseKeychain() &&
00203             GetEnvValue(prompt, "host", host) &&
00204             GetEnvValue(prompt, "user", user))
00205         {
00206             doUseKeyChain = true;
00207
00208             OSStatus theStatus;
00209             UInt32 theLength;
00210
00211             phost = host;
00212             puser = user;
00213
00214             UStr authen;
00215             if(GetEnvValue(prompt, "authen", authen))
00216             {
00217                 phost += ":";
00218                 phost += authen;
00219             }
00220
00221             UStr dir;
00222             if(GetEnvValue(prompt, "dir", dir))
00223             {
00224                 phost += ":";
00225                 phost += dir;
00226             }
00227
00228             static char ppass[255];
00229
00230             theStatus = KCFindGenericPassword(phost, puser, sizeof(ppass) - 1,
00231                 ppass, &theLength, &theItem);
00232
00233             user = puser;
00234             host = phost;
00235             loopKey = user;
00236             loopKey << '@';
00237             loopKey << host;
00238             // we could have an endless loop is the password is not valid
00239             if (theStatus == noErr && CMacCvsApp::app->CheckLoopingPassword(loopKey))
00240             {
00241                 if (theItem != NULL)
00242                     KCReleaseItem(&theItem);
00243
00244                 ppass[theLength] = '\0';
00245
00246                 return ppass;
00247             }
00248         }
00249 #endif
00250     }
00251     else
00252         pstr = prompt;
00253
00254     StDialogHandler theHandler(dlg_Passwd, LCommander::GetTopCommander());
00255     LWindow *theDialog = theHandler.GetDialog();
00256     ThrowIfNil_(theDialog);
00257
00258     LEditText *passwd = dynamic_cast<LEditText*>
00259         (theDialog->FindPaneByID(item_GetPasswd));
00260     LStaticText *promptbox = dynamic_cast<LStaticText*>
00261         (theDialog->FindPaneByID('PROM'));
00262     theDialog->SetLatentSub(passwd);
00263
00264     promptbox->SetText(pstr);
00265
00266     theDialog->Show();
00267     MessageT hitMessage;
00268     while (true)
00269     {       // Let DialogHandler process events
00270         hitMessage = theHandler.DoDialog();
00271
00272         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00273             break;
00274     }
00275     theDialog->Hide();
00276
00277     if(hitMessage == msg_OK)
00278     {
00279         passwd->GetText(pstr);
00280
00281 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00282         if (doUseKeyChain && CMacCvsApp::CanUseKeychain())
00283         {
00284             if (theItem != NULL)
00285             {
00286                 theStatus = KCSetData(theItem, pstr[0], &pstr[1]);
00287
00288                 if (theStatus == noErr)
00289                     theStatus = KCUpdateItem(theItem);
00290             }
00291             else
00292             {
00293                 theStatus = KCAddGenericPassword(phost, puser,
00294                     pstr[0], &pstr[1], &theItem);
00295
00296                 KCAttribute theAttribute;
00297
00298                 if (theStatus == noErr)
00299                 {
00300                     UStr theDescriptionText("MacCVS password");
00301                     theAttribute.tag = kDescriptionKCItemAttr;
00302                     theAttribute.length = theDescriptionText.length();
00303                     theAttribute.data = (void *)(const char *)theDescriptionText;
00304                     theStatus = KCSetAttribute(theItem, &theAttribute);
00305                 }
00306
00307                 OSType theTypeCreator;
00308
00309                 if (theStatus == noErr)
00310                 {
00311                     theTypeCreator = 'mCVS';
00312                     theAttribute.tag = kCreatorKCItemAttr;
00313                     theAttribute.length = sizeof(theTypeCreator);
00314                     theAttribute.data = &theTypeCreator;
00315                     theStatus = KCSetAttribute(theItem, &theAttribute);
00316                 }
00317
00318                 if (theStatus == noErr)
00319                 {
00320                     theTypeCreator = 'APPL';
00321                     theAttribute.tag = kTypeKCItemAttr;
00322                     theStatus = KCSetAttribute(theItem, &theAttribute);
00323                 }
00324
00325                 if (theStatus == noErr)
00326                 {
00327                     Boolean theCustomIcon = true;
00328                     theAttribute.tag = kCustomIconKCItemAttr;
00329                     theAttribute.length = sizeof(theCustomIcon);
00330                     theAttribute.data = &theCustomIcon;
00331                     theStatus = KCSetAttribute(theItem, &theAttribute);
00332                 }
00333
00334                 if (theStatus == noErr)
00335                     theStatus = KCUpdateItem(theItem);
00336             }
00337
00338             if (theItem != NULL)
00339                 KCReleaseItem(&theItem);
00340
00341             CMacCvsApp::app->PushValidPassword(loopKey);
00342         }
00343 #endif
00344
00345         thepasswd = pstr;
00346         return thepasswd.length() == 0 ? (char *)"" : (char *)thepasswd;
00347     }
00348
00349 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00350     if (theItem != NULL)
00351         KCReleaseItem(&theItem);
00352 #endif
00353
00354     return "";
00355 #endif /* qMacCvsPP */
00356 #if qUnix
00357     static char passwd[255];
00358     void *wid = UCreate_PasswdDlg();
00359
00360     UCvsGetPasswd *dlg = new UCvsGetPasswd();
00361     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00362
00363     if(dlg->DoModal())
00364     {
00365         strcpy(passwd, dlg->m_passwd);
00366     }
00367     else
00368         strcpy(passwd, "");
00369
00370     delete dlg;
00371     return passwd;
00372 #endif // qUnix
00373 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/GetPassword.h Source File

common/GetPassword.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 #if !defined(AFX_GETPASSWORD_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_)
00022 #define AFX_GETPASSWORD_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_
00023
00024 #if _MSC_VER >= 1000
00025 #pragma once
00026 #endif // _MSC_VER >= 1000
00027 // GetPassword.h : header file
00028 //
00029
00030 char *CompatGetPassword(const char *prompt);
00031     // prompt for a password
00032
00033 #ifdef WIN32
00034
00035 // GetPassword dialog
00036
00037 class GetPassword : public CDialog
00038 {
00039 // Construction
00040 public:
00041     GetPassword(CWnd* pParent = NULL);   // standard constructor
00042
00043 // Dialog Data
00044     //{{AFX_DATA(GetPassword)
00045     enum { IDD = IDD_PASSWRD };
00046     CString m_passwd;
00047     //}}AFX_DATA
00048
00049
00050 // Overrides
00051     // ClassWizard generated virtual function overrides
00052     //{{AFX_VIRTUAL(GetPassword)
00053     protected:
00054     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00055     //}}AFX_VIRTUAL
00056
00057 // Implementation
00058 protected:
00059
00060     // Generated message map functions
00061     //{{AFX_MSG(GetPassword)
00062     virtual BOOL OnInitDialog();
00063     //}}AFX_MSG
00064     DECLARE_MESSAGE_MAP()
00065 };
00066
00067 //{{AFX_INSERT_LOCATION}}
00068 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00069 #endif /* WIN32 */
00070
00071 #endif // !defined(AFX_GETPASSWORD_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/GetPrefs.cpp Source File

common/GetPrefs.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // GetPrefs.cpp : implementation file
00022 //
00023
00024 #include "stdafx.h"
00025
00026 #ifdef qMacCvsPP
00027 #   include <UModalDialogs.h>
00028 #   include <LMultiPanelView.h>
00029 #   include <LPopupGroupBox.h>
00030
00031 #   include "MacCvsConstant.h"
00032 #   include "MacBinEncoding.h"
00033 #   include "uwidget.h"
00034 #endif /* qMacCvsPP */
00035
00036 #if qUnix
00037 #   include "UCvsDialogs.h"
00038 #endif
00039
00040 #ifdef WIN32
00041 #   include "wincvs.h"
00042 #   include "umain.h"
00043 #   include <afxdao.h>
00044 #endif /* WIN32 */
00045
00046 #include "GetPrefs.h"
00047 #include "CvsPrefs.h"
00048 #include "Authen.h"
00049 #include "AppConsole.h"
00050 #include "PromptFiles.h"
00051 #include "MultiFiles.h"
00052 #include "CvsArgs.h"
00053 #include "FileTraversal.h"
00054 #include "MakeSurePathExists.h"
00055
00056 #ifdef WIN32
00057
00058 #ifdef _DEBUG
00059 #define new DEBUG_NEW
00060 #undef THIS_FILE
00061 static char THIS_FILE[] = __FILE__;
00062 #endif
00063
00064 // CVSROOT page
00065 IMPLEMENT_DYNCREATE(CGetPrefs_CVSROOT, CPropertyPage)
00066
00067 CGetPrefs_CVSROOT::CGetPrefs_CVSROOT() : CPropertyPage(CGetPrefs_CVSROOT::IDD), m_didInteract(false)
00068 {
00069     //{{AFX_DATA_INIT(CGetPrefs_CVSROOT)
00070     m_cvsroot = (const char *)gCvsPrefs;
00071     m_cvsvers = gCvsPrefs.CvsVersion();
00072     m_cvsconsole = gCvsPrefs.CvsConsole();
00073     m_authen = gAuthen.kind();
00074     m_host = _T("");
00075     m_login = _T("");
00076     m_path = _T("");
00077     //}}AFX_DATA_INIT
00078     m_flag = false;
00079 }
00080
00081 CGetPrefs_CVSROOT::~CGetPrefs_CVSROOT()
00082 {
00083 }
00084
00085 BOOL CGetPrefs_CVSROOT::OnInitDialog()
00086 {
00087     CDialog::OnInitDialog();
00088     CenterWindow();
00089
00090     for(int i =0; i < NUM_CVSROOT; i++)
00091     {
00092         const CPStr & strroot =
00093             (*(const CvsPrefs *)&gCvsPrefs).get_cvsroot_list(i);
00094         if(!strroot.empty())
00095             m_ctrlroot.InsertString(-1, (const char *)strroot);
00096     }
00097
00098     return TRUE;  // return TRUE  unless you set the focus to a control
00099 }
00100
00101 void CGetPrefs_CVSROOT::DoDataExchange(CDataExchange* pDX)
00102 {
00103     m_didInteract = true;
00104
00105     CPropertyPage::DoDataExchange(pDX);
00106
00107     //{{AFX_DATA_MAP(CGetPrefs_CVSROOT)
00108     DDX_Control(pDX, IDC_CVSVERS, m_combovers);
00109     DDX_Control(pDX, IDC_AUTHEN, m_comboauthen);
00110     DDX_Control(pDX, IDC_COMBOROOT, m_ctrlroot);
00111     DDX_CBString(pDX, IDC_COMBOROOT, m_cvsroot);
00112     DDV_MinChars(pDX, m_cvsroot, 1);
00113     DDX_Text(pDX, IDC_HOST, m_host);
00114     DDX_Text(pDX, IDC_LOGIN, m_login);
00115     DDX_Text(pDX, IDC_PATH, m_path);
00116     DDX_Check(pDX, IDC_CONSOLE, m_cvsconsole);
00117     //}}AFX_DATA_MAP
00118     DDV_CheckCVSROOT( pDX, m_cvsroot ); //it is out here to avoid the class wizard parsing error
00119     if( pDX->m_bSaveAndValidate )
00120     {
00121         //in case the CVSROOT was modified by DDV rutine we need to refill the fields
00122         FillFields();
00123     }
00124
00125     if(pDX->m_bSaveAndValidate)
00126     {
00127         CString theUser, theHost, thePath;
00128
00129         GetDlgItem(IDC_PATH)->GetWindowText(thePath);
00130         GetDlgItem(IDC_HOST)->GetWindowText(theHost);
00131         GetDlgItem(IDC_LOGIN)->GetWindowText(theUser);
00132
00133         UStr root;
00134         if(m_authen != local)
00135         {
00136             root << theUser;
00137             root << '@';
00138             root << theHost;
00139             root << ':';
00140             root << thePath;
00141         }
00142         else
00143             root = thePath;
00144
00145         m_cvsroot = root;
00146         m_cvsvers = m_combovers.GetCurSel();
00147     }
00148     else
00149     {
00150         m_combovers.SetCurSel(m_cvsvers);
00151
00152         m_comboauthen.ResetContent();
00153         std::vector<AuthenModel *> & allAuthen = AuthenModel::GetAllInstances();
00154         std::vector<AuthenModel *>::iterator j;
00155         for(j = allAuthen.begin(); j != allAuthen.end(); ++j)
00156         {
00157             m_comboauthen.InsertString(-1, (*j)->GetToken());
00158         }
00159
00160         AuthenModel *model = AuthenModel::GetInstance(m_authen);
00161         m_comboauthen.SetCurSel(Authen::kindToNum(m_authen));
00162
00163         FillFields();
00164         OnSelchangeAuthen();
00165     }
00166 }
00167
00168 void CGetPrefs_CVSROOT::StoreValues()
00169 {
00170     if(!m_didInteract)
00171         return;
00172
00173     gCvsPrefs = (const char *)m_cvsroot;
00174     gAuthen.setkind(m_authen);
00175     gCvsPrefs.SetCvsVersion(m_cvsvers);
00176     gCvsPrefs.SetCvsConsole(m_cvsconsole != 0);
00177 }
00178
00179 void CGetPrefs_CVSROOT::OnSelchangeAuthen()
00180 {
00181     m_authen = Authen::numToKind(m_comboauthen.GetCurSel());
00182
00183     AuthenModel *model = AuthenModel::GetInstance(m_authen);
00184
00185     GetDlgItem(IDC_HOST)->EnableWindow(model->HasHost());
00186     GetDlgItem(IDC_LOGIN)->EnableWindow(model->HasUser());
00187     GetDlgItem(IDC_SETTINGS)->EnableWindow(model->HasSettings());
00188
00189     if(!model->HasHost())
00190         GetDlgItem(IDC_HOST)->SetWindowText("");
00191     if(!model->HasUser())
00192         GetDlgItem(IDC_LOGIN)->SetWindowText("");
00193
00194     UStr desc;
00195     model->GetSettingsDesc(desc);
00196     GetDlgItem(IDC_AUTHENDESC)->SetWindowText(desc);
00197
00198     // ntserver
00199     // the default *is* ntserver now
00200     // TODO : something more elaborated that is querying cvs
00201 #if 0
00202     if(m_authen == ntserver && m_combovers.GetCurSel() != 1)
00203     {
00204         AfxMessageBox("For the ntserver support, you got to switch the cvs used from"
00205             " \"cvs-1.10 (Standard)\" to \"cvs-1.10 (NT server)\". Check"
00206             " http://www.cvsnt.org for more informations."
00207             , MB_ICONEXCLAMATION | MB_OK);
00208     }
00209 #endif
00210 }
00211
00212 void CGetPrefs_CVSROOT::OnChangePath()
00213 {
00214     OnChangeFields();
00215 }
00216
00217 void CGetPrefs_CVSROOT::OnChangeHost()
00218 {
00219     OnChangeFields();
00220 }
00221
00222 void CGetPrefs_CVSROOT::OnChangeLogin()
00223 {
00224     OnChangeFields();
00225 }
00226
00227 void CGetPrefs_CVSROOT::OnSettings()
00228 {
00229     AuthenModel *model = AuthenModel::GetInstance(m_authen);
00230     model->DoSettings();
00231     UStr desc;
00232     model->GetSettingsDesc(desc);
00233     GetDlgItem(IDC_AUTHENDESC)->SetWindowText(desc);
00234 }
00235
00236 void CGetPrefs_CVSROOT::FillFields(void)
00237 {
00238     UStr theMethod, theUser, theHost, thePath;
00239     USemaphore policeman(m_flag);
00240     if(policeman.IsEnteredTwice())
00241         return;
00242
00243     UStr root;
00244     root = gAuthen.token();
00245     root << Authen::skiptoken(m_cvsroot);
00246
00247     if(Authen::parse_cvsroot(root, theMethod, theUser, theHost, thePath))
00248     {
00249         GetDlgItem(IDC_PATH)->SetWindowText(thePath);
00250         GetDlgItem(IDC_HOST)->SetWindowText(theHost);
00251         GetDlgItem(IDC_LOGIN)->SetWindowText(theUser);
00252     }
00253 }
00254
00255 void CGetPrefs_CVSROOT::OnEditchangeComboroot()
00256 {
00257     m_ctrlroot.GetWindowText(m_cvsroot);
00258     FillFields();
00259 }
00260
00261 void CGetPrefs_CVSROOT::OnChangeFields(void)
00262 {
00263     USemaphore policeman(m_flag);
00264     if(policeman.IsEnteredTwice())
00265         return;
00266
00267     CString theUser, theHost, thePath;
00268
00269     GetDlgItem(IDC_PATH)->GetWindowText(thePath);
00270     GetDlgItem(IDC_HOST)->GetWindowText(theHost);
00271     GetDlgItem(IDC_LOGIN)->GetWindowText(theUser);
00272
00273     m_cvsroot = "";
00274     AuthenModel *model = AuthenModel::GetInstance(m_authen);
00275     if(model->HasUser())
00276         m_cvsroot += theUser;
00277     if(model->HasHost())
00278     {
00279         m_cvsroot += '@';
00280         m_cvsroot += theHost;
00281     }
00282     if(model->HasUser() || model->HasHost())
00283         m_cvsroot += ':';
00284     m_cvsroot += thePath;
00285
00286     m_ctrlroot.SetWindowText(m_cvsroot);
00287 }
00288
00289 void CGetPrefs_CVSROOT::OnSelchangeComboroot()
00290 {
00291     int nCurSel = m_ctrlroot.GetCurSel();
00292     m_ctrlroot.GetLBText(nCurSel, m_cvsroot);
00293     FillFields();
00294 }
00295
00296 BEGIN_MESSAGE_MAP(CGetPrefs_CVSROOT, CPropertyPage)
00297     //{{AFX_MSG_MAP(CGetPrefs_CVSROOT)
00298     ON_CBN_SELCHANGE(IDC_AUTHEN, OnSelchangeAuthen)
00299     ON_EN_CHANGE(IDC_PATH, OnChangePath)
00300     ON_EN_CHANGE(IDC_HOST, OnChangeHost)
00301     ON_EN_CHANGE(IDC_LOGIN, OnChangeLogin)
00302     ON_BN_CLICKED(IDC_SETTINGS, OnSettings)
00303     ON_CBN_SELCHANGE(IDC_COMBOROOT, OnSelchangeComboroot)
00304     ON_CBN_EDITCHANGE(IDC_COMBOROOT, OnEditchangeComboroot)
00305     //}}AFX_MSG_MAP
00306 END_MESSAGE_MAP()
00307
00308 // Globals options page
00309 IMPLEMENT_DYNCREATE(CGetPrefs_GLOBALS, CPropertyPage)
00310
00311 CGetPrefs_GLOBALS::CGetPrefs_GLOBALS() : CPropertyPage(CGetPrefs_GLOBALS::IDD), m_didInteract(false)
00312 {
00313     //{{AFX_DATA_INIT(CGetPrefs_GLOBALS)
00314     m_checkoutro = gCvsPrefs.CheckoutRO();
00315     m_prune = gCvsPrefs.PruneOption();
00316     m_tcpip = gCvsPrefs.Z9Option();
00317     m_quiet = gCvsPrefs.QuietOption();
00318     m_cntladd = gCvsPrefs.AddControl();
00319     m_dirty = gCvsPrefs.DirtySupport();
00320     m_alwaysroot = gCvsPrefs.AlwaysUseCvsroot();
00321     m_logout = gCvsPrefs.LogoutTimeOut() > 0;
00322     m_editlogout = gCvsPrefs.LogoutTimeOut();
00323     m_unixlf = gCvsPrefs.UnixLF();
00324     m_zlevel = gCvsPrefs.ZLevel();
00325     //}}AFX_DATA_INIT
00326 }
00327
00328 CGetPrefs_GLOBALS::~CGetPrefs_GLOBALS()
00329 {
00330 }
00331
00332 void CGetPrefs_GLOBALS::DoDataExchange(CDataExchange* pDX)
00333 {
00334     m_didInteract = true;
00335
00336     CPropertyPage::DoDataExchange(pDX);
00337
00338     //{{AFX_DATA_MAP(CGetPrefs_GLOBALS)
00339     DDX_Control(pDX, IDC_ZSPIN, m_zspin);
00340     DDX_Control(pDX, IDC_SPINLOGOUT, m_spin);
00341     DDX_Check(pDX, IDC_CHECKOUTRO, m_checkoutro);
00342     DDX_Check(pDX, IDC_PRUNE, m_prune);
00343     DDX_Check(pDX, IDC_TCPIP, m_tcpip);
00344     DDX_Check(pDX, IDC_QUIET, m_quiet);
00345     DDX_Check(pDX, IDC_CTNLADD, m_cntladd);
00346     DDX_Check(pDX, IDC_DIRTYSUPPORT, m_dirty);
00347     DDX_Check(pDX, IDC_ALWAYSROOT, m_alwaysroot);
00348     DDX_Check(pDX, IDC_LOGOUT, m_logout);
00349     DDX_Text(pDX, IDC_EDITLOGOUT, m_editlogout);
00350     DDV_MinMaxUInt(pDX, m_editlogout, 0, 999999);
00351     DDX_Check(pDX, IDC_CHECKUNIXLF, m_unixlf);
00352     DDX_Text(pDX, IDC_ZLEVEL, m_zlevel);
00353     DDV_MinMaxUInt(pDX, m_zlevel, 1, 9);
00354     //}}AFX_DATA_MAP
00355
00356     if(!pDX->m_bSaveAndValidate)
00357     {
00358         m_spin.SetBase(10);
00359         m_spin.SetRange(0, 30000);
00360         m_spin.SetBuddy(GetDlgItem(IDC_EDITLOGOUT));
00361
00362         m_zspin.SetBase(1);
00363         m_zspin.SetRange(1, 9);
00364         m_zspin.SetBuddy(GetDlgItem(IDC_ZLEVEL));
00365
00366         OnTcpip();
00367         OnLogout();
00368     }
00369 }
00370
00371 void CGetPrefs_GLOBALS::StoreValues()
00372 {
00373     if(!m_didInteract)
00374         return;
00375
00376     gCvsPrefs.SetCheckoutRO(m_checkoutro ? true : false);
00377     gCvsPrefs.SetPruneOption(m_prune ? true : false);
00378     gCvsPrefs.SetZ9Option(m_tcpip ? true : false);
00379     gCvsPrefs.SetQuietOption(m_quiet ? true : false);
00380     gCvsPrefs.SetAddControl(m_cntladd ? true : false);
00381     gCvsPrefs.SetDirtySupport(m_dirty ? true : false);
00382     gCvsPrefs.SetAlwaysUseCvsroot(m_alwaysroot ? true : false);
00383     gCvsPrefs.SetLogoutTimeOut(m_logout ? (int)m_editlogout : 0);
00384     gCvsPrefs.SetUnixLF(m_unixlf != 0);
00385     gCvsPrefs.SetZLevel(m_zlevel);
00386 }
00387
00388 BEGIN_MESSAGE_MAP(CGetPrefs_GLOBALS, CPropertyPage)
00389     //{{AFX_MSG_MAP(CGetPrefs_GLOBALS)
00390     ON_BN_CLICKED(IDC_LOGOUT, OnLogout)
00391     ON_BN_CLICKED(IDC_CHECKUNIXLF, OnCheckunixlf)
00392     ON_BN_CLICKED(IDC_TCPIP, OnTcpip)
00393     //}}AFX_MSG_MAP
00394 END_MESSAGE_MAP()
00395
00396 void CGetPrefs_GLOBALS::OnTcpip()
00397 {
00398     CButton* but = (CButton *)GetDlgItem(IDC_TCPIP);
00399     CWnd* wnd = (CButton *)GetDlgItem(IDC_ZLEVEL);
00400     wnd->EnableWindow(but->GetCheck() == 1);
00401     wnd = (CButton *)GetDlgItem(IDC_ZSPIN);
00402     wnd->EnableWindow(but->GetCheck() == 1);
00403 }
00404
00405 void CGetPrefs_GLOBALS::OnLogout()
00406 {
00407     CButton* but = (CButton *)GetDlgItem(IDC_LOGOUT);
00408     CWnd* wnd = (CButton *)GetDlgItem(IDC_EDITLOGOUT);
00409     wnd->EnableWindow(but->GetCheck() == 1);
00410     wnd = (CButton *)GetDlgItem(IDC_SPINLOGOUT);
00411     wnd->EnableWindow(but->GetCheck() == 1);
00412 }
00413
00414 void CGetPrefs_GLOBALS::OnCheckunixlf()
00415 {
00416     AfxMessageBox("Be carefull when toggling this option : you *CANNOT* use WinCvs in"
00417         " both mode. You got to use either one or the other. If you experience some"
00418         " problems, try to remove the global cvs files (such as .cvspass) because they probably"
00419         " don't match the new line feeds.", MB_ICONEXCLAMATION | MB_OK);
00420 }
00421
00422 // WinCvs options page
00423 IMPLEMENT_DYNCREATE(CGetPrefs_WINCVS, CPropertyPage)
00424
00425 CGetPrefs_WINCVS::CGetPrefs_WINCVS() : CPropertyPage(CGetPrefs_WINCVS::IDD), m_didInteract(false)
00426 {
00427     UStr cvsPath;
00428     //{{AFX_DATA_INIT(CGetPrefs_WINCVS)
00429     m_viewer = gCvsPrefs.Viewer() != 0L ? gCvsPrefs.Viewer() : "";
00430     m_diffprog = gCvsPrefs.ExtDiff() != 0L ? gCvsPrefs.ExtDiff() : "";
00431     m_chkdiff = gCvsPrefs.ExtDiff() != 0L;
00432     m_home = gCvsPrefs.Home() != 0L ? gCvsPrefs.Home() : "";
00433     m_chkUseViewerAlways = gCvsPrefs.UseViewerAlways() != 0L;
00434     m_cvschk = gCvsPrefs.WhichCvs(cvsPath, true) != 0L;
00435     m_cvsprog = gCvsPrefs.WhichCvs(cvsPath);
00436     //}}AFX_DATA_INIT
00437 }
00438
00439 CGetPrefs_WINCVS::~CGetPrefs_WINCVS()
00440 {
00441 }
00442
00443 void CGetPrefs_WINCVS::DoDataExchange(CDataExchange* pDX)
00444 {
00445     m_didInteract = true;
00446
00447     CPropertyPage::DoDataExchange(pDX);
00448
00449     //{{AFX_DATA_MAP(CGetPrefs_WINCVS)
00450     DDX_Text(pDX, IDC_PROGRAM, m_viewer);
00451     DDX_Text(pDX, IDC_DIFFPROG, m_diffprog);
00452     DDX_Check(pDX, IDC_EXTDIFF, m_chkdiff);
00453     DDX_Text(pDX, IDC_HOME, m_home);
00454     DDX_Check(pDX, IDC_USE_VIEWER_ALWAYS, m_chkUseViewerAlways);
00455     DDX_Check(pDX, IDC_ALTCVSCHK, m_cvschk);
00456     DDX_Text(pDX, IDC_ALTCVSPROG, m_cvsprog);
00457     //}}AFX_DATA_MAP
00458     if( pDX->m_bSaveAndValidate )
00459     {
00460         //check the home directory
00461         if( !CompatMakeSurePathExists(m_home) )
00462         {
00463             AfxMessageBox("Cannot find folder " + m_home);
00464             pDX->PrepareEditCtrl(IDC_HOME);
00465             pDX->Fail();
00466         }
00467     }
00468     else
00469     {
00470         OnExtdiff();
00471         OnAltcvschk();
00472     }
00473 }
00474
00475 void CGetPrefs_WINCVS::StoreValues()
00476 {
00477     if(!m_didInteract)
00478         return;
00479
00480     if(!m_viewer.IsEmpty())
00481         gCvsPrefs.SetViewer(m_viewer);
00482     else
00483         gCvsPrefs.SetViewer(0L);
00484     if(m_chkdiff && !m_diffprog.IsEmpty())
00485         gCvsPrefs.SetExtDiff(m_diffprog);
00486     else
00487         gCvsPrefs.SetExtDiff(0L);
00488     if(!m_home.IsEmpty())
00489         gCvsPrefs.SetHome(m_home);
00490     gCvsPrefs.SetUseViewerAlways(m_chkUseViewerAlways ? true : false);
00491
00492     if(m_cvschk && !m_cvsprog.IsEmpty())
00493         gCvsPrefs.SetWhichCvs(m_cvsprog);
00494     else
00495         gCvsPrefs.SetWhichCvs("");
00496 }
00497
00498 BEGIN_MESSAGE_MAP(CGetPrefs_WINCVS, CPropertyPage)
00499     //{{AFX_MSG_MAP(CGetPrefs_WINCVS)
00500     ON_BN_CLICKED(IDC_BTNPROGRAM, OnBtnviewer)
00501     ON_BN_CLICKED(IDC_EXTDIFFSEL, OnExtdiffsel)
00502     ON_BN_CLICKED(IDC_EXTDIFF, OnExtdiff)
00503     ON_BN_CLICKED(IDC_BTNHOME, OnBtnhome)
00504     ON_BN_CLICKED(IDC_ALTCVSCHK, OnAltcvschk)
00505     ON_BN_CLICKED(IDC_ALTCVSSEL, OnAltcvssel)
00506     //}}AFX_MSG_MAP
00507 END_MESSAGE_MAP()
00508
00509 void CGetPrefs_WINCVS::OnBtnviewer()
00510 {
00511     MultiFiles mf;
00512     if(!BrowserGetMultiFiles("Select a program :", mf, "Executable Files (*.exe)|*.exe|All Files (*.*)|*.*||"))
00513         return;
00514
00515     CvsArgs args(false);
00516     mf.next();
00517     const char *dir = mf.add(args);
00518     char * const *argv = args.Argv();
00519     CStr fullpath;
00520     fullpath = dir;
00521     if(!fullpath.endsWith(kPathDelimiter))
00522         fullpath << kPathDelimiter;
00523     fullpath << argv[0];
00524
00525     SetDlgItemText(IDC_PROGRAM, fullpath);
00526 }
00527
00528 void CGetPrefs_WINCVS::OnExtdiffsel()
00529 {
00530     MultiFiles mf;
00531     if(!BrowserGetMultiFiles("Select a diff program :", mf, "Executable Files (*.exe)|*.exe|All Files (*.*)|*.*||"))
00532         return;
00533
00534     CvsArgs args(false);
00535     mf.next();
00536     const char *dir = mf.add(args);
00537     char * const *argv = args.Argv();
00538     CStr fullpath;
00539     fullpath = dir;
00540     if(!fullpath.endsWith(kPathDelimiter))
00541         fullpath << kPathDelimiter;
00542     fullpath << argv[0];
00543
00544     SetDlgItemText(IDC_DIFFPROG, fullpath);
00545 }
00546
00547 void CGetPrefs_WINCVS::OnExtdiff()
00548 {
00549     CButton* but = (CButton *)GetDlgItem(IDC_EXTDIFF);
00550     CWnd* wnd = GetDlgItem(IDC_DIFFPROG);
00551     wnd->EnableWindow(but->GetCheck() == 1);
00552     wnd = GetDlgItem(IDC_EXTDIFFSEL);
00553     wnd->EnableWindow(but->GetCheck() == 1);
00554 }
00555
00556 void CGetPrefs_WINCVS::OnBtnhome()
00557 {
00558     const char *dir = BrowserGetDirectory("Select a directory to be the HOME :");
00559     if(dir != NULL)
00560         SetDlgItemText(IDC_HOME, dir);
00561 }
00562
00563 void CGetPrefs_WINCVS::OnAltcvschk()
00564 {
00565     CButton* but = (CButton *)GetDlgItem(IDC_ALTCVSCHK);
00566     CWnd* wnd = GetDlgItem(IDC_ALTCVSPROG);
00567     wnd->EnableWindow(but->GetCheck() == 1);
00568     wnd = GetDlgItem(IDC_ALTCVSSEL);
00569     wnd->EnableWindow(but->GetCheck() == 1);
00570 }
00571
00572 void CGetPrefs_WINCVS::OnAltcvssel()
00573 {
00574     MultiFiles mf;
00575     if(!BrowserGetMultiFiles("Select a cvs program :", mf, "Executable Files (*.exe)|*.exe|All Files (*.*)|*.*||"))
00576         return;
00577
00578     CvsArgs args(false);
00579     mf.next();
00580     const char *dir = mf.add(args);
00581     char * const *argv = args.Argv();
00582     CStr fullpath;
00583     fullpath = dir;
00584     if(!fullpath.endsWith(kPathDelimiter))
00585         fullpath << kPathDelimiter;
00586     fullpath << argv[0];
00587
00588     SetDlgItemText(IDC_ALTCVSPROG, fullpath);
00589 }
00590
00591 // Command Dialogs options page
00592 IMPLEMENT_DYNCREATE(CGetPrefs_CVSCMD_DIALOGS, CPropertyPage)
00593
00594 CGetPrefs_CVSCMD_DIALOGS::CGetPrefs_CVSCMD_DIALOGS() : CPropertyPage(CGetPrefs_CVSCMD_DIALOGS::IDD), m_didInteract(false)
00595 {
00596     //{{AFX_DATA_INIT(CGetPrefs_CVSCMD_DIALOGS)
00597     m_hideUpdate = gCvsPrefs.HideCommandDlgUpdate() != 0L;
00598     m_hideDiff = gCvsPrefs.HideCommandDlgDiff() != 0L;
00599     m_hideGraph = gCvsPrefs.HideCommandDlgGraph() != 0L;
00600     m_hideLog = gCvsPrefs.HideCommandDlgLog() != 0L;
00601     m_keyForce = gCvsPrefs.HideCommandDlgUseShift() != 0L ? 0 : 1;
00602     m_hideAnnotate = gCvsPrefs.HideCommandDlgAnnotate() != 0L;
00603     //}}AFX_DATA_INIT
00604 }
00605
00606 CGetPrefs_CVSCMD_DIALOGS::~CGetPrefs_CVSCMD_DIALOGS()
00607 {
00608 }
00609
00610 void CGetPrefs_CVSCMD_DIALOGS::DoDataExchange(CDataExchange* pDX)
00611 {
00612     m_didInteract = true;
00613
00614     CPropertyPage::DoDataExchange(pDX);
00615     //{{AFX_DATA_MAP(CGetPrefs_CVSCMD_DIALOGS)
00616     DDX_Check(pDX, IDC_CHECKUPDATE, m_hideUpdate);
00617     DDX_Check(pDX, IDC_CHECKDIFF, m_hideDiff);
00618     DDX_Check(pDX, IDC_CHECKGRAPH, m_hideGraph);
00619     DDX_Check(pDX, IDC_CHECKLOG, m_hideLog);
00620     DDX_Radio(pDX, IDC_RADIOSHIFT, m_keyForce);
00621     DDX_Check(pDX, IDC_CHECKANNOTATE, m_hideAnnotate);
00622     //}}AFX_DATA_MAP
00623 }
00624
00625 void CGetPrefs_CVSCMD_DIALOGS::StoreValues()
00626 {
00627     if(!m_didInteract)
00628         return;
00629
00630     gCvsPrefs.SetHideCommandDlgUpdate(m_hideUpdate ? true : false);
00631     gCvsPrefs.SetHideCommandDlgDiff(m_hideDiff ? true : false);
00632     gCvsPrefs.SetHideCommandDlgGraph(m_hideGraph ? true : false);
00633     gCvsPrefs.SetHideCommandDlgAnnotate(m_hideAnnotate ? true : false);
00634     gCvsPrefs.SetHideCommandDlgLog(m_hideLog ? true : false);
00635     gCvsPrefs.SetHideCommandDlgUseShift(m_keyForce == 0);
00636 }
00637
00638 BEGIN_MESSAGE_MAP(CGetPrefs_CVSCMD_DIALOGS, CPropertyPage)
00639 //{{AFX_MSG_MAP(CGetPrefs_CVSCMD_DIALOGS)
00640 // NOTE: the ClassWizard will add message map macros here
00641 //}}AFX_MSG_MAP
00642 END_MESSAGE_MAP()
00643
00644 #endif /* WIN32 */
00645
00646 #if qUnix
00647 class UCvsPrefs_MAIN : public UWidget
00648 {
00649     UDECLARE_DYNAMIC(UCvsPrefs_MAIN)
00650 public:
00651     UCvsPrefs_MAIN() : UWidget(::UEventGetWidID()) {}
00652     virtual ~UCvsPrefs_MAIN() {}
00653
00654     enum
00655     {
00656         kOK = EV_COMMAND_START, // 0
00657         kCancel,                // 1
00658         kTabGeneral             // 2
00659     };
00660
00661     virtual void DoDataExchange(bool fill);
00662
00663 protected:
00664     ev_msg int OnOK(void);
00665     ev_msg int OnCancel(void);
00666
00667     UDECLARE_MESSAGE_MAP()
00668 };
00669
00670 UIMPLEMENT_DYNAMIC(UCvsPrefs_MAIN, UWidget)
00671
00672 UBEGIN_MESSAGE_MAP(UCvsPrefs_MAIN, UWidget)
00673     ON_UCOMMAND(UCvsPrefs_MAIN::kOK, UCvsPrefs_MAIN::OnOK)
00674     ON_UCOMMAND(UCvsPrefs_MAIN::kCancel, UCvsPrefs_MAIN::OnCancel)
00675 UEND_MESSAGE_MAP()
00676
00677 int UCvsPrefs_MAIN::OnOK(void)
00678 {
00679     EndModal(true);
00680     return 0;
00681 }
00682
00683 int UCvsPrefs_MAIN::OnCancel(void)
00684 {
00685     EndModal(false);
00686     return 0;
00687 }
00688
00689 void UCvsPrefs_MAIN::DoDataExchange(bool fill)
00690 {
00691     if(fill)
00692     {
00693     }
00694     else
00695     {
00696     }
00697 }
00698
00699 class UCvsPrefs_CVSROOT : public UWidget
00700 {
00701     UDECLARE_DYNAMIC(UCvsPrefs_CVSROOT)
00702 public:
00703     UCvsPrefs_CVSROOT();
00704     virtual ~UCvsPrefs_CVSROOT() {}
00705
00706     enum
00707     {
00708         kCvsrootCombo = EV_COMMAND_START,   // 0
00709         kRshRadio,              // 1
00710         kPserverRadio,          // 2
00711         kLocalRadio,            // 3
00712         kSshRadio,              // 4
00713         kKerberosRadio,         // 5
00714         kCvsVersionCombo        // 6
00715     };
00716
00717     virtual void DoDataExchange(bool fill);
00718
00719     void StoreValues(void);
00720
00721 protected:
00722     UStr m_cvsroot;
00723     AuthenKind m_kind;
00724
00725     UDECLARE_MESSAGE_MAP()
00726 };
00727
00728 UIMPLEMENT_DYNAMIC(UCvsPrefs_CVSROOT, UWidget)
00729
00730 UBEGIN_MESSAGE_MAP(UCvsPrefs_CVSROOT, UWidget)
00731 UEND_MESSAGE_MAP()
00732
00733 UCvsPrefs_CVSROOT::UCvsPrefs_CVSROOT() : UWidget(::UEventGetWidID())
00734 {
00735     if(!gCvsPrefs.empty())
00736         m_cvsroot = (const char *)gCvsPrefs;
00737     m_kind = gAuthen.kind();
00738 }
00739
00740 void UCvsPrefs_CVSROOT::StoreValues(void)
00741 {
00742     gCvsPrefs = m_cvsroot;
00743     gAuthen.setkind(m_kind);
00744 }
00745
00746 void UCvsPrefs_CVSROOT::DoDataExchange(bool fill)
00747 {
00748     if(fill)
00749     {
00750         UEventSendMessage(GetWidID(), EV_SETTEXT, kCvsrootCombo, (void *)(const char *)m_cvsroot);
00751         UEventSendMessage(GetWidID(), EV_COMBO_RESETALL, kCvsrootCombo, 0L);
00752         for(int i = 0; i < NUM_CVSROOT; i++)
00753         {
00754             const CPStr & strroot =
00755                 (*(const CvsPrefs *)&gCvsPrefs).get_cvsroot_list(i);
00756             if(!strroot.empty())
00757                 UEventSendMessage(GetWidID(), EV_COMBO_APPEND,
00758                                   kCvsrootCombo, (void *)(const char *)strroot);
00759         }
00760
00761         int item = kLocalRadio;
00762         switch(m_kind)
00763         {
00764         case local: item = kLocalRadio; break;
00765         case kserver: item = kKerberosRadio; break;
00766         case rhosts: item = kRshRadio; break;
00767         case pserver: item = kPserverRadio; break;
00768         case ssh: item = kSshRadio; break;
00769         case ntserver: item = kLocalRadio; break;
00770         }
00771
00772         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(item, 1), 0L);
00773     }
00774     else
00775     {
00776         UEventSendMessage(GetWidID(), EV_GETTEXT, kCvsrootCombo, &m_cvsroot);
00777
00778         m_kind = local;
00779         if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kLocalRadio, 0L))
00780             m_kind = local;
00781         else if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kKerberosRadio, 0L))
00782             m_kind = kserver;
00783         else if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kRshRadio, 0L))
00784             m_kind = rhosts;
00785         else if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kPserverRadio, 0L))
00786             m_kind = pserver;
00787         else if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kSshRadio, 0L))
00788             m_kind = ssh;
00789     }
00790 }
00791
00792 class UCvsPrefs_GLOBALS : public UWidget
00793 {
00794     UDECLARE_DYNAMIC(UCvsPrefs_GLOBALS)
00795 public:
00796     UCvsPrefs_GLOBALS();
00797     virtual ~UCvsPrefs_GLOBALS() {}
00798
00799     enum
00800     {
00801         kcheckoutro = EV_COMMAND_START, // 0
00802         kdirty,                 // 1
00803         ktcpip,                 // 2
00804         kprune,                 // 3
00805         kquiet,                 // 4
00806         kcntladd                // 5
00807     };
00808
00809     virtual void DoDataExchange(bool fill);
00810
00811     void StoreValues(void);
00812
00813 protected:
00814     bool m_checkoutro;
00815     bool m_dirty;
00816     bool m_tcpip;
00817     bool m_prune;
00818     bool m_quiet;
00819     bool m_cntladd;
00820
00821     UDECLARE_MESSAGE_MAP()
00822 };
00823
00824 UIMPLEMENT_DYNAMIC(UCvsPrefs_GLOBALS, UWidget)
00825
00826 UBEGIN_MESSAGE_MAP(UCvsPrefs_GLOBALS, UWidget)
00827 UEND_MESSAGE_MAP()
00828
00829 UCvsPrefs_GLOBALS::UCvsPrefs_GLOBALS() : UWidget(::UEventGetWidID())
00830 {
00831     m_checkoutro = gCvsPrefs.CheckoutRO();
00832     m_prune = gCvsPrefs.PruneOption();
00833     m_tcpip = gCvsPrefs.Z9Option();
00834     m_quiet = gCvsPrefs.QuietOption();
00835     m_cntladd = gCvsPrefs.AddControl();
00836     m_dirty = gCvsPrefs.DirtySupport();
00837 }
00838
00839 void UCvsPrefs_GLOBALS::StoreValues(void)
00840 {
00841     gCvsPrefs.SetCheckoutRO(m_checkoutro);
00842     gCvsPrefs.SetPruneOption(m_prune);
00843     gCvsPrefs.SetZ9Option(m_tcpip);
00844     gCvsPrefs.SetQuietOption(m_quiet);
00845     gCvsPrefs.SetAddControl(m_cntladd);
00846     gCvsPrefs.SetDirtySupport(m_dirty);
00847 }
00848
00849 void UCvsPrefs_GLOBALS::DoDataExchange(bool fill)
00850 {
00851     if(fill)
00852     {
00853         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kcheckoutro, m_checkoutro), 0L);
00854         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kprune, m_prune), 0L);
00855         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(ktcpip, m_tcpip), 0L);
00856         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kquiet, m_quiet), 0L);
00857         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kcntladd, m_cntladd), 0L);
00858         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kdirty, m_dirty), 0L);
00859     }
00860     else
00861     {
00862         m_checkoutro = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kcheckoutro, 0L) != 0;
00863         m_prune = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kprune, 0L) != 0;
00864         m_tcpip = UEventSendMessage(GetWidID(), EV_QUERYSTATE, ktcpip, 0L) != 0;
00865         m_quiet = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kquiet, 0L) != 0;
00866         m_cntladd = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kcntladd, 0L) != 0;
00867         m_dirty = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kdirty, 0L) != 0;
00868     }
00869 }
00870
00871 class UCvsPrefs_PORTS : public UWidget
00872 {
00873     UDECLARE_DYNAMIC(UCvsPrefs_PORTS)
00874 public:
00875     UCvsPrefs_PORTS();
00876     virtual ~UCvsPrefs_PORTS() {}
00877
00878     enum
00879     {
00880         kcheckrhost = EV_COMMAND_START, // 0
00881         kcheckpserver,          // 1
00882         kcheckkserver,          // 2
00883         kchecksname,            // 3
00884         kcheckrsh,              // 4
00885         kportrhost,             // 5
00886         kportpserver,           // 6
00887         kportkserver,           // 7
00888         ksname,                 // 8
00889         krshname                // 9
00890     };
00891
00892     virtual void DoDataExchange(bool fill);
00893
00894     void StoreValues(void);
00895
00896 protected:
00897     bool m_checkrhost;
00898     bool m_checkpserver;
00899     bool m_checkkserver;
00900     bool m_checksname;
00901     bool m_checkrsh;
00902     int m_portrhost;
00903     int m_portpserver;
00904     int m_portkserver;
00905     UStr m_sname;
00906     UStr m_rshname;
00907
00908     ev_msg int OnCheckPorts(int cmd);
00909
00910     UDECLARE_MESSAGE_MAP()
00911 };
00912
00913 UIMPLEMENT_DYNAMIC(UCvsPrefs_PORTS, UWidget)
00914
00915 UBEGIN_MESSAGE_MAP(UCvsPrefs_PORTS, UWidget)
00916     ON_UCOMMAND_RANGE(UCvsPrefs_PORTS::kcheckrhost, UCvsPrefs_PORTS::kcheckrsh, UCvsPrefs_PORTS::OnCheckPorts)
00917 UEND_MESSAGE_MAP()
00918
00919 UCvsPrefs_PORTS::UCvsPrefs_PORTS() : UWidget(::UEventGetWidID())
00920 {
00921     m_checkkserver = gCvsPrefs.KserverPort() != -1;
00922     m_checkpserver = gCvsPrefs.PserverPort() != -1;
00923     m_checkrhost = gCvsPrefs.RhostPort() != -1;
00924     m_checksname = gCvsPrefs.ServerName() != 0L;
00925     m_checkrsh = gCvsPrefs.RshName() != 0L;
00926
00927     m_portkserver = gCvsPrefs.KserverPort() != -1 ? gCvsPrefs.KserverPort() : 0;
00928     m_portpserver = gCvsPrefs.PserverPort() != -1 ? gCvsPrefs.PserverPort() : 0;
00929     m_portrhost = gCvsPrefs.RhostPort() != -1 ? gCvsPrefs.RhostPort() : 0;
00930     m_sname = gCvsPrefs.ServerName() == 0L ? "cvs" : gCvsPrefs.ServerName();
00931     m_rshname = gCvsPrefs.RshName() == 0L ? "ssh" : gCvsPrefs.RshName();
00932 }
00933
00934 void UCvsPrefs_PORTS::StoreValues(void)
00935 {
00936     gCvsPrefs.SetKserverPort(m_checkkserver ? m_portkserver : -1);
00937     gCvsPrefs.SetPserverPort(m_checkpserver ? m_portpserver : -1);
00938     gCvsPrefs.SetRhostPort(m_checkrhost ? m_portrhost : -1);
00939
00940     gCvsPrefs.SetServerName(m_checksname ? (const char *)m_sname : 0L);
00941     gCvsPrefs.SetRshName(m_checkrsh ? (const char *)m_rshname : 0L);
00942 }
00943
00944 int UCvsPrefs_PORTS::OnCheckPorts(int cmd)
00945 {
00946     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, cmd, 0L);
00947     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(cmd + 5, state), 0L);
00948     return 0;
00949 }
00950
00951 void UCvsPrefs_PORTS::DoDataExchange(bool fill)
00952 {
00953     if(fill)
00954     {
00955         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kcheckkserver, m_checkkserver), 0L);
00956         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kcheckpserver, m_checkpserver), 0L);
00957         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kcheckrhost, m_checkrhost), 0L);
00958         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kchecksname, m_checksname), 0L);
00959         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kcheckrsh, m_checkrsh), 0L);
00960
00961         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kportkserver, m_portkserver), 0L);
00962         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kportpserver, m_portpserver), 0L);
00963         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kportrhost, m_portrhost), 0L);
00964         UEventSendMessage(GetWidID(), EV_SETTEXT, ksname, (void *)(const char *)m_sname);
00965         UEventSendMessage(GetWidID(), EV_SETTEXT, krshname, (void *)(const char *)m_rshname);
00966
00967         OnCheckPorts(kcheckrhost);
00968         OnCheckPorts(kcheckpserver);
00969         OnCheckPorts(kcheckkserver);
00970         OnCheckPorts(kchecksname);
00971         OnCheckPorts(kcheckrsh);
00972     }
00973     else
00974     {
00975         m_checkkserver = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kcheckkserver, 0L) != 0;
00976         m_portkserver = UEventSendMessage(GetWidID(), EV_GETINTEGER, kportkserver, 0L);
00977         m_checkpserver = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kcheckpserver, 0L) != 0;
00978         m_portpserver = UEventSendMessage(GetWidID(), EV_GETINTEGER, kportpserver, 0L);
00979         m_checkrhost = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kcheckrhost, 0L) != 0;
00980         m_portrhost = UEventSendMessage(GetWidID(), EV_GETINTEGER, kportrhost, 0L);
00981
00982         UEventSendMessage(GetWidID(), EV_GETTEXT, ksname, &m_sname);
00983         m_checksname = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kchecksname, 0L) != 0;
00984         UEventSendMessage(GetWidID(), EV_GETTEXT, krshname, &m_rshname);
00985         m_checkrsh = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kcheckrsh, 0L) != 0;
00986     }
00987 }
00988
00989 class UCvsPrefs_PROXY : public UWidget
00990 {
00991     UDECLARE_DYNAMIC(UCvsPrefs_PROXY)
00992 public:
00993     UCvsPrefs_PROXY();
00994     virtual ~UCvsPrefs_PROXY() {}
00995
00996     enum
00997     {
00998         kuseproxy = EV_COMMAND_START,   // 0
00999         kproxyhost,             // 1
01000         kproxyport              // 2
01001     };
01002
01003     virtual void DoDataExchange(bool fill);
01004
01005     void StoreValues(void);
01006
01007 protected:
01008     bool m_useproxy;
01009     UStr m_proxyhost;
01010     int m_proxyport;
01011
01012     ev_msg int OnUseProxy(void);
01013
01014     UDECLARE_MESSAGE_MAP()
01015 };
01016
01017 UIMPLEMENT_DYNAMIC(UCvsPrefs_PROXY, UWidget)
01018
01019 UBEGIN_MESSAGE_MAP(UCvsPrefs_PROXY, UWidget)
01020     ON_UCOMMAND(UCvsPrefs_PROXY::kuseproxy, UCvsPrefs_PROXY::OnUseProxy)
01021 UEND_MESSAGE_MAP()
01022
01023 UCvsPrefs_PROXY::UCvsPrefs_PROXY() : UWidget(::UEventGetWidID())
01024 {
01025     m_useproxy = gCvsPrefs.UseProxy();
01026     m_proxyport = gCvsPrefs.ProxyPort();
01027     m_proxyhost = gCvsPrefs.ProxyHost();
01028 }
01029
01030 void UCvsPrefs_PROXY::StoreValues(void)
01031 {
01032     gCvsPrefs.SetUseProxy(m_useproxy);
01033     gCvsPrefs.SetProxyHost(m_proxyhost);
01034     gCvsPrefs.SetProxyPort(m_proxyport);
01035 }
01036
01037 int UCvsPrefs_PROXY::OnUseProxy(void)
01038 {
01039     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kuseproxy, 0L);
01040     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kproxyhost, state), 0L);
01041     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kproxyport, state), 0L);
01042     return 0;
01043 }
01044
01045 void UCvsPrefs_PROXY::DoDataExchange(bool fill)
01046 {
01047     if(fill)
01048     {
01049         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kuseproxy, m_useproxy), 0L);
01050         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kproxyport, m_proxyport), 0L);
01051         UEventSendMessage(GetWidID(), EV_SETTEXT, kproxyhost, (void *)(const char *)m_proxyhost);
01052
01053         OnUseProxy();
01054     }
01055     else
01056     {
01057         CStr str;
01058         m_useproxy = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kuseproxy, 0L) != 0;
01059         UEventSendMessage(GetWidID(), EV_GETTEXT, kproxyhost, &m_proxyhost);
01060         m_proxyport = UEventSendMessage(GetWidID(), EV_GETINTEGER, kproxyport, 0L);
01061     }
01062 }
01063
01064 class UCvsPrefs_GCVS : public UWidget
01065 {
01066     UDECLARE_DYNAMIC(UCvsPrefs_GCVS)
01067 public:
01068     UCvsPrefs_GCVS();
01069     virtual ~UCvsPrefs_GCVS() {}
01070
01071     enum
01072     {
01073         kdiffApp = EV_COMMAND_START,    // 0
01074         kviewerApp,             // 1
01075         kbrowserApp,            // 2
01076         khelpApp,               // 3
01077         kdiffBtn,               // 4
01078         kviewerBtn,             // 5
01079         kbrowserBtn,            // 6
01080         khelpBtn                // 7
01081     };
01082
01083     virtual void DoDataExchange(bool fill);
01084
01085     void StoreValues(void);
01086
01087 protected:
01088     UStr m_diffApp;
01089     UStr m_viewerApp;
01090     UStr m_browserApp;
01091     UStr m_helpApp;
01092
01093     ev_msg int OnPickProgram(int cmd);
01094
01095     UDECLARE_MESSAGE_MAP()
01096 };
01097
01098 UIMPLEMENT_DYNAMIC(UCvsPrefs_GCVS, UWidget)
01099
01100 UBEGIN_MESSAGE_MAP(UCvsPrefs_GCVS, UWidget)
01101     ON_UCOMMAND_RANGE(UCvsPrefs_GCVS::kdiffBtn, UCvsPrefs_GCVS::khelpBtn, UCvsPrefs_GCVS::OnPickProgram)
01102 UEND_MESSAGE_MAP()
01103
01104 UCvsPrefs_GCVS::UCvsPrefs_GCVS() : UWidget(::UEventGetWidID())
01105 {
01106     m_diffApp = gCvsPrefs.ExtDiff();
01107     m_viewerApp = gCvsPrefs.Viewer();
01108     m_browserApp = gCvsPrefs.Browser();
01109     m_helpApp = gCvsPrefs.Helper();
01110 }
01111
01112 void UCvsPrefs_GCVS::StoreValues(void)
01113 {
01114     gCvsPrefs.SetExtDiff(m_diffApp);
01115     gCvsPrefs.SetViewer(m_viewerApp);
01116     gCvsPrefs.SetBrowser(m_browserApp);
01117     gCvsPrefs.SetHelper(m_helpApp);
01118 }
01119
01120 int UCvsPrefs_GCVS::OnPickProgram(int cmd)
01121 {
01122     MultiFiles mf;
01123     if(!BrowserGetMultiFiles("Select a program :", mf))
01124         return 0;
01125
01126     CvsArgs args(false);
01127     mf.next();
01128     const char *dir = mf.add(args);
01129     char * const *argv = args.Argv();
01130     CStr fullpath;
01131     fullpath = dir;
01132     if(!fullpath.endsWith(kPathDelimiter))
01133         fullpath << kPathDelimiter;
01134     fullpath << argv[0];
01135
01136     UEventSendMessage(GetWidID(), EV_SETTEXT, cmd - kdiffBtn + kdiffApp, (void *)(const char *)fullpath);
01137     return 0;
01138 }
01139
01140 void UCvsPrefs_GCVS::DoDataExchange(bool fill)
01141 {
01142     if(fill)
01143     {
01144         UEventSendMessage(GetWidID(), EV_SETTEXT, kdiffApp, (void *)(const char *)m_diffApp);
01145         UEventSendMessage(GetWidID(), EV_SETTEXT, kviewerApp, (void *)(const char *)m_viewerApp);
01146         UEventSendMessage(GetWidID(), EV_SETTEXT, kbrowserApp, (void *)(const char *)m_browserApp);
01147         UEventSendMessage(GetWidID(), EV_SETTEXT, khelpApp, (void *)(const char *)m_helpApp);
01148     }
01149     else
01150     {
01151         UEventSendMessage(GetWidID(), EV_GETTEXT, kdiffApp, &m_diffApp);
01152         UEventSendMessage(GetWidID(), EV_GETTEXT, kviewerApp, &m_viewerApp);
01153         UEventSendMessage(GetWidID(), EV_GETTEXT, kbrowserApp, &m_browserApp);
01154         UEventSendMessage(GetWidID(), EV_GETTEXT, khelpApp, &m_helpApp);
01155     }
01156 }
01157
01158 #endif // qUnix
01159 #if qMacCvsPP
01160
01161 class UCvsPrefs_CVSROOT : public UWidget
01162 {
01163     UDECLARE_DYNAMIC(UCvsPrefs_CVSROOT)
01164 public:
01165     UCvsPrefs_CVSROOT();
01166     virtual ~UCvsPrefs_CVSROOT() {}
01167
01168     enum
01169     {
01170         kAuthenPopup = EV_COMMAND_START + 40,   // 40
01171         kPath,              // 41
01172         kHost,              // 42
01173         kUser,              // 43
01174         kRootPopup,         // 44
01175         kRootStat,          // 45
01176         kCvsVers,           // 46
01177         kAuthenSettings,    // 47
01178         kAuthenDesc         // 48
01179     };
01180
01181     virtual void DoDataExchange(bool fill);
01182
01183 protected:
01184     UStr m_cvsroot;
01185     AuthenKind m_kind;
01186
01187     ev_msg void OnAuthenPopup(int pos, const char *txt);
01188     ev_msg void OnRootPopup(int pos, const char *txt);
01189     ev_msg void OnEditChange(int cmd);
01190     ev_msg int OnAuthenSettings(void);
01191     ev_msg void OnDestroy(void);
01192
01193     UDECLARE_MESSAGE_MAP()
01194 };
01195
01196 UIMPLEMENT_DYNAMIC(UCvsPrefs_CVSROOT, UWidget)
01197
01198 UBEGIN_MESSAGE_MAP(UCvsPrefs_CVSROOT, UWidget)
01199     ON_COMBO_SEL(kAuthenPopup, OnAuthenPopup)
01200     ON_COMBO_SEL(kRootPopup, OnRootPopup)
01201     ON_EDITCHANGE_RANGE(kPath, kUser, OnEditChange)
01202     ON_UCOMMAND(kAuthenSettings, OnAuthenSettings)
01203     ON_UDESTROY(UCvsPrefs_CVSROOT)
01204 UEND_MESSAGE_MAP()
01205
01206 UCvsPrefs_CVSROOT::UCvsPrefs_CVSROOT() : UWidget(::UEventGetWidID())
01207 {
01208 }
01209
01210 void UCvsPrefs_CVSROOT::OnAuthenPopup(int pos, const char *txt)
01211 {
01212     m_kind = Authen::numToKind(pos);
01213     AuthenModel *model = AuthenModel::GetInstance(m_kind);
01214     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kHost, model->HasHost()), 0L);
01215     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kUser, model->HasUser()), 0L);
01216     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kAuthenSettings, model->HasSettings()), 0L);
01217
01218     if(!model->HasHost())
01219         UEventSendMessage(GetWidID(), EV_SETTEXT, kHost, (void *)"");
01220     if(!model->HasUser())
01221         UEventSendMessage(GetWidID(), EV_SETTEXT, kUser, (void *)"");
01222     UStr desc;
01223     model->GetSettingsDesc(desc);
01224     UEventSendMessage(GetWidID(), EV_SETTEXT, kAuthenDesc, (void *)(const char *)desc);
01225 }
01226
01227 void UCvsPrefs_CVSROOT::OnRootPopup(int pos, const char *txt)
01228 {
01229     m_cvsroot = txt;
01230     UEventSendMessage(GetWidID(), EV_SETTEXT, kRootStat, (void *)txt);
01231
01232     UStr theMethod, theUser, theHost, thePath;
01233
01234     if(Authen::parse_cvsroot(txt, theMethod, theUser, theHost, thePath))
01235     {
01236         UEventSendMessage(GetWidID(), EV_SETTEXT, kPath, (void *)(const char *)thePath);
01237         UEventSendMessage(GetWidID(), EV_SETTEXT, kHost, (void *)(const char *)theHost);
01238         UEventSendMessage(GetWidID(), EV_SETTEXT, kUser, (void *)(const char *)theUser);
01239         if (theMethod.length () > 0)
01240             UEventSendMessage(GetWidID(), EV_COMBO_SETSEL,
01241                               UMAKEINT(kAuthenPopup, Authen::kindToNum(Authen::tokenToKind (theMethod.c_str ()))), 0L);
01242     }
01243 }
01244
01245 void UCvsPrefs_CVSROOT::OnEditChange(int cmd)
01246 {
01247     UStr theUser, theHost, thePath;
01248
01249     UEventSendMessage(GetWidID(), EV_GETTEXT, kPath, &thePath);
01250     UEventSendMessage(GetWidID(), EV_GETTEXT, kHost, &theHost);
01251     UEventSendMessage(GetWidID(), EV_GETTEXT, kUser, &theUser);
01252
01253     m_cvsroot = "";
01254     AuthenModel *model = AuthenModel::GetInstance(m_kind);
01255     if(model->HasUser())
01256         m_cvsroot << theUser;
01257     if(model->HasHost())
01258     {
01259         m_cvsroot << '@';
01260         m_cvsroot << theHost;
01261     }
01262     if(model->HasUser() || model->HasHost())
01263         m_cvsroot << ':';
01264     m_cvsroot << thePath;
01265     UEventSendMessage(GetWidID(), EV_SETTEXT, kRootStat, (void *)(const char *)m_cvsroot);
01266 }
01267
01268 int UCvsPrefs_CVSROOT::OnAuthenSettings(void)
01269 {
01270     AuthenModel *model = AuthenModel::GetInstance(m_kind);
01271     model->DoSettings();
01272     UStr desc;
01273     model->GetSettingsDesc(desc);
01274     UEventSendMessage(GetWidID(), EV_SETTEXT, kAuthenDesc, (void *)(const char *)desc);
01275     return 0;
01276 }
01277
01278 void UCvsPrefs_CVSROOT::OnDestroy(void)
01279 {
01280     delete this;
01281 }
01282
01283 void UCvsPrefs_CVSROOT::DoDataExchange(bool fill)
01284 {
01285     if(fill)
01286     {
01287         if(!gCvsPrefs.empty())
01288             m_cvsroot = (const char *)gCvsPrefs;
01289         m_kind = gAuthen.kind();
01290
01291         UEventSendMessage(GetWidID(), EV_COMBO_RESETALL, kAuthenPopup, 0L);
01292         std::vector<AuthenModel *> & allAuthen = AuthenModel::GetAllInstances();
01293         std::vector<AuthenModel *>::iterator i;
01294         for(i = allAuthen.begin(); i != allAuthen.end(); ++i)
01295         {
01296             UEventSendMessage(GetWidID(), EV_COMBO_APPEND,
01297                               kAuthenPopup, (void *)(*i)->GetToken());
01298         }
01299
01300         AuthenModel *model = AuthenModel::GetInstance(m_kind);
01301         UEventSendMessage(GetWidID(), EV_COMBO_SETSEL,
01302                           UMAKEINT(kAuthenPopup, Authen::kindToNum(model->GetKind())), 0L);
01303
01304         UEventSendMessage(GetWidID(), EV_COMBO_RESETALL, kRootPopup, 0L);
01305         for(int i = 0; i < NUM_CVSROOT; i++)
01306         {
01307             const CPStr & strroot =
01308                 (*(const CvsPrefs *)&gCvsPrefs).get_cvsroot_list(i);
01309             if(!strroot.empty())
01310                 UEventSendMessage(GetWidID(), EV_COMBO_APPEND,
01311                                   kRootPopup, (void *)(const char *)strroot);
01312         }
01313
01314         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCvsVers, 1), 0L);
01315
01316         UStr tmp(m_cvsroot);
01317         OnRootPopup(0, tmp);
01318         OnAuthenPopup(Authen::kindToNum(m_kind), 0L);
01319
01320         UEventSendMessage(GetWidID(), EV_CHGFOCUS, kPath, 0L);
01321     }
01322     else
01323     {
01324         gAuthen.setkind(m_kind);
01325
01326         UStr theUser, theHost, thePath;
01327
01328         UEventSendMessage(GetWidID(), EV_GETTEXT, kPath, &thePath);
01329         UEventSendMessage(GetWidID(), EV_GETTEXT, kHost, &theHost);
01330         UEventSendMessage(GetWidID(), EV_GETTEXT, kUser, &theUser);
01331
01332         UStr root;
01333         if(m_kind != local)
01334         {
01335             root << theUser;
01336             root << '@';
01337             root << theHost;
01338             root << ':';
01339             root << thePath;
01340         }
01341         else
01342             root = thePath;
01343
01344         gCvsPrefs = root;
01345     }
01346 }
01347
01348 static void DoDataExchange_Cvsroot(UCvsPrefs_CVSROOT *handler, bool putValue)
01349 {
01350     handler->DoDataExchange(putValue);
01351 }
01352 #endif // qMacCvsPP
01353
01354 void CompatGetPrefs(void)
01355 {
01356     bool userHitOK = false;
01357
01358 #ifdef WIN32
01359     CPropertySheet pages("WinCvs Preferences");
01360     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
01361     CGetPrefs_CVSROOT page1;
01362     CGetPrefs_GLOBALS page2;
01363     CGetPrefs_WINCVS page4;
01364     CGetPrefs_CVSCMD_DIALOGS page5;
01365     pages.AddPage(&page1);
01366     pages.AddPage(&page2);
01367     pages.AddPage(&page4);
01368     pages.AddPage(&page5);
01369     if(pages.DoModal() == IDOK)
01370     {
01371         page1.StoreValues();
01372         page2.StoreValues();
01373         page4.StoreValues();
01374         page5.StoreValues();
01375         userHitOK = true;
01376     }
01377 #endif /* WIN32 */
01378 #ifdef qMacCvsPP
01379     MacBinMaps maps;
01380     maps.LoadDefaults();
01381     CMacBinTable::SetCurrentMap(&maps);
01382
01383     StDialogHandler theHandler(dlg_Prefs, LCommander::GetTopCommander());
01384     LWindow *theDialog = theHandler.GetDialog();
01385     ThrowIfNil_(theDialog);
01386     static UInt16 sRuntimePanel = 1;
01387
01388     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01389         (theDialog->FindPaneByID(item_MultiViewPrefs));
01390     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01391
01392     UCvsPrefs_CVSROOT *handler = new UCvsPrefs_CVSROOT;
01393     ThrowIfNil_(handler);
01394
01395     UEventSendMessage(handler->GetWidID(), EV_INIT_WIDGET, 0, theDialog);
01396
01397     multiView->SwitchToPanel(5);
01398     DoDataExchange_Fonts(theDialog, true);
01399     multiView->SwitchToPanel(4);
01400     DoDataExchange_BinFiles(theDialog, maps, true);
01401     multiView->SwitchToPanel(3);
01402     DoDataExchange_TextFiles(theDialog, true);
01403     multiView->SwitchToPanel(2);
01404     DoDataExchange_Globals(theDialog, true);
01405     multiView->SwitchToPanel(1);
01406     DoDataExchange_Cvsroot(handler, true);
01407
01408     groupView->SetValue(sRuntimePanel);
01409     theDialog->Show();
01410     MessageT hitMessage;
01411     while (true)
01412     {       // Let DialogHandler process events
01413         hitMessage = theHandler.DoDialog();
01414
01415         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01416             break;
01417     }
01418     theDialog->Hide();
01419     sRuntimePanel = groupView->GetValue();
01420
01421     if(hitMessage == msg_OK)
01422     {
01423         userHitOK = true;
01424
01425         multiView->SwitchToPanel(1);
01426         DoDataExchange_Cvsroot(handler, false);
01427         multiView->SwitchToPanel(2);
01428         DoDataExchange_Globals(theDialog, false);
01429         multiView->SwitchToPanel(3);
01430         DoDataExchange_TextFiles(theDialog, false);
01431         multiView->SwitchToPanel(4);
01432         DoDataExchange_BinFiles(theDialog, maps, false);
01433         multiView->SwitchToPanel(5);
01434         DoDataExchange_Fonts(theDialog, false);
01435
01436         maps.SaveDefaults();
01437     }
01438 #endif /* qMacCvsPP */
01439 #if qUnix
01440     void *wid = UCreate_gcvs_Settings();
01441
01442     UCvsPrefs_MAIN *dlg = new UCvsPrefs_MAIN();
01443     UCvsPrefs_CVSROOT *tab1 = new UCvsPrefs_CVSROOT();
01444     UCvsPrefs_GLOBALS *tab2 = new UCvsPrefs_GLOBALS();
01445     UCvsPrefs_PORTS *tab3 = new UCvsPrefs_PORTS();
01446     UCvsPrefs_PROXY *tab4 = new UCvsPrefs_PROXY();
01447     UCvsPrefs_GCVS *tab5 = new UCvsPrefs_GCVS();
01448     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01449     dlg->AddPage(tab1, UCvsPrefs_MAIN::kTabGeneral, 0);
01450     dlg->AddPage(tab2, UCvsPrefs_MAIN::kTabGeneral, 1);
01451     dlg->AddPage(tab3, UCvsPrefs_MAIN::kTabGeneral, 2);
01452     dlg->AddPage(tab4, UCvsPrefs_MAIN::kTabGeneral, 3);
01453     dlg->AddPage(tab5, UCvsPrefs_MAIN::kTabGeneral, 4);
01454
01455     if(dlg->DoModal())
01456     {
01457         tab1->StoreValues();
01458         tab2->StoreValues();
01459         tab3->StoreValues();
01460         tab4->StoreValues();
01461         tab5->StoreValues();
01462
01463         userHitOK = true;
01464     }
01465     delete dlg;
01466 #endif // qUnix
01467
01468     if(userHitOK && !gCvsPrefs.empty())
01469     {
01470         cvs_out("NEW CVSROOT: %s (%s)\n", (const char *)gCvsPrefs, gAuthen.kindstr());
01471         gCvsPrefs.save();
01472     }
01473 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/GetPrefs.h Source File

common/GetPrefs.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 #if !defined(AFX_GETPREFS_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00022 #define AFX_GETPREFS_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00023
00024 #if _MSC_VER >= 1000
00025 #pragma once
00026 #endif // _MSC_VER >= 1000
00027
00028 void CompatGetPrefs(void);
00029     // get the CVSROOT, authentication, and misc options...
00030
00031 #ifdef WIN32
00032 #include "Authen.h"
00033
00034 class CGetPrefs_CVSROOT : public CPropertyPage
00035 {
00036     DECLARE_DYNCREATE(CGetPrefs_CVSROOT)
00037
00038 // Construction
00039 public:
00040     CGetPrefs_CVSROOT();
00041     ~CGetPrefs_CVSROOT();
00042
00043     void StoreValues();
00044
00045     // Dialog Data
00046     //{{AFX_DATA(CGetPrefs_CVSROOT)
00047     enum { IDD = IDD_PREFS_CVSROOT };
00048     CComboBox   m_combovers;
00049     CComboBox   m_comboauthen;
00050     CComboBox   m_ctrlroot;
00051     CString     m_cvsroot;
00052     int         m_cvsvers;
00053     AuthenKind  m_authen;
00054     CString m_host;
00055     CString m_login;
00056     CString m_path;
00057     BOOL        m_cvsconsole;
00058     //}}AFX_DATA
00059
00060 // Overrides
00061     // ClassWizard generate virtual function overrides
00062     //{{AFX_VIRTUAL(CGetPrefs_CVSROOT)
00063     protected:
00064     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00065     //}}AFX_VIRTUAL
00066
00067 // Implementation
00068 protected:
00069     bool m_didInteract;
00070     bool m_flag;
00071
00072     void FillFields(void);
00073     void OnChangeFields(void);
00074
00075     // Generated message map functions
00076     //{{AFX_MSG(CGetPrefs_CVSROOT)
00077     virtual BOOL OnInitDialog();
00078     afx_msg void OnSelchangeAuthen();
00079     afx_msg void OnChangePath();
00080     afx_msg void OnChangeHost();
00081     afx_msg void OnChangeLogin();
00082     afx_msg void OnSettings();
00083     afx_msg void OnSelchangeComboroot();
00084     afx_msg void OnEditchangeComboroot();
00085     //}}AFX_MSG
00086     DECLARE_MESSAGE_MAP()
00087 };
00088
00089 class CGetPrefs_GLOBALS : public CPropertyPage
00090 {
00091     DECLARE_DYNCREATE(CGetPrefs_GLOBALS)
00092
00093 // Construction
00094 public:
00095     CGetPrefs_GLOBALS();
00096     ~CGetPrefs_GLOBALS();
00097
00098     void StoreValues();
00099
00100 // Dialog Data
00101     //{{AFX_DATA(CGetPrefs_GLOBALS)
00102     enum { IDD = IDD_PREFS_GLOBALS };
00103     CSpinButtonCtrl m_zspin;
00104     CSpinButtonCtrl m_spin;
00105     BOOL    m_checkoutro;
00106     BOOL    m_prune;
00107     BOOL    m_tcpip;
00108     BOOL    m_quiet;
00109     BOOL    m_cntladd;
00110     BOOL    m_dirty;
00111     BOOL    m_alwaysroot;
00112     BOOL    m_logout;
00113     UINT    m_editlogout;
00114     BOOL    m_unixlf;
00115     UINT    m_zlevel;
00116     //}}AFX_DATA
00117
00118
00119 // Overrides
00120     // ClassWizard generate virtual function overrides
00121     //{{AFX_VIRTUAL(CGetPrefs_GLOBALS)
00122     protected:
00123     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00124     //}}AFX_VIRTUAL
00125
00126 // Implementation
00127 protected:
00128     bool m_didInteract;
00129
00130     // Generated message map functions
00131     //{{AFX_MSG(CGetPrefs_GLOBALS)
00132     afx_msg void OnLogout();
00133     afx_msg void OnCheckunixlf();
00134     afx_msg void OnTcpip();
00135     //}}AFX_MSG
00136     DECLARE_MESSAGE_MAP()
00137
00138 };
00139
00140 class CGetPrefs_WINCVS : public CPropertyPage
00141 {
00142     DECLARE_DYNCREATE(CGetPrefs_WINCVS)
00143
00144 // Construction
00145 public:
00146     CGetPrefs_WINCVS();
00147     ~CGetPrefs_WINCVS();
00148
00149     void StoreValues();
00150
00151 // Dialog Data
00152     //{{AFX_DATA(CGetPrefs_WINCVS)
00153     enum { IDD = IDD_PREFS_WINCVS };
00154     CString m_viewer;
00155     CString m_diffprog;
00156     BOOL    m_chkdiff;
00157     CString m_home;
00158     BOOL    m_chkUseViewerAlways;
00159     BOOL    m_cvschk;
00160     CString m_cvsprog;
00161     //}}AFX_DATA
00162
00163
00164 // Overrides
00165     // ClassWizard generate virtual function overrides
00166     //{{AFX_VIRTUAL(CGetPrefs_WINCVS)
00167     protected:
00168     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00169     //}}AFX_VIRTUAL
00170
00171 // Implementation
00172 protected:
00173     bool m_didInteract;
00174
00175     // Generated message map functions
00176     //{{AFX_MSG(CGetPrefs_WINCVS)
00177     afx_msg void OnBtnviewer();
00178     afx_msg void OnExtdiffsel();
00179     afx_msg void OnExtdiff();
00180     afx_msg void OnBtnhome();
00181     afx_msg void OnAltcvschk();
00182     afx_msg void OnAltcvssel();
00183     //}}AFX_MSG
00184     DECLARE_MESSAGE_MAP()
00185
00186 };
00187
00188 class CGetPrefs_CVSCMD_DIALOGS : public CPropertyPage
00189 {
00190     DECLARE_DYNCREATE(CGetPrefs_CVSCMD_DIALOGS)
00191
00192 // Construction
00193 public:
00194     CGetPrefs_CVSCMD_DIALOGS();
00195     ~CGetPrefs_CVSCMD_DIALOGS();
00196
00197     void StoreValues();
00198
00199 // Dialog Data
00200     //{{AFX_DATA(CGetPrefs_CVSCMD_DIALOGS)
00201     enum { IDD = IDD_PREFS_CVSCMD_DIALOGS };
00202     BOOL    m_hideUpdate;
00203     BOOL    m_hideDiff;
00204     BOOL    m_hideGraph;
00205     BOOL    m_hideLog;
00206     int     m_keyForce;
00207     BOOL    m_hideAnnotate;
00208     //}}AFX_DATA
00209
00210
00211 // Overrides
00212     // ClassWizard generate virtual function overrides
00213     //{{AFX_VIRTUAL(CGetPrefs_CVSCMD_DIALOGS)
00214     protected:
00215     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00216     //}}AFX_VIRTUAL
00217
00218 // Implementation
00219 protected:
00220     bool m_didInteract;
00221
00222     // Generated message map functions
00223     //{{AFX_MSG(CGetPrefs_CVSCMD_DIALOGS)
00224         // NOTE: the ClassWizard will add member functions here
00225     //}}AFX_MSG
00226     DECLARE_MESSAGE_MAP()
00227
00228 };
00229 //{{AFX_INSERT_LOCATION}}
00230 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00231
00232 #endif /* WIN32 */
00233
00234 #endif // !defined(AFX_GETPREFS_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/GetValue.cpp Source File

common/GetValue.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // GetValue.cpp : implementation file
00022 //
00023
00024 #include "stdafx.h"
00025
00026 #ifdef macintosh
00027 #   define kDlgIdGetValue 128
00028 #   include <Dialogs.h>
00029 #   include <TextUtils.h>
00030 #   include <string.h>
00031 #   include "MacMisc.h"
00032 #endif /* macintosh */
00033
00034 #ifdef WIN32
00035 #   include "wincvs.h"
00036 #endif /* WIN32 */
00037
00038 #include "GetValue.h"
00039
00040 #ifdef _DEBUG
00041 #define new DEBUG_NEW
00042 #undef THIS_FILE
00043 static char THIS_FILE[] = __FILE__;
00044 #endif
00045
00046 #ifdef WIN32
00047
00048 // GetValue dialog
00049
00050
00051 GetValue::GetValue(const char *defvalue, const char *title, CWnd* pParent /*=NULL*/)
00052     : CDialog(GetValue::IDD, pParent)
00053 {
00054     //{{AFX_DATA_INIT(GetValue)
00055     m_value = defvalue != NULL ? defvalue : "";
00056     m_prompt = title != NULL ? title : "";
00057     //}}AFX_DATA_INIT
00058 }
00059
00060 //BOOL GetValue::OnInitDialog()
00061 //{
00062 //  BOOL result = CDialog::OnInitDialog();
00063 //
00064 //  if (result)
00065 //      GotoDlgCtrl(GetDlgItem(IDC_PROMPTEDIT));
00066 //
00067 //  return result;
00068 //}
00069
00070 void GetValue::DoDataExchange(CDataExchange* pDX)
00071 {
00072     CDialog::DoDataExchange(pDX);
00073
00074     //{{AFX_DATA_MAP(GetValue)
00075     DDX_Text(pDX, IDC_PROMPTVALUE, m_prompt);
00076     DDX_Text(pDX, IDC_PROMPTEDIT, m_value);
00077     DDV_MinChars(pDX, m_value, 1);
00078     //}}AFX_DATA_MAP
00079 }
00080
00081
00082 BEGIN_MESSAGE_MAP(GetValue, CDialog)
00083     //{{AFX_MSG_MAP(GetValue)
00084         // NOTE: the ClassWizard will add message map macros here
00085     //}}AFX_MSG_MAP
00086 END_MESSAGE_MAP()
00087
00089 // GetValue message handlers
00090 #endif /* WIN32 */
00091
00092 bool CompatGetValue(char *value, const char *defvalue, const char *title)
00093 {
00094 #ifdef WIN32
00095     GetValue gv(defvalue, title);
00096     if(gv.DoModal() == IDOK)
00097     {
00098         strcpy(value, gv.m_value);
00099         return true;
00100     }
00101     return false;
00102 #endif /* WIN32 */
00103 #ifdef macintosh
00104     GrafPtr     OldPort;
00105     DialogPtr   alertDialog;
00106     short       WhichItem = 0;
00107     Str255 pdef = {'\0'}, ptitle = {'\0'}, pvalue;
00108
00109     if(defvalue != NULL)
00110     {
00111         strcpy((char *)pdef, defvalue);
00112         c2pstr((char *)pdef);
00113     }
00114     if(title != NULL)
00115     {
00116         strcpy((char *)ptitle, title);
00117         c2pstr((char *)ptitle);
00118     }
00119
00120     GetPort(&OldPort);
00121     alertDialog = GetNewDialog(kDlgIdGetValue, NULL, (WindowPtr)-1);
00122     SetPort(alertDialog);
00123
00124     SetDialogItemText(GetDItemHdl(alertDialog, 3), pdef);
00125     SetDialogItemText(GetDItemHdl(alertDialog, 4), ptitle);
00126
00127     while(WhichItem != 1 && WhichItem != 2)
00128     {
00129         ModalDialog(NULL, &WhichItem);
00130
00131         if(WhichItem == 1)
00132         {
00133             GetDialogItemText(GetDItemHdl(alertDialog, 3), pvalue);
00134             if(pvalue[0] == '\0')
00135                 WhichItem = 0;
00136         }
00137     }
00138
00139     if(WhichItem == 1)
00140     {
00141         GetDialogItemText(GetDItemHdl(alertDialog, 3), pvalue);
00142         p2cstr(pvalue);
00143         strcpy(value, (char *)pvalue);
00144     }
00145
00146     DisposeDialog(alertDialog);
00147     SetPort(OldPort);
00148
00149     return WhichItem == 1;
00150 #endif /* macintosh */
00151 #ifdef UNIX_CVS
00152     return false;
00153 #endif /* UNIX_CVS */
00154 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/GetValue.h Source File

common/GetValue.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 #if !defined(AFX_GETVALUE_H__5946A8C3_8517_11D1_8949_444553540000__INCLUDED_)
00022 #define AFX_GETVALUE_H__5946A8C3_8517_11D1_8949_444553540000__INCLUDED_
00023
00024 #if _MSC_VER >= 1000
00025 #pragma once
00026 #endif // _MSC_VER >= 1000
00027 // GetValue.h : header file
00028 //
00029
00030 #ifdef macintosh
00031 #   define MAX_VALUE_LEN 255
00032 #else /* !macintosh */
00033 #   define MAX_VALUE_LEN 1024
00034 #endif /* !macintosh */
00035
00036 bool CompatGetValue(char *value, const char *defvalue = 0L, const char *title = 0L);
00037
00038 #ifdef WIN32
00039
00040 // GetValue dialog
00041
00042 class GetValue : public CDialog
00043 {
00044 // Construction
00045 public:
00046     GetValue(const char *defvalue, const char *title, CWnd* pParent = NULL);   // standard constructor
00047
00048 // Dialog Data
00049     //{{AFX_DATA(GetValue)
00050     enum { IDD = IDD_GETVALUE };
00051     CString m_prompt;
00052     CString m_value;
00053     //}}AFX_DATA
00054
00055
00056 // Overrides
00057     // ClassWizard generated virtual function overrides
00058     //{{AFX_VIRTUAL(GetValue)
00059     protected:
00060     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00061     //}}AFX_VIRTUAL
00062
00063 // Implementation
00064 protected:
00065
00066     // Generated message map functions
00067     //{{AFX_MSG(GetValue)
00068         // NOTE: the ClassWizard will add member functions here
00069     //}}AFX_MSG
00070     DECLARE_MESSAGE_MAP()
00071 };
00072
00073 //{{AFX_INSERT_LOCATION}}
00074 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00075 #endif /* WIN32 */
00076
00077 #endif // !defined(AFX_GETVALUE_H__5946A8C3_8517_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/GraphOptDlg.cpp Source File

common/GraphOptDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- September 2001
00019  */
00020
00021 /*
00022  * GraphOptDlg.cpp --- graph options dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #include "wincvs.h"
00029 #include "MainFrm.h"
00030 #include "GraphView.h"
00031 #endif /* WIN32 */
00032
00033 #include "GraphOptDlg.h"
00034 #include "CvsPrefs.h"
00035
00036
00037 #ifdef _DEBUG
00038 #define new DEBUG_NEW
00039 #undef THIS_FILE
00040 static char THIS_FILE[] = __FILE__;
00041 #endif
00042
00044 // CGraphOptDlg dialog
00045
00046 #ifdef WIN32
00047
00048 CGraphOptDlg::CGraphOptDlg(CPersistentInt& selColor, CPersistentInt& shadowColor,
00049                            CPersistentInt& headerColor, CPersistentInt& tagColor, CPersistentInt& branchColor,
00050                            CPersistentInt& nodeColor, CPersistentInt& deadNodeColor, CPersistentInt& userStateNodeColor,
00051                            CWnd* pParent /*=NULL*/)
00052     : CDialog(CGraphOptDlg::IDD, pParent),
00053     m_selColor(selColor), m_shadowColor(shadowColor),
00054     m_headerColor(headerColor), m_tagColor(tagColor), m_branchColor(branchColor),
00055     m_nodeColor(nodeColor), m_deadNodeColor(deadNodeColor), m_userStateNodeColor(userStateNodeColor)
00056 {
00057     //{{AFX_DATA_INIT(CGraphOptDlg)
00058         // NOTE: the ClassWizard will add member initialization here
00059     //}}AFX_DATA_INIT
00060
00061     m_rgbShadow.SetColor((int)m_shadowColor);
00062     m_rgbSelection.SetColor((int)m_selColor);
00063     m_rgbState.SetColor((int)m_userStateNodeColor);
00064     m_rgbDead.SetColor((int)m_deadNodeColor);
00065     m_rgbNode.SetColor((int)m_nodeColor);
00066     m_rgbBranch.SetColor((int)m_branchColor);
00067     m_rgbTag.SetColor((int)m_tagColor);
00068     m_rgbHeader.SetColor((int)m_headerColor);
00069
00070     m_origSelColor = m_selColor;
00071     m_origShadowColor = m_shadowColor;
00072     m_origHeaderColor = m_headerColor;
00073     m_origTagColor = m_tagColor;
00074     m_origBranchColor = m_branchColor;
00075     m_origNodeColor = m_deadNodeColor;
00076     m_origDeadNodeColor = m_deadNodeColor;
00077     m_origUserStateNodeColor = m_userStateNodeColor;
00078 }
00079
00080
00081 void CGraphOptDlg::DoDataExchange(CDataExchange* pDX)
00082 {
00083     CDialog::DoDataExchange(pDX);
00084     //{{AFX_DATA_MAP(CGraphOptDlg)
00085     DDX_Control(pDX, IDC_APPLY, m_apply);
00086     DDX_Control(pDX, IDC_RGBSHADOW, m_rgbShadow);
00087     DDX_Control(pDX, IDC_RGBSELECTION, m_rgbSelection);
00088     DDX_Control(pDX, IDC_RGBSTATE, m_rgbState);
00089     DDX_Control(pDX, IDC_RGBDEAD, m_rgbDead);
00090     DDX_Control(pDX, IDC_RGBNODE, m_rgbNode);
00091     DDX_Control(pDX, IDC_RGBBRANCH, m_rgbBranch);
00092     DDX_Control(pDX, IDC_RGBTAG, m_rgbTag);
00093     DDX_Control(pDX, IDC_RGBHEADER, m_rgbHeader);
00094     //}}AFX_DATA_MAP
00095 }
00096
00097
00098 BEGIN_MESSAGE_MAP(CGraphOptDlg, CDialog)
00099     //{{AFX_MSG_MAP(CGraphOptDlg)
00100     ON_BN_CLICKED(IDC_APPLY, OnApply)
00101     ON_BN_CLICKED(IDC_HEADER, OnHeader)
00102     ON_BN_CLICKED(IDC_TAG, OnTag)
00103     ON_BN_CLICKED(IDC_BRANCH, OnBranch)
00104     ON_BN_CLICKED(IDC_NODE, OnNode)
00105     ON_BN_CLICKED(IDC_DEAD, OnDead)
00106     ON_BN_CLICKED(IDC_STATE, OnState)
00107     ON_BN_CLICKED(IDC_SELECTION, OnSelection)
00108     ON_BN_CLICKED(IDC_SHADOW, OnShadow)
00109     ON_BN_CLICKED(IDC_RESET, OnReset)
00110     //}}AFX_MSG_MAP
00111 END_MESSAGE_MAP()
00112
00114 // CGraphOptDlg message handlers
00115
00116 void CGraphOptDlg::GetAllColors()
00117 {
00118     m_shadowColor = (int)m_rgbShadow.GetColor();
00119     m_selColor = (int)m_rgbSelection.GetColor();
00120     m_userStateNodeColor = (int)m_rgbState.GetColor();
00121     m_deadNodeColor = (int)m_rgbDead.GetColor();
00122     m_nodeColor = (int)m_rgbNode.GetColor();
00123     m_branchColor = (int)m_rgbBranch.GetColor();
00124     m_tagColor = (int)m_rgbTag.GetColor();
00125     m_headerColor = (int)m_rgbHeader.GetColor();
00126 }
00127
00128 void CGraphOptDlg::OnOK()
00129 {
00130     GetAllColors();
00131
00132     CDialog::OnOK();
00133 }
00134
00135 void CGraphOptDlg::OnApply()
00136 {
00137     GetAllColors();
00138
00139     CWincvsApp* pApp = (CWincvsApp*)AfxGetApp();
00140     if( pApp )
00141     {
00142         pApp->UpdateAllDocsView();
00143     }
00144
00145     m_apply.EnableWindow(FALSE);
00146 }
00147
00148 void CGraphOptDlg::OnCancel()
00149 {
00150     m_selColor = m_origSelColor;
00151     m_shadowColor = m_origShadowColor;
00152     m_headerColor = m_origHeaderColor;
00153     m_tagColor = m_origTagColor;
00154     m_branchColor = m_origBranchColor;
00155     m_deadNodeColor = m_origNodeColor;
00156     m_deadNodeColor = m_origDeadNodeColor;
00157     m_userStateNodeColor = m_origUserStateNodeColor;
00158
00159     CDialog::OnCancel();
00160 }
00161
00162 void CGraphOptDlg::PromptForColor(CColorStatic& colorStatic)
00163 {
00164     CColorDialog colorDialog(colorStatic.GetColor());
00165     if( colorDialog.DoModal() == IDOK )
00166     {
00167         if( colorDialog.GetColor() != colorStatic.GetColor() )
00168         {
00169             colorStatic.SetColor(colorDialog.GetColor());
00170             m_apply.EnableWindow();
00171         }
00172     }
00173 }
00174
00175 void CGraphOptDlg::OnHeader()
00176 {
00177     PromptForColor(m_rgbHeader);
00178 }
00179
00180 void CGraphOptDlg::OnTag()
00181 {
00182     PromptForColor(m_rgbTag);
00183 }
00184
00185 void CGraphOptDlg::OnBranch()
00186 {
00187     PromptForColor(m_rgbBranch);
00188 }
00189
00190 void CGraphOptDlg::OnNode()
00191 {
00192     PromptForColor(m_rgbNode);
00193 }
00194
00195 void CGraphOptDlg::OnDead()
00196 {
00197     PromptForColor(m_rgbDead);
00198 }
00199
00200 void CGraphOptDlg::OnState()
00201 {
00202     PromptForColor(m_rgbState);
00203 }
00204
00205 void CGraphOptDlg::OnSelection()
00206 {
00207     PromptForColor(m_rgbSelection);
00208 }
00209
00210 void CGraphOptDlg::OnShadow()
00211 {
00212     PromptForColor(m_rgbShadow);
00213 }
00214
00215 void CGraphOptDlg::OnReset()
00216 {
00217     m_rgbShadow.SetColor(RGB_DEF_SHADOW);
00218     m_rgbSelection.SetColor(RGB_DEF_SEL);
00219     m_rgbState.SetColor(RGB_DEF_USERSTATENODE);
00220     m_rgbDead.SetColor(RGB_DEF_DEADNODE);
00221     m_rgbNode.SetColor(RGB_DEF_NODE);
00222     m_rgbBranch.SetColor(RGB_DEF_BRANCH);
00223     m_rgbTag.SetColor(RGB_DEF_TAG);
00224     m_rgbHeader.SetColor(RGB_DEF_HEADER);
00225
00226     m_apply.EnableWindow();
00227 }
00228
00229 #endif /* WIN32 */
00230
00231 bool CompatGetGraphOptions(CPersistentInt& selColor, CPersistentInt& shadowColor,
00232                            CPersistentInt& headerColor, CPersistentInt& tagColor, CPersistentInt& branchColor,
00233                            CPersistentInt& nodeColor, CPersistentInt& deadNodeColor, CPersistentInt& userStateNodeColor)
00234 {
00235     bool userHitOK = false;
00236
00237 #ifdef WIN32
00238     CGraphOptDlg graphOptDlg(selColor, shadowColor,
00239         headerColor, tagColor, branchColor,
00240         nodeColor, deadNodeColor, userStateNodeColor);
00241     if( graphOptDlg.DoModal() == IDOK )
00242     {
00243         userHitOK = true;
00244     }
00245 #endif /* WIN32 */
00246 #ifdef qMacCvsPP
00247 #endif /* qMacCvsPP */
00248 #if qUnix
00249 #endif // qUnix
00250
00251     return userHitOK && !gCvsPrefs.empty();
00252 }
00253
00254
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/GraphOptDlg.h Source File

common/GraphOptDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- September 2001
00019  */
00020
00021 /*
00022  * GraphOptDlg.h --- graph options dialog
00023  */
00024
00025 #if !defined(AFX_GRAPHOPTDLG_H__E05908EC_20A6_43FE_93C7_0964E6ABB6B1__INCLUDED_)
00026 #define AFX_GRAPHOPTDLG_H__E05908EC_20A6_43FE_93C7_0964E6ABB6B1__INCLUDED_
00027
00028 #if _MSC_VER > 1000
00029 #pragma once
00030 #endif // _MSC_VER > 1000
00031
00032 #ifdef WIN32
00033 #include "ColorStatic.h"
00034 #endif /* WIN32 */
00035
00036 bool CompatGetGraphOptions(CPersistentInt& selColor, CPersistentInt& shadowColor,
00037                            CPersistentInt& headerColor, CPersistentInt& tagColor, CPersistentInt& branchColor,
00038                            CPersistentInt& nodeColor, CPersistentInt& deadNodeColor, CPersistentInt& userStateNodeColor);
00039    // get the graph options...
00040
00041
00042 #ifdef WIN32
00043
00045 // CGraphOptDlg dialog
00046
00047 class CGraphOptDlg : public CDialog
00048 {
00049 // Construction
00050 public:
00051     CGraphOptDlg(CPersistentInt& selColor, CPersistentInt& shadowColor,
00052         CPersistentInt& headerColor, CPersistentInt& tagColor, CPersistentInt& branchColor,
00053         CPersistentInt& nodeColor, CPersistentInt& deadNodeColor, CPersistentInt& userStateNodeColor,
00054         CWnd* pParent = NULL);   // standard constructor
00055
00056 // Dialog Data
00057     //{{AFX_DATA(CGraphOptDlg)
00058     enum { IDD = IDD_GRAPH_OPTIONS };
00059     CButton m_apply;
00060     CColorStatic    m_rgbShadow;
00061     CColorStatic    m_rgbSelection;
00062     CColorStatic    m_rgbState;
00063     CColorStatic    m_rgbDead;
00064     CColorStatic    m_rgbNode;
00065     CColorStatic    m_rgbBranch;
00066     CColorStatic    m_rgbTag;
00067     CColorStatic    m_rgbHeader;
00068     //}}AFX_DATA
00069
00070
00071 // Overrides
00072     // ClassWizard generated virtual function overrides
00073     //{{AFX_VIRTUAL(CGraphOptDlg)
00074     protected:
00075     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00076     //}}AFX_VIRTUAL
00077
00078 // Implementation
00079 protected:
00080
00081     // Generated message map functions
00082     //{{AFX_MSG(CGraphOptDlg)
00083     virtual void OnOK();
00084     afx_msg void OnApply();
00085     afx_msg void OnHeader();
00086     afx_msg void OnTag();
00087     afx_msg void OnBranch();
00088     afx_msg void OnNode();
00089     afx_msg void OnDead();
00090     afx_msg void OnState();
00091     afx_msg void OnSelection();
00092     afx_msg void OnShadow();
00093     afx_msg void OnReset();
00094     virtual void OnCancel();
00095     //}}AFX_MSG
00096     DECLARE_MESSAGE_MAP()
00097 private:
00098     CPersistentInt& m_selColor;
00099     CPersistentInt& m_shadowColor;
00100     CPersistentInt& m_headerColor;
00101     CPersistentInt& m_tagColor;
00102     CPersistentInt& m_branchColor;
00103     CPersistentInt& m_nodeColor;
00104     CPersistentInt& m_deadNodeColor;
00105     CPersistentInt& m_userStateNodeColor;
00106
00107     int m_origSelColor;
00108     int m_origShadowColor;
00109     int m_origHeaderColor;
00110     int m_origTagColor;
00111     int m_origBranchColor;
00112     int m_origNodeColor;
00113     int m_origDeadNodeColor;
00114     int m_origUserStateNodeColor;
00115
00116     void PromptForColor(CColorStatic& colorStatic);
00117         // select the color
00118
00119     void GetAllColors();
00120         // retrieve all colors
00121 };
00122
00123 //{{AFX_INSERT_LOCATION}}
00124 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00125
00126 #endif /* WIN32 */
00127
00128 #endif // !defined(AFX_GRAPHOPTDLG_H__E05908EC_20A6_43FE_93C7_0964E6ABB6B1__INCLUDED_)
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/ImportDlg.cpp Source File

common/ImportDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * ImportDlg.cpp : the cvs import dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #endif /* WIN32 */
00030
00031 #if qUnix
00032 #   include "UCvsDialogs.h"
00033 #   include "CheckoutDlg.h"
00034 #endif
00035
00036 #ifdef qMacCvsPP
00037 #   include <UModalDialogs.h>
00038 #   include <LMultiPanelView.h>
00039 #   include <LPopupGroupBox.h>
00040 #   include <LCheckBox.h>
00041 #   include <LTextEditView.h>
00042 #   include <LEditText.h>
00043 #   include <LPushButton.h>
00044
00045 #   include "MacCvsConstant.h"
00046 #endif /* qMacCvsPP */
00047
00048 #include "ImportDlg.h"
00049 #include "CvsPrefs.h"
00050 #include "MultiString.h"
00051 #include "PromptFiles.h"
00052 #include "TextBinary.h"
00053 #include "MakeSurePathExists.h"
00054
00055 static char *sDefReleases[] =
00056 {
00057     "V10",
00058     "V101",
00059     0L
00060 };
00061
00062 static char *sDefVendors[] =
00063 {
00064     "GNU",
00065     0L
00066 };
00067
00068 static char *sDefModuleNames[] =
00069 {
00070     "Module",
00071     "Project",
00072     0L
00073 };
00074
00075 static CMString gVendorNames(10, "P_VendorNames", sDefVendors);
00076 static CMString gReleasesNames(10, "P_ReleaseNames", sDefReleases);
00077 static CMString gImportModuleNames(10, "P_ImportModuleNames", sDefModuleNames);
00078
00079 #ifdef WIN32
00080 #   include "GetPrefs.h"
00081 #   ifdef _DEBUG
00082 #   define new DEBUG_NEW
00083 #   undef THIS_FILE
00084     static char THIS_FILE[] = __FILE__;
00085 #   endif
00086
00087 IMPLEMENT_DYNCREATE(CImport_MAIN, CPropertyPage)
00088
00089 CImport_MAIN::CImport_MAIN(const char *logmsg, const char *modname,
00090                            const char *rtag, const char *vtag) :
00091     CPropertyPage(CImport_MAIN::IDD)
00092 {
00093     //{{AFX_DATA_INIT(CImport_MAIN)
00094     m_logmsg = logmsg;
00095     m_vtag = vtag;
00096     m_rtag = rtag;
00097     m_modname = modname;
00098     //}}AFX_DATA_INIT
00099 }
00100
00101 CImport_MAIN::CImport_MAIN() : CPropertyPage(CImport_MAIN::IDD)
00102 {
00103 }
00104
00105 CImport_MAIN::~CImport_MAIN()
00106 {
00107 }
00108
00109 void CImport_MAIN::DoDataExchange(CDataExchange* pDX)
00110 {
00111     CPropertyPage::DoDataExchange(pDX);
00112
00113     //{{AFX_DATA_MAP(CImport_MAIN)
00114     DDX_Control(pDX, IDC_COMBOMODNAME, m_modnameCombo);
00115     DDX_Control(pDX, IDC_COMBORTAG, m_rtagCombo);
00116     DDX_Control(pDX, IDC_COMBOVTAG, m_vtagCombo);
00117     DDX_Text(pDX, IDC_LOGMSG, m_logmsg);
00118     DDX_CBString(pDX, IDC_COMBOVTAG, m_vtag);
00119     DDX_CBString(pDX, IDC_COMBORTAG, m_rtag);
00120     DDX_CBString(pDX, IDC_COMBOMODNAME, m_modname);
00121     //}}AFX_DATA_MAP
00122     DDV_MinChars(pDX, m_modname, 1);
00123     DDV_MinChars(pDX, m_rtag, 1);
00124     DDV_MinChars(pDX, m_vtag, 1);
00125     DDX_ComboMString(pDX, IDC_COMBOMODNAME, gImportModuleNames, m_modnameCombo);
00126     DDX_ComboMString(pDX, IDC_COMBOVTAG, gVendorNames, m_vtagCombo);
00127     DDX_ComboMString(pDX, IDC_COMBORTAG, gReleasesNames, m_rtagCombo);
00128
00129     //error if the vendor and release tags are same
00130     if( pDX->m_bSaveAndValidate )
00131     {
00132         if( m_vtag == m_rtag )
00133         {
00134             AfxMessageBox("Vendor Tag and Release Tag can't have the same values.", MB_ICONEXCLAMATION, AFX_IDP_PARSE_STRING_SIZE);
00135             pDX->Fail();
00136         }
00137     }
00138 }
00139
00140
00141 BEGIN_MESSAGE_MAP(CImport_MAIN, CPropertyPage)
00142     //{{AFX_MSG_MAP(CImport_MAIN)
00143         // NOTE: the ClassWizard will add message map macros here
00144     //}}AFX_MSG_MAP
00145 END_MESSAGE_MAP()
00146
00147 IMPLEMENT_DYNCREATE(CImport_OPTIONS, CPropertyPage)
00148
00149 CImport_OPTIONS::CImport_OPTIONS(const char *path, const bool useDefIgnore) :
00150     CPropertyPage(CImport_OPTIONS::IDD)
00151 {
00152     //{{AFX_DATA_INIT(CImport_OPTIONS)
00153     m_path = path;
00154     m_chkUseDefIgnore = useDefIgnore;
00155     //}}AFX_DATA_INIT
00156 }
00157
00158 CImport_OPTIONS::CImport_OPTIONS() : CPropertyPage(CImport_OPTIONS::IDD)
00159 {
00160 }
00161
00162 CImport_OPTIONS::~CImport_OPTIONS()
00163 {
00164 }
00165
00166 void CImport_OPTIONS::DoDataExchange(CDataExchange* pDX)
00167 {
00168     CPropertyPage::DoDataExchange(pDX);
00169
00170     //{{AFX_DATA_MAP(CImport_OPTIONS)
00171     DDX_Text(pDX, IDC_PATH, m_path);
00172     DDX_Check(pDX, IDC_USEDEFIGNORE, m_chkUseDefIgnore);
00173     //}}AFX_DATA_MAP
00174
00175     if( pDX->m_bSaveAndValidate )
00176     {
00177         //check the import directory
00178         if( !CompatMakeSurePathExists(m_path, false) )
00179         {
00180             AfxMessageBox("Cannot find folder " + m_path);
00181             pDX->PrepareEditCtrl(IDC_PATH);
00182             pDX->Fail();
00183         }
00184     }
00185 }
00186
00187
00188 BEGIN_MESSAGE_MAP(CImport_OPTIONS, CPropertyPage)
00189     //{{AFX_MSG_MAP(CImport_OPTIONS)
00190     ON_BN_CLICKED(IDC_BTNPATH2, OnBtnpath)
00191     //}}AFX_MSG_MAP
00192 END_MESSAGE_MAP()
00193
00195 // CImport_OPTIONS message handlers
00196
00197 void CImport_OPTIONS::OnBtnpath()
00198 {
00199     const char *dir = BrowserGetDirectory("Select a directory to import :", IsWindow(this->m_hWnd) ? this : NULL);
00200     if(dir != NULL)
00201         SetDlgItemText(IDC_PATH, dir);
00202 }
00203 #endif /* WIN32 */
00204
00205 #ifdef qMacCvsPP
00206 static void DoDataExchange_ImportMain(LWindow *theDialog, CPStr & modname, CStr & logmsg, bool putValue)
00207 {
00208     LEditText *mname = dynamic_cast<LEditText*>
00209         (theDialog->FindPaneByID(item_ModuleName));
00210     LTextEditView *editLog = dynamic_cast<LTextEditView*>
00211         (theDialog->FindPaneByID(item_LogMsg));
00212
00213     if(putValue)
00214     {
00215         mname->SetText((Ptr)(const char *)modname, modname.length());
00216         editLog->SetTextPtr((Ptr)(const char *)logmsg, logmsg.length());
00217         theDialog->SetLatentSub(mname);
00218
00219         // this will take care about an empty module name
00220         mname->AddListener(GetDlgHandler());
00221         if(modname.length() == 0)
00222         {
00223             LPushButton *theOK = dynamic_cast<LPushButton*>
00224                                         (theDialog->FindPaneByID(item_OK));
00225             Assert_(theOK != 0L);
00226             theOK->Disable();
00227         }
00228     }
00229     else
00230     {
00231         Handle hdl = editLog->GetTextHandle();
00232         Assert_(hdl != 0L);
00233         logmsg.set(*hdl, GetHandleSize(hdl));
00234
00235         char buf[512];
00236         Size len;
00237         mname->GetText(buf, 511, &len);
00238         modname.set(buf, len);
00239
00240     }
00241 }
00242
00243 static void DoDataExchange_ImportTags(LWindow *theDialog, CPStr & vendortag, CPStr & reltag, bool putValue)
00244 {
00245     LEditText *vtag = dynamic_cast<LEditText*>
00246         (theDialog->FindPaneByID(item_Vendortag));
00247     LEditText *rtag = dynamic_cast<LEditText*>
00248         (theDialog->FindPaneByID(item_Reltag));
00249
00250     if(putValue)
00251     {
00252         vtag->SetText((Ptr)(const char *)vendortag, vendortag.length());
00253         rtag->SetText((Ptr)(const char *)reltag, reltag.length());
00254         theDialog->SetLatentSub(vtag);
00255     }
00256     else
00257     {
00258         char buf[512];
00259         Size len;
00260         vtag->GetText(buf, 511, &len);
00261         vendortag.set(buf, len);
00262         rtag->GetText(buf, 511, &len);
00263         reltag.set(buf, len);
00264
00265     }
00266 }
00267 #endif /* qMacCvsPP */
00268 #if qUnix
00269 class UCvsImport : public UWidget
00270 {
00271     UDECLARE_DYNAMIC(UCvsImport)
00272 public:
00273     UCvsImport() : UWidget(::UEventGetWidID()) {}
00274     virtual ~UCvsImport() {}
00275
00276     enum
00277     {
00278         kOK = EV_COMMAND_START, // 0
00279         kCancel,                // 1
00280         kTabGeneral             // 2
00281     };
00282
00283     virtual void DoDataExchange(bool fill);
00284
00285 protected:
00286     ev_msg int OnOK(void);
00287     ev_msg int OnCancel(void);
00288
00289     UDECLARE_MESSAGE_MAP()
00290 };
00291
00292 UIMPLEMENT_DYNAMIC(UCvsImport, UWidget)
00293
00294 UBEGIN_MESSAGE_MAP(UCvsImport, UWidget)
00295     ON_UCOMMAND(UCvsImport::kOK, UCvsImport::OnOK)
00296     ON_UCOMMAND(UCvsImport::kCancel, UCvsImport::OnCancel)
00297 UEND_MESSAGE_MAP()
00298
00299 int UCvsImport::OnOK(void)
00300 {
00301     EndModal(true);
00302     return 0;
00303 }
00304
00305 int UCvsImport::OnCancel(void)
00306 {
00307     EndModal(false);
00308     return 0;
00309 }
00310
00311 void UCvsImport::DoDataExchange(bool fill)
00312 {
00313     if(fill)
00314     {
00315     }
00316     else
00317     {
00318     }
00319 }
00320
00321 class UCvsImport_MAIN : public UWidget
00322 {
00323     UDECLARE_DYNAMIC(UCvsImport_MAIN)
00324 public:
00325     UCvsImport_MAIN(const char *logmsg, const char *modname,
00326                     const char *rtag, const char *vtag);
00327     virtual ~UCvsImport_MAIN() {}
00328
00329     enum
00330     {
00331         kEditModule = EV_COMMAND_START, // 0
00332         kEditLog,                       // 1
00333         kEditVendor,                    // 2
00334         kEditRelease                    // 3
00335     };
00336
00337     virtual void DoDataExchange(bool fill);
00338
00339     UStr m_logmsg;
00340     UStr m_modname;
00341     UStr m_rtag;
00342     UStr m_vtag;
00343 protected:
00344
00345     UDECLARE_MESSAGE_MAP()
00346 };
00347
00348 UIMPLEMENT_DYNAMIC(UCvsImport_MAIN, UWidget)
00349
00350 UBEGIN_MESSAGE_MAP(UCvsImport_MAIN, UWidget)
00351 UEND_MESSAGE_MAP()
00352
00353 UCvsImport_MAIN::UCvsImport_MAIN(const char *logmsg, const char *modname,
00354                                  const char *rtag, const char *vtag) : UWidget(::UEventGetWidID())
00355 {
00356     m_logmsg = logmsg;
00357     m_modname = modname;
00358     m_rtag = rtag;
00359     m_vtag = vtag;
00360 }
00361
00362 void UCvsImport_MAIN::DoDataExchange(bool fill)
00363 {
00364     ::DoDataExchange(fill, GetWidID(), kEditModule, gOldModules);
00365     ::DoDataExchange(fill, GetWidID(), kEditRelease, gReleasesNames);
00366     ::DoDataExchange(fill, GetWidID(), kEditVendor, gVendorNames);
00367
00368     if(fill)
00369     {
00370         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditLog, (void *)(const char *)m_logmsg);
00371         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditModule, (void *)(const char *)m_modname);
00372         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditRelease, (void *)(const char *)m_rtag);
00373         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditVendor, (void *)(const char *)m_vtag);
00374     }
00375     else
00376     {
00377         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditLog, &m_logmsg);
00378         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditModule, &m_modname);
00379         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditRelease, &m_rtag);
00380         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditVendor, &m_vtag);
00381     }
00382 }
00383
00384 class UCvsImport_OPTIONS : public UWidget
00385 {
00386     UDECLARE_DYNAMIC(UCvsImport_OPTIONS)
00387 public:
00388     UCvsImport_OPTIONS(const char *path);
00389     virtual ~UCvsImport_OPTIONS() {}
00390
00391     enum
00392     {
00393         kStatPath = EV_COMMAND_START,   // 0
00394         kBtnChange                      // 1
00395     };
00396
00397     virtual void DoDataExchange(bool fill);
00398
00399     UStr m_path;
00400 protected:
00401
00402     ev_msg int OnChange(void);
00403
00404     UDECLARE_MESSAGE_MAP()
00405 };
00406
00407 UIMPLEMENT_DYNAMIC(UCvsImport_OPTIONS, UWidget)
00408
00409 UBEGIN_MESSAGE_MAP(UCvsImport_OPTIONS, UWidget)
00410     ON_UCOMMAND(UCvsImport_OPTIONS::kBtnChange, UCvsImport_OPTIONS::OnChange)
00411 UEND_MESSAGE_MAP()
00412
00413 UCvsImport_OPTIONS::UCvsImport_OPTIONS(const char *path) : UWidget(::UEventGetWidID())
00414 {
00415     m_path = path;
00416 }
00417
00418 int UCvsImport_OPTIONS::OnChange()
00419 {
00420     const char *dir = BrowserGetDirectory("Select a directory to import :");
00421     if(dir != 0L)
00422         UEventSendMessage(GetWidID(), EV_SETTEXT, kStatPath, (void *)dir);
00423     return 0;
00424 }
00425
00426 void UCvsImport_OPTIONS::DoDataExchange(bool fill)
00427 {
00428     if(fill)
00429     {
00430         UEventSendMessage(GetWidID(), EV_SETTEXT, kStatPath, (void *)(const char *)m_path);
00431     }
00432     else
00433     {
00434         UEventSendMessage(GetWidID(), EV_GETTEXT, kStatPath, &m_path);
00435     }
00436 }
00437 #endif // qUnix
00438
00439 bool CompatGetImport(CPStr & modname, CStr & logmsg, CPStr & vendortag,
00440                     CPStr & reltag, CPStr & path,
00441                     bool& useDefIgnore)
00442 {
00443     bool userHitOK = false;
00444     modname = "";
00445     logmsg = "";
00446     vendortag = "";
00447     reltag = "";
00448     useDefIgnore = false;
00449
00450     static CPStr sLastModName;  /*Obsolete - remove it and always use sFolder! Get rid after all platforms have combo boxes for recent modules!*/
00451
00452     static CPStr sFolder;
00453     static CStr sLastMsg;
00454     static CPStr sLastVTag("avendor");
00455     static CPStr sLastRTag("arelease");
00456
00457     //dig out the folder so we can suggest the module name
00458     CStr uppath, folder;
00459     if( SplitPath(path, uppath, folder) )
00460         sFolder = folder;
00461
00462     if( sLastModName.length() == 0L )   /*Obsolete - see above*/
00463     {
00464         sLastModName = folder;
00465     }
00466 #ifdef WIN32
00467     CPropertySheet pages("Import settings");
00468     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00469     CImport_MAIN page1(sLastMsg, sFolder, sLastRTag, sLastVTag);
00470     CImport_OPTIONS page2(path, useDefIgnore);
00471     CGetPrefs_CVSROOT page3;
00472     CGetPrefs_GLOBALS page4;
00473     pages.AddPage(&page1);
00474     pages.AddPage(&page2);
00475     pages.AddPage(&page3);
00476     pages.AddPage(&page4);
00477     if(pages.DoModal() == IDOK)
00478     {
00479         sLastModName = (const char *)page1.m_modname;
00480         sLastMsg = (const char *)page1.m_logmsg;
00481         sLastVTag = (const char *)page1.m_vtag;
00482         sLastRTag = (const char *)page1.m_rtag;
00483         path = (const char *)page2.m_path;
00484         useDefIgnore = page2.m_chkUseDefIgnore == TRUE;
00485
00486         page3.StoreValues();
00487         page4.StoreValues();
00488         userHitOK = true;
00489     }
00490 #endif /* WIN32 */
00491 #ifdef qMacCvsPP
00492     StDialogHandler theHandler(dlg_Import, LCommander::GetTopCommander());
00493     LWindow *theDialog = theHandler.GetDialog();
00494     ThrowIfNil_(theDialog);
00495     static UInt16 sRuntimePanel = 1;
00496
00497     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00498         (theDialog->FindPaneByID(item_MultiViewPrefs));
00499     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00500
00501     multiView->SwitchToPanel(3);
00502     DoDataExchange_Globals(theDialog, true);
00503     multiView->SwitchToPanel(2);
00504     DoDataExchange (theDialog, item_ImportCvsIgnore, useDefIgnore, true);
00505     DoDataExchange (theDialog, item_EditPath, path, true);
00506     dynamic_cast<LControl*> (theDialog->FindPaneByID (item_EditPath))->AddListener (&theHandler);
00507
00508     multiView->SwitchToPanel(1);
00509     DoDataExchange_ImportMain(theDialog, sLastModName, sLastMsg, true);
00510     DoDataExchange_ImportTags(theDialog, sLastVTag, sLastRTag, true);
00511
00512
00513     groupView->SetValue(sRuntimePanel);
00514     theDialog->Show();
00515     MessageT hitMessage;
00516     while (true)
00517     {       // Let DialogHandler process events
00518         hitMessage = theHandler.DoDialog();
00519
00520         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00521             break;
00522
00523         if(hitMessage == item_EditPath)
00524         {
00525             const char * dir = BrowserGetDirectory("Choose folder to import :");
00526             if(dir != 0L)
00527             {
00528                 CPStr tmp(dir);
00529                 theDialog->SetDescriptorForPaneID(item_EditPath, tmp);
00530             }
00531         }
00532     }
00533     theDialog->Hide();
00534     sRuntimePanel = groupView->GetValue();
00535
00536     if(hitMessage == msg_OK)
00537     {
00538         multiView->SwitchToPanel(1);
00539         DoDataExchange_ImportMain(theDialog, sLastModName, sLastMsg, false);
00540         DoDataExchange_ImportTags(theDialog, sLastVTag, sLastRTag, false);
00541         multiView->SwitchToPanel(2);
00542         DoDataExchange (theDialog, item_ImportCvsIgnore, useDefIgnore, false);
00543         DoDataExchange (theDialog, item_EditPath, path, false);
00544         multiView->SwitchToPanel(3);
00545         DoDataExchange_Globals(theDialog, false);
00546
00547         Assert_(sLastModName.length() != 0);
00548
00549         userHitOK = true;
00550     }
00551 #endif /* qMacCvsPP */
00552 #if qUnix
00553     void *wid = UCreate_ImportDlg();
00554
00555     UCvsImport *dlg = new UCvsImport();
00556     UCvsImport_MAIN *tab1 = new UCvsImport_MAIN(sLastMsg, sLastModName, sLastRTag, sLastVTag);
00557     UCvsImport_OPTIONS *tab2 = new UCvsImport_OPTIONS(path);
00558     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00559     dlg->AddPage(tab1, UCvsImport::kTabGeneral, 0);
00560     dlg->AddPage(tab2, UCvsImport::kTabGeneral, 1);
00561
00562     if(dlg->DoModal())
00563     {
00564         sLastModName = tab1->m_modname;
00565         sLastMsg = tab1->m_logmsg;
00566         sLastVTag = tab1->m_vtag;
00567         sLastRTag = tab1->m_rtag;
00568         path = tab2->m_path;
00569
00570         userHitOK = true;
00571     }
00572
00573     delete dlg;
00574 #endif // qUnix
00575
00576     if(userHitOK)
00577     {
00578         gCvsPrefs.save();
00579         if(sLastMsg.length() == 0)
00580             sLastMsg = "no message";
00581         if(sLastVTag.length() == 0)
00582             sLastVTag = "initial";
00583         if(sLastRTag.length() == 0)
00584             sLastRTag = "start";
00585
00586         modname = sLastModName;
00587         logmsg = sLastMsg;
00588         vendortag = sLastVTag;
00589         reltag = sLastRTag;
00590 #ifdef macintosh
00591         logmsg.replace('\015', '\012');
00592 #endif /* macintosh */
00593     }
00594     return userHitOK;
00595 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/ImportDlg.h Source File

common/ImportDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * ImportDlg.h : the cvs import dialog
00023  */
00024
00025 #if !defined(AFX_IMPORTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_IMPORTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 #include "CPStr.h"
00033
00034 bool CompatGetImport(CPStr & modname, CStr & logmsg,
00035                      CPStr & vendortag, CPStr & reltag, CPStr & path,
00036                      bool& useDefIgnore);
00037     // get the import module name and misc options...
00038
00039 #ifdef WIN32
00040 class CImport_MAIN : public CPropertyPage
00041 {
00042     DECLARE_DYNCREATE(CImport_MAIN)
00043
00044 // Construction
00045 public:
00046     CImport_MAIN(const char *logmsg, const char *modname,
00047         const char *rtag, const char *vtag);
00048     CImport_MAIN();
00049     ~CImport_MAIN();
00050
00051 // Dialog Data
00052     //{{AFX_DATA(CImport_MAIN)
00053     enum { IDD = IDD_IMPORT_MAIN };
00054     CComboBox   m_modnameCombo;
00055     CComboBox   m_rtagCombo;
00056     CComboBox   m_vtagCombo;
00057     CString m_logmsg;
00058     CString m_vtag;
00059     CString m_rtag;
00060     CString m_modname;
00061     //}}AFX_DATA
00062
00063
00064 // Overrides
00065     // ClassWizard generate virtual function overrides
00066     //{{AFX_VIRTUAL(CImport_MAIN)
00067     protected:
00068     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00069     //}}AFX_VIRTUAL
00070
00071 // Implementation
00072 protected:
00073     // Generated message map functions
00074     //{{AFX_MSG(CImport_MAIN)
00075         // NOTE: the ClassWizard will add member functions here
00076     //}}AFX_MSG
00077     DECLARE_MESSAGE_MAP()
00078
00079 };
00080
00081 class CImport_OPTIONS : public CPropertyPage
00082 {
00083     DECLARE_DYNCREATE(CImport_OPTIONS)
00084
00085 // Construction
00086 public:
00087     CImport_OPTIONS(const char *path, const bool useDefIgnore);
00088     CImport_OPTIONS();
00089     ~CImport_OPTIONS();
00090
00091 // Dialog Data
00092     //{{AFX_DATA(CImport_OPTIONS)
00093     enum { IDD = IDD_IMPORT_TAGS };
00094     CString m_path;
00095     BOOL    m_chkUseDefIgnore;
00096     //}}AFX_DATA
00097
00098
00099 // Overrides
00100     // ClassWizard generate virtual function overrides
00101     //{{AFX_VIRTUAL(CImport_OPTIONS)
00102     protected:
00103     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00104     //}}AFX_VIRTUAL
00105
00106 // Implementation
00107 protected:
00108     // Generated message map functions
00109     //{{AFX_MSG(CImport_OPTIONS)
00110     afx_msg void OnBtnpath();
00111     //}}AFX_MSG
00112     DECLARE_MESSAGE_MAP()
00113
00114 };
00115
00116 //{{AFX_INSERT_LOCATION}}
00117 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00118 #endif /* WIN32 */
00119
00120 #endif // !defined(AFX_IMPORTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/ImportFilter.cpp Source File

common/ImportFilter.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * ImportFilter.cpp : filter the imported files before importing
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "resource.h"
00029 #endif /* WIN32 */
00030
00031 #ifdef macintosh
00032 #   include "GUSIInternal.h"
00033 #   include "GUSIFileSpec.h"
00034 #   include "MacMisc.h"
00035 #endif /* macintosh */
00036
00037 #include "ImportFilter.h"
00038 #include "AppConsole.h"
00039
00040 //
00041 // MN - Apply $HOME/.cvsignore to import filter
00042 //
00043 // list_add_type function uses ignore filter to decided whether
00044 // a file should be ignored in importing (user can change this
00045 // in import dialogbox, but this is a default). If user imports
00046 // a whole subdirectory instead of a file then this will
00047 // eliminate ignored files.
00048 //
00049 #include "CvsIgnore.h"
00050
00051 #if qCvsDebug
00052 #   include "CvsAlert.h"
00053 #endif /* qCvsDebug */
00054
00055 #ifdef macintosh
00056     static const char *lf = "\r";
00057 #elif defined(WIN32)
00058     static const char *lf = "\r\n";
00059 #else
00060     static const char *lf = "\n";
00061 #endif
00062
00063 #ifdef WIN32
00064 #   ifdef _DEBUG
00065 #   define new DEBUG_NEW
00066 #   undef THIS_FILE
00067     static char THIS_FILE[] = __FILE__;
00068 #   endif
00069 #endif /* WIN32 */
00070
00071 #ifndef NEW
00072 #define NEW new
00073 #endif
00074
00075 ReportConflict::ReportConflict(int mac_type, int mac_creator)
00076 {
00077     next = 0L;
00078     status = noConflict;
00079     ftype = mac_type;
00080     fcreator = mac_creator;
00081 }
00082
00083 void ReportConflict::PrintOut(CStr & out) const
00084 {
00085     out = "";
00086     if(HasConflict())
00087     {
00088         out << "Text/Binary conflict, at least these files :";
00089         out << lf;
00090         if(!sample1.empty() && !sample2.empty())
00091         {
00092             out << "    ";
00093             out << sample1;
00094             out << " and ";
00095             out << sample2;
00096             out << lf;
00097         }
00098     }
00099     else if(HasTypeCreatorConflict())
00100     {
00101         out << "Mac signature mismatch for this type, at least these files :";
00102         out << lf;
00103         if(!sample1.empty() && !sample2.empty())
00104         {
00105             out << "    ";
00106             out << sample1;
00107             out << " and ";
00108             out << sample2;
00109             out << lf;
00110         }
00111     }
00112 }
00113
00114 #if qCvsDebug
00115 void ReportConflict::PrintOut(void) const
00116 {
00117     if(pattern.empty())
00118         return;
00119
00120     cvs_out("  New type : %s%s (%s)\n",
00121         (status & hasExtension) ? "*" : "",
00122         (const char *)pattern,
00123         (status & isBinary) ? "BINARY" : "TEXT"
00124     );
00125     if(!sample1.empty() && !sample2.empty())
00126     {
00127         if(HasConflict())
00128             cvs_out("    Text/Binary CONFLICT ! %s and %s\n",
00129                     (const char *)sample1, (const char *)sample2);
00130         else if(HasTypeCreatorConflict())
00131             cvs_out("    Mac signature mismatch ! %s and %s\n",
00132                     (const char *)sample1, (const char *)sample2);
00133     }
00134 }
00135 #endif /* qCvsDebug */
00136
00137 ReportConflict::~ReportConflict()
00138 {
00139 }
00140
00141 void ReportConflict::AddPattern(const char *newpat, bool isBin, bool isExt,
00142                              const char *sample)
00143 {
00144     pattern = newpat;
00145     sample1 = sample;
00146     if(isBin)
00147         status |= isBinary;
00148     if(isExt)
00149         status |= hasExtension;
00150 }
00151
00152 bool ReportConflict::Match(const char *pat)
00153 {
00154     if(pat == 0L || pattern.empty())
00155         return false;
00156
00157     int len = strlen(pat);
00158     int patlen = pattern.length();
00159
00160     if(status & hasExtension)
00161     {
00162         if(len < patlen)
00163             return false;
00164         // since it is the server who compares against the pattern,
00165         // that might be a case compare
00166 #if 0 //def WIN32
00167         return stricmp(pattern, pat + len - patlen) == 0;
00168 #else /* !WIN32 */
00169         return strcmp(pattern, pat + len - patlen) == 0;
00170 #endif /* !WIN32 */
00171     }
00172
00173 #if 0 //def WIN32
00174     return stricmp(pattern, pat) == 0;
00175 #else /* !WIN32 */
00176     return strcmp(pattern, pat) == 0;
00177 #endif /* !WIN32 */
00178 }
00179
00180 void ReportConflict::SetConflict(const char *sample)
00181 {
00182     // one is enough !
00183     if(HasConflict())
00184         return;
00185
00186     sample2 = sample;
00187     status |= hasConflict;
00188 }
00189
00190 void ReportConflict::SetTypeCreatorConflict(const char *sample)
00191 {
00192     // one is enough !
00193     if(HasTypeCreatorConflict() || HasConflict())
00194         return;
00195
00196     sample2 = sample;
00197     status |= hasTypeCreatorConflict;
00198 }
00199
00200 const size_t ReportWarning::maxWarnings = 10;
00201
00202 ReportWarning::ReportWarning(kTextBinTYPE akind)
00203 {
00204     kind = akind;
00205     next = 0L;
00206     tooMuchWarnings = false;
00207 }
00208
00209 ReportWarning::~ReportWarning()
00210 {
00211 }
00212
00213 void ReportWarning::PrintOut(CStr & out) const
00214 {
00215     out = "";
00216
00217     if(samples.size() == 0)
00218         return;
00219
00220     out = "Warning : ";
00221     switch(kind)
00222     {
00223     default:
00224     case kFileIsOK: out << "Files are OK"; break;
00225     case kFileMissing: out << "Files are missing or unreadable"; break;
00226     case kFileIsAlias: out << "Files are aliases"; break;
00227     case kFileInvalidName: out << "Files have invalid name"; break;
00228     case kTextWrongLF: out << "Files have the wrong line feed"; break;
00229     case kTextIsBinary: out << "Files are binary"; break;
00230     case kTextEscapeChar: out << "Files have escape characters in it"; break;
00231     case kTextWrongSig: out << "Text files have the wrong signature"; break;
00232     case kBinIsText: out << "Files are text, should be binary"; break;
00233     case kBinWrongSig: out << "Binary files have the wrong signature"; break;
00234     }
00235     out << lf;
00236     std::vector<CStr>::const_iterator i;
00237     for(i = samples.begin(); i != samples.end(); ++i)
00238     {
00239         out << "    ";
00240         out << *i;
00241         out << lf;
00242     }
00243     if(tooMuchWarnings)
00244     {
00245         out << "    More files follow";
00246         out << lf;
00247     }
00248 }
00249
00250 #if qCvsDebug
00251 void ReportWarning::PrintOut(void) const
00252 {
00253     if(samples.size() == 0)
00254         return;
00255
00256     cvs_out("  Warning : ");
00257     switch(kind)
00258     {
00259     default:
00260     case kFileIsOK: cvs_out("Files are OK\n"); break;
00261     case kFileMissing: cvs_out("Files are missing or unreadable\n"); break;
00262     case kFileIsAlias: cvs_out("Files are aliases\n"); break;
00263     case kFileInvalidName: cvs_out("Files have invalid name\n"); break;
00264     case kTextWrongLF: cvs_out("Files have the wrong line feed\n"); break;
00265     case kTextIsBinary: cvs_out("Files are binary\n"); break;
00266     case kTextEscapeChar: cvs_out("Files have escape characters in it\n"); break;
00267     case kTextWrongSig: cvs_out("Text files have the wrong signature\n"); break;
00268     case kBinIsText: cvs_out("Files are text, should be binary\n"); break;
00269     case kBinWrongSig: cvs_out("Binary files have the wrong signature\n"); break;
00270     }
00271     std::vector<CStr>::const_iterator i;
00272     for(i = samples.begin(); i != samples.end(); ++i)
00273     {
00274         cvs_out("    %s\n", (const char *)(*i));
00275     }
00276     if(tooMuchWarnings)
00277         cvs_out("    More files follow\n");
00278 }
00279 #endif /* qCvsDebug */
00280
00281 void ReportWarning::AddWarning(const char *sample)
00282 {
00283     // it's enough !
00284     if(samples.size() >= maxWarnings)
00285     {
00286         tooMuchWarnings = true;
00287         return;
00288     }
00289
00290     samples.push_back(CStr(sample));
00291 }
00292
00293 static void list_add_warning(ReportWarning *& warnings, kTextBinTYPE warn, const char *sample)
00294 {
00295     // find if it exists already a same kind of warning
00296     ReportWarning *tmp = warnings;
00297     while(tmp != 0L)
00298     {
00299         if(tmp->Kind() == warn)
00300             break;
00301         tmp = tmp->next;
00302     }
00303     if(tmp != 0L && tmp->Kind() == warn)
00304     {
00305         tmp->AddWarning(sample);
00306         return;
00307     }
00308
00309     // insert new one
00310     tmp = NEW ReportWarning(warn);
00311     if(tmp == 0L)
00312     {
00313         cvs_err("Impossible to allocate %d bytes !\n", sizeof(ReportWarning));
00314         return;
00315     }
00316
00317     tmp->AddWarning(sample);
00318     if(warnings == 0L)
00319     {
00320         warnings = tmp;
00321     }
00322     else
00323     {
00324         tmp->next = warnings;
00325         warnings = tmp;
00326     }
00327 }
00328
00329 class ImportReport;
00330 static void list_add_type(ImportReport *impReport, ReportConflict *& conflicts, bool isBinary,
00331                           const char *sample, const char *fullname,
00332                           int mac_type, int mac_creator);
00333
00334 class ImportReport : public TraversalReport
00335 {
00336 public:
00337     ImportReport(const char *path, ReportWarning *& w, ReportConflict *& c) : warnings(w), conflicts(c)
00338     {
00339         // MN - Apply ignore filter to import file list
00340         BuildIgnoredList(m_Ignlist, path);
00341     }
00342     virtual ~ImportReport() {}
00343
00344     ReportWarning *& warnings;
00345     ReportConflict *& conflicts;
00346     std::vector<CStr> m_Ignlist;
00347         // MN - Ignore list
00348
00349     virtual kTraversal EnterDirectory(const char *fullpath, const char *dirname, const FSSpec * macspec)
00350     {
00351         cvs_out("Filtering \'%s\'...\n", fullpath);
00352         return kContinueTraversal;
00353     }
00354
00355     virtual kTraversal ExitDirectory(const char *fullpath)
00356     {
00357         return kContinueTraversal;
00358     }
00359
00360     virtual kTraversal OnError(const char *err, int errcode)
00361     {
00362         list_add_warning(warnings, kFileMissing, err);
00363         return kContinueTraversal;
00364     }
00365
00366     virtual kTraversal OnIdle(const char *fullpath)
00367     {
00368         return kContinueTraversal;
00369     }
00370
00371     virtual kTraversal OnDirectory(const char *fullpath,
00372         const char *fullname,
00373         const char *name,
00374         const struct stat & dir, const FSSpec * macspec)
00375     {
00376 #if defined(WIN32) || defined(macintosh)
00377         if(stricmp(name, "CVS") == 0)
00378 #else
00379         if(strcmp(name, "CVS") == 0)
00380 #endif
00381             return kSkipFile;
00382         return kContinueTraversal;
00383     }
00384
00385     virtual kTraversal OnFile(const char *fullpath,
00386         const char *fullname,
00387         const char *name,
00388         const struct stat & dir, const FSSpec * macspec)
00389     {
00390         int mac_type = 0;
00391         int mac_creator = 0;
00392 #ifdef macintosh
00393 #   define MACSPEC , &fsSpec
00394         GUSIFileSpec inspec(fullname);
00395         mac_type = inspec.CatInfo()->FileInfo().ioFlFndrInfo.fdType;
00396         mac_creator = inspec.CatInfo()->FileInfo().ioFlFndrInfo.fdCreator;
00397         FSSpec fsSpec = inspec;
00398 #else /* !macintosh */
00399 #   define MACSPEC
00400 #endif /* !macintosh */
00401
00402         kTextBinTYPE filetype = FileIsText(name, fullpath MACSPEC);
00403         if(filetype == kTextIsBinary || filetype == kTextWrongSig)
00404         {
00405             kTextBinTYPE bintype = FileIsBinary(name, fullpath MACSPEC);
00406             if(bintype != kFileIsOK)
00407                 list_add_warning(warnings, bintype, fullname);
00408             else if(filetype == kTextWrongSig)
00409             {
00410                 list_add_warning(warnings, filetype, fullname);
00411                 filetype = kTextIsBinary;
00412             }
00413         }
00414         else if(filetype != kFileIsOK)
00415             list_add_warning(warnings, filetype, fullname);
00416
00417         // add the type
00418         list_add_type(this, conflicts, filetype == kTextIsBinary,
00419                       name, fullname, mac_type, mac_creator);
00420
00421         return kContinueTraversal;
00422     }
00423
00424     virtual kTraversal OnAlias(const char *fullpath,
00425         const char *fullname,
00426         const char *name,
00427         const struct stat & dir, const FSSpec * macspec)
00428     {
00429         list_add_warning(warnings, kFileIsAlias, fullname);
00430         return kContinueTraversal;
00431     }
00432 };
00433
00434 //
00435 // MN - Had to move this function after class ImportReport, because
00436 // this function uses a variable of that type.
00437 //
00438 // When a file is added to warning/conflict list, it is also
00439 // processed through ignore filter. If file should be ignored
00440 // then the initial state is "IGNORE" in import dialogbox.
00441 //
00442 static void list_add_type(ImportReport *impReport, ReportConflict *& conflicts, bool isBinary,
00443                           const char *sample, const char *fullname,
00444                           int mac_type, int mac_creator)
00445 {
00446     // look for a matching entry
00447     ReportConflict *entry = conflicts;
00448     while(entry != 0L)
00449     {
00450         if(entry->Match(sample))
00451         {
00452             if(entry->HasConflict())
00453                 return;
00454
00455             if(entry->IsBinary() ^ isBinary)
00456                 entry->SetConflict(fullname);
00457
00458             // mac only
00459             if(entry->GetMacType() != mac_type || entry->GetMacCreator() != mac_creator)
00460                 entry->SetTypeCreatorConflict(fullname);
00461
00462             // it matches perfectly
00463             return;
00464         }
00465         entry = entry->next;
00466     }
00467
00468     // find the extension
00469     const char *tmp = sample, *ext = 0L;
00470     while((tmp = strchr(tmp, '.')) != 0L)
00471     {
00472         ext = tmp++;
00473     }
00474
00475     // add a new entry
00476     ReportConflict *newc = NEW ReportConflict(mac_type, mac_creator);
00477     if(newc == 0L)
00478     {
00479         cvs_err("Impossible to allocate %d bytes !\n", sizeof(ReportConflict));
00480         return;
00481     }
00482
00483     newc->AddPattern(ext != 0L ? ext : sample, isBinary, ext != 0L, fullname);
00484     if(conflicts == 0L)
00485         conflicts = newc;
00486     else
00487     {
00488         newc->next = conflicts;
00489         conflicts = newc;
00490     }
00491
00492     // MN - Apply ignore filter. If $HOME/.cvsignore tells that
00493     // file should be ignored then set object to ignored state.
00494     if(MatchIgnoredList(sample, impReport->m_Ignlist))
00495         newc->Ignore();
00496 }
00497
00498 kTraversal list_all_types_recur(const char *path, ReportWarning *& warnings,
00499                                 ReportConflict *& conflicts)
00500 {
00501     ImportReport report(path, warnings, conflicts);
00502     return FileTraverse(path, report);
00503 }
00504
00505 void free_list_types(ReportWarning * warnings, ReportConflict * conflicts)
00506 {
00507     ReportWarning *tmpwarn;
00508     ReportWarning *warn = warnings;
00509     while(warn != 0L)
00510     {
00511         tmpwarn = warn;
00512         warn = warn->next;
00513         delete tmpwarn;
00514     }
00515
00516     ReportConflict *tmpconf;
00517     ReportConflict *conf = conflicts;
00518     while(conf != 0L)
00519     {
00520         tmpconf = conf;
00521         conf = conf->next;
00522         delete tmpconf;
00523     }
00524 }
00525
00526 #if qCvsDebug
00527 bool list_all_types(const char *path)
00528 {
00529     ReportWarning * warnings = 0L;
00530     ReportConflict * conflicts = 0L;
00531     list_all_types_recur(path, warnings, conflicts);
00532
00533     cvs_out("Reporting warnings :\n");
00534     ReportWarning *warn = warnings;
00535     while(warn != 0L)
00536     {
00537         warn->PrintOut();
00538         warn = warn->next;
00539     }
00540
00541     cvs_out("Reporting types :\n");
00542     ReportConflict *conf = conflicts;
00543     while(conf != 0L)
00544     {
00545         conf->PrintOut();
00546         conf = conf->next;
00547     }
00548
00549     free_list_types(warnings, conflicts);
00550
00551     return !CvsAlert("Continue importing ?", "Cancel", "Continue");
00552 }
00553 #endif /* qCvsDebug */
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/ImportFilter.h Source File

common/ImportFilter.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * ImportFilter.h : filter the imported files before importing
00023  */
00024
00025 #if !defined(AFX_IMPORTFILTER_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_IMPORTFILTER_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 #include <vector>
00033 #include "TextBinary.h"
00034 #include "CPStr.h"
00035 #include "FileTraversal.h"
00036
00037 #ifdef _MSC_VER
00038     using namespace std;
00039 #endif
00040
00041 // include a type (like *.c or ChangeLog) + several informations
00042 // like : if several files of this type are conflicting (i.e. are
00043 // binary AND text), if it is a binary or text type...
00044 class ReportConflict
00045 {
00046 public:
00047     ReportConflict(int mac_type, int mac_creator);
00048     ~ReportConflict();
00049
00050     ReportConflict *next;
00051
00052     enum
00053     {
00054         noConflict =        0x00,
00055         hasConflict =       0x01,
00056         hasExtension =      0x02,
00057         isBinary =          0x04,
00058         forceBinary =       0x08,
00059         forceText =         0x10,
00060         hasIgnore =         0x20,
00061         hasTypeCreatorConflict = 0x40, /* mac only */
00062         forceNoKeywords =   0x80,
00063         userFlags =     forceText | forceBinary | hasIgnore | forceNoKeywords
00064     };
00065
00066     void AddPattern(const char *newpat, bool isBinary, bool isExtension,
00067         const char *sample);
00068     void SetConflict(const char *sample);
00069     void SetTypeCreatorConflict(const char *sample); /* mac only */
00070     bool Match(const char *pat);
00071
00072     inline bool HasConflict(void) const {return (status & hasConflict) != 0;}
00073     inline bool HasTypeCreatorConflict(void) const {return (status & hasTypeCreatorConflict) != 0;} /* mac only */
00074     inline bool IsBinary(void) const {return (status & isBinary) != 0;}
00075     inline bool IsExtension(void) const {return (status & hasExtension) != 0;}
00076     inline const char *GetPattern(void) const {return pattern;}
00077     inline int GetMacType(void) const {return ftype;} /* mac only */
00078     inline int GetMacCreator(void) const {return fcreator;} /* mac only */
00079
00080     inline void ForceBinary(void)
00081         {status &= ~(int)userFlags; status |= (int)forceBinary;}
00082     inline void ForceText(void)
00083         {status &= ~(int)userFlags; status |= (int)forceText;}
00084     inline void Ignore(void)
00085         {status &= ~(int)userFlags; status |= (int)hasIgnore;}
00086     inline void ForceNoKeywords(void)
00087         {status &= ~(int)userFlags; status |= (int)forceNoKeywords;}
00088     inline bool HasForceBinary(void) const {return (status & forceBinary) != 0;}
00089     inline bool HasForceText(void) const {return (status & forceText) != 0;}
00090     inline bool HasIgnore(void) const {return (status & hasIgnore) != 0;}
00091     inline bool HasForceNoKeywords(void) const {return (status & forceNoKeywords) != 0;}
00092     inline void DisableUserSettings(void)
00093         {status &= ~(int)userFlags;}
00094
00095     void PrintOut(CStr & out) const;
00096 #if qCvsDebug
00097     void PrintOut(void) const;
00098 #endif /* qCvsDebug */
00099
00100 protected:
00101     int status;
00102
00103     CStr pattern;
00104         // an extension or a whole name (hasExtension)
00105     CStr sample1;
00106         // a sample for this entry
00107     CStr sample2;
00108         // another sample (if hasConflict)
00109
00110     int ftype, fcreator; /* mac only */
00111 };
00112
00113 // a warning contains a kind of warning (i.e. wrong line feed,
00114 // has escape characters...) + a set of files which illustrates
00115 // this warning.
00116
00117 class ReportWarning
00118 {
00119 public:
00120     ReportWarning(kTextBinTYPE akind);
00121     ~ReportWarning();
00122
00123     ReportWarning *next;
00124     static const size_t maxWarnings;
00125
00126     void AddWarning(const char *sample);
00127     inline kTextBinTYPE Kind(void) const {return kind;}
00128
00129     void PrintOut(CStr & out) const;
00130 #if qCvsDebug
00131     void PrintOut(void) const;
00132 #endif /* qCvsDebug */
00133
00134 protected:
00135     kTextBinTYPE kind;
00136
00137     std::vector<CStr> samples;
00138     bool tooMuchWarnings;
00139 };
00140
00141 kTraversal list_all_types_recur(const char *path, ReportWarning *& warnings,
00142                          ReportConflict *& conflicts);
00143 void free_list_types(ReportWarning * warnings, ReportConflict * conflicts);
00144
00145 #if qCvsDebug
00146     bool list_all_types(const char *path);
00147 #endif /* qCvsDebug */
00148
00149 #endif // !defined(AFX_IMPORTFILTER_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/ImportFilterDlg.cpp Source File

common/ImportFilterDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * ImportFilterDlg.cpp - edit filtered import
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #endif /* WIN32 */
00030
00031 #if qUnix
00032 #   include "UCvsDialogs.h"
00033 #endif
00034
00035 #ifdef qMacCvsPP
00036 #   include <Icons.h>
00037
00038 #   include <UModalDialogs.h>
00039 #   include <LTableMultiGeometry.h>
00040 #   include <LOutlineKeySelector.h>
00041 #   include <LTableSingleSelector.h>
00042 #   include <LOutlineRowSelector.h>
00043 #   include <UAttachments.h>
00044 #   include <UGAColorRamp.h>
00045 #   include <LTextEditView.h>
00046
00047 #   include "MacCvsConstant.h"
00048 #endif /* qMacCvsPP */
00049
00050 #include "ImportFilterDlg.h"
00051
00052 #ifdef WIN32
00053 #   ifdef _DEBUG
00054 #   define new DEBUG_NEW
00055 #   undef THIS_FILE
00056     static char THIS_FILE[] = __FILE__;
00057 #   endif
00058 #endif /* WIN32 */
00059
00060 #ifdef WIN32
00061 CImportWarning::CImportWarning(ReportWarning * warn, CWnd* pParent /*=NULL*/)
00062     : CDialog(CImportWarning::IDD, pParent)
00063 {
00064     CStr print;
00065     warn->PrintOut(print);
00066     //{{AFX_DATA_INIT(CImportWarning)
00067     m_desc = print;
00068     //}}AFX_DATA_INIT
00069 }
00070
00071
00072 void CImportWarning::DoDataExchange(CDataExchange* pDX)
00073 {
00074     CDialog::DoDataExchange(pDX);
00075     //{{AFX_DATA_MAP(CImportWarning)
00076     DDX_Text(pDX, IDC_WARNINGDESC, m_desc);
00077     //}}AFX_DATA_MAP
00078 }
00079
00080
00081 BEGIN_MESSAGE_MAP(CImportWarning, CDialog)
00082     //{{AFX_MSG_MAP(CImportWarning)
00083         // NOTE: the ClassWizard will add message map macros here
00084     //}}AFX_MSG_MAP
00085 END_MESSAGE_MAP()
00086
00087 CImportEntry::CImportEntry(ReportConflict * entry, CWnd* pParent /*=NULL*/)
00088     : CDialog(CImportEntry::IDD, pParent)
00089 {
00090     CStr print;
00091     entry->PrintOut(print);
00092
00093     //{{AFX_DATA_INIT(CImportEntry)
00094     //}}AFX_DATA_INIT
00095
00096     //keep these outside MFC remarks
00097     m_desc = print;
00098     if(entry->HasForceBinary())
00099         m_radios = 1;
00100     else if(entry->HasForceText())
00101         m_radios = 2;
00102     else if(entry->HasForceNoKeywords())
00103         m_radios = 3;
00104     else if(entry->HasIgnore())
00105         m_radios = 4;
00106     else
00107         m_radios = 0;
00108 }
00109
00110
00111 void CImportEntry::DoDataExchange(CDataExchange* pDX)
00112 {
00113     CDialog::DoDataExchange(pDX);
00114     //{{AFX_DATA_MAP(CImportEntry)
00115     DDX_Text(pDX, IDC_WARNINGDESC, m_desc);
00116     DDX_Radio(pDX, IDC_ENTRYSTATE, m_radios);
00117     //}}AFX_DATA_MAP
00118 }
00119
00120
00121 BEGIN_MESSAGE_MAP(CImportEntry, CDialog)
00122     //{{AFX_MSG_MAP(CImportEntry)
00123         // NOTE: the ClassWizard will add message map macros here
00124     //}}AFX_MSG_MAP
00125 END_MESSAGE_MAP()
00126
00128 // CImportFilterDlg dialog
00129
00130
00131 CImportFilterDlg::CImportFilterDlg(ReportConflict * entries, ReportWarning * warnings,
00132                                    CWnd* pParent /*=NULL*/)
00133     : CDialog(CImportFilterDlg::IDD, pParent)
00134 {
00135     //{{AFX_DATA_INIT(CImportFilterDlg)
00136     m_entries = entries;
00137     m_warnings = warnings;
00138     //}}AFX_DATA_INIT
00139 }
00140
00141
00142 void CImportFilterDlg::DoDataExchange(CDataExchange* pDX)
00143 {
00144     CDialog::DoDataExchange(pDX);
00145     //{{AFX_DATA_MAP(CImportFilterDlg)
00146     DDX_Control(pDX, IDC_LISTENTRIES, m_list);
00147     DDX_Control(pDX, IDC_EDITENTRY, m_edit);
00148     //}}AFX_DATA_MAP
00149 }
00150
00151
00152 BEGIN_MESSAGE_MAP(CImportFilterDlg, CDialog)
00153     //{{AFX_MSG_MAP(CImportFilterDlg)
00154     ON_BN_CLICKED(IDC_EDITENTRY, OnEditentry)
00155     ON_NOTIFY(NM_DBLCLK, IDC_LISTENTRIES, OnDblclkListentries)
00156     //}}AFX_MSG_MAP
00157 END_MESSAGE_MAP()
00158
00160 // CImportFilterDlg message handlers
00161
00162 void CImportFilterDlg::OnEditentry()
00163 {
00164     // The user wants to edit an entry.
00165     // Start at the top of the list and walk through it until an item
00166     // that is selected is found.
00167     int nItem = m_list.GetNextItem(-1, LVNI_ALL);
00168     while (nItem != -1)
00169     {
00170         UINT nState = m_list.GetItemState(nItem, LVIS_SELECTED);
00171         if ((nState & LVIS_SELECTED) == LVIS_SELECTED)
00172             break;
00173
00174         nItem = m_list.GetNextItem(nItem, LVNI_ALL);
00175     }
00176     if(nItem == -1)
00177         return;
00178
00179     int i = 0;
00180     ReportWarning * warn = m_warnings;
00181     while(warn != 0L)
00182     {
00183         if(i == nItem)
00184         {
00185             CImportWarning dlg(warn);
00186             dlg.DoModal();
00187             return;
00188         }
00189         warn = warn->next;
00190         i++;
00191     }
00192
00193     ReportConflict * conf = m_entries;
00194     while(conf != 0L)
00195     {
00196         if(i == nItem)
00197         {
00198             CImportEntry dlg(conf);
00199             if(dlg.DoModal() == IDOK)
00200             {
00201                 switch(dlg.m_radios)
00202                 {
00203                 case 0:
00204                     conf->DisableUserSettings();
00205                     m_list.SetItem(nItem, 2, LVIF_TEXT, conf->IsBinary() ? "BINARY" : "TEXT", 0, 0, 0, 0);
00206                     break;
00207                 case 1:
00208                     conf->ForceBinary();
00209                     m_list.SetItem(nItem, 2, LVIF_TEXT, "FORCE BINARY", 0, 0, 0, 0);
00210                     break;
00211                 case 2:
00212                     conf->ForceText();
00213                     m_list.SetItem(nItem, 2, LVIF_TEXT, "FORCE TEXT", 0, 0, 0, 0);
00214                     break;
00215                 case 3:
00216                     conf->ForceNoKeywords();
00217                     m_list.SetItem(nItem, 2, LVIF_TEXT, "FORCE NO KEYWORDS", 0, 0, 0, 0);
00218                     break;
00219                 case 4:
00220                     conf->Ignore();
00221                     m_list.SetItem(nItem, 2, LVIF_TEXT, "IGNORE", 0, 0, 0, 0);
00222                     break;
00223                 }
00224             }
00225             return;
00226         }
00227
00228         conf = conf->next;
00229         i++;
00230     }
00231 }
00232
00233 void CImportFilterDlg::OnDblclkListentries(NMHDR* pNMHDR, LRESULT* pResult)
00234 {
00235     OnEditentry();
00236     *pResult = 0;
00237 }
00238
00239 BOOL CImportFilterDlg::OnInitDialog()
00240 {
00241     CDialog::OnInitDialog();
00242
00243     // Need to set up to display the little icons next to each entry
00244     HICON hIcon = AfxGetApp()->LoadIcon(IDI_CVSERROR);
00245     m_ImageList.Create(16, 16, ILC_COLOR, 1, 1);
00246     m_ImageList.SetBkColor(GetSysColor(COLOR_WINDOW));
00247     m_ImageList.Add(hIcon);
00248     hIcon = AfxGetApp()->LoadIcon(IDI_CVSWARNING);
00249     m_ImageList.Add(hIcon);
00250     m_list.SetImageList(&m_ImageList, LVSIL_SMALL);
00251
00252     //full row selection
00253     m_list.SetExtendedStyle( LVS_EX_FULLROWSELECT |
00254         LVS_EX_ONECLICKACTIVATE |
00255         LVS_EX_UNDERLINEHOT );
00256
00257     // Set up columns inside the list view
00258     m_list.InsertColumn(0, "Entry state", LVCFMT_LEFT, 80);
00259     m_list.InsertColumn(1, "Entry description", LVCFMT_LEFT, 270);
00260     m_list.InsertColumn(2, "Entry kind", LVCFMT_LEFT, 140);
00261
00262     int i = 0;
00263     ReportWarning * warn = m_warnings;
00264     while(warn != 0L)
00265     {
00266         const char *desc;
00267         bool isError = true;
00268
00269         switch(warn->Kind())
00270         {
00271         case kFileIsOK:
00272             isError = false; // should not happen
00273             desc = "File is OK";
00274             break;
00275         case kFileMissing:
00276             desc = "File is missing or unreadable";
00277             break;
00278         case kFileIsAlias:
00279             desc = "File is an alias";
00280             break;
00281         case kFileInvalidName:
00282             desc = "File has an invalid name";
00283             break;
00284         case kTextWrongLF:
00285             desc = "File has the wrong line feed for this machine";
00286             break;
00287         case kTextIsBinary:
00288             desc = "File seems to be binary, while expecting text";
00289             break;
00290         case kTextEscapeChar:
00291             desc = "File has some escape characters in it (0x00-0x20, 0x80-0xFF)";
00292             isError = false;
00293             break;
00294         default:
00295             desc = "File has some unknown problem";
00296             break;
00297         }
00298
00299         // Store this information in the list view
00300         m_list.InsertItem(i, "", isError ? 0 : 1);
00301
00302         m_list.SetItem(i, 1, LVIF_TEXT, desc, 0, 0, 0, 0);
00303         m_list.SetItem(i, 0, LVIF_TEXT, isError ? "Error" : "Warning", 0, 0, 0, 0);
00304
00305         warn = warn->next;
00306         i++;
00307     }
00308
00309     ReportConflict * conf = m_entries;
00310     while(conf != 0L)
00311     {
00312         CPStr desc;
00313
00314         desc << "Type ";
00315         desc << (conf->IsExtension() ? "*" : "");
00316         desc << conf->GetPattern();
00317
00318         // Store this information in the list view
00319         m_list.InsertItem(i, "", conf->HasConflict() ? 0 : 1);
00320
00321         if(conf->HasIgnore())
00322             m_list.SetItem(i, 2, LVIF_TEXT, "IGNORE", 0, 0, 0, 0);
00323         else
00324             m_list.SetItem(i, 2, LVIF_TEXT, conf->IsBinary() ? "BINARY" : "TEXT", 0, 0, 0, 0);
00325         m_list.SetItem(i, 1, LVIF_TEXT, desc, 0, 0, 0, 0);
00326         m_list.SetItem(i, 0, LVIF_TEXT, conf->HasConflict() ? "Error" : "OK", 0, 0, 0, 0);
00327
00328         conf = conf->next;
00329         i++;
00330     }
00331
00332     return TRUE;  // return TRUE unless you set the focus to a control
00333                   // EXCEPTION: OCX Property Pages should return FALSE
00334 }
00335 #endif /* WIN32 */
00336
00337 #ifdef qMacCvsPP
00338 static ReportConflict * gEntries;
00339 static ReportWarning * gWarnings;
00340
00341 COutlineTable::COutlineTable(
00342     LStream *inStream )
00343         : LOutlineTable( inStream )
00344 {
00345     // set the table geometry
00346     LTableMultiGeometry *geom = NEW LTableMultiGeometry(this, 50, 20);
00347     ThrowIfNil_(geom);
00348     SetTableGeometry(geom);
00349
00350     // set the table selector
00351     SetTableSelector(NEW LTableSingleSelector( this )/*LOutlineRowSelector*/ );
00352
00353     // and note that we don't set the table storage....
00354
00355     // most of the table classes not only maintain the graphical
00356     // representation of your data but also the data itself. But
00357     // LOutlineTable doesn't really do this...it mostly handles
00358     // graphical representation... you need to handle your data
00359     // maintenance elsewhere by yourself.
00360
00361     // insert a couple columns (name and size)
00362     InsertCols( 3, 0, nil, nil, false );
00363     geom->SetColWidth(80, 1, 1);
00364     geom->SetColWidth(310, 2, 2);
00365     geom->SetColWidth(90, 3, 3);
00366
00367     // Set up keyboard selection and scrolling.
00368     AddAttachment(NEW LOutlineKeySelector(this, msg_AnyMessage));
00369     AddAttachment(NEW LKeyScrollAttachment(this));
00370
00371     // Try to become default commander in the window.
00372     if (mSuperCommander != nil)
00373         mSuperCommander->SetLatentSub(this);
00374
00375     mIconWarning = nil;
00376     mIconError = nil;
00377
00378     OSErr err = ::GetIconSuite( &mIconError, icons_Error, kSelectorAllAvailableData );
00379     ThrowIfOSErr_(err);
00380     ThrowIfResFail_(mIconError);
00381     err = ::GetIconSuite( &mIconWarning, icons_Warning, kSelectorAllAvailableData );
00382     ThrowIfOSErr_(err);
00383     ThrowIfResFail_(mIconWarning);
00384 }
00385
00386 COutlineTable::~COutlineTable()
00387 {
00388     if (mIconWarning != 0L)
00389         ::DisposeIconSuite(mIconWarning, true);
00390     if (mIconError != 0L)
00391         ::DisposeIconSuite(mIconError, true);
00392 }
00393
00394 void COutlineTable::FinishCreateSelf()
00395 {
00396     // insert the root level of the disk into the table
00397     LOutlineItem *theItem = nil;
00398     LOutlineItem *lastItem = nil;
00399
00400     ReportWarning * warn = gWarnings;
00401     while(warn != 0L)
00402     {
00403         // Store this information in the list view
00404         CWarningItem *theItem = NEW CWarningItem(warn, mIconWarning, mIconError);
00405         ThrowIfNil_(theItem);
00406
00407         // and insert it at the end of the table
00408         InsertItem( theItem, nil, lastItem );
00409         lastItem = theItem;
00410
00411         warn = warn->next;
00412     }
00413
00414     ReportConflict * conf = gEntries;
00415     while(conf != 0L)
00416     {
00417         // Store this information in the list view
00418         CEntryItem *theItem = NEW CEntryItem(conf, mIconWarning, mIconError);
00419         ThrowIfNil_(theItem);
00420
00421         // and insert it at the end of the table
00422         InsertItem( theItem, nil, lastItem );
00423         lastItem = theItem;
00424
00425         conf = conf->next;
00426     }
00427 }
00428
00429 CWarningItem::CWarningItem(ReportWarning * entry, Handle war_icon, Handle err_icon)
00430 {
00431     mEntry = entry;
00432     mErrIcon = err_icon;
00433     mWarnIcon = war_icon;
00434 }
00435
00436 CWarningItem::~CWarningItem()
00437 {
00438 }
00439
00440 // this is the routine called to know what to draw within the
00441 // table cell. See the comments in LOutlineItem.cp for more info.
00442 void
00443 CWarningItem::GetDrawContentsSelf(
00444     const STableCell&       inCell,
00445     SOutlineDrawContents&   ioDrawContents)
00446 {
00447     CPStr desc;
00448
00449     switch (inCell.col)
00450     {
00451     case 1:
00452         bool isError = mEntry->Kind() != kFileIsOK && mEntry->Kind() != kTextEscapeChar;
00453         ioDrawContents.outShowSelection = true;
00454         ioDrawContents.outHasIcon = true;
00455         ioDrawContents.outIconSuite = isError ? mErrIcon : mWarnIcon;
00456
00457         if(isError)
00458         {
00459             LString::CopyPStr("\pError", ioDrawContents.outTextString);
00460             ioDrawContents.outTextTraits.style = bold;
00461         }
00462         else
00463         {
00464             LString::CopyPStr("\pWarning", ioDrawContents.outTextString);
00465             ioDrawContents.outTextTraits.style = 0;
00466         }
00467         break;
00468
00469     case 2:
00470         ioDrawContents.outShowSelection = true;
00471         ioDrawContents.outTextTraits.style = 0;
00472
00473         switch(mEntry->Kind())
00474         {
00475         case kFileIsOK:
00476             desc = "File is OK"; // should not happen
00477             break;
00478         case kFileMissing:
00479             desc = "File is missing or unreadable";
00480             break;
00481         case kFileIsAlias:
00482             desc = "File is an alias";
00483             break;
00484         case kFileInvalidName:
00485             desc = "File has an invalid name";
00486             break;
00487         case kTextWrongLF:
00488             desc = "File has the wrong line feed for this machine";
00489             break;
00490         case kTextIsBinary:
00491             desc = "File seems to be binary, while expecting text";
00492             break;
00493         case kTextEscapeChar:
00494             desc = "File has some escape characters in it (0x00-0x20, 0x80-0xFF)";
00495             break;
00496         case kTextWrongSig:
00497             desc = "Text File has a wrong mac signature";
00498             break;
00499         case kBinWrongSig:
00500             desc = "Binary File has a wrong mac signature";
00501             break;
00502         default:
00503             desc = "File has some unknown problem";
00504             break;
00505         }
00506         LString::CopyPStr(desc, ioDrawContents.outTextString);
00507         break;
00508     case 3:
00509         ioDrawContents.outShowSelection = false;
00510         break;
00511     }
00512 }
00513
00514 // just to be cute, we'll draw an adornment (again, see the LOutlineItem.cp
00515 // comments for more information). We'll draw a groovy gray background
00516 void
00517 CWarningItem::DrawRowAdornments(
00518     const Rect&     inLocalRowRect )
00519 {
00520     ShadeRow(UGAColorRamp::GetColor(0), inLocalRowRect);
00521 }
00522
00523 void CWarningItem::EditImportCell(void)
00524 {
00525     StDialogHandler theHandler(dlg_ImpFilterWarn, LCommander::GetTopCommander());
00526     LWindow *theDialog = theHandler.GetDialog();
00527     ThrowIfNil_(theDialog);
00528
00529     LTextEditView *warn = dynamic_cast<LTextEditView*>
00530         (theDialog->FindPaneByID(item_ImpEditWarn));
00531     CStr print;
00532     mEntry->PrintOut(print);
00533     warn->SetTextPtr((Ptr)(const char *)print, print.length());
00534
00535     theDialog->Show();
00536     MessageT hitMessage;
00537     while (true)
00538     {       // Let DialogHandler process events
00539         hitMessage = theHandler.DoDialog();
00540
00541         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00542             break;
00543     }
00544     theDialog->Hide();
00545 }
00546
00547 void
00548 CWarningItem::DoubleClick(
00549     const STableCell&           /* inCell */,
00550     const SMouseDownEvent&      /* inMouseDown */,
00551     const SOutlineDrawContents& /* inDrawContents */,
00552     Boolean                     /* inHitText */)
00553 {
00554     EditImportCell();
00555 }
00556
00557 CEntryItem::CEntryItem( ReportConflict * entry, Handle war_icon, Handle err_icon)
00558 {
00559     mEntry = entry;
00560     mErrIcon = err_icon;
00561     mWarnIcon = war_icon;
00562 }
00563
00564 CEntryItem::~CEntryItem()
00565 {
00566 }
00567
00568 // this is the routine called to know what to draw within the
00569 // table cell. See the comments in LOutlineItem.cp for more info.
00570 void
00571 CEntryItem::GetDrawContentsSelf(
00572     const STableCell&       inCell,
00573     SOutlineDrawContents&   ioDrawContents)
00574 {
00575     CPStr str;
00576
00577     switch (inCell.col)
00578     {
00579     case 1:
00580         ioDrawContents.outShowSelection = true;
00581         ioDrawContents.outHasIcon = true;
00582         ioDrawContents.outIconSuite = mEntry->HasConflict() ? mErrIcon : mWarnIcon;
00583
00584         if(mEntry->HasConflict())
00585         {
00586             str << "Conflict";
00587             ioDrawContents.outTextTraits.style = bold;
00588         }
00589         else if(mEntry->HasTypeCreatorConflict())
00590         {
00591             str << "Warning";
00592             ioDrawContents.outTextTraits.style = 0;
00593         }
00594         else
00595         {
00596             str << "OK";
00597             ioDrawContents.outTextTraits.style = 0;
00598         }
00599         LString::CopyPStr(str, ioDrawContents.outTextString);
00600         break;
00601
00602     case 2:
00603         ioDrawContents.outShowSelection = true;
00604         ioDrawContents.outHasIcon = false/*true*/;
00605         ioDrawContents.outIconSuite = 0L/*mIconH*/;
00606         ioDrawContents.outTextTraits.style = 0;
00607
00608         str << "Type ";
00609         str << (mEntry->IsExtension() ? "*" : "");
00610         str << mEntry->GetPattern();
00611         LString::CopyPStr(str, ioDrawContents.outTextString);
00612         break;
00613
00614     case 3:
00615         ioDrawContents.outShowSelection = true;
00616         ioDrawContents.outHasIcon = false;
00617         ioDrawContents.outTextTraits.style = 0;
00618
00619         if(mEntry->HasForceBinary())
00620         {
00621             LString::CopyPStr("\pFORCE BINARY", ioDrawContents.outTextString);
00622             ioDrawContents.outTextTraits.style = bold;
00623         }
00624         else if(mEntry->HasForceText())
00625         {
00626             LString::CopyPStr("\pFORCE TEXT", ioDrawContents.outTextString);
00627             ioDrawContents.outTextTraits.style = bold;
00628         }
00629         else if(mEntry->HasIgnore())
00630         {
00631             LString::CopyPStr("\pIGNORE", ioDrawContents.outTextString);
00632             ioDrawContents.outTextTraits.style = bold;
00633         }
00634         else if(mEntry->IsBinary())
00635         {
00636             LString::CopyPStr("\pBINARY", ioDrawContents.outTextString);
00637             ioDrawContents.outTextTraits.style = 0;
00638         }
00639         else
00640         {
00641             LString::CopyPStr("\pTEXT", ioDrawContents.outTextString);
00642             ioDrawContents.outTextTraits.style = 0;
00643         }
00644         break;
00645     }
00646 }
00647
00648 // just to be cute, we'll draw an adornment (again, see the LOutlineItem.cp
00649 // comments for more information). We'll draw a groovy gray background
00650 void
00651 CEntryItem::DrawRowAdornments(
00652     const Rect&     inLocalRowRect )
00653 {
00654     ShadeRow(UGAColorRamp::GetColor(0), inLocalRowRect);
00655 }
00656
00657 static void DoDataExchange_ImpEditEntry(LWindow *theDialog, ReportConflict * mEntry, bool putValue)
00658 {
00659     LTextEditView *warn = dynamic_cast<LTextEditView*>
00660         (theDialog->FindPaneByID(item_ImpEditWarn));
00661
00662     if(putValue)
00663     {
00664         if(mEntry->HasForceBinary())
00665             theDialog->SetValueForPaneID (item_ImpEntryFBin, Button_On);
00666         else if(mEntry->HasForceText())
00667             theDialog->SetValueForPaneID (item_ImpEntryFText, Button_On);
00668         else if(mEntry->HasIgnore())
00669             theDialog->SetValueForPaneID (item_ImpEntryFIgn, Button_On);
00670         else
00671             theDialog->SetValueForPaneID (item_ImpEntryUnch, Button_On);
00672         CStr print;
00673         mEntry->PrintOut(print);
00674         warn->SetTextPtr((Ptr)(const char *)print, print.length());
00675     }
00676     else
00677     {
00678         if(theDialog->GetValueForPaneID (item_ImpEntryFBin) == Button_On)
00679             mEntry->ForceBinary();
00680         else if(theDialog->GetValueForPaneID (item_ImpEntryFText) == Button_On)
00681             mEntry->ForceText();
00682         else if(theDialog->GetValueForPaneID (item_ImpEntryFIgn) == Button_On)
00683             mEntry->Ignore();
00684         else
00685             mEntry->DisableUserSettings();
00686     }
00687 }
00688
00689 void CEntryItem::EditImportCell(void)
00690 {
00691     StDialogHandler theHandler(dlg_ImpFilterEntry, LCommander::GetTopCommander());
00692     LWindow *theDialog = theHandler.GetDialog();
00693     ThrowIfNil_(theDialog);
00694
00695     DoDataExchange_ImpEditEntry(theDialog, mEntry, true);
00696
00697     theDialog->Show();
00698     MessageT hitMessage;
00699     while (true)
00700     {       // Let DialogHandler process events
00701         hitMessage = theHandler.DoDialog();
00702
00703         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00704             break;
00705     }
00706     theDialog->Hide();
00707
00708     if(hitMessage == msg_OK)
00709     {
00710         DoDataExchange_ImpEditEntry(theDialog, mEntry, false);
00711         mOutlineTable->Refresh();
00712     }
00713 }
00714
00715 void
00716 CEntryItem::DoubleClick(
00717     const STableCell&           /* inCell */,
00718     const SMouseDownEvent&      /* inMouseDown */,
00719     const SOutlineDrawContents& /* inDrawContents */,
00720     Boolean                     /* inHitText */)
00721 {
00722     EditImportCell();
00723 }
00724 #endif /* qMacCvsPP */
00725
00726 #if qUnix
00727 class UCvsImpWarning : public UWidget
00728 {
00729     UDECLARE_DYNAMIC(UCvsImpWarning)
00730 public:
00731     UCvsImpWarning(ReportWarning * warn);
00732     virtual ~UCvsImpWarning() {}
00733
00734     enum
00735     {
00736         kOK = EV_COMMAND_START, // 0
00737         kDesc                   // 1
00738     };
00739
00740     virtual void DoDataExchange(bool fill);
00741
00742 protected:
00743     UStr m_desc;
00744
00745     ev_msg int OnOK(void);
00746
00747     UDECLARE_MESSAGE_MAP()
00748 };
00749
00750 UIMPLEMENT_DYNAMIC(UCvsImpWarning, UWidget)
00751
00752 UBEGIN_MESSAGE_MAP(UCvsImpWarning, UWidget)
00753     ON_UCOMMAND(UCvsImpWarning::kOK, UCvsImpWarning::OnOK)
00754 UEND_MESSAGE_MAP()
00755
00756 UCvsImpWarning::UCvsImpWarning(ReportWarning * warn) : UWidget(::UEventGetWidID())
00757 {
00758     warn->PrintOut(m_desc);
00759 }
00760
00761 int UCvsImpWarning::OnOK(void)
00762 {
00763     EndModal(true);
00764     return 0;
00765 }
00766
00767 void UCvsImpWarning::DoDataExchange(bool fill)
00768 {
00769     if(fill)
00770     {
00771         UEventSendMessage(GetWidID(), EV_SETTEXT, kDesc, (void *)(const char *)m_desc);
00772     }
00773     else
00774     {
00775     }
00776 }
00777
00778 class UCvsImpEntry : public UWidget
00779 {
00780     UDECLARE_DYNAMIC(UCvsImpEntry)
00781 public:
00782     UCvsImpEntry(ReportConflict * entry);
00783     virtual ~UCvsImpEntry() {}
00784
00785     enum
00786     {
00787         kOK = EV_COMMAND_START, // 0
00788         kCancel,                // 1
00789         kRadUnchanged,          // 2
00790         kRadBinary,             // 3
00791         kRadText,               // 4
00792         kRadIgnore,             // 5
00793         kDesc                   // 6
00794     };
00795
00796     virtual void DoDataExchange(bool fill);
00797
00798     int m_radios;
00799 protected:
00800     UStr m_desc;
00801
00802     ev_msg int OnOK(void);
00803     ev_msg int OnCancel(void);
00804     ev_msg int OnRadios(int cmd);
00805
00806     UDECLARE_MESSAGE_MAP()
00807 };
00808
00809 UIMPLEMENT_DYNAMIC(UCvsImpEntry, UWidget)
00810
00811 UBEGIN_MESSAGE_MAP(UCvsImpEntry, UWidget)
00812     ON_UCOMMAND(UCvsImpEntry::kOK, UCvsImpEntry::OnOK)
00813     ON_UCOMMAND(UCvsImpEntry::kCancel, UCvsImpEntry::OnCancel)
00814     ON_UCOMMAND_RANGE(UCvsImpEntry::kRadUnchanged, UCvsImpEntry::kRadIgnore, UCvsImpEntry::OnRadios)
00815 UEND_MESSAGE_MAP()
00816
00817 UCvsImpEntry::UCvsImpEntry(ReportConflict * entry) : UWidget(::UEventGetWidID())
00818 {
00819     entry->PrintOut(m_desc);
00820
00821     if(entry->HasForceBinary())
00822         m_radios = 1;
00823     else if(entry->HasForceText())
00824         m_radios = 2;
00825     else if(entry->HasIgnore())
00826         m_radios = 3;
00827     else
00828         m_radios = 0;
00829 }
00830
00831 int UCvsImpEntry::OnOK(void)
00832 {
00833     EndModal(true);
00834     return 0;
00835 }
00836
00837 int UCvsImpEntry::OnCancel(void)
00838 {
00839     EndModal(false);
00840     return 0;
00841 }
00842
00843 int UCvsImpEntry::OnRadios(int cmd)
00844 {
00845     m_radios = cmd - kRadUnchanged;
00846     return 0;
00847 }
00848
00849 void UCvsImpEntry::DoDataExchange(bool fill)
00850 {
00851     if(fill)
00852     {
00853         UEventSendMessage(GetWidID(), EV_SETTEXT, kDesc, (void *)(const char *)m_desc);
00854         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kRadUnchanged + m_radios, 1), 0L);
00855     }
00856     else
00857     {
00858     }
00859 }
00860
00861 #define NUM_COLUMNS 3
00862
00863 static char *_gszColumnLabel[NUM_COLUMNS] =
00864 {
00865     "Entry state", "Entry description", "Entry kind"
00866 };
00867
00868 static int _gnColumnWidth[NUM_COLUMNS] =
00869 {
00870     80, 270, 80
00871 };
00872
00873 #if qGTK
00874 static void *sWarningIcon;
00875 static void *sErrorIcon;
00876 #endif
00877
00878 class UCvsImpFilter : public UWidget
00879 {
00880     UDECLARE_DYNAMIC(UCvsImpFilter)
00881 public:
00882     UCvsImpFilter(ReportConflict * entries, ReportWarning * warnings);
00883     virtual ~UCvsImpFilter() {}
00884
00885     enum
00886     {
00887         kOK = EV_COMMAND_START, // 0
00888         kCancel,                // 1
00889         kList,                  // 2
00890         kEdit                   // 3
00891     };
00892
00893     virtual void DoDataExchange(bool fill);
00894
00895 protected:
00896     ReportConflict *m_entries;
00897     ReportWarning *m_warnings;
00898
00899     ev_msg int OnOK(void);
00900     ev_msg int OnCancel(void);
00901     ev_msg int OnEdit(void);
00902     ev_msg void OnDblClick(void);
00903
00904     UDECLARE_MESSAGE_MAP()
00905 };
00906
00907 UIMPLEMENT_DYNAMIC(UCvsImpFilter, UWidget)
00908
00909 UBEGIN_MESSAGE_MAP(UCvsImpFilter, UWidget)
00910     ON_UCOMMAND(UCvsImpFilter::kOK, UCvsImpFilter::OnOK)
00911     ON_UCOMMAND(UCvsImpFilter::kCancel, UCvsImpFilter::OnCancel)
00912     ON_UCOMMAND(UCvsImpFilter::kEdit, UCvsImpFilter::OnEdit)
00913     ON_LIST_DBLCLICK(UCvsImpFilter::kList, UCvsImpFilter::OnDblClick)
00914 UEND_MESSAGE_MAP()
00915
00916 UCvsImpFilter::UCvsImpFilter(ReportConflict * entries, ReportWarning * warnings) :
00917     UWidget(::UEventGetWidID())
00918 {
00919     m_entries = entries;
00920     m_warnings = warnings;
00921 }
00922
00923 int UCvsImpFilter::OnOK(void)
00924 {
00925     EndModal(true);
00926     return 0;
00927 }
00928
00929 int UCvsImpFilter::OnCancel(void)
00930 {
00931     EndModal(false);
00932     return 0;
00933 }
00934
00935 void UCvsImpFilter::OnDblClick(void)
00936 {
00937     OnEdit();
00938 }
00939
00940 void UCvsImpFilter::DoDataExchange(bool fill)
00941 {
00942     if(sWarningIcon == 0L)
00943     {
00944         sWarningIcon = UCreate_pixmap(this, "warning.xpm");
00945         sErrorIcon = UCreate_pixmap(this, "error.xpm");
00946     }
00947
00948     if(fill)
00949     {
00950         UEventSendMessage(GetWidID(), EV_LIST_SETFEEDBACK, UMAKEINT(kList, 0), 0L);
00951         UEventSendMessage(GetWidID(), EV_LIST_ADDCOLUMNS, UMAKEINT(kList, NUM_COLUMNS), 0L);
00952         for(int i = 0; i < NUM_COLUMNS; i++)
00953         {
00954             UEventSendMessage(GetWidID(), EV_LIST_SETCOLTITLE, UMAKEINT(kList, i),
00955                               _gszColumnLabel[i]);
00956             UEventSendMessage(GetWidID(), EV_LIST_SETCOLWIDTH, UMAKEINT(kList, i),
00957                               (void *)_gnColumnWidth[i]);
00958         }
00959         UEventSendMessage(GetWidID(), EV_LIST_SETFEEDBACK, UMAKEINT(kList, 1), 0L);
00960
00961         UEventSendMessage(GetWidID(), EV_LIST_RESETALL, kList, 0L);
00962
00963         ReportWarning * warn = m_warnings;
00964         while(warn != 0L)
00965         {
00966             const char *desc;
00967             bool isError = true;
00968
00969             switch(warn->Kind())
00970             {
00971             case kFileIsOK:
00972                 isError = false; // should not happen
00973                 desc = "File is OK";
00974                 break;
00975             case kFileMissing:
00976                 desc = "File is missing or unreadable";
00977                 break;
00978             case kFileIsAlias:
00979                 desc = "File is an alias";
00980                 break;
00981             case kFileInvalidName:
00982                 desc = "File has an invalid name";
00983                 break;
00984             case kTextWrongLF:
00985                 desc = "File has the wrong line feed for this machine";
00986                 break;
00987             case kTextIsBinary:
00988                 desc = "File seems to be binary, while expecting text";
00989                 break;
00990             case kTextEscapeChar:
00991                 desc = "File has some escape characters in it (0x00-0x20, 0x80-0xFF)";
00992                 isError = false;
00993                 break;
00994             default:
00995                 desc = "File has some unknown problem";
00996                 break;
00997             }
00998
00999             int rownum;
01000             UEventSendMessage(GetWidID(), EV_LIST_NEWROW, kList, &rownum);
01001             UEventSendMessage(GetWidID(), EV_LIST_ROWSETDATA, UMAKEINT(kList, rownum), warn);
01002             ULIST_INSERT entry;
01003             entry.row = rownum;
01004
01005             entry.col = 0;
01006             entry.title = isError ? "Error" : "Warning";
01007             entry.icon = 0L;
01008 #if qGTK
01009             entry.icon = isError ? sErrorIcon : sWarningIcon;
01010 #endif
01011             UEventSendMessage(GetWidID(), EV_LIST_INSERT, kList, &entry);
01012
01013             entry.col = 1;
01014             entry.title = desc;
01015             entry.icon = 0L;
01016             UEventSendMessage(GetWidID(), EV_LIST_INSERT, kList, &entry);
01017
01018             warn = warn->next;
01019         }
01020
01021         ReportConflict * conf = m_entries;
01022         while(conf != 0L)
01023         {
01024             UStr desc;
01025
01026             desc << "Type ";
01027             desc << (conf->IsExtension() ? "*" : "");
01028             desc << conf->GetPattern();
01029
01030             int rownum;
01031             UEventSendMessage(GetWidID(), EV_LIST_NEWROW, kList, &rownum);
01032             UEventSendMessage(GetWidID(), EV_LIST_ROWSETDATA, UMAKEINT(kList, rownum), conf);
01033             ULIST_INSERT entry;
01034             entry.row = rownum;
01035
01036             entry.col = 0;
01037             entry.title = conf->HasConflict() ? "Error" : "OK";
01038             entry.icon = 0L;
01039 #if qGTK
01040             entry.icon = conf->HasConflict() ? sErrorIcon : sWarningIcon;
01041 #endif
01042             UEventSendMessage(GetWidID(), EV_LIST_INSERT, kList, &entry);
01043
01044             entry.col = 1;
01045             entry.title = desc;
01046             entry.icon = 0L;
01047             UEventSendMessage(GetWidID(), EV_LIST_INSERT, kList, &entry);
01048
01049             entry.col = 2;
01050             entry.title = conf->HasIgnore() ? "IGNORE" : (conf->IsBinary() ? "BINARY" : "TEXT");
01051             entry.icon = 0L;
01052             UEventSendMessage(GetWidID(), EV_LIST_INSERT, kList, &entry);
01053
01054             conf = conf->next;
01055         }
01056     }
01057     else
01058     {
01059     }
01060 }
01061
01062 int UCvsImpFilter::OnEdit()
01063 {
01064     int row = -1;
01065     if((row = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL,
01066                                 UMAKEINT(kList, row), 0L)) == -1)
01067         return 0;
01068
01069     ULIST_INFO info;
01070     info.col = 0;
01071     info.row = row;
01072     UEventSendMessage(GetWidID(), EV_LIST_GETINFO, kList, &info);
01073
01074     ReportWarning * warn = m_warnings;
01075     while(warn != 0L)
01076     {
01077         if(warn == info.data)
01078         {
01079             void *wid = UCreate_ImpWarningDlg();
01080             UCvsImpWarning *dlg = new UCvsImpWarning(warn);
01081             UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01082             dlg->DoModal();
01083             delete dlg;
01084             return 0;
01085         }
01086         warn = warn->next;
01087     }
01088
01089     ReportConflict * conf = m_entries;
01090     while(conf != 0L)
01091     {
01092         if(conf == info.data)
01093         {
01094             void *wid = UCreate_ImpEntryDlg();
01095             UCvsImpEntry *dlg = new UCvsImpEntry(conf);
01096             UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01097             if(dlg->DoModal())
01098             {
01099                 ULIST_INSERT entry;
01100                 entry.row = row;
01101
01102                 entry.col = 2;
01103                 entry.title = 0L;
01104                 entry.icon = /*UCvsFiles::GetImageForEntry(data)*/0L;
01105                 switch(dlg->m_radios)
01106                 {
01107                 case 0:
01108                     conf->DisableUserSettings();
01109                     entry.title = conf->IsBinary() ? "BINARY" : "TEXT";
01110                     break;
01111                 case 1:
01112                     conf->ForceBinary();
01113                     entry.title = "FORCE BINARY";
01114                     break;
01115                 case 2:
01116                     conf->ForceText();
01117                     entry.title = "FORCE TEXT";
01118                     break;
01119                 case 3:
01120                     conf->Ignore();
01121                     entry.title = "IGNORE";
01122                     break;
01123                 }
01124                 if(entry.title != 0L)
01125                     UEventSendMessage(GetWidID(), EV_LIST_INSERT, kList, &entry);
01126             }
01127             delete dlg;
01128             return 0;
01129         }
01130
01131         conf = conf->next;
01132     }
01133     return 0;
01134 }
01135 #endif /* qUnix */
01136
01137 bool CompatImportFilter(const char *path, ReportConflict *& entries,
01138                         ReportWarning *& warnings)
01139 {
01140     bool result = false;
01141     entries = 0L;
01142     warnings = 0L;
01143
01144     list_all_types_recur(path, warnings, entries);
01145     if(entries == 0L && warnings == 0L)
01146         return false;
01147
01148 #ifdef WIN32
01149     CImportFilterDlg pages(entries, warnings);
01150     if(pages.DoModal() == IDOK)
01151     {
01152         result = true;
01153     }
01154 #endif /* WIN32 */
01155 #ifdef qMacCvsPP
01156     gWarnings = warnings;
01157     gEntries = entries;
01158
01159     StDialogHandler theHandler(dlg_ImpFilter, LCommander::GetTopCommander());
01160     LWindow *theDialog = theHandler.GetDialog();
01161     ThrowIfNil_(theDialog);
01162
01163     theDialog->Show();
01164     MessageT hitMessage;
01165     while (true)
01166     {       // Let DialogHandler process events
01167         hitMessage = theHandler.DoDialog();
01168
01169         if(hitMessage == item_ImpPushEdit)
01170         {
01171             // simulate dbl click
01172             LOutlineTable *tab = dynamic_cast<LOutlineTable*>
01173                 (theDialog->FindPaneByID(item_ImpFilterList));
01174
01175             STableCell  cell = tab->GetFirstSelectedCell();
01176             if(!cell.IsNullCell())
01177             {
01178                 //TableIndexT index;
01179                 //tab->CellToIndex(cell, index);
01180                 CImportItem *item = dynamic_cast<CImportItem*>(tab->FindItemForRow(cell.row));
01181                 Assert_(item != 0L);
01182                 if(item != 0L)
01183                     item->EditImportCell();
01184             }
01185         }
01186
01187         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01188             break;
01189     }
01190     theDialog->Hide();
01191
01192     if(hitMessage == msg_OK)
01193     {
01194         result = true;
01195     }
01196 #endif /* qMacCvsPP */
01197 #if qUnix
01198     void *wid = UCreate_ImportFilterDlg();
01199
01200     UCvsImpFilter *dlg = new UCvsImpFilter(entries, warnings);
01201     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01202
01203     if(dlg->DoModal())
01204     {
01205         result = true;
01206     }
01207
01208     delete dlg;
01209 #endif // qUnix
01210
01211     if(!result)
01212     {
01213         free_list_types(warnings, entries);
01214         entries = 0L;
01215         warnings = 0L;
01216     }
01217
01218     return result;
01219 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/ImportFilterDlg.h Source File

common/ImportFilterDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * ImportFilterDlg.h - edit filtered import
00023  */
00024
00025 #if !defined(AFX_IMPORTFILDERDLG_H__CFB7AA41_BDDB_11D1_B965_0020AF51D9DA__INCLUDED_)
00026 #define AFX_IMPORTFILDERDLG_H__CFB7AA41_BDDB_11D1_B965_0020AF51D9DA__INCLUDED_
00027
00028 #include "ImportFilter.h"
00029
00030 bool CompatImportFilter(const char *path, ReportConflict *& entries,
00031                         ReportWarning *& warnings);
00032     // - return false if the user canceled.
00033     // - if the user hits OK, all the conflicts should be resolved
00034     // by the dialog session.
00035
00036 #if _MSC_VER >= 1000
00037 #pragma once
00038 #endif // _MSC_VER >= 1000
00039
00040 #ifdef WIN32
00041
00042 // CImportFilterDlg dialog
00043
00044 class CImportFilterDlg : public CDialog
00045 {
00046 // Construction
00047 public:
00048     CImportFilterDlg(ReportConflict * entries, ReportWarning * warnings,
00049         CWnd* pParent = NULL);   // standard constructor
00050
00051 // Dialog Data
00052     //{{AFX_DATA(CImportFilterDlg)
00053     enum { IDD = IDD_IMPORTFILTER };
00054     CListCtrl   m_list;
00055     CButton m_edit;
00056     //}}AFX_DATA
00057
00058
00059 // Overrides
00060     // ClassWizard generated virtual function overrides
00061     //{{AFX_VIRTUAL(CImportFilterDlg)
00062     protected:
00063     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00064     //}}AFX_VIRTUAL
00065
00066 // Implementation
00067 protected:
00068     CImageList m_ImageList;
00069     ReportConflict * m_entries;
00070     ReportWarning * m_warnings;
00071
00072     // Generated message map functions
00073     //{{AFX_MSG(CImportFilterDlg)
00074     afx_msg void OnEditentry();
00075     virtual BOOL OnInitDialog();
00076     afx_msg void OnDblclkListentries(NMHDR* pNMHDR, LRESULT* pResult);
00077     //}}AFX_MSG
00078     DECLARE_MESSAGE_MAP()
00079 };
00080
00081 class CImportWarning : public CDialog
00082 {
00083 // Construction
00084 public:
00085     CImportWarning(ReportWarning * warn, CWnd* pParent = NULL);   // standard constructor
00086
00087 // Dialog Data
00088     //{{AFX_DATA(CImportWarning)
00089     enum { IDD = IDD_WARNINGDESC };
00090     CString m_desc;
00091     //}}AFX_DATA
00092
00093
00094 // Overrides
00095     // ClassWizard generated virtual function overrides
00096     //{{AFX_VIRTUAL(CImportWarning)
00097     protected:
00098     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00099     //}}AFX_VIRTUAL
00100
00101 // Implementation
00102 protected:
00103
00104     // Generated message map functions
00105     //{{AFX_MSG(CImportWarning)
00106         // NOTE: the ClassWizard will add member functions here
00107     //}}AFX_MSG
00108     DECLARE_MESSAGE_MAP()
00109 };
00110
00111 class CImportEntry : public CDialog
00112 {
00113 // Construction
00114 public:
00115     CImportEntry(ReportConflict * entry, CWnd* pParent = NULL);   // standard constructor
00116
00117 // Dialog Data
00118     //{{AFX_DATA(CImportEntry)
00119     enum { IDD = IDD_ENTRYDESC };
00120     CString m_desc;
00121     int m_radios;
00122     //}}AFX_DATA
00123
00124
00125 // Overrides
00126     // ClassWizard generated virtual function overrides
00127     //{{AFX_VIRTUAL(CImportEntry)
00128     protected:
00129     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00130     //}}AFX_VIRTUAL
00131
00132 // Implementation
00133 protected:
00134
00135     // Generated message map functions
00136     //{{AFX_MSG(CImportEntry)
00137         // NOTE: the ClassWizard will add member functions here
00138     //}}AFX_MSG
00139     DECLARE_MESSAGE_MAP()
00140 };
00141
00142 //{{AFX_INSERT_LOCATION}}
00143 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00144
00145 #endif /* WIN32 */
00146
00147 #ifdef qMacCvsPP
00148 #include <LOutlineTable.h>
00149 #include <LCommander.h>
00150 #include <LOutlineItem.h>
00151 #include <LString.h>
00152
00153 class COutlineTable : public LOutlineTable, public LCommander
00154 {
00155 public:
00156     enum { class_ID = 'Cout' };
00157
00158     COutlineTable( LStream *inStream );
00159     virtual ~COutlineTable();
00160 protected:
00161     virtual void FinishCreateSelf();
00162
00163     Handle mIconWarning;
00164     Handle mIconError;
00165 private:
00166     // defensive programming
00167     COutlineTable();
00168     COutlineTable( const COutlineTable &inOriginal );
00169     COutlineTable&      operator=( const COutlineTable &inOriginal );
00170 };
00171
00172 class CImportItem : public LOutlineItem
00173 {
00174 public:
00175     virtual void EditImportCell(void) = 0;
00176 };
00177
00178 class CEntryItem : public CImportItem
00179 {
00180 public:
00181     CEntryItem(ReportConflict * entry, Handle war_icon, Handle err_icon);
00182     virtual ~CEntryItem();
00183
00184     virtual void EditImportCell(void);
00185 protected:
00186
00187     virtual void GetDrawContentsSelf(const STableCell& inCell, SOutlineDrawContents& ioDrawContents);
00188
00189     virtual void DrawRowAdornments(const Rect& inLocalRowRect);
00190
00191     virtual void DoubleClick(const STableCell& inCell, const SMouseDownEvent& inMouseDown,
00192         const SOutlineDrawContents& inDrawContents, Boolean inHitText);
00193
00194     ReportConflict * mEntry;
00195     Handle mErrIcon;
00196     Handle mWarnIcon;
00197 private:
00198     // defensive programming
00199     CEntryItem();
00200     CEntryItem( const CEntryItem &inOriginal );
00201     CEntryItem& operator=( const CEntryItem &inOriginal );
00202 };
00203
00204 class CWarningItem : public CImportItem
00205 {
00206 public:
00207     CWarningItem(ReportWarning * warn, Handle war_icon, Handle err_icon);
00208     virtual ~CWarningItem();
00209
00210     virtual void EditImportCell(void);
00211 protected:
00212
00213     virtual void GetDrawContentsSelf(const STableCell& inCell, SOutlineDrawContents& ioDrawContents);
00214
00215     virtual void DrawRowAdornments(const Rect& inLocalRowRect);
00216
00217     virtual void DoubleClick(const STableCell& inCell, const SMouseDownEvent& inMouseDown,
00218         const SOutlineDrawContents& inDrawContents, Boolean inHitText);
00219
00220     ReportWarning * mEntry;
00221     Handle mErrIcon;
00222     Handle mWarnIcon;
00223 private:
00224     // defensive programming
00225     CWarningItem();
00226     CWarningItem( const CWarningItem &inOriginal );
00227     CWarningItem&   operator=( const CWarningItem &inOriginal );
00228 };
00229 #endif /* qMacCvsPP */
00230
00231 #endif // !defined(AFX_IMPORTFILDERDLG_H__CFB7AA41_BDDB_11D1_B965_0020AF51D9DA__INCLUDED_)
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/InitDlg.cpp Source File

common/InitDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- June 1999
00019  */
00020
00021 /*
00022  * InitDlg.cpp : the cvs init dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #endif /* WIN32 */
00030
00031 #include "InitDlg.h"
00032 #include "CvsPrefs.h"
00033
00034 #ifdef WIN32
00035 #   include "GetPrefs.h"
00036 #   include "PromptFiles.h"
00037 #   ifdef _DEBUG
00038 #   define new DEBUG_NEW
00039 #   undef THIS_FILE
00040     static char THIS_FILE[] = __FILE__;
00041 #   endif
00042
00044 // CInit_MAIN dialog
00045
00046
00047 CInit_MAIN::CInit_MAIN()
00048     : CPropertyPage(CInit_MAIN::IDD)
00049 {
00050     //{{AFX_DATA_INIT(CInit_MAIN)
00051     m_forceroot = FALSE;
00052     m_helpinit = _T("");
00053     //}}AFX_DATA_INIT
00054 }
00055
00056 CInit_MAIN::CInit_MAIN(bool forceRoot)
00057     : CPropertyPage(CInit_MAIN::IDD)
00058 {
00059     m_forceroot = forceRoot;
00060     m_helpinit = _T("If the CVSROOT (see next tab) is set to ""local"", "
00061         "the CVSROOT should be a Windows path (i.e. c:\\cvsroot). "
00062         "If the CVSROOT points on a remote machine, the path should be a Unix path "
00063         "(i.e. /fscvs/cvsroot : make sure you got the relevant security rights in "
00064         "order to create such a directory on the remote machine.");
00065 }
00066
00067 void CInit_MAIN::DoDataExchange(CDataExchange* pDX)
00068 {
00069     CPropertyPage::DoDataExchange(pDX);
00070     //{{AFX_DATA_MAP(CInit_MAIN)
00071     DDX_Check(pDX, IDC_FORCEROOT, m_forceroot);
00072     DDX_Text(pDX, IDC_HELPINIT, m_helpinit);
00073     //}}AFX_DATA_MAP
00074 }
00075
00076 BEGIN_MESSAGE_MAP(CInit_MAIN, CPropertyPage)
00077     //{{AFX_MSG_MAP(CInit_MAIN)
00078     //}}AFX_MSG_MAP
00079 END_MESSAGE_MAP()
00080
00081 IMPLEMENT_DYNCREATE(CInit_MAIN, CPropertyPage)
00082
00084 // CInit_MAIN message handlers
00085 #endif
00086
00087 bool CompatGetInit(bool & forceCvsroot)
00088 {
00089     bool userHitOK = false;
00090
00091     forceCvsroot = true;
00092
00093 #ifdef WIN32
00094     CPropertySheet pages("Init settings");
00095     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00096     CInit_MAIN page1(forceCvsroot);
00097     CGetPrefs_CVSROOT page2;
00098     CGetPrefs_GLOBALS page3;
00099     pages.AddPage(&page1);
00100     pages.AddPage(&page2);
00101     pages.AddPage(&page3);
00102     if(pages.DoModal() == IDOK)
00103     {
00104         forceCvsroot = page1.m_forceroot == TRUE;
00105
00106         page2.StoreValues();
00107         page3.StoreValues();
00108         userHitOK = true;
00109     }
00110 #endif /* WIN32 */
00111
00112     if(userHitOK)
00113     {
00114         gCvsPrefs.save();
00115     }
00116     return userHitOK;
00117 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/InitDlg.h Source File

common/InitDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- June 1999
00019  */
00020
00021 /*
00022  * InitDlg.cpp : the cvs init dialog
00023  */
00024
00025 #if !defined(AFX_INITDLG_H__155D02C3_2323_11D3_B1A6_004095463819__INCLUDED_)
00026 #define AFX_INITDLG_H__155D02C3_2323_11D3_B1A6_004095463819__INCLUDED_
00027
00028 #if _MSC_VER > 1000
00029 #pragma once
00030 #endif // _MSC_VER > 1000
00031
00032 #include "CPStr.h"
00033
00034 bool CompatGetInit(bool & forceCvsroot);
00035     // get the init path and misc options...
00036
00037 #ifdef WIN32
00038
00039 // CInit_MAIN dialog
00040
00041 class CInit_MAIN : public CPropertyPage
00042 {
00043     DECLARE_DYNCREATE(CInit_MAIN)
00044
00045 // Construction
00046 public:
00047     CInit_MAIN();   // standard constructor
00048     CInit_MAIN(bool forceRoot);
00049
00050 // Dialog Data
00051     //{{AFX_DATA(CInit_MAIN)
00052     enum { IDD = IDD_INIT_MAIN };
00053     BOOL    m_forceroot;
00054     CString m_helpinit;
00055     //}}AFX_DATA
00056
00057
00058 // Overrides
00059     // ClassWizard generated virtual function overrides
00060     //{{AFX_VIRTUAL(CInit_MAIN)
00061     protected:
00062     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00063     //}}AFX_VIRTUAL
00064
00065 // Implementation
00066 protected:
00067
00068     // Generated message map functions
00069     //{{AFX_MSG(CInit_MAIN)
00070     //}}AFX_MSG
00071     DECLARE_MESSAGE_MAP()
00072 };
00073
00074 //{{AFX_INSERT_LOCATION}}
00075 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00076 #endif
00077
00078 #endif // !defined(AFX_INITDLG_H__155D02C3_2323_11D3_B1A6_004095463819__INCLUDED_)
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/LineCmd.cpp Source File

common/LineCmd.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // LineCmd.cpp : implementation file
00022 //
00023
00024 #include "stdafx.h"
00025
00026 #ifdef WIN32
00027 #   include "wincvs.h"
00028 #endif /* WIN32 */
00029
00030 #ifdef qMacCvsPP
00031 #   include <UModalDialogs.h>
00032 #   include <LCheckBoxGroupBox.h>
00033 #   include <LTextEditView.h>
00034 #   include <LPushButton.h>
00035 #   include <LMultiPanelView.h>
00036 #   include <LPopupGroupBox.h>
00037
00038 #   include "MacCvsConstant.h"
00039 #endif /* qMacCvsPP */
00040
00041 #include "LineCmd.h"
00042 #include "CvsArgs.h"
00043 #include "PromptFiles.h"
00044 #include "CPStr.h"
00045 #include "TextBinary.h"
00046
00047 #if qUnix
00048 #   include "UCvsDialogs.h"
00049 #endif
00050
00051 #ifdef WIN32
00052 #   ifdef _DEBUG
00053 #   define new DEBUG_NEW
00054 #   undef THIS_FILE
00055     static char THIS_FILE[] = __FILE__;
00056 #   endif
00057 #endif /* WIN32 */
00058
00059 #ifdef qMacCvsPP
00060 static void DoDataExchange_CmdlineMain(LWindow *theDialog, CStr & cmdline, CPStr & path, bool & hasPath, bool putValue)
00061 {
00062     LCheckBoxGroupBox *cbox = dynamic_cast<LCheckBoxGroupBox*>
00063         (theDialog->FindPaneByID(item_CheckGroupPath));
00064     LPushButton *epath = dynamic_cast<LPushButton*>
00065         (theDialog->FindPaneByID(item_EditPath));
00066     LTextEditView *cline = dynamic_cast<LTextEditView*>
00067         (theDialog->FindPaneByID(item_NonEmptyTextEdit));
00068
00069     if(putValue)
00070     {
00071         cline->SetTextPtr((Ptr)(const char *)cmdline, cmdline.length());
00072         cbox->SetValue(hasPath ? Button_On : Button_Off);
00073         epath->SetDescriptor(path);
00074
00075         // this will take care about an empty module name
00076         theDialog->SetLatentSub(cline);
00077         //cline->AddListener(LCommander::GetTopCommander());
00078         if(cmdline.length() == 0)
00079         {
00080             LPushButton *theOK = dynamic_cast<LPushButton*>
00081                                         (theDialog->FindPaneByID(item_OK));
00082             Assert_(theOK != 0L);
00083             theOK->Disable();
00084         }
00085     }
00086     else
00087     {
00088         Handle hdl = cline->GetTextHandle();
00089         Assert_(hdl != 0L);
00090         cmdline.set(*hdl, GetHandleSize(hdl));
00091
00092         Str255 outDescriptor;
00093         epath->GetDescriptor(outDescriptor);
00094         path = outDescriptor;
00095         hasPath = cbox->GetValue() == Button_On;
00096     }
00097 }
00098 #endif /* qMacCvsPP */
00099
00100 #ifdef WIN32
00101 #include "GetPrefs.h"
00102 #include "CvsPrefs.h"
00103
00104 IMPLEMENT_DYNCREATE(CCmdLine_MAIN, CPropertyPage)
00105
00106 CCmdLine_MAIN::CCmdLine_MAIN(const char *lastcmd, bool hasPath,
00107                              const char *lastpath) : CPropertyPage(CCmdLine_MAIN::IDD)
00108 {
00109     //{{AFX_DATA_INIT(CCmdLine_MAIN)
00110     m_checkpath = hasPath;
00111     m_cmdline = lastcmd;
00112     m_folderloc = lastpath;
00113     //}}AFX_DATA_INIT
00114 }
00115
00116 CCmdLine_MAIN::CCmdLine_MAIN() : CPropertyPage(CCmdLine_MAIN::IDD)
00117 {
00118 }
00119
00120 CCmdLine_MAIN::~CCmdLine_MAIN()
00121 {
00122 }
00123
00124 void CCmdLine_MAIN::DoDataExchange(CDataExchange* pDX)
00125 {
00126     CPropertyPage::DoDataExchange(pDX);
00127     //{{AFX_DATA_MAP(CCmdLine_MAIN)
00128     DDX_Control(pDX, IDC_SELFOLDER, m_selfolder);
00129     DDX_Check(pDX, IDC_CHECKPATH, m_checkpath);
00130     DDX_Text(pDX, IDC_CMDLINE, m_cmdline);
00131     DDV_MinChars(pDX, m_cmdline, 1);
00132     DDX_Text(pDX, IDC_FOLDERLOC, m_folderloc);
00133     //}}AFX_DATA_MAP
00134
00135     if(!pDX->m_bSaveAndValidate)
00136     {
00137         m_selfolder.EnableWindow(m_checkpath);
00138     }
00139 }
00140
00141
00142 BEGIN_MESSAGE_MAP(CCmdLine_MAIN, CPropertyPage)
00143     //{{AFX_MSG_MAP(CCmdLine_MAIN)
00144     ON_BN_CLICKED(IDC_CHECKPATH, OnCheckpath)
00145     ON_BN_CLICKED(IDC_SELFOLDER, OnSelfolder)
00146     //}}AFX_MSG_MAP
00147 END_MESSAGE_MAP()
00148
00150 // CCmdLine_MAIN message handlers
00151
00152 void CCmdLine_MAIN::OnCheckpath()
00153 {
00154     CButton* but = (CButton *)GetDlgItem(IDC_CHECKPATH);
00155     int isChecked = but->GetCheck();
00156     m_selfolder.EnableWindow(isChecked);
00157     if(isChecked)
00158     {
00159         OnSelfolder();
00160     }
00161 }
00162
00163 void CCmdLine_MAIN::OnSelfolder()
00164 {
00165     const char *dir = BrowserGetDirectory("Select where to execute :", IsWindow(this->m_hWnd) ? this : NULL);
00166     SetDlgItemText(IDC_FOLDERLOC, dir != 0L ? dir : "");
00167
00168     if(dir == 0L)
00169     {
00170         CButton* but = (CButton *)GetDlgItem(IDC_CHECKPATH);
00171         but->SetCheck(FALSE);
00172         m_selfolder.EnableWindow(FALSE);
00173     }
00174 }
00175 #endif /* WIN32 */
00176
00177 #if qUnix
00178 class UCvsCmdline : public UWidget
00179 {
00180     UDECLARE_DYNAMIC(UCvsCmdline)
00181 public:
00182     UCvsCmdline() : UWidget(::UEventGetWidID()) {}
00183     virtual ~UCvsCmdline() {}
00184
00185     enum
00186     {
00187         kOK = EV_COMMAND_START, // 0
00188         kCancel,                // 1
00189         kTabGeneral             // 2
00190     };
00191
00192     virtual void DoDataExchange(bool fill);
00193
00194 protected:
00195     ev_msg int OnOK(void);
00196     ev_msg int OnCancel(void);
00197
00198     UDECLARE_MESSAGE_MAP()
00199 };
00200
00201 UIMPLEMENT_DYNAMIC(UCvsCmdline, UWidget)
00202
00203 UBEGIN_MESSAGE_MAP(UCvsCmdline, UWidget)
00204     ON_UCOMMAND(UCvsCmdline::kOK, UCvsCmdline::OnOK)
00205     ON_UCOMMAND(UCvsCmdline::kCancel, UCvsCmdline::OnCancel)
00206 UEND_MESSAGE_MAP()
00207
00208 int UCvsCmdline::OnOK(void)
00209 {
00210     EndModal(true);
00211     return 0;
00212 }
00213
00214 int UCvsCmdline::OnCancel(void)
00215 {
00216     EndModal(false);
00217     return 0;
00218 }
00219
00220 void UCvsCmdline::DoDataExchange(bool fill)
00221 {
00222     if(fill)
00223     {
00224     }
00225     else
00226     {
00227     }
00228 }
00229
00230 class UCvsCmdline_MAIN : public UWidget
00231 {
00232     UDECLARE_DYNAMIC(UCvsCmdline_MAIN)
00233 public:
00234     UCvsCmdline_MAIN(const char *lastcmd, bool hasPath,
00235                      const char *lastpath);
00236     virtual ~UCvsCmdline_MAIN() {}
00237
00238     enum
00239     {
00240         kEditCmd = EV_COMMAND_START,    // 0
00241         kCheckPath,         // 1
00242         kStatPath,          // 2
00243         kBtnPath            // 3
00244     };
00245
00246     virtual void DoDataExchange(bool fill);
00247
00248     bool m_checkpath;
00249     UStr m_cmdline;
00250     UStr m_folderloc;
00251 protected:
00252     ev_msg int OnCheckPath(void);
00253     ev_msg int OnBtnPath(void);
00254
00255     UDECLARE_MESSAGE_MAP()
00256 };
00257
00258 UIMPLEMENT_DYNAMIC(UCvsCmdline_MAIN, UWidget)
00259
00260 UBEGIN_MESSAGE_MAP(UCvsCmdline_MAIN, UWidget)
00261     ON_UCOMMAND(UCvsCmdline_MAIN::kCheckPath, UCvsCmdline_MAIN::OnCheckPath)
00262     ON_UCOMMAND(UCvsCmdline_MAIN::kBtnPath, UCvsCmdline_MAIN::OnBtnPath)
00263 UEND_MESSAGE_MAP()
00264
00265 UCvsCmdline_MAIN::UCvsCmdline_MAIN(const char *lastcmd, bool hasPath,
00266                              const char *lastpath) : UWidget(::UEventGetWidID())
00267 {
00268     m_checkpath = hasPath;
00269     m_cmdline = lastcmd;
00270     m_folderloc = lastpath;
00271 }
00272
00273 int UCvsCmdline_MAIN::OnCheckPath()
00274 {
00275     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPath, 0L);
00276     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kStatPath, state), 0L);
00277     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kBtnPath, state), 0L);
00278     return 0;
00279 }
00280
00281 int UCvsCmdline_MAIN::OnBtnPath()
00282 {
00283     const char *dir = BrowserGetDirectory("Select where to execute :");
00284     if(dir != 0L)
00285         UEventSendMessage(GetWidID(), EV_SETTEXT, kStatPath, (void *)dir);
00286     return 0;
00287 }
00288
00289 void UCvsCmdline_MAIN::DoDataExchange(bool fill)
00290 {
00291     if(fill)
00292     {
00293         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckPath, m_checkpath), 0L);
00294         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditCmd, (void *)(const char *)m_cmdline);
00295         UEventSendMessage(GetWidID(), EV_SETTEXT, kStatPath, (void *)(const char *)m_folderloc);
00296
00297         OnCheckPath();
00298     }
00299     else
00300     {
00301         m_checkpath = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPath, 0L) != 0;
00302         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditCmd, &m_cmdline);
00303         UEventSendMessage(GetWidID(), EV_GETTEXT, kStatPath, &m_folderloc);
00304     }
00305 }
00306 #endif // qUnix
00307
00308 bool CompatGetCommand(CvsArgs &args, const char * &dir)
00309 {
00310     char cmd[MAX_CMD_LEN] = {'\0'};
00311     dir = 0L;
00312
00313     static CStr sLastCmdline("cvs ");
00314 #ifdef macintosh
00315     static CPStr sLastPath("pick:a:mac:path:");
00316 #else /* !macintosh */
00317     static CPStr sLastPath("");
00318 #endif /* !macintosh */
00319     static bool sLastHasPath = false;
00320
00321 #ifdef WIN32
00322     CPropertySheet pages("Command line settings");
00323     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00324     CCmdLine_MAIN page1(sLastCmdline, sLastHasPath, sLastPath);
00325     CGetPrefs_GLOBALS page2;
00326     pages.AddPage(&page1);
00327     pages.AddPage(&page2);
00328     if(pages.DoModal() == IDOK)
00329     {
00330         sLastCmdline = page1.m_cmdline;
00331         sLastHasPath = page1.m_checkpath == TRUE;
00332         sLastPath = page1.m_folderloc;
00333
00334         dir = page1.m_checkpath ? (const char *)sLastPath : 0L;
00335         strcpy(cmd, page1.m_cmdline);
00336
00337         page2.StoreValues();
00338         gCvsPrefs.save();
00339     }
00340     else
00341         return false;
00342 #endif /* WIN32 */
00343 #if qUnix
00344     void *wid = UCreate_CmdlineDlg();
00345
00346     UCvsCmdline *dlg = new UCvsCmdline();
00347     UCvsCmdline_MAIN *tab1 = new UCvsCmdline_MAIN(sLastCmdline, sLastHasPath, sLastPath);
00348     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00349     dlg->AddPage(tab1, UCvsCmdline::kTabGeneral, 0);
00350
00351     if(dlg->DoModal())
00352     {
00353         sLastCmdline = tab1->m_cmdline;
00354         sLastHasPath = tab1->m_checkpath;
00355         sLastPath = tab1->m_folderloc;
00356
00357         dir = tab1->m_checkpath ? (const char *)sLastPath : 0L;
00358         strcpy(cmd, tab1->m_cmdline);
00359     }
00360     else
00361     {
00362         delete dlg;
00363         return false;
00364     }
00365
00366     delete dlg;
00367 #endif // qUnix
00368 #ifdef qMacCvsPP
00369     StDialogHandler theHandler(dlg_Cmdline, LCommander::GetTopCommander());
00370     LWindow *theDialog = theHandler.GetDialog();
00371     ThrowIfNil_(theDialog);
00372     static UInt16 sRuntimePanel = 1;
00373
00374     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00375         (theDialog->FindPaneByID(item_MultiViewPrefs));
00376     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00377
00378     multiView->SwitchToPanel(2);
00379     DoDataExchange_Globals(theDialog, true);
00380     multiView->SwitchToPanel(1);
00381     DoDataExchange_CmdlineMain(theDialog, sLastCmdline, sLastPath, sLastHasPath, true);
00382
00383     LCheckBoxGroupBox *cbox = dynamic_cast<LCheckBoxGroupBox*>
00384         (theDialog->FindPaneByID(item_CheckGroupPath));
00385     LPushButton *epath = dynamic_cast<LPushButton*>
00386         (theDialog->FindPaneByID(item_EditPath));
00387     epath->AddListener(&theHandler);
00388     cbox->AddListener(&theHandler);
00389
00390     groupView->SetValue(sRuntimePanel);
00391     theDialog->Show();
00392     MessageT hitMessage;
00393     while (true)
00394     {       // Let DialogHandler process events
00395         hitMessage = theHandler.DoDialog();
00396
00397         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00398             break;
00399
00400         if(hitMessage == item_CheckGroupPath || hitMessage == item_EditPath)
00401         {
00402             cbox = dynamic_cast<LCheckBoxGroupBox*>
00403                 (theDialog->FindPaneByID(item_CheckGroupPath));
00404             epath = dynamic_cast<LPushButton*>
00405                 (theDialog->FindPaneByID(item_EditPath));
00406             if(cbox->GetValue() == Button_Off)
00407             {
00408                 dir = 0L;
00409                 continue;
00410             }
00411
00412             dir = BrowserGetDirectory("Select where to execute :");
00413             if(dir != 0L)
00414             {
00415                 CPStr tmp(dir);
00416                 epath->SetDescriptor(tmp);
00417             }
00418             else if(hitMessage == item_CheckGroupPath)
00419             {
00420                 cbox->SetValue(Button_Off);
00421             }
00422         }
00423
00424     }
00425     theDialog->Hide();
00426     sRuntimePanel = groupView->GetValue();
00427
00428     if(hitMessage == msg_OK)
00429     {
00430         multiView->SwitchToPanel(1);
00431         DoDataExchange_CmdlineMain(theDialog, sLastCmdline, sLastPath, sLastHasPath, false);
00432         multiView->SwitchToPanel(2);
00433         DoDataExchange_Globals(theDialog, false);
00434
00435         strcpy(cmd, sLastCmdline);
00436         Assert_(sLastCmdline.length() != 0);
00437         dir = sLastHasPath ? (const char *)sLastPath : 0L;
00438     }
00439     else
00440         return false;
00441 #endif /* qMacCvsPP */
00442
00443     if(cmd[0] == '\0' || (dir != 0L && dir[0] == '\0'))
00444         return false;
00445
00446     char *argv[MAX_ARGS];
00447     int argc = StringToArgv(cmd, argv);
00448
00449     for (int i = 0; i < argc; i++)
00450         args.add(argv[i]);
00451
00452     return true;
00453 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/LineCmd.h Source File

common/LineCmd.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 #if !defined(AFX_LINECMD_H__5946A8C5_8517_11D1_8949_444553540000__INCLUDED_)
00022 #define AFX_LINECMD_H__5946A8C5_8517_11D1_8949_444553540000__INCLUDED_
00023
00024 #if _MSC_VER >= 1000
00025 #pragma once
00026 #endif // _MSC_VER >= 1000
00027 // LineCmd.h : header file
00028 //
00029
00030 class CvsArgs;
00031
00032 bool CompatGetCommand(CvsArgs &args, const char * &dir);
00033     // return the directory, false if the user canceled
00034
00035 #ifdef WIN32
00036 class CCmdLine_MAIN : public CPropertyPage
00037 {
00038     DECLARE_DYNCREATE(CCmdLine_MAIN)
00039
00040 // Construction
00041 public:
00042     CCmdLine_MAIN();
00043     CCmdLine_MAIN(const char *lastcmd, bool hasPath, const char *lastpath);
00044     ~CCmdLine_MAIN();
00045
00046 // Dialog Data
00047     //{{AFX_DATA(CCmdLine_MAIN)
00048     enum { IDD = IDD_CMDLINE_MAIN };
00049     CButton m_selfolder;
00050     BOOL    m_checkpath;
00051     CString m_cmdline;
00052     CString m_folderloc;
00053     //}}AFX_DATA
00054
00055
00056 // Overrides
00057     // ClassWizard generate virtual function overrides
00058     //{{AFX_VIRTUAL(CCmdLine_MAIN)
00059     protected:
00060     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00061     //}}AFX_VIRTUAL
00062
00063 // Implementation
00064 protected:
00065     // Generated message map functions
00066     //{{AFX_MSG(CCmdLine_MAIN)
00067     afx_msg void OnCheckpath();
00068     afx_msg void OnSelfolder();
00069     //}}AFX_MSG
00070     DECLARE_MESSAGE_MAP()
00071
00072 };
00073
00074 //{{AFX_INSERT_LOCATION}}
00075 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00076 #endif /* WIN32 */
00077
00078 #endif // !defined(AFX_LINECMD_H__5946A8C5_8517_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/LogDlg.cpp Source File

common/LogDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * LogDlg.cpp : the cvs log dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #   include "OptionalPropertySheet.h"
00030 #endif /* WIN32 */
00031
00032 #ifdef qMacCvsPP
00033 #   include <UModalDialogs.h>
00034 #   include <LMultiPanelView.h>
00035 #   include <LCheckBox.h>
00036 #   include <LEditText.h>
00037 #   include <LPopupGroupBox.h>
00038 #   include <LRadioButton.h>
00039 #   include "LPopupFiller.h"
00040
00041 #   include "MacCvsConstant.h"
00042 #endif /* qMacCvsPP */
00043
00044 #ifdef WIN32
00045 #   ifdef _DEBUG
00046 #   define new DEBUG_NEW
00047 #   undef THIS_FILE
00048     static char THIS_FILE[] = __FILE__;
00049 #   endif
00050 #endif /* WIN32 */
00051
00052 #if qUnix
00053 #   include "UCvsDialogs.h"
00054 #endif
00055
00056 #include "LogDlg.h"
00057 #include "CvsPrefs.h"
00058 #include "MultiString.h"
00059
00060 char *sDefLogTagNames[] =
00061 {
00062     "1.32:1.35",
00063     "1.32:",
00064     ":1.35",
00065     "branch-release1-0",
00066     "HEAD",
00067     0L
00068 };
00069
00070 char *sDefLogDateNames[] =
00071 {
00072     ">1998-3-24",
00073     "<1998-1-24",
00074     "1998-1-24<1998-3-24",
00075     "<=3-24",
00076     0L
00077 };
00078
00079 char *sDefLogStateNames[] =
00080 {
00081     "mystate",
00082     "dead",
00083     "exp",
00084     "mystate,mystate2",
00085     0L
00086 };
00087
00088 char *sDefLogUserNames[] =
00089 {
00090     "johna",
00091     "garyb",
00092     "johna,garyb",
00093     0L
00094 };
00095
00096 static CMString gLogRevNames(10, "P_LogTagNames", sDefLogTagNames);
00097 static CMString gLogDateNames(10, "P_LogDateNames", sDefLogDateNames);
00098 static CMString gLogStateNames(10, "P_LogStateNames", sDefLogStateNames);
00099 static CMString gLogUserNames(10, "P_LogUserNames", sDefLogUserNames);
00100
00101 #ifdef WIN32
00102 #include "GetPrefs.h"
00103
00104 IMPLEMENT_DYNCREATE(CLogMain, CPropertyPage)
00105
00106 CLogMain::CLogMain() : CPropertyPage(CLogMain::IDD)
00107 {
00108     //{{AFX_DATA_INIT(CLogMain)
00109     m_defbranch = FALSE;
00110     m_norecurs = FALSE;
00111     m_notags = FALSE;
00112     m_nousers = FALSE;
00113     m_onlyrcs = FALSE;
00114     //}}AFX_DATA_INIT
00115 }
00116
00117 CLogMain::~CLogMain()
00118 {
00119 }
00120
00121 void CLogMain::DoDataExchange(CDataExchange* pDX)
00122 {
00123     CPropertyPage::DoDataExchange(pDX);
00124     //{{AFX_DATA_MAP(CLogMain)
00125     DDX_Check(pDX, IDC_DEFBRANCH, m_defbranch);
00126     DDX_Check(pDX, IDC_NORECURS, m_norecurs);
00127     DDX_Check(pDX, IDC_NOTAGS, m_notags);
00128     DDX_Check(pDX, IDC_NOUSERS, m_nousers);
00129     DDX_Check(pDX, IDC_ONLYRCS, m_onlyrcs);
00130     //}}AFX_DATA_MAP
00131 }
00132
00133
00134 BEGIN_MESSAGE_MAP(CLogMain, CPropertyPage)
00135     //{{AFX_MSG_MAP(CLogMain)
00136         // NOTE: the ClassWizard will add message map macros here
00137     //}}AFX_MSG_MAP
00138 END_MESSAGE_MAP()
00139
00140 IMPLEMENT_DYNCREATE(CLogFilters, CPropertyPage)
00141
00142 CLogFilters::CLogFilters(const char * sLastDate, const char * sLastRev,
00143         const char * sLastUsers, const char * sLastStates) : CPropertyPage(CLogFilters::IDD)
00144 {
00145     //{{AFX_DATA_INIT(CLogFilters)
00146     m_date = sLastDate;
00147     m_rev = sLastRev;
00148     m_state = sLastStates;
00149     m_user = sLastUsers;
00150     //}}AFX_DATA_INIT
00151     m_hasdate = FALSE;
00152     m_hasrev = FALSE;
00153     m_hasstate = FALSE;
00154     m_hasuser = FALSE;
00155 }
00156
00157 CLogFilters::CLogFilters() : CPropertyPage(CLogFilters::IDD)
00158 {
00159 }
00160
00161 CLogFilters::~CLogFilters()
00162 {
00163 }
00164
00165 void CLogFilters::DoDataExchange(CDataExchange* pDX)
00166 {
00167     CPropertyPage::DoDataExchange(pDX);
00168     //{{AFX_DATA_MAP(CLogFilters)
00169     DDX_Control(pDX, IDC_COMBOUSER, m_userdef);
00170     DDX_Control(pDX, IDC_COMBOSTATE, m_statedef);
00171     DDX_Control(pDX, IDC_COMBOREV, m_revdef);
00172     DDX_Control(pDX, IDC_COMBODATE, m_datedef);
00173     DDX_CBString(pDX, IDC_COMBODATE, m_date);
00174     DDX_CBString(pDX, IDC_COMBOREV, m_rev);
00175     DDX_CBString(pDX, IDC_COMBOSTATE, m_state);
00176     DDX_CBString(pDX, IDC_COMBOUSER, m_user);
00177     DDX_Check(pDX, IDC_DATE, m_hasdate);
00178     DDX_Check(pDX, IDC_REV, m_hasrev);
00179     DDX_Check(pDX, IDC_STATE, m_hasstate);
00180     DDX_Check(pDX, IDC_USER, m_hasuser);
00181     //}}AFX_DATA_MAP
00182     if(m_hasstate)
00183         DDV_MinChars(pDX, m_state, 1);
00184     if(m_hasdate)
00185         DDV_MinChars(pDX, m_date, 1);
00186     if(!pDX->m_bSaveAndValidate)
00187     {
00188         OnRev();
00189         OnDate();
00190         OnState();
00191         OnUser();
00192     }
00193     DDX_ComboMString(pDX, IDC_COMBOREV, gLogRevNames, m_revdef);
00194     DDX_ComboMString(pDX, IDC_COMBODATE, gLogDateNames, m_datedef);
00195     DDX_ComboMString(pDX, IDC_COMBOUSER, gLogUserNames, m_userdef);
00196     DDX_ComboMString(pDX, IDC_COMBOSTATE, gLogStateNames, m_statedef);
00197 }
00198
00199
00200 BEGIN_MESSAGE_MAP(CLogFilters, CPropertyPage)
00201     //{{AFX_MSG_MAP(CLogFilters)
00202     ON_BN_CLICKED(IDC_DATE, OnDate)
00203     ON_BN_CLICKED(IDC_REV, OnRev)
00204     ON_BN_CLICKED(IDC_STATE, OnState)
00205     ON_BN_CLICKED(IDC_USER, OnUser)
00206     //}}AFX_MSG_MAP
00207 END_MESSAGE_MAP()
00208
00210 // CLogFilters message handlers
00211
00212 void CLogFilters::OnDate()
00213 {
00214     CButton* but = (CButton *)GetDlgItem(IDC_DATE);
00215     CWnd* wnd = GetDlgItem(IDC_COMBODATE);
00216     wnd->EnableWindow(but->GetCheck() == 1);
00217 }
00218
00219 void CLogFilters::OnRev()
00220 {
00221     CButton* but = (CButton *)GetDlgItem(IDC_REV);
00222     CWnd* wnd = GetDlgItem(IDC_COMBOREV);
00223     wnd->EnableWindow(but->GetCheck() == 1);
00224 }
00225
00226 void CLogFilters::OnState()
00227 {
00228     CButton* but = (CButton *)GetDlgItem(IDC_STATE);
00229     CWnd* wnd = GetDlgItem(IDC_COMBOSTATE);
00230     wnd->EnableWindow(but->GetCheck() == 1);
00231 }
00232
00233 void CLogFilters::OnUser()
00234 {
00235     CButton* but = (CButton *)GetDlgItem(IDC_USER);
00236     CWnd* wnd = GetDlgItem(IDC_COMBOUSER);
00237     wnd->EnableWindow(but->GetCheck() == 1);
00238 }
00239 #endif /* WIN32 */
00240
00241 #ifdef qMacCvsPP
00242 static void DoDataExchange_LogFilters(LWindow *theDialog, bool & hasDate, bool & hasStates,
00243         bool & hasRev, bool & hasUsers,
00244         CPStr & sLastDate, CPStr & sLastRev,
00245         CPStr & sLastUsers, CPStr & sLastStates, bool putValue)
00246 {
00247     LCheckBox *chkd = dynamic_cast<LCheckBox*>
00248         (theDialog->FindPaneByID(item_LogCheckByDate));
00249     LEditText *editd = dynamic_cast<LEditText*>
00250         (theDialog->FindPaneByID(item_LogEditByDate));
00251     LCheckBox *chks = dynamic_cast<LCheckBox*>
00252         (theDialog->FindPaneByID(item_LogCheckByState));
00253     LEditText *edits = dynamic_cast<LEditText*>
00254         (theDialog->FindPaneByID(item_LogEditByState));
00255     LCheckBox *chkr = dynamic_cast<LCheckBox*>
00256         (theDialog->FindPaneByID(item_LogCheckByRev));
00257     LEditText *editr = dynamic_cast<LEditText*>
00258         (theDialog->FindPaneByID(item_LogEditByRev));
00259     LCheckBox *chku = dynamic_cast<LCheckBox*>
00260         (theDialog->FindPaneByID(item_LogCheckByUser));
00261     LEditText *editu = dynamic_cast<LEditText*>
00262         (theDialog->FindPaneByID(item_LogEditByUser));
00263     LPopupFiller *fillDate = dynamic_cast<LPopupFiller*>
00264         (theDialog->FindPaneByID(item_LogFillByDate));
00265     LPopupFiller *fillState = dynamic_cast<LPopupFiller*>
00266         (theDialog->FindPaneByID(item_LogFillByState));
00267     LPopupFiller *fillRev = dynamic_cast<LPopupFiller*>
00268         (theDialog->FindPaneByID(item_LogFillByRev));
00269     LPopupFiller *fillUser = dynamic_cast<LPopupFiller*>
00270         (theDialog->FindPaneByID(item_LogFillByUser));
00271
00272     fillDate->DoDataExchange(gLogDateNames, putValue);
00273     fillState->DoDataExchange(gLogStateNames, putValue);
00274     fillRev->DoDataExchange(gLogRevNames, putValue);
00275     fillUser->DoDataExchange(gLogUserNames, putValue);
00276
00277     if(putValue)
00278     {
00279         chkd->SetValue(hasDate ? Button_On : Button_Off);
00280         editd->SetText((Ptr)(const char *)sLastDate, sLastDate.length());
00281
00282         chks->SetValue(hasStates ? Button_On : Button_Off);
00283         edits->SetText((Ptr)(const char *)sLastStates, sLastStates.length());
00284
00285         chkr->SetValue(hasRev ? Button_On : Button_Off);
00286         editr->SetText((Ptr)(const char *)sLastRev, sLastRev.length());
00287
00288         chku->SetValue(hasUsers ? Button_On : Button_Off);
00289         editu->SetText((Ptr)(const char *)sLastUsers, sLastUsers.length());
00290     }
00291     else
00292     {
00293         char str[255];
00294         Size len;
00295
00296         hasDate = chkd->GetValue() == Button_On;
00297         editd->GetText(str, 254, &len);
00298         sLastDate.set(str, len);
00299
00300         hasStates = chks->GetValue() == Button_On;
00301         edits->GetText(str, 254, &len);
00302         sLastStates.set(str, len);
00303
00304         hasRev = chkr->GetValue() == Button_On;
00305         editr->GetText(str, 254, &len);
00306         sLastRev.set(str, len);
00307
00308         hasUsers = chku->GetValue() == Button_On;
00309         editu->GetText(str, 254, &len);
00310         sLastUsers.set(str, len);
00311     }
00312 }
00313
00314 static void DoDataExchange_LogSettings(LWindow *theDialog, bool & noRecurs, bool & defBranch,
00315     bool & headerOnly, bool & noTags, bool & onlyRCSfile, bool putValue)
00316 {
00317     LCheckBox *chkNoRecurs = dynamic_cast<LCheckBox*>
00318         (theDialog->FindPaneByID(item_NoRecurs));
00319     LCheckBox *chkDefBranch = dynamic_cast<LCheckBox*>
00320         (theDialog->FindPaneByID(item_LogDefBranch));
00321     LCheckBox *chkHeaderOnly = dynamic_cast<LCheckBox*>
00322         (theDialog->FindPaneByID(item_LogNoUserLogs));
00323     LCheckBox *chkNoTags = dynamic_cast<LCheckBox*>
00324         (theDialog->FindPaneByID(item_LogNoTags));
00325     LCheckBox *chkOnlyRCSfile = dynamic_cast<LCheckBox*>
00326         (theDialog->FindPaneByID(item_LogOnlyRcs));
00327
00328     if(putValue)
00329     {
00330         chkNoRecurs->SetValue(noRecurs ? Button_On : Button_Off);
00331         chkDefBranch->SetValue(defBranch ? Button_On : Button_Off);
00332         chkHeaderOnly->SetValue(headerOnly ? Button_On : Button_Off);
00333         chkNoTags->SetValue(noTags ? Button_On : Button_Off);
00334         chkOnlyRCSfile->SetValue(onlyRCSfile ? Button_On : Button_Off);
00335     }
00336     else
00337     {
00338         noRecurs = chkNoRecurs->GetValue() == Button_On;
00339         defBranch = chkDefBranch->GetValue() == Button_On;
00340         headerOnly = chkHeaderOnly->GetValue() == Button_On;
00341         noTags = chkNoTags->GetValue() == Button_On;
00342         onlyRCSfile = chkOnlyRCSfile->GetValue() == Button_On;
00343     }
00344 }
00345 #endif /* qMacCvsPP */
00346
00347 #if qUnix
00348 class UCvsLog : public UWidget
00349 {
00350     UDECLARE_DYNAMIC(UCvsLog)
00351 public:
00352     UCvsLog() : UWidget(::UEventGetWidID()) {}
00353     virtual ~UCvsLog() {}
00354
00355     enum
00356     {
00357         kOK = EV_COMMAND_START, // 0
00358         kCancel,                // 1
00359         kTabGeneral             // 2
00360     };
00361
00362     virtual void DoDataExchange(bool fill);
00363
00364 protected:
00365     ev_msg int OnOK(void);
00366     ev_msg int OnCancel(void);
00367
00368     UDECLARE_MESSAGE_MAP()
00369 };
00370
00371 UIMPLEMENT_DYNAMIC(UCvsLog, UWidget)
00372
00373 UBEGIN_MESSAGE_MAP(UCvsLog, UWidget)
00374     ON_UCOMMAND(UCvsLog::kOK, UCvsLog::OnOK)
00375     ON_UCOMMAND(UCvsLog::kCancel, UCvsLog::OnCancel)
00376 UEND_MESSAGE_MAP()
00377
00378 int UCvsLog::OnOK(void)
00379 {
00380     EndModal(true);
00381     return 0;
00382 }
00383
00384 int UCvsLog::OnCancel(void)
00385 {
00386     EndModal(false);
00387     return 0;
00388 }
00389
00390 void UCvsLog::DoDataExchange(bool fill)
00391 {
00392     if(fill)
00393     {
00394     }
00395     else
00396     {
00397     }
00398 }
00399
00400 class UCvsLog_MAIN : public UWidget
00401 {
00402     UDECLARE_DYNAMIC(UCvsLog_MAIN)
00403 public:
00404     UCvsLog_MAIN();
00405     virtual ~UCvsLog_MAIN() {}
00406
00407     enum
00408     {
00409         kCheckBranch = EV_COMMAND_START,    // 0
00410         kCheckRecurs,           // 1
00411         kCheckRCS,              // 2
00412         kCheckTags,             // 3
00413         kCheckUsers             // 4
00414     };
00415
00416     virtual void DoDataExchange(bool fill);
00417
00418     bool m_defbranch;
00419     bool m_norecurs;
00420     bool m_notags;
00421     bool m_nousers;
00422     bool m_onlyrcs;
00423
00424 protected:
00425     UDECLARE_MESSAGE_MAP()
00426 };
00427
00428 UIMPLEMENT_DYNAMIC(UCvsLog_MAIN, UWidget)
00429
00430 UBEGIN_MESSAGE_MAP(UCvsLog_MAIN, UWidget)
00431 UEND_MESSAGE_MAP()
00432
00433 UCvsLog_MAIN::UCvsLog_MAIN() : UWidget(::UEventGetWidID())
00434 {
00435     m_defbranch = false;
00436     m_norecurs = false;
00437     m_notags = false;
00438     m_nousers = false;
00439     m_onlyrcs = false;
00440 }
00441
00442 void UCvsLog_MAIN::DoDataExchange(bool fill)
00443 {
00444     if(fill)
00445     {
00446         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckBranch, m_defbranch), 0L);
00447         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRecurs, m_norecurs), 0L);
00448         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckTags, m_notags), 0L);
00449         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckUsers, m_nousers), 0L);
00450         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRCS, m_onlyrcs), 0L);
00451     }
00452     else
00453     {
00454         m_defbranch = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckBranch, 0L);
00455         m_norecurs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRecurs, 0L);
00456         m_notags = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckTags, 0L);
00457         m_nousers = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckUsers, 0L);
00458         m_onlyrcs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRCS, 0L);
00459     }
00460 }
00461
00462 class UCvsLog_FILTERS : public UWidget
00463 {
00464     UDECLARE_DYNAMIC(UCvsLog_FILTERS)
00465 public:
00466     UCvsLog_FILTERS(const char * sLastDate, const char * sLastRev,
00467         const char * sLastUsers, const char * sLastStates);
00468     virtual ~UCvsLog_FILTERS() {}
00469
00470     enum
00471     {
00472         kCheckTag = EV_COMMAND_START,   // 0
00473         kCheckDate,         // 1
00474         kCheckState,        // 2
00475         kCheckUser,         // 3
00476         kComboTag,          // 4
00477         kComboDate,         // 5
00478         kComboState,        // 6
00479         kComboUser          // 7
00480     };
00481
00482     virtual void DoDataExchange(bool fill);
00483
00484     UStr m_date;
00485     UStr m_rev;
00486     UStr m_state;
00487     UStr m_user;
00488     bool m_hasrev;
00489     bool m_hasuser;
00490     bool m_hasdate;
00491     bool m_hasstate;
00492 protected:
00493
00494     ev_msg int OnSelect(int cmd);
00495
00496     UDECLARE_MESSAGE_MAP()
00497 };
00498
00499 UIMPLEMENT_DYNAMIC(UCvsLog_FILTERS, UWidget)
00500
00501 UBEGIN_MESSAGE_MAP(UCvsLog_FILTERS, UWidget)
00502     ON_UCOMMAND_RANGE(UCvsLog_FILTERS::kCheckTag, UCvsLog_FILTERS::kCheckUser, UCvsLog_FILTERS::OnSelect)
00503 UEND_MESSAGE_MAP()
00504
00505 UCvsLog_FILTERS::UCvsLog_FILTERS(const char * sLastDate, const char * sLastRev,
00506         const char * sLastUsers, const char * sLastStates) : UWidget(::UEventGetWidID())
00507 {
00508     m_date = sLastDate;
00509     m_rev = sLastRev;
00510     m_state = sLastStates;
00511     m_user = sLastUsers;
00512     m_hasrev = false;
00513     m_hasuser = false;
00514     m_hasdate = false;
00515     m_hasstate = false;
00516 }
00517
00518 int UCvsLog_FILTERS::OnSelect(int cmd)
00519 {
00520     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, cmd, 0L);
00521     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(cmd + 4, state), 0L);
00522     return 0;
00523 }
00524
00525 void UCvsLog_FILTERS::DoDataExchange(bool fill)
00526 {
00527     ::DoDataExchange(fill, GetWidID(), kComboTag, gLogRevNames);
00528     ::DoDataExchange(fill, GetWidID(), kComboDate, gLogDateNames);
00529     ::DoDataExchange(fill, GetWidID(), kComboUser, gLogUserNames);
00530     ::DoDataExchange(fill, GetWidID(), kComboState, gLogStateNames);
00531
00532     if(fill)
00533     {
00534         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckDate, m_hasdate), 0L);
00535         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckTag, m_hasrev), 0L);
00536         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckState, m_hasstate), 0L);
00537         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckUser, m_hasuser), 0L);
00538
00539         UEventSendMessage(GetWidID(), EV_SETTEXT, kComboDate, (void *)(const char *)m_date);
00540         UEventSendMessage(GetWidID(), EV_SETTEXT, kComboTag, (void *)(const char *)m_rev);
00541         UEventSendMessage(GetWidID(), EV_SETTEXT, kComboState, (void *)(const char *)m_state);
00542         UEventSendMessage(GetWidID(), EV_SETTEXT, kComboUser, (void *)(const char *)m_user);
00543
00544         OnSelect(kCheckDate);
00545         OnSelect(kCheckTag);
00546         OnSelect(kCheckUser);
00547         OnSelect(kCheckState);
00548     }
00549     else
00550     {
00551         m_hasdate = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDate, 0L);
00552         m_hasrev = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckTag, 0L);
00553         m_hasstate = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckState, 0L);
00554         m_hasuser = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckUser, 0L);
00555
00556         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboDate, &m_date);
00557         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboTag, &m_rev);
00558         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboState, &m_state);
00559         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboUser, &m_user);
00560     }
00561 }
00562 #endif // qUnix
00563
00564 bool CompatGetLog(bool & noRecurs, bool & defBranch, CPStr & date,
00565     bool & headerOnly, bool & noTags, bool & onlyRCSfile, bool & hasRev,
00566     CPStr & rev, CPStr & states, bool & hasUsers, CPStr & users,
00567     bool outGraph /*= false*/)
00568 {
00569     bool userHitOK = false;
00570
00571     static CPStr sLastDate;
00572     static CPStr sLastRev;
00573     static CPStr sLastUsers;
00574     static CPStr sLastStates;
00575
00576     bool hasDate = false;
00577     bool hasStates = false;
00578
00579     hasRev = false;
00580     hasUsers = false;
00581     date = "";
00582     rev = "";
00583     states = "";
00584     users = "";
00585     noRecurs = false;
00586     defBranch = false;
00587     headerOnly = false;
00588     noTags = false;
00589     onlyRCSfile = false;
00590
00591 #ifdef WIN32
00592     COptionalPropertySheet pages(outGraph ? gCvsPrefs.HideCommandDlgGraph() : gCvsPrefs.HideCommandDlgLog(),
00593         outGraph ? "Graph settings" : "Log settings");
00594     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00595     CLogMain page1;
00596     CLogFilters page2(sLastDate, sLastRev, sLastUsers, sLastStates);
00597     CGetPrefs_GLOBALS page3;
00598     pages.AddPage(&page1);
00599     pages.AddPage(&page2);
00600     pages.AddPage(&page3);
00601     if(pages.DoModal() == IDOK)
00602     {
00603         noRecurs = page1.m_norecurs == TRUE;
00604         defBranch = page1.m_defbranch == TRUE;
00605         headerOnly = page1.m_nousers == TRUE;
00606         noTags = page1.m_notags == TRUE;
00607         onlyRCSfile = page1.m_onlyrcs == TRUE;
00608
00609         sLastDate = page2.m_date;
00610         sLastRev = page2.m_rev;
00611         sLastUsers = page2.m_user;
00612         sLastStates = page2.m_state;
00613
00614         hasRev = page2.m_hasrev == TRUE;
00615         hasUsers = page2.m_hasuser == TRUE;
00616         hasDate = page2.m_hasdate == TRUE;
00617         hasStates = page2.m_hasstate == TRUE;
00618
00619         page3.StoreValues();
00620         if( outGraph )
00621         {
00622             gCvsPrefs.SetHideCommandDlgGraph(pages.GetHideCommandDlg());
00623         }
00624         else
00625         {
00626             gCvsPrefs.SetHideCommandDlgLog(pages.GetHideCommandDlg());
00627         }
00628         userHitOK = true;
00629     }
00630 #endif /* WIN32 */
00631 #ifdef qMacCvsPP
00632     StDialogHandler theHandler(dlg_Log, LCommander::GetTopCommander());
00633     LWindow *theDialog = theHandler.GetDialog();
00634     ThrowIfNil_(theDialog);
00635     static UInt16 sRuntimePanel = 1;
00636
00637     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00638         (theDialog->FindPaneByID(item_MultiViewPrefs));
00639     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00640
00641     multiView->SwitchToPanel(3);
00642     DoDataExchange_Globals(theDialog, true);
00643     multiView->SwitchToPanel(2);
00644     DoDataExchange_LogFilters(theDialog, hasDate, hasStates, hasRev, hasUsers,
00645         sLastDate, sLastRev, sLastUsers, sLastStates, true);
00646     multiView->SwitchToPanel(1);
00647     DoDataExchange_LogSettings(theDialog, noRecurs, defBranch, headerOnly, noTags, onlyRCSfile, true);
00648
00649     groupView->SetValue(sRuntimePanel);
00650     theDialog->Show();
00651     MessageT hitMessage;
00652     while (true)
00653     {       // Let DialogHandler process events
00654         hitMessage = theHandler.DoDialog();
00655
00656         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00657             break;
00658     }
00659     theDialog->Hide();
00660     sRuntimePanel = groupView->GetValue();
00661
00662     if(hitMessage == msg_OK)
00663     {
00664         multiView->SwitchToPanel(1);
00665         DoDataExchange_LogSettings(theDialog, noRecurs, defBranch, headerOnly, noTags, onlyRCSfile, false);
00666         multiView->SwitchToPanel(2);
00667         DoDataExchange_LogFilters(theDialog, hasDate, hasStates, hasRev, hasUsers,
00668         sLastDate, sLastRev, sLastUsers, sLastStates, false);
00669         multiView->SwitchToPanel(3);
00670         DoDataExchange_Globals(theDialog, false);
00671         userHitOK = true;
00672     }
00673 #endif /* qMacCvsPP */
00674 #if qUnix
00675     void *wid = UCreate_LogDlg();
00676
00677     UCvsLog *dlg = new UCvsLog();
00678     UCvsLog_MAIN *tab1 = new UCvsLog_MAIN();
00679     UCvsLog_FILTERS *tab2 = new UCvsLog_FILTERS(sLastDate, sLastRev, sLastUsers, sLastStates);
00680     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00681     dlg->AddPage(tab1, UCvsLog::kTabGeneral, 0);
00682     dlg->AddPage(tab2, UCvsLog::kTabGeneral, 1);
00683
00684     if(dlg->DoModal())
00685     {
00686         noRecurs = tab1->m_norecurs;
00687         defBranch = tab1->m_defbranch;
00688         headerOnly = tab1->m_nousers;
00689         noTags = tab1->m_notags;
00690         onlyRCSfile = tab1->m_onlyrcs;
00691
00692         sLastDate = tab2->m_date;
00693         sLastRev = tab2->m_rev;
00694         sLastUsers = tab2->m_user;
00695         sLastStates = tab2->m_state;
00696
00697         hasRev = tab2->m_hasrev;
00698         hasUsers = tab2->m_hasuser;
00699         hasDate = tab2->m_hasdate;
00700         hasStates = tab2->m_hasstate;
00701
00702         userHitOK = true;
00703     }
00704
00705     delete dlg;
00706 #endif // qUnix
00707
00708     if(userHitOK)
00709     {
00710         if(hasDate && !sLastDate.empty())
00711             date = sLastDate;
00712         if(hasRev)
00713             rev = sLastRev;
00714         if(hasUsers)
00715             users = sLastUsers;
00716         if(hasStates && !sLastStates.empty())
00717             states = sLastStates;
00718
00719         gCvsPrefs.save();
00720     }
00721
00722     return userHitOK;
00723 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/LogDlg.h Source File

common/LogDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * LogDlg.h : the cvs log dialog
00023  */
00024
00025 #if !defined(AFX_LOGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_LOGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 #include "CPStr.h"
00033
00034 bool CompatGetLog(bool & noRecurs, bool & defBranch, CPStr & date,
00035     bool & headerOnly, bool & noTags, bool & onlyRCSfile, bool & hasRev,
00036     CPStr & rev, CPStr & states, bool & hasUser, CPStr & users,
00037     bool outGraph = false);
00038     // get the log options...
00039
00040 #ifdef WIN32
00041 class CLogMain : public CPropertyPage
00042 {
00043     DECLARE_DYNCREATE(CLogMain)
00044
00045 // Construction
00046 public:
00047     CLogMain();
00048     ~CLogMain();
00049
00050 // Dialog Data
00051     //{{AFX_DATA(CLogMain)
00052     enum { IDD = IDD_LOG_MAIN };
00053     BOOL    m_defbranch;
00054     BOOL    m_norecurs;
00055     BOOL    m_notags;
00056     BOOL    m_nousers;
00057     BOOL    m_onlyrcs;
00058     //}}AFX_DATA
00059
00060
00061 // Overrides
00062     // ClassWizard generate virtual function overrides
00063     //{{AFX_VIRTUAL(CLogMain)
00064     protected:
00065     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00066     //}}AFX_VIRTUAL
00067
00068 // Implementation
00069 protected:
00070     // Generated message map functions
00071     //{{AFX_MSG(CLogMain)
00072         // NOTE: the ClassWizard will add member functions here
00073     //}}AFX_MSG
00074     DECLARE_MESSAGE_MAP()
00075
00076 };
00077
00078 class CLogFilters : public CPropertyPage
00079 {
00080     DECLARE_DYNCREATE(CLogFilters)
00081
00082 // Construction
00083 public:
00084     CLogFilters(const char * sLastDate, const char * sLastRev,
00085         const char * sLastUsers, const char * sLastStates);
00086     CLogFilters();
00087     ~CLogFilters();
00088
00089 // Dialog Data
00090     //{{AFX_DATA(CLogFilters)
00091     enum { IDD = IDD_LOG_FILTERS };
00092     CComboBox   m_userdef;
00093     CComboBox   m_statedef;
00094     CComboBox   m_revdef;
00095     CComboBox   m_datedef;
00096     CString m_date;
00097     CString m_rev;
00098     CString m_state;
00099     CString m_user;
00100     BOOL    m_hasdate;
00101     BOOL    m_hasrev;
00102     BOOL    m_hasstate;
00103     BOOL    m_hasuser;
00104     //}}AFX_DATA
00105
00106
00107 // Overrides
00108     // ClassWizard generate virtual function overrides
00109     //{{AFX_VIRTUAL(CLogFilters)
00110     protected:
00111     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00112     //}}AFX_VIRTUAL
00113
00114 // Implementation
00115 protected:
00116     // Generated message map functions
00117     //{{AFX_MSG(CLogFilters)
00118     afx_msg void OnDate();
00119     afx_msg void OnRev();
00120     afx_msg void OnState();
00121     afx_msg void OnUser();
00122     //}}AFX_MSG
00123     DECLARE_MESSAGE_MAP()
00124
00125 };
00126 //{{AFX_INSERT_LOCATION}}
00127 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00128 #endif /* WIN32 */
00129
00130 #endif // !defined(AFX_LOGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/LogParse.cpp Source File

common/LogParse.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * LogParse.cpp : parse the cvs log output
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include <errno.h>
00028 #include <stdio.h>
00029
00030 #ifdef HAVE_UNISTD_H
00031 #include <unistd.h>
00032 #endif
00033
00034 #ifdef WIN32
00035 #   include "wincvs.h"
00036 #   include "GraphDoc.h"
00037 #endif /* WIN32 */
00038
00039 #ifdef macintosh
00040 #   include <unistd.h>
00041 #   include "MacCvsApp.h"
00042 #   include "CTreeView.h"
00043 #endif /* macintosh */
00044
00045 #if qUnix
00046 #   include "UCvsDialogs.h"
00047 #   include "UCvsGraph.h"
00048 #endif
00049
00050 #include "LogParse.h"
00051 #include "CvsArgs.h"
00052 #include "CvsLog.h"
00053 #include "AppGlue.h"
00054 #include "AppConsole.h"
00055 #include "CPStr.h"
00056 #include "getline.h"
00057
00058 #ifdef WIN32
00059 #   ifdef _DEBUG
00060 #   define new DEBUG_NEW
00061 #   undef THIS_FILE
00062     static char THIS_FILE[] = __FILE__;
00063 #   endif
00064 #endif /* WIN32 */
00065
00066 static void print(CColorConsole & out, const CRevFile & rev)
00067 {
00068     out << kBlue << "----------------------------" << kNormal << kNL;
00069     out << "Revision : " << kBold << kRed << rev.RevNum().c_str() << kNormal << kNL;
00070     if(!rev.Locker().empty())
00071         out << "Locked by : '" << kBold << rev.Locker() << kNormal << '\'' << kNL;
00072     out << "Date : " << kBold <<
00073         (rev.RevTime().tm_year + 1900) << '/' <<
00074         rev.RevTime().tm_mon << '/' <<
00075         rev.RevTime().tm_mday << ' ' <<
00076         rev.RevTime().tm_hour << ':' <<
00077         rev.RevTime().tm_min << ':' <<
00078         rev.RevTime().tm_sec << kNormal << kNL;
00079     out << "Author : '" << kBold << rev.Author() << kNormal << '\'' << kNL;
00080     out << "State : '" << kBold << rev.State() << kNormal << '\'' << kNL;
00081     out << "Lines : +" << kBold << rev.ChgPos() << ' ' << rev.ChgNeg() << kNormal << kNL;
00082
00083     if(!rev.BranchesList().empty())
00084     {
00085         out << "Branches :" << kNL;
00086         std::vector<CRevNumber>::const_iterator s;
00087         for(s = rev.BranchesList().begin(); s != rev.BranchesList().end(); ++s)
00088         {
00089             const CRevNumber & branch = *s;
00090             out << '\t' << kBold << branch.c_str() << kNormal << kNL;
00091         }
00092     }
00093
00094     out << "Description :" << kNL << kBrown << rev.DescLog() << kNormal << kNL;
00095 }
00096
00097 static void print(CColorConsole & out, const CRcsFile & rcs, bool recurse = true)
00098 {
00099     out << "Rcs file : '" << kRed << rcs.RcsFile() << kNormal << '\'' << kNL;
00100     out << "Working file : '" << kBold << rcs.WorkingFile() << kNormal << '\'' << kNL;
00101     out << "Head revision : " << kBold << kRed << rcs.HeadRev().c_str() << kNormal << kNL;
00102     out << "Branch revision : " << kBold << rcs.BranchRev().c_str() << kNormal << kNL;
00103
00104     out << "Locks :" << kBold << (rcs.LockStrict() ? " strict" : "") << kNormal << kNL;
00105     std::vector<CRevNumber>::const_iterator s;
00106     for(s = rcs.LocksList().begin(); s != rcs.LocksList().end(); ++s)
00107     {
00108         const CRevNumber & lock = *s;
00109         out << '\t' << kBold << lock.c_str() << " : '" << lock.Tag() << '\'' << kNormal << kNL;
00110     }
00111
00112     out << "Access :" << kNL;
00113     std::vector<CLogStr>::const_iterator a;
00114     for(a = rcs.AccessList().begin(); a != rcs.AccessList().end(); ++a)
00115     {
00116         out << "\t'" << kBold << *a << kNormal << '\'' << kNL;
00117     }
00118
00119     if(!rcs.SymbolicList().empty())
00120     {
00121         out << "Symbolic names :" << kNL;
00122         std::vector<CRevNumber>::const_iterator n;
00123         for(n = rcs.SymbolicList().begin(); n != rcs.SymbolicList().end(); ++n)
00124         {
00125             const CRevNumber & symb = *n;
00126             out << '\t' << kBold << symb.c_str() << " : '" << symb.Tag() << '\'' << kNormal << kNL;
00127         }
00128     }
00129
00130     out << "Keyword substitution : '" << kBold << rcs.KeywordSubst() << kNormal << '\'' << kNL;
00131     out << "Total revisions : " << kBold << rcs.TotRevisions() << kNormal << kNL;
00132     out << "Selected revisions : " << kBold << rcs.SelRevisions() << kNormal << kNL;
00133     out << "Description :" << kNL << kBrown << rcs.DescLog() << kNormal << kNL;
00134
00135     std::vector<CRevFile>::const_iterator i;
00136     if(recurse) for(i = rcs.AllRevs().begin(); i != rcs.AllRevs().end(); ++i)
00137     {
00138         print(out, *i);
00139     }
00140
00141     out << kGreen << "===============================================" << kNormal << kNL;
00142 }
00143
00144 static void print(CColorConsole & out, const CLogNode * node, CStr & offset)
00145 {
00146     out << offset;
00147     switch(node->GetType())
00148     {
00149         case kNodeHeader :
00150         {
00151             CLogNodeHeader *header = (CLogNodeHeader *)node;
00152             out << offset << "Rcs file : '" << kRed << (**header).RcsFile() << kNormal << '\'' << kNL;
00153             break;
00154         }
00155         case kNodeBranch :
00156             break;
00157         case kNodeRev :
00158         {
00159             CLogNodeRev *rev = (CLogNodeRev *)node;
00160             out << offset << kBold << (**rev).RevNum().c_str() << kNormal << kNL;
00161             break;
00162         }
00163         case kNodeTag :
00164             break;
00165     }
00166
00167     CStr newOffset;
00168     newOffset = offset;
00169     newOffset << "    ";
00170     std::vector<CLogNode *>::const_iterator i;
00171     for(i = node->Childs().begin(); i != node->Childs().end(); ++i)
00172     {
00173         print(out, *i, newOffset);
00174         newOffset << ' ';
00175     }
00176
00177     if(node->Next() != 0L)
00178     {
00179         print(out, node->Next(), offset);
00180     }
00181 }
00182
00183 void CvsLogOutput(CColorConsole & out, CLogNode *node)
00184 {
00185     switch(node->GetType())
00186     {
00187         case kNodeHeader :
00188         {
00189             CRcsFile & rcs = **(CLogNodeHeader *)node;
00190             print(out, rcs, false);
00191             break;
00192         }
00193         case kNodeBranch :
00194             break;
00195         case kNodeRev :
00196         {
00197             CRevFile & rev = **(CLogNodeRev *)node;
00198             print(out, rev);
00199             break;
00200         }
00201         case kNodeTag :
00202             break;
00203     }
00204 }
00205
00206 void CvsLogParse(const char *dir, const CvsArgs & args, bool outGraph, void *defWnd)
00207 {
00208     // make a stream of the cvs log output
00209     CStr tmpFile;
00210     FILE *output;
00211     output = launchCVS(dir, args, tmpFile);
00212     if(output == 0L)
00213         return;
00214
00215     // parse
00216     std::vector<CRcsFile> & allRcs = CvsLogParse(output);
00217
00218     // maybe something went wrong or may be the user
00219     // asked to print only the RCS names, so print the
00220     // output directly whithout parsing../
00221     if(allRcs.empty())
00222     {
00223         char *line = 0L;
00224         size_t line_chars_allocated = 0;
00225         int line_length;
00226         fseek(output, SEEK_SET, 0);
00227         while ((line_length = getline (&line, &line_chars_allocated, output)) > 0)
00228         {
00229             cvs_outstr(line, line_length);
00230             cvs_outstr("\n", 1);
00231         }
00232
00233         if (line_length < 0 && !feof (output))
00234             cvs_err("Cannot read output file (error %d)\n", errno);
00235
00236         if(line != 0L)
00237             free (line);
00238     }
00239
00240     // close the temp file
00241     fclose(output);
00242     if(unlink(tmpFile) != 0)
00243     {
00244         cvs_err("Impossible to delete the file '%s' (error %d)",
00245             (const char *)tmpFile, errno);
00246     }
00247
00248     if(allRcs.empty())
00249         return;
00250
00251     // output the result
00252     CColorConsole out;
00253     std::vector<CRcsFile>::iterator i;
00254     for(i = allRcs.begin(); i != allRcs.end(); ++i)
00255     {
00256         CRcsFile & rcs = *i;
00257         if(!outGraph)
00258             print(out, rcs);
00259         else
00260         {
00261             CLogNode *node = CvsLogGraph(rcs);
00262             if(node == 0L)
00263             {
00264                 cvs_err("Impossible to create a graph for %s\n",
00265                     (const char *)rcs.WorkingFile());
00266             }
00267
00268 #ifdef WIN32
00269             CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00270             CGraphDoc *doc;
00271             if(defWnd != 0L)
00272                 doc = (CGraphDoc *)defWnd;
00273             else
00274                 doc = (CGraphDoc*)app->gLogGraph->OpenDocumentFile(NULL);
00275             doc->SetNode(node, dir);
00276 #elif qMacCvsPP
00277             if(defWnd != 0L)
00278                 ((CTreeView *)defWnd)->SetNode(node, dir);
00279             else
00280                 CMacCvsApp::app->NewLogTree(node, dir);
00281 #elif qUnix
00282             UCvsGraph * graph = new UCvsGraph(node, dir);
00283             void *win = UCreate_GraphWindow();
00284             UEventSendMessage(graph->GetWidID(), EV_INIT_WIDGET, kUMainWidget, win);
00285             UEventSendMessage(graph->GetWidID(), EV_SHOW_WIDGET, UMAKEINT(kUMainWidget, 1), 0L);
00286 #else
00287             CStr offset;
00288             print(out, node, offset);
00289             delete node;
00290 #endif
00291         }
00292     }
00293
00294     // reset the parser
00295     CvsLogReset();
00296 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/LogParse.h Source File

common/LogParse.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * LogParse.h : parse the cvs log output
00023  */
00024
00025 #if !defined(AFX_LOGPARSE_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_LOGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #   pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 class CvsArgs;
00033 class CLogNode;
00034 class CColorConsole;
00035
00036 void CvsLogParse(const char *dir, const CvsArgs & args, bool outGraph = false,
00037         void *defWnd = 0L);
00038     // launch a cvs log command, parse the output, output a graph
00039     // or a syntax colored of the cvs log output
00040
00041 void CvsLogOutput(CColorConsole & out, CLogNode *node);
00042     // print a syntax colored of the cvs log node
00043
00044 #endif // !defined(AFX_LOGPARSE_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MacBinEncoding.cpp Source File

common/MacBinEncoding.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 /*
00022  * MacBinEncoding.cpp --- class to store the mac binary encoding mappings
00023  */
00024
00025 #include <stdlib.h>
00026
00027 #include <UModalDialogs.h>
00028 #include <LTableMultiGeometry.h>
00029 #include <LOutlineKeySelector.h>
00030 #include <LTableSingleSelector.h>
00031 #include <LOutlineRowSelector.h>
00032 #include <UAttachments.h>
00033 #include <UGAColorRamp.h>
00034 #include <LEditText.h>
00035
00036 #include "MacCvsConstant.h"
00037 #include "MacBinEncoding.h"
00038
00039 MacBinMaps *CMacBinTable::gCurMacBinMap = 0L;
00040
00041 CMacBinTable::CMacBinTable(LStream *inStream) : LOutlineTable(inStream)
00042 {
00043     // set the table geometry
00044     LTableMultiGeometry *geom = NEW LTableMultiGeometry(this, 50, 20);
00045     ThrowIfNil_(geom);
00046     SetTableGeometry(geom);
00047
00048     // set the table selector
00049     SetTableSelector(NEW LTableSingleSelector( this )/*LOutlineRowSelector*/ );
00050
00051     // and note that we don't set the table storage....
00052
00053     // most of the table classes not only maintain the graphical
00054     // representation of your data but also the data itself. But
00055     // LOutlineTable doesn't really do this...it mostly handles
00056     // graphical representation... you need to handle your data
00057     // maintenance elsewhere by yourself.
00058
00059     // insert a couple columns (name and size)
00060     InsertCols( 3, 0, nil, nil, false );
00061     geom->SetColWidth(60, 1, 1);
00062     geom->SetColWidth(237, 2, 2);
00063     geom->SetColWidth(120, 3, 3);
00064
00065     // Set up keyboard selection and scrolling.
00066     AddAttachment(NEW LOutlineKeySelector(this, msg_AnyMessage));
00067     AddAttachment(NEW LKeyScrollAttachment(this));
00068
00069     // Try to become default commander in the window.
00070     if (mSuperCommander != nil)
00071         mSuperCommander->SetLatentSub(this);
00072 }
00073
00074 CMacBinTable::~CMacBinTable()
00075 {
00076 }
00077
00078 void CMacBinTable::FinishCreateSelf()
00079 {
00080     // insert the root level of the disk into the table
00081     CMacBinItem *theItem = nil;
00082     CMacBinItem *lastItem = nil;
00083
00084     const MACBINMAPENTRIES * entries = gCurMacBinMap->Entries();
00085
00086     if(entries != 0L) for(int i = 0; i < entries->numMaps; i++)
00087     {
00088         // Store this information in the list view
00089         theItem = NEW CMacBinItem(entries->maps[i]);
00090         ThrowIfNil_(theItem);
00091
00092         // and insert it at the end of the table
00093         InsertItem( theItem, nil, lastItem );
00094         lastItem = theItem;
00095     }
00096 }
00097
00098 CMacBinItem::CMacBinItem(const MACBINMAP & map) :fMap(map)
00099 {
00100 }
00101
00102 CMacBinItem::~CMacBinItem()
00103 {
00104 }
00105
00106 // this is the routine called to know what to draw within the
00107 // table cell. See the comments in LOutlineItem.cp for more info.
00108 void
00109 CMacBinItem::GetDrawContentsSelf(
00110     const STableCell&       inCell,
00111     SOutlineDrawContents&   ioDrawContents)
00112 {
00113     CPStr desc;
00114
00115     switch (inCell.col)
00116     {
00117     case 1:
00118         ioDrawContents.outShowSelection = true;
00119         ioDrawContents.outHasIcon = false;
00120         //ioDrawContents.outIconSuite = ;
00121         ioDrawContents.outTextTraits.style = bold;
00122
00123         unsigned char *ptr = ioDrawContents.outTextString;
00124         *ptr++ = 4;
00125         *ptr++ = ((unsigned char *)&fMap.sig)[0];
00126         *ptr++ = ((unsigned char *)&fMap.sig)[1];
00127         *ptr++ = ((unsigned char *)&fMap.sig)[2];
00128         *ptr++ = ((unsigned char *)&fMap.sig)[3];
00129         break;
00130
00131     case 2:
00132         ioDrawContents.outShowSelection = true;
00133         ioDrawContents.outTextTraits.style = 0;
00134         c2pstrcpy(ioDrawContents.outTextString, fMap.desc);
00135         break;
00136     case 3:
00137         ioDrawContents.outShowSelection = true;
00138         ioDrawContents.outTextTraits.style = 0;
00139         if(fMap.plainBin)
00140         {
00141             ioDrawContents.outTextTraits.style = bold;
00142             LString::CopyPStr("\pPlain binary", ioDrawContents.outTextString);
00143         }
00144         else if(fMap.useDefault)
00145         {
00146             LString::CopyPStr("\pDefault encoding", ioDrawContents.outTextString);
00147         }
00148         else if(fMap.encod == MAC_HQX)
00149         {
00150             ioDrawContents.outTextTraits.style = bold;
00151             LString::CopyPStr("\pHQX encoding", ioDrawContents.outTextString);
00152         }
00153         else
00154         {
00155             ioDrawContents.outTextTraits.style = bold;
00156             LString::CopyPStr("\pAppleSingle encoding", ioDrawContents.outTextString);
00157         }
00158         break;
00159     }
00160 }
00161
00162 // just to be cute, we'll draw an adornment (again, see the LOutlineItem.cp
00163 // comments for more information). We'll draw a groovy gray background
00164 void CMacBinItem::DrawRowAdornments(const Rect & inLocalRowRect)
00165 {
00166     ShadeRow(UGAColorRamp::GetColor(0), inLocalRowRect);
00167 }
00168
00169 bool CMacBinItem::EditCell(void)
00170 {
00171     StDialogHandler theHandler(dlg_MacBinEntry, LCommander::GetTopCommander());
00172     LWindow *theDialog = theHandler.GetDialog();
00173     ThrowIfNil_(theDialog);
00174
00175     LEditText *typ = dynamic_cast<LEditText*>
00176         (theDialog->FindPaneByID(item_MacBinType));
00177     LEditText *desc = dynamic_cast<LEditText*>
00178         (theDialog->FindPaneByID(item_MacBinDesc));
00179
00180     typ->SetText((Ptr)&fMap.sig, 4);
00181     desc->SetText((Ptr)fMap.desc, strlen(fMap.desc));
00182
00183     OSType oldsig = fMap.sig;
00184
00185     if(fMap.plainBin)
00186         theDialog->SetValueForPaneID (item_MacBinPlain, Button_On);
00187     else if(fMap.useDefault)
00188         theDialog->SetValueForPaneID (item_MacBinDefault, Button_On);
00189     else if(fMap.encod == MAC_HQX)
00190         theDialog->SetValueForPaneID (item_MacBinHQX, Button_On);
00191     else
00192         theDialog->SetValueForPaneID (item_MacBinAS, Button_On);
00193
00194     theDialog->Show();
00195     MessageT hitMessage;
00196     while (true)
00197     {       // Let DialogHandler process events
00198         hitMessage = theHandler.DoDialog();
00199
00200         if (hitMessage == msg_OK)
00201         {
00202             char buf[255];
00203             Size len;
00204             typ->GetText(buf, 254, &len);
00205             if(len != 4 || ((OSType *)buf)[0] == '????' || buf[0] == ';' || buf[1] == ';' ||
00206                 buf[2] == ';' || buf[3] == ';')
00207             {
00208                 SysBeep(10);
00209                 continue;
00210             }
00211
00212         }
00213
00214         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00215             break;
00216     }
00217     theDialog->Hide();
00218
00219     if(hitMessage == msg_OK)
00220     {
00221         char buf[255];
00222         Size len;
00223
00224         typ->GetText(buf, 254, &len);
00225         if(len == 4)
00226         {
00227             ((char *)&fMap.sig)[0] = buf[0];
00228             ((char *)&fMap.sig)[1] = buf[1];
00229             ((char *)&fMap.sig)[2] = buf[2];
00230             ((char *)&fMap.sig)[3] = buf[3];
00231         }
00232         desc->GetText(buf, 254, &len);
00233         buf[len] = '\0';
00234         strncpy(fMap.desc, buf, MAX_MACBIN_DESC);
00235
00236         fMap.useDefault = true;
00237         fMap.plainBin = false;
00238
00239         if(theDialog->GetValueForPaneID (item_MacBinPlain) == Button_On)
00240         {
00241             fMap.plainBin = true;
00242         }
00243         else if(theDialog->GetValueForPaneID (item_MacBinDefault) == Button_On)
00244         {
00245         }
00246         else if(theDialog->GetValueForPaneID (item_MacBinHQX) == Button_On)
00247         {
00248             fMap.useDefault = false;
00249             fMap.encod = MAC_HQX;
00250         }
00251         else
00252         {
00253             fMap.useDefault = false;
00254             fMap.encod = MAC_APPSINGLE;
00255         }
00256
00257         CMacBinTable *list = dynamic_cast<CMacBinTable*>(mOutlineTable);
00258         if(list != 0L)
00259         {
00260             list->GetCurrentMap()->RemoveEntry(oldsig);
00261             list->GetCurrentMap()->AddEntry(fMap.sig, fMap.desc, fMap.encod, fMap.plainBin, fMap.useDefault);
00262         }
00263         return true;
00264     }
00265     return false;
00266 }
00267
00268 void CMacBinItem::RemoveCell(void)
00269 {
00270     CMacBinTable *list = dynamic_cast<CMacBinTable*>(mOutlineTable);
00271     if(list != 0L)
00272     {
00273         list->GetCurrentMap()->RemoveEntry(fMap.sig);
00274     }
00275 }
00276
00277 void CMacBinItem::DoubleClick(
00278     const STableCell&           /* inCell */,
00279     const SMouseDownEvent&      /* inMouseDown */,
00280     const SOutlineDrawContents& /* inDrawContents */,
00281     Boolean                     /* inHitText */)
00282 {
00283     EditCell();
00284 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MacBinEncoding.h Source File

common/MacBinEncoding.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 /*
00022  * MacBinEncoding.h --- class to store the mac binary encoding mappings
00023  */
00024
00025 #ifndef MACBINENCODING_H
00026 #define MACBINENCODING_H
00027
00028 #include <LOutlineTable.h>
00029 #include <LCommander.h>
00030 #include <LOutlineItem.h>
00031 #include <LString.h>
00032
00033 #include "MacBinMaps.h"
00034
00035 class CMacBinTable : public LOutlineTable, public LCommander
00036 {
00037 public:
00038     enum { class_ID = 'MBTA' };
00039
00040     CMacBinTable( LStream *inStream );
00041     virtual ~CMacBinTable();
00042
00043     static void SetCurrentMap(MacBinMaps *map) {gCurMacBinMap = map;}
00044     static MacBinMaps * GetCurrentMap(void) {return gCurMacBinMap;}
00045 protected:
00046     static MacBinMaps *gCurMacBinMap;
00047
00048     virtual void FinishCreateSelf();
00049
00050 private:
00051     // defensive programming
00052     CMacBinTable();
00053     CMacBinTable( const CMacBinTable &inOriginal );
00054     CMacBinTable&       operator=( const CMacBinTable &inOriginal );
00055 };
00056
00057 class CMacBinItem : public LOutlineItem
00058 {
00059 public:
00060     CMacBinItem(const MACBINMAP & map);
00061     virtual ~CMacBinItem();
00062
00063     virtual bool EditCell(void);
00064         // return false if user canceled
00065     virtual void RemoveCell(void);
00066
00067 protected:
00068     virtual void GetDrawContentsSelf(const STableCell& inCell, SOutlineDrawContents& ioDrawContents);
00069     virtual void DrawRowAdornments(const Rect& inLocalRowRect);
00070     virtual void DoubleClick(const STableCell& inCell, const SMouseDownEvent& inMouseDown,
00071         const SOutlineDrawContents& inDrawContents, Boolean inHitText);
00072
00073     MACBINMAP fMap;
00074 private:
00075     // defensive programming
00076     CMacBinItem();
00077     CMacBinItem( const CMacBinItem &inOriginal );
00078     CMacBinItem&    operator=( const CMacBinItem &inOriginal );
00079 };
00080
00081 #endif /* MACBINENCODING_H */
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MacBinMaps.cpp Source File

common/MacBinMaps.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 /*
00022  * MacBinMaps.cpp --- class to store the mac binary encoding mappings
00023  */
00024
00025 #include <stdlib.h>
00026 #include <Resources.h>
00027 #include <TextUtils.h>
00028
00029 #include "MacBinMaps.h"
00030 #include "Persistent.h"
00031
00032 static const    OSType      kTypesListResType   = 'bin#';
00033 static const    short       kTypesListResID     = 128;
00034 static const    short       kTypesDescResID     = 128;
00035
00036 class PMacBinMaps : public MacBinMaps, public CPersistent
00037 {
00038 public:
00039     PMacBinMaps(const char *uniqueName) : CPersistent(uniqueName, kNoClass)
00040     {
00041         if(entries != 0L)
00042         {
00043             free(entries);
00044             entries = 0L;
00045         }
00046     }
00047
00048     virtual ~PMacBinMaps()
00049     {
00050     }
00051
00052     virtual unsigned int SizeOf(void) const
00053     {
00054         if(entries == 0L)
00055             return 0;
00056         return sizeof(MACBINMAPENTRIES) + (entries->numMaps - 1) * sizeof(MACBINMAP);
00057     }
00058
00059     virtual const void *GetData(void) const
00060     {
00061         return entries;
00062     }
00063     virtual void SetData(const void *ptr, unsigned int size)
00064     {
00065         if(entries != 0L)
00066         {
00067             free(entries);
00068             entries = 0L;
00069         }
00070
00071         if(size < sizeof(int))
00072             return;
00073         MACBINMAPENTRIES *newEntries = (MACBINMAPENTRIES *)ptr;
00074         if((sizeof(MACBINMAPENTRIES) + (newEntries->numMaps - 1) * sizeof(MACBINMAP)) != size)
00075             return;
00076
00077         entries = (MACBINMAPENTRIES *)malloc(size);
00078         if(entries == 0L)
00079             return;
00080
00081         memcpy(entries, ptr, size);
00082     }
00083 } gAllBinMaps("P_MacBinMaps");
00084
00085 MacBinMaps::MacBinMaps()
00086 {
00087     Reset();
00088 }
00089
00090 MacBinMaps::~MacBinMaps()
00091 {
00092     if(entries != 0L)
00093         free(entries);
00094 }
00095
00096 void MacBinMaps::Reset(void)
00097 {
00098     entries = (MACBINMAPENTRIES *)malloc(sizeof(int));
00099     if(entries == 0L)
00100         return;
00101     entries->numMaps = 0;
00102 }
00103
00104 const char *MacBinMaps::GetEnvPlainTypes(void)
00105 {
00106     static CStr result;
00107     result = "";
00108     const MACBINMAPENTRIES * allEntries = gAllBinMaps.Entries();
00109     if(allEntries == 0L)
00110         return 0L;
00111
00112     int i;
00113     for(i = 0; i < allEntries->numMaps; i++)
00114     {
00115         const MACBINMAP & curmap = allEntries->maps[i];
00116         if(curmap.plainBin)
00117         {
00118             result << ((char *)&curmap.sig)[0];
00119             result << ((char *)&curmap.sig)[1];
00120             result << ((char *)&curmap.sig)[2];
00121             result << ((char *)&curmap.sig)[3];
00122             result << ';';
00123         }
00124     }
00125     return result;
00126 }
00127
00128 const char *MacBinMaps::GetEnvTypes(MACENCODING type)
00129 {
00130     static CStr result;
00131     result = "";
00132     const MACBINMAPENTRIES * allEntries = gAllBinMaps.Entries();
00133     if(allEntries == 0L)
00134         return 0L;
00135
00136     int i;
00137     for(i = 0; i < allEntries->numMaps; i++)
00138     {
00139         const MACBINMAP & curmap = allEntries->maps[i];
00140         if(!curmap.plainBin && !curmap.useDefault && curmap.encod == type)
00141         {
00142             result << ((char *)&curmap.sig)[0];
00143             result << ((char *)&curmap.sig)[1];
00144             result << ((char *)&curmap.sig)[2];
00145             result << ((char *)&curmap.sig)[3];
00146             result << ';';
00147         }
00148     }
00149     return result;
00150 }
00151
00152 void MacBinMaps::LoadDefaults(void)
00153 {
00154     if(gAllBinMaps.SizeOf() == 0L)
00155     {
00156         short index = 1;
00157
00158         // take defaults from the '#bin' resource
00159         Handle  typesHandle = Get1Resource (kTypesListResType, kTypesListResID);
00160         if (typesHandle == nil)
00161             return;
00162
00163         HLock(typesHandle);
00164         Ptr typesPtr = *typesHandle;
00165
00166         short       typesCount = *(short*)typesPtr;
00167         typesPtr += (2 * sizeof(short)) / sizeof(char); // count + align
00168         OSType*     walker = (OSType *)typesPtr;
00169
00170         while (typesCount-- > 0)
00171         {
00172             Str255 theString;
00173             char theCString[256];
00174             theString[0] = '\0';
00175             GetIndString(theString, kTypesDescResID, index++);
00176             p2cstrcpy(theCString, theString);
00177
00178             AddEntry(*walker++, theCString[0] != '\0' ? theCString : "Default type",
00179                 MAC_HQX, true, true);
00180         }
00181         HUnlock(typesHandle);
00182     }
00183     else
00184     {
00185         *this = gAllBinMaps;
00186     }
00187 }
00188
00189 void MacBinMaps::SaveDefaults(void)
00190 {
00191     *(MacBinMaps *)&gAllBinMaps = *this;
00192 }
00193
00194 const MACBINMAP *MacBinMaps::AddEntry(OSType sig, const char *desc, MACENCODING encod, bool plainBin, bool useDefault)
00195 {
00196     if(entries == 0L)
00197         return 0L;
00198
00199     int i;
00200     for(i = 0; i < entries->numMaps; i++)
00201     {
00202         if(entries->maps[i].sig == sig)
00203             break;
00204     }
00205
00206     if(i != entries->numMaps)
00207     {
00208         MACBINMAP & curmap = entries->maps[i];
00209         curmap.sig = sig;
00210         curmap.desc[0] = '\0';
00211         if(desc != 0L)
00212             strncpy(curmap.desc, desc, MAX_MACBIN_DESC);
00213         curmap.encod = encod;
00214         curmap.plainBin = plainBin;
00215         curmap.useDefault = useDefault;
00216         return &curmap;
00217     }
00218
00219     entries = (MACBINMAPENTRIES *)realloc(entries, sizeof(MACBINMAPENTRIES) + entries->numMaps * sizeof(MACBINMAP));
00220     if(entries == 0L)
00221         return 0L;
00222
00223     MACBINMAP & newmap = entries->maps[entries->numMaps++];
00224     newmap.sig = sig;
00225     newmap.desc[0] = '\0';
00226     if(desc != 0L)
00227         strncpy(newmap.desc, desc, MAX_MACBIN_DESC);
00228     newmap.encod = encod;
00229     newmap.plainBin = plainBin;
00230     newmap.useDefault = useDefault;
00231     return &newmap;
00232 }
00233
00234 void MacBinMaps::RemoveEntry(OSType sig)
00235 {
00236     if(entries == 0L)
00237         return;
00238
00239     int i;
00240     for(i = 0; i < entries->numMaps; i++)
00241     {
00242         if(entries->maps[i].sig == sig)
00243             break;
00244     }
00245
00246     if(i == entries->numMaps)
00247         return;
00248
00249     memmove(&entries->maps[i], &entries->maps[i + 1],
00250         (entries->numMaps - i - 1) * sizeof(MACBINMAP));
00251     entries->numMaps--;
00252     entries = (MACBINMAPENTRIES *)realloc(entries, sizeof(MACBINMAPENTRIES) + (entries->numMaps - 1) * sizeof(MACBINMAP));
00253 }
00254
00255 MacBinMaps & MacBinMaps::operator=(const MacBinMaps & otherMap)
00256 {
00257     if(entries != 0L)
00258         free(entries);
00259     Reset();
00260     if(entries == 0L)
00261         return *this;
00262
00263     const MACBINMAPENTRIES *theseEntries = otherMap.Entries();
00264     if(theseEntries != 0L) for(int i = 0; i < theseEntries->numMaps; i++)
00265     {
00266         const MACBINMAP & newmap = theseEntries->maps[i];
00267         AddEntry(newmap.sig, newmap.desc, newmap.encod, newmap.plainBin, newmap.useDefault);
00268     }
00269     return *this;
00270 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MacBinMaps.h Source File

common/MacBinMaps.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 /*
00022  * MacBinMaps.h --- class to store the mac binary encoding mappings
00023  */
00024
00025 #ifndef MACBINMAPS_H
00026 #define MACBINMAPS_H
00027
00028 #include "CvsPrefs.h"
00029
00030 typedef struct
00031 {
00032 #   define MAX_MACBIN_DESC 63
00033     OSType sig;
00034     char desc[MAX_MACBIN_DESC + 1];
00035     MACENCODING encod;
00036     bool plainBin;
00037     bool useDefault;
00038 } MACBINMAP;
00039
00040 typedef struct
00041 {
00042     int numMaps;
00043     MACBINMAP maps[1];
00044 } MACBINMAPENTRIES;
00045
00046 class MacBinMaps
00047 {
00048 public:
00049     MacBinMaps();
00050     ~MacBinMaps();
00051
00052     void LoadDefaults(void);
00053         // fill with the persistent defaults
00054
00055     void SaveDefaults(void);
00056         // store as defaults
00057
00058     const MACBINMAP *AddEntry(OSType sig, const char *desc, MACENCODING encod, bool plainBin, bool useDefault);
00059         // an an entry
00060
00061     void RemoveEntry(OSType sig);
00062         // remove an entry
00063
00064     MacBinMaps & operator=(const MacBinMaps & otherMap);
00065         // replace by this map
00066
00067     inline const MACBINMAPENTRIES * Entries(void) const {return entries;}
00068         // return the entries
00069
00070     static const char *GetEnvPlainTypes(void);
00071         // return all the plain binaries types with a semi-colon
00072         // between each ones.
00073
00074     static const char *GetEnvTypes(MACENCODING type);
00075         // return all the plain binaries types with a semi-colon
00076         // between each ones.
00077 protected:
00078     void Reset(void);
00079
00080     MACBINMAPENTRIES *entries;
00081 };
00082
00083 #endif /* MACBINMAPS_H */
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MacMisc.cpp Source File

common/MacMisc.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * MacMisc.cpp --- misc. utilities for mac
00023  */
00024
00025 #include "MacMisc.h"
00026
00027 Handle
00028 GetDItemHdl(DialogPtr dlg, SInt16 Id)
00029 {
00030     SInt16  type;
00031     Handle  item;
00032     Rect    box;
00033
00034     GetDialogItem(dlg, Id, &type, &item, &box);
00035     return item;
00036 }
00037
00038 ControlHandle
00039 GetDItemCtrlHdl(DialogPtr dlg, SInt16 Id)
00040 {
00041     SInt16  type;
00042     Handle  item;
00043     Rect    box;
00044
00045     GetDialogItem(dlg, Id, &type, &item, &box);
00046     return (ControlHandle)item;
00047 }
00048
00049 SInt16 GetDItemMenuSel(DialogPtr dlg, SInt16 Id)
00050 {
00051     ControlHandle ctrl = GetDItemCtrlHdl(dlg, Id);
00052     return ctrl != 0L ? GetControlValue(ctrl) : 0;
00053 }
00054
00055 void SetDItemMenuSel(DialogPtr dlg, SInt16 Id, SInt16 sel)
00056 {
00057     ControlHandle ctrl = GetDItemCtrlHdl(dlg, Id);
00058     if(ctrl != 0L)
00059         SetControlValue(ctrl, sel);
00060 }
00061
00062 pascal  OSErr   FSMakeFSSpecCompat(short vRefNum,
00063                                    long dirID,
00064                                    ConstStr255Param fileName,
00065                                    FSSpec & spec)
00066 {
00067     OSErr   result;
00068
00069     /* Let the file system create the FSSpec if it can since it does the job */
00070     /* much more efficiently than I can. */
00071     result = FSMakeFSSpec(vRefNum, dirID, fileName, &spec);
00072     /* Fix a bug in Macintosh PC Exchange's MakeFSSpec code where 0 is */
00073     /* returned in the parID field when making an FSSpec to the volume's */
00074     /* root directory by passing a full pathname in MakeFSSpec's */
00075     /* fileName parameter. */
00076     if ( (result == noErr) && (spec.parID == 0) )
00077         spec.parID = fsRtParID;
00078
00079     return ( result );
00080 }
00081
00082 int stricmp(const char *str1, const char *str2)
00083 {
00084     unsigned char c1, c2;
00085
00086     while(1)
00087     {
00088         c1 = (unsigned char)*str1++;
00089         c2 = (unsigned char)*str2++;
00090         if(c1 == '\0' || c2 == '\0') break;
00091
00092         if((c1 < 'A' || c1 > 'Z') && (c1 < 'a' || c1 > 'z'))
00093         {
00094             if(c1 != c2) break;
00095         }
00096         else if((c2 < 'A' || c2 > 'Z') && (c2 < 'a' || c2 > 'z'))
00097             break;
00098         else
00099         {
00100             c1 &= 0xDF;
00101             c2 &= 0xDF;
00102             if(c1 != c2)
00103                 break;
00104         }
00105     }
00106
00107     return c1 == c2 ? 0 : (c1 < c2 ? -1 : 1);
00108 }
00109
00110 int strnicmp(const char *str1, const char *str2, unsigned long n)
00111 {
00112     unsigned char c1 = 0, c2 = 0;
00113
00114     while(n--)
00115     {
00116         c1 = (unsigned char)*str1++;
00117         c2 = (unsigned char)*str2++;
00118         if(c1 == '\0' || c2 == '\0') break;
00119
00120         if((c1 < 'A' || c1 > 'Z') && (c1 < 'a' || c1 > 'z'))
00121         {
00122             if(c1 != c2) break;
00123         }
00124         else if((c2 < 'A' || c2 > 'Z') && (c2 < 'a' || c2 > 'z'))
00125             break;
00126         else
00127         {
00128             c1 &= 0xDF;
00129             c2 &= 0xDF;
00130             if(c1 != c2)
00131                 break;
00132         }
00133     }
00134
00135     return c1 == c2 ? 0 : (c1 < c2 ? -1 : 1);
00136 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MacMisc.h Source File

common/MacMisc.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * MacMisc.cpp --- misc. utilities for mac
00023  */
00024
00025 #ifndef MACMISC_H
00026 #define MACMISC_H
00027
00028 #include <Dialogs.h>
00029
00030 Handle GetDItemHdl(DialogPtr dlg, SInt16 Id);
00031 ControlHandle GetDItemCtrlHdl(DialogPtr dlg, SInt16 Id);
00032 SInt16 GetDItemMenuSel(DialogPtr dlg, SInt16 Id);
00033 void SetDItemMenuSel(DialogPtr dlg, SInt16 Id, SInt16 sel);
00034
00035 pascal  OSErr   FSMakeFSSpecCompat(short vRefNum,
00036                                    long dirID,
00037                                    ConstStr255Param fileName,
00038                                    FSSpec & spec);
00039
00040 extern "C" int stricmp(const char *str1, const char *str2);
00041 extern "C" int strnicmp(const char *str1, const char *str2, unsigned long size);
00042
00043 #endif /* MACMISC_H */
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MacrosSetup.cpp Source File

common/MacrosSetup.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- August 1998
00019  */
00020
00021 /*
00022  * MacrosSetup.cpp --- hook the macros files
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifndef WIN32
00028 #   include <ctype.h>
00029 #endif /* !WIN32 */
00030
00031 #ifdef HAVE_STRING_H
00032 #   include <string.h>
00033 #endif
00034
00035 #ifdef HAVE_STRINGS_H
00036 #   include <strings.h>
00037 #endif
00038
00039 #ifdef HAVE_ERRNO_H
00040 #   include <errno.h>
00041 #endif
00042
00043 #include "MacrosSetup.h"
00044 #include "AppConsole.h"
00045 #include "FileTraversal.h"
00046 #include "getline.h"
00047 #include "CvsArgs.h"
00048
00049 #ifdef macintosh
00050 #   include "MacMisc.h"
00051 #   include <errno.h>
00052 #endif
00053
00054 #ifdef qMacCvsPP
00055 #   include "MacCvsApp.h"
00056 #endif /* qMacCvsPP */
00057
00058 #include "getopt.h"
00059
00060 #ifdef WIN32
00061 #   include "wincvs.h"
00062 #   ifdef _DEBUG
00063 #   define new DEBUG_NEW
00064 #   undef THIS_FILE
00065     static char THIS_FILE[] = __FILE__;
00066 #   endif
00067 #endif /* WIN32 */
00068
00069 CMacroSet gMacrosAdmin;
00070 CMacroSet gMacrosSel;
00071
00072 static void getLoc(CStr & path, const char *subFolder)
00073 {
00074     path = "";
00075 #ifdef WIN32
00076     CWincvsApp* pApp = (CWincvsApp *)AfxGetApp();
00077     pApp->GetAppPath(path);
00078
00079     CString appPath = path;
00080     // first the macro folder may be ./macro
00081     CString test = appPath;
00082     test.TrimRight('\\');
00083     test += "\\";
00084     test += subFolder;
00085
00086     struct stat sb;
00087     if(stat(test, &sb) != -1 && S_ISDIR(sb.st_mode))
00088     {
00089         path = test;
00090         return;
00091     }
00092
00093     CStr uppath, file;
00094     while(SplitPath(appPath, uppath, file) && !uppath.empty())
00095     {
00096         test = uppath;
00097         test.TrimRight('\\');
00098         test += "\\";
00099         test += subFolder;
00100
00101         if(stat(test, &sb) != -1 && S_ISDIR(sb.st_mode))
00102         {
00103             path = test;
00104             return;
00105         }
00106         appPath = uppath;
00107     }
00108     path = test;
00109 #elif defined(qUnix)
00110     struct stat sb;
00111     path = PACKAGE_DATA_DIR;
00112     if(stat(path, &sb) == -1 || !S_ISDIR(sb.st_mode))
00113     {
00114         path = PACKAGE_SOURCE_DIR;
00115         CStr uppath, folder;
00116         SplitPath(path, uppath, folder);
00117         path = uppath;
00118         if(!path.endsWith(kPathDelimiter))
00119             path << kPathDelimiter;
00120         path << subFolder;
00121     }
00122 #elif qMacCvsPP
00123     UStr appPath = CMacCvsApp::GetAppPath();
00124     if(!appPath.endsWith(kPathDelimiter))
00125         appPath << kPathDelimiter;
00126     UStr test = appPath;
00127     test << subFolder;
00128
00129     struct stat sb;
00130     if(stat(test, &sb) != -1 && S_ISDIR(sb.st_mode))
00131     {
00132         path = test;
00133         return;
00134     }
00135
00136     UStr uppath, file;
00137     while(SplitPath(appPath, uppath, file) && !uppath.empty())
00138     {
00139         test = uppath;
00140         if(!test.endsWith(kPathDelimiter))
00141             test << kPathDelimiter;
00142         test << subFolder;
00143
00144         if(stat(test, &sb) != -1 && S_ISDIR(sb.st_mode))
00145         {
00146             path = test;
00147             return;
00148         }
00149         appPath = uppath;
00150     }
00151     path = test;
00152 #else
00153     if(!path.empty() && !path.endsWith(kPathDelimiter))
00154     {
00155         path << kPathDelimiter;
00156     }
00157     path << subFolder;
00158 #endif
00159 }
00160
00161 void MacrosGetLoc(CStr & path)
00162 {
00163     getLoc(path, MACROS_FOLDER);
00164 }
00165
00166 void PythonLibGetLoc(CStr & path)
00167 {
00168     getLoc(path, PYTHONLIB_FOLDER);
00169 }
00170
00171 static void MacrosFlushAll(void)
00172 {
00173     gMacrosAdmin.Flush();
00174     gMacrosSel.Flush();
00175 }
00176
00177 class MacroTraversal : public TraversalReport
00178 {
00179 public:
00180     virtual kTraversal OnError(const char *err, int errcode)
00181     {
00182         cvs_err(err);
00183         cvs_err("\n");
00184         return kTraversalError;
00185     }
00186
00187     virtual kTraversal OnFile(const char *fullpath,
00188         const char *fullname,
00189         const char *name,
00190         const struct stat & dir, const FSSpec * macspec);
00191 };
00192
00193 kTraversal MacroTraversal::OnFile(const char *fullpath,
00194     const char *fullname,
00195     const char *name,
00196     const struct stat & dir, const FSSpec * macspec)
00197 {
00198     if(stricmp(name + strlen(name) - 4, ".tcl"))
00199         return kContinueTraversal;
00200
00201     FILE *fpin = fopen(fullname, "r");
00202     if(fpin == 0L)
00203     {
00204         cvs_err("Impossible to open '%s' (error %d)\n", fullname, errno);
00205         return kContinueTraversal;
00206     }
00207
00208     char *oldline = 0L;
00209     int line_length;
00210     size_t line_chars_allocated = 0;
00211     CvsArgs args(false);
00212     args.add("dummy");
00213
00214     if((line_length = getline (&oldline, &line_chars_allocated, fpin)) > 0 &&
00215         strnicmp(oldline, "#!CVSGUI1.0", strlen("#!CVSGUI1.0")) == 0)
00216     {
00217         char *line = oldline + strlen("#!CVSGUI1.0");
00218
00219         while(*line)
00220         {
00221             int hasQuote = 0;
00222             char *temp;
00223
00224             // Search for the non space char
00225             while(*line && isspace(*line))
00226                 ++line;
00227
00228             // handle the quote
00229             if((*line) == '"')
00230             {
00231                 hasQuote = 1;
00232                 line++;
00233             }
00234             for(temp=line;*line;++line)
00235             {
00236                 if((*line) == '"')
00237                 {
00238                     if(hasQuote)
00239                     {
00240                         hasQuote = 0; /* ok doc */
00241                         break;
00242                     }
00243                 }
00244                 if(isspace(*line) && !hasQuote)
00245                     break;
00246             }
00247             if(hasQuote) /* mismatch quote */
00248                 temp = line;
00249
00250             if(temp != line)
00251             {
00252                 CStr arg;
00253                 arg.set(temp, line - temp);
00254                 args.add(arg);
00255             }
00256         }
00257
00258         static struct option long_options[] =
00259         {
00260             {"admin", no_argument, 0L, 1},
00261             {"selection", no_argument, 0L, 2},
00262             {"name", required_argument, 0L, 3},
00263             {0, 0, 0, 0}
00264         };
00265         bool hasAdmin = false;
00266         bool hasSel = false;
00267         CStr dispname;
00268
00269         optind = 0;
00270         int option_index = 0, c;
00271         while ((c = getopt_long
00272             (args.Argc(), args.Argv(), "+", long_options, &option_index)) != EOF)
00273         {
00274             switch (c)
00275             {
00276             case 1:
00277                 hasAdmin = true;
00278                 break;
00279             case 2:
00280                 hasSel = true;
00281                 break;
00282             case 3:
00283                 dispname = optarg;
00284                 break;
00285             default:
00286                 cvs_err("Warning : unknown option in the file '%s'\n", fullname);
00287                 break;
00288             }
00289         }
00290
00291         if(dispname.empty())
00292         {
00293             dispname = name;
00294         }
00295
00296         if(hasAdmin)
00297         {
00298             gMacrosAdmin.Add(fullname, dispname);
00299         }
00300         else if(hasSel)
00301         {
00302             gMacrosSel.Add(fullname, dispname);
00303         }
00304         else
00305         {
00306             cvs_err("Warning : no option <admin|selection> in the file '%s'\n", fullname);
00307         }
00308     }
00309
00310     free (oldline);
00311
00312     fclose(fpin);
00313
00314     return kContinueTraversal;
00315 }
00316
00317 void MacrosReloadAll(void)
00318 {
00319     MacrosFlushAll();
00320
00321     // get the macro folder
00322     CStr path;
00323     MacrosGetLoc(path);
00324
00325     // traverse the macro folder
00326     MacroTraversal traverse;
00327     FileTraverse(path, traverse);
00328 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MacrosSetup.h Source File

common/MacrosSetup.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- August 1998
00019  */
00020
00021 /*
00022  * MacrosSetup.h --- hook the macros files
00023  */
00024
00025 #ifndef MACROSSETUP_H
00026 #define MACROSSETUP_H
00027
00028 #ifdef _MSC_VER
00029     using namespace std;
00030 #endif
00031
00032 #include <vector>
00033 #include "CPStr.h"
00034
00035 #define MACROS_FOLDER "Macros"
00036 #define PYTHONLIB_FOLDER "PythonLib"
00037
00038 // a macro is a file + a display name
00039 class CMacroEntry
00040 {
00041 public:
00042     CMacroEntry() {}
00043     CMacroEntry(const char *fullname, const char *dispname)
00044     {
00045         path = fullname;
00046         name = dispname;
00047     }
00048     CMacroEntry(const CMacroEntry & anentry)
00049     {
00050         *this = anentry;
00051     }
00052
00053     inline CMacroEntry & operator=(const CMacroEntry & anentry)
00054     {
00055         path = anentry.path;
00056         name = anentry.name;
00057         return *this;
00058     }
00059
00060     inline bool operator<(const CMacroEntry & anentry) const
00061     {
00062         return false;
00063     }
00064
00065     inline bool operator==(const CMacroEntry & anentry) const
00066     {
00067         return path.compare(anentry.path) == 0 && name.compare(anentry.name) == 0;
00068     }
00069
00070     CStr path;
00071     CStr name;
00072 };
00073
00074 // a set of macros + a flag to reload menus
00075 class CMacroSet
00076 {
00077 public:
00078     CMacroSet()
00079     {
00080         invalFlag = true;
00081     }
00082
00083     std::vector<CMacroEntry> entries;
00084     bool invalFlag;
00085
00086     void Flush(void)
00087     {
00088         entries.erase(entries.begin(), entries.end());
00089         invalFlag = true;
00090     }
00091
00092     void Add(const char *fullname, const char *name)
00093     {
00094         entries.push_back(CMacroEntry(fullname, name));
00095     }
00096 };
00097
00098 extern CMacroSet gMacrosAdmin;
00099 extern CMacroSet gMacrosSel;
00100
00101 void MacrosReloadAll(void);
00102     // reload the available macros
00103     // TO_OBSOLETE
00104
00105 void MacrosGetLoc(CStr & path);
00106     // return the macros location
00107
00108 void PythonLibGetLoc(CStr & path);
00109     // return python library root path
00110
00111 #endif /* MACROSSETUP_H */
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MakeSurePathExists.cpp Source File

common/MakeSurePathExists.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * MakeSurePathExists.cpp --- check if the directory exists and prompt to create one if it doesn't
00019  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- January 27, 2001
00020  * Modified :
00021  */
00022
00023 #include "stdafx.h"
00024
00025 #ifdef WIN32
00026 #   include "wincvs.h"
00027 #   include <sys\stat.h>
00028 #   include <direct.h>
00029 #   include <errno.h>
00030 #endif /* WIN32 */
00031
00032 #if qUnix
00033 #endif
00034
00035 #ifdef qMacCvsPP
00036 #endif /* qMacCvsPP */
00037
00038 #include "MakeSurePathExists.h"
00039 #include "FileTraversal.h"
00040
00041 // common interface to check whether the specified path exists,
00042 // if promptForCreation is set to true it will prompt for creation
00043 // return true if the path exists, false if not
00044 bool CompatMakeSurePathExists( const char* path, bool promptForCreation /*= true*/ )
00045 {
00046     bool valid = false;
00047
00048 #ifdef WIN32
00049     TCHAR fn[MAX_PATH];
00050     if (_tfullpath(fn, path, MAX_PATH))
00051     {
00052         struct _tstat dirstat;
00053         if (_tstat(fn, &dirstat) == 0)
00054         {
00055             if (dirstat.st_mode & _S_IFDIR)
00056             {
00057                 valid = true;
00058             }
00059         }
00060         else
00061         {
00062             // not found, ask for permission to create
00063             if( promptForCreation &&
00064                 AfxMessageBox("Folder " +
00065                 CString(path) +
00066                 " not found.\nDo you want to create it?", MB_YESNO) == IDYES )
00067             {
00068                 valid = CreateFolder(fn);
00069             }
00070         }
00071     }
00072 #endif
00073
00074     return valid;
00075 }
00076
00077 //basic rutine to create path leading to the folder
00078 bool CreateFolder(const char* fn)
00079 {
00080 #ifdef WIN32
00081     // remove possible trailing separator
00082     TCHAR folder[MAX_PATH];
00083     _tcscpy(folder, fn);
00084     int len = _tcslen(folder);
00085     if (len > 1)
00086     {
00087         switch (folder[len - 1])
00088         {
00089         case _T('\\'):
00090         case _T('/'):
00091             folder[len - 1] = 0;
00092             break;
00093         }
00094     }
00095
00096     // try to create
00097     if (_tmkdir(folder) == 0)
00098     {
00099         return true;
00100     }
00101
00102     // if path does not exist, create parent folder and then try again
00103     if (errno == ENOENT)
00104     {
00105         TCHAR drive[_MAX_DRIVE];
00106         TCHAR dir[_MAX_PATH];
00107         TCHAR fname[_MAX_PATH];
00108         _tsplitpath(folder, drive, dir, fname, NULL);
00109         if (!*fname)
00110         {
00111             return false;
00112         }
00113         _tmakepath(fname, drive, dir, NULL, NULL);
00114         if (!CreateFolder(fname))
00115         {
00116             return false;
00117         }
00118
00119         return _tmkdir(folder) == 0;
00120     }
00121 #endif
00122     // not possible to create
00123     return false;
00124 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MakeSurePathExists.h Source File

common/MakeSurePathExists.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * MakeSurePathExists.h --- check if the directory exists and prompt to create one if it doesn't
00019  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- January 27, 2001
00020  * Modified :
00021  */
00022
00023 #ifndef __MAKESUREPATHEXISTS_H__
00024 #define __MAKESUREPATHEXISTS_H__
00025
00026 bool CreateFolder(const char* fn);
00027 bool CompatMakeSurePathExists( const char* path, bool promptForCreation = true );
00028
00029 #endif //__MAKESUREPATHEXISTS_H__
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MoveToTrash.cpp Source File

common/MoveToTrash.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * MoveToTrash.cpp --- send the files to the trash
00019  * Author : Miro Jurisic <meeroh@MIT.EDU> --- December 1997
00020  * Modified : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00021  */
00022
00023 #include "stdafx.h"
00024
00025 #ifdef macintosh
00026 #   include <Files.h>
00027 #   include <Folders.h>
00028 #   include <AERegistry.h>
00029 #   include <AEPackObject.h>
00030 #   include <AEObjects.h>
00031 #endif /* macintosh */
00032
00033 #ifdef qUnix
00034 #   include <stdio.h>
00035 #endif /* qUnix */
00036
00037 #ifdef HAVE_UNISTD_H
00038 #   include <unistd.h>
00039 #endif
00040
00041 #include "MoveToTrash.h"
00042 #include "CPStr.h"
00043 #include "FileTraversal.h"
00044 #include "AppConsole.h"
00045
00046 #ifdef WIN32
00047 #   include <direct.h>
00048 #endif /* WIN32 */
00049
00050 #ifdef WIN32
00051 #   ifdef _DEBUG
00052 #   define new DEBUG_NEW
00053 #   undef THIS_FILE
00054     static char THIS_FILE[] = __FILE__;
00055 #   endif
00056 #endif /* WIN32 */
00057
00058 #ifdef macintosh
00059     static OSErr    GetAddressOfFinder (
00060         AEAddressDesc*  outFinderAddress);
00061     static OSErr    SendFilesToTrash (
00062         AEAddressDesc const*    inFinderAddress,
00063         short                   inFileCount,
00064         const FSSpec*           inFileList);
00065     static OSErr    PutFilesInAE (
00066         short           inFileCount,
00067         const FSSpec*   inFileList,
00068         AppleEvent  *   ioAppleEvent);
00069     static OSErr ToolboxMoveToTrash(const FSSpec* spec);
00070
00071     const   OSType  kFinderSignature    =   'MACS';
00072
00073     static std::vector<FSSpec> sToTrash;
00074     static bool sTrashRetainer = false;
00075
00076     static OSErr    MoveToTrash (const std::vector<FSSpec> & inFiles)
00077     {
00078         OSErr   err = noErr;
00079         AEDesc  finderAddress = {typeNull, nil};
00080
00081         /*  First unlock the file so that the Finder can rename it
00082             if there are already files of that name in the Trash */
00083         std::vector<FSSpec>::const_iterator i;
00084         for(i = inFiles.begin(); i != inFiles.end(); ++i)
00085         {
00086             err = FSpRstFLock (&*i);
00087             if (err != noErr)
00088                 goto cleanup;
00089         }
00090
00091         err = GetAddressOfFinder (&finderAddress);
00092         if (err != noErr)
00093             goto cleanup;
00094
00095         err = SendFilesToTrash (&finderAddress, inFiles.size(), &inFiles[0]);
00096         if (err != noErr)
00097             goto cleanup;
00098
00099     cleanup:
00100         if (finderAddress.dataHandle != nil) {
00101             AEDisposeDesc (&finderAddress);
00102         }
00103         if(err != noErr)
00104         {
00105             /* try the toolbox way */
00106             for(i = inFiles.begin(); i != inFiles.end(); ++i)
00107             {
00108                 err = ToolboxMoveToTrash(&*i);
00109             }
00110         }
00111
00112         return err;
00113     }
00114
00115     static OSErr    MoveToTrash (const FSSpec* inFile)
00116     {
00117         OSErr   err = noErr;
00118         AEDesc  finderAddress = {typeNull, nil};
00119
00120         /*  First unlock the file so that the Finder can rename it
00121             if there are already files of that name in the Trash */
00122
00123         err = FSpRstFLock (inFile);
00124         if (err != noErr)
00125             goto cleanup;
00126
00127         err = GetAddressOfFinder (&finderAddress);
00128         if (err != noErr)
00129             goto cleanup;
00130
00131         err = SendFilesToTrash (&finderAddress, 1, inFile);
00132         if (err != noErr)
00133             goto cleanup;
00134
00135     cleanup:
00136         if (finderAddress.dataHandle != nil) {
00137             AEDisposeDesc (&finderAddress);
00138         }
00139         if(err != noErr)
00140         {
00141             /* try the toolbox way */
00142             err = ToolboxMoveToTrash(inFile);
00143         }
00144
00145         return err;
00146     }
00147
00148     static OSErr
00149     ToolboxMoveToTrash(const FSSpec* spec)
00150     {
00151         short foundVRefNum;
00152         long foundDirID;
00153         OSErr err;
00154
00155         err = FindFolder(spec->vRefNum, kTrashFolderType, kDontCreateFolder,
00156             &foundVRefNum, &foundDirID);
00157
00158         if(err != noErr)
00159             return err;
00160
00161         err = CatMove(spec->vRefNum, spec->parID, spec->name, foundDirID, "\p:"/*spec.name*/);
00162         return err;
00163     }
00164
00165     /* get address of the Finder (to use as the destination of our appleevents) */
00166
00167     static OSErr
00168     GetAddressOfFinder (
00169         AEAddressDesc*  outFinderAddress)
00170     {
00171         return (AECreateDesc (typeApplSignature, (Ptr) &kFinderSignature, sizeof (long), outFinderAddress));
00172     }
00173
00174     /* Tell Finder to send a list of files to the trash */
00175
00176     static OSErr
00177     SendFilesToTrash (
00178         AEAddressDesc const*    inFinderAddress,
00179         short                   inFileCount,
00180         const FSSpec*           inFileList)
00181     {
00182         OSErr       err = noErr;
00183         AppleEvent  theAppleEvent = {typeNull, nil};
00184         AppleEvent  theReply = {typeNull, nil};
00185         DescType    trashType = kTrashFolderType;
00186         AEDesc      keyData = {typeNull, nil};
00187         AEDesc      trashSpecifier = {typeNull, nil};
00188         AEDesc      nullDescriptor = {typeNull, nil};
00189
00190
00191         /* create the appleevent */
00192         err = AECreateAppleEvent (kAECoreSuite, kAEMove, inFinderAddress, kAutoGenerateReturnID, kAnyTransactionID, &theAppleEvent);
00193         if (err != noErr)
00194             goto cleanup;
00195
00196         /* put the files into the direct object of the appleevent */
00197         err = PutFilesInAE (inFileCount, inFileList, &theAppleEvent);
00198         if (err != noErr)
00199             goto cleanup;
00200
00201         /* create a descriptor for trash */
00202         err = AECreateDesc (typeType, (Ptr) &trashType, sizeof (DescType) , &keyData);
00203         if (err != noErr)
00204             goto cleanup;
00205
00206         /* get specifier for trash object */
00207         err = CreateObjSpecifier (typeProperty, &nullDescriptor, formPropertyID, &keyData, true, &trashSpecifier);
00208         if (err != noErr)
00209             goto cleanup;
00210
00211         /* put the trash specifier as the indirect object in the appleevent */
00212         err = AEPutParamDesc (&theAppleEvent, keyAEInsertHere, &trashSpecifier);
00213         if (err != noErr)
00214             goto cleanup;
00215
00216         /* send the appleevent */
00217         err = AESend (&theAppleEvent, &theReply, kAEWaitReply, kAENormalPriority, kAEDefaultTimeout, nil, nil);
00218         if (err != noErr)
00219             goto cleanup;
00220
00221         /* ignore the reply */
00222
00223     cleanup:
00224
00225         /* dispose of the stuff that we allocated */
00226         if (theAppleEvent.dataHandle != nil) {
00227             AEDisposeDesc (&theAppleEvent);
00228         }
00229         if (theReply.dataHandle != nil) {
00230             AEDisposeDesc (&theReply);
00231         }
00232         if (keyData.dataHandle != nil) {
00233             AEDisposeDesc (&keyData);
00234         }
00235         if (trashSpecifier.dataHandle != nil) {
00236             AEDisposeDesc (&trashSpecifier);
00237         }
00238         /* don't have to dispose of nullDescriptor because it's null */
00239
00240         return err;
00241     }
00242
00243     /* put a list of files into the direct object of an apple event */
00244
00245     static OSErr
00246     PutFilesInAE (
00247         short               inFileCount,
00248         const FSSpec*       inFileList,
00249         AppleEvent*         ioAppleEvent)
00250     {
00251         OSErr       err;
00252         AEDescList  fileList = {typeNull, nil};
00253         short       i;
00254
00255         err = AECreateList(nil, 0, false, &fileList);
00256         if (err != noErr) return err;
00257
00258         for (i = 1; i <= inFileCount; i++) {
00259             err = AEPutPtr(&fileList, i, typeFSS,
00260                             (Ptr) (inFileList + i - 1), sizeof(FSSpec));
00261             if (err != noErr) goto cleanup;
00262         }
00263
00264         err = AEPutParamDesc(ioAppleEvent, keyDirectObject, &fileList);
00265
00266     cleanup:
00267         if (fileList.dataHandle != nil) {
00268             AEDisposeDesc(&fileList);
00269         }
00270
00271         return err;
00272     }
00273 #endif /* macintosh */
00274
00275 void CompatBeginMoveToTrash(void)
00276 {
00277 #ifdef macintosh
00278     sToTrash.erase(sToTrash.begin(), sToTrash.end());
00279     sTrashRetainer = true;
00280 #endif
00281 }
00282
00283 void CompatEndMoveToTrash(void)
00284 {
00285 #ifdef macintosh
00286     if(sToTrash.size() > 0)
00287     {
00288         OSErr err;
00289         err = MoveToTrash(sToTrash);
00290         if(err != noErr)
00291             cvs_err("Unable to send files to the trash (Error %d)\n", err);
00292         else
00293             cvs_out("Files has been moved successfully to the trash...\n");
00294     }
00295
00296     sToTrash.erase(sToTrash.begin(), sToTrash.end());
00297     sTrashRetainer = false;
00298 #endif
00299 }
00300
00301 bool CompatMoveToTrash(const char *file, const char *dir, const FSSpec *spec)
00302 {
00303 #ifdef macintosh
00304     if(sTrashRetainer)
00305     {
00306         sToTrash.push_back(*spec);
00307         return true;
00308     }
00309
00310     return spec != NULL ? MoveToTrash(spec) == noErr : false;
00311 #elif defined(WIN32)
00312     SHFILEOPSTRUCT fileop;
00313     CStr fullpath(dir);
00314     if(!fullpath.empty() && !fullpath.endsWith(kPathDelimiter))
00315     {
00316         fullpath << kPathDelimiter;
00317     }
00318     fullpath << file;
00319     fullpath << ' ';
00320     fullpath[fullpath.length() - 1] = '\0';
00321
00322     fileop.hwnd     = *AfxGetMainWnd();
00323     fileop.wFunc    = FO_DELETE;
00324     fileop.pFrom    = fullpath;
00325     fileop.pTo      = 0L;
00326     fileop.fFlags   = FOF_ALLOWUNDO | FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI;
00327
00328     if(SHFileOperation(&fileop) != 0)
00329     {
00330         if(dir != 0L && chdir(dir) != 0)
00331             return false;
00332
00333         cvs_err("Unable to send \'%s\' to the recycle bin (error %d)\n",
00334             file, GetLastError());
00335         cvs_err("Trying now to delete \'%s\' instead\n", file);
00336         return remove(file) == 0;
00337     }
00338     return true;
00339 #else /* !macintosh && !WIN32 */
00340     CStr fullpath(dir);
00341     if(!fullpath.empty() && !fullpath.endsWith(kPathDelimiter))
00342     {
00343         fullpath << kPathDelimiter;
00344     }
00345     fullpath << file;
00346
00347     return remove(fullpath) == 0;
00348 #endif /* !macintosh && !WIN32 */
00349 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MoveToTrash.h Source File

common/MoveToTrash.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * MoveToTrash.h --- send the files to the trash
00019  * Author : Miro Jurisic <meeroh@MIT.EDU> --- December 1997
00020  * Modified : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00021  */
00022
00023 #ifndef MOVETOTRASH_H
00024 #define MOVETOTRASH_H
00025
00026 #ifdef macintosh
00027 #   include <Files.h>
00028 #else /* !macintosh */
00029     typedef int FSSpec;
00030 #endif /* !macintosh */
00031
00032 bool CompatMoveToTrash(const char *file, const char *dir = 0L, const FSSpec *spec = 0L);
00033     // return false if failed
00034
00035 void CompatBeginMoveToTrash(void);
00036 void CompatEndMoveToTrash(void);
00037
00038 #endif /* MOVETOTRASH_H */
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MultiFiles.cpp Source File

common/MultiFiles.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * MultiFiles.h --- class to store multiple files by directory
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include <stdlib.h>
00028 #include <string.h>
00029
00030 #include "MultiFiles.h"
00031 #include "CvsArgs.h"
00032 #include "AppConsole.h"
00033 #include "CPStr.h"
00034
00035 #include <errno.h>
00036
00037 #ifdef WIN32
00038 #   ifdef _DEBUG
00039 #   define new DEBUG_NEW
00040 #   undef THIS_FILE
00041     static char THIS_FILE[] = __FILE__;
00042 #   endif
00043 #endif /* WIN32 */
00044
00045 void MultiFilesEntry::setdir(const char *newdir)
00046 {
00047     dir = newdir;
00048 }
00049
00050 void MultiFilesEntry::add(const char *file, const FSSpec *spec)
00051 {
00052     FileEntry entry(file, spec);
00053     files.push_back(entry);
00054 }
00055
00056 void MultiFiles::newdir(const char *dir)
00057 {
00058     MultiFilesEntry entry(dir);
00059     dirs.push_back(dir);
00060 }
00061
00062 void MultiFiles::newfile(const char *file, const FSSpec *spec)
00063 {
00064     if(dirs.size() == 0)
00065         return;
00066
00067     MultiFilesEntry & entry = dirs[dirs.size() - 1];
00068     entry.add(file, spec);
00069 }
00070
00071 bool MultiFiles::next(void)
00072 {
00073     if(pos == -1)
00074         pos = 0;
00075     else
00076         ++pos;
00077
00078     return (size_t)pos < dirs.size();
00079 }
00080
00081 char *MultiFiles::add(CvsArgs & args)
00082 {
00083     if(pos < 0 || (size_t)pos >= dirs.size())
00084         return 0L;
00085
00086     MultiFilesEntry & entry = dirs[pos];
00087     std::vector<FileEntry>::const_iterator i;
00088     for(i = entry.files.begin(); i != entry.files.end(); ++i)
00089     {
00090         args.addfile((*i).file, entry.dir, &(*i).spec);
00091     }
00092     return entry.dir;
00093 }
00094
00095 bool MultiFiles::get (int index, CStr & path, CStr & fileName)
00096 {
00097     if(pos < 0 || (size_t)pos >= dirs.size())
00098         return false;
00099
00100     MultiFilesEntry & entry = dirs[pos];
00101     if(index < 0 || (size_t)index >= entry.files.size())
00102         return false;
00103
00104     path = entry.dir;
00105     fileName = entry.files[index].file;
00106     return true;
00107 }
00108
00109 int MultiFiles::NumFiles(void) const
00110 {
00111     int locpos = pos;
00112     if(locpos == -1)
00113         locpos = 0;
00114     if((size_t)locpos >= dirs.size())
00115         return 0;
00116
00117     const MultiFilesEntry & entry = dirs[locpos];
00118     return entry.files.size();
00119 }
00120
00121 void MultiFiles::reset()
00122 {
00123     dirs.erase(dirs.begin(), dirs.end());
00124     pos = -1;
00125 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MultiFiles.h Source File

common/MultiFiles.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * MultiFiles.h --- class to store multiple files by directory
00023  */
00024
00025 #ifndef MULTIFILES_H
00026 #define MULTIFILES_H
00027
00028 #ifdef macintosh
00029 #   include <Files.h>
00030 #else /* !macintosh */
00031     typedef int FSSpec;
00032 #endif /* !macintosh */
00033
00034 #include "CPStr.h"
00035 #include <vector>
00036
00037 #ifdef _MSC_VER
00038     using namespace std;
00039 #endif
00040
00041 class CvsArgs;
00042
00043 // used internally
00044 class FileEntry
00045 {
00046 public:
00047     FileEntry() {}
00048     FileEntry(const char *filename, const FSSpec *macspec = 0L)
00049     {
00050         file = filename;
00051         if(macspec != 0L)
00052             spec = *macspec;
00053     }
00054     FileEntry(const FileEntry & entry)
00055     {
00056         *this = entry;
00057     }
00058
00059     FileEntry & operator=(const FileEntry & entry)
00060     {
00061         file = entry.file;
00062         spec = entry.spec;
00063         return *this;
00064     }
00065
00066     CStr file;
00067     FSSpec spec;
00068 };
00069
00070 // used internally
00071 class MultiFilesEntry
00072 {
00073 public:
00074     MultiFilesEntry() {}
00075     MultiFilesEntry(const char *path)
00076     {
00077         dir = path;
00078     }
00079     MultiFilesEntry(const MultiFilesEntry & entries)
00080     {
00081         *this = entries;
00082     }
00083
00084     MultiFilesEntry & operator=(const MultiFilesEntry & entries)
00085     {
00086         dir = entries.dir;
00087         files = entries.files;
00088         return *this;
00089     }
00090
00091     void setdir(const char *newdir);
00092     void add(const char *file, const FSSpec *spec = 0L);
00093
00094     CStr dir;
00095     std::vector<FileEntry> files;
00096 };
00097
00098 class MultiFiles
00099 {
00100 public:
00101     MultiFiles() : pos(-1) {}
00102
00103     void newdir(const char *dir);
00104         // add a new directory
00105     void newfile(const char *file, const FSSpec *spec = 0L);
00106         // add a new file to the current directory
00107
00108     inline void rewind(void) {pos = -1;}
00109         // rewind to first directory
00110     bool next(void);
00111         // return false if no more directories
00112     char *add (CvsArgs & args);
00113         // add the files to a CvsArgs, return the directory
00114     bool get (int index, CStr & path, CStr & fileName);
00115         // return the file in the current directory (false if failed)
00116
00117     int NumFiles(void) const;
00118         // number of files in the current dir
00119
00120     void reset();
00121         // reset for reuse.
00122 protected:
00123     int pos;
00124     std::vector<MultiFilesEntry> dirs;
00125 };
00126
00127 #endif /* MULTIFILES_H */
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MultiString.cpp Source File

common/MultiString.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- August 1998
00019  */
00020
00021 /*
00022  * MultiString.cpp --- remember several unique persistents strings
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include "MultiString.h"
00028
00029 #if qUnix
00030 #   include "uwidget.h"
00031 #endif
00032
00033 #ifdef WIN32
00034 #   ifdef _DEBUG
00035 #   define new DEBUG_NEW
00036 #   undef THIS_FILE
00037     static char THIS_FILE[] = __FILE__;
00038 #   endif
00039 #   pragma warning (disable : 4660)
00040 #endif /* WIN32 */
00041
00042 template<class T>
00043 TMString<T>::TMString(unsigned int maxstr, const char *uniqueName, char * const *defaultStr,
00044     kClassPersistent pclass) : CPersistent(uniqueName, pclass), fMaxStr(maxstr)
00045 {
00046     if(defaultStr != 0L)
00047     {
00048         int i = 0;
00049         while(defaultStr[i] != 0L)
00050         {
00051             Insert(defaultStr[i++]);
00052         }
00053     }
00054 }
00055
00056 template<class T>
00057 TMString<T>::~TMString()
00058 {
00059 }
00060
00061 template<class T>
00062 unsigned int TMString<T>::SizeOf(void) const
00063 {
00064     NAMESPACE(std) vector<T>::const_iterator i;
00065     unsigned int thesize = sizeof(int);
00066
00067     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00068     {
00069         thesize += (*i).length() + 1;
00070     }
00071     return thesize;
00072 }
00073
00074 template<class T>
00075 const void *TMString<T>::GetData(void) const
00076 {
00077     unsigned int thesize = SizeOf(), tmpsize;
00078     ((TMString *)this)->fBuf.AdjustSize(thesize);
00079     char *tmp = ((TMString *)this)->fBuf;
00080     *(int *)tmp = fAllStrs.size();
00081     tmp += sizeof(int) / sizeof(char);
00082
00083     NAMESPACE(std) vector<T>::const_iterator i;
00084     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00085     {
00086         tmpsize = (*i).length() + 1;
00087         memcpy(tmp, (const char *)(*i), tmpsize * sizeof(char));
00088         tmp += tmpsize;
00089     }
00090
00091     return (char *)fBuf;
00092 }
00093
00094 template<class T>
00095 void TMString<T>::SetData(const void *ptr, unsigned int size)
00096 {
00097     const char *tmp = (char *)ptr;
00098     unsigned int thesize;
00099     fAllStrs.erase(fAllStrs.begin(), fAllStrs.end());
00100     thesize = *(int *)tmp;
00101     tmp += sizeof(int) / sizeof(char);
00102     for(unsigned int i = 0; i < thesize && i < fMaxStr; i++)
00103     {
00104         fAllStrs.push_back(T(tmp));
00105         tmp += strlen(tmp) + 1;
00106     }
00107 }
00108
00109 //  The string classes have too many operators to use std::find.
00110 template<class T>
00111 typename TMString<T>::list_t::const_iterator TMString<T>::Find(const char *instr) const
00112 {
00113     TMString<T>::list_t::const_iterator i;
00114     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00115         if(Compare(*i, instr) == 0) break;
00116
00117     return i;
00118 }
00119
00120 template<class T>
00121 void TMString<T>::Insert(const char *newstr)
00122 {
00123     TouchTimeStamp();
00124
00125     NAMESPACE(std) vector<T>::iterator i;
00126     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00127     {
00128         if(Compare(*i, newstr) == 0)
00129         {
00130             fAllStrs.erase(i);
00131             fAllStrs.insert(fAllStrs.begin(), T(newstr));
00132             return;
00133         }
00134     }
00135     fAllStrs.insert(fAllStrs.begin(), T(newstr));
00136     if(fAllStrs.size() > fMaxStr)
00137     {
00138         fAllStrs.erase(fAllStrs.begin() + fMaxStr, fAllStrs.end());
00139     }
00140 }
00141
00142 template<class T>
00143 bool TMString<T>::Remove(const char *newstr)
00144 {
00145
00146     NAMESPACE(std) vector<T>::iterator i;
00147     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00148     {
00149         if(Compare(*i, newstr) == 0)
00150         {
00151             TouchTimeStamp();
00152             fAllStrs.erase(i);
00153             return true;
00154         }
00155     }
00156
00157     return false;
00158 }
00159
00160 template class TMString<CStr>;
00161 template class TMString<CPStr>;
00162
00163 UIMPLEMENT_DYNAMIC(CMString, CPersistent)
00164 UIMPLEMENT_DYNAMIC(CMPString, CPersistent)
00165
00166 void CKeyString::Concatenate(UStr & res, const char *key, const char *value)
00167 {
00168     char c;
00169     while((c = *key++) != '\0')
00170     {
00171         if(c == '@' || c == '\\')
00172             res << '\\';
00173         res << c;
00174     }
00175     res << '@';
00176     while((c = *value++) != '\0')
00177     {
00178         if(c == '@' || c == '\\')
00179             res << '\\';
00180         res << c;
00181     }
00182 }
00183
00184 void CKeyString::Split(const char *str, UStr & key, UStr & value)
00185 {
00186     key = "";
00187     value = "";
00188     char c;
00189     bool inKey = true;
00190     while((c = *str++) != 0)
00191     {
00192         if(c == '\\')
00193             c = *str++;
00194         else if(c == '@')
00195         {
00196             inKey = false;
00197             continue;
00198         }
00199
00200         if(inKey)
00201             key << c;
00202         else
00203             value << c;
00204     }
00205 }
00206
00207 int CKeyString::Compare(const char *s1, const char *s2) const
00208 {
00209     UStr key1, key2, val1, val2;
00210     Split(s1, key1, val1);
00211     Split(s2, key2, val2);
00212     return strcmp(key1, key2);
00213 }
00214
00215 #if qUnix
00216 void DoDataExchange(bool fill, int widid, int cmdid, CMString & mstr)
00217 {
00218     if(fill)
00219     {
00220         UEventSendMessage(widid, EV_COMBO_RESETALL, cmdid, 0L);
00221         const vector<CStr> & list = mstr.GetList();
00222         vector<CStr>::const_iterator i;
00223         for(i = list.begin(); i != list.end(); ++i)
00224         {
00225             UEventSendMessage(widid, EV_COMBO_APPEND, cmdid, (void *)(const char *)*i);
00226         }
00227     }
00228     else
00229     {
00230         UStr value;
00231         UEventSendMessage(widid, EV_GETTEXT, cmdid, &value);
00232         if(!value.empty())
00233         {
00234             mstr.Insert(value);
00235         }
00236     }
00237 }
00238 #endif // qUnix
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/MultiString.h Source File

common/MultiString.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- August 1998
00019  */
00020
00021 /*
00022  * MultiString.h --- remember several unique persistents strings
00023  */
00024
00025 #ifndef MULTISTRING_H
00026 #define MULTISTRING_H
00027
00028 #include <vector>
00029 #include "Persistent.h"
00030 #include "CPStr.h"
00031
00032 #ifndef NAMESPACE
00033 #   if defined(_MSC_VER) || defined(__MWERKS__)
00034 #       define NAMESPACE(w) w::
00035 #   else
00036 #       define NAMESPACE(w) ::
00037 #   endif
00038 #endif
00039
00040 //  Persistent array
00041 template<class T>
00042 class TMPersistent : public CPersistent
00043 {
00044 public:
00045     typedef NAMESPACE(std) vector<T>    list_t;
00046
00047     TMPersistent(const char *uniqueName, kClassPersistent pclass = kNoClass)
00048     : CPersistent(uniqueName, pclass) {};
00049
00050     virtual ~TMPersistent() {};
00051
00052     virtual unsigned int SizeOf(void) const {return sizeof (int) + sizeof (T) * fAllItems.size ();};
00053     virtual const void *GetData(void) const
00054         {
00055             fBuf.AdjustSize(SizeOf());
00056             char *tmp = fBuf;
00057             *(int *) tmp = fAllItems.size();
00058             tmp += sizeof(int) / sizeof(char);
00059
00060             for(list_t::const_iterator i = fAllItems.begin(); i != fAllItems.end(); ++i)
00061             {
00062                 memcpy(tmp, (const char *)(&*i), sizeof (T));
00063                 tmp += sizeof (T);
00064             }
00065
00066             return (char *)fBuf;
00067         };
00068
00069     virtual void SetData(const void *ptr, unsigned int size)
00070         {
00071             const char *tmp = (char *)ptr;
00072             fAllItems.erase(fAllItems.begin(), fAllItems.end());
00073             unsigned int thesize = *(int *)tmp;
00074             tmp += sizeof(int) / sizeof(char);
00075             for(unsigned int i = 0; i < thesize; ++i)
00076             {
00077                 fAllItems.push_back(*((T*)tmp));
00078                 tmp += sizeof (T);
00079             }
00080         };
00081         // persistent interface
00082
00083     inline const list_t & GetList(void) const { return fAllItems; }
00084     inline list_t & GetList(void) { return fAllItems; }
00085
00086 protected:
00087     list_t                      fAllItems;
00088     mutable CStaticAllocT<char> fBuf;
00089 };
00090
00091 template<class T>
00092 class TMString : public CPersistent
00093 {
00094 public:
00095     typedef NAMESPACE(std) vector<T> list_t;
00096
00097     TMString(unsigned int maxstr, const char *uniqueName,
00098         char * const *defaultStr = 0L, kClassPersistent pclass = kNoClass);
00099         // defaultStr is a null terminated set of strings
00100
00101     virtual ~TMString();
00102
00103     virtual unsigned int SizeOf(void) const;
00104     virtual const void *GetData(void) const;
00105     virtual void SetData(const void *ptr, unsigned int size);
00106         // persistent interface
00107
00108     void Insert(const char *newstr);
00109         // add a new string
00110
00111     bool Remove(const char *newstr);
00112         // remove a new string, true if it was found
00113
00114     list_t::const_iterator Find(const char *instr) const;
00115         // find a string
00116
00117     inline const list_t & GetList(void) const { return fAllStrs; }
00118     inline list_t::const_iterator begin() const { return GetList ().begin ();};
00119     inline list_t::const_iterator end() const { return GetList ().end ();};
00120
00121 protected:
00122     virtual int Compare(const char *s1, const char *s2) const
00123     {
00124         return strcmp(s1, s2);
00125     }
00126
00127     list_t fAllStrs;
00128     mutable CStaticAllocT<char> fBuf;
00129     unsigned int fMaxStr;
00130 };
00131
00132 class CMString : public TMString<CStr>
00133 {
00134     UDECLARE_DYNAMIC(CMString)
00135 public:
00136     CMString(unsigned int maxstr, const char *uniqueName,
00137         char * const *defaultStr = 0L, kClassPersistent pclass = kNoClass) :
00138         TMString<CStr>(maxstr, uniqueName, defaultStr, pclass)
00139     {
00140     }
00141
00142     virtual ~CMString()
00143     {
00144     }
00145 };
00146
00147 class CMPString : public TMString<CPStr>
00148 {
00149     UDECLARE_DYNAMIC(CMPString)
00150 public:
00151     CMPString(unsigned int maxstr, const char *uniqueName,
00152         char * const *defaultStr = 0L, kClassPersistent pclass = kNoClass) :
00153         TMString<CPStr>(maxstr, uniqueName, defaultStr, pclass)
00154     {
00155     }
00156
00157     virtual ~CMPString()
00158     {
00159     }
00160 };
00161
00162 // this is a multi-string for storing map (i.e. dictionary)
00163 class CKeyString : public CMString
00164 {
00165 public:
00166     CKeyString(unsigned int maxstr, const char *uniqueName,
00167         char * const *defaultStr = 0L, kClassPersistent pclass = kNoClass) :
00168         CMString(maxstr, uniqueName, defaultStr, pclass)
00169     {
00170     }
00171
00172     virtual ~CKeyString()
00173     {
00174     }
00175
00176     static void Concatenate(UStr & res, const char *key, const char *value);
00177     static void Split(const char *str, UStr & key, UStr & value);
00178 protected:
00179     virtual int Compare(const char *s1, const char *s2) const;
00180 };
00181
00182 #if qUnix
00183     void DoDataExchange(bool fill, int widid, int cmdid, CMString & mstr);
00184 #endif // qUnix
00185
00186 #endif /* AUTHEN_H */
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/OptionalPropertySheet.cpp Source File

common/OptionalPropertySheet.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- June 2001
00019  */
00020
00021 // OptionalPropertySheet.cpp : implementation file
00022 //
00023
00024 #include "stdafx.h"
00025 #include "wincvs.h"
00026 #include "OptionalPropertySheet.h"
00027
00028 #include "CvsPrefs.h"
00029
00030 #ifdef _DEBUG
00031 #define new DEBUG_NEW
00032 #undef THIS_FILE
00033 static char THIS_FILE[] = __FILE__;
00034 #endif
00035
00037 // COptionalPropertySheet
00038
00039 IMPLEMENT_DYNAMIC(COptionalPropertySheet, CPropertySheet)
00040
00041 COptionalPropertySheet::COptionalPropertySheet(bool bOptionChecked, UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
00042     :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
00043 {
00044     m_bOptionChecked = bOptionChecked;
00045 }
00046
00047 COptionalPropertySheet::COptionalPropertySheet(bool bOptionChecked, LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
00048     :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
00049 {
00050     m_bOptionChecked = bOptionChecked;
00051 }
00052
00053 COptionalPropertySheet::~COptionalPropertySheet()
00054 {
00055 }
00056
00057
00058 BEGIN_MESSAGE_MAP(COptionalPropertySheet, CPropertySheet)
00059 //{{AFX_MSG_MAP(COptionalPropertySheet)
00060 //}}AFX_MSG_MAP
00061 END_MESSAGE_MAP()
00062
00064 // COptionalPropertySheet message handlers
00065
00066 BOOL COptionalPropertySheet::OnInitDialog()
00067 {
00068     CPropertySheet::OnInitDialog();
00069
00070     // Add the option check box
00071     CRect rectWnd;
00072     GetClientRect(rectWnd);
00073
00074     rectWnd.bottom -= 13;
00075     rectWnd.left   += 7;
00076     rectWnd.top     = rectWnd.bottom - 12;
00077     rectWnd.right   = rectWnd.left   + 180;
00078
00079     CString strOptionText;
00080     strOptionText.Format(_T("Display only if %s key is down"),
00081         gCvsPrefs.HideCommandDlgUseShift() ? "Shift" : "Ctrl");
00082     m_optionCheck.Create(strOptionText,
00083         WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX|WS_TABSTOP,
00084         rectWnd, this, 4);
00085
00086     m_optionCheck.SetFont( GetFont() );
00087
00088     // Set the checkbox
00089     m_optionCheck.SetCheck(m_bOptionChecked);
00090
00091     return TRUE;  // return TRUE unless you set the focus to a control
00092     // EXCEPTION: OCX Property Pages should return FALSE
00093 }
00094
00095 int COptionalPropertySheet::DoModal()
00096 {
00097     bool bDisplayDlg = true;
00098
00099     // See if the option flag is set
00100     //m_bOptionChecked = !!AfxGetApp()->GetProfileInt(PROFILE_NAME, m_psh.pszCaption, (int)false);
00101
00102     if (m_bOptionChecked)
00103     {
00104         // See if the ctrl key is down
00105         bDisplayDlg = (::GetKeyState(gCvsPrefs.HideCommandDlgUseShift() ? VK_SHIFT : VK_CONTROL) < 0);
00106     }
00107
00108     if (bDisplayDlg)
00109         return CPropertySheet::DoModal();
00110     else
00111         return IDOK;
00112 }
00113
00114 BOOL COptionalPropertySheet::OnCommand(WPARAM wParam, LPARAM lParam)
00115 {
00116     if (wParam == IDOK)
00117     {
00118         // Save the check state of the display option
00119         m_bOptionChecked = (m_optionCheck.GetCheck() == 1);
00120         //AfxGetApp()->WriteProfileInt(PROFILE_NAME, m_psh.pszCaption, bChecked);
00121     }
00122
00123     return CPropertySheet::OnCommand(wParam, lParam);
00124 }
00125
00126 bool COptionalPropertySheet::GetHideCommandDlg()
00127 {
00128     return m_bOptionChecked;
00129 }
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/OptionalPropertySheet.h Source File

common/OptionalPropertySheet.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- June 2001
00019  */
00020
00021 #if !defined(AFX_OPTIONALPROPERTYSHEET_H__F82DC8BB_73CD_4AEA_8635_1A0932F24C7D__INCLUDED_)
00022 #define AFX_OPTIONALPROPERTYSHEET_H__F82DC8BB_73CD_4AEA_8635_1A0932F24C7D__INCLUDED_
00023
00024 #if _MSC_VER > 1000
00025 #pragma once
00026 #endif // _MSC_VER > 1000
00027 // OptionalPropertySheet.h : header file
00028 //
00029
00031 // COptionalPropertySheet
00032
00033 class COptionalPropertySheet : public CPropertySheet
00034 {
00035     DECLARE_DYNAMIC(COptionalPropertySheet)
00036
00037 // Construction
00038 public:
00039     COptionalPropertySheet(bool bOptionChecked, UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
00040     COptionalPropertySheet(bool bOptionChecked, LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
00041
00042 // Attributes
00043 public:
00044
00045 // Operations
00046 public:
00047
00048 // Overrides
00049     // ClassWizard generated virtual function overrides
00050     //{{AFX_VIRTUAL(COptionalPropertySheet)
00051     public:
00052     virtual int DoModal();
00053     protected:
00054     virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
00055     //}}AFX_VIRTUAL
00056
00057 // Implementation
00058 public:
00059     virtual ~COptionalPropertySheet();
00060
00061     // Generated message map functions
00062 protected:
00063     //{{AFX_MSG(COptionalPropertySheet)
00064     virtual BOOL OnInitDialog();
00065     //}}AFX_MSG
00066     DECLARE_MESSAGE_MAP()
00067 protected:
00068     bool m_bOptionChecked; // The initial state of the option check box
00069     CButton m_optionCheck; // The object wrapping the option check box
00070 public:
00071     bool GetHideCommandDlg();
00072 };
00073
00075
00076 //{{AFX_INSERT_LOCATION}}
00077 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00078
00079 #endif // !defined(AFX_OPTIONALPROPERTYSHEET_H__F82DC8BB_73CD_4AEA_8635_1A0932F24C7D__INCLUDED_)
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/Persistent.cpp Source File

common/Persistent.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 1998
00019  */
00020
00021 /*
00022  * Persistent.cpp --- utilities to store persitent values
00023  */
00024
00025 #ifdef macintosh
00026 #   include "GUSIInternal.h"
00027 #   include "GUSIFileSpec.h"
00028 #endif
00029
00030 #include "stdafx.h"
00031 #include <stdlib.h>
00032 #include <string.h>
00033 #include <map>
00034
00035 #if defined(HAVE_ERRNO_H) || defined(WIN32)
00036 #   include <errno.h>
00037 #endif
00038
00039 #ifdef HAVE_UNISTD_H
00040 #   include <unistd.h>
00041 #endif
00042
00043 #ifndef WIN32
00044 #   include <ctype.h>
00045 #endif /* !WIN32 */
00046
00047 #ifdef WIN32
00048 #   include "wincvs.h"
00049 #endif
00050
00051 #include "Persistent.h"
00052 #include "AppConsole.h"
00053 #include "CPStr.h"
00054 #include "uconsole.h"
00055 #include "uwidget.h"
00056 #include "FileTraversal.h"
00057 #include "Authen.h"
00058 #include "CvsPrefs.h"
00059 #include "getline.h"
00060 #include "CvsAlert.h"
00061
00062 #ifdef macintosh
00063 #   include <Resources.h>
00064 #   include <TextUtils.h>
00065 #   include <Folders.h>
00066 #   include "VolsPaths.h"
00067 #   include "MacMisc.h"
00068 #   define kCVS_prefID 'cprf'
00069 #   define kCVS_prefName "\pMacCvs Prefs"
00070 #   ifndef Assert_ // for mpw
00071 #       include <assert.h>
00072 #       define Assert_(cond) assert(cond)
00073 #   endif
00074 #endif /* macintosh */
00075
00076 #if qMacCvsPP
00077 #   include "MacCvsApp.h"
00078 #   include "MacCvsConstant.h"
00079 #endif
00080
00081 #if qUnix
00082 #   include "UCvsDialogs.h"
00083 #endif
00084
00085 #ifdef WIN32
00086 #   ifdef _DEBUG
00087 #   define new DEBUG_NEW
00088 #   undef THIS_FILE
00089     static char THIS_FILE[] = __FILE__;
00090 #   endif
00091 #endif /* WIN32 */
00092
00093 #ifndef NEW
00094 #define NEW new
00095 #endif
00096
00097 std::vector<CPersistent::CPersistentEntry> *CPersistent::fAllEntries = 0L;
00098
00099 UIMPLEMENT_DYNAMIC(CPersistent, UObject)
00100 UIMPLEMENT_DYNAMIC(CPersistentInt, CPersistent)
00101 UIMPLEMENT_DYNAMIC(CPersistentBool, CPersistent)
00102 UIMPLEMENT_DYNAMIC(PCStr, CPersistent)
00103 UIMPLEMENT_DYNAMIC(PCPStr, CPersistent)
00104
00105 CPersistent::CPersistent(const char *uniqueName, kClassPersistent pclass) : fTimeStamp(0)
00106 {
00107     Register(this, uniqueName, pclass);
00108     TouchTimeStamp();
00109 }
00110
00111 CPersistent::~CPersistent()
00112 {
00113     UnRegister(this);
00114 }
00115
00116 void CPersistent::Register(CPersistent *value, const char *uniqueName, kClassPersistent pclass)
00117 {
00118     std::vector<CPersistentEntry>::const_iterator i;
00119     if(fAllEntries == 0L)
00120         fAllEntries = NEW std::vector<CPersistentEntry>;
00121     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00122     {
00123         if(strcmp(uniqueName, (*i).fUniqueName) == 0)
00124         {
00125             UAppConsole("Error : duplicate persistent %s !\n", uniqueName);
00126         }
00127     }
00128     CPersistentEntry newentry;
00129     newentry.fClass = pclass;
00130     newentry.fUniqueName = uniqueName;
00131     newentry.fValue = value;
00132     fAllEntries->push_back(newentry);
00133 }
00134
00135 void CPersistent::UnRegister(CPersistent *value)
00136 {
00137     std::vector<CPersistentEntry>::iterator i;
00138     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00139     {
00140         if(value == (*i).fValue)
00141             break;
00142     }
00143
00144     if(i == fAllEntries->end())
00145     {
00146         UAppConsole("Error : Unknown persistent value !\n");
00147         return;
00148     }
00149
00150     fAllEntries->erase(i);
00151     if(fAllEntries->size() == 0)
00152     {
00153         delete fAllEntries;
00154         fAllEntries = 0L;
00155     }
00156 }
00157
00158 #ifdef macintosh
00159     static OSErr GetPreferencesFile(FSSpec & mMacFileSpec)
00160     {
00161         short   theVRef;
00162         long    theDirID;
00163         OSErr   theErr;
00164         Str255 name = {'\0'};
00165
00166         theErr = ::FindFolder(kOnSystemDisk, kPreferencesFolderType,
00167                         kDontCreateFolder, &theVRef, &theDirID);
00168
00169         if (theErr == noErr)
00170         {
00171             GUSIFileSpec spec(theVRef, theDirID, name);
00172             theErr = spec.Error();
00173             if (theErr == noErr)
00174             {
00175                 spec += kCVS_prefName;
00176                 theErr = spec.Error();
00177                 if (theErr == noErr || theErr == fnfErr)
00178                 {
00179                     mMacFileSpec = spec;
00180                 }
00181             }
00182         }
00183
00184         return theErr;
00185
00186     }
00187
00188     OSErr
00189     MacGetSpecialFolder(FSSpec & theFolder, Str255 & thePath, OSType inType, const char* inDesc)
00190     {
00191         short foundVRefNum;
00192         long foundDirID;
00193         OSErr err;
00194         char theCPath[256];
00195
00196         err = FindFolder(kOnSystemDisk, inType,
00197             kDontCreateFolder, &foundVRefNum, &foundDirID);
00198         if (err != noErr)
00199         {
00200             cvs_err("MacCvs: Unable to find the %s folder (error %d)\n", inDesc, err);
00201             return err;
00202         }
00203
00204         if(PathNameFromDirID(foundDirID, foundVRefNum, theCPath) != noErr)
00205         {
00206             cvs_err("MacCvs: Unable to convert path name\n");
00207             return fnfErr;
00208         }
00209         c2pstrcpy(thePath, theCPath);
00210
00211         err = FSMakeFSSpecCompat(foundVRefNum, foundDirID, "\p", theFolder);
00212         return err;
00213     }
00214
00215     OSErr
00216     MacGetTempFolder(FSSpec & theFolder, Str255 & thePath)
00217     {
00218         static FSSpec cacheFile = {0, 0, '\0'};
00219         static UPStr cachePath;
00220         if(!cachePath.empty())
00221         {
00222             theFolder = cacheFile;
00223             memcpy(thePath, (const unsigned char *)cachePath, cachePath.length() + 1);
00224             return noErr;
00225         }
00226
00227         OSErr err = MacGetSpecialFolder (theFolder, thePath, kTemporaryFolderType, "temporary");
00228         if(err == noErr)
00229         {
00230             cacheFile = theFolder;
00231             cachePath = thePath;
00232         }
00233
00234         return err;
00235     }
00236
00237     OSErr
00238     MacGetPrefsFolder(FSSpec & theFolder, Str255 & thePath)
00239     {
00240         static FSSpec cacheFile = {0, 0, '\0'};
00241         static UPStr cachePath;
00242         if(!cachePath.empty())
00243         {
00244             theFolder = cacheFile;
00245             memcpy(thePath, (const unsigned char *)cachePath, cachePath.length() + 1);
00246             return noErr;
00247         }
00248
00249         OSErr err = MacGetSpecialFolder (theFolder, thePath, kPreferencesFolderType, "preferences");
00250         if(err == noErr)
00251         {
00252             cacheFile = theFolder;
00253             cachePath = thePath;
00254         }
00255
00256         return err;
00257     }
00258 #endif /* macintosh */
00259
00260 // very simple diff
00261 static int simple_diff(const char *file1, const char *file2)
00262 {
00263     FILE *f1 = fopen(file1, "rb");
00264     if(f1 == 0L)
00265         return -1;
00266
00267     FILE *f2 = fopen(file2, "rb");
00268     if(f2 == 0L)
00269     {
00270         fclose(f1);
00271         return 1;
00272     }
00273
00274     int res = -1;
00275     char buf1[8000];
00276     char buf2[8000];
00277     size_t num1, num2;
00278     while(!feof(f1) && !feof(f2) && !ferror(f1) && !ferror(f2))
00279     {
00280         num1 = fread(buf1, sizeof(char), 8000, f1);
00281         num2 = fread(buf2, sizeof(char), 8000, f2);
00282         if(num1 != num2 || (res = memcmp(buf1, buf2, num1 * sizeof(char))) != 0)
00283             goto fail;
00284     }
00285
00286     if(ferror(f1) || ferror(f2))
00287         goto fail;
00288
00289     if(feof(f1) ^ feof(f2))
00290         goto fail;
00291
00292     res = 0;
00293 fail:
00294     fclose(f1);
00295     fclose(f2);
00296     return res;
00297 }
00298
00299 bool CPersistent::SaveAllSettings(const char *settingFileName, const char *forPath)
00300 {
00301     UStr tmpSettingsFile(settingFileName);
00302     tmpSettingsFile << "__";
00303     FILE *fd = fopen(tmpSettingsFile, "w");
00304     if(fd == 0L)
00305     {
00306         cvs_err("Failed to open the setting file '%s' for writing (error %d)",
00307             (const char *)tmpSettingsFile, errno);
00308         return false;
00309     }
00310
00311     fprintf(fd, "VERSION=%d\n", 1);
00312
00313     UStr path(forPath);
00314     if(path.endsWith(kPathDelimiter))
00315         path[path.length() - 1] = '\0';
00316     fprintf(fd, "PATH=%s\n", (const char *)path);
00317
00318     fprintf(fd, "AUTHENTICATION=%s\n",
00319         (const char *)Authen::kindToToken(gAuthen.kind()));
00320
00321     fprintf(fd, "CVSROOT=%s\n", (const char *)gCvsPrefs);
00322
00323     std::vector<CPersistentEntry>::const_iterator i;
00324     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00325     {
00326         const CPersistentEntry & entry = *i;
00327         if((entry.fClass & kAddSettings) == 0)
00328             continue;
00329
00330         if(entry.fValue->IsKindOf(URUNTIME_CLASS(CPersistentBool)))
00331         {
00332             CPersistentBool *pbool = (CPersistentBool *)entry.fValue;
00333             bool state = *pbool;
00334             fprintf(fd, "%s=%s\n", entry.fUniqueName, state ? "true" : "false");
00335         }
00336         else if(entry.fValue->IsKindOf(URUNTIME_CLASS(CPersistentInt)))
00337         {
00338             CPersistentInt *pint = (CPersistentInt *)entry.fValue;
00339             int val = *pint;
00340             fprintf(fd, "%s=%d\n", entry.fUniqueName, val);
00341         }
00342         else if(entry.fValue->IsKindOf(URUNTIME_CLASS(PCStr)))
00343         {
00344             PCStr *pstr = (PCStr *)entry.fValue;
00345             const char *str = *pstr;
00346             fprintf(fd, "%s=%s\n", entry.fUniqueName, (const char *)(str == 0L ? "" : str));
00347         }
00348         else if(entry.fValue->IsKindOf(URUNTIME_CLASS(PCPStr)))
00349         {
00350             PCPStr *pstr = (PCPStr *)entry.fValue;
00351             const char *str = *pstr;
00352             fprintf(fd, "%s=%s\n", entry.fUniqueName, (const char *)(str == 0L ? "" : str));
00353         }
00354         else
00355         {
00356             cvs_err("Unknown persistent value '%s'\n", entry.fUniqueName);
00357         }
00358     }
00359     fclose(fd);
00360
00361     if(simple_diff(tmpSettingsFile, settingFileName) == 0)
00362     {
00363         if(unlink(tmpSettingsFile) != 0 && errno != ENOENT)
00364             cvs_err("Could not remove file '%s' (error %d)\n", (const char *)tmpSettingsFile, errno);
00365
00366         return false;
00367     }
00368
00369     if(unlink(settingFileName) != 0 && errno != ENOENT)
00370     {
00371         cvs_err("Could not remove file '%s' (error %d)\n", (const char *)settingFileName, errno);
00372         return false;
00373     }
00374
00375     if(rename(tmpSettingsFile, settingFileName) != 0)
00376     {
00377         cvs_err("Could not rename file '%s' (error %d)\n", (const char *)tmpSettingsFile, errno);
00378         return false;
00379     }
00380
00381     return true;
00382 }
00383
00384 void CPersistent::SaveAll(void)
00385 {
00386 #ifdef macintosh
00387     FSSpec thePrefFile;
00388     short FRef, oldRef;
00389     Handle hdl;
00390     OSErr err;
00391
00392     err = GetPreferencesFile(thePrefFile);
00393     if(err != noErr)
00394     {
00395         cvs_err("Error while searching preference folder (error %d)!\n", err);
00396         return;
00397     }
00398
00399     oldRef = CurResFile();
00400     err = ::FSpDelete(&thePrefFile);
00401     Assert_(err == noErr || err == fnfErr);
00402     ::FSpCreateResFile (&thePrefFile, 'mCVS', 'pref', smRoman);
00403     FRef = FSpOpenResFile(&thePrefFile, fsRdWrPerm);
00404     if(FRef < 0)
00405     {
00406         cvs_err("Error while saving preferences (error %d)!\n", ResError());
00407         return;
00408     }
00409
00410     UseResFile (FRef);
00411     CPStr name;
00412
00413     std::vector<CPersistentEntry>::iterator i;
00414     int resnum = 0;
00415     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00416     {
00417         CPersistentEntry & entry = *i;
00418         int size = entry.fValue->SizeOf();
00419         if(size <= 0)
00420             continue;
00421
00422         //short id = Unique1ID(kCVS_prefID);
00423         name = entry.fUniqueName;
00424
00425         Handle hdl = NewHandle(size);
00426         Assert_(hdl != 0L);
00427         HLock(hdl);
00428         BlockMove(entry.fValue->GetData(), *hdl, size);
00429         HUnlock(hdl);
00430         AddResource(hdl, kCVS_prefID, resnum++, name);
00431         Assert_(ResError() == noErr);
00432         UpdateResFile(FRef);
00433         Assert_(ResError() == noErr);
00434         ReleaseResource(hdl);
00435         Assert_(ResError() == noErr);
00436     }
00437
00438     UseResFile(oldRef);
00439     Assert_(ResError() == noErr);
00440     CloseResFile (FRef);
00441     Assert_(ResError() == noErr);
00442 #endif /* macintosh */
00443 #ifdef WIN32
00444     std::vector<CPersistentEntry>::iterator i;
00445     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00446     {
00447         CPersistentEntry & entry = *i;
00448         unsigned int size = entry.fValue->SizeOf();
00449         if(size == 0)
00450             continue;
00451
00452         if(!AfxGetApp()->WriteProfileBinary(PROFILE_NAME, entry.fUniqueName,
00453             (BYTE *)entry.fValue->GetData(), size))
00454         {
00455             cvs_err("Error while saving preferences !\n");
00456             break;
00457         }
00458     }
00459 #endif /* WIN32 */
00460 #ifdef qUnix
00461     CStr home;
00462     home = gCvsPrefs.Home();
00463     if(!home.endsWith(kPathDelimiter))
00464         home << kPathDelimiter;
00465     home << ".gcvsrc";
00466     FILE *out = fopen(home, "wb");
00467     if(out == 0L)
00468     {
00469         cvs_err("Unable to open '%s' for writing (error %d)", (char *)home, errno);
00470         return;
00471     }
00472     int version = 1;
00473     fwrite(&version, sizeof(int), 1, out);
00474     int numEntries = fAllEntries->size();
00475     fwrite(&numEntries, sizeof(int), 1, out);
00476     std::vector<CPersistentEntry>::iterator i;
00477     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00478     {
00479         CPersistentEntry & entry = *i;
00480         unsigned int size = entry.fValue->SizeOf();
00481
00482         fwrite(entry.fUniqueName, sizeof(char), strlen(entry.fUniqueName) + 1, out);
00483         fwrite(&size, sizeof(unsigned int), 1, out);
00484         fwrite(entry.fValue->GetData(), 1, size, out);
00485     }
00486
00487     if(ferror(out))
00488         cvs_err("Error while writing '%s' (error %d)", (char *)home, errno);
00489     fclose(out);
00490 #endif /* qUnix */
00491
00492     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00493     {
00494         CPersistentEntry & entry = *i;
00495         entry.fValue->ResetTimeStamp();
00496     }
00497 }
00498
00499 bool CPersistent::LoadAll(void)
00500 {
00501 #ifdef macintosh
00502     FSSpec thePrefFile;
00503     short FRef, oldRef;
00504     Handle hdl;
00505     OSErr err;
00506
00507     err = GetPreferencesFile(thePrefFile);
00508     if(err != noErr)
00509         return false;
00510
00511     oldRef = CurResFile();
00512     FRef = FSpOpenResFile(&thePrefFile, fsRdPerm);
00513     if(FRef < 0)
00514         return false;
00515
00516     CPStr name;
00517     UseResFile(FRef);
00518
00519     std::vector<CPersistentEntry>::iterator i;
00520     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00521     {
00522         CPersistentEntry & entry = *i;
00523         name = entry.fUniqueName;
00524
00525         Handle hdl = Get1NamedResource(kCVS_prefID, name);
00526         if(hdl == 0L)
00527             continue;
00528
00529         HLock(hdl);
00530         entry.fValue->SetData(*hdl, GetHandleSize(hdl));
00531         entry.fValue->ResetTimeStamp();
00532         HUnlock(hdl);
00533     }
00534
00535     CloseResFile (FRef);
00536     UseResFile(oldRef);
00537     return true;
00538 #endif /* macintosh */
00539 #ifdef WIN32
00540     bool found_one = false;
00541     std::vector<CPersistentEntry>::iterator i;
00542     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00543     {
00544         CPersistentEntry & entry = *i;
00545         BYTE* ppData;
00546         UINT pBytes;
00547
00548         if(!AfxGetApp()->GetProfileBinary(PROFILE_NAME, entry.fUniqueName,
00549             &ppData, &pBytes))
00550         {
00551             continue;
00552         }
00553         found_one = true;
00554         entry.fValue->SetData(ppData, pBytes);
00555         entry.fValue->ResetTimeStamp();
00556         delete ppData;
00557     }
00558     return found_one;
00559 #endif /* WIN32 */
00560 #ifdef qUnix
00561     CStr home;
00562     home = gCvsPrefs.Home();
00563     if(!home.endsWith(kPathDelimiter))
00564         home << kPathDelimiter;
00565     home << ".gcvsrc";
00566     FILE *out = fopen(home, "rb");
00567     if(out == 0L)
00568         return false;
00569
00570     int version;
00571     int numEntries;
00572     CStaticAllocT<char> alloc;
00573
00574     fread(&version, sizeof(int), 1, out);
00575     if(version != 1)
00576     {
00577         cvs_err("Unexpected version %d in the file '%s'\n", version, (char *)home);
00578         goto close;
00579     }
00580     fread(&numEntries, sizeof(int), 1, out);
00581     if(numEntries < 0)
00582     {
00583         cvs_err("Unexpected # %d in the file '%s'\n", numEntries, (char *)home);
00584         goto close;
00585     }
00586     for(int i = 0; i < numEntries; i++)
00587     {
00588         CStr name;
00589         while(!feof(out) && !ferror(out))
00590         {
00591             int c = getc(out);
00592             name << (char)c;
00593             if(c == '\0')
00594                 break;
00595         }
00596         if(feof(out))
00597         {
00598             cvs_err("Unexpected end of file in '%s'\n", (char *)home);
00599             goto close;
00600         }
00601         if(ferror(out))
00602         {
00603             cvs_err("Unexpected error %d in '%s'\n", errno, (char *)home);
00604             goto close;
00605         }
00606         CPersistentEntry * entry = CPersistent::Find(name);
00607         if(entry == 0L)
00608         {
00609             cvs_err("Unexpected token '%s' in '%s'\n", (char *)name, (char *)home);
00610         }
00611
00612         unsigned int size;
00613         fread(&size, sizeof(unsigned int), 1, out);
00614
00615         alloc.AdjustSize(size);
00616         fread((char *)alloc, 1, size, out);
00617         if(entry != 0L)
00618         {
00619             entry->fValue->SetData((char *)alloc, size);
00620             entry->fValue->ResetTimeStamp();
00621         }
00622     }
00623
00624     if(ferror(out))
00625         cvs_err("Error while reading '%s' (error %d)", (char *)home, errno);
00626     fclose(out);
00627     return true;
00628 close:
00629     fclose(out);
00630 #endif /* qUnix */
00631     return false;
00632 }
00633
00634 CPersistent::CPersistentEntry * CPersistent::Find(const char *uniqueName)
00635 {
00636     std::vector<CPersistentEntry>::iterator i;
00637     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00638     {
00639         CPersistentEntry & entry = *i;
00640         if(!strcmp(uniqueName, entry.fUniqueName))
00641             return &entry;
00642     }
00643     return 0L;
00644 }
00645
00646 bool CPersistent::NeedSave(bool onlySettings)
00647 {
00648     std::vector<CPersistentEntry>::const_iterator i;
00649     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00650     {
00651         const CPersistentEntry & entry = *i;
00652         if(onlySettings && (entry.fClass & kAddSettings) == 0)
00653             continue;
00654
00655         if(entry.fValue->fTimeStamp != 0)
00656             return true;
00657     }
00658     return false;
00659 }
00660
00661 #if !qMPWCvs
00662 //
00663 // Settings management
00664 //
00665
00666 #define SETTINGS_FOLDER "Settings"
00667
00668 static bool SettingsGetLoc(CStr & path)
00669 {
00670     struct stat sb;
00671
00672     path = "";
00673 #ifdef WIN32
00674     CWincvsApp* pApp = (CWincvsApp *)AfxGetApp();
00675     pApp->GetAppPath(path);
00676     if(!path.empty() && !path.endsWith(kPathDelimiter))
00677     {
00678         path << kPathDelimiter;
00679     }
00680     path << SETTINGS_FOLDER;
00681 #elif defined(qUnix)
00682     path = gCvsPrefs.Home();
00683     if(!path.endsWith(kPathDelimiter))
00684         path << kPathDelimiter;
00685     path << ".gcvs";
00686
00687     if(stat(path, &sb) != -1)
00688     {
00689         if(!S_ISDIR(sb.st_mode))
00690         {
00691             cvs_err("The file '%s' already exists and is not a directory", (char *)path, errno);
00692             return false;
00693         }
00694     }
00695     else if(mkdir(path, 0750) != 0)
00696     {
00697         cvs_err("Unable to create the directory '%s' (error %d)", (char *)path, errno);
00698         return false;
00699     }
00700
00701     if(!path.endsWith(kPathDelimiter))
00702         path << kPathDelimiter;
00703     path << SETTINGS_FOLDER;
00704 #else
00705 #   ifdef qMacCvsPP
00706     path = CMacCvsApp::GetAppPath();
00707 #   endif /* qMacCvsPP */
00708
00709     if(!path.empty() && !path.endsWith(kPathDelimiter))
00710     {
00711         path << kPathDelimiter;
00712     }
00713     path << SETTINGS_FOLDER;
00714 #endif
00715
00716     if(stat(path, &sb) != -1 && S_ISDIR(sb.st_mode))
00717         return true;
00718
00719 #if qUnix
00720     if(mkdir(path, 0750) != 0)
00721 #else
00722     if(mkdir(path) != 0)
00723 #endif
00724     {
00725         cvs_err("Failed to create the setting folder '%s' (error %d)",
00726             (const char *)path, errno);
00727         return false;
00728     }
00729     return true;
00730 }
00731
00732 class USaveSettings : public UWidget
00733 {
00734 public:
00735     UDECLARE_DYNAMIC(USaveSettings)
00736 public:
00737     USaveSettings(const char *path, const char *oldname);
00738     virtual ~USaveSettings();
00739
00740     virtual void DoDataExchange(bool fill);
00741
00742     enum
00743     {
00744 #if qUnix
00745         kOK = EV_COMMAND_START,
00746         kCancel,
00747         kSettingName,
00748 #else
00749         kSettingName = EV_COMMAND_START,
00750 #endif
00751         kCopyPath,
00752         kCopyFrom,
00753         kCopyList
00754     };
00755
00756     UStr m_settingName;
00757     UStr m_copyFromPath;
00758
00759 protected:
00760     UStr m_path;
00761     UStr m_oldname;
00762     std::map<UStr, UStr> m_list;
00763
00764     ev_msg int OnCopyFrom(void);
00765 #if qUnix
00766     ev_msg int OnOK(void);
00767     ev_msg int OnCancel(void);
00768 #endif
00769
00770     UDECLARE_MESSAGE_MAP()
00771 };
00772
00773 UIMPLEMENT_DYNAMIC(USaveSettings, UWidget)
00774
00775 UBEGIN_MESSAGE_MAP(USaveSettings, UWidget)
00776     ON_UCOMMAND(USaveSettings::kCopyFrom, USaveSettings::OnCopyFrom)
00777 #if qUnix
00778     ON_UCOMMAND(USaveSettings::kOK, USaveSettings::OnOK)
00779     ON_UCOMMAND(USaveSettings::kCancel, USaveSettings::OnCancel)
00780 #endif
00781 UEND_MESSAGE_MAP()
00782
00783 #if qUnix
00784 int USaveSettings::OnOK(void)
00785 {
00786     EndModal(true);
00787     return 0;
00788 }
00789
00790 int USaveSettings::OnCancel(void)
00791 {
00792     EndModal(false);
00793     return 0;
00794 }
00795 #endif
00796
00797 USaveSettings::USaveSettings(const char *path, const char *oldname) :
00798     UWidget(::UEventGetWidID()), m_path(path), m_oldname(oldname)
00799 {
00800 }
00801
00802 USaveSettings::~USaveSettings()
00803 {
00804 }
00805
00806 static bool GetAllPersistentSettings(std::map<UStr, UStr> & res);
00807
00808 void USaveSettings::DoDataExchange(bool fill)
00809 {
00810     if(fill)
00811     {
00812         UEventSendMessage(GetWidID(), EV_SETTEXT, kCopyPath,
00813             (void *)(const char *)m_path);
00814
00815         UStr defname;
00816         if(m_oldname.empty())
00817         {
00818             UStr uppath;
00819             SplitPath(m_path, uppath, defname);
00820         }
00821         else
00822             defname = m_oldname;
00823
00824         UEventSendMessage(GetWidID(), EV_SETTEXT, kSettingName,
00825             (void *)(const char *)defname);
00826
00827         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kCopyList, 0), 0L);
00828
00829         UEventSendMessage(GetWidID(), EV_COMBO_RESETALL, kCopyList, 0L);
00830
00831         if(GetAllPersistentSettings(m_list))
00832         {
00833             std::map<UStr, UStr>::const_iterator i;
00834             for(i = m_list.begin(); i != m_list.end(); ++i)
00835             {
00836                 UEventSendMessage(GetWidID(), EV_COMBO_APPEND, kCopyList,
00837                     (void *)(const char *)(*i).first);
00838             }
00839         }
00840     }
00841     else
00842     {
00843         UEventSendMessage(GetWidID(), EV_GETTEXT, kSettingName,
00844             &m_settingName);
00845         int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCopyFrom, 0L);
00846         if(state)
00847         {
00848             UStr what;
00849             UEventSendMessage(GetWidID(), EV_COMBO_GETSEL, kCopyList, &what);
00850
00851             std::map<UStr, UStr>::const_iterator i;
00852             i = m_list.find(what);
00853             if(i != m_list.end())
00854             {
00855                 m_copyFromPath = (*i).second;
00856             }
00857         }
00858     }
00859 }
00860
00861 int USaveSettings::OnCopyFrom(void)
00862 {
00863     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCopyFrom, 0L);
00864     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kCopyList, state), 0L);
00865     return 1;
00866 }
00867
00868 static bool loadSettingsInternal(const char *fullname,
00869     bool (*func)(const char *token, const char *value, void *data), void *data)
00870 {
00871     bool res = false;
00872     int line_length;
00873     char *line = 0L;
00874     size_t line_chars_allocated = 0;
00875     FILE *fp = fopen(fullname, "r");
00876
00877     if(fp == 0L)
00878     {
00879         cvs_err("Failed to open the setting file '%s' for reading (error %d)",
00880             fullname, errno);
00881         goto fail;
00882     }
00883
00884     while ((line_length = getline (&line, &line_chars_allocated, fp)) > 0)
00885     {
00886         // read each token=value
00887         char *tmp = 0L;
00888
00889         if((tmp = strchr(line, '\n')) != 0L)
00890             *tmp = '\0';
00891
00892         tmp = line;
00893         while(isspace(*tmp) && *tmp != '\0')
00894             tmp++;
00895         if(*tmp == '\0' || *tmp == '#')
00896             continue;
00897
00898         UStr token;
00899         UStr value;
00900         const char *tmp2 = strchr(tmp, '=');
00901         if(tmp2 == 0L)
00902             continue;
00903
00904         token.set(tmp, tmp2 - tmp);
00905         value = tmp2 + 1;
00906
00907         // check version
00908         if(strcmp(token, "VERSION") == 0)
00909         {
00910             if(atoi(value) != 1)
00911             {
00912                 cvs_err("Newer format than expected in the setting file '%s'\n", fullname);
00913                 goto fail;
00914             }
00915             continue;
00916         }
00917
00918         if(func(token, value, data))
00919             break;
00920     }
00921
00922     if (line_length < 0 && !feof (fp))
00923     {
00924         cvs_err("Cannot read file (error %d)\n", errno);
00925         goto fail;
00926     }
00927
00928     res = true;
00929 fail:
00930     if(line != 0L)
00931         free(line);
00932     if(fp!= 0L)
00933         fclose(fp);
00934     return res;
00935 }
00936
00937 static void getSettingName(const char *fromfile, UStr & res)
00938 {
00939     CStr base, ext, uppath, filename;
00940     SplitPath(fromfile, uppath, filename);
00941     GetExtension(filename, base, ext);
00942     if(!base.empty() && stricmp(ext, "txt") == 0)
00943         res = base;
00944     else
00945         res = filename;
00946 }
00947
00948 class CFindSettings : public TraversalReport
00949 {
00950 public:
00951     CFindSettings(const char *findPath) : m_pathToFind(findPath), m_list(0L)
00952     {
00953         if(m_pathToFind.endsWith(kPathDelimiter))
00954             m_pathToFind[m_pathToFind.length() - 1] = '\0';
00955     }
00956
00957     CFindSettings(std::map<UStr, UStr> & list) : m_list(&list)
00958     {
00959     }
00960
00961     virtual ~CFindSettings() {}
00962
00963     virtual kTraversal OnError(const char *err, int errcode)
00964     {
00965         cvs_err(err);
00966         cvs_err("\n");
00967         return kTraversalError;
00968     }
00969
00970     virtual kTraversal OnFile(const char *fullpath,
00971         const char *fullname,
00972         const char *name,
00973         const struct stat & dir, const FSSpec * macspec);
00974
00975     static bool searchPath(const char *token, const char *value, void *data);
00976     static bool searchAllPath(const char *token, const char *value, void *data);
00977
00978     UStr m_pathToFind;
00979     UStr m_fullname;
00980     bool m_foundIt;
00981     std::map<UStr, UStr> *m_list;
00982 };
00983
00984 bool CFindSettings::searchPath(const char *token, const char *value, void *data)
00985 {
00986     CFindSettings *loader = (CFindSettings *)data;
00987     if(strcmp(token, "PATH") == 0 &&
00988 #if qUnix
00989         strncmp(value, loader->m_pathToFind, strlen(value)) == 0
00990 #else
00991         strnicmp(value, loader->m_pathToFind, strlen(value)) == 0
00992 #endif
00993         )
00994     {
00995         loader->m_foundIt = true;
00996         return true;
00997     }
00998     return false;
00999 }
01000
01001 bool CFindSettings::searchAllPath(const char *token, const char *value, void *data)
01002 {
01003     CFindSettings *loader = (CFindSettings *)data;
01004     if(strcmp(token, "PATH") == 0)
01005     {
01006         getSettingName(loader->m_fullname, loader->m_fullname);
01007         std::map<UStr, UStr>::value_type v(loader->m_fullname, UStr(value));
01008         loader->m_list->insert(v);
01009         return true;
01010     }
01011     return false;
01012 }
01013
01014 kTraversal CFindSettings::OnFile(const char *fullpath,
01015         const char *fullname,
01016         const char *name,
01017         const struct stat & dir, const FSSpec * macspec)
01018 {
01019     m_foundIt = false;
01020     if(m_list == 0L)
01021     {
01022         loadSettingsInternal(fullname, searchPath, this);
01023     }
01024     else
01025     {
01026         m_fullname = fullname;
01027         loadSettingsInternal(fullname, searchAllPath, this);
01028     }
01029     if(m_foundIt)
01030         m_fullname = fullname;
01031
01032     return m_foundIt ? kStopTraversal : kContinueTraversal;
01033 }
01034
01035 static bool GetAllPersistentSettings(std::map<UStr, UStr> & res)
01036 {
01037     UStr settingsDir;
01038     if(!SettingsGetLoc(settingsDir))
01039         return false;
01040
01041     CFindSettings finder(res);
01042     FileTraverse(settingsDir, finder);
01043
01044     return !res.empty();
01045 }
01046
01047 bool HasPersistentSettings(const char *path)
01048 {
01049     UStr settingsDir;
01050     if(!SettingsGetLoc(settingsDir))
01051         return false;
01052
01053     CFindSettings finder(path);
01054     FileTraverse(settingsDir, finder);
01055
01056     return !finder.m_fullname.empty();
01057 }
01058
01059 static bool _loadPersistentSettings(const char *token, const char *value, void *data)
01060 {
01061     if(strcmp(token, "CVSROOT") == 0)
01062     {
01063         gCvsPrefs = value;
01064     }
01065     else if(strcmp(token, "AUTHENTICATION") == 0)
01066     {
01067         gAuthen.setkind(Authen::tokenToKind(value));
01068     }
01069     else if(strcmp(token, "PATH") == 0)
01070     {
01071     }
01072     else
01073     {
01074         CPersistent::CPersistentEntry *entry = CPersistent::Find(token);
01075         if(entry == 0L)
01076         {
01077             //cvs_err("Persistent value '%s' is not registred\n", token);
01078         }
01079         else
01080         {
01081             if(entry->fValue->IsKindOf(URUNTIME_CLASS(CPersistentBool)))
01082             {
01083                 CPersistentBool *pbool = (CPersistentBool *)entry->fValue;
01084                 if(strcmp(value, "true") == 0)
01085                     *pbool = true;
01086                 else if(strcmp(value, "false") == 0)
01087                     *pbool = false;
01088                 else
01089                     cvs_err("Invalid value '%s' for persistent '%s'\n",
01090                         (const char *)value, entry->fUniqueName);
01091             }
01092             else if(entry->fValue->IsKindOf(URUNTIME_CLASS(CPersistentInt)))
01093             {
01094                 CPersistentInt *pint = (CPersistentInt *)entry->fValue;
01095                 int aint;
01096                 int check = sscanf(value, "%d", &aint);
01097                 if(check == 1)
01098                     *pint = aint;
01099                 else
01100                     cvs_err("Invalid value '%s' for persistent '%s'\n",
01101                         (const char *)value, entry->fUniqueName);
01102             }
01103             else if(entry->fValue->IsKindOf(URUNTIME_CLASS(PCStr)))
01104             {
01105                 PCStr *pstr = (PCStr *)entry->fValue;
01106                 *pstr = value;
01107             }
01108             else if(entry->fValue->IsKindOf(URUNTIME_CLASS(PCPStr)))
01109             {
01110                 PCPStr *pstr = (PCPStr *)entry->fValue;
01111                 *pstr = value;
01112             }
01113             else
01114             {
01115                 cvs_err("Unknown persistent value '%s'\n", entry->fUniqueName);
01116             }
01117         }
01118     }
01119
01120     return false;
01121 }
01122
01123 void LoadPersistentSettings(const char *path)
01124 {
01125     UStr settingsDir;
01126     if(!SettingsGetLoc(settingsDir))
01127         return;
01128
01129     CFindSettings finder(path);
01130     FileTraverse(settingsDir, finder);
01131
01132     if(finder.m_fullname.empty())
01133         return;
01134
01135     if(loadSettingsInternal(finder.m_fullname, _loadPersistentSettings, 0L))
01136     {
01137         CColorConsole out;
01138         out << kBold << "Loaded settings for " << kNormal << kUnderline << path << kNormal << kBold << " successfully..." << kNormal << kNL;
01139     }
01140 }
01141
01142 static void SaveAsPersistentSettings(const char *name, const char *path)
01143 {
01144     UStr settingFileName;
01145     if(!SettingsGetLoc(settingFileName))
01146         return;
01147
01148     if(!settingFileName.empty() && !settingFileName.endsWith(kPathDelimiter))
01149         settingFileName << kPathDelimiter;
01150     settingFileName << name;
01151     settingFileName << ".txt";
01152
01153     if(CPersistent::SaveAllSettings(settingFileName, path))
01154     {
01155         CColorConsole out;
01156         out << kBold << "Saved settings for " << kNormal << kUnderline << path << kNormal << kBold << " successfully..." << kNormal << kNL;
01157     }
01158 }
01159
01160 void AskCreatePersistentSettings(const char *path)
01161 {
01162     UStr settingsDir;
01163     if(!SettingsGetLoc(settingsDir))
01164         return;
01165
01166     int id = 0;
01167 #ifdef WIN32
01168     id = IDD_SAVESETTINGS;
01169 #endif
01170 #ifdef qMacCvsPP
01171     id = dlg_SaveSettings;
01172 #endif
01173     CFindSettings finder(path);
01174     FileTraverse(settingsDir, finder);
01175
01176     UStr oldName;
01177
01178     if(!finder.m_fullname.empty())
01179     {
01180         getSettingName(finder.m_fullname, oldName);
01181     }
01182
01183     USaveSettings *dlg = NEW USaveSettings(path, oldName);
01184
01185 #if qUnix
01186     void *wid;
01187 #   if qGTK
01188     wid = UCreate_SettingsDlg();
01189 #   endif
01190
01191     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01192 #endif
01193
01194     if(dlg->DoModal(id))
01195     {
01196         UStr name = dlg->m_settingName;
01197         UStr fileToDelete;
01198
01199         if(!name.empty())
01200         {
01201             if(!oldName.empty())
01202             {
01203                 if(stricmp(oldName, name) != 0)
01204                 {
01205                     UStr prompt("The setting '");
01206                     prompt << oldName;
01207                     prompt << "' already points on the same folder. ";
01208                     prompt << "Press 'Delete' if you want to overide this setting ";
01209                     prompt << "(two settings cannot point on the same location).";
01210                     if(CvsAlert(prompt, "Cancel", "Delete"))
01211                     {
01212                         delete dlg;
01213                         return;
01214                     }
01215                     fileToDelete = finder.m_fullname;
01216                 }
01217             }
01218
01219             if(!dlg->m_copyFromPath.empty())
01220                 LoadPersistentSettings(dlg->m_copyFromPath);
01221             SaveAsPersistentSettings(name, path);
01222
01223             if(!fileToDelete.empty())
01224             {
01225                 if(remove(fileToDelete) != 0)
01226                     cvs_err("Error while deleting '%s' (error %d)\n", (const char *)fileToDelete, errno);
01227             }
01228         }
01229     }
01230     delete dlg;
01231 }
01232
01233 void SavePersistentSettings(const char *path)
01234 {
01235     UStr settingsDir;
01236     if(!SettingsGetLoc(settingsDir))
01237         return;
01238
01239     CFindSettings finder(path);
01240     FileTraverse(settingsDir, finder);
01241
01242     if(finder.m_fullname.empty())
01243         return;
01244
01245     if(CPersistent::SaveAllSettings(finder.m_fullname, path))
01246     {
01247         CColorConsole out;
01248         out << kBold << "Saved settings for " << kNormal << kUnderline << path << kNormal << kBold << " successfully..." << kNormal << kNL;
01249     }
01250 }
01251 #endif // !qMPWCvs
Generated on Sun Oct 21 12:41:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/Persistent.h Source File

common/Persistent.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * Persistent.h --- utilities to store persitent values
00023  */
00024
00025 #ifndef PERSISTENT_H
00026 #define PERSISTENT_H
00027
00028 #include <string.h>
00029 #include <vector>
00030 #include "uobject.h"
00031
00032 #ifdef macintosh
00033 #   include <Files.h>
00034 #endif /* macintosh */
00035
00036 typedef enum
00037 {
00038     kNoClass = 0x00,
00039     kAddSettings = 0x01
00040 } kClassPersistent;
00041
00042 // virtual class to access the persistent data to load/save
00043 class CPersistent : public UObject
00044 {
00045     UDECLARE_DYNAMIC(CPersistent)
00046 public:
00047     CPersistent(const char *uniqueName, kClassPersistent pclass);
00048     virtual ~CPersistent();
00049
00050     virtual unsigned int SizeOf(void) const = 0L;
00051     virtual const void *GetData(void) const = 0L;
00052     virtual void SetData(const void *ptr, unsigned int size) = 0L;
00053         // virtual access
00054
00055     static void SaveAll(void);
00056     static bool LoadAll(void);
00057         // save/load the registred values
00058
00059     static bool SaveAllSettings(const char *settingFileName, const char *forPath);
00060         // save all the persistent values with the class 'kAddSettings'
00061
00062     struct CPersistentEntry
00063     {
00064         const char *fUniqueName;
00065         CPersistent *fValue;
00066         kClassPersistent fClass;
00067     };
00068
00069     static CPersistentEntry * Find(const char *uniqueName);
00070
00071     // handle modification flag (see if we really need to save it)
00072     inline void ResetTimeStamp() { fTimeStamp = 0; }
00073     inline long GetTimeStamp() const { return fTimeStamp; }
00074     inline void TouchTimeStamp() { fTimeStamp++; }
00075
00076     static bool NeedSave(bool onlySettings = false);
00077
00078 private:
00079     static void Register(CPersistent *value, const char *uniqueName,
00080         kClassPersistent pclass);
00081     static void UnRegister(CPersistent *value);
00082         // register/unregister a value to store/load
00083
00084 protected:
00085     long fTimeStamp;
00086     static std::vector<CPersistentEntry> *fAllEntries;
00087 };
00088
00089 #define PERSISTENT_CAST(T) \
00090     inline operator const T &() const {return fValue;} \
00091     inline const T * operator ->() const {return &fValue;} \
00092     inline T & operator=(const T & val) { TouchTimeStamp(); return fValue = val;} \
00093     inline bool operator==(const T & val) const {return fValue == val;}
00094
00095 // this is OK for most of the persistant values
00096
00097 template <class T>
00098 class CPersistentT : public CPersistent
00099 {
00100 public:
00101     CPersistentT(const char *uniqueName, T defValue, kClassPersistent pclass) : CPersistent(uniqueName, pclass)
00102     {
00103         fValue = fDefValue = defValue;
00104     }
00105     virtual ~CPersistentT()
00106     {
00107     }
00108
00109     PERSISTENT_CAST(T)
00110
00111     virtual unsigned int SizeOf(void) const {return sizeof(T);}
00112     virtual const void *GetData(void) const {return &fValue;}
00113     virtual void SetData(const void *ptr, unsigned int size)
00114     {
00115         if(size == sizeof(T))
00116             memcpy(&fValue, ptr, size);
00117     }
00118
00119 protected:
00120     T fDefValue, fValue;
00121 };
00122
00123 class CPersistentBool : public CPersistentT<bool>
00124 {
00125     UDECLARE_DYNAMIC(CPersistentBool)
00126 public:
00127     CPersistentBool(const char *uniqueName, bool defValue,
00128         kClassPersistent pclass = kNoClass) :
00129       CPersistentT<bool>(uniqueName, defValue, pclass)
00130     {
00131     }
00132     virtual ~CPersistentBool()
00133     {
00134     }
00135
00136     PERSISTENT_CAST(bool)
00137 };
00138
00139 class CPersistentInt : public CPersistentT<int>
00140 {
00141     UDECLARE_DYNAMIC(CPersistentInt)
00142 public:
00143     CPersistentInt(const char *uniqueName, int defValue,
00144         kClassPersistent pclass = kNoClass) :
00145             CPersistentT<int>(uniqueName, defValue, pclass)
00146     {
00147     }
00148     virtual ~CPersistentInt()
00149     {
00150     }
00151
00152     PERSISTENT_CAST(int)
00153 };
00154
00155 #ifdef macintosh
00156     OSErr MacGetSpecialFolder(FSSpec & theFolder, Str255 & thePath, OSType inType, const char* inDesc);
00157     OSErr MacGetTempFolder(FSSpec & theFolder, Str255 & thePath);
00158     OSErr MacGetPrefsFolder(FSSpec & theFolder, Str255 & thePath);
00159 #endif /* macintosh */
00160
00161 #ifdef WIN32
00162 #   define PROFILE_NAME "CVS settings"
00163 #endif /* WIN32 */
00164
00165 // Persistent settings API
00166 void LoadPersistentSettings(const char *path);
00167 bool HasPersistentSettings(const char *path);
00168 void AskCreatePersistentSettings(const char *path);
00169 void SavePersistentSettings(const char *path);
00170
00171 #endif /* PERSISTENT_H */
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/PromptFiles.cpp Source File

common/PromptFiles.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * PromptFiles.cpp --- class to pick set of files and folder
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef macintosh
00028 #   include "GUSIInternal.h"
00029 #   include "GUSIFileSpec.h"
00030 #   include <string.h>
00031 #   include <TextUtils.h>
00032 #   include <LowMem.h>
00033 #   include "stdfolder.h"
00034 #   include "stdmfiles.h"
00035 #   include "VolsPaths.h"
00036 #endif /* macintosh */
00037
00038 #if qMacPP
00039 #   include <UConditionalDialogs.h>
00040 #   include <UNavServicesDialogs.h>
00041 #endif
00042
00043 #include "PromptFiles.h"
00044 #include "MultiFiles.h"
00045 #include "AppConsole.h"
00046
00047 #ifdef qQT
00048 #   include "qcvsapp.h"
00049 #   include "CPStr.h"
00050 #   include "TextBinary.h"
00051 #   include <qfiledialog.h>
00052 #   include <vector>
00053 #   include <stdlib.h>
00054 #endif /* qQT */
00055
00056 #ifdef qGTK
00057 #   include <gtk/gtk.h>
00058 #   include <sys/stat.h>
00059 #   include "TextBinary.h"
00060 #endif /* qGTK */
00061
00062 #ifdef WIN32
00063 #   ifdef _DEBUG
00064 #   define new DEBUG_NEW
00065 #   undef THIS_FILE
00066     static char THIS_FILE[] = __FILE__;
00067 #   endif
00068 #endif /* WIN32 */
00069
00070 #ifdef macintosh
00071     const char *
00072     BrowserGetDirectory(const char *prompt)
00073     {
00074 #   if qMacPP
00075 #       if !qCarbon
00076         if(UConditionalDialogs::UseNavServices())
00077 #       else
00078         if(1)
00079 #       endif
00080         {
00081             UNavServicesDialogs::LFileChooser chooser;
00082
00083             FSSpec folderReply;
00084             SInt32 outFolderDirID;
00085             if(!chooser.AskChooseFolder(folderReply, outFolderDirID))
00086                 return 0L;
00087
00088             static char cres[256];
00089             GUSIFileSpec dirSpec(folderReply);
00090             strcpy(cres, dirSpec.FullPath());
00091             return cres;
00092         }
00093 #   endif
00094 #   if !qCarbon
00095         FSSpec folderReply;
00096         Point apt = {-1, -1};
00097         Str255 pprompt;
00098
00099         strcpy((char *)pprompt, prompt);
00100         c2pstr((char *)pprompt);
00101         if(!SF_PromptForFolder(apt, pprompt, &folderReply))
00102             return NULL;
00103
00104         GUSIFileSpec spec = folderReply;
00105
00106         static char aPath[512];
00107         strcpy(aPath, spec.FullPath());
00108         if(spec.Error() != noErr)
00109         {
00110             cvs_err("MacCvs: Unable to convert path name\n");
00111             return NULL;
00112         }
00113
00114         return aPath;
00115 #   else
00116         return 0L;
00117 #   endif
00118     }
00119
00120     // enumerate the multiple files
00121     extern "C" {
00122         static void
00123         MacEnumFiles_hook(FSSpec *newFile, MultiFiles *mf)
00124         {
00125             char cname[64];
00126             p2cstrcpy(cname, newFile->name);
00127             mf->newfile(cname, newFile);
00128         }
00129     }
00130
00131     // prompt for multiple files
00132     bool
00133     BrowserGetMultiFiles(const char *prompt, MultiFiles & mf)
00134     {
00135         StandardFileReply newFileReply;
00136         Point apt = {-1, -1};
00137         Str255 pprompt;
00138
00139         c2pstrcpy(pprompt, prompt);
00140
00141         if(!SF_PromptForMFiles(apt, pprompt))
00142             return false;
00143
00144         SF_PFMF_INFO info;
00145         FSSpec dirSpec;
00146
00147         SF_PFMF_BeginTraversal(&info);
00148         while(1)
00149         {
00150             if(!SF_PFMF_GetCurrentDir(&info, &dirSpec))
00151                 break;
00152
00153             char aPath[255];
00154             GUSIFileSpec spec = dirSpec;
00155             strcpy(aPath, spec.FullPath());
00156             if(spec.Error() != noErr)
00157             {
00158                 cvs_err("MacCvs: Unable to convert path name\n");
00159                 return false;
00160             }
00161             mf.newdir(aPath);
00162
00163             if(!SF_PFMF_DoTraversal(&info, true, NULL, (SF_PFMF_HOOK)MacEnumFiles_hook, &mf))
00164                 return false;
00165         }
00166         SF_PFMF_EndTraversal(&info);
00167
00168         return true;
00169     }
00170 #endif /* macintosh */
00171
00172 #ifdef WIN32
00173 #   if oldWay
00174
00175     static BOOL CALLBACK APIENTRY
00176     MyDirOpen(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
00177     {
00178         switch (message)
00179         {
00180             case WM_INITDIALOG:
00181                 {
00182                     LPOPENFILENAME pofn = (LPOPENFILENAME)lParam;
00183                     if(pofn && pofn->lpstrTitle)
00184                     {
00185                         SetDlgItemText (hDlg, 1090, pofn->lpstrTitle);
00186                     }
00187                     return TRUE;
00188                 }
00189             case WM_COMMAND:
00190                 {
00191                     if (LOWORD(wParam) == IDOK)
00192                     {
00193                         EndDialog(hDlg, wParam);
00194                         return TRUE;
00195                     }
00196                 }
00197         }
00198         return FALSE;
00199     }
00200
00201     bool BrowserGetDirectory(const char * prompt, char* fileName, int size)
00202     {
00203         OPENFILENAME ofn;
00204
00205         // set default informations
00206         memset(&ofn, 0, sizeof(OPENFILENAME));
00207         ofn.lStructSize     = sizeof(OPENFILENAME);
00208         ofn.hwndOwner       = *AfxGetMainWnd();
00209         ofn.lpstrFilter     = NULL;
00210         ofn.nFilterIndex    = 0;
00211         ofn.lpstrFile       = fileName;
00212         ofn.nMaxFile        = size;
00213         ofn.lpstrFileTitle  = NULL;
00214         ofn.nMaxFileTitle   = 0;
00215         ofn.lpstrInitialDir = (fileName[0]) ? fileName : NULL;
00216         ofn.lpstrTitle      = prompt;
00217         ofn.lpTemplateName  = "MYFOLDEROPENORD";
00218         ofn.hInstance       = AfxGetResourceHandle();
00219         ofn.lpfnHook        =  (LPOFNHOOKPROC)MyDirOpen;
00220         ofn.Flags = OFN_ENABLEHOOK | OFN_ENABLETEMPLATE;
00221
00222         if (GetOpenFileName( &ofn ))
00223         {
00224             GetCurrentDirectory(size, fileName);
00225             return true;
00226         }
00227         else
00228         {
00229             // LM
00230             TRACE("Retrun error of GetOpenFileName() = %0x\n", CommDlgExtendedError());
00231             // CDERR_DIALOGFAILURE
00232         }
00233
00234         return false;
00235     }
00236 #   else // !oldWay
00237
00238     bool BrowserGetDirectory(const char* prompt, char* fileName, int size, CWnd* pParentWnd)
00239     {
00240         CCJShell m_shell;
00241         m_shell.m_strTitle = (prompt) ? prompt : "";
00242
00243         if (fileName[0])
00244         {
00245             m_shell.m_strSelDir = fileName;
00246         }
00247
00248         if( m_shell.BrowseForFolder(pParentWnd != 0L ? pParentWnd : AfxGetMainWnd()) )
00249         {
00250             lstrcpyn(fileName, m_shell.m_strPath, size);
00251             return true;
00252         }
00253
00254         return false;
00255     }
00256 #   endif // !oldWay
00257
00258     static char sDefaultPath[MAX_PATH];
00259
00260     const char *
00261     BrowserGetDirectory(const char *prompt, CWnd* pParentWnd)
00262     {
00263         BOOL selected = BrowserGetDirectory(prompt, sDefaultPath, MAX_PATH, pParentWnd);
00264         return (selected) ? sDefaultPath : NULL;
00265     }
00266
00267
00268     bool BrowserGetMultiFiles(const char *prompt, MultiFiles & mf, const char* lpszFilter)
00269     {
00270         bool result = false;
00271         CFileDialog fd(true, NULL, NULL,
00272             OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT |
00273             OFN_FILEMUSTEXIST,
00274             lpszFilter );
00275
00276         fd.m_ofn.nMaxFile = 38000 * sizeof(char);
00277         fd.m_ofn.lpstrFile = (char *)malloc(fd.m_ofn.nMaxFile * sizeof(char));
00278         fd.m_ofn.lpstrTitle = prompt;
00279         fd.m_ofn.lpstrInitialDir = sDefaultPath[0] != '\0' ? sDefaultPath : NULL;
00280         fd.m_ofn.nMaxFileTitle   = 38000;
00281         fd.m_ofn.lpstrFileTitle  = (char *)malloc(fd.m_ofn.nMaxFileTitle * sizeof(char));
00282         if(fd.m_ofn.lpstrFile == NULL || fd.m_ofn.lpstrFileTitle == NULL)
00283         {
00284             cvs_err("Impossible to allocate %d bytes !\n", 38000 * sizeof(char));
00285             exit(1);
00286         }
00287
00288         // add the directory and the files
00289         fd.m_ofn.lpstrFile[0] = '\0';
00290         fd.m_ofn.lpstrFileTitle[0] = '\0';
00291         if(fd.DoModal() == IDOK)
00292         {
00293             GetCurrentDirectory(sizeof(sDefaultPath), sDefaultPath);
00294             const char *tmp = fd.m_ofn.lpstrFile;
00295             if(fd.m_ofn.lpstrFileTitle[0] == '\0')
00296             {
00297                 mf.newdir(tmp);
00298                 tmp += strlen(tmp) + 1;
00299                 while(tmp[0] != '\0')
00300                 {
00301                     mf.newfile(tmp);
00302                     tmp += strlen(tmp) + 1;
00303                 }
00304             }
00305             else
00306             {
00307                 mf.newdir(sDefaultPath);
00308                 mf.newfile(tmp + fd.m_ofn.nFileOffset);
00309             }
00310             result = true;
00311         }
00312
00313         free(fd.m_ofn.lpstrFile);
00314         free(fd.m_ofn.lpstrFileTitle);
00315         return result;
00316     }
00317 #endif /* WIN32 */
00318
00319 #ifdef qQT
00320     const char *
00321     BrowserGetDirectory(const char *prompt)
00322     {
00323         QFileDialog::Mode mode = QFileDialog::Directory;
00324         QString start(QDir::currentDirPath());
00325         QString filter("*");
00326         QString caption(prompt);
00327
00328         QFileDialog fd(start, filter, 0, 0L, TRUE );
00329         fd.setMode(mode);
00330         fd.setCaption(caption);
00331         fd.setSelection(start);
00332         if (fd.exec() == QDialog::Accepted)
00333         {
00334             static CStr result;
00335             result = fd.dirPath();
00336             return result;
00337         }
00338         return 0L;
00339     }
00340
00341     extern "C"
00342     {
00343         static int compareCStr(const CStr *s1, const CStr *s2)
00344         {
00345             return strcmp(*s1, *s2);
00346         }
00347     }
00348
00349     bool
00350     BrowserGetMultiFiles(const char *prompt, MultiFiles & mf)
00351     {
00352         QStringList s = QFileDialog::getOpenFileNames();
00353         vector <CStr> allpaths;
00354         QStringList::Iterator f;
00355         for (f = s.begin(); f != s.end(); f++)
00356         {
00357             allpaths.push_back(CStr(*f));
00358         }
00359         if(allpaths.size() == 0)
00360             return false;
00361
00362         qsort(&allpaths[0], allpaths.size(), sizeof(CStr), (int (*)(const void *, const void *))compareCStr);
00363
00364         vector<CStr>::const_iterator i;
00365         CStr uppath, file, oldpath;
00366         for(i = allpaths.begin(); i != allpaths.end(); ++i)
00367         {
00368             SplitPath(*i, uppath, file);
00369             if(strcmp(uppath, oldpath) != 0)
00370                 mf.newdir(uppath);
00371             oldpath = uppath;
00372             mf.newfile(file);
00373         }
00374         return true;
00375     }
00376 #endif /* qQT */
00377
00378 #ifdef qGTK
00379     static CStr gtksel;
00380     static bool gtkModalLoop;
00381
00382     static gint gtkcancel(GtkWidget *widget, gpointer data)
00383     {
00384         gtkModalLoop = false;
00385         return TRUE;
00386     }
00387
00388     static void file_ok_sel (GtkWidget *w, gpointer data)
00389     {
00390         gtkModalLoop = false;
00391         gtksel = gtk_file_selection_get_filename(GTK_FILE_SELECTION (data));
00392     }
00393
00394     static void file_cancel_sel (GtkWidget *w, gpointer data)
00395     {
00396         gtkModalLoop = false;
00397     }
00398
00399     const char *
00400     BrowserGetDirectory(const char *prompt)
00401     {
00402         /* Create a new file selection widget */
00403         GtkWidget *filew = gtk_file_selection_new (prompt);
00404
00405         gtk_signal_connect(GTK_OBJECT(filew), "delete_event",
00406                            GTK_SIGNAL_FUNC(gtkcancel), 0L);
00407
00408         /* Connect the ok_button to file_ok_sel function */
00409         gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
00410                             "clicked", (GtkSignalFunc) file_ok_sel, filew);
00411         gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
00412                             "clicked", (GtkSignalFunc) file_cancel_sel, filew);
00413
00414         gtkModalLoop = true;
00415         gtksel = "";
00416         gtk_widget_show(filew);
00417         gtk_grab_add (filew);
00418         while (gtkModalLoop)
00419         {
00420             gtk_main_iteration_do(TRUE);
00421         }
00422         gtk_grab_remove (filew);
00423         gtk_widget_destroy(filew);
00424
00425         if(!gtksel.empty())
00426         {
00427             static CStr fname;
00428
00429             fname = gtksel;
00430             if(fname.empty())
00431                 return 0L;
00432
00433             struct stat sb;
00434             if (stat(fname, &sb) != -1 && S_ISREG(sb.st_mode))
00435             {
00436                 CStr uppath, file;
00437                 SplitPath(fname, uppath, file);
00438                 fname = uppath;
00439             }
00440
00441             if(fname.endsWith(kPathDelimiter))
00442                 fname[fname.length() - 1] = '\0';
00443
00444             return fname;
00445         }
00446
00447         return 0L;
00448     }
00449
00450     bool
00451     BrowserGetMultiFiles(const char *prompt, MultiFiles & mf)
00452     {
00453         /* Create a new file selection widget */
00454         GtkWidget *filew = gtk_file_selection_new (prompt);
00455
00456         gtk_signal_connect(GTK_OBJECT(filew), "delete_event",
00457                            GTK_SIGNAL_FUNC(gtkcancel), 0L);
00458
00459         /* Connect the ok_button to file_ok_sel function */
00460         gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
00461                             "clicked", (GtkSignalFunc) file_ok_sel, filew);
00462         gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
00463                             "clicked", (GtkSignalFunc) file_cancel_sel, filew);
00464
00465         gtkModalLoop = true;
00466         gtksel = "";
00467         gtk_widget_show(filew);
00468         gtk_grab_add (filew);
00469         while (gtkModalLoop)
00470         {
00471             gtk_main_iteration_do(TRUE);
00472         }
00473         gtk_grab_remove (filew);
00474         gtk_widget_destroy(filew);
00475
00476         if(!gtksel.empty())
00477         {
00478             CStr fname = gtksel;
00479             if(fname.empty())
00480                 return false;
00481
00482             CStr uppath, file;
00483             SplitPath(fname, uppath, file);
00484             mf.newdir(uppath);
00485             mf.newfile(file);
00486
00487             return true;
00488         }
00489
00490         return false;
00491     }
00492 #endif /* qUnix */
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/PromptFiles.h Source File

common/PromptFiles.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * PromptFiles.h --- class to pick set of files and folder
00023  */
00024
00025 #ifndef PROMPTFILES_H
00026 #define PROMPTFILES_H
00027
00028 class MultiFiles;
00029 class CWnd;
00030
00031 #ifdef WIN32
00032 const char *BrowserGetDirectory(const char *prompt, CWnd* pParentWnd = 0L);
00033     // return a directory, the prompt is a caption for the dialog
00034
00035 bool BrowserGetDirectory(const char* prompt, char* fileName, int size, CWnd* pParentWnd = 0L);
00036 // prompts the user for directory selection
00037 // Parameters
00038 //      prompt - dialog caption
00039 //      fileName   - IN  : initial directory
00040 //                   OUT : selected directory if selection done
00041 //      size       - size of the fileName buffer
00042 //      pParentWnd - parent for the dialog, important if you call it from within the dialog
00043 // Return
00044 //  true if selection done, false otherwise
00045 // Notes
00046 //  single-argument version should probably be deprecated after implementing this one
00047 //  on all platforms
00048
00049 bool BrowserGetMultiFiles(const char *prompt, MultiFiles & mf, const char* lpszFilter = NULL);
00050     // return a set of files, sorted by directory (class MultiFiles).
00051 #else
00052 const char *BrowserGetDirectory(const char *prompt);
00053     // return a directory, the prompt is a caption for the dialog
00054
00055 bool BrowserGetMultiFiles(const char *prompt, MultiFiles & mf);
00056     // return a set of files, sorted by directory (class MultiFiles).
00057 #endif /* WIN32 */
00058
00059 #endif /* PROMPTFILES_H */
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/PythonContainer.cpp Source File

common/PythonContainer.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- September 2001
00019  */
00020
00021 #include "stdafx.h"
00022
00023 #include "PythonContainer.h"
00024
00025 #if USE_PYTHON
00026 #include <vector>
00027
00028 PyObject *gCvsguiErr = NULL;
00029
00030 PyRegistry *PyRegistry::m_all = NULL;
00031
00032 PyRegistry::PyRegistry(const char *name, size_t size, destructor d, getattrfunc g,
00033     PyRegistry_InitValues v, PyCFunction c, const char *doc) : m_v(v), m_c(c), m_doc(doc)
00034 {
00035     m_next = m_all;
00036     m_all = this;
00037
00038     PyTypeObject deftype =
00039     {
00040         PyObject_HEAD_INIT(0)
00041         0,
00042         (char *)name,
00043         size,
00044         0, \
00045         d,                           /*tp_dealloc*/
00046         0,                              /*tp_print*/
00047         g,                            /*tp_getattr*/
00048         0,                              /*tp_setattr*/
00049         0,                              /*tp_compare*/
00050         0,                              /*tp_repr*/
00051         0,                              /*tp_as_number*/
00052         0,                              /*tp_as_sequence*/
00053         0,                              /*tp_as_mapping*/
00054     };
00055
00056     m_type = deftype;
00057     m_type.ob_type = GetPyType_Type();
00058 }
00059
00060 PyRegistry::~PyRegistry()
00061 {
00062 }
00063
00064 void PyRegistry::RegisterAllObjects(std::vector<PyMethodDef> & methods)
00065 {
00066     PyRegistry *tmp = m_all;
00067     PyMethodDef def;
00068     while(tmp != 0L)
00069     {
00070         def.ml_name = tmp->m_type.tp_name;
00071         def.ml_meth = tmp->m_c;
00072         def.ml_flags = METH_VARARGS;
00073         def.ml_doc = (char *)tmp->m_doc;
00074
00075         methods.push_back(def);
00076
00077         tmp = tmp->m_next;
00078     }
00079
00080     memset(&def, 0, sizeof(def));
00081     methods.push_back(def);
00082 }
00083
00084 void PyRegistry::CallInitValues(PyObject *d)
00085 {
00086     PyRegistry *tmp = m_all;
00087     while(tmp != 0L)
00088     {
00089         tmp->m_v(d);
00090         tmp = tmp->m_next;
00091     }
00092 }
00093
00094 /* Convenience routine to export an integer value.
00095    For simplicity, errors (which are unlikely anyway) are ignored. */
00096 void PyContainer::RegisterValue(PyObject *d, char *name, int value)
00097 {
00098     PyObject *v = PyInt_FromLong((long) value);
00099     if (v == NULL) {
00100         /* Don't bother reporting this error */
00101         PyErr_Clear();
00102     }
00103     else {
00104         PyDict_SetItemString(d, name, v);
00105         Py_DECREF(v);
00106     }
00107 }
00108
00109 #ifdef WIN32
00110 void PyHandleCvsguiError(CException* e)
00111 {
00112     char tmp[256];
00113     if(e->GetErrorMessage(tmp, sizeof(tmp)))
00114         PyErr_SetString(gCvsguiErr, tmp);
00115     else
00116         PyErr_SetString(gCvsguiErr, "Unknown error");
00117 }
00118 #else
00119 void PyHandleCvsguiError(const std::exception & e)
00120 {
00121     PyErr_SetString(gCvsguiErr, e.what());
00122 }
00123 #endif
00124
00125 void PyHandleCvsguiError(const char *msg)
00126 {
00127     PyErr_SetString(gCvsguiErr, msg);
00128 }
00129
00130 #endif // USE_PYTHON
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/PythonContainer.h Source File

common/PythonContainer.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- September 2001
00019  */
00020
00021 #ifndef __PY_CONTAINER
00022 #define __PY_CONTAINER
00023
00024 #if !defined(USE_PYTHON)
00025 #   define USE_PYTHON 1
00026 #endif
00027
00028 #if defined(WIN32) && !qCvsDebug /* || qCarbon */
00029     // force to not import Python
00030 #   define USE_DL_EXPORT
00031 #endif
00032
00033 #if USE_PYTHON
00034 #include <Python.h>
00035 #include <exception>
00036 #include <vector>
00037 #include "PythonMacros.h"
00038 #include "PythonGlue.impl.h"
00039
00040 typedef void (*PyRegistry_InitValues)(PyObject *d);
00041
00042 /*
00043  * Each C++ for Python has a registry which help us registring
00044  * the object to Python
00045  */
00046
00047 class PyRegistry
00048 {
00049 public:
00050     PyRegistry(const char *name, size_t size, destructor d, getattrfunc g,
00051         PyRegistry_InitValues v, PyCFunction c, const char *doc);
00052     ~PyRegistry();
00053
00054     PyTypeObject m_type;
00055
00056     static void RegisterAllObjects(std::vector<PyMethodDef> & methods);
00057         // initialize each wrapper class and return a method table
00058         // for the module
00059
00060     static void CallInitValues(PyObject *dict);
00061         // give a chance for each container to make some registrations
00062
00063 protected:
00064     PyRegistry *m_next;
00065     PyRegistry_InitValues m_v;
00066     PyCFunction m_c;
00067     const char *m_doc;
00068
00069     static PyRegistry *m_all;
00070 };
00071
00072 /*
00073  * Base for a C++ container wrapper
00074  */
00075
00076 class PyContainer
00077 {
00078 public:
00079     PyContainer() {}
00080     virtual ~PyContainer() {}
00081
00082     virtual PyObject *GetAttr(char *name) { return NULL; }
00083         // overide to implement attributes
00084
00085     static PyObject *True() { Py_INCREF(GetPyTrue()); return GetPyTrue(); }
00086     static PyObject *False() { Py_INCREF(GetPyFalse()); return GetPyFalse(); }
00087     static PyObject *Void() { Py_INCREF(GetPyNone()); return GetPyNone(); }
00088         // goodies for returning void or boolean to python
00089
00090     static void RegisterValue(PyObject *d, char *name, int value);
00091         // register a single constant value in the module dictionary
00092 };
00093
00094 // smart pointer for python PyObject
00095 template <class T>
00096 class PyAutoObject
00097 {
00098 public:
00099     inline PyAutoObject() : m_o(NULL)
00100     {
00101     }
00102
00103     inline PyAutoObject(T *o) : m_o(o)
00104     {
00105         Ref();
00106     }
00107
00108     inline PyAutoObject(PyObject *o) : m_o((T *)o)
00109     {
00110         Ref();
00111     }
00112
00113     inline PyAutoObject(PyAutoObject & obj) : m_o((T *)obj.CopyReturn())
00114     {
00115     }
00116
00117     inline operator T*() const  { return m_o; }
00118
00119     inline ~PyAutoObject()
00120     {
00121         UnRef();
00122     }
00123
00124     inline PyAutoObject & operator=(T *o)
00125     {
00126         UnRef();
00127         m_o = o;
00128         Ref();
00129         return *this;
00130     }
00131
00132     inline PyAutoObject & operator=(PyObject *o)
00133     {
00134         UnRef();
00135         m_o = (T *)o;
00136         Ref();
00137         return *this;
00138     }
00139
00140     inline PyAutoObject & operator=(PyAutoObject & obj)
00141     {
00142         UnRef();
00143         m_o = (T *)obj.CopyReturn();
00144         return *this;
00145     }
00146
00147     inline PyObject *CopyReturn(void)
00148     {
00149         Ref();
00150         return (PyObject *)m_o;
00151     }
00152
00153     inline bool IsValid(void)
00154     {
00155         return m_o != 0L;
00156     }
00157
00158     inline T *operator->(void)
00159     {
00160         return m_o;
00161     }
00162
00163 protected:
00164     inline void Ref(void)
00165     {
00166         if(m_o)
00167             Py_INCREF(m_o);
00168     }
00169
00170     inline void UnRef(void)
00171     {
00172         if(m_o)
00173         {
00174             Py_DECREF(m_o);
00175             m_o = NULL;
00176         }
00177     }
00178
00179     T *m_o;
00180 };
00181
00182 extern PyObject *gCvsguiErr;
00183 #endif // USE_PYTHON
00184
00185 #endif
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/PythonGlue.cpp Source File

common/PythonGlue.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- August 2001
00019  */
00020
00021 /*
00022  * PythonGlue.cpp --- glue to the Python language
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include <stdarg.h>
00028 #include <string.h>
00029 #include <stdlib.h>
00030
00031 #ifdef HAVE_UNISTD_H
00032 #include <unistd.h>
00033 #endif
00034
00035 #ifdef WIN32
00036 #   include "resource.h"
00037 #   include "NoPython.h"
00038 #endif /* WIN32 */
00039
00040 #include "PythonGlue.h"
00041 #include "CvsLog.h"
00042 #include "AppConsole.h"
00043 #include "MacrosSetup.h"
00044 #include "umenu.h"
00045 #include "PythonContainer.h"
00046 #include "PythonImpl.h"
00047 #include "TclGlue.h"
00048 #include "AppGlue.h"
00049 #include "CvsArgs.h"
00050 #include "FileTraversal.h"
00051 #include "AskYesNo.h"
00052 #include "dll_loader.h"
00053 #include "CvsPrefs.h"
00054
00055 #include <Python.h>
00056 #include <osdefs.h>
00057 #if qMacCvsPP
00058 #   include <macglue.h>
00059 #   include "MacCvsApp.h"
00060 #   include "MacCvsConstant.h"
00061 #   include "MacMisc.h"
00062 #endif
00063
00064 #ifdef WIN32
00065 #   ifdef _DEBUG
00066 #   define new DEBUG_NEW
00067 #   undef THIS_FILE
00068     static char THIS_FILE[] = __FILE__;
00069 #   endif
00070 #   include "wincvs_winutil.h"
00071 #endif /* WIN32 */
00072
00073 #ifndef NEW
00074 #define NEW new
00075 #endif
00076
00077 #if USE_PYTHON
00078
00079 PyThreadState *CPython_Interp::m_mainInterpreter = 0L;
00080 static bool gUICacheValid = false;
00081 static std::vector<ENTNODE> gUICache;
00082 static PyObject *gUICacheObj = NULL;
00083
00084 class CPyThreadState
00085 {
00086 public:
00087     CPyThreadState(PyThreadState *p) : m_p(p)
00088     {
00089         m_p = PyThreadState_Swap(p);
00090     }
00091     ~CPyThreadState()
00092     {
00093         PyThreadState_Swap(m_p);
00094     }
00095 protected:
00096     PyThreadState *m_p;
00097 };
00098
00099 enum
00100 {
00101     _stdout_style = 15,
00102     _stderr_style = 16,
00103     _trace_style = 17
00104 };
00105
00106 static PyObject *cvsgui_write(PyObject *self, PyObject *args)
00107 {
00108     char *str;
00109     int style;
00110     PyObject *shell;
00111
00112     if(!PyArg_ParseTuple(args, "siO", &str, &style, &shell))
00113         return NULL;
00114
00115     TRY
00116     {
00117         if(style == _stdout_style)
00118             cvs_outstr(str, strlen(str));
00119         else
00120             cvs_errstr(str, strlen(str));
00121     }
00122     CATCH_ALL(e)
00123     {
00124         PyHandleCvsguiError(e);
00125         return NULL;
00126     }
00127     END_CATCH_ALL
00128
00129     return PyContainer::Void();
00130 }
00131
00132 static PyObject *cvsgui_GetMainMenuWidget(PyObject *self, PyObject *args)
00133 {
00134     int res = 0;
00135
00136     if(!PyArg_ParseTuple(args, ""))
00137         return NULL;
00138
00139     TRY
00140     {
00141     }
00142     CATCH_ALL(e)
00143     {
00144         PyHandleCvsguiError(e);
00145         return NULL;
00146     }
00147     END_CATCH_ALL
00148
00149     return PyInt_FromLong(res);
00150 }
00151
00152 static PyObject *cvsgui_GetTopMacroSelectionMenu(PyObject *self, PyObject *args)
00153 {
00154     static UMENU macroMenu = 0L;
00155
00156     if(!PyArg_ParseTuple(args, ""))
00157         return NULL;
00158
00159     PyAutoObject<PyMenuMgr::obj_t> res = PyMenuMgr::New();
00160     if (!res.IsValid())
00161         return NULL;
00162
00163     TRY
00164     {
00165 #ifdef WIN32
00166         int pos;
00167         if(macroMenu == 0L)
00168         {
00169             CMenu *top = GetMenuEntry(ID_MACRO_SEL, pos);
00170             if(top)
00171             {
00172                 top->DeleteMenu(pos, MF_BYPOSITION);
00173                 macroMenu = (UMENU)(HMENU)*top;
00174             }
00175         }
00176 #endif
00177 #if qMacCvsPP
00178         if(macroMenu == 0L)
00179         {
00180             LMenuBar *menuBar   = LMenuBar::GetCurrentMenuBar();
00181             LMenu *menu = menuBar->FetchMenu(menu_MacroSel);
00182             if(menu)
00183                 macroMenu = menu->GetMenuID();
00184         }
00185 #endif
00186
00187         res->m_object = new PyMenuMgr(macroMenu);
00188     }
00189     CATCH_ALL(e)
00190     {
00191         PyHandleCvsguiError(e);
00192         return NULL;
00193     }
00194     END_CATCH_ALL
00195
00196     return res.CopyReturn();
00197 }
00198
00199 static PyObject *cvsgui_GetTopMacroAdminMenu(PyObject *self, PyObject *args)
00200 {
00201     static UMENU macroMenu = 0L;
00202
00203     if(!PyArg_ParseTuple(args, ""))
00204         return NULL;
00205
00206     PyAutoObject<PyMenuMgr::obj_t> res = PyMenuMgr::New();
00207     if (!res.IsValid())
00208         return NULL;
00209
00210     TRY
00211     {
00212 #ifdef WIN32
00213         int pos;
00214         if(macroMenu == 0L)
00215         {
00216             CMenu *top = GetMenuEntry(ID_MACRO_ADMIN, pos);
00217             if(top)
00218             {
00219                 top->DeleteMenu(pos, MF_BYPOSITION);
00220                 macroMenu = (UMENU)(HMENU)*top;
00221             }
00222         }
00223 #endif
00224 #if qMacCvsPP
00225         if(macroMenu == 0L)
00226         {
00227             LMenuBar *menuBar   = LMenuBar::GetCurrentMenuBar();
00228             LMenu *menu = menuBar->FetchMenu(menu_MacroAdmin);
00229             if(menu)
00230                 macroMenu = menu->GetMenuID();
00231         }
00232 #endif
00233         res->m_object = new PyMenuMgr(macroMenu);
00234     }
00235     CATCH_ALL(e)
00236     {
00237         PyHandleCvsguiError(e);
00238         return NULL;
00239     }
00240     END_CATCH_ALL
00241
00242     return res.CopyReturn();
00243 }
00244
00245 static PyObject *cvsgui_GetSelection(PyObject *self, PyObject *args)
00246 {
00247     if(!PyArg_ParseTuple(args, ""))
00248         return NULL;
00249
00250     if(gUICacheObj != 0L)
00251     {
00252         Py_INCREF(gUICacheObj);
00253         return gUICacheObj;
00254     }
00255
00256     gUICacheObj = PyTuple_New(gUICache.size());
00257     if(gUICacheObj == NULL)
00258         return NULL;
00259
00260     std::vector<ENTNODE>::const_iterator i;
00261     int cnt;
00262     for(cnt = 0, i = gUICache.begin(); i != gUICache.end(); ++i, ++cnt)
00263     {
00264         PyAutoObject<PyCvsEntry::obj_t> res = PyCvsEntry::New();
00265         if (!res.IsValid())
00266             return NULL;
00267
00268         res->m_object = new PyCvsEntry(*i);
00269
00270         PyTuple_SET_ITEM(gUICacheObj, cnt, res.CopyReturn());
00271     }
00272
00273     Py_INCREF(gUICacheObj);
00274     return gUICacheObj;
00275 }
00276
00277 class CFillPyEntries : public TraversalReport
00278 {
00279 public:
00280     CSortList<ENTNODE> & m_entries;
00281     std::vector<CStr> m_ignlist;
00282
00283     CFillPyEntries(CSortList<ENTNODE> & entries) :
00284         m_entries(entries) {}
00285
00286     virtual ~CFillPyEntries() {}
00287
00288     virtual kTraversal EnterDirectory(const char *fullpath, const char *dirname, const FSSpec * macspec)
00289     {
00290         Entries_Open (m_entries, fullpath);
00291         BuildIgnoredList(m_ignlist, fullpath);
00292         return kContinueTraversal;
00293     }
00294
00295     virtual kTraversal ExitDirectory(const char *fullpath)
00296     {
00297         m_ignlist.erase(m_ignlist.begin(), m_ignlist.end());
00298         return kContinueTraversal;
00299     }
00300
00301     virtual kTraversal OnError(const char *err, int errcode)
00302     {
00303         return kTraversalError;
00304     }
00305
00306     virtual kTraversal OnIdle(const char *fullpath)
00307     {
00308         return kContinueTraversal;
00309     }
00310
00311     virtual kTraversal OnDirectory(const char *fullpath,
00312         const char *fullname,
00313         const char *name,
00314         const struct stat & dir, const FSSpec * macspec)
00315     {
00316 #if defined(WIN32) || defined(macintosh)
00317         if(stricmp(name, "CVS") == 0)
00318 #else
00319         if(strcmp(name, "CVS") == 0)
00320 #endif
00321             return kSkipFile;
00322
00323         /*EntnodeData *data = */Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00324
00325         return kSkipFile;
00326     }
00327
00328     virtual kTraversal OnAlias(const char *fullpath,
00329         const char *fullname,
00330         const char *name,
00331         const struct stat & dir, const FSSpec * macspec)
00332     {
00333         return OnFile(fullpath, fullname, name, dir, macspec);
00334     }
00335
00336     virtual kTraversal OnFile(const char *fullpath,
00337         const char *fullname,
00338         const char *name,
00339         const struct stat & dir, const FSSpec * macspec)
00340     {
00341         /*EntnodeData *data = */Entries_SetVisited(fullpath, m_entries, name, dir, false, &m_ignlist);
00342
00343         return kContinueTraversal;
00344     }
00345 };
00346
00347 static PyObject *cvsgui_GetCvsEntries(PyObject *self, PyObject *args)
00348 {
00349     char *path;
00350
00351     if(!PyArg_ParseTuple(args, "s", &path))
00352         return NULL;
00353
00354     CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00355     CFillPyEntries traverse(entries);
00356     /*kTraversal res = */FileTraverse(path, traverse);
00357
00358     // add the missing files
00359     Entries_SetMissing(entries);
00360
00361     int numEntries = entries.NumOfElements();
00362     PyObject *obj = PyTuple_New(numEntries);
00363     if(obj == NULL)
00364         return NULL;
00365
00366     for(int i = 0; i < numEntries; i++)
00367     {
00368         const ENTNODE & theNode = entries.Get(i);
00369         EntnodeData *data = theNode.Data();
00370
00371         PyAutoObject<PyCvsEntry::obj_t> res = PyCvsEntry::New();
00372         if (!res.IsValid())
00373             return NULL;
00374
00375         res->m_object = new PyCvsEntry(data);
00376
00377         PyTuple_SET_ITEM(obj, i, res.CopyReturn());
00378     }
00379
00380     return obj;
00381 }
00382
00383 #if defined(WIN32)
00384 //
00385 // Get correct (UTC) file modification time.
00386 // Used for dealing with notorious DST bug.
00387 //
00388 static PyObject * cvsgui_GetFileModTime(PyObject *self, PyObject *args)
00389 {
00390     struct wnt_stat sb;
00391     struct tm * p_utc = NULL;
00392
00393     const char *path;
00394
00395 // PyObject_Length exists only for debugging version (ActiveState Python 2.1)
00396 #if defined(_DEBUG)
00397     int len = PyObject_Length(args);
00398     if (len < 1)
00399     {
00400         char errstr[255];
00401         sprintf(errstr, "Too few arguments (%d, expected 1)", len);
00402         PyErr_SetString(gCvsguiErr, errstr);
00403         return NULL;
00404     }
00405     else if (len > 1)
00406     {
00407         char errstr[255];
00408         sprintf(errstr, "Too many arguments (%d, expected 1)", len);
00409         PyErr_SetString(gCvsguiErr, errstr);
00410         return NULL;
00411     }
00412 #endif
00413
00414     if(!PyArg_ParseTuple(args, "s", &path))
00415         return NULL;
00416
00417     if (wnt_stat(path, &sb) != 0)
00418     {
00419         char errstr[255];
00420         sprintf(errstr, "Could not find file \"%s\"", path);
00421         PyErr_SetString(gCvsguiErr, errstr);
00422         return NULL;
00423     }
00424
00425     p_utc = gmtime(& sb.st_mtime);
00426     return Py_BuildValue("s", asctime(p_utc));
00427 }
00428 #endif  // defined(_WIN32)
00429
00430 static PyObject *cvsgui_LaunchTclMacro(PyObject *self, PyObject *args)
00431 {
00432     char *macroName;
00433
00434     if(!PyArg_ParseTuple(args, "s", &macroName) || !CTcl_Interp::IsAvail())
00435         return NULL;
00436
00437     std::vector<ENTNODE>::const_iterator i;
00438     TclBrowserReset();
00439     for(i = gUICache.begin(); i != gUICache.end(); ++i)
00440     {
00441         EntnodeData *data = *i;
00442         TclBrowserAppend((*data)[EntnodeData::kPath], data);
00443     }
00444
00445     CTcl_Interp interp;
00446     CStr path = macroName;
00447     CTcl_Interp::Unixfy(path);
00448     interp.DoScriptVar("source \"%s\"", (const char *)path);
00449
00450     return PyContainer::Void();
00451 }
00452
00453 class CBuffer
00454 {
00455 public:
00456     CBuffer() : m_curSize(0)
00457     {
00458     }
00459
00460     void append(const char *ptr, size_t s)
00461     {
00462         if((s + m_curSize) > m_buf.size())
00463         {
00464             size_t step = s > 1024 ? s : 1024;
00465             m_buf.AdjustSize(m_buf.size() + step);
00466         }
00467 #ifdef WIN32
00468         char *tmp = (char *)m_buf + m_curSize;
00469         size_t incs = 0;
00470         while(s--)
00471         {
00472             char c = *ptr++;
00473             if(c == '\r')
00474                 continue;
00475             *tmp++ = c;
00476             incs++;
00477         }
00478         m_curSize += incs;
00479 #elif defined(macintosh)
00480         char *tmp = (char *)m_buf + m_curSize;
00481         size_t cnt = s;
00482         while(cnt--)
00483         {
00484             char c = *ptr++;
00485             if(c == '\r')
00486                 c = '\n';
00487             *tmp++ = c;
00488         }
00489         m_curSize += s;
00490 #else
00491         memcpy((char *)m_buf + m_curSize, ptr, s * sizeof(char));
00492         m_curSize += s;
00493 #endif
00494     }
00495
00496     inline size_t size() const { return m_curSize; }
00497     inline operator char *(void) const { return m_buf; }
00498
00499 protected:
00500     size_t m_curSize;
00501     CStaticAllocT<char> m_buf;
00502 };
00503
00504 class CPyCvsConsole : public CCvsConsole
00505 {
00506 public:
00507     CPyCvsConsole() {}
00508     virtual ~CPyCvsConsole() {}
00509
00510     virtual long cvs_out(char *txt, long len)
00511     {
00512         m_out.append(txt, len);
00513         return len;
00514     }
00515
00516     virtual long cvs_err(char *txt, long len)
00517     {
00518         m_err.append(txt, len);
00519         return len;
00520     }
00521
00522     CBuffer m_out;
00523     CBuffer m_err;
00524 };
00525
00526 static PyObject *cvsgui_PromptMessage(PyObject *self, PyObject *args)
00527 {
00528     char *msg, *title, *ok, *cncl;
00529
00530     if(!PyArg_ParseTuple(args, "ssss", &msg, &title, &ok, &cncl))
00531         return NULL;
00532
00533     bool res;
00534
00535     TRY
00536     {
00537         res = PromptMessage(msg, title, ok, cncl);
00538     }
00539     CATCH_ALL(e)
00540     {
00541         PyHandleCvsguiError(e);
00542         return NULL;
00543     }
00544     END_CATCH_ALL
00545
00546     if(res)
00547     {
00548         return PyContainer::True();
00549     }
00550
00551     return PyContainer::False();
00552 }
00553
00554 static PyObject *cvsgui_PromptEditMessage(PyObject *self, PyObject *args)
00555 {
00556     char *msg, *title, *ok, *cncl, *edit;
00557
00558     if(!PyArg_ParseTuple(args, "sssss", &msg, &edit, &title, &ok, &cncl))
00559         return NULL;
00560
00561     bool res;
00562     UStr ed;
00563
00564     TRY
00565     {
00566         ed = edit;
00567         res = PromptEditMessage(msg, ed, title, ok, cncl);
00568     }
00569     CATCH_ALL(e)
00570     {
00571         PyHandleCvsguiError(e);
00572         return NULL;
00573     }
00574     END_CATCH_ALL
00575
00576     return Py_BuildValue("(is)", res ? 1 : 0, ed.empty() ? "" : ed.c_str());
00577 }
00578
00579 static PyObject *cvsgui_LaunchBrowser(PyObject *self, PyObject *args)
00580 {
00581     char *url;
00582
00583     if(!PyArg_ParseTuple(args, "s", &url))
00584         return NULL;
00585
00586 #ifdef WIN32
00587     ShellExecute(NULL, "open", url, /*postData*/0L, NULL, SW_SHOWNORMAL);
00588 #endif
00589
00590     return PyContainer::Void();
00591 }
00592
00593 static void outputXML(FILE *out, CLogNode *node)
00594 {
00595     switch(node->GetType())
00596     {
00597         case kNodeHeader :
00598         {
00599             fputs("<RCS>\n", out);
00600             const CRcsFile rcs = **(CLogNodeHeader *)node;
00601             fprintf(out, "<RCSFILE>%s</RCSFILE>\n", rcs.RcsFile().c_str());
00602             fprintf(out, "<WORKINGFILE>%s</WORKINGFILE>\n", rcs.WorkingFile().c_str());
00603             fprintf(out, "<HEADREV>%s</HEADREV>\n", rcs.HeadRev().c_str());
00604             fprintf(out, "<BRANCHREV>%s</BRANCHREV>\n", rcs.BranchRev().c_str());
00605             fprintf(out, "<KEYWORDSUBST>%s</KEYWORDSUBST>\n", rcs.KeywordSubst().c_str());
00606             fprintf(out, "<DESCRIPTION>%s</DESCRIPTION>\n", rcs.DescLog().c_str());
00607             fprintf(out, "<SELREVISIONS>%d</SELREVISIONS>\n", rcs.SelRevisions());
00608             fprintf(out, "<TOTREVISIONS>%d</TOTREVISIONS>\n", rcs.TotRevisions());
00609             fprintf(out, "<LOCKSTRICT>%d</LOCKSTRICT>\n", rcs.LockStrict() ? 1 : 0);
00610
00611             fputs("<ACCESSLIST>\n", out);
00612             const std::vector<CLogStr> & ac = rcs.AccessList();
00613             std::vector<CLogStr>::const_iterator i;
00614             for(i = ac.begin(); i != ac.end(); ++i)
00615             {
00616                 fprintf(out, "<ACCESS>%s</ACCESS>\n", (*i).c_str());
00617             }
00618             fputs("</ACCESSLIST>\n", out);
00619
00620             fputs("<SYMBOLICLIST>\n", out);
00621             const std::vector<CRevNumber> & sy = rcs.SymbolicList();
00622             std::vector<CRevNumber>::const_iterator j;
00623             for(j = sy.begin(); j != sy.end(); ++j)
00624             {
00625                 fprintf(out, "<SYMBOLIC>%s</SYMBOLIC>\n", (*j).c_str());
00626             }
00627             fputs("</SYMBOLICLIST>\n", out);
00628
00629             fputs("<LOCKLIST>\n", out);
00630             const std::vector<CRevNumber> & lo = rcs.LocksList();
00631             for(j = lo.begin(); j != lo.end(); ++j)
00632             {
00633                 fprintf(out, "<LOCK>%s</LOCK>\n", (*j).c_str());
00634             }
00635             fputs("</LOCKLIST>\n", out);
00636             break;
00637         }
00638         case kNodeRev :
00639         {
00640             const CRevFile & rev = **(CLogNodeRev *)node;
00641             fputs("<REVISION>\n", out);
00642             fprintf(out, "<NUMBER>%s</NUMBER>\n", rev.RevNum().c_str());
00643             const struct tm & tm = rev.RevTime();
00644             fprintf(out, "<DATE>%d/%d/%d %d:%d:%d</DATE>\n", (tm.tm_year + 1900),
00645                 tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
00646             fprintf(out, "<AUTHOR>%s</AUTHOR>\n", rev.Author().c_str());
00647             fprintf(out, "<STATE>%s</STATE>\n", rev.State().c_str());
00648             fprintf(out, "<CHANGES>+%d%d</CHANGES>\n", rev.ChgPos(), rev.ChgNeg());
00649             fprintf(out, "<DESCRIPTION>%s</DESCRIPTION>\n", rev.DescLog().c_str());
00650
00651             fputs("<BRANCHLIST>\n", out);
00652             const std::vector<CRevNumber> & sy = rev.BranchesList();
00653             std::vector<CRevNumber>::const_iterator j;
00654             for(j = sy.begin(); j != sy.end(); ++j)
00655             {
00656                 fprintf(out, "<REVBRANCH>%s</REVBRANCH>\n", (*j).c_str());
00657             }
00658             fputs("</BRANCHLIST>\n", out);
00659             break;
00660         }
00661         case kNodeBranch :
00662         {
00663             fputs("<BRANCH>\n", out);
00664             const CLogStr & branch = **(CLogNodeBranch *)node;
00665             fprintf(out, "<BRANCHNAME>%s</BRANCHNAME>\n", branch.c_str());
00666             break;
00667         }
00668         case kNodeTag :
00669         {
00670             fputs("<TAG>\n", out);
00671             const CLogStr & tag = **(CLogNodeTag *)node;
00672             fprintf(out, "<TAGNAME>%s</TAGNAME>\n", tag.c_str());
00673             break;
00674         }
00675     }
00676
00677     if(node->Childs().size() > 0)
00678     {
00679         fputs("<REVISIONS>\n", out);
00680         std::vector<CLogNode *>::const_iterator i;
00681         for(i = node->Childs().begin(); i != node->Childs().end(); ++i)
00682         {
00683             outputXML(out, *i);
00684         }
00685         fputs("</REVISIONS>\n", out);
00686     }
00687
00688     switch(node->GetType())
00689     {
00690         case kNodeHeader :
00691             fputs("</RCS>\n", out);
00692             break;
00693         case kNodeRev :
00694             fputs("</REVISION>\n", out);
00695             break;
00696         case kNodeBranch :
00697             fputs("</BRANCH>\n", out);
00698             break;
00699         case kNodeTag :
00700             fputs("</TAG>\n", out);
00701             break;
00702     }
00703
00704     if(node->Next() != 0L)
00705     {
00706         outputXML(out, node->Next());
00707     }
00708 }
00709
00710 static PyObject *cvsgui_GetHistoryAsXML(PyObject *self, PyObject *args)
00711 {
00712     PyObject *logfile, *xmlfile;
00713
00714     if(!PyArg_ParseTuple(args, "O!O!", GetPyFile_Type(), &logfile,
00715         GetPyFile_Type(), &xmlfile))
00716             return NULL;
00717
00718     TRY
00719     {
00720         std::vector<CRcsFile> & allRcs = CvsLogParse(PyFile_AsFile(logfile));
00721
00722         std::vector<CRcsFile>::iterator i;
00723         FILE *xml = PyFile_AsFile(xmlfile);
00724         fputs("<ROOT>\n", xml);
00725         for(i = allRcs.begin(); i != allRcs.end(); ++i)
00726         {
00727             std::auto_ptr<CLogNode> node(CvsLogGraph(*i));
00728             outputXML(xml, node.get());
00729         }
00730         fputs("</ROOT>\n", xml);
00731
00732         CvsLogReset();
00733     }
00734     CATCH_ALL(e)
00735     {
00736         PyHandleCvsguiError(e);
00737         return NULL;
00738     }
00739     END_CATCH_ALL
00740
00741     return PyContainer::Void();
00742 }
00743
00744 static PyObject *cvsgui_RunCvs(PyObject *self, PyObject *args)
00745 {
00746     CvsArgs arg;
00747     PyObject *cargs;
00748     int exitOnError = 1;
00749     int exitc;
00750     CPyCvsConsole console;
00751
00752     if(!PyArg_ParseTuple(args, "O!|i", GetPyTuple_Type(), &cargs, &exitOnError))
00753         return NULL;
00754
00755     TRY
00756     {
00757         int argc = PyTuple_Size(cargs);
00758         for(int i = 0; i < argc; i++)
00759         {
00760             PyObject *o = PyTuple_GET_ITEM(cargs, i);
00761             if(!PyString_Check(o))
00762             {
00763                 PyErr_SetString(gCvsguiErr, "Wrong argument type, should be string");
00764                 return NULL;
00765             }
00766
00767             arg.add(PyString_AsString(o));
00768         }
00769
00770         exitc = launchCVS(0L, arg.Argc(), arg.Argv(), &console);
00771
00772         if(exitOnError && exitc != 0)
00773         {
00774             UStr str;
00775             str.set(console.m_err, console.m_err.size());
00776             str << "cvs returned an non-zero error code (";
00777             str << exitc;
00778             str << ")\n";
00779             PyErr_SetString(gCvsguiErr, str);
00780             return NULL;
00781         }
00782     }
00783     CATCH_ALL(e)
00784     {
00785         PyHandleCvsguiError(e);
00786         return NULL;
00787     }
00788     END_CATCH_ALL
00789
00790     return Py_BuildValue("(is#s#)", exitc, (char *)console.m_out, console.m_out.size(),
00791         (char *)console.m_err, console.m_err.size());
00792 }
00793
00794 static PyMethodDef cvsgui_methods[] =
00795 {
00796     {"write", (PyCFunction)cvsgui_write, METH_VARARGS, ""},
00797     {"GetMainMenuWidget", (PyCFunction)cvsgui_GetMainMenuWidget, METH_VARARGS, ""},
00798     {"GetTopMacroSelectionMenu", (PyCFunction)cvsgui_GetTopMacroSelectionMenu, METH_VARARGS, ""},
00799     {"GetTopMacroAdminMenu", (PyCFunction)cvsgui_GetTopMacroAdminMenu, METH_VARARGS, ""},
00800     {"GetSelection", (PyCFunction)cvsgui_GetSelection, METH_VARARGS, ""},
00801     {"GetCvsEntries", (PyCFunction)cvsgui_GetCvsEntries, METH_VARARGS, ""},
00802 #if defined(WIN32)
00803     {"GetFileModTime", (PyCFunction)cvsgui_GetFileModTime, METH_VARARGS, ""},
00804 #endif
00805     {"LaunchTclMacro", (PyCFunction)cvsgui_LaunchTclMacro, METH_VARARGS, ""},
00806     {"RunCvs", (PyCFunction)cvsgui_RunCvs, METH_VARARGS, ""},
00807     {"PromptMessage", (PyCFunction)cvsgui_PromptMessage, METH_VARARGS, ""},
00808     {"PromptEditMessage", (PyCFunction)cvsgui_PromptEditMessage, METH_VARARGS, ""},
00809     {"LaunchBrowser", (PyCFunction)cvsgui_LaunchBrowser, METH_VARARGS, ""},
00810     {"GetHistoryAsXML", (PyCFunction)cvsgui_GetHistoryAsXML, METH_VARARGS, ""},
00811     {NULL, NULL}
00812 };
00813
00814 static std::vector<PyMethodDef> gAllMethods;
00815
00816 static void InitializeInterp(PyThreadState *interp)
00817 {
00818     CPyThreadState lock(interp);
00819
00820     // first time, create the method table for cvsgui module
00821     if(gAllMethods.empty())
00822     {
00823         PyMethodDef *tmp = cvsgui_methods;
00824         while(tmp->ml_name)
00825         {
00826             gAllMethods.push_back(*tmp);
00827             tmp++;
00828         }
00829
00830         PyRegistry::RegisterAllObjects(gAllMethods);
00831     }
00832
00833     // this module contains the glue code functions
00834     PyObject *m = Py_InitModule4("_cvsgui", &gAllMethods[0],
00835         "The cvsgui glue functions", (PyObject*)NULL,PYTHON_API_VERSION);
00836
00837     if(m == NULL)
00838     {
00839         cvs_err("Could not create the Python cvsgui module !\n");
00840         return;
00841     }
00842
00843     // this is the exception we raised when the error comes from us
00844     PyObject *d = PyModule_GetDict(m);
00845     if(gCvsguiErr == NULL)
00846         gCvsguiErr = PyErr_NewException("_cvsgui.error", NULL, NULL);
00847     if (gCvsguiErr != NULL)
00848         PyDict_SetItemString(d, "error", gCvsguiErr);
00849
00850     PyRegistry::CallInitValues(d);
00851
00852     // Ideally we need to use Jonathan's mechanism
00853     PyObject *ver = PyString_FromString("1.3");
00854     if (ver != NULL) {
00855         PyDict_SetItemString(d, "CVSGUI_VERSION", ver);
00856         Py_DECREF(ver);
00857     }
00858
00859     char *script = NULL;
00860
00861 #ifdef WIN32
00862     HINSTANCE hInst = ::AfxGetInstanceHandle();
00863     HRSRC rsrc = FindResource(hInst, "PYSHELL", "PYSCRIPT");
00864
00865     if(rsrc)
00866     {
00867         HGLOBAL h = LoadResource(hInst, rsrc);
00868         if(h)
00869         {
00870             DWORD size = SizeofResource(hInst, rsrc);
00871             script = (char *)malloc(size + 1);
00872             char *ptr = (char *)LockResource(h);
00873
00874             if(script)
00875             {
00876                 char *tmp = script;
00877                 while(size--)
00878                 {
00879                     char c = *ptr++;
00880                     if(c == '\r')
00881                         continue;
00882                     *tmp++ = c;
00883                 }
00884                 *tmp = '\0';
00885             }
00886
00887             FreeResource(h);
00888         }
00889     }
00890
00891 #endif // WIN32
00892 #if qMacCvsPP
00893     StResource rsrcH(FOUR_CHAR_CODE('PYTH'), 128);
00894     size_t size = GetHandleSize(rsrcH);
00895     script = (char *)malloc(size + 1);
00896     if(script)
00897     {
00898         char *ptr = (char *)*rsrcH;
00899         char *tmp = script;
00900         while(size--)
00901         {
00902             char c = *ptr++;
00903             if(c == '\r')
00904                 c = '\n';
00905             *tmp++ = c;
00906         }
00907         *tmp = '\0';
00908     }
00909 #endif
00910
00911     // augment the library path of python with our library
00912     CStr ourLibPath;
00913     PythonLibGetLoc(ourLibPath);
00914
00915     UStr libPath = Py_GetPath();
00916     if(!ourLibPath.empty())
00917     {
00918         libPath << DELIM;
00919         libPath << ourLibPath;
00920         PySys_SetPath((char *)(const char *)libPath);
00921     }
00922
00923     // this is the script to setup stdout/stderr and reroute it
00924     // to the console window
00925     if(script)
00926     {
00927         PyRun_SimpleString(script);
00928
00929         free(script);
00930     }
00931     else
00932     {
00933         cvs_err("Could not initialize properly the Python interpreter !\n");
00934     }
00935 }
00936 #endif // USE_PYTHON
00937
00938 CPython_Interp::CPython_Interp(bool mainInterp)
00939 {
00940     fInterp = 0L;
00941
00942 #if USE_PYTHON
00943     if(!CPython_Interp::IsAvail())
00944     {
00945         cvs_err("Python is not available !\n");
00946         return;
00947     }
00948
00949     if(mainInterp)
00950     {
00951         fInterp = m_mainInterpreter;
00952         gCvsPrefs.SetTclFileRunning(true);
00953         return;
00954     }
00955
00956     {
00957         CPyThreadState lock(0L);
00958
00959         fInterp = Py_NewInterpreter();
00960         if(fInterp == NULL)
00961             return;
00962     }
00963
00964     InitializeInterp(fInterp);
00965     gCvsPrefs.SetTclFileRunning(true);
00966 #endif
00967 }
00968
00969 CPython_Interp::~CPython_Interp()
00970 {
00971 #if USE_PYTHON
00972     if(fInterp != 0L)
00973     {
00974         gCvsPrefs.SetTclFileRunning(false);
00975
00976         if(fInterp != m_mainInterpreter)
00977         {
00978             CPyThreadState lock(fInterp);
00979
00980             Py_EndInterpreter(fInterp);
00981         }
00982     }
00983 #endif
00984 }
00985
00986 bool CPython_Interp::IsAvail(void)
00987 {
00988 #if USE_PYTHON
00989 #   if qMacCvsPP
00990     return PyThreadState_Swap != 0L;
00991 #   elif defined(WIN32) && !qCvsDebug /* || qCarbon */
00992     static bool firstTime = true;
00993     static bool pyAvail = false;
00994     if(firstTime)
00995     {
00996 #   if defined(WIN32) || qCarbon
00997         CompatConnectID connID;
00998 #   endif
00999
01000 #   ifdef WIN32
01001         if(!pyAvail)
01002             pyAvail = CompatLoadLibrary(&connID, "python21.dll") != 0 ||
01003                 CompatLoadLibrary(&connID, "python22.dll") != 0;
01004 #   endif
01005
01006 #   if qCarbon
01007         if (UEnvironment::GetOSVersion() >= 0x1000)
01008             pyAvail = CompatLoadLibrary(&connID, "/System/Library/Frameworks/Tcl.framework");
01009         else
01010             pyAvail = CompatLoadLibrary(&connID, "tcl8.3");
01011 #   endif
01012
01013 #   if defined(WIN32) || qCarbon
01014 #   define LOAD_CODEFRAG(name) \
01015         if(pyAvail) \
01016             pyAvail = (*(void **)&name##_glue = \
01017                 _CompatCallLibrary(connID, #name)) != 0L
01018 #   endif
01019 #   if defined(WIN32) || TARGET_API_MAC_CARBON
01020         LOAD_CODEFRAG(PyThreadState_Swap);
01021         LOAD_CODEFRAG(PyDict_SetItemString);
01022         LOAD_CODEFRAG(PyErr_Clear);
01023         LOAD_CODEFRAG(PyInt_FromLong);
01024         LOAD_CODEFRAG(PyErr_SetString);
01025         LOAD_CODEFRAG(PyArg_ParseTuple);
01026         LOAD_CODEFRAG(PyTuple_New);
01027         LOAD_CODEFRAG(Py_BuildValue);
01028         LOAD_CODEFRAG(PyFile_AsFile);
01029         LOAD_CODEFRAG(PyString_AsString);
01030         LOAD_CODEFRAG(PyTuple_Size);
01031         LOAD_CODEFRAG(PyRun_SimpleString);
01032         LOAD_CODEFRAG(PyRun_SimpleFile);
01033         LOAD_CODEFRAG(Py_SetProgramName);
01034         LOAD_CODEFRAG(Py_Initialize);
01035         LOAD_CODEFRAG(Py_Finalize);
01036         LOAD_CODEFRAG(Py_IsInitialized);
01037         LOAD_CODEFRAG(Py_NewInterpreter);
01038         LOAD_CODEFRAG(Py_EndInterpreter);
01039         LOAD_CODEFRAG(PyString_FromString);
01040         LOAD_CODEFRAG(PyErr_NewException);
01041         LOAD_CODEFRAG(PyModule_GetDict);
01042         LOAD_CODEFRAG(Py_InitModule4);
01043         LOAD_CODEFRAG(PyEval_InitThreads);
01044         LOAD_CODEFRAG(Py_FindMethod);
01045         LOAD_CODEFRAG(_PyObject_New);
01046         LOAD_CODEFRAG(_PyObject_Del);
01047         LOAD_CODEFRAG(PySys_SetPath);
01048         LOAD_CODEFRAG(Py_GetPath);
01049
01050         LOAD_CODEFRAG(PyType_Type);
01051         LOAD_CODEFRAG(PyFile_Type);
01052         LOAD_CODEFRAG(PyString_Type);
01053         LOAD_CODEFRAG(PyTuple_Type);
01054         LOAD_CODEFRAG(PyInt_Type);
01055         LOAD_CODEFRAG(_Py_NoneStruct);
01056         LOAD_CODEFRAG(_Py_ZeroStruct);
01057         LOAD_CODEFRAG(_Py_TrueStruct);
01058
01059         if(!pyAvail)
01060         {
01061             WarnNoPython();
01062         }
01063 #   endif /* WIN32 */
01064
01065         firstTime = false;
01066     }
01067
01068     return pyAvail;
01069 #   else
01070     return true;
01071 #   endif
01072 #else // !USE_PYTHON
01073     return false;
01074 #endif // !USE_PYTHON
01075 }
01076
01077 int CPython_Interp::DoScript(const char *script)
01078 {
01079 #if USE_PYTHON
01080     if(fInterp == 0L)
01081         return -1;
01082
01083     CPyThreadState lock(fInterp);
01084
01085     PyRun_SimpleString((char *)script);
01086
01087     return 0;
01088 #else
01089     return -1;
01090 #endif
01091 }
01092
01093 int CPython_Interp::DoScriptVar(const char *format, ...)
01094 {
01095 #if USE_PYTHON
01096     if(fInterp == 0L)
01097         return -1;
01098
01099     va_list args;
01100     char script[1024] = {'\0'};
01101
01102     va_start (args, format);
01103     vsprintf (script, format, args);
01104     va_end (args);
01105
01106     return DoScript(script);
01107 #else
01108     return -1;
01109 #endif
01110 }
01111
01112 int CPython_Interp::DoFile(const char *file)
01113 {
01114 #if USE_PYTHON
01115     if(fInterp == 0L)
01116         return -1;
01117
01118     CPyThreadState lock(fInterp);
01119
01120     FILE *f = fopen(file, "r");
01121     if(f)
01122     {
01123         PyRun_SimpleFile(f, (char *)file);
01124         fclose(f);
01125     }
01126
01127     return 0;
01128 #else
01129     return -1;
01130 #endif
01131 }
01132
01133 void CPython_Interp::InitPythonSupport(void)
01134 {
01135 #if USE_PYTHON
01136     if(!CPython_Interp::IsAvail())
01137         return;
01138
01139 #ifdef WIN32
01140     Py_SetProgramName("wincvs");
01141     Py_Initialize();
01142 #elif qMacCvsPP
01143     Py_SetProgramName("maccvs");
01144     PyMac_Initialize();
01145 #else
01146     Py_SetProgramName("gcvs");
01147     Py_Initialize();
01148 #endif
01149
01150     PyEval_InitThreads();
01151     m_mainInterpreter = PyThreadState_Swap(NULL);
01152
01153     InitializeInterp(m_mainInterpreter);
01154 #endif
01155 }
01156
01157 void CPython_Interp::ClosePythonSupport(void)
01158 {
01159 #if USE_PYTHON
01160     if(!CPython_Interp::IsAvail())
01161         return;
01162
01163     PyThreadState_Swap(m_mainInterpreter);
01164 //  PyEval_ReleaseLock();
01165
01166     PyInvalUICache();
01167
01168     Py_Finalize();
01169 #endif
01170 }
01171
01172 void PyMacrosReloadAll(void)
01173 {
01174     // get the macro folder
01175     UStr path;
01176     MacrosGetLoc(path);
01177
01178 #ifdef WIN32
01179     CString newpath(path);
01180     newpath.Replace("\\", "\\\\");
01181     path = newpath;
01182 #endif
01183
01184     CPython_Interp interp;
01185     interp.DoScriptVar("from cvsgui.MacroRegistry import *; "
01186         "gMacroRegistry.LoadMacros(\"%s\")", (char *)path.c_str());;
01187 }
01188
01189 void PyDoCmdUI(UCmdUI *ucmdui)
01190 {
01191     CPython_Interp interp;
01192     interp.DoScriptVar("from cvsgui.MacroRegistry import *; "
01193         "from cvsgui.CmdUI import *; "
01194         "gMacroRegistry.DoCmdUI(CmdUI(%d), %d)", (long)ucmdui, ucmdui->m_nID);
01195 }
01196
01197 void PyDoPython(int cmd)
01198 {
01199     CPython_Interp interp;
01200     interp.DoScriptVar("from cvsgui.MacroRegistry import *; "
01201         "gMacroRegistry.DoCmd(%d)", cmd);
01202 }
01203
01204 bool PyIsUICacheValid()
01205 {
01206 #if USE_PYTHON
01207     return gUICacheValid;
01208 #else
01209     return false;
01210 #endif
01211 }
01212
01213 void PyValidUICache()
01214 {
01215 #if USE_PYTHON
01216     gUICacheValid = true;
01217 #endif
01218 }
01219
01220 void PyInvalUICache()
01221 {
01222 #if USE_PYTHON
01223     gUICache.erase(gUICache.begin(), gUICache.end());
01224     gUICacheValid = false;
01225     Py_XDECREF(gUICacheObj);
01226     gUICacheObj = 0L;
01227 #endif
01228 }
01229
01230 void PyAppendCache(EntnodeData *data)
01231 {
01232 #if USE_PYTHON
01233     Py_XDECREF(gUICacheObj);
01234     gUICacheObj = 0L;
01235     gUICache.push_back(ENTNODE(data));
01236     gUICacheValid = true;
01237 #endif
01238 }
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/PythonGlue.h Source File

common/PythonGlue.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- August 2001
00019  */
00020
00021 /*
00022  * PythonGlue.h --- glue to the Python language
00023  */
00024
00025 #ifndef PYTHONGLUE_H
00026 #define PYTHONGLUE_H
00027
00028 class UCmdUI;
00029 class EntnodeData;
00030 typedef struct _ts PyThreadState;
00031
00032 class CPython_Interp
00033 {
00034 public:
00035     CPython_Interp(bool mainInterp = true);
00036     ~CPython_Interp();
00037
00038     static bool IsAvail(void);
00039         // tells if Python is available
00040
00041     int DoScriptVar(const char *format, ...);
00042     int DoScript(const char *script);
00043     int DoFile(const char *file);
00044         // execute a Python script, returns false on error
00045
00046     static void InitPythonSupport(void);
00047     static void ClosePythonSupport(void);
00048
00049     inline operator PyThreadState *(void) {return fInterp;}
00050
00051 protected:
00052     PyThreadState *fInterp;
00053
00054     static PyThreadState *m_mainInterpreter;
00055 };
00056
00057 void PyMacrosReloadAll(void);
00058     // reload the available macros
00059
00060 void PyDoCmdUI(UCmdUI *ucmdui);
00061     // update a menu state (call python)
00062
00063 void PyDoPython(int cmd);
00064     // call python because a command has been trigerred (by the menu or an icon)
00065
00066 bool PyIsUICacheValid();
00067 void PyValidUICache();
00068 void PyInvalUICache();
00069 void PyAppendCache(EntnodeData *data);
00070     // call for Python to invalidate selection cache (the current selection
00071     // in the file and folder browser)
00072
00073 #endif /* PYTHONGLUE_H */
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/PythonGlue.impl.h Source File

common/PythonGlue.impl.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- October 2001
00019  */
00020
00021 /*
00022  * PythonGlue.impl.h --- wrappers to the Python library
00023  */
00024
00025 #ifndef PYTHONGLUE_IMPL_H
00026 #define PYTHONGLUE_IMPL_H
00027
00028 #ifndef PYTHONGLUE_EXTERN
00029 #   define PYTHONGLUE_EXTERN extern
00030 #endif
00031
00032 #if defined(WIN32) && !qCvsDebug /* || qCarbon */
00033 #   define DEC_GLUE(f) (*f##_glue)
00034 #   define VAR_GLUE(f) f##_glue
00035
00036     PYTHONGLUE_EXTERN PyThreadState * DEC_GLUE(PyThreadState_Swap) (PyThreadState *);
00037     PYTHONGLUE_EXTERN int DEC_GLUE(PyDict_SetItemString) (PyObject *dp, char *key, PyObject *item);
00038     PYTHONGLUE_EXTERN void  DEC_GLUE(PyErr_Clear) (void);
00039     PYTHONGLUE_EXTERN PyObject * DEC_GLUE(PyInt_FromLong) (long);
00040     PYTHONGLUE_EXTERN void DEC_GLUE(PyErr_SetString) (PyObject *, const char *);
00041     PYTHONGLUE_EXTERN int DEC_GLUE(PyArg_ParseTuple) (PyObject *, char *, ...);
00042     PYTHONGLUE_EXTERN PyObject * DEC_GLUE(PyTuple_New) (int size);
00043     PYTHONGLUE_EXTERN PyObject * DEC_GLUE(Py_BuildValue) (char *, ...);
00044     PYTHONGLUE_EXTERN FILE * DEC_GLUE(PyFile_AsFile) (PyObject *);
00045     PYTHONGLUE_EXTERN char * DEC_GLUE(PyString_AsString) (PyObject *);
00046     PYTHONGLUE_EXTERN int DEC_GLUE(PyTuple_Size) (PyObject *);
00047     PYTHONGLUE_EXTERN int DEC_GLUE(PyRun_SimpleString) (char *);
00048     PYTHONGLUE_EXTERN int DEC_GLUE(PyRun_SimpleFile) (FILE *, char *);
00049     PYTHONGLUE_EXTERN void DEC_GLUE(Py_SetProgramName) (char *);
00050     PYTHONGLUE_EXTERN void DEC_GLUE(Py_Initialize) (void);
00051     PYTHONGLUE_EXTERN void DEC_GLUE(Py_Finalize) (void);
00052     PYTHONGLUE_EXTERN int DEC_GLUE(Py_IsInitialized) (void);
00053     PYTHONGLUE_EXTERN PyThreadState * DEC_GLUE(Py_NewInterpreter) (void);
00054     PYTHONGLUE_EXTERN void DEC_GLUE(Py_EndInterpreter) (PyThreadState *);
00055     PYTHONGLUE_EXTERN PyObject * DEC_GLUE(PyString_FromString) (const char *);
00056     PYTHONGLUE_EXTERN PyObject * DEC_GLUE(PyErr_NewException) (char *name, PyObject *base, PyObject *dict);
00057     PYTHONGLUE_EXTERN PyObject * DEC_GLUE(PyModule_GetDict) (PyObject *);
00058     PYTHONGLUE_EXTERN PyObject * DEC_GLUE(Py_InitModule4) (char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver);
00059     PYTHONGLUE_EXTERN void DEC_GLUE(PyEval_InitThreads) (void);
00060     PYTHONGLUE_EXTERN PyObject * DEC_GLUE(Py_FindMethod) (PyMethodDef[], PyObject *, char *);
00061     PYTHONGLUE_EXTERN PyObject * DEC_GLUE(_PyObject_New) (PyTypeObject *);
00062     PYTHONGLUE_EXTERN void DEC_GLUE(_PyObject_Del) (PyObject *);
00063     PYTHONGLUE_EXTERN void DEC_GLUE(PySys_SetPath) (char *);
00064     PYTHONGLUE_EXTERN char * DEC_GLUE(Py_GetPath) (void);
00065
00066     PYTHONGLUE_EXTERN PyTypeObject * VAR_GLUE(PyType_Type);
00067     PYTHONGLUE_EXTERN PyTypeObject * VAR_GLUE(PyFile_Type);
00068     PYTHONGLUE_EXTERN PyTypeObject * VAR_GLUE(PyString_Type);
00069     PYTHONGLUE_EXTERN PyTypeObject * VAR_GLUE(PyTuple_Type);
00070     PYTHONGLUE_EXTERN PyTypeObject * VAR_GLUE(PyInt_Type);
00071     PYTHONGLUE_EXTERN PyObject * VAR_GLUE(_Py_NoneStruct);
00072     PYTHONGLUE_EXTERN PyObject * VAR_GLUE(_Py_ZeroStruct);
00073     PYTHONGLUE_EXTERN PyObject * VAR_GLUE(_Py_TrueStruct);
00074
00075 #   define GLUE_WRAP(f) f##_glue
00076
00077 #   define PyThreadState_Swap GLUE_WRAP(PyThreadState_Swap)
00078 #   define PyDict_SetItemString GLUE_WRAP(PyDict_SetItemString)
00079 #   define PyErr_Clear GLUE_WRAP(PyErr_Clear)
00080 #   define PyInt_FromLong GLUE_WRAP(PyInt_FromLong)
00081 #   define PyErr_SetString GLUE_WRAP(PyErr_SetString)
00082 #   define PyArg_ParseTuple GLUE_WRAP(PyArg_ParseTuple)
00083 #   define PyTuple_New GLUE_WRAP(PyTuple_New)
00084 #   define Py_BuildValue GLUE_WRAP(Py_BuildValue)
00085 #   define PyFile_AsFile GLUE_WRAP(PyFile_AsFile)
00086 #   define PyString_AsString GLUE_WRAP(PyString_AsString)
00087 #   define PyTuple_Size GLUE_WRAP(PyTuple_Size)
00088 #   define PyRun_SimpleString GLUE_WRAP(PyRun_SimpleString)
00089 #   define PyRun_SimpleFile GLUE_WRAP(PyRun_SimpleFile)
00090 #   define Py_SetProgramName GLUE_WRAP(Py_SetProgramName)
00091 #   define Py_Initialize GLUE_WRAP(Py_Initialize)
00092 #   define Py_Finalize GLUE_WRAP(Py_Finalize)
00093 #   define Py_IsInitialized GLUE_WRAP(Py_IsInitialized)
00094 #   define Py_NewInterpreter GLUE_WRAP(Py_NewInterpreter)
00095 #   define Py_EndInterpreter GLUE_WRAP(Py_EndInterpreter)
00096 #   define PyString_FromString GLUE_WRAP(PyString_FromString)
00097 #   define PyErr_NewException GLUE_WRAP(PyErr_NewException)
00098 #   define PyModule_GetDict GLUE_WRAP(PyModule_GetDict)
00099 #   define Py_InitModule4 GLUE_WRAP(Py_InitModule4)
00100 #   define PyEval_InitThreads GLUE_WRAP(PyEval_InitThreads)
00101 #   define Py_FindMethod GLUE_WRAP(Py_FindMethod)
00102 #   define _PyObject_New GLUE_WRAP(_PyObject_New)
00103 #   define _PyObject_Del GLUE_WRAP(_PyObject_Del)
00104 #   define PySys_SetPath GLUE_WRAP(PySys_SetPath)
00105 #   define Py_GetPath GLUE_WRAP(Py_GetPath)
00106
00107     extern PyTypeObject *GetPyType_Type();
00108     extern PyTypeObject *GetPyFile_Type();
00109     extern PyTypeObject *GetPyString_Type();
00110     extern PyTypeObject *GetPyTuple_Type();
00111     extern PyTypeObject *GetPyInt_Type();
00112     extern PyObject *GetPyNone();
00113     extern PyObject *GetPyTrue();
00114     extern PyObject *GetPyFalse();
00115
00116 #   undef PyString_Check
00117 #   define PyString_Check(op) ((op)->ob_type == GetPyString_Type())
00118 #   undef PyTuple_Check
00119 #   define PyTuple_Check(op) ((op)->ob_type == GetPyTuple_Type())
00120 #   undef PyInt_Check
00121 #   define PyInt_Check(op) ((op)->ob_type == GetPyInt_Type())
00122
00123 #else /* !WIN32 || qCvsDebug */
00124     inline PyTypeObject *GetPyType_Type() { return &PyType_Type; }
00125     inline PyTypeObject *GetPyFile_Type() { return &PyFile_Type; }
00126     inline PyTypeObject *GetPyString_Type() { return &PyString_Type; }
00127     inline PyTypeObject *GetPyTuple_Type() { return &PyTuple_Type; }
00128     inline PyTypeObject *GetPyInt_Type() { return &PyInt_Type; }
00129     inline PyObject *GetPyNone() { return Py_None; }
00130     inline PyObject *GetPyTrue() { return Py_True; }
00131     inline PyObject *GetPyFalse() { return Py_False; }
00132 #endif /* !WIN32 || qCvsDebug */
00133
00134 #endif /* PYTHONGLUE_IMPL_H */
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/PythonImpl.cpp Source File

common/PythonImpl.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- September 2001
00019  */
00020
00021 #include "stdafx.h"
00022
00023 #include "PythonImpl.h"
00024 #include "CvsPrefs.h"
00025 #include "umenu.h"
00026
00027 #if USE_PYTHON
00028
00029 PY_IMPL_CLASS(CvsEntry, "Class for an entry in CVS/Entries")
00030
00031 PY_BEGIN_IMPL_METHOD(CvsEntry)
00032 PY_END_IMPL_METHOD
00033
00034 PyObject *PyCvsEntry::Create(PyObject *selfptr, PyObject *args)
00035 {
00036     if (!PyArg_ParseTuple(args, ":CCvsEntry"))
00037         return NULL;
00038
00039     PyAutoObject<PyCvsEntry::obj_t> self = PyCvsEntry::New();
00040     if (!self.IsValid())
00041         return NULL;
00042
00043     TRY
00044     {
00045         self->m_object = new PyCvsEntry(0L);
00046     }
00047     CATCH_ALL(e)
00048     {
00049         PyHandleCvsguiError(e);
00050         return NULL;
00051     }
00052     END_CATCH_ALL
00053
00054     return self.CopyReturn();
00055 }
00056
00057 void PyCvsEntry::InitValues(PyObject *d)
00058 {
00059 }
00060
00061 PyObject *PyCvsEntry::GetAttr(char *name)
00062 {
00063     UStr buf;
00064     EntnodeData *data = m_data;
00065
00066     if(strcmp(name, "name") == 0)
00067         return PyString_FromString(data->GetName());
00068     else if(strcmp(name, "fullname") == 0)
00069         return PyString_FromString(data->GetFullPathName(buf));
00070     else if(strcmp(name, "version") == 0)
00071     {
00072         const char *str = (*data)[EntnodeFile::kVN];
00073         return PyString_FromString(str ? str : "");
00074     }
00075     else if(strcmp(name, "timeutc") == 0)
00076     {
00077         const char *str = (*data)[EntnodeFile::kTS];
00078         return PyString_FromString(str ? str : "");
00079     }
00080     else if(strcmp(name, "keyword") == 0)
00081     {
00082         const char *str = (*data)[EntnodeFile::kOption];
00083         return PyString_FromString(str ? str : "");
00084     }
00085     else if(strcmp(name, "tag") == 0)
00086     {
00087         const char *str = (*data)[EntnodeFile::kTag];
00088         return PyString_FromString(str ? str : "");
00089     }
00090     else if(strcmp(name, "isfile") == 0)
00091         return data->GetType() == ENT_FILE ? True() : False();
00092     else if(strcmp(name, "modified") == 0)
00093         return data->IsUnmodified() ? False() : True();
00094     else if(strcmp(name, "missing") == 0)
00095         return data->IsMissing() ? True() : False();
00096     else if(strcmp(name, "unknown") == 0)
00097         return data->IsUnknown() ? True() : False();
00098     else if(strcmp(name, "ignored") == 0)
00099         return data->IsIgnored() ? True() : False();
00100     else if(strcmp(name, "readonly") == 0)
00101         return data->IsLocked() ? True() : False();
00102     else if(strcmp(name, "removed") == 0)
00103         return data->IsRemoved() ? True() : False();
00104     else if(strcmp(name, "added") == 0)
00105     {
00106         const char* vn = (*data)[EntnodeFile::kVN];
00107         bool isAdded = vn && (strcmp(vn, "0") == 0);
00108         return isAdded ? True() : False();
00109     }
00110     else if(strcmp(name, "desc") == 0)
00111         return PyString_FromString(data->GetDesc() ? data->GetDesc() : "");
00112     else if(strcmp(name, "conflict") == 0)
00113         return PyString_FromString(data->GetConflict() ? data->GetConflict() : "");
00114
00115     return NULL;
00116 }
00117
00118 PY_IMPL_CLASS(ColorConsole, "Class printing in color in the console")
00119
00120 PY_BEGIN_IMPL_METHOD(ColorConsole)
00121     PY_IMPL_METHOD(ColorConsole, Print, "Print in color")
00122 PY_END_IMPL_METHOD
00123
00124 PyObject *PyColorConsole::Create(PyObject *selfptr, PyObject *args)
00125 {
00126     if (!PyArg_ParseTuple(args, ":CColorConsole"))
00127         return NULL;
00128
00129     PyAutoObject<PyColorConsole::obj_t> self = PyColorConsole::New();
00130     if (!self.IsValid())
00131         return NULL;
00132
00133     TRY
00134     {
00135         self->m_object = new PyColorConsole();
00136     }
00137     CATCH_ALL(e)
00138     {
00139         PyHandleCvsguiError(e);
00140         return NULL;
00141     }
00142     END_CATCH_ALL
00143
00144     return self.CopyReturn();
00145 }
00146
00147
00148 void PyColorConsole::InitValues(PyObject *d)
00149 {
00150     RegisterValue(d, "kNormal", kNormal);
00151     RegisterValue(d, "kBrown", kBrown);
00152     RegisterValue(d, "kGreen", kGreen);
00153     RegisterValue(d, "kMagenta", kMagenta);
00154     RegisterValue(d, "kRed", kRed);
00155     RegisterValue(d, "kBlue", kBlue);
00156     RegisterValue(d, "kBold", kBold);
00157     RegisterValue(d, "kItalic", kItalic);
00158     RegisterValue(d, "kUnderline", kUnderline);
00159     RegisterValue(d, "kNL", kNL);
00160 }
00161
00162 PyObject *PyColorConsole::Print(PyObject *args)
00163 {
00164     int style;
00165
00166     if(PyArg_ParseTuple(args, "i", &style))
00167     {
00168         m_console << kConsoleColor(style);
00169         return Void();
00170     }
00171
00172     PyErr_Clear();
00173
00174     char *str;
00175     if(PyArg_ParseTuple(args, "s", &str))
00176     {
00177         m_console << str;
00178         return Void();
00179     }
00180
00181     return NULL;
00182 }
00183
00184 PY_IMPL_CLASS(MenuMgr, "Class to manipulate menus")
00185
00186 PY_BEGIN_IMPL_METHOD(MenuMgr)
00187     PY_IMPL_METHOD(MenuMgr, AddPulldown, "Add a new menu")
00188     PY_IMPL_METHOD(MenuMgr, AddToggle, "Add a toggle menu entry")
00189     PY_IMPL_METHOD(MenuMgr, AddButton, "Add a regular menu entry")
00190     PY_IMPL_METHOD(MenuMgr, AddSeparator, "Add a separator menu entry")
00191     PY_IMPL_METHOD(MenuMgr, Delete, "Delete a menu entry by index")
00192     PY_IMPL_METHOD(MenuMgr, DeleteByCmd, "Delete a menu entry by command")
00193     PY_IMPL_METHOD(MenuMgr, Count, "Count the number of entries in the menu")
00194 PY_END_IMPL_METHOD
00195
00196 static int ParseUMENU(PyObject *v, UMENU *menu)
00197 {
00198     if(v->ob_type == PyMenuMgr::GetType())
00199     {
00200         *menu = *((PyMenuMgr::obj_t *)v)->m_object;
00201         return 1;
00202     }
00203
00204     return 0;
00205 }
00206
00207 PyObject *PyMenuMgr::Create(PyObject *selfptr, PyObject *args)
00208 {
00209     UMENU menu;
00210
00211     if (!PyArg_ParseTuple(args, "i:CMenuMgr", &menu))
00212         return NULL;
00213
00214     PyAutoObject<PyMenuMgr::obj_t> self = PyMenuMgr::New();
00215     if (!self.IsValid())
00216         return NULL;
00217
00218     TRY
00219     {
00220         self->m_object = new PyMenuMgr(menu);
00221     }
00222     CATCH_ALL(e)
00223     {
00224         PyHandleCvsguiError(e);
00225         return NULL;
00226     }
00227     END_CATCH_ALL
00228
00229     return self.CopyReturn();
00230 }
00231
00232 void PyMenuMgr::InitValues(PyObject *d)
00233 {
00234 }
00235
00236 PyObject *PyMenuMgr::AddPulldown(PyObject *args)
00237 {
00238     int widid;
00239     char *name;
00240
00241     if (!PyArg_ParseTuple(args, "is", &widid, &name))
00242         return NULL;
00243
00244     PyAutoObject<PyMenuMgr::obj_t> res = PyMenuMgr::New();
00245     if (!res.IsValid())
00246         return NULL;
00247
00248     res->m_object = new PyMenuMgr(UMenuAddPulldown(widid, name, m_menu));
00249
00250     return res.CopyReturn();
00251 }
00252
00253 PyObject *PyMenuMgr::AddToggle(PyObject *args)
00254 {
00255     int widid, cmd;
00256     char *name, *pixmap = 0L;
00257
00258     if (!PyArg_ParseTuple(args, "isi|s", &widid, &name, &cmd, &pixmap))
00259         return NULL;
00260
00261     UMenuAddToggle(widid, name, m_menu, pixmap, cmd);
00262
00263     return Void();
00264 }
00265
00266 PyObject *PyMenuMgr::AddButton(PyObject *args)
00267 {
00268     int widid, cmd;
00269     char *name, *pixmap = 0L;
00270
00271     if (!PyArg_ParseTuple(args, "isi|s", &widid, &name, &cmd, &pixmap))
00272         return NULL;
00273
00274     UMenuAddButton(widid, name, m_menu, pixmap, cmd);
00275
00276     return Void();
00277 }
00278
00279 PyObject *PyMenuMgr::AddSeparator(PyObject *args)
00280 {
00281     int widid;
00282
00283     if (!PyArg_ParseTuple(args, "i", &widid))
00284         return NULL;
00285
00286     UMenuAddSeparator(widid, m_menu);
00287
00288     return Void();
00289 }
00290
00291 PyObject *PyMenuMgr::Delete(PyObject *args)
00292 {
00293     int afterIndex;
00294
00295     if (!PyArg_ParseTuple(args, "i", &afterIndex))
00296         return NULL;
00297
00298     UMenuDelete(m_menu, afterIndex);
00299
00300     return Void();
00301 }
00302
00303 PyObject *PyMenuMgr::DeleteByCmd(PyObject *args)
00304 {
00305     int cmd;
00306
00307     if (!PyArg_ParseTuple(args, "i", &cmd))
00308         return NULL;
00309
00310     UMenuDeleteByCmd(m_menu, cmd);
00311
00312     return Void();
00313 }
00314
00315 PyObject *PyMenuMgr::Count(PyObject *args)
00316 {
00317     int res;
00318
00319     if (!PyArg_ParseTuple(args, ""))
00320         return NULL;
00321
00322     res = UMenuCount(m_menu);
00323
00324     return PyInt_FromLong(res);
00325 }
00326
00327 PY_IMPL_CLASS(CmdUI, "Class to update an interface object state")
00328
00329 PY_BEGIN_IMPL_METHOD(CmdUI)
00330     PY_IMPL_METHOD(CmdUI, Enable, "Enable/Disable the object")
00331     PY_IMPL_METHOD(CmdUI, SetCheck, "Check/uncheck the object")
00332     PY_IMPL_METHOD(CmdUI, SetText, "Rename the object")
00333 PY_END_IMPL_METHOD
00334
00335 PyObject *PyCmdUI::Create(PyObject *selfptr, PyObject *args)
00336 {
00337     UCmdUI *cmdui;
00338
00339     if (!PyArg_ParseTuple(args, "i:CCmdUI", &cmdui))
00340         return NULL;
00341
00342     PyAutoObject<PyCmdUI::obj_t> self = PyCmdUI::New();
00343     if (!self.IsValid())
00344         return NULL;
00345
00346     TRY
00347     {
00348         self->m_object = new PyCmdUI(cmdui);
00349     }
00350     CATCH_ALL(e)
00351     {
00352         PyHandleCvsguiError(e);
00353         return NULL;
00354     }
00355     END_CATCH_ALL
00356
00357     return self.CopyReturn();
00358 }
00359
00360 void PyCmdUI::InitValues(PyObject *d)
00361 {
00362 }
00363
00364 PyObject *PyCmdUI::Enable(PyObject *args)
00365 {
00366     int state;
00367
00368     if (!PyArg_ParseTuple(args, "i", &state))
00369         return NULL;
00370
00371     m_cmdui->Enable(state != 0);
00372
00373     return Void();
00374 }
00375
00376 PyObject *PyCmdUI::SetCheck(PyObject *args)
00377 {
00378     int state;
00379
00380     if (!PyArg_ParseTuple(args, "i", &state))
00381         return NULL;
00382
00383     m_cmdui->Check(state != 0);
00384
00385     return Void();
00386 }
00387
00388 PyObject *PyCmdUI::SetText(PyObject *args)
00389 {
00390     char *text;
00391
00392     if (!PyArg_ParseTuple(args, "s", &text))
00393         return NULL;
00394
00395     m_cmdui->SetText(text);
00396
00397     return Void();
00398 }
00399
00400 PY_IMPL_CLASS(Persistent, "Class to store persistent values on disk")
00401
00402 PY_BEGIN_IMPL_METHOD(Persistent)
00403     PY_IMPL_METHOD(Persistent, GetValue, "Get the persistent value")
00404     PY_IMPL_METHOD(Persistent, SetValue, "Set the persistent value")
00405 PY_END_IMPL_METHOD
00406
00407 PyObject *PyPersistent::Create(PyObject *selfptr, PyObject *args)
00408 {
00409     char *uniqueName, *defValue = 0L;
00410     int addToSettings = 0;
00411
00412     if (!PyArg_ParseTuple(args, "s|si:CPersistent", &uniqueName, &defValue,
00413         &addToSettings))
00414         return NULL;
00415
00416     PyAutoObject<PyPersistent::obj_t> self = PyPersistent::New();
00417     if (!self.IsValid())
00418         return NULL;
00419
00420     TRY
00421     {
00422         self->m_object = new PyPersistent(uniqueName, defValue,
00423             addToSettings ? kAddSettings : kNoClass);
00424     }
00425     CATCH_ALL(e)
00426     {
00427         PyHandleCvsguiError(e);
00428         return NULL;
00429     }
00430     END_CATCH_ALL
00431
00432     return self.CopyReturn();
00433 }
00434
00435 void PyPersistent::InitValues(PyObject *d)
00436 {
00437 }
00438
00439 PyObject *PyPersistent::SetValue(PyObject *args)
00440 {
00441     char *s;
00442
00443     if (!PyArg_ParseTuple(args, "s", &s))
00444         return NULL;
00445
00446     m_cstr = s;
00447     gCvsPrefs.save();
00448
00449     return Void();
00450 }
00451
00452 PyObject *PyPersistent::GetValue(PyObject *args)
00453 {
00454     if (!PyArg_ParseTuple(args, ""))
00455         return NULL;
00456
00457     return PyString_FromString(m_cstr);
00458 }
00459
00460 #if defined(WIN32) && !qCvsDebug
00461
00462 #undef PYTHONGLUE_IMPL_H
00463 #undef PYTHONGLUE_EXTERN
00464 #define PYTHONGLUE_EXTERN
00465 #include "PythonGlue.impl.h"
00466
00467 PyTypeObject *GetPyType_Type()
00468 {
00469     return PyType_Type_glue;
00470 }
00471
00472 PyTypeObject *GetPyFile_Type()
00473 {
00474     return PyFile_Type_glue;
00475 }
00476
00477 PyTypeObject *GetPyString_Type()
00478 {
00479     return PyString_Type_glue;
00480 }
00481
00482 PyTypeObject *GetPyTuple_Type()
00483 {
00484     return PyTuple_Type_glue;
00485 }
00486
00487 PyTypeObject *GetPyInt_Type()
00488 {
00489     return PyInt_Type_glue;
00490 }
00491
00492 PyObject *GetPyNone()
00493 {
00494     return _Py_NoneStruct_glue;
00495 }
00496
00497 PyObject *GetPyTrue()
00498 {
00499     return _Py_TrueStruct_glue;
00500 }
00501
00502 PyObject *GetPyFalse()
00503 {
00504     return _Py_ZeroStruct_glue;
00505 }
00506 #endif // WIN32 && !qCvsDebug
00507
00508 #endif // USE_PYTHON
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/PythonImpl.h Source File

common/PythonImpl.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- September 2001
00019  */
00020
00021 #ifndef __PYIMPL
00022 #define __PYIMPL
00023
00024 #include "PythonContainer.h"
00025
00026 #if USE_PYTHON
00027 #include "CvsEntries.h"
00028 #include "AppConsole.h"
00029 #include "CPStr.h"
00030 #include "umain.h"
00031
00032 class PyCvsEntry : public PyContainer
00033 {
00034     PY_DECL_CLASS(CvsEntry)
00035 public:
00036     PyCvsEntry(EntnodeData *data) : m_data(data)
00037     {
00038     }
00039
00040     virtual ~PyCvsEntry()
00041     {
00042     }
00043
00044     virtual PyObject *GetAttr(char *name);
00045
00046     inline operator EntnodeData *(void) const { return m_data; }
00047
00048 protected:
00049     ENTNODE m_data;
00050 };
00051
00052 class PyColorConsole : public PyContainer
00053 {
00054     PY_DECL_CLASS(ColorConsole)
00055     PY_DECL_METHOD(ColorConsole, Print)
00056 public:
00057     PyColorConsole()
00058     {
00059     }
00060
00061     virtual ~PyColorConsole()
00062     {
00063     }
00064
00065 protected:
00066     CColorConsole m_console;
00067 };
00068
00069 class PyMenuMgr : public PyContainer
00070 {
00071     PY_DECL_CLASS(MenuMgr)
00072     PY_DECL_METHOD(MenuMgr, AddPulldown)
00073     PY_DECL_METHOD(MenuMgr, AddToggle)
00074     PY_DECL_METHOD(MenuMgr, AddButton)
00075     PY_DECL_METHOD(MenuMgr, AddSeparator)
00076     PY_DECL_METHOD(MenuMgr, Delete)
00077     PY_DECL_METHOD(MenuMgr, DeleteByCmd)
00078     PY_DECL_METHOD(MenuMgr, Count)
00079
00080 public:
00081     PyMenuMgr(UMENU menu) : m_menu(menu)
00082     {
00083     }
00084
00085     virtual ~PyMenuMgr()
00086     {
00087     }
00088
00089     inline operator UMENU() const { return m_menu; }
00090 protected:
00091     UMENU m_menu;
00092 };
00093
00094 class PyCmdUI : public PyContainer
00095 {
00096     PY_DECL_CLASS(CmdUI)
00097     PY_DECL_METHOD(CmdUI, Enable)
00098     PY_DECL_METHOD(CmdUI, SetCheck)
00099     PY_DECL_METHOD(CmdUI, SetText)
00100 public:
00101     PyCmdUI(UCmdUI *cmdui) : m_cmdui(cmdui)
00102     {
00103     }
00104
00105     virtual ~PyCmdUI()
00106     {
00107     }
00108
00109 protected:
00110     UCmdUI *m_cmdui;
00111 };
00112
00113 class PyPersistent : public PyContainer
00114 {
00115     PY_DECL_CLASS(Persistent)
00116     PY_DECL_METHOD(Persistent, GetValue)
00117     PY_DECL_METHOD(Persistent, SetValue)
00118 public:
00119     PyPersistent(const char *uniqueName, const char *defValue, kClassPersistent pclass) :
00120         m_cstr(uniqueName, defValue, pclass)
00121     {
00122     }
00123
00124     virtual ~PyPersistent()
00125     {
00126     }
00127
00128 protected:
00129     PCStr m_cstr;
00130 };
00131 #endif // USE_PYTHON
00132
00133 #endif
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/PythonMacros.h Source File

common/PythonMacros.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- September 2001
00019  */
00020
00021 #ifndef __PY_MACROS
00022 #define __PY_MACROS
00023
00024 // it is important with Python to not throw, instead we need
00025 // to intercept each exception and turn it into a Python exception
00026 #ifdef WIN32
00027     extern void PyHandleCvsguiError(CException* e);
00028 #else
00029     extern void PyHandleCvsguiError(const std::exception & e);
00030 #   define TRY try
00031 #   define CATCH_ALL(e) catch(const std::exception & e)
00032 #   define END_CATCH_ALL
00033 #endif
00034 extern void PyHandleCvsguiError(const char *msg);
00035
00036 /*
00037  * PY_DECL_CLASS : declate a python wrapper class
00038  * PY_IMPL_CLASS : implement python wrapper class
00039  */
00040
00041 #define _COMMON_PY_DECL_CLASS(c) \
00042 public: \
00043     typedef struct \
00044     { \
00045         PyObject_HEAD \
00046         Py##c *m_object; \
00047     } obj_t; \
00048     static const char *m_doc; \
00049     static void dealloc(obj_t *self); \
00050     static PyObject *getattr(obj_t *self, char *name); \
00051     static PyAutoObject<obj_t> New(void); \
00052     static PyMethodDef m_methods[]; \
00053     static PyRegistry m_registry; \
00054     static inline PyTypeObject *GetType(void) { return &m_registry.m_type; } \
00055     static PyObject *Create(PyObject *selfptr, PyObject *args); \
00056     static void InitValues(PyObject *d);
00057
00058 #define PY_DECL_CLASS_INHERITED(c, a) \
00059     _COMMON_PY_DECL_CLASS(c) \
00060     static PyObject *FindMethod(PyObject *self, char *name) \
00061     { \
00062         PyObject *res = Py_FindMethod(m_methods, self, name); \
00063         if(res != NULL) \
00064             return res; \
00065         PyErr_Clear(); \
00066         return Py##a::FindMethod(self, name); \
00067     }
00068
00069 #define PY_DECL_CLASS(c) \
00070     _COMMON_PY_DECL_CLASS(c) \
00071     static PyObject *FindMethod(PyObject *self, char *name) \
00072     { \
00073         return Py_FindMethod(m_methods, self, name); \
00074     }
00075
00076
00077 #define PY_IMPL_CLASS(c, adoc) \
00078     PyRegistry Py##c::m_registry("C"#c, sizeof(Py##c::obj_t), (destructor)Py##c::dealloc, (getattrfunc)Py##c::getattr, \
00079         Py##c::InitValues, (PyCFunction)Py##c::Create, Py##c::m_doc); \
00080     PyAutoObject<Py##c::obj_t> Py##c::New(void) \
00081     { \
00082         Py##c::obj_t *self = PyObject_New(Py##c::obj_t, Py##c::GetType()); \
00083         self->m_object = NULL; \
00084         PyAutoObject<Py##c::obj_t> res(self); \
00085         Py_DECREF(self); \
00086         return res; \
00087     } \
00088     const char *Py##c::m_doc = adoc; \
00089  \
00090     void Py##c::dealloc(obj_t *self) \
00091     { \
00092         delete self->m_object; \
00093         PyObject_Del(self); \
00094     } \
00095  \
00096     PyObject *Py##c::getattr(obj_t *self, char *name) \
00097     { \
00098         if(self->m_object) \
00099         { \
00100             TRY \
00101             { \
00102                 PyObject *res = self->m_object->GetAttr(name); \
00103                 if(res) \
00104                     return res; \
00105             } \
00106             CATCH_ALL(e) \
00107             { \
00108                 PyHandleCvsguiError(e); \
00109                 return NULL; \
00110             } \
00111             END_CATCH_ALL \
00112         } \
00113         return Py##c::FindMethod((PyObject *)self, name); \
00114     }
00115
00116 #define PY_DECL_METHOD(c, m) \
00117 protected: \
00118     static PyObject *_##m(obj_t *self, PyObject *args) \
00119     { \
00120         TRY \
00121         { \
00122             if(self->m_object) \
00123                 return self->m_object->##m(args); \
00124         } \
00125         CATCH_ALL(e) \
00126         { \
00127             PyHandleCvsguiError(e); \
00128             return NULL; \
00129         } \
00130         END_CATCH_ALL \
00131         return NULL; \
00132     } \
00133 public: \
00134     PyObject *m(PyObject *args);
00135
00136 #define PY_BEGIN_IMPL_METHOD(c) \
00137     PyMethodDef Py##c::m_methods[] = \
00138     {
00139
00140 #define PY_IMPL_METHOD(c, m, adoc) \
00141     {#m, (binaryfunc)Py##c::_##m, METH_VARARGS, (char *)adoc},
00142
00143 #define PY_END_IMPL_METHOD \
00144         {NULL, NULL} \
00145     };
00146
00147 #endif
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/ReleaseDlg.cpp Source File

common/ReleaseDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- October 2000
00019  */
00020
00021 /*
00022  * ReleaseDlg.cpp : the cvs release dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #endif /* WIN32 */
00030
00031 #include "ReleaseDlg.h"
00032
00033 #ifdef WIN32
00034 #   ifdef _DEBUG
00035 #   define new DEBUG_NEW
00036 #   undef THIS_FILE
00037     static char THIS_FILE[] = __FILE__;
00038 #   endif
00039 #endif /* WIN32 */
00040
00041 #ifdef WIN32
00042
00043 // CReleaseDlg dialog
00044
00045 CReleaseDlg::CReleaseDlg(CWnd* pParent /*=NULL*/)
00046     : CDialog(CReleaseDlg::IDD, pParent)
00047 {
00048     //{{AFX_DATA_INIT(CReleaseDlg)
00049     m_strDirectory = _T("");
00050     m_bRemoveDirectory = FALSE;
00051     //}}AFX_DATA_INIT
00052 }
00053
00054
00055 void CReleaseDlg::DoDataExchange(CDataExchange* pDX)
00056 {
00057     CDialog::DoDataExchange(pDX);
00058     //{{AFX_DATA_MAP(CReleaseDlg)
00059     DDX_Text(pDX, IDC_DIRECTORY, m_strDirectory);
00060     DDX_Check(pDX, IDC_REMOVE, m_bRemoveDirectory);
00061     //}}AFX_DATA_MAP
00062 }
00063
00064
00065 BEGIN_MESSAGE_MAP(CReleaseDlg, CDialog)
00066     //{{AFX_MSG_MAP(CReleaseDlg)
00067         // NOTE: the ClassWizard will add message map macros here
00068     //}}AFX_MSG_MAP
00069 END_MESSAGE_MAP()
00070
00072 // CReleaseDlg message handlers
00073
00074 #endif /* WIN32 */
00075
00076 bool CompatGetRelease( const char* dir, bool& removeDirectory )
00077 {
00078     bool userHitOK = false;
00079
00080 #ifdef WIN32
00081     CReleaseDlg oReleaseDlg;
00082     oReleaseDlg.m_strDirectory = dir;
00083
00084     if(oReleaseDlg.DoModal() == IDOK)
00085     {
00086         removeDirectory = oReleaseDlg.m_bRemoveDirectory == TRUE;
00087         userHitOK = true;
00088     }
00089 #endif /* WIN32 */
00090
00091 #ifdef qMacCvsPP
00092     userHitOK = true;
00093 #endif /* qMacCvsPP */
00094
00095 #if qUnix
00096     userHitOK = true;
00097 #endif // qUnix
00098
00099     return userHitOK;
00100 }
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/ReleaseDlg.h Source File

common/ReleaseDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- October 2000
00019  */
00020
00021 /*
00022  * ReleaseDlg.h : the cvs release dialog
00023  */
00024
00025 #if !defined(AFX_RELEASEDLG_H__12B5FA97_703E_4616_B361_F2917D45E54A__INCLUDED_)
00026 #define AFX_RELEASEDLG_H__12B5FA97_703E_4616_B361_F2917D45E54A__INCLUDED_
00027
00028 #if _MSC_VER > 1000
00029 #pragma once
00030 #endif // _MSC_VER > 1000
00031
00032 bool CompatGetRelease( const char* dir, bool& removeDirectory );
00033     // get the release options...
00034
00035 #ifdef WIN32
00036
00037 // CReleaseDlg dialog
00038
00039 class CReleaseDlg : public CDialog
00040 {
00041 // Construction
00042 public:
00043     CReleaseDlg(CWnd* pParent = NULL);   // standard constructor
00044
00045 // Dialog Data
00046     //{{AFX_DATA(CReleaseDlg)
00047     enum { IDD = IDD_RELEASE };
00048     CString m_strDirectory;
00049     BOOL    m_bRemoveDirectory;
00050     //}}AFX_DATA
00051
00052
00053 // Overrides
00054     // ClassWizard generated virtual function overrides
00055     //{{AFX_VIRTUAL(CReleaseDlg)
00056     protected:
00057     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00058     //}}AFX_VIRTUAL
00059
00060 // Implementation
00061 protected:
00062
00063     // Generated message map functions
00064     //{{AFX_MSG(CReleaseDlg)
00065         // NOTE: the ClassWizard will add member functions here
00066     //}}AFX_MSG
00067     DECLARE_MESSAGE_MAP()
00068 };
00069
00070 //{{AFX_INSERT_LOCATION}}
00071 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00072
00073 #endif /* WIN32 */
00074
00075
00076 #endif // !defined(AFX_RELEASEDLG_H__12B5FA97_703E_4616_B361_F2917D45E54A__INCLUDED_)
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/RtagDlg.cpp Source File

common/RtagDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- July 1998
00019  */
00020
00021 /*
00022  * RtagDlg.cpp : the cvs rtag dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #   include "GetPrefs.h"
00030 #endif /* WIN32 */
00031
00032 #ifdef qMacCvsPP
00033 #   include <UModalDialogs.h>
00034 #   include <LMultiPanelView.h>
00035 #   include <LCheckBox.h>
00036 #   include <LEditText.h>
00037 #   include <LPopupGroupBox.h>
00038 #   include <LRadioButton.h>
00039 #   include "LPopupFiller.h"
00040
00041 #   include "MacCvsApp.h"
00042 #   include "MacCvsConstant.h"
00043 #endif /* qMacCvsPP */
00044
00045 #if qUnix
00046 #   include "UCvsDialogs.h"
00047 #endif
00048
00049 #include "RtagDlg.h"
00050 #include "CvsPrefs.h"
00051 #include "UpdateDlg.h"
00052
00053 #ifdef WIN32
00054 #   ifdef _DEBUG
00055 #   define new DEBUG_NEW
00056 #   undef THIS_FILE
00057     static char THIS_FILE[] = __FILE__;
00058 #   endif
00059 #endif /* WIN32 */
00060
00061 #ifdef WIN32
00062 IMPLEMENT_DYNCREATE(CRtag_CREATE, CPropertyPage)
00063
00064 CRtag_CREATE::CRtag_CREATE(const char * sLastModule, const char * sLastTag,
00065     bool hasDate, bool hasRev,
00066     const char * sLastDate, const char * sLastRev,
00067     bool noRecurs, bool overwriteExist,
00068     bool useMostRecent, bool lookAttic) : CPropertyPage(CRtag_CREATE::IDD)
00069 {
00070     m_attic = lookAttic;
00071     m_date = sLastDate;
00072     m_rev = sLastRev;
00073     m_hasdate = hasDate;
00074     m_hasrev = hasRev;
00075     m_norecurs = noRecurs;
00076     m_match = useMostRecent;
00077     m_modname = sLastModule;
00078     m_tagname = sLastTag;
00079     m_overwrite = overwriteExist;
00080 }
00081
00082 CRtag_CREATE::CRtag_CREATE() : CPropertyPage(CRtag_CREATE::IDD)
00083 {
00084     //{{AFX_DATA_INIT(CRtag_CREATE)
00085     m_attic = FALSE;
00086     m_date = _T("");
00087     m_rev = _T("");
00088     m_hasdate = FALSE;
00089     m_hasrev = FALSE;
00090     m_norecurs = FALSE;
00091     m_match = FALSE;
00092     m_modname = _T("");
00093     m_tagname = _T("");
00094     m_overwrite = FALSE;
00095     //}}AFX_DATA_INIT
00096 }
00097
00098 CRtag_CREATE::~CRtag_CREATE()
00099 {
00100 }
00101
00102 void CRtag_CREATE::DoDataExchange(CDataExchange* pDX)
00103 {
00104     CPropertyPage::DoDataExchange(pDX);
00105     //{{AFX_DATA_MAP(CRtag_CREATE)
00106     DDX_Control(pDX, IDC_COMBOREV, m_revdef);
00107     DDX_Control(pDX, IDC_COMBODATE, m_datedef);
00108     DDX_Check(pDX, IDC_ATTIC, m_attic);
00109     DDX_CBString(pDX, IDC_COMBODATE, m_date);
00110     DDX_CBString(pDX, IDC_COMBOREV, m_rev);
00111     DDX_Check(pDX, IDC_DATE, m_hasdate);
00112     DDX_Check(pDX, IDC_MATCH, m_match);
00113     DDX_Check(pDX, IDC_REV, m_hasrev);
00114     DDX_Check(pDX, IDC_NORECURS, m_norecurs);
00115     DDX_Text(pDX, IDC_MODNAME, m_modname);
00116     DDX_Text(pDX, IDC_TAGNAME, m_tagname);
00117     DDX_Check(pDX, IDC_OVERWRITE, m_overwrite);
00118     //}}AFX_DATA_MAP
00119     if(m_hasrev)
00120         DDV_MinChars(pDX, m_rev, 1);
00121     if(m_hasdate)
00122         DDV_MinChars(pDX, m_date, 1);
00123     DDV_MinChars(pDX, m_modname, 1);
00124     DDV_MinChars(pDX, m_tagname, 1);
00125     if(!pDX->m_bSaveAndValidate)
00126     {
00127         OnDate();
00128         OnRev();
00129     }
00130     DDX_ComboMString(pDX, IDC_COMBOREV, gRevNames, m_revdef);
00131     DDX_ComboMString(pDX, IDC_COMBODATE, gDateNames, m_datedef);
00132 }
00133
00134 BEGIN_MESSAGE_MAP(CRtag_CREATE, CPropertyPage)
00135     //{{AFX_MSG_MAP(CRtag_CREATE)
00136     ON_BN_CLICKED(IDC_DATE, OnDate)
00137     ON_BN_CLICKED(IDC_REV, OnRev)
00138     //}}AFX_MSG_MAP
00139 END_MESSAGE_MAP()
00140
00141 void CRtag_CREATE::OnDate()
00142 {
00143     CButton* but = (CButton *)GetDlgItem(IDC_DATE);
00144     CWnd* wnd = GetDlgItem(IDC_COMBODATE);
00145     wnd->EnableWindow(but->GetCheck() == 1);
00146 }
00147
00148 void CRtag_CREATE::OnRev()
00149 {
00150     CButton* but = (CButton *)GetDlgItem(IDC_REV);
00151     CWnd* wnd = GetDlgItem(IDC_COMBOREV);
00152     wnd->EnableWindow(but->GetCheck() == 1);
00153 }
00154
00155 IMPLEMENT_DYNCREATE(CRtag_DELETE, CPropertyPage)
00156
00157 CRtag_DELETE::CRtag_DELETE(const char * sLastModule,
00158     const char * sLastTag, bool noRecurs,
00159     bool lookAttic) : CPropertyPage(CRtag_DELETE::IDD)
00160 {
00161     m_attic = lookAttic;
00162     m_norecurs = noRecurs;
00163     m_modname = sLastModule;
00164     m_tagname = sLastTag;
00165 }
00166
00167 CRtag_DELETE::CRtag_DELETE() : CPropertyPage(CRtag_DELETE::IDD)
00168 {
00169     //{{AFX_DATA_INIT(CRtag_DELETE)
00170     m_attic = FALSE;
00171     m_norecurs = FALSE;
00172     m_modname = _T("");
00173     m_tagname = _T("");
00174     //}}AFX_DATA_INIT
00175 }
00176
00177 CRtag_DELETE::~CRtag_DELETE()
00178 {
00179 }
00180
00181 void CRtag_DELETE::DoDataExchange(CDataExchange* pDX)
00182 {
00183     CPropertyPage::DoDataExchange(pDX);
00184     //{{AFX_DATA_MAP(CRtag_DELETE)
00185     DDX_Check(pDX, IDC_ATTIC, m_attic);
00186     DDX_Check(pDX, IDC_NORECURS, m_norecurs);
00187     DDX_Text(pDX, IDC_MODNAME, m_modname);
00188     DDX_Text(pDX, IDC_TAGNAME, m_tagname);
00189     //}}AFX_DATA_MAP
00190     DDV_MinChars(pDX, m_modname, 1);
00191     DDV_MinChars(pDX, m_tagname, 1);
00192 }
00193
00194 BEGIN_MESSAGE_MAP(CRtag_DELETE, CPropertyPage)
00195     //{{AFX_MSG_MAP(CRtag_DELETE)
00196     //}}AFX_MSG_MAP
00197 END_MESSAGE_MAP()
00198
00199 IMPLEMENT_DYNCREATE(CRtag_BRANCH, CPropertyPage)
00200
00201 CRtag_BRANCH::CRtag_BRANCH(const char * sLastModule, const char * sLastBranch,
00202     bool hasDate, bool hasRev,
00203     const char * sLastDate, const char * sLastRev,
00204     bool noRecurs, bool useMostRecent, bool lookAttic) :
00205         CPropertyPage(CRtag_BRANCH::IDD)
00206 {
00207     m_attic = lookAttic;
00208     m_date = sLastDate;
00209     m_rev = sLastRev;
00210     m_hasdate = hasDate;
00211     m_hasrev = hasRev;
00212     m_norecurs = noRecurs;
00213     m_match = useMostRecent;
00214     m_modname = sLastModule;
00215     m_branchname = sLastBranch;
00216 }
00217
00218 CRtag_BRANCH::CRtag_BRANCH() : CPropertyPage(CRtag_BRANCH::IDD)
00219 {
00220     //{{AFX_DATA_INIT(CRtag_BRANCH)
00221     m_attic = FALSE;
00222     m_date = _T("");
00223     m_rev = _T("");
00224     m_hasdate = FALSE;
00225     m_hasrev = FALSE;
00226     m_norecurs = FALSE;
00227     m_match = FALSE;
00228     m_modname = _T("");
00229     m_branchname = _T("");
00230     //}}AFX_DATA_INIT
00231 }
00232
00233 CRtag_BRANCH::~CRtag_BRANCH()
00234 {
00235 }
00236
00237 void CRtag_BRANCH::DoDataExchange(CDataExchange* pDX)
00238 {
00239     CPropertyPage::DoDataExchange(pDX);
00240     //{{AFX_DATA_MAP(CRtag_BRANCH)
00241     DDX_Control(pDX, IDC_COMBOREV, m_revdef);
00242     DDX_Control(pDX, IDC_COMBODATE, m_datedef);
00243     DDX_Check(pDX, IDC_ATTIC, m_attic);
00244     DDX_CBString(pDX, IDC_COMBODATE, m_date);
00245     DDX_CBString(pDX, IDC_COMBOREV, m_rev);
00246     DDX_Check(pDX, IDC_DATE, m_hasdate);
00247     DDX_Check(pDX, IDC_MATCH, m_match);
00248     DDX_Check(pDX, IDC_REV, m_hasrev);
00249     DDX_Check(pDX, IDC_NORECURS, m_norecurs);
00250     DDX_Text(pDX, IDC_MODNAME, m_modname);
00251     DDX_Text(pDX, IDC_TAGNAME, m_branchname);
00252     //}}AFX_DATA_MAP
00253     if(m_hasrev)
00254         DDV_MinChars(pDX, m_rev, 1);
00255     if(m_hasdate)
00256         DDV_MinChars(pDX, m_date, 1);
00257     DDV_MinChars(pDX, m_modname, 1);
00258     DDV_MinChars(pDX, m_branchname, 1);
00259     if(!pDX->m_bSaveAndValidate)
00260     {
00261         OnDate();
00262         OnRev();
00263     }
00264     DDX_ComboMString(pDX, IDC_COMBOREV, gRevNames, m_revdef);
00265     DDX_ComboMString(pDX, IDC_COMBODATE, gDateNames, m_datedef);
00266 }
00267
00268 BEGIN_MESSAGE_MAP(CRtag_BRANCH, CPropertyPage)
00269     //{{AFX_MSG_MAP(CRtag_BRANCH)
00270     ON_BN_CLICKED(IDC_DATE, OnDate)
00271     ON_BN_CLICKED(IDC_REV, OnRev)
00272     //}}AFX_MSG_MAP
00273 END_MESSAGE_MAP()
00274
00275 void CRtag_BRANCH::OnDate()
00276 {
00277     CButton* but = (CButton *)GetDlgItem(IDC_DATE);
00278     CWnd* wnd = GetDlgItem(IDC_COMBODATE);
00279     wnd->EnableWindow(but->GetCheck() == 1);
00280 }
00281
00282 void CRtag_BRANCH::OnRev()
00283 {
00284     CButton* but = (CButton *)GetDlgItem(IDC_REV);
00285     CWnd* wnd = GetDlgItem(IDC_COMBOREV);
00286     wnd->EnableWindow(but->GetCheck() == 1);
00287 }
00288 #endif /* WIN32 */
00289
00290 #ifdef qMacCvsPP
00291 static void DoDataExchange_RtagCreateMain(LWindow *theDialog,
00292     CPStr & sLastModule, CPStr & sLastTag,
00293     bool & hasDate, bool & hasRev,
00294     CPStr & sLastDate, CPStr & sLastRev,
00295     bool & useMostRecent, bool & lookAttic, bool putValue)
00296 {
00297     LEditText *mname = dynamic_cast<LEditText*>
00298         (theDialog->FindPaneByID(item_ModuleName));
00299     LEditText *tname = dynamic_cast<LEditText*>
00300         (theDialog->FindPaneByID(item_BranchRev));
00301     LCheckBox *chkHasDate = dynamic_cast<LCheckBox*>
00302         (theDialog->FindPaneByID(item_CheckDate));
00303     LCheckBox *chkHasRev = dynamic_cast<LCheckBox*>
00304         (theDialog->FindPaneByID(item_CheckRevTag));
00305     LCheckBox *chkMostRecent = dynamic_cast<LCheckBox*>
00306         (theDialog->FindPaneByID(item_MostRecentRev));
00307     LCheckBox *chkLookAttic = dynamic_cast<LCheckBox*>
00308         (theDialog->FindPaneByID(item_InAttic));
00309     LEditText *editDate = dynamic_cast<LEditText*>
00310         (theDialog->FindPaneByID(item_EditDate));
00311     LEditText *editRev = dynamic_cast<LEditText*>
00312         (theDialog->FindPaneByID(item_EditRevTag));
00313     LPopupFiller *fillRev = dynamic_cast<LPopupFiller*>
00314         (theDialog->FindPaneByID(item_FillerRev1));
00315     LPopupFiller *fillTag = dynamic_cast<LPopupFiller*>
00316         (theDialog->FindPaneByID(item_FillerTag));
00317     LPopupFiller *fillDate = dynamic_cast<LPopupFiller*>
00318         (theDialog->FindPaneByID(item_FillerDate));
00319
00320     fillRev->DoDataExchange(gRevNames, putValue);
00321     fillTag->DoDataExchange(gRevNames, putValue);
00322     fillDate->DoDataExchange(gDateNames, putValue);
00323
00324     if(putValue)
00325     {
00326         mname->SetText((Ptr)(const char *)sLastModule, sLastModule.length());
00327         tname->SetText((Ptr)(const char *)sLastTag, sLastTag.length());
00328         chkHasDate->SetValue(hasDate ? Button_On : Button_Off);
00329         chkHasRev->SetValue(hasRev ? Button_On : Button_Off);
00330         chkMostRecent->SetValue(useMostRecent ? Button_On : Button_Off);
00331         chkLookAttic->SetValue(lookAttic ? Button_On : Button_Off);
00332         editDate->SetText((Ptr)(const char *)sLastDate, sLastDate.length());
00333         editRev->SetText((Ptr)(const char *)sLastRev, sLastRev.length());
00334     }
00335     else
00336     {
00337         hasDate = chkHasDate->GetValue() == Button_On;
00338         hasRev = chkHasRev->GetValue() == Button_On;
00339         useMostRecent = chkMostRecent->GetValue() == Button_On;
00340         lookAttic = chkLookAttic->GetValue() == Button_On;
00341
00342         char str[255];
00343         Size len;
00344
00345         mname->GetText(str, 254, &len);
00346         sLastModule.set(str, len);
00347         tname->GetText(str, 254, &len);
00348         sLastTag.set(str, len);
00349         editDate->GetText(str, 254, &len);
00350         sLastDate.set(str, len);
00351         editRev->GetText(str, 254, &len);
00352         sLastRev.set(str, len);
00353     }
00354 }
00355
00356 static void DoDataExchange_RtagCreateOptions(LWindow *theDialog,
00357     bool & noRecurs, bool & overwriteExist, bool putValue)
00358 {
00359     LCheckBox *chkNoRecurs = dynamic_cast<LCheckBox*>
00360         (theDialog->FindPaneByID(item_NoRecurs));
00361     LCheckBox *chkOverwrite = dynamic_cast<LCheckBox*>
00362         (theDialog->FindPaneByID(item_OverwriteRev));
00363
00364     if(putValue)
00365     {
00366         chkNoRecurs->SetValue(noRecurs ? Button_On : Button_Off);
00367         chkOverwrite->SetValue(overwriteExist ? Button_On : Button_Off);
00368     }
00369     else
00370     {
00371         noRecurs = chkNoRecurs->GetValue() == Button_On;
00372         overwriteExist = chkOverwrite->GetValue() == Button_On;
00373     }
00374 }
00375
00376 static void DoDataExchange_RtagDeleteMain(LWindow *theDialog,
00377     CPStr & sLastModule, CPStr & sLastTag,
00378     bool & noRecurs, bool & lookAttic, bool putValue)
00379 {
00380     LEditText *mname = dynamic_cast<LEditText*>
00381         (theDialog->FindPaneByID(item_ModuleName));
00382     LEditText *tname = dynamic_cast<LEditText*>
00383         (theDialog->FindPaneByID(item_BranchRev));
00384     LCheckBox *chkLookAttic = dynamic_cast<LCheckBox*>
00385         (theDialog->FindPaneByID(item_InAttic));
00386     LCheckBox *chkNoRecurs = dynamic_cast<LCheckBox*>
00387         (theDialog->FindPaneByID(item_NoRecurs));
00388     LPopupFiller *fillTag = dynamic_cast<LPopupFiller*>
00389         (theDialog->FindPaneByID(item_FillerTag));
00390
00391     fillTag->DoDataExchange(gRevNames, putValue);
00392
00393     if(putValue)
00394     {
00395         mname->SetText((Ptr)(const char *)sLastModule, sLastModule.length());
00396         tname->SetText((Ptr)(const char *)sLastTag, sLastTag.length());
00397         chkLookAttic->SetValue(lookAttic ? Button_On : Button_Off);
00398         chkNoRecurs->SetValue(noRecurs ? Button_On : Button_Off);
00399     }
00400     else
00401     {
00402         lookAttic = chkLookAttic->GetValue() == Button_On;
00403         noRecurs = chkNoRecurs->GetValue() == Button_On;
00404
00405         char str[255];
00406         Size len;
00407
00408         mname->GetText(str, 254, &len);
00409         sLastModule.set(str, len);
00410         tname->GetText(str, 254, &len);
00411         sLastTag.set(str, len);
00412     }
00413 }
00414
00415 static void DoDataExchange_RtagBranchMain(LWindow *theDialog,
00416     CPStr & sLastModule, CPStr & sLastBranch,
00417     bool & hasDate, bool & hasRev,
00418     CPStr & sLastDate, CPStr & sLastRev,
00419     bool & useMostRecent, bool & lookAttic, bool putValue)
00420 {
00421     LEditText *mname = dynamic_cast<LEditText*>
00422         (theDialog->FindPaneByID(item_ModuleName));
00423     LEditText *tname = dynamic_cast<LEditText*>
00424         (theDialog->FindPaneByID(item_BranchRev));
00425     LCheckBox *chkHasDate = dynamic_cast<LCheckBox*>
00426         (theDialog->FindPaneByID(item_CheckDate));
00427     LCheckBox *chkHasRev = dynamic_cast<LCheckBox*>
00428         (theDialog->FindPaneByID(item_CheckRevTag));
00429     LCheckBox *chkMostRecent = dynamic_cast<LCheckBox*>
00430         (theDialog->FindPaneByID(item_MostRecentRev));
00431     LCheckBox *chkLookAttic = dynamic_cast<LCheckBox*>
00432         (theDialog->FindPaneByID(item_InAttic));
00433     LEditText *editDate = dynamic_cast<LEditText*>
00434         (theDialog->FindPaneByID(item_EditDate));
00435     LEditText *editRev = dynamic_cast<LEditText*>
00436         (theDialog->FindPaneByID(item_EditRevTag));
00437     LPopupFiller *fillRev = dynamic_cast<LPopupFiller*>
00438         (theDialog->FindPaneByID(item_FillerRev1));
00439     LPopupFiller *fillTag = dynamic_cast<LPopupFiller*>
00440         (theDialog->FindPaneByID(item_FillerTag));
00441     LPopupFiller *fillDate = dynamic_cast<LPopupFiller*>
00442         (theDialog->FindPaneByID(item_FillerDate));
00443
00444     fillRev->DoDataExchange(gRevNames, putValue);
00445     fillTag->DoDataExchange(gRevNames, putValue);
00446     fillDate->DoDataExchange(gDateNames, putValue);
00447
00448     if(putValue)
00449     {
00450         mname->SetText((Ptr)(const char *)sLastModule, sLastModule.length());
00451         tname->SetText((Ptr)(const char *)sLastBranch, sLastBranch.length());
00452         chkHasDate->SetValue(hasDate ? Button_On : Button_Off);
00453         chkHasRev->SetValue(hasRev ? Button_On : Button_Off);
00454         chkMostRecent->SetValue(useMostRecent ? Button_On : Button_Off);
00455         chkLookAttic->SetValue(lookAttic ? Button_On : Button_Off);
00456         editDate->SetText((Ptr)(const char *)sLastDate, sLastDate.length());
00457         editRev->SetText((Ptr)(const char *)sLastRev, sLastRev.length());
00458     }
00459     else
00460     {
00461         hasDate = chkHasDate->GetValue() == Button_On;
00462         hasRev = chkHasRev->GetValue() == Button_On;
00463         useMostRecent = chkMostRecent->GetValue() == Button_On;
00464         lookAttic = chkLookAttic->GetValue() == Button_On;
00465
00466         char str[255];
00467         Size len;
00468
00469         mname->GetText(str, 254, &len);
00470         sLastModule.set(str, len);
00471         tname->GetText(str, 254, &len);
00472         sLastBranch.set(str, len);
00473         editDate->GetText(str, 254, &len);
00474         sLastDate.set(str, len);
00475         editRev->GetText(str, 254, &len);
00476         sLastRev.set(str, len);
00477     }
00478 }
00479
00480 static void DoDataExchange_RtagBranchOptions(LWindow *theDialog,
00481     bool & noRecurs, bool putValue)
00482 {
00483     LCheckBox *chkNoRecurs = dynamic_cast<LCheckBox*>
00484         (theDialog->FindPaneByID(item_NoRecurs));
00485
00486     if(putValue)
00487     {
00488         chkNoRecurs->SetValue(noRecurs ? Button_On : Button_Off);
00489     }
00490     else
00491     {
00492         noRecurs = chkNoRecurs->GetValue() == Button_On;
00493     }
00494 }
00495 #endif /* qMacCvsPP */
00496
00497 #if qUnix
00498 class UCvsRtagCreate : public UWidget
00499 {
00500     UDECLARE_DYNAMIC(UCvsRtagCreate)
00501 public:
00502     UCvsRtagCreate() : UWidget(::UEventGetWidID()) {}
00503     virtual ~UCvsRtagCreate() {}
00504
00505     enum
00506     {
00507         kOK = EV_COMMAND_START, // 0
00508         kCancel,                // 1
00509         kTabGeneral             // 2
00510     };
00511
00512     virtual void DoDataExchange(bool fill);
00513
00514 protected:
00515     ev_msg int OnOK(void);
00516     ev_msg int OnCancel(void);
00517
00518     UDECLARE_MESSAGE_MAP()
00519 };
00520
00521 UIMPLEMENT_DYNAMIC(UCvsRtagCreate, UWidget)
00522
00523 UBEGIN_MESSAGE_MAP(UCvsRtagCreate, UWidget)
00524     ON_UCOMMAND(UCvsRtagCreate::kOK, UCvsRtagCreate::OnOK)
00525     ON_UCOMMAND(UCvsRtagCreate::kCancel, UCvsRtagCreate::OnCancel)
00526 UEND_MESSAGE_MAP()
00527
00528 int UCvsRtagCreate::OnOK(void)
00529 {
00530     EndModal(true);
00531     return 0;
00532 }
00533
00534 int UCvsRtagCreate::OnCancel(void)
00535 {
00536     EndModal(false);
00537     return 0;
00538 }
00539
00540 void UCvsRtagCreate::DoDataExchange(bool fill)
00541 {
00542     if(fill)
00543     {
00544     }
00545     else
00546     {
00547     }
00548 }
00549
00550 class UCvsRtagCreate_MAIN : public UWidget
00551 {
00552     UDECLARE_DYNAMIC(UCvsRtagCreate_MAIN)
00553 public:
00554     UCvsRtagCreate_MAIN(const char * sLastModule, const char * sLastTag,
00555                         bool hasDate, bool hasRev,
00556                         const char * sLastDate, const char * sLastRev,
00557                         bool noRecurs, bool overwriteExist,
00558                         bool useMostRecent, bool lookAttic);
00559     virtual ~UCvsRtagCreate_MAIN() {}
00560
00561     enum
00562     {
00563         kEditTag = EV_COMMAND_START,    // 0
00564         kEditMod,           // 1
00565         kCheckRev,          // 2
00566         kCheckDate,         // 3
00567         kComboRev,          // 4
00568         kComboDate,         // 5
00569         kCheckRecurs,       // 6
00570         kCheckAttic,        // 7
00571         kCheckOverwrite,    // 8
00572         kCheckMatch         // 9
00573     };
00574
00575     virtual void DoDataExchange(bool fill);
00576
00577     bool m_attic;
00578     UStr m_date;
00579     UStr m_rev;
00580     bool m_hasdate;
00581     bool m_hasrev;
00582     bool m_norecurs;
00583     bool m_match;
00584     UStr m_modname;
00585     UStr m_tagname;
00586     bool m_overwrite;
00587 protected:
00588     ev_msg int OnChecks(int cmd);
00589
00590     UDECLARE_MESSAGE_MAP()
00591 };
00592
00593 UIMPLEMENT_DYNAMIC(UCvsRtagCreate_MAIN, UWidget)
00594
00595 UBEGIN_MESSAGE_MAP(UCvsRtagCreate_MAIN, UWidget)
00596     ON_UCOMMAND_RANGE(UCvsRtagCreate_MAIN::kCheckRev, UCvsRtagCreate_MAIN::kCheckDate, UCvsRtagCreate_MAIN::OnChecks)
00597 UEND_MESSAGE_MAP()
00598
00599 UCvsRtagCreate_MAIN::UCvsRtagCreate_MAIN(const char * sLastModule, const char * sLastTag,
00600                                          bool hasDate, bool hasRev,
00601                                          const char * sLastDate, const char * sLastRev,
00602                                          bool noRecurs, bool overwriteExist,
00603                                          bool useMostRecent, bool lookAttic) : UWidget(::UEventGetWidID())
00604 {
00605     m_attic = lookAttic;
00606     m_date = sLastDate;
00607     m_rev = sLastRev;
00608     m_hasdate = hasDate;
00609     m_hasrev = hasRev;
00610     m_norecurs = noRecurs;
00611     m_match = useMostRecent;
00612     m_modname = sLastModule;
00613     m_tagname = sLastTag;
00614     m_overwrite = overwriteExist;
00615 }
00616
00617 int UCvsRtagCreate_MAIN::OnChecks(int cmd)
00618 {
00619     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, cmd, 0L);
00620     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(cmd + 2, state), 0L);
00621     return 0;
00622 }
00623
00624 void UCvsRtagCreate_MAIN::DoDataExchange(bool fill)
00625 {
00626     ::DoDataExchange(fill, GetWidID(), kComboRev, gRevNames);
00627     ::DoDataExchange(fill, GetWidID(), kComboDate, gDateNames);
00628
00629     if(fill)
00630     {
00631         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditTag, (void *)(const char *)m_tagname);
00632         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditMod, (void *)(const char *)m_modname);
00633         UEventSendMessage(GetWidID(), EV_SETTEXT, kComboRev, (void *)(const char *)m_rev);
00634         UEventSendMessage(GetWidID(), EV_SETTEXT, kComboDate, (void *)(const char *)m_date);
00635
00636         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckDate, m_hasdate), 0L);
00637         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRev, m_hasrev), 0L);
00638         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckAttic, m_attic), 0L);
00639         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRecurs, m_norecurs), 0L);
00640         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckOverwrite, m_overwrite), 0L);
00641         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckMatch, m_match), 0L);
00642
00643         OnChecks(kCheckRev);
00644         OnChecks(kCheckDate);
00645     }
00646     else
00647     {
00648         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditTag, &m_tagname);
00649         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditMod, &m_modname);
00650         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboRev, &m_rev);
00651         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboDate, &m_date);
00652
00653         m_hasdate = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDate, 0L);
00654         m_hasrev = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRev, 0L);
00655         m_attic = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckAttic, 0L);
00656         m_norecurs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRecurs, 0L);
00657         m_overwrite = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckOverwrite, 0L);
00658         m_match = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckMatch, 0L);
00659     }
00660 }
00661
00662 class UCvsRtagDel : public UWidget
00663 {
00664     UDECLARE_DYNAMIC(UCvsRtagDel)
00665 public:
00666     UCvsRtagDel() : UWidget(::UEventGetWidID()) {}
00667     virtual ~UCvsRtagDel() {}
00668
00669     enum
00670     {
00671         kOK = EV_COMMAND_START, // 0
00672         kCancel,                // 1
00673         kTabGeneral             // 2
00674     };
00675
00676     virtual void DoDataExchange(bool fill);
00677
00678 protected:
00679     ev_msg int OnOK(void);
00680     ev_msg int OnCancel(void);
00681
00682     UDECLARE_MESSAGE_MAP()
00683 };
00684
00685 UIMPLEMENT_DYNAMIC(UCvsRtagDel, UWidget)
00686
00687 UBEGIN_MESSAGE_MAP(UCvsRtagDel, UWidget)
00688     ON_UCOMMAND(UCvsRtagDel::kOK, UCvsRtagDel::OnOK)
00689     ON_UCOMMAND(UCvsRtagDel::kCancel, UCvsRtagDel::OnCancel)
00690 UEND_MESSAGE_MAP()
00691
00692 int UCvsRtagDel::OnOK(void)
00693 {
00694     EndModal(true);
00695     return 0;
00696 }
00697
00698 int UCvsRtagDel::OnCancel(void)
00699 {
00700     EndModal(false);
00701     return 0;
00702 }
00703
00704 void UCvsRtagDel::DoDataExchange(bool fill)
00705 {
00706     if(fill)
00707     {
00708     }
00709     else
00710     {
00711     }
00712 }
00713
00714 class UCvsRtagDel_MAIN : public UWidget
00715 {
00716     UDECLARE_DYNAMIC(UCvsRtagDel_MAIN)
00717 public:
00718     UCvsRtagDel_MAIN(const char * sLastModule,
00719                      const char * sLastTag, bool noRecurs,
00720                      bool lookAttic);
00721     virtual ~UCvsRtagDel_MAIN() {}
00722
00723     enum
00724     {
00725         kEditTag = EV_COMMAND_START,    // 0
00726         kEditMod,           // 1
00727         kCheckRecurs,       // 2
00728         kCheckAttic         // 3
00729     };
00730
00731     virtual void DoDataExchange(bool fill);
00732
00733     bool m_attic;
00734     bool m_norecurs;
00735     UStr m_modname;
00736     UStr m_tagname;
00737 protected:
00738
00739     UDECLARE_MESSAGE_MAP()
00740 };
00741
00742 UIMPLEMENT_DYNAMIC(UCvsRtagDel_MAIN, UWidget)
00743
00744 UBEGIN_MESSAGE_MAP(UCvsRtagDel_MAIN, UWidget)
00745 UEND_MESSAGE_MAP()
00746
00747 UCvsRtagDel_MAIN::UCvsRtagDel_MAIN(const char * sLastModule,
00748                                    const char * sLastTag, bool noRecurs,
00749                                    bool lookAttic) : UWidget(::UEventGetWidID())
00750 {
00751     m_attic = lookAttic;
00752     m_norecurs = noRecurs;
00753     m_modname = sLastModule;
00754     m_tagname = sLastTag;
00755 }
00756
00757 void UCvsRtagDel_MAIN::DoDataExchange(bool fill)
00758 {
00759     if(fill)
00760     {
00761         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditTag, (void *)(const char *)m_tagname);
00762         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditMod, (void *)(const char *)m_modname);
00763
00764         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckAttic, m_attic), 0L);
00765         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRecurs, m_norecurs), 0L);
00766     }
00767     else
00768     {
00769         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditTag, &m_tagname);
00770         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditMod, &m_modname);
00771
00772         m_attic = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckAttic, 0L);
00773         m_norecurs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRecurs, 0L);
00774     }
00775 }
00776
00777 class UCvsRtagBranch : public UWidget
00778 {
00779     UDECLARE_DYNAMIC(UCvsRtagBranch)
00780 public:
00781     UCvsRtagBranch() : UWidget(::UEventGetWidID()) {}
00782     virtual ~UCvsRtagBranch() {}
00783
00784     enum
00785     {
00786         kOK = EV_COMMAND_START, // 0
00787         kCancel,                // 1
00788         kTabGeneral             // 2
00789     };
00790
00791     virtual void DoDataExchange(bool fill);
00792
00793 protected:
00794     ev_msg int OnOK(void);
00795     ev_msg int OnCancel(void);
00796
00797     UDECLARE_MESSAGE_MAP()
00798 };
00799
00800 UIMPLEMENT_DYNAMIC(UCvsRtagBranch, UWidget)
00801
00802 UBEGIN_MESSAGE_MAP(UCvsRtagBranch, UWidget)
00803     ON_UCOMMAND(UCvsRtagBranch::kOK, UCvsRtagBranch::OnOK)
00804     ON_UCOMMAND(UCvsRtagBranch::kCancel, UCvsRtagBranch::OnCancel)
00805 UEND_MESSAGE_MAP()
00806
00807 int UCvsRtagBranch::OnOK(void)
00808 {
00809     EndModal(true);
00810     return 0;
00811 }
00812
00813 int UCvsRtagBranch::OnCancel(void)
00814 {
00815     EndModal(false);
00816     return 0;
00817 }
00818
00819 void UCvsRtagBranch::DoDataExchange(bool fill)
00820 {
00821     if(fill)
00822     {
00823     }
00824     else
00825     {
00826     }
00827 }
00828
00829 class UCvsRtagBranch_MAIN : public UWidget
00830 {
00831     UDECLARE_DYNAMIC(UCvsRtagBranch_MAIN)
00832 public:
00833     UCvsRtagBranch_MAIN(const char * sLastModule, const char * sLastTag,
00834                         bool hasDate, bool hasRev,
00835                         const char * sLastDate, const char * sLastRev,
00836                         bool noRecurs, bool useMostRecent, bool lookAttic);
00837     virtual ~UCvsRtagBranch_MAIN() {}
00838
00839     enum
00840     {
00841         kEditTag = EV_COMMAND_START,    // 0
00842         kEditMod,           // 1
00843         kCheckRev,          // 2
00844         kCheckDate,         // 3
00845         kComboRev,          // 4
00846         kComboDate,         // 5
00847         kCheckRecurs,       // 6
00848         kCheckAttic,        // 7
00849         kCheckMatch         // 9
00850     };
00851
00852     virtual void DoDataExchange(bool fill);
00853
00854     bool m_attic;
00855     UStr m_date;
00856     UStr m_rev;
00857     bool m_hasdate;
00858     bool m_hasrev;
00859     bool m_norecurs;
00860     bool m_match;
00861     UStr m_modname;
00862     UStr m_tagname;
00863 protected:
00864     ev_msg int OnChecks(int cmd);
00865
00866     UDECLARE_MESSAGE_MAP()
00867 };
00868
00869 UIMPLEMENT_DYNAMIC(UCvsRtagBranch_MAIN, UWidget)
00870
00871 UBEGIN_MESSAGE_MAP(UCvsRtagBranch_MAIN, UWidget)
00872     ON_UCOMMAND_RANGE(UCvsRtagBranch_MAIN::kCheckRev, UCvsRtagBranch_MAIN::kCheckDate, UCvsRtagBranch_MAIN::OnChecks)
00873 UEND_MESSAGE_MAP()
00874
00875 UCvsRtagBranch_MAIN::UCvsRtagBranch_MAIN(const char * sLastModule, const char * sLastTag,
00876                                              bool hasDate, bool hasRev, const char * sLastDate,
00877                                              const char * sLastRev, bool noRecurs, bool useMostRecent,
00878                                              bool lookAttic) : UWidget(::UEventGetWidID())
00879 {
00880     m_attic = lookAttic;
00881     m_date = sLastDate;
00882     m_rev = sLastRev;
00883     m_hasdate = hasDate;
00884     m_hasrev = hasRev;
00885     m_norecurs = noRecurs;
00886     m_match = useMostRecent;
00887     m_modname = sLastModule;
00888     m_tagname = sLastTag;
00889 }
00890
00891 int UCvsRtagBranch_MAIN::OnChecks(int cmd)
00892 {
00893     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, cmd, 0L);
00894     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(cmd + 2, state), 0L);
00895     return 0;
00896 }
00897
00898 void UCvsRtagBranch_MAIN::DoDataExchange(bool fill)
00899 {
00900     ::DoDataExchange(fill, GetWidID(), kComboRev, gRevNames);
00901     ::DoDataExchange(fill, GetWidID(), kComboDate, gDateNames);
00902
00903     if(fill)
00904     {
00905         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditTag, (void *)(const char *)m_tagname);
00906         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditMod, (void *)(const char *)m_modname);
00907         UEventSendMessage(GetWidID(), EV_SETTEXT, kComboRev, (void *)(const char *)m_rev);
00908         UEventSendMessage(GetWidID(), EV_SETTEXT, kComboDate, (void *)(const char *)m_date);
00909
00910         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckDate, m_hasdate), 0L);
00911         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRev, m_hasrev), 0L);
00912         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckAttic, m_attic), 0L);
00913         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRecurs, m_norecurs), 0L);
00914         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckMatch, m_match), 0L);
00915
00916         OnChecks(kCheckRev);
00917         OnChecks(kCheckDate);
00918     }
00919     else
00920     {
00921         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditTag, &m_tagname);
00922         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditMod, &m_modname);
00923         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboRev, &m_rev);
00924         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboDate, &m_date);
00925
00926         m_hasdate = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDate, 0L);
00927         m_hasrev = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRev, 0L);
00928         m_attic = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckAttic, 0L);
00929         m_norecurs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRecurs, 0L);
00930         m_match = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckMatch, 0L);
00931     }
00932 }
00933
00934 #endif // qUnix
00935
00936 bool CompatRtagCreate(bool & noRecurs, bool & overwriteExisting, CPStr & tagName,
00937                      CPStr & modName, CPStr & date, CPStr & rev,
00938                      bool & useMostRecent, bool & lookAttic)
00939 {
00940     bool userHitOK = false;
00941
00942     static CPStr sLastModule;
00943     static CPStr sLastTag;
00944     static CPStr sLastDate;
00945     static CPStr sLastRev;
00946
00947     bool hasDate = false;
00948     bool hasRev = false;
00949
00950     date = "";
00951     rev = "";
00952     tagName = "";
00953     modName = "";
00954     noRecurs = false;
00955     overwriteExisting = false;
00956     useMostRecent = false;
00957     lookAttic = false;
00958
00959 #ifdef WIN32
00960     CPropertySheet pages("Create tag settings");
00961     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00962     CRtag_CREATE page1(sLastModule, sLastTag, hasDate, hasRev,
00963         sLastDate, sLastRev, noRecurs, overwriteExisting,
00964         useMostRecent, lookAttic);
00965     CGetPrefs_GLOBALS page2;
00966     pages.AddPage(&page1);
00967     pages.AddPage(&page2);
00968     if(pages.DoModal() == IDOK)
00969     {
00970         lookAttic = page1.m_attic == TRUE;
00971         sLastDate = page1.m_date;
00972         sLastRev = page1.m_rev;
00973         hasDate = page1.m_hasdate == TRUE;
00974         hasRev = page1.m_hasrev == TRUE;
00975         noRecurs = page1.m_norecurs == TRUE;
00976         useMostRecent = page1.m_match == TRUE;
00977         sLastModule = page1.m_modname;
00978         sLastTag = page1.m_tagname;
00979         overwriteExisting = page1.m_overwrite == TRUE;
00980
00981         page2.StoreValues();
00982         userHitOK = true;
00983     }
00984 #endif /* WIN32 */
00985 #if qUnix
00986     void *wid = UCreate_TagModDlg();
00987
00988     UCvsRtagCreate *dlg = new UCvsRtagCreate();
00989     UCvsRtagCreate_MAIN *tab1 =
00990         new UCvsRtagCreate_MAIN(sLastModule, sLastTag, hasDate, hasRev,
00991                                 sLastDate, sLastRev, noRecurs, overwriteExisting,
00992                                 useMostRecent, lookAttic);
00993     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00994     dlg->AddPage(tab1, UCvsRtagCreate::kTabGeneral, 0);
00995
00996     if(dlg->DoModal())
00997     {
00998         lookAttic = tab1->m_attic;
00999         sLastDate = tab1->m_date;
01000         sLastRev = tab1->m_rev;
01001         hasDate = tab1->m_hasdate;
01002         hasRev = tab1->m_hasrev;
01003         noRecurs = tab1->m_norecurs;
01004         useMostRecent = tab1->m_match;
01005         sLastModule = tab1->m_modname;
01006         sLastTag = tab1->m_tagname;
01007         overwriteExisting = tab1->m_overwrite;
01008
01009         userHitOK = true;
01010     }
01011
01012     delete dlg;
01013 #endif // qUnix
01014 #ifdef qMacCvsPP
01015     StDialogHandler theHandler(dlg_RtagCreate, LCommander::GetTopCommander());
01016     LWindow *theDialog = theHandler.GetDialog();
01017     ThrowIfNil_(theDialog);
01018     static UInt16 sRuntimePanel = 1;
01019
01020     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01021         (theDialog->FindPaneByID(item_MultiViewPrefs));
01022     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01023
01024     multiView->SwitchToPanel(3);
01025     DoDataExchange_Globals(theDialog, true);
01026     multiView->SwitchToPanel(2);
01027     DoDataExchange_RtagCreateOptions(theDialog, noRecurs, overwriteExisting, true);
01028     multiView->SwitchToPanel(1);
01029     DoDataExchange_RtagCreateMain(theDialog, sLastModule, sLastTag,
01030         hasDate, hasRev, sLastDate, sLastRev,
01031         useMostRecent, lookAttic, true);
01032
01033     groupView->SetValue(sRuntimePanel);
01034     theDialog->Show();
01035     MessageT hitMessage;
01036     while (true)
01037     {       // Let DialogHandler process events
01038         hitMessage = theHandler.DoDialog();
01039
01040         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01041             break;
01042     }
01043     theDialog->Hide();
01044     sRuntimePanel = groupView->GetValue();
01045
01046     if(hitMessage == msg_OK)
01047     {
01048         multiView->SwitchToPanel(1);
01049         DoDataExchange_RtagCreateMain(theDialog, sLastModule, sLastTag,
01050             hasDate, hasRev, sLastDate, sLastRev,
01051             useMostRecent, lookAttic, false);
01052         multiView->SwitchToPanel(2);
01053         DoDataExchange_RtagCreateOptions(theDialog, noRecurs, overwriteExisting, false);
01054         multiView->SwitchToPanel(3);
01055         DoDataExchange_Globals(theDialog, false);
01056         userHitOK = true;
01057     }
01058 #endif /* qMacCvsPP */
01059
01060     if(userHitOK)
01061     {
01062         if(hasDate && !sLastDate.empty())
01063             date = sLastDate;
01064         if(hasRev && !sLastRev.empty())
01065             rev = sLastRev;
01066
01067         tagName = sLastTag;
01068         modName = sLastModule;
01069
01070         gCvsPrefs.save();
01071     }
01072
01073     return userHitOK;
01074 }
01075
01076 bool CompatRtagDelete(bool & noRecurs, bool & lookAttic,
01077                      CPStr & tagName, CPStr & modName)
01078 {
01079
01080     bool userHitOK = false;
01081
01082     static CPStr sLastModule;
01083     static CPStr sLastTag;
01084
01085     tagName = "";
01086     modName = "";
01087     noRecurs = false;
01088     lookAttic = false;
01089
01090 #ifdef WIN32
01091     CPropertySheet pages("Delete tag settings");
01092     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
01093     CRtag_DELETE page1(sLastModule, sLastTag, noRecurs, lookAttic);
01094     CGetPrefs_GLOBALS page2;
01095     pages.AddPage(&page1);
01096     pages.AddPage(&page2);
01097     if(pages.DoModal() == IDOK)
01098     {
01099         lookAttic = page1.m_attic == TRUE;
01100         noRecurs = page1.m_norecurs == TRUE;
01101         sLastModule = page1.m_modname;
01102         sLastTag = page1.m_tagname;
01103
01104         page2.StoreValues();
01105         userHitOK = true;
01106     }
01107 #endif /* WIN32 */
01108 #if qUnix
01109     void *wid = UCreate_UntagModDlg();
01110
01111     UCvsRtagDel *dlg = new UCvsRtagDel();
01112     UCvsRtagDel_MAIN *tab1 = new UCvsRtagDel_MAIN(sLastModule, sLastTag,
01113                                                   noRecurs, lookAttic);
01114     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01115     dlg->AddPage(tab1, UCvsRtagDel::kTabGeneral, 0);
01116
01117     if(dlg->DoModal())
01118     {
01119         lookAttic = tab1->m_attic;
01120         noRecurs = tab1->m_norecurs;
01121         sLastModule = tab1->m_modname;
01122         sLastTag = tab1->m_tagname;
01123
01124         userHitOK = true;
01125     }
01126
01127     delete dlg;
01128 #endif // qUnix
01129 #ifdef qMacCvsPP
01130     StDialogHandler theHandler(dlg_RtagDelete, LCommander::GetTopCommander());
01131     LWindow *theDialog = theHandler.GetDialog();
01132     ThrowIfNil_(theDialog);
01133     static UInt16 sRuntimePanel = 1;
01134
01135     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01136         (theDialog->FindPaneByID(item_MultiViewPrefs));
01137     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01138
01139     multiView->SwitchToPanel(2);
01140     DoDataExchange_Globals(theDialog, true);
01141     multiView->SwitchToPanel(1);
01142     DoDataExchange_RtagDeleteMain(theDialog, sLastModule, sLastTag,
01143         noRecurs, lookAttic, true);
01144
01145     groupView->SetValue(sRuntimePanel);
01146     theDialog->Show();
01147     MessageT hitMessage;
01148     while (true)
01149     {       // Let DialogHandler process events
01150         hitMessage = theHandler.DoDialog();
01151
01152         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01153             break;
01154     }
01155     theDialog->Hide();
01156     sRuntimePanel = groupView->GetValue();
01157
01158     if(hitMessage == msg_OK)
01159     {
01160         multiView->SwitchToPanel(1);
01161         DoDataExchange_RtagDeleteMain(theDialog, sLastModule, sLastTag,
01162             noRecurs, lookAttic, false);
01163         multiView->SwitchToPanel(2);
01164         DoDataExchange_Globals(theDialog, false);
01165         userHitOK = true;
01166     }
01167 #endif /* qMacCvsPP */
01168
01169     if(userHitOK)
01170     {
01171         tagName = sLastTag;
01172         modName = sLastModule;
01173
01174         gCvsPrefs.save();
01175     }
01176
01177     return userHitOK;
01178 }
01179
01180 bool CompatRtagBranch(bool & noRecurs, CPStr & branchName,
01181                      CPStr & modName, CPStr & date, CPStr & rev,
01182                      bool & useMostRecent, bool & lookAttic)
01183 {
01184     bool userHitOK = false;
01185
01186     static CPStr sLastModule;
01187     static CPStr sLastBranch;
01188     static CPStr sLastDate;
01189     static CPStr sLastRev;
01190
01191     bool hasDate = false;
01192     bool hasRev = false;
01193
01194     date = "";
01195     rev = "";
01196     branchName = "";
01197     modName = "";
01198     noRecurs = false;
01199     useMostRecent = false;
01200     lookAttic = false;
01201
01202 #ifdef WIN32
01203     CPropertySheet pages("Create branch settings");
01204     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
01205     CRtag_BRANCH page1(sLastModule, sLastBranch, hasDate, hasRev,
01206         sLastDate, sLastRev, noRecurs, useMostRecent, lookAttic);
01207     CGetPrefs_GLOBALS page2;
01208     pages.AddPage(&page1);
01209     pages.AddPage(&page2);
01210     if(pages.DoModal() == IDOK)
01211     {
01212         lookAttic = page1.m_attic == TRUE;
01213         sLastDate = page1.m_date;
01214         sLastRev = page1.m_rev;
01215         hasDate = page1.m_hasdate == TRUE;
01216         hasRev = page1.m_hasrev == TRUE;
01217         noRecurs = page1.m_norecurs == TRUE;
01218         useMostRecent = page1.m_match == TRUE;
01219         sLastModule = page1.m_modname;
01220         sLastBranch = page1.m_branchname;
01221
01222         page2.StoreValues();
01223         userHitOK = true;
01224     }
01225 #endif /* WIN32 */
01226 #if qUnix
01227     void *wid = UCreate_BranchModDlg();
01228
01229     UCvsRtagBranch *dlg = new UCvsRtagBranch();
01230     UCvsRtagBranch_MAIN *tab1 =
01231         new UCvsRtagBranch_MAIN(sLastModule, sLastBranch, hasDate, hasRev,
01232                                   sLastDate, sLastRev, noRecurs, useMostRecent,
01233                                   lookAttic);
01234     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01235     dlg->AddPage(tab1, UCvsRtagBranch::kTabGeneral, 0);
01236
01237     if(dlg->DoModal())
01238     {
01239         lookAttic = tab1->m_attic;
01240         sLastDate = tab1->m_date;
01241         sLastRev = tab1->m_rev;
01242         hasDate = tab1->m_hasdate;
01243         hasRev = tab1->m_hasrev;
01244         noRecurs = tab1->m_norecurs;
01245         useMostRecent = tab1->m_match;
01246         sLastModule = tab1->m_modname;
01247         sLastBranch = tab1->m_tagname;
01248
01249         userHitOK = true;
01250     }
01251
01252     delete dlg;
01253 #endif // qUnix
01254 #ifdef qMacCvsPP
01255     StDialogHandler theHandler(dlg_RtagBranch, LCommander::GetTopCommander());
01256     LWindow *theDialog = theHandler.GetDialog();
01257     ThrowIfNil_(theDialog);
01258     static UInt16 sRuntimePanel = 1;
01259
01260     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01261         (theDialog->FindPaneByID(item_MultiViewPrefs));
01262     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01263
01264     multiView->SwitchToPanel(3);
01265     DoDataExchange_Globals(theDialog, true);
01266     multiView->SwitchToPanel(2);
01267     DoDataExchange_RtagBranchOptions(theDialog, noRecurs, true);
01268     multiView->SwitchToPanel(1);
01269     DoDataExchange_RtagBranchMain(theDialog, sLastModule, sLastBranch,
01270         hasDate, hasRev, sLastDate, sLastRev,
01271         useMostRecent, lookAttic, true);
01272
01273     groupView->SetValue(sRuntimePanel);
01274     theDialog->Show();
01275     MessageT hitMessage;
01276     while (true)
01277     {       // Let DialogHandler process events
01278         hitMessage = theHandler.DoDialog();
01279
01280         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01281             break;
01282     }
01283     theDialog->Hide();
01284     sRuntimePanel = groupView->GetValue();
01285
01286     if(hitMessage == msg_OK)
01287     {
01288         multiView->SwitchToPanel(1);
01289         DoDataExchange_RtagBranchMain(theDialog, sLastModule, sLastBranch,
01290             hasDate, hasRev, sLastDate, sLastRev,
01291             useMostRecent, lookAttic, false);
01292         multiView->SwitchToPanel(2);
01293         DoDataExchange_RtagBranchOptions(theDialog, noRecurs, false);
01294         multiView->SwitchToPanel(3);
01295         DoDataExchange_Globals(theDialog, false);
01296         userHitOK = true;
01297     }
01298 #endif /* qMacCvsPP */
01299
01300     if(userHitOK)
01301     {
01302         if(hasDate && !sLastDate.empty())
01303             date = sLastDate;
01304         if(hasRev && !sLastRev.empty())
01305             rev = sLastRev;
01306
01307         branchName = sLastBranch;
01308         modName = sLastModule;
01309
01310         gCvsPrefs.save();
01311     }
01312
01313     return userHitOK;
01314 }
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/RtagDlg.h Source File

common/RtagDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- July 1998
00019  */
00020
00021 /*
00022  * RtagDlg.h : the cvs rtag dialog
00023  */
00024
00025 #if !defined(AFX_RTAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_RTAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 #include "CPStr.h"
00033
00034 bool CompatRtagCreate(bool & noRecurs, bool & overwriteExisting, CPStr & tagName,
00035                      CPStr & modName, CPStr & date, CPStr & rev,
00036                      bool & useMostRecent, bool & lookAttic);
00037 bool CompatRtagDelete(bool & noRecurs, bool & lookAttic,
00038                      CPStr & tagName, CPStr & modName);
00039 bool CompatRtagBranch(bool & noRecurs, CPStr & branchName,
00040                      CPStr & modName, CPStr & date, CPStr & rev,
00041                      bool & useMostRecent, bool & lookAttic);
00042     // get the rtag options...
00043
00044 #ifdef WIN32
00045
00046 // CRtag_CREATE dialog
00047
00048 class CRtag_CREATE : public CPropertyPage
00049 {
00050     DECLARE_DYNCREATE(CRtag_CREATE)
00051
00052 // Construction
00053 public:
00054     CRtag_CREATE::CRtag_CREATE(const char * sLastModule, const char * sLastTag,
00055         bool hasDate, bool hasRev,
00056         const char * sLastDate, const char * sLastRev,
00057         bool noRecurs, bool overwriteExist,
00058         bool useMostRecent, bool lookAttic);
00059     CRtag_CREATE();
00060     ~CRtag_CREATE();
00061
00062 // Dialog Data
00063     //{{AFX_DATA(CRtag_CREATE)
00064     enum { IDD = IDD_RTAG_CREATE };
00065     BOOL    m_attic;
00066     CString m_date;
00067     CString m_rev;
00068     CComboBox   m_revdef;
00069     CComboBox   m_datedef;
00070     BOOL    m_hasdate;
00071     BOOL    m_hasrev;
00072     BOOL    m_match;
00073     BOOL    m_norecurs;
00074     BOOL    m_overwrite;
00075     CString m_modname;
00076     CString m_tagname;
00077     //}}AFX_DATA
00078
00079
00080 // Overrides
00081     // ClassWizard generate virtual function overrides
00082     //{{AFX_VIRTUAL(CRtag_CREATE)
00083     protected:
00084     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00085     //}}AFX_VIRTUAL
00086
00087 // Implementation
00088 protected:
00089     // Generated message map functions
00090     //{{AFX_MSG(CRtag_CREATE)
00091     afx_msg void OnDate();
00092     afx_msg void OnRev();
00093     //}}AFX_MSG
00094     DECLARE_MESSAGE_MAP()
00095
00096 };
00097
00099 // CRtag_DELETE dialog
00100
00101 class CRtag_DELETE : public CPropertyPage
00102 {
00103     DECLARE_DYNCREATE(CRtag_DELETE)
00104
00105 // Construction
00106 public:
00107     CRtag_DELETE::CRtag_DELETE(const char * sLastModule,
00108         const char * sLastBranch, bool noRecurs, bool lookAttic);
00109     CRtag_DELETE();
00110     ~CRtag_DELETE();
00111
00112 // Dialog Data
00113     //{{AFX_DATA(CRtag_DELETE)
00114     enum { IDD = IDD_RTAG_DELETE };
00115     BOOL    m_attic;
00116     BOOL    m_norecurs;
00117     CString m_modname;
00118     CString m_tagname;
00119     //}}AFX_DATA
00120
00121
00122 // Overrides
00123     // ClassWizard generate virtual function overrides
00124     //{{AFX_VIRTUAL(CRtag_DELETE)
00125     protected:
00126     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00127     //}}AFX_VIRTUAL
00128
00129 // Implementation
00130 protected:
00131     // Generated message map functions
00132     //{{AFX_MSG(CRtag_DELETE)
00133     //}}AFX_MSG
00134     DECLARE_MESSAGE_MAP()
00135
00136 };
00137
00139 // CRtag_BRANCH dialog
00140
00141 class CRtag_BRANCH : public CPropertyPage
00142 {
00143     DECLARE_DYNCREATE(CRtag_BRANCH)
00144
00145 // Construction
00146 public:
00147     CRtag_BRANCH::CRtag_BRANCH(const char * sLastModule, const char * sLastBranch,
00148         bool hasDate, bool hasRev,
00149         const char * sLastDate, const char * sLastRev,
00150         bool noRecurs, bool useMostRecent, bool lookAttic);
00151     CRtag_BRANCH();
00152     ~CRtag_BRANCH();
00153
00154 // Dialog Data
00155     //{{AFX_DATA(CRtag_BRANCH)
00156     enum { IDD = IDD_RTAG_BRANCH };
00157     BOOL    m_attic;
00158     CString m_date;
00159     CString m_rev;
00160     CComboBox   m_revdef;
00161     CComboBox   m_datedef;
00162     BOOL    m_hasdate;
00163     BOOL    m_hasrev;
00164     BOOL    m_match;
00165     BOOL    m_norecurs;
00166     BOOL    m_overwrite;
00167     CString m_modname;
00168     CString m_branchname;
00169     //}}AFX_DATA
00170
00171
00172 // Overrides
00173     // ClassWizard generate virtual function overrides
00174     //{{AFX_VIRTUAL(CRtag_BRANCH)
00175     protected:
00176     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00177     //}}AFX_VIRTUAL
00178
00179 // Implementation
00180 protected:
00181     // Generated message map functions
00182     //{{AFX_MSG(CRtag_BRANCH)
00183     afx_msg void OnDate();
00184     afx_msg void OnRev();
00185     //}}AFX_MSG
00186     DECLARE_MESSAGE_MAP()
00187
00188 };
00189
00190 //{{AFX_INSERT_LOCATION}}
00191 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00192 #endif /* WIN32 */
00193
00194 #endif // !defined(AFX_RTAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/SortList.h Source File

common/SortList.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 /*
00022  * SortList.cpp --- sorted list using binary sort
00023  */
00024
00025 #ifndef SORTLIST_H
00026 #define SORTLIST_H
00027
00028 #include <stdlib.h>
00029 #include <string.h>
00030 #include <errno.h>
00031
00032 #include <assert.h>
00033
00034 // Note : this templates require to have a ref. counting
00035 // and a correct operator= if the instancied class
00036 // has some allocations inside.
00037
00038 typedef enum
00039 {
00040     computeNone,
00041     computeLR
00042 } computeSort;
00043
00044 template <class T> class CSortList
00045 {
00046 public :
00047     // method to sort elements (similar to qsort, return -1, 0, 1)
00048     typedef int (*QsortMethod)(const T &, const T &);
00049
00050     CSortList(int def_size, QsortMethod method_sort)
00051     {
00052         assert(def_size > 1 && method_sort != 0L);
00053
00054         fDef = def_size;
00055         fMethod = method_sort;
00056         fMax = fNum = 0;
00057         fElems = 0L;
00058         fNewOne = false;
00059     }
00060
00061     ~CSortList()
00062     {
00063         Reset();
00064     }
00065
00066     // - insert or ignore (if already exists) an element in the list.
00067     // - return the location of the element in the list.
00068     int Insert(const T & entry, bool replaceIfAlreadyExists = false)
00069     {
00070         int index = Location(entry), i;
00071
00072         if(!fNewOne)
00073         {
00074             if(replaceIfAlreadyExists)
00075                 fElems[index] = entry;
00076
00077             return index;
00078         }
00079
00080         // check memory
00081         if(fNum == fMax)
00082         {
00083             T *newElems = 0L;
00084
00085             try
00086             {
00087                 newElems = new T[fMax + fDef];
00088
00089                 for(i = 0; i < fNum + 1; i++)
00090                 {
00091                     if(i < index)
00092                         newElems[i] = fElems[i];
00093                     else if(i == index)
00094                         newElems[i] = entry;
00095                     else
00096                         newElems[i] = fElems[i - 1];
00097                 }
00098             }
00099             catch(...)
00100             {
00101                 if(newElems != 0L)
00102                     delete[] newElems;
00103                 throw;
00104             }
00105
00106             fMax += fDef;
00107             fNum++;
00108             if(fElems != 0L)
00109                 delete[] fElems;
00110             fElems = newElems;
00111             return index;
00112         }
00113
00114         for(i = fNum - 1; i >= index; i--)
00115         {
00116             fElems[i + 1] = fElems[i];
00117         }
00118
00119         fElems[index] = entry;
00120         fNum++;
00121         return index;
00122     }
00123
00124     // say if this entry is already in the list
00125     // and return its index in the list (does not
00126     // change the row list).
00127     bool Inside(const T & entry, int *indexptr = 0L) const
00128     {
00129         int index = ((CSortList*)this)->Location(entry);
00130
00131         if(indexptr != 0L)
00132             *indexptr = fNewOne ? -1 : index;
00133
00134         return !fNewOne;
00135     }
00136
00137     // - insert or ignore (if already exists) an element in the list.
00138     // - return true if the information was ALREADY in the sorted list.
00139     bool InsideAndInsert(const T & entry, int * indexptr = 0L,
00140         bool replaceIfAlreadyExists = false)
00141     {
00142         int index = Insert(entry, replaceIfAlreadyExists);
00143         if(indexptr != 0L)
00144             *indexptr = index;
00145
00146         return !fNewOne;
00147     }
00148
00149     // delete the entry from the sorted list which matches
00150     // this entry. Returns false if no matching entry was found.
00151     bool Delete(const T & entry)
00152     {
00153         int index = Location(entry), i;
00154
00155         if(fNewOne)
00156             return false;
00157
00158         if(fNum == 1)
00159         {
00160             Reset();
00161             return true;
00162         }
00163
00164         for(i = index; i < fNum - 1; i++)
00165         {
00166             fElems[i] = fElems[i + 1];
00167         }
00168         --fNum;
00169         return true;
00170     }
00171
00172     // return an allocated copy of the sorted list.
00173     T *Result(int *num_elem)
00174     {
00175         *num_elem = 0;
00176
00177         if(fNum == 0)
00178             return 0L;
00179
00180         *num_elem = fNum;
00181         T *res = new T[fNum];
00182         for(int i = 0; i < fNum; i++)
00183         {
00184             res[i] = fElems[i];
00185         }
00186
00187         return res;
00188     }
00189
00190     // return an element of the list.
00191     inline const T & Get(int index) const
00192     {
00193         return Entry(index);
00194     }
00195
00196     // get ready for a new sorted list (another "Init" call is not necessary,
00197     // but you can do it to start another kind of sorted list)
00198     void Reset(void)
00199     {
00200         if(fElems != 0L)
00201             delete[] fElems;
00202         fMax = fNum = 0;
00203         fElems = 0L;
00204     }
00205
00206     // # elements in the sorted list at this time
00207     inline int NumOfElements(void) {return fNum;}
00208 private :
00209     QsortMethod fMethod;
00210     int fDef;       // default num of elem (ex: 100)
00211     int fNum;       // number of element
00212     int fMax;       // number of element allocated
00213     T *fElems;      // elements stored
00214     bool fNewOne;   // set by 'Location'
00215
00216     // return the element pointer by index.
00217     inline const T & Entry(int num_elem) const
00218     {
00219         assert(num_elem >= 0 && num_elem < fNum);
00220
00221         return fElems[num_elem];
00222     }
00223
00224     // - return the location of the element in the
00225     // sorted list (does not change the list).
00226     int Location(const T & entry)
00227     {
00228         int left, right, cmp_left = 0, cmp_right = 0;
00229         int cmp_middle, middle;
00230         computeSort compute;
00231
00232         if(fNum == 0)
00233         {
00234             fNewOne = true;
00235             return 0;
00236         }
00237
00238         fNewOne = false;
00239         left = 0;
00240         right = fNum - 1;
00241         compute = computeLR;
00242
00243         while(1)
00244         {
00245             middle = (left + right) / 2;
00246
00247             if(compute == computeLR)
00248             {
00249                 // firstime only
00250                 cmp_left = fMethod(Entry(left), entry);
00251                 cmp_right = fMethod(Entry(right), entry);
00252             }
00253             cmp_middle = fMethod(Entry(middle), entry);
00254
00255             // entry already exist (E == L || E == R)
00256             if(cmp_left == 0 || cmp_right == 0)
00257             {
00258                 return cmp_left == 0 ? left : right;
00259             }
00260
00261             // found an entry superior to the right (E > R && E < R + 1)
00262             if(cmp_right < 0)
00263             {
00264                 fNewOne = true;
00265                 return right + 1;
00266             }
00267
00268             // found an entry inferior to the left (L - 1 < E < L)
00269             if(cmp_left > 0)
00270             {
00271                 fNewOne = true;
00272                 return left;
00273             }
00274
00275             // found an entry inferior to the right (E > R - 1 && E < R)
00276             if(middle == left)
00277             {
00278                 fNewOne = true;
00279                 return right;
00280             }
00281
00282             // entry already exist (E == M)
00283             if(cmp_middle == 0)
00284                 return middle;
00285             // restart search (E > M && E < R)
00286             else if(cmp_middle < 0)
00287             {
00288                 compute = computeNone;
00289                 left = middle;
00290                 cmp_left = cmp_middle;
00291                 cmp_right = 1;
00292             }
00293             // restart search (E > L && E < M)
00294             else
00295             {
00296                 compute = computeNone;
00297                 right = middle;
00298                 cmp_right = cmp_middle;
00299                 cmp_left = -1;
00300             }
00301         }
00302         assert(0);
00303         return 0;
00304     }
00305 };
00306
00307 #endif // SORTLIST_H
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/TagDlg.cpp Source File

common/TagDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- July 1998
00019  */
00020
00021 /*
00022  * TagDlg.cpp : the cvs tag dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #   include "GetPrefs.h"
00030 #endif /* WIN32 */
00031
00032 #if qUnix
00033 #   include "UCvsDialogs.h"
00034 #endif
00035
00036 #ifdef qMacCvsPP
00037 #   include <UModalDialogs.h>
00038 #   include <LMultiPanelView.h>
00039 #   include <LCheckBox.h>
00040 #   include <LEditText.h>
00041 #   include <LPopupGroupBox.h>
00042 #   include <LRadioButton.h>
00043 #   include "LPopupFiller.h"
00044
00045 #   include "MacCvsConstant.h"
00046 #endif /* qMacCvsPP */
00047
00048 #include "TagDlg.h"
00049 #include "CvsPrefs.h"
00050 #include "UpdateDlg.h"
00051
00052 #ifdef WIN32
00053 #   ifdef _DEBUG
00054 #   define new DEBUG_NEW
00055 #   undef THIS_FILE
00056     static char THIS_FILE[] = __FILE__;
00057 #   endif
00058 #endif /* WIN32 */
00059
00060 #ifdef WIN32
00061
00062 // CTag_CREATE property page
00063
00064 IMPLEMENT_DYNCREATE(CTag_CREATE, CPropertyPage)
00065
00066 CTag_CREATE::CTag_CREATE(const char * sLastTag, bool noRecurs,
00067     bool overwriteExist, bool checkUnmod) : CPropertyPage(CTag_CREATE::IDD)
00068 {
00069     m_checkunmod = checkUnmod;
00070     m_norecurs = noRecurs;
00071     m_tagname = sLastTag;
00072     m_overwrite = overwriteExist;
00073 }
00074
00075 CTag_CREATE::CTag_CREATE() : CPropertyPage(CTag_CREATE::IDD)
00076 {
00077     //{{AFX_DATA_INIT(CTag_CREATE)
00078     m_checkunmod = FALSE;
00079     m_norecurs = FALSE;
00080     m_tagname = _T("");
00081     m_overwrite = FALSE;
00082     //}}AFX_DATA_INIT
00083 }
00084
00085 CTag_CREATE::~CTag_CREATE()
00086 {
00087 }
00088
00089 void CTag_CREATE::DoDataExchange(CDataExchange* pDX)
00090 {
00091     CPropertyPage::DoDataExchange(pDX);
00092     //{{AFX_DATA_MAP(CTag_CREATE)
00093     DDX_Check(pDX, IDC_CHECKUNMOD, m_checkunmod);
00094     DDX_Check(pDX, IDC_NORECURS, m_norecurs);
00095     DDX_CBString(pDX, IDC_TAGNAME, m_tagname);
00096     DDX_Control(pDX, IDC_TAGNAME, m_tag);
00097     DDX_Check(pDX, IDC_OVERWRITE, m_overwrite);
00098     //}}AFX_DATA_MAP
00099     DDV_MinChars(pDX, m_tagname, 1);
00100     DDX_ComboMString(pDX, IDC_TAGNAME, gRevNames, m_tag);
00101 }
00102
00103 BEGIN_MESSAGE_MAP(CTag_CREATE, CPropertyPage)
00104     //{{AFX_MSG_MAP(CTag_CREATE)
00105     //}}AFX_MSG_MAP
00106 END_MESSAGE_MAP()
00107
00109 // CTag_CREATE message handlers
00110
00112 // CTag_DELETE property page
00113
00114 IMPLEMENT_DYNCREATE(CTag_DELETE, CPropertyPage)
00115
00116 CTag_DELETE::CTag_DELETE(const char * sLastTag, bool noRecurs) :
00117     CPropertyPage(CTag_DELETE::IDD)
00118 {
00119     m_norecurs = noRecurs;
00120     m_tagname = sLastTag;
00121 }
00122
00123 CTag_DELETE::CTag_DELETE() : CPropertyPage(CTag_DELETE::IDD)
00124 {
00125     //{{AFX_DATA_INIT(CTag_DELETE)
00126     m_norecurs = FALSE;
00127     m_tagname = _T("");
00128     //}}AFX_DATA_INIT
00129 }
00130
00131 CTag_DELETE::~CTag_DELETE()
00132 {
00133 }
00134
00135 void CTag_DELETE::DoDataExchange(CDataExchange* pDX)
00136 {
00137     CPropertyPage::DoDataExchange(pDX);
00138     //{{AFX_DATA_MAP(CTag_DELETE)
00139     DDX_Check(pDX, IDC_NORECURS, m_norecurs);
00140     DDX_CBString(pDX, IDC_TAGNAME, m_tagname);
00141     DDX_Control(pDX, IDC_TAGNAME, m_tag);
00142     //}}AFX_DATA_MAP
00143     DDV_MinChars(pDX, m_tagname, 1);
00144     DDX_ComboMString(pDX, IDC_TAGNAME, gRevNames, m_tag);
00145 }
00146
00147 BEGIN_MESSAGE_MAP(CTag_DELETE, CPropertyPage)
00148     //{{AFX_MSG_MAP(CTag_DELETE)
00149     //}}AFX_MSG_MAP
00150 END_MESSAGE_MAP()
00151
00153 // CTag_DELETE message handlers
00154
00156 // CTag_BRANCH property page
00157
00158 IMPLEMENT_DYNCREATE(CTag_BRANCH, CPropertyPage)
00159
00160 CTag_BRANCH::CTag_BRANCH(const char * sLastBranch, bool noRecurs,
00161     bool checkUnmod) : CPropertyPage(CTag_BRANCH::IDD)
00162 {
00163     m_checkunmod = checkUnmod;
00164     m_norecurs = noRecurs;
00165     m_branchname = sLastBranch;
00166 }
00167
00168 CTag_BRANCH::CTag_BRANCH() : CPropertyPage(CTag_BRANCH::IDD)
00169 {
00170     //{{AFX_DATA_INIT(CTag_BRANCH)
00171     m_checkunmod = FALSE;
00172     m_norecurs = FALSE;
00173     m_branchname = _T("");
00174     //}}AFX_DATA_INIT
00175 }
00176
00177 CTag_BRANCH::~CTag_BRANCH()
00178 {
00179 }
00180
00181 void CTag_BRANCH::DoDataExchange(CDataExchange* pDX)
00182 {
00183     CPropertyPage::DoDataExchange(pDX);
00184     //{{AFX_DATA_MAP(CTag_BRANCH)
00185     DDX_Check(pDX, IDC_CHECKUNMOD, m_checkunmod);
00186     DDX_Check(pDX, IDC_NORECURS, m_norecurs);
00187     DDX_CBString(pDX, IDC_TAGNAME, m_branchname);
00188     DDX_Control(pDX, IDC_TAGNAME, m_branch);
00189     //}}AFX_DATA_MAP
00190     DDV_MinChars(pDX, m_branchname, 1);
00191     DDX_ComboMString(pDX, IDC_TAGNAME, gRevNames, m_branch);
00192 }
00193
00194 BEGIN_MESSAGE_MAP(CTag_BRANCH, CPropertyPage)
00195     //{{AFX_MSG_MAP(CTag_BRANCH)
00196     //}}AFX_MSG_MAP
00197 END_MESSAGE_MAP()
00198
00200 // CTag_BRANCH message handlers
00201 #endif /* WIN32 */
00202
00203 #ifdef qMacCvsPP
00204 static void DoDataExchange_TagCreateMain(LWindow *theDialog,
00205     CPStr & sLastTag, bool & noRecurs, bool & overwriteExist,
00206     bool & checkUnmod, bool putValue)
00207 {
00208     LEditText *tname = dynamic_cast<LEditText*>
00209         (theDialog->FindPaneByID(item_BranchRev));
00210     LCheckBox *chkNoRecurs = dynamic_cast<LCheckBox*>
00211         (theDialog->FindPaneByID(item_NoRecurs));
00212     LCheckBox *chkOverwrite = dynamic_cast<LCheckBox*>
00213         (theDialog->FindPaneByID(item_OverwriteRev));
00214     LCheckBox *chkUnmod = dynamic_cast<LCheckBox*>
00215         (theDialog->FindPaneByID(item_CheckUnmod));
00216     LPopupFiller *fillTag = dynamic_cast<LPopupFiller*>
00217         (theDialog->FindPaneByID(item_FillerTag));
00218
00219     fillTag->DoDataExchange(gRevNames, putValue);
00220
00221     if(putValue)
00222     {
00223         chkNoRecurs->SetValue(noRecurs ? Button_On : Button_Off);
00224         chkOverwrite->SetValue(overwriteExist ? Button_On : Button_Off);
00225         chkUnmod->SetValue(checkUnmod ? Button_On : Button_Off);
00226         tname->SetText((Ptr)(const char *)sLastTag, sLastTag.length());
00227     }
00228     else
00229     {
00230         char str[255];
00231         Size len;
00232
00233         tname->GetText(str, 254, &len);
00234         sLastTag.set(str, len);
00235         noRecurs = chkNoRecurs->GetValue() == Button_On;
00236         overwriteExist = chkOverwrite->GetValue() == Button_On;
00237         checkUnmod = chkUnmod->GetValue() == Button_On;
00238     }
00239 }
00240
00241 static void DoDataExchange_TagDeleteMain(LWindow *theDialog,
00242     CPStr & sLastTag, bool & noRecurs, bool putValue)
00243 {
00244     LEditText *tname = dynamic_cast<LEditText*>
00245         (theDialog->FindPaneByID(item_BranchRev));
00246     LCheckBox *chkNoRecurs = dynamic_cast<LCheckBox*>
00247         (theDialog->FindPaneByID(item_NoRecurs));
00248     LPopupFiller *fillTag = dynamic_cast<LPopupFiller*>
00249         (theDialog->FindPaneByID(item_FillerTag));
00250
00251     fillTag->DoDataExchange(gRevNames, putValue);
00252
00253     if(putValue)
00254     {
00255         tname->SetText((Ptr)(const char *)sLastTag, sLastTag.length());
00256         chkNoRecurs->SetValue(noRecurs ? Button_On : Button_Off);
00257     }
00258     else
00259     {
00260         noRecurs = chkNoRecurs->GetValue() == Button_On;
00261
00262         char str[255];
00263         Size len;
00264
00265         tname->GetText(str, 254, &len);
00266         sLastTag.set(str, len);
00267     }
00268 }
00269
00270 static void DoDataExchange_TagBranchMain(LWindow *theDialog,
00271     CPStr & sLastBranch, bool & noRecurs, bool & checkUnmod, bool putValue)
00272 {
00273     LEditText *tname = dynamic_cast<LEditText*>
00274         (theDialog->FindPaneByID(item_BranchRev));
00275     LCheckBox *chkNoRecurs = dynamic_cast<LCheckBox*>
00276         (theDialog->FindPaneByID(item_NoRecurs));
00277     LCheckBox *chkUnmod = dynamic_cast<LCheckBox*>
00278         (theDialog->FindPaneByID(item_CheckUnmod));
00279     LPopupFiller *fillTag = dynamic_cast<LPopupFiller*>
00280         (theDialog->FindPaneByID(item_FillerTag));
00281
00282     fillTag->DoDataExchange(gRevNames, putValue);
00283
00284     if(putValue)
00285     {
00286         chkNoRecurs->SetValue(noRecurs ? Button_On : Button_Off);
00287         chkUnmod->SetValue(checkUnmod ? Button_On : Button_Off);
00288         tname->SetText((Ptr)(const char *)sLastBranch, sLastBranch.length());
00289     }
00290     else
00291     {
00292         char str[255];
00293         Size len;
00294
00295         tname->GetText(str, 254, &len);
00296         sLastBranch.set(str, len);
00297         noRecurs = chkNoRecurs->GetValue() == Button_On;
00298         checkUnmod = chkUnmod->GetValue() == Button_On;
00299     }
00300 }
00301
00302 static void DoDataExchange_TagBranchOptions(LWindow *theDialog,
00303     bool & noRecurs, bool putValue)
00304 {
00305     LCheckBox *chkNoRecurs = dynamic_cast<LCheckBox*>
00306         (theDialog->FindPaneByID(item_NoRecurs));
00307
00308     if(putValue)
00309     {
00310         chkNoRecurs->SetValue(noRecurs ? Button_On : Button_Off);
00311     }
00312     else
00313     {
00314         noRecurs = chkNoRecurs->GetValue() == Button_On;
00315     }
00316 }
00317 #endif /* qMacCvsPP */
00318
00319 #if qUnix
00320 class UCvsTagCreate : public UWidget
00321 {
00322     UDECLARE_DYNAMIC(UCvsTagCreate)
00323 public:
00324     UCvsTagCreate() : UWidget(::UEventGetWidID()) {}
00325     virtual ~UCvsTagCreate() {}
00326
00327     enum
00328     {
00329         kOK = EV_COMMAND_START, // 0
00330         kCancel,                // 1
00331         kTabGeneral             // 2
00332     };
00333
00334     virtual void DoDataExchange(bool fill);
00335
00336 protected:
00337     ev_msg int OnOK(void);
00338     ev_msg int OnCancel(void);
00339
00340     UDECLARE_MESSAGE_MAP()
00341 };
00342
00343 UIMPLEMENT_DYNAMIC(UCvsTagCreate, UWidget)
00344
00345 UBEGIN_MESSAGE_MAP(UCvsTagCreate, UWidget)
00346     ON_UCOMMAND(UCvsTagCreate::kOK, UCvsTagCreate::OnOK)
00347     ON_UCOMMAND(UCvsTagCreate::kCancel, UCvsTagCreate::OnCancel)
00348 UEND_MESSAGE_MAP()
00349
00350 int UCvsTagCreate::OnOK(void)
00351 {
00352     EndModal(true);
00353     return 0;
00354 }
00355
00356 int UCvsTagCreate::OnCancel(void)
00357 {
00358     EndModal(false);
00359     return 0;
00360 }
00361
00362 void UCvsTagCreate::DoDataExchange(bool fill)
00363 {
00364     if(fill)
00365     {
00366     }
00367     else
00368     {
00369     }
00370 }
00371
00372 class UCvsTagCreate_MAIN : public UWidget
00373 {
00374     UDECLARE_DYNAMIC(UCvsTagCreate_MAIN)
00375 public:
00376     UCvsTagCreate_MAIN(const char * sLastTag, bool noRecurs,
00377                        bool overwriteExist, bool checkUnmod);
00378     virtual ~UCvsTagCreate_MAIN() {}
00379
00380     enum
00381     {
00382         kEditTag = EV_COMMAND_START,    // 0
00383         kCheckRecurs,       // 1
00384         kCheckUnmod,        // 2
00385         kCheckOverwrite,    // 3
00386     };
00387
00388     virtual void DoDataExchange(bool fill);
00389
00390     UStr m_tagname;
00391     bool m_norecurs;
00392     bool m_checkunmod;
00393     bool m_overwrite;
00394 protected:
00395
00396     UDECLARE_MESSAGE_MAP()
00397 };
00398
00399 UIMPLEMENT_DYNAMIC(UCvsTagCreate_MAIN, UWidget)
00400
00401 UBEGIN_MESSAGE_MAP(UCvsTagCreate_MAIN, UWidget)
00402 UEND_MESSAGE_MAP()
00403
00404 UCvsTagCreate_MAIN::UCvsTagCreate_MAIN(const char * sLastTag, bool noRecurs,
00405                        bool overwriteExist, bool checkUnmod) : UWidget(::UEventGetWidID())
00406 {
00407     m_tagname = sLastTag;
00408     m_norecurs = noRecurs;
00409     m_checkunmod = checkUnmod;
00410     m_overwrite = overwriteExist;
00411 }
00412
00413 void UCvsTagCreate_MAIN::DoDataExchange(bool fill)
00414 {
00415     ::DoDataExchange(fill, GetWidID(), kEditTag, gRevNames);
00416
00417     if(fill)
00418     {
00419         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditTag, (void *)(const char *)m_tagname);
00420
00421         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckUnmod, m_checkunmod), 0L);
00422         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRecurs, m_norecurs), 0L);
00423         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckOverwrite, m_overwrite), 0L);
00424     }
00425     else
00426     {
00427         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditTag, &m_tagname);
00428
00429         m_checkunmod = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckUnmod, 0L);
00430         m_norecurs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRecurs, 0L);
00431         m_overwrite = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckOverwrite, 0L);
00432     }
00433 }
00434
00435 class UCvsTagDel : public UWidget
00436 {
00437     UDECLARE_DYNAMIC(UCvsTagDel)
00438 public:
00439     UCvsTagDel() : UWidget(::UEventGetWidID()) {}
00440     virtual ~UCvsTagDel() {}
00441
00442     enum
00443     {
00444         kOK = EV_COMMAND_START, // 0
00445         kCancel,                // 1
00446         kTabGeneral             // 2
00447     };
00448
00449     virtual void DoDataExchange(bool fill);
00450
00451 protected:
00452     ev_msg int OnOK(void);
00453     ev_msg int OnCancel(void);
00454
00455     UDECLARE_MESSAGE_MAP()
00456 };
00457
00458 UIMPLEMENT_DYNAMIC(UCvsTagDel, UWidget)
00459
00460 UBEGIN_MESSAGE_MAP(UCvsTagDel, UWidget)
00461     ON_UCOMMAND(UCvsTagDel::kOK, UCvsTagDel::OnOK)
00462     ON_UCOMMAND(UCvsTagDel::kCancel, UCvsTagDel::OnCancel)
00463 UEND_MESSAGE_MAP()
00464
00465 int UCvsTagDel::OnOK(void)
00466 {
00467     EndModal(true);
00468     return 0;
00469 }
00470
00471 int UCvsTagDel::OnCancel(void)
00472 {
00473     EndModal(false);
00474     return 0;
00475 }
00476
00477 void UCvsTagDel::DoDataExchange(bool fill)
00478 {
00479     if(fill)
00480     {
00481     }
00482     else
00483     {
00484     }
00485 }
00486
00487 class UCvsTagDel_MAIN : public UWidget
00488 {
00489     UDECLARE_DYNAMIC(UCvsTagDel_MAIN)
00490 public:
00491     UCvsTagDel_MAIN(const char * sLastTag, bool noRecurs);
00492     virtual ~UCvsTagDel_MAIN() {}
00493
00494     enum
00495     {
00496         kEditTag = EV_COMMAND_START,    // 0
00497         kCheckRecurs        // 1
00498     };
00499
00500     virtual void DoDataExchange(bool fill);
00501
00502     bool m_norecurs;
00503     UStr m_tagname;
00504 protected:
00505
00506     UDECLARE_MESSAGE_MAP()
00507 };
00508
00509 UIMPLEMENT_DYNAMIC(UCvsTagDel_MAIN, UWidget)
00510
00511 UBEGIN_MESSAGE_MAP(UCvsTagDel_MAIN, UWidget)
00512 UEND_MESSAGE_MAP()
00513
00514 UCvsTagDel_MAIN::UCvsTagDel_MAIN(const char * sLastTag, bool noRecurs) : UWidget(::UEventGetWidID())
00515 {
00516     m_norecurs = noRecurs;
00517     m_tagname = sLastTag;
00518 }
00519
00520 void UCvsTagDel_MAIN::DoDataExchange(bool fill)
00521 {
00522     ::DoDataExchange(fill, GetWidID(), kEditTag, gRevNames);
00523     if(fill)
00524     {
00525         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditTag, (void *)(const char *)m_tagname);
00526
00527         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRecurs, m_norecurs), 0L);
00528     }
00529     else
00530     {
00531         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditTag, &m_tagname);
00532
00533         m_norecurs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRecurs, 0L);
00534     }
00535 }
00536
00537 class UCvsTagBranch : public UWidget
00538 {
00539     UDECLARE_DYNAMIC(UCvsTagBranch)
00540 public:
00541     UCvsTagBranch() : UWidget(::UEventGetWidID()) {}
00542     virtual ~UCvsTagBranch() {}
00543
00544     enum
00545     {
00546         kOK = EV_COMMAND_START, // 0
00547         kCancel,                // 1
00548         kTabGeneral             // 2
00549     };
00550
00551     virtual void DoDataExchange(bool fill);
00552
00553 protected:
00554     ev_msg int OnOK(void);
00555     ev_msg int OnCancel(void);
00556
00557     UDECLARE_MESSAGE_MAP()
00558 };
00559
00560 UIMPLEMENT_DYNAMIC(UCvsTagBranch, UWidget)
00561
00562 UBEGIN_MESSAGE_MAP(UCvsTagBranch, UWidget)
00563     ON_UCOMMAND(UCvsTagBranch::kOK, UCvsTagBranch::OnOK)
00564     ON_UCOMMAND(UCvsTagBranch::kCancel, UCvsTagBranch::OnCancel)
00565 UEND_MESSAGE_MAP()
00566
00567 int UCvsTagBranch::OnOK(void)
00568 {
00569     EndModal(true);
00570     return 0;
00571 }
00572
00573 int UCvsTagBranch::OnCancel(void)
00574 {
00575     EndModal(false);
00576     return 0;
00577 }
00578
00579 void UCvsTagBranch::DoDataExchange(bool fill)
00580 {
00581     if(fill)
00582     {
00583     }
00584     else
00585     {
00586     }
00587 }
00588
00589 class UCvsTagBranch_MAIN : public UWidget
00590 {
00591     UDECLARE_DYNAMIC(UCvsTagBranch_MAIN)
00592 public:
00593     UCvsTagBranch_MAIN(const char * sLastTag, bool noRecurs,
00594                        bool checkUnmod);
00595     virtual ~UCvsTagBranch_MAIN() {}
00596
00597     enum
00598     {
00599         kEditTag = EV_COMMAND_START,    // 0
00600         kCheckRecurs,       // 1
00601         kCheckUnmod         // 2
00602     };
00603
00604     virtual void DoDataExchange(bool fill);
00605
00606     UStr m_tagname;
00607     bool m_norecurs;
00608     bool m_checkunmod;
00609 protected:
00610
00611     UDECLARE_MESSAGE_MAP()
00612 };
00613
00614 UIMPLEMENT_DYNAMIC(UCvsTagBranch_MAIN, UWidget)
00615
00616 UBEGIN_MESSAGE_MAP(UCvsTagBranch_MAIN, UWidget)
00617 UEND_MESSAGE_MAP()
00618
00619 UCvsTagBranch_MAIN::UCvsTagBranch_MAIN(const char * sLastTag, bool noRecurs,
00620                                        bool checkUnmod) : UWidget(::UEventGetWidID())
00621 {
00622     m_tagname = sLastTag;
00623     m_norecurs = noRecurs;
00624     m_checkunmod = checkUnmod;
00625 }
00626
00627 void UCvsTagBranch_MAIN::DoDataExchange(bool fill)
00628 {
00629     ::DoDataExchange(fill, GetWidID(), kEditTag, gRevNames);
00630
00631     if(fill)
00632     {
00633         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditTag, (void *)(const char *)m_tagname);
00634
00635         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckUnmod, m_checkunmod), 0L);
00636         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRecurs, m_norecurs), 0L);
00637     }
00638     else
00639     {
00640         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditTag, &m_tagname);
00641
00642         m_checkunmod = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckUnmod, 0L);
00643         m_norecurs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRecurs, 0L);
00644     }
00645 }
00646 #endif // qUnix
00647
00648 bool CompatTagCreate(bool & noRecurs, bool & overwriteExisting,
00649                      CPStr & tagName, bool & checkUnmod)
00650 {
00651     bool userHitOK = false;
00652
00653     static CPStr sLastTag;
00654
00655     tagName = "";
00656     noRecurs = false;
00657     overwriteExisting = false;
00658     checkUnmod = false;
00659
00660 #ifdef WIN32
00661     CPropertySheet pages("Create tag settings");
00662     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00663     CTag_CREATE page1(sLastTag, noRecurs, overwriteExisting,
00664         checkUnmod);
00665     CGetPrefs_GLOBALS page2;
00666     pages.AddPage(&page1);
00667     pages.AddPage(&page2);
00668     if(pages.DoModal() == IDOK)
00669     {
00670         checkUnmod = page1.m_checkunmod == TRUE;
00671         noRecurs = page1.m_norecurs == TRUE;
00672         sLastTag = page1.m_tagname;
00673         overwriteExisting = page1.m_overwrite == TRUE;
00674
00675         page2.StoreValues();
00676         userHitOK = true;
00677     }
00678 #endif /* WIN32 */
00679 #if qUnix
00680     void *wid = UCreate_TagDlg();
00681
00682     UCvsTagCreate *dlg = new UCvsTagCreate();
00683     UCvsTagCreate_MAIN *tab1 =
00684         new UCvsTagCreate_MAIN(sLastTag, noRecurs, overwriteExisting, checkUnmod);
00685     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00686     dlg->AddPage(tab1, UCvsTagCreate::kTabGeneral, 0);
00687
00688     if(dlg->DoModal())
00689     {
00690         checkUnmod = tab1->m_checkunmod;
00691         noRecurs = tab1->m_norecurs;
00692         sLastTag = tab1->m_tagname;
00693         overwriteExisting = tab1->m_overwrite;
00694
00695         userHitOK = true;
00696     }
00697
00698     delete dlg;
00699 #endif // qUnix
00700 #ifdef qMacCvsPP
00701     StDialogHandler theHandler(dlg_TagCreate, LCommander::GetTopCommander());
00702     LWindow *theDialog = theHandler.GetDialog();
00703     ThrowIfNil_(theDialog);
00704     static UInt16 sRuntimePanel = 1;
00705
00706     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00707         (theDialog->FindPaneByID(item_MultiViewPrefs));
00708     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00709
00710     multiView->SwitchToPanel(2);
00711     DoDataExchange_Globals(theDialog, true);
00712     multiView->SwitchToPanel(1);
00713     DoDataExchange_TagCreateMain(theDialog, sLastTag,
00714         noRecurs, overwriteExisting, checkUnmod, true);
00715
00716     groupView->SetValue(sRuntimePanel);
00717     theDialog->Show();
00718     MessageT hitMessage;
00719     while (true)
00720     {       // Let DialogHandler process events
00721         hitMessage = theHandler.DoDialog();
00722
00723         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00724             break;
00725     }
00726     theDialog->Hide();
00727     sRuntimePanel = groupView->GetValue();
00728
00729     if(hitMessage == msg_OK)
00730     {
00731         multiView->SwitchToPanel(1);
00732         DoDataExchange_TagCreateMain(theDialog, sLastTag,
00733             noRecurs, overwriteExisting, checkUnmod, false);
00734         multiView->SwitchToPanel(2);
00735         DoDataExchange_Globals(theDialog, false);
00736         userHitOK = true;
00737     }
00738 #endif /* qMacCvsPP */
00739
00740     if(userHitOK)
00741     {
00742         tagName = sLastTag;
00743
00744         gCvsPrefs.save();
00745     }
00746
00747     return userHitOK;
00748 }
00749
00750 bool CompatTagDelete(bool & noRecurs, CPStr & tagName)
00751 {
00752
00753     bool userHitOK = false;
00754
00755     static CPStr sLastTag;
00756
00757     tagName = "";
00758     noRecurs = false;
00759
00760 #ifdef WIN32
00761     CPropertySheet pages("Delete tag settings");
00762     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00763     CTag_DELETE page1(sLastTag, noRecurs);
00764     CGetPrefs_GLOBALS page2;
00765     pages.AddPage(&page1);
00766     pages.AddPage(&page2);
00767     if(pages.DoModal() == IDOK)
00768     {
00769         noRecurs = page1.m_norecurs == TRUE;
00770         sLastTag = page1.m_tagname;
00771
00772         page2.StoreValues();
00773         userHitOK = true;
00774     }
00775 #endif /* WIN32 */
00776 #if qUnix
00777     void *wid = UCreate_UntagDlg();
00778
00779     UCvsTagDel *dlg = new UCvsTagDel();
00780     UCvsTagDel_MAIN *tab1 = new UCvsTagDel_MAIN(sLastTag, noRecurs);
00781     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00782     dlg->AddPage(tab1, UCvsTagDel::kTabGeneral, 0);
00783
00784     if(dlg->DoModal())
00785     {
00786         noRecurs = tab1->m_norecurs;
00787         sLastTag = tab1->m_tagname;
00788
00789         userHitOK = true;
00790     }
00791
00792     delete dlg;
00793 #endif // qUnix
00794 #ifdef qMacCvsPP
00795     StDialogHandler theHandler(dlg_TagDelete, LCommander::GetTopCommander());
00796     LWindow *theDialog = theHandler.GetDialog();
00797     ThrowIfNil_(theDialog);
00798     static UInt16 sRuntimePanel = 1;
00799
00800     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00801         (theDialog->FindPaneByID(item_MultiViewPrefs));
00802     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00803
00804     multiView->SwitchToPanel(2);
00805     DoDataExchange_Globals(theDialog, true);
00806     multiView->SwitchToPanel(1);
00807     DoDataExchange_TagDeleteMain(theDialog, sLastTag, noRecurs, true);
00808
00809     groupView->SetValue(sRuntimePanel);
00810     theDialog->Show();
00811     MessageT hitMessage;
00812     while (true)
00813     {       // Let DialogHandler process events
00814         hitMessage = theHandler.DoDialog();
00815
00816         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00817             break;
00818     }
00819     theDialog->Hide();
00820     sRuntimePanel = groupView->GetValue();
00821
00822     if(hitMessage == msg_OK)
00823     {
00824         multiView->SwitchToPanel(1);
00825         DoDataExchange_TagDeleteMain(theDialog, sLastTag, noRecurs, false);
00826         multiView->SwitchToPanel(2);
00827         DoDataExchange_Globals(theDialog, false);
00828         userHitOK = true;
00829     }
00830 #endif /* qMacCvsPP */
00831
00832     if(userHitOK)
00833     {
00834         tagName = sLastTag;
00835
00836         gCvsPrefs.save();
00837     }
00838
00839     return userHitOK;
00840 }
00841
00842 bool CompatTagBranch(bool & noRecurs, CPStr & branchName,
00843                      bool & checkUnmod)
00844 {
00845     bool userHitOK = false;
00846
00847     static CPStr sLastBranch;
00848
00849     branchName = "";
00850     noRecurs = false;
00851     checkUnmod = false;
00852
00853 #ifdef WIN32
00854     CPropertySheet pages("Create branch settings");
00855     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00856     CTag_BRANCH page1(sLastBranch, noRecurs, checkUnmod);
00857     CGetPrefs_GLOBALS page2;
00858     pages.AddPage(&page1);
00859     pages.AddPage(&page2);
00860     if(pages.DoModal() == IDOK)
00861     {
00862         checkUnmod = page1.m_checkunmod == TRUE;
00863         noRecurs = page1.m_norecurs == TRUE;
00864         sLastBranch = page1.m_branchname;
00865
00866         page2.StoreValues();
00867         userHitOK = true;
00868     }
00869 #endif /* WIN32 */
00870 #if qUnix
00871     void *wid = UCreate_BranchDlg();
00872
00873     UCvsTagBranch *dlg = new UCvsTagBranch();
00874     UCvsTagBranch_MAIN *tab1 = new UCvsTagBranch_MAIN(sLastBranch, noRecurs, checkUnmod);
00875     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00876     dlg->AddPage(tab1, UCvsTagBranch::kTabGeneral, 0);
00877
00878     if(dlg->DoModal())
00879     {
00880         checkUnmod = tab1->m_checkunmod;
00881         noRecurs = tab1->m_norecurs;
00882         sLastBranch = tab1->m_tagname;
00883
00884         userHitOK = true;
00885     }
00886
00887     delete dlg;
00888 #endif // qUnix
00889 #ifdef qMacCvsPP
00890     StDialogHandler theHandler(dlg_TagBranch, LCommander::GetTopCommander());
00891     LWindow *theDialog = theHandler.GetDialog();
00892     ThrowIfNil_(theDialog);
00893     static UInt16 sRuntimePanel = 1;
00894
00895     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00896         (theDialog->FindPaneByID(item_MultiViewPrefs));
00897     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00898
00899     multiView->SwitchToPanel(2);
00900     DoDataExchange_Globals(theDialog, true);
00901     multiView->SwitchToPanel(1);
00902     DoDataExchange_TagBranchMain(theDialog, sLastBranch,
00903         noRecurs, checkUnmod, true);
00904
00905     groupView->SetValue(sRuntimePanel);
00906     theDialog->Show();
00907     MessageT hitMessage;
00908     while (true)
00909     {       // Let DialogHandler process events
00910         hitMessage = theHandler.DoDialog();
00911
00912         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00913             break;
00914     }
00915     theDialog->Hide();
00916     sRuntimePanel = groupView->GetValue();
00917
00918     if(hitMessage == msg_OK)
00919     {
00920         multiView->SwitchToPanel(1);
00921         DoDataExchange_TagBranchMain(theDialog, sLastBranch,
00922             noRecurs, checkUnmod, false);
00923         multiView->SwitchToPanel(2);
00924         DoDataExchange_Globals(theDialog, false);
00925         userHitOK = true;
00926     }
00927 #endif /* qMacCvsPP */
00928
00929     if(userHitOK)
00930     {
00931         branchName = sLastBranch;
00932
00933         gCvsPrefs.save();
00934     }
00935
00936     return userHitOK;
00937 }
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/TagDlg.h Source File

common/TagDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- July 1998
00019  */
00020
00021 /*
00022  * TagDlg.h : the cvs tag dialog
00023  */
00024
00025 #if !defined(AFX_TAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_TAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 #include "CPStr.h"
00033
00034 bool CompatTagCreate(bool & noRecurs, bool & overwriteExisting,
00035                      CPStr & tagName, bool & checkUnmod);
00036 bool CompatTagDelete(bool & noRecurs, CPStr & tagName);
00037 bool CompatTagBranch(bool & noRecurs, CPStr & branchName,
00038                      bool & checkUnmod);
00039     // get the tag options...
00040
00041 #ifdef WIN32
00042
00043 // CTag_CREATE dialog
00044
00045 class CTag_CREATE : public CPropertyPage
00046 {
00047     DECLARE_DYNCREATE(CTag_CREATE)
00048
00049 // Construction
00050 public:
00051     CTag_CREATE::CTag_CREATE(const char * sLastTag, bool noRecurs,
00052         bool overwriteExist, bool checkUnmod);
00053     CTag_CREATE();
00054     ~CTag_CREATE();
00055
00056 // Dialog Data
00057     //{{AFX_DATA(CTag_CREATE)
00058     enum { IDD = IDD_TAG_CREATE };
00059     BOOL    m_checkunmod;
00060     BOOL    m_norecurs;
00061     BOOL    m_overwrite;
00062     CString m_tagname;
00063     CComboBox m_tag;
00064     //}}AFX_DATA
00065
00066
00067 // Overrides
00068     // ClassWizard generate virtual function overrides
00069     //{{AFX_VIRTUAL(CTag_CREATE)
00070     protected:
00071     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00072     //}}AFX_VIRTUAL
00073
00074 // Implementation
00075 protected:
00076     // Generated message map functions
00077     //{{AFX_MSG(CTag_CREATE)
00078     //}}AFX_MSG
00079     DECLARE_MESSAGE_MAP()
00080
00081 };
00082
00084 // CTag_DELETE dialog
00085
00086 class CTag_DELETE : public CPropertyPage
00087 {
00088     DECLARE_DYNCREATE(CTag_DELETE)
00089
00090 // Construction
00091 public:
00092     CTag_DELETE::CTag_DELETE(const char * sLastBranch, bool noRecurs);
00093     CTag_DELETE();
00094     ~CTag_DELETE();
00095
00096 // Dialog Data
00097     //{{AFX_DATA(CTag_DELETE)
00098     enum { IDD = IDD_TAG_DELETE };
00099     BOOL    m_norecurs;
00100     CString m_tagname;
00101     CComboBox m_tag;
00102     //}}AFX_DATA
00103
00104
00105 // Overrides
00106     // ClassWizard generate virtual function overrides
00107     //{{AFX_VIRTUAL(CTag_DELETE)
00108     protected:
00109     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00110     //}}AFX_VIRTUAL
00111
00112 // Implementation
00113 protected:
00114     // Generated message map functions
00115     //{{AFX_MSG(CTag_DELETE)
00116     //}}AFX_MSG
00117     DECLARE_MESSAGE_MAP()
00118
00119 };
00120
00121 //{{AFX_INSERT_LOCATION}}
00122 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00123
00125 // CTag_BRANCH dialog
00126
00127 class CTag_BRANCH : public CPropertyPage
00128 {
00129     DECLARE_DYNCREATE(CTag_BRANCH)
00130
00131 // Construction
00132 public:
00133     CTag_BRANCH::CTag_BRANCH(const char * sLastBranch, bool noRecurs,
00134         bool checkUnmod);
00135     CTag_BRANCH();
00136     ~CTag_BRANCH();
00137
00138 // Dialog Data
00139     //{{AFX_DATA(CTag_BRANCH)
00140     enum { IDD = IDD_TAG_BRANCH };
00141     BOOL    m_checkunmod;
00142     BOOL    m_norecurs;
00143     CString m_branchname;
00144     CComboBox m_branch;
00145     //}}AFX_DATA
00146
00147
00148 // Overrides
00149     // ClassWizard generate virtual function overrides
00150     //{{AFX_VIRTUAL(CTag_BRANCH)
00151     protected:
00152     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00153     //}}AFX_VIRTUAL
00154
00155 // Implementation
00156 protected:
00157     // Generated message map functions
00158     //{{AFX_MSG(CTag_BRANCH)
00159     //}}AFX_MSG
00160     DECLARE_MESSAGE_MAP()
00161
00162 };
00163
00164 //{{AFX_INSERT_LOCATION}}
00165 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00166 #endif /* WIN32 */
00167
00168 #endif // !defined(AFX_TAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/TclGlue.cpp Source File

common/TclGlue.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1998
00019  * Modified : David Gravereaux <davygrvy@bigfoot.com> -- May 1999
00020  */
00021
00022 /*
00023  * TclGlue.cpp --- glue to the TCL language
00024  */
00025
00026 #include "stdafx.h"
00027
00028 #ifdef macintosh
00029 #   include "MacMisc.h"
00030 #endif
00031
00032 #include <stdarg.h>
00033 #include <string.h>
00034 #include <stdlib.h>
00035
00036 #ifdef HAVE_UNISTD_H
00037 #include <unistd.h>
00038 #endif
00039
00040 #if !defined(USE_TCL)
00041 #   define USE_TCL 1
00042 #endif
00043
00044 #ifdef qMacCvsPP
00045 #   include "MacCvsApp.h"
00046 #endif /* qMacCvsPP */
00047
00048 #if qCarbon
00049 #   include "TclGlue.mac.h"
00050 #endif
00051
00052 // this cannot work before the stub library is linked with wrong libraries
00053 // and it causes WinCvs to crash
00054 //#define USE_TCL_STUBS
00055
00056 #if !defined(__STDC__) && (defined(macintosh) || defined(WIN32))
00057 #   define __STDC__ 1
00058 #   define UNDEF_STDC
00059 #endif
00060
00061 #include "tcl.h"
00062
00063 #if TCL_MAJOR_VERSION != 8 && TCL_MINOR_VERSION < 1
00064 #   error "You need the Tcl 8.1.x header (or above) from Scriptics for this"
00065 #endif
00066
00067 #ifdef UNDEF_STDC
00068 #   undef __STDC__
00069 #   define __STDC__ 0
00070 #endif
00071
00072 #if 0//def WIN32
00073 //  this comes with the Scriptic release, or
00074 //  you can compile your own from generic/tclStubLib.c
00075 //  in the source release of Tcl and build it with any
00076 //  combination of the C runtime to match WinCVS, so you
00077 //  don't get those:
00078 // LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
00079 #pragma comment(lib,"tclstub81.lib")
00080 #endif
00081
00082 #include "TclGlue.h"
00083 #include "AppConsole.h"
00084 #include "AppGlue.h"
00085 #include "CvsArgs.h"
00086 #include "CvsEntries.h"
00087 #include "dll_loader.h"
00088 #include "FileTraversal.h"
00089 #include "MacrosSetup.h"
00090 #include "MoveToTrash.h"
00091 #include "CvsPrefs.h"
00092
00093 #ifdef WIN32
00094 #   include "wincvs.h"
00095 #   include "wincvsdebug.h"
00096
00097 #   ifdef _DEBUG
00098 #   define new DEBUG_NEW
00099 #   undef THIS_FILE
00100     static char THIS_FILE[] = __FILE__;
00101 #   endif
00102 #endif /* WIN32 */
00103
00104 #ifndef NEW
00105 #define NEW new
00106 #endif
00107
00108 #if defined(_MSC_VER) || qCarbon
00109 #   define DECLC extern "C"
00110 #else
00111 #   define DECLC
00112 #endif
00113
00114 #if defined(WIN32) || qCarbon
00115 #   define DEC_GLUE(f) (*f##_glue)
00116
00117     Tcl_Command DEC_GLUE(Tcl_CreateCommand)
00118         _ANSI_ARGS_((Tcl_Interp *interp, char *cmdName, Tcl_CmdProc *proc,
00119             ClientData clientData, Tcl_CmdDeleteProc *deleteProc));
00120     Tcl_Interp * DEC_GLUE(Tcl_CreateInterp) _ANSI_ARGS_((void));
00121     void DEC_GLUE(Tcl_AppendResult) _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp));
00122     void DEC_GLUE(Tcl_SetResult) _ANSI_ARGS_((Tcl_Interp *interp, char *string, Tcl_FreeProc *freeProc));
00123     void DEC_GLUE(Tcl_DeleteInterp) _ANSI_ARGS_((Tcl_Interp *interp));
00124     int DEC_GLUE(Tcl_Eval) _ANSI_ARGS_((Tcl_Interp *interp, char *string));
00125     int DEC_GLUE(Tcl_EvalFile) _ANSI_ARGS_((Tcl_Interp *interp, char *fileName));
00126     char *      DEC_GLUE(Tcl_Alloc) _ANSI_ARGS_((unsigned int size));
00127     void        DEC_GLUE(Tcl_Free) _ANSI_ARGS_((char *ptr));
00128     char *      DEC_GLUE(Tcl_Realloc) _ANSI_ARGS_((char *ptr,
00129                     unsigned int size));
00130     int     DEC_GLUE(Tcl_ExprLong) _ANSI_ARGS_((Tcl_Interp *interp,
00131                 char *string, long *ptr));
00132     char *      DEC_GLUE(Tcl_Concat) _ANSI_ARGS_((int argc, char **argv));
00133     char *      DEC_GLUE(Tcl_SetVar2) _ANSI_ARGS_((Tcl_Interp *interp,
00134                 char *part1, char *part2, char *newValue,
00135                 int flags));
00136     void        DEC_GLUE(Tcl_DStringStartSublist) _ANSI_ARGS_((
00137                 Tcl_DString *dsPtr));
00138     void        DEC_GLUE(Tcl_DStringEndSublist) _ANSI_ARGS_((Tcl_DString *dsPtr));
00139     void        DEC_GLUE(Tcl_DStringFree) _ANSI_ARGS_((Tcl_DString *dsPtr));
00140     void        DEC_GLUE(Tcl_DStringInit) _ANSI_ARGS_((Tcl_DString *dsPtr));
00141     void        DEC_GLUE(Tcl_DStringResult) _ANSI_ARGS_((Tcl_Interp *interp,
00142                 Tcl_DString *dsPtr));
00143     char *      DEC_GLUE(Tcl_DStringAppendElement) _ANSI_ARGS_((
00144                 Tcl_DString *dsPtr, CONST char *string));
00145     void        DEC_GLUE(TclFreeObj) _ANSI_ARGS_((Tcl_Obj *objPtr));
00146     void        DEC_GLUE(Tcl_SetObjResult) _ANSI_ARGS_((Tcl_Interp *interp,
00147                 Tcl_Obj *resultObjPtr));
00148     Tcl_Obj *   DEC_GLUE(Tcl_NewStringObj) _ANSI_ARGS_((CONST char *bytes,
00149                 int length));
00150     Tcl_Obj *   DEC_GLUE(Tcl_NewListObj) _ANSI_ARGS_((int objc,
00151                 Tcl_Obj *CONST objv[]));
00152     int     DEC_GLUE(Tcl_ListObjAppendElement) _ANSI_ARGS_((
00153                 Tcl_Interp *interp, Tcl_Obj *listPtr,
00154                 Tcl_Obj *objPtr));
00155
00156     void        DEC_GLUE(Tcl_SourceRCFile) _ANSI_ARGS_((Tcl_Interp * interp));
00157     int     DEC_GLUE(Tcl_Init) _ANSI_ARGS_((Tcl_Interp * interp));
00158     char *      DEC_GLUE(Tcl_SetVar) _ANSI_ARGS_((Tcl_Interp * interp,
00159                 char * varName, char * newValue, int flags));
00160     void        DEC_GLUE(Tcl_FindExecutable) _ANSI_ARGS_((CONST char * argv0));
00161
00162 #   define GLUE_WRAP(f) f##_glue
00163 #   define Tcl_CreateCommand GLUE_WRAP(Tcl_CreateCommand)
00164 #   define Tcl_CreateInterp GLUE_WRAP(Tcl_CreateInterp)
00165 #   define Tcl_AppendResult GLUE_WRAP(Tcl_AppendResult)
00166 #   define Tcl_SetResult GLUE_WRAP(Tcl_SetResult)
00167 #   define Tcl_DeleteInterp GLUE_WRAP(Tcl_DeleteInterp)
00168 #   define Tcl_Eval GLUE_WRAP(Tcl_Eval)
00169 #   define Tcl_EvalFile GLUE_WRAP(Tcl_EvalFile)
00170 #   define Tcl_Alloc GLUE_WRAP(Tcl_Alloc)
00171 #   define Tcl_Free GLUE_WRAP(Tcl_Free)
00172 #   define Tcl_Realloc GLUE_WRAP(Tcl_Realloc)
00173 #   define Tcl_ExprLong GLUE_WRAP(Tcl_ExprLong)
00174 #   define Tcl_Concat GLUE_WRAP(Tcl_Concat)
00175 #   define Tcl_SetVar2 GLUE_WRAP(Tcl_SetVar2)
00176 #   define Tcl_DStringStartSublist GLUE_WRAP(Tcl_DStringStartSublist)
00177 #   define Tcl_DStringEndSublist GLUE_WRAP(Tcl_DStringEndSublist)
00178 #   define Tcl_DStringFree GLUE_WRAP(Tcl_DStringFree)
00179 #   define Tcl_DStringInit GLUE_WRAP(Tcl_DStringInit)
00180 #   define Tcl_DStringResult GLUE_WRAP(Tcl_DStringResult)
00181 #   define Tcl_DStringAppendElement GLUE_WRAP(Tcl_DStringAppendElement)
00182 #   define TclFreeObj GLUE_WRAP(TclFreeObj)
00183 #   define Tcl_SetObjResult GLUE_WRAP(Tcl_SetObjResult)
00184 #   define Tcl_NewStringObj GLUE_WRAP(Tcl_NewStringObj)
00185 #   define Tcl_NewListObj GLUE_WRAP(Tcl_NewListObj)
00186 #   define Tcl_ListObjAppendElement GLUE_WRAP(Tcl_ListObjAppendElement)
00187 #   define Tcl_SourceRCFile GLUE_WRAP(Tcl_SourceRCFile)
00188 #   define Tcl_Init GLUE_WRAP(Tcl_Init)
00189 #   define Tcl_SetVar GLUE_WRAP(Tcl_SetVar)
00190 #   define Tcl_FindExecutable GLUE_WRAP(Tcl_FindExecutable)
00191 #endif /* WIN32 */
00192
00193 #if USE_TCL
00194
00195 // our app on OSX is CFM, while TCL is mach-o. We need to re-encode the function pointer
00196 // we give to the mach-o code
00197 #if qCarbon
00198 #   define _TCL_CALLBACK(f) ((Tcl_CmdProc *)_tcl_cfm_macho(f))
00199 #   define CompatLoadLibrary CarbonCompatLoadLibrary
00200 #   define CompatCloseLibrary CarbonCompatCloseLibrary
00201 #   define _CompatCallLibrary _CarbonCompatCallLibrary
00202 #else
00203 #   define _TCL_CALLBACK(f) f
00204 #endif
00205
00206 extern "C"
00207 {
00208     static int tclCvsProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]);
00209     static int tclHelpProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]);
00210     static int tclCvsOutProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]);
00211     static int tclCvsErrProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]);
00212     static int tclCvsBrowserProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]);
00213     static int tclCvsEntriesProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]);
00214     static void tclCvsEntriesDeleteProc(ClientData clientData);
00215 #ifdef WIN32
00216     static int tclDirProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]);
00217 #endif /* WIN32 */
00218
00219     static int tclCvsExitOnErrorProc(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]);
00220     static int tclCvsLastErrorCodeProc(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]);
00221     static int tclSetDebugLevelProc(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]);
00222 }
00223
00224 // the tcl browser class entity
00225 class CTCLBrowserEnt
00226 {
00227 public:
00228     CTCLBrowserEnt()
00229     {}
00230
00231     CTCLBrowserEnt(EntnodeData *data)
00232     : node(data)
00233     {}
00234
00235     CTCLBrowserEnt(const CTCLBrowserEnt & ent)
00236     : node(ent.node)
00237     {}
00238
00239     ~CTCLBrowserEnt()
00240     {}
00241
00242     CTCLBrowserEnt & operator=(const CTCLBrowserEnt & ent)
00243     {
00244         node = ent.node;
00245         return *this;
00246     }
00247
00248     bool IsSamePath(const char * pathstr) const
00249     {
00250         CStr path = pathstr;
00251         CTcl_Interp::Deunixfy(path);
00252
00253         CStr file;
00254         node.Data()->GetFullPathName(file);
00255         CTcl_Interp::Deunixfy(file);
00256
00257         return path.compare(file) == 0;
00258     }
00259
00260     EntnodeData* GetData() const
00261     {
00262         return node.Data();
00263     }
00264
00265     // returns normalized path and file name (GetName() may return relative path)
00266     void GetNormalized(CStr& path, CStr& fname) const
00267     {
00268         CStr file;
00269         node.Data()->GetFullPathName(file);
00270         CTcl_Interp::Deunixfy(file);
00271         SplitPath(file, path, fname);
00272     }
00273
00274 private:
00275     ENTNODE node;
00276 };
00277
00278 static std::vector<CTCLBrowserEnt> sTclBrowser;
00279
00280 class CTCLCvsConsole : public CCvsConsole
00281 {
00282 public:
00283     CTCLCvsConsole(Tcl_Interp *interp) : fInterp(interp)
00284     {
00285         fLen = 100;
00286         fAlloc = (char *)malloc((fLen + 1) * sizeof(char));
00287     }
00288     virtual ~CTCLCvsConsole()
00289     {
00290         if(fAlloc != 0L)
00291             free(fAlloc);
00292     }
00293
00294     virtual long cvs_out(char *txt, long len)
00295     {
00296         if(fAlloc == 0L)
00297             return 0;
00298
00299         if(len > fLen)
00300         {
00301             fLen = len;
00302             fAlloc = (char *)realloc(fAlloc, (fLen + 1) * sizeof(char));
00303         }
00304         if(fAlloc == 0L)
00305             return 0;
00306
00307         memcpy(fAlloc, txt, len * sizeof(char));
00308         fAlloc[len] = '\0';
00309
00310         Tcl_AppendResult(fInterp, fAlloc, 0L);
00311         return len;
00312     }
00313
00314     virtual long cvs_err(char *txt, long len)
00315     {
00316         return cvs_out(txt, len);
00317     }
00318 protected:
00319     Tcl_Interp *fInterp;
00320     int fLen;
00321     char *fAlloc;
00322 };
00323
00324 DECLC static int tclCvsProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00325 {
00326     CTcl_Interp *tcl_interp = (CTcl_Interp*) clientData;
00327     CvsArgs args;
00328
00329     for(int i = 1; i < argc; i++)
00330     {
00331         args.add(argv[i]);
00332     }
00333
00334     CTCLCvsConsole console(interp);
00335     int exitc = launchCVS(0L, args.Argc(), args.Argv(), &console);
00336
00337     //
00338     // Set CvsLastErrorCode value. TCL script can query
00339     // this value using cvslasterrorcode command
00340     //
00341     tcl_interp->SetCvsLastErrorCode(exitc);
00342
00343     //
00344     // If command succeeded then return always TCL_OK and
00345     // proceed with script. If command failed (exitc != 0)
00346     // then exit only if CvsExitOnError is TRUE.
00347     //
00348     if(exitc == 0)
00349         return TCL_OK;
00350     else
00351         return tcl_interp->GetCvsExitOnError() ? TCL_ERROR : TCL_OK;
00352 }
00353
00354 DECLC static int tclHelpProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00355 {
00356     Tcl_AppendResult(interp, "Help :\n", 0L);
00357     Tcl_AppendResult(interp, "   cvs  : the cvs tool.\n", 0L);
00358     Tcl_AppendResult(interp, "   help : this help.\n", 0L);
00359     Tcl_AppendResult(interp, "Others commands :\n", 0L);
00360     Tcl_AppendResult(interp, "   cd   : change directory\n", 0L);
00361     Tcl_AppendResult(interp, "   pwd  : print current directory\n", 0L);
00362     Tcl_AppendResult(interp, "   ls   : list the current directory\n", 0L);
00363     Tcl_AppendResult(interp, "   info ?  : misc. informations\n", 0L);
00364     Tcl_AppendResult(interp, "   info commands : all the TCL commands\n", 0L);
00365     return TCL_OK;
00366 }
00367
00368 DECLC static int tclCvsOutProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00369 {
00370     for(int i = 1; i < argc; i++)
00371     {
00372         cvs_outstr(argv[i], strlen(argv[i]));
00373     }
00374     return TCL_OK;
00375 }
00376
00377 DECLC static int tclCvsErrProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00378 {
00379     for(int i = 1; i < argc; i++)
00380     {
00381         cvs_errstr(argv[i], strlen(argv[i]));
00382     }
00383     return TCL_OK;
00384 }
00385
00386 DECLC static int tclCvsBrowserProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00387 {
00388     if(argc < 2)
00389     {
00390         Tcl_AppendResult(interp, argv[0], " : Missing arguments\n", 0L);
00391         return TCL_ERROR;
00392     }
00393
00394     std::vector<CTCLBrowserEnt> & browser = clientData != 0L ?
00395         *(std::vector<CTCLBrowserEnt> *)clientData : sTclBrowser;
00396     if(strcmp(argv[1], "get") == 0)
00397     {
00398         if(argc != 2)
00399         {
00400             char *str = Tcl_Concat(argc, argv);
00401             Tcl_AppendResult(interp, argv[0], " : Too many arguments : '", str, "'\n", 0L);
00402             Tcl_Free(str);
00403             return TCL_ERROR;
00404         }
00405
00406         Tcl_Obj *list = Tcl_NewListObj(0, 0L);
00407         std::vector<CTCLBrowserEnt>::const_iterator i;
00408         for(i = browser.begin(); i != browser.end(); ++i)
00409         {
00410             const CTCLBrowserEnt* entry = i;
00411             CStr path;
00412             entry->GetData()->GetFullPathName(path);
00413             CTcl_Interp::Unixfy(path);
00414
00415             Tcl_Obj * obj = Tcl_NewStringObj(path, path.length());
00416             Tcl_ListObjAppendElement(interp, list, obj);
00417             //TclFreeObj(obj);
00418         }
00419         Tcl_SetObjResult(interp, list);
00420         //TclFreeObj(list);
00421     }
00422     else if(strcmp(argv[1], "info") == 0)
00423     {
00424         if(argc != 4)
00425         {
00426             char *str = Tcl_Concat(argc, argv);
00427             Tcl_AppendResult(interp, argv[0], " : Too many arguments : '", str, "'\n", 0L);
00428             Tcl_Free(str);
00429             return TCL_ERROR;
00430         }
00431
00432         std::vector<CTCLBrowserEnt>::const_iterator i;
00433         for(i = browser.begin(); i != browser.end(); ++i)
00434         {
00435             const CTCLBrowserEnt* entry = i;
00436             if(entry->IsSamePath(argv[2]))
00437             {
00438                 EntnodeData* data = entry->GetData();
00439                 CStr path, fname, value;
00440                 entry->GetNormalized(path, fname);
00441                 char *res = Tcl_SetVar2(interp, argv[3], "name", fname, 0);
00442                 if(res == 0L)
00443                     goto err1;
00444
00445                 value = data->GetType() == ENT_FILE ? "file" : "folder";
00446                 res = Tcl_SetVar2(interp, argv[3], "kind", value, 0);
00447                 if(res == 0L)
00448                     goto err1;
00449
00450                 res = Tcl_SetVar2(interp, argv[3], "path", path, 0);
00451                 if(res == 0L)
00452                     goto err1;
00453
00454                 value = (*data)[EntnodeData::kStatus];
00455                 res = Tcl_SetVar2(interp, argv[3], "status", value, 0);
00456                 if(res == 0L)
00457                     goto err1;
00458
00459                 value = data->IsMissing() ? "1" : "0";
00460                 res = Tcl_SetVar2(interp, argv[3], "missing", value, 0);
00461                 if(res == 0L)
00462                     goto err1;
00463
00464                 value = data->IsUnknown() ? "1" : "0";
00465                 res = Tcl_SetVar2(interp, argv[3], "unknown", value, 0);
00466                 if(res == 0L)
00467                     goto err1;
00468
00469                 value = data->IsIgnored() ? "1" : "0";
00470                 res = Tcl_SetVar2(interp, argv[3], "ignored", value, 0);
00471                 if(res == 0L)
00472                     goto err1;
00473
00474                 value = data->IsLocked() ? "1" : "0";
00475                 res = Tcl_SetVar2(interp, argv[3], "locked", value, 0);
00476                 if(res == 0L)
00477                     goto err1;
00478
00479                 value = data->IsUnmodified() ? "0" : "1";
00480                 res = Tcl_SetVar2(interp, argv[3], "modified", value, 0);
00481                 if(res == 0L)
00482                     goto err1;
00483
00484                 value = data->GetDesc();
00485                 res = Tcl_SetVar2(interp, argv[3], "status", value, 0);
00486                 if(res == 0L)
00487                     goto err1;
00488
00489                 if(data->GetType() == ENT_FILE)
00490                 {
00491                     value = (*data)[EntnodeFile::kVN];
00492                     res = Tcl_SetVar2(interp, argv[3], "revision", value, 0);
00493                     if(res == 0L)
00494                         goto err1;
00495
00496                     value = (*data)[EntnodeFile::kTS];
00497                     res = Tcl_SetVar2(interp, argv[3], "timestamp", value, 0);
00498                     if(res == 0L)
00499                         goto err1;
00500
00501                     value = (*data)[EntnodeFile::kOption];
00502                     res = Tcl_SetVar2(interp, argv[3], "option", value, 0);
00503                     if(res == 0L)
00504                         goto err1;
00505
00506                     value = (*data)[EntnodeFile::kTag];
00507                     res = Tcl_SetVar2(interp, argv[3], "tag", value, 0);
00508                     if(res == 0L)
00509                         goto err1;
00510
00511                     value = (*data)[EntnodeFile::kConflict];
00512                     res = Tcl_SetVar2(interp, argv[3], "conflict", value, 0);
00513                     if(res == 0L)
00514                         goto err1;
00515                 }
00516
00517                 goto ok1;
00518 err1:
00519                 Tcl_AppendResult(interp, argv[0], " : Error while creating '", argv[3], "'\n", 0L);
00520                 return TCL_ERROR;
00521 ok1:
00522                 break;
00523             }
00524         }
00525     }
00526     else
00527     {
00528         char *str = Tcl_Concat(argc, argv);
00529         Tcl_AppendResult(interp, argv[0], " : Wrong arguments : '", str, "'\n", 0L);
00530         Tcl_Free(str);
00531         return TCL_ERROR;
00532     }
00533     return TCL_OK;
00534 }
00535
00536 class CFillTclEntries : public TraversalReport
00537 {
00538 public:
00539     CSortList<ENTNODE> & m_entries;
00540     std::vector<CStr> m_ignlist;
00541
00542     CFillTclEntries(CSortList<ENTNODE> & entries) :
00543         m_entries(entries) {}
00544
00545     virtual ~CFillTclEntries() {}
00546
00547     virtual kTraversal EnterDirectory(const char *fullpath, const char *dirname, const FSSpec * macspec)
00548     {
00549         Entries_Open (m_entries, fullpath);
00550         BuildIgnoredList(m_ignlist, fullpath);
00551         return kContinueTraversal;
00552     }
00553
00554     virtual kTraversal ExitDirectory(const char *fullpath)
00555     {
00556         m_ignlist.erase(m_ignlist.begin(), m_ignlist.end());
00557         return kContinueTraversal;
00558     }
00559
00560     virtual kTraversal OnError(const char *err, int errcode)
00561     {
00562         return kTraversalError;
00563     }
00564
00565     virtual kTraversal OnIdle(const char *fullpath)
00566     {
00567         return kContinueTraversal;
00568     }
00569
00570     virtual kTraversal OnDirectory(const char *fullpath,
00571         const char *fullname,
00572         const char *name,
00573         const struct stat & dir, const FSSpec * macspec)
00574     {
00575 #if defined(WIN32) || defined(macintosh)
00576         if(stricmp(name, "CVS") == 0)
00577 #else
00578         if(strcmp(name, "CVS") == 0)
00579 #endif
00580             return kSkipFile;
00581
00582         /*EntnodeData *data = */Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00583
00584         return kSkipFile;
00585     }
00586
00587     virtual kTraversal OnAlias(const char *fullpath,
00588         const char *fullname,
00589         const char *name,
00590         const struct stat & dir, const FSSpec * macspec)
00591     {
00592         return OnFile(fullpath, fullname, name, dir, macspec);
00593     }
00594
00595     virtual kTraversal OnFile(const char *fullpath,
00596         const char *fullname,
00597         const char *name,
00598         const struct stat & dir, const FSSpec * macspec)
00599     {
00600         /*EntnodeData *data = */Entries_SetVisited(fullpath, m_entries, name, dir, false, &m_ignlist);
00601
00602         return kContinueTraversal;
00603     }
00604 };
00605
00606
00607 DECLC static void tclCvsEntriesDeleteProc(ClientData clientData)
00608 {
00609     if(clientData != 0L)
00610         delete (std::vector<CTCLBrowserEnt> *)clientData;
00611 }
00612
00613 DECLC static int tclCvsEntriesProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00614 {
00615     if(argc != 3)
00616     {
00617         Tcl_AppendResult(interp, argv[0], " : Wrong # of arguments\n", 0L);
00618         return TCL_ERROR;
00619     }
00620
00621     CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00622
00623     // refetch all items
00624     CFillTclEntries traverse(entries);
00625     CStr path(argv[1]);
00626     CTcl_Interp::Deunixfy(path);
00627     /*kTraversal res = */FileTraverse(path, traverse);
00628
00629     // add the missing files
00630     Entries_SetMissing(entries);
00631
00632     // now make the TCL entries
00633     std::vector<CTCLBrowserEnt> *browser = NEW std::vector<CTCLBrowserEnt>;
00634
00635     int numEntries = entries.NumOfElements();
00636     for(int i = 0; i < numEntries; i++)
00637     {
00638         const ENTNODE & theNode = entries.Get(i);
00639         EntnodeData *data = theNode.Data();
00640         browser->push_back(CTCLBrowserEnt(data));
00641     }
00642
00643     Tcl_Command cmd = Tcl_CreateCommand (interp, argv[2], _TCL_CALLBACK(tclCvsBrowserProc),
00644         (ClientData)browser, tclCvsEntriesDeleteProc);
00645
00646     return cmd != 0L ? TCL_OK : TCL_ERROR;
00647 }
00648
00649 #ifdef WIN32
00650 class LSReport : public TraversalReport
00651 {
00652 public:
00653     Tcl_Interp *fInterp;
00654     int fState;
00655
00656     LSReport(Tcl_Interp *interp) : fInterp(interp), fState(TCL_OK) {}
00657
00658     virtual kTraversal EnterDirectory(const char *fullpath, const char *dirname, const FSSpec * macspec)
00659     {
00660         return kContinueTraversal;
00661     }
00662
00663     virtual kTraversal ExitDirectory(const char *fullpath)
00664     {
00665         return kContinueTraversal;
00666     }
00667
00668     virtual kTraversal OnError(const char *err, int errcode)
00669     {
00670         fState = TCL_ERROR;
00671         Tcl_AppendResult(fInterp, err, "\n", 0L);
00672         return kTraversalError;
00673     }
00674
00675     virtual kTraversal OnIdle(const char *fullpath)
00676     {
00677         return kContinueTraversal;
00678     }
00679
00680     virtual kTraversal OnAnyDevice(const char *fullpath,
00681         const char *fullname,
00682         const char *name,
00683         const struct stat & dir, const FSSpec * macspec)
00684     {
00685         Tcl_AppendResult(fInterp, name, "\n", 0L);
00686         return kSkipFile;
00687     }
00688 };
00689
00690 DECLC static int tclDirProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00691 {
00692     LSReport report(interp);
00693     char path[256];
00694     getcwd(path, 256);
00695     kTraversal res = FileTraverse(path, report);
00696     return report.fState;
00697 }
00698 #endif /* WIN32 */
00699
00700 DECLC static int tclSafeRemove (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00701 {
00702     if(argc < 2)
00703     {
00704         Tcl_AppendResult(interp, argv[0], " : Missing list of files\n", 0L);
00705         return TCL_ERROR;
00706     }
00707
00708     for(int i = 1; i < argc; i++)
00709     {
00710         CStr fn(argv[i]);
00711         CTcl_Interp::Deunixfy(fn);
00712         if(!CompatMoveToTrash(fn, 0))  // dir is not needed, TCL profides fully qualified file name
00713         {
00714             cvs_err("Unable to trash '%s'\n", (char *)fn);
00715         }
00716     }
00717
00718     return TCL_OK;
00719 }
00720
00721 DECLC static int tclCvsExitOnErrorProc(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00722 {
00723     CTcl_Interp *tcl_interp = (CTcl_Interp*) clientData;
00724
00725     //
00726     // CvsExitOnError command can be used to define whether TCL macro
00727     // is automatically terminated if CVS command returned error (non zero).
00728     //
00729     // CvsExitOnError has following modes:
00730     //   false  = Do not exit automaticaly. CvsLastErrorCode constains the last error code.
00731     //   true   = Exit TCL script in error (default).
00732     //
00733     if(argc < 2)
00734     {
00735         Tcl_AppendResult(interp, argv[0], " : Missing argument (true|false)\n", 0L);
00736         return TCL_ERROR;
00737     }
00738
00739     if(strcmp(argv[1], "true") == 0)
00740         tcl_interp->SetCvsExitOnError(true);
00741     else if(strcmp(argv[1], "false") == 0)
00742         tcl_interp->SetCvsExitOnError(false);
00743     else
00744     {
00745         char *str = Tcl_Concat(argc, argv);
00746         Tcl_AppendResult(interp, argv[0], " : Wrong argument : '", str, "'\n", 0L);
00747         Tcl_Free(str);
00748
00749         return TCL_ERROR;
00750     }
00751
00752     return TCL_OK;
00753 }
00754
00755 DECLC static int tclCvsLastErrorCodeProc(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00756 {
00757     CTcl_Interp *tcl_interp = (CTcl_Interp*) clientData;
00758
00759     if(argc < 2)
00760     {
00761         char value[35];
00762
00763         // CvsLastErrorCode called without arguments, so return current value
00764         sprintf(value, "%d", tcl_interp->GetCvsLastErrorCode());
00765         Tcl_AppendResult(interp, value, 0L);
00766     }
00767     else
00768     {
00769         // Set the value of LastErrorCode variable
00770         tcl_interp->SetCvsLastErrorCode(atoi(argv[1]));
00771     }
00772
00773     return TCL_OK;
00774 }
00775
00776 #if defined(WIN32)
00777 DECLC static int tclGetFileModTimeProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00778 {
00779     struct wnt_stat sb;
00780     struct tm * p_utc = NULL;
00781
00782     if (argc < 2)
00783     {
00784         Tcl_AppendResult(interp, argv[0], " : Missing argument (int)\n", 0L);
00785         return TCL_ERROR;
00786     }
00787
00788     if (argc > 2)
00789     {
00790         char * str = Tcl_Concat(argc, argv);
00791         Tcl_AppendResult(interp, argv[0], " : Too many arguments : '", str, "'\n", 0L);
00792         Tcl_Free(str);
00793         return TCL_ERROR;
00794     }
00795
00796     if (wnt_stat(argv[1], &sb) != 0)
00797     {
00798         Tcl_AppendResult(interp, argv[0], " : Could not find file : '", argv[1], "'\n", 0L);
00799         return TCL_ERROR;
00800     }
00801
00802     p_utc = gmtime(& sb.st_mtime);
00803     Tcl_AppendResult(interp, asctime(p_utc), 0L);
00804     return TCL_OK;
00805 }
00806
00807 DECLC static int tclSetDebugMaskProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00808 {
00809     if (argc < 2)
00810     {
00811         Tcl_AppendResult(interp, argv[0], " : Missing argument (int)\n", 0L);
00812         return TCL_ERROR;
00813     }
00814
00815     if (argc > 3)
00816     {
00817         char * str = Tcl_Concat(argc, argv);
00818         Tcl_AppendResult(interp, argv[0], " : Too many arguments : '", str, "'\n", 0L);
00819         Tcl_Free(str);
00820         return TCL_ERROR;
00821     }
00822
00823     char * endc = NULL;
00824     unsigned long n;
00825     bool b;
00826
00827     n = strtoul(argv[1], & endc, 0);
00828     if (*endc)
00829     {
00830         Tcl_AppendResult(interp, argv[0], " : Could not understand argument '", argv[1], "'\n", 0L);
00831         return TCL_ERROR;
00832     }
00833
00834     if (argc == 2)
00835     {
00836         SetWinCvsDebugMask(n);
00837         return TCL_OK;
00838     }
00839
00840
00841     if (!stricmp(argv[2], "true"))
00842     {
00843         b = true;
00844     }
00845     else if (!stricmp(argv[2], "false"))
00846     {
00847         b = false;
00848     }
00849     else
00850     {
00851         b = strtoul(argv[2], & endc, 0) != 0;
00852         if (*endc)
00853         {
00854             Tcl_AppendResult(interp, argv[0], " : Could not understand argument '", argv[2], "'\n", 0L);
00855             return TCL_ERROR;
00856         }
00857     }
00858
00859     SetWinCvsDebugMaskBit(n,b);
00860     return TCL_OK;
00861 }
00862
00863 DECLC static int tclGetDebugMaskProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
00864 {
00865     char retstr[32];
00866     if (argc < 2)
00867     {
00868         _snprintf(retstr,32,"%u",GetWinCvsDebugMask());
00869         Tcl_AppendResult(interp, retstr, 0L);
00870         return TCL_OK;
00871     }
00872
00873     if (argc > 3)
00874     {
00875         char * str = Tcl_Concat(argc, argv);
00876         Tcl_AppendResult(interp, argv[0], " : Too many arguments : '", str, "'\n", 0L);
00877         Tcl_Free(str);
00878         return TCL_ERROR;
00879     }
00880
00881     char * endc = NULL;
00882     unsigned long n;
00883
00884     n = strtoul(argv[1], & endc, 0);
00885     if (*endc)
00886     {
00887         Tcl_AppendResult(interp, argv[0], " : Could not understand argument '", argv[1], "'\n", 0L);
00888         return TCL_ERROR;
00889     }
00890
00891     _snprintf(retstr, 32, "%u", GetWinCvsDebugMaskBit(n));
00892     Tcl_AppendResult(interp, retstr, 0L);
00893
00894     return TCL_OK;
00895 }
00896 #endif  // WIN32
00897
00898 #endif // USE_TCL
00899
00900 void TclBrowserReset(void)
00901 {
00902 #if USE_TCL
00903     sTclBrowser.erase(sTclBrowser.begin(), sTclBrowser.end());
00904 #endif
00905 }
00906
00907 // note that although 'path' is not used here any longer, it makes sense to retain
00908 // that attribute since it gives you an option to figure out relative filename,
00909 // relative to 'path' that designates the folder in which the operation takes place
00910 void TclBrowserAppend(const char * /*path*/, EntnodeData *data)
00911 {
00912 #if USE_TCL
00913     sTclBrowser.push_back(CTCLBrowserEnt(data));
00914 #endif
00915 }
00916
00917 static Tcl_Interp *myTcl_CreateInterp(void)
00918 {
00919 #   ifdef WIN32
00920     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00921     CStr path;
00922     app->GetAppModule(path);
00923     Tcl_FindExecutable(path);
00924 #   endif
00925
00926 #   ifdef qMacCvsPP
00927     CStr appPath = CMacCvsApp::GetAppPath();
00928     Tcl_FindExecutable(appPath);
00929 #   endif
00930
00931     Tcl_Interp *res = Tcl_CreateInterp();
00932     return res;
00933 }
00934
00935 CTcl_Interp::CTcl_Interp()
00936 {
00937     fInterp = 0L;
00938
00939     fExitOnError = true;
00940     fLastErrorCode = 0;
00941
00942 #if USE_TCL
00943     if(!CTcl_Interp::IsAvail())
00944     {
00945         cvs_err("TCL is not available !\n");
00946         return;
00947     }
00948
00949     fInterp = myTcl_CreateInterp();
00950     if(fInterp == 0L)
00951     {
00952         cvs_err("Unable to create a new TCL interpreter !\n");
00953         return;
00954     }
00955
00956     Tcl_Command cmd;
00957
00958     // this parameter is used to get access to CTcl_Interp::SetCvsLastErrorCode
00959     // in tclCvsProc method
00960     cmd = Tcl_CreateCommand (fInterp, "cvs", _TCL_CALLBACK(tclCvsProc),
00961         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00962
00963     cmd = Tcl_CreateCommand (fInterp, "help", _TCL_CALLBACK(tclHelpProc),
00964         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00965     cmd = Tcl_CreateCommand (fInterp, "cvsout", _TCL_CALLBACK(tclCvsOutProc),
00966         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00967     cmd = Tcl_CreateCommand (fInterp, "cvserr", _TCL_CALLBACK(tclCvsErrProc),
00968         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00969     cmd = Tcl_CreateCommand (fInterp, "cvsbrowser", _TCL_CALLBACK(tclCvsBrowserProc),
00970         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00971     cmd = Tcl_CreateCommand (fInterp, "cvsentries", _TCL_CALLBACK(tclCvsEntriesProc),
00972         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00973 #ifdef WIN32
00974     cmd = Tcl_CreateCommand (fInterp, "ls", _TCL_CALLBACK(tclDirProc),
00975         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00976     cmd = Tcl_CreateCommand (fInterp, "dir", _TCL_CALLBACK(tclDirProc),
00977         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00978 #endif /* WIN32 */
00979     cmd = Tcl_CreateCommand (fInterp, "trash", _TCL_CALLBACK(tclSafeRemove),
00980         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00981
00982     cmd = Tcl_CreateCommand (fInterp, "cvsexitonerror", _TCL_CALLBACK(tclCvsExitOnErrorProc),
00983         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00984
00985     cmd = Tcl_CreateCommand (fInterp, "cvslasterrorcode", _TCL_CALLBACK(tclCvsLastErrorCodeProc),
00986         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00987 #if defined(WIN32)
00988     cmd = Tcl_CreateCommand (fInterp, "cvssetdebugmask", _TCL_CALLBACK(tclSetDebugMaskProc),
00989         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00990     cmd = Tcl_CreateCommand (fInterp, "cvsgetdebugmask", _TCL_CALLBACK(tclGetDebugMaskProc),
00991         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00992     cmd = Tcl_CreateCommand (fInterp, "cvsfilemodtime", _TCL_CALLBACK(tclGetFileModTimeProc),
00993         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00994 #endif  // defined(WIN32)
00995
00996     CStr rcfile;
00997     MacrosGetLoc(rcfile);
00998     if(!rcfile.endsWith(kPathDelimiter))
00999         rcfile << kPathDelimiter;
01000     rcfile << "startup.tcl";
01001     Tcl_SetVar(fInterp, "tcl_rcFileName", rcfile, TCL_GLOBAL_ONLY);
01002     Tcl_SetVar(fInterp, "tcl_interactive", "1", TCL_GLOBAL_ONLY);
01003     Tcl_Init(fInterp);
01004     Tcl_SourceRCFile(fInterp);
01005 #endif
01006 }
01007
01008 CTcl_Interp::~CTcl_Interp()
01009 {
01010 #if USE_TCL
01011     if(fInterp != 0L)
01012         Tcl_DeleteInterp(fInterp);
01013 #endif
01014 }
01015
01016 bool CTcl_Interp::IsAvail(void)
01017 {
01018 #if USE_TCL
01019 #if defined(macintosh) && !qCarbon
01020     return Tcl_CreateInterp != 0L;
01021 #else /* !macintosh */
01022     static bool firstTime = true;
01023     static bool tclAvail = false;
01024     if(firstTime)
01025     {
01026 #   if defined(WIN32) || qCarbon
01027         CompatConnectID connID;
01028 #   endif
01029
01030 #   ifdef WIN32
01031         extern char *findTcl (char *_minVer, int _exact, int _dbgOnly);
01032         char *tclver = 0L;
01033         try
01034         {
01035             tclver = findTcl("8.1", 0, 0);
01036         }
01037         catch(...)
01038         {
01039         }
01040
01041         if(tclver != 0L)
01042             tclAvail = CompatLoadLibrary(&connID, tclver) != 0;
01043
01044         if(!tclAvail)
01045             tclAvail = CompatLoadLibrary(&connID, "tcl87.dll") != 0 ||
01046             CompatLoadLibrary(&connID, "tcl86.dll") != 0 ||
01047             CompatLoadLibrary(&connID, "tcl85.dll") != 0 ||
01048             CompatLoadLibrary(&connID, "tcl84.dll") != 0 ||
01049             CompatLoadLibrary(&connID, "tcl83.dll") != 0 ||
01050             CompatLoadLibrary(&connID, "tcl82.dll") != 0 ||
01051             CompatLoadLibrary(&connID, "tcl81.dll") != 0;
01052 #   endif
01053
01054 #   if qCarbon
01055         if (UEnvironment::GetOSVersion() >= 0x1000)
01056             tclAvail = CompatLoadLibrary(&connID, "/System/Library/Frameworks/Tcl.framework");
01057         else
01058             tclAvail = CompatLoadLibrary(&connID, "tcl8.3");
01059 #   endif
01060
01061 #   if defined(WIN32) || qCarbon
01062 #   define LOAD_CODEFRAG(name) \
01063         if(tclAvail) \
01064             tclAvail = (*(void **)&name##_glue = \
01065                 _CompatCallLibrary(connID, #name)) != 0L
01066 #   endif
01067 #   if defined(WIN32) || TARGET_API_MAC_CARBON
01068         LOAD_CODEFRAG(Tcl_CreateCommand);
01069         LOAD_CODEFRAG(Tcl_CreateInterp);
01070         LOAD_CODEFRAG(Tcl_AppendResult);
01071         LOAD_CODEFRAG(Tcl_SetResult);
01072         LOAD_CODEFRAG(Tcl_DeleteInterp);
01073         LOAD_CODEFRAG(Tcl_Eval);
01074         LOAD_CODEFRAG(Tcl_EvalFile);
01075         LOAD_CODEFRAG(Tcl_Alloc);
01076         LOAD_CODEFRAG(Tcl_Free);
01077         LOAD_CODEFRAG(Tcl_Realloc);
01078         LOAD_CODEFRAG(Tcl_ExprLong);
01079         LOAD_CODEFRAG(Tcl_Concat);
01080         LOAD_CODEFRAG(Tcl_SetVar2);
01081         LOAD_CODEFRAG(Tcl_DStringStartSublist);
01082         LOAD_CODEFRAG(Tcl_DStringEndSublist);
01083         LOAD_CODEFRAG(Tcl_DStringFree);
01084         LOAD_CODEFRAG(Tcl_DStringInit);
01085         LOAD_CODEFRAG(Tcl_DStringResult);
01086         LOAD_CODEFRAG(Tcl_DStringAppendElement);
01087         LOAD_CODEFRAG(TclFreeObj);
01088         LOAD_CODEFRAG(Tcl_SetObjResult);
01089         LOAD_CODEFRAG(Tcl_NewStringObj);
01090         LOAD_CODEFRAG(Tcl_NewListObj);
01091         LOAD_CODEFRAG(Tcl_ListObjAppendElement);
01092         LOAD_CODEFRAG(Tcl_SourceRCFile);
01093         LOAD_CODEFRAG(Tcl_Init);
01094         LOAD_CODEFRAG(Tcl_SetVar);
01095         LOAD_CODEFRAG(Tcl_FindExecutable);
01096
01097         if(!tclAvail)
01098             return false;
01099 #   endif /* WIN32 */
01100
01101         Tcl_Interp *interp = myTcl_CreateInterp();
01102         tclAvail = interp != 0L;
01103         if (!tclAvail)
01104             return false;
01105
01106         Tcl_Init(interp);
01107
01108         /* Destroy the interp we needed just for this */
01109         Tcl_DeleteInterp(interp);
01110
01111         firstTime = false;
01112     }
01113
01114     return tclAvail;
01115 #endif /* !macintosh */
01116 #else
01117     return false;
01118 #endif
01119 }
01120
01121 kTclRes CTcl_Interp::DoScript(const char *script)
01122 {
01123 #if USE_TCL
01124     bool bTclFileStarted;
01125
01126     if(fInterp == 0L)
01127         return false;
01128
01129     // If script cmd begins with "source " then this
01130     // must be TCL file execution.
01131     bTclFileStarted = (strncmp(script, "source ", 7) == 0);
01132     if(bTclFileStarted)
01133         gCvsPrefs.SetTclFileRunning(true);
01134
01135     int exitc = Tcl_Eval(fInterp, (char *)script);
01136
01137     if(bTclFileStarted)
01138         gCvsPrefs.SetTclFileRunning(false);
01139
01140     size_t len = strlen(fInterp->result);
01141     if(exitc == TCL_ERROR)
01142     {
01143         cvs_errstr(fInterp->result, len);
01144         if(len != 0 && fInterp->result[len - 1] != '\n')
01145             cvs_errstr("\n", 1);
01146     }
01147     else
01148     {
01149         cvs_outstr(fInterp->result, len);
01150         if(len != 0 && fInterp->result[len - 1] != '\n')
01151             cvs_outstr("\n", 1);
01152     }
01153
01154     return exitc;
01155 #else
01156     return false;
01157 #endif
01158 }
01159
01160 kTclRes CTcl_Interp::DoScriptVar(const char *format, ...)
01161 {
01162 #if USE_TCL
01163     if(fInterp == 0L)
01164         return false;
01165
01166     va_list args;
01167     char script[1024] = {'\0'};
01168
01169     va_start (args, format);
01170     vsprintf (script, format, args);
01171     va_end (args);
01172
01173     return DoScript(script);
01174 #else
01175     return false;
01176 #endif
01177 }
01178
01179 kTclRes CTcl_Interp::DoFile(const char *file)
01180 {
01181 #if USE_TCL
01182     if(fInterp == 0L)
01183         return false;
01184
01185     int exitc = Tcl_EvalFile(fInterp, (char *)file);
01186     size_t len = strlen(fInterp->result);
01187     if(exitc == TCL_ERROR)
01188     {
01189         cvs_errstr(fInterp->result, len);
01190         if(len != 0 && fInterp->result[len - 1] != '\n')
01191             cvs_errstr("\n", 1);
01192     }
01193     else
01194     {
01195         cvs_outstr(fInterp->result, len);
01196         if(len != 0 && fInterp->result[len - 1] != '\n')
01197             cvs_outstr("\n", 1);
01198     }
01199
01200     return exitc;
01201 #else
01202     return false;
01203 #endif
01204 }
01205
01206 void CTcl_Interp::Unixfy(CStr & path)
01207 {
01208     char *ptr = path;
01209     while((ptr = strchr(ptr, kPathDelimiter)) != 0L)
01210     {
01211         *ptr++ = kTCLPathDelimiter;
01212     }
01213     ptr = (char *)path + path.length() - 1;
01214     if(*ptr == kTCLPathDelimiter)
01215     {
01216         *ptr = '\0';
01217     }
01218 }
01219
01220 void CTcl_Interp::Deunixfy(CStr & path)
01221 {
01222     char *ptr = path;
01223     while((ptr = strchr(ptr, kTCLPathDelimiter)) != 0L)
01224     {
01225         *ptr++ = kPathDelimiter;
01226     }
01227 }
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/TclGlue.h Source File

common/TclGlue.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * TclGlue.h --- glue to the TCL language
00023  */
00024
00025 #ifndef TCLGLUE_H
00026 #define TCLGLUE_H
00027
00028 class UStr;
00029 class EntnodeData;
00030
00031 #ifndef _TCL
00032 #   define TCL_OK       0
00033 #   define TCL_ERROR    1
00034 #   define TCL_RETURN   2
00035 #   define TCL_BREAK    3
00036 #   define TCL_CONTINUE 4
00037 #endif
00038
00039 typedef int kTclRes;
00040
00041 #ifndef macintosh
00042 #   define kTCLPathDelimiter '/'
00043 #else
00044 #   define kTCLPathDelimiter ':'
00045 #endif
00046
00047 struct Tcl_Interp;
00048
00049 class CTcl_Interp
00050 {
00051 public:
00052     CTcl_Interp();
00053     ~CTcl_Interp();
00054
00055     static bool IsAvail(void);
00056         // tells if TCL is available
00057
00058     kTclRes DoScriptVar(const char *format, ...);
00059     kTclRes DoScript(const char *script);
00060     kTclRes DoFile(const char *file);
00061         // execute a TCL script, returns false on error
00062
00063     inline operator Tcl_Interp *(void) {return fInterp;}
00064
00065     inline int  GetCvsLastErrorCode()  { return fLastErrorCode; }
00066     inline void SetCvsLastErrorCode(int value)  { fLastErrorCode = value; }
00067
00068     inline bool GetCvsExitOnError()  { return fExitOnError; }
00069     inline void SetCvsExitOnError(bool value) { fExitOnError = value; }
00070
00071     static void Unixfy(UStr & path);
00072     static void Deunixfy(UStr & path);
00073         // changes the \ into a /
00074 protected:
00075     Tcl_Interp *fInterp;
00076
00077     int  fLastErrorCode;    // ErrorCode value from the last CVS command (cvslaunch)
00078     bool fExitOnError;      // TRUE = Exit TCL macro automatically in error, FALSE = Do not exit
00079 };
00080
00081 // browser filler
00082 void TclBrowserReset(void);
00083 void TclBrowserAppend(const char *path, EntnodeData *data);
00084     // TO_OBSOLETE
00085
00086 #endif /* TCLGLUE_H */
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/TclGlue.mac.cpp Source File

common/TclGlue.mac.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2001
00019  */
00020
00021 /*
00022  * TclGlue.mac.cpp --- glue to the TCL language specific to mac/carbon
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #if qCarbon
00028
00029 #ifndef NEW
00030 #define NEW new
00031 #endif
00032
00033 #include "TclGlue.mac.h"
00034 #include <CFBundle.h>
00035 #include <stdlib.h>
00036 #include <string.h>
00037
00038 // our app on OSX is CFM, while TCL is mach-o. We need to re-encode the function pointer
00039 // we give to the mach-o code
00040 typedef struct _CompatConnectID
00041 {
00042     CFURLRef        bundleURL;
00043     CFBundleRef     myBundle;
00044 };
00045
00046 static ProcPtr getSymFunction(CompatConnectID connID, const Str255 name)
00047 {
00048     long symCount;
00049     Ptr symAddr;
00050     int i;
00051     OSErr err = CountSymbols(connID, &symCount);
00052     if(err != noErr)
00053         return 0L;
00054
00055     for(i = 0; i < symCount; i++)
00056     {
00057         CFragSymbolClass symClass;
00058         Str255 symName;
00059         err = GetIndSymbol(connID, i, symName, &symAddr, &symClass);
00060         if(err != noErr)
00061             return 0L;
00062         if(memcmp(symName, name, name[0]) == 0)
00063             break;
00064     }
00065     if(i == symCount)
00066         return 0L;
00067     return (ProcPtr)symAddr;
00068 }
00069
00070 int CarbonCompatLoadLibrary(CompatConnectID * connID, const char *name_dll)
00071 {
00072     if(connID == 0L)
00073         return 0;
00074
00075     if (UEnvironment::GetOSVersion() < 0x1000)
00076     {
00077         OSErr err;
00078         Ptr mainAddr;
00079         Str255 errMessage;
00080         Str255 pname;
00081
00082         c2pstrcpy(pname, name_dll);
00083         err = GetSharedLibrary(pname, kPowerPCCFragArch, kPrivateCFragCopy, connID, &mainAddr, errMessage);
00084         return err == noErr;
00085     }
00086     else
00087     {
00088         *connID = 0L;
00089
00090          *connID = (CompatConnectID)malloc(sizeof(_CompatConnectID));
00091
00092         struct _CompatConnectID *c = (struct _CompatConnectID *)*connID;
00093
00094         if(c == 0L)
00095             return 0;
00096
00097         c->bundleURL = 0L;
00098         c->myBundle = 0L;
00099
00100         CFStringRef s = CFStringCreateWithCString(0L, name_dll, kCFStringEncodingMacRoman);
00101         if(s == 0L)
00102             goto fail;
00103
00104         c->bundleURL    = CFURLCreateWithFileSystemPath(0L, s, kCFURLPOSIXPathStyle, false );
00105         if(c->bundleURL == 0L)
00106             goto fail;
00107
00108         c->myBundle = CFBundleCreate(0L, c->bundleURL );
00109         if(c->myBundle == 0L)
00110             goto fail;
00111
00112         if(!CFBundleLoadExecutable( c->myBundle ))
00113             goto fail;
00114
00115         CFRelease( s );
00116         return 1;
00117     fail:
00118         if(s != 0L)
00119             CFRelease( s );
00120         if(c != 0L)
00121         {
00122             if(c->bundleURL != 0L)
00123                 CFRelease( c->bundleURL );
00124             if(c->myBundle != 0L)
00125                 CFRelease( c->myBundle );
00126             *connID = 0L;
00127             free(c);
00128         }
00129         return 0;
00130     }
00131 }
00132
00133 int CarbonCompatCloseLibrary(CompatConnectID * connID)
00134 {
00135     if(connID == 0L)
00136         return 0;
00137
00138     if (UEnvironment::GetOSVersion() < 0x1000)
00139     {
00140         CloseConnection(connID);
00141     }
00142     else
00143     {
00144         struct _CompatConnectID *c = (struct _CompatConnectID *)*connID;
00145         if(c != 0L)
00146         {
00147             CFBundleUnloadExecutable( c->myBundle );
00148             CFRelease( c->bundleURL );
00149             CFRelease( c->myBundle );
00150             free(c);
00151         }
00152         *connID = 0L;
00153     }
00154     return 1;
00155 }
00156
00157 void *_CarbonCompatCallLibrary(CompatConnectID connID, const char *name_func)
00158 {
00159     if (UEnvironment::GetOSVersion() < 0x1000)
00160     {
00161         ProcPtr symAddr;
00162         UniversalProcPtr proc;
00163         Str255 pname;
00164
00165         c2pstrcpy(pname, name_func);
00166
00167         symAddr = getSymFunction(connID, pname);
00168         return symAddr;
00169     }
00170     else
00171     {
00172         CFStringRef s = CFStringCreateWithCString(0L, name_func, kCFStringEncodingMacRoman);
00173         if(s == 0L)
00174             return 0L;
00175
00176         struct _CompatConnectID *c = (struct _CompatConnectID *)connID;
00177         void *ptr = CFBundleGetFunctionPointerForName(c->myBundle, s);
00178         CFRelease( s );
00179
00180         return ptr;
00181     }
00182
00183     return 0L;
00184 }
00185
00186 #define CompatLoadLibrary CarbonCompatLoadLibrary
00187 #define CompatCloseLibrary CarbonCompatCloseLibrary
00188 #define _CompatCallLibrary _CarbonCompatCallLibrary
00189
00190 void *_tcl_cfm_macho(void *func)
00191 {
00192     static UInt32 templ[6] = {0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420};
00193
00194     // nothing to do on OS9, cause we call a CFM code in this case
00195     if (UEnvironment::GetOSVersion() < 0x1000)
00196         return func;
00197
00198 #pragma message(" Memory leak here, fix me !")
00199     UInt32  *mfp = (UInt32*) NewPtr( sizeof(templ) );       //  Must later dispose of allocated memory
00200     if(mfp == 0L)
00201         return 0L;
00202
00203     mfp[0] = templ[0] | ((UInt32)func >> 16);
00204     mfp[1] = templ[1] | ((UInt32)func & 0xFFFF);
00205     mfp[2] = templ[2];
00206     mfp[3] = templ[3];
00207     mfp[4] = templ[4];
00208     mfp[5] = templ[5];
00209     MakeDataExecutable( mfp, sizeof(templ) );
00210
00211     return mfp;
00212 }
00213
00214 #endif // qCarbon
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/TclGlue.mac.h Source File

common/TclGlue.mac.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2001
00019  */
00020
00021 /*
00022  * TclGlue.mac.h --- glue to the TCL language specific to mac/carbon
00023  */
00024
00025 #ifndef TCLGLUEMAC_H
00026 #define TCLGLUEMAC_H
00027
00028 #include "dll_loader.h"
00029
00030 int CarbonCompatLoadLibrary(CompatConnectID * connID, const char *name_dll);
00031 int CarbonCompatCloseLibrary(CompatConnectID * connID);
00032 void *_CarbonCompatCallLibrary(CompatConnectID connID, const char *name_func);
00033 void *_tcl_cfm_macho(void *func);
00034
00035 #endif // TCLGLUEMAC_H
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/TextBinary.cpp Source File

common/TextBinary.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * TextBinary.cpp --- utilities to ckeck if files are binary or text
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include <sys/stat.h>
00029 #   include <direct.h>
00030 #   include <io.h>
00031 #endif /* WIN32 */
00032
00033 #ifdef macintosh
00034 #   include <Resources.h>
00035 #   include <unistd.h>
00036 #   include <sys/types.h>
00037 #   include <sys/stat.h>
00038 #   include "MacMisc.h"
00039 #endif /* macintosh */
00040
00041 #ifdef HAVE_UNISTD_H
00042 #   include <unistd.h>
00043 #endif
00044
00045 #include <stdio.h>
00046 #include <errno.h>
00047 #include <stdlib.h>
00048 #include <string.h>
00049
00050 #include "TextBinary.h"
00051 #include "FileTraversal.h"
00052 #include "AppConsole.h"
00053 #include "CPStr.h"
00054
00055 #if !defined(S_ISLNK) && defined(S_IFLNK)
00056 #   if defined(S_IFMT)
00057 #       define  S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
00058 #   else
00059 #       define S_ISLNK(m) ((m) & S_IFLNK)
00060 #   endif
00061 #endif
00062
00063 #define MAX_TEST_SIZE 100000
00064
00065 #ifdef WIN32
00066 #   ifdef _DEBUG
00067 #   define new DEBUG_NEW
00068 #   undef THIS_FILE
00069     static char THIS_FILE[] = __FILE__;
00070 #   endif
00071 #endif /* WIN32 */
00072
00073 static CStaticAllocT<char> sBuf;
00074 static int sBufSize;
00075
00076 static kTextBinTYPE FillBuffer(const char *arg, const char *dir, const FSSpec * spec, bool bin)
00077 {
00078     sBuf.AdjustSize(MAX_TEST_SIZE);
00079
00080     if(chdir(dir) != 0)
00081     {
00082         cvs_err("Unable to chdir to ""%s"" (error %d)\n", dir, errno);
00083         return kFileMissing;
00084     }
00085
00086     FILE *samp = fopen(arg, bin ? "rb" : "r");
00087     if(samp == 0L)
00088     {
00089         return kFileMissing;
00090     }
00091
00092     sBufSize = fread(sBuf, sizeof(char), MAX_TEST_SIZE, samp);
00093     if(sBufSize < 0)
00094     {
00095         cvs_err("Unable to read ""%s"" (error %d)\n", arg, errno);
00096         return kFileMissing;
00097     }
00098
00099     fclose(samp);
00100     return kFileIsOK;
00101 }
00102
00103 static kTextBinTYPE TestBuffer(const char *arg, const char *dir, const FSSpec * spec, bool expectbin)
00104 {
00105     if(sBufSize == 0)
00106         return kFileIsOK;
00107
00108     // Windows : fread skips the \r, so we don't care.
00109     // Mac : MSL exchanges when reading the \r and \n,
00110     // so we look for \n
00111     // Others : default to \n
00112
00113     const unsigned char nativeNL = '\n';
00114     const unsigned char nonnativeNL = '\r';
00115
00116     // figure it it is binary (the test is more than 10% binary
00117     // is binary)
00118     int numBinChars = 0;
00119     int numTextChars = 0;
00120     int i;
00121     unsigned char c;
00122     char *tmp;
00123
00124     for(tmp = sBuf, i = 0; i < sBufSize; i++)
00125     {
00126         c = (unsigned char)*tmp++;
00127         if((c < 0x20 && c != nativeNL && c != nonnativeNL && c != '\t') || (c >= 0x80
00128 #ifdef macintosh
00129         && c != (unsigned char)'Ñ' && c != (unsigned char)'¥' /* powerplant */
00130 #endif /* macintosh */
00131         ))
00132             numBinChars++;
00133         else
00134             numTextChars++;
00135     }
00136
00137     float percent = (float)numBinChars / (float)sBufSize;
00138     bool isbin = percent >= 0.05;
00139     if(isbin && !expectbin)
00140         return kTextIsBinary;
00141     if(!isbin && expectbin)
00142         return kBinIsText;
00143
00144
00145     // for the text files, check if the new lines are good
00146     if(!expectbin)
00147     {
00148         int numNonNative = 0, numNative = 0;
00149         for(tmp = sBuf, i = 0; i < sBufSize; i++)
00150         {
00151             c = (unsigned char)*tmp++;
00152             if(c == nonnativeNL)
00153                 numNonNative++;
00154             else if(c == nativeNL)
00155                 numNative++;
00156         }
00157         if(numNative == 0)
00158         {
00159             if(numNonNative > 0)
00160                 return kTextWrongLF;
00161         }
00162         else
00163         {
00164             percent = (float)numNonNative / (float)numNative;
00165             if(percent >= 0.1)
00166                 return kTextWrongLF;
00167         }
00168
00169         if(numBinChars > 0)
00170             return kTextEscapeChar;
00171     }
00172
00173     return kFileIsOK;
00174 }
00175
00176 #ifdef macintosh
00177 static kTextBinTYPE GetMacSig(const char *arg, const char *dir, const FSSpec * spec, bool expectbin)
00178 {
00179     CInfoPBRec info;
00180
00181     info.dirInfo.ioVRefNum      = spec->vRefNum;
00182     info.dirInfo.ioDrDirID      = spec->parID;
00183     info.dirInfo.ioNamePtr      = (StringPtr)spec->name;
00184     info.dirInfo.ioFDirIndex    = 0;
00185     info.dirInfo.ioACUser       = 0;
00186
00187     OSErr err = PBGetCatInfoSync(&info);
00188     if(err != noErr || (info.dirInfo.ioFlAttrib & 0x10)/*folder*/)
00189     {
00190         cvs_err("Unable to get info on ""%s"" (error %d)\n", arg, err);
00191         return kFileMissing;
00192     }
00193
00194     if(info.hFileInfo.ioFlFndrInfo.fdFlags & (1 << 15))
00195     {
00196         return kFileIsAlias;
00197     }
00198
00199     if(expectbin)
00200     {
00201         if(info.hFileInfo.ioFlFndrInfo.fdType == 'TEXT')
00202             return kBinWrongSig;
00203     }
00204     else
00205     {
00206         if(info.hFileInfo.ioFlRLgLen > 0 && info.hFileInfo.ioFlLgLen == 0)
00207             return kTextIsBinary;
00208
00209
00210         if(info.hFileInfo.ioFlFndrInfo.fdType != 'TEXT')
00211             return kTextWrongSig;
00212     }
00213
00214     return kFileIsOK;
00215 }
00216 #endif /* macintosh */
00217
00218
00219 static kTextBinTYPE TestValidName(const char *filename)
00220 {
00221     kTextBinTYPE result = kFileIsOK;
00222
00223     if(strchr(filename, '/') != 0L)
00224         result = kFileInvalidName;
00225     if(strchr(filename, '\n') != 0L)
00226         result = kFileInvalidName;
00227
00228 #ifdef macintosh
00229     if(strchr(filename, '\r') != 0L)
00230         result = kFileInvalidName;
00231     if(strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0)
00232         result = kFileInvalidName;
00233     if(strcmp(filename, "CVS") != 0 && stricmp(filename, "cvs") == 0)
00234         result = kFileInvalidName;
00235 #endif /* !macintosh */
00236
00237     return result;
00238 }
00239
00240 static kTextBinTYPE TestFileIsAlias(const char *arg, const char *dir, const FSSpec * spec)
00241 {
00242     kTextBinTYPE result = kFileIsOK;
00243
00244 #ifdef S_ISLNK
00245     CPStr fullname;
00246     struct stat sb;
00247
00248     fullname = dir;
00249     if(!fullname.endsWith(kPathDelimiter))
00250         fullname << kPathDelimiter;
00251     fullname << arg;
00252
00253     if (stat(fullname, &sb) == -1)
00254         result = kFileMissing;
00255     else if(S_ISLNK(sb.st_mode))
00256         result = kFileIsAlias;
00257 #endif /* S_ISLNK */
00258
00259     return result;
00260 }
00261
00262 kTextBinTYPE FileIsText(const char *arg, const char *dir, const FSSpec * spec)
00263 {
00264     kTextBinTYPE state;
00265
00266 #ifdef macintosh
00267     state = GetMacSig(arg, dir, spec, false);
00268     if(state != kFileIsOK)
00269         return state;
00270 #endif /* macintosh */
00271
00272     state = FillBuffer(arg, dir, spec, false);
00273     if(state != kFileIsOK)
00274         return state;
00275
00276     if(sBufSize == 0)
00277         return kFileIsOK;
00278
00279     state = TestBuffer(arg, dir, spec, false);
00280     if(state != kFileIsOK)
00281         return state;
00282
00283     state = TestValidName(arg);
00284     if(state != kFileIsOK)
00285         return state;
00286
00287     state = TestFileIsAlias(arg, dir, spec);
00288     if(state != kFileIsOK)
00289         return state;
00290
00291     return kFileIsOK;
00292 }
00293
00294 kTextBinTYPE FileIsBinary(const char *arg, const char *dir, const FSSpec * spec)
00295 {
00296     kTextBinTYPE state;
00297
00298     state = FillBuffer(arg, dir, spec, true);
00299     if(state != kFileIsOK)
00300         return state;
00301
00302     state = TestBuffer(arg, dir, spec, true);
00303
00304 #ifdef macintosh
00305     kTextBinTYPE sigstate = GetMacSig(arg, dir, spec, true);
00306     if(sigstate != kFileIsOK)
00307         return state;
00308     if(state != kFileIsOK && state != kBinIsText)
00309         return state;
00310 #else /* !macintosh */
00311     if(state != kFileIsOK)
00312         return state;
00313 #endif /* !macintosh */
00314
00315     state = TestValidName(arg);
00316     if(state != kFileIsOK)
00317         return state;
00318
00319     state = TestFileIsAlias(arg, dir, spec);
00320     if(state != kFileIsOK)
00321         return state;
00322
00323     return kFileIsOK;
00324 }
00325
00326 bool SplitPath(const char *dir, CStr & uppath, CStr & folder)
00327 {
00328     char newdir[512];
00329     char olddir[512];
00330     char newfile[256];
00331     int lendir = strlen(dir);
00332     strcpy(olddir, dir);
00333     if(dir[lendir - 1] == kPathDelimiter)
00334     {
00335         olddir[lendir - 1] = '\0';
00336         --lendir;
00337     }
00338     const char *tmp = olddir, *prev = olddir;
00339
00340     while((tmp = strchr(tmp, kPathDelimiter)) != 0L)
00341         prev = ++tmp;
00342
00343     strcpy(newdir, olddir);
00344     newdir[prev - olddir] = '\0';
00345     strcpy(newfile, prev);
00346
00347     uppath = newdir;
00348     folder = newfile;
00349
00350     return true;
00351 }
00352
00353 void GetExtension(const char *file, CStr & base, CStr & ext)
00354 {
00355     char *tmp = strrchr(file, '.');
00356     if(tmp == 0L)
00357     {
00358         ext = "";
00359         base = file;
00360     }
00361     else
00362     {
00363         ext = tmp + 1;
00364         base = file;
00365         base[tmp - file] = '\0';
00366     }
00367 }
00368
00369 bool MakeTmpFile(CStr & file, const char *prefix, const char *extension /*= 0L*/, bool create /*= false*/)
00370 {
00371     static int count = 0;
00372     char filename[256];
00373
00374     CStr tmpPath;
00375     CStr ext;
00376     CStr prf;
00377
00378     if(extension != 0L && extension[0] != '\0')
00379     {
00380         if(extension[0] != '.')
00381             ext = ".";
00382         ext << extension;
00383     }
00384
00385     if(prefix != 0L && prefix[0] != '\0')
00386     {
00387         prf = prefix;
00388     }
00389     else
00390         prf = "cvsgui";
00391
00392 #ifdef WIN32
00393     char *ptr;
00394     ptr = getenv(_T("TMP"));
00395     if (ptr != 0L && _access( ptr, 0 ) != -1 )
00396         tmpPath = ptr;
00397     else
00398         tmpPath = ".";
00399 #endif /* !WIN32 */
00400 #ifdef macintosh
00401     FSSpec theFolder;
00402     Str255 aPath;
00403     OSErr err;
00404
00405     if((err = MacGetTempFolder(theFolder, aPath)) != noErr)
00406     {
00407         cvs_err("Unable to locate the preferences folder (error %d) !\n", err);
00408         return 0L;
00409     }
00410     tmpPath = aPath;
00411
00412     for (;;) {
00413         sprintf(filename, "%s%d%s", (const char *)prf, count, (const char *)ext);
00414         if (::strlen (filename) <= 31) break;
00415
00416         if (prf.length () == 0) {
00417             cvs_err("Unable to truncate temp file !\n");
00418             return 0L;
00419             } // if
00420
00421         prf.set (prf, prf.length () - 1);
00422         } // for
00423 #endif /* !macintosh */
00424 #if qUnix
00425     tmpPath = "/tmp";
00426 #endif
00427
00428     struct stat sb;
00429     if (stat(tmpPath, &sb) == -1 || !S_ISDIR(sb.st_mode))
00430     {
00431         cvs_err("Unable to access '%s' (error %d) !\n", (const char *)tmpPath, errno);
00432         return false;
00433     }
00434
00435     if(!tmpPath.endsWith(kPathDelimiter))
00436         tmpPath << kPathDelimiter;
00437
00438     int maxtry = 10000;
00439     while(1)
00440     {
00441         sprintf(filename, "%s%d%s", (const char *)prf, count++, (const char *)ext);
00442         file = tmpPath;
00443         file << filename;
00444         if (stat(file, &sb) == -1 && errno == ENOENT)
00445         {
00446             if( create )
00447             {
00448                 FILE* stream = fopen(file, "w");
00449                 if( stream )
00450                 {
00451                     fclose(stream);
00452                 }
00453             }
00454             return true;
00455         }
00456
00457         if(maxtry-- == 0)
00458         {
00459             cvs_err("Time out to access '%s' !\n", (const char *)tmpPath);
00460             break;
00461         }
00462     }
00463
00464     return false;
00465 }
00466
00467 bool GetEnvValue(const char *cmd, const char *key, UStr & value)
00468 {
00469     const char *tmp = strstr(cmd, key);
00470     if(tmp == 0L)
00471         return false;
00472     tmp = strchr(tmp, '=');
00473     if(tmp == 0L)
00474         return false;
00475     tmp++;
00476     const char *tmp2 = strchr(tmp, '&');
00477     if(tmp2 == 0L)
00478         value = tmp;
00479     else
00480         value.set(tmp, tmp2 - tmp);
00481     return true;
00482 }
00483
00484 int StringToArgv(const char *cmdLine, char **argv)
00485 {
00486     int argc = 0;
00487
00488     char    Quote = '\0';               /*  Contains the quote character if we are
00489                                             inside "" or '', or \0 otherwise */
00490     const char* walker1 = cmdLine;      /*  walker1 traverses the original
00491                                             command line */
00492     char*   walker2;                    /*  walker2 traverses the parsed copy of
00493                                             the command line */
00494     char    theChar;                    /*  theChar is the character we are currently
00495                                             parsing */
00496     char    arguments [MAX_CMD_LEN];            /*  will contain a parsed copy of the
00497                                             command line */
00498
00499     walker2 = arguments;                                        /*  copy into arguments */
00500     while ((theChar = *walker1++) != '\0') {                    /*  parse command line to \0 */
00501         if (theChar == ' ')                                     /*  skip leading space before an argument */
00502             continue;
00503         argv [argc++] = walker2;                                /*  set argv to point to the space
00504                                                                     where we copy the next argument */
00505         if (argc > MAX_ARGS) {                                  /*  if we filled argv, skip the rest */
00506             argc--;
00507             break;
00508         }
00509         do {                                                    /*  parse an argument */
00510             if (theChar == '\\' && *walker1++)                  /*  skip \s */
00511                 theChar = *walker1++;
00512             else
00513                 if ((theChar == '"') || (theChar == '\'')) {    /*  when we find a quote... */
00514                     if (Quote == '\0') {                        /*  if we are not inside quotes already, */
00515                         Quote = theChar;                        /*  remember we are inside quotes now */
00516                         continue;                               /*  go to the next character */
00517                     }
00518                     if (theChar == Quote) {                     /*  if we are already inside that kind of quotes */
00519                         Quote = '\0';                           /*  close quotes */
00520                         continue;                               /*  go to the next character */
00521                     }
00522                 }
00523             *walker2++ = theChar;                               /*  copy the character into args */
00524                                                                 /*  repeat until we reach the end of arguments
00525                                                                     or we reach a space that is not inside quotes */
00526         } while ((*walker1 != '\0') && (((theChar = *walker1++) != ' ') || (Quote != '\0')));
00527         *walker2++ = 0;                                         /* null-terminate the last argument */
00528     }
00529
00530     return argc;
00531 }
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/TextBinary.h Source File

common/TextBinary.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * TextBinary.h --- utilities to ckeck if files are binary or text
00023  */
00024
00025 #ifndef TEXTBINARY_H
00026 #define TEXTBINARY_H
00027
00028 #include "CPStr.h"
00029
00030 #ifdef macintosh
00031 #   include <Files.h>
00032 #else /* !macintosh */
00033     typedef int FSSpec;
00034 #endif /* !macintosh */
00035
00036 #ifdef WIN32
00037     static const char kPathDelimiter = '\\';
00038 #elif defined(macintosh)
00039     static const char kPathDelimiter = ':';
00040 #else
00041     static const char kPathDelimiter = '/';
00042 #endif
00043
00044 typedef enum
00045 {
00046     // text and binary flags
00047     kFileIsOK, // good file
00048     kFileMissing, // file is missing or unreadable
00049     kFileIsAlias, // file is an alias
00050     kFileInvalidName, // invalid character ('/')
00051
00052     // text flags
00053     kTextWrongLF, // for example it has Mac \r on Windows
00054     kTextIsBinary, // file should be text but seems (at least) to be binary
00055     kTextEscapeChar, // file has some extras characters (0x00-0x1F, 0x80-0xFF)
00056     kTextWrongSig, // file has not the 'TEXT' signature (Mac only)
00057
00058     // binary flags
00059     kBinIsText, // binary file seems to ba a text file
00060     kBinWrongSig // file should not have the 'TEXT' signature in it (Mac only)
00061 } kTextBinTYPE;
00062
00063 kTextBinTYPE FileIsText(const char *arg, const char *dir, const FSSpec * spec = 0L);
00064 kTextBinTYPE FileIsBinary(const char *arg, const char *dir, const FSSpec * spec = 0L);
00065
00066 bool SplitPath(const char *dir, CStr & uppath, CStr & folder);
00067     // split the path with the up-directory and the folder.
00068     // returns false if failed
00069
00070 bool MakeTmpFile(CStr & file, const char *prefix, const char *extension = 0L, bool create = false);
00071     // find a unique name for a temp file
00072
00073 void GetExtension(const char *file, CStr & base, CStr & ext);
00074     // extract the extension from the filename
00075
00076 bool GetEnvValue(const char *cmd, const char *key, UStr & value);
00077     // utility function, parse a command like 'user=who&host=cvs'
00078
00079 #define MAX_ARGS 40
00080 #define MAX_CMD_LEN 2048
00081
00082 int StringToArgv(const char *cmdLine, char **argv);
00083     // convert a command line (possibly quoted) into
00084     // regular argc, argv arguments
00085
00086 #endif /* TEXTBINARY_H */
Generated on Sun Oct 21 12:41:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsApp.cpp Source File

common/UCvsApp.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef HAVE_UNISTD_H
00028 #include <unistd.h>
00029 #endif
00030
00031 #ifdef HAVE_FCNTL_H
00032 #include <fcntl.h>
00033 #endif
00034
00035 #ifdef HAVE_SYS_WAIT_H
00036 #include <sys/wait.h>
00037 #endif
00038
00039 #if qGTK
00040 #include <gtk/gtk.h>
00041 #include <signal.h>
00042 // glade generated that
00043 extern "C"
00044 {
00045 #include "support.h"
00046 #include "interface.h"
00047 }
00048 #endif
00049
00050 #include "UCvsApp.h"
00051 #include "UCvsCommands.h"
00052 #include "UCvsFolders.h"
00053 #include "UCvsFiles.h"
00054 #include "TclGlue.h"
00055 #include "GetPrefs.h"
00056 #include "CvsPrefs.h"
00057 #include "AppConsole.h"
00058 #include "MacrosSetup.h"
00059 #include "Authen.h"
00060 #include "getopt.h"
00061
00062 UIMPLEMENT_DYNAMIC(UCvsApp, UWidget)
00063
00064 UBEGIN_MESSAGE_MAP(UCvsApp, UWidget)
00065     ON_TIMER(UCvsApp::kProcessTimer, UCvsApp::OnMainTimer)
00066 UEND_MESSAGE_MAP()
00067
00068 UCvsApp *UCvsApp::gApp = 0L;
00069 CvsProcess *UCvsApp::gCurCvs = 0L;
00070
00071 static void usage(void)
00072 {
00073     fprintf(stderr, "gcvs [--root=path]\n");
00074 }
00075
00076 UCvsApp::UCvsApp(int argc, char **argv) : UWidget(::UEventGetWidID()), gCvsRunning(false), gCvsStopping(false)
00077 {
00078     gApp = this;
00079
00080 #if qGTK
00081     add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps");
00082     add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");
00083 #endif
00084
00085     // load the persistent values (i.e. preferences) and the locate the macros
00086     gCvsPrefs.load();
00087     MacrosReloadAll();
00088
00089     AddTimer(50, kProcessTimer);
00090
00091     if(argc > 0)
00092     {
00093         static struct option long_options[] =
00094         {
00095             {"root", required_argument, 0L, 1},
00096             {0, 0, 0, 0}
00097         };
00098         optind = 0;
00099         int option_index = 0, c;
00100         while ((c = getopt_long
00101                 (argc, argv, "+", long_options, &option_index)) != EOF)
00102         {
00103             switch (c)
00104             {
00105             case 1:
00106                 UCvsFolders::SetDefaultRoot(optarg);
00107                 break;
00108             default:
00109                 cvs_err("Warning : unknown option\n");
00110                 usage();
00111                 break;
00112             }
00113         }
00114
00115     }
00116 }
00117
00118 UCvsApp::~UCvsApp()
00119 {
00120 }
00121
00122 void UCvsApp::SayWelcome(void)
00123 {
00124     // say hello from the application, optionnaly prompt for the CVSROOT
00125     cvs_out("Welcome to %s %s\n", PACKAGE, VERSION);
00126     if(gCvsPrefs.empty())
00127         CompatGetPrefs();
00128     else
00129         cvs_out("CVSROOT: %s (%s)\n", (const char *)gCvsPrefs, gAuthen.kindstr());
00130
00131     if(CTcl_Interp::IsAvail())
00132     {
00133         cvs_out("TCL is available, shell and macros are enabled : help (select and press enter)\n");
00134     }
00135     else
00136     {
00137         cvs_err("TCL is *not* available, shell and macros are disabled\n");
00138     }
00139 }
00140
00141 void UCvsApp::SetCvsRunning(bool state)
00142 {
00143     if(state ^ gCvsRunning)
00144     {
00145         gCvsRunning = state;
00146     }
00147 }
00148
00149 void UCvsApp::SetCvsStopping(bool state)
00150 {
00151     if(state ^ gCvsStopping)
00152     {
00153         gCvsStopping = state;
00154     }
00155 }
00156
00157 UCvsFolders *UCvsApp::GetBrowserView(void)
00158 {
00159     UCmdTarget *cmd = UEventQueryWidget(kUCvsFoldersID);
00160     if(cmd != 0L && cmd->IsKindOf(URUNTIME_CLASS(UCvsFolders)))
00161         return (UCvsFolders *)cmd;
00162
00163     return 0L;
00164 }
00165
00166 UCvsFiles *UCvsApp::GetFilesView(void)
00167 {
00168     UCmdTarget *cmd = UEventQueryWidget(kUCvsFilesID);
00169     if(cmd != 0L && cmd->IsKindOf(URUNTIME_CLASS(UCvsFiles)))
00170         return (UCvsFiles *)cmd;
00171
00172     return 0L;
00173 }
00174
00175 const char *UCvsApp::GetAppName() const
00176 {
00177 #ifdef macintosh
00178     return "MacCvs";
00179 #elif defined(WIN32)
00180     return "WinCvs";
00181 #elif defined(qUnix)
00182     return PACKAGE;
00183 #endif
00184 }
00185
00186 const char *UCvsApp::GetAppVersion() const
00187 {
00188 #ifdef macintosh
00189
00190 #elif defined(WIN32)
00191
00192 #elif defined(qUnix)
00193     return VERSION;
00194 #endif
00195 }
00196
00197 const char *UCvsApp::GetAppLibFolder() const
00198 {
00199 #if qUnix
00200     return EXECLIB;
00201 #else
00202     return 0L;
00203 #endif
00204 }
00205
00206 #if qUnix
00207 static void
00208 set_cloexec (gint fd)
00209 {
00210     fcntl (fd, F_SETFD, FD_CLOEXEC);
00211 }
00212
00213 static int
00214 gnome_execute_async_with_env_fds(const char *dir, int argc,
00215                        char * const argv[], int envc,
00216                        char * const envv[],
00217                        gboolean close_fds)
00218 {
00219     int parent_comm_pipes[2], child_comm_pipes[2];
00220     int child_errno, itmp, i, open_max;
00221     int res;
00222     char **cpargv;
00223     pid_t child_pid, immediate_child_pid; /* XXX this routine assumes
00224                        pid_t is signed */
00225
00226     if(pipe(parent_comm_pipes))
00227         return -1;
00228
00229     child_pid = immediate_child_pid = fork();
00230
00231     switch(child_pid) {
00232     case -1:
00233         close(parent_comm_pipes[0]);
00234         close(parent_comm_pipes[1]);
00235         return -1;
00236
00237     case 0: /* START PROCESS 1: child */
00238         child_pid = -1;
00239         res = pipe(child_comm_pipes);
00240         close(parent_comm_pipes[0]);
00241         if(!res)
00242             child_pid = fork();
00243
00244         switch(child_pid) {
00245         case -1:
00246             itmp = errno;
00247             child_pid = -1; /* simplify parent code */
00248             write(parent_comm_pipes[1], &child_pid, sizeof(child_pid));
00249             write(parent_comm_pipes[1], &itmp, sizeof(itmp));
00250             close(child_comm_pipes[0]);
00251             close(child_comm_pipes[1]);
00252             _exit(0); break;      /* END PROCESS 1: monkey in the middle dies */
00253
00254         default:
00255         {
00256             char buf[16];
00257
00258             close(child_comm_pipes[1]);
00259             while((res = read(child_comm_pipes[0], buf, sizeof(buf))) > 0)
00260                 write(parent_comm_pipes[1], buf, res);
00261             close(child_comm_pipes[0]);
00262             _exit(0); /* END PROCESS 1: monkey in the middle dies */
00263         }
00264             break;
00265
00266         case 0:                 /* START PROCESS 2: child of child */
00267             close(parent_comm_pipes[1]);
00268             /* pre-exec setup */
00269             close (child_comm_pipes[0]);
00270             set_cloexec (child_comm_pipes[1]);
00271             child_pid = getpid();
00272             res = write(child_comm_pipes[1], &child_pid, sizeof(child_pid));
00273
00274             if(envv) {
00275                 for(itmp = 0; itmp < envc; itmp++)
00276                     putenv(envv[itmp]);
00277             }
00278
00279             if(dir) chdir(dir);
00280
00281             cpargv = (char **)malloc((argc + 1) * sizeof(char *));
00282             memcpy(cpargv, argv, argc * sizeof(char *));
00283             cpargv[argc] = NULL;
00284
00285             if(close_fds)
00286             {
00287                 int stdinfd;
00288                 /* Close all file descriptors but stdin stdout and stderr */
00289                 open_max = sysconf (_SC_OPEN_MAX);
00290                 for (i = 3; i < open_max; i++)
00291                     set_cloexec (i);
00292
00293                 if(child_comm_pipes[1] != 0) {
00294                     close(0);
00295                     /* Open stdin as being nothingness, so that if someone tries to
00296                        read from this they don't hang up the whole GNOME session. BUGFIX #1548 */
00297                     stdinfd = open("/dev/null", O_RDONLY);
00298                     g_assert(stdinfd >= 0);
00299                     if(stdinfd != 0)
00300                     {
00301                         dup2(stdinfd, 0);
00302                         close(stdinfd);
00303                     }
00304                 }
00305             }
00306             signal (SIGPIPE, SIG_DFL);
00307             /* doit */
00308             execvp(cpargv[0], cpargv);
00309             free(cpargv);
00310
00311             /* failed */
00312             itmp = errno;
00313             write(child_comm_pipes[1], &itmp, sizeof(itmp));
00314             _exit(1); break;      /* END PROCESS 2 */
00315         }
00316         break;
00317
00318     default: /* parent process */
00319         /* do nothing */
00320         break;
00321     }
00322
00323     close(parent_comm_pipes[1]);
00324
00325     res = read (parent_comm_pipes[0], &child_pid, sizeof(child_pid));
00326     if (res != sizeof(child_pid))
00327     {
00328         g_message("res is %d instead of %d", res, sizeof(child_pid));
00329         child_pid = -1; /* really weird things happened */
00330     }
00331     else if (read (parent_comm_pipes[0], &child_errno, sizeof(child_errno))
00332              == sizeof(child_errno))
00333     {
00334         errno = child_errno;
00335         child_pid = -1;
00336     }
00337
00338     /* do this after the read's in case some OS's handle blocking on pipe writes
00339      differently */
00340     waitpid(immediate_child_pid, &itmp, 0); /* eat zombies */
00341
00342     close(parent_comm_pipes[0]);
00343
00344     if(child_pid < 0)
00345         g_message("gnome_execute_async_with_env_fds: returning %d", child_pid);
00346
00347     return child_pid;
00348 }
00349 #endif
00350
00351 void UCvsApp::Execute(int argc, char * const *argv)
00352 {
00353 #if qUnix
00354     gnome_execute_async_with_env_fds(0L, argc, argv, 0, 0L, true);
00355 #endif
00356 }
00357
00358 void UCvsApp::OnMainTimer(long time)
00359 {
00360     if(gCurCvs != 0L)
00361     {
00362         cvs_process_give_time();
00363         if(!cvs_process_is_active(gCurCvs))
00364         {
00365             UCvsApp::gApp->SetCvsRunning(false);
00366             gCurCvs = 0L;
00367             UWidget::DoValidUI(false);
00368             UCvsApp::gApp->GetFilesView()->ResetView();
00369         }
00370     }
00371 }
00372
00373 #if qGTK
00374 #   define NEWDLG(name) \
00375     void *UCreate_##name(void) \
00376     { \
00377         return create_##name(); \
00378     }
00379     NEWDLG(MainWindow)
00380     NEWDLG(GraphWindow)
00381     NEWDLG(AskYesNo)
00382     NEWDLG(gcvs_Settings)
00383     NEWDLG(UpdateDlg)
00384     NEWDLG(PasswdDlg)
00385     NEWDLG(CommitDlg)
00386     NEWDLG(DiffDlg)
00387     NEWDLG(CheckoutDlg)
00388     NEWDLG(LogDlg)
00389     NEWDLG(ImportFilterDlg)
00390     NEWDLG(ImpWarningDlg)
00391     NEWDLG(ImpEntryDlg)
00392     NEWDLG(ImportDlg)
00393     NEWDLG(CmdlineDlg)
00394     NEWDLG(TagModDlg)
00395     NEWDLG(BranchModDlg)
00396     NEWDLG(UntagModDlg)
00397     NEWDLG(TagDlg)
00398     NEWDLG(BranchDlg)
00399     NEWDLG(UntagDlg)
00400     NEWDLG(SettingsDlg)
00401 #endif
00402
00403 void *UCreate_pixmap(UWidget *parent, const char *fileIcon)
00404 {
00405 #if qGTK
00406     GtkWidget *wid = (GtkWidget *)parent->GetWidget(kUMainWidget);
00407     return GTK_PIXMAP(create_pixmap(wid, fileIcon));
00408 #else
00409     return 0L;
00410 #endif
00411 }
Generated on Sun Oct 21 12:41:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsApp.h Source File

common/UCvsApp.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #ifndef UCVSAPP_H
00026 #define UCVSAPP_H
00027
00028 #include "uwidget.h"
00029 #include "cvsgui_process.h"
00030
00031 class UCvsFolders;
00032 class UCvsFiles;
00033
00034 class UCvsApp : public UWidget
00035 {
00036     UDECLARE_DYNAMIC(UCvsApp)
00037 public:
00038     UCvsApp(int argc, char **argv);
00039     virtual ~UCvsApp();
00040
00041     static UCvsApp *gApp;
00042         // a pointer on the pseudo application
00043
00044     static CvsProcess *gCurCvs;
00045         // the running process (if any)
00046
00047     void SayWelcome(void);
00048         // make the greetings and ask for the CVSROOT if necessary
00049
00050     void SetCvsRunning(bool state);
00051     inline bool IsCvsRunning(void) { return gCvsRunning; }
00052         // when the cvs processus (or thread) is running
00053
00054     void SetCvsStopping(bool state);
00055     inline bool IsCvsStopping(void) { return gCvsStopping; }
00056         // when the cvs processus is stopping (it may take a while)
00057
00058     UCvsFolders *GetBrowserView(void);
00059         // get the left pane browser tree
00060
00061     UCvsFiles *GetFilesView(void);
00062         // get the right pane file list
00063
00064     const char *GetAppName(void) const;
00065     const char *GetAppLibFolder(void) const;
00066     const char *GetAppVersion(void) const;
00067
00068     void Execute(int argc, char * const *argv);
00069
00070     enum
00071     {
00072         kProcessTimer = EV_COMMAND_START
00073     };
00074
00075 protected:
00076     bool gCvsRunning;
00077     bool gCvsStopping;
00078
00079     ev_msg void OnMainTimer(long time);
00080
00081     UDECLARE_MESSAGE_MAP()
00082 };
00083
00084 #endif
Generated on Sun Oct 21 12:41:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsCommands.h Source File

common/UCvsCommands.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #ifndef UCVSCOMMANDS_H
00026 #define UCVSCOMMANDS_H
00027
00028 #include "umain.h"
00029
00030 // the global pseudo-widgets have fixed assigned IDs in order
00031 // to be able to access them from anywhere.
00032 enum
00033 {
00034     kUCvsFrameID = 1,           /* the main frane */
00035     kUMainConsoleID,            /* the pseudo-console */
00036     kUCvsFoldersID,             /* the folder tree */
00037     kUCvsFilesID,               /* the files list */
00038     kUCvsToolbarID,             /* the toolbar */
00039     kUCvsMenubarID              /* the menubar */
00040 };
00041
00042 // commands shared over the pseudo-widgets : thse commands are dispatched
00043 // mainly by the toolbar and the menubar.
00044 enum
00045 {
00046     cmdSAVE = EV_COMMAND_START + 100,
00047     cmdSAVE_AS,
00048     cmdPRINT,
00049     cmdPRINT_PREVIEW,
00050     cmdPRINT_SETUP,
00051     cmdSEND_MAIL,
00052     cmdEXIT,
00053     cmdUNDO,
00054     cmdCUT,
00055     cmdCOPY,
00056     cmdPASTE,
00057     cmdSELECT_ALL,
00058     cmdCLEAR_ALL,
00059     cmdFIND,
00060     cmdREPEAT,
00061     cmdFONT,
00062     cmdTOOLBAR,
00063     cmdSTATUS_BAR,
00064     cmdBROWSER_BAR,
00065     cmdFILES_BAR,
00066     cmdMULTI_BAR,
00067     cmdTAGS_BAR,
00068     cmdCONSOLE_BAR,
00069     cmdWORKSPACE,
00070     cmdOPEN,
00071     cmdPREFERENCES,
00072     cmdCMDLINE,
00073     cmdLOGIN,
00074     cmdLOGOUT,
00075     cmdSTOPCVS,
00076     cmdINIT,
00077     cmdIMPORT,
00078     cmdCHECKOUT,
00079     cmdRTAGCREATE,
00080     cmdRTAGDELETE,
00081     cmdRTAGBRANCH,
00082     cmdUPDATE,
00083     cmdCOMMIT,
00084     cmdADD,
00085     cmdADDB,
00086     cmdRMV,
00087     cmdTRASH,
00088     cmdTAGNEW,
00089     cmdTAGDELETE,
00090     cmdTAGBRANCH,
00091     cmdEXPLORE,
00092     cmdQUERYUPDATE,
00093     cmdRELOAD,
00094     cmdEDITSEL,
00095     cmdEDITSELDEF,
00096     cmdDIFF,
00097     cmdLOG,
00098     cmdSTATUS,
00099     cmdGRAPH,
00100     cmdLOCKF,
00101     cmdUNLOCKF,
00102     cmdEDIT,
00103     cmdUNEDIT,
00104     cmdWATCHON,
00105     cmdWATCHOFF,
00106     cmdRELEASE,
00107     cmdWATCHERS,
00108     cmdEDITORS,
00109     cmdCASCADE,
00110     cmdTILE_HORZ,
00111     cmdARRANGE,
00112     cmdFINDER,
00113     cmdCVS,
00114     cmdCVSCLIENT,
00115     cmdABOUT,
00116     cmdIGNORE,
00117     cmdUPFOLDER,
00118     cmdSAVESETTINGS,
00119
00120     cmdSELMACRO, // contiguous BEGIN
00121     cmdSELMACROEND = cmdSELMACRO + 30,
00122
00123     cmdMACROADMIN, // contiguous BEGIN
00124     cmdMACROADMINEND = cmdMACROADMIN + 20,
00125
00126     cmdCREDITS, // contiguous BEGIN
00127     cmdCOPYRIGHTS // END
00128 };
00129
00130 #endif
Generated on Sun Oct 21 12:41:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsConsole.cpp Source File

common/UCvsConsole.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #if qGTK
00028 #   include <gtk/gtk.h>
00029 #   include <gdk/gdkkeysyms.h>
00030 #endif
00031
00032 #include "UCvsConsole.h"
00033 #include "UCvsCommands.h"
00034 #include "uconsole.h"
00035 #include "TclGlue.h"
00036
00037 UIMPLEMENT_DYNAMIC(UCvsConsole, UWidget)
00038
00039 UBEGIN_MESSAGE_MAP(UCvsConsole, UWidget)
00040     ON_UDESTROY(UCvsConsole)
00041     ON_UCREATE(UCvsConsole)
00042 UEND_MESSAGE_MAP()
00043
00044 UCvsConsole::UCvsConsole() : UWidget(kUMainConsoleID), m_buf(0L), m_numbuf(0)
00045 {
00046     out.col = UCOLOR(0, 0, 0);
00047     out.bold = false;
00048     out.italic = false;
00049     out.underline = false;
00050 }
00051
00052 UCvsConsole::~UCvsConsole()
00053 {
00054     m_numbuf = 0;
00055     if(m_buf != 0L)
00056     {
00057         free(m_buf);
00058         m_buf = 0L;
00059     }
00060 }
00061
00062 void UCvsConsole::FeedThisLine(const char *buf, size_t numbuf, bool isStderr)
00063 {
00064     void *wid = GetWidget(kUMainWidget);
00065     if(wid == 0L)
00066     {
00067         UAppConsole("The console is not here !\n");
00068         return;
00069     }
00070
00071 #if qGTK
00072     if(!GTK_IS_TEXT(wid))
00073     {
00074         g_warning("The pseudo-console is not here !\n");
00075         return;
00076     }
00077
00078     GtkText *w = GTK_TEXT(wid);
00079     gtk_text_set_point(w, gtk_text_get_length(w));
00080 #endif
00081
00082     UCOLOR color(0, 0, 0);
00083     bool colorChanged = false;
00084     UStr s;
00085     s.set(buf, numbuf);
00086
00087     if(s.length() >= 5 && s[1] == ' ' &&
00088         (s[0] == 'M' || s[0] == 'C' || s[0] == 'U' ||
00089         s[0] == 'P' || s[0] == 'N' || s[0] == 'A' ||
00090         s[0] == 'R' || s[0] == 'I' || s[0] == '?' ||
00091         s[0] == '<' || s[0] == '>'))
00092     {
00093         colorChanged = true;
00094         switch(s[0])
00095         {
00096         default:
00097         case '?' :
00098         case 'I' :
00099             color = UCOLOR(0x80, 0x80, 0x00);
00100             break;
00101         case 'U' :
00102         case 'N' :
00103             color = UCOLOR(0x00, 0xA0, 0x00);
00104             break;
00105         case 'M' :
00106         case 'A' :
00107         case 'R' :
00108             color = UCOLOR(0xFF, 0x00, 0xFF);
00109             break;
00110         case 'C' :
00111         case '<' :
00112             color = UCOLOR(0xFF, 0x00, 0x00);
00113             break;
00114         case '>' :
00115         case 'P' :
00116             color = UCOLOR(0x00, 0x00, 0xFF);
00117             break;
00118         }
00119     }
00120     else if(isStderr)
00121     {
00122         colorChanged = true;
00123         color = UCOLOR(0xFF, 0x80, 0x00);
00124     }
00125
00126 #if qGTK
00127     GdkColormap *cmap;
00128     GdkColor col;
00129     cmap = gdk_colormap_get_system();
00130     col.red = ((unsigned int)color.r) << 8;
00131     col.green = ((unsigned int)color.g) << 8;
00132     col.blue = ((unsigned int)color.b) << 8;
00133     if(color.r != 0 || color.g != 0 || color.b != 0)
00134     {
00135         if (!gdk_color_alloc(cmap, &col)) {
00136             g_error("Couldn't allocate color\n");
00137         }
00138         gtk_text_insert(w, NULL, &col, NULL, s, -1);
00139     }
00140     else
00141         gtk_text_insert(w, NULL, &GTK_WIDGET(w)->style->black, NULL, s, -1);
00142 #endif
00143 }
00144
00145 void UCvsConsole::OutConsole(const char *txt, size_t len, bool isStderr)
00146 {
00147     if(len == 0)
00148         return;
00149
00150     if(m_buf == 0L)
00151     {
00152         m_buf = (char *)malloc((MAX_CHAR_BY_LINE + 3) * sizeof(char));
00153         if(m_buf == 0L)
00154             return;
00155     }
00156
00157     size_t i = 0;
00158     char c = 0;
00159 once_again:
00160     for(; i < len && m_numbuf < MAX_CHAR_BY_LINE; m_numbuf++)
00161     {
00162         c = txt[i++];
00163         if(c == 0x0a)
00164             break;
00165         m_buf[m_numbuf] = c;
00166     }
00167
00168     if(c == 0x0a || m_numbuf == MAX_CHAR_BY_LINE)
00169     {
00170         m_buf[m_numbuf++] = 0x0a;
00171         m_buf[m_numbuf++] = 0x00;
00172
00173         FeedThisLine(m_buf, m_numbuf, isStderr);
00174         m_numbuf = 0;
00175     }
00176
00177     if(i != len)
00178         goto once_again;
00179 }
00180
00181 void UCvsConsole::OnDestroy(void)
00182 {
00183     delete this;
00184 }
00185
00186 #if qGTK
00187 extern "C"
00188 {
00189     static int gtkkeypress(GtkWidget *widget, GdkEventKey * event, gpointer user_data)
00190     {
00191         UCvsConsole *wid = (UCvsConsole *)user_data;
00192
00193         if (event->keyval != GDK_Return && event->keyval != GDK_KP_Enter)
00194             return FALSE;
00195
00196         if(!CTcl_Interp::IsAvail())
00197             return FALSE;
00198
00199         if(!GTK_IS_TEXT(widget))
00200         {
00201             g_warning("The pseudo-console is not here !\n");
00202             return FALSE;
00203         }
00204
00205         GtkText *text = GTK_TEXT(widget);
00206         const GtkEditable & w = text->editable;
00207         guint len = gtk_text_get_length(text);
00208         if(len == 0)
00209             return FALSE;
00210
00211         guint nStartChar, nEndChar;
00212
00213         if (!w.has_selection)
00214         {
00215             // get the end and the beginning of the line
00216             nStartChar = nEndChar = w.current_pos;
00217
00218             if(nStartChar > 0 && GTK_TEXT_INDEX(text, nStartChar) == '\n')
00219                 nStartChar--;
00220             while(nStartChar > 0 && GTK_TEXT_INDEX(text, nStartChar) != '\n')
00221                 nStartChar--;
00222             if(GTK_TEXT_INDEX(text, nStartChar) == '\n')
00223                 nStartChar++;
00224             while(nEndChar < len && GTK_TEXT_INDEX(text, nEndChar) != '\n')
00225                 nEndChar++;
00226         }
00227         else
00228         {
00229             nStartChar = w.selection_start_pos;
00230             nEndChar = w.selection_end_pos;
00231         }
00232
00233         guint long length = nEndChar - nStartChar;
00234         if(length > 0 && nStartChar < len)
00235         {
00236             char *buf = (char *)malloc((length + 1) * sizeof(char));
00237             if(buf != 0L)
00238             {
00239                 char *tmp = buf;
00240                 while(nStartChar < nEndChar)
00241                 {
00242                     *tmp++ = GTK_TEXT_INDEX(text, nStartChar);
00243                     nStartChar++;
00244                 }
00245                 *tmp++ = '\0';
00246
00247                 wid->OutConsole("\n", 1);
00248                 CTcl_Interp interp;
00249                 interp.DoScript(buf);
00250                 free(buf);
00251             }
00252         }
00253
00254         return FALSE;
00255     }
00256 }
00257 #endif
00258
00259 void UCvsConsole::OnCreate(void)
00260 {
00261     void *wid = GetWidget(kUMainWidget);
00262     if(wid == 0L)
00263     {
00264         UAppConsole("The console is not here !\n");
00265         return;
00266     }
00267
00268 #if qGTK
00269     gtk_signal_connect (GTK_OBJECT (wid), "key_press_event",
00270                         GTK_SIGNAL_FUNC(gtkkeypress), (gpointer)this);
00271 #endif
00272 }
00273
00274 void UCvsConsole::OutColor(const char *txt, long len)
00275 {
00276     void *wid = GetWidget(kUMainWidget);
00277     if(wid == 0L)
00278     {
00279         UAppConsole("The console is not here !\n");
00280         return;
00281     }
00282
00283 #if qGTK
00284     if(!GTK_IS_TEXT(wid))
00285     {
00286         g_warning("The pseudo-console is not here !\n");
00287         return;
00288     }
00289
00290     GtkText *w = GTK_TEXT(wid);
00291     gtk_text_set_point(w, gtk_text_get_length(w));
00292
00293     GdkColormap *cmap;
00294     GdkColor col;
00295     cmap = gdk_colormap_get_system();
00296     col.red = ((unsigned int)out.col.r) << 8;
00297     col.green = ((unsigned int)out.col.g) << 8;
00298     col.blue = ((unsigned int)out.col.b) << 8;
00299     if(out.col.r != 0 || out.col.g != 0 || out.col.b != 0)
00300     {
00301         if (!gdk_color_alloc(cmap, &col)) {
00302             g_error("Couldn't allocate color\n");
00303         }
00304         gtk_text_insert(w, NULL, &col, NULL, txt, len);
00305     }
00306     else
00307         gtk_text_insert(w, NULL, &GTK_WIDGET(w)->style->black, NULL, txt, len);
00308 #endif
00309 }
00310
00311 void UCvsConsole::OutColor(kConsoleColor color)
00312 {
00313     switch(color)
00314     {
00315     case kBrown :
00316         out.col = UCOLOR(0x80, 0x80, 0x00);
00317         break;
00318     case kGreen :
00319         out.col = UCOLOR(0x00, 0xA0, 0x00);
00320         break;
00321     case kMagenta :
00322         out.col = UCOLOR(0xFF, 0x00, 0xFF);
00323         break;
00324     case kRed :
00325         out.col = UCOLOR(0xFF, 0x00, 0x00);
00326         break;
00327     case kBlue :
00328         out.col = UCOLOR(0x00, 0x00, 0xFF);
00329         break;
00330     case kBold :
00331         out.bold = true;
00332         break;
00333     case kItalic :
00334         out.italic = true;
00335         break;
00336     case kUnderline :
00337         out.underline = true;
00338         break;
00339     case kNormal:
00340         out.col = UCOLOR(0, 0, 0);
00341         out.bold = false;
00342         out.italic = false;
00343         out.underline = false;
00344         break;
00345     case kNL :
00346         break;
00347     }
00348 }
Generated on Sun Oct 21 12:41:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsConsole.h Source File

common/UCvsConsole.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #ifndef UCVSCONSOLE_H
00026 #define UCVSCONSOLE_H
00027
00028 #include "uwidget.h"
00029 #include "AppConsole.h"
00030
00031 struct UCOLOR
00032 {
00033     UCOLOR() {}
00034     UCOLOR(char _r, char _g, char _b) : r(_r), g(_g), b(_b) {}
00035
00036     unsigned char r;
00037     unsigned char g;
00038     unsigned char b;
00039 };
00040
00041 class UCvsConsole : public UWidget
00042 {
00043     UDECLARE_DYNAMIC(UCvsConsole)
00044 public:
00045     UCvsConsole();
00046     virtual ~UCvsConsole();
00047
00048     void OutConsole(const char *txt, size_t len, bool isStderr = false);
00049
00050     void OutColor(const char *txt, long len);
00051     void OutColor(kConsoleColor color);
00052         // colorized output
00053 protected:
00054     void FeedThisLine(const char *buf, size_t numbuf, bool isStderr);
00055
00056     enum
00057     {
00058         MAX_CHAR_BY_LINE = 1024
00059     };
00060
00061     char *m_buf;
00062     size_t m_numbuf;
00063
00064     struct
00065     {
00066         UCOLOR col;
00067         bool bold, italic, underline;
00068     } out;
00069
00070     ev_msg void OnDestroy();
00071     ev_msg void OnCreate();
00072
00073     UDECLARE_MESSAGE_MAP()
00074 };
00075
00076 #endif
Generated on Sun Oct 21 12:41:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsDialogs.h Source File

common/UCvsDialogs.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #ifndef UCVSDIALOGS_H
00026 #define UCVSDIALOGS_H
00027
00028 #include "uwidget.h"
00029
00030 // the pixmaps creations
00031 void *UCreate_pixmap(UWidget *parent, const char *fileIcon);
00032
00033 // the dialogs creationj
00034 extern void *UCreate_MainWindow (void);
00035 extern void *UCreate_GraphWindow (void);
00036 extern void *UCreate_AskYesNo (void);
00037 extern void *UCreate_gcvs_Settings (void);
00038 extern void *UCreate_UpdateDlg (void);
00039 extern void *UCreate_PasswdDlg (void);
00040 extern void *UCreate_CommitDlg (void);
00041 extern void *UCreate_DiffDlg (void);
00042 extern void *UCreate_CheckoutDlg (void);
00043 extern void *UCreate_LogDlg (void);
00044 extern void *UCreate_ImportFilterDlg (void);
00045 extern void *UCreate_ImpWarningDlg (void);
00046 extern void *UCreate_ImpEntryDlg (void);
00047 extern void *UCreate_ImportDlg (void);
00048 extern void *UCreate_CmdlineDlg (void);
00049 extern void *UCreate_TagModDlg (void);
00050 extern void *UCreate_UntagModDlg (void);
00051 extern void *UCreate_BranchModDlg (void);
00052 extern void *UCreate_TagDlg (void);
00053 extern void *UCreate_UntagDlg (void);
00054 extern void *UCreate_BranchDlg (void);
00055 extern void *UCreate_SettingsDlg (void);
00056
00057 #endif
Generated on Sun Oct 21 12:41:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsFiles.cpp Source File

common/UCvsFiles.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #if qGTK
00028 #   include <gtk/gtk.h>
00029 #endif
00030
00031 #ifdef HAVE_UNISTD_H
00032 #include <unistd.h>
00033 #endif
00034
00035 #ifdef HAVE_STRINGS_H
00036 #include <strings.h>
00037 #endif
00038
00039 #include "UCvsFiles.h"
00040 #include "UCvsDialogs.h"
00041 #include "UCvsFolders.h"
00042 #include "UCvsCommands.h"
00043 #include "UCvsFrame.h"
00044 #include "UCvsApp.h"
00045 #include "CvsPrefs.h"
00046 #include "FileTraversal.h"
00047 #include "MultiFiles.h"
00048 #include "CvsCommands.h"
00049 #include "CvsArgs.h"
00050 #include "TclGlue.h"
00051 #include "AppConsole.h"
00052 #include "MoveToTrash.h"
00053 #include "MacrosSetup.h"
00054
00055 UIMPLEMENT_DYNAMIC(UCvsFiles, UWidget)
00056
00057 UBEGIN_MESSAGE_MAP(UCvsFiles, UWidget)
00058     ON_UUPDATECMD(cmdUPDATE, UCvsFiles::OnCmdUIUpdate)
00059     ON_UUPDATECMD(cmdCOMMIT, UCvsFiles::OnCmdUIUpdate)
00060     ON_UUPDATECMD(cmdDIFF, UCvsFiles::OnCmdUIUpdate)
00061     ON_UUPDATECMD(cmdEDIT, UCvsFiles::OnCmdUIUpdate)
00062     ON_UUPDATECMD(cmdEDITORS, UCvsFiles::OnCmdUIUpdate)
00063     ON_UUPDATECMD(cmdLOCKF, UCvsFiles::OnCmdUIUpdate)
00064     ON_UUPDATECMD(cmdLOG, UCvsFiles::OnCmdUIUpdate)
00065     ON_UUPDATECMD(cmdTAGNEW, UCvsFiles::OnCmdUIUpdate)
00066     ON_UUPDATECMD(cmdTAGDELETE, UCvsFiles::OnCmdUIUpdate)
00067     ON_UUPDATECMD(cmdTAGBRANCH, UCvsFiles::OnCmdUIUpdate)
00068     ON_UUPDATECMD(cmdSTATUS, UCvsFiles::OnCmdUIUpdate)
00069     ON_UUPDATECMD(cmdUNEDIT, UCvsFiles::OnCmdUIUpdate)
00070     ON_UUPDATECMD(cmdQUERYUPDATE, UCvsFiles::OnCmdUIUpdate)
00071     ON_UUPDATECMD(cmdUNLOCKF, UCvsFiles::OnCmdUIUpdate)
00072     ON_UUPDATECMD(cmdWATCHERS, UCvsFiles::OnCmdUIUpdate)
00073     ON_UUPDATECMD(cmdWATCHON, UCvsFiles::OnCmdUIUpdate)
00074     ON_UUPDATECMD(cmdWATCHOFF, UCvsFiles::OnCmdUIUpdate)
00075     ON_UUPDATECMD(cmdADD, UCvsFiles::OnCmdUIAdd)
00076     ON_UUPDATECMD(cmdADDB, UCvsFiles::OnCmdUIAddB)
00077     ON_UUPDATECMD(cmdRELEASE, UCvsFiles::OnCmdUIRelease)
00078     ON_UUPDATECMD(cmdRMV, UCvsFiles::OnCmdUIRmv)
00079     ON_UUPDATECMD(cmdGRAPH, UCvsFiles::OnCmdUIGraph)
00080     ON_UUPDATECMD(cmdEDITSELDEF, UCvsFiles::OnCmdUIEditseldef)
00081     ON_UUPDATECMD(cmdRELOAD, UCvsFiles::OnCmdUIReload)
00082     ON_UUPDATECMD(cmdUPFOLDER, UCvsFiles::OnCmdUIUpone)
00083     ON_UUPDATECMD(cmdTRASH, UCvsFiles::OnCmdUITrash)
00084     ON_UUPDATECMD(cmdEXPLORE, UCvsFiles::OnCmdUIExplore)
00085     ON_UUPDATECMD(cmdIGNORE, UCvsFiles::OnCmdUIIgnore)
00086     ON_UUPDATECMD(cmdEDITSEL, UCvsFiles::OnCmdUITrash)
00087     ON_UUPDATECMD_RANGE(cmdSELMACRO, cmdSELMACROEND, UCvsFiles::OnCmdUIMacroSel)
00088     ON_UCOMMAND(cmdUPDATE, UCvsFiles::OnCmdUpdate)
00089     ON_UCOMMAND(cmdADD, UCvsFiles::OnCmdAdd)
00090     ON_UCOMMAND(cmdADDB, UCvsFiles::OnCmdAddb)
00091     ON_UCOMMAND(cmdCOMMIT, UCvsFiles::OnCmdCommit)
00092     ON_UCOMMAND(cmdRMV, UCvsFiles::OnCmdRmv)
00093     ON_UCOMMAND(cmdQUERYUPDATE, UCvsFiles::OnCmdQueryUpdate)
00094     ON_UCOMMAND(cmdRELOAD, UCvsFiles::OnCmdReload)
00095     ON_UCOMMAND(cmdUPFOLDER, UCvsFiles::OnCmdUpone)
00096     ON_UCOMMAND(cmdTRASH, UCvsFiles::OnCmdTrash)
00097     ON_UCOMMAND(cmdDIFF, UCvsFiles::OnCmdDiff)
00098     ON_UCOMMAND(cmdLOG, UCvsFiles::OnCmdLog)
00099     ON_UCOMMAND(cmdGRAPH, UCvsFiles::OnCmdGraph)
00100     ON_UCOMMAND(cmdSTATUS, UCvsFiles::OnCmdStatus)
00101     ON_UCOMMAND(cmdLOCKF, UCvsFiles::OnCmdLock)
00102     ON_UCOMMAND(cmdUNLOCKF, UCvsFiles::OnCmdUnlock)
00103     ON_UCOMMAND(cmdWATCHON, UCvsFiles::OnCmdWatchOn)
00104     ON_UCOMMAND(cmdWATCHOFF, UCvsFiles::OnCmdWatchOff)
00105     ON_UCOMMAND(cmdEDIT, UCvsFiles::OnCmdEdit)
00106     ON_UCOMMAND(cmdUNEDIT, UCvsFiles::OnCmdUnedit)
00107     ON_UCOMMAND(cmdWATCHERS, UCvsFiles::OnCmdWatchers)
00108     ON_UCOMMAND(cmdEDITORS, UCvsFiles::OnCmdEditors)
00109     ON_UCOMMAND(cmdRELEASE, UCvsFiles::OnCmdRelease)
00110     ON_UCOMMAND(cmdTAGNEW, UCvsFiles::OnCmdTagNew)
00111     ON_UCOMMAND(cmdTAGDELETE, UCvsFiles::OnCmdTagDelete)
00112     ON_UCOMMAND(cmdTAGBRANCH, UCvsFiles::OnCmdTagBranch)
00113     ON_UCOMMAND(cmdEXPLORE, UCvsFiles::OnCmdExplore)
00114     ON_UCOMMAND(cmdIGNORE, UCvsFiles::OnCmdIgnore)
00115     ON_UCOMMAND(cmdEDITSEL, UCvsFiles::OnCmdEditsel)
00116     ON_UCOMMAND(cmdEDITSELDEF, UCvsFiles::OnCmdEditseldef)
00117     ON_UCOMMAND_RANGE(cmdSELMACRO, cmdSELMACROEND, UCvsFiles::OnMacroSel)
00118     ON_LIST_DBLCLICK(kUMainWidget, UCvsFiles::OnDblClick)
00119     ON_LIST_SELCOLUMN(kUMainWidget, UCvsFiles::OnSelColumn)
00120     ON_UDESTROY(UCvsFiles)
00121     ON_UCREATE(UCvsFiles)
00122 UEND_MESSAGE_MAP()
00123
00124 #if 0
00125     ON_UUPDATECMD(cmdSMALLICONS, OnCmdUISmallIcons)
00126     ON_UUPDATECMD(cmdFULLLIST, OnCmdUIList)
00127     ON_UUPDATECMD(cmdROWDETAILS, OnCmdUIFullRowDetails)
00128     ON_COMMAND(ID_VIEW_SMALLICONS, OnViewSmallIcons)
00129     ON_COMMAND(ID_VIEW_FULLLIST, OnViewList)
00130     ON_COMMAND(ID_VIEW_ROWDETAILS, OnViewFullRowDetails)
00131     ON_WM_LBUTTONDOWN()
00132     ON_WM_RBUTTONDOWN()
00133     ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
00134     ON_NOTIFY_REFLECT(LVN_KEYDOWN, OnKeydown)
00135     ON_WM_TIMER()
00136
00137     //}}AFX_MSG_MAP
00138     ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
00139     ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
00140 #endif
00141
00142 static void *sFileIconTextIcon;
00143 static void *sFileIconBinaryIcon;
00144 static void *sFileIconUnknownIcon;
00145 static void *sFileIconAddedIcon;
00146 static void *sFileIconConflictIcon;
00147 static void *sFileIconMissIcon;
00148 static void *sFolderIconIcon;
00149 static void *sFolderIconUnknownIcon;
00150 static void *sFolderIconMissIcon;
00151 static void *sFileIconTextModIcon;
00152 static void *sFileIconBinaryModIcon;
00153 static void *sFileIconIgnoredIcon;
00154 static void *sFolderIconIgnoredIcon;
00155 static void *sFileIconRemovedIcon;
00156
00157 /*
00158 kFileIconText,cvsfile
00159 kFileIconBinary,binfile
00160 kFileIconUnknown,unkfile
00161 kFileIconAdded,addfile
00162 kFileIconConflict,conflict
00163 kFileIconMiss,missfile
00164 kFolderIcon,folder
00165 kFolderIconUnknown,foldunk
00166 kFolderIconMiss,foldmiss
00167 kFileIconTextMod,modfile
00168 kFileIconBinaryMod,modbin
00169 kFileIconIgnored,ignfile
00170 kFolderIconIgnored,foldign
00171 kFileIconRemoved,delfile
00172 */
00173
00174 enum
00175 {
00176     kFileIconText = 0,
00177     kFileIconBinary,
00178     kFileIconUnknown,
00179     kFileIconAdded,
00180     kFileIconConflict,
00181     kFileIconMiss,
00182     kFolderIcon,
00183     kFolderIconUnknown,
00184     kFolderIconMiss,
00185     kFileIconTextMod,
00186     kFileIconBinaryMod,
00187     kFileIconIgnored,
00188     kFolderIconIgnored,
00189     kFileIconRemoved
00190 };
00191
00192 #define NUM_COLUMNS 7
00193
00194 static char *_gszColumnLabel[NUM_COLUMNS] =
00195 {
00196     "Name", "Rev.", "Option", "Status", "Tag", "Date", "Conflict"
00197 };
00198
00199 static int _gnColumnWidth[NUM_COLUMNS] =
00200 {
00201     150, 50, 50, 100, 150, 150, 150
00202 };
00203
00204 CPersistentBool gFileViewIgnore("P_FileViewIgnore", true);
00205 CPersistentInt gFileViewSort("P_FileViewSort", EntnodeData::kName);
00206 CPersistentBool gFileViewSortAsc("P_FileViewSortAsc", true);
00207
00208 class TViewFill : public TraversalReport
00209 {
00210 public:
00211     UCvsFiles *m_listCtrl;
00212     CSortList<ENTNODE> & m_entries;
00213     vector<CStr> m_ignlist;
00214
00215     TViewFill(UCvsFiles *listCtrl, CSortList<ENTNODE> & entries) :
00216         m_listCtrl(listCtrl), m_entries(entries) {}
00217
00218     virtual ~TViewFill() {}
00219
00220     virtual kTraversal EnterDirectory(const char *fullpath, const char *dirname, const FSSpec * macspec)
00221     {
00222         Entries_Open (m_entries, fullpath);
00223         BuildIgnoredList(m_ignlist, fullpath);
00224
00225         return kContinueTraversal;
00226     }
00227
00228     virtual kTraversal ExitDirectory(const char *fullpath)
00229     {
00230         m_ignlist.erase(m_ignlist.begin(), m_ignlist.end());
00231         return kContinueTraversal;
00232     }
00233
00234     virtual kTraversal OnError(const char *err, int errcode)
00235     {
00236         return kTraversalError;
00237     }
00238
00239     virtual kTraversal OnIdle(const char *fullpath)
00240     {
00241         return kContinueTraversal;
00242     }
00243
00244     virtual kTraversal OnDirectory(const char *fullpath,
00245         const char *fullname,
00246         const char *name,
00247         const struct stat & dir, const FSSpec * macspec)
00248     {
00249 #if qUnix
00250         if(strcmp(name, "CVS") == 0)
00251 #else
00252         if(stricmp(name, "CVS") == 0)
00253 #endif
00254             return kSkipFile;
00255
00256         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00257         if(!(bool)gFileViewIgnore && data->IsIgnored())
00258             return kSkipFile;
00259
00260         // get the tag
00261         CStr subCVS;
00262         CStr tagName;
00263         subCVS = fullname;
00264         if(!subCVS.endsWith(kPathDelimiter))
00265             subCVS << kPathDelimiter;
00266         subCVS << "CVS";
00267         if(chdir(subCVS) == 0)
00268             Tag_Open(tagName, subCVS);
00269         if(chdir(fullpath) != 0)
00270             return kTraversalError;
00271
00272         int rownum;
00273         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_NEWROW, kUMainWidget, &rownum);
00274         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_ROWSETDATA, UMAKEINT(kUMainWidget, rownum), data);
00275         ULIST_INSERT entry;
00276         entry.row = rownum;
00277
00278         entry.col = 0;
00279         entry.title = name;
00280         entry.icon = UCvsFiles::GetImageForEntry(data);
00281         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00282
00283         entry.icon = 0L;
00284
00285         // set item text for additional columns
00286         for(int j = 1; j < NUM_COLUMNS; j++)
00287         {
00288             const char *info = (*data)[j];
00289             if(info != 0L)
00290             {
00291                 entry.col = j;
00292                 entry.title = info;
00293                 UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00294             }
00295         }
00296         entry.col = EntnodeData::kStatus;
00297         entry.title = data->GetDesc();
00298         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00299         entry.col = EntnodeFile::kTag;
00300         entry.title = tagName.empty() ? "" : (const char *)tagName;
00301         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00302
00303         return kSkipFile;
00304     }
00305
00306     virtual kTraversal OnAlias(const char *fullpath,
00307         const char *fullname,
00308         const char *name,
00309         const struct stat & dir, const FSSpec * macspec)
00310     {
00311         return OnFile(fullpath, fullname, name, dir, macspec);
00312     }
00313
00314     virtual kTraversal OnFile(const char *fullpath,
00315         const char *fullname,
00316         const char *name,
00317         const struct stat & dir, const FSSpec * macspec)
00318     {
00319         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, false, &m_ignlist);
00320         if(!(bool)gFileViewIgnore && data->IsIgnored())
00321             return kContinueTraversal;
00322
00323         int rownum;
00324         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_NEWROW, kUMainWidget, &rownum);
00325         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_ROWSETDATA, UMAKEINT(kUMainWidget, rownum), data);
00326         ULIST_INSERT entry;
00327         entry.row = rownum;
00328
00329         entry.col = 0;
00330         entry.title = name;
00331         entry.icon = UCvsFiles::GetImageForEntry(data);
00332         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00333
00334         entry.icon = 0L;
00335
00336 #if 0 /* TODO */
00337         lvi.state = data->IsLocked() ?
00338             INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1);
00339 #endif
00340
00341         // set item text for additional columns
00342         for(int j = 1; j < NUM_COLUMNS; j++)
00343         {
00344             const char *info = (*data)[j];
00345             if(info != 0L)
00346             {
00347                 entry.col = j;
00348                 entry.title = info;
00349                 UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00350             }
00351         }
00352         entry.col = EntnodeData::kStatus;
00353         entry.title = data->GetDesc();
00354         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00355
00356         return kContinueTraversal;
00357     }
00358 };
00359
00360 UCvsFiles::UCvsFiles() : UWidget(kUCvsFilesID), m_entries(200, ENTNODE::Compare), m_entriesMod(0), m_entriesLogMod(0)
00361
00362 {
00363     m_sort = (int)gFileViewSort;
00364     m_ascendant = (bool)gFileViewSortAsc;
00365 }
00366
00367 UCvsFiles::~UCvsFiles()
00368 {
00369     gFileViewSort = m_sort;
00370     gFileViewSortAsc = m_ascendant;
00371 }
00372
00373 void UCvsFiles::OnDestroy(void)
00374 {
00375     delete this;
00376 }
00377
00378 void UCvsFiles::OnCreate(void)
00379 {
00380     if(sFileIconTextIcon == 0L)
00381     {
00382         sFileIconTextIcon = UCreate_pixmap(this, "cvsfile.xpm");
00383         sFileIconBinaryIcon = UCreate_pixmap(this, "binfile.xpm");
00384         sFileIconUnknownIcon = UCreate_pixmap(this, "unkfile.xpm");
00385         sFileIconAddedIcon = UCreate_pixmap(this, "addfile.xpm");
00386         sFileIconConflictIcon = UCreate_pixmap(this, "conflict.xpm");
00387         sFileIconMissIcon = UCreate_pixmap(this, "missfile.xpm");
00388         sFolderIconIcon = UCreate_pixmap(this, "folder.xpm");
00389         sFolderIconUnknownIcon = UCreate_pixmap(this, "foldunk.xpm");
00390         sFolderIconMissIcon = UCreate_pixmap(this, "foldmiss.xpm");
00391         sFileIconTextModIcon = UCreate_pixmap(this, "modfile.xpm");
00392         sFileIconBinaryModIcon = UCreate_pixmap(this, "modbin.xpm");
00393         sFileIconIgnoredIcon = UCreate_pixmap(this, "ignfile.xpm");
00394         sFolderIconIgnoredIcon = UCreate_pixmap(this, "foldign.xpm");
00395         sFileIconRemovedIcon = UCreate_pixmap(this, "delfile.xpm");
00396     }
00397
00398     UEventSendMessage(GetWidID(), EV_LIST_SETFEEDBACK, UMAKEINT(kUMainWidget, 0), 0L);
00399     UEventSendMessage(GetWidID(), EV_LIST_ADDCOLUMNS, UMAKEINT(kUMainWidget, NUM_COLUMNS), 0L);
00400     for(int i = 0; i < NUM_COLUMNS; i++)
00401     {
00402         UEventSendMessage(GetWidID(), EV_LIST_SETCOLTITLE, UMAKEINT(kUMainWidget, i), _gszColumnLabel[i]);
00403         UEventSendMessage(GetWidID(), EV_LIST_SETCOLWIDTH, UMAKEINT(kUMainWidget, i), (void *)_gnColumnWidth[i]);
00404     }
00405     UEventSendMessage(GetWidID(), EV_LIST_SETFEEDBACK, UMAKEINT(kUMainWidget, 1), 0L);
00406 }
00407
00408 void UCvsFiles::ResetView(const char *path, bool notifyBrowser)
00409 {
00410     m_path = path;
00411     ResetView(true);
00412
00413     UStr title(UCvsApp::gApp->GetAppName());
00414     title << ": ";
00415     title << m_path;
00416     UEventSendMessage(kUCvsFrameID, EV_SETTEXT, kUMainWidget, (void *)(const char *)title);
00417
00418     if(notifyBrowser)
00419     {
00420         // notify the tree
00421         UCvsApp::gApp->GetBrowserView()->StepToLocation(path);
00422     }
00423 }
00424
00425 void UCvsFiles::GetEntriesModTime(time_t & newEntriesMod, time_t & newEntriesLogMod)
00426 {
00427     newEntriesMod = 0;
00428     newEntriesLogMod = 0;
00429     if(chdir(m_path) != 0)
00430         return;
00431     if(chdir("CVS") != 0)
00432         return;
00433
00434     struct stat sb;
00435     if (stat("Entries", &sb) != -1)
00436         newEntriesMod = sb.st_mtime;
00437     if (stat("Entries.log", &sb) != -1)
00438         newEntriesLogMod = sb.st_mtime;
00439     chdir(m_path);
00440 }
00441
00442 int UCvsFiles::Search(const char *title)
00443 {
00444     int row = -1;
00445     while((row = UEventSendMessage(GetWidID(), EV_LIST_GETNEXT,
00446                                      UMAKEINT(kUMainWidget, row), 0L)) != -1)
00447     {
00448         ULIST_INFO info;
00449         info.col = 0;
00450         info.row = row;
00451         UEventSendMessage(GetWidID(), EV_LIST_GETINFO, kUMainWidget, &info);
00452         if(info.title == 0L)
00453             continue;
00454
00455 #if qUnix
00456         if(strcmp(title, info.title) == 0)
00457 #else
00458         if(stricmp(title, info.title) == 0)
00459 #endif
00460             return row;
00461     }
00462
00463     return -1;
00464 }
00465
00466 void UCvsFiles::ResetView(bool forceReload, bool notifyBrowser)
00467 {
00468     UWaitCursor wait;
00469
00470     static bool sSemaphore = false;
00471     USemaphore policeman(sSemaphore);
00472     if(policeman.IsEnteredTwice())
00473         return;
00474
00475     // - check if we really need to reload (forceReload == false)
00476     // - wait a bit for the watcher in order to let him tell us
00477     // if something was modified.
00478     time_t newEntriesMod;
00479     time_t newEntriesLogMod;
00480     GetEntriesModTime(newEntriesMod, newEntriesLogMod);
00481     if(!forceReload)
00482     {
00483         if(m_entriesMod == newEntriesMod && m_entriesLogMod == newEntriesLogMod)
00484             return;
00485     }
00486
00487     // reset all the watchers
00488     m_entriesMod = newEntriesMod;
00489     m_entriesLogMod = newEntriesLogMod;
00490
00491     // get the selection to later try to restore it
00492     CvsArgs selection(false);
00493     int nItem = -1;
00494
00495     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL,
00496                                      UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00497     {
00498         EntnodeData *data;
00499         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00500         selection.add((*data)[EntnodeData::kName]);
00501     }
00502
00503     UEventSendMessage(GetWidID(), EV_LIST_RESETALL, kUMainWidget, 0L);
00504
00505     // refetch all items
00506     TViewFill traverse(this, m_entries);
00507     /*kTraversal res = */FileTraverse(m_path, traverse);
00508
00509     // add the missing files
00510     Entries_SetMissing(m_entries);
00511
00512     int numEntries = m_entries.NumOfElements();
00513     for(int i = 0; i < numEntries; i++)
00514     {
00515         const ENTNODE & theNode = m_entries.Get(i);
00516         EntnodeData *data = ((ENTNODE *)&theNode)->Data();
00517         if(!data->IsMissing())
00518             continue;
00519
00520         int rownum;
00521         UEventSendMessage(GetWidID(), EV_LIST_NEWROW, kUMainWidget, &rownum);
00522         UEventSendMessage(GetWidID(), EV_LIST_ROWSETDATA, UMAKEINT(kUMainWidget, rownum), data);
00523         ULIST_INSERT entry;
00524         entry.row = rownum;
00525
00526         entry.col = 0;
00527         entry.title = (*data)[EntnodeData::kName];
00528         entry.icon = UCvsFiles::GetImageForEntry(data);
00529         UEventSendMessage(GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00530
00531         entry.icon = 0L;
00532
00533         // set item text for additional columns
00534         for(int j = 1; j < NUM_COLUMNS; j++)
00535         {
00536             const char *info = (*data)[j];
00537             if(info != 0L)
00538             {
00539                 entry.col = j;
00540                 entry.title = info;
00541                 UEventSendMessage(GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00542             }
00543         }
00544         entry.col = EntnodeData::kStatus;
00545         entry.title = data->GetDesc();
00546         UEventSendMessage(GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00547     }
00548
00549     Resort();
00550
00551     // now restore the selection
00552     int argc = selection.Argc(), c;
00553     char * const *argv = selection.Argv();
00554     for(c = 0; c < argc; c++)
00555     {
00556         int row = Search(argv[c]);
00557         if(row != -1)
00558             UEventSendMessage(GetWidID(), EV_LIST_ADDSEL, UMAKEINT(kUMainWidget, row), 0L);
00559     }
00560
00561     if(notifyBrowser)
00562     {
00563         // notify the tree
00564         UCvsApp::gApp->GetBrowserView()->ResetView(forceReload);
00565     }
00566 }
00567
00568 void *UCvsFiles::GetImageForEntry(EntnodeData *data)
00569 {
00570     int result;
00571     void *resIcon = 0L;
00572
00573     if(data->GetType() == ENT_FILE)
00574     {
00575         const char *info = 0L;
00576         if(data->IsIgnored())
00577         {
00578             result = kFileIconIgnored;
00579         }
00580         else if(data->IsUnknown())
00581         {
00582             result = kFileIconUnknown;
00583         }
00584         else if(data->IsMissing())
00585         {
00586             result = data->IsRemoved() ? kFileIconRemoved : kFileIconMiss;
00587         }
00588         else if((*data)[EntnodeFile::kConflict] != 0L)
00589         {
00590             result = kFileIconConflict;
00591         }
00592         else if(data->IsRemoved())
00593         {
00594             result = kFileIconRemoved;
00595         }
00596         else if((info = (*data)[EntnodeFile::kOption]) != 0L && strcmp(info, "-kb") == 0)
00597         {
00598             result = data->IsUnmodified() ? kFileIconBinary : kFileIconBinaryMod;
00599         }
00600         else
00601         {
00602             result = data->IsUnmodified() ? kFileIconText : kFileIconTextMod;
00603         }
00604     }
00605     else
00606     {
00607         if(data->IsIgnored())
00608         {
00609             result = kFolderIconIgnored;
00610         }
00611         else if(data->IsUnknown())
00612         {
00613             result = kFolderIconUnknown;
00614         }
00615         else if(data->IsMissing())
00616         {
00617             result = kFolderIconMiss;
00618         }
00619         else
00620         {
00621             result = kFolderIcon;
00622         }
00623     }
00624
00625 #if qGTK
00626     void *pixmap = 0L;
00627     switch(result)
00628     {
00629     case kFileIconText:
00630         pixmap = sFileIconTextIcon;
00631         break;
00632     case kFileIconBinary:
00633         pixmap = sFileIconBinaryIcon;
00634         break;
00635     case kFileIconUnknown:
00636         pixmap = sFileIconUnknownIcon;
00637         break;
00638     case kFileIconAdded:
00639         pixmap = sFileIconAddedIcon;
00640         break;
00641     case kFileIconConflict:
00642         pixmap = sFileIconConflictIcon;
00643         break;
00644     case kFileIconMiss:
00645         pixmap = sFileIconMissIcon;
00646         break;
00647     case kFolderIcon:
00648         pixmap = sFolderIconIcon;
00649         break;
00650     case kFolderIconUnknown:
00651         pixmap = sFolderIconUnknownIcon;
00652         break;
00653     case kFolderIconMiss:
00654         pixmap = sFolderIconMissIcon;
00655         break;
00656     case kFileIconTextMod:
00657         pixmap = sFileIconTextModIcon;
00658         break;
00659     case kFileIconBinaryMod:
00660         pixmap = sFileIconBinaryModIcon;
00661         break;
00662     case kFileIconIgnored:
00663         pixmap = sFileIconIgnoredIcon;
00664         break;
00665     case kFolderIconIgnored:
00666         pixmap = sFolderIconIgnoredIcon;
00667         break;
00668     case kFileIconRemoved:
00669         pixmap = sFileIconRemovedIcon;
00670         break;
00671     }
00672     if(pixmap != 0L)
00673     {
00674         resIcon = gtk_pixmap_new (GTK_PIXMAP(pixmap)->pixmap, GTK_PIXMAP(pixmap)->mask);
00675     }
00676 #endif
00677
00678     return resIcon;
00679 }
00680
00681
00682 int UCvsFiles::OnCmdUpdate(void)
00683 {
00684     int nItem = -1;
00685
00686     MultiFiles mf;
00687     mf.newdir(m_path);
00688
00689     // first add the folders
00690     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00691     {
00692         EntnodeData *data;
00693         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00694
00695         if(data->GetType() == ENT_SUBDIR)
00696         {
00697             CStr fullpath;
00698             fullpath = m_path;
00699             if(!fullpath.endsWith(kPathDelimiter))
00700                 fullpath << kPathDelimiter;
00701             fullpath << (*data)[EntnodeData::kName];
00702             CvsCmdUpdateFolder(fullpath);
00703         }
00704         else
00705         {
00706             mf.newfile((*data)[EntnodeData::kName]);
00707         }
00708     }
00709     if(mf.NumFiles() != 0)
00710     {
00711         CvsCmdUpdateFiles(&mf);
00712     }
00713     return 0;
00714 }
00715
00716 bool UCvsFiles::DisableGeneric()
00717 {
00718     return UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, -1), 0L) == -1 ||
00719         UCvsApp::gApp->IsCvsRunning() || gCvsPrefs.empty() || !HasFocus();
00720 }
00721
00722 void UCvsFiles::OnCmdUIUpdate(UCmdUI *pCmdUI)
00723 {
00724     if(DisableGeneric())
00725     {
00726         pCmdUI->Enable(false);
00727         return;
00728     }
00729
00730     int nItem = -1;
00731     bool res = true;
00732     int numFiles = 0;
00733     int numFolders = 0;
00734
00735     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00736     {
00737         EntnodeData *data;
00738         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00739
00740         if(data->IsUnknown())
00741         {
00742             res = false;
00743             break;
00744         }
00745         if(data->GetType() == ENT_FILE)
00746             numFiles++;
00747         else
00748             numFolders++;
00749
00750         if((numFiles != 0 && numFolders != 0) || numFolders > 1)
00751         {
00752             res = false;
00753             break;
00754         }
00755     }
00756
00757     pCmdUI->Enable(res);
00758 }
00759
00760 void UCvsFiles::OnCmdUIAdd(UCmdUI *pCmdUI)
00761 {
00762     if(DisableGeneric())
00763     {
00764         pCmdUI->Enable(false);
00765         return;
00766     }
00767
00768     int nItem = -1;
00769     bool res = true;
00770     int numFiles = 0;
00771     int numFolders = 0;
00772
00773     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00774     {
00775         EntnodeData *data;
00776         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00777
00778         if(!(data->IsUnknown() || (data->IsRemoved() && data->IsMissing())))
00779         {
00780             res = false;
00781             break;
00782         }
00783         if(data->GetType() == ENT_FILE)
00784         {
00785             numFiles++;
00786         }
00787         else
00788             numFolders++;
00789
00790         if((numFiles != 0 && numFolders != 0) || numFolders > 1)
00791         {
00792             res = false;
00793             break;
00794         }
00795     }
00796
00797     pCmdUI->Enable(res);
00798 }
00799
00800 void UCvsFiles::OnCmdUIAddB(UCmdUI *pCmdUI)
00801 {
00802     if(DisableGeneric())
00803     {
00804         pCmdUI->Enable(false);
00805         return;
00806     }
00807
00808     int nItem = -1;
00809     bool res = true;
00810
00811     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00812     {
00813         EntnodeData *data;
00814         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00815
00816         if(data->GetType() != ENT_FILE)
00817         {
00818             res = false;
00819             break;
00820         }
00821         if(!(data->IsUnknown() || (data->IsRemoved() && data->IsMissing())))
00822         {
00823             res = false;
00824             break;
00825         }
00826     }
00827
00828     pCmdUI->Enable(res);
00829 }
00830
00831 void UCvsFiles::OnCmdUIRelease(UCmdUI *pCmdUI)
00832 {
00833     if(DisableGeneric())
00834     {
00835         pCmdUI->Enable(false);
00836         return;
00837     }
00838
00839     int nItem = -1;
00840     bool res = true;
00841     int numFolders = 0;
00842
00843     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00844     {
00845         EntnodeData *data;
00846         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00847
00848         if(data->IsUnknown() || data->GetType() != ENT_SUBDIR)
00849         {
00850             res = false;
00851             break;
00852         }
00853         numFolders++;
00854
00855         if(numFolders > 1)
00856         {
00857             res = false;
00858             break;
00859         }
00860     }
00861
00862     pCmdUI->Enable(res);
00863 }
00864
00865 void UCvsFiles::OnCmdUIRmv(UCmdUI *pCmdUI)
00866 {
00867     if(DisableGeneric())
00868     {
00869         pCmdUI->Enable(false);
00870         return;
00871     }
00872
00873     int nItem = -1;
00874     bool res = true;
00875
00876     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00877     {
00878         EntnodeData *data;
00879         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00880
00881         if(data->IsUnknown() || data->IsRemoved() || data->GetType() == ENT_SUBDIR)
00882         {
00883             res = false;
00884             break;
00885         }
00886     }
00887
00888     pCmdUI->Enable(res);
00889 }
00890
00891 void UCvsFiles::OnCmdUIGraph(UCmdUI *pCmdUI)
00892 {
00893     if(DisableGeneric())
00894     {
00895         pCmdUI->Enable(false);
00896         return;
00897     }
00898
00899     int nItem = -1;
00900     bool res = true;
00901
00902     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00903     {
00904         EntnodeData *data;
00905         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00906
00907         if(data->IsUnknown() || data->GetType() == ENT_SUBDIR)
00908         {
00909             res = false;
00910             break;
00911         }
00912     }
00913
00914     pCmdUI->Enable(res);
00915 }
00916
00917 void UCvsFiles::OnCmdUIEditseldef(UCmdUI *pCmdUI)
00918 {
00919     if(DisableGeneric())
00920     {
00921         pCmdUI->Enable(false);
00922         return;
00923     }
00924
00925     int nItem = -1;
00926     bool res = true;
00927
00928     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00929     {
00930         EntnodeData *data;
00931         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00932
00933         if(data->GetType() == ENT_SUBDIR || data->IsMissing())
00934         {
00935             res = false;
00936             break;
00937         }
00938     }
00939
00940     pCmdUI->Enable(res);
00941     if(gCvsPrefs.Viewer() != 0L)
00942     {
00943         CStr title("Edit with ");
00944         title << gCvsPrefs.Viewer();
00945         pCmdUI->SetText(title);
00946     }
00947 }
00948
00949 void UCvsFiles::OnCmdUIReload(UCmdUI *pCmdUI)
00950 {
00951     pCmdUI->Enable(!DisableGeneric());
00952 }
00953
00954 void UCvsFiles::OnCmdUIUpone(UCmdUI *pCmdUI)
00955 {
00956     pCmdUI->Enable(!DisableGeneric());
00957 }
00958
00959 void UCvsFiles::OnCmdUITrash(UCmdUI *pCmdUI)
00960 {
00961     if(DisableGeneric())
00962     {
00963         pCmdUI->Enable(false);
00964         return;
00965     }
00966
00967     int nItem = -1;
00968     bool res = true;
00969
00970     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00971     {
00972         EntnodeData *data;
00973         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00974         if(data->GetType() == ENT_SUBDIR || data->IsMissing())
00975         {
00976             res = false;
00977             break;
00978         }
00979     }
00980
00981     pCmdUI->Enable(res);
00982 }
00983
00984 void UCvsFiles::OnCmdUIExplore(UCmdUI *pCmdUI)
00985 {
00986     if(DisableGeneric())
00987     {
00988         pCmdUI->Enable(false);
00989         return;
00990     }
00991
00992     int nItem = -1;
00993     bool res = true;
00994     int numItem = 0;
00995
00996     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00997     {
00998         EntnodeData *data;
00999         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01000
01001         if(data->IsMissing() || ++numItem > 1)
01002         {
01003             res = false;
01004             break;
01005         }
01006     }
01007
01008     pCmdUI->Enable(res);
01009 }
01010
01011 void UCvsFiles::OnCmdUIIgnore(UCmdUI *pCmdUI)
01012 {
01013     pCmdUI->Enable(!DisableGeneric());
01014     pCmdUI->Check(gFileViewIgnore);
01015 }
01016
01017 void UCvsFiles::OnCmdUIMacroSel(int cmd, UCmdUI *pCmdUI)
01018 {
01019     if(DisableGeneric())
01020     {
01021         pCmdUI->Enable(false);
01022         return;
01023     }
01024
01025     int nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, -1), 0L);
01026     pCmdUI->Enable(nItem != -1 && CTcl_Interp::IsAvail());
01027 }
01028
01029 int UCvsFiles::OnCmdAdd(void)
01030 {
01031     int nItem = -1;
01032
01033     MultiFiles mf;
01034     mf.newdir(m_path);
01035
01036     // first add the folders
01037     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01038     {
01039         EntnodeData *data;
01040         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01041
01042         if(data->GetType() == ENT_SUBDIR)
01043         {
01044             CStr fullpath;
01045             fullpath = m_path;
01046             if(!fullpath.endsWith(kPathDelimiter))
01047                 fullpath << kPathDelimiter;
01048             fullpath << (*data)[EntnodeData::kName];
01049             CvsCmdAddFolder(fullpath);
01050         }
01051         else
01052         {
01053             mf.newfile((*data)[EntnodeData::kName]);
01054         }
01055     }
01056     if(mf.NumFiles() != 0)
01057     {
01058         CvsCmdAddFiles(&mf);
01059     }
01060     return 0;
01061 }
01062
01063 int UCvsFiles::OnCmdAddb(void)
01064 {
01065     int nItem = -1;
01066
01067     MultiFiles mf;
01068     mf.newdir(m_path);
01069
01070     // first add the folders
01071     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01072     {
01073         EntnodeData *data;
01074         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01075
01076         if(data->GetType() == ENT_SUBDIR)
01077         {
01078             CStr fullpath;
01079             fullpath = m_path;
01080             if(!fullpath.endsWith(kPathDelimiter))
01081                 fullpath << kPathDelimiter;
01082             fullpath << (*data)[EntnodeData::kName];
01083             CvsCmdAddFolder(fullpath);
01084         }
01085         else
01086         {
01087             mf.newfile((*data)[EntnodeData::kName]);
01088         }
01089     }
01090     if(mf.NumFiles() != 0)
01091     {
01092         CvsCmdAddBinaryFiles(&mf);
01093     }
01094     return 0;
01095 }
01096
01097 int UCvsFiles::OnCmdCommit(void)
01098 {
01099     int nItem = -1;
01100
01101     MultiFiles mf;
01102     mf.newdir(m_path);
01103
01104     // first add the folders
01105     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01106     {
01107         EntnodeData *data;
01108         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01109
01110         if(data->GetType() == ENT_SUBDIR)
01111         {
01112             CStr fullpath;
01113             fullpath = m_path;
01114             if(!fullpath.endsWith(kPathDelimiter))
01115                 fullpath << kPathDelimiter;
01116             fullpath << (*data)[EntnodeData::kName];
01117             CvsCmdCommitFolder(fullpath);
01118         }
01119         else
01120         {
01121             mf.newfile((*data)[EntnodeData::kName]);
01122         }
01123     }
01124     if(mf.NumFiles() != 0)
01125     {
01126         CvsCmdCommitFiles(&mf);
01127     }
01128     return 0;
01129 }
01130
01131 int UCvsFiles::OnCmdRmv(void)
01132 {
01133     int nItem = -1;
01134
01135     MultiFiles mf;
01136     mf.newdir(m_path);
01137
01138     // first add the folders
01139     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01140     {
01141         EntnodeData *data;
01142         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01143
01144         if(data->GetType() != ENT_FILE)
01145             continue;
01146
01147         mf.newfile((*data)[EntnodeData::kName]);
01148     }
01149     if(mf.NumFiles() != 0)
01150     {
01151         CvsCmdRemoveFiles(&mf);
01152     }
01153     return 0;
01154 }
01155
01156 int UCvsFiles::OnCmdQueryUpdate(void)
01157 {
01158     int nItem = -1;
01159
01160     MultiFiles mf;
01161     mf.newdir(m_path);
01162
01163     // first add the folders
01164     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01165     {
01166         EntnodeData *data;
01167         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01168
01169         if(data->GetType() == ENT_SUBDIR)
01170         {
01171             CStr fullpath;
01172             fullpath = m_path;
01173             if(!fullpath.endsWith(kPathDelimiter))
01174                 fullpath << kPathDelimiter;
01175             fullpath << (*data)[EntnodeData::kName];
01176             CvsCmdUpdateFolder(fullpath, true);
01177         }
01178         else
01179         {
01180             mf.newfile((*data)[EntnodeData::kName]);
01181         }
01182     }
01183     if(mf.NumFiles() != 0)
01184     {
01185         CvsCmdUpdateFiles(&mf, true);
01186     }
01187     return 0;
01188 }
01189
01190 int UCvsFiles::OnCmdReload(void)
01191 {
01192     ResetView(true, true);
01193     return 0;
01194 }
01195
01196 int UCvsFiles::OnCmdUpone(void)
01197 {
01198     UStr uppath, filename;
01199     SplitPath(m_path, uppath, filename);
01200     ResetView(uppath, true);
01201     return 0;
01202 }
01203
01204 int UCvsFiles::OnCmdTrash(void)
01205 {
01206     int nItem = -1;
01207
01208     MultiFiles mf;
01209     mf.newdir(m_path);
01210
01211     // first add the folders
01212     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01213     {
01214         EntnodeData *data;
01215         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01216
01217         if(data->GetType() != ENT_FILE)
01218             continue;
01219
01220         mf.newfile((*data)[EntnodeData::kName]);
01221     }
01222
01223     if(mf.NumFiles() != 0)
01224     {
01225         CvsArgs args(false);
01226         mf.next();
01227         const char *dir = mf.add(args);
01228         char * const *argv = args.Argv();
01229         int argc = args.Argc();
01230         for(int i = 0; i < argc; i++)
01231         {
01232             CStr fullpath(dir);
01233             if(!fullpath.empty() && !fullpath.endsWith(kPathDelimiter))
01234             {
01235                 fullpath << kPathDelimiter;
01236             }
01237             fullpath << argv[i];
01238
01239             if(chmod(fullpath, 0666) != 0)
01240             {
01241                 cvs_err("Unable to change permission on '%s' (error %d)\n", (const char *)fullpath, errno);
01242                 continue;
01243             }
01244
01245             if(!CompatMoveToTrash(argv[i], dir))
01246                 cvs_err("Unable to remove '%s' (error %d)\n", (const char *)fullpath, errno);
01247             else
01248 #ifdef WIN32
01249                 cvs_out("'%s' has been moved successfully to the recycle bin...\n", (const char *)fullpath);
01250 #else
01251                 cvs_out("'%s' has been deleted successfully...\n", (const char *)fullpath);
01252 #endif
01253             }
01254
01255         ResetView(true);
01256     }
01257     return 0;
01258 }
01259
01260 int UCvsFiles::OnCmdDiff(void)
01261 {
01262     int nItem = -1;
01263
01264     MultiFiles mf;
01265     mf.newdir(m_path);
01266
01267     // first add the folders
01268     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01269     {
01270         EntnodeData *data;
01271         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01272
01273         if(data->GetType() == ENT_SUBDIR)
01274         {
01275             CStr fullpath;
01276             fullpath = m_path;
01277             if(!fullpath.endsWith(kPathDelimiter))
01278                 fullpath << kPathDelimiter;
01279             fullpath << (*data)[EntnodeData::kName];
01280             CvsCmdDiffFolder(fullpath);
01281         }
01282         else
01283         {
01284             mf.newfile((*data)[EntnodeData::kName]);
01285         }
01286     }
01287     if(mf.NumFiles() != 0)
01288     {
01289         CvsCmdDiffFiles(&mf);
01290     }
01291     return 0;
01292 }
01293
01294 int UCvsFiles::OnCmdLog(void)
01295 {
01296     int nItem = -1;
01297
01298     MultiFiles mf;
01299     mf.newdir(m_path);
01300
01301     // first add the folders
01302     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01303     {
01304         EntnodeData *data;
01305         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01306
01307         if(data->GetType() == ENT_SUBDIR)
01308         {
01309             CStr fullpath;
01310             fullpath = m_path;
01311             if(!fullpath.endsWith(kPathDelimiter))
01312                 fullpath << kPathDelimiter;
01313             fullpath << (*data)[EntnodeData::kName];
01314             CvsCmdLogFolder(fullpath);
01315         }
01316         else
01317         {
01318             mf.newfile((*data)[EntnodeData::kName]);
01319         }
01320     }
01321     if(mf.NumFiles() != 0)
01322     {
01323         CvsCmdLogFiles(&mf);
01324     }
01325     return 0;
01326 }
01327
01328 int UCvsFiles::OnCmdGraph(void)
01329 {
01330     int nItem = -1;
01331
01332     MultiFiles mf;
01333     mf.newdir(m_path);
01334
01335     // first add the folders
01336     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01337     {
01338         EntnodeData *data;
01339         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01340
01341         if(data->GetType() != ENT_FILE)
01342             continue;
01343
01344         mf.newfile((*data)[EntnodeData::kName]);
01345     }
01346     if(mf.NumFiles() != 0)
01347     {
01348         CvsCmdLogFiles(&mf, true);
01349     }
01350     return 0;
01351 }
01352
01353 int UCvsFiles::OnCmdStatus(void)
01354 {
01355     int nItem = -1;
01356
01357     MultiFiles mf;
01358     mf.newdir(m_path);
01359
01360     // first add the folders
01361     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01362     {
01363         EntnodeData *data;
01364         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01365
01366         if(data->GetType() == ENT_SUBDIR)
01367         {
01368             CStr fullpath;
01369             fullpath = m_path;
01370             if(!fullpath.endsWith(kPathDelimiter))
01371                 fullpath << kPathDelimiter;
01372             fullpath << (*data)[EntnodeData::kName];
01373             CvsCmdStatusFolder(fullpath);
01374         }
01375         else
01376         {
01377             mf.newfile((*data)[EntnodeData::kName]);
01378         }
01379     }
01380     if(mf.NumFiles() != 0)
01381     {
01382         CvsCmdStatusFiles(&mf);
01383     }
01384     return 0;
01385 }
01386
01387 int UCvsFiles::OnCmdLock(void)
01388 {
01389     int nItem = -1;
01390
01391     MultiFiles mf;
01392     mf.newdir(m_path);
01393
01394     // first add the folders
01395     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01396     {
01397         EntnodeData *data;
01398         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01399
01400         if(data->GetType() == ENT_SUBDIR)
01401         {
01402             CStr fullpath;
01403             fullpath = m_path;
01404             if(!fullpath.endsWith(kPathDelimiter))
01405                 fullpath << kPathDelimiter;
01406             fullpath << (*data)[EntnodeData::kName];
01407             CvsCmdLockFolder(fullpath);
01408         }
01409         else
01410         {
01411             mf.newfile((*data)[EntnodeData::kName]);
01412         }
01413     }
01414     if(mf.NumFiles() != 0)
01415     {
01416         CvsCmdLockFiles(&mf);
01417     }
01418     return 0;
01419 }
01420
01421 int UCvsFiles::OnCmdUnlock(void)
01422 {
01423     int nItem = -1;
01424
01425     MultiFiles mf;
01426     mf.newdir(m_path);
01427
01428     // first add the folders
01429     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01430     {
01431         EntnodeData *data;
01432         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01433
01434         if(data->GetType() == ENT_SUBDIR)
01435         {
01436             CStr fullpath;
01437             fullpath = m_path;
01438             if(!fullpath.endsWith(kPathDelimiter))
01439                 fullpath << kPathDelimiter;
01440             fullpath << (*data)[EntnodeData::kName];
01441             CvsCmdUnlockFolder(fullpath);
01442         }
01443         else
01444         {
01445             mf.newfile((*data)[EntnodeData::kName]);
01446         }
01447     }
01448     if(mf.NumFiles() != 0)
01449     {
01450         CvsCmdUnlockFiles(&mf);
01451     }
01452     return 0;
01453 }
01454
01455 int UCvsFiles::OnCmdWatchOn(void)
01456 {
01457     int nItem = -1;
01458
01459     MultiFiles mf;
01460     mf.newdir(m_path);
01461
01462     // first add the folders
01463     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01464     {
01465         EntnodeData *data;
01466         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01467
01468         if(data->GetType() == ENT_SUBDIR)
01469         {
01470             CStr fullpath;
01471             fullpath = m_path;
01472             if(!fullpath.endsWith(kPathDelimiter))
01473                 fullpath << kPathDelimiter;
01474             fullpath << (*data)[EntnodeData::kName];
01475             CvsCmdWatchOnFolder(fullpath);
01476         }
01477         else
01478         {
01479             mf.newfile((*data)[EntnodeData::kName]);
01480         }
01481     }
01482     if(mf.NumFiles() != 0)
01483     {
01484         CvsCmdWatchOnFiles(&mf);
01485     }
01486     return 0;
01487 }
01488
01489 int UCvsFiles::OnCmdWatchOff(void)
01490 {
01491     int nItem = -1;
01492
01493     MultiFiles mf;
01494     mf.newdir(m_path);
01495
01496     // first add the folders
01497     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01498     {
01499         EntnodeData *data;
01500         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01501
01502         if(data->GetType() == ENT_SUBDIR)
01503         {
01504             CStr fullpath;
01505             fullpath = m_path;
01506             if(!fullpath.endsWith(kPathDelimiter))
01507                 fullpath << kPathDelimiter;
01508             fullpath << (*data)[EntnodeData::kName];
01509             CvsCmdWatchOffFolder(fullpath);
01510         }
01511         else
01512         {
01513             mf.newfile((*data)[EntnodeData::kName]);
01514         }
01515     }
01516     if(mf.NumFiles() != 0)
01517     {
01518         CvsCmdWatchOffFiles(&mf);
01519     }
01520     return 0;
01521 }
01522
01523 int UCvsFiles::OnCmdEdit(void)
01524 {
01525     int nItem = -1;
01526
01527     MultiFiles mf;
01528     mf.newdir(m_path);
01529
01530     // first add the folders
01531     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01532     {
01533         EntnodeData *data;
01534         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01535
01536         if(data->GetType() == ENT_SUBDIR)
01537         {
01538             CStr fullpath;
01539             fullpath = m_path;
01540             if(!fullpath.endsWith(kPathDelimiter))
01541                 fullpath << kPathDelimiter;
01542             fullpath << (*data)[EntnodeData::kName];
01543             CvsCmdEditFolder(fullpath);
01544         }
01545         else
01546         {
01547             mf.newfile((*data)[EntnodeData::kName]);
01548         }
01549     }
01550     if(mf.NumFiles() != 0)
01551     {
01552         CvsCmdEditFiles(&mf);
01553     }
01554     return 0;
01555 }
01556
01557 int UCvsFiles::OnCmdUnedit(void)
01558 {
01559     int nItem = -1;
01560
01561     MultiFiles mf;
01562     mf.newdir(m_path);
01563
01564     // first add the folders
01565     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01566     {
01567         EntnodeData *data;
01568         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01569
01570         if(data->GetType() == ENT_SUBDIR)
01571         {
01572             CStr fullpath;
01573             fullpath = m_path;
01574             if(!fullpath.endsWith(kPathDelimiter))
01575                 fullpath << kPathDelimiter;
01576             fullpath << (*data)[EntnodeData::kName];
01577             CvsCmdUneditFolder(fullpath);
01578         }
01579         else
01580         {
01581             mf.newfile((*data)[EntnodeData::kName]);
01582         }
01583     }
01584     if(mf.NumFiles() != 0)
01585     {
01586         CvsCmdUneditFiles(&mf);
01587     }
01588     return 0;
01589 }
01590
01591 int UCvsFiles::OnCmdWatchers(void)
01592 {
01593     int nItem = -1;
01594
01595     MultiFiles mf;
01596     mf.newdir(m_path);
01597
01598     // first add the folders
01599     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01600     {
01601         EntnodeData *data;
01602         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01603
01604         if(data->GetType() == ENT_SUBDIR)
01605         {
01606             CStr fullpath;
01607             fullpath = m_path;
01608             if(!fullpath.endsWith(kPathDelimiter))
01609                 fullpath << kPathDelimiter;
01610             fullpath << (*data)[EntnodeData::kName];
01611             CvsCmdWatchersFolder(fullpath);
01612         }
01613         else
01614         {
01615             mf.newfile((*data)[EntnodeData::kName]);
01616         }
01617     }
01618     if(mf.NumFiles() != 0)
01619     {
01620         CvsCmdWatchersFiles(&mf);
01621     }
01622     return 0;
01623 }
01624
01625 int UCvsFiles::OnCmdEditors(void)
01626 {
01627     int nItem = -1;
01628
01629     MultiFiles mf;
01630     mf.newdir(m_path);
01631
01632     // first add the folders
01633     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01634     {
01635         EntnodeData *data;
01636         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01637
01638         if(data->GetType() == ENT_SUBDIR)
01639         {
01640             CStr fullpath;
01641             fullpath = m_path;
01642             if(!fullpath.endsWith(kPathDelimiter))
01643                 fullpath << kPathDelimiter;
01644             fullpath << (*data)[EntnodeData::kName];
01645             CvsCmdEditorsFolder(fullpath);
01646         }
01647         else
01648         {
01649             mf.newfile((*data)[EntnodeData::kName]);
01650         }
01651     }
01652     if(mf.NumFiles() != 0)
01653     {
01654         CvsCmdEditorsFiles(&mf);
01655     }
01656     return 0;
01657 }
01658
01659 int UCvsFiles::OnCmdRelease(void)
01660 {
01661     int nItem = -1;
01662
01663     // first add the folders
01664     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01665     {
01666         EntnodeData *data;
01667         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01668
01669         if(data->GetType() == ENT_SUBDIR)
01670         {
01671             CStr fullpath;
01672             fullpath = m_path;
01673             if(!fullpath.endsWith(kPathDelimiter))
01674                 fullpath << kPathDelimiter;
01675             fullpath << (*data)[EntnodeData::kName];
01676             CvsCmdReleaseFolder(fullpath);
01677         }
01678     }
01679     return 0;
01680 }
01681
01682 int UCvsFiles::OnCmdTagNew(void)
01683 {
01684     int nItem = -1;
01685
01686     MultiFiles mf;
01687     mf.newdir(m_path);
01688
01689     // first add the folders
01690     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01691     {
01692         EntnodeData *data;
01693         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01694
01695         if(data->GetType() == ENT_SUBDIR)
01696         {
01697             CStr fullpath;
01698             fullpath = m_path;
01699             if(!fullpath.endsWith(kPathDelimiter))
01700                 fullpath << kPathDelimiter;
01701             fullpath << (*data)[EntnodeData::kName];
01702             CvsCmdTagCreateFolder(fullpath);
01703         }
01704         else
01705         {
01706             mf.newfile((*data)[EntnodeData::kName]);
01707         }
01708     }
01709     if(mf.NumFiles() != 0)
01710     {
01711         CvsCmdTagCreateFiles(&mf);
01712     }
01713     return 0;
01714 }
01715
01716 int UCvsFiles::OnCmdTagDelete(void)
01717 {
01718     int nItem = -1;
01719
01720     MultiFiles mf;
01721     mf.newdir(m_path);
01722
01723     // first add the folders
01724     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01725     {
01726         EntnodeData *data;
01727         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01728
01729         if(data->GetType() == ENT_SUBDIR)
01730         {
01731             CStr fullpath;
01732             fullpath = m_path;
01733             if(!fullpath.endsWith(kPathDelimiter))
01734                 fullpath << kPathDelimiter;
01735             fullpath << (*data)[EntnodeData::kName];
01736             CvsCmdTagDeleteFolder(fullpath);
01737         }
01738         else
01739         {
01740             mf.newfile((*data)[EntnodeData::kName]);
01741         }
01742     }
01743     if(mf.NumFiles() != 0)
01744     {
01745         CvsCmdTagDeleteFiles(&mf);
01746     }
01747     return 0;
01748 }
01749
01750 int UCvsFiles::OnCmdTagBranch(void)
01751 {
01752     int nItem = -1;
01753
01754     MultiFiles mf;
01755     mf.newdir(m_path);
01756
01757     // first add the folders
01758     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01759     {
01760         EntnodeData *data;
01761         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01762
01763         if(data->GetType() == ENT_SUBDIR)
01764         {
01765             CStr fullpath;
01766             fullpath = m_path;
01767             if(!fullpath.endsWith(kPathDelimiter))
01768                 fullpath << kPathDelimiter;
01769             fullpath << (*data)[EntnodeData::kName];
01770             CvsCmdTagBranchFolder(fullpath);
01771         }
01772         else
01773         {
01774             mf.newfile((*data)[EntnodeData::kName]);
01775         }
01776     }
01777     if(mf.NumFiles() != 0)
01778     {
01779         CvsCmdTagBranchFiles(&mf);
01780     }
01781     return 0;
01782 }
01783
01784 int UCvsFiles::OnCmdExplore(void)
01785 {
01786     int nItem = -1;
01787
01788     // first add the folders
01789     if((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01790     {
01791         EntnodeData *data;
01792         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01793
01794         CStr fullpath;
01795         fullpath = m_path;
01796         if(!fullpath.endsWith(kPathDelimiter))
01797             fullpath << kPathDelimiter;
01798         fullpath << (*data)[EntnodeData::kName];
01799
01800 #ifdef WIN32
01801         HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), "explore", fullpath,
01802                                        0L, 0L, SW_SHOWDEFAULT);
01803         if((long)hInst < 32)
01804         {
01805             cvs_err("Unable to explore '%s' (error %d)\n", (char *)m_path, GetLastError());
01806         }
01807 #endif
01808 #ifdef qUnix
01809         CvsArgs args(false);
01810         args.add(gCvsPrefs.Browser());
01811         args.add(fullpath);
01812         UCvsApp::gApp->Execute(args.Argc(), args.Argv());
01813 #endif
01814     }
01815     return 0;
01816 }
01817
01818 int UCvsFiles::OnCmdIgnore(void)
01819 {
01820     gFileViewIgnore = !(bool)gFileViewIgnore;
01821     ResetView(true, true);
01822     return 0;
01823 }
01824
01825 int UCvsFiles::OnCmdEditsel(void)
01826 {
01827     int nItem = -1;
01828
01829     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01830     {
01831         EntnodeData *data;
01832         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01833         EditSel(data);
01834     }
01835     return 0;
01836 }
01837
01838 int UCvsFiles::OnCmdEditseldef(void)
01839 {
01840     int nItem = -1;
01841
01842     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01843     {
01844         EntnodeData *data;
01845         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01846         EditSel(data, true);
01847     }
01848     return 0;
01849 }
01850
01851 int UCvsFiles::OnMacroSel(int cmd)
01852 {
01853     CTcl_Interp interp;
01854     CMacroEntry & entry = gMacrosSel.entries[cmd - cmdSELMACRO];
01855     CStr path = entry.path;
01856     CTcl_Interp::Unixfy(path);
01857
01858     TclBrowserReset();
01859
01860     int nItem = -1;
01861     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01862     {
01863         EntnodeData *data;
01864         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01865         TclBrowserAppend(m_path, data);
01866     }
01867
01868     interp.DoScriptVar("source \"%s\"", (const char *)path);
01869     return 0;
01870 }
01871
01872 void UCvsFiles::EditSel(EntnodeData *data, bool useDefault)
01873 {
01874     CStr fullpath;
01875     fullpath = m_path;
01876     if(!fullpath.endsWith(kPathDelimiter))
01877         fullpath << kPathDelimiter;
01878     fullpath << (*data)[EntnodeData::kName];
01879     if(data->GetType() == ENT_SUBDIR)
01880     {
01881         ResetView(fullpath, true);
01882     }
01883     else
01884     {
01885 #ifdef WIN32
01886         char viewer[_MAX_PATH];
01887         HINSTANCE hInst = FindExecutable((*data)[EntnodeData::kName],
01888             m_path, viewer);
01889         bool done = false;
01890         if(!useDefault && (UINT)hInst >= 32)
01891         {
01892             HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), "open", (*data)[EntnodeData::kName],
01893                 NULL, m_path, SW_SHOWDEFAULT);
01894             if((long)hInst < 32)
01895             {
01896                 cvs_err("Unable to open '%s' (error %d), using default viewer instead\n", (char *)fullpath, GetLastError());
01897             }
01898             else
01899                 done = true;
01900         }
01901
01902         if(!done)
01903         {
01904             const char * argv[3] = {0L, 0L, 0L};
01905             CStr program, file;
01906             if(strchr(gCvsPrefs.Viewer(), ' ') != 0L)
01907             {
01908                 program << '\"';
01909                 program << gCvsPrefs.Viewer();
01910                 program << '\"';
01911             }
01912             else
01913                 program = gCvsPrefs.Viewer();
01914             if(strchr(fullpath, ' ') != 0L)
01915             {
01916                 file << '\"';
01917                 file << fullpath;
01918                 file << '\"';
01919             }
01920             else
01921                 file = fullpath;
01922             argv[0] = program;
01923             argv[1] = file;
01924             int process = _spawnvp(_P_NOWAIT, gCvsPrefs.Viewer(), argv);
01925         }
01926 #endif
01927 #ifdef qUnix
01928         CStr fullpath;
01929         fullpath = m_path;
01930         if(!fullpath.endsWith(kPathDelimiter))
01931             fullpath << kPathDelimiter;
01932         fullpath << (*data)[EntnodeData::kName];
01933
01934         CvsArgs args(false);
01935         args.add(gCvsPrefs.Viewer());
01936         args.add(fullpath);
01937         UCvsApp::gApp->Execute(args.Argc(), args.Argv());
01938 #endif
01939     }
01940 }
01941
01942 void UCvsFiles::OnDblClick(void)
01943 {
01944     int nItem = -1;
01945
01946     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01947     {
01948         EntnodeData *data;
01949         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01950         EditSel(data);
01951     }
01952 }
01953
01954 static int compareName(UWidget *wid, void *data1, void *data2)
01955 {
01956     UCvsFiles *w = (UCvsFiles *)wid;
01957     EntnodeData *d1 = (EntnodeData *)data1;
01958     EntnodeData *d2 = (EntnodeData *)data2;
01959     int res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
01960     return w->IsSortAscendant() ? res : -res;
01961 }
01962
01963 static int compareStatus(UWidget *wid, void *data1, void *data2)
01964 {
01965     UCvsFiles *w = (UCvsFiles *)wid;
01966     EntnodeData *d1 = (EntnodeData *)data1;
01967     EntnodeData *d2 = (EntnodeData *)data2;
01968     int res = stricmp((*d1)[EntnodeData::kStatus], (*d2)[EntnodeData::kStatus]);
01969     if(res == 0)
01970         res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
01971     return w->IsSortAscendant() ? res : -res;
01972 }
01973
01974 static int compareOption(UWidget *wid, void *data1, void *data2)
01975 {
01976     UCvsFiles *w = (UCvsFiles *)wid;
01977     EntnodeData *d1 = (EntnodeData *)data1;
01978     EntnodeData *d2 = (EntnodeData *)data2;
01979     const char *s1 = (*d1)[EntnodeFile::kOption];
01980     const char *s2 = (*d2)[EntnodeFile::kOption];
01981     int res;
01982     if(s1 != 0L && s2 != 0L)
01983         res = strcmp(s1, s2);
01984     else
01985         res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
01986     if(res == 0)
01987         res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
01988     return w->IsSortAscendant() ? res : -res;
01989 }
01990
01991 static int revcmp(const char *rev1, const char *rev2)
01992 {
01993     if(rev1 == 0L && rev2 == 0L)
01994         return 0;
01995     else if(rev1 == 0L || rev2 == 0L)
01996         return rev1 == 0L ? -1 : 1;
01997
01998     CStr r1(rev1), r2(rev2);
01999     CStr q1, q2;
02000     char *tmp;
02001     int v1, v2;
02002
02003     if((tmp = strchr(r1, '.')) != 0L)
02004     {
02005         tmp[0] = '\0';
02006         q1 = tmp + 1;
02007     }
02008
02009     v1 = atoi(r1);
02010
02011     if((tmp = strchr(r2, '.')) != 0L)
02012     {
02013         tmp[0] = '\0';
02014         q2 = tmp + 1;
02015     }
02016     v2 = atoi(r2);
02017
02018     if(v1 == v2)
02019         return revcmp(q1.empty() ? (char *)0L : (const char *)q1, q2.empty() ? (char *)0L : (const char *)q2);
02020
02021     return v1 < v2 ? -1 : 1;
02022 }
02023
02024 static int compareRevs(UWidget *wid, void * data1, void * data2)
02025 {
02026     UCvsFiles *w = (UCvsFiles *)wid;
02027     EntnodeData *d1 = (EntnodeData *)data1;
02028     EntnodeData *d2 = (EntnodeData *)data2;
02029     const char *s1 = (*d1)[EntnodeFile::kVN];
02030     const char *s2 = (*d2)[EntnodeFile::kVN];
02031     int res;
02032     if(s1 != 0L && s2 != 0L)
02033         res = revcmp(s1, s2);
02034     else
02035         res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
02036     if(res == 0)
02037         res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
02038     return w->IsSortAscendant() ? res : -res;
02039 }
02040
02041 static int compareTag(UWidget *wid, void * data1, void * data2)
02042 {
02043     UCvsFiles *w = (UCvsFiles *)wid;
02044     EntnodeData *d1 = (EntnodeData *)data1;
02045     EntnodeData *d2 = (EntnodeData *)data2;
02046     const char *s1 = (*d1)[EntnodeFile::kTag];
02047     const char *s2 = (*d2)[EntnodeFile::kTag];
02048     int res;
02049     if(s1 != 0L && s2 != 0L)
02050         res = strcmp(s1, s2);
02051     else
02052         res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
02053     if(res == 0)
02054         res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
02055     return w->IsSortAscendant() ? res : -res;
02056 }
02057
02058 static int compareConflict(UWidget *wid, void * data1, void * data2)
02059 {
02060     UCvsFiles *w = (UCvsFiles *)wid;
02061     EntnodeData *d1 = (EntnodeData *)data1;
02062     EntnodeData *d2 = (EntnodeData *)data2;
02063     const char *s1 = (*d1)[EntnodeFile::kConflict];
02064     const char *s2 = (*d2)[EntnodeFile::kConflict];
02065     int res;
02066     if(s1 != 0L && s2 != 0L)
02067         res = strcmp(s1, s2);
02068     else
02069         res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
02070     if(res == 0)
02071         res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
02072     return w->IsSortAscendant() ? res : -res;
02073 }
02074
02075 void UCvsFiles::Resort(void)
02076 {
02077     UListSorter fsort = 0L;
02078     switch(m_sort)
02079     {
02080     case EntnodeData::kName:
02081         fsort = compareName;
02082         break;
02083     case EntnodeFile::kVN:
02084         fsort = compareRevs;
02085         break;
02086     case EntnodeData::kStatus:
02087         fsort = compareStatus;
02088         break;
02089     case EntnodeFile::kOption:
02090         fsort = compareOption;
02091         break;
02092     case EntnodeFile::kTag:
02093         fsort = compareTag;
02094         break;
02095     case EntnodeFile::kConflict:
02096         fsort = compareConflict;
02097         break;
02098     }
02099     if(fsort != 0L)
02100         UEventSendMessage(GetWidID(), EV_LIST_RESORT, UMAKEINT(kUMainWidget, m_sort), (void *)fsort);
02101 }
02102
02103 void UCvsFiles::OnSelColumn(int column)
02104 {
02105     if(column == m_sort)
02106         m_ascendant = !m_ascendant;
02107     else
02108     {
02109         m_ascendant = true;
02110         switch(column)
02111         {
02112         case EntnodeData::kName:
02113         case EntnodeData::kStatus:
02114         case EntnodeFile::kOption:
02115         case EntnodeFile::kTag:
02116         case EntnodeFile::kConflict:
02117         case EntnodeFile::kVN:
02118             m_sort = column;
02119             break;
02120         }
02121     }
02122
02123     Resort();
02124 }
Generated on Sun Oct 21 12:41:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsFiles.h Source File

common/UCvsFiles.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #ifndef UCVSFILES_H
00026 #define UCVSFILES_H
00027
00028 #include "uwidget.h"
00029 #include "CvsEntries.h"
00030
00031 class UCvsFiles : public UWidget
00032 {
00033     UDECLARE_DYNAMIC(UCvsFiles)
00034 public:
00035     UCvsFiles();
00036     virtual ~UCvsFiles();
00037
00038     void ResetView(const char *path, bool notifyBrowser = false);
00039         // reset to this path and notify optionally the directories tree
00040
00041     void ResetView(bool forceReload = false, bool notifyBrowser = false);
00042         // - reload and try to guess if something changed
00043         // according to the mod. time of CVS
00044         // - notify optionally the directories tree
00045
00046     static void *GetImageForEntry(EntnodeData *data);
00047         // return the icon of the image which symbolizes the
00048         // state of the file/directory
00049
00050     inline bool IsSortAscendant(void) { return m_ascendant; }
00051
00052 protected:
00053     void GetEntriesModTime(time_t & newEntriesMod, time_t & newEntriesLogMod);
00054         // used internally to get the time stamp of the CVS/Entries
00055
00056     void EditSel(EntnodeData *data, bool useDefault = false);
00057         // used internally to open a file
00058
00059     void Resort(void);
00060         // resort according to the current key
00061
00062     CSortList<ENTNODE> m_entries;
00063         // CVS/Entries infos
00064     CStr m_path;
00065         // current path
00066     time_t m_entriesMod;
00067     time_t m_entriesLogMod;
00068         // time stamp of CVS/
00069     int m_sort;
00070         // sort key
00071     bool m_ascendant;
00072         // sort flag
00073
00074     bool DisableGeneric();
00075         // used for the handling of EV_UPDTCMD
00076
00077     int Search(const char *title);
00078
00079     ev_msg void OnDestroy();
00080     ev_msg void OnCreate();
00081     ev_msg int OnCmdUpdate(void);
00082     ev_msg int OnCmdAdd(void);
00083     ev_msg int OnCmdAddb(void);
00084     ev_msg int OnCmdCommit(void);
00085     ev_msg int OnCmdRmv(void);
00086     ev_msg int OnCmdQueryUpdate(void);
00087     ev_msg int OnCmdReload(void);
00088     ev_msg int OnCmdUpone(void);
00089     ev_msg int OnCmdTrash(void);
00090     ev_msg int OnCmdDiff(void);
00091     ev_msg int OnCmdLog(void);
00092     ev_msg int OnCmdGraph(void);
00093     ev_msg int OnCmdStatus(void);
00094     ev_msg int OnCmdLock(void);
00095     ev_msg int OnCmdUnlock(void);
00096     ev_msg int OnCmdWatchOn(void);
00097     ev_msg int OnCmdWatchOff(void);
00098     ev_msg int OnCmdEdit(void);
00099     ev_msg int OnCmdUnedit(void);
00100     ev_msg int OnCmdWatchers(void);
00101     ev_msg int OnCmdEditors(void);
00102     ev_msg int OnCmdRelease(void);
00103     ev_msg int OnCmdTagNew(void);
00104     ev_msg int OnCmdTagDelete(void);
00105     ev_msg int OnCmdTagBranch(void);
00106     ev_msg int OnCmdExplore(void);
00107     ev_msg int OnCmdIgnore(void);
00108     ev_msg int OnCmdEditsel(void);
00109     ev_msg int OnCmdEditseldef(void);
00110     ev_msg int OnMacroSel(int cmd);
00111     ev_msg void OnCmdUIUpdate(UCmdUI *pCmdUI);
00112     ev_msg void OnCmdUIAdd(UCmdUI *pCmdUI);
00113     ev_msg void OnCmdUIAddB(UCmdUI *pCmdUI);
00114     ev_msg void OnCmdUIRelease(UCmdUI *pCmdUI);
00115     ev_msg void OnCmdUIRmv(UCmdUI *pCmdUI);
00116     ev_msg void OnCmdUIGraph(UCmdUI *pCmdUI);
00117     ev_msg void OnCmdUIEditseldef(UCmdUI *pCmdUI);
00118     ev_msg void OnCmdUIReload(UCmdUI *pCmdUI);
00119     ev_msg void OnCmdUIUpone(UCmdUI *pCmdUI);
00120     ev_msg void OnCmdUITrash(UCmdUI *pCmdUI);
00121     ev_msg void OnCmdUIExplore(UCmdUI *pCmdUI);
00122     ev_msg void OnCmdUIIgnore(UCmdUI *pCmdUI);
00123     ev_msg void OnCmdUIMacroSel(int cmd, UCmdUI *pCmdUI);
00124     ev_msg void OnDblClick(void);
00125     ev_msg void OnSelColumn(int column);
00126
00127     UDECLARE_MESSAGE_MAP()
00128 };
00129
00130 extern CPersistentBool gFileViewIgnore;
00131
00132 #endif
Generated on Sun Oct 21 12:41:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsFolders.cpp Source File

common/UCvsFolders.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #if qGTK
00028 #   include <gtk/gtk.h>
00029 #endif
00030
00031 #ifdef HAVE_UNISTD_H
00032 #include <unistd.h>
00033 #endif
00034
00035 #include "UCvsFolders.h"
00036 #include "UCvsDialogs.h"
00037 #include "UCvsApp.h"
00038 #include "UCvsFiles.h"
00039 #include "UCvsCommands.h"
00040 #include "UCvsFrame.h"
00041 #include "MultiString.h"
00042 #include "FileTraversal.h"
00043 #include "CvsEntries.h"
00044 #include "CvsPrefs.h"
00045 #include "AppConsole.h"
00046 #include "CvsCommands.h"
00047 #include "TclGlue.h"
00048 #include "MacrosSetup.h"
00049 #include "CvsArgs.h"
00050
00051 #ifdef WIN32
00052 static PCPStr gOldLoc("P_BrowserLoc", "C:\\");
00053 #endif
00054
00055 #ifdef qUnix
00056 static PCPStr gOldLoc("P_BrowserLoc");
00057 #endif
00058
00059 static const char *gDummyFile = "@@@dummy file@@@";
00060
00061 static CMString gHistoryLocs(100, "P_BrowserLocs");
00062
00063 static void *sFolderIcon;
00064 static void *sFolderUnknownIcon;
00065 static void *sFolderIgnoredIcon;
00066 static void *sFolderMissingIcon;
00067
00068 enum
00069 {
00070     kIconFolderClosed,
00071     kIconFolderOpened,
00072     kIconFolderCVSClosed,
00073     kIconFolderCVSOpened,
00074     kIconFolderIgnoreClosed,
00075     kIconFolderIgnoreOpened,
00076     kIconFolderIgnoreLost
00077 };
00078
00079 UIMPLEMENT_DYNAMIC(UCvsFolders, UWidget)
00080
00081 UBEGIN_MESSAGE_MAP(UCvsFolders, UWidget)
00082     ON_UUPDATECMD(cmdUPDATE, UCvsFolders::OnCmdUIUpdate)
00083     ON_UUPDATECMD(cmdCOMMIT, UCvsFolders::OnCmdUIUpdate)
00084     ON_UUPDATECMD(cmdDIFF, UCvsFolders::OnCmdUIUpdate)
00085     ON_UUPDATECMD(cmdEDIT, UCvsFolders::OnCmdUIUpdate)
00086     ON_UUPDATECMD(cmdEDITORS, UCvsFolders::OnCmdUIUpdate)
00087     ON_UUPDATECMD(cmdLOCKF, UCvsFolders::OnCmdUIUpdate)
00088     ON_UUPDATECMD(cmdLOG, UCvsFolders::OnCmdUIUpdate)
00089     ON_UUPDATECMD(cmdRELEASE, UCvsFolders::OnCmdUIUpdate)
00090     ON_UUPDATECMD(cmdSTATUS, UCvsFolders::OnCmdUIUpdate)
00091     ON_UUPDATECMD(cmdUNEDIT, UCvsFolders::OnCmdUIUpdate)
00092     ON_UUPDATECMD(cmdUPDATE, UCvsFolders::OnCmdUIUpdate)
00093     ON_UUPDATECMD(cmdQUERYUPDATE, UCvsFolders::OnCmdUIUpdate)
00094     ON_UUPDATECMD(cmdUNLOCKF, UCvsFolders::OnCmdUIUpdate)
00095     ON_UUPDATECMD(cmdWATCHERS, UCvsFolders::OnCmdUIUpdate)
00096     ON_UUPDATECMD(cmdWATCHON, UCvsFolders::OnCmdUIUpdate)
00097     ON_UUPDATECMD(cmdWATCHOFF, UCvsFolders::OnCmdUIUpdate)
00098     ON_UUPDATECMD(cmdTAGNEW, UCvsFolders::OnCmdUIUpdate)
00099     ON_UUPDATECMD(cmdTAGDELETE, UCvsFolders::OnCmdUIUpdate)
00100     ON_UUPDATECMD(cmdTAGBRANCH, UCvsFolders::OnCmdUIUpdate)
00101     ON_UUPDATECMD(cmdADD, UCvsFolders::OnCmdUIAdd)
00102     ON_UUPDATECMD(cmdEXPLORE, UCvsFolders::OnCmdUIExplore)
00103     ON_UUPDATECMD(cmdRELOAD, UCvsFolders::OnCmdUIReload)
00104     ON_UUPDATECMD(cmdIGNORE, UCvsFolders::OnCmdUIIgnore)
00105     ON_UUPDATECMD(cmdCHECKOUT, UCvsFolders::OnCmdUICheckout)
00106     ON_UUPDATECMD(cmdIMPORT, UCvsFolders::OnCmdUIImport)
00107     ON_UUPDATECMD_RANGE(cmdSELMACRO, cmdSELMACROEND, UCvsFolders::OnCmdUIMacrosSel)
00108     ON_UDESTROY(UCvsFolders)
00109     ON_UCREATE(UCvsFolders)
00110     ON_TREE_EXPANDING(kUMainWidget, UCvsFolders::OnTreeExpanding)
00111     ON_TREE_SELECTING(kUMainWidget, UCvsFolders::OnTreeSelecting)
00112     ON_UCOMMAND(cmdUPDATE, UCvsFolders::OnCmdUpdate)
00113     ON_UCOMMAND(cmdADD, UCvsFolders::OnCmdAdd)
00114     ON_UCOMMAND(cmdCOMMIT, UCvsFolders::OnCmdCommit)
00115     ON_UCOMMAND(cmdQUERYUPDATE, UCvsFolders::OnCmdQueryUpdate)
00116     ON_UCOMMAND(cmdDIFF, UCvsFolders::OnCmdDiff)
00117     ON_UCOMMAND(cmdLOG, UCvsFolders::OnCmdLog)
00118     ON_UCOMMAND(cmdSTATUS, UCvsFolders::OnCmdStatus)
00119     ON_UCOMMAND(cmdLOCKF, UCvsFolders::OnCmdLock)
00120     ON_UCOMMAND(cmdUNLOCKF, UCvsFolders::OnCmdUnlock)
00121     ON_UCOMMAND(cmdWATCHON, UCvsFolders::OnCmdWatchOn)
00122     ON_UCOMMAND(cmdWATCHOFF, UCvsFolders::OnCmdWatchOff)
00123     ON_UCOMMAND(cmdEDIT, UCvsFolders::OnCmdEdit)
00124     ON_UCOMMAND(cmdUNEDIT, UCvsFolders::OnCmdUnedit)
00125     ON_UCOMMAND(cmdWATCHERS, UCvsFolders::OnCmdWatchers)
00126     ON_UCOMMAND(cmdEDITORS, UCvsFolders::OnCmdEditors)
00127     ON_UCOMMAND(cmdRELEASE, UCvsFolders::OnCmdRelease)
00128     ON_UCOMMAND(cmdTAGNEW, UCvsFolders::OnCmdTagNew)
00129     ON_UCOMMAND(cmdTAGDELETE, UCvsFolders::OnCmdTagDelete)
00130     ON_UCOMMAND(cmdTAGBRANCH, UCvsFolders::OnCmdTagBranch)
00131     ON_UCOMMAND(cmdEXPLORE, UCvsFolders::OnCmdExplore)
00132     ON_UCOMMAND(cmdRELOAD, UCvsFolders::OnCmdReload)
00133     ON_UCOMMAND(cmdIGNORE, UCvsFolders::OnCmdIgnore)
00134     ON_UCOMMAND(cmdCHECKOUT, UCvsFolders::OnCmdCheckout)
00135     ON_UCOMMAND(cmdIMPORT, UCvsFolders::OnCmdImport)
00136     ON_UCOMMAND_RANGE(cmdSELMACRO, cmdSELMACROEND, UCvsFolders::OnCmdMacrosSel)
00137 UEND_MESSAGE_MAP()
00138
00139 #if 0
00140     ON_WM_RBUTTONDOWN() // TODO
00141 #endif
00142
00143 static bool sTemporaryTurnOffNotify = false;
00144
00145 class CTempToggleBool
00146 {
00147 public:
00148     CTempToggleBool(bool & value) : m_value(value), m_didSetIt(false)
00149     {
00150         if(!m_value)
00151         {
00152             m_didSetIt = true;
00153             m_value = true;
00154         }
00155     }
00156
00157     ~CTempToggleBool()
00158     {
00159         if(m_didSetIt)
00160             m_value = false;
00161     }
00162 protected:
00163     bool & m_value;
00164     bool m_didSetIt;
00165 };
00166
00167 static void *GetIcon(UCvsFolders *treeCrtl, UTREEITEM item, bool hasCvsInfos, bool expand, EntnodeData *data)
00168 {
00169     int newImage;
00170     void *result = 0L;
00171
00172     if(data == 0L)
00173     {
00174         if(expand)
00175             newImage = hasCvsInfos ? kIconFolderCVSOpened : kIconFolderOpened;
00176         else
00177             newImage = hasCvsInfos ? kIconFolderCVSClosed : kIconFolderClosed;
00178     }
00179     else
00180     {
00181         if(expand)
00182         {
00183             if(data->IsIgnored())
00184                 newImage = kIconFolderIgnoreOpened;
00185             else if(data->IsUnknown())
00186                 newImage = kIconFolderOpened;
00187             else if(data->IsMissing())
00188                 newImage = kIconFolderIgnoreLost;
00189             else
00190                 newImage = kIconFolderCVSOpened;
00191         }
00192         else
00193         {
00194             if(data->IsIgnored())
00195                 newImage = kIconFolderIgnoreClosed;
00196             else if(data->IsUnknown())
00197                 newImage = kIconFolderClosed;
00198             else if(data->IsMissing())
00199                 newImage = kIconFolderIgnoreLost;
00200             else
00201                 newImage = kIconFolderCVSClosed;
00202         }
00203     }
00204
00205 #if qGTK
00206     void *pixmap = 0L;
00207     switch(newImage)
00208     {
00209     case kIconFolderClosed:
00210     case kIconFolderOpened:
00211         pixmap = sFolderUnknownIcon;
00212         break;
00213     case kIconFolderCVSClosed:
00214     case kIconFolderCVSOpened:
00215         pixmap = sFolderIcon;
00216         break;
00217     case kIconFolderIgnoreClosed:
00218     case kIconFolderIgnoreOpened:
00219         pixmap = sFolderIgnoredIcon;
00220         break;
00221     case kIconFolderIgnoreLost:
00222         pixmap = sFolderMissingIcon;
00223         break;
00224     }
00225     if(pixmap != 0L)
00226     {
00227         result = gtk_pixmap_new (GTK_PIXMAP(pixmap)->pixmap, GTK_PIXMAP(pixmap)->mask);
00228     }
00229 #endif
00230
00231     return result;
00232 }
00233
00234 // regarding a path and a root item, create an
00235 // item with a dummy item inside if and only if
00236 // the folder is not empty.
00237 class TBrowserFillDummy : public TraversalReport
00238 {
00239 public:
00240     UTREEITEM   m_root;
00241     UTREEITEM   m_item;
00242     UCvsFolders *m_treeCtrl;
00243     bool        m_empty;
00244     bool        m_hascvs;
00245     EntnodeData *m_data;
00246     UStr        m_dirname;
00247
00248     TBrowserFillDummy(UCvsFolders *treeCtrl, UTREEITEM root, UTREEITEM item, EntnodeData *data) :
00249         m_root(root), m_item(item), m_treeCtrl(treeCtrl), m_empty(true),
00250         m_hascvs(false), m_data(data) {}
00251
00252     virtual ~TBrowserFillDummy() {}
00253
00254     virtual kTraversal EnterDirectory(const char *fullpath, const char *dirname, const FSSpec * macspec)
00255     {
00256         m_dirname = dirname;
00257 #if qUnix
00258         if(m_dirname.empty())
00259             m_dirname = fullpath; // '/'
00260 #endif
00261         return kContinueTraversal;
00262     }
00263
00264     virtual kTraversal ExitDirectory(const char *fullpath)
00265     {
00266         if(m_item == 0L)
00267         {
00268             UTREE_INSERT insert;
00269             insert.parent = m_root;
00270             insert.icon = GetIcon(m_treeCtrl, m_item, m_hascvs, false, m_data);
00271             insert.title = m_dirname;
00272             insert.data = 0L;
00273             UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_INSERT, kUMainWidget, &insert);
00274             m_item = insert.result;
00275         }
00276
00277         // assign the entries to this item
00278         UTREE_INFO query;
00279         query.item = m_item;
00280         if(m_data != 0L)
00281         {
00282             UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00283             EntnodeData *data = (EntnodeData *)query.data;
00284
00285             if(m_data != 0L)
00286                 m_data->Ref();
00287
00288             query.data = m_data;
00289             UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_SETDATA, kUMainWidget, &query);
00290
00291             if(data != 0L)
00292                 data->UnRef();
00293         }
00294         else
00295         {
00296             UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00297             m_data = (EntnodeData *)query.data;
00298         }
00299
00300         if(m_empty)
00301             return kContinueTraversal;
00302
00303         // add a dummy item to simulate the folder
00304         // is not empty. This dummy item will be
00305         // replaced by a complete listing when the
00306         // node is expanding...
00307
00308         UTREE_INSERT insert;
00309         insert.parent = m_item;
00310         insert.icon = 0L;
00311         insert.title = gDummyFile;
00312         insert.data = 0L;
00313         UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_INSERT, kUMainWidget, &insert);
00314
00315         return kContinueTraversal;
00316     }
00317
00318     virtual kTraversal OnError(const char *err, int errcode)
00319     {
00320         return kTraversalError;
00321     }
00322
00323     virtual kTraversal OnIdle(const char *fullpath)
00324     {
00325         return kContinueTraversal;
00326     }
00327
00328     virtual kTraversal OnDirectory(const char *fullpath,
00329         const char *fullname,
00330         const char *name,
00331         const struct stat & dir, const FSSpec * macspec)
00332     {
00333 #if qUnix
00334         if(strcmp(name, "CVS") == 0)
00335 #else
00336         if(stricmp(name, "cvs") == 0)
00337 #endif
00338             m_hascvs = true;
00339         else
00340             m_empty = false;
00341
00342         return kSkipFile;
00343     }
00344 };
00345
00346 // regarding a path and a root item, create an
00347 // item with all the subdirectories inside.
00348 class TBrowserFill : public TraversalReport
00349 {
00350 public:
00351     UTREEITEM m_root;
00352     UTREEITEM m_item;
00353     UCvsFolders *m_treeCtrl;
00354     CSortList<ENTNODE> & m_entries;
00355     vector<UStr> m_ignlist;
00356
00357     TBrowserFill(UCvsFolders *treeCtrl, UTREEITEM root, UTREEITEM item, CSortList<ENTNODE> & entries) :
00358             m_root(root), m_item(item), m_treeCtrl(treeCtrl),
00359             m_entries(entries) {}
00360
00361     virtual ~TBrowserFill() {}
00362
00363     virtual kTraversal EnterDirectory(const char *fullpath, const char *dirname, const FSSpec * macspec)
00364     {
00365         ASSERT(m_item != 0L);
00366
00367         // assign the entries to this item
00368         Entries_Open (m_entries, fullpath);
00369         BuildIgnoredList(m_ignlist, fullpath);
00370
00371         return kContinueTraversal;
00372     }
00373
00374     virtual kTraversal ExitDirectory(const char *fullpath)
00375     {
00376         m_ignlist.erase(m_ignlist.begin(), m_ignlist.end());
00377
00378         UTREE_INFO query;
00379         query.item = m_item;
00380         UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00381         query.icon = GetIcon(m_treeCtrl, m_item, true /*ignored*/, true, (EntnodeData *)query.data);
00382         UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_SETICON, kUMainWidget, &query);
00383
00384         return kContinueTraversal;
00385     }
00386
00387     virtual kTraversal OnError(const char *err, int errcode)
00388     {
00389         return kTraversalError;
00390     }
00391
00392     virtual kTraversal OnIdle(const char *fullpath)
00393     {
00394         return kContinueTraversal;
00395     }
00396
00397     virtual kTraversal OnDirectory(const char *fullpath,
00398         const char *fullname,
00399         const char *name,
00400         const struct stat & dir, const FSSpec * macspec)
00401     {
00402 #if qUnix
00403         if(strcmp(name, "CVS") == 0)
00404 #else
00405         if(stricmp(name, "cvs") == 0)
00406 #endif
00407             return kSkipFile;
00408
00409         // is the sub-directory ignored ?
00410         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00411         if(!(bool)gFileViewIgnore && data->IsIgnored())
00412             return kSkipFile;
00413
00414         // create the item for the sub-directory
00415         TBrowserFillDummy traverse(m_treeCtrl, m_item, 0L, data);
00416         /*kTraversal res = */FileTraverse(fullname, traverse);
00417
00418         // assign the icon regarding our Entries info
00419         if(traverse.m_item != 0L)
00420         {
00421             UTREE_INFO query;
00422             query.item = traverse.m_item;
00423             query.icon = GetIcon(m_treeCtrl, m_item, true /*ignored*/, false, data);
00424             UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_SETICON, kUMainWidget, &query);
00425         }
00426
00427         return kSkipFile;
00428     }
00429 };
00430
00431 UCvsFolders::UCvsFolders() : UWidget(kUCvsFoldersID)
00432 {
00433 }
00434
00435 UCvsFolders::~UCvsFolders()
00436 {
00437 }
00438
00439 void UCvsFolders::OnDestroy(void)
00440 {
00441     delete this;
00442 }
00443
00444 void UCvsFolders::OnCreate(void)
00445 {
00446     if(sFolderIcon == 0L)
00447     {
00448         sFolderIcon = UCreate_pixmap(this, "folder.xpm");
00449         sFolderUnknownIcon = UCreate_pixmap(this, "foldunk.xpm");
00450         sFolderIgnoredIcon = UCreate_pixmap(this, "foldign.xpm");
00451         sFolderMissingIcon = UCreate_pixmap(this, "foldmiss.xpm");
00452     }
00453
00454     UStr newpath;
00455     newpath = (const char *)gOldLoc;
00456     if(newpath.empty())
00457         newpath = gCvsPrefs.Home();
00458
00459     // set the initial root
00460     ResetBrowser(newpath, true);
00461 }
00462
00463 void UCvsFolders::ResetBrowser(const char *path, bool notifyView)
00464 {
00465     UWaitCursor wait;
00466
00467     DeleteAllItems();
00468     bool isReload = path != 0L && !m_root.empty() && stricmp(m_root, path) == 0;
00469
00470     m_root = path;
00471
00472     if(path == 0L)
00473         return;
00474
00475     if(!isReload)
00476     {
00477         if(HasPersistentSettings(m_root))
00478             LoadPersistentSettings(m_root);
00479         else
00480         {
00481             // check if the path has a CVS folder. If not,
00482             // we don't want the user to be prompted (like when
00483             // WinCvs is starting for the first time).
00484             UStr cvsFolder(m_root);
00485             if(!cvsFolder.endsWith(kPathDelimiter))
00486                 cvsFolder << kPathDelimiter;
00487             cvsFolder << "CVS";
00488             struct stat sb;
00489             if (stat(cvsFolder, &sb) != -1 && S_ISDIR(sb.st_mode))
00490                 AskCreatePersistentSettings(m_root);
00491         }
00492     }
00493
00494     if(stricmp(gOldLoc, m_root) != 0)
00495         gOldLoc = m_root;
00496
00497     // update the history combo
00498     gHistoryLocs.Insert(m_root);
00499     UEventSendMessage(kUCvsFrameID, EV_COMBO_RESETALL, UCvsFrame::kDirCombo, 0L);
00500     const std::vector<UStr> & list = gHistoryLocs.GetList();
00501     std::vector<UStr>::const_iterator i;
00502     int pos = 0;
00503     for(i = list.begin(); i != list.end(); ++i, pos++)
00504     {
00505         UEventSendMessage(kUCvsFrameID, EV_COMBO_APPEND,
00506                           UCvsFrame::kDirCombo, (void *)(const char *)*i);
00507     }
00508     UEventSendMessage(kUCvsFrameID, EV_COMBO_SETSEL, UMAKEINT(UCvsFrame::kDirCombo, 0), 0L);
00509
00510     // fill the browser
00511     TBrowserFillDummy traverse(this, 0L, 0L, 0L);
00512     /*kTraversal res = */FileTraverse(m_root, traverse);
00513
00514     if(traverse.m_item != 0L)
00515     {
00516         UEventSendMessage(GetWidID(), EV_TREE_EXPAND, UMAKEINT(kUMainWidget, 0), traverse.m_item);
00517         if(notifyView && UCvsApp::gApp->GetFilesView())
00518             UCvsApp::gApp->GetFilesView()->ResetView(path);
00519     }
00520 }
00521
00522 void UCvsFolders::ResetView(bool forceReload, bool notifyView)
00523 {
00524     UWaitCursor doWait;
00525
00526     std::vector<UStr> allExpanded;
00527     StoreExpanded(allExpanded);
00528
00529     bool contentChanged = false;
00530     UStr selPath;
00531     UTREEITEM selItem;
00532     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &selItem);
00533     if(selItem != 0L)
00534         RetrievePath(selItem, selPath);
00535
00536     if(forceReload)
00537     {
00538         ResetBrowser(m_root);
00539         contentChanged = true;
00540     }
00541
00542     if(contentChanged)
00543     {
00544         // restore the expanded paths and the selected item
00545         std::vector<UStr>::const_iterator i;
00546         for(i = allExpanded.begin(); i != allExpanded.end(); ++i)
00547         {
00548             StepToLocation(*i);
00549         }
00550         if(!selPath.empty())
00551         {
00552             selItem = GetItemByLocation(selPath);
00553             if(selItem != 0L)
00554                 UEventSendMessage(GetWidID(), EV_TREE_SELECT, UMAKEINT(kUMainWidget, 0), selItem);
00555         }
00556     }
00557
00558     // we don't need to notify the file view if we force the reload
00559     // because that's already done
00560     if(notifyView)
00561     {
00562         UCvsApp::gApp->GetFilesView()->ResetView(forceReload);
00563     }
00564     UEventSendMessage(GetWidID(), EV_CHGFOCUS, kUMainWidget, 0L);
00565 }
00566
00567 void UCvsFolders::StoreExpanded(std::vector<UStr> & allExpanded, UTREEITEM root)
00568 {
00569     UTREE_INFO query;
00570     query.item = root;
00571     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00572
00573     UTREEITEM item = query.item;
00574     if(item == 0L)
00575         return;
00576
00577     if(query.expanded)
00578     {
00579         UStr path;
00580         RetrievePath(item, path);
00581         allExpanded.push_back(path);
00582     }
00583
00584     UTREEITEM childItem = query.child;
00585
00586     while(childItem != 0L)
00587     {
00588         StoreExpanded(allExpanded, childItem);
00589         query.item = childItem;
00590         UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00591         childItem = query.next;
00592     }
00593 }
00594
00595 void UCvsFolders::StepToLocation(const char *path, bool notifyView)
00596 {
00597     UStr root(m_root);
00598     if(!root.endsWith(kPathDelimiter))
00599         root << kPathDelimiter;
00600     UStr subpath(path);
00601     if(!subpath.endsWith(kPathDelimiter))
00602         subpath << kPathDelimiter;
00603
00604     // check if it is a sub-path
00605     if(strncmp(root, subpath, root.length()) != 0)
00606         return;
00607
00608     UTREE_INFO query;
00609     query.item = 0L;
00610     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00611
00612     UTREEITEM item = query.item;
00613     UTREEITEM lastitem = 0L;
00614     if(item == 0L)
00615         return;
00616
00617     // step inside synchronized
00618     const char *tmp = (const char *)subpath + root.length() - 1;
00619     while((tmp = strchr(tmp, kPathDelimiter)) != 0L)
00620     {
00621         const char *name = ++tmp;
00622         if(name[0] == '\0')
00623             break;
00624
00625         UStr subname;
00626         const char *tmp2 = strchr(name, kPathDelimiter);
00627         if(tmp2 == 0L)
00628             subname = name;
00629         else
00630             subname.set(name, tmp2 - name);
00631
00632         query.item = item;
00633         UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00634         UTREEITEM childItem = query.child;
00635
00636         // find the subitem which matches this name
00637         while(childItem != 0L)
00638         {
00639             query.item = childItem;
00640             UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00641             EntnodeData *data = (EntnodeData *)query.data;
00642             if(data != 0L)
00643             {
00644 #ifdef qUnix
00645                 if(strcmp((*data)[EntnodeData::kName], subname) == 0)
00646 #else
00647                 if(_stricmp((*data)[EntnodeData::kName], subname) == 0)
00648 #endif
00649                 {
00650                     // found it !
00651                     lastitem = item = childItem;
00652                     UEventSendMessage(GetWidID(), EV_TREE_EXPAND, UMAKEINT(kUMainWidget, 0), item);
00653                     break;
00654                 }
00655             }
00656
00657             childItem = query.next;
00658         }
00659     }
00660
00661     // in case this is called by the view, turn off notifying
00662     // when the item gets selected
00663     if(lastitem != 0L)
00664     {
00665         if(!notifyView)
00666         {
00667             CTempToggleBool toggler(sTemporaryTurnOffNotify);
00668             UEventSendMessage(GetWidID(), EV_TREE_SELECT, UMAKEINT(kUMainWidget, 0), lastitem);
00669         }
00670         else
00671         {
00672             UEventSendMessage(GetWidID(), EV_TREE_SELECT, UMAKEINT(kUMainWidget, 0), lastitem);
00673         }
00674     }
00675 }
00676
00677 UTREEITEM UCvsFolders::GetItemByLocation(const char *path)
00678 {
00679     UStr root(m_root);
00680     if(!root.endsWith(kPathDelimiter))
00681         root << kPathDelimiter;
00682     UStr subpath(path);
00683     if(!subpath.endsWith(kPathDelimiter))
00684         subpath << kPathDelimiter;
00685
00686     // check if it is a sub-path
00687     if(strncmp(root, subpath, root.length()) != 0)
00688         return 0L;
00689
00690     UTREE_INFO query;
00691     query.item = 0L;
00692     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00693     UTREEITEM item = query.item;
00694     if(item == 0L)
00695         return 0L;
00696
00697     // step inside synchronized
00698     const char *tmp = (const char *)subpath + root.length() - 1;
00699     while((tmp = strchr(tmp, kPathDelimiter)) != 0L)
00700     {
00701         const char *name = ++tmp;
00702         if(name[0] == '\0')
00703             break;
00704
00705         CStr subname;
00706         const char *tmp2 = strchr(name, kPathDelimiter);
00707         if(tmp2 == 0L)
00708             subname = name;
00709         else
00710             subname.set(name, tmp2 - name);
00711
00712         UTREEITEM childItem = query.child;
00713
00714         // find the subitem which matches this name
00715         while(childItem != 0L)
00716         {
00717             query.item = childItem;
00718             UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00719             EntnodeData *data = (EntnodeData *)query.data;
00720             if(data != 0L)
00721             {
00722 #if qUnix
00723                 if(strcmp((*data)[EntnodeData::kName], subname) == 0)
00724 #else
00725                 if(_stricmp((*data)[EntnodeData::kName], subname) == 0)
00726 #endif
00727                 {
00728                     item = childItem;
00729                     break;
00730                 }
00731             }
00732
00733             childItem = query.next;
00734         }
00735         if(childItem == 0L)
00736             return 0L;
00737     }
00738
00739     return item;
00740 }
00741
00742 void UCvsFolders::OnTreeExpanding(int collapse, UTREEITEM item)
00743 {
00744     // many situations make that we enter here twice. Fortunately enough
00745     // we only dare the first signal.
00746     static bool sSemaphore = false;
00747     USemaphore policeman(sSemaphore);
00748     if(policeman.IsEnteredTwice())
00749         return;
00750
00751     UWaitCursor wait;
00752
00753     UTREE_INFO query;
00754     query.item = item;
00755     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00756     EntnodeData *data = (EntnodeData *)query.data;
00757
00758     // we refuse to expand in this case cause the folder is not really here
00759     if(data != 0L && data->IsMissing())
00760     {
00761         UEventSendMessage(GetWidID(), EV_TREE_EXPAND, UMAKEINT(kUMainWidget, 1), item);
00762         return;
00763     }
00764
00765     // erase all the childs
00766     DeleteAllItems(item);
00767
00768     UStr path;
00769     RetrievePath(item, path);
00770
00771     if(collapse)
00772     {
00773         TBrowserFillDummy traverse(this, 0L, item, 0L);
00774         /*kTraversal res = */FileTraverse(path, traverse);
00775     }
00776     else
00777     {
00778         CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00779         TBrowserFill traverse(this, 0L, item, entries);
00780         /*kTraversal res = */FileTraverse(path, traverse);
00781
00782 #if qGTK
00783         // gtk is closing the tree when we removed everything in it
00784         UEventSendMessage(GetWidID(), EV_TREE_EXPAND, UMAKEINT(kUMainWidget, 0), item);
00785 #endif
00786
00787         // add the missing folders
00788         Entries_SetMissing(entries);
00789         int numEntries = entries.NumOfElements();
00790         for(int i = 0; i < numEntries; i++)
00791         {
00792             const ENTNODE & theNode = entries.Get(i);
00793             EntnodeData *data = ((ENTNODE *)&theNode)->Data();
00794             if(!data->IsMissing() || data->GetType() != ENT_SUBDIR)
00795                 continue;
00796
00797             UTREE_INSERT insert;
00798             insert.parent = item;
00799             insert.icon = GetIcon(this, item, false, false, data->Ref());
00800             insert.title = (*data)[EntnodeData::kName];
00801             insert.data = data;
00802             UEventSendMessage(GetWidID(), EV_TREE_INSERT, kUMainWidget, &insert);
00803         }
00804     }
00805 }
00806
00807 void UCvsFolders::OnTreeSelecting(int deselect, UTREEITEM item)
00808 {
00809     if(deselect)
00810         return;
00811
00812     UTREE_INFO query;
00813     query.item = item;
00814     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00815     EntnodeData *data = (EntnodeData *)query.data;
00816     if(data != 0L && data->IsMissing())
00817         return;
00818
00819     if(!sTemporaryTurnOffNotify)
00820     {
00821         UStr path;
00822         RetrievePath(item, path);
00823         UCvsFiles *fileView = (UCvsFiles *)UEventQueryWidget(kUCvsFilesID);
00824         if(fileView != 0L)
00825         {
00826             ASSERT(fileView->IsKindOf(URUNTIME_CLASS(UCvsFiles)));
00827             fileView->ResetView(path);
00828         }
00829     }
00830
00831 }
00832
00833 void UCvsFolders::SetDefaultRoot(const char *root)
00834 {
00835     struct stat sb;
00836
00837     if (stat(root, &sb) == -1 || !S_ISDIR(sb.st_mode))
00838     {
00839         cvs_err("Cannot access directory '%s' (error %d)\n", root, errno);
00840         return;
00841     }
00842
00843     gOldLoc = root;
00844 }
00845
00846 void UCvsFolders::RetrievePath(UTREEITEM item, UStr & path)
00847 {
00848     UStr tmp, newPath;
00849     path = "";
00850
00851     do
00852     {
00853         UTREE_INFO query;
00854         query.item = item;
00855         UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00856
00857         item = query.parent;
00858
00859         tmp = path;
00860         newPath = item == 0L ? (const char *)m_root : query.title;
00861         if(!newPath.endsWith(kPathDelimiter))
00862             newPath << kPathDelimiter;
00863         newPath << path;
00864         path = newPath;
00865     } while(item != 0L);
00866 }
00867
00868 void UCvsFolders::DeleteAllItems(UTREEITEM root = 0L)
00869 {
00870     // we don't want the file view to be notified when things get deleted
00871     CTempToggleBool toggler(sTemporaryTurnOffNotify);
00872
00873     UTREE_INFO query;
00874     bool eraseRoot = false;
00875     query.item = root;
00876     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00877     if(root == 0L)
00878     {
00879         root = query.item;
00880         eraseRoot = true;
00881     }
00882
00883     if(root == 0L)
00884         return;
00885
00886     UTREEITEM childItem = query.child;
00887
00888     // erase all the childs
00889     while(childItem != 0L)
00890     {
00891         UTREE_INFO queryChild;
00892         queryChild.item = childItem;
00893         UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &queryChild);
00894
00895         EntnodeData *data = (EntnodeData *)queryChild.data;
00896         if(data != 0L)
00897         {
00898             queryChild.data = 0L; // So that subsequent references after UnRef() won't SEGV
00899             UEventSendMessage(GetWidID(), EV_TREE_SETDATA, kUMainWidget, &queryChild);
00900             data->UnRef();  // Or move this one after DeleteAllItems? so we don't loose one system call. For now, safe way
00901         }
00902
00903         DeleteAllItems(childItem);
00904
00905         UEventSendMessage(GetWidID(), EV_TREE_DELETE, kUMainWidget, childItem);
00906         childItem = queryChild.next;
00907     }
00908
00909     // erase the root only if initially root was 0L
00910     if(eraseRoot)
00911     {
00912         EntnodeData *data = (EntnodeData *)query.data;
00913         ASSERT(data == 0L);
00914
00915         UEventSendMessage(GetWidID(), EV_TREE_DELETE, kUMainWidget, root);
00916     }
00917 }
00918
00919 bool UCvsFolders::DisableGeneric()
00920 {
00921     UCvsApp *app = UCvsApp::gApp;
00922     return app->IsCvsRunning() || gCvsPrefs.empty() || !HasFocus();
00923 }
00924
00925 void UCvsFolders::OnUpdateGeneric(UCmdUI* pCmdUI, bool needCvsInfos)
00926 {
00927     if(DisableGeneric())
00928     {
00929         pCmdUI->Enable(false);
00930         return;
00931     }
00932
00933     UTREEITEM *item;
00934     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
00935     if(item == 0L)
00936     {
00937         pCmdUI->Enable(false);
00938         return;
00939     }
00940
00941     UStr path;
00942     RetrievePath(item, path);
00943     if(!path.endsWith(kPathDelimiter))
00944         path << kPathDelimiter;
00945     path << "CVS";
00946
00947     struct stat sb;
00948     if (stat(path, &sb) == -1 || !S_ISDIR(sb.st_mode))
00949         pCmdUI->Enable(!needCvsInfos);
00950     else
00951         pCmdUI->Enable(needCvsInfos);
00952 }
00953
00954 int UCvsFolders::OnCmdUpdate(void)
00955 {
00956     UTREEITEM *item;
00957     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
00958     ASSERT(item != 0L);
00959
00960     UStr path;
00961     RetrievePath(item, path);
00962     CvsCmdUpdateFolder(path);
00963     return 0;
00964 }
00965
00966 void UCvsFolders::OnCmdUIUpdate(UCmdUI *pCmdUI)
00967 {
00968     OnUpdateGeneric(pCmdUI, true);
00969 }
00970
00971 int UCvsFolders::OnCmdAdd(void)
00972 {
00973     UTREEITEM *item;
00974     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
00975     ASSERT(item != 0L);
00976
00977     UStr path;
00978     RetrievePath(item, path);
00979     CvsCmdAddFolder(path);
00980     return 0;
00981 }
00982
00983 int UCvsFolders::OnCmdCommit(void)
00984 {
00985     UTREEITEM *item;
00986     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
00987     ASSERT(item != 0L);
00988
00989     UStr path;
00990     RetrievePath(item, path);
00991     CvsCmdCommitFolder(path);
00992     return 0;
00993 }
00994
00995 int UCvsFolders::OnCmdQueryUpdate(void)
00996 {
00997     UTREEITEM *item;
00998     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
00999     ASSERT(item != 0L);
01000
01001     UStr path;
01002     RetrievePath(item, path);
01003     CvsCmdUpdateFolder(path, true);
01004     return 0;
01005 }
01006
01007 int UCvsFolders::OnCmdDiff(void)
01008 {
01009     UTREEITEM *item;
01010     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01011     ASSERT(item != 0L);
01012
01013     UStr path;
01014     RetrievePath(item, path);
01015     CvsCmdDiffFolder(path);
01016     return 0;
01017 }
01018
01019 int UCvsFolders::OnCmdLog(void)
01020 {
01021     UTREEITEM *item;
01022     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01023     ASSERT(item != 0L);
01024
01025     UStr path;
01026     RetrievePath(item, path);
01027     CvsCmdLogFolder(path);
01028     return 0;
01029 }
01030
01031 int UCvsFolders::OnCmdStatus(void)
01032 {
01033     UTREEITEM *item;
01034     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01035     ASSERT(item != 0L);
01036
01037     UStr path;
01038     RetrievePath(item, path);
01039     CvsCmdStatusFolder(path);
01040     return 0;
01041 }
01042
01043 int UCvsFolders::OnCmdLock(void)
01044 {
01045     UTREEITEM *item;
01046     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01047     ASSERT(item != 0L);
01048
01049     UStr path;
01050     RetrievePath(item, path);
01051     CvsCmdLockFolder(path);
01052     return 0;
01053 }
01054
01055 int UCvsFolders::OnCmdUnlock(void)
01056 {
01057     UTREEITEM *item;
01058     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01059     ASSERT(item != 0L);
01060
01061     UStr path;
01062     RetrievePath(item, path);
01063     CvsCmdUnlockFolder(path);
01064     return 0;
01065 }
01066
01067 int UCvsFolders::OnCmdWatchOn(void)
01068 {
01069     UTREEITEM *item;
01070     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01071     ASSERT(item != 0L);
01072
01073     UStr path;
01074     RetrievePath(item, path);
01075     CvsCmdWatchOnFolder(path);
01076     return 0;
01077 }
01078
01079 int UCvsFolders::OnCmdWatchOff(void)
01080 {
01081     UTREEITEM *item;
01082     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01083     ASSERT(item != 0L);
01084
01085     UStr path;
01086     RetrievePath(item, path);
01087     CvsCmdWatchOffFolder(path);
01088     return 0;
01089 }
01090
01091 int UCvsFolders::OnCmdEdit(void)
01092 {
01093     UTREEITEM *item;
01094     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01095     ASSERT(item != 0L);
01096
01097     UStr path;
01098     RetrievePath(item, path);
01099     CvsCmdEditFolder(path);
01100     return 0;
01101 }
01102
01103 int UCvsFolders::OnCmdUnedit(void)
01104 {
01105     UTREEITEM *item;
01106     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01107     ASSERT(item != 0L);
01108
01109     UStr path;
01110     RetrievePath(item, path);
01111     CvsCmdUneditFolder(path);
01112     return 0;
01113 }
01114
01115 int UCvsFolders::OnCmdWatchers(void)
01116 {
01117     UTREEITEM *item;
01118     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01119     ASSERT(item != 0L);
01120
01121     UStr path;
01122     RetrievePath(item, path);
01123     CvsCmdWatchersFolder(path);
01124     return 0;
01125 }
01126
01127 int UCvsFolders::OnCmdEditors(void)
01128 {
01129     UTREEITEM *item;
01130     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01131     ASSERT(item != 0L);
01132
01133     UStr path;
01134     RetrievePath(item, path);
01135     CvsCmdEditorsFolder(path);
01136     return 0;
01137 }
01138
01139 int UCvsFolders::OnCmdRelease(void)
01140 {
01141     UTREEITEM *item;
01142     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01143     ASSERT(item != 0L);
01144
01145     UStr path;
01146     RetrievePath(item, path);
01147     CvsCmdReleaseFolder(path);
01148     return 0;
01149 }
01150
01151 int UCvsFolders::OnCmdTagNew(void)
01152 {
01153     UTREEITEM *item;
01154     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01155     ASSERT(item != 0L);
01156
01157     UStr path;
01158     RetrievePath(item, path);
01159     CvsCmdTagCreateFolder(path);
01160     return 0;
01161 }
01162
01163 int UCvsFolders::OnCmdTagDelete(void)
01164 {
01165     UTREEITEM *item;
01166     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01167     ASSERT(item != 0L);
01168
01169     UStr path;
01170     RetrievePath(item, path);
01171     CvsCmdTagDeleteFolder(path);
01172     return 0;
01173 }
01174
01175 int UCvsFolders::OnCmdTagBranch(void)
01176 {
01177     UTREEITEM *item;
01178     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01179     ASSERT(item != 0L);
01180
01181     UStr path;
01182     RetrievePath(item, path);
01183     CvsCmdTagBranchFolder(path);
01184     return 0;
01185 }
01186
01187 int UCvsFolders::OnCmdExplore(void)
01188 {
01189     UTREEITEM *item;
01190     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01191     ASSERT(item != 0L);
01192
01193     UStr path;
01194     RetrievePath(item, path);
01195
01196 #ifdef WIN32
01197     HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), "explore", path,
01198             0L, 0L, SW_SHOWDEFAULT);
01199     if((long)hInst < 32)
01200     {
01201         cvs_err("Unable to explore '%s' (error %d)\n", (const char *)path, GetLastError());
01202     }
01203 #endif
01204 #ifdef qUnix
01205     CvsArgs args(false);
01206     args.add(gCvsPrefs.Browser());
01207     args.add(path);
01208     UCvsApp::gApp->Execute(args.Argc(), args.Argv());
01209 #endif
01210
01211     return 0;
01212 }
01213
01214 int UCvsFolders::OnCmdReload(void)
01215 {
01216     ResetView(true);
01217     return 0;
01218 }
01219
01220 int UCvsFolders::OnCmdIgnore(void)
01221 {
01222     gFileViewIgnore = !(bool)gFileViewIgnore;
01223     ResetView(true, true);
01224     return 0;
01225 }
01226
01227 int UCvsFolders::OnCmdCheckout(void)
01228 {
01229     CvsCmdCheckoutModule();
01230     return 0;
01231 }
01232
01233 int UCvsFolders::OnCmdImport(void)
01234 {
01235     CvsCmdImportModule();
01236     return 0;
01237 }
01238
01239 void UCvsFolders::OnCmdUIAdd(UCmdUI *pCmdUI)
01240 {
01241     OnUpdateGeneric(pCmdUI, false);
01242 }
01243
01244 void UCvsFolders::OnCmdUIExplore(UCmdUI *pCmdUI)
01245 {
01246     if(DisableGeneric())
01247     {
01248         pCmdUI->Enable(false);
01249         return;
01250     }
01251     UTREEITEM selItem;
01252     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &selItem);
01253     pCmdUI->Enable(selItem != 0L);
01254 }
01255
01256 void UCvsFolders::OnCmdUIReload(UCmdUI *pCmdUI)
01257 {
01258     UCvsApp *app = UCvsApp::gApp;
01259     pCmdUI->Enable(!app->IsCvsRunning());
01260 }
01261
01262 void UCvsFolders::OnCmdUIIgnore(UCmdUI *pCmdUI)
01263 {
01264     pCmdUI->Enable(!DisableGeneric());
01265     pCmdUI->Check(gFileViewIgnore);
01266 }
01267
01268 void UCvsFolders::OnCmdUICheckout(UCmdUI *pCmdUI)
01269 {
01270     UCvsApp *app = UCvsApp::gApp;
01271     pCmdUI->Enable(!app->IsCvsRunning() && !gCvsPrefs.empty());
01272 }
01273
01274 void UCvsFolders::OnCmdUIImport(UCmdUI *pCmdUI)
01275 {
01276     UCvsApp *app = UCvsApp::gApp;
01277     pCmdUI->Enable(!app->IsCvsRunning() && !gCvsPrefs.empty());
01278 }
01279
01280 void UCvsFolders::OnCmdUIMacrosSel(int cmd, UCmdUI *pCmdUI)
01281 {
01282     if(DisableGeneric())
01283     {
01284         pCmdUI->Enable(false);
01285         return;
01286     }
01287     UTREEITEM selItem;
01288     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &selItem);
01289     pCmdUI->Enable(selItem != 0L && CTcl_Interp::IsAvail());
01290 }
01291
01292 int UCvsFolders::OnCmdMacrosSel(int cmd)
01293 {
01294     CTcl_Interp interp;
01295     CMacroEntry & entry = gMacrosSel.entries[cmd - cmdSELMACRO];
01296     CStr path = entry.path;
01297     CTcl_Interp::Unixfy(path);
01298
01299     UTREEITEM selItem;
01300     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &selItem);
01301
01302     CStr selPath;
01303     RetrievePath(selItem, selPath);
01304     CStr uppath, folder;
01305     SplitPath(selPath, uppath, folder);
01306
01307     UTREE_INFO query;
01308     query.item = selItem;
01309     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
01310     bool deleteData = false;
01311     EntnodeData *data = (EntnodeData *)query.data;
01312     if(data == 0L)
01313     {
01314         deleteData = true;
01315         EntnodePath *apath = new EntnodePath(uppath);
01316         data = new EntnodeFolder(folder, apath);
01317         apath->UnRef();
01318     }
01319
01320     TclBrowserReset();
01321     TclBrowserAppend(uppath, data);
01322
01323     interp.DoScriptVar("source \"%s\"", (const char *)path);
01324
01325     if(deleteData)
01326         data->UnRef();
01327
01328     return 0;
01329 }
Generated on Sun Oct 21 12:41:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsFolders.h Source File

common/UCvsFolders.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #ifndef UCVSFOLDER_H
00026 #define UCVSFOLDER_H
00027
00028 #include "uwidget.h"
00029
00030 class UCvsFolders : public UWidget
00031 {
00032     UDECLARE_DYNAMIC(UCvsFolders)
00033 public:
00034     UCvsFolders();
00035     virtual ~UCvsFolders();
00036
00037     void ResetBrowser(const char *path, bool notifyView = false);
00038         // set the browser root path.
00039
00040     inline const char *GetRoot(void) const { return m_root; }
00041         // get the base of the browser
00042
00043     static void SetDefaultRoot(const char *root);
00044         // set the opening root
00045
00046     void RetrievePath(UTREEITEM item, UStr & path);
00047         // given an item of the tree, guess the full path.
00048
00049     void StepToLocation(const char *path, bool notifyView = false);
00050         // expand and select the path and optionally synchronize the
00051         // file view.
00052
00053     void DeleteAllItems(UTREEITEM root = 0L);
00054         // used when resetting and take care about our item data
00055         // if root != 0L : delete all childs of root (except root)
00056         // if root == 0L : delete all
00057
00058     void ResetView(bool forceReload = false, bool notifyView = false);
00059         // force reload or check modifications before redrawing
00060         // and optionally synchronize the file view.
00061 protected:
00062     UStr m_root;
00063         // current path of the browser
00064
00065     void OnUpdateGeneric(UCmdUI* pCmdUI, bool needCvsInfos);
00066     bool DisableGeneric();
00067         // used for the handling of EV_UPDTCMD
00068
00069     void StoreExpanded(std::vector<UStr> & allExpanded, UTREEITEM root = 0L);
00070     UTREEITEM GetItemByLocation(const char *path);
00071         // used internally
00072
00073     ev_msg void OnDestroy();
00074     ev_msg void OnCreate();
00075     ev_msg void OnTreeExpanding(int collapse, UTREEITEM item);
00076     ev_msg void OnTreeSelecting(int deselect, UTREEITEM item);
00077     ev_msg void OnCmdUIMacrosSel(int cmd, UCmdUI *pCmdUI);
00078     ev_msg void OnCmdUIUpdate(UCmdUI *pCmdUI);
00079     ev_msg void OnCmdUIAdd(UCmdUI *pCmdUI);
00080     ev_msg void OnCmdUIExplore(UCmdUI *pCmdUI);
00081     ev_msg void OnCmdUIReload(UCmdUI *pCmdUI);
00082     ev_msg void OnCmdUIIgnore(UCmdUI *pCmdUI);
00083     ev_msg void OnCmdUICheckout(UCmdUI *pCmdUI);
00084     ev_msg void OnCmdUIImport(UCmdUI *pCmdUI);
00085     ev_msg int OnCmdUpdate(void);
00086     ev_msg int OnCmdAdd(void);
00087     ev_msg int OnCmdCommit(void);
00088     ev_msg int OnCmdQueryUpdate(void);
00089     ev_msg int OnCmdDiff(void);
00090     ev_msg int OnCmdLog(void);
00091     ev_msg int OnCmdStatus(void);
00092     ev_msg int OnCmdLock(void);
00093     ev_msg int OnCmdUnlock(void);
00094     ev_msg int OnCmdWatchOn(void);
00095     ev_msg int OnCmdWatchOff(void);
00096     ev_msg int OnCmdEdit(void);
00097     ev_msg int OnCmdUnedit(void);
00098     ev_msg int OnCmdWatchers(void);
00099     ev_msg int OnCmdEditors(void);
00100     ev_msg int OnCmdRelease(void);
00101     ev_msg int OnCmdTagNew(void);
00102     ev_msg int OnCmdTagDelete(void);
00103     ev_msg int OnCmdTagBranch(void);
00104     ev_msg int OnCmdExplore(void);
00105     ev_msg int OnCmdReload(void);
00106     ev_msg int OnCmdIgnore(void);
00107     ev_msg int OnCmdCheckout(void);
00108     ev_msg int OnCmdImport(void);
00109     ev_msg int OnCmdMacrosSel(int cmd);
00110
00111     UDECLARE_MESSAGE_MAP()
00112 };
00113
00114 #endif
Generated on Sun Oct 21 12:41:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsFrame.cpp Source File

common/UCvsFrame.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #if qGTK
00028 #   include <gtk/gtk.h>
00029 #endif
00030
00031 #include "UCvsFrame.h"
00032 #include "UCvsApp.h"
00033 #include "UCvsCommands.h"
00034 #include "UCvsFolders.h"
00035 #include "CvsAlert.h"
00036 #include "PromptFiles.h"
00037 #include "CvsPrefs.h"
00038 #include "AppConsole.h"
00039 #include "CvsCommands.h"
00040 #include "TclGlue.h"
00041 #include "MacrosSetup.h"
00042 #include "GetPrefs.h"
00043 #include "UCvsDialogs.h"
00044
00045 UIMPLEMENT_DYNAMIC(UCvsFrame, UWidget)
00046
00047 UBEGIN_MESSAGE_MAP(UCvsFrame, UWidget)
00048     ON_UUPDATECMD_RANGE(cmdCREDITS, cmdCOPYRIGHTS, UCvsFrame::OnCmdUIAnytime)
00049     ON_UUPDATECMD_RANGE(UCvsFrame::kDirCombo, UCvsFrame::kBrowserPopup, UCvsFrame::OnCmdUIAnytime)
00050     ON_UUPDATECMD(cmdEXIT, UCvsFrame::OnCmdUIQuit)
00051     ON_UUPDATECMD_RANGE(cmdPREFERENCES, cmdPREFERENCES, UCvsFrame::OnCmdUIAnytime)
00052     ON_UUPDATECMD(cmdSTOPCVS, UCvsFrame::OnCmdUIStopcvs)
00053     ON_UUPDATECMD(cmdRTAGCREATE, UCvsFrame::OnCmdUICvsCmd)
00054     ON_UUPDATECMD(cmdSAVESETTINGS, UCvsFrame::OnCmdUICvsCmd)
00055     ON_UUPDATECMD(cmdINIT, UCvsFrame::OnCmdUICvsCmd)
00056     ON_UUPDATECMD(cmdRTAGDELETE, UCvsFrame::OnCmdUICvsCmd)
00057     ON_UUPDATECMD(cmdRTAGBRANCH, UCvsFrame::OnCmdUICvsCmd)
00058     ON_UUPDATECMD(cmdCMDLINE, UCvsFrame::OnCmdUICvsCmd)
00059     ON_UUPDATECMD(cmdLOGIN, UCvsFrame::OnCmdUICvsCmd)
00060     ON_UUPDATECMD(cmdLOGOUT, UCvsFrame::OnCmdUICvsCmd)
00061     ON_UUPDATECMD_RANGE(cmdMACROADMIN, cmdMACROADMINEND, UCvsFrame::OnCmdUIMacroAdmin)
00062     ON_COMBO_SEL(UCvsFrame::kDirCombo, UCvsFrame::OnComboSelDir)
00063     ON_UCOMMAND(UCvsFrame::kBrowserPopup, UCvsFrame::OnBrowserPopup)
00064     ON_UCOMMAND(cmdCOPYRIGHTS, UCvsFrame::OnCopyrights)
00065     ON_UCOMMAND(cmdCREDITS, UCvsFrame::OnCredits)
00066     ON_UCOMMAND(cmdEXIT, UCvsFrame::OnQuit)
00067     ON_UCOMMAND(cmdPREFERENCES, UCvsFrame::OnCmdPreferences)
00068     ON_UCOMMAND(cmdSAVESETTINGS, UCvsFrame::OnCmdSaveSettings)
00069     ON_UCOMMAND(cmdRTAGCREATE, UCvsFrame::OnCmdRtagNew)
00070     ON_UCOMMAND(cmdRTAGDELETE, UCvsFrame::OnCmdRtagDelete)
00071     ON_UCOMMAND(cmdRTAGBRANCH, UCvsFrame::OnCmdRtagBranch)
00072     ON_UCOMMAND(cmdCMDLINE, UCvsFrame::OnCmdCmdline)
00073     ON_UCOMMAND(cmdLOGIN, UCvsFrame::OnCmdLogin)
00074     ON_UCOMMAND(cmdLOGOUT, UCvsFrame::OnCmdLogout)
00075     ON_UCOMMAND(cmdSTOPCVS, UCvsFrame::OnCmdStopcvs)
00076     ON_UCOMMAND(cmdINIT, UCvsFrame::OnCmdInit)
00077     ON_UCOMMAND_RANGE(cmdMACROADMIN, cmdMACROADMINEND, UCvsFrame::OnCmdMacroAdmin)
00078     ON_UDESTROY(UCvsFrame)
00079 UEND_MESSAGE_MAP()
00080
00081 #if 0
00082     //}}AFX_MSG_MAP
00083     // Enable default OLE container implementation
00084     //ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, CDocument::OnUpdatePasteMenu)
00085     ON_COMMAND_EX_RANGE(ID_MACRO_ADMIN, ID_MACRO_ADMIN + 99, OnMacroAdmin)
00086     ON_COMMAND(ID_FILE_SEND_MAIL, OnFileSendMail)
00087     ON_UPDATE_COMMAND_UI(ID_FILE_SEND_MAIL, OnUpdateFileSendMail)
00088 #endif
00089
00090 UCvsFrame::UCvsFrame() : UWidget(kUCvsFrameID)
00091 {
00092 }
00093
00094 UCvsFrame::~UCvsFrame()
00095 {
00096 }
00097
00098 void UCvsFrame::OnDestroy(void)
00099 {
00100 #if qGTK
00101     gtk_main_quit();
00102 #endif /* qGTK */
00103     delete this;
00104 }
00105
00106 bool UCvsFrame::AskForQuitting(void)
00107 {
00108     bool res = true;
00109
00110     if(UCvsApp::gApp->IsCvsRunning())
00111         res = !CvsAlert("Cvs is currently running. Are-you sure you want to quit ?", "Cancel", "Quit");
00112
00113     gCvsPrefs.save();
00114
00115     return res;
00116 }
00117
00118 void UCvsFrame::OnComboSelDir(int pos, const char *txt)
00119 {
00120     UCvsApp::gApp->GetBrowserView()->ResetBrowser(txt, true);
00121 }
00122
00123 int UCvsFrame::OnBrowserPopup(void)
00124 {
00125     const char *newPath =
00126         BrowserGetDirectory("Select a folder to open with the browser");
00127     if(newPath == 0L)
00128         return 0;
00129
00130     UCvsApp::gApp->GetBrowserView()->ResetBrowser(newPath, true);
00131
00132     return 0;
00133 }
00134
00135 int UCvsFrame::OnQuit(void)
00136 {
00137     if(!AskForQuitting())
00138         return 0;
00139
00140 #if qGTK
00141     gtk_main_quit();
00142 #endif /* qGTK */
00143
00144     return 0;
00145 }
00146
00147 void UCvsFrame::OnCmdUIQuit(UCmdUI *pCmdUI)
00148 {
00149     pCmdUI->Enable(true);
00150 }
00151
00152 void UCvsFrame::OnCmdUIAnytime(int cmd, UCmdUI *pCmdUI)
00153 {
00154     pCmdUI->Enable(!UCvsApp::gApp->IsCvsRunning());
00155 }
00156
00157 int UCvsFrame::OnCopyrights()
00158 {
00159     const char *appName = UCvsApp::gApp->GetAppName();
00160
00161     cvs_out("\nBoth %s and CVS are distributed under the terms of\n", appName);
00162     cvs_out("the GNU General Public Licence (GPL).\n\n");
00163     cvs_out("* %s : maintained by Alexandre Parenteau (aubonbeurre@hotmail.com)\n", appName);
00164     cvs_out("* CVS : Copyright © 1989-1998 Brian Berliner, david d `zoo' zuhn,\n");
00165     cvs_out("        Jeff Polk, and other authors\n");
00166 #ifdef macintosh
00167     printf("* MacCVS : Mike Ladwig, Matthias Neeracher, Alexandre Parenteau\n");
00168     printf("* GUSI : Copyright © 1992-1997 Matthias Neeracher\n");
00169     printf("* Waste : Copyright © 1993-1998 Marco Piovanelli\n");
00170     printf("* CWASTEEdit : Copyright © 1995-1997 Timothy Paustian\n");
00171     printf("* ABalloon : Freeware of James W. Walker (jwwalker@kagi.com)\n");
00172     printf("* Metrowerks Standard Library, PowerPlant & CodeWarrior :\n");
00173     printf("    Copyright © 1996-1997 Metrowerks Inc.\n");
00174     printf("* MPW, MoreFiles : Copyright © Apple Computer Inc.\n");
00175 #endif
00176 #ifdef WIN32
00177     cvs_out("* WinCvs documentation : Copyright © 1999 Don Harper <don@lamrc.com>.\n");
00178     cvs_out("* CJLIB : Copyright © 1998-99 Kirk Stowell <kstowell@codejockeys.com>\n");
00179     cvs_out("* MFC : Copyright © 1992-1997 Microsoft Corporation\n");
00180 #endif
00181     cvs_out("* Kerberos : Copyright © 1997 the Massachusetts Institute of Technology\n");
00182     cvs_out("* TCL : Copyright © Sun Microsystems Inc.\n");
00183     cvs_out("\nSome others copyrights may apply, check the source code for details.\n");
00184     return 0;
00185 }
00186
00187 int UCvsFrame::OnCredits()
00188 {
00189     const char *appName = UCvsApp::gApp->GetAppName();
00190     const char *appVers = UCvsApp::gApp->GetAppVersion();
00191
00192 #ifndef macintosh
00193     cvs_out("\n%s %s - Client/Local\n", appName, appVers);
00194 #else
00195     cvs_out("\n%s %s - Client\n", appName, appVers);
00196 #endif
00197     cvs_out("%s is maintained by Alexandre Parenteau\n", appName);
00198     cvs_out("- WinCvs/MacCvs/gcvs page : http://www.wincvs.org\n");
00199     cvs_out("- cvs page : http://www.cyclic.com\n");
00200 #ifdef WIN32
00201     cvs_out("- WinCvs documentation : Don Harper <don@lamrc.com>.\n");
00202     cvs_out("- WinHelp cvs documentation : Norbert Klamann.\n");
00203 #endif
00204 #ifdef macintosh
00205     printf("- Mac port :\n");
00206     printf("\t* Mike Ladwig <mike@twinpeaks.prc.com>\n");
00207     printf("\t* Matthias Neeracher <neeri@iis.ee.ethz.ch>\n");
00208     printf("\t* Alexandre Parenteau <aubonbeurre@hotmail.com>\n");
00209     printf("- With contributions of :\n");
00210     printf("\t* Miro Jurisic <meeroh@mit.edu> (Kerberos)\n");
00211     printf("\t* Aleks Totic <atotic@netscape.com> (AppleSingle)\n");
00212     printf("\t* Jocelyn Houle <houlejo@IRO.UMontreal.CA> (Help balloons)\n");
00213 #endif
00214     cvs_out("- Special thanks to :\n");
00215     cvs_out("\t* Gary Bringhurst from C3D Digital who gives me time, resources,\n");
00216     cvs_out("\t  help and ideas for doing this project (http://www.3d.com)\n");
00217     cvs_out("\t* The Freeware community for providing cvs, Linux, Perl, GTK, gcc\n");
00218     cvs_out("\t  and so many others valuables tools\n");
00219     cvs_out("\t* The users of the CvsGui project (WinCvs, MacCvs, gcvs) who have\n");
00220     cvs_out("\t  defined all the functionnalities and help every day to enhance it\n");
00221     cvs_out("- Cvs contributors :\n");
00222     cvs_out("\t* Too many to be listed here, see the 'ChangeLog' instead !\n");
00223     return 0;
00224 }
00225
00226 int UCvsFrame::OnCmdPreferences(void)
00227 {
00228     CompatGetPrefs();
00229     return 0;
00230 }
00231
00232 int UCvsFrame::OnCmdSaveSettings(void)
00233 {
00234     UCvsFolders *browser = UCvsApp::gApp->GetBrowserView();
00235     if(browser != 0L && browser->GetRoot() != 0L)
00236         AskCreatePersistentSettings(browser->GetRoot());
00237     return 0;
00238 }
00239
00240 int UCvsFrame::OnCmdRtagNew(void)
00241 {
00242     CvsCmdRtagCreate();
00243     return 0;
00244 }
00245
00246 int UCvsFrame::OnCmdRtagDelete(void)
00247 {
00248     CvsCmdRtagDelete();
00249     return 0;
00250 }
00251
00252 int UCvsFrame::OnCmdRtagBranch(void)
00253 {
00254     CvsCmdRtagBranch();
00255     return 0;
00256 }
00257
00258 int UCvsFrame::OnCmdCmdline(void)
00259 {
00260     CvsCmdLine();
00261     return 0;
00262 }
00263
00264 int UCvsFrame::OnCmdLogin(void)
00265 {
00266     CvsCmdLogin();
00267     return 0;
00268 }
00269
00270 int UCvsFrame::OnCmdLogout(void)
00271 {
00272     CvsCmdLogout();
00273     return 0;
00274 }
00275
00276 int UCvsFrame::OnCmdStopcvs(void)
00277 {
00278     UCvsApp::gApp->SetCvsStopping(true);
00279     if(UCvsApp::gCurCvs != 0L && cvs_process_is_active(UCvsApp::gCurCvs))
00280     {
00281         cvs_process_kill(UCvsApp::gCurCvs);
00282         cvs_out("*****CVS stopped on user request !!! *****\n\n");
00283     }
00284
00285     return 0;
00286 }
00287
00288 int UCvsFrame::OnCmdInit(void)
00289 {
00290     CvsCmdInit();
00291     return 0;
00292 }
00293
00294 int UCvsFrame::OnCmdMacroAdmin(int cmd)
00295 {
00296     CMacroEntry & entry = gMacrosAdmin.entries[cmd - cmdMACROADMIN];
00297     CvsCmdMacrosAdmin(entry.path);
00298     return 0;
00299 }
00300
00301 void UCvsFrame::OnCmdUIStopcvs(UCmdUI *pCmdUI)
00302 {
00303     UCvsApp *app = UCvsApp::gApp;
00304     pCmdUI->Enable(app->IsCvsRunning() && !app->IsCvsStopping());
00305 }
00306
00307 void UCvsFrame::OnCmdUICvsCmd(UCmdUI *pCmdUI)
00308 {
00309     pCmdUI->Enable(!UCvsApp::gApp->IsCvsRunning() && !gCvsPrefs.empty());
00310 }
00311
00312 void UCvsFrame::OnCmdUIMacroAdmin(int cmd, UCmdUI *pCmdUI)
00313 {
00314     pCmdUI->Enable(!UCvsApp::gApp->IsCvsRunning() && !gCvsPrefs.empty() && CTcl_Interp::IsAvail());
00315 }
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsFrame.h Source File

common/UCvsFrame.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #ifndef UCVSFRAME_H
00026 #define UCVSFRAME_H
00027
00028 #include "uwidget.h"
00029 #include "UCvsCommands.h"
00030
00031 class UCvsFrame : public UWidget
00032 {
00033     UDECLARE_DYNAMIC(UCvsFrame)
00034 public:
00035     UCvsFrame();
00036     virtual ~UCvsFrame();
00037
00038     bool AskForQuitting(void);
00039         // true if we can quit the application
00040
00041     enum
00042     {
00043         kDirCombo = EV_COMMAND_START,   // 0
00044         kBrowserPopup                   // 1
00045     };
00046
00047 protected:
00048     ev_msg void OnCmdUIAnytime(int cmd, UCmdUI *pCmdUI);
00049     ev_msg void OnCmdUIQuit(UCmdUI *pCmdUI);
00050     ev_msg void OnCmdUIStopcvs(UCmdUI *pCmdUI);
00051     ev_msg void OnCmdUICvsCmd(UCmdUI *pCmdUI);
00052     ev_msg void OnCmdUIMacroAdmin(int cmd, UCmdUI *pCmdUI);
00053     ev_msg void OnDestroy(void);
00054     ev_msg int OnQuit(void);
00055     ev_msg int OnCopyrights(void);
00056     ev_msg int OnCredits(void);
00057     ev_msg void OnComboSelDir(int pos, const char *txt);
00058     ev_msg int OnBrowserPopup(void);
00059     ev_msg int OnCmdPreferences(void);
00060     ev_msg int OnCmdSaveSettings(void);
00061     ev_msg int OnCmdRtagNew(void);
00062     ev_msg int OnCmdRtagDelete(void);
00063     ev_msg int OnCmdRtagBranch(void);
00064     ev_msg int OnCmdCmdline(void);
00065     ev_msg int OnCmdLogin(void);
00066     ev_msg int OnCmdLogout(void);
00067     ev_msg int OnCmdStopcvs(void);
00068     ev_msg int OnCmdInit(void);
00069     ev_msg int OnCmdMacroAdmin(int cmd);
00070
00071     UDECLARE_MESSAGE_MAP()
00072 };
00073
00074 // little class to get the cursor to wait during the existence of the object
00075 class UWaitCursor
00076 {
00077 public:
00078     UWaitCursor()
00079     {
00080         UEventSendMessage(kUCvsFrameID, EV_CHGCURSOR, UMAKEINT(kUMainWidget, uCursWatch), 0L);
00081     }
00082     virtual ~UWaitCursor()
00083     {
00084         UEventSendMessage(kUCvsFrameID, EV_CHGCURSOR, UMAKEINT(kUMainWidget, uCursArrow), 0L);
00085     }
00086 };
00087
00088 #endif
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsGraph.cpp Source File

common/UCvsGraph.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include <sys/stat.h>
00028
00029 #ifdef HAVE_UNISTD_H
00030 #include <unistd.h>
00031 #endif
00032
00033 #include "UCvsGraph.h"
00034 #include "UCvsFiles.h"
00035 #include "CvsEntries.h"
00036 #include "CvsLog.h"
00037 #include "AppConsole.h"
00038 #include "udraw.h"
00039
00040 UIMPLEMENT_DYNAMIC(UCvsGraph, UWidget)
00041
00042 UBEGIN_MESSAGE_MAP(UCvsGraph, UWidget)
00043     ON_UDESTROY(UCvsGraph)
00044     ON_UCREATE(UCvsGraph)
00045     ON_CUSTOM_DRAW(UCvsGraph::kDrawing, UCvsGraph::OnDrawing)
00046 UEND_MESSAGE_MAP()
00047
00048 UCvsGraph::UCvsGraph(CLogNode *node, const char *dir) :
00049     UWidget(::UEventGetWidID()), m_node(node), m_dir(dir), m_data(0L)
00050 {
00051     // get the CVS/Entries infos for this file
00052     CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00053     if(!Entries_Open (entries, dir))
00054     {
00055         cvs_err("Warning : Error while accessing the CVS folder in '%s'\n", dir);
00056     }
00057     else
00058     {
00059         if(node->GetType() != kNodeHeader)
00060         {
00061             cvs_err("Warning : Top node is not a RCS file description !\n");
00062         }
00063         else
00064         {
00065             const char *name = (**(CLogNodeHeader *)node).WorkingFile();
00066             struct stat sb;
00067             if (stat(name, &sb) == -1)
00068             {
00069                 cvs_err("Warning : Unknown file '%s'\n", name);
00070             }
00071             else
00072             {
00073                 m_data = Entries_SetVisited(dir, entries, name, sb, false);
00074                 m_data->Ref();
00075                 m_name = name;
00076             }
00077         }
00078     }
00079 }
00080
00081 UCvsGraph::~UCvsGraph()
00082 {
00083     if(m_node != 0L)
00084         delete m_node;
00085     if(m_data != 0L)
00086         m_data->UnRef();
00087 }
00088
00089 void UCvsGraph::OnDestroy(void)
00090 {
00091     delete this;
00092 }
00093
00094 void UCvsGraph::OnCreate(void)
00095 {
00096     UStr title("Graph log : ");
00097     title << m_name;
00098     UEventSendMessage(GetWidID(), EV_SETTEXT, kUMainWidget, (void *)(const char *)title);
00099 }
00100
00101 class CScrollView
00102 {
00103 public:
00104     UPoint GetDeviceScrollPosition() { return UPoint(0, 0); }
00105     void InvalidateRect(const URECT *r) {}
00106 };
00107
00108 class CWinLogData : public CLogNodeData
00109 {
00110 public:
00111     CWinLogData(CLogNode *node);
00112     virtual ~CWinLogData();
00113
00114     inline kLogNode GetType(void) const { return fNode->GetType(); }
00115     const char *GetStr(void);
00116
00117     void ComputeBounds(const UPoint & topLeft, UDC & hdc,
00118         EntnodeData *entryInfo = 0L);
00119     void Offset(UPoint o);
00120     void Update(UDC & hdc, EntnodeData *entryInfo = 0L);
00121
00122     inline URect & Bounds(void) { return totB; }
00123     inline URect & SelfBounds(void) { return selfB; }
00124
00125     inline bool Selected(void) const { return sel; }
00126     void SetSelected(CScrollView *view, bool state);
00127     void UnselectAll(CScrollView *view);
00128     CWinLogData *HitTest(UPoint point);
00129
00130     static CWinLogData *CreateNewData(CLogNode *node);
00131
00132     bool IsDiskNode(EntnodeData *entryInfo);
00133
00134 protected:
00135     virtual void UpdateSelf(UDC & hdc, EntnodeData *entryInfo) = 0;
00136     virtual USize GetBoundsSelf(UDC & hdc, EntnodeData *entryInfo) = 0;
00137
00138     inline CWinLogData *GetData(CLogNode *node)
00139         { return (CWinLogData *)node->GetUserData(); }
00140
00141     URect selfB;
00142     URect totB;
00143     bool sel;
00144 };
00145
00146 class CWinLogHeaderData : public CWinLogData
00147 {
00148 public:
00149     CWinLogHeaderData(CLogNode *node) : CWinLogData(node) {}
00150     virtual ~CWinLogHeaderData() {}
00151
00152 protected:
00153     virtual void UpdateSelf(UDC & hdc, EntnodeData *entryInfo);
00154     virtual USize GetBoundsSelf(UDC & hdc, EntnodeData *entryInfo);
00155 };
00156
00157 class CWinLogRevData : public CWinLogData
00158 {
00159 public:
00160     CWinLogRevData(CLogNode *node) : CWinLogData(node) {}
00161     virtual ~CWinLogRevData() {}
00162
00163 protected:
00164     virtual void UpdateSelf(UDC & hdc, EntnodeData *entryInfo);
00165     virtual USize GetBoundsSelf(UDC & hdc, EntnodeData *entryInfo);
00166 };
00167
00168 class CWinLogTagData : public CWinLogData
00169 {
00170 public:
00171     CWinLogTagData(CLogNode *node) : CWinLogData(node) {}
00172     virtual ~CWinLogTagData() {}
00173
00174 protected:
00175     virtual void UpdateSelf(UDC & hdc, EntnodeData *entryInfo);
00176     virtual USize GetBoundsSelf(UDC & hdc, EntnodeData *entryInfo);
00177 };
00178
00179 class CWinLogBranchData : public CWinLogData
00180 {
00181 public:
00182     CWinLogBranchData(CLogNode *node) : CWinLogData(node) {}
00183     virtual ~CWinLogBranchData() {}
00184
00185 protected:
00186     virtual void UpdateSelf(UDC & hdc, EntnodeData *entryInfo);
00187     virtual USize GetBoundsSelf(UDC & hdc, EntnodeData *entryInfo);
00188 };
00189
00190 USize CWinLogHeaderData::GetBoundsSelf(UDC & hdc, EntnodeData *entryInfo)
00191 {
00192     CLogNodeHeader & header = *(CLogNodeHeader *)fNode;
00193     return hdc.GetTextExtent((*header).WorkingFile(),
00194         (*header).WorkingFile().length());
00195 }
00196
00197 static void DrawNode(UDC & hdc, const URect & selfB,
00198                      UCOLORREF contour, UCOLORREF shadowc,
00199                      bool isRounded, bool issel)
00200 {
00201     UPen *pOldPen = 0L;
00202     UBrush *pOldBrush = 0L;
00203     UPen pen, pen2;
00204     UBrush brush;
00205     UCOLORREF selcolor = URGB(160, 160, 160);
00206     UCOLORREF wcolor = URGB(255, 255, 255);
00207
00208     try
00209     {
00210         if(!isRounded)
00211         {
00212             if(!issel)
00213             {
00214                 brush.CreateSolidBrush(wcolor);
00215                 pOldBrush = hdc.SelectObject(&brush);
00216                 pen.CreatePen(UPS_SOLID, 1, contour);
00217                 pOldPen = hdc.SelectObject(&pen);
00218                 hdc.Rectangle(selfB);
00219             }
00220             else
00221             {
00222                 brush.CreateSolidBrush(selcolor);
00223                 pOldBrush = hdc.SelectObject(&brush);
00224                 pen.CreatePen(UPS_SOLID, 1, contour);
00225                 pOldPen = hdc.SelectObject(&pen);
00226                 hdc.Rectangle(selfB);
00227             }
00228         }
00229         else
00230         {
00231             URect shadow;
00232             if(!issel)
00233             {
00234                 brush.CreateSolidBrush(shadowc);
00235                 pOldBrush = hdc.SelectObject(&brush);
00236                 pen.CreatePen(UPS_SOLID, 1, shadowc);
00237                 pOldPen = hdc.SelectObject(&pen);
00238                 shadow = selfB;
00239                 shadow.OffsetRect(UPoint(2, 2));
00240                 hdc.RoundRect(shadow, UPoint(6, 6));
00241
00242                 brush.DeleteObject();
00243                 brush.CreateSolidBrush(wcolor);
00244                 hdc.SelectObject(&brush);
00245                 pen2.CreatePen(UPS_SOLID, 1, contour);
00246                 hdc.SelectObject(&pen2);
00247                 hdc.RoundRect(selfB, UPoint(6, 6));
00248             }
00249             else
00250             {
00251                 brush.CreateSolidBrush(shadowc);
00252                 pOldBrush = hdc.SelectObject(&brush);
00253                 pen.CreatePen(UPS_SOLID, 1, shadowc);
00254                 pOldPen = hdc.SelectObject(&pen);
00255                 shadow = selfB;
00256                 shadow.OffsetRect(UPoint(2, 2));
00257                 hdc.RoundRect(shadow, UPoint(6, 6));
00258
00259                 brush.DeleteObject();
00260                 brush.CreateSolidBrush(selcolor);
00261                 hdc.SelectObject(&brush);
00262                 pen2.CreatePen(UPS_SOLID, 1, contour);
00263                 hdc.SelectObject(&pen2);
00264                 hdc.RoundRect(selfB, UPoint(6, 6));
00265             }
00266         }
00267
00268         if (pOldPen != 0L)
00269         {
00270             hdc.SelectObject(pOldPen);
00271             pOldPen = 0L;
00272         }
00273         if (pOldBrush != 0L)
00274         {
00275             hdc.SelectObject(pOldBrush);
00276             pOldBrush = 0L;
00277         }
00278
00279         pen.DeleteObject();
00280         pen2.DeleteObject();
00281         brush.DeleteObject();
00282     }
00283     catch(...)
00284     {
00285         if (pOldPen != 0L)
00286             hdc.SelectObject(pOldPen);
00287         if (pOldBrush != 0L)
00288             hdc.SelectObject(pOldBrush);
00289     }
00290 }
00291
00292 void CWinLogHeaderData::UpdateSelf(UDC & hdc, EntnodeData *entryInfo)
00293 {
00294     // draw the node
00295     ::DrawNode(hdc, selfB, URGB(255, 0, 0), URGB(120, 0, 0), true, sel);
00296
00297     // draw the content of the node
00298     UPoint center = selfB.CenterPoint();
00299     int nCenterX = center.x;
00300     int nCenterY = center.y - hdc.GetTextHeight()/2;
00301     CLogNodeHeader & header = *(CLogNodeHeader *)fNode;
00302     hdc.TextOutClipped(nCenterX, nCenterY, selfB,
00303         (*header).WorkingFile(), (*header).WorkingFile().length());
00304 }
00305
00306 USize CWinLogRevData::GetBoundsSelf(UDC & hdc, EntnodeData *entryInfo)
00307 {
00308     CLogNodeRev & rev = *(CLogNodeRev *)fNode;
00309     USize size = hdc.GetTextExtent((*rev).RevNum().str(),
00310         strlen((*rev).RevNum().str()));
00311     if(IsDiskNode(entryInfo))
00312     {
00313         size.cx += 2 + 16 + 2;
00314         size.cy = max(16, size.cy);
00315     }
00316     return size;
00317 }
00318
00319 void CWinLogRevData::UpdateSelf(UDC & hdc, EntnodeData *entryInfo)
00320 {
00321     URect txtRect = selfB;
00322
00323     if(IsDiskNode(entryInfo))
00324     {
00325         txtRect.left += 2 + 16 + 2;
00326     }
00327
00328     // draw the node
00329     ::DrawNode(hdc, selfB, URGB(0, 0, 255), URGB(0, 0, 0), false, sel);
00330
00331     // draw the state icon if it is the rev. of the disk
00332     if(IsDiskNode(entryInfo))
00333     {
00334         UPoint w(selfB.TopLeft());
00335         w.x += 2;
00336         w.y += (selfB.Height() - 16) / 2;
00337         hdc.DrawBitmap(UCvsFiles::GetImageForEntry(entryInfo), w);
00338     }
00339
00340     // draw the content of the node
00341     UPoint center = txtRect.CenterPoint();
00342     int nCenterX = center.x;
00343     int nCenterY = center.y - hdc.GetTextHeight()/2;
00344     CLogNodeRev & rev = *(CLogNodeRev *)fNode;
00345     hdc.TextOutClipped(nCenterX, nCenterY, txtRect,
00346             (*rev).RevNum().str(), strlen((*rev).RevNum().str()));
00347 }
00348
00349 USize CWinLogTagData::GetBoundsSelf(UDC & hdc, EntnodeData *entryInfo)
00350 {
00351     CLogNodeTag & tag = *(CLogNodeTag *)fNode;
00352     return hdc.GetTextExtent(*tag, (*tag).length());
00353 }
00354
00355 void CWinLogTagData::UpdateSelf(UDC & hdc, EntnodeData *entryInfo)
00356 {
00357     // draw the node
00358     ::DrawNode(hdc, selfB, URGB(0, 0, 0), URGB(120, 120, 120), true, sel);
00359
00360     // draw the content of the node
00361     UPoint center = selfB.CenterPoint();
00362     int nCenterX = center.x;
00363     int nCenterY = center.y - hdc.GetTextHeight()/2;
00364     CLogNodeTag & tag = *(CLogNodeTag *)fNode;
00365     hdc.TextOutClipped(nCenterX, nCenterY, selfB,
00366         *tag, (*tag).length());
00367 }
00368
00369 USize CWinLogBranchData::GetBoundsSelf(UDC & hdc, EntnodeData *entryInfo)
00370 {
00371     CLogNodeBranch & branch = *(CLogNodeBranch *)fNode;
00372     return hdc.GetTextExtent(*branch, (*branch).length());
00373 }
00374
00375 void CWinLogBranchData::UpdateSelf(UDC & hdc, EntnodeData *entryInfo)
00376 {
00377     // draw the node
00378     ::DrawNode(hdc, selfB, URGB(0, 0, 255), URGB(0, 0, 120), true, sel);
00379
00380     // draw the content of the node
00381     UPoint center = selfB.CenterPoint();
00382     int nCenterX = center.x;
00383     int nCenterY = center.y - hdc.GetTextHeight()/2;
00384     CLogNodeBranch & branch = *(CLogNodeBranch *)fNode;
00385     hdc.TextOutClipped(nCenterX, nCenterY, selfB,
00386         *branch, (*branch).length());
00387 }
00388
00389 CWinLogData::CWinLogData(CLogNode *node) : CLogNodeData(node)
00390 {
00391     selfB.SetRectEmpty();
00392     totB.SetRectEmpty();
00393     sel = false;
00394 }
00395
00396 CWinLogData::~CWinLogData()
00397 {
00398 }
00399
00400 const char *CWinLogData::GetStr(void)
00401 {
00402     switch(GetType())
00403     {
00404         case kNodeHeader :
00405         {
00406             CLogNodeHeader & header = *(CLogNodeHeader *)fNode;
00407             return (*header).WorkingFile();
00408             break;
00409         }
00410         case kNodeBranch :
00411         {
00412             CLogNodeBranch & branch = *(CLogNodeBranch *)fNode;
00413             return *branch;
00414             break;
00415         }
00416         case kNodeRev :
00417         {
00418             CLogNodeRev & rev = *(CLogNodeRev *)fNode;
00419             return (*rev).RevNum().str();
00420             break;
00421         }
00422         case kNodeTag :
00423         {
00424             CLogNodeTag & tag = *(CLogNodeTag *)fNode;
00425             return *tag;
00426             break;
00427         }
00428     }
00429     return 0L;
00430 }
00431
00432 CWinLogData * CWinLogData::CreateNewData(CLogNode *node)
00433 {
00434     if(node->GetUserData() != 0L)
00435         return (CWinLogData *)node->GetUserData();
00436
00437     CWinLogData *res = 0L;
00438     switch(node->GetType())
00439     {
00440     case kNodeHeader :
00441         res = new CWinLogHeaderData(node);
00442         break;
00443     case kNodeBranch :
00444         res = new CWinLogBranchData(node);
00445         break;
00446     case kNodeRev :
00447         res = new CWinLogRevData(node);
00448         break;
00449     case kNodeTag :
00450         res = new CWinLogTagData(node);
00451         break;
00452     }
00453     node->SetUserData(res);
00454     return res;
00455 }
00456
00457 bool CWinLogData::IsDiskNode(EntnodeData *entryInfo)
00458 {
00459     if(entryInfo == 0L || GetType() != kNodeRev)
00460         return false;
00461     const char *vn = (*entryInfo)[EntnodeFile::kVN];
00462     if(vn == 0L)
00463         return false;
00464
00465     return strcmp(vn, (**(CLogNodeRev *)fNode).RevNum().str()) == 0;
00466 }
00467
00468 const int kVChildSpace = 8;
00469 const int kHChildSpace = 40;
00470 const int kInflateNodeSpace = 8;
00471
00472 void CWinLogData::Offset(UPoint o)
00473 {
00474     selfB.OffsetRect(o);
00475     totB.OffsetRect(o);
00476     vector<CLogNode *>::iterator i;
00477     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00478     {
00479         CLogNode *subNode = *i;
00480         GetData(subNode)->Offset(o);
00481     }
00482     if(fNode->Next() != 0L)
00483         GetData(fNode->Next())->Offset(o);
00484 }
00485
00486 void CWinLogData::SetSelected(CScrollView *view, bool state)
00487 {
00488     sel = state;
00489
00490     URect invalR = selfB;
00491     invalR.OffsetRect(-view->GetDeviceScrollPosition());
00492     view->InvalidateRect(invalR);
00493 }
00494
00495 void CWinLogData::UnselectAll(CScrollView *view)
00496 {
00497     if(sel)
00498     {
00499         SetSelected(view, false);
00500     }
00501
00502     vector<CLogNode *>::iterator i;
00503     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00504     {
00505         CLogNode *subNode = *i;
00506         GetData(subNode)->UnselectAll(view);
00507     }
00508     if(fNode->Next() != 0L)
00509         GetData(fNode->Next())->UnselectAll(view);
00510 }
00511
00512 CWinLogData *CWinLogData::HitTest(UPoint point)
00513 {
00514     if(!totB.PtInRect(point))
00515         return 0L;
00516     if(selfB.PtInRect(point))
00517         return this;
00518
00519     CWinLogData *result;
00520     vector<CLogNode *>::iterator i;
00521     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00522     {
00523         CLogNode *subNode = *i;
00524         result = GetData(subNode)->HitTest(point);
00525         if(result != 0L)
00526             return result;
00527     }
00528     if(fNode->Next() != 0L)
00529     {
00530         result = GetData(fNode->Next())->HitTest(point);
00531         if(result != 0L)
00532             return result;
00533     }
00534     return 0L;
00535 }
00536
00537 void CWinLogData::Update(UDC & hdc, EntnodeData *entryInfo)
00538 {
00539     CLogNode *subNode;
00540     CLogNode *nextNode = fNode->Next();
00541     UPen *pOldPen = 0L;
00542     UPen pen, pen2;
00543
00544     UpdateSelf(hdc, entryInfo);
00545
00546     try
00547     {
00548         pen.CreatePen(UPS_SOLID, 2, URGB(0, 0, 255));
00549         pen2.CreatePen(UPS_SOLID, 1, URGB(0, 0, 0));
00550         pOldPen = hdc.SelectObject(&pen);
00551
00552         int topY = selfB.TopLeft().y + 2;
00553         int botY = selfB.BottomRight().y - 2;
00554         int lefX = selfB.BottomRight().x + 4;
00555         int count = 1;
00556         int tot = fNode->Childs().size() + 1;
00557
00558         // draw the children
00559         vector<CLogNode *>::iterator i;
00560         for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i, ++count)
00561         {
00562             subNode = *i;
00563
00564             // draw the link
00565             URect & cb = GetData(subNode)->SelfBounds();
00566             if(subNode->GetType() == kNodeRev || subNode->GetType() == kNodeBranch)
00567                 hdc.SelectObject(&pen);
00568             else
00569                 hdc.SelectObject(&pen2);
00570             float y = (float)topY + (float)(botY - topY) *
00571                 (float)count / (float)tot;
00572             int rigX = cb.TopLeft().x - 4;
00573             float x = (float)rigX - (float)(rigX - lefX) *
00574                 (float)count / (float)tot;
00575             //int halfX = (cb.TopLeft().x - selfB.BottomRight().x) / 2;
00576             hdc.MoveTo(selfB.BottomRight().x, (int)y);
00577             hdc.LineTo((int)x, (int)y);
00578             hdc.LineTo((int)x, cb.CenterPoint().y);
00579             hdc.LineTo(cb.TopLeft().x, cb.CenterPoint().y);
00580
00581             // draw the sub-node
00582             GetData(subNode)->Update(hdc, entryInfo);
00583         }
00584
00585         // draw the next node
00586         if(nextNode != 0L)
00587         {
00588             // draw the link
00589             URect & nb = GetData(nextNode)->SelfBounds();
00590             if(nextNode->GetType() == kNodeRev || nextNode->GetType() == kNodeBranch)
00591                 hdc.SelectObject(&pen);
00592             else
00593                 hdc.SelectObject(&pen2);
00594             int centerX = selfB.Width() < nb.Width() ?
00595                 selfB.CenterPoint().x : nb.CenterPoint().x;
00596             hdc.MoveTo(centerX, selfB.BottomRight().y);
00597             hdc.LineTo(centerX, nb.TopLeft().y);
00598
00599             // draw the next node
00600             GetData(nextNode)->Update(hdc, entryInfo);
00601         }
00602
00603         if (pOldPen != 0L)
00604         {
00605             hdc.SelectObject(pOldPen);
00606             pOldPen = 0L;
00607         }
00608
00609         pen.DeleteObject();
00610         pen2.DeleteObject();
00611     }
00612     catch(...)
00613     {
00614         if (pOldPen != 0L)
00615             hdc.SelectObject(pOldPen);
00616     }
00617 }
00618
00619 void CWinLogData::ComputeBounds(const UPoint & topLeft, UDC & hdc,
00620                                 EntnodeData *entryInfo)
00621 {
00622     CLogNode *subNode;
00623     CLogNode *nextNode = fNode->Next();
00624
00625     // first compute childrens bounds
00626     vector<CLogNode *>::iterator i;
00627     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00628     {
00629         subNode = *i;
00630         CWinLogData::CreateNewData(subNode);
00631         GetData(subNode)->ComputeBounds(topLeft, hdc, entryInfo);
00632     }
00633     if(nextNode != 0L)
00634         CWinLogData::CreateNewData(nextNode);
00635
00636     // compute self place
00637     selfB.SetRectEmpty();
00638     USize size = GetBoundsSelf(hdc, entryInfo);
00639     size.cx += kInflateNodeSpace;
00640     size.cy += kInflateNodeSpace;
00641     selfB.SetRect(0, 0, size.cx, size.cy);
00642
00643     // offset to the place assigned to this node
00644     selfB.OffsetRect(topLeft - selfB.TopLeft());
00645
00646     // calculate the total height of the childrens
00647     int vSize = 0;
00648     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00649     {
00650         subNode = *i;
00651         URect & b = GetData(subNode)->Bounds();
00652         vSize += b.Height();
00653     }
00654     if(!fNode->Childs().empty())
00655         vSize += (fNode->Childs().size() - 1) * kVChildSpace;
00656
00657     // offset the children relative to self
00658     UPoint startChilds(topLeft.x + selfB.Width() + kHChildSpace,
00659         /*selfB.CenterPoint().y - vSize / 2*/topLeft.y);
00660     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00661     {
00662         subNode = *i;
00663         URect curPos = GetData(subNode)->Bounds();
00664         GetData(subNode)->Offset(startChilds - curPos.TopLeft());
00665         startChilds.y += curPos.Height() + kVChildSpace;
00666     }
00667
00668     // calculate the total bounds of the childrens
00669     URect bc;
00670     bc.SetRectEmpty();
00671     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00672     {
00673         subNode = *i;
00674         URect & b = GetData(subNode)->Bounds();
00675         bc.UnionRect(bc, b);
00676     }
00677
00678     // now we got the complete size
00679     totB.UnionRect(selfB, bc);
00680
00681     if(nextNode != 0L)
00682     {
00683         UPoint nextTopLeft;
00684         nextTopLeft.x = totB.TopLeft().x;
00685         nextTopLeft.y = totB.BottomRight().y + kVChildSpace;
00686         GetData(nextNode)->ComputeBounds(nextTopLeft, hdc, entryInfo);
00687
00688         totB.UnionRect(totB, GetData(nextNode)->Bounds());
00689     }
00690 }
00691
00692 void UCvsGraph::CalcImageSize(void)
00693 {
00694     if(m_node == 0L)
00695         return;
00696
00697     // set all the bounds locations
00698     UDC dc(GetWidID(), kDrawing);
00699     CWinLogData *data = CWinLogData::CreateNewData(m_node);
00700     m_node->SetUserData(data);
00701     UPoint start(5, 5);
00702     data->ComputeBounds(start, dc, m_data);
00703
00704     // reoffset from (0, 0)
00705     URect bounds = data->Bounds();
00706     data->Offset(start - bounds.TopLeft());
00707     bounds = data->Bounds();
00708
00709 #if qGTK
00710     GtkWidget *layout = (GtkWidget *)GetWidget(kDrawing);
00711     gtk_layout_set_size (GTK_LAYOUT (layout), bounds.Width(), bounds.Height());
00712 #endif
00713 #if 0
00714     // set the scroll size
00715     SetScrollSizes(MM_TEXT, bounds.Size() + USize(5, 5));
00716 #endif
00717 }
00718
00719 void UCvsGraph::OnDrawing(void *info)
00720 {
00721 #if qGTK
00722     GdkEventExpose *event = (GdkEventExpose *)info;
00723     GtkLayout *layout = GTK_LAYOUT(GetWidget(kDrawing));
00724     gdk_window_clear_area (layout->bin_window,
00725                            event->area.x, event->area.y,
00726                            event->area.width, event->area.height);
00727 #endif
00728     CalcImageSize();
00729
00730     if(m_node == 0L || m_node->GetUserData() == 0L)
00731         return;
00732
00733     UDC dc(GetWidID(), kDrawing);
00734     CWinLogData *data = (CWinLogData *)m_node->GetUserData();
00735     data->Update(dc, m_data);
00736
00737 /*  GtkWidget *widget = (GtkWidget *)GetWidget(kDrawing);
00738     if(widget == 0L)
00739         return;
00740
00741     GtkDrawingArea *darea;
00742     GdkDrawable *drawable;
00743     GdkGC *black_gc;
00744     GdkGC *gray_gc;
00745     GdkGC *white_gc;
00746     guint max_width;
00747     guint max_height;
00748
00749     g_return_if_fail (widget != NULL);
00750     g_return_if_fail (GTK_IS_DRAWING_AREA (widget));
00751
00752     darea = GTK_DRAWING_AREA (widget);
00753     drawable = widget->window;
00754     white_gc = widget->style->white_gc;
00755     gray_gc = widget->style->bg_gc[GTK_STATE_NORMAL];
00756     black_gc = widget->style->black_gc;
00757     max_width = widget->allocation.width;
00758     max_height = widget->allocation.height;
00759     gdk_draw_rectangle (drawable, black_gc,
00760                         TRUE,
00761                         0,
00762                         max_height / 2,
00763                         max_width,
00764                         max_height / 2);*/
00765 }
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsGraph.h Source File

common/UCvsGraph.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #ifndef UCVSGRAPH_H
00026 #define UCVSGRAPH_H
00027
00028 #include "uwidget.h"
00029
00030 class CLogNode;
00031 class EntnodeData;
00032
00033 class UCvsGraph : public UWidget
00034 {
00035     UDECLARE_DYNAMIC(UCvsGraph)
00036 public:
00037     UCvsGraph(CLogNode *node, const char *dir);
00038     virtual ~UCvsGraph();
00039
00040     enum
00041     {
00042         kDrawing = EV_COMMAND_START // 0
00043     };
00044 protected:
00045     CLogNode *m_node;
00046     UStr m_dir;
00047     UStr m_name;
00048     EntnodeData *m_data;
00049
00050     void CalcImageSize(void);
00051
00052     ev_msg void OnDestroy();
00053     ev_msg void OnCreate();
00054     ev_msg void OnDrawing(void *info);
00055
00056     UDECLARE_MESSAGE_MAP()
00057 };
00058
00059 #endif
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsMenubar.cpp Source File

common/UCvsMenubar.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include "UCvsMenubar.h"
00028 #include "UCvsCommands.h"
00029 #include "MacrosSetup.h"
00030
00031 UIMPLEMENT_DYNAMIC(UCvsMenubar, UMenu)
00032
00033 UBEGIN_MESSAGE_MAP(UCvsMenubar, UMenu)
00034     ON_UDESTROY(UCvsMenubar)
00035     ON_UCREATE(UCvsMenubar)
00036 UEND_MESSAGE_MAP()
00037
00038 UCvsMenubar::UCvsMenubar() : UMenu(kUCvsMenubarID)
00039 {
00040 }
00041
00042 UCvsMenubar::~UCvsMenubar()
00043 {
00044 }
00045
00046 void UCvsMenubar::OnDestroy(void)
00047 {
00048     delete this;
00049 }
00050
00051 void UCvsMenubar::OnCreate(void)
00052 {
00053 }
00054
00055 void CreateMainMenubar(int widid)
00056 {
00057     std::vector<CMacroEntry>::const_iterator i;
00058     int cnt;
00059
00060     UMENU menu = UMenuAddPulldown(widid, "&File", UMENU_NULL);
00061     UMenuAddButton(widid, "&Save\tCtrl+S", menu, 0L, cmdSAVE);
00062     UMenuAddButton(widid, "Save &As...", menu, 0L, cmdSAVE_AS);
00063     UMenuAddSeparator(widid, menu);
00064     UMenuAddButton(widid, "&Print...\tCtrl+P", menu, 0L, cmdPRINT);
00065     UMenuAddButton(widid, "Print Pre&view", menu, 0L, cmdPRINT_PREVIEW);
00066     UMenuAddButton(widid, "P&rint Setup...", menu, 0L, cmdPRINT_SETUP);
00067     UMenuAddSeparator(widid, menu);
00068     UMenuAddButton(widid, "Sen&d...", menu, 0L, cmdSEND_MAIL);
00069     UMenuAddSeparator(widid, menu);
00070     UMenuAddButton(widid, "E&xit\tCtrl+Q", menu, 0L, cmdEXIT);
00071
00072     menu = UMenuAddPulldown(widid, "&Edit", UMENU_NULL);
00073     UMenuAddButton(widid, "&Undo\tCtrl+Z", menu, 0L, cmdUNDO);
00074     UMenuAddSeparator(widid, menu);
00075     UMenuAddButton(widid, "Cu&t\tCtrl+X", menu, 0L, cmdCUT);
00076     UMenuAddButton(widid, "&Copy\tCtrl+C", menu, 0L, cmdCOPY);
00077     UMenuAddButton(widid, "&Paste\tCtrl+V", menu, 0L, cmdPASTE);
00078     UMenuAddSeparator(widid, menu);
00079     UMenuAddButton(widid, "Select &All\tCtrl+A", menu, 0L, cmdSELECT_ALL);
00080     UMenuAddButton(widid, "&Erase all", menu, 0L, cmdCLEAR_ALL);
00081     UMenuAddSeparator(widid, menu);
00082     UMenuAddButton(widid, "&Find...\tCtrl+F", menu, 0L, cmdFIND);
00083     UMenuAddButton(widid, "Find next\tF3", menu, 0L, cmdREPEAT);
00084     UMenuAddSeparator(widid, menu);
00085     UMenuAddButton(widid, "F&ont...", menu, 0L, cmdFONT);
00086
00087     menu = UMenuAddPulldown(widid, "&View", UMENU_NULL);
00088     UMenuAddButton(widid, "&Toolbar", menu, 0L, cmdTOOLBAR);
00089     UMenuAddButton(widid, "&Status Bar", menu, 0L, cmdSTATUS_BAR);
00090     UMenuAddButton(widid, "&Browser Bar", menu, 0L, cmdBROWSER_BAR);
00091     UMenuAddButton(widid, "&Files Bar", menu, 0L, cmdFILES_BAR);
00092     UMenuAddButton(widid, "&Multi-Users Bar", menu, 0L, cmdMULTI_BAR);
00093     UMenuAddButton(widid, "T&ags Bar", menu, 0L, cmdTAGS_BAR);
00094     UMenuAddButton(widid, "&Console Bar", menu, 0L, cmdCONSOLE_BAR);
00095     UMenuAddButton(widid, "&Workspace Bar", menu, 0L, cmdWORKSPACE);
00096     UMenuAddSeparator(widid, menu);
00097     UMenuAddButton(widid, "Change browser &location...", menu, 0L, cmdOPEN);
00098     UMenuAddButton(widid, "S&ave settings for location...", menu, 0L, cmdSAVESETTINGS);
00099
00100     menu = UMenuAddPulldown(widid, "&Admin", UMENU_NULL);
00101     UMenuAddButton(widid, "Pr&eferences...\tCtrl+F1", menu, 0L, cmdPREFERENCES);
00102     UMenuAddButton(widid, "&Command Line...", menu, 0L, cmdCMDLINE);
00103     UMenuAddSeparator(widid, menu);
00104     UMenuAddButton(widid, "&Login...", menu, 0L, cmdLOGIN);
00105     UMenuAddButton(widid, "Lo&gout", menu, 0L, cmdLOGOUT);
00106     UMenuAddSeparator(widid, menu);
00107     UMenuAddButton(widid, "&Stop cvs", menu, 0L, cmdSTOPCVS);
00108     menu = UMenuAddPulldown(widid, "Macros admin", menu);
00109     for(cnt = 0, i = gMacrosAdmin.entries.begin(); i != gMacrosAdmin.entries.end(); ++i, cnt++)
00110     {
00111         UMenuAddButton(widid, (*i).name, menu, 0L, cmdMACROADMIN + cnt);
00112     }
00113
00114     menu = UMenuAddPulldown(widid, "&Create", UMENU_NULL);
00115     UMenuAddButton(widid, "&Create a new repository...", menu, 0L, cmdINIT);
00116     UMenuAddSeparator(widid, menu);
00117     UMenuAddButton(widid, "Import module...", menu, 0L, cmdIMPORT);
00118     UMenuAddButton(widid, "Checkout module...", menu, 0L, cmdCHECKOUT);
00119     UMenuAddSeparator(widid, menu);
00120     UMenuAddButton(widid, "&Create a tag by module...", menu, 0L, cmdRTAGCREATE);
00121     UMenuAddButton(widid, "&Delete a tag by module...", menu, 0L, cmdRTAGDELETE);
00122     UMenuAddButton(widid, "Create a &branch by module...", menu, 0L, cmdRTAGBRANCH);
00123
00124     menu = UMenuAddPulldown(widid, "&Modify", UMENU_NULL);
00125     UMenuAddButton(widid, "&Update selection...\tCtrl+U", menu, 0L, cmdUPDATE);
00126     UMenuAddButton(widid, "Co&mmit selection...\tCtrl+M", menu, 0L, cmdCOMMIT);
00127     UMenuAddSeparator(widid, menu);
00128     UMenuAddButton(widid, "&Add selection", menu, 0L, cmdADD);
00129     UMenuAddButton(widid, "Add selection binar&y", menu, 0L, cmdADDB);
00130     UMenuAddButton(widid, "&Remove selection", menu, 0L, cmdRMV);
00131     UMenuAddSeparator(widid, menu);
00132     UMenuAddButton(widid, "Erase &selection\tCtrl+Backspace", menu, 0L, cmdTRASH);
00133     UMenuAddSeparator(widid, menu);
00134     UMenuAddButton(widid, "&Create a tag on selection...", menu, 0L, cmdTAGNEW);
00135     UMenuAddButton(widid, "&Delete a tag on selection...", menu, 0L, cmdTAGDELETE);
00136     UMenuAddButton(widid, "Create a &branch on selection...", menu, 0L, cmdTAGBRANCH);
00137
00138     menu = UMenuAddPulldown(widid, "&Query", UMENU_NULL);
00139     UMenuAddButton(widid, "E&xplore selection\tF2", menu, 0L, cmdEXPLORE);
00140     UMenuAddButton(widid, "&Query Update\tF4", menu, 0L, cmdQUERYUPDATE);
00141     UMenuAddButton(widid, "R&eload view\tF5", menu, 0L, cmdRELOAD);
00142     UMenuAddSeparator(widid, menu);
00143     UMenuAddButton(widid, "View selection\tF7", menu, 0L, cmdEDITSEL);
00144     UMenuAddButton(widid, "View default", menu, 0L, cmdEDITSELDEF);
00145     UMenuAddSeparator(widid, menu);
00146     UMenuAddButton(widid, "&Diff selection\tAlt+=", menu, 0L, cmdDIFF);
00147     UMenuAddButton(widid, "&Log selection", menu, 0L, cmdLOG);
00148     UMenuAddButton(widid, "Status sele&ction", menu, 0L, cmdSTATUS);
00149     UMenuAddButton(widid, "Graph selection\tCtrl+G", menu, 0L, cmdGRAPH);
00150
00151     menu = UMenuAddPulldown(widid, "&Trace", UMENU_NULL);
00152     UMenuAddButton(widid, "Lock selection", menu, 0L, cmdLOCKF);
00153     UMenuAddButton(widid, "Unlock selection", menu, 0L, cmdUNLOCKF);
00154     UMenuAddButton(widid, "Edit selection", menu, 0L, cmdEDIT);
00155     UMenuAddButton(widid, "Unedit selection", menu, 0L, cmdUNEDIT);
00156     UMenuAddButton(widid, "Add a Watch on selection", menu, 0L, cmdWATCHON);
00157     UMenuAddButton(widid, "Remove a watch from selection", menu, 0L, cmdWATCHOFF);
00158     UMenuAddSeparator(widid, menu);
00159     UMenuAddButton(widid, "Release selection", menu, 0L, cmdRELEASE);
00160     UMenuAddSeparator(widid, menu);
00161     UMenuAddButton(widid, "Watchers of selection", menu, 0L, cmdWATCHERS);
00162     UMenuAddButton(widid, "Editors of selection", menu, 0L, cmdEDITORS);
00163
00164     menu = UMenuAddPulldown(widid, "Macro&s", UMENU_NULL);
00165     for(cnt = 0, i = gMacrosSel.entries.begin(); i != gMacrosSel.entries.end(); ++i, cnt++)
00166     {
00167         UMenuAddButton(widid, (*i).name, menu, 0L, cmdSELMACRO + cnt);
00168     }
00169
00170     menu = UMenuAddPulldown(widid, "&Window", UMENU_NULL);
00171     UMenuAddButton(widid, "&Cascade", menu, 0L, cmdCASCADE);
00172     UMenuAddButton(widid, "&Tile", menu, 0L, cmdTILE_HORZ);
00173     UMenuAddButton(widid, "&Arrange Icons", menu, 0L, cmdARRANGE);
00174
00175     menu = UMenuAddPulldown(widid, "&Help", UMENU_NULL);
00176     UMenuAddButton(widid, "&Help Topics", menu, 0L, cmdFINDER);
00177     UMenuAddButton(widid, "Help on cvs-1.10", menu, 0L, cmdCVS);
00178     UMenuAddButton(widid, "Help on cvs client", menu, 0L, cmdCVSCLIENT);
00179     UMenuAddSeparator(widid, menu);
00180     UMenuAddButton(widid, "&About wincvs...", menu, 0L, cmdABOUT);
00181     UMenuAddButton(widid, "&Credits", menu, 0L, cmdCREDITS);
00182     UMenuAddButton(widid, "C&opyrights", menu, 0L, cmdCOPYRIGHTS);
00183 }
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsMenubar.h Source File

common/UCvsMenubar.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #ifndef UCVSMENU_H
00026 #define UCVSMENU_H
00027
00028 #include "umenu.h"
00029
00030 class UCvsMenubar : public UMenu
00031 {
00032     UDECLARE_DYNAMIC(UCvsMenubar)
00033 public:
00034     UCvsMenubar();
00035     virtual ~UCvsMenubar();
00036
00037 protected:
00038
00039     ev_msg void OnDestroy();
00040     ev_msg void OnCreate();
00041
00042     UDECLARE_MESSAGE_MAP()
00043 };
00044
00045 void CreateMainMenubar(int widid);
00046
00047 #endif
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsToolbar.cpp Source File

common/UCvsToolbar.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include "UCvsToolbar.h"
00028 #include "UCvsCommands.h"
00029
00030 UIMPLEMENT_DYNAMIC(UCvsToolbar, UToolbar)
00031
00032 UBEGIN_MESSAGE_MAP(UCvsToolbar, UToolbar)
00033     ON_UDESTROY(UCvsToolbar)
00034     ON_UCREATE(UCvsToolbar)
00035 UEND_MESSAGE_MAP()
00036
00037 UCvsToolbar::UCvsToolbar() : UToolbar(kUCvsToolbarID)
00038 {
00039 }
00040
00041 UCvsToolbar::~UCvsToolbar()
00042 {
00043 }
00044
00045 void UCvsToolbar::OnDestroy(void)
00046 {
00047     delete this;
00048 }
00049
00050 void UCvsToolbar::OnCreate(void)
00051 {
00052 }
00053
00054 void CreateMainToolbar(void)
00055 {
00056     UTB_INIT init;
00057     init.widthbtn = 16;
00058     init.heightbtn = 16;
00059     init.title = "Main Toolbar";
00060     UEventSendMessage(kUCvsToolbarID, EV_TB_INIT, 0, &init);
00061
00062     UTB_BUTTON updtBtn = {
00063         "update.xpm",
00064         cmdUPDATE,
00065         DDV_NONE,
00066         DDD_NONE,
00067         "Update the selected items, changes your disk only\nUpdate selected"
00068     };
00069     UTB_BUTTON commitBtn = {
00070         "commit.xpm",
00071         cmdCOMMIT,
00072         DDV_NONE,
00073         DDD_NONE,
00074         "Commit the selected items, changes the remote repository\nCommit selected"
00075     };
00076     UTB_BUTTON stopBtn = {
00077         "stop.xpm",
00078         cmdSTOPCVS,
00079         DDV_NONE,
00080         DDD_NONE,
00081         "Stop when cvs is running...\nStop cvs..."
00082     };
00083     UTB_BUTTON ignoreBtn = {
00084         "ignore.xpm",
00085         cmdIGNORE,
00086         DDV_NONE,
00087         DDD_NONE,
00088         "View or hide the cvs ignored files/folders\nIgnore switch"
00089     };
00090     UTB_BUTTON reloadBtn = {
00091         "reload.xpm",
00092         cmdRELOAD,
00093         DDV_NONE,
00094         DDD_NONE,
00095         "Refresh the views, updating the contents\nRefresh view"
00096     };
00097     UTB_BUTTON exploreBtn = {
00098         "explore.xpm",
00099         cmdEXPLORE,
00100         DDV_NONE,
00101         DDD_NONE,
00102         "Open an explorer window for this selection\nExplore selection"
00103     };
00104     UTB_BUTTON upBtn = {
00105         "upfolder.xpm",
00106         cmdUPFOLDER,
00107         DDV_NONE,
00108         DDD_NONE,
00109         "Go to the upper folder and refresh\nUp one level"
00110     };
00111     UTB_BUTTON diffBtn = {
00112         "diff.xpm",
00113         cmdDIFF,
00114         DDV_NONE,
00115         DDD_NONE,
00116         "Print the differences with the CVS remote repository\nDiff selected"
00117     };
00118     UTB_BUTTON logBtn = {
00119         "log.xpm",
00120         cmdLOG,
00121         DDV_NONE,
00122         DDD_NONE,
00123         "Print the history of the selected files\nLog selected"
00124     };
00125     UTB_BUTTON statusBtn = {
00126         "status.xpm",
00127         cmdSTATUS,
00128         DDV_NONE,
00129         DDD_NONE,
00130         "Print the current status of the selected files\nStatus selected"
00131     };
00132     UTB_BUTTON graphBtn = {
00133         "graph.xpm",
00134         cmdGRAPH,
00135         DDV_NONE,
00136         DDD_NONE,
00137         "Print the history as a graph of the selected files\nGraph selected"
00138     };
00139     UTB_BUTTON trashBtn = {
00140         "trash.xpm",
00141         cmdTRASH,
00142         DDV_NONE,
00143         DDD_NONE,
00144         "Erase the selection from your disk\nErase selected"
00145     };
00146     UTB_BUTTON addBtn = {
00147         "add.xpm",
00148         cmdADD,
00149         DDV_NONE,
00150         DDD_NONE,
00151         "Add the selected items to the remote CVS repository\nAdd selected"
00152     };
00153     UTB_BUTTON addbBtn = {
00154         "addb.xpm",
00155         cmdADDB,
00156         DDV_NONE,
00157         DDD_NONE,
00158         "Add the selected binary items to the remote CVS repository\nAdd selected binary"
00159     };
00160     UTB_BUTTON rmvBtn = {
00161         "remove.xpm",
00162         cmdRMV,
00163         DDV_NONE,
00164         DDD_NONE,
00165         "Remove the selected items to the remote CVS repository\nRemove selected"
00166     };
00167     UTB_BUTTON tagBtn = {
00168         "tag.xpm",
00169         cmdTAGNEW,
00170         DDV_NONE,
00171         DDD_NONE,
00172         "Create/move a tag on the selection\nTag selection"
00173     };
00174     UTB_BUTTON untagBtn = {
00175         "untag.xpm",
00176         cmdTAGDELETE,
00177         DDV_NONE,
00178         DDD_NONE,
00179         "Remove a tag on the selection\nUntag selection"
00180     };
00181     UTB_BUTTON branchBtn = {
00182         "branch.xpm",
00183         cmdTAGBRANCH,
00184         DDV_NONE,
00185         DDD_NONE,
00186         "Open (fork) a branch on the selection\nFork selection"
00187     };
00188     UTB_BUTTON lockBtn = {
00189         "lock.xpm",
00190         cmdLOCKF,
00191         DDV_NONE,
00192         DDD_NONE,
00193         "Lock the selected file on the remote repository until next commit\nLock selection"
00194     };
00195     UTB_BUTTON unlockBtn = {
00196         "unlock.xpm",
00197         cmdUNLOCKF,
00198         DDV_NONE,
00199         DDD_NONE,
00200         "Unlock the selected file on the remote repository\nUnlock selection"
00201     };
00202     UTB_BUTTON watchBtn = {
00203         "watch.xpm",
00204         cmdWATCHON,
00205         DDV_NONE,
00206         DDD_NONE,
00207         "Put a watch on the selected files\nWatch selection"
00208     };
00209     UTB_BUTTON unwatchBtn = {
00210         "unwatch.xpm",
00211         cmdWATCHOFF,
00212         DDV_NONE,
00213         DDD_NONE,
00214         "Release a watch on the selected files\nRelease watch selection"
00215     };
00216     UTB_BUTTON editBtn = {
00217         "edit.xpm",
00218         cmdEDIT,
00219         DDV_NONE,
00220         DDD_NONE,
00221         "Edit the selected files\nEdit selection"
00222     };
00223     UTB_BUTTON uneditBtn = {
00224         "unedit.xpm",
00225         cmdUNEDIT,
00226         DDV_NONE,
00227         DDD_NONE,
00228         "Unedit the selected files\nUnedit selection"
00229     };
00230     UTB_BUTTON releaseBtn = {
00231         "release.xpm",
00232         cmdRELEASE,
00233         DDV_NONE,
00234         DDD_NONE,
00235         "Release the selected files\nRelease selection"
00236     };
00237     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &updtBtn);
00238     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &commitBtn);
00239     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00240     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &stopBtn);
00241     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00242     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &addBtn);
00243     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &addbBtn);
00244     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &rmvBtn);
00245     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00246     UEventSendMessage(kUCvsToolbarID, EV_TB_CHECKBTN, 0, &ignoreBtn);
00247     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &reloadBtn);
00248     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &exploreBtn);
00249     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &upBtn);
00250     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00251     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &diffBtn);
00252     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &logBtn);
00253     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &statusBtn);
00254     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00255     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &graphBtn);
00256     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00257     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &trashBtn);
00258     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00259     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &tagBtn);
00260     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &untagBtn);
00261     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &branchBtn);
00262     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00263     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &lockBtn);
00264     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &unlockBtn);
00265     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00266     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &watchBtn);
00267     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &unwatchBtn);
00268     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00269     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &editBtn);
00270     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &uneditBtn);
00271     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00272     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &releaseBtn);
00273
00274     UEventSendMessage(kUCvsToolbarID, EV_TB_END, 0, 0L);
00275 }
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UCvsToolbar.h Source File

common/UCvsToolbar.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 /*
00022  *
00023  */
00024
00025 #ifndef UCVSTOOLBAR_H
00026 #define UCVSTOOLBAR_H
00027
00028 #include "utoolbar.h"
00029
00030 class UCvsToolbar : public UToolbar
00031 {
00032     UDECLARE_DYNAMIC(UCvsToolbar)
00033 public:
00034     UCvsToolbar();
00035     virtual ~UCvsToolbar();
00036
00037 protected:
00038
00039     ev_msg void OnDestroy();
00040     ev_msg void OnCreate();
00041
00042     UDECLARE_MESSAGE_MAP()
00043 };
00044
00045 void CreateMainToolbar(void);
00046
00047 #endif
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UpdateDlg.cpp Source File

common/UpdateDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * UpdateDlg.cpp : the cvs update dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #   include "OptionalPropertySheet.h"
00030 #endif /* WIN32 */
00031
00032 #if qUnix
00033 #   include "UCvsDialogs.h"
00034 #endif
00035
00036 #ifdef qMacCvsPP
00037 #   include <UModalDialogs.h>
00038 #   include <LMultiPanelView.h>
00039 #   include <LCheckBox.h>
00040 #   include <LEditText.h>
00041 #   include <LPopupGroupBox.h>
00042 #   include <LRadioButton.h>
00043 #   include "LPopupFiller.h"
00044
00045 #   include "MacCvsConstant.h"
00046 #endif /* qMacCvsPP */
00047
00048 #include "UpdateDlg.h"
00049 #include "CvsPrefs.h"
00050
00051 #ifdef WIN32
00052 #   ifdef _DEBUG
00053 #   define new DEBUG_NEW
00054 #   undef THIS_FILE
00055     static char THIS_FILE[] = __FILE__;
00056 #   endif
00057 #endif /* WIN32 */
00058
00059 char *sDefTagNames[] =
00060 {
00061     "1.1",
00062     "1.6.2.4",
00063     "HEAD",
00064     "branch-release-1-0",
00065     0L
00066 };
00067
00068 char *sDefDateNames[] =
00069 {
00070     "1998-3",
00071     "1998-3-24",
00072     "1998-3-24 20:55",
00073     "24 Mar",
00074     "24 Mar 1998",
00075     "<=1998-3-24",
00076     0L
00077 };
00078
00079 char *sDefRevDateNames[] =
00080 {
00081     "1.1",
00082     "1.6.2.4",
00083     "HEAD",
00084     "branch-release-1-0",
00085     "1998-3",
00086     "1998-3-24",
00087     "1998-3-24 20:55",
00088     "24 Mar",
00089     "24 Mar 1998",
00090     "<=1998-3-24",
00091     0L
00092 };
00093
00094 CMString gRevNames(10, "P_TagNames", sDefTagNames);
00095 CMString gDateNames(10, "P_DateNames", sDefDateNames);
00096 CMString gDateOrRevNames(20, "P_RebDateNames", sDefRevDateNames);
00097
00098 #ifdef WIN32
00099 #include "GetPrefs.h"
00100
00101 IMPLEMENT_DYNCREATE(CUpdateMain, CPropertyPage)
00102
00103 CUpdateMain::CUpdateMain() : CPropertyPage(CUpdateMain::IDD)
00104 {
00105     //{{AFX_DATA_INIT(CUpdateMain)
00106     m_delsticky = FALSE;
00107     m_norecurs = FALSE;
00108     m_stdout = FALSE;
00109     m_createmissdir = FALSE;
00110     m_getcleancopy = FALSE;
00111     //}}AFX_DATA_INIT
00112 }
00113
00114 CUpdateMain::~CUpdateMain()
00115 {
00116 }
00117
00118 void CUpdateMain::DoDataExchange(CDataExchange* pDX)
00119 {
00120     CPropertyPage::DoDataExchange(pDX);
00121     //{{AFX_DATA_MAP(CUpdateMain)
00122     DDX_Check(pDX, IDC_DELSTICKY, m_delsticky);
00123     DDX_Check(pDX, IDC_NORECURS, m_norecurs);
00124     DDX_Check(pDX, IDC_STDOUT, m_stdout);
00125     DDX_Check(pDX, IDC_CREATEMISSDIR, m_createmissdir);
00126     DDX_Check(pDX, IDC_CLEANCOPY, m_getcleancopy);
00127     //}}AFX_DATA_MAP
00128 }
00129
00130
00131 BEGIN_MESSAGE_MAP(CUpdateMain, CPropertyPage)
00132     //{{AFX_MSG_MAP(CUpdateMain)
00133         // NOTE: the ClassWizard will add message map macros here
00134     //}}AFX_MSG_MAP
00135 END_MESSAGE_MAP()
00136
00137 IMPLEMENT_DYNCREATE(CUpdateSticky, CPropertyPage)
00138
00139 CUpdateSticky::CUpdateSticky(const char *rev, const char *date) : CPropertyPage(CUpdateSticky::IDD)
00140 {
00141     //{{AFX_DATA_INIT(CUpdateSticky)
00142     m_date = date;
00143     m_rev = rev;
00144     m_hasdate = FALSE;
00145     m_hasrev = FALSE;
00146     m_match = FALSE;
00147     //}}AFX_DATA_INIT
00148 }
00149
00150 CUpdateSticky::CUpdateSticky() : CPropertyPage(CUpdateSticky::IDD)
00151 {
00152 }
00153
00154 CUpdateSticky::~CUpdateSticky()
00155 {
00156 }
00157
00158 void CUpdateSticky::DoDataExchange(CDataExchange* pDX)
00159 {
00160     CPropertyPage::DoDataExchange(pDX);
00161     //{{AFX_DATA_MAP(CUpdateSticky)
00162     DDX_Control(pDX, IDC_COMBODATE, m_datedef);
00163     DDX_Control(pDX, IDC_COMBOREV, m_revdef);
00164     DDX_CBString(pDX, IDC_COMBODATE, m_date);
00165     DDX_CBString(pDX, IDC_COMBOREV, m_rev);
00166     DDX_Check(pDX, IDC_DATE, m_hasdate);
00167     DDX_Check(pDX, IDC_REV, m_hasrev);
00168     DDX_Check(pDX, IDC_MATCH, m_match);
00169     //}}AFX_DATA_MAP
00170     if(m_hasrev)
00171         DDV_MinChars(pDX, m_rev, 1);
00172     if(m_hasdate)
00173         DDV_MinChars(pDX, m_date, 1);
00174     if(!pDX->m_bSaveAndValidate)
00175     {
00176         OnDate();
00177         OnRev();
00178     }
00179     DDX_ComboMString(pDX, IDC_COMBOREV, gRevNames, m_revdef);
00180     DDX_ComboMString(pDX, IDC_COMBODATE, gDateNames, m_datedef);
00181 }
00182
00183 BEGIN_MESSAGE_MAP(CUpdateSticky, CPropertyPage)
00184     //{{AFX_MSG_MAP(CUpdateSticky)
00185     ON_BN_CLICKED(IDC_DATE, OnDate)
00186     ON_BN_CLICKED(IDC_REV, OnRev)
00187     //}}AFX_MSG_MAP
00188 END_MESSAGE_MAP()
00189
00190
00191 void CUpdateSticky::OnDate()
00192 {
00193     CButton* but = (CButton *)GetDlgItem(IDC_DATE);
00194     CWnd* wnd = GetDlgItem(IDC_COMBODATE);
00195     wnd->EnableWindow(but->GetCheck() == 1);
00196 }
00197
00198 void CUpdateSticky::OnRev()
00199 {
00200     CButton* but = (CButton *)GetDlgItem(IDC_REV);
00201     CWnd* wnd = GetDlgItem(IDC_COMBOREV);
00202     wnd->EnableWindow(but->GetCheck() == 1);
00203 }
00204
00205 IMPLEMENT_DYNCREATE(CUpdateMerge, CPropertyPage)
00206
00207 CUpdateMerge::CUpdateMerge(const char *rev1, const char *rev2) : CPropertyPage(CUpdateMerge::IDD)
00208 {
00209     //{{AFX_DATA_INIT(CUpdateMerge)
00210     m_rev1 = rev1;
00211     m_rev2 = rev2;
00212     m_merge = 0;
00213     //}}AFX_DATA_INIT
00214 }
00215
00216 CUpdateMerge::CUpdateMerge() : CPropertyPage(CUpdateMerge::IDD)
00217 {
00218 }
00219
00220 CUpdateMerge::~CUpdateMerge()
00221 {
00222 }
00223
00224 void CUpdateMerge::DoDataExchange(CDataExchange* pDX)
00225 {
00226     CPropertyPage::DoDataExchange(pDX);
00227     //{{AFX_DATA_MAP(CUpdateMerge)
00228     DDX_Control(pDX, IDC_COMBOREV2, m_comborevdef2);
00229     DDX_Control(pDX, IDC_COMBOREV, m_comborevdef);
00230     DDX_CBString(pDX, IDC_COMBOREV, m_rev1);
00231     DDX_CBString(pDX, IDC_COMBOREV2, m_rev2);
00232     DDX_Radio(pDX, IDC_MERGE, m_merge);
00233     //}}AFX_DATA_MAP
00234     if(m_merge == 1 || m_merge == 2)
00235         DDV_MinChars(pDX, m_rev1, 1);
00236     if(m_merge == 2)
00237         DDV_MinChars(pDX, m_rev2, 1);
00238     if(!pDX->m_bSaveAndValidate)
00239     {
00240         OnMerge();
00241     }
00242     DDX_ComboMString(pDX, IDC_COMBOREV, gRevNames, m_comborevdef);
00243     DDX_ComboMString(pDX, IDC_COMBOREV2, gRevNames, m_comborevdef2);
00244 }
00245
00246 void CUpdateMerge::OnMerge()
00247 {
00248     CButton* but = (CButton *)GetDlgItem(IDC_MERGE);
00249     CButton* but1 = (CButton *)GetDlgItem(IDC_MERGE1);
00250     CButton* but2 = (CButton *)GetDlgItem(IDC_MERGE2);
00251     CWnd* wnd1 = GetDlgItem(IDC_COMBOREV);
00252     CWnd* wnd2 = GetDlgItem(IDC_COMBOREV2);
00253     if(but->GetCheck() == 1)
00254     {
00255         wnd1->EnableWindow(FALSE);
00256         wnd2->EnableWindow(FALSE);
00257     }
00258     else if(but1->GetCheck() == 1)
00259     {
00260         wnd1->EnableWindow(TRUE);
00261         wnd2->EnableWindow(FALSE);
00262     }
00263     else
00264     {
00265         wnd1->EnableWindow(TRUE);
00266         wnd2->EnableWindow(TRUE);
00267     }
00268 }
00269
00270 void CUpdateMerge::OnMerge1()
00271 {
00272     OnMerge();
00273 }
00274
00275 void CUpdateMerge::OnMerge2()
00276 {
00277     OnMerge();
00278 }
00279
00280 BEGIN_MESSAGE_MAP(CUpdateMerge, CPropertyPage)
00281     //{{AFX_MSG_MAP(CUpdateMerge)
00282     ON_BN_CLICKED(IDC_MERGE, OnMerge)
00283     ON_BN_CLICKED(IDC_MERGE1, OnMerge1)
00284     ON_BN_CLICKED(IDC_MERGE2, OnMerge2)
00285     //}}AFX_MSG_MAP
00286 END_MESSAGE_MAP()
00287 #endif /* WIN32 */
00288
00289 #ifdef qMacCvsPP
00290 static void DoDataExchange_UpdateMerge(LWindow *theDialog, bool & merge1, bool & merge2,
00291     CPStr & sLastRev1, CPStr & sLastRev2, bool putValue)
00292 {
00293     LRadioButton *chkHasRev = dynamic_cast<LRadioButton*>
00294         (theDialog->FindPaneByID(item_CheckRevTag1));
00295     LEditText *editRev = dynamic_cast<LEditText*>
00296         (theDialog->FindPaneByID(item_EditRevTag1));
00297     LRadioButton *chkHasRev2 = dynamic_cast<LRadioButton*>
00298         (theDialog->FindPaneByID(item_CheckRevTag2));
00299     LEditText *editRev2 = dynamic_cast<LEditText*>
00300         (theDialog->FindPaneByID(item_EditRevTag2));
00301     LPopupFiller *fill1 = dynamic_cast<LPopupFiller*>
00302         (theDialog->FindPaneByID(item_FillerRev1));
00303     LPopupFiller *fill2 = dynamic_cast<LPopupFiller*>
00304         (theDialog->FindPaneByID(item_FillerRev2));
00305
00306     fill1->DoDataExchange(gRevNames, putValue);
00307     fill2->DoDataExchange(gRevNames, putValue);
00308
00309     if(putValue)
00310     {
00311         if(merge1 && merge2)
00312             theDialog->SetValueForPaneID (item_CheckRevTag2, Button_On);
00313         else if(merge1)
00314             theDialog->SetValueForPaneID (item_CheckRevTag1, Button_On);
00315         else
00316             theDialog->SetValueForPaneID (item_MergeNone, Button_On);
00317
00318         editRev->SetText((Ptr)(const char *)sLastRev1, sLastRev1.length());
00319         editRev2->SetText((Ptr)(const char *)sLastRev2, sLastRev2.length());
00320     }
00321     else
00322     {
00323         if(theDialog->GetValueForPaneID(item_CheckRevTag2) == Button_On)
00324         {
00325             merge1 = merge2 = true;
00326         }
00327         else if (theDialog->GetValueForPaneID(item_CheckRevTag1) == Button_On)
00328         {
00329             merge1 = true;
00330             merge2 = false;
00331         }
00332         else
00333         {
00334             merge1 = merge2 = false;
00335         }
00336
00337         char str[255];
00338         Size len;
00339
00340         editRev->GetText(str, 254, &len);
00341         sLastRev1.set(str, len);
00342         editRev2->GetText(str, 254, &len);
00343         sLastRev2.set(str, len);
00344     }
00345 }
00346
00347 static void DoDataExchange_UpdateSticky(LWindow *theDialog, bool & hasDate, bool & hasRev,
00348     CPStr & sLastDate, CPStr & sLastRev, bool & useMostRecent, bool putValue)
00349 {
00350     LCheckBox *chkHasDate = dynamic_cast<LCheckBox*>
00351         (theDialog->FindPaneByID(item_CheckDate));
00352     LCheckBox *chkHasRev = dynamic_cast<LCheckBox*>
00353         (theDialog->FindPaneByID(item_CheckRevTag));
00354     LCheckBox *chkMostRecent = dynamic_cast<LCheckBox*>
00355         (theDialog->FindPaneByID(item_MostRecentRev));
00356     LEditText *editDate = dynamic_cast<LEditText*>
00357         (theDialog->FindPaneByID(item_EditDate));
00358     LEditText *editRev = dynamic_cast<LEditText*>
00359         (theDialog->FindPaneByID(item_EditRevTag));
00360     LPopupFiller *fillTag = dynamic_cast<LPopupFiller*>
00361         (theDialog->FindPaneByID(item_FillerTag));
00362     LPopupFiller *fillDate = dynamic_cast<LPopupFiller*>
00363         (theDialog->FindPaneByID(item_FillerDate));
00364
00365     fillTag->DoDataExchange(gRevNames, putValue);
00366     fillDate->DoDataExchange(gDateNames, putValue);
00367
00368     if(putValue)
00369     {
00370         chkHasDate->SetValue(hasDate ? Button_On : Button_Off);
00371         chkHasRev->SetValue(hasRev ? Button_On : Button_Off);
00372         chkMostRecent->SetValue(useMostRecent ? Button_On : Button_Off);
00373         editDate->SetText((Ptr)(const char *)sLastDate, sLastDate.length());
00374         editRev->SetText((Ptr)(const char *)sLastRev, sLastRev.length());
00375     }
00376     else
00377     {
00378         hasDate = chkHasDate->GetValue() == Button_On;
00379         hasRev = chkHasRev->GetValue() == Button_On;
00380         useMostRecent = chkMostRecent->GetValue() == Button_On;
00381
00382         char str[255];
00383         Size len;
00384
00385         editDate->GetText(str, 254, &len);
00386         sLastDate.set(str, len);
00387         editRev->GetText(str, 254, &len);
00388         sLastRev.set(str, len);
00389     }
00390 }
00391
00392 static void DoDataExchange_UpdateSettings(LWindow *theDialog, bool & toStdout, bool & noRecurs,
00393     bool & resetSticky, bool & createMissDir, bool & getCleanCopy, bool putValue)
00394 {
00395     DoDataExchange (theDialog, item_NoRecurs, noRecurs, putValue);
00396     DoDataExchange (theDialog, item_ToStout, toStdout, putValue);
00397     DoDataExchange (theDialog, item_ResetSticky, resetSticky, putValue);
00398     DoDataExchange (theDialog, item_CreateMissDir, createMissDir, putValue);
00399     DoDataExchange (theDialog, item_GetCleanCopy, getCleanCopy, putValue);
00400
00401 }
00402 #endif /* qMacCvsPP */
00403
00404 #if qUnix
00405 class UCvsUpdate : public UWidget
00406 {
00407     UDECLARE_DYNAMIC(UCvsUpdate)
00408 public:
00409     UCvsUpdate() : UWidget(::UEventGetWidID()) {}
00410     virtual ~UCvsUpdate() {}
00411
00412     enum
00413     {
00414         kOK = EV_COMMAND_START, // 0
00415         kCancel,                // 1
00416         kTabGeneral             // 2
00417     };
00418
00419     virtual void DoDataExchange(bool fill);
00420
00421 protected:
00422     ev_msg int OnOK(void);
00423     ev_msg int OnCancel(void);
00424
00425     UDECLARE_MESSAGE_MAP()
00426 };
00427
00428 UIMPLEMENT_DYNAMIC(UCvsUpdate, UWidget)
00429
00430 UBEGIN_MESSAGE_MAP(UCvsUpdate, UWidget)
00431     ON_UCOMMAND(UCvsUpdate::kOK, UCvsUpdate::OnOK)
00432     ON_UCOMMAND(UCvsUpdate::kCancel, UCvsUpdate::OnCancel)
00433 UEND_MESSAGE_MAP()
00434
00435 int UCvsUpdate::OnOK(void)
00436 {
00437     EndModal(true);
00438     return 0;
00439 }
00440
00441 int UCvsUpdate::OnCancel(void)
00442 {
00443     EndModal(false);
00444     return 0;
00445 }
00446
00447 void UCvsUpdate::DoDataExchange(bool fill)
00448 {
00449     if(fill)
00450     {
00451     }
00452     else
00453     {
00454     }
00455 }
00456
00457 class UCvsUpdate_MAIN : public UWidget
00458 {
00459     UDECLARE_DYNAMIC(UCvsUpdate_MAIN)
00460 public:
00461     UCvsUpdate_MAIN() : UWidget(::UEventGetWidID()) {}
00462     virtual ~UCvsUpdate_MAIN() {}
00463
00464     enum
00465     {
00466         kCheckStdout = EV_COMMAND_START,    // 0
00467         kCheckRecurse,          // 1
00468         kCheckReset,            // 2
00469         kCheckMissing           // 3
00470     };
00471
00472     virtual void DoDataExchange(bool fill);
00473
00474     bool m_toStdout;
00475     bool m_noRecurs;
00476     bool m_resetSticky;
00477     bool m_createMissDir;
00478 protected:
00479
00480     UDECLARE_MESSAGE_MAP()
00481 };
00482
00483 UIMPLEMENT_DYNAMIC(UCvsUpdate_MAIN, UWidget)
00484
00485 UBEGIN_MESSAGE_MAP(UCvsUpdate_MAIN, UWidget)
00486 UEND_MESSAGE_MAP()
00487
00488 void UCvsUpdate_MAIN::DoDataExchange(bool fill)
00489 {
00490     if(fill)
00491     {
00492         m_toStdout = false;
00493         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckStdout, m_toStdout), 0L);
00494         m_noRecurs = false;
00495         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRecurse, m_noRecurs), 0L);
00496         m_resetSticky = false;
00497         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckReset, m_resetSticky), 0L);
00498         m_createMissDir = false;
00499         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckMissing, m_createMissDir), 0L);
00500     }
00501     else
00502     {
00503         m_toStdout = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckStdout, 0L) != 0;
00504         m_noRecurs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRecurse, 0L) != 0;
00505         m_resetSticky = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckReset, 0L) != 0;
00506         m_createMissDir = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckMissing, 0L) != 0;
00507     }
00508 }
00509
00510 class UCvsUpdate_STICKY : public UWidget
00511 {
00512     UDECLARE_DYNAMIC(UCvsUpdate_STICKY)
00513 public:
00514     UCvsUpdate_STICKY(const char *rev, const char *date);
00515     virtual ~UCvsUpdate_STICKY() {}
00516
00517     enum
00518     {
00519         kCheckDate = EV_COMMAND_START,  // 0
00520         kComboDate,         // 1
00521         kCheckRev,          // 2
00522         kComboRev,          // 3
00523         kCheckMatch         // 4
00524     };
00525
00526     virtual void DoDataExchange(bool fill);
00527
00528     UStr m_date;
00529     UStr m_rev;
00530     bool m_hasdate;
00531     bool m_hasrev;
00532     bool m_match;
00533 protected:
00534
00535     ev_msg int OnDate(void);
00536     ev_msg int OnRev(void);
00537
00538     UDECLARE_MESSAGE_MAP()
00539 };
00540
00541 UIMPLEMENT_DYNAMIC(UCvsUpdate_STICKY, UWidget)
00542
00543 UBEGIN_MESSAGE_MAP(UCvsUpdate_STICKY, UWidget)
00544     ON_UCOMMAND(UCvsUpdate_STICKY::kCheckDate, UCvsUpdate_STICKY::OnDate)
00545     ON_UCOMMAND(UCvsUpdate_STICKY::kCheckRev, UCvsUpdate_STICKY::OnRev)
00546 UEND_MESSAGE_MAP()
00547
00548 UCvsUpdate_STICKY::UCvsUpdate_STICKY(const char *rev, const char *date) : UWidget(::UEventGetWidID())
00549 {
00550     m_date = date;
00551     m_rev = rev;
00552     m_hasdate = false;
00553     m_hasrev = false;
00554     m_match = false;
00555 }
00556
00557 int UCvsUpdate_STICKY::OnDate()
00558 {
00559     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDate, 0L);
00560     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboDate, state), 0L);
00561     return 0;
00562 }
00563
00564 int UCvsUpdate_STICKY::OnRev()
00565 {
00566     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRev, 0L);
00567     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboRev, state), 0L);
00568     return 0;
00569 }
00570
00571 void UCvsUpdate_STICKY::DoDataExchange(bool fill)
00572 {
00573     ::DoDataExchange(fill, GetWidID(), kComboRev, gRevNames);
00574     ::DoDataExchange(fill, GetWidID(), kComboDate, gDateNames);
00575
00576     if(fill)
00577     {
00578         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckDate, m_hasdate), 0L);
00579         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRev, m_hasrev), 0L);
00580         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckMatch, m_match), 0L);
00581
00582         OnDate();
00583         OnRev();
00584     }
00585     else
00586     {
00587         m_hasdate = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDate, 0L);
00588         m_hasrev = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRev, 0L);
00589         m_match = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckMatch, 0L);
00590
00591         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboDate, &m_date);
00592         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboRev, &m_rev);
00593     }
00594 }
00595
00596 class UCvsUpdate_MERGE : public UWidget
00597 {
00598     UDECLARE_DYNAMIC(UCvsUpdate_MERGE)
00599 public:
00600     UCvsUpdate_MERGE(const char *rev1, const char *rev2);
00601     virtual ~UCvsUpdate_MERGE() {}
00602
00603     enum
00604     {
00605         kRadioNone = EV_COMMAND_START,  // 0
00606         kRadioMerge1,       // 1
00607         kRadioMerge2,       // 2
00608         kComboRev1,         // 3
00609         kComboRev2          // 4
00610     };
00611
00612     virtual void DoDataExchange(bool fill);
00613
00614     UStr m_rev1;
00615     UStr m_rev2;
00616     int m_merge;
00617 protected:
00618
00619     ev_msg int OnMerge(int cmd);
00620
00621     UDECLARE_MESSAGE_MAP()
00622 };
00623
00624 UIMPLEMENT_DYNAMIC(UCvsUpdate_MERGE, UWidget)
00625
00626 UBEGIN_MESSAGE_MAP(UCvsUpdate_MERGE, UWidget)
00627     ON_UCOMMAND_RANGE(UCvsUpdate_MERGE::kRadioNone, UCvsUpdate_MERGE::kRadioMerge2, UCvsUpdate_MERGE::OnMerge)
00628 UEND_MESSAGE_MAP()
00629
00630 UCvsUpdate_MERGE::UCvsUpdate_MERGE(const char *rev1, const char *rev2) : UWidget(::UEventGetWidID())
00631 {
00632     m_rev1 = rev1;
00633     m_rev2 = rev2;
00634     m_merge = 0;
00635 }
00636
00637 int UCvsUpdate_MERGE::OnMerge(int cmd)
00638 {
00639     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kRadioNone, 0L);
00640     if(state)
00641     {
00642         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboRev1, 0), 0L);
00643         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboRev2, 0), 0L);
00644     }
00645     else
00646     {
00647         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboRev1, 1), 0L);
00648         state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kRadioMerge1, 0L);
00649         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboRev2, state == 0), 0L);
00650     }
00651     return 0;
00652 }
00653
00654 void UCvsUpdate_MERGE::DoDataExchange(bool fill)
00655 {
00656     ::DoDataExchange(fill, GetWidID(), kComboRev1, gRevNames);
00657     ::DoDataExchange(fill, GetWidID(), kComboRev2, gRevNames);
00658
00659     if(fill)
00660     {
00661         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kRadioNone + m_merge, 1), 0L);
00662
00663         OnMerge(kRadioNone + m_merge);
00664     }
00665     else
00666     {
00667         if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kRadioNone, 0L))
00668             m_merge = 0;
00669         else if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kRadioMerge1, 0L))
00670             m_merge = 1;
00671         else
00672             m_merge = 2;
00673
00674         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboRev1, &m_rev1);
00675         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboRev2, &m_rev2);
00676     }
00677 }
00678 #endif // qUnix
00679
00680 bool CompatGetUpdate(bool & toStdout, bool & noRecurs, bool & resetSticky,
00681                      CPStr & date, CPStr & rev,
00682                      bool & useMostRecent,
00683                      CPStr & rev1, CPStr & rev2,
00684                      bool & createMissDir,
00685                      bool & getCleanCopy)
00686 {
00687     bool userHitOK = false;
00688
00689     static CPStr sLastDate;
00690     static CPStr sLastRev;
00691     static CPStr sLastRev1;
00692     static CPStr sLastRev2;
00693
00694     bool hasDate = false;
00695     bool hasRev = false;
00696     bool merge1 = false;
00697     bool merge2 = false;
00698
00699     date = "";
00700     rev = "";
00701     rev1 = "";
00702     rev2 = "";
00703     toStdout = false;
00704     noRecurs = false;
00705     resetSticky = false;
00706     useMostRecent = false;
00707     createMissDir = false;
00708     getCleanCopy = false;
00709
00710 #ifdef WIN32
00711     COptionalPropertySheet pages(gCvsPrefs.HideCommandDlgUpdate(), "Update settings");
00712     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00713     CUpdateMain page1;
00714     CUpdateSticky page2(sLastRev, sLastDate);
00715     CUpdateMerge page3(sLastRev1, sLastRev2);
00716     CGetPrefs_GLOBALS page4;
00717     pages.AddPage(&page1);
00718     pages.AddPage(&page2);
00719     pages.AddPage(&page3);
00720     pages.AddPage(&page4);
00721     if(pages.DoModal() == IDOK)
00722     {
00723         toStdout = page1.m_stdout == TRUE;
00724         noRecurs = page1.m_norecurs == TRUE;
00725         resetSticky = page1.m_delsticky == TRUE;
00726         createMissDir = page1.m_createmissdir == TRUE;
00727         getCleanCopy = page1.m_getcleancopy == TRUE;
00728
00729         sLastDate = page2.m_date;
00730         sLastRev = page2.m_rev;
00731         hasDate = page2.m_hasdate == TRUE;
00732         hasRev = page2.m_hasrev == TRUE;
00733         useMostRecent = page2.m_match == TRUE;
00734
00735         merge1 = page3.m_merge >= 1;
00736         merge2 = page3.m_merge == 2;
00737         sLastRev1 = page3.m_rev1;
00738         sLastRev2 = page3.m_rev2;
00739
00740         page4.StoreValues();
00741         gCvsPrefs.SetHideCommandDlgUpdate(pages.GetHideCommandDlg());
00742         userHitOK = true;
00743     }
00744 #endif /* WIN32 */
00745 #ifdef qMacCvsPP
00746     StDialogHandler theHandler(dlg_Update, LCommander::GetTopCommander());
00747     LWindow *theDialog = theHandler.GetDialog();
00748     ThrowIfNil_(theDialog);
00749     static UInt16 sRuntimePanel = 1;
00750
00751     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00752         (theDialog->FindPaneByID(item_MultiViewPrefs));
00753     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00754
00755     multiView->SwitchToPanel(4);
00756     DoDataExchange_Globals(theDialog, true);
00757     multiView->SwitchToPanel(3);
00758     DoDataExchange_UpdateMerge(theDialog, merge1, merge2, sLastRev1, sLastRev2, true);
00759     multiView->SwitchToPanel(2);
00760     DoDataExchange_UpdateSticky(theDialog, hasDate, hasRev, sLastDate, sLastRev, useMostRecent, true);
00761     multiView->SwitchToPanel(1);
00762     DoDataExchange_UpdateSettings(theDialog, toStdout, noRecurs, resetSticky, createMissDir, getCleanCopy, true);
00763
00764     groupView->SetValue(sRuntimePanel);
00765     theDialog->Show();
00766     MessageT hitMessage;
00767     while (true)
00768     {       // Let DialogHandler process events
00769         hitMessage = theHandler.DoDialog();
00770
00771         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00772             break;
00773     }
00774     theDialog->Hide();
00775     sRuntimePanel = groupView->GetValue();
00776
00777     if(hitMessage == msg_OK)
00778     {
00779         multiView->SwitchToPanel(1);
00780         DoDataExchange_UpdateSettings(theDialog, toStdout, noRecurs, resetSticky, createMissDir, getCleanCopy, false);
00781         multiView->SwitchToPanel(2);
00782         DoDataExchange_UpdateSticky(theDialog, hasDate, hasRev, sLastDate, sLastRev, useMostRecent, false);
00783         multiView->SwitchToPanel(3);
00784         DoDataExchange_UpdateMerge(theDialog, merge1, merge2, sLastRev1, sLastRev2, false);
00785         multiView->SwitchToPanel(4);
00786         DoDataExchange_Globals(theDialog, false);
00787         userHitOK = true;
00788     }
00789 #endif /* qMacCvsPP */
00790 #if qUnix
00791     void *wid;
00792 #   if qGTK
00793     wid = UCreate_UpdateDlg();
00794 #   endif
00795
00796     UCvsUpdate *dlg = new UCvsUpdate();
00797     UCvsUpdate_MAIN *tab1 = new UCvsUpdate_MAIN();
00798     UCvsUpdate_STICKY *tab2 = new UCvsUpdate_STICKY(sLastRev, sLastDate);
00799     UCvsUpdate_MERGE *tab3 = new UCvsUpdate_MERGE(sLastRev1, sLastRev2);
00800     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00801     dlg->AddPage(tab1, UCvsUpdate::kTabGeneral, 0);
00802     dlg->AddPage(tab2, UCvsUpdate::kTabGeneral, 1);
00803     dlg->AddPage(tab3, UCvsUpdate::kTabGeneral, 2);
00804
00805     if(dlg->DoModal())
00806     {
00807         toStdout = tab1->m_toStdout;
00808         noRecurs = tab1->m_noRecurs;
00809         resetSticky = tab1->m_resetSticky;
00810         createMissDir = tab1->m_createMissDir;
00811
00812         sLastDate = tab2->m_date;
00813         sLastRev = tab2->m_rev;
00814         hasDate = tab2->m_hasdate;
00815         hasRev = tab2->m_hasrev;
00816         useMostRecent = tab2->m_match;
00817
00818         merge1 = tab3->m_merge >= 1;
00819         merge2 = tab3->m_merge == 2;
00820         sLastRev1 = tab3->m_rev1;
00821         sLastRev2 = tab3->m_rev2;
00822
00823         userHitOK = true;
00824     }
00825
00826     delete dlg;
00827 #endif // qUnix
00828
00829     if(userHitOK)
00830     {
00831         if(hasDate && !sLastDate.empty())
00832             date = sLastDate;
00833         if(hasRev && !sLastRev.empty())
00834             rev = sLastRev;
00835
00836         if(merge1 && merge2 && !sLastRev1.empty() && !sLastRev2.empty())
00837         {
00838             rev1 = sLastRev1;
00839             rev2 = sLastRev2;
00840         }
00841         if(merge1 && !merge2 && !sLastRev1.empty())
00842         {
00843             rev1 = sLastRev1;
00844         }
00845
00846         gCvsPrefs.save();
00847     }
00848
00849     return userHitOK;
00850 }
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/UpdateDlg.h Source File

common/UpdateDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * UpdateDlg.h : the cvs update dialog
00023  */
00024
00025 #if !defined(AFX_UPDATEDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_UPDATEDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 #include "CPStr.h"
00033 #include "MultiString.h"
00034
00035 bool CompatGetUpdate(bool & toStdout, bool & noRecurs, bool & resetSticky,
00036                      CPStr & date, CPStr & rev,
00037                      bool & useMostRecent,
00038                      CPStr & rev1, CPStr & rev2,
00039                      bool & createMissDir,
00040                      bool & getCleanCopy);
00041     // get the update options...
00042
00043 extern CMString gRevNames;
00044 extern CMString gDateNames;
00045 extern CMString gDateOrRevNames;
00046     // persistent default values for the dates, tags...
00047
00048 #ifdef WIN32
00049 class CUpdateMain : public CPropertyPage
00050 {
00051     DECLARE_DYNCREATE(CUpdateMain)
00052
00053 // Construction
00054 public:
00055     CUpdateMain();
00056     ~CUpdateMain();
00057
00058 // Dialog Data
00059     //{{AFX_DATA(CUpdateMain)
00060     enum { IDD = IDD_UPDATE_MAIN };
00061     BOOL    m_delsticky;
00062     BOOL    m_norecurs;
00063     BOOL    m_stdout;
00064     BOOL    m_createmissdir;
00065     BOOL    m_getcleancopy;
00066     //}}AFX_DATA
00067
00068
00069 // Overrides
00070     // ClassWizard generate virtual function overrides
00071     //{{AFX_VIRTUAL(CUpdateMain)
00072     protected:
00073     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00074     //}}AFX_VIRTUAL
00075
00076 // Implementation
00077 protected:
00078     // Generated message map functions
00079     //{{AFX_MSG(CUpdateMain)
00080         // NOTE: the ClassWizard will add member functions here
00081     //}}AFX_MSG
00082     DECLARE_MESSAGE_MAP()
00083
00084 };
00085
00086 class CUpdateMerge : public CPropertyPage
00087 {
00088     DECLARE_DYNCREATE(CUpdateMerge)
00089
00090 // Construction
00091 public:
00092     CUpdateMerge(const char *rev1, const char *rev2);
00093     CUpdateMerge();
00094     ~CUpdateMerge();
00095
00096 // Dialog Data
00097     //{{AFX_DATA(CUpdateMerge)
00098     enum { IDD = IDD_UPDATE_MERGE };
00099     CComboBox   m_comborevdef2;
00100     CComboBox   m_comborevdef;
00101     CString m_rev1;
00102     CString m_rev2;
00103     int m_merge;
00104     //}}AFX_DATA
00105
00106
00107 // Overrides
00108     // ClassWizard generate virtual function overrides
00109     //{{AFX_VIRTUAL(CUpdateMerge)
00110     protected:
00111     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00112     //}}AFX_VIRTUAL
00113
00114 // Implementation
00115 protected:
00116     // Generated message map functions
00117     //{{AFX_MSG(CUpdateMerge)
00118     afx_msg void OnMerge();
00119     afx_msg void OnMerge1();
00120     afx_msg void OnMerge2();
00121     //}}AFX_MSG
00122     DECLARE_MESSAGE_MAP()
00123
00124 };
00125
00126 class CUpdateSticky : public CPropertyPage
00127 {
00128     DECLARE_DYNCREATE(CUpdateSticky)
00129
00130 // Construction
00131 public:
00132     CUpdateSticky(const char *rev, const char *date);
00133     CUpdateSticky();
00134     ~CUpdateSticky();
00135
00136 // Dialog Data
00137     //{{AFX_DATA(CUpdateSticky)
00138     enum { IDD = IDD_UPDATE_STICKY };
00139     CComboBox   m_datedef;
00140     CComboBox   m_revdef;
00141     CString m_date;
00142     CString m_rev;
00143     BOOL    m_hasdate;
00144     BOOL    m_hasrev;
00145     BOOL    m_match;
00146     //}}AFX_DATA
00147
00148
00149 // Overrides
00150     // ClassWizard generate virtual function overrides
00151     //{{AFX_VIRTUAL(CUpdateSticky)
00152     protected:
00153     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00154     //}}AFX_VIRTUAL
00155
00156 // Implementation
00157 protected:
00158     // Generated message map functions
00159     //{{AFX_MSG(CUpdateSticky)
00160     afx_msg void OnDate();
00161     afx_msg void OnRev();
00162     //}}AFX_MSG
00163     DECLARE_MESSAGE_MAP()
00164
00165 };
00166 //{{AFX_INSERT_LOCATION}}
00167 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00168 #endif /* WIN32 */
00169
00170 #endif // !defined(AFX_UPDATEDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/VolsPaths.c Source File

common/VolsPaths.c

Go to the documentation of this file.
00001 /*
00002  * Stollen from POV and added to MacCVS by
00003  * Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00004  */
00005
00006 /*==============================================================================
00007 Project:    POV-Ray
00008
00009 Version:    3
00010
00011 File:   VolsPaths.c
00012
00013 Description:
00014     Various volume and pathname handling routines.
00015 ------------------------------------------------------------------------------
00016 Author:
00017     Eduard [esp] Schwan
00018 ------------------------------------------------------------------------------
00019     from Persistence of Vision(tm) Ray Tracer
00020     Copyright 1996 Persistence of Vision Team
00021 ------------------------------------------------------------------------------
00022     NOTICE: This source code file is provided so that users may experiment
00023     with enhancements to POV-Ray and to port the software to platforms other
00024     than those supported by the POV-Ray Team.  There are strict rules under
00025     which you are permitted to use this file.  The rules are in the file
00026     named POVLEGAL.DOC which should be distributed with this file. If
00027     POVLEGAL.DOC is not available or for more info please contact the POV-Ray
00028     Team Coordinator by leaving a message in CompuServe's Graphics Developer's
00029     Forum.  The latest version of POV-Ray may be found there as well.
00030
00031     This program is based on the popular DKB raytracer version 2.12.
00032     DKBTrace was originally written by David K. Buck.
00033     DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
00034 ------------------------------------------------------------------------------
00035 Change History:
00036     941221  [esp]   Created
00037 ==============================================================================*/
00038
00039 #define VOLSPATHS_C
00040
00041 /*==== my header =====*/
00042 #include "VolsPaths.h"
00043
00044
00045 /*==== Macintosh-specific headers ====*/
00046 #include <Types.h>
00047 #include <Files.h>
00048 #include <Resources.h>
00049 #include <errors.h>         /* dupFNErr, etc */
00050 #include <Memory.h>         /* NewPtr, etc */
00051 #include <string.h>         /* strcpy/cat */
00052 #include <strings.h>        /* p2cstr */
00053 #include <TextUtils.h>      /* Munger */
00054
00055
00056 /*==== Standard C headers ====*/
00057
00058
00059 /*==== General definitions ====*/
00060
00061
00062 /*==== Global variables (external scope) ====*/
00063
00064
00065 /*==== Global variables (local scope) ====*/
00066
00067
00068 // ---------------------------------------------------------------------
00069 // VRef2VolName
00070 // ---------------------------------------------------------------------
00071 OSErr VRef2VolName(short theVRef, StringPtr theVolName)
00072 {
00073     OSErr           anError;
00074     HVolumeParam    pbVInfo;
00075
00076     pbVInfo.ioCompletion = NULL;
00077     theVolName[0] = '\0';
00078     pbVInfo.ioNamePtr = theVolName;
00079     pbVInfo.ioVRefNum = theVRef;
00080     pbVInfo.ioVolIndex = 0; // use VRefNum only
00081     anError = PBHGetVInfoSync((HParmBlkPtr)&pbVInfo);
00082
00083     return anError;
00084 } // VRef2VolName
00085
00086
00087 // ---------------------------------------------------------------------
00088 // VolName2VRef
00089 // ---------------------------------------------------------------------
00090 OSErr VolName2VRef(StringPtr myPVolName, short * theVRefPtr)
00091 {
00092     OSErr           anError = noErr;
00093     Boolean         foundIt = false;
00094     short           theDriveNum;
00095     short           theVRefNum;
00096     HParamBlockRec  aParamBlk;
00097     char            myCVolName[32], theCVolName[32];
00098     Str31           theVolName;
00099
00100     // convert passed vol name from P 2 C string for compare
00101     p2cstrcpy(myCVolName, myPVolName);
00102
00103     // loop through all mounted volumes, see if myPVolName matches one
00104     for (theDriveNum = 1; !foundIt && (anError==noErr); theDriveNum++)
00105     {
00106         theVolName[0] = '\0';
00107         aParamBlk.volumeParam.ioNamePtr = (StringPtr)&theVolName;
00108         aParamBlk.volumeParam.ioVolIndex = theDriveNum;
00109
00110         anError = PBHGetVInfoSync((HParmBlkPtr)&aParamBlk);
00111         if (anError == noErr)
00112         {
00113             p2cstrcpy(theCVolName, theVolName);
00114             if (strcmp(theCVolName, myCVolName)==0)
00115             {
00116                 foundIt = true;
00117                 theVRefNum = aParamBlk.volumeParam.ioVRefNum;
00118             }
00119         }
00120     }
00121
00122     if (foundIt)
00123         *theVRefPtr = theVRefNum;
00124     else
00125         *theVRefPtr = 0;
00126
00127     if (anError == nsvErr) // no such vol, just bumped end of volume list
00128         anError = noErr;
00129
00130     return anError;
00131 } // VolName2VRef
00132
00133
00134 // ---------------------------------------------------------------------
00135 // PathNameFromDirID
00136 // ---------------------------------------------------------------------
00137 /*
00138 Function:   PathNameFromDirID
00139
00140 Parameters:
00141     aDirID      the directory ID to start at
00142     avRefNum    the volume ref # to start at
00143     aPathStyle  The style of pathname to format (based on OS)
00144     aPath       the final path string is placed in this buffer
00145
00146 Return Value:
00147     zero is returned if OK, else an error is returned
00148
00149 Purpose/Description:
00150     PathNameFromDirID takes a real vRefNum and a DirID and returns
00151     the full pathname that corresponds to it.  It does this by calling
00152     _PBGetCatInfo for the given directory and finding out its name and
00153     the DirID of its parent. It then performs the same operation on the
00154     parent, sticking its name onto the beginning of the first directory.
00155     This whole process is continued until we have processed everything up
00156     to the root directory (identified with a DirID of 2).
00157 */
00158 OSErr PathNameFromDirID(const long          aDirID,
00159                         const short         avRefNum,
00160                         char                * aPath)
00161 {
00162     Handle      strHandle = NULL;
00163     OSErr       anError = noErr;
00164     long        currDirID = 0,
00165                 nextDirID = 0;
00166     Size        theLen = 0;     // GetHandleSize
00167     char        tempName[64];   // directory or volume name
00168     CInfoPBRec  aPBblock;
00169
00170     /* create an empty string handle for Munger */
00171     strHandle = NewHandle(0);
00172
00173     if (strHandle == NULL)
00174     {
00175         anError = MemError();
00176     }
00177     else
00178     {
00179         *aPath = '\0';
00180         aPBblock.dirInfo.ioCompletion   = NULL;
00181         aPBblock.dirInfo.ioNamePtr      = (StringPtr)tempName;  // temp destination buffer
00182         nextDirID                       = aDirID;   // start at DirID passed in..
00183
00184         /* walk up the directories, collecting dir names as we go, until we hit the top (volname) */
00185         do {
00186
00187             aPBblock.dirInfo.ioVRefNum      = avRefNum;
00188             aPBblock.dirInfo.ioFDirIndex    = -1; // ignore ioNamePtr input, use ioDirID
00189             aPBblock.dirInfo.ioDrDirID      = nextDirID;
00190
00191             anError = PBGetCatInfoSync(&aPBblock);
00192             currDirID   = aPBblock.dirInfo.ioDrDirID;   // remember current
00193             nextDirID   = aPBblock.dirInfo.ioDrParID;   // find parent for next loop
00194
00195             if (anError != noErr)
00196                 break;
00197
00198             /* Insert a separator in front of the Directory Entry */
00199             Munger(strHandle, 0L, NULL, 0L, ":", 1L);
00200
00201             /* Insert the next directory/volume name into the front of the string */
00202             Munger(strHandle, 0L, NULL, 0L, &(tempName[1]), (long)tempName[0]);
00203
00204             /* NOTE: fsRtDirID is defined in Files.h */
00205         } while (currDirID != fsRtDirID);
00206
00207         /* now move the string into the parameter */
00208         theLen = GetHandleSize(strHandle);
00209         if (!anError && theLen)
00210         {
00211             BlockMove(&(**strHandle), aPath, theLen);
00212             anError = MemError();
00213         }
00214         aPath[theLen] = '\0';   /* set C string length */
00215
00216         /* dispose of temp storage */
00217         DisposeHandle(strHandle);
00218
00219     } /*else NULL*/
00220
00221     return(anError);
00222
00223 } /* PathNameFromDirID */
00224
00225
00226 // ---------------------------------------------------------------------
00227 // PathNameFromWD
00228 // ---------------------------------------------------------------------
00229 /*
00230 Function:   PathNameFromWD
00231
00232 Parameters:
00233     avRefNum    the volume ref # to start at (Assumes WD is set)
00234     aPathStyle  The style of pathname to format (based on OS)
00235     aPath       the final path string is placed in this buffer
00236
00237 Return Value:
00238     Describe the value returned, or void
00239
00240 Purpose/Description:
00241     PathNameFromWD takes an HFS Working Directory ID and returns
00242     the full pathname that corresponds to it.  It does this by calling
00243     _PBGetWDInfo to get the vRefNum and DirID of the real directory.
00244     It then calls PathNameFromDirID and returns its result.
00245 */
00246 #if !TARGET_API_MAC_CARBON
00247 OSErr PathNameFromWD(   const short         avRefNum,
00248                         char                * aPath)
00249 {
00250     WDPBRec aPBblock;
00251     OSErr   anError = noErr;
00252
00253 /*
00254  PBGetWDInfo has a bug under A/UX 1.1.  If vRefNum is a real vRefNum
00255  and not a wdRefNum, then it returns garbage.  Since A/UX has only 1
00256  volume (in the Macintosh sense) and only 1 root directory, this can
00257  occur only when a file has been selected in the root directory (/).
00258  So we look for this and hard code the DirID and vRefNum.
00259  */
00260 #if defined(AUX)
00261     if ((aPathStyle == ePathTypeAUX) && (avRefNum == -1))
00262     {
00263         anError = PathNameFromDirID(fsRtDirID, -1, aPath);
00264     }
00265     else
00266 #endif
00267     {
00268         aPBblock.ioCompletion = NULL;
00269         aPBblock.ioNamePtr = NULL;
00270         aPBblock.ioVRefNum = avRefNum;
00271         aPBblock.ioWDIndex = 0;
00272         aPBblock.ioWDProcID = 0;
00273
00274         /* Change the Working Directory number in vRefnum into a real vRefnum */
00275         /* and DirID. The real vRefnum is returned in ioVRefnum, and the real */
00276         /* DirID is returned in ioWDDirID. */
00277
00278         anError = PBGetWDInfoSync(&aPBblock);
00279         if (anError == noErr)
00280             anError = PathNameFromDirID(aPBblock.ioWDDirID,
00281                                         aPBblock.ioWDVRefNum,
00282                                         aPath);
00283     }
00284
00285     return(anError);
00286
00287 } /* PathNameFromWD */
00288 #endif
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/VolsPaths.h Source File

common/VolsPaths.h

Go to the documentation of this file.
00001 /*
00002  * Stollen from POV and added to MacCVS by
00003  * Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00004  */
00005
00006 /*==============================================================================
00007 Project:    POV-Ray
00008
00009 Version:    3
00010
00011 File:   VolsPaths.h
00012
00013 Description:
00014     Various volume and pathname handling routines.
00015 ------------------------------------------------------------------------------
00016 Author:
00017     Eduard [esp] Schwan
00018 ------------------------------------------------------------------------------
00019     from Persistence of Vision(tm) Ray Tracer
00020     Copyright 1996 Persistence of Vision Team
00021 ------------------------------------------------------------------------------
00022     NOTICE: This source code file is provided so that users may experiment
00023     with enhancements to POV-Ray and to port the software to platforms other
00024     than those supported by the POV-Ray Team.  There are strict rules under
00025     which you are permitted to use this file.  The rules are in the file
00026     named POVLEGAL.DOC which should be distributed with this file. If
00027     POVLEGAL.DOC is not available or for more info please contact the POV-Ray
00028     Team Coordinator by leaving a message in CompuServe's Graphics Developer's
00029     Forum.  The latest version of POV-Ray may be found there as well.
00030
00031     This program is based on the popular DKB raytracer version 2.12.
00032     DKBTrace was originally written by David K. Buck.
00033     DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
00034 ------------------------------------------------------------------------------
00035 Change History:
00036     941221  [esp]   Created
00037 ==============================================================================*/
00038
00039 #ifndef VOLSPATHS_H
00040 #define VOLSPATHS_H
00041
00042
00043 /*==== Macintosh-specific headers ====*/
00044 #include <Types.h>
00045
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049
00050 /*==== Prototypes =====*/
00051
00052 OSErr VRef2VolName(short theVRef, StringPtr theVolName);
00053
00054 OSErr VolName2VRef(StringPtr myPVolName, short * theVRefPtr);
00055
00056 OSErr PathNameFromDirID(const long          aDirID,
00057                         const short         avRefNum,
00058                         char                * aPath);
00059
00060 #if !TARGET_API_MAC_CARBON
00061 OSErr PathNameFromWD(   const short         avRefNum,
00062                         char                * aPath);
00063 #endif
00064
00065 #ifdef __cplusplus
00066 }
00067 #endif
00068
00069 #endif //  VOLSPATHS_H
00070
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/acconfig.h Source File

cvs-1.10/acconfig.h

Go to the documentation of this file.
00001 /* Define if you have MIT Kerberos version 4 available.  */
00002 #undef HAVE_KERBEROS
00003
00004 /* Define if you have GSSAPI with MIT Kerberos version 5 available.  */
00005 #undef HAVE_GSSAPI
00006
00007 /* Define if GSS_C_NT_HOSTBASED_SERVICE is defined in the gssapi.h
00008    header file.  Only relevant when using GSSAPI.  */
00009 #undef HAVE_GSS_C_NT_HOSTBASED_SERVICE
00010
00011 /* Define if you want CVS to be able to be a remote repository client.  */
00012 #undef CLIENT_SUPPORT
00013
00014 /* Define if you want CVS to be able to serve repositories to remote
00015    clients.  */
00016 #undef SERVER_SUPPORT
00017
00018 /* Define if you want to use the password authenticated server.  */
00019 #undef AUTH_SERVER_SUPPORT
00020
00021 /* Define if you want encryption support.  */
00022 #undef ENCRYPTION
00023
00024 /* Define if you have the connect function.  */
00025 #undef HAVE_CONNECT
00026
00027 /* Define if this system supports chown(), link(), and friends.  */
00028 #undef PRESERVE_PERMISSIONS_SUPPORT
00029
00030 /* Define if you have memchr (always for CVS).  */
00031 #undef HAVE_MEMCHR
00032
00033 /* Define if you have strchr (always for CVS).  */
00034 #undef HAVE_STRCHR
00035
00036 /* Define if utime requires write access to the file (true on Windows,
00037    but not Unix).  */
00038 #undef UTIME_EXPECTS_WRITABLE
00039
00040 /* Define if setmode is required when writing binary data to stdout.  */
00041 #undef USE_SETMODE_STDOUT
00042
00043 /* Define if the diff library should use setmode for binary files.
00044    FIXME: Why two different macros for setmode?  */
00045 #undef HAVE_SETMODE
00046
00047 /* Define if you have the crypt function.  */
00048 #undef HAVE_CRYPT
00049
00050 /* Define if you have the getspnam function.  */
00051 #undef HAVE_GETSPNAM
00052
00053 /* Define to force lib/regex.c to use malloc instead of alloca.  */
00054 #undef REGEX_MALLOC
00055
00056 /* Define to force lib/regex.c to define re_comp et al.  */
00057 #undef _REGEX_RE_COMP
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/analyze.c Source File

cvs-1.10/diff/analyze.c

Go to the documentation of this file.
00001 /* Analyze file differences for GNU DIFF.
00002    Copyright (C) 1988, 1989, 1992, 1993, 1997 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018 /* The basic algorithm is described in:
00019    "An O(ND) Difference Algorithm and its Variations", Eugene Myers,
00020    Algorithmica Vol. 1 No. 2, 1986, pp. 251-266;
00021    see especially section 4.2, which describes the variation used below.
00022    Unless the --minimal option is specified, this code uses the TOO_EXPENSIVE
00023    heuristic, by Paul Eggert, to limit the cost to O(N**1.5 log N)
00024    at the price of producing suboptimal output for large inputs with
00025    many differences.
00026
00027    The basic algorithm was independently discovered as described in:
00028    "Algorithms for Approximate String Matching", E. Ukkonen,
00029    Information and Control Vol. 64, 1985, pp. 100-118.  */
00030
00031 #include "diff.h"
00032 #include "cmpbuf.h"
00033
00034 extern int no_discards;
00035
00036 static int *xvec, *yvec;    /* Vectors being compared. */
00037 static int *fdiag;      /* Vector, indexed by diagonal, containing
00038                    1 + the X coordinate of the point furthest
00039                    along the given diagonal in the forward
00040                    search of the edit matrix. */
00041 static int *bdiag;      /* Vector, indexed by diagonal, containing
00042                    the X coordinate of the point furthest
00043                    along the given diagonal in the backward
00044                    search of the edit matrix. */
00045 static int too_expensive;   /* Edit scripts longer than this are too
00046                    expensive to compute.  */
00047
00048 #define SNAKE_LIMIT 20  /* Snakes bigger than this are considered `big'.  */
00049
00050 struct partition
00051 {
00052   int xmid, ymid;   /* Midpoints of this partition.  */
00053   int lo_minimal;   /* Nonzero if low half will be analyzed minimally.  */
00054   int hi_minimal;   /* Likewise for high half.  */
00055 };
00056
00057 static int diag PARAMS((int, int, int, int, int, struct partition *));
00058 static struct change *add_change PARAMS((int, int, int, int, struct change *));
00059 static struct change *build_reverse_script PARAMS((struct file_data const[]));
00060 static struct change *build_script PARAMS((struct file_data const[]));
00061 static void briefly_report PARAMS((int, struct file_data const[]));
00062 static void compareseq PARAMS((int, int, int, int, int));
00063 static void discard_confusing_lines PARAMS((struct file_data[]));
00064 static void shift_boundaries PARAMS((struct file_data[]));
00065
00066 /* Find the midpoint of the shortest edit script for a specified
00067    portion of the two files.
00068
00069    Scan from the beginnings of the files, and simultaneously from the ends,
00070    doing a breadth-first search through the space of edit-sequence.
00071    When the two searches meet, we have found the midpoint of the shortest
00072    edit sequence.
00073
00074    If MINIMAL is nonzero, find the minimal edit script regardless
00075    of expense.  Otherwise, if the search is too expensive, use
00076    heuristics to stop the search and report a suboptimal answer.
00077
00078    Set PART->(XMID,YMID) to the midpoint (XMID,YMID).  The diagonal number
00079    XMID - YMID equals the number of inserted lines minus the number
00080    of deleted lines (counting only lines before the midpoint).
00081    Return the approximate edit cost; this is the total number of
00082    lines inserted or deleted (counting only lines before the midpoint),
00083    unless a heuristic is used to terminate the search prematurely.
00084
00085    Set PART->LEFT_MINIMAL to nonzero iff the minimal edit script for the
00086    left half of the partition is known; similarly for PART->RIGHT_MINIMAL.
00087
00088    This function assumes that the first lines of the specified portions
00089    of the two files do not match, and likewise that the last lines do not
00090    match.  The caller must trim matching lines from the beginning and end
00091    of the portions it is going to specify.
00092
00093    If we return the "wrong" partitions,
00094    the worst this can do is cause suboptimal diff output.
00095    It cannot cause incorrect diff output.  */
00096
00097 static int
00098 diag (xoff, xlim, yoff, ylim, minimal, part)
00099      int xoff, xlim, yoff, ylim, minimal;
00100      struct partition *part;
00101 {
00102   int *const fd = fdiag;    /* Give the compiler a chance. */
00103   int *const bd = bdiag;    /* Additional help for the compiler. */
00104   int const *const xv = xvec;   /* Still more help for the compiler. */
00105   int const *const yv = yvec;   /* And more and more . . . */
00106   int const dmin = xoff - ylim; /* Minimum valid diagonal. */
00107   int const dmax = xlim - yoff; /* Maximum valid diagonal. */
00108   int const fmid = xoff - yoff; /* Center diagonal of top-down search. */
00109   int const bmid = xlim - ylim; /* Center diagonal of bottom-up search. */
00110   int fmin = fmid, fmax = fmid; /* Limits of top-down search. */
00111   int bmin = bmid, bmax = bmid; /* Limits of bottom-up search. */
00112   int c;            /* Cost. */
00113   int odd = (fmid - bmid) & 1;  /* True if southeast corner is on an odd
00114                    diagonal with respect to the northwest. */
00115
00116   fd[fmid] = xoff;
00117   bd[bmid] = xlim;
00118
00119   for (c = 1;; ++c)
00120     {
00121       int d;            /* Active diagonal. */
00122       int big_snake = 0;
00123
00124       /* Extend the top-down search by an edit step in each diagonal. */
00125       fmin > dmin ? fd[--fmin - 1] = -1 : ++fmin;
00126       fmax < dmax ? fd[++fmax + 1] = -1 : --fmax;
00127       for (d = fmax; d >= fmin; d -= 2)
00128     {
00129       int x, y, oldx, tlo = fd[d - 1], thi = fd[d + 1];
00130
00131       if (tlo >= thi)
00132         x = tlo + 1;
00133       else
00134         x = thi;
00135       oldx = x;
00136       y = x - d;
00137       while (x < xlim && y < ylim && xv[x] == yv[y])
00138         ++x, ++y;
00139       if (x - oldx > SNAKE_LIMIT)
00140         big_snake = 1;
00141       fd[d] = x;
00142       if (odd && bmin <= d && d <= bmax && bd[d] <= x)
00143         {
00144           part->xmid = x;
00145           part->ymid = y;
00146           part->lo_minimal = part->hi_minimal = 1;
00147           return 2 * c - 1;
00148         }
00149     }
00150
00151       /* Similarly extend the bottom-up search.  */
00152       bmin > dmin ? bd[--bmin - 1] = INT_MAX : ++bmin;
00153       bmax < dmax ? bd[++bmax + 1] = INT_MAX : --bmax;
00154       for (d = bmax; d >= bmin; d -= 2)
00155     {
00156       int x, y, oldx, tlo = bd[d - 1], thi = bd[d + 1];
00157
00158       if (tlo < thi)
00159         x = tlo;
00160       else
00161         x = thi - 1;
00162       oldx = x;
00163       y = x - d;
00164       while (x > xoff && y > yoff && xv[x - 1] == yv[y - 1])
00165         --x, --y;
00166       if (oldx - x > SNAKE_LIMIT)
00167         big_snake = 1;
00168       bd[d] = x;
00169       if (!odd && fmin <= d && d <= fmax && x <= fd[d])
00170         {
00171           part->xmid = x;
00172           part->ymid = y;
00173           part->lo_minimal = part->hi_minimal = 1;
00174           return 2 * c;
00175         }
00176     }
00177
00178       if (minimal)
00179     continue;
00180
00181       /* Heuristic: check occasionally for a diagonal that has made
00182      lots of progress compared with the edit distance.
00183      If we have any such, find the one that has made the most
00184      progress and return it as if it had succeeded.
00185
00186      With this heuristic, for files with a constant small density
00187      of changes, the algorithm is linear in the file size.  */
00188
00189       if (c > 200 && big_snake && heuristic)
00190     {
00191       int best;
00192
00193       best = 0;
00194       for (d = fmax; d >= fmin; d -= 2)
00195         {
00196           int dd = d - fmid;
00197           int x = fd[d];
00198           int y = x - d;
00199           int v = (x - xoff) * 2 - dd;
00200           if (v > 12 * (c + (dd < 0 ? -dd : dd)))
00201         {
00202           if (v > best
00203               && xoff + SNAKE_LIMIT <= x && x < xlim
00204               && yoff + SNAKE_LIMIT <= y && y < ylim)
00205             {
00206               /* We have a good enough best diagonal;
00207              now insist that it end with a significant snake.  */
00208               int k;
00209
00210               for (k = 1; xv[x - k] == yv[y - k]; k++)
00211             if (k == SNAKE_LIMIT)
00212               {
00213                 best = v;
00214                 part->xmid = x;
00215                 part->ymid = y;
00216                 break;
00217               }
00218             }
00219         }
00220         }
00221       if (best > 0)
00222         {
00223           part->lo_minimal = 1;
00224           part->hi_minimal = 0;
00225           return 2 * c - 1;
00226         }
00227
00228       best = 0;
00229       for (d = bmax; d >= bmin; d -= 2)
00230         {
00231           int dd = d - bmid;
00232           int x = bd[d];
00233           int y = x - d;
00234           int v = (xlim - x) * 2 + dd;
00235           if (v > 12 * (c + (dd < 0 ? -dd : dd)))
00236         {
00237           if (v > best
00238               && xoff < x && x <= xlim - SNAKE_LIMIT
00239               && yoff < y && y <= ylim - SNAKE_LIMIT)
00240             {
00241               /* We have a good enough best diagonal;
00242              now insist that it end with a significant snake.  */
00243               int k;
00244
00245               for (k = 0; xv[x + k] == yv[y + k]; k++)
00246             if (k == SNAKE_LIMIT - 1)
00247               {
00248                 best = v;
00249                 part->xmid = x;
00250                 part->ymid = y;
00251                 break;
00252               }
00253             }
00254         }
00255         }
00256       if (best > 0)
00257         {
00258           part->lo_minimal = 0;
00259           part->hi_minimal = 1;
00260           return 2 * c - 1;
00261         }
00262     }
00263
00264       /* Heuristic: if we've gone well beyond the call of duty,
00265      give up and report halfway between our best results so far.  */
00266       if (c >= too_expensive)
00267     {
00268       int fxybest, fxbest;
00269       int bxybest, bxbest;
00270
00271       fxbest = bxbest = 0;  /* Pacify `gcc -Wall'.  */
00272
00273       /* Find forward diagonal that maximizes X + Y.  */
00274       fxybest = -1;
00275       for (d = fmax; d >= fmin; d -= 2)
00276         {
00277           int x = min (fd[d], xlim);
00278           int y = x - d;
00279           if (ylim < y)
00280         x = ylim + d, y = ylim;
00281           if (fxybest < x + y)
00282         {
00283           fxybest = x + y;
00284           fxbest = x;
00285         }
00286         }
00287
00288       /* Find backward diagonal that minimizes X + Y.  */
00289       bxybest = INT_MAX;
00290       for (d = bmax; d >= bmin; d -= 2)
00291         {
00292           int x = max (xoff, bd[d]);
00293           int y = x - d;
00294           if (y < yoff)
00295         x = yoff + d, y = yoff;
00296           if (x + y < bxybest)
00297         {
00298           bxybest = x + y;
00299           bxbest = x;
00300         }
00301         }
00302
00303       /* Use the better of the two diagonals.  */
00304       if ((xlim + ylim) - bxybest < fxybest - (xoff + yoff))
00305         {
00306           part->xmid = fxbest;
00307           part->ymid = fxybest - fxbest;
00308           part->lo_minimal = 1;
00309           part->hi_minimal = 0;
00310         }
00311       else
00312         {
00313           part->xmid = bxbest;
00314           part->ymid = bxybest - bxbest;
00315           part->lo_minimal = 0;
00316           part->hi_minimal = 1;
00317         }
00318       return 2 * c - 1;
00319     }
00320     }
00321 }
00322
00323 /* Compare in detail contiguous subsequences of the two files
00324    which are known, as a whole, to match each other.
00325
00326    The results are recorded in the vectors files[N].changed_flag, by
00327    storing a 1 in the element for each line that is an insertion or deletion.
00328
00329    The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1.
00330
00331    Note that XLIM, YLIM are exclusive bounds.
00332    All line numbers are origin-0 and discarded lines are not counted.
00333
00334    If MINIMAL is nonzero, find a minimal difference no matter how
00335    expensive it is.  */
00336
00337 static void
00338 compareseq (xoff, xlim, yoff, ylim, minimal)
00339      int xoff, xlim, yoff, ylim, minimal;
00340 {
00341   int * const xv = xvec; /* Help the compiler.  */
00342   int * const yv = yvec;
00343
00344   /* Slide down the bottom initial diagonal. */
00345   while (xoff < xlim && yoff < ylim && xv[xoff] == yv[yoff])
00346     ++xoff, ++yoff;
00347   /* Slide up the top initial diagonal. */
00348   while (xlim > xoff && ylim > yoff && xv[xlim - 1] == yv[ylim - 1])
00349     --xlim, --ylim;
00350
00351   /* Handle simple cases. */
00352   if (xoff == xlim)
00353     while (yoff < ylim)
00354       files[1].changed_flag[files[1].realindexes[yoff++]] = 1;
00355   else if (yoff == ylim)
00356     while (xoff < xlim)
00357       files[0].changed_flag[files[0].realindexes[xoff++]] = 1;
00358   else
00359     {
00360       int c;
00361       struct partition part;
00362
00363       /* Find a point of correspondence in the middle of the files.  */
00364
00365       c = diag (xoff, xlim, yoff, ylim, minimal, &part);
00366
00367       if (c == 1)
00368     {
00369       /* This should be impossible, because it implies that
00370          one of the two subsequences is empty,
00371          and that case was handled above without calling `diag'.
00372          Let's verify that this is true.  */
00373       abort ();
00374 #if 0
00375       /* The two subsequences differ by a single insert or delete;
00376          record it and we are done.  */
00377       if (part.xmid - part.ymid < xoff - yoff)
00378         files[1].changed_flag[files[1].realindexes[part.ymid - 1]] = 1;
00379       else
00380         files[0].changed_flag[files[0].realindexes[part.xmid]] = 1;
00381 #endif
00382     }
00383       else
00384     {
00385       /* Use the partitions to split this problem into subproblems.  */
00386       compareseq (xoff, part.xmid, yoff, part.ymid, part.lo_minimal);
00387       compareseq (part.xmid, xlim, part.ymid, ylim, part.hi_minimal);
00388     }
00389     }
00390 }
00391
00392 /* Discard lines from one file that have no matches in the other file.
00393
00394    A line which is discarded will not be considered by the actual
00395    comparison algorithm; it will be as if that line were not in the file.
00396    The file's `realindexes' table maps virtual line numbers
00397    (which don't count the discarded lines) into real line numbers;
00398    this is how the actual comparison algorithm produces results
00399    that are comprehensible when the discarded lines are counted.
00400
00401    When we discard a line, we also mark it as a deletion or insertion
00402    so that it will be printed in the output.  */
00403
00404 static void
00405 discard_confusing_lines (filevec)
00406      struct file_data filevec[];
00407 {
00408   unsigned int f, i;
00409   char *discarded[2];
00410   int *equiv_count[2];
00411   int *p;
00412
00413   /* Allocate our results.  */
00414   p = (int *) xmalloc ((filevec[0].buffered_lines + filevec[1].buffered_lines)
00415                * (2 * sizeof (int)));
00416   for (f = 0; f < 2; f++)
00417     {
00418       filevec[f].undiscarded = p;  p += filevec[f].buffered_lines;
00419       filevec[f].realindexes = p;  p += filevec[f].buffered_lines;
00420     }
00421
00422   /* Set up equiv_count[F][I] as the number of lines in file F
00423      that fall in equivalence class I.  */
00424
00425   p = (int *) xmalloc (filevec[0].equiv_max * (2 * sizeof (int)));
00426   equiv_count[0] = p;
00427   equiv_count[1] = p + filevec[0].equiv_max;
00428   bzero (p, filevec[0].equiv_max * (2 * sizeof (int)));
00429
00430   for (i = 0; i < filevec[0].buffered_lines; ++i)
00431     ++equiv_count[0][filevec[0].equivs[i]];
00432   for (i = 0; i < filevec[1].buffered_lines; ++i)
00433     ++equiv_count[1][filevec[1].equivs[i]];
00434
00435   /* Set up tables of which lines are going to be discarded.  */
00436
00437   discarded[0] = xmalloc (sizeof (char)
00438               * (filevec[0].buffered_lines
00439                  + filevec[1].buffered_lines));
00440   discarded[1] = discarded[0] + filevec[0].buffered_lines;
00441   bzero (discarded[0], sizeof (char) * (filevec[0].buffered_lines
00442                     + filevec[1].buffered_lines));
00443
00444   /* Mark to be discarded each line that matches no line of the other file.
00445      If a line matches many lines, mark it as provisionally discardable.  */
00446
00447   for (f = 0; f < 2; f++)
00448     {
00449       unsigned int end = filevec[f].buffered_lines;
00450       char *discards = discarded[f];
00451       int *counts = equiv_count[1 - f];
00452       int *equivs = filevec[f].equivs;
00453       unsigned int many = 5;
00454       unsigned int tem = end / 64;
00455
00456       /* Multiply MANY by approximate square root of number of lines.
00457      That is the threshold for provisionally discardable lines.  */
00458       while ((tem = tem >> 2) > 0)
00459     many *= 2;
00460
00461       for (i = 0; i < end; i++)
00462     {
00463       int nmatch;
00464       if (equivs[i] == 0)
00465         continue;
00466       nmatch = counts[equivs[i]];
00467       if (nmatch == 0)
00468         discards[i] = 1;
00469       else if (nmatch > many)
00470         discards[i] = 2;
00471     }
00472     }
00473
00474   /* Don't really discard the provisional lines except when they occur
00475      in a run of discardables, with nonprovisionals at the beginning
00476      and end.  */
00477
00478   for (f = 0; f < 2; f++)
00479     {
00480       unsigned int end = filevec[f].buffered_lines;
00481       register char *discards = discarded[f];
00482
00483       for (i = 0; i < end; i++)
00484     {
00485       /* Cancel provisional discards not in middle of run of discards.  */
00486       if (discards[i] == 2)
00487         discards[i] = 0;
00488       else if (discards[i] != 0)
00489         {
00490           /* We have found a nonprovisional discard.  */
00491           register int j;
00492           unsigned int length;
00493           unsigned int provisional = 0;
00494
00495           /* Find end of this run of discardable lines.
00496          Count how many are provisionally discardable.  */
00497           for (j = i; j < end; j++)
00498         {
00499           if (discards[j] == 0)
00500             break;
00501           if (discards[j] == 2)
00502             ++provisional;
00503         }
00504
00505           /* Cancel provisional discards at end, and shrink the run.  */
00506           while (j > i && discards[j - 1] == 2)
00507         discards[--j] = 0, --provisional;
00508
00509           /* Now we have the length of a run of discardable lines
00510          whose first and last are not provisional.  */
00511           length = j - i;
00512
00513           /* If 1/4 of the lines in the run are provisional,
00514          cancel discarding of all provisional lines in the run.  */
00515           if (provisional * 4 > length)
00516         {
00517           while (j > i)
00518             if (discards[--j] == 2)
00519               discards[j] = 0;
00520         }
00521           else
00522         {
00523           register unsigned int consec;
00524           unsigned int minimum = 1;
00525           unsigned int tem = length / 4;
00526
00527           /* MINIMUM is approximate square root of LENGTH/4.
00528              A subrun of two or more provisionals can stand
00529              when LENGTH is at least 16.
00530              A subrun of 4 or more can stand when LENGTH >= 64.  */
00531           while ((tem = tem >> 2) > 0)
00532             minimum *= 2;
00533           minimum++;
00534
00535           /* Cancel any subrun of MINIMUM or more provisionals
00536              within the larger run.  */
00537           for (j = 0, consec = 0; j < length; j++)
00538             if (discards[i + j] != 2)
00539               consec = 0;
00540             else if (minimum == ++consec)
00541               /* Back up to start of subrun, to cancel it all.  */
00542               j -= consec;
00543             else if (minimum < consec)
00544               discards[i + j] = 0;
00545
00546           /* Scan from beginning of run
00547              until we find 3 or more nonprovisionals in a row
00548              or until the first nonprovisional at least 8 lines in.
00549              Until that point, cancel any provisionals.  */
00550           for (j = 0, consec = 0; j < length; j++)
00551             {
00552               if (j >= 8 && discards[i + j] == 1)
00553             break;
00554               if (discards[i + j] == 2)
00555             consec = 0, discards[i + j] = 0;
00556               else if (discards[i + j] == 0)
00557             consec = 0;
00558               else
00559             consec++;
00560               if (consec == 3)
00561             break;
00562             }
00563
00564           /* I advances to the last line of the run.  */
00565           i += length - 1;
00566
00567           /* Same thing, from end.  */
00568           for (j = 0, consec = 0; j < length; j++)
00569             {
00570               if (j >= 8 && discards[i - j] == 1)
00571             break;
00572               if (discards[i - j] == 2)
00573             consec = 0, discards[i - j] = 0;
00574               else if (discards[i - j] == 0)
00575             consec = 0;
00576               else
00577             consec++;
00578               if (consec == 3)
00579             break;
00580             }
00581         }
00582         }
00583     }
00584     }
00585
00586   /* Actually discard the lines. */
00587   for (f = 0; f < 2; f++)
00588     {
00589       char *discards = discarded[f];
00590       unsigned int end = filevec[f].buffered_lines;
00591       unsigned int j = 0;
00592       for (i = 0; i < end; ++i)
00593     if (no_discards || discards[i] == 0)
00594       {
00595         filevec[f].undiscarded[j] = filevec[f].equivs[i];
00596         filevec[f].realindexes[j++] = i;
00597       }
00598     else
00599       filevec[f].changed_flag[i] = 1;
00600       filevec[f].nondiscarded_lines = j;
00601     }
00602
00603   free (discarded[0]);
00604   free (equiv_count[0]);
00605 }
00606
00607 /* Adjust inserts/deletes of identical lines to join changes
00608    as much as possible.
00609
00610    We do something when a run of changed lines include a
00611    line at one end and have an excluded, identical line at the other.
00612    We are free to choose which identical line is included.
00613    `compareseq' usually chooses the one at the beginning,
00614    but usually it is cleaner to consider the following identical line
00615    to be the "change".  */
00616
00617 int inhibit;
00618
00619 static void
00620 shift_boundaries (filevec)
00621      struct file_data filevec[];
00622 {
00623   int f;
00624   int inhibit_hunk_merge = horizon_lines != context;
00625
00626   for (f = 0; f < 2; f++)
00627     {
00628       char *changed = filevec[f].changed_flag;
00629       char const *other_changed = filevec[1-f].changed_flag;
00630       int const *equivs = filevec[f].equivs;
00631       int i = 0;
00632       int j = 0;
00633       int i_end = filevec[f].buffered_lines;
00634
00635       while (1)
00636     {
00637       int runlength, start, corresponding;
00638
00639       /* Scan forwards to find beginning of another run of changes.
00640          Also keep track of the corresponding point in the other file.  */
00641
00642       while (i < i_end && changed[i] == 0)
00643         {
00644           while (other_changed[j++])
00645         continue;
00646           i++;
00647         }
00648
00649       if (i == i_end)
00650         break;
00651
00652       start = i;
00653
00654       /* Find the end of this run of changes.  */
00655
00656       while (changed[++i])
00657         continue;
00658       while (other_changed[j])
00659         j++;
00660
00661       do
00662         {
00663           /* Record the length of this run of changes, so that
00664          we can later determine whether the run has grown.  */
00665           runlength = i - start;
00666
00667           if (! inhibit_hunk_merge)
00668         {
00669           /* Move the changed region back, so long as the
00670              previous unchanged line matches the last changed one.
00671              This merges with previous changed regions.  */
00672
00673           while (start && equivs[start - 1] == equivs[i - 1])
00674             {
00675               changed[--start] = 1;
00676               changed[--i] = 0;
00677               while (changed[start - 1])
00678             start--;
00679               while (other_changed[--j])
00680             continue;
00681             }
00682         }
00683
00684           /* Set CORRESPONDING to the end of the changed run, at the last
00685          point where it corresponds to a changed run in the other file.
00686          CORRESPONDING == I_END means no such point has been found.  */
00687           corresponding = other_changed[j - 1] ? i : i_end;
00688
00689           /* Shift the changed region forward, so long as the
00690          first changed line matches the following unchanged one,
00691          but if INHIBIT_HUNK_MERGE is 1 do not shift if
00692          this would merge with another changed region.
00693          Do this second, so that if there are no merges,
00694          the changed region is moved forward as far as possible.  */
00695
00696           while (i != i_end && equivs[start] == equivs[i]
00697              && ! (inhibit_hunk_merge & other_changed[j + 1]))
00698         {
00699           changed[start++] = 0;
00700           changed[i++] = 1;
00701           while (changed[i])
00702             i++;
00703           while (other_changed[++j])
00704             corresponding = i;
00705         }
00706         }
00707       while (runlength != i - start);
00708
00709       /* If possible, move the fully-merged run of changes
00710          back to a corresponding run in the other file.  */
00711
00712       while (corresponding < i)
00713         {
00714           changed[--start] = 1;
00715           changed[--i] = 0;
00716           while (other_changed[--j])
00717         continue;
00718         }
00719     }
00720     }
00721 }
00722
00723 /* Cons an additional entry onto the front of an edit script OLD.
00724    LINE0 and LINE1 are the first affected lines in the two files (origin 0).
00725    DELETED is the number of lines deleted here from file 0.
00726    INSERTED is the number of lines inserted here in file 1.
00727
00728    If DELETED is 0 then LINE0 is the number of the line before
00729    which the insertion was done; vice versa for INSERTED and LINE1.  */
00730
00731 static struct change *
00732 add_change (line0, line1, deleted, inserted, old)
00733      int line0, line1, deleted, inserted;
00734      struct change *old;
00735 {
00736   struct change *new = (struct change *) xmalloc (sizeof (struct change));
00737
00738   new->line0 = line0;
00739   new->line1 = line1;
00740   new->inserted = inserted;
00741   new->deleted = deleted;
00742   new->link = old;
00743   return new;
00744 }
00745
00746 /* Scan the tables of which lines are inserted and deleted,
00747    producing an edit script in reverse order.  */
00748
00749 static struct change *
00750 build_reverse_script (filevec)
00751      struct file_data const filevec[];
00752 {
00753   struct change *script = 0;
00754   char *changed0 = filevec[0].changed_flag;
00755   char *changed1 = filevec[1].changed_flag;
00756   int len0 = filevec[0].buffered_lines;
00757   int len1 = filevec[1].buffered_lines;
00758
00759   /* Note that changedN[len0] does exist, and contains 0.  */
00760
00761   int i0 = 0, i1 = 0;
00762
00763   while (i0 < len0 || i1 < len1)
00764     {
00765       if (changed0[i0] || changed1[i1])
00766     {
00767       int line0 = i0, line1 = i1;
00768
00769       /* Find # lines changed here in each file.  */
00770       while (changed0[i0]) ++i0;
00771       while (changed1[i1]) ++i1;
00772
00773       /* Record this change.  */
00774       script = add_change (line0, line1, i0 - line0, i1 - line1, script);
00775     }
00776
00777       /* We have reached lines in the two files that match each other.  */
00778       i0++, i1++;
00779     }
00780
00781   return script;
00782 }
00783
00784 /* Scan the tables of which lines are inserted and deleted,
00785    producing an edit script in forward order.  */
00786
00787 static struct change *
00788 build_script (filevec)
00789      struct file_data const filevec[];
00790 {
00791   struct change *script = 0;
00792   char *changed0 = filevec[0].changed_flag;
00793   char *changed1 = filevec[1].changed_flag;
00794   int i0 = filevec[0].buffered_lines, i1 = filevec[1].buffered_lines;
00795
00796   /* Note that changedN[-1] does exist, and contains 0.  */
00797
00798   while (i0 >= 0 || i1 >= 0)
00799     {
00800       if (changed0[i0 - 1] || changed1[i1 - 1])
00801     {
00802       int line0 = i0, line1 = i1;
00803
00804       /* Find # lines changed here in each file.  */
00805       while (changed0[i0 - 1]) --i0;
00806       while (changed1[i1 - 1]) --i1;
00807
00808       /* Record this change.  */
00809       script = add_change (i0, i1, line0 - i0, line1 - i1, script);
00810     }
00811
00812       /* We have reached lines in the two files that match each other.  */
00813       i0--, i1--;
00814     }
00815
00816   return script;
00817 }
00818
00819 /* If CHANGES, briefly report that two files differed.  */
00820 static void
00821 briefly_report (changes, filevec)
00822      int changes;
00823      struct file_data const filevec[];
00824 {
00825   if (changes)
00826     message (no_details_flag ? "Files %s and %s differ\n"
00827          : "Binary files %s and %s differ\n",
00828          filevec[0].name, filevec[1].name);
00829 }
00830
00831 /* Report the differences of two files.  DEPTH is the current directory
00832    depth. */
00833 int
00834 diff_2_files (filevec, depth)
00835      struct file_data filevec[];
00836      int depth;
00837 {
00838   int diags;
00839   int i;
00840   struct change *e, *p;
00841   struct change *script;
00842   int changes;
00843
00844
00845   /* If we have detected that either file is binary,
00846      compare the two files as binary.  This can happen
00847      only when the first chunk is read.
00848      Also, --brief without any --ignore-* options means
00849      we can speed things up by treating the files as binary.  */
00850
00851   if (read_files (filevec, no_details_flag & ~ignore_some_changes))
00852     {
00853       /* Files with different lengths must be different.  */
00854       if (filevec[0].stat.st_size != filevec[1].stat.st_size
00855       && (filevec[0].desc < 0 || S_ISREG (filevec[0].stat.st_mode))
00856       && (filevec[1].desc < 0 || S_ISREG (filevec[1].stat.st_mode)))
00857     changes = 1;
00858
00859       /* Standard input equals itself.  */
00860       else if (filevec[0].desc == filevec[1].desc)
00861     changes = 0;
00862
00863       else
00864     /* Scan both files, a buffer at a time, looking for a difference.  */
00865     {
00866       /* Allocate same-sized buffers for both files.  */
00867       size_t buffer_size = buffer_lcm (STAT_BLOCKSIZE (filevec[0].stat),
00868                        STAT_BLOCKSIZE (filevec[1].stat));
00869       for (i = 0; i < 2; i++)
00870         filevec[i].buffer = xrealloc (filevec[i].buffer, buffer_size);
00871
00872       for (;;  filevec[0].buffered_chars = filevec[1].buffered_chars = 0)
00873         {
00874           /* Read a buffer's worth from both files.  */
00875           for (i = 0; i < 2; i++)
00876         if (0 <= filevec[i].desc)
00877           while (filevec[i].buffered_chars != buffer_size)
00878             {
00879               int r = read (filevec[i].desc,
00880                     filevec[i].buffer
00881                     + filevec[i].buffered_chars,
00882                     buffer_size - filevec[i].buffered_chars);
00883               if (r == 0)
00884             break;
00885               if (r < 0)
00886             pfatal_with_name (filevec[i].name);
00887               filevec[i].buffered_chars += r;
00888             }
00889
00890           /* If the buffers differ, the files differ.  */
00891           if (filevec[0].buffered_chars != filevec[1].buffered_chars
00892           || (filevec[0].buffered_chars != 0
00893               && memcmp (filevec[0].buffer,
00894                  filevec[1].buffer,
00895                  filevec[0].buffered_chars) != 0))
00896         {
00897           changes = 1;
00898           break;
00899         }
00900
00901           /* If we reach end of file, the files are the same.  */
00902           if (filevec[0].buffered_chars != buffer_size)
00903         {
00904           changes = 0;
00905           break;
00906         }
00907         }
00908     }
00909
00910       briefly_report (changes, filevec);
00911     }
00912   else
00913     {
00914       /* Allocate vectors for the results of comparison:
00915      a flag for each line of each file, saying whether that line
00916      is an insertion or deletion.
00917      Allocate an extra element, always zero, at each end of each vector.  */
00918
00919       size_t s = filevec[0].buffered_lines + filevec[1].buffered_lines + 4;
00920       filevec[0].changed_flag = xmalloc (s);
00921       bzero (filevec[0].changed_flag, s);
00922       filevec[0].changed_flag++;
00923       filevec[1].changed_flag = filevec[0].changed_flag
00924                 + filevec[0].buffered_lines + 2;
00925
00926       /* Some lines are obviously insertions or deletions
00927      because they don't match anything.  Detect them now, and
00928      avoid even thinking about them in the main comparison algorithm.  */
00929
00930       discard_confusing_lines (filevec);
00931
00932       /* Now do the main comparison algorithm, considering just the
00933      undiscarded lines.  */
00934
00935       xvec = filevec[0].undiscarded;
00936       yvec = filevec[1].undiscarded;
00937       diags = filevec[0].nondiscarded_lines + filevec[1].nondiscarded_lines + 3;
00938       fdiag = (int *) xmalloc (diags * (2 * sizeof (int)));
00939       bdiag = fdiag + diags;
00940       fdiag += filevec[1].nondiscarded_lines + 1;
00941       bdiag += filevec[1].nondiscarded_lines + 1;
00942
00943       /* Set TOO_EXPENSIVE to be approximate square root of input size,
00944      bounded below by 256.  */
00945       too_expensive = 1;
00946       for (i = filevec[0].nondiscarded_lines + filevec[1].nondiscarded_lines;
00947        i != 0; i >>= 2)
00948     too_expensive <<= 1;
00949       too_expensive = max (256, too_expensive);
00950
00951       files[0] = filevec[0];
00952       files[1] = filevec[1];
00953
00954       compareseq (0, filevec[0].nondiscarded_lines,
00955           0, filevec[1].nondiscarded_lines, no_discards);
00956
00957       free (fdiag - (filevec[1].nondiscarded_lines + 1));
00958
00959       /* Modify the results slightly to make them prettier
00960      in cases where that can validly be done.  */
00961
00962       shift_boundaries (filevec);
00963
00964       /* Get the results of comparison in the form of a chain
00965      of `struct change's -- an edit script.  */
00966
00967       if (output_style == OUTPUT_ED)
00968     script = build_reverse_script (filevec);
00969       else
00970     script = build_script (filevec);
00971
00972       /* Set CHANGES if we had any diffs.
00973      If some changes are ignored, we must scan the script to decide.  */
00974       if (ignore_blank_lines_flag || ignore_regexp_list)
00975     {
00976       struct change *next = script;
00977       changes = 0;
00978
00979       while (next && changes == 0)
00980         {
00981           struct change *this, *end;
00982           int first0, last0, first1, last1, deletes, inserts;
00983
00984           /* Find a set of changes that belong together.  */
00985           this = next;
00986           end = find_change (next);
00987
00988           /* Disconnect them from the rest of the changes, making them
00989          a hunk, and remember the rest for next iteration.  */
00990           next = end->link;
00991           end->link = 0;
00992
00993           /* Determine whether this hunk is really a difference.  */
00994           analyze_hunk (this, &first0, &last0, &first1, &last1,
00995                 &deletes, &inserts);
00996
00997           /* Reconnect the script so it will all be freed properly.  */
00998           end->link = next;
00999
01000           if (deletes || inserts)
01001         changes = 1;
01002         }
01003     }
01004       else
01005     changes = (script != 0);
01006
01007       if (no_details_flag)
01008     briefly_report (changes, filevec);
01009       else
01010     {
01011       if (changes || ! no_diff_means_no_output)
01012         {
01013           /* Record info for starting up output,
01014          to be used if and when we have some output to print.  */
01015           setup_output (files[0].name, files[1].name, depth);
01016
01017           switch (output_style)
01018         {
01019         case OUTPUT_CONTEXT:
01020           print_context_script (script, 0);
01021           break;
01022
01023         case OUTPUT_UNIFIED:
01024           print_context_script (script, 1);
01025           break;
01026
01027         case OUTPUT_ED:
01028           print_ed_script (script);
01029           break;
01030
01031         case OUTPUT_FORWARD_ED:
01032           pr_forward_ed_script (script);
01033           break;
01034
01035         case OUTPUT_RCS:
01036           print_rcs_script (script);
01037           break;
01038
01039         case OUTPUT_NORMAL:
01040           print_normal_script (script);
01041           break;
01042
01043         case OUTPUT_IFDEF:
01044           print_ifdef_script (script);
01045           break;
01046
01047         case OUTPUT_SDIFF:
01048           print_sdiff_script (script);
01049         }
01050
01051           finish_output ();
01052         }
01053     }
01054
01055       free (filevec[0].undiscarded);
01056
01057       free (filevec[0].changed_flag - 1);
01058
01059       for (i = 1; i >= 0; --i)
01060     free (filevec[i].equivs);
01061
01062       for (i = 0; i < 2; ++i)
01063     free (filevec[i].linbuf + filevec[i].linbuf_base);
01064
01065       for (e = script; e; e = p)
01066     {
01067       p = e->link;
01068       free (e);
01069     }
01070
01071       if (! ROBUST_OUTPUT_STYLE (output_style))
01072     for (i = 0; i < 2; ++i)
01073       if (filevec[i].missing_newline)
01074         {
01075           diff_error ("No newline at end of file %s", filevec[i].name, "");
01076           changes = 2;
01077         }
01078     }
01079
01080   if (filevec[0].buffer != filevec[1].buffer)
01081     free (filevec[0].buffer);
01082   free (filevec[1].buffer);
01083
01084   return changes;
01085 }
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/cmpbuf.c Source File

cvs-1.10/diff/cmpbuf.c

Go to the documentation of this file.
00001 /* Buffer primitives for comparison operations.
00002    Copyright (C) 1993 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013
00014    */
00015
00016 #include "system.h"
00017 #include "cmpbuf.h"
00018
00019 /* Least common multiple of two buffer sizes A and B.  */
00020
00021 size_t
00022 buffer_lcm (a, b)
00023      size_t a, b;
00024 {
00025   size_t m, n, r;
00026
00027   /* Yield reasonable values if buffer sizes are zero.  */
00028   if (!a)
00029     return b ? b : 8 * 1024;
00030   if (!b)
00031     return a;
00032
00033   /* n = gcd (a, b) */
00034   for (m = a, n = b;  (r = m % n) != 0;  m = n, n = r)
00035     continue;
00036
00037   return a/n * b;
00038 }
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/cmpbuf.h Source File

cvs-1.10/diff/cmpbuf.h

Go to the documentation of this file.
00001 /* Buffer primitives for comparison operations.
00002    Copyright (C) 1993 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018 size_t buffer_lcm PARAMS((size_t, size_t));
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/context.c Source File

cvs-1.10/diff/context.c

Go to the documentation of this file.
00001 /* Context-format output routines for GNU DIFF.
00002    Copyright (C) 1988,1989,1991,1992,1993,1994,1998 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018 #include "diff.h"
00019
00020 static struct change *find_hunk PARAMS((struct change *));
00021 static void find_function PARAMS((struct file_data const *, int, char const **, size_t *));
00022 static void mark_ignorable PARAMS((struct change *));
00023 static void pr_context_hunk PARAMS((struct change *));
00024 static void pr_unidiff_hunk PARAMS((struct change *));
00025 static void print_context_label PARAMS ((char const *, struct file_data *, char const *));
00026 static void print_context_number_range PARAMS((struct file_data const *, int, int));
00027 static void print_unidiff_number_range PARAMS((struct file_data const *, int, int));
00028
00029 /* Last place find_function started searching from.  */
00030 static int find_function_last_search;
00031
00032 /* The value find_function returned when it started searching there.  */
00033 static int find_function_last_match;
00034
00035 /* Print a label for a context diff, with a file name and date or a label.  */
00036
00037 static void
00038 print_context_label (mark, inf, label)
00039      char const *mark;
00040      struct file_data *inf;
00041      char const *label;
00042 {
00043   if (label)
00044     printf_output ("%s %s\n", mark, label);
00045   else
00046     {
00047       char const *ct = ctime (&inf->stat.st_mtime);
00048       if (!ct)
00049     ct = "?\n";
00050       /* See Posix.2 section 4.17.6.1.4 for this format.  */
00051       printf_output ("%s %s\t%s", mark, inf->name, ct);
00052     }
00053 }
00054
00055 /* Print a header for a context diff, with the file names and dates.  */
00056
00057 void
00058 print_context_header (inf, unidiff_flag)
00059      struct file_data inf[];
00060      int unidiff_flag;
00061 {
00062   if (unidiff_flag)
00063     {
00064       print_context_label ("---", &inf[0], file_label[0]);
00065       print_context_label ("+++", &inf[1], file_label[1]);
00066     }
00067   else
00068     {
00069       print_context_label ("***", &inf[0], file_label[0]);
00070       print_context_label ("---", &inf[1], file_label[1]);
00071     }
00072 }
00073
00074 /* Print an edit script in context format.  */
00075
00076 void
00077 print_context_script (script, unidiff_flag)
00078      struct change *script;
00079      int unidiff_flag;
00080 {
00081   if (ignore_blank_lines_flag || ignore_regexp_list)
00082     mark_ignorable (script);
00083   else
00084     {
00085       struct change *e;
00086       for (e = script; e; e = e->link)
00087     e->ignore = 0;
00088     }
00089
00090   find_function_last_search = - files[0].prefix_lines;
00091   find_function_last_match = find_function_last_search - 1;
00092
00093   if (unidiff_flag)
00094     print_script (script, find_hunk, pr_unidiff_hunk);
00095   else
00096     print_script (script, find_hunk, pr_context_hunk);
00097 }
00098
00099 /* Print a pair of line numbers with a comma, translated for file FILE.
00100    If the second number is not greater, use the first in place of it.
00101
00102    Args A and B are internal line numbers.
00103    We print the translated (real) line numbers.  */
00104
00105 static void
00106 print_context_number_range (file, a, b)
00107      struct file_data const *file;
00108      int a, b;
00109 {
00110   int trans_a, trans_b;
00111   translate_range (file, a, b, &trans_a, &trans_b);
00112
00113   /* Note: we can have B < A in the case of a range of no lines.
00114      In this case, we should print the line number before the range,
00115      which is B.  */
00116   if (trans_b > trans_a)
00117     printf_output ("%d,%d", trans_a, trans_b);
00118   else
00119     printf_output ("%d", trans_b);
00120 }
00121
00122 /* Print a portion of an edit script in context format.
00123    HUNK is the beginning of the portion to be printed.
00124    The end is marked by a `link' that has been nulled out.
00125
00126    Prints out lines from both files, and precedes each
00127    line with the appropriate flag-character.  */
00128
00129 static void
00130 pr_context_hunk (hunk)
00131      struct change *hunk;
00132 {
00133   int first0, last0, first1, last1, show_from, show_to, i;
00134   struct change *next;
00135   char const *prefix;
00136   char const *function;
00137   size_t function_length;
00138
00139   /* Determine range of line numbers involved in each file.  */
00140
00141   analyze_hunk (hunk, &first0, &last0, &first1, &last1, &show_from, &show_to);
00142
00143   if (!show_from && !show_to)
00144     return;
00145
00146   /* Include a context's width before and after.  */
00147
00148   i = - files[0].prefix_lines;
00149   first0 = max (first0 - context, i);
00150   first1 = max (first1 - context, i);
00151   last0 = min (last0 + context, files[0].valid_lines - 1);
00152   last1 = min (last1 + context, files[1].valid_lines - 1);
00153
00154   /* If desired, find the preceding function definition line in file 0.  */
00155   function = 0;
00156   if (function_regexp_list)
00157     find_function (&files[0], first0, &function, &function_length);
00158
00159   begin_output ();
00160
00161   /* If we looked for and found a function this is part of,
00162      include its name in the header of the diff section.  */
00163   printf_output ("***************");
00164
00165   if (function)
00166     {
00167       printf_output (" ");
00168       write_output (function, min (function_length - 1, 40));
00169     }
00170
00171   printf_output ("\n*** ");
00172   print_context_number_range (&files[0], first0, last0);
00173   printf_output (" ****\n");
00174
00175   if (show_from)
00176     {
00177       next = hunk;
00178
00179       for (i = first0; i <= last0; i++)
00180     {
00181       /* Skip past changes that apply (in file 0)
00182          only to lines before line I.  */
00183
00184       while (next && next->line0 + next->deleted <= i)
00185         next = next->link;
00186
00187       /* Compute the marking for line I.  */
00188
00189       prefix = " ";
00190       if (next && next->line0 <= i)
00191         /* The change NEXT covers this line.
00192            If lines were inserted here in file 1, this is "changed".
00193            Otherwise it is "deleted".  */
00194         prefix = (next->inserted > 0 ? "!" : "-");
00195
00196       print_1_line (prefix, &files[0].linbuf[i]);
00197     }
00198     }
00199
00200   printf_output ("--- ");
00201   print_context_number_range (&files[1], first1, last1);
00202   printf_output (" ----\n");
00203
00204   if (show_to)
00205     {
00206       next = hunk;
00207
00208       for (i = first1; i <= last1; i++)
00209     {
00210       /* Skip past changes that apply (in file 1)
00211          only to lines before line I.  */
00212
00213       while (next && next->line1 + next->inserted <= i)
00214         next = next->link;
00215
00216       /* Compute the marking for line I.  */
00217
00218       prefix = " ";
00219       if (next && next->line1 <= i)
00220         /* The change NEXT covers this line.
00221            If lines were deleted here in file 0, this is "changed".
00222            Otherwise it is "inserted".  */
00223         prefix = (next->deleted > 0 ? "!" : "+");
00224
00225       print_1_line (prefix, &files[1].linbuf[i]);
00226     }
00227     }
00228 }
00229
00230 /* Print a pair of line numbers with a comma, translated for file FILE.
00231    If the second number is smaller, use the first in place of it.
00232    If the numbers are equal, print just one number.
00233
00234    Args A and B are internal line numbers.
00235    We print the translated (real) line numbers.  */
00236
00237 static void
00238 print_unidiff_number_range (file, a, b)
00239      struct file_data const *file;
00240      int a, b;
00241 {
00242   int trans_a, trans_b;
00243   translate_range (file, a, b, &trans_a, &trans_b);
00244
00245   /* Note: we can have B < A in the case of a range of no lines.
00246      In this case, we should print the line number before the range,
00247      which is B.  */
00248   if (trans_b <= trans_a)
00249     printf_output (trans_b == trans_a ? "%d" : "%d,0", trans_b);
00250   else
00251     printf_output ("%d,%d", trans_a, trans_b - trans_a + 1);
00252 }
00253
00254 /* Print a portion of an edit script in unidiff format.
00255    HUNK is the beginning of the portion to be printed.
00256    The end is marked by a `link' that has been nulled out.
00257
00258    Prints out lines from both files, and precedes each
00259    line with the appropriate flag-character.  */
00260
00261 static void
00262 pr_unidiff_hunk (hunk)
00263      struct change *hunk;
00264 {
00265   int first0, last0, first1, last1, show_from, show_to, i, j, k;
00266   struct change *next;
00267   char const *function;
00268   size_t function_length;
00269
00270   /* Determine range of line numbers involved in each file.  */
00271
00272   analyze_hunk (hunk, &first0, &last0, &first1, &last1, &show_from, &show_to);
00273
00274   if (!show_from && !show_to)
00275     return;
00276
00277   /* Include a context's width before and after.  */
00278
00279   i = - files[0].prefix_lines;
00280   first0 = max (first0 - context, i);
00281   first1 = max (first1 - context, i);
00282   last0 = min (last0 + context, files[0].valid_lines - 1);
00283   last1 = min (last1 + context, files[1].valid_lines - 1);
00284
00285   /* If desired, find the preceding function definition line in file 0.  */
00286   function = 0;
00287   if (function_regexp_list)
00288     find_function (&files[0], first0, &function, &function_length);
00289
00290   begin_output ();
00291
00292   printf_output ("@@ -");
00293   print_unidiff_number_range (&files[0], first0, last0);
00294   printf_output (" +");
00295   print_unidiff_number_range (&files[1], first1, last1);
00296   printf_output (" @@");
00297
00298   /* If we looked for and found a function this is part of,
00299      include its name in the header of the diff section.  */
00300
00301   if (function)
00302     {
00303       write_output (" ", 1);
00304       write_output (function, min (function_length - 1, 40));
00305     }
00306   write_output ("\n", 1);
00307
00308   next = hunk;
00309   i = first0;
00310   j = first1;
00311
00312   while (i <= last0 || j <= last1)
00313     {
00314
00315       /* If the line isn't a difference, output the context from file 0. */
00316
00317       if (!next || i < next->line0)
00318     {
00319       write_output (tab_align_flag ? "\t" : " ", 1);
00320       print_1_line (0, &files[0].linbuf[i++]);
00321       j++;
00322     }
00323       else
00324     {
00325       /* For each difference, first output the deleted part. */
00326
00327       k = next->deleted;
00328       while (k--)
00329         {
00330           write_output ("-", 1);
00331           if (tab_align_flag)
00332         write_output ("\t", 1);
00333           print_1_line (0, &files[0].linbuf[i++]);
00334         }
00335
00336       /* Then output the inserted part. */
00337
00338       k = next->inserted;
00339       while (k--)
00340         {
00341           write_output ("+", 1);
00342           if (tab_align_flag)
00343         write_output ("\t", 1);
00344           print_1_line (0, &files[1].linbuf[j++]);
00345         }
00346
00347       /* We're done with this hunk, so on to the next! */
00348
00349       next = next->link;
00350     }
00351     }
00352 }
00353
00354 /* Scan a (forward-ordered) edit script for the first place that more than
00355    2*CONTEXT unchanged lines appear, and return a pointer
00356    to the `struct change' for the last change before those lines.  */
00357
00358 static struct change *
00359 find_hunk (start)
00360      struct change *start;
00361 {
00362   struct change *prev;
00363   int top0, top1;
00364   int thresh;
00365
00366   do
00367     {
00368       /* Compute number of first line in each file beyond this changed.  */
00369       top0 = start->line0 + start->deleted;
00370       top1 = start->line1 + start->inserted;
00371       prev = start;
00372       start = start->link;
00373       /* Threshold distance is 2*CONTEXT between two non-ignorable changes,
00374      but only CONTEXT if one is ignorable.  */
00375       thresh = ((prev->ignore || (start && start->ignore))
00376         ? context
00377         : 2 * context + 1);
00378       /* It is not supposed to matter which file we check in the end-test.
00379      If it would matter, crash.  */
00380       if (start && start->line0 - top0 != start->line1 - top1)
00381     abort ();
00382     } while (start
00383          /* Keep going if less than THRESH lines
00384         elapse before the affected line.  */
00385          && start->line0 < top0 + thresh);
00386
00387   return prev;
00388 }
00389
00390 /* Set the `ignore' flag properly in each change in SCRIPT.
00391    It should be 1 if all the lines inserted or deleted in that change
00392    are ignorable lines.  */
00393
00394 static void
00395 mark_ignorable (script)
00396      struct change *script;
00397 {
00398   while (script)
00399     {
00400       struct change *next = script->link;
00401       int first0, last0, first1, last1, deletes, inserts;
00402
00403       /* Turn this change into a hunk: detach it from the others.  */
00404       script->link = 0;
00405
00406       /* Determine whether this change is ignorable.  */
00407       analyze_hunk (script, &first0, &last0, &first1, &last1, &deletes, &inserts);
00408       /* Reconnect the chain as before.  */
00409       script->link = next;
00410
00411       /* If the change is ignorable, mark it.  */
00412       script->ignore = (!deletes && !inserts);
00413
00414       /* Advance to the following change.  */
00415       script = next;
00416     }
00417 }
00418
00419 /* Find the last function-header line in FILE prior to line number LINENUM.
00420    This is a line containing a match for the regexp in `function_regexp'.
00421    Store the address of the line text into LINEP and the length of the
00422    line into LENP.
00423    Do not store anything if no function-header is found.  */
00424
00425 static void
00426 find_function (file, linenum, linep, lenp)
00427      struct file_data const *file;
00428      int linenum;
00429      char const **linep;
00430      size_t *lenp;
00431 {
00432   int i = linenum;
00433   int last = find_function_last_search;
00434   find_function_last_search = i;
00435
00436   while (--i >= last)
00437     {
00438       /* See if this line is what we want.  */
00439       struct regexp_list *r;
00440       char const *line = file->linbuf[i];
00441       size_t len = file->linbuf[i + 1] - line;
00442
00443       for (r = function_regexp_list; r; r = r->next)
00444     if (0 <= re_search (&r->buf, line, len, 0, len, 0))
00445       {
00446         *linep = line;
00447         *lenp = len;
00448         find_function_last_match = i;
00449         return;
00450       }
00451     }
00452   /* If we search back to where we started searching the previous time,
00453      find the line we found last time.  */
00454   if (find_function_last_match >= - file->prefix_lines)
00455     {
00456       i = find_function_last_match;
00457       *linep = file->linbuf[i];
00458       *lenp = file->linbuf[i + 1] - *linep;
00459       return;
00460     }
00461   return;
00462 }
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GetPassword.cpp File Reference

common/GetPassword.cpp File Reference

#include "stdafx.h"
#include "GetPassword.h"
#include "CPStr.h"

Include dependency graph for GetPassword.cpp:

Include dependency graph

Go to the source code of this file.

Functions

char * CompatGetPassword (const char *prompt)

Function Documentation

char* CompatGetPassword ( const char * prompt )

Definition at line 162 of file GetPassword.cpp.

00163 {
00164 #ifdef WIN32
00165     static char passwd[255];
00166     GetPassword gp;
00167     if(gp.DoModal() == IDOK)
00168     {
00169         strcpy(passwd, gp.m_passwd);
00170         return passwd;
00171     }
00172     return "";
00173 #endif /* WIN32 */
00174 #ifdef qMacCvsPP
00175     if(!CMacCvsApp::app->IsFrontProcess() && CMacCvsApp::app->NotifyUser(0L))
00176     {
00177         while(!CMacCvsApp::app->IsFrontProcess())
00178         {
00179             CMacCvsApp::app->SpendSomeTime();
00180         }
00181     }
00182
00183     static UStr thepasswd;
00184     KCItemRef theItem               = NULL;
00185
00186     LStr255 pstr;
00187     UStr realPrompt;
00188 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00189     LStr255 phost, puser;
00190     bool doUseKeyChain = false;
00191     OSStatus theStatus;
00192     UStr loopKey;
00193 #endif
00194
00195     if(GetEnvValue(prompt, "prompt", realPrompt))
00196     {
00197         pstr = realPrompt;
00198
00199 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00200         // copied from MacCvsPro::CMacCVSDoc.cpp
00201         UStr host, user, authen;
00202         if(CMacCvsApp::CanUseKeychain() &&
00203             GetEnvValue(prompt, "host", host) &&
00204             GetEnvValue(prompt, "user", user))
00205         {
00206             doUseKeyChain = true;
00207
00208             OSStatus theStatus;
00209             UInt32 theLength;
00210
00211             phost = host;
00212             puser = user;
00213
00214             UStr authen;
00215             if(GetEnvValue(prompt, "authen", authen))
00216             {
00217                 phost += ":";
00218                 phost += authen;
00219             }
00220
00221             UStr dir;
00222             if(GetEnvValue(prompt, "dir", dir))
00223             {
00224                 phost += ":";
00225                 phost += dir;
00226             }
00227
00228             static char ppass[255];
00229
00230             theStatus = KCFindGenericPassword(phost, puser, sizeof(ppass) - 1,
00231                 ppass, &theLength, &theItem);
00232
00233             user = puser;
00234             host = phost;
00235             loopKey = user;
00236             loopKey << '@';
00237             loopKey << host;
00238             // we could have an endless loop is the password is not valid
00239             if (theStatus == noErr && CMacCvsApp::app->CheckLoopingPassword(loopKey))
00240             {
00241                 if (theItem != NULL)
00242                     KCReleaseItem(&theItem);
00243
00244                 ppass[theLength] = '\0';
00245
00246                 return ppass;
00247             }
00248         }
00249 #endif
00250     }
00251     else
00252         pstr = prompt;
00253
00254     StDialogHandler theHandler(dlg_Passwd, LCommander::GetTopCommander());
00255     LWindow *theDialog = theHandler.GetDialog();
00256     ThrowIfNil_(theDialog);
00257
00258     LEditText *passwd = dynamic_cast<LEditText*>
00259         (theDialog->FindPaneByID(item_GetPasswd));
00260     LStaticText *promptbox = dynamic_cast<LStaticText*>
00261         (theDialog->FindPaneByID('PROM'));
00262     theDialog->SetLatentSub(passwd);
00263
00264     promptbox->SetText(pstr);
00265
00266     theDialog->Show();
00267     MessageT hitMessage;
00268     while (true)
00269     {       // Let DialogHandler process events
00270         hitMessage = theHandler.DoDialog();
00271
00272         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00273             break;
00274     }
00275     theDialog->Hide();
00276
00277     if(hitMessage == msg_OK)
00278     {
00279         passwd->GetText(pstr);
00280
00281 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00282         if (doUseKeyChain && CMacCvsApp::CanUseKeychain())
00283         {
00284             if (theItem != NULL)
00285             {
00286                 theStatus = KCSetData(theItem, pstr[0], &pstr[1]);
00287
00288                 if (theStatus == noErr)
00289                     theStatus = KCUpdateItem(theItem);
00290             }
00291             else
00292             {
00293                 theStatus = KCAddGenericPassword(phost, puser,
00294                     pstr[0], &pstr[1], &theItem);
00295
00296                 KCAttribute theAttribute;
00297
00298                 if (theStatus == noErr)
00299                 {
00300                     UStr theDescriptionText("MacCVS password");
00301                     theAttribute.tag = kDescriptionKCItemAttr;
00302                     theAttribute.length = theDescriptionText.length();
00303                     theAttribute.data = (void *)(const char *)theDescriptionText;
00304                     theStatus = KCSetAttribute(theItem, &theAttribute);
00305                 }
00306
00307                 OSType theTypeCreator;
00308
00309                 if (theStatus == noErr)
00310                 {
00311                     theTypeCreator = 'mCVS';
00312                     theAttribute.tag = kCreatorKCItemAttr;
00313                     theAttribute.length = sizeof(theTypeCreator);
00314                     theAttribute.data = &theTypeCreator;
00315                     theStatus = KCSetAttribute(theItem, &theAttribute);
00316                 }
00317
00318                 if (theStatus == noErr)
00319                 {
00320                     theTypeCreator = 'APPL';
00321                     theAttribute.tag = kTypeKCItemAttr;
00322                     theStatus = KCSetAttribute(theItem, &theAttribute);
00323                 }
00324
00325                 if (theStatus == noErr)
00326                 {
00327                     Boolean theCustomIcon = true;
00328                     theAttribute.tag = kCustomIconKCItemAttr;
00329                     theAttribute.length = sizeof(theCustomIcon);
00330                     theAttribute.data = &theCustomIcon;
00331                     theStatus = KCSetAttribute(theItem, &theAttribute);
00332                 }
00333
00334                 if (theStatus == noErr)
00335                     theStatus = KCUpdateItem(theItem);
00336             }
00337
00338             if (theItem != NULL)
00339                 KCReleaseItem(&theItem);
00340
00341             CMacCvsApp::app->PushValidPassword(loopKey);
00342         }
00343 #endif
00344
00345         thepasswd = pstr;
00346         return thepasswd.length() == 0 ? (char *)"" : (char *)thepasswd;
00347     }
00348
00349 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00350     if (theItem != NULL)
00351         KCReleaseItem(&theItem);
00352 #endif
00353
00354     return "";
00355 #endif /* qMacCvsPP */
00356 #if qUnix
00357     static char passwd[255];
00358     void *wid = UCreate_PasswdDlg();
00359
00360     UCvsGetPasswd *dlg = new UCvsGetPasswd();
00361     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00362
00363     if(dlg->DoModal())
00364     {
00365         strcpy(passwd, dlg->m_passwd);
00366     }
00367     else
00368         strcpy(passwd, "");
00369
00370     delete dlg;
00371     return passwd;
00372 #endif // qUnix
00373 }

Generated on Sun Oct 21 12:42:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GetPassword.h File Reference

common/GetPassword.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_GETPASSWORD_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_

Functions

char * | CompatGetPassword (const char *prompt)

Define Documentation

#define AFX_GETPASSWORD_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_

Definition at line 22 of file GetPassword.h.

Function Documentation

char* CompatGetPassword ( const char * prompt )

Definition at line 162 of file GetPassword.cpp.

Referenced by glue_getenv().

00163 {
00164 #ifdef WIN32
00165     static char passwd[255];
00166     GetPassword gp;
00167     if(gp.DoModal() == IDOK)
00168     {
00169         strcpy(passwd, gp.m_passwd);
00170         return passwd;
00171     }
00172     return "";
00173 #endif /* WIN32 */
00174 #ifdef qMacCvsPP
00175     if(!CMacCvsApp::app->IsFrontProcess() && CMacCvsApp::app->NotifyUser(0L))
00176     {
00177         while(!CMacCvsApp::app->IsFrontProcess())
00178         {
00179             CMacCvsApp::app->SpendSomeTime();
00180         }
00181     }
00182
00183     static UStr thepasswd;
00184     KCItemRef theItem               = NULL;
00185
00186     LStr255 pstr;
00187     UStr realPrompt;
00188 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00189     LStr255 phost, puser;
00190     bool doUseKeyChain = false;
00191     OSStatus theStatus;
00192     UStr loopKey;
00193 #endif
00194
00195     if(GetEnvValue(prompt, "prompt", realPrompt))
00196     {
00197         pstr = realPrompt;
00198
00199 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00200         // copied from MacCvsPro::CMacCVSDoc.cpp
00201         UStr host, user, authen;
00202         if(CMacCvsApp::CanUseKeychain() &&
00203             GetEnvValue(prompt, "host", host) &&
00204             GetEnvValue(prompt, "user", user))
00205         {
00206             doUseKeyChain = true;
00207
00208             OSStatus theStatus;
00209             UInt32 theLength;
00210
00211             phost = host;
00212             puser = user;
00213
00214             UStr authen;
00215             if(GetEnvValue(prompt, "authen", authen))
00216             {
00217                 phost += ":";
00218                 phost += authen;
00219             }
00220
00221             UStr dir;
00222             if(GetEnvValue(prompt, "dir", dir))
00223             {
00224                 phost += ":";
00225                 phost += dir;
00226             }
00227
00228             static char ppass[255];
00229
00230             theStatus = KCFindGenericPassword(phost, puser, sizeof(ppass) - 1,
00231                 ppass, &theLength, &theItem);
00232
00233             user = puser;
00234             host = phost;
00235             loopKey = user;
00236             loopKey << '@';
00237             loopKey << host;
00238             // we could have an endless loop is the password is not valid
00239             if (theStatus == noErr && CMacCvsApp::app->CheckLoopingPassword(loopKey))
00240             {
00241                 if (theItem != NULL)
00242                     KCReleaseItem(&theItem);
00243
00244                 ppass[theLength] = '\0';
00245
00246                 return ppass;
00247             }
00248         }
00249 #endif
00250     }
00251     else
00252         pstr = prompt;
00253
00254     StDialogHandler theHandler(dlg_Passwd, LCommander::GetTopCommander());
00255     LWindow *theDialog = theHandler.GetDialog();
00256     ThrowIfNil_(theDialog);
00257
00258     LEditText *passwd = dynamic_cast<LEditText*>
00259         (theDialog->FindPaneByID(item_GetPasswd));
00260     LStaticText *promptbox = dynamic_cast<LStaticText*>
00261         (theDialog->FindPaneByID('PROM'));
00262     theDialog->SetLatentSub(passwd);
00263
00264     promptbox->SetText(pstr);
00265
00266     theDialog->Show();
00267     MessageT hitMessage;
00268     while (true)
00269     {       // Let DialogHandler process events
00270         hitMessage = theHandler.DoDialog();
00271
00272         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00273             break;
00274     }
00275     theDialog->Hide();
00276
00277     if(hitMessage == msg_OK)
00278     {
00279         passwd->GetText(pstr);
00280
00281 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00282         if (doUseKeyChain && CMacCvsApp::CanUseKeychain())
00283         {
00284             if (theItem != NULL)
00285             {
00286                 theStatus = KCSetData(theItem, pstr[0], &pstr[1]);
00287
00288                 if (theStatus == noErr)
00289                     theStatus = KCUpdateItem(theItem);
00290             }
00291             else
00292             {
00293                 theStatus = KCAddGenericPassword(phost, puser,
00294                     pstr[0], &pstr[1], &theItem);
00295
00296                 KCAttribute theAttribute;
00297
00298                 if (theStatus == noErr)
00299                 {
00300                     UStr theDescriptionText("MacCVS password");
00301                     theAttribute.tag = kDescriptionKCItemAttr;
00302                     theAttribute.length = theDescriptionText.length();
00303                     theAttribute.data = (void *)(const char *)theDescriptionText;
00304                     theStatus = KCSetAttribute(theItem, &theAttribute);
00305                 }
00306
00307                 OSType theTypeCreator;
00308
00309                 if (theStatus == noErr)
00310                 {
00311                     theTypeCreator = 'mCVS';
00312                     theAttribute.tag = kCreatorKCItemAttr;
00313                     theAttribute.length = sizeof(theTypeCreator);
00314                     theAttribute.data = &theTypeCreator;
00315                     theStatus = KCSetAttribute(theItem, &theAttribute);
00316                 }
00317
00318                 if (theStatus == noErr)
00319                 {
00320                     theTypeCreator = 'APPL';
00321                     theAttribute.tag = kTypeKCItemAttr;
00322                     theStatus = KCSetAttribute(theItem, &theAttribute);
00323                 }
00324
00325                 if (theStatus == noErr)
00326                 {
00327                     Boolean theCustomIcon = true;
00328                     theAttribute.tag = kCustomIconKCItemAttr;
00329                     theAttribute.length = sizeof(theCustomIcon);
00330                     theAttribute.data = &theCustomIcon;
00331                     theStatus = KCSetAttribute(theItem, &theAttribute);
00332                 }
00333
00334                 if (theStatus == noErr)
00335                     theStatus = KCUpdateItem(theItem);
00336             }
00337
00338             if (theItem != NULL)
00339                 KCReleaseItem(&theItem);
00340
00341             CMacCvsApp::app->PushValidPassword(loopKey);
00342         }
00343 #endif
00344
00345         thepasswd = pstr;
00346         return thepasswd.length() == 0 ? (char *)"" : (char *)thepasswd;
00347     }
00348
00349 #if !qCarbon || UNIVERSAL_INTERFACES_VERSION >= 0x0334
00350     if (theItem != NULL)
00351         KCReleaseItem(&theItem);
00352 #endif
00353
00354     return "";
00355 #endif /* qMacCvsPP */
00356 #if qUnix
00357     static char passwd[255];
00358     void *wid = UCreate_PasswdDlg();
00359
00360     UCvsGetPasswd *dlg = new UCvsGetPasswd();
00361     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00362
00363     if(dlg->DoModal())
00364     {
00365         strcpy(passwd, dlg->m_passwd);
00366     }
00367     else
00368         strcpy(passwd, "");
00369
00370     delete dlg;
00371     return passwd;
00372 #endif // qUnix
00373 }

Generated on Sun Oct 21 12:42:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GetPrefs.cpp File Reference

common/GetPrefs.cpp File Reference

#include "stdafx.h"
#include "GetPrefs.h"
#include "CvsPrefs.h"
#include "Authen.h"
#include "AppConsole.h"
#include "PromptFiles.h"
#include "MultiFiles.h"
#include "CvsArgs.h"
#include "FileTraversal.h"
#include "MakeSurePathExists.h"

Include dependency graph for GetPrefs.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void CompatGetPrefs (void)

Function Documentation

void CompatGetPrefs ( void )

Definition at line 1354 of file GetPrefs.cpp.

Referenced by CWincvsDoc::OnAppPreferences(), UCvsFrame::OnCmdPreferences(), and UCvsApp::SayWelcome().

01355 {
01356     bool userHitOK = false;
01357
01358 #ifdef WIN32
01359     CPropertySheet pages("WinCvs Preferences");
01360     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
01361     CGetPrefs_CVSROOT page1;
01362     CGetPrefs_GLOBALS page2;
01363     CGetPrefs_WINCVS page4;
01364     CGetPrefs_CVSCMD_DIALOGS page5;
01365     pages.AddPage(&page1);
01366     pages.AddPage(&page2);
01367     pages.AddPage(&page4);
01368     pages.AddPage(&page5);
01369     if(pages.DoModal() == IDOK)
01370     {
01371         page1.StoreValues();
01372         page2.StoreValues();
01373         page4.StoreValues();
01374         page5.StoreValues();
01375         userHitOK = true;
01376     }
01377 #endif /* WIN32 */
01378 #ifdef qMacCvsPP
01379     MacBinMaps maps;
01380     maps.LoadDefaults();
01381     CMacBinTable::SetCurrentMap(&maps);
01382
01383     StDialogHandler theHandler(dlg_Prefs, LCommander::GetTopCommander());
01384     LWindow *theDialog = theHandler.GetDialog();
01385     ThrowIfNil_(theDialog);
01386     static UInt16 sRuntimePanel = 1;
01387
01388     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01389         (theDialog->FindPaneByID(item_MultiViewPrefs));
01390     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01391
01392     UCvsPrefs_CVSROOT *handler = new UCvsPrefs_CVSROOT;
01393     ThrowIfNil_(handler);
01394
01395     UEventSendMessage(handler->GetWidID(), EV_INIT_WIDGET, 0, theDialog);
01396
01397     multiView->SwitchToPanel(5);
01398     DoDataExchange_Fonts(theDialog, true);
01399     multiView->SwitchToPanel(4);
01400     DoDataExchange_BinFiles(theDialog, maps, true);
01401     multiView->SwitchToPanel(3);
01402     DoDataExchange_TextFiles(theDialog, true);
01403     multiView->SwitchToPanel(2);
01404     DoDataExchange_Globals(theDialog, true);
01405     multiView->SwitchToPanel(1);
01406     DoDataExchange_Cvsroot(handler, true);
01407
01408     groupView->SetValue(sRuntimePanel);
01409     theDialog->Show();
01410     MessageT hitMessage;
01411     while (true)
01412     {       // Let DialogHandler process events
01413         hitMessage = theHandler.DoDialog();
01414
01415         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01416             break;
01417     }
01418     theDialog->Hide();
01419     sRuntimePanel = groupView->GetValue();
01420
01421     if(hitMessage == msg_OK)
01422     {
01423         userHitOK = true;
01424
01425         multiView->SwitchToPanel(1);
01426         DoDataExchange_Cvsroot(handler, false);
01427         multiView->SwitchToPanel(2);
01428         DoDataExchange_Globals(theDialog, false);
01429         multiView->SwitchToPanel(3);
01430         DoDataExchange_TextFiles(theDialog, false);
01431         multiView->SwitchToPanel(4);
01432         DoDataExchange_BinFiles(theDialog, maps, false);
01433         multiView->SwitchToPanel(5);
01434         DoDataExchange_Fonts(theDialog, false);
01435
01436         maps.SaveDefaults();
01437     }
01438 #endif /* qMacCvsPP */
01439 #if qUnix
01440     void *wid = UCreate_gcvs_Settings();
01441
01442     UCvsPrefs_MAIN *dlg = new UCvsPrefs_MAIN();
01443     UCvsPrefs_CVSROOT *tab1 = new UCvsPrefs_CVSROOT();
01444     UCvsPrefs_GLOBALS *tab2 = new UCvsPrefs_GLOBALS();
01445     UCvsPrefs_PORTS *tab3 = new UCvsPrefs_PORTS();
01446     UCvsPrefs_PROXY *tab4 = new UCvsPrefs_PROXY();
01447     UCvsPrefs_GCVS *tab5 = new UCvsPrefs_GCVS();
01448     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01449     dlg->AddPage(tab1, UCvsPrefs_MAIN::kTabGeneral, 0);
01450     dlg->AddPage(tab2, UCvsPrefs_MAIN::kTabGeneral, 1);
01451     dlg->AddPage(tab3, UCvsPrefs_MAIN::kTabGeneral, 2);
01452     dlg->AddPage(tab4, UCvsPrefs_MAIN::kTabGeneral, 3);
01453     dlg->AddPage(tab5, UCvsPrefs_MAIN::kTabGeneral, 4);
01454
01455     if(dlg->DoModal())
01456     {
01457         tab1->StoreValues();
01458         tab2->StoreValues();
01459         tab3->StoreValues();
01460         tab4->StoreValues();
01461         tab5->StoreValues();
01462
01463         userHitOK = true;
01464     }
01465     delete dlg;
01466 #endif // qUnix
01467
01468     if(userHitOK && !gCvsPrefs.empty())
01469     {
01470         cvs_out("NEW CVSROOT: %s (%s)\n", (const char *)gCvsPrefs, gAuthen.kindstr());
01471         gCvsPrefs.save();
01472     }
01473 }

Generated on Sun Oct 21 12:42:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GetPrefs.h File Reference

common/GetPrefs.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_GETPREFS_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Functions

void | CompatGetPrefs (void)

Define Documentation

#define AFX_GETPREFS_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 22 of file GetPrefs.h.

Function Documentation

void CompatGetPrefs ( void )

Definition at line 1354 of file GetPrefs.cpp.

01355 {
01356     bool userHitOK = false;
01357
01358 #ifdef WIN32
01359     CPropertySheet pages("WinCvs Preferences");
01360     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
01361     CGetPrefs_CVSROOT page1;
01362     CGetPrefs_GLOBALS page2;
01363     CGetPrefs_WINCVS page4;
01364     CGetPrefs_CVSCMD_DIALOGS page5;
01365     pages.AddPage(&page1);
01366     pages.AddPage(&page2);
01367     pages.AddPage(&page4);
01368     pages.AddPage(&page5);
01369     if(pages.DoModal() == IDOK)
01370     {
01371         page1.StoreValues();
01372         page2.StoreValues();
01373         page4.StoreValues();
01374         page5.StoreValues();
01375         userHitOK = true;
01376     }
01377 #endif /* WIN32 */
01378 #ifdef qMacCvsPP
01379     MacBinMaps maps;
01380     maps.LoadDefaults();
01381     CMacBinTable::SetCurrentMap(&maps);
01382
01383     StDialogHandler theHandler(dlg_Prefs, LCommander::GetTopCommander());
01384     LWindow *theDialog = theHandler.GetDialog();
01385     ThrowIfNil_(theDialog);
01386     static UInt16 sRuntimePanel = 1;
01387
01388     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01389         (theDialog->FindPaneByID(item_MultiViewPrefs));
01390     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01391
01392     UCvsPrefs_CVSROOT *handler = new UCvsPrefs_CVSROOT;
01393     ThrowIfNil_(handler);
01394
01395     UEventSendMessage(handler->GetWidID(), EV_INIT_WIDGET, 0, theDialog);
01396
01397     multiView->SwitchToPanel(5);
01398     DoDataExchange_Fonts(theDialog, true);
01399     multiView->SwitchToPanel(4);
01400     DoDataExchange_BinFiles(theDialog, maps, true);
01401     multiView->SwitchToPanel(3);
01402     DoDataExchange_TextFiles(theDialog, true);
01403     multiView->SwitchToPanel(2);
01404     DoDataExchange_Globals(theDialog, true);
01405     multiView->SwitchToPanel(1);
01406     DoDataExchange_Cvsroot(handler, true);
01407
01408     groupView->SetValue(sRuntimePanel);
01409     theDialog->Show();
01410     MessageT hitMessage;
01411     while (true)
01412     {       // Let DialogHandler process events
01413         hitMessage = theHandler.DoDialog();
01414
01415         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01416             break;
01417     }
01418     theDialog->Hide();
01419     sRuntimePanel = groupView->GetValue();
01420
01421     if(hitMessage == msg_OK)
01422     {
01423         userHitOK = true;
01424
01425         multiView->SwitchToPanel(1);
01426         DoDataExchange_Cvsroot(handler, false);
01427         multiView->SwitchToPanel(2);
01428         DoDataExchange_Globals(theDialog, false);
01429         multiView->SwitchToPanel(3);
01430         DoDataExchange_TextFiles(theDialog, false);
01431         multiView->SwitchToPanel(4);
01432         DoDataExchange_BinFiles(theDialog, maps, false);
01433         multiView->SwitchToPanel(5);
01434         DoDataExchange_Fonts(theDialog, false);
01435
01436         maps.SaveDefaults();
01437     }
01438 #endif /* qMacCvsPP */
01439 #if qUnix
01440     void *wid = UCreate_gcvs_Settings();
01441
01442     UCvsPrefs_MAIN *dlg = new UCvsPrefs_MAIN();
01443     UCvsPrefs_CVSROOT *tab1 = new UCvsPrefs_CVSROOT();
01444     UCvsPrefs_GLOBALS *tab2 = new UCvsPrefs_GLOBALS();
01445     UCvsPrefs_PORTS *tab3 = new UCvsPrefs_PORTS();
01446     UCvsPrefs_PROXY *tab4 = new UCvsPrefs_PROXY();
01447     UCvsPrefs_GCVS *tab5 = new UCvsPrefs_GCVS();
01448     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01449     dlg->AddPage(tab1, UCvsPrefs_MAIN::kTabGeneral, 0);
01450     dlg->AddPage(tab2, UCvsPrefs_MAIN::kTabGeneral, 1);
01451     dlg->AddPage(tab3, UCvsPrefs_MAIN::kTabGeneral, 2);
01452     dlg->AddPage(tab4, UCvsPrefs_MAIN::kTabGeneral, 3);
01453     dlg->AddPage(tab5, UCvsPrefs_MAIN::kTabGeneral, 4);
01454
01455     if(dlg->DoModal())
01456     {
01457         tab1->StoreValues();
01458         tab2->StoreValues();
01459         tab3->StoreValues();
01460         tab4->StoreValues();
01461         tab5->StoreValues();
01462
01463         userHitOK = true;
01464     }
01465     delete dlg;
01466 #endif // qUnix
01467
01468     if(userHitOK && !gCvsPrefs.empty())
01469     {
01470         cvs_out("NEW CVSROOT: %s (%s)\n", (const char *)gCvsPrefs, gAuthen.kindstr());
01471         gCvsPrefs.save();
01472     }
01473 }

Generated on Sun Oct 21 12:42:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GetValue.cpp File Reference

common/GetValue.cpp File Reference

#include "stdafx.h"
#include "GetValue.h"

Include dependency graph for GetValue.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool CompatGetValue (char *value, const char *defvalue, const char *title)

Function Documentation

bool CompatGetValue | ( | char * | value,
 |  | const char * | defvalue = 0L,
 |  | const char * | title = 0L
 | ) |

Definition at line 92 of file GetValue.cpp.

00093 {
00094 #ifdef WIN32
00095     GetValue gv(defvalue, title);
00096     if(gv.DoModal() == IDOK)
00097     {
00098         strcpy(value, gv.m_value);
00099         return true;
00100     }
00101     return false;
00102 #endif /* WIN32 */
00103 #ifdef macintosh
00104     GrafPtr     OldPort;
00105     DialogPtr   alertDialog;
00106     short       WhichItem = 0;
00107     Str255 pdef = {'\0'}, ptitle = {'\0'}, pvalue;
00108
00109     if(defvalue != NULL)
00110     {
00111         strcpy((char *)pdef, defvalue);
00112         c2pstr((char *)pdef);
00113     }
00114     if(title != NULL)
00115     {
00116         strcpy((char *)ptitle, title);
00117         c2pstr((char *)ptitle);
00118     }
00119
00120     GetPort(&OldPort);
00121     alertDialog = GetNewDialog(kDlgIdGetValue, NULL, (WindowPtr)-1);
00122     SetPort(alertDialog);
00123
00124     SetDialogItemText(GetDItemHdl(alertDialog, 3), pdef);
00125     SetDialogItemText(GetDItemHdl(alertDialog, 4), ptitle);
00126
00127     while(WhichItem != 1 && WhichItem != 2)
00128     {
00129         ModalDialog(NULL, &WhichItem);
00130
00131         if(WhichItem == 1)
00132         {
00133             GetDialogItemText(GetDItemHdl(alertDialog, 3), pvalue);
00134             if(pvalue[0] == '\0')
00135                 WhichItem = 0;
00136         }
00137     }
00138
00139     if(WhichItem == 1)
00140     {
00141         GetDialogItemText(GetDItemHdl(alertDialog, 3), pvalue);
00142         p2cstr(pvalue);
00143         strcpy(value, (char *)pvalue);
00144     }
00145
00146     DisposeDialog(alertDialog);
00147     SetPort(OldPort);
00148
00149     return WhichItem == 1;
00150 #endif /* macintosh */
00151 #ifdef UNIX_CVS
00152     return false;
00153 #endif /* UNIX_CVS */
00154 }

Generated on Sun Oct 21 12:42:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GetValue.h File Reference

common/GetValue.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_GETVALUE_H__5946A8C3_8517_11D1_8949_444553540000__INCLUDED_
#define | MAX_VALUE_LEN 1024

Functions

bool | CompatGetValue (char *value, const char *defvalue=0L, const char *title=0L)

Define Documentation

#define AFX_GETVALUE_H__5946A8C3_8517_11D1_8949_444553540000__INCLUDED_

Definition at line 22 of file GetValue.h.

#define MAX_VALUE_LEN 1024

Definition at line 33 of file GetValue.h.

Function Documentation

bool CompatGetValue | ( | char * | value,
 |  | const char * | defvalue = 0L,
 |  | const char * | title = 0L
 | ) |

Definition at line 92 of file GetValue.cpp.

00093 {
00094 #ifdef WIN32
00095     GetValue gv(defvalue, title);
00096     if(gv.DoModal() == IDOK)
00097     {
00098         strcpy(value, gv.m_value);
00099         return true;
00100     }
00101     return false;
00102 #endif /* WIN32 */
00103 #ifdef macintosh
00104     GrafPtr     OldPort;
00105     DialogPtr   alertDialog;
00106     short       WhichItem = 0;
00107     Str255 pdef = {'\0'}, ptitle = {'\0'}, pvalue;
00108
00109     if(defvalue != NULL)
00110     {
00111         strcpy((char *)pdef, defvalue);
00112         c2pstr((char *)pdef);
00113     }
00114     if(title != NULL)
00115     {
00116         strcpy((char *)ptitle, title);
00117         c2pstr((char *)ptitle);
00118     }
00119
00120     GetPort(&OldPort);
00121     alertDialog = GetNewDialog(kDlgIdGetValue, NULL, (WindowPtr)-1);
00122     SetPort(alertDialog);
00123
00124     SetDialogItemText(GetDItemHdl(alertDialog, 3), pdef);
00125     SetDialogItemText(GetDItemHdl(alertDialog, 4), ptitle);
00126
00127     while(WhichItem != 1 && WhichItem != 2)
00128     {
00129         ModalDialog(NULL, &WhichItem);
00130
00131         if(WhichItem == 1)
00132         {
00133             GetDialogItemText(GetDItemHdl(alertDialog, 3), pvalue);
00134             if(pvalue[0] == '\0')
00135                 WhichItem = 0;
00136         }
00137     }
00138
00139     if(WhichItem == 1)
00140     {
00141         GetDialogItemText(GetDItemHdl(alertDialog, 3), pvalue);
00142         p2cstr(pvalue);
00143         strcpy(value, (char *)pvalue);
00144     }
00145
00146     DisposeDialog(alertDialog);
00147     SetPort(OldPort);
00148
00149     return WhichItem == 1;
00150 #endif /* macintosh */
00151 #ifdef UNIX_CVS
00152     return false;
00153 #endif /* UNIX_CVS */
00154 }

Generated on Sun Oct 21 12:42:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GraphOptDlg.cpp File Reference

common/GraphOptDlg.cpp File Reference

#include "stdafx.h"
#include "GraphOptDlg.h"
#include "CvsPrefs.h"

Include dependency graph for GraphOptDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool CompatGetGraphOptions (CPersistentInt &selColor, CPersistentInt &shadowColor, CPersistentInt &headerColor, CPersistentInt &tagColor, CPersistentInt &branchColor, CPersistentInt &nodeColor, CPersistentInt &deadNodeColor, CPersistentInt &userStateNodeColor)

Function Documentation

bool CompatGetGraphOptions | ( | CPersistentInt & | selColor,
 |  | CPersistentInt & | shadowColor,
 |  | CPersistentInt & | headerColor,
 |  | CPersistentInt & | tagColor,
 |  | CPersistentInt & | branchColor,
 |  | CPersistentInt & | nodeColor,
 |  | CPersistentInt & | deadNodeColor,
 |  | CPersistentInt & | userStateNodeColor
 | ) |

Definition at line 231 of file GraphOptDlg.cpp.

00234 {
00235     bool userHitOK = false;
00236
00237 #ifdef WIN32
00238     CGraphOptDlg graphOptDlg(selColor, shadowColor,
00239         headerColor, tagColor, branchColor,
00240         nodeColor, deadNodeColor, userStateNodeColor);
00241     if( graphOptDlg.DoModal() == IDOK )
00242     {
00243         userHitOK = true;
00244     }
00245 #endif /* WIN32 */
00246 #ifdef qMacCvsPP
00247 #endif /* qMacCvsPP */
00248 #if qUnix
00249 #endif // qUnix
00250
00251     return userHitOK && !gCvsPrefs.empty();
00252 }

Generated on Sun Oct 21 12:42:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GraphOptDlg.h File Reference

common/GraphOptDlg.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_GRAPHOPTDLG_H__E05908EC_20A6_43FE_93C7_0964E6ABB6B1__INCLUDED_

Functions

bool | CompatGetGraphOptions (CPersistentInt &selColor, CPersistentInt &shadowColor, CPersistentInt &headerColor, CPersistentInt &tagColor, CPersistentInt &branchColor, CPersistentInt &nodeColor, CPersistentInt &deadNodeColor, CPersistentInt &userStateNodeColor)

Define Documentation

#define AFX_GRAPHOPTDLG_H__E05908EC_20A6_43FE_93C7_0964E6ABB6B1__INCLUDED_

Definition at line 26 of file GraphOptDlg.h.

Function Documentation

bool CompatGetGraphOptions | ( | CPersistentInt & | selColor,
 |  | CPersistentInt & | shadowColor,
 |  | CPersistentInt & | headerColor,
 |  | CPersistentInt & | tagColor,
 |  | CPersistentInt & | branchColor,
 |  | CPersistentInt & | nodeColor,
 |  | CPersistentInt & | deadNodeColor,
 |  | CPersistentInt & | userStateNodeColor
 | ) |

Definition at line 231 of file GraphOptDlg.cpp.

Referenced by CGraphView::OnGraphGraphoptions().

00234 {
00235     bool userHitOK = false;
00236
00237 #ifdef WIN32
00238     CGraphOptDlg graphOptDlg(selColor, shadowColor,
00239         headerColor, tagColor, branchColor,
00240         nodeColor, deadNodeColor, userStateNodeColor);
00241     if( graphOptDlg.DoModal() == IDOK )
00242     {
00243         userHitOK = true;
00244     }
00245 #endif /* WIN32 */
00246 #ifdef qMacCvsPP
00247 #endif /* qMacCvsPP */
00248 #if qUnix
00249 #endif // qUnix
00250
00251     return userHitOK && !gCvsPrefs.empty();
00252 }

Generated on Sun Oct 21 12:42:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ImportDlg.cpp File Reference

common/ImportDlg.cpp File Reference

#include "stdafx.h"
#include "ImportDlg.h"
#include "CvsPrefs.h"
#include "MultiString.h"
#include "PromptFiles.h"
#include "TextBinary.h"
#include "MakeSurePathExists.h"

Include dependency graph for ImportDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

CMString | gVendorNames (10,"P_VendorNames", sDefVendors)
CMString | gReleasesNames (10,"P_ReleaseNames", sDefReleases)
CMString | gImportModuleNames (10,"P_ImportModuleNames", sDefModuleNames)
bool | CompatGetImport (UPStr &modname, UStr &logmsg, UPStr &vendortag, UPStr &reltag, UPStr &path, bool &useDefIgnore)

Variables

char * | sDefReleases []
char * | sDefVendors []
char * | sDefModuleNames []

Function Documentation

bool CompatGetImport | ( | UPStr & | modname,
 |  | UStr & | logmsg,
 |  | UPStr & | vendortag,
 |  | UPStr & | reltag,
 |  | UPStr & | path,
 |  | bool & | useDefIgnore
 | ) |

Definition at line 439 of file ImportDlg.cpp.

00442 {
00443     bool userHitOK = false;
00444     modname = "";
00445     logmsg = "";
00446     vendortag = "";
00447     reltag = "";
00448     useDefIgnore = false;
00449
00450     static CPStr sLastModName;  /*Obsolete - remove it and always use sFolder! Get rid after all platforms have combo boxes for recent modules!*/
00451
00452     static CPStr sFolder;
00453     static CStr sLastMsg;
00454     static CPStr sLastVTag("avendor");
00455     static CPStr sLastRTag("arelease");
00456
00457     //dig out the folder so we can suggest the module name
00458     CStr uppath, folder;
00459     if( SplitPath(path, uppath, folder) )
00460         sFolder = folder;
00461
00462     if( sLastModName.length() == 0L )   /*Obsolete - see above*/
00463     {
00464         sLastModName = folder;
00465     }
00466 #ifdef WIN32
00467     CPropertySheet pages("Import settings");
00468     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00469     CImport_MAIN page1(sLastMsg, sFolder, sLastRTag, sLastVTag);
00470     CImport_OPTIONS page2(path, useDefIgnore);
00471     CGetPrefs_CVSROOT page3;
00472     CGetPrefs_GLOBALS page4;
00473     pages.AddPage(&page1);
00474     pages.AddPage(&page2);
00475     pages.AddPage(&page3);
00476     pages.AddPage(&page4);
00477     if(pages.DoModal() == IDOK)
00478     {
00479         sLastModName = (const char *)page1.m_modname;
00480         sLastMsg = (const char *)page1.m_logmsg;
00481         sLastVTag = (const char *)page1.m_vtag;
00482         sLastRTag = (const char *)page1.m_rtag;
00483         path = (const char *)page2.m_path;
00484         useDefIgnore = page2.m_chkUseDefIgnore == TRUE;
00485
00486         page3.StoreValues();
00487         page4.StoreValues();
00488         userHitOK = true;
00489     }
00490 #endif /* WIN32 */
00491 #ifdef qMacCvsPP
00492     StDialogHandler theHandler(dlg_Import, LCommander::GetTopCommander());
00493     LWindow *theDialog = theHandler.GetDialog();
00494     ThrowIfNil_(theDialog);
00495     static UInt16 sRuntimePanel = 1;
00496
00497     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00498         (theDialog->FindPaneByID(item_MultiViewPrefs));
00499     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00500
00501     multiView->SwitchToPanel(3);
00502     DoDataExchange_Globals(theDialog, true);
00503     multiView->SwitchToPanel(2);
00504     DoDataExchange (theDialog, item_ImportCvsIgnore, useDefIgnore, true);
00505     DoDataExchange (theDialog, item_EditPath, path, true);
00506     dynamic_cast<LControl*> (theDialog->FindPaneByID (item_EditPath))->AddListener (&theHandler);
00507
00508     multiView->SwitchToPanel(1);
00509     DoDataExchange_ImportMain(theDialog, sLastModName, sLastMsg, true);
00510     DoDataExchange_ImportTags(theDialog, sLastVTag, sLastRTag, true);
00511
00512
00513     groupView->SetValue(sRuntimePanel);
00514     theDialog->Show();
00515     MessageT hitMessage;
00516     while (true)
00517     {       // Let DialogHandler process events
00518         hitMessage = theHandler.DoDialog();
00519
00520         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00521             break;
00522
00523         if(hitMessage == item_EditPath)
00524         {
00525             const char * dir = BrowserGetDirectory("Choose folder to import :");
00526             if(dir != 0L)
00527             {
00528                 CPStr tmp(dir);
00529                 theDialog->SetDescriptorForPaneID(item_EditPath, tmp);
00530             }
00531         }
00532     }
00533     theDialog->Hide();
00534     sRuntimePanel = groupView->GetValue();
00535
00536     if(hitMessage == msg_OK)
00537     {
00538         multiView->SwitchToPanel(1);
00539         DoDataExchange_ImportMain(theDialog, sLastModName, sLastMsg, false);
00540         DoDataExchange_ImportTags(theDialog, sLastVTag, sLastRTag, false);
00541         multiView->SwitchToPanel(2);
00542         DoDataExchange (theDialog, item_ImportCvsIgnore, useDefIgnore, false);
00543         DoDataExchange (theDialog, item_EditPath, path, false);
00544         multiView->SwitchToPanel(3);
00545         DoDataExchange_Globals(theDialog, false);
00546
00547         Assert_(sLastModName.length() != 0);
00548
00549         userHitOK = true;
00550     }
00551 #endif /* qMacCvsPP */
00552 #if qUnix
00553     void *wid = UCreate_ImportDlg();
00554
00555     UCvsImport *dlg = new UCvsImport();
00556     UCvsImport_MAIN *tab1 = new UCvsImport_MAIN(sLastMsg, sLastModName, sLastRTag, sLastVTag);
00557     UCvsImport_OPTIONS *tab2 = new UCvsImport_OPTIONS(path);
00558     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00559     dlg->AddPage(tab1, UCvsImport::kTabGeneral, 0);
00560     dlg->AddPage(tab2, UCvsImport::kTabGeneral, 1);
00561
00562     if(dlg->DoModal())
00563     {
00564         sLastModName = tab1->m_modname;
00565         sLastMsg = tab1->m_logmsg;
00566         sLastVTag = tab1->m_vtag;
00567         sLastRTag = tab1->m_rtag;
00568         path = tab2->m_path;
00569
00570         userHitOK = true;
00571     }
00572
00573     delete dlg;
00574 #endif // qUnix
00575
00576     if(userHitOK)
00577     {
00578         gCvsPrefs.save();
00579         if(sLastMsg.length() == 0)
00580             sLastMsg = "no message";
00581         if(sLastVTag.length() == 0)
00582             sLastVTag = "initial";
00583         if(sLastRTag.length() == 0)
00584             sLastRTag = "start";
00585
00586         modname = sLastModName;
00587         logmsg = sLastMsg;
00588         vendortag = sLastVTag;
00589         reltag = sLastRTag;
00590 #ifdef macintosh
00591         logmsg.replace('\015', '\012');
00592 #endif /* macintosh */
00593     }
00594     return userHitOK;
00595 }

CMString gImportModuleNames | ( | 10 | ,
 |  | "P_ImportModuleNames" | ,
 |  | sDefModuleNames |
 | ) | [static]

CMString gReleasesNames | ( | 10 | ,
 |  | "P_ReleaseNames" | ,
 |  | sDefReleases |
 | ) | [static]

CMString gVendorNames | ( | 10 | ,
 |  | "P_VendorNames" | ,
 |  | sDefVendors |
 | ) | [static]

Variable Documentation

char* sDefModuleNames[] [static]

Initial value:

{
    "Module",
    "Project",
    0L
}

Definition at line 68 of file ImportDlg.cpp.

char* sDefReleases[] [static]

Initial value:

{
    "V10",
    "V101",
    0L
}

Definition at line 55 of file ImportDlg.cpp.

char* sDefVendors[] [static]

Initial value:

{
    "GNU",
    0L
}

Definition at line 62 of file ImportDlg.cpp.

Generated on Sun Oct 21 12:42:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ImportDlg.h File Reference

common/ImportDlg.h File Reference

#include "CPStr.h"

Include dependency graph for ImportDlg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_IMPORTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Functions

bool | CompatGetImport (UPStr &modname, UStr &logmsg, UPStr &vendortag, UPStr &reltag, UPStr &path, bool &useDefIgnore)

Define Documentation

#define AFX_IMPORTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file ImportDlg.h.

Function Documentation

bool CompatGetImport | ( | UPStr & | modname,
 |  | UStr & | logmsg,
 |  | UPStr & | vendortag,
 |  | UPStr & | reltag,
 |  | UPStr & | path,
 |  | bool & | useDefIgnore
 | ) |

Definition at line 439 of file ImportDlg.cpp.

Referenced by CvsCmdImportModule().

00442 {
00443     bool userHitOK = false;
00444     modname = "";
00445     logmsg = "";
00446     vendortag = "";
00447     reltag = "";
00448     useDefIgnore = false;
00449
00450     static CPStr sLastModName;  /*Obsolete - remove it and always use sFolder! Get rid after all platforms have combo boxes for recent modules!*/
00451
00452     static CPStr sFolder;
00453     static CStr sLastMsg;
00454     static CPStr sLastVTag("avendor");
00455     static CPStr sLastRTag("arelease");
00456
00457     //dig out the folder so we can suggest the module name
00458     CStr uppath, folder;
00459     if( SplitPath(path, uppath, folder) )
00460         sFolder = folder;
00461
00462     if( sLastModName.length() == 0L )   /*Obsolete - see above*/
00463     {
00464         sLastModName = folder;
00465     }
00466 #ifdef WIN32
00467     CPropertySheet pages("Import settings");
00468     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00469     CImport_MAIN page1(sLastMsg, sFolder, sLastRTag, sLastVTag);
00470     CImport_OPTIONS page2(path, useDefIgnore);
00471     CGetPrefs_CVSROOT page3;
00472     CGetPrefs_GLOBALS page4;
00473     pages.AddPage(&page1);
00474     pages.AddPage(&page2);
00475     pages.AddPage(&page3);
00476     pages.AddPage(&page4);
00477     if(pages.DoModal() == IDOK)
00478     {
00479         sLastModName = (const char *)page1.m_modname;
00480         sLastMsg = (const char *)page1.m_logmsg;
00481         sLastVTag = (const char *)page1.m_vtag;
00482         sLastRTag = (const char *)page1.m_rtag;
00483         path = (const char *)page2.m_path;
00484         useDefIgnore = page2.m_chkUseDefIgnore == TRUE;
00485
00486         page3.StoreValues();
00487         page4.StoreValues();
00488         userHitOK = true;
00489     }
00490 #endif /* WIN32 */
00491 #ifdef qMacCvsPP
00492     StDialogHandler theHandler(dlg_Import, LCommander::GetTopCommander());
00493     LWindow *theDialog = theHandler.GetDialog();
00494     ThrowIfNil_(theDialog);
00495     static UInt16 sRuntimePanel = 1;
00496
00497     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00498         (theDialog->FindPaneByID(item_MultiViewPrefs));
00499     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00500
00501     multiView->SwitchToPanel(3);
00502     DoDataExchange_Globals(theDialog, true);
00503     multiView->SwitchToPanel(2);
00504     DoDataExchange (theDialog, item_ImportCvsIgnore, useDefIgnore, true);
00505     DoDataExchange (theDialog, item_EditPath, path, true);
00506     dynamic_cast<LControl*> (theDialog->FindPaneByID (item_EditPath))->AddListener (&theHandler);
00507
00508     multiView->SwitchToPanel(1);
00509     DoDataExchange_ImportMain(theDialog, sLastModName, sLastMsg, true);
00510     DoDataExchange_ImportTags(theDialog, sLastVTag, sLastRTag, true);
00511
00512
00513     groupView->SetValue(sRuntimePanel);
00514     theDialog->Show();
00515     MessageT hitMessage;
00516     while (true)
00517     {       // Let DialogHandler process events
00518         hitMessage = theHandler.DoDialog();
00519
00520         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00521             break;
00522
00523         if(hitMessage == item_EditPath)
00524         {
00525             const char * dir = BrowserGetDirectory("Choose folder to import :");
00526             if(dir != 0L)
00527             {
00528                 CPStr tmp(dir);
00529                 theDialog->SetDescriptorForPaneID(item_EditPath, tmp);
00530             }
00531         }
00532     }
00533     theDialog->Hide();
00534     sRuntimePanel = groupView->GetValue();
00535
00536     if(hitMessage == msg_OK)
00537     {
00538         multiView->SwitchToPanel(1);
00539         DoDataExchange_ImportMain(theDialog, sLastModName, sLastMsg, false);
00540         DoDataExchange_ImportTags(theDialog, sLastVTag, sLastRTag, false);
00541         multiView->SwitchToPanel(2);
00542         DoDataExchange (theDialog, item_ImportCvsIgnore, useDefIgnore, false);
00543         DoDataExchange (theDialog, item_EditPath, path, false);
00544         multiView->SwitchToPanel(3);
00545         DoDataExchange_Globals(theDialog, false);
00546
00547         Assert_(sLastModName.length() != 0);
00548
00549         userHitOK = true;
00550     }
00551 #endif /* qMacCvsPP */
00552 #if qUnix
00553     void *wid = UCreate_ImportDlg();
00554
00555     UCvsImport *dlg = new UCvsImport();
00556     UCvsImport_MAIN *tab1 = new UCvsImport_MAIN(sLastMsg, sLastModName, sLastRTag, sLastVTag);
00557     UCvsImport_OPTIONS *tab2 = new UCvsImport_OPTIONS(path);
00558     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00559     dlg->AddPage(tab1, UCvsImport::kTabGeneral, 0);
00560     dlg->AddPage(tab2, UCvsImport::kTabGeneral, 1);
00561
00562     if(dlg->DoModal())
00563     {
00564         sLastModName = tab1->m_modname;
00565         sLastMsg = tab1->m_logmsg;
00566         sLastVTag = tab1->m_vtag;
00567         sLastRTag = tab1->m_rtag;
00568         path = tab2->m_path;
00569
00570         userHitOK = true;
00571     }
00572
00573     delete dlg;
00574 #endif // qUnix
00575
00576     if(userHitOK)
00577     {
00578         gCvsPrefs.save();
00579         if(sLastMsg.length() == 0)
00580             sLastMsg = "no message";
00581         if(sLastVTag.length() == 0)
00582             sLastVTag = "initial";
00583         if(sLastRTag.length() == 0)
00584             sLastRTag = "start";
00585
00586         modname = sLastModName;
00587         logmsg = sLastMsg;
00588         vendortag = sLastVTag;
00589         reltag = sLastRTag;
00590 #ifdef macintosh
00591         logmsg.replace('\015', '\012');
00592 #endif /* macintosh */
00593     }
00594     return userHitOK;
00595 }

Generated on Sun Oct 21 12:42:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ImportFilter.cpp File Reference

common/ImportFilter.cpp File Reference

#include "stdafx.h"
#include "ImportFilter.h"
#include "AppConsole.h"
#include "CvsIgnore.h"

Include dependency graph for ImportFilter.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | ImportReport

Defines

#define | NEW new
#define | MACSPEC

Functions

void | list_add_warning (ReportWarning *&warnings, kTextBinTYPE warn, const char *sample)
void | list_add_type (ImportReport *impReport, ReportConflict *&conflicts, bool isBinary, const char *sample, const char *fullname, int mac_type, int mac_creator)
kTraversal | list_all_types_recur (const char *path, ReportWarning *&warnings, ReportConflict *&conflicts)
void | free_list_types (ReportWarning *warnings, ReportConflict *conflicts)

Variables

const char * | lf = "\n"

Define Documentation

#define MACSPEC

#define NEW new

Definition at line 72 of file ImportFilter.cpp.

Function Documentation

void free_list_types | ( | ReportWarning * | warnings,
 |  | ReportConflict * | conflicts
 | ) |

Definition at line 505 of file ImportFilter.cpp.

00506 {
00507     ReportWarning *tmpwarn;
00508     ReportWarning *warn = warnings;
00509     while(warn != 0L)
00510     {
00511         tmpwarn = warn;
00512         warn = warn->next;
00513         delete tmpwarn;
00514     }
00515
00516     ReportConflict *tmpconf;
00517     ReportConflict *conf = conflicts;
00518     while(conf != 0L)
00519     {
00520         tmpconf = conf;
00521         conf = conf->next;
00522         delete tmpconf;
00523     }
00524 }

void list_add_type | ( | ImportReport * | impReport,
 |  | ReportConflict *& | conflicts,
 |  | bool | isBinary,
 |  | const char * | sample,
 |  | const char * | fullname,
 |  | int | mac_type,
 |  | int | mac_creator
 | ) | [static]

Definition at line 442 of file ImportFilter.cpp.

Referenced by ImportReport::OnFile().

00445 {
00446     // look for a matching entry
00447     ReportConflict *entry = conflicts;
00448     while(entry != 0L)
00449     {
00450         if(entry->Match(sample))
00451         {
00452             if(entry->HasConflict())
00453                 return;
00454
00455             if(entry->IsBinary() ^ isBinary)
00456                 entry->SetConflict(fullname);
00457
00458             // mac only
00459             if(entry->GetMacType() != mac_type || entry->GetMacCreator() != mac_creator)
00460                 entry->SetTypeCreatorConflict(fullname);
00461
00462             // it matches perfectly
00463             return;
00464         }
00465         entry = entry->next;
00466     }
00467
00468     // find the extension
00469     const char *tmp = sample, *ext = 0L;
00470     while((tmp = strchr(tmp, '.')) != 0L)
00471     {
00472         ext = tmp++;
00473     }
00474
00475     // add a new entry
00476     ReportConflict *newc = NEW ReportConflict(mac_type, mac_creator);
00477     if(newc == 0L)
00478     {
00479         cvs_err("Impossible to allocate %d bytes !\n", sizeof(ReportConflict));
00480         return;
00481     }
00482
00483     newc->AddPattern(ext != 0L ? ext : sample, isBinary, ext != 0L, fullname);
00484     if(conflicts == 0L)
00485         conflicts = newc;
00486     else
00487     {
00488         newc->next = conflicts;
00489         conflicts = newc;
00490     }
00491
00492     // MN - Apply ignore filter. If $HOME/.cvsignore tells that
00493     // file should be ignored then set object to ignored state.
00494     if(MatchIgnoredList(sample, impReport->m_Ignlist))
00495         newc->Ignore();
00496 }

void list_add_warning | ( | ReportWarning *& | warnings,
 |  | kTextBinTYPE | warn,
 |  | const char * | sample
 | ) | [static]

Definition at line 293 of file ImportFilter.cpp.

Referenced by ImportReport::OnAlias(), ImportReport::OnError(), and ImportReport::OnFile().

00294 {
00295     // find if it exists already a same kind of warning
00296     ReportWarning *tmp = warnings;
00297     while(tmp != 0L)
00298     {
00299         if(tmp->Kind() == warn)
00300             break;
00301         tmp = tmp->next;
00302     }
00303     if(tmp != 0L && tmp->Kind() == warn)
00304     {
00305         tmp->AddWarning(sample);
00306         return;
00307     }
00308
00309     // insert new one
00310     tmp = NEW ReportWarning(warn);
00311     if(tmp == 0L)
00312     {
00313         cvs_err("Impossible to allocate %d bytes !\n", sizeof(ReportWarning));
00314         return;
00315     }
00316
00317     tmp->AddWarning(sample);
00318     if(warnings == 0L)
00319     {
00320         warnings = tmp;
00321     }
00322     else
00323     {
00324         tmp->next = warnings;
00325         warnings = tmp;
00326     }
00327 }

kTraversal list_all_types_recur | ( | const char * | path,
 |  | ReportWarning *& | warnings,
 |  | ReportConflict *& | conflicts
 | ) |

Definition at line 498 of file ImportFilter.cpp.

00500 {
00501     ImportReport report(path, warnings, conflicts);
00502     return FileTraverse(path, report);
00503 }

Variable Documentation

const char* lf = "\n" [static]

Definition at line 60 of file ImportFilter.cpp.

Generated on Sun Oct 21 12:42:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ImportFilter.h File Reference

common/ImportFilter.h File Reference

#include <vector>
#include "TextBinary.h"
#include "CPStr.h"
#include "FileTraversal.h"

Include dependency graph for ImportFilter.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | ReportConflict
class | ReportWarning

Defines

#define | AFX_IMPORTFILTER_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Functions

kTraversal | list_all_types_recur (const char *path, ReportWarning *&warnings, ReportConflict *&conflicts)
void | free_list_types (ReportWarning *warnings, ReportConflict *conflicts)

Define Documentation

#define AFX_IMPORTFILTER_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file ImportFilter.h.

Function Documentation

void free_list_types | ( | ReportWarning * | warnings,
 |  | ReportConflict * | conflicts
 | ) |

Definition at line 505 of file ImportFilter.cpp.

Referenced by CompatImportFilter(), and CvsCmdImportModule().

00506 {
00507     ReportWarning *tmpwarn;
00508     ReportWarning *warn = warnings;
00509     while(warn != 0L)
00510     {
00511         tmpwarn = warn;
00512         warn = warn->next;
00513         delete tmpwarn;
00514     }
00515
00516     ReportConflict *tmpconf;
00517     ReportConflict *conf = conflicts;
00518     while(conf != 0L)
00519     {
00520         tmpconf = conf;
00521         conf = conf->next;
00522         delete tmpconf;
00523     }
00524 }

kTraversal list_all_types_recur | ( | const char * | path,
 |  | ReportWarning *& | warnings,
 |  | ReportConflict *& | conflicts
 | ) |

Definition at line 498 of file ImportFilter.cpp.

Referenced by CompatImportFilter().

00500 {
00501     ImportReport report(path, warnings, conflicts);
00502     return FileTraverse(path, report);
00503 }

Generated on Sun Oct 21 12:42:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ImportFilterDlg.cpp File Reference

common/ImportFilterDlg.cpp File Reference

#include "stdafx.h"
#include "ImportFilterDlg.h"

Include dependency graph for ImportFilterDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool CompatImportFilter (const char *path, ReportConflict *&entries, ReportWarning *&warnings)

Function Documentation

bool CompatImportFilter | ( | const char * | path,
 |  | ReportConflict *& | entries,
 |  | ReportWarning *& | warnings
 | ) |

Definition at line 1137 of file ImportFilterDlg.cpp.

01139 {
01140     bool result = false;
01141     entries = 0L;
01142     warnings = 0L;
01143
01144     list_all_types_recur(path, warnings, entries);
01145     if(entries == 0L && warnings == 0L)
01146         return false;
01147
01148 #ifdef WIN32
01149     CImportFilterDlg pages(entries, warnings);
01150     if(pages.DoModal() == IDOK)
01151     {
01152         result = true;
01153     }
01154 #endif /* WIN32 */
01155 #ifdef qMacCvsPP
01156     gWarnings = warnings;
01157     gEntries = entries;
01158
01159     StDialogHandler theHandler(dlg_ImpFilter, LCommander::GetTopCommander());
01160     LWindow *theDialog = theHandler.GetDialog();
01161     ThrowIfNil_(theDialog);
01162
01163     theDialog->Show();
01164     MessageT hitMessage;
01165     while (true)
01166     {       // Let DialogHandler process events
01167         hitMessage = theHandler.DoDialog();
01168
01169         if(hitMessage == item_ImpPushEdit)
01170         {
01171             // simulate dbl click
01172             LOutlineTable *tab = dynamic_cast<LOutlineTable*>
01173                 (theDialog->FindPaneByID(item_ImpFilterList));
01174
01175             STableCell  cell = tab->GetFirstSelectedCell();
01176             if(!cell.IsNullCell())
01177             {
01178                 //TableIndexT index;
01179                 //tab->CellToIndex(cell, index);
01180                 CImportItem *item = dynamic_cast<CImportItem*>(tab->FindItemForRow(cell.row));
01181                 Assert_(item != 0L);
01182                 if(item != 0L)
01183                     item->EditImportCell();
01184             }
01185         }
01186
01187         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01188             break;
01189     }
01190     theDialog->Hide();
01191
01192     if(hitMessage == msg_OK)
01193     {
01194         result = true;
01195     }
01196 #endif /* qMacCvsPP */
01197 #if qUnix
01198     void *wid = UCreate_ImportFilterDlg();
01199
01200     UCvsImpFilter *dlg = new UCvsImpFilter(entries, warnings);
01201     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01202
01203     if(dlg->DoModal())
01204     {
01205         result = true;
01206     }
01207
01208     delete dlg;
01209 #endif // qUnix
01210
01211     if(!result)
01212     {
01213         free_list_types(warnings, entries);
01214         entries = 0L;
01215         warnings = 0L;
01216     }
01217
01218     return result;
01219 }

Generated on Sun Oct 21 12:42:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ImportFilterDlg.h File Reference

common/ImportFilterDlg.h File Reference

#include "ImportFilter.h"

Include dependency graph for ImportFilterDlg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_IMPORTFILDERDLG_H__CFB7AA41_BDDB_11D1_B965_0020AF51D9DA__INCLUDED_

Functions

bool | CompatImportFilter (const char *path, ReportConflict *&entries, ReportWarning *&warnings)

Define Documentation

#define AFX_IMPORTFILDERDLG_H__CFB7AA41_BDDB_11D1_B965_0020AF51D9DA__INCLUDED_

Definition at line 26 of file ImportFilterDlg.h.

Function Documentation

bool CompatImportFilter | ( | const char * | path,
 |  | ReportConflict *& | entries,
 |  | ReportWarning *& | warnings
 | ) |

Definition at line 1137 of file ImportFilterDlg.cpp.

Referenced by CvsCmdImportModule().

01139 {
01140     bool result = false;
01141     entries = 0L;
01142     warnings = 0L;
01143
01144     list_all_types_recur(path, warnings, entries);
01145     if(entries == 0L && warnings == 0L)
01146         return false;
01147
01148 #ifdef WIN32
01149     CImportFilterDlg pages(entries, warnings);
01150     if(pages.DoModal() == IDOK)
01151     {
01152         result = true;
01153     }
01154 #endif /* WIN32 */
01155 #ifdef qMacCvsPP
01156     gWarnings = warnings;
01157     gEntries = entries;
01158
01159     StDialogHandler theHandler(dlg_ImpFilter, LCommander::GetTopCommander());
01160     LWindow *theDialog = theHandler.GetDialog();
01161     ThrowIfNil_(theDialog);
01162
01163     theDialog->Show();
01164     MessageT hitMessage;
01165     while (true)
01166     {       // Let DialogHandler process events
01167         hitMessage = theHandler.DoDialog();
01168
01169         if(hitMessage == item_ImpPushEdit)
01170         {
01171             // simulate dbl click
01172             LOutlineTable *tab = dynamic_cast<LOutlineTable*>
01173                 (theDialog->FindPaneByID(item_ImpFilterList));
01174
01175             STableCell  cell = tab->GetFirstSelectedCell();
01176             if(!cell.IsNullCell())
01177             {
01178                 //TableIndexT index;
01179                 //tab->CellToIndex(cell, index);
01180                 CImportItem *item = dynamic_cast<CImportItem*>(tab->FindItemForRow(cell.row));
01181                 Assert_(item != 0L);
01182                 if(item != 0L)
01183                     item->EditImportCell();
01184             }
01185         }
01186
01187         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01188             break;
01189     }
01190     theDialog->Hide();
01191
01192     if(hitMessage == msg_OK)
01193     {
01194         result = true;
01195     }
01196 #endif /* qMacCvsPP */
01197 #if qUnix
01198     void *wid = UCreate_ImportFilterDlg();
01199
01200     UCvsImpFilter *dlg = new UCvsImpFilter(entries, warnings);
01201     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01202
01203     if(dlg->DoModal())
01204     {
01205         result = true;
01206     }
01207
01208     delete dlg;
01209 #endif // qUnix
01210
01211     if(!result)
01212     {
01213         free_list_types(warnings, entries);
01214         entries = 0L;
01215         warnings = 0L;
01216     }
01217
01218     return result;
01219 }

Generated on Sun Oct 21 12:42:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


InitDlg.cpp File Reference

common/InitDlg.cpp File Reference

#include "stdafx.h"
#include "InitDlg.h"
#include "CvsPrefs.h"

Include dependency graph for InitDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool CompatGetInit (bool &forceCvsroot)

Function Documentation

bool CompatGetInit ( bool & forceCvsroot )

Definition at line 87 of file InitDlg.cpp.

00088 {
00089     bool userHitOK = false;
00090
00091     forceCvsroot = true;
00092
00093 #ifdef WIN32
00094     CPropertySheet pages("Init settings");
00095     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00096     CInit_MAIN page1(forceCvsroot);
00097     CGetPrefs_CVSROOT page2;
00098     CGetPrefs_GLOBALS page3;
00099     pages.AddPage(&page1);
00100     pages.AddPage(&page2);
00101     pages.AddPage(&page3);
00102     if(pages.DoModal() == IDOK)
00103     {
00104         forceCvsroot = page1.m_forceroot == TRUE;
00105
00106         page2.StoreValues();
00107         page3.StoreValues();
00108         userHitOK = true;
00109     }
00110 #endif /* WIN32 */
00111
00112     if(userHitOK)
00113     {
00114         gCvsPrefs.save();
00115     }
00116     return userHitOK;
00117 }

Generated on Sun Oct 21 12:42:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


InitDlg.h File Reference

common/InitDlg.h File Reference

#include "CPStr.h"

Include dependency graph for InitDlg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_INITDLG_H__155D02C3_2323_11D3_B1A6_004095463819__INCLUDED_

Functions

bool | CompatGetInit (bool &forceCvsroot)

Define Documentation

#define AFX_INITDLG_H__155D02C3_2323_11D3_B1A6_004095463819__INCLUDED_

Definition at line 26 of file InitDlg.h.

Function Documentation

bool CompatGetInit ( bool & forceCvsroot )

Definition at line 87 of file InitDlg.cpp.

Referenced by CvsCmdInit().

00088 {
00089     bool userHitOK = false;
00090
00091     forceCvsroot = true;
00092
00093 #ifdef WIN32
00094     CPropertySheet pages("Init settings");
00095     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00096     CInit_MAIN page1(forceCvsroot);
00097     CGetPrefs_CVSROOT page2;
00098     CGetPrefs_GLOBALS page3;
00099     pages.AddPage(&page1);
00100     pages.AddPage(&page2);
00101     pages.AddPage(&page3);
00102     if(pages.DoModal() == IDOK)
00103     {
00104         forceCvsroot = page1.m_forceroot == TRUE;
00105
00106         page2.StoreValues();
00107         page3.StoreValues();
00108         userHitOK = true;
00109     }
00110 #endif /* WIN32 */
00111
00112     if(userHitOK)
00113     {
00114         gCvsPrefs.save();
00115     }
00116     return userHitOK;
00117 }

Generated on Sun Oct 21 12:42:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LineCmd.cpp File Reference

common/LineCmd.cpp File Reference

#include "stdafx.h"
#include "LineCmd.h"
#include "CvsArgs.h"
#include "PromptFiles.h"
#include "CPStr.h"
#include "TextBinary.h"

Include dependency graph for LineCmd.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool CompatGetCommand (CvsArgs &args, const char *&dir)

Function Documentation

bool CompatGetCommand | ( | CvsArgs & | args,
 |  | const char *& | dir
 | ) |

Definition at line 308 of file LineCmd.cpp.

00309 {
00310     char cmd[MAX_CMD_LEN] = {'\0'};
00311     dir = 0L;
00312
00313     static CStr sLastCmdline("cvs ");
00314 #ifdef macintosh
00315     static CPStr sLastPath("pick:a:mac:path:");
00316 #else /* !macintosh */
00317     static CPStr sLastPath("");
00318 #endif /* !macintosh */
00319     static bool sLastHasPath = false;
00320
00321 #ifdef WIN32
00322     CPropertySheet pages("Command line settings");
00323     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00324     CCmdLine_MAIN page1(sLastCmdline, sLastHasPath, sLastPath);
00325     CGetPrefs_GLOBALS page2;
00326     pages.AddPage(&page1);
00327     pages.AddPage(&page2);
00328     if(pages.DoModal() == IDOK)
00329     {
00330         sLastCmdline = page1.m_cmdline;
00331         sLastHasPath = page1.m_checkpath == TRUE;
00332         sLastPath = page1.m_folderloc;
00333
00334         dir = page1.m_checkpath ? (const char *)sLastPath : 0L;
00335         strcpy(cmd, page1.m_cmdline);
00336
00337         page2.StoreValues();
00338         gCvsPrefs.save();
00339     }
00340     else
00341         return false;
00342 #endif /* WIN32 */
00343 #if qUnix
00344     void *wid = UCreate_CmdlineDlg();
00345
00346     UCvsCmdline *dlg = new UCvsCmdline();
00347     UCvsCmdline_MAIN *tab1 = new UCvsCmdline_MAIN(sLastCmdline, sLastHasPath, sLastPath);
00348     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00349     dlg->AddPage(tab1, UCvsCmdline::kTabGeneral, 0);
00350
00351     if(dlg->DoModal())
00352     {
00353         sLastCmdline = tab1->m_cmdline;
00354         sLastHasPath = tab1->m_checkpath;
00355         sLastPath = tab1->m_folderloc;
00356
00357         dir = tab1->m_checkpath ? (const char *)sLastPath : 0L;
00358         strcpy(cmd, tab1->m_cmdline);
00359     }
00360     else
00361     {
00362         delete dlg;
00363         return false;
00364     }
00365
00366     delete dlg;
00367 #endif // qUnix
00368 #ifdef qMacCvsPP
00369     StDialogHandler theHandler(dlg_Cmdline, LCommander::GetTopCommander());
00370     LWindow *theDialog = theHandler.GetDialog();
00371     ThrowIfNil_(theDialog);
00372     static UInt16 sRuntimePanel = 1;
00373
00374     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00375         (theDialog->FindPaneByID(item_MultiViewPrefs));
00376     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00377
00378     multiView->SwitchToPanel(2);
00379     DoDataExchange_Globals(theDialog, true);
00380     multiView->SwitchToPanel(1);
00381     DoDataExchange_CmdlineMain(theDialog, sLastCmdline, sLastPath, sLastHasPath, true);
00382
00383     LCheckBoxGroupBox *cbox = dynamic_cast<LCheckBoxGroupBox*>
00384         (theDialog->FindPaneByID(item_CheckGroupPath));
00385     LPushButton *epath = dynamic_cast<LPushButton*>
00386         (theDialog->FindPaneByID(item_EditPath));
00387     epath->AddListener(&theHandler);
00388     cbox->AddListener(&theHandler);
00389
00390     groupView->SetValue(sRuntimePanel);
00391     theDialog->Show();
00392     MessageT hitMessage;
00393     while (true)
00394     {       // Let DialogHandler process events
00395         hitMessage = theHandler.DoDialog();
00396
00397         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00398             break;
00399
00400         if(hitMessage == item_CheckGroupPath || hitMessage == item_EditPath)
00401         {
00402             cbox = dynamic_cast<LCheckBoxGroupBox*>
00403                 (theDialog->FindPaneByID(item_CheckGroupPath));
00404             epath = dynamic_cast<LPushButton*>
00405                 (theDialog->FindPaneByID(item_EditPath));
00406             if(cbox->GetValue() == Button_Off)
00407             {
00408                 dir = 0L;
00409                 continue;
00410             }
00411
00412             dir = BrowserGetDirectory("Select where to execute :");
00413             if(dir != 0L)
00414             {
00415                 CPStr tmp(dir);
00416                 epath->SetDescriptor(tmp);
00417             }
00418             else if(hitMessage == item_CheckGroupPath)
00419             {
00420                 cbox->SetValue(Button_Off);
00421             }
00422         }
00423
00424     }
00425     theDialog->Hide();
00426     sRuntimePanel = groupView->GetValue();
00427
00428     if(hitMessage == msg_OK)
00429     {
00430         multiView->SwitchToPanel(1);
00431         DoDataExchange_CmdlineMain(theDialog, sLastCmdline, sLastPath, sLastHasPath, false);
00432         multiView->SwitchToPanel(2);
00433         DoDataExchange_Globals(theDialog, false);
00434
00435         strcpy(cmd, sLastCmdline);
00436         Assert_(sLastCmdline.length() != 0);
00437         dir = sLastHasPath ? (const char *)sLastPath : 0L;
00438     }
00439     else
00440         return false;
00441 #endif /* qMacCvsPP */
00442
00443     if(cmd[0] == '\0' || (dir != 0L && dir[0] == '\0'))
00444         return false;
00445
00446     char *argv[MAX_ARGS];
00447     int argc = StringToArgv(cmd, argv);
00448
00449     for (int i = 0; i < argc; i++)
00450         args.add(argv[i]);
00451
00452     return true;
00453 }

Generated on Sun Oct 21 12:42:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LineCmd.h File Reference

common/LineCmd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_LINECMD_H__5946A8C5_8517_11D1_8949_444553540000__INCLUDED_

Functions

bool | CompatGetCommand (CvsArgs &args, const char *&dir)

Define Documentation

#define AFX_LINECMD_H__5946A8C5_8517_11D1_8949_444553540000__INCLUDED_

Definition at line 22 of file LineCmd.h.

Function Documentation

bool CompatGetCommand | ( | CvsArgs & | args,
 |  | const char *& | dir
 | ) |

Definition at line 308 of file LineCmd.cpp.

Referenced by CvsCmdLine().

00309 {
00310     char cmd[MAX_CMD_LEN] = {'\0'};
00311     dir = 0L;
00312
00313     static CStr sLastCmdline("cvs ");
00314 #ifdef macintosh
00315     static CPStr sLastPath("pick:a:mac:path:");
00316 #else /* !macintosh */
00317     static CPStr sLastPath("");
00318 #endif /* !macintosh */
00319     static bool sLastHasPath = false;
00320
00321 #ifdef WIN32
00322     CPropertySheet pages("Command line settings");
00323     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00324     CCmdLine_MAIN page1(sLastCmdline, sLastHasPath, sLastPath);
00325     CGetPrefs_GLOBALS page2;
00326     pages.AddPage(&page1);
00327     pages.AddPage(&page2);
00328     if(pages.DoModal() == IDOK)
00329     {
00330         sLastCmdline = page1.m_cmdline;
00331         sLastHasPath = page1.m_checkpath == TRUE;
00332         sLastPath = page1.m_folderloc;
00333
00334         dir = page1.m_checkpath ? (const char *)sLastPath : 0L;
00335         strcpy(cmd, page1.m_cmdline);
00336
00337         page2.StoreValues();
00338         gCvsPrefs.save();
00339     }
00340     else
00341         return false;
00342 #endif /* WIN32 */
00343 #if qUnix
00344     void *wid = UCreate_CmdlineDlg();
00345
00346     UCvsCmdline *dlg = new UCvsCmdline();
00347     UCvsCmdline_MAIN *tab1 = new UCvsCmdline_MAIN(sLastCmdline, sLastHasPath, sLastPath);
00348     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00349     dlg->AddPage(tab1, UCvsCmdline::kTabGeneral, 0);
00350
00351     if(dlg->DoModal())
00352     {
00353         sLastCmdline = tab1->m_cmdline;
00354         sLastHasPath = tab1->m_checkpath;
00355         sLastPath = tab1->m_folderloc;
00356
00357         dir = tab1->m_checkpath ? (const char *)sLastPath : 0L;
00358         strcpy(cmd, tab1->m_cmdline);
00359     }
00360     else
00361     {
00362         delete dlg;
00363         return false;
00364     }
00365
00366     delete dlg;
00367 #endif // qUnix
00368 #ifdef qMacCvsPP
00369     StDialogHandler theHandler(dlg_Cmdline, LCommander::GetTopCommander());
00370     LWindow *theDialog = theHandler.GetDialog();
00371     ThrowIfNil_(theDialog);
00372     static UInt16 sRuntimePanel = 1;
00373
00374     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00375         (theDialog->FindPaneByID(item_MultiViewPrefs));
00376     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00377
00378     multiView->SwitchToPanel(2);
00379     DoDataExchange_Globals(theDialog, true);
00380     multiView->SwitchToPanel(1);
00381     DoDataExchange_CmdlineMain(theDialog, sLastCmdline, sLastPath, sLastHasPath, true);
00382
00383     LCheckBoxGroupBox *cbox = dynamic_cast<LCheckBoxGroupBox*>
00384         (theDialog->FindPaneByID(item_CheckGroupPath));
00385     LPushButton *epath = dynamic_cast<LPushButton*>
00386         (theDialog->FindPaneByID(item_EditPath));
00387     epath->AddListener(&theHandler);
00388     cbox->AddListener(&theHandler);
00389
00390     groupView->SetValue(sRuntimePanel);
00391     theDialog->Show();
00392     MessageT hitMessage;
00393     while (true)
00394     {       // Let DialogHandler process events
00395         hitMessage = theHandler.DoDialog();
00396
00397         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00398             break;
00399
00400         if(hitMessage == item_CheckGroupPath || hitMessage == item_EditPath)
00401         {
00402             cbox = dynamic_cast<LCheckBoxGroupBox*>
00403                 (theDialog->FindPaneByID(item_CheckGroupPath));
00404             epath = dynamic_cast<LPushButton*>
00405                 (theDialog->FindPaneByID(item_EditPath));
00406             if(cbox->GetValue() == Button_Off)
00407             {
00408                 dir = 0L;
00409                 continue;
00410             }
00411
00412             dir = BrowserGetDirectory("Select where to execute :");
00413             if(dir != 0L)
00414             {
00415                 CPStr tmp(dir);
00416                 epath->SetDescriptor(tmp);
00417             }
00418             else if(hitMessage == item_CheckGroupPath)
00419             {
00420                 cbox->SetValue(Button_Off);
00421             }
00422         }
00423
00424     }
00425     theDialog->Hide();
00426     sRuntimePanel = groupView->GetValue();
00427
00428     if(hitMessage == msg_OK)
00429     {
00430         multiView->SwitchToPanel(1);
00431         DoDataExchange_CmdlineMain(theDialog, sLastCmdline, sLastPath, sLastHasPath, false);
00432         multiView->SwitchToPanel(2);
00433         DoDataExchange_Globals(theDialog, false);
00434
00435         strcpy(cmd, sLastCmdline);
00436         Assert_(sLastCmdline.length() != 0);
00437         dir = sLastHasPath ? (const char *)sLastPath : 0L;
00438     }
00439     else
00440         return false;
00441 #endif /* qMacCvsPP */
00442
00443     if(cmd[0] == '\0' || (dir != 0L && dir[0] == '\0'))
00444         return false;
00445
00446     char *argv[MAX_ARGS];
00447     int argc = StringToArgv(cmd, argv);
00448
00449     for (int i = 0; i < argc; i++)
00450         args.add(argv[i]);
00451
00452     return true;
00453 }

Generated on Sun Oct 21 12:42:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LogDlg.cpp File Reference

common/LogDlg.cpp File Reference

#include "stdafx.h"
#include "LogDlg.h"
#include "CvsPrefs.h"
#include "MultiString.h"

Include dependency graph for LogDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

CMString | gLogRevNames (10,"P_LogTagNames", sDefLogTagNames)
CMString | gLogDateNames (10,"P_LogDateNames", sDefLogDateNames)
CMString | gLogStateNames (10,"P_LogStateNames", sDefLogStateNames)
CMString | gLogUserNames (10,"P_LogUserNames", sDefLogUserNames)
bool | CompatGetLog (bool &noRecurs, bool &defBranch, UPStr &date, bool &headerOnly, bool &noTags, bool &onlyRCSfile, bool &hasRev, UPStr &rev, UPStr &states, bool &hasUsers, UPStr &users, bool outGraph)

Variables

char * | sDefLogTagNames []
char * | sDefLogDateNames []
char * | sDefLogStateNames []
char * | sDefLogUserNames []

Function Documentation

bool CompatGetLog | ( | bool & | noRecurs,
 |  | bool & | defBranch,
 |  | UPStr & | date,
 |  | bool & | headerOnly,
 |  | bool & | noTags,
 |  | bool & | onlyRCSfile,
 |  | bool & | hasRev,
 |  | UPStr & | rev,
 |  | UPStr & | states,
 |  | bool & | hasUser,
 |  | UPStr & | users,
 |  | bool | outGraph = false
 | ) |

Definition at line 564 of file LogDlg.cpp.

00568 {
00569     bool userHitOK = false;
00570
00571     static CPStr sLastDate;
00572     static CPStr sLastRev;
00573     static CPStr sLastUsers;
00574     static CPStr sLastStates;
00575
00576     bool hasDate = false;
00577     bool hasStates = false;
00578
00579     hasRev = false;
00580     hasUsers = false;
00581     date = "";
00582     rev = "";
00583     states = "";
00584     users = "";
00585     noRecurs = false;
00586     defBranch = false;
00587     headerOnly = false;
00588     noTags = false;
00589     onlyRCSfile = false;
00590
00591 #ifdef WIN32
00592     COptionalPropertySheet pages(outGraph ? gCvsPrefs.HideCommandDlgGraph() : gCvsPrefs.HideCommandDlgLog(),
00593         outGraph ? "Graph settings" : "Log settings");
00594     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00595     CLogMain page1;
00596     CLogFilters page2(sLastDate, sLastRev, sLastUsers, sLastStates);
00597     CGetPrefs_GLOBALS page3;
00598     pages.AddPage(&page1);
00599     pages.AddPage(&page2);
00600     pages.AddPage(&page3);
00601     if(pages.DoModal() == IDOK)
00602     {
00603         noRecurs = page1.m_norecurs == TRUE;
00604         defBranch = page1.m_defbranch == TRUE;
00605         headerOnly = page1.m_nousers == TRUE;
00606         noTags = page1.m_notags == TRUE;
00607         onlyRCSfile = page1.m_onlyrcs == TRUE;
00608
00609         sLastDate = page2.m_date;
00610         sLastRev = page2.m_rev;
00611         sLastUsers = page2.m_user;
00612         sLastStates = page2.m_state;
00613
00614         hasRev = page2.m_hasrev == TRUE;
00615         hasUsers = page2.m_hasuser == TRUE;
00616         hasDate = page2.m_hasdate == TRUE;
00617         hasStates = page2.m_hasstate == TRUE;
00618
00619         page3.StoreValues();
00620         if( outGraph )
00621         {
00622             gCvsPrefs.SetHideCommandDlgGraph(pages.GetHideCommandDlg());
00623         }
00624         else
00625         {
00626             gCvsPrefs.SetHideCommandDlgLog(pages.GetHideCommandDlg());
00627         }
00628         userHitOK = true;
00629     }
00630 #endif /* WIN32 */
00631 #ifdef qMacCvsPP
00632     StDialogHandler theHandler(dlg_Log, LCommander::GetTopCommander());
00633     LWindow *theDialog = theHandler.GetDialog();
00634     ThrowIfNil_(theDialog);
00635     static UInt16 sRuntimePanel = 1;
00636
00637     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00638         (theDialog->FindPaneByID(item_MultiViewPrefs));
00639     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00640
00641     multiView->SwitchToPanel(3);
00642     DoDataExchange_Globals(theDialog, true);
00643     multiView->SwitchToPanel(2);
00644     DoDataExchange_LogFilters(theDialog, hasDate, hasStates, hasRev, hasUsers,
00645         sLastDate, sLastRev, sLastUsers, sLastStates, true);
00646     multiView->SwitchToPanel(1);
00647     DoDataExchange_LogSettings(theDialog, noRecurs, defBranch, headerOnly, noTags, onlyRCSfile, true);
00648
00649     groupView->SetValue(sRuntimePanel);
00650     theDialog->Show();
00651     MessageT hitMessage;
00652     while (true)
00653     {       // Let DialogHandler process events
00654         hitMessage = theHandler.DoDialog();
00655
00656         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00657             break;
00658     }
00659     theDialog->Hide();
00660     sRuntimePanel = groupView->GetValue();
00661
00662     if(hitMessage == msg_OK)
00663     {
00664         multiView->SwitchToPanel(1);
00665         DoDataExchange_LogSettings(theDialog, noRecurs, defBranch, headerOnly, noTags, onlyRCSfile, false);
00666         multiView->SwitchToPanel(2);
00667         DoDataExchange_LogFilters(theDialog, hasDate, hasStates, hasRev, hasUsers,
00668         sLastDate, sLastRev, sLastUsers, sLastStates, false);
00669         multiView->SwitchToPanel(3);
00670         DoDataExchange_Globals(theDialog, false);
00671         userHitOK = true;
00672     }
00673 #endif /* qMacCvsPP */
00674 #if qUnix
00675     void *wid = UCreate_LogDlg();
00676
00677     UCvsLog *dlg = new UCvsLog();
00678     UCvsLog_MAIN *tab1 = new UCvsLog_MAIN();
00679     UCvsLog_FILTERS *tab2 = new UCvsLog_FILTERS(sLastDate, sLastRev, sLastUsers, sLastStates);
00680     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00681     dlg->AddPage(tab1, UCvsLog::kTabGeneral, 0);
00682     dlg->AddPage(tab2, UCvsLog::kTabGeneral, 1);
00683
00684     if(dlg->DoModal())
00685     {
00686         noRecurs = tab1->m_norecurs;
00687         defBranch = tab1->m_defbranch;
00688         headerOnly = tab1->m_nousers;
00689         noTags = tab1->m_notags;
00690         onlyRCSfile = tab1->m_onlyrcs;
00691
00692         sLastDate = tab2->m_date;
00693         sLastRev = tab2->m_rev;
00694         sLastUsers = tab2->m_user;
00695         sLastStates = tab2->m_state;
00696
00697         hasRev = tab2->m_hasrev;
00698         hasUsers = tab2->m_hasuser;
00699         hasDate = tab2->m_hasdate;
00700         hasStates = tab2->m_hasstate;
00701
00702         userHitOK = true;
00703     }
00704
00705     delete dlg;
00706 #endif // qUnix
00707
00708     if(userHitOK)
00709     {
00710         if(hasDate && !sLastDate.empty())
00711             date = sLastDate;
00712         if(hasRev)
00713             rev = sLastRev;
00714         if(hasUsers)
00715             users = sLastUsers;
00716         if(hasStates && !sLastStates.empty())
00717             states = sLastStates;
00718
00719         gCvsPrefs.save();
00720     }
00721
00722     return userHitOK;
00723 }

CMString gLogDateNames | ( | 10 | ,
 |  | "P_LogDateNames" | ,
 |  | sDefLogDateNames |
 | ) | [static]

CMString gLogRevNames | ( | 10 | ,
 |  | "P_LogTagNames" | ,
 |  | sDefLogTagNames |
 | ) | [static]

CMString gLogStateNames | ( | 10 | ,
 |  | "P_LogStateNames" | ,
 |  | sDefLogStateNames |
 | ) | [static]

CMString gLogUserNames | ( | 10 | ,
 |  | "P_LogUserNames" | ,
 |  | sDefLogUserNames |
 | ) | [static]

Variable Documentation

char* sDefLogDateNames[]

Initial value:

{
    ">1998-3-24",
    "<1998-1-24",
    "1998-1-24<1998-3-24",
    "<=3-24",
    0L
}

Definition at line 70 of file LogDlg.cpp.

char* sDefLogStateNames[]

Initial value:

{
    "mystate",
    "dead",
    "exp",
    "mystate,mystate2",
    0L
}

Definition at line 79 of file LogDlg.cpp.

char* sDefLogTagNames[]

Initial value:

{
    "1.32:1.35",
    "1.32:",
    ":1.35",
    "branch-release1-0",
    "HEAD",
    0L
}

Definition at line 60 of file LogDlg.cpp.

char* sDefLogUserNames[]

Initial value:

{
    "johna",
    "garyb",
    "johna,garyb",
    0L
}

Definition at line 88 of file LogDlg.cpp.

Generated on Sun Oct 21 12:42:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LogDlg.h File Reference

common/LogDlg.h File Reference

#include "CPStr.h"

Include dependency graph for LogDlg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_LOGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Functions

bool | CompatGetLog (bool &noRecurs, bool &defBranch, UPStr &date, bool &headerOnly, bool &noTags, bool &onlyRCSfile, bool &hasRev, UPStr &rev, UPStr &states, bool &hasUser, UPStr &users, bool outGraph=false)

Define Documentation

#define AFX_LOGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file LogDlg.h.

Function Documentation

bool CompatGetLog | ( | bool & | noRecurs,
 |  | bool & | defBranch,
 |  | UPStr & | date,
 |  | bool & | headerOnly,
 |  | bool & | noTags,
 |  | bool & | onlyRCSfile,
 |  | bool & | hasRev,
 |  | UPStr & | rev,
 |  | UPStr & | states,
 |  | bool & | hasUser,
 |  | UPStr & | users,
 |  | bool | outGraph = false
 | ) |

Definition at line 564 of file LogDlg.cpp.

Referenced by CvsCmdLogFiles(), and CvsCmdLogFolder().

00568 {
00569     bool userHitOK = false;
00570
00571     static CPStr sLastDate;
00572     static CPStr sLastRev;
00573     static CPStr sLastUsers;
00574     static CPStr sLastStates;
00575
00576     bool hasDate = false;
00577     bool hasStates = false;
00578
00579     hasRev = false;
00580     hasUsers = false;
00581     date = "";
00582     rev = "";
00583     states = "";
00584     users = "";
00585     noRecurs = false;
00586     defBranch = false;
00587     headerOnly = false;
00588     noTags = false;
00589     onlyRCSfile = false;
00590
00591 #ifdef WIN32
00592     COptionalPropertySheet pages(outGraph ? gCvsPrefs.HideCommandDlgGraph() : gCvsPrefs.HideCommandDlgLog(),
00593         outGraph ? "Graph settings" : "Log settings");
00594     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00595     CLogMain page1;
00596     CLogFilters page2(sLastDate, sLastRev, sLastUsers, sLastStates);
00597     CGetPrefs_GLOBALS page3;
00598     pages.AddPage(&page1);
00599     pages.AddPage(&page2);
00600     pages.AddPage(&page3);
00601     if(pages.DoModal() == IDOK)
00602     {
00603         noRecurs = page1.m_norecurs == TRUE;
00604         defBranch = page1.m_defbranch == TRUE;
00605         headerOnly = page1.m_nousers == TRUE;
00606         noTags = page1.m_notags == TRUE;
00607         onlyRCSfile = page1.m_onlyrcs == TRUE;
00608
00609         sLastDate = page2.m_date;
00610         sLastRev = page2.m_rev;
00611         sLastUsers = page2.m_user;
00612         sLastStates = page2.m_state;
00613
00614         hasRev = page2.m_hasrev == TRUE;
00615         hasUsers = page2.m_hasuser == TRUE;
00616         hasDate = page2.m_hasdate == TRUE;
00617         hasStates = page2.m_hasstate == TRUE;
00618
00619         page3.StoreValues();
00620         if( outGraph )
00621         {
00622             gCvsPrefs.SetHideCommandDlgGraph(pages.GetHideCommandDlg());
00623         }
00624         else
00625         {
00626             gCvsPrefs.SetHideCommandDlgLog(pages.GetHideCommandDlg());
00627         }
00628         userHitOK = true;
00629     }
00630 #endif /* WIN32 */
00631 #ifdef qMacCvsPP
00632     StDialogHandler theHandler(dlg_Log, LCommander::GetTopCommander());
00633     LWindow *theDialog = theHandler.GetDialog();
00634     ThrowIfNil_(theDialog);
00635     static UInt16 sRuntimePanel = 1;
00636
00637     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00638         (theDialog->FindPaneByID(item_MultiViewPrefs));
00639     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00640
00641     multiView->SwitchToPanel(3);
00642     DoDataExchange_Globals(theDialog, true);
00643     multiView->SwitchToPanel(2);
00644     DoDataExchange_LogFilters(theDialog, hasDate, hasStates, hasRev, hasUsers,
00645         sLastDate, sLastRev, sLastUsers, sLastStates, true);
00646     multiView->SwitchToPanel(1);
00647     DoDataExchange_LogSettings(theDialog, noRecurs, defBranch, headerOnly, noTags, onlyRCSfile, true);
00648
00649     groupView->SetValue(sRuntimePanel);
00650     theDialog->Show();
00651     MessageT hitMessage;
00652     while (true)
00653     {       // Let DialogHandler process events
00654         hitMessage = theHandler.DoDialog();
00655
00656         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00657             break;
00658     }
00659     theDialog->Hide();
00660     sRuntimePanel = groupView->GetValue();
00661
00662     if(hitMessage == msg_OK)
00663     {
00664         multiView->SwitchToPanel(1);
00665         DoDataExchange_LogSettings(theDialog, noRecurs, defBranch, headerOnly, noTags, onlyRCSfile, false);
00666         multiView->SwitchToPanel(2);
00667         DoDataExchange_LogFilters(theDialog, hasDate, hasStates, hasRev, hasUsers,
00668         sLastDate, sLastRev, sLastUsers, sLastStates, false);
00669         multiView->SwitchToPanel(3);
00670         DoDataExchange_Globals(theDialog, false);
00671         userHitOK = true;
00672     }
00673 #endif /* qMacCvsPP */
00674 #if qUnix
00675     void *wid = UCreate_LogDlg();
00676
00677     UCvsLog *dlg = new UCvsLog();
00678     UCvsLog_MAIN *tab1 = new UCvsLog_MAIN();
00679     UCvsLog_FILTERS *tab2 = new UCvsLog_FILTERS(sLastDate, sLastRev, sLastUsers, sLastStates);
00680     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00681     dlg->AddPage(tab1, UCvsLog::kTabGeneral, 0);
00682     dlg->AddPage(tab2, UCvsLog::kTabGeneral, 1);
00683
00684     if(dlg->DoModal())
00685     {
00686         noRecurs = tab1->m_norecurs;
00687         defBranch = tab1->m_defbranch;
00688         headerOnly = tab1->m_nousers;
00689         noTags = tab1->m_notags;
00690         onlyRCSfile = tab1->m_onlyrcs;
00691
00692         sLastDate = tab2->m_date;
00693         sLastRev = tab2->m_rev;
00694         sLastUsers = tab2->m_user;
00695         sLastStates = tab2->m_state;
00696
00697         hasRev = tab2->m_hasrev;
00698         hasUsers = tab2->m_hasuser;
00699         hasDate = tab2->m_hasdate;
00700         hasStates = tab2->m_hasstate;
00701
00702         userHitOK = true;
00703     }
00704
00705     delete dlg;
00706 #endif // qUnix
00707
00708     if(userHitOK)
00709     {
00710         if(hasDate && !sLastDate.empty())
00711             date = sLastDate;
00712         if(hasRev)
00713             rev = sLastRev;
00714         if(hasUsers)
00715             users = sLastUsers;
00716         if(hasStates && !sLastStates.empty())
00717             states = sLastStates;
00718
00719         gCvsPrefs.save();
00720     }
00721
00722     return userHitOK;
00723 }

Generated on Sun Oct 21 12:42:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LogParse.cpp File Reference

common/LogParse.cpp File Reference

#include "stdafx.h"
#include <errno.h>
#include <stdio.h>
#include "LogParse.h"
#include "CvsArgs.h"
#include "CvsLog.h"
#include "AppGlue.h"
#include "AppConsole.h"
#include "CPStr.h"
#include "getline.h"

Include dependency graph for LogParse.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void | print (CColorConsole &out, const CRevFile &rev)
void | print (CColorConsole &out, const CRcsFile &rcs, bool recurse=true)
void | print (CColorConsole &out, const CLogNode *node, UStr &offset)
void | CvsLogOutput (CColorConsole &out, CLogNode *node)
void | CvsLogParse (const char *dir, const CvsArgs &args, bool outGraph, void *defWnd)

Function Documentation

void CvsLogOutput | ( | CColorConsole & | out,
 |  | CLogNode * | node
 | ) |

Definition at line 183 of file LogParse.cpp.

00184 {
00185     switch(node->GetType())
00186     {
00187         case kNodeHeader :
00188         {
00189             CRcsFile & rcs = **(CLogNodeHeader *)node;
00190             print(out, rcs, false);
00191             break;
00192         }
00193         case kNodeBranch :
00194             break;
00195         case kNodeRev :
00196         {
00197             CRevFile & rev = **(CLogNodeRev *)node;
00198             print(out, rev);
00199             break;
00200         }
00201         case kNodeTag :
00202             break;
00203     }
00204 }

void CvsLogParse | ( | const char * | dir,
 |  | const CvsArgs & | args,
 |  | bool | outGraph = false,
 |  | void * | defWnd = 0L
 | ) |

Definition at line 206 of file LogParse.cpp.

00207 {
00208     // make a stream of the cvs log output
00209     CStr tmpFile;
00210     FILE *output;
00211     output = launchCVS(dir, args, tmpFile);
00212     if(output == 0L)
00213         return;
00214
00215     // parse
00216     std::vector<CRcsFile> & allRcs = CvsLogParse(output);
00217
00218     // maybe something went wrong or may be the user
00219     // asked to print only the RCS names, so print the
00220     // output directly whithout parsing../
00221     if(allRcs.empty())
00222     {
00223         char *line = 0L;
00224         size_t line_chars_allocated = 0;
00225         int line_length;
00226         fseek(output, SEEK_SET, 0);
00227         while ((line_length = getline (&line, &line_chars_allocated, output)) > 0)
00228         {
00229             cvs_outstr(line, line_length);
00230             cvs_outstr("\n", 1);
00231         }
00232
00233         if (line_length < 0 && !feof (output))
00234             cvs_err("Cannot read output file (error %d)\n", errno);
00235
00236         if(line != 0L)
00237             free (line);
00238     }
00239
00240     // close the temp file
00241     fclose(output);
00242     if(unlink(tmpFile) != 0)
00243     {
00244         cvs_err("Impossible to delete the file '%s' (error %d)",
00245             (const char *)tmpFile, errno);
00246     }
00247
00248     if(allRcs.empty())
00249         return;
00250
00251     // output the result
00252     CColorConsole out;
00253     std::vector<CRcsFile>::iterator i;
00254     for(i = allRcs.begin(); i != allRcs.end(); ++i)
00255     {
00256         CRcsFile & rcs = *i;
00257         if(!outGraph)
00258             print(out, rcs);
00259         else
00260         {
00261             CLogNode *node = CvsLogGraph(rcs);
00262             if(node == 0L)
00263             {
00264                 cvs_err("Impossible to create a graph for %s\n",
00265                     (const char *)rcs.WorkingFile());
00266             }
00267
00268 #ifdef WIN32
00269             CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00270             CGraphDoc *doc;
00271             if(defWnd != 0L)
00272                 doc = (CGraphDoc *)defWnd;
00273             else
00274                 doc = (CGraphDoc*)app->gLogGraph->OpenDocumentFile(NULL);
00275             doc->SetNode(node, dir);
00276 #elif qMacCvsPP
00277             if(defWnd != 0L)
00278                 ((CTreeView *)defWnd)->SetNode(node, dir);
00279             else
00280                 CMacCvsApp::app->NewLogTree(node, dir);
00281 #elif qUnix
00282             UCvsGraph * graph = new UCvsGraph(node, dir);
00283             void *win = UCreate_GraphWindow();
00284             UEventSendMessage(graph->GetWidID(), EV_INIT_WIDGET, kUMainWidget, win);
00285             UEventSendMessage(graph->GetWidID(), EV_SHOW_WIDGET, UMAKEINT(kUMainWidget, 1), 0L);
00286 #else
00287             CStr offset;
00288             print(out, node, offset);
00289             delete node;
00290 #endif
00291         }
00292     }
00293
00294     // reset the parser
00295     CvsLogReset();
00296 }

void print | ( | CColorConsole & | out,
 |  | const CLogNode * | node,
 |  | UStr & | offset
 | ) | [static]

Definition at line 144 of file LogParse.cpp.

Referenced by CvsLogOutput(), CvsLogParse(), and print().

00145 {
00146     out << offset;
00147     switch(node->GetType())
00148     {
00149         case kNodeHeader :
00150         {
00151             CLogNodeHeader *header = (CLogNodeHeader *)node;
00152             out << offset << "Rcs file : '" << kRed << (**header).RcsFile() << kNormal << '\'' << kNL;
00153             break;
00154         }
00155         case kNodeBranch :
00156             break;
00157         case kNodeRev :
00158         {
00159             CLogNodeRev *rev = (CLogNodeRev *)node;
00160             out << offset << kBold << (**rev).RevNum().c_str() << kNormal << kNL;
00161             break;
00162         }
00163         case kNodeTag :
00164             break;
00165     }
00166
00167     CStr newOffset;
00168     newOffset = offset;
00169     newOffset << "    ";
00170     std::vector<CLogNode *>::const_iterator i;
00171     for(i = node->Childs().begin(); i != node->Childs().end(); ++i)
00172     {
00173         print(out, *i, newOffset);
00174         newOffset << ' ';
00175     }
00176
00177     if(node->Next() != 0L)
00178     {
00179         print(out, node->Next(), offset);
00180     }
00181 }

void print | ( | CColorConsole & | out,
 |  | const CRcsFile & | rcs,
 |  | bool | recurse = true
 | ) | [static]

Definition at line 97 of file LogParse.cpp.

00098 {
00099     out << "Rcs file : '" << kRed << rcs.RcsFile() << kNormal << '\'' << kNL;
00100     out << "Working file : '" << kBold << rcs.WorkingFile() << kNormal << '\'' << kNL;
00101     out << "Head revision : " << kBold << kRed << rcs.HeadRev().c_str() << kNormal << kNL;
00102     out << "Branch revision : " << kBold << rcs.BranchRev().c_str() << kNormal << kNL;
00103
00104     out << "Locks :" << kBold << (rcs.LockStrict() ? " strict" : "") << kNormal << kNL;
00105     std::vector<CRevNumber>::const_iterator s;
00106     for(s = rcs.LocksList().begin(); s != rcs.LocksList().end(); ++s)
00107     {
00108         const CRevNumber & lock = *s;
00109         out << '\t' << kBold << lock.c_str() << " : '" << lock.Tag() << '\'' << kNormal << kNL;
00110     }
00111
00112     out << "Access :" << kNL;
00113     std::vector<CLogStr>::const_iterator a;
00114     for(a = rcs.AccessList().begin(); a != rcs.AccessList().end(); ++a)
00115     {
00116         out << "\t'" << kBold << *a << kNormal << '\'' << kNL;
00117     }
00118
00119     if(!rcs.SymbolicList().empty())
00120     {
00121         out << "Symbolic names :" << kNL;
00122         std::vector<CRevNumber>::const_iterator n;
00123         for(n = rcs.SymbolicList().begin(); n != rcs.SymbolicList().end(); ++n)
00124         {
00125             const CRevNumber & symb = *n;
00126             out << '\t' << kBold << symb.c_str() << " : '" << symb.Tag() << '\'' << kNormal << kNL;
00127         }
00128     }
00129
00130     out << "Keyword substitution : '" << kBold << rcs.KeywordSubst() << kNormal << '\'' << kNL;
00131     out << "Total revisions : " << kBold << rcs.TotRevisions() << kNormal << kNL;
00132     out << "Selected revisions : " << kBold << rcs.SelRevisions() << kNormal << kNL;
00133     out << "Description :" << kNL << kBrown << rcs.DescLog() << kNormal << kNL;
00134
00135     std::vector<CRevFile>::const_iterator i;
00136     if(recurse) for(i = rcs.AllRevs().begin(); i != rcs.AllRevs().end(); ++i)
00137     {
00138         print(out, *i);
00139     }
00140
00141     out << kGreen << "===============================================" << kNormal << kNL;
00142 }

void print | ( | CColorConsole & | out,
 |  | const CRevFile & | rev
 | ) | [static]

Definition at line 66 of file LogParse.cpp.

00067 {
00068     out << kBlue << "----------------------------" << kNormal << kNL;
00069     out << "Revision : " << kBold << kRed << rev.RevNum().c_str() << kNormal << kNL;
00070     if(!rev.Locker().empty())
00071         out << "Locked by : '" << kBold << rev.Locker() << kNormal << '\'' << kNL;
00072     out << "Date : " << kBold <<
00073         (rev.RevTime().tm_year + 1900) << '/' <<
00074         rev.RevTime().tm_mon << '/' <<
00075         rev.RevTime().tm_mday << ' ' <<
00076         rev.RevTime().tm_hour << ':' <<
00077         rev.RevTime().tm_min << ':' <<
00078         rev.RevTime().tm_sec << kNormal << kNL;
00079     out << "Author : '" << kBold << rev.Author() << kNormal << '\'' << kNL;
00080     out << "State : '" << kBold << rev.State() << kNormal << '\'' << kNL;
00081     out << "Lines : +" << kBold << rev.ChgPos() << ' ' << rev.ChgNeg() << kNormal << kNL;
00082
00083     if(!rev.BranchesList().empty())
00084     {
00085         out << "Branches :" << kNL;
00086         std::vector<CRevNumber>::const_iterator s;
00087         for(s = rev.BranchesList().begin(); s != rev.BranchesList().end(); ++s)
00088         {
00089             const CRevNumber & branch = *s;
00090             out << '\t' << kBold << branch.c_str() << kNormal << kNL;
00091         }
00092     }
00093
00094     out << "Description :" << kNL << kBrown << rev.DescLog() << kNormal << kNL;
00095 }

Generated on Sun Oct 21 12:42:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LogParse.h File Reference

common/LogParse.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_LOGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Functions

void | CvsLogParse (const char *dir, const CvsArgs &args, bool outGraph=false, void *defWnd=0L)
void | CvsLogOutput (CColorConsole &out, CLogNode *node)

Define Documentation

#define AFX_LOGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file LogParse.h.

Function Documentation

void CvsLogOutput | ( | CColorConsole & | out,
 |  | CLogNode * | node
 | ) |

Definition at line 183 of file LogParse.cpp.

Referenced by CGraphView::OnLButtonDown().

00184 {
00185     switch(node->GetType())
00186     {
00187         case kNodeHeader :
00188         {
00189             CRcsFile & rcs = **(CLogNodeHeader *)node;
00190             print(out, rcs, false);
00191             break;
00192         }
00193         case kNodeBranch :
00194             break;
00195         case kNodeRev :
00196         {
00197             CRevFile & rev = **(CLogNodeRev *)node;
00198             print(out, rev);
00199             break;
00200         }
00201         case kNodeTag :
00202             break;
00203     }
00204 }

void CvsLogParse | ( | const char * | dir,
 |  | const CvsArgs & | args,
 |  | bool | outGraph = false,
 |  | void * | defWnd = 0L
 | ) |

Generated on Sun Oct 21 12:42:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MacBinEncoding.cpp File Reference

common/MacBinEncoding.cpp File Reference

#include <stdlib.h>
#include <UModalDialogs.h>
#include <LTableMultiGeometry.h>
#include <LOutlineKeySelector.h>
#include <LTableSingleSelector.h>
#include <LOutlineRowSelector.h>
#include <UAttachments.h>
#include <UGAColorRamp.h>
#include <LEditText.h>
#include "MacCvsConstant.h"
#include "MacBinEncoding.h"

Include dependency graph for MacBinEncoding.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:42:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MacBinEncoding.h File Reference

common/MacBinEncoding.h File Reference

#include <LOutlineTable.h>
#include <LCommander.h>
#include <LOutlineItem.h>
#include <LString.h>
#include "MacBinMaps.h"

Include dependency graph for MacBinEncoding.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CMacBinItem
class | CMacBinTable

Generated on Sun Oct 21 12:42:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MacBinMaps.cpp File Reference

common/MacBinMaps.cpp File Reference

#include <stdlib.h>
#include <Resources.h>
#include <TextUtils.h>
#include "MacBinMaps.h"
#include "Persistent.h"

Include dependency graph for MacBinMaps.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | PMacBinMaps

Variables

const OSType | kTypesListResType = 'bin#'
const short | kTypesListResID = 128
const short | kTypesDescResID = 128
PMacBinMaps P_MacBinMaps

Variable Documentation

PMacBinMaps P_MacBinMaps

const short kTypesDescResID = 128 [static]

Definition at line 34 of file MacBinMaps.cpp.

const short kTypesListResID = 128 [static]

Definition at line 33 of file MacBinMaps.cpp.

const OSType kTypesListResType = 'bin#' [static]

Definition at line 32 of file MacBinMaps.cpp.

Generated on Sun Oct 21 12:42:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MacBinMaps.h File Reference

common/MacBinMaps.h File Reference

#include "CvsPrefs.h"

Include dependency graph for MacBinMaps.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | MACBINMAP
struct | MACBINMAPENTRIES
class | MacBinMaps

Defines

#define | MAX_MACBIN_DESC 63

Define Documentation

#define MAX_MACBIN_DESC 63

Definition at line 32 of file MacBinMaps.h.

Generated on Sun Oct 21 12:42:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MacMisc.cpp File Reference

common/MacMisc.cpp File Reference

#include "MacMisc.h"

Include dependency graph for MacMisc.cpp:

Include dependency graph

Go to the source code of this file.

Functions

Handle | GetDItemHdl (DialogPtr dlg, SInt16 Id)
ControlHandle | GetDItemCtrlHdl (DialogPtr dlg, SInt16 Id)
SInt16 | GetDItemMenuSel (DialogPtr dlg, SInt16 Id)
void | SetDItemMenuSel (DialogPtr dlg, SInt16 Id, SInt16 sel)
pascal OSErr | FSMakeFSSpecCompat (short vRefNum, long dirID, ConstStr255Param fileName, FSSpec &spec)
int | stricmp (const char *str1, const char *str2)
int | strnicmp (const char *str1, const char *str2, unsigned long n)

Function Documentation

pascal OSErr FSMakeFSSpecCompat | ( | short | vRefNum,
 |  | long | dirID,
 |  | ConstStr255Param | fileName,
 |  | FSSpec & | spec
 | ) |

Definition at line 62 of file MacMisc.cpp.

00066 {
00067     OSErr   result;
00068
00069     /* Let the file system create the FSSpec if it can since it does the job */
00070     /* much more efficiently than I can. */
00071     result = FSMakeFSSpec(vRefNum, dirID, fileName, &spec);
00072     /* Fix a bug in Macintosh PC Exchange's MakeFSSpec code where 0 is */
00073     /* returned in the parID field when making an FSSpec to the volume's */
00074     /* root directory by passing a full pathname in MakeFSSpec's */
00075     /* fileName parameter. */
00076     if ( (result == noErr) && (spec.parID == 0) )
00077         spec.parID = fsRtParID;
00078
00079     return ( result );
00080 }

ControlHandle GetDItemCtrlHdl | ( | DialogPtr | dlg,
 |  | SInt16 | Id
 | ) |

Definition at line 39 of file MacMisc.cpp.

00040 {
00041     SInt16  type;
00042     Handle  item;
00043     Rect    box;
00044
00045     GetDialogItem(dlg, Id, &type, &item, &box);
00046     return (ControlHandle)item;
00047 }

Handle GetDItemHdl | ( | DialogPtr | dlg,
 |  | SInt16 | Id
 | ) |

Definition at line 28 of file MacMisc.cpp.

00029 {
00030     SInt16  type;
00031     Handle  item;
00032     Rect    box;
00033
00034     GetDialogItem(dlg, Id, &type, &item, &box);
00035     return item;
00036 }

SInt16 GetDItemMenuSel | ( | DialogPtr | dlg,
 |  | SInt16 | Id
 | ) |

Definition at line 49 of file MacMisc.cpp.

00050 {
00051     ControlHandle ctrl = GetDItemCtrlHdl(dlg, Id);
00052     return ctrl != 0L ? GetControlValue(ctrl) : 0;
00053 }

void SetDItemMenuSel | ( | DialogPtr | dlg,
 |  | SInt16 | Id,
 |  | SInt16 | sel
 | ) |

Definition at line 55 of file MacMisc.cpp.

00056 {
00057     ControlHandle ctrl = GetDItemCtrlHdl(dlg, Id);
00058     if(ctrl != 0L)
00059         SetControlValue(ctrl, sel);
00060 }

int stricmp | ( | const char * | str1,
 |  | const char * | str2
 | ) |

Definition at line 82 of file MacMisc.cpp.

00083 {
00084     unsigned char c1, c2;
00085
00086     while(1)
00087     {
00088         c1 = (unsigned char)*str1++;
00089         c2 = (unsigned char)*str2++;
00090         if(c1 == '\0' || c2 == '\0') break;
00091
00092         if((c1 < 'A' || c1 > 'Z') && (c1 < 'a' || c1 > 'z'))
00093         {
00094             if(c1 != c2) break;
00095         }
00096         else if((c2 < 'A' || c2 > 'Z') && (c2 < 'a' || c2 > 'z'))
00097             break;
00098         else
00099         {
00100             c1 &= 0xDF;
00101             c2 &= 0xDF;
00102             if(c1 != c2)
00103                 break;
00104         }
00105     }
00106
00107     return c1 == c2 ? 0 : (c1 < c2 ? -1 : 1);
00108 }

int strnicmp | ( | const char * | str1,
 |  | const char * | str2,
 |  | unsigned long | size
 | ) |

Definition at line 110 of file MacMisc.cpp.

00111 {
00112     unsigned char c1 = 0, c2 = 0;
00113
00114     while(n--)
00115     {
00116         c1 = (unsigned char)*str1++;
00117         c2 = (unsigned char)*str2++;
00118         if(c1 == '\0' || c2 == '\0') break;
00119
00120         if((c1 < 'A' || c1 > 'Z') && (c1 < 'a' || c1 > 'z'))
00121         {
00122             if(c1 != c2) break;
00123         }
00124         else if((c2 < 'A' || c2 > 'Z') && (c2 < 'a' || c2 > 'z'))
00125             break;
00126         else
00127         {
00128             c1 &= 0xDF;
00129             c2 &= 0xDF;
00130             if(c1 != c2)
00131                 break;
00132         }
00133     }
00134
00135     return c1 == c2 ? 0 : (c1 < c2 ? -1 : 1);
00136 }

Generated on Sun Oct 21 12:42:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MacMisc.h File Reference

common/MacMisc.h File Reference

#include <Dialogs.h>

Include dependency graph for MacMisc.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

Handle | GetDItemHdl (DialogPtr dlg, SInt16 Id)
ControlHandle | GetDItemCtrlHdl (DialogPtr dlg, SInt16 Id)
SInt16 | GetDItemMenuSel (DialogPtr dlg, SInt16 Id)
void | SetDItemMenuSel (DialogPtr dlg, SInt16 Id, SInt16 sel)
pascal OSErr | FSMakeFSSpecCompat (short vRefNum, long dirID, ConstStr255Param fileName, FSSpec &spec)
int | stricmp (const char *str1, const char *str2)
int | strnicmp (const char *str1, const char *str2, unsigned long size)

Function Documentation

pascal OSErr FSMakeFSSpecCompat | ( | short | vRefNum,
 |  | long | dirID,
 |  | ConstStr255Param | fileName,
 |  | FSSpec & | spec
 | ) |

Definition at line 62 of file MacMisc.cpp.

00066 {
00067     OSErr   result;
00068
00069     /* Let the file system create the FSSpec if it can since it does the job */
00070     /* much more efficiently than I can. */
00071     result = FSMakeFSSpec(vRefNum, dirID, fileName, &spec);
00072     /* Fix a bug in Macintosh PC Exchange's MakeFSSpec code where 0 is */
00073     /* returned in the parID field when making an FSSpec to the volume's */
00074     /* root directory by passing a full pathname in MakeFSSpec's */
00075     /* fileName parameter. */
00076     if ( (result == noErr) && (spec.parID == 0) )
00077         spec.parID = fsRtParID;
00078
00079     return ( result );
00080 }

ControlHandle GetDItemCtrlHdl | ( | DialogPtr | dlg,
 |  | SInt16 | Id
 | ) |

Definition at line 39 of file MacMisc.cpp.

Referenced by GetDItemMenuSel(), and SetDItemMenuSel().

00040 {
00041     SInt16  type;
00042     Handle  item;
00043     Rect    box;
00044
00045     GetDialogItem(dlg, Id, &type, &item, &box);
00046     return (ControlHandle)item;
00047 }

Handle GetDItemHdl | ( | DialogPtr | dlg,
 |  | SInt16 | Id
 | ) |

Definition at line 28 of file MacMisc.cpp.

Referenced by CompatGetValue().

00029 {
00030     SInt16  type;
00031     Handle  item;
00032     Rect    box;
00033
00034     GetDialogItem(dlg, Id, &type, &item, &box);
00035     return item;
00036 }

SInt16 GetDItemMenuSel | ( | DialogPtr | dlg,
 |  | SInt16 | Id
 | ) |

Definition at line 49 of file MacMisc.cpp.

00050 {
00051     ControlHandle ctrl = GetDItemCtrlHdl(dlg, Id);
00052     return ctrl != 0L ? GetControlValue(ctrl) : 0;
00053 }

void SetDItemMenuSel | ( | DialogPtr | dlg,
 |  | SInt16 | Id,
 |  | SInt16 | sel
 | ) |

Definition at line 55 of file MacMisc.cpp.

00056 {
00057     ControlHandle ctrl = GetDItemCtrlHdl(dlg, Id);
00058     if(ctrl != 0L)
00059         SetControlValue(ctrl, sel);
00060 }

int stricmp | ( | const char * | str1,
 |  | const char * | str2
 | ) |

Definition at line 82 of file MacMisc.cpp.

Referenced by AskCreatePersistentSettings(), EntnodeData::Compare(), KoStatusColumn::Compare(), KoPathColumn::Compare(), KoNameColumn::Compare(), ReportConflict::Match(), CHistComboBoxEx::NewRoot(), TBrowserFill::OnDirectory(), TBrowserFillDummy::OnDirectory(), TViewFill::OnDirectory(), CFillTclEntries::OnDirectory(), CFillPyEntries::OnDirectory(), ImportReport::OnDirectory(), MacroTraversal::OnFile(), CWinCvsBrowser::ResetBrowser(), UCvsFolders::ResetBrowser(), CBrowseFileView::ResetView(), UCvsFiles::Search(), KoFilterModel::SetMask(), CWinCvsBrowser::StepToLocation(), TestValidName(), WinInitWidgets(), _statcore(), compareConflict(), compareName(), compareOption(), compareRevs(), compareStatus(), compareTag(), getSettingName(), and wnt_stat().

00083 {
00084     unsigned char c1, c2;
00085
00086     while(1)
00087     {
00088         c1 = (unsigned char)*str1++;
00089         c2 = (unsigned char)*str2++;
00090         if(c1 == '\0' || c2 == '\0') break;
00091
00092         if((c1 < 'A' || c1 > 'Z') && (c1 < 'a' || c1 > 'z'))
00093         {
00094             if(c1 != c2) break;
00095         }
00096         else if((c2 < 'A' || c2 > 'Z') && (c2 < 'a' || c2 > 'z'))
00097             break;
00098         else
00099         {
00100             c1 &= 0xDF;
00101             c2 &= 0xDF;
00102             if(c1 != c2)
00103                 break;
00104         }
00105     }
00106
00107     return c1 == c2 ? 0 : (c1 < c2 ? -1 : 1);
00108 }

int strnicmp | ( | const char * | str1,
 |  | const char * | str2,
 |  | unsigned long | size
 | ) |

Definition at line 110 of file MacMisc.cpp.

Referenced by MacroTraversal::OnFile(), CWinCvsBrowser::StepToLocation(), and CFindSettings::searchPath().

00111 {
00112     unsigned char c1 = 0, c2 = 0;
00113
00114     while(n--)
00115     {
00116         c1 = (unsigned char)*str1++;
00117         c2 = (unsigned char)*str2++;
00118         if(c1 == '\0' || c2 == '\0') break;
00119
00120         if((c1 < 'A' || c1 > 'Z') && (c1 < 'a' || c1 > 'z'))
00121         {
00122             if(c1 != c2) break;
00123         }
00124         else if((c2 < 'A' || c2 > 'Z') && (c2 < 'a' || c2 > 'z'))
00125             break;
00126         else
00127         {
00128             c1 &= 0xDF;
00129             c2 &= 0xDF;
00130             if(c1 != c2)
00131                 break;
00132         }
00133     }
00134
00135     return c1 == c2 ? 0 : (c1 < c2 ? -1 : 1);
00136 }

Generated on Sun Oct 21 12:42:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MacrosSetup.cpp File Reference

common/MacrosSetup.cpp File Reference

#include "stdafx.h"
#include <ctype.h>
#include "MacrosSetup.h"
#include "AppConsole.h"
#include "FileTraversal.h"
#include "getline.h"
#include "CvsArgs.h"
#include "getopt.h"

Include dependency graph for MacrosSetup.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | MacroTraversal

Functions

void | getLoc (UStr &path, const char *subFolder)
void | MacrosGetLoc (UStr &path)
void | PythonLibGetLoc (UStr &path)
void | MacrosFlushAll (void)
void | MacrosReloadAll (void)

Variables

CMacroSet gMacrosAdmin
CMacroSet gMacrosSel

Function Documentation

void MacrosFlushAll ( void ) [static]

Definition at line 171 of file MacrosSetup.cpp.

Referenced by MacrosReloadAll().

00172 {
00173     gMacrosAdmin.Flush();
00174     gMacrosSel.Flush();
00175 }

void MacrosGetLoc ( UStr & path )

Definition at line 161 of file MacrosSetup.cpp.

00162 {
00163     getLoc(path, MACROS_FOLDER);
00164 }

void MacrosReloadAll ( void )

Definition at line 317 of file MacrosSetup.cpp.

Referenced by UCvsApp::UCvsApp().

00318 {
00319     MacrosFlushAll();
00320
00321     // get the macro folder
00322     CStr path;
00323     MacrosGetLoc(path);
00324
00325     // traverse the macro folder
00326     MacroTraversal traverse;
00327     FileTraverse(path, traverse);
00328 }

void PythonLibGetLoc ( UStr & path )

Definition at line 166 of file MacrosSetup.cpp.

00167 {
00168     getLoc(path, PYTHONLIB_FOLDER);
00169 }

void getLoc | ( | UStr & | path,
 |  | const char * | subFolder
 | ) | [static]

Definition at line 72 of file MacrosSetup.cpp.

Referenced by MacrosGetLoc(), and PythonLibGetLoc().

00073 {
00074     path = "";
00075 #ifdef WIN32
00076     CWincvsApp* pApp = (CWincvsApp *)AfxGetApp();
00077     pApp->GetAppPath(path);
00078
00079     CString appPath = path;
00080     // first the macro folder may be ./macro
00081     CString test = appPath;
00082     test.TrimRight('\\');
00083     test += "\\";
00084     test += subFolder;
00085
00086     struct stat sb;
00087     if(stat(test, &sb) != -1 && S_ISDIR(sb.st_mode))
00088     {
00089         path = test;
00090         return;
00091     }
00092
00093     CStr uppath, file;
00094     while(SplitPath(appPath, uppath, file) && !uppath.empty())
00095     {
00096         test = uppath;
00097         test.TrimRight('\\');
00098         test += "\\";
00099         test += subFolder;
00100
00101         if(stat(test, &sb) != -1 && S_ISDIR(sb.st_mode))
00102         {
00103             path = test;
00104             return;
00105         }
00106         appPath = uppath;
00107     }
00108     path = test;
00109 #elif defined(qUnix)
00110     struct stat sb;
00111     path = PACKAGE_DATA_DIR;
00112     if(stat(path, &sb) == -1 || !S_ISDIR(sb.st_mode))
00113     {
00114         path = PACKAGE_SOURCE_DIR;
00115         CStr uppath, folder;
00116         SplitPath(path, uppath, folder);
00117         path = uppath;
00118         if(!path.endsWith(kPathDelimiter))
00119             path << kPathDelimiter;
00120         path << subFolder;
00121     }
00122 #elif qMacCvsPP
00123     UStr appPath = CMacCvsApp::GetAppPath();
00124     if(!appPath.endsWith(kPathDelimiter))
00125         appPath << kPathDelimiter;
00126     UStr test = appPath;
00127     test << subFolder;
00128
00129     struct stat sb;
00130     if(stat(test, &sb) != -1 && S_ISDIR(sb.st_mode))
00131     {
00132         path = test;
00133         return;
00134     }
00135
00136     UStr uppath, file;
00137     while(SplitPath(appPath, uppath, file) && !uppath.empty())
00138     {
00139         test = uppath;
00140         if(!test.endsWith(kPathDelimiter))
00141             test << kPathDelimiter;
00142         test << subFolder;
00143
00144         if(stat(test, &sb) != -1 && S_ISDIR(sb.st_mode))
00145         {
00146             path = test;
00147             return;
00148         }
00149         appPath = uppath;
00150     }
00151     path = test;
00152 #else
00153     if(!path.empty() && !path.endsWith(kPathDelimiter))
00154     {
00155         path << kPathDelimiter;
00156     }
00157     path << subFolder;
00158 #endif
00159 }

Variable Documentation

CMacroSet gMacrosAdmin

Definition at line 69 of file MacrosSetup.cpp.

CMacroSet gMacrosSel

Definition at line 70 of file MacrosSetup.cpp.

Generated on Sun Oct 21 12:42:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MacrosSetup.h File Reference

common/MacrosSetup.h File Reference

#include <vector>
#include "CPStr.h"

Include dependency graph for MacrosSetup.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CMacroEntry
class | CMacroSet

Defines

#define | MACROS_FOLDER "Macros"
#define | PYTHONLIB_FOLDER "PythonLib"

Functions

void | MacrosReloadAll (void)
void | MacrosGetLoc (UStr &path)
void | PythonLibGetLoc (UStr &path)

Variables

CMacroSet gMacrosAdmin
CMacroSet gMacrosSel

Define Documentation

#define MACROS_FOLDER "Macros"

Definition at line 35 of file MacrosSetup.h.

#define PYTHONLIB_FOLDER "PythonLib"

Definition at line 36 of file MacrosSetup.h.

Function Documentation

void MacrosGetLoc ( UStr & path )

Definition at line 161 of file MacrosSetup.cpp.

Referenced by CTcl_Interp::CTcl_Interp(), MacrosReloadAll(), and PyMacrosReloadAll().

00162 {
00163     getLoc(path, MACROS_FOLDER);
00164 }

void MacrosReloadAll ( void )

Definition at line 317 of file MacrosSetup.cpp.

00318 {
00319     MacrosFlushAll();
00320
00321     // get the macro folder
00322     CStr path;
00323     MacrosGetLoc(path);
00324
00325     // traverse the macro folder
00326     MacroTraversal traverse;
00327     FileTraverse(path, traverse);
00328 }

void PythonLibGetLoc ( UStr & path )

Definition at line 166 of file MacrosSetup.cpp.

Referenced by InitializeInterp().

00167 {
00168     getLoc(path, PYTHONLIB_FOLDER);
00169 }

Variable Documentation

CMacroSet gMacrosAdmin

Definition at line 98 of file MacrosSetup.h.

CMacroSet gMacrosSel

Definition at line 99 of file MacrosSetup.h.

Generated on Sun Oct 21 12:42:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MakeSurePathExists.cpp File Reference

common/MakeSurePathExists.cpp File Reference

#include "stdafx.h"
#include "MakeSurePathExists.h"
#include "FileTraversal.h"

Include dependency graph for MakeSurePathExists.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool | CompatMakeSurePathExists (const char *path, bool promptForCreation)
bool | CreateFolder (const char *fn)

Function Documentation

bool CompatMakeSurePathExists | ( | const char * | path,
 |  | bool | promptForCreation = true
 | ) |

Definition at line 44 of file MakeSurePathExists.cpp.

00045 {
00046     bool valid = false;
00047
00048 #ifdef WIN32
00049     TCHAR fn[MAX_PATH];
00050     if (_tfullpath(fn, path, MAX_PATH))
00051     {
00052         struct _tstat dirstat;
00053         if (_tstat(fn, &dirstat) == 0)
00054         {
00055             if (dirstat.st_mode & _S_IFDIR)
00056             {
00057                 valid = true;
00058             }
00059         }
00060         else
00061         {
00062             // not found, ask for permission to create
00063             if( promptForCreation &&
00064                 AfxMessageBox("Folder " +
00065                 CString(path) +
00066                 " not found.\nDo you want to create it?", MB_YESNO) == IDYES )
00067             {
00068                 valid = CreateFolder(fn);
00069             }
00070         }
00071     }
00072 #endif
00073
00074     return valid;
00075 }

bool CreateFolder ( const char * fn )

Definition at line 78 of file MakeSurePathExists.cpp.

00079 {
00080 #ifdef WIN32
00081     // remove possible trailing separator
00082     TCHAR folder[MAX_PATH];
00083     _tcscpy(folder, fn);
00084     int len = _tcslen(folder);
00085     if (len > 1)
00086     {
00087         switch (folder[len - 1])
00088         {
00089         case _T('\\'):
00090         case _T('/'):
00091             folder[len - 1] = 0;
00092             break;
00093         }
00094     }
00095
00096     // try to create
00097     if (_tmkdir(folder) == 0)
00098     {
00099         return true;
00100     }
00101
00102     // if path does not exist, create parent folder and then try again
00103     if (errno == ENOENT)
00104     {
00105         TCHAR drive[_MAX_DRIVE];
00106         TCHAR dir[_MAX_PATH];
00107         TCHAR fname[_MAX_PATH];
00108         _tsplitpath(folder, drive, dir, fname, NULL);
00109         if (!*fname)
00110         {
00111             return false;
00112         }
00113         _tmakepath(fname, drive, dir, NULL, NULL);
00114         if (!CreateFolder(fname))
00115         {
00116             return false;
00117         }
00118
00119         return _tmkdir(folder) == 0;
00120     }
00121 #endif
00122     // not possible to create
00123     return false;
00124 }

Generated on Sun Oct 21 12:42:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MakeSurePathExists.h File Reference

common/MakeSurePathExists.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

bool | CreateFolder (const char *fn)
bool | CompatMakeSurePathExists (const char *path, bool promptForCreation=true)

Function Documentation

bool CompatMakeSurePathExists | ( | const char * | path,
 |  | bool | promptForCreation = true
 | ) |

Definition at line 44 of file MakeSurePathExists.cpp.

00045 {
00046     bool valid = false;
00047
00048 #ifdef WIN32
00049     TCHAR fn[MAX_PATH];
00050     if (_tfullpath(fn, path, MAX_PATH))
00051     {
00052         struct _tstat dirstat;
00053         if (_tstat(fn, &dirstat) == 0)
00054         {
00055             if (dirstat.st_mode & _S_IFDIR)
00056             {
00057                 valid = true;
00058             }
00059         }
00060         else
00061         {
00062             // not found, ask for permission to create
00063             if( promptForCreation &&
00064                 AfxMessageBox("Folder " +
00065                 CString(path) +
00066                 " not found.\nDo you want to create it?", MB_YESNO) == IDYES )
00067             {
00068                 valid = CreateFolder(fn);
00069             }
00070         }
00071     }
00072 #endif
00073
00074     return valid;
00075 }

bool CreateFolder ( const char * fn )

Definition at line 78 of file MakeSurePathExists.cpp.

Referenced by CompatMakeSurePathExists().

00079 {
00080 #ifdef WIN32
00081     // remove possible trailing separator
00082     TCHAR folder[MAX_PATH];
00083     _tcscpy(folder, fn);
00084     int len = _tcslen(folder);
00085     if (len > 1)
00086     {
00087         switch (folder[len - 1])
00088         {
00089         case _T('\\'):
00090         case _T('/'):
00091             folder[len - 1] = 0;
00092             break;
00093         }
00094     }
00095
00096     // try to create
00097     if (_tmkdir(folder) == 0)
00098     {
00099         return true;
00100     }
00101
00102     // if path does not exist, create parent folder and then try again
00103     if (errno == ENOENT)
00104     {
00105         TCHAR drive[_MAX_DRIVE];
00106         TCHAR dir[_MAX_PATH];
00107         TCHAR fname[_MAX_PATH];
00108         _tsplitpath(folder, drive, dir, fname, NULL);
00109         if (!*fname)
00110         {
00111             return false;
00112         }
00113         _tmakepath(fname, drive, dir, NULL, NULL);
00114         if (!CreateFolder(fname))
00115         {
00116             return false;
00117         }
00118
00119         return _tmkdir(folder) == 0;
00120     }
00121 #endif
00122     // not possible to create
00123     return false;
00124 }

Generated on Sun Oct 21 12:42:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MoveToTrash.cpp File Reference

common/MoveToTrash.cpp File Reference

#include "stdafx.h"
#include "MoveToTrash.h"
#include "CPStr.h"
#include "FileTraversal.h"
#include "AppConsole.h"

Include dependency graph for MoveToTrash.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void | CompatBeginMoveToTrash (void)
void | CompatEndMoveToTrash (void)
bool | CompatMoveToTrash (const char *file, const char *dir, const FSSpec *spec)

Function Documentation

void CompatBeginMoveToTrash ( void )

Definition at line 275 of file MoveToTrash.cpp.

Referenced by CvsCmdRemoveFiles().

00276 {
00277 #ifdef macintosh
00278     sToTrash.erase(sToTrash.begin(), sToTrash.end());
00279     sTrashRetainer = true;
00280 #endif
00281 }

void CompatEndMoveToTrash ( void )

Definition at line 283 of file MoveToTrash.cpp.

Referenced by CvsCmdRemoveFiles().

00284 {
00285 #ifdef macintosh
00286     if(sToTrash.size() > 0)
00287     {
00288         OSErr err;
00289         err = MoveToTrash(sToTrash);
00290         if(err != noErr)
00291             cvs_err("Unable to send files to the trash (Error %d)\n", err);
00292         else
00293             cvs_out("Files has been moved successfully to the trash...\n");
00294     }
00295
00296     sToTrash.erase(sToTrash.begin(), sToTrash.end());
00297     sTrashRetainer = false;
00298 #endif
00299 }

bool CompatMoveToTrash | ( | const char * | file,
 |  | const char * | dir = 0L,
 |  | const FSSpec * | spec = 0L
 | ) |

Definition at line 301 of file MoveToTrash.cpp.

00302 {
00303 #ifdef macintosh
00304     if(sTrashRetainer)
00305     {
00306         sToTrash.push_back(*spec);
00307         return true;
00308     }
00309
00310     return spec != NULL ? MoveToTrash(spec) == noErr : false;
00311 #elif defined(WIN32)
00312     SHFILEOPSTRUCT fileop;
00313     CStr fullpath(dir);
00314     if(!fullpath.empty() && !fullpath.endsWith(kPathDelimiter))
00315     {
00316         fullpath << kPathDelimiter;
00317     }
00318     fullpath << file;
00319     fullpath << ' ';
00320     fullpath[fullpath.length() - 1] = '\0';
00321
00322     fileop.hwnd     = *AfxGetMainWnd();
00323     fileop.wFunc    = FO_DELETE;
00324     fileop.pFrom    = fullpath;
00325     fileop.pTo      = 0L;
00326     fileop.fFlags   = FOF_ALLOWUNDO | FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI;
00327
00328     if(SHFileOperation(&fileop) != 0)
00329     {
00330         if(dir != 0L && chdir(dir) != 0)
00331             return false;
00332
00333         cvs_err("Unable to send \'%s\' to the recycle bin (error %d)\n",
00334             file, GetLastError());
00335         cvs_err("Trying now to delete \'%s\' instead\n", file);
00336         return remove(file) == 0;
00337     }
00338     return true;
00339 #else /* !macintosh && !WIN32 */
00340     CStr fullpath(dir);
00341     if(!fullpath.empty() && !fullpath.endsWith(kPathDelimiter))
00342     {
00343         fullpath << kPathDelimiter;
00344     }
00345     fullpath << file;
00346
00347     return remove(fullpath) == 0;
00348 #endif /* !macintosh && !WIN32 */
00349 }

Generated on Sun Oct 21 12:42:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MoveToTrash.h File Reference

common/MoveToTrash.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Typedefs

typedef int | FSSpec

Functions

bool | CompatMoveToTrash (const char *file, const char *dir=0L, const FSSpec *spec=0L)
void | CompatBeginMoveToTrash (void)
void | CompatEndMoveToTrash (void)

Typedef Documentation

typedef int FSSpec

Definition at line 29 of file MoveToTrash.h.

Function Documentation

void CompatBeginMoveToTrash ( void )

Definition at line 275 of file MoveToTrash.cpp.

00276 {
00277 #ifdef macintosh
00278     sToTrash.erase(sToTrash.begin(), sToTrash.end());
00279     sTrashRetainer = true;
00280 #endif
00281 }

void CompatEndMoveToTrash ( void )

Definition at line 283 of file MoveToTrash.cpp.

00284 {
00285 #ifdef macintosh
00286     if(sToTrash.size() > 0)
00287     {
00288         OSErr err;
00289         err = MoveToTrash(sToTrash);
00290         if(err != noErr)
00291             cvs_err("Unable to send files to the trash (Error %d)\n", err);
00292         else
00293             cvs_out("Files has been moved successfully to the trash...\n");
00294     }
00295
00296     sToTrash.erase(sToTrash.begin(), sToTrash.end());
00297     sTrashRetainer = false;
00298 #endif
00299 }

bool CompatMoveToTrash | ( | const char * | file,
 |  | const char * | dir = 0L,
 |  | const FSSpec * | spec = 0L
 | ) |

Definition at line 301 of file MoveToTrash.cpp.

Referenced by UCvsFiles::OnCmdTrash(), KoMoveToTrashHandler::OnFiles(), RemoveCvsArgs::addfile(), and tclSafeRemove().

00302 {
00303 #ifdef macintosh
00304     if(sTrashRetainer)
00305     {
00306         sToTrash.push_back(*spec);
00307         return true;
00308     }
00309
00310     return spec != NULL ? MoveToTrash(spec) == noErr : false;
00311 #elif defined(WIN32)
00312     SHFILEOPSTRUCT fileop;
00313     CStr fullpath(dir);
00314     if(!fullpath.empty() && !fullpath.endsWith(kPathDelimiter))
00315     {
00316         fullpath << kPathDelimiter;
00317     }
00318     fullpath << file;
00319     fullpath << ' ';
00320     fullpath[fullpath.length() - 1] = '\0';
00321
00322     fileop.hwnd     = *AfxGetMainWnd();
00323     fileop.wFunc    = FO_DELETE;
00324     fileop.pFrom    = fullpath;
00325     fileop.pTo      = 0L;
00326     fileop.fFlags   = FOF_ALLOWUNDO | FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI;
00327
00328     if(SHFileOperation(&fileop) != 0)
00329     {
00330         if(dir != 0L && chdir(dir) != 0)
00331             return false;
00332
00333         cvs_err("Unable to send \'%s\' to the recycle bin (error %d)\n",
00334             file, GetLastError());
00335         cvs_err("Trying now to delete \'%s\' instead\n", file);
00336         return remove(file) == 0;
00337     }
00338     return true;
00339 #else /* !macintosh && !WIN32 */
00340     CStr fullpath(dir);
00341     if(!fullpath.empty() && !fullpath.endsWith(kPathDelimiter))
00342     {
00343         fullpath << kPathDelimiter;
00344     }
00345     fullpath << file;
00346
00347     return remove(fullpath) == 0;
00348 #endif /* !macintosh && !WIN32 */
00349 }

Generated on Sun Oct 21 12:42:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MultiFiles.cpp File Reference

common/MultiFiles.cpp File Reference

#include "stdafx.h"
#include <stdlib.h>
#include <string.h>
#include "MultiFiles.h"
#include "CvsArgs.h"
#include "AppConsole.h"
#include "CPStr.h"
#include <errno.h>

Include dependency graph for MultiFiles.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:42:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MultiFiles.h File Reference

common/MultiFiles.h File Reference

#include "CPStr.h"
#include <vector>

Include dependency graph for MultiFiles.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | FileEntry
class | MultiFiles
class | MultiFilesEntry

Typedefs

typedef int | FSSpec

Typedef Documentation

typedef int FSSpec

Definition at line 31 of file MultiFiles.h.

Generated on Sun Oct 21 12:42:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MultiString.cpp File Reference

common/MultiString.cpp File Reference

#include "stdafx.h"
#include "MultiString.h"

Include dependency graph for MultiString.cpp:

Include dependency graph

Go to the source code of this file.

Variables

template class | TMString< UStr >
template class | TMString< UPStr >

Variable Documentation

template class TMString< UPStr >

Definition at line 161 of file MultiString.cpp.

template class TMString< UStr >

Definition at line 160 of file MultiString.cpp.

Generated on Sun Oct 21 12:42:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MultiString.h File Reference

common/MultiString.h File Reference

#include <vector>
#include "Persistent.h"
#include "CPStr.h"

Include dependency graph for MultiString.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CKeyString
class | CMPString
class | CMString
class | TMPersistent
class | TMString

Defines

#define | NAMESPACE(w) ::

Define Documentation

#define NAMESPACE ( w ) ::

Definition at line 36 of file MultiString.h.

Referenced by CMMenuString::GetData(), TMString::GetData(), TMString::Insert(), TMString::Remove(), CMMenuString::SizeOf(), and TMString::SizeOf().

Generated on Sun Oct 21 12:42:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


OptionalPropertySheet.cpp File Reference

common/OptionalPropertySheet.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "OptionalPropertySheet.h"
#include "CvsPrefs.h"

Include dependency graph for OptionalPropertySheet.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:42:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


OptionalPropertySheet.h File Reference

common/OptionalPropertySheet.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | COptionalPropertySheet

Defines

#define | AFX_OPTIONALPROPERTYSHEET_H__F82DC8BB_73CD_4AEA_8635_1A0932F24C7D__INCLUDED_

Define Documentation

#define AFX_OPTIONALPROPERTYSHEET_H__F82DC8BB_73CD_4AEA_8635_1A0932F24C7D__INCLUDED_

Definition at line 22 of file OptionalPropertySheet.h.

Generated on Sun Oct 21 12:42:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Persistent.cpp File Reference

common/Persistent.cpp File Reference

#include "stdafx.h"
#include <stdlib.h>
#include <string.h>
#include <map>
#include <ctype.h>
#include "Persistent.h"
#include "AppConsole.h"
#include "CPStr.h"
#include "uconsole.h"
#include "uwidget.h"
#include "FileTraversal.h"
#include "Authen.h"
#include "CvsPrefs.h"
#include "getline.h"
#include "CvsAlert.h"

Include dependency graph for Persistent.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CFindSettings
class | USaveSettings

Defines

#define | NEW new
#define | SETTINGS_FOLDER "Settings"

Functions

int | simple_diff (const char *file1, const char *file2)
bool | SettingsGetLoc (UStr &path)
bool | GetAllPersistentSettings (std::map< UStr, UStr > &res)
bool | loadSettingsInternal (const char *fullname, bool(*func)(const char *token, const char *value, void *data), void *data)
void | getSettingName (const char *fromfile, UStr &res)
bool | HasPersistentSettings (const char *path)
bool | _loadPersistentSettings (const char *token, const char *value, void *data)
void | LoadPersistentSettings (const char *path)
void | SaveAsPersistentSettings (const char *name, const char *path)
void | AskCreatePersistentSettings (const char *path)
void | SavePersistentSettings (const char *path)

Define Documentation

#define NEW new

Definition at line 94 of file Persistent.cpp.

#define SETTINGS_FOLDER "Settings"

Definition at line 666 of file Persistent.cpp.

Function Documentation

void AskCreatePersistentSettings ( const char * path )

Definition at line 1160 of file Persistent.cpp.

01161 {
01162     UStr settingsDir;
01163     if(!SettingsGetLoc(settingsDir))
01164         return;
01165
01166     int id = 0;
01167 #ifdef WIN32
01168     id = IDD_SAVESETTINGS;
01169 #endif
01170 #ifdef qMacCvsPP
01171     id = dlg_SaveSettings;
01172 #endif
01173     CFindSettings finder(path);
01174     FileTraverse(settingsDir, finder);
01175
01176     UStr oldName;
01177
01178     if(!finder.m_fullname.empty())
01179     {
01180         getSettingName(finder.m_fullname, oldName);
01181     }
01182
01183     USaveSettings *dlg = NEW USaveSettings(path, oldName);
01184
01185 #if qUnix
01186     void *wid;
01187 #   if qGTK
01188     wid = UCreate_SettingsDlg();
01189 #   endif
01190
01191     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01192 #endif
01193
01194     if(dlg->DoModal(id))
01195     {
01196         UStr name = dlg->m_settingName;
01197         UStr fileToDelete;
01198
01199         if(!name.empty())
01200         {
01201             if(!oldName.empty())
01202             {
01203                 if(stricmp(oldName, name) != 0)
01204                 {
01205                     UStr prompt("The setting '");
01206                     prompt << oldName;
01207                     prompt << "' already points on the same folder. ";
01208                     prompt << "Press 'Delete' if you want to overide this setting ";
01209                     prompt << "(two settings cannot point on the same location).";
01210                     if(CvsAlert(prompt, "Cancel", "Delete"))
01211                     {
01212                         delete dlg;
01213                         return;
01214                     }
01215                     fileToDelete = finder.m_fullname;
01216                 }
01217             }
01218
01219             if(!dlg->m_copyFromPath.empty())
01220                 LoadPersistentSettings(dlg->m_copyFromPath);
01221             SaveAsPersistentSettings(name, path);
01222
01223             if(!fileToDelete.empty())
01224             {
01225                 if(remove(fileToDelete) != 0)
01226                     cvs_err("Error while deleting '%s' (error %d)\n", (const char *)fileToDelete, errno);
01227             }
01228         }
01229     }
01230     delete dlg;
01231 }

bool GetAllPersistentSettings ( std::map< UStr, UStr > & res ) [static]

Definition at line 1035 of file Persistent.cpp.

Referenced by USaveSettings::DoDataExchange().

01036 {
01037     UStr settingsDir;
01038     if(!SettingsGetLoc(settingsDir))
01039         return false;
01040
01041     CFindSettings finder(res);
01042     FileTraverse(settingsDir, finder);
01043
01044     return !res.empty();
01045 }

bool HasPersistentSettings ( const char * path )

Definition at line 1047 of file Persistent.cpp.

01048 {
01049     UStr settingsDir;
01050     if(!SettingsGetLoc(settingsDir))
01051         return false;
01052
01053     CFindSettings finder(path);
01054     FileTraverse(settingsDir, finder);
01055
01056     return !finder.m_fullname.empty();
01057 }

void LoadPersistentSettings ( const char * path )

Definition at line 1123 of file Persistent.cpp.

01124 {
01125     UStr settingsDir;
01126     if(!SettingsGetLoc(settingsDir))
01127         return;
01128
01129     CFindSettings finder(path);
01130     FileTraverse(settingsDir, finder);
01131
01132     if(finder.m_fullname.empty())
01133         return;
01134
01135     if(loadSettingsInternal(finder.m_fullname, _loadPersistentSettings, 0L))
01136     {
01137         CColorConsole out;
01138         out << kBold << "Loaded settings for " << kNormal << kUnderline << path << kNormal << kBold << " successfully..." << kNormal << kNL;
01139     }
01140 }

void SaveAsPersistentSettings | ( | const char * | name,
 |  | const char * | path
 | ) | [static]

Definition at line 1142 of file Persistent.cpp.

Referenced by AskCreatePersistentSettings().

01143 {
01144     UStr settingFileName;
01145     if(!SettingsGetLoc(settingFileName))
01146         return;
01147
01148     if(!settingFileName.empty() && !settingFileName.endsWith(kPathDelimiter))
01149         settingFileName << kPathDelimiter;
01150     settingFileName << name;
01151     settingFileName << ".txt";
01152
01153     if(CPersistent::SaveAllSettings(settingFileName, path))
01154     {
01155         CColorConsole out;
01156         out << kBold << "Saved settings for " << kNormal << kUnderline << path << kNormal << kBold << " successfully..." << kNormal << kNL;
01157     }
01158 }

void SavePersistentSettings ( const char * path )

Definition at line 1233 of file Persistent.cpp.

01234 {
01235     UStr settingsDir;
01236     if(!SettingsGetLoc(settingsDir))
01237         return;
01238
01239     CFindSettings finder(path);
01240     FileTraverse(settingsDir, finder);
01241
01242     if(finder.m_fullname.empty())
01243         return;
01244
01245     if(CPersistent::SaveAllSettings(finder.m_fullname, path))
01246     {
01247         CColorConsole out;
01248         out << kBold << "Saved settings for " << kNormal << kUnderline << path << kNormal << kBold << " successfully..." << kNormal << kNL;
01249     }
01250 }

bool SettingsGetLoc ( UStr & path ) [static]

Definition at line 668 of file Persistent.cpp.

Referenced by AskCreatePersistentSettings(), GetAllPersistentSettings(), HasPersistentSettings(), LoadPersistentSettings(), SaveAsPersistentSettings(), and SavePersistentSettings().

00669 {
00670     struct stat sb;
00671
00672     path = "";
00673 #ifdef WIN32
00674     CWincvsApp* pApp = (CWincvsApp *)AfxGetApp();
00675     pApp->GetAppPath(path);
00676     if(!path.empty() && !path.endsWith(kPathDelimiter))
00677     {
00678         path << kPathDelimiter;
00679     }
00680     path << SETTINGS_FOLDER;
00681 #elif defined(qUnix)
00682     path = gCvsPrefs.Home();
00683     if(!path.endsWith(kPathDelimiter))
00684         path << kPathDelimiter;
00685     path << ".gcvs";
00686
00687     if(stat(path, &sb) != -1)
00688     {
00689         if(!S_ISDIR(sb.st_mode))
00690         {
00691             cvs_err("The file '%s' already exists and is not a directory", (char *)path, errno);
00692             return false;
00693         }
00694     }
00695     else if(mkdir(path, 0750) != 0)
00696     {
00697         cvs_err("Unable to create the directory '%s' (error %d)", (char *)path, errno);
00698         return false;
00699     }
00700
00701     if(!path.endsWith(kPathDelimiter))
00702         path << kPathDelimiter;
00703     path << SETTINGS_FOLDER;
00704 #else
00705 #   ifdef qMacCvsPP
00706     path = CMacCvsApp::GetAppPath();
00707 #   endif /* qMacCvsPP */
00708
00709     if(!path.empty() && !path.endsWith(kPathDelimiter))
00710     {
00711         path << kPathDelimiter;
00712     }
00713     path << SETTINGS_FOLDER;
00714 #endif
00715
00716     if(stat(path, &sb) != -1 && S_ISDIR(sb.st_mode))
00717         return true;
00718
00719 #if qUnix
00720     if(mkdir(path, 0750) != 0)
00721 #else
00722     if(mkdir(path) != 0)
00723 #endif
00724     {
00725         cvs_err("Failed to create the setting folder '%s' (error %d)",
00726             (const char *)path, errno);
00727         return false;
00728     }
00729     return true;
00730 }

bool _loadPersistentSettings | ( | const char * | token,
 |  | const char * | value,
 |  | void * | data
 | ) | [static]

Definition at line 1059 of file Persistent.cpp.

01060 {
01061     if(strcmp(token, "CVSROOT") == 0)
01062     {
01063         gCvsPrefs = value;
01064     }
01065     else if(strcmp(token, "AUTHENTICATION") == 0)
01066     {
01067         gAuthen.setkind(Authen::tokenToKind(value));
01068     }
01069     else if(strcmp(token, "PATH") == 0)
01070     {
01071     }
01072     else
01073     {
01074         CPersistent::CPersistentEntry *entry = CPersistent::Find(token);
01075         if(entry == 0L)
01076         {
01077             //cvs_err("Persistent value '%s' is not registred\n", token);
01078         }
01079         else
01080         {
01081             if(entry->fValue->IsKindOf(URUNTIME_CLASS(CPersistentBool)))
01082             {
01083                 CPersistentBool *pbool = (CPersistentBool *)entry->fValue;
01084                 if(strcmp(value, "true") == 0)
01085                     *pbool = true;
01086                 else if(strcmp(value, "false") == 0)
01087                     *pbool = false;
01088                 else
01089                     cvs_err("Invalid value '%s' for persistent '%s'\n",
01090                         (const char *)value, entry->fUniqueName);
01091             }
01092             else if(entry->fValue->IsKindOf(URUNTIME_CLASS(CPersistentInt)))
01093             {
01094                 CPersistentInt *pint = (CPersistentInt *)entry->fValue;
01095                 int aint;
01096                 int check = sscanf(value, "%d", &aint);
01097                 if(check == 1)
01098                     *pint = aint;
01099                 else
01100                     cvs_err("Invalid value '%s' for persistent '%s'\n",
01101                         (const char *)value, entry->fUniqueName);
01102             }
01103             else if(entry->fValue->IsKindOf(URUNTIME_CLASS(PCStr)))
01104             {
01105                 PCStr *pstr = (PCStr *)entry->fValue;
01106                 *pstr = value;
01107             }
01108             else if(entry->fValue->IsKindOf(URUNTIME_CLASS(PCPStr)))
01109             {
01110                 PCPStr *pstr = (PCPStr *)entry->fValue;
01111                 *pstr = value;
01112             }
01113             else
01114             {
01115                 cvs_err("Unknown persistent value '%s'\n", entry->fUniqueName);
01116             }
01117         }
01118     }
01119
01120     return false;
01121 }

void getSettingName | ( | const char * | fromfile,
 |  | UStr & | res
 | ) | [static]

Definition at line 937 of file Persistent.cpp.

Referenced by AskCreatePersistentSettings(), and CFindSettings::searchAllPath().

00938 {
00939     CStr base, ext, uppath, filename;
00940     SplitPath(fromfile, uppath, filename);
00941     GetExtension(filename, base, ext);
00942     if(!base.empty() && stricmp(ext, "txt") == 0)
00943         res = base;
00944     else
00945         res = filename;
00946 }

bool loadSettingsInternal | ( | const char * | fullname,
 |  | bool(* | func)(const char *token, const char *value, void *data),
 |  | void * | data
 | ) | [static]

Definition at line 868 of file Persistent.cpp.

Referenced by LoadPersistentSettings(), and CFindSettings::OnFile().

00870 {
00871     bool res = false;
00872     int line_length;
00873     char *line = 0L;
00874     size_t line_chars_allocated = 0;
00875     FILE *fp = fopen(fullname, "r");
00876
00877     if(fp == 0L)
00878     {
00879         cvs_err("Failed to open the setting file '%s' for reading (error %d)",
00880             fullname, errno);
00881         goto fail;
00882     }
00883
00884     while ((line_length = getline (&line, &line_chars_allocated, fp)) > 0)
00885     {
00886         // read each token=value
00887         char *tmp = 0L;
00888
00889         if((tmp = strchr(line, '\n')) != 0L)
00890             *tmp = '\0';
00891
00892         tmp = line;
00893         while(isspace(*tmp) && *tmp != '\0')
00894             tmp++;
00895         if(*tmp == '\0' || *tmp == '#')
00896             continue;
00897
00898         UStr token;
00899         UStr value;
00900         const char *tmp2 = strchr(tmp, '=');
00901         if(tmp2 == 0L)
00902             continue;
00903
00904         token.set(tmp, tmp2 - tmp);
00905         value = tmp2 + 1;
00906
00907         // check version
00908         if(strcmp(token, "VERSION") == 0)
00909         {
00910             if(atoi(value) != 1)
00911             {
00912                 cvs_err("Newer format than expected in the setting file '%s'\n", fullname);
00913                 goto fail;
00914             }
00915             continue;
00916         }
00917
00918         if(func(token, value, data))
00919             break;
00920     }
00921
00922     if (line_length < 0 && !feof (fp))
00923     {
00924         cvs_err("Cannot read file (error %d)\n", errno);
00925         goto fail;
00926     }
00927
00928     res = true;
00929 fail:
00930     if(line != 0L)
00931         free(line);
00932     if(fp!= 0L)
00933         fclose(fp);
00934     return res;
00935 }

int simple_diff | ( | const char * | file1,
 |  | const char * | file2
 | ) | [static]

Definition at line 261 of file Persistent.cpp.

Referenced by CPersistent::SaveAllSettings().

00262 {
00263     FILE *f1 = fopen(file1, "rb");
00264     if(f1 == 0L)
00265         return -1;
00266
00267     FILE *f2 = fopen(file2, "rb");
00268     if(f2 == 0L)
00269     {
00270         fclose(f1);
00271         return 1;
00272     }
00273
00274     int res = -1;
00275     char buf1[8000];
00276     char buf2[8000];
00277     size_t num1, num2;
00278     while(!feof(f1) && !feof(f2) && !ferror(f1) && !ferror(f2))
00279     {
00280         num1 = fread(buf1, sizeof(char), 8000, f1);
00281         num2 = fread(buf2, sizeof(char), 8000, f2);
00282         if(num1 != num2 || (res = memcmp(buf1, buf2, num1 * sizeof(char))) != 0)
00283             goto fail;
00284     }
00285
00286     if(ferror(f1) || ferror(f2))
00287         goto fail;
00288
00289     if(feof(f1) ^ feof(f2))
00290         goto fail;
00291
00292     res = 0;
00293 fail:
00294     fclose(f1);
00295     fclose(f2);
00296     return res;
00297 }

Generated on Sun Oct 21 12:42:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Persistent.h File Reference

common/Persistent.h File Reference

#include <string.h>
#include <vector>
#include "uobject.h"

Include dependency graph for Persistent.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CPersistent
struct | CPersistent::CPersistentEntry
class | CPersistentBool
class | CPersistentInt
class | CPersistentT

Defines

#define | PERSISTENT_CAST(T)

Enumerations

enum | kClassPersistent { kNoClass = 0x00, kAddSettings = 0x01 }

Functions

void | LoadPersistentSettings (const char *path)
bool | HasPersistentSettings (const char *path)
void | AskCreatePersistentSettings (const char *path)
void | SavePersistentSettings (const char *path)

Define Documentation

#define PERSISTENT_CAST ( T )

Value:

inline operator const T &() const {return fValue;} \
    inline const T * operator ->() const {return &fValue;} \
    inline T & operator=(const T & val) { TouchTimeStamp(); return fValue = val;} \
    inline bool operator==(const T & val) const {return fValue == val;}

Definition at line 89 of file Persistent.h.

Enumeration Type Documentation

enum kClassPersistent

Enumeration values:
kNoClass
kAddSettings

Definition at line 36 of file Persistent.h.

00037 {
00038     kNoClass = 0x00,
00039     kAddSettings = 0x01
00040 } kClassPersistent;

Function Documentation

void AskCreatePersistentSettings ( const char * path )

Definition at line 1160 of file Persistent.cpp.

Referenced by UCvsFrame::OnCmdSaveSettings(), CWincvsDoc::OnSavesettings(), CWinCvsBrowser::ResetBrowser(), and UCvsFolders::ResetBrowser().

01161 {
01162     UStr settingsDir;
01163     if(!SettingsGetLoc(settingsDir))
01164         return;
01165
01166     int id = 0;
01167 #ifdef WIN32
01168     id = IDD_SAVESETTINGS;
01169 #endif
01170 #ifdef qMacCvsPP
01171     id = dlg_SaveSettings;
01172 #endif
01173     CFindSettings finder(path);
01174     FileTraverse(settingsDir, finder);
01175
01176     UStr oldName;
01177
01178     if(!finder.m_fullname.empty())
01179     {
01180         getSettingName(finder.m_fullname, oldName);
01181     }
01182
01183     USaveSettings *dlg = NEW USaveSettings(path, oldName);
01184
01185 #if qUnix
01186     void *wid;
01187 #   if qGTK
01188     wid = UCreate_SettingsDlg();
01189 #   endif
01190
01191     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01192 #endif
01193
01194     if(dlg->DoModal(id))
01195     {
01196         UStr name = dlg->m_settingName;
01197         UStr fileToDelete;
01198
01199         if(!name.empty())
01200         {
01201             if(!oldName.empty())
01202             {
01203                 if(stricmp(oldName, name) != 0)
01204                 {
01205                     UStr prompt("The setting '");
01206                     prompt << oldName;
01207                     prompt << "' already points on the same folder. ";
01208                     prompt << "Press 'Delete' if you want to overide this setting ";
01209                     prompt << "(two settings cannot point on the same location).";
01210                     if(CvsAlert(prompt, "Cancel", "Delete"))
01211                     {
01212                         delete dlg;
01213                         return;
01214                     }
01215                     fileToDelete = finder.m_fullname;
01216                 }
01217             }
01218
01219             if(!dlg->m_copyFromPath.empty())
01220                 LoadPersistentSettings(dlg->m_copyFromPath);
01221             SaveAsPersistentSettings(name, path);
01222
01223             if(!fileToDelete.empty())
01224             {
01225                 if(remove(fileToDelete) != 0)
01226                     cvs_err("Error while deleting '%s' (error %d)\n", (const char *)fileToDelete, errno);
01227             }
01228         }
01229     }
01230     delete dlg;
01231 }

bool HasPersistentSettings ( const char * path )

Definition at line 1047 of file Persistent.cpp.

Referenced by CWinCvsBrowser::ResetBrowser(), and UCvsFolders::ResetBrowser().

01048 {
01049     UStr settingsDir;
01050     if(!SettingsGetLoc(settingsDir))
01051         return false;
01052
01053     CFindSettings finder(path);
01054     FileTraverse(settingsDir, finder);
01055
01056     return !finder.m_fullname.empty();
01057 }

void LoadPersistentSettings ( const char * path )

Definition at line 1123 of file Persistent.cpp.

Referenced by AskCreatePersistentSettings(), CWinCvsBrowser::ResetBrowser(), and UCvsFolders::ResetBrowser().

01124 {
01125     UStr settingsDir;
01126     if(!SettingsGetLoc(settingsDir))
01127         return;
01128
01129     CFindSettings finder(path);
01130     FileTraverse(settingsDir, finder);
01131
01132     if(finder.m_fullname.empty())
01133         return;
01134
01135     if(loadSettingsInternal(finder.m_fullname, _loadPersistentSettings, 0L))
01136     {
01137         CColorConsole out;
01138         out << kBold << "Loaded settings for " << kNormal << kUnderline << path << kNormal << kBold << " successfully..." << kNormal << kNL;
01139     }
01140 }

void SavePersistentSettings ( const char * path )

Definition at line 1233 of file Persistent.cpp.

Referenced by CvsPrefs::save().

01234 {
01235     UStr settingsDir;
01236     if(!SettingsGetLoc(settingsDir))
01237         return;
01238
01239     CFindSettings finder(path);
01240     FileTraverse(settingsDir, finder);
01241
01242     if(finder.m_fullname.empty())
01243         return;
01244
01245     if(CPersistent::SaveAllSettings(finder.m_fullname, path))
01246     {
01247         CColorConsole out;
01248         out << kBold << "Saved settings for " << kNormal << kUnderline << path << kNormal << kBold << " successfully..." << kNormal << kNL;
01249     }
01250 }

Generated on Sun Oct 21 12:42:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PromptFiles.cpp File Reference

common/PromptFiles.cpp File Reference

#include "stdafx.h"
#include "PromptFiles.h"
#include "MultiFiles.h"
#include "AppConsole.h"

Include dependency graph for PromptFiles.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:42:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PromptFiles.h File Reference

common/PromptFiles.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

const char * | BrowserGetDirectory (const char *prompt)
bool | BrowserGetMultiFiles (const char *prompt, MultiFiles &mf)

Function Documentation

const char* BrowserGetDirectory ( const char * prompt )

Referenced by CompatGetCheckout(), CompatGetCommand(), CompatGetImport(), CvsCmdAddFolder(), CvsCmdCheckoutModule(), CvsCmdCommitFolder(), CvsCmdDiffFolder(), CvsCmdEditFolder(), CvsCmdEditorsFolder(), CvsCmdImportModule(), CvsCmdLockFolder(), CvsCmdLogFolder(), CvsCmdReleaseFolder(), CvsCmdStatusFolder(), CvsCmdTagBranchFolder(), CvsCmdTagCreateFolder(), CvsCmdTagDeleteFolder(), CvsCmdUneditFolder(), CvsCmdUnlockFolder(), CvsCmdUpdateFolder(), CvsCmdWatchOffFolder(), CvsCmdWatchOnFolder(), CvsCmdWatchersFolder(), CWincvsDoc::OnBrowserOpen(), UCvsFrame::OnBrowserPopup(), and glue_getenv().

bool BrowserGetMultiFiles | ( | const char * | prompt,
 |  | MultiFiles & | mf
 | ) |

Referenced by CvsCmdAddBinaryFiles(), CvsCmdAddFiles(), CvsCmdAnnotateFiles(), CvsCmdCancelChangesFiles(), CvsCmdCommitFiles(), CvsCmdDiffFiles(), CvsCmdEditFiles(), CvsCmdEditorsFiles(), CvsCmdLockFiles(), CvsCmdLogFiles(), CvsCmdRemoveFiles(), CvsCmdStatusFiles(), CvsCmdTagBranchFiles(), CvsCmdTagCreateFiles(), CvsCmdTagDeleteFiles(), CvsCmdUneditFiles(), CvsCmdUnlockFiles(), CvsCmdUpdateFiles(), CvsCmdWatchOffFiles(), CvsCmdWatchOnFiles(), CvsCmdWatchersFiles(), UAuthen_SSH::OnBtnName(), and UAuthen_SSH::OnBtnRSA().

Generated on Sun Oct 21 12:42:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PythonContainer.cpp File Reference

common/PythonContainer.cpp File Reference

#include "stdafx.h"
#include "PythonContainer.h"
#include <vector>

Include dependency graph for PythonContainer.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void | PyHandleCvsguiError (const std::exception &e)
void | PyHandleCvsguiError (const char *msg)

Variables

PyObject * | gCvsguiErr = NULL

Function Documentation

void PyHandleCvsguiError ( const char * msg )

Definition at line 125 of file PythonContainer.cpp.

00126 {
00127     PyErr_SetString(gCvsguiErr, msg);
00128 }

void PyHandleCvsguiError ( const std::exception & e )

Definition at line 119 of file PythonContainer.cpp.

00120 {
00121     PyErr_SetString(gCvsguiErr, e.what());
00122 }

Variable Documentation

PyObject* gCvsguiErr = NULL

Definition at line 28 of file PythonContainer.cpp.

Generated on Sun Oct 21 12:42:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PythonContainer.h File Reference

common/PythonContainer.h File Reference

#include <Python.h>
#include <exception>
#include <vector>
#include "PythonMacros.h"
#include "PythonGlue.impl.h"

Include dependency graph for PythonContainer.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | PyAutoObject
class | PyContainer
class | PyRegistry

Defines

#define | USE_PYTHON 1

Typedefs

typedef void(* | PyRegistry_InitValues )(PyObject *d)

Variables

PyObject * | gCvsguiErr

Define Documentation

#define USE_PYTHON 1

Definition at line 25 of file PythonContainer.h.

Typedef Documentation

typedef void(* PyRegistry_InitValues)(PyObject *d)

Definition at line 40 of file PythonContainer.h.

Variable Documentation

PyObject* gCvsguiErr

Definition at line 182 of file PythonContainer.h.

Generated on Sun Oct 21 12:42:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PythonGlue.cpp File Reference

common/PythonGlue.cpp File Reference

#include "stdafx.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "PythonGlue.h"
#include "CvsLog.h"
#include "AppConsole.h"
#include "MacrosSetup.h"
#include "umenu.h"
#include "PythonContainer.h"
#include "PythonImpl.h"
#include "TclGlue.h"
#include "AppGlue.h"
#include "CvsArgs.h"
#include "FileTraversal.h"
#include "AskYesNo.h"
#include "dll_loader.h"
#include "CvsPrefs.h"
#include <Python.h>
#include <osdefs.h>

Include dependency graph for PythonGlue.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CBuffer
class | CFillPyEntries
class | CPyCvsConsole
class | CPyThreadState

Defines

#define | NEW new

Enumerations

enum | { _stdout_style = 15, _stderr_style = 16, _trace_style = 17 }

Functions

PyObject * | cvsgui_write (PyObject *self, PyObject *args)
PyObject * | cvsgui_GetMainMenuWidget (PyObject *self, PyObject *args)
PyObject * | cvsgui_GetTopMacroSelectionMenu (PyObject *self, PyObject *args)
PyObject * | cvsgui_GetTopMacroAdminMenu (PyObject *self, PyObject *args)
PyObject * | cvsgui_GetSelection (PyObject *self, PyObject *args)
PyObject * | cvsgui_GetCvsEntries (PyObject *self, PyObject *args)
PyObject * | cvsgui_LaunchTclMacro (PyObject *self, PyObject *args)
PyObject * | cvsgui_PromptMessage (PyObject *self, PyObject *args)
PyObject * | cvsgui_PromptEditMessage (PyObject *self, PyObject *args)
PyObject * | cvsgui_LaunchBrowser (PyObject *self, PyObject *args)
void | outputXML (FILE *out, CLogNode *node)
PyObject * | cvsgui_GetHistoryAsXML (PyObject *self, PyObject *args)
PyObject * | cvsgui_RunCvs (PyObject *self, PyObject *args)
void | InitializeInterp (PyThreadState *interp)
void | PyMacrosReloadAll (void)
void | PyDoCmdUI (UCmdUI *ucmdui)
void | PyDoPython (int cmd)
bool | PyIsUICacheValid ()
void | PyValidUICache ()
void | PyInvalUICache ()
void | PyAppendCache (EntnodeData *data)

Variables

bool | gUICacheValid = false
std::vector< ENTNODE > gUICache
PyObject * | gUICacheObj = NULL
PyMethodDef | cvsgui_methods []
std::vector< PyMethodDef > | gAllMethods

Define Documentation

#define NEW new

Definition at line 74 of file PythonGlue.cpp.

Enumeration Type Documentation

anonymous enum

Enumeration values:
_stdout_style
_stderr_style
_trace_style

Definition at line 99 of file PythonGlue.cpp.

00100 {
00101     _stdout_style = 15,
00102     _stderr_style = 16,
00103     _trace_style = 17
00104 };

Function Documentation

void InitializeInterp ( PyThreadState * interp ) [static]

Definition at line 816 of file PythonGlue.cpp.

Referenced by CPython_Interp::CPython_Interp(), and CPython_Interp::InitPythonSupport().

00817 {
00818     CPyThreadState lock(interp);
00819
00820     // first time, create the method table for cvsgui module
00821     if(gAllMethods.empty())
00822     {
00823         PyMethodDef *tmp = cvsgui_methods;
00824         while(tmp->ml_name)
00825         {
00826             gAllMethods.push_back(*tmp);
00827             tmp++;
00828         }
00829
00830         PyRegistry::RegisterAllObjects(gAllMethods);
00831     }
00832
00833     // this module contains the glue code functions
00834     PyObject *m = Py_InitModule4("_cvsgui", &gAllMethods[0],
00835         "The cvsgui glue functions", (PyObject*)NULL,PYTHON_API_VERSION);
00836
00837     if(m == NULL)
00838     {
00839         cvs_err("Could not create the Python cvsgui module !\n");
00840         return;
00841     }
00842
00843     // this is the exception we raised when the error comes from us
00844     PyObject *d = PyModule_GetDict(m);
00845     if(gCvsguiErr == NULL)
00846         gCvsguiErr = PyErr_NewException("_cvsgui.error", NULL, NULL);
00847     if (gCvsguiErr != NULL)
00848         PyDict_SetItemString(d, "error", gCvsguiErr);
00849
00850     PyRegistry::CallInitValues(d);
00851
00852     // Ideally we need to use Jonathan's mechanism
00853     PyObject *ver = PyString_FromString("1.3");
00854     if (ver != NULL) {
00855         PyDict_SetItemString(d, "CVSGUI_VERSION", ver);
00856         Py_DECREF(ver);
00857     }
00858
00859     char *script = NULL;
00860
00861 #ifdef WIN32
00862     HINSTANCE hInst = ::AfxGetInstanceHandle();
00863     HRSRC rsrc = FindResource(hInst, "PYSHELL", "PYSCRIPT");
00864
00865     if(rsrc)
00866     {
00867         HGLOBAL h = LoadResource(hInst, rsrc);
00868         if(h)
00869         {
00870             DWORD size = SizeofResource(hInst, rsrc);
00871             script = (char *)malloc(size + 1);
00872             char *ptr = (char *)LockResource(h);
00873
00874             if(script)
00875             {
00876                 char *tmp = script;
00877                 while(size--)
00878                 {
00879                     char c = *ptr++;
00880                     if(c == '\r')
00881                         continue;
00882                     *tmp++ = c;
00883                 }
00884                 *tmp = '\0';
00885             }
00886
00887             FreeResource(h);
00888         }
00889     }
00890
00891 #endif // WIN32
00892 #if qMacCvsPP
00893     StResource rsrcH(FOUR_CHAR_CODE('PYTH'), 128);
00894     size_t size = GetHandleSize(rsrcH);
00895     script = (char *)malloc(size + 1);
00896     if(script)
00897     {
00898         char *ptr = (char *)*rsrcH;
00899         char *tmp = script;
00900         while(size--)
00901         {
00902             char c = *ptr++;
00903             if(c == '\r')
00904                 c = '\n';
00905             *tmp++ = c;
00906         }
00907         *tmp = '\0';
00908     }
00909 #endif
00910
00911     // augment the library path of python with our library
00912     CStr ourLibPath;
00913     PythonLibGetLoc(ourLibPath);
00914
00915     UStr libPath = Py_GetPath();
00916     if(!ourLibPath.empty())
00917     {
00918         libPath << DELIM;
00919         libPath << ourLibPath;
00920         PySys_SetPath((char *)(const char *)libPath);
00921     }
00922
00923     // this is the script to setup stdout/stderr and reroute it
00924     // to the console window
00925     if(script)
00926     {
00927         PyRun_SimpleString(script);
00928
00929         free(script);
00930     }
00931     else
00932     {
00933         cvs_err("Could not initialize properly the Python interpreter !\n");
00934     }
00935 }

void PyAppendCache ( EntnodeData * data )

Definition at line 1230 of file PythonGlue.cpp.

01231 {
01232 #if USE_PYTHON
01233     Py_XDECREF(gUICacheObj);
01234     gUICacheObj = 0L;
01235     gUICache.push_back(ENTNODE(data));
01236     gUICacheValid = true;
01237 #endif
01238 }

void PyDoCmdUI ( UCmdUI * ucmdui )

Definition at line 1189 of file PythonGlue.cpp.

01190 {
01191     CPython_Interp interp;
01192     interp.DoScriptVar("from cvsgui.MacroRegistry import *; "
01193         "from cvsgui.CmdUI import *; "
01194         "gMacroRegistry.DoCmdUI(CmdUI(%d), %d)", (long)ucmdui, ucmdui->m_nID);
01195 }

void PyDoPython ( int cmd )

Definition at line 1197 of file PythonGlue.cpp.

01198 {
01199     CPython_Interp interp;
01200     interp.DoScriptVar("from cvsgui.MacroRegistry import *; "
01201         "gMacroRegistry.DoCmd(%d)", cmd);
01202 }

void PyInvalUICache ( )

Definition at line 1220 of file PythonGlue.cpp.

Referenced by CPython_Interp::ClosePythonSupport(), CWincvsApp::PreTranslateMessage(), and CWincvsView::~CWincvsView().

01221 {
01222 #if USE_PYTHON
01223     gUICache.erase(gUICache.begin(), gUICache.end());
01224     gUICacheValid = false;
01225     Py_XDECREF(gUICacheObj);
01226     gUICacheObj = 0L;
01227 #endif
01228 }

bool PyIsUICacheValid ( )

Definition at line 1204 of file PythonGlue.cpp.

Referenced by CWinCvsBrowser::OnUpdateMacro(), and CBrowseFileView::OnUpdateMacro().

01205 {
01206 #if USE_PYTHON
01207     return gUICacheValid;
01208 #else
01209     return false;
01210 #endif
01211 }

void PyMacrosReloadAll ( void )

Definition at line 1172 of file PythonGlue.cpp.

Referenced by CWincvsApp::InitInstance().

01173 {
01174     // get the macro folder
01175     UStr path;
01176     MacrosGetLoc(path);
01177
01178 #ifdef WIN32
01179     CString newpath(path);
01180     newpath.Replace("\\", "\\\\");
01181     path = newpath;
01182 #endif
01183
01184     CPython_Interp interp;
01185     interp.DoScriptVar("from cvsgui.MacroRegistry import *; "
01186         "gMacroRegistry.LoadMacros(\"%s\")", (char *)path.c_str());;
01187 }

void PyValidUICache ( )

Definition at line 1213 of file PythonGlue.cpp.

01214 {
01215 #if USE_PYTHON
01216     gUICacheValid = true;
01217 #endif
01218 }

PyObject* cvsgui_GetCvsEntries | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 347 of file PythonGlue.cpp.

00348 {
00349     char *path;
00350
00351     if(!PyArg_ParseTuple(args, "s", &path))
00352         return NULL;
00353
00354     CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00355     CFillPyEntries traverse(entries);
00356     /*kTraversal res = */FileTraverse(path, traverse);
00357
00358     // add the missing files
00359     Entries_SetMissing(entries);
00360
00361     int numEntries = entries.NumOfElements();
00362     PyObject *obj = PyTuple_New(numEntries);
00363     if(obj == NULL)
00364         return NULL;
00365
00366     for(int i = 0; i < numEntries; i++)
00367     {
00368         const ENTNODE & theNode = entries.Get(i);
00369         EntnodeData *data = theNode.Data();
00370
00371         PyAutoObject<PyCvsEntry::obj_t> res = PyCvsEntry::New();
00372         if (!res.IsValid())
00373             return NULL;
00374
00375         res->m_object = new PyCvsEntry(data);
00376
00377         PyTuple_SET_ITEM(obj, i, res.CopyReturn());
00378     }
00379
00380     return obj;
00381 }

PyObject* cvsgui_GetHistoryAsXML | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 710 of file PythonGlue.cpp.

00711 {
00712     PyObject *logfile, *xmlfile;
00713
00714     if(!PyArg_ParseTuple(args, "O!O!", GetPyFile_Type(), &logfile,
00715         GetPyFile_Type(), &xmlfile))
00716             return NULL;
00717
00718     TRY
00719     {
00720         std::vector<CRcsFile> & allRcs = CvsLogParse(PyFile_AsFile(logfile));
00721
00722         std::vector<CRcsFile>::iterator i;
00723         FILE *xml = PyFile_AsFile(xmlfile);
00724         fputs("<ROOT>\n", xml);
00725         for(i = allRcs.begin(); i != allRcs.end(); ++i)
00726         {
00727             std::auto_ptr<CLogNode> node(CvsLogGraph(*i));
00728             outputXML(xml, node.get());
00729         }
00730         fputs("</ROOT>\n", xml);
00731
00732         CvsLogReset();
00733     }
00734     CATCH_ALL(e)
00735     {
00736         PyHandleCvsguiError(e);
00737         return NULL;
00738     }
00739     END_CATCH_ALL
00740
00741     return PyContainer::Void();
00742 }

PyObject* cvsgui_GetMainMenuWidget | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 132 of file PythonGlue.cpp.

00133 {
00134     int res = 0;
00135
00136     if(!PyArg_ParseTuple(args, ""))
00137         return NULL;
00138
00139     TRY
00140     {
00141     }
00142     CATCH_ALL(e)
00143     {
00144         PyHandleCvsguiError(e);
00145         return NULL;
00146     }
00147     END_CATCH_ALL
00148
00149     return PyInt_FromLong(res);
00150 }

PyObject* cvsgui_GetSelection | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 245 of file PythonGlue.cpp.

00246 {
00247     if(!PyArg_ParseTuple(args, ""))
00248         return NULL;
00249
00250     if(gUICacheObj != 0L)
00251     {
00252         Py_INCREF(gUICacheObj);
00253         return gUICacheObj;
00254     }
00255
00256     gUICacheObj = PyTuple_New(gUICache.size());
00257     if(gUICacheObj == NULL)
00258         return NULL;
00259
00260     std::vector<ENTNODE>::const_iterator i;
00261     int cnt;
00262     for(cnt = 0, i = gUICache.begin(); i != gUICache.end(); ++i, ++cnt)
00263     {
00264         PyAutoObject<PyCvsEntry::obj_t> res = PyCvsEntry::New();
00265         if (!res.IsValid())
00266             return NULL;
00267
00268         res->m_object = new PyCvsEntry(*i);
00269
00270         PyTuple_SET_ITEM(gUICacheObj, cnt, res.CopyReturn());
00271     }
00272
00273     Py_INCREF(gUICacheObj);
00274     return gUICacheObj;
00275 }

PyObject* cvsgui_GetTopMacroAdminMenu | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 199 of file PythonGlue.cpp.

00200 {
00201     static UMENU macroMenu = 0L;
00202
00203     if(!PyArg_ParseTuple(args, ""))
00204         return NULL;
00205
00206     PyAutoObject<PyMenuMgr::obj_t> res = PyMenuMgr::New();
00207     if (!res.IsValid())
00208         return NULL;
00209
00210     TRY
00211     {
00212 #ifdef WIN32
00213         int pos;
00214         if(macroMenu == 0L)
00215         {
00216             CMenu *top = GetMenuEntry(ID_MACRO_ADMIN, pos);
00217             if(top)
00218             {
00219                 top->DeleteMenu(pos, MF_BYPOSITION);
00220                 macroMenu = (UMENU)(HMENU)*top;
00221             }
00222         }
00223 #endif
00224 #if qMacCvsPP
00225         if(macroMenu == 0L)
00226         {
00227             LMenuBar *menuBar   = LMenuBar::GetCurrentMenuBar();
00228             LMenu *menu = menuBar->FetchMenu(menu_MacroAdmin);
00229             if(menu)
00230                 macroMenu = menu->GetMenuID();
00231         }
00232 #endif
00233         res->m_object = new PyMenuMgr(macroMenu);
00234     }
00235     CATCH_ALL(e)
00236     {
00237         PyHandleCvsguiError(e);
00238         return NULL;
00239     }
00240     END_CATCH_ALL
00241
00242     return res.CopyReturn();
00243 }

PyObject* cvsgui_GetTopMacroSelectionMenu | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 152 of file PythonGlue.cpp.

00153 {
00154     static UMENU macroMenu = 0L;
00155
00156     if(!PyArg_ParseTuple(args, ""))
00157         return NULL;
00158
00159     PyAutoObject<PyMenuMgr::obj_t> res = PyMenuMgr::New();
00160     if (!res.IsValid())
00161         return NULL;
00162
00163     TRY
00164     {
00165 #ifdef WIN32
00166         int pos;
00167         if(macroMenu == 0L)
00168         {
00169             CMenu *top = GetMenuEntry(ID_MACRO_SEL, pos);
00170             if(top)
00171             {
00172                 top->DeleteMenu(pos, MF_BYPOSITION);
00173                 macroMenu = (UMENU)(HMENU)*top;
00174             }
00175         }
00176 #endif
00177 #if qMacCvsPP
00178         if(macroMenu == 0L)
00179         {
00180             LMenuBar *menuBar   = LMenuBar::GetCurrentMenuBar();
00181             LMenu *menu = menuBar->FetchMenu(menu_MacroSel);
00182             if(menu)
00183                 macroMenu = menu->GetMenuID();
00184         }
00185 #endif
00186
00187         res->m_object = new PyMenuMgr(macroMenu);
00188     }
00189     CATCH_ALL(e)
00190     {
00191         PyHandleCvsguiError(e);
00192         return NULL;
00193     }
00194     END_CATCH_ALL
00195
00196     return res.CopyReturn();
00197 }

PyObject* cvsgui_LaunchBrowser | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 579 of file PythonGlue.cpp.

00580 {
00581     char *url;
00582
00583     if(!PyArg_ParseTuple(args, "s", &url))
00584         return NULL;
00585
00586 #ifdef WIN32
00587     ShellExecute(NULL, "open", url, /*postData*/0L, NULL, SW_SHOWNORMAL);
00588 #endif
00589
00590     return PyContainer::Void();
00591 }

PyObject* cvsgui_LaunchTclMacro | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 430 of file PythonGlue.cpp.

00431 {
00432     char *macroName;
00433
00434     if(!PyArg_ParseTuple(args, "s", &macroName) || !CTcl_Interp::IsAvail())
00435         return NULL;
00436
00437     std::vector<ENTNODE>::const_iterator i;
00438     TclBrowserReset();
00439     for(i = gUICache.begin(); i != gUICache.end(); ++i)
00440     {
00441         EntnodeData *data = *i;
00442         TclBrowserAppend((*data)[EntnodeData::kPath], data);
00443     }
00444
00445     CTcl_Interp interp;
00446     CStr path = macroName;
00447     CTcl_Interp::Unixfy(path);
00448     interp.DoScriptVar("source \"%s\"", (const char *)path);
00449
00450     return PyContainer::Void();
00451 }

PyObject* cvsgui_PromptEditMessage | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 554 of file PythonGlue.cpp.

00555 {
00556     char *msg, *title, *ok, *cncl, *edit;
00557
00558     if(!PyArg_ParseTuple(args, "sssss", &msg, &edit, &title, &ok, &cncl))
00559         return NULL;
00560
00561     bool res;
00562     UStr ed;
00563
00564     TRY
00565     {
00566         ed = edit;
00567         res = PromptEditMessage(msg, ed, title, ok, cncl);
00568     }
00569     CATCH_ALL(e)
00570     {
00571         PyHandleCvsguiError(e);
00572         return NULL;
00573     }
00574     END_CATCH_ALL
00575
00576     return Py_BuildValue("(is)", res ? 1 : 0, ed.empty() ? "" : ed.c_str());
00577 }

PyObject* cvsgui_PromptMessage | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 526 of file PythonGlue.cpp.

00527 {
00528     char *msg, *title, *ok, *cncl;
00529
00530     if(!PyArg_ParseTuple(args, "ssss", &msg, &title, &ok, &cncl))
00531         return NULL;
00532
00533     bool res;
00534
00535     TRY
00536     {
00537         res = PromptMessage(msg, title, ok, cncl);
00538     }
00539     CATCH_ALL(e)
00540     {
00541         PyHandleCvsguiError(e);
00542         return NULL;
00543     }
00544     END_CATCH_ALL
00545
00546     if(res)
00547     {
00548         return PyContainer::True();
00549     }
00550
00551     return PyContainer::False();
00552 }

PyObject* cvsgui_RunCvs | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 744 of file PythonGlue.cpp.

00745 {
00746     CvsArgs arg;
00747     PyObject *cargs;
00748     int exitOnError = 1;
00749     int exitc;
00750     CPyCvsConsole console;
00751
00752     if(!PyArg_ParseTuple(args, "O!|i", GetPyTuple_Type(), &cargs, &exitOnError))
00753         return NULL;
00754
00755     TRY
00756     {
00757         int argc = PyTuple_Size(cargs);
00758         for(int i = 0; i < argc; i++)
00759         {
00760             PyObject *o = PyTuple_GET_ITEM(cargs, i);
00761             if(!PyString_Check(o))
00762             {
00763                 PyErr_SetString(gCvsguiErr, "Wrong argument type, should be string");
00764                 return NULL;
00765             }
00766
00767             arg.add(PyString_AsString(o));
00768         }
00769
00770         exitc = launchCVS(0L, arg.Argc(), arg.Argv(), &console);
00771
00772         if(exitOnError && exitc != 0)
00773         {
00774             UStr str;
00775             str.set(console.m_err, console.m_err.size());
00776             str << "cvs returned an non-zero error code (";
00777             str << exitc;
00778             str << ")\n";
00779             PyErr_SetString(gCvsguiErr, str);
00780             return NULL;
00781         }
00782     }
00783     CATCH_ALL(e)
00784     {
00785         PyHandleCvsguiError(e);
00786         return NULL;
00787     }
00788     END_CATCH_ALL
00789
00790     return Py_BuildValue("(is#s#)", exitc, (char *)console.m_out, console.m_out.size(),
00791         (char *)console.m_err, console.m_err.size());
00792 }

PyObject* cvsgui_write | ( | PyObject * | self,
 |  | PyObject * | args
 | ) | [static]

Definition at line 106 of file PythonGlue.cpp.

00107 {
00108     char *str;
00109     int style;
00110     PyObject *shell;
00111
00112     if(!PyArg_ParseTuple(args, "siO", &str, &style, &shell))
00113         return NULL;
00114
00115     TRY
00116     {
00117         if(style == _stdout_style)
00118             cvs_outstr(str, strlen(str));
00119         else
00120             cvs_errstr(str, strlen(str));
00121     }
00122     CATCH_ALL(e)
00123     {
00124         PyHandleCvsguiError(e);
00125         return NULL;
00126     }
00127     END_CATCH_ALL
00128
00129     return PyContainer::Void();
00130 }

void outputXML | ( | FILE * | out,
 |  | CLogNode * | node
 | ) | [static]

Definition at line 593 of file PythonGlue.cpp.

Referenced by cvsgui_GetHistoryAsXML().

00594 {
00595     switch(node->GetType())
00596     {
00597         case kNodeHeader :
00598         {
00599             fputs("<RCS>\n", out);
00600             const CRcsFile rcs = **(CLogNodeHeader *)node;
00601             fprintf(out, "<RCSFILE>%s</RCSFILE>\n", rcs.RcsFile().c_str());
00602             fprintf(out, "<WORKINGFILE>%s</WORKINGFILE>\n", rcs.WorkingFile().c_str());
00603             fprintf(out, "<HEADREV>%s</HEADREV>\n", rcs.HeadRev().c_str());
00604             fprintf(out, "<BRANCHREV>%s</BRANCHREV>\n", rcs.BranchRev().c_str());
00605             fprintf(out, "<KEYWORDSUBST>%s</KEYWORDSUBST>\n", rcs.KeywordSubst().c_str());
00606             fprintf(out, "<DESCRIPTION>%s</DESCRIPTION>\n", rcs.DescLog().c_str());
00607             fprintf(out, "<SELREVISIONS>%d</SELREVISIONS>\n", rcs.SelRevisions());
00608             fprintf(out, "<TOTREVISIONS>%d</TOTREVISIONS>\n", rcs.TotRevisions());
00609             fprintf(out, "<LOCKSTRICT>%d</LOCKSTRICT>\n", rcs.LockStrict() ? 1 : 0);
00610
00611             fputs("<ACCESSLIST>\n", out);
00612             const std::vector<CLogStr> & ac = rcs.AccessList();
00613             std::vector<CLogStr>::const_iterator i;
00614             for(i = ac.begin(); i != ac.end(); ++i)
00615             {
00616                 fprintf(out, "<ACCESS>%s</ACCESS>\n", (*i).c_str());
00617             }
00618             fputs("</ACCESSLIST>\n", out);
00619
00620             fputs("<SYMBOLICLIST>\n", out);
00621             const std::vector<CRevNumber> & sy = rcs.SymbolicList();
00622             std::vector<CRevNumber>::const_iterator j;
00623             for(j = sy.begin(); j != sy.end(); ++j)
00624             {
00625                 fprintf(out, "<SYMBOLIC>%s</SYMBOLIC>\n", (*j).c_str());
00626             }
00627             fputs("</SYMBOLICLIST>\n", out);
00628
00629             fputs("<LOCKLIST>\n", out);
00630             const std::vector<CRevNumber> & lo = rcs.LocksList();
00631             for(j = lo.begin(); j != lo.end(); ++j)
00632             {
00633                 fprintf(out, "<LOCK>%s</LOCK>\n", (*j).c_str());
00634             }
00635             fputs("</LOCKLIST>\n", out);
00636             break;
00637         }
00638         case kNodeRev :
00639         {
00640             const CRevFile & rev = **(CLogNodeRev *)node;
00641             fputs("<REVISION>\n", out);
00642             fprintf(out, "<NUMBER>%s</NUMBER>\n", rev.RevNum().c_str());
00643             const struct tm & tm = rev.RevTime();
00644             fprintf(out, "<DATE>%d/%d/%d %d:%d:%d</DATE>\n", (tm.tm_year + 1900),
00645                 tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
00646             fprintf(out, "<AUTHOR>%s</AUTHOR>\n", rev.Author().c_str());
00647             fprintf(out, "<STATE>%s</STATE>\n", rev.State().c_str());
00648             fprintf(out, "<CHANGES>+%d%d</CHANGES>\n", rev.ChgPos(), rev.ChgNeg());
00649             fprintf(out, "<DESCRIPTION>%s</DESCRIPTION>\n", rev.DescLog().c_str());
00650
00651             fputs("<BRANCHLIST>\n", out);
00652             const std::vector<CRevNumber> & sy = rev.BranchesList();
00653             std::vector<CRevNumber>::const_iterator j;
00654             for(j = sy.begin(); j != sy.end(); ++j)
00655             {
00656                 fprintf(out, "<REVBRANCH>%s</REVBRANCH>\n", (*j).c_str());
00657             }
00658             fputs("</BRANCHLIST>\n", out);
00659             break;
00660         }
00661         case kNodeBranch :
00662         {
00663             fputs("<BRANCH>\n", out);
00664             const CLogStr & branch = **(CLogNodeBranch *)node;
00665             fprintf(out, "<BRANCHNAME>%s</BRANCHNAME>\n", branch.c_str());
00666             break;
00667         }
00668         case kNodeTag :
00669         {
00670             fputs("<TAG>\n", out);
00671             const CLogStr & tag = **(CLogNodeTag *)node;
00672             fprintf(out, "<TAGNAME>%s</TAGNAME>\n", tag.c_str());
00673             break;
00674         }
00675     }
00676
00677     if(node->Childs().size() > 0)
00678     {
00679         fputs("<REVISIONS>\n", out);
00680         std::vector<CLogNode *>::const_iterator i;
00681         for(i = node->Childs().begin(); i != node->Childs().end(); ++i)
00682         {
00683             outputXML(out, *i);
00684         }
00685         fputs("</REVISIONS>\n", out);
00686     }
00687
00688     switch(node->GetType())
00689     {
00690         case kNodeHeader :
00691             fputs("</RCS>\n", out);
00692             break;
00693         case kNodeRev :
00694             fputs("</REVISION>\n", out);
00695             break;
00696         case kNodeBranch :
00697             fputs("</BRANCH>\n", out);
00698             break;
00699         case kNodeTag :
00700             fputs("</TAG>\n", out);
00701             break;
00702     }
00703
00704     if(node->Next() != 0L)
00705     {
00706         outputXML(out, node->Next());
00707     }
00708 }

Variable Documentation

PyMethodDef cvsgui_methods[] [static]

Initial value:

{
    {"write", (PyCFunction)cvsgui_write, METH_VARARGS, ""},
    {"GetMainMenuWidget", (PyCFunction)cvsgui_GetMainMenuWidget, METH_VARARGS, ""},
    {"GetTopMacroSelectionMenu", (PyCFunction)cvsgui_GetTopMacroSelectionMenu, METH_VARARGS, ""},
    {"GetTopMacroAdminMenu", (PyCFunction)cvsgui_GetTopMacroAdminMenu, METH_VARARGS, ""},
    {"GetSelection", (PyCFunction)cvsgui_GetSelection, METH_VARARGS, ""},
    {"GetCvsEntries", (PyCFunction)cvsgui_GetCvsEntries, METH_VARARGS, ""},

    {"LaunchTclMacro", (PyCFunction)cvsgui_LaunchTclMacro, METH_VARARGS, ""},
    {"RunCvs", (PyCFunction)cvsgui_RunCvs, METH_VARARGS, ""},
    {"PromptMessage", (PyCFunction)cvsgui_PromptMessage, METH_VARARGS, ""},
    {"PromptEditMessage", (PyCFunction)cvsgui_PromptEditMessage, METH_VARARGS, ""},
    {"LaunchBrowser", (PyCFunction)cvsgui_LaunchBrowser, METH_VARARGS, ""},
    {"GetHistoryAsXML", (PyCFunction)cvsgui_GetHistoryAsXML, METH_VARARGS, ""},
    {NULL, NULL}
}

Definition at line 794 of file PythonGlue.cpp.

std::vector<PyMethodDef> gAllMethods [static]

Definition at line 814 of file PythonGlue.cpp.

std::vector<ENTNODE> gUICache [static]

Definition at line 81 of file PythonGlue.cpp.

PyObject* gUICacheObj = NULL [static]

Definition at line 82 of file PythonGlue.cpp.

bool gUICacheValid = false [static]

Definition at line 80 of file PythonGlue.cpp.

Generated on Sun Oct 21 12:42:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PythonGlue.h File Reference

common/PythonGlue.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CPython_Interp

Typedefs

typedef _ts | PyThreadState

Functions

void | PyMacrosReloadAll (void)
void | PyDoCmdUI (UCmdUI *ucmdui)
void | PyDoPython (int cmd)
bool | PyIsUICacheValid ()
void | PyValidUICache ()
void | PyInvalUICache ()
void | PyAppendCache (EntnodeData *data)

Typedef Documentation

typedef struct _ts PyThreadState

Definition at line 30 of file PythonGlue.h.

Function Documentation

void PyAppendCache ( EntnodeData * data )

Definition at line 1230 of file PythonGlue.cpp.

Referenced by CWinCvsBrowser::OnUpdateMacro(), and CBrowseFileView::OnUpdateMacro().

01231 {
01232 #if USE_PYTHON
01233     Py_XDECREF(gUICacheObj);
01234     gUICacheObj = 0L;
01235     gUICache.push_back(ENTNODE(data));
01236     gUICacheValid = true;
01237 #endif
01238 }

void PyDoCmdUI ( UCmdUI * ucmdui )

Definition at line 1189 of file PythonGlue.cpp.

Referenced by CWinCvsBrowser::OnUpdateMacro(), and CBrowseFileView::OnUpdateMacro().

01190 {
01191     CPython_Interp interp;
01192     interp.DoScriptVar("from cvsgui.MacroRegistry import *; "
01193         "from cvsgui.CmdUI import *; "
01194         "gMacroRegistry.DoCmdUI(CmdUI(%d), %d)", (long)ucmdui, ucmdui->m_nID);
01195 }

void PyDoPython ( int cmd )

Definition at line 1197 of file PythonGlue.cpp.

Referenced by CWinCvsBrowser::OnMacro(), and CBrowseFileView::OnMacro().

01198 {
01199     CPython_Interp interp;
01200     interp.DoScriptVar("from cvsgui.MacroRegistry import *; "
01201         "gMacroRegistry.DoCmd(%d)", cmd);
01202 }

void PyInvalUICache ( )

Definition at line 1220 of file PythonGlue.cpp.

01221 {
01222 #if USE_PYTHON
01223     gUICache.erase(gUICache.begin(), gUICache.end());
01224     gUICacheValid = false;
01225     Py_XDECREF(gUICacheObj);
01226     gUICacheObj = 0L;
01227 #endif
01228 }

bool PyIsUICacheValid ( )

Definition at line 1204 of file PythonGlue.cpp.

01205 {
01206 #if USE_PYTHON
01207     return gUICacheValid;
01208 #else
01209     return false;
01210 #endif
01211 }

void PyMacrosReloadAll ( void )

Definition at line 1172 of file PythonGlue.cpp.

01173 {
01174     // get the macro folder
01175     UStr path;
01176     MacrosGetLoc(path);
01177
01178 #ifdef WIN32
01179     CString newpath(path);
01180     newpath.Replace("\\", "\\\\");
01181     path = newpath;
01182 #endif
01183
01184     CPython_Interp interp;
01185     interp.DoScriptVar("from cvsgui.MacroRegistry import *; "
01186         "gMacroRegistry.LoadMacros(\"%s\")", (char *)path.c_str());;
01187 }

void PyValidUICache ( )

Definition at line 1213 of file PythonGlue.cpp.

01214 {
01215 #if USE_PYTHON
01216     gUICacheValid = true;
01217 #endif
01218 }

Generated on Sun Oct 21 12:42:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PythonGlue.impl.h File Reference

common/PythonGlue.impl.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | PYTHONGLUE_EXTERN extern

Functions

PyTypeObject * | GetPyType_Type ()
PyTypeObject * | GetPyFile_Type ()
PyTypeObject * | GetPyString_Type ()
PyTypeObject * | GetPyTuple_Type ()
PyTypeObject * | GetPyInt_Type ()
PyObject * | GetPyNone ()
PyObject * | GetPyTrue ()
PyObject * | GetPyFalse ()

Define Documentation

#define PYTHONGLUE_EXTERN extern

Definition at line 29 of file PythonGlue.impl.h.

Function Documentation

PyObject* GetPyFalse ( ) [inline]

Definition at line 131 of file PythonGlue.impl.h.

Referenced by PyContainer::False().

00131 { return Py_False; }

PyTypeObject* GetPyFile_Type ( ) [inline]

Definition at line 125 of file PythonGlue.impl.h.

Referenced by cvsgui_GetHistoryAsXML().

00125 { return &PyFile_Type; }

PyTypeObject* GetPyInt_Type ( ) [inline]

Definition at line 128 of file PythonGlue.impl.h.

00128 { return &PyInt_Type; }

PyObject* GetPyNone ( ) [inline]

Definition at line 129 of file PythonGlue.impl.h.

Referenced by PyContainer::Void().

00129 { return Py_None; }

PyTypeObject* GetPyString_Type ( ) [inline]

Definition at line 126 of file PythonGlue.impl.h.

00126 { return &PyString_Type; }

PyObject* GetPyTrue ( ) [inline]

Definition at line 130 of file PythonGlue.impl.h.

Referenced by PyContainer::True().

00130 { return Py_True; }

PyTypeObject* GetPyTuple_Type ( ) [inline]

Definition at line 127 of file PythonGlue.impl.h.

Referenced by cvsgui_RunCvs().

00127 { return &PyTuple_Type; }

PyTypeObject* GetPyType_Type ( ) [inline]

Definition at line 124 of file PythonGlue.impl.h.

00124 { return &PyType_Type; }

Generated on Sun Oct 21 12:42:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PythonImpl.cpp File Reference

common/PythonImpl.cpp File Reference

#include "stdafx.h"
#include "PythonImpl.h"
#include "CvsPrefs.h"
#include "umenu.h"

Include dependency graph for PythonImpl.cpp:

Include dependency graph

Go to the source code of this file.

Functions

int ParseUMENU (PyObject *v, UMENU *menu)

Function Documentation

int ParseUMENU | ( | PyObject * | v,
 |  | UMENU * | menu
 | ) | [static]

Definition at line 196 of file PythonImpl.cpp.

00197 {
00198     if(v->ob_type == PyMenuMgr::GetType())
00199     {
00200         *menu = *((PyMenuMgr::obj_t *)v)->m_object;
00201         return 1;
00202     }
00203
00204     return 0;
00205 }

Generated on Sun Oct 21 12:42:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PythonImpl.h File Reference

common/PythonImpl.h File Reference

#include "PythonContainer.h"
#include "CvsEntries.h"
#include "AppConsole.h"
#include "CPStr.h"
#include "umain.h"

Include dependency graph for PythonImpl.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | PyPersistent::obj_t
struct | PyCmdUI::obj_t
class | PyCmdUI
struct | PyMenuMgr::obj_t
struct | PyColorConsole::obj_t
class | PyColorConsole
struct | PyCvsEntry::obj_t
class | PyCvsEntry
class | PyMenuMgr
class | PyPersistent

Generated on Sun Oct 21 12:42:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PythonMacros.h File Reference

common/PythonMacros.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | TRY try
#define | CATCH_ALL(e) catch(const std::exception & e)
#define | END_CATCH_ALL
#define | _COMMON_PY_DECL_CLASS(c)
#define | PY_DECL_CLASS_INHERITED(c, a)
#define | PY_DECL_CLASS(c)
#define | PY_IMPL_CLASS(c, adoc)
#define | PY_DECL_METHOD(c, m)
#define | PY_BEGIN_IMPL_METHOD(c)
#define | PY_IMPL_METHOD(c, m, adoc) {#m, (binaryfunc)Py##c::_##m, METH_VARARGS, (char *)adoc},
#define | PY_END_IMPL_METHOD

Functions

void | PyHandleCvsguiError (const std::exception &e)
void | PyHandleCvsguiError (const char *msg)

Define Documentation

#define CATCH_ALL ( e ) catch(const std::exception & e)

Definition at line 31 of file PythonMacros.h.

Referenced by CCJTabView::AddView(), PyPersistent::Create(), PyCmdUI::Create(), PyMenuMgr::Create(), PyColorConsole::Create(), PyCvsEntry::Create(), CCJTabCtrlBar::CreateTabView(), DrawNode(), CWinLogData::Update(), cvsgui_GetHistoryAsXML(), cvsgui_GetMainMenuWidget(), cvsgui_GetTopMacroAdminMenu(), cvsgui_GetTopMacroSelectionMenu(), cvsgui_PromptEditMessage(), cvsgui_PromptMessage(), cvsgui_RunCvs(), and cvsgui_write().

#define END_CATCH_ALL

Definition at line 32 of file PythonMacros.h.

#define PY_BEGIN_IMPL_METHOD ( c )

Value:

PyMethodDef Py##c::m_methods[] = \
    {

Definition at line 136 of file PythonMacros.h.

#define PY_DECL_CLASS ( c )

Value:

_COMMON_PY_DECL_CLASS(c) \
    static PyObject *FindMethod(PyObject *self, char *name) \
    { \
        return Py_FindMethod(m_methods, self, name); \
    }

Definition at line 69 of file PythonMacros.h.

#define PY_DECL_CLASS_INHERITED | ( | c,
 |  | a | )

Value:

_COMMON_PY_DECL_CLASS(c) \
    static PyObject *FindMethod(PyObject *self, char *name) \
    { \
        PyObject *res = Py_FindMethod(m_methods, self, name); \
        if(res != NULL) \
            return res; \
        PyErr_Clear(); \
        return Py##a::FindMethod(self, name); \
    }

Definition at line 58 of file PythonMacros.h.

#define PY_DECL_METHOD | ( | c,
 |  | m | )

Value:

protected: \
    static PyObject *_##m(obj_t *self, PyObject *args) \
    { \
        TRY \
        { \
            if(self->m_object) \
                return self->m_object->##m(args); \
        } \
        CATCH_ALL(e) \
        { \
            PyHandleCvsguiError(e); \
            return NULL; \
        } \
        END_CATCH_ALL \
        return NULL; \
    } \
public: \
    PyObject *m(PyObject *args);

Definition at line 116 of file PythonMacros.h.

#define PY_END_IMPL_METHOD

Value:

{NULL, NULL} \
    };

Definition at line 143 of file PythonMacros.h.

#define PY_IMPL_CLASS | ( | c,
 |  | adoc | )

Definition at line 77 of file PythonMacros.h.

#define PY_IMPL_METHOD | ( | c,
 |  | m,
 |  | adoc | ) | {#m, (binaryfunc)Py##c::_##m, METH_VARARGS, (char *)adoc},

Definition at line 140 of file PythonMacros.h.

#define TRY try

Definition at line 30 of file PythonMacros.h.

#define _COMMON_PY_DECL_CLASS ( c )

Value:

public: \
    typedef struct \
    { \
        PyObject_HEAD \
        Py##c *m_object; \
    } obj_t; \
    static const char *m_doc; \
    static void dealloc(obj_t *self); \
    static PyObject *getattr(obj_t *self, char *name); \
    static PyAutoObject<obj_t> New(void); \
    static PyMethodDef m_methods[]; \
    static PyRegistry m_registry; \
    static inline PyTypeObject *GetType(void) { return &m_registry.m_type; } \
    static PyObject *Create(PyObject *selfptr, PyObject *args); \
    static void InitValues(PyObject *d);

Definition at line 41 of file PythonMacros.h.

Function Documentation

void PyHandleCvsguiError ( const char * msg )

Definition at line 125 of file PythonContainer.cpp.

Referenced by PyPersistent::Create(), PyCmdUI::Create(), PyMenuMgr::Create(), PyColorConsole::Create(), PyCvsEntry::Create(), cvsgui_GetHistoryAsXML(), cvsgui_GetMainMenuWidget(), cvsgui_GetTopMacroAdminMenu(), cvsgui_GetTopMacroSelectionMenu(), cvsgui_PromptEditMessage(), cvsgui_PromptMessage(), cvsgui_RunCvs(), and cvsgui_write().

00126 {
00127     PyErr_SetString(gCvsguiErr, msg);
00128 }

void PyHandleCvsguiError ( const std::exception & e )

Generated on Sun Oct 21 12:42:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ReleaseDlg.cpp File Reference

common/ReleaseDlg.cpp File Reference

#include "stdafx.h"
#include "ReleaseDlg.h"

Include dependency graph for ReleaseDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool CompatGetRelease (const char *dir, bool &removeDirectory)

Function Documentation

bool CompatGetRelease | ( | const char * | dir,
 |  | bool & | removeDirectory
 | ) |

Definition at line 76 of file ReleaseDlg.cpp.

00077 {
00078     bool userHitOK = false;
00079
00080 #ifdef WIN32
00081     CReleaseDlg oReleaseDlg;
00082     oReleaseDlg.m_strDirectory = dir;
00083
00084     if(oReleaseDlg.DoModal() == IDOK)
00085     {
00086         removeDirectory = oReleaseDlg.m_bRemoveDirectory == TRUE;
00087         userHitOK = true;
00088     }
00089 #endif /* WIN32 */
00090
00091 #ifdef qMacCvsPP
00092     userHitOK = true;
00093 #endif /* qMacCvsPP */
00094
00095 #if qUnix
00096     userHitOK = true;
00097 #endif // qUnix
00098
00099     return userHitOK;
00100 }

Generated on Sun Oct 21 12:42:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ReleaseDlg.h File Reference

common/ReleaseDlg.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_RELEASEDLG_H__12B5FA97_703E_4616_B361_F2917D45E54A__INCLUDED_

Functions

bool | CompatGetRelease (const char *dir, bool &removeDirectory)

Define Documentation

#define AFX_RELEASEDLG_H__12B5FA97_703E_4616_B361_F2917D45E54A__INCLUDED_

Definition at line 26 of file ReleaseDlg.h.

Function Documentation

bool CompatGetRelease | ( | const char * | dir,
 |  | bool & | removeDirectory
 | ) |

Definition at line 76 of file ReleaseDlg.cpp.

Referenced by CvsCmdReleaseFolder().

00077 {
00078     bool userHitOK = false;
00079
00080 #ifdef WIN32
00081     CReleaseDlg oReleaseDlg;
00082     oReleaseDlg.m_strDirectory = dir;
00083
00084     if(oReleaseDlg.DoModal() == IDOK)
00085     {
00086         removeDirectory = oReleaseDlg.m_bRemoveDirectory == TRUE;
00087         userHitOK = true;
00088     }
00089 #endif /* WIN32 */
00090
00091 #ifdef qMacCvsPP
00092     userHitOK = true;
00093 #endif /* qMacCvsPP */
00094
00095 #if qUnix
00096     userHitOK = true;
00097 #endif // qUnix
00098
00099     return userHitOK;
00100 }

Generated on Sun Oct 21 12:42:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


RtagDlg.cpp File Reference

common/RtagDlg.cpp File Reference

#include "stdafx.h"
#include "RtagDlg.h"
#include "CvsPrefs.h"
#include "UpdateDlg.h"

Include dependency graph for RtagDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool | CompatRtagCreate (bool &noRecurs, bool &overwriteExisting, UPStr &tagName, UPStr &modName, UPStr &date, UPStr &rev, bool &useMostRecent, bool &lookAttic)
bool | CompatRtagDelete (bool &noRecurs, bool &lookAttic, UPStr &tagName, UPStr &modName)
bool | CompatRtagBranch (bool &noRecurs, UPStr &branchName, UPStr &modName, UPStr &date, UPStr &rev, bool &useMostRecent, bool &lookAttic)

Function Documentation

bool CompatRtagBranch | ( | bool & | noRecurs,
 |  | UPStr & | branchName,
 |  | UPStr & | modName,
 |  | UPStr & | date,
 |  | UPStr & | rev,
 |  | bool & | useMostRecent,
 |  | bool & | lookAttic
 | ) |

Definition at line 1180 of file RtagDlg.cpp.

01183 {
01184     bool userHitOK = false;
01185
01186     static CPStr sLastModule;
01187     static CPStr sLastBranch;
01188     static CPStr sLastDate;
01189     static CPStr sLastRev;
01190
01191     bool hasDate = false;
01192     bool hasRev = false;
01193
01194     date = "";
01195     rev = "";
01196     branchName = "";
01197     modName = "";
01198     noRecurs = false;
01199     useMostRecent = false;
01200     lookAttic = false;
01201
01202 #ifdef WIN32
01203     CPropertySheet pages("Create branch settings");
01204     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
01205     CRtag_BRANCH page1(sLastModule, sLastBranch, hasDate, hasRev,
01206         sLastDate, sLastRev, noRecurs, useMostRecent, lookAttic);
01207     CGetPrefs_GLOBALS page2;
01208     pages.AddPage(&page1);
01209     pages.AddPage(&page2);
01210     if(pages.DoModal() == IDOK)
01211     {
01212         lookAttic = page1.m_attic == TRUE;
01213         sLastDate = page1.m_date;
01214         sLastRev = page1.m_rev;
01215         hasDate = page1.m_hasdate == TRUE;
01216         hasRev = page1.m_hasrev == TRUE;
01217         noRecurs = page1.m_norecurs == TRUE;
01218         useMostRecent = page1.m_match == TRUE;
01219         sLastModule = page1.m_modname;
01220         sLastBranch = page1.m_branchname;
01221
01222         page2.StoreValues();
01223         userHitOK = true;
01224     }
01225 #endif /* WIN32 */
01226 #if qUnix
01227     void *wid = UCreate_BranchModDlg();
01228
01229     UCvsRtagBranch *dlg = new UCvsRtagBranch();
01230     UCvsRtagBranch_MAIN *tab1 =
01231         new UCvsRtagBranch_MAIN(sLastModule, sLastBranch, hasDate, hasRev,
01232                                   sLastDate, sLastRev, noRecurs, useMostRecent,
01233                                   lookAttic);
01234     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01235     dlg->AddPage(tab1, UCvsRtagBranch::kTabGeneral, 0);
01236
01237     if(dlg->DoModal())
01238     {
01239         lookAttic = tab1->m_attic;
01240         sLastDate = tab1->m_date;
01241         sLastRev = tab1->m_rev;
01242         hasDate = tab1->m_hasdate;
01243         hasRev = tab1->m_hasrev;
01244         noRecurs = tab1->m_norecurs;
01245         useMostRecent = tab1->m_match;
01246         sLastModule = tab1->m_modname;
01247         sLastBranch = tab1->m_tagname;
01248
01249         userHitOK = true;
01250     }
01251
01252     delete dlg;
01253 #endif // qUnix
01254 #ifdef qMacCvsPP
01255     StDialogHandler theHandler(dlg_RtagBranch, LCommander::GetTopCommander());
01256     LWindow *theDialog = theHandler.GetDialog();
01257     ThrowIfNil_(theDialog);
01258     static UInt16 sRuntimePanel = 1;
01259
01260     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01261         (theDialog->FindPaneByID(item_MultiViewPrefs));
01262     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01263
01264     multiView->SwitchToPanel(3);
01265     DoDataExchange_Globals(theDialog, true);
01266     multiView->SwitchToPanel(2);
01267     DoDataExchange_RtagBranchOptions(theDialog, noRecurs, true);
01268     multiView->SwitchToPanel(1);
01269     DoDataExchange_RtagBranchMain(theDialog, sLastModule, sLastBranch,
01270         hasDate, hasRev, sLastDate, sLastRev,
01271         useMostRecent, lookAttic, true);
01272
01273     groupView->SetValue(sRuntimePanel);
01274     theDialog->Show();
01275     MessageT hitMessage;
01276     while (true)
01277     {       // Let DialogHandler process events
01278         hitMessage = theHandler.DoDialog();
01279
01280         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01281             break;
01282     }
01283     theDialog->Hide();
01284     sRuntimePanel = groupView->GetValue();
01285
01286     if(hitMessage == msg_OK)
01287     {
01288         multiView->SwitchToPanel(1);
01289         DoDataExchange_RtagBranchMain(theDialog, sLastModule, sLastBranch,
01290             hasDate, hasRev, sLastDate, sLastRev,
01291             useMostRecent, lookAttic, false);
01292         multiView->SwitchToPanel(2);
01293         DoDataExchange_RtagBranchOptions(theDialog, noRecurs, false);
01294         multiView->SwitchToPanel(3);
01295         DoDataExchange_Globals(theDialog, false);
01296         userHitOK = true;
01297     }
01298 #endif /* qMacCvsPP */
01299
01300     if(userHitOK)
01301     {
01302         if(hasDate && !sLastDate.empty())
01303             date = sLastDate;
01304         if(hasRev && !sLastRev.empty())
01305             rev = sLastRev;
01306
01307         branchName = sLastBranch;
01308         modName = sLastModule;
01309
01310         gCvsPrefs.save();
01311     }
01312
01313     return userHitOK;
01314 }

bool CompatRtagCreate | ( | bool & | noRecurs,
 |  | bool & | overwriteExisting,
 |  | UPStr & | tagName,
 |  | UPStr & | modName,
 |  | UPStr & | date,
 |  | UPStr & | rev,
 |  | bool & | useMostRecent,
 |  | bool & | lookAttic
 | ) |

Definition at line 936 of file RtagDlg.cpp.

00939 {
00940     bool userHitOK = false;
00941
00942     static CPStr sLastModule;
00943     static CPStr sLastTag;
00944     static CPStr sLastDate;
00945     static CPStr sLastRev;
00946
00947     bool hasDate = false;
00948     bool hasRev = false;
00949
00950     date = "";
00951     rev = "";
00952     tagName = "";
00953     modName = "";
00954     noRecurs = false;
00955     overwriteExisting = false;
00956     useMostRecent = false;
00957     lookAttic = false;
00958
00959 #ifdef WIN32
00960     CPropertySheet pages("Create tag settings");
00961     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00962     CRtag_CREATE page1(sLastModule, sLastTag, hasDate, hasRev,
00963         sLastDate, sLastRev, noRecurs, overwriteExisting,
00964         useMostRecent, lookAttic);
00965     CGetPrefs_GLOBALS page2;
00966     pages.AddPage(&page1);
00967     pages.AddPage(&page2);
00968     if(pages.DoModal() == IDOK)
00969     {
00970         lookAttic = page1.m_attic == TRUE;
00971         sLastDate = page1.m_date;
00972         sLastRev = page1.m_rev;
00973         hasDate = page1.m_hasdate == TRUE;
00974         hasRev = page1.m_hasrev == TRUE;
00975         noRecurs = page1.m_norecurs == TRUE;
00976         useMostRecent = page1.m_match == TRUE;
00977         sLastModule = page1.m_modname;
00978         sLastTag = page1.m_tagname;
00979         overwriteExisting = page1.m_overwrite == TRUE;
00980
00981         page2.StoreValues();
00982         userHitOK = true;
00983     }
00984 #endif /* WIN32 */
00985 #if qUnix
00986     void *wid = UCreate_TagModDlg();
00987
00988     UCvsRtagCreate *dlg = new UCvsRtagCreate();
00989     UCvsRtagCreate_MAIN *tab1 =
00990         new UCvsRtagCreate_MAIN(sLastModule, sLastTag, hasDate, hasRev,
00991                                 sLastDate, sLastRev, noRecurs, overwriteExisting,
00992                                 useMostRecent, lookAttic);
00993     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00994     dlg->AddPage(tab1, UCvsRtagCreate::kTabGeneral, 0);
00995
00996     if(dlg->DoModal())
00997     {
00998         lookAttic = tab1->m_attic;
00999         sLastDate = tab1->m_date;
01000         sLastRev = tab1->m_rev;
01001         hasDate = tab1->m_hasdate;
01002         hasRev = tab1->m_hasrev;
01003         noRecurs = tab1->m_norecurs;
01004         useMostRecent = tab1->m_match;
01005         sLastModule = tab1->m_modname;
01006         sLastTag = tab1->m_tagname;
01007         overwriteExisting = tab1->m_overwrite;
01008
01009         userHitOK = true;
01010     }
01011
01012     delete dlg;
01013 #endif // qUnix
01014 #ifdef qMacCvsPP
01015     StDialogHandler theHandler(dlg_RtagCreate, LCommander::GetTopCommander());
01016     LWindow *theDialog = theHandler.GetDialog();
01017     ThrowIfNil_(theDialog);
01018     static UInt16 sRuntimePanel = 1;
01019
01020     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01021         (theDialog->FindPaneByID(item_MultiViewPrefs));
01022     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01023
01024     multiView->SwitchToPanel(3);
01025     DoDataExchange_Globals(theDialog, true);
01026     multiView->SwitchToPanel(2);
01027     DoDataExchange_RtagCreateOptions(theDialog, noRecurs, overwriteExisting, true);
01028     multiView->SwitchToPanel(1);
01029     DoDataExchange_RtagCreateMain(theDialog, sLastModule, sLastTag,
01030         hasDate, hasRev, sLastDate, sLastRev,
01031         useMostRecent, lookAttic, true);
01032
01033     groupView->SetValue(sRuntimePanel);
01034     theDialog->Show();
01035     MessageT hitMessage;
01036     while (true)
01037     {       // Let DialogHandler process events
01038         hitMessage = theHandler.DoDialog();
01039
01040         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01041             break;
01042     }
01043     theDialog->Hide();
01044     sRuntimePanel = groupView->GetValue();
01045
01046     if(hitMessage == msg_OK)
01047     {
01048         multiView->SwitchToPanel(1);
01049         DoDataExchange_RtagCreateMain(theDialog, sLastModule, sLastTag,
01050             hasDate, hasRev, sLastDate, sLastRev,
01051             useMostRecent, lookAttic, false);
01052         multiView->SwitchToPanel(2);
01053         DoDataExchange_RtagCreateOptions(theDialog, noRecurs, overwriteExisting, false);
01054         multiView->SwitchToPanel(3);
01055         DoDataExchange_Globals(theDialog, false);
01056         userHitOK = true;
01057     }
01058 #endif /* qMacCvsPP */
01059
01060     if(userHitOK)
01061     {
01062         if(hasDate && !sLastDate.empty())
01063             date = sLastDate;
01064         if(hasRev && !sLastRev.empty())
01065             rev = sLastRev;
01066
01067         tagName = sLastTag;
01068         modName = sLastModule;
01069
01070         gCvsPrefs.save();
01071     }
01072
01073     return userHitOK;
01074 }

bool CompatRtagDelete | ( | bool & | noRecurs,
 |  | bool & | lookAttic,
 |  | UPStr & | tagName,
 |  | UPStr & | modName
 | ) |

Definition at line 1076 of file RtagDlg.cpp.

01078 {
01079
01080     bool userHitOK = false;
01081
01082     static CPStr sLastModule;
01083     static CPStr sLastTag;
01084
01085     tagName = "";
01086     modName = "";
01087     noRecurs = false;
01088     lookAttic = false;
01089
01090 #ifdef WIN32
01091     CPropertySheet pages("Delete tag settings");
01092     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
01093     CRtag_DELETE page1(sLastModule, sLastTag, noRecurs, lookAttic);
01094     CGetPrefs_GLOBALS page2;
01095     pages.AddPage(&page1);
01096     pages.AddPage(&page2);
01097     if(pages.DoModal() == IDOK)
01098     {
01099         lookAttic = page1.m_attic == TRUE;
01100         noRecurs = page1.m_norecurs == TRUE;
01101         sLastModule = page1.m_modname;
01102         sLastTag = page1.m_tagname;
01103
01104         page2.StoreValues();
01105         userHitOK = true;
01106     }
01107 #endif /* WIN32 */
01108 #if qUnix
01109     void *wid = UCreate_UntagModDlg();
01110
01111     UCvsRtagDel *dlg = new UCvsRtagDel();
01112     UCvsRtagDel_MAIN *tab1 = new UCvsRtagDel_MAIN(sLastModule, sLastTag,
01113                                                   noRecurs, lookAttic);
01114     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01115     dlg->AddPage(tab1, UCvsRtagDel::kTabGeneral, 0);
01116
01117     if(dlg->DoModal())
01118     {
01119         lookAttic = tab1->m_attic;
01120         noRecurs = tab1->m_norecurs;
01121         sLastModule = tab1->m_modname;
01122         sLastTag = tab1->m_tagname;
01123
01124         userHitOK = true;
01125     }
01126
01127     delete dlg;
01128 #endif // qUnix
01129 #ifdef qMacCvsPP
01130     StDialogHandler theHandler(dlg_RtagDelete, LCommander::GetTopCommander());
01131     LWindow *theDialog = theHandler.GetDialog();
01132     ThrowIfNil_(theDialog);
01133     static UInt16 sRuntimePanel = 1;
01134
01135     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01136         (theDialog->FindPaneByID(item_MultiViewPrefs));
01137     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01138
01139     multiView->SwitchToPanel(2);
01140     DoDataExchange_Globals(theDialog, true);
01141     multiView->SwitchToPanel(1);
01142     DoDataExchange_RtagDeleteMain(theDialog, sLastModule, sLastTag,
01143         noRecurs, lookAttic, true);
01144
01145     groupView->SetValue(sRuntimePanel);
01146     theDialog->Show();
01147     MessageT hitMessage;
01148     while (true)
01149     {       // Let DialogHandler process events
01150         hitMessage = theHandler.DoDialog();
01151
01152         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01153             break;
01154     }
01155     theDialog->Hide();
01156     sRuntimePanel = groupView->GetValue();
01157
01158     if(hitMessage == msg_OK)
01159     {
01160         multiView->SwitchToPanel(1);
01161         DoDataExchange_RtagDeleteMain(theDialog, sLastModule, sLastTag,
01162             noRecurs, lookAttic, false);
01163         multiView->SwitchToPanel(2);
01164         DoDataExchange_Globals(theDialog, false);
01165         userHitOK = true;
01166     }
01167 #endif /* qMacCvsPP */
01168
01169     if(userHitOK)
01170     {
01171         tagName = sLastTag;
01172         modName = sLastModule;
01173
01174         gCvsPrefs.save();
01175     }
01176
01177     return userHitOK;
01178 }

Generated on Sun Oct 21 12:42:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


RtagDlg.h File Reference

common/RtagDlg.h File Reference

#include "CPStr.h"

Include dependency graph for RtagDlg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_RTAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Functions

bool | CompatRtagCreate (bool &noRecurs, bool &overwriteExisting, UPStr &tagName, UPStr &modName, UPStr &date, UPStr &rev, bool &useMostRecent, bool &lookAttic)
bool | CompatRtagDelete (bool &noRecurs, bool &lookAttic, UPStr &tagName, UPStr &modName)
bool | CompatRtagBranch (bool &noRecurs, UPStr &branchName, UPStr &modName, UPStr &date, UPStr &rev, bool &useMostRecent, bool &lookAttic)

Define Documentation

#define AFX_RTAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file RtagDlg.h.

Function Documentation

bool CompatRtagBranch | ( | bool & | noRecurs,
 |  | UPStr & | branchName,
 |  | UPStr & | modName,
 |  | UPStr & | date,
 |  | UPStr & | rev,
 |  | bool & | useMostRecent,
 |  | bool & | lookAttic
 | ) |

Definition at line 1180 of file RtagDlg.cpp.

Referenced by CvsCmdRtagBranch().

01183 {
01184     bool userHitOK = false;
01185
01186     static CPStr sLastModule;
01187     static CPStr sLastBranch;
01188     static CPStr sLastDate;
01189     static CPStr sLastRev;
01190
01191     bool hasDate = false;
01192     bool hasRev = false;
01193
01194     date = "";
01195     rev = "";
01196     branchName = "";
01197     modName = "";
01198     noRecurs = false;
01199     useMostRecent = false;
01200     lookAttic = false;
01201
01202 #ifdef WIN32
01203     CPropertySheet pages("Create branch settings");
01204     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
01205     CRtag_BRANCH page1(sLastModule, sLastBranch, hasDate, hasRev,
01206         sLastDate, sLastRev, noRecurs, useMostRecent, lookAttic);
01207     CGetPrefs_GLOBALS page2;
01208     pages.AddPage(&page1);
01209     pages.AddPage(&page2);
01210     if(pages.DoModal() == IDOK)
01211     {
01212         lookAttic = page1.m_attic == TRUE;
01213         sLastDate = page1.m_date;
01214         sLastRev = page1.m_rev;
01215         hasDate = page1.m_hasdate == TRUE;
01216         hasRev = page1.m_hasrev == TRUE;
01217         noRecurs = page1.m_norecurs == TRUE;
01218         useMostRecent = page1.m_match == TRUE;
01219         sLastModule = page1.m_modname;
01220         sLastBranch = page1.m_branchname;
01221
01222         page2.StoreValues();
01223         userHitOK = true;
01224     }
01225 #endif /* WIN32 */
01226 #if qUnix
01227     void *wid = UCreate_BranchModDlg();
01228
01229     UCvsRtagBranch *dlg = new UCvsRtagBranch();
01230     UCvsRtagBranch_MAIN *tab1 =
01231         new UCvsRtagBranch_MAIN(sLastModule, sLastBranch, hasDate, hasRev,
01232                                   sLastDate, sLastRev, noRecurs, useMostRecent,
01233                                   lookAttic);
01234     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01235     dlg->AddPage(tab1, UCvsRtagBranch::kTabGeneral, 0);
01236
01237     if(dlg->DoModal())
01238     {
01239         lookAttic = tab1->m_attic;
01240         sLastDate = tab1->m_date;
01241         sLastRev = tab1->m_rev;
01242         hasDate = tab1->m_hasdate;
01243         hasRev = tab1->m_hasrev;
01244         noRecurs = tab1->m_norecurs;
01245         useMostRecent = tab1->m_match;
01246         sLastModule = tab1->m_modname;
01247         sLastBranch = tab1->m_tagname;
01248
01249         userHitOK = true;
01250     }
01251
01252     delete dlg;
01253 #endif // qUnix
01254 #ifdef qMacCvsPP
01255     StDialogHandler theHandler(dlg_RtagBranch, LCommander::GetTopCommander());
01256     LWindow *theDialog = theHandler.GetDialog();
01257     ThrowIfNil_(theDialog);
01258     static UInt16 sRuntimePanel = 1;
01259
01260     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01261         (theDialog->FindPaneByID(item_MultiViewPrefs));
01262     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01263
01264     multiView->SwitchToPanel(3);
01265     DoDataExchange_Globals(theDialog, true);
01266     multiView->SwitchToPanel(2);
01267     DoDataExchange_RtagBranchOptions(theDialog, noRecurs, true);
01268     multiView->SwitchToPanel(1);
01269     DoDataExchange_RtagBranchMain(theDialog, sLastModule, sLastBranch,
01270         hasDate, hasRev, sLastDate, sLastRev,
01271         useMostRecent, lookAttic, true);
01272
01273     groupView->SetValue(sRuntimePanel);
01274     theDialog->Show();
01275     MessageT hitMessage;
01276     while (true)
01277     {       // Let DialogHandler process events
01278         hitMessage = theHandler.DoDialog();
01279
01280         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01281             break;
01282     }
01283     theDialog->Hide();
01284     sRuntimePanel = groupView->GetValue();
01285
01286     if(hitMessage == msg_OK)
01287     {
01288         multiView->SwitchToPanel(1);
01289         DoDataExchange_RtagBranchMain(theDialog, sLastModule, sLastBranch,
01290             hasDate, hasRev, sLastDate, sLastRev,
01291             useMostRecent, lookAttic, false);
01292         multiView->SwitchToPanel(2);
01293         DoDataExchange_RtagBranchOptions(theDialog, noRecurs, false);
01294         multiView->SwitchToPanel(3);
01295         DoDataExchange_Globals(theDialog, false);
01296         userHitOK = true;
01297     }
01298 #endif /* qMacCvsPP */
01299
01300     if(userHitOK)
01301     {
01302         if(hasDate && !sLastDate.empty())
01303             date = sLastDate;
01304         if(hasRev && !sLastRev.empty())
01305             rev = sLastRev;
01306
01307         branchName = sLastBranch;
01308         modName = sLastModule;
01309
01310         gCvsPrefs.save();
01311     }
01312
01313     return userHitOK;
01314 }

bool CompatRtagCreate | ( | bool & | noRecurs,
 |  | bool & | overwriteExisting,
 |  | UPStr & | tagName,
 |  | UPStr & | modName,
 |  | UPStr & | date,
 |  | UPStr & | rev,
 |  | bool & | useMostRecent,
 |  | bool & | lookAttic
 | ) |

Definition at line 936 of file RtagDlg.cpp.

Referenced by CvsCmdRtagCreate().

00939 {
00940     bool userHitOK = false;
00941
00942     static CPStr sLastModule;
00943     static CPStr sLastTag;
00944     static CPStr sLastDate;
00945     static CPStr sLastRev;
00946
00947     bool hasDate = false;
00948     bool hasRev = false;
00949
00950     date = "";
00951     rev = "";
00952     tagName = "";
00953     modName = "";
00954     noRecurs = false;
00955     overwriteExisting = false;
00956     useMostRecent = false;
00957     lookAttic = false;
00958
00959 #ifdef WIN32
00960     CPropertySheet pages("Create tag settings");
00961     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00962     CRtag_CREATE page1(sLastModule, sLastTag, hasDate, hasRev,
00963         sLastDate, sLastRev, noRecurs, overwriteExisting,
00964         useMostRecent, lookAttic);
00965     CGetPrefs_GLOBALS page2;
00966     pages.AddPage(&page1);
00967     pages.AddPage(&page2);
00968     if(pages.DoModal() == IDOK)
00969     {
00970         lookAttic = page1.m_attic == TRUE;
00971         sLastDate = page1.m_date;
00972         sLastRev = page1.m_rev;
00973         hasDate = page1.m_hasdate == TRUE;
00974         hasRev = page1.m_hasrev == TRUE;
00975         noRecurs = page1.m_norecurs == TRUE;
00976         useMostRecent = page1.m_match == TRUE;
00977         sLastModule = page1.m_modname;
00978         sLastTag = page1.m_tagname;
00979         overwriteExisting = page1.m_overwrite == TRUE;
00980
00981         page2.StoreValues();
00982         userHitOK = true;
00983     }
00984 #endif /* WIN32 */
00985 #if qUnix
00986     void *wid = UCreate_TagModDlg();
00987
00988     UCvsRtagCreate *dlg = new UCvsRtagCreate();
00989     UCvsRtagCreate_MAIN *tab1 =
00990         new UCvsRtagCreate_MAIN(sLastModule, sLastTag, hasDate, hasRev,
00991                                 sLastDate, sLastRev, noRecurs, overwriteExisting,
00992                                 useMostRecent, lookAttic);
00993     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00994     dlg->AddPage(tab1, UCvsRtagCreate::kTabGeneral, 0);
00995
00996     if(dlg->DoModal())
00997     {
00998         lookAttic = tab1->m_attic;
00999         sLastDate = tab1->m_date;
01000         sLastRev = tab1->m_rev;
01001         hasDate = tab1->m_hasdate;
01002         hasRev = tab1->m_hasrev;
01003         noRecurs = tab1->m_norecurs;
01004         useMostRecent = tab1->m_match;
01005         sLastModule = tab1->m_modname;
01006         sLastTag = tab1->m_tagname;
01007         overwriteExisting = tab1->m_overwrite;
01008
01009         userHitOK = true;
01010     }
01011
01012     delete dlg;
01013 #endif // qUnix
01014 #ifdef qMacCvsPP
01015     StDialogHandler theHandler(dlg_RtagCreate, LCommander::GetTopCommander());
01016     LWindow *theDialog = theHandler.GetDialog();
01017     ThrowIfNil_(theDialog);
01018     static UInt16 sRuntimePanel = 1;
01019
01020     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01021         (theDialog->FindPaneByID(item_MultiViewPrefs));
01022     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01023
01024     multiView->SwitchToPanel(3);
01025     DoDataExchange_Globals(theDialog, true);
01026     multiView->SwitchToPanel(2);
01027     DoDataExchange_RtagCreateOptions(theDialog, noRecurs, overwriteExisting, true);
01028     multiView->SwitchToPanel(1);
01029     DoDataExchange_RtagCreateMain(theDialog, sLastModule, sLastTag,
01030         hasDate, hasRev, sLastDate, sLastRev,
01031         useMostRecent, lookAttic, true);
01032
01033     groupView->SetValue(sRuntimePanel);
01034     theDialog->Show();
01035     MessageT hitMessage;
01036     while (true)
01037     {       // Let DialogHandler process events
01038         hitMessage = theHandler.DoDialog();
01039
01040         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01041             break;
01042     }
01043     theDialog->Hide();
01044     sRuntimePanel = groupView->GetValue();
01045
01046     if(hitMessage == msg_OK)
01047     {
01048         multiView->SwitchToPanel(1);
01049         DoDataExchange_RtagCreateMain(theDialog, sLastModule, sLastTag,
01050             hasDate, hasRev, sLastDate, sLastRev,
01051             useMostRecent, lookAttic, false);
01052         multiView->SwitchToPanel(2);
01053         DoDataExchange_RtagCreateOptions(theDialog, noRecurs, overwriteExisting, false);
01054         multiView->SwitchToPanel(3);
01055         DoDataExchange_Globals(theDialog, false);
01056         userHitOK = true;
01057     }
01058 #endif /* qMacCvsPP */
01059
01060     if(userHitOK)
01061     {
01062         if(hasDate && !sLastDate.empty())
01063             date = sLastDate;
01064         if(hasRev && !sLastRev.empty())
01065             rev = sLastRev;
01066
01067         tagName = sLastTag;
01068         modName = sLastModule;
01069
01070         gCvsPrefs.save();
01071     }
01072
01073     return userHitOK;
01074 }

bool CompatRtagDelete | ( | bool & | noRecurs,
 |  | bool & | lookAttic,
 |  | UPStr & | tagName,
 |  | UPStr & | modName
 | ) |

Definition at line 1076 of file RtagDlg.cpp.

Referenced by CvsCmdRtagDelete().

01078 {
01079
01080     bool userHitOK = false;
01081
01082     static CPStr sLastModule;
01083     static CPStr sLastTag;
01084
01085     tagName = "";
01086     modName = "";
01087     noRecurs = false;
01088     lookAttic = false;
01089
01090 #ifdef WIN32
01091     CPropertySheet pages("Delete tag settings");
01092     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
01093     CRtag_DELETE page1(sLastModule, sLastTag, noRecurs, lookAttic);
01094     CGetPrefs_GLOBALS page2;
01095     pages.AddPage(&page1);
01096     pages.AddPage(&page2);
01097     if(pages.DoModal() == IDOK)
01098     {
01099         lookAttic = page1.m_attic == TRUE;
01100         noRecurs = page1.m_norecurs == TRUE;
01101         sLastModule = page1.m_modname;
01102         sLastTag = page1.m_tagname;
01103
01104         page2.StoreValues();
01105         userHitOK = true;
01106     }
01107 #endif /* WIN32 */
01108 #if qUnix
01109     void *wid = UCreate_UntagModDlg();
01110
01111     UCvsRtagDel *dlg = new UCvsRtagDel();
01112     UCvsRtagDel_MAIN *tab1 = new UCvsRtagDel_MAIN(sLastModule, sLastTag,
01113                                                   noRecurs, lookAttic);
01114     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
01115     dlg->AddPage(tab1, UCvsRtagDel::kTabGeneral, 0);
01116
01117     if(dlg->DoModal())
01118     {
01119         lookAttic = tab1->m_attic;
01120         noRecurs = tab1->m_norecurs;
01121         sLastModule = tab1->m_modname;
01122         sLastTag = tab1->m_tagname;
01123
01124         userHitOK = true;
01125     }
01126
01127     delete dlg;
01128 #endif // qUnix
01129 #ifdef qMacCvsPP
01130     StDialogHandler theHandler(dlg_RtagDelete, LCommander::GetTopCommander());
01131     LWindow *theDialog = theHandler.GetDialog();
01132     ThrowIfNil_(theDialog);
01133     static UInt16 sRuntimePanel = 1;
01134
01135     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
01136         (theDialog->FindPaneByID(item_MultiViewPrefs));
01137     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
01138
01139     multiView->SwitchToPanel(2);
01140     DoDataExchange_Globals(theDialog, true);
01141     multiView->SwitchToPanel(1);
01142     DoDataExchange_RtagDeleteMain(theDialog, sLastModule, sLastTag,
01143         noRecurs, lookAttic, true);
01144
01145     groupView->SetValue(sRuntimePanel);
01146     theDialog->Show();
01147     MessageT hitMessage;
01148     while (true)
01149     {       // Let DialogHandler process events
01150         hitMessage = theHandler.DoDialog();
01151
01152         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
01153             break;
01154     }
01155     theDialog->Hide();
01156     sRuntimePanel = groupView->GetValue();
01157
01158     if(hitMessage == msg_OK)
01159     {
01160         multiView->SwitchToPanel(1);
01161         DoDataExchange_RtagDeleteMain(theDialog, sLastModule, sLastTag,
01162             noRecurs, lookAttic, false);
01163         multiView->SwitchToPanel(2);
01164         DoDataExchange_Globals(theDialog, false);
01165         userHitOK = true;
01166     }
01167 #endif /* qMacCvsPP */
01168
01169     if(userHitOK)
01170     {
01171         tagName = sLastTag;
01172         modName = sLastModule;
01173
01174         gCvsPrefs.save();
01175     }
01176
01177     return userHitOK;
01178 }

Generated on Sun Oct 21 12:42:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


SortList.h File Reference

common/SortList.h File Reference

#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>

Include dependency graph for SortList.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CSortList

Enumerations

enum | computeSort { computeNone, computeLR }

Enumeration Type Documentation

enum computeSort

Enumeration values:
computeNone
computeLR

Definition at line 38 of file SortList.h.

00039 {
00040     computeNone,
00041     computeLR
00042 } computeSort;

Generated on Sun Oct 21 12:42:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TagDlg.cpp File Reference

common/TagDlg.cpp File Reference

#include "stdafx.h"
#include "TagDlg.h"
#include "CvsPrefs.h"
#include "UpdateDlg.h"

Include dependency graph for TagDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

bool | CompatTagCreate (bool &noRecurs, bool &overwriteExisting, UPStr &tagName, bool &checkUnmod)
bool | CompatTagDelete (bool &noRecurs, UPStr &tagName)
bool | CompatTagBranch (bool &noRecurs, UPStr &branchName, bool &checkUnmod)

Function Documentation

bool CompatTagBranch | ( | bool & | noRecurs,
 |  | UPStr & | branchName,
 |  | bool & | checkUnmod
 | ) |

Definition at line 842 of file TagDlg.cpp.

00844 {
00845     bool userHitOK = false;
00846
00847     static CPStr sLastBranch;
00848
00849     branchName = "";
00850     noRecurs = false;
00851     checkUnmod = false;
00852
00853 #ifdef WIN32
00854     CPropertySheet pages("Create branch settings");
00855     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00856     CTag_BRANCH page1(sLastBranch, noRecurs, checkUnmod);
00857     CGetPrefs_GLOBALS page2;
00858     pages.AddPage(&page1);
00859     pages.AddPage(&page2);
00860     if(pages.DoModal() == IDOK)
00861     {
00862         checkUnmod = page1.m_checkunmod == TRUE;
00863         noRecurs = page1.m_norecurs == TRUE;
00864         sLastBranch = page1.m_branchname;
00865
00866         page2.StoreValues();
00867         userHitOK = true;
00868     }
00869 #endif /* WIN32 */
00870 #if qUnix
00871     void *wid = UCreate_BranchDlg();
00872
00873     UCvsTagBranch *dlg = new UCvsTagBranch();
00874     UCvsTagBranch_MAIN *tab1 = new UCvsTagBranch_MAIN(sLastBranch, noRecurs, checkUnmod);
00875     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00876     dlg->AddPage(tab1, UCvsTagBranch::kTabGeneral, 0);
00877
00878     if(dlg->DoModal())
00879     {
00880         checkUnmod = tab1->m_checkunmod;
00881         noRecurs = tab1->m_norecurs;
00882         sLastBranch = tab1->m_tagname;
00883
00884         userHitOK = true;
00885     }
00886
00887     delete dlg;
00888 #endif // qUnix
00889 #ifdef qMacCvsPP
00890     StDialogHandler theHandler(dlg_TagBranch, LCommander::GetTopCommander());
00891     LWindow *theDialog = theHandler.GetDialog();
00892     ThrowIfNil_(theDialog);
00893     static UInt16 sRuntimePanel = 1;
00894
00895     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00896         (theDialog->FindPaneByID(item_MultiViewPrefs));
00897     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00898
00899     multiView->SwitchToPanel(2);
00900     DoDataExchange_Globals(theDialog, true);
00901     multiView->SwitchToPanel(1);
00902     DoDataExchange_TagBranchMain(theDialog, sLastBranch,
00903         noRecurs, checkUnmod, true);
00904
00905     groupView->SetValue(sRuntimePanel);
00906     theDialog->Show();
00907     MessageT hitMessage;
00908     while (true)
00909     {       // Let DialogHandler process events
00910         hitMessage = theHandler.DoDialog();
00911
00912         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00913             break;
00914     }
00915     theDialog->Hide();
00916     sRuntimePanel = groupView->GetValue();
00917
00918     if(hitMessage == msg_OK)
00919     {
00920         multiView->SwitchToPanel(1);
00921         DoDataExchange_TagBranchMain(theDialog, sLastBranch,
00922             noRecurs, checkUnmod, false);
00923         multiView->SwitchToPanel(2);
00924         DoDataExchange_Globals(theDialog, false);
00925         userHitOK = true;
00926     }
00927 #endif /* qMacCvsPP */
00928
00929     if(userHitOK)
00930     {
00931         branchName = sLastBranch;
00932
00933         gCvsPrefs.save();
00934     }
00935
00936     return userHitOK;
00937 }

bool CompatTagCreate | ( | bool & | noRecurs,
 |  | bool & | overwriteExisting,
 |  | UPStr & | tagName,
 |  | bool & | checkUnmod
 | ) |

Definition at line 648 of file TagDlg.cpp.

00650 {
00651     bool userHitOK = false;
00652
00653     static CPStr sLastTag;
00654
00655     tagName = "";
00656     noRecurs = false;
00657     overwriteExisting = false;
00658     checkUnmod = false;
00659
00660 #ifdef WIN32
00661     CPropertySheet pages("Create tag settings");
00662     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00663     CTag_CREATE page1(sLastTag, noRecurs, overwriteExisting,
00664         checkUnmod);
00665     CGetPrefs_GLOBALS page2;
00666     pages.AddPage(&page1);
00667     pages.AddPage(&page2);
00668     if(pages.DoModal() == IDOK)
00669     {
00670         checkUnmod = page1.m_checkunmod == TRUE;
00671         noRecurs = page1.m_norecurs == TRUE;
00672         sLastTag = page1.m_tagname;
00673         overwriteExisting = page1.m_overwrite == TRUE;
00674
00675         page2.StoreValues();
00676         userHitOK = true;
00677     }
00678 #endif /* WIN32 */
00679 #if qUnix
00680     void *wid = UCreate_TagDlg();
00681
00682     UCvsTagCreate *dlg = new UCvsTagCreate();
00683     UCvsTagCreate_MAIN *tab1 =
00684         new UCvsTagCreate_MAIN(sLastTag, noRecurs, overwriteExisting, checkUnmod);
00685     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00686     dlg->AddPage(tab1, UCvsTagCreate::kTabGeneral, 0);
00687
00688     if(dlg->DoModal())
00689     {
00690         checkUnmod = tab1->m_checkunmod;
00691         noRecurs = tab1->m_norecurs;
00692         sLastTag = tab1->m_tagname;
00693         overwriteExisting = tab1->m_overwrite;
00694
00695         userHitOK = true;
00696     }
00697
00698     delete dlg;
00699 #endif // qUnix
00700 #ifdef qMacCvsPP
00701     StDialogHandler theHandler(dlg_TagCreate, LCommander::GetTopCommander());
00702     LWindow *theDialog = theHandler.GetDialog();
00703     ThrowIfNil_(theDialog);
00704     static UInt16 sRuntimePanel = 1;
00705
00706     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00707         (theDialog->FindPaneByID(item_MultiViewPrefs));
00708     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00709
00710     multiView->SwitchToPanel(2);
00711     DoDataExchange_Globals(theDialog, true);
00712     multiView->SwitchToPanel(1);
00713     DoDataExchange_TagCreateMain(theDialog, sLastTag,
00714         noRecurs, overwriteExisting, checkUnmod, true);
00715
00716     groupView->SetValue(sRuntimePanel);
00717     theDialog->Show();
00718     MessageT hitMessage;
00719     while (true)
00720     {       // Let DialogHandler process events
00721         hitMessage = theHandler.DoDialog();
00722
00723         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00724             break;
00725     }
00726     theDialog->Hide();
00727     sRuntimePanel = groupView->GetValue();
00728
00729     if(hitMessage == msg_OK)
00730     {
00731         multiView->SwitchToPanel(1);
00732         DoDataExchange_TagCreateMain(theDialog, sLastTag,
00733             noRecurs, overwriteExisting, checkUnmod, false);
00734         multiView->SwitchToPanel(2);
00735         DoDataExchange_Globals(theDialog, false);
00736         userHitOK = true;
00737     }
00738 #endif /* qMacCvsPP */
00739
00740     if(userHitOK)
00741     {
00742         tagName = sLastTag;
00743
00744         gCvsPrefs.save();
00745     }
00746
00747     return userHitOK;
00748 }

bool CompatTagDelete | ( | bool & | noRecurs,
 |  | UPStr & | tagName
 | ) |

Definition at line 750 of file TagDlg.cpp.

00751 {
00752
00753     bool userHitOK = false;
00754
00755     static CPStr sLastTag;
00756
00757     tagName = "";
00758     noRecurs = false;
00759
00760 #ifdef WIN32
00761     CPropertySheet pages("Delete tag settings");
00762     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00763     CTag_DELETE page1(sLastTag, noRecurs);
00764     CGetPrefs_GLOBALS page2;
00765     pages.AddPage(&page1);
00766     pages.AddPage(&page2);
00767     if(pages.DoModal() == IDOK)
00768     {
00769         noRecurs = page1.m_norecurs == TRUE;
00770         sLastTag = page1.m_tagname;
00771
00772         page2.StoreValues();
00773         userHitOK = true;
00774     }
00775 #endif /* WIN32 */
00776 #if qUnix
00777     void *wid = UCreate_UntagDlg();
00778
00779     UCvsTagDel *dlg = new UCvsTagDel();
00780     UCvsTagDel_MAIN *tab1 = new UCvsTagDel_MAIN(sLastTag, noRecurs);
00781     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00782     dlg->AddPage(tab1, UCvsTagDel::kTabGeneral, 0);
00783
00784     if(dlg->DoModal())
00785     {
00786         noRecurs = tab1->m_norecurs;
00787         sLastTag = tab1->m_tagname;
00788
00789         userHitOK = true;
00790     }
00791
00792     delete dlg;
00793 #endif // qUnix
00794 #ifdef qMacCvsPP
00795     StDialogHandler theHandler(dlg_TagDelete, LCommander::GetTopCommander());
00796     LWindow *theDialog = theHandler.GetDialog();
00797     ThrowIfNil_(theDialog);
00798     static UInt16 sRuntimePanel = 1;
00799
00800     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00801         (theDialog->FindPaneByID(item_MultiViewPrefs));
00802     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00803
00804     multiView->SwitchToPanel(2);
00805     DoDataExchange_Globals(theDialog, true);
00806     multiView->SwitchToPanel(1);
00807     DoDataExchange_TagDeleteMain(theDialog, sLastTag, noRecurs, true);
00808
00809     groupView->SetValue(sRuntimePanel);
00810     theDialog->Show();
00811     MessageT hitMessage;
00812     while (true)
00813     {       // Let DialogHandler process events
00814         hitMessage = theHandler.DoDialog();
00815
00816         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00817             break;
00818     }
00819     theDialog->Hide();
00820     sRuntimePanel = groupView->GetValue();
00821
00822     if(hitMessage == msg_OK)
00823     {
00824         multiView->SwitchToPanel(1);
00825         DoDataExchange_TagDeleteMain(theDialog, sLastTag, noRecurs, false);
00826         multiView->SwitchToPanel(2);
00827         DoDataExchange_Globals(theDialog, false);
00828         userHitOK = true;
00829     }
00830 #endif /* qMacCvsPP */
00831
00832     if(userHitOK)
00833     {
00834         tagName = sLastTag;
00835
00836         gCvsPrefs.save();
00837     }
00838
00839     return userHitOK;
00840 }

Generated on Sun Oct 21 12:42:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TagDlg.h File Reference

common/TagDlg.h File Reference

#include "CPStr.h"

Include dependency graph for TagDlg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_TAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Functions

bool | CompatTagCreate (bool &noRecurs, bool &overwriteExisting, UPStr &tagName, bool &checkUnmod)
bool | CompatTagDelete (bool &noRecurs, UPStr &tagName)
bool | CompatTagBranch (bool &noRecurs, UPStr &branchName, bool &checkUnmod)

Define Documentation

#define AFX_TAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file TagDlg.h.

Function Documentation

bool CompatTagBranch | ( | bool & | noRecurs,
 |  | UPStr & | branchName,
 |  | bool & | checkUnmod
 | ) |

Definition at line 842 of file TagDlg.cpp.

Referenced by CvsCmdTagBranchFiles(), and CvsCmdTagBranchFolder().

00844 {
00845     bool userHitOK = false;
00846
00847     static CPStr sLastBranch;
00848
00849     branchName = "";
00850     noRecurs = false;
00851     checkUnmod = false;
00852
00853 #ifdef WIN32
00854     CPropertySheet pages("Create branch settings");
00855     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00856     CTag_BRANCH page1(sLastBranch, noRecurs, checkUnmod);
00857     CGetPrefs_GLOBALS page2;
00858     pages.AddPage(&page1);
00859     pages.AddPage(&page2);
00860     if(pages.DoModal() == IDOK)
00861     {
00862         checkUnmod = page1.m_checkunmod == TRUE;
00863         noRecurs = page1.m_norecurs == TRUE;
00864         sLastBranch = page1.m_branchname;
00865
00866         page2.StoreValues();
00867         userHitOK = true;
00868     }
00869 #endif /* WIN32 */
00870 #if qUnix
00871     void *wid = UCreate_BranchDlg();
00872
00873     UCvsTagBranch *dlg = new UCvsTagBranch();
00874     UCvsTagBranch_MAIN *tab1 = new UCvsTagBranch_MAIN(sLastBranch, noRecurs, checkUnmod);
00875     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00876     dlg->AddPage(tab1, UCvsTagBranch::kTabGeneral, 0);
00877
00878     if(dlg->DoModal())
00879     {
00880         checkUnmod = tab1->m_checkunmod;
00881         noRecurs = tab1->m_norecurs;
00882         sLastBranch = tab1->m_tagname;
00883
00884         userHitOK = true;
00885     }
00886
00887     delete dlg;
00888 #endif // qUnix
00889 #ifdef qMacCvsPP
00890     StDialogHandler theHandler(dlg_TagBranch, LCommander::GetTopCommander());
00891     LWindow *theDialog = theHandler.GetDialog();
00892     ThrowIfNil_(theDialog);
00893     static UInt16 sRuntimePanel = 1;
00894
00895     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00896         (theDialog->FindPaneByID(item_MultiViewPrefs));
00897     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00898
00899     multiView->SwitchToPanel(2);
00900     DoDataExchange_Globals(theDialog, true);
00901     multiView->SwitchToPanel(1);
00902     DoDataExchange_TagBranchMain(theDialog, sLastBranch,
00903         noRecurs, checkUnmod, true);
00904
00905     groupView->SetValue(sRuntimePanel);
00906     theDialog->Show();
00907     MessageT hitMessage;
00908     while (true)
00909     {       // Let DialogHandler process events
00910         hitMessage = theHandler.DoDialog();
00911
00912         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00913             break;
00914     }
00915     theDialog->Hide();
00916     sRuntimePanel = groupView->GetValue();
00917
00918     if(hitMessage == msg_OK)
00919     {
00920         multiView->SwitchToPanel(1);
00921         DoDataExchange_TagBranchMain(theDialog, sLastBranch,
00922             noRecurs, checkUnmod, false);
00923         multiView->SwitchToPanel(2);
00924         DoDataExchange_Globals(theDialog, false);
00925         userHitOK = true;
00926     }
00927 #endif /* qMacCvsPP */
00928
00929     if(userHitOK)
00930     {
00931         branchName = sLastBranch;
00932
00933         gCvsPrefs.save();
00934     }
00935
00936     return userHitOK;
00937 }

bool CompatTagCreate | ( | bool & | noRecurs,
 |  | bool & | overwriteExisting,
 |  | UPStr & | tagName,
 |  | bool & | checkUnmod
 | ) |

Definition at line 648 of file TagDlg.cpp.

Referenced by CvsCmdTagCreateFiles(), and CvsCmdTagCreateFolder().

00650 {
00651     bool userHitOK = false;
00652
00653     static CPStr sLastTag;
00654
00655     tagName = "";
00656     noRecurs = false;
00657     overwriteExisting = false;
00658     checkUnmod = false;
00659
00660 #ifdef WIN32
00661     CPropertySheet pages("Create tag settings");
00662     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00663     CTag_CREATE page1(sLastTag, noRecurs, overwriteExisting,
00664         checkUnmod);
00665     CGetPrefs_GLOBALS page2;
00666     pages.AddPage(&page1);
00667     pages.AddPage(&page2);
00668     if(pages.DoModal() == IDOK)
00669     {
00670         checkUnmod = page1.m_checkunmod == TRUE;
00671         noRecurs = page1.m_norecurs == TRUE;
00672         sLastTag = page1.m_tagname;
00673         overwriteExisting = page1.m_overwrite == TRUE;
00674
00675         page2.StoreValues();
00676         userHitOK = true;
00677     }
00678 #endif /* WIN32 */
00679 #if qUnix
00680     void *wid = UCreate_TagDlg();
00681
00682     UCvsTagCreate *dlg = new UCvsTagCreate();
00683     UCvsTagCreate_MAIN *tab1 =
00684         new UCvsTagCreate_MAIN(sLastTag, noRecurs, overwriteExisting, checkUnmod);
00685     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00686     dlg->AddPage(tab1, UCvsTagCreate::kTabGeneral, 0);
00687
00688     if(dlg->DoModal())
00689     {
00690         checkUnmod = tab1->m_checkunmod;
00691         noRecurs = tab1->m_norecurs;
00692         sLastTag = tab1->m_tagname;
00693         overwriteExisting = tab1->m_overwrite;
00694
00695         userHitOK = true;
00696     }
00697
00698     delete dlg;
00699 #endif // qUnix
00700 #ifdef qMacCvsPP
00701     StDialogHandler theHandler(dlg_TagCreate, LCommander::GetTopCommander());
00702     LWindow *theDialog = theHandler.GetDialog();
00703     ThrowIfNil_(theDialog);
00704     static UInt16 sRuntimePanel = 1;
00705
00706     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00707         (theDialog->FindPaneByID(item_MultiViewPrefs));
00708     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00709
00710     multiView->SwitchToPanel(2);
00711     DoDataExchange_Globals(theDialog, true);
00712     multiView->SwitchToPanel(1);
00713     DoDataExchange_TagCreateMain(theDialog, sLastTag,
00714         noRecurs, overwriteExisting, checkUnmod, true);
00715
00716     groupView->SetValue(sRuntimePanel);
00717     theDialog->Show();
00718     MessageT hitMessage;
00719     while (true)
00720     {       // Let DialogHandler process events
00721         hitMessage = theHandler.DoDialog();
00722
00723         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00724             break;
00725     }
00726     theDialog->Hide();
00727     sRuntimePanel = groupView->GetValue();
00728
00729     if(hitMessage == msg_OK)
00730     {
00731         multiView->SwitchToPanel(1);
00732         DoDataExchange_TagCreateMain(theDialog, sLastTag,
00733             noRecurs, overwriteExisting, checkUnmod, false);
00734         multiView->SwitchToPanel(2);
00735         DoDataExchange_Globals(theDialog, false);
00736         userHitOK = true;
00737     }
00738 #endif /* qMacCvsPP */
00739
00740     if(userHitOK)
00741     {
00742         tagName = sLastTag;
00743
00744         gCvsPrefs.save();
00745     }
00746
00747     return userHitOK;
00748 }

bool CompatTagDelete | ( | bool & | noRecurs,
 |  | UPStr & | tagName
 | ) |

Definition at line 750 of file TagDlg.cpp.

Referenced by CvsCmdTagDeleteFiles(), and CvsCmdTagDeleteFolder().

00751 {
00752
00753     bool userHitOK = false;
00754
00755     static CPStr sLastTag;
00756
00757     tagName = "";
00758     noRecurs = false;
00759
00760 #ifdef WIN32
00761     CPropertySheet pages("Delete tag settings");
00762     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00763     CTag_DELETE page1(sLastTag, noRecurs);
00764     CGetPrefs_GLOBALS page2;
00765     pages.AddPage(&page1);
00766     pages.AddPage(&page2);
00767     if(pages.DoModal() == IDOK)
00768     {
00769         noRecurs = page1.m_norecurs == TRUE;
00770         sLastTag = page1.m_tagname;
00771
00772         page2.StoreValues();
00773         userHitOK = true;
00774     }
00775 #endif /* WIN32 */
00776 #if qUnix
00777     void *wid = UCreate_UntagDlg();
00778
00779     UCvsTagDel *dlg = new UCvsTagDel();
00780     UCvsTagDel_MAIN *tab1 = new UCvsTagDel_MAIN(sLastTag, noRecurs);
00781     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00782     dlg->AddPage(tab1, UCvsTagDel::kTabGeneral, 0);
00783
00784     if(dlg->DoModal())
00785     {
00786         noRecurs = tab1->m_norecurs;
00787         sLastTag = tab1->m_tagname;
00788
00789         userHitOK = true;
00790     }
00791
00792     delete dlg;
00793 #endif // qUnix
00794 #ifdef qMacCvsPP
00795     StDialogHandler theHandler(dlg_TagDelete, LCommander::GetTopCommander());
00796     LWindow *theDialog = theHandler.GetDialog();
00797     ThrowIfNil_(theDialog);
00798     static UInt16 sRuntimePanel = 1;
00799
00800     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00801         (theDialog->FindPaneByID(item_MultiViewPrefs));
00802     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00803
00804     multiView->SwitchToPanel(2);
00805     DoDataExchange_Globals(theDialog, true);
00806     multiView->SwitchToPanel(1);
00807     DoDataExchange_TagDeleteMain(theDialog, sLastTag, noRecurs, true);
00808
00809     groupView->SetValue(sRuntimePanel);
00810     theDialog->Show();
00811     MessageT hitMessage;
00812     while (true)
00813     {       // Let DialogHandler process events
00814         hitMessage = theHandler.DoDialog();
00815
00816         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00817             break;
00818     }
00819     theDialog->Hide();
00820     sRuntimePanel = groupView->GetValue();
00821
00822     if(hitMessage == msg_OK)
00823     {
00824         multiView->SwitchToPanel(1);
00825         DoDataExchange_TagDeleteMain(theDialog, sLastTag, noRecurs, false);
00826         multiView->SwitchToPanel(2);
00827         DoDataExchange_Globals(theDialog, false);
00828         userHitOK = true;
00829     }
00830 #endif /* qMacCvsPP */
00831
00832     if(userHitOK)
00833     {
00834         tagName = sLastTag;
00835
00836         gCvsPrefs.save();
00837     }
00838
00839     return userHitOK;
00840 }

Generated on Sun Oct 21 12:42:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TclGlue.cpp File Reference

common/TclGlue.cpp File Reference

#include "stdafx.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "tcl.h"
#include "TclGlue.h"
#include "AppConsole.h"
#include "AppGlue.h"
#include "CvsArgs.h"
#include "CvsEntries.h"
#include "dll_loader.h"
#include "FileTraversal.h"
#include "MacrosSetup.h"
#include "MoveToTrash.h"
#include "CvsPrefs.h"

Include dependency graph for TclGlue.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CFillTclEntries
class | CTCLBrowserEnt
class | CTCLCvsConsole

Defines

#define | USE_TCL 1
#define | NEW new
#define | DECLC
#define | _TCL_CALLBACK(f) f

Functions

int | tclCvsProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
int | tclHelpProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
int | tclCvsOutProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
int | tclCvsErrProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
int | tclCvsBrowserProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
int | tclCvsEntriesProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
void | tclCvsEntriesDeleteProc (ClientData clientData)
int | tclCvsExitOnErrorProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
int | tclCvsLastErrorCodeProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
int | tclSetDebugLevelProc (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
int | tclSafeRemove (ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
void | TclBrowserReset (void)
void | TclBrowserAppend (const char *, EntnodeData *data)
Tcl_Interp * | myTcl_CreateInterp (void)

Variables

std::vector< CTCLBrowserEnt > sTclBrowser

Define Documentation

#define DECLC

Definition at line 111 of file TclGlue.cpp.

#define NEW new

Definition at line 105 of file TclGlue.cpp.

#define USE_TCL 1

Definition at line 41 of file TclGlue.cpp.

#define _TCL_CALLBACK ( f ) f

Definition at line 203 of file TclGlue.cpp.

Referenced by CTcl_Interp::CTcl_Interp(), and tclCvsEntriesProc().

Function Documentation

void TclBrowserAppend | ( | const char * | path,
 |  | EntnodeData * | data
 | ) |

Definition at line 910 of file TclGlue.cpp.

00911 {
00912 #if USE_TCL
00913     sTclBrowser.push_back(CTCLBrowserEnt(data));
00914 #endif
00915 }

void TclBrowserReset ( void )

Definition at line 900 of file TclGlue.cpp.

Referenced by UCvsFolders::OnCmdMacrosSel(), UCvsFiles::OnMacroSel(), and cvsgui_LaunchTclMacro().

00901 {
00902 #if USE_TCL
00903     sTclBrowser.erase(sTclBrowser.begin(), sTclBrowser.end());
00904 #endif
00905 }

Tcl_Interp* myTcl_CreateInterp ( void ) [static]

Definition at line 917 of file TclGlue.cpp.

Referenced by CTcl_Interp::CTcl_Interp(), and CTcl_Interp::IsAvail().

00918 {
00919 #   ifdef WIN32
00920     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00921     CStr path;
00922     app->GetAppModule(path);
00923     Tcl_FindExecutable(path);
00924 #   endif
00925
00926 #   ifdef qMacCvsPP
00927     CStr appPath = CMacCvsApp::GetAppPath();
00928     Tcl_FindExecutable(appPath);
00929 #   endif
00930
00931     Tcl_Interp *res = Tcl_CreateInterp();
00932     return res;
00933 }

int tclCvsBrowserProc | ( | ClientData | clientData,
 |  | Tcl_Interp * | interp,
 |  | int | argc,
 |  | char * | argv[]
 | ) | [static]

Definition at line 386 of file TclGlue.cpp.

Referenced by _TCL_CALLBACK().

00387 {
00388     if(argc < 2)
00389     {
00390         Tcl_AppendResult(interp, argv[0], " : Missing arguments\n", 0L);
00391         return TCL_ERROR;
00392     }
00393
00394     std::vector<CTCLBrowserEnt> & browser = clientData != 0L ?
00395         *(std::vector<CTCLBrowserEnt> *)clientData : sTclBrowser;
00396     if(strcmp(argv[1], "get") == 0)
00397     {
00398         if(argc != 2)
00399         {
00400             char *str = Tcl_Concat(argc, argv);
00401             Tcl_AppendResult(interp, argv[0], " : Too many arguments : '", str, "'\n", 0L);
00402             Tcl_Free(str);
00403             return TCL_ERROR;
00404         }
00405
00406         Tcl_Obj *list = Tcl_NewListObj(0, 0L);
00407         std::vector<CTCLBrowserEnt>::const_iterator i;
00408         for(i = browser.begin(); i != browser.end(); ++i)
00409         {
00410             const CTCLBrowserEnt* entry = i;
00411             CStr path;
00412             entry->GetData()->GetFullPathName(path);
00413             CTcl_Interp::Unixfy(path);
00414
00415             Tcl_Obj * obj = Tcl_NewStringObj(path, path.length());
00416             Tcl_ListObjAppendElement(interp, list, obj);
00417             //TclFreeObj(obj);
00418         }
00419         Tcl_SetObjResult(interp, list);
00420         //TclFreeObj(list);
00421     }
00422     else if(strcmp(argv[1], "info") == 0)
00423     {
00424         if(argc != 4)
00425         {
00426             char *str = Tcl_Concat(argc, argv);
00427             Tcl_AppendResult(interp, argv[0], " : Too many arguments : '", str, "'\n", 0L);
00428             Tcl_Free(str);
00429             return TCL_ERROR;
00430         }
00431
00432         std::vector<CTCLBrowserEnt>::const_iterator i;
00433         for(i = browser.begin(); i != browser.end(); ++i)
00434         {
00435             const CTCLBrowserEnt* entry = i;
00436             if(entry->IsSamePath(argv[2]))
00437             {
00438                 EntnodeData* data = entry->GetData();
00439                 CStr path, fname, value;
00440                 entry->GetNormalized(path, fname);
00441                 char *res = Tcl_SetVar2(interp, argv[3], "name", fname, 0);
00442                 if(res == 0L)
00443                     goto err1;
00444
00445                 value = data->GetType() == ENT_FILE ? "file" : "folder";
00446                 res = Tcl_SetVar2(interp, argv[3], "kind", value, 0);
00447                 if(res == 0L)
00448                     goto err1;
00449
00450                 res = Tcl_SetVar2(interp, argv[3], "path", path, 0);
00451                 if(res == 0L)
00452                     goto err1;
00453
00454                 value = (*data)[EntnodeData::kStatus];
00455                 res = Tcl_SetVar2(interp, argv[3], "status", value, 0);
00456                 if(res == 0L)
00457                     goto err1;
00458
00459                 value = data->IsMissing() ? "1" : "0";
00460                 res = Tcl_SetVar2(interp, argv[3], "missing", value, 0);
00461                 if(res == 0L)
00462                     goto err1;
00463
00464                 value = data->IsUnknown() ? "1" : "0";
00465                 res = Tcl_SetVar2(interp, argv[3], "unknown", value, 0);
00466                 if(res == 0L)
00467                     goto err1;
00468
00469                 value = data->IsIgnored() ? "1" : "0";
00470                 res = Tcl_SetVar2(interp, argv[3], "ignored", value, 0);
00471                 if(res == 0L)
00472                     goto err1;
00473
00474                 value = data->IsLocked() ? "1" : "0";
00475                 res = Tcl_SetVar2(interp, argv[3], "locked", value, 0);
00476                 if(res == 0L)
00477                     goto err1;
00478
00479                 value = data->IsUnmodified() ? "0" : "1";
00480                 res = Tcl_SetVar2(interp, argv[3], "modified", value, 0);
00481                 if(res == 0L)
00482                     goto err1;
00483
00484                 value = data->GetDesc();
00485                 res = Tcl_SetVar2(interp, argv[3], "status", value, 0);
00486                 if(res == 0L)
00487                     goto err1;
00488
00489                 if(data->GetType() == ENT_FILE)
00490                 {
00491                     value = (*data)[EntnodeFile::kVN];
00492                     res = Tcl_SetVar2(interp, argv[3], "revision", value, 0);
00493                     if(res == 0L)
00494                         goto err1;
00495
00496                     value = (*data)[EntnodeFile::kTS];
00497                     res = Tcl_SetVar2(interp, argv[3], "timestamp", value, 0);
00498                     if(res == 0L)
00499                         goto err1;
00500
00501                     value = (*data)[EntnodeFile::kOption];
00502                     res = Tcl_SetVar2(interp, argv[3], "option", value, 0);
00503                     if(res == 0L)
00504                         goto err1;
00505
00506                     value = (*data)[EntnodeFile::kTag];
00507                     res = Tcl_SetVar2(interp, argv[3], "tag", value, 0);
00508                     if(res == 0L)
00509                         goto err1;
00510
00511                     value = (*data)[EntnodeFile::kConflict];
00512                     res = Tcl_SetVar2(interp, argv[3], "conflict", value, 0);
00513                     if(res == 0L)
00514                         goto err1;
00515                 }
00516
00517                 goto ok1;
00518 err1:
00519                 Tcl_AppendResult(interp, argv[0], " : Error while creating '", argv[3], "'\n", 0L);
00520                 return TCL_ERROR;
00521 ok1:
00522                 break;
00523             }
00524         }
00525     }
00526     else
00527     {
00528         char *str = Tcl_Concat(argc, argv);
00529         Tcl_AppendResult(interp, argv[0], " : Wrong arguments : '", str, "'\n", 0L);
00530         Tcl_Free(str);
00531         return TCL_ERROR;
00532     }
00533     return TCL_OK;
00534 }

void tclCvsEntriesDeleteProc ( ClientData clientData ) [static]

Definition at line 607 of file TclGlue.cpp.

Referenced by _TCL_CALLBACK().

00608 {
00609     if(clientData != 0L)
00610         delete (std::vector<CTCLBrowserEnt> *)clientData;
00611 }

int tclCvsEntriesProc | ( | ClientData | clientData,
 |  | Tcl_Interp * | interp,
 |  | int | argc,
 |  | char * | argv[]
 | ) | [static]

Definition at line 613 of file TclGlue.cpp.

Referenced by _TCL_CALLBACK().

00614 {
00615     if(argc != 3)
00616     {
00617         Tcl_AppendResult(interp, argv[0], " : Wrong # of arguments\n", 0L);
00618         return TCL_ERROR;
00619     }
00620
00621     CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00622
00623     // refetch all items
00624     CFillTclEntries traverse(entries);
00625     CStr path(argv[1]);
00626     CTcl_Interp::Deunixfy(path);
00627     /*kTraversal res = */FileTraverse(path, traverse);
00628
00629     // add the missing files
00630     Entries_SetMissing(entries);
00631
00632     // now make the TCL entries
00633     std::vector<CTCLBrowserEnt> *browser = NEW std::vector<CTCLBrowserEnt>;
00634
00635     int numEntries = entries.NumOfElements();
00636     for(int i = 0; i < numEntries; i++)
00637     {
00638         const ENTNODE & theNode = entries.Get(i);
00639         EntnodeData *data = theNode.Data();
00640         browser->push_back(CTCLBrowserEnt(data));
00641     }
00642
00643     Tcl_Command cmd = Tcl_CreateCommand (interp, argv[2], _TCL_CALLBACK(tclCvsBrowserProc),
00644         (ClientData)browser, tclCvsEntriesDeleteProc);
00645
00646     return cmd != 0L ? TCL_OK : TCL_ERROR;
00647 }

int tclCvsErrProc | ( | ClientData | clientData,
 |  | Tcl_Interp * | interp,
 |  | int | argc,
 |  | char * | argv[]
 | ) | [static]

Definition at line 377 of file TclGlue.cpp.

Referenced by _TCL_CALLBACK().

00378 {
00379     for(int i = 1; i < argc; i++)
00380     {
00381         cvs_errstr(argv[i], strlen(argv[i]));
00382     }
00383     return TCL_OK;
00384 }

int tclCvsExitOnErrorProc | ( | ClientData | clientData,
 |  | Tcl_Interp * | interp,
 |  | int | argc,
 |  | char * | argv[]
 | ) | [static]

Definition at line 721 of file TclGlue.cpp.

Referenced by _TCL_CALLBACK().

00722 {
00723     CTcl_Interp *tcl_interp = (CTcl_Interp*) clientData;
00724
00725     //
00726     // CvsExitOnError command can be used to define whether TCL macro
00727     // is automatically terminated if CVS command returned error (non zero).
00728     //
00729     // CvsExitOnError has following modes:
00730     //   false  = Do not exit automaticaly. CvsLastErrorCode constains the last error code.
00731     //   true   = Exit TCL script in error (default).
00732     //
00733     if(argc < 2)
00734     {
00735         Tcl_AppendResult(interp, argv[0], " : Missing argument (true|false)\n", 0L);
00736         return TCL_ERROR;
00737     }
00738
00739     if(strcmp(argv[1], "true") == 0)
00740         tcl_interp->SetCvsExitOnError(true);
00741     else if(strcmp(argv[1], "false") == 0)
00742         tcl_interp->SetCvsExitOnError(false);
00743     else
00744     {
00745         char *str = Tcl_Concat(argc, argv);
00746         Tcl_AppendResult(interp, argv[0], " : Wrong argument : '", str, "'\n", 0L);
00747         Tcl_Free(str);
00748
00749         return TCL_ERROR;
00750     }
00751
00752     return TCL_OK;
00753 }

int tclCvsLastErrorCodeProc | ( | ClientData | clientData,
 |  | Tcl_Interp * | interp,
 |  | int | argc,
 |  | char * | argv[]
 | ) | [static]

Definition at line 755 of file TclGlue.cpp.

Referenced by _TCL_CALLBACK().

00756 {
00757     CTcl_Interp *tcl_interp = (CTcl_Interp*) clientData;
00758
00759     if(argc < 2)
00760     {
00761         char value[35];
00762
00763         // CvsLastErrorCode called without arguments, so return current value
00764         sprintf(value, "%d", tcl_interp->GetCvsLastErrorCode());
00765         Tcl_AppendResult(interp, value, 0L);
00766     }
00767     else
00768     {
00769         // Set the value of LastErrorCode variable
00770         tcl_interp->SetCvsLastErrorCode(atoi(argv[1]));
00771     }
00772
00773     return TCL_OK;
00774 }

int tclCvsOutProc | ( | ClientData | clientData,
 |  | Tcl_Interp * | interp,
 |  | int | argc,
 |  | char * | argv[]
 | ) | [static]

Definition at line 368 of file TclGlue.cpp.

Referenced by _TCL_CALLBACK().

00369 {
00370     for(int i = 1; i < argc; i++)
00371     {
00372         cvs_outstr(argv[i], strlen(argv[i]));
00373     }
00374     return TCL_OK;
00375 }

int tclCvsProc | ( | ClientData | clientData,
 |  | Tcl_Interp * | interp,
 |  | int | argc,
 |  | char * | argv[]
 | ) | [static]

Definition at line 324 of file TclGlue.cpp.

Referenced by _TCL_CALLBACK().

00325 {
00326     CTcl_Interp *tcl_interp = (CTcl_Interp*) clientData;
00327     CvsArgs args;
00328
00329     for(int i = 1; i < argc; i++)
00330     {
00331         args.add(argv[i]);
00332     }
00333
00334     CTCLCvsConsole console(interp);
00335     int exitc = launchCVS(0L, args.Argc(), args.Argv(), &console);
00336
00337     //
00338     // Set CvsLastErrorCode value. TCL script can query
00339     // this value using cvslasterrorcode command
00340     //
00341     tcl_interp->SetCvsLastErrorCode(exitc);
00342
00343     //
00344     // If command succeeded then return always TCL_OK and
00345     // proceed with script. If command failed (exitc != 0)
00346     // then exit only if CvsExitOnError is TRUE.
00347     //
00348     if(exitc == 0)
00349         return TCL_OK;
00350     else
00351         return tcl_interp->GetCvsExitOnError() ? TCL_ERROR : TCL_OK;
00352 }

int tclHelpProc | ( | ClientData | clientData,
 |  | Tcl_Interp * | interp,
 |  | int | argc,
 |  | char * | argv[]
 | ) | [static]

Definition at line 354 of file TclGlue.cpp.

Referenced by _TCL_CALLBACK().

00355 {
00356     Tcl_AppendResult(interp, "Help :\n", 0L);
00357     Tcl_AppendResult(interp, "   cvs  : the cvs tool.\n", 0L);
00358     Tcl_AppendResult(interp, "   help : this help.\n", 0L);
00359     Tcl_AppendResult(interp, "Others commands :\n", 0L);
00360     Tcl_AppendResult(interp, "   cd   : change directory\n", 0L);
00361     Tcl_AppendResult(interp, "   pwd  : print current directory\n", 0L);
00362     Tcl_AppendResult(interp, "   ls   : list the current directory\n", 0L);
00363     Tcl_AppendResult(interp, "   info ?  : misc. informations\n", 0L);
00364     Tcl_AppendResult(interp, "   info commands : all the TCL commands\n", 0L);
00365     return TCL_OK;
00366 }

int tclSafeRemove | ( | ClientData | clientData,
 |  | Tcl_Interp * | interp,
 |  | int | argc,
 |  | char * | argv[]
 | ) | [static]

Definition at line 700 of file TclGlue.cpp.

00701 {
00702     if(argc < 2)
00703     {
00704         Tcl_AppendResult(interp, argv[0], " : Missing list of files\n", 0L);
00705         return TCL_ERROR;
00706     }
00707
00708     for(int i = 1; i < argc; i++)
00709     {
00710         CStr fn(argv[i]);
00711         CTcl_Interp::Deunixfy(fn);
00712         if(!CompatMoveToTrash(fn, 0))  // dir is not needed, TCL profides fully qualified file name
00713         {
00714             cvs_err("Unable to trash '%s'\n", (char *)fn);
00715         }
00716     }
00717
00718     return TCL_OK;
00719 }

int tclSetDebugLevelProc | ( | ClientData | clientData,
 |  | Tcl_Interp * | interp,
 |  | int | argc,
 |  | char * | argv[]
 | ) | [static]

Referenced by _TCL_CALLBACK().

Variable Documentation

std::vector<CTCLBrowserEnt> sTclBrowser [static]

Definition at line 278 of file TclGlue.cpp.

Generated on Sun Oct 21 12:42:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TclGlue.h File Reference

common/TclGlue.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CTcl_Interp

Defines

#define | TCL_OK 0
#define | TCL_ERROR 1
#define | TCL_RETURN 2
#define | TCL_BREAK 3
#define | TCL_CONTINUE 4
#define | kTCLPathDelimiter '/'

Typedefs

typedef int | kTclRes

Functions

void | TclBrowserReset (void)
void | TclBrowserAppend (const char *path, EntnodeData *data)

Define Documentation

#define TCL_BREAK 3

Definition at line 35 of file TclGlue.h.

#define TCL_CONTINUE 4

Definition at line 36 of file TclGlue.h.

#define TCL_ERROR 1

Definition at line 33 of file TclGlue.h.

#define TCL_OK 0

Definition at line 32 of file TclGlue.h.

#define TCL_RETURN 2

Definition at line 34 of file TclGlue.h.

#define kTCLPathDelimiter '/'

Definition at line 42 of file TclGlue.h.

Typedef Documentation

typedef int kTclRes

Definition at line 39 of file TclGlue.h.

Function Documentation

void TclBrowserAppend | ( | const char * | path,
 |  | EntnodeData * | data
 | ) |

Definition at line 910 of file TclGlue.cpp.

Referenced by UCvsFolders::OnCmdMacrosSel(), UCvsFiles::OnMacroSel(), and cvsgui_LaunchTclMacro().

00911 {
00912 #if USE_TCL
00913     sTclBrowser.push_back(CTCLBrowserEnt(data));
00914 #endif
00915 }

void TclBrowserReset ( void )

Definition at line 900 of file TclGlue.cpp.

00901 {
00902 #if USE_TCL
00903     sTclBrowser.erase(sTclBrowser.begin(), sTclBrowser.end());
00904 #endif
00905 }

Generated on Sun Oct 21 12:42:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TclGlue.mac.cpp File Reference

common/TclGlue.mac.cpp File Reference

#include "stdafx.h"

Include dependency graph for TclGlue.mac.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:42:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TclGlue.mac.h File Reference

common/TclGlue.mac.h File Reference

#include "dll_loader.h"

Include dependency graph for TclGlue.mac.h:

Include dependency graph

Go to the source code of this file.

Functions

int | CarbonCompatLoadLibrary (CompatConnectID *connID, const char *name_dll)
int | CarbonCompatCloseLibrary (CompatConnectID *connID)
void * | _CarbonCompatCallLibrary (CompatConnectID connID, const char *name_func)
void * | _tcl_cfm_macho (void *func)

Function Documentation

int CarbonCompatCloseLibrary ( CompatConnectID * connID )

int CarbonCompatLoadLibrary | ( | CompatConnectID * | connID,
 |  | const char * | name_dll
 | ) |

void* _CarbonCompatCallLibrary | ( | CompatConnectID | connID,
 |  | const char * | name_func
 | ) |

void* _tcl_cfm_macho ( void * func )

Generated on Sun Oct 21 12:42:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TextBinary.cpp File Reference

common/TextBinary.cpp File Reference

#include "stdafx.h"
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "TextBinary.h"
#include "FileTraversal.h"
#include "AppConsole.h"
#include "CPStr.h"

Include dependency graph for TextBinary.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | MAX_TEST_SIZE 100000

Functions

kTextBinTYPE | FillBuffer (const char *arg, const char *dir, const FSSpec *spec, bool bin)
kTextBinTYPE | TestBuffer (const char *arg, const char *dir, const FSSpec *spec, bool expectbin)
kTextBinTYPE | TestValidName (const char *filename)
kTextBinTYPE | TestFileIsAlias (const char *arg, const char *dir, const FSSpec *spec)
kTextBinTYPE | FileIsText (const char *arg, const char *dir, const FSSpec *spec)
kTextBinTYPE | FileIsBinary (const char *arg, const char *dir, const FSSpec *spec)
bool | SplitPath (const char *dir, UStr &uppath, UStr &folder)
void | GetExtension (const char *file, UStr &base, UStr &ext)
bool | MakeTmpFile (UStr &file, const char *prefix, const char *extension, bool create)
bool | GetEnvValue (const char *cmd, const char *key, UStr &value)
int | StringToArgv (const char *cmdLine, char **argv)

Variables

CStaticAllocT< char > | sBuf
int | sBufSize

Define Documentation

#define MAX_TEST_SIZE 100000

Definition at line 63 of file TextBinary.cpp.

Function Documentation

kTextBinTYPE FileIsBinary | ( | const char * | arg,
 |  | const char * | dir,
 |  | const FSSpec * | spec = 0L
 | ) |

Definition at line 294 of file TextBinary.cpp.

00295 {
00296     kTextBinTYPE state;
00297
00298     state = FillBuffer(arg, dir, spec, true);
00299     if(state != kFileIsOK)
00300         return state;
00301
00302     state = TestBuffer(arg, dir, spec, true);
00303
00304 #ifdef macintosh
00305     kTextBinTYPE sigstate = GetMacSig(arg, dir, spec, true);
00306     if(sigstate != kFileIsOK)
00307         return state;
00308     if(state != kFileIsOK && state != kBinIsText)
00309         return state;
00310 #else /* !macintosh */
00311     if(state != kFileIsOK)
00312         return state;
00313 #endif /* !macintosh */
00314
00315     state = TestValidName(arg);
00316     if(state != kFileIsOK)
00317         return state;
00318
00319     state = TestFileIsAlias(arg, dir, spec);
00320     if(state != kFileIsOK)
00321         return state;
00322
00323     return kFileIsOK;
00324 }

kTextBinTYPE FileIsText | ( | const char * | arg,
 |  | const char * | dir,
 |  | const FSSpec * | spec = 0L
 | ) |

Definition at line 262 of file TextBinary.cpp.

00263 {
00264     kTextBinTYPE state;
00265
00266 #ifdef macintosh
00267     state = GetMacSig(arg, dir, spec, false);
00268     if(state != kFileIsOK)
00269         return state;
00270 #endif /* macintosh */
00271
00272     state = FillBuffer(arg, dir, spec, false);
00273     if(state != kFileIsOK)
00274         return state;
00275
00276     if(sBufSize == 0)
00277         return kFileIsOK;
00278
00279     state = TestBuffer(arg, dir, spec, false);
00280     if(state != kFileIsOK)
00281         return state;
00282
00283     state = TestValidName(arg);
00284     if(state != kFileIsOK)
00285         return state;
00286
00287     state = TestFileIsAlias(arg, dir, spec);
00288     if(state != kFileIsOK)
00289         return state;
00290
00291     return kFileIsOK;
00292 }

kTextBinTYPE FillBuffer | ( | const char * | arg,
 |  | const char * | dir,
 |  | const FSSpec * | spec,
 |  | bool | bin
 | ) | [static]

Definition at line 76 of file TextBinary.cpp.

Referenced by FileIsBinary(), and FileIsText().

00077 {
00078     sBuf.AdjustSize(MAX_TEST_SIZE);
00079
00080     if(chdir(dir) != 0)
00081     {
00082         cvs_err("Unable to chdir to ""%s"" (error %d)\n", dir, errno);
00083         return kFileMissing;
00084     }
00085
00086     FILE *samp = fopen(arg, bin ? "rb" : "r");
00087     if(samp == 0L)
00088     {
00089         return kFileMissing;
00090     }
00091
00092     sBufSize = fread(sBuf, sizeof(char), MAX_TEST_SIZE, samp);
00093     if(sBufSize < 0)
00094     {
00095         cvs_err("Unable to read ""%s"" (error %d)\n", arg, errno);
00096         return kFileMissing;
00097     }
00098
00099     fclose(samp);
00100     return kFileIsOK;
00101 }

bool GetEnvValue | ( | const char * | cmd,
 |  | const char * | key,
 |  | UStr & | value
 | ) |

Definition at line 467 of file TextBinary.cpp.

00468 {
00469     const char *tmp = strstr(cmd, key);
00470     if(tmp == 0L)
00471         return false;
00472     tmp = strchr(tmp, '=');
00473     if(tmp == 0L)
00474         return false;
00475     tmp++;
00476     const char *tmp2 = strchr(tmp, '&');
00477     if(tmp2 == 0L)
00478         value = tmp;
00479     else
00480         value.set(tmp, tmp2 - tmp);
00481     return true;
00482 }

void GetExtension | ( | const char * | file,
 |  | UStr & | base,
 |  | UStr & | ext
 | ) |

Definition at line 353 of file TextBinary.cpp.

00354 {
00355     char *tmp = strrchr(file, '.');
00356     if(tmp == 0L)
00357     {
00358         ext = "";
00359         base = file;
00360     }
00361     else
00362     {
00363         ext = tmp + 1;
00364         base = file;
00365         base[tmp - file] = '\0';
00366     }
00367 }

bool MakeTmpFile | ( | UStr & | file,
 |  | const char * | prefix,
 |  | const char * | extension = 0L,
 |  | bool | create = false
 | ) |

Definition at line 369 of file TextBinary.cpp.

00370 {
00371     static int count = 0;
00372     char filename[256];
00373
00374     CStr tmpPath;
00375     CStr ext;
00376     CStr prf;
00377
00378     if(extension != 0L && extension[0] != '\0')
00379     {
00380         if(extension[0] != '.')
00381             ext = ".";
00382         ext << extension;
00383     }
00384
00385     if(prefix != 0L && prefix[0] != '\0')
00386     {
00387         prf = prefix;
00388     }
00389     else
00390         prf = "cvsgui";
00391
00392 #ifdef WIN32
00393     char *ptr;
00394     ptr = getenv(_T("TMP"));
00395     if (ptr != 0L && _access( ptr, 0 ) != -1 )
00396         tmpPath = ptr;
00397     else
00398         tmpPath = ".";
00399 #endif /* !WIN32 */
00400 #ifdef macintosh
00401     FSSpec theFolder;
00402     Str255 aPath;
00403     OSErr err;
00404
00405     if((err = MacGetTempFolder(theFolder, aPath)) != noErr)
00406     {
00407         cvs_err("Unable to locate the preferences folder (error %d) !\n", err);
00408         return 0L;
00409     }
00410     tmpPath = aPath;
00411
00412     for (;;) {
00413         sprintf(filename, "%s%d%s", (const char *)prf, count, (const char *)ext);
00414         if (::strlen (filename) <= 31) break;
00415
00416         if (prf.length () == 0) {
00417             cvs_err("Unable to truncate temp file !\n");
00418             return 0L;
00419             } // if
00420
00421         prf.set (prf, prf.length () - 1);
00422         } // for
00423 #endif /* !macintosh */
00424 #if qUnix
00425     tmpPath = "/tmp";
00426 #endif
00427
00428     struct stat sb;
00429     if (stat(tmpPath, &sb) == -1 || !S_ISDIR(sb.st_mode))
00430     {
00431         cvs_err("Unable to access '%s' (error %d) !\n", (const char *)tmpPath, errno);
00432         return false;
00433     }
00434
00435     if(!tmpPath.endsWith(kPathDelimiter))
00436         tmpPath << kPathDelimiter;
00437
00438     int maxtry = 10000;
00439     while(1)
00440     {
00441         sprintf(filename, "%s%d%s", (const char *)prf, count++, (const char *)ext);
00442         file = tmpPath;
00443         file << filename;
00444         if (stat(file, &sb) == -1 && errno == ENOENT)
00445         {
00446             if( create )
00447             {
00448                 FILE* stream = fopen(file, "w");
00449                 if( stream )
00450                 {
00451                     fclose(stream);
00452                 }
00453             }
00454             return true;
00455         }
00456
00457         if(maxtry-- == 0)
00458         {
00459             cvs_err("Time out to access '%s' !\n", (const char *)tmpPath);
00460             break;
00461         }
00462     }
00463
00464     return false;
00465 }

bool SplitPath | ( | const char * | dir,
 |  | UStr & | uppath,
 |  | UStr & | folder
 | ) |

Definition at line 326 of file TextBinary.cpp.

00327 {
00328     char newdir[512];
00329     char olddir[512];
00330     char newfile[256];
00331     int lendir = strlen(dir);
00332     strcpy(olddir, dir);
00333     if(dir[lendir - 1] == kPathDelimiter)
00334     {
00335         olddir[lendir - 1] = '\0';
00336         --lendir;
00337     }
00338     const char *tmp = olddir, *prev = olddir;
00339
00340     while((tmp = strchr(tmp, kPathDelimiter)) != 0L)
00341         prev = ++tmp;
00342
00343     strcpy(newdir, olddir);
00344     newdir[prev - olddir] = '\0';
00345     strcpy(newfile, prev);
00346
00347     uppath = newdir;
00348     folder = newfile;
00349
00350     return true;
00351 }

int StringToArgv | ( | const char * | cmdLine,
 |  | char ** | argv
 | ) |

Definition at line 484 of file TextBinary.cpp.

00485 {
00486     int argc = 0;
00487
00488     char    Quote = '\0';               /*  Contains the quote character if we are
00489                                             inside "" or '', or \0 otherwise */
00490     const char* walker1 = cmdLine;      /*  walker1 traverses the original
00491                                             command line */
00492     char*   walker2;                    /*  walker2 traverses the parsed copy of
00493                                             the command line */
00494     char    theChar;                    /*  theChar is the character we are currently
00495                                             parsing */
00496     char    arguments [MAX_CMD_LEN];            /*  will contain a parsed copy of the
00497                                             command line */
00498
00499     walker2 = arguments;                                        /*  copy into arguments */
00500     while ((theChar = *walker1++) != '\0') {                    /*  parse command line to \0 */
00501         if (theChar == ' ')                                     /*  skip leading space before an argument */
00502             continue;
00503         argv [argc++] = walker2;                                /*  set argv to point to the space
00504                                                                     where we copy the next argument */
00505         if (argc > MAX_ARGS) {                                  /*  if we filled argv, skip the rest */
00506             argc--;
00507             break;
00508         }
00509         do {                                                    /*  parse an argument */
00510             if (theChar == '\\' && *walker1++)                  /*  skip \s */
00511                 theChar = *walker1++;
00512             else
00513                 if ((theChar == '"') || (theChar == '\'')) {    /*  when we find a quote... */
00514                     if (Quote == '\0') {                        /*  if we are not inside quotes already, */
00515                         Quote = theChar;                        /*  remember we are inside quotes now */
00516                         continue;                               /*  go to the next character */
00517                     }
00518                     if (theChar == Quote) {                     /*  if we are already inside that kind of quotes */
00519                         Quote = '\0';                           /*  close quotes */
00520                         continue;                               /*  go to the next character */
00521                     }
00522                 }
00523             *walker2++ = theChar;                               /*  copy the character into args */
00524                                                                 /*  repeat until we reach the end of arguments
00525                                                                     or we reach a space that is not inside quotes */
00526         } while ((*walker1 != '\0') && (((theChar = *walker1++) != ' ') || (Quote != '\0')));
00527         *walker2++ = 0;                                         /* null-terminate the last argument */
00528     }
00529
00530     return argc;
00531 }

kTextBinTYPE TestBuffer | ( | const char * | arg,
 |  | const char * | dir,
 |  | const FSSpec * | spec,
 |  | bool | expectbin
 | ) | [static]

Definition at line 103 of file TextBinary.cpp.

Referenced by FileIsBinary(), and FileIsText().

00104 {
00105     if(sBufSize == 0)
00106         return kFileIsOK;
00107
00108     // Windows : fread skips the \r, so we don't care.
00109     // Mac : MSL exchanges when reading the \r and \n,
00110     // so we look for \n
00111     // Others : default to \n
00112
00113     const unsigned char nativeNL = '\n';
00114     const unsigned char nonnativeNL = '\r';
00115
00116     // figure it it is binary (the test is more than 10% binary
00117     // is binary)
00118     int numBinChars = 0;
00119     int numTextChars = 0;
00120     int i;
00121     unsigned char c;
00122     char *tmp;
00123
00124     for(tmp = sBuf, i = 0; i < sBufSize; i++)
00125     {
00126         c = (unsigned char)*tmp++;
00127         if((c < 0x20 && c != nativeNL && c != nonnativeNL && c != '\t') || (c >= 0x80
00128 #ifdef macintosh
00129         && c != (unsigned char)'Ñ' && c != (unsigned char)'¥' /* powerplant */
00130 #endif /* macintosh */
00131         ))
00132             numBinChars++;
00133         else
00134             numTextChars++;
00135     }
00136
00137     float percent = (float)numBinChars / (float)sBufSize;
00138     bool isbin = percent >= 0.05;
00139     if(isbin && !expectbin)
00140         return kTextIsBinary;
00141     if(!isbin && expectbin)
00142         return kBinIsText;
00143
00144
00145     // for the text files, check if the new lines are good
00146     if(!expectbin)
00147     {
00148         int numNonNative = 0, numNative = 0;
00149         for(tmp = sBuf, i = 0; i < sBufSize; i++)
00150         {
00151             c = (unsigned char)*tmp++;
00152             if(c == nonnativeNL)
00153                 numNonNative++;
00154             else if(c == nativeNL)
00155                 numNative++;
00156         }
00157         if(numNative == 0)
00158         {
00159             if(numNonNative > 0)
00160                 return kTextWrongLF;
00161         }
00162         else
00163         {
00164             percent = (float)numNonNative / (float)numNative;
00165             if(percent >= 0.1)
00166                 return kTextWrongLF;
00167         }
00168
00169         if(numBinChars > 0)
00170             return kTextEscapeChar;
00171     }
00172
00173     return kFileIsOK;
00174 }

kTextBinTYPE TestFileIsAlias | ( | const char * | arg,
 |  | const char * | dir,
 |  | const FSSpec * | spec
 | ) | [static]

Definition at line 240 of file TextBinary.cpp.

Referenced by FileIsBinary(), and FileIsText().

00241 {
00242     kTextBinTYPE result = kFileIsOK;
00243
00244 #ifdef S_ISLNK
00245     CPStr fullname;
00246     struct stat sb;
00247
00248     fullname = dir;
00249     if(!fullname.endsWith(kPathDelimiter))
00250         fullname << kPathDelimiter;
00251     fullname << arg;
00252
00253     if (stat(fullname, &sb) == -1)
00254         result = kFileMissing;
00255     else if(S_ISLNK(sb.st_mode))
00256         result = kFileIsAlias;
00257 #endif /* S_ISLNK */
00258
00259     return result;
00260 }

kTextBinTYPE TestValidName ( const char * filename ) [static]

Definition at line 219 of file TextBinary.cpp.

Referenced by FileIsBinary(), and FileIsText().

00220 {
00221     kTextBinTYPE result = kFileIsOK;
00222
00223     if(strchr(filename, '/') != 0L)
00224         result = kFileInvalidName;
00225     if(strchr(filename, '\n') != 0L)
00226         result = kFileInvalidName;
00227
00228 #ifdef macintosh
00229     if(strchr(filename, '\r') != 0L)
00230         result = kFileInvalidName;
00231     if(strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0)
00232         result = kFileInvalidName;
00233     if(strcmp(filename, "CVS") != 0 && stricmp(filename, "cvs") == 0)
00234         result = kFileInvalidName;
00235 #endif /* !macintosh */
00236
00237     return result;
00238 }

Variable Documentation

CStaticAllocT<char> sBuf [static]

Definition at line 73 of file TextBinary.cpp.

int sBufSize [static]

Definition at line 74 of file TextBinary.cpp.

Generated on Sun Oct 21 12:42:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TextBinary.h File Reference

common/TextBinary.h File Reference

#include "CPStr.h"

Include dependency graph for TextBinary.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | MAX_ARGS 40
#define | MAX_CMD_LEN 2048

Typedefs

typedef int | FSSpec

Enumerations

enum kTextBinTYPE {
kFileIsOK, kFileMissing, kFileIsAlias, kFileInvalidName,
kTextWrongLF, kTextIsBinary, kTextEscapeChar, kTextWrongSig,
kBinIsText, kBinWrongSig
}

Functions

kTextBinTYPE | FileIsText (const char *arg, const char *dir, const FSSpec *spec=0L)
kTextBinTYPE | FileIsBinary (const char *arg, const char *dir, const FSSpec *spec=0L)
bool | SplitPath (const char *dir, UStr &uppath, UStr &folder)
bool | MakeTmpFile (UStr &file, const char *prefix, const char *extension=0L, bool create=false)
void | GetExtension (const char *file, UStr &base, UStr &ext)
bool | GetEnvValue (const char *cmd, const char *key, UStr &value)
int | StringToArgv (const char *cmdLine, char **argv)

Variables

const char | kPathDelimiter = '/'

Define Documentation

#define MAX_ARGS 40

Definition at line 79 of file TextBinary.h.

#define MAX_CMD_LEN 2048

Definition at line 80 of file TextBinary.h.

Typedef Documentation

typedef int FSSpec

Definition at line 33 of file TextBinary.h.

Enumeration Type Documentation

enum kTextBinTYPE

Enumeration values:
kFileIsOK
kFileMissing
kFileIsAlias
kFileInvalidName
kTextWrongLF
kTextIsBinary
kTextEscapeChar
kTextWrongSig
kBinIsText
kBinWrongSig

Definition at line 44 of file TextBinary.h.

00045 {
00046     // text and binary flags
00047     kFileIsOK, // good file
00048     kFileMissing, // file is missing or unreadable
00049     kFileIsAlias, // file is an alias
00050     kFileInvalidName, // invalid character ('/')
00051
00052     // text flags
00053     kTextWrongLF, // for example it has Mac \r on Windows
00054     kTextIsBinary, // file should be text but seems (at least) to be binary
00055     kTextEscapeChar, // file has some extras characters (0x00-0x1F, 0x80-0xFF)
00056     kTextWrongSig, // file has not the 'TEXT' signature (Mac only)
00057
00058     // binary flags
00059     kBinIsText, // binary file seems to ba a text file
00060     kBinWrongSig // file should not have the 'TEXT' signature in it (Mac only)
00061 } kTextBinTYPE;

Function Documentation

kTextBinTYPE FileIsBinary | ( | const char * | arg,
 |  | const char * | dir,
 |  | const FSSpec * | spec = 0L
 | ) |

Definition at line 294 of file TextBinary.cpp.

Referenced by ImportReport::OnFile(), and AddBinCvsArgs::addfile().

00295 {
00296     kTextBinTYPE state;
00297
00298     state = FillBuffer(arg, dir, spec, true);
00299     if(state != kFileIsOK)
00300         return state;
00301
00302     state = TestBuffer(arg, dir, spec, true);
00303
00304 #ifdef macintosh
00305     kTextBinTYPE sigstate = GetMacSig(arg, dir, spec, true);
00306     if(sigstate != kFileIsOK)
00307         return state;
00308     if(state != kFileIsOK && state != kBinIsText)
00309         return state;
00310 #else /* !macintosh */
00311     if(state != kFileIsOK)
00312         return state;
00313 #endif /* !macintosh */
00314
00315     state = TestValidName(arg);
00316     if(state != kFileIsOK)
00317         return state;
00318
00319     state = TestFileIsAlias(arg, dir, spec);
00320     if(state != kFileIsOK)
00321         return state;
00322
00323     return kFileIsOK;
00324 }

kTextBinTYPE FileIsText | ( | const char * | arg,
 |  | const char * | dir,
 |  | const FSSpec * | spec = 0L
 | ) |

Definition at line 262 of file TextBinary.cpp.

Referenced by ImportReport::OnFile(), and AddCvsArgs::addfile().

00263 {
00264     kTextBinTYPE state;
00265
00266 #ifdef macintosh
00267     state = GetMacSig(arg, dir, spec, false);
00268     if(state != kFileIsOK)
00269         return state;
00270 #endif /* macintosh */
00271
00272     state = FillBuffer(arg, dir, spec, false);
00273     if(state != kFileIsOK)
00274         return state;
00275
00276     if(sBufSize == 0)
00277         return kFileIsOK;
00278
00279     state = TestBuffer(arg, dir, spec, false);
00280     if(state != kFileIsOK)
00281         return state;
00282
00283     state = TestValidName(arg);
00284     if(state != kFileIsOK)
00285         return state;
00286
00287     state = TestFileIsAlias(arg, dir, spec);
00288     if(state != kFileIsOK)
00289         return state;
00290
00291     return kFileIsOK;
00292 }

bool GetEnvValue | ( | const char * | cmd,
 |  | const char * | key,
 |  | UStr & | value
 | ) |

Definition at line 467 of file TextBinary.cpp.

Referenced by CompatGetPassword().

00468 {
00469     const char *tmp = strstr(cmd, key);
00470     if(tmp == 0L)
00471         return false;
00472     tmp = strchr(tmp, '=');
00473     if(tmp == 0L)
00474         return false;
00475     tmp++;
00476     const char *tmp2 = strchr(tmp, '&');
00477     if(tmp2 == 0L)
00478         value = tmp;
00479     else
00480         value.set(tmp, tmp2 - tmp);
00481     return true;
00482 }

void GetExtension | ( | const char * | file,
 |  | UStr & | base,
 |  | UStr & | ext
 | ) |

Definition at line 353 of file TextBinary.cpp.

Referenced by CvsCmdAnnotateFiles(), CvsCmdDiffFiles(), CGraphView::OnQueryAnnotate(), CGraphView::OnViewDiff(), and getSettingName().

00354 {
00355     char *tmp = strrchr(file, '.');
00356     if(tmp == 0L)
00357     {
00358         ext = "";
00359         base = file;
00360     }
00361     else
00362     {
00363         ext = tmp + 1;
00364         base = file;
00365         base[tmp - file] = '\0';
00366     }
00367 }

bool MakeTmpFile | ( | UStr & | file,
 |  | const char * | prefix,
 |  | const char * | extension = 0L,
 |  | bool | create = false
 | ) |

Definition at line 369 of file TextBinary.cpp.

Referenced by CompatGetEditorMsg(), and launchCVS().

00370 {
00371     static int count = 0;
00372     char filename[256];
00373
00374     CStr tmpPath;
00375     CStr ext;
00376     CStr prf;
00377
00378     if(extension != 0L && extension[0] != '\0')
00379     {
00380         if(extension[0] != '.')
00381             ext = ".";
00382         ext << extension;
00383     }
00384
00385     if(prefix != 0L && prefix[0] != '\0')
00386     {
00387         prf = prefix;
00388     }
00389     else
00390         prf = "cvsgui";
00391
00392 #ifdef WIN32
00393     char *ptr;
00394     ptr = getenv(_T("TMP"));
00395     if (ptr != 0L && _access( ptr, 0 ) != -1 )
00396         tmpPath = ptr;
00397     else
00398         tmpPath = ".";
00399 #endif /* !WIN32 */
00400 #ifdef macintosh
00401     FSSpec theFolder;
00402     Str255 aPath;
00403     OSErr err;
00404
00405     if((err = MacGetTempFolder(theFolder, aPath)) != noErr)
00406     {
00407         cvs_err("Unable to locate the preferences folder (error %d) !\n", err);
00408         return 0L;
00409     }
00410     tmpPath = aPath;
00411
00412     for (;;) {
00413         sprintf(filename, "%s%d%s", (const char *)prf, count, (const char *)ext);
00414         if (::strlen (filename) <= 31) break;
00415
00416         if (prf.length () == 0) {
00417             cvs_err("Unable to truncate temp file !\n");
00418             return 0L;
00419             } // if
00420
00421         prf.set (prf, prf.length () - 1);
00422         } // for
00423 #endif /* !macintosh */
00424 #if qUnix
00425     tmpPath = "/tmp";
00426 #endif
00427
00428     struct stat sb;
00429     if (stat(tmpPath, &sb) == -1 || !S_ISDIR(sb.st_mode))
00430     {
00431         cvs_err("Unable to access '%s' (error %d) !\n", (const char *)tmpPath, errno);
00432         return false;
00433     }
00434
00435     if(!tmpPath.endsWith(kPathDelimiter))
00436         tmpPath << kPathDelimiter;
00437
00438     int maxtry = 10000;
00439     while(1)
00440     {
00441         sprintf(filename, "%s%d%s", (const char *)prf, count++, (const char *)ext);
00442         file = tmpPath;
00443         file << filename;
00444         if (stat(file, &sb) == -1 && errno == ENOENT)
00445         {
00446             if( create )
00447             {
00448                 FILE* stream = fopen(file, "w");
00449                 if( stream )
00450                 {
00451                     fclose(stream);
00452                 }
00453             }
00454             return true;
00455         }
00456
00457         if(maxtry-- == 0)
00458         {
00459             cvs_err("Time out to access '%s' !\n", (const char *)tmpPath);
00460             break;
00461         }
00462     }
00463
00464     return false;
00465 }

bool SplitPath | ( | const char * | dir,
 |  | UStr & | uppath,
 |  | UStr & | folder
 | ) |

Definition at line 326 of file TextBinary.cpp.

Referenced by CompatGetEditorMsg(), CompatGetImport(), CvsCmdAddFolder(), CvsCmdReleaseFolder(), USaveSettings::DoDataExchange(), FormatMenuString(), CTCLBrowserEnt::GetNormalized(), LaunchViewer(), CWincvsApp::LookForResourceFile(), UCvsFolders::OnCmdMacrosSel(), UCvsFiles::OnCmdUpone(), CWinCvsBrowser::OnUpdateMacro(), CHistComboBoxEx::SetIcon(), getLoc(), getSettingName(), and launchCVS().

00327 {
00328     char newdir[512];
00329     char olddir[512];
00330     char newfile[256];
00331     int lendir = strlen(dir);
00332     strcpy(olddir, dir);
00333     if(dir[lendir - 1] == kPathDelimiter)
00334     {
00335         olddir[lendir - 1] = '\0';
00336         --lendir;
00337     }
00338     const char *tmp = olddir, *prev = olddir;
00339
00340     while((tmp = strchr(tmp, kPathDelimiter)) != 0L)
00341         prev = ++tmp;
00342
00343     strcpy(newdir, olddir);
00344     newdir[prev - olddir] = '\0';
00345     strcpy(newfile, prev);
00346
00347     uppath = newdir;
00348     folder = newfile;
00349
00350     return true;
00351 }

int StringToArgv | ( | const char * | cmdLine,
 |  | char ** | argv
 | ) |

Definition at line 484 of file TextBinary.cpp.

Referenced by CompatGetCommand().

00485 {
00486     int argc = 0;
00487
00488     char    Quote = '\0';               /*  Contains the quote character if we are
00489                                             inside "" or '', or \0 otherwise */
00490     const char* walker1 = cmdLine;      /*  walker1 traverses the original
00491                                             command line */
00492     char*   walker2;                    /*  walker2 traverses the parsed copy of
00493                                             the command line */
00494     char    theChar;                    /*  theChar is the character we are currently
00495                                             parsing */
00496     char    arguments [MAX_CMD_LEN];            /*  will contain a parsed copy of the
00497                                             command line */
00498
00499     walker2 = arguments;                                        /*  copy into arguments */
00500     while ((theChar = *walker1++) != '\0') {                    /*  parse command line to \0 */
00501         if (theChar == ' ')                                     /*  skip leading space before an argument */
00502             continue;
00503         argv [argc++] = walker2;                                /*  set argv to point to the space
00504                                                                     where we copy the next argument */
00505         if (argc > MAX_ARGS) {                                  /*  if we filled argv, skip the rest */
00506             argc--;
00507             break;
00508         }
00509         do {                                                    /*  parse an argument */
00510             if (theChar == '\\' && *walker1++)                  /*  skip \s */
00511                 theChar = *walker1++;
00512             else
00513                 if ((theChar == '"') || (theChar == '\'')) {    /*  when we find a quote... */
00514                     if (Quote == '\0') {                        /*  if we are not inside quotes already, */
00515                         Quote = theChar;                        /*  remember we are inside quotes now */
00516                         continue;                               /*  go to the next character */
00517                     }
00518                     if (theChar == Quote) {                     /*  if we are already inside that kind of quotes */
00519                         Quote = '\0';                           /*  close quotes */
00520                         continue;                               /*  go to the next character */
00521                     }
00522                 }
00523             *walker2++ = theChar;                               /*  copy the character into args */
00524                                                                 /*  repeat until we reach the end of arguments
00525                                                                     or we reach a space that is not inside quotes */
00526         } while ((*walker1 != '\0') && (((theChar = *walker1++) != ' ') || (Quote != '\0')));
00527         *walker2++ = 0;                                         /* null-terminate the last argument */
00528     }
00529
00530     return argc;
00531 }

Variable Documentation

const char kPathDelimiter = '/' [static]

Definition at line 41 of file TextBinary.h.

Generated on Sun Oct 21 12:42:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsApp.cpp File Reference

common/UCvsApp.cpp File Reference

#include "stdafx.h"
#include "UCvsApp.h"
#include "UCvsCommands.h"
#include "UCvsFolders.h"
#include "UCvsFiles.h"
#include "TclGlue.h"
#include "GetPrefs.h"
#include "CvsPrefs.h"
#include "AppConsole.h"
#include "MacrosSetup.h"
#include "Authen.h"
#include "getopt.h"

Include dependency graph for UCvsApp.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void | usage (void)
void * | UCreate_pixmap (UWidget *parent, const char *fileIcon)

Function Documentation

void* UCreate_pixmap | ( | UWidget * | parent,
 |  | const char * | fileIcon
 | ) |

Definition at line 403 of file UCvsApp.cpp.

00404 {
00405 #if qGTK
00406     GtkWidget *wid = (GtkWidget *)parent->GetWidget(kUMainWidget);
00407     return GTK_PIXMAP(create_pixmap(wid, fileIcon));
00408 #else
00409     return 0L;
00410 #endif
00411 }

void usage ( void ) [static]

Definition at line 71 of file UCvsApp.cpp.

Referenced by UCvsApp::UCvsApp(), and main().

00072 {
00073     fprintf(stderr, "gcvs [--root=path]\n");
00074 }

Generated on Sun Oct 21 12:42:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsApp.h File Reference

common/UCvsApp.h File Reference

#include "uwidget.h"
#include "cvsgui_process.h"

Include dependency graph for UCvsApp.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class UCvsApp

Generated on Sun Oct 21 12:42:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsCommands.h File Reference

common/UCvsCommands.h File Reference

#include "umain.h"

Include dependency graph for UCvsCommands.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Enumerations

enum {
kUCvsFrameID = 1, kUMainConsoleID, kUCvsFoldersID, kUCvsFilesID,
kUCvsToolbarID, kUCvsMenubarID
}
enum {
cmdSAVE = EV_COMMAND_START + 100, cmdSAVE_AS, cmdPRINT, cmdPRINT_PREVIEW,
cmdPRINT_SETUP, cmdSEND_MAIL, cmdEXIT, cmdUNDO,
cmdCUT, cmdCOPY, cmdPASTE, cmdSELECT_ALL,
cmdCLEAR_ALL, cmdFIND, cmdREPEAT, cmdFONT,
cmdTOOLBAR, cmdSTATUS_BAR, cmdBROWSER_BAR, cmdFILES_BAR,
cmdMULTI_BAR, cmdTAGS_BAR, cmdCONSOLE_BAR, cmdWORKSPACE,
cmdOPEN, cmdPREFERENCES, cmdCMDLINE, cmdLOGIN,
cmdLOGOUT, cmdSTOPCVS, cmdINIT, cmdIMPORT,
cmdCHECKOUT, cmdRTAGCREATE, cmdRTAGDELETE, cmdRTAGBRANCH,
cmdUPDATE, cmdCOMMIT, cmdADD, cmdADDB,
cmdRMV, cmdTRASH, cmdTAGNEW, cmdTAGDELETE,
cmdTAGBRANCH, cmdEXPLORE, cmdQUERYUPDATE, cmdRELOAD,
cmdEDITSEL, cmdEDITSELDEF, cmdDIFF, cmdLOG,
cmdSTATUS, cmdGRAPH, cmdLOCKF, cmdUNLOCKF,
cmdEDIT, cmdUNEDIT, cmdWATCHON, cmdWATCHOFF,
cmdRELEASE, cmdWATCHERS, cmdEDITORS, cmdCASCADE,
cmdTILE_HORZ, cmdARRANGE, cmdFINDER, cmdCVS,
cmdCVSCLIENT, cmdABOUT, cmdIGNORE, cmdUPFOLDER,
cmdSAVESETTINGS, cmdSELMACRO, cmdSELMACROEND = cmdSELMACRO + 30, cmdMACROADMIN,
cmdMACROADMINEND = cmdMACROADMIN + 20, cmdCREDITS, cmdCOPYRIGHTS
}

Enumeration Type Documentation

anonymous enum

Enumeration values:
kUCvsFrameID
kUMainConsoleID
kUCvsFoldersID
kUCvsFilesID
kUCvsToolbarID
kUCvsMenubarID

Definition at line 32 of file UCvsCommands.h.

00033 {
00034     kUCvsFrameID = 1,           /* the main frane */
00035     kUMainConsoleID,            /* the pseudo-console */
00036     kUCvsFoldersID,             /* the folder tree */
00037     kUCvsFilesID,               /* the files list */
00038     kUCvsToolbarID,             /* the toolbar */
00039     kUCvsMenubarID              /* the menubar */
00040 };

anonymous enum

Enumeration values:
cmdSAVE
cmdSAVE_AS
cmdPRINT
cmdPRINT_PREVIEW
cmdPRINT_SETUP
cmdSEND_MAIL
cmdEXIT
cmdUNDO
cmdCUT
cmdCOPY
cmdPASTE
cmdSELECT_ALL
cmdCLEAR_ALL
cmdFIND
cmdREPEAT
cmdFONT
cmdTOOLBAR
cmdSTATUS_BAR
cmdBROWSER_BAR
cmdFILES_BAR
cmdMULTI_BAR
cmdTAGS_BAR
cmdCONSOLE_BAR
cmdWORKSPACE
cmdOPEN
cmdPREFERENCES
cmdCMDLINE
cmdLOGIN
cmdLOGOUT
cmdSTOPCVS
cmdINIT
cmdIMPORT
cmdCHECKOUT
cmdRTAGCREATE
cmdRTAGDELETE
cmdRTAGBRANCH
cmdUPDATE
cmdCOMMIT
cmdADD
cmdADDB
cmdRMV
cmdTRASH
cmdTAGNEW
cmdTAGDELETE
cmdTAGBRANCH
cmdEXPLORE
cmdQUERYUPDATE
cmdRELOAD
cmdEDITSEL
cmdEDITSELDEF
cmdDIFF
cmdLOG
cmdSTATUS
cmdGRAPH
cmdLOCKF
cmdUNLOCKF
cmdEDIT
cmdUNEDIT
cmdWATCHON
cmdWATCHOFF
cmdRELEASE
cmdWATCHERS
cmdEDITORS
cmdCASCADE
cmdTILE_HORZ
cmdARRANGE
cmdFINDER
cmdCVS
cmdCVSCLIENT
cmdABOUT
cmdIGNORE
cmdUPFOLDER
cmdSAVESETTINGS
cmdSELMACRO
cmdSELMACROEND
cmdMACROADMIN
cmdMACROADMINEND
cmdCREDITS
cmdCOPYRIGHTS

Definition at line 44 of file UCvsCommands.h.

00045 {
00046     cmdSAVE = EV_COMMAND_START + 100,
00047     cmdSAVE_AS,
00048     cmdPRINT,
00049     cmdPRINT_PREVIEW,
00050     cmdPRINT_SETUP,
00051     cmdSEND_MAIL,
00052     cmdEXIT,
00053     cmdUNDO,
00054     cmdCUT,
00055     cmdCOPY,
00056     cmdPASTE,
00057     cmdSELECT_ALL,
00058     cmdCLEAR_ALL,
00059     cmdFIND,
00060     cmdREPEAT,
00061     cmdFONT,
00062     cmdTOOLBAR,
00063     cmdSTATUS_BAR,
00064     cmdBROWSER_BAR,
00065     cmdFILES_BAR,
00066     cmdMULTI_BAR,
00067     cmdTAGS_BAR,
00068     cmdCONSOLE_BAR,
00069     cmdWORKSPACE,
00070     cmdOPEN,
00071     cmdPREFERENCES,
00072     cmdCMDLINE,
00073     cmdLOGIN,
00074     cmdLOGOUT,
00075     cmdSTOPCVS,
00076     cmdINIT,
00077     cmdIMPORT,
00078     cmdCHECKOUT,
00079     cmdRTAGCREATE,
00080     cmdRTAGDELETE,
00081     cmdRTAGBRANCH,
00082     cmdUPDATE,
00083     cmdCOMMIT,
00084     cmdADD,
00085     cmdADDB,
00086     cmdRMV,
00087     cmdTRASH,
00088     cmdTAGNEW,
00089     cmdTAGDELETE,
00090     cmdTAGBRANCH,
00091     cmdEXPLORE,
00092     cmdQUERYUPDATE,
00093     cmdRELOAD,
00094     cmdEDITSEL,
00095     cmdEDITSELDEF,
00096     cmdDIFF,
00097     cmdLOG,
00098     cmdSTATUS,
00099     cmdGRAPH,
00100     cmdLOCKF,
00101     cmdUNLOCKF,
00102     cmdEDIT,
00103     cmdUNEDIT,
00104     cmdWATCHON,
00105     cmdWATCHOFF,
00106     cmdRELEASE,
00107     cmdWATCHERS,
00108     cmdEDITORS,
00109     cmdCASCADE,
00110     cmdTILE_HORZ,
00111     cmdARRANGE,
00112     cmdFINDER,
00113     cmdCVS,
00114     cmdCVSCLIENT,
00115     cmdABOUT,
00116     cmdIGNORE,
00117     cmdUPFOLDER,
00118     cmdSAVESETTINGS,
00119
00120     cmdSELMACRO, // contiguous BEGIN
00121     cmdSELMACROEND = cmdSELMACRO + 30,
00122
00123     cmdMACROADMIN, // contiguous BEGIN
00124     cmdMACROADMINEND = cmdMACROADMIN + 20,
00125
00126     cmdCREDITS, // contiguous BEGIN
00127     cmdCOPYRIGHTS // END
00128 };

Generated on Sun Oct 21 12:42:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsConsole.cpp File Reference

common/UCvsConsole.cpp File Reference

#include "stdafx.h"
#include "UCvsConsole.h"
#include "UCvsCommands.h"
#include "uconsole.h"
#include "TclGlue.h"

Include dependency graph for UCvsConsole.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:42:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsConsole.h File Reference

common/UCvsConsole.h File Reference

#include "uwidget.h"
#include "AppConsole.h"

Include dependency graph for UCvsConsole.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | UCOLOR
class | UCvsConsole

Generated on Sun Oct 21 12:42:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsDialogs.h File Reference

common/UCvsDialogs.h File Reference

#include "uwidget.h"

Include dependency graph for UCvsDialogs.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void * | UCreate_pixmap (UWidget *parent, const char *fileIcon)
void * | UCreate_MainWindow (void)
void * | UCreate_GraphWindow (void)
void * | UCreate_AskYesNo (void)
void * | UCreate_gcvs_Settings (void)
void * | UCreate_UpdateDlg (void)
void * | UCreate_PasswdDlg (void)
void * | UCreate_CommitDlg (void)
void * | UCreate_DiffDlg (void)
void * | UCreate_CheckoutDlg (void)
void * | UCreate_LogDlg (void)
void * | UCreate_ImportFilterDlg (void)
void * | UCreate_ImpWarningDlg (void)
void * | UCreate_ImpEntryDlg (void)
void * | UCreate_ImportDlg (void)
void * | UCreate_CmdlineDlg (void)
void * | UCreate_TagModDlg (void)
void * | UCreate_UntagModDlg (void)
void * | UCreate_BranchModDlg (void)
void * | UCreate_TagDlg (void)
void * | UCreate_UntagDlg (void)
void * | UCreate_BranchDlg (void)
void * | UCreate_SettingsDlg (void)

Function Documentation

void* UCreate_AskYesNo ( void )

Referenced by CvsAlert().

void* UCreate_BranchDlg ( void )

Referenced by CompatTagBranch().

void* UCreate_BranchModDlg ( void )

Referenced by CompatRtagBranch().

void* UCreate_CheckoutDlg ( void )

Referenced by CompatGetCheckout().

void* UCreate_CmdlineDlg ( void )

Referenced by CompatGetCommand().

void* UCreate_CommitDlg ( void )

Referenced by CompatGetCommit().

void* UCreate_DiffDlg ( void )

Referenced by CompatGetDiff().

void* UCreate_GraphWindow ( void )

Referenced by CvsLogParse().

void* UCreate_ImpEntryDlg ( void )

void* UCreate_ImpWarningDlg ( void )

void* UCreate_ImportDlg ( void )

Referenced by CompatGetImport().

void* UCreate_ImportFilterDlg ( void )

Referenced by CompatImportFilter().

void* UCreate_LogDlg ( void )

Referenced by CompatGetLog().

void* UCreate_MainWindow ( void )

void* UCreate_PasswdDlg ( void )

Referenced by CompatGetPassword().

void* UCreate_SettingsDlg ( void )

Referenced by AskCreatePersistentSettings().

void* UCreate_TagDlg ( void )

Referenced by CompatTagCreate().

void* UCreate_TagModDlg ( void )

Referenced by CompatRtagCreate().

void* UCreate_UntagDlg ( void )

Referenced by CompatTagDelete().

void* UCreate_UntagModDlg ( void )

Referenced by CompatRtagDelete().

void* UCreate_UpdateDlg ( void )

Referenced by CompatGetUpdate().

void* UCreate_gcvs_Settings ( void )

Referenced by CompatGetPrefs().

void* UCreate_pixmap | ( | UWidget * | parent,
 |  | const char * | fileIcon
 | ) |

Definition at line 403 of file UCvsApp.cpp.

Referenced by UCvsFolders::OnCreate(), and UCvsFiles::OnCreate().

00404 {
00405 #if qGTK
00406     GtkWidget *wid = (GtkWidget *)parent->GetWidget(kUMainWidget);
00407     return GTK_PIXMAP(create_pixmap(wid, fileIcon));
00408 #else
00409     return 0L;
00410 #endif
00411 }

Generated on Sun Oct 21 12:42:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsFiles.cpp File Reference

common/UCvsFiles.cpp File Reference

#include "stdafx.h"
#include "UCvsFiles.h"
#include "UCvsDialogs.h"
#include "UCvsFolders.h"
#include "UCvsCommands.h"
#include "UCvsFrame.h"
#include "UCvsApp.h"
#include "CvsPrefs.h"
#include "FileTraversal.h"
#include "MultiFiles.h"
#include "CvsCommands.h"
#include "CvsArgs.h"
#include "TclGlue.h"
#include "AppConsole.h"
#include "MoveToTrash.h"
#include "MacrosSetup.h"

Include dependency graph for UCvsFiles.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | TViewFill

Defines

#define | NUM_COLUMNS 7

Enumerations

enum {
kFileIconText = 0, kFileIconBinary, kFileIconUnknown, kFileIconAdded,
kFileIconConflict, kFileIconMiss, kFolderIcon, kFolderIconUnknown,
kFolderIconMiss, kFileIconTextMod, kFileIconBinaryMod, kFileIconIgnored,
kFolderIconIgnored, kFileIconRemoved
}

Functions

CPersistentBool | gFileViewIgnore ("P_FileViewIgnore", true)
CPersistentInt | gFileViewSort ("P_FileViewSort", EntnodeData::kName)
CPersistentBool | gFileViewSortAsc ("P_FileViewSortAsc", true)
int | compareName (UWidget *wid, void *data1, void *data2)
int | compareStatus (UWidget *wid, void *data1, void *data2)
int | compareOption (UWidget *wid, void *data1, void *data2)
int | revcmp (const char *rev1, const char *rev2)
int | compareRevs (UWidget *wid, void *data1, void *data2)
int | compareTag (UWidget *wid, void *data1, void *data2)
int | compareConflict (UWidget *wid, void *data1, void *data2)

Variables

void * | sFileIconTextIcon
void * | sFileIconBinaryIcon
void * | sFileIconUnknownIcon
void * | sFileIconAddedIcon
void * | sFileIconConflictIcon
void * | sFileIconMissIcon
void * | sFolderIconIcon
void * | sFolderIconUnknownIcon
void * | sFolderIconMissIcon
void * | sFileIconTextModIcon
void * | sFileIconBinaryModIcon
void * | sFileIconIgnoredIcon
void * | sFolderIconIgnoredIcon
void * | sFileIconRemovedIcon
char * | _gszColumnLabel [7]
int | _gnColumnWidth [7]

Define Documentation

#define NUM_COLUMNS 7

Definition at line 192 of file UCvsFiles.cpp.

Enumeration Type Documentation

anonymous enum

Enumeration values:
kFileIconText
kFileIconBinary
kFileIconUnknown
kFileIconAdded
kFileIconConflict
kFileIconMiss
kFolderIcon
kFolderIconUnknown
kFolderIconMiss
kFileIconTextMod
kFileIconBinaryMod
kFileIconIgnored
kFolderIconIgnored
kFileIconRemoved

Definition at line 174 of file UCvsFiles.cpp.

00175 {
00176     kFileIconText = 0,
00177     kFileIconBinary,
00178     kFileIconUnknown,
00179     kFileIconAdded,
00180     kFileIconConflict,
00181     kFileIconMiss,
00182     kFolderIcon,
00183     kFolderIconUnknown,
00184     kFolderIconMiss,
00185     kFileIconTextMod,
00186     kFileIconBinaryMod,
00187     kFileIconIgnored,
00188     kFolderIconIgnored,
00189     kFileIconRemoved
00190 };

Function Documentation

int compareConflict | ( | UWidget * | wid,
 |  | void * | data1,
 |  | void * | data2
 | ) | [static]

Definition at line 2058 of file UCvsFiles.cpp.

02059 {
02060     UCvsFiles *w = (UCvsFiles *)wid;
02061     EntnodeData *d1 = (EntnodeData *)data1;
02062     EntnodeData *d2 = (EntnodeData *)data2;
02063     const char *s1 = (*d1)[EntnodeFile::kConflict];
02064     const char *s2 = (*d2)[EntnodeFile::kConflict];
02065     int res;
02066     if(s1 != 0L && s2 != 0L)
02067         res = strcmp(s1, s2);
02068     else
02069         res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
02070     if(res == 0)
02071         res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
02072     return w->IsSortAscendant() ? res : -res;
02073 }

int compareName | ( | UWidget * | wid,
 |  | void * | data1,
 |  | void * | data2
 | ) | [static]

Definition at line 1954 of file UCvsFiles.cpp.

01955 {
01956     UCvsFiles *w = (UCvsFiles *)wid;
01957     EntnodeData *d1 = (EntnodeData *)data1;
01958     EntnodeData *d2 = (EntnodeData *)data2;
01959     int res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
01960     return w->IsSortAscendant() ? res : -res;
01961 }

int compareOption | ( | UWidget * | wid,
 |  | void * | data1,
 |  | void * | data2
 | ) | [static]

Definition at line 1974 of file UCvsFiles.cpp.

01975 {
01976     UCvsFiles *w = (UCvsFiles *)wid;
01977     EntnodeData *d1 = (EntnodeData *)data1;
01978     EntnodeData *d2 = (EntnodeData *)data2;
01979     const char *s1 = (*d1)[EntnodeFile::kOption];
01980     const char *s2 = (*d2)[EntnodeFile::kOption];
01981     int res;
01982     if(s1 != 0L && s2 != 0L)
01983         res = strcmp(s1, s2);
01984     else
01985         res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
01986     if(res == 0)
01987         res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
01988     return w->IsSortAscendant() ? res : -res;
01989 }

int compareRevs | ( | UWidget * | wid,
 |  | void * | data1,
 |  | void * | data2
 | ) | [static]

Definition at line 2024 of file UCvsFiles.cpp.

02025 {
02026     UCvsFiles *w = (UCvsFiles *)wid;
02027     EntnodeData *d1 = (EntnodeData *)data1;
02028     EntnodeData *d2 = (EntnodeData *)data2;
02029     const char *s1 = (*d1)[EntnodeFile::kVN];
02030     const char *s2 = (*d2)[EntnodeFile::kVN];
02031     int res;
02032     if(s1 != 0L && s2 != 0L)
02033         res = revcmp(s1, s2);
02034     else
02035         res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
02036     if(res == 0)
02037         res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
02038     return w->IsSortAscendant() ? res : -res;
02039 }

int compareStatus | ( | UWidget * | wid,
 |  | void * | data1,
 |  | void * | data2
 | ) | [static]

Definition at line 1963 of file UCvsFiles.cpp.

01964 {
01965     UCvsFiles *w = (UCvsFiles *)wid;
01966     EntnodeData *d1 = (EntnodeData *)data1;
01967     EntnodeData *d2 = (EntnodeData *)data2;
01968     int res = stricmp((*d1)[EntnodeData::kStatus], (*d2)[EntnodeData::kStatus]);
01969     if(res == 0)
01970         res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
01971     return w->IsSortAscendant() ? res : -res;
01972 }

int compareTag | ( | UWidget * | wid,
 |  | void * | data1,
 |  | void * | data2
 | ) | [static]

Definition at line 2041 of file UCvsFiles.cpp.

02042 {
02043     UCvsFiles *w = (UCvsFiles *)wid;
02044     EntnodeData *d1 = (EntnodeData *)data1;
02045     EntnodeData *d2 = (EntnodeData *)data2;
02046     const char *s1 = (*d1)[EntnodeFile::kTag];
02047     const char *s2 = (*d2)[EntnodeFile::kTag];
02048     int res;
02049     if(s1 != 0L && s2 != 0L)
02050         res = strcmp(s1, s2);
02051     else
02052         res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
02053     if(res == 0)
02054         res = stricmp((*d1)[EntnodeData::kName], (*d2)[EntnodeData::kName]);
02055     return w->IsSortAscendant() ? res : -res;
02056 }

CPersistentBool gFileViewIgnore | ( | "P_FileViewIgnore" | ,
 |  | true |
 | ) |

CPersistentInt gFileViewSort | ( | "P_FileViewSort" | ,
 |  | EntnodeData::kName |
 | ) |

CPersistentBool gFileViewSortAsc | ( | "P_FileViewSortAsc" | ,
 |  | true |
 | ) |

int revcmp | ( | const char * | rev1,
 |  | const char * | rev2
 | ) | [static]

Definition at line 1991 of file UCvsFiles.cpp.

Referenced by KoRevisionColumn::Compare(), compareRevs(), and KoRevisionColumn::revcmp().

01992 {
01993     if(rev1 == 0L && rev2 == 0L)
01994         return 0;
01995     else if(rev1 == 0L || rev2 == 0L)
01996         return rev1 == 0L ? -1 : 1;
01997
01998     CStr r1(rev1), r2(rev2);
01999     CStr q1, q2;
02000     char *tmp;
02001     int v1, v2;
02002
02003     if((tmp = strchr(r1, '.')) != 0L)
02004     {
02005         tmp[0] = '\0';
02006         q1 = tmp + 1;
02007     }
02008
02009     v1 = atoi(r1);
02010
02011     if((tmp = strchr(r2, '.')) != 0L)
02012     {
02013         tmp[0] = '\0';
02014         q2 = tmp + 1;
02015     }
02016     v2 = atoi(r2);
02017
02018     if(v1 == v2)
02019         return revcmp(q1.empty() ? (char *)0L : (const char *)q1, q2.empty() ? (char *)0L : (const char *)q2);
02020
02021     return v1 < v2 ? -1 : 1;
02022 }

Variable Documentation

int _gnColumnWidth[ 7 ] [static]

Initial value:

{
    150, 50, 50, 100, 150, 150, 150
}

Definition at line 199 of file UCvsFiles.cpp.

char* _gszColumnLabel[ 7 ] [static]

Initial value:

{
    "Name", "Rev.", "Option", "Status", "Tag", "Date", "Conflict"
}

Definition at line 194 of file UCvsFiles.cpp.

void* sFileIconAddedIcon [static]

Definition at line 145 of file UCvsFiles.cpp.

void* sFileIconBinaryIcon [static]

Definition at line 143 of file UCvsFiles.cpp.

void* sFileIconBinaryModIcon [static]

Definition at line 152 of file UCvsFiles.cpp.

void* sFileIconConflictIcon [static]

Definition at line 146 of file UCvsFiles.cpp.

void* sFileIconIgnoredIcon [static]

Definition at line 153 of file UCvsFiles.cpp.

void* sFileIconMissIcon [static]

Definition at line 147 of file UCvsFiles.cpp.

void* sFileIconRemovedIcon [static]

Definition at line 155 of file UCvsFiles.cpp.

void* sFileIconTextIcon [static]

Definition at line 142 of file UCvsFiles.cpp.

void* sFileIconTextModIcon [static]

Definition at line 151 of file UCvsFiles.cpp.

void* sFileIconUnknownIcon [static]

Definition at line 144 of file UCvsFiles.cpp.

void* sFolderIconIcon [static]

Definition at line 148 of file UCvsFiles.cpp.

void* sFolderIconIgnoredIcon [static]

Definition at line 154 of file UCvsFiles.cpp.

void* sFolderIconMissIcon [static]

Definition at line 150 of file UCvsFiles.cpp.

void* sFolderIconUnknownIcon [static]

Definition at line 149 of file UCvsFiles.cpp.

Generated on Sun Oct 21 12:42:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsFiles.h File Reference

common/UCvsFiles.h File Reference

#include "uwidget.h"
#include "CvsEntries.h"

Include dependency graph for UCvsFiles.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class UCvsFiles

Variables

CPersistentBool gFileViewIgnore

Variable Documentation

CPersistentBool gFileViewIgnore

Definition at line 130 of file UCvsFiles.h.

Generated on Sun Oct 21 12:42:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsFolders.cpp File Reference

common/UCvsFolders.cpp File Reference

#include "stdafx.h"
#include "UCvsFolders.h"
#include "UCvsDialogs.h"
#include "UCvsApp.h"
#include "UCvsFiles.h"
#include "UCvsCommands.h"
#include "UCvsFrame.h"
#include "MultiString.h"
#include "FileTraversal.h"
#include "CvsEntries.h"
#include "CvsPrefs.h"
#include "AppConsole.h"
#include "CvsCommands.h"
#include "TclGlue.h"
#include "MacrosSetup.h"
#include "CvsArgs.h"

Include dependency graph for UCvsFolders.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | TBrowserFill
class | TBrowserFillDummy
class | CTempToggleBool

Enumerations

enum {
kIconFolderClosed, kIconFolderOpened, kIconFolderCVSClosed, kIconFolderCVSOpened,
kIconFolderIgnoreClosed, kIconFolderIgnoreOpened, kIconFolderIgnoreLost
}

Functions

CMString | gHistoryLocs (100,"P_BrowserLocs")
void * | GetIcon (UCvsFolders *treeCrtl, UTREEITEM item, bool hasCvsInfos, bool expand, EntnodeData *data)

Variables

const char * | gDummyFile = "@@@dummy file@@@"
void * | sFolderIcon
void * | sFolderUnknownIcon
void * | sFolderIgnoredIcon
void * | sFolderMissingIcon
bool | sTemporaryTurnOffNotify = false

Enumeration Type Documentation

anonymous enum

Enumeration values:
kIconFolderClosed
kIconFolderOpened
kIconFolderCVSClosed
kIconFolderCVSOpened
kIconFolderIgnoreClosed
kIconFolderIgnoreOpened
kIconFolderIgnoreLost

Definition at line 68 of file UCvsFolders.cpp.

00069 {
00070     kIconFolderClosed,
00071     kIconFolderOpened,
00072     kIconFolderCVSClosed,
00073     kIconFolderCVSOpened,
00074     kIconFolderIgnoreClosed,
00075     kIconFolderIgnoreOpened,
00076     kIconFolderIgnoreLost
00077 };

Function Documentation

void* GetIcon | ( | UCvsFolders * | treeCrtl,
 |  | UTREEITEM | item,
 |  | bool | hasCvsInfos,
 |  | bool | expand,
 |  | EntnodeData * | data
 | ) | [static]

Definition at line 167 of file UCvsFolders.cpp.

Referenced by CCJFlatButton::DrawButtonIcon(), CCJCBarButton::DrawButtonIcon(), TBrowserFill::ExitDirectory(), TBrowserFillDummy::ExitDirectory(), TBrowserFill::OnDirectory(), CCustomizeMenus::OnRemove(), and UCvsFolders::OnTreeExpanding().

00168 {
00169     int newImage;
00170     void *result = 0L;
00171
00172     if(data == 0L)
00173     {
00174         if(expand)
00175             newImage = hasCvsInfos ? kIconFolderCVSOpened : kIconFolderOpened;
00176         else
00177             newImage = hasCvsInfos ? kIconFolderCVSClosed : kIconFolderClosed;
00178     }
00179     else
00180     {
00181         if(expand)
00182         {
00183             if(data->IsIgnored())
00184                 newImage = kIconFolderIgnoreOpened;
00185             else if(data->IsUnknown())
00186                 newImage = kIconFolderOpened;
00187             else if(data->IsMissing())
00188                 newImage = kIconFolderIgnoreLost;
00189             else
00190                 newImage = kIconFolderCVSOpened;
00191         }
00192         else
00193         {
00194             if(data->IsIgnored())
00195                 newImage = kIconFolderIgnoreClosed;
00196             else if(data->IsUnknown())
00197                 newImage = kIconFolderClosed;
00198             else if(data->IsMissing())
00199                 newImage = kIconFolderIgnoreLost;
00200             else
00201                 newImage = kIconFolderCVSClosed;
00202         }
00203     }
00204
00205 #if qGTK
00206     void *pixmap = 0L;
00207     switch(newImage)
00208     {
00209     case kIconFolderClosed:
00210     case kIconFolderOpened:
00211         pixmap = sFolderUnknownIcon;
00212         break;
00213     case kIconFolderCVSClosed:
00214     case kIconFolderCVSOpened:
00215         pixmap = sFolderIcon;
00216         break;
00217     case kIconFolderIgnoreClosed:
00218     case kIconFolderIgnoreOpened:
00219         pixmap = sFolderIgnoredIcon;
00220         break;
00221     case kIconFolderIgnoreLost:
00222         pixmap = sFolderMissingIcon;
00223         break;
00224     }
00225     if(pixmap != 0L)
00226     {
00227         result = gtk_pixmap_new (GTK_PIXMAP(pixmap)->pixmap, GTK_PIXMAP(pixmap)->mask);
00228     }
00229 #endif
00230
00231     return result;
00232 }

CMString gHistoryLocs | ( | 100 | ,
 |  | "P_BrowserLocs" |
 | ) | [static]

Variable Documentation

const char* gDummyFile = "@@@dummy file@@@" [static]

Definition at line 59 of file UCvsFolders.cpp.

void* sFolderIcon [static]

Definition at line 63 of file UCvsFolders.cpp.

void* sFolderIgnoredIcon [static]

Definition at line 65 of file UCvsFolders.cpp.

void* sFolderMissingIcon [static]

Definition at line 66 of file UCvsFolders.cpp.

void* sFolderUnknownIcon [static]

Definition at line 64 of file UCvsFolders.cpp.

bool sTemporaryTurnOffNotify = false [static]

Definition at line 143 of file UCvsFolders.cpp.

Generated on Sun Oct 21 12:42:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsFolders.h File Reference

common/UCvsFolders.h File Reference

#include "uwidget.h"

Include dependency graph for UCvsFolders.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class UCvsFolders

Generated on Sun Oct 21 12:42:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsFrame.cpp File Reference

common/UCvsFrame.cpp File Reference

#include "stdafx.h"
#include "UCvsFrame.h"
#include "UCvsApp.h"
#include "UCvsCommands.h"
#include "UCvsFolders.h"
#include "CvsAlert.h"
#include "PromptFiles.h"
#include "CvsPrefs.h"
#include "AppConsole.h"
#include "CvsCommands.h"
#include "TclGlue.h"
#include "MacrosSetup.h"
#include "GetPrefs.h"
#include "UCvsDialogs.h"

Include dependency graph for UCvsFrame.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:42:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsFrame.h File Reference

common/UCvsFrame.h File Reference

#include "uwidget.h"
#include "UCvsCommands.h"

Include dependency graph for UCvsFrame.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | UCvsFrame
class | UWaitCursor

Generated on Sun Oct 21 12:42:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsGraph.cpp File Reference

common/UCvsGraph.cpp File Reference

#include "stdafx.h"
#include <sys/stat.h>
#include "UCvsGraph.h"
#include "UCvsFiles.h"
#include "CvsEntries.h"
#include "CvsLog.h"
#include "AppConsole.h"
#include "udraw.h"

Include dependency graph for UCvsGraph.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CScrollView
class | CWinLogBranchData
class | CWinLogData
class | CWinLogHeaderData
class | CWinLogRevData
class | CWinLogTagData

Functions

void | DrawNode (UDC &hdc, const URect &selfB, UCOLORREF contour, UCOLORREF shadowc, bool isRounded, bool issel)

Variables

const int | kVChildSpace = 8
const int | kHChildSpace = 40
const int | kInflateNodeSpace = 8

Function Documentation

void DrawNode | ( | UDC & | hdc,
 |  | const URect & | selfB,
 |  | UCOLORREF | contour,
 |  | UCOLORREF | shadowc,
 |  | bool | isRounded,
 |  | bool | issel
 | ) | [static]

Definition at line 197 of file UCvsGraph.cpp.

00200 {
00201     UPen *pOldPen = 0L;
00202     UBrush *pOldBrush = 0L;
00203     UPen pen, pen2;
00204     UBrush brush;
00205     UCOLORREF selcolor = URGB(160, 160, 160);
00206     UCOLORREF wcolor = URGB(255, 255, 255);
00207
00208     try
00209     {
00210         if(!isRounded)
00211         {
00212             if(!issel)
00213             {
00214                 brush.CreateSolidBrush(wcolor);
00215                 pOldBrush = hdc.SelectObject(&brush);
00216                 pen.CreatePen(UPS_SOLID, 1, contour);
00217                 pOldPen = hdc.SelectObject(&pen);
00218                 hdc.Rectangle(selfB);
00219             }
00220             else
00221             {
00222                 brush.CreateSolidBrush(selcolor);
00223                 pOldBrush = hdc.SelectObject(&brush);
00224                 pen.CreatePen(UPS_SOLID, 1, contour);
00225                 pOldPen = hdc.SelectObject(&pen);
00226                 hdc.Rectangle(selfB);
00227             }
00228         }
00229         else
00230         {
00231             URect shadow;
00232             if(!issel)
00233             {
00234                 brush.CreateSolidBrush(shadowc);
00235                 pOldBrush = hdc.SelectObject(&brush);
00236                 pen.CreatePen(UPS_SOLID, 1, shadowc);
00237                 pOldPen = hdc.SelectObject(&pen);
00238                 shadow = selfB;
00239                 shadow.OffsetRect(UPoint(2, 2));
00240                 hdc.RoundRect(shadow, UPoint(6, 6));
00241
00242                 brush.DeleteObject();
00243                 brush.CreateSolidBrush(wcolor);
00244                 hdc.SelectObject(&brush);
00245                 pen2.CreatePen(UPS_SOLID, 1, contour);
00246                 hdc.SelectObject(&pen2);
00247                 hdc.RoundRect(selfB, UPoint(6, 6));
00248             }
00249             else
00250             {
00251                 brush.CreateSolidBrush(shadowc);
00252                 pOldBrush = hdc.SelectObject(&brush);
00253                 pen.CreatePen(UPS_SOLID, 1, shadowc);
00254                 pOldPen = hdc.SelectObject(&pen);
00255                 shadow = selfB;
00256                 shadow.OffsetRect(UPoint(2, 2));
00257                 hdc.RoundRect(shadow, UPoint(6, 6));
00258
00259                 brush.DeleteObject();
00260                 brush.CreateSolidBrush(selcolor);
00261                 hdc.SelectObject(&brush);
00262                 pen2.CreatePen(UPS_SOLID, 1, contour);
00263                 hdc.SelectObject(&pen2);
00264                 hdc.RoundRect(selfB, UPoint(6, 6));
00265             }
00266         }
00267
00268         if (pOldPen != 0L)
00269         {
00270             hdc.SelectObject(pOldPen);
00271             pOldPen = 0L;
00272         }
00273         if (pOldBrush != 0L)
00274         {
00275             hdc.SelectObject(pOldBrush);
00276             pOldBrush = 0L;
00277         }
00278
00279         pen.DeleteObject();
00280         pen2.DeleteObject();
00281         brush.DeleteObject();
00282     }
00283     catch(...)
00284     {
00285         if (pOldPen != 0L)
00286             hdc.SelectObject(pOldPen);
00287         if (pOldBrush != 0L)
00288             hdc.SelectObject(pOldBrush);
00289     }
00290 }

Variable Documentation

const int kHChildSpace = 40

Definition at line 469 of file UCvsGraph.cpp.

const int kInflateNodeSpace = 8

Definition at line 470 of file UCvsGraph.cpp.

const int kVChildSpace = 8

Definition at line 468 of file UCvsGraph.cpp.

Generated on Sun Oct 21 12:42:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsGraph.h File Reference

common/UCvsGraph.h File Reference

#include "uwidget.h"

Include dependency graph for UCvsGraph.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class UCvsGraph

Generated on Sun Oct 21 12:42:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsMenubar.cpp File Reference

common/UCvsMenubar.cpp File Reference

#include "stdafx.h"
#include "UCvsMenubar.h"
#include "UCvsCommands.h"
#include "MacrosSetup.h"

Include dependency graph for UCvsMenubar.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void CreateMainMenubar (int widid)

Function Documentation

void CreateMainMenubar ( int widid )

Definition at line 55 of file UCvsMenubar.cpp.

00056 {
00057     std::vector<CMacroEntry>::const_iterator i;
00058     int cnt;
00059
00060     UMENU menu = UMenuAddPulldown(widid, "&File", UMENU_NULL);
00061     UMenuAddButton(widid, "&Save\tCtrl+S", menu, 0L, cmdSAVE);
00062     UMenuAddButton(widid, "Save &As...", menu, 0L, cmdSAVE_AS);
00063     UMenuAddSeparator(widid, menu);
00064     UMenuAddButton(widid, "&Print...\tCtrl+P", menu, 0L, cmdPRINT);
00065     UMenuAddButton(widid, "Print Pre&view", menu, 0L, cmdPRINT_PREVIEW);
00066     UMenuAddButton(widid, "P&rint Setup...", menu, 0L, cmdPRINT_SETUP);
00067     UMenuAddSeparator(widid, menu);
00068     UMenuAddButton(widid, "Sen&d...", menu, 0L, cmdSEND_MAIL);
00069     UMenuAddSeparator(widid, menu);
00070     UMenuAddButton(widid, "E&xit\tCtrl+Q", menu, 0L, cmdEXIT);
00071
00072     menu = UMenuAddPulldown(widid, "&Edit", UMENU_NULL);
00073     UMenuAddButton(widid, "&Undo\tCtrl+Z", menu, 0L, cmdUNDO);
00074     UMenuAddSeparator(widid, menu);
00075     UMenuAddButton(widid, "Cu&t\tCtrl+X", menu, 0L, cmdCUT);
00076     UMenuAddButton(widid, "&Copy\tCtrl+C", menu, 0L, cmdCOPY);
00077     UMenuAddButton(widid, "&Paste\tCtrl+V", menu, 0L, cmdPASTE);
00078     UMenuAddSeparator(widid, menu);
00079     UMenuAddButton(widid, "Select &All\tCtrl+A", menu, 0L, cmdSELECT_ALL);
00080     UMenuAddButton(widid, "&Erase all", menu, 0L, cmdCLEAR_ALL);
00081     UMenuAddSeparator(widid, menu);
00082     UMenuAddButton(widid, "&Find...\tCtrl+F", menu, 0L, cmdFIND);
00083     UMenuAddButton(widid, "Find next\tF3", menu, 0L, cmdREPEAT);
00084     UMenuAddSeparator(widid, menu);
00085     UMenuAddButton(widid, "F&ont...", menu, 0L, cmdFONT);
00086
00087     menu = UMenuAddPulldown(widid, "&View", UMENU_NULL);
00088     UMenuAddButton(widid, "&Toolbar", menu, 0L, cmdTOOLBAR);
00089     UMenuAddButton(widid, "&Status Bar", menu, 0L, cmdSTATUS_BAR);
00090     UMenuAddButton(widid, "&Browser Bar", menu, 0L, cmdBROWSER_BAR);
00091     UMenuAddButton(widid, "&Files Bar", menu, 0L, cmdFILES_BAR);
00092     UMenuAddButton(widid, "&Multi-Users Bar", menu, 0L, cmdMULTI_BAR);
00093     UMenuAddButton(widid, "T&ags Bar", menu, 0L, cmdTAGS_BAR);
00094     UMenuAddButton(widid, "&Console Bar", menu, 0L, cmdCONSOLE_BAR);
00095     UMenuAddButton(widid, "&Workspace Bar", menu, 0L, cmdWORKSPACE);
00096     UMenuAddSeparator(widid, menu);
00097     UMenuAddButton(widid, "Change browser &location...", menu, 0L, cmdOPEN);
00098     UMenuAddButton(widid, "S&ave settings for location...", menu, 0L, cmdSAVESETTINGS);
00099
00100     menu = UMenuAddPulldown(widid, "&Admin", UMENU_NULL);
00101     UMenuAddButton(widid, "Pr&eferences...\tCtrl+F1", menu, 0L, cmdPREFERENCES);
00102     UMenuAddButton(widid, "&Command Line...", menu, 0L, cmdCMDLINE);
00103     UMenuAddSeparator(widid, menu);
00104     UMenuAddButton(widid, "&Login...", menu, 0L, cmdLOGIN);
00105     UMenuAddButton(widid, "Lo&gout", menu, 0L, cmdLOGOUT);
00106     UMenuAddSeparator(widid, menu);
00107     UMenuAddButton(widid, "&Stop cvs", menu, 0L, cmdSTOPCVS);
00108     menu = UMenuAddPulldown(widid, "Macros admin", menu);
00109     for(cnt = 0, i = gMacrosAdmin.entries.begin(); i != gMacrosAdmin.entries.end(); ++i, cnt++)
00110     {
00111         UMenuAddButton(widid, (*i).name, menu, 0L, cmdMACROADMIN + cnt);
00112     }
00113
00114     menu = UMenuAddPulldown(widid, "&Create", UMENU_NULL);
00115     UMenuAddButton(widid, "&Create a new repository...", menu, 0L, cmdINIT);
00116     UMenuAddSeparator(widid, menu);
00117     UMenuAddButton(widid, "Import module...", menu, 0L, cmdIMPORT);
00118     UMenuAddButton(widid, "Checkout module...", menu, 0L, cmdCHECKOUT);
00119     UMenuAddSeparator(widid, menu);
00120     UMenuAddButton(widid, "&Create a tag by module...", menu, 0L, cmdRTAGCREATE);
00121     UMenuAddButton(widid, "&Delete a tag by module...", menu, 0L, cmdRTAGDELETE);
00122     UMenuAddButton(widid, "Create a &branch by module...", menu, 0L, cmdRTAGBRANCH);
00123
00124     menu = UMenuAddPulldown(widid, "&Modify", UMENU_NULL);
00125     UMenuAddButton(widid, "&Update selection...\tCtrl+U", menu, 0L, cmdUPDATE);
00126     UMenuAddButton(widid, "Co&mmit selection...\tCtrl+M", menu, 0L, cmdCOMMIT);
00127     UMenuAddSeparator(widid, menu);
00128     UMenuAddButton(widid, "&Add selection", menu, 0L, cmdADD);
00129     UMenuAddButton(widid, "Add selection binar&y", menu, 0L, cmdADDB);
00130     UMenuAddButton(widid, "&Remove selection", menu, 0L, cmdRMV);
00131     UMenuAddSeparator(widid, menu);
00132     UMenuAddButton(widid, "Erase &selection\tCtrl+Backspace", menu, 0L, cmdTRASH);
00133     UMenuAddSeparator(widid, menu);
00134     UMenuAddButton(widid, "&Create a tag on selection...", menu, 0L, cmdTAGNEW);
00135     UMenuAddButton(widid, "&Delete a tag on selection...", menu, 0L, cmdTAGDELETE);
00136     UMenuAddButton(widid, "Create a &branch on selection...", menu, 0L, cmdTAGBRANCH);
00137
00138     menu = UMenuAddPulldown(widid, "&Query", UMENU_NULL);
00139     UMenuAddButton(widid, "E&xplore selection\tF2", menu, 0L, cmdEXPLORE);
00140     UMenuAddButton(widid, "&Query Update\tF4", menu, 0L, cmdQUERYUPDATE);
00141     UMenuAddButton(widid, "R&eload view\tF5", menu, 0L, cmdRELOAD);
00142     UMenuAddSeparator(widid, menu);
00143     UMenuAddButton(widid, "View selection\tF7", menu, 0L, cmdEDITSEL);
00144     UMenuAddButton(widid, "View default", menu, 0L, cmdEDITSELDEF);
00145     UMenuAddSeparator(widid, menu);
00146     UMenuAddButton(widid, "&Diff selection\tAlt+=", menu, 0L, cmdDIFF);
00147     UMenuAddButton(widid, "&Log selection", menu, 0L, cmdLOG);
00148     UMenuAddButton(widid, "Status sele&ction", menu, 0L, cmdSTATUS);
00149     UMenuAddButton(widid, "Graph selection\tCtrl+G", menu, 0L, cmdGRAPH);
00150
00151     menu = UMenuAddPulldown(widid, "&Trace", UMENU_NULL);
00152     UMenuAddButton(widid, "Lock selection", menu, 0L, cmdLOCKF);
00153     UMenuAddButton(widid, "Unlock selection", menu, 0L, cmdUNLOCKF);
00154     UMenuAddButton(widid, "Edit selection", menu, 0L, cmdEDIT);
00155     UMenuAddButton(widid, "Unedit selection", menu, 0L, cmdUNEDIT);
00156     UMenuAddButton(widid, "Add a Watch on selection", menu, 0L, cmdWATCHON);
00157     UMenuAddButton(widid, "Remove a watch from selection", menu, 0L, cmdWATCHOFF);
00158     UMenuAddSeparator(widid, menu);
00159     UMenuAddButton(widid, "Release selection", menu, 0L, cmdRELEASE);
00160     UMenuAddSeparator(widid, menu);
00161     UMenuAddButton(widid, "Watchers of selection", menu, 0L, cmdWATCHERS);
00162     UMenuAddButton(widid, "Editors of selection", menu, 0L, cmdEDITORS);
00163
00164     menu = UMenuAddPulldown(widid, "Macro&s", UMENU_NULL);
00165     for(cnt = 0, i = gMacrosSel.entries.begin(); i != gMacrosSel.entries.end(); ++i, cnt++)
00166     {
00167         UMenuAddButton(widid, (*i).name, menu, 0L, cmdSELMACRO + cnt);
00168     }
00169
00170     menu = UMenuAddPulldown(widid, "&Window", UMENU_NULL);
00171     UMenuAddButton(widid, "&Cascade", menu, 0L, cmdCASCADE);
00172     UMenuAddButton(widid, "&Tile", menu, 0L, cmdTILE_HORZ);
00173     UMenuAddButton(widid, "&Arrange Icons", menu, 0L, cmdARRANGE);
00174
00175     menu = UMenuAddPulldown(widid, "&Help", UMENU_NULL);
00176     UMenuAddButton(widid, "&Help Topics", menu, 0L, cmdFINDER);
00177     UMenuAddButton(widid, "Help on cvs-1.10", menu, 0L, cmdCVS);
00178     UMenuAddButton(widid, "Help on cvs client", menu, 0L, cmdCVSCLIENT);
00179     UMenuAddSeparator(widid, menu);
00180     UMenuAddButton(widid, "&About wincvs...", menu, 0L, cmdABOUT);
00181     UMenuAddButton(widid, "&Credits", menu, 0L, cmdCREDITS);
00182     UMenuAddButton(widid, "C&opyrights", menu, 0L, cmdCOPYRIGHTS);
00183 }

Generated on Sun Oct 21 12:42:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsMenubar.h File Reference

common/UCvsMenubar.h File Reference

#include "umenu.h"

Include dependency graph for UCvsMenubar.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | UCvsMenubar

Functions

void | CreateMainMenubar (int widid)

Function Documentation

void CreateMainMenubar ( int widid )

Definition at line 55 of file UCvsMenubar.cpp.

00056 {
00057     std::vector<CMacroEntry>::const_iterator i;
00058     int cnt;
00059
00060     UMENU menu = UMenuAddPulldown(widid, "&File", UMENU_NULL);
00061     UMenuAddButton(widid, "&Save\tCtrl+S", menu, 0L, cmdSAVE);
00062     UMenuAddButton(widid, "Save &As...", menu, 0L, cmdSAVE_AS);
00063     UMenuAddSeparator(widid, menu);
00064     UMenuAddButton(widid, "&Print...\tCtrl+P", menu, 0L, cmdPRINT);
00065     UMenuAddButton(widid, "Print Pre&view", menu, 0L, cmdPRINT_PREVIEW);
00066     UMenuAddButton(widid, "P&rint Setup...", menu, 0L, cmdPRINT_SETUP);
00067     UMenuAddSeparator(widid, menu);
00068     UMenuAddButton(widid, "Sen&d...", menu, 0L, cmdSEND_MAIL);
00069     UMenuAddSeparator(widid, menu);
00070     UMenuAddButton(widid, "E&xit\tCtrl+Q", menu, 0L, cmdEXIT);
00071
00072     menu = UMenuAddPulldown(widid, "&Edit", UMENU_NULL);
00073     UMenuAddButton(widid, "&Undo\tCtrl+Z", menu, 0L, cmdUNDO);
00074     UMenuAddSeparator(widid, menu);
00075     UMenuAddButton(widid, "Cu&t\tCtrl+X", menu, 0L, cmdCUT);
00076     UMenuAddButton(widid, "&Copy\tCtrl+C", menu, 0L, cmdCOPY);
00077     UMenuAddButton(widid, "&Paste\tCtrl+V", menu, 0L, cmdPASTE);
00078     UMenuAddSeparator(widid, menu);
00079     UMenuAddButton(widid, "Select &All\tCtrl+A", menu, 0L, cmdSELECT_ALL);
00080     UMenuAddButton(widid, "&Erase all", menu, 0L, cmdCLEAR_ALL);
00081     UMenuAddSeparator(widid, menu);
00082     UMenuAddButton(widid, "&Find...\tCtrl+F", menu, 0L, cmdFIND);
00083     UMenuAddButton(widid, "Find next\tF3", menu, 0L, cmdREPEAT);
00084     UMenuAddSeparator(widid, menu);
00085     UMenuAddButton(widid, "F&ont...", menu, 0L, cmdFONT);
00086
00087     menu = UMenuAddPulldown(widid, "&View", UMENU_NULL);
00088     UMenuAddButton(widid, "&Toolbar", menu, 0L, cmdTOOLBAR);
00089     UMenuAddButton(widid, "&Status Bar", menu, 0L, cmdSTATUS_BAR);
00090     UMenuAddButton(widid, "&Browser Bar", menu, 0L, cmdBROWSER_BAR);
00091     UMenuAddButton(widid, "&Files Bar", menu, 0L, cmdFILES_BAR);
00092     UMenuAddButton(widid, "&Multi-Users Bar", menu, 0L, cmdMULTI_BAR);
00093     UMenuAddButton(widid, "T&ags Bar", menu, 0L, cmdTAGS_BAR);
00094     UMenuAddButton(widid, "&Console Bar", menu, 0L, cmdCONSOLE_BAR);
00095     UMenuAddButton(widid, "&Workspace Bar", menu, 0L, cmdWORKSPACE);
00096     UMenuAddSeparator(widid, menu);
00097     UMenuAddButton(widid, "Change browser &location...", menu, 0L, cmdOPEN);
00098     UMenuAddButton(widid, "S&ave settings for location...", menu, 0L, cmdSAVESETTINGS);
00099
00100     menu = UMenuAddPulldown(widid, "&Admin", UMENU_NULL);
00101     UMenuAddButton(widid, "Pr&eferences...\tCtrl+F1", menu, 0L, cmdPREFERENCES);
00102     UMenuAddButton(widid, "&Command Line...", menu, 0L, cmdCMDLINE);
00103     UMenuAddSeparator(widid, menu);
00104     UMenuAddButton(widid, "&Login...", menu, 0L, cmdLOGIN);
00105     UMenuAddButton(widid, "Lo&gout", menu, 0L, cmdLOGOUT);
00106     UMenuAddSeparator(widid, menu);
00107     UMenuAddButton(widid, "&Stop cvs", menu, 0L, cmdSTOPCVS);
00108     menu = UMenuAddPulldown(widid, "Macros admin", menu);
00109     for(cnt = 0, i = gMacrosAdmin.entries.begin(); i != gMacrosAdmin.entries.end(); ++i, cnt++)
00110     {
00111         UMenuAddButton(widid, (*i).name, menu, 0L, cmdMACROADMIN + cnt);
00112     }
00113
00114     menu = UMenuAddPulldown(widid, "&Create", UMENU_NULL);
00115     UMenuAddButton(widid, "&Create a new repository...", menu, 0L, cmdINIT);
00116     UMenuAddSeparator(widid, menu);
00117     UMenuAddButton(widid, "Import module...", menu, 0L, cmdIMPORT);
00118     UMenuAddButton(widid, "Checkout module...", menu, 0L, cmdCHECKOUT);
00119     UMenuAddSeparator(widid, menu);
00120     UMenuAddButton(widid, "&Create a tag by module...", menu, 0L, cmdRTAGCREATE);
00121     UMenuAddButton(widid, "&Delete a tag by module...", menu, 0L, cmdRTAGDELETE);
00122     UMenuAddButton(widid, "Create a &branch by module...", menu, 0L, cmdRTAGBRANCH);
00123
00124     menu = UMenuAddPulldown(widid, "&Modify", UMENU_NULL);
00125     UMenuAddButton(widid, "&Update selection...\tCtrl+U", menu, 0L, cmdUPDATE);
00126     UMenuAddButton(widid, "Co&mmit selection...\tCtrl+M", menu, 0L, cmdCOMMIT);
00127     UMenuAddSeparator(widid, menu);
00128     UMenuAddButton(widid, "&Add selection", menu, 0L, cmdADD);
00129     UMenuAddButton(widid, "Add selection binar&y", menu, 0L, cmdADDB);
00130     UMenuAddButton(widid, "&Remove selection", menu, 0L, cmdRMV);
00131     UMenuAddSeparator(widid, menu);
00132     UMenuAddButton(widid, "Erase &selection\tCtrl+Backspace", menu, 0L, cmdTRASH);
00133     UMenuAddSeparator(widid, menu);
00134     UMenuAddButton(widid, "&Create a tag on selection...", menu, 0L, cmdTAGNEW);
00135     UMenuAddButton(widid, "&Delete a tag on selection...", menu, 0L, cmdTAGDELETE);
00136     UMenuAddButton(widid, "Create a &branch on selection...", menu, 0L, cmdTAGBRANCH);
00137
00138     menu = UMenuAddPulldown(widid, "&Query", UMENU_NULL);
00139     UMenuAddButton(widid, "E&xplore selection\tF2", menu, 0L, cmdEXPLORE);
00140     UMenuAddButton(widid, "&Query Update\tF4", menu, 0L, cmdQUERYUPDATE);
00141     UMenuAddButton(widid, "R&eload view\tF5", menu, 0L, cmdRELOAD);
00142     UMenuAddSeparator(widid, menu);
00143     UMenuAddButton(widid, "View selection\tF7", menu, 0L, cmdEDITSEL);
00144     UMenuAddButton(widid, "View default", menu, 0L, cmdEDITSELDEF);
00145     UMenuAddSeparator(widid, menu);
00146     UMenuAddButton(widid, "&Diff selection\tAlt+=", menu, 0L, cmdDIFF);
00147     UMenuAddButton(widid, "&Log selection", menu, 0L, cmdLOG);
00148     UMenuAddButton(widid, "Status sele&ction", menu, 0L, cmdSTATUS);
00149     UMenuAddButton(widid, "Graph selection\tCtrl+G", menu, 0L, cmdGRAPH);
00150
00151     menu = UMenuAddPulldown(widid, "&Trace", UMENU_NULL);
00152     UMenuAddButton(widid, "Lock selection", menu, 0L, cmdLOCKF);
00153     UMenuAddButton(widid, "Unlock selection", menu, 0L, cmdUNLOCKF);
00154     UMenuAddButton(widid, "Edit selection", menu, 0L, cmdEDIT);
00155     UMenuAddButton(widid, "Unedit selection", menu, 0L, cmdUNEDIT);
00156     UMenuAddButton(widid, "Add a Watch on selection", menu, 0L, cmdWATCHON);
00157     UMenuAddButton(widid, "Remove a watch from selection", menu, 0L, cmdWATCHOFF);
00158     UMenuAddSeparator(widid, menu);
00159     UMenuAddButton(widid, "Release selection", menu, 0L, cmdRELEASE);
00160     UMenuAddSeparator(widid, menu);
00161     UMenuAddButton(widid, "Watchers of selection", menu, 0L, cmdWATCHERS);
00162     UMenuAddButton(widid, "Editors of selection", menu, 0L, cmdEDITORS);
00163
00164     menu = UMenuAddPulldown(widid, "Macro&s", UMENU_NULL);
00165     for(cnt = 0, i = gMacrosSel.entries.begin(); i != gMacrosSel.entries.end(); ++i, cnt++)
00166     {
00167         UMenuAddButton(widid, (*i).name, menu, 0L, cmdSELMACRO + cnt);
00168     }
00169
00170     menu = UMenuAddPulldown(widid, "&Window", UMENU_NULL);
00171     UMenuAddButton(widid, "&Cascade", menu, 0L, cmdCASCADE);
00172     UMenuAddButton(widid, "&Tile", menu, 0L, cmdTILE_HORZ);
00173     UMenuAddButton(widid, "&Arrange Icons", menu, 0L, cmdARRANGE);
00174
00175     menu = UMenuAddPulldown(widid, "&Help", UMENU_NULL);
00176     UMenuAddButton(widid, "&Help Topics", menu, 0L, cmdFINDER);
00177     UMenuAddButton(widid, "Help on cvs-1.10", menu, 0L, cmdCVS);
00178     UMenuAddButton(widid, "Help on cvs client", menu, 0L, cmdCVSCLIENT);
00179     UMenuAddSeparator(widid, menu);
00180     UMenuAddButton(widid, "&About wincvs...", menu, 0L, cmdABOUT);
00181     UMenuAddButton(widid, "&Credits", menu, 0L, cmdCREDITS);
00182     UMenuAddButton(widid, "C&opyrights", menu, 0L, cmdCOPYRIGHTS);
00183 }

Generated on Sun Oct 21 12:42:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsToolbar.cpp File Reference

common/UCvsToolbar.cpp File Reference

#include "stdafx.h"
#include "UCvsToolbar.h"
#include "UCvsCommands.h"

Include dependency graph for UCvsToolbar.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void CreateMainToolbar (void)

Function Documentation

void CreateMainToolbar ( void )

Definition at line 54 of file UCvsToolbar.cpp.

00055 {
00056     UTB_INIT init;
00057     init.widthbtn = 16;
00058     init.heightbtn = 16;
00059     init.title = "Main Toolbar";
00060     UEventSendMessage(kUCvsToolbarID, EV_TB_INIT, 0, &init);
00061
00062     UTB_BUTTON updtBtn = {
00063         "update.xpm",
00064         cmdUPDATE,
00065         DDV_NONE,
00066         DDD_NONE,
00067         "Update the selected items, changes your disk only\nUpdate selected"
00068     };
00069     UTB_BUTTON commitBtn = {
00070         "commit.xpm",
00071         cmdCOMMIT,
00072         DDV_NONE,
00073         DDD_NONE,
00074         "Commit the selected items, changes the remote repository\nCommit selected"
00075     };
00076     UTB_BUTTON stopBtn = {
00077         "stop.xpm",
00078         cmdSTOPCVS,
00079         DDV_NONE,
00080         DDD_NONE,
00081         "Stop when cvs is running...\nStop cvs..."
00082     };
00083     UTB_BUTTON ignoreBtn = {
00084         "ignore.xpm",
00085         cmdIGNORE,
00086         DDV_NONE,
00087         DDD_NONE,
00088         "View or hide the cvs ignored files/folders\nIgnore switch"
00089     };
00090     UTB_BUTTON reloadBtn = {
00091         "reload.xpm",
00092         cmdRELOAD,
00093         DDV_NONE,
00094         DDD_NONE,
00095         "Refresh the views, updating the contents\nRefresh view"
00096     };
00097     UTB_BUTTON exploreBtn = {
00098         "explore.xpm",
00099         cmdEXPLORE,
00100         DDV_NONE,
00101         DDD_NONE,
00102         "Open an explorer window for this selection\nExplore selection"
00103     };
00104     UTB_BUTTON upBtn = {
00105         "upfolder.xpm",
00106         cmdUPFOLDER,
00107         DDV_NONE,
00108         DDD_NONE,
00109         "Go to the upper folder and refresh\nUp one level"
00110     };
00111     UTB_BUTTON diffBtn = {
00112         "diff.xpm",
00113         cmdDIFF,
00114         DDV_NONE,
00115         DDD_NONE,
00116         "Print the differences with the CVS remote repository\nDiff selected"
00117     };
00118     UTB_BUTTON logBtn = {
00119         "log.xpm",
00120         cmdLOG,
00121         DDV_NONE,
00122         DDD_NONE,
00123         "Print the history of the selected files\nLog selected"
00124     };
00125     UTB_BUTTON statusBtn = {
00126         "status.xpm",
00127         cmdSTATUS,
00128         DDV_NONE,
00129         DDD_NONE,
00130         "Print the current status of the selected files\nStatus selected"
00131     };
00132     UTB_BUTTON graphBtn = {
00133         "graph.xpm",
00134         cmdGRAPH,
00135         DDV_NONE,
00136         DDD_NONE,
00137         "Print the history as a graph of the selected files\nGraph selected"
00138     };
00139     UTB_BUTTON trashBtn = {
00140         "trash.xpm",
00141         cmdTRASH,
00142         DDV_NONE,
00143         DDD_NONE,
00144         "Erase the selection from your disk\nErase selected"
00145     };
00146     UTB_BUTTON addBtn = {
00147         "add.xpm",
00148         cmdADD,
00149         DDV_NONE,
00150         DDD_NONE,
00151         "Add the selected items to the remote CVS repository\nAdd selected"
00152     };
00153     UTB_BUTTON addbBtn = {
00154         "addb.xpm",
00155         cmdADDB,
00156         DDV_NONE,
00157         DDD_NONE,
00158         "Add the selected binary items to the remote CVS repository\nAdd selected binary"
00159     };
00160     UTB_BUTTON rmvBtn = {
00161         "remove.xpm",
00162         cmdRMV,
00163         DDV_NONE,
00164         DDD_NONE,
00165         "Remove the selected items to the remote CVS repository\nRemove selected"
00166     };
00167     UTB_BUTTON tagBtn = {
00168         "tag.xpm",
00169         cmdTAGNEW,
00170         DDV_NONE,
00171         DDD_NONE,
00172         "Create/move a tag on the selection\nTag selection"
00173     };
00174     UTB_BUTTON untagBtn = {
00175         "untag.xpm",
00176         cmdTAGDELETE,
00177         DDV_NONE,
00178         DDD_NONE,
00179         "Remove a tag on the selection\nUntag selection"
00180     };
00181     UTB_BUTTON branchBtn = {
00182         "branch.xpm",
00183         cmdTAGBRANCH,
00184         DDV_NONE,
00185         DDD_NONE,
00186         "Open (fork) a branch on the selection\nFork selection"
00187     };
00188     UTB_BUTTON lockBtn = {
00189         "lock.xpm",
00190         cmdLOCKF,
00191         DDV_NONE,
00192         DDD_NONE,
00193         "Lock the selected file on the remote repository until next commit\nLock selection"
00194     };
00195     UTB_BUTTON unlockBtn = {
00196         "unlock.xpm",
00197         cmdUNLOCKF,
00198         DDV_NONE,
00199         DDD_NONE,
00200         "Unlock the selected file on the remote repository\nUnlock selection"
00201     };
00202     UTB_BUTTON watchBtn = {
00203         "watch.xpm",
00204         cmdWATCHON,
00205         DDV_NONE,
00206         DDD_NONE,
00207         "Put a watch on the selected files\nWatch selection"
00208     };
00209     UTB_BUTTON unwatchBtn = {
00210         "unwatch.xpm",
00211         cmdWATCHOFF,
00212         DDV_NONE,
00213         DDD_NONE,
00214         "Release a watch on the selected files\nRelease watch selection"
00215     };
00216     UTB_BUTTON editBtn = {
00217         "edit.xpm",
00218         cmdEDIT,
00219         DDV_NONE,
00220         DDD_NONE,
00221         "Edit the selected files\nEdit selection"
00222     };
00223     UTB_BUTTON uneditBtn = {
00224         "unedit.xpm",
00225         cmdUNEDIT,
00226         DDV_NONE,
00227         DDD_NONE,
00228         "Unedit the selected files\nUnedit selection"
00229     };
00230     UTB_BUTTON releaseBtn = {
00231         "release.xpm",
00232         cmdRELEASE,
00233         DDV_NONE,
00234         DDD_NONE,
00235         "Release the selected files\nRelease selection"
00236     };
00237     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &updtBtn);
00238     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &commitBtn);
00239     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00240     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &stopBtn);
00241     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00242     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &addBtn);
00243     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &addbBtn);
00244     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &rmvBtn);
00245     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00246     UEventSendMessage(kUCvsToolbarID, EV_TB_CHECKBTN, 0, &ignoreBtn);
00247     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &reloadBtn);
00248     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &exploreBtn);
00249     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &upBtn);
00250     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00251     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &diffBtn);
00252     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &logBtn);
00253     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &statusBtn);
00254     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00255     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &graphBtn);
00256     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00257     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &trashBtn);
00258     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00259     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &tagBtn);
00260     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &untagBtn);
00261     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &branchBtn);
00262     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00263     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &lockBtn);
00264     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &unlockBtn);
00265     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00266     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &watchBtn);
00267     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &unwatchBtn);
00268     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00269     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &editBtn);
00270     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &uneditBtn);
00271     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00272     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &releaseBtn);
00273
00274     UEventSendMessage(kUCvsToolbarID, EV_TB_END, 0, 0L);
00275 }

Generated on Sun Oct 21 12:42:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsToolbar.h File Reference

common/UCvsToolbar.h File Reference

#include "utoolbar.h"

Include dependency graph for UCvsToolbar.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | UCvsToolbar

Functions

void | CreateMainToolbar (void)

Function Documentation

void CreateMainToolbar ( void )

Definition at line 54 of file UCvsToolbar.cpp.

00055 {
00056     UTB_INIT init;
00057     init.widthbtn = 16;
00058     init.heightbtn = 16;
00059     init.title = "Main Toolbar";
00060     UEventSendMessage(kUCvsToolbarID, EV_TB_INIT, 0, &init);
00061
00062     UTB_BUTTON updtBtn = {
00063         "update.xpm",
00064         cmdUPDATE,
00065         DDV_NONE,
00066         DDD_NONE,
00067         "Update the selected items, changes your disk only\nUpdate selected"
00068     };
00069     UTB_BUTTON commitBtn = {
00070         "commit.xpm",
00071         cmdCOMMIT,
00072         DDV_NONE,
00073         DDD_NONE,
00074         "Commit the selected items, changes the remote repository\nCommit selected"
00075     };
00076     UTB_BUTTON stopBtn = {
00077         "stop.xpm",
00078         cmdSTOPCVS,
00079         DDV_NONE,
00080         DDD_NONE,
00081         "Stop when cvs is running...\nStop cvs..."
00082     };
00083     UTB_BUTTON ignoreBtn = {
00084         "ignore.xpm",
00085         cmdIGNORE,
00086         DDV_NONE,
00087         DDD_NONE,
00088         "View or hide the cvs ignored files/folders\nIgnore switch"
00089     };
00090     UTB_BUTTON reloadBtn = {
00091         "reload.xpm",
00092         cmdRELOAD,
00093         DDV_NONE,
00094         DDD_NONE,
00095         "Refresh the views, updating the contents\nRefresh view"
00096     };
00097     UTB_BUTTON exploreBtn = {
00098         "explore.xpm",
00099         cmdEXPLORE,
00100         DDV_NONE,
00101         DDD_NONE,
00102         "Open an explorer window for this selection\nExplore selection"
00103     };
00104     UTB_BUTTON upBtn = {
00105         "upfolder.xpm",
00106         cmdUPFOLDER,
00107         DDV_NONE,
00108         DDD_NONE,
00109         "Go to the upper folder and refresh\nUp one level"
00110     };
00111     UTB_BUTTON diffBtn = {
00112         "diff.xpm",
00113         cmdDIFF,
00114         DDV_NONE,
00115         DDD_NONE,
00116         "Print the differences with the CVS remote repository\nDiff selected"
00117     };
00118     UTB_BUTTON logBtn = {
00119         "log.xpm",
00120         cmdLOG,
00121         DDV_NONE,
00122         DDD_NONE,
00123         "Print the history of the selected files\nLog selected"
00124     };
00125     UTB_BUTTON statusBtn = {
00126         "status.xpm",
00127         cmdSTATUS,
00128         DDV_NONE,
00129         DDD_NONE,
00130         "Print the current status of the selected files\nStatus selected"
00131     };
00132     UTB_BUTTON graphBtn = {
00133         "graph.xpm",
00134         cmdGRAPH,
00135         DDV_NONE,
00136         DDD_NONE,
00137         "Print the history as a graph of the selected files\nGraph selected"
00138     };
00139     UTB_BUTTON trashBtn = {
00140         "trash.xpm",
00141         cmdTRASH,
00142         DDV_NONE,
00143         DDD_NONE,
00144         "Erase the selection from your disk\nErase selected"
00145     };
00146     UTB_BUTTON addBtn = {
00147         "add.xpm",
00148         cmdADD,
00149         DDV_NONE,
00150         DDD_NONE,
00151         "Add the selected items to the remote CVS repository\nAdd selected"
00152     };
00153     UTB_BUTTON addbBtn = {
00154         "addb.xpm",
00155         cmdADDB,
00156         DDV_NONE,
00157         DDD_NONE,
00158         "Add the selected binary items to the remote CVS repository\nAdd selected binary"
00159     };
00160     UTB_BUTTON rmvBtn = {
00161         "remove.xpm",
00162         cmdRMV,
00163         DDV_NONE,
00164         DDD_NONE,
00165         "Remove the selected items to the remote CVS repository\nRemove selected"
00166     };
00167     UTB_BUTTON tagBtn = {
00168         "tag.xpm",
00169         cmdTAGNEW,
00170         DDV_NONE,
00171         DDD_NONE,
00172         "Create/move a tag on the selection\nTag selection"
00173     };
00174     UTB_BUTTON untagBtn = {
00175         "untag.xpm",
00176         cmdTAGDELETE,
00177         DDV_NONE,
00178         DDD_NONE,
00179         "Remove a tag on the selection\nUntag selection"
00180     };
00181     UTB_BUTTON branchBtn = {
00182         "branch.xpm",
00183         cmdTAGBRANCH,
00184         DDV_NONE,
00185         DDD_NONE,
00186         "Open (fork) a branch on the selection\nFork selection"
00187     };
00188     UTB_BUTTON lockBtn = {
00189         "lock.xpm",
00190         cmdLOCKF,
00191         DDV_NONE,
00192         DDD_NONE,
00193         "Lock the selected file on the remote repository until next commit\nLock selection"
00194     };
00195     UTB_BUTTON unlockBtn = {
00196         "unlock.xpm",
00197         cmdUNLOCKF,
00198         DDV_NONE,
00199         DDD_NONE,
00200         "Unlock the selected file on the remote repository\nUnlock selection"
00201     };
00202     UTB_BUTTON watchBtn = {
00203         "watch.xpm",
00204         cmdWATCHON,
00205         DDV_NONE,
00206         DDD_NONE,
00207         "Put a watch on the selected files\nWatch selection"
00208     };
00209     UTB_BUTTON unwatchBtn = {
00210         "unwatch.xpm",
00211         cmdWATCHOFF,
00212         DDV_NONE,
00213         DDD_NONE,
00214         "Release a watch on the selected files\nRelease watch selection"
00215     };
00216     UTB_BUTTON editBtn = {
00217         "edit.xpm",
00218         cmdEDIT,
00219         DDV_NONE,
00220         DDD_NONE,
00221         "Edit the selected files\nEdit selection"
00222     };
00223     UTB_BUTTON uneditBtn = {
00224         "unedit.xpm",
00225         cmdUNEDIT,
00226         DDV_NONE,
00227         DDD_NONE,
00228         "Unedit the selected files\nUnedit selection"
00229     };
00230     UTB_BUTTON releaseBtn = {
00231         "release.xpm",
00232         cmdRELEASE,
00233         DDV_NONE,
00234         DDD_NONE,
00235         "Release the selected files\nRelease selection"
00236     };
00237     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &updtBtn);
00238     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &commitBtn);
00239     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00240     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &stopBtn);
00241     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00242     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &addBtn);
00243     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &addbBtn);
00244     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &rmvBtn);
00245     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00246     UEventSendMessage(kUCvsToolbarID, EV_TB_CHECKBTN, 0, &ignoreBtn);
00247     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &reloadBtn);
00248     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &exploreBtn);
00249     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &upBtn);
00250     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00251     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &diffBtn);
00252     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &logBtn);
00253     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &statusBtn);
00254     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00255     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &graphBtn);
00256     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00257     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &trashBtn);
00258     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00259     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &tagBtn);
00260     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &untagBtn);
00261     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &branchBtn);
00262     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00263     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &lockBtn);
00264     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &unlockBtn);
00265     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00266     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &watchBtn);
00267     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &unwatchBtn);
00268     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00269     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &editBtn);
00270     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &uneditBtn);
00271     UEventSendMessage(kUCvsToolbarID, EV_TB_SEPARATOR, 0, 0L);
00272     UEventSendMessage(kUCvsToolbarID, EV_TB_BUTTON, 0, &releaseBtn);
00273
00274     UEventSendMessage(kUCvsToolbarID, EV_TB_END, 0, 0L);
00275 }

Generated on Sun Oct 21 12:42:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UpdateDlg.cpp File Reference

common/UpdateDlg.cpp File Reference

#include "stdafx.h"
#include "UpdateDlg.h"
#include "CvsPrefs.h"

Include dependency graph for UpdateDlg.cpp:

Include dependency graph

Go to the source code of this file.

Functions

CMString | gRevNames (10,"P_TagNames", sDefTagNames)
CMString | gDateNames (10,"P_DateNames", sDefDateNames)
CMString | gDateOrRevNames (20,"P_RebDateNames", sDefRevDateNames)
bool | CompatGetUpdate (bool &toStdout, bool &noRecurs, bool &resetSticky, UPStr &date, UPStr &rev, bool &useMostRecent, UPStr &rev1, UPStr &rev2, bool &createMissDir, bool &getCleanCopy)

Variables

char * | sDefTagNames []
char * | sDefDateNames []
char * | sDefRevDateNames []

Function Documentation

bool CompatGetUpdate | ( | bool & | toStdout,
 |  | bool & | noRecurs,
 |  | bool & | resetSticky,
 |  | UPStr & | date,
 |  | UPStr & | rev,
 |  | bool & | useMostRecent,
 |  | UPStr & | rev1,
 |  | UPStr & | rev2,
 |  | bool & | createMissDir,
 |  | bool & | getCleanCopy
 | ) |

Definition at line 680 of file UpdateDlg.cpp.

00686 {
00687     bool userHitOK = false;
00688
00689     static CPStr sLastDate;
00690     static CPStr sLastRev;
00691     static CPStr sLastRev1;
00692     static CPStr sLastRev2;
00693
00694     bool hasDate = false;
00695     bool hasRev = false;
00696     bool merge1 = false;
00697     bool merge2 = false;
00698
00699     date = "";
00700     rev = "";
00701     rev1 = "";
00702     rev2 = "";
00703     toStdout = false;
00704     noRecurs = false;
00705     resetSticky = false;
00706     useMostRecent = false;
00707     createMissDir = false;
00708     getCleanCopy = false;
00709
00710 #ifdef WIN32
00711     COptionalPropertySheet pages(gCvsPrefs.HideCommandDlgUpdate(), "Update settings");
00712     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00713     CUpdateMain page1;
00714     CUpdateSticky page2(sLastRev, sLastDate);
00715     CUpdateMerge page3(sLastRev1, sLastRev2);
00716     CGetPrefs_GLOBALS page4;
00717     pages.AddPage(&page1);
00718     pages.AddPage(&page2);
00719     pages.AddPage(&page3);
00720     pages.AddPage(&page4);
00721     if(pages.DoModal() == IDOK)
00722     {
00723         toStdout = page1.m_stdout == TRUE;
00724         noRecurs = page1.m_norecurs == TRUE;
00725         resetSticky = page1.m_delsticky == TRUE;
00726         createMissDir = page1.m_createmissdir == TRUE;
00727         getCleanCopy = page1.m_getcleancopy == TRUE;
00728
00729         sLastDate = page2.m_date;
00730         sLastRev = page2.m_rev;
00731         hasDate = page2.m_hasdate == TRUE;
00732         hasRev = page2.m_hasrev == TRUE;
00733         useMostRecent = page2.m_match == TRUE;
00734
00735         merge1 = page3.m_merge >= 1;
00736         merge2 = page3.m_merge == 2;
00737         sLastRev1 = page3.m_rev1;
00738         sLastRev2 = page3.m_rev2;
00739
00740         page4.StoreValues();
00741         gCvsPrefs.SetHideCommandDlgUpdate(pages.GetHideCommandDlg());
00742         userHitOK = true;
00743     }
00744 #endif /* WIN32 */
00745 #ifdef qMacCvsPP
00746     StDialogHandler theHandler(dlg_Update, LCommander::GetTopCommander());
00747     LWindow *theDialog = theHandler.GetDialog();
00748     ThrowIfNil_(theDialog);
00749     static UInt16 sRuntimePanel = 1;
00750
00751     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00752         (theDialog->FindPaneByID(item_MultiViewPrefs));
00753     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00754
00755     multiView->SwitchToPanel(4);
00756     DoDataExchange_Globals(theDialog, true);
00757     multiView->SwitchToPanel(3);
00758     DoDataExchange_UpdateMerge(theDialog, merge1, merge2, sLastRev1, sLastRev2, true);
00759     multiView->SwitchToPanel(2);
00760     DoDataExchange_UpdateSticky(theDialog, hasDate, hasRev, sLastDate, sLastRev, useMostRecent, true);
00761     multiView->SwitchToPanel(1);
00762     DoDataExchange_UpdateSettings(theDialog, toStdout, noRecurs, resetSticky, createMissDir, getCleanCopy, true);
00763
00764     groupView->SetValue(sRuntimePanel);
00765     theDialog->Show();
00766     MessageT hitMessage;
00767     while (true)
00768     {       // Let DialogHandler process events
00769         hitMessage = theHandler.DoDialog();
00770
00771         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00772             break;
00773     }
00774     theDialog->Hide();
00775     sRuntimePanel = groupView->GetValue();
00776
00777     if(hitMessage == msg_OK)
00778     {
00779         multiView->SwitchToPanel(1);
00780         DoDataExchange_UpdateSettings(theDialog, toStdout, noRecurs, resetSticky, createMissDir, getCleanCopy, false);
00781         multiView->SwitchToPanel(2);
00782         DoDataExchange_UpdateSticky(theDialog, hasDate, hasRev, sLastDate, sLastRev, useMostRecent, false);
00783         multiView->SwitchToPanel(3);
00784         DoDataExchange_UpdateMerge(theDialog, merge1, merge2, sLastRev1, sLastRev2, false);
00785         multiView->SwitchToPanel(4);
00786         DoDataExchange_Globals(theDialog, false);
00787         userHitOK = true;
00788     }
00789 #endif /* qMacCvsPP */
00790 #if qUnix
00791     void *wid;
00792 #   if qGTK
00793     wid = UCreate_UpdateDlg();
00794 #   endif
00795
00796     UCvsUpdate *dlg = new UCvsUpdate();
00797     UCvsUpdate_MAIN *tab1 = new UCvsUpdate_MAIN();
00798     UCvsUpdate_STICKY *tab2 = new UCvsUpdate_STICKY(sLastRev, sLastDate);
00799     UCvsUpdate_MERGE *tab3 = new UCvsUpdate_MERGE(sLastRev1, sLastRev2);
00800     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00801     dlg->AddPage(tab1, UCvsUpdate::kTabGeneral, 0);
00802     dlg->AddPage(tab2, UCvsUpdate::kTabGeneral, 1);
00803     dlg->AddPage(tab3, UCvsUpdate::kTabGeneral, 2);
00804
00805     if(dlg->DoModal())
00806     {
00807         toStdout = tab1->m_toStdout;
00808         noRecurs = tab1->m_noRecurs;
00809         resetSticky = tab1->m_resetSticky;
00810         createMissDir = tab1->m_createMissDir;
00811
00812         sLastDate = tab2->m_date;
00813         sLastRev = tab2->m_rev;
00814         hasDate = tab2->m_hasdate;
00815         hasRev = tab2->m_hasrev;
00816         useMostRecent = tab2->m_match;
00817
00818         merge1 = tab3->m_merge >= 1;
00819         merge2 = tab3->m_merge == 2;
00820         sLastRev1 = tab3->m_rev1;
00821         sLastRev2 = tab3->m_rev2;
00822
00823         userHitOK = true;
00824     }
00825
00826     delete dlg;
00827 #endif // qUnix
00828
00829     if(userHitOK)
00830     {
00831         if(hasDate && !sLastDate.empty())
00832             date = sLastDate;
00833         if(hasRev && !sLastRev.empty())
00834             rev = sLastRev;
00835
00836         if(merge1 && merge2 && !sLastRev1.empty() && !sLastRev2.empty())
00837         {
00838             rev1 = sLastRev1;
00839             rev2 = sLastRev2;
00840         }
00841         if(merge1 && !merge2 && !sLastRev1.empty())
00842         {
00843             rev1 = sLastRev1;
00844         }
00845
00846         gCvsPrefs.save();
00847     }
00848
00849     return userHitOK;
00850 }

CMString gDateNames | ( | 10 | ,
 |  | "P_DateNames" | ,
 |  | sDefDateNames |
 | ) |

CMString gDateOrRevNames | ( | 20 | ,
 |  | "P_RebDateNames" | ,
 |  | sDefRevDateNames |
 | ) |

CMString gRevNames | ( | 10 | ,
 |  | "P_TagNames" | ,
 |  | sDefTagNames |
 | ) |

Variable Documentation

char* sDefDateNames[]

Initial value:

{
    "1998-3",
    "1998-3-24",
    "1998-3-24 20:55",
    "24 Mar",
    "24 Mar 1998",
    "<=1998-3-24",
    0L
}

Definition at line 68 of file UpdateDlg.cpp.

char* sDefRevDateNames[]

Initial value:

{
    "1.1",
    "1.6.2.4",
    "HEAD",
    "branch-release-1-0",
    "1998-3",
    "1998-3-24",
    "1998-3-24 20:55",
    "24 Mar",
    "24 Mar 1998",
    "<=1998-3-24",
    0L
}

Definition at line 79 of file UpdateDlg.cpp.

char* sDefTagNames[]

Initial value:

{
    "1.1",
    "1.6.2.4",
    "HEAD",
    "branch-release-1-0",
    0L
}

Definition at line 59 of file UpdateDlg.cpp.

Generated on Sun Oct 21 12:42:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UpdateDlg.h File Reference

common/UpdateDlg.h File Reference

#include "CPStr.h"
#include "MultiString.h"

Include dependency graph for UpdateDlg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_UPDATEDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Functions

bool | CompatGetUpdate (bool &toStdout, bool &noRecurs, bool &resetSticky, UPStr &date, UPStr &rev, bool &useMostRecent, UPStr &rev1, UPStr &rev2, bool &createMissDir, bool &getCleanCopy)

Variables

CMString gRevNames
CMString gDateNames
CMString gDateOrRevNames

Define Documentation

#define AFX_UPDATEDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file UpdateDlg.h.

Function Documentation

bool CompatGetUpdate | ( | bool & | toStdout,
 |  | bool & | noRecurs,
 |  | bool & | resetSticky,
 |  | UPStr & | date,
 |  | UPStr & | rev,
 |  | bool & | useMostRecent,
 |  | UPStr & | rev1,
 |  | UPStr & | rev2,
 |  | bool & | createMissDir,
 |  | bool & | getCleanCopy
 | ) |

Definition at line 680 of file UpdateDlg.cpp.

Referenced by CvsCmdUpdateFiles(), and CvsCmdUpdateFolder().

00686 {
00687     bool userHitOK = false;
00688
00689     static CPStr sLastDate;
00690     static CPStr sLastRev;
00691     static CPStr sLastRev1;
00692     static CPStr sLastRev2;
00693
00694     bool hasDate = false;
00695     bool hasRev = false;
00696     bool merge1 = false;
00697     bool merge2 = false;
00698
00699     date = "";
00700     rev = "";
00701     rev1 = "";
00702     rev2 = "";
00703     toStdout = false;
00704     noRecurs = false;
00705     resetSticky = false;
00706     useMostRecent = false;
00707     createMissDir = false;
00708     getCleanCopy = false;
00709
00710 #ifdef WIN32
00711     COptionalPropertySheet pages(gCvsPrefs.HideCommandDlgUpdate(), "Update settings");
00712     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00713     CUpdateMain page1;
00714     CUpdateSticky page2(sLastRev, sLastDate);
00715     CUpdateMerge page3(sLastRev1, sLastRev2);
00716     CGetPrefs_GLOBALS page4;
00717     pages.AddPage(&page1);
00718     pages.AddPage(&page2);
00719     pages.AddPage(&page3);
00720     pages.AddPage(&page4);
00721     if(pages.DoModal() == IDOK)
00722     {
00723         toStdout = page1.m_stdout == TRUE;
00724         noRecurs = page1.m_norecurs == TRUE;
00725         resetSticky = page1.m_delsticky == TRUE;
00726         createMissDir = page1.m_createmissdir == TRUE;
00727         getCleanCopy = page1.m_getcleancopy == TRUE;
00728
00729         sLastDate = page2.m_date;
00730         sLastRev = page2.m_rev;
00731         hasDate = page2.m_hasdate == TRUE;
00732         hasRev = page2.m_hasrev == TRUE;
00733         useMostRecent = page2.m_match == TRUE;
00734
00735         merge1 = page3.m_merge >= 1;
00736         merge2 = page3.m_merge == 2;
00737         sLastRev1 = page3.m_rev1;
00738         sLastRev2 = page3.m_rev2;
00739
00740         page4.StoreValues();
00741         gCvsPrefs.SetHideCommandDlgUpdate(pages.GetHideCommandDlg());
00742         userHitOK = true;
00743     }
00744 #endif /* WIN32 */
00745 #ifdef qMacCvsPP
00746     StDialogHandler theHandler(dlg_Update, LCommander::GetTopCommander());
00747     LWindow *theDialog = theHandler.GetDialog();
00748     ThrowIfNil_(theDialog);
00749     static UInt16 sRuntimePanel = 1;
00750
00751     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00752         (theDialog->FindPaneByID(item_MultiViewPrefs));
00753     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00754
00755     multiView->SwitchToPanel(4);
00756     DoDataExchange_Globals(theDialog, true);
00757     multiView->SwitchToPanel(3);
00758     DoDataExchange_UpdateMerge(theDialog, merge1, merge2, sLastRev1, sLastRev2, true);
00759     multiView->SwitchToPanel(2);
00760     DoDataExchange_UpdateSticky(theDialog, hasDate, hasRev, sLastDate, sLastRev, useMostRecent, true);
00761     multiView->SwitchToPanel(1);
00762     DoDataExchange_UpdateSettings(theDialog, toStdout, noRecurs, resetSticky, createMissDir, getCleanCopy, true);
00763
00764     groupView->SetValue(sRuntimePanel);
00765     theDialog->Show();
00766     MessageT hitMessage;
00767     while (true)
00768     {       // Let DialogHandler process events
00769         hitMessage = theHandler.DoDialog();
00770
00771         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00772             break;
00773     }
00774     theDialog->Hide();
00775     sRuntimePanel = groupView->GetValue();
00776
00777     if(hitMessage == msg_OK)
00778     {
00779         multiView->SwitchToPanel(1);
00780         DoDataExchange_UpdateSettings(theDialog, toStdout, noRecurs, resetSticky, createMissDir, getCleanCopy, false);
00781         multiView->SwitchToPanel(2);
00782         DoDataExchange_UpdateSticky(theDialog, hasDate, hasRev, sLastDate, sLastRev, useMostRecent, false);
00783         multiView->SwitchToPanel(3);
00784         DoDataExchange_UpdateMerge(theDialog, merge1, merge2, sLastRev1, sLastRev2, false);
00785         multiView->SwitchToPanel(4);
00786         DoDataExchange_Globals(theDialog, false);
00787         userHitOK = true;
00788     }
00789 #endif /* qMacCvsPP */
00790 #if qUnix
00791     void *wid;
00792 #   if qGTK
00793     wid = UCreate_UpdateDlg();
00794 #   endif
00795
00796     UCvsUpdate *dlg = new UCvsUpdate();
00797     UCvsUpdate_MAIN *tab1 = new UCvsUpdate_MAIN();
00798     UCvsUpdate_STICKY *tab2 = new UCvsUpdate_STICKY(sLastRev, sLastDate);
00799     UCvsUpdate_MERGE *tab3 = new UCvsUpdate_MERGE(sLastRev1, sLastRev2);
00800     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00801     dlg->AddPage(tab1, UCvsUpdate::kTabGeneral, 0);
00802     dlg->AddPage(tab2, UCvsUpdate::kTabGeneral, 1);
00803     dlg->AddPage(tab3, UCvsUpdate::kTabGeneral, 2);
00804
00805     if(dlg->DoModal())
00806     {
00807         toStdout = tab1->m_toStdout;
00808         noRecurs = tab1->m_noRecurs;
00809         resetSticky = tab1->m_resetSticky;
00810         createMissDir = tab1->m_createMissDir;
00811
00812         sLastDate = tab2->m_date;
00813         sLastRev = tab2->m_rev;
00814         hasDate = tab2->m_hasdate;
00815         hasRev = tab2->m_hasrev;
00816         useMostRecent = tab2->m_match;
00817
00818         merge1 = tab3->m_merge >= 1;
00819         merge2 = tab3->m_merge == 2;
00820         sLastRev1 = tab3->m_rev1;
00821         sLastRev2 = tab3->m_rev2;
00822
00823         userHitOK = true;
00824     }
00825
00826     delete dlg;
00827 #endif // qUnix
00828
00829     if(userHitOK)
00830     {
00831         if(hasDate && !sLastDate.empty())
00832             date = sLastDate;
00833         if(hasRev && !sLastRev.empty())
00834             rev = sLastRev;
00835
00836         if(merge1 && merge2 && !sLastRev1.empty() && !sLastRev2.empty())
00837         {
00838             rev1 = sLastRev1;
00839             rev2 = sLastRev2;
00840         }
00841         if(merge1 && !merge2 && !sLastRev1.empty())
00842         {
00843             rev1 = sLastRev1;
00844         }
00845
00846         gCvsPrefs.save();
00847     }
00848
00849     return userHitOK;
00850 }

Variable Documentation

CMString gDateNames

Definition at line 44 of file UpdateDlg.h.

CMString gDateOrRevNames

Definition at line 45 of file UpdateDlg.h.

CMString gRevNames

Definition at line 43 of file UpdateDlg.h.

Generated on Sun Oct 21 12:42:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


VolsPaths.c File Reference

common/VolsPaths.c File Reference

#include "VolsPaths.h"
#include <Types.h>
#include <Files.h>
#include <Resources.h>
#include <errors.h>
#include <Memory.h>
#include <string.h>
#include <strings.h>
#include <TextUtils.h>

Include dependency graph for VolsPaths.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | VOLSPATHS_C

Functions

OSErr | VRef2VolName (short theVRef, StringPtr theVolName)
OSErr | VolName2VRef (StringPtr myPVolName, short *theVRefPtr)
OSErr | PathNameFromDirID (const long aDirID, const short avRefNum, char *aPath)
OSErr | PathNameFromWD (const short avRefNum, char *aPath)

Define Documentation

#define VOLSPATHS_C

Definition at line 39 of file VolsPaths.c.

Function Documentation

OSErr PathNameFromDirID | ( | const long | aDirID,
 |  | const short | avRefNum,
 |  | char * | aPath
 | ) |

Definition at line 158 of file VolsPaths.c.

00161 {
00162     Handle      strHandle = NULL;
00163     OSErr       anError = noErr;
00164     long        currDirID = 0,
00165                 nextDirID = 0;
00166     Size        theLen = 0;     // GetHandleSize
00167     char        tempName[64];   // directory or volume name
00168     CInfoPBRec  aPBblock;
00169
00170     /* create an empty string handle for Munger */
00171     strHandle = NewHandle(0);
00172
00173     if (strHandle == NULL)
00174     {
00175         anError = MemError();
00176     }
00177     else
00178     {
00179         *aPath = '\0';
00180         aPBblock.dirInfo.ioCompletion   = NULL;
00181         aPBblock.dirInfo.ioNamePtr      = (StringPtr)tempName;  // temp destination buffer
00182         nextDirID                       = aDirID;   // start at DirID passed in..
00183
00184         /* walk up the directories, collecting dir names as we go, until we hit the top (volname) */
00185         do {
00186
00187             aPBblock.dirInfo.ioVRefNum      = avRefNum;
00188             aPBblock.dirInfo.ioFDirIndex    = -1; // ignore ioNamePtr input, use ioDirID
00189             aPBblock.dirInfo.ioDrDirID      = nextDirID;
00190
00191             anError = PBGetCatInfoSync(&aPBblock);
00192             currDirID   = aPBblock.dirInfo.ioDrDirID;   // remember current
00193             nextDirID   = aPBblock.dirInfo.ioDrParID;   // find parent for next loop
00194
00195             if (anError != noErr)
00196                 break;
00197
00198             /* Insert a separator in front of the Directory Entry */
00199             Munger(strHandle, 0L, NULL, 0L, ":", 1L);
00200
00201             /* Insert the next directory/volume name into the front of the string */
00202             Munger(strHandle, 0L, NULL, 0L, &(tempName[1]), (long)tempName[0]);
00203
00204             /* NOTE: fsRtDirID is defined in Files.h */
00205         } while (currDirID != fsRtDirID);
00206
00207         /* now move the string into the parameter */
00208         theLen = GetHandleSize(strHandle);
00209         if (!anError && theLen)
00210         {
00211             BlockMove(&(**strHandle), aPath, theLen);
00212             anError = MemError();
00213         }
00214         aPath[theLen] = '\0';   /* set C string length */
00215
00216         /* dispose of temp storage */
00217         DisposeHandle(strHandle);
00218
00219     } /*else NULL*/
00220
00221     return(anError);
00222
00223 } /* PathNameFromDirID */

OSErr PathNameFromWD | ( | const short | avRefNum,
 |  | char * | aPath
 | ) |

Definition at line 247 of file VolsPaths.c.

00249 {
00250     WDPBRec aPBblock;
00251     OSErr   anError = noErr;
00252
00253 /*
00254  PBGetWDInfo has a bug under A/UX 1.1.  If vRefNum is a real vRefNum
00255  and not a wdRefNum, then it returns garbage.  Since A/UX has only 1
00256  volume (in the Macintosh sense) and only 1 root directory, this can
00257  occur only when a file has been selected in the root directory (/).
00258  So we look for this and hard code the DirID and vRefNum.
00259  */
00260 #if defined(AUX)
00261     if ((aPathStyle == ePathTypeAUX) && (avRefNum == -1))
00262     {
00263         anError = PathNameFromDirID(fsRtDirID, -1, aPath);
00264     }
00265     else
00266 #endif
00267     {
00268         aPBblock.ioCompletion = NULL;
00269         aPBblock.ioNamePtr = NULL;
00270         aPBblock.ioVRefNum = avRefNum;
00271         aPBblock.ioWDIndex = 0;
00272         aPBblock.ioWDProcID = 0;
00273
00274         /* Change the Working Directory number in vRefnum into a real vRefnum */
00275         /* and DirID. The real vRefnum is returned in ioVRefnum, and the real */
00276         /* DirID is returned in ioWDDirID. */
00277
00278         anError = PBGetWDInfoSync(&aPBblock);
00279         if (anError == noErr)
00280             anError = PathNameFromDirID(aPBblock.ioWDDirID,
00281                                         aPBblock.ioWDVRefNum,
00282                                         aPath);
00283     }
00284
00285     return(anError);
00286
00287 } /* PathNameFromWD */

OSErr VRef2VolName | ( | short | theVRef,
 |  | StringPtr | theVolName
 | ) |

Definition at line 71 of file VolsPaths.c.

00072 {
00073     OSErr           anError;
00074     HVolumeParam    pbVInfo;
00075
00076     pbVInfo.ioCompletion = NULL;
00077     theVolName[0] = '\0';
00078     pbVInfo.ioNamePtr = theVolName;
00079     pbVInfo.ioVRefNum = theVRef;
00080     pbVInfo.ioVolIndex = 0; // use VRefNum only
00081     anError = PBHGetVInfoSync((HParmBlkPtr)&pbVInfo);
00082
00083     return anError;
00084 } // VRef2VolName

OSErr VolName2VRef | ( | StringPtr | myPVolName,
 |  | short * | theVRefPtr
 | ) |

Definition at line 90 of file VolsPaths.c.

00091 {
00092     OSErr           anError = noErr;
00093     Boolean         foundIt = false;
00094     short           theDriveNum;
00095     short           theVRefNum;
00096     HParamBlockRec  aParamBlk;
00097     char            myCVolName[32], theCVolName[32];
00098     Str31           theVolName;
00099
00100     // convert passed vol name from P 2 C string for compare
00101     p2cstrcpy(myCVolName, myPVolName);
00102
00103     // loop through all mounted volumes, see if myPVolName matches one
00104     for (theDriveNum = 1; !foundIt && (anError==noErr); theDriveNum++)
00105     {
00106         theVolName[0] = '\0';
00107         aParamBlk.volumeParam.ioNamePtr = (StringPtr)&theVolName;
00108         aParamBlk.volumeParam.ioVolIndex = theDriveNum;
00109
00110         anError = PBHGetVInfoSync((HParmBlkPtr)&aParamBlk);
00111         if (anError == noErr)
00112         {
00113             p2cstrcpy(theCVolName, theVolName);
00114             if (strcmp(theCVolName, myCVolName)==0)
00115             {
00116                 foundIt = true;
00117                 theVRefNum = aParamBlk.volumeParam.ioVRefNum;
00118             }
00119         }
00120     }
00121
00122     if (foundIt)
00123         *theVRefPtr = theVRefNum;
00124     else
00125         *theVRefPtr = 0;
00126
00127     if (anError == nsvErr) // no such vol, just bumped end of volume list
00128         anError = noErr;
00129
00130     return anError;
00131 } // VolName2VRef

Generated on Sun Oct 21 12:42:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


VolsPaths.h File Reference

common/VolsPaths.h File Reference

#include <Types.h>

Include dependency graph for VolsPaths.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

OSErr | VRef2VolName (short theVRef, StringPtr theVolName)
OSErr | VolName2VRef (StringPtr myPVolName, short *theVRefPtr)
OSErr | PathNameFromDirID (const long aDirID, const short avRefNum, char *aPath)
OSErr | PathNameFromWD (const short avRefNum, char *aPath)

Function Documentation

OSErr PathNameFromDirID | ( | const long | aDirID,
 |  | const short | avRefNum,
 |  | char * | aPath
 | ) |

Definition at line 158 of file VolsPaths.c.

Referenced by PathNameFromWD().

00161 {
00162     Handle      strHandle = NULL;
00163     OSErr       anError = noErr;
00164     long        currDirID = 0,
00165                 nextDirID = 0;
00166     Size        theLen = 0;     // GetHandleSize
00167     char        tempName[64];   // directory or volume name
00168     CInfoPBRec  aPBblock;
00169
00170     /* create an empty string handle for Munger */
00171     strHandle = NewHandle(0);
00172
00173     if (strHandle == NULL)
00174     {
00175         anError = MemError();
00176     }
00177     else
00178     {
00179         *aPath = '\0';
00180         aPBblock.dirInfo.ioCompletion   = NULL;
00181         aPBblock.dirInfo.ioNamePtr      = (StringPtr)tempName;  // temp destination buffer
00182         nextDirID                       = aDirID;   // start at DirID passed in..
00183
00184         /* walk up the directories, collecting dir names as we go, until we hit the top (volname) */
00185         do {
00186
00187             aPBblock.dirInfo.ioVRefNum      = avRefNum;
00188             aPBblock.dirInfo.ioFDirIndex    = -1; // ignore ioNamePtr input, use ioDirID
00189             aPBblock.dirInfo.ioDrDirID      = nextDirID;
00190
00191             anError = PBGetCatInfoSync(&aPBblock);
00192             currDirID   = aPBblock.dirInfo.ioDrDirID;   // remember current
00193             nextDirID   = aPBblock.dirInfo.ioDrParID;   // find parent for next loop
00194
00195             if (anError != noErr)
00196                 break;
00197
00198             /* Insert a separator in front of the Directory Entry */
00199             Munger(strHandle, 0L, NULL, 0L, ":", 1L);
00200
00201             /* Insert the next directory/volume name into the front of the string */
00202             Munger(strHandle, 0L, NULL, 0L, &(tempName[1]), (long)tempName[0]);
00203
00204             /* NOTE: fsRtDirID is defined in Files.h */
00205         } while (currDirID != fsRtDirID);
00206
00207         /* now move the string into the parameter */
00208         theLen = GetHandleSize(strHandle);
00209         if (!anError && theLen)
00210         {
00211             BlockMove(&(**strHandle), aPath, theLen);
00212             anError = MemError();
00213         }
00214         aPath[theLen] = '\0';   /* set C string length */
00215
00216         /* dispose of temp storage */
00217         DisposeHandle(strHandle);
00218
00219     } /*else NULL*/
00220
00221     return(anError);
00222
00223 } /* PathNameFromDirID */

OSErr PathNameFromWD | ( | const short | avRefNum,
 |  | char * | aPath
 | ) |

Definition at line 247 of file VolsPaths.c.

00249 {
00250     WDPBRec aPBblock;
00251     OSErr   anError = noErr;
00252
00253 /*
00254  PBGetWDInfo has a bug under A/UX 1.1.  If vRefNum is a real vRefNum
00255  and not a wdRefNum, then it returns garbage.  Since A/UX has only 1
00256  volume (in the Macintosh sense) and only 1 root directory, this can
00257  occur only when a file has been selected in the root directory (/).
00258  So we look for this and hard code the DirID and vRefNum.
00259  */
00260 #if defined(AUX)
00261     if ((aPathStyle == ePathTypeAUX) && (avRefNum == -1))
00262     {
00263         anError = PathNameFromDirID(fsRtDirID, -1, aPath);
00264     }
00265     else
00266 #endif
00267     {
00268         aPBblock.ioCompletion = NULL;
00269         aPBblock.ioNamePtr = NULL;
00270         aPBblock.ioVRefNum = avRefNum;
00271         aPBblock.ioWDIndex = 0;
00272         aPBblock.ioWDProcID = 0;
00273
00274         /* Change the Working Directory number in vRefnum into a real vRefnum */
00275         /* and DirID. The real vRefnum is returned in ioVRefnum, and the real */
00276         /* DirID is returned in ioWDDirID. */
00277
00278         anError = PBGetWDInfoSync(&aPBblock);
00279         if (anError == noErr)
00280             anError = PathNameFromDirID(aPBblock.ioWDDirID,
00281                                         aPBblock.ioWDVRefNum,
00282                                         aPath);
00283     }
00284
00285     return(anError);
00286
00287 } /* PathNameFromWD */

OSErr VRef2VolName | ( | short | theVRef,
 |  | StringPtr | theVolName
 | ) |

Definition at line 71 of file VolsPaths.c.

00072 {
00073     OSErr           anError;
00074     HVolumeParam    pbVInfo;
00075
00076     pbVInfo.ioCompletion = NULL;
00077     theVolName[0] = '\0';
00078     pbVInfo.ioNamePtr = theVolName;
00079     pbVInfo.ioVRefNum = theVRef;
00080     pbVInfo.ioVolIndex = 0; // use VRefNum only
00081     anError = PBHGetVInfoSync((HParmBlkPtr)&pbVInfo);
00082
00083     return anError;
00084 } // VRef2VolName

OSErr VolName2VRef | ( | StringPtr | myPVolName,
 |  | short * | theVRefPtr
 | ) |

Definition at line 90 of file VolsPaths.c.

00091 {
00092     OSErr           anError = noErr;
00093     Boolean         foundIt = false;
00094     short           theDriveNum;
00095     short           theVRefNum;
00096     HParamBlockRec  aParamBlk;
00097     char            myCVolName[32], theCVolName[32];
00098     Str31           theVolName;
00099
00100     // convert passed vol name from P 2 C string for compare
00101     p2cstrcpy(myCVolName, myPVolName);
00102
00103     // loop through all mounted volumes, see if myPVolName matches one
00104     for (theDriveNum = 1; !foundIt && (anError==noErr); theDriveNum++)
00105     {
00106         theVolName[0] = '\0';
00107         aParamBlk.volumeParam.ioNamePtr = (StringPtr)&theVolName;
00108         aParamBlk.volumeParam.ioVolIndex = theDriveNum;
00109
00110         anError = PBHGetVInfoSync((HParmBlkPtr)&aParamBlk);
00111         if (anError == noErr)
00112         {
00113             p2cstrcpy(theCVolName, theVolName);
00114             if (strcmp(theCVolName, myCVolName)==0)
00115             {
00116                 foundIt = true;
00117                 theVRefNum = aParamBlk.volumeParam.ioVRefNum;
00118             }
00119         }
00120     }
00121
00122     if (foundIt)
00123         *theVRefPtr = theVRefNum;
00124     else
00125         *theVRefPtr = 0;
00126
00127     if (anError == nsvErr) // no such vol, just bumped end of volume list
00128         anError = noErr;
00129
00130     return anError;
00131 } // VolName2VRef

Generated on Sun Oct 21 12:42:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


acconfig.h File Reference

cvs-1.10/acconfig.h File Reference

Go to the source code of this file.

Generated on Sun Oct 21 12:42:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


analyze.c File Reference

cvs-1.10/diff/analyze.c File Reference

#include "diff.h"
#include "cmpbuf.h"

Include dependency graph for analyze.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | partition

Defines

#define | SNAKE_LIMIT 20

Functions

int | diag ()
change * add_change ()
change * build_reverse_script ()
change * build_script ()
void | briefly_report ()
void | compareseq ()
void | discard_confusing_lines ()
void | shift_boundaries ()
int | diag (xoff, xlim, yoff, ylim, minimal, part) int xoff, xlim, yoff, ylim, minimal
void | shift_boundaries (filevec) struct file_data filevec[]

Variables

int | no_discards
int * | xvec
int * | yvec
int * | fdiag
int * | bdiag
int | too_expensive
partition * part
xlim
yoff
ylim
minimal
line1
deleted
inserted
change * old
file_data const | filevec []
int | depth

Define Documentation

#define SNAKE_LIMIT 20

Definition at line 48 of file analyze.c.

Function Documentation

struct change* add_change ( ) [static]

void briefly_report ( ) [static]

Referenced by depth().

struct change* build_reverse_script ( ) [static]

struct change* build_script ( ) [static]

void compareseq ( ) [static]

int diag | ( | xoff | ,
 |  | xlim | ,
 |  | yoff | ,
 |  | ylim | ,
 |  | minimal | ,
 |  | part |
 | ) | [static]

int diag ( ) [static]

void discard_confusing_lines ( ) [static]

void shift_boundaries ( filevec ) [static]

void shift_boundaries ( ) [static]

Variable Documentation

int* bdiag [static]

Definition at line 41 of file analyze.c.

deleted

Definition at line 733 of file analyze.c.

int depth

Definition at line 836 of file analyze.c.

int* fdiag [static]

Definition at line 37 of file analyze.c.

struct file_data const filevec[]

Definition at line 823 of file analyze.c.

inserted

Definition at line 733 of file analyze.c.

line1

Definition at line 733 of file analyze.c.

minimal

Definition at line 339 of file analyze.c.

int no_discards

Definition at line 34 of file analyze.c.

struct change* old

Definition at line 734 of file analyze.c.

struct partition* part

Definition at line 100 of file analyze.c.

int too_expensive [static]

Definition at line 45 of file analyze.c.

xlim

Definition at line 339 of file analyze.c.

int* xvec [static]

Definition at line 36 of file analyze.c.

ylim

Definition at line 339 of file analyze.c.

yoff

Definition at line 339 of file analyze.c.

int * yvec [static]

Definition at line 36 of file analyze.c.

Generated on Sun Oct 21 12:42:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cmpbuf.c File Reference

cvs-1.10/diff/cmpbuf.c File Reference

#include "system.h"
#include "cmpbuf.h"

Include dependency graph for cmpbuf.c:

Include dependency graph

Go to the source code of this file.

Functions

size_t buffer_lcm (a, b) size_t a, b

Function Documentation

size_t buffer_lcm | ( | a | ,
 |  | b |
 | ) |

Referenced by depth().

Generated on Sun Oct 21 12:42:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cmpbuf.h File Reference

cvs-1.10/diff/cmpbuf.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

size_t buffer_lcm PARAMS ((size_t, size_t))

Function Documentation

size_t buffer_lcm PARAMS ( (size_t, size_t) )

Generated on Sun Oct 21 12:42:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


context.c File Reference

cvs-1.10/diff/context.c File Reference

#include "diff.h"

Include dependency graph for context.c:

Include dependency graph

Go to the source code of this file.

Functions

change * find_hunk ()
void | find_function ()
void | mark_ignorable ()
void | pr_context_hunk ()
void | pr_unidiff_hunk ()
void | print_context_label ()
void | print_context_number_range ()
void | print_unidiff_number_range ()
void | print_context_label (mark, inf, label) char const *mark

Variables

int | find_function_last_search
int | find_function_last_match
file_data * inf
char const * | label
int | unidiff_flag
int | a
int | b
int | linenum
char const ** | linep
size_t * | lenp

Function Documentation

void find_function ( ) [static]

struct change* find_hunk ( ) [static]

void mark_ignorable ( ) [static]

void pr_context_hunk ( ) [static]

void pr_unidiff_hunk ( ) [static]

void print_context_label | ( | mark | ,
 |  | inf | ,
 |  | label |
 | ) | const [static]

void print_context_label ( ) [static]

void print_context_number_range ( ) [static]

void print_unidiff_number_range ( ) [static]

Variable Documentation

int a

Definition at line 717 of file util.c.

int b

Definition at line 717 of file util.c.

int find_function_last_match [static]

Definition at line 33 of file context.c.

int find_function_last_search [static]

Definition at line 30 of file context.c.

struct file_data* inf

Definition at line 40 of file context.c.

char const* label

Definition at line 41 of file context.c.

size_t * lenp

Definition at line 1847 of file rcs.c.

int linenum

Definition at line 428 of file context.c.

char const** linep

Definition at line 429 of file context.c.

int unidiff_flag

Definition at line 79 of file context.c.

Generated on Sun Oct 21 12:42:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


diff.c File Reference

cvs-1.10/diff/diff.c File Reference

#include "diff.h"
#include <signal.h>
#include "getopt.h"
#include "fnmatch.h"

Include dependency graph for diff.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | GDIFF_MAIN
#define | DEFAULT_WIDTH 130
#define | GUTTER_WIDTH_MINIMUM 3

Functions

char const * | filetype ()
char * | option_list ()
int | add_exclude_file ()
int | ck_atoi ()
int | compare_files ()
int | specify_format ()
void | add_exclude ()
void | add_regexp ()
void | specify_style ()
int | try_help ()
void | check_output ()
void | usage ()
void | initialize_main ()
char * | option_list (optionvec, count) char **optionvec
int | excluded_filename (f) char const *f
int | diff_run (argc, argv, out, callbacks_arg) int argc
int | specify_format (var, value) char **var

Variables

int | recursive
int | no_discards
int | count
int * | out
int | exclude_alloc
int | exclude_count
char * | argv []
const struct diff_callbacks * | callbacks_arg
char const * | pattern
char * | value
* dir1
char const * | name0
char const * | name1
int | depth
char *** | argvp

Define Documentation

#define DEFAULT_WIDTH 130

Definition at line 28 of file diff.c.

#define GDIFF_MAIN

Definition at line 21 of file diff.c.

#define GUTTER_WIDTH_MINIMUM 3

Definition at line 32 of file diff.c.

Function Documentation

void add_exclude ( ) [static]

int add_exclude_file ( ) [static]

void add_regexp ( ) [static]

void check_output ( ) [static]

int ck_atoi ( ) [static]

int compare_files ( ) [static]

int diff_run | ( | argc | ,
 |  | argv | ,
 |  | out | ,
 |  | callbacks_arg |
 | ) |

int excluded_filename ( f ) const

char const* filetype ( ) [static]

void initialize_main ( ) [static]

char* option_list | ( | optionvec | ,
 |  | count |
 | ) | [static]

char* option_list ( ) [static]

int specify_format | ( | var | ,
 |  | value |
 | ) | [static]

int specify_format ( ) [static]

void specify_style ( ) [static]

int try_help ( ) [static]

void usage ( void ) [static]

Definition at line 824 of file diff.c.

00825 {
00826   char const * const *p;
00827
00828   if (callbacks && callbacks->write_stdout)
00829     {
00830       (*callbacks->write_stdout) ("Usage: ");
00831       (*callbacks->write_stdout) (diff_program_name);
00832       (*callbacks->write_stdout) (" [OPTION]... FILE1 FILE2\n\n");
00833       for (p = option_help;  *p;  p++)
00834     {
00835       (*callbacks->write_stdout) ("  ");
00836       (*callbacks->write_stdout) (*p);
00837       (*callbacks->write_stdout) ("\n");
00838     }
00839       (*callbacks->write_stdout)
00840     ("\nIf FILE1 or FILE2 is `-', read standard input.\n");
00841     }
00842   else
00843     {
00844       printf ("Usage: %s [OPTION]... FILE1 FILE2\n\n", diff_program_name);
00845       for (p = option_help;  *p;  p++)
00846     printf ("  %s\n", *p);
00847       printf ("\nIf FILE1 or FILE2 is `-', read standard input.\n");
00848     }
00849 }

Variable Documentation

char* argv[]

Definition at line 234 of file diff.c.

char*** argvp

Definition at line 1211 of file diff.c.

const struct diff_callbacks* callbacks_arg

Definition at line 236 of file diff.c.

int count

Definition at line 79 of file diff.c.

int depth

Definition at line 934 of file diff.c.

* dir1

Definition at line 932 of file diff.c.

int exclude_alloc [static]

Definition at line 119 of file diff.c.

int exclude_count [static]

Definition at line 119 of file diff.c.

char const* name0

Definition at line 933 of file diff.c.

char const * name1

Definition at line 933 of file diff.c.

int no_discards

Definition at line 61 of file diff.c.

FILE * out

Definition at line 112 of file minigzip.c.

char const* pattern

Definition at line 723 of file diff.c.

int recursive [static]

Definition at line 57 of file diff.c.

char* value

Definition at line 854 of file diff.c.

Generated on Sun Oct 21 12:42:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/diff.c Source File

cvs-1.10/diff/diff.c

Go to the documentation of this file.
00001 /* GNU DIFF entry routine.
00002    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018 /* GNU DIFF was written by Mike Haertel, David Hayes,
00019    Richard Stallman, Len Tower, and Paul Eggert.  */
00020
00021 #define GDIFF_MAIN
00022 #include "diff.h"
00023 #include <signal.h>
00024 #include "getopt.h"
00025 #include "fnmatch.h"
00026
00027 #ifndef DEFAULT_WIDTH
00028 #define DEFAULT_WIDTH 130
00029 #endif
00030
00031 #ifndef GUTTER_WIDTH_MINIMUM
00032 #define GUTTER_WIDTH_MINIMUM 3
00033 #endif
00034
00035 /* diff.c has a real initialize_main function. */
00036 #ifdef initialize_main
00037 #undef initialize_main
00038 #endif
00039
00040 static char const *filetype PARAMS((struct stat const *));
00041 static char *option_list PARAMS((char **, int));
00042 static int add_exclude_file PARAMS((char const *));
00043 static int ck_atoi PARAMS((char const *, int *));
00044 static int compare_files PARAMS((char const *, char const *, char const *, char const *, int));
00045 static int specify_format PARAMS((char **, char *));
00046 static void add_exclude PARAMS((char const *));
00047 static void add_regexp PARAMS((struct regexp_list **, char const *));
00048 static void specify_style PARAMS((enum output_style));
00049 static int try_help PARAMS((char const *));
00050 static void check_output PARAMS((FILE *));
00051 static void usage PARAMS((void));
00052 static void initialize_main PARAMS((int *, char ***));
00053
00054 /* Nonzero for -r: if comparing two directories,
00055    compare their common subdirectories recursively.  */
00056
00057 static int recursive;
00058
00059 /* For debugging: don't do discard_confusing_lines.  */
00060
00061 int no_discards;
00062
00063 #if HAVE_SETMODE
00064 /* I/O mode: nonzero only if using binary input/output.  */
00065 static int binary_I_O;
00066 #endif
00067
00068 /* Return a string containing the command options with which diff was invoked.
00069    Spaces appear between what were separate ARGV-elements.
00070    There is a space at the beginning but none at the end.
00071    If there were no options, the result is an empty string.
00072
00073    Arguments: OPTIONVEC, a vector containing separate ARGV-elements, and COUNT,
00074    the length of that vector.  */
00075
00076 static char *
00077 option_list (optionvec, count)
00078      char **optionvec;  /* Was `vector', but that collides on Alliant.  */
00079      int count;
00080 {
00081   int i;
00082   size_t length = 0;
00083   char *result;
00084
00085   for (i = 0; i < count; i++)
00086     length += strlen (optionvec[i]) + 1;
00087
00088   result = xmalloc (length + 1);
00089   result[0] = 0;
00090
00091   for (i = 0; i < count; i++)
00092     {
00093       strcat (result, " ");
00094       strcat (result, optionvec[i]);
00095     }
00096
00097   return result;
00098 }
00099
00100 /* Convert STR to a positive integer, storing the result in *OUT.
00101    If STR is not a valid integer, return -1 (otherwise 0). */
00102 static int
00103 ck_atoi (str, out)
00104      char const *str;
00105      int *out;
00106 {
00107   char const *p;
00108   for (p = str; *p; p++)
00109     if (*p < '0' || *p > '9')
00110       return -1;
00111
00112   *out = atoi (optarg);
00113   return 0;
00114 }
00115
00116 /* Keep track of excluded file name patterns.  */
00117
00118 static char const **exclude;
00119 static int exclude_alloc, exclude_count;
00120
00121 int
00122 excluded_filename (f)
00123      char const *f;
00124 {
00125   int i;
00126   for (i = 0;  i < exclude_count;  i++)
00127     if (fnmatch (exclude[i], f, 0) == 0)
00128       return 1;
00129   return 0;
00130 }
00131
00132 static void
00133 add_exclude (pattern)
00134      char const *pattern;
00135 {
00136   if (exclude_alloc <= exclude_count)
00137     exclude = (char const **)
00138           (exclude_alloc == 0
00139            ? xmalloc ((exclude_alloc = 64) * sizeof (*exclude))
00140            : xrealloc (exclude, (exclude_alloc *= 2) * sizeof (*exclude)));
00141
00142   exclude[exclude_count++] = pattern;
00143 }
00144
00145 static int
00146 add_exclude_file (name)
00147      char const *name;
00148 {
00149   struct file_data f;
00150   char *p, *q, *lim;
00151
00152   f.name = optarg;
00153   f.desc = (strcmp (optarg, "-") == 0
00154         ? STDIN_FILENO
00155         : CVS_OPEN (optarg, O_RDONLY, 0));
00156   if (f.desc < 0 || fstat (f.desc, &f.stat) != 0)
00157     return -1;
00158
00159   sip (&f, 1);
00160   slurp (&f);
00161
00162   for (p = f.buffer, lim = p + f.buffered_chars;  p < lim;  p = q)
00163     {
00164       q = (char *) memchr (p, '\n', lim - p);
00165       if (!q)
00166     q = lim;
00167       *q++ = 0;
00168       add_exclude (p);
00169     }
00170
00171   return close (f.desc);
00172 }
00173
00174 /* The numbers 129- that appear in the fourth element of some entries
00175    tell the big switch in `diff_run' how to process those options.  */
00176
00177 static struct option const longopts[] =
00178 {
00179   {"ignore-blank-lines", 0, 0, 'B'},
00180   {"context", 2, 0, 'C'},
00181   {"ifdef", 1, 0, 'D'},
00182   {"show-function-line", 1, 0, 'F'},
00183   {"speed-large-files", 0, 0, 'H'},
00184   {"ignore-matching-lines", 1, 0, 'I'},
00185   {"label", 1, 0, 'L'},
00186   {"file-label", 1, 0, 'L'},    /* An alias, no longer recommended */
00187   {"new-file", 0, 0, 'N'},
00188   {"entire-new-file", 0, 0, 'N'},   /* An alias, no longer recommended */
00189   {"unidirectional-new-file", 0, 0, 'P'},
00190   {"starting-file", 1, 0, 'S'},
00191   {"initial-tab", 0, 0, 'T'},
00192   {"width", 1, 0, 'W'},
00193   {"text", 0, 0, 'a'},
00194   {"ascii", 0, 0, 'a'},     /* An alias, no longer recommended */
00195   {"ignore-space-change", 0, 0, 'b'},
00196   {"minimal", 0, 0, 'd'},
00197   {"ed", 0, 0, 'e'},
00198   {"forward-ed", 0, 0, 'f'},
00199   {"ignore-case", 0, 0, 'i'},
00200   {"paginate", 0, 0, 'l'},
00201   {"print", 0, 0, 'l'},     /* An alias, no longer recommended */
00202   {"rcs", 0, 0, 'n'},
00203   {"show-c-function", 0, 0, 'p'},
00204   {"brief", 0, 0, 'q'},
00205   {"recursive", 0, 0, 'r'},
00206   {"report-identical-files", 0, 0, 's'},
00207   {"expand-tabs", 0, 0, 't'},
00208   {"version", 0, 0, 'v'},
00209   {"ignore-all-space", 0, 0, 'w'},
00210   {"exclude", 1, 0, 'x'},
00211   {"exclude-from", 1, 0, 'X'},
00212   {"side-by-side", 0, 0, 'y'},
00213   {"unified", 2, 0, 'U'},
00214   {"left-column", 0, 0, 129},
00215   {"suppress-common-lines", 0, 0, 130},
00216   {"sdiff-merge-assist", 0, 0, 131},
00217   {"old-line-format", 1, 0, 132},
00218   {"new-line-format", 1, 0, 133},
00219   {"unchanged-line-format", 1, 0, 134},
00220   {"line-format", 1, 0, 135},
00221   {"old-group-format", 1, 0, 136},
00222   {"new-group-format", 1, 0, 137},
00223   {"unchanged-group-format", 1, 0, 138},
00224   {"changed-group-format", 1, 0, 139},
00225   {"horizon-lines", 1, 0, 140},
00226   {"help", 0, 0, 141},
00227   {"binary", 0, 0, 142},
00228   {0, 0, 0, 0}
00229 };
00230
00231 int
00232 diff_run (argc, argv, out, callbacks_arg)
00233      int argc;
00234      char *argv[];
00235      char *out;
00236      const struct diff_callbacks *callbacks_arg;
00237 {
00238   int val;
00239   int c;
00240   int prev = -1;
00241   int width = DEFAULT_WIDTH;
00242   int show_c_function = 0;
00243   int optind_old;
00244   int opened_file = 0;
00245
00246   callbacks = callbacks_arg;
00247
00248   /* Do our initializations.  */
00249   initialize_main (&argc, &argv);
00250   optind_old = optind;
00251   optind = 0;
00252
00253   /* Set the jump buffer, so that diff may abort execution without
00254      terminating the process. */
00255   val = setjmp (diff_abort_buf);
00256   if (val != 0)
00257     {
00258       optind = optind_old;
00259       if (opened_file)
00260     fclose (outfile);
00261       return val;
00262     }
00263
00264   /* Decode the options.  */
00265   while ((c = getopt_long (argc, argv,
00266                "0123456789abBcC:dD:efF:hHiI:lL:nNpPqrsS:tTuU:vwW:x:X:y",
00267                longopts, 0)) != EOF)
00268     {
00269       switch (c)
00270     {
00271       /* All digits combine in decimal to specify the context-size.  */
00272     case '1':
00273     case '2':
00274     case '3':
00275     case '4':
00276     case '5':
00277     case '6':
00278     case '7':
00279     case '8':
00280     case '9':
00281     case '0':
00282       if (context == -1)
00283         context = 0;
00284       /* If a context length has already been specified,
00285          more digits allowed only if they follow right after the others.
00286          Reject two separate runs of digits, or digits after -C.  */
00287       else if (prev < '0' || prev > '9')
00288         fatal ("context length specified twice");
00289
00290       context = context * 10 + c - '0';
00291       break;
00292
00293     case 'a':
00294       /* Treat all files as text files; never treat as binary.  */
00295       always_text_flag = 1;
00296       break;
00297
00298     case 'b':
00299       /* Ignore changes in amount of white space.  */
00300       ignore_space_change_flag = 1;
00301       ignore_some_changes = 1;
00302       ignore_some_line_changes = 1;
00303       break;
00304
00305     case 'B':
00306       /* Ignore changes affecting only blank lines.  */
00307       ignore_blank_lines_flag = 1;
00308       ignore_some_changes = 1;
00309       break;
00310
00311     case 'C':       /* +context[=lines] */
00312     case 'U':       /* +unified[=lines] */
00313       if (optarg)
00314         {
00315           if (context >= 0)
00316         fatal ("context length specified twice");
00317
00318           if (ck_atoi (optarg, &context))
00319         fatal ("invalid context length argument");
00320         }
00321
00322       /* Falls through.  */
00323     case 'c':
00324       /* Make context-style output.  */
00325       specify_style (c == 'U' ? OUTPUT_UNIFIED : OUTPUT_CONTEXT);
00326       break;
00327
00328     case 'd':
00329       /* Don't discard lines.  This makes things slower (sometimes much
00330          slower) but will find a guaranteed minimal set of changes.  */
00331       no_discards = 1;
00332       break;
00333
00334     case 'D':
00335       /* Make merged #ifdef output.  */
00336       specify_style (OUTPUT_IFDEF);
00337       {
00338         int i, err = 0;
00339         static char const C_ifdef_group_formats[] =
00340           "#ifndef %s\n%%<#endif /* not %s */\n%c#ifdef %s\n%%>#endif /* %s */\n%c%%=%c#ifndef %s\n%%<#else /* %s */\n%%>#endif /* %s */\n";
00341         char *b = xmalloc (sizeof (C_ifdef_group_formats)
00342                    + 7 * strlen(optarg) - 14 /* 7*"%s" */
00343                    - 8 /* 5*"%%" + 3*"%c" */);
00344         sprintf (b, C_ifdef_group_formats,
00345              optarg, optarg, 0,
00346              optarg, optarg, 0, 0,
00347              optarg, optarg, optarg);
00348         for (i = 0; i < 4; i++)
00349           {
00350         err |= specify_format (&group_format[i], b);
00351         b += strlen (b) + 1;
00352           }
00353         if (err)
00354           diff_error ("conflicting #ifdef formats", 0, 0);
00355       }
00356       break;
00357
00358     case 'e':
00359       /* Make output that is a valid `ed' script.  */
00360       specify_style (OUTPUT_ED);
00361       break;
00362
00363     case 'f':
00364       /* Make output that looks vaguely like an `ed' script
00365          but has changes in the order they appear in the file.  */
00366       specify_style (OUTPUT_FORWARD_ED);
00367       break;
00368
00369     case 'F':
00370       /* Show, for each set of changes, the previous line that
00371          matches the specified regexp.  Currently affects only
00372          context-style output.  */
00373       add_regexp (&function_regexp_list, optarg);
00374       break;
00375
00376     case 'h':
00377       /* Split the files into chunks of around 1500 lines
00378          for faster processing.  Usually does not change the result.
00379
00380          This currently has no effect.  */
00381       break;
00382
00383     case 'H':
00384       /* Turn on heuristics that speed processing of large files
00385          with a small density of changes.  */
00386       heuristic = 1;
00387       break;
00388
00389     case 'i':
00390       /* Ignore changes in case.  */
00391       ignore_case_flag = 1;
00392       ignore_some_changes = 1;
00393       ignore_some_line_changes = 1;
00394       break;
00395
00396     case 'I':
00397       /* Ignore changes affecting only lines that match the
00398          specified regexp.  */
00399       add_regexp (&ignore_regexp_list, optarg);
00400       ignore_some_changes = 1;
00401       break;
00402
00403     case 'l':
00404       /* Pass the output through `pr' to paginate it.  */
00405       paginate_flag = 1;
00406 #if !defined(SIGCHLD) && defined(SIGCLD)
00407 #define SIGCHLD SIGCLD
00408 #endif
00409 #ifdef SIGCHLD
00410       /* Pagination requires forking and waiting, and
00411          System V fork+wait does not work if SIGCHLD is ignored.  */
00412       signal (SIGCHLD, SIG_DFL);
00413 #endif
00414       break;
00415
00416     case 'L':
00417       /* Specify file labels for `-c' output headers.  */
00418       if (!file_label[0])
00419         file_label[0] = optarg;
00420       else if (!file_label[1])
00421         file_label[1] = optarg;
00422       else
00423         fatal ("too many file label options");
00424       break;
00425
00426     case 'n':
00427       /* Output RCS-style diffs, like `-f' except that each command
00428          specifies the number of lines affected.  */
00429       specify_style (OUTPUT_RCS);
00430       break;
00431
00432     case 'N':
00433       /* When comparing directories, if a file appears only in one
00434          directory, treat it as present but empty in the other.  */
00435       entire_new_file_flag = 1;
00436       break;
00437
00438     case 'p':
00439       /* Make context-style output and show name of last C function.  */
00440       show_c_function = 1;
00441       add_regexp (&function_regexp_list, "^[_a-zA-Z$]");
00442       break;
00443
00444     case 'P':
00445       /* When comparing directories, if a file appears only in
00446          the second directory of the two,
00447          treat it as present but empty in the other.  */
00448       unidirectional_new_file_flag = 1;
00449       break;
00450
00451     case 'q':
00452       no_details_flag = 1;
00453       break;
00454
00455     case 'r':
00456       /* When comparing directories,
00457          recursively compare any subdirectories found.  */
00458       recursive = 1;
00459       break;
00460
00461     case 's':
00462       /* Print a message if the files are the same.  */
00463       print_file_same_flag = 1;
00464       break;
00465
00466     case 'S':
00467       /* When comparing directories, start with the specified
00468          file name.  This is used for resuming an aborted comparison.  */
00469       dir_start_file = optarg;
00470       break;
00471
00472     case 't':
00473       /* Expand tabs to spaces in the output so that it preserves
00474          the alignment of the input files.  */
00475       tab_expand_flag = 1;
00476       break;
00477
00478     case 'T':
00479       /* Use a tab in the output, rather than a space, before the
00480          text of an input line, so as to keep the proper alignment
00481          in the input line without changing the characters in it.  */
00482       tab_align_flag = 1;
00483       break;
00484
00485     case 'u':
00486       /* Output the context diff in unidiff format.  */
00487       specify_style (OUTPUT_UNIFIED);
00488       break;
00489
00490     case 'v':
00491       if (callbacks && callbacks->write_stdout)
00492         {
00493           (*callbacks->write_stdout) ("diff - GNU diffutils version ");
00494           (*callbacks->write_stdout) (diff_version_string);
00495           (*callbacks->write_stdout) ("\n");
00496         }
00497       else
00498         printf ("diff - GNU diffutils version %s\n", diff_version_string);
00499       return 0;
00500
00501     case 'w':
00502       /* Ignore horizontal white space when comparing lines.  */
00503       ignore_all_space_flag = 1;
00504       ignore_some_changes = 1;
00505       ignore_some_line_changes = 1;
00506       break;
00507
00508     case 'x':
00509       add_exclude (optarg);
00510       break;
00511
00512     case 'X':
00513       if (add_exclude_file (optarg) != 0)
00514         pfatal_with_name (optarg);
00515       break;
00516
00517     case 'y':
00518       /* Use side-by-side (sdiff-style) columnar output. */
00519       specify_style (OUTPUT_SDIFF);
00520       break;
00521
00522     case 'W':
00523       /* Set the line width for OUTPUT_SDIFF.  */
00524       if (ck_atoi (optarg, &width) || width <= 0)
00525         fatal ("column width must be a positive integer");
00526       break;
00527
00528     case 129:
00529       sdiff_left_only = 1;
00530       break;
00531
00532     case 130:
00533       sdiff_skip_common_lines = 1;
00534       break;
00535
00536     case 131:
00537       /* sdiff-style columns output. */
00538       specify_style (OUTPUT_SDIFF);
00539       sdiff_help_sdiff = 1;
00540       break;
00541
00542     case 132:
00543     case 133:
00544     case 134:
00545       specify_style (OUTPUT_IFDEF);
00546       if (specify_format (&line_format[c - 132], optarg) != 0)
00547         diff_error ("conflicting line format", 0, 0);
00548       break;
00549
00550     case 135:
00551       specify_style (OUTPUT_IFDEF);
00552       {
00553         int i, err = 0;
00554         for (i = 0; i < sizeof (line_format) / sizeof (*line_format); i++)
00555           err |= specify_format (&line_format[i], optarg);
00556         if (err)
00557           diff_error ("conflicting line format", 0, 0);
00558       }
00559       break;
00560
00561     case 136:
00562     case 137:
00563     case 138:
00564     case 139:
00565       specify_style (OUTPUT_IFDEF);
00566       if (specify_format (&group_format[c - 136], optarg) != 0)
00567         diff_error ("conflicting group format", 0, 0);
00568       break;
00569
00570     case 140:
00571       if (ck_atoi (optarg, &horizon_lines) || horizon_lines < 0)
00572         fatal ("horizon must be a nonnegative integer");
00573       break;
00574
00575     case 141:
00576       usage ();
00577       if (! callbacks || ! callbacks->write_stdout)
00578         check_output (stdout);
00579       return 0;
00580
00581     case 142:
00582       /* Use binary I/O when reading and writing data.
00583          On Posix hosts, this has no effect.  */
00584 #if HAVE_SETMODE
00585       binary_I_O = 1;
00586 #  if 0
00587       /* Because this code is leftover from pre-library days,
00588          there is no way to set stdout back to the default mode
00589          when we are done.  As it turns out, I think the only
00590          parts of CVS that pass out == NULL, and thus cause diff
00591          to write to stdout, are "cvs diff" and "cvs rdiff".  So
00592          I'm not going to worry about this too much yet.  */
00593       setmode (STDOUT_FILENO, O_BINARY);
00594 #  else
00595       if (out == NULL)
00596         error (0, 0, "warning: did not set stdout to binary mode");
00597 #  endif
00598 #endif
00599       break;
00600
00601     default:
00602       return try_help (0);
00603     }
00604       prev = c;
00605     }
00606
00607   if (argc - optind != 2)
00608     return try_help (argc - optind < 2 ? "missing operand" : "extra operand");
00609
00610   {
00611     /*
00612      *  We maximize first the half line width, and then the gutter width,
00613      *  according to the following constraints:
00614      *  1.  Two half lines plus a gutter must fit in a line.
00615      *  2.  If the half line width is nonzero:
00616      *      a.  The gutter width is at least GUTTER_WIDTH_MINIMUM.
00617      *      b.  If tabs are not expanded to spaces,
00618      *      a half line plus a gutter is an integral number of tabs,
00619      *      so that tabs in the right column line up.
00620      */
00621     int t = tab_expand_flag ? 1 : TAB_WIDTH;
00622     int off = (width + t + GUTTER_WIDTH_MINIMUM) / (2*t)  *  t;
00623     sdiff_half_width = max (0, min (off - GUTTER_WIDTH_MINIMUM, width - off)),
00624     sdiff_column2_offset = sdiff_half_width ? off : width;
00625   }
00626
00627   if (show_c_function && output_style != OUTPUT_UNIFIED)
00628     specify_style (OUTPUT_CONTEXT);
00629
00630   if (output_style != OUTPUT_CONTEXT && output_style != OUTPUT_UNIFIED)
00631     context = 0;
00632   else if (context == -1)
00633     /* Default amount of context for -c.  */
00634     context = 3;
00635
00636   if (output_style == OUTPUT_IFDEF)
00637     {
00638       /* Format arrays are char *, not char const *,
00639      because integer formats are temporarily modified.
00640      But it is safe to assign a constant like "%=" to a format array,
00641      since "%=" does not format any integers.  */
00642       int i;
00643       for (i = 0; i < sizeof (line_format) / sizeof (*line_format); i++)
00644     if (!line_format[i])
00645       line_format[i] = "%l\n";
00646       if (!group_format[OLD])
00647     group_format[OLD]
00648       = group_format[UNCHANGED] ? group_format[UNCHANGED] : "%<";
00649       if (!group_format[NEW])
00650     group_format[NEW]
00651       = group_format[UNCHANGED] ? group_format[UNCHANGED] : "%>";
00652       if (!group_format[UNCHANGED])
00653     group_format[UNCHANGED] = "%=";
00654       if (!group_format[CHANGED])
00655     group_format[CHANGED] = concat (group_format[OLD],
00656                     group_format[NEW], "");
00657     }
00658
00659   no_diff_means_no_output =
00660     (output_style == OUTPUT_IFDEF ?
00661       (!*group_format[UNCHANGED]
00662        || (strcmp (group_format[UNCHANGED], "%=") == 0
00663        && !*line_format[UNCHANGED]))
00664      : output_style == OUTPUT_SDIFF ? sdiff_skip_common_lines : 1);
00665
00666   switch_string = option_list (argv + 1, optind - 1);
00667
00668   if (callbacks && callbacks->write_output)
00669     {
00670       if (out != NULL)
00671     {
00672       diff_error ("write callback with output file", 0, 0);
00673       return 2;
00674     }
00675     }
00676   else
00677     {
00678       if (out == NULL)
00679     outfile = stdout;
00680       else
00681     {
00682 #if HAVE_SETMODE
00683       /* A diff which is full of ^Z and such isn't going to work
00684          very well in text mode.  */
00685       if (binary_I_O)
00686         outfile = fopen (out, "wb");
00687       else
00688 #endif
00689         outfile = fopen (out, "w");
00690       if (outfile == NULL)
00691         {
00692           perror_with_name ("could not open output file");
00693           return 2;
00694         }
00695       opened_file = 1;
00696     }
00697     }
00698
00699   val = compare_files (0, argv[optind], 0, argv[optind + 1], 0);
00700
00701   /* Print any messages that were saved up for last.  */
00702   print_message_queue ();
00703
00704   free (switch_string);
00705
00706   optind = optind_old;
00707
00708   if (! callbacks || ! callbacks->write_output)
00709     check_output (outfile);
00710
00711   if (opened_file)
00712     if (fclose (outfile) != 0)
00713     perror_with_name ("close error on output file");
00714
00715   return val;
00716 }
00717
00718 /* Add the compiled form of regexp PATTERN to REGLIST.  */
00719
00720 static void
00721 add_regexp (reglist, pattern)
00722      struct regexp_list **reglist;
00723      char const *pattern;
00724 {
00725   struct regexp_list *r;
00726   char const *m;
00727
00728   r = (struct regexp_list *) xmalloc (sizeof (*r));
00729   bzero (r, sizeof (*r));
00730   r->buf.fastmap = xmalloc (256);
00731   m = re_compile_pattern (pattern, strlen (pattern), &r->buf);
00732   if (m != 0)
00733     diff_error ("%s: %s", pattern, m);
00734
00735   /* Add to the start of the list, since it's easier than the end.  */
00736   r->next = *reglist;
00737   *reglist = r;
00738 }
00739
00740 static int
00741 try_help (reason)
00742      char const *reason;
00743 {
00744   if (reason)
00745     diff_error ("%s", reason, 0);
00746   diff_error ("Try `%s --help' for more information.", diff_program_name, 0);
00747   return 2;
00748 }
00749
00750 static void
00751 check_output (file)
00752     FILE *file;
00753 {
00754   if (ferror (file) || fflush (file) != 0)
00755     fatal ("write error");
00756 }
00757
00758 static char const * const option_help[] = {
00759 "-i  --ignore-case  Consider upper- and lower-case to be the same.",
00760 "-w  --ignore-all-space  Ignore all white space.",
00761 "-b  --ignore-space-change  Ignore changes in the amount of white space.",
00762 "-B  --ignore-blank-lines  Ignore changes whose lines are all blank.",
00763 "-I RE  --ignore-matching-lines=RE  Ignore changes whose lines all match RE.",
00764 #if HAVE_SETMODE
00765 "--binary  Read and write data in binary mode.",
00766 #endif
00767 "-a  --text  Treat all files as text.\n",
00768 "-c  -C NUM  --context[=NUM]  Output NUM (default 2) lines of copied context.",
00769 "-u  -U NUM  --unified[=NUM]  Output NUM (default 2) lines of unified context.",
00770 "  -NUM  Use NUM context lines.",
00771 "  -L LABEL  --label LABEL  Use LABEL instead of file name.",
00772 "  -p  --show-c-function  Show which C function each change is in.",
00773 "  -F RE  --show-function-line=RE  Show the most recent line matching RE.",
00774 "-q  --brief  Output only whether files differ.",
00775 "-e  --ed  Output an ed script.",
00776 "-n  --rcs  Output an RCS format diff.",
00777 "-y  --side-by-side  Output in two columns.",
00778 "  -w NUM  --width=NUM  Output at most NUM (default 130) characters per line.",
00779 "  --left-column  Output only the left column of common lines.",
00780 "  --suppress-common-lines  Do not output common lines.",
00781 "-DNAME  --ifdef=NAME  Output merged file to show `#ifdef NAME' diffs.",
00782 "--GTYPE-group-format=GFMT  Similar, but format GTYPE input groups with GFMT.",
00783 "--line-format=LFMT  Similar, but format all input lines with LFMT.",
00784 "--LTYPE-line-format=LFMT  Similar, but format LTYPE input lines with LFMT.",
00785 "  LTYPE is `old', `new', or `unchanged'.  GTYPE is LTYPE or `changed'.",
00786 "  GFMT may contain:",
00787 "    %<  lines from FILE1",
00788 "    %>  lines from FILE2",
00789 "    %=  lines common to FILE1 and FILE2",
00790 "    %[-][WIDTH][.[PREC]]{doxX}LETTER  printf-style spec for LETTER",
00791 "      LETTERs are as follows for new group, lower case for old group:",
00792 "        F  first line number",
00793 "        L  last line number",
00794 "        N  number of lines = L-F+1",
00795 "        E  F-1",
00796 "        M  L+1",
00797 "  LFMT may contain:",
00798 "    %L  contents of line",
00799 "    %l  contents of line, excluding any trailing newline",
00800 "    %[-][WIDTH][.[PREC]]{doxX}n  printf-style spec for input line number",
00801 "  Either GFMT or LFMT may contain:",
00802 "    %%  %",
00803 "    %c'C'  the single character C",
00804 "    %c'\\OOO'  the character with octal code OOO\n",
00805 "-l  --paginate  Pass the output through `pr' to paginate it.",
00806 "-t  --expand-tabs  Expand tabs to spaces in output.",
00807 "-T  --initial-tab  Make tabs line up by prepending a tab.\n",
00808 "-r  --recursive  Recursively compare any subdirectories found.",
00809 "-N  --new-file  Treat absent files as empty.",
00810 "-P  --unidirectional-new-file  Treat absent first files as empty.",
00811 "-s  --report-identical-files  Report when two files are the same.",
00812 "-x PAT  --exclude=PAT  Exclude files that match PAT.",
00813 "-X FILE  --exclude-from=FILE  Exclude files that match any pattern in FILE.",
00814 "-S FILE  --starting-file=FILE  Start with FILE when comparing directories.\n",
00815 "--horizon-lines=NUM  Keep NUM lines of the common prefix and suffix.",
00816 "-d  --minimal  Try hard to find a smaller set of changes.",
00817 "-H  --speed-large-files  Assume large files and many scattered small changes.\n",
00818 "-v  --version  Output version info.",
00819 "--help  Output this help.",
00820 0
00821 };
00822
00823 static void
00824 usage ()
00825 {
00826   char const * const *p;
00827
00828   if (callbacks && callbacks->write_stdout)
00829     {
00830       (*callbacks->write_stdout) ("Usage: ");
00831       (*callbacks->write_stdout) (diff_program_name);
00832       (*callbacks->write_stdout) (" [OPTION]... FILE1 FILE2\n\n");
00833       for (p = option_help;  *p;  p++)
00834     {
00835       (*callbacks->write_stdout) ("  ");
00836       (*callbacks->write_stdout) (*p);
00837       (*callbacks->write_stdout) ("\n");
00838     }
00839       (*callbacks->write_stdout)
00840     ("\nIf FILE1 or FILE2 is `-', read standard input.\n");
00841     }
00842   else
00843     {
00844       printf ("Usage: %s [OPTION]... FILE1 FILE2\n\n", diff_program_name);
00845       for (p = option_help;  *p;  p++)
00846     printf ("  %s\n", *p);
00847       printf ("\nIf FILE1 or FILE2 is `-', read standard input.\n");
00848     }
00849 }
00850
00851 static int
00852 specify_format (var, value)
00853      char **var;
00854      char *value;
00855 {
00856   int err = *var ? strcmp (*var, value) : 0;
00857   *var = value;
00858   return err;
00859 }
00860
00861 static void
00862 specify_style (style)
00863      enum output_style style;
00864 {
00865   if (output_style != OUTPUT_NORMAL
00866       && output_style != style)
00867     diff_error ("conflicting specifications of output style", 0, 0);
00868   output_style = style;
00869 }
00870
00871 static char const *
00872 filetype (st)
00873      struct stat const *st;
00874 {
00875   /* See Posix.2 section 4.17.6.1.1 and Table 5-1 for these formats.
00876      To keep diagnostics grammatical, the returned string must start
00877      with a consonant.  */
00878
00879   if (S_ISREG (st->st_mode))
00880     {
00881       if (st->st_size == 0)
00882     return "regular empty file";
00883       /* Posix.2 section 5.14.2 seems to suggest that we must read the file
00884      and guess whether it's C, Fortran, etc., but this is somewhat useless
00885      and doesn't reflect historical practice.  We're allowed to guess
00886      wrong, so we don't bother to read the file.  */
00887       return "regular file";
00888     }
00889   if (S_ISDIR (st->st_mode)) return "directory";
00890
00891   /* other Posix.1 file types */
00892 #ifdef S_ISBLK
00893   if (S_ISBLK (st->st_mode)) return "block special file";
00894 #endif
00895 #ifdef S_ISCHR
00896   if (S_ISCHR (st->st_mode)) return "character special file";
00897 #endif
00898 #ifdef S_ISFIFO
00899   if (S_ISFIFO (st->st_mode)) return "fifo";
00900 #endif
00901
00902   /* other Posix.1b file types */
00903 #ifdef S_TYPEISMQ
00904   if (S_TYPEISMQ (st)) return "message queue";
00905 #endif
00906 #ifdef S_TYPEISSEM
00907   if (S_TYPEISSEM (st)) return "semaphore";
00908 #endif
00909 #ifdef S_TYPEISSHM
00910   if (S_TYPEISSHM (st)) return "shared memory object";
00911 #endif
00912
00913   /* other popular file types */
00914   /* S_ISLNK is impossible with `fstat' and `stat'.  */
00915 #ifdef S_ISSOCK
00916   if (S_ISSOCK (st->st_mode)) return "socket";
00917 #endif
00918
00919   return "weird file";
00920 }
00921
00922 /* Compare two files (or dirs) with specified names
00923    DIR0/NAME0 and DIR1/NAME1, at level DEPTH in directory recursion.
00924    (if DIR0 is 0, then the name is just NAME0, etc.)
00925    This is self-contained; it opens the files and closes them.
00926
00927    Value is 0 if files are the same, 1 if different,
00928    2 if there is a problem opening them.  */
00929
00930 static int
00931 compare_files (dir0, name0, dir1, name1, depth)
00932      char const *dir0, *dir1;
00933      char const *name0, *name1;
00934      int depth;
00935 {
00936   struct file_data inf[2];
00937   register int i;
00938   int val;
00939   int same_files;
00940   int failed = 0;
00941   char *free0 = 0, *free1 = 0;
00942
00943   /* If this is directory comparison, perhaps we have a file
00944      that exists only in one of the directories.
00945      If so, just print a message to that effect.  */
00946
00947   if (! ((name0 != 0 && name1 != 0)
00948      || (unidirectional_new_file_flag && name1 != 0)
00949      || entire_new_file_flag))
00950     {
00951       char const *name = name0 == 0 ? name1 : name0;
00952       char const *dir = name0 == 0 ? dir1 : dir0;
00953       message ("Only in %s: %s\n", dir, name);
00954       /* Return 1 so that diff_dirs will return 1 ("some files differ").  */
00955       return 1;
00956     }
00957
00958   bzero (inf, sizeof (inf));
00959
00960   /* Mark any nonexistent file with -1 in the desc field.  */
00961   /* Mark unopened files (e.g. directories) with -2. */
00962
00963   inf[0].desc = name0 == 0 ? -1 : -2;
00964   inf[1].desc = name1 == 0 ? -1 : -2;
00965
00966   /* Now record the full name of each file, including nonexistent ones.  */
00967
00968   if (name0 == 0)
00969     name0 = name1;
00970   if (name1 == 0)
00971     name1 = name0;
00972
00973   inf[0].name = dir0 == 0 ? name0 : (free0 = dir_file_pathname (dir0, name0));
00974   inf[1].name = dir1 == 0 ? name1 : (free1 = dir_file_pathname (dir1, name1));
00975
00976   /* Stat the files.  Record whether they are directories.  */
00977
00978   for (i = 0; i <= 1; i++)
00979     {
00980       if (inf[i].desc != -1)
00981     {
00982       int stat_result;
00983
00984       if (i && filename_cmp (inf[i].name, inf[0].name) == 0)
00985         {
00986           inf[i].stat = inf[0].stat;
00987           stat_result = 0;
00988         }
00989       else if (strcmp (inf[i].name, "-") == 0)
00990         {
00991           inf[i].desc = STDIN_FILENO;
00992           stat_result = fstat (STDIN_FILENO, &inf[i].stat);
00993           if (stat_result == 0 && S_ISREG (inf[i].stat.st_mode))
00994         {
00995           off_t pos = lseek (STDIN_FILENO, (off_t) 0, SEEK_CUR);
00996           if (pos == -1)
00997             stat_result = -1;
00998           else
00999             {
01000               if (pos <= inf[i].stat.st_size)
01001             inf[i].stat.st_size -= pos;
01002               else
01003             inf[i].stat.st_size = 0;
01004               /* Posix.2 4.17.6.1.4 requires current time for stdin.  */
01005               time (&inf[i].stat.st_mtime);
01006             }
01007         }
01008         }
01009       else
01010         stat_result = stat (inf[i].name, &inf[i].stat);
01011
01012       if (stat_result != 0)
01013         {
01014           perror_with_name (inf[i].name);
01015           failed = 1;
01016         }
01017       else
01018         {
01019           inf[i].dir_p = S_ISDIR (inf[i].stat.st_mode) && inf[i].desc != 0;
01020           if (inf[1 - i].desc == -1)
01021         {
01022           inf[1 - i].dir_p = inf[i].dir_p;
01023           inf[1 - i].stat.st_mode = inf[i].stat.st_mode;
01024         }
01025         }
01026     }
01027     }
01028
01029   if (! failed && depth == 0 && inf[0].dir_p != inf[1].dir_p)
01030     {
01031       /* If one is a directory, and it was specified in the command line,
01032      use the file in that dir with the other file's basename.  */
01033
01034       int fnm_arg = inf[0].dir_p;
01035       int dir_arg = 1 - fnm_arg;
01036       char const *fnm = inf[fnm_arg].name;
01037       char const *dir = inf[dir_arg].name;
01038       char const *p = filename_lastdirchar (fnm);
01039       char const *filename = inf[dir_arg].name
01040     = dir_file_pathname (dir, p ? p + 1 : fnm);
01041
01042       if (strcmp (fnm, "-") == 0)
01043     fatal ("can't compare - to a directory");
01044
01045       if (stat (filename, &inf[dir_arg].stat) != 0)
01046     {
01047       perror_with_name (filename);
01048       failed = 1;
01049     }
01050       else
01051     inf[dir_arg].dir_p = S_ISDIR (inf[dir_arg].stat.st_mode);
01052     }
01053
01054   if (failed)
01055     {
01056
01057       /* If either file should exist but does not, return 2.  */
01058
01059       val = 2;
01060
01061     }
01062   else if ((same_files = inf[0].desc != -1 && inf[1].desc != -1
01063              && 0 < same_file (&inf[0].stat, &inf[1].stat))
01064        && no_diff_means_no_output)
01065     {
01066       /* The two named files are actually the same physical file.
01067      We know they are identical without actually reading them.  */
01068
01069       val = 0;
01070     }
01071   else if (inf[0].dir_p & inf[1].dir_p)
01072     {
01073       if (output_style == OUTPUT_IFDEF)
01074     fatal ("-D option not supported with directories");
01075
01076       /* If both are directories, compare the files in them.  */
01077
01078       if (depth > 0 && !recursive)
01079     {
01080       /* But don't compare dir contents one level down
01081          unless -r was specified.  */
01082       message ("Common subdirectories: %s and %s\n",
01083            inf[0].name, inf[1].name);
01084       val = 0;
01085     }
01086       else
01087     {
01088       val = diff_dirs (inf, compare_files, depth);
01089     }
01090
01091     }
01092   else if ((inf[0].dir_p | inf[1].dir_p)
01093        || (depth > 0
01094            && (! S_ISREG (inf[0].stat.st_mode)
01095            || ! S_ISREG (inf[1].stat.st_mode))))
01096     {
01097       /* Perhaps we have a subdirectory that exists only in one directory.
01098      If so, just print a message to that effect.  */
01099
01100       if (inf[0].desc == -1 || inf[1].desc == -1)
01101     {
01102       if ((inf[0].dir_p | inf[1].dir_p)
01103           && recursive
01104           && (entire_new_file_flag
01105           || (unidirectional_new_file_flag && inf[0].desc == -1)))
01106         val = diff_dirs (inf, compare_files, depth);
01107       else
01108         {
01109           char const *dir = (inf[0].desc == -1) ? dir1 : dir0;
01110           /* See Posix.2 section 4.17.6.1.1 for this format.  */
01111           message ("Only in %s: %s\n", dir, name0);
01112           val = 1;
01113         }
01114     }
01115       else
01116     {
01117       /* We have two files that are not to be compared.  */
01118
01119       /* See Posix.2 section 4.17.6.1.1 for this format.  */
01120       message5 ("File %s is a %s while file %s is a %s\n",
01121             inf[0].name, filetype (&inf[0].stat),
01122             inf[1].name, filetype (&inf[1].stat));
01123
01124       /* This is a difference.  */
01125       val = 1;
01126     }
01127     }
01128   else if ((no_details_flag & ~ignore_some_changes)
01129        && inf[0].stat.st_size != inf[1].stat.st_size
01130        && (inf[0].desc == -1 || S_ISREG (inf[0].stat.st_mode))
01131        && (inf[1].desc == -1 || S_ISREG (inf[1].stat.st_mode)))
01132     {
01133       message ("Files %s and %s differ\n", inf[0].name, inf[1].name);
01134       val = 1;
01135     }
01136   else
01137     {
01138       /* Both exist and neither is a directory.  */
01139
01140       /* Open the files and record their descriptors.  */
01141
01142       if (inf[0].desc == -2)
01143     if ((inf[0].desc = CVS_OPEN (inf[0].name, O_RDONLY, 0)) < 0)
01144       {
01145         perror_with_name (inf[0].name);
01146         failed = 1;
01147       }
01148       if (inf[1].desc == -2)
01149     {
01150       if (same_files)
01151         inf[1].desc = inf[0].desc;
01152       else if ((inf[1].desc = CVS_OPEN (inf[1].name, O_RDONLY, 0)) < 0)
01153         {
01154           perror_with_name (inf[1].name);
01155           failed = 1;
01156         }
01157     }
01158
01159 #if HAVE_SETMODE
01160       if (binary_I_O)
01161     for (i = 0; i <= 1; i++)
01162       if (0 <= inf[i].desc)
01163         setmode (inf[i].desc, O_BINARY);
01164 #endif
01165
01166       /* Compare the files, if no error was found.  */
01167
01168       val = failed ? 2 : diff_2_files (inf, depth);
01169
01170       /* Close the file descriptors.  */
01171
01172       if (inf[0].desc >= 0 && close (inf[0].desc) != 0)
01173     {
01174       perror_with_name (inf[0].name);
01175       val = 2;
01176     }
01177       if (inf[1].desc >= 0 && inf[0].desc != inf[1].desc
01178       && close (inf[1].desc) != 0)
01179     {
01180       perror_with_name (inf[1].name);
01181       val = 2;
01182     }
01183     }
01184
01185   /* Now the comparison has been done, if no error prevented it,
01186      and VAL is the value this function will return.  */
01187
01188   if (val == 0 && !inf[0].dir_p)
01189     {
01190       if (print_file_same_flag)
01191     message ("Files %s and %s are identical\n",
01192          inf[0].name, inf[1].name);
01193     }
01194   else
01195     flush_output ();
01196
01197   if (free0)
01198     free (free0);
01199   if (free1)
01200     free (free1);
01201
01202   return val;
01203 }
01204
01205 /* Initialize status variables and flag variables used in libdiff,
01206    to permit repeated calls to diff_run. */
01207
01208 static void
01209 initialize_main (argcp, argvp)
01210     int *argcp;
01211     char ***argvp;
01212 {
01213   /* These variables really must be reset each time diff_run is called. */
01214   output_style = OUTPUT_NORMAL;
01215   context = -1;
01216   file_label[0] = NULL;
01217   file_label[1] = NULL;
01218   diff_program_name = (*argvp)[0];
01219   outfile = NULL;
01220
01221   /* Reset these also, just for safety's sake. (If one invocation turns
01222      on ignore_case_flag, it must be turned off before diff_run is called
01223      again.  But it is possible to make many diffs before encountering
01224      such a problem. */
01225   recursive = 0;
01226   no_discards = 0;
01227 #if HAVE_SETMODE
01228   binary_I_O = 0;
01229 #endif
01230   no_diff_means_no_output = 0;
01231   always_text_flag = 0;
01232   horizon_lines = 0;
01233   ignore_space_change_flag = 0;
01234   ignore_all_space_flag = 0;
01235   ignore_blank_lines_flag = 0;
01236   ignore_some_line_changes = 0;
01237   ignore_some_changes = 0;
01238   ignore_case_flag = 0;
01239   function_regexp_list = NULL;
01240   ignore_regexp_list = NULL;
01241   no_details_flag = 0;
01242   print_file_same_flag = 0;
01243   tab_align_flag = 0;
01244   tab_expand_flag = 0;
01245   dir_start_file = NULL;
01246   entire_new_file_flag = 0;
01247   unidirectional_new_file_flag = 0;
01248   paginate_flag = 0;
01249   bzero (group_format, sizeof (group_format));
01250   bzero (line_format, sizeof (line_format));
01251   sdiff_help_sdiff = 0;
01252   sdiff_left_only = 0;
01253   sdiff_skip_common_lines = 0;
01254   sdiff_half_width = 0;
01255   sdiff_column2_offset = 0;
01256   switch_string = NULL;
01257   heuristic = 0;
01258   bzero (files, sizeof (files));
01259 }
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/diff.h Source File

cvs-1.10/diff/diff.h

Go to the documentation of this file.
00001 /* Shared definitions for GNU DIFF
00002    Copyright (C) 1988, 89, 91, 92, 93, 97, 1998 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018 #include "system.h"
00019 #include <stdio.h>
00020 #include <setjmp.h>
00021 #include "regex.h"
00022 #include "diffrun.h"
00023
00024 #define TAB_WIDTH 8
00025
00026 /* Variables for command line options */
00027
00028 #ifndef GDIFF_MAIN
00029 #define EXTERN extern
00030 #else
00031 #define EXTERN
00032 #endif
00033
00034 /* The callbacks to use for output.  */
00035 EXTERN const struct diff_callbacks *callbacks;
00036
00037 enum output_style {
00038   /* Default output style.  */
00039   OUTPUT_NORMAL,
00040   /* Output the differences with lines of context before and after (-c).  */
00041   OUTPUT_CONTEXT,
00042   /* Output the differences in a unified context diff format (-u). */
00043   OUTPUT_UNIFIED,
00044   /* Output the differences as commands suitable for `ed' (-e).  */
00045   OUTPUT_ED,
00046   /* Output the diff as a forward ed script (-f).  */
00047   OUTPUT_FORWARD_ED,
00048   /* Like -f, but output a count of changed lines in each "command" (-n). */
00049   OUTPUT_RCS,
00050   /* Output merged #ifdef'd file (-D).  */
00051   OUTPUT_IFDEF,
00052   /* Output sdiff style (-y).  */
00053   OUTPUT_SDIFF
00054 };
00055
00056 /* True for output styles that are robust,
00057    i.e. can handle a file that ends in a non-newline.  */
00058 #define ROBUST_OUTPUT_STYLE(S) ((S) != OUTPUT_ED && (S) != OUTPUT_FORWARD_ED)
00059
00060 EXTERN enum output_style output_style;
00061
00062 /* Nonzero if output cannot be generated for identical files.  */
00063 EXTERN int no_diff_means_no_output;
00064
00065 /* Number of lines of context to show in each set of diffs.
00066    This is zero when context is not to be shown.  */
00067 EXTERN int      context;
00068
00069 /* Consider all files as text files (-a).
00070    Don't interpret codes over 0177 as implying a "binary file".  */
00071 EXTERN int  always_text_flag;
00072
00073 /* Number of lines to keep in identical prefix and suffix.  */
00074 EXTERN int      horizon_lines;
00075
00076 /* Ignore changes in horizontal white space (-b).  */
00077 EXTERN int      ignore_space_change_flag;
00078
00079 /* Ignore all horizontal white space (-w).  */
00080 EXTERN int      ignore_all_space_flag;
00081
00082 /* Ignore changes that affect only blank lines (-B).  */
00083 EXTERN int      ignore_blank_lines_flag;
00084
00085 /* 1 if lines may match even if their contents do not match exactly.
00086    This depends on various options.  */
00087 EXTERN int      ignore_some_line_changes;
00088
00089 /* 1 if files may match even if their contents are not byte-for-byte identical.
00090    This depends on various options.  */
00091 EXTERN int      ignore_some_changes;
00092
00093 /* Ignore differences in case of letters (-i).  */
00094 EXTERN int      ignore_case_flag;
00095
00096 /* File labels for `-c' output headers (-L).  */
00097 EXTERN char *file_label[2];
00098
00099 struct regexp_list
00100 {
00101   struct re_pattern_buffer buf;
00102   struct regexp_list *next;
00103 };
00104
00105 /* Regexp to identify function-header lines (-F).  */
00106 EXTERN struct regexp_list *function_regexp_list;
00107
00108 /* Ignore changes that affect only lines matching this regexp (-I).  */
00109 EXTERN struct regexp_list *ignore_regexp_list;
00110
00111 /* Say only whether files differ, not how (-q).  */
00112 EXTERN int  no_details_flag;
00113
00114 /* Report files compared that match (-s).
00115    Normally nothing is output when that happens.  */
00116 EXTERN int      print_file_same_flag;
00117
00118 /* Output the differences with exactly 8 columns added to each line
00119    so that any tabs in the text line up properly (-T).  */
00120 EXTERN int  tab_align_flag;
00121
00122 /* Expand tabs in the output so the text lines up properly
00123    despite the characters added to the front of each line (-t).  */
00124 EXTERN int  tab_expand_flag;
00125
00126 /* In directory comparison, specify file to start with (-S).
00127    All file names less than this name are ignored.  */
00128 EXTERN char *dir_start_file;
00129
00130 /* If a file is new (appears in only one dir)
00131    include its entire contents (-N).
00132    Then `patch' would create the file with appropriate contents.  */
00133 EXTERN int  entire_new_file_flag;
00134
00135 /* If a file is new (appears in only the second dir)
00136    include its entire contents (-P).
00137    Then `patch' would create the file with appropriate contents.  */
00138 EXTERN int  unidirectional_new_file_flag;
00139
00140 /* Pipe each file's output through pr (-l).  */
00141 EXTERN int  paginate_flag;
00142
00143 enum line_class {
00144   /* Lines taken from just the first file.  */
00145   OLD,
00146   /* Lines taken from just the second file.  */
00147   NEW,
00148   /* Lines common to both files.  */
00149   UNCHANGED,
00150   /* A hunk containing both old and new lines (line groups only).  */
00151   CHANGED
00152 };
00153
00154 /* Line group formats for old, new, unchanged, and changed groups.  */
00155 EXTERN char *group_format[CHANGED + 1];
00156
00157 /* Line formats for old, new, and unchanged lines.  */
00158 EXTERN char *line_format[UNCHANGED + 1];
00159
00160 /* If using OUTPUT_SDIFF print extra information to help the sdiff filter. */
00161 EXTERN int sdiff_help_sdiff;
00162
00163 /* Tell OUTPUT_SDIFF to show only the left version of common lines. */
00164 EXTERN int sdiff_left_only;
00165
00166 /* Tell OUTPUT_SDIFF to not show common lines. */
00167 EXTERN int sdiff_skip_common_lines;
00168
00169 /* The half line width and column 2 offset for OUTPUT_SDIFF.  */
00170 EXTERN unsigned sdiff_half_width;
00171 EXTERN unsigned sdiff_column2_offset;
00172
00173 /* String containing all the command options diff received,
00174    with spaces between and at the beginning but none at the end.
00175    If there were no options given, this string is empty.  */
00176 EXTERN char *   switch_string;
00177
00178 /* Nonzero means use heuristics for better speed.  */
00179 EXTERN int  heuristic;
00180
00181 /* Name of program the user invoked (for error messages).  */
00182 EXTERN char *diff_program_name;
00183
00184 /* Jump buffer for nonlocal exits. */
00185 EXTERN jmp_buf diff_abort_buf;
00186 #define DIFF_ABORT(retval) longjmp(diff_abort_buf, retval)
00187
00188 /* The result of comparison is an "edit script": a chain of `struct change'.
00189    Each `struct change' represents one place where some lines are deleted
00190    and some are inserted.
00191
00192    LINE0 and LINE1 are the first affected lines in the two files (origin 0).
00193    DELETED is the number of lines deleted here from file 0.
00194    INSERTED is the number of lines inserted here in file 1.
00195
00196    If DELETED is 0 then LINE0 is the number of the line before
00197    which the insertion was done; vice versa for INSERTED and LINE1.  */
00198
00199 struct change
00200 {
00201   struct change *link;      /* Previous or next edit command  */
00202   int inserted;         /* # lines of file 1 changed here.  */
00203   int deleted;          /* # lines of file 0 changed here.  */
00204   int line0;            /* Line number of 1st deleted line.  */
00205   int line1;            /* Line number of 1st inserted line.  */
00206   char ignore;          /* Flag used in context.c */
00207 };
00208
00209 /* Structures that describe the input files.  */
00210
00211 /* Data on one input file being compared.  */
00212
00213 struct file_data {
00214     int             desc;   /* File descriptor  */
00215     char const      *name;  /* File name  */
00216     struct stat     stat;   /* File status from fstat()  */
00217     int             dir_p;  /* nonzero if file is a directory  */
00218
00219     /* Buffer in which text of file is read.  */
00220     char *      buffer;
00221     /* Allocated size of buffer.  */
00222     size_t      bufsize;
00223     /* Number of valid characters now in the buffer. */
00224     size_t      buffered_chars;
00225
00226     /* Array of pointers to lines in the file.  */
00227     char const **linbuf;
00228
00229     /* linbuf_base <= buffered_lines <= valid_lines <= alloc_lines.
00230        linebuf[linbuf_base ... buffered_lines - 1] are possibly differing.
00231        linebuf[linbuf_base ... valid_lines - 1] contain valid data.
00232        linebuf[linbuf_base ... alloc_lines - 1] are allocated.  */
00233     int linbuf_base, buffered_lines, valid_lines, alloc_lines;
00234
00235     /* Pointer to end of prefix of this file to ignore when hashing. */
00236     char const *prefix_end;
00237
00238     /* Count of lines in the prefix.
00239        There are this many lines in the file before linbuf[0].  */
00240     int prefix_lines;
00241
00242     /* Pointer to start of suffix of this file to ignore when hashing. */
00243     char const *suffix_begin;
00244
00245     /* Vector, indexed by line number, containing an equivalence code for
00246        each line.  It is this vector that is actually compared with that
00247        of another file to generate differences. */
00248     int        *equivs;
00249
00250     /* Vector, like the previous one except that
00251        the elements for discarded lines have been squeezed out.  */
00252     int        *undiscarded;
00253
00254     /* Vector mapping virtual line numbers (not counting discarded lines)
00255        to real ones (counting those lines).  Both are origin-0.  */
00256     int        *realindexes;
00257
00258     /* Total number of nondiscarded lines. */
00259     int         nondiscarded_lines;
00260
00261     /* Vector, indexed by real origin-0 line number,
00262        containing 1 for a line that is an insertion or a deletion.
00263        The results of comparison are stored here.  */
00264     char       *changed_flag;
00265
00266     /* 1 if file ends in a line with no final newline. */
00267     int         missing_newline;
00268
00269     /* 1 more than the maximum equivalence value used for this or its
00270        sibling file. */
00271     int equiv_max;
00272 };
00273
00274 /* Describe the two files currently being compared.  */
00275
00276 EXTERN struct file_data files[2];
00277
00278 /* Stdio stream to output diffs to.  */
00279
00280 EXTERN FILE *outfile;
00281
00282 /* Declare various functions.  */
00283
00284 /* analyze.c */
00285 int diff_2_files PARAMS((struct file_data[], int));
00286
00287 /* context.c */
00288 void print_context_header PARAMS((struct file_data[], int));
00289 void print_context_script PARAMS((struct change *, int));
00290
00291 /* diff.c */
00292 int excluded_filename PARAMS((char const *));
00293
00294 /* dir.c */
00295 int diff_dirs PARAMS((struct file_data const[], int (*) PARAMS((char const *, char const *, char const *, char const *, int)), int));
00296
00297 /* ed.c */
00298 void print_ed_script PARAMS((struct change *));
00299 void pr_forward_ed_script PARAMS((struct change *));
00300
00301 /* ifdef.c */
00302 void print_ifdef_script PARAMS((struct change *));
00303
00304 /* io.c */
00305 int read_files PARAMS((struct file_data[], int));
00306 int sip PARAMS((struct file_data *, int));
00307 void slurp PARAMS((struct file_data *));
00308
00309 /* normal.c */
00310 void print_normal_script PARAMS((struct change *));
00311
00312 /* rcs.c */
00313 void print_rcs_script PARAMS((struct change *));
00314
00315 /* side.c */
00316 void print_sdiff_script PARAMS((struct change *));
00317
00318 /* util.c */
00319 #ifndef CVSGUI_SHL
00320     VOID *xmalloc PARAMS((size_t));
00321     VOID *xrealloc PARAMS((VOID *, size_t));
00322 #else /* CVSGUI_SHL */
00323 #   if qCvsDebug
00324 #       define xmalloc(s) xmalloc_glue(s, __LINE__, __FILE__)
00325 #       define xrealloc(p, s) xrealloc_glue(p, s, __LINE__, __FILE__)
00326         VOID *xmalloc_glue PARAMS((size_t bytes, int line, const char *file));
00327         VOID *xrealloc_glue PARAMS((void *ptr, size_t bytes, int line, const char *file));
00328 #   else /* !qCvsDebug */
00329         VOID *xmalloc PARAMS((size_t bytes));
00330         VOID *xrealloc PARAMS((VOID *ptr, size_t bytes));
00331 #   endif /* !qCvsDebug */
00332 #endif /* CVSGUI_SHL */
00333 char *concat PARAMS((char const *, char const *, char const *));
00334 char *dir_file_pathname PARAMS((char const *, char const *));
00335 int change_letter PARAMS((int, int));
00336 int line_cmp PARAMS((char const *, char const *));
00337 int translate_line_number PARAMS((struct file_data const *, int));
00338 struct change *find_change PARAMS((struct change *));
00339 struct change *find_reverse_change PARAMS((struct change *));
00340 void analyze_hunk PARAMS((struct change *, int *, int *, int *, int *, int *, int *));
00341 void begin_output PARAMS((void));
00342 void debug_script PARAMS((struct change *));
00343 void diff_error PARAMS((char const *, char const *, char const *));
00344 void fatal PARAMS((char const *));
00345 void finish_output PARAMS((void));
00346 void write_output PARAMS((char const *, size_t));
00347 void printf_output PARAMS((char const *, ...))
00348 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)
00349      __attribute__ ((__format__ (__printf__, 1, 2)))
00350 #endif
00351      ;
00352 void flush_output PARAMS((void));
00353 void message PARAMS((char const *, char const *, char const *));
00354 void message5 PARAMS((char const *, char const *, char const *, char const *, char const *));
00355 void output_1_line PARAMS((char const *, char const *, char const *, char const *));
00356 void perror_with_name PARAMS((char const *));
00357 void pfatal_with_name PARAMS((char const *));
00358 void print_1_line PARAMS((char const *, char const * const *));
00359 void print_message_queue PARAMS((void));
00360 void print_number_range PARAMS((int, struct file_data *, int, int));
00361 void print_script PARAMS((struct change *, struct change * (*) PARAMS((struct change *)), void (*) PARAMS((struct change *))));
00362 void setup_output PARAMS((char const *, char const *, int));
00363 void translate_range PARAMS((struct file_data const *, int, int, int *, int *));
00364
00365 /* version.c */
00366 extern char const diff_version_string[];
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/diff3.c Source File

cvs-1.10/diff/diff3.c

Go to the documentation of this file.
00001 /* Three way file comparison program (diff3) for Project GNU.
00002    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013
00014    */
00015
00016 /* Written by Randy Smith */
00017 /* Librarification by Tim Pierce */
00018
00019 #ifndef CVSGUI_SHL
00020 #   include "system.h"
00021 #else /* CVSGUI_SHL */
00022 #   include "diff.h"
00023 #endif /* CVSGUI_SHL */
00024 #include <stdio.h>
00025 #include <setjmp.h>
00026 #include "getopt.h"
00027 #include "diffrun.h"
00028
00029 /* diff3.c has a real initialize_main function. */
00030 #ifdef initialize_main
00031 #undef initialize_main
00032 #endif
00033
00034 #ifdef _MSC_VER
00035 // BUG FIX on Windows at shared drives with
00036 // unwritable root directories.
00037 //
00038 // For windows, tmpnam() fails in the scenario where the
00039 // current working directory is a shared drive with
00040 // unwrittable root (a common situation for a file server)
00041 // This is because tmpnam() returns
00042 // a temporary file at this root and then diff3 wants
00043 // to write to it. Bad, bad, bad. Need to use _tempnam()
00044 // which will refer to the environment's TEMP setting.
00045 // Unfortunately, we also then have to convert to static
00046 // storage, since tmpnam returns static-ly stored string,
00047 // but _tempnam's string is malloced up.
00048
00049 char static_tempnam_storage[_MAX_PATH];
00050
00051 char* tmpnam_for_windows(char* param1)
00052 {
00053    char* ac = _tempnam(NULL,NULL);
00054    if (ac) {
00055       strncpy(static_tempnam_storage,ac,_MAX_PATH);
00056       free(ac);
00057       return static_tempnam_storage;
00058    }
00059    else return NULL;
00060 }
00061
00062 #define tmpnam(x) tmpnam_for_windows(x)
00063 #endif // WIN32 || _WIN32
00064
00065
00066
00067
00068
00069 extern char const diff_version_string[];
00070
00071 extern FILE *outfile;
00072
00073 extern const struct diff_callbacks *callbacks;
00074
00075 void write_output PARAMS((char const *, size_t));
00076 void printf_output PARAMS((char const *, ...))
00077 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)
00078      __attribute__ ((__format__ (__printf__, 1, 2)))
00079 #endif
00080      ;
00081 void flush_output PARAMS((void));
00082
00083 char * cvs_temp_name PARAMS((void));
00084
00085 /*
00086  * Internal data structures and macros for the diff3 program; includes
00087  * data structures for both diff3 diffs and normal diffs.
00088  */
00089
00090 /* Different files within a three way diff.  */
00091 #define FILE0   0
00092 #define FILE1   1
00093 #define FILE2   2
00094
00095 /*
00096  * A three way diff is built from two two-way diffs; the file which
00097  * the two two-way diffs share is:
00098  */
00099 #define FILEC   FILE2
00100
00101 /*
00102  * Different files within a two way diff.
00103  * FC is the common file, FO the other file.
00104  */
00105 #define FO 0
00106 #define FC 1
00107
00108 /* The ranges are indexed by */
00109 #define START   0
00110 #define END 1
00111
00112 enum diff_type {
00113   ERROR,            /* Should not be used */
00114   ADD,              /* Two way diff add */
00115   CHANGE,           /* Two way diff change */
00116   DELETE,           /* Two way diff delete */
00117   DIFF_ALL,         /* All three are different */
00118   DIFF_1ST,         /* Only the first is different */
00119   DIFF_2ND,         /* Only the second */
00120   DIFF_3RD          /* Only the third */
00121 };
00122
00123 /* Two way diff */
00124 struct diff_block {
00125   int ranges[2][2];     /* Ranges are inclusive */
00126   char **lines[2];      /* The actual lines (may contain nulls) */
00127   size_t *lengths[2];       /* Line lengths (including newlines, if any) */
00128   struct diff_block *next;
00129 };
00130
00131 /* Three way diff */
00132
00133 struct diff3_block {
00134   enum diff_type correspond;    /* Type of diff */
00135   int ranges[3][2];     /* Ranges are inclusive */
00136   char **lines[3];      /* The actual lines (may contain nulls) */
00137   size_t *lengths[3];       /* Line lengths (including newlines, if any) */
00138   struct diff3_block *next;
00139 };
00140
00141 /*
00142  * Access the ranges on a diff block.
00143  */
00144 #define D_LOWLINE(diff, filenum)    \
00145   ((diff)->ranges[filenum][START])
00146 #define D_HIGHLINE(diff, filenum)   \
00147   ((diff)->ranges[filenum][END])
00148 #define D_NUMLINES(diff, filenum)   \
00149   (D_HIGHLINE (diff, filenum) - D_LOWLINE (diff, filenum) + 1)
00150
00151 /*
00152  * Access the line numbers in a file in a diff by relative line
00153  * numbers (i.e. line number within the diff itself).  Note that these
00154  * are lvalues and can be used for assignment.
00155  */
00156 #define D_RELNUM(diff, filenum, linenum)    \
00157   ((diff)->lines[filenum][linenum])
00158 #define D_RELLEN(diff, filenum, linenum)    \
00159   ((diff)->lengths[filenum][linenum])
00160
00161 /*
00162  * And get at them directly, when that should be necessary.
00163  */
00164 #define D_LINEARRAY(diff, filenum)  \
00165   ((diff)->lines[filenum])
00166 #define D_LENARRAY(diff, filenum)   \
00167   ((diff)->lengths[filenum])
00168
00169 /*
00170  * Next block.
00171  */
00172 #define D_NEXT(diff)    ((diff)->next)
00173
00174 /*
00175  * Access the type of a diff3 block.
00176  */
00177 #define D3_TYPE(diff)   ((diff)->correspond)
00178
00179 /*
00180  * Line mappings based on diffs.  The first maps off the top of the
00181  * diff, the second off of the bottom.
00182  */
00183 #define D_HIGH_MAPLINE(diff, fromfile, tofile, lineno)  \
00184   ((lineno)                     \
00185    - D_HIGHLINE ((diff), (fromfile))            \
00186    + D_HIGHLINE ((diff), (tofile)))
00187
00188 #define D_LOW_MAPLINE(diff, fromfile, tofile, lineno)   \
00189   ((lineno)                     \
00190    - D_LOWLINE ((diff), (fromfile))         \
00191    + D_LOWLINE ((diff), (tofile)))
00192
00193 /*
00194  * General memory allocation function.
00195  */
00196 #define ALLOCATE(number, type)  \
00197   (type *) xmalloc ((number) * sizeof (type))
00198
00199 /* Options variables for flags set on command line.  */
00200
00201 /* If nonzero, treat all files as text files, never as binary.  */
00202 static int always_text;
00203
00204 /* If nonzero, write out an ed script instead of the standard diff3 format.  */
00205 static int edscript;
00206
00207 /* If nonzero, in the case of overlapping diffs (type DIFF_ALL),
00208    preserve the lines which would normally be deleted from
00209    file 1 with a special flagging mechanism.  */
00210 static int flagging;
00211
00212 /* Number of lines to keep in identical prefix and suffix.  */
00213 static int horizon_lines = 10;
00214
00215 /* Use a tab to align output lines (-T).  */
00216 static int tab_align_flag;
00217
00218 /* If nonzero, do not output information for overlapping diffs.  */
00219 static int simple_only;
00220
00221 /* If nonzero, do not output information for non-overlapping diffs.  */
00222 static int overlap_only;
00223
00224 /* If nonzero, show information for DIFF_2ND diffs.  */
00225 static int show_2nd;
00226
00227 /* If nonzero, include `:wq' at the end of the script
00228    to write out the file being edited.   */
00229 static int finalwrite;
00230
00231 /* If nonzero, output a merged file.  */
00232 static int merge;
00233
00234 extern char *diff_program_name;
00235
00236 static char *read_diff PARAMS((char const *, char const *, char **));
00237 static char *scan_diff_line PARAMS((char *, char **, size_t *, char *, int));
00238 static enum diff_type process_diff_control PARAMS((char **, struct diff_block *));
00239 static int compare_line_list PARAMS((char * const[], size_t const[], char * const[], size_t const[], int));
00240 static int copy_stringlist PARAMS((char * const[], size_t const[], char *[], size_t[], int));
00241 static int dotlines PARAMS((struct diff3_block *, int));
00242 static int output_diff3_edscript PARAMS((struct diff3_block *, int const[3], int const[3], char const *, char const *, char const *));
00243 static int output_diff3_merge PARAMS((FILE *, struct diff3_block *, int const[3], int const[3], char const *, char const *, char const *));
00244 static size_t myread PARAMS((int, char *, size_t));
00245 static struct diff3_block *create_diff3_block PARAMS((int, int, int, int, int, int));
00246 static struct diff3_block *make_3way_diff PARAMS((struct diff_block *, struct diff_block *));
00247 static struct diff3_block *reverse_diff3_blocklist PARAMS((struct diff3_block *));
00248 static struct diff3_block *using_to_diff3_block PARAMS((struct diff_block *[2], struct diff_block *[2], int, int, struct diff3_block const *));
00249 static struct diff_block *process_diff PARAMS((char const *, char const *, struct diff_block **, char **));
00250 static void check_output PARAMS((FILE *));
00251 static void diff3_fatal PARAMS((char const *));
00252 static void output_diff3 PARAMS((struct diff3_block *, int const[3], int const[3]));
00253 static void diff3_perror_with_exit PARAMS((char const *));
00254 static int try_help PARAMS((char const *));
00255 static void undotlines PARAMS((int, int, int));
00256 static void usage PARAMS((void));
00257 static void initialize_main PARAMS((int *, char ***));
00258 static void free_diff_blocks PARAMS((struct diff_block *));
00259 static void free_diff3_blocks PARAMS((struct diff3_block *));
00260
00261 /* Functions provided in libdiff.a or other external sources. */
00262 #ifndef CVSGUI_SHL
00263     VOID *xmalloc PARAMS((size_t));
00264     VOID *xrealloc PARAMS((VOID *, size_t));
00265 #endif /* !CVSGUI_SHL */
00266 void perror_with_name PARAMS((char const *));
00267 void diff_error PARAMS((char const *, char const *, char const *));
00268
00269 /* Permit non-local exits from diff3. */
00270 static jmp_buf diff3_abort_buf;
00271 #define DIFF3_ABORT(retval) longjmp(diff3_abort_buf, retval)
00272
00273 static struct option const longopts[] =
00274 {
00275   {"text", 0, 0, 'a'},
00276   {"show-all", 0, 0, 'A'},
00277   {"ed", 0, 0, 'e'},
00278   {"show-overlap", 0, 0, 'E'},
00279   {"label", 1, 0, 'L'},
00280   {"merge", 0, 0, 'm'},
00281   {"initial-tab", 0, 0, 'T'},
00282   {"overlap-only", 0, 0, 'x'},
00283   {"easy-only", 0, 0, '3'},
00284   {"version", 0, 0, 'v'},
00285   {"help", 0, 0, 129},
00286   {0, 0, 0, 0}
00287 };
00288
00289 /*
00290  * Main program.  Calls diff twice on two pairs of input files,
00291  * combines the two diffs, and outputs them.
00292  */
00293 int
00294 diff3_run (argc, argv, out, callbacks_arg)
00295      int argc;
00296      char **argv;
00297      char *out;
00298      const struct diff_callbacks *callbacks_arg;
00299 {
00300   int c, i;
00301   int mapping[3];
00302   int rev_mapping[3];
00303   int incompat = 0;
00304   int conflicts_found;
00305   int status;
00306   struct diff_block *thread0, *thread1, *last_block;
00307   char *content0, *content1;
00308   struct diff3_block *diff3;
00309   int tag_count = 0;
00310   char *tag_strings[3];
00311   char *commonname;
00312   char **file;
00313   struct stat statb;
00314   int optind_old;
00315   int opened_file = 0;
00316
00317   callbacks = callbacks_arg;
00318
00319   initialize_main (&argc, &argv);
00320
00321   optind_old = optind;
00322   optind = 0;
00323   while ((c = getopt_long (argc, argv, "aeimvx3AEL:TX", longopts, 0)) != EOF)
00324     {
00325       switch (c)
00326     {
00327     case 'a':
00328       always_text = 1;
00329       break;
00330     case 'A':
00331       show_2nd = 1;
00332       flagging = 1;
00333       incompat++;
00334       break;
00335     case 'x':
00336       overlap_only = 1;
00337       incompat++;
00338       break;
00339     case '3':
00340       simple_only = 1;
00341       incompat++;
00342       break;
00343     case 'i':
00344       finalwrite = 1;
00345       break;
00346     case 'm':
00347       merge = 1;
00348       break;
00349     case 'X':
00350       overlap_only = 1;
00351       /* Falls through */
00352     case 'E':
00353       flagging = 1;
00354       /* Falls through */
00355     case 'e':
00356       incompat++;
00357       break;
00358     case 'T':
00359       tab_align_flag = 1;
00360       break;
00361     case 'v':
00362       if (callbacks && callbacks->write_stdout)
00363         {
00364           (*callbacks->write_stdout) ("diff3 - GNU diffutils version ");
00365           (*callbacks->write_stdout) (diff_version_string);
00366           (*callbacks->write_stdout) ("\n");
00367         }
00368       else
00369         printf ("diff3 - GNU diffutils version %s\n", diff_version_string);
00370       return 0;
00371     case 129:
00372       usage ();
00373       if (! callbacks || ! callbacks->write_stdout)
00374         check_output (stdout);
00375       return 0;
00376     case 'L':
00377       /* Handle up to three -L options.  */
00378       if (tag_count < 3)
00379         {
00380           tag_strings[tag_count++] = optarg;
00381           break;
00382         }
00383       return try_help ("Too many labels were given.  The limit is 3.");
00384     default:
00385       return try_help (0);
00386     }
00387     }
00388
00389   edscript = incompat & ~merge;  /* -AeExX3 without -m implies ed script.  */
00390   show_2nd |= ~incompat & merge;  /* -m without -AeExX3 implies -A.  */
00391   flagging |= ~incompat & merge;
00392
00393   if (incompat > 1  /* Ensure at most one of -AeExX3.  */
00394       || finalwrite & merge /* -i -m would rewrite input file.  */
00395       || (tag_count && ! flagging)) /* -L requires one of -AEX.  */
00396     return try_help ("incompatible options");
00397
00398   if (argc - optind != 3)
00399     return try_help (argc - optind < 3 ? "missing operand" : "extra operand");
00400
00401   file = &argv[optind];
00402
00403   optind = optind_old;
00404
00405   for (i = tag_count; i < 3; i++)
00406     tag_strings[i] = file[i];
00407
00408   /* Always compare file1 to file2, even if file2 is "-".
00409      This is needed for -mAeExX3.  Using the file0 as
00410      the common file would produce wrong results, because if the
00411      file0-file1 diffs didn't line up with the file0-file2 diffs
00412      (which is entirely possible since we don't use diff's -n option),
00413      diff3 might report phantom changes from file1 to file2.  */
00414
00415   if (strcmp (file[2], "-") == 0)
00416     {
00417       /* Sigh.  We've got standard input as the last arg.  We can't
00418      call diff twice on stdin.  Use the middle arg as the common
00419      file instead.  */
00420       if (strcmp (file[0], "-") == 0 || strcmp (file[1], "-") == 0)
00421         {
00422       diff_error ("%s", "`-' specified for more than one input file", 0);
00423       return 2;
00424         }
00425       mapping[0] = 0;
00426       mapping[1] = 2;
00427       mapping[2] = 1;
00428     }
00429   else
00430     {
00431       /* Normal, what you'd expect */
00432       mapping[0] = 0;
00433       mapping[1] = 1;
00434       mapping[2] = 2;
00435     }
00436
00437   for (i = 0; i < 3; i++)
00438     rev_mapping[mapping[i]] = i;
00439
00440   for (i = 0; i < 3; i++)
00441     if (strcmp (file[i], "-") != 0)
00442       {
00443     if (stat (file[i], &statb) < 0)
00444       {
00445         perror_with_name (file[i]);
00446         return 2;
00447           }
00448     else if (S_ISDIR(statb.st_mode))
00449       {
00450         diff_error ("%s: Is a directory", file[i], 0);
00451         return 2;
00452       }
00453       }
00454
00455   if (callbacks && callbacks->write_output)
00456     {
00457       if (out != NULL)
00458     {
00459       diff_error ("write callback with output file", 0, 0);
00460       return 2;
00461     }
00462     }
00463   else
00464     {
00465       if (out == NULL)
00466     outfile = stdout;
00467       else
00468     {
00469       outfile = fopen (out, "w");
00470       if (outfile == NULL)
00471         {
00472           perror_with_name ("could not open output file");
00473           return 2;
00474         }
00475       opened_file = 1;
00476     }
00477     }
00478
00479   /* Set the jump buffer, so that diff may abort execution without
00480      terminating the process. */
00481   status = setjmp (diff3_abort_buf);
00482   if (status != 0)
00483       return status;
00484
00485   commonname = file[rev_mapping[FILEC]];
00486   thread1 = process_diff (file[rev_mapping[FILE1]], commonname, &last_block,
00487               &content1);
00488   if (thread1)
00489     for (i = 0; i < 2; i++)
00490       {
00491     horizon_lines = max (horizon_lines, D_NUMLINES (thread1, i));
00492     horizon_lines = max (horizon_lines, D_NUMLINES (last_block, i));
00493       }
00494   thread0 = process_diff (file[rev_mapping[FILE0]], commonname, &last_block,
00495               &content0);
00496   diff3 = make_3way_diff (thread0, thread1);
00497   if (edscript)
00498     conflicts_found
00499       = output_diff3_edscript (diff3, mapping, rev_mapping,
00500                    tag_strings[0], tag_strings[1], tag_strings[2]);
00501   else if (merge)
00502     {
00503       FILE *mfp = fopen (file[rev_mapping[FILE0]], "r");
00504       if (! mfp)
00505     diff3_perror_with_exit (file[rev_mapping[FILE0]]);
00506       conflicts_found = output_diff3_merge (mfp, diff3, mapping, rev_mapping,
00507                   tag_strings[0], tag_strings[1], tag_strings[2]);
00508       if (ferror (mfp))
00509     diff3_fatal ("read error");
00510       if (fclose(mfp) != 0)
00511     perror_with_name (file[rev_mapping[FILE0]]);
00512     }
00513   else
00514     {
00515       output_diff3 (diff3, mapping, rev_mapping);
00516       conflicts_found = 0;
00517     }
00518
00519   free(content0);
00520   free(content1);
00521   free_diff3_blocks(diff3);
00522
00523   if (! callbacks || ! callbacks->write_output)
00524     check_output (outfile);
00525
00526   if (opened_file)
00527     if (fclose (outfile) != 0)
00528     perror_with_name ("close error on output file");
00529
00530   return conflicts_found;
00531 }
00532
00533 static int
00534 try_help (reason)
00535      char const *reason;
00536 {
00537   if (reason)
00538     diff_error ("%s", reason, 0);
00539   diff_error ("Try `%s --help' for more information.", diff_program_name, 0);
00540   return 2;
00541 }
00542
00543 static void
00544 check_output (stream)
00545      FILE *stream;
00546 {
00547   if (ferror (stream) || fflush (stream) != 0)
00548     diff3_fatal ("write error");
00549 }
00550
00551 /*
00552  * Explain, patiently and kindly, how to use this program.
00553  */
00554 static void
00555 usage ()
00556 {
00557   if (callbacks && callbacks->write_stdout)
00558     {
00559       (*callbacks->write_stdout) ("Usage: ");
00560       (*callbacks->write_stdout) (diff_program_name);
00561       (*callbacks->write_stdout) (" [OPTION]... MYFILE OLDFILE YOURFILE\n\n");
00562
00563       (*callbacks->write_stdout) ("\
00564   -e  --ed  Output unmerged changes from OLDFILE to YOURFILE into MYFILE.\n\
00565   -E  --show-overlap  Output unmerged changes, bracketing conflicts.\n\
00566   -A  --show-all  Output all changes, bracketing conflicts.\n\
00567   -x  --overlap-only  Output overlapping changes.\n\
00568   -X  Output overlapping changes, bracketing them.\n\
00569   -3  --easy-only  Output unmerged nonoverlapping changes.\n\n");
00570       (*callbacks->write_stdout) ("\
00571   -m  --merge  Output merged file instead of ed script (default -A).\n\
00572   -L LABEL  --label=LABEL  Use LABEL instead of file name.\n\
00573   -i  Append `w' and `q' commands to ed scripts.\n\
00574   -a  --text  Treat all files as text.\n\
00575   -T  --initial-tab  Make tabs line up by prepending a tab.\n\n");
00576       (*callbacks->write_stdout) ("\
00577   -v  --version  Output version info.\n\
00578   --help  Output this help.\n\n");
00579       (*callbacks->write_stdout) ("If a FILE is `-', read standard input.\n");
00580     }
00581   else
00582     {
00583       printf ("Usage: %s [OPTION]... MYFILE OLDFILE YOURFILE\n\n", diff_program_name);
00584
00585       printf ("%s", "\
00586   -e  --ed  Output unmerged changes from OLDFILE to YOURFILE into MYFILE.\n\
00587   -E  --show-overlap  Output unmerged changes, bracketing conflicts.\n\
00588   -A  --show-all  Output all changes, bracketing conflicts.\n\
00589   -x  --overlap-only  Output overlapping changes.\n\
00590   -X  Output overlapping changes, bracketing them.\n\
00591   -3  --easy-only  Output unmerged nonoverlapping changes.\n\n");
00592       printf ("%s", "\
00593   -m  --merge  Output merged file instead of ed script (default -A).\n\
00594   -L LABEL  --label=LABEL  Use LABEL instead of file name.\n\
00595   -i  Append `w' and `q' commands to ed scripts.\n\
00596   -a  --text  Treat all files as text.\n\
00597   -T  --initial-tab  Make tabs line up by prepending a tab.\n\n");
00598       printf ("%s", "\
00599   -v  --version  Output version info.\n\
00600   --help  Output this help.\n\n");
00601       printf ("If a FILE is `-', read standard input.\n");
00602     }
00603 }
00604
00605 /*
00606  * Routines that combine the two diffs together into one.  The
00607  * algorithm used follows:
00608  *
00609  *   File2 is shared in common between the two diffs.
00610  *   Diff02 is the diff between 0 and 2.
00611  *   Diff12 is the diff between 1 and 2.
00612  *
00613  *  1) Find the range for the first block in File2.
00614  *      a) Take the lowest of the two ranges (in File2) in the two
00615  *         current blocks (one from each diff) as being the low
00616  *         water mark.  Assign the upper end of this block as
00617  *         being the high water mark and move the current block up
00618  *         one.  Mark the block just moved over as to be used.
00619  *      b) Check the next block in the diff that the high water
00620  *         mark is *not* from.
00621  *
00622  *         *If* the high water mark is above
00623  *         the low end of the range in that block,
00624  *
00625  *         mark that block as to be used and move the current
00626  *         block up.  Set the high water mark to the max of
00627  *         the high end of this block and the current.  Repeat b.
00628  *
00629  *   2) Find the corresponding ranges in File0 (from the blocks
00630  *      in diff02; line per line outside of diffs) and in File1.
00631  *      Create a diff3_block, reserving space as indicated by the ranges.
00632  *
00633  *   3) Copy all of the pointers for file2 in.  At least for now,
00634  *      do memcmp's between corresponding strings in the two diffs.
00635  *
00636  *   4) Copy all of the pointers for file0 and 1 in.  Get what you
00637  *      need from file2 (when there isn't a diff block, it's
00638  *      identical to file2 within the range between diff blocks).
00639  *
00640  *   5) If the diff blocks you used came from only one of the two
00641  *      strings of diffs, then that file (i.e. the one other than
00642  *      the common file in that diff) is the odd person out.  If you used
00643  *      diff blocks from both sets, check to see if files 0 and 1 match:
00644  *
00645  *      Same number of lines?  If so, do a set of memcmp's (if a
00646  *      memcmp matches; copy the pointer over; it'll be easier later
00647  *      if you have to do any compares).  If they match, 0 & 1 are
00648  *      the same.  If not, all three different.
00649  *
00650  *   Then you do it again, until you run out of blocks.
00651  *
00652  */
00653
00654 /*
00655  * This routine makes a three way diff (chain of diff3_block's) from two
00656  * two way diffs (chains of diff_block's).  It is assumed that each of
00657  * the two diffs passed are onto the same file (i.e. that each of the
00658  * diffs were made "to" the same file).  The three way diff pointer
00659  * returned will have numbering FILE0--the other file in diff02,
00660  * FILE1--the other file in diff12, and FILEC--the common file.
00661  */
00662 static struct diff3_block *
00663 make_3way_diff (thread0, thread1)
00664      struct diff_block *thread0, *thread1;
00665 {
00666 /*
00667  * This routine works on the two diffs passed to it as threads.
00668  * Thread number 0 is diff02, thread number 1 is diff12.  The USING
00669  * array is set to the base of the list of blocks to be used to
00670  * construct each block of the three way diff; if no blocks from a
00671  * particular thread are to be used, that element of the using array
00672  * is set to 0.  The elements LAST_USING array are set to the last
00673  * elements on each of the using lists.
00674  *
00675  * The HIGH_WATER_MARK is set to the highest line number in the common file
00676  * described in any of the diffs in either of the USING lists.  The
00677  * HIGH_WATER_THREAD names the thread.  Similarly the BASE_WATER_MARK
00678  * and BASE_WATER_THREAD describe the lowest line number in the common file
00679  * described in any of the diffs in either of the USING lists.  The
00680  * HIGH_WATER_DIFF is the diff from which the HIGH_WATER_MARK was
00681  * taken.
00682  *
00683  * The HIGH_WATER_DIFF should always be equal to LAST_USING
00684  * [HIGH_WATER_THREAD].  The OTHER_DIFF is the next diff to check for
00685  * higher water, and should always be equal to
00686  * CURRENT[HIGH_WATER_THREAD ^ 0x1].  The OTHER_THREAD is the thread
00687  * in which the OTHER_DIFF is, and hence should always be equal to
00688  * HIGH_WATER_THREAD ^ 0x1.
00689  *
00690  * The variable LAST_DIFF is kept set to the last diff block produced
00691  * by this routine, for line correspondence purposes between that diff
00692  * and the one currently being worked on.  It is initialized to
00693  * ZERO_DIFF before any blocks have been created.
00694  */
00695
00696   struct diff_block
00697     *using[2],
00698     *last_using[2],
00699     *current[2];
00700
00701   int
00702     high_water_mark;
00703
00704   int
00705     high_water_thread,
00706     base_water_thread,
00707     other_thread;
00708
00709   struct diff_block
00710     *high_water_diff,
00711     *other_diff;
00712
00713   struct diff3_block
00714     *result,
00715     *tmpblock,
00716     **result_end;
00717
00718   struct diff3_block const *last_diff3;
00719
00720   static struct diff3_block const zero_diff3 = { 0 };
00721
00722   /* Initialization */
00723   result = 0;
00724   result_end = &result;
00725   current[0] = thread0; current[1] = thread1;
00726   last_diff3 = &zero_diff3;
00727
00728   /* Sniff up the threads until we reach the end */
00729
00730   while (current[0] || current[1])
00731     {
00732       using[0] = using[1] = last_using[0] = last_using[1] = 0;
00733
00734       /* Setup low and high water threads, diffs, and marks.  */
00735       if (!current[0])
00736     base_water_thread = 1;
00737       else if (!current[1])
00738     base_water_thread = 0;
00739       else
00740     base_water_thread =
00741       (D_LOWLINE (current[0], FC) > D_LOWLINE (current[1], FC));
00742
00743       high_water_thread = base_water_thread;
00744
00745       high_water_diff = current[high_water_thread];
00746
00747 #if 0
00748       /* low and high waters start off same diff */
00749       base_water_mark = D_LOWLINE (high_water_diff, FC);
00750 #endif
00751
00752       high_water_mark = D_HIGHLINE (high_water_diff, FC);
00753
00754       /* Make the diff you just got info from into the using class */
00755       using[high_water_thread]
00756     = last_using[high_water_thread]
00757     = high_water_diff;
00758       current[high_water_thread] = high_water_diff->next;
00759       last_using[high_water_thread]->next = 0;
00760
00761       /* And mark the other diff */
00762       other_thread = high_water_thread ^ 0x1;
00763       other_diff = current[other_thread];
00764
00765       /* Shuffle up the ladder, checking the other diff to see if it
00766      needs to be incorporated.  */
00767       while (other_diff
00768          && D_LOWLINE (other_diff, FC) <= high_water_mark + 1)
00769     {
00770
00771       /* Incorporate this diff into the using list.  Note that
00772          this doesn't take it off the current list */
00773       if (using[other_thread])
00774         last_using[other_thread]->next = other_diff;
00775       else
00776         using[other_thread] = other_diff;
00777       last_using[other_thread] = other_diff;
00778
00779       /* Take it off the current list.  Note that this following
00780          code assumes that other_diff enters it equal to
00781          current[high_water_thread ^ 0x1] */
00782       current[other_thread] = current[other_thread]->next;
00783       other_diff->next = 0;
00784
00785       /* Set the high_water stuff
00786          If this comparison is equal, then this is the last pass
00787          through this loop; since diff blocks within a given
00788          thread cannot overlap, the high_water_mark will be
00789          *below* the range_start of either of the next diffs.  */
00790
00791       if (high_water_mark < D_HIGHLINE (other_diff, FC))
00792         {
00793           high_water_thread ^= 1;
00794           high_water_diff = other_diff;
00795           high_water_mark = D_HIGHLINE (other_diff, FC);
00796         }
00797
00798       /* Set the other diff */
00799       other_thread = high_water_thread ^ 0x1;
00800       other_diff = current[other_thread];
00801     }
00802
00803       /* The using lists contain a list of all of the blocks to be
00804      included in this diff3_block.  Create it.  */
00805
00806       tmpblock = using_to_diff3_block (using, last_using,
00807                        base_water_thread, high_water_thread,
00808                        last_diff3);
00809       free_diff_blocks(using[0]);
00810       free_diff_blocks(using[1]);
00811
00812       if (!tmpblock)
00813     diff3_fatal ("internal error: screwup in format of diff blocks");
00814
00815       /* Put it on the list.  */
00816       *result_end = tmpblock;
00817       result_end = &tmpblock->next;
00818
00819       /* Set up corresponding lines correctly.  */
00820       last_diff3 = tmpblock;
00821     }
00822   return result;
00823 }
00824
00825 /*
00826  * using_to_diff3_block:
00827  *   This routine takes two lists of blocks (from two separate diff
00828  * threads) and puts them together into one diff3 block.
00829  * It then returns a pointer to this diff3 block or 0 for failure.
00830  *
00831  * All arguments besides using are for the convenience of the routine;
00832  * they could be derived from the using array.
00833  * LAST_USING is a pair of pointers to the last blocks in the using
00834  * structure.
00835  * LOW_THREAD and HIGH_THREAD tell which threads contain the lowest
00836  * and highest line numbers for File0.
00837  * last_diff3 contains the last diff produced in the calling routine.
00838  * This is used for lines mappings which would still be identical to
00839  * the state that diff ended in.
00840  *
00841  * A distinction should be made in this routine between the two diffs
00842  * that are part of a normal two diff block, and the three diffs that
00843  * are part of a diff3_block.
00844  */
00845 static struct diff3_block *
00846 using_to_diff3_block (using, last_using, low_thread, high_thread, last_diff3)
00847      struct diff_block
00848        *using[2],
00849        *last_using[2];
00850      int low_thread, high_thread;
00851      struct diff3_block const *last_diff3;
00852 {
00853   int low[2], high[2];
00854   struct diff3_block *result;
00855   struct diff_block *ptr;
00856   int d, i;
00857
00858   /* Find the range in the common file.  */
00859   int lowc = D_LOWLINE (using[low_thread], FC);
00860   int highc = D_HIGHLINE (last_using[high_thread], FC);
00861
00862   /* Find the ranges in the other files.
00863      If using[d] is null, that means that the file to which that diff
00864      refers is equivalent to the common file over this range.  */
00865
00866   for (d = 0; d < 2; d++)
00867     if (using[d])
00868       {
00869     low[d] = D_LOW_MAPLINE (using[d], FC, FO, lowc);
00870     high[d] = D_HIGH_MAPLINE (last_using[d], FC, FO, highc);
00871       }
00872     else
00873       {
00874     low[d] = D_HIGH_MAPLINE (last_diff3, FILEC, FILE0 + d, lowc);
00875     high[d] = D_HIGH_MAPLINE (last_diff3, FILEC, FILE0 + d, highc);
00876       }
00877
00878   /* Create a block with the appropriate sizes */
00879   result = create_diff3_block (low[0], high[0], low[1], high[1], lowc, highc);
00880
00881   /* Copy information for the common file.
00882      Return with a zero if any of the compares failed.  */
00883
00884   for (d = 0; d < 2; d++)
00885     for (ptr = using[d]; ptr; ptr = D_NEXT (ptr))
00886       {
00887     int result_offset = D_LOWLINE (ptr, FC) - lowc;
00888
00889     if (!copy_stringlist (D_LINEARRAY (ptr, FC),
00890                   D_LENARRAY (ptr, FC),
00891                   D_LINEARRAY (result, FILEC) + result_offset,
00892                   D_LENARRAY (result, FILEC) + result_offset,
00893                   D_NUMLINES (ptr, FC)))
00894       return 0;
00895       }
00896
00897   /* Copy information for file d.  First deal with anything that might be
00898      before the first diff.  */
00899
00900   for (d = 0; d < 2; d++)
00901     {
00902       struct diff_block *u = using[d];
00903       int lo = low[d], hi = high[d];
00904
00905       for (i = 0;
00906        i + lo < (u ? D_LOWLINE (u, FO) : hi + 1);
00907        i++)
00908     {
00909       D_RELNUM (result, FILE0 + d, i) = D_RELNUM (result, FILEC, i);
00910       D_RELLEN (result, FILE0 + d, i) = D_RELLEN (result, FILEC, i);
00911     }
00912
00913       for (ptr = u; ptr; ptr = D_NEXT (ptr))
00914     {
00915       int result_offset = D_LOWLINE (ptr, FO) - lo;
00916       int linec;
00917
00918       if (!copy_stringlist (D_LINEARRAY (ptr, FO),
00919                 D_LENARRAY (ptr, FO),
00920                 D_LINEARRAY (result, FILE0 + d) + result_offset,
00921                 D_LENARRAY (result, FILE0 + d) + result_offset,
00922                 D_NUMLINES (ptr, FO)))
00923         return 0;
00924
00925       /* Catch the lines between here and the next diff */
00926       linec = D_HIGHLINE (ptr, FC) + 1 - lowc;
00927       for (i = D_HIGHLINE (ptr, FO) + 1 - lo;
00928            i < (D_NEXT (ptr) ? D_LOWLINE (D_NEXT (ptr), FO) : hi + 1) - lo;
00929            i++)
00930         {
00931           D_RELNUM (result, FILE0 + d, i) = D_RELNUM (result, FILEC, linec);
00932           D_RELLEN (result, FILE0 + d, i) = D_RELLEN (result, FILEC, linec);
00933           linec++;
00934         }
00935     }
00936     }
00937
00938   /* Set correspond */
00939   if (!using[0])
00940     D3_TYPE (result) = DIFF_2ND;
00941   else if (!using[1])
00942     D3_TYPE (result) = DIFF_1ST;
00943   else
00944     {
00945       int nl0 = D_NUMLINES (result, FILE0);
00946       int nl1 = D_NUMLINES (result, FILE1);
00947
00948       if (nl0 != nl1
00949       || !compare_line_list (D_LINEARRAY (result, FILE0),
00950                  D_LENARRAY (result, FILE0),
00951                  D_LINEARRAY (result, FILE1),
00952                  D_LENARRAY (result, FILE1),
00953                  nl0))
00954     D3_TYPE (result) = DIFF_ALL;
00955       else
00956     D3_TYPE (result) = DIFF_3RD;
00957     }
00958
00959   return result;
00960 }
00961
00962 /*
00963  * This routine copies pointers from a list of strings to a different list
00964  * of strings.  If a spot in the second list is already filled, it
00965  * makes sure that it is filled with the same string; if not it
00966  * returns 0, the copy incomplete.
00967  * Upon successful completion of the copy, it returns 1.
00968  */
00969 static int
00970 copy_stringlist (fromptrs, fromlengths, toptrs, tolengths, copynum)
00971      char * const fromptrs[];
00972      char *toptrs[];
00973      size_t const fromlengths[];
00974      size_t tolengths[];
00975      int copynum;
00976 {
00977   register char * const *f = fromptrs;
00978   register char **t = toptrs;
00979   register size_t const *fl = fromlengths;
00980   register size_t *tl = tolengths;
00981
00982   while (copynum--)
00983     {
00984       if (*t)
00985     { if (*fl != *tl || memcmp (*f, *t, *fl)) return 0; }
00986       else
00987     { *t = *f ; *tl = *fl; }
00988
00989       t++; f++; tl++; fl++;
00990     }
00991   return 1;
00992 }
00993
00994 /*
00995  * Create a diff3_block, with ranges as specified in the arguments.
00996  * Allocate the arrays for the various pointers (and zero them) based
00997  * on the arguments passed.  Return the block as a result.
00998  */
00999 static struct diff3_block *
01000 create_diff3_block (low0, high0, low1, high1, low2, high2)
01001      register int low0, high0, low1, high1, low2, high2;
01002 {
01003   struct diff3_block *result = ALLOCATE (1, struct diff3_block);
01004   int numlines;
01005
01006   D3_TYPE (result) = ERROR;
01007   D_NEXT (result) = 0;
01008
01009   /* Assign ranges */
01010   D_LOWLINE (result, FILE0) = low0;
01011   D_HIGHLINE (result, FILE0) = high0;
01012   D_LOWLINE (result, FILE1) = low1;
01013   D_HIGHLINE (result, FILE1) = high1;
01014   D_LOWLINE (result, FILE2) = low2;
01015   D_HIGHLINE (result, FILE2) = high2;
01016
01017   /* Allocate and zero space */
01018   numlines = D_NUMLINES (result, FILE0);
01019   if (numlines)
01020     {
01021       D_LINEARRAY (result, FILE0) = ALLOCATE (numlines, char *);
01022       D_LENARRAY (result, FILE0) = ALLOCATE (numlines, size_t);
01023       bzero (D_LINEARRAY (result, FILE0), (numlines * sizeof (char *)));
01024       bzero (D_LENARRAY (result, FILE0), (numlines * sizeof (size_t)));
01025     }
01026   else
01027     {
01028       D_LINEARRAY (result, FILE0) = 0;
01029       D_LENARRAY (result, FILE0) = 0;
01030     }
01031
01032   numlines = D_NUMLINES (result, FILE1);
01033   if (numlines)
01034     {
01035       D_LINEARRAY (result, FILE1) = ALLOCATE (numlines, char *);
01036       D_LENARRAY (result, FILE1) = ALLOCATE (numlines, size_t);
01037       bzero (D_LINEARRAY (result, FILE1), (numlines * sizeof (char *)));
01038       bzero (D_LENARRAY (result, FILE1), (numlines * sizeof (size_t)));
01039     }
01040   else
01041     {
01042       D_LINEARRAY (result, FILE1) = 0;
01043       D_LENARRAY (result, FILE1) = 0;
01044     }
01045
01046   numlines = D_NUMLINES (result, FILE2);
01047   if (numlines)
01048     {
01049       D_LINEARRAY (result, FILE2) = ALLOCATE (numlines, char *);
01050       D_LENARRAY (result, FILE2) = ALLOCATE (numlines, size_t);
01051       bzero (D_LINEARRAY (result, FILE2), (numlines * sizeof (char *)));
01052       bzero (D_LENARRAY (result, FILE2), (numlines * sizeof (size_t)));
01053     }
01054   else
01055     {
01056       D_LINEARRAY (result, FILE2) = 0;
01057       D_LENARRAY (result, FILE2) = 0;
01058     }
01059
01060   /* Return */
01061   return result;
01062 }
01063
01064 /*
01065  * Compare two lists of lines of text.
01066  * Return 1 if they are equivalent, 0 if not.
01067  */
01068 static int
01069 compare_line_list (list1, lengths1, list2, lengths2, nl)
01070      char * const list1[], * const list2[];
01071      size_t const lengths1[], lengths2[];
01072      int nl;
01073 {
01074   char
01075     * const *l1 = list1,
01076     * const *l2 = list2;
01077   size_t const
01078     *lgths1 = lengths1,
01079     *lgths2 = lengths2;
01080
01081   while (nl--)
01082     if (!*l1 || !*l2 || *lgths1 != *lgths2++
01083     || memcmp (*l1++, *l2++, *lgths1++))
01084       return 0;
01085   return 1;
01086 }
01087
01088 /*
01089  * Routines to input and parse two way diffs.
01090  */
01091
01092 extern char **environ;
01093
01094 static struct diff_block *
01095 process_diff (filea, fileb, last_block, diff_contents)
01096      char const *filea, *fileb;
01097      struct diff_block **last_block;
01098      char **diff_contents;
01099 {
01100   char *diff_limit;
01101   char *scan_diff;
01102   enum diff_type dt;
01103   int i;
01104   struct diff_block *block_list, **block_list_end, *bptr;
01105
01106   diff_limit = read_diff (filea, fileb, diff_contents);
01107   scan_diff = *diff_contents;
01108   block_list_end = &block_list;
01109   bptr = 0; /* Pacify `gcc -W'.  */
01110
01111   while (scan_diff < diff_limit)
01112     {
01113       bptr = ALLOCATE (1, struct diff_block);
01114       bptr->lines[0] = bptr->lines[1] = 0;
01115       bptr->lengths[0] = bptr->lengths[1] = 0;
01116
01117       dt = process_diff_control (&scan_diff, bptr);
01118       if (dt == ERROR || *scan_diff != '\n')
01119     {
01120       char *serr;
01121
01122       for (serr = scan_diff; *serr != '\n'; serr++)
01123         ;
01124       *serr = '\0';
01125       diff_error ("diff error: %s", scan_diff, 0);
01126       *serr = '\n';
01127       DIFF3_ABORT (2);
01128     }
01129       scan_diff++;
01130
01131       /* Force appropriate ranges to be null, if necessary */
01132       switch (dt)
01133     {
01134     case ADD:
01135       bptr->ranges[0][0]++;
01136       break;
01137     case DELETE:
01138       bptr->ranges[1][0]++;
01139       break;
01140     case CHANGE:
01141       break;
01142     default:
01143       diff3_fatal ("internal error: invalid diff type in process_diff");
01144       break;
01145     }
01146
01147       /* Allocate space for the pointers for the lines from filea, and
01148      parcel them out among these pointers */
01149       if (dt != ADD)
01150     {
01151       int numlines = D_NUMLINES (bptr, 0);
01152       bptr->lines[0] = ALLOCATE (numlines, char *);
01153       bptr->lengths[0] = ALLOCATE (numlines, size_t);
01154       for (i = 0; i < numlines; i++)
01155         scan_diff = scan_diff_line (scan_diff,
01156                     &(bptr->lines[0][i]),
01157                     &(bptr->lengths[0][i]),
01158                     diff_limit,
01159                     '<');
01160     }
01161
01162       /* Get past the separator for changes */
01163       if (dt == CHANGE)
01164     {
01165       if (strncmp (scan_diff, "---\n", 4))
01166         diff3_fatal ("invalid diff format; invalid change separator");
01167       scan_diff += 4;
01168     }
01169
01170       /* Allocate space for the pointers for the lines from fileb, and
01171      parcel them out among these pointers */
01172       if (dt != DELETE)
01173     {
01174       int numlines = D_NUMLINES (bptr, 1);
01175       bptr->lines[1] = ALLOCATE (numlines, char *);
01176       bptr->lengths[1] = ALLOCATE (numlines, size_t);
01177       for (i = 0; i < numlines; i++)
01178         scan_diff = scan_diff_line (scan_diff,
01179                     &(bptr->lines[1][i]),
01180                     &(bptr->lengths[1][i]),
01181                     diff_limit,
01182                     '>');
01183     }
01184
01185       /* Place this block on the blocklist.  */
01186       *block_list_end = bptr;
01187       block_list_end = &bptr->next;
01188     }
01189
01190   *block_list_end = 0;
01191   *last_block = bptr;
01192   return block_list;
01193 }
01194
01195 /*
01196  * This routine will parse a normal format diff control string.  It
01197  * returns the type of the diff (ERROR if the format is bad).  All of
01198  * the other important information is filled into to the structure
01199  * pointed to by db, and the string pointer (whose location is passed
01200  * to this routine) is updated to point beyond the end of the string
01201  * parsed.  Note that only the ranges in the diff_block will be set by
01202  * this routine.
01203  *
01204  * If some specific pair of numbers has been reduced to a single
01205  * number, then both corresponding numbers in the diff block are set
01206  * to that number.  In general these numbers are interpetted as ranges
01207  * inclusive, unless being used by the ADD or DELETE commands.  It is
01208  * assumed that these will be special cased in a superior routine.
01209  */
01210
01211 static enum diff_type
01212 process_diff_control (string, db)
01213      char **string;
01214      struct diff_block *db;
01215 {
01216   char *s = *string;
01217   int holdnum;
01218   enum diff_type type;
01219
01220 /* These macros are defined here because they can use variables
01221    defined in this function.  Don't try this at home kids, we're
01222    trained professionals!
01223
01224    Also note that SKIPWHITE only recognizes tabs and spaces, and
01225    that READNUM can only read positive, integral numbers */
01226
01227 #define SKIPWHITE(s)    { while (*s == ' ' || *s == '\t') s++; }
01228 #define READNUM(s, num) \
01229     { unsigned char c = *s; if (!ISDIGIT (c)) return ERROR; holdnum = 0; \
01230       do { holdnum = (c - '0' + holdnum * 10); }    \
01231       while (ISDIGIT (c = *++s)); (num) = holdnum; }
01232
01233   /* Read first set of digits */
01234   SKIPWHITE (s);
01235   READNUM (s, db->ranges[0][START]);
01236
01237   /* Was that the only digit? */
01238   SKIPWHITE (s);
01239   if (*s == ',')
01240     {
01241       /* Get the next digit */
01242       s++;
01243       READNUM (s, db->ranges[0][END]);
01244     }
01245   else
01246     db->ranges[0][END] = db->ranges[0][START];
01247
01248   /* Get the letter */
01249   SKIPWHITE (s);
01250   switch (*s)
01251     {
01252     case 'a':
01253       type = ADD;
01254       break;
01255     case 'c':
01256       type = CHANGE;
01257       break;
01258     case 'd':
01259       type = DELETE;
01260       break;
01261     default:
01262       return ERROR;         /* Bad format */
01263     }
01264   s++;              /* Past letter */
01265
01266   /* Read second set of digits */
01267   SKIPWHITE (s);
01268   READNUM (s, db->ranges[1][START]);
01269
01270   /* Was that the only digit? */
01271   SKIPWHITE (s);
01272   if (*s == ',')
01273     {
01274       /* Get the next digit */
01275       s++;
01276       READNUM (s, db->ranges[1][END]);
01277       SKIPWHITE (s);        /* To move to end */
01278     }
01279   else
01280     db->ranges[1][END] = db->ranges[1][START];
01281
01282   *string = s;
01283   return type;
01284 }
01285
01286 static char *
01287 read_diff (filea, fileb, output_placement)
01288      char const *filea, *fileb;
01289      char **output_placement;
01290 {
01291   char *diff_result;
01292   size_t bytes, current_chunk_size, total;
01293   int fd, wstatus;
01294   struct stat pipestat;
01295   FILE *outfile_hold;
01296   const struct diff_callbacks *callbacks_hold;
01297   struct diff_callbacks my_callbacks;
01298   struct diff_callbacks *my_callbacks_arg;
01299
01300   /* 302 / 1000 is log10(2.0) rounded up.  Subtract 1 for the sign bit;
01301      add 1 for integer division truncation; add 1 more for a minus sign.  */
01302 #define INT_STRLEN_BOUND(type) ((sizeof(type)*CHAR_BIT - 1) * 302 / 1000 + 2)
01303
01304   char const *argv[7];
01305   char horizon_arg[17 + INT_STRLEN_BOUND (int)];
01306   char const **ap;
01307   char *diffout;
01308
01309   ap = argv;
01310   *ap++ = "diff";
01311   if (always_text)
01312     *ap++ = "-a";
01313   sprintf (horizon_arg, "--horizon-lines=%d", horizon_lines);
01314   *ap++ = horizon_arg;
01315   *ap++ = "--";
01316   *ap++ = filea;
01317   *ap++ = fileb;
01318   *ap = 0;
01319
01320   diffout = cvs_temp_name ();
01321
01322   outfile_hold = outfile;
01323   callbacks_hold = callbacks;
01324
01325   /* We want to call diff_run preserving any stdout and stderr
01326      callbacks, but discarding any callbacks to handle file output,
01327      since we want the file output to go to our temporary file.
01328      FIXME: We should use callbacks to just read it into a memory
01329      buffer; that's we do with the temporary file just below anyhow.  */
01330   if (callbacks == NULL)
01331     my_callbacks_arg = NULL;
01332   else
01333     {
01334       my_callbacks = *callbacks;
01335       my_callbacks.write_output = NULL;
01336       my_callbacks.flush_output = NULL;
01337       my_callbacks_arg = &my_callbacks;
01338     }
01339
01340   wstatus = diff_run (ap - argv, (char **) argv, diffout, my_callbacks_arg);
01341
01342   outfile = outfile_hold;
01343   callbacks = callbacks_hold;
01344
01345   if (wstatus == 2)
01346     diff3_fatal ("subsidiary diff failed");
01347
01348   if (-1 == (fd = open (diffout, O_RDONLY)))
01349     diff3_fatal ("could not open temporary diff file");
01350
01351   current_chunk_size = 8 * 1024;
01352   if (fstat (fd, &pipestat) == 0)
01353     current_chunk_size = max (current_chunk_size, STAT_BLOCKSIZE (pipestat));
01354
01355   diff_result = xmalloc (current_chunk_size);
01356   total = 0;
01357   do {
01358     bytes = myread (fd,
01359             diff_result + total,
01360             current_chunk_size - total);
01361     total += bytes;
01362     if (total == current_chunk_size)
01363       {
01364     if (current_chunk_size < 2 * current_chunk_size)
01365       current_chunk_size = 2 * current_chunk_size;
01366     else if (current_chunk_size < (size_t) -1)
01367       current_chunk_size = (size_t) -1;
01368     else
01369       diff3_fatal ("files are too large to fit into memory");
01370     diff_result = xrealloc (diff_result, (current_chunk_size *= 2));
01371       }
01372   } while (bytes);
01373
01374   if (total != 0 && diff_result[total-1] != '\n')
01375     diff3_fatal ("invalid diff format; incomplete last line");
01376
01377   *output_placement = diff_result;
01378
01379   if (close (fd) != 0)
01380     diff3_perror_with_exit ("pipe close");
01381   unlink (diffout);
01382
01383   return diff_result + total;
01384 }
01385
01386
01387 /*
01388  * Scan a regular diff line (consisting of > or <, followed by a
01389  * space, followed by text (including nulls) up to a newline.
01390  *
01391  * This next routine began life as a macro and many parameters in it
01392  * are used as call-by-reference values.
01393  */
01394 static char *
01395 scan_diff_line (scan_ptr, set_start, set_length, limit, leadingchar)
01396      char *scan_ptr, **set_start;
01397      size_t *set_length;
01398      char *limit;
01399      int leadingchar;
01400 {
01401   char *line_ptr;
01402
01403   if (!(scan_ptr[0] == leadingchar
01404     && scan_ptr[1] == ' '))
01405     diff3_fatal ("invalid diff format; incorrect leading line chars");
01406
01407   *set_start = line_ptr = scan_ptr + 2;
01408   while (*line_ptr++ != '\n')
01409     ;
01410
01411   /* Include newline if the original line ended in a newline,
01412      or if an edit script is being generated.
01413      Copy any missing newline message to stderr if an edit script is being
01414      generated, because edit scripts cannot handle missing newlines.
01415      Return the beginning of the next line.  */
01416   *set_length = line_ptr - *set_start;
01417   if (line_ptr < limit && *line_ptr == '\\')
01418     {
01419       if (! edscript)
01420     {
01421       --*set_length;
01422       line_ptr++;
01423       while (*line_ptr++ != '\n')
01424         ;
01425     }
01426       else
01427     {
01428       char *serr;
01429
01430       line_ptr++;
01431       serr = line_ptr;
01432       while (*line_ptr++ != '\n')
01433         ;
01434       line_ptr[-1] = '\0';
01435       diff_error ("%s", serr, 0);
01436       line_ptr[-1] = '\n';
01437     }
01438     }
01439
01440   return line_ptr;
01441 }
01442
01443 /*
01444  * This routine outputs a three way diff passed as a list of
01445  * diff3_block's.
01446  * The argument MAPPING is indexed by external file number (in the
01447  * argument list) and contains the internal file number (from the
01448  * diff passed).  This is important because the user expects his
01449  * outputs in terms of the argument list number, and the diff passed
01450  * may have been done slightly differently (if the last argument
01451  * was "-", for example).
01452  * REV_MAPPING is the inverse of MAPPING.
01453  */
01454 static void
01455 output_diff3 (diff, mapping, rev_mapping)
01456      struct diff3_block *diff;
01457      int const mapping[3], rev_mapping[3];
01458 {
01459   int i;
01460   int oddoneout;
01461   char *cp;
01462   struct diff3_block *ptr;
01463   int line;
01464   size_t length;
01465   int dontprint;
01466   static int skew_increment[3] = { 2, 3, 1 }; /* 0==>2==>1==>3 */
01467   char const *line_prefix = tab_align_flag ? "\t" : "  ";
01468
01469   for (ptr = diff; ptr; ptr = D_NEXT (ptr))
01470     {
01471       char x[2];
01472
01473       switch (ptr->correspond)
01474     {
01475     case DIFF_ALL:
01476       x[0] = '\0';
01477       dontprint = 3;    /* Print them all */
01478       oddoneout = 3;    /* Nobody's odder than anyone else */
01479       break;
01480     case DIFF_1ST:
01481     case DIFF_2ND:
01482     case DIFF_3RD:
01483       oddoneout = rev_mapping[(int) ptr->correspond - (int) DIFF_1ST];
01484
01485       x[0] = oddoneout + '1';
01486       x[1] = '\0';
01487       dontprint = oddoneout==0;
01488       break;
01489     default:
01490       diff3_fatal ("internal error: invalid diff type passed to output");
01491     }
01492       printf_output ("====%s\n", x);
01493
01494       /* Go 0, 2, 1 if the first and third outputs are equivalent.  */
01495       for (i = 0; i < 3;
01496        i = (oddoneout == 1 ? skew_increment[i] : i + 1))
01497     {
01498       int realfile = mapping[i];
01499       int
01500         lowt = D_LOWLINE (ptr, realfile),
01501         hight = D_HIGHLINE (ptr, realfile);
01502
01503       printf_output ("%d:", i + 1);
01504       switch (lowt - hight)
01505         {
01506         case 1:
01507           printf_output ("%da\n", lowt - 1);
01508           break;
01509         case 0:
01510           printf_output ("%dc\n", lowt);
01511           break;
01512         default:
01513           printf_output ("%d,%dc\n", lowt, hight);
01514           break;
01515         }
01516
01517       if (i == dontprint) continue;
01518
01519       if (lowt <= hight)
01520         {
01521           line = 0;
01522           do
01523         {
01524           printf_output (line_prefix);
01525           cp = D_RELNUM (ptr, realfile, line);
01526           length = D_RELLEN (ptr, realfile, line);
01527           write_output (cp, length);
01528         }
01529           while (++line < hight - lowt + 1);
01530           if (cp[length - 1] != '\n')
01531         printf_output ("\n\\ No newline at end of file\n");
01532         }
01533     }
01534     }
01535 }
01536
01537
01538 /*
01539  * Output the lines of B taken from FILENUM.
01540  * Double any initial '.'s; yield nonzero if any initial '.'s were doubled.
01541  */
01542 static int
01543 dotlines (b, filenum)
01544      struct diff3_block *b;
01545      int filenum;
01546 {
01547   int i;
01548   int leading_dot = 0;
01549
01550   for (i = 0;
01551        i < D_NUMLINES (b, filenum);
01552        i++)
01553     {
01554       char *line = D_RELNUM (b, filenum, i);
01555       if (line[0] == '.')
01556     {
01557       leading_dot = 1;
01558       write_output (".", 1);
01559     }
01560       write_output (line, D_RELLEN (b, filenum, i));
01561     }
01562
01563   return leading_dot;
01564 }
01565
01566 /*
01567  * Output to OUTPUTFILE a '.' line.  If LEADING_DOT is nonzero,
01568  * also output a command that removes initial '.'s
01569  * starting with line START and continuing for NUM lines.
01570  */
01571 static void
01572 undotlines (leading_dot, start, num)
01573      int leading_dot, start, num;
01574 {
01575   write_output (".\n", 2);
01576   if (leading_dot)
01577     if (num == 1)
01578       printf_output ("%ds/^\\.//\n", start);
01579     else
01580       printf_output ("%d,%ds/^\\.//\n", start, start + num - 1);
01581 }
01582
01583 /*
01584  * This routine outputs a diff3 set of blocks as an ed script.  This
01585  * script applies the changes between file's 2 & 3 to file 1.  It
01586  * takes the precise format of the ed script to be output from global
01587  * variables set during options processing.  Note that it does
01588  * destructive things to the set of diff3 blocks it is passed; it
01589  * reverses their order (this gets around the problems involved with
01590  * changing line numbers in an ed script).
01591  *
01592  * Note that this routine has the same problem of mapping as the last
01593  * one did; the variable MAPPING maps from file number according to
01594  * the argument list to file number according to the diff passed.  All
01595  * files listed below are in terms of the argument list.
01596  * REV_MAPPING is the inverse of MAPPING.
01597  *
01598  * The arguments FILE0, FILE1 and FILE2 are the strings to print
01599  * as the names of the three files.  These may be the actual names,
01600  * or may be the arguments specified with -L.
01601  *
01602  * Returns 1 if conflicts were found.
01603  */
01604
01605 static int
01606 output_diff3_edscript (diff, mapping, rev_mapping, file0, file1, file2)
01607      struct diff3_block *diff;
01608      int const mapping[3], rev_mapping[3];
01609      char const *file0, *file1, *file2;
01610 {
01611   int leading_dot;
01612   int conflicts_found = 0, conflict;
01613   struct diff3_block *b;
01614
01615   for (b = reverse_diff3_blocklist (diff); b; b = b->next)
01616     {
01617       /* Must do mapping correctly.  */
01618       enum diff_type type
01619     = ((b->correspond == DIFF_ALL) ?
01620        DIFF_ALL :
01621        ((enum diff_type)
01622         (((int) DIFF_1ST)
01623          + rev_mapping[(int) b->correspond - (int) DIFF_1ST])));
01624
01625       /* If we aren't supposed to do this output block, skip it.  */
01626       switch (type)
01627     {
01628     default: continue;
01629     case DIFF_2ND: if (!show_2nd) continue; conflict = 1; break;
01630     case DIFF_3RD: if (overlap_only) continue; conflict = 0; break;
01631     case DIFF_ALL: if (simple_only) continue; conflict = flagging; break;
01632     }
01633
01634       if (conflict)
01635     {
01636       conflicts_found = 1;
01637
01638
01639       /* Mark end of conflict.  */
01640
01641       printf_output ("%da\n", D_HIGHLINE (b, mapping[FILE0]));
01642       leading_dot = 0;
01643       if (type == DIFF_ALL)
01644         {
01645           if (show_2nd)
01646         {
01647           /* Append lines from FILE1.  */
01648           printf_output ("||||||| %s\n", file1);
01649           leading_dot = dotlines (b, mapping[FILE1]);
01650         }
01651           /* Append lines from FILE2.  */
01652           printf_output ("=======\n");
01653           leading_dot |= dotlines (b, mapping[FILE2]);
01654         }
01655       printf_output (">>>>>>> %s\n", file2);
01656       undotlines (leading_dot,
01657               D_HIGHLINE (b, mapping[FILE0]) + 2,
01658               (D_NUMLINES (b, mapping[FILE1])
01659                + D_NUMLINES (b, mapping[FILE2]) + 1));
01660
01661
01662       /* Mark start of conflict.  */
01663
01664       printf_output ("%da\n<<<<<<< %s\n",
01665              D_LOWLINE (b, mapping[FILE0]) - 1,
01666              type == DIFF_ALL ? file0 : file1);
01667       leading_dot = 0;
01668       if (type == DIFF_2ND)
01669         {
01670           /* Prepend lines from FILE1.  */
01671           leading_dot = dotlines (b, mapping[FILE1]);
01672           printf_output ("=======\n");
01673         }
01674       undotlines (leading_dot,
01675               D_LOWLINE (b, mapping[FILE0]) + 1,
01676               D_NUMLINES (b, mapping[FILE1]));
01677     }
01678       else if (D_NUMLINES (b, mapping[FILE2]) == 0)
01679     /* Write out a delete */
01680     {
01681       if (D_NUMLINES (b, mapping[FILE0]) == 1)
01682         printf_output ("%dd\n", D_LOWLINE (b, mapping[FILE0]));
01683       else
01684         printf_output ("%d,%dd\n",
01685                D_LOWLINE (b, mapping[FILE0]),
01686                D_HIGHLINE (b, mapping[FILE0]));
01687     }
01688       else
01689     /* Write out an add or change */
01690     {
01691       switch (D_NUMLINES (b, mapping[FILE0]))
01692         {
01693         case 0:
01694           printf_output ("%da\n", D_HIGHLINE (b, mapping[FILE0]));
01695           break;
01696         case 1:
01697           printf_output ("%dc\n", D_HIGHLINE (b, mapping[FILE0]));
01698           break;
01699         default:
01700           printf_output ("%d,%dc\n",
01701                  D_LOWLINE (b, mapping[FILE0]),
01702                  D_HIGHLINE (b, mapping[FILE0]));
01703           break;
01704         }
01705
01706       undotlines (dotlines (b, mapping[FILE2]),
01707               D_LOWLINE (b, mapping[FILE0]),
01708               D_NUMLINES (b, mapping[FILE2]));
01709     }
01710     }
01711   if (finalwrite) printf_output ("w\nq\n");
01712   return conflicts_found;
01713 }
01714
01715 /*
01716  * Read from INFILE and output to the standard output file a set of
01717  * diff3_ blocks DIFF as a merged file.  This acts like 'ed file0
01718  * <[output_diff3_edscript]', except that it works even for binary
01719  * data or incomplete lines.
01720  *
01721  * As before, MAPPING maps from arg list file number to diff file number,
01722  * REV_MAPPING is its inverse,
01723  * and FILE0, FILE1, and FILE2 are the names of the files.
01724  *
01725  * Returns 1 if conflicts were found.
01726  */
01727
01728 static int
01729 output_diff3_merge (infile, diff, mapping, rev_mapping,
01730             file0, file1, file2)
01731      FILE *infile;
01732      struct diff3_block *diff;
01733      int const mapping[3], rev_mapping[3];
01734      char const *file0, *file1, *file2;
01735 {
01736   int c, i;
01737   char cc;
01738   int conflicts_found = 0, conflict;
01739   struct diff3_block *b;
01740   int linesread = 0;
01741
01742   for (b = diff; b; b = b->next)
01743     {
01744       /* Must do mapping correctly.  */
01745       enum diff_type type
01746     = ((b->correspond == DIFF_ALL) ?
01747        DIFF_ALL :
01748        ((enum diff_type)
01749         (((int) DIFF_1ST)
01750          + rev_mapping[(int) b->correspond - (int) DIFF_1ST])));
01751       char const *format_2nd = "<<<<<<< %s\n";
01752
01753       /* If we aren't supposed to do this output block, skip it.  */
01754       switch (type)
01755     {
01756     default: continue;
01757     case DIFF_2ND: if (!show_2nd) continue; conflict = 1; break;
01758     case DIFF_3RD: if (overlap_only) continue; conflict = 0; break;
01759     case DIFF_ALL: if (simple_only) continue; conflict = flagging;
01760       format_2nd = "||||||| %s\n";
01761       break;
01762     }
01763
01764       /* Copy I lines from file 0.  */
01765       i = D_LOWLINE (b, FILE0) - linesread - 1;
01766       linesread += i;
01767       while (0 <= --i)
01768     do
01769       {
01770         c = getc (infile);
01771         if (c == EOF)
01772           if (ferror (infile))
01773         diff3_perror_with_exit ("input file");
01774           else if (feof (infile))
01775         diff3_fatal ("input file shrank");
01776         cc = c;
01777         write_output (&cc, 1);
01778       }
01779     while (c != '\n');
01780
01781       if (conflict)
01782     {
01783       conflicts_found = 1;
01784
01785       if (type == DIFF_ALL)
01786         {
01787           /* Put in lines from FILE0 with bracket.  */
01788           printf_output ("<<<<<<< %s\n", file0);
01789           for (i = 0;
01790            i < D_NUMLINES (b, mapping[FILE0]);
01791            i++)
01792         write_output (D_RELNUM (b, mapping[FILE0], i),
01793                   D_RELLEN (b, mapping[FILE0], i));
01794         }
01795
01796       if (show_2nd)
01797         {
01798           /* Put in lines from FILE1 with bracket.  */
01799           printf_output (format_2nd, file1);
01800           for (i = 0;
01801            i < D_NUMLINES (b, mapping[FILE1]);
01802            i++)
01803         write_output (D_RELNUM (b, mapping[FILE1], i),
01804                   D_RELLEN (b, mapping[FILE1], i));
01805         }
01806
01807       printf_output ("=======\n");
01808     }
01809
01810       /* Put in lines from FILE2.  */
01811       for (i = 0;
01812        i < D_NUMLINES (b, mapping[FILE2]);
01813        i++)
01814     write_output (D_RELNUM (b, mapping[FILE2], i),
01815               D_RELLEN (b, mapping[FILE2], i));
01816
01817       if (conflict)
01818     printf_output (">>>>>>> %s\n", file2);
01819
01820       /* Skip I lines in file 0.  */
01821       i = D_NUMLINES (b, FILE0);
01822       linesread += i;
01823       while (0 <= --i)
01824     while ((c = getc (infile)) != '\n')
01825       if (c == EOF)
01826         if (ferror (infile))
01827           diff3_perror_with_exit ("input file");
01828         else if (feof (infile))
01829           {
01830         if (i || b->next)
01831           diff3_fatal ("input file shrank");
01832         return conflicts_found;
01833           }
01834     }
01835   /* Copy rest of common file.  */
01836   while ((c = getc (infile)) != EOF || !(ferror (infile) | feof (infile)))
01837     {
01838       cc = c;
01839       write_output (&cc, 1);
01840     }
01841   return conflicts_found;
01842 }
01843
01844 /*
01845  * Reverse the order of the list of diff3 blocks.
01846  */
01847 static struct diff3_block *
01848 reverse_diff3_blocklist (diff)
01849      struct diff3_block *diff;
01850 {
01851   register struct diff3_block *tmp, *next, *prev;
01852
01853   for (tmp = diff, prev = 0;  tmp;  tmp = next)
01854     {
01855       next = tmp->next;
01856       tmp->next = prev;
01857       prev = tmp;
01858     }
01859
01860   return prev;
01861 }
01862
01863 static size_t
01864 myread (fd, ptr, size)
01865      int fd;
01866      char *ptr;
01867      size_t size;
01868 {
01869   size_t result = read (fd, ptr, size);
01870   if (result == -1)
01871     diff3_perror_with_exit ("read failed");
01872   return result;
01873 }
01874
01875 static void
01876 diff3_fatal (string)
01877      char const *string;
01878 {
01879   diff_error ("%s", string, 0);
01880   DIFF3_ABORT (2);
01881 }
01882
01883 static void
01884 diff3_perror_with_exit (string)
01885      char const *string;
01886 {
01887   perror_with_name (string);
01888   DIFF3_ABORT (2);
01889 }
01890
01891 static void
01892 initialize_main (argcp, argvp)
01893     int *argcp;
01894     char ***argvp;
01895 {
01896   always_text = 0;
01897   edscript = 0;
01898   flagging = 0;
01899   horizon_lines = 10;
01900   tab_align_flag = 0;
01901   simple_only = 0;
01902   overlap_only = 0;
01903   show_2nd = 0;
01904   finalwrite = 0;
01905   merge = 0;
01906   diff_program_name = (*argvp)[0];
01907   outfile = NULL;
01908 }
01909
01910 static void
01911 free_diff_blocks(p)
01912     struct diff_block *p;
01913 {
01914   register struct diff_block *next;
01915
01916   while (p)
01917     {
01918       next = p->next;
01919       if (p->lines[0]) free(p->lines[0]);
01920       if (p->lines[1]) free(p->lines[1]);
01921       if (p->lengths[0]) free(p->lengths[0]);
01922       if (p->lengths[1]) free(p->lengths[1]);
01923       free(p);
01924       p = next;
01925     }
01926 }
01927
01928 static void
01929 free_diff3_blocks(p)
01930     struct diff3_block *p;
01931 {
01932   register struct diff3_block *next;
01933
01934   while (p)
01935     {
01936       next = p->next;
01937       if (p->lines[0]) free(p->lines[0]);
01938       if (p->lines[1]) free(p->lines[1]);
01939       if (p->lines[2]) free(p->lines[2]);
01940       if (p->lengths[0]) free(p->lengths[0]);
01941       if (p->lengths[1]) free(p->lengths[1]);
01942       if (p->lengths[2]) free(p->lengths[2]);
01943       free(p);
01944       p = next;
01945     }
01946 }
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/diffrun.h Source File

cvs-1.10/diff/diffrun.h

Go to the documentation of this file.
00001 /* Interface header file for GNU DIFF library.
00002    Copyright (C) 1998 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018 #ifndef DIFFRUN_H
00019 #define DIFFRUN_H
00020
00021 /* This header file defines the interfaces used by the diff library.
00022    It should be included by programs which use the diff library.  */
00023
00024 #include <sys/types.h>
00025
00026 #if defined __STDC__ && __STDC__
00027 #define DIFFPARAMS(args) args
00028 #else
00029 #define DIFFPARAMS(args) ()
00030 #endif
00031
00032 /* The diff_callbacks structure is used to handle callbacks from the
00033    diff library.  All output goes through these callbacks.  When a
00034    pointer to this structure is passed in, it may be NULL.  Also, any
00035    of the individual callbacks may be NULL.  This means that the
00036    default action should be taken.  */
00037
00038 struct diff_callbacks
00039 {
00040   /* Write output.  This function just writes a string of a given
00041      length to the output file.  The default is to fwrite to OUTFILE.
00042      If this callback is defined, flush_output must also be defined.
00043      If the length is zero, output zero bytes.  */
00044   void (*write_output) DIFFPARAMS((char const *, size_t));
00045   /* Flush output.  The default is to fflush OUTFILE.  If this
00046      callback is defined, write_output must also be defined.  */
00047   void (*flush_output) DIFFPARAMS((void));
00048   /* Write a '\0'-terminated string to stdout.
00049      This is called for version and help messages.  */
00050   void (*write_stdout) DIFFPARAMS((char const *));
00051   /* Print an error message.  The first argument is a printf format,
00052      and the next two are parameters.  The default is to print a
00053      message on stderr.  */
00054   void (*error) DIFFPARAMS((char const *, char const *, char const *));
00055 };
00056
00057 /* Run a diff.  */
00058
00059 extern int diff_run DIFFPARAMS((int, char **, char *,
00060                 const struct diff_callbacks *));
00061
00062 /* Run a diff3.  */
00063
00064 extern int diff3_run DIFFPARAMS((int, char **, char *,
00065                  const struct diff_callbacks *));
00066
00067 #undef DIFFPARAMS
00068
00069 #endif /* DIFFRUN_H */
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/dir.c Source File

cvs-1.10/diff/dir.c

Go to the documentation of this file.
00001 /* Read, sort and compare two directories.  Used for GNU DIFF.
00002    Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018 #include "diff.h"
00019
00020 /* Read the directory named by DIR and store into DIRDATA a sorted vector
00021    of filenames for its contents.  DIR->desc == -1 means this directory is
00022    known to be nonexistent, so set DIRDATA to an empty vector.
00023    Return -1 (setting errno) if error, 0 otherwise.  */
00024
00025 struct dirdata
00026 {
00027   char const **names;   /* Sorted names of files in dir, 0-terminated.  */
00028   char *data;   /* Allocated storage for file names.  */
00029 };
00030
00031 static int compare_names PARAMS((void const *, void const *));
00032 static int dir_sort PARAMS((struct file_data const *, struct dirdata *));
00033
00034 #ifdef _WIN32
00035 #define CLOSEDIR_VOID 1
00036 #endif
00037
00038 static int
00039 dir_sort (dir, dirdata)
00040      struct file_data const *dir;
00041      struct dirdata *dirdata;
00042 {
00043   register struct dirent *next;
00044   register int i;
00045
00046   /* Address of block containing the files that are described.  */
00047   char const **names;
00048
00049   /* Number of files in directory.  */
00050   size_t nnames;
00051
00052   /* Allocated and used storage for file name data.  */
00053   char *data;
00054   size_t data_alloc, data_used;
00055
00056   dirdata->names = 0;
00057   dirdata->data = 0;
00058   nnames = 0;
00059   data = 0;
00060
00061   if (dir->desc != -1)
00062     {
00063       /* Open the directory and check for errors.  */
00064       register DIR *reading = opendir (dir->name);
00065       if (!reading)
00066     return -1;
00067
00068       /* Initialize the table of filenames.  */
00069
00070       data_alloc = max (1, (size_t) dir->stat.st_size);
00071       data_used = 0;
00072       dirdata->data = data = xmalloc (data_alloc);
00073
00074       /* Read the directory entries, and insert the subfiles
00075      into the `data' table.  */
00076
00077       while ((errno = 0, (next = readdir (reading)) != 0))
00078     {
00079       char *d_name = next->d_name;
00080       size_t d_size = NAMLEN (next) + 1;
00081
00082       /* Ignore the files `.' and `..' */
00083       if (d_name[0] == '.'
00084           && (d_name[1] == 0 || (d_name[1] == '.' && d_name[2] == 0)))
00085         continue;
00086
00087       if (excluded_filename (d_name))
00088         continue;
00089
00090       while (data_alloc < data_used + d_size)
00091         dirdata->data = data = xrealloc (data, data_alloc *= 2);
00092       memcpy (data + data_used, d_name, d_size);
00093       data_used += d_size;
00094       nnames++;
00095     }
00096       if (errno)
00097     {
00098       int e = errno;
00099       closedir (reading);
00100       errno = e;
00101       return -1;
00102     }
00103 #if CLOSEDIR_VOID
00104       closedir (reading);
00105 #else
00106       if (closedir (reading) != 0)
00107     return -1;
00108 #endif
00109     }
00110
00111   /* Create the `names' table from the `data' table.  */
00112   dirdata->names = names = (char const **) xmalloc (sizeof (char *)
00113                             * (nnames + 1));
00114   for (i = 0;  i < nnames;  i++)
00115     {
00116       names[i] = data;
00117       data += strlen (data) + 1;
00118     }
00119   names[nnames] = 0;
00120
00121   /* Sort the table.  */
00122   qsort (names, nnames, sizeof (char *), compare_names);
00123
00124   return 0;
00125 }
00126
00127 /* Sort the files now in the table.  */
00128
00129 static int
00130 compare_names (file1, file2)
00131      void const *file1, *file2;
00132 {
00133   return filename_cmp (* (char const *const *) file1,
00134                * (char const *const *) file2);
00135 }
00136
00137 /* Compare the contents of two directories named in FILEVEC[0] and FILEVEC[1].
00138    This is a top-level routine; it does everything necessary for diff
00139    on two directories.
00140
00141    FILEVEC[0].desc == -1 says directory FILEVEC[0] doesn't exist,
00142    but pretend it is empty.  Likewise for FILEVEC[1].
00143
00144    HANDLE_FILE is a caller-provided subroutine called to handle each file.
00145    It gets five operands: dir and name (rel to original working dir) of file
00146    in dir 0, dir and name pathname of file in dir 1, and the recursion depth.
00147
00148    For a file that appears in only one of the dirs, one of the name-args
00149    to HANDLE_FILE is zero.
00150
00151    DEPTH is the current depth in recursion, used for skipping top-level
00152    files by the -S option.
00153
00154    Returns the maximum of all the values returned by HANDLE_FILE,
00155    or 2 if trouble is encountered in opening files.  */
00156
00157 int
00158 diff_dirs (filevec, handle_file, depth)
00159      struct file_data const filevec[];
00160      int (*handle_file) PARAMS((char const *, char const *, char const *, char const *, int));
00161      int depth;
00162 {
00163   struct dirdata dirdata[2];
00164   int val = 0;          /* Return value.  */
00165   int i;
00166
00167   /* Get sorted contents of both dirs.  */
00168   for (i = 0; i < 2; i++)
00169     if (dir_sort (&filevec[i], &dirdata[i]) != 0)
00170       {
00171     perror_with_name (filevec[i].name);
00172     val = 2;
00173       }
00174
00175   if (val == 0)
00176     {
00177       register char const * const *names0 = dirdata[0].names;
00178       register char const * const *names1 = dirdata[1].names;
00179       char const *name0 = filevec[0].name;
00180       char const *name1 = filevec[1].name;
00181
00182       /* If `-S name' was given, and this is the topmost level of comparison,
00183      ignore all file names less than the specified starting name.  */
00184
00185       if (dir_start_file && depth == 0)
00186     {
00187       while (*names0 && filename_cmp (*names0, dir_start_file) < 0)
00188         names0++;
00189       while (*names1 && filename_cmp (*names1, dir_start_file) < 0)
00190         names1++;
00191     }
00192
00193       /* Loop while files remain in one or both dirs.  */
00194       while (*names0 || *names1)
00195     {
00196       /* Compare next name in dir 0 with next name in dir 1.
00197          At the end of a dir,
00198          pretend the "next name" in that dir is very large.  */
00199       int nameorder = (!*names0 ? 1 : !*names1 ? -1
00200                : filename_cmp (*names0, *names1));
00201       int v1 = (*handle_file) (name0, 0 < nameorder ? 0 : *names0++,
00202                    name1, nameorder < 0 ? 0 : *names1++,
00203                    depth + 1);
00204       if (v1 > val)
00205         val = v1;
00206     }
00207     }
00208
00209   for (i = 0; i < 2; i++)
00210     {
00211       if (dirdata[i].names)
00212     free (dirdata[i].names);
00213       if (dirdata[i].data)
00214     free (dirdata[i].data);
00215     }
00216
00217   return val;
00218 }
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/ed.c Source File

cvs-1.10/diff/ed.c

Go to the documentation of this file.
00001 /* Output routines for ed-script format.
00002    Copyright (C) 1988, 89, 91, 92, 93, 1998 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018 #include "diff.h"
00019
00020 static void print_ed_hunk PARAMS((struct change *));
00021 static void print_rcs_hunk PARAMS((struct change *));
00022 static void pr_forward_ed_hunk PARAMS((struct change *));
00023
00024 /* Print our script as ed commands.  */
00025
00026 void
00027 print_ed_script (script)
00028     struct change *script;
00029 {
00030   print_script (script, find_reverse_change, print_ed_hunk);
00031 }
00032
00033 /* Print a hunk of an ed diff */
00034
00035 static void
00036 print_ed_hunk (hunk)
00037      struct change *hunk;
00038 {
00039   int f0, l0, f1, l1;
00040   int deletes, inserts;
00041
00042 #if 0
00043   hunk = flip_script (hunk);
00044 #endif
00045 #ifdef DEBUG
00046   debug_script (hunk);
00047 #endif
00048
00049   /* Determine range of line numbers involved in each file.  */
00050   analyze_hunk (hunk, &f0, &l0, &f1, &l1, &deletes, &inserts);
00051   if (!deletes && !inserts)
00052     return;
00053
00054   begin_output ();
00055
00056   /* Print out the line number header for this hunk */
00057   print_number_range (',', &files[0], f0, l0);
00058   printf_output ("%c\n", change_letter (inserts, deletes));
00059
00060   /* Print new/changed lines from second file, if needed */
00061   if (inserts)
00062     {
00063       int i;
00064       int inserting = 1;
00065       for (i = f1; i <= l1; i++)
00066     {
00067       /* Resume the insert, if we stopped.  */
00068       if (! inserting)
00069         printf_output ("%da\n",
00070                i - f1 + translate_line_number (&files[0], f0) - 1);
00071       inserting = 1;
00072
00073       /* If the file's line is just a dot, it would confuse `ed'.
00074          So output it with a double dot, and set the flag LEADING_DOT
00075          so that we will output another ed-command later
00076          to change the double dot into a single dot.  */
00077
00078       if (files[1].linbuf[i][0] == '.'
00079           && files[1].linbuf[i][1] == '\n')
00080         {
00081           printf_output ("..\n");
00082           printf_output (".\n");
00083           /* Now change that double dot to the desired single dot.  */
00084           printf_output ("%ds/^\\.\\././\n",
00085                  i - f1 + translate_line_number (&files[0], f0));
00086           inserting = 0;
00087         }
00088       else
00089         /* Line is not `.', so output it unmodified.  */
00090         print_1_line ("", &files[1].linbuf[i]);
00091     }
00092
00093       /* End insert mode, if we are still in it.  */
00094       if (inserting)
00095     printf_output (".\n");
00096     }
00097 }
00098
00099 /* Print change script in the style of ed commands,
00100    but print the changes in the order they appear in the input files,
00101    which means that the commands are not truly useful with ed.  */
00102
00103 void
00104 pr_forward_ed_script (script)
00105      struct change *script;
00106 {
00107   print_script (script, find_change, pr_forward_ed_hunk);
00108 }
00109
00110 static void
00111 pr_forward_ed_hunk (hunk)
00112      struct change *hunk;
00113 {
00114   int i;
00115   int f0, l0, f1, l1;
00116   int deletes, inserts;
00117
00118   /* Determine range of line numbers involved in each file.  */
00119   analyze_hunk (hunk, &f0, &l0, &f1, &l1, &deletes, &inserts);
00120   if (!deletes && !inserts)
00121     return;
00122
00123   begin_output ();
00124
00125   printf_output ("%c", change_letter (inserts, deletes));
00126   print_number_range (' ', files, f0, l0);
00127   printf_output ("\n");
00128
00129   /* If deletion only, print just the number range.  */
00130
00131   if (!inserts)
00132     return;
00133
00134   /* For insertion (with or without deletion), print the number range
00135      and the lines from file 2.  */
00136
00137   for (i = f1; i <= l1; i++)
00138     print_1_line ("", &files[1].linbuf[i]);
00139
00140   printf_output (".\n");
00141 }
00142
00143 /* Print in a format somewhat like ed commands
00144    except that each insert command states the number of lines it inserts.
00145    This format is used for RCS.  */
00146
00147 void
00148 print_rcs_script (script)
00149      struct change *script;
00150 {
00151   print_script (script, find_change, print_rcs_hunk);
00152 }
00153
00154 /* Print a hunk of an RCS diff */
00155
00156 static void
00157 print_rcs_hunk (hunk)
00158      struct change *hunk;
00159 {
00160   int i;
00161   int f0, l0, f1, l1;
00162   int deletes, inserts;
00163   int tf0, tl0, tf1, tl1;
00164
00165   /* Determine range of line numbers involved in each file.  */
00166   analyze_hunk (hunk, &f0, &l0, &f1, &l1, &deletes, &inserts);
00167   if (!deletes && !inserts)
00168     return;
00169
00170   begin_output ();
00171
00172   translate_range (&files[0], f0, l0, &tf0, &tl0);
00173
00174   if (deletes)
00175     {
00176       printf_output ("d");
00177       /* For deletion, print just the starting line number from file 0
00178      and the number of lines deleted.  */
00179       printf_output ("%d %d\n",
00180              tf0,
00181              (tl0 >= tf0 ? tl0 - tf0 + 1 : 1));
00182     }
00183
00184   if (inserts)
00185     {
00186       printf_output ("a");
00187
00188       /* Take last-line-number from file 0 and # lines from file 1.  */
00189       translate_range (&files[1], f1, l1, &tf1, &tl1);
00190       printf_output ("%d %d\n",
00191              tl0,
00192              (tl1 >= tf1 ? tl1 - tf1 + 1 : 1));
00193
00194       /* Print the inserted lines.  */
00195       for (i = f1; i <= l1; i++)
00196     print_1_line ("", &files[1].linbuf[i]);
00197     }
00198 }
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/ifdef.c Source File

cvs-1.10/diff/ifdef.c

Go to the documentation of this file.
00001 /* #ifdef-format output routines for GNU DIFF.
00002    Copyright (C) 1989, 1991, 1992, 1993, 1994, 1998 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is distributed in the hope that it will be useful,
00007 but WITHOUT ANY WARRANTY.  No author or distributor
00008 accepts responsibility to anyone for the consequences of using it
00009 or for whether it serves any particular purpose or works at all,
00010 unless he says so in writing.  Refer to the GNU DIFF General Public
00011 License for full details.
00012
00013 Everyone is granted permission to copy, modify and redistribute
00014 GNU DIFF, but only under the conditions described in the
00015 GNU DIFF General Public License.   A copy of this license is
00016 supposed to have been given to you along with GNU DIFF so you
00017 can know your rights and responsibilities.  It should be in a
00018 file named COPYING.  Among other things, the copyright notice
00019 and this notice must be preserved on all copies.  */
00020
00021
00022 #include "diff.h"
00023
00024 struct group
00025 {
00026   struct file_data const *file;
00027   int from, upto; /* start and limit lines for this group of lines */
00028 };
00029
00030 static char *format_group PARAMS((int, char *, int, struct group const *));
00031 static char *scan_char_literal PARAMS((char *, int *));
00032 static char *scan_printf_spec PARAMS((char *));
00033 static int groups_letter_value PARAMS((struct group const *, int));
00034 static void format_ifdef PARAMS((char *, int, int, int, int));
00035 static void print_ifdef_hunk PARAMS((struct change *));
00036 static void print_ifdef_lines PARAMS((int, char *, struct group const *));
00037
00038 static int next_line;
00039
00040 /* Print the edit-script SCRIPT as a merged #ifdef file.  */
00041
00042 void
00043 print_ifdef_script (script)
00044      struct change *script;
00045 {
00046   next_line = - files[0].prefix_lines;
00047   print_script (script, find_change, print_ifdef_hunk);
00048   if (next_line < files[0].valid_lines)
00049     {
00050       begin_output ();
00051       format_ifdef (group_format[UNCHANGED], next_line, files[0].valid_lines,
00052             next_line - files[0].valid_lines + files[1].valid_lines,
00053             files[1].valid_lines);
00054     }
00055 }
00056
00057 /* Print a hunk of an ifdef diff.
00058    This is a contiguous portion of a complete edit script,
00059    describing changes in consecutive lines.  */
00060
00061 static void
00062 print_ifdef_hunk (hunk)
00063      struct change *hunk;
00064 {
00065   int first0, last0, first1, last1, deletes, inserts;
00066   char *format;
00067
00068   /* Determine range of line numbers involved in each file.  */
00069   analyze_hunk (hunk, &first0, &last0, &first1, &last1, &deletes, &inserts);
00070   if (inserts)
00071     format = deletes ? group_format[CHANGED] : group_format[NEW];
00072   else if (deletes)
00073     format = group_format[OLD];
00074   else
00075     return;
00076
00077   begin_output ();
00078
00079   /* Print lines up to this change.  */
00080   if (next_line < first0)
00081     format_ifdef (group_format[UNCHANGED], next_line, first0,
00082           next_line - first0 + first1, first1);
00083
00084   /* Print this change.  */
00085   next_line = last0 + 1;
00086   format_ifdef (format, first0, next_line, first1, last1 + 1);
00087 }
00088
00089 /* Print a set of lines according to FORMAT.
00090    Lines BEG0 up to END0 are from the first file;
00091    lines BEG1 up to END1 are from the second file.  */
00092
00093 static void
00094 format_ifdef (format, beg0, end0, beg1, end1)
00095      char *format;
00096      int beg0, end0, beg1, end1;
00097 {
00098   struct group groups[2];
00099
00100   groups[0].file = &files[0];
00101   groups[0].from = beg0;
00102   groups[0].upto = end0;
00103   groups[1].file = &files[1];
00104   groups[1].from = beg1;
00105   groups[1].upto = end1;
00106   format_group (1, format, '\0', groups);
00107 }
00108
00109 /* If DOIT is non-zero, output a set of lines according to FORMAT.
00110    The format ends at the first free instance of ENDCHAR.
00111    Yield the address of the terminating character.
00112    GROUPS specifies which lines to print.
00113    If OUT is zero, do not actually print anything; just scan the format.  */
00114
00115 static char *
00116 format_group (doit, format, endchar, groups)
00117      int doit;
00118      char *format;
00119      int endchar;
00120      struct group const *groups;
00121 {
00122   register char c;
00123   register char *f = format;
00124
00125   while ((c = *f) != endchar && c != 0)
00126     {
00127       f++;
00128       if (c == '%')
00129     {
00130       char *spec = f;
00131       switch ((c = *f++))
00132         {
00133         case '%':
00134           break;
00135
00136         case '(':
00137           /* Print if-then-else format e.g. `%(n=1?thenpart:elsepart)'.  */
00138           {
00139         int i, value[2];
00140         int thendoit, elsedoit;
00141
00142         for (i = 0; i < 2; i++)
00143           {
00144             unsigned char f0 = f[0];
00145             if (ISDIGIT (f0))
00146               {
00147             value[i] = atoi (f);
00148             while (ISDIGIT ((unsigned char) *++f))
00149               continue;
00150               }
00151             else
00152               {
00153             value[i] = groups_letter_value (groups, f0);
00154             if (value[i] < 0)
00155               goto bad_format;
00156             f++;
00157               }
00158             if (*f++ != "=?"[i])
00159               goto bad_format;
00160           }
00161         if (value[0] == value[1])
00162           thendoit = doit, elsedoit = 0;
00163         else
00164           thendoit = 0, elsedoit = doit;
00165         f = format_group (thendoit, f, ':', groups);
00166         if (*f)
00167           {
00168             f = format_group (elsedoit, f + 1, ')', groups);
00169             if (*f)
00170               f++;
00171           }
00172           }
00173           continue;
00174
00175         case '<':
00176           /* Print lines deleted from first file.  */
00177           print_ifdef_lines (doit, line_format[OLD], &groups[0]);
00178           continue;
00179
00180         case '=':
00181           /* Print common lines.  */
00182           print_ifdef_lines (doit, line_format[UNCHANGED], &groups[0]);
00183           continue;
00184
00185         case '>':
00186           /* Print lines inserted from second file.  */
00187           print_ifdef_lines (doit, line_format[NEW], &groups[1]);
00188           continue;
00189
00190         default:
00191           {
00192         int value;
00193         char *speclim;
00194
00195         f = scan_printf_spec (spec);
00196         if (!f)
00197           goto bad_format;
00198         speclim = f;
00199         c = *f++;
00200         switch (c)
00201           {
00202             case '\'':
00203               f = scan_char_literal (f, &value);
00204               if (!f)
00205             goto bad_format;
00206               break;
00207
00208             default:
00209               value = groups_letter_value (groups, c);
00210               if (value < 0)
00211             goto bad_format;
00212               break;
00213           }
00214         if (doit)
00215           {
00216             /* Temporarily replace e.g. "%3dnx" with "%3d\0x".  */
00217             *speclim = 0;
00218             printf_output (spec - 1, value);
00219             /* Undo the temporary replacement.  */
00220             *speclim = c;
00221           }
00222           }
00223           continue;
00224
00225         bad_format:
00226           c = '%';
00227           f = spec;
00228           break;
00229         }
00230     }
00231       if (doit)
00232     {
00233       /* Don't take the address of a register variable.  */
00234       char cc = c;
00235       write_output (&cc, 1);
00236     }
00237     }
00238   return f;
00239 }
00240
00241 /* For the line group pair G, return the number corresponding to LETTER.
00242    Return -1 if LETTER is not a group format letter.  */
00243 static int
00244 groups_letter_value (g, letter)
00245      struct group const *g;
00246      int letter;
00247 {
00248   if (ISUPPER (letter))
00249     {
00250       g++;
00251       letter = tolower (letter);
00252     }
00253   switch (letter)
00254     {
00255       case 'e': return translate_line_number (g->file, g->from) - 1;
00256       case 'f': return translate_line_number (g->file, g->from);
00257       case 'l': return translate_line_number (g->file, g->upto) - 1;
00258       case 'm': return translate_line_number (g->file, g->upto);
00259       case 'n': return g->upto - g->from;
00260       default: return -1;
00261     }
00262 }
00263
00264 /* Output using FORMAT to print the line group GROUP.
00265    But do nothing if DOIT is zero.  */
00266 static void
00267 print_ifdef_lines (doit, format, group)
00268      int doit;
00269      char *format;
00270      struct group const *group;
00271 {
00272   struct file_data const *file = group->file;
00273   char const * const *linbuf = file->linbuf;
00274   int from = group->from, upto = group->upto;
00275
00276   if (!doit)
00277     return;
00278
00279   /* If possible, use a single fwrite; it's faster.  */
00280   if (!tab_expand_flag && format[0] == '%')
00281     {
00282       if (format[1] == 'l' && format[2] == '\n' && !format[3])
00283     {
00284       write_output (linbuf[from],
00285             (linbuf[upto] + (linbuf[upto][-1] != '\n')
00286              - linbuf[from]));
00287       return;
00288     }
00289       if (format[1] == 'L' && !format[2])
00290     {
00291       write_output (linbuf[from],
00292             linbuf[upto] -  linbuf[from]);
00293       return;
00294     }
00295     }
00296
00297   for (;  from < upto;  from++)
00298     {
00299       register char c;
00300       register char *f = format;
00301       char cc;
00302
00303       while ((c = *f++) != 0)
00304     {
00305       if (c == '%')
00306         {
00307           char *spec = f;
00308           switch ((c = *f++))
00309         {
00310         case '%':
00311           break;
00312
00313         case 'l':
00314           output_1_line (linbuf[from],
00315                  linbuf[from + 1]
00316                    - (linbuf[from + 1][-1] == '\n'), 0, 0);
00317           continue;
00318
00319         case 'L':
00320           output_1_line (linbuf[from], linbuf[from + 1], 0, 0);
00321           continue;
00322
00323         default:
00324           {
00325             int value;
00326             char *speclim;
00327
00328             f = scan_printf_spec (spec);
00329             if (!f)
00330               goto bad_format;
00331             speclim = f;
00332             c = *f++;
00333             switch (c)
00334               {
00335             case '\'':
00336               f = scan_char_literal (f, &value);
00337               if (!f)
00338                 goto bad_format;
00339               break;
00340
00341             case 'n':
00342               value = translate_line_number (file, from);
00343               break;
00344
00345             default:
00346               goto bad_format;
00347               }
00348             /* Temporarily replace e.g. "%3dnx" with "%3d\0x".  */
00349             *speclim = 0;
00350             printf_output (spec - 1, value);
00351             /* Undo the temporary replacement.  */
00352             *speclim = c;
00353           }
00354           continue;
00355
00356         bad_format:
00357           c = '%';
00358           f = spec;
00359           break;
00360         }
00361         }
00362
00363       /* Don't take the address of a register variable.  */
00364       cc = c;
00365       write_output (&cc, 1);
00366     }
00367     }
00368 }
00369
00370 /* Scan the character literal represented in the string LIT; LIT points just
00371    after the initial apostrophe.  Put the literal's value into *INTPTR.
00372    Yield the address of the first character after the closing apostrophe,
00373    or zero if the literal is ill-formed.  */
00374 static char *
00375 scan_char_literal (lit, intptr)
00376      char *lit;
00377      int *intptr;
00378 {
00379   register char *p = lit;
00380   int value, digits;
00381   char c = *p++;
00382
00383   switch (c)
00384     {
00385       case 0:
00386       case '\'':
00387     return 0;
00388
00389       case '\\':
00390     value = 0;
00391     while ((c = *p++) != '\'')
00392       {
00393         unsigned digit = c - '0';
00394         if (8 <= digit)
00395           return 0;
00396         value = 8 * value + digit;
00397       }
00398     digits = p - lit - 2;
00399     if (! (1 <= digits && digits <= 3))
00400       return 0;
00401     break;
00402
00403       default:
00404     value = c;
00405     if (*p++ != '\'')
00406       return 0;
00407     break;
00408     }
00409   *intptr = value;
00410   return p;
00411 }
00412
00413 /* Scan optional printf-style SPEC of the form `-*[0-9]*(.[0-9]*)?[cdoxX]'.
00414    Return the address of the character following SPEC, or zero if failure.  */
00415 static char *
00416 scan_printf_spec (spec)
00417      register char *spec;
00418 {
00419   register unsigned char c;
00420
00421   while ((c = *spec++) == '-')
00422     continue;
00423   while (ISDIGIT (c))
00424     c = *spec++;
00425   if (c == '.')
00426     while (ISDIGIT (c = *spec++))
00427       continue;
00428   switch (c)
00429     {
00430       case 'c': case 'd': case 'o': case 'x': case 'X':
00431     return spec;
00432
00433       default:
00434     return 0;
00435     }
00436 }
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/io.c Source File

cvs-1.10/diff/io.c

Go to the documentation of this file.
00001 /* File I/O for GNU DIFF.
00002    Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018 #include "diff.h"
00019
00020 /* Rotate a value n bits to the left. */
00021 #define UINT_BIT (sizeof (unsigned) * CHAR_BIT)
00022 #define ROL(v, n) ((v) << (n) | (v) >> (UINT_BIT - (n)))
00023
00024 /* Given a hash value and a new character, return a new hash value. */
00025 #define HASH(h, c) ((c) + ROL (h, 7))
00026
00027 /* Guess remaining number of lines from number N of lines so far,
00028    size S so far, and total size T.  */
00029 #define GUESS_LINES(n,s,t) (((t) - (s)) / ((n) < 10 ? 32 : (s) / ((n)-1)) + 5)
00030
00031 /* Type used for fast prefix comparison in find_identical_ends.  */
00032 #ifndef word
00033 #define word int
00034 #endif
00035
00036 /* Lines are put into equivalence classes (of lines that match in line_cmp).
00037    Each equivalence class is represented by one of these structures,
00038    but only while the classes are being computed.
00039    Afterward, each class is represented by a number.  */
00040 struct equivclass
00041 {
00042   int next; /* Next item in this bucket. */
00043   unsigned hash;    /* Hash of lines in this class.  */
00044   char const *line; /* A line that fits this class. */
00045   size_t length;    /* That line's length, not counting its newline.  */
00046 };
00047
00048 /* Hash-table: array of buckets, each being a chain of equivalence classes.
00049    buckets[-1] is reserved for incomplete lines.  */
00050 static int *buckets;
00051
00052 /* Number of buckets in the hash table array, not counting buckets[-1]. */
00053 static int nbuckets;
00054
00055 /* Array in which the equivalence classes are allocated.
00056    The bucket-chains go through the elements in this array.
00057    The number of an equivalence class is its index in this array.  */
00058 static struct equivclass *equivs;
00059
00060 /* Index of first free element in the array `equivs'.  */
00061 static int equivs_index;
00062
00063 /* Number of elements allocated in the array `equivs'.  */
00064 static int equivs_alloc;
00065
00066 static void find_and_hash_each_line PARAMS((struct file_data *));
00067 static void find_identical_ends PARAMS((struct file_data[]));
00068 static void prepare_text_end PARAMS((struct file_data *));
00069
00070 /* Check for binary files and compare them for exact identity.  */
00071
00072 /* Return 1 if BUF contains a non text character.
00073    SIZE is the number of characters in BUF.  */
00074
00075 #define binary_file_p(buf, size) (memchr (buf, '\0', size) != 0)
00076
00077 /* Get ready to read the current file.
00078    Return nonzero if SKIP_TEST is zero,
00079    and if it appears to be a binary file.  */
00080
00081 int
00082 sip (current, skip_test)
00083      struct file_data *current;
00084      int skip_test;
00085 {
00086   /* If we have a nonexistent file at this stage, treat it as empty.  */
00087   if (current->desc < 0)
00088     {
00089       /* Leave room for a sentinel.  */
00090       current->bufsize = sizeof (word);
00091       current->buffer = xmalloc (current->bufsize);
00092     }
00093   else
00094     {
00095       current->bufsize = STAT_BLOCKSIZE (current->stat);
00096       current->buffer = xmalloc (current->bufsize);
00097
00098       if (! skip_test)
00099     {
00100       /* Check first part of file to see if it's a binary file.  */
00101 #if HAVE_SETMODE
00102       int oldmode = setmode (current->desc, O_BINARY);
00103 #endif
00104       size_t n = read (current->desc, current->buffer, current->bufsize);
00105       if (n == -1)
00106         pfatal_with_name (current->name);
00107       current->buffered_chars = n;
00108 #if HAVE_SETMODE
00109       if (oldmode != O_BINARY)
00110         {
00111           if (lseek (current->desc, - (off_t) n, SEEK_CUR) == -1)
00112         pfatal_with_name (current->name);
00113           setmode (current->desc, oldmode);
00114           current->buffered_chars = 0;
00115         }
00116 #endif
00117       return binary_file_p (current->buffer, n);
00118     }
00119     }
00120
00121   current->buffered_chars = 0;
00122   return 0;
00123 }
00124
00125 /* Slurp the rest of the current file completely into memory.  */
00126
00127 void
00128 slurp (current)
00129      struct file_data *current;
00130 {
00131   size_t cc;
00132
00133   if (current->desc < 0)
00134     /* The file is nonexistent.  */
00135     ;
00136   else if (S_ISREG (current->stat.st_mode))
00137     {
00138       /* It's a regular file; slurp in the rest all at once.  */
00139
00140       /* Get the size out of the stat block.
00141      Allocate enough room for appended newline and sentinel.  */
00142       cc = current->stat.st_size + 1 + sizeof (word);
00143       if (current->bufsize < cc)
00144     {
00145       current->bufsize = cc;
00146       current->buffer = xrealloc (current->buffer, cc);
00147     }
00148
00149       if (current->buffered_chars < current->stat.st_size)
00150     {
00151       cc = read (current->desc,
00152              current->buffer + current->buffered_chars,
00153              current->stat.st_size - current->buffered_chars);
00154       if (cc == -1)
00155         pfatal_with_name (current->name);
00156       current->buffered_chars += cc;
00157     }
00158     }
00159   /* It's not a regular file; read it, growing the buffer as needed.  */
00160   else if (always_text_flag || current->buffered_chars != 0)
00161     {
00162       for (;;)
00163     {
00164       if (current->buffered_chars == current->bufsize)
00165         {
00166           current->bufsize = current->bufsize * 2;
00167           current->buffer = xrealloc (current->buffer, current->bufsize);
00168         }
00169       cc = read (current->desc,
00170              current->buffer + current->buffered_chars,
00171              current->bufsize - current->buffered_chars);
00172       if (cc == 0)
00173         break;
00174       if (cc == -1)
00175         pfatal_with_name (current->name);
00176       current->buffered_chars += cc;
00177     }
00178       /* Allocate just enough room for appended newline and sentinel.  */
00179       current->bufsize = current->buffered_chars + 1 + sizeof (word);
00180       current->buffer = xrealloc (current->buffer, current->bufsize);
00181     }
00182 }
00183
00184 /* Split the file into lines, simultaneously computing the equivalence class for
00185    each line. */
00186
00187 static void
00188 find_and_hash_each_line (current)
00189      struct file_data *current;
00190 {
00191   unsigned h;
00192   unsigned char const *p = (unsigned char const *) current->prefix_end;
00193   unsigned char c;
00194   int i, *bucket;
00195   size_t length;
00196
00197   /* Cache often-used quantities in local variables to help the compiler.  */
00198   char const **linbuf = current->linbuf;
00199   int alloc_lines = current->alloc_lines;
00200   int line = 0;
00201   int linbuf_base = current->linbuf_base;
00202   int *cureqs = (int *) xmalloc (alloc_lines * sizeof (int));
00203   struct equivclass *eqs = equivs;
00204   int eqs_index = equivs_index;
00205   int eqs_alloc = equivs_alloc;
00206   char const *suffix_begin = current->suffix_begin;
00207   char const *bufend = current->buffer + current->buffered_chars;
00208   int use_line_cmp = ignore_some_line_changes;
00209
00210   while ((char const *) p < suffix_begin)
00211     {
00212       char const *ip = (char const *) p;
00213
00214       /* Compute the equivalence class for this line.  */
00215
00216       h = 0;
00217
00218       /* Hash this line until we find a newline. */
00219       if (ignore_case_flag)
00220     {
00221       if (ignore_all_space_flag)
00222         while ((c = *p++) != '\n')
00223           {
00224         if (! ISSPACE (c))
00225           h = HASH (h, ISUPPER (c) ? tolower (c) : c);
00226           }
00227       else if (ignore_space_change_flag)
00228         while ((c = *p++) != '\n')
00229           {
00230         if (ISSPACE (c))
00231           {
00232             for (;;)
00233               {
00234             c = *p++;
00235             if (!ISSPACE (c))
00236               break;
00237             if (c == '\n')
00238               goto hashing_done;
00239               }
00240             h = HASH (h, ' ');
00241           }
00242         /* C is now the first non-space.  */
00243         h = HASH (h, ISUPPER (c) ? tolower (c) : c);
00244           }
00245       else
00246         while ((c = *p++) != '\n')
00247           h = HASH (h, ISUPPER (c) ? tolower (c) : c);
00248     }
00249       else
00250     {
00251       if (ignore_all_space_flag)
00252         while ((c = *p++) != '\n')
00253           {
00254         if (! ISSPACE (c))
00255           h = HASH (h, c);
00256           }
00257       else if (ignore_space_change_flag)
00258         while ((c = *p++) != '\n')
00259           {
00260         if (ISSPACE (c))
00261           {
00262             for (;;)
00263               {
00264             c = *p++;
00265             if (!ISSPACE (c))
00266               break;
00267             if (c == '\n')
00268               goto hashing_done;
00269               }
00270             h = HASH (h, ' ');
00271           }
00272         /* C is now the first non-space.  */
00273         h = HASH (h, c);
00274           }
00275       else
00276         while ((c = *p++) != '\n')
00277           h = HASH (h, c);
00278     }
00279    hashing_done:;
00280
00281       bucket = &buckets[h % nbuckets];
00282       length = (char const *) p - ip - 1;
00283
00284       if ((char const *) p == bufend
00285       && current->missing_newline
00286       && ROBUST_OUTPUT_STYLE (output_style))
00287     {
00288       /* This line is incomplete.  If this is significant,
00289          put the line into bucket[-1].  */
00290       if (! (ignore_space_change_flag | ignore_all_space_flag))
00291         bucket = &buckets[-1];
00292
00293       /* Omit the inserted newline when computing linbuf later.  */
00294       p--;
00295       bufend = suffix_begin = (char const *) p;
00296     }
00297
00298       for (i = *bucket;  ;  i = eqs[i].next)
00299     if (!i)
00300       {
00301         /* Create a new equivalence class in this bucket. */
00302         i = eqs_index++;
00303         if (i == eqs_alloc)
00304           eqs = (struct equivclass *)
00305               xrealloc (eqs, (eqs_alloc*=2) * sizeof(*eqs));
00306         eqs[i].next = *bucket;
00307         eqs[i].hash = h;
00308         eqs[i].line = ip;
00309         eqs[i].length = length;
00310         *bucket = i;
00311         break;
00312       }
00313     else if (eqs[i].hash == h)
00314       {
00315         char const *eqline = eqs[i].line;
00316
00317         /* Reuse existing equivalence class if the lines are identical.
00318            This detects the common case of exact identity
00319            faster than complete comparison would.  */
00320         if (eqs[i].length == length && memcmp (eqline, ip, length) == 0)
00321           break;
00322
00323         /* Reuse existing class if line_cmp reports the lines equal.  */
00324         if (use_line_cmp && line_cmp (eqline, ip) == 0)
00325           break;
00326       }
00327
00328       /* Maybe increase the size of the line table. */
00329       if (line == alloc_lines)
00330     {
00331       /* Double (alloc_lines - linbuf_base) by adding to alloc_lines.  */
00332       alloc_lines = 2 * alloc_lines - linbuf_base;
00333       cureqs = (int *) xrealloc (cureqs, alloc_lines * sizeof (*cureqs));
00334       linbuf = (char const **) xrealloc (linbuf + linbuf_base,
00335                          (alloc_lines - linbuf_base)
00336                          * sizeof (*linbuf))
00337            - linbuf_base;
00338     }
00339       linbuf[line] = ip;
00340       cureqs[line] = i;
00341       ++line;
00342     }
00343
00344   current->buffered_lines = line;
00345
00346   for (i = 0;  ;  i++)
00347     {
00348       /* Record the line start for lines in the suffix that we care about.
00349      Record one more line start than lines,
00350      so that we can compute the length of any buffered line.  */
00351       if (line == alloc_lines)
00352     {
00353       /* Double (alloc_lines - linbuf_base) by adding to alloc_lines.  */
00354       alloc_lines = 2 * alloc_lines - linbuf_base;
00355       linbuf = (char const **) xrealloc (linbuf + linbuf_base,
00356                          (alloc_lines - linbuf_base)
00357                          * sizeof (*linbuf))
00358            - linbuf_base;
00359     }
00360       linbuf[line] = (char const *) p;
00361
00362       if ((char const *) p == bufend)
00363     break;
00364
00365       if (context <= i && no_diff_means_no_output)
00366     break;
00367
00368       line++;
00369
00370       while (*p++ != '\n')
00371     ;
00372     }
00373
00374   /* Done with cache in local variables.  */
00375   current->linbuf = linbuf;
00376   current->valid_lines = line;
00377   current->alloc_lines = alloc_lines;
00378   current->equivs = cureqs;
00379   equivs = eqs;
00380   equivs_alloc = eqs_alloc;
00381   equivs_index = eqs_index;
00382 }
00383
00384 /* Prepare the end of the text.  Make sure it's initialized.
00385    Make sure text ends in a newline,
00386    but remember that we had to add one.  */
00387
00388 static void
00389 prepare_text_end (current)
00390      struct file_data *current;
00391 {
00392   size_t buffered_chars = current->buffered_chars;
00393   char *p = current->buffer;
00394
00395   if (buffered_chars == 0 || p[buffered_chars - 1] == '\n')
00396     current->missing_newline = 0;
00397   else
00398     {
00399       p[buffered_chars++] = '\n';
00400       current->buffered_chars = buffered_chars;
00401       current->missing_newline = 1;
00402     }
00403
00404   /* Don't use uninitialized storage when planting or using sentinels.  */
00405   if (p)
00406     bzero (p + buffered_chars, sizeof (word));
00407 }
00408
00409 /* Given a vector of two file_data objects, find the identical
00410    prefixes and suffixes of each object. */
00411
00412 static void
00413 find_identical_ends (filevec)
00414      struct file_data filevec[];
00415 {
00416   word *w0, *w1;
00417   char *p0, *p1, *buffer0, *buffer1;
00418   char const *end0, *beg0;
00419   char const **linbuf0, **linbuf1;
00420   int i, lines;
00421   size_t n0, n1, tem;
00422   int alloc_lines0, alloc_lines1;
00423   int buffered_prefix, prefix_count, prefix_mask;
00424
00425   slurp (&filevec[0]);
00426   if (filevec[0].desc != filevec[1].desc)
00427     slurp (&filevec[1]);
00428   else
00429     {
00430       filevec[1].buffer = filevec[0].buffer;
00431       filevec[1].bufsize = filevec[0].bufsize;
00432       filevec[1].buffered_chars = filevec[0].buffered_chars;
00433     }
00434   for (i = 0; i < 2; i++)
00435     prepare_text_end (&filevec[i]);
00436
00437   /* Find identical prefix.  */
00438
00439   p0 = buffer0 = filevec[0].buffer;
00440   p1 = buffer1 = filevec[1].buffer;
00441
00442   n0 = filevec[0].buffered_chars;
00443   n1 = filevec[1].buffered_chars;
00444
00445   if (p0 == p1)
00446     /* The buffers are the same; sentinels won't work.  */
00447     p0 = p1 += n1;
00448   else
00449     {
00450       /* Insert end sentinels, in this case characters that are guaranteed
00451      to make the equality test false, and thus terminate the loop.  */
00452
00453       if (n0 < n1)
00454     p0[n0] = ~p1[n0];
00455       else
00456     p1[n1] = ~p0[n1];
00457
00458       /* Loop until first mismatch, or to the sentinel characters.  */
00459
00460       /* Compare a word at a time for speed.  */
00461       w0 = (word *) p0;
00462       w1 = (word *) p1;
00463       while (*w0++ == *w1++)
00464     ;
00465       --w0, --w1;
00466
00467       /* Do the last few bytes of comparison a byte at a time.  */
00468       p0 = (char *) w0;
00469       p1 = (char *) w1;
00470       while (*p0++ == *p1++)
00471     ;
00472       --p0, --p1;
00473
00474       /* Don't mistakenly count missing newline as part of prefix. */
00475       if (ROBUST_OUTPUT_STYLE (output_style)
00476       && (buffer0 + n0 - filevec[0].missing_newline < p0)
00477          !=
00478          (buffer1 + n1 - filevec[1].missing_newline < p1))
00479     --p0, --p1;
00480     }
00481
00482   /* Now P0 and P1 point at the first nonmatching characters.  */
00483
00484   /* Skip back to last line-beginning in the prefix,
00485      and then discard up to HORIZON_LINES lines from the prefix.  */
00486   i = horizon_lines;
00487   while (p0 != buffer0 && (p0[-1] != '\n' || i--))
00488     --p0, --p1;
00489
00490   /* Record the prefix.  */
00491   filevec[0].prefix_end = p0;
00492   filevec[1].prefix_end = p1;
00493
00494   /* Find identical suffix.  */
00495
00496   /* P0 and P1 point beyond the last chars not yet compared.  */
00497   p0 = buffer0 + n0;
00498   p1 = buffer1 + n1;
00499
00500   if (! ROBUST_OUTPUT_STYLE (output_style)
00501       || filevec[0].missing_newline == filevec[1].missing_newline)
00502     {
00503       end0 = p0;    /* Addr of last char in file 0.  */
00504
00505       /* Get value of P0 at which we should stop scanning backward:
00506      this is when either P0 or P1 points just past the last char
00507      of the identical prefix.  */
00508       beg0 = filevec[0].prefix_end + (n0 < n1 ? 0 : n0 - n1);
00509
00510       /* Scan back until chars don't match or we reach that point.  */
00511       while (p0 != beg0)
00512     if (*--p0 != *--p1)
00513       {
00514         /* Point at the first char of the matching suffix.  */
00515         ++p0, ++p1;
00516         beg0 = p0;
00517         break;
00518       }
00519
00520       /* Are we at a line-beginning in both files?  If not, add the rest of
00521      this line to the main body.  Discard up to HORIZON_LINES lines from
00522      the identical suffix.  Also, discard one extra line,
00523      because shift_boundaries may need it.  */
00524       i = horizon_lines + !((buffer0 == p0 || p0[-1] == '\n')
00525                 &&
00526                 (buffer1 == p1 || p1[-1] == '\n'));
00527       while (i-- && p0 != end0)
00528     while (*p0++ != '\n')
00529       ;
00530
00531       p1 += p0 - beg0;
00532     }
00533
00534   /* Record the suffix.  */
00535   filevec[0].suffix_begin = p0;
00536   filevec[1].suffix_begin = p1;
00537
00538   /* Calculate number of lines of prefix to save.
00539
00540      prefix_count == 0 means save the whole prefix;
00541      we need this with for options like -D that output the whole file.
00542      We also need it for options like -F that output some preceding line;
00543      at least we will need to find the last few lines,
00544      but since we don't know how many, it's easiest to find them all.
00545
00546      Otherwise, prefix_count != 0.  Save just prefix_count lines at start
00547      of the line buffer; they'll be moved to the proper location later.
00548      Handle 1 more line than the context says (because we count 1 too many),
00549      rounded up to the next power of 2 to speed index computation.  */
00550
00551   if (no_diff_means_no_output && ! function_regexp_list)
00552     {
00553       for (prefix_count = 1;  prefix_count < context + 1;  prefix_count *= 2)
00554     ;
00555       prefix_mask = prefix_count - 1;
00556       alloc_lines0
00557     = prefix_count
00558       + GUESS_LINES (0, 0, p0 - filevec[0].prefix_end)
00559       + context;
00560     }
00561   else
00562     {
00563       prefix_count = 0;
00564       prefix_mask = ~0;
00565       alloc_lines0 = GUESS_LINES (0, 0, n0);
00566     }
00567
00568   lines = 0;
00569   linbuf0 = (char const **) xmalloc (alloc_lines0 * sizeof (*linbuf0));
00570
00571   /* If the prefix is needed, find the prefix lines.  */
00572   if (! (no_diff_means_no_output
00573      && filevec[0].prefix_end == p0
00574      && filevec[1].prefix_end == p1))
00575     {
00576       p0 = buffer0;
00577       end0 = filevec[0].prefix_end;
00578       while (p0 != end0)
00579     {
00580       int l = lines++ & prefix_mask;
00581       if (l == alloc_lines0)
00582         linbuf0 = (char const **) xrealloc (linbuf0, (alloc_lines0 *= 2)
00583                              * sizeof(*linbuf0));
00584       linbuf0[l] = p0;
00585       while (*p0++ != '\n')
00586         ;
00587     }
00588     }
00589   buffered_prefix = prefix_count && context < lines ? context : lines;
00590
00591   /* Allocate line buffer 1.  */
00592   tem = prefix_count ? filevec[1].suffix_begin - buffer1 : n1;
00593
00594   alloc_lines1
00595     = (buffered_prefix
00596        + GUESS_LINES (lines, filevec[1].prefix_end - buffer1, tem)
00597        + context);
00598   linbuf1 = (char const **) xmalloc (alloc_lines1 * sizeof (*linbuf1));
00599
00600   if (buffered_prefix != lines)
00601     {
00602       /* Rotate prefix lines to proper location.  */
00603       for (i = 0;  i < buffered_prefix;  i++)
00604     linbuf1[i] = linbuf0[(lines - context + i) & prefix_mask];
00605       for (i = 0;  i < buffered_prefix;  i++)
00606     linbuf0[i] = linbuf1[i];
00607     }
00608
00609   /* Initialize line buffer 1 from line buffer 0.  */
00610   for (i = 0; i < buffered_prefix; i++)
00611     linbuf1[i] = linbuf0[i] - buffer0 + buffer1;
00612
00613   /* Record the line buffer, adjusted so that
00614      linbuf*[0] points at the first differing line.  */
00615   filevec[0].linbuf = linbuf0 + buffered_prefix;
00616   filevec[1].linbuf = linbuf1 + buffered_prefix;
00617   filevec[0].linbuf_base = filevec[1].linbuf_base = - buffered_prefix;
00618   filevec[0].alloc_lines = alloc_lines0 - buffered_prefix;
00619   filevec[1].alloc_lines = alloc_lines1 - buffered_prefix;
00620   filevec[0].prefix_lines = filevec[1].prefix_lines = lines;
00621 }
00622
00623 /* Largest primes less than some power of two, for nbuckets.  Values range
00624    from useful to preposterous.  If one of these numbers isn't prime
00625    after all, don't blame it on me, blame it on primes (6) . . . */
00626 static int const primes[] =
00627 {
00628   509,
00629   1021,
00630   2039,
00631   4093,
00632   8191,
00633   16381,
00634   32749,
00635 #if 32767 < INT_MAX
00636   65521,
00637   131071,
00638   262139,
00639   524287,
00640   1048573,
00641   2097143,
00642   4194301,
00643   8388593,
00644   16777213,
00645   33554393,
00646   67108859,         /* Preposterously large . . . */
00647   134217689,
00648   268435399,
00649   536870909,
00650   1073741789,
00651   2147483647,
00652 #endif
00653   0
00654 };
00655
00656 /* Given a vector of two file_data objects, read the file associated
00657    with each one, and build the table of equivalence classes.
00658    Return 1 if either file appears to be a binary file.
00659    If PRETEND_BINARY is nonzero, pretend they are binary regardless.  */
00660
00661 int
00662 read_files (filevec, pretend_binary)
00663      struct file_data filevec[];
00664      int pretend_binary;
00665 {
00666   int i;
00667   int skip_test = always_text_flag | pretend_binary;
00668   int appears_binary = pretend_binary | sip (&filevec[0], skip_test);
00669
00670   if (filevec[0].desc != filevec[1].desc)
00671     appears_binary |= sip (&filevec[1], skip_test | appears_binary);
00672   else
00673     {
00674       filevec[1].buffer = filevec[0].buffer;
00675       filevec[1].bufsize = filevec[0].bufsize;
00676       filevec[1].buffered_chars = filevec[0].buffered_chars;
00677     }
00678   if (appears_binary)
00679     {
00680 #if HAVE_SETMODE
00681       setmode (filevec[0].desc, O_BINARY);
00682       setmode (filevec[1].desc, O_BINARY);
00683 #endif
00684       return 1;
00685     }
00686
00687   find_identical_ends (filevec);
00688
00689   equivs_alloc = filevec[0].alloc_lines + filevec[1].alloc_lines + 1;
00690   equivs = (struct equivclass *) xmalloc (equivs_alloc * sizeof (struct equivclass));
00691   /* Equivalence class 0 is permanently safe for lines that were not
00692      hashed.  Real equivalence classes start at 1. */
00693   equivs_index = 1;
00694
00695   for (i = 0;  primes[i] < equivs_alloc / 3;  i++)
00696     if (! primes[i])
00697       abort ();
00698   nbuckets = primes[i];
00699
00700   buckets = (int *) xmalloc ((nbuckets + 1) * sizeof (*buckets));
00701   bzero (buckets++, (nbuckets + 1) * sizeof (*buckets));
00702
00703   for (i = 0; i < 2; i++)
00704     find_and_hash_each_line (&filevec[i]);
00705
00706   filevec[0].equiv_max = filevec[1].equiv_max = equivs_index;
00707
00708   free (equivs);
00709   free (buckets - 1);
00710
00711   return 0;
00712 }
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/normal.c Source File

cvs-1.10/diff/normal.c

Go to the documentation of this file.
00001 /* Normal-format output routines for GNU DIFF.
00002    Copyright (C) 1988, 1989, 1993, 1998 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018
00019 #include "diff.h"
00020
00021 static void print_normal_hunk PARAMS((struct change *));
00022
00023 /* Print the edit-script SCRIPT as a normal diff.
00024    INF points to an array of descriptions of the two files.  */
00025
00026 void
00027 print_normal_script (script)
00028      struct change *script;
00029 {
00030   print_script (script, find_change, print_normal_hunk);
00031 }
00032
00033 /* Print a hunk of a normal diff.
00034    This is a contiguous portion of a complete edit script,
00035    describing changes in consecutive lines.  */
00036
00037 static void
00038 print_normal_hunk (hunk)
00039      struct change *hunk;
00040 {
00041   int first0, last0, first1, last1, deletes, inserts;
00042   register int i;
00043
00044   /* Determine range of line numbers involved in each file.  */
00045   analyze_hunk (hunk, &first0, &last0, &first1, &last1, &deletes, &inserts);
00046   if (!deletes && !inserts)
00047     return;
00048
00049   begin_output ();
00050
00051   /* Print out the line number header for this hunk */
00052   print_number_range (',', &files[0], first0, last0);
00053   printf_output ("%c", change_letter (inserts, deletes));
00054   print_number_range (',', &files[1], first1, last1);
00055   printf_output ("\n");
00056
00057   /* Print the lines that the first file has.  */
00058   if (deletes)
00059     for (i = first0; i <= last0; i++)
00060       print_1_line ("<", &files[0].linbuf[i]);
00061
00062   if (inserts && deletes)
00063     printf_output ("---\n");
00064
00065   /* Print the lines that the second file has.  */
00066   if (inserts)
00067     for (i = first1; i <= last1; i++)
00068       print_1_line (">", &files[1].linbuf[i]);
00069 }
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/side.c Source File

cvs-1.10/diff/side.c

Go to the documentation of this file.
00001 /* sdiff-format output routines for GNU DIFF.
00002    Copyright (C) 1991, 1992, 1993, 1998 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is distributed in the hope that it will be useful,
00007 but WITHOUT ANY WARRANTY.  No author or distributor
00008 accepts responsibility to anyone for the consequences of using it
00009 or for whether it serves any particular purpose or works at all,
00010 unless he says so in writing.  Refer to the GNU DIFF General Public
00011 License for full details.
00012
00013 Everyone is granted permission to copy, modify and redistribute
00014 GNU DIFF, but only under the conditions described in the
00015 GNU DIFF General Public License.   A copy of this license is
00016 supposed to have been given to you along with GNU DIFF so you
00017 can know your rights and responsibilities.  It should be in a
00018 file named COPYING.  Among other things, the copyright notice
00019 and this notice must be preserved on all copies.  */
00020
00021
00022 #include "diff.h"
00023
00024 static unsigned print_half_line PARAMS((char const * const *, unsigned, unsigned));
00025 static unsigned tab_from_to PARAMS((unsigned, unsigned));
00026 static void print_1sdiff_line PARAMS((char const * const *, int, char const * const *));
00027 static void print_sdiff_common_lines PARAMS((int, int));
00028 static void print_sdiff_hunk PARAMS((struct change *));
00029
00030 /* Next line number to be printed in the two input files.  */
00031 static int next0, next1;
00032
00033 /* Print the edit-script SCRIPT as a sdiff style output.  */
00034
00035 void
00036 print_sdiff_script (script)
00037      struct change *script;
00038 {
00039   begin_output ();
00040
00041   next0 = next1 = - files[0].prefix_lines;
00042   print_script (script, find_change, print_sdiff_hunk);
00043
00044   print_sdiff_common_lines (files[0].valid_lines, files[1].valid_lines);
00045 }
00046
00047 /* Tab from column FROM to column TO, where FROM <= TO.  Yield TO.  */
00048
00049 static unsigned
00050 tab_from_to (from, to)
00051      unsigned from, to;
00052 {
00053   unsigned tab;
00054
00055   if (! tab_expand_flag)
00056     for (tab = from + TAB_WIDTH - from % TAB_WIDTH;  tab <= to;  tab += TAB_WIDTH)
00057       {
00058     write_output ("\t", 1);
00059     from = tab;
00060       }
00061   while (from++ < to)
00062     write_output (" ", 1);
00063   return to;
00064 }
00065
00066 /*
00067  * Print the text for half an sdiff line.  This means truncate to width
00068  * observing tabs, and trim a trailing newline.  Returns the last column
00069  * written (not the number of chars).
00070  */
00071 static unsigned
00072 print_half_line (line, indent, out_bound)
00073      char const * const *line;
00074      unsigned indent, out_bound;
00075 {
00076   register unsigned in_position = 0, out_position = 0;
00077   register char const
00078     *text_pointer = line[0],
00079     *text_limit = line[1];
00080
00081   while (text_pointer < text_limit)
00082     {
00083       register unsigned char c = *text_pointer++;
00084       /* We use CC to avoid taking the address of the register
00085          variable C.  */
00086       char cc;
00087
00088       switch (c)
00089     {
00090     case '\t':
00091       {
00092         unsigned spaces = TAB_WIDTH - in_position % TAB_WIDTH;
00093         if (in_position == out_position)
00094           {
00095         unsigned tabstop = out_position + spaces;
00096         if (tab_expand_flag)
00097           {
00098             if (out_bound < tabstop)
00099               tabstop = out_bound;
00100             for (;  out_position < tabstop;  out_position++)
00101               write_output (" ", 1);
00102           }
00103         else
00104           if (tabstop < out_bound)
00105             {
00106               out_position = tabstop;
00107               cc = c;
00108               write_output (&cc, 1);
00109             }
00110           }
00111         in_position += spaces;
00112       }
00113       break;
00114
00115     case '\r':
00116       {
00117         cc = c;
00118         write_output (&cc, 1);
00119         tab_from_to (0, indent);
00120         in_position = out_position = 0;
00121       }
00122       break;
00123
00124     case '\b':
00125       if (in_position != 0 && --in_position < out_bound)
00126         if (out_position <= in_position)
00127           /* Add spaces to make up for suppressed tab past out_bound.  */
00128           for (;  out_position < in_position;  out_position++)
00129         write_output (" ", 1);
00130         else
00131           {
00132         out_position = in_position;
00133         cc = c;
00134         write_output (&cc, 1);
00135           }
00136       break;
00137
00138     case '\f':
00139     case '\v':
00140     control_char:
00141       if (in_position < out_bound)
00142         {
00143           cc = c;
00144           write_output (&cc, 1);
00145         }
00146       break;
00147
00148     default:
00149       if (! ISPRINT (c))
00150         goto control_char;
00151       /* falls through */
00152     case ' ':
00153       if (in_position++ < out_bound)
00154         {
00155           out_position = in_position;
00156           cc = c;
00157           write_output (&cc, 1);
00158         }
00159       break;
00160
00161     case '\n':
00162       return out_position;
00163     }
00164     }
00165
00166   return out_position;
00167 }
00168
00169 /*
00170  * Print side by side lines with a separator in the middle.
00171  * 0 parameters are taken to indicate white space text.
00172  * Blank lines that can easily be caught are reduced to a single newline.
00173  */
00174
00175 static void
00176 print_1sdiff_line (left, sep, right)
00177      char const * const *left;
00178      int sep;
00179      char const * const *right;
00180 {
00181   unsigned hw = sdiff_half_width, c2o = sdiff_column2_offset;
00182   unsigned col = 0;
00183   int put_newline = 0;
00184
00185   if (left)
00186     {
00187       if (left[1][-1] == '\n')
00188     put_newline = 1;
00189       col = print_half_line (left, 0, hw);
00190     }
00191
00192   if (sep != ' ')
00193     {
00194       char cc;
00195
00196       col = tab_from_to (col, (hw + c2o - 1) / 2) + 1;
00197       if (sep == '|' && put_newline != (right[1][-1] == '\n'))
00198     sep = put_newline ? '/' : '\\';
00199       cc = sep;
00200       write_output (&cc, 1);
00201     }
00202
00203   if (right)
00204     {
00205       if (right[1][-1] == '\n')
00206     put_newline = 1;
00207       if (**right != '\n')
00208     {
00209       col = tab_from_to (col, c2o);
00210       print_half_line (right, col, hw);
00211     }
00212     }
00213
00214   if (put_newline)
00215     write_output ("\n", 1);
00216 }
00217
00218 /* Print lines common to both files in side-by-side format.  */
00219 static void
00220 print_sdiff_common_lines (limit0, limit1)
00221      int limit0, limit1;
00222 {
00223   int i0 = next0, i1 = next1;
00224
00225   if (! sdiff_skip_common_lines  &&  (i0 != limit0 || i1 != limit1))
00226     {
00227       if (sdiff_help_sdiff)
00228     printf_output ("i%d,%d\n", limit0 - i0, limit1 - i1);
00229
00230       if (! sdiff_left_only)
00231     {
00232       while (i0 != limit0 && i1 != limit1)
00233         print_1sdiff_line (&files[0].linbuf[i0++], ' ', &files[1].linbuf[i1++]);
00234       while (i1 != limit1)
00235         print_1sdiff_line (0, ')', &files[1].linbuf[i1++]);
00236     }
00237       while (i0 != limit0)
00238     print_1sdiff_line (&files[0].linbuf[i0++], '(', 0);
00239     }
00240
00241   next0 = limit0;
00242   next1 = limit1;
00243 }
00244
00245 /* Print a hunk of an sdiff diff.
00246    This is a contiguous portion of a complete edit script,
00247    describing changes in consecutive lines.  */
00248
00249 static void
00250 print_sdiff_hunk (hunk)
00251      struct change *hunk;
00252 {
00253   int first0, last0, first1, last1, deletes, inserts;
00254   register int i, j;
00255
00256   /* Determine range of line numbers involved in each file.  */
00257   analyze_hunk (hunk, &first0, &last0, &first1, &last1, &deletes, &inserts);
00258   if (!deletes && !inserts)
00259     return;
00260
00261   /* Print out lines up to this change.  */
00262   print_sdiff_common_lines (first0, first1);
00263
00264   if (sdiff_help_sdiff)
00265     printf_output ("c%d,%d\n", last0 - first0 + 1, last1 - first1 + 1);
00266
00267   /* Print ``xxx  |  xxx '' lines */
00268   if (inserts && deletes)
00269     {
00270       for (i = first0, j = first1;  i <= last0 && j <= last1; ++i, ++j)
00271     print_1sdiff_line (&files[0].linbuf[i], '|', &files[1].linbuf[j]);
00272       deletes = i <= last0;
00273       inserts = j <= last1;
00274       next0 = first0 = i;
00275       next1 = first1 = j;
00276     }
00277
00278
00279   /* Print ``     >  xxx '' lines */
00280   if (inserts)
00281     {
00282       for (j = first1; j <= last1; ++j)
00283     print_1sdiff_line (0, '>', &files[1].linbuf[j]);
00284       next1 = j;
00285     }
00286
00287   /* Print ``xxx  <     '' lines */
00288   if (deletes)
00289     {
00290       for (i = first0; i <= last0; ++i)
00291     print_1sdiff_line (&files[0].linbuf[i], '<', 0);
00292       next0 = i;
00293     }
00294 }
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


diff.h File Reference

cvs-1.10/diff/diff.h File Reference

#include "system.h"
#include <stdio.h>
#include <setjmp.h>
#include "regex.h"
#include "diffrun.h"

Include dependency graph for diff.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | change
struct | file_data
struct | regexp_list

Defines

#define | TAB_WIDTH 8
#define | EXTERN extern
#define | ROBUST_OUTPUT_STYLE(S) ((S) != OUTPUT_ED && (S) != OUTPUT_FORWARD_ED)
#define | DIFF_ABORT(retval) longjmp(diff_abort_buf, retval)

Enumerations

enum output_style {
OUTPUT_NORMAL, OUTPUT_CONTEXT, OUTPUT_UNIFIED, OUTPUT_ED,
OUTPUT_FORWARD_ED, OUTPUT_RCS, OUTPUT_IFDEF, OUTPUT_SDIFF
}
enum | line_class { OLD, NEW, UNCHANGED, CHANGED }

Functions

int | diff_2_files ()
void | print_context_header ()
void | print_context_script ()
int | excluded_filename ()
int | diff_dirs ()
void | print_ed_script ()
void | pr_forward_ed_script ()
void | print_ifdef_script ()
int | read_files ()
int | sip ()
void | slurp ()
void | print_normal_script ()
void | print_rcs_script ()
void | print_sdiff_script ()
char * | xmalloc ()
char * | xrealloc ()
char * | concat ()
char * | dir_file_pathname ()
int | change_letter ()
int | line_cmp ()
int | translate_line_number ()
change * find_change ()
change * find_reverse_change ()
void | analyze_hunk ()
void | begin_output ()
void | debug_script ()
void | diff_error ()
void | fatal ()
void | finish_output ()
void | write_output ()
void | printf_output ()
void | flush_output ()
void | message ()
void | message5 ()
void | output_1_line ()
void | perror_with_name ()
void | pfatal_with_name ()
void | print_1_line ()
void | print_message_queue ()
void | print_number_range ()
void | print_script ()
void | setup_output ()
void | translate_range ()

Variables

const struct diff_callbacks * | callbacks
enum output_style | output_style
int | no_diff_means_no_output
int | context
int | always_text_flag
int | horizon_lines
int | ignore_space_change_flag
int | ignore_all_space_flag
int | ignore_blank_lines_flag
int | ignore_some_line_changes
int | ignore_some_changes
int | ignore_case_flag
char * | file_label [2]
regexp_list * function_regexp_list
regexp_list * ignore_regexp_list
int | no_details_flag
int | print_file_same_flag
int | tab_align_flag
int | tab_expand_flag
char * | dir_start_file
int | entire_new_file_flag
int | unidirectional_new_file_flag
int | paginate_flag
char * | group_format [CHANGED+1]
char * | line_format [UNCHANGED+1]
int | sdiff_help_sdiff
int | sdiff_left_only
int | sdiff_skip_common_lines
unsigned | sdiff_half_width
unsigned | sdiff_column2_offset
char * | switch_string
int | heuristic
char * | diff_program_name
jmp_buf | diff_abort_buf
file_data | files [2]
FILE * | outfile
char const | diff_version_string []

Define Documentation

#define DIFF_ABORT ( retval ) longjmp(diff_abort_buf, retval)

Definition at line 186 of file diff.h.

#define EXTERN extern

Definition at line 29 of file diff.h.

#define ROBUST_OUTPUT_STYLE ( S ) ((S) != OUTPUT_ED && (S) != OUTPUT_FORWARD_ED)

Definition at line 58 of file diff.h.

#define TAB_WIDTH 8

Definition at line 24 of file diff.h.

Enumeration Type Documentation

enum line_class

Enumeration values:
OLD
NEW
UNCHANGED
CHANGED

Definition at line 143 of file diff.h.

00143                 {
00144   /* Lines taken from just the first file.  */
00145   OLD,
00146   /* Lines taken from just the second file.  */
00147   NEW,
00148   /* Lines common to both files.  */
00149   UNCHANGED,
00150   /* A hunk containing both old and new lines (line groups only).  */
00151   CHANGED
00152 };

enum output_style

Enumeration values:
OUTPUT_NORMAL
OUTPUT_CONTEXT
OUTPUT_UNIFIED
OUTPUT_ED
OUTPUT_FORWARD_ED
OUTPUT_RCS
OUTPUT_IFDEF
OUTPUT_SDIFF

Definition at line 37 of file diff.h.

00037                   {
00038   /* Default output style.  */
00039   OUTPUT_NORMAL,
00040   /* Output the differences with lines of context before and after (-c).  */
00041   OUTPUT_CONTEXT,
00042   /* Output the differences in a unified context diff format (-u). */
00043   OUTPUT_UNIFIED,
00044   /* Output the differences as commands suitable for `ed' (-e).  */
00045   OUTPUT_ED,
00046   /* Output the diff as a forward ed script (-f).  */
00047   OUTPUT_FORWARD_ED,
00048   /* Like -f, but output a count of changed lines in each "command" (-n). */
00049   OUTPUT_RCS,
00050   /* Output merged #ifdef'd file (-D).  */
00051   OUTPUT_IFDEF,
00052   /* Output sdiff style (-y).  */
00053   OUTPUT_SDIFF
00054 };

Function Documentation

void analyze_hunk ( )

void begin_output ( )

int change_letter ( )

char* concat ( )

Referenced by arg4().

void debug_script ( )

int diff_2_files ( )

int diff_dirs ( )

void diff_error ( )

char* dir_file_pathname ( )

int excluded_filename ( )

void fatal ( )

Referenced by depth().

struct change* find_change ( )

struct change* find_reverse_change ( )

void finish_output ( )

void flush_output ( )

int line_cmp ( )

void message ( )

Referenced by depth().

void message5 ( )

void output_1_line ( )

void perror_with_name ( )

Referenced by depth().

void pfatal_with_name ( )

Referenced by depth().

void pr_forward_ed_script ( )

void print_1_line ( )

void print_context_header ( )

Referenced by depth().

void print_context_script ( )

void print_ed_script ( )

void print_ifdef_script ( )

void print_message_queue ( )

void print_normal_script ( )

void print_number_range ( )

void print_rcs_script ( )

void print_script ( )

void print_sdiff_script ( )

void printf_output ( )

Referenced by depth(), groups(), and limit1().

int read_files ( )

void setup_output ( )

int sip ( )

void slurp ( )

int translate_line_number ( )

void translate_range ( )

void write_output ( )

Referenced by file1(), group(), groups(), and out_bound().

char* xmalloc ( )

Referenced by argstring(), argvconcat(), depth(), dirdata(), extra_arg(), getpass(), hold(), ign_setup(), macos_start_server(), name(), open_module(), os2_start_server(), rootdir(), skip_test(), strndup(), suffix(), update_dir(), update_server(), vms_start_server(), wnt_start_server(), wrap_setup(), and xgetwd().

char* xrealloc ( )

Referenced by closure(), depth(), dir_ign_current(), hold(), newsize(), src(), temp(), vers(), and xgetwd().

Variable Documentation

int always_text_flag

Definition at line 71 of file diff.h.

const struct diff_callbacks* callbacks

Definition at line 35 of file diff.h.

int context

Definition at line 67 of file diff.h.

Referenced by TViewFill::InitItem(), CBrowseFileView::OnInitialUpdate(), CBrowseFileView::OnPrint(), CBrowseFileView::ResetView(), and CBrowseFileView::Resort().

jmp_buf diff_abort_buf

Definition at line 185 of file diff.h.

char* diff_program_name

Definition at line 182 of file diff.h.

char const diff_version_string[]

Definition at line 366 of file diff.h.

char* dir_start_file

Definition at line 128 of file diff.h.

int entire_new_file_flag

Definition at line 133 of file diff.h.

char* file_label[2]

Definition at line 97 of file diff.h.

struct file_data files[2]

Definition at line 276 of file diff.h.

struct regexp_list* function_regexp_list

Definition at line 106 of file diff.h.

char* group_format[CHANGED + 1]

Definition at line 155 of file diff.h.

int heuristic

Definition at line 179 of file diff.h.

int horizon_lines

Definition at line 74 of file diff.h.

int ignore_all_space_flag

Definition at line 80 of file diff.h.

int ignore_blank_lines_flag

Definition at line 83 of file diff.h.

int ignore_case_flag

Definition at line 94 of file diff.h.

struct regexp_list* ignore_regexp_list

Definition at line 109 of file diff.h.

int ignore_some_changes

Definition at line 91 of file diff.h.

int ignore_some_line_changes

Definition at line 87 of file diff.h.

int ignore_space_change_flag

Definition at line 77 of file diff.h.

char* line_format[UNCHANGED + 1]

Definition at line 158 of file diff.h.

int no_details_flag

Definition at line 112 of file diff.h.

int no_diff_means_no_output

Definition at line 63 of file diff.h.

FILE* outfile

Definition at line 280 of file diff.h.

enum output_style output_style

Definition at line 60 of file diff.h.

int paginate_flag

Definition at line 141 of file diff.h.

int print_file_same_flag

Definition at line 116 of file diff.h.

unsigned sdiff_column2_offset

Definition at line 171 of file diff.h.

unsigned sdiff_half_width

Definition at line 170 of file diff.h.

int sdiff_help_sdiff

Definition at line 161 of file diff.h.

int sdiff_left_only

Definition at line 164 of file diff.h.

int sdiff_skip_common_lines

Definition at line 167 of file diff.h.

char* switch_string

Definition at line 176 of file diff.h.

int tab_align_flag

Definition at line 120 of file diff.h.

int tab_expand_flag

Definition at line 124 of file diff.h.

int unidirectional_new_file_flag

Definition at line 138 of file diff.h.

Generated on Sun Oct 21 12:42:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


diff3.c File Reference

cvs-1.10/diff/diff3.c File Reference

#include "system.h"
#include <stdio.h>
#include <setjmp.h>
#include "getopt.h"
#include "diffrun.h"

Include dependency graph for diff3.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | diff3_block
struct | diff_block

Defines

#define | FILE0 0
#define | FILE1 1
#define | FILE2 2
#define | FILEC FILE2
#define | FO 0
#define | FC 1
#define | START 0
#define | END 1
#define | D_LOWLINE(diff, filenum) ((diff)->ranges[filenum][START])
#define | D_HIGHLINE(diff, filenum) ((diff)->ranges[filenum][END])
#define | D_NUMLINES(diff, filenum) (D_HIGHLINE (diff, filenum) - D_LOWLINE (diff, filenum) + 1)
#define | D_RELNUM(diff, filenum, linenum) ((diff)->lines[filenum][linenum])
#define | D_RELLEN(diff, filenum, linenum) ((diff)->lengths[filenum][linenum])
#define | D_LINEARRAY(diff, filenum) ((diff)->lines[filenum])
#define | D_LENARRAY(diff, filenum) ((diff)->lengths[filenum])
#define | D_NEXT(diff) ((diff)->next)
#define | D3_TYPE(diff) ((diff)->correspond)
#define | D_HIGH_MAPLINE(diff, fromfile, tofile, lineno)
#define | D_LOW_MAPLINE(diff, fromfile, tofile, lineno)
#define | ALLOCATE(number, type) (type *) xmalloc ((number) * sizeof (type))
#define | DIFF3_ABORT(retval) longjmp(diff3_abort_buf, retval)
#define | SKIPWHITE(s) { while (*s == ' ' || *s == '\t') s++; }
#define | READNUM(s, num)
#define | INT_STRLEN_BOUND(type) ((sizeof(type)*CHAR_BIT - 1) * 302 / 1000 + 2)

Enumerations

enum diff_type {
ERROR, ADD, CHANGE, DELETE,
DIFF_ALL, DIFF_1ST, DIFF_2ND, DIFF_3RD
}

Functions

void | write_output ()
void | printf_output ()
void | flush_output ()
char * | cvs_temp_name ()
char * | read_diff ()
char * | scan_diff_line ()
enum diff_type | process_diff_control ()
int | compare_line_list ()
int | copy_stringlist ()
int | dotlines ()
int | output_diff3_edscript ()
int | output_diff3_merge ()
size_t | myread ()
diff3_block * create_diff3_block ()
diff3_block * make_3way_diff ()
diff3_block * reverse_diff3_blocklist ()
diff3_block * using_to_diff3_block ()
diff_block * process_diff ()
void | check_output ()
void | diff3_fatal ()
void | output_diff3 ()
void | diff3_perror_with_exit ()
int | try_help ()
void | undotlines ()
void | usage ()
void | initialize_main ()
void | free_diff_blocks ()
void | free_diff3_blocks ()
char * | xmalloc ()
char * | xrealloc ()
void | perror_with_name ()
void | diff_error ()
int | diff3_run (argc, argv, out, callbacks_arg) int argc
diff_block * | process_diff (filea, fileb, last_block, diff_contents) char const *filea,*fileb

Variables

char const | diff_version_string []
FILE * | outfile
const struct diff_callbacks * | callbacks
int | always_text
int | edscript
int | flagging
int | horizon_lines = 10
int | tab_align_flag
int | simple_only
int | overlap_only
int | show_2nd
int | finalwrite
int | merge
char * | diff_program_name
jmp_buf | diff3_abort_buf
option const | longopts []
char ** | argv
char * | out
const struct diff_callbacks * | callbacks_arg
* thread1
* last_using [2]
int | low_thread
int | high_thread
diff3_block const * | last_diff3
char * | toptrs []
size_t const | fromlengths []
size_t | tolengths []
int | copynum
high0
low1
high1
low2
high2
*const | list2 []
size_t const | lengths1 []
size_t const | lengths2 []
int | nl
diff_block ** last_block
char ** | diff_contents
diff_block * db
* fileb
char ** | output_placement
** set_start
size_t * | set_length
char * | limit
int | leadingchar
int const | mapping [3]
int const | rev_mapping [3]
int | filenum
start
num
char const * | file0
char const * | file1
char const * | file2
diff3_block * diff
char * | ptr
size_t | size
char *** | argvp

Define Documentation

#define ALLOCATE | ( | number,
 |  | type | ) | (type *) xmalloc ((number) * sizeof (type))

Definition at line 196 of file diff3.c.

#define D3_TYPE ( diff ) ((diff)->correspond)

Definition at line 177 of file diff3.c.

#define DIFF3_ABORT ( retval ) longjmp(diff3_abort_buf, retval)

Definition at line 271 of file diff3.c.

#define D_HIGHLINE | ( | diff,
 |  | filenum | ) | ((diff)->ranges[filenum][END])

Definition at line 146 of file diff3.c.

#define D_HIGH_MAPLINE | ( | diff,
 |  | fromfile,
 |  | tofile,
 |  | lineno | )

Value:

((lineno)                       \
   - D_HIGHLINE ((diff), (fromfile))            \
   + D_HIGHLINE ((diff), (tofile)))

Definition at line 183 of file diff3.c.

#define D_LENARRAY | ( | diff,
 |  | filenum | ) | ((diff)->lengths[filenum])

Definition at line 166 of file diff3.c.

#define D_LINEARRAY | ( | diff,
 |  | filenum | ) | ((diff)->lines[filenum])

Definition at line 164 of file diff3.c.

#define D_LOWLINE | ( | diff,
 |  | filenum | ) | ((diff)->ranges[filenum][START])

Definition at line 144 of file diff3.c.

Referenced by file1().

#define D_LOW_MAPLINE | ( | diff,
 |  | fromfile,
 |  | tofile,
 |  | lineno | )

Value:

((lineno)                       \
   - D_LOWLINE ((diff), (fromfile))         \
   + D_LOWLINE ((diff), (tofile)))

Definition at line 188 of file diff3.c.

#define D_NEXT ( diff ) ((diff)->next)

Definition at line 172 of file diff3.c.

#define D_NUMLINES | ( | diff,
 |  | filenum | ) | (D_HIGHLINE (diff, filenum) - D_LOWLINE (diff, filenum) + 1)

Definition at line 148 of file diff3.c.

#define D_RELLEN | ( | diff,
 |  | filenum,
 |  | linenum | ) | ((diff)->lengths[filenum][linenum])

Definition at line 158 of file diff3.c.

#define D_RELNUM | ( | diff,
 |  | filenum,
 |  | linenum | ) | ((diff)->lines[filenum][linenum])

Definition at line 156 of file diff3.c.

#define END 1

Definition at line 110 of file diff3.c.

#define FC 1

Definition at line 106 of file diff3.c.

#define FILE0 0

Definition at line 91 of file diff3.c.

#define FILE1 1

Definition at line 92 of file diff3.c.

#define FILE2 2

Definition at line 93 of file diff3.c.

#define FILEC FILE2

Definition at line 99 of file diff3.c.

#define FO 0

Definition at line 105 of file diff3.c.

#define INT_STRLEN_BOUND ( type ) ((sizeof(type)*CHAR_BIT - 1) * 302 / 1000 + 2)

#define READNUM | ( | s,
 |  | num | )

Value:

{ unsigned char c = *s; if (!ISDIGIT (c)) return ERROR; holdnum = 0; \
      do { holdnum = (c - '0' + holdnum * 10); }    \
      while (ISDIGIT (c = *++s)); (num) = holdnum; }

#define SKIPWHITE ( s ) { while (*s == ' ' || *s == '\t') s++; }

#define START 0

Definition at line 109 of file diff3.c.

Enumeration Type Documentation

enum diff_type

Enumeration values:
ERROR
ADD
CHANGE
DELETE
DIFF_ALL
DIFF_1ST
DIFF_2ND
DIFF_3RD

Definition at line 112 of file diff3.c.

00112                {
00113   ERROR,            /* Should not be used */
00114   ADD,              /* Two way diff add */
00115   CHANGE,           /* Two way diff change */
00116   DELETE,           /* Two way diff delete */
00117   DIFF_ALL,         /* All three are different */
00118   DIFF_1ST,         /* Only the first is different */
00119   DIFF_2ND,         /* Only the second */
00120   DIFF_3RD          /* Only the third */
00121 };

Function Documentation

void check_output ( ) [static]

int compare_line_list ( ) [static]

int copy_stringlist ( ) [static]

struct diff3_block* create_diff3_block ( ) [static]

char* cvs_temp_name ( )

Definition at line 695 of file filesubr.c.

Referenced by decode_file().

00696 {
00697     char value[L_tmpnam + 1];
00698     char *retval;
00699
00700     /* FIXME: Does OS/2 have some equivalent to TMPDIR?  */
00701     retval = tmpnam (value);
00702     if (retval == NULL)
00703     error (1, errno, "cannot generate temporary filename");
00704     return xstrdup (retval);
00705 }

void diff3_fatal ( ) [static]

Referenced by file1().

void diff3_perror_with_exit ( ) [static]

Referenced by file1().

int diff3_run | ( | argc | ,
 |  | argv | ,
 |  | out | ,
 |  | callbacks_arg |
 | ) |

void diff_error ( )

int dotlines ( ) [static]

void flush_output ( )

void free_diff3_blocks ( ) [static]

void free_diff_blocks ( ) [static]

void initialize_main ( ) [static]

struct diff3_block* make_3way_diff ( ) [static]

size_t myread ( ) [static]

void output_diff3 ( ) [static]

int output_diff3_edscript ( ) [static]

int output_diff3_merge ( ) [static]

void perror_with_name ( )

void printf_output ( )

struct diff_block* process_diff | ( | filea | ,
 |  | fileb | ,
 |  | last_block | ,
 |  | diff_contents |
 | ) | const [static]

struct diff_block* process_diff ( ) [static]

enum diff_type process_diff_control ( ) [static]

char* read_diff ( ) [static]

struct diff3_block* reverse_diff3_blocklist ( ) [static]

char* scan_diff_line ( ) [static]

int try_help ( ) [static]

void undotlines ( ) [static]

void usage ( void ) [static]

struct diff3_block* using_to_diff3_block ( ) [static]

void write_output ( )

char* xmalloc ( )

char* xrealloc ( )

Variable Documentation

int always_text [static]

Definition at line 202 of file diff3.c.

char** argv

Definition at line 296 of file diff3.c.

char*** argvp

Definition at line 1894 of file diff3.c.

const struct diff_callbacks* callbacks

Definition at line 73 of file diff3.c.

const struct diff_callbacks* callbacks_arg

Definition at line 298 of file diff3.c.

int copynum

Definition at line 975 of file diff3.c.

struct diff_block* db

Definition at line 1214 of file diff3.c.

struct diff3_block* diff

Definition at line 1732 of file diff3.c.

jmp_buf diff3_abort_buf [static]

Definition at line 270 of file diff3.c.

char** diff_contents

Definition at line 1098 of file diff3.c.

char* diff_program_name

Definition at line 234 of file diff3.c.

char const diff_version_string[]

Definition at line 69 of file diff3.c.

int edscript [static]

Definition at line 205 of file diff3.c.

char const * file0

Definition at line 1734 of file diff3.c.

char const * file1

Definition at line 1734 of file diff3.c.

char * file2

Definition at line 588 of file rcscmds.c.

* fileb

Definition at line 1288 of file diff3.c.

int filenum

Definition at line 1545 of file diff3.c.

int finalwrite [static]

Definition at line 229 of file diff3.c.

int flagging [static]

Definition at line 210 of file diff3.c.

size_t const fromlengths[]

Definition at line 973 of file diff3.c.

high0

Definition at line 1001 of file diff3.c.

high1

Definition at line 1001 of file diff3.c.

high2

Definition at line 1001 of file diff3.c.

int high_thread

Definition at line 850 of file diff3.c.

int horizon_lines = 10 [static]

Definition at line 213 of file diff3.c.

struct diff_block** last_block

Definition at line 1097 of file diff3.c.

struct diff3_block const* last_diff3

Definition at line 851 of file diff3.c.

* last_using[2]

Definition at line 848 of file diff3.c.

int leadingchar

Definition at line 1399 of file diff3.c.

size_t const lengths1[]

Definition at line 1071 of file diff3.c.

size_t const lengths2[]

Definition at line 1071 of file diff3.c.

char* limit

Definition at line 1398 of file diff3.c.

* const list2[]

Definition at line 1070 of file diff3.c.

struct option const longopts[] [static]

Initial value:

{
  {"text", 0, 0, 'a'},
  {"show-all", 0, 0, 'A'},
  {"ed", 0, 0, 'e'},
  {"show-overlap", 0, 0, 'E'},
  {"label", 1, 0, 'L'},
  {"merge", 0, 0, 'm'},
  {"initial-tab", 0, 0, 'T'},
  {"overlap-only", 0, 0, 'x'},
  {"easy-only", 0, 0, '3'},
  {"version", 0, 0, 'v'},
  {"help", 0, 0, 129},
  {0, 0, 0, 0}
}

Definition at line 273 of file diff3.c.

low1

Definition at line 1001 of file diff3.c.

low2

Definition at line 1001 of file diff3.c.

int low_thread

Definition at line 850 of file diff3.c.

int const mapping

Definition at line 1733 of file diff3.c.

int merge [static]

Definition at line 232 of file diff3.c.

int nl

Definition at line 1072 of file diff3.c.

num

Definition at line 1573 of file diff3.c.

char* out

Definition at line 297 of file diff3.c.

FILE* outfile

Definition at line 71 of file diff3.c.

char** output_placement

Definition at line 1289 of file diff3.c.

int overlap_only [static]

Definition at line 222 of file diff3.c.

char* ptr

Definition at line 1866 of file diff3.c.

int const rev_mapping

Definition at line 1733 of file diff3.c.

size_t* set_length

Definition at line 1397 of file diff3.c.

** set_start

Definition at line 1396 of file diff3.c.

int show_2nd [static]

Definition at line 225 of file diff3.c.

int simple_only [static]

Definition at line 219 of file diff3.c.

size_t size

Definition at line 1867 of file diff3.c.

start

Definition at line 1573 of file diff3.c.

Referenced by UCvsGraph::CalcImageSize(), and CGraphView::OnBeginPrinting().

int tab_align_flag [static]

Definition at line 216 of file diff3.c.

* thread1

Definition at line 664 of file diff3.c.

size_t tolengths[]

Definition at line 974 of file diff3.c.

char* toptrs[]

Definition at line 972 of file diff3.c.

Generated on Sun Oct 21 12:42:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


diffrun.h File Reference

cvs-1.10/diff/diffrun.h File Reference

#include <sys/types.h>

Include dependency graph for diffrun.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | diff_callbacks

Defines

#define | DIFFPARAMS(args) ()

Functions

int | diff_run ()
int | diff3_run ()

Define Documentation

#define DIFFPARAMS ( args ) ()

Definition at line 29 of file diffrun.h.

Function Documentation

int diff3_run ( )

int diff_run ( )

Generated on Sun Oct 21 12:42:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dir.c File Reference

cvs-1.10/diff/dir.c File Reference

#include "diff.h"

Include dependency graph for dir.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | dirdata

Functions

int | compare_names ()
int | dir_sort ()
int | dir_sort (dir, dirdata) struct file_data const *dir

Variables

dirdata * | dirdata
* file2
int(* | handle_file )()
int | depth

Function Documentation

int compare_names ( ) [static]

int dir_sort | ( | dir | ,
 |  | dirdata |
 | ) | const [static]

int dir_sort ( ) [static]

Referenced by depth().

Variable Documentation

int depth

Definition at line 161 of file dir.c.

struct dirdata* dirdata

Definition at line 41 of file dir.c.

* file2

Definition at line 131 of file dir.c.

int(* handle_file)()

Definition at line 160 of file dir.c.

Generated on Sun Oct 21 12:42:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ed.c File Reference

cvs-1.10/diff/ed.c File Reference

#include "diff.h"

Include dependency graph for ed.c:

Include dependency graph

Go to the source code of this file.

Functions

void | print_ed_hunk ()
void | print_rcs_hunk ()
void | pr_forward_ed_hunk ()
void | print_ed_script (script) struct change *script

Function Documentation

void pr_forward_ed_hunk ( ) [static]

void print_ed_hunk ( ) [static]

void print_ed_script ( script )

void print_rcs_hunk ( ) [static]

Generated on Sun Oct 21 12:42:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ifdef.c File Reference

cvs-1.10/diff/ifdef.c File Reference

#include "diff.h"

Include dependency graph for ifdef.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | group

Functions

char * | format_group ()
char * | scan_char_literal ()
char * | scan_printf_spec ()
int | groups_letter_value ()
void | format_ifdef ()
void | print_ifdef_hunk ()
void | print_ifdef_lines ()
void | print_ifdef_script (script) struct change *script

Variables

int | next_line
int | beg0
int | end0
int | beg1
int | end1
char * | format
int | endchar
group const * | groups
int | letter
group const * | group
int * | intptr

Function Documentation

char* format_group ( ) [static]

Referenced by groups().

void format_ifdef ( ) [static]

int groups_letter_value ( ) [static]

Referenced by groups().

void print_ifdef_hunk ( ) [static]

void print_ifdef_lines ( ) [static]

Referenced by groups().

void print_ifdef_script ( script )

char* scan_char_literal ( ) [static]

Referenced by groups().

char* scan_printf_spec ( ) [static]

Referenced by groups().

Variable Documentation

int beg0

Definition at line 96 of file ifdef.c.

int beg1

Definition at line 96 of file ifdef.c.

int end0

Definition at line 96 of file ifdef.c.

int end1

Definition at line 96 of file ifdef.c.

int endchar

Definition at line 119 of file ifdef.c.

const char * format

Definition at line 124 of file vasprintf.c.

struct group const* group

Definition at line 270 of file ifdef.c.

struct group const* groups

Definition at line 120 of file ifdef.c.

int* intptr

Definition at line 377 of file ifdef.c.

int letter

Definition at line 246 of file ifdef.c.

int next_line [static]

Definition at line 38 of file ifdef.c.

Generated on Sun Oct 21 12:42:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


io.c File Reference

cvs-1.10/diff/io.c File Reference

#include "diff.h"

Include dependency graph for io.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | equivclass

Defines

#define | UINT_BIT (sizeof (unsigned) * CHAR_BIT)
#define | ROL(v, n) ((v) << (n) | (v) >> (UINT_BIT - (n)))
#define | HASH(h, c) ((c) + ROL (h, 7))
#define | GUESS_LINES(n, s, t) (((t) - (s)) / ((n) < 10 ? 32 : (s) / ((n)-1)) + 5)
#define | word int
#define | binary_file_p(buf, size) (memchr (buf, '\0', size) != 0)

Functions

void | find_and_hash_each_line ()
void | find_identical_ends ()
void | prepare_text_end ()
int | sip (current, skip_test) struct file_data *current
int | read_files (filevec, pretend_binary) struct file_data filevec[]

Variables

int * | buckets
int | nbuckets
equivclass * equivs
int | equivs_index
int | equivs_alloc
int | skip_test
int | pretend_binary

Define Documentation

#define GUESS_LINES | ( | n,
 |  | s,
 |  | t | ) | (((t) - (s)) / ((n) < 10 ? 32 : (s) / ((n)-1)) + 5)

Definition at line 29 of file io.c.

#define HASH | ( | h,
 |  | c | ) | ((c) + ROL (h, 7))

Definition at line 25 of file io.c.

#define ROL | ( | v,
 |  | n | ) | ((v) << (n) | (v) >> (UINT_BIT - (n)))

Definition at line 22 of file io.c.

#define UINT_BIT (sizeof (unsigned) * CHAR_BIT)

Definition at line 21 of file io.c.

#define binary_file_p | ( | buf,
 |  | size | ) | (memchr (buf, '\0', size) != 0)

Definition at line 75 of file io.c.

#define word int

Definition at line 33 of file io.c.

Function Documentation

void find_and_hash_each_line ( ) [static]

void find_identical_ends ( ) [static]

void prepare_text_end ( ) [static]

int read_files | ( | filevec | ,
 |  | pretend_binary |
 | ) |

int sip | ( | current | ,
 |  | skip_test |
 | ) |

Variable Documentation

int* buckets [static]

Definition at line 50 of file io.c.

struct equivclass* equivs [static]

Definition at line 58 of file io.c.

int equivs_alloc [static]

Definition at line 64 of file io.c.

int equivs_index [static]

Definition at line 61 of file io.c.

int nbuckets [static]

Definition at line 53 of file io.c.

int pretend_binary

Definition at line 664 of file io.c.

int skip_test

Definition at line 84 of file io.c.

Generated on Sun Oct 21 12:42:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


normal.c File Reference

cvs-1.10/diff/normal.c File Reference

#include "diff.h"

Include dependency graph for normal.c:

Include dependency graph

Go to the source code of this file.

Functions

void | print_normal_hunk ()
void | print_normal_script (script) struct change *script

Function Documentation

void print_normal_hunk ( ) [static]

void print_normal_script ( script )

Generated on Sun Oct 21 12:42:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


side.c File Reference

cvs-1.10/diff/side.c File Reference

#include "diff.h"

Include dependency graph for side.c:

Include dependency graph

Go to the source code of this file.

Functions

unsigned | print_half_line ()
unsigned | tab_from_to ()
void | print_1sdiff_line ()
void | print_sdiff_common_lines ()
void | print_sdiff_hunk ()
void | print_sdiff_script (script) struct change *script

Variables

int | next0
int | next1
to
unsigned | indent
unsigned | out_bound
int | sep
char const *const * | right
limit1

Function Documentation

void print_1sdiff_line ( ) [static]

Referenced by limit1().

unsigned print_half_line ( ) [static]

Referenced by right().

void print_sdiff_common_lines ( ) [static]

void print_sdiff_hunk ( ) [static]

void print_sdiff_script ( script )

unsigned tab_from_to ( ) [static]

Referenced by out_bound().

Variable Documentation

unsigned indent

Definition at line 74 of file side.c.

limit1

Definition at line 221 of file side.c.

int next0 [static]

Definition at line 31 of file side.c.

int next1 [static]

Definition at line 31 of file side.c.

unsigned out_bound

Definition at line 74 of file side.c.

char const* const* right

Definition at line 179 of file side.c.

int sep

Definition at line 178 of file side.c.

const char * to

Definition at line 413 of file filesubr.c.

Generated on Sun Oct 21 12:42:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


system.h File Reference

cvs-1.10/diff/system.h File Reference

#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <ctype.h>
#include <errno.h>

Include dependency graph for system.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | PARAMS(args) ()
#define | VOID char
#define | S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#define | S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#define | SEEK_SET 0
#define | SEEK_CUR 1
#define | STDIN_FILENO 0
#define | STDOUT_FILENO 1
#define | STDERR_FILENO 2
#define | HAVE_TIME_H 1
#define | O_RDONLY 0
#define | WEXITSTATUS(stat_val) ((unsigned) (stat_val) >> 8)
#define | WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#define | STAT_BLOCKSIZE(s) (8 * 1024)
#define | dirent direct
#define | NAMLEN(dirent) ((dirent)->d_namlen)
#define | INT_MAX 2147483647
#define | CHAR_BIT 8
#define | strchr index
#define | strrchr rindex
#define | memcmp(s1, s2, n) bcmp (s1, s2, n)
#define | memcpy(d, s, n) bcopy (s, d, n)
#define | CTYPE_DOMAIN(c) ((unsigned) (c) <= 0177)
#define | ISPRINT(c) (CTYPE_DOMAIN (c) && isprint (c))
#define | ISSPACE(c) (CTYPE_DOMAIN (c) && isspace (c))
#define | ISUPPER(c) (CTYPE_DOMAIN (c) && isupper (c))
#define | ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#define | min(a, b) ((a) <= (b) ? (a) : (b))
#define | max(a, b) ((a) >= (b) ? (a) : (b))
#define | filename_cmp(a, b) strcmp (a, b)
#define | filename_lastdirchar(filename) strrchr (filename, '/')
#define | HAVE_FORK 1
#define | HAVE_SETMODE 0
#define | initialize_main(argcp, argvp)
#define | same_file(s, t) ((s)->st_ino==(t)->st_ino && (s)->st_dev==(t)->st_dev)
#define | SYSTEM_QUOTE_ARG(q, a)
#define | CVS_OPEN open

Functions

char * | malloc ()
char * | realloc ()
char * | getenv ()
char * | index (),*rindex()
void * | memchr ()

Variables

int | errno

Define Documentation

#define CHAR_BIT 8

Definition at line 175 of file system.h.

#define CTYPE_DOMAIN ( c ) ((unsigned) (c) <= 0177)

Definition at line 202 of file system.h.

#define CVS_OPEN open

Definition at line 284 of file system.h.

#define HAVE_FORK 1

Definition at line 244 of file system.h.

#define HAVE_SETMODE 0

Definition at line 248 of file system.h.

#define HAVE_TIME_H 1

Definition at line 99 of file system.h.

#define INT_MAX 2147483647

Definition at line 172 of file system.h.

#define ISDIGIT ( c ) ((unsigned) (c) - '0' <= 9)

Definition at line 215 of file system.h.

Referenced by groups().

#define ISPRINT ( c ) (CTYPE_DOMAIN (c) && isprint (c))

Definition at line 205 of file system.h.

Referenced by out_bound().

#define ISSPACE ( c ) (CTYPE_DOMAIN (c) && isspace (c))

Definition at line 208 of file system.h.

#define ISUPPER ( c ) (CTYPE_DOMAIN (c) && isupper (c))

Definition at line 211 of file system.h.

#define NAMLEN ( dirent ) ((dirent)->d_namlen)

Definition at line 142 of file system.h.

Referenced by dirdata().

#define O_RDONLY 0

Definition at line 116 of file system.h.

#define PARAMS ( args ) ()

Definition at line 42 of file system.h.

#define SEEK_CUR 1

Definition at line 81 of file system.h.

#define SEEK_SET 0

Definition at line 78 of file system.h.

#define STAT_BLOCKSIZE ( s ) (8 * 1024)

Definition at line 133 of file system.h.

#define STDERR_FILENO 2

Definition at line 91 of file system.h.

#define STDIN_FILENO 0

Definition at line 85 of file system.h.

#define STDOUT_FILENO 1

Definition at line 88 of file system.h.

#define SYSTEM_QUOTE_ARG | ( | q,
 |  | a | )

Value:

{ \
    *(q)++ = '\''; \
    for (;  *(a);  *(q)++ = *(a)++) \
      if (*(a) == '\'') \
    { \
      *(q)++ = '\''; \
      *(q)++ = '\\'; \
      *(q)++ = '\''; \
    } \
    *(q)++ = '\''; \
  }

Definition at line 264 of file system.h.

Referenced by depth().

#define S_ISDIR ( mode ) (((mode) & S_IFMT) == S_IFDIR)

Definition at line 55 of file system.h.

Referenced by BuildIgnoredList(), Entries_SetVisited(), FileTraverse(), CWincvsApp::InitInstance(), MakeTmpFile(), CWinCvsBrowser::OnUpdateCmd(), UCvsFolders::OnUpdateGeneric(), CWinCvsBrowser::ResetBrowser(), UCvsFolders::ResetBrowser(), UCvsFolders::SetDefaultRoot(), CHistComboBoxEx::SetIcon(), SettingsGetLoc(), RemoveCvsArgs::addfile(), and getLoc().

#define S_ISREG ( mode ) (((mode) & S_IFMT) == S_IFREG)

Definition at line 58 of file system.h.

Referenced by FileTraverse(), LaunchViewer(), CWincvsApp::LookForResourceFile(), CvsPrefs::WhichCvs(), depth(), launchCVS(), and out().

#define VOID char

Definition at line 43 of file system.h.

#define WEXITSTATUS ( stat_val ) ((unsigned) (stat_val) >> 8)

Definition at line 123 of file system.h.

#define WIFEXITED ( stat_val ) (((stat_val) & 255) == 0)

Definition at line 126 of file system.h.

#define dirent direct

Definition at line 141 of file system.h.

#define filename_cmp | ( | a,
 |  | b | ) | strcmp (a, b)

Definition at line 236 of file system.h.

Referenced by depth().

#define filename_lastdirchar ( filename ) strrchr (filename, '/')

Definition at line 240 of file system.h.

#define initialize_main | ( | argcp,
 |  | argvp | )

Definition at line 252 of file system.h.

#define max | ( | a,
 |  | b | ) | ((a) >= (b) ? (a) : (b))

Definition at line 230 of file system.h.

Referenced by CCJListView::AutoSizeColumn(), CCJListCtrl::AutoSizeColumn(), CCJDockBar::CalcFixedLayout(), CCJToolBar::CalcLayout(), CCJToolBar::CalcSize(), CWinLogRevData::GetBoundsSelf(), CCJHexEdit::OnKeyDown(), CBrowseFileView::OnPrint(), CCJColorPicker::SetWindowSize(), dirdata(), and part().

#define memcmp | ( | s1,
 |  | s2,
 |  | n | ) | bcmp (s1, s2, n)

Definition at line 190 of file system.h.

Referenced by CCJToolBar::SetButton(), CCJToolBar::SetButtonInfo(), convert_hqx_file(), copynum(), depth(), CRevNumber::ischildof(), CRevNumber::ispartof(), CRevNumber::issamebranch(), CRevNumber::issubbranchof(), len(), CRevNumber::operator==(), sCompatProc(), and simple_diff().

#define memcpy | ( | d,
 |  | s,
 |  | n | ) | bcopy (s, d, n)

Definition at line 191 of file system.h.

Referenced by CCJHtmlView::BeforeNavigate2(), CBrowseFileView::DoDrag(), Entries_SetVisited(), CMMenuString::GetData(), CCJHexEdit::GetData(), TMPersistent::GetData(), TMString::GetData(), CCJMonthCalCtrl::GetMonthRange(), CCJMonthCalCtrl::GetRange(), CCJMonthCalCtrl::GetSelRange(), CCJMenu::LoadMenu(), MakeOleVariant(), CCJHexEdit::OnEditCopy(), CCJHexEdit::OnEditPaste(), CCJHexEdit::SelDelete(), CCJHexEdit::SelInsert(), CCJToolBar::SetButtonInfo(), CWinPlacement::SetData(), CCJHexEdit::SetData(), CPersistentT::SetData(), PMacBinMaps::SetData(), CCJMonthCalCtrl::SetRange(), CCJMonthCalCtrl::SetSelRange(), _LoadSysColorBitmap(), CBuffer::append(), convert_iso(), CTCLCvsConsole::cvs_out(), cvs_process_write(), decodeFileDates(), decodeFinderInfo(), decodeMacInfo(), decodeRealName(), dirdata(), encodeAppleSingle(), glue_getenv(), gp_console_write(), jmpbuf(), len(), opendir(), UStr::operator<<(), UPStr::operator<<(), CLogStr::operator<<(), CWinPlacement::operator=(), UStr::operator=(), UPStr::operator=(), p2cstrcpy(), rcmd(), reduceString(), CvsString::resize(), resolve_address(), UStr::set(), UPStr::set(), CLogStr::set(), and unmodified().

#define min | ( | a,
 |  | b | ) | ((a) <= (b) ? (a) : (b))

Definition at line 229 of file system.h.

Referenced by CCJHexEdit::GetData(), CHistComboBoxEx::OnDropdown(), and part().

#define same_file | ( | s,
 |  | t | ) | ((s)->st_ino==(t)->st_ino && (s)->st_dev==(t)->st_dev)

Definition at line 257 of file system.h.

#define strchr index

Definition at line 185 of file system.h.

Referenced by CompatGetEditorMsg(), CvsCmdImportModule(), CvsFilenames::CvsFilenames(), CTcl_Interp::Deunixfy(), UCvsFiles::EditSel(), FileTraverse(), GetEnvValue(), CWinCvsBrowser::GetItemByLocation(), UCvsFolders::GetItemByLocation(), GetMenuTitle(), InFilter(), LaunchDiff(), LaunchEditor(), LaunchViewer(), CMainFrame::OnDropFiles(), UToolbar::OnTbButton(), UToolbar::OnTbCheckBtn(), TPseudoRotateIconButton::ReadFields(), UPseudoRotButton::ReadIconsID(), UCmdUI::SetTooltip(), SplitPath(), CWinCvsBrowser::StepToLocation(), UCvsFolders::StepToLocation(), Tag_Open(), TestValidName(), UPseudoPageHider::UPseudoPageHider(), UPseudoPlaceHolder::UPseudoPlaceHolder(), CTcl_Interp::Unixfy(), argstring(), expandLF(), fgetentent(), fillSemiColonTypes(), CvsFilenames::getOptionsAndFilename(), glue_getenv(), list_add_type(), loadSettingsInternal(), macos_fixpath(), nextLine(), Authen::parse_cvsroot(), CvsArgs::print(), revcmp(), KoRevisionColumn::revcmp(), sawdir(), and Authen::skiptoken().

#define strrchr rindex

Definition at line 186 of file system.h.

Referenced by GetExtension(), default_branch(), findTcl(), and vers().

Function Documentation

char* getenv ( )

char* index ( )

char* malloc ( )

void* memchr ( )

char* realloc ( )

Variable Documentation

int errno

Definition at line 220 of file system.h.

Generated on Sun Oct 21 12:42:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/system.h Source File

cvs-1.10/diff/system.h

Go to the documentation of this file.
00001 /* System dependent declarations.
00002    Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018 /* We must define `volatile' and `const' first (the latter inside config.h),
00019    so that they're used consistently in all system includes.  */
00020 #if !__STDC__
00021 #ifndef volatile
00022 #define volatile
00023 #endif
00024 #endif
00025 #include <config.h>
00026
00027 #include <sys/types.h>
00028 #include <sys/stat.h>
00029
00030 /* Note that PARAMS is just internal to the diff library; diffrun.h
00031    has its own mechanism, which will hopefully be less likely to
00032    conflict with the library's caller's namespace.  */
00033
00034 #ifdef WIN32
00035 #include <io.h>
00036 #endif
00037
00038 #if __STDC__
00039 #define PARAMS(args) args
00040 #define VOID void
00041 #else
00042 #define PARAMS(args) ()
00043 #define VOID char
00044 #endif
00045
00046 #if STAT_MACROS_BROKEN
00047 #undef S_ISBLK
00048 #undef S_ISCHR
00049 #undef S_ISDIR
00050 #undef S_ISFIFO
00051 #undef S_ISREG
00052 #undef S_ISSOCK
00053 #endif
00054 #ifndef S_ISDIR
00055 #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
00056 #endif
00057 #ifndef S_ISREG
00058 #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
00059 #endif
00060 #if !defined(S_ISBLK) && defined(S_IFBLK)
00061 #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
00062 #endif
00063 #if !defined(S_ISCHR) && defined(S_IFCHR)
00064 #define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
00065 #endif
00066 #if !defined(S_ISFIFO) && defined(S_IFFIFO)
00067 #define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO)
00068 #endif
00069 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
00070 #define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
00071 #endif
00072
00073 #if HAVE_UNISTD_H
00074 #include <unistd.h>
00075 #endif
00076
00077 #ifndef SEEK_SET
00078 #define SEEK_SET 0
00079 #endif
00080 #ifndef SEEK_CUR
00081 #define SEEK_CUR 1
00082 #endif
00083
00084 #ifndef STDIN_FILENO
00085 #define STDIN_FILENO 0
00086 #endif
00087 #ifndef STDOUT_FILENO
00088 #define STDOUT_FILENO 1
00089 #endif
00090 #ifndef STDERR_FILENO
00091 #define STDERR_FILENO 2
00092 #endif
00093
00094 /* I believe that all relevant systems have
00095    time.h.  It is in ANSI, for example.  The
00096    code below looks quite bogus as I don't think
00097    sys/time.h is ever a substitute for time.h;
00098    it is something different.  */
00099 #define HAVE_TIME_H 1
00100
00101 #if HAVE_TIME_H
00102 #include <time.h>
00103 #else
00104 #include <sys/time.h>
00105 #endif
00106
00107 #if HAVE_FCNTL_H
00108 #include <fcntl.h>
00109 #else
00110 #if HAVE_SYS_FILE_H
00111 #include <sys/file.h>
00112 #endif
00113 #endif
00114
00115 #ifndef O_RDONLY
00116 #define O_RDONLY 0
00117 #endif
00118
00119 #if HAVE_SYS_WAIT_H
00120 #include <sys/wait.h>
00121 #endif
00122 #ifndef WEXITSTATUS
00123 #define WEXITSTATUS(stat_val) ((unsigned) (stat_val) >> 8)
00124 #endif
00125 #ifndef WIFEXITED
00126 #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
00127 #endif
00128
00129 #ifndef STAT_BLOCKSIZE
00130 #if HAVE_ST_BLKSIZE
00131 #define STAT_BLOCKSIZE(s) (s).st_blksize
00132 #else
00133 #define STAT_BLOCKSIZE(s) (8 * 1024)
00134 #endif
00135 #endif
00136
00137 #if HAVE_DIRENT_H
00138 # include <dirent.h>
00139 # define NAMLEN(dirent) strlen((dirent)->d_name)
00140 #else
00141 # define dirent direct
00142 # define NAMLEN(dirent) ((dirent)->d_namlen)
00143 # if HAVE_SYS_NDIR_H
00144 #  include <sys/ndir.h>
00145 # endif
00146 # if HAVE_SYS_DIR_H
00147 #  include <sys/dir.h>
00148 # endif
00149 # if HAVE_NDIR_H
00150 #  include <ndir.h>
00151 # endif
00152 #endif
00153
00154 #if HAVE_VFORK_H
00155 #include <vfork.h>
00156 #endif
00157
00158 #if HAVE_STDLIB_H || defined(STDC_HEADERS)
00159 #include <stdlib.h>
00160 #else
00161 VOID *malloc ();
00162 VOID *realloc ();
00163 #endif
00164 #ifndef getenv
00165 char *getenv ();
00166 #endif
00167
00168 #if HAVE_LIMITS_H
00169 #include <limits.h>
00170 #endif
00171 #ifndef INT_MAX
00172 #define INT_MAX 2147483647
00173 #endif
00174 #ifndef CHAR_BIT
00175 #define CHAR_BIT 8
00176 #endif
00177
00178 #if STDC_HEADERS || HAVE_STRING_H
00179 # include <string.h>
00180 # ifndef bzero
00181 #  define bzero(s, n) memset (s, 0, n)
00182 # endif
00183 #else
00184 # if !HAVE_STRCHR
00185 #  define strchr index
00186 #  define strrchr rindex
00187 # endif
00188 char *strchr (), *strrchr ();
00189 # if !HAVE_MEMCHR
00190 #  define memcmp(s1, s2, n) bcmp (s1, s2, n)
00191 #  define memcpy(d, s, n) bcopy (s, d, n)
00192 void *memchr ();
00193 # endif
00194 #endif
00195
00196 #include <ctype.h>
00197 /* CTYPE_DOMAIN (C) is nonzero if the unsigned char C can safely be given
00198    as an argument to <ctype.h> macros like `isspace'.  */
00199 #if STDC_HEADERS
00200 #define CTYPE_DOMAIN(c) 1
00201 #else
00202 #define CTYPE_DOMAIN(c) ((unsigned) (c) <= 0177)
00203 #endif
00204 #ifndef ISPRINT
00205 #define ISPRINT(c) (CTYPE_DOMAIN (c) && isprint (c))
00206 #endif
00207 #ifndef ISSPACE
00208 #define ISSPACE(c) (CTYPE_DOMAIN (c) && isspace (c))
00209 #endif
00210 #ifndef ISUPPER
00211 #define ISUPPER(c) (CTYPE_DOMAIN (c) && isupper (c))
00212 #endif
00213
00214 #ifndef ISDIGIT
00215 #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
00216 #endif
00217
00218 #include <errno.h>
00219 #if !STDC_HEADERS
00220 extern int errno;
00221 #endif
00222
00223 #ifdef min
00224 #undef min
00225 #endif
00226 #ifdef max
00227 #undef max
00228 #endif
00229 #define min(a,b) ((a) <= (b) ? (a) : (b))
00230 #define max(a,b) ((a) >= (b) ? (a) : (b))
00231
00232 /* This section contains Posix-compliant defaults for macros
00233    that are meant to be overridden by hand in config.h as needed.  */
00234
00235 #ifndef filename_cmp
00236 #define filename_cmp(a, b) strcmp (a, b)
00237 #endif
00238
00239 #ifndef filename_lastdirchar
00240 #define filename_lastdirchar(filename) strrchr (filename, '/')
00241 #endif
00242
00243 #ifndef HAVE_FORK
00244 #define HAVE_FORK 1
00245 #endif
00246
00247 #ifndef HAVE_SETMODE
00248 #define HAVE_SETMODE 0
00249 #endif
00250
00251 #ifndef initialize_main
00252 #define initialize_main(argcp, argvp)
00253 #endif
00254
00255 /* Do struct stat *S, *T describe the same file?  Answer -1 if unknown.  */
00256 #ifndef same_file
00257 #define same_file(s,t) ((s)->st_ino==(t)->st_ino && (s)->st_dev==(t)->st_dev)
00258 #endif
00259
00260 /* Place into Q a quoted version of A suitable for `popen' or `system',
00261    incrementing Q and junking A.
00262    Do not increment Q by more than 4 * strlen (A) + 2.  */
00263 #ifndef SYSTEM_QUOTE_ARG
00264 #define SYSTEM_QUOTE_ARG(q, a) \
00265   { \
00266     *(q)++ = '\''; \
00267     for (;  *(a);  *(q)++ = *(a)++) \
00268       if (*(a) == '\'') \
00269     { \
00270       *(q)++ = '\''; \
00271       *(q)++ = '\\'; \
00272       *(q)++ = '\''; \
00273     } \
00274     *(q)++ = '\''; \
00275   }
00276 #endif
00277
00278 /* Under non-UNIX operating systems (MS-DOS, WinNT, MacOS), many filesystem
00279    calls take  only one argument; permission is handled very differently on
00280    those systems than in Unix.  So we leave such systems a hook on which they
00281    can hang their own definitions.  */
00282
00283 #ifndef CVS_OPEN
00284 #define CVS_OPEN open
00285 #endif
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/util.c Source File

cvs-1.10/diff/util.c

Go to the documentation of this file.
00001 /* Support routines for GNU DIFF.
00002    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015
00016 */
00017
00018 #include "diff.h"
00019
00020 #if __STDC__
00021 #include <stdarg.h>
00022 #else
00023 #include <varargs.h>
00024 #endif
00025
00026 #ifndef strerror
00027 extern char *strerror ();
00028 #endif
00029
00030 /* Queue up one-line messages to be printed at the end,
00031    when -l is specified.  Each message is recorded with a `struct msg'.  */
00032
00033 struct msg
00034 {
00035   struct msg *next;
00036   char const *format;
00037   char const *arg1;
00038   char const *arg2;
00039   char const *arg3;
00040   char const *arg4;
00041 };
00042
00043 /* Head of the chain of queues messages.  */
00044
00045 static struct msg *msg_chain;
00046
00047 /* Tail of the chain of queues messages.  */
00048
00049 static struct msg **msg_chain_end = &msg_chain;
00050
00051 /* Use when a system call returns non-zero status.
00052    TEXT should normally be the file name.  */
00053
00054 void
00055 perror_with_name (text)
00056      char const *text;
00057 {
00058   int e = errno;
00059
00060   if (callbacks && callbacks->error)
00061     (*callbacks->error) ("%s: %s", text, strerror (e));
00062   else
00063     {
00064       fprintf (stderr, "%s: ", diff_program_name);
00065       errno = e;
00066       perror (text);
00067     }
00068 }
00069
00070 /* Use when a system call returns non-zero status and that is fatal.  */
00071
00072 void
00073 pfatal_with_name (text)
00074      char const *text;
00075 {
00076   int e = errno;
00077   print_message_queue ();
00078   if (callbacks && callbacks->error)
00079     (*callbacks->error) ("%s: %s", text, strerror (e));
00080   else
00081     {
00082       fprintf (stderr, "%s: ", diff_program_name);
00083       errno = e;
00084       perror (text);
00085     }
00086   DIFF_ABORT (2);
00087 }
00088
00089 /* Print an error message from the format-string FORMAT
00090    with args ARG1 and ARG2.  */
00091
00092 void
00093 diff_error (format, arg, arg1)
00094      char const *format, *arg, *arg1;
00095 {
00096   if (callbacks && callbacks->error)
00097     (*callbacks->error) (format, arg, arg1);
00098   else
00099     {
00100       fprintf (stderr, "%s: ", diff_program_name);
00101       fprintf (stderr, format, arg, arg1);
00102       fprintf (stderr, "\n");
00103     }
00104 }
00105
00106 /* Print an error message containing the string TEXT, then exit.  */
00107
00108 void
00109 fatal (m)
00110      char const *m;
00111 {
00112   print_message_queue ();
00113   diff_error ("%s", m, 0);
00114   DIFF_ABORT (2);
00115 }
00116
00117 /* Like printf, except if -l in effect then save the message and print later.
00118    This is used for things like "binary files differ" and "Only in ...".  */
00119
00120 void
00121 message (format, arg1, arg2)
00122      char const *format, *arg1, *arg2;
00123 {
00124   message5 (format, arg1, arg2, 0, 0);
00125 }
00126
00127 void
00128 message5 (format, arg1, arg2, arg3, arg4)
00129      char const *format, *arg1, *arg2, *arg3, *arg4;
00130 {
00131   if (paginate_flag)
00132     {
00133       struct msg *new = (struct msg *) xmalloc (sizeof (struct msg));
00134       new->format = format;
00135       new->arg1 = concat (arg1, "", "");
00136       new->arg2 = concat (arg2, "", "");
00137       new->arg3 = arg3 ? concat (arg3, "", "") : 0;
00138       new->arg4 = arg4 ? concat (arg4, "", "") : 0;
00139       new->next = 0;
00140       *msg_chain_end = new;
00141       msg_chain_end = &new->next;
00142     }
00143   else
00144     {
00145       if (sdiff_help_sdiff)
00146     write_output (" ", 1);
00147       printf_output (format, arg1, arg2, arg3, arg4);
00148     }
00149 }
00150
00151 /* Output all the messages that were saved up by calls to `message'.  */
00152
00153 void
00154 print_message_queue ()
00155 {
00156   struct msg *m;
00157
00158   for (m = msg_chain; m; m = m->next)
00159     printf_output (m->format, m->arg1, m->arg2, m->arg3, m->arg4);
00160 }
00161
00162 /* Call before outputting the results of comparing files NAME0 and NAME1
00163    to set up OUTFILE, the stdio stream for the output to go to.
00164
00165    Usually, OUTFILE is just stdout.  But when -l was specified
00166    we fork off a `pr' and make OUTFILE a pipe to it.
00167    `pr' then outputs to our stdout.  */
00168
00169 static char const *current_name0;
00170 static char const *current_name1;
00171 static int current_depth;
00172
00173 static int output_in_progress = 0;
00174
00175 void
00176 setup_output (name0, name1, depth)
00177      char const *name0, *name1;
00178      int depth;
00179 {
00180   current_name0 = name0;
00181   current_name1 = name1;
00182   current_depth = depth;
00183 }
00184
00185 #if HAVE_FORK && defined (PR_PROGRAM)
00186 static pid_t pr_pid;
00187 #endif
00188
00189 void
00190 begin_output ()
00191 {
00192   char *name;
00193
00194   if (output_in_progress)
00195     return;
00196   output_in_progress = 1;
00197
00198   /* Construct the header of this piece of diff.  */
00199   name = xmalloc (strlen (current_name0) + strlen (current_name1)
00200           + strlen (switch_string) + 7);
00201   /* Posix.2 section 4.17.6.1.1 specifies this format.  But there is a
00202      bug in the first printing (IEEE Std 1003.2-1992 p 251 l 3304):
00203      it says that we must print only the last component of the pathnames.
00204      This requirement is silly and does not match historical practice.  */
00205   sprintf (name, "diff%s %s %s", switch_string, current_name0, current_name1);
00206
00207   if (paginate_flag && callbacks && callbacks->write_output)
00208     fatal ("can't paginate when using library callbacks");
00209
00210   if (paginate_flag)
00211     {
00212       /* Make OUTFILE a pipe to a subsidiary `pr'.  */
00213
00214 #ifdef PR_PROGRAM
00215
00216 # if HAVE_FORK
00217       int pipes[2];
00218
00219       if (pipe (pipes) != 0)
00220     pfatal_with_name ("pipe");
00221
00222       fflush (stdout);
00223
00224       pr_pid = vfork ();
00225       if (pr_pid < 0)
00226     pfatal_with_name ("vfork");
00227
00228       if (pr_pid == 0)
00229     {
00230       close (pipes[1]);
00231       if (pipes[0] != STDIN_FILENO)
00232         {
00233           if (dup2 (pipes[0], STDIN_FILENO) < 0)
00234         pfatal_with_name ("dup2");
00235           close (pipes[0]);
00236         }
00237
00238       execl (PR_PROGRAM, PR_PROGRAM, "-f", "-h", name, 0);
00239       pfatal_with_name (PR_PROGRAM);
00240     }
00241       else
00242     {
00243       close (pipes[0]);
00244       outfile = fdopen (pipes[1], "w");
00245       if (!outfile)
00246         pfatal_with_name ("fdopen");
00247     }
00248 # else /* ! HAVE_FORK */
00249       char *command = xmalloc (4 * strlen (name) + strlen (PR_PROGRAM) + 10);
00250       char *p;
00251       char const *a = name;
00252       sprintf (command, "%s -f -h ", PR_PROGRAM);
00253       p = command + strlen (command);
00254       SYSTEM_QUOTE_ARG (p, a);
00255       *p = 0;
00256       outfile = popen (command, "w");
00257       if (!outfile)
00258     pfatal_with_name (command);
00259       free (command);
00260 # endif /* ! HAVE_FORK */
00261 #else
00262       fatal ("This port does not support the --paginate option to diff.");
00263 #endif
00264     }
00265   else
00266     {
00267
00268       /* If -l was not specified, output the diff straight to `stdout'.  */
00269
00270       /* If handling multiple files (because scanning a directory),
00271      print which files the following output is about.  */
00272       if (current_depth > 0)
00273     printf_output ("%s\n", name);
00274     }
00275
00276   free (name);
00277
00278   /* A special header is needed at the beginning of context output.  */
00279   switch (output_style)
00280     {
00281     case OUTPUT_CONTEXT:
00282       print_context_header (files, 0);
00283       break;
00284
00285     case OUTPUT_UNIFIED:
00286       print_context_header (files, 1);
00287       break;
00288
00289     default:
00290       break;
00291     }
00292 }
00293
00294 /* Call after the end of output of diffs for one file.
00295    If -l was given, close OUTFILE and get rid of the `pr' subfork.  */
00296
00297 void
00298 finish_output ()
00299 {
00300   if (paginate_flag && outfile != 0 && outfile != stdout)
00301     {
00302 #ifdef PR_PROGRAM
00303       int wstatus;
00304       if (ferror (outfile))
00305     fatal ("write error");
00306 # if ! HAVE_FORK
00307       wstatus = pclose (outfile);
00308 # else /* HAVE_FORK */
00309       if (fclose (outfile) != 0)
00310     pfatal_with_name ("write error");
00311       if (waitpid (pr_pid, &wstatus, 0) < 0)
00312     pfatal_with_name ("waitpid");
00313 # endif /* HAVE_FORK */
00314       if (wstatus != 0)
00315     fatal ("subsidiary pr failed");
00316 #else
00317       fatal ("internal error in finish_output");
00318 #endif
00319     }
00320
00321   output_in_progress = 0;
00322 }
00323
00324 /* Write something to the output file.  */
00325
00326 void
00327 write_output (text, len)
00328      char const *text;
00329      size_t len;
00330 {
00331   if (callbacks && callbacks->write_output)
00332     (*callbacks->write_output) (text, len);
00333   else if (len == 1)
00334     putc (*text, outfile);
00335   else
00336     fwrite (text, sizeof (char), len, outfile);
00337 }
00338
00339 /* Printf something to the output file.  */
00340
00341 #if __STDC__
00342 #define VA_START(args, lastarg) va_start(args, lastarg)
00343 #else /* ! __STDC__ */
00344 #define VA_START(args, lastarg) va_start(args)
00345 #endif /* __STDC__ */
00346
00347 void
00348 #if __STDC__
00349 printf_output (const char *format, ...)
00350 #else
00351 printf_output (format, va_alist)
00352      char const *format;
00353      va_dcl
00354 #endif
00355 {
00356   va_list args;
00357
00358   VA_START (args, format);
00359   if (callbacks && callbacks->write_output)
00360     {
00361       /* We implement our own limited printf-like functionality (%s, %d,
00362      and %c only).  Callers who want something fancier can use
00363      sprintf.  */
00364       const char *p = format;
00365       char *q;
00366       char *str;
00367       int num;
00368       int ch;
00369       char buf[100];
00370
00371       while ((q = strchr (p, '%')) != NULL)
00372     {
00373       static const char msg[] =
00374         "\ninternal error: bad % in printf_output\n";
00375       (*callbacks->write_output) (p, q - p);
00376
00377       switch (q[1])
00378         {
00379         case 's':
00380           str = va_arg (args, char *);
00381           (*callbacks->write_output) (str, strlen (str));
00382           break;
00383         case 'd':
00384           num = va_arg (args, int);
00385           sprintf (buf, "%d", num);
00386           (*callbacks->write_output) (buf, strlen (buf));
00387           break;
00388         case 'c':
00389           ch = va_arg (args, int);
00390           buf[0] = ch;
00391           (*callbacks->write_output) (buf, 1);
00392           break;
00393         default:
00394           (*callbacks->write_output) (msg, sizeof (msg) - 1);
00395           /* Don't just keep going, because q + 1 might point to the
00396          terminating '\0'.  */
00397           goto out;
00398         }
00399       p = q + 2;
00400     }
00401       (*callbacks->write_output) (p, strlen (p));
00402     }
00403   else
00404     vfprintf (outfile, format, args);
00405  out:
00406   va_end (args);
00407 }
00408
00409 /* Flush the output file.  */
00410
00411 void
00412 flush_output ()
00413 {
00414   if (callbacks && callbacks->flush_output)
00415     (*callbacks->flush_output) ();
00416   else
00417     fflush (outfile);
00418 }
00419
00420 /* Compare two lines (typically one from each input file)
00421    according to the command line options.
00422    For efficiency, this is invoked only when the lines do not match exactly
00423    but an option like -i might cause us to ignore the difference.
00424    Return nonzero if the lines differ.  */
00425
00426 int
00427 line_cmp (s1, s2)
00428      char const *s1, *s2;
00429 {
00430   register unsigned char const *t1 = (unsigned char const *) s1;
00431   register unsigned char const *t2 = (unsigned char const *) s2;
00432
00433   while (1)
00434     {
00435       register unsigned char c1 = *t1++;
00436       register unsigned char c2 = *t2++;
00437
00438       /* Test for exact char equality first, since it's a common case.  */
00439       if (c1 != c2)
00440     {
00441       /* Ignore horizontal white space if -b or -w is specified.  */
00442
00443       if (ignore_all_space_flag)
00444         {
00445           /* For -w, just skip past any white space.  */
00446           while (ISSPACE (c1) && c1 != '\n') c1 = *t1++;
00447           while (ISSPACE (c2) && c2 != '\n') c2 = *t2++;
00448         }
00449       else if (ignore_space_change_flag)
00450         {
00451           /* For -b, advance past any sequence of white space in line 1
00452          and consider it just one Space, or nothing at all
00453          if it is at the end of the line.  */
00454           if (ISSPACE (c1))
00455         {
00456           while (c1 != '\n')
00457             {
00458               c1 = *t1++;
00459               if (! ISSPACE (c1))
00460             {
00461               --t1;
00462               c1 = ' ';
00463               break;
00464             }
00465             }
00466         }
00467
00468           /* Likewise for line 2.  */
00469           if (ISSPACE (c2))
00470         {
00471           while (c2 != '\n')
00472             {
00473               c2 = *t2++;
00474               if (! ISSPACE (c2))
00475             {
00476               --t2;
00477               c2 = ' ';
00478               break;
00479             }
00480             }
00481         }
00482
00483           if (c1 != c2)
00484         {
00485           /* If we went too far when doing the simple test
00486              for equality, go back to the first non-white-space
00487              character in both sides and try again.  */
00488           if (c2 == ' ' && c1 != '\n'
00489               && (unsigned char const *) s1 + 1 < t1
00490               && ISSPACE(t1[-2]))
00491             {
00492               --t1;
00493               continue;
00494             }
00495           if (c1 == ' ' && c2 != '\n'
00496               && (unsigned char const *) s2 + 1 < t2
00497               && ISSPACE(t2[-2]))
00498             {
00499               --t2;
00500               continue;
00501             }
00502         }
00503         }
00504
00505       /* Lowercase all letters if -i is specified.  */
00506
00507       if (ignore_case_flag)
00508         {
00509           if (ISUPPER (c1))
00510         c1 = tolower (c1);
00511           if (ISUPPER (c2))
00512         c2 = tolower (c2);
00513         }
00514
00515       if (c1 != c2)
00516         break;
00517     }
00518       if (c1 == '\n')
00519     return 0;
00520     }
00521
00522   return (1);
00523 }
00524
00525 /* Find the consecutive changes at the start of the script START.
00526    Return the last link before the first gap.  */
00527
00528 struct change *
00529 find_change (start)
00530      struct change *start;
00531 {
00532   return start;
00533 }
00534
00535 struct change *
00536 find_reverse_change (start)
00537      struct change *start;
00538 {
00539   return start;
00540 }
00541
00542 /* Divide SCRIPT into pieces by calling HUNKFUN and
00543    print each piece with PRINTFUN.
00544    Both functions take one arg, an edit script.
00545
00546    HUNKFUN is called with the tail of the script
00547    and returns the last link that belongs together with the start
00548    of the tail.
00549
00550    PRINTFUN takes a subscript which belongs together (with a null
00551    link at the end) and prints it.  */
00552
00553 void
00554 print_script (script, hunkfun, printfun)
00555      struct change *script;
00556      struct change * (*hunkfun) PARAMS((struct change *));
00557      void (*printfun) PARAMS((struct change *));
00558 {
00559   struct change *next = script;
00560
00561   while (next)
00562     {
00563       struct change *this, *end;
00564
00565       /* Find a set of changes that belong together.  */
00566       this = next;
00567       end = (*hunkfun) (next);
00568
00569       /* Disconnect them from the rest of the changes,
00570      making them a hunk, and remember the rest for next iteration.  */
00571       next = end->link;
00572       end->link = 0;
00573 #ifdef DEBUG
00574       debug_script (this);
00575 #endif
00576
00577       /* Print this hunk.  */
00578       (*printfun) (this);
00579
00580       /* Reconnect the script so it will all be freed properly.  */
00581       end->link = next;
00582     }
00583 }
00584
00585 /* Print the text of a single line LINE,
00586    flagging it with the characters in LINE_FLAG (which say whether
00587    the line is inserted, deleted, changed, etc.).  */
00588
00589 void
00590 print_1_line (line_flag, line)
00591      char const *line_flag;
00592      char const * const *line;
00593 {
00594   char const *text = line[0], *limit = line[1]; /* Help the compiler.  */
00595   char const *flag_format = 0;
00596
00597   /* If -T was specified, use a Tab between the line-flag and the text.
00598      Otherwise use a Space (as Unix diff does).
00599      Print neither space nor tab if line-flags are empty.  */
00600
00601   if (line_flag && *line_flag)
00602     {
00603       flag_format = tab_align_flag ? "%s\t" : "%s ";
00604       printf_output (flag_format, line_flag);
00605     }
00606
00607   output_1_line (text, limit, flag_format, line_flag);
00608
00609   if ((!line_flag || line_flag[0]) && limit[-1] != '\n')
00610     printf_output ("\n\\ No newline at end of file\n");
00611 }
00612
00613 /* Output a line from TEXT up to LIMIT.  Without -t, output verbatim.
00614    With -t, expand white space characters to spaces, and if FLAG_FORMAT
00615    is nonzero, output it with argument LINE_FLAG after every
00616    internal carriage return, so that tab stops continue to line up.  */
00617
00618 void
00619 output_1_line (text, limit, flag_format, line_flag)
00620      char const *text, *limit, *flag_format, *line_flag;
00621 {
00622   if (!tab_expand_flag)
00623     write_output (text, limit - text);
00624   else
00625     {
00626       register unsigned char c;
00627       register char const *t = text;
00628       register unsigned column = 0;
00629       /* CC is used to avoid taking the address of the register
00630          variable C.  */
00631       char cc;
00632
00633       while (t < limit)
00634     switch ((c = *t++))
00635       {
00636       case '\t':
00637         {
00638           unsigned spaces = TAB_WIDTH - column % TAB_WIDTH;
00639           column += spaces;
00640           do
00641         write_output (" ", 1);
00642           while (--spaces);
00643         }
00644         break;
00645
00646       case '\r':
00647         write_output ("\r", 1);
00648         if (flag_format && t < limit && *t != '\n')
00649           printf_output (flag_format, line_flag);
00650         column = 0;
00651         break;
00652
00653       case '\b':
00654         if (column == 0)
00655           continue;
00656         column--;
00657         write_output ("\b", 1);
00658         break;
00659
00660       default:
00661         if (ISPRINT (c))
00662           column++;
00663         cc = c;
00664         write_output (&cc, 1);
00665         break;
00666       }
00667     }
00668 }
00669
00670 int
00671 change_letter (inserts, deletes)
00672      int inserts, deletes;
00673 {
00674   if (!inserts)
00675     return 'd';
00676   else if (!deletes)
00677     return 'a';
00678   else
00679     return 'c';
00680 }
00681
00682 /* Translate an internal line number (an index into diff's table of lines)
00683    into an actual line number in the input file.
00684    The internal line number is LNUM.  FILE points to the data on the file.
00685
00686    Internal line numbers count from 0 starting after the prefix.
00687    Actual line numbers count from 1 within the entire file.  */
00688
00689 int
00690 translate_line_number (file, lnum)
00691      struct file_data const *file;
00692      int lnum;
00693 {
00694   return lnum + file->prefix_lines + 1;
00695 }
00696
00697 void
00698 translate_range (file, a, b, aptr, bptr)
00699      struct file_data const *file;
00700      int a, b;
00701      int *aptr, *bptr;
00702 {
00703   *aptr = translate_line_number (file, a - 1) + 1;
00704   *bptr = translate_line_number (file, b + 1) - 1;
00705 }
00706
00707 /* Print a pair of line numbers with SEPCHAR, translated for file FILE.
00708    If the two numbers are identical, print just one number.
00709
00710    Args A and B are internal line numbers.
00711    We print the translated (real) line numbers.  */
00712
00713 void
00714 print_number_range (sepchar, file, a, b)
00715      int sepchar;
00716      struct file_data *file;
00717      int a, b;
00718 {
00719   int trans_a, trans_b;
00720   translate_range (file, a, b, &trans_a, &trans_b);
00721
00722   /* Note: we can have B < A in the case of a range of no lines.
00723      In this case, we should print the line number before the range,
00724      which is B.  */
00725   if (trans_b > trans_a)
00726     printf_output ("%d%c%d", trans_a, sepchar, trans_b);
00727   else
00728     printf_output ("%d", trans_b);
00729 }
00730
00731 /* Look at a hunk of edit script and report the range of lines in each file
00732    that it applies to.  HUNK is the start of the hunk, which is a chain
00733    of `struct change'.  The first and last line numbers of file 0 are stored in
00734    *FIRST0 and *LAST0, and likewise for file 1 in *FIRST1 and *LAST1.
00735    Note that these are internal line numbers that count from 0.
00736
00737    If no lines from file 0 are deleted, then FIRST0 is LAST0+1.
00738
00739    Also set *DELETES nonzero if any lines of file 0 are deleted
00740    and set *INSERTS nonzero if any lines of file 1 are inserted.
00741    If only ignorable lines are inserted or deleted, both are
00742    set to 0.  */
00743
00744 void
00745 analyze_hunk (hunk, first0, last0, first1, last1, deletes, inserts)
00746      struct change *hunk;
00747      int *first0, *last0, *first1, *last1;
00748      int *deletes, *inserts;
00749 {
00750   int l0, l1, show_from, show_to;
00751   int i;
00752   int trivial = ignore_blank_lines_flag || ignore_regexp_list;
00753   struct change *next;
00754
00755   show_from = show_to = 0;
00756
00757   *first0 = hunk->line0;
00758   *first1 = hunk->line1;
00759
00760   next = hunk;
00761   do
00762     {
00763       l0 = next->line0 + next->deleted - 1;
00764       l1 = next->line1 + next->inserted - 1;
00765       show_from += next->deleted;
00766       show_to += next->inserted;
00767
00768       for (i = next->line0; i <= l0 && trivial; i++)
00769     if (!ignore_blank_lines_flag || files[0].linbuf[i][0] != '\n')
00770       {
00771         struct regexp_list *r;
00772         char const *line = files[0].linbuf[i];
00773         int len = files[0].linbuf[i + 1] - line;
00774
00775         for (r = ignore_regexp_list; r; r = r->next)
00776           if (0 <= re_search (&r->buf, line, len, 0, len, 0))
00777         break;  /* Found a match.  Ignore this line.  */
00778         /* If we got all the way through the regexp list without
00779            finding a match, then it's nontrivial.  */
00780         if (!r)
00781           trivial = 0;
00782       }
00783
00784       for (i = next->line1; i <= l1 && trivial; i++)
00785     if (!ignore_blank_lines_flag || files[1].linbuf[i][0] != '\n')
00786       {
00787         struct regexp_list *r;
00788         char const *line = files[1].linbuf[i];
00789         int len = files[1].linbuf[i + 1] - line;
00790
00791         for (r = ignore_regexp_list; r; r = r->next)
00792           if (0 <= re_search (&r->buf, line, len, 0, len, 0))
00793         break;  /* Found a match.  Ignore this line.  */
00794         /* If we got all the way through the regexp list without
00795            finding a match, then it's nontrivial.  */
00796         if (!r)
00797           trivial = 0;
00798       }
00799     }
00800   while ((next = next->link) != 0);
00801
00802   *last0 = l0;
00803   *last1 = l1;
00804
00805   /* If all inserted or deleted lines are ignorable,
00806      tell the caller to ignore this hunk.  */
00807
00808   if (trivial)
00809     show_from = show_to = 0;
00810
00811   *deletes = show_from;
00812   *inserts = show_to;
00813 }
00814
00815 /* Concatenate three strings, returning a newly malloc'd string.  */
00816
00817 char *
00818 concat (s1, s2, s3)
00819      char const *s1, *s2, *s3;
00820 {
00821   size_t len = strlen (s1) + strlen (s2) + strlen (s3);
00822   char *new = xmalloc (len + 1);
00823   sprintf (new, "%s%s%s", s1, s2, s3);
00824   return new;
00825 }
00826
00827 /* Yield the newly malloc'd pathname
00828    of the file in DIR whose filename is FILE.  */
00829
00830 char *
00831 dir_file_pathname (dir, file)
00832      char const *dir, *file;
00833 {
00834   char const *p = filename_lastdirchar (dir);
00835   return concat (dir, "/" + (p && !p[1]), file);
00836 }
00837
00838 void
00839 debug_script (sp)
00840      struct change *sp;
00841 {
00842   fflush (stdout);
00843   for (; sp; sp = sp->link)
00844     fprintf (stderr, "%3d %3d delete %d insert %d\n",
00845          sp->line0, sp->line1, sp->deleted, sp->inserted);
00846   fflush (stderr);
00847 }
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


util.c File Reference

cvs-1.10/diff/util.c File Reference

#include "diff.h"
#include <varargs.h>

Include dependency graph for util.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | msg

Defines

#define | VA_START(args, lastarg) va_start(args)

Functions

char * | strerror ()
void | perror_with_name (text) char const *text
void | setup_output (name0, name1, depth) char const *name0,*name1

Variables

msg * msg_chain
msg ** msg_chain_end = &msg_chain
* arg
* arg1
* arg2
* arg3
* arg4
char const * | current_name1
int | current_depth
int | output_in_progress = 0
int | depth
size_t | len
* s2
change *(* hunkfun )()
void(* | printfun )()
char const *const * | line
* limit
* flag_format
* line_flag
deletes
int | lnum
int | a
int | b
int * | aptr
int * | bptr
file_data * file
int * | first0
int * | last0
int * | first1
int * | last1
int * | inserts
* s3

Define Documentation

#define VA_START | ( | args,
 |  | lastarg | ) | va_start(args)

Function Documentation

void perror_with_name ( text ) const

void setup_output | ( | name0 | ,
 |  | name1 | ,
 |  | depth |
 | ) | const

char* strerror ( )

Variable Documentation

int a

Definition at line 717 of file util.c.

int* aptr

Definition at line 701 of file util.c.

* arg

Definition at line 94 of file util.c.

* arg1

Definition at line 129 of file util.c.

* arg2

Definition at line 129 of file util.c.

* arg3

Definition at line 129 of file util.c.

* arg4

Definition at line 129 of file util.c.

int b

Definition at line 717 of file util.c.

int * bptr

Definition at line 701 of file util.c.

int current_depth [static]

Definition at line 171 of file util.c.

char const* current_name1 [static]

Definition at line 170 of file util.c.

int * deletes

Definition at line 748 of file util.c.

int depth

Definition at line 178 of file util.c.

char * file

Definition at line 271 of file expand_path.c.

int* first0

Definition at line 747 of file util.c.

int * first1

Definition at line 747 of file util.c.

* flag_format

Definition at line 620 of file util.c.

struct change*(* hunkfun)()

Definition at line 556 of file util.c.

int * inserts

Definition at line 748 of file util.c.

int * last0

Definition at line 747 of file util.c.

int * last1

Definition at line 747 of file util.c.

unsigned len

Definition at line 1122 of file trees.c.

* limit

Definition at line 620 of file util.c.

int line

Definition at line 272 of file expand_path.c.

* line_flag

Definition at line 620 of file util.c.

int lnum

Definition at line 692 of file util.c.

struct msg* msg_chain [static]

Definition at line 45 of file util.c.

struct msg** msg_chain_end = &msg_chain [static]

Definition at line 49 of file util.c.

int output_in_progress = 0 [static]

Definition at line 173 of file util.c.

void(* printfun)()

Definition at line 557 of file util.c.

* s2

Definition at line 819 of file util.c.

Referenced by _Compare().

* s3

Definition at line 819 of file util.c.

Generated on Sun Oct 21 12:42:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


version.c File Reference

cvs-1.10/diff/version.c File Reference

#include <config.h>

Include dependency graph for version.c:

Include dependency graph

Go to the source code of this file.

Variables

char const diff_version_string [] = "2.7"

Variable Documentation

char const diff_version_string[] = "2.7"

Definition at line 5 of file version.c.

Generated on Sun Oct 21 12:42:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/diff/version.c Source File

cvs-1.10/diff/version.c

Go to the documentation of this file.
00001 /* Version number of GNU diff.  */
00002
00003 #include <config.h>
00004
00005 char const diff_version_string[] = "2.7";
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


config.h File Reference

cvs-1.10/emx/config.h File Reference

#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>

Include dependency graph for config.h:

Include dependency graph

Go to the source code of this file.

Defines

#define | HAVE_LONG_FILE_NAMES 1
#define | HAVE_SYS_WAIT_H 1
#define | HAVE_UTIME_NULL 1
#define | RETSIGTYPE void
#define | STDC_HEADERS 1
#define | TIME_WITH_SYS_TIME 1
#define | CLIENT_SUPPORT 1
#define | HAVE_CONNECT 1
#define | HAVE_CRYPT 1
#define | HAVE_FSYNC 1
#define | HAVE_FTIME 1
#define | HAVE_FTRUNCATE 1
#define | HAVE_GETPAGESIZE 1
#define | HAVE_PUTENV 1
#define | HAVE_SIGACTION 1
#define | HAVE_SIGPROCMASK 1
#define | HAVE_TIMEZONE 1
#define | HAVE_TZSET 1
#define | HAVE_VPRINTF 1
#define | HAVE_DIRENT_H 1
#define | HAVE_ERRNO_H 1
#define | HAVE_FCNTL_H 1
#define | HAVE_IO_H 1
#define | HAVE_MEMORY_H 1
#define | HAVE_STRING_H 1
#define | HAVE_SYS_DIR_H 1
#define | HAVE_SYS_PARAM_H 1
#define | HAVE_SYS_RESOURCE_H 1
#define | HAVE_SYS_SELECT_H 1
#define | HAVE_SYS_TIME_H 1
#define | HAVE_SYS_TIMEB_H 1
#define | HAVE_UNISTD_H 1
#define | HAVE_UTIME_H 1
#define | HAVE_LIBCRYPT 1
#define | HAVE_LIBNSL 1
#define | HAVE_LIBSOCKET 1
#define | FOLD_FN_CHAR(c) (OS2_filename_classes[(unsigned char) (c)])
#define | ISDIRSEP(c) (FOLD_FN_CHAR(c) == '/')
#define | DEVNULL "nul"
#define | RSH_NEEDS_BINARY_FLAG 1
#define | START_SERVER os2_start_server
#define | SHUTDOWN_SERVER os2_shutdown_server
#define | SYSTEM_INITIALIZE(pargc, pargv) os2_initialize (pargc, pargv)
#define | CVS_STAT os2_stat
#define | CVS_CHDIR os2_chdir
#define | CVS_FNMATCH os2_fnmatch
#define | USE_SETMODE_BINARY 1
#define | NO_EXT_METHOD 1
#define | RSH_NOT_TRANSPARENT 1
#define | CHMOD_BROKEN 1

Functions

int | fncmp (const char *n1, const char *n2)
void | fnfold (char *FILENAME)
void | os2_start_server (int *tofd, int *fromfd, char *client_user, char *server_user, char *server_host, char *server_cvsroot)
void | os2_shutdown_server (int fd)
void | os2_initialize (int *pargc, char ***pargv)
int | os2_stat (const char *name, struct stat *buffer)
int | os2_chdir (const char *name)
int | os2_fnmatch (const char *pattern, const char *name, int flags)

Variables

unsigned char | OS2_filename_classes []

Define Documentation

#define CHMOD_BROKEN 1

Definition at line 316 of file config.h.

#define CLIENT_SUPPORT 1

Definition at line 84 of file config.h.

#define CVS_CHDIR os2_chdir

Definition at line 293 of file config.h.

Referenced by sticky().

#define CVS_FNMATCH os2_fnmatch

Definition at line 294 of file config.h.

#define CVS_STAT os2_stat

Definition at line 292 of file config.h.

#define DEVNULL "nul"

Definition at line 261 of file config.h.

#define FOLD_FN_CHAR ( c ) (OS2_filename_classes[(unsigned char) (c)])

Definition at line 243 of file config.h.

#define HAVE_CONNECT 1

Definition at line 101 of file config.h.

#define HAVE_CRYPT 1

Definition at line 104 of file config.h.

#define HAVE_DIRENT_H 1

Definition at line 170 of file config.h.

#define HAVE_ERRNO_H 1

Definition at line 173 of file config.h.

#define HAVE_FCNTL_H 1

Definition at line 176 of file config.h.

#define HAVE_FSYNC 1

Definition at line 113 of file config.h.

#define HAVE_FTIME 1

Definition at line 116 of file config.h.

#define HAVE_FTRUNCATE 1

Definition at line 119 of file config.h.

#define HAVE_GETPAGESIZE 1

Definition at line 122 of file config.h.

#define HAVE_IO_H 1

Definition at line 179 of file config.h.

#define HAVE_LIBCRYPT 1

Definition at line 224 of file config.h.

#define HAVE_LIBNSL 1

Definition at line 230 of file config.h.

#define HAVE_LIBSOCKET 1

Definition at line 239 of file config.h.

#define HAVE_LONG_FILE_NAMES 1

Definition at line 38 of file config.h.

#define HAVE_MEMORY_H 1

Definition at line 182 of file config.h.

#define HAVE_PUTENV 1

Definition at line 134 of file config.h.

#define HAVE_SIGACTION 1

Definition at line 140 of file config.h.

#define HAVE_SIGPROCMASK 1

Definition at line 146 of file config.h.

#define HAVE_STRING_H 1

Definition at line 191 of file config.h.

#define HAVE_SYS_DIR_H 1

Definition at line 197 of file config.h.

#define HAVE_SYS_PARAM_H 1

Definition at line 203 of file config.h.

#define HAVE_SYS_RESOURCE_H 1

Definition at line 206 of file config.h.

#define HAVE_SYS_SELECT_H 1

Definition at line 209 of file config.h.

#define HAVE_SYS_TIMEB_H 1

Definition at line 215 of file config.h.

#define HAVE_SYS_TIME_H 1

Definition at line 212 of file config.h.

#define HAVE_SYS_WAIT_H 1

Definition at line 41 of file config.h.

#define HAVE_TIMEZONE 1

Definition at line 155 of file config.h.

#define HAVE_TZSET 1

Definition at line 158 of file config.h.

#define HAVE_UNISTD_H 1

Definition at line 218 of file config.h.

#define HAVE_UTIME_H 1

Definition at line 221 of file config.h.

#define HAVE_UTIME_NULL 1

Definition at line 44 of file config.h.

#define HAVE_VPRINTF 1

Definition at line 164 of file config.h.

#define ISDIRSEP ( c ) (FOLD_FN_CHAR(c) == '/')

Definition at line 248 of file config.h.

#define NO_EXT_METHOD 1

Definition at line 310 of file config.h.

#define RETSIGTYPE void

Definition at line 63 of file config.h.

Referenced by SIG_init().

#define RSH_NEEDS_BINARY_FLAG 1

Definition at line 266 of file config.h.

#define RSH_NOT_TRANSPARENT 1

Definition at line 313 of file config.h.

#define SHUTDOWN_SERVER os2_shutdown_server

Definition at line 269 of file config.h.

#define START_SERVER os2_start_server

Definition at line 268 of file config.h.

#define STDC_HEADERS 1

Definition at line 72 of file config.h.

#define SYSTEM_INITIALIZE | ( | pargc,
 |  | pargv | ) | os2_initialize (pargc, pargv)

Definition at line 279 of file config.h.

#define TIME_WITH_SYS_TIME 1

Definition at line 75 of file config.h.

#define USE_SETMODE_BINARY 1

Definition at line 301 of file config.h.

Function Documentation

int fncmp | ( | const char * | n1,
 |  | const char * | n2
 | ) |

Definition at line 766 of file filesubr.c.

00767 {
00768     char fn1[MAXNAMLEN], fn2[MAXNAMLEN];
00769
00770     strcpy (fn1, n1); _fnslashify(fn1);
00771     strcpy (fn2, n2); _fnslashify(fn2);
00772
00773     return _fncmp ((unsigned char *) fn1, (unsigned char *) fn2);
00774 }

void fnfold ( char * filename )

Definition at line 781 of file filesubr.c.

00782 {
00783     while (*filename)
00784     {
00785         *filename = FOLD_FN_CHAR (*filename);
00786     filename++;
00787     }
00788 }

int os2_chdir ( const char * Dir )

int os2_fnmatch | ( | const char * | pattern,
 |  | const char * | name,
 |  | int | flags
 | ) |

void os2_initialize | ( | int * | pargc,
 |  | char *** | pargv
 | ) |

void os2_shutdown_server ( int fd )

Definition at line 76 of file startserver.c.

00077 {
00078     /* FIXME: shutdown on files seems to have no bad effects */
00079     if (shutdown (fd, 2) < 0 && errno != ENOTSOCK)
00080         error (1, 0, "couldn't shutdown server connection");
00081     if (close (fd) < 0)
00082         error (1, 0, "couldn't close server connection");
00083 }

void os2_start_server | ( | int * | tofd,
 |  | int * | fromfd,
 |  | char * | client_user,
 |  | char * | server_user,
 |  | char * | server_host,
 |  | char * | server_cvsroot
 | ) |

Definition at line 27 of file startserver.c.

00032 {
00033     int fd, port;
00034     char *portenv;
00035     struct servent *sptr;
00036     const char *rcmd_host = (const char *) server_host;
00037
00038     if (! (cvs_server = getenv ("CVS_SERVER")))
00039     cvs_server = "cvs";
00040     command = xmalloc (strlen (cvs_server)
00041              + strlen (server_cvsroot)
00042              + 50);
00043     sprintf (command, "%s server", cvs_server);
00044
00045     portenv = getenv ("CVS_RCMD_PORT");
00046     if (portenv)
00047     port = atoi (portenv);
00048     else if ((sptr = getservbyname ("shell", "tcp")) != NULL)
00049     port = sptr->s_port;
00050     else
00051     port = 514; /* shell/tcp */
00052
00053     if (trace)
00054     {
00055     fprintf (stderr, "os2_start_server(): connecting to %s:%d\n",
00056         server_host, port);
00057     fprintf (stderr, "local_user = %s, remote_user = %s, CVSROOT = %s\n",
00058         client_user, (server_user ? server_user : client_user),
00059         server_cvsroot);
00060     }
00061
00062     fd = rcmd (&rcmd_host, port,
00063            client_user,
00064            (server_user ? server_user : client_user),
00065            command, 0);
00066
00067     if (fd < 0)
00068     error (1, errno, "cannot start server via rcmd()");
00069
00070     *tofd = fd;
00071     *fromfd = fd;
00072     free (command);
00073 }

int os2_stat | ( | const char * | name,
 |  | struct stat * | buffer
 | ) |

Variable Documentation

unsigned char OS2_filename_classes[]

Definition at line 244 of file config.h.

Generated on Sun Oct 21 12:42:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/emx/config.h Source File

cvs-1.10/emx/config.h

Go to the documentation of this file.
00001 /* config.h --- configuration file for OS/2 EMX
00002    Thomas Epting <tepting@swol.de> --- Feb 1997  */
00003
00004 /* This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 /* This file lives in the emx/ subdirectory, which is only included
00015  * in your header search path if you use emx/Makefile (with GNU make
00016  * for OS/2). Thus, this is the right place to put configuration
00017  * information for OS/2.
00018  */
00019
00020 #include <io.h>
00021 #include <sys/types.h>
00022 #include <sys/stat.h>
00023
00024 /* Define if on AIX 3.
00025    System headers sometimes define this.
00026    We just want to avoid a redefinition error message.  */
00027 #ifndef _ALL_SOURCE
00028 /* #undef _ALL_SOURCE */
00029 #endif
00030
00031 /* Define to empty if the keyword does not work.  */
00032 #undef const
00033
00034 /* Define to `int' if <sys/types.h> doesn't define.  */
00035 /* #undef gid_t */
00036
00037 /* Define if you support file names longer than 14 characters.  */
00038 #define HAVE_LONG_FILE_NAMES 1
00039
00040 /* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
00041 #define HAVE_SYS_WAIT_H 1
00042
00043 /* Define if utime(file, NULL) sets file's timestamp to the present.  */
00044 #define HAVE_UTIME_NULL 1
00045
00046 /* Define if on MINIX.  */
00047 /* #undef _MINIX */
00048
00049 /* Define to `int' if <sys/types.h> doesn't define.  */
00050 /* #undef mode_t */
00051
00052 /* Define to `int' if <sys/types.h> doesn't define.  */
00053 /* #undef pid_t */
00054
00055 /* Define if the system does not provide POSIX.1 features except
00056    with this defined.  */
00057 /* #undef _POSIX_1_SOURCE */
00058
00059 /* Define if you need to in order for stat and other things to work.  */
00060 /* #undef _POSIX_SOURCE */
00061
00062 /* Define as the return type of signal handlers (int or void).  */
00063 #define RETSIGTYPE void
00064
00065 /* Define to `unsigned' if <sys/types.h> doesn't define.  */
00066 /* #undef size_t */
00067
00068 /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly.  */
00069 /* #undef STAT_MACROS_BROKEN */
00070
00071 /* Define if you have the ANSI C header files.  */
00072 #define STDC_HEADERS 1
00073
00074 /* Define if you can safely include both <sys/time.h> and <time.h>.  */
00075 #define TIME_WITH_SYS_TIME 1
00076
00077 /* Define to `int' if <sys/types.h> doesn't define.  */
00078 /* #undef uid_t */
00079
00080 /* Define if you have MIT Kerberos version 4 available.  */
00081 #undef HAVE_KERBEROS
00082
00083 /* Define if you want CVS to be able to be a remote repository client.  */
00084 #define CLIENT_SUPPORT 1
00085
00086 #if 0
00087 /* This doesn't work yet, and I'm sure I don't want the hassles of seeing
00088    whether it will compile.  */
00089 /* Define if you want CVS to be able to serve repositories to remote
00090    clients.  */
00091 #define SERVER_SUPPORT 1
00092
00093 /* Define if you want to use the password authenticated server.  */
00094 #define AUTH_SERVER_SUPPORT
00095 #endif /* 0 */
00096
00097 /* Define if you want encryption support.  */
00098 /* #undef ENCRYPTION */
00099
00100 /* Define if you have the connect function.  */
00101 #define HAVE_CONNECT 1
00102
00103 /* Define if you have the crypt function.  */
00104 #define HAVE_CRYPT 1
00105
00106 /* Define if you have the fchdir function.  */
00107 /* #define HAVE_FCHDIR */
00108
00109 /* Define if you have the fchmod function.  */
00110 /* #define HAVE_FCHMOD */
00111
00112 /* Define if you have the fsync function.  */
00113 #define HAVE_FSYNC 1
00114
00115 /* Define if you have the ftime function.  */
00116 #define HAVE_FTIME 1
00117
00118 /* Define if you have the ftruncate function.  */
00119 #define HAVE_FTRUNCATE 1
00120
00121 /* Define if you have the getpagesize function.  */
00122 #define HAVE_GETPAGESIZE 1
00123
00124 /* Define if you have the getspnam function.  */
00125 /* #define HAVE_GETSPNAM */
00126
00127 /* Define if you have the initgroups function.  */
00128 /* #define HAVE_INITGROUPS */
00129
00130 /* Define if you have the krb_get_err_text function.  */
00131 /* #undef HAVE_KRB_GET_ERR_TEXT */
00132
00133 /* Define if you have the putenv function.  */
00134 #define HAVE_PUTENV 1
00135
00136 /* Define if you have the readlink function.  */
00137 /* #define HAVE_READLINK */
00138
00139 /* Define if you have the sigaction function.  */
00140 #define HAVE_SIGACTION 1
00141
00142 /* Define if you have the sigblock function.  */
00143 /* #undef HAVE_SIGBLOCK */
00144
00145 /* Define if you have the sigprocmask function.  */
00146 #define HAVE_SIGPROCMASK 1
00147
00148 /* Define if you have the sigsetmask function.  */
00149 /* #undef HAVE_SIGSETMASK */
00150
00151 /* Define if you have the sigvec function.  */
00152 /* #undef HAVE_SIGVEC */
00153
00154 /* Define if you have the timezone function.  */
00155 #define HAVE_TIMEZONE 1
00156
00157 /* Define if you have the tzset function.  */
00158 #define HAVE_TZSET 1
00159
00160 /* Define if you have the vfork function.  */
00161 /* #undef HAVE_VFORK */
00162
00163 /* Define if you have the vprintf function.  */
00164 #define HAVE_VPRINTF 1
00165
00166 /* Define if you have the <direct.h> header file.  */
00167 /* #undef HAVE_DIRECT_H */
00168
00169 /* Define if you have the <dirent.h> header file.  */
00170 #define HAVE_DIRENT_H 1
00171
00172 /* Define if you have the <errno.h> header file.  */
00173 #define HAVE_ERRNO_H 1
00174
00175 /* Define if you have the <fcntl.h> header file.  */
00176 #define HAVE_FCNTL_H 1
00177
00178 /* Define if you have the <io.h> header file.  */
00179 #define HAVE_IO_H 1
00180
00181 /* Define if you have the <memory.h> header file.  */
00182 #define HAVE_MEMORY_H 1
00183
00184 /* Define if you have the <ndbm.h> header file.  */
00185 /* #undef HAVE_NDBM_H 1 */
00186
00187 /* Define if you have the <ndir.h> header file.  */
00188 /* #undef HAVE_NDIR_H */
00189
00190 /* Define if you have the <string.h> header file.  */
00191 #define HAVE_STRING_H 1
00192
00193 /* Define if you have the <sys/bsdtypes.h> header file.  */
00194 /* #undef HAVE_SYS_BSDTYPES_H */
00195
00196 /* Define if you have the <sys/dir.h> header file.  */
00197 #define HAVE_SYS_DIR_H 1
00198
00199 /* Define if you have the <sys/ndir.h> header file.  */
00200 /* #undef HAVE_SYS_NDIR_H */
00201
00202 /* Define if you have the <sys/param.h> header file.  */
00203 #define HAVE_SYS_PARAM_H 1
00204
00205 /* Define if you have the <sys/resource.h> header file.  */
00206 #define HAVE_SYS_RESOURCE_H 1
00207
00208 /* Define if you have the <sys/select.h> header file.  */
00209 #define HAVE_SYS_SELECT_H 1
00210
00211 /* Define if you have the <sys/time.h> header file.  */
00212 #define HAVE_SYS_TIME_H 1
00213
00214 /* Define if you have the <sys/timeb.h> header file.  */
00215 #define HAVE_SYS_TIMEB_H 1
00216
00217 /* Define if you have the <unistd.h> header file.  */
00218 #define HAVE_UNISTD_H 1
00219
00220 /* Define if you have the <utime.h> header file.  */
00221 #define HAVE_UTIME_H 1
00222
00223 /* Define if you have the crypt library (-lcrypt).  */
00224 #define HAVE_LIBCRYPT 1
00225
00226 /* Define if you have the inet library (-linet).  */
00227 /* #undef HAVE_LIBINET */
00228
00229 /* Define if you have the nsl library (-lnsl).  */
00230 #define HAVE_LIBNSL 1
00231
00232 /* Define if you have the nsl_s library (-lnsl_s).  */
00233 /* #undef HAVE_LIBNSL_S */
00234
00235 /* Define if you have the sec library (-lsec).  */
00236 /* #undef HAVE_LIBSEC 1 */
00237
00238 /* Define if you have the socket library (-lsocket).  */
00239 #define HAVE_LIBSOCKET 1
00240
00241 /* Under OS/2, filenames are case-insensitive, and both / and \
00242    are path component separators.  */
00243 #define FOLD_FN_CHAR(c) (OS2_filename_classes[(unsigned char) (c)])
00244 extern unsigned char OS2_filename_classes[];
00245
00246 /* Is the character C a path name separator?  Under OS/2, you can use
00247    either / or \.  */
00248 #define ISDIRSEP(c) (FOLD_FN_CHAR(c) == '/')
00249
00250 /* Like strcmp, but with the appropriate tweaks for file names.
00251    Under OS/2, filenames are case-insensitive but case-preserving,
00252    and both \ and / are path element separators.  */
00253 extern int fncmp (const char *n1, const char *n2);
00254
00255 /* Fold characters in FILENAME to their canonical forms.
00256    If FOLD_FN_CHAR is not #defined, the system provides a default
00257    definition for this.  */
00258 extern void fnfold (char *FILENAME);
00259
00260 /* This is where old bits go to die under OS/2 as well as WinNT.  */
00261 #define DEVNULL "nul"
00262
00263 /* We actually do have a transparent rsh, whew. */
00264 #undef RSH_NOT_TRANSPARENT
00265 /* But it won't be transparent unless we ask it nicely! */
00266 #define RSH_NEEDS_BINARY_FLAG 1
00267
00268 #define START_SERVER os2_start_server
00269 #define SHUTDOWN_SERVER os2_shutdown_server
00270
00271 extern void START_SERVER (int *tofd, int *fromfd,
00272               char *client_user,
00273               char *server_user,
00274               char *server_host,
00275               char *server_cvsroot);
00276 extern void SHUTDOWN_SERVER (int fd);
00277
00278 /* Call our own os2_initialize function */
00279 #define SYSTEM_INITIALIZE(pargc,pargv) os2_initialize (pargc, pargv)
00280 extern void os2_initialize (int *pargc, char ***pargv);
00281
00282 /* Under EMX, we already have popen() and pclose()... */
00283 /* #undef USE_OWN_POPEN */
00284 /* ... and we too have no need for popenRW to start the rsh server. */
00285 /* #define START_RSH_WITH_POPEN_RW */
00286
00287 /* Socket handles and file handles share a command handle space under EMX. */
00288 /* #undef NO_SOCKET_TO_FD */
00289
00290
00291
00292 #define CVS_STAT     os2_stat
00293 #define CVS_CHDIR    os2_chdir
00294 #define CVS_FNMATCH  os2_fnmatch
00295
00296 extern int os2_stat(const char *name, struct stat *buffer);
00297 extern int os2_chdir(const char *name);
00298 extern int os2_fnmatch(const char *pattern, const char *name, int flags);
00299
00300 /* Pipes need to be put into binary mode using setmode ().  */
00301 #define USE_SETMODE_BINARY 1
00302
00303 /* The reason for this is that we don't know whether to pass -b to
00304    rsh.  The system-supplied rsh on OS/2 wants it.  Some other rsh
00305    replacement might not accept it.  Historically, the NT port of CVS
00306    has not passed -b, and the OS/2 port has.  What a mess.  If we can
00307    get away with just not accepting :ext: until we can figure out how
00308    we should deal with this, then it will avoid having people rely on
00309    behaviors which will need to change.  */
00310 #define NO_EXT_METHOD 1
00311
00312 /* See above; we can't use rsh without -b.  */
00313 #define RSH_NOT_TRANSPARENT 1
00314
00315 /* See discussion at xchmod in filesubr.c.  */
00316 #define CHMOD_BROKEN 1
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


filesubr.c File Reference

cvs-1.10/emx/filesubr.c File Reference

#include "cvs.h"
#include <sys/param.h>

Include dependency graph for filesubr.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | L_tmpnam 50

Functions

int deep_remove_dir | PROTO ((const char *path))
void | copy_file (from, to) const char *from
int | fncmp (const char *n1, const char *n2)
void | fnfold (char *filename)

Variables

const char * | to
const int | mode
int | writable
char * | buf
size_t | nchars
const char * | file2
char ** | argv
int * | pargc
char *** | pargv

Define Documentation

#define L_tmpnam 50

Function Documentation

int deep_remove_dir PROTO ( (const char *path) ) [static]

void copy_file | ( | from | ,
 |  | to |
 | ) | const

int fncmp | ( | const char * | n1,
 |  | const char * | n2
 | ) |

Definition at line 766 of file filesubr.c.

00767 {
00768     char fn1[MAXNAMLEN], fn2[MAXNAMLEN];
00769
00770     strcpy (fn1, n1); _fnslashify(fn1);
00771     strcpy (fn2, n2); _fnslashify(fn2);
00772
00773     return _fncmp ((unsigned char *) fn1, (unsigned char *) fn2);
00774 }

void fnfold ( char * filename )

Definition at line 781 of file filesubr.c.

00782 {
00783     while (*filename)
00784     {
00785         *filename = FOLD_FN_CHAR (*filename);
00786     filename++;
00787     }
00788 }

Variable Documentation

char** argv

Definition at line 713 of file filesubr.c.

charf * buf

Definition at line 1121 of file trees.c.

const char* file2

Definition at line 556 of file filesubr.c.

const char * mode

Definition at line 161 of file gzio.c.

size_t nchars

Definition at line 522 of file filesubr.c.

int* pargc

Definition at line 714 of file filesubr.c.

char*** pargv

Definition at line 715 of file filesubr.c.

const char* to

Definition at line 372 of file filesubr.c.

int writable

Definition at line 317 of file filesubr.c.

Generated on Sun Oct 21 12:42:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/emx/filesubr.c Source File

cvs-1.10/emx/filesubr.c

Go to the documentation of this file.
00001 /* filesubr.c --- subroutines for dealing with files
00002    Jim Blandy <jimb@cyclic.com>
00003
00004    This file is part of GNU CVS.
00005
00006    GNU CVS is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published by the
00008    Free Software Foundation; either version 2, or (at your option) any
00009    later version.
00010
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.  */
00015
00016 /* These functions were moved out of subr.c because they need different
00017    definitions under operating systems (like, say, Windows NT) with different
00018    file system semantics.  */
00019
00020 #include "cvs.h"
00021 #include <sys/param.h>
00022
00023 /*
00024  * I don't know of a convenient way to test this at configure time, or else
00025  * I'd certainly do it there.
00026  */
00027 #if defined(NeXT)
00028 #define LOSING_TMPNAM_FUNCTION
00029 #endif
00030
00031 static int deep_remove_dir PROTO((const char *path));
00032
00033 /*
00034  * Copies "from" to "to".
00035  */
00036 void
00037 copy_file (from, to)
00038     const char *from;
00039     const char *to;
00040 {
00041     struct stat sb;
00042     struct utimbuf t;
00043     int fdin, fdout;
00044
00045     if (trace)
00046 #ifdef SERVER_SUPPORT
00047     (void) fprintf (stderr, "%c-> copy(%s,%s)\n",
00048             (server_active) ? 'S' : ' ', from, to);
00049 #else
00050     (void) fprintf (stderr, "-> copy(%s,%s)\n", from, to);
00051 #endif
00052     if (noexec)
00053     return;
00054
00055     if ((fdin = open (from, O_RDONLY | O_BINARY)) < 0)
00056     error (1, errno, "cannot open %s for copying", from);
00057     if (fstat (fdin, &sb) < 0)
00058     error (1, errno, "cannot fstat %s", from);
00059     if ((fdout = open (to, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY,
00060                        (int) sb.st_mode & 07777)) < 0)
00061     error (1, errno, "cannot create %s for copying", to);
00062     if (sb.st_size > 0)
00063     {
00064     char buf[BUFSIZ];
00065     int n;
00066
00067     for (;;)
00068     {
00069         n = read (fdin, buf, sizeof(buf));
00070         if (n == -1)
00071         {
00072 #ifdef EINTR
00073         if (errno == EINTR)
00074             continue;
00075 #endif
00076         error (1, errno, "cannot read file %s for copying", from);
00077         }
00078             else if (n == 0)
00079         break;
00080
00081         if (write(fdout, buf, n) != n) {
00082         error (1, errno, "cannot write file %s for copying", to);
00083         }
00084     }
00085
00086 #ifdef HAVE_FSYNC
00087     if (fsync (fdout))
00088         error (1, errno, "cannot fsync file %s after copying", to);
00089 #endif
00090     }
00091
00092     if (close (fdin) < 0)
00093     error (0, errno, "cannot close %s", from);
00094     if (close (fdout) < 0)
00095     error (1, errno, "cannot close %s", to);
00096
00097     /* now, set the times for the copied file to match those of the original */
00098     memset ((char *) &t, 0, sizeof (t));
00099     t.actime = sb.st_atime;
00100     t.modtime = sb.st_mtime;
00101     (void) utime (to, &t);
00102 }
00103
00104 /* FIXME-krp: these functions would benefit from caching the char * &
00105    stat buf.  */
00106
00107 /*
00108  * Returns non-zero if the argument file is a directory, or is a symbolic
00109  * link which points to a directory.
00110  */
00111 int
00112 isdir (file)
00113     const char *file;
00114 {
00115     struct stat sb;
00116
00117     if (stat (file, &sb) < 0)
00118     return (0);
00119     return (S_ISDIR (sb.st_mode));
00120 }
00121
00122 /*
00123  * Returns non-zero if the argument file is a symbolic link.
00124  */
00125 int
00126 islink (file)
00127     const char *file;
00128 {
00129 #ifdef S_ISLNK
00130     struct stat sb;
00131
00132     if (lstat (file, &sb) < 0)
00133     return (0);
00134     return (S_ISLNK (sb.st_mode));
00135 #else
00136     return (0);
00137 #endif
00138 }
00139
00140 /*
00141  * Returns non-zero if the argument file exists.
00142  */
00143 int
00144 isfile (file)
00145     const char *file;
00146 {
00147     return isaccessible(file, F_OK);
00148 }
00149
00150 /*
00151  * Returns non-zero if the argument file is readable.
00152  */
00153 int
00154 isreadable (file)
00155     const char *file;
00156 {
00157     return isaccessible(file, R_OK);
00158 }
00159
00160 /*
00161  * Returns non-zero if the argument file is writable.
00162  */
00163 int
00164 iswritable (file)
00165     const char *file;
00166 {
00167     return isaccessible(file, W_OK);
00168 }
00169
00170 /*
00171  * Returns non-zero if the argument file is accessable according to
00172  * mode.  If compiled with SETXID_SUPPORT also works if cvs has setxid
00173  * bits set.
00174  */
00175 int
00176 isaccessible (file, mode)
00177     const char *file;
00178     const int mode;
00179 {
00180 #ifdef SETXID_SUPPORT
00181     struct stat sb;
00182     int umask = 0;
00183     int gmask = 0;
00184     int omask = 0;
00185     int uid;
00186
00187     if (stat(file, &sb) == -1)
00188     return 0;
00189     if (mode == F_OK)
00190     return 1;
00191
00192     uid = geteuid();
00193     if (uid == 0)       /* superuser */
00194     {
00195     if (mode & X_OK)
00196         return sb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH);
00197     else
00198         return 1;
00199     }
00200
00201     if (mode & R_OK)
00202     {
00203     umask |= S_IRUSR;
00204     gmask |= S_IRGRP;
00205     omask |= S_IROTH;
00206     }
00207     if (mode & W_OK)
00208     {
00209     umask |= S_IWUSR;
00210     gmask |= S_IWGRP;
00211     omask |= S_IWOTH;
00212     }
00213     if (mode & X_OK)
00214     {
00215     umask |= S_IXUSR;
00216     gmask |= S_IXGRP;
00217     omask |= S_IXOTH;
00218     }
00219
00220     if (sb.st_uid == uid)
00221     return (sb.st_mode & umask) == umask;
00222     else if (sb.st_gid == getegid())
00223     return (sb.st_mode & gmask) == gmask;
00224     else
00225     return (sb.st_mode & omask) == omask;
00226 #else
00227     return access(file, mode) == 0;
00228 #endif
00229 }
00230
00231 /*
00232  * Open a file and die if it fails
00233  */
00234 FILE *
00235 open_file (name, mode)
00236     const char *name;
00237     const char *mode;
00238 {
00239     FILE *fp;
00240
00241     if ((fp = fopen (name, mode)) == NULL)
00242     error (1, errno, "cannot open %s", name);
00243     return (fp);
00244 }
00245
00246 /*
00247  * Make a directory and die if it fails
00248  */
00249 void
00250 make_directory (name)
00251     const char *name;
00252 {
00253     struct stat sb;
00254
00255     if (stat (name, &sb) == 0 && (!S_ISDIR (sb.st_mode)))
00256         error (0, 0, "%s already exists but is not a directory", name);
00257     if (!noexec && mkdir (name, 0777) < 0)
00258     error (1, errno, "cannot make directory %s", name);
00259 }
00260
00261 /*
00262  * Make a path to the argument directory, printing a message if something
00263  * goes wrong.
00264  */
00265 void
00266 make_directories (name)
00267     const char *name;
00268 {
00269     char *cp;
00270
00271     if (noexec)
00272     return;
00273
00274     if (mkdir (name, 0777) == 0 || errno == EEXIST)
00275     return;
00276     if (! existence_error (errno))
00277     {
00278     error (0, errno, "cannot make path to %s", name);
00279     return;
00280     }
00281     if ((cp = strrchr (name, '/')) == NULL)
00282     return;
00283     *cp = '\0';
00284     make_directories (name);
00285     *cp++ = '/';
00286     if (*cp == '\0')
00287     return;
00288     (void) mkdir (name, 0777);
00289 }
00290
00291 /* Create directory NAME if it does not already exist; fatal error for
00292    other errors.  Returns 0 if directory was created; 1 if it already
00293    existed.  */
00294 int
00295 mkdir_if_needed (name)
00296     char *name;
00297 {
00298     if (mkdir (name, 0777) < 0)
00299     {
00300     if (errno != EEXIST)
00301         error (1, errno, "cannot make directory %s", name);
00302     return 1;
00303     }
00304     return 0;
00305 }
00306
00307 /*
00308  * Change the mode of a file, either adding write permissions, or removing
00309  * all write permissions.  Either change honors the current umask setting.
00310  * The EMX doc (0.9c, emxlib.doc) says that chmod sets/clears the readonly
00311  * bit.  But it always seemed to be a noop when I tried it.  Therefore,
00312  * I've copied over the "attrib" code from os2/filesubr.c.
00313  */
00314 void
00315 xchmod (fname, writable)
00316     char *fname;
00317     int writable;
00318 {
00319     char *attrib_cmd;
00320     char *attrib_option;
00321     char *whole_cmd;
00322     char *p;
00323     char *q;
00324
00325     if (!isfile (fname))
00326     {
00327     error (0, 0, "cannot change mode of file %s; it does not exist",
00328            fname);
00329     return;
00330     }
00331
00332     attrib_cmd = "attrib "; /* No, really? */
00333
00334     if (writable)
00335         attrib_option = "-r ";  /* make writeable */
00336     else
00337         attrib_option = "+r ";  /* make read-only */
00338
00339     whole_cmd = xmalloc (strlen (attrib_cmd)
00340                          + strlen (attrib_option)
00341                          + strlen (fname)
00342                          + 1);
00343
00344     strcpy (whole_cmd, attrib_cmd);
00345     strcat (whole_cmd, attrib_option);
00346
00347     /* Copy fname to the end of whole_cmd, translating / to \.
00348        Attrib doesn't take / but many parts of CVS rely
00349        on being able to use it.  */
00350     p = whole_cmd + strlen (whole_cmd);
00351     q = fname;
00352     while (*q)
00353     {
00354     if (*q == '/')
00355         *p++ = '\\';
00356     else
00357         *p++ = *q;
00358     ++q;
00359     }
00360     *p = '\0';
00361
00362     system (whole_cmd);
00363     free (whole_cmd);
00364 }
00365
00366 /*
00367  * Rename a file and die if it fails
00368  */
00369 void
00370 rename_file (from, to)
00371     const char *from;
00372     const char *to;
00373 {
00374     if (trace)
00375 #ifdef SERVER_SUPPORT
00376     (void) fprintf (stderr, "%c-> rename(%s,%s)\n",
00377             (server_active) ? 'S' : ' ', from, to);
00378 #else
00379     (void) fprintf (stderr, "-> rename(%s,%s)\n", from, to);
00380 #endif
00381     if (noexec)
00382     return;
00383
00384     unlink_file (to);
00385     if (rename (from, to) != 0)
00386     error (1, errno, "cannot rename file %s to %s", from, to);
00387 }
00388
00389 /*
00390  * unlink a file, if possible.
00391  */
00392 int
00393 unlink_file (f)
00394     const char *f;
00395 {
00396     if (trace)
00397 #ifdef SERVER_SUPPORT
00398     (void) fprintf (stderr, "%c-> unlink(%s)\n",
00399             (server_active) ? 'S' : ' ', f);
00400 #else
00401     (void) fprintf (stderr, "-> unlink(%s)\n", f);
00402 #endif
00403     if (noexec)
00404     return (0);
00405
00406     if (isfile (f))
00407     xchmod ((char *)f, 1);
00408     return (unlink (f));
00409 }
00410
00411 /*
00412  * Unlink a file or dir, if possible.  If it is a directory do a deep
00413  * removal of all of the files in the directory.  Return -1 on error
00414  * (in which case errno is set).
00415  */
00416 int
00417 unlink_file_dir (f)
00418     const char *f;
00419 {
00420     if (trace)
00421 #ifdef SERVER_SUPPORT
00422     (void) fprintf (stderr, "%c-> unlink_file_dir(%s)\n",
00423             (server_active) ? 'S' : ' ', f);
00424 #else
00425     (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f);
00426 #endif
00427     if (noexec)
00428     return (0);
00429
00430     /* For at least some unices, if root tries to unlink() a directory,
00431        instead of doing something rational like returning EISDIR,
00432        the system will gleefully go ahead and corrupt the filesystem.
00433        So we first call isdir() to see if it is OK to call unlink().  This
00434        doesn't quite work--if someone creates a directory between the
00435        call to isdir() and the call to unlink(), we'll still corrupt
00436        the filesystem.  Where is the Unix Haters Handbook when you need
00437        it?  */
00438     if (isdir(f))
00439     return deep_remove_dir(f);
00440     else
00441     {
00442     if (unlink (f) != 0)
00443         return -1;
00444     }
00445     /* We were able to remove the file from the disk */
00446     return 0;
00447 }
00448
00449 /* Remove a directory and everything it contains.  Returns 0 for
00450  * success, -1 for failure (in which case errno is set).
00451  */
00452
00453 static int
00454 deep_remove_dir (path)
00455     const char *path;
00456 {
00457     DIR       *dirp;
00458     struct dirent *dp;
00459     char       buf[PATH_MAX];
00460
00461     if (rmdir (path) != 0)
00462     {
00463     if (errno == ENOTEMPTY
00464         || errno == EEXIST
00465         /* Ugly workaround for ugly AIX 4.1 (and 3.2) header bug
00466            (it defines ENOTEMPTY and EEXIST to 17 but actually
00467            returns 87).  */
00468         || (ENOTEMPTY == 17 && EEXIST == 17 && errno == 87))
00469     {
00470         if ((dirp = opendir (path)) == NULL)
00471         /* If unable to open the directory return
00472          * an error
00473          */
00474         return -1;
00475
00476         while ((dp = readdir (dirp)) != NULL)
00477         {
00478         if (strcmp (dp->d_name, ".") == 0 ||
00479                 strcmp (dp->d_name, "..") == 0)
00480             continue;
00481
00482         sprintf (buf, "%s/%s", path, dp->d_name);
00483
00484         /* See comment in unlink_file_dir explanation of why we use
00485            isdir instead of just calling unlink and checking the
00486            status.  */
00487         if (isdir(buf))
00488         {
00489             if (deep_remove_dir(buf))
00490             {
00491             closedir(dirp);
00492             return -1;
00493             }
00494         }
00495         else
00496         {
00497             if (unlink (buf) != 0)
00498             {
00499             closedir(dirp);
00500             return -1;
00501             }
00502         }
00503         }
00504         closedir (dirp);
00505         return rmdir (path);
00506     }
00507     else
00508         return -1;
00509     }
00510
00511     /* Was able to remove the directory return 0 */
00512     return 0;
00513 }
00514
00515 /* Read NCHARS bytes from descriptor FD into BUF.
00516    Return the number of characters successfully read.
00517    The number returned is always NCHARS unless end-of-file or error.  */
00518 static size_t
00519 block_read (fd, buf, nchars)
00520     int fd;
00521     char *buf;
00522     size_t nchars;
00523 {
00524     char *bp = buf;
00525     size_t nread;
00526
00527     do
00528     {
00529     nread = read (fd, bp, nchars);
00530     if (nread == (size_t)-1)
00531     {
00532 #ifdef EINTR
00533         if (errno == EINTR)
00534         continue;
00535 #endif
00536         return (size_t)-1;
00537     }
00538
00539     if (nread == 0)
00540         break;
00541
00542     bp += nread;
00543     nchars -= nread;
00544     } while (nchars != 0);
00545
00546     return bp - buf;
00547 }
00548
00549
00550 /*
00551  * Compare "file1" to "file2". Return non-zero if they don't compare exactly.
00552  */
00553 int
00554 xcmp (file1, file2)
00555     const char *file1;
00556     const char *file2;
00557 {
00558     char *buf1, *buf2;
00559     struct stat sb1, sb2;
00560     int fd1, fd2;
00561     int ret;
00562
00563     if ((fd1 = open (file1, O_RDONLY | O_BINARY)) < 0)
00564     error (1, errno, "cannot open file %s for comparing", file1);
00565     if ((fd2 = open (file2, O_RDONLY | O_BINARY)) < 0)
00566     error (1, errno, "cannot open file %s for comparing", file2);
00567     if (fstat (fd1, &sb1) < 0)
00568     error (1, errno, "cannot fstat %s", file1);
00569     if (fstat (fd2, &sb2) < 0)
00570     error (1, errno, "cannot fstat %s", file2);
00571
00572     /* A generic file compare routine might compare st_dev & st_ino here
00573        to see if the two files being compared are actually the same file.
00574        But that won't happen in CVS, so we won't bother. */
00575
00576     if (sb1.st_size != sb2.st_size)
00577     ret = 1;
00578     else if (sb1.st_size == 0)
00579     ret = 0;
00580     else
00581     {
00582     /* FIXME: compute the optimal buffer size by computing the least
00583        common multiple of the files st_blocks field */
00584     size_t buf_size = 8 * 1024;
00585     size_t read1;
00586     size_t read2;
00587
00588     buf1 = xmalloc (buf_size);
00589     buf2 = xmalloc (buf_size);
00590
00591     do
00592     {
00593         read1 = block_read (fd1, buf1, buf_size);
00594         if (read1 == (size_t)-1)
00595         error (1, errno, "cannot read file %s for comparing", file1);
00596
00597         read2 = block_read (fd2, buf2, buf_size);
00598         if (read2 == (size_t)-1)
00599         error (1, errno, "cannot read file %s for comparing", file2);
00600
00601         /* assert (read1 == read2); */
00602
00603         ret = memcmp(buf1, buf2, read1);
00604     } while (ret == 0 && read1 == buf_size);
00605
00606     free (buf1);
00607     free (buf2);
00608     }
00609
00610     (void) close (fd1);
00611     (void) close (fd2);
00612     return (ret);
00613 }
00614
00615
00616 /* Just in case this implementation does not define this.  */
00617 #ifndef L_tmpnam
00618 #define L_tmpnam 50
00619 #endif
00620
00621
00622 #ifdef LOSING_TMPNAM_FUNCTION
00623 char *
00624 cvs_temp_name ()
00625 {
00626     char value[L_tmpnam + 1];
00627
00628     /* FIXME: Should be using TMPDIR.  */
00629     strcpy (value, "/tmp/cvsXXXXXX");
00630     mktemp (value);
00631     return xstrdup (value);
00632 }
00633 #else
00634 /* Generate a unique temporary filename.  Returns a pointer to a newly
00635    malloc'd string containing the name.  Returns successfully or not at
00636    all.  */
00637 char *
00638 cvs_temp_name ()
00639 {
00640     char value[L_tmpnam + 1];
00641     char *retval;
00642
00643     /* FIXME: should be using TMPDIR, perhaps by using tempnam on systems
00644        which have it.  */
00645     retval = tmpnam (value);
00646     if (retval == NULL)
00647     error (1, errno, "cannot generate temporary filename");
00648     return xstrdup (retval);
00649 }
00650 #endif
00651
00652
00653 /* Return non-zero iff FILENAME is absolute.
00654    Trivial under Unix, but more complicated under other systems.
00655    Under EMX let _fnisabs do all this work. */
00656 int
00657 isabsolute (filename)
00658     const char *filename;
00659 {
00660     return _fnisabs(filename);
00661 }
00662
00663
00664 /* Return a pointer into PATH's last component.  */
00665 char *
00666 last_component (path)
00667     char *path;
00668 {
00669     char *last;
00670
00671     /* We can't be sure here if 'path' is already slashified. */
00672     _fnslashify (path);
00673
00674     last = strrchr (path, '/');
00675
00676     if (last && (last != path))
00677         return last + 1;
00678     else
00679         return path;
00680 }
00681
00682 /* Return the home directory.  Returns a pointer to storage
00683    managed by this function or its callees (currently getenv).
00684    This function will return the same thing every time it is
00685    called.  */
00686 char *
00687 get_homedir ()
00688 {
00689     static char *home = NULL;
00690     char *env = getenv ("HOME");
00691     struct passwd *pw;
00692
00693     if (home != NULL)
00694     return home;
00695
00696     if (env)
00697     home = env;
00698     else if ((pw = (struct passwd *) getpwuid (getuid ()))
00699          && pw->pw_dir)
00700     home = xstrdup (pw->pw_dir);
00701     else
00702     return 0;
00703
00704     return home;
00705 }
00706
00707 /* See cvs.h for description.  On unix this does nothing, because the
00708    shell expands the wildcards.  Under EMX, use _fnexplode to get the
00709    expanded filenames */
00710 void
00711 expand_wild (argc, argv, pargc, pargv)
00712     int argc;
00713     char **argv;
00714     int *pargc;
00715     char ***pargv;
00716 {
00717     int i;
00718     *pargc = argc;
00719     *pargv = (char **) xmalloc (argc * sizeof (char *));
00720     for (i = 0; i < argc; ++i)
00721     (*pargv)[i] = xstrdup (argv[i]);
00722 }
00723
00724 unsigned char
00725 OS2_filename_classes[] =
00726 {
00727     0x00,0x01,0x02,0x03, 0x04,0x05,0x06,0x07,
00728     0x08,0x09,0x0a,0x0b, 0x0c,0x0d,0x0e,0x0f,
00729     0x10,0x11,0x12,0x13, 0x14,0x15,0x16,0x17,
00730     0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f,
00731     0x20,0x21,0x22,0x23, 0x24,0x25,0x26,0x27,
00732     0x28,0x29,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f,
00733     0x30,0x31,0x32,0x33, 0x34,0x35,0x36,0x37,
00734     0x38,0x39,0x3a,0x3b, 0x3c,0x3d,0x3e,0x3f,
00735     0x40,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
00736     0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
00737     0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
00738     0x78,0x79,0x7a,0x5b, 0x2f,0x5d,0x5e,0x5f,
00739     0x60,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
00740     0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
00741     0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
00742     0x78,0x79,0x7a,0x7b, 0x7c,0x7d,0x7e,0x7f,
00743     0x80,0x81,0x82,0x83, 0x84,0x85,0x86,0x87,
00744     0x88,0x89,0x8a,0x8b, 0x8c,0x8d,0x8e,0x8f,
00745     0x90,0x91,0x92,0x93, 0x94,0x95,0x96,0x97,
00746     0x98,0x99,0x9a,0x9b, 0x9c,0x9d,0x9e,0x9f,
00747     0xa0,0xa1,0xa2,0xa3, 0xa4,0xa5,0xa6,0xa7,
00748     0xa8,0xa9,0xaa,0xab, 0xac,0xad,0xae,0xaf,
00749     0xb0,0xb1,0xb2,0xb3, 0xb4,0xb5,0xb6,0xb7,
00750     0xb8,0xb9,0xba,0xbb, 0xbc,0xbd,0xbe,0xbf,
00751     0xc0,0xc1,0xc2,0xc3, 0xc4,0xc5,0xc6,0xc7,
00752     0xc8,0xc9,0xca,0xcb, 0xcc,0xcd,0xce,0xcf,
00753     0xd0,0xd1,0xd2,0xd3, 0xd4,0xd5,0xd6,0xd7,
00754     0xd8,0xd9,0xda,0xdb, 0xdc,0xdd,0xde,0xdf,
00755     0xe0,0xe1,0xe2,0xe3, 0xe4,0xe5,0xe6,0xe7,
00756     0xe8,0xe9,0xea,0xeb, 0xec,0xed,0xee,0xef,
00757     0xf0,0xf1,0xf2,0xf3, 0xf4,0xf5,0xf6,0xf7,
00758     0xf8,0xf9,0xfa,0xfb, 0xfc,0xfd,0xfe,0xff,
00759 };
00760
00761
00762 /* Like strcmp, but with the appropriate tweaks for file names.
00763    Under OS/2, filenames are case-insensitive but case-preserving, and
00764    both \ and / are path element separators.  */
00765 int
00766 fncmp (const char *n1, const char *n2)
00767 {
00768     char fn1[MAXNAMLEN], fn2[MAXNAMLEN];
00769
00770     strcpy (fn1, n1); _fnslashify(fn1);
00771     strcpy (fn2, n2); _fnslashify(fn2);
00772
00773     return _fncmp ((unsigned char *) fn1, (unsigned char *) fn2);
00774 }
00775
00776
00777 /* Fold characters in FILENAME to their canonical forms.
00778    If FOLD_FN_CHAR is not #defined, the system provides a default
00779    definition for this.  */
00780 void
00781 fnfold (char *filename)
00782 {
00783     while (*filename)
00784     {
00785         *filename = FOLD_FN_CHAR (*filename);
00786     filename++;
00787     }
00788 }
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


options.h File Reference

cvs-1.10/emx/options.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | PATCH_PROGRAM "patch"
#define | TMPDIR_DFLT "/tmp"
#define | EDITOR_DFLT "e"
#define | UMASK_DFLT 002
#define | CVS_ADMIN_GROUP "cvsadmin"
#define | RELATIVE_REPOS 1
#define | SERVER_FLOWCONTROL
#define | SERVER_HI_WATER (2 * 1024 * 1024)
#define | SERVER_LO_WATER (1 * 1024 * 1024)

Functions

void | exit ()

Define Documentation

#define CVS_ADMIN_GROUP "cvsadmin"

Definition at line 79 of file options.h.

#define EDITOR_DFLT "e"

Definition at line 55 of file options.h.

#define PATCH_PROGRAM "patch"

Definition at line 36 of file options.h.

#define RELATIVE_REPOS 1

Definition at line 98 of file options.h.

#define SERVER_FLOWCONTROL

Definition at line 190 of file options.h.

#define SERVER_HI_WATER (2 * 1024 * 1024)

Definition at line 191 of file options.h.

#define SERVER_LO_WATER (1 * 1024 * 1024)

Definition at line 192 of file options.h.

#define TMPDIR_DFLT "/tmp"

Definition at line 44 of file options.h.

#define UMASK_DFLT 002

Definition at line 68 of file options.h.

Function Documentation

void exit ( )

Generated on Sun Oct 21 12:42:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/emx/options.h Source File

cvs-1.10/emx/options.h

Go to the documentation of this file.
00001 /* src/options.h.  Generated automatically by configure.  */
00002 /*
00003  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00004  * Copyright (c) 1989-1992, Brian Berliner
00005  *
00006  * You may distribute under the terms of the GNU General Public License as
00007  * specified in the README file that comes with the CVS 1.4 kit.
00008  *
00009  * This file holds (most of) the configuration tweaks that can be made to
00010  * customize CVS for your site.  CVS comes configured for a typical SunOS 4.x
00011  * environment.  The comments for each configurable item are intended to be
00012  * self-explanatory.  All #defines are tested first to see if an over-riding
00013  * option was specified on the "make" command line.
00014  *
00015  * If special libraries are needed, you will have to edit the Makefile.in file
00016  * or the configure script directly.  Sorry.
00017  */
00018
00019 /*
00020  * For portability and heterogeneity reasons, CVS is shipped by
00021  * default using my own text-file version of the ndbm database library
00022  * in the src/myndbm.c file.  If you want better performance and are
00023  * not concerned about heterogeneous hosts accessing your modules
00024  * file, turn this option off.
00025  */
00026 #ifndef MY_NDBM
00027 #define MY_NDBM
00028 #endif
00029
00030 /*
00031  * The "patch" program to run when using the CVS server and accepting
00032  * patches across the network.  Specify a full pathname if your site
00033  * wants to use a particular patch.
00034  */
00035 #ifndef PATCH_PROGRAM
00036 #define PATCH_PROGRAM   "patch"
00037 #endif
00038
00039 /* Directory used for storing temporary files, if not overridden by
00040    environment variables or the -T global option.  There should be little
00041    need to change this (-T is a better mechanism if you need to use a
00042    different directory for temporary files).  */
00043 #ifndef TMPDIR_DFLT
00044 #define TMPDIR_DFLT "/tmp"
00045 #endif
00046
00047 /*
00048  * The default editor to use, if one does not specify the "-e" option
00049  * to cvs, or does not have an EDITOR environment variable.  I set
00050  * this to just "vi", and use the shell to find where "vi" actually
00051  * is.  This allows sites with /usr/bin/vi or /usr/ucb/vi to work
00052  * equally well (assuming that your PATH is reasonable).
00053  */
00054 #ifndef EDITOR_DFLT
00055 #define EDITOR_DFLT "e"
00056 #endif
00057
00058 /*
00059  * The default umask to use when creating or otherwise setting file or
00060  * directory permissions in the repository.  Must be a value in the
00061  * range of 0 through 0777.  For example, a value of 002 allows group
00062  * rwx access and world rx access; a value of 007 allows group rwx
00063  * access but no world access.  This value is overridden by the value
00064  * of the CVSUMASK environment variable, which is interpreted as an
00065  * octal number.
00066  */
00067 #ifndef UMASK_DFLT
00068 #define UMASK_DFLT  002
00069 #endif
00070
00071 /*
00072  * The cvs admin command is restricted to the members of the group
00073  * CVS_ADMIN_GROUP.  If this group does not exist, all users are
00074  * allowed to run cvs admin.  To disable the cvs admin for all users,
00075  * create an empty group CVS_ADMIN_GROUP.  To disable access control
00076  * for cvs admin, comment out the define below.
00077  */
00078 #ifndef CVS_ADMIN_GROUP
00079 #define CVS_ADMIN_GROUP "cvsadmin"
00080 #endif
00081
00082 /*
00083  * The Repository file holds the path to the directory within the
00084  * source repository that contains the RCS ,v files for each CVS
00085  * working directory.  This path is either a full-path or a path
00086  * relative to CVSROOT.
00087  *
00088  * The big advantage that I can see to having a relative path is that
00089  * one can change the physical location of the master source
00090  * repository, change the contents of CVS/Root files in your
00091  * checked-out code, and CVS will work without problems.
00092  *
00093  * Therefore, RELATIVE_REPOS is now the default.  In the future, this
00094  * is likely to disappear entirely as a compile-time (or other) option,
00095  * so if you have other software which relies on absolute pathnames,
00096  * update them.
00097  */
00098 #define RELATIVE_REPOS 1
00099
00100 /*
00101  * When committing or importing files, you must enter a log message.
00102  * Normally, you can do this either via the -m flag on the command
00103  * line or an editor will be started for you.  If you like to use
00104  * logging templates (the rcsinfo file within the $CVSROOT/CVSROOT
00105  * directory), you might want to force people to use the editor even
00106  * if they specify a message with -m.  Enabling FORCE_USE_EDITOR will
00107  * cause the -m message to be appended to the temp file when the
00108  * editor is started.
00109  */
00110 #ifndef FORCE_USE_EDITOR
00111 /* #define  FORCE_USE_EDITOR */
00112 #endif
00113
00114 /*
00115  * When locking the repository, some sites like to remove locks and
00116  * assume the program that created them went away if the lock has
00117  * existed for a long time.  This used to be the default for previous
00118  * versions of CVS.  CVS now attempts to be much more robust, so lock
00119  * files should not be left around by mistake. The new behaviour will
00120  * never remove old locks (they must now be removed by hand).
00121  * Enabling CVS_FUDGELOCKS will cause CVS to remove locks that are
00122  * older than CVSLCKAGE seconds.
00123  *
00124  * Use of this option is NOT recommended.
00125  */
00126 #ifndef CVS_FUDGELOCKS
00127 /* #define CVS_FUDGELOCKS */
00128 #endif
00129
00130 /*
00131  * When committing a permanent change, CVS and RCS make a log entry of
00132  * who committed the change.  If you are committing the change logged
00133  * in as "root" (not under "su" or other root-priv giving program),
00134  * CVS/RCS cannot determine who is actually making the change.
00135  *
00136  * As such, by default, CVS disallows changes to be committed by users
00137  * logged in as "root".  You can disable this option by commenting out
00138  * the lines below.
00139  */
00140 #ifdef CVS_BADROOT
00141 #undef  CVS_BADROOT
00142 #endif
00143
00144 /* Define this to enable the SETXID support.  The way to use this is
00145    to create a group with no users in it (except perhaps cvs
00146    administrators), set the cvs executable to setgid that group, chown
00147    all the repository files to that group, and change all directory
00148    permissions in the repository to 770.  The last person to modify a
00149    file will own it, but as long as directory permissions are set
00150    right that won't matter.  You'll need a system which inherits file
00151    groups from the parent directory (WARNING: using the wrong kind of
00152    system (I think Solaris 2.4 is the wrong kind, for example) will
00153    create a security hole!  You will receive no warning other than the
00154    fact that files in the working directory are owned by the group
00155    which cvs is setgid to).
00156
00157    One security hole which has been reported is that setgid is not
00158    turned off when the editor is invoked--most editors provide a way
00159    to execute a shell, or the user can specify an editor (this one is
00160    large enough to drive a truck through).  Don't assume that the
00161    holes described here are the only ones; I don't know how carefully
00162    SETXID has been inspected for security holes.  */
00163 #ifndef SETXID_SUPPORT
00164 /* #define SETXID_SUPPORT */
00165 #endif
00166
00167 /*
00168  * Should we build the password-authenticating client?  Whether to
00169  * include the password-authenticating _server_, on the other hand, is
00170  * set in config.h.
00171  */
00172 #ifdef CLIENT_SUPPORT
00173 #define AUTH_CLIENT_SUPPORT 1
00174 #endif
00175
00176 /*
00177  * If you are working with a large remote repository and a 'cvs
00178  * checkout' is swamping your network and memory, define these to
00179  * enable flow control.  You will end up with even less probability of
00180  * a consistent checkout (see Concurrency in cvs.texinfo), but CVS
00181  * doesn't try to guarantee that anyway.  The master server process
00182  * will monitor how far it is getting behind, if it reaches the high
00183  * water mark, it will signal the child process to stop generating
00184  * data when convenient (ie: no locks are held, currently at the
00185  * beginning of a new directory).  Once the buffer has drained
00186  * sufficiently to reach the low water mark, it will be signalled to
00187  * start again.  You may override the default hi/low watermarks here
00188  * too.
00189  */
00190 #define SERVER_FLOWCONTROL
00191 #define SERVER_HI_WATER (2 * 1024 * 1024)
00192 #define SERVER_LO_WATER (1 * 1024 * 1024)
00193
00194 /* End of CVS configuration section */
00195
00196 /*
00197  * Externs that are included in libc, but are used frequently enough
00198  * to warrant defining here.
00199  */
00200 #ifndef STDC_HEADERS
00201 extern void exit ();
00202 #endif
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcmd.h File Reference

cvs-1.10/emx/rcmd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int rcmd (const char **AHOST, unsigned short INPORT, char *LOCUSER, char *REMUSER, char *CMD, int *fd2p)

Function Documentation

int rcmd | ( | const char ** | AHOST,
 |  | unsigned short | INPORT,
 |  | char * | LOCUSER,
 |  | char * | REMUSER,
 |  | char * | CMD,
 |  | int * | fd2p
 | ) |

Definition at line 66 of file rcmd.c.

00072 {
00073     fprintf (stderr,
00074              "Error: rcmd() doesn't work.\n");
00075     exit (1);
00076 }

Generated on Sun Oct 21 12:42:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/emx/rcmd.h Source File

cvs-1.10/emx/rcmd.h

Go to the documentation of this file.
00001 /* rcmd.h --- interface to executing commands on remote hosts
00002    Karl Fogel <kfogel@cyclic.com> --- November 1995  */
00003
00004 /* This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 /* Run the command CMD on the host *AHOST, and return a file descriptor for
00015    a bidirectional stream socket connected to the command's standard input
00016    and output.
00017
00018    rcmd looks up *AHOST using gethostbyname, and sets *AHOST to the host's
00019    canonical name.  If *AHOST is not found, rcmd returns -1.
00020
00021    rcmd connects to the remote host at TCP port INPORT.  This should
00022    probably be the "shell" service, port 514.
00023
00024    LOCUSER is the name of the user on the local machine, and REMUSER is
00025    the name of the user on the remote machine; the remote machine uses this,
00026    along with the source address of the TCP connection, to authenticate
00027    the connection.
00028
00029    CMD is the command to execute.  The remote host will tokenize it any way
00030    it damn well pleases.  Welcome to Unix.
00031
00032    FD2P is a feature we don't support, but there's no point in making mindless
00033    deviations from the interface.  Callers should always pass this argument
00034    as zero.  */
00035
00036 /* Note that because we are using windows-NT/rcmd.c, this declaration
00037    must match windows-NT/rcmd.h (and rcmd.c).  It would be much
00038    more sensible to use a common header file.  But I haven't bothered to
00039    adjust the makefile accordingly, yet.  Probably the best long-term
00040    home for this would be in lib/rcmd.*, or perhaps src.  */
00041 extern int rcmd (const char **AHOST,
00042          unsigned short INPORT,
00043          char *LOCUSER,
00044          char *REMUSER,
00045          char *CMD,
00046          int *fd2p);
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


savecwd.c File Reference

cvs-1.10/emx/savecwd.c File Reference

#include <stdio.h>
#include <sys/file.h>
#include <errno.h>
#include "savecwd.h"
#include "error.h"

Include dependency graph for savecwd.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | fchdir(x) (abort (), 0)

Functions

char *xgetwd | __PROTO ((void))
int | save_cwd (cwd) struct saved_cwd *cwd

Variables

int | errno
const char * | dest

Define Documentation

#define fchdir ( x ) (abort (), 0)

Referenced by dest().

Function Documentation

char* xgetwd __PROTO ( (void) )

int save_cwd ( cwd )

Variable Documentation

const char* dest

Definition at line 112 of file savecwd.c.

int errno

Definition at line 31 of file savecwd.c.

Generated on Sun Oct 21 12:42:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/emx/savecwd.c Source File

cvs-1.10/emx/savecwd.c

Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 # include "config.h"
00003 #endif
00004
00005 #include <stdio.h>
00006
00007 #ifdef STDC_HEADERS
00008 # include <stdlib.h>
00009 #endif
00010
00011 #ifdef HAVE_UNISTD_H
00012 # include <unistd.h>
00013 #endif
00014
00015 #ifdef HAVE_FCNTL_H
00016 # include <fcntl.h>
00017 #else
00018 # include <sys/file.h>
00019 #endif
00020
00021 #ifdef HAVE_DIRECT_H
00022 # include <direct.h>
00023 #endif
00024
00025 #ifdef HAVE_IO_H
00026 # include <io.h>
00027 #endif
00028
00029 #include <errno.h>
00030 # ifndef errno
00031 extern int errno;
00032 #endif
00033
00034 #include "savecwd.h"
00035 #include "error.h"
00036
00037 char *xgetwd __PROTO((void));
00038
00039 /* Record the location of the current working directory in CWD so that
00040    the program may change to other directories and later use restore_cwd
00041    to return to the recorded location.  This function may allocate
00042    space using malloc (via xgetwd) or leave a file descriptor open;
00043    use free_cwd to perform the necessary free or close.  Upon failure,
00044    no memory is allocated, any locally opened file descriptors are
00045    closed;  return non-zero -- in that case, free_cwd need not be
00046    called, but doing so is ok.  Otherwise, return zero.  */
00047
00048 int
00049 save_cwd (cwd)
00050      struct saved_cwd *cwd;
00051 {
00052   static int have_working_fchdir = 1;
00053
00054   cwd->desc = -1;
00055   cwd->name = NULL;
00056
00057   if (have_working_fchdir)
00058     {
00059 #ifdef HAVE_FCHDIR
00060       cwd->desc = open (".", O_RDONLY);
00061       if (cwd->desc < 0)
00062     {
00063       error (0, errno, "cannot open current directory");
00064       return 1;
00065     }
00066
00067 # if __sun__ || sun
00068       /* On SunOS 4, fchdir returns EINVAL if accounting is enabled,
00069      so we have to fall back to chdir.  */
00070       if (fchdir (cwd->desc))
00071     {
00072       if (errno == EINVAL)
00073         {
00074           close (cwd->desc);
00075           cwd->desc = -1;
00076           have_working_fchdir = 0;
00077         }
00078       else
00079         {
00080           error (0, errno, "current directory");
00081           close (cwd->desc);
00082           cwd->desc = -1;
00083           return 1;
00084         }
00085     }
00086 # endif /* __sun__ || sun */
00087 #else
00088 #define fchdir(x) (abort (), 0)
00089       have_working_fchdir = 0;
00090 #endif
00091     }
00092
00093   if (!have_working_fchdir)
00094     {
00095       cwd->name = xgetwd ();
00096       if (cwd->name == NULL)
00097     {
00098       error (0, errno, "cannot get current directory");
00099       return 1;
00100     }
00101     }
00102   return 0;
00103 }
00104
00105 /* Change to recorded location, CWD, in directory hierarchy.
00106    If "saved working directory", NULL))
00107    */
00108
00109 int
00110 restore_cwd (cwd, dest)
00111      const struct saved_cwd *cwd;
00112      const char *dest;
00113 {
00114   int fail = 0;
00115   if (cwd->desc >= 0)
00116     {
00117       if (fchdir (cwd->desc))
00118     {
00119       error (0, errno, "cannot return to %s",
00120          (dest ? dest : "saved working directory"));
00121       fail = 1;
00122     }
00123     }
00124   else if (_chdir2 (cwd->name) < 0)
00125     {
00126       error (0, errno, "%s", cwd->name);
00127       fail = 1;
00128     }
00129   return fail;
00130 }
00131
00132 void
00133 free_cwd (cwd)
00134      struct saved_cwd *cwd;
00135 {
00136   if (cwd->desc >= 0)
00137     close (cwd->desc);
00138   if (cwd->name)
00139     free (cwd->name);
00140 }
00141
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


startserver.c File Reference

cvs-1.10/emx/startserver.c File Reference

#include <assert.h>
#include "cvs.h"
#include "rcmd.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include "options.h"

Include dependency graph for startserver.c:

Include dependency graph

Go to the source code of this file.

Functions

void | os2_start_server (int *tofd, int *fromfd, char *client_user, char *server_user, char *server_host, char *server_cvsroot)
void | os2_shutdown_server (int fd)

Variables

char * | cvs_server
char * | command
int | trace

Function Documentation

void os2_shutdown_server ( int fd )

Definition at line 76 of file startserver.c.

00077 {
00078     /* FIXME: shutdown on files seems to have no bad effects */
00079     if (shutdown (fd, 2) < 0 && errno != ENOTSOCK)
00080         error (1, 0, "couldn't shutdown server connection");
00081     if (close (fd) < 0)
00082         error (1, 0, "couldn't close server connection");
00083 }

void os2_start_server | ( | int * | tofd,
 |  | int * | fromfd,
 |  | char * | client_user,
 |  | char * | server_user,
 |  | char * | server_host,
 |  | char * | server_cvsroot
 | ) |

Definition at line 27 of file startserver.c.

00032 {
00033     int fd, port;
00034     char *portenv;
00035     struct servent *sptr;
00036     const char *rcmd_host = (const char *) server_host;
00037
00038     if (! (cvs_server = getenv ("CVS_SERVER")))
00039     cvs_server = "cvs";
00040     command = xmalloc (strlen (cvs_server)
00041              + strlen (server_cvsroot)
00042              + 50);
00043     sprintf (command, "%s server", cvs_server);
00044
00045     portenv = getenv ("CVS_RCMD_PORT");
00046     if (portenv)
00047     port = atoi (portenv);
00048     else if ((sptr = getservbyname ("shell", "tcp")) != NULL)
00049     port = sptr->s_port;
00050     else
00051     port = 514; /* shell/tcp */
00052
00053     if (trace)
00054     {
00055     fprintf (stderr, "os2_start_server(): connecting to %s:%d\n",
00056         server_host, port);
00057     fprintf (stderr, "local_user = %s, remote_user = %s, CVSROOT = %s\n",
00058         client_user, (server_user ? server_user : client_user),
00059         server_cvsroot);
00060     }
00061
00062     fd = rcmd (&rcmd_host, port,
00063            client_user,
00064            (server_user ? server_user : client_user),
00065            command, 0);
00066
00067     if (fd < 0)
00068     error (1, errno, "cannot start server via rcmd()");
00069
00070     *tofd = fd;
00071     *fromfd = fd;
00072     free (command);
00073 }

Variable Documentation

char* command [static]

Definition at line 22 of file startserver.c.

char* cvs_server [static]

Definition at line 21 of file startserver.c.

int trace

Definition at line 24 of file startserver.c.

Generated on Sun Oct 21 12:42:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/emx/startserver.c Source File

cvs-1.10/emx/startserver.c

Go to the documentation of this file.
00001 /* This program is free software; you can redistribute it and/or modify
00002    it under the terms of the GNU General Public License as published by
00003    the Free Software Foundation; either version 2, or (at your option)
00004    any later version.
00005
00006    This program is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009    GNU General Public License for more details.  */
00010
00011 #include <assert.h>
00012 #include "cvs.h"
00013 #include "rcmd.h"
00014
00015 #include <sys/types.h>
00016 #include <sys/socket.h>
00017 #include <netdb.h>
00018
00019 #include "options.h"
00020
00021 static char *cvs_server;
00022 static char *command;
00023
00024 extern int trace;
00025
00026 void
00027 os2_start_server (int *tofd, int *fromfd,
00028           char *client_user,
00029           char *server_user,
00030           char *server_host,
00031           char *server_cvsroot)
00032 {
00033     int fd, port;
00034     char *portenv;
00035     struct servent *sptr;
00036     const char *rcmd_host = (const char *) server_host;
00037
00038     if (! (cvs_server = getenv ("CVS_SERVER")))
00039     cvs_server = "cvs";
00040     command = xmalloc (strlen (cvs_server)
00041              + strlen (server_cvsroot)
00042              + 50);
00043     sprintf (command, "%s server", cvs_server);
00044
00045     portenv = getenv ("CVS_RCMD_PORT");
00046     if (portenv)
00047     port = atoi (portenv);
00048     else if ((sptr = getservbyname ("shell", "tcp")) != NULL)
00049     port = sptr->s_port;
00050     else
00051     port = 514; /* shell/tcp */
00052
00053     if (trace)
00054     {
00055     fprintf (stderr, "os2_start_server(): connecting to %s:%d\n",
00056         server_host, port);
00057     fprintf (stderr, "local_user = %s, remote_user = %s, CVSROOT = %s\n",
00058         client_user, (server_user ? server_user : client_user),
00059         server_cvsroot);
00060     }
00061
00062     fd = rcmd (&rcmd_host, port,
00063            client_user,
00064            (server_user ? server_user : client_user),
00065            command, 0);
00066
00067     if (fd < 0)
00068     error (1, errno, "cannot start server via rcmd()");
00069
00070     *tofd = fd;
00071     *fromfd = fd;
00072     free (command);
00073 }
00074
00075 void
00076 os2_shutdown_server (int fd)
00077 {
00078     /* FIXME: shutdown on files seems to have no bad effects */
00079     if (shutdown (fd, 2) < 0 && errno != ENOTSOCK)
00080         error (1, 0, "couldn't shutdown server connection");
00081     if (close (fd) < 0)
00082         error (1, 0, "couldn't close server connection");
00083 }
00084
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


stripslash.c File Reference

cvs-1.10/emx/stripslash.c File Reference

#include <string.h>

Include dependency graph for stripslash.c:

Include dependency graph

Go to the source code of this file.

Functions

void strip_trailing_slashes (path) char *path

Function Documentation

void strip_trailing_slashes ( path )

Generated on Sun Oct 21 12:42:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/emx/stripslash.c Source File

cvs-1.10/emx/stripslash.c

Go to the documentation of this file.
00001 /* stripslash.c -- remove trailing slashes from a string
00002    Copyright (C) 1990 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #include <string.h>
00015
00016 /* Remove trailing slashes from PATH. */
00017
00018 void
00019 strip_trailing_slashes (path)
00020      char *path;
00021 {
00022   int last;
00023
00024   last = strlen (path) - 1;
00025   while (last > 0 && (path[last] == '/' || path[last] == '\\'))
00026     path[last--] = '\0';
00027 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/emx/system.c Source File

cvs-1.10/emx/system.c

Go to the documentation of this file.
00001 /* This program is free software; you can redistribute it and/or modify
00002    it under the terms of the GNU General Public License as published by
00003    the Free Software Foundation; either version 2, or (at your option)
00004    any later version.
00005
00006    This program is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009    GNU General Public License for more details.  */
00010
00011 #include <io.h>
00012 #include <stdio.h>
00013 #include <stdlib.h>
00014 #include <sys/types.h>
00015 #include <sys/stat.h>
00016 #include <sys/param.h>
00017 #include <fnmatch.h>
00018
00019
00020 /* Expand wildcards in argv.  We probably should be expanding wildcards
00021    via expand_wild instead; that way we could expand only filenames and
00022    not tag names and the like.  */
00023
00024 void
00025 os2_initialize (pargc, pargv)
00026     int *pargc;
00027     char **pargv[];
00028 {
00029     _wildcard (pargc, pargv);
00030 }
00031
00032
00033 /* Modifies 'stat' so that always the same inode is returned.  EMX never
00034    returns the same value for st_ino.  Without this modification,
00035    release_delete in module src/release.c refuses to work.  Care must
00036    be taken if someone is using the value of st_ino (but as far as I know,
00037    no callers are).  */
00038
00039 int
00040 os2_stat (name, buffer)
00041     const char *name;
00042     struct stat *buffer;
00043 {
00044     int rc = stat (name, buffer);
00045
00046     /* There are no inodes on OS/2.  */
00047     buffer->st_ino = 42;
00048
00049     return rc;
00050 }
00051
00052
00053 /* We must not only change the directory, but also the current drive.
00054    Otherwise it is be impossible to have the working directory and the
00055    repository on different drives.  */
00056
00057 int
00058 os2_chdir (name)
00059     const char *name;
00060 {
00061     return _chdir2 (name);
00062 }
00063
00064
00065 /* getwd must return a drive specification.  */
00066
00067 char *
00068 xgetwd ()
00069 {
00070     return _getcwd2 (NULL, 1);
00071 }
00072
00073
00074 /* fnmatch must recognize OS/2 filename conventions: Filename case
00075    must be preserved, but ignored in searches.  It would perhaps be better
00076    to just have CVS pick how to match based on FILENAMES_CASE_INSENSITIVE
00077    or something rather than having an OS/2-specific version of CVS_FNMATCH.
00078    Note that lib/fnmatch.c uses FOLD_FN_CHAR; that is how we get
00079    case-insensitivity on NT (and VMS, I think).  */
00080
00081 #define _FNM_OS2           1
00082 #define _FNM_IGNORECASE    128
00083
00084 int
00085 os2_fnmatch (pattern, name, flags)
00086     const char *pattern;
00087     const char *name;
00088     int flags;
00089 {
00090     return fnmatch (pattern, name, _FNM_IGNORECASE | _FNM_OS2 | flags);
00091 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/argmatch.c Source File

cvs-1.10/lib/argmatch.c

Go to the documentation of this file.
00001 /* argmatch.c -- find a match for a string in an array
00002    Copyright (C) 1990 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 /* Written by David MacKenzie <djm@ai.mit.edu> */
00015
00016 #ifdef HAVE_CONFIG_H
00017 #include "config.h"
00018 #endif
00019
00020 #include <sys/types.h>
00021
00022 #include <stdio.h>
00023 #ifdef STDC_HEADERS
00024 #include <string.h>
00025 #endif
00026
00027 extern char *program_name;
00028
00029 /* If ARG is an unambiguous match for an element of the
00030    null-terminated array OPTLIST, return the index in OPTLIST
00031    of the matched element, else -1 if it does not match any element
00032    or -2 if it is ambiguous (is a prefix of more than one element). */
00033
00034 int
00035 argmatch (arg, optlist)
00036      char *arg;
00037      char **optlist;
00038 {
00039   int i;            /* Temporary index in OPTLIST. */
00040   size_t arglen;        /* Length of ARG. */
00041   int matchind = -1;        /* Index of first nonexact match. */
00042   int ambiguous = 0;        /* If nonzero, multiple nonexact match(es). */
00043
00044   arglen = strlen (arg);
00045
00046   /* Test all elements for either exact match or abbreviated matches.  */
00047   for (i = 0; optlist[i]; i++)
00048     {
00049       if (!strncmp (optlist[i], arg, arglen))
00050     {
00051       if (strlen (optlist[i]) == arglen)
00052         /* Exact match found.  */
00053         return i;
00054       else if (matchind == -1)
00055         /* First nonexact match found.  */
00056         matchind = i;
00057       else
00058         /* Second nonexact match found.  */
00059         ambiguous = 1;
00060     }
00061     }
00062   if (ambiguous)
00063     return -2;
00064   else
00065     return matchind;
00066 }
00067
00068 /* Error reporting for argmatch.
00069    KIND is a description of the type of entity that was being matched.
00070    VALUE is the invalid value that was given.
00071    PROBLEM is the return value from argmatch. */
00072
00073 void
00074 invalid_arg (kind, value, problem)
00075      char *kind;
00076      char *value;
00077      int problem;
00078 {
00079   fprintf (stderr, "%s: ", program_name);
00080   if (problem == -1)
00081     fprintf (stderr, "invalid");
00082   else              /* Assume -2. */
00083     fprintf (stderr, "ambiguous");
00084   fprintf (stderr, " %s `%s'\n", kind, value);
00085 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/dup2.c Source File

cvs-1.10/lib/dup2.c

Go to the documentation of this file.
00001 /*
00002     dup2 -- 7th Edition UNIX system call emulation for UNIX System V
00003
00004     last edit:  11-Feb-1987 D A Gwyn
00005 */
00006
00007 #ifdef HAVE_CONFIG_H
00008 #include "config.h"
00009 #endif
00010
00011 #include    <errno.h>
00012 #include    <fcntl.h>
00013
00014 extern int  close(), fcntl();
00015
00016 int
00017 dup2( oldfd, newfd )
00018     int     oldfd;      /* already-open file descriptor */
00019     int     newfd;      /* desired duplicate descriptor */
00020 {
00021     register int    ret;        /* for fcntl() return value */
00022     register int    save;       /* for saving entry errno */
00023
00024     if ( oldfd == newfd )
00025         return oldfd;       /* be careful not to close() */
00026
00027     save = errno;           /* save entry errno */
00028     (void) close( newfd );      /* in case newfd is open */
00029     /* (may have just clobbered the original errno value) */
00030
00031     ret = fcntl( oldfd, F_DUPFD, newfd );   /* dupe it */
00032
00033     if ( ret >= 0 )
00034         errno = save;       /* restore entry errno */
00035     else                /* fcntl() returned error */
00036         if ( errno == EINVAL )
00037             errno = EBADF;  /* we think of everything */
00038
00039     return ret;         /* return file descriptor */
00040 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/fncase.c Source File

cvs-1.10/lib/fncase.c

Go to the documentation of this file.
00001 /* fncase.c -- CVS support for case insensitive file systems.
00002    Jim Blandy <jimb@cyclic.com>
00003
00004    This file is part of GNU CVS.
00005
00006    GNU CVS is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published by the
00008    Free Software Foundation; either version 2, or (at your option) any
00009    later version.
00010
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.  */
00015
00016 #ifdef HAVE_CONFIG_H
00017 #include "config.h"
00018 #endif
00019
00020 #include "system.h"
00021
00022 /* The equivalence class mapping for filenames.
00023    Windows NT filenames are case-insensitive, but case-preserving.
00024    Both / and \ are path element separators.
00025    Thus, this table maps both upper and lower case to lower case, and
00026    both / and \ to /.  */
00027
00028 #if 0
00029 main ()
00030 {
00031   int c;
00032
00033   for (c = 0; c < 256; c++)
00034     {
00035       int t;
00036
00037       if (c == '\\')
00038         t = '/';
00039       else
00040         t = tolower (c);
00041
00042       if ((c & 0x7) == 0x0)
00043          printf ("    ");
00044       printf ("0x%02x,", t);
00045       if ((c & 0x7) == 0x7)
00046          putchar ('\n');
00047       else if ((c & 0x7) == 0x3)
00048          putchar (' ');
00049     }
00050 }
00051 #endif
00052
00053 unsigned char
00054 WNT_filename_classes[] =
00055 {
00056     0x00,0x01,0x02,0x03, 0x04,0x05,0x06,0x07,
00057     0x08,0x09,0x0a,0x0b, 0x0c,0x0d,0x0e,0x0f,
00058     0x10,0x11,0x12,0x13, 0x14,0x15,0x16,0x17,
00059     0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f,
00060     0x20,0x21,0x22,0x23, 0x24,0x25,0x26,0x27,
00061     0x28,0x29,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f,
00062     0x30,0x31,0x32,0x33, 0x34,0x35,0x36,0x37,
00063     0x38,0x39,0x3a,0x3b, 0x3c,0x3d,0x3e,0x3f,
00064     0x40,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
00065     0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
00066     0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
00067     0x78,0x79,0x7a,0x5b, 0x2f,0x5d,0x5e,0x5f,
00068     0x60,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
00069     0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
00070     0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
00071     0x78,0x79,0x7a,0x7b, 0x7c,0x7d,0x7e,0x7f,
00072     0x80,0x81,0x82,0x83, 0x84,0x85,0x86,0x87,
00073     0x88,0x89,0x8a,0x8b, 0x8c,0x8d,0x8e,0x8f,
00074     0x90,0x91,0x92,0x93, 0x94,0x95,0x96,0x97,
00075     0x98,0x99,0x9a,0x9b, 0x9c,0x9d,0x9e,0x9f,
00076     0xa0,0xa1,0xa2,0xa3, 0xa4,0xa5,0xa6,0xa7,
00077     0xa8,0xa9,0xaa,0xab, 0xac,0xad,0xae,0xaf,
00078     0xb0,0xb1,0xb2,0xb3, 0xb4,0xb5,0xb6,0xb7,
00079     0xb8,0xb9,0xba,0xbb, 0xbc,0xbd,0xbe,0xbf,
00080     0xc0,0xc1,0xc2,0xc3, 0xc4,0xc5,0xc6,0xc7,
00081     0xc8,0xc9,0xca,0xcb, 0xcc,0xcd,0xce,0xcf,
00082     0xd0,0xd1,0xd2,0xd3, 0xd4,0xd5,0xd6,0xd7,
00083     0xd8,0xd9,0xda,0xdb, 0xdc,0xdd,0xde,0xdf,
00084     0xe0,0xe1,0xe2,0xe3, 0xe4,0xe5,0xe6,0xe7,
00085     0xe8,0xe9,0xea,0xeb, 0xec,0xed,0xee,0xef,
00086     0xf0,0xf1,0xf2,0xf3, 0xf4,0xf5,0xf6,0xf7,
00087     0xf8,0xf9,0xfa,0xfb, 0xfc,0xfd,0xfe,0xff,
00088 };
00089
00090 /* Like strcmp, but with the appropriate tweaks for file names.
00091    Under Windows NT, filenames are case-insensitive but case-preserving,
00092    and both \ and / are path element separators.  */
00093 int
00094 fncmp (const char *n1, const char *n2)
00095 {
00096     while (*n1 && *n2
00097            && (WNT_filename_classes[(unsigned char) *n1]
00098            == WNT_filename_classes[(unsigned char) *n2]))
00099         n1++, n2++;
00100     return (WNT_filename_classes[(unsigned char) *n1]
00101             - WNT_filename_classes[(unsigned char) *n2]);
00102 }
00103
00104 /* Fold characters in FILENAME to their canonical forms.
00105    If FOLD_FN_CHAR is not #defined, the system provides a default
00106    definition for this.  */
00107 void
00108 fnfold (char *filename)
00109 {
00110     while (*filename)
00111     {
00112         *filename = FOLD_FN_CHAR (*filename);
00113     filename++;
00114     }
00115 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


system.c File Reference

cvs-1.10/emx/system.c File Reference

#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <fnmatch.h>

Include dependency graph for system.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | _FNM_OS2 1
#define | _FNM_IGNORECASE 128

Functions

void | os2_initialize (pargc, pargv) int *pargc

Variables

char ** | pargv []
stat * | buffer
const char * | name
int | flags

Define Documentation

#define _FNM_IGNORECASE 128

#define _FNM_OS2 1

Function Documentation

void os2_initialize | ( | pargc | ,
 |  | pargv |
 | ) |

Variable Documentation

struct stat* buffer

Definition at line 42 of file system.c.

int flags

Definition at line 88 of file system.c.

const char * name

Definition at line 6830 of file rcs.c.

char** pargv[]

Definition at line 27 of file system.c.

Generated on Sun Oct 21 12:42:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


argmatch.c File Reference

cvs-1.10/lib/argmatch.c File Reference

#include <sys/types.h>
#include <stdio.h>

Include dependency graph for argmatch.c:

Include dependency graph

Go to the source code of this file.

Functions

int | argmatch (arg, optlist) char *arg

Variables

char * | program_name
char ** | optlist
char * | value
int | problem

Function Documentation

int argmatch | ( | arg | ,
 |  | optlist |
 | ) |

Variable Documentation

char** optlist

Definition at line 37 of file argmatch.c.

int problem

Definition at line 77 of file argmatch.c.

char* program_name

Definition at line 27 of file argmatch.c.

char* value

Definition at line 76 of file argmatch.c.

Generated on Sun Oct 21 12:42:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dup2.c File Reference

cvs-1.10/lib/dup2.c File Reference

#include <errno.h>
#include <fcntl.h>

Include dependency graph for dup2.c:

Include dependency graph

Go to the source code of this file.

Functions

int | close (), fcntl()
int | dup2 (oldfd, newfd) int oldfd

Variables

int | newfd

Function Documentation

int close ( )

Referenced by argv(), cvs_process_close(), cvs_process_open(), depth(), macos_cleanup(), macos_shutdown_server(), os2_shutdown_server(), rcmd(), and wnt_shutdown_server().

int dup2 | ( | oldfd | ,
 |  | newfd |
 | ) |

Referenced by depth().

Variable Documentation

int newfd

Definition at line 19 of file dup2.c.

Generated on Sun Oct 21 12:42:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


fncase.c File Reference

cvs-1.10/lib/fncase.c File Reference

#include "system.h"

Include dependency graph for fncase.c:

Include dependency graph

Go to the source code of this file.

Functions

int | strcmp (const char *n1, const char *n2)
void (char *filename)

Variables

unsigned char | WNT_filename_classes []

Function Documentation

int strcmp | ( | const char * | n1,
 |  | const char * | n2
 | ) |

Definition at line 94 of file fncase.c.

Referenced by TMString::Compare(), CKeyString::Compare(), EntnodeData::Compare(), KoConflictColumn::Compare(), KoTagColumn::Compare(), KoOptionColumn::Compare(), UObject::CreateObject(), CustGetByKey(), Entries_SetVisited(), FileTraverse(), CPersistent::Find(), PyCvsEntry::GetAttr(), CBrowseFileView::GetImageForEntry(), UCvsFiles::GetImageForEntry(), UCvsFolders::GetItemByLocation(), CWinLogData::IsDeadNode(), CWinLogData::IsDiskNode(), IsInInvertList(), KoFilterModel::IsMatch(), CWinLogData::IsUserState(), LookupWord(), ReportConflict::Match(), UWidget::OnComboAppend(), TBrowserFill::OnDirectory(), TBrowserFillDummy::OnDirectory(), TViewFill::OnDirectory(), CFillTclEntries::OnDirectory(), CFillPyEntries::OnDirectory(), ImportReport::OnDirectory(), AuthenRhosts::OnGetEnv(), AuthenPserver::OnGetEnv(), AuthenSSH::OnGetEnv(), CGraphView::OnGraphSetstate(), CPersistent::Register(), UCvsFiles::Search(), UCvsFolders::StepToLocation(), TestValidName(), UWinPseudoWindowProc(), VolName2VRef(), _Compare(), _loadPersistentSettings(), argv(), UStr::compare(), compareConflict(), compareOption(), compareTag(), getDefaultEncodingPolicy(), glue_getenv(), CvsPrefs::has_cvsroot_in_list(), loadSettingsInternal(), local(), macos_fixpath(), main(), UStr::operator!=(), UStr::operator<(), CvsString::operator==(), UStr::operator==(), UStr::operator>(), r(), CFindSettings::searchAllPath(), CFindSettings::searchPath(), tclCvsBrowserProc(), tclCvsExitOnErrorProc(), Authen::tokenToKind(), unmodified(), width(), and yesno().

00095 {
00096     while (*n1 && *n2
00097            && (WNT_filename_classes[(unsigned char) *n1]
00098            == WNT_filename_classes[(unsigned char) *n2]))
00099         n1++, n2++;
00100     return (WNT_filename_classes[(unsigned char) *n1]
00101             - WNT_filename_classes[(unsigned char) *n2]);
00102 }

void ( char * filename )

Definition at line 108 of file fncase.c.

Referenced by call_diff_file_callbacks().

00109 {
00110     while (*filename)
00111     {
00112         *filename = FOLD_FN_CHAR (*filename);
00113     filename++;
00114     }
00115 }

Variable Documentation

unsigned char WNT_filename_classes[]

Definition at line 54 of file fncase.c.

Generated on Sun Oct 21 12:42:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


fnmatch.c File Reference

cvs-1.10/lib/fnmatch.c File Reference

#include "system.h"
#include <errno.h>
#include <fnmatch.h>

Include dependency graph for fnmatch.c:

Include dependency graph

Go to the source code of this file.

Functions

int | fnmatch (pattern, string, flags) char *pattern

Variables

int | errno
char * | string
int | flags

Function Documentation

int fnmatch | ( | pattern | ,
 |  | string | ,
 |  | flags |
 | ) |

Variable Documentation

int errno

Definition at line 30 of file fnmatch.c.

int flags

Definition at line 42 of file fnmatch.c.

char* string

Definition at line 41 of file fnmatch.c.

Generated on Sun Oct 21 12:42:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/fnmatch.c Source File

cvs-1.10/lib/fnmatch.c

Go to the documentation of this file.
00001 /* Copyright (C) 1992 Free Software Foundation, Inc.
00002 This file is part of the GNU C Library.
00003
00004 The GNU C Library is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU Library General Public License as
00006 published by the Free Software Foundation; either version 2 of the
00007 License, or (at your option) any later version.
00008
00009 The GNU C Library is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 Library General Public License for more details.  */
00013
00014 /* Modified slightly by Brian Berliner <berliner@sun.com> and
00015    Jim Blandy <jimb@cyclic.com> for CVS use */
00016
00017 #ifdef HAVE_CONFIG_H
00018 #include "config.h"
00019 #endif
00020
00021 #include "system.h"
00022
00023 /* IGNORE(@ */
00024 /* #include <ansidecl.h> */
00025 /* @) */
00026 #include <errno.h>
00027 #include <fnmatch.h>
00028
00029 #if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
00030 extern int errno;
00031 #endif
00032
00033 /* Match STRING against the filename pattern PATTERN, returning zero if
00034    it matches, nonzero if not.  */
00035 int
00036 #if __STDC__
00037 fnmatch (const char *pattern, const char *string, int flags)
00038 #else
00039 fnmatch (pattern, string, flags)
00040     char *pattern;
00041     char *string;
00042     int flags;
00043 #endif
00044 {
00045   register const char *p = pattern, *n = string;
00046   register char c;
00047
00048   if ((flags & ~__FNM_FLAGS) != 0)
00049     {
00050       errno = EINVAL;
00051       return -1;
00052     }
00053
00054   while ((c = *p++) != '\0')
00055     {
00056       switch (c)
00057     {
00058     case '?':
00059       if (*n == '\0')
00060         return FNM_NOMATCH;
00061       else if ((flags & FNM_PATHNAME) && *n == '/')
00062         return FNM_NOMATCH;
00063       else if ((flags & FNM_PERIOD) && *n == '.' &&
00064            (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
00065         return FNM_NOMATCH;
00066       break;
00067
00068     case '\\':
00069       if (!(flags & FNM_NOESCAPE))
00070         c = *p++;
00071       if (FOLD_FN_CHAR (*n) != FOLD_FN_CHAR (c))
00072         return FNM_NOMATCH;
00073       break;
00074
00075     case '*':
00076       if ((flags & FNM_PERIOD) && *n == '.' &&
00077           (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
00078         return FNM_NOMATCH;
00079
00080       for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
00081         if (((flags & FNM_PATHNAME) && *n == '/') ||
00082         (c == '?' && *n == '\0'))
00083           return FNM_NOMATCH;
00084
00085       if (c == '\0')
00086         return 0;
00087
00088       {
00089         char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
00090         for (--p; *n != '\0'; ++n)
00091           if ((c == '[' || FOLD_FN_CHAR (*n) == FOLD_FN_CHAR (c1)) &&
00092           fnmatch(p, n, flags & ~FNM_PERIOD) == 0)
00093         return 0;
00094         return FNM_NOMATCH;
00095       }
00096
00097     case '[':
00098       {
00099         /* Nonzero if the sense of the character class is inverted.  */
00100         register int not;
00101
00102         if (*n == '\0')
00103           return FNM_NOMATCH;
00104
00105         if ((flags & FNM_PERIOD) && *n == '.' &&
00106         (n == string || ((flags & FNM_PATHNAME) && n[-1] == '/')))
00107           return FNM_NOMATCH;
00108
00109         not = (*p == '!' || *p == '^');
00110         if (not)
00111           ++p;
00112
00113         c = *p++;
00114         for (;;)
00115           {
00116         register char cstart = c, cend = c;
00117
00118         if (!(flags & FNM_NOESCAPE) && c == '\\')
00119           cstart = cend = *p++;
00120
00121         if (c == '\0')
00122           /* [ (unterminated) loses.  */
00123           return FNM_NOMATCH;
00124
00125         c = *p++;
00126
00127         if ((flags & FNM_PATHNAME) && c == '/')
00128           /* [/] can never match.  */
00129           return FNM_NOMATCH;
00130
00131         if (c == '-' && *p != ']')
00132           {
00133             cend = *p++;
00134             if (!(flags & FNM_NOESCAPE) && cend == '\\')
00135               cend = *p++;
00136             if (cend == '\0')
00137               return FNM_NOMATCH;
00138             c = *p++;
00139           }
00140
00141         if (*n >= cstart && *n <= cend)
00142           goto matched;
00143
00144         if (c == ']')
00145           break;
00146           }
00147         if (!not)
00148           return FNM_NOMATCH;
00149         break;
00150
00151       matched:;
00152         /* Skip the rest of the [...] that already matched.  */
00153         while (c != ']')
00154           {
00155         if (c == '\0')
00156           /* [... (unterminated) loses.  */
00157           return FNM_NOMATCH;
00158
00159         c = *p++;
00160         if (!(flags & FNM_NOESCAPE) && c == '\\')
00161           /* 1003.2d11 is unclear if this is right.  %%% */
00162           ++p;
00163           }
00164         if (not)
00165           return FNM_NOMATCH;
00166       }
00167       break;
00168
00169     default:
00170       if (FOLD_FN_CHAR (c) != FOLD_FN_CHAR (*n))
00171         return FNM_NOMATCH;
00172     }
00173
00174       ++n;
00175     }
00176
00177   if (*n == '\0')
00178     return 0;
00179
00180   return FNM_NOMATCH;
00181 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


fnmatch.h File Reference

cvs-1.10/lib/fnmatch.h File Reference

Go to the source code of this file.

Defines

#define | _FNMATCH_H 1
#define | FNM_PATHNAME (1 << 0)
#define | FNM_NOESCAPE (1 << 1)
#define | FNM_PERIOD (1 << 2)
#define | __FNM_FLAGS (FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD)
#define | FNM_NOMATCH 1

Functions

int | fnmatch ()

Define Documentation

#define FNM_NOESCAPE (1 << 1)

Definition at line 22 of file fnmatch.h.

#define FNM_NOMATCH 1

Definition at line 30 of file fnmatch.h.

#define FNM_PATHNAME (1 << 0)

Definition at line 20 of file fnmatch.h.

#define FNM_PERIOD (1 << 2)

Definition at line 24 of file fnmatch.h.

#define _FNMATCH_H 1

Definition at line 16 of file fnmatch.h.

#define __FNM_FLAGS (FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD)

Definition at line 26 of file fnmatch.h.

Function Documentation

int fnmatch ( )

Generated on Sun Oct 21 12:42:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/fnmatch.h Source File

cvs-1.10/lib/fnmatch.h

Go to the documentation of this file.
00001 /* Copyright (C) 1992 Free Software Foundation, Inc.
00002 This file is part of the GNU C Library.
00003
00004 The GNU C Library is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU Library General Public License as
00006 published by the Free Software Foundation; either version 2 of the
00007 License, or (at your option) any later version.
00008
00009 The GNU C Library is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 Library General Public License for more details.  */
00013
00014 #ifndef _FNMATCH_H
00015
00016 #define _FNMATCH_H  1
00017
00018 /* Bits set in the FLAGS argument to `fnmatch'.  */
00019 #undef FNM_PATHNAME
00020 #define FNM_PATHNAME    (1 << 0)/* No wildcard can ever match `/'.  */
00021 #undef FNM_NOESCAPE
00022 #define FNM_NOESCAPE    (1 << 1)/* Backslashes don't quote special chars.  */
00023 #undef FNM_PERIOD
00024 #define FNM_PERIOD  (1 << 2)/* Leading `.' is matched only explicitly.  */
00025 #undef __FNM_FLAGS
00026 #define __FNM_FLAGS (FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD)
00027
00028 /* Value returned by `fnmatch' if STRING does not match PATTERN.  */
00029 #undef FNM_NOMATCH
00030 #define FNM_NOMATCH 1
00031
00032 /* Match STRING against the filename pattern PATTERN,
00033    returning zero if it matches, FNM_NOMATCH if not.  */
00034 #if __STDC__
00035 extern int fnmatch (const char *pattern, const char *string, int flags);
00036 #else
00037 extern int fnmatch ();
00038 #endif
00039
00040 #endif  /* fnmatch.h */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/ftruncate.c Source File

cvs-1.10/lib/ftruncate.c

Go to the documentation of this file.
00001 /* ftruncate emulations that work on some System V's.
00002    This file is in the public domain. */
00003
00004 #ifdef HAVE_CONFIG_H
00005 #include "config.h"
00006 #endif
00007
00008 #include <sys/types.h>
00009 #include <fcntl.h>
00010
00011 #ifdef F_CHSIZE
00012 int
00013 ftruncate (fd, length)
00014      int fd;
00015      off_t length;
00016 {
00017   return fcntl (fd, F_CHSIZE, length);
00018 }
00019 #else
00020 #ifdef F_FREESP
00021 /* The following function was written by
00022    kucharsk@Solbourne.com (William Kucharski) */
00023
00024 #include <sys/stat.h>
00025 #include <errno.h>
00026 #include <unistd.h>
00027
00028 int
00029 ftruncate (fd, length)
00030      int fd;
00031      off_t length;
00032 {
00033   struct flock fl;
00034   struct stat filebuf;
00035
00036   if (fstat (fd, &filebuf) < 0)
00037     return -1;
00038
00039   if (filebuf.st_size < length)
00040     {
00041       /* Extend file length. */
00042       if (lseek (fd, (length - 1), SEEK_SET) < 0)
00043     return -1;
00044
00045       /* Write a "0" byte. */
00046       if (write (fd, "", 1) != 1)
00047     return -1;
00048     }
00049   else
00050     {
00051       /* Truncate length. */
00052       fl.l_whence = 0;
00053       fl.l_len = 0;
00054       fl.l_start = length;
00055       fl.l_type = F_WRLCK;  /* Write lock on file space. */
00056
00057       /* This relies on the UNDOCUMENTED F_FREESP argument to
00058      fcntl, which truncates the file so that it ends at the
00059      position indicated by fl.l_start.
00060      Will minor miracles never cease? */
00061       if (fcntl (fd, F_FREESP, &fl) < 0)
00062     return -1;
00063     }
00064
00065   return 0;
00066 }
00067 #else
00068 int
00069 ftruncate (fd, length)
00070      int fd;
00071      off_t length;
00072 {
00073   return chsize (fd, length);
00074 }
00075 #endif
00076 #endif
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ftruncate.c File Reference

cvs-1.10/lib/ftruncate.c File Reference

#include <sys/types.h>
#include <fcntl.h>

Include dependency graph for ftruncate.c:

Include dependency graph

Go to the source code of this file.

Functions

int | ftruncate (fd, length) int fd

Variables

off_t | length

Function Documentation

int ftruncate | ( | fd | ,
 |  | length |
 | ) |

Variable Documentation

off_t length

Definition at line 71 of file ftruncate.c.

Generated on Sun Oct 21 12:42:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getdate.c File Reference

cvs-1.10/lib/getdate.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <time.h>

Include dependency graph for getdate.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | _TABLE
struct | timeb
struct | yystack
union | YYSTYPE

Defines

#define | YYBYACC 1
#define | YYMAJOR 1
#define | YYMINOR 9
#define | YYEMPTY (-1)
#define | YYLEX yylex()
#define | yyclearin (yychar=YYEMPTY)
#define | yyerrok (yyerrflag=0)
#define | YYRECOVERING (yyerrflag!=0)
#define | YYPREFIX "yy"
#define | yyparse getdate_yyparse
#define | yylex getdate_yylex
#define | yyerror getdate_yyerror
#define | yydebug getdate_yydebug
#define | yynerrs getdate_yynerrs
#define | yychar getdate_yychar
#define | yylval getdate_yylval
#define | EPOCH 1970
#define | HOUR(x) ((time_t)(x) * 60)
#define | SECSPERDAY (24L * 60L * 60L)
#define | tAGO 257
#define | tDAY 258
#define | tDAYZONE 259
#define | tID 260
#define | tMERIDIAN 261
#define | tMINUTE_UNIT 262
#define | tMONTH 263
#define | tMONTH_UNIT 264
#define | tSEC_UNIT 265
#define | tSNUMBER 266
#define | tUNUMBER 267
#define | tZONE 268
#define | tDST 269
#define | YYERRCODE 256
#define | YYTABLESIZE 337
#define | YYFINAL 1
#define | YYDEBUG 0
#define | YYMAXTOKEN 269
#define | YYSTACKSIZE 10000
#define | YYMAXDEPTH 10000
#define | YYINITSTACKSIZE 200
#define | TM_YEAR_ORIGIN 1900
#define | YYFREESTACK(sp) { free((sp)->ss); free((sp)->vs); }
#define | YYABORT goto yyabort
#define | YYREJECT goto yyabort
#define | YYACCEPT goto yyaccept
#define | YYERROR goto yyerrlab

Typedefs

typedef _TABLE | TABLE
typedef enum _DSTMODE | DSTMODE
typedef enum _MERIDIAN | MERIDIAN

Enumerations

enum | _DSTMODE { DSTon, DSToff, DSTmaybe }
enum | _MERIDIAN { MERam, MERpm, MER24 }

Functions

int | getdate_yyparse ()
int | getdate_yylex ()
int | getdate_yyerror (char *s)
time_t | get_date (char *p, struct timeb *now)
time_t | ToSeconds (time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian)
time_t | Convert (time_t Month, time_t Day, time_t Year, time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian, DSTMODE DSTmode)
time_t | DSTcorrect (time_t Start, time_t Future)
time_t | RelativeDate (time_t Start, time_t DayOrdinal, time_t DayNumber)
time_t | RelativeMonth (time_t Start, time_t RelMonth)
int | LookupWord (char *buff)
long | difftm (struct tm *a, struct tm *b)
int | yyinitstack (struct yystack *sp)
int | yygrowstack (struct yystack *sp)

Variables

char | yysccsid [] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93 (BSDI)"
char * | yyInput
DSTMODE yyDSTmode
time_t | yyDayOrdinal
time_t | yyDayNumber
int | yyHaveDate
int | yyHaveDay
int | yyHaveRel
int | yyHaveTime
int | yyHaveZone
time_t | yyTimezone
time_t | yyDay
time_t | yyHour
time_t | yyMinutes
time_t | yyMonth
time_t | yySeconds
time_t | yyYear
MERIDIAN yyMeridian
time_t | yyRelMonth
time_t | yyRelSeconds
short | yylhs []
short | yylen []
short | yydefred []
short | yydgoto []
short | yysindex []
short | yyrindex []
short | yygindex []
short | yytable []
short | yycheck []
int | getdate_yydebug
int | getdate_yynerrs
int | getdate_yychar
int | yyerrflag
YYSTYPE getdate_yylval
TABLE const | MonthDayTable []
TABLE const | UnitsTable []
TABLE const | OtherTable []
TABLE const | TimezoneTable []
TABLE const | MilitaryTable []

Define Documentation

#define EPOCH 1970

Definition at line 145 of file getdate.c.

#define HOUR ( x ) ((time_t)(x) * 60)

Definition at line 149 of file getdate.c.

Referenced by TimezoneTable().

#define SECSPERDAY (24L * 60L * 60L)

Definition at line 150 of file getdate.c.

#define TM_YEAR_ORIGIN 1900

Definition at line 902 of file getdate.c.

#define YYABORT goto yyabort

Definition at line 1100 of file getdate.c.

#define YYACCEPT goto yyaccept

Definition at line 1102 of file getdate.c.

#define YYBYACC 1

Definition at line 5 of file getdate.c.

#define YYDEBUG 0

Definition at line 340 of file getdate.c.

#define YYEMPTY (-1)

Definition at line 8 of file getdate.c.

#define YYERRCODE 256

Definition at line 223 of file getdate.c.

#define YYERROR goto yyerrlab

Definition at line 1103 of file getdate.c.

#define YYFINAL 1

Definition at line 338 of file getdate.c.

#define YYFREESTACK ( sp ) { free((sp)->ss); free((sp)->vs); }

Definition at line 1098 of file getdate.c.

Referenced by getdate_yyparse().

#define YYINITSTACKSIZE 200

Definition at line 411 of file getdate.c.

#define YYLEX yylex()

Definition at line 9 of file getdate.c.

#define YYMAJOR 1

Definition at line 6 of file getdate.c.

#define YYMAXDEPTH 10000

Definition at line 408 of file getdate.c.

#define YYMAXTOKEN 269

Definition at line 342 of file getdate.c.

#define YYMINOR 9

Definition at line 7 of file getdate.c.

#define YYPREFIX "yy"

Definition at line 13 of file getdate.c.

#define YYRECOVERING (yyerrflag!=0)

Definition at line 12 of file getdate.c.

#define YYREJECT goto yyabort

Definition at line 1101 of file getdate.c.

#define YYSTACKSIZE 10000

Definition at line 407 of file getdate.c.

#define YYTABLESIZE 337

Definition at line 265 of file getdate.c.

#define tAGO 257

Definition at line 210 of file getdate.c.

#define tDAY 258

Definition at line 211 of file getdate.c.

#define tDAYZONE 259

Definition at line 212 of file getdate.c.

#define tDST 269

Definition at line 222 of file getdate.c.

#define tID 260

Definition at line 213 of file getdate.c.

#define tMERIDIAN 261

Definition at line 214 of file getdate.c.

#define tMINUTE_UNIT 262

Definition at line 215 of file getdate.c.

#define tMONTH 263

Definition at line 216 of file getdate.c.

#define tMONTH_UNIT 264

Definition at line 217 of file getdate.c.

#define tSEC_UNIT 265

Definition at line 218 of file getdate.c.

#define tSNUMBER 266

Definition at line 219 of file getdate.c.

#define tUNUMBER 267

Definition at line 220 of file getdate.c.

#define tZONE 268

Definition at line 221 of file getdate.c.

int yychar getdate_yychar

Definition at line 133 of file getdate.c.

#define yyclearin (yychar=YYEMPTY)

Definition at line 10 of file getdate.c.

#define yydebug getdate_yydebug

Definition at line 131 of file getdate.c.

#define yyerrok (yyerrflag=0)

Definition at line 11 of file getdate.c.

#define yyerror getdate_yyerror

Definition at line 130 of file getdate.c.

Referenced by getdate_yyparse(), and yylex().

#define yylex getdate_yylex

Definition at line 129 of file getdate.c.

Referenced by getdate_yyparse().

#define yylval getdate_yylval

Definition at line 134 of file getdate.c.

#define yynerrs getdate_yynerrs

Definition at line 132 of file getdate.c.

#define yyparse getdate_yyparse

Definition at line 128 of file getdate.c.

Referenced by CvsLogParse(), get_date(), main(), and now().

Typedef Documentation

typedef enum _DSTMODE DSTMODE

typedef enum _MERIDIAN MERIDIAN

typedef struct _TABLE TABLE

Enumeration Type Documentation

enum _DSTMODE

Enumeration values:
DSTon
DSToff
DSTmaybe

Definition at line 166 of file getdate.c.

00166                       {
00167     DSTon, DSToff, DSTmaybe
00168 } DSTMODE;

enum _MERIDIAN

Enumeration values:
MERam
MERpm
MER24

Definition at line 173 of file getdate.c.

00173                        {
00174     MERam, MERpm, MER24
00175 } MERIDIAN;

Function Documentation

time_t Convert | ( | time_t | Month,
 |  | time_t | Day,
 |  | time_t | Year,
 |  | time_t | Hours,
 |  | time_t | Minutes,
 |  | time_t | Seconds,
 |  | MERIDIAN | Meridian,
 |  | DSTMODE | DSTmode
 | ) | [static]

Definition at line 656 of file getdate.c.

00658 {
00659     static int DaysInMonth[12] = {
00660     31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
00661     };
00662     time_t  tod;
00663     time_t  Julian;
00664     int     i;
00665
00666     if (Year < 0)
00667     Year = -Year;
00668     if (Year < 69)
00669     Year += 2000;
00670     else if (Year < 100)
00671     Year += 1900;
00672     DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
00673             ? 29 : 28;
00674     /* Checking for 2038 bogusly assumes that time_t is 32 bits.  But
00675        I'm too lazy to try to check for time_t overflow in another way.  */
00676     if (Year < EPOCH || Year > 2038
00677      || Month < 1 || Month > 12
00678      /* Lint fluff:  "conversion from long may lose accuracy" */
00679      || Day < 1 || Day > DaysInMonth[(int)--Month])
00680     return -1;
00681
00682     for (Julian = Day - 1, i = 0; i < Month; i++)
00683     Julian += DaysInMonth[i];
00684     for (i = EPOCH; i < Year; i++)
00685     Julian += 365 + (i % 4 == 0);
00686     Julian *= SECSPERDAY;
00687     Julian += yyTimezone * 60L;
00688     if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
00689     return -1;
00690     Julian += tod;
00691     if (DSTmode == DSTon
00692      || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
00693     Julian -= 60 * 60;
00694     return Julian;
00695 }

time_t DSTcorrect | ( | time_t | Start,
 |  | time_t | Future
 | ) | [static]

Definition at line 699 of file getdate.c.

00700 {
00701     time_t  StartDay;
00702     time_t  FutureDay;
00703
00704     StartDay = (localtime(&Start)->tm_hour + 1) % 24;
00705     FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
00706     return (Future - Start) + (StartDay - FutureDay) * 60L * 60L;
00707 }

int LookupWord ( char * buff ) [static]

Definition at line 745 of file getdate.c.

00746 {
00747     register char   *p;
00748     register char   *q;
00749     register const TABLE    *tp;
00750     int         i;
00751     int         abbrev;
00752
00753     /* Make it lowercase. */
00754     for (p = buff; *p; p++)
00755     if (isupper(*p))
00756         *p = tolower(*p);
00757
00758     if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
00759     yylval.Meridian = MERam;
00760     return tMERIDIAN;
00761     }
00762     if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
00763     yylval.Meridian = MERpm;
00764     return tMERIDIAN;
00765     }
00766
00767     /* See if we have an abbreviation for a month. */
00768     if (strlen(buff) == 3)
00769     abbrev = 1;
00770     else if (strlen(buff) == 4 && buff[3] == '.') {
00771     abbrev = 1;
00772     buff[3] = '\0';
00773     }
00774     else
00775     abbrev = 0;
00776
00777     for (tp = MonthDayTable; tp->name; tp++) {
00778     if (abbrev) {
00779         if (strncmp(buff, tp->name, 3) == 0) {
00780         yylval.Number = tp->value;
00781         return tp->type;
00782         }
00783     }
00784     else if (strcmp(buff, tp->name) == 0) {
00785         yylval.Number = tp->value;
00786         return tp->type;
00787     }
00788     }
00789
00790     for (tp = TimezoneTable; tp->name; tp++)
00791     if (strcmp(buff, tp->name) == 0) {
00792         yylval.Number = tp->value;
00793         return tp->type;
00794     }
00795
00796     if (strcmp(buff, "dst") == 0)
00797     return tDST;
00798
00799     for (tp = UnitsTable; tp->name; tp++)
00800     if (strcmp(buff, tp->name) == 0) {
00801         yylval.Number = tp->value;
00802         return tp->type;
00803     }
00804
00805     /* Strip off any plural and try the units table again. */
00806     i = strlen(buff) - 1;
00807     if (buff[i] == 's') {
00808     buff[i] = '\0';
00809     for (tp = UnitsTable; tp->name; tp++)
00810         if (strcmp(buff, tp->name) == 0) {
00811         yylval.Number = tp->value;
00812         return tp->type;
00813         }
00814     buff[i] = 's';      /* Put back for "this" in OtherTable. */
00815     }
00816
00817     for (tp = OtherTable; tp->name; tp++)
00818     if (strcmp(buff, tp->name) == 0) {
00819         yylval.Number = tp->value;
00820         return tp->type;
00821     }
00822
00823     /* Military timezones. */
00824     if (buff[1] == '\0' && isalpha(*buff)) {
00825     for (tp = MilitaryTable; tp->name; tp++)
00826         if (strcmp(buff, tp->name) == 0) {
00827         yylval.Number = tp->value;
00828         return tp->type;
00829         }
00830     }
00831
00832     /* Drop out any periods and try the timezone table again. */
00833     for (i = 0, p = q = buff; *q; q++)
00834     if (*q != '.')
00835         *p++ = *q;
00836     else
00837         i++;
00838     *p = '\0';
00839     if (i)
00840     for (tp = TimezoneTable; tp->name; tp++)
00841         if (strcmp(buff, tp->name) == 0) {
00842         yylval.Number = tp->value;
00843         return tp->type;
00844         }
00845
00846     return tID;
00847 }

time_t RelativeDate | ( | time_t | Start,
 |  | time_t | DayOrdinal,
 |  | time_t | DayNumber
 | ) | [static]

Definition at line 711 of file getdate.c.

00712 {
00713     struct tm   *tm;
00714     time_t  now;
00715
00716     now = Start;
00717     tm = localtime(&now);
00718     now += SECSPERDAY * ((DayNumber - tm->tm_wday + 7) % 7);
00719     now += 7 * SECSPERDAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
00720     return DSTcorrect(Start, now);
00721 }

time_t RelativeMonth | ( | time_t | Start,
 |  | time_t | RelMonth
 | ) | [static]

Definition at line 725 of file getdate.c.

00726 {
00727     struct tm   *tm;
00728     time_t  Month;
00729     time_t  Year;
00730
00731     if (RelMonth == 0)
00732     return 0;
00733     tm = localtime(&Start);
00734     Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth;
00735     Year = Month / 12;
00736     Month = Month % 12 + 1;
00737     return DSTcorrect(Start,
00738         Convert(Month, (time_t)tm->tm_mday, Year,
00739         (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
00740         MER24, DSTmaybe));
00741 }

time_t ToSeconds | ( | time_t | Hours,
 |  | time_t | Minutes,
 |  | time_t | Seconds,
 |  | MERIDIAN | Meridian
 | ) | [static]

Definition at line 623 of file getdate.c.

00624 {
00625     if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59)
00626     return -1;
00627     switch (Meridian) {
00628     case MER24:
00629     if (Hours < 0 || Hours > 23)
00630         return -1;
00631     return (Hours * 60L + Minutes) * 60L + Seconds;
00632     case MERam:
00633     if (Hours < 1 || Hours > 12)
00634         return -1;
00635     if (Hours == 12)
00636         Hours = 0;
00637     return (Hours * 60L + Minutes) * 60L + Seconds;
00638     case MERpm:
00639     if (Hours < 1 || Hours > 12)
00640         return -1;
00641     if (Hours == 12)
00642         Hours = 0;
00643     return ((Hours + 12) * 60L + Minutes) * 60L + Seconds;
00644     default:
00645     abort ();
00646     }
00647     /* NOTREACHED */
00648 }

long difftm | ( | struct tm * | a,
 |  | struct tm * | b
 | ) | [static]

Definition at line 906 of file getdate.c.

00907 {
00908   int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
00909   int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
00910   int days = (
00911           /* difference in day of year */
00912           a->tm_yday - b->tm_yday
00913           /* + intervening leap days */
00914           +  ((ay >> 2) - (by >> 2))
00915           -  (ay/100 - by/100)
00916           +  ((ay/100 >> 2) - (by/100 >> 2))
00917           /* + difference in years * 365 */
00918           +  (long)(ay-by) * 365
00919           );
00920   return (60*(60*(24*days + (a->tm_hour - b->tm_hour))
00921           + (a->tm_min - b->tm_min))
00922       + (a->tm_sec - b->tm_sec));
00923 }

time_t get_date | ( | char * | p,
 |  | struct timeb * | now
 | ) |

Definition at line 926 of file getdate.c.

00927 {
00928     struct tm       *tm, gmt;
00929     struct timeb    ftz;
00930     time_t      Start;
00931     time_t      tod;
00932     time_t nowtime;
00933
00934     yyInput = p;
00935     if (now == NULL) {
00936     struct tm *gmt_ptr;
00937
00938         now = &ftz;
00939     (void)time (&nowtime);
00940
00941     gmt_ptr = gmtime (&nowtime);
00942     if (gmt_ptr != NULL)
00943     {
00944         /* Make a copy, in case localtime modifies *tm (I think
00945            that comment now applies to *gmt_ptr, but I am too
00946            lazy to dig into how gmtime and locatime allocate the
00947            structures they return pointers to).  */
00948         gmt = *gmt_ptr;
00949     }
00950
00951     if (! (tm = localtime (&nowtime)))
00952         return -1;
00953
00954     if (gmt_ptr != NULL)
00955         ftz.timezone = difftm (&gmt, tm) / 60;
00956     else
00957         /* We are on a system like VMS, where the system clock is
00958            in local time and the system has no concept of timezones.
00959            Hopefully we can fake this out (for the case in which the
00960            user specifies no timezone) by just saying the timezone
00961            is zero.  */
00962         ftz.timezone = 0;
00963
00964     if(tm->tm_isdst)
00965         ftz.timezone += 60;
00966     }
00967     else
00968     {
00969     nowtime = now->time;
00970     }
00971
00972     tm = localtime(&nowtime);
00973     yyYear = tm->tm_year + 1900;
00974     yyMonth = tm->tm_mon + 1;
00975     yyDay = tm->tm_mday;
00976     yyTimezone = now->timezone;
00977     yyDSTmode = DSTmaybe;
00978     yyHour = 0;
00979     yyMinutes = 0;
00980     yySeconds = 0;
00981     yyMeridian = MER24;
00982     yyRelSeconds = 0;
00983     yyRelMonth = 0;
00984     yyHaveDate = 0;
00985     yyHaveDay = 0;
00986     yyHaveRel = 0;
00987     yyHaveTime = 0;
00988     yyHaveZone = 0;
00989
00990     if (yyparse()
00991      || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
00992     return -1;
00993
00994     if (yyHaveDate || yyHaveTime || yyHaveDay) {
00995     Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
00996             yyMeridian, yyDSTmode);
00997     if (Start == -1)
00998         return -1;
00999     }
01000     else {
01001     Start = nowtime;
01002     if (!yyHaveRel)
01003         Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) + tm->tm_sec;
01004     }
01005
01006     Start += yyRelSeconds;
01007     Start += RelativeMonth(Start, yyRelMonth);
01008
01009     if (yyHaveDay && !yyHaveDate) {
01010     tod = RelativeDate(Start, yyDayOrdinal, yyDayNumber);
01011     Start += tod;
01012     }
01013
01014     /* Have to do *something* with a legitimate -1 so it's distinguishable
01015      * from the error return value.  (Alternately could set errno on error.) */
01016     return Start == -1 ? 0 : Start;
01017 }

int getdate_yyerror ( char * s ) [static]

Definition at line 616 of file getdate.c.

00617 {
00618   return 0;
00619 }

int getdate_yylex ( ) [static]

Definition at line 851 of file getdate.c.

00852 {
00853     register char   c;
00854     register char   *p;
00855     char        buff[20];
00856     int         Count;
00857     int         sign;
00858
00859     for ( ; ; ) {
00860     while (isspace(*yyInput))
00861         yyInput++;
00862
00863     if (isdigit(c = *yyInput) || c == '-' || c == '+') {
00864         if (c == '-' || c == '+') {
00865         sign = c == '-' ? -1 : 1;
00866         if (!isdigit(*++yyInput))
00867             /* skip the '-' sign */
00868             continue;
00869         }
00870         else
00871         sign = 0;
00872         for (yylval.Number = 0; isdigit(c = *yyInput++); )
00873         yylval.Number = 10 * yylval.Number + c - '0';
00874         yyInput--;
00875         if (sign < 0)
00876         yylval.Number = -yylval.Number;
00877         return sign ? tSNUMBER : tUNUMBER;
00878     }
00879     if (isalpha(c)) {
00880         for (p = buff; isalpha(c = *yyInput++) || c == '.'; )
00881         if (p < &buff[sizeof buff - 1])
00882             *p++ = c;
00883         *p = '\0';
00884         yyInput--;
00885         return LookupWord(buff);
00886     }
00887     if (c != '(')
00888         return *yyInput++;
00889     Count = 0;
00890     do {
00891         c = *yyInput++;
00892         if (c == '\0')
00893         return c;
00894         if (c == '(')
00895         Count++;
00896         else if (c == ')')
00897         Count--;
00898     } while (Count > 0);
00899     }
00900 }

int getdate_yyparse ( ) [static]

Definition at line 1105 of file getdate.c.

01106 {
01107     register int yym, yyn, yystate, yych;
01108     register YYSTYPE *yyvsp;
01109     YYSTYPE yyval;
01110     struct yystack yystk;
01111 #if YYDEBUG
01112     register char *yys;
01113     extern char *getenv();
01114
01115     if (yys = getenv("YYDEBUG"))
01116     {
01117         yyn = *yys;
01118         if (yyn >= '0' && yyn <= '9')
01119             yydebug = yyn - '0';
01120     }
01121 #endif
01122
01123     yynerrs = 0;
01124     yyerrflag = 0;
01125     yychar = yych = YYEMPTY;
01126
01127     if (yyinitstack(&yystk)) goto yyoverflow;
01128     *yystk.ssp = yystate = 0;
01129
01130 yyloop:
01131     if (yyn = yydefred[yystate]) goto yyreduce;
01132     if (yych < 0)
01133     {
01134         if ((yych = YYLEX) < 0) yych = 0;
01135         yychar = yych;
01136 #if YYDEBUG
01137         if (yydebug)
01138         {
01139             yys = 0;
01140             if (yych <= YYMAXTOKEN) yys = yyname[yych];
01141             if (!yys) yys = "illegal-symbol";
01142             printf("%sdebug: state %d, reading %d (%s)\n",
01143                     YYPREFIX, yystate, yych, yys);
01144         }
01145 #endif
01146     }
01147     if ((yyn = yysindex[yystate]) && (yyn += yych) >= 0 &&
01148             yyn <= YYTABLESIZE && yycheck[yyn] == yych)
01149     {
01150 #if YYDEBUG
01151         if (yydebug)
01152             printf("%sdebug: state %d, shifting to state %d\n",
01153                     YYPREFIX, yystate, yytable[yyn]);
01154 #endif
01155         if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
01156             goto yyoverflow;
01157         *++yystk.ssp = yystate = yytable[yyn];
01158         *++yystk.vsp = yylval;
01159         yychar = yych = YYEMPTY;
01160         if (yyerrflag > 0)  --yyerrflag;
01161         goto yyloop;
01162     }
01163     if ((yyn = yyrindex[yystate]) && (yyn += yych) >= 0 &&
01164             yyn <= YYTABLESIZE && yycheck[yyn] == yych)
01165     {
01166         yyn = yytable[yyn];
01167         goto yyreduce;
01168     }
01169     if (yyerrflag) goto yyinrecovery;
01170 #ifdef lint
01171     goto yynewerror;
01172 #endif
01173 yynewerror:
01174     yyerror("syntax error");
01175 #ifdef lint
01176     goto yyerrlab;
01177 #endif
01178 yyerrlab:
01179     ++yynerrs;
01180 yyinrecovery:
01181     if (yyerrflag < 3)
01182     {
01183         yyerrflag = 3;
01184         for (;;)
01185         {
01186             if ((yyn = yysindex[*yystk.ssp]) &&
01187                     (yyn += YYERRCODE) >= 0 &&
01188                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
01189             {
01190 #if YYDEBUG
01191                 if (yydebug)
01192                     printf("%sdebug: state %d, error recovery shifting\
01193  to state %d\n", YYPREFIX, *yystk.ssp, yytable[yyn]);
01194 #endif
01195                 if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
01196                     goto yyoverflow;
01197                 *++yystk.ssp = yystate = yytable[yyn];
01198                 *++yystk.vsp = yylval;
01199                 goto yyloop;
01200             }
01201             else
01202             {
01203 #if YYDEBUG
01204                 if (yydebug)
01205                     printf("%sdebug: error recovery discarding state %d\n",
01206                             YYPREFIX, *yystk.ssp);
01207 #endif
01208                 if (yystk.ssp <= yystk.ss) goto yyabort;
01209                 --yystk.ssp;
01210                 --yystk.vsp;
01211             }
01212         }
01213     }
01214     else
01215     {
01216         if (yych == 0) goto yyabort;
01217 #if YYDEBUG
01218         if (yydebug)
01219         {
01220             yys = 0;
01221             if (yych <= YYMAXTOKEN) yys = yyname[yych];
01222             if (!yys) yys = "illegal-symbol";
01223             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
01224                     YYPREFIX, yystate, yych, yys);
01225         }
01226 #endif
01227         yychar = yych = YYEMPTY;
01228         goto yyloop;
01229     }
01230 yyreduce:
01231 #if YYDEBUG
01232     if (yydebug)
01233         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
01234                 YYPREFIX, yystate, yyn, yyrule[yyn]);
01235 #endif
01236     yym = yylen[yyn];
01237     yyvsp = yystk.vsp; /* for speed in code under switch() */
01238     yyval = yyvsp[1-yym];
01239     switch (yyn)
01240     {
01241 case 3:
01242 #line 197 "/u/scjones/cvs-nightly/lib/getdate.y"
01243 {
01244         yyHaveTime++;
01245     }
01246 break;
01247 case 4:
01248 #line 200 "/u/scjones/cvs-nightly/lib/getdate.y"
01249 {
01250         yyHaveZone++;
01251     }
01252 break;
01253 case 5:
01254 #line 203 "/u/scjones/cvs-nightly/lib/getdate.y"
01255 {
01256         yyHaveDate++;
01257     }
01258 break;
01259 case 6:
01260 #line 206 "/u/scjones/cvs-nightly/lib/getdate.y"
01261 {
01262         yyHaveDay++;
01263     }
01264 break;
01265 case 7:
01266 #line 209 "/u/scjones/cvs-nightly/lib/getdate.y"
01267 {
01268         yyHaveRel++;
01269     }
01270 break;
01271 case 9:
01272 #line 215 "/u/scjones/cvs-nightly/lib/getdate.y"
01273 {
01274         yyHour = yyvsp[-1].Number;
01275         yyMinutes = 0;
01276         yySeconds = 0;
01277         yyMeridian = yyvsp[0].Meridian;
01278     }
01279 break;
01280 case 10:
01281 #line 221 "/u/scjones/cvs-nightly/lib/getdate.y"
01282 {
01283         yyHour = yyvsp[-3].Number;
01284         yyMinutes = yyvsp[-1].Number;
01285         yySeconds = 0;
01286         yyMeridian = yyvsp[0].Meridian;
01287     }
01288 break;
01289 case 11:
01290 #line 227 "/u/scjones/cvs-nightly/lib/getdate.y"
01291 {
01292         yyHour = yyvsp[-3].Number;
01293         yyMinutes = yyvsp[-1].Number;
01294         yyMeridian = MER24;
01295         yyDSTmode = DSToff;
01296         yyTimezone = - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60);
01297     }
01298 break;
01299 case 12:
01300 #line 234 "/u/scjones/cvs-nightly/lib/getdate.y"
01301 {
01302         yyHour = yyvsp[-5].Number;
01303         yyMinutes = yyvsp[-3].Number;
01304         yySeconds = yyvsp[-1].Number;
01305         yyMeridian = yyvsp[0].Meridian;
01306     }
01307 break;
01308 case 13:
01309 #line 240 "/u/scjones/cvs-nightly/lib/getdate.y"
01310 {
01311         yyHour = yyvsp[-5].Number;
01312         yyMinutes = yyvsp[-3].Number;
01313         yySeconds = yyvsp[-1].Number;
01314         yyMeridian = MER24;
01315         yyDSTmode = DSToff;
01316         yyTimezone = - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60);
01317     }
01318 break;
01319 case 14:
01320 #line 250 "/u/scjones/cvs-nightly/lib/getdate.y"
01321 {
01322         yyTimezone = yyvsp[0].Number;
01323         yyDSTmode = DSToff;
01324     }
01325 break;
01326 case 15:
01327 #line 254 "/u/scjones/cvs-nightly/lib/getdate.y"
01328 {
01329         yyTimezone = yyvsp[0].Number;
01330         yyDSTmode = DSTon;
01331     }
01332 break;
01333 case 16:
01334 #line 259 "/u/scjones/cvs-nightly/lib/getdate.y"
01335 {
01336         yyTimezone = yyvsp[-1].Number;
01337         yyDSTmode = DSTon;
01338     }
01339 break;
01340 case 17:
01341 #line 265 "/u/scjones/cvs-nightly/lib/getdate.y"
01342 {
01343         yyDayOrdinal = 1;
01344         yyDayNumber = yyvsp[0].Number;
01345     }
01346 break;
01347 case 18:
01348 #line 269 "/u/scjones/cvs-nightly/lib/getdate.y"
01349 {
01350         yyDayOrdinal = 1;
01351         yyDayNumber = yyvsp[-1].Number;
01352     }
01353 break;
01354 case 19:
01355 #line 273 "/u/scjones/cvs-nightly/lib/getdate.y"
01356 {
01357         yyDayOrdinal = yyvsp[-1].Number;
01358         yyDayNumber = yyvsp[0].Number;
01359     }
01360 break;
01361 case 20:
01362 #line 279 "/u/scjones/cvs-nightly/lib/getdate.y"
01363 {
01364         yyMonth = yyvsp[-2].Number;
01365         yyDay = yyvsp[0].Number;
01366     }
01367 break;
01368 case 21:
01369 #line 283 "/u/scjones/cvs-nightly/lib/getdate.y"
01370 {
01371         if (yyvsp[-4].Number >= 100) {
01372         yyYear = yyvsp[-4].Number;
01373         yyMonth = yyvsp[-2].Number;
01374         yyDay = yyvsp[0].Number;
01375         } else {
01376         yyMonth = yyvsp[-4].Number;
01377         yyDay = yyvsp[-2].Number;
01378         yyYear = yyvsp[0].Number;
01379         }
01380     }
01381 break;
01382 case 22:
01383 #line 294 "/u/scjones/cvs-nightly/lib/getdate.y"
01384 {
01385         /* ISO 8601 format.  yyyy-mm-dd.  */
01386         yyYear = yyvsp[-2].Number;
01387         yyMonth = -yyvsp[-1].Number;
01388         yyDay = -yyvsp[0].Number;
01389     }
01390 break;
01391 case 23:
01392 #line 300 "/u/scjones/cvs-nightly/lib/getdate.y"
01393 {
01394         /* e.g. 17-JUN-1992.  */
01395         yyDay = yyvsp[-2].Number;
01396         yyMonth = yyvsp[-1].Number;
01397         yyYear = -yyvsp[0].Number;
01398     }
01399 break;
01400 case 24:
01401 #line 306 "/u/scjones/cvs-nightly/lib/getdate.y"
01402 {
01403         yyMonth = yyvsp[-1].Number;
01404         yyDay = yyvsp[0].Number;
01405     }
01406 break;
01407 case 25:
01408 #line 310 "/u/scjones/cvs-nightly/lib/getdate.y"
01409 {
01410         yyMonth = yyvsp[-3].Number;
01411         yyDay = yyvsp[-2].Number;
01412         yyYear = yyvsp[0].Number;
01413     }
01414 break;
01415 case 26:
01416 #line 315 "/u/scjones/cvs-nightly/lib/getdate.y"
01417 {
01418         yyMonth = yyvsp[0].Number;
01419         yyDay = yyvsp[-1].Number;
01420     }
01421 break;
01422 case 27:
01423 #line 319 "/u/scjones/cvs-nightly/lib/getdate.y"
01424 {
01425         yyMonth = yyvsp[-1].Number;
01426         yyDay = yyvsp[-2].Number;
01427         yyYear = yyvsp[0].Number;
01428     }
01429 break;
01430 case 28:
01431 #line 326 "/u/scjones/cvs-nightly/lib/getdate.y"
01432 {
01433         yyRelSeconds = -yyRelSeconds;
01434         yyRelMonth = -yyRelMonth;
01435     }
01436 break;
01437 case 30:
01438 #line 333 "/u/scjones/cvs-nightly/lib/getdate.y"
01439 {
01440         yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
01441     }
01442 break;
01443 case 31:
01444 #line 336 "/u/scjones/cvs-nightly/lib/getdate.y"
01445 {
01446         yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
01447     }
01448 break;
01449 case 32:
01450 #line 339 "/u/scjones/cvs-nightly/lib/getdate.y"
01451 {
01452         yyRelSeconds += yyvsp[0].Number * 60L;
01453     }
01454 break;
01455 case 33:
01456 #line 342 "/u/scjones/cvs-nightly/lib/getdate.y"
01457 {
01458         yyRelSeconds += yyvsp[-1].Number;
01459     }
01460 break;
01461 case 34:
01462 #line 345 "/u/scjones/cvs-nightly/lib/getdate.y"
01463 {
01464         yyRelSeconds += yyvsp[-1].Number;
01465     }
01466 break;
01467 case 35:
01468 #line 348 "/u/scjones/cvs-nightly/lib/getdate.y"
01469 {
01470         yyRelSeconds++;
01471     }
01472 break;
01473 case 36:
01474 #line 351 "/u/scjones/cvs-nightly/lib/getdate.y"
01475 {
01476         yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
01477     }
01478 break;
01479 case 37:
01480 #line 354 "/u/scjones/cvs-nightly/lib/getdate.y"
01481 {
01482         yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
01483     }
01484 break;
01485 case 38:
01486 #line 357 "/u/scjones/cvs-nightly/lib/getdate.y"
01487 {
01488         yyRelMonth += yyvsp[0].Number;
01489     }
01490 break;
01491 case 39:
01492 #line 362 "/u/scjones/cvs-nightly/lib/getdate.y"
01493 {
01494         if (yyHaveTime && yyHaveDate && !yyHaveRel)
01495         yyYear = yyvsp[0].Number;
01496         else {
01497         if(yyvsp[0].Number>10000) {
01498             yyHaveDate++;
01499             yyDay= (yyvsp[0].Number)%100;
01500             yyMonth= (yyvsp[0].Number/100)%100;
01501             yyYear = yyvsp[0].Number/10000;
01502         }
01503         else {
01504             yyHaveTime++;
01505             if (yyvsp[0].Number < 100) {
01506             yyHour = yyvsp[0].Number;
01507             yyMinutes = 0;
01508             }
01509             else {
01510                 yyHour = yyvsp[0].Number / 100;
01511                 yyMinutes = yyvsp[0].Number % 100;
01512             }
01513             yySeconds = 0;
01514             yyMeridian = MER24;
01515             }
01516         }
01517     }
01518 break;
01519 case 40:
01520 #line 389 "/u/scjones/cvs-nightly/lib/getdate.y"
01521 {
01522         yyval.Meridian = MER24;
01523     }
01524 break;
01525 case 41:
01526 #line 392 "/u/scjones/cvs-nightly/lib/getdate.y"
01527 {
01528         yyval.Meridian = yyvsp[0].Meridian;
01529     }
01530 break;
01531 #line 1541 "y.tab.c"
01532     }
01533     yystk.ssp -= yym;
01534     yystate = *yystk.ssp;
01535     yystk.vsp -= yym;
01536     yym = yylhs[yyn];
01537     yych = yychar;
01538     if (yystate == 0 && yym == 0)
01539     {
01540 #if YYDEBUG
01541         if (yydebug)
01542             printf("%sdebug: after reduction, shifting from state 0 to\
01543  state %d\n", YYPREFIX, YYFINAL);
01544 #endif
01545         yystate = YYFINAL;
01546         *++yystk.ssp = YYFINAL;
01547         *++yystk.vsp = yyval;
01548         if (yych < 0)
01549         {
01550             if ((yych = YYLEX) < 0) yych = 0;
01551             yychar = yych;
01552 #if YYDEBUG
01553             if (yydebug)
01554             {
01555                 yys = 0;
01556                 if (yych <= YYMAXTOKEN) yys = yyname[yych];
01557                 if (!yys) yys = "illegal-symbol";
01558                 printf("%sdebug: state %d, reading %d (%s)\n",
01559                         YYPREFIX, YYFINAL, yych, yys);
01560             }
01561 #endif
01562         }
01563         if (yych == 0) goto yyaccept;
01564         goto yyloop;
01565     }
01566     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
01567             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
01568         yystate = yytable[yyn];
01569     else
01570         yystate = yydgoto[yym];
01571 #if YYDEBUG
01572     if (yydebug)
01573         printf("%sdebug: after reduction, shifting from state %d \
01574 to state %d\n", YYPREFIX, *yystk.ssp, yystate);
01575 #endif
01576     if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
01577         goto yyoverflow;
01578     *++yystk.ssp = yystate;
01579     *++yystk.vsp = yyval;
01580     goto yyloop;
01581 yyoverflow:
01582     yyerror("yacc stack overflow");
01583 yyabort:
01584     YYFREESTACK(&yystk);
01585     return (1);
01586 yyaccept:
01587     YYFREESTACK(&yystk);
01588     return (0);
01589 }

int yygrowstack ( struct yystack * sp ) [static]

Definition at line 1072 of file getdate.c.

Referenced by getdate_yyparse().

01077 {
01078     int newsize, i;
01079     short *newss;
01080     YYSTYPE *newvs;
01081
01082     if ((newsize = sp->stacksize) >= YYMAXDEPTH) return -1;
01083     if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH;
01084     i = sp->ssp - sp->ss;
01085     if ((newss = (short *)realloc(sp->ss, newsize * sizeof *newss)) == NULL)
01086         return -1;
01087     sp->ss = newss;
01088     sp->ssp = newss + i;
01089     if ((newvs = (YYSTYPE *)realloc(sp->vs, newsize * sizeof *newvs)) == NULL)
01090         return -1;
01091     sp->vs = newvs;
01092     sp->vsp = newvs + i;
01093     sp->stacksize = newsize;
01094     sp->sslim = newss + newsize - 1;
01095     return 0;
01096 }

int yyinitstack ( struct yystack * sp ) [static]

Definition at line 1049 of file getdate.c.

Referenced by getdate_yyparse().

01054 {
01055     int newsize;
01056     short *newss;
01057     YYSTYPE *newvs;
01058
01059     newsize = YYINITSTACKSIZE;
01060     newss = (short *)malloc(newsize * sizeof *newss);
01061     newvs = (YYSTYPE *)malloc(newsize * sizeof *newvs);
01062     sp->ss = sp->ssp = newss;
01063     sp->vs = sp->vsp = newvs;
01064     if (newss == NULL || newvs == NULL) return -1;
01065     sp->stacksize = newsize;
01066     sp->sslim = newss + newsize - 1;
01067     return 0;
01068 }

Variable Documentation

TABLE const MilitaryTable[] [static]

Initial value:

 {
    { "a",   268 ,  ((time_t)( 1 ) * 60) },
    { "b",   268 ,  ((time_t)( 2 ) * 60) },
    { "c",   268 ,  ((time_t)( 3 ) * 60) },
    { "d",   268 ,  ((time_t)( 4 ) * 60) },
    { "e",   268 ,  ((time_t)( 5 ) * 60) },
    { "f",   268 ,  ((time_t)( 6 ) * 60) },
    { "g",   268 ,  ((time_t)( 7 ) * 60) },
    { "h",   268 ,  ((time_t)( 8 ) * 60) },
    { "i",   268 ,  ((time_t)( 9 ) * 60) },
    { "k",   268 ,  ((time_t)( 10 ) * 60) },
    { "l",   268 ,  ((time_t)( 11 ) * 60) },
    { "m",   268 ,  ((time_t)( 12 ) * 60) },
    { "n",   268 ,  ((time_t)( - 1 ) * 60) },
    { "o",   268 ,  ((time_t)( - 2 ) * 60) },
    { "p",   268 ,  ((time_t)( - 3 ) * 60) },
    { "q",   268 ,  ((time_t)( - 4 ) * 60) },
    { "r",   268 ,  ((time_t)( - 5 ) * 60) },
    { "s",   268 ,  ((time_t)( - 6 ) * 60) },
    { "t",   268 ,  ((time_t)( - 7 ) * 60) },
    { "u",   268 ,  ((time_t)( - 8 ) * 60) },
    { "v",   268 ,  ((time_t)( - 9 ) * 60) },
    { "w",   268 ,  ((time_t)( -10 ) * 60) },
    { "x",   268 ,  ((time_t)( -11 ) * 60) },
    { "y",   268 ,  ((time_t)( -12 ) * 60) },
    { "z",   268 ,  ((time_t)( 0 ) * 60) },
    { NULL }
}

Definition at line 582 of file getdate.c.

TABLE const MonthDayTable[] [static]

Initial value:

 {
    { "january",     263 ,  1 },
    { "february",    263 ,  2 },
    { "march",       263 ,  3 },
    { "april",       263 ,  4 },
    { "may",         263 ,  5 },
    { "june",        263 ,  6 },
    { "july",        263 ,  7 },
    { "august",      263 ,  8 },
    { "september",   263 ,  9 },
    { "sept",        263 ,  9 },
    { "october",     263 , 10 },
    { "november",    263 , 11 },
    { "december",    263 , 12 },
    { "sunday",      258 , 0 },
    { "monday",      258 , 1 },
    { "tuesday",     258 , 2 },
    { "tues",        258 , 2 },
    { "wednesday",   258 , 3 },
    { "wednes",      258 , 3 },
    { "thursday",    258 , 4 },
    { "thur",        258 , 4 },
    { "thurs",       258 , 4 },
    { "friday",      258 , 5 },
    { "saturday",    258 , 6 },
    { NULL }
}

Definition at line 428 of file getdate.c.

TABLE const OtherTable[] [static]

Initial value:

 {
    { "tomorrow",    262 ,  1 * 24 * 60 },
    { "yesterday",   262 ,  -1 * 24 * 60 },
    { "today",       262 ,  0 },
    { "now",         262 ,  0 },
    { "last",        267 ,  -1 },
    { "this",        262 ,  0 },
    { "next",        267 ,  2 },
    { "first",       267 ,  1 },

    { "third",       267 ,  3 },
    { "fourth",      267 ,  4 },
    { "fifth",       267 ,  5 },
    { "sixth",       267 ,  6 },
    { "seventh",     267 ,  7 },
    { "eighth",      267 ,  8 },
    { "ninth",       267 ,  9 },
    { "tenth",       267 ,  10 },
    { "eleventh",    267 ,  11 },
    { "twelfth",     267 ,  12 },
    { "ago",         257 ,  1 },
    { NULL }
}

Definition at line 472 of file getdate.c.

TABLE const TimezoneTable[] [static]

Definition at line 498 of file getdate.c.

TABLE const UnitsTable[] [static]

Initial value:

 {
    { "year",        264 ,  12 },
    { "month",       264 ,  1 },
    { "fortnight",   262 ,  14 * 24 * 60 },
    { "week",        262 ,  7 * 24 * 60 },
    { "day",         262 ,  1 * 24 * 60 },
    { "hour",        262 ,  60 },
    { "minute",      262 ,  1 },
    { "min",         262 ,  1 },
    { "second",      265 ,  1 },
    { "sec",         265 ,  1 },
    { NULL }
}

Definition at line 457 of file getdate.c.

int getdate_yychar

Definition at line 422 of file getdate.c.

int getdate_yydebug

Definition at line 412 of file getdate.c.

YYSTYPE getdate_yylval

Definition at line 424 of file getdate.c.

int getdate_yynerrs

Definition at line 413 of file getdate.c.

DSTMODE yyDSTmode [static]

Definition at line 185 of file getdate.c.

time_t yyDay [static]

Definition at line 194 of file getdate.c.

time_t yyDayNumber [static]

Definition at line 187 of file getdate.c.

time_t yyDayOrdinal [static]

Definition at line 186 of file getdate.c.

int yyHaveDate [static]

Definition at line 188 of file getdate.c.

int yyHaveDay [static]

Definition at line 189 of file getdate.c.

int yyHaveRel [static]

Definition at line 190 of file getdate.c.

int yyHaveTime [static]

Definition at line 191 of file getdate.c.

int yyHaveZone [static]

Definition at line 192 of file getdate.c.

time_t yyHour [static]

Definition at line 195 of file getdate.c.

char* yyInput [static]

Definition at line 184 of file getdate.c.

MERIDIAN yyMeridian [static]

Definition at line 200 of file getdate.c.

time_t yyMinutes [static]

Definition at line 196 of file getdate.c.

time_t yyMonth [static]

Definition at line 197 of file getdate.c.

time_t yyRelMonth [static]

Definition at line 201 of file getdate.c.

time_t yyRelSeconds [static]

Definition at line 202 of file getdate.c.

time_t yySeconds [static]

Definition at line 198 of file getdate.c.

time_t yyTimezone [static]

Definition at line 193 of file getdate.c.

time_t yyYear [static]

Definition at line 199 of file getdate.c.

short yycheck[]

Definition at line 302 of file getdate.c.

short yydefred[]

Initial value:

 {                                      1,
    0,    0,   15,   32,    0,   38,   35,    0,    0,    0,
    2,    3,    4,    5,    6,    7,    8,    0,   18,    0,
   31,   36,   33,   19,    9,   30,    0,   37,   34,    0,
    0,    0,   16,   28,    0,   23,   27,   22,    0,    0,
   25,   41,   11,    0,   10,    0,    0,   21,   13,   12,
}

Definition at line 238 of file getdate.c.

short yydgoto[]

Initial value:

 {                                       1,
   45,   11,   12,   13,   14,   15,   16,   17,   18,
}

Definition at line 245 of file getdate.c.

int yyerrflag

Definition at line 980 of file getdate.c.

short yygindex[]

Initial value:

 {                                      0,
  -17,    0,    0,    0,    0,    0,    0,    0,    0,
}

Definition at line 262 of file getdate.c.

short yylen[]

Initial value:

 {                                         2,
    0,    2,    1,    1,    1,    1,    1,    1,    2,    4,
    4,    6,    6,    1,    1,    2,    1,    2,    2,    3,
    5,    3,    3,    2,    4,    2,    3,    2,    1,    2,
    2,    1,    2,    2,    1,    2,    2,    1,    1,    0,
    1,
}

Definition at line 231 of file getdate.c.

short yylhs[]

Initial value:

 {                                        -1,
    0,    0,    2,    2,    2,    2,    2,    2,    3,    3,
    3,    3,    3,    4,    4,    4,    6,    6,    6,    5,
    5,    5,    5,    5,    5,    5,    5,    7,    7,    9,
    9,    9,    9,    9,    9,    9,    9,    9,    8,    1,
    1,
}

Definition at line 224 of file getdate.c.

short yyrindex[]

Initial value:

 {                                      0,
    0,    1,    0,    0,    0,    0,    0,    0,   69,   12,
    0,    0,    0,    0,    0,    0,    0,   23,    0,   34,
    0,    0,    0,    0,    0,    0,   67,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,   56,   45,
    0,    0,    0,    0,    0,    0,   56,    0,    0,    0,
}

Definition at line 255 of file getdate.c.

char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93 (BSDI)" [static]

Definition at line 2 of file getdate.c.

short yysindex[]

Initial value:

 {                                      0,
 -249,  -38,    0,    0, -260,    0,    0, -240,  -47, -248,
    0,    0,    0,    0,    0,    0,    0, -237,    0,  -18,
    0,    0,    0,    0,    0,    0, -262,    0,    0, -239,
 -238, -236,    0,    0, -235,    0,    0,    0,  -56,  -19,
    0,    0,    0, -234,    0, -232, -258,    0,    0,    0,
}

Definition at line 248 of file getdate.c.

short yytable[]

Definition at line 266 of file getdate.c.

Generated on Sun Oct 21 12:42:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/getdate.c Source File

cvs-1.10/lib/getdate.c

Go to the documentation of this file.
00001 #ifndef lint
00002 static char yysccsid[] = "@(#)yaccpar   1.9 (Berkeley) 02/21/93 (BSDI)";
00003 #endif
00004 #include <stdlib.h>
00005 #define YYBYACC 1
00006 #define YYMAJOR 1
00007 #define YYMINOR 9
00008 #define YYEMPTY (-1)
00009 #define YYLEX yylex()
00010 #define yyclearin (yychar=YYEMPTY)
00011 #define yyerrok (yyerrflag=0)
00012 #define YYRECOVERING (yyerrflag!=0)
00013 #define YYPREFIX "yy"
00014 #line 2 "/u/scjones/cvs-nightly/lib/getdate.y"
00015 /*
00016 **  Originally written by Steven M. Bellovin <smb@research.att.com> while
00017 **  at the University of North Carolina at Chapel Hill.  Later tweaked by
00018 **  a couple of people on Usenet.  Completely overhauled by Rich $alz
00019 **  <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
00020 **
00021 **  This grammar has 10 shift/reduce conflicts.
00022 **
00023 **  This code is in the public domain and has no copyright.
00024 */
00025 /* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */
00026 /* SUPPRESS 288 on yyerrlab *//* Label unused */
00027
00028 #ifdef HAVE_CONFIG_H
00029 #if defined (emacs) || defined (CONFIG_BROKETS)
00030 #include <config.h>
00031 #else
00032 #include "config.h"
00033 #endif
00034 #endif
00035
00036 /* Since the code of getdate.y is not included in the Emacs executable
00037    itself, there is no need to #define static in this file.  Even if
00038    the code were included in the Emacs executable, it probably
00039    wouldn't do any harm to #undef it here; this will only cause
00040    problems if we try to write to a static variable, which I don't
00041    think this code needs to do.  */
00042 #ifdef emacs
00043 #undef static
00044 #endif
00045
00046 #include <stdio.h>
00047 #include <ctype.h>
00048
00049 /* The code at the top of get_date which figures out the offset of the
00050    current time zone checks various CPP symbols to see if special
00051    tricks are need, but defaults to using the gettimeofday system call.
00052    Include <sys/time.h> if that will be used.  */
00053
00054 #if defined(vms)
00055
00056 #include <types.h>
00057 #include <time.h>
00058
00059 #else
00060
00061 #include <sys/types.h>
00062
00063 #ifdef TIME_WITH_SYS_TIME
00064 #include <sys/time.h>
00065 #include <time.h>
00066 #else
00067 #ifdef HAVE_SYS_TIME_H
00068 #include <sys/time.h>
00069 #else
00070 #include <time.h>
00071 #endif
00072 #endif
00073
00074 #ifdef timezone
00075 #undef timezone /* needed for sgi */
00076 #endif
00077
00078 #if (defined(WIN32) || defined(__MWERKS__)) && !defined(STDC_HEADERS)
00079 #define STDC_HEADERS
00080 #endif
00081
00082 #if defined(HAVE_SYS_TIMEB_H)
00083 #include <sys/timeb.h>
00084 #else
00085 /*
00086 ** We use the obsolete `struct timeb' as part of our interface!
00087 ** Since the system doesn't have it, we define it here;
00088 ** our callers must do likewise.
00089 */
00090 struct timeb {
00091     time_t      time;       /* Seconds since the epoch  */
00092     unsigned short  millitm;    /* Field not used       */
00093     short       timezone;   /* Minutes west of GMT      */
00094     short       dstflag;    /* Field not used       */
00095 };
00096 #endif /* defined(HAVE_SYS_TIMEB_H) */
00097
00098 #endif  /* defined(vms) */
00099
00100 #if defined (STDC_HEADERS) || defined (USG)
00101 #include <string.h>
00102 #endif
00103
00104 /* Some old versions of bison generate parsers that use bcopy.
00105    That loses on systems that don't provide the function, so we have
00106    to redefine it here.  */
00107 #if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
00108 #define bcopy(from, to, len) memcpy ((to), (from), (len))
00109 #endif
00110
00111 #if defined (STDC_HEADERS)
00112 #include <stdlib.h>
00113 #endif
00114
00115 /* NOTES on rebuilding getdate.c (particularly for inclusion in CVS
00116    releases):
00117
00118    We don't want to mess with all the portability hassles of alloca.
00119    In particular, most (all?) versions of bison will use alloca in
00120    their parser.  If bison works on your system (e.g. it should work
00121    with gcc), then go ahead and use it, but the more general solution
00122    is to use byacc instead of bison, which should generate a portable
00123    parser.  I played with adding "#define alloca dont_use_alloca", to
00124    give an error if the parser generator uses alloca (and thus detect
00125    unportable getdate.c's), but that seems to cause as many problems
00126    as it solves.  */
00127
00128 #define yyparse getdate_yyparse
00129 #define yylex getdate_yylex
00130 #define yyerror getdate_yyerror
00131 #define yydebug getdate_yydebug
00132 #define yynerrs getdate_yynerrs
00133 #define yychar getdate_yychar
00134 #define yylval getdate_yylval
00135
00136 static int yyparse ();
00137 static int yylex ();
00138 static int yyerror (char    *s);
00139
00140 #ifdef __cplusplus
00141 extern "C" time_t get_date(char     *p, struct timeb    *now);
00142 #endif
00143
00144 #ifndef macintosh
00145 #define EPOCH       1970
00146 #else
00147 #define EPOCH       1904        /*  GUSI = 1904; MSL = 1900 */
00148 #endif
00149 #define HOUR(x)     ((time_t)(x) * 60)
00150 #define SECSPERDAY  (24L * 60L * 60L)
00151
00152
00153 /*
00154 **  An entry in the lexical lookup table.
00155 */
00156 typedef struct _TABLE {
00157     char    *name;
00158     int     type;
00159     time_t  value;
00160 } TABLE;
00161
00162
00163 /*
00164 **  Daylight-savings mode:  on, off, or not yet known.
00165 */
00166 typedef enum _DSTMODE {
00167     DSTon, DSToff, DSTmaybe
00168 } DSTMODE;
00169
00170 /*
00171 **  Meridian:  am, pm, or 24-hour style.
00172 */
00173 typedef enum _MERIDIAN {
00174     MERam, MERpm, MER24
00175 } MERIDIAN;
00176
00177
00178 /*
00179 **  Global variables.  We could get rid of most of these by using a good
00180 **  union as the yacc stack.  (This routine was originally written before
00181 **  yacc had the %union construct.)  Maybe someday; right now we only use
00182 **  the %union very rarely.
00183 */
00184 static char *yyInput;
00185 static DSTMODE  yyDSTmode;
00186 static time_t   yyDayOrdinal;
00187 static time_t   yyDayNumber;
00188 static int  yyHaveDate;
00189 static int  yyHaveDay;
00190 static int  yyHaveRel;
00191 static int  yyHaveTime;
00192 static int  yyHaveZone;
00193 static time_t   yyTimezone;
00194 static time_t   yyDay;
00195 static time_t   yyHour;
00196 static time_t   yyMinutes;
00197 static time_t   yyMonth;
00198 static time_t   yySeconds;
00199 static time_t   yyYear;
00200 static MERIDIAN yyMeridian;
00201 static time_t   yyRelMonth;
00202 static time_t   yyRelSeconds;
00203
00204 #line 179 "/u/scjones/cvs-nightly/lib/getdate.y"
00205 typedef union {
00206     time_t      Number;
00207     enum _MERIDIAN  Meridian;
00208 } YYSTYPE;
00209 #line 196 "y.tab.c"
00210 #define tAGO 257
00211 #define tDAY 258
00212 #define tDAYZONE 259
00213 #define tID 260
00214 #define tMERIDIAN 261
00215 #define tMINUTE_UNIT 262
00216 #define tMONTH 263
00217 #define tMONTH_UNIT 264
00218 #define tSEC_UNIT 265
00219 #define tSNUMBER 266
00220 #define tUNUMBER 267
00221 #define tZONE 268
00222 #define tDST 269
00223 #define YYERRCODE 256
00224 short yylhs[] = {                                        -1,
00225     0,    0,    2,    2,    2,    2,    2,    2,    3,    3,
00226     3,    3,    3,    4,    4,    4,    6,    6,    6,    5,
00227     5,    5,    5,    5,    5,    5,    5,    7,    7,    9,
00228     9,    9,    9,    9,    9,    9,    9,    9,    8,    1,
00229     1,
00230 };
00231 short yylen[] = {                                         2,
00232     0,    2,    1,    1,    1,    1,    1,    1,    2,    4,
00233     4,    6,    6,    1,    1,    2,    1,    2,    2,    3,
00234     5,    3,    3,    2,    4,    2,    3,    2,    1,    2,
00235     2,    1,    2,    2,    1,    2,    2,    1,    1,    0,
00236     1,
00237 };
00238 short yydefred[] = {                                      1,
00239     0,    0,   15,   32,    0,   38,   35,    0,    0,    0,
00240     2,    3,    4,    5,    6,    7,    8,    0,   18,    0,
00241    31,   36,   33,   19,    9,   30,    0,   37,   34,    0,
00242     0,    0,   16,   28,    0,   23,   27,   22,    0,    0,
00243    25,   41,   11,    0,   10,    0,    0,   21,   13,   12,
00244 };
00245 short yydgoto[] = {                                       1,
00246    45,   11,   12,   13,   14,   15,   16,   17,   18,
00247 };
00248 short yysindex[] = {                                      0,
00249  -249,  -38,    0,    0, -260,    0,    0, -240,  -47, -248,
00250     0,    0,    0,    0,    0,    0,    0, -237,    0,  -18,
00251     0,    0,    0,    0,    0,    0, -262,    0,    0, -239,
00252  -238, -236,    0,    0, -235,    0,    0,    0,  -56,  -19,
00253     0,    0,    0, -234,    0, -232, -258,    0,    0,    0,
00254 };
00255 short yyrindex[] = {                                      0,
00256     0,    1,    0,    0,    0,    0,    0,    0,   69,   12,
00257     0,    0,    0,    0,    0,    0,    0,   23,    0,   34,
00258     0,    0,    0,    0,    0,    0,   67,    0,    0,    0,
00259     0,    0,    0,    0,    0,    0,    0,    0,   56,   45,
00260     0,    0,    0,    0,    0,    0,   56,    0,    0,    0,
00261 };
00262 short yygindex[] = {                                      0,
00263   -17,    0,    0,    0,    0,    0,    0,    0,    0,
00264 };
00265 #define YYTABLESIZE 337
00266 short yytable[] = {                                      32,
00267    17,   44,   42,   36,   37,   19,   20,   49,    2,    3,
00268    31,   14,    4,    5,    6,    7,    8,    9,   10,   34,
00269    33,   21,   29,   22,   23,   35,   38,   46,   39,   50,
00270    40,   41,   47,   24,   48,    0,    0,    0,    0,    0,
00271     0,    0,    0,    0,   20,    0,    0,    0,    0,    0,
00272     0,    0,    0,    0,    0,   40,    0,    0,    0,    0,
00273     0,    0,    0,    0,    0,    0,   26,    0,   39,    0,
00274     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00275     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00276     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00277     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00278     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00279     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00280     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00281     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00282     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00283     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00284     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00285     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00286     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00287     0,    0,    0,    0,   42,    0,    0,    0,    0,   43,
00288    24,    0,    0,   25,   26,   27,   28,   29,   30,    0,
00289     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00290     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00291     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00292     0,    0,    0,    0,    0,    0,    0,    0,   17,   17,
00293     0,    0,   17,   17,   17,   17,   17,   17,   17,   14,
00294    14,    0,    0,   14,   14,   14,   14,   14,   14,   14,
00295    29,   29,    0,    0,   29,   29,   29,   29,   29,   29,
00296    29,   24,   24,    0,    0,   24,   24,   24,   24,   24,
00297    24,   24,   20,   20,    0,    0,   20,   20,   20,   20,
00298    20,   20,   20,   40,   40,    0,    0,   40,   40,   40,
00299    40,    0,   40,   40,   26,   26,    0,   39,   26,   26,
00300    26,   26,    0,    0,   26,   39,   39,
00301 };
00302 short yycheck[] = {                                      47,
00303     0,   58,  261,  266,  267,   44,  267,  266,  258,  259,
00304    58,    0,  262,  263,  264,  265,  266,  267,  268,  257,
00305   269,  262,    0,  264,  265,   44,  266,   47,  267,   47,
00306   267,  267,  267,    0,  267,   -1,   -1,   -1,   -1,   -1,
00307    -1,   -1,   -1,   -1,    0,   -1,   -1,   -1,   -1,   -1,
00308    -1,   -1,   -1,   -1,   -1,    0,   -1,   -1,   -1,   -1,
00309    -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,    0,   -1,
00310    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00311    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00312    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00313    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00314    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00315    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00316    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00317    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00318    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00319    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00320    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00321    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00322    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00323    -1,   -1,   -1,   -1,  261,   -1,   -1,   -1,   -1,  266,
00324   258,   -1,   -1,  261,  262,  263,  264,  265,  266,   -1,
00325    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00326    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00327    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00328    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  258,  259,
00329    -1,   -1,  262,  263,  264,  265,  266,  267,  268,  258,
00330   259,   -1,   -1,  262,  263,  264,  265,  266,  267,  268,
00331   258,  259,   -1,   -1,  262,  263,  264,  265,  266,  267,
00332   268,  258,  259,   -1,   -1,  262,  263,  264,  265,  266,
00333   267,  268,  258,  259,   -1,   -1,  262,  263,  264,  265,
00334   266,  267,  268,  258,  259,   -1,   -1,  262,  263,  264,
00335   265,   -1,  267,  268,  258,  259,   -1,  259,  262,  263,
00336   264,  265,   -1,   -1,  268,  267,  268,
00337 };
00338 #define YYFINAL 1
00339 #ifndef YYDEBUG
00340 #define YYDEBUG 0
00341 #endif
00342 #define YYMAXTOKEN 269
00343 #if YYDEBUG
00344 char *yyname[] = {
00345 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00346 0,0,0,0,0,0,0,0,0,0,"','",0,0,"'/'",0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0,0,0,0,0,
00347 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00348 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00349 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00350 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00351 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"tAGO","tDAY",
00352 "tDAYZONE","tID","tMERIDIAN","tMINUTE_UNIT","tMONTH","tMONTH_UNIT","tSEC_UNIT",
00353 "tSNUMBER","tUNUMBER","tZONE","tDST",
00354 };
00355 char *yyrule[] = {
00356 "$accept : spec",
00357 "spec :",
00358 "spec : spec item",
00359 "item : time",
00360 "item : zone",
00361 "item : date",
00362 "item : day",
00363 "item : rel",
00364 "item : number",
00365 "time : tUNUMBER tMERIDIAN",
00366 "time : tUNUMBER ':' tUNUMBER o_merid",
00367 "time : tUNUMBER ':' tUNUMBER tSNUMBER",
00368 "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid",
00369 "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER",
00370 "zone : tZONE",
00371 "zone : tDAYZONE",
00372 "zone : tZONE tDST",
00373 "day : tDAY",
00374 "day : tDAY ','",
00375 "day : tUNUMBER tDAY",
00376 "date : tUNUMBER '/' tUNUMBER",
00377 "date : tUNUMBER '/' tUNUMBER '/' tUNUMBER",
00378 "date : tUNUMBER tSNUMBER tSNUMBER",
00379 "date : tUNUMBER tMONTH tSNUMBER",
00380 "date : tMONTH tUNUMBER",
00381 "date : tMONTH tUNUMBER ',' tUNUMBER",
00382 "date : tUNUMBER tMONTH",
00383 "date : tUNUMBER tMONTH tUNUMBER",
00384 "rel : relunit tAGO",
00385 "rel : relunit",
00386 "relunit : tUNUMBER tMINUTE_UNIT",
00387 "relunit : tSNUMBER tMINUTE_UNIT",
00388 "relunit : tMINUTE_UNIT",
00389 "relunit : tSNUMBER tSEC_UNIT",
00390 "relunit : tUNUMBER tSEC_UNIT",
00391 "relunit : tSEC_UNIT",
00392 "relunit : tSNUMBER tMONTH_UNIT",
00393 "relunit : tUNUMBER tMONTH_UNIT",
00394 "relunit : tMONTH_UNIT",
00395 "number : tUNUMBER",
00396 "o_merid :",
00397 "o_merid : tMERIDIAN",
00398 };
00399 #endif
00400 #ifdef YYSTACKSIZE
00401 #undef YYMAXDEPTH
00402 #define YYMAXDEPTH YYSTACKSIZE
00403 #else
00404 #ifdef YYMAXDEPTH
00405 #define YYSTACKSIZE YYMAXDEPTH
00406 #else
00407 #define YYSTACKSIZE 10000
00408 #define YYMAXDEPTH 10000
00409 #endif
00410 #endif
00411 #define YYINITSTACKSIZE 200
00412 int yydebug;
00413 int yynerrs;
00414 struct yystack {
00415     short *ssp;
00416     YYSTYPE *vsp;
00417     short *ss;
00418     YYSTYPE *vs;
00419     int stacksize;
00420     short *sslim;
00421 };
00422 int yychar; /* some people use this, so we copy it in & out */
00423 int yyerrflag; /* must be global for yyerrok & YYRECOVERING */
00424 YYSTYPE yylval;
00425 #line 398 "/u/scjones/cvs-nightly/lib/getdate.y"
00426
00427 /* Month and day table. */
00428 static TABLE const MonthDayTable[] = {
00429     { "january",    tMONTH,  1 },
00430     { "february",   tMONTH,  2 },
00431     { "march",      tMONTH,  3 },
00432     { "april",      tMONTH,  4 },
00433     { "may",        tMONTH,  5 },
00434     { "june",       tMONTH,  6 },
00435     { "july",       tMONTH,  7 },
00436     { "august",     tMONTH,  8 },
00437     { "september",  tMONTH,  9 },
00438     { "sept",       tMONTH,  9 },
00439     { "october",    tMONTH, 10 },
00440     { "november",   tMONTH, 11 },
00441     { "december",   tMONTH, 12 },
00442     { "sunday",     tDAY, 0 },
00443     { "monday",     tDAY, 1 },
00444     { "tuesday",    tDAY, 2 },
00445     { "tues",       tDAY, 2 },
00446     { "wednesday",  tDAY, 3 },
00447     { "wednes",     tDAY, 3 },
00448     { "thursday",   tDAY, 4 },
00449     { "thur",       tDAY, 4 },
00450     { "thurs",      tDAY, 4 },
00451     { "friday",     tDAY, 5 },
00452     { "saturday",   tDAY, 6 },
00453     { NULL }
00454 };
00455
00456 /* Time units table. */
00457 static TABLE const UnitsTable[] = {
00458     { "year",       tMONTH_UNIT,    12 },
00459     { "month",      tMONTH_UNIT,    1 },
00460     { "fortnight",  tMINUTE_UNIT,   14 * 24 * 60 },
00461     { "week",       tMINUTE_UNIT,   7 * 24 * 60 },
00462     { "day",        tMINUTE_UNIT,   1 * 24 * 60 },
00463     { "hour",       tMINUTE_UNIT,   60 },
00464     { "minute",     tMINUTE_UNIT,   1 },
00465     { "min",        tMINUTE_UNIT,   1 },
00466     { "second",     tSEC_UNIT,  1 },
00467     { "sec",        tSEC_UNIT,  1 },
00468     { NULL }
00469 };
00470
00471 /* Assorted relative-time words. */
00472 static TABLE const OtherTable[] = {
00473     { "tomorrow",   tMINUTE_UNIT,   1 * 24 * 60 },
00474     { "yesterday",  tMINUTE_UNIT,   -1 * 24 * 60 },
00475     { "today",      tMINUTE_UNIT,   0 },
00476     { "now",        tMINUTE_UNIT,   0 },
00477     { "last",       tUNUMBER,   -1 },
00478     { "this",       tMINUTE_UNIT,   0 },
00479     { "next",       tUNUMBER,   2 },
00480     { "first",      tUNUMBER,   1 },
00481 /*  { "second",     tUNUMBER,   2 }, */
00482     { "third",      tUNUMBER,   3 },
00483     { "fourth",     tUNUMBER,   4 },
00484     { "fifth",      tUNUMBER,   5 },
00485     { "sixth",      tUNUMBER,   6 },
00486     { "seventh",    tUNUMBER,   7 },
00487     { "eighth",     tUNUMBER,   8 },
00488     { "ninth",      tUNUMBER,   9 },
00489     { "tenth",      tUNUMBER,   10 },
00490     { "eleventh",   tUNUMBER,   11 },
00491     { "twelfth",    tUNUMBER,   12 },
00492     { "ago",        tAGO,   1 },
00493     { NULL }
00494 };
00495
00496 /* The timezone table. */
00497 /* Some of these are commented out because a time_t can't store a float. */
00498 static TABLE const TimezoneTable[] = {
00499     { "gmt",    tZONE,     HOUR( 0) },  /* Greenwich Mean */
00500     { "ut", tZONE,     HOUR( 0) },  /* Universal (Coordinated) */
00501     { "utc",    tZONE,     HOUR( 0) },
00502     { "wet",    tZONE,     HOUR( 0) },  /* Western European */
00503     { "bst",    tDAYZONE,  HOUR( 0) },  /* British Summer */
00504     { "wat",    tZONE,     HOUR( 1) },  /* West Africa */
00505     { "at", tZONE,     HOUR( 2) },  /* Azores */
00506 #if 0
00507     /* For completeness.  BST is also British Summer, and GST is
00508      * also Guam Standard. */
00509     { "bst",    tZONE,     HOUR( 3) },  /* Brazil Standard */
00510     { "gst",    tZONE,     HOUR( 3) },  /* Greenland Standard */
00511 #endif
00512 #if 0
00513     { "nft",    tZONE,     HOUR(3.5) }, /* Newfoundland */
00514     { "nst",    tZONE,     HOUR(3.5) }, /* Newfoundland Standard */
00515     { "ndt",    tDAYZONE,  HOUR(3.5) }, /* Newfoundland Daylight */
00516 #endif
00517     { "ast",    tZONE,     HOUR( 4) },  /* Atlantic Standard */
00518     { "adt",    tDAYZONE,  HOUR( 4) },  /* Atlantic Daylight */
00519     { "est",    tZONE,     HOUR( 5) },  /* Eastern Standard */
00520     { "edt",    tDAYZONE,  HOUR( 5) },  /* Eastern Daylight */
00521     { "cst",    tZONE,     HOUR( 6) },  /* Central Standard */
00522     { "cdt",    tDAYZONE,  HOUR( 6) },  /* Central Daylight */
00523     { "mst",    tZONE,     HOUR( 7) },  /* Mountain Standard */
00524     { "mdt",    tDAYZONE,  HOUR( 7) },  /* Mountain Daylight */
00525     { "pst",    tZONE,     HOUR( 8) },  /* Pacific Standard */
00526     { "pdt",    tDAYZONE,  HOUR( 8) },  /* Pacific Daylight */
00527     { "yst",    tZONE,     HOUR( 9) },  /* Yukon Standard */
00528     { "ydt",    tDAYZONE,  HOUR( 9) },  /* Yukon Daylight */
00529     { "hst",    tZONE,     HOUR(10) },  /* Hawaii Standard */
00530     { "hdt",    tDAYZONE,  HOUR(10) },  /* Hawaii Daylight */
00531     { "cat",    tZONE,     HOUR(10) },  /* Central Alaska */
00532     { "ahst",   tZONE,     HOUR(10) },  /* Alaska-Hawaii Standard */
00533     { "nt", tZONE,     HOUR(11) },  /* Nome */
00534     { "idlw",   tZONE,     HOUR(12) },  /* International Date Line West */
00535     { "cet",    tZONE,     -HOUR(1) },  /* Central European */
00536     { "met",    tZONE,     -HOUR(1) },  /* Middle European */
00537     { "mewt",   tZONE,     -HOUR(1) },  /* Middle European Winter */
00538     { "mest",   tDAYZONE,  -HOUR(1) },  /* Middle European Summer */
00539     { "swt",    tZONE,     -HOUR(1) },  /* Swedish Winter */
00540     { "sst",    tDAYZONE,  -HOUR(1) },  /* Swedish Summer */
00541     { "fwt",    tZONE,     -HOUR(1) },  /* French Winter */
00542     { "fst",    tDAYZONE,  -HOUR(1) },  /* French Summer */
00543     { "eet",    tZONE,     -HOUR(2) },  /* Eastern Europe, USSR Zone 1 */
00544     { "bt", tZONE,     -HOUR(3) },  /* Baghdad, USSR Zone 2 */
00545 #if 0
00546     { "it", tZONE,     -HOUR(3.5) },/* Iran */
00547 #endif
00548     { "zp4",    tZONE,     -HOUR(4) },  /* USSR Zone 3 */
00549     { "zp5",    tZONE,     -HOUR(5) },  /* USSR Zone 4 */
00550 #if 0
00551     { "ist",    tZONE,     -HOUR(5.5) },/* Indian Standard */
00552 #endif
00553     { "zp6",    tZONE,     -HOUR(6) },  /* USSR Zone 5 */
00554 #if 0
00555     /* For completeness.  NST is also Newfoundland Stanard, and SST is
00556      * also Swedish Summer. */
00557     { "nst",    tZONE,     -HOUR(6.5) },/* North Sumatra */
00558     { "sst",    tZONE,     -HOUR(7) },  /* South Sumatra, USSR Zone 6 */
00559 #endif  /* 0 */
00560     { "wast",   tZONE,     -HOUR(7) },  /* West Australian Standard */
00561     { "wadt",   tDAYZONE,  -HOUR(7) },  /* West Australian Daylight */
00562 #if 0
00563     { "jt", tZONE,     -HOUR(7.5) },/* Java (3pm in Cronusland!) */
00564 #endif
00565     { "cct",    tZONE,     -HOUR(8) },  /* China Coast, USSR Zone 7 */
00566     { "jst",    tZONE,     -HOUR(9) },  /* Japan Standard, USSR Zone 8 */
00567 #if 0
00568     { "cast",   tZONE,     -HOUR(9.5) },/* Central Australian Standard */
00569     { "cadt",   tDAYZONE,  -HOUR(9.5) },/* Central Australian Daylight */
00570 #endif
00571     { "east",   tZONE,     -HOUR(10) }, /* Eastern Australian Standard */
00572     { "eadt",   tDAYZONE,  -HOUR(10) }, /* Eastern Australian Daylight */
00573     { "gst",    tZONE,     -HOUR(10) }, /* Guam Standard, USSR Zone 9 */
00574     { "nzt",    tZONE,     -HOUR(12) }, /* New Zealand */
00575     { "nzst",   tZONE,     -HOUR(12) }, /* New Zealand Standard */
00576     { "nzdt",   tDAYZONE,  -HOUR(12) }, /* New Zealand Daylight */
00577     { "idle",   tZONE,     -HOUR(12) }, /* International Date Line East */
00578     {  NULL  }
00579 };
00580
00581 /* Military timezone table. */
00582 static TABLE const MilitaryTable[] = {
00583     { "a",  tZONE,  HOUR(  1) },
00584     { "b",  tZONE,  HOUR(  2) },
00585     { "c",  tZONE,  HOUR(  3) },
00586     { "d",  tZONE,  HOUR(  4) },
00587     { "e",  tZONE,  HOUR(  5) },
00588     { "f",  tZONE,  HOUR(  6) },
00589     { "g",  tZONE,  HOUR(  7) },
00590     { "h",  tZONE,  HOUR(  8) },
00591     { "i",  tZONE,  HOUR(  9) },
00592     { "k",  tZONE,  HOUR( 10) },
00593     { "l",  tZONE,  HOUR( 11) },
00594     { "m",  tZONE,  HOUR( 12) },
00595     { "n",  tZONE,  HOUR(- 1) },
00596     { "o",  tZONE,  HOUR(- 2) },
00597     { "p",  tZONE,  HOUR(- 3) },
00598     { "q",  tZONE,  HOUR(- 4) },
00599     { "r",  tZONE,  HOUR(- 5) },
00600     { "s",  tZONE,  HOUR(- 6) },
00601     { "t",  tZONE,  HOUR(- 7) },
00602     { "u",  tZONE,  HOUR(- 8) },
00603     { "v",  tZONE,  HOUR(- 9) },
00604     { "w",  tZONE,  HOUR(-10) },
00605     { "x",  tZONE,  HOUR(-11) },
00606     { "y",  tZONE,  HOUR(-12) },
00607     { "z",  tZONE,  HOUR(  0) },
00608     { NULL }
00609 };
00610
00611
00612
00613
00614 /* ARGSUSED */
00615 static int
00616 yyerror(char *s)
00617 {
00618   return 0;
00619 }
00620
00621
00622 static time_t
00623 ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian)
00624 {
00625     if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59)
00626     return -1;
00627     switch (Meridian) {
00628     case MER24:
00629     if (Hours < 0 || Hours > 23)
00630         return -1;
00631     return (Hours * 60L + Minutes) * 60L + Seconds;
00632     case MERam:
00633     if (Hours < 1 || Hours > 12)
00634         return -1;
00635     if (Hours == 12)
00636         Hours = 0;
00637     return (Hours * 60L + Minutes) * 60L + Seconds;
00638     case MERpm:
00639     if (Hours < 1 || Hours > 12)
00640         return -1;
00641     if (Hours == 12)
00642         Hours = 0;
00643     return ((Hours + 12) * 60L + Minutes) * 60L + Seconds;
00644     default:
00645     abort ();
00646     }
00647     /* NOTREACHED */
00648 }
00649
00650
00651 /* Year is either
00652    * A negative number, which means to use its absolute value (why?)
00653    * A number from 0 to 99, which means a year from 1900 to 1999, or
00654    * The actual year (>=100).  */
00655 static time_t
00656 Convert(time_t Month, time_t Day, time_t Year, time_t Hours, time_t Minutes, time_t Seconds,
00657     MERIDIAN Meridian, DSTMODE DSTmode)
00658 {
00659     static int DaysInMonth[12] = {
00660     31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
00661     };
00662     time_t  tod;
00663     time_t  Julian;
00664     int     i;
00665
00666     if (Year < 0)
00667     Year = -Year;
00668     if (Year < 69)
00669     Year += 2000;
00670     else if (Year < 100)
00671     Year += 1900;
00672     DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
00673             ? 29 : 28;
00674     /* Checking for 2038 bogusly assumes that time_t is 32 bits.  But
00675        I'm too lazy to try to check for time_t overflow in another way.  */
00676     if (Year < EPOCH || Year > 2038
00677      || Month < 1 || Month > 12
00678      /* Lint fluff:  "conversion from long may lose accuracy" */
00679      || Day < 1 || Day > DaysInMonth[(int)--Month])
00680     return -1;
00681
00682     for (Julian = Day - 1, i = 0; i < Month; i++)
00683     Julian += DaysInMonth[i];
00684     for (i = EPOCH; i < Year; i++)
00685     Julian += 365 + (i % 4 == 0);
00686     Julian *= SECSPERDAY;
00687     Julian += yyTimezone * 60L;
00688     if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
00689     return -1;
00690     Julian += tod;
00691     if (DSTmode == DSTon
00692      || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
00693     Julian -= 60 * 60;
00694     return Julian;
00695 }
00696
00697
00698 static time_t
00699 DSTcorrect(time_t Start, time_t Future)
00700 {
00701     time_t  StartDay;
00702     time_t  FutureDay;
00703
00704     StartDay = (localtime(&Start)->tm_hour + 1) % 24;
00705     FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
00706     return (Future - Start) + (StartDay - FutureDay) * 60L * 60L;
00707 }
00708
00709
00710 static time_t
00711 RelativeDate(time_t Start, time_t DayOrdinal, time_t DayNumber)
00712 {
00713     struct tm   *tm;
00714     time_t  now;
00715
00716     now = Start;
00717     tm = localtime(&now);
00718     now += SECSPERDAY * ((DayNumber - tm->tm_wday + 7) % 7);
00719     now += 7 * SECSPERDAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
00720     return DSTcorrect(Start, now);
00721 }
00722
00723
00724 static time_t
00725 RelativeMonth(time_t Start, time_t RelMonth)
00726 {
00727     struct tm   *tm;
00728     time_t  Month;
00729     time_t  Year;
00730
00731     if (RelMonth == 0)
00732     return 0;
00733     tm = localtime(&Start);
00734     Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth;
00735     Year = Month / 12;
00736     Month = Month % 12 + 1;
00737     return DSTcorrect(Start,
00738         Convert(Month, (time_t)tm->tm_mday, Year,
00739         (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
00740         MER24, DSTmaybe));
00741 }
00742
00743
00744 static int
00745 LookupWord(char     *buff)
00746 {
00747     register char   *p;
00748     register char   *q;
00749     register const TABLE    *tp;
00750     int         i;
00751     int         abbrev;
00752
00753     /* Make it lowercase. */
00754     for (p = buff; *p; p++)
00755     if (isupper(*p))
00756         *p = tolower(*p);
00757
00758     if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
00759     yylval.Meridian = MERam;
00760     return tMERIDIAN;
00761     }
00762     if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
00763     yylval.Meridian = MERpm;
00764     return tMERIDIAN;
00765     }
00766
00767     /* See if we have an abbreviation for a month. */
00768     if (strlen(buff) == 3)
00769     abbrev = 1;
00770     else if (strlen(buff) == 4 && buff[3] == '.') {
00771     abbrev = 1;
00772     buff[3] = '\0';
00773     }
00774     else
00775     abbrev = 0;
00776
00777     for (tp = MonthDayTable; tp->name; tp++) {
00778     if (abbrev) {
00779         if (strncmp(buff, tp->name, 3) == 0) {
00780         yylval.Number = tp->value;
00781         return tp->type;
00782         }
00783     }
00784     else if (strcmp(buff, tp->name) == 0) {
00785         yylval.Number = tp->value;
00786         return tp->type;
00787     }
00788     }
00789
00790     for (tp = TimezoneTable; tp->name; tp++)
00791     if (strcmp(buff, tp->name) == 0) {
00792         yylval.Number = tp->value;
00793         return tp->type;
00794     }
00795
00796     if (strcmp(buff, "dst") == 0)
00797     return tDST;
00798
00799     for (tp = UnitsTable; tp->name; tp++)
00800     if (strcmp(buff, tp->name) == 0) {
00801         yylval.Number = tp->value;
00802         return tp->type;
00803     }
00804
00805     /* Strip off any plural and try the units table again. */
00806     i = strlen(buff) - 1;
00807     if (buff[i] == 's') {
00808     buff[i] = '\0';
00809     for (tp = UnitsTable; tp->name; tp++)
00810         if (strcmp(buff, tp->name) == 0) {
00811         yylval.Number = tp->value;
00812         return tp->type;
00813         }
00814     buff[i] = 's';      /* Put back for "this" in OtherTable. */
00815     }
00816
00817     for (tp = OtherTable; tp->name; tp++)
00818     if (strcmp(buff, tp->name) == 0) {
00819         yylval.Number = tp->value;
00820         return tp->type;
00821     }
00822
00823     /* Military timezones. */
00824     if (buff[1] == '\0' && isalpha(*buff)) {
00825     for (tp = MilitaryTable; tp->name; tp++)
00826         if (strcmp(buff, tp->name) == 0) {
00827         yylval.Number = tp->value;
00828         return tp->type;
00829         }
00830     }
00831
00832     /* Drop out any periods and try the timezone table again. */
00833     for (i = 0, p = q = buff; *q; q++)
00834     if (*q != '.')
00835         *p++ = *q;
00836     else
00837         i++;
00838     *p = '\0';
00839     if (i)
00840     for (tp = TimezoneTable; tp->name; tp++)
00841         if (strcmp(buff, tp->name) == 0) {
00842         yylval.Number = tp->value;
00843         return tp->type;
00844         }
00845
00846     return tID;
00847 }
00848
00849
00850 static int
00851 yylex()
00852 {
00853     register char   c;
00854     register char   *p;
00855     char        buff[20];
00856     int         Count;
00857     int         sign;
00858
00859     for ( ; ; ) {
00860     while (isspace(*yyInput))
00861         yyInput++;
00862
00863     if (isdigit(c = *yyInput) || c == '-' || c == '+') {
00864         if (c == '-' || c == '+') {
00865         sign = c == '-' ? -1 : 1;
00866         if (!isdigit(*++yyInput))
00867             /* skip the '-' sign */
00868             continue;
00869         }
00870         else
00871         sign = 0;
00872         for (yylval.Number = 0; isdigit(c = *yyInput++); )
00873         yylval.Number = 10 * yylval.Number + c - '0';
00874         yyInput--;
00875         if (sign < 0)
00876         yylval.Number = -yylval.Number;
00877         return sign ? tSNUMBER : tUNUMBER;
00878     }
00879     if (isalpha(c)) {
00880         for (p = buff; isalpha(c = *yyInput++) || c == '.'; )
00881         if (p < &buff[sizeof buff - 1])
00882             *p++ = c;
00883         *p = '\0';
00884         yyInput--;
00885         return LookupWord(buff);
00886     }
00887     if (c != '(')
00888         return *yyInput++;
00889     Count = 0;
00890     do {
00891         c = *yyInput++;
00892         if (c == '\0')
00893         return c;
00894         if (c == '(')
00895         Count++;
00896         else if (c == ')')
00897         Count--;
00898     } while (Count > 0);
00899     }
00900 }
00901
00902 #define TM_YEAR_ORIGIN 1900
00903
00904 /* Yield A - B, measured in seconds.  */
00905 static long
00906 difftm (struct tm *a, struct tm *b)
00907 {
00908   int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
00909   int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
00910   int days = (
00911           /* difference in day of year */
00912           a->tm_yday - b->tm_yday
00913           /* + intervening leap days */
00914           +  ((ay >> 2) - (by >> 2))
00915           -  (ay/100 - by/100)
00916           +  ((ay/100 >> 2) - (by/100 >> 2))
00917           /* + difference in years * 365 */
00918           +  (long)(ay-by) * 365
00919           );
00920   return (60*(60*(24*days + (a->tm_hour - b->tm_hour))
00921           + (a->tm_min - b->tm_min))
00922       + (a->tm_sec - b->tm_sec));
00923 }
00924
00925 time_t
00926 get_date(char       *p, struct timeb    *now)
00927 {
00928     struct tm       *tm, gmt;
00929     struct timeb    ftz;
00930     time_t      Start;
00931     time_t      tod;
00932     time_t nowtime;
00933
00934     yyInput = p;
00935     if (now == NULL) {
00936     struct tm *gmt_ptr;
00937
00938         now = &ftz;
00939     (void)time (&nowtime);
00940
00941     gmt_ptr = gmtime (&nowtime);
00942     if (gmt_ptr != NULL)
00943     {
00944         /* Make a copy, in case localtime modifies *tm (I think
00945            that comment now applies to *gmt_ptr, but I am too
00946            lazy to dig into how gmtime and locatime allocate the
00947            structures they return pointers to).  */
00948         gmt = *gmt_ptr;
00949     }
00950
00951     if (! (tm = localtime (&nowtime)))
00952         return -1;
00953
00954     if (gmt_ptr != NULL)
00955         ftz.timezone = difftm (&gmt, tm) / 60;
00956     else
00957         /* We are on a system like VMS, where the system clock is
00958            in local time and the system has no concept of timezones.
00959            Hopefully we can fake this out (for the case in which the
00960            user specifies no timezone) by just saying the timezone
00961            is zero.  */
00962         ftz.timezone = 0;
00963
00964     if(tm->tm_isdst)
00965         ftz.timezone += 60;
00966     }
00967     else
00968     {
00969     nowtime = now->time;
00970     }
00971
00972     tm = localtime(&nowtime);
00973     yyYear = tm->tm_year + 1900;
00974     yyMonth = tm->tm_mon + 1;
00975     yyDay = tm->tm_mday;
00976     yyTimezone = now->timezone;
00977     yyDSTmode = DSTmaybe;
00978     yyHour = 0;
00979     yyMinutes = 0;
00980     yySeconds = 0;
00981     yyMeridian = MER24;
00982     yyRelSeconds = 0;
00983     yyRelMonth = 0;
00984     yyHaveDate = 0;
00985     yyHaveDay = 0;
00986     yyHaveRel = 0;
00987     yyHaveTime = 0;
00988     yyHaveZone = 0;
00989
00990     if (yyparse()
00991      || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
00992     return -1;
00993
00994     if (yyHaveDate || yyHaveTime || yyHaveDay) {
00995     Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
00996             yyMeridian, yyDSTmode);
00997     if (Start == -1)
00998         return -1;
00999     }
01000     else {
01001     Start = nowtime;
01002     if (!yyHaveRel)
01003         Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) + tm->tm_sec;
01004     }
01005
01006     Start += yyRelSeconds;
01007     Start += RelativeMonth(Start, yyRelMonth);
01008
01009     if (yyHaveDay && !yyHaveDate) {
01010     tod = RelativeDate(Start, yyDayOrdinal, yyDayNumber);
01011     Start += tod;
01012     }
01013
01014     /* Have to do *something* with a legitimate -1 so it's distinguishable
01015      * from the error return value.  (Alternately could set errno on error.) */
01016     return Start == -1 ? 0 : Start;
01017 }
01018
01019
01020 #if defined(TEST)
01021
01022 /* ARGSUSED */
01023 int
01024 main(ac, av)
01025     int     ac;
01026     char    *av[];
01027 {
01028     char    buff[128];
01029     time_t  d;
01030
01031     (void)printf("Enter date, or blank line to exit.\n\t> ");
01032     (void)fflush(stdout);
01033     while (gets(buff) && buff[0]) {
01034     d = get_date(buff, (struct timeb *)NULL);
01035     if (d == -1)
01036         (void)printf("Bad format - couldn't convert.\n");
01037     else
01038         (void)printf("%s", ctime(&d));
01039     (void)printf("\t> ");
01040     (void)fflush(stdout);
01041     }
01042     exit(0);
01043     /* NOTREACHED */
01044 }
01045 #endif  /* defined(TEST) */
01046 #line 1056 "y.tab.c"
01047 /* allocate initial stack */
01048 #if defined(__STDC__) || defined(__cplusplus)
01049 static int yyinitstack(struct yystack *sp)
01050 #else
01051 static int yyinitstack(sp)
01052     struct yystack *sp;
01053 #endif
01054 {
01055     int newsize;
01056     short *newss;
01057     YYSTYPE *newvs;
01058
01059     newsize = YYINITSTACKSIZE;
01060     newss = (short *)malloc(newsize * sizeof *newss);
01061     newvs = (YYSTYPE *)malloc(newsize * sizeof *newvs);
01062     sp->ss = sp->ssp = newss;
01063     sp->vs = sp->vsp = newvs;
01064     if (newss == NULL || newvs == NULL) return -1;
01065     sp->stacksize = newsize;
01066     sp->sslim = newss + newsize - 1;
01067     return 0;
01068 }
01069
01070 /* double stack size, up to YYMAXDEPTH */
01071 #if defined(__STDC__) || defined(__cplusplus)
01072 static int yygrowstack(struct yystack *sp)
01073 #else
01074 static int yygrowstack(sp)
01075     struct yystack *sp;
01076 #endif
01077 {
01078     int newsize, i;
01079     short *newss;
01080     YYSTYPE *newvs;
01081
01082     if ((newsize = sp->stacksize) >= YYMAXDEPTH) return -1;
01083     if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH;
01084     i = sp->ssp - sp->ss;
01085     if ((newss = (short *)realloc(sp->ss, newsize * sizeof *newss)) == NULL)
01086         return -1;
01087     sp->ss = newss;
01088     sp->ssp = newss + i;
01089     if ((newvs = (YYSTYPE *)realloc(sp->vs, newsize * sizeof *newvs)) == NULL)
01090         return -1;
01091     sp->vs = newvs;
01092     sp->vsp = newvs + i;
01093     sp->stacksize = newsize;
01094     sp->sslim = newss + newsize - 1;
01095     return 0;
01096 }
01097
01098 #define YYFREESTACK(sp) { free((sp)->ss); free((sp)->vs); }
01099
01100 #define YYABORT goto yyabort
01101 #define YYREJECT goto yyabort
01102 #define YYACCEPT goto yyaccept
01103 #define YYERROR goto yyerrlab
01104 static int
01105 yyparse()
01106 {
01107     register int yym, yyn, yystate, yych;
01108     register YYSTYPE *yyvsp;
01109     YYSTYPE yyval;
01110     struct yystack yystk;
01111 #if YYDEBUG
01112     register char *yys;
01113     extern char *getenv();
01114
01115     if (yys = getenv("YYDEBUG"))
01116     {
01117         yyn = *yys;
01118         if (yyn >= '0' && yyn <= '9')
01119             yydebug = yyn - '0';
01120     }
01121 #endif
01122
01123     yynerrs = 0;
01124     yyerrflag = 0;
01125     yychar = yych = YYEMPTY;
01126
01127     if (yyinitstack(&yystk)) goto yyoverflow;
01128     *yystk.ssp = yystate = 0;
01129
01130 yyloop:
01131     if (yyn = yydefred[yystate]) goto yyreduce;
01132     if (yych < 0)
01133     {
01134         if ((yych = YYLEX) < 0) yych = 0;
01135         yychar = yych;
01136 #if YYDEBUG
01137         if (yydebug)
01138         {
01139             yys = 0;
01140             if (yych <= YYMAXTOKEN) yys = yyname[yych];
01141             if (!yys) yys = "illegal-symbol";
01142             printf("%sdebug: state %d, reading %d (%s)\n",
01143                     YYPREFIX, yystate, yych, yys);
01144         }
01145 #endif
01146     }
01147     if ((yyn = yysindex[yystate]) && (yyn += yych) >= 0 &&
01148             yyn <= YYTABLESIZE && yycheck[yyn] == yych)
01149     {
01150 #if YYDEBUG
01151         if (yydebug)
01152             printf("%sdebug: state %d, shifting to state %d\n",
01153                     YYPREFIX, yystate, yytable[yyn]);
01154 #endif
01155         if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
01156             goto yyoverflow;
01157         *++yystk.ssp = yystate = yytable[yyn];
01158         *++yystk.vsp = yylval;
01159         yychar = yych = YYEMPTY;
01160         if (yyerrflag > 0)  --yyerrflag;
01161         goto yyloop;
01162     }
01163     if ((yyn = yyrindex[yystate]) && (yyn += yych) >= 0 &&
01164             yyn <= YYTABLESIZE && yycheck[yyn] == yych)
01165     {
01166         yyn = yytable[yyn];
01167         goto yyreduce;
01168     }
01169     if (yyerrflag) goto yyinrecovery;
01170 #ifdef lint
01171     goto yynewerror;
01172 #endif
01173 yynewerror:
01174     yyerror("syntax error");
01175 #ifdef lint
01176     goto yyerrlab;
01177 #endif
01178 yyerrlab:
01179     ++yynerrs;
01180 yyinrecovery:
01181     if (yyerrflag < 3)
01182     {
01183         yyerrflag = 3;
01184         for (;;)
01185         {
01186             if ((yyn = yysindex[*yystk.ssp]) &&
01187                     (yyn += YYERRCODE) >= 0 &&
01188                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
01189             {
01190 #if YYDEBUG
01191                 if (yydebug)
01192                     printf("%sdebug: state %d, error recovery shifting\
01193  to state %d\n", YYPREFIX, *yystk.ssp, yytable[yyn]);
01194 #endif
01195                 if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
01196                     goto yyoverflow;
01197                 *++yystk.ssp = yystate = yytable[yyn];
01198                 *++yystk.vsp = yylval;
01199                 goto yyloop;
01200             }
01201             else
01202             {
01203 #if YYDEBUG
01204                 if (yydebug)
01205                     printf("%sdebug: error recovery discarding state %d\n",
01206                             YYPREFIX, *yystk.ssp);
01207 #endif
01208                 if (yystk.ssp <= yystk.ss) goto yyabort;
01209                 --yystk.ssp;
01210                 --yystk.vsp;
01211             }
01212         }
01213     }
01214     else
01215     {
01216         if (yych == 0) goto yyabort;
01217 #if YYDEBUG
01218         if (yydebug)
01219         {
01220             yys = 0;
01221             if (yych <= YYMAXTOKEN) yys = yyname[yych];
01222             if (!yys) yys = "illegal-symbol";
01223             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
01224                     YYPREFIX, yystate, yych, yys);
01225         }
01226 #endif
01227         yychar = yych = YYEMPTY;
01228         goto yyloop;
01229     }
01230 yyreduce:
01231 #if YYDEBUG
01232     if (yydebug)
01233         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
01234                 YYPREFIX, yystate, yyn, yyrule[yyn]);
01235 #endif
01236     yym = yylen[yyn];
01237     yyvsp = yystk.vsp; /* for speed in code under switch() */
01238     yyval = yyvsp[1-yym];
01239     switch (yyn)
01240     {
01241 case 3:
01242 #line 197 "/u/scjones/cvs-nightly/lib/getdate.y"
01243 {
01244         yyHaveTime++;
01245     }
01246 break;
01247 case 4:
01248 #line 200 "/u/scjones/cvs-nightly/lib/getdate.y"
01249 {
01250         yyHaveZone++;
01251     }
01252 break;
01253 case 5:
01254 #line 203 "/u/scjones/cvs-nightly/lib/getdate.y"
01255 {
01256         yyHaveDate++;
01257     }
01258 break;
01259 case 6:
01260 #line 206 "/u/scjones/cvs-nightly/lib/getdate.y"
01261 {
01262         yyHaveDay++;
01263     }
01264 break;
01265 case 7:
01266 #line 209 "/u/scjones/cvs-nightly/lib/getdate.y"
01267 {
01268         yyHaveRel++;
01269     }
01270 break;
01271 case 9:
01272 #line 215 "/u/scjones/cvs-nightly/lib/getdate.y"
01273 {
01274         yyHour = yyvsp[-1].Number;
01275         yyMinutes = 0;
01276         yySeconds = 0;
01277         yyMeridian = yyvsp[0].Meridian;
01278     }
01279 break;
01280 case 10:
01281 #line 221 "/u/scjones/cvs-nightly/lib/getdate.y"
01282 {
01283         yyHour = yyvsp[-3].Number;
01284         yyMinutes = yyvsp[-1].Number;
01285         yySeconds = 0;
01286         yyMeridian = yyvsp[0].Meridian;
01287     }
01288 break;
01289 case 11:
01290 #line 227 "/u/scjones/cvs-nightly/lib/getdate.y"
01291 {
01292         yyHour = yyvsp[-3].Number;
01293         yyMinutes = yyvsp[-1].Number;
01294         yyMeridian = MER24;
01295         yyDSTmode = DSToff;
01296         yyTimezone = - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60);
01297     }
01298 break;
01299 case 12:
01300 #line 234 "/u/scjones/cvs-nightly/lib/getdate.y"
01301 {
01302         yyHour = yyvsp[-5].Number;
01303         yyMinutes = yyvsp[-3].Number;
01304         yySeconds = yyvsp[-1].Number;
01305         yyMeridian = yyvsp[0].Meridian;
01306     }
01307 break;
01308 case 13:
01309 #line 240 "/u/scjones/cvs-nightly/lib/getdate.y"
01310 {
01311         yyHour = yyvsp[-5].Number;
01312         yyMinutes = yyvsp[-3].Number;
01313         yySeconds = yyvsp[-1].Number;
01314         yyMeridian = MER24;
01315         yyDSTmode = DSToff;
01316         yyTimezone = - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60);
01317     }
01318 break;
01319 case 14:
01320 #line 250 "/u/scjones/cvs-nightly/lib/getdate.y"
01321 {
01322         yyTimezone = yyvsp[0].Number;
01323         yyDSTmode = DSToff;
01324     }
01325 break;
01326 case 15:
01327 #line 254 "/u/scjones/cvs-nightly/lib/getdate.y"
01328 {
01329         yyTimezone = yyvsp[0].Number;
01330         yyDSTmode = DSTon;
01331     }
01332 break;
01333 case 16:
01334 #line 259 "/u/scjones/cvs-nightly/lib/getdate.y"
01335 {
01336         yyTimezone = yyvsp[-1].Number;
01337         yyDSTmode = DSTon;
01338     }
01339 break;
01340 case 17:
01341 #line 265 "/u/scjones/cvs-nightly/lib/getdate.y"
01342 {
01343         yyDayOrdinal = 1;
01344         yyDayNumber = yyvsp[0].Number;
01345     }
01346 break;
01347 case 18:
01348 #line 269 "/u/scjones/cvs-nightly/lib/getdate.y"
01349 {
01350         yyDayOrdinal = 1;
01351         yyDayNumber = yyvsp[-1].Number;
01352     }
01353 break;
01354 case 19:
01355 #line 273 "/u/scjones/cvs-nightly/lib/getdate.y"
01356 {
01357         yyDayOrdinal = yyvsp[-1].Number;
01358         yyDayNumber = yyvsp[0].Number;
01359     }
01360 break;
01361 case 20:
01362 #line 279 "/u/scjones/cvs-nightly/lib/getdate.y"
01363 {
01364         yyMonth = yyvsp[-2].Number;
01365         yyDay = yyvsp[0].Number;
01366     }
01367 break;
01368 case 21:
01369 #line 283 "/u/scjones/cvs-nightly/lib/getdate.y"
01370 {
01371         if (yyvsp[-4].Number >= 100) {
01372         yyYear = yyvsp[-4].Number;
01373         yyMonth = yyvsp[-2].Number;
01374         yyDay = yyvsp[0].Number;
01375         } else {
01376         yyMonth = yyvsp[-4].Number;
01377         yyDay = yyvsp[-2].Number;
01378         yyYear = yyvsp[0].Number;
01379         }
01380     }
01381 break;
01382 case 22:
01383 #line 294 "/u/scjones/cvs-nightly/lib/getdate.y"
01384 {
01385         /* ISO 8601 format.  yyyy-mm-dd.  */
01386         yyYear = yyvsp[-2].Number;
01387         yyMonth = -yyvsp[-1].Number;
01388         yyDay = -yyvsp[0].Number;
01389     }
01390 break;
01391 case 23:
01392 #line 300 "/u/scjones/cvs-nightly/lib/getdate.y"
01393 {
01394         /* e.g. 17-JUN-1992.  */
01395         yyDay = yyvsp[-2].Number;
01396         yyMonth = yyvsp[-1].Number;
01397         yyYear = -yyvsp[0].Number;
01398     }
01399 break;
01400 case 24:
01401 #line 306 "/u/scjones/cvs-nightly/lib/getdate.y"
01402 {
01403         yyMonth = yyvsp[-1].Number;
01404         yyDay = yyvsp[0].Number;
01405     }
01406 break;
01407 case 25:
01408 #line 310 "/u/scjones/cvs-nightly/lib/getdate.y"
01409 {
01410         yyMonth = yyvsp[-3].Number;
01411         yyDay = yyvsp[-2].Number;
01412         yyYear = yyvsp[0].Number;
01413     }
01414 break;
01415 case 26:
01416 #line 315 "/u/scjones/cvs-nightly/lib/getdate.y"
01417 {
01418         yyMonth = yyvsp[0].Number;
01419         yyDay = yyvsp[-1].Number;
01420     }
01421 break;
01422 case 27:
01423 #line 319 "/u/scjones/cvs-nightly/lib/getdate.y"
01424 {
01425         yyMonth = yyvsp[-1].Number;
01426         yyDay = yyvsp[-2].Number;
01427         yyYear = yyvsp[0].Number;
01428     }
01429 break;
01430 case 28:
01431 #line 326 "/u/scjones/cvs-nightly/lib/getdate.y"
01432 {
01433         yyRelSeconds = -yyRelSeconds;
01434         yyRelMonth = -yyRelMonth;
01435     }
01436 break;
01437 case 30:
01438 #line 333 "/u/scjones/cvs-nightly/lib/getdate.y"
01439 {
01440         yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
01441     }
01442 break;
01443 case 31:
01444 #line 336 "/u/scjones/cvs-nightly/lib/getdate.y"
01445 {
01446         yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
01447     }
01448 break;
01449 case 32:
01450 #line 339 "/u/scjones/cvs-nightly/lib/getdate.y"
01451 {
01452         yyRelSeconds += yyvsp[0].Number * 60L;
01453     }
01454 break;
01455 case 33:
01456 #line 342 "/u/scjones/cvs-nightly/lib/getdate.y"
01457 {
01458         yyRelSeconds += yyvsp[-1].Number;
01459     }
01460 break;
01461 case 34:
01462 #line 345 "/u/scjones/cvs-nightly/lib/getdate.y"
01463 {
01464         yyRelSeconds += yyvsp[-1].Number;
01465     }
01466 break;
01467 case 35:
01468 #line 348 "/u/scjones/cvs-nightly/lib/getdate.y"
01469 {
01470         yyRelSeconds++;
01471     }
01472 break;
01473 case 36:
01474 #line 351 "/u/scjones/cvs-nightly/lib/getdate.y"
01475 {
01476         yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
01477     }
01478 break;
01479 case 37:
01480 #line 354 "/u/scjones/cvs-nightly/lib/getdate.y"
01481 {
01482         yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
01483     }
01484 break;
01485 case 38:
01486 #line 357 "/u/scjones/cvs-nightly/lib/getdate.y"
01487 {
01488         yyRelMonth += yyvsp[0].Number;
01489     }
01490 break;
01491 case 39:
01492 #line 362 "/u/scjones/cvs-nightly/lib/getdate.y"
01493 {
01494         if (yyHaveTime && yyHaveDate && !yyHaveRel)
01495         yyYear = yyvsp[0].Number;
01496         else {
01497         if(yyvsp[0].Number>10000) {
01498             yyHaveDate++;
01499             yyDay= (yyvsp[0].Number)%100;
01500             yyMonth= (yyvsp[0].Number/100)%100;
01501             yyYear = yyvsp[0].Number/10000;
01502         }
01503         else {
01504             yyHaveTime++;
01505             if (yyvsp[0].Number < 100) {
01506             yyHour = yyvsp[0].Number;
01507             yyMinutes = 0;
01508             }
01509             else {
01510                 yyHour = yyvsp[0].Number / 100;
01511                 yyMinutes = yyvsp[0].Number % 100;
01512             }
01513             yySeconds = 0;
01514             yyMeridian = MER24;
01515             }
01516         }
01517     }
01518 break;
01519 case 40:
01520 #line 389 "/u/scjones/cvs-nightly/lib/getdate.y"
01521 {
01522         yyval.Meridian = MER24;
01523     }
01524 break;
01525 case 41:
01526 #line 392 "/u/scjones/cvs-nightly/lib/getdate.y"
01527 {
01528         yyval.Meridian = yyvsp[0].Meridian;
01529     }
01530 break;
01531 #line 1541 "y.tab.c"
01532     }
01533     yystk.ssp -= yym;
01534     yystate = *yystk.ssp;
01535     yystk.vsp -= yym;
01536     yym = yylhs[yyn];
01537     yych = yychar;
01538     if (yystate == 0 && yym == 0)
01539     {
01540 #if YYDEBUG
01541         if (yydebug)
01542             printf("%sdebug: after reduction, shifting from state 0 to\
01543  state %d\n", YYPREFIX, YYFINAL);
01544 #endif
01545         yystate = YYFINAL;
01546         *++yystk.ssp = YYFINAL;
01547         *++yystk.vsp = yyval;
01548         if (yych < 0)
01549         {
01550             if ((yych = YYLEX) < 0) yych = 0;
01551             yychar = yych;
01552 #if YYDEBUG
01553             if (yydebug)
01554             {
01555                 yys = 0;
01556                 if (yych <= YYMAXTOKEN) yys = yyname[yych];
01557                 if (!yys) yys = "illegal-symbol";
01558                 printf("%sdebug: state %d, reading %d (%s)\n",
01559                         YYPREFIX, YYFINAL, yych, yys);
01560             }
01561 #endif
01562         }
01563         if (yych == 0) goto yyaccept;
01564         goto yyloop;
01565     }
01566     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
01567             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
01568         yystate = yytable[yyn];
01569     else
01570         yystate = yydgoto[yym];
01571 #if YYDEBUG
01572     if (yydebug)
01573         printf("%sdebug: after reduction, shifting from state %d \
01574 to state %d\n", YYPREFIX, *yystk.ssp, yystate);
01575 #endif
01576     if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
01577         goto yyoverflow;
01578     *++yystk.ssp = yystate;
01579     *++yystk.vsp = yyval;
01580     goto yyloop;
01581 yyoverflow:
01582     yyerror("yacc stack overflow");
01583 yyabort:
01584     YYFREESTACK(&yystk);
01585     return (1);
01586 yyaccept:
01587     YYFREESTACK(&yystk);
01588     return (0);
01589 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/getdate.y Source File

cvs-1.10/lib/getdate.y

Go to the documentation of this file.
00001 %{
00002 /*
00003 **  Originally written by Steven M. Bellovin <smb@research.att.com> while
00004 **  at the University of North Carolina at Chapel Hill.  Later tweaked by
00005 **  a couple of people on Usenet.  Completely overhauled by Rich $alz
00006 **  <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
00007 **
00008 **  This grammar has 10 shift/reduce conflicts.
00009 **
00010 **  This code is in the public domain and has no copyright.
00011 */
00012 /* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */
00013 /* SUPPRESS 288 on yyerrlab *//* Label unused */
00014
00015 #ifdef HAVE_CONFIG_H
00016 #if defined (emacs) || defined (CONFIG_BROKETS)
00017 #include <config.h>
00018 #else
00019 #include "config.h"
00020 #endif
00021 #endif
00022
00023 /* Since the code of getdate.y is not included in the Emacs executable
00024    itself, there is no need to #define static in this file.  Even if
00025    the code were included in the Emacs executable, it probably
00026    wouldn't do any harm to #undef it here; this will only cause
00027    problems if we try to write to a static variable, which I don't
00028    think this code needs to do.  */
00029 #ifdef emacs
00030 #undef static
00031 #endif
00032
00033 #include <stdio.h>
00034 #include <ctype.h>
00035
00036 /* The code at the top of get_date which figures out the offset of the
00037    current time zone checks various CPP symbols to see if special
00038    tricks are need, but defaults to using the gettimeofday system call.
00039    Include <sys/time.h> if that will be used.  */
00040
00041 #if defined(vms)
00042
00043 #include <types.h>
00044 #include <time.h>
00045
00046 #else
00047
00048 #include <sys/types.h>
00049
00050 #ifdef TIME_WITH_SYS_TIME
00051 #include <sys/time.h>
00052 #include <time.h>
00053 #else
00054 #ifdef HAVE_SYS_TIME_H
00055 #include <sys/time.h>
00056 #else
00057 #include <time.h>
00058 #endif
00059 #endif
00060
00061 #ifdef timezone
00062 #undef timezone /* needed for sgi */
00063 #endif
00064
00065 #if (defined(WIN32) || defined(__MWERKS__)) && !defined(STDC_HEADERS)
00066 #define STDC_HEADERS
00067 #endif
00068
00069 #if defined(HAVE_SYS_TIMEB_H)
00070 #include <sys/timeb.h>
00071 #else
00072 /*
00073 ** We use the obsolete `struct timeb' as part of our interface!
00074 ** Since the system doesn't have it, we define it here;
00075 ** our callers must do likewise.
00076 */
00077 struct timeb {
00078     time_t      time;       /* Seconds since the epoch  */
00079     unsigned short  millitm;    /* Field not used       */
00080     short       timezone;   /* Minutes west of GMT      */
00081     short       dstflag;    /* Field not used       */
00082 };
00083 #endif /* defined(HAVE_SYS_TIMEB_H) */
00084
00085 #endif  /* defined(vms) */
00086
00087 #if defined (STDC_HEADERS) || defined (USG)
00088 #include <string.h>
00089 #endif
00090
00091 /* Some old versions of bison generate parsers that use bcopy.
00092    That loses on systems that don't provide the function, so we have
00093    to redefine it here.  */
00094 #if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
00095 #define bcopy(from, to, len) memcpy ((to), (from), (len))
00096 #endif
00097
00098 #if defined (STDC_HEADERS)
00099 #include <stdlib.h>
00100 #endif
00101
00102 /* NOTES on rebuilding getdate.c (particularly for inclusion in CVS
00103    releases):
00104
00105    We don't want to mess with all the portability hassles of alloca.
00106    In particular, most (all?) versions of bison will use alloca in
00107    their parser.  If bison works on your system (e.g. it should work
00108    with gcc), then go ahead and use it, but the more general solution
00109    is to use byacc instead of bison, which should generate a portable
00110    parser.  I played with adding "#define alloca dont_use_alloca", to
00111    give an error if the parser generator uses alloca (and thus detect
00112    unportable getdate.c's), but that seems to cause as many problems
00113    as it solves.  */
00114
00115 #define yyparse getdate_yyparse
00116 #define yylex getdate_yylex
00117 #define yyerror getdate_yyerror
00118 #define yydebug getdate_yydebug
00119 #define yynerrs getdate_yynerrs
00120 #define yychar getdate_yychar
00121 #define yylval getdate_yylval
00122
00123 static int yyparse ();
00124 static int yylex ();
00125 static int yyerror (char    *s);
00126
00127 #ifdef __cplusplus
00128 extern "C" time_t get_date(char     *p, struct timeb    *now);
00129 #endif
00130
00131 #ifndef macintosh
00132 #define EPOCH       1970
00133 #else
00134 #define EPOCH       1904        /*  GUSI = 1904; MSL = 1900 */
00135 #endif
00136 #define HOUR(x)     ((time_t)(x) * 60)
00137 #define SECSPERDAY  (24L * 60L * 60L)
00138
00139
00140 /*
00141 **  An entry in the lexical lookup table.
00142 */
00143 typedef struct _TABLE {
00144     char    *name;
00145     int     type;
00146     time_t  value;
00147 } TABLE;
00148
00149
00150 /*
00151 **  Daylight-savings mode:  on, off, or not yet known.
00152 */
00153 typedef enum _DSTMODE {
00154     DSTon, DSToff, DSTmaybe
00155 } DSTMODE;
00156
00157 /*
00158 **  Meridian:  am, pm, or 24-hour style.
00159 */
00160 typedef enum _MERIDIAN {
00161     MERam, MERpm, MER24
00162 } MERIDIAN;
00163
00164
00165 /*
00166 **  Global variables.  We could get rid of most of these by using a good
00167 **  union as the yacc stack.  (This routine was originally written before
00168 **  yacc had the %union construct.)  Maybe someday; right now we only use
00169 **  the %union very rarely.
00170 */
00171 static char *yyInput;
00172 static DSTMODE  yyDSTmode;
00173 static time_t   yyDayOrdinal;
00174 static time_t   yyDayNumber;
00175 static int  yyHaveDate;
00176 static int  yyHaveDay;
00177 static int  yyHaveRel;
00178 static int  yyHaveTime;
00179 static int  yyHaveZone;
00180 static time_t   yyTimezone;
00181 static time_t   yyDay;
00182 static time_t   yyHour;
00183 static time_t   yyMinutes;
00184 static time_t   yyMonth;
00185 static time_t   yySeconds;
00186 static time_t   yyYear;
00187 static MERIDIAN yyMeridian;
00188 static time_t   yyRelMonth;
00189 static time_t   yyRelSeconds;
00190
00191 %}
00192
00193 %union {
00194     time_t      Number;
00195     enum _MERIDIAN  Meridian;
00196 }
00197
00198 %token  tAGO tDAY tDAYZONE tID tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT
00199 %token  tSEC_UNIT tSNUMBER tUNUMBER tZONE tDST
00200
00201 %type   <Number>    tDAY tDAYZONE tMINUTE_UNIT tMONTH tMONTH_UNIT
00202 %type   <Number>    tSEC_UNIT tSNUMBER tUNUMBER tZONE
00203 %type   <Meridian>  tMERIDIAN o_merid
00204
00205 %%
00206
00207 spec    : /* NULL */
00208     | spec item
00209     ;
00210
00211 item    : time {
00212         yyHaveTime++;
00213     }
00214     | zone {
00215         yyHaveZone++;
00216     }
00217     | date {
00218         yyHaveDate++;
00219     }
00220     | day {
00221         yyHaveDay++;
00222     }
00223     | rel {
00224         yyHaveRel++;
00225     }
00226     | number
00227     ;
00228
00229 time    : tUNUMBER tMERIDIAN {
00230         yyHour = $1;
00231         yyMinutes = 0;
00232         yySeconds = 0;
00233         yyMeridian = $2;
00234     }
00235     | tUNUMBER ':' tUNUMBER o_merid {
00236         yyHour = $1;
00237         yyMinutes = $3;
00238         yySeconds = 0;
00239         yyMeridian = $4;
00240     }
00241     | tUNUMBER ':' tUNUMBER tSNUMBER {
00242         yyHour = $1;
00243         yyMinutes = $3;
00244         yyMeridian = MER24;
00245         yyDSTmode = DSToff;
00246         yyTimezone = - ($4 % 100 + ($4 / 100) * 60);
00247     }
00248     | tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
00249         yyHour = $1;
00250         yyMinutes = $3;
00251         yySeconds = $5;
00252         yyMeridian = $6;
00253     }
00254     | tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER {
00255         yyHour = $1;
00256         yyMinutes = $3;
00257         yySeconds = $5;
00258         yyMeridian = MER24;
00259         yyDSTmode = DSToff;
00260         yyTimezone = - ($6 % 100 + ($6 / 100) * 60);
00261     }
00262     ;
00263
00264 zone    : tZONE {
00265         yyTimezone = $1;
00266         yyDSTmode = DSToff;
00267     }
00268     | tDAYZONE {
00269         yyTimezone = $1;
00270         yyDSTmode = DSTon;
00271     }
00272     |
00273       tZONE tDST {
00274         yyTimezone = $1;
00275         yyDSTmode = DSTon;
00276     }
00277     ;
00278
00279 day : tDAY {
00280         yyDayOrdinal = 1;
00281         yyDayNumber = $1;
00282     }
00283     | tDAY ',' {
00284         yyDayOrdinal = 1;
00285         yyDayNumber = $1;
00286     }
00287     | tUNUMBER tDAY {
00288         yyDayOrdinal = $1;
00289         yyDayNumber = $2;
00290     }
00291     ;
00292
00293 date    : tUNUMBER '/' tUNUMBER {
00294         yyMonth = $1;
00295         yyDay = $3;
00296     }
00297     | tUNUMBER '/' tUNUMBER '/' tUNUMBER {
00298         if ($1 >= 100) {
00299         yyYear = $1;
00300         yyMonth = $3;
00301         yyDay = $5;
00302         } else {
00303         yyMonth = $1;
00304         yyDay = $3;
00305         yyYear = $5;
00306         }
00307     }
00308     | tUNUMBER tSNUMBER tSNUMBER {
00309         /* ISO 8601 format.  yyyy-mm-dd.  */
00310         yyYear = $1;
00311         yyMonth = -$2;
00312         yyDay = -$3;
00313     }
00314     | tUNUMBER tMONTH tSNUMBER {
00315         /* e.g. 17-JUN-1992.  */
00316         yyDay = $1;
00317         yyMonth = $2;
00318         yyYear = -$3;
00319     }
00320     | tMONTH tUNUMBER {
00321         yyMonth = $1;
00322         yyDay = $2;
00323     }
00324     | tMONTH tUNUMBER ',' tUNUMBER {
00325         yyMonth = $1;
00326         yyDay = $2;
00327         yyYear = $4;
00328     }
00329     | tUNUMBER tMONTH {
00330         yyMonth = $2;
00331         yyDay = $1;
00332     }
00333     | tUNUMBER tMONTH tUNUMBER {
00334         yyMonth = $2;
00335         yyDay = $1;
00336         yyYear = $3;
00337     }
00338     ;
00339
00340 rel : relunit tAGO {
00341         yyRelSeconds = -yyRelSeconds;
00342         yyRelMonth = -yyRelMonth;
00343     }
00344     | relunit
00345     ;
00346
00347 relunit : tUNUMBER tMINUTE_UNIT {
00348         yyRelSeconds += $1 * $2 * 60L;
00349     }
00350     | tSNUMBER tMINUTE_UNIT {
00351         yyRelSeconds += $1 * $2 * 60L;
00352     }
00353     | tMINUTE_UNIT {
00354         yyRelSeconds += $1 * 60L;
00355     }
00356     | tSNUMBER tSEC_UNIT {
00357         yyRelSeconds += $1;
00358     }
00359     | tUNUMBER tSEC_UNIT {
00360         yyRelSeconds += $1;
00361     }
00362     | tSEC_UNIT {
00363         yyRelSeconds++;
00364     }
00365     | tSNUMBER tMONTH_UNIT {
00366         yyRelMonth += $1 * $2;
00367     }
00368     | tUNUMBER tMONTH_UNIT {
00369         yyRelMonth += $1 * $2;
00370     }
00371     | tMONTH_UNIT {
00372         yyRelMonth += $1;
00373     }
00374     ;
00375
00376 number  : tUNUMBER {
00377         if (yyHaveTime && yyHaveDate && !yyHaveRel)
00378         yyYear = $1;
00379         else {
00380         if($1>10000) {
00381             yyHaveDate++;
00382             yyDay= ($1)%100;
00383             yyMonth= ($1/100)%100;
00384             yyYear = $1/10000;
00385         }
00386         else {
00387             yyHaveTime++;
00388             if ($1 < 100) {
00389             yyHour = $1;
00390             yyMinutes = 0;
00391             }
00392             else {
00393                 yyHour = $1 / 100;
00394                 yyMinutes = $1 % 100;
00395             }
00396             yySeconds = 0;
00397             yyMeridian = MER24;
00398             }
00399         }
00400     }
00401     ;
00402
00403 o_merid : /* NULL */ {
00404         $$ = MER24;
00405     }
00406     | tMERIDIAN {
00407         $$ = $1;
00408     }
00409     ;
00410
00411 %%
00412
00413 /* Month and day table. */
00414 static TABLE const MonthDayTable[] = {
00415     { "january",    tMONTH,  1 },
00416     { "february",   tMONTH,  2 },
00417     { "march",      tMONTH,  3 },
00418     { "april",      tMONTH,  4 },
00419     { "may",        tMONTH,  5 },
00420     { "june",       tMONTH,  6 },
00421     { "july",       tMONTH,  7 },
00422     { "august",     tMONTH,  8 },
00423     { "september",  tMONTH,  9 },
00424     { "sept",       tMONTH,  9 },
00425     { "october",    tMONTH, 10 },
00426     { "november",   tMONTH, 11 },
00427     { "december",   tMONTH, 12 },
00428     { "sunday",     tDAY, 0 },
00429     { "monday",     tDAY, 1 },
00430     { "tuesday",    tDAY, 2 },
00431     { "tues",       tDAY, 2 },
00432     { "wednesday",  tDAY, 3 },
00433     { "wednes",     tDAY, 3 },
00434     { "thursday",   tDAY, 4 },
00435     { "thur",       tDAY, 4 },
00436     { "thurs",      tDAY, 4 },
00437     { "friday",     tDAY, 5 },
00438     { "saturday",   tDAY, 6 },
00439     { NULL }
00440 };
00441
00442 /* Time units table. */
00443 static TABLE const UnitsTable[] = {
00444     { "year",       tMONTH_UNIT,    12 },
00445     { "month",      tMONTH_UNIT,    1 },
00446     { "fortnight",  tMINUTE_UNIT,   14 * 24 * 60 },
00447     { "week",       tMINUTE_UNIT,   7 * 24 * 60 },
00448     { "day",        tMINUTE_UNIT,   1 * 24 * 60 },
00449     { "hour",       tMINUTE_UNIT,   60 },
00450     { "minute",     tMINUTE_UNIT,   1 },
00451     { "min",        tMINUTE_UNIT,   1 },
00452     { "second",     tSEC_UNIT,  1 },
00453     { "sec",        tSEC_UNIT,  1 },
00454     { NULL }
00455 };
00456
00457 /* Assorted relative-time words. */
00458 static TABLE const OtherTable[] = {
00459     { "tomorrow",   tMINUTE_UNIT,   1 * 24 * 60 },
00460     { "yesterday",  tMINUTE_UNIT,   -1 * 24 * 60 },
00461     { "today",      tMINUTE_UNIT,   0 },
00462     { "now",        tMINUTE_UNIT,   0 },
00463     { "last",       tUNUMBER,   -1 },
00464     { "this",       tMINUTE_UNIT,   0 },
00465     { "next",       tUNUMBER,   2 },
00466     { "first",      tUNUMBER,   1 },
00467 /*  { "second",     tUNUMBER,   2 }, */
00468     { "third",      tUNUMBER,   3 },
00469     { "fourth",     tUNUMBER,   4 },
00470     { "fifth",      tUNUMBER,   5 },
00471     { "sixth",      tUNUMBER,   6 },
00472     { "seventh",    tUNUMBER,   7 },
00473     { "eighth",     tUNUMBER,   8 },
00474     { "ninth",      tUNUMBER,   9 },
00475     { "tenth",      tUNUMBER,   10 },
00476     { "eleventh",   tUNUMBER,   11 },
00477     { "twelfth",    tUNUMBER,   12 },
00478     { "ago",        tAGO,   1 },
00479     { NULL }
00480 };
00481
00482 /* The timezone table. */
00483 /* Some of these are commented out because a time_t can't store a float. */
00484 static TABLE const TimezoneTable[] = {
00485     { "gmt",    tZONE,     HOUR( 0) },  /* Greenwich Mean */
00486     { "ut", tZONE,     HOUR( 0) },  /* Universal (Coordinated) */
00487     { "utc",    tZONE,     HOUR( 0) },
00488     { "wet",    tZONE,     HOUR( 0) },  /* Western European */
00489     { "bst",    tDAYZONE,  HOUR( 0) },  /* British Summer */
00490     { "wat",    tZONE,     HOUR( 1) },  /* West Africa */
00491     { "at", tZONE,     HOUR( 2) },  /* Azores */
00492 #if 0
00493     /* For completeness.  BST is also British Summer, and GST is
00494      * also Guam Standard. */
00495     { "bst",    tZONE,     HOUR( 3) },  /* Brazil Standard */
00496     { "gst",    tZONE,     HOUR( 3) },  /* Greenland Standard */
00497 #endif
00498 #if 0
00499     { "nft",    tZONE,     HOUR(3.5) }, /* Newfoundland */
00500     { "nst",    tZONE,     HOUR(3.5) }, /* Newfoundland Standard */
00501     { "ndt",    tDAYZONE,  HOUR(3.5) }, /* Newfoundland Daylight */
00502 #endif
00503     { "ast",    tZONE,     HOUR( 4) },  /* Atlantic Standard */
00504     { "adt",    tDAYZONE,  HOUR( 4) },  /* Atlantic Daylight */
00505     { "est",    tZONE,     HOUR( 5) },  /* Eastern Standard */
00506     { "edt",    tDAYZONE,  HOUR( 5) },  /* Eastern Daylight */
00507     { "cst",    tZONE,     HOUR( 6) },  /* Central Standard */
00508     { "cdt",    tDAYZONE,  HOUR( 6) },  /* Central Daylight */
00509     { "mst",    tZONE,     HOUR( 7) },  /* Mountain Standard */
00510     { "mdt",    tDAYZONE,  HOUR( 7) },  /* Mountain Daylight */
00511     { "pst",    tZONE,     HOUR( 8) },  /* Pacific Standard */
00512     { "pdt",    tDAYZONE,  HOUR( 8) },  /* Pacific Daylight */
00513     { "yst",    tZONE,     HOUR( 9) },  /* Yukon Standard */
00514     { "ydt",    tDAYZONE,  HOUR( 9) },  /* Yukon Daylight */
00515     { "hst",    tZONE,     HOUR(10) },  /* Hawaii Standard */
00516     { "hdt",    tDAYZONE,  HOUR(10) },  /* Hawaii Daylight */
00517     { "cat",    tZONE,     HOUR(10) },  /* Central Alaska */
00518     { "ahst",   tZONE,     HOUR(10) },  /* Alaska-Hawaii Standard */
00519     { "nt", tZONE,     HOUR(11) },  /* Nome */
00520     { "idlw",   tZONE,     HOUR(12) },  /* International Date Line West */
00521     { "cet",    tZONE,     -HOUR(1) },  /* Central European */
00522     { "met",    tZONE,     -HOUR(1) },  /* Middle European */
00523     { "mewt",   tZONE,     -HOUR(1) },  /* Middle European Winter */
00524     { "mest",   tDAYZONE,  -HOUR(1) },  /* Middle European Summer */
00525     { "swt",    tZONE,     -HOUR(1) },  /* Swedish Winter */
00526     { "sst",    tDAYZONE,  -HOUR(1) },  /* Swedish Summer */
00527     { "fwt",    tZONE,     -HOUR(1) },  /* French Winter */
00528     { "fst",    tDAYZONE,  -HOUR(1) },  /* French Summer */
00529     { "eet",    tZONE,     -HOUR(2) },  /* Eastern Europe, USSR Zone 1 */
00530     { "bt", tZONE,     -HOUR(3) },  /* Baghdad, USSR Zone 2 */
00531 #if 0
00532     { "it", tZONE,     -HOUR(3.5) },/* Iran */
00533 #endif
00534     { "zp4",    tZONE,     -HOUR(4) },  /* USSR Zone 3 */
00535     { "zp5",    tZONE,     -HOUR(5) },  /* USSR Zone 4 */
00536 #if 0
00537     { "ist",    tZONE,     -HOUR(5.5) },/* Indian Standard */
00538 #endif
00539     { "zp6",    tZONE,     -HOUR(6) },  /* USSR Zone 5 */
00540 #if 0
00541     /* For completeness.  NST is also Newfoundland Stanard, and SST is
00542      * also Swedish Summer. */
00543     { "nst",    tZONE,     -HOUR(6.5) },/* North Sumatra */
00544     { "sst",    tZONE,     -HOUR(7) },  /* South Sumatra, USSR Zone 6 */
00545 #endif  /* 0 */
00546     { "wast",   tZONE,     -HOUR(7) },  /* West Australian Standard */
00547     { "wadt",   tDAYZONE,  -HOUR(7) },  /* West Australian Daylight */
00548 #if 0
00549     { "jt", tZONE,     -HOUR(7.5) },/* Java (3pm in Cronusland!) */
00550 #endif
00551     { "cct",    tZONE,     -HOUR(8) },  /* China Coast, USSR Zone 7 */
00552     { "jst",    tZONE,     -HOUR(9) },  /* Japan Standard, USSR Zone 8 */
00553 #if 0
00554     { "cast",   tZONE,     -HOUR(9.5) },/* Central Australian Standard */
00555     { "cadt",   tDAYZONE,  -HOUR(9.5) },/* Central Australian Daylight */
00556 #endif
00557     { "east",   tZONE,     -HOUR(10) }, /* Eastern Australian Standard */
00558     { "eadt",   tDAYZONE,  -HOUR(10) }, /* Eastern Australian Daylight */
00559     { "gst",    tZONE,     -HOUR(10) }, /* Guam Standard, USSR Zone 9 */
00560     { "nzt",    tZONE,     -HOUR(12) }, /* New Zealand */
00561     { "nzst",   tZONE,     -HOUR(12) }, /* New Zealand Standard */
00562     { "nzdt",   tDAYZONE,  -HOUR(12) }, /* New Zealand Daylight */
00563     { "idle",   tZONE,     -HOUR(12) }, /* International Date Line East */
00564     {  NULL  }
00565 };
00566
00567 /* Military timezone table. */
00568 static TABLE const MilitaryTable[] = {
00569     { "a",  tZONE,  HOUR(  1) },
00570     { "b",  tZONE,  HOUR(  2) },
00571     { "c",  tZONE,  HOUR(  3) },
00572     { "d",  tZONE,  HOUR(  4) },
00573     { "e",  tZONE,  HOUR(  5) },
00574     { "f",  tZONE,  HOUR(  6) },
00575     { "g",  tZONE,  HOUR(  7) },
00576     { "h",  tZONE,  HOUR(  8) },
00577     { "i",  tZONE,  HOUR(  9) },
00578     { "k",  tZONE,  HOUR( 10) },
00579     { "l",  tZONE,  HOUR( 11) },
00580     { "m",  tZONE,  HOUR( 12) },
00581     { "n",  tZONE,  HOUR(- 1) },
00582     { "o",  tZONE,  HOUR(- 2) },
00583     { "p",  tZONE,  HOUR(- 3) },
00584     { "q",  tZONE,  HOUR(- 4) },
00585     { "r",  tZONE,  HOUR(- 5) },
00586     { "s",  tZONE,  HOUR(- 6) },
00587     { "t",  tZONE,  HOUR(- 7) },
00588     { "u",  tZONE,  HOUR(- 8) },
00589     { "v",  tZONE,  HOUR(- 9) },
00590     { "w",  tZONE,  HOUR(-10) },
00591     { "x",  tZONE,  HOUR(-11) },
00592     { "y",  tZONE,  HOUR(-12) },
00593     { "z",  tZONE,  HOUR(  0) },
00594     { NULL }
00595 };
00596
00597
00598
00599
00600 /* ARGSUSED */
00601 static int
00602 yyerror(char    *s)
00603 {
00604   return 0;
00605 }
00606
00607
00608 static time_t
00609 ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian)
00610 {
00611     if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59)
00612     return -1;
00613     switch (Meridian) {
00614     case MER24:
00615     if (Hours < 0 || Hours > 23)
00616         return -1;
00617     return (Hours * 60L + Minutes) * 60L + Seconds;
00618     case MERam:
00619     if (Hours < 1 || Hours > 12)
00620         return -1;
00621     if (Hours == 12)
00622         Hours = 0;
00623     return (Hours * 60L + Minutes) * 60L + Seconds;
00624     case MERpm:
00625     if (Hours < 1 || Hours > 12)
00626         return -1;
00627     if (Hours == 12)
00628         Hours = 0;
00629     return ((Hours + 12) * 60L + Minutes) * 60L + Seconds;
00630     default:
00631     abort ();
00632     }
00633     /* NOTREACHED */
00634 }
00635
00636
00637 /* Year is either
00638    * A negative number, which means to use its absolute value (why?)
00639    * A number from 0 to 99, which means a year from 1900 to 1999, or
00640    * The actual year (>=100).  */
00641 static time_t
00642 Convert(time_t Month, time_t Day, time_t Year, time_t Hours, time_t Minutes, time_t Seconds,
00643     MERIDIAN Meridian, DSTMODE DSTmode)
00644 {
00645     static int DaysInMonth[12] = {
00646     31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
00647     };
00648     time_t  tod;
00649     time_t  Julian;
00650     int     i;
00651
00652     if (Year < 0)
00653     Year = -Year;
00654     if (Year < 69)
00655     Year += 2000;
00656     else if (Year < 100)
00657     Year += 1900;
00658     DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
00659             ? 29 : 28;
00660     /* Checking for 2038 bogusly assumes that time_t is 32 bits.  But
00661        I'm too lazy to try to check for time_t overflow in another way.  */
00662     if (Year < EPOCH || Year > 2038
00663      || Month < 1 || Month > 12
00664      /* Lint fluff:  "conversion from long may lose accuracy" */
00665      || Day < 1 || Day > DaysInMonth[(int)--Month])
00666     return -1;
00667
00668     for (Julian = Day - 1, i = 0; i < Month; i++)
00669     Julian += DaysInMonth[i];
00670     for (i = EPOCH; i < Year; i++)
00671     Julian += 365 + (i % 4 == 0);
00672     Julian *= SECSPERDAY;
00673     Julian += yyTimezone * 60L;
00674     if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
00675     return -1;
00676     Julian += tod;
00677     if (DSTmode == DSTon
00678      || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
00679     Julian -= 60 * 60;
00680     return Julian;
00681 }
00682
00683
00684 static time_t
00685 DSTcorrect(time_t Start, time_t Future)
00686 {
00687     time_t  StartDay;
00688     time_t  FutureDay;
00689
00690     StartDay = (localtime(&Start)->tm_hour + 1) % 24;
00691     FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
00692     return (Future - Start) + (StartDay - FutureDay) * 60L * 60L;
00693 }
00694
00695
00696 static time_t
00697 RelativeDate(time_t Start, time_t DayOrdinal, time_t DayNumber)
00698 {
00699     struct tm   *tm;
00700     time_t  now;
00701
00702     now = Start;
00703     tm = localtime(&now);
00704     now += SECSPERDAY * ((DayNumber - tm->tm_wday + 7) % 7);
00705     now += 7 * SECSPERDAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
00706     return DSTcorrect(Start, now);
00707 }
00708
00709
00710 static time_t
00711 RelativeMonth(time_t Start, time_t RelMonth)
00712 {
00713     struct tm   *tm;
00714     time_t  Month;
00715     time_t  Year;
00716
00717     if (RelMonth == 0)
00718     return 0;
00719     tm = localtime(&Start);
00720     Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth;
00721     Year = Month / 12;
00722     Month = Month % 12 + 1;
00723     return DSTcorrect(Start,
00724         Convert(Month, (time_t)tm->tm_mday, Year,
00725         (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
00726         MER24, DSTmaybe));
00727 }
00728
00729
00730 static int
00731 LookupWord(char     *buff)
00732 {
00733     register char   *p;
00734     register char   *q;
00735     register const TABLE    *tp;
00736     int         i;
00737     int         abbrev;
00738
00739     /* Make it lowercase. */
00740     for (p = buff; *p; p++)
00741     if (isupper(*p))
00742         *p = tolower(*p);
00743
00744     if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
00745     yylval.Meridian = MERam;
00746     return tMERIDIAN;
00747     }
00748     if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
00749     yylval.Meridian = MERpm;
00750     return tMERIDIAN;
00751     }
00752
00753     /* See if we have an abbreviation for a month. */
00754     if (strlen(buff) == 3)
00755     abbrev = 1;
00756     else if (strlen(buff) == 4 && buff[3] == '.') {
00757     abbrev = 1;
00758     buff[3] = '\0';
00759     }
00760     else
00761     abbrev = 0;
00762
00763     for (tp = MonthDayTable; tp->name; tp++) {
00764     if (abbrev) {
00765         if (strncmp(buff, tp->name, 3) == 0) {
00766         yylval.Number = tp->value;
00767         return tp->type;
00768         }
00769     }
00770     else if (strcmp(buff, tp->name) == 0) {
00771         yylval.Number = tp->value;
00772         return tp->type;
00773     }
00774     }
00775
00776     for (tp = TimezoneTable; tp->name; tp++)
00777     if (strcmp(buff, tp->name) == 0) {
00778         yylval.Number = tp->value;
00779         return tp->type;
00780     }
00781
00782     if (strcmp(buff, "dst") == 0)
00783     return tDST;
00784
00785     for (tp = UnitsTable; tp->name; tp++)
00786     if (strcmp(buff, tp->name) == 0) {
00787         yylval.Number = tp->value;
00788         return tp->type;
00789     }
00790
00791     /* Strip off any plural and try the units table again. */
00792     i = strlen(buff) - 1;
00793     if (buff[i] == 's') {
00794     buff[i] = '\0';
00795     for (tp = UnitsTable; tp->name; tp++)
00796         if (strcmp(buff, tp->name) == 0) {
00797         yylval.Number = tp->value;
00798         return tp->type;
00799         }
00800     buff[i] = 's';      /* Put back for "this" in OtherTable. */
00801     }
00802
00803     for (tp = OtherTable; tp->name; tp++)
00804     if (strcmp(buff, tp->name) == 0) {
00805         yylval.Number = tp->value;
00806         return tp->type;
00807     }
00808
00809     /* Military timezones. */
00810     if (buff[1] == '\0' && isalpha(*buff)) {
00811     for (tp = MilitaryTable; tp->name; tp++)
00812         if (strcmp(buff, tp->name) == 0) {
00813         yylval.Number = tp->value;
00814         return tp->type;
00815         }
00816     }
00817
00818     /* Drop out any periods and try the timezone table again. */
00819     for (i = 0, p = q = buff; *q; q++)
00820     if (*q != '.')
00821         *p++ = *q;
00822     else
00823         i++;
00824     *p = '\0';
00825     if (i)
00826     for (tp = TimezoneTable; tp->name; tp++)
00827         if (strcmp(buff, tp->name) == 0) {
00828         yylval.Number = tp->value;
00829         return tp->type;
00830         }
00831
00832     return tID;
00833 }
00834
00835
00836 static int
00837 yylex()
00838 {
00839     register char   c;
00840     register char   *p;
00841     char        buff[20];
00842     int         Count;
00843     int         sign;
00844
00845     for ( ; ; ) {
00846     while (isspace(*yyInput))
00847         yyInput++;
00848
00849     if (isdigit(c = *yyInput) || c == '-' || c == '+') {
00850         if (c == '-' || c == '+') {
00851         sign = c == '-' ? -1 : 1;
00852         if (!isdigit(*++yyInput))
00853             /* skip the '-' sign */
00854             continue;
00855         }
00856         else
00857         sign = 0;
00858         for (yylval.Number = 0; isdigit(c = *yyInput++); )
00859         yylval.Number = 10 * yylval.Number + c - '0';
00860         yyInput--;
00861         if (sign < 0)
00862         yylval.Number = -yylval.Number;
00863         return sign ? tSNUMBER : tUNUMBER;
00864     }
00865     if (isalpha(c)) {
00866         for (p = buff; isalpha(c = *yyInput++) || c == '.'; )
00867         if (p < &buff[sizeof buff - 1])
00868             *p++ = c;
00869         *p = '\0';
00870         yyInput--;
00871         return LookupWord(buff);
00872     }
00873     if (c != '(')
00874         return *yyInput++;
00875     Count = 0;
00876     do {
00877         c = *yyInput++;
00878         if (c == '\0')
00879         return c;
00880         if (c == '(')
00881         Count++;
00882         else if (c == ')')
00883         Count--;
00884     } while (Count > 0);
00885     }
00886 }
00887
00888 #define TM_YEAR_ORIGIN 1900
00889
00890 /* Yield A - B, measured in seconds.  */
00891 static long
00892 difftm (struct tm *a, struct tm *b)
00893 {
00894   int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
00895   int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
00896   int days = (
00897           /* difference in day of year */
00898           a->tm_yday - b->tm_yday
00899           /* + intervening leap days */
00900           +  ((ay >> 2) - (by >> 2))
00901           -  (ay/100 - by/100)
00902           +  ((ay/100 >> 2) - (by/100 >> 2))
00903           /* + difference in years * 365 */
00904           +  (long)(ay-by) * 365
00905           );
00906   return (60*(60*(24*days + (a->tm_hour - b->tm_hour))
00907           + (a->tm_min - b->tm_min))
00908       + (a->tm_sec - b->tm_sec));
00909 }
00910
00911 time_t
00912 get_date(char       *p, struct timeb    *now)
00913 {
00914     struct tm       *tm, gmt;
00915     struct timeb    ftz;
00916     time_t      Start;
00917     time_t      tod;
00918     time_t nowtime;
00919
00920     yyInput = p;
00921     if (now == NULL) {
00922     struct tm *gmt_ptr;
00923
00924         now = &ftz;
00925     (void)time (&nowtime);
00926
00927     gmt_ptr = gmtime (&nowtime);
00928     if (gmt_ptr != NULL)
00929     {
00930         /* Make a copy, in case localtime modifies *tm (I think
00931            that comment now applies to *gmt_ptr, but I am too
00932            lazy to dig into how gmtime and locatime allocate the
00933            structures they return pointers to).  */
00934         gmt = *gmt_ptr;
00935     }
00936
00937     if (! (tm = localtime (&nowtime)))
00938         return -1;
00939
00940     if (gmt_ptr != NULL)
00941         ftz.timezone = difftm (&gmt, tm) / 60;
00942     else
00943         /* We are on a system like VMS, where the system clock is
00944            in local time and the system has no concept of timezones.
00945            Hopefully we can fake this out (for the case in which the
00946            user specifies no timezone) by just saying the timezone
00947            is zero.  */
00948         ftz.timezone = 0;
00949
00950     if(tm->tm_isdst)
00951         ftz.timezone += 60;
00952     }
00953     else
00954     {
00955     nowtime = now->time;
00956     }
00957
00958     tm = localtime(&nowtime);
00959     yyYear = tm->tm_year + 1900;
00960     yyMonth = tm->tm_mon + 1;
00961     yyDay = tm->tm_mday;
00962     yyTimezone = now->timezone;
00963     yyDSTmode = DSTmaybe;
00964     yyHour = 0;
00965     yyMinutes = 0;
00966     yySeconds = 0;
00967     yyMeridian = MER24;
00968     yyRelSeconds = 0;
00969     yyRelMonth = 0;
00970     yyHaveDate = 0;
00971     yyHaveDay = 0;
00972     yyHaveRel = 0;
00973     yyHaveTime = 0;
00974     yyHaveZone = 0;
00975
00976     if (yyparse()
00977      || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
00978     return -1;
00979
00980     if (yyHaveDate || yyHaveTime || yyHaveDay) {
00981     Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
00982             yyMeridian, yyDSTmode);
00983     if (Start == -1) // bug on mac, was < 0
00984         return -1;
00985     }
00986     else {
00987     Start = nowtime;
00988     if (!yyHaveRel)
00989         Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) + tm->tm_sec;
00990     }
00991
00992     Start += yyRelSeconds;
00993     Start += RelativeMonth(Start, yyRelMonth);
00994
00995     if (yyHaveDay && !yyHaveDate) {
00996     tod = RelativeDate(Start, yyDayOrdinal, yyDayNumber);
00997     Start += tod;
00998     }
00999
01000     /* Have to do *something* with a legitimate -1 so it's distinguishable
01001      * from the error return value.  (Alternately could set errno on error.) */
01002     return Start == -1 ? 0 : Start;
01003 }
01004
01005
01006 #if defined(TEST)
01007
01008 /* ARGSUSED */
01009 int
01010 main(ac, av)
01011     int     ac;
01012     char    *av[];
01013 {
01014     char    buff[128];
01015     time_t  d;
01016
01017     (void)printf("Enter date, or blank line to exit.\n\t> ");
01018     (void)fflush(stdout);
01019     while (gets(buff) && buff[0]) {
01020     d = get_date(buff, (struct timeb *)NULL);
01021     if (d == -1)
01022         (void)printf("Bad format - couldn't convert.\n");
01023     else
01024         (void)printf("%s", ctime(&d));
01025     (void)printf("\t> ");
01026     (void)fflush(stdout);
01027     }
01028     exit(0);
01029     /* NOTREACHED */
01030 }
01031 #endif  /* defined(TEST) */
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getdate.y File Reference

cvs-1.10/lib/getdate.y File Reference

#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <time.h>

Include dependency graph for getdate.y:

Include dependency graph

Go to the source code of this file.

Defines

#define | yyparse getdate_yyparse
#define | yylex getdate_yylex
#define | yyerror getdate_yyerror
#define | yydebug getdate_yydebug
#define | yynerrs getdate_yynerrs
#define | yychar getdate_yychar
#define | yylval getdate_yylval
#define | EPOCH 1970
#define | HOUR(x) ((time_t)(x) * 60)
#define | SECSPERDAY (24L * 60L * 60L)
#define | TM_YEAR_ORIGIN 1900

Functions

int | getdate_yyerror (char *s)
time_t | ToSeconds (time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian)
time_t | Convert (time_t Month, time_t Day, time_t Year, time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian, DSTMODE DSTmode)
time_t | DSTcorrect (time_t Start, time_t Future)
time_t | RelativeDate (time_t Start, time_t DayOrdinal, time_t DayNumber)
time_t | RelativeMonth (time_t Start, time_t RelMonth)
int | LookupWord (char *buff)
int | getdate_yylex ()
long | difftm (struct tm *a, struct tm *b)
time_t | get_date (char *p, struct timeb *now)

Variables

item | __pad0__
time | __pad1__
yyMinutes = 0
yySeconds = 0
yyMeridian = $2
tUNUMBER | __pad2__
tUNUMBER | __pad3__
yyDSTmode = DSToff
yyTimezone = - ($4 % 100 + ($4 / 100) * 60)
tUNUMBER | __pad4__
tUNUMBER | __pad5__
zone | __pad6__
day | __pad7__
yyDayNumber = $1
tDAY
date __pad8__
yyDay = $3
rel | __pad9__
yyRelMonth = -yyRelMonth
relunit
relunit __pad10__
number | __pad11__
o_merid | __pad12__
TABLE const | MonthDayTable []
TABLE const | UnitsTable []
TABLE const | OtherTable []
TABLE const | TimezoneTable []
TABLE const | MilitaryTable []

Define Documentation

#define EPOCH 1970

#define HOUR ( x ) ((time_t)(x) * 60)

#define SECSPERDAY (24L * 60L * 60L)

#define TM_YEAR_ORIGIN 1900

Definition at line 888 of file getdate.y.

#define yychar getdate_yychar

#define yydebug getdate_yydebug

#define yyerror getdate_yyerror

#define yylex getdate_yylex

#define yylval getdate_yylval

#define yynerrs getdate_yynerrs

#define yyparse getdate_yyparse

Function Documentation

time_t Convert | ( | time_t | Month,
 |  | time_t | Day,
 |  | time_t | Year,
 |  | time_t | Hours,
 |  | time_t | Minutes,
 |  | time_t | Seconds,
 |  | MERIDIAN | Meridian,
 |  | DSTMODE | DSTmode
 | ) | [static]

Definition at line 642 of file getdate.y.

Referenced by RelativeMonth(), get_date(), and now().

00644 {
00645     static int DaysInMonth[12] = {
00646     31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
00647     };
00648     time_t  tod;
00649     time_t  Julian;
00650     int     i;
00651
00652     if (Year < 0)
00653     Year = -Year;
00654     if (Year < 69)
00655     Year += 2000;
00656     else if (Year < 100)
00657     Year += 1900;
00658     DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
00659             ? 29 : 28;
00660     /* Checking for 2038 bogusly assumes that time_t is 32 bits.  But
00661        I'm too lazy to try to check for time_t overflow in another way.  */
00662     if (Year < EPOCH || Year > 2038
00663      || Month < 1 || Month > 12
00664      /* Lint fluff:  "conversion from long may lose accuracy" */
00665      || Day < 1 || Day > DaysInMonth[(int)--Month])
00666     return -1;
00667
00668     for (Julian = Day - 1, i = 0; i < Month; i++)
00669     Julian += DaysInMonth[i];
00670     for (i = EPOCH; i < Year; i++)
00671     Julian += 365 + (i % 4 == 0);
00672     Julian *= SECSPERDAY;
00673     Julian += yyTimezone * 60L;
00674     if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
00675     return -1;
00676     Julian += tod;
00677     if (DSTmode == DSTon
00678      || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
00679     Julian -= 60 * 60;
00680     return Julian;
00681 }

time_t DSTcorrect | ( | time_t | Start,
 |  | time_t | Future
 | ) | [static]

Definition at line 685 of file getdate.y.

Referenced by RelativeDate(), and RelativeMonth().

00686 {
00687     time_t  StartDay;
00688     time_t  FutureDay;
00689
00690     StartDay = (localtime(&Start)->tm_hour + 1) % 24;
00691     FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
00692     return (Future - Start) + (StartDay - FutureDay) * 60L * 60L;
00693 }

int LookupWord ( char * buff ) [static]

Definition at line 731 of file getdate.y.

Referenced by getdate_yylex().

00732 {
00733     register char   *p;
00734     register char   *q;
00735     register const TABLE    *tp;
00736     int         i;
00737     int         abbrev;
00738
00739     /* Make it lowercase. */
00740     for (p = buff; *p; p++)
00741     if (isupper(*p))
00742         *p = tolower(*p);
00743
00744     if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
00745     yylval.Meridian = MERam;
00746     return tMERIDIAN;
00747     }
00748     if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
00749     yylval.Meridian = MERpm;
00750     return tMERIDIAN;
00751     }
00752
00753     /* See if we have an abbreviation for a month. */
00754     if (strlen(buff) == 3)
00755     abbrev = 1;
00756     else if (strlen(buff) == 4 && buff[3] == '.') {
00757     abbrev = 1;
00758     buff[3] = '\0';
00759     }
00760     else
00761     abbrev = 0;
00762
00763     for (tp = MonthDayTable; tp->name; tp++) {
00764     if (abbrev) {
00765         if (strncmp(buff, tp->name, 3) == 0) {
00766         yylval.Number = tp->value;
00767         return tp->type;
00768         }
00769     }
00770     else if (strcmp(buff, tp->name) == 0) {
00771         yylval.Number = tp->value;
00772         return tp->type;
00773     }
00774     }
00775
00776     for (tp = TimezoneTable; tp->name; tp++)
00777     if (strcmp(buff, tp->name) == 0) {
00778         yylval.Number = tp->value;
00779         return tp->type;
00780     }
00781
00782     if (strcmp(buff, "dst") == 0)
00783     return tDST;
00784
00785     for (tp = UnitsTable; tp->name; tp++)
00786     if (strcmp(buff, tp->name) == 0) {
00787         yylval.Number = tp->value;
00788         return tp->type;
00789     }
00790
00791     /* Strip off any plural and try the units table again. */
00792     i = strlen(buff) - 1;
00793     if (buff[i] == 's') {
00794     buff[i] = '\0';
00795     for (tp = UnitsTable; tp->name; tp++)
00796         if (strcmp(buff, tp->name) == 0) {
00797         yylval.Number = tp->value;
00798         return tp->type;
00799         }
00800     buff[i] = 's';      /* Put back for "this" in OtherTable. */
00801     }
00802
00803     for (tp = OtherTable; tp->name; tp++)
00804     if (strcmp(buff, tp->name) == 0) {
00805         yylval.Number = tp->value;
00806         return tp->type;
00807     }
00808
00809     /* Military timezones. */
00810     if (buff[1] == '\0' && isalpha(*buff)) {
00811     for (tp = MilitaryTable; tp->name; tp++)
00812         if (strcmp(buff, tp->name) == 0) {
00813         yylval.Number = tp->value;
00814         return tp->type;
00815         }
00816     }
00817
00818     /* Drop out any periods and try the timezone table again. */
00819     for (i = 0, p = q = buff; *q; q++)
00820     if (*q != '.')
00821         *p++ = *q;
00822     else
00823         i++;
00824     *p = '\0';
00825     if (i)
00826     for (tp = TimezoneTable; tp->name; tp++)
00827         if (strcmp(buff, tp->name) == 0) {
00828         yylval.Number = tp->value;
00829         return tp->type;
00830         }
00831
00832     return tID;
00833 }

time_t RelativeDate | ( | time_t | Start,
 |  | time_t | DayOrdinal,
 |  | time_t | DayNumber
 | ) | [static]

Definition at line 697 of file getdate.y.

Referenced by get_date(), and now().

00698 {
00699     struct tm   *tm;
00700     time_t  now;
00701
00702     now = Start;
00703     tm = localtime(&now);
00704     now += SECSPERDAY * ((DayNumber - tm->tm_wday + 7) % 7);
00705     now += 7 * SECSPERDAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
00706     return DSTcorrect(Start, now);
00707 }

time_t RelativeMonth | ( | time_t | Start,
 |  | time_t | RelMonth
 | ) | [static]

Definition at line 711 of file getdate.y.

Referenced by get_date(), and now().

00712 {
00713     struct tm   *tm;
00714     time_t  Month;
00715     time_t  Year;
00716
00717     if (RelMonth == 0)
00718     return 0;
00719     tm = localtime(&Start);
00720     Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth;
00721     Year = Month / 12;
00722     Month = Month % 12 + 1;
00723     return DSTcorrect(Start,
00724         Convert(Month, (time_t)tm->tm_mday, Year,
00725         (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
00726         MER24, DSTmaybe));
00727 }

time_t ToSeconds | ( | time_t | Hours,
 |  | time_t | Minutes,
 |  | time_t | Seconds,
 |  | MERIDIAN | Meridian
 | ) | [static]

Definition at line 609 of file getdate.y.

Referenced by Convert().

00610 {
00611     if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59)
00612     return -1;
00613     switch (Meridian) {
00614     case MER24:
00615     if (Hours < 0 || Hours > 23)
00616         return -1;
00617     return (Hours * 60L + Minutes) * 60L + Seconds;
00618     case MERam:
00619     if (Hours < 1 || Hours > 12)
00620         return -1;
00621     if (Hours == 12)
00622         Hours = 0;
00623     return (Hours * 60L + Minutes) * 60L + Seconds;
00624     case MERpm:
00625     if (Hours < 1 || Hours > 12)
00626         return -1;
00627     if (Hours == 12)
00628         Hours = 0;
00629     return ((Hours + 12) * 60L + Minutes) * 60L + Seconds;
00630     default:
00631     abort ();
00632     }
00633     /* NOTREACHED */
00634 }

long difftm | ( | struct tm * | a,
 |  | struct tm * | b
 | ) | [static]

Definition at line 892 of file getdate.y.

Referenced by get_date(), and now().

00893 {
00894   int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
00895   int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
00896   int days = (
00897           /* difference in day of year */
00898           a->tm_yday - b->tm_yday
00899           /* + intervening leap days */
00900           +  ((ay >> 2) - (by >> 2))
00901           -  (ay/100 - by/100)
00902           +  ((ay/100 >> 2) - (by/100 >> 2))
00903           /* + difference in years * 365 */
00904           +  (long)(ay-by) * 365
00905           );
00906   return (60*(60*(24*days + (a->tm_hour - b->tm_hour))
00907           + (a->tm_min - b->tm_min))
00908       + (a->tm_sec - b->tm_sec));
00909 }

time_t get_date | ( | char * | p,
 |  | struct timeb * | now
 | ) |

Definition at line 912 of file getdate.y.

00913 {
00914     struct tm       *tm, gmt;
00915     struct timeb    ftz;
00916     time_t      Start;
00917     time_t      tod;
00918     time_t nowtime;
00919
00920     yyInput = p;
00921     if (now == NULL) {
00922     struct tm *gmt_ptr;
00923
00924         now = &ftz;
00925     (void)time (&nowtime);
00926
00927     gmt_ptr = gmtime (&nowtime);
00928     if (gmt_ptr != NULL)
00929     {
00930         /* Make a copy, in case localtime modifies *tm (I think
00931            that comment now applies to *gmt_ptr, but I am too
00932            lazy to dig into how gmtime and locatime allocate the
00933            structures they return pointers to).  */
00934         gmt = *gmt_ptr;
00935     }
00936
00937     if (! (tm = localtime (&nowtime)))
00938         return -1;
00939
00940     if (gmt_ptr != NULL)
00941         ftz.timezone = difftm (&gmt, tm) / 60;
00942     else
00943         /* We are on a system like VMS, where the system clock is
00944            in local time and the system has no concept of timezones.
00945            Hopefully we can fake this out (for the case in which the
00946            user specifies no timezone) by just saying the timezone
00947            is zero.  */
00948         ftz.timezone = 0;
00949
00950     if(tm->tm_isdst)
00951         ftz.timezone += 60;
00952     }
00953     else
00954     {
00955     nowtime = now->time;
00956     }
00957
00958     tm = localtime(&nowtime);
00959     yyYear = tm->tm_year + 1900;
00960     yyMonth = tm->tm_mon + 1;
00961     yyDay = tm->tm_mday;
00962     yyTimezone = now->timezone;
00963     yyDSTmode = DSTmaybe;
00964     yyHour = 0;
00965     yyMinutes = 0;
00966     yySeconds = 0;
00967     yyMeridian = MER24;
00968     yyRelSeconds = 0;
00969     yyRelMonth = 0;
00970     yyHaveDate = 0;
00971     yyHaveDay = 0;
00972     yyHaveRel = 0;
00973     yyHaveTime = 0;
00974     yyHaveZone = 0;
00975
00976     if (yyparse()
00977      || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
00978     return -1;
00979
00980     if (yyHaveDate || yyHaveTime || yyHaveDay) {
00981     Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
00982             yyMeridian, yyDSTmode);
00983     if (Start == -1) // bug on mac, was < 0
00984         return -1;
00985     }
00986     else {
00987     Start = nowtime;
00988     if (!yyHaveRel)
00989         Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) + tm->tm_sec;
00990     }
00991
00992     Start += yyRelSeconds;
00993     Start += RelativeMonth(Start, yyRelMonth);
00994
00995     if (yyHaveDay && !yyHaveDate) {
00996     tod = RelativeDate(Start, yyDayOrdinal, yyDayNumber);
00997     Start += tod;
00998     }
00999
01000     /* Have to do *something* with a legitimate -1 so it's distinguishable
01001      * from the error return value.  (Alternately could set errno on error.) */
01002     return Start == -1 ? 0 : Start;
01003 }

int getdate_yyerror ( char * s ) [static]

Definition at line 602 of file getdate.y.

00603 {
00604   return 0;
00605 }

int getdate_yylex ( ) [static]

Definition at line 837 of file getdate.y.

00838 {
00839     register char   c;
00840     register char   *p;
00841     char        buff[20];
00842     int         Count;
00843     int         sign;
00844
00845     for ( ; ; ) {
00846     while (isspace(*yyInput))
00847         yyInput++;
00848
00849     if (isdigit(c = *yyInput) || c == '-' || c == '+') {
00850         if (c == '-' || c == '+') {
00851         sign = c == '-' ? -1 : 1;
00852         if (!isdigit(*++yyInput))
00853             /* skip the '-' sign */
00854             continue;
00855         }
00856         else
00857         sign = 0;
00858         for (yylval.Number = 0; isdigit(c = *yyInput++); )
00859         yylval.Number = 10 * yylval.Number + c - '0';
00860         yyInput--;
00861         if (sign < 0)
00862         yylval.Number = -yylval.Number;
00863         return sign ? tSNUMBER : tUNUMBER;
00864     }
00865     if (isalpha(c)) {
00866         for (p = buff; isalpha(c = *yyInput++) || c == '.'; )
00867         if (p < &buff[sizeof buff - 1])
00868             *p++ = c;
00869         *p = '\0';
00870         yyInput--;
00871         return LookupWord(buff);
00872     }
00873     if (c != '(')
00874         return *yyInput++;
00875     Count = 0;
00876     do {
00877         c = *yyInput++;
00878         if (c == '\0')
00879         return c;
00880         if (c == '(')
00881         Count++;
00882         else if (c == ')')
00883         Count--;
00884     } while (Count > 0);
00885     }
00886 }

Variable Documentation

TABLE const MilitaryTable[] [static]

Initial value:

 {
    { "a",  tZONE,  ((time_t)( 1 ) * 60) },
    { "b",  tZONE,  ((time_t)( 2 ) * 60) },
    { "c",  tZONE,  ((time_t)( 3 ) * 60) },
    { "d",  tZONE,  ((time_t)( 4 ) * 60) },
    { "e",  tZONE,  ((time_t)( 5 ) * 60) },
    { "f",  tZONE,  ((time_t)( 6 ) * 60) },
    { "g",  tZONE,  ((time_t)( 7 ) * 60) },
    { "h",  tZONE,  ((time_t)( 8 ) * 60) },
    { "i",  tZONE,  ((time_t)( 9 ) * 60) },
    { "k",  tZONE,  ((time_t)( 10 ) * 60) },
    { "l",  tZONE,  ((time_t)( 11 ) * 60) },
    { "m",  tZONE,  ((time_t)( 12 ) * 60) },
    { "n",  tZONE,  ((time_t)( - 1 ) * 60) },
    { "o",  tZONE,  ((time_t)( - 2 ) * 60) },
    { "p",  tZONE,  ((time_t)( - 3 ) * 60) },
    { "q",  tZONE,  ((time_t)( - 4 ) * 60) },
    { "r",  tZONE,  ((time_t)( - 5 ) * 60) },
    { "s",  tZONE,  ((time_t)( - 6 ) * 60) },
    { "t",  tZONE,  ((time_t)( - 7 ) * 60) },
    { "u",  tZONE,  ((time_t)( - 8 ) * 60) },
    { "v",  tZONE,  ((time_t)( - 9 ) * 60) },
    { "w",  tZONE,  ((time_t)( -10 ) * 60) },
    { "x",  tZONE,  ((time_t)( -11 ) * 60) },
    { "y",  tZONE,  ((time_t)( -12 ) * 60) },
    { "z",  tZONE,  ((time_t)( 0 ) * 60) },
    { NULL }
}

Definition at line 568 of file getdate.y.

TABLE const MonthDayTable[] [static]

Initial value:

 {
    { "january",    tMONTH,  1 },
    { "february",   tMONTH,  2 },
    { "march",      tMONTH,  3 },
    { "april",      tMONTH,  4 },
    { "may",        tMONTH,  5 },
    { "june",       tMONTH,  6 },
    { "july",       tMONTH,  7 },
    { "august",     tMONTH,  8 },
    { "september",  tMONTH,  9 },
    { "sept",       tMONTH,  9 },
    { "october",    tMONTH, 10 },
    { "november",   tMONTH, 11 },
    { "december",   tMONTH, 12 },
    { "sunday",     tDAY, 0 },
    { "monday",     tDAY, 1 },
    { "tuesday",    tDAY, 2 },
    { "tues",       tDAY, 2 },
    { "wednesday",  tDAY, 3 },
    { "wednes",     tDAY, 3 },
    { "thursday",   tDAY, 4 },
    { "thur",       tDAY, 4 },
    { "thurs",      tDAY, 4 },
    { "friday",     tDAY, 5 },
    { "saturday",   tDAY, 6 },
    { NULL }
}

Definition at line 414 of file getdate.y.

TABLE const OtherTable[] [static]

Initial value:

 {
    { "tomorrow",   tMINUTE_UNIT,   1 * 24 * 60 },
    { "yesterday",  tMINUTE_UNIT,   -1 * 24 * 60 },
    { "today",      tMINUTE_UNIT,   0 },
    { "now",        tMINUTE_UNIT,   0 },
    { "last",       tUNUMBER,   -1 },
    { "this",       tMINUTE_UNIT,   0 },
    { "next",       tUNUMBER,   2 },
    { "first",      tUNUMBER,   1 },

    { "third",      tUNUMBER,   3 },
    { "fourth",     tUNUMBER,   4 },
    { "fifth",      tUNUMBER,   5 },
    { "sixth",      tUNUMBER,   6 },
    { "seventh",    tUNUMBER,   7 },
    { "eighth",     tUNUMBER,   8 },
    { "ninth",      tUNUMBER,   9 },
    { "tenth",      tUNUMBER,   10 },
    { "eleventh",   tUNUMBER,   11 },
    { "twelfth",    tUNUMBER,   12 },
    { "ago",        tAGO,   1 },
    { NULL }
}

Definition at line 458 of file getdate.y.

TABLE const TimezoneTable[] [static]

Definition at line 484 of file getdate.y.

TABLE const UnitsTable[] [static]

Initial value:

 {
    { "year",       tMONTH_UNIT,    12 },
    { "month",      tMONTH_UNIT,    1 },
    { "fortnight",  tMINUTE_UNIT,   14 * 24 * 60 },
    { "week",       tMINUTE_UNIT,   7 * 24 * 60 },
    { "day",        tMINUTE_UNIT,   1 * 24 * 60 },
    { "hour",       tMINUTE_UNIT,   60 },
    { "minute",     tMINUTE_UNIT,   1 },
    { "min",        tMINUTE_UNIT,   1 },
    { "second",     tSEC_UNIT,  1 },
    { "sec",        tSEC_UNIT,  1 },
    { NULL }
}

Definition at line 443 of file getdate.y.

item __pad0__

Definition at line 212 of file getdate.y.

relunit __pad10__

Definition at line 348 of file getdate.y.

number __pad11__

Definition at line 378 of file getdate.y.

o_merid __pad12__

Definition at line 404 of file getdate.y.

time __pad1__

Definition at line 230 of file getdate.y.

tUNUMBER __pad2__

Definition at line 236 of file getdate.y.

tUNUMBER __pad3__

Definition at line 242 of file getdate.y.

tUNUMBER __pad4__

Definition at line 249 of file getdate.y.

tUNUMBER __pad5__

Definition at line 255 of file getdate.y.

zone __pad6__

Definition at line 265 of file getdate.y.

day __pad7__

Definition at line 280 of file getdate.y.

date __pad8__

Definition at line 294 of file getdate.y.

rel __pad9__

Definition at line 341 of file getdate.y.

relunit

Definition at line 345 of file getdate.y.

tDAY

Definition at line 283 of file getdate.y.

yyDSTmode = DSToff

Definition at line 266 of file getdate.y.

yyDay = $3

Definition at line 295 of file getdate.y.

yyDayNumber = $1

Definition at line 281 of file getdate.y.

yyMeridian = $2

Definition at line 258 of file getdate.y.

yyMinutes = 0

Definition at line 256 of file getdate.y.

yyRelMonth = -yyRelMonth

Definition at line 342 of file getdate.y.

yySeconds = 0

Definition at line 257 of file getdate.y.

yyTimezone = - ($4 % 100 + ($4 / 100) * 60)

Definition at line 260 of file getdate.y.

Generated on Sun Oct 21 12:43:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getline.c File Reference

cvs-1.10/lib/getline.c File Reference

#include <sys/types.h>
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include "getline.h"

Include dependency graph for getline.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | MIN_CHUNK 64

Functions

char * | malloc (),*realloc()
int | getstr (char **lineptr, size_t *n, FILE *stream, char terminator, int offset, int limit)
int | getline (char **lineptr, size_t *n, FILE *stream)
int | getline_safe (char **lineptr, size_t *n, FILE *stream, int limit)

Define Documentation

#define MIN_CHUNK 64

Definition at line 34 of file getline.c.

Function Documentation

int getline | ( | char ** | lineptr,
 |  | size_t * | n,
 |  | FILE * | stream
 | ) |

Definition at line 152 of file getline.c.

00153 {
00154   return getstr (lineptr, n, stream, '\n', 0, GETLINE_NO_LIMIT);
00155 }

int getline_safe | ( | char ** | lineptr,
 |  | size_t * | n,
 |  | FILE * | stream,
 |  | int | limit
 | ) |

Definition at line 158 of file getline.c.

00160 {
00161   return getstr (lineptr, n, stream, '\n', 0, limit);
00162 }

int getstr | ( | char ** | lineptr,
 |  | size_t * | n,
 |  | FILE * | stream,
 |  | char | terminator,
 |  | int | offset,
 |  | int | limit
 | ) |

Definition at line 49 of file getline.c.

00051 {
00052   int nchars_avail;     /* Allocated but unused chars in *LINEPTR.  */
00053   char *read_pos;       /* Where we're reading into *LINEPTR. */
00054   int ret;
00055
00056   if (!lineptr || !n || !stream)
00057     {
00058       errno = EINVAL;
00059       return -1;
00060     }
00061
00062   if (!*lineptr)
00063     {
00064       *n = MIN_CHUNK;
00065       *lineptr = malloc (*n);
00066       if (!*lineptr)
00067     {
00068       errno = ENOMEM;
00069       return -1;
00070     }
00071     }
00072
00073   nchars_avail = *n - offset;
00074   read_pos = *lineptr + offset;
00075
00076   for (;;)
00077     {
00078       int save_errno;
00079       register int c;
00080
00081       if (limit == 0)
00082           break;
00083       else
00084       {
00085           c = getc (stream);
00086
00087           /* If limit is negative, then we shouldn't pay attention to
00088              it, so decrement only if positive. */
00089           if (limit > 0)
00090               limit--;
00091       }
00092
00093       save_errno = errno;
00094
00095       /* We always want at least one char left in the buffer, since we
00096      always (unless we get an error while reading the first char)
00097      NUL-terminate the line buffer.  */
00098
00099       assert((*lineptr + *n) == (read_pos + nchars_avail));
00100       if (nchars_avail < 2)
00101     {
00102       if (*n > MIN_CHUNK)
00103         *n *= 2;
00104       else
00105         *n += MIN_CHUNK;
00106
00107       nchars_avail = *n + *lineptr - read_pos;
00108       *lineptr = realloc (*lineptr, *n);
00109       if (!*lineptr)
00110         {
00111           errno = ENOMEM;
00112           return -1;
00113         }
00114       read_pos = *n - nchars_avail + *lineptr;
00115       assert((*lineptr + *n) == (read_pos + nchars_avail));
00116     }
00117
00118       if (ferror (stream))
00119     {
00120       /* Might like to return partial line, but there is no
00121          place for us to store errno.  And we don't want to just
00122          lose errno.  */
00123       errno = save_errno;
00124       return -1;
00125     }
00126
00127       if (c == EOF)
00128     {
00129       /* Return partial line, if any.  */
00130       if (read_pos == *lineptr)
00131         return -1;
00132       else
00133         break;
00134     }
00135
00136       *read_pos++ = c;
00137       nchars_avail--;
00138
00139       if (c == terminator)
00140     /* Return the line.  */
00141     break;
00142     }
00143
00144   /* Done - NUL terminate and return the number of chars read.  */
00145   *read_pos = '\0';
00146
00147   ret = read_pos - (*lineptr + offset);
00148   return ret;
00149 }

char* malloc ( )

Generated on Sun Oct 21 12:42:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/getline.c Source File

cvs-1.10/lib/getline.c

Go to the documentation of this file.
00001 /* getline.c -- Replacement for GNU C library function getline
00002
00003 Copyright (C) 1993 Free Software Foundation, Inc.
00004
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License as
00007 published by the Free Software Foundation; either version 2 of the
00008 License, or (at your option) any later version.
00009
00010 This program is distributed in the hope that it will be useful, but
00011 WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 General Public License for more details.  */
00014
00015 /* Written by Jan Brittenson, bson@gnu.ai.mit.edu.  */
00016
00017 #ifdef HAVE_CONFIG_H
00018 #include <config.h>
00019 #endif
00020
00021 #include <sys/types.h>
00022 #include <stdio.h>
00023 #include <assert.h>
00024 #include <errno.h>
00025 #include "getline.h"
00026
00027 #if STDC_HEADERS
00028 #include <stdlib.h>
00029 #else
00030 char *malloc (), *realloc ();
00031 #endif
00032
00033 /* Always add at least this many bytes when extending the buffer.  */
00034 #define MIN_CHUNK 64
00035
00036 /* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR
00037    + OFFSET (and null-terminate it).  If LIMIT is non-negative, then
00038    read no more than LIMIT chars.
00039
00040    *LINEPTR is a pointer returned from malloc (or NULL), pointing to
00041    *N characters of space.  It is realloc'd as necessary.
00042
00043    Return the number of characters read (not including the null
00044    terminator), or -1 on error or EOF.  On a -1 return, the caller
00045    should check feof(), if not then errno has been set to indicate the
00046    error.  */
00047
00048 int
00049 getstr (char **lineptr, size_t *n, FILE *stream,
00050            char terminator, int offset, int limit)
00051 {
00052   int nchars_avail;     /* Allocated but unused chars in *LINEPTR.  */
00053   char *read_pos;       /* Where we're reading into *LINEPTR. */
00054   int ret;
00055
00056   if (!lineptr || !n || !stream)
00057     {
00058       errno = EINVAL;
00059       return -1;
00060     }
00061
00062   if (!*lineptr)
00063     {
00064       *n = MIN_CHUNK;
00065       *lineptr = malloc (*n);
00066       if (!*lineptr)
00067     {
00068       errno = ENOMEM;
00069       return -1;
00070     }
00071     }
00072
00073   nchars_avail = *n - offset;
00074   read_pos = *lineptr + offset;
00075
00076   for (;;)
00077     {
00078       int save_errno;
00079       register int c;
00080
00081       if (limit == 0)
00082           break;
00083       else
00084       {
00085           c = getc (stream);
00086
00087           /* If limit is negative, then we shouldn't pay attention to
00088              it, so decrement only if positive. */
00089           if (limit > 0)
00090               limit--;
00091       }
00092
00093       save_errno = errno;
00094
00095       /* We always want at least one char left in the buffer, since we
00096      always (unless we get an error while reading the first char)
00097      NUL-terminate the line buffer.  */
00098
00099       assert((*lineptr + *n) == (read_pos + nchars_avail));
00100       if (nchars_avail < 2)
00101     {
00102       if (*n > MIN_CHUNK)
00103         *n *= 2;
00104       else
00105         *n += MIN_CHUNK;
00106
00107       nchars_avail = *n + *lineptr - read_pos;
00108       *lineptr = realloc (*lineptr, *n);
00109       if (!*lineptr)
00110         {
00111           errno = ENOMEM;
00112           return -1;
00113         }
00114       read_pos = *n - nchars_avail + *lineptr;
00115       assert((*lineptr + *n) == (read_pos + nchars_avail));
00116     }
00117
00118       if (ferror (stream))
00119     {
00120       /* Might like to return partial line, but there is no
00121          place for us to store errno.  And we don't want to just
00122          lose errno.  */
00123       errno = save_errno;
00124       return -1;
00125     }
00126
00127       if (c == EOF)
00128     {
00129       /* Return partial line, if any.  */
00130       if (read_pos == *lineptr)
00131         return -1;
00132       else
00133         break;
00134     }
00135
00136       *read_pos++ = c;
00137       nchars_avail--;
00138
00139       if (c == terminator)
00140     /* Return the line.  */
00141     break;
00142     }
00143
00144   /* Done - NUL terminate and return the number of chars read.  */
00145   *read_pos = '\0';
00146
00147   ret = read_pos - (*lineptr + offset);
00148   return ret;
00149 }
00150
00151 int
00152 getline (char **lineptr, size_t *n, FILE *stream)
00153 {
00154   return getstr (lineptr, n, stream, '\n', 0, GETLINE_NO_LIMIT);
00155 }
00156
00157 int
00158 getline_safe (char **lineptr, size_t *n, FILE *stream,
00159                          int limit)
00160 {
00161   return getstr (lineptr, n, stream, '\n', 0, limit);
00162 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getline.h File Reference

cvs-1.10/lib/getline.h File Reference

#include <stdio.h>

Include dependency graph for getline.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | _getline_h_ 1
#define | __PROTO(args) ()
#define | GETLINE_NO_LIMIT -1

Functions

int | getline ()
int | getline_safe ()
int | getstr ()

Define Documentation

#define GETLINE_NO_LIMIT -1

Definition at line 12 of file getline.h.

#define __PROTO ( args ) ()

Definition at line 9 of file getline.h.

#define _getline_h_ 1

Definition at line 2 of file getline.h.

Function Documentation

int getline ( )

Referenced by CvsLogParse(), MacroTraversal::OnFile(), ReadIgnoredFile(), Tag_Open(), fgetentent(), and loadSettingsInternal().

int getline_safe ( )

int getstr ( )

Referenced by getline(), and getline_safe().

Generated on Sun Oct 21 12:42:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/getline.h Source File

cvs-1.10/lib/getline.h

Go to the documentation of this file.
00001 #ifndef _getline_h_
00002 #define _getline_h_ 1
00003
00004 #include <stdio.h>
00005
00006 #if defined (__GNUC__) || (defined (__STDC__) && __STDC__) || defined(macintosh)
00007 #define __PROTO(args) args
00008 #else
00009 #define __PROTO(args) ()
00010 #endif  /* GCC.  */
00011
00012 #define GETLINE_NO_LIMIT -1
00013
00014 int
00015   getline __PROTO ((char **_lineptr, size_t *_n, FILE *_stream));
00016 int
00017   getline_safe __PROTO ((char **_lineptr, size_t *_n, FILE *_stream,
00018                          int limit));
00019 int
00020   getstr __PROTO ((char **_lineptr, size_t *_n, FILE *_stream,
00021            char _terminator, int _offset, int limit));
00022
00023 #endif /* _getline_h_ */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getopt.c File Reference

cvs-1.10/lib/getopt.c File Reference

#include <stdio.h>
#include "getopt.h"

Include dependency graph for getopt.c:

Include dependency graph

Go to the source code of this file.

Enumerations

enum | { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER }

Functions

char * | getenv ()
char * | my_index (str, chr) char *str
void | exchange (argv) char **argv

Variables

char * | optarg = NULL
int | optind = 0
char * | nextchar
int | opterr = 1
int | optopt = '?'
enum { ... } | ordering
char * | posixly_correct
int | chr
int | last_nonopt
char ** | argv
char * | optstring
option * longopts
int * | longind
int | long_only

Enumeration Type Documentation

anonymous enum

Enumeration values:
REQUIRE_ORDER
PERMUTE
RETURN_IN_ORDER

Definition at line 157 of file getopt.c.

00158 {
00159   REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
00160 } ordering;

Function Documentation

void exchange ( argv ) [static]

char* getenv ( )

char* my_index | ( | str | ,
 |  | chr |
 | ) | [static]

Variable Documentation

char* * argv

Definition at line 674 of file getopt.c.

int chr

Definition at line 182 of file getopt.c.

int last_nonopt [static]

Definition at line 214 of file getopt.c.

int long_only

Definition at line 380 of file getopt.c.

int* longind

Definition at line 379 of file getopt.c.

struct option* longopts

Definition at line 378 of file getopt.c.

char* nextchar [static]

Definition at line 115 of file getopt.c.

char* optarg = NULL

Definition at line 91 of file getopt.c.

int opterr = 1

Definition at line 120 of file getopt.c.

int optind = 0

Definition at line 106 of file getopt.c.

int optopt = '?'

Definition at line 126 of file getopt.c.

char* optstring

Definition at line 675 of file getopt.c.

enum { ... } ordering [static]

char* posixly_correct [static]

Definition at line 163 of file getopt.c.

Generated on Sun Oct 21 12:42:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/getopt.c Source File

cvs-1.10/lib/getopt.c

Go to the documentation of this file.
00001 /* Getopt for GNU.
00002    NOTE: getopt is now part of the C library, so if you don't know what
00003    "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
00004    before changing it!
00005
00006    Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94
00007     Free Software Foundation, Inc.
00008
00009    This program is free software; you can redistribute it and/or modify it
00010    under the terms of the GNU General Public License as published by the
00011    Free Software Foundation; either version 2, or (at your option) any
00012    later version.
00013
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.  */
00018
00019 /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
00020    Ditto for AIX 3.2 and <stdlib.h>.  */
00021 #ifndef _NO_PROTO
00022 #define _NO_PROTO
00023 #endif
00024
00025 #ifdef HAVE_CONFIG_H
00026 #if defined (emacs) || defined (CONFIG_BROKETS)
00027 /* We use <config.h> instead of "config.h" so that a compilation
00028    using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
00029    (which it would do because it found this file in $srcdir).  */
00030 #include <config.h>
00031 #else
00032 #include "config.h"
00033 #endif
00034 #endif
00035
00036 #ifndef __STDC__
00037 /* This is a separate conditional since some stdc systems
00038    reject `defined (const)'.  */
00039 #ifndef const
00040 #define const
00041 #endif
00042 #endif
00043
00044 #include <stdio.h>
00045
00046 #ifdef HAVE_STRING_H
00047 #include <string.h>
00048 #endif
00049
00050 /* Comment out all this code if we are using the GNU C Library, and are not
00051    actually compiling the library itself.  This code is part of the GNU C
00052    Library, but also included in many other GNU distributions.  Compiling
00053    and linking in this code is a waste when using the GNU C library
00054    (especially if it is a shared library).  Rather than having every GNU
00055    program understand `configure --with-gnu-libc' and omit the object files,
00056    it is simpler to just do this in the source for each such file.  */
00057
00058 #if defined (_LIBC) || !defined (__GNU_LIBRARY__)
00059
00060
00061 /* This needs to come after some library #include
00062    to get __GNU_LIBRARY__ defined.  */
00063 #ifdef  __GNU_LIBRARY__
00064 /* Don't include stdlib.h for non-GNU C libraries because some of them
00065    contain conflicting prototypes for getopt.  */
00066 #include <stdlib.h>
00067 #endif  /* GNU C library.  */
00068
00069 /* This version of `getopt' appears to the caller like standard Unix `getopt'
00070    but it behaves differently for the user, since it allows the user
00071    to intersperse the options with the other arguments.
00072
00073    As `getopt' works, it permutes the elements of ARGV so that,
00074    when it is done, all the options precede everything else.  Thus
00075    all application programs are extended to handle flexible argument order.
00076
00077    Setting the environment variable POSIXLY_CORRECT disables permutation.
00078    Then the behavior is completely standard.
00079
00080    GNU application programs can use a third alternative mode in which
00081    they can distinguish the relative order of options and other arguments.  */
00082
00083 #include "getopt.h"
00084
00085 /* For communication from `getopt' to the caller.
00086    When `getopt' finds an option that takes an argument,
00087    the argument value is returned here.
00088    Also, when `ordering' is RETURN_IN_ORDER,
00089    each non-option ARGV-element is returned here.  */
00090
00091 char *optarg = NULL;
00092
00093 /* Index in ARGV of the next element to be scanned.
00094    This is used for communication to and from the caller
00095    and for communication between successive calls to `getopt'.
00096
00097    On entry to `getopt', zero means this is the first call; initialize.
00098
00099    When `getopt' returns EOF, this is the index of the first of the
00100    non-option elements that the caller should itself scan.
00101
00102    Otherwise, `optind' communicates from one call to the next
00103    how much of ARGV has been scanned so far.  */
00104
00105 /* XXX 1003.2 says this must be 1 before any call.  */
00106 int optind = 0;
00107
00108 /* The next char to be scanned in the option-element
00109    in which the last option character we returned was found.
00110    This allows us to pick up the scan where we left off.
00111
00112    If this is zero, or a null string, it means resume the scan
00113    by advancing to the next ARGV-element.  */
00114
00115 static char *nextchar;
00116
00117 /* Callers store zero here to inhibit the error message
00118    for unrecognized options.  */
00119
00120 int opterr = 1;
00121
00122 /* Set to an option character which was unrecognized.
00123    This must be initialized on some systems to avoid linking in the
00124    system's own getopt implementation.  */
00125
00126 int optopt = '?';
00127
00128 /* Describe how to deal with options that follow non-option ARGV-elements.
00129
00130    If the caller did not specify anything,
00131    the default is REQUIRE_ORDER if the environment variable
00132    POSIXLY_CORRECT is defined, PERMUTE otherwise.
00133
00134    REQUIRE_ORDER means don't recognize them as options;
00135    stop option processing when the first non-option is seen.
00136    This is what Unix does.
00137    This mode of operation is selected by either setting the environment
00138    variable POSIXLY_CORRECT, or using `+' as the first character
00139    of the list of option characters.
00140
00141    PERMUTE is the default.  We permute the contents of ARGV as we scan,
00142    so that eventually all the non-options are at the end.  This allows options
00143    to be given in any order, even with programs that were not written to
00144    expect this.
00145
00146    RETURN_IN_ORDER is an option available to programs that were written
00147    to expect options and other ARGV-elements in any order and that care about
00148    the ordering of the two.  We describe each non-option ARGV-element
00149    as if it were the argument of an option with character code 1.
00150    Using `-' as the first character of the list of option characters
00151    selects this mode of operation.
00152
00153    The special argument `--' forces an end of option-scanning regardless
00154    of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
00155    `--' can cause `getopt' to return EOF with `optind' != ARGC.  */
00156
00157 static enum
00158 {
00159   REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
00160 } ordering;
00161
00162 /* Value of POSIXLY_CORRECT environment variable.  */
00163 static char *posixly_correct;
00164
00165 #ifdef  __GNU_LIBRARY__
00166 /* We want to avoid inclusion of string.h with non-GNU libraries
00167    because there are many ways it can cause trouble.
00168    On some systems, it contains special magic macros that don't work
00169    in GCC.  */
00170 #include <string.h>
00171 #define my_index    strchr
00172 #else
00173
00174 /* Avoid depending on library functions or files
00175    whose names are inconsistent.  */
00176
00177 char *getenv ();
00178
00179 static char *
00180 my_index (str, chr)
00181      const char *str;
00182      int chr;
00183 {
00184   while (*str)
00185     {
00186       if (*str == chr)
00187     return (char *) str;
00188       str++;
00189     }
00190   return 0;
00191 }
00192
00193 /* If using GCC, we can safely declare strlen this way.
00194    If not using GCC, it is ok not to declare it.  */
00195 #ifdef __GNUC__
00196 /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
00197    That was relevant to code that was here before.  */
00198 #ifndef __STDC__
00199 /* gcc with -traditional declares the built-in strlen to return int,
00200    and has done so at least since version 2.4.5. -- rms.  */
00201 extern int strlen (const char *);
00202 #endif /* not __STDC__ */
00203 #endif /* __GNUC__ */
00204
00205 #endif /* not __GNU_LIBRARY__ */
00206
00207 /* Handle permutation of arguments.  */
00208
00209 /* Describe the part of ARGV that contains non-options that have
00210    been skipped.  `first_nonopt' is the index in ARGV of the first of them;
00211    `last_nonopt' is the index after the last of them.  */
00212
00213 static int first_nonopt;
00214 static int last_nonopt;
00215
00216 /* Exchange two adjacent subsequences of ARGV.
00217    One subsequence is elements [first_nonopt,last_nonopt)
00218    which contains all the non-options that have been skipped so far.
00219    The other is elements [last_nonopt,optind), which contains all
00220    the options processed since those non-options were skipped.
00221
00222    `first_nonopt' and `last_nonopt' are relocated so that they describe
00223    the new indices of the non-options in ARGV after they are moved.  */
00224
00225 static void
00226 exchange (argv)
00227      char **argv;
00228 {
00229   int bottom = first_nonopt;
00230   int middle = last_nonopt;
00231   int top = optind;
00232   char *tem;
00233
00234   /* Exchange the shorter segment with the far end of the longer segment.
00235      That puts the shorter segment into the right place.
00236      It leaves the longer segment in the right place overall,
00237      but it consists of two parts that need to be swapped next.  */
00238
00239   while (top > middle && middle > bottom)
00240     {
00241       if (top - middle > middle - bottom)
00242     {
00243       /* Bottom segment is the short one.  */
00244       int len = middle - bottom;
00245       register int i;
00246
00247       /* Swap it with the top part of the top segment.  */
00248       for (i = 0; i < len; i++)
00249         {
00250           tem = argv[bottom + i];
00251           argv[bottom + i] = argv[top - (middle - bottom) + i];
00252           argv[top - (middle - bottom) + i] = tem;
00253         }
00254       /* Exclude the moved bottom segment from further swapping.  */
00255       top -= len;
00256     }
00257       else
00258     {
00259       /* Top segment is the short one.  */
00260       int len = top - middle;
00261       register int i;
00262
00263       /* Swap it with the bottom part of the bottom segment.  */
00264       for (i = 0; i < len; i++)
00265         {
00266           tem = argv[bottom + i];
00267           argv[bottom + i] = argv[middle + i];
00268           argv[middle + i] = tem;
00269         }
00270       /* Exclude the moved top segment from further swapping.  */
00271       bottom += len;
00272     }
00273     }
00274
00275   /* Update records for the slots the non-options now occupy.  */
00276
00277   first_nonopt += (optind - last_nonopt);
00278   last_nonopt = optind;
00279 }
00280
00281 /* Initialize the internal data when the first call is made.  */
00282
00283 static const char *
00284 _getopt_initialize (optstring)
00285      const char *optstring;
00286 {
00287   /* Start processing options with ARGV-element 1 (since ARGV-element 0
00288      is the program name); the sequence of previously skipped
00289      non-option ARGV-elements is empty.  */
00290
00291   first_nonopt = last_nonopt = optind = 1;
00292
00293   nextchar = NULL;
00294
00295   posixly_correct = getenv ("POSIXLY_CORRECT");
00296
00297   /* Determine how to handle the ordering of options and nonoptions.  */
00298
00299   if (optstring[0] == '-')
00300     {
00301       ordering = RETURN_IN_ORDER;
00302       ++optstring;
00303     }
00304   else if (optstring[0] == '+')
00305     {
00306       ordering = REQUIRE_ORDER;
00307       ++optstring;
00308     }
00309   else if (posixly_correct != NULL)
00310     ordering = REQUIRE_ORDER;
00311   else
00312     ordering = PERMUTE;
00313
00314   return optstring;
00315 }
00316
00317 /* Scan elements of ARGV (whose length is ARGC) for option characters
00318    given in OPTSTRING.
00319
00320    If an element of ARGV starts with '-', and is not exactly "-" or "--",
00321    then it is an option element.  The characters of this element
00322    (aside from the initial '-') are option characters.  If `getopt'
00323    is called repeatedly, it returns successively each of the option characters
00324    from each of the option elements.
00325
00326    If `getopt' finds another option character, it returns that character,
00327    updating `optind' and `nextchar' so that the next call to `getopt' can
00328    resume the scan with the following option character or ARGV-element.
00329
00330    If there are no more option characters, `getopt' returns `EOF'.
00331    Then `optind' is the index in ARGV of the first ARGV-element
00332    that is not an option.  (The ARGV-elements have been permuted
00333    so that those that are not options now come last.)
00334
00335    OPTSTRING is a string containing the legitimate option characters.
00336    If an option character is seen that is not listed in OPTSTRING,
00337    return '?' after printing an error message.  If you set `opterr' to
00338    zero, the error message is suppressed but we still return '?'.
00339
00340    If a char in OPTSTRING is followed by a colon, that means it wants an arg,
00341    so the following text in the same ARGV-element, or the text of the following
00342    ARGV-element, is returned in `optarg'.  Two colons mean an option that
00343    wants an optional arg; if there is text in the current ARGV-element,
00344    it is returned in `optarg', otherwise `optarg' is set to zero.
00345
00346    If OPTSTRING starts with `-' or `+', it requests different methods of
00347    handling the non-option ARGV-elements.
00348    See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
00349
00350    Long-named options begin with `--' instead of `-'.
00351    Their names may be abbreviated as long as the abbreviation is unique
00352    or is an exact match for some defined option.  If they have an
00353    argument, it follows the option name in the same ARGV-element, separated
00354    from the option name by a `=', or else the in next ARGV-element.
00355    When `getopt' finds a long-named option, it returns 0 if that option's
00356    `flag' field is nonzero, the value of the option's `val' field
00357    if the `flag' field is zero.
00358
00359    The elements of ARGV aren't really const, because we permute them.
00360    But we pretend they're const in the prototype to be compatible
00361    with other systems.
00362
00363    LONGOPTS is a vector of `struct option' terminated by an
00364    element containing a name which is zero.
00365
00366    LONGIND returns the index in LONGOPT of the long-named option found.
00367    It is only valid when a long-named option has been found by the most
00368    recent call.
00369
00370    If LONG_ONLY is nonzero, '-' as well as '--' can introduce
00371    long-named options.  */
00372
00373 int
00374 _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
00375      int argc;
00376      char *const *argv;
00377      const char *optstring;
00378      const struct option *longopts;
00379      int *longind;
00380      int long_only;
00381 {
00382   optarg = NULL;
00383
00384   if (optind == 0)
00385     optstring = _getopt_initialize (optstring);
00386
00387   if (nextchar == NULL || *nextchar == '\0')
00388     {
00389       /* Advance to the next ARGV-element.  */
00390
00391       if (ordering == PERMUTE)
00392     {
00393       /* If we have just processed some options following some non-options,
00394          exchange them so that the options come first.  */
00395
00396       if (first_nonopt != last_nonopt && last_nonopt != optind)
00397         exchange ((char **) argv);
00398       else if (last_nonopt != optind)
00399         first_nonopt = optind;
00400
00401       /* Skip any additional non-options
00402          and extend the range of non-options previously skipped.  */
00403
00404       while (optind < argc
00405          && (argv[optind][0] != '-' || argv[optind][1] == '\0'))
00406         optind++;
00407       last_nonopt = optind;
00408     }
00409
00410       /* The special ARGV-element `--' means premature end of options.
00411      Skip it like a null option,
00412      then exchange with previous non-options as if it were an option,
00413      then skip everything else like a non-option.  */
00414
00415       if (optind != argc && !strcmp (argv[optind], "--"))
00416     {
00417       optind++;
00418
00419       if (first_nonopt != last_nonopt && last_nonopt != optind)
00420         exchange ((char **) argv);
00421       else if (first_nonopt == last_nonopt)
00422         first_nonopt = optind;
00423       last_nonopt = argc;
00424
00425       optind = argc;
00426     }
00427
00428       /* If we have done all the ARGV-elements, stop the scan
00429      and back over any non-options that we skipped and permuted.  */
00430
00431       if (optind == argc)
00432     {
00433       /* Set the next-arg-index to point at the non-options
00434          that we previously skipped, so the caller will digest them.  */
00435       if (first_nonopt != last_nonopt)
00436         optind = first_nonopt;
00437       return EOF;
00438     }
00439
00440       /* If we have come to a non-option and did not permute it,
00441      either stop the scan or describe it to the caller and pass it by.  */
00442
00443       if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
00444     {
00445       if (ordering == REQUIRE_ORDER)
00446         return EOF;
00447       optarg = argv[optind++];
00448       return 1;
00449     }
00450
00451       /* We have found another option-ARGV-element.
00452      Skip the initial punctuation.  */
00453
00454       nextchar = (argv[optind] + 1
00455           + (longopts != NULL && argv[optind][1] == '-'));
00456     }
00457
00458   /* Decode the current option-ARGV-element.  */
00459
00460   /* Check whether the ARGV-element is a long option.
00461
00462      If long_only and the ARGV-element has the form "-f", where f is
00463      a valid short option, don't consider it an abbreviated form of
00464      a long option that starts with f.  Otherwise there would be no
00465      way to give the -f short option.
00466
00467      On the other hand, if there's a long option "fubar" and
00468      the ARGV-element is "-fu", do consider that an abbreviation of
00469      the long option, just like "--fu", and not "-f" with arg "u".
00470
00471      This distinction seems to be the most useful approach.  */
00472
00473   if (longopts != NULL
00474       && (argv[optind][1] == '-'
00475       || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
00476     {
00477       char *nameend;
00478       const struct option *p;
00479       const struct option *pfound = NULL;
00480       int exact = 0;
00481       int ambig = 0;
00482       int indfound;
00483       int option_index;
00484
00485       for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
00486     /* Do nothing.  */ ;
00487
00488       /* Test all long options for either exact match
00489      or abbreviated matches.  */
00490       for (p = longopts, option_index = 0; p->name; p++, option_index++)
00491     if (!strncmp (p->name, nextchar, nameend - nextchar))
00492       {
00493         if (nameend - nextchar == (int) strlen (p->name))
00494           {
00495         /* Exact match found.  */
00496         pfound = p;
00497         indfound = option_index;
00498         exact = 1;
00499         break;
00500           }
00501         else if (pfound == NULL)
00502           {
00503         /* First nonexact match found.  */
00504         pfound = p;
00505         indfound = option_index;
00506           }
00507         else
00508           /* Second or later nonexact match found.  */
00509           ambig = 1;
00510       }
00511
00512       if (ambig && !exact)
00513     {
00514       if (opterr)
00515         fprintf (stderr, "%s: option `%s' is ambiguous\n",
00516              argv[0], argv[optind]);
00517       nextchar += strlen (nextchar);
00518       optind++;
00519       return '?';
00520     }
00521
00522       if (pfound != NULL)
00523     {
00524       option_index = indfound;
00525       optind++;
00526       if (*nameend)
00527         {
00528           /* Don't test has_arg with >, because some C compilers don't
00529          allow it to be used on enums.  */
00530           if (pfound->has_arg)
00531         optarg = nameend + 1;
00532           else
00533         {
00534           if (opterr)
00535             {
00536               if (argv[optind - 1][1] == '-')
00537             /* --option */
00538             fprintf (stderr,
00539                  "%s: option `--%s' doesn't allow an argument\n",
00540                  argv[0], pfound->name);
00541               else
00542             /* +option or -option */
00543             fprintf (stderr,
00544                  "%s: option `%c%s' doesn't allow an argument\n",
00545                  argv[0], argv[optind - 1][0], pfound->name);
00546             }
00547           nextchar += strlen (nextchar);
00548           return '?';
00549         }
00550         }
00551       else if (pfound->has_arg == 1)
00552         {
00553           if (optind < argc)
00554         optarg = argv[optind++];
00555           else
00556         {
00557           if (opterr)
00558             fprintf (stderr, "%s: option `%s' requires an argument\n",
00559                  argv[0], argv[optind - 1]);
00560           nextchar += strlen (nextchar);
00561           return optstring[0] == ':' ? ':' : '?';
00562         }
00563         }
00564       nextchar += strlen (nextchar);
00565       if (longind != NULL)
00566         *longind = option_index;
00567       if (pfound->flag)
00568         {
00569           *(pfound->flag) = pfound->val;
00570           return 0;
00571         }
00572       return pfound->val;
00573     }
00574
00575       /* Can't find it as a long option.  If this is not getopt_long_only,
00576      or the option starts with '--' or is not a valid short
00577      option, then it's an error.
00578      Otherwise interpret it as a short option.  */
00579       if (!long_only || argv[optind][1] == '-'
00580       || my_index (optstring, *nextchar) == NULL)
00581     {
00582       if (opterr)
00583         {
00584           if (argv[optind][1] == '-')
00585         /* --option */
00586         fprintf (stderr, "%s: unrecognized option `--%s'\n",
00587              argv[0], nextchar);
00588           else
00589         /* +option or -option */
00590         fprintf (stderr, "%s: unrecognized option `%c%s'\n",
00591              argv[0], argv[optind][0], nextchar);
00592         }
00593       nextchar = (char *) "";
00594       optind++;
00595       return '?';
00596     }
00597     }
00598
00599   /* Look at and handle the next short option-character.  */
00600
00601   {
00602     char c = *nextchar++;
00603     char *temp = my_index (optstring, c);
00604
00605     /* Increment `optind' when we start to process its last character.  */
00606     if (*nextchar == '\0')
00607       ++optind;
00608
00609     if (temp == NULL || c == ':')
00610       {
00611     if (opterr)
00612       {
00613         if (posixly_correct)
00614           /* 1003.2 specifies the format of this message.  */
00615           fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
00616         else
00617           fprintf (stderr, "%s: invalid option -- %c\n", argv[0], c);
00618       }
00619     optopt = c;
00620     return '?';
00621       }
00622     if (temp[1] == ':')
00623       {
00624     if (temp[2] == ':')
00625       {
00626         /* This is an option that accepts an argument optionally.  */
00627         if (*nextchar != '\0')
00628           {
00629         optarg = nextchar;
00630         optind++;
00631           }
00632         else
00633           optarg = NULL;
00634         nextchar = NULL;
00635       }
00636     else
00637       {
00638         /* This is an option that requires an argument.  */
00639         if (*nextchar != '\0')
00640           {
00641         optarg = nextchar;
00642         /* If we end this ARGV-element by taking the rest as an arg,
00643            we must advance to the next element now.  */
00644         optind++;
00645           }
00646         else if (optind == argc)
00647           {
00648         if (opterr)
00649           {
00650             /* 1003.2 specifies the format of this message.  */
00651             fprintf (stderr, "%s: option requires an argument -- %c\n",
00652                  argv[0], c);
00653           }
00654         optopt = c;
00655         if (optstring[0] == ':')
00656           c = ':';
00657         else
00658           c = '?';
00659           }
00660         else
00661           /* We already incremented `optind' once;
00662          increment it again when taking next ARGV-elt as argument.  */
00663           optarg = argv[optind++];
00664         nextchar = NULL;
00665       }
00666       }
00667     return c;
00668   }
00669 }
00670
00671 int
00672 getopt (argc, argv, optstring)
00673      int argc;
00674      char *const *argv;
00675      const char *optstring;
00676 {
00677   return _getopt_internal (argc, argv, optstring,
00678                (const struct option *) 0,
00679                (int *) 0,
00680                0);
00681 }
00682
00683 #endif  /* _LIBC or not __GNU_LIBRARY__.  */
00684
00685 #ifdef TEST
00686
00687 /* Compile with -DTEST to make an executable for use in testing
00688    the above definition of `getopt'.  */
00689
00690 int
00691 main (argc, argv)
00692      int argc;
00693      char **argv;
00694 {
00695   int c;
00696   int digit_optind = 0;
00697
00698   while (1)
00699     {
00700       int this_option_optind = optind ? optind : 1;
00701
00702       c = getopt (argc, argv, "abc:d:0123456789");
00703       if (c == EOF)
00704     break;
00705
00706       switch (c)
00707     {
00708     case '0':
00709     case '1':
00710     case '2':
00711     case '3':
00712     case '4':
00713     case '5':
00714     case '6':
00715     case '7':
00716     case '8':
00717     case '9':
00718       if (digit_optind != 0 && digit_optind != this_option_optind)
00719         printf ("digits occur in two different argv-elements.\n");
00720       digit_optind = this_option_optind;
00721       printf ("option %c\n", c);
00722       break;
00723
00724     case 'a':
00725       printf ("option a\n");
00726       break;
00727
00728     case 'b':
00729       printf ("option b\n");
00730       break;
00731
00732     case 'c':
00733       printf ("option c with value `%s'\n", optarg);
00734       break;
00735
00736     case '?':
00737       break;
00738
00739     default:
00740       printf ("?? getopt returned character code 0%o ??\n", c);
00741     }
00742     }
00743
00744   if (optind < argc)
00745     {
00746       printf ("non-option ARGV-elements: ");
00747       while (optind < argc)
00748     printf ("%s ", argv[optind++]);
00749       printf ("\n");
00750     }
00751
00752   exit (0);
00753 }
00754
00755 #endif /* TEST */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getopt.h File Reference

cvs-1.10/lib/getopt.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | option

Defines

#define | _GETOPT_H 1
#define | no_argument 0
#define | required_argument 1
#define | optional_argument 2

Functions

int | getopt ()
int | getopt_long ()
int | getopt_long_only ()
int | _getopt_internal ()

Variables

char * | optarg
int | optind
int | opterr
int | optopt

Define Documentation

#define _GETOPT_H 1

Definition at line 15 of file getopt.h.

#define no_argument 0

Definition at line 89 of file getopt.h.

#define optional_argument 2

Definition at line 91 of file getopt.h.

#define required_argument 1

Definition at line 90 of file getopt.h.

Function Documentation

int _getopt_internal ( )

int getopt ( )

int getopt_long ( )

int getopt_long_only ( )

Variable Documentation

char* optarg

Definition at line 27 of file getopt.h.

int opterr

Definition at line 46 of file getopt.h.

int optind

Definition at line 41 of file getopt.h.

int optopt

Definition at line 50 of file getopt.h.

Generated on Sun Oct 21 12:42:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/getopt.h Source File

cvs-1.10/lib/getopt.h

Go to the documentation of this file.
00001 /* Declarations for getopt.
00002    Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify it
00005    under the terms of the GNU General Public License as published by the
00006    Free Software Foundation; either version 2, or (at your option) any
00007    later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #ifndef _GETOPT_H
00015 #define _GETOPT_H 1
00016
00017 #ifdef  __cplusplus
00018 extern "C" {
00019 #endif
00020
00021 /* For communication from `getopt' to the caller.
00022    When `getopt' finds an option that takes an argument,
00023    the argument value is returned here.
00024    Also, when `ordering' is RETURN_IN_ORDER,
00025    each non-option ARGV-element is returned here.  */
00026
00027 extern char *optarg;
00028
00029 /* Index in ARGV of the next element to be scanned.
00030    This is used for communication to and from the caller
00031    and for communication between successive calls to `getopt'.
00032
00033    On entry to `getopt', zero means this is the first call; initialize.
00034
00035    When `getopt' returns EOF, this is the index of the first of the
00036    non-option elements that the caller should itself scan.
00037
00038    Otherwise, `optind' communicates from one call to the next
00039    how much of ARGV has been scanned so far.  */
00040
00041 extern int optind;
00042
00043 /* Callers store zero here to inhibit the error message `getopt' prints
00044    for unrecognized options.  */
00045
00046 extern int opterr;
00047
00048 /* Set to an option character which was unrecognized.  */
00049
00050 extern int optopt;
00051
00052 /* Describe the long-named options requested by the application.
00053    The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
00054    of `struct option' terminated by an element containing a name which is
00055    zero.
00056
00057    The field `has_arg' is:
00058    no_argument      (or 0) if the option does not take an argument,
00059    required_argument    (or 1) if the option requires an argument,
00060    optional_argument    (or 2) if the option takes an optional argument.
00061
00062    If the field `flag' is not NULL, it points to a variable that is set
00063    to the value given in the field `val' when the option is found, but
00064    left unchanged if the option is not found.
00065
00066    To have a long-named option do something other than set an `int' to
00067    a compiled-in constant, such as set a value from `optarg', set the
00068    option's `flag' field to zero and its `val' field to a nonzero
00069    value (the equivalent single-letter option character, if there is
00070    one).  For long options that have a zero `flag' field, `getopt'
00071    returns the contents of the `val' field.  */
00072
00073 struct option
00074 {
00075 #if __STDC__
00076   const char *name;
00077 #else
00078   char *name;
00079 #endif
00080   /* has_arg can't be an enum because some compilers complain about
00081      type mismatches in all the code that assumes it is an int.  */
00082   int has_arg;
00083   int *flag;
00084   int val;
00085 };
00086
00087 /* Names for the values of the `has_arg' field of `struct option'.  */
00088
00089 #define no_argument     0
00090 #define required_argument   1
00091 #define optional_argument   2
00092
00093 #if __STDC__
00094 /* Many other libraries have conflicting prototypes for getopt, with
00095    differences in the consts, in stdlib.h.  We used to try to prototype
00096    it if __GNU_LIBRARY__ but that wasn't problem free either (I'm not sure
00097    exactly why), and there is no particular need to prototype it.
00098    We really shouldn't be trampling on the system's namespace at all by
00099    declaring getopt() but that is a bigger issue.  */
00100 extern int getopt ();
00101
00102 extern int getopt_long (int argc, char *const *argv, const char *shortopts,
00103                 const struct option *longopts, int *longind);
00104 extern int getopt_long_only (int argc, char *const *argv,
00105                  const char *shortopts,
00106                      const struct option *longopts, int *longind);
00107
00108 /* Internal only.  Users should not call this directly.  */
00109 extern int _getopt_internal (int argc, char *const *argv,
00110                  const char *shortopts,
00111                      const struct option *longopts, int *longind,
00112                  int long_only);
00113 #else /* not __STDC__ */
00114 extern int getopt ();
00115 extern int getopt_long ();
00116 extern int getopt_long_only ();
00117
00118 extern int _getopt_internal ();
00119 #endif /* not __STDC__ */
00120
00121 #ifdef  __cplusplus
00122 }
00123 #endif
00124
00125 #endif /* _GETOPT_H */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getopt1.c File Reference

cvs-1.10/lib/getopt1.c File Reference

#include "getopt.h"
#include <stdio.h>

Include dependency graph for getopt1.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | NULL 0

Functions

char * | getenv ()
int | getopt_long (argc, argv, options, long_options, opt_index) int argc

Variables

char ** | argv
char * | options
option * long_options
int * | opt_index

Define Documentation

#define NULL 0

Definition at line 58 of file getopt1.c.

Function Documentation

char* getenv ( )

int getopt_long | ( | argc | ,
 |  | argv | ,
 |  | options | ,
 |  | long_options | ,
 |  | opt_index |
 | ) |

Variable Documentation

char* * argv

Definition at line 80 of file getopt1.c.

struct option* long_options

Definition at line 82 of file getopt1.c.

int* opt_index

Definition at line 83 of file getopt1.c.

char* options

Definition at line 81 of file getopt1.c.

Generated on Sun Oct 21 12:42:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/getopt1.c Source File

cvs-1.10/lib/getopt1.c

Go to the documentation of this file.
00001 /* getopt_long and getopt_long_only entry points for GNU getopt.
00002    Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
00003     Free Software Foundation, Inc.
00004
00005    This program is free software; you can redistribute it and/or modify it
00006    under the terms of the GNU General Public License as published by the
00007    Free Software Foundation; either version 2, or (at your option) any
00008    later version.
00009
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.  */
00014
00015 #ifdef HAVE_CONFIG_H
00016 #if defined (emacs) || defined (CONFIG_BROKETS)
00017 /* We use <config.h> instead of "config.h" so that a compilation
00018    using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
00019    (which it would do because it found this file in $srcdir).  */
00020 #include <config.h>
00021 #else
00022 #include "config.h"
00023 #endif
00024 #endif
00025
00026 #include "getopt.h"
00027
00028 #ifndef __STDC__
00029 /* This is a separate conditional since some stdc systems
00030    reject `defined (const)'.  */
00031 #ifndef const
00032 #define const
00033 #endif
00034 #endif
00035
00036 #include <stdio.h>
00037
00038 /* Comment out all this code if we are using the GNU C Library, and are not
00039    actually compiling the library itself.  This code is part of the GNU C
00040    Library, but also included in many other GNU distributions.  Compiling
00041    and linking in this code is a waste when using the GNU C library
00042    (especially if it is a shared library).  Rather than having every GNU
00043    program understand `configure --with-gnu-libc' and omit the object files,
00044    it is simpler to just do this in the source for each such file.  */
00045
00046 #if defined (_LIBC) || !defined (__GNU_LIBRARY__)
00047
00048
00049 /* This needs to come after some library #include
00050    to get __GNU_LIBRARY__ defined.  */
00051 #ifdef __GNU_LIBRARY__
00052 #include <stdlib.h>
00053 #else
00054 char *getenv ();
00055 #endif
00056
00057 #ifndef NULL
00058 #define NULL 0
00059 #endif
00060
00061 int
00062 getopt_long (argc, argv, options, long_options, opt_index)
00063      int argc;
00064      char *const *argv;
00065      const char *options;
00066      const struct option *long_options;
00067      int *opt_index;
00068 {
00069   return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
00070 }
00071
00072 /* Like getopt_long, but '-' as well as '--' can indicate a long option.
00073    If an option that starts with '-' (not '--') doesn't match a long option,
00074    but does match a short option, it is parsed as a short option
00075    instead.  */
00076
00077 int
00078 getopt_long_only (argc, argv, options, long_options, opt_index)
00079      int argc;
00080      char *const *argv;
00081      const char *options;
00082      const struct option *long_options;
00083      int *opt_index;
00084 {
00085   return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
00086 }
00087
00088
00089 #endif  /* _LIBC or not __GNU_LIBRARY__.  */
00090
00091 #ifdef TEST
00092
00093 #include <stdio.h>
00094
00095 int
00096 main (argc, argv)
00097      int argc;
00098      char **argv;
00099 {
00100   int c;
00101   int digit_optind = 0;
00102
00103   while (1)
00104     {
00105       int this_option_optind = optind ? optind : 1;
00106       int option_index = 0;
00107       static struct option long_options[] =
00108       {
00109     {"add", 1, 0, 0},
00110     {"append", 0, 0, 0},
00111     {"delete", 1, 0, 0},
00112     {"verbose", 0, 0, 0},
00113     {"create", 0, 0, 0},
00114     {"file", 1, 0, 0},
00115     {0, 0, 0, 0}
00116       };
00117
00118       c = getopt_long (argc, argv, "abc:d:0123456789",
00119                long_options, &option_index);
00120       if (c == EOF)
00121     break;
00122
00123       switch (c)
00124     {
00125     case 0:
00126       printf ("option %s", long_options[option_index].name);
00127       if (optarg)
00128         printf (" with arg %s", optarg);
00129       printf ("\n");
00130       break;
00131
00132     case '0':
00133     case '1':
00134     case '2':
00135     case '3':
00136     case '4':
00137     case '5':
00138     case '6':
00139     case '7':
00140     case '8':
00141     case '9':
00142       if (digit_optind != 0 && digit_optind != this_option_optind)
00143         printf ("digits occur in two different argv-elements.\n");
00144       digit_optind = this_option_optind;
00145       printf ("option %c\n", c);
00146       break;
00147
00148     case 'a':
00149       printf ("option a\n");
00150       break;
00151
00152     case 'b':
00153       printf ("option b\n");
00154       break;
00155
00156     case 'c':
00157       printf ("option c with value `%s'\n", optarg);
00158       break;
00159
00160     case 'd':
00161       printf ("option d with value `%s'\n", optarg);
00162       break;
00163
00164     case '?':
00165       break;
00166
00167     default:
00168       printf ("?? getopt returned character code 0%o ??\n", c);
00169     }
00170     }
00171
00172   if (optind < argc)
00173     {
00174       printf ("non-option ARGV-elements: ");
00175       while (optind < argc)
00176     printf ("%s ", argv[optind++]);
00177       printf ("\n");
00178     }
00179
00180   exit (0);
00181 }
00182
00183 #endif /* TEST */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/hostname.c Source File

cvs-1.10/lib/hostname.c

Go to the documentation of this file.
00001 /* hostname.c -- use uname() to get the name of the host
00002    Copyright (C) 1992 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #ifdef HAVE_CONFIG_H
00015 #include "config.h"
00016 #endif
00017
00018 #if defined(STDC_HEADERS) || defined(USG)
00019 #include <string.h>
00020 #ifndef index
00021 #define index strchr
00022 #endif
00023 #else
00024 #include <strings.h>
00025 #endif
00026
00027 #include <sys/utsname.h>
00028
00029 /* Put this host's name into NAME, using at most NAMELEN characters */
00030
00031 int
00032 gethostname(name, namelen)
00033      char *name;
00034      int namelen;
00035 {
00036   struct utsname ugnm;
00037
00038   if (uname(&ugnm) < 0)
00039     return (-1);
00040
00041   (void) strncpy(name, ugnm.nodename, namelen-1);
00042   name[namelen-1] = '\0';
00043
00044   return (0);
00045 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/md5.c Source File

cvs-1.10/lib/md5.c

Go to the documentation of this file.
00001 /*
00002  * This code implements the MD5 message-digest algorithm.
00003  * The algorithm is due to Ron Rivest.  This code was
00004  * written by Colin Plumb in 1993, no copyright is claimed.
00005  * This code is in the public domain; do with it what you wish.
00006  *
00007  * Equivalent code is available from RSA Data Security, Inc.
00008  * This code has been tested against that, and is equivalent,
00009  * except that you don't need to include two pages of legalese
00010  * with every copy.
00011  *
00012  * To compute the message digest of a chunk of bytes, declare an
00013  * MD5Context structure, pass it to MD5Init, call MD5Update as
00014  * needed on buffers full of bytes, and then call MD5Final, which
00015  * will fill a supplied 16-byte array with the digest.
00016  */
00017
00018 /* This code was modified in 1997 by Jim Kingdon of Cyclic Software to
00019    not require an integer type which is exactly 32 bits.  This work
00020    draws on the changes for the same purpose by Tatu Ylonen
00021    <ylo@cs.hut.fi> as part of SSH, but since I didn't actually use
00022    that code, there is no copyright issue.  I hereby disclaim
00023    copyright in any changes I have made; this code remains in the
00024    public domain.  */
00025
00026 /* Note regarding cvs_* namespace: this avoids potential conflicts
00027    with libraries such as some versions of Kerberos.  No particular
00028    need to worry about whether the system supplies an MD5 library, as
00029    this file is only about 3k of object code.  */
00030
00031 #ifdef HAVE_CONFIG_H
00032 #include "config.h"
00033 #endif
00034
00035 #include <string.h> /* for memcpy() and memset() */
00036
00037 /* Add prototype support.  */
00038 #ifndef PROTO
00039 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
00040 #define PROTO(ARGS) ARGS
00041 #else
00042 #define PROTO(ARGS) ()
00043 #endif
00044 #endif
00045
00046 #include "md5.h"
00047
00048 /* Little-endian byte-swapping routines.  Note that these do not
00049    depend on the size of datatypes such as cvs_uint32, nor do they require
00050    us to detect the endianness of the machine we are running on.  It
00051    is possible they should be macros for speed, but I would be
00052    surprised if they were a performance bottleneck for MD5.  */
00053
00054 static cvs_uint32
00055 getu32 (addr)
00056      const unsigned char *addr;
00057 {
00058     return (((((unsigned long)addr[3] << 8) | addr[2]) << 8)
00059         | addr[1]) << 8 | addr[0];
00060 }
00061
00062 static void
00063 putu32 (data, addr)
00064      cvs_uint32 data;
00065      unsigned char *addr;
00066 {
00067     addr[0] = (unsigned char)data;
00068     addr[1] = (unsigned char)(data >> 8);
00069     addr[2] = (unsigned char)(data >> 16);
00070     addr[3] = (unsigned char)(data >> 24);
00071 }
00072
00073 /*
00074  * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
00075  * initialization constants.
00076  */
00077 void
00078 cvs_MD5Init (ctx)
00079      struct cvs_MD5Context *ctx;
00080 {
00081     ctx->buf[0] = 0x67452301;
00082     ctx->buf[1] = 0xefcdab89;
00083     ctx->buf[2] = 0x98badcfe;
00084     ctx->buf[3] = 0x10325476;
00085
00086     ctx->bits[0] = 0;
00087     ctx->bits[1] = 0;
00088 }
00089
00090 /*
00091  * Update context to reflect the concatenation of another buffer full
00092  * of bytes.
00093  */
00094 void
00095 cvs_MD5Update (ctx, buf, len)
00096      struct cvs_MD5Context *ctx;
00097      unsigned char const *buf;
00098      unsigned len;
00099 {
00100     cvs_uint32 t;
00101
00102     /* Update bitcount */
00103
00104     t = ctx->bits[0];
00105     if ((ctx->bits[0] = (t + ((cvs_uint32)len << 3)) & 0xffffffff) < t)
00106         ctx->bits[1]++; /* Carry from low to high */
00107     ctx->bits[1] += len >> 29;
00108
00109     t = (t >> 3) & 0x3f;    /* Bytes already in shsInfo->data */
00110
00111     /* Handle any leading odd-sized chunks */
00112
00113     if ( t ) {
00114         unsigned char *p = ctx->in + t;
00115
00116         t = 64-t;
00117         if (len < t) {
00118             memcpy(p, buf, len);
00119             return;
00120         }
00121         memcpy(p, buf, t);
00122         cvs_MD5Transform (ctx->buf, ctx->in);
00123         buf += t;
00124         len -= t;
00125     }
00126
00127     /* Process data in 64-byte chunks */
00128
00129     while (len >= 64) {
00130         memcpy(ctx->in, buf, 64);
00131         cvs_MD5Transform (ctx->buf, ctx->in);
00132         buf += 64;
00133         len -= 64;
00134     }
00135
00136     /* Handle any remaining bytes of data. */
00137
00138     memcpy(ctx->in, buf, len);
00139 }
00140
00141 /*
00142  * Final wrapup - pad to 64-byte boundary with the bit pattern
00143  * 1 0* (64-bit count of bits processed, MSB-first)
00144  */
00145 void
00146 cvs_MD5Final (digest, ctx)
00147      unsigned char digest[16];
00148      struct cvs_MD5Context *ctx;
00149 {
00150     unsigned count;
00151     unsigned char *p;
00152
00153     /* Compute number of bytes mod 64 */
00154     count = (ctx->bits[0] >> 3) & 0x3F;
00155
00156     /* Set the first char of padding to 0x80.  This is safe since there is
00157        always at least one byte free */
00158     p = ctx->in + count;
00159     *p++ = 0x80;
00160
00161     /* Bytes of padding needed to make 64 bytes */
00162     count = 64 - 1 - count;
00163
00164     /* Pad out to 56 mod 64 */
00165     if (count < 8) {
00166         /* Two lots of padding:  Pad the first block to 64 bytes */
00167         memset(p, 0, count);
00168         cvs_MD5Transform (ctx->buf, ctx->in);
00169
00170         /* Now fill the next block with 56 bytes */
00171         memset(ctx->in, 0, 56);
00172     } else {
00173         /* Pad block to 56 bytes */
00174         memset(p, 0, count-8);
00175     }
00176
00177     /* Append length in bits and transform */
00178     putu32(ctx->bits[0], ctx->in + 56);
00179     putu32(ctx->bits[1], ctx->in + 60);
00180
00181     cvs_MD5Transform (ctx->buf, ctx->in);
00182     putu32(ctx->buf[0], digest);
00183     putu32(ctx->buf[1], digest + 4);
00184     putu32(ctx->buf[2], digest + 8);
00185     putu32(ctx->buf[3], digest + 12);
00186     memset(ctx, 0, sizeof(ctx));    /* In case it's sensitive */
00187 }
00188
00189 #ifndef ASM_MD5
00190
00191 /* The four core functions - F1 is optimized somewhat */
00192
00193 /* #define F1(x, y, z) (x & y | ~x & z) */
00194 #define F1(x, y, z) (z ^ (x & (y ^ z)))
00195 #define F2(x, y, z) F1(z, x, y)
00196 #define F3(x, y, z) (x ^ y ^ z)
00197 #define F4(x, y, z) (y ^ (x | ~z))
00198
00199 /* This is the central step in the MD5 algorithm. */
00200 #define MD5STEP(f, w, x, y, z, data, s) \
00201     ( w += f(x, y, z) + data, w &= 0xffffffff, w = w<<s | w>>(32-s), w += x )
00202
00203 /*
00204  * The core of the MD5 algorithm, this alters an existing MD5 hash to
00205  * reflect the addition of 16 longwords of new data.  MD5Update blocks
00206  * the data and converts bytes into longwords for this routine.
00207  */
00208 void
00209 cvs_MD5Transform (buf, inraw)
00210      cvs_uint32 buf[4];
00211      const unsigned char inraw[64];
00212 {
00213     register cvs_uint32 a, b, c, d;
00214     cvs_uint32 in[16];
00215     int i;
00216
00217     for (i = 0; i < 16; ++i)
00218         in[i] = getu32 (inraw + 4 * i);
00219
00220     a = buf[0];
00221     b = buf[1];
00222     c = buf[2];
00223     d = buf[3];
00224
00225     MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478,  7);
00226     MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
00227     MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
00228     MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
00229     MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf,  7);
00230     MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
00231     MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
00232     MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
00233     MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8,  7);
00234     MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
00235     MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
00236     MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
00237     MD5STEP(F1, a, b, c, d, in[12]+0x6b901122,  7);
00238     MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
00239     MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
00240     MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
00241
00242     MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562,  5);
00243     MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340,  9);
00244     MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
00245     MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
00246     MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d,  5);
00247     MD5STEP(F2, d, a, b, c, in[10]+0x02441453,  9);
00248     MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
00249     MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
00250     MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6,  5);
00251     MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6,  9);
00252     MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
00253     MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
00254     MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905,  5);
00255     MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8,  9);
00256     MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
00257     MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
00258
00259     MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942,  4);
00260     MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
00261     MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
00262     MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
00263     MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44,  4);
00264     MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
00265     MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
00266     MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
00267     MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6,  4);
00268     MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
00269     MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
00270     MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
00271     MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039,  4);
00272     MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
00273     MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
00274     MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
00275
00276     MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244,  6);
00277     MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
00278     MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
00279     MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
00280     MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3,  6);
00281     MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
00282     MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
00283     MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
00284     MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f,  6);
00285     MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
00286     MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
00287     MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
00288     MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82,  6);
00289     MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
00290     MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
00291     MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
00292
00293     buf[0] += a;
00294     buf[1] += b;
00295     buf[2] += c;
00296     buf[3] += d;
00297 }
00298 #endif
00299
00300 #ifdef TEST
00301 /* Simple test program.  Can use it to manually run the tests from
00302    RFC1321 for example.  */
00303 #include <stdio.h>
00304
00305 int
00306 main (int argc, char **argv)
00307 {
00308     struct cvs_MD5Context context;
00309     unsigned char checksum[16];
00310     int i;
00311     int j;
00312
00313     if (argc < 2)
00314     {
00315         fprintf (stderr, "usage: %s string-to-hash\n", argv[0]);
00316         exit (1);
00317     }
00318     for (j = 1; j < argc; ++j)
00319     {
00320         printf ("MD5 (\"%s\") = ", argv[j]);
00321         cvs_MD5Init (&context);
00322         cvs_MD5Update (&context, argv[j], strlen (argv[j]));
00323         cvs_MD5Final (checksum, &context);
00324         for (i = 0; i < 16; i++)
00325         {
00326             printf ("%02x", (unsigned int) checksum[i]);
00327         }
00328         printf ("\n");
00329     }
00330     return 0;
00331 }
00332 #endif /* TEST */
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/md5.h Source File

cvs-1.10/lib/md5.h

Go to the documentation of this file.
00001 /* See md5.c for explanation and copyright information.  */
00002
00003 #ifndef MD5_H
00004 #define MD5_H
00005
00006 /* Unlike previous versions of this code, uint32 need not be exactly
00007    32 bits, merely 32 bits or more.  Choosing a data type which is 32
00008    bits instead of 64 is not important; speed is considerably more
00009    important.  ANSI guarantees that "unsigned long" will be big enough,
00010    and always using it seems to have few disadvantages.  */
00011 typedef unsigned long cvs_uint32;
00012
00013 struct cvs_MD5Context {
00014     cvs_uint32 buf[4];
00015     cvs_uint32 bits[2];
00016     unsigned char in[64];
00017 };
00018
00019 void cvs_MD5Init PROTO ((struct cvs_MD5Context *context));
00020 void cvs_MD5Update PROTO ((struct cvs_MD5Context *context,
00021                unsigned char const *buf, unsigned len));
00022 void cvs_MD5Final PROTO ((unsigned char digest[16],
00023               struct cvs_MD5Context *context));
00024 void cvs_MD5Transform PROTO ((cvs_uint32 buf[4], const unsigned char in[64]));
00025
00026 #endif /* !MD5_H */
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/memmove.c Source File

cvs-1.10/lib/memmove.c

Go to the documentation of this file.
00001 /* memmove -- copy memory regions of arbitary length
00002    Copyright (C) 1991 Free Software Foundation, Inc.
00003
00004 This file is part of the libiberty library.
00005 Libiberty is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Library General Public
00007 License as published by the Free Software Foundation; either
00008 version 2 of the License, or (at your option) any later version.
00009
00010 Libiberty is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Library General Public License for more details.
00014
00015 */
00016
00017
00018 /*
00019
00020 NAME
00021
00022     memmove -- copy memory regions of arbitary length
00023
00024 SYNOPSIS
00025
00026     void memmove (void *out, const void *in, size_t n);
00027
00028 DESCRIPTION
00029
00030     Copy LENGTH bytes from memory region pointed to by IN to memory
00031     region pointed to by OUT.
00032
00033     Regions can be overlapping.
00034 */
00035
00036 #ifdef HAVE_CONFIG_H
00037 #include "config.h"
00038 #endif
00039
00040 #ifdef __STDC__
00041 #include <stddef.h>
00042 #else
00043 #define size_t unsigned long
00044 #endif
00045
00046 void *
00047 memmove (out, in, length)
00048      void *out;
00049      const void* in;
00050      size_t length;
00051 {
00052     bcopy(in, out, length);
00053     return out;
00054 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


hostname.c File Reference

cvs-1.10/lib/hostname.c File Reference

#include <strings.h>
#include <sys/utsname.h>

Include dependency graph for hostname.c:

Include dependency graph

Go to the source code of this file.

Functions

int | gethostname (name, namelen) char *name

Variables

int | namelen

Function Documentation

int gethostname | ( | name | ,
 |  | namelen |
 | ) |

Variable Documentation

int namelen

Definition at line 34 of file hostname.c.

Generated on Sun Oct 21 12:43:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


md5.c File Reference

cvs-1.10/lib/md5.c File Reference

#include <string.h>
#include "md5.h"

Include dependency graph for md5.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | PROTO(ARGS) ()
#define | F1(x, y, z) (z ^ (x & (y ^ z)))
#define | F2(x, y, z) F1(z, x, y)
#define | F3(x, y, z) (x ^ y ^ z)
#define | F4(x, y, z) (y ^ (x | ~z))
#define | MD5STEP(f, w, x, y, z, data, s) ( w += f(x, y, z) + data, w &= 0xffffffff, w = w<<s | w>>(32-s), w += x )

Functions

cvs_uint32 | getu32 (addr) const unsigned char *addr

Variables

unsigned char * | addr
unsigned char const * | buf
unsigned | len
cvs_MD5Context * ctx
const unsigned char | inraw [64]

Define Documentation

#define F1 | ( | x,
 |  | y,
 |  | z | ) | (z ^ (x & (y ^ z)))

#define F2 | ( | x,
 |  | y,
 |  | z | ) | F1(z, x, y)

#define F3 | ( | x,
 |  | y,
 |  | z | ) | (x ^ y ^ z)

#define F4 | ( | x,
 |  | y,
 |  | z | ) | (y ^ (x | ~z))

#define MD5STEP | ( | f,
 |  | w,
 |  | x,
 |  | y,
 |  | z,
 |  | data,
 |  | s | ) | ( w += f(x, y, z) + data, w &= 0xffffffff, w = w<<s | w>>(32-s), w += x )

#define PROTO ( ARGS ) ()

Definition at line 42 of file md5.c.

Referenced by call_diff_file_callbacks().

Function Documentation

cvs_uint32 getu32 ( addr ) const [static]

Variable Documentation

unsigned char* addr

Definition at line 65 of file md5.c.

unsigned char const* buf

Definition at line 97 of file md5.c.

struct cvs_MD5Context* ctx

Definition at line 148 of file md5.c.

const unsigned char inraw[64]

Definition at line 211 of file md5.c.

unsigned len

Definition at line 98 of file md5.c.

Generated on Sun Oct 21 12:43:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


md5.h File Reference

cvs-1.10/lib/md5.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | cvs_MD5Context

Typedefs

typedef unsigned long | cvs_uint32

Functions

void cvs_MD5Init | PROTO ((struct cvs_MD5Context *context))
void cvs_MD5Update | PROTO ((struct cvs_MD5Context *context, unsigned char const *buf, unsigned len))
void cvs_MD5Final | PROTO ((unsigned char digest[16], struct cvs_MD5Context *context))
void cvs_MD5Transform | PROTO ((cvs_uint32 buf[4], const unsigned char in[64]))

Typedef Documentation

typedef unsigned long cvs_uint32

Definition at line 11 of file md5.h.

Function Documentation

void cvs_MD5Transform PROTO ( (cvs_uint32 buf[4], const unsigned char in[64]) )

void cvs_MD5Final PROTO ( (unsigned char digest[16], struct cvs_MD5Context *context) )

void cvs_MD5Update PROTO ( (struct cvs_MD5Context *context, unsigned char const *buf, unsigned len) )

void cvs_MD5Init PROTO ( (struct cvs_MD5Context *context) )

Generated on Sun Oct 21 12:43:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


memmove.c File Reference

cvs-1.10/lib/memmove.c File Reference

Go to the source code of this file.

Defines

#define | size_t unsigned long

Functions

void * | memmove (out, in, length) void *out

Variables

const void * | in
unsigned long | length

Define Documentation

#define size_t unsigned long

Definition at line 43 of file memmove.c.

Function Documentation

void* memmove | ( | out | ,
 |  | in | ,
 |  | length |
 | ) |

Referenced by GetMenuTitle(), and MacBinMaps::RemoveEntry().

Variable Documentation

const void* in

Definition at line 49 of file memmove.c.

unsigned long length

Definition at line 50 of file memmove.c.

Referenced by CWinLogBranchData::GetBoundsSelf(), CWinLogTagData::GetBoundsSelf(), CMainFrame::OnClose(), CBrowseFileView::ProcessSelectionCommand(), PCPStr::SizeOf(), CWinLogBranchData::UpdateSelf(), CWinLogTagData::UpdateSelf(), and UStr::endsWith().

Generated on Sun Oct 21 12:43:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


mkdir.c File Reference

cvs-1.10/lib/mkdir.c File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>

Include dependency graph for mkdir.c:

Include dependency graph

Go to the source code of this file.

Functions

int | mkdir (dpath, dmode) char *dpath

Variables

int | errno
int | dmode

Function Documentation

int mkdir | ( | dpath | ,
 |  | dmode |
 | ) |

Variable Documentation

int dmode

Definition at line 41 of file mkdir.c.

int errno

Definition at line 22 of file mkdir.c.

Generated on Sun Oct 21 12:43:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/mkdir.c Source File

cvs-1.10/lib/mkdir.c

Go to the documentation of this file.
00001 /* mkrmdir.c -- BSD compatible directory functions for System V
00002    Copyright (C) 1988, 1990 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #ifdef HAVE_CONFIG_H
00015 #include "config.h"
00016 #endif
00017
00018 #include <sys/types.h>
00019 #include <sys/stat.h>
00020 #include <errno.h>
00021 #ifndef STDC_HEADERS
00022 extern int errno;
00023 #endif
00024
00025 /* mkdir and rmdir adapted from GNU tar. */
00026
00027 /* Make directory DPATH, with permission mode DMODE.
00028
00029    Written by Robert Rother, Mariah Corporation, August 1985
00030    (sdcsvax!rmr or rmr@uscd).  If you want it, it's yours.
00031
00032    Severely hacked over by John Gilmore to make a 4.2BSD compatible
00033    subroutine.  11Mar86; hoptoad!gnu
00034
00035    Modified by rmtodd@uokmax 6-28-87 -- when making an already existing dir,
00036    subroutine didn't return EEXIST.  It does now. */
00037
00038 int
00039 mkdir (dpath, dmode)
00040      char *dpath;
00041      int dmode;
00042 {
00043   int cpid, status;
00044   struct stat statbuf;
00045
00046   if (stat (dpath, &statbuf) == 0)
00047     {
00048       errno = EEXIST;       /* stat worked, so it already exists. */
00049       return -1;
00050     }
00051
00052   /* If stat fails for a reason other than non-existence, return error. */
00053   if (! existence_error (errno))
00054     return -1;
00055
00056   cpid = fork ();
00057   switch (cpid)
00058     {
00059     case -1:            /* Cannot fork. */
00060       return -1;        /* errno is set already. */
00061
00062     case 0:         /* Child process. */
00063       /* Cheap hack to set mode of new directory.  Since this child
00064      process is going away anyway, we zap its umask.
00065      This won't suffice to set SUID, SGID, etc. on this
00066      directory, so the parent process calls chmod afterward. */
00067       status = umask (0);   /* Get current umask. */
00068       umask (status | (0777 & ~dmode)); /* Set for mkdir. */
00069       execl ("/bin/mkdir", "mkdir", dpath, (char *) 0);
00070       _exit (1);
00071
00072     default:            /* Parent process. */
00073       while (wait (&status) != cpid) /* Wait for kid to finish. */
00074     /* Do nothing. */ ;
00075
00076       if (status & 0xFFFF)
00077     {
00078       errno = EIO;      /* /bin/mkdir failed. */
00079       return -1;
00080     }
00081       return chmod (dpath, dmode);
00082     }
00083 }
00084
00085 /* Remove directory DPATH.
00086    Return 0 if successful, -1 if not. */
00087
00088 int
00089 rmdir (dpath)
00090      char *dpath;
00091 {
00092   int cpid, status;
00093   struct stat statbuf;
00094
00095   if (stat (dpath, &statbuf) != 0)
00096     return -1;          /* stat set errno. */
00097
00098   if ((statbuf.st_mode & S_IFMT) != S_IFDIR)
00099     {
00100       errno = ENOTDIR;
00101       return -1;
00102     }
00103
00104   cpid = fork ();
00105   switch (cpid)
00106     {
00107     case -1:            /* Cannot fork. */
00108       return -1;        /* errno is set already. */
00109
00110     case 0:         /* Child process. */
00111       execl ("/bin/rmdir", "rmdir", dpath, (char *) 0);
00112       _exit (1);
00113
00114     default:            /* Parent process. */
00115       while (wait (&status) != cpid) /* Wait for kid to finish. */
00116     /* Do nothing. */ ;
00117
00118       if (status & 0xFFFF)
00119     {
00120       errno = EIO;      /* /bin/rmdir failed. */
00121       return -1;
00122     }
00123       return 0;
00124     }
00125 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/regex.c Source File

cvs-1.10/lib/regex.c

Go to the documentation of this file.
00001 /* Extended regular expression matching and search library, version
00002    0.12.  (Implements POSIX draft P10003.2/D11.2, except for
00003    internationalization features.)
00004
00005    Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
00006
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2, or (at your option)
00010    any later version.
00011
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00020    USA.  */
00021
00022 /* AIX requires this to be the first thing in the file. */
00023 #if defined (_AIX) && !defined (REGEX_MALLOC)
00024   #pragma alloca
00025 #endif
00026
00027 #undef  _GNU_SOURCE
00028 #define _GNU_SOURCE
00029
00030 #ifdef emacs
00031 /* Converts the pointer to the char to BEG-based offset from the start.  */
00032 #define PTR_TO_OFFSET(d)                        \
00033     POS_AS_IN_BUFFER (MATCHING_IN_FIRST_STRING          \
00034               ? (d) - string1 : (d) - (string2 - size1))
00035 #define POS_AS_IN_BUFFER(p) ((p) + (NILP (re_match_object) || BUFFERP (re_match_object)))
00036 #else
00037 #define PTR_TO_OFFSET(d) 0
00038 #endif
00039
00040 #ifdef HAVE_CONFIG_H
00041 #include <config.h>
00042 #endif
00043
00044 /* We need this for `regex.h', and perhaps for the Emacs include files.  */
00045 #include <sys/types.h>
00046
00047 /* This is for other GNU distributions with internationalized messages.  */
00048 #if HAVE_LIBINTL_H || defined (_LIBC)
00049 # include <libintl.h>
00050 #else
00051 # define gettext(msgid) (msgid)
00052 #endif
00053
00054 #ifndef gettext_noop
00055 /* This define is so xgettext can find the internationalizable
00056    strings.  */
00057 #define gettext_noop(String) String
00058 #endif
00059
00060 /* The `emacs' switch turns on certain matching commands
00061    that make sense only in Emacs. */
00062 #ifdef emacs
00063
00064 #include "lisp.h"
00065 #include "buffer.h"
00066
00067 /* Make syntax table lookup grant data in gl_state.  */
00068 #define SYNTAX_ENTRY_VIA_PROPERTY
00069
00070 #include "syntax.h"
00071 #include "charset.h"
00072 #include "category.h"
00073
00074 #define malloc xmalloc
00075 #define realloc xrealloc
00076 #define free xfree
00077
00078 #else  /* not emacs */
00079
00080 /* If we are not linking with Emacs proper,
00081    we can't use the relocating allocator
00082    even if config.h says that we can.  */
00083 #undef REL_ALLOC
00084
00085 #if defined (STDC_HEADERS) || defined (_LIBC)
00086 #include <stdlib.h>
00087 #else
00088 char *malloc ();
00089 char *realloc ();
00090 #endif
00091
00092 /* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
00093    If nothing else has been done, use the method below.  */
00094 #ifdef INHIBIT_STRING_HEADER
00095 #if !(defined (HAVE_BZERO) && defined (HAVE_BCOPY))
00096 #if !defined (bzero) && !defined (bcopy)
00097 #undef INHIBIT_STRING_HEADER
00098 #endif
00099 #endif
00100 #endif
00101
00102 /* This is the normal way of making sure we have a bcopy and a bzero.
00103    This is used in most programs--a few other programs avoid this
00104    by defining INHIBIT_STRING_HEADER.  */
00105 #ifndef INHIBIT_STRING_HEADER
00106 #if defined (HAVE_STRING_H) || defined (STDC_HEADERS) || defined (_LIBC)
00107 #include <string.h>
00108 #ifndef bcmp
00109 #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
00110 #endif
00111 #ifndef bcopy
00112 #define bcopy(s, d, n)  memcpy ((d), (s), (n))
00113 #endif
00114 #ifndef bzero
00115 #define bzero(s, n) memset ((s), 0, (n))
00116 #endif
00117 #else
00118 #include <strings.h>
00119 #endif
00120 #endif
00121
00122 /* Define the syntax stuff for <, >, etc.  */
00123
00124 /* This must be nonzero for the wordchar and notwordchar pattern
00125    commands in re_match_2.  */
00126 #ifndef Sword
00127 #define Sword 1
00128 #endif
00129
00130 #ifdef SWITCH_ENUM_BUG
00131 #define SWITCH_ENUM_CAST(x) ((int)(x))
00132 #else
00133 #define SWITCH_ENUM_CAST(x) (x)
00134 #endif
00135
00136 #ifdef SYNTAX_TABLE
00137
00138 extern char *re_syntax_table;
00139
00140 #else /* not SYNTAX_TABLE */
00141
00142 /* How many characters in the character set.  */
00143 #define CHAR_SET_SIZE 256
00144
00145 static char re_syntax_table[CHAR_SET_SIZE];
00146
00147 static void
00148 init_syntax_once ()
00149 {
00150    register int c;
00151    static int done = 0;
00152
00153    if (done)
00154      return;
00155
00156    bzero (re_syntax_table, sizeof re_syntax_table);
00157
00158    for (c = 'a'; c <= 'z'; c++)
00159      re_syntax_table[c] = Sword;
00160
00161    for (c = 'A'; c <= 'Z'; c++)
00162      re_syntax_table[c] = Sword;
00163
00164    for (c = '0'; c <= '9'; c++)
00165      re_syntax_table[c] = Sword;
00166
00167    re_syntax_table['_'] = Sword;
00168
00169    done = 1;
00170 }
00171
00172 #endif /* not SYNTAX_TABLE */
00173
00174 #define SYNTAX(c) re_syntax_table[c]
00175
00176 /* Dummy macros for non-Emacs environments.  */
00177 #define BASE_LEADING_CODE_P(c) (0)
00178 #define WORD_BOUNDARY_P(c1, c2) (0)
00179 #define CHAR_HEAD_P(p) (1)
00180 #define SINGLE_BYTE_CHAR_P(c) (1)
00181 #define SAME_CHARSET_P(c1, c2) (1)
00182 #define MULTIBYTE_FORM_LENGTH(p, s) (1)
00183 #define STRING_CHAR(p, s) (*(p))
00184 #define STRING_CHAR_AND_LENGTH(p, s, actual_len) ((actual_len) = 1, *(p))
00185 #define GET_CHAR_AFTER_2(c, p, str1, end1, str2, end2) \
00186   (c = ((p) == (end1) ? *(str2) : *(p)))
00187 #define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \
00188   (c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1)))
00189 #endif /* not emacs */
00190
00191 /* Get the interface, including the syntax bits.  */
00192 #include "regex.h"
00193
00194 /* isalpha etc. are used for the character classes.  */
00195 #include <ctype.h>
00196
00197 /* Jim Meyering writes:
00198
00199    "... Some ctype macros are valid only for character codes that
00200    isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
00201    using /bin/cc or gcc but without giving an ansi option).  So, all
00202    ctype uses should be through macros like ISPRINT...  If
00203    STDC_HEADERS is defined, then autoconf has verified that the ctype
00204    macros don't need to be guarded with references to isascii. ...
00205    Defining isascii to 1 should let any compiler worth its salt
00206    eliminate the && through constant folding."  */
00207
00208 #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
00209 #define ISASCII(c) 1
00210 #else
00211 #define ISASCII(c) isascii(c)
00212 #endif
00213
00214 #ifdef isblank
00215 #define ISBLANK(c) (ISASCII (c) && isblank (c))
00216 #else
00217 #define ISBLANK(c) ((c) == ' ' || (c) == '\t')
00218 #endif
00219 #ifdef isgraph
00220 #define ISGRAPH(c) (ISASCII (c) && isgraph (c))
00221 #else
00222 #define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
00223 #endif
00224
00225 #define ISPRINT(c) (ISASCII (c) && isprint (c))
00226 #define ISDIGIT(c) (ISASCII (c) && isdigit (c))
00227 #define ISALNUM(c) (ISASCII (c) && isalnum (c))
00228 #define ISALPHA(c) (ISASCII (c) && isalpha (c))
00229 #define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
00230 #define ISLOWER(c) (ISASCII (c) && islower (c))
00231 #define ISPUNCT(c) (ISASCII (c) && ispunct (c))
00232 #define ISSPACE(c) (ISASCII (c) && isspace (c))
00233 #define ISUPPER(c) (ISASCII (c) && isupper (c))
00234 #define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
00235
00236 #ifndef NULL
00237 #define NULL (void *)0
00238 #endif
00239
00240 /* We remove any previous definition of `SIGN_EXTEND_CHAR',
00241    since ours (we hope) works properly with all combinations of
00242    machines, compilers, `char' and `unsigned char' argument types.
00243    (Per Bothner suggested the basic approach.)  */
00244 #undef SIGN_EXTEND_CHAR
00245 #if __STDC__
00246 #define SIGN_EXTEND_CHAR(c) ((signed char) (c))
00247 #else  /* not __STDC__ */
00248 /* As in Harbison and Steele.  */
00249 #define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
00250 #endif
00251
00252 /* Should we use malloc or alloca?  If REGEX_MALLOC is not defined, we
00253    use `alloca' instead of `malloc'.  This is because using malloc in
00254    re_search* or re_match* could cause memory leaks when C-g is used in
00255    Emacs; also, malloc is slower and causes storage fragmentation.  On
00256    the other hand, malloc is more portable, and easier to debug.
00257
00258    Because we sometimes use alloca, some routines have to be macros,
00259    not functions -- `alloca'-allocated space disappears at the end of the
00260    function it is called in.  */
00261
00262 #ifdef REGEX_MALLOC
00263
00264 #define REGEX_ALLOCATE malloc
00265 #define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
00266 #define REGEX_FREE free
00267
00268 #else /* not REGEX_MALLOC  */
00269
00270 /* Emacs already defines alloca, sometimes.  */
00271 #ifndef alloca
00272
00273 /* Make alloca work the best possible way.  */
00274 #ifdef __GNUC__
00275 #define alloca __builtin_alloca
00276 #else /* not __GNUC__ */
00277 #if HAVE_ALLOCA_H
00278 #include <alloca.h>
00279 #else /* not __GNUC__ or HAVE_ALLOCA_H */
00280 #if 0 /* It is a bad idea to declare alloca.  We always cast the result.  */
00281 #ifndef _AIX /* Already did AIX, up at the top.  */
00282 char *alloca ();
00283 #endif /* not _AIX */
00284 #endif
00285 #endif /* not HAVE_ALLOCA_H */
00286 #endif /* not __GNUC__ */
00287
00288 #endif /* not alloca */
00289
00290 #define REGEX_ALLOCATE alloca
00291
00292 /* Assumes a `char *destination' variable.  */
00293 #define REGEX_REALLOCATE(source, osize, nsize)              \
00294   (destination = (char *) alloca (nsize),               \
00295    bcopy (source, destination, osize),                  \
00296    destination)
00297
00298 /* No need to do anything to free, after alloca.  */
00299 #define REGEX_FREE(arg) ((void)0) /* Do nothing!  But inhibit gcc warning.  */
00300
00301 #endif /* not REGEX_MALLOC */
00302
00303 /* Define how to allocate the failure stack.  */
00304
00305 #if defined (REL_ALLOC) && defined (REGEX_MALLOC)
00306
00307 #define REGEX_ALLOCATE_STACK(size)              \
00308   r_alloc (&failure_stack_ptr, (size))
00309 #define REGEX_REALLOCATE_STACK(source, osize, nsize)        \
00310   r_re_alloc (&failure_stack_ptr, (nsize))
00311 #define REGEX_FREE_STACK(ptr)                   \
00312   r_alloc_free (&failure_stack_ptr)
00313
00314 #else /* not using relocating allocator */
00315
00316 #ifdef REGEX_MALLOC
00317
00318 #define REGEX_ALLOCATE_STACK malloc
00319 #define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize)
00320 #define REGEX_FREE_STACK free
00321
00322 #else /* not REGEX_MALLOC */
00323
00324 #define REGEX_ALLOCATE_STACK alloca
00325
00326 #define REGEX_REALLOCATE_STACK(source, osize, nsize)            \
00327    REGEX_REALLOCATE (source, osize, nsize)
00328 /* No need to explicitly free anything.  */
00329 #define REGEX_FREE_STACK(arg)
00330
00331 #endif /* not REGEX_MALLOC */
00332 #endif /* not using relocating allocator */
00333
00334
00335 /* True if `size1' is non-NULL and PTR is pointing anywhere inside
00336    `string1' or just past its end.  This works if PTR is NULL, which is
00337    a good thing.  */
00338 #define FIRST_STRING_P(ptr)                 \
00339   (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
00340
00341 /* (Re)Allocate N items of type T using malloc, or fail.  */
00342 #define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
00343 #define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
00344 #define RETALLOC_IF(addr, n, t) \
00345   if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
00346 #define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
00347
00348 #define BYTEWIDTH 8 /* In bits.  */
00349
00350 #define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
00351
00352 #undef MAX
00353 #undef MIN
00354 #define MAX(a, b) ((a) > (b) ? (a) : (b))
00355 #define MIN(a, b) ((a) < (b) ? (a) : (b))
00356
00357 typedef char boolean;
00358 #define false 0
00359 #define true 1
00360
00361 static int re_match_2_internal ();
00362
00363 /* These are the command codes that appear in compiled regular
00364    expressions.  Some opcodes are followed by argument bytes.  A
00365    command code can specify any interpretation whatsoever for its
00366    arguments.  Zero bytes may appear in the compiled regular expression.  */
00367
00368 typedef enum
00369 {
00370   no_op = 0,
00371
00372   /* Succeed right away--no more backtracking.  */
00373   succeed,
00374
00375     /* Followed by one byte giving n, then by n literal bytes.  */
00376   exactn,
00377
00378     /* Matches any (more or less) character.  */
00379   anychar,
00380
00381     /* Matches any one char belonging to specified set.  First
00382        following byte is number of bitmap bytes.  Then come bytes
00383        for a bitmap saying which chars are in.  Bits in each byte
00384        are ordered low-bit-first.  A character is in the set if its
00385        bit is 1.  A character too large to have a bit in the map is
00386        automatically not in the set.  */
00387   charset,
00388
00389     /* Same parameters as charset, but match any character that is
00390        not one of those specified.  */
00391   charset_not,
00392
00393     /* Start remembering the text that is matched, for storing in a
00394        register.  Followed by one byte with the register number, in
00395        the range 0 to one less than the pattern buffer's re_nsub
00396        field.  Then followed by one byte with the number of groups
00397        inner to this one.  (This last has to be part of the
00398        start_memory only because we need it in the on_failure_jump
00399        of re_match_2.)  */
00400   start_memory,
00401
00402     /* Stop remembering the text that is matched and store it in a
00403        memory register.  Followed by one byte with the register
00404        number, in the range 0 to one less than `re_nsub' in the
00405        pattern buffer, and one byte with the number of inner groups,
00406        just like `start_memory'.  (We need the number of inner
00407        groups here because we don't have any easy way of finding the
00408        corresponding start_memory when we're at a stop_memory.)  */
00409   stop_memory,
00410
00411     /* Match a duplicate of something remembered. Followed by one
00412        byte containing the register number.  */
00413   duplicate,
00414
00415     /* Fail unless at beginning of line.  */
00416   begline,
00417
00418     /* Fail unless at end of line.  */
00419   endline,
00420
00421     /* Succeeds if at beginning of buffer (if emacs) or at beginning
00422        of string to be matched (if not).  */
00423   begbuf,
00424
00425     /* Analogously, for end of buffer/string.  */
00426   endbuf,
00427
00428     /* Followed by two byte relative address to which to jump.  */
00429   jump,
00430
00431     /* Same as jump, but marks the end of an alternative.  */
00432   jump_past_alt,
00433
00434     /* Followed by two-byte relative address of place to resume at
00435        in case of failure.  */
00436   on_failure_jump,
00437
00438     /* Like on_failure_jump, but pushes a placeholder instead of the
00439        current string position when executed.  */
00440   on_failure_keep_string_jump,
00441
00442     /* Throw away latest failure point and then jump to following
00443        two-byte relative address.  */
00444   pop_failure_jump,
00445
00446     /* Change to pop_failure_jump if know won't have to backtrack to
00447        match; otherwise change to jump.  This is used to jump
00448        back to the beginning of a repeat.  If what follows this jump
00449        clearly won't match what the repeat does, such that we can be
00450        sure that there is no use backtracking out of repetitions
00451        already matched, then we change it to a pop_failure_jump.
00452        Followed by two-byte address.  */
00453   maybe_pop_jump,
00454
00455     /* Jump to following two-byte address, and push a dummy failure
00456        point. This failure point will be thrown away if an attempt
00457        is made to use it for a failure.  A `+' construct makes this
00458        before the first repeat.  Also used as an intermediary kind
00459        of jump when compiling an alternative.  */
00460   dummy_failure_jump,
00461
00462     /* Push a dummy failure point and continue.  Used at the end of
00463        alternatives.  */
00464   push_dummy_failure,
00465
00466     /* Followed by two-byte relative address and two-byte number n.
00467        After matching N times, jump to the address upon failure.  */
00468   succeed_n,
00469
00470     /* Followed by two-byte relative address, and two-byte number n.
00471        Jump to the address N times, then fail.  */
00472   jump_n,
00473
00474     /* Set the following two-byte relative address to the
00475        subsequent two-byte number.  The address *includes* the two
00476        bytes of number.  */
00477   set_number_at,
00478
00479   wordchar, /* Matches any word-constituent character.  */
00480   notwordchar,  /* Matches any char that is not a word-constituent.  */
00481
00482   wordbeg,  /* Succeeds if at word beginning.  */
00483   wordend,  /* Succeeds if at word end.  */
00484
00485   wordbound,    /* Succeeds if at a word boundary.  */
00486   notwordbound  /* Succeeds if not at a word boundary.  */
00487
00488 #ifdef emacs
00489   ,before_dot,  /* Succeeds if before point.  */
00490   at_dot,   /* Succeeds if at point.  */
00491   after_dot,    /* Succeeds if after point.  */
00492
00493     /* Matches any character whose syntax is specified.  Followed by
00494        a byte which contains a syntax code, e.g., Sword.  */
00495   syntaxspec,
00496
00497     /* Matches any character whose syntax is not that specified.  */
00498   notsyntaxspec,
00499
00500   /* Matches any character whose category-set contains the specified
00501      category.  The operator is followed by a byte which contains a
00502      category code (mnemonic ASCII character).  */
00503   categoryspec,
00504
00505   /* Matches any character whose category-set does not contain the
00506      specified category.  The operator is followed by a byte which
00507      contains the category code (mnemonic ASCII character).  */
00508   notcategoryspec
00509 #endif /* emacs */
00510 } re_opcode_t;
00511
00512 /* Common operations on the compiled pattern.  */
00513
00514 /* Store NUMBER in two contiguous bytes starting at DESTINATION.  */
00515
00516 #define STORE_NUMBER(destination, number)               \
00517   do {                                  \
00518     (destination)[0] = (number) & 0377;                 \
00519     (destination)[1] = (number) >> 8;                   \
00520   } while (0)
00521
00522 /* Same as STORE_NUMBER, except increment DESTINATION to
00523    the byte after where the number is stored.  Therefore, DESTINATION
00524    must be an lvalue.  */
00525
00526 #define STORE_NUMBER_AND_INCR(destination, number)          \
00527   do {                                  \
00528     STORE_NUMBER (destination, number);                 \
00529     (destination) += 2;                         \
00530   } while (0)
00531
00532 /* Put into DESTINATION a number stored in two contiguous bytes starting
00533    at SOURCE.  */
00534
00535 #define EXTRACT_NUMBER(destination, source)             \
00536   do {                                  \
00537     (destination) = *(source) & 0377;                   \
00538     (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8;       \
00539   } while (0)
00540
00541 #ifdef DEBUG
00542 static void
00543 extract_number (dest, source)
00544     int *dest;
00545     unsigned char *source;
00546 {
00547   int temp = SIGN_EXTEND_CHAR (*(source + 1));
00548   *dest = *source & 0377;
00549   *dest += temp << 8;
00550 }
00551
00552 #ifndef EXTRACT_MACROS /* To debug the macros.  */
00553 #undef EXTRACT_NUMBER
00554 #define EXTRACT_NUMBER(dest, src) extract_number (&dest, src)
00555 #endif /* not EXTRACT_MACROS */
00556
00557 #endif /* DEBUG */
00558
00559 /* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
00560    SOURCE must be an lvalue.  */
00561
00562 #define EXTRACT_NUMBER_AND_INCR(destination, source)            \
00563   do {                                  \
00564     EXTRACT_NUMBER (destination, source);               \
00565     (source) += 2;                          \
00566   } while (0)
00567
00568 #ifdef DEBUG
00569 static void
00570 extract_number_and_incr (destination, source)
00571     int *destination;
00572     unsigned char **source;
00573 {
00574   extract_number (destination, *source);
00575   *source += 2;
00576 }
00577
00578 #ifndef EXTRACT_MACROS
00579 #undef EXTRACT_NUMBER_AND_INCR
00580 #define EXTRACT_NUMBER_AND_INCR(dest, src) \
00581   extract_number_and_incr (&dest, &src)
00582 #endif /* not EXTRACT_MACROS */
00583
00584 #endif /* DEBUG */
00585
00586 /* Store a multibyte character in three contiguous bytes starting
00587    DESTINATION, and increment DESTINATION to the byte after where the
00588    character is stored.  Therefore, DESTINATION must be an lvalue.  */
00589
00590 #define STORE_CHARACTER_AND_INCR(destination, character)    \
00591   do {                              \
00592     (destination)[0] = (character) & 0377;          \
00593     (destination)[1] = ((character) >> 8) & 0377;       \
00594     (destination)[2] = (character) >> 16;           \
00595     (destination) += 3;                     \
00596   } while (0)
00597
00598 /* Put into DESTINATION a character stored in three contiguous bytes
00599    starting at SOURCE.  */
00600
00601 #define EXTRACT_CHARACTER(destination, source)  \
00602   do {                      \
00603     (destination) = ((source)[0]        \
00604              | ((source)[1] << 8)   \
00605              | ((source)[2] << 16));    \
00606   } while (0)
00607
00608
00609 /* Macros for charset. */
00610
00611 /* Size of bitmap of charset P in bytes.  P is a start of charset,
00612    i.e. *P is (re_opcode_t) charset or (re_opcode_t) charset_not.  */
00613 #define CHARSET_BITMAP_SIZE(p) ((p)[1] & 0x7F)
00614
00615 /* Nonzero if charset P has range table.  */
00616 #define CHARSET_RANGE_TABLE_EXISTS_P(p)  ((p)[1] & 0x80)
00617
00618 /* Return the address of range table of charset P.  But not the start
00619    of table itself, but the before where the number of ranges is
00620    stored.  `2 +' means to skip re_opcode_t and size of bitmap.  */
00621 #define CHARSET_RANGE_TABLE(p) (&(p)[2 + CHARSET_BITMAP_SIZE (p)])
00622
00623 /* Test if C is listed in the bitmap of charset P.  */
00624 #define CHARSET_LOOKUP_BITMAP(p, c)             \
00625   ((c) < CHARSET_BITMAP_SIZE (p) * BYTEWIDTH            \
00626    && (p)[2 + (c) / BYTEWIDTH] & (1 << ((c) % BYTEWIDTH)))
00627
00628 /* Return the address of end of RANGE_TABLE.  COUNT is number of
00629    ranges (which is a pair of (start, end)) in the RANGE_TABLE.  `* 2'
00630    is start of range and end of range.  `* 3' is size of each start
00631    and end.  */
00632 #define CHARSET_RANGE_TABLE_END(range_table, count) \
00633   ((range_table) + (count) * 2 * 3)
00634
00635 /* Test if C is in RANGE_TABLE.  A flag NOT is negated if C is in.
00636    COUNT is number of ranges in RANGE_TABLE.  */
00637 #define CHARSET_LOOKUP_RANGE_TABLE_RAW(not, c, range_table, count)  \
00638   do                                    \
00639     {                                   \
00640       int range_start, range_end;                   \
00641       unsigned char *p;                         \
00642       unsigned char *range_table_end                    \
00643     = CHARSET_RANGE_TABLE_END ((range_table), (count));     \
00644                                     \
00645       for (p = (range_table); p < range_table_end; p += 2 * 3)      \
00646     {                               \
00647       EXTRACT_CHARACTER (range_start, p);               \
00648       EXTRACT_CHARACTER (range_end, p + 3);             \
00649                                     \
00650       if (range_start <= (c) && (c) <= range_end)           \
00651         {                               \
00652           (not) = !(not);                       \
00653           break;                            \
00654         }                               \
00655     }                               \
00656     }                                   \
00657   while (0)
00658
00659 /* Test if C is in range table of CHARSET.  The flag NOT is negated if
00660    C is listed in it.  */
00661 #define CHARSET_LOOKUP_RANGE_TABLE(not, c, charset)         \
00662   do                                    \
00663     {                                   \
00664       /* Number of ranges in range table. */                \
00665       int count;                            \
00666       unsigned char *range_table = CHARSET_RANGE_TABLE (charset);   \
00667                                     \
00668       EXTRACT_NUMBER_AND_INCR (count, range_table);         \
00669       CHARSET_LOOKUP_RANGE_TABLE_RAW ((not), (c), range_table, count);  \
00670     }                                   \
00671   while (0)
00672
00673 /* If DEBUG is defined, Regex prints many voluminous messages about what
00674    it is doing (if the variable `debug' is nonzero).  If linked with the
00675    main program in `iregex.c', you can enter patterns and strings
00676    interactively.  And if linked with the main program in `main.c' and
00677    the other test files, you can run the already-written tests.  */
00678
00679 #ifdef DEBUG
00680
00681 /* We use standard I/O for debugging.  */
00682 #include <stdio.h>
00683
00684 /* It is useful to test things that ``must'' be true when debugging.  */
00685 #include <assert.h>
00686
00687 static int debug = 0;
00688
00689 #define DEBUG_STATEMENT(e) e
00690 #define DEBUG_PRINT1(x) if (debug) printf (x)
00691 #define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
00692 #define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
00693 #define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
00694 #define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)               \
00695   if (debug) print_partial_compiled_pattern (s, e)
00696 #define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)          \
00697   if (debug) print_double_string (w, s1, sz1, s2, sz2)
00698
00699
00700 /* Print the fastmap in human-readable form.  */
00701
00702 void
00703 print_fastmap (fastmap)
00704     char *fastmap;
00705 {
00706   unsigned was_a_range = 0;
00707   unsigned i = 0;
00708
00709   while (i < (1 << BYTEWIDTH))
00710     {
00711       if (fastmap[i++])
00712     {
00713       was_a_range = 0;
00714       putchar (i - 1);
00715       while (i < (1 << BYTEWIDTH)  &&  fastmap[i])
00716         {
00717           was_a_range = 1;
00718           i++;
00719         }
00720       if (was_a_range)
00721         {
00722           printf ("-");
00723           putchar (i - 1);
00724         }
00725     }
00726     }
00727   putchar ('\n');
00728 }
00729
00730
00731 /* Print a compiled pattern string in human-readable form, starting at
00732    the START pointer into it and ending just before the pointer END.  */
00733
00734 void
00735 print_partial_compiled_pattern (start, end)
00736     unsigned char *start;
00737     unsigned char *end;
00738 {
00739   int mcnt, mcnt2;
00740   unsigned char *p = start;
00741   unsigned char *pend = end;
00742
00743   if (start == NULL)
00744     {
00745       printf ("(null)\n");
00746       return;
00747     }
00748
00749   /* Loop over pattern commands.  */
00750   while (p < pend)
00751     {
00752       printf ("%d:\t", p - start);
00753
00754       switch ((re_opcode_t) *p++)
00755     {
00756     case no_op:
00757       printf ("/no_op");
00758       break;
00759
00760     case exactn:
00761       mcnt = *p++;
00762       printf ("/exactn/%d", mcnt);
00763       do
00764         {
00765           putchar ('/');
00766           putchar (*p++);
00767         }
00768       while (--mcnt);
00769       break;
00770
00771     case start_memory:
00772       mcnt = *p++;
00773       printf ("/start_memory/%d/%d", mcnt, *p++);
00774       break;
00775
00776     case stop_memory:
00777       mcnt = *p++;
00778       printf ("/stop_memory/%d/%d", mcnt, *p++);
00779       break;
00780
00781     case duplicate:
00782       printf ("/duplicate/%d", *p++);
00783       break;
00784
00785     case anychar:
00786       printf ("/anychar");
00787       break;
00788
00789     case charset:
00790     case charset_not:
00791       {
00792         register int c, last = -100;
00793         register int in_range = 0;
00794
00795         printf ("/charset [%s",
00796             (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
00797
00798         assert (p + *p < pend);
00799
00800         for (c = 0; c < 256; c++)
00801           if (c / 8 < *p
00802           && (p[1 + (c/8)] & (1 << (c % 8))))
00803         {
00804           /* Are we starting a range?  */
00805           if (last + 1 == c && ! in_range)
00806             {
00807               putchar ('-');
00808               in_range = 1;
00809             }
00810           /* Have we broken a range?  */
00811           else if (last + 1 != c && in_range)
00812           {
00813               putchar (last);
00814               in_range = 0;
00815             }
00816
00817           if (! in_range)
00818             putchar (c);
00819
00820           last = c;
00821           }
00822
00823         if (in_range)
00824           putchar (last);
00825
00826         putchar (']');
00827
00828         p += 1 + *p;
00829       }
00830       break;
00831
00832     case begline:
00833       printf ("/begline");
00834       break;
00835
00836     case endline:
00837       printf ("/endline");
00838       break;
00839
00840     case on_failure_jump:
00841       extract_number_and_incr (&mcnt, &p);
00842       printf ("/on_failure_jump to %d", p + mcnt - start);
00843       break;
00844
00845     case on_failure_keep_string_jump:
00846       extract_number_and_incr (&mcnt, &p);
00847       printf ("/on_failure_keep_string_jump to %d", p + mcnt - start);
00848       break;
00849
00850     case dummy_failure_jump:
00851       extract_number_and_incr (&mcnt, &p);
00852       printf ("/dummy_failure_jump to %d", p + mcnt - start);
00853       break;
00854
00855     case push_dummy_failure:
00856       printf ("/push_dummy_failure");
00857       break;
00858
00859     case maybe_pop_jump:
00860       extract_number_and_incr (&mcnt, &p);
00861       printf ("/maybe_pop_jump to %d", p + mcnt - start);
00862       break;
00863
00864     case pop_failure_jump:
00865       extract_number_and_incr (&mcnt, &p);
00866       printf ("/pop_failure_jump to %d", p + mcnt - start);
00867       break;
00868
00869     case jump_past_alt:
00870       extract_number_and_incr (&mcnt, &p);
00871       printf ("/jump_past_alt to %d", p + mcnt - start);
00872       break;
00873
00874     case jump:
00875       extract_number_and_incr (&mcnt, &p);
00876       printf ("/jump to %d", p + mcnt - start);
00877       break;
00878
00879     case succeed_n:
00880       extract_number_and_incr (&mcnt, &p);
00881       extract_number_and_incr (&mcnt2, &p);
00882       printf ("/succeed_n to %d, %d times", p + mcnt - start, mcnt2);
00883       break;
00884
00885     case jump_n:
00886       extract_number_and_incr (&mcnt, &p);
00887       extract_number_and_incr (&mcnt2, &p);
00888       printf ("/jump_n to %d, %d times", p + mcnt - start, mcnt2);
00889       break;
00890
00891     case set_number_at:
00892       extract_number_and_incr (&mcnt, &p);
00893       extract_number_and_incr (&mcnt2, &p);
00894       printf ("/set_number_at location %d to %d", p + mcnt - start, mcnt2);
00895       break;
00896
00897     case wordbound:
00898       printf ("/wordbound");
00899       break;
00900
00901     case notwordbound:
00902       printf ("/notwordbound");
00903       break;
00904
00905     case wordbeg:
00906       printf ("/wordbeg");
00907       break;
00908
00909     case wordend:
00910       printf ("/wordend");
00911
00912 #ifdef emacs
00913     case before_dot:
00914       printf ("/before_dot");
00915       break;
00916
00917     case at_dot:
00918       printf ("/at_dot");
00919       break;
00920
00921     case after_dot:
00922       printf ("/after_dot");
00923       break;
00924
00925     case syntaxspec:
00926       printf ("/syntaxspec");
00927       mcnt = *p++;
00928       printf ("/%d", mcnt);
00929       break;
00930
00931     case notsyntaxspec:
00932       printf ("/notsyntaxspec");
00933       mcnt = *p++;
00934       printf ("/%d", mcnt);
00935       break;
00936 #endif /* emacs */
00937
00938     case wordchar:
00939       printf ("/wordchar");
00940       break;
00941
00942     case notwordchar:
00943       printf ("/notwordchar");
00944       break;
00945
00946     case begbuf:
00947       printf ("/begbuf");
00948       break;
00949
00950     case endbuf:
00951       printf ("/endbuf");
00952       break;
00953
00954     default:
00955       printf ("?%d", *(p-1));
00956     }
00957
00958       putchar ('\n');
00959     }
00960
00961   printf ("%d:\tend of pattern.\n", p - start);
00962 }
00963
00964
00965 void
00966 print_compiled_pattern (bufp)
00967     struct re_pattern_buffer *bufp;
00968 {
00969   unsigned char *buffer = bufp->buffer;
00970
00971   print_partial_compiled_pattern (buffer, buffer + bufp->used);
00972   printf ("%d bytes used/%d bytes allocated.\n", bufp->used, bufp->allocated);
00973
00974   if (bufp->fastmap_accurate && bufp->fastmap)
00975     {
00976       printf ("fastmap: ");
00977       print_fastmap (bufp->fastmap);
00978     }
00979
00980   printf ("re_nsub: %d\t", bufp->re_nsub);
00981   printf ("regs_alloc: %d\t", bufp->regs_allocated);
00982   printf ("can_be_null: %d\t", bufp->can_be_null);
00983   printf ("newline_anchor: %d\n", bufp->newline_anchor);
00984   printf ("no_sub: %d\t", bufp->no_sub);
00985   printf ("not_bol: %d\t", bufp->not_bol);
00986   printf ("not_eol: %d\t", bufp->not_eol);
00987   printf ("syntax: %d\n", bufp->syntax);
00988   /* Perhaps we should print the translate table?  */
00989 }
00990
00991
00992 void
00993 print_double_string (where, string1, size1, string2, size2)
00994     const char *where;
00995     const char *string1;
00996     const char *string2;
00997     int size1;
00998     int size2;
00999 {
01000   unsigned this_char;
01001
01002   if (where == NULL)
01003     printf ("(null)");
01004   else
01005     {
01006       if (FIRST_STRING_P (where))
01007     {
01008       for (this_char = where - string1; this_char < size1; this_char++)
01009         putchar (string1[this_char]);
01010
01011       where = string2;
01012     }
01013
01014       for (this_char = where - string2; this_char < size2; this_char++)
01015     putchar (string2[this_char]);
01016     }
01017 }
01018
01019 #else /* not DEBUG */
01020
01021 #undef assert
01022 #define assert(e)
01023
01024 #define DEBUG_STATEMENT(e)
01025 #define DEBUG_PRINT1(x)
01026 #define DEBUG_PRINT2(x1, x2)
01027 #define DEBUG_PRINT3(x1, x2, x3)
01028 #define DEBUG_PRINT4(x1, x2, x3, x4)
01029 #define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
01030 #define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
01031
01032 #endif /* not DEBUG */
01033
01034 /* Set by `re_set_syntax' to the current regexp syntax to recognize.  Can
01035    also be assigned to arbitrarily: each pattern buffer stores its own
01036    syntax, so it can be changed between regex compilations.  */
01037 /* This has no initializer because initialized variables in Emacs
01038    become read-only after dumping.  */
01039 reg_syntax_t re_syntax_options;
01040
01041
01042 /* Specify the precise syntax of regexps for compilation.  This provides
01043    for compatibility for various utilities which historically have
01044    different, incompatible syntaxes.
01045
01046    The argument SYNTAX is a bit mask comprised of the various bits
01047    defined in regex.h.  We return the old syntax.  */
01048
01049 reg_syntax_t
01050 re_set_syntax (syntax)
01051     reg_syntax_t syntax;
01052 {
01053   reg_syntax_t ret = re_syntax_options;
01054
01055   re_syntax_options = syntax;
01056   return ret;
01057 }
01058
01059 /* This table gives an error message for each of the error codes listed
01060    in regex.h.  Obviously the order here has to be same as there.
01061    POSIX doesn't require that we do anything for REG_NOERROR,
01062    but why not be nice?  */
01063
01064 static const char *re_error_msgid[] =
01065   {
01066     gettext_noop ("Success"),   /* REG_NOERROR */
01067     gettext_noop ("No match"),  /* REG_NOMATCH */
01068     gettext_noop ("Invalid regular expression"), /* REG_BADPAT */
01069     gettext_noop ("Invalid collation character"), /* REG_ECOLLATE */
01070     gettext_noop ("Invalid character class name"), /* REG_ECTYPE */
01071     gettext_noop ("Trailing backslash"), /* REG_EESCAPE */
01072     gettext_noop ("Invalid back reference"), /* REG_ESUBREG */
01073     gettext_noop ("Unmatched [ or [^"), /* REG_EBRACK */
01074     gettext_noop ("Unmatched ( or \\("), /* REG_EPAREN */
01075     gettext_noop ("Unmatched \\{"), /* REG_EBRACE */
01076     gettext_noop ("Invalid content of \\{\\}"), /* REG_BADBR */
01077     gettext_noop ("Invalid range end"), /* REG_ERANGE */
01078     gettext_noop ("Memory exhausted"), /* REG_ESPACE */
01079     gettext_noop ("Invalid preceding regular expression"), /* REG_BADRPT */
01080     gettext_noop ("Premature end of regular expression"), /* REG_EEND */
01081     gettext_noop ("Regular expression too big"), /* REG_ESIZE */
01082     gettext_noop ("Unmatched ) or \\)"), /* REG_ERPAREN */
01083   };
01084
01085 /* Avoiding alloca during matching, to placate r_alloc.  */
01086
01087 /* Define MATCH_MAY_ALLOCATE unless we need to make sure that the
01088    searching and matching functions should not call alloca.  On some
01089    systems, alloca is implemented in terms of malloc, and if we're
01090    using the relocating allocator routines, then malloc could cause a
01091    relocation, which might (if the strings being searched are in the
01092    ralloc heap) shift the data out from underneath the regexp
01093    routines.
01094
01095    Here's another reason to avoid allocation: Emacs
01096    processes input from X in a signal handler; processing X input may
01097    call malloc; if input arrives while a matching routine is calling
01098    malloc, then we're scrod.  But Emacs can't just block input while
01099    calling matching routines; then we don't notice interrupts when
01100    they come in.  So, Emacs blocks input around all regexp calls
01101    except the matching calls, which it leaves unprotected, in the
01102    faith that they will not malloc.  */
01103
01104 /* Normally, this is fine.  */
01105 #define MATCH_MAY_ALLOCATE
01106
01107 /* When using GNU C, we are not REALLY using the C alloca, no matter
01108    what config.h may say.  So don't take precautions for it.  */
01109 #ifdef __GNUC__
01110 #undef C_ALLOCA
01111 #endif
01112
01113 /* The match routines may not allocate if (1) they would do it with malloc
01114    and (2) it's not safe for them to use malloc.
01115    Note that if REL_ALLOC is defined, matching would not use malloc for the
01116    failure stack, but we would still use it for the register vectors;
01117    so REL_ALLOC should not affect this.  */
01118 #if (defined (C_ALLOCA) || defined (REGEX_MALLOC)) && defined (emacs)
01119 #undef MATCH_MAY_ALLOCATE
01120 #endif
01121
01122
01123 /* Failure stack declarations and macros; both re_compile_fastmap and
01124    re_match_2 use a failure stack.  These have to be macros because of
01125    REGEX_ALLOCATE_STACK.  */
01126
01127
01128 /* Approximate number of failure points for which to initially allocate space
01129    when matching.  If this number is exceeded, we allocate more
01130    space, so it is not a hard limit.  */
01131 #ifndef INIT_FAILURE_ALLOC
01132 #define INIT_FAILURE_ALLOC 20
01133 #endif
01134
01135 /* Roughly the maximum number of failure points on the stack.  Would be
01136    exactly that if always used TYPICAL_FAILURE_SIZE items each time we failed.
01137    This is a variable only so users of regex can assign to it; we never
01138    change it ourselves.  */
01139 #if defined (MATCH_MAY_ALLOCATE)
01140 /* Note that 4400 is enough to cause a crash on Alpha OSF/1,
01141    whose default stack limit is 2mb.  In order for a larger
01142    value to work reliably, you have to try to make it accord
01143    with the process stack limit.  */
01144 int re_max_failures = 40000;
01145 #else
01146 int re_max_failures = 4000;
01147 #endif
01148
01149 union fail_stack_elt
01150 {
01151   unsigned char *pointer;
01152   int integer;
01153 };
01154
01155 typedef union fail_stack_elt fail_stack_elt_t;
01156
01157 typedef struct
01158 {
01159   fail_stack_elt_t *stack;
01160   unsigned size;
01161   unsigned avail;           /* Offset of next open position.  */
01162 } fail_stack_type;
01163
01164 #define FAIL_STACK_EMPTY()     (fail_stack.avail == 0)
01165 #define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
01166 #define FAIL_STACK_FULL()      (fail_stack.avail == fail_stack.size)
01167
01168
01169 /* Define macros to initialize and free the failure stack.
01170    Do `return -2' if the alloc fails.  */
01171
01172 #ifdef MATCH_MAY_ALLOCATE
01173 #define INIT_FAIL_STACK()                       \
01174   do {                                  \
01175     fail_stack.stack = (fail_stack_elt_t *)             \
01176       REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * TYPICAL_FAILURE_SIZE   \
01177                 * sizeof (fail_stack_elt_t));       \
01178                                     \
01179     if (fail_stack.stack == NULL)                   \
01180       return -2;                            \
01181                                     \
01182     fail_stack.size = INIT_FAILURE_ALLOC;               \
01183     fail_stack.avail = 0;                       \
01184   } while (0)
01185
01186 #define RESET_FAIL_STACK()  REGEX_FREE_STACK (fail_stack.stack)
01187 #else
01188 #define INIT_FAIL_STACK()                       \
01189   do {                                  \
01190     fail_stack.avail = 0;                       \
01191   } while (0)
01192
01193 #define RESET_FAIL_STACK()
01194 #endif
01195
01196
01197 /* Double the size of FAIL_STACK, up to a limit
01198    which allows approximately `re_max_failures' items.
01199
01200    Return 1 if succeeds, and 0 if either ran out of memory
01201    allocating space for it or it was already too large.
01202
01203    REGEX_REALLOCATE_STACK requires `destination' be declared.   */
01204
01205 /* Factor to increase the failure stack size by
01206    when we increase it.
01207    This used to be 2, but 2 was too wasteful
01208    because the old discarded stacks added up to as much space
01209    were as ultimate, maximum-size stack.  */
01210 #define FAIL_STACK_GROWTH_FACTOR 4
01211
01212 #define GROW_FAIL_STACK(fail_stack)                 \
01213   (((fail_stack).size * sizeof (fail_stack_elt_t)           \
01214     >= re_max_failures * TYPICAL_FAILURE_SIZE)              \
01215    ? 0                                  \
01216    : ((fail_stack).stack                        \
01217       = (fail_stack_elt_t *)                        \
01218     REGEX_REALLOCATE_STACK ((fail_stack).stack,         \
01219       (fail_stack).size * sizeof (fail_stack_elt_t),        \
01220       MIN (re_max_failures * TYPICAL_FAILURE_SIZE,          \
01221            ((fail_stack).size * sizeof (fail_stack_elt_t)       \
01222         * FAIL_STACK_GROWTH_FACTOR))),              \
01223                                     \
01224       (fail_stack).stack == NULL                    \
01225       ? 0                               \
01226       : ((fail_stack).size                      \
01227      = (MIN (re_max_failures * TYPICAL_FAILURE_SIZE,        \
01228          ((fail_stack).size * sizeof (fail_stack_elt_t)     \
01229           * FAIL_STACK_GROWTH_FACTOR))              \
01230         / sizeof (fail_stack_elt_t)),               \
01231      1)))
01232
01233
01234 /* Push pointer POINTER on FAIL_STACK.
01235    Return 1 if was able to do so and 0 if ran out of memory allocating
01236    space to do so.  */
01237 #define PUSH_PATTERN_OP(POINTER, FAIL_STACK)                \
01238   ((FAIL_STACK_FULL ()                          \
01239     && !GROW_FAIL_STACK (FAIL_STACK))                   \
01240    ? 0                                  \
01241    : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER,   \
01242       1))
01243
01244 /* Push a pointer value onto the failure stack.
01245    Assumes the variable `fail_stack'.  Probably should only
01246    be called from within `PUSH_FAILURE_POINT'.  */
01247 #define PUSH_FAILURE_POINTER(item)                  \
01248   fail_stack.stack[fail_stack.avail++].pointer = (unsigned char *) (item)
01249
01250 /* This pushes an integer-valued item onto the failure stack.
01251    Assumes the variable `fail_stack'.  Probably should only
01252    be called from within `PUSH_FAILURE_POINT'.  */
01253 #define PUSH_FAILURE_INT(item)                  \
01254   fail_stack.stack[fail_stack.avail++].integer = (item)
01255
01256 /* Push a fail_stack_elt_t value onto the failure stack.
01257    Assumes the variable `fail_stack'.  Probably should only
01258    be called from within `PUSH_FAILURE_POINT'.  */
01259 #define PUSH_FAILURE_ELT(item)                  \
01260   fail_stack.stack[fail_stack.avail++] =  (item)
01261
01262 /* These three POP... operations complement the three PUSH... operations.
01263    All assume that `fail_stack' is nonempty.  */
01264 #define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer
01265 #define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer
01266 #define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail]
01267
01268 /* Used to omit pushing failure point id's when we're not debugging.  */
01269 #ifdef DEBUG
01270 #define DEBUG_PUSH PUSH_FAILURE_INT
01271 #define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_INT ()
01272 #else
01273 #define DEBUG_PUSH(item)
01274 #define DEBUG_POP(item_addr)
01275 #endif
01276
01277
01278 /* Push the information about the state we will need
01279    if we ever fail back to it.
01280
01281    Requires variables fail_stack, regstart, regend, reg_info, and
01282    num_regs be declared.  GROW_FAIL_STACK requires `destination' be
01283    declared.
01284
01285    Does `return FAILURE_CODE' if runs out of memory.  */
01286
01287 #define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code)   \
01288   do {                                  \
01289     char *destination;                          \
01290     /* Must be int, so when we don't save any registers, the arithmetic \
01291        of 0 + -1 isn't done as unsigned.  */                \
01292     int this_reg;                           \
01293                                     \
01294     DEBUG_STATEMENT (failure_id++);                 \
01295     DEBUG_STATEMENT (nfailure_points_pushed++);             \
01296     DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id);       \
01297     DEBUG_PRINT2 ("  Before push, next avail: %d\n", (fail_stack).avail);\
01298     DEBUG_PRINT2 ("         size: %d\n", (fail_stack).size);\
01299                                     \
01300     DEBUG_PRINT2 ("  slots needed: %d\n", NUM_FAILURE_ITEMS);       \
01301     DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS);   \
01302                                     \
01303     /* Ensure we have enough space allocated for what we will push.  */ \
01304     while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS)           \
01305       {                                 \
01306     if (!GROW_FAIL_STACK (fail_stack))              \
01307       return failure_code;                      \
01308                                     \
01309     DEBUG_PRINT2 ("\n  Doubled stack; size now: %d\n",      \
01310                (fail_stack).size);              \
01311     DEBUG_PRINT2 ("  slots available: %d\n", REMAINING_AVAIL_SLOTS);\
01312       }                                 \
01313                                     \
01314     /* Push the info, starting with the registers.  */          \
01315     DEBUG_PRINT1 ("\n");                        \
01316                                     \
01317     if (1)                              \
01318       for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
01319        this_reg++)                          \
01320     {                               \
01321       DEBUG_PRINT2 ("  Pushing reg: %d\n", this_reg);       \
01322       DEBUG_STATEMENT (num_regs_pushed++);              \
01323                                     \
01324       DEBUG_PRINT2 ("    start: 0x%x\n", regstart[this_reg]);   \
01325       PUSH_FAILURE_POINTER (regstart[this_reg]);            \
01326                                     \
01327       DEBUG_PRINT2 ("    end: 0x%x\n", regend[this_reg]);       \
01328       PUSH_FAILURE_POINTER (regend[this_reg]);          \
01329                                     \
01330       DEBUG_PRINT2 ("    info: 0x%x\n      ", reg_info[this_reg]);  \
01331       DEBUG_PRINT2 (" match_null=%d",               \
01332             REG_MATCH_NULL_STRING_P (reg_info[this_reg]));  \
01333       DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg]));  \
01334       DEBUG_PRINT2 (" matched_something=%d",            \
01335             MATCHED_SOMETHING (reg_info[this_reg]));    \
01336       DEBUG_PRINT2 (" ever_matched=%d",             \
01337             EVER_MATCHED_SOMETHING (reg_info[this_reg]));   \
01338       DEBUG_PRINT1 ("\n");                      \
01339       PUSH_FAILURE_ELT (reg_info[this_reg].word);           \
01340     }                               \
01341                                     \
01342     DEBUG_PRINT2 ("  Pushing  low active reg: %d\n", lowest_active_reg);\
01343     PUSH_FAILURE_INT (lowest_active_reg);               \
01344                                     \
01345     DEBUG_PRINT2 ("  Pushing high active reg: %d\n", highest_active_reg);\
01346     PUSH_FAILURE_INT (highest_active_reg);              \
01347                                     \
01348     DEBUG_PRINT2 ("  Pushing pattern 0x%x: ", pattern_place);       \
01349     DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend);       \
01350     PUSH_FAILURE_POINTER (pattern_place);               \
01351                                     \
01352     DEBUG_PRINT2 ("  Pushing string 0x%x: `", string_place);        \
01353     DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2,   \
01354                  size2);                \
01355     DEBUG_PRINT1 ("'\n");                       \
01356     PUSH_FAILURE_POINTER (string_place);                \
01357                                     \
01358     DEBUG_PRINT2 ("  Pushing failure id: %u\n", failure_id);        \
01359     DEBUG_PUSH (failure_id);                        \
01360   } while (0)
01361
01362 /* This is the number of items that are pushed and popped on the stack
01363    for each register.  */
01364 #define NUM_REG_ITEMS  3
01365
01366 /* Individual items aside from the registers.  */
01367 #ifdef DEBUG
01368 #define NUM_NONREG_ITEMS 5 /* Includes failure point id.  */
01369 #else
01370 #define NUM_NONREG_ITEMS 4
01371 #endif
01372
01373 /* Estimate the size of data pushed by a typical failure stack entry.
01374    An estimate is all we need, because all we use this for
01375    is to choose a limit for how big to make the failure stack.  */
01376
01377 #define TYPICAL_FAILURE_SIZE 20
01378
01379 /* This is how many items we actually use for a failure point.
01380    It depends on the regexp.  */
01381 #define NUM_FAILURE_ITEMS               \
01382   (((0                          \
01383      ? 0 : highest_active_reg - lowest_active_reg + 1)  \
01384     * NUM_REG_ITEMS)                    \
01385    + NUM_NONREG_ITEMS)
01386
01387 /* How many items can still be added to the stack without overflowing it.  */
01388 #define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
01389
01390
01391 /* Pops what PUSH_FAIL_STACK pushes.
01392
01393    We restore into the parameters, all of which should be lvalues:
01394      STR -- the saved data position.
01395      PAT -- the saved pattern position.
01396      LOW_REG, HIGH_REG -- the highest and lowest active registers.
01397      REGSTART, REGEND -- arrays of string positions.
01398      REG_INFO -- array of information about each subexpression.
01399
01400    Also assumes the variables `fail_stack' and (if debugging), `bufp',
01401    `pend', `string1', `size1', `string2', and `size2'.  */
01402
01403 #define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
01404 {                                   \
01405   DEBUG_STATEMENT (fail_stack_elt_t failure_id;)            \
01406   int this_reg;                             \
01407   const unsigned char *string_temp;                 \
01408                                     \
01409   assert (!FAIL_STACK_EMPTY ());                    \
01410                                     \
01411   /* Remove failure points and point to how many regs pushed.  */   \
01412   DEBUG_PRINT1 ("POP_FAILURE_POINT:\n");                \
01413   DEBUG_PRINT2 ("  Before pop, next avail: %d\n", fail_stack.avail);    \
01414   DEBUG_PRINT2 ("            size: %d\n", fail_stack.size); \
01415                                     \
01416   assert (fail_stack.avail >= NUM_NONREG_ITEMS);            \
01417                                     \
01418   DEBUG_POP (&failure_id);                      \
01419   DEBUG_PRINT2 ("  Popping failure id: %u\n", failure_id);      \
01420                                     \
01421   /* If the saved string location is NULL, it came from an      \
01422      on_failure_keep_string_jump opcode, and we want to throw away the  \
01423      saved NULL, thus retaining our current position in the string.  */ \
01424   string_temp = POP_FAILURE_POINTER ();                 \
01425   if (string_temp != NULL)                      \
01426     str = (const char *) string_temp;                   \
01427                                     \
01428   DEBUG_PRINT2 ("  Popping string 0x%x: `", str);           \
01429   DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2);  \
01430   DEBUG_PRINT1 ("'\n");                         \
01431                                     \
01432   pat = (unsigned char *) POP_FAILURE_POINTER ();           \
01433   DEBUG_PRINT2 ("  Popping pattern 0x%x: ", pat);           \
01434   DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend);           \
01435                                     \
01436   /* Restore register info.  */                     \
01437   high_reg = (unsigned) POP_FAILURE_INT ();             \
01438   DEBUG_PRINT2 ("  Popping high active reg: %d\n", high_reg);       \
01439                                     \
01440   low_reg = (unsigned) POP_FAILURE_INT ();              \
01441   DEBUG_PRINT2 ("  Popping  low active reg: %d\n", low_reg);        \
01442                                     \
01443   if (1)                                \
01444     for (this_reg = high_reg; this_reg >= low_reg; this_reg--)      \
01445       {                                 \
01446     DEBUG_PRINT2 ("    Popping reg: %d\n", this_reg);       \
01447                                     \
01448     reg_info[this_reg].word = POP_FAILURE_ELT ();           \
01449     DEBUG_PRINT2 ("      info: 0x%x\n", reg_info[this_reg]);    \
01450                                     \
01451     regend[this_reg] = (const char *) POP_FAILURE_POINTER ();   \
01452     DEBUG_PRINT2 ("      end: 0x%x\n", regend[this_reg]);       \
01453                                     \
01454     regstart[this_reg] = (const char *) POP_FAILURE_POINTER (); \
01455     DEBUG_PRINT2 ("      start: 0x%x\n", regstart[this_reg]);   \
01456       }                                 \
01457   else                                  \
01458     {                                   \
01459       for (this_reg = highest_active_reg; this_reg > high_reg; this_reg--) \
01460     {                               \
01461       reg_info[this_reg].word.integer = 0;              \
01462       regend[this_reg] = 0;                     \
01463       regstart[this_reg] = 0;                   \
01464     }                               \
01465       highest_active_reg = high_reg;                    \
01466     }                                   \
01467                                     \
01468   set_regs_matched_done = 0;                        \
01469   DEBUG_STATEMENT (nfailure_points_popped++);               \
01470 } /* POP_FAILURE_POINT */
01471
01472
01473
01474 /* Structure for per-register (a.k.a. per-group) information.
01475    Other register information, such as the
01476    starting and ending positions (which are addresses), and the list of
01477    inner groups (which is a bits list) are maintained in separate
01478    variables.
01479
01480    We are making a (strictly speaking) nonportable assumption here: that
01481    the compiler will pack our bit fields into something that fits into
01482    the type of `word', i.e., is something that fits into one item on the
01483    failure stack.  */
01484
01485 typedef union
01486 {
01487   fail_stack_elt_t word;
01488   struct
01489   {
01490       /* This field is one if this group can match the empty string,
01491      zero if not.  If not yet determined,  `MATCH_NULL_UNSET_VALUE'.  */
01492 #define MATCH_NULL_UNSET_VALUE 3
01493     unsigned match_null_string_p : 2;
01494     unsigned is_active : 1;
01495     unsigned matched_something : 1;
01496     unsigned ever_matched_something : 1;
01497   } bits;
01498 } register_info_type;
01499
01500 #define REG_MATCH_NULL_STRING_P(R)  ((R).bits.match_null_string_p)
01501 #define IS_ACTIVE(R)  ((R).bits.is_active)
01502 #define MATCHED_SOMETHING(R)  ((R).bits.matched_something)
01503 #define EVER_MATCHED_SOMETHING(R)  ((R).bits.ever_matched_something)
01504
01505
01506 /* Call this when have matched a real character; it sets `matched' flags
01507    for the subexpressions which we are currently inside.  Also records
01508    that those subexprs have matched.  */
01509 #define SET_REGS_MATCHED()                      \
01510   do                                    \
01511     {                                   \
01512       if (!set_regs_matched_done)                   \
01513     {                               \
01514       unsigned r;                           \
01515       set_regs_matched_done = 1;                    \
01516       for (r = lowest_active_reg; r <= highest_active_reg; r++) \
01517         {                               \
01518           MATCHED_SOMETHING (reg_info[r])               \
01519         = EVER_MATCHED_SOMETHING (reg_info[r])          \
01520         = 1;                            \
01521         }                               \
01522     }                               \
01523     }                                   \
01524   while (0)
01525
01526 /* Registers are set to a sentinel when they haven't yet matched.  */
01527 static char reg_unset_dummy;
01528 #define REG_UNSET_VALUE (&reg_unset_dummy)
01529 #define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
01530
01531 /* Subroutine declarations and macros for regex_compile.  */
01532
01533 static void store_op1 (), store_op2 ();
01534 static void insert_op1 (), insert_op2 ();
01535 static boolean at_begline_loc_p (), at_endline_loc_p ();
01536 static boolean group_in_compile_stack ();
01537 static reg_errcode_t compile_range ();
01538
01539 /* Fetch the next character in the uncompiled pattern---translating it
01540    if necessary.  Also cast from a signed character in the constant
01541    string passed to us by the user to an unsigned char that we can use
01542    as an array index (in, e.g., `translate').  */
01543 #ifndef PATFETCH
01544 #define PATFETCH(c)                         \
01545   do {if (p == pend) return REG_EEND;                   \
01546     c = (unsigned char) *p++;                       \
01547     if (RE_TRANSLATE_P (translate)) c = RE_TRANSLATE (translate, c);    \
01548   } while (0)
01549 #endif
01550
01551 /* Fetch the next character in the uncompiled pattern, with no
01552    translation.  */
01553 #define PATFETCH_RAW(c)                         \
01554   do {if (p == pend) return REG_EEND;                   \
01555     c = (unsigned char) *p++;                       \
01556   } while (0)
01557
01558 /* Go backwards one character in the pattern.  */
01559 #define PATUNFETCH p--
01560
01561
01562 /* If `translate' is non-null, return translate[D], else just D.  We
01563    cast the subscript to translate because some data is declared as
01564    `char *', to avoid warnings when a string constant is passed.  But
01565    when we use a character as a subscript we must make it unsigned.  */
01566 #ifndef TRANSLATE
01567 #define TRANSLATE(d) \
01568   (RE_TRANSLATE_P (translate) \
01569    ? (unsigned) RE_TRANSLATE (translate, (unsigned) (d)) : (d))
01570 #endif
01571
01572
01573 /* Macros for outputting the compiled pattern into `buffer'.  */
01574
01575 /* If the buffer isn't allocated when it comes in, use this.  */
01576 #define INIT_BUF_SIZE  32
01577
01578 /* Make sure we have at least N more bytes of space in buffer.  */
01579 #define GET_BUFFER_SPACE(n)                     \
01580     while (b - bufp->buffer + (n) > bufp->allocated)            \
01581       EXTEND_BUFFER ()
01582
01583 /* Make sure we have one more byte of buffer space and then add C to it.  */
01584 #define BUF_PUSH(c)                         \
01585   do {                                  \
01586     GET_BUFFER_SPACE (1);                       \
01587     *b++ = (unsigned char) (c);                     \
01588   } while (0)
01589
01590
01591 /* Ensure we have two more bytes of buffer space and then append C1 and C2.  */
01592 #define BUF_PUSH_2(c1, c2)                      \
01593   do {                                  \
01594     GET_BUFFER_SPACE (2);                       \
01595     *b++ = (unsigned char) (c1);                    \
01596     *b++ = (unsigned char) (c2);                    \
01597   } while (0)
01598
01599
01600 /* As with BUF_PUSH_2, except for three bytes.  */
01601 #define BUF_PUSH_3(c1, c2, c3)                      \
01602   do {                                  \
01603     GET_BUFFER_SPACE (3);                       \
01604     *b++ = (unsigned char) (c1);                    \
01605     *b++ = (unsigned char) (c2);                    \
01606     *b++ = (unsigned char) (c3);                    \
01607   } while (0)
01608
01609
01610 /* Store a jump with opcode OP at LOC to location TO.  We store a
01611    relative address offset by the three bytes the jump itself occupies.  */
01612 #define STORE_JUMP(op, loc, to) \
01613   store_op1 (op, loc, (to) - (loc) - 3)
01614
01615 /* Likewise, for a two-argument jump.  */
01616 #define STORE_JUMP2(op, loc, to, arg) \
01617   store_op2 (op, loc, (to) - (loc) - 3, arg)
01618
01619 /* Like `STORE_JUMP', but for inserting.  Assume `b' is the buffer end.  */
01620 #define INSERT_JUMP(op, loc, to) \
01621   insert_op1 (op, loc, (to) - (loc) - 3, b)
01622
01623 /* Like `STORE_JUMP2', but for inserting.  Assume `b' is the buffer end.  */
01624 #define INSERT_JUMP2(op, loc, to, arg) \
01625   insert_op2 (op, loc, (to) - (loc) - 3, arg, b)
01626
01627
01628 /* This is not an arbitrary limit: the arguments which represent offsets
01629    into the pattern are two bytes long.  So if 2^16 bytes turns out to
01630    be too small, many things would have to change.  */
01631 #define MAX_BUF_SIZE (1L << 16)
01632
01633
01634 /* Extend the buffer by twice its current size via realloc and
01635    reset the pointers that pointed into the old block to point to the
01636    correct places in the new one.  If extending the buffer results in it
01637    being larger than MAX_BUF_SIZE, then flag memory exhausted.  */
01638 #define EXTEND_BUFFER()                         \
01639   do {                                  \
01640     unsigned char *old_buffer = bufp->buffer;               \
01641     if (bufp->allocated == MAX_BUF_SIZE)                \
01642       return REG_ESIZE;                         \
01643     bufp->allocated <<= 1;                      \
01644     if (bufp->allocated > MAX_BUF_SIZE)                 \
01645       bufp->allocated = MAX_BUF_SIZE;                   \
01646     bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\
01647     if (bufp->buffer == NULL)                       \
01648       return REG_ESPACE;                        \
01649     /* If the buffer moved, move all the pointers into it.  */      \
01650     if (old_buffer != bufp->buffer)                 \
01651       {                                 \
01652     b = (b - old_buffer) + bufp->buffer;                \
01653     begalt = (begalt - old_buffer) + bufp->buffer;          \
01654     if (fixup_alt_jump)                     \
01655       fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
01656     if (laststart)                          \
01657       laststart = (laststart - old_buffer) + bufp->buffer;      \
01658     if (pending_exact)                      \
01659       pending_exact = (pending_exact - old_buffer) + bufp->buffer;  \
01660       }                                 \
01661   } while (0)
01662
01663
01664 /* Since we have one byte reserved for the register number argument to
01665    {start,stop}_memory, the maximum number of groups we can report
01666    things about is what fits in that byte.  */
01667 #define MAX_REGNUM 255
01668
01669 /* But patterns can have more than `MAX_REGNUM' registers.  We just
01670    ignore the excess.  */
01671 typedef unsigned regnum_t;
01672
01673
01674 /* Macros for the compile stack.  */
01675
01676 /* Since offsets can go either forwards or backwards, this type needs to
01677    be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1.  */
01678 typedef int pattern_offset_t;
01679
01680 typedef struct
01681 {
01682   pattern_offset_t begalt_offset;
01683   pattern_offset_t fixup_alt_jump;
01684   pattern_offset_t inner_group_offset;
01685   pattern_offset_t laststart_offset;
01686   regnum_t regnum;
01687 } compile_stack_elt_t;
01688
01689
01690 typedef struct
01691 {
01692   compile_stack_elt_t *stack;
01693   unsigned size;
01694   unsigned avail;           /* Offset of next open position.  */
01695 } compile_stack_type;
01696
01697
01698 #define INIT_COMPILE_STACK_SIZE 32
01699
01700 #define COMPILE_STACK_EMPTY  (compile_stack.avail == 0)
01701 #define COMPILE_STACK_FULL  (compile_stack.avail == compile_stack.size)
01702
01703 /* The next available element.  */
01704 #define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
01705
01706
01707 /* Structure to manage work area for range table.  */
01708 struct range_table_work_area
01709 {
01710   int *table;           /* actual work area.  */
01711   int allocated;        /* allocated size for work area in bytes.  */
01712   int used;         /* actually used size in words.  */
01713 };
01714
01715 /* Make sure that WORK_AREA can hold more N multibyte characters.  */
01716 #define EXTEND_RANGE_TABLE_WORK_AREA(work_area, n)            \
01717   do {                                    \
01718     if (((work_area).used + (n)) * sizeof (int) > (work_area).allocated)  \
01719       {                                   \
01720     (work_area).allocated += 16 * sizeof (int);           \
01721     if ((work_area).table)                        \
01722       (work_area).table                       \
01723         = (int *) realloc ((work_area).table, (work_area).allocated); \
01724     else                                  \
01725       (work_area).table                       \
01726         = (int *) malloc ((work_area).allocated);             \
01727     if ((work_area).table == 0)                   \
01728       FREE_STACK_RETURN (REG_ESPACE);                 \
01729       }                                   \
01730   } while (0)
01731
01732 /* Set a range (RANGE_START, RANGE_END) to WORK_AREA.  */
01733 #define SET_RANGE_TABLE_WORK_AREA(work_area, range_start, range_end)    \
01734   do {                                  \
01735     EXTEND_RANGE_TABLE_WORK_AREA ((work_area), 2);          \
01736     (work_area).table[(work_area).used++] = (range_start);      \
01737     (work_area).table[(work_area).used++] = (range_end);        \
01738   } while (0)
01739
01740 /* Free allocated memory for WORK_AREA.  */
01741 #define FREE_RANGE_TABLE_WORK_AREA(work_area)   \
01742   do {                      \
01743     if ((work_area).table)          \
01744       free ((work_area).table);         \
01745   } while (0)
01746
01747 #define CLEAR_RANGE_TABLE_WORK_USED(work_area) ((work_area).used = 0)
01748 #define RANGE_TABLE_WORK_USED(work_area) ((work_area).used)
01749 #define RANGE_TABLE_WORK_ELT(work_area, i) ((work_area).table[i])
01750
01751
01752 /* Set the bit for character C in a list.  */
01753 #define SET_LIST_BIT(c)                   \
01754   (b[((unsigned char) (c)) / BYTEWIDTH]           \
01755    |= 1 << (((unsigned char) c) % BYTEWIDTH))
01756
01757
01758 /* Get the next unsigned number in the uncompiled pattern.  */
01759 #define GET_UNSIGNED_NUMBER(num)                    \
01760   { if (p != pend)                          \
01761      {                                  \
01762        PATFETCH (c);                            \
01763        while (ISDIGIT (c))                      \
01764      {                              \
01765        if (num < 0)                         \
01766           num = 0;                          \
01767        num = num * 10 + c - '0';                    \
01768        if (p == pend)                       \
01769           break;                            \
01770        PATFETCH (c);                        \
01771      }                              \
01772        }                                \
01773     }
01774
01775 #define CHAR_CLASS_MAX_LENGTH  6 /* Namely, `xdigit'.  */
01776
01777 #define IS_CHAR_CLASS(string)                       \
01778    (STREQ (string, "alpha") || STREQ (string, "upper")          \
01779     || STREQ (string, "lower") || STREQ (string, "digit")       \
01780     || STREQ (string, "alnum") || STREQ (string, "xdigit")      \
01781     || STREQ (string, "space") || STREQ (string, "print")       \
01782     || STREQ (string, "punct") || STREQ (string, "graph")       \
01783     || STREQ (string, "cntrl") || STREQ (string, "blank"))
01784
01785 #ifndef MATCH_MAY_ALLOCATE
01786
01787 /* If we cannot allocate large objects within re_match_2_internal,
01788    we make the fail stack and register vectors global.
01789    The fail stack, we grow to the maximum size when a regexp
01790    is compiled.
01791    The register vectors, we adjust in size each time we
01792    compile a regexp, according to the number of registers it needs.  */
01793
01794 static fail_stack_type fail_stack;
01795
01796 /* Size with which the following vectors are currently allocated.
01797    That is so we can make them bigger as needed,
01798    but never make them smaller.  */
01799 static int regs_allocated_size;
01800
01801 static const char **     regstart, **     regend;
01802 static const char ** old_regstart, ** old_regend;
01803 static const char **best_regstart, **best_regend;
01804 static register_info_type *reg_info;
01805 static const char **reg_dummy;
01806 static register_info_type *reg_info_dummy;
01807
01808 /* Make the register vectors big enough for NUM_REGS registers,
01809    but don't make them smaller.  */
01810
01811 static
01812 regex_grow_registers (num_regs)
01813      int num_regs;
01814 {
01815   if (num_regs > regs_allocated_size)
01816     {
01817       RETALLOC_IF (regstart,     num_regs, const char *);
01818       RETALLOC_IF (regend,   num_regs, const char *);
01819       RETALLOC_IF (old_regstart, num_regs, const char *);
01820       RETALLOC_IF (old_regend,   num_regs, const char *);
01821       RETALLOC_IF (best_regstart, num_regs, const char *);
01822       RETALLOC_IF (best_regend,  num_regs, const char *);
01823       RETALLOC_IF (reg_info,     num_regs, register_info_type);
01824       RETALLOC_IF (reg_dummy,    num_regs, const char *);
01825       RETALLOC_IF (reg_info_dummy, num_regs, register_info_type);
01826
01827       regs_allocated_size = num_regs;
01828     }
01829 }
01830
01831 #endif /* not MATCH_MAY_ALLOCATE */
01832
01833 /* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
01834    Returns one of error codes defined in `regex.h', or zero for success.
01835
01836    Assumes the `allocated' (and perhaps `buffer') and `translate'
01837    fields are set in BUFP on entry.
01838
01839    If it succeeds, results are put in BUFP (if it returns an error, the
01840    contents of BUFP are undefined):
01841      `buffer' is the compiled pattern;
01842      `syntax' is set to SYNTAX;
01843      `used' is set to the length of the compiled pattern;
01844      `fastmap_accurate' is zero;
01845      `re_nsub' is the number of subexpressions in PATTERN;
01846      `not_bol' and `not_eol' are zero;
01847
01848    The `fastmap' and `newline_anchor' fields are neither
01849    examined nor set.  */
01850
01851 /* Return, freeing storage we allocated.  */
01852 #define FREE_STACK_RETURN(value)        \
01853   do {                          \
01854     FREE_RANGE_TABLE_WORK_AREA (range_table_work);  \
01855     free (compile_stack.stack);             \
01856     return value;                   \
01857   } while (0)
01858
01859 static reg_errcode_t
01860 regex_compile (pattern, size, syntax, bufp)
01861      const char *pattern;
01862      int size;
01863      reg_syntax_t syntax;
01864      struct re_pattern_buffer *bufp;
01865 {
01866   /* We fetch characters from PATTERN here.  Even though PATTERN is
01867      `char *' (i.e., signed), we declare these variables as unsigned, so
01868      they can be reliably used as array indices.  */
01869   register unsigned int c, c1;
01870
01871   /* A random temporary spot in PATTERN.  */
01872   const char *p1;
01873
01874   /* Points to the end of the buffer, where we should append.  */
01875   register unsigned char *b;
01876
01877   /* Keeps track of unclosed groups.  */
01878   compile_stack_type compile_stack;
01879
01880   /* Points to the current (ending) position in the pattern.  */
01881 #ifdef AIX
01882   /* `const' makes AIX compiler fail.  */
01883   char *p = pattern;
01884 #else
01885   const char *p = pattern;
01886 #endif
01887   const char *pend = pattern + size;
01888
01889   /* How to translate the characters in the pattern.  */
01890   RE_TRANSLATE_TYPE translate = bufp->translate;
01891
01892   /* Address of the count-byte of the most recently inserted `exactn'
01893      command.  This makes it possible to tell if a new exact-match
01894      character can be added to that command or if the character requires
01895      a new `exactn' command.  */
01896   unsigned char *pending_exact = 0;
01897
01898   /* Address of start of the most recently finished expression.
01899      This tells, e.g., postfix * where to find the start of its
01900      operand.  Reset at the beginning of groups and alternatives.  */
01901   unsigned char *laststart = 0;
01902
01903   /* Address of beginning of regexp, or inside of last group.  */
01904   unsigned char *begalt;
01905
01906   /* Place in the uncompiled pattern (i.e., the {) to
01907      which to go back if the interval is invalid.  */
01908   const char *beg_interval;
01909
01910   /* Address of the place where a forward jump should go to the end of
01911      the containing expression.  Each alternative of an `or' -- except the
01912      last -- ends with a forward jump of this sort.  */
01913   unsigned char *fixup_alt_jump = 0;
01914
01915   /* Counts open-groups as they are encountered.  Remembered for the
01916      matching close-group on the compile stack, so the same register
01917      number is put in the stop_memory as the start_memory.  */
01918   regnum_t regnum = 0;
01919
01920   /* Work area for range table of charset.  */
01921   struct range_table_work_area range_table_work;
01922
01923 #ifdef DEBUG
01924   DEBUG_PRINT1 ("\nCompiling pattern: ");
01925   if (debug)
01926     {
01927       unsigned debug_count;
01928
01929       for (debug_count = 0; debug_count < size; debug_count++)
01930     putchar (pattern[debug_count]);
01931       putchar ('\n');
01932     }
01933 #endif /* DEBUG */
01934
01935   /* Initialize the compile stack.  */
01936   compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
01937   if (compile_stack.stack == NULL)
01938     return REG_ESPACE;
01939
01940   compile_stack.size = INIT_COMPILE_STACK_SIZE;
01941   compile_stack.avail = 0;
01942
01943   range_table_work.table = 0;
01944   range_table_work.allocated = 0;
01945
01946   /* Initialize the pattern buffer.  */
01947   bufp->syntax = syntax;
01948   bufp->fastmap_accurate = 0;
01949   bufp->not_bol = bufp->not_eol = 0;
01950
01951   /* Set `used' to zero, so that if we return an error, the pattern
01952      printer (for debugging) will think there's no pattern.  We reset it
01953      at the end.  */
01954   bufp->used = 0;
01955
01956   /* Always count groups, whether or not bufp->no_sub is set.  */
01957   bufp->re_nsub = 0;
01958
01959 #ifdef emacs
01960   /* bufp->multibyte is set before regex_compile is called, so don't alter
01961      it. */
01962 #else  /* not emacs */
01963   /* Nothing is recognized as a multibyte character.  */
01964   bufp->multibyte = 0;
01965 #endif
01966
01967 #if !defined (emacs) && !defined (SYNTAX_TABLE)
01968   /* Initialize the syntax table.  */
01969    init_syntax_once ();
01970 #endif
01971
01972   if (bufp->allocated == 0)
01973     {
01974       if (bufp->buffer)
01975     { /* If zero allocated, but buffer is non-null, try to realloc
01976          enough space.  This loses if buffer's address is bogus, but
01977          that is the user's responsibility.  */
01978       RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char);
01979     }
01980       else
01981     { /* Caller did not allocate a buffer.  Do it for them.  */
01982       bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char);
01983     }
01984       if (!bufp->buffer) FREE_STACK_RETURN (REG_ESPACE);
01985
01986       bufp->allocated = INIT_BUF_SIZE;
01987     }
01988
01989   begalt = b = bufp->buffer;
01990
01991   /* Loop through the uncompiled pattern until we're at the end.  */
01992   while (p != pend)
01993     {
01994       PATFETCH (c);
01995
01996       switch (c)
01997     {
01998     case '^':
01999       {
02000         if (   /* If at start of pattern, it's an operator.  */
02001            p == pattern + 1
02002            /* If context independent, it's an operator.  */
02003         || syntax & RE_CONTEXT_INDEP_ANCHORS
02004            /* Otherwise, depends on what's come before.  */
02005         || at_begline_loc_p (pattern, p, syntax))
02006           BUF_PUSH (begline);
02007         else
02008           goto normal_char;
02009       }
02010       break;
02011
02012
02013     case '$':
02014       {
02015         if (   /* If at end of pattern, it's an operator.  */
02016            p == pend
02017            /* If context independent, it's an operator.  */
02018         || syntax & RE_CONTEXT_INDEP_ANCHORS
02019            /* Otherwise, depends on what's next.  */
02020         || at_endline_loc_p (p, pend, syntax))
02021            BUF_PUSH (endline);
02022          else
02023            goto normal_char;
02024        }
02025        break;
02026
02027
02028     case '+':
02029     case '?':
02030       if ((syntax & RE_BK_PLUS_QM)
02031           || (syntax & RE_LIMITED_OPS))
02032         goto normal_char;
02033     handle_plus:
02034     case '*':
02035       /* If there is no previous pattern... */
02036       if (!laststart)
02037         {
02038           if (syntax & RE_CONTEXT_INVALID_OPS)
02039         FREE_STACK_RETURN (REG_BADRPT);
02040           else if (!(syntax & RE_CONTEXT_INDEP_OPS))
02041         goto normal_char;
02042         }
02043
02044       {
02045         /* Are we optimizing this jump?  */
02046         boolean keep_string_p = false;
02047
02048         /* 1 means zero (many) matches is allowed.  */
02049         char zero_times_ok = 0, many_times_ok = 0;
02050
02051         /* If there is a sequence of repetition chars, collapse it
02052            down to just one (the right one).  We can't combine
02053            interval operators with these because of, e.g., `a{2}*',
02054            which should only match an even number of `a's.  */
02055
02056         for (;;)
02057           {
02058         zero_times_ok |= c != '+';
02059         many_times_ok |= c != '?';
02060
02061         if (p == pend)
02062           break;
02063
02064         PATFETCH (c);
02065
02066         if (c == '*'
02067             || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
02068           ;
02069
02070         else if (syntax & RE_BK_PLUS_QM  &&  c == '\\')
02071           {
02072             if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
02073
02074             PATFETCH (c1);
02075             if (!(c1 == '+' || c1 == '?'))
02076               {
02077             PATUNFETCH;
02078             PATUNFETCH;
02079             break;
02080               }
02081
02082             c = c1;
02083           }
02084         else
02085           {
02086             PATUNFETCH;
02087             break;
02088           }
02089
02090         /* If we get here, we found another repeat character.  */
02091            }
02092
02093         /* Star, etc. applied to an empty pattern is equivalent
02094            to an empty pattern.  */
02095         if (!laststart)
02096           break;
02097
02098         /* Now we know whether or not zero matches is allowed
02099            and also whether or not two or more matches is allowed.  */
02100         if (many_times_ok)
02101           { /* More than one repetition is allowed, so put in at the
02102            end a backward relative jump from `b' to before the next
02103            jump we're going to put in below (which jumps from
02104            laststart to after this jump).
02105
02106            But if we are at the `*' in the exact sequence `.*\n',
02107            insert an unconditional jump backwards to the .,
02108            instead of the beginning of the loop.  This way we only
02109            push a failure point once, instead of every time
02110            through the loop.  */
02111         assert (p - 1 > pattern);
02112
02113         /* Allocate the space for the jump.  */
02114         GET_BUFFER_SPACE (3);
02115
02116         /* We know we are not at the first character of the pattern,
02117            because laststart was nonzero.  And we've already
02118            incremented `p', by the way, to be the character after
02119            the `*'.  Do we have to do something analogous here
02120            for null bytes, because of RE_DOT_NOT_NULL?  */
02121         if (TRANSLATE ((unsigned char)*(p - 2)) == TRANSLATE ('.')
02122             && zero_times_ok
02123             && p < pend
02124             && TRANSLATE ((unsigned char)*p) == TRANSLATE ('\n')
02125             && !(syntax & RE_DOT_NEWLINE))
02126           { /* We have .*\n.  */
02127             STORE_JUMP (jump, b, laststart);
02128             keep_string_p = true;
02129           }
02130         else
02131           /* Anything else.  */
02132           STORE_JUMP (maybe_pop_jump, b, laststart - 3);
02133
02134         /* We've added more stuff to the buffer.  */
02135         b += 3;
02136           }
02137
02138         /* On failure, jump from laststart to b + 3, which will be the
02139            end of the buffer after this jump is inserted.  */
02140         GET_BUFFER_SPACE (3);
02141         INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump
02142                        : on_failure_jump,
02143              laststart, b + 3);
02144         pending_exact = 0;
02145         b += 3;
02146
02147         if (!zero_times_ok)
02148           {
02149         /* At least one repetition is required, so insert a
02150            `dummy_failure_jump' before the initial
02151            `on_failure_jump' instruction of the loop. This
02152            effects a skip over that instruction the first time
02153            we hit that loop.  */
02154         GET_BUFFER_SPACE (3);
02155         INSERT_JUMP (dummy_failure_jump, laststart, laststart + 6);
02156         b += 3;
02157           }
02158         }
02159       break;
02160
02161
02162     case '.':
02163       laststart = b;
02164       BUF_PUSH (anychar);
02165       break;
02166
02167
02168     case '[':
02169       {
02170         CLEAR_RANGE_TABLE_WORK_USED (range_table_work);
02171
02172         if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
02173
02174         /* Ensure that we have enough space to push a charset: the
02175            opcode, the length count, and the bitset; 34 bytes in all.  */
02176         GET_BUFFER_SPACE (34);
02177
02178         laststart = b;
02179
02180         /* We test `*p == '^' twice, instead of using an if
02181            statement, so we only need one BUF_PUSH.  */
02182         BUF_PUSH (*p == '^' ? charset_not : charset);
02183         if (*p == '^')
02184           p++;
02185
02186         /* Remember the first position in the bracket expression.  */
02187         p1 = p;
02188
02189         /* Push the number of bytes in the bitmap.  */
02190         BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
02191
02192         /* Clear the whole map.  */
02193         bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
02194
02195         /* charset_not matches newline according to a syntax bit.  */
02196         if ((re_opcode_t) b[-2] == charset_not
02197         && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
02198           SET_LIST_BIT ('\n');
02199
02200         /* Read in characters and ranges, setting map bits.  */
02201         for (;;)
02202           {
02203         int len;
02204         boolean escaped_char = false;
02205
02206         if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
02207
02208         PATFETCH (c);
02209
02210         /* \ might escape characters inside [...] and [^...].  */
02211         if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
02212           {
02213             if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
02214
02215             PATFETCH (c);
02216             escaped_char = true;
02217           }
02218         else
02219           {
02220             /* Could be the end of the bracket expression.  If it's
02221                not (i.e., when the bracket expression is `[]' so
02222                far), the ']' character bit gets set way below.  */
02223             if (c == ']' && p != p1 + 1)
02224               break;
02225           }
02226
02227         /* If C indicates start of multibyte char, get the
02228            actual character code in C, and set the pattern
02229            pointer P to the next character boundary.  */
02230         if (bufp->multibyte && BASE_LEADING_CODE_P (c))
02231           {
02232             PATUNFETCH;
02233             c = STRING_CHAR_AND_LENGTH (p, pend - p, len);
02234             p += len;
02235           }
02236         /* What should we do for the character which is
02237            greater than 0x7F, but not BASE_LEADING_CODE_P?
02238            XXX */
02239
02240         /* See if we're at the beginning of a possible character
02241            class.  */
02242
02243         else if (!escaped_char &&
02244              syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
02245           {
02246             /* Leave room for the null.  */
02247             char str[CHAR_CLASS_MAX_LENGTH + 1];
02248
02249             PATFETCH (c);
02250             c1 = 0;
02251
02252             /* If pattern is `[[:'.  */
02253             if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
02254
02255             for (;;)
02256               {
02257             PATFETCH (c);
02258             if (c == ':' || c == ']' || p == pend
02259                 || c1 == CHAR_CLASS_MAX_LENGTH)
02260               break;
02261             str[c1++] = c;
02262               }
02263             str[c1] = '\0';
02264
02265             /* If isn't a word bracketed by `[:' and `:]':
02266                undo the ending character, the letters, and
02267                leave the leading `:' and `[' (but set bits for
02268                them).  */
02269             if (c == ':' && *p == ']')
02270               {
02271             int ch;
02272             boolean is_alnum = STREQ (str, "alnum");
02273             boolean is_alpha = STREQ (str, "alpha");
02274             boolean is_blank = STREQ (str, "blank");
02275             boolean is_cntrl = STREQ (str, "cntrl");
02276             boolean is_digit = STREQ (str, "digit");
02277             boolean is_graph = STREQ (str, "graph");
02278             boolean is_lower = STREQ (str, "lower");
02279             boolean is_print = STREQ (str, "print");
02280             boolean is_punct = STREQ (str, "punct");
02281             boolean is_space = STREQ (str, "space");
02282             boolean is_upper = STREQ (str, "upper");
02283             boolean is_xdigit = STREQ (str, "xdigit");
02284
02285             if (!IS_CHAR_CLASS (str))
02286               FREE_STACK_RETURN (REG_ECTYPE);
02287
02288             /* Throw away the ] at the end of the character
02289                class.  */
02290             PATFETCH (c);
02291
02292             if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
02293
02294             for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
02295               {
02296                 int translated = TRANSLATE (ch);
02297                 /* This was split into 3 if's to
02298                    avoid an arbitrary limit in some compiler.  */
02299                 if (   (is_alnum  && ISALNUM (ch))
02300                 || (is_alpha  && ISALPHA (ch))
02301                 || (is_blank  && ISBLANK (ch))
02302                 || (is_cntrl  && ISCNTRL (ch)))
02303                   SET_LIST_BIT (translated);
02304                 if (   (is_digit  && ISDIGIT (ch))
02305                 || (is_graph  && ISGRAPH (ch))
02306                 || (is_lower  && ISLOWER (ch))
02307                 || (is_print  && ISPRINT (ch)))
02308                   SET_LIST_BIT (translated);
02309                 if (   (is_punct  && ISPUNCT (ch))
02310                 || (is_space  && ISSPACE (ch))
02311                 || (is_upper  && ISUPPER (ch))
02312                 || (is_xdigit && ISXDIGIT (ch)))
02313                   SET_LIST_BIT (translated);
02314               }
02315
02316             /* Repeat the loop. */
02317             continue;
02318               }
02319             else
02320               {
02321             c1++;
02322             while (c1--)
02323               PATUNFETCH;
02324             SET_LIST_BIT ('[');
02325
02326             /* Because the `:' may starts the range, we
02327                can't simply set bit and repeat the loop.
02328                Instead, just set it to C and handle below.  */
02329             c = ':';
02330               }
02331           }
02332
02333         if (p < pend && p[0] == '-' && p[1] != ']')
02334           {
02335
02336             /* Discard the `-'. */
02337             PATFETCH (c1);
02338
02339             /* Fetch the character which ends the range. */
02340             PATFETCH (c1);
02341             if (bufp->multibyte && BASE_LEADING_CODE_P (c1))
02342               {
02343             PATUNFETCH;
02344             c1 = STRING_CHAR_AND_LENGTH (p, pend - p, len);
02345             p += len;
02346               }
02347
02348             if (SINGLE_BYTE_CHAR_P (c)
02349             && ! SINGLE_BYTE_CHAR_P (c1))
02350               {
02351             /* Handle a range such as \177-\377 in multibyte mode.
02352                Split that into two ranges,,
02353                the low one ending at 0237, and the high one
02354                starting at ...040.  */
02355             int c1_base = (c1 & ~0177) | 040;
02356             SET_RANGE_TABLE_WORK_AREA (range_table_work, c, c1);
02357             c1 = 0237;
02358               }
02359             else if (!SAME_CHARSET_P (c, c1))
02360               FREE_STACK_RETURN (REG_ERANGE);
02361           }
02362         else
02363           /* Range from C to C. */
02364           c1 = c;
02365
02366         /* Set the range ... */
02367         if (SINGLE_BYTE_CHAR_P (c))
02368           /* ... into bitmap.  */
02369           {
02370             unsigned this_char;
02371             int range_start = c, range_end = c1;
02372
02373             /* If the start is after the end, the range is empty.  */
02374             if (range_start > range_end)
02375               {
02376             if (syntax & RE_NO_EMPTY_RANGES)
02377               FREE_STACK_RETURN (REG_ERANGE);
02378             /* Else, repeat the loop.  */
02379               }
02380             else
02381               {
02382             for (this_char = range_start; this_char <= range_end;
02383                  this_char++)
02384               SET_LIST_BIT (TRANSLATE (this_char));
02385               }
02386           }
02387         else
02388           /* ... into range table.  */
02389           SET_RANGE_TABLE_WORK_AREA (range_table_work, c, c1);
02390           }
02391
02392         /* Discard any (non)matching list bytes that are all 0 at the
02393            end of the map.  Decrease the map-length byte too.  */
02394         while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
02395           b[-1]--;
02396         b += b[-1];
02397
02398         /* Build real range table from work area. */
02399         if (RANGE_TABLE_WORK_USED (range_table_work))
02400           {
02401         int i;
02402         int used = RANGE_TABLE_WORK_USED (range_table_work);
02403
02404         /* Allocate space for COUNT + RANGE_TABLE.  Needs two
02405            bytes for COUNT and three bytes for each character.  */
02406         GET_BUFFER_SPACE (2 + used * 3);
02407
02408         /* Indicate the existence of range table.  */
02409         laststart[1] |= 0x80;
02410
02411         STORE_NUMBER_AND_INCR (b, used / 2);
02412         for (i = 0; i < used; i++)
02413           STORE_CHARACTER_AND_INCR
02414             (b, RANGE_TABLE_WORK_ELT (range_table_work, i));
02415           }
02416       }
02417       break;
02418
02419
02420     case '(':
02421       if (syntax & RE_NO_BK_PARENS)
02422         goto handle_open;
02423       else
02424         goto normal_char;
02425
02426
02427     case ')':
02428       if (syntax & RE_NO_BK_PARENS)
02429         goto handle_close;
02430       else
02431         goto normal_char;
02432
02433
02434     case '\n':
02435       if (syntax & RE_NEWLINE_ALT)
02436         goto handle_alt;
02437       else
02438         goto normal_char;
02439
02440
02441     case '|':
02442       if (syntax & RE_NO_BK_VBAR)
02443         goto handle_alt;
02444       else
02445         goto normal_char;
02446
02447
02448     case '{':
02449        if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
02450          goto handle_interval;
02451        else
02452          goto normal_char;
02453
02454
02455     case '\\':
02456       if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
02457
02458       /* Do not translate the character after the \, so that we can
02459          distinguish, e.g., \B from \b, even if we normally would
02460          translate, e.g., B to b.  */
02461       PATFETCH_RAW (c);
02462
02463       switch (c)
02464         {
02465         case '(':
02466           if (syntax & RE_NO_BK_PARENS)
02467         goto normal_backslash;
02468
02469         handle_open:
02470           bufp->re_nsub++;
02471           regnum++;
02472
02473           if (COMPILE_STACK_FULL)
02474         {
02475           RETALLOC (compile_stack.stack, compile_stack.size << 1,
02476                 compile_stack_elt_t);
02477           if (compile_stack.stack == NULL) return REG_ESPACE;
02478
02479           compile_stack.size <<= 1;
02480         }
02481
02482           /* These are the values to restore when we hit end of this
02483          group.  They are all relative offsets, so that if the
02484          whole pattern moves because of realloc, they will still
02485          be valid.  */
02486           COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer;
02487           COMPILE_STACK_TOP.fixup_alt_jump
02488         = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0;
02489           COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer;
02490           COMPILE_STACK_TOP.regnum = regnum;
02491
02492           /* We will eventually replace the 0 with the number of
02493          groups inner to this one.  But do not push a
02494          start_memory for groups beyond the last one we can
02495          represent in the compiled pattern.  */
02496           if (regnum <= MAX_REGNUM)
02497         {
02498           COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2;
02499           BUF_PUSH_3 (start_memory, regnum, 0);
02500         }
02501
02502           compile_stack.avail++;
02503
02504           fixup_alt_jump = 0;
02505           laststart = 0;
02506           begalt = b;
02507           /* If we've reached MAX_REGNUM groups, then this open
02508          won't actually generate any code, so we'll have to
02509          clear pending_exact explicitly.  */
02510           pending_exact = 0;
02511           break;
02512
02513
02514         case ')':
02515           if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
02516
02517           if (COMPILE_STACK_EMPTY)
02518         if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
02519           goto normal_backslash;
02520         else
02521           FREE_STACK_RETURN (REG_ERPAREN);
02522
02523         handle_close:
02524           if (fixup_alt_jump)
02525         { /* Push a dummy failure point at the end of the
02526              alternative for a possible future
02527              `pop_failure_jump' to pop.  See comments at
02528              `push_dummy_failure' in `re_match_2'.  */
02529           BUF_PUSH (push_dummy_failure);
02530
02531           /* We allocated space for this jump when we assigned
02532              to `fixup_alt_jump', in the `handle_alt' case below.  */
02533           STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1);
02534         }
02535
02536           /* See similar code for backslashed left paren above.  */
02537           if (COMPILE_STACK_EMPTY)
02538         if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
02539           goto normal_char;
02540         else
02541           FREE_STACK_RETURN (REG_ERPAREN);
02542
02543           /* Since we just checked for an empty stack above, this
02544          ``can't happen''.  */
02545           assert (compile_stack.avail != 0);
02546           {
02547         /* We don't just want to restore into `regnum', because
02548            later groups should continue to be numbered higher,
02549            as in `(ab)c(de)' -- the second group is #2.  */
02550         regnum_t this_group_regnum;
02551
02552         compile_stack.avail--;
02553         begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset;
02554         fixup_alt_jump
02555           = COMPILE_STACK_TOP.fixup_alt_jump
02556             ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1
02557             : 0;
02558         laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset;
02559         this_group_regnum = COMPILE_STACK_TOP.regnum;
02560         /* If we've reached MAX_REGNUM groups, then this open
02561            won't actually generate any code, so we'll have to
02562            clear pending_exact explicitly.  */
02563         pending_exact = 0;
02564
02565         /* We're at the end of the group, so now we know how many
02566            groups were inside this one.  */
02567         if (this_group_regnum <= MAX_REGNUM)
02568           {
02569             unsigned char *inner_group_loc
02570               = bufp->buffer + COMPILE_STACK_TOP.inner_group_offset;
02571
02572             *inner_group_loc = regnum - this_group_regnum;
02573             BUF_PUSH_3 (stop_memory, this_group_regnum,
02574                 regnum - this_group_regnum);
02575           }
02576           }
02577           break;
02578
02579
02580         case '|':                   /* `\|'.  */
02581           if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
02582         goto normal_backslash;
02583         handle_alt:
02584           if (syntax & RE_LIMITED_OPS)
02585         goto normal_char;
02586
02587           /* Insert before the previous alternative a jump which
02588          jumps to this alternative if the former fails.  */
02589           GET_BUFFER_SPACE (3);
02590           INSERT_JUMP (on_failure_jump, begalt, b + 6);
02591           pending_exact = 0;
02592           b += 3;
02593
02594           /* The alternative before this one has a jump after it
02595          which gets executed if it gets matched.  Adjust that
02596          jump so it will jump to this alternative's analogous
02597          jump (put in below, which in turn will jump to the next
02598          (if any) alternative's such jump, etc.).  The last such
02599          jump jumps to the correct final destination.  A picture:
02600               _____ _____
02601               |   | |   |
02602               |   v |   v
02603              a | b   | c
02604
02605          If we are at `b', then fixup_alt_jump right now points to a
02606          three-byte space after `a'.  We'll put in the jump, set
02607          fixup_alt_jump to right after `b', and leave behind three
02608          bytes which we'll fill in when we get to after `c'.  */
02609
02610           if (fixup_alt_jump)
02611         STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
02612
02613           /* Mark and leave space for a jump after this alternative,
02614          to be filled in later either by next alternative or
02615          when know we're at the end of a series of alternatives.  */
02616           fixup_alt_jump = b;
02617           GET_BUFFER_SPACE (3);
02618           b += 3;
02619
02620           laststart = 0;
02621           begalt = b;
02622           break;
02623
02624
02625         case '{':
02626           /* If \{ is a literal.  */
02627           if (!(syntax & RE_INTERVALS)
02628              /* If we're at `\{' and it's not the open-interval
02629             operator.  */
02630           || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
02631           || (p - 2 == pattern  &&  p == pend))
02632         goto normal_backslash;
02633
02634         handle_interval:
02635           {
02636         /* If got here, then the syntax allows intervals.  */
02637
02638         /* At least (most) this many matches must be made.  */
02639         int lower_bound = -1, upper_bound = -1;
02640
02641         beg_interval = p - 1;
02642
02643         if (p == pend)
02644           {
02645             if (syntax & RE_NO_BK_BRACES)
02646               goto unfetch_interval;
02647             else
02648               FREE_STACK_RETURN (REG_EBRACE);
02649           }
02650
02651         GET_UNSIGNED_NUMBER (lower_bound);
02652
02653         if (c == ',')
02654           {
02655             GET_UNSIGNED_NUMBER (upper_bound);
02656             if (upper_bound < 0) upper_bound = RE_DUP_MAX;
02657           }
02658         else
02659           /* Interval such as `{1}' => match exactly once. */
02660           upper_bound = lower_bound;
02661
02662         if (lower_bound < 0 || upper_bound > RE_DUP_MAX
02663             || lower_bound > upper_bound)
02664           {
02665             if (syntax & RE_NO_BK_BRACES)
02666               goto unfetch_interval;
02667             else
02668               FREE_STACK_RETURN (REG_BADBR);
02669           }
02670
02671         if (!(syntax & RE_NO_BK_BRACES))
02672           {
02673             if (c != '\\') FREE_STACK_RETURN (REG_EBRACE);
02674
02675             PATFETCH (c);
02676           }
02677
02678         if (c != '}')
02679           {
02680             if (syntax & RE_NO_BK_BRACES)
02681               goto unfetch_interval;
02682             else
02683               FREE_STACK_RETURN (REG_BADBR);
02684           }
02685
02686         /* We just parsed a valid interval.  */
02687
02688         /* If it's invalid to have no preceding re.  */
02689         if (!laststart)
02690           {
02691             if (syntax & RE_CONTEXT_INVALID_OPS)
02692               FREE_STACK_RETURN (REG_BADRPT);
02693             else if (syntax & RE_CONTEXT_INDEP_OPS)
02694               laststart = b;
02695             else
02696               goto unfetch_interval;
02697           }
02698
02699         /* If the upper bound is zero, don't want to succeed at
02700            all; jump from `laststart' to `b + 3', which will be
02701            the end of the buffer after we insert the jump.  */
02702          if (upper_bound == 0)
02703            {
02704              GET_BUFFER_SPACE (3);
02705              INSERT_JUMP (jump, laststart, b + 3);
02706              b += 3;
02707            }
02708
02709          /* Otherwise, we have a nontrivial interval.  When
02710             we're all done, the pattern will look like:
02711               set_number_at <jump count> <upper bound>
02712               set_number_at <succeed_n count> <lower bound>
02713               succeed_n <after jump addr> <succeed_n count>
02714               <body of loop>
02715               jump_n <succeed_n addr> <jump count>
02716             (The upper bound and `jump_n' are omitted if
02717             `upper_bound' is 1, though.)  */
02718          else
02719            { /* If the upper bound is > 1, we need to insert
02720             more at the end of the loop.  */
02721              unsigned nbytes = 10 + (upper_bound > 1) * 10;
02722
02723              GET_BUFFER_SPACE (nbytes);
02724
02725              /* Initialize lower bound of the `succeed_n', even
02726             though it will be set during matching by its
02727             attendant `set_number_at' (inserted next),
02728             because `re_compile_fastmap' needs to know.
02729             Jump to the `jump_n' we might insert below.  */
02730              INSERT_JUMP2 (succeed_n, laststart,
02731                    b + 5 + (upper_bound > 1) * 5,
02732                    lower_bound);
02733              b += 5;
02734
02735              /* Code to initialize the lower bound.  Insert
02736             before the `succeed_n'.  The `5' is the last two
02737             bytes of this `set_number_at', plus 3 bytes of
02738             the following `succeed_n'.  */
02739              insert_op2 (set_number_at, laststart, 5, lower_bound, b);
02740              b += 5;
02741
02742              if (upper_bound > 1)
02743                { /* More than one repetition is allowed, so
02744                 append a backward jump to the `succeed_n'
02745                 that starts this interval.
02746
02747                 When we've reached this during matching,
02748                 we'll have matched the interval once, so
02749                 jump back only `upper_bound - 1' times.  */
02750              STORE_JUMP2 (jump_n, b, laststart + 5,
02751                       upper_bound - 1);
02752              b += 5;
02753
02754              /* The location we want to set is the second
02755                 parameter of the `jump_n'; that is `b-2' as
02756                 an absolute address.  `laststart' will be
02757                 the `set_number_at' we're about to insert;
02758                 `laststart+3' the number to set, the source
02759                 for the relative address.  But we are
02760                 inserting into the middle of the pattern --
02761                 so everything is getting moved up by 5.
02762                 Conclusion: (b - 2) - (laststart + 3) + 5,
02763                 i.e., b - laststart.
02764
02765                 We insert this at the beginning of the loop
02766                 so that if we fail during matching, we'll
02767                 reinitialize the bounds.  */
02768              insert_op2 (set_number_at, laststart, b - laststart,
02769                      upper_bound - 1, b);
02770              b += 5;
02771                }
02772            }
02773         pending_exact = 0;
02774         beg_interval = NULL;
02775           }
02776           break;
02777
02778         unfetch_interval:
02779           /* If an invalid interval, match the characters as literals.  */
02780            assert (beg_interval);
02781            p = beg_interval;
02782            beg_interval = NULL;
02783
02784            /* normal_char and normal_backslash need `c'.  */
02785            PATFETCH (c);
02786
02787            if (!(syntax & RE_NO_BK_BRACES))
02788          {
02789            if (p > pattern  &&  p[-1] == '\\')
02790              goto normal_backslash;
02791          }
02792            goto normal_char;
02793
02794 #ifdef emacs
02795         /* There is no way to specify the before_dot and after_dot
02796            operators.  rms says this is ok.  --karl  */
02797         case '=':
02798           BUF_PUSH (at_dot);
02799           break;
02800
02801         case 's':
02802           laststart = b;
02803           PATFETCH (c);
02804           BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
02805           break;
02806
02807         case 'S':
02808           laststart = b;
02809           PATFETCH (c);
02810           BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]);
02811           break;
02812
02813         case 'c':
02814           laststart = b;
02815           PATFETCH_RAW (c);
02816           BUF_PUSH_2 (categoryspec, c);
02817           break;
02818
02819         case 'C':
02820           laststart = b;
02821           PATFETCH_RAW (c);
02822           BUF_PUSH_2 (notcategoryspec, c);
02823           break;
02824 #endif /* emacs */
02825
02826
02827         case 'w':
02828           laststart = b;
02829           BUF_PUSH (wordchar);
02830           break;
02831
02832
02833         case 'W':
02834           laststart = b;
02835           BUF_PUSH (notwordchar);
02836           break;
02837
02838
02839         case '<':
02840           BUF_PUSH (wordbeg);
02841           break;
02842
02843         case '>':
02844           BUF_PUSH (wordend);
02845           break;
02846
02847         case 'b':
02848           BUF_PUSH (wordbound);
02849           break;
02850
02851         case 'B':
02852           BUF_PUSH (notwordbound);
02853           break;
02854
02855         case '`':
02856           BUF_PUSH (begbuf);
02857           break;
02858
02859         case '\'':
02860           BUF_PUSH (endbuf);
02861           break;
02862
02863         case '1': case '2': case '3': case '4': case '5':
02864         case '6': case '7': case '8': case '9':
02865           if (syntax & RE_NO_BK_REFS)
02866         goto normal_char;
02867
02868           c1 = c - '0';
02869
02870           if (c1 > regnum)
02871         FREE_STACK_RETURN (REG_ESUBREG);
02872
02873           /* Can't back reference to a subexpression if inside of it.  */
02874           if (group_in_compile_stack (compile_stack, c1))
02875         goto normal_char;
02876
02877           laststart = b;
02878           BUF_PUSH_2 (duplicate, c1);
02879           break;
02880
02881
02882         case '+':
02883         case '?':
02884           if (syntax & RE_BK_PLUS_QM)
02885         goto handle_plus;
02886           else
02887         goto normal_backslash;
02888
02889         default:
02890         normal_backslash:
02891           /* You might think it would be useful for \ to mean
02892          not to translate; but if we don't translate it
02893          it will never match anything.  */
02894           c = TRANSLATE (c);
02895           goto normal_char;
02896         }
02897       break;
02898
02899
02900     default:
02901     /* Expects the character in `c'.  */
02902     normal_char:
02903       p1 = p - 1;       /* P1 points the head of C.  */
02904 #ifdef emacs
02905       if (bufp->multibyte)
02906         {
02907           c = STRING_CHAR (p1, pend - p1);
02908           c = TRANSLATE (c);
02909           /* Set P to the next character boundary.  */
02910           p += MULTIBYTE_FORM_LENGTH (p1, pend - p1) - 1;
02911         }
02912 #endif
02913           /* If no exactn currently being built.  */
02914       if (!pending_exact
02915
02916           /* If last exactn not at current position.  */
02917           || pending_exact + *pending_exact + 1 != b
02918
02919           /* We have only one byte following the exactn for the count.  */
02920           || *pending_exact >= (1 << BYTEWIDTH) - (p - p1)
02921
02922           /* If followed by a repetition operator.  */
02923           || (p != pend && (*p == '*' || *p == '^'))
02924           || ((syntax & RE_BK_PLUS_QM)
02925           ? p + 1 < pend && *p == '\\' && (p[1] == '+' || p[1] == '?')
02926           : p != pend && (*p == '+' || *p == '?'))
02927           || ((syntax & RE_INTERVALS)
02928           && ((syntax & RE_NO_BK_BRACES)
02929               ? p != pend && *p == '{'
02930               : p + 1 < pend && p[0] == '\\' && p[1] == '{')))
02931         {
02932           /* Start building a new exactn.  */
02933
02934           laststart = b;
02935
02936           BUF_PUSH_2 (exactn, 0);
02937           pending_exact = b - 1;
02938         }
02939
02940 #ifdef emacs
02941       if (! SINGLE_BYTE_CHAR_P (c))
02942         {
02943           unsigned char work[4], *str;
02944           int i = CHAR_STRING (c, work, str);
02945           int j;
02946           for (j = 0; j < i; j++)
02947         {
02948           BUF_PUSH (str[j]);
02949           (*pending_exact)++;
02950         }
02951         }
02952       else
02953 #endif
02954         {
02955           BUF_PUSH (c);
02956           (*pending_exact)++;
02957         }
02958       break;
02959     } /* switch (c) */
02960     } /* while p != pend */
02961
02962
02963   /* Through the pattern now.  */
02964
02965   if (fixup_alt_jump)
02966     STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
02967
02968   if (!COMPILE_STACK_EMPTY)
02969     FREE_STACK_RETURN (REG_EPAREN);
02970
02971   /* If we don't want backtracking, force success
02972      the first time we reach the end of the compiled pattern.  */
02973   if (syntax & RE_NO_POSIX_BACKTRACKING)
02974     BUF_PUSH (succeed);
02975
02976   free (compile_stack.stack);
02977
02978   /* We have succeeded; set the length of the buffer.  */
02979   bufp->used = b - bufp->buffer;
02980
02981 #ifdef DEBUG
02982   if (debug)
02983     {
02984       DEBUG_PRINT1 ("\nCompiled pattern: \n");
02985       print_compiled_pattern (bufp);
02986     }
02987 #endif /* DEBUG */
02988
02989 #ifndef MATCH_MAY_ALLOCATE
02990   /* Initialize the failure stack to the largest possible stack.  This
02991      isn't necessary unless we're trying to avoid calling alloca in
02992      the search and match routines.  */
02993   {
02994     int num_regs = bufp->re_nsub + 1;
02995
02996     if (fail_stack.size < re_max_failures * TYPICAL_FAILURE_SIZE)
02997       {
02998     fail_stack.size = re_max_failures * TYPICAL_FAILURE_SIZE;
02999
03000 #ifdef emacs
03001     if (! fail_stack.stack)
03002       fail_stack.stack
03003         = (fail_stack_elt_t *) xmalloc (fail_stack.size
03004                         * sizeof (fail_stack_elt_t));
03005     else
03006       fail_stack.stack
03007         = (fail_stack_elt_t *) xrealloc (fail_stack.stack,
03008                          (fail_stack.size
03009                           * sizeof (fail_stack_elt_t)));
03010 #else /* not emacs */
03011     if (! fail_stack.stack)
03012       fail_stack.stack
03013         = (fail_stack_elt_t *) malloc (fail_stack.size
03014                        * sizeof (fail_stack_elt_t));
03015     else
03016       fail_stack.stack
03017         = (fail_stack_elt_t *) realloc (fail_stack.stack,
03018                         (fail_stack.size
03019                          * sizeof (fail_stack_elt_t)));
03020 #endif /* not emacs */
03021       }
03022
03023     regex_grow_registers (num_regs);
03024   }
03025 #endif /* not MATCH_MAY_ALLOCATE */
03026
03027   return REG_NOERROR;
03028 } /* regex_compile */
03029
03030 /* Subroutines for `regex_compile'.  */
03031
03032 /* Store OP at LOC followed by two-byte integer parameter ARG.  */
03033
03034 static void
03035 store_op1 (op, loc, arg)
03036     re_opcode_t op;
03037     unsigned char *loc;
03038     int arg;
03039 {
03040   *loc = (unsigned char) op;
03041   STORE_NUMBER (loc + 1, arg);
03042 }
03043
03044
03045 /* Like `store_op1', but for two two-byte parameters ARG1 and ARG2.  */
03046
03047 static void
03048 store_op2 (op, loc, arg1, arg2)
03049     re_opcode_t op;
03050     unsigned char *loc;
03051     int arg1, arg2;
03052 {
03053   *loc = (unsigned char) op;
03054   STORE_NUMBER (loc + 1, arg1);
03055   STORE_NUMBER (loc + 3, arg2);
03056 }
03057
03058
03059 /* Copy the bytes from LOC to END to open up three bytes of space at LOC
03060    for OP followed by two-byte integer parameter ARG.  */
03061
03062 static void
03063 insert_op1 (op, loc, arg, end)
03064     re_opcode_t op;
03065     unsigned char *loc;
03066     int arg;
03067     unsigned char *end;
03068 {
03069   register unsigned char *pfrom = end;
03070   register unsigned char *pto = end + 3;
03071
03072   while (pfrom != loc)
03073     *--pto = *--pfrom;
03074
03075   store_op1 (op, loc, arg);
03076 }
03077
03078
03079 /* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2.  */
03080
03081 static void
03082 insert_op2 (op, loc, arg1, arg2, end)
03083     re_opcode_t op;
03084     unsigned char *loc;
03085     int arg1, arg2;
03086     unsigned char *end;
03087 {
03088   register unsigned char *pfrom = end;
03089   register unsigned char *pto = end + 5;
03090
03091   while (pfrom != loc)
03092     *--pto = *--pfrom;
03093
03094   store_op2 (op, loc, arg1, arg2);
03095 }
03096
03097
03098 /* P points to just after a ^ in PATTERN.  Return true if that ^ comes
03099    after an alternative or a begin-subexpression.  We assume there is at
03100    least one character before the ^.  */
03101
03102 static boolean
03103 at_begline_loc_p (pattern, p, syntax)
03104     const char *pattern, *p;
03105     reg_syntax_t syntax;
03106 {
03107   const char *prev = p - 2;
03108   boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
03109
03110   return
03111        /* After a subexpression?  */
03112        (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
03113        /* After an alternative?  */
03114     || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
03115 }
03116
03117
03118 /* The dual of at_begline_loc_p.  This one is for $.  We assume there is
03119    at least one character after the $, i.e., `P < PEND'.  */
03120
03121 static boolean
03122 at_endline_loc_p (p, pend, syntax)
03123     const char *p, *pend;
03124     int syntax;
03125 {
03126   const char *next = p;
03127   boolean next_backslash = *next == '\\';
03128   const char *next_next = p + 1 < pend ? p + 1 : 0;
03129
03130   return
03131        /* Before a subexpression?  */
03132        (syntax & RE_NO_BK_PARENS ? *next == ')'
03133     : next_backslash && next_next && *next_next == ')')
03134        /* Before an alternative?  */
03135     || (syntax & RE_NO_BK_VBAR ? *next == '|'
03136     : next_backslash && next_next && *next_next == '|');
03137 }
03138
03139
03140 /* Returns true if REGNUM is in one of COMPILE_STACK's elements and
03141    false if it's not.  */
03142
03143 static boolean
03144 group_in_compile_stack (compile_stack, regnum)
03145     compile_stack_type compile_stack;
03146     regnum_t regnum;
03147 {
03148   int this_element;
03149
03150   for (this_element = compile_stack.avail - 1;
03151        this_element >= 0;
03152        this_element--)
03153     if (compile_stack.stack[this_element].regnum == regnum)
03154       return true;
03155
03156   return false;
03157 }
03158
03159 /* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
03160    BUFP.  A fastmap records which of the (1 << BYTEWIDTH) possible
03161    characters can start a string that matches the pattern.  This fastmap
03162    is used by re_search to skip quickly over impossible starting points.
03163
03164    The caller must supply the address of a (1 << BYTEWIDTH)-byte data
03165    area as BUFP->fastmap.
03166
03167    We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
03168    the pattern buffer.
03169
03170    Returns 0 if we succeed, -2 if an internal error.   */
03171
03172 int
03173 re_compile_fastmap (bufp)
03174      struct re_pattern_buffer *bufp;
03175 {
03176   int i, j, k;
03177 #ifdef MATCH_MAY_ALLOCATE
03178   fail_stack_type fail_stack;
03179 #endif
03180 #ifndef REGEX_MALLOC
03181   char *destination;
03182 #endif
03183   /* We don't push any register information onto the failure stack.  */
03184   unsigned num_regs = 0;
03185
03186   register char *fastmap = bufp->fastmap;
03187   unsigned char *pattern = bufp->buffer;
03188   unsigned long size = bufp->used;
03189   unsigned char *p = pattern;
03190   register unsigned char *pend = pattern + size;
03191
03192   /* This holds the pointer to the failure stack, when
03193      it is allocated relocatably.  */
03194   fail_stack_elt_t *failure_stack_ptr;
03195
03196   /* Assume that each path through the pattern can be null until
03197      proven otherwise.  We set this false at the bottom of switch
03198      statement, to which we get only if a particular path doesn't
03199      match the empty string.  */
03200   boolean path_can_be_null = true;
03201
03202   /* We aren't doing a `succeed_n' to begin with.  */
03203   boolean succeed_n_p = false;
03204
03205   /* If all elements for base leading-codes in fastmap is set, this
03206      flag is set true.  */
03207   boolean match_any_multibyte_characters = false;
03208
03209   /* Maximum code of simple (single byte) character. */
03210   int simple_char_max;
03211
03212   assert (fastmap != NULL && p != NULL);
03213
03214   INIT_FAIL_STACK ();
03215   bzero (fastmap, 1 << BYTEWIDTH);  /* Assume nothing's valid.  */
03216   bufp->fastmap_accurate = 1;       /* It will be when we're done.  */
03217   bufp->can_be_null = 0;
03218
03219   while (1)
03220     {
03221       if (p == pend || *p == succeed)
03222     {
03223       /* We have reached the (effective) end of pattern.  */
03224       if (!FAIL_STACK_EMPTY ())
03225         {
03226           bufp->can_be_null |= path_can_be_null;
03227
03228           /* Reset for next path.  */
03229           path_can_be_null = true;
03230
03231           p = fail_stack.stack[--fail_stack.avail].pointer;
03232
03233           continue;
03234         }
03235       else
03236         break;
03237     }
03238
03239       /* We should never be about to go beyond the end of the pattern.  */
03240       assert (p < pend);
03241
03242       switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
03243     {
03244
03245     /* I guess the idea here is to simply not bother with a fastmap
03246        if a backreference is used, since it's too hard to figure out
03247        the fastmap for the corresponding group.  Setting
03248        `can_be_null' stops `re_search_2' from using the fastmap, so
03249        that is all we do.  */
03250     case duplicate:
03251       bufp->can_be_null = 1;
03252       goto done;
03253
03254
03255       /* Following are the cases which match a character.  These end
03256      with `break'.  */
03257
03258     case exactn:
03259       fastmap[p[1]] = 1;
03260       break;
03261
03262
03263 #ifndef emacs
03264     case charset:
03265       for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
03266         if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
03267           fastmap[j] = 1;
03268       break;
03269
03270
03271     case charset_not:
03272       /* Chars beyond end of map must be allowed.  */
03273       for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
03274         fastmap[j] = 1;
03275
03276       for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
03277         if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
03278           fastmap[j] = 1;
03279       break;
03280
03281
03282     case wordchar:
03283       for (j = 0; j < (1 << BYTEWIDTH); j++)
03284         if (SYNTAX (j) == Sword)
03285           fastmap[j] = 1;
03286       break;
03287
03288
03289     case notwordchar:
03290       for (j = 0; j < (1 << BYTEWIDTH); j++)
03291         if (SYNTAX (j) != Sword)
03292           fastmap[j] = 1;
03293       break;
03294 #else  /* emacs */
03295     case charset:
03296       for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH - 1, p++;
03297            j >= 0; j--)
03298         if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
03299           fastmap[j] = 1;
03300
03301       if (CHARSET_RANGE_TABLE_EXISTS_P (&p[-2])
03302           && match_any_multibyte_characters == false)
03303         {
03304           /* Set fastmap[I] 1 where I is a base leading code of each
03305          multibyte character in the range table. */
03306           int c, count;
03307
03308           /* Make P points the range table. */
03309           p += CHARSET_BITMAP_SIZE (&p[-2]);
03310
03311           /* Extract the number of ranges in range table into
03312          COUNT.  */
03313           EXTRACT_NUMBER_AND_INCR (count, p);
03314           for (; count > 0; count--, p += 2 * 3) /* XXX */
03315         {
03316           /* Extract the start of each range.  */
03317           EXTRACT_CHARACTER (c, p);
03318           j = CHAR_CHARSET (c);
03319           fastmap[CHARSET_LEADING_CODE_BASE (j)] = 1;
03320         }
03321         }
03322       break;
03323
03324
03325     case charset_not:
03326       /* Chars beyond end of bitmap are possible matches.
03327          All the single-byte codes can occur in multibyte buffers.
03328          So any that are not listed in the charset
03329          are possible matches, even in multibyte buffers.  */
03330       simple_char_max = (1 << BYTEWIDTH);
03331       for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH;
03332            j < simple_char_max; j++)
03333         fastmap[j] = 1;
03334
03335       for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH - 1, p++;
03336            j >= 0; j--)
03337         if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
03338           fastmap[j] = 1;
03339
03340       if (bufp->multibyte)
03341         /* Any character set can possibly contain a character
03342            which doesn't match the specified set of characters.  */
03343         {
03344         set_fastmap_for_multibyte_characters:
03345           if (match_any_multibyte_characters == false)
03346         {
03347           for (j = 0x80; j < 0xA0; j++) /* XXX */
03348             if (BASE_LEADING_CODE_P (j))
03349               fastmap[j] = 1;
03350           match_any_multibyte_characters = true;
03351         }
03352         }
03353       break;
03354
03355
03356     case wordchar:
03357       /* All the single-byte codes can occur in multibyte buffers,
03358          and they may have word syntax.  So do consider them.  */
03359       simple_char_max = (1 << BYTEWIDTH);
03360       for (j = 0; j < simple_char_max; j++)
03361         if (SYNTAX (j) == Sword)
03362           fastmap[j] = 1;
03363
03364       if (bufp->multibyte)
03365         /* Any character set can possibly contain a character
03366            whose syntax is `Sword'.  */
03367         goto set_fastmap_for_multibyte_characters;
03368       break;
03369
03370
03371     case notwordchar:
03372       /* All the single-byte codes can occur in multibyte buffers,
03373          and they may not have word syntax.  So do consider them.  */
03374       simple_char_max = (1 << BYTEWIDTH);
03375       for (j = 0; j < simple_char_max; j++)
03376         if (SYNTAX (j) != Sword)
03377           fastmap[j] = 1;
03378
03379       if (bufp->multibyte)
03380         /* Any character set can possibly contain a character
03381            whose syntax is not `Sword'.  */
03382         goto set_fastmap_for_multibyte_characters;
03383       break;
03384 #endif
03385
03386     case anychar:
03387       {
03388         int fastmap_newline = fastmap['\n'];
03389
03390         /* `.' matches anything, except perhaps newline.
03391            Even in a multibyte buffer, it should match any
03392            conceivable byte value for the fastmap.  */
03393         if (bufp->multibyte)
03394           match_any_multibyte_characters = true;
03395
03396         simple_char_max = (1 << BYTEWIDTH);
03397         for (j = 0; j < simple_char_max; j++)
03398           fastmap[j] = 1;
03399
03400         /* ... except perhaps newline.  */
03401         if (!(bufp->syntax & RE_DOT_NEWLINE))
03402           fastmap['\n'] = fastmap_newline;
03403
03404         /* Return if we have already set `can_be_null'; if we have,
03405            then the fastmap is irrelevant.  Something's wrong here.  */
03406         else if (bufp->can_be_null)
03407           goto done;
03408
03409         /* Otherwise, have to check alternative paths.  */
03410         break;
03411       }
03412
03413 #ifdef emacs
03414     case wordbound:
03415     case notwordbound:
03416     case wordbeg:
03417     case wordend:
03418     case notsyntaxspec:
03419     case syntaxspec:
03420       /* This match depends on text properties.  These end with
03421          aborting optimizations.  */
03422       bufp->can_be_null = 1;
03423       goto done;
03424 #if 0
03425       k = *p++;
03426       simple_char_max = bufp->multibyte ? 0x80 : (1 << BYTEWIDTH);
03427       for (j = 0; j < simple_char_max; j++)
03428         if (SYNTAX (j) == (enum syntaxcode) k)
03429           fastmap[j] = 1;
03430
03431       if (bufp->multibyte)
03432         /* Any character set can possibly contain a character
03433            whose syntax is K.  */
03434         goto set_fastmap_for_multibyte_characters;
03435       break;
03436
03437     case notsyntaxspec:
03438       k = *p++;
03439       simple_char_max = bufp->multibyte ? 0x80 : (1 << BYTEWIDTH);
03440       for (j = 0; j < simple_char_max; j++)
03441         if (SYNTAX (j) != (enum syntaxcode) k)
03442           fastmap[j] = 1;
03443
03444       if (bufp->multibyte)
03445         /* Any character set can possibly contain a character
03446            whose syntax is not K.  */
03447         goto set_fastmap_for_multibyte_characters;
03448       break;
03449 #endif
03450
03451
03452     case categoryspec:
03453       k = *p++;
03454       simple_char_max = (1 << BYTEWIDTH);
03455       for (j = 0; j < simple_char_max; j++)
03456         if (CHAR_HAS_CATEGORY (j, k))
03457           fastmap[j] = 1;
03458
03459       if (bufp->multibyte)
03460         /* Any character set can possibly contain a character
03461            whose category is K.  */
03462         goto set_fastmap_for_multibyte_characters;
03463       break;
03464
03465
03466     case notcategoryspec:
03467       k = *p++;
03468       simple_char_max = (1 << BYTEWIDTH);
03469       for (j = 0; j < simple_char_max; j++)
03470         if (!CHAR_HAS_CATEGORY (j, k))
03471           fastmap[j] = 1;
03472
03473       if (bufp->multibyte)
03474         /* Any character set can possibly contain a character
03475            whose category is not K.  */
03476         goto set_fastmap_for_multibyte_characters;
03477       break;
03478
03479       /* All cases after this match the empty string.  These end with
03480      `continue'.  */
03481
03482
03483     case before_dot:
03484     case at_dot:
03485     case after_dot:
03486       continue;
03487 #endif /* emacs */
03488
03489
03490     case no_op:
03491     case begline:
03492     case endline:
03493     case begbuf:
03494     case endbuf:
03495 #ifndef emacs
03496     case wordbound:
03497     case notwordbound:
03498     case wordbeg:
03499     case wordend:
03500 #endif
03501     case push_dummy_failure:
03502       continue;
03503
03504
03505     case jump_n:
03506     case pop_failure_jump:
03507     case maybe_pop_jump:
03508     case jump:
03509     case jump_past_alt:
03510     case dummy_failure_jump:
03511       EXTRACT_NUMBER_AND_INCR (j, p);
03512       p += j;
03513       if (j > 0)
03514         continue;
03515
03516       /* Jump backward implies we just went through the body of a
03517          loop and matched nothing.  Opcode jumped to should be
03518          `on_failure_jump' or `succeed_n'.  Just treat it like an
03519          ordinary jump.  For a * loop, it has pushed its failure
03520          point already; if so, discard that as redundant.  */
03521       if ((re_opcode_t) *p != on_failure_jump
03522           && (re_opcode_t) *p != succeed_n)
03523         continue;
03524
03525       p++;
03526       EXTRACT_NUMBER_AND_INCR (j, p);
03527       p += j;
03528
03529       /* If what's on the stack is where we are now, pop it.  */
03530       if (!FAIL_STACK_EMPTY ()
03531           && fail_stack.stack[fail_stack.avail - 1].pointer == p)
03532         fail_stack.avail--;
03533
03534       continue;
03535
03536
03537     case on_failure_jump:
03538     case on_failure_keep_string_jump:
03539     handle_on_failure_jump:
03540       EXTRACT_NUMBER_AND_INCR (j, p);
03541
03542       /* For some patterns, e.g., `(a?)?', `p+j' here points to the
03543          end of the pattern.  We don't want to push such a point,
03544          since when we restore it above, entering the switch will
03545          increment `p' past the end of the pattern.  We don't need
03546          to push such a point since we obviously won't find any more
03547          fastmap entries beyond `pend'.  Such a pattern can match
03548          the null string, though.  */
03549       if (p + j < pend)
03550         {
03551           if (!PUSH_PATTERN_OP (p + j, fail_stack))
03552         {
03553           RESET_FAIL_STACK ();
03554           return -2;
03555         }
03556         }
03557       else
03558         bufp->can_be_null = 1;
03559
03560       if (succeed_n_p)
03561         {
03562           EXTRACT_NUMBER_AND_INCR (k, p);   /* Skip the n.  */
03563           succeed_n_p = false;
03564         }
03565
03566       continue;
03567
03568
03569     case succeed_n:
03570       /* Get to the number of times to succeed.  */
03571       p += 2;
03572
03573       /* Increment p past the n for when k != 0.  */
03574       EXTRACT_NUMBER_AND_INCR (k, p);
03575       if (k == 0)
03576         {
03577           p -= 4;
03578           succeed_n_p = true;  /* Spaghetti code alert.  */
03579           goto handle_on_failure_jump;
03580         }
03581       continue;
03582
03583
03584     case set_number_at:
03585       p += 4;
03586       continue;
03587
03588
03589     case start_memory:
03590     case stop_memory:
03591       p += 2;
03592       continue;
03593
03594
03595     default:
03596       abort (); /* We have listed all the cases.  */
03597     } /* switch *p++ */
03598
03599       /* Getting here means we have found the possible starting
03600      characters for one path of the pattern -- and that the empty
03601      string does not match.  We need not follow this path further.
03602      Instead, look at the next alternative (remembered on the
03603      stack), or quit if no more.  The test at the top of the loop
03604      does these things.  */
03605       path_can_be_null = false;
03606       p = pend;
03607     } /* while p */
03608
03609   /* Set `can_be_null' for the last path (also the first path, if the
03610      pattern is empty).  */
03611   bufp->can_be_null |= path_can_be_null;
03612
03613  done:
03614   RESET_FAIL_STACK ();
03615   return 0;
03616 } /* re_compile_fastmap */
03617
03618 /* Set REGS to hold NUM_REGS registers, storing them in STARTS and
03619    ENDS.  Subsequent matches using PATTERN_BUFFER and REGS will use
03620    this memory for recording register information.  STARTS and ENDS
03621    must be allocated using the malloc library routine, and must each
03622    be at least NUM_REGS * sizeof (regoff_t) bytes long.
03623
03624    If NUM_REGS == 0, then subsequent matches should allocate their own
03625    register data.
03626
03627    Unless this function is called, the first search or match using
03628    PATTERN_BUFFER will allocate its own register data, without
03629    freeing the old data.  */
03630
03631 void
03632 re_set_registers (bufp, regs, num_regs, starts, ends)
03633     struct re_pattern_buffer *bufp;
03634     struct re_registers *regs;
03635     unsigned num_regs;
03636     regoff_t *starts, *ends;
03637 {
03638   if (num_regs)
03639     {
03640       bufp->regs_allocated = REGS_REALLOCATE;
03641       regs->num_regs = num_regs;
03642       regs->start = starts;
03643       regs->end = ends;
03644     }
03645   else
03646     {
03647       bufp->regs_allocated = REGS_UNALLOCATED;
03648       regs->num_regs = 0;
03649       regs->start = regs->end = (regoff_t *) 0;
03650     }
03651 }
03652
03653 /* Searching routines.  */
03654
03655 /* Like re_search_2, below, but only one string is specified, and
03656    doesn't let you say where to stop matching. */
03657
03658 int
03659 re_search (bufp, string, size, startpos, range, regs)
03660      struct re_pattern_buffer *bufp;
03661      const char *string;
03662      int size, startpos, range;
03663      struct re_registers *regs;
03664 {
03665   return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
03666               regs, size);
03667 }
03668
03669 /* End address of virtual concatenation of string.  */
03670 #define STOP_ADDR_VSTRING(P)                \
03671   (((P) >= size1 ? string2 + size2 : string1 + size1))
03672
03673 /* Address of POS in the concatenation of virtual string. */
03674 #define POS_ADDR_VSTRING(POS)                   \
03675   (((POS) >= size1 ? string2 - size1 : string1) + (POS))
03676
03677 /* Using the compiled pattern in BUFP->buffer, first tries to match the
03678    virtual concatenation of STRING1 and STRING2, starting first at index
03679    STARTPOS, then at STARTPOS + 1, and so on.
03680
03681    STRING1 and STRING2 have length SIZE1 and SIZE2, respectively.
03682
03683    RANGE is how far to scan while trying to match.  RANGE = 0 means try
03684    only at STARTPOS; in general, the last start tried is STARTPOS +
03685    RANGE.
03686
03687    In REGS, return the indices of the virtual concatenation of STRING1
03688    and STRING2 that matched the entire BUFP->buffer and its contained
03689    subexpressions.
03690
03691    Do not consider matching one past the index STOP in the virtual
03692    concatenation of STRING1 and STRING2.
03693
03694    We return either the position in the strings at which the match was
03695    found, -1 if no match, or -2 if error (such as failure
03696    stack overflow).  */
03697
03698 int
03699 re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
03700      struct re_pattern_buffer *bufp;
03701      const char *string1, *string2;
03702      int size1, size2;
03703      int startpos;
03704      int range;
03705      struct re_registers *regs;
03706      int stop;
03707 {
03708   int val;
03709   register char *fastmap = bufp->fastmap;
03710   register RE_TRANSLATE_TYPE translate = bufp->translate;
03711   int total_size = size1 + size2;
03712   int endpos = startpos + range;
03713   int anchored_start = 0;
03714
03715   /* Nonzero if we have to concern multibyte character.  */
03716   int multibyte = bufp->multibyte;
03717
03718   /* Check for out-of-range STARTPOS.  */
03719   if (startpos < 0 || startpos > total_size)
03720     return -1;
03721
03722   /* Fix up RANGE if it might eventually take us outside
03723      the virtual concatenation of STRING1 and STRING2.
03724      Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE.  */
03725   if (endpos < 0)
03726     range = 0 - startpos;
03727   else if (endpos > total_size)
03728     range = total_size - startpos;
03729
03730   /* If the search isn't to be a backwards one, don't waste time in a
03731      search for a pattern anchored at beginning of buffer.  */
03732   if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0)
03733     {
03734       if (startpos > 0)
03735     return -1;
03736       else
03737     range = 0;
03738     }
03739
03740 #ifdef emacs
03741   /* In a forward search for something that starts with \=.
03742      don't keep searching past point.  */
03743   if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0)
03744     {
03745       range = PT_BYTE - BEGV_BYTE - startpos;
03746       if (range < 0)
03747     return -1;
03748     }
03749 #endif /* emacs */
03750
03751   /* Update the fastmap now if not correct already.  */
03752   if (fastmap && !bufp->fastmap_accurate)
03753     if (re_compile_fastmap (bufp) == -2)
03754       return -2;
03755
03756   /* See whether the pattern is anchored.  */
03757   if (bufp->buffer[0] == begline)
03758     anchored_start = 1;
03759
03760 #ifdef emacs
03761   gl_state.object = re_match_object;
03762   {
03763     int adjpos = NILP (re_match_object) || BUFFERP (re_match_object);
03764     int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (startpos + adjpos);
03765
03766     SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1);
03767   }
03768 #endif
03769
03770   /* Loop through the string, looking for a place to start matching.  */
03771   for (;;)
03772     {
03773       /* If the pattern is anchored,
03774      skip quickly past places we cannot match.
03775      We don't bother to treat startpos == 0 specially
03776      because that case doesn't repeat.  */
03777       if (anchored_start && startpos > 0)
03778     {
03779       if (! (bufp->newline_anchor
03780          && ((startpos <= size1 ? string1[startpos - 1]
03781               : string2[startpos - size1 - 1])
03782              == '\n')))
03783         goto advance;
03784     }
03785
03786       /* If a fastmap is supplied, skip quickly over characters that
03787      cannot be the start of a match.  If the pattern can match the
03788      null string, however, we don't need to skip characters; we want
03789      the first null string.  */
03790       if (fastmap && startpos < total_size && !bufp->can_be_null)
03791     {
03792       register const char *d;
03793       register unsigned int buf_ch;
03794
03795       d = POS_ADDR_VSTRING (startpos);
03796
03797       if (range > 0)    /* Searching forwards.  */
03798         {
03799           register int lim = 0;
03800           int irange = range;
03801
03802           if (startpos < size1 && startpos + range >= size1)
03803         lim = range - (size1 - startpos);
03804
03805           /* Written out as an if-else to avoid testing `translate'
03806          inside the loop.  */
03807           if (RE_TRANSLATE_P (translate))
03808         {
03809           if (multibyte)
03810             while (range > lim)
03811               {
03812             int buf_charlen;
03813
03814             buf_ch = STRING_CHAR_AND_LENGTH (d, range - lim,
03815                              buf_charlen);
03816
03817             buf_ch = RE_TRANSLATE (translate, buf_ch);
03818             if (buf_ch >= 0400
03819                 || fastmap[buf_ch])
03820               break;
03821
03822             range -= buf_charlen;
03823             d += buf_charlen;
03824               }
03825           else
03826             while (range > lim
03827                && !fastmap[(unsigned char)
03828                        RE_TRANSLATE (translate, (unsigned char) *d)])
03829               {
03830             d++;
03831             range--;
03832               }
03833         }
03834           else
03835         while (range > lim && !fastmap[(unsigned char) *d])
03836           {
03837             d++;
03838             range--;
03839           }
03840
03841           startpos += irange - range;
03842         }
03843       else              /* Searching backwards.  */
03844         {
03845           int room = (size1 == 0 || startpos >= size1
03846               ? size2 + size1 - startpos
03847               : size1 - startpos);
03848
03849           buf_ch = STRING_CHAR (d, room);
03850           if (RE_TRANSLATE_P (translate))
03851         buf_ch = RE_TRANSLATE (translate, buf_ch);
03852
03853           if (! (buf_ch >= 0400
03854              || fastmap[buf_ch]))
03855         goto advance;
03856         }
03857     }
03858
03859       /* If can't match the null string, and that's all we have left, fail.  */
03860       if (range >= 0 && startpos == total_size && fastmap
03861       && !bufp->can_be_null)
03862     return -1;
03863
03864       val = re_match_2_internal (bufp, string1, size1, string2, size2,
03865                  startpos, regs, stop);
03866 #ifndef REGEX_MALLOC
03867 #ifdef C_ALLOCA
03868       alloca (0);
03869 #endif
03870 #endif
03871
03872       if (val >= 0)
03873     return startpos;
03874
03875       if (val == -2)
03876     return -2;
03877
03878     advance:
03879       if (!range)
03880     break;
03881       else if (range > 0)
03882     {
03883       /* Update STARTPOS to the next character boundary.  */
03884       if (multibyte)
03885         {
03886           const unsigned char *p
03887         = (const unsigned char *) POS_ADDR_VSTRING (startpos);
03888           const unsigned char *pend
03889         = (const unsigned char *) STOP_ADDR_VSTRING (startpos);
03890           int len = MULTIBYTE_FORM_LENGTH (p, pend - p);
03891
03892           range -= len;
03893           if (range < 0)
03894         break;
03895           startpos += len;
03896         }
03897       else
03898         {
03899           range--;
03900           startpos++;
03901         }
03902     }
03903       else
03904     {
03905       range++;
03906       startpos--;
03907
03908       /* Update STARTPOS to the previous character boundary.  */
03909       if (multibyte)
03910         {
03911           const unsigned char *p
03912         = (const unsigned char *) POS_ADDR_VSTRING (startpos);
03913           int len = 0;
03914
03915           /* Find the head of multibyte form.  */
03916           while (!CHAR_HEAD_P (*p))
03917         p--, len++;
03918
03919           /* Adjust it. */
03920 #if 0               /* XXX */
03921           if (MULTIBYTE_FORM_LENGTH (p, len + 1) != (len + 1))
03922         ;
03923           else
03924 #endif
03925         {
03926           range += len;
03927           if (range > 0)
03928             break;
03929
03930           startpos -= len;
03931         }
03932         }
03933     }
03934     }
03935   return -1;
03936 } /* re_search_2 */
03937
03938 /* Declarations and macros for re_match_2.  */
03939
03940 static int bcmp_translate ();
03941 static boolean alt_match_null_string_p (),
03942            common_op_match_null_string_p (),
03943            group_match_null_string_p ();
03944
03945 /* This converts PTR, a pointer into one of the search strings `string1'
03946    and `string2' into an offset from the beginning of that string.  */
03947 #define POINTER_TO_OFFSET(ptr)          \
03948   (FIRST_STRING_P (ptr)             \
03949    ? ((regoff_t) ((ptr) - string1))     \
03950    : ((regoff_t) ((ptr) - string2 + size1)))
03951
03952 /* Macros for dealing with the split strings in re_match_2.  */
03953
03954 #define MATCHING_IN_FIRST_STRING  (dend == end_match_1)
03955
03956 /* Call before fetching a character with *d.  This switches over to
03957    string2 if necessary.  */
03958 #define PREFETCH()                          \
03959   while (d == dend)                         \
03960     {                                   \
03961       /* End of string2 => fail.  */                    \
03962       if (dend == end_match_2)                      \
03963     goto fail;                          \
03964       /* End of string1 => advance to string2.  */          \
03965       d = string2;                          \
03966       dend = end_match_2;                       \
03967     }
03968
03969
03970 /* Test if at very beginning or at very end of the virtual concatenation
03971    of `string1' and `string2'.  If only one string, it's `string2'.  */
03972 #define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
03973 #define AT_STRINGS_END(d) ((d) == end2)
03974
03975
03976 /* Test if D points to a character which is word-constituent.  We have
03977    two special cases to check for: if past the end of string1, look at
03978    the first character in string2; and if before the beginning of
03979    string2, look at the last character in string1.  */
03980 #define WORDCHAR_P(d)                           \
03981   (SYNTAX ((d) == end1 ? *string2                   \
03982        : (d) == string2 - 1 ? *(end1 - 1) : *(d))           \
03983    == Sword)
03984
03985 /* Disabled due to a compiler bug -- see comment at case wordbound */
03986
03987 /* The comment at case wordbound is following one, but we don't use
03988    AT_WORD_BOUNDARY anymore to support multibyte form.
03989
03990    The DEC Alpha C compiler 3.x generates incorrect code for the
03991    test  WORDCHAR_P (d - 1) != WORDCHAR_P (d)  in the expansion of
03992    AT_WORD_BOUNDARY, so this code is disabled.  Expanding the
03993    macro and introducing temporary variables works around the bug.  */
03994
03995 #if 0
03996 /* Test if the character before D and the one at D differ with respect
03997    to being word-constituent.  */
03998 #define AT_WORD_BOUNDARY(d)                     \
03999   (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)             \
04000    || WORDCHAR_P (d - 1) != WORDCHAR_P (d))
04001 #endif
04002
04003 /* Free everything we malloc.  */
04004 #ifdef MATCH_MAY_ALLOCATE
04005 #define FREE_VAR(var) if (var) { REGEX_FREE (var); var = NULL; } else
04006 #define FREE_VARIABLES()                        \
04007   do {                                  \
04008     REGEX_FREE_STACK (fail_stack.stack);                \
04009     FREE_VAR (regstart);                        \
04010     FREE_VAR (regend);                          \
04011     FREE_VAR (old_regstart);                        \
04012     FREE_VAR (old_regend);                      \
04013     FREE_VAR (best_regstart);                       \
04014     FREE_VAR (best_regend);                     \
04015     FREE_VAR (reg_info);                        \
04016     FREE_VAR (reg_dummy);                       \
04017     FREE_VAR (reg_info_dummy);                      \
04018   } while (0)
04019 #else
04020 #define FREE_VARIABLES() ((void)0) /* Do nothing!  But inhibit gcc warning.  */
04021 #endif /* not MATCH_MAY_ALLOCATE */
04022
04023 /* These values must meet several constraints.  They must not be valid
04024    register values; since we have a limit of 255 registers (because
04025    we use only one byte in the pattern for the register number), we can
04026    use numbers larger than 255.  They must differ by 1, because of
04027    NUM_FAILURE_ITEMS above.  And the value for the lowest register must
04028    be larger than the value for the highest register, so we do not try
04029    to actually save any registers when none are active.  */
04030 #define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
04031 #define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)
04032
04033 /* Matching routines.  */
04034
04035 #ifndef emacs   /* Emacs never uses this.  */
04036 /* re_match is like re_match_2 except it takes only a single string.  */
04037
04038 int
04039 re_match (bufp, string, size, pos, regs)
04040      struct re_pattern_buffer *bufp;
04041      const char *string;
04042      int size, pos;
04043      struct re_registers *regs;
04044 {
04045   int result = re_match_2_internal (bufp, NULL, 0, string, size,
04046                     pos, regs, size);
04047 #ifndef REGEX_MALLOC    /* CVS */
04048 #ifdef C_ALLOCA     /* CVS */
04049   alloca (0);
04050 #endif          /* CVS */
04051 #endif          /* CVS */
04052   return result;
04053 }
04054 #endif /* not emacs */
04055
04056 #ifdef emacs
04057 /* In Emacs, this is the string or buffer in which we
04058    are matching.  It is used for looking up syntax properties.  */
04059 Lisp_Object re_match_object;
04060 #endif
04061
04062 /* re_match_2 matches the compiled pattern in BUFP against the
04063    the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
04064    and SIZE2, respectively).  We start matching at POS, and stop
04065    matching at STOP.
04066
04067    If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
04068    store offsets for the substring each group matched in REGS.  See the
04069    documentation for exactly how many groups we fill.
04070
04071    We return -1 if no match, -2 if an internal error (such as the
04072    failure stack overflowing).  Otherwise, we return the length of the
04073    matched substring.  */
04074
04075 int
04076 re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
04077      struct re_pattern_buffer *bufp;
04078      const char *string1, *string2;
04079      int size1, size2;
04080      int pos;
04081      struct re_registers *regs;
04082      int stop;
04083 {
04084   int result;
04085
04086 #ifdef emacs
04087   int charpos;
04088   int adjpos = NILP (re_match_object) || BUFFERP (re_match_object);
04089   gl_state.object = re_match_object;
04090   charpos = SYNTAX_TABLE_BYTE_TO_CHAR (pos + adjpos);
04091   SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1);
04092 #endif
04093
04094   result = re_match_2_internal (bufp, string1, size1, string2, size2,
04095                 pos, regs, stop);
04096 #ifndef REGEX_MALLOC    /* CVS */
04097 #ifdef C_ALLOCA     /* CVS */
04098   alloca (0);
04099 #endif          /* CVS */
04100 #endif          /* CVS */
04101   return result;
04102 }
04103
04104 /* This is a separate function so that we can force an alloca cleanup
04105    afterwards.  */
04106 static int
04107 re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
04108      struct re_pattern_buffer *bufp;
04109      const char *string1, *string2;
04110      int size1, size2;
04111      int pos;
04112      struct re_registers *regs;
04113      int stop;
04114 {
04115   /* General temporaries.  */
04116   int mcnt;
04117   unsigned char *p1;
04118
04119   /* Just past the end of the corresponding string.  */
04120   const char *end1, *end2;
04121
04122   /* Pointers into string1 and string2, just past the last characters in
04123      each to consider matching.  */
04124   const char *end_match_1, *end_match_2;
04125
04126   /* Where we are in the data, and the end of the current string.  */
04127   const char *d, *dend;
04128
04129   /* Where we are in the pattern, and the end of the pattern.  */
04130   unsigned char *p = bufp->buffer;
04131   register unsigned char *pend = p + bufp->used;
04132
04133   /* Mark the opcode just after a start_memory, so we can test for an
04134      empty subpattern when we get to the stop_memory.  */
04135   unsigned char *just_past_start_mem = 0;
04136
04137   /* We use this to map every character in the string.  */
04138   RE_TRANSLATE_TYPE translate = bufp->translate;
04139
04140   /* Nonzero if we have to concern multibyte character.  */
04141   int multibyte = bufp->multibyte;
04142
04143   /* Failure point stack.  Each place that can handle a failure further
04144      down the line pushes a failure point on this stack.  It consists of
04145      restart, regend, and reg_info for all registers corresponding to
04146      the subexpressions we're currently inside, plus the number of such
04147      registers, and, finally, two char *'s.  The first char * is where
04148      to resume scanning the pattern; the second one is where to resume
04149      scanning the strings.  If the latter is zero, the failure point is
04150      a ``dummy''; if a failure happens and the failure point is a dummy,
04151      it gets discarded and the next next one is tried.  */
04152 #ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global.  */
04153   fail_stack_type fail_stack;
04154 #endif
04155 #ifdef DEBUG
04156   static unsigned failure_id = 0;
04157   unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
04158 #endif
04159
04160   /* This holds the pointer to the failure stack, when
04161      it is allocated relocatably.  */
04162   fail_stack_elt_t *failure_stack_ptr;
04163
04164   /* We fill all the registers internally, independent of what we
04165      return, for use in backreferences.  The number here includes
04166      an element for register zero.  */
04167   unsigned num_regs = bufp->re_nsub + 1;
04168
04169   /* The currently active registers.  */
04170   unsigned lowest_active_reg = NO_LOWEST_ACTIVE_REG;
04171   unsigned highest_active_reg = NO_HIGHEST_ACTIVE_REG;
04172
04173   /* Information on the contents of registers. These are pointers into
04174      the input strings; they record just what was matched (on this
04175      attempt) by a subexpression part of the pattern, that is, the
04176      regnum-th regstart pointer points to where in the pattern we began
04177      matching and the regnum-th regend points to right after where we
04178      stopped matching the regnum-th subexpression.  (The zeroth register
04179      keeps track of what the whole pattern matches.)  */
04180 #ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global.  */
04181   const char **regstart, **regend;
04182 #endif
04183
04184   /* If a group that's operated upon by a repetition operator fails to
04185      match anything, then the register for its start will need to be
04186      restored because it will have been set to wherever in the string we
04187      are when we last see its open-group operator.  Similarly for a
04188      register's end.  */
04189 #ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global.  */
04190   const char **old_regstart, **old_regend;
04191 #endif
04192
04193   /* The is_active field of reg_info helps us keep track of which (possibly
04194      nested) subexpressions we are currently in. The matched_something
04195      field of reg_info[reg_num] helps us tell whether or not we have
04196      matched any of the pattern so far this time through the reg_num-th
04197      subexpression.  These two fields get reset each time through any
04198      loop their register is in.  */
04199 #ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global.  */
04200   register_info_type *reg_info;
04201 #endif
04202
04203   /* The following record the register info as found in the above
04204      variables when we find a match better than any we've seen before.
04205      This happens as we backtrack through the failure points, which in
04206      turn happens only if we have not yet matched the entire string. */
04207   unsigned best_regs_set = false;
04208 #ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global.  */
04209   const char **best_regstart, **best_regend;
04210 #endif
04211
04212   /* Logically, this is `best_regend[0]'.  But we don't want to have to
04213      allocate space for that if we're not allocating space for anything
04214      else (see below).  Also, we never need info about register 0 for
04215      any of the other register vectors, and it seems rather a kludge to
04216      treat `best_regend' differently than the rest.  So we keep track of
04217      the end of the best match so far in a separate variable.  We
04218      initialize this to NULL so that when we backtrack the first time
04219      and need to test it, it's not garbage.  */
04220   const char *match_end = NULL;
04221
04222   /* This helps SET_REGS_MATCHED avoid doing redundant work.  */
04223   int set_regs_matched_done = 0;
04224
04225   /* Used when we pop values we don't care about.  */
04226 #ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global.  */
04227   const char **reg_dummy;
04228   register_info_type *reg_info_dummy;
04229 #endif
04230
04231 #ifdef DEBUG
04232   /* Counts the total number of registers pushed.  */
04233   unsigned num_regs_pushed = 0;
04234 #endif
04235
04236   DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
04237
04238   INIT_FAIL_STACK ();
04239
04240 #ifdef MATCH_MAY_ALLOCATE
04241   /* Do not bother to initialize all the register variables if there are
04242      no groups in the pattern, as it takes a fair amount of time.  If
04243      there are groups, we include space for register 0 (the whole
04244      pattern), even though we never use it, since it simplifies the
04245      array indexing.  We should fix this.  */
04246   if (bufp->re_nsub)
04247     {
04248       regstart = REGEX_TALLOC (num_regs, const char *);
04249       regend = REGEX_TALLOC (num_regs, const char *);
04250       old_regstart = REGEX_TALLOC (num_regs, const char *);
04251       old_regend = REGEX_TALLOC (num_regs, const char *);
04252       best_regstart = REGEX_TALLOC (num_regs, const char *);
04253       best_regend = REGEX_TALLOC (num_regs, const char *);
04254       reg_info = REGEX_TALLOC (num_regs, register_info_type);
04255       reg_dummy = REGEX_TALLOC (num_regs, const char *);
04256       reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type);
04257
04258       if (!(regstart && regend && old_regstart && old_regend && reg_info
04259         && best_regstart && best_regend && reg_dummy && reg_info_dummy))
04260     {
04261       FREE_VARIABLES ();
04262       return -2;
04263     }
04264     }
04265   else
04266     {
04267       /* We must initialize all our variables to NULL, so that
04268      `FREE_VARIABLES' doesn't try to free them.  */
04269       regstart = regend = old_regstart = old_regend = best_regstart
04270     = best_regend = reg_dummy = NULL;
04271       reg_info = reg_info_dummy = (register_info_type *) NULL;
04272     }
04273 #endif /* MATCH_MAY_ALLOCATE */
04274
04275   /* The starting position is bogus.  */
04276   if (pos < 0 || pos > size1 + size2)
04277     {
04278       FREE_VARIABLES ();
04279       return -1;
04280     }
04281
04282   /* Initialize subexpression text positions to -1 to mark ones that no
04283      start_memory/stop_memory has been seen for. Also initialize the
04284      register information struct.  */
04285   for (mcnt = 1; mcnt < num_regs; mcnt++)
04286     {
04287       regstart[mcnt] = regend[mcnt]
04288     = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
04289
04290       REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
04291       IS_ACTIVE (reg_info[mcnt]) = 0;
04292       MATCHED_SOMETHING (reg_info[mcnt]) = 0;
04293       EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0;
04294     }
04295
04296   /* We move `string1' into `string2' if the latter's empty -- but not if
04297      `string1' is null.  */
04298   if (size2 == 0 && string1 != NULL)
04299     {
04300       string2 = string1;
04301       size2 = size1;
04302       string1 = 0;
04303       size1 = 0;
04304     }
04305   end1 = string1 + size1;
04306   end2 = string2 + size2;
04307
04308   /* Compute where to stop matching, within the two strings.  */
04309   if (stop <= size1)
04310     {
04311       end_match_1 = string1 + stop;
04312       end_match_2 = string2;
04313     }
04314   else
04315     {
04316       end_match_1 = end1;
04317       end_match_2 = string2 + stop - size1;
04318     }
04319
04320   /* `p' scans through the pattern as `d' scans through the data.
04321      `dend' is the end of the input string that `d' points within.  `d'
04322      is advanced into the following input string whenever necessary, but
04323      this happens before fetching; therefore, at the beginning of the
04324      loop, `d' can be pointing at the end of a string, but it cannot
04325      equal `string2'.  */
04326   if (size1 > 0 && pos <= size1)
04327     {
04328       d = string1 + pos;
04329       dend = end_match_1;
04330     }
04331   else
04332     {
04333       d = string2 + pos - size1;
04334       dend = end_match_2;
04335     }
04336
04337   DEBUG_PRINT1 ("The compiled pattern is: ");
04338   DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
04339   DEBUG_PRINT1 ("The string to match is: `");
04340   DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
04341   DEBUG_PRINT1 ("'\n");
04342
04343   /* This loops over pattern commands.  It exits by returning from the
04344      function if the match is complete, or it drops through if the match
04345      fails at this starting point in the input data.  */
04346   for (;;)
04347     {
04348       DEBUG_PRINT2 ("\n0x%x: ", p);
04349
04350       if (p == pend)
04351     { /* End of pattern means we might have succeeded.  */
04352       DEBUG_PRINT1 ("end of pattern ... ");
04353
04354       /* If we haven't matched the entire string, and we want the
04355          longest match, try backtracking.  */
04356       if (d != end_match_2)
04357         {
04358           /* 1 if this match ends in the same string (string1 or string2)
04359          as the best previous match.  */
04360           boolean same_str_p = (FIRST_STRING_P (match_end)
04361                     == MATCHING_IN_FIRST_STRING);
04362           /* 1 if this match is the best seen so far.  */
04363           boolean best_match_p;
04364
04365           /* AIX compiler got confused when this was combined
04366          with the previous declaration.  */
04367           if (same_str_p)
04368         best_match_p = d > match_end;
04369           else
04370         best_match_p = !MATCHING_IN_FIRST_STRING;
04371
04372           DEBUG_PRINT1 ("backtracking.\n");
04373
04374           if (!FAIL_STACK_EMPTY ())
04375         { /* More failure points to try.  */
04376
04377           /* If exceeds best match so far, save it.  */
04378           if (!best_regs_set || best_match_p)
04379             {
04380               best_regs_set = true;
04381               match_end = d;
04382
04383               DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
04384
04385               for (mcnt = 1; mcnt < num_regs; mcnt++)
04386             {
04387               best_regstart[mcnt] = regstart[mcnt];
04388               best_regend[mcnt] = regend[mcnt];
04389             }
04390             }
04391           goto fail;
04392         }
04393
04394           /* If no failure points, don't restore garbage.  And if
04395          last match is real best match, don't restore second
04396          best one. */
04397           else if (best_regs_set && !best_match_p)
04398         {
04399         restore_best_regs:
04400           /* Restore best match.  It may happen that `dend ==
04401              end_match_1' while the restored d is in string2.
04402              For example, the pattern `x.*y.*z' against the
04403              strings `x-' and `y-z-', if the two strings are
04404              not consecutive in memory.  */
04405           DEBUG_PRINT1 ("Restoring best registers.\n");
04406
04407           d = match_end;
04408           dend = ((d >= string1 && d <= end1)
04409                ? end_match_1 : end_match_2);
04410
04411           for (mcnt = 1; mcnt < num_regs; mcnt++)
04412             {
04413               regstart[mcnt] = best_regstart[mcnt];
04414               regend[mcnt] = best_regend[mcnt];
04415             }
04416         }
04417         } /* d != end_match_2 */
04418
04419     succeed_label:
04420       DEBUG_PRINT1 ("Accepting match.\n");
04421
04422       /* If caller wants register contents data back, do it.  */
04423       if (regs && !bufp->no_sub)
04424         {
04425           /* Have the register data arrays been allocated?  */
04426           if (bufp->regs_allocated == REGS_UNALLOCATED)
04427         { /* No.  So allocate them with malloc.  We need one
04428              extra element beyond `num_regs' for the `-1' marker
04429              GNU code uses.  */
04430           regs->num_regs = MAX (RE_NREGS, num_regs + 1);
04431           regs->start = TALLOC (regs->num_regs, regoff_t);
04432           regs->end = TALLOC (regs->num_regs, regoff_t);
04433           if (regs->start == NULL || regs->end == NULL)
04434             {
04435               FREE_VARIABLES ();
04436               return -2;
04437             }
04438           bufp->regs_allocated = REGS_REALLOCATE;
04439         }
04440           else if (bufp->regs_allocated == REGS_REALLOCATE)
04441         { /* Yes.  If we need more elements than were already
04442              allocated, reallocate them.  If we need fewer, just
04443              leave it alone.  */
04444           if (regs->num_regs < num_regs + 1)
04445             {
04446               regs->num_regs = num_regs + 1;
04447               RETALLOC (regs->start, regs->num_regs, regoff_t);
04448               RETALLOC (regs->end, regs->num_regs, regoff_t);
04449               if (regs->start == NULL || regs->end == NULL)
04450             {
04451               FREE_VARIABLES ();
04452               return -2;
04453             }
04454             }
04455         }
04456           else
04457         {
04458           /* These braces fend off a "empty body in an else-statement"
04459              warning under GCC when assert expands to nothing.  */
04460           assert (bufp->regs_allocated == REGS_FIXED);
04461         }
04462
04463           /* Convert the pointer data in `regstart' and `regend' to
04464          indices.  Register zero has to be set differently,
04465          since we haven't kept track of any info for it.  */
04466           if (regs->num_regs > 0)
04467         {
04468           regs->start[0] = pos;
04469           regs->end[0] = (MATCHING_IN_FIRST_STRING
04470                   ? ((regoff_t) (d - string1))
04471                   : ((regoff_t) (d - string2 + size1)));
04472         }
04473
04474           /* Go through the first `min (num_regs, regs->num_regs)'
04475          registers, since that is all we initialized.  */
04476           for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++)
04477         {
04478           if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
04479             regs->start[mcnt] = regs->end[mcnt] = -1;
04480           else
04481             {
04482               regs->start[mcnt]
04483             = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]);
04484               regs->end[mcnt]
04485             = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]);
04486             }
04487         }
04488
04489           /* If the regs structure we return has more elements than
04490          were in the pattern, set the extra elements to -1.  If
04491          we (re)allocated the registers, this is the case,
04492          because we always allocate enough to have at least one
04493          -1 at the end.  */
04494           for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++)
04495         regs->start[mcnt] = regs->end[mcnt] = -1;
04496         } /* regs && !bufp->no_sub */
04497
04498       DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
04499             nfailure_points_pushed, nfailure_points_popped,
04500             nfailure_points_pushed - nfailure_points_popped);
04501       DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
04502
04503       mcnt = d - pos - (MATCHING_IN_FIRST_STRING
04504                 ? string1
04505                 : string2 - size1);
04506
04507       DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
04508
04509       FREE_VARIABLES ();
04510       return mcnt;
04511     }
04512
04513       /* Otherwise match next pattern command.  */
04514       switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
04515     {
04516     /* Ignore these.  Used to ignore the n of succeed_n's which
04517        currently have n == 0.  */
04518     case no_op:
04519       DEBUG_PRINT1 ("EXECUTING no_op.\n");
04520       break;
04521
04522     case succeed:
04523       DEBUG_PRINT1 ("EXECUTING succeed.\n");
04524       goto succeed_label;
04525
04526     /* Match the next n pattern characters exactly.  The following
04527        byte in the pattern defines n, and the n bytes after that
04528        are the characters to match.  */
04529     case exactn:
04530       mcnt = *p++;
04531       DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
04532
04533       /* This is written out as an if-else so we don't waste time
04534          testing `translate' inside the loop.  */
04535       if (RE_TRANSLATE_P (translate))
04536         {
04537 #ifdef emacs
04538           if (multibyte)
04539         do
04540           {
04541             int pat_charlen, buf_charlen;
04542             unsigned int pat_ch, buf_ch;
04543
04544             PREFETCH ();
04545             pat_ch = STRING_CHAR_AND_LENGTH (p, pend - p, pat_charlen);
04546             buf_ch = STRING_CHAR_AND_LENGTH (d, dend - d, buf_charlen);
04547
04548             if (RE_TRANSLATE (translate, buf_ch)
04549             != pat_ch)
04550               goto fail;
04551
04552             p += pat_charlen;
04553             d += buf_charlen;
04554             mcnt -= pat_charlen;
04555           }
04556         while (mcnt > 0);
04557           else
04558 #endif /* not emacs */
04559         do
04560           {
04561             PREFETCH ();
04562             if ((unsigned char) RE_TRANSLATE (translate, (unsigned char) *d)
04563             != (unsigned char) *p++)
04564               goto fail;
04565             d++;
04566           }
04567         while (--mcnt);
04568         }
04569       else
04570         {
04571           do
04572         {
04573           PREFETCH ();
04574           if (*d++ != (char) *p++) goto fail;
04575         }
04576           while (--mcnt);
04577         }
04578       SET_REGS_MATCHED ();
04579       break;
04580
04581
04582     /* Match any character except possibly a newline or a null.  */
04583     case anychar:
04584       {
04585         int buf_charlen;
04586         unsigned int buf_ch;
04587
04588         DEBUG_PRINT1 ("EXECUTING anychar.\n");
04589
04590         PREFETCH ();
04591
04592 #ifdef emacs
04593         if (multibyte)
04594           buf_ch = STRING_CHAR_AND_LENGTH (d, dend - d, buf_charlen);
04595         else
04596 #endif /* not emacs */
04597           {
04598         buf_ch = (unsigned char) *d;
04599         buf_charlen = 1;
04600           }
04601
04602         buf_ch = TRANSLATE (buf_ch);
04603
04604         if ((!(bufp->syntax & RE_DOT_NEWLINE)
04605          && buf_ch == '\n')
04606         || ((bufp->syntax & RE_DOT_NOT_NULL)
04607             && buf_ch == '\000'))
04608           goto fail;
04609
04610         SET_REGS_MATCHED ();
04611         DEBUG_PRINT2 ("  Matched `%d'.\n", *d);
04612         d += buf_charlen;
04613       }
04614       break;
04615
04616
04617     case charset:
04618     case charset_not:
04619       {
04620         register unsigned int c;
04621         boolean not = (re_opcode_t) *(p - 1) == charset_not;
04622         int len;
04623
04624         /* Start of actual range_table, or end of bitmap if there is no
04625            range table.  */
04626         unsigned char *range_table;
04627
04628         /* Nonzero if there is range table.  */
04629         int range_table_exists;
04630
04631         /* Number of ranges of range table.  Not in bytes.  */
04632         int count;
04633
04634         DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : "");
04635
04636         PREFETCH ();
04637         c = (unsigned char) *d;
04638
04639         range_table = CHARSET_RANGE_TABLE (&p[-1]); /* Past the bitmap.  */
04640         range_table_exists = CHARSET_RANGE_TABLE_EXISTS_P (&p[-1]);
04641         if (range_table_exists)
04642           EXTRACT_NUMBER_AND_INCR (count, range_table);
04643         else
04644           count = 0;
04645
04646         if (multibyte && BASE_LEADING_CODE_P (c))
04647           c = STRING_CHAR_AND_LENGTH (d, dend - d, len);
04648
04649         if (SINGLE_BYTE_CHAR_P (c))
04650           {         /* Lookup bitmap.  */
04651         c = TRANSLATE (c); /* The character to match.  */
04652         len = 1;
04653
04654         /* Cast to `unsigned' instead of `unsigned char' in
04655            case the bit list is a full 32 bytes long.  */
04656         if (c < (unsigned) (CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH)
04657         && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
04658           not = !not;
04659           }
04660         else if (range_table_exists)
04661           CHARSET_LOOKUP_RANGE_TABLE_RAW (not, c, range_table, count);
04662
04663         p = CHARSET_RANGE_TABLE_END (range_table, count);
04664
04665         if (!not) goto fail;
04666
04667         SET_REGS_MATCHED ();
04668         d += len;
04669         break;
04670       }
04671
04672
04673     /* The beginning of a group is represented by start_memory.
04674        The arguments are the register number in the next byte, and the
04675        number of groups inner to this one in the next.  The text
04676        matched within the group is recorded (in the internal
04677        registers data structure) under the register number.  */
04678     case start_memory:
04679       DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]);
04680
04681       /* Find out if this group can match the empty string.  */
04682       p1 = p;       /* To send to group_match_null_string_p.  */
04683
04684       if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
04685         REG_MATCH_NULL_STRING_P (reg_info[*p])
04686           = group_match_null_string_p (&p1, pend, reg_info);
04687
04688       /* Save the position in the string where we were the last time
04689          we were at this open-group operator in case the group is
04690          operated upon by a repetition operator, e.g., with `(a*)*b'
04691          against `ab'; then we want to ignore where we are now in
04692          the string in case this attempt to match fails.  */
04693       old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
04694                  ? REG_UNSET (regstart[*p]) ? d : regstart[*p]
04695                  : regstart[*p];
04696       DEBUG_PRINT2 ("  old_regstart: %d\n",
04697              POINTER_TO_OFFSET (old_regstart[*p]));
04698
04699       regstart[*p] = d;
04700       DEBUG_PRINT2 ("  regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
04701
04702       IS_ACTIVE (reg_info[*p]) = 1;
04703       MATCHED_SOMETHING (reg_info[*p]) = 0;
04704
04705       /* Clear this whenever we change the register activity status.  */
04706       set_regs_matched_done = 0;
04707
04708       /* This is the new highest active register.  */
04709       highest_active_reg = *p;
04710
04711       /* If nothing was active before, this is the new lowest active
04712          register.  */
04713       if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
04714         lowest_active_reg = *p;
04715
04716       /* Move past the register number and inner group count.  */
04717       p += 2;
04718       just_past_start_mem = p;
04719
04720       break;
04721
04722
04723     /* The stop_memory opcode represents the end of a group.  Its
04724        arguments are the same as start_memory's: the register
04725        number, and the number of inner groups.  */
04726     case stop_memory:
04727       DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]);
04728
04729       /* We need to save the string position the last time we were at
04730          this close-group operator in case the group is operated
04731          upon by a repetition operator, e.g., with `((a*)*(b*)*)*'
04732          against `aba'; then we want to ignore where we are now in
04733          the string in case this attempt to match fails.  */
04734       old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
04735                ? REG_UNSET (regend[*p]) ? d : regend[*p]
04736                : regend[*p];
04737       DEBUG_PRINT2 ("      old_regend: %d\n",
04738              POINTER_TO_OFFSET (old_regend[*p]));
04739
04740       regend[*p] = d;
04741       DEBUG_PRINT2 ("      regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
04742
04743       /* This register isn't active anymore.  */
04744       IS_ACTIVE (reg_info[*p]) = 0;
04745
04746       /* Clear this whenever we change the register activity status.  */
04747       set_regs_matched_done = 0;
04748
04749       /* If this was the only register active, nothing is active
04750          anymore.  */
04751       if (lowest_active_reg == highest_active_reg)
04752         {
04753           lowest_active_reg = NO_LOWEST_ACTIVE_REG;
04754           highest_active_reg = NO_HIGHEST_ACTIVE_REG;
04755         }
04756       else
04757         { /* We must scan for the new highest active register, since
04758          it isn't necessarily one less than now: consider
04759          (a(b)c(d(e)f)g).  When group 3 ends, after the f), the
04760          new highest active register is 1.  */
04761           unsigned char r = *p - 1;
04762           while (r > 0 && !IS_ACTIVE (reg_info[r]))
04763         r--;
04764
04765           /* If we end up at register zero, that means that we saved
04766          the registers as the result of an `on_failure_jump', not
04767          a `start_memory', and we jumped to past the innermost
04768          `stop_memory'.  For example, in ((.)*) we save
04769          registers 1 and 2 as a result of the *, but when we pop
04770          back to the second ), we are at the stop_memory 1.
04771          Thus, nothing is active.  */
04772           if (r == 0)
04773         {
04774           lowest_active_reg = NO_LOWEST_ACTIVE_REG;
04775           highest_active_reg = NO_HIGHEST_ACTIVE_REG;
04776         }
04777           else
04778         highest_active_reg = r;
04779         }
04780
04781       /* If just failed to match something this time around with a
04782          group that's operated on by a repetition operator, try to
04783          force exit from the ``loop'', and restore the register
04784          information for this group that we had before trying this
04785          last match.  */
04786       if ((!MATCHED_SOMETHING (reg_info[*p])
04787            || just_past_start_mem == p - 1)
04788           && (p + 2) < pend)
04789         {
04790           boolean is_a_jump_n = false;
04791
04792           p1 = p + 2;
04793           mcnt = 0;
04794           switch ((re_opcode_t) *p1++)
04795         {
04796           case jump_n:
04797             is_a_jump_n = true;
04798           case pop_failure_jump:
04799           case maybe_pop_jump:
04800           case jump:
04801           case dummy_failure_jump:
04802             EXTRACT_NUMBER_AND_INCR (mcnt, p1);
04803             if (is_a_jump_n)
04804               p1 += 2;
04805             break;
04806
04807           default:
04808             /* do nothing */ ;
04809         }
04810           p1 += mcnt;
04811
04812           /* If the next operation is a jump backwards in the pattern
04813          to an on_failure_jump right before the start_memory
04814          corresponding to this stop_memory, exit from the loop
04815          by forcing a failure after pushing on the stack the
04816          on_failure_jump's jump in the pattern, and d.  */
04817           if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
04818           && (re_opcode_t) p1[3] == start_memory && p1[4] == *p)
04819         {
04820           /* If this group ever matched anything, then restore
04821              what its registers were before trying this last
04822              failed match, e.g., with `(a*)*b' against `ab' for
04823              regstart[1], and, e.g., with `((a*)*(b*)*)*'
04824              against `aba' for regend[3].
04825
04826              Also restore the registers for inner groups for,
04827              e.g., `((a*)(b*))*' against `aba' (register 3 would
04828              otherwise get trashed).  */
04829
04830           if (EVER_MATCHED_SOMETHING (reg_info[*p]))
04831             {
04832               unsigned r;
04833
04834               EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
04835
04836               /* Restore this and inner groups' (if any) registers.  */
04837               for (r = *p; r < *p + *(p + 1); r++)
04838             {
04839               regstart[r] = old_regstart[r];
04840
04841               /* xx why this test?  */
04842               if (old_regend[r] >= regstart[r])
04843                 regend[r] = old_regend[r];
04844             }
04845             }
04846           p1++;
04847           EXTRACT_NUMBER_AND_INCR (mcnt, p1);
04848           PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
04849
04850           goto fail;
04851         }
04852         }
04853
04854       /* Move past the register number and the inner group count.  */
04855       p += 2;
04856       break;
04857
04858
04859     /* <digit> has been turned into a `duplicate' command which is
04860        followed by the numeric value of <digit> as the register number.  */
04861     case duplicate:
04862       {
04863         register const char *d2, *dend2;
04864         int regno = *p++;   /* Get which register to match against.  */
04865         DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
04866
04867         /* Can't back reference a group which we've never matched.  */
04868         if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
04869           goto fail;
04870
04871         /* Where in input to try to start matching.  */
04872         d2 = regstart[regno];
04873
04874         /* Where to stop matching; if both the place to start and
04875            the place to stop matching are in the same string, then
04876            set to the place to stop, otherwise, for now have to use
04877            the end of the first string.  */
04878
04879         dend2 = ((FIRST_STRING_P (regstart[regno])
04880               == FIRST_STRING_P (regend[regno]))
04881              ? regend[regno] : end_match_1);
04882         for (;;)
04883           {
04884         /* If necessary, advance to next segment in register
04885            contents.  */
04886         while (d2 == dend2)
04887           {
04888             if (dend2 == end_match_2) break;
04889             if (dend2 == regend[regno]) break;
04890
04891             /* End of string1 => advance to string2. */
04892             d2 = string2;
04893             dend2 = regend[regno];
04894           }
04895         /* At end of register contents => success */
04896         if (d2 == dend2) break;
04897
04898         /* If necessary, advance to next segment in data.  */
04899         PREFETCH ();
04900
04901         /* How many characters left in this segment to match.  */
04902         mcnt = dend - d;
04903
04904         /* Want how many consecutive characters we can match in
04905            one shot, so, if necessary, adjust the count.  */
04906         if (mcnt > dend2 - d2)
04907           mcnt = dend2 - d2;
04908
04909         /* Compare that many; failure if mismatch, else move
04910            past them.  */
04911         if (RE_TRANSLATE_P (translate)
04912             ? bcmp_translate (d, d2, mcnt, translate)
04913             : bcmp (d, d2, mcnt))
04914           goto fail;
04915         d += mcnt, d2 += mcnt;
04916
04917         /* Do this because we've match some characters.  */
04918         SET_REGS_MATCHED ();
04919           }
04920       }
04921       break;
04922
04923
04924     /* begline matches the empty string at the beginning of the string
04925        (unless `not_bol' is set in `bufp'), and, if
04926        `newline_anchor' is set, after newlines.  */
04927     case begline:
04928       DEBUG_PRINT1 ("EXECUTING begline.\n");
04929
04930       if (AT_STRINGS_BEG (d))
04931         {
04932           if (!bufp->not_bol) break;
04933         }
04934       else if (d[-1] == '\n' && bufp->newline_anchor)
04935         {
04936           break;
04937         }
04938       /* In all other cases, we fail.  */
04939       goto fail;
04940
04941
04942     /* endline is the dual of begline.  */
04943     case endline:
04944       DEBUG_PRINT1 ("EXECUTING endline.\n");
04945
04946       if (AT_STRINGS_END (d))
04947         {
04948           if (!bufp->not_eol) break;
04949         }
04950
04951       /* We have to ``prefetch'' the next character.  */
04952       else if ((d == end1 ? *string2 : *d) == '\n'
04953            && bufp->newline_anchor)
04954         {
04955           break;
04956         }
04957       goto fail;
04958
04959
04960     /* Match at the very beginning of the data.  */
04961     case begbuf:
04962       DEBUG_PRINT1 ("EXECUTING begbuf.\n");
04963       if (AT_STRINGS_BEG (d))
04964         break;
04965       goto fail;
04966
04967
04968     /* Match at the very end of the data.  */
04969     case endbuf:
04970       DEBUG_PRINT1 ("EXECUTING endbuf.\n");
04971       if (AT_STRINGS_END (d))
04972         break;
04973       goto fail;
04974
04975
04976     /* on_failure_keep_string_jump is used to optimize `.*\n'.  It
04977        pushes NULL as the value for the string on the stack.  Then
04978        `pop_failure_point' will keep the current value for the
04979        string, instead of restoring it.  To see why, consider
04980        matching `foo\nbar' against `.*\n'.  The .* matches the foo;
04981        then the . fails against the \n.  But the next thing we want
04982        to do is match the \n against the \n; if we restored the
04983        string value, we would be back at the foo.
04984
04985        Because this is used only in specific cases, we don't need to
04986        check all the things that `on_failure_jump' does, to make
04987        sure the right things get saved on the stack.  Hence we don't
04988        share its code.  The only reason to push anything on the
04989        stack at all is that otherwise we would have to change
04990        `anychar's code to do something besides goto fail in this
04991        case; that seems worse than this.  */
04992     case on_failure_keep_string_jump:
04993       DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
04994
04995       EXTRACT_NUMBER_AND_INCR (mcnt, p);
04996       DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
04997
04998       PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
04999       break;
05000
05001
05002     /* Uses of on_failure_jump:
05003
05004        Each alternative starts with an on_failure_jump that points
05005        to the beginning of the next alternative.  Each alternative
05006        except the last ends with a jump that in effect jumps past
05007        the rest of the alternatives.  (They really jump to the
05008        ending jump of the following alternative, because tensioning
05009        these jumps is a hassle.)
05010
05011        Repeats start with an on_failure_jump that points past both
05012        the repetition text and either the following jump or
05013        pop_failure_jump back to this on_failure_jump.  */
05014     case on_failure_jump:
05015     on_failure:
05016       DEBUG_PRINT1 ("EXECUTING on_failure_jump");
05017
05018 #if defined (WINDOWSNT) && defined (emacs)
05019       QUIT;
05020 #endif
05021
05022       EXTRACT_NUMBER_AND_INCR (mcnt, p);
05023       DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
05024
05025       /* If this on_failure_jump comes right before a group (i.e.,
05026          the original * applied to a group), save the information
05027          for that group and all inner ones, so that if we fail back
05028          to this point, the group's information will be correct.
05029          For example, in \(a*\)*\1, we need the preceding group,
05030          and in \(zz\(a*\)b*\)\2, we need the inner group.  */
05031
05032       /* We can't use `p' to check ahead because we push
05033          a failure point to `p + mcnt' after we do this.  */
05034       p1 = p;
05035
05036       /* We need to skip no_op's before we look for the
05037          start_memory in case this on_failure_jump is happening as
05038          the result of a completed succeed_n, as in \(a\)\{1,3\}b\1
05039          against aba.  */
05040       while (p1 < pend && (re_opcode_t) *p1 == no_op)
05041         p1++;
05042
05043       if (p1 < pend && (re_opcode_t) *p1 == start_memory)
05044         {
05045           /* We have a new highest active register now.  This will
05046          get reset at the start_memory we are about to get to,
05047          but we will have saved all the registers relevant to
05048          this repetition op, as described above.  */
05049           highest_active_reg = *(p1 + 1) + *(p1 + 2);
05050           if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
05051         lowest_active_reg = *(p1 + 1);
05052         }
05053
05054       DEBUG_PRINT1 (":\n");
05055       PUSH_FAILURE_POINT (p + mcnt, d, -2);
05056       break;
05057
05058
05059     /* A smart repeat ends with `maybe_pop_jump'.
05060        We change it to either `pop_failure_jump' or `jump'.  */
05061     case maybe_pop_jump:
05062 #if defined (WINDOWSNT) && defined (emacs)
05063       QUIT;
05064 #endif
05065       EXTRACT_NUMBER_AND_INCR (mcnt, p);
05066       DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
05067       {
05068         register unsigned char *p2 = p;
05069
05070         /* Compare the beginning of the repeat with what in the
05071            pattern follows its end. If we can establish that there
05072            is nothing that they would both match, i.e., that we
05073            would have to backtrack because of (as in, e.g., `a*a')
05074            then we can change to pop_failure_jump, because we'll
05075            never have to backtrack.
05076
05077            This is not true in the case of alternatives: in
05078            `(a|ab)*' we do need to backtrack to the `ab' alternative
05079            (e.g., if the string was `ab').  But instead of trying to
05080            detect that here, the alternative has put on a dummy
05081            failure point which is what we will end up popping.  */
05082
05083         /* Skip over open/close-group commands.
05084            If what follows this loop is a ...+ construct,
05085            look at what begins its body, since we will have to
05086            match at least one of that.  */
05087         while (1)
05088           {
05089         if (p2 + 2 < pend
05090             && ((re_opcode_t) *p2 == stop_memory
05091             || (re_opcode_t) *p2 == start_memory))
05092           p2 += 3;
05093         else if (p2 + 6 < pend
05094              && (re_opcode_t) *p2 == dummy_failure_jump)
05095           p2 += 6;
05096         else
05097           break;
05098           }
05099
05100         p1 = p + mcnt;
05101         /* p1[0] ... p1[2] are the `on_failure_jump' corresponding
05102            to the `maybe_finalize_jump' of this case.  Examine what
05103            follows.  */
05104
05105         /* If we're at the end of the pattern, we can change.  */
05106         if (p2 == pend)
05107           {
05108         /* Consider what happens when matching ":\(.*\)"
05109            against ":/".  I don't really understand this code
05110            yet.  */
05111         p[-3] = (unsigned char) pop_failure_jump;
05112         DEBUG_PRINT1
05113           ("  End of pattern: change to `pop_failure_jump'.\n");
05114           }
05115
05116         else if ((re_opcode_t) *p2 == exactn
05117              || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
05118           {
05119         register unsigned int c
05120           = *p2 == (unsigned char) endline ? '\n' : p2[2];
05121
05122         if ((re_opcode_t) p1[3] == exactn)
05123           {
05124             if (!(multibyte /* && (c != '\n') */
05125               && BASE_LEADING_CODE_P (c))
05126             ? c != p1[5]
05127             : (STRING_CHAR (&p2[2], pend - &p2[2])
05128                != STRING_CHAR (&p1[5], pend - &p1[5])))
05129           {
05130             p[-3] = (unsigned char) pop_failure_jump;
05131             DEBUG_PRINT3 ("  %c != %c => pop_failure_jump.\n",
05132                   c, p1[5]);
05133           }
05134           }
05135
05136         else if ((re_opcode_t) p1[3] == charset
05137              || (re_opcode_t) p1[3] == charset_not)
05138           {
05139             int not = (re_opcode_t) p1[3] == charset_not;
05140
05141             if (multibyte /* && (c != '\n') */
05142             && BASE_LEADING_CODE_P (c))
05143               c = STRING_CHAR (&p2[2], pend - &p2[2]);
05144
05145             /* Test if C is listed in charset (or charset_not)
05146                at `&p1[3]'.  */
05147             if (SINGLE_BYTE_CHAR_P (c))
05148               {
05149             if (c < CHARSET_BITMAP_SIZE (&p1[3]) * BYTEWIDTH
05150             && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
05151               not = !not;
05152               }
05153             else if (CHARSET_RANGE_TABLE_EXISTS_P (&p1[3]))
05154               CHARSET_LOOKUP_RANGE_TABLE (not, c, &p1[3]);
05155
05156             /* `not' is equal to 1 if c would match, which means
05157             that we can't change to pop_failure_jump.  */
05158             if (!not)
05159               {
05160             p[-3] = (unsigned char) pop_failure_jump;
05161             DEBUG_PRINT1 ("  No match => pop_failure_jump.\n");
05162               }
05163           }
05164           }
05165         else if ((re_opcode_t) *p2 == charset)
05166           {
05167         if ((re_opcode_t) p1[3] == exactn)
05168           {
05169             register unsigned int c = p1[5];
05170             int not = 0;
05171
05172             if (multibyte && BASE_LEADING_CODE_P (c))
05173               c = STRING_CHAR (&p1[5], pend - &p1[5]);
05174
05175             /* Test if C is listed in charset at `p2'.  */
05176             if (SINGLE_BYTE_CHAR_P (c))
05177               {
05178             if (c < CHARSET_BITMAP_SIZE (p2) * BYTEWIDTH
05179                 && (p2[2 + c / BYTEWIDTH]
05180                 & (1 << (c % BYTEWIDTH))))
05181               not = !not;
05182               }
05183             else if (CHARSET_RANGE_TABLE_EXISTS_P (p2))
05184               CHARSET_LOOKUP_RANGE_TABLE (not, c, p2);
05185
05186             if (!not)
05187           {
05188             p[-3] = (unsigned char) pop_failure_jump;
05189             DEBUG_PRINT1 ("  No match => pop_failure_jump.\n");
05190               }
05191           }
05192
05193         /* It is hard to list up all the character in charset
05194            P2 if it includes multibyte character.  Give up in
05195            such case.  */
05196         else if (!multibyte || !CHARSET_RANGE_TABLE_EXISTS_P (p2))
05197           {
05198             /* Now, we are sure that P2 has no range table.
05199                So, for the size of bitmap in P2, `p2[1]' is
05200                enough.  But P1 may have range table, so the
05201                size of bitmap table of P1 is extracted by
05202                using macro `CHARSET_BITMAP_SIZE'.
05203
05204                Since we know that all the character listed in
05205                P2 is ASCII, it is enough to test only bitmap
05206                table of P1.  */
05207
05208             if ((re_opcode_t) p1[3] == charset_not)
05209           {
05210             int idx;
05211             /* We win if the charset_not inside the loop lists
05212                every character listed in the charset after.  */
05213             for (idx = 0; idx < (int) p2[1]; idx++)
05214               if (! (p2[2 + idx] == 0
05215                  || (idx < CHARSET_BITMAP_SIZE (&p1[3])
05216                  && ((p2[2 + idx] & ~ p1[5 + idx]) == 0))))
05217             break;
05218
05219             if (idx == p2[1])
05220               {
05221             p[-3] = (unsigned char) pop_failure_jump;
05222             DEBUG_PRINT1 ("  No match => pop_failure_jump.\n");
05223               }
05224           }
05225         else if ((re_opcode_t) p1[3] == charset)
05226           {
05227             int idx;
05228             /* We win if the charset inside the loop
05229                has no overlap with the one after the loop.  */
05230             for (idx = 0;
05231                  (idx < (int) p2[1]
05232                   && idx < CHARSET_BITMAP_SIZE (&p1[3]));
05233              idx++)
05234               if ((p2[2 + idx] & p1[5 + idx]) != 0)
05235             break;
05236
05237             if (idx == p2[1]
05238                 || idx == CHARSET_BITMAP_SIZE (&p1[3]))
05239               {
05240             p[-3] = (unsigned char) pop_failure_jump;
05241             DEBUG_PRINT1 ("  No match => pop_failure_jump.\n");
05242               }
05243           }
05244           }
05245       }
05246       }
05247       p -= 2;       /* Point at relative address again.  */
05248       if ((re_opcode_t) p[-1] != pop_failure_jump)
05249         {
05250           p[-1] = (unsigned char) jump;
05251           DEBUG_PRINT1 ("  Match => jump.\n");
05252           goto unconditional_jump;
05253         }
05254     /* Note fall through.  */
05255
05256
05257     /* The end of a simple repeat has a pop_failure_jump back to
05258        its matching on_failure_jump, where the latter will push a
05259        failure point.  The pop_failure_jump takes off failure
05260        points put on by this pop_failure_jump's matching
05261        on_failure_jump; we got through the pattern to here from the
05262        matching on_failure_jump, so didn't fail.  */
05263     case pop_failure_jump:
05264       {
05265         /* We need to pass separate storage for the lowest and
05266            highest registers, even though we don't care about the
05267            actual values.  Otherwise, we will restore only one
05268            register from the stack, since lowest will == highest in
05269            `pop_failure_point'.  */
05270         unsigned dummy_low_reg, dummy_high_reg;
05271         unsigned char *pdummy;
05272         const char *sdummy;
05273
05274         DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
05275         POP_FAILURE_POINT (sdummy, pdummy,
05276                    dummy_low_reg, dummy_high_reg,
05277                    reg_dummy, reg_dummy, reg_info_dummy);
05278       }
05279       /* Note fall through.  */
05280
05281
05282     /* Unconditionally jump (without popping any failure points).  */
05283     case jump:
05284     unconditional_jump:
05285 #if defined (WINDOWSNT) && defined (emacs)
05286       QUIT;
05287 #endif
05288       EXTRACT_NUMBER_AND_INCR (mcnt, p);    /* Get the amount to jump.  */
05289       DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
05290       p += mcnt;                /* Do the jump.  */
05291       DEBUG_PRINT2 ("(to 0x%x).\n", p);
05292       break;
05293
05294
05295     /* We need this opcode so we can detect where alternatives end
05296        in `group_match_null_string_p' et al.  */
05297     case jump_past_alt:
05298       DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n");
05299       goto unconditional_jump;
05300
05301
05302     /* Normally, the on_failure_jump pushes a failure point, which
05303        then gets popped at pop_failure_jump.  We will end up at
05304        pop_failure_jump, also, and with a pattern of, say, `a+', we
05305        are skipping over the on_failure_jump, so we have to push
05306        something meaningless for pop_failure_jump to pop.  */
05307     case dummy_failure_jump:
05308       DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
05309       /* It doesn't matter what we push for the string here.  What
05310          the code at `fail' tests is the value for the pattern.  */
05311       PUSH_FAILURE_POINT (0, 0, -2);
05312       goto unconditional_jump;
05313
05314
05315     /* At the end of an alternative, we need to push a dummy failure
05316        point in case we are followed by a `pop_failure_jump', because
05317        we don't want the failure point for the alternative to be
05318        popped.  For example, matching `(a|ab)*' against `aab'
05319        requires that we match the `ab' alternative.  */
05320     case push_dummy_failure:
05321       DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
05322       /* See comments just above at `dummy_failure_jump' about the
05323          two zeroes.  */
05324       PUSH_FAILURE_POINT (0, 0, -2);
05325       break;
05326
05327     /* Have to succeed matching what follows at least n times.
05328        After that, handle like `on_failure_jump'.  */
05329     case succeed_n:
05330       EXTRACT_NUMBER (mcnt, p + 2);
05331       DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt);
05332
05333       assert (mcnt >= 0);
05334       /* Originally, this is how many times we HAVE to succeed.  */
05335       if (mcnt > 0)
05336         {
05337            mcnt--;
05338            p += 2;
05339            STORE_NUMBER_AND_INCR (p, mcnt);
05340            DEBUG_PRINT3 ("  Setting 0x%x to %d.\n", p, mcnt);
05341         }
05342       else if (mcnt == 0)
05343         {
05344           DEBUG_PRINT2 ("  Setting two bytes from 0x%x to no_op.\n", p+2);
05345           p[2] = (unsigned char) no_op;
05346           p[3] = (unsigned char) no_op;
05347           goto on_failure;
05348         }
05349       break;
05350
05351     case jump_n:
05352       EXTRACT_NUMBER (mcnt, p + 2);
05353       DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt);
05354
05355       /* Originally, this is how many times we CAN jump.  */
05356       if (mcnt)
05357         {
05358            mcnt--;
05359            STORE_NUMBER (p + 2, mcnt);
05360            goto unconditional_jump;
05361         }
05362       /* If don't have to jump any more, skip over the rest of command.  */
05363       else
05364         p += 4;
05365       break;
05366
05367     case set_number_at:
05368       {
05369         DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
05370
05371         EXTRACT_NUMBER_AND_INCR (mcnt, p);
05372         p1 = p + mcnt;
05373         EXTRACT_NUMBER_AND_INCR (mcnt, p);
05374         DEBUG_PRINT3 ("  Setting 0x%x to %d.\n", p1, mcnt);
05375         STORE_NUMBER (p1, mcnt);
05376         break;
05377       }
05378
05379     case wordbound:
05380       DEBUG_PRINT1 ("EXECUTING wordbound.\n");
05381
05382       /* We SUCCEED in one of the following cases: */
05383
05384       /* Case 1: D is at the beginning or the end of string.  */
05385       if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
05386         break;
05387       else
05388         {
05389           /* C1 is the character before D, S1 is the syntax of C1, C2
05390          is the character at D, and S2 is the syntax of C2.  */
05391           int c1, c2, s1, s2;
05392           int pos1 = PTR_TO_OFFSET (d - 1);
05393           int charpos;
05394
05395           GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
05396           GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2);
05397 #ifdef emacs
05398           charpos = SYNTAX_TABLE_BYTE_TO_CHAR (pos1);
05399           UPDATE_SYNTAX_TABLE (charpos);
05400 #endif
05401           s1 = SYNTAX (c1);
05402 #ifdef emacs
05403           UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1);
05404 #endif
05405           s2 = SYNTAX (c2);
05406
05407           if (/* Case 2: Only one of S1 and S2 is Sword.  */
05408           ((s1 == Sword) != (s2 == Sword))
05409           /* Case 3: Both of S1 and S2 are Sword, and macro
05410              WORD_BOUNDARY_P (C1, C2) returns nonzero.  */
05411           || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2)))
05412         break;
05413     }
05414       goto fail;
05415
05416       case notwordbound:
05417       DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
05418
05419       /* We FAIL in one of the following cases: */
05420
05421       /* Case 1: D is at the beginning or the end of string.  */
05422       if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
05423         goto fail;
05424       else
05425         {
05426           /* C1 is the character before D, S1 is the syntax of C1, C2
05427          is the character at D, and S2 is the syntax of C2.  */
05428           int c1, c2, s1, s2;
05429           int pos1 = PTR_TO_OFFSET (d - 1);
05430           int charpos;
05431
05432           GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
05433           GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2);
05434 #ifdef emacs
05435           charpos = SYNTAX_TABLE_BYTE_TO_CHAR (pos1);
05436           UPDATE_SYNTAX_TABLE (charpos);
05437 #endif
05438           s1 = SYNTAX (c1);
05439 #ifdef emacs
05440           UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1);
05441 #endif
05442           s2 = SYNTAX (c2);
05443
05444           if (/* Case 2: Only one of S1 and S2 is Sword.  */
05445           ((s1 == Sword) != (s2 == Sword))
05446           /* Case 3: Both of S1 and S2 are Sword, and macro
05447              WORD_BOUNDARY_P (C1, C2) returns nonzero.  */
05448           || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2)))
05449         goto fail;
05450     }
05451       break;
05452
05453     case wordbeg:
05454       DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
05455
05456       /* We FAIL in one of the following cases: */
05457
05458       /* Case 1: D is at the end of string.  */
05459       if (AT_STRINGS_END (d))
05460       goto fail;
05461       else
05462         {
05463           /* C1 is the character before D, S1 is the syntax of C1, C2
05464          is the character at D, and S2 is the syntax of C2.  */
05465           int c1, c2, s1, s2;
05466           int pos1 = PTR_TO_OFFSET (d);
05467           int charpos;
05468
05469           GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2);
05470 #ifdef emacs
05471           charpos = SYNTAX_TABLE_BYTE_TO_CHAR (pos1);
05472           UPDATE_SYNTAX_TABLE (charpos);
05473 #endif
05474           s2 = SYNTAX (c2);
05475
05476           /* Case 2: S2 is not Sword. */
05477           if (s2 != Sword)
05478         goto fail;
05479
05480           /* Case 3: D is not at the beginning of string ... */
05481           if (!AT_STRINGS_BEG (d))
05482         {
05483           GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
05484 #ifdef emacs
05485           UPDATE_SYNTAX_TABLE_BACKWARD (charpos - 1);
05486 #endif
05487           s1 = SYNTAX (c1);
05488
05489           /* ... and S1 is Sword, and WORD_BOUNDARY_P (C1, C2)
05490              returns 0.  */
05491           if ((s1 == Sword) && !WORD_BOUNDARY_P (c1, c2))
05492             goto fail;
05493         }
05494         }
05495       break;
05496
05497     case wordend:
05498       DEBUG_PRINT1 ("EXECUTING wordend.\n");
05499
05500       /* We FAIL in one of the following cases: */
05501
05502       /* Case 1: D is at the beginning of string.  */
05503       if (AT_STRINGS_BEG (d))
05504         goto fail;
05505       else
05506         {
05507           /* C1 is the character before D, S1 is the syntax of C1, C2
05508          is the character at D, and S2 is the syntax of C2.  */
05509           int c1, c2, s1, s2;
05510           int pos1 = PTR_TO_OFFSET (d);
05511           int charpos;
05512
05513           GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
05514 #ifdef emacs
05515           charpos = SYNTAX_TABLE_BYTE_TO_CHAR (pos1 - 1);
05516           UPDATE_SYNTAX_TABLE (charpos);
05517 #endif
05518           s1 = SYNTAX (c1);
05519
05520           /* Case 2: S1 is not Sword.  */
05521           if (s1 != Sword)
05522         goto fail;
05523
05524           /* Case 3: D is not at the end of string ... */
05525           if (!AT_STRINGS_END (d))
05526         {
05527           GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2);
05528 #ifdef emacs
05529           UPDATE_SYNTAX_TABLE_FORWARD (charpos);
05530 #endif
05531           s2 = SYNTAX (c2);
05532
05533           /* ... and S2 is Sword, and WORD_BOUNDARY_P (C1, C2)
05534              returns 0.  */
05535           if ((s2 == Sword) && !WORD_BOUNDARY_P (c1, c2))
05536       goto fail;
05537         }
05538         }
05539       break;
05540
05541 #ifdef emacs
05542     case before_dot:
05543       DEBUG_PRINT1 ("EXECUTING before_dot.\n");
05544       if (PTR_BYTE_POS ((unsigned char *) d) >= PT_BYTE)
05545         goto fail;
05546       break;
05547
05548     case at_dot:
05549       DEBUG_PRINT1 ("EXECUTING at_dot.\n");
05550       if (PTR_BYTE_POS ((unsigned char *) d) != PT_BYTE)
05551         goto fail;
05552       break;
05553
05554     case after_dot:
05555       DEBUG_PRINT1 ("EXECUTING after_dot.\n");
05556       if (PTR_BYTE_POS ((unsigned char *) d) <= PT_BYTE)
05557         goto fail;
05558       break;
05559
05560     case syntaxspec:
05561       DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
05562       mcnt = *p++;
05563       goto matchsyntax;
05564
05565     case wordchar:
05566       DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
05567       mcnt = (int) Sword;
05568     matchsyntax:
05569       PREFETCH ();
05570 #ifdef emacs
05571       {
05572         int pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (PTR_TO_OFFSET (d));
05573         UPDATE_SYNTAX_TABLE (pos1);
05574       }
05575 #endif
05576       {
05577         int c, len;
05578
05579         if (multibyte)
05580           /* we must concern about multibyte form, ... */
05581           c = STRING_CHAR_AND_LENGTH (d, dend - d, len);
05582         else
05583           /* everything should be handled as ASCII, even though it
05584          looks like multibyte form.  */
05585           c = *d, len = 1;
05586
05587         if (SYNTAX (c) != (enum syntaxcode) mcnt)
05588         goto fail;
05589         d += len;
05590       }
05591       SET_REGS_MATCHED ();
05592       break;
05593
05594     case notsyntaxspec:
05595       DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
05596       mcnt = *p++;
05597       goto matchnotsyntax;
05598
05599     case notwordchar:
05600       DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
05601       mcnt = (int) Sword;
05602     matchnotsyntax:
05603       PREFETCH ();
05604 #ifdef emacs
05605       {
05606         int pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (PTR_TO_OFFSET (d));
05607         UPDATE_SYNTAX_TABLE (pos1);
05608       }
05609 #endif
05610       {
05611         int c, len;
05612
05613         if (multibyte)
05614           c = STRING_CHAR_AND_LENGTH (d, dend - d, len);
05615         else
05616           c = *d, len = 1;
05617
05618         if (SYNTAX (c) == (enum syntaxcode) mcnt)
05619         goto fail;
05620         d += len;
05621       }
05622       SET_REGS_MATCHED ();
05623       break;
05624
05625     case categoryspec:
05626       DEBUG_PRINT2 ("EXECUTING categoryspec %d.\n", *p);
05627       mcnt = *p++;
05628       PREFETCH ();
05629       {
05630         int c, len;
05631
05632         if (multibyte)
05633           c = STRING_CHAR_AND_LENGTH (d, dend - d, len);
05634         else
05635           c = *d, len = 1;
05636
05637         if (!CHAR_HAS_CATEGORY (c, mcnt))
05638           goto fail;
05639         d += len;
05640       }
05641       SET_REGS_MATCHED ();
05642       break;
05643
05644     case notcategoryspec:
05645       DEBUG_PRINT2 ("EXECUTING notcategoryspec %d.\n", *p);
05646       mcnt = *p++;
05647       PREFETCH ();
05648       {
05649         int c, len;
05650
05651         if (multibyte)
05652           c = STRING_CHAR_AND_LENGTH (d, dend - d, len);
05653         else
05654           c = *d, len = 1;
05655
05656         if (CHAR_HAS_CATEGORY (c, mcnt))
05657           goto fail;
05658         d += len;
05659       }
05660       SET_REGS_MATCHED ();
05661           break;
05662
05663 #else /* not emacs */
05664     case wordchar:
05665           DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
05666       PREFETCH ();
05667           if (!WORDCHAR_P (d))
05668             goto fail;
05669       SET_REGS_MATCHED ();
05670           d++;
05671       break;
05672
05673     case notwordchar:
05674           DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
05675       PREFETCH ();
05676       if (WORDCHAR_P (d))
05677             goto fail;
05678           SET_REGS_MATCHED ();
05679           d++;
05680       break;
05681 #endif /* not emacs */
05682
05683         default:
05684           abort ();
05685     }
05686       continue;  /* Successfully executed one pattern command; keep going.  */
05687
05688
05689     /* We goto here if a matching operation fails. */
05690     fail:
05691 #if defined (WINDOWSNT) && defined (emacs)
05692       QUIT;
05693 #endif
05694       if (!FAIL_STACK_EMPTY ())
05695     { /* A restart point is known.  Restore to that state.  */
05696           DEBUG_PRINT1 ("\nFAIL:\n");
05697           POP_FAILURE_POINT (d, p,
05698                              lowest_active_reg, highest_active_reg,
05699                              regstart, regend, reg_info);
05700
05701           /* If this failure point is a dummy, try the next one.  */
05702           if (!p)
05703         goto fail;
05704
05705           /* If we failed to the end of the pattern, don't examine *p.  */
05706       assert (p <= pend);
05707           if (p < pend)
05708             {
05709               boolean is_a_jump_n = false;
05710
05711               /* If failed to a backwards jump that's part of a repetition
05712                  loop, need to pop this failure point and use the next one.  */
05713               switch ((re_opcode_t) *p)
05714                 {
05715                 case jump_n:
05716                   is_a_jump_n = true;
05717                 case maybe_pop_jump:
05718                 case pop_failure_jump:
05719                 case jump:
05720                   p1 = p + 1;
05721                   EXTRACT_NUMBER_AND_INCR (mcnt, p1);
05722                   p1 += mcnt;
05723
05724                   if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
05725                       || (!is_a_jump_n
05726                           && (re_opcode_t) *p1 == on_failure_jump))
05727                     goto fail;
05728                   break;
05729                 default:
05730                   /* do nothing */ ;
05731                 }
05732             }
05733
05734           if (d >= string1 && d <= end1)
05735         dend = end_match_1;
05736         }
05737       else
05738         break;   /* Matching at this starting point really fails.  */
05739     } /* for (;;) */
05740
05741   if (best_regs_set)
05742     goto restore_best_regs;
05743
05744   FREE_VARIABLES ();
05745
05746   return -1;                    /* Failure to match.  */
05747 } /* re_match_2 */
05748
05749 /* Subroutine definitions for re_match_2.  */
05750
05751
05752 /* We are passed P pointing to a register number after a start_memory.
05753
05754    Return true if the pattern up to the corresponding stop_memory can
05755    match the empty string, and false otherwise.
05756
05757    If we find the matching stop_memory, sets P to point to one past its number.
05758    Otherwise, sets P to an undefined byte less than or equal to END.
05759
05760    We don't handle duplicates properly (yet).  */
05761
05762 static boolean
05763 group_match_null_string_p (p, end, reg_info)
05764     unsigned char **p, *end;
05765     register_info_type *reg_info;
05766 {
05767   int mcnt;
05768   /* Point to after the args to the start_memory.  */
05769   unsigned char *p1 = *p + 2;
05770
05771   while (p1 < end)
05772     {
05773       /* Skip over opcodes that can match nothing, and return true or
05774      false, as appropriate, when we get to one that can't, or to the
05775          matching stop_memory.  */
05776
05777       switch ((re_opcode_t) *p1)
05778         {
05779         /* Could be either a loop or a series of alternatives.  */
05780         case on_failure_jump:
05781           p1++;
05782           EXTRACT_NUMBER_AND_INCR (mcnt, p1);
05783
05784           /* If the next operation is not a jump backwards in the
05785          pattern.  */
05786
05787       if (mcnt >= 0)
05788         {
05789               /* Go through the on_failure_jumps of the alternatives,
05790                  seeing if any of the alternatives cannot match nothing.
05791                  The last alternative starts with only a jump,
05792                  whereas the rest start with on_failure_jump and end
05793                  with a jump, e.g., here is the pattern for `a|b|c':
05794
05795                  /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
05796                  /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
05797                  /exactn/1/c
05798
05799                  So, we have to first go through the first (n-1)
05800                  alternatives and then deal with the last one separately.  */
05801
05802
05803               /* Deal with the first (n-1) alternatives, which start
05804                  with an on_failure_jump (see above) that jumps to right
05805                  past a jump_past_alt.  */
05806
05807               while ((re_opcode_t) p1[mcnt-3] == jump_past_alt)
05808                 {
05809                   /* `mcnt' holds how many bytes long the alternative
05810                      is, including the ending `jump_past_alt' and
05811                      its number.  */
05812
05813                   if (!alt_match_null_string_p (p1, p1 + mcnt - 3,
05814                                       reg_info))
05815                     return false;
05816
05817                   /* Move to right after this alternative, including the
05818              jump_past_alt.  */
05819                   p1 += mcnt;
05820
05821                   /* Break if it's the beginning of an n-th alternative
05822                      that doesn't begin with an on_failure_jump.  */
05823                   if ((re_opcode_t) *p1 != on_failure_jump)
05824                     break;
05825
05826           /* Still have to check that it's not an n-th
05827              alternative that starts with an on_failure_jump.  */
05828           p1++;
05829                   EXTRACT_NUMBER_AND_INCR (mcnt, p1);
05830                   if ((re_opcode_t) p1[mcnt-3] != jump_past_alt)
05831                     {
05832               /* Get to the beginning of the n-th alternative.  */
05833                       p1 -= 3;
05834                       break;
05835                     }
05836                 }
05837
05838               /* Deal with the last alternative: go back and get number
05839                  of the `jump_past_alt' just before it.  `mcnt' contains
05840                  the length of the alternative.  */
05841               EXTRACT_NUMBER (mcnt, p1 - 2);
05842
05843               if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info))
05844                 return false;
05845
05846               p1 += mcnt;   /* Get past the n-th alternative.  */
05847             } /* if mcnt > 0 */
05848           break;
05849
05850
05851         case stop_memory:
05852       assert (p1[1] == **p);
05853           *p = p1 + 2;
05854           return true;
05855
05856
05857         default:
05858           if (!common_op_match_null_string_p (&p1, end, reg_info))
05859             return false;
05860         }
05861     } /* while p1 < end */
05862
05863   return false;
05864 } /* group_match_null_string_p */
05865
05866
05867 /* Similar to group_match_null_string_p, but doesn't deal with alternatives:
05868    It expects P to be the first byte of a single alternative and END one
05869    byte past the last. The alternative can contain groups.  */
05870
05871 static boolean
05872 alt_match_null_string_p (p, end, reg_info)
05873     unsigned char *p, *end;
05874     register_info_type *reg_info;
05875 {
05876   int mcnt;
05877   unsigned char *p1 = p;
05878
05879   while (p1 < end)
05880     {
05881       /* Skip over opcodes that can match nothing, and break when we get
05882          to one that can't.  */
05883
05884       switch ((re_opcode_t) *p1)
05885         {
05886     /* It's a loop.  */
05887         case on_failure_jump:
05888           p1++;
05889           EXTRACT_NUMBER_AND_INCR (mcnt, p1);
05890           p1 += mcnt;
05891           break;
05892
05893     default:
05894           if (!common_op_match_null_string_p (&p1, end, reg_info))
05895             return false;
05896         }
05897     }  /* while p1 < end */
05898
05899   return true;
05900 } /* alt_match_null_string_p */
05901
05902
05903 /* Deals with the ops common to group_match_null_string_p and
05904    alt_match_null_string_p.
05905
05906    Sets P to one after the op and its arguments, if any.  */
05907
05908 static boolean
05909 common_op_match_null_string_p (p, end, reg_info)
05910     unsigned char **p, *end;
05911     register_info_type *reg_info;
05912 {
05913   int mcnt;
05914   boolean ret;
05915   int reg_no;
05916   unsigned char *p1 = *p;
05917
05918   switch ((re_opcode_t) *p1++)
05919     {
05920     case no_op:
05921     case begline:
05922     case endline:
05923     case begbuf:
05924     case endbuf:
05925     case wordbeg:
05926     case wordend:
05927     case wordbound:
05928     case notwordbound:
05929 #ifdef emacs
05930     case before_dot:
05931     case at_dot:
05932     case after_dot:
05933 #endif
05934       break;
05935
05936     case start_memory:
05937       reg_no = *p1;
05938       assert (reg_no > 0 && reg_no <= MAX_REGNUM);
05939       ret = group_match_null_string_p (&p1, end, reg_info);
05940
05941       /* Have to set this here in case we're checking a group which
05942          contains a group and a back reference to it.  */
05943
05944       if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE)
05945         REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret;
05946
05947       if (!ret)
05948         return false;
05949       break;
05950
05951     /* If this is an optimized succeed_n for zero times, make the jump.  */
05952     case jump:
05953       EXTRACT_NUMBER_AND_INCR (mcnt, p1);
05954       if (mcnt >= 0)
05955         p1 += mcnt;
05956       else
05957         return false;
05958       break;
05959
05960     case succeed_n:
05961       /* Get to the number of times to succeed.  */
05962       p1 += 2;
05963       EXTRACT_NUMBER_AND_INCR (mcnt, p1);
05964
05965       if (mcnt == 0)
05966         {
05967           p1 -= 4;
05968           EXTRACT_NUMBER_AND_INCR (mcnt, p1);
05969           p1 += mcnt;
05970         }
05971       else
05972         return false;
05973       break;
05974
05975     case duplicate:
05976       if (!REG_MATCH_NULL_STRING_P (reg_info[*p1]))
05977         return false;
05978       break;
05979
05980     case set_number_at:
05981       p1 += 4;
05982
05983     default:
05984       /* All other opcodes mean we cannot match the empty string.  */
05985       return false;
05986   }
05987
05988   *p = p1;
05989   return true;
05990 } /* common_op_match_null_string_p */
05991
05992
05993 /* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
05994    bytes; nonzero otherwise.  */
05995
05996 static int
05997 bcmp_translate (s1, s2, len, translate)
05998      unsigned char *s1, *s2;
05999      register int len;
06000      RE_TRANSLATE_TYPE translate;
06001 {
06002   register unsigned char *p1 = s1, *p2 = s2;
06003   unsigned char *p1_end = s1 + len;
06004   unsigned char *p2_end = s2 + len;
06005
06006   while (p1 != p1_end && p2 != p2_end)
06007     {
06008       int p1_charlen, p2_charlen;
06009       int p1_ch, p2_ch;
06010
06011       p1_ch = STRING_CHAR_AND_LENGTH (p1, p1_end - p1, p1_charlen);
06012       p2_ch = STRING_CHAR_AND_LENGTH (p2, p2_end - p2, p2_charlen);
06013
06014       if (RE_TRANSLATE (translate, p1_ch)
06015       != RE_TRANSLATE (translate, p2_ch))
06016     return 1;
06017
06018       p1 += p1_charlen, p2 += p2_charlen;
06019     }
06020
06021   if (p1 != p1_end || p2 != p2_end)
06022     return 1;
06023
06024   return 0;
06025 }
06026
06027 /* Entry points for GNU code.  */
06028
06029 /* re_compile_pattern is the GNU regular expression compiler: it
06030    compiles PATTERN (of length SIZE) and puts the result in BUFP.
06031    Returns 0 if the pattern was valid, otherwise an error string.
06032
06033    Assumes the `allocated' (and perhaps `buffer') and `translate' fields
06034    are set in BUFP on entry.
06035
06036    We call regex_compile to do the actual compilation.  */
06037
06038 const char *
06039 re_compile_pattern (pattern, length, bufp)
06040      const char *pattern;
06041      int length;
06042      struct re_pattern_buffer *bufp;
06043 {
06044   reg_errcode_t ret;
06045
06046   /* GNU code is written to assume at least RE_NREGS registers will be set
06047      (and at least one extra will be -1).  */
06048   bufp->regs_allocated = REGS_UNALLOCATED;
06049
06050   /* And GNU code determines whether or not to get register information
06051      by passing null for the REGS argument to re_match, etc., not by
06052      setting no_sub.  */
06053   bufp->no_sub = 0;
06054
06055   /* Match anchors at newline.  */
06056   bufp->newline_anchor = 1;
06057
06058   ret = regex_compile (pattern, length, re_syntax_options, bufp);
06059
06060   if (!ret)
06061     return NULL;
06062   return gettext (re_error_msgid[(int) ret]);
06063 }
06064
06065 /* Entry points compatible with 4.2 BSD regex library.  We don't define
06066    them unless specifically requested.  */
06067
06068 #if defined (_REGEX_RE_COMP) || defined (_LIBC)
06069
06070 /* BSD has one and only one pattern buffer.  */
06071 static struct re_pattern_buffer re_comp_buf;
06072
06073 char *
06074 #ifdef _LIBC
06075 /* Make these definitions weak in libc, so POSIX programs can redefine
06076    these names if they don't use our functions, and still use
06077    regcomp/regexec below without link errors.  */
06078 weak_function
06079 #endif
06080 re_comp (s)
06081     const char *s;
06082 {
06083   reg_errcode_t ret;
06084
06085   if (!s)
06086     {
06087       if (!re_comp_buf.buffer)
06088     return gettext ("No previous regular expression");
06089       return 0;
06090     }
06091
06092   if (!re_comp_buf.buffer)
06093     {
06094       re_comp_buf.buffer = (unsigned char *) malloc (200);
06095       if (re_comp_buf.buffer == NULL)
06096         /* CVS: Yes, we're discarding `const' here if !HAVE_LIBINTL.  */
06097         return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
06098       re_comp_buf.allocated = 200;
06099
06100       re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
06101       if (re_comp_buf.fastmap == NULL)
06102     /* CVS: Yes, we're discarding `const' here if !HAVE_LIBINTL.  */
06103     return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
06104     }
06105
06106   /* Since `re_exec' always passes NULL for the `regs' argument, we
06107      don't need to initialize the pattern buffer fields which affect it.  */
06108
06109   /* Match anchors at newlines.  */
06110   re_comp_buf.newline_anchor = 1;
06111
06112   ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
06113
06114   if (!ret)
06115     return NULL;
06116
06117   /* Yes, we're discarding `const' here if !HAVE_LIBINTL.  */
06118   return (char *) gettext (re_error_msgid[(int) ret]);
06119 }
06120
06121
06122 int
06123 #ifdef _LIBC
06124 weak_function
06125 #endif
06126 re_exec (s)
06127     const char *s;
06128 {
06129   const int len = strlen (s);
06130   return
06131     0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
06132 }
06133 #endif /* _REGEX_RE_COMP */
06134
06135 /* POSIX.2 functions.  Don't define these for Emacs.  */
06136
06137 #ifndef emacs
06138
06139 /* regcomp takes a regular expression as a string and compiles it.
06140
06141    PREG is a regex_t *.  We do not expect any fields to be initialized,
06142    since POSIX says we shouldn't.  Thus, we set
06143
06144      `buffer' to the compiled pattern;
06145      `used' to the length of the compiled pattern;
06146      `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
06147        REG_EXTENDED bit in CFLAGS is set; otherwise, to
06148        RE_SYNTAX_POSIX_BASIC;
06149      `newline_anchor' to REG_NEWLINE being set in CFLAGS;
06150      `fastmap' and `fastmap_accurate' to zero;
06151      `re_nsub' to the number of subexpressions in PATTERN.
06152
06153    PATTERN is the address of the pattern string.
06154
06155    CFLAGS is a series of bits which affect compilation.
06156
06157      If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
06158      use POSIX basic syntax.
06159
06160      If REG_NEWLINE is set, then . and [^...] don't match newline.
06161      Also, regexec will try a match beginning after every newline.
06162
06163      If REG_ICASE is set, then we considers upper- and lowercase
06164      versions of letters to be equivalent when matching.
06165
06166      If REG_NOSUB is set, then when PREG is passed to regexec, that
06167      routine will report only success or failure, and nothing about the
06168      registers.
06169
06170    It returns 0 if it succeeds, nonzero if it doesn't.  (See regex.h for
06171    the return codes and their meanings.)  */
06172
06173 int
06174 regcomp (preg, pattern, cflags)
06175     regex_t *preg;
06176     const char *pattern;
06177     int cflags;
06178 {
06179   reg_errcode_t ret;
06180   unsigned syntax
06181     = (cflags & REG_EXTENDED) ?
06182       RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
06183
06184   /* regex_compile will allocate the space for the compiled pattern.  */
06185   preg->buffer = 0;
06186   preg->allocated = 0;
06187   preg->used = 0;
06188
06189   /* Don't bother to use a fastmap when searching.  This simplifies the
06190      REG_NEWLINE case: if we used a fastmap, we'd have to put all the
06191      characters after newlines into the fastmap.  This way, we just try
06192      every character.  */
06193   preg->fastmap = 0;
06194
06195   if (cflags & REG_ICASE)
06196     {
06197       unsigned i;
06198
06199       preg->translate
06200     = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE
06201                       * sizeof (*(RE_TRANSLATE_TYPE)0));
06202       if (preg->translate == NULL)
06203         return (int) REG_ESPACE;
06204
06205       /* Map uppercase characters to corresponding lowercase ones.  */
06206       for (i = 0; i < CHAR_SET_SIZE; i++)
06207         preg->translate[i] = ISUPPER (i) ? tolower (i) : i;
06208     }
06209   else
06210     preg->translate = NULL;
06211
06212   /* If REG_NEWLINE is set, newlines are treated differently.  */
06213   if (cflags & REG_NEWLINE)
06214     { /* REG_NEWLINE implies neither . nor [^...] match newline.  */
06215       syntax &= ~RE_DOT_NEWLINE;
06216       syntax |= RE_HAT_LISTS_NOT_NEWLINE;
06217       /* It also changes the matching behavior.  */
06218       preg->newline_anchor = 1;
06219     }
06220   else
06221     preg->newline_anchor = 0;
06222
06223   preg->no_sub = !!(cflags & REG_NOSUB);
06224
06225   /* POSIX says a null character in the pattern terminates it, so we
06226      can use strlen here in compiling the pattern.  */
06227   ret = regex_compile (pattern, strlen (pattern), syntax, preg);
06228
06229   /* POSIX doesn't distinguish between an unmatched open-group and an
06230      unmatched close-group: both are REG_EPAREN.  */
06231   if (ret == REG_ERPAREN) ret = REG_EPAREN;
06232
06233   return (int) ret;
06234 }
06235
06236
06237 /* regexec searches for a given pattern, specified by PREG, in the
06238    string STRING.
06239
06240    If NMATCH is zero or REG_NOSUB was set in the cflags argument to
06241    `regcomp', we ignore PMATCH.  Otherwise, we assume PMATCH has at
06242    least NMATCH elements, and we set them to the offsets of the
06243    corresponding matched substrings.
06244
06245    EFLAGS specifies `execution flags' which affect matching: if
06246    REG_NOTBOL is set, then ^ does not match at the beginning of the
06247    string; if REG_NOTEOL is set, then $ does not match at the end.
06248
06249    We return 0 if we find a match and REG_NOMATCH if not.  */
06250
06251 int
06252 regexec (preg, string, nmatch, pmatch, eflags)
06253     const regex_t *preg;
06254     const char *string;
06255     size_t nmatch;
06256     regmatch_t pmatch[];
06257     int eflags;
06258 {
06259   int ret;
06260   struct re_registers regs;
06261   regex_t private_preg;
06262   int len = strlen (string);
06263   boolean want_reg_info = !preg->no_sub && nmatch > 0;
06264
06265   private_preg = *preg;
06266
06267   private_preg.not_bol = !!(eflags & REG_NOTBOL);
06268   private_preg.not_eol = !!(eflags & REG_NOTEOL);
06269
06270   /* The user has told us exactly how many registers to return
06271      information about, via `nmatch'.  We have to pass that on to the
06272      matching routines.  */
06273   private_preg.regs_allocated = REGS_FIXED;
06274
06275   if (want_reg_info)
06276     {
06277       regs.num_regs = nmatch;
06278       regs.start = TALLOC (nmatch, regoff_t);
06279       regs.end = TALLOC (nmatch, regoff_t);
06280       if (regs.start == NULL || regs.end == NULL)
06281         return (int) REG_NOMATCH;
06282     }
06283
06284   /* Perform the searching operation.  */
06285   ret = re_search (&private_preg, string, len,
06286                    /* start: */ 0, /* range: */ len,
06287                    want_reg_info ? &regs : (struct re_registers *) 0);
06288
06289   /* Copy the register information to the POSIX structure.  */
06290   if (want_reg_info)
06291     {
06292       if (ret >= 0)
06293         {
06294           unsigned r;
06295
06296           for (r = 0; r < nmatch; r++)
06297             {
06298               pmatch[r].rm_so = regs.start[r];
06299               pmatch[r].rm_eo = regs.end[r];
06300             }
06301         }
06302
06303       /* If we needed the temporary register info, free the space now.  */
06304       free (regs.start);
06305       free (regs.end);
06306     }
06307
06308   /* We want zero return to mean success, unlike `re_search'.  */
06309   return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
06310 }
06311
06312
06313 /* Returns a message corresponding to an error code, ERRCODE, returned
06314    from either regcomp or regexec.   We don't use PREG here.  */
06315
06316 size_t
06317 regerror (errcode, preg, errbuf, errbuf_size)
06318     int errcode;
06319     const regex_t *preg;
06320     char *errbuf;
06321     size_t errbuf_size;
06322 {
06323   const char *msg;
06324   size_t msg_size;
06325
06326   if (errcode < 0
06327       || errcode >= (sizeof (re_error_msgid) / sizeof (re_error_msgid[0])))
06328     /* Only error codes returned by the rest of the code should be passed
06329        to this routine.  If we are given anything else, or if other regex
06330        code generates an invalid error code, then the program has a bug.
06331        Dump core so we can fix it.  */
06332     abort ();
06333
06334   msg = gettext (re_error_msgid[errcode]);
06335
06336   msg_size = strlen (msg) + 1; /* Includes the null.  */
06337
06338   if (errbuf_size != 0)
06339     {
06340       if (msg_size > errbuf_size)
06341         {
06342           strncpy (errbuf, msg, errbuf_size - 1);
06343           errbuf[errbuf_size - 1] = 0;
06344         }
06345       else
06346         strcpy (errbuf, msg);
06347     }
06348
06349   return msg_size;
06350 }
06351
06352
06353 /* Free dynamically allocated space used by PREG.  */
06354
06355 void
06356 regfree (preg)
06357     regex_t *preg;
06358 {
06359   if (preg->buffer != NULL)
06360     free (preg->buffer);
06361   preg->buffer = NULL;
06362
06363   preg->allocated = 0;
06364   preg->used = 0;
06365
06366   if (preg->fastmap != NULL)
06367     free (preg->fastmap);
06368   preg->fastmap = NULL;
06369   preg->fastmap_accurate = 0;
06370
06371   if (preg->translate != NULL)
06372     free (preg->translate);
06373   preg->translate = NULL;
06374 }
06375
06376 #endif /* not emacs  */
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/regex.h Source File

cvs-1.10/lib/regex.h

Go to the documentation of this file.
00001 /* Definitions for data structures and routines for the regular
00002    expression library, version 0.12.
00003
00004    Copyright (C) 1985, 89, 90, 91, 92, 93, 95 Free Software Foundation, Inc.
00005
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00019    USA.  */
00020
00021 #ifndef __REGEXP_LIBRARY_H__
00022 #define __REGEXP_LIBRARY_H__
00023
00024 /* POSIX says that <sys/types.h> must be included (by the caller) before
00025    <regex.h>.  */
00026
00027 #if !defined (_POSIX_C_SOURCE) && !defined (_POSIX_SOURCE) && defined (VMS)
00028 /* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
00029    should be there.  */
00030 #include <stddef.h>
00031 #endif
00032
00033
00034 /* The following bits are used to determine the regexp syntax we
00035    recognize.  The set/not-set meanings are chosen so that Emacs syntax
00036    remains the value 0.  The bits are given in alphabetical order, and
00037    the definitions shifted by one from the previous bit; thus, when we
00038    add or remove a bit, only one other definition need change.  */
00039 typedef unsigned reg_syntax_t;
00040
00041 /* If this bit is not set, then \ inside a bracket expression is literal.
00042    If set, then such a \ quotes the following character.  */
00043 #define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
00044
00045 /* If this bit is not set, then + and ? are operators, and \+ and \? are
00046      literals.
00047    If set, then \+ and \? are operators and + and ? are literals.  */
00048 #define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
00049
00050 /* If this bit is set, then character classes are supported.  They are:
00051      [:alpha:], [:upper:], [:lower:],  [:digit:], [:alnum:], [:xdigit:],
00052      [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
00053    If not set, then character classes are not supported.  */
00054 #define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
00055
00056 /* If this bit is set, then ^ and $ are always anchors (outside bracket
00057      expressions, of course).
00058    If this bit is not set, then it depends:
00059         ^  is an anchor if it is at the beginning of a regular
00060            expression or after an open-group or an alternation operator;
00061         $  is an anchor if it is at the end of a regular expression, or
00062            before a close-group or an alternation operator.
00063
00064    This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
00065    POSIX draft 11.2 says that * etc. in leading positions is undefined.
00066    We already implemented a previous draft which made those constructs
00067    invalid, though, so we haven't changed the code back.  */
00068 #define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
00069
00070 /* If this bit is set, then special characters are always special
00071      regardless of where they are in the pattern.
00072    If this bit is not set, then special characters are special only in
00073      some contexts; otherwise they are ordinary.  Specifically,
00074      * + ? and intervals are only special when not after the beginning,
00075      open-group, or alternation operator.  */
00076 #define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
00077
00078 /* If this bit is set, then *, +, ?, and { cannot be first in an re or
00079      immediately after an alternation or begin-group operator.  */
00080 #define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
00081
00082 /* If this bit is set, then . matches newline.
00083    If not set, then it doesn't.  */
00084 #define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
00085
00086 /* If this bit is set, then . doesn't match NUL.
00087    If not set, then it does.  */
00088 #define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
00089
00090 /* If this bit is set, nonmatching lists [^...] do not match newline.
00091    If not set, they do.  */
00092 #define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
00093
00094 /* If this bit is set, either \{...\} or {...} defines an
00095      interval, depending on RE_NO_BK_BRACES.
00096    If not set, \{, \}, {, and } are literals.  */
00097 #define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
00098
00099 /* If this bit is set, +, ? and | aren't recognized as operators.
00100    If not set, they are.  */
00101 #define RE_LIMITED_OPS (RE_INTERVALS << 1)
00102
00103 /* If this bit is set, newline is an alternation operator.
00104    If not set, newline is literal.  */
00105 #define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
00106
00107 /* If this bit is set, then `{...}' defines an interval, and \{ and \}
00108      are literals.
00109   If not set, then `\{...\}' defines an interval.  */
00110 #define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
00111
00112 /* If this bit is set, (...) defines a group, and \( and \) are literals.
00113    If not set, \(...\) defines a group, and ( and ) are literals.  */
00114 #define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
00115
00116 /* If this bit is set, then <digit> matches <digit>.
00117    If not set, then <digit> is a back-reference.  */
00118 #define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
00119
00120 /* If this bit is set, then | is an alternation operator, and \| is literal.
00121    If not set, then \| is an alternation operator, and | is literal.  */
00122 #define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
00123
00124 /* If this bit is set, then an ending range point collating higher
00125      than the starting range point, as in [z-a], is invalid.
00126    If not set, then when ending range point collates higher than the
00127      starting range point, the range is ignored.  */
00128 #define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
00129
00130 /* If this bit is set, then an unmatched ) is ordinary.
00131    If not set, then an unmatched ) is invalid.  */
00132 #define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
00133
00134 /* If this bit is set, succeed as soon as we match the whole pattern,
00135    without further backtracking.  */
00136 #define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
00137
00138 /* This global variable defines the particular regexp syntax to use (for
00139    some interfaces).  When a regexp is compiled, the syntax used is
00140    stored in the pattern buffer, so changing this does not affect
00141    already-compiled regexps.  */
00142 extern reg_syntax_t re_syntax_options;
00143
00144 #ifdef emacs
00145 /* In Emacs, this is the string or buffer in which we
00146    are matching.  It is used for looking up syntax properties.  */
00147 extern Lisp_Object re_match_object;
00148 #endif
00149
00150
00151 /* Define combinations of the above bits for the standard possibilities.
00152    (The [[[ comments delimit what gets put into the Texinfo file, so
00153    don't delete them!)  */
00154 /* [[[begin syntaxes]]] */
00155 #define RE_SYNTAX_EMACS 0
00156
00157 #define RE_SYNTAX_AWK                           \
00158   (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL           \
00159    | RE_NO_BK_PARENS            | RE_NO_BK_REFS             \
00160    | RE_NO_BK_VBAR               | RE_NO_EMPTY_RANGES           \
00161    | RE_UNMATCHED_RIGHT_PAREN_ORD)
00162
00163 #define RE_SYNTAX_POSIX_AWK                         \
00164   (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
00165
00166 #define RE_SYNTAX_GREP                          \
00167   (RE_BK_PLUS_QM              | RE_CHAR_CLASSES             \
00168    | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS                \
00169    | RE_NEWLINE_ALT)
00170
00171 #define RE_SYNTAX_EGREP                         \
00172   (RE_CHAR_CLASSES        | RE_CONTEXT_INDEP_ANCHORS            \
00173    | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE            \
00174    | RE_NEWLINE_ALT       | RE_NO_BK_PARENS             \
00175    | RE_NO_BK_VBAR)
00176
00177 #define RE_SYNTAX_POSIX_EGREP                       \
00178   (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
00179
00180 /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff.  */
00181 #define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
00182
00183 #define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
00184
00185 /* Syntax bits common to both basic and extended POSIX regex syntax.  */
00186 #define _RE_SYNTAX_POSIX_COMMON                     \
00187   (RE_CHAR_CLASSES | RE_DOT_NEWLINE      | RE_DOT_NOT_NULL      \
00188    | RE_INTERVALS  | RE_NO_EMPTY_RANGES)
00189
00190 #define RE_SYNTAX_POSIX_BASIC                       \
00191   (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
00192
00193 /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
00194    RE_LIMITED_OPS, i.e., \? \+ \| are not recognized.  Actually, this
00195    isn't minimal, since other operators, such as \`, aren't disabled.  */
00196 #define RE_SYNTAX_POSIX_MINIMAL_BASIC                   \
00197   (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
00198
00199 #define RE_SYNTAX_POSIX_EXTENDED                    \
00200   (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS           \
00201    | RE_CONTEXT_INDEP_OPS  | RE_NO_BK_BRACES                \
00202    | RE_NO_BK_PARENS       | RE_NO_BK_VBAR              \
00203    | RE_UNMATCHED_RIGHT_PAREN_ORD)
00204
00205 /* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
00206    replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added.  */
00207 #define RE_SYNTAX_POSIX_MINIMAL_EXTENDED                \
00208   (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS          \
00209    | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES               \
00210    | RE_NO_BK_PARENS        | RE_NO_BK_REFS             \
00211    | RE_NO_BK_VBAR      | RE_UNMATCHED_RIGHT_PAREN_ORD)
00212 /* [[[end syntaxes]]] */
00213
00214 /* Maximum number of duplicates an interval can allow.  Some systems
00215    (erroneously) define this in other header files, but we want our
00216    value, so remove any previous define.  */
00217 #ifdef RE_DUP_MAX
00218 #undef RE_DUP_MAX
00219 #endif
00220 #define RE_DUP_MAX ((1 << 15) - 1)
00221
00222
00223 /* POSIX `cflags' bits (i.e., information for `regcomp').  */
00224
00225 /* If this bit is set, then use extended regular expression syntax.
00226    If not set, then use basic regular expression syntax.  */
00227 #define REG_EXTENDED 1
00228
00229 /* If this bit is set, then ignore case when matching.
00230    If not set, then case is significant.  */
00231 #define REG_ICASE (REG_EXTENDED << 1)
00232
00233 /* If this bit is set, then anchors do not match at newline
00234      characters in the string.
00235    If not set, then anchors do match at newlines.  */
00236 #define REG_NEWLINE (REG_ICASE << 1)
00237
00238 /* If this bit is set, then report only success or fail in regexec.
00239    If not set, then returns differ between not matching and errors.  */
00240 #define REG_NOSUB (REG_NEWLINE << 1)
00241
00242
00243 /* POSIX `eflags' bits (i.e., information for regexec).  */
00244
00245 /* If this bit is set, then the beginning-of-line operator doesn't match
00246      the beginning of the string (presumably because it's not the
00247      beginning of a line).
00248    If not set, then the beginning-of-line operator does match the
00249      beginning of the string.  */
00250 #define REG_NOTBOL 1
00251
00252 /* Like REG_NOTBOL, except for the end-of-line.  */
00253 #define REG_NOTEOL (1 << 1)
00254
00255
00256 /* If any error codes are removed, changed, or added, update the
00257    `re_error_msg' table in regex.c.  */
00258 typedef enum
00259 {
00260   REG_NOERROR = 0,  /* Success.  */
00261   REG_NOMATCH,      /* Didn't find a match (for regexec).  */
00262
00263   /* POSIX regcomp return error codes.  (In the order listed in the
00264      standard.)  */
00265   REG_BADPAT,       /* Invalid pattern.  */
00266   REG_ECOLLATE,     /* Not implemented.  */
00267   REG_ECTYPE,       /* Invalid character class name.  */
00268   REG_EESCAPE,      /* Trailing backslash.  */
00269   REG_ESUBREG,      /* Invalid back reference.  */
00270   REG_EBRACK,       /* Unmatched left bracket.  */
00271   REG_EPAREN,       /* Parenthesis imbalance.  */
00272   REG_EBRACE,       /* Unmatched \{.  */
00273   REG_BADBR,        /* Invalid contents of \{\}.  */
00274   REG_ERANGE,       /* Invalid range end.  */
00275   REG_ESPACE,       /* Ran out of memory.  */
00276   REG_BADRPT,       /* No preceding re for repetition op.  */
00277
00278   /* Error codes we've added.  */
00279   REG_EEND,     /* Premature end.  */
00280   REG_ESIZE,        /* Compiled pattern bigger than 2^16 bytes.  */
00281   REG_ERPAREN       /* Unmatched ) or \); not returned from regcomp.  */
00282 } reg_errcode_t;
00283
00284 /* This data structure represents a compiled pattern.  Before calling
00285    the pattern compiler, the fields `buffer', `allocated', `fastmap',
00286    `translate', and `no_sub' can be set.  After the pattern has been
00287    compiled, the `re_nsub' field is available.  All other fields are
00288    private to the regex routines.  */
00289
00290 #ifndef RE_TRANSLATE_TYPE
00291 #define RE_TRANSLATE_TYPE char *
00292 #define RE_TRANSLATE(TBL, C) ((TBL)[C])
00293 #define RE_TRANSLATE_P(TBL) (TBL)
00294 #endif
00295
00296 struct re_pattern_buffer
00297 {
00298 /* [[[begin pattern_buffer]]] */
00299     /* Space that holds the compiled pattern.  It is declared as
00300           `unsigned char *' because its elements are
00301            sometimes used as array indexes.  */
00302   unsigned char *buffer;
00303
00304     /* Number of bytes to which `buffer' points.  */
00305   unsigned long allocated;
00306
00307     /* Number of bytes actually used in `buffer'.  */
00308   unsigned long used;
00309
00310         /* Syntax setting with which the pattern was compiled.  */
00311   reg_syntax_t syntax;
00312
00313         /* Pointer to a fastmap, if any, otherwise zero.  re_search uses
00314            the fastmap, if there is one, to skip over impossible
00315            starting points for matches.  */
00316   char *fastmap;
00317
00318         /* Either a translate table to apply to all characters before
00319            comparing them, or zero for no translation.  The translation
00320            is applied to a pattern when it is compiled and to a string
00321            when it is matched.  */
00322   RE_TRANSLATE_TYPE translate;
00323
00324     /* Number of subexpressions found by the compiler.  */
00325   size_t re_nsub;
00326
00327         /* Zero if this pattern cannot match the empty string, one else.
00328            Well, in truth it's used only in `re_search_2', to see
00329            whether or not we should use the fastmap, so we don't set
00330            this absolutely perfectly; see `re_compile_fastmap' (the
00331            `duplicate' case).  */
00332   unsigned can_be_null : 1;
00333
00334         /* If REGS_UNALLOCATED, allocate space in the `regs' structure
00335              for `max (RE_NREGS, re_nsub + 1)' groups.
00336            If REGS_REALLOCATE, reallocate space if necessary.
00337            If REGS_FIXED, use what's there.  */
00338 #define REGS_UNALLOCATED 0
00339 #define REGS_REALLOCATE 1
00340 #define REGS_FIXED 2
00341   unsigned regs_allocated : 2;
00342
00343         /* Set to zero when `regex_compile' compiles a pattern; set to one
00344            by `re_compile_fastmap' if it updates the fastmap.  */
00345   unsigned fastmap_accurate : 1;
00346
00347         /* If set, `re_match_2' does not return information about
00348            subexpressions.  */
00349   unsigned no_sub : 1;
00350
00351         /* If set, a beginning-of-line anchor doesn't match at the
00352            beginning of the string.  */
00353   unsigned not_bol : 1;
00354
00355         /* Similarly for an end-of-line anchor.  */
00356   unsigned not_eol : 1;
00357
00358         /* If true, an anchor at a newline matches.  */
00359   unsigned newline_anchor : 1;
00360
00361   /* If true, multi-byte form in the `buffer' should be recognized as a
00362      multibyte character. */
00363   unsigned multibyte : 1;
00364
00365 /* [[[end pattern_buffer]]] */
00366 };
00367
00368 typedef struct re_pattern_buffer regex_t;
00369
00370 /* Type for byte offsets within the string.  POSIX mandates this.  */
00371 typedef int regoff_t;
00372
00373
00374 /* This is the structure we store register match data in.  See
00375    regex.texinfo for a full description of what registers match.  */
00376 struct re_registers
00377 {
00378   unsigned num_regs;
00379   regoff_t *start;
00380   regoff_t *end;
00381 };
00382
00383
00384 /* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
00385    `re_match_2' returns information about at least this many registers
00386    the first time a `regs' structure is passed.  */
00387 #ifndef RE_NREGS
00388 #define RE_NREGS 30
00389 #endif
00390
00391
00392 /* POSIX specification for registers.  Aside from the different names than
00393    `re_registers', POSIX uses an array of structures, instead of a
00394    structure of arrays.  */
00395 typedef struct
00396 {
00397   regoff_t rm_so;  /* Byte offset from string's start to substring's start.  */
00398   regoff_t rm_eo;  /* Byte offset from string's start to substring's end.  */
00399 } regmatch_t;
00400
00401 /* Declarations for routines.  */
00402
00403 /* To avoid duplicating every routine declaration -- once with a
00404    prototype (if we are ANSI), and once without (if we aren't) -- we
00405    use the following macro to declare argument types.  This
00406    unfortunately clutters up the declarations a bit, but I think it's
00407    worth it.  */
00408
00409 #if __STDC__
00410
00411 #define _RE_ARGS(args) args
00412
00413 #else /* not __STDC__ */
00414
00415 #define _RE_ARGS(args) ()
00416
00417 #endif /* not __STDC__ */
00418
00419 /* Sets the current default syntax to SYNTAX, and return the old syntax.
00420    You can also simply assign to the `re_syntax_options' variable.  */
00421 extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
00422
00423 /* Compile the regular expression PATTERN, with length LENGTH
00424    and syntax given by the global `re_syntax_options', into the buffer
00425    BUFFER.  Return NULL if successful, and an error string if not.  */
00426 extern const char *re_compile_pattern
00427   _RE_ARGS ((const char *pattern, int length,
00428              struct re_pattern_buffer *buffer));
00429
00430
00431 /* Compile a fastmap for the compiled pattern in BUFFER; used to
00432    accelerate searches.  Return 0 if successful and -2 if was an
00433    internal error.  */
00434 extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
00435
00436
00437 /* Search in the string STRING (with length LENGTH) for the pattern
00438    compiled into BUFFER.  Start searching at position START, for RANGE
00439    characters.  Return the starting position of the match, -1 for no
00440    match, or -2 for an internal error.  Also return register
00441    information in REGS (if REGS and BUFFER->no_sub are nonzero).  */
00442 extern int re_search
00443   _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
00444             int length, int start, int range, struct re_registers *regs));
00445
00446
00447 /* Like `re_search', but search in the concatenation of STRING1 and
00448    STRING2.  Also, stop searching at index START + STOP.  */
00449 extern int re_search_2
00450   _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
00451              int length1, const char *string2, int length2,
00452              int start, int range, struct re_registers *regs, int stop));
00453
00454
00455 /* Like `re_search', but return how many characters in STRING the regexp
00456    in BUFFER matched, starting at position START.  */
00457 extern int re_match
00458   _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
00459              int length, int start, struct re_registers *regs));
00460
00461
00462 /* Relates to `re_match' as `re_search_2' relates to `re_search'.  */
00463 extern int re_match_2
00464   _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
00465              int length1, const char *string2, int length2,
00466              int start, struct re_registers *regs, int stop));
00467
00468
00469 /* Set REGS to hold NUM_REGS registers, storing them in STARTS and
00470    ENDS.  Subsequent matches using BUFFER and REGS will use this memory
00471    for recording register information.  STARTS and ENDS must be
00472    allocated with malloc, and must each be at least `NUM_REGS * sizeof
00473    (regoff_t)' bytes long.
00474
00475    If NUM_REGS == 0, then subsequent matches should allocate their own
00476    register data.
00477
00478    Unless this function is called, the first search or match using
00479    PATTERN_BUFFER will allocate its own register data, without
00480    freeing the old data.  */
00481 extern void re_set_registers
00482   _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
00483              unsigned num_regs, regoff_t *starts, regoff_t *ends));
00484
00485 #ifdef _REGEX_RE_COMP
00486 /* 4.2 bsd compatibility.  */
00487 /* CVS: don't use prototypes: they may conflict with system headers.  */
00488 extern char *re_comp _RE_ARGS (());
00489 extern int re_exec _RE_ARGS (());
00490 #endif
00491
00492 /* POSIX compatibility.  */
00493 extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
00494 extern int regexec
00495   _RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch,
00496              regmatch_t pmatch[], int eflags));
00497 extern size_t regerror
00498   _RE_ARGS ((int errcode, const regex_t *preg, char *errbuf,
00499              size_t errbuf_size));
00500 extern void regfree _RE_ARGS ((regex_t *preg));
00501
00502 #endif /* not __REGEXP_LIBRARY_H__ */
00503
00504 /*
00505 Local variables:
00506 make-backup-files: t
00507 version-control: t
00508 trim-versions-without-asking: nil
00509 End:
00510 */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/rename.c Source File

cvs-1.10/lib/rename.c

Go to the documentation of this file.
00001 /* rename.c -- BSD compatible directory function for System V
00002    Copyright (C) 1988, 1990 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #ifdef HAVE_CONFIG_H
00015 #include "config.h"
00016 #endif
00017
00018 #include <sys/types.h>
00019 #include <sys/stat.h>
00020 #include <errno.h>
00021 #ifndef STDC_HEADERS
00022 extern int errno;
00023 #endif
00024
00025 /* Rename file FROM to file TO.
00026    Return 0 if successful, -1 if not. */
00027
00028 int
00029 rename (from, to)
00030      char *from;
00031      char *to;
00032 {
00033   struct stat from_stats;
00034   int pid, status;
00035
00036   if (stat (from, &from_stats) == 0)
00037     {
00038       /* We don't check existence_error because the systems which need it
00039      have rename().  */
00040       if (unlink (to) && errno != ENOENT)
00041     return -1;
00042       if ((from_stats.st_mode & S_IFMT) == S_IFDIR)
00043     {
00044 #ifdef MVDIR
00045       /* I don't think MVDIR ever gets defined, but I don't think
00046          it matters, because I don't think CVS ever calls rename()
00047          on directories.  */
00048
00049       /* Need a setuid root process to link and unlink directories. */
00050       pid = fork ();
00051       switch (pid)
00052         {
00053         case -1:        /* Error. */
00054           error (1, errno, "cannot fork");
00055
00056         case 0:     /* Child. */
00057           execl (MVDIR, "mvdir", from, to, (char *) 0);
00058           error (255, errno, "cannot run `%s'", MVDIR);
00059
00060         default:        /* Parent. */
00061           while (wait (&status) != pid)
00062         /* Do nothing. */ ;
00063
00064           errno = 0;    /* mvdir printed the system error message. */
00065           return status != 0 ? -1 : 0;
00066         }
00067 #else /* no MVDIR */
00068       error (1, 0, "internal error: cannot move directories");
00069 #endif /* no MVDIR */
00070     }
00071       else
00072     {
00073       /* We don't check existence_error because the systems which need it
00074          have rename().  */
00075       if (link (from, to) == 0 && (unlink (from) == 0 || errno == ENOENT))
00076         return 0;
00077     }
00078     }
00079   return -1;
00080 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


regex.c File Reference

cvs-1.10/lib/regex.c File Reference

#include <sys/types.h>
#include <strings.h>
#include "regex.h"
#include <ctype.h>

Include dependency graph for regex.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | _GNU_SOURCE
#define | PTR_TO_OFFSET(d) 0
#define | gettext(msgid) (msgid)
#define | gettext_noop(String) String
#define | Sword 1
#define | SWITCH_ENUM_CAST(x) (x)
#define | CHAR_SET_SIZE 256
#define | SYNTAX(c) re_syntax_table[c]
#define | BASE_LEADING_CODE_P(c) (0)
#define | WORD_BOUNDARY_P(c1, c2) (0)
#define | CHAR_HEAD_P(p) (1)
#define | SINGLE_BYTE_CHAR_P(c) (1)
#define | SAME_CHARSET_P(c1, c2) (1)
#define | MULTIBYTE_FORM_LENGTH(p, s) (1)
#define | STRING_CHAR(p, s) (*(p))
#define | STRING_CHAR_AND_LENGTH(p, s, actual_len) ((actual_len) = 1, *(p))
#define | GET_CHAR_AFTER_2(c, p, str1, end1, str2, end2) (c = ((p) == (end1) ? *(str2) : *(p)))
#define | GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) (c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1)))
#define | ISASCII(c) 1
#define | ISBLANK(c) ((c) == ' ' || (c) == '\t')
#define | ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
#define | ISPRINT(c) (ISASCII (c) && isprint (c))
#define | ISDIGIT(c) (ISASCII (c) && isdigit (c))
#define | ISALNUM(c) (ISASCII (c) && isalnum (c))
#define | ISALPHA(c) (ISASCII (c) && isalpha (c))
#define | ISCNTRL(c) (ISASCII (c) && iscntrl (c))
#define | ISLOWER(c) (ISASCII (c) && islower (c))
#define | ISPUNCT(c) (ISASCII (c) && ispunct (c))
#define | ISSPACE(c) (ISASCII (c) && isspace (c))
#define | ISUPPER(c) (ISASCII (c) && isupper (c))
#define | ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
#define | NULL (void *)0
#define | SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
#define | REGEX_ALLOCATE alloca
#define | REGEX_REALLOCATE(source, osize, nsize)
#define | REGEX_FREE(arg) ((void)0)
#define | REGEX_ALLOCATE_STACK alloca
#define | REGEX_REALLOCATE_STACK(source, osize, nsize) REGEX_REALLOCATE (source, osize, nsize)
#define | REGEX_FREE_STACK(arg)
#define | FIRST_STRING_P(ptr) (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
#define | TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
#define | RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
#define | RETALLOC_IF(addr, n, t) if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
#define | REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
#define | BYTEWIDTH 8
#define | STREQ(s1, s2) ((strcmp (s1, s2) == 0))
#define | MAX(a, b) ((a) > (b) ? (a) : (b))
#define | MIN(a, b) ((a) < (b) ? (a) : (b))
#define | false 0
#define | true 1
#define | STORE_NUMBER(destination, number)
#define | STORE_NUMBER_AND_INCR(destination, number)
#define | EXTRACT_NUMBER(destination, source)
#define | EXTRACT_NUMBER_AND_INCR(destination, source)
#define | STORE_CHARACTER_AND_INCR(destination, character)
#define | EXTRACT_CHARACTER(destination, source)
#define | CHARSET_BITMAP_SIZE(p) ((p)[1] & 0x7F)
#define | CHARSET_RANGE_TABLE_EXISTS_P(p) ((p)[1] & 0x80)
#define | CHARSET_RANGE_TABLE(p) (&(p)[2 + CHARSET_BITMAP_SIZE (p)])
#define | CHARSET_LOOKUP_BITMAP(p, c)
#define | CHARSET_RANGE_TABLE_END(range_table, count) ((range_table) + (count) * 2 * 3)
#define | CHARSET_LOOKUP_RANGE_TABLE_RAW(not, c, range_table, count)
#define | CHARSET_LOOKUP_RANGE_TABLE(not, c, charset)
#define | assert(e)
#define | DEBUG_STATEMENT(e)
#define | DEBUG_PRINT1(x)
#define | DEBUG_PRINT2(x1, x2)
#define | DEBUG_PRINT3(x1, x2, x3)
#define | DEBUG_PRINT4(x1, x2, x3, x4)
#define | DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
#define | DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
#define | MATCH_MAY_ALLOCATE
#define | INIT_FAILURE_ALLOC 20
#define | FAIL_STACK_EMPTY() (fail_stack.avail == 0)
#define | FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
#define | FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
#define | INIT_FAIL_STACK()
#define | RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
#define | FAIL_STACK_GROWTH_FACTOR 4
#define | GROW_FAIL_STACK(fail_stack)
#define | PUSH_PATTERN_OP(POINTER, FAIL_STACK)
#define | PUSH_FAILURE_POINTER(item) fail_stack.stack[fail_stack.avail++].pointer = (unsigned char *) (item)
#define | PUSH_FAILURE_INT(item) fail_stack.stack[fail_stack.avail++].integer = (item)
#define | PUSH_FAILURE_ELT(item) fail_stack.stack[fail_stack.avail++] = (item)
#define | POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer
#define | POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer
#define | POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail]
#define | DEBUG_PUSH(item)
#define | DEBUG_POP(item_addr)
#define | PUSH_FAILURE_POINT(pattern_place, string_place, failure_code)
#define | NUM_REG_ITEMS 3
#define | NUM_NONREG_ITEMS 4
#define | TYPICAL_FAILURE_SIZE 20
#define | NUM_FAILURE_ITEMS
#define | REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
#define | POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)
#define | MATCH_NULL_UNSET_VALUE 3
#define | REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p)
#define | IS_ACTIVE(R) ((R).bits.is_active)
#define | MATCHED_SOMETHING(R) ((R).bits.matched_something)
#define | EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something)
#define | SET_REGS_MATCHED()
#define | REG_UNSET_VALUE (&reg_unset_dummy)
#define | REG_UNSET(e) ((e) == REG_UNSET_VALUE)
#define | PATFETCH(c)
#define | PATFETCH_RAW(c)
#define | PATUNFETCH p--
#define | TRANSLATE(d)
#define | INIT_BUF_SIZE 32
#define | GET_BUFFER_SPACE(n)
#define | BUF_PUSH(c)
#define | BUF_PUSH_2(c1, c2)
#define | BUF_PUSH_3(c1, c2, c3)
#define | STORE_JUMP(op, loc, to) store_op1 (op, loc, (to) - (loc) - 3)
#define | STORE_JUMP2(op, loc, to, arg) store_op2 (op, loc, (to) - (loc) - 3, arg)
#define | INSERT_JUMP(op, loc, to) insert_op1 (op, loc, (to) - (loc) - 3, b)
#define | INSERT_JUMP2(op, loc, to, arg) insert_op2 (op, loc, (to) - (loc) - 3, arg, b)
#define | MAX_BUF_SIZE (1L << 16)
#define | EXTEND_BUFFER()
#define | MAX_REGNUM 255
#define | INIT_COMPILE_STACK_SIZE 32
#define | COMPILE_STACK_EMPTY (compile_stack.avail == 0)
#define | COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size)
#define | COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
#define | EXTEND_RANGE_TABLE_WORK_AREA(work_area, n)
#define | SET_RANGE_TABLE_WORK_AREA(work_area, range_start, range_end)
#define | FREE_RANGE_TABLE_WORK_AREA(work_area)
#define | CLEAR_RANGE_TABLE_WORK_USED(work_area) ((work_area).used = 0)
#define | RANGE_TABLE_WORK_USED(work_area) ((work_area).used)
#define | RANGE_TABLE_WORK_ELT(work_area, i) ((work_area).table[i])
#define | SET_LIST_BIT(c)
#define | GET_UNSIGNED_NUMBER(num)
#define | CHAR_CLASS_MAX_LENGTH 6
#define | IS_CHAR_CLASS(string)
#define | FREE_STACK_RETURN(value)
#define | STOP_ADDR_VSTRING(P) (((P) >= size1 ? string2 + size2 : string1 + size1))
#define | POS_ADDR_VSTRING(POS) (((POS) >= size1 ? string2 - size1 : string1) + (POS))
#define | POINTER_TO_OFFSET(ptr)
#define | MATCHING_IN_FIRST_STRING (dend == end_match_1)
#define | PREFETCH()
#define | AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
#define | AT_STRINGS_END(d) ((d) == end2)
#define | WORDCHAR_P(d)
#define | FREE_VAR(var) if (var) { REGEX_FREE (var); var = NULL; } else
#define | FREE_VARIABLES()
#define | NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
#define | NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)

Typedefs

typedef char | boolean

Enumerations

enum re_opcode_t {
no_op = 0, succeed, exactn, anychar,
charset, charset_not, start_memory, stop_memory,
duplicate, begline, endline, begbuf,
endbuf, jump, jump_past_alt, on_failure_jump,
on_failure_keep_string_jump, pop_failure_jump, maybe_pop_jump, dummy_failure_jump,
push_dummy_failure, succeed_n, jump_n, set_number_at,
wordchar, notwordchar, wordbeg, wordend,
wordbound, notwordbound
}

Functions

char * | malloc ()
char * | realloc ()
void | init_syntax_once ()
int | re_match_2_internal ()
reg_syntax_t | re_set_syntax (syntax) reg_syntax_t syntax

Variables

char | re_syntax_table [256]
reg_syntax_t re_syntax_options

Define Documentation

#define AT_STRINGS_BEG ( d ) ((d) == (size1 ? string1 : string2) || !size2)

#define AT_STRINGS_END ( d ) ((d) == end2)

#define BASE_LEADING_CODE_P ( c ) (0)

Definition at line 177 of file regex.c.

#define BUF_PUSH ( c )

Value:

do {                                    \
    GET_BUFFER_SPACE (1);                       \
    *b++ = (unsigned char) (c);                     \
  } while (0)

#define BUF_PUSH_2 | ( | c1,
 |  | c2 | )

Value:

do {                                    \
    GET_BUFFER_SPACE (2);                       \
    *b++ = (unsigned char) (c1);                    \
    *b++ = (unsigned char) (c2);                    \
  } while (0)

#define BUF_PUSH_3 | ( | c1,
 |  | c2,
 |  | c3 | )

Value:

do {                                    \
    GET_BUFFER_SPACE (3);                       \
    *b++ = (unsigned char) (c1);                    \
    *b++ = (unsigned char) (c2);                    \
    *b++ = (unsigned char) (c3);                    \
  } while (0)

#define BYTEWIDTH 8

Definition at line 348 of file regex.c.

#define CHARSET_BITMAP_SIZE ( p ) ((p)[1] & 0x7F)

Definition at line 613 of file regex.c.

#define CHARSET_LOOKUP_BITMAP | ( | p,
 |  | c | )

Value:

((c) < CHARSET_BITMAP_SIZE (p) * BYTEWIDTH          \
   && (p)[2 + (c) / BYTEWIDTH] & (1 << ((c) % BYTEWIDTH)))

Definition at line 624 of file regex.c.

#define CHARSET_LOOKUP_RANGE_TABLE | ( | not,
 |  | c,
 |  | charset | )

Value:

do                                  \
    {                                   \
                    \
      int count;                            \
      unsigned char *range_table = CHARSET_RANGE_TABLE (charset);   \
                                    \
      EXTRACT_NUMBER_AND_INCR (count, range_table);         \
      CHARSET_LOOKUP_RANGE_TABLE_RAW ((not), (c), range_table, count);  \
    }                                   \
  while (0)

Definition at line 661 of file regex.c.

#define CHARSET_LOOKUP_RANGE_TABLE_RAW | ( | not,
 |  | c,
 |  | range_table,
 |  | count | )

Value:

do                                  \
    {                                   \
      int range_start, range_end;                   \
      unsigned char *p;                         \
      unsigned char *range_table_end                    \
    = CHARSET_RANGE_TABLE_END ((range_table), (count));     \
                                    \
      for (p = (range_table); p < range_table_end; p += 2 * 3)      \
    {                               \
      EXTRACT_CHARACTER (range_start, p);               \
      EXTRACT_CHARACTER (range_end, p + 3);             \
                                    \
      if (range_start <= (c) && (c) <= range_end)           \
        {                               \
          (not) = !(not);                       \
          break;                            \
        }                               \
    }                               \
    }                                   \
  while (0)

Definition at line 637 of file regex.c.

#define CHARSET_RANGE_TABLE ( p ) (&(p)[2 + CHARSET_BITMAP_SIZE (p)])

Definition at line 621 of file regex.c.

#define CHARSET_RANGE_TABLE_END | ( | range_table,
 |  | count | ) | ((range_table) + (count) * 2 * 3)

Definition at line 632 of file regex.c.

#define CHARSET_RANGE_TABLE_EXISTS_P ( p ) ((p)[1] & 0x80)

Definition at line 616 of file regex.c.

#define CHAR_CLASS_MAX_LENGTH 6

#define CHAR_HEAD_P ( p ) (1)

Definition at line 179 of file regex.c.

#define CHAR_SET_SIZE 256

Definition at line 143 of file regex.c.

#define CLEAR_RANGE_TABLE_WORK_USED ( work_area ) ((work_area).used = 0)

#define COMPILE_STACK_EMPTY (compile_stack.avail == 0)

#define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size)

#define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])

#define DEBUG_POP ( item_addr )

#define DEBUG_PRINT1 ( x )

Definition at line 1025 of file regex.c.

#define DEBUG_PRINT2 | ( | x1,
 |  | x2 | )

Definition at line 1026 of file regex.c.

#define DEBUG_PRINT3 | ( | x1,
 |  | x2,
 |  | x3 | )

Definition at line 1027 of file regex.c.

#define DEBUG_PRINT4 | ( | x1,
 |  | x2,
 |  | x3,
 |  | x4 | )

Definition at line 1028 of file regex.c.

#define DEBUG_PRINT_COMPILED_PATTERN | ( | p,
 |  | s,
 |  | e | )

Definition at line 1029 of file regex.c.

#define DEBUG_PRINT_DOUBLE_STRING | ( | w,
 |  | s1,
 |  | sz1,
 |  | s2,
 |  | sz2 | )

Definition at line 1030 of file regex.c.

#define DEBUG_PUSH ( item )

#define DEBUG_STATEMENT ( e )

Definition at line 1024 of file regex.c.

#define EVER_MATCHED_SOMETHING ( R ) ((R).bits.ever_matched_something)

#define EXTEND_BUFFER ( )

Value:

do {                                    \
    unsigned char *old_buffer = bufp->buffer;               \
    if (bufp->allocated == MAX_BUF_SIZE)                \
      return REG_ESIZE;                         \
    bufp->allocated <<= 1;                      \
    if (bufp->allocated > MAX_BUF_SIZE)                 \
      bufp->allocated = MAX_BUF_SIZE;                   \
    bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\
    if (bufp->buffer == NULL)                       \
      return REG_ESPACE;                        \
            \
    if (old_buffer != bufp->buffer)                 \
      {                                 \
    b = (b - old_buffer) + bufp->buffer;                \
    begalt = (begalt - old_buffer) + bufp->buffer;          \
    if (fixup_alt_jump)                     \
      fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
    if (laststart)                          \
      laststart = (laststart - old_buffer) + bufp->buffer;      \
    if (pending_exact)                      \
      pending_exact = (pending_exact - old_buffer) + bufp->buffer;  \
      }                                 \
  } while (0)

#define EXTEND_RANGE_TABLE_WORK_AREA | ( | work_area,
 |  | n | )

Value:

do {                                      \
    if (((work_area).used + (n)) * sizeof (int) > (work_area).allocated)  \
      {                                   \
    (work_area).allocated += 16 * sizeof (int);           \
    if ((work_area).table)                        \
      (work_area).table                       \
        = (int *) realloc ((work_area).table, (work_area).allocated); \
    else                                  \
      (work_area).table                       \
        = (int *) malloc ((work_area).allocated);             \
    if ((work_area).table == 0)                   \
      FREE_STACK_RETURN (REG_ESPACE);                 \
      }                                   \
  } while (0)

#define EXTRACT_CHARACTER | ( | destination,
 |  | source | )

Value:

do {                        \
    (destination) = ((source)[0]        \
             | ((source)[1] << 8)   \
             | ((source)[2] << 16));    \
  } while (0)

Definition at line 601 of file regex.c.

#define EXTRACT_NUMBER | ( | destination,
 |  | source | )

Value:

do {                                    \
    (destination) = *(source) & 0377;                   \
    (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8;       \
  } while (0)

Definition at line 535 of file regex.c.

#define EXTRACT_NUMBER_AND_INCR | ( | destination,
 |  | source | )

Value:

do {                                    \
    EXTRACT_NUMBER (destination, source);               \
    (source) += 2;                          \
  } while (0)

Definition at line 562 of file regex.c.

#define FAIL_STACK_EMPTY ( ) (fail_stack.avail == 0)

#define FAIL_STACK_FULL ( ) (fail_stack.avail == fail_stack.size)

#define FAIL_STACK_GROWTH_FACTOR 4

#define FAIL_STACK_PTR_EMPTY ( ) (fail_stack_ptr->avail == 0)

#define FIRST_STRING_P ( ptr ) (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)

Definition at line 338 of file regex.c.

#define FREE_RANGE_TABLE_WORK_AREA ( work_area )

Value:

do {                        \
    if ((work_area).table)          \
      free ((work_area).table);         \
  } while (0)

#define FREE_STACK_RETURN ( value )

Value:

do {                            \
    FREE_RANGE_TABLE_WORK_AREA (range_table_work);  \
    free (compile_stack.stack);             \
    return value;                   \
  } while (0)

#define FREE_VAR ( var ) if (var) { REGEX_FREE (var); var = NULL; } else

#define FREE_VARIABLES ( )

Value:

do {                                    \
    REGEX_FREE_STACK (fail_stack.stack);                \
    FREE_VAR (regstart);                        \
    FREE_VAR (regend);                          \
    FREE_VAR (old_regstart);                        \
    FREE_VAR (old_regend);                      \
    FREE_VAR (best_regstart);                       \
    FREE_VAR (best_regend);                     \
    FREE_VAR (reg_info);                        \
    FREE_VAR (reg_dummy);                       \
    FREE_VAR (reg_info_dummy);                      \
  } while (0)

#define GET_BUFFER_SPACE ( n )

Value:

while (b - bufp->buffer + (n) > bufp->allocated)            \
      EXTEND_BUFFER ()

#define GET_CHAR_AFTER_2 | ( | c,
 |  | p,
 |  | str1,
 |  | end1,
 |  | str2,
 |  | end2 | ) | (c = ((p) == (end1) ? *(str2) : *(p)))

Definition at line 185 of file regex.c.

#define GET_CHAR_BEFORE_2 | ( | c,
 |  | p,
 |  | str1,
 |  | end1,
 |  | str2,
 |  | end2 | ) | (c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1)))

Definition at line 187 of file regex.c.

#define GET_UNSIGNED_NUMBER ( num )

Value:

{ if (p != pend)                            \
     {                                  \
       PATFETCH (c);                            \
       while (ISDIGIT (c))                      \
     {                              \
       if (num < 0)                         \
          num = 0;                          \
       num = num * 10 + c - '0';                    \
       if (p == pend)                       \
          break;                            \
       PATFETCH (c);                        \
     }                              \
       }                                \
    }

#define GROW_FAIL_STACK ( fail_stack )

Value:

(((fail_stack).size * sizeof (fail_stack_elt_t)         \
    >= re_max_failures * TYPICAL_FAILURE_SIZE)              \
   ? 0                                  \
   : ((fail_stack).stack                        \
      = (fail_stack_elt_t *)                        \
    REGEX_REALLOCATE_STACK ((fail_stack).stack,         \
      (fail_stack).size * sizeof (fail_stack_elt_t),        \
      MIN (re_max_failures * TYPICAL_FAILURE_SIZE,          \
           ((fail_stack).size * sizeof (fail_stack_elt_t)       \
        * FAIL_STACK_GROWTH_FACTOR))),              \
                                    \
      (fail_stack).stack == NULL                    \
      ? 0                               \
      : ((fail_stack).size                      \
     = (MIN (re_max_failures * TYPICAL_FAILURE_SIZE,        \
         ((fail_stack).size * sizeof (fail_stack_elt_t)     \
          * FAIL_STACK_GROWTH_FACTOR))              \
        / sizeof (fail_stack_elt_t)),               \
     1)))

#define INIT_BUF_SIZE 32

#define INIT_COMPILE_STACK_SIZE 32

#define INIT_FAILURE_ALLOC 20

#define INIT_FAIL_STACK ( )

Value:

do {                                    \
    fail_stack.stack = (fail_stack_elt_t *)             \
      REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * TYPICAL_FAILURE_SIZE   \
                * sizeof (fail_stack_elt_t));       \
                                    \
    if (fail_stack.stack == NULL)                   \
      return -2;                            \
                                    \
    fail_stack.size = INIT_FAILURE_ALLOC;               \
    fail_stack.avail = 0;                       \
  } while (0)

#define INSERT_JUMP | ( | op,
 |  | loc,
 |  | to | ) | insert_op1 (op, loc, (to) - (loc) - 3, b)

#define INSERT_JUMP2 | ( | op,
 |  | loc,
 |  | to,
 |  | arg | ) | insert_op2 (op, loc, (to) - (loc) - 3, arg, b)

#define ISALNUM ( c ) (ISASCII (c) && isalnum (c))

Definition at line 227 of file regex.c.

#define ISALPHA ( c ) (ISASCII (c) && isalpha (c))

Definition at line 228 of file regex.c.

#define ISASCII ( c ) 1

Definition at line 209 of file regex.c.

#define ISBLANK ( c ) ((c) == ' ' || (c) == '\t')

Definition at line 217 of file regex.c.

#define ISCNTRL ( c ) (ISASCII (c) && iscntrl (c))

Definition at line 229 of file regex.c.

#define ISDIGIT ( c ) (ISASCII (c) && isdigit (c))

Definition at line 226 of file regex.c.

#define ISGRAPH ( c ) (ISASCII (c) && isprint (c) && !isspace (c))

Definition at line 222 of file regex.c.

#define ISLOWER ( c ) (ISASCII (c) && islower (c))

Definition at line 230 of file regex.c.

#define ISPRINT ( c ) (ISASCII (c) && isprint (c))

Definition at line 225 of file regex.c.

#define ISPUNCT ( c ) (ISASCII (c) && ispunct (c))

Definition at line 231 of file regex.c.

#define ISSPACE ( c ) (ISASCII (c) && isspace (c))

Definition at line 232 of file regex.c.

#define ISUPPER ( c ) (ISASCII (c) && isupper (c))

Definition at line 233 of file regex.c.

#define ISXDIGIT ( c ) (ISASCII (c) && isxdigit (c))

Definition at line 234 of file regex.c.

#define IS_ACTIVE ( R ) ((R).bits.is_active)

#define IS_CHAR_CLASS ( string )

Value:

(STREQ (string, "alpha") || STREQ (string, "upper")         \
    || STREQ (string, "lower") || STREQ (string, "digit")       \
    || STREQ (string, "alnum") || STREQ (string, "xdigit")      \
    || STREQ (string, "space") || STREQ (string, "print")       \
    || STREQ (string, "punct") || STREQ (string, "graph")       \
    || STREQ (string, "cntrl") || STREQ (string, "blank"))

#define MATCHED_SOMETHING ( R ) ((R).bits.matched_something)

#define MATCHING_IN_FIRST_STRING (dend == end_match_1)

#define MATCH_MAY_ALLOCATE

#define MATCH_NULL_UNSET_VALUE 3

#define MAX | ( | a,
 |  | b | ) | ((a) > (b) ? (a) : (b))

Definition at line 354 of file regex.c.

Referenced by UnionRect(), and errno_max().

#define MAX_BUF_SIZE (1L << 16)

#define MAX_REGNUM 255

#define MIN | ( | a,
 |  | b | ) | ((a) < (b) ? (a) : (b))

Definition at line 355 of file regex.c.

Referenced by UnionRect().

#define MULTIBYTE_FORM_LENGTH | ( | p,
 |  | s | ) | (1)

Definition at line 182 of file regex.c.

#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)

#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)

#define NULL (void *)0

Definition at line 237 of file regex.c.

#define NUM_FAILURE_ITEMS

Value:

(((0                            \
     ? 0 : highest_active_reg - lowest_active_reg + 1)  \
    * NUM_REG_ITEMS)                    \
   + NUM_NONREG_ITEMS)

#define NUM_NONREG_ITEMS 4

#define NUM_REG_ITEMS 3

#define PATFETCH ( c )

Value:

do {if (p == pend) return REG_EEND;                 \
    c = (unsigned char) *p++;                       \
    if (RE_TRANSLATE_P (translate)) c = RE_TRANSLATE (translate, c);    \
  } while (0)

#define PATFETCH_RAW ( c )

Value:

do {if (p == pend) return REG_EEND;                 \
    c = (unsigned char) *p++;                       \
  } while (0)

#define PATUNFETCH p--

#define POINTER_TO_OFFSET ( ptr )

Value:

(FIRST_STRING_P (ptr)               \
   ? ((regoff_t) ((ptr) - string1))     \
   : ((regoff_t) ((ptr) - string2 + size1)))

#define POP_FAILURE_ELT ( ) fail_stack.stack[--fail_stack.avail]

#define POP_FAILURE_INT ( ) fail_stack.stack[--fail_stack.avail].integer

#define POP_FAILURE_POINT | ( | str,
 |  | pat,
 |  | low_reg,
 |  | high_reg,
 |  | regstart,
 |  | regend,
 |  | reg_info | )

#define POP_FAILURE_POINTER ( ) fail_stack.stack[--fail_stack.avail].pointer

#define POS_ADDR_VSTRING ( POS ) (((POS) >= size1 ? string2 - size1 : string1) + (POS))

#define PREFETCH ( )

Value:

while (d == dend)                           \
    {                                   \
                        \
      if (dend == end_match_2)                      \
    goto fail;                          \
                \
      d = string2;                          \
      dend = end_match_2;                       \
    }

#define PTR_TO_OFFSET ( d ) 0

Definition at line 37 of file regex.c.

#define PUSH_FAILURE_ELT ( item ) fail_stack.stack[fail_stack.avail++] = (item)

#define PUSH_FAILURE_INT ( item ) fail_stack.stack[fail_stack.avail++].integer = (item)

#define PUSH_FAILURE_POINT | ( | pattern_place,
 |  | string_place,
 |  | failure_code | )

#define PUSH_FAILURE_POINTER ( item ) fail_stack.stack[fail_stack.avail++].pointer = (unsigned char *) (item)

#define PUSH_PATTERN_OP | ( | POINTER,
 |  | FAIL_STACK | )

Value:

((FAIL_STACK_FULL ()                            \
    && !GROW_FAIL_STACK (FAIL_STACK))                   \
   ? 0                                  \
   : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER,   \
      1))

#define RANGE_TABLE_WORK_ELT | ( | work_area,
 |  | i | ) | ((work_area).table[i])

#define RANGE_TABLE_WORK_USED ( work_area ) ((work_area).used)

#define REGEX_ALLOCATE alloca

Definition at line 290 of file regex.c.

#define REGEX_ALLOCATE_STACK alloca

Definition at line 324 of file regex.c.

#define REGEX_FREE ( arg ) ((void)0)

Definition at line 299 of file regex.c.

#define REGEX_FREE_STACK ( arg )

Definition at line 329 of file regex.c.

#define REGEX_REALLOCATE | ( | source,
 |  | osize,
 |  | nsize | )

Value:

(destination = (char *) alloca (nsize),             \
   bcopy (source, destination, osize),                  \
   destination)

Definition at line 293 of file regex.c.

#define REGEX_REALLOCATE_STACK | ( | source,
 |  | osize,
 |  | nsize | ) | REGEX_REALLOCATE (source, osize, nsize)

Definition at line 326 of file regex.c.

#define REGEX_TALLOC | ( | n,
 |  | t | ) | ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))

Definition at line 346 of file regex.c.

#define REG_MATCH_NULL_STRING_P ( R ) ((R).bits.match_null_string_p)

#define REG_UNSET ( e ) ((e) == REG_UNSET_VALUE)

#define REG_UNSET_VALUE (&reg_unset_dummy)

#define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)

#define RESET_FAIL_STACK ( ) REGEX_FREE_STACK (fail_stack.stack)

#define RETALLOC | ( | addr,
 |  | n,
 |  | t | ) | ((addr) = (t *) realloc (addr, (n) * sizeof (t)))

Definition at line 343 of file regex.c.

#define RETALLOC_IF | ( | addr,
 |  | n,
 |  | t | ) | if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)

Definition at line 344 of file regex.c.

#define SAME_CHARSET_P | ( | c1,
 |  | c2 | ) | (1)

Definition at line 181 of file regex.c.

#define SET_LIST_BIT ( c )

Value:

(b[((unsigned char) (c)) / BYTEWIDTH]             \
   |= 1 << (((unsigned char) c) % BYTEWIDTH))

#define SET_RANGE_TABLE_WORK_AREA | ( | work_area,
 |  | range_start,
 |  | range_end | )

Value:

do {                                    \
    EXTEND_RANGE_TABLE_WORK_AREA ((work_area), 2);          \
    (work_area).table[(work_area).used++] = (range_start);      \
    (work_area).table[(work_area).used++] = (range_end);        \
  } while (0)

#define SET_REGS_MATCHED ( )

Value:

do                                  \
    {                                   \
      if (!set_regs_matched_done)                   \
    {                               \
      unsigned r;                           \
      set_regs_matched_done = 1;                    \
      for (r = lowest_active_reg; r <= highest_active_reg; r++) \
        {                               \
          MATCHED_SOMETHING (reg_info[r])               \
        = EVER_MATCHED_SOMETHING (reg_info[r])          \
        = 1;                            \
        }                               \
    }                               \
    }                                   \
  while (0)

#define SIGN_EXTEND_CHAR ( c ) ((((unsigned char) (c)) ^ 128) - 128)

Definition at line 249 of file regex.c.

#define SINGLE_BYTE_CHAR_P ( c ) (1)

Definition at line 180 of file regex.c.

#define STOP_ADDR_VSTRING ( P ) (((P) >= size1 ? string2 + size2 : string1 + size1))

#define STORE_CHARACTER_AND_INCR | ( | destination,
 |  | character | )

Value:

do {                                \
    (destination)[0] = (character) & 0377;          \
    (destination)[1] = ((character) >> 8) & 0377;       \
    (destination)[2] = (character) >> 16;           \
    (destination) += 3;                     \
  } while (0)

Definition at line 590 of file regex.c.

#define STORE_JUMP | ( | op,
 |  | loc,
 |  | to | ) | store_op1 (op, loc, (to) - (loc) - 3)

#define STORE_JUMP2 | ( | op,
 |  | loc,
 |  | to,
 |  | arg | ) | store_op2 (op, loc, (to) - (loc) - 3, arg)

#define STORE_NUMBER | ( | destination,
 |  | number | )

Value:

do {                                    \
    (destination)[0] = (number) & 0377;                 \
    (destination)[1] = (number) >> 8;                   \
  } while (0)

Definition at line 516 of file regex.c.

#define STORE_NUMBER_AND_INCR | ( | destination,
 |  | number | )

Value:

do {                                    \
    STORE_NUMBER (destination, number);                 \
    (destination) += 2;                         \
  } while (0)

Definition at line 526 of file regex.c.

#define STREQ | ( | s1,
 |  | s2 | ) | ((strcmp (s1, s2) == 0))

Definition at line 350 of file regex.c.

#define STRING_CHAR | ( | p,
 |  | s | ) | (*(p))

Definition at line 183 of file regex.c.

#define STRING_CHAR_AND_LENGTH | ( | p,
 |  | s,
 |  | actual_len | ) | ((actual_len) = 1, *(p))

Definition at line 184 of file regex.c.

#define SWITCH_ENUM_CAST ( x ) (x)

Definition at line 133 of file regex.c.

#define SYNTAX ( c ) re_syntax_table[c]

Definition at line 174 of file regex.c.

#define Sword 1

Definition at line 127 of file regex.c.

#define TALLOC | ( | n,
 |  | t | ) | ((t *) malloc ((n) * sizeof (t)))

Definition at line 342 of file regex.c.

#define TRANSLATE ( d )

Value:

(RE_TRANSLATE_P (translate) \
   ? (unsigned) RE_TRANSLATE (translate, (unsigned) (d)) : (d))

#define TYPICAL_FAILURE_SIZE 20

#define WORDCHAR_P ( d )

Value:

(SYNTAX ((d) == end1 ? *string2                 \
       : (d) == string2 - 1 ? *(end1 - 1) : *(d))           \
   == Sword)

#define WORD_BOUNDARY_P | ( | c1,
 |  | c2 | ) | (0)

Definition at line 178 of file regex.c.

#define _GNU_SOURCE

Definition at line 28 of file regex.c.

#define assert ( e )

Definition at line 1022 of file regex.c.

Referenced by CSortList::CSortList(), CSortList::Entry(), CSortList::Location(), delvers(), getstr(), os2_mkdir(), rcmd(), resolve_address(), and wnt_mkdir().

#define false 0

Definition at line 358 of file regex.c.

#define gettext ( msgid ) (msgid)

Definition at line 51 of file regex.c.

#define gettext_noop ( String ) String

Definition at line 57 of file regex.c.

#define true 1

Definition at line 359 of file regex.c.

Typedef Documentation

typedef char boolean

Definition at line 357 of file regex.c.

Enumeration Type Documentation

enum re_opcode_t

Enumeration values:
no_op
succeed
exactn
anychar
charset
charset_not
start_memory
stop_memory
duplicate
begline
endline
begbuf
endbuf
jump
jump_past_alt
on_failure_jump
on_failure_keep_string_jump
pop_failure_jump
maybe_pop_jump
dummy_failure_jump
push_dummy_failure
succeed_n
jump_n
set_number_at
wordchar
notwordchar
wordbeg
wordend
wordbound
notwordbound

Definition at line 368 of file regex.c.

00369 {
00370   no_op = 0,
00371
00372   /* Succeed right away--no more backtracking.  */
00373   succeed,
00374
00375     /* Followed by one byte giving n, then by n literal bytes.  */
00376   exactn,
00377
00378     /* Matches any (more or less) character.  */
00379   anychar,
00380
00381     /* Matches any one char belonging to specified set.  First
00382        following byte is number of bitmap bytes.  Then come bytes
00383        for a bitmap saying which chars are in.  Bits in each byte
00384        are ordered low-bit-first.  A character is in the set if its
00385        bit is 1.  A character too large to have a bit in the map is
00386        automatically not in the set.  */
00387   charset,
00388
00389     /* Same parameters as charset, but match any character that is
00390        not one of those specified.  */
00391   charset_not,
00392
00393     /* Start remembering the text that is matched, for storing in a
00394        register.  Followed by one byte with the register number, in
00395        the range 0 to one less than the pattern buffer's re_nsub
00396        field.  Then followed by one byte with the number of groups
00397        inner to this one.  (This last has to be part of the
00398        start_memory only because we need it in the on_failure_jump
00399        of re_match_2.)  */
00400   start_memory,
00401
00402     /* Stop remembering the text that is matched and store it in a
00403        memory register.  Followed by one byte with the register
00404        number, in the range 0 to one less than `re_nsub' in the
00405        pattern buffer, and one byte with the number of inner groups,
00406        just like `start_memory'.  (We need the number of inner
00407        groups here because we don't have any easy way of finding the
00408        corresponding start_memory when we're at a stop_memory.)  */
00409   stop_memory,
00410
00411     /* Match a duplicate of something remembered. Followed by one
00412        byte containing the register number.  */
00413   duplicate,
00414
00415     /* Fail unless at beginning of line.  */
00416   begline,
00417
00418     /* Fail unless at end of line.  */
00419   endline,
00420
00421     /* Succeeds if at beginning of buffer (if emacs) or at beginning
00422        of string to be matched (if not).  */
00423   begbuf,
00424
00425     /* Analogously, for end of buffer/string.  */
00426   endbuf,
00427
00428     /* Followed by two byte relative address to which to jump.  */
00429   jump,
00430
00431     /* Same as jump, but marks the end of an alternative.  */
00432   jump_past_alt,
00433
00434     /* Followed by two-byte relative address of place to resume at
00435        in case of failure.  */
00436   on_failure_jump,
00437
00438     /* Like on_failure_jump, but pushes a placeholder instead of the
00439        current string position when executed.  */
00440   on_failure_keep_string_jump,
00441
00442     /* Throw away latest failure point and then jump to following
00443        two-byte relative address.  */
00444   pop_failure_jump,
00445
00446     /* Change to pop_failure_jump if know won't have to backtrack to
00447        match; otherwise change to jump.  This is used to jump
00448        back to the beginning of a repeat.  If what follows this jump
00449        clearly won't match what the repeat does, such that we can be
00450        sure that there is no use backtracking out of repetitions
00451        already matched, then we change it to a pop_failure_jump.
00452        Followed by two-byte address.  */
00453   maybe_pop_jump,
00454
00455     /* Jump to following two-byte address, and push a dummy failure
00456        point. This failure point will be thrown away if an attempt
00457        is made to use it for a failure.  A `+' construct makes this
00458        before the first repeat.  Also used as an intermediary kind
00459        of jump when compiling an alternative.  */
00460   dummy_failure_jump,
00461
00462     /* Push a dummy failure point and continue.  Used at the end of
00463        alternatives.  */
00464   push_dummy_failure,
00465
00466     /* Followed by two-byte relative address and two-byte number n.
00467        After matching N times, jump to the address upon failure.  */
00468   succeed_n,
00469
00470     /* Followed by two-byte relative address, and two-byte number n.
00471        Jump to the address N times, then fail.  */
00472   jump_n,
00473
00474     /* Set the following two-byte relative address to the
00475        subsequent two-byte number.  The address *includes* the two
00476        bytes of number.  */
00477   set_number_at,
00478
00479   wordchar, /* Matches any word-constituent character.  */
00480   notwordchar,  /* Matches any char that is not a word-constituent.  */
00481
00482   wordbeg,  /* Succeeds if at word beginning.  */
00483   wordend,  /* Succeeds if at word end.  */
00484
00485   wordbound,    /* Succeeds if at a word boundary.  */
00486   notwordbound  /* Succeeds if not at a word boundary.  */
00487
00488 #ifdef emacs
00489   ,before_dot,  /* Succeeds if before point.  */
00490   at_dot,   /* Succeeds if at point.  */
00491   after_dot,    /* Succeeds if after point.  */
00492
00493     /* Matches any character whose syntax is specified.  Followed by
00494        a byte which contains a syntax code, e.g., Sword.  */
00495   syntaxspec,
00496
00497     /* Matches any character whose syntax is not that specified.  */
00498   notsyntaxspec,
00499
00500   /* Matches any character whose category-set contains the specified
00501      category.  The operator is followed by a byte which contains a
00502      category code (mnemonic ASCII character).  */
00503   categoryspec,
00504
00505   /* Matches any character whose category-set does not contain the
00506      specified category.  The operator is followed by a byte which
00507      contains the category code (mnemonic ASCII character).  */
00508   notcategoryspec
00509 #endif /* emacs */
00510 } re_opcode_t;

Function Documentation

void init_syntax_once ( ) [static]

Definition at line 148 of file regex.c.

00149 {
00150    register int c;
00151    static int done = 0;
00152
00153    if (done)
00154      return;
00155
00156    bzero (re_syntax_table, sizeof re_syntax_table);
00157
00158    for (c = 'a'; c <= 'z'; c++)
00159      re_syntax_table[c] = Sword;
00160
00161    for (c = 'A'; c <= 'Z'; c++)
00162      re_syntax_table[c] = Sword;
00163
00164    for (c = '0'; c <= '9'; c++)
00165      re_syntax_table[c] = Sword;
00166
00167    re_syntax_table['_'] = Sword;
00168
00169    done = 1;
00170 }

char* malloc ( )

int re_match_2_internal ( ) [static]

reg_syntax_t re_set_syntax ( syntax )

char* realloc ( )

Variable Documentation

reg_syntax_t re_syntax_options

Definition at line 1039 of file regex.c.

char re_syntax_table[ 256 ] [static]

Definition at line 145 of file regex.c.

Generated on Sun Oct 21 12:43:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


regex.h File Reference

cvs-1.10/lib/regex.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | re_pattern_buffer
struct | re_registers
struct | regmatch_t

Defines

#define | RE_BACKSLASH_ESCAPE_IN_LISTS (1)
#define | RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
#define | RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
#define | RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
#define | RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
#define | RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
#define | RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
#define | RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
#define | RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
#define | RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
#define | RE_LIMITED_OPS (RE_INTERVALS << 1)
#define | RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
#define | RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
#define | RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
#define | RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
#define | RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
#define | RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
#define | RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
#define | RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
#define | RE_SYNTAX_EMACS 0
#define | RE_SYNTAX_AWK
#define | RE_SYNTAX_POSIX_AWK (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
#define | RE_SYNTAX_GREP
#define | RE_SYNTAX_EGREP
#define | RE_SYNTAX_POSIX_EGREP (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
#define | RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
#define | RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
#define | _RE_SYNTAX_POSIX_COMMON
#define | RE_SYNTAX_POSIX_BASIC (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
#define | RE_SYNTAX_POSIX_MINIMAL_BASIC (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
#define | RE_SYNTAX_POSIX_EXTENDED
#define | RE_SYNTAX_POSIX_MINIMAL_EXTENDED
#define | RE_DUP_MAX ((1 << 15) - 1)
#define | REG_EXTENDED 1
#define | REG_ICASE (REG_EXTENDED << 1)
#define | REG_NEWLINE (REG_ICASE << 1)
#define | REG_NOSUB (REG_NEWLINE << 1)
#define | REG_NOTBOL 1
#define | REG_NOTEOL (1 << 1)
#define | RE_TRANSLATE_TYPE char *
#define | RE_TRANSLATE(TBL, C) ((TBL)[C])
#define | RE_TRANSLATE_P(TBL) (TBL)
#define | REGS_UNALLOCATED 0
#define | REGS_REALLOCATE 1
#define | REGS_FIXED 2
#define | RE_NREGS 30
#define | _RE_ARGS(args) ()

Typedefs

typedef unsigned | reg_syntax_t
typedef re_pattern_buffer | regex_t
typedef int | regoff_t

Enumerations

enum reg_errcode_t {
REG_NOERROR = 0, REG_NOMATCH, REG_BADPAT, REG_ECOLLATE,
REG_ECTYPE, REG_EESCAPE, REG_ESUBREG, REG_EBRACK,
REG_EPAREN, REG_EBRACE, REG_BADBR, REG_ERANGE,
REG_ESPACE, REG_BADRPT, REG_EEND, REG_ESIZE,
REG_ERPAREN
}

Functions

reg_syntax_t re_set_syntax ()
const char * | re_compile_pattern ()
int | re_compile_fastmap ()
int | re_search ()
int | re_search_2 ()
int | re_match ()
int | re_match_2 ()
void | re_set_registers ()
int | regcomp ()
int | regexec ()
size_t | regerror ()
void | regfree ()

Variables

reg_syntax_t re_syntax_options

Define Documentation

#define REGS_FIXED 2

Definition at line 340 of file regex.h.

#define REGS_REALLOCATE 1

Definition at line 339 of file regex.h.

#define REGS_UNALLOCATED 0

Definition at line 338 of file regex.h.

#define REG_EXTENDED 1

Definition at line 227 of file regex.h.

#define REG_ICASE (REG_EXTENDED << 1)

Definition at line 231 of file regex.h.

#define REG_NEWLINE (REG_ICASE << 1)

Definition at line 236 of file regex.h.

#define REG_NOSUB (REG_NEWLINE << 1)

Definition at line 240 of file regex.h.

#define REG_NOTBOL 1

Definition at line 250 of file regex.h.

#define REG_NOTEOL (1 << 1)

Definition at line 253 of file regex.h.

#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)

Definition at line 43 of file regex.h.

#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)

Definition at line 48 of file regex.h.

#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)

Definition at line 54 of file regex.h.

#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)

Definition at line 68 of file regex.h.

#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)

Definition at line 76 of file regex.h.

#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)

Definition at line 80 of file regex.h.

#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)

Definition at line 84 of file regex.h.

#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)

Definition at line 88 of file regex.h.

#define RE_DUP_MAX ((1 << 15) - 1)

Definition at line 220 of file regex.h.

#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)

Definition at line 92 of file regex.h.

#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)

Definition at line 97 of file regex.h.

#define RE_LIMITED_OPS (RE_INTERVALS << 1)

Definition at line 101 of file regex.h.

#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)

Definition at line 105 of file regex.h.

#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)

Definition at line 110 of file regex.h.

#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)

Definition at line 114 of file regex.h.

#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)

Definition at line 118 of file regex.h.

#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)

Definition at line 122 of file regex.h.

#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)

Definition at line 128 of file regex.h.

#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)

Definition at line 136 of file regex.h.

#define RE_NREGS 30

Definition at line 388 of file regex.h.

#define RE_SYNTAX_AWK

Value:

(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL         \
   | RE_NO_BK_PARENS            | RE_NO_BK_REFS             \
   | RE_NO_BK_VBAR               | RE_NO_EMPTY_RANGES           \
   | RE_UNMATCHED_RIGHT_PAREN_ORD)

Definition at line 157 of file regex.h.

#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC

Definition at line 181 of file regex.h.

#define RE_SYNTAX_EGREP

Value:

(RE_CHAR_CLASSES        | RE_CONTEXT_INDEP_ANCHORS          \
   | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE            \
   | RE_NEWLINE_ALT       | RE_NO_BK_PARENS             \
   | RE_NO_BK_VBAR)

Definition at line 171 of file regex.h.

#define RE_SYNTAX_EMACS 0

Definition at line 155 of file regex.h.

#define RE_SYNTAX_GREP

Value:

(RE_BK_PLUS_QM              | RE_CHAR_CLASSES               \
   | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS                \
   | RE_NEWLINE_ALT)

Definition at line 166 of file regex.h.

#define RE_SYNTAX_POSIX_AWK (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)

Definition at line 163 of file regex.h.

#define RE_SYNTAX_POSIX_BASIC (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)

Definition at line 190 of file regex.h.

#define RE_SYNTAX_POSIX_EGREP (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)

Definition at line 177 of file regex.h.

#define RE_SYNTAX_POSIX_EXTENDED

Value:

(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS         \
   | RE_CONTEXT_INDEP_OPS  | RE_NO_BK_BRACES                \
   | RE_NO_BK_PARENS       | RE_NO_BK_VBAR              \
   | RE_UNMATCHED_RIGHT_PAREN_ORD)

Definition at line 199 of file regex.h.

#define RE_SYNTAX_POSIX_MINIMAL_BASIC (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)

Definition at line 196 of file regex.h.

#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED

Value:

(_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS            \
   | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES               \
   | RE_NO_BK_PARENS        | RE_NO_BK_REFS             \
   | RE_NO_BK_VBAR      | RE_UNMATCHED_RIGHT_PAREN_ORD)

Definition at line 207 of file regex.h.

#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC

Definition at line 183 of file regex.h.

#define RE_TRANSLATE | ( | TBL,
 |  | C | ) | ((TBL)[C])

Definition at line 292 of file regex.h.

#define RE_TRANSLATE_P ( TBL ) (TBL)

Definition at line 293 of file regex.h.

#define RE_TRANSLATE_TYPE char *

Definition at line 291 of file regex.h.

#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)

Definition at line 132 of file regex.h.

#define _RE_ARGS ( args ) ()

Definition at line 415 of file regex.h.

#define _RE_SYNTAX_POSIX_COMMON

Value:

(RE_CHAR_CLASSES | RE_DOT_NEWLINE      | RE_DOT_NOT_NULL        \
   | RE_INTERVALS  | RE_NO_EMPTY_RANGES)

Definition at line 186 of file regex.h.

Typedef Documentation

typedef unsigned reg_syntax_t

Definition at line 39 of file regex.h.

typedef struct re_pattern_buffer regex_t

Definition at line 368 of file regex.h.

typedef int regoff_t

Definition at line 371 of file regex.h.

Enumeration Type Documentation

enum reg_errcode_t

Enumeration values:
REG_NOERROR
REG_NOMATCH
REG_BADPAT
REG_ECOLLATE
REG_ECTYPE
REG_EESCAPE
REG_ESUBREG
REG_EBRACK
REG_EPAREN
REG_EBRACE
REG_BADBR
REG_ERANGE
REG_ESPACE
REG_BADRPT
REG_EEND
REG_ESIZE
REG_ERPAREN

Definition at line 258 of file regex.h.

00259 {
00260   REG_NOERROR = 0,  /* Success.  */
00261   REG_NOMATCH,      /* Didn't find a match (for regexec).  */
00262
00263   /* POSIX regcomp return error codes.  (In the order listed in the
00264      standard.)  */
00265   REG_BADPAT,       /* Invalid pattern.  */
00266   REG_ECOLLATE,     /* Not implemented.  */
00267   REG_ECTYPE,       /* Invalid character class name.  */
00268   REG_EESCAPE,      /* Trailing backslash.  */
00269   REG_ESUBREG,      /* Invalid back reference.  */
00270   REG_EBRACK,       /* Unmatched left bracket.  */
00271   REG_EPAREN,       /* Parenthesis imbalance.  */
00272   REG_EBRACE,       /* Unmatched \{.  */
00273   REG_BADBR,        /* Invalid contents of \{\}.  */
00274   REG_ERANGE,       /* Invalid range end.  */
00275   REG_ESPACE,       /* Ran out of memory.  */
00276   REG_BADRPT,       /* No preceding re for repetition op.  */
00277
00278   /* Error codes we've added.  */
00279   REG_EEND,     /* Premature end.  */
00280   REG_ESIZE,        /* Compiled pattern bigger than 2^16 bytes.  */
00281   REG_ERPAREN       /* Unmatched ) or \); not returned from regcomp.  */
00282 } reg_errcode_t;

Function Documentation

int re_compile_fastmap ( )

const char* re_compile_pattern ( )

int re_match ( )

int re_match_2 ( )

int re_search ( )

Referenced by inserts(), and linep().

int re_search_2 ( )

void re_set_registers ( )

reg_syntax_t re_set_syntax ( )

int regcomp ( )

size_t regerror ( )

int regexec ( )

void regfree ( )

Variable Documentation

reg_syntax_t re_syntax_options

Definition at line 142 of file regex.h.

Generated on Sun Oct 21 12:43:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rename.c File Reference

cvs-1.10/lib/rename.c File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>

Include dependency graph for rename.c:

Include dependency graph

Go to the source code of this file.

Functions

int | rename (from, to) char *from

Variables

int | errno
char * | to

Function Documentation

int rename | ( | from | ,
 |  | to |
 | ) |

Variable Documentation

int errno

Definition at line 22 of file rename.c.

char* to

Definition at line 31 of file rename.c.

Generated on Sun Oct 21 12:43:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


savecwd.c File Reference

cvs-1.10/lib/savecwd.c File Reference

#include <stdio.h>
#include <sys/file.h>
#include <errno.h>
#include "savecwd.h"
#include "error.h"

Include dependency graph for savecwd.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | fchdir(x) (abort (), 0)

Functions

char * | xgetwd ()
int | save_cwd (cwd) struct saved_cwd *cwd

Variables

int | errno
const char * | dest

Define Documentation

#define fchdir ( x ) (abort (), 0)

Function Documentation

int save_cwd ( cwd )

char* xgetwd ( )

Definition at line 45 of file xgetwd.c.

00046 {
00047   char *cwd;
00048   char *ret;
00049   unsigned path_max;
00050
00051   errno = 0;
00052   path_max = (unsigned) PATH_MAX;
00053   path_max += 2;        /* The getcwd docs say to do this. */
00054
00055   cwd = xmalloc (path_max);
00056
00057   errno = 0;
00058   while ((ret = getcwd (cwd, path_max)) == NULL && errno == ERANGE)
00059     {
00060       path_max += PATH_INCR;
00061       cwd = xrealloc (cwd, path_max);
00062       errno = 0;
00063     }
00064
00065   if (ret == NULL)
00066     {
00067       int save_errno = errno;
00068       free (cwd);
00069       errno = save_errno;
00070       return NULL;
00071     }
00072   return cwd;
00073 }

Variable Documentation

const char* dest

Definition at line 113 of file savecwd.c.

int errno

Definition at line 32 of file savecwd.c.

Generated on Sun Oct 21 12:42:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/savecwd.c Source File

cvs-1.10/lib/savecwd.c

Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 # include "config.h"
00003 #endif
00004
00005 #include <stdio.h>
00006
00007 #ifdef STDC_HEADERS
00008 # include <stdlib.h>
00009 #endif
00010
00011 #ifdef HAVE_UNISTD_H
00012 # include <unistd.h>
00013 #endif
00014
00015 #ifdef HAVE_FCNTL_H
00016 # include <sys/types.h>
00017 # include <fcntl.h>
00018 #else
00019 # include <sys/file.h>
00020 #endif
00021
00022 #ifdef HAVE_DIRECT_H
00023 # include <direct.h>
00024 #endif
00025
00026 #ifdef HAVE_IO_H
00027 # include <io.h>
00028 #endif
00029
00030 #include <errno.h>
00031 # ifndef errno
00032 extern int errno;
00033 #endif
00034
00035 #include "savecwd.h"
00036 #include "error.h"
00037
00038 char *xgetwd __PROTO((void));
00039
00040 /* Record the location of the current working directory in CWD so that
00041    the program may change to other directories and later use restore_cwd
00042    to return to the recorded location.  This function may allocate
00043    space using malloc (via xgetwd) or leave a file descriptor open;
00044    use free_cwd to perform the necessary free or close.  Upon failure,
00045    no memory is allocated, any locally opened file descriptors are
00046    closed;  return non-zero -- in that case, free_cwd need not be
00047    called, but doing so is ok.  Otherwise, return zero.  */
00048
00049 int
00050 save_cwd (cwd)
00051      struct saved_cwd *cwd;
00052 {
00053   static int have_working_fchdir = 1;
00054
00055   cwd->desc = -1;
00056   cwd->name = NULL;
00057
00058   if (have_working_fchdir)
00059     {
00060 #ifdef HAVE_FCHDIR
00061       cwd->desc = open (".", O_RDONLY);
00062       if (cwd->desc < 0)
00063     {
00064       error (0, errno, "cannot open current directory");
00065       return 1;
00066     }
00067
00068 # if __sun__ || sun
00069       /* On SunOS 4, fchdir returns EINVAL if accounting is enabled,
00070      so we have to fall back to chdir.  */
00071       if (fchdir (cwd->desc))
00072     {
00073       if (errno == EINVAL)
00074         {
00075           close (cwd->desc);
00076           cwd->desc = -1;
00077           have_working_fchdir = 0;
00078         }
00079       else
00080         {
00081           error (0, errno, "current directory");
00082           close (cwd->desc);
00083           cwd->desc = -1;
00084           return 1;
00085         }
00086     }
00087 # endif /* __sun__ || sun */
00088 #else
00089 #define fchdir(x) (abort (), 0)
00090       have_working_fchdir = 0;
00091 #endif
00092     }
00093
00094   if (!have_working_fchdir)
00095     {
00096       cwd->name = xgetwd ();
00097       if (cwd->name == NULL)
00098     {
00099       error (0, errno, "cannot get current directory");
00100       return 1;
00101     }
00102     }
00103   return 0;
00104 }
00105
00106 /* Change to recorded location, CWD, in directory hierarchy.
00107    If "saved working directory", NULL))
00108    */
00109
00110 int
00111 restore_cwd (cwd, dest)
00112      const struct saved_cwd *cwd;
00113      const char *dest;
00114 {
00115   int fail = 0;
00116   if (cwd->desc >= 0)
00117     {
00118       if (fchdir (cwd->desc))
00119     {
00120       error (0, errno, "cannot return to %s",
00121          (dest ? dest : "saved working directory"));
00122       fail = 1;
00123     }
00124     }
00125   else if (chdir (cwd->name) < 0)
00126     {
00127       error (0, errno, "%s", cwd->name);
00128       fail = 1;
00129     }
00130   return fail;
00131 }
00132
00133 void
00134 free_cwd (cwd)
00135      struct saved_cwd *cwd;
00136 {
00137   if (cwd->desc >= 0)
00138     close (cwd->desc);
00139   if (cwd->name)
00140     free (cwd->name);
00141 }
00142
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/savecwd.h Source File

cvs-1.10/lib/savecwd.h

Go to the documentation of this file.
00001 #ifndef SAVE_CWD_H
00002 #define SAVE_CWD_H 1
00003
00004 struct saved_cwd
00005   {
00006     int desc;
00007     char *name;
00008   };
00009
00010 #if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
00011 #define __PROTO(args) args
00012 #else
00013 #define __PROTO(args) ()
00014 #endif  /* GCC.  */
00015
00016 int save_cwd __PROTO((struct saved_cwd *cwd));
00017 int restore_cwd __PROTO((const struct saved_cwd *cwd, const char *dest));
00018 void free_cwd __PROTO((struct saved_cwd *cwd));
00019
00020 #endif /* SAVE_CWD_H */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/sighandle.c Source File

cvs-1.10/lib/sighandle.c

Go to the documentation of this file.
00001 /* sighandle.c -- Library routines for manipulating chains of signal handlers
00002    Copyright (C) 1992 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 /* Written by Paul Sander, HaL Computer Systems, Inc. <paul@hal.com>
00015    Brian Berliner <berliner@Sun.COM> added POSIX support */
00016
00017 /*************************************************************************
00018  *
00019  * signal.c -- This file contains code that manipulates chains of signal
00020  *             handlers.
00021  *
00022  *             Facilities are provided to register a signal handler for
00023  *             any specific signal.  When a signal is received, all of the
00024  *             registered signal handlers are invoked in the reverse order
00025  *             in which they are registered.  Note that the signal handlers
00026  *             must not themselves make calls to the signal handling
00027  *             facilities.
00028  *
00029  *************************************************************************/
00030
00031 #ifdef HAVE_CONFIG_H
00032 #include "config.h"
00033 #endif
00034 #include "system.h"
00035
00036 #include <sys/types.h>
00037 #include <stdio.h>
00038 #include <signal.h>
00039
00040 /* Add prototype support.  */
00041 #ifndef PROTO
00042 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
00043 #define PROTO(ARGS) ARGS
00044 #else
00045 #define PROTO(ARGS) ()
00046 #endif
00047 #endif
00048
00049 #ifdef STDC_HEADERS
00050 #include <stdlib.h>
00051 #else
00052 #if __STDC__
00053 char *calloc(unsigned nelem, unsigned size);
00054 char *malloc(unsigned size);
00055 #else
00056 char *calloc();
00057 char *malloc();
00058 #endif /* __STDC__ */
00059 #endif /* STDC_HEADERS */
00060
00061 /* Define the highest signal number (usually) */
00062 #ifndef SIGMAX
00063 #define SIGMAX  64
00064 #endif
00065
00066 /* Define linked list of signal handlers structure */
00067 struct SIG_hlist {
00068     RETSIGTYPE      (*handler)();
00069     struct SIG_hlist    *next;
00070 };
00071
00072 /*
00073  * Define array of lists of signal handlers.  Note that this depends on
00074  * the implementation to initialize each element to a null pointer.
00075  */
00076
00077 static  struct SIG_hlist    **SIG_handlers;
00078
00079 /* Define array of default signal vectors */
00080
00081 #ifdef POSIX_SIGNALS
00082 static  struct sigaction    *SIG_defaults;
00083 #else
00084 #ifdef BSD_SIGNALS
00085 static  struct sigvec       *SIG_defaults;
00086 #else
00087 static  RETSIGTYPE      (**SIG_defaults) PROTO ((int));
00088 #endif
00089 #endif
00090
00091 /* Critical section housekeeping */
00092 static  int     SIG_crSectNest = 0; /* Nesting level */
00093 #ifdef POSIX_SIGNALS
00094 static  sigset_t    SIG_crSectMask;     /* Signal mask */
00095 #else
00096 static  int     SIG_crSectMask;     /* Signal mask */
00097 #endif
00098
00099 /*
00100  * Initialize the signal handler arrays
00101  */
00102
00103 static int SIG_init()
00104 {
00105     int i;
00106 #ifdef POSIX_SIGNALS
00107     sigset_t sigset_test;
00108 #endif
00109
00110     if (SIG_defaults && SIG_handlers)   /* already allocated */
00111         return (0);
00112
00113 #ifdef POSIX_SIGNALS
00114     (void) sigfillset(&sigset_test);
00115     for (i = 1; i < SIGMAX && sigismember(&sigset_test, i) == 1; i++)
00116         ;
00117     if (i < SIGMAX)
00118         i = SIGMAX;
00119     i++;
00120     if (!SIG_defaults)
00121         SIG_defaults = (struct sigaction *)
00122             calloc(i, sizeof(struct sigaction));
00123     (void) sigemptyset(&SIG_crSectMask);
00124 #else
00125     i = SIGMAX+1;
00126 #ifdef BSD_SIGNALS
00127     if (!SIG_defaults)
00128         SIG_defaults = (struct sigvec *)
00129             calloc(i, sizeof(struct sigvec));
00130 #else
00131     if (!SIG_defaults)
00132         SIG_defaults = (RETSIGTYPE (**) PROTO ((int)) )
00133             calloc(i, sizeof(RETSIGTYPE (**) PROTO ((int)) ));
00134 #endif
00135     SIG_crSectMask = 0;
00136 #endif
00137     if (!SIG_handlers)
00138         SIG_handlers = (struct SIG_hlist **)
00139             calloc(i, sizeof(struct SIG_hlist *));
00140     return (!SIG_defaults || !SIG_handlers);
00141 }
00142
00143 /*
00144  * The following invokes each signal handler in the reverse order in which
00145  * they were registered.
00146  */
00147 static RETSIGTYPE SIG_handle PROTO ((int));
00148
00149 static RETSIGTYPE SIG_handle(sig)
00150 int         sig;
00151 {
00152     struct SIG_hlist    *this;
00153
00154     /* Dispatch signal handlers */
00155     this = SIG_handlers[sig];
00156     while (this != (struct SIG_hlist *) NULL)
00157     {
00158         (*this->handler)(sig);
00159         this = this->next;
00160     }
00161
00162     return;
00163 }
00164
00165 /*
00166  * The following registers a signal handler.  If the handler is already
00167  * registered, it is not registered twice, nor is the order in which signal
00168  * handlers are invoked changed.  If this is the first signal handler
00169  * registered for a given signal, the old sigvec structure is saved for
00170  * restoration later.
00171  */
00172
00173 int SIG_register(sig,fn)
00174 int sig;
00175 RETSIGTYPE  (*fn)();
00176 {
00177     int         val;
00178     struct SIG_hlist    *this;
00179 #ifdef POSIX_SIGNALS
00180     struct sigaction    act;
00181     sigset_t        sigset_mask, sigset_omask;
00182 #else
00183 #ifdef BSD_SIGNALS
00184     struct sigvec       vec;
00185     int         mask;
00186 #endif
00187 #endif
00188
00189     /* Initialize */
00190     if (SIG_init() != 0)
00191         return (-1);
00192     val = 0;
00193
00194     /* Block this signal while we look at handler chain */
00195 #ifdef POSIX_SIGNALS
00196     (void) sigemptyset(&sigset_mask);
00197     (void) sigaddset(&sigset_mask, sig);
00198     (void) sigprocmask(SIG_BLOCK, &sigset_mask, &sigset_omask);
00199 #else
00200 #ifdef BSD_SIGNALS
00201     mask = sigblock(sigmask(sig));
00202 #endif
00203 #endif
00204
00205     /* See if this handler was already registered */
00206     this = SIG_handlers[sig];
00207     while (this != (struct SIG_hlist *) NULL)
00208     {
00209         if (this->handler == fn) break;
00210         this = this->next;
00211     }
00212
00213     /* Register the new handler only if it is not already registered. */
00214     if (this == (struct SIG_hlist *) NULL)
00215     {
00216
00217         /*
00218          * If this is the first handler registered for this signal,
00219          * set up the signal handler dispatcher
00220          */
00221
00222         if (SIG_handlers[sig] == (struct SIG_hlist *) NULL)
00223         {
00224 #ifdef POSIX_SIGNALS
00225             act.sa_handler = SIG_handle;
00226             (void) sigemptyset(&act.sa_mask);
00227             act.sa_flags = 0;
00228             val = sigaction(sig, &act, &SIG_defaults[sig]);
00229 #else
00230 #ifdef BSD_SIGNALS
00231             memset (&vec, 0, sizeof (vec));
00232             vec.sv_handler = SIG_handle;
00233             val = sigvec(sig, &vec, &SIG_defaults[sig]);
00234 #else
00235             if ((SIG_defaults[sig] = signal(sig, SIG_handle)) == SIG_ERR)
00236                 val = -1;
00237 #endif
00238 #endif
00239         }
00240
00241         /* If not, register it */
00242         if ((val == 0) && (this == (struct SIG_hlist *) NULL))
00243         {
00244             this = (struct SIG_hlist *)
00245                                   malloc(sizeof(struct SIG_hlist));
00246             if (this == NULL)
00247             {
00248                 val = -1;
00249             }
00250             else
00251             {
00252                 this->handler = fn;
00253                 this->next = SIG_handlers[sig];
00254                 SIG_handlers[sig] = this;
00255             }
00256         }
00257     }
00258
00259     /* Unblock the signal */
00260 #ifdef POSIX_SIGNALS
00261     (void) sigprocmask(SIG_SETMASK, &sigset_omask, NULL);
00262 #else
00263 #ifdef BSD_SIGNALS
00264     (void) sigsetmask(mask);
00265 #endif
00266 #endif
00267
00268     return val;
00269 }
00270
00271 /*
00272  * The following deregisters a signal handler.  If the last signal handler for
00273  * a given signal is deregistered, the default sigvec information is restored.
00274  */
00275
00276 int SIG_deregister(sig,fn)
00277 int sig;
00278 RETSIGTYPE  (*fn)();
00279 {
00280     int         val;
00281     struct SIG_hlist    *this;
00282     struct SIG_hlist    *last;
00283 #ifdef POSIX_SIGNALS
00284     sigset_t        sigset_mask, sigset_omask;
00285 #else
00286 #ifdef BSD_SIGNALS
00287     int         mask;
00288 #endif
00289 #endif
00290
00291     /* Initialize */
00292     if (SIG_init() != 0)
00293         return (-1);
00294     val = 0;
00295     last = (struct SIG_hlist *) NULL;
00296
00297     /* Block this signal while we look at handler chain */
00298 #ifdef POSIX_SIGNALS
00299     (void) sigemptyset(&sigset_mask);
00300     (void) sigaddset(&sigset_mask, sig);
00301     (void) sigprocmask(SIG_BLOCK, &sigset_mask, &sigset_omask);
00302 #else
00303 #ifdef BSD_SIGNALS
00304     mask = sigblock(sigmask(sig));
00305 #endif
00306 #endif
00307
00308     /* Search for the signal handler */
00309     this = SIG_handlers[sig];
00310     while ((this != (struct SIG_hlist *) NULL) && (this->handler != fn))
00311     {
00312         last = this;
00313         this = this->next;
00314     }
00315
00316     /* If it was registered, remove it */
00317     if (this != (struct SIG_hlist *) NULL)
00318     {
00319         if (last == (struct SIG_hlist *) NULL)
00320         {
00321             SIG_handlers[sig] = this->next;
00322         }
00323         else
00324         {
00325             last->next = this->next;
00326         }
00327         free((char *) this);
00328     }
00329
00330     /* Restore default behavior if there are no registered handlers */
00331     if (SIG_handlers[sig] == (struct SIG_hlist *) NULL)
00332     {
00333 #ifdef POSIX_SIGNALS
00334         val = sigaction(sig, &SIG_defaults[sig],
00335                 (struct sigaction *) NULL);
00336 #else
00337 #ifdef BSD_SIGNALS
00338         val = sigvec(sig, &SIG_defaults[sig], (struct sigvec *) NULL);
00339 #else
00340         if (signal(sig, SIG_defaults[sig]) == SIG_ERR)
00341             val = -1;
00342 #endif
00343 #endif
00344     }
00345
00346     /* Unblock the signal */
00347 #ifdef POSIX_SIGNALS
00348     (void) sigprocmask(SIG_SETMASK, &sigset_omask, NULL);
00349 #else
00350 #ifdef BSD_SIGNALS
00351     (void) sigsetmask(mask);
00352 #endif
00353 #endif
00354
00355     return val;
00356 }
00357
00358 /*
00359  * The following begins a critical section.
00360  */
00361
00362 void SIG_beginCrSect()
00363 {
00364     if (SIG_init() == 0)
00365     {
00366         if (SIG_crSectNest == 0)
00367         {
00368 #ifdef POSIX_SIGNALS
00369             sigset_t sigset_mask;
00370
00371             (void) sigfillset(&sigset_mask);
00372             (void) sigprocmask(SIG_SETMASK,
00373                        &sigset_mask, &SIG_crSectMask);
00374 #else
00375 #ifdef BSD_SIGNALS
00376             SIG_crSectMask = sigblock(~0);
00377 #else
00378             /* TBD */
00379 #endif
00380 #endif
00381         }
00382         SIG_crSectNest++;
00383     }
00384 }
00385
00386 /*
00387  * Return nonzero if currently in a critical section.
00388  * Otherwise return zero.
00389  */
00390
00391 int SIG_inCrSect()
00392 {
00393     return SIG_crSectNest > 0;
00394 }
00395
00396 /*
00397  * The following ends a critical section.
00398  */
00399
00400 void SIG_endCrSect()
00401 {
00402     if (SIG_init() == 0)
00403     {
00404         SIG_crSectNest--;
00405         if (SIG_crSectNest == 0)
00406         {
00407 #ifdef POSIX_SIGNALS
00408             (void) sigprocmask(SIG_SETMASK, &SIG_crSectMask, NULL);
00409 #else
00410 #ifdef BSD_SIGNALS
00411             (void) sigsetmask(SIG_crSectMask);
00412 #else
00413             /* TBD */
00414 #endif
00415 #endif
00416         }
00417     }
00418 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/strerror.c Source File

cvs-1.10/lib/strerror.c

Go to the documentation of this file.
00001 /* Extended support for using errno values.
00002    Copyright (C) 1992 Free Software Foundation, Inc.
00003    Written by Fred Fish.  fnf@cygnus.com
00004
00005 This file is part of the libiberty library.
00006 Libiberty is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU Library General Public
00008 License as published by the Free Software Foundation; either
00009 version 2 of the License, or (at your option) any later version.
00010
00011 Libiberty is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 Library General Public License for more details.  */
00015
00016 #include "config.h"
00017
00018 #ifndef NEED_sys_errlist
00019 /* Note that errno.h (not sure what OS) or stdio.h (BSD 4.4, at least)
00020    might declare sys_errlist in a way that the compiler might consider
00021    incompatible with our later declaration, perhaps by using const
00022    attributes.  So we hide the declaration in errno.h (if any) using a
00023    macro. */
00024 #define sys_errlist sys_errlist__
00025 #endif
00026
00027 #include <stdio.h>
00028 #include <errno.h>
00029
00030 #ifndef NEED_sys_errlist
00031 #undef sys_errlist
00032 #endif
00033
00034 /*  Routines imported from standard C runtime libraries. */
00035
00036 #ifdef __STDC__
00037 #include <stddef.h>
00038 extern void *malloc (size_t size);              /* 4.10.3.3 */
00039 extern void *memset (void *s, int c, size_t n);         /* 4.11.6.1 */
00040 #else   /* !__STDC__ */
00041 extern char *malloc ();     /* Standard memory allocater */
00042 extern char *memset ();
00043 #endif  /* __STDC__ */
00044
00045 #ifndef MAX
00046 #  define MAX(a,b) ((a) > (b) ? (a) : (b))
00047 #endif
00048
00049 /* Translation table for errno values.  See intro(2) in most UNIX systems
00050    Programmers Reference Manuals.
00051
00052    Note that this table is generally only accessed when it is used at runtime
00053    to initialize errno name and message tables that are indexed by errno
00054    value.
00055
00056    Not all of these errnos will exist on all systems.  This table is the only
00057    thing that should have to be updated as new error numbers are introduced.
00058    It's sort of ugly, but at least its portable. */
00059
00060 struct error_info
00061 {
00062   int value;        /* The numeric value from <errno.h> */
00063   char *name;       /* The equivalent symbolic value */
00064 #ifdef NEED_sys_errlist
00065   char *msg;        /* Short message about this value */
00066 #endif
00067 };
00068
00069 #ifdef NEED_sys_errlist
00070 #   define ENTRY(value, name, msg)  {value, name, msg}
00071 #else
00072 #   define ENTRY(value, name, msg)  {value, name}
00073 #endif
00074
00075 static const struct error_info error_table[] =
00076 {
00077 #if defined (EPERM)
00078   ENTRY(EPERM, "EPERM", "Not owner"),
00079 #endif
00080 #if defined (ENOENT)
00081   ENTRY(ENOENT, "ENOENT", "No such file or directory"),
00082 #endif
00083 #if defined (ESRCH)
00084   ENTRY(ESRCH, "ESRCH", "No such process"),
00085 #endif
00086 #if defined (EINTR)
00087   ENTRY(EINTR, "EINTR", "Interrupted system call"),
00088 #endif
00089 #if defined (EIO)
00090   ENTRY(EIO, "EIO", "I/O error"),
00091 #endif
00092 #if defined (ENXIO)
00093   ENTRY(ENXIO, "ENXIO", "No such device or address"),
00094 #endif
00095 #if defined (E2BIG)
00096   ENTRY(E2BIG, "E2BIG", "Arg list too long"),
00097 #endif
00098 #if defined (ENOEXEC)
00099   ENTRY(ENOEXEC, "ENOEXEC", "Exec format error"),
00100 #endif
00101 #if defined (EBADF)
00102   ENTRY(EBADF, "EBADF", "Bad file number"),
00103 #endif
00104 #if defined (ECHILD)
00105   ENTRY(ECHILD, "ECHILD", "No child processes"),
00106 #endif
00107 #if defined (EWOULDBLOCK)   /* Put before EAGAIN, sometimes aliased */
00108   ENTRY(EWOULDBLOCK, "EWOULDBLOCK", "Operation would block"),
00109 #endif
00110 #if defined (EAGAIN)
00111   ENTRY(EAGAIN, "EAGAIN", "No more processes"),
00112 #endif
00113 #if defined (ENOMEM)
00114   ENTRY(ENOMEM, "ENOMEM", "Not enough space"),
00115 #endif
00116 #if defined (EACCES)
00117   ENTRY(EACCES, "EACCES", "Permission denied"),
00118 #endif
00119 #if defined (EFAULT)
00120   ENTRY(EFAULT, "EFAULT", "Bad address"),
00121 #endif
00122 #if defined (ENOTBLK)
00123   ENTRY(ENOTBLK, "ENOTBLK", "Block device required"),
00124 #endif
00125 #if defined (EBUSY)
00126   ENTRY(EBUSY, "EBUSY", "Device busy"),
00127 #endif
00128 #if defined (EEXIST)
00129   ENTRY(EEXIST, "EEXIST", "File exists"),
00130 #endif
00131 #if defined (EXDEV)
00132   ENTRY(EXDEV, "EXDEV", "Cross-device link"),
00133 #endif
00134 #if defined (ENODEV)
00135   ENTRY(ENODEV, "ENODEV", "No such device"),
00136 #endif
00137 #if defined (ENOTDIR)
00138   ENTRY(ENOTDIR, "ENOTDIR", "Not a directory"),
00139 #endif
00140 #if defined (EISDIR)
00141   ENTRY(EISDIR, "EISDIR", "Is a directory"),
00142 #endif
00143 #if defined (EINVAL)
00144   ENTRY(EINVAL, "EINVAL", "Invalid argument"),
00145 #endif
00146 #if defined (ENFILE)
00147   ENTRY(ENFILE, "ENFILE", "File table overflow"),
00148 #endif
00149 #if defined (EMFILE)
00150   ENTRY(EMFILE, "EMFILE", "Too many open files"),
00151 #endif
00152 #if defined (ENOTTY)
00153   ENTRY(ENOTTY, "ENOTTY", "Not a typewriter"),
00154 #endif
00155 #if defined (ETXTBSY)
00156   ENTRY(ETXTBSY, "ETXTBSY", "Text file busy"),
00157 #endif
00158 #if defined (EFBIG)
00159   ENTRY(EFBIG, "EFBIG", "File too large"),
00160 #endif
00161 #if defined (ENOSPC)
00162   ENTRY(ENOSPC, "ENOSPC", "No space left on device"),
00163 #endif
00164 #if defined (ESPIPE)
00165   ENTRY(ESPIPE, "ESPIPE", "Illegal seek"),
00166 #endif
00167 #if defined (EROFS)
00168   ENTRY(EROFS, "EROFS", "Read-only file system"),
00169 #endif
00170 #if defined (EMLINK)
00171   ENTRY(EMLINK, "EMLINK", "Too many links"),
00172 #endif
00173 #if defined (EPIPE)
00174   ENTRY(EPIPE, "EPIPE", "Broken pipe"),
00175 #endif
00176 #if defined (EDOM)
00177   ENTRY(EDOM, "EDOM", "Math argument out of domain of func"),
00178 #endif
00179 #if defined (ERANGE)
00180   ENTRY(ERANGE, "ERANGE", "Math result not representable"),
00181 #endif
00182 #if defined (ENOMSG)
00183   ENTRY(ENOMSG, "ENOMSG", "No message of desired type"),
00184 #endif
00185 #if defined (EIDRM)
00186   ENTRY(EIDRM, "EIDRM", "Identifier removed"),
00187 #endif
00188 #if defined (ECHRNG)
00189   ENTRY(ECHRNG, "ECHRNG", "Channel number out of range"),
00190 #endif
00191 #if defined (EL2NSYNC)
00192   ENTRY(EL2NSYNC, "EL2NSYNC", "Level 2 not synchronized"),
00193 #endif
00194 #if defined (EL3HLT)
00195   ENTRY(EL3HLT, "EL3HLT", "Level 3 halted"),
00196 #endif
00197 #if defined (EL3RST)
00198   ENTRY(EL3RST, "EL3RST", "Level 3 reset"),
00199 #endif
00200 #if defined (ELNRNG)
00201   ENTRY(ELNRNG, "ELNRNG", "Link number out of range"),
00202 #endif
00203 #if defined (EUNATCH)
00204   ENTRY(EUNATCH, "EUNATCH", "Protocol driver not attached"),
00205 #endif
00206 #if defined (ENOCSI)
00207   ENTRY(ENOCSI, "ENOCSI", "No CSI structure available"),
00208 #endif
00209 #if defined (EL2HLT)
00210   ENTRY(EL2HLT, "EL2HLT", "Level 2 halted"),
00211 #endif
00212 #if defined (EDEADLK)
00213   ENTRY(EDEADLK, "EDEADLK", "Deadlock condition"),
00214 #endif
00215 #if defined (ENOLCK)
00216   ENTRY(ENOLCK, "ENOLCK", "No record locks available"),
00217 #endif
00218 #if defined (EBADE)
00219   ENTRY(EBADE, "EBADE", "Invalid exchange"),
00220 #endif
00221 #if defined (EBADR)
00222   ENTRY(EBADR, "EBADR", "Invalid request descriptor"),
00223 #endif
00224 #if defined (EXFULL)
00225   ENTRY(EXFULL, "EXFULL", "Exchange full"),
00226 #endif
00227 #if defined (ENOANO)
00228   ENTRY(ENOANO, "ENOANO", "No anode"),
00229 #endif
00230 #if defined (EBADRQC)
00231   ENTRY(EBADRQC, "EBADRQC", "Invalid request code"),
00232 #endif
00233 #if defined (EBADSLT)
00234   ENTRY(EBADSLT, "EBADSLT", "Invalid slot"),
00235 #endif
00236 #if defined (EDEADLOCK)
00237   ENTRY(EDEADLOCK, "EDEADLOCK", "File locking deadlock error"),
00238 #endif
00239 #if defined (EBFONT)
00240   ENTRY(EBFONT, "EBFONT", "Bad font file format"),
00241 #endif
00242 #if defined (ENOSTR)
00243   ENTRY(ENOSTR, "ENOSTR", "Device not a stream"),
00244 #endif
00245 #if defined (ENODATA)
00246   ENTRY(ENODATA, "ENODATA", "No data available"),
00247 #endif
00248 #if defined (ETIME)
00249   ENTRY(ETIME, "ETIME", "Timer expired"),
00250 #endif
00251 #if defined (ENOSR)
00252   ENTRY(ENOSR, "ENOSR", "Out of streams resources"),
00253 #endif
00254 #if defined (ENONET)
00255   ENTRY(ENONET, "ENONET", "Machine is not on the network"),
00256 #endif
00257 #if defined (ENOPKG)
00258   ENTRY(ENOPKG, "ENOPKG", "Package not installed"),
00259 #endif
00260 #if defined (EREMOTE)
00261   ENTRY(EREMOTE, "EREMOTE", "Object is remote"),
00262 #endif
00263 #if defined (ENOLINK)
00264   ENTRY(ENOLINK, "ENOLINK", "Link has been severed"),
00265 #endif
00266 #if defined (EADV)
00267   ENTRY(EADV, "EADV", "Advertise error"),
00268 #endif
00269 #if defined (ESRMNT)
00270   ENTRY(ESRMNT, "ESRMNT", "Srmount error"),
00271 #endif
00272 #if defined (ECOMM)
00273   ENTRY(ECOMM, "ECOMM", "Communication error on send"),
00274 #endif
00275 #if defined (EPROTO)
00276   ENTRY(EPROTO, "EPROTO", "Protocol error"),
00277 #endif
00278 #if defined (EMULTIHOP)
00279   ENTRY(EMULTIHOP, "EMULTIHOP", "Multihop attempted"),
00280 #endif
00281 #if defined (EDOTDOT)
00282   ENTRY(EDOTDOT, "EDOTDOT", "RFS specific error"),
00283 #endif
00284 #if defined (EBADMSG)
00285   ENTRY(EBADMSG, "EBADMSG", "Not a data message"),
00286 #endif
00287 #if defined (ENAMETOOLONG)
00288   ENTRY(ENAMETOOLONG, "ENAMETOOLONG", "File name too long"),
00289 #endif
00290 #if defined (EOVERFLOW)
00291   ENTRY(EOVERFLOW, "EOVERFLOW", "Value too large for defined data type"),
00292 #endif
00293 #if defined (ENOTUNIQ)
00294   ENTRY(ENOTUNIQ, "ENOTUNIQ", "Name not unique on network"),
00295 #endif
00296 #if defined (EBADFD)
00297   ENTRY(EBADFD, "EBADFD", "File descriptor in bad state"),
00298 #endif
00299 #if defined (EREMCHG)
00300   ENTRY(EREMCHG, "EREMCHG", "Remote address changed"),
00301 #endif
00302 #if defined (ELIBACC)
00303   ENTRY(ELIBACC, "ELIBACC", "Can not access a needed shared library"),
00304 #endif
00305 #if defined (ELIBBAD)
00306   ENTRY(ELIBBAD, "ELIBBAD", "Accessing a corrupted shared library"),
00307 #endif
00308 #if defined (ELIBSCN)
00309   ENTRY(ELIBSCN, "ELIBSCN", ".lib section in a.out corrupted"),
00310 #endif
00311 #if defined (ELIBMAX)
00312   ENTRY(ELIBMAX, "ELIBMAX", "Attempting to link in too many shared libraries"),
00313 #endif
00314 #if defined (ELIBEXEC)
00315   ENTRY(ELIBEXEC, "ELIBEXEC", "Cannot exec a shared library directly"),
00316 #endif
00317 #if defined (EILSEQ)
00318   ENTRY(EILSEQ, "EILSEQ", "Illegal byte sequence"),
00319 #endif
00320 #if defined (ENOSYS)
00321   ENTRY(ENOSYS, "ENOSYS", "Operation not applicable"),
00322 #endif
00323 #if defined (ELOOP)
00324   ENTRY(ELOOP, "ELOOP", "Too many symbolic links encountered"),
00325 #endif
00326 #if defined (ERESTART)
00327   ENTRY(ERESTART, "ERESTART", "Interrupted system call should be restarted"),
00328 #endif
00329 #if defined (ESTRPIPE)
00330   ENTRY(ESTRPIPE, "ESTRPIPE", "Streams pipe error"),
00331 #endif
00332 #if defined (ENOTEMPTY)
00333   ENTRY(ENOTEMPTY, "ENOTEMPTY", "Directory not empty"),
00334 #endif
00335 #if defined (EUSERS)
00336   ENTRY(EUSERS, "EUSERS", "Too many users"),
00337 #endif
00338 #if defined (ENOTSOCK)
00339   ENTRY(ENOTSOCK, "ENOTSOCK", "Socket operation on non-socket"),
00340 #endif
00341 #if defined (EDESTADDRREQ)
00342   ENTRY(EDESTADDRREQ, "EDESTADDRREQ", "Destination address required"),
00343 #endif
00344 #if defined (EMSGSIZE)
00345   ENTRY(EMSGSIZE, "EMSGSIZE", "Message too long"),
00346 #endif
00347 #if defined (EPROTOTYPE)
00348   ENTRY(EPROTOTYPE, "EPROTOTYPE", "Protocol wrong type for socket"),
00349 #endif
00350 #if defined (ENOPROTOOPT)
00351   ENTRY(ENOPROTOOPT, "ENOPROTOOPT", "Protocol not available"),
00352 #endif
00353 #if defined (EPROTONOSUPPORT)
00354   ENTRY(EPROTONOSUPPORT, "EPROTONOSUPPORT", "Protocol not supported"),
00355 #endif
00356 #if defined (ESOCKTNOSUPPORT)
00357   ENTRY(ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT", "Socket type not supported"),
00358 #endif
00359 #if defined (EOPNOTSUPP)
00360   ENTRY(EOPNOTSUPP, "EOPNOTSUPP", "Operation not supported on transport endpoint"),
00361 #endif
00362 #if defined (EPFNOSUPPORT)
00363   ENTRY(EPFNOSUPPORT, "EPFNOSUPPORT", "Protocol family not supported"),
00364 #endif
00365 #if defined (EAFNOSUPPORT)
00366   ENTRY(EAFNOSUPPORT, "EAFNOSUPPORT", "Address family not supported by protocol"),
00367 #endif
00368 #if defined (EADDRINUSE)
00369   ENTRY(EADDRINUSE, "EADDRINUSE", "Address already in use"),
00370 #endif
00371 #if defined (EADDRNOTAVAIL)
00372   ENTRY(EADDRNOTAVAIL, "EADDRNOTAVAIL","Cannot assign requested address"),
00373 #endif
00374 #if defined (ENETDOWN)
00375   ENTRY(ENETDOWN, "ENETDOWN", "Network is down"),
00376 #endif
00377 #if defined (ENETUNREACH)
00378   ENTRY(ENETUNREACH, "ENETUNREACH", "Network is unreachable"),
00379 #endif
00380 #if defined (ENETRESET)
00381   ENTRY(ENETRESET, "ENETRESET", "Network dropped connection because of reset"),
00382 #endif
00383 #if defined (ECONNABORTED)
00384   ENTRY(ECONNABORTED, "ECONNABORTED", "Software caused connection abort"),
00385 #endif
00386 #if defined (ECONNRESET)
00387   ENTRY(ECONNRESET, "ECONNRESET", "Connection reset by peer"),
00388 #endif
00389 #if defined (ENOBUFS)
00390   ENTRY(ENOBUFS, "ENOBUFS", "No buffer space available"),
00391 #endif
00392 #if defined (EISCONN)
00393   ENTRY(EISCONN, "EISCONN", "Transport endpoint is already connected"),
00394 #endif
00395 #if defined (ENOTCONN)
00396   ENTRY(ENOTCONN, "ENOTCONN", "Transport endpoint is not connected"),
00397 #endif
00398 #if defined (ESHUTDOWN)
00399   ENTRY(ESHUTDOWN, "ESHUTDOWN", "Cannot send after transport endpoint shutdown"),
00400 #endif
00401 #if defined (ETOOMANYREFS)
00402   ENTRY(ETOOMANYREFS, "ETOOMANYREFS", "Too many references: cannot splice"),
00403 #endif
00404 #if defined (ETIMEDOUT)
00405   ENTRY(ETIMEDOUT, "ETIMEDOUT", "Connection timed out"),
00406 #endif
00407 #if defined (ECONNREFUSED)
00408   ENTRY(ECONNREFUSED, "ECONNREFUSED", "Connection refused"),
00409 #endif
00410 #if defined (EHOSTDOWN)
00411   ENTRY(EHOSTDOWN, "EHOSTDOWN", "Host is down"),
00412 #endif
00413 #if defined (EHOSTUNREACH)
00414   ENTRY(EHOSTUNREACH, "EHOSTUNREACH", "No route to host"),
00415 #endif
00416 #if defined (EALREADY)
00417   ENTRY(EALREADY, "EALREADY", "Operation already in progress"),
00418 #endif
00419 #if defined (EINPROGRESS)
00420   ENTRY(EINPROGRESS, "EINPROGRESS", "Operation now in progress"),
00421 #endif
00422 #if defined (ESTALE)
00423   ENTRY(ESTALE, "ESTALE", "Stale NFS file handle"),
00424 #endif
00425 #if defined (EUCLEAN)
00426   ENTRY(EUCLEAN, "EUCLEAN", "Structure needs cleaning"),
00427 #endif
00428 #if defined (ENOTNAM)
00429   ENTRY(ENOTNAM, "ENOTNAM", "Not a XENIX named type file"),
00430 #endif
00431 #if defined (ENAVAIL)
00432   ENTRY(ENAVAIL, "ENAVAIL", "No XENIX semaphores available"),
00433 #endif
00434 #if defined (EISNAM)
00435   ENTRY(EISNAM, "EISNAM", "Is a named type file"),
00436 #endif
00437 #if defined (EREMOTEIO)
00438   ENTRY(EREMOTEIO, "EREMOTEIO", "Remote I/O error"),
00439 #endif
00440   ENTRY(0, NULL, NULL)
00441 };
00442
00443 /* Translation table allocated and initialized at runtime.  Indexed by the
00444    errno value to find the equivalent symbolic value. */
00445
00446 static char **error_names;
00447 static int num_error_names = 0;
00448
00449 /* Translation table allocated and initialized at runtime, if it does not
00450    already exist in the host environment.  Indexed by the errno value to find
00451    the descriptive string.
00452
00453    We don't export it for use in other modules because even though it has the
00454    same name, it differs from other implementations in that it is dynamically
00455    initialized rather than statically initialized. */
00456
00457 #ifdef NEED_sys_errlist
00458
00459 static int sys_nerr;
00460 static char **sys_errlist;
00461
00462 #else
00463
00464 extern int sys_nerr;
00465 extern char *sys_errlist[];
00466
00467 #endif
00468
00469
00470 /*
00471
00472 NAME
00473
00474     init_error_tables -- initialize the name and message tables
00475
00476 SYNOPSIS
00477
00478     static void init_error_tables ();
00479
00480 DESCRIPTION
00481
00482     Using the error_table, which is initialized at compile time, generate
00483     the error_names and the sys_errlist (if needed) tables, which are
00484     indexed at runtime by a specific errno value.
00485
00486 BUGS
00487
00488     The initialization of the tables may fail under low memory conditions,
00489     in which case we don't do anything particularly useful, but we don't
00490     bomb either.  Who knows, it might succeed at a later point if we free
00491     some memory in the meantime.  In any case, the other routines know
00492     how to deal with lack of a table after trying to initialize it.  This
00493     may or may not be considered to be a bug, that we don't specifically
00494     warn about this particular failure mode.
00495
00496 */
00497
00498 static void
00499 init_error_tables ()
00500 {
00501   const struct error_info *eip;
00502   int nbytes;
00503
00504   /* If we haven't already scanned the error_table once to find the maximum
00505      errno value, then go find it now. */
00506
00507   if (num_error_names == 0)
00508     {
00509       for (eip = error_table; eip -> name != NULL; eip++)
00510     {
00511       if (eip -> value >= num_error_names)
00512         {
00513           num_error_names = eip -> value + 1;
00514         }
00515     }
00516     }
00517
00518   /* Now attempt to allocate the error_names table, zero it out, and then
00519      initialize it from the statically initialized error_table. */
00520
00521   if (error_names == NULL)
00522     {
00523       nbytes = num_error_names * sizeof (char *);
00524       if ((error_names = (char **) malloc (nbytes)) != NULL)
00525     {
00526       memset (error_names, 0, nbytes);
00527       for (eip = error_table; eip -> name != NULL; eip++)
00528         {
00529           error_names[eip -> value] = eip -> name;
00530         }
00531     }
00532     }
00533
00534 #ifdef NEED_sys_errlist
00535
00536   /* Now attempt to allocate the sys_errlist table, zero it out, and then
00537      initialize it from the statically initialized error_table. */
00538
00539   if (sys_errlist == NULL)
00540     {
00541       nbytes = num_error_names * sizeof (char *);
00542       if ((sys_errlist = (char **) malloc (nbytes)) != NULL)
00543     {
00544       memset (sys_errlist, 0, nbytes);
00545       sys_nerr = num_error_names;
00546       for (eip = error_table; eip -> name != NULL; eip++)
00547         {
00548           sys_errlist[eip -> value] = eip -> msg;
00549         }
00550     }
00551     }
00552
00553 #endif
00554
00555 }
00556
00557 /*
00558
00559 NAME
00560
00561     errno_max -- return the max errno value
00562
00563 SYNOPSIS
00564
00565     int errno_max ();
00566
00567 DESCRIPTION
00568
00569     Returns the maximum errno value for which a corresponding symbolic
00570     name or message is available.  Note that in the case where
00571     we use the sys_errlist supplied by the system, it is possible for
00572     there to be more symbolic names than messages, or vice versa.
00573     In fact, the manual page for perror(3C) explicitly warns that one
00574     should check the size of the table (sys_nerr) before indexing it,
00575     since new error codes may be added to the system before they are
00576     added to the table.  Thus sys_nerr might be smaller than value
00577     implied by the largest errno value defined in <errno.h>.
00578
00579     We return the maximum value that can be used to obtain a meaningful
00580     symbolic name or message.
00581
00582 */
00583
00584 int
00585 errno_max ()
00586 {
00587   int maxsize;
00588
00589   if (error_names == NULL)
00590     {
00591       init_error_tables ();
00592     }
00593   maxsize = MAX (sys_nerr, num_error_names);
00594   return (maxsize - 1);
00595 }
00596
00597 /*
00598
00599 NAME
00600
00601     strerror -- map an error number to an error message string
00602
00603 SYNOPSIS
00604
00605     char *strerror (int errnoval)
00606
00607 DESCRIPTION
00608
00609     Maps an errno number to an error message string, the contents of
00610     which are implementation defined.  On systems which have the external
00611     variables sys_nerr and sys_errlist, these strings will be the same
00612     as the ones used by perror().
00613
00614     If the supplied error number is within the valid range of indices
00615     for the sys_errlist, but no message is available for the particular
00616     error number, then returns the string "Error NUM", where NUM is the
00617     error number.
00618
00619     If the supplied error number is not a valid index into sys_errlist,
00620     returns NULL.
00621
00622     The returned string is only guaranteed to be valid only until the
00623     next call to strerror.
00624
00625 */
00626
00627 char *
00628 strerror (errnoval)
00629   int errnoval;
00630 {
00631   char *msg;
00632   static char buf[32];
00633
00634 #ifdef NEED_sys_errlist
00635
00636   if (error_names == NULL)
00637     {
00638       init_error_tables ();
00639     }
00640
00641 #endif
00642
00643   if ((errnoval < 0) || (errnoval >= sys_nerr))
00644     {
00645       /* Out of range, just return NULL */
00646       msg = NULL;
00647     }
00648   else if ((sys_errlist == NULL) || (sys_errlist[errnoval] == NULL))
00649     {
00650       /* In range, but no sys_errlist or no entry at this index. */
00651       sprintf (buf, "Error %d", errnoval);
00652       msg = buf;
00653     }
00654   else
00655     {
00656       /* In range, and a valid message.  Just return the message. */
00657       msg = sys_errlist[errnoval];
00658     }
00659
00660   return (msg);
00661 }
00662
00663
00664
00665 /*
00666
00667 NAME
00668
00669     strerrno -- map an error number to a symbolic name string
00670
00671 SYNOPSIS
00672
00673     char *strerrno (int errnoval)
00674
00675 DESCRIPTION
00676
00677     Given an error number returned from a system call (typically
00678     returned in errno), returns a pointer to a string containing the
00679     symbolic name of that error number, as found in <errno.h>.
00680
00681     If the supplied error number is within the valid range of indices
00682     for symbolic names, but no name is available for the particular
00683     error number, then returns the string "Error NUM", where NUM is
00684     the error number.
00685
00686     If the supplied error number is not within the range of valid
00687     indices, then returns NULL.
00688
00689 BUGS
00690
00691     The contents of the location pointed to are only guaranteed to be
00692     valid until the next call to strerrno.
00693
00694 */
00695
00696 char *
00697 strerrno (errnoval)
00698   int errnoval;
00699 {
00700   char *name;
00701   static char buf[32];
00702
00703   if (error_names == NULL)
00704     {
00705       init_error_tables ();
00706     }
00707
00708   if ((errnoval < 0) || (errnoval >= num_error_names))
00709     {
00710       /* Out of range, just return NULL */
00711       name = NULL;
00712     }
00713   else if ((error_names == NULL) || (error_names[errnoval] == NULL))
00714     {
00715       /* In range, but no error_names or no entry at this index. */
00716       sprintf (buf, "Error %d", errnoval);
00717       name = buf;
00718     }
00719   else
00720     {
00721       /* In range, and a valid name.  Just return the name. */
00722       name = error_names[errnoval];
00723     }
00724
00725   return (name);
00726 }
00727
00728 /*
00729
00730 NAME
00731
00732     strtoerrno -- map a symbolic errno name to a numeric value
00733
00734 SYNOPSIS
00735
00736     int strtoerrno (char *name)
00737
00738 DESCRIPTION
00739
00740     Given the symbolic name of a error number, map it to an errno value.
00741     If no translation is found, returns 0.
00742
00743 */
00744
00745 int
00746 strtoerrno (name)
00747   char *name;
00748 {
00749   int errnoval = 0;
00750
00751   if (name != NULL)
00752     {
00753       if (error_names == NULL)
00754     {
00755       init_error_tables ();
00756     }
00757       for (errnoval = 0; errnoval < num_error_names; errnoval++)
00758     {
00759       if ((error_names[errnoval] != NULL) &&
00760           (strcmp (name, error_names[errnoval]) == 0))
00761         {
00762           break;
00763         }
00764     }
00765       if (errnoval == num_error_names)
00766     {
00767       errnoval = 0;
00768     }
00769     }
00770   return (errnoval);
00771 }
00772
00773
00774 /* A simple little main that does nothing but print all the errno translations
00775    if MAIN is defined and this file is compiled and linked. */
00776
00777 #ifdef MAIN
00778
00779 main ()
00780 {
00781   int errn;
00782   int errnmax;
00783   char *name;
00784   char *msg;
00785   char *strerrno ();
00786   char *strerror ();
00787
00788   errnmax = errno_max ();
00789   printf ("%d entries in names table.\n", num_error_names);
00790   printf ("%d entries in messages table.\n", sys_nerr);
00791   printf ("%d is max useful index.\n", errnmax);
00792
00793   /* Keep printing values until we get to the end of *both* tables, not
00794      *either* table.  Note that knowing the maximum useful index does *not*
00795      relieve us of the responsibility of testing the return pointer for
00796      NULL. */
00797
00798   for (errn = 0; errn <= errnmax; errn++)
00799     {
00800       name = strerrno (errn);
00801       name = (name == NULL) ? "<NULL>" : name;
00802       msg = strerror (errn);
00803       msg = (msg == NULL) ? "<NULL>" : msg;
00804       printf ("%-4d%-18s%s\n", errn, name, msg);
00805     }
00806 }
00807
00808 #endif
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


savecwd.h File Reference

cvs-1.10/lib/savecwd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | saved_cwd

Defines

#define | SAVE_CWD_H 1
#define | __PROTO(args) ()

Functions

int | save_cwd ()
int | restore_cwd ()
void | free_cwd ()

Define Documentation

#define SAVE_CWD_H 1

Definition at line 2 of file savecwd.h.

#define __PROTO ( args ) ()

Definition at line 13 of file savecwd.h.

Function Documentation

void free_cwd ( )

int restore_cwd ( )

int save_cwd ( )

Generated on Sun Oct 21 12:43:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


sighandle.c File Reference

cvs-1.10/lib/sighandle.c File Reference

#include "system.h"
#include <sys/types.h>
#include <stdio.h>
#include <signal.h>

Include dependency graph for sighandle.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | SIG_hlist

Defines

#define | PROTO(ARGS) ()
#define | SIGMAX 64

Functions

char * | calloc ()
char * | malloc ()
int | SIG_init ()
RETSIGTYPE | SIG_handle ()
RETSIGTYPE | SIG_handle (sig) int sig

Variables

SIG_hlist ** SIG_handlers
RETSIGTYPE(** | SIG_defaults )()
int | SIG_crSectNest = 0
int | SIG_crSectMask
RETSIGTYPE(* | fn )()

Define Documentation

#define PROTO ( ARGS ) ()

Definition at line 45 of file sighandle.c.

#define SIGMAX 64

Definition at line 63 of file sighandle.c.

Function Documentation

RETSIGTYPE SIG_handle ( sig ) [static]

RETSIGTYPE SIG_handle ( ) [static]

int SIG_init ( ) [static]

Definition at line 103 of file sighandle.c.

00104 {
00105     int i;
00106 #ifdef POSIX_SIGNALS
00107     sigset_t sigset_test;
00108 #endif
00109
00110     if (SIG_defaults && SIG_handlers)   /* already allocated */
00111         return (0);
00112
00113 #ifdef POSIX_SIGNALS
00114     (void) sigfillset(&sigset_test);
00115     for (i = 1; i < SIGMAX && sigismember(&sigset_test, i) == 1; i++)
00116         ;
00117     if (i < SIGMAX)
00118         i = SIGMAX;
00119     i++;
00120     if (!SIG_defaults)
00121         SIG_defaults = (struct sigaction *)
00122             calloc(i, sizeof(struct sigaction));
00123     (void) sigemptyset(&SIG_crSectMask);
00124 #else
00125     i = SIGMAX+1;
00126 #ifdef BSD_SIGNALS
00127     if (!SIG_defaults)
00128         SIG_defaults = (struct sigvec *)
00129             calloc(i, sizeof(struct sigvec));
00130 #else
00131     if (!SIG_defaults)
00132         SIG_defaults = (RETSIGTYPE (**) PROTO ((int)) )
00133             calloc(i, sizeof(RETSIGTYPE (**) PROTO ((int)) ));
00134 #endif
00135     SIG_crSectMask = 0;
00136 #endif
00137     if (!SIG_handlers)
00138         SIG_handlers = (struct SIG_hlist **)
00139             calloc(i, sizeof(struct SIG_hlist *));
00140     return (!SIG_defaults || !SIG_handlers);
00141 }

char* calloc ( )

char* malloc ( )

Variable Documentation

int SIG_crSectMask [static]

Definition at line 96 of file sighandle.c.

int SIG_crSectNest = 0 [static]

Definition at line 92 of file sighandle.c.

RETSIGTYPE(** SIG_defaults)() [static]

Definition at line 87 of file sighandle.c.

struct SIG_hlist** SIG_handlers [static]

Definition at line 77 of file sighandle.c.

RETSIGTYPE(* fn)()

Definition at line 278 of file sighandle.c.

Referenced by tclSafeRemove().

Generated on Sun Oct 21 12:43:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


strerror.c File Reference

cvs-1.10/lib/strerror.c File Reference

#include "config.h"
#include <stdio.h>
#include <errno.h>

Include dependency graph for strerror.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | error_info

Defines

#define | sys_errlist sys_errlist__
#define | MAX(a, b) ((a) > (b) ? (a) : (b))
#define | ENTRY(value, name, msg) {value, name}

Functions

char * | malloc ()
char * | memset ()
void | init_error_tables ()
int | errno_max ()
char * | strerror (errnoval) int errnoval

Variables

const struct error_info | error_table []
char ** | error_names
int | num_error_names = 0
int | sys_nerr

Define Documentation

#define ENTRY | ( | value,
 |  | name,
 |  | msg | ) | {value, name}

Definition at line 72 of file strerror.c.

Referenced by error_table().

#define MAX | ( | a,
 |  | b | ) | ((a) > (b) ? (a) : (b))

Definition at line 46 of file strerror.c.

char * sys_errlist sys_errlist__

Definition at line 24 of file strerror.c.

Function Documentation

int errno_max ( )

Definition at line 585 of file strerror.c.

00586 {
00587   int maxsize;
00588
00589   if (error_names == NULL)
00590     {
00591       init_error_tables ();
00592     }
00593   maxsize = MAX (sys_nerr, num_error_names);
00594   return (maxsize - 1);
00595 }

void init_error_tables ( ) [static]

Definition at line 499 of file strerror.c.

Referenced by errno_max().

00500 {
00501   const struct error_info *eip;
00502   int nbytes;
00503
00504   /* If we haven't already scanned the error_table once to find the maximum
00505      errno value, then go find it now. */
00506
00507   if (num_error_names == 0)
00508     {
00509       for (eip = error_table; eip -> name != NULL; eip++)
00510     {
00511       if (eip -> value >= num_error_names)
00512         {
00513           num_error_names = eip -> value + 1;
00514         }
00515     }
00516     }
00517
00518   /* Now attempt to allocate the error_names table, zero it out, and then
00519      initialize it from the statically initialized error_table. */
00520
00521   if (error_names == NULL)
00522     {
00523       nbytes = num_error_names * sizeof (char *);
00524       if ((error_names = (char **) malloc (nbytes)) != NULL)
00525     {
00526       memset (error_names, 0, nbytes);
00527       for (eip = error_table; eip -> name != NULL; eip++)
00528         {
00529           error_names[eip -> value] = eip -> name;
00530         }
00531     }
00532     }
00533
00534 #ifdef NEED_sys_errlist
00535
00536   /* Now attempt to allocate the sys_errlist table, zero it out, and then
00537      initialize it from the statically initialized error_table. */
00538
00539   if (sys_errlist == NULL)
00540     {
00541       nbytes = num_error_names * sizeof (char *);
00542       if ((sys_errlist = (char **) malloc (nbytes)) != NULL)
00543     {
00544       memset (sys_errlist, 0, nbytes);
00545       sys_nerr = num_error_names;
00546       for (eip = error_table; eip -> name != NULL; eip++)
00547         {
00548           sys_errlist[eip -> value] = eip -> msg;
00549         }
00550     }
00551     }
00552
00553 #endif
00554
00555 }

char* malloc ( )

char* memset ( )

Referenced by CMenuItemInfo::CMenuItemInfo(), CRevFile::CRevFile(), CCJFlatHeaderCtrl::DrawFlatBorder(), CCJMonthCalCtrl::GetMonthRange(), CCJMonthCalCtrl::GetRange(), CCJDateTimeCtrl::GetRange(), CCJMonthCalCtrl::GetSelRange(), CCJTabCtrlBar::GetTabFromPoint(), HQXEncode(), IsShellType(), LaunchEditor(), CCJMenuBar::LoadMenu(), LogBuffer(), CGraphView::OnContextMenu(), UWidget::OnInitWidget(), UWidget::OnListInsert(), UWidget::OnListSetColTitle(), UWidget::OnListSetColWidth(), UWidget::OnSetSliderProperty(), PyRegistry::RegisterAllObjects(), CCJToolBar::SetButtons(), _GetComCtlVersion(), _statcore(), ctx(), cvs_process_new(), cvs_process_open(), cvs_process_recv_message(), encodeAppleSingle(), encodeMacInfo(), gp_getenv_read(), init_error_tables(), init_si(), qRangeCheck(), and CvsString::resize().

char* strerror ( errnoval )

Variable Documentation

char** error_names [static]

Definition at line 446 of file strerror.c.

const struct error_info error_table[] [static]

Definition at line 75 of file strerror.c.

int num_error_names = 0 [static]

Definition at line 447 of file strerror.c.

int sys_nerr

Definition at line 464 of file strerror.c.

Generated on Sun Oct 21 12:43:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


stripslash.c File Reference

cvs-1.10/lib/stripslash.c File Reference

#include <strings.h>

Include dependency graph for stripslash.c:

Include dependency graph

Go to the source code of this file.

Functions

void strip_trailing_slashes (path) char *path

Function Documentation

void strip_trailing_slashes ( path )

Generated on Sun Oct 21 12:42:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/stripslash.c Source File

cvs-1.10/lib/stripslash.c

Go to the documentation of this file.
00001 /* stripslash.c -- remove trailing slashes from a string
00002    Copyright (C) 1990 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #ifdef HAVE_CONFIG_H
00015 #include "config.h"
00016 #endif
00017
00018 #if STDC_HEADERS || HAVE_STRING_H
00019 #include <string.h>
00020 /* An ANSI string.h and pre-ANSI memory.h might conflict. */
00021 #if !STDC_HEADERS && HAVE_MEMORY_H
00022 #include <memory.h>
00023 #endif /* not STDC_HEADERS and HAVE_MEMORY_H */
00024 #else /* not STDC_HJEADERS and not HAVE_STRING_H */
00025 #include <strings.h>
00026 /* memory.h and strings.h conflict on some systems. */
00027 #endif /* not STDC_HEADERS and not HAVE_STRING_H */
00028
00029 /* Remove trailing slashes from PATH. */
00030
00031 void
00032 strip_trailing_slashes (path)
00033      char *path;
00034 {
00035   int last;
00036
00037   last = strlen (path) - 1;
00038   while (last > 0 && path[last] == '/')
00039     path[last--] = '\0';
00040 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/strstr.c Source File

cvs-1.10/lib/strstr.c

Go to the documentation of this file.
00001 /******************************************************************************
00002 *                                                                             *
00003 *   s t r s t r                                                               *
00004 *                                                                             *
00005 *   Find the first occurrence of a string in another string.                  *
00006 *                                                                             *
00007 * Format:                                                                     *
00008 *             return = strstr(Source,What);                                   *
00009 *                                                                             *
00010 * Parameters:                                                                 *
00011 *                                                                             *
00012 * Returns:                                                                    *
00013 *                                                                             *
00014 * Scope:      PUBLIC                                                          *
00015 *                                                                             *
00016 ******************************************************************************/
00017
00018 char *strstr(Source, What)
00019 register const char *Source;
00020 register const char *What;
00021 {
00022 register char WhatChar;
00023 register char SourceChar;
00024 register long Length;
00025
00026
00027     if ((WhatChar = *What++) != 0) {
00028         Length = strlen(What);
00029         do {
00030             do {
00031                 if ((SourceChar = *Source++) == 0) {
00032                     return (0);
00033                 }
00034             } while (SourceChar != WhatChar);
00035         } while (strncmp(Source, What, Length) != 0);
00036         Source--;
00037     }
00038     return ((char *)Source);
00039
00040 }/*strstr*/
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/strtoul.c Source File

cvs-1.10/lib/strtoul.c

Go to the documentation of this file.
00001 /*
00002  * strtol : convert a string to long.
00003  *
00004  * Andy Wilson, 2-Oct-89.
00005  */
00006
00007 #include <errno.h>
00008 #include <ctype.h>
00009 #include <stdio.h>
00010
00011 #ifdef HAVE_CONFIG_H
00012 #include "config.h"
00013 #endif
00014
00015 #ifndef ULONG_MAX
00016 #define ULONG_MAX   ((unsigned long)(~0L))      /* 0xFFFFFFFF */
00017 #endif
00018
00019 extern int errno;
00020
00021 unsigned long
00022 strtoul(s, ptr, base)
00023      const char *s; char **ptr; int base;
00024 {
00025   unsigned long total = 0;
00026   unsigned digit;
00027   const char *start=s;
00028   int did_conversion=0;
00029   int overflow = 0;
00030   int negate = 0;
00031   unsigned long maxdiv, maxrem;
00032
00033   if (s==NULL)
00034     {
00035       errno = ERANGE;
00036       if (!ptr)
00037     *ptr = (char *)start;
00038       return 0L;
00039     }
00040
00041   while (isspace(*s))
00042     s++;
00043   if (*s == '+')
00044     s++;
00045   else if (*s == '-')
00046     s++, negate = 1;
00047   if (base==0 || base==16) /*  the 'base==16' is for handling 0x */
00048     {
00049       int tmp;
00050
00051       /*
00052        * try to infer base from the string
00053        */
00054       if (*s != '0')
00055         tmp = 10;   /* doesn't start with 0 - assume decimal */
00056       else if (s[1] == 'X' || s[1] == 'x')
00057     tmp = 16, s += 2; /* starts with 0x or 0X - hence hex */
00058       else
00059     tmp = 8;    /* starts with 0 - hence octal */
00060       if (base==0)
00061     base = (int)tmp;
00062     }
00063
00064   maxdiv = ULONG_MAX / base;
00065   maxrem = ULONG_MAX % base;
00066
00067   while ((digit = *s) != '\0')
00068     {
00069       if (digit >= '0' && digit < ('0'+base))
00070     digit -= '0';
00071       else
00072     if (base > 10)
00073       {
00074         if (digit >= 'a' && digit < ('a'+(base-10)))
00075           digit = digit - 'a' + 10;
00076         else if (digit >= 'A' && digit < ('A'+(base-10)))
00077           digit = digit - 'A' + 10;
00078         else
00079           break;
00080       }
00081     else
00082       break;
00083       did_conversion = 1;
00084       if (total > maxdiv
00085       || (total == maxdiv && digit > maxrem))
00086     overflow = 1;
00087       total = (total * base) + digit;
00088       s++;
00089     }
00090   if (overflow)
00091     {
00092       errno = ERANGE;
00093       if (ptr != NULL)
00094     *ptr = (char *)s;
00095       return (ULONG_MAX);
00096     }
00097   if (ptr != NULL)
00098     *ptr = (char *) ((did_conversion) ? (char *)s : (char *)start);
00099   return negate ? -total : total;
00100 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


strstr.c File Reference

cvs-1.10/lib/strstr.c File Reference

Go to the source code of this file.

Functions

char * | strstr (Source, What) register const char *Source

Variables

register const char * | What

Function Documentation

char* strstr | ( | Source | ,
 |  | What |
 | ) | const

Referenced by GetEnvValue(), and fixpath().

Variable Documentation

register const char* What

Definition at line 20 of file strstr.c.

Generated on Sun Oct 21 12:43:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


strtoul.c File Reference

cvs-1.10/lib/strtoul.c File Reference

#include <errno.h>
#include <ctype.h>
#include <stdio.h>

Include dependency graph for strtoul.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | ULONG_MAX ((unsigned long)(~0L))

Functions

unsigned long | strtoul (s, ptr, base) const char *s

Variables

int | errno
char ** | ptr
int | base

Define Documentation

#define ULONG_MAX ((unsigned long)(~0L))

Definition at line 16 of file strtoul.c.

Function Documentation

unsigned long strtoul | ( | s | ,
 |  | ptr | ,
 |  | base |
 | ) | const

Variable Documentation

int base

Definition at line 23 of file strtoul.c.

int errno

Definition at line 19 of file strtoul.c.

char** ptr

Definition at line 23 of file strtoul.c.

Generated on Sun Oct 21 12:43:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


system.h File Reference

cvs-1.10/lib/system.h File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <limits.h>
#include <string.h>
#include <errno.h>
#include <sys/file.h>

Include dependency graph for system.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | timeb
struct | utimbuf

Defines

#define | S_IRUSR 0400
#define | S_IWUSR 0200
#define | S_IXUSR 0100
#define | S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
#define | S_IRGRP (S_IRUSR >> 3)
#define | S_IWGRP (S_IWUSR >> 3)
#define | S_IXGRP (S_IXUSR >> 3)
#define | S_IRWXG (S_IRWXU >> 3)
#define | S_IROTH (S_IRGRP >> 3)
#define | S_IWOTH (S_IWGRP >> 3)
#define | S_IXOTH (S_IXGRP >> 3)
#define | S_IRWXO (S_IRWXG >> 3)
#define | PATH_MAX 1024
#define | existence_error(x) ((x) == ENOENT)
#define | EXIT_FAILURE 1
#define | SEEK_SET 0
#define | SEEK_CUR 1
#define | SEEK_END 2
#define | F_OK 0
#define | X_OK 1
#define | W_OK 2
#define | R_OK 4
#define | dirent direct
#define | NAMLEN(dirent) (dirent)->d_namlen
#define | convert_blocks(b, k) ((k) ? ((b) + 1) / 2 : (b))
#define | lstat stat
#define | S_IWRITE 0000200
#define | CVS_ACCESS access
#define | CVS_CHDIR chdir
#define | CVS_CREAT creat
#define | CVS_FOPEN fopen
#define | CVS_MKDIR mkdir
#define | CVS_OPEN open
#define | CVS_OPENDIR opendir
#define | CVS_RENAME rename
#define | CVS_RMDIR rmdir
#define | CVS_STAT stat
#define | CVS_LSTAT lstat
#define | CVS_UNLINK unlink
#define | CVS_FNMATCH fnmatch
#define | FOLD_FN_CHAR(c) (c)
#define | fnfold(filename) (filename)
#define | fncmp strcmp
#define | ISDIRSEP(c) ((c) == '/')
#define | FOPEN_BINARY_READ ("rb")
#define | FOPEN_BINARY_WRITE ("wb")
#define | OPEN_BINARY (0)

Functions

off_t | lseek ()
char * | getcwd ()
int | utime ()
char * | getenv ()
char * | malloc ()
char * | realloc ()
char * | calloc ()

Variables

long | timezone
int | errno

Define Documentation

#define CVS_ACCESS access

Definition at line 417 of file system.h.

#define CVS_CHDIR chdir

Definition at line 421 of file system.h.

#define CVS_CREAT creat

Definition at line 425 of file system.h.

#define CVS_FNMATCH fnmatch

Definition at line 469 of file system.h.

#define CVS_FOPEN fopen

Definition at line 429 of file system.h.

#define CVS_LSTAT lstat

Definition at line 460 of file system.h.

Referenced by out().

#define CVS_MKDIR mkdir

Definition at line 433 of file system.h.

#define CVS_OPEN open

Definition at line 437 of file system.h.

#define CVS_OPENDIR opendir

Definition at line 441 of file system.h.

#define CVS_RENAME rename

Definition at line 445 of file system.h.

#define CVS_RMDIR rmdir

Definition at line 449 of file system.h.

#define CVS_STAT stat

Definition at line 453 of file system.h.

#define CVS_UNLINK unlink

Definition at line 464 of file system.h.

Referenced by finfo().

#define EXIT_FAILURE 1

Definition at line 327 of file system.h.

#define FOLD_FN_CHAR ( c ) (c)

Definition at line 503 of file system.h.

#define FOPEN_BINARY_READ ("rb")

Definition at line 526 of file system.h.

#define FOPEN_BINARY_WRITE ("wb")

Definition at line 527 of file system.h.

#define F_OK 0

Definition at line 366 of file system.h.

#define ISDIRSEP ( c ) ((c) == '/')

Definition at line 511 of file system.h.

#define NAMLEN ( dirent ) (dirent)->d_namlen

Definition at line 377 of file system.h.

#define OPEN_BINARY (0)

Definition at line 532 of file system.h.

#define PATH_MAX 1024

Definition at line 257 of file system.h.

#define R_OK 4

Definition at line 369 of file system.h.

#define SEEK_CUR 1

Definition at line 361 of file system.h.

#define SEEK_END 2

Definition at line 362 of file system.h.

#define SEEK_SET 0

Definition at line 360 of file system.h.

#define S_IRGRP (S_IRUSR >> 3)

Definition at line 137 of file system.h.

#define S_IROTH (S_IRGRP >> 3)

Definition at line 143 of file system.h.

#define S_IRUSR 0400

Definition at line 131 of file system.h.

#define S_IRWXG (S_IRWXU >> 3)

Definition at line 141 of file system.h.

#define S_IRWXO (S_IRWXG >> 3)

Definition at line 147 of file system.h.

#define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)

Definition at line 135 of file system.h.

#define S_IWGRP (S_IWUSR >> 3)

Definition at line 138 of file system.h.

#define S_IWOTH (S_IWGRP >> 3)

Definition at line 144 of file system.h.

#define S_IWRITE 0000200

Definition at line 402 of file system.h.

#define S_IWUSR 0200

Definition at line 132 of file system.h.

#define S_IXGRP (S_IXUSR >> 3)

Definition at line 139 of file system.h.

#define S_IXOTH (S_IXGRP >> 3)

Definition at line 145 of file system.h.

#define S_IXUSR 0100

Definition at line 133 of file system.h.

#define W_OK 2

Definition at line 368 of file system.h.

#define X_OK 1

Definition at line 367 of file system.h.

#define convert_blocks | ( | b,
 |  | k | ) | ((k) ? ((b) + 1) / 2 : (b))

Definition at line 391 of file system.h.

#define dirent direct

Definition at line 376 of file system.h.

#define existence_error ( x ) ((x) == ENOENT)

Definition at line 310 of file system.h.

Referenced by might_not_exist(), and update_server().

#define fncmp strcmp

Definition at line 505 of file system.h.

#define fnfold ( filename ) (filename)

Definition at line 504 of file system.h.

#define lstat stat

Definition at line 394 of file system.h.

Referenced by macos_lstat().

Function Documentation

char* calloc ( )

char* getcwd ( )

Referenced by FileTraverse(), CWincvsApp::IdleCvsProgress(), CBrowseFileView::OnViewUpone(), glue_getenv(), run_popen(), and xgetwd().

char* getenv ( )

off_t lseek ( )

char* malloc ( )

char* realloc ( )

int utime ( )

Variable Documentation

int errno

Definition at line 322 of file system.h.

long timezone

Definition at line 195 of file system.h.

Generated on Sun Oct 21 12:42:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/system.h Source File

cvs-1.10/lib/system.h

Go to the documentation of this file.
00001 /* system-dependent definitions for CVS.
00002    Copyright (C) 1989-1992 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #include <sys/types.h>
00015 #include <sys/stat.h>
00016
00017 #ifdef STAT_MACROS_BROKEN
00018 #undef S_ISBLK
00019 #undef S_ISCHR
00020 #undef S_ISDIR
00021 #undef S_ISREG
00022 #undef S_ISFIFO
00023 #undef S_ISLNK
00024 #undef S_ISSOCK
00025 #undef S_ISMPB
00026 #undef S_ISMPC
00027 #undef S_ISNWK
00028 #endif
00029
00030 /* Not all systems have S_IFMT, but we want to use it if we have it.
00031    The S_IFMT code below looks right (it masks and compares).  The
00032    non-S_IFMT code looks bogus (are there really systems on which
00033    S_IFBLK, S_IFLNK, &c, each have their own bit?  I suspect it was
00034    written for OS/2 using the IBM C/C++ Tools 2.01 compiler).
00035
00036    Of course POSIX systems will have S_IS*, so maybe the issue is
00037    semi-moot.  */
00038
00039 #if !defined(S_ISBLK) && defined(S_IFBLK)
00040 # if defined(S_IFMT)
00041 # define    S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
00042 # else
00043 # define S_ISBLK(m) ((m) & S_IFBLK)
00044 # endif
00045 #endif
00046
00047 #if !defined(S_ISCHR) && defined(S_IFCHR)
00048 # if defined(S_IFMT)
00049 # define    S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
00050 # else
00051 # define S_ISCHR(m) ((m) & S_IFCHR)
00052 # endif
00053 #endif
00054
00055 #if !defined(S_ISDIR) && defined(S_IFDIR)
00056 # if defined(S_IFMT)
00057 # define    S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
00058 # else
00059 # define S_ISDIR(m) ((m) & S_IFDIR)
00060 # endif
00061 #endif
00062
00063 #if !defined(S_ISREG) && defined(S_IFREG)
00064 # if defined(S_IFMT)
00065 # define    S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
00066 # else
00067 # define S_ISREG(m) ((m) & S_IFREG)
00068 # endif
00069 #endif
00070
00071 #if !defined(S_ISFIFO) && defined(S_IFIFO)
00072 # if defined(S_IFMT)
00073 # define    S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
00074 # else
00075 # define S_ISFIFO(m) ((m) & S_IFIFO)
00076 # endif
00077 #endif
00078
00079 #if !defined(S_ISLNK) && defined(S_IFLNK)
00080 # if defined(S_IFMT)
00081 # define    S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
00082 # else
00083 # define S_ISLNK(m) ((m) & S_IFLNK)
00084 # endif
00085 #endif
00086
00087 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
00088 # if defined(S_IFMT)
00089 # define    S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
00090 # else
00091 # define S_ISSOCK(m) ((m) & S_IFSOCK)
00092 # endif
00093 #endif
00094
00095 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
00096 # if defined(S_IFMT)
00097 # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
00098 # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
00099 # else
00100 # define S_ISMPB(m) ((m) & S_IFMPB)
00101 # define S_ISMPC(m) ((m) & S_IFMPC)
00102 # endif
00103 #endif
00104
00105 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
00106 # if defined(S_IFMT)
00107 # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
00108 # else
00109 # define S_ISNWK(m) ((m) & S_IFNWK)
00110 # endif
00111 #endif
00112
00113 #ifdef NEED_DECOY_PERMISSIONS        /* OS/2, really */
00114
00115 #define S_IRUSR S_IREAD
00116 #define S_IWUSR S_IWRITE
00117 #define S_IXUSR S_IEXEC
00118 #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
00119 #define S_IRGRP S_IREAD
00120 #define S_IWGRP S_IWRITE
00121 #define S_IXGRP S_IEXEC
00122 #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
00123 #define S_IROTH S_IREAD
00124 #define S_IWOTH S_IWRITE
00125 #define S_IXOTH S_IEXEC
00126 #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
00127
00128 #else /* ! NEED_DECOY_PERMISSIONS */
00129
00130 #ifndef S_IRUSR
00131 #define S_IRUSR 0400
00132 #define S_IWUSR 0200
00133 #define S_IXUSR 0100
00134 /* Read, write, and execute by owner.  */
00135 #define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
00136
00137 #define S_IRGRP (S_IRUSR >> 3)  /* Read by group.  */
00138 #define S_IWGRP (S_IWUSR >> 3)  /* Write by group.  */
00139 #define S_IXGRP (S_IXUSR >> 3)  /* Execute by group.  */
00140 /* Read, write, and execute by group.  */
00141 #define S_IRWXG (S_IRWXU >> 3)
00142
00143 #define S_IROTH (S_IRGRP >> 3)  /* Read by others.  */
00144 #define S_IWOTH (S_IWGRP >> 3)  /* Write by others.  */
00145 #define S_IXOTH (S_IXGRP >> 3)  /* Execute by others.  */
00146 /* Read, write, and execute by others.  */
00147 #define S_IRWXO (S_IRWXG >> 3)
00148 #endif /* !def S_IRUSR */
00149 #endif /* NEED_DECOY_PERMISSIONS */
00150
00151 #if defined(POSIX) || defined(HAVE_UNISTD_H)
00152 #include <unistd.h>
00153 #include <limits.h>
00154 #else
00155 off_t lseek ();
00156 char *getcwd ();
00157 #endif
00158
00159 #if TIME_WITH_SYS_TIME
00160 # include <sys/time.h>
00161 # include <time.h>
00162 #else
00163 # if HAVE_SYS_TIME_H
00164 #  include <sys/time.h>
00165 # else
00166 #  include <time.h>
00167 # endif
00168 #endif
00169
00170 #ifdef HAVE_IO_H
00171 #include <io.h>
00172 #endif
00173
00174 #ifdef HAVE_DIRECT_H
00175 #include <direct.h>
00176 #endif
00177
00178 #ifdef timezone
00179 #undef timezone /* needed for sgi */
00180 #endif
00181
00182 #ifdef HAVE_SYS_TIMEB_H
00183 #include <sys/timeb.h>
00184 #else
00185 struct timeb {
00186     time_t      time;       /* Seconds since the epoch  */
00187     unsigned short  millitm;    /* Field not used       */
00188     short       timezone;
00189     short       dstflag;    /* Field not used       */
00190 };
00191 #endif
00192
00193 #if !defined(HAVE_FTIME) && !defined(HAVE_TIMEZONE)
00194 #if !defined(timezone)
00195 extern long timezone;
00196 #endif
00197 #endif
00198
00199
00200 /*
00201 **  MAXPATHLEN and PATH_MAX
00202 **
00203 **     On most systems MAXPATHLEN is defined in sys/param.h to be 1024. Of
00204 **     those that this is not true, again most define PATH_MAX in limits.h
00205 **     or sys/limits.h which usually gets included by limits.h. On the few
00206 **     remaining systems that neither statement is true, _POSIX_PATH_MAX
00207 **     is defined.
00208 **
00209 **     So:
00210 **         1. If PATH_MAX is defined just use it.
00211 **         2. If MAXPATHLEN is defined but not PATH_MAX, then define
00212 **            PATH_MAX in terms of MAXPATHLEN.
00213 **         3. If neither is defined, include limits.h and check for
00214 **            PATH_MAX again.
00215 **         3.1 If we now have PATHSIZE, define PATH_MAX in terms of that.
00216 **             and ignore the rest.  Since _POSIX_PATH_MAX (checked for
00217 **             next) is the *most* restrictive (smallest) value, if we
00218 **             trust _POSIX_PATH_MAX, several of our buffers are too small.
00219 **         4. If PATH_MAX is still not defined but _POSIX_PATH_MAX is,
00220 **            then define PATH_MAX in terms of _POSIX_PATH_MAX.
00221 **         5. And if even _POSIX_PATH_MAX doesn't exist just put in
00222 **            a reasonable value.
00223 **         *. All in all, this is an excellent argument for using pathconf()
00224 **            when at all possible.  Or better yet, dynamically allocate
00225 **            our buffers and use getcwd() not getwd().
00226 **
00227 **     This works on:
00228 **         Sun Sparc 10        SunOS 4.1.3  &  Solaris 1.2
00229 **         HP 9000/700         HP/UX 8.07   &  HP/UX 9.01
00230 **         Tektronix XD88/10   UTekV 3.2e
00231 **         IBM RS6000          AIX 3.2
00232 **         Dec Alpha           OSF 1 ????
00233 **         Intel 386           BSDI BSD/386
00234 **         Intel 386           SCO OpenServer Release 5
00235 **         Apollo              Domain 10.4
00236 **         NEC                 SVR4
00237 */
00238
00239 /* On MOST systems this will get you MAXPATHLEN.
00240    Windows NT doesn't have this file, tho.  */
00241 #ifdef HAVE_SYS_PARAM_H
00242 #include <sys/param.h>
00243 #endif
00244
00245 #ifndef PATH_MAX
00246 #  ifdef MAXPATHLEN
00247 #    define PATH_MAX                 MAXPATHLEN
00248 #  else
00249 #    include <limits.h>
00250 #    ifndef PATH_MAX
00251 #      ifdef PATHSIZE
00252 #         define PATH_MAX               PATHSIZE
00253 #      else /* no PATHSIZE */
00254 #        ifdef _POSIX_PATH_MAX
00255 #          define PATH_MAX             _POSIX_PATH_MAX
00256 #        else
00257 #          define PATH_MAX             1024
00258 #        endif  /* no _POSIX_PATH_MAX */
00259 #      endif  /* no PATHSIZE */
00260 #    endif /* no PATH_MAX   */
00261 #  endif  /* MAXPATHLEN */
00262 #endif  /* PATH_MAX   */
00263
00264
00265 /* The NeXT (without _POSIX_SOURCE, which we don't want) has a utime.h
00266    which doesn't define anything.  It would be cleaner to have configure
00267    check for struct utimbuf, but for now I'm checking NeXT here (so I don't
00268    have to debug the configure check across all the machines).  */
00269 #if defined (HAVE_UTIME_H) && !defined (NeXT)
00270 #  include <utime.h>
00271 #else
00272 #  if defined (HAVE_SYS_UTIME_H)
00273 #    include <sys/utime.h>
00274 #  else
00275 #    ifndef ALTOS
00276 struct utimbuf
00277 {
00278   long actime;
00279   long modtime;
00280 };
00281 #    endif
00282 int utime ();
00283 #  endif
00284 #endif
00285
00286 #include <string.h>
00287
00288 #ifndef ERRNO_H_MISSING
00289 #include <errno.h>
00290 #endif
00291
00292 /* Not all systems set the same error code on a non-existent-file
00293    error.  This tries to ask the question somewhat portably.
00294    On systems that don't have ENOTEXIST, this should behave just like
00295    x == ENOENT.  "x" is probably errno, of course. */
00296
00297 #ifdef ENOTEXIST
00298 #  ifdef EOS2ERR
00299 #    define existence_error(x) \
00300      (((x) == ENOTEXIST) || ((x) == ENOENT) || ((x) == EOS2ERR))
00301 #  else
00302 #    define existence_error(x) \
00303      (((x) == ENOTEXIST) || ((x) == ENOENT))
00304 #  endif
00305 #else
00306 #  ifdef EVMSERR
00307 #     define existence_error(x) \
00308 ((x) == ENOENT || (x) == EINVAL || (x) == EVMSERR)
00309 #  else
00310 #    define existence_error(x) ((x) == ENOENT)
00311 #  endif
00312 #endif
00313
00314
00315 #ifdef STDC_HEADERS
00316 #include <stdlib.h>
00317 #else
00318 char *getenv ();
00319 char *malloc ();
00320 char *realloc ();
00321 char *calloc ();
00322 extern int errno;
00323 #endif
00324
00325 /* SunOS4 apparently does not define this in stdlib.h.  */
00326 #ifndef EXIT_FAILURE
00327 #define EXIT_FAILURE 1
00328 #endif
00329
00330 /* check for POSIX signals */
00331 #if defined(HAVE_SIGACTION) && defined(HAVE_SIGPROCMASK)
00332 # define POSIX_SIGNALS
00333 #endif
00334
00335 /* MINIX 1.6 doesn't properly support sigaction */
00336 #if defined(_MINIX)
00337 # undef POSIX_SIGNALS
00338 #endif
00339
00340 /* If !POSIX, try for BSD.. Reason: 4.4BSD implements these as wrappers */
00341 #if !defined(POSIX_SIGNALS)
00342 # if defined(HAVE_SIGVEC) && defined(HAVE_SIGSETMASK) && defined(HAVE_SIGBLOCK)
00343 #  define BSD_SIGNALS
00344 # endif
00345 #endif
00346
00347 /* Under OS/2, this must be included _after_ stdio.h; that's why we do
00348    it here. */
00349 #ifdef USE_OWN_TCPIP_H
00350 #include "tcpip.h"
00351 #endif
00352
00353 #ifdef HAVE_FCNTL_H
00354 #include <fcntl.h>
00355 #else
00356 #include <sys/file.h>
00357 #endif
00358
00359 #ifndef SEEK_SET
00360 #define SEEK_SET 0
00361 #define SEEK_CUR 1
00362 #define SEEK_END 2
00363 #endif
00364
00365 #ifndef F_OK
00366 #define F_OK 0
00367 #define X_OK 1
00368 #define W_OK 2
00369 #define R_OK 4
00370 #endif
00371
00372 #if HAVE_DIRENT_H
00373 # include <dirent.h>
00374 # define NAMLEN(dirent) strlen((dirent)->d_name)
00375 #else
00376 # define dirent direct
00377 # define NAMLEN(dirent) (dirent)->d_namlen
00378 # if HAVE_SYS_NDIR_H
00379 #  include <sys/ndir.h>
00380 # endif
00381 # if HAVE_SYS_DIR_H
00382 #  include <sys/dir.h>
00383 # endif
00384 # if HAVE_NDIR_H
00385 #  include <ndir.h>
00386 # endif
00387 #endif
00388
00389 /* Convert B 512-byte blocks to kilobytes if K is nonzero,
00390    otherwise return it unchanged. */
00391 #define convert_blocks(b, k) ((k) ? ((b) + 1) / 2 : (b))
00392
00393 #ifndef S_ISLNK
00394 #define lstat stat
00395 #endif
00396
00397 /*
00398  * Some UNIX distributions don't include these in their stat.h Defined here
00399  * because "config.h" is always included last.
00400  */
00401 #ifndef S_IWRITE
00402 #define S_IWRITE    0000200     /* write permission, owner */
00403 #endif
00404 #ifndef S_IWGRP
00405 #define S_IWGRP     0000020     /* write permission, grougroup */
00406 #endif
00407 #ifndef S_IWOTH
00408 #define S_IWOTH     0000002     /* write permission, other */
00409 #endif
00410
00411 /* Under non-UNIX operating systems (MS-DOS, WinNT, MacOS), many filesystem
00412    calls take  only one argument; permission is handled very differently on
00413    those systems than in Unix.  So we leave such systems a hook on which they
00414    can hang their own definitions.  */
00415
00416 #ifndef CVS_ACCESS
00417 #define CVS_ACCESS access
00418 #endif
00419
00420 #ifndef CVS_CHDIR
00421 #define CVS_CHDIR chdir
00422 #endif
00423
00424 #ifndef CVS_CREAT
00425 #define CVS_CREAT creat
00426 #endif
00427
00428 #ifndef CVS_FOPEN
00429 #define CVS_FOPEN fopen
00430 #endif
00431
00432 #ifndef CVS_MKDIR
00433 #define CVS_MKDIR mkdir
00434 #endif
00435
00436 #ifndef CVS_OPEN
00437 #define CVS_OPEN open
00438 #endif
00439
00440 #ifndef CVS_OPENDIR
00441 #define CVS_OPENDIR opendir
00442 #endif
00443
00444 #ifndef CVS_RENAME
00445 #define CVS_RENAME rename
00446 #endif
00447
00448 #ifndef CVS_RMDIR
00449 #define CVS_RMDIR rmdir
00450 #endif
00451
00452 #ifndef CVS_STAT
00453 #define CVS_STAT stat
00454 #endif
00455
00456 /* Open question: should CVS_STAT be lstat by default?  We need
00457    to use lstat in order to handle symbolic links correctly with
00458    the PreservePermissions option. -twp */
00459 #ifndef CVS_LSTAT
00460 #define CVS_LSTAT lstat
00461 #endif
00462
00463 #ifndef CVS_UNLINK
00464 #define CVS_UNLINK unlink
00465 #endif
00466
00467 /* Wildcard matcher.  Should be case-insensitive if the system is.  */
00468 #ifndef CVS_FNMATCH
00469 #define CVS_FNMATCH fnmatch
00470 #endif
00471
00472 #if defined (__CYGWIN32__) || defined (WIN32)
00473
00474 /* Under Windows NT, filenames are case-insensitive, and both / and \
00475    are path component separators.  */
00476
00477 #define FOLD_FN_CHAR(c) (WNT_filename_classes[(unsigned char) (c)])
00478 extern unsigned char WNT_filename_classes[];
00479 #define FILENAMES_CASE_INSENSITIVE 1
00480
00481 /* Is the character C a path name separator?  Under
00482    Windows NT, you can use either / or \.  */
00483 #define ISDIRSEP(c) (FOLD_FN_CHAR(c) == '/')
00484
00485 /* Like strcmp, but with the appropriate tweaks for file names.
00486    Under Windows NT, filenames are case-insensitive but case-preserving,
00487    and both \ and / are path element separators.  */
00488 extern int fncmp (const char *n1, const char *n2);
00489
00490 /* Fold characters in FILENAME to their canonical forms.
00491    If FOLD_FN_CHAR is not #defined, the system provides a default
00492    definition for this.  */
00493 extern void fnfold (char *FILENAME);
00494
00495 #endif /* defined (__CYGWIN32__) || defined (WIN32) */
00496
00497 /* Some file systems are case-insensitive.  If FOLD_FN_CHAR is
00498    #defined, it maps the character C onto its "canonical" form.  In a
00499    case-insensitive system, it would map all alphanumeric characters
00500    to lower case.  Under Windows NT, / and \ are both path component
00501    separators, so FOLD_FN_CHAR would map them both to /.  */
00502 #ifndef FOLD_FN_CHAR
00503 #define FOLD_FN_CHAR(c) (c)
00504 #define fnfold(filename) (filename)
00505 #define fncmp strcmp
00506 #endif
00507
00508 /* Different file systems have different path component separators.
00509    For the VMS port we might need to abstract further back than this.  */
00510 #ifndef ISDIRSEP
00511 #define ISDIRSEP(c) ((c) == '/')
00512 #endif
00513
00514
00515 /* On some systems, we have to be careful about writing/reading files
00516    in text or binary mode (so in text mode the system can handle CRLF
00517    vs. LF, VMS text file conventions, &c).  We decide to just always
00518    be careful.  That way we don't have to worry about whether text and
00519    binary differ on this system.  We just have to worry about whether
00520    the system has O_BINARY and "rb".  The latter is easy; all ANSI C
00521    libraries have it, SunOS4 has it, and CVS has used it unguarded
00522    some places for a while now without complaints (e.g. "rb" in
00523    server.c (server_updated), since CVS 1.8).  The former is just an
00524    #ifdef.  */
00525
00526 #define FOPEN_BINARY_READ ("rb")
00527 #define FOPEN_BINARY_WRITE ("wb")
00528
00529 #ifdef O_BINARY
00530 #define OPEN_BINARY (O_BINARY)
00531 #else
00532 #define OPEN_BINARY (0)
00533 #endif
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/valloc.c Source File

cvs-1.10/lib/valloc.c

Go to the documentation of this file.
00001 /* valloc -- return memory aligned to the page size.  */
00002
00003 #ifdef HAVE_CONFIG_H
00004 #include "config.h"
00005 #endif
00006
00007 #include "system.h"
00008
00009 #ifndef HAVE_GETPAGESIZE
00010 #define getpagesize() 4096
00011 #endif
00012
00013 void *
00014 valloc (bytes)
00015      size_t bytes;
00016 {
00017   long pagesize;
00018   char *ret;
00019
00020   pagesize = getpagesize ();
00021   ret = (char *) malloc (bytes + pagesize - 1);
00022   if (ret)
00023     ret = (char *) ((long) (ret + pagesize - 1) &~ (pagesize - 1));
00024   return ret;
00025 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/vasprintf.c Source File

cvs-1.10/lib/vasprintf.c

Go to the documentation of this file.
00001 /* Like vsprintf but provides a pointer to malloc'd storage, which must
00002    be freed by the caller.
00003    Copyright (C) 1994 Free Software Foundation, Inc.
00004
00005 This file is part of the libiberty library.
00006 Libiberty is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU Library General Public
00008 License as published by the Free Software Foundation; either
00009 version 2 of the License, or (at your option) any later version.
00010
00011 Libiberty is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 Library General Public License for more details.  */
00015
00016 #include <stdio.h>
00017 #include <string.h>
00018
00019 #ifdef HAVE_CONFIG_H
00020 #include "config.h"
00021 #endif
00022
00023 #ifdef __STDC__
00024 #include <stdarg.h>
00025 #else
00026 #include <varargs.h>
00027 #endif
00028
00029 #ifdef TEST
00030 int global_total_width;
00031 #endif
00032
00033 #ifdef STDC_HEADERS
00034 #include <stdlib.h>
00035 #else
00036 extern int abs ();
00037 extern unsigned long strtoul ();
00038 extern char *malloc ();
00039 #endif
00040
00041 static int
00042 int_vasprintf (result, format, args)
00043      char **result;
00044      const char *format;
00045      va_list *args;
00046 {
00047   const char *p = format;
00048   /* Add one to make sure that it is never zero, which might cause malloc
00049      to return NULL.  */
00050   int total_width = strlen (format) + 1;
00051   va_list ap;
00052
00053   memcpy (&ap, args, sizeof (va_list));
00054
00055   while (*p != '\0')
00056     {
00057       if (*p++ == '%')
00058     {
00059       while (strchr ("-+ #0", *p))
00060         ++p;
00061       if (*p == '*')
00062         {
00063           ++p;
00064           total_width += abs (va_arg (ap, int));
00065         }
00066       else
00067         total_width += strtoul (p, (char **)&p, 10);
00068       if (*p == '.')
00069         {
00070           ++p;
00071           if (*p == '*')
00072         {
00073           ++p;
00074           total_width += abs (va_arg (ap, int));
00075         }
00076           else
00077           total_width += strtoul (p, (char **)&p, 10);
00078         }
00079       while (strchr ("hlL", *p))
00080         ++p;
00081       /* Should be big enough for any format specifier except %s.  */
00082       total_width += 30;
00083       switch (*p)
00084         {
00085         case 'd':
00086         case 'i':
00087         case 'o':
00088         case 'u':
00089         case 'x':
00090         case 'X':
00091         case 'c':
00092           (void) va_arg (ap, int);
00093           break;
00094         case 'f':
00095         case 'e':
00096         case 'E':
00097         case 'g':
00098         case 'G':
00099           (void) va_arg (ap, double);
00100           break;
00101         case 's':
00102           total_width += strlen (va_arg (ap, char *));
00103           break;
00104         case 'p':
00105         case 'n':
00106           (void) va_arg (ap, char *);
00107           break;
00108         }
00109     }
00110     }
00111 #ifdef TEST
00112   global_total_width = total_width;
00113 #endif
00114   *result = malloc (total_width);
00115   if (*result != NULL)
00116     return vsprintf (*result, format, *args);
00117   else
00118     return 0;
00119 }
00120
00121 int
00122 vasprintf (result, format, args)
00123      char **result;
00124      const char *format;
00125      va_list args;
00126 {
00127 #ifdef VA_LIST_IS_ARRAY
00128   /* If va_list is an array, we do not need the additional indirection */
00129   return int_vasprintf (result, format, args);
00130 #else
00131   /* va_list is some sort of pointer */
00132   return int_vasprintf (result, format, &args);
00133 #endif
00134 }
00135
00136 #ifdef TEST
00137 void
00138 checkit
00139 #ifdef __STDC__
00140      (const char* format, ...)
00141 #else
00142      (va_alist)
00143      va_dcl
00144 #endif
00145 {
00146   va_list args;
00147   char *result;
00148
00149 #ifdef __STDC__
00150   va_start (args, format);
00151 #else
00152   char *format;
00153   va_start (args);
00154   format = va_arg (args, char *);
00155 #endif
00156   vasprintf (&result, format, args);
00157   if (strlen (result) < global_total_width)
00158     printf ("PASS: ");
00159   else
00160     printf ("FAIL: ");
00161   printf ("%d %s\n", global_total_width, result);
00162 }
00163
00164 int
00165 main ()
00166 {
00167   checkit ("%d", 0x12345678);
00168   checkit ("%200d", 5);
00169   checkit ("%.300d", 6);
00170   checkit ("%100.150d", 7);
00171   checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
00172 777777777777777777333333333333366666666666622222222222777777777777733333");
00173   checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx");
00174 }
00175 #endif /* TEST */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/wait.h Source File

cvs-1.10/lib/wait.h

Go to the documentation of this file.
00001 /* wait.h -- POSIX macros for evaluating exit statuses
00002    Copyright (C) 1990 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #ifdef HAVE_SYS_WAIT_H
00015 #include <sys/types.h>      /* For pid_t. */
00016 #ifdef HAVE_SYS_RESOURCE_H
00017 #include <sys/resource.h>   /* for rusage */
00018 #endif
00019 #include <sys/wait.h>
00020 #endif
00021 #ifndef WIFSTOPPED
00022 #define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
00023 #endif
00024 #ifndef WIFSIGNALED
00025 #define WIFSIGNALED(w) (((w) & 0xff) != 0x7f && ((w) & 0xff) != 0)
00026 #endif
00027 #ifndef WIFEXITED
00028 #define WIFEXITED(w) (((w) & 0xff) == 0)
00029 #endif
00030
00031 #ifndef WSTOPSIG
00032 #define WSTOPSIG(w) (((w) >> 8) & 0xff)
00033 #endif
00034 #ifndef WTERMSIG
00035 #define WTERMSIG(w) ((w) & 0x7f)
00036 #endif
00037 #ifndef WEXITSTATUS
00038 #define WEXITSTATUS(w) (((w) >> 8) & 0xff)
00039 #endif
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


valloc.c File Reference

cvs-1.10/lib/valloc.c File Reference

#include "system.h"

Include dependency graph for valloc.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | getpagesize() 4096

Functions

void * | valloc (bytes) size_t bytes

Define Documentation

#define getpagesize ( ) 4096

Definition at line 10 of file valloc.c.

Function Documentation

void* valloc ( bytes )

Generated on Sun Oct 21 12:43:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


vasprintf.c File Reference

cvs-1.10/lib/vasprintf.c File Reference

#include <stdio.h>
#include <string.h>
#include <varargs.h>

Include dependency graph for vasprintf.c:

Include dependency graph

Go to the source code of this file.

Functions

int | abs ()
unsigned long | strtoul ()
char * | malloc ()
int | int_vasprintf (result, format, args) char **result

Variables

const char * | format
va_list * | args

Function Documentation

int abs ( )

int int_vasprintf | ( | result | ,
 |  | format | ,
 |  | args |
 | ) | [static]

char* malloc ( )

unsigned long strtoul ( )

Referenced by delvers().

Variable Documentation

va_list args

Definition at line 125 of file vasprintf.c.

Referenced by CvsCmdLine(), UCvsFiles::EditSel(), LaunchDiff(), UAuthen_SSH::OnBtnName(), UAuthen_SSH::OnBtnRSA(), UCvsFolders::OnCmdExplore(), UCvsFiles::OnCmdExplore(), UCvsFiles::OnCmdTrash(), and MacroTraversal::OnFile().

const char* format

Definition at line 124 of file vasprintf.c.

Generated on Sun Oct 21 12:43:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


wait.h File Reference

cvs-1.10/lib/wait.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
#define | WIFSIGNALED(w) (((w) & 0xff) != 0x7f && ((w) & 0xff) != 0)
#define | WIFEXITED(w) (((w) & 0xff) == 0)
#define | WSTOPSIG(w) (((w) >> 8) & 0xff)
#define | WTERMSIG(w) ((w) & 0x7f)
#define | WEXITSTATUS(w) (((w) >> 8) & 0xff)

Define Documentation

#define WEXITSTATUS ( w ) (((w) >> 8) & 0xff)

Definition at line 38 of file wait.h.

#define WIFEXITED ( w ) (((w) & 0xff) == 0)

Definition at line 28 of file wait.h.

#define WIFSIGNALED ( w ) (((w) & 0xff) != 0x7f && ((w) & 0xff) != 0)

Definition at line 25 of file wait.h.

#define WIFSTOPPED ( w ) (((w) & 0xff) == 0x7f)

Definition at line 22 of file wait.h.

#define WSTOPSIG ( w ) (((w) >> 8) & 0xff)

Definition at line 32 of file wait.h.

#define WTERMSIG ( w ) ((w) & 0x7f)

Definition at line 35 of file wait.h.

Generated on Sun Oct 21 12:43:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


waitpid.c File Reference

cvs-1.10/lib/waitpid.c File Reference

#include "system.h"
#include "wait.h"
#include <stdio.h>

Include dependency graph for waitpid.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | unreaped

Functions

unreaped * | ualloc (oldptr, n) struct unreaped *oldptr

Variables

unreaped * | unreaped
int | n
int * | status
int | options

Function Documentation

struct unreaped* ualloc | ( | oldptr | ,
 |  | n |
 | ) | [static]

Referenced by options().

Variable Documentation

int n [static]

Definition at line 19 of file waitpid.c.

int options

Definition at line 39 of file waitpid.c.

int* status

Definition at line 38 of file waitpid.c.

struct unreaped* unreaped [static]

Definition at line 14 of file waitpid.c.

Generated on Sun Oct 21 12:43:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/waitpid.c Source File

cvs-1.10/lib/waitpid.c

Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #include "config.h"
00003 #endif
00004
00005 #include "system.h"
00006 #include "wait.h"
00007
00008 #include <stdio.h>
00009
00010 struct unreaped {
00011   pid_t pid;
00012   int status;
00013 };
00014 static struct unreaped *unreaped;
00015 static int n;
00016
00017 static struct unreaped *ualloc (oldptr, n)
00018      struct unreaped *oldptr;
00019      int n;
00020 {
00021   n *= sizeof (struct unreaped);
00022   if (n == 0)
00023     n = 1;
00024   if (oldptr)
00025     oldptr = (struct unreaped *) realloc ((char *) oldptr, n);
00026   else
00027     oldptr = (struct unreaped *) malloc (n);
00028   if (oldptr == 0)
00029     {
00030       fprintf (stderr, "cannot allocate %d bytes\n", n);
00031       exit (1);
00032     }
00033   return oldptr;
00034 }
00035
00036 pid_t waitpid (pid, status, options)
00037      pid_t pid;
00038      int *status;
00039      int options;
00040 {
00041   int i;
00042
00043   /* initialize */
00044   if (unreaped == 0)
00045     {
00046       unreaped = ualloc (unreaped, 1);
00047       unreaped[0].pid = 0;
00048       n = 1;
00049     }
00050
00051   for (i = 0; unreaped[i].pid; i++)
00052     if (unreaped[i].pid == pid)
00053       {
00054     *status = unreaped[i].status;
00055     while (unreaped[i].pid)
00056       {
00057         unreaped[i] = unreaped[i+1];
00058         i++;
00059       }
00060     n--;
00061     return pid;
00062       }
00063
00064   while (1)
00065     {
00066 #ifdef HAVE_WAIT3
00067       pid_t p = wait3 (status, options, (struct rusage *) 0);
00068 #else
00069       pid_t p = wait (status);
00070 #endif
00071
00072       if (p == 0 || p == -1 || p == pid)
00073     return p;
00074
00075       n++;
00076       unreaped = ualloc (unreaped, n);
00077       unreaped[n-1].pid = p;
00078       unreaped[n-1].status = *status;
00079     }
00080 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/xgetwd.c Source File

cvs-1.10/lib/xgetwd.c

Go to the documentation of this file.
00001 /* xgetwd.c -- return current directory with unlimited length
00002    Copyright (C) 1992, 1997 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 /* Derived from xgetcwd.c in e.g. the GNU sh-utils.  */
00015
00016 #ifdef HAVE_CONFIG_H
00017 #include <config.h>
00018 #endif
00019
00020 #ifndef CVSGUI_SHL
00021 #include "system.h"
00022 #endif /* !CVSGUI_SHL */
00023
00024 #include <stdio.h>
00025 #include <errno.h>
00026 #ifndef errno
00027 extern int errno;
00028 #endif
00029 #include <sys/types.h>
00030
00031 /* Amount by which to increase buffer size when allocating more space. */
00032 #define PATH_INCR 32
00033
00034 #ifndef CVSGUI_SHL
00035 char *xmalloc ();
00036 char *xrealloc ();
00037 #else /* CVSGUI_SHL */
00038 #include "cvs.h"
00039 #endif /* CVSGUI_SHL */
00040
00041 /* Return the current directory, newly allocated, arbitrarily long.
00042    Return NULL and set errno on error. */
00043
00044 char *
00045 xgetwd ()
00046 {
00047   char *cwd;
00048   char *ret;
00049   unsigned path_max;
00050
00051   errno = 0;
00052   path_max = (unsigned) PATH_MAX;
00053   path_max += 2;        /* The getcwd docs say to do this. */
00054
00055   cwd = xmalloc (path_max);
00056
00057   errno = 0;
00058   while ((ret = getcwd (cwd, path_max)) == NULL && errno == ERANGE)
00059     {
00060       path_max += PATH_INCR;
00061       cwd = xrealloc (cwd, path_max);
00062       errno = 0;
00063     }
00064
00065   if (ret == NULL)
00066     {
00067       int save_errno = errno;
00068       free (cwd);
00069       errno = save_errno;
00070       return NULL;
00071     }
00072   return cwd;
00073 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/lib/yesno.c Source File

cvs-1.10/lib/yesno.c

Go to the documentation of this file.
00001 /* yesno.c -- read a yes/no response from stdin
00002    Copyright (C) 1990 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #ifdef HAVE_CONFIG_H
00015 #include "config.h"
00016 #endif
00017
00018 #include <stdio.h>
00019
00020 #ifdef CVSGUI_SHL
00021 #   include <string.h>
00022 #endif /* CVSGUI_SHL */
00023
00024 /* Read one line from standard input
00025    and return nonzero if that line begins with y or Y,
00026    otherwise return 0. */
00027
00028 int
00029 yesno ()
00030 {
00031   int c;
00032   int rv;
00033
00034 #ifdef CVSGUI_SHL
00035     char *response;
00036
00037     printf("\n");
00038     dllglue_flushconsole();
00039     response = getenv("CVSLIB_YESNO");
00040     if(response != 0L)
00041         return strcmp(response, "yes") == 0;
00042 #endif /* CVSGUI_SHL */
00043 #ifdef CVSGUI_PIPE
00044     char *response;
00045
00046     cvs_output("\n", 1);
00047     response = getenv("CVSLIB_YESNO");
00048     if(response != 0L)
00049         return strcmp(response, "yes") == 0;
00050 #endif /* CVSGUI_PIPE*/
00051
00052   fflush (stderr);
00053   fflush (stdout);
00054   c = getchar ();
00055   rv = (c == 'y') || (c == 'Y');
00056   while (c != EOF && c != '\n')
00057     c = getchar ();
00058
00059   return rv;
00060 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/apsingle.c Source File

cvs-1.10/macintosh/apsingle.c

Go to the documentation of this file.
00001 /* Implements a simple AppleSingle decoder/encoder, as described in RFC1740 */
00002 /* http://andrew2.andrew.cmu.edu/rfc/rfc1740.html */
00003
00004 #include "apsingle.h"
00005
00006 /* Mac headers */
00007 #include <Finder.h>
00008 #include <MacErrors.h>
00009 #include <Resources.h>
00010
00011 /* stdc */
00012 #include <stdio.h>
00013 #include <string.h>
00014
00015 /* struct definitions from RFC1740 */
00016 #if PRAGMA_STRUCT_ALIGN
00017 #pragma options align=mac68k
00018 #endif
00019
00020 typedef struct ASHeader /* header portion of AppleSingle */
00021 {
00022     /* AppleSingle = 0x00051600; AppleDouble = 0x00051607 */
00023        UInt32 magicNum; /* internal file type tag */
00024        UInt32 versionNum; /* format version: 2 = 0x00020000 */
00025        UInt8 filler[16]; /* filler, currently all bits 0 */
00026        UInt16 numEntries; /* number of entries which follow */
00027 } ASHeader ; /* ASHeader */
00028
00029 typedef struct ASEntry /* one AppleSingle entry descriptor */
00030 {
00031     UInt32 entryID; /* entry type: see list, 0 invalid */
00032     UInt32 entryOffset; /* offset, in octets, from beginning */
00033                               /* of file to this entry's data */
00034     UInt32 entryLength; /* length of data in octets */
00035 } ASEntry; /* ASEntry */
00036
00037 typedef struct ASFinderInfo
00038 {
00039     FInfo ioFlFndrInfo; /* PBGetFileInfo() or PBGetCatInfo() */
00040     FXInfo ioFlXFndrInfo; /* PBGetCatInfo() (HFS only) */
00041 } ASFinderInfo; /* ASFinderInfo */
00042
00043 typedef struct ASMacInfo        /* entry ID 10, Macintosh file information */
00044 {
00045        UInt8 filler[3]; /* filler, currently all bits 0 */
00046        UInt8 ioFlAttrib; /* PBGetFileInfo() or PBGetCatInfo() */
00047 } ASMacInfo;
00048
00049 typedef struct ASFileDates      /* entry ID 8, file dates info */
00050 {
00051     SInt32 create; /* file creation date/time */
00052     SInt32 modify; /* last modification date/time */
00053     SInt32 backup; /* last backup date/time */
00054     SInt32 access; /* last access date/time */
00055 } ASFileDates; /* ASFileDates */
00056
00057
00058 #if PRAGMA_STRUCT_ALIGN
00059 #pragma options align=reset
00060 #endif
00061
00062 /* Prototypes */
00063 OSErr decodeFileDates( ASEntry inEntry, FILE * inFile, FSSpec * ioSpec );
00064 OSErr decodeRealName( ASEntry inEntry, FILE * inFile, FSSpec * ioSpec );
00065 OSErr encodeRealName(FILE * outfp, const FSSpec * inSpec );
00066 OSErr encodeComment(FILE * outfp, Str255 comment );
00067 OSErr encodeFileDates(FILE * outfp, const CInfoPBRec * pb);
00068 OSErr encodeFinderInfo( FILE * outfp, const FSSpec * inSpec, const CInfoPBRec * pb);
00069 OSErr encodeMacInfo( FILE * outfp, const CInfoPBRec * pb );
00070 OSErr macFileToFileStream( FILE * outfp, SInt16 refNum, UInt32 bytesExpected);
00071 OSErr encodeDataFork( FILE * outfp, const FSSpec * inFile, UInt32 bytesExpected);
00072 OSErr encodeResourceFork( FILE * outfp, const FSSpec * inFile, UInt32 bytesExpected);
00073
00074 /* asEntryToMacFile
00075  * Blasts the bytes specified in the entry to already opened Mac file
00076  */
00077 static OSErr
00078 asEntryToMacFile( ASEntry inEntry, FILE * inFile, UInt16 inRefNum)
00079 {
00080 #define BUFFER_SIZE 8192
00081
00082     char buffer[BUFFER_SIZE];
00083     size_t totalRead = 0, bytesRead;
00084     long bytesToWrite;
00085     OSErr err;
00086
00087     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00088         return -1 ;
00089
00090     while ( totalRead < inEntry.entryLength )
00091     {
00092 // Should we yield in here?
00093         bytesRead = fread( buffer, 1, BUFFER_SIZE, inFile );
00094         if ( bytesRead <= 0 )
00095             return ioErr;
00096         bytesToWrite = totalRead + bytesRead > inEntry.entryLength ?
00097                                     inEntry.entryLength - totalRead :
00098                                     bytesRead;
00099
00100         totalRead += bytesRead;
00101         err = FSWrite(inRefNum, &bytesToWrite, buffer);
00102         if (err != noErr)
00103             return err;
00104     }
00105     return 0;
00106 }
00107
00108 static OSErr
00109 decodeDataFork( ASEntry inEntry, FILE * inFile, const FSSpec * ioSpec )
00110 {
00111     SInt16  refNum;
00112     OSErr err;
00113
00114     /* Setup the files */
00115     err = FSpOpenDF (ioSpec, fsWrPerm,  &refNum);
00116
00117     if ( err == noErr )
00118         err = asEntryToMacFile( inEntry, inFile, refNum );
00119
00120     FSClose( refNum );
00121     return err;
00122 }
00123
00124 static OSErr
00125 decodeResourceFork( ASEntry inEntry, FILE * inFile, const FSSpec * ioSpec )
00126 {
00127     SInt16  refNum;
00128     OSErr err;
00129
00130     err = FSpOpenRF (ioSpec, fsWrPerm,  &refNum);
00131
00132     if ( err == noErr )
00133         err = asEntryToMacFile( inEntry, inFile, refNum );
00134
00135     FSClose( refNum );
00136     return err;
00137 }
00138
00139 static OSErr
00140 decodeComment( ASEntry inEntry, FILE * inFile, const FSSpec * ioSpec )
00141 {
00142     Str255 newComment;
00143     if ( inEntry.entryLength > 32 ) /* Max file name length for the Mac */
00144         return -1;
00145
00146     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00147         return -1 ;
00148
00149     if ( fread( &newComment[1], 1, inEntry.entryLength, inFile ) != inEntry.entryLength )
00150         return -1;
00151     newComment[0] = inEntry.entryLength;
00152
00153     return FSpDTSetComment(ioSpec, newComment);
00154 }
00155
00156 static OSErr
00157 decodeFinderInfo( ASEntry inEntry, FILE * inFile, const FSSpec * ioSpec )
00158 {
00159     ASFinderInfo info;
00160     OSErr err;
00161     Str31 name;
00162     CInfoPBRec pb;
00163
00164     if (inEntry.entryLength != sizeof( ASFinderInfo ))
00165         return -1;
00166
00167     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00168         return -1 ;
00169
00170     if ( fread( &info, 1, sizeof(info), inFile) != inEntry.entryLength )
00171         return -1;
00172
00173     err = FSpSetFInfo(ioSpec, &info.ioFlFndrInfo);
00174     if ( err != noErr )
00175         return -1;
00176
00177     memcpy(name, ioSpec->name, ioSpec->name[0] + 1);
00178     pb.hFileInfo.ioNamePtr = name;
00179     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00180     pb.hFileInfo.ioDirID = ioSpec->parID;
00181     pb.hFileInfo.ioFDirIndex = 0;   /* use ioNamePtr and ioDirID */
00182     err = PBGetCatInfoSync(&pb);
00183     if ( err != noErr )
00184         return err;
00185
00186     pb.hFileInfo.ioNamePtr = name;
00187     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00188     pb.hFileInfo.ioDirID = ioSpec->parID;
00189     pb.hFileInfo.ioFDirIndex = 0;   /* use ioNamePtr and ioDirID */
00190     pb.hFileInfo.ioFlXFndrInfo = info.ioFlXFndrInfo;
00191     err = PBSetCatInfoSync(&pb);
00192     return err;
00193 }
00194
00195 static OSErr
00196 decodeMacInfo( ASEntry inEntry, FILE * inFile, const FSSpec * ioSpec )
00197 {
00198     ASMacInfo info;
00199     OSErr err;
00200     Str31 name;
00201     CInfoPBRec pb;
00202
00203     if (inEntry.entryLength != sizeof( ASMacInfo ))
00204         return -1;
00205
00206     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00207         return -1 ;
00208
00209     if ( fread( &info, 1, sizeof(info), inFile) != inEntry.entryLength )
00210         return -1;
00211
00212     memcpy(name, ioSpec->name, ioSpec->name[0] + 1);
00213     pb.hFileInfo.ioNamePtr = name;
00214     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00215     pb.hFileInfo.ioDirID = ioSpec->parID;
00216     pb.hFileInfo.ioFDirIndex = 0;   /* use ioNamePtr and ioDirID */
00217     err = PBGetCatInfoSync(&pb);
00218     if ( err != noErr )
00219         return -1;
00220
00221     pb.hFileInfo.ioNamePtr = name;
00222     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00223     pb.hFileInfo.ioDirID = ioSpec->parID;
00224     pb.hFileInfo.ioFlAttrib = info.ioFlAttrib;
00225     err = PBSetCatInfoSync(&pb);
00226     return err;
00227 }
00228
00229 OSErr
00230 decodeFileDates( ASEntry inEntry, FILE * inFile, FSSpec * ioSpec )
00231 {
00232     ASFileDates dates;
00233     OSErr err;
00234     Str31 name;
00235     CInfoPBRec pb;
00236
00237     if ( inEntry.entryLength != sizeof(dates) ) /* Max file name length for the Mac */
00238         return -1;
00239
00240     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00241         return -1 ;
00242
00243     if ( fread( &dates, 1, inEntry.entryLength, inFile ) != inEntry.entryLength )
00244         return -1;
00245
00246     memcpy(name, ioSpec->name, ioSpec->name[0] + 1);
00247     pb.hFileInfo.ioNamePtr = name;
00248     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00249     pb.hFileInfo.ioDirID = ioSpec->parID;
00250     pb.hFileInfo.ioFDirIndex = 0;   /* use ioNamePtr and ioDirID */
00251     err = PBGetCatInfoSync(&pb);
00252     if ( err != noErr )
00253         return err;
00254 #define YR_2000_SECONDS 3029572800
00255     pb.hFileInfo.ioFlCrDat = dates.create + YR_2000_SECONDS;
00256     pb.hFileInfo.ioFlMdDat = dates.modify + YR_2000_SECONDS;
00257     pb.hFileInfo.ioFlBkDat = dates.backup + YR_2000_SECONDS;
00258     /* Not sure if mac has the last access time dates.access*/
00259
00260     memcpy(name, ioSpec->name, ioSpec->name[0] + 1);
00261     pb.hFileInfo.ioNamePtr = name;
00262     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00263     pb.hFileInfo.ioDirID = ioSpec->parID;
00264     pb.hFileInfo.ioFDirIndex = 0;   /* use ioNamePtr and ioDirID */
00265     err = PBSetCatInfoSync(&pb);
00266
00267     return err;
00268 }
00269
00270 OSErr
00271 decodeRealName( ASEntry inEntry, FILE * inFile, FSSpec * ioSpec )
00272 {
00273     Str255 newName;
00274     OSErr err;
00275
00276     if ( inEntry.entryLength > 32 ) /* Max file name length for the Mac */
00277         return -1;
00278
00279     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00280         return -1 ;
00281
00282     if ( fread( &newName[1], 1, inEntry.entryLength, inFile ) != inEntry.entryLength )
00283         return -1;
00284
00285     newName[0] = inEntry.entryLength;
00286     err =  FSpRename(ioSpec, newName);
00287
00288     if (err == noErr)
00289         memcpy( ioSpec->name, newName, 32 );
00290     return err;
00291
00292 }
00293
00294 static OSErr
00295 processASEntry( ASEntry inEntry, FILE * inFile, const FSSpec * ioSpec )
00296 {
00297     switch (inEntry.entryID)
00298     {
00299         case AS_DATA:
00300             return decodeDataFork( inEntry, inFile, ioSpec );
00301             break;
00302         case AS_RESOURCE:
00303             return decodeResourceFork( inEntry, inFile, ioSpec );
00304             break;
00305         case AS_REALNAME:
00306 //          return decodeRealName( inEntry, inFile, ioSpec );
00307             break;
00308         case AS_COMMENT:
00309             return decodeComment( inEntry, inFile, ioSpec );
00310             break;
00311         case AS_ICONBW:
00312 //          return decodeIconBW( inEntry, inFile, ioSpec );
00313             break;
00314         case AS_ICONCOLOR:
00315 //          return decodeIconColor( inEntry, inFile, ioSpec );
00316             break;
00317         case AS_FILEDATES:
00318 //          return decodeFileDates( inEntry, inFile, ioSpec );
00319             break;
00320         case AS_FINDERINFO:
00321             return decodeFinderInfo( inEntry, inFile, ioSpec );
00322             break;
00323         case AS_MACINFO:
00324             return decodeMacInfo( inEntry, inFile, ioSpec );
00325             break;
00326         case AS_PRODOSINFO:
00327         case AS_MSDOSINFO:
00328         case AS_AFPNAME:
00329         case AS_AFPINFO:
00330         case AS_AFPDIRID:
00331         default:
00332             return 0;
00333     }
00334     return 0;
00335 }
00336
00337 /* Decodes
00338  * Arguments:
00339  * inFile - name of the AppleSingle file
00340  * outSpec - destination. If destination is renamed (as part of decoding of realName)
00341  *          the outSpec is modified to represent the new name
00342  */
00343 OSErr
00344 decodeAppleSingle(const char * inFile, FSSpec * outSpec, long wantedEntries)
00345 {
00346     FILE * in;
00347     size_t  bytesRead;
00348     ASHeader header;
00349     OSErr err;
00350     int i;
00351
00352     in = fopen( inFile, "rb");
00353     if ( in == NULL )
00354         return fnfErr;
00355     /* Read in the header */
00356     {
00357         bytesRead = fread(&header, 1, sizeof(ASHeader),  in );
00358         if ( bytesRead != sizeof(ASHeader))
00359             goto fail;
00360         if ( header.magicNum != AS_MAGIC_NUM )
00361             goto fail;
00362         if ( header.versionNum != 0x00020000 )
00363             goto fail;
00364         if ( header.numEntries == 0 )   /* nothing in this file ? */
00365             goto fail;
00366     }
00367     /* Create the output file */
00368     FSpDelete( outSpec );   /* Preventive delete, not sure if we need it */
00369     err = FSpCreate( outSpec, AS_DEFAULT_CREATOR, AS_DEFAULT_TYPE, 0);
00370     if ( err != noErr )
00371         goto fail;
00372
00373     /* Loop through the entries, processing each */
00374     /* Set the time/date stamps last, because otherwise they'll be destroyed
00375        when we write */
00376     {
00377         Boolean hasDateEntry = false;
00378         ASEntry dateEntry;
00379         for ( i=0; i < header.numEntries; i++ )
00380         {
00381             ASEntry entry;
00382             size_t offset = sizeof( ASHeader ) + sizeof( ASEntry ) * i;
00383             if ( fseek( in, offset, SEEK_SET ) != 0 )
00384                 goto fail;
00385             if ( fread( &entry, 1, sizeof( entry ), in ) != sizeof( entry ))
00386                 goto fail;
00387             if ( wantedEntries & ( ((UInt32)1) << (entry.entryID - 1 )))
00388                 switch (entry.entryID)
00389                 {
00390                     case AS_DATA:
00391                         err = decodeDataFork( entry, in, outSpec );
00392                         break;
00393                     case AS_RESOURCE:
00394                         err = decodeResourceFork( entry, in, outSpec );
00395                         break;
00396                     case AS_REALNAME:
00397                         err = decodeRealName( entry, in, outSpec );
00398                         break;
00399                     case AS_COMMENT:
00400                         err = decodeComment( entry, in, outSpec );
00401                         break;
00402                     case AS_FILEDATES:
00403                     /* Save it for postprocessing */
00404                         hasDateEntry = true;
00405                         dateEntry = entry;
00406                         break;
00407                     case AS_FINDERINFO:
00408                         err = decodeFinderInfo( entry, in, outSpec );
00409                         break;
00410                     case AS_MACINFO:
00411                         err = decodeMacInfo( entry, in, outSpec );
00412                         break;
00413                     case AS_ICONBW:
00414                     case AS_ICONCOLOR:
00415                         fprintf(stderr, "Can't decode AS_ICONBW...");
00416                         break;
00417                     case AS_PRODOSINFO:
00418                     case AS_MSDOSINFO:
00419                     case AS_AFPNAME:
00420                     case AS_AFPINFO:
00421                     case AS_AFPDIRID:
00422                     default:
00423                         break;
00424                 }
00425             if ( err != 0)
00426                 break;
00427         }
00428         if ( hasDateEntry )
00429             err = processASEntry( dateEntry, in, outSpec );
00430     }
00431     fclose(in);
00432     in = NULL;
00433
00434     if ( err == noErr )
00435         return err;
00436     // else fall through failure
00437 fail:
00438     if (in)
00439         fclose(in);
00440     FSpDelete( outSpec);
00441     printf("AppleSingle decoding has failed: %s");
00442     return ioErr;
00443 }
00444
00445 OSErr
00446 encodeRealName(FILE * outfp, const FSSpec * inSpec )
00447 {
00448     if ( fwrite( &(inSpec->name[1]), 1, inSpec->name[0], outfp) < 0 )
00449         return ioErr;
00450     return noErr;
00451 }
00452
00453 OSErr
00454 encodeComment(FILE * outfp, Str255 comment )
00455 {
00456     if ( fwrite( &(comment[1]), 1, comment[0], outfp) < 0 )
00457         return ioErr;
00458     return noErr;
00459 }
00460
00461 OSErr
00462 encodeFileDates(FILE * outfp, const CInfoPBRec * pb)
00463 {
00464     ASFileDates dates;
00465 #define YR_2000_SECONDS 3029572800
00466     dates.create = pb->hFileInfo.ioFlCrDat - YR_2000_SECONDS;
00467     dates.modify = pb->hFileInfo.ioFlMdDat - YR_2000_SECONDS;
00468     dates.backup = pb->hFileInfo.ioFlBkDat - YR_2000_SECONDS;
00469     dates.access = 0;   /* Unknown on the mac */
00470     if ( fwrite( &dates, 1, sizeof(dates), outfp) < 0 )
00471         return ioErr;
00472     return noErr;
00473 }
00474
00475 OSErr
00476 encodeFinderInfo( FILE * outfp, const FSSpec * inSpec, const CInfoPBRec * pb)
00477 {
00478     ASFinderInfo info;
00479     OSErr err;
00480     err = FSpGetFInfo(inSpec, &info.ioFlFndrInfo);
00481     if (err != noErr )
00482         return err;
00483     info.ioFlXFndrInfo = pb->hFileInfo.ioFlXFndrInfo;
00484     if ( fwrite( &info, 1, sizeof(info), outfp) < 0 )
00485         return ioErr;
00486     return noErr;
00487 }
00488
00489 OSErr
00490 encodeMacInfo( FILE * outfp, const CInfoPBRec * pb )
00491 {
00492     ASMacInfo info;
00493     memset( &info, 0, sizeof(info));
00494     info.ioFlAttrib = pb->hFileInfo.ioFlAttrib;
00495     if ( fwrite( &info, 1, sizeof(info), outfp) < 0 )
00496         return ioErr;
00497     return noErr;
00498 }
00499
00500 OSErr
00501 macFileToFileStream( FILE * outfp, SInt16 refNum, UInt32 bytesExpected)
00502 {
00503 #define BUFFER_SIZE 8192
00504
00505     char buffer[BUFFER_SIZE];
00506     UInt32 totalRead = 0;
00507     SInt32 currentRead;
00508     OSErr err;
00509     while ( totalRead < bytesExpected )
00510     {
00511         currentRead = BUFFER_SIZE;
00512         err = FSRead( refNum, &currentRead, buffer);
00513         totalRead += currentRead;
00514         if ( err != noErr && ( totalRead < bytesExpected))
00515             return err;
00516         if ( fwrite( buffer, 1, currentRead, outfp) < 0)
00517             return -1;
00518     }
00519     return noErr;
00520 }
00521
00522 OSErr
00523 encodeDataFork( FILE * outfp, const FSSpec * inFile, UInt32 bytesExpected)
00524 {
00525     short refNum;
00526     OSErr err = noErr;
00527     err = FSpOpenDF (inFile, fsRdPerm,  &refNum);
00528     if (err != noErr )
00529         return err;
00530     err = macFileToFileStream( outfp, refNum, bytesExpected );
00531     FSClose( refNum );
00532     return err;
00533 }
00534
00535 OSErr
00536 encodeResourceFork( FILE * outfp, const FSSpec * inFile, UInt32 bytesExpected)
00537 {
00538     short refNum;
00539     OSErr err = noErr;
00540     err = FSpOpenRF (inFile, fsRdPerm,  &refNum);
00541     if (err != noErr )
00542         return err;
00543     err = macFileToFileStream( outfp, refNum, bytesExpected );
00544     FSClose( refNum );
00545     return err;
00546 }
00547
00548 /* Encodes the file as applesingle
00549  *
00550  * These are the possible parts that can be encoded as AppleSingle:
00551       Data Fork              1 Data fork
00552       Resource Fork          2 Resource fork
00553       Real Name              3 File's name as created on home file system
00554       Comment                4 Standard Macintosh comment
00555       File Dates Info        8 File creation date, modification date,
00556                                       and so on
00557       Finder Info            9 Standard Macintosh Finder information
00558       Macintosh File Info   10 Macintosh file information, attributes  and so on
00559   * This routine will encode all parts that are relevant (ex no data fork encoding if data fork length is 0
00560   */
00561 OSErr
00562 encodeAppleSingle(const FSSpec * inSpec, const char * outFile, long wantedEntries)
00563 {
00564     OSErr err;
00565     CInfoPBRec cbrec;
00566     FInfo fileinfo;
00567     Boolean needDataFork, needResourceFork, needRealName, needComment, needFileDates, needFinderInfo, needMacInfo;
00568     ASHeader header;
00569     ASEntry entry;
00570     UInt16 numEntries;
00571     FILE * outfp;
00572     Str255 comment;
00573     size_t availableOffset;
00574     Str255 temp;
00575     needDataFork = needResourceFork = needRealName = needComment
00576     = needFileDates = needFinderInfo = needMacInfo = false;
00577
00578     /* Figure out which parts of will we need to encode */
00579
00580     memcpy( temp, inSpec->name, inSpec->name[0] + 1);
00581     cbrec.hFileInfo.ioNamePtr = temp;
00582     cbrec.hFileInfo.ioDirID = inSpec->parID;
00583     cbrec.hFileInfo.ioVRefNum = inSpec->vRefNum;
00584     cbrec.hFileInfo.ioFDirIndex = 0;
00585
00586     err = PBGetCatInfoSync(&cbrec);
00587     if(err != noErr)
00588         goto fail;
00589
00590     if ( FSpDTGetComment( inSpec,comment) != noErr)
00591         comment[0] = 0;
00592
00593     needDataFork = (cbrec.hFileInfo.ioFlLgLen > 0)
00594                     && ( AS_DATA_BIT & wantedEntries) ; /* Data fork? */
00595     needResourceFork = (cbrec.hFileInfo.ioFlRLgLen > 0)
00596                     && ( AS_RESOURCE_BIT & wantedEntries ); /* Resource fork? */
00597     needComment = comment[0] != 0
00598                     && ( AS_COMMENT_BIT & wantedEntries );
00599     needRealName = (AS_REALNAME_BIT & wantedEntries) != 0;
00600     needFileDates = ( AS_FILEDATES_BIT & wantedEntries) != 0;
00601     needFinderInfo = ( AS_FINDERINFO_BIT & wantedEntries) != 0;
00602     needMacInfo = ( AS_MACINFO_BIT & wantedEntries) != 0;
00603
00604     /* The header */
00605     memset(&header, 0, sizeof(ASHeader));   /* for the filler bits */
00606     header.magicNum = AS_MAGIC_NUM;
00607     header.versionNum = 0x00020000;
00608     numEntries = 0;
00609     if ( needDataFork ) numEntries++;
00610     if ( needResourceFork ) numEntries++;
00611     if ( needRealName ) numEntries++;
00612     if ( needComment ) numEntries++;
00613     if ( needFileDates ) numEntries++;
00614     if ( needFinderInfo ) numEntries++;
00615     if ( needMacInfo ) numEntries++;
00616     header.numEntries = numEntries;
00617
00618     outfp = fopen(outFile, "wb");
00619     if ( outfp == NULL)
00620         goto fail;
00621
00622     /* write header */
00623     if ( fwrite( &header, 1, sizeof(ASHeader), outfp) < 0 )
00624         goto fail;
00625
00626     /* write out the entry headers */
00627     availableOffset = sizeof(ASHeader) + numEntries * sizeof(ASEntry);
00628
00629     if ( needRealName )
00630     {
00631         entry.entryID = AS_REALNAME;
00632         entry.entryOffset = availableOffset;
00633         entry.entryLength = inSpec->name[0];
00634         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00635             goto fail;
00636         availableOffset += entry.entryLength;
00637     }
00638     if ( needComment )
00639     {
00640         entry.entryID = AS_COMMENT;
00641         entry.entryOffset = availableOffset;
00642         entry.entryLength = comment[0];
00643         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00644             goto fail;
00645         availableOffset += entry.entryLength;
00646     }
00647     if ( needFileDates )
00648     {
00649         entry.entryID = AS_FILEDATES;
00650         entry.entryOffset = availableOffset;
00651         entry.entryLength = sizeof (ASFileDates );
00652         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00653             goto fail;
00654         availableOffset += entry.entryLength;
00655     }
00656     if ( needFinderInfo )
00657     {
00658         entry.entryID = AS_FINDERINFO;
00659         entry.entryOffset = availableOffset;
00660         entry.entryLength = sizeof (ASFinderInfo );
00661         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00662             goto fail;
00663         availableOffset += entry.entryLength;
00664     }
00665     if ( needMacInfo )
00666     {
00667         entry.entryID = AS_MACINFO;
00668         entry.entryOffset = availableOffset;
00669         entry.entryLength = sizeof (ASMacInfo );
00670         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00671             goto fail;
00672         availableOffset += entry.entryLength;
00673     }
00674     if ( needDataFork )
00675     {
00676         entry.entryID = AS_DATA;
00677         entry.entryOffset = availableOffset;
00678         entry.entryLength = cbrec.hFileInfo.ioFlLgLen;
00679         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00680             goto fail;
00681         availableOffset += entry.entryLength;
00682     }
00683     if ( needResourceFork )
00684     {
00685         entry.entryID = AS_RESOURCE;
00686         entry.entryOffset = availableOffset;
00687         entry.entryLength = cbrec.hFileInfo.ioFlRLgLen;
00688         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00689             goto fail;
00690         availableOffset += entry.entryLength;
00691     }
00692
00693     /* write out the entry data */
00694     if ( needRealName )
00695         if ( encodeRealName(outfp, inSpec) != noErr )
00696             goto fail;
00697     if ( needComment )
00698         if ( encodeComment(outfp, comment) != noErr )
00699             goto fail;
00700     if ( needFileDates )
00701         if ( encodeFileDates(outfp, &cbrec) != noErr )
00702             goto fail;
00703     if ( needFinderInfo )
00704         if ( encodeFinderInfo(outfp, inSpec, &cbrec) != noErr )
00705             goto fail;
00706     if ( needMacInfo )
00707         if ( encodeMacInfo( outfp, &cbrec ) != noErr )
00708             goto fail;
00709     if ( needDataFork )
00710         if ( encodeDataFork( outfp, inSpec, cbrec.hFileInfo.ioFlLgLen) != noErr )
00711             goto fail;
00712     if ( needResourceFork )
00713         if ( encodeResourceFork( outfp, inSpec, cbrec.hFileInfo.ioFlRLgLen ) != noErr )
00714             goto fail;
00715
00716     fclose(outfp);
00717     outfp = NULL;
00718     /* All done! */
00719     return noErr;
00720
00721 fail:
00722     if ( outfp )
00723         fclose(outfp);
00724     remove( outFile);
00725     if (err == noErr)
00726         err = ioErr;
00727     fprintf(stderr, "Unexpected AppleSingle encoding error %s\n", outFile );
00728     return err;
00729 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/apsingle.h Source File

cvs-1.10/macintosh/apsingle.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software
00003 */
00004
00005 /*
00006  * Author : Aleks Totic <atotic@netscape.com> --- April 1998
00007  */
00008
00009 #ifndef APSINGLE_H
00010 #define APSINGLE_H
00011
00012 #include <MacTypes.h>
00013 #include <Files.h>
00014
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018
00019 int
00020 convert_apsingle_file(const char *inFile, int inflags, const char *outFile, int outflags, int *bin);
00021
00022 /* Decodes
00023  * Arguments:
00024  * inFile - name of the AppleSingle file
00025  * outSpec - destination. If destination is renamed (as part of decoding of realName)
00026  *          the outSpec is modified to represent the new name
00027  * wantedEntries - a bitmask what entries do we want decoded. Bit positions correspond to entryIDs
00028  */
00029 OSErr
00030 decodeAppleSingle( const char * inFile, FSSpec * outSpec, long wantedEntries );
00031
00032 /*
00033  * Arguments:
00034  * inSpec - file to be encoded
00035  * outSpec - destination. If an error occurs during decoding, destination will be deleted!
00036  * wantedEntries - a bitmask what entries do we want encoded. Bit positions correspond to entryIDs
00037  */
00038 OSErr
00039 encodeAppleSingle( const FSSpec * inSpec, const char * outFile, long wantedEntries );
00040
00041 #define AS_MAGIC_NUM    0x00051600  /* Magic start of the file */
00042
00043 #define AS_DEFAULT_CREATOR 'MPS '
00044 #define AS_DEFAULT_TYPE '????'
00045
00046 /* entryIDs */
00047 #define AS_DATA         1 /* data fork */
00048 #define AS_RESOURCE     2 /* resource fork */
00049 #define AS_REALNAME     3 /* File's name on home file system */
00050 #define AS_COMMENT      4 /* standard Mac comment */
00051 #define AS_ICONBW       5 /* Mac black & white icon */
00052 #define AS_ICONCOLOR    6 /* Mac color icon */
00053       /*              7       /* not used */
00054 #define AS_FILEDATES    8 /* file dates; create, modify, etc */
00055 #define AS_FINDERINFO   9 /* Mac Finder info & extended info */
00056 #define AS_MACINFO      10 /* Mac file info, attributes, etc */
00057 #define AS_PRODOSINFO   11 /* Pro-DOS file info, attrib., etc */
00058 #define AS_MSDOSINFO    12 /* MS-DOS file info, attributes, etc */
00059 #define AS_AFPNAME      13 /* Short name on AFP server */
00060 #define AS_AFPINFO      14 /* AFP file info, attrib., etc */
00061 #define AS_AFPDIRID     15 /* AFP directory ID */
00062
00063 /* Because it seems that 1 << AS_FINDER_INFO operation works unreliably, I'll just define these
00064    as constants */
00065 #define AS_DATA_BIT         0x0001
00066 #define AS_RESOURCE_BIT     0x0002
00067 #define AS_REALNAME_BIT     0x0004
00068 #define AS_COMMENT_BIT      0x0008
00069 #define AS_ICONBW_BIT       0x0010
00070 #define AS_ICONCOLOR_BIT    0x0020
00071
00072 #define AS_FILEDATES_BIT    0x0080
00073 #define AS_FINDERINFO_BIT   0x0100
00074 #define AS_MACINFO_BIT      0x0200
00075 #define AS_PRODOSINFO_BIT   0x0400
00076 #define AS_MSDOSINFO_BIT    0x0800
00077 #define AS_AFPNAME_BIT      0x1000
00078 #define AS_AFPINFO_BIT      0x2000
00079 #define AS_AFPDIRID_BIT     0x4000
00080
00081 #ifdef __cplusplus
00082 }
00083 #endif
00084
00085 #endif /* APSINGLE_H */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


xgetwd.c File Reference

cvs-1.10/lib/xgetwd.c File Reference

#include "system.h"
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>

Include dependency graph for xgetwd.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | PATH_INCR 32

Functions

char * | xmalloc ()
char * | xrealloc ()
char * | xgetwd ()

Variables

int | errno

Define Documentation

#define PATH_INCR 32

Definition at line 32 of file xgetwd.c.

Function Documentation

char* xgetwd ( )

Definition at line 45 of file xgetwd.c.

00046 {
00047   char *cwd;
00048   char *ret;
00049   unsigned path_max;
00050
00051   errno = 0;
00052   path_max = (unsigned) PATH_MAX;
00053   path_max += 2;        /* The getcwd docs say to do this. */
00054
00055   cwd = xmalloc (path_max);
00056
00057   errno = 0;
00058   while ((ret = getcwd (cwd, path_max)) == NULL && errno == ERANGE)
00059     {
00060       path_max += PATH_INCR;
00061       cwd = xrealloc (cwd, path_max);
00062       errno = 0;
00063     }
00064
00065   if (ret == NULL)
00066     {
00067       int save_errno = errno;
00068       free (cwd);
00069       errno = save_errno;
00070       return NULL;
00071     }
00072   return cwd;
00073 }

char* xmalloc ( )

char* xrealloc ( )

Variable Documentation

int errno

Definition at line 27 of file xgetwd.c.

Generated on Sun Oct 21 12:43:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


yesno.c File Reference

cvs-1.10/lib/yesno.c File Reference

#include <stdio.h>

Include dependency graph for yesno.c:

Include dependency graph

Go to the source code of this file.

Functions

int yesno ()

Function Documentation

int yesno ( )

Definition at line 29 of file yesno.c.

00030 {
00031   int c;
00032   int rv;
00033
00034 #ifdef CVSGUI_SHL
00035     char *response;
00036
00037     printf("\n");
00038     dllglue_flushconsole();
00039     response = getenv("CVSLIB_YESNO");
00040     if(response != 0L)
00041         return strcmp(response, "yes") == 0;
00042 #endif /* CVSGUI_SHL */
00043 #ifdef CVSGUI_PIPE
00044     char *response;
00045
00046     cvs_output("\n", 1);
00047     response = getenv("CVSLIB_YESNO");
00048     if(response != 0L)
00049         return strcmp(response, "yes") == 0;
00050 #endif /* CVSGUI_PIPE*/
00051
00052   fflush (stderr);
00053   fflush (stdout);
00054   c = getchar ();
00055   rv = (c == 'y') || (c == 'Y');
00056   while (c != EOF && c != '\n')
00057     c = getchar ();
00058
00059   return rv;
00060 }

Generated on Sun Oct 21 12:43:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


apsingle.c File Reference

cvs-1.10/macintosh/apsingle.c File Reference

#include "apsingle.h"
#include <Finder.h>
#include <MacErrors.h>
#include <Resources.h>
#include <stdio.h>
#include <string.h>

Include dependency graph for apsingle.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | ASEntry
struct | ASFileDates
struct | ASFinderInfo
struct | ASHeader
struct | ASMacInfo

Defines

#define | BUFFER_SIZE 8192
#define | YR_2000_SECONDS 3029572800
#define | YR_2000_SECONDS 3029572800
#define | BUFFER_SIZE 8192

Typedefs

typedef ASHeader | ASHeader
typedef ASEntry | ASEntry
typedef ASFinderInfo | ASFinderInfo
typedef ASMacInfo | ASMacInfo
typedef ASFileDates | ASFileDates

Functions

OSErr | decodeFileDates (ASEntry inEntry, FILE *inFile, FSSpec *ioSpec)
OSErr | decodeRealName (ASEntry inEntry, FILE *inFile, FSSpec *ioSpec)
OSErr | encodeRealName (FILE *outfp, const FSSpec *inSpec)
OSErr | encodeComment (FILE *outfp, Str255 comment)
OSErr | encodeFileDates (FILE *outfp, const CInfoPBRec *pb)
OSErr | encodeFinderInfo (FILE *outfp, const FSSpec *inSpec, const CInfoPBRec *pb)
OSErr | encodeMacInfo (FILE *outfp, const CInfoPBRec *pb)
OSErr | macFileToFileStream (FILE *outfp, SInt16 refNum, UInt32 bytesExpected)
OSErr | encodeDataFork (FILE *outfp, const FSSpec *inFile, UInt32 bytesExpected)
OSErr | encodeResourceFork (FILE *outfp, const FSSpec *inFile, UInt32 bytesExpected)
OSErr | asEntryToMacFile (ASEntry inEntry, FILE *inFile, UInt16 inRefNum)
OSErr | decodeDataFork (ASEntry inEntry, FILE *inFile, const FSSpec *ioSpec)
OSErr | decodeResourceFork (ASEntry inEntry, FILE *inFile, const FSSpec *ioSpec)
OSErr | decodeComment (ASEntry inEntry, FILE *inFile, const FSSpec *ioSpec)
OSErr | decodeFinderInfo (ASEntry inEntry, FILE *inFile, const FSSpec *ioSpec)
OSErr | decodeMacInfo (ASEntry inEntry, FILE *inFile, const FSSpec *ioSpec)
OSErr | processASEntry (ASEntry inEntry, FILE *inFile, const FSSpec *ioSpec)
OSErr | decodeAppleSingle (const char *inFile, FSSpec *outSpec, long wantedEntries)
OSErr | encodeAppleSingle (const FSSpec *inSpec, const char *outFile, long wantedEntries)

Define Documentation

#define BUFFER_SIZE 8192

#define BUFFER_SIZE 8192

#define YR_2000_SECONDS 3029572800

#define YR_2000_SECONDS 3029572800

Typedef Documentation

typedef struct ASEntry ASEntry

typedef struct ASFileDates ASFileDates

typedef struct ASFinderInfo ASFinderInfo

typedef struct ASHeader ASHeader

typedef struct ASMacInfo ASMacInfo

Function Documentation

OSErr asEntryToMacFile | ( | ASEntry | inEntry,
 |  | FILE * | inFile,
 |  | UInt16 | inRefNum
 | ) | [static]

Definition at line 78 of file apsingle.c.

Referenced by decodeDataFork(), and decodeResourceFork().

00079 {
00080 #define BUFFER_SIZE 8192
00081
00082     char buffer[BUFFER_SIZE];
00083     size_t totalRead = 0, bytesRead;
00084     long bytesToWrite;
00085     OSErr err;
00086
00087     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00088         return -1 ;
00089
00090     while ( totalRead < inEntry.entryLength )
00091     {
00092 // Should we yield in here?
00093         bytesRead = fread( buffer, 1, BUFFER_SIZE, inFile );
00094         if ( bytesRead <= 0 )
00095             return ioErr;
00096         bytesToWrite = totalRead + bytesRead > inEntry.entryLength ?
00097                                     inEntry.entryLength - totalRead :
00098                                     bytesRead;
00099
00100         totalRead += bytesRead;
00101         err = FSWrite(inRefNum, &bytesToWrite, buffer);
00102         if (err != noErr)
00103             return err;
00104     }
00105     return 0;
00106 }

OSErr decodeAppleSingle | ( | const char * | inFile,
 |  | FSSpec * | outSpec,
 |  | long | wantedEntries
 | ) |

Definition at line 344 of file apsingle.c.

00345 {
00346     FILE * in;
00347     size_t  bytesRead;
00348     ASHeader header;
00349     OSErr err;
00350     int i;
00351
00352     in = fopen( inFile, "rb");
00353     if ( in == NULL )
00354         return fnfErr;
00355     /* Read in the header */
00356     {
00357         bytesRead = fread(&header, 1, sizeof(ASHeader),  in );
00358         if ( bytesRead != sizeof(ASHeader))
00359             goto fail;
00360         if ( header.magicNum != AS_MAGIC_NUM )
00361             goto fail;
00362         if ( header.versionNum != 0x00020000 )
00363             goto fail;
00364         if ( header.numEntries == 0 )   /* nothing in this file ? */
00365             goto fail;
00366     }
00367     /* Create the output file */
00368     FSpDelete( outSpec );   /* Preventive delete, not sure if we need it */
00369     err = FSpCreate( outSpec, AS_DEFAULT_CREATOR, AS_DEFAULT_TYPE, 0);
00370     if ( err != noErr )
00371         goto fail;
00372
00373     /* Loop through the entries, processing each */
00374     /* Set the time/date stamps last, because otherwise they'll be destroyed
00375        when we write */
00376     {
00377         Boolean hasDateEntry = false;
00378         ASEntry dateEntry;
00379         for ( i=0; i < header.numEntries; i++ )
00380         {
00381             ASEntry entry;
00382             size_t offset = sizeof( ASHeader ) + sizeof( ASEntry ) * i;
00383             if ( fseek( in, offset, SEEK_SET ) != 0 )
00384                 goto fail;
00385             if ( fread( &entry, 1, sizeof( entry ), in ) != sizeof( entry ))
00386                 goto fail;
00387             if ( wantedEntries & ( ((UInt32)1) << (entry.entryID - 1 )))
00388                 switch (entry.entryID)
00389                 {
00390                     case AS_DATA:
00391                         err = decodeDataFork( entry, in, outSpec );
00392                         break;
00393                     case AS_RESOURCE:
00394                         err = decodeResourceFork( entry, in, outSpec );
00395                         break;
00396                     case AS_REALNAME:
00397                         err = decodeRealName( entry, in, outSpec );
00398                         break;
00399                     case AS_COMMENT:
00400                         err = decodeComment( entry, in, outSpec );
00401                         break;
00402                     case AS_FILEDATES:
00403                     /* Save it for postprocessing */
00404                         hasDateEntry = true;
00405                         dateEntry = entry;
00406                         break;
00407                     case AS_FINDERINFO:
00408                         err = decodeFinderInfo( entry, in, outSpec );
00409                         break;
00410                     case AS_MACINFO:
00411                         err = decodeMacInfo( entry, in, outSpec );
00412                         break;
00413                     case AS_ICONBW:
00414                     case AS_ICONCOLOR:
00415                         fprintf(stderr, "Can't decode AS_ICONBW...");
00416                         break;
00417                     case AS_PRODOSINFO:
00418                     case AS_MSDOSINFO:
00419                     case AS_AFPNAME:
00420                     case AS_AFPINFO:
00421                     case AS_AFPDIRID:
00422                     default:
00423                         break;
00424                 }
00425             if ( err != 0)
00426                 break;
00427         }
00428         if ( hasDateEntry )
00429             err = processASEntry( dateEntry, in, outSpec );
00430     }
00431     fclose(in);
00432     in = NULL;
00433
00434     if ( err == noErr )
00435         return err;
00436     // else fall through failure
00437 fail:
00438     if (in)
00439         fclose(in);
00440     FSpDelete( outSpec);
00441     printf("AppleSingle decoding has failed: %s");
00442     return ioErr;
00443 }

OSErr decodeComment | ( | ASEntry | inEntry,
 |  | FILE * | inFile,
 |  | const FSSpec * | ioSpec
 | ) | [static]

Definition at line 140 of file apsingle.c.

Referenced by decodeAppleSingle(), and processASEntry().

00141 {
00142     Str255 newComment;
00143     if ( inEntry.entryLength > 32 ) /* Max file name length for the Mac */
00144         return -1;
00145
00146     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00147         return -1 ;
00148
00149     if ( fread( &newComment[1], 1, inEntry.entryLength, inFile ) != inEntry.entryLength )
00150         return -1;
00151     newComment[0] = inEntry.entryLength;
00152
00153     return FSpDTSetComment(ioSpec, newComment);
00154 }

OSErr decodeDataFork | ( | ASEntry | inEntry,
 |  | FILE * | inFile,
 |  | const FSSpec * | ioSpec
 | ) | [static]

Definition at line 109 of file apsingle.c.

Referenced by decodeAppleSingle(), and processASEntry().

00110 {
00111     SInt16  refNum;
00112     OSErr err;
00113
00114     /* Setup the files */
00115     err = FSpOpenDF (ioSpec, fsWrPerm,  &refNum);
00116
00117     if ( err == noErr )
00118         err = asEntryToMacFile( inEntry, inFile, refNum );
00119
00120     FSClose( refNum );
00121     return err;
00122 }

OSErr decodeFileDates | ( | ASEntry | inEntry,
 |  | FILE * | inFile,
 |  | FSSpec * | ioSpec
 | ) |

Definition at line 230 of file apsingle.c.

00231 {
00232     ASFileDates dates;
00233     OSErr err;
00234     Str31 name;
00235     CInfoPBRec pb;
00236
00237     if ( inEntry.entryLength != sizeof(dates) ) /* Max file name length for the Mac */
00238         return -1;
00239
00240     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00241         return -1 ;
00242
00243     if ( fread( &dates, 1, inEntry.entryLength, inFile ) != inEntry.entryLength )
00244         return -1;
00245
00246     memcpy(name, ioSpec->name, ioSpec->name[0] + 1);
00247     pb.hFileInfo.ioNamePtr = name;
00248     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00249     pb.hFileInfo.ioDirID = ioSpec->parID;
00250     pb.hFileInfo.ioFDirIndex = 0;   /* use ioNamePtr and ioDirID */
00251     err = PBGetCatInfoSync(&pb);
00252     if ( err != noErr )
00253         return err;
00254 #define YR_2000_SECONDS 3029572800
00255     pb.hFileInfo.ioFlCrDat = dates.create + YR_2000_SECONDS;
00256     pb.hFileInfo.ioFlMdDat = dates.modify + YR_2000_SECONDS;
00257     pb.hFileInfo.ioFlBkDat = dates.backup + YR_2000_SECONDS;
00258     /* Not sure if mac has the last access time dates.access*/
00259
00260     memcpy(name, ioSpec->name, ioSpec->name[0] + 1);
00261     pb.hFileInfo.ioNamePtr = name;
00262     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00263     pb.hFileInfo.ioDirID = ioSpec->parID;
00264     pb.hFileInfo.ioFDirIndex = 0;   /* use ioNamePtr and ioDirID */
00265     err = PBSetCatInfoSync(&pb);
00266
00267     return err;
00268 }

OSErr decodeFinderInfo | ( | ASEntry | inEntry,
 |  | FILE * | inFile,
 |  | const FSSpec * | ioSpec
 | ) | [static]

Definition at line 157 of file apsingle.c.

Referenced by decodeAppleSingle(), and processASEntry().

00158 {
00159     ASFinderInfo info;
00160     OSErr err;
00161     Str31 name;
00162     CInfoPBRec pb;
00163
00164     if (inEntry.entryLength != sizeof( ASFinderInfo ))
00165         return -1;
00166
00167     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00168         return -1 ;
00169
00170     if ( fread( &info, 1, sizeof(info), inFile) != inEntry.entryLength )
00171         return -1;
00172
00173     err = FSpSetFInfo(ioSpec, &info.ioFlFndrInfo);
00174     if ( err != noErr )
00175         return -1;
00176
00177     memcpy(name, ioSpec->name, ioSpec->name[0] + 1);
00178     pb.hFileInfo.ioNamePtr = name;
00179     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00180     pb.hFileInfo.ioDirID = ioSpec->parID;
00181     pb.hFileInfo.ioFDirIndex = 0;   /* use ioNamePtr and ioDirID */
00182     err = PBGetCatInfoSync(&pb);
00183     if ( err != noErr )
00184         return err;
00185
00186     pb.hFileInfo.ioNamePtr = name;
00187     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00188     pb.hFileInfo.ioDirID = ioSpec->parID;
00189     pb.hFileInfo.ioFDirIndex = 0;   /* use ioNamePtr and ioDirID */
00190     pb.hFileInfo.ioFlXFndrInfo = info.ioFlXFndrInfo;
00191     err = PBSetCatInfoSync(&pb);
00192     return err;
00193 }

OSErr decodeMacInfo | ( | ASEntry | inEntry,
 |  | FILE * | inFile,
 |  | const FSSpec * | ioSpec
 | ) | [static]

Definition at line 196 of file apsingle.c.

Referenced by decodeAppleSingle(), and processASEntry().

00197 {
00198     ASMacInfo info;
00199     OSErr err;
00200     Str31 name;
00201     CInfoPBRec pb;
00202
00203     if (inEntry.entryLength != sizeof( ASMacInfo ))
00204         return -1;
00205
00206     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00207         return -1 ;
00208
00209     if ( fread( &info, 1, sizeof(info), inFile) != inEntry.entryLength )
00210         return -1;
00211
00212     memcpy(name, ioSpec->name, ioSpec->name[0] + 1);
00213     pb.hFileInfo.ioNamePtr = name;
00214     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00215     pb.hFileInfo.ioDirID = ioSpec->parID;
00216     pb.hFileInfo.ioFDirIndex = 0;   /* use ioNamePtr and ioDirID */
00217     err = PBGetCatInfoSync(&pb);
00218     if ( err != noErr )
00219         return -1;
00220
00221     pb.hFileInfo.ioNamePtr = name;
00222     pb.hFileInfo.ioVRefNum = ioSpec->vRefNum;
00223     pb.hFileInfo.ioDirID = ioSpec->parID;
00224     pb.hFileInfo.ioFlAttrib = info.ioFlAttrib;
00225     err = PBSetCatInfoSync(&pb);
00226     return err;
00227 }

OSErr decodeRealName | ( | ASEntry | inEntry,
 |  | FILE * | inFile,
 |  | FSSpec * | ioSpec
 | ) |

Definition at line 271 of file apsingle.c.

Referenced by decodeAppleSingle().

00272 {
00273     Str255 newName;
00274     OSErr err;
00275
00276     if ( inEntry.entryLength > 32 ) /* Max file name length for the Mac */
00277         return -1;
00278
00279     if ( fseek( inFile, inEntry.entryOffset, SEEK_SET) != 0 )
00280         return -1 ;
00281
00282     if ( fread( &newName[1], 1, inEntry.entryLength, inFile ) != inEntry.entryLength )
00283         return -1;
00284
00285     newName[0] = inEntry.entryLength;
00286     err =  FSpRename(ioSpec, newName);
00287
00288     if (err == noErr)
00289         memcpy( ioSpec->name, newName, 32 );
00290     return err;
00291
00292 }

OSErr decodeResourceFork | ( | ASEntry | inEntry,
 |  | FILE * | inFile,
 |  | const FSSpec * | ioSpec
 | ) | [static]

Definition at line 125 of file apsingle.c.

Referenced by decodeAppleSingle(), and processASEntry().

00126 {
00127     SInt16  refNum;
00128     OSErr err;
00129
00130     err = FSpOpenRF (ioSpec, fsWrPerm,  &refNum);
00131
00132     if ( err == noErr )
00133         err = asEntryToMacFile( inEntry, inFile, refNum );
00134
00135     FSClose( refNum );
00136     return err;
00137 }

OSErr encodeAppleSingle | ( | const FSSpec * | inSpec,
 |  | const char * | outFile,
 |  | long | wantedEntries
 | ) |

Definition at line 562 of file apsingle.c.

00563 {
00564     OSErr err;
00565     CInfoPBRec cbrec;
00566     FInfo fileinfo;
00567     Boolean needDataFork, needResourceFork, needRealName, needComment, needFileDates, needFinderInfo, needMacInfo;
00568     ASHeader header;
00569     ASEntry entry;
00570     UInt16 numEntries;
00571     FILE * outfp;
00572     Str255 comment;
00573     size_t availableOffset;
00574     Str255 temp;
00575     needDataFork = needResourceFork = needRealName = needComment
00576     = needFileDates = needFinderInfo = needMacInfo = false;
00577
00578     /* Figure out which parts of will we need to encode */
00579
00580     memcpy( temp, inSpec->name, inSpec->name[0] + 1);
00581     cbrec.hFileInfo.ioNamePtr = temp;
00582     cbrec.hFileInfo.ioDirID = inSpec->parID;
00583     cbrec.hFileInfo.ioVRefNum = inSpec->vRefNum;
00584     cbrec.hFileInfo.ioFDirIndex = 0;
00585
00586     err = PBGetCatInfoSync(&cbrec);
00587     if(err != noErr)
00588         goto fail;
00589
00590     if ( FSpDTGetComment( inSpec,comment) != noErr)
00591         comment[0] = 0;
00592
00593     needDataFork = (cbrec.hFileInfo.ioFlLgLen > 0)
00594                     && ( AS_DATA_BIT & wantedEntries) ; /* Data fork? */
00595     needResourceFork = (cbrec.hFileInfo.ioFlRLgLen > 0)
00596                     && ( AS_RESOURCE_BIT & wantedEntries ); /* Resource fork? */
00597     needComment = comment[0] != 0
00598                     && ( AS_COMMENT_BIT & wantedEntries );
00599     needRealName = (AS_REALNAME_BIT & wantedEntries) != 0;
00600     needFileDates = ( AS_FILEDATES_BIT & wantedEntries) != 0;
00601     needFinderInfo = ( AS_FINDERINFO_BIT & wantedEntries) != 0;
00602     needMacInfo = ( AS_MACINFO_BIT & wantedEntries) != 0;
00603
00604     /* The header */
00605     memset(&header, 0, sizeof(ASHeader));   /* for the filler bits */
00606     header.magicNum = AS_MAGIC_NUM;
00607     header.versionNum = 0x00020000;
00608     numEntries = 0;
00609     if ( needDataFork ) numEntries++;
00610     if ( needResourceFork ) numEntries++;
00611     if ( needRealName ) numEntries++;
00612     if ( needComment ) numEntries++;
00613     if ( needFileDates ) numEntries++;
00614     if ( needFinderInfo ) numEntries++;
00615     if ( needMacInfo ) numEntries++;
00616     header.numEntries = numEntries;
00617
00618     outfp = fopen(outFile, "wb");
00619     if ( outfp == NULL)
00620         goto fail;
00621
00622     /* write header */
00623     if ( fwrite( &header, 1, sizeof(ASHeader), outfp) < 0 )
00624         goto fail;
00625
00626     /* write out the entry headers */
00627     availableOffset = sizeof(ASHeader) + numEntries * sizeof(ASEntry);
00628
00629     if ( needRealName )
00630     {
00631         entry.entryID = AS_REALNAME;
00632         entry.entryOffset = availableOffset;
00633         entry.entryLength = inSpec->name[0];
00634         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00635             goto fail;
00636         availableOffset += entry.entryLength;
00637     }
00638     if ( needComment )
00639     {
00640         entry.entryID = AS_COMMENT;
00641         entry.entryOffset = availableOffset;
00642         entry.entryLength = comment[0];
00643         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00644             goto fail;
00645         availableOffset += entry.entryLength;
00646     }
00647     if ( needFileDates )
00648     {
00649         entry.entryID = AS_FILEDATES;
00650         entry.entryOffset = availableOffset;
00651         entry.entryLength = sizeof (ASFileDates );
00652         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00653             goto fail;
00654         availableOffset += entry.entryLength;
00655     }
00656     if ( needFinderInfo )
00657     {
00658         entry.entryID = AS_FINDERINFO;
00659         entry.entryOffset = availableOffset;
00660         entry.entryLength = sizeof (ASFinderInfo );
00661         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00662             goto fail;
00663         availableOffset += entry.entryLength;
00664     }
00665     if ( needMacInfo )
00666     {
00667         entry.entryID = AS_MACINFO;
00668         entry.entryOffset = availableOffset;
00669         entry.entryLength = sizeof (ASMacInfo );
00670         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00671             goto fail;
00672         availableOffset += entry.entryLength;
00673     }
00674     if ( needDataFork )
00675     {
00676         entry.entryID = AS_DATA;
00677         entry.entryOffset = availableOffset;
00678         entry.entryLength = cbrec.hFileInfo.ioFlLgLen;
00679         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00680             goto fail;
00681         availableOffset += entry.entryLength;
00682     }
00683     if ( needResourceFork )
00684     {
00685         entry.entryID = AS_RESOURCE;
00686         entry.entryOffset = availableOffset;
00687         entry.entryLength = cbrec.hFileInfo.ioFlRLgLen;
00688         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00689             goto fail;
00690         availableOffset += entry.entryLength;
00691     }
00692
00693     /* write out the entry data */
00694     if ( needRealName )
00695         if ( encodeRealName(outfp, inSpec) != noErr )
00696             goto fail;
00697     if ( needComment )
00698         if ( encodeComment(outfp, comment) != noErr )
00699             goto fail;
00700     if ( needFileDates )
00701         if ( encodeFileDates(outfp, &cbrec) != noErr )
00702             goto fail;
00703     if ( needFinderInfo )
00704         if ( encodeFinderInfo(outfp, inSpec, &cbrec) != noErr )
00705             goto fail;
00706     if ( needMacInfo )
00707         if ( encodeMacInfo( outfp, &cbrec ) != noErr )
00708             goto fail;
00709     if ( needDataFork )
00710         if ( encodeDataFork( outfp, inSpec, cbrec.hFileInfo.ioFlLgLen) != noErr )
00711             goto fail;
00712     if ( needResourceFork )
00713         if ( encodeResourceFork( outfp, inSpec, cbrec.hFileInfo.ioFlRLgLen ) != noErr )
00714             goto fail;
00715
00716     fclose(outfp);
00717     outfp = NULL;
00718     /* All done! */
00719     return noErr;
00720
00721 fail:
00722     if ( outfp )
00723         fclose(outfp);
00724     remove( outFile);
00725     if (err == noErr)
00726         err = ioErr;
00727     fprintf(stderr, "Unexpected AppleSingle encoding error %s\n", outFile );
00728     return err;
00729 }

OSErr encodeComment | ( | FILE * | outfp,
 |  | Str255 | comment
 | ) |

Definition at line 454 of file apsingle.c.

Referenced by encodeAppleSingle().

00455 {
00456     if ( fwrite( &(comment[1]), 1, comment[0], outfp) < 0 )
00457         return ioErr;
00458     return noErr;
00459 }

OSErr encodeDataFork | ( | FILE * | outfp,
 |  | const FSSpec * | inFile,
 |  | UInt32 | bytesExpected
 | ) |

Definition at line 523 of file apsingle.c.

Referenced by encodeAppleSingle().

00524 {
00525     short refNum;
00526     OSErr err = noErr;
00527     err = FSpOpenDF (inFile, fsRdPerm,  &refNum);
00528     if (err != noErr )
00529         return err;
00530     err = macFileToFileStream( outfp, refNum, bytesExpected );
00531     FSClose( refNum );
00532     return err;
00533 }

OSErr encodeFileDates | ( | FILE * | outfp,
 |  | const CInfoPBRec * | pb
 | ) |

Definition at line 462 of file apsingle.c.

Referenced by encodeAppleSingle().

00463 {
00464     ASFileDates dates;
00465 #define YR_2000_SECONDS 3029572800
00466     dates.create = pb->hFileInfo.ioFlCrDat - YR_2000_SECONDS;
00467     dates.modify = pb->hFileInfo.ioFlMdDat - YR_2000_SECONDS;
00468     dates.backup = pb->hFileInfo.ioFlBkDat - YR_2000_SECONDS;
00469     dates.access = 0;   /* Unknown on the mac */
00470     if ( fwrite( &dates, 1, sizeof(dates), outfp) < 0 )
00471         return ioErr;
00472     return noErr;
00473 }

OSErr encodeFinderInfo | ( | FILE * | outfp,
 |  | const FSSpec * | inSpec,
 |  | const CInfoPBRec * | pb
 | ) |

Definition at line 476 of file apsingle.c.

Referenced by encodeAppleSingle().

00477 {
00478     ASFinderInfo info;
00479     OSErr err;
00480     err = FSpGetFInfo(inSpec, &info.ioFlFndrInfo);
00481     if (err != noErr )
00482         return err;
00483     info.ioFlXFndrInfo = pb->hFileInfo.ioFlXFndrInfo;
00484     if ( fwrite( &info, 1, sizeof(info), outfp) < 0 )
00485         return ioErr;
00486     return noErr;
00487 }

OSErr encodeMacInfo | ( | FILE * | outfp,
 |  | const CInfoPBRec * | pb
 | ) |

Definition at line 490 of file apsingle.c.

Referenced by encodeAppleSingle().

00491 {
00492     ASMacInfo info;
00493     memset( &info, 0, sizeof(info));
00494     info.ioFlAttrib = pb->hFileInfo.ioFlAttrib;
00495     if ( fwrite( &info, 1, sizeof(info), outfp) < 0 )
00496         return ioErr;
00497     return noErr;
00498 }

OSErr encodeRealName | ( | FILE * | outfp,
 |  | const FSSpec * | inSpec
 | ) |

Definition at line 446 of file apsingle.c.

Referenced by encodeAppleSingle().

00447 {
00448     if ( fwrite( &(inSpec->name[1]), 1, inSpec->name[0], outfp) < 0 )
00449         return ioErr;
00450     return noErr;
00451 }

OSErr encodeResourceFork | ( | FILE * | outfp,
 |  | const FSSpec * | inFile,
 |  | UInt32 | bytesExpected
 | ) |

Definition at line 536 of file apsingle.c.

Referenced by encodeAppleSingle().

00537 {
00538     short refNum;
00539     OSErr err = noErr;
00540     err = FSpOpenRF (inFile, fsRdPerm,  &refNum);
00541     if (err != noErr )
00542         return err;
00543     err = macFileToFileStream( outfp, refNum, bytesExpected );
00544     FSClose( refNum );
00545     return err;
00546 }

OSErr macFileToFileStream | ( | FILE * | outfp,
 |  | SInt16 | refNum,
 |  | UInt32 | bytesExpected
 | ) |

Definition at line 501 of file apsingle.c.

Referenced by encodeDataFork(), and encodeResourceFork().

00502 {
00503 #define BUFFER_SIZE 8192
00504
00505     char buffer[BUFFER_SIZE];
00506     UInt32 totalRead = 0;
00507     SInt32 currentRead;
00508     OSErr err;
00509     while ( totalRead < bytesExpected )
00510     {
00511         currentRead = BUFFER_SIZE;
00512         err = FSRead( refNum, &currentRead, buffer);
00513         totalRead += currentRead;
00514         if ( err != noErr && ( totalRead < bytesExpected))
00515             return err;
00516         if ( fwrite( buffer, 1, currentRead, outfp) < 0)
00517             return -1;
00518     }
00519     return noErr;
00520 }

OSErr processASEntry | ( | ASEntry | inEntry,
 |  | FILE * | inFile,
 |  | const FSSpec * | ioSpec
 | ) | [static]

Definition at line 295 of file apsingle.c.

Referenced by decodeAppleSingle().

00296 {
00297     switch (inEntry.entryID)
00298     {
00299         case AS_DATA:
00300             return decodeDataFork( inEntry, inFile, ioSpec );
00301             break;
00302         case AS_RESOURCE:
00303             return decodeResourceFork( inEntry, inFile, ioSpec );
00304             break;
00305         case AS_REALNAME:
00306 //          return decodeRealName( inEntry, inFile, ioSpec );
00307             break;
00308         case AS_COMMENT:
00309             return decodeComment( inEntry, inFile, ioSpec );
00310             break;
00311         case AS_ICONBW:
00312 //          return decodeIconBW( inEntry, inFile, ioSpec );
00313             break;
00314         case AS_ICONCOLOR:
00315 //          return decodeIconColor( inEntry, inFile, ioSpec );
00316             break;
00317         case AS_FILEDATES:
00318 //          return decodeFileDates( inEntry, inFile, ioSpec );
00319             break;
00320         case AS_FINDERINFO:
00321             return decodeFinderInfo( inEntry, inFile, ioSpec );
00322             break;
00323         case AS_MACINFO:
00324             return decodeMacInfo( inEntry, inFile, ioSpec );
00325             break;
00326         case AS_PRODOSINFO:
00327         case AS_MSDOSINFO:
00328         case AS_AFPNAME:
00329         case AS_AFPINFO:
00330         case AS_AFPDIRID:
00331         default:
00332             return 0;
00333     }
00334     return 0;
00335 }

Generated on Sun Oct 21 12:43:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


apsingle.h File Reference

cvs-1.10/macintosh/apsingle.h File Reference

#include <MacTypes.h>
#include <Files.h>

Include dependency graph for apsingle.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AS_MAGIC_NUM 0x00051600
#define | AS_DEFAULT_CREATOR 'MPS '
#define | AS_DEFAULT_TYPE '????'
#define | AS_DATA 1
#define | AS_RESOURCE 2
#define | AS_REALNAME 3
#define | AS_COMMENT 4
#define | AS_ICONBW 5
#define | AS_ICONCOLOR 6
#define | AS_FILEDATES 8
#define | AS_FINDERINFO 9
#define | AS_MACINFO 10
#define | AS_PRODOSINFO 11
#define | AS_MSDOSINFO 12
#define | AS_AFPNAME 13
#define | AS_AFPINFO 14
#define | AS_AFPDIRID 15
#define | AS_DATA_BIT 0x0001
#define | AS_RESOURCE_BIT 0x0002
#define | AS_REALNAME_BIT 0x0004
#define | AS_COMMENT_BIT 0x0008
#define | AS_ICONBW_BIT 0x0010
#define | AS_ICONCOLOR_BIT 0x0020
#define | AS_FILEDATES_BIT 0x0080
#define | AS_FINDERINFO_BIT 0x0100
#define | AS_MACINFO_BIT 0x0200
#define | AS_PRODOSINFO_BIT 0x0400
#define | AS_MSDOSINFO_BIT 0x0800
#define | AS_AFPNAME_BIT 0x1000
#define | AS_AFPINFO_BIT 0x2000
#define | AS_AFPDIRID_BIT 0x4000

Functions

int | convert_apsingle_file (const char *inFile, int inflags, const char *outFile, int outflags, int *bin)
OSErr | decodeAppleSingle (const char *inFile, FSSpec *outSpec, long wantedEntries)
OSErr | encodeAppleSingle (const FSSpec *inSpec, const char *outFile, long wantedEntries)

Define Documentation

#define AS_AFPDIRID 15

Definition at line 61 of file apsingle.h.

#define AS_AFPDIRID_BIT 0x4000

Definition at line 79 of file apsingle.h.

#define AS_AFPINFO 14

Definition at line 60 of file apsingle.h.

#define AS_AFPINFO_BIT 0x2000

Definition at line 78 of file apsingle.h.

#define AS_AFPNAME 13

Definition at line 59 of file apsingle.h.

#define AS_AFPNAME_BIT 0x1000

Definition at line 77 of file apsingle.h.

#define AS_COMMENT 4

Definition at line 50 of file apsingle.h.

#define AS_COMMENT_BIT 0x0008

Definition at line 68 of file apsingle.h.

#define AS_DATA 1

Definition at line 47 of file apsingle.h.

#define AS_DATA_BIT 0x0001

Definition at line 65 of file apsingle.h.

#define AS_DEFAULT_CREATOR 'MPS '

Definition at line 43 of file apsingle.h.

#define AS_DEFAULT_TYPE '????'

Definition at line 44 of file apsingle.h.

#define AS_FILEDATES 8

Definition at line 54 of file apsingle.h.

#define AS_FILEDATES_BIT 0x0080

Definition at line 72 of file apsingle.h.

#define AS_FINDERINFO 9

Definition at line 55 of file apsingle.h.

#define AS_FINDERINFO_BIT 0x0100

Definition at line 73 of file apsingle.h.

#define AS_ICONBW 5

Definition at line 51 of file apsingle.h.

#define AS_ICONBW_BIT 0x0010

Definition at line 69 of file apsingle.h.

#define AS_ICONCOLOR 6

Definition at line 52 of file apsingle.h.

#define AS_ICONCOLOR_BIT 0x0020

Definition at line 70 of file apsingle.h.

#define AS_MACINFO 10

Definition at line 56 of file apsingle.h.

#define AS_MACINFO_BIT 0x0200

Definition at line 74 of file apsingle.h.

#define AS_MAGIC_NUM 0x00051600

Definition at line 41 of file apsingle.h.

#define AS_MSDOSINFO 12

Definition at line 58 of file apsingle.h.

#define AS_MSDOSINFO_BIT 0x0800

Definition at line 76 of file apsingle.h.

#define AS_PRODOSINFO 11

Definition at line 57 of file apsingle.h.

#define AS_PRODOSINFO_BIT 0x0400

Definition at line 75 of file apsingle.h.

#define AS_REALNAME 3

Definition at line 49 of file apsingle.h.

#define AS_REALNAME_BIT 0x0004

Definition at line 67 of file apsingle.h.

#define AS_RESOURCE 2

Definition at line 48 of file apsingle.h.

#define AS_RESOURCE_BIT 0x0002

Definition at line 66 of file apsingle.h.

Function Documentation

int convert_apsingle_file | ( | const char * | inFile,
 |  | int | inflags,
 |  | const char * | outFile,
 |  | int | outflags,
 |  | int * | bin
 | ) |

OSErr decodeAppleSingle | ( | const char * | inFile,
 |  | FSSpec * | outSpec,
 |  | long | wantedEntries
 | ) |

Definition at line 344 of file apsingle.c.

Referenced by convert_hqx_file().

00345 {
00346     FILE * in;
00347     size_t  bytesRead;
00348     ASHeader header;
00349     OSErr err;
00350     int i;
00351
00352     in = fopen( inFile, "rb");
00353     if ( in == NULL )
00354         return fnfErr;
00355     /* Read in the header */
00356     {
00357         bytesRead = fread(&header, 1, sizeof(ASHeader),  in );
00358         if ( bytesRead != sizeof(ASHeader))
00359             goto fail;
00360         if ( header.magicNum != AS_MAGIC_NUM )
00361             goto fail;
00362         if ( header.versionNum != 0x00020000 )
00363             goto fail;
00364         if ( header.numEntries == 0 )   /* nothing in this file ? */
00365             goto fail;
00366     }
00367     /* Create the output file */
00368     FSpDelete( outSpec );   /* Preventive delete, not sure if we need it */
00369     err = FSpCreate( outSpec, AS_DEFAULT_CREATOR, AS_DEFAULT_TYPE, 0);
00370     if ( err != noErr )
00371         goto fail;
00372
00373     /* Loop through the entries, processing each */
00374     /* Set the time/date stamps last, because otherwise they'll be destroyed
00375        when we write */
00376     {
00377         Boolean hasDateEntry = false;
00378         ASEntry dateEntry;
00379         for ( i=0; i < header.numEntries; i++ )
00380         {
00381             ASEntry entry;
00382             size_t offset = sizeof( ASHeader ) + sizeof( ASEntry ) * i;
00383             if ( fseek( in, offset, SEEK_SET ) != 0 )
00384                 goto fail;
00385             if ( fread( &entry, 1, sizeof( entry ), in ) != sizeof( entry ))
00386                 goto fail;
00387             if ( wantedEntries & ( ((UInt32)1) << (entry.entryID - 1 )))
00388                 switch (entry.entryID)
00389                 {
00390                     case AS_DATA:
00391                         err = decodeDataFork( entry, in, outSpec );
00392                         break;
00393                     case AS_RESOURCE:
00394                         err = decodeResourceFork( entry, in, outSpec );
00395                         break;
00396                     case AS_REALNAME:
00397                         err = decodeRealName( entry, in, outSpec );
00398                         break;
00399                     case AS_COMMENT:
00400                         err = decodeComment( entry, in, outSpec );
00401                         break;
00402                     case AS_FILEDATES:
00403                     /* Save it for postprocessing */
00404                         hasDateEntry = true;
00405                         dateEntry = entry;
00406                         break;
00407                     case AS_FINDERINFO:
00408                         err = decodeFinderInfo( entry, in, outSpec );
00409                         break;
00410                     case AS_MACINFO:
00411                         err = decodeMacInfo( entry, in, outSpec );
00412                         break;
00413                     case AS_ICONBW:
00414                     case AS_ICONCOLOR:
00415                         fprintf(stderr, "Can't decode AS_ICONBW...");
00416                         break;
00417                     case AS_PRODOSINFO:
00418                     case AS_MSDOSINFO:
00419                     case AS_AFPNAME:
00420                     case AS_AFPINFO:
00421                     case AS_AFPDIRID:
00422                     default:
00423                         break;
00424                 }
00425             if ( err != 0)
00426                 break;
00427         }
00428         if ( hasDateEntry )
00429             err = processASEntry( dateEntry, in, outSpec );
00430     }
00431     fclose(in);
00432     in = NULL;
00433
00434     if ( err == noErr )
00435         return err;
00436     // else fall through failure
00437 fail:
00438     if (in)
00439         fclose(in);
00440     FSpDelete( outSpec);
00441     printf("AppleSingle decoding has failed: %s");
00442     return ioErr;
00443 }

OSErr encodeAppleSingle | ( | const FSSpec * | inSpec,
 |  | const char * | outFile,
 |  | long | wantedEntries
 | ) |

Definition at line 562 of file apsingle.c.

Referenced by convert_hqx_file().

00563 {
00564     OSErr err;
00565     CInfoPBRec cbrec;
00566     FInfo fileinfo;
00567     Boolean needDataFork, needResourceFork, needRealName, needComment, needFileDates, needFinderInfo, needMacInfo;
00568     ASHeader header;
00569     ASEntry entry;
00570     UInt16 numEntries;
00571     FILE * outfp;
00572     Str255 comment;
00573     size_t availableOffset;
00574     Str255 temp;
00575     needDataFork = needResourceFork = needRealName = needComment
00576     = needFileDates = needFinderInfo = needMacInfo = false;
00577
00578     /* Figure out which parts of will we need to encode */
00579
00580     memcpy( temp, inSpec->name, inSpec->name[0] + 1);
00581     cbrec.hFileInfo.ioNamePtr = temp;
00582     cbrec.hFileInfo.ioDirID = inSpec->parID;
00583     cbrec.hFileInfo.ioVRefNum = inSpec->vRefNum;
00584     cbrec.hFileInfo.ioFDirIndex = 0;
00585
00586     err = PBGetCatInfoSync(&cbrec);
00587     if(err != noErr)
00588         goto fail;
00589
00590     if ( FSpDTGetComment( inSpec,comment) != noErr)
00591         comment[0] = 0;
00592
00593     needDataFork = (cbrec.hFileInfo.ioFlLgLen > 0)
00594                     && ( AS_DATA_BIT & wantedEntries) ; /* Data fork? */
00595     needResourceFork = (cbrec.hFileInfo.ioFlRLgLen > 0)
00596                     && ( AS_RESOURCE_BIT & wantedEntries ); /* Resource fork? */
00597     needComment = comment[0] != 0
00598                     && ( AS_COMMENT_BIT & wantedEntries );
00599     needRealName = (AS_REALNAME_BIT & wantedEntries) != 0;
00600     needFileDates = ( AS_FILEDATES_BIT & wantedEntries) != 0;
00601     needFinderInfo = ( AS_FINDERINFO_BIT & wantedEntries) != 0;
00602     needMacInfo = ( AS_MACINFO_BIT & wantedEntries) != 0;
00603
00604     /* The header */
00605     memset(&header, 0, sizeof(ASHeader));   /* for the filler bits */
00606     header.magicNum = AS_MAGIC_NUM;
00607     header.versionNum = 0x00020000;
00608     numEntries = 0;
00609     if ( needDataFork ) numEntries++;
00610     if ( needResourceFork ) numEntries++;
00611     if ( needRealName ) numEntries++;
00612     if ( needComment ) numEntries++;
00613     if ( needFileDates ) numEntries++;
00614     if ( needFinderInfo ) numEntries++;
00615     if ( needMacInfo ) numEntries++;
00616     header.numEntries = numEntries;
00617
00618     outfp = fopen(outFile, "wb");
00619     if ( outfp == NULL)
00620         goto fail;
00621
00622     /* write header */
00623     if ( fwrite( &header, 1, sizeof(ASHeader), outfp) < 0 )
00624         goto fail;
00625
00626     /* write out the entry headers */
00627     availableOffset = sizeof(ASHeader) + numEntries * sizeof(ASEntry);
00628
00629     if ( needRealName )
00630     {
00631         entry.entryID = AS_REALNAME;
00632         entry.entryOffset = availableOffset;
00633         entry.entryLength = inSpec->name[0];
00634         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00635             goto fail;
00636         availableOffset += entry.entryLength;
00637     }
00638     if ( needComment )
00639     {
00640         entry.entryID = AS_COMMENT;
00641         entry.entryOffset = availableOffset;
00642         entry.entryLength = comment[0];
00643         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00644             goto fail;
00645         availableOffset += entry.entryLength;
00646     }
00647     if ( needFileDates )
00648     {
00649         entry.entryID = AS_FILEDATES;
00650         entry.entryOffset = availableOffset;
00651         entry.entryLength = sizeof (ASFileDates );
00652         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00653             goto fail;
00654         availableOffset += entry.entryLength;
00655     }
00656     if ( needFinderInfo )
00657     {
00658         entry.entryID = AS_FINDERINFO;
00659         entry.entryOffset = availableOffset;
00660         entry.entryLength = sizeof (ASFinderInfo );
00661         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00662             goto fail;
00663         availableOffset += entry.entryLength;
00664     }
00665     if ( needMacInfo )
00666     {
00667         entry.entryID = AS_MACINFO;
00668         entry.entryOffset = availableOffset;
00669         entry.entryLength = sizeof (ASMacInfo );
00670         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00671             goto fail;
00672         availableOffset += entry.entryLength;
00673     }
00674     if ( needDataFork )
00675     {
00676         entry.entryID = AS_DATA;
00677         entry.entryOffset = availableOffset;
00678         entry.entryLength = cbrec.hFileInfo.ioFlLgLen;
00679         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00680             goto fail;
00681         availableOffset += entry.entryLength;
00682     }
00683     if ( needResourceFork )
00684     {
00685         entry.entryID = AS_RESOURCE;
00686         entry.entryOffset = availableOffset;
00687         entry.entryLength = cbrec.hFileInfo.ioFlRLgLen;
00688         if ( fwrite( &entry, 1, sizeof(ASEntry), outfp) < 0 )
00689             goto fail;
00690         availableOffset += entry.entryLength;
00691     }
00692
00693     /* write out the entry data */
00694     if ( needRealName )
00695         if ( encodeRealName(outfp, inSpec) != noErr )
00696             goto fail;
00697     if ( needComment )
00698         if ( encodeComment(outfp, comment) != noErr )
00699             goto fail;
00700     if ( needFileDates )
00701         if ( encodeFileDates(outfp, &cbrec) != noErr )
00702             goto fail;
00703     if ( needFinderInfo )
00704         if ( encodeFinderInfo(outfp, inSpec, &cbrec) != noErr )
00705             goto fail;
00706     if ( needMacInfo )
00707         if ( encodeMacInfo( outfp, &cbrec ) != noErr )
00708             goto fail;
00709     if ( needDataFork )
00710         if ( encodeDataFork( outfp, inSpec, cbrec.hFileInfo.ioFlLgLen) != noErr )
00711             goto fail;
00712     if ( needResourceFork )
00713         if ( encodeResourceFork( outfp, inSpec, cbrec.hFileInfo.ioFlRLgLen ) != noErr )
00714             goto fail;
00715
00716     fclose(outfp);
00717     outfp = NULL;
00718     /* All done! */
00719     return noErr;
00720
00721 fail:
00722     if ( outfp )
00723         fclose(outfp);
00724     remove( outFile);
00725     if (err == noErr)
00726         err = ioErr;
00727     fprintf(stderr, "Unexpected AppleSingle encoding error %s\n", outFile );
00728     return err;
00729 }

Generated on Sun Oct 21 12:43:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


config.h File Reference

cvs-1.10/macintosh/config.h File Reference

#include <ansi_parms.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

Include dependency graph for config.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | O_BINARY 0x8000
#define | ENUMS_CAN_BE_TROUBLE 1
#define | NO_CLIENT_GZIP_PROCESS 1
#define | BROKEN_READWRITE_CONVERSION 1
#define | DONT_USE_PATCH 1
#define | HAVE_LONG_FILE_NAMES 1
#define | HAVE_ST_BLKSIZE 1
#define | HAVE_UTIME_NULL 1
#define | RETSIGTYPE void
#define | STDC_HEADERS 1
#define | TIME_WITH_SYS_TIME 1
#define | CLIENT_SUPPORT 1
#define | HAVE_CONNECT
#define | _REGEX_RE_COMP 1
#define | HAVE_FSYNC 1
#define | HAVE_FTIME 1
#define | HAVE_FTRUNCATE 1
#define | HAVE_READLINK 1
#define | HAVE_SIGACTION 1
#define | HAVE_SIGPROCMASK 1
#define | HAVE_VPRINTF 1
#define | HAVE_DIRENT_H 1
#define | HAVE_ERRNO_H 1
#define | HAVE_FCNTL_H 1
#define | HAVE_LIMITS_H 1
#define | HAVE_STRING_H 1
#define | HAVE_SYS_TIME_H 1
#define | HAVE_UNISTD_H 1
#define | HAVE_UTIME_H 1
#define | CVS_MKDIR macos_mkdir
#define | mkdir macos_mkdir
#define | CVS_OPEN macos_open
#define | open macos_open
#define | CVS_CREAT macos_creat
#define | creat macos_creat
#define | CVS_FOPEN macos_fopen
#define | fopen macos_fopen
#define | CVS_CHDIR macos_chdir
#define | chdir macos_chdir
#define | CVS_ACCESS macos_access
#define | access macos_access
#define | CVS_OPENDIR macos_opendir
#define | opendir macos_opendir
#define | CVS_STAT macos_stat
#define | stat(a, b) macos_stat(a,b)
#define | CVS_RENAME macos_rename
#define | rename macos_rename
#define | CVS_RMDIR macos_rmdir
#define | rmdir macos_rmdir
#define | CVS_UNLINK macos_unlink
#define | unlink macos_unlink
#define | CVS_CHMOD macos_chmod
#define | chmod macos_chmod
#define | CVS_LSTAT macos_lstat
#define | lstat macos_lstat
#define | USE_PROTOTYPES 1
#define | fncmp strcmp
#define | RSH_NOT_TRANSPARENT 1
#define | START_SERVER macos_start_server
#define | SHUTDOWN_SERVER macos_shutdown_server
#define | SYSTEM_CLEANUP macos_cleanup
#define | SYSTEM_INITIALIZE macos_initialize
#define | BINHEX_STUFF
#define | DIRTY_MODDATE
#define | DO_NOT_LOCK_DIRTY
#define | STRATA_HACK

Functions

int | macos_rmdir (const char *)
int | macos_rename (const char *, const char *)
int | macos_stat (const char *, struct stat *)
int | macos_lstat (const char *, struct stat *)
DIR * | macos_opendir (const char *)
int | macos_access (const char *, int)
int | macos_chdir (const char *path)
FILE * | macos_fopen (const char *path, const char *mode)
int | macos_creat (const char *path, mode_t mode)
int | macos_open (const char *path, int oflag,...)
int | macos_mkdir (const char *path, int oflag)
int | macos_unlink (const char *)
int | macos_chmod (const char *path, mode_t mode)
passwd * | getpwnam (char *name)
pid_t | getpid (void)
void | macos_start_server (int *tofd, int *fromfd, char *client_user, char *server_user, char *server_host, char *server_cvsroot)
void | macos_shutdown_server (int to)
void | macos_cleanup (void)
void | macos_initialize (int *argc, char ***argv)

Define Documentation

#define BINHEX_STUFF

Definition at line 413 of file config.h.

#define BROKEN_READWRITE_CONVERSION 1

Definition at line 50 of file config.h.

#define CLIENT_SUPPORT 1

Definition at line 106 of file config.h.

#define CVS_ACCESS macos_access

Definition at line 337 of file config.h.

#define CVS_CHDIR macos_chdir

Definition at line 335 of file config.h.

#define CVS_CHMOD macos_chmod

Definition at line 349 of file config.h.

#define CVS_CREAT macos_creat

Definition at line 331 of file config.h.

#define CVS_FOPEN macos_fopen

Definition at line 333 of file config.h.

#define CVS_LSTAT macos_lstat

Definition at line 351 of file config.h.

#define CVS_MKDIR macos_mkdir

Definition at line 327 of file config.h.

#define CVS_OPEN macos_open

Definition at line 329 of file config.h.

#define CVS_OPENDIR macos_opendir

Definition at line 339 of file config.h.

#define CVS_RENAME macos_rename

Definition at line 343 of file config.h.

#define CVS_RMDIR macos_rmdir

Definition at line 345 of file config.h.

#define CVS_STAT macos_stat

Definition at line 341 of file config.h.

#define CVS_UNLINK macos_unlink

Definition at line 347 of file config.h.

#define DIRTY_MODDATE

Definition at line 416 of file config.h.

#define DONT_USE_PATCH 1

Definition at line 53 of file config.h.

#define DO_NOT_LOCK_DIRTY

Definition at line 417 of file config.h.

#define ENUMS_CAN_BE_TROUBLE 1

Definition at line 43 of file config.h.

#define HAVE_CONNECT

Definition at line 119 of file config.h.

#define HAVE_DIRENT_H 1

Definition at line 226 of file config.h.

#define HAVE_ERRNO_H 1

Definition at line 229 of file config.h.

#define HAVE_FCNTL_H 1

Definition at line 232 of file config.h.

#define HAVE_FSYNC 1

Definition at line 163 of file config.h.

#define HAVE_FTIME 1

Definition at line 166 of file config.h.

#define HAVE_FTRUNCATE 1

Definition at line 169 of file config.h.

#define HAVE_LIMITS_H 1

Definition at line 247 of file config.h.

#define HAVE_LONG_FILE_NAMES 1

Definition at line 59 of file config.h.

#define HAVE_READLINK 1

Definition at line 190 of file config.h.

#define HAVE_SIGACTION 1

Definition at line 193 of file config.h.

#define HAVE_SIGPROCMASK 1

Definition at line 199 of file config.h.

#define HAVE_STRING_H 1

Definition at line 259 of file config.h.

#define HAVE_ST_BLKSIZE 1

Definition at line 62 of file config.h.

#define HAVE_SYS_TIME_H 1

Definition at line 283 of file config.h.

#define HAVE_UNISTD_H 1

Definition at line 289 of file config.h.

#define HAVE_UTIME_H 1

Definition at line 292 of file config.h.

#define HAVE_UTIME_NULL 1

Definition at line 68 of file config.h.

#define HAVE_VPRINTF 1

Definition at line 217 of file config.h.

#define NO_CLIENT_GZIP_PROCESS 1

Definition at line 47 of file config.h.

#define O_BINARY 0x8000

Definition at line 14 of file config.h.

#define RETSIGTYPE void

Definition at line 84 of file config.h.

#define RSH_NOT_TRANSPARENT 1

Definition at line 388 of file config.h.

#define SHUTDOWN_SERVER macos_shutdown_server

Definition at line 391 of file config.h.

#define START_SERVER macos_start_server

Definition at line 390 of file config.h.

#define STDC_HEADERS 1

Definition at line 90 of file config.h.

#define STRATA_HACK

Definition at line 420 of file config.h.

#define SYSTEM_CLEANUP macos_cleanup

Definition at line 392 of file config.h.

Referenced by error_exit(), and root_allow_size().

#define SYSTEM_INITIALIZE macos_initialize

Definition at line 393 of file config.h.

#define TIME_WITH_SYS_TIME 1

Definition at line 93 of file config.h.

#define USE_PROTOTYPES 1

Definition at line 381 of file config.h.

#define _REGEX_RE_COMP 1

Definition at line 151 of file config.h.

#define access macos_access

Definition at line 338 of file config.h.

Referenced by macos_access().

#define chdir macos_chdir

Definition at line 336 of file config.h.

Referenced by CompatMoveToTrash(), FileTraverse(), FillBuffer(), CBrowseFileView::GetEntriesModTime(), UCvsFiles::GetEntriesModTime(), CWincvsApp::InitInstance(), TViewFill::OnDirectory(), CBrowseFileView::OnViewUpone(), dllglue_main(), glue_getenv(), launchCVS(), and macos_chdir().

#define chmod macos_chmod

Definition at line 350 of file config.h.

Referenced by UCvsFiles::OnCmdTrash(), convert_file(), macos_chmod(), and macos_unlink().

#define creat macos_creat

Definition at line 332 of file config.h.

Referenced by macos_creat().

#define fncmp strcmp

Definition at line 385 of file config.h.

#define fopen macos_fopen

Definition at line 334 of file config.h.

Referenced by CTipDlg::CTipDlg(), CompatGetEditorMsg(), CPython_Interp::DoFile(), Entries_Open(), FillBuffer(), CPersistent::LoadAll(), MakeTmpFile(), MacroTraversal::OnFile(), ReadIgnoredFile(), CPersistent::SaveAll(), CPersistent::SaveAllSettings(), SccInitialize(), Tag_Open(), convert_file(), convert_hqx_file(), decodeAppleSingle(), encodeAppleSingle(), CRevisionConsole::init(), launchCVS(), loadSettingsInternal(), macos_fopen(), main(), run_popen(), and simple_diff().

#define lstat macos_lstat

Definition at line 352 of file config.h.

#define mkdir macos_mkdir

Definition at line 328 of file config.h.

Referenced by SettingsGetLoc(), macos_mkdir(), os2_mkdir(), and wnt_mkdir().

#define open macos_open

Definition at line 330 of file config.h.

Referenced by macos_open().

#define opendir macos_opendir

Definition at line 340 of file config.h.

Referenced by FileTraverse(), dirdata(), and macos_opendir().

#define rename macos_rename

Definition at line 344 of file config.h.

Referenced by CPersistent::SaveAllSettings(), and macos_rename().

#define rmdir macos_rmdir

Definition at line 346 of file config.h.

Referenced by macos_rmdir().

#define stat | ( | a,
 |  | b | ) | macos_stat(a,b)

Definition at line 342 of file config.h.

Referenced by BuildIgnoredList(), CBrowseFileView::EditSel(), Entries_SetVisited(), FileTraverse(), CBrowseFileView::GetEntriesModTime(), UCvsFiles::GetEntriesModTime(), CWincvsApp::InitInstance(), LaunchViewer(), CWincvsApp::LookForResourceFile(), MakeTmpFile(), CWinCvsBrowser::OnUpdateCmd(), UCvsFolders::OnUpdateGeneric(), CWinCvsBrowser::ResetBrowser(), UCvsFolders::ResetBrowser(), UCvsFolders::SetDefaultRoot(), CHistComboBoxEx::SetIcon(), CGraphDoc::SetNode(), SettingsGetLoc(), TestFileIsAlias(), UCvsGraph::UCvsGraph(), CvsPrefs::WhichCvs(), RemoveCvsArgs::addfile(), depth(), getLoc(), launchCVS(), and macos_stat().

#define unlink macos_unlink

Definition at line 348 of file config.h.

Referenced by CvsLogParse(), CPersistent::SaveAllSettings(), close_consoles(), macos_unlink(), to(), and CTmpFiles::~CTmpFiles().

Function Documentation

pid_t getpid ( void )

Definition at line 32 of file pwd.c.

Referenced by lstat().

00032 { return 0; }                   /* getpid */

struct passwd* getpwnam ( char * name )

Definition at line 50 of file pwd.c.

00050 { return (struct passwd *) 0; }

int macos_access | ( | const char * | path,
 |  | int | amode
 | ) |

Definition at line 256 of file macos_filesys.c.

00257 {
00258     int res = access( macos_fixpath(path), amode );
00259     TRACE((stderr, "access %s %x -> %d", macos_fixpath(path), amode, res));
00260     return res;
00261 }

int macos_chdir ( const char * path )

Definition at line 237 of file macos_filesys.c.

00238 {
00239     int r;
00240     char    *macPath;
00241
00242     macPath = macos_fixpath(path);
00243
00244     r = chdir(macPath);
00245     TRACE((stderr, "chdir %s -> %d", macPath, r));
00246     if( r < 0 )
00247     {
00248         r = chdir(macPath+1);
00249         TRACE((stderr, "chdir %s -> %d", macPath+1, r));
00250     }
00251
00252     return r;
00253 }

int macos_chmod | ( | const char * | path,
 |  | mode_t | mode
 | ) |

Definition at line 205 of file macos_filesys.c.

00206 {
00207     int res = chmod(macos_fixpath(path), mode);
00208     TRACE((stderr, "chmod %s %x -> %d", macos_fixpath(path), mode, res));
00209     return res;
00210 }

void macos_cleanup ( void )

Definition at line 36 of file mac_run.c.

Referenced by SYSTEM_INITIALIZE().

00037 {
00038     int i;
00039     for(i = 0; i < _close_on_exec_num; i++)
00040         close(_close_on_exec_list[i]);
00041     GUSIwithoutLSHSockets();
00042
00043 }

int macos_creat | ( | const char * | path,
 |  | mode_t | mode
 | ) |

Definition at line 213 of file macos_filesys.c.

00214 {
00215     int res = creat( macos_fixpath(path) );
00216     TRACE((stderr, "creat %s -> %d", macos_fixpath(path), res));
00217     return res;
00218 }

FILE* macos_fopen | ( | const char * | path,
 |  | const char * | mode
 | ) |

Definition at line 221 of file macos_filesys.c.

00222 {
00223     FILE    *fp;
00224
00225     fp = fopen(macos_fixpath(path), mode);
00226
00227     TRACE((stderr, "fopen %s %x -> %d", macos_fixpath(path), mode, fp != 0L));
00228
00229     /* I'm getting ENOTDIR, CVS expects ENOENT */
00230
00231     if( (fp == NULL) && (errno == ENOTDIR) ) errno = ENOENT;
00232
00233     return fp;
00234 }

void macos_initialize | ( | int * | argc,
 |  | char *** | argv
 | ) |

Definition at line 45 of file mac_run.c.

00046 {
00047     GUSIwithLSHSockets();
00048 }

int macos_lstat | ( | const char * | path,
 |  | struct stat * | ststr
 | ) |

Definition at line 280 of file macos_filesys.c.

00281 {
00282     int res = lstat( macos_fixpath(path), ststr );
00283     TRACE((stderr, "lstat %s -> %d", macos_fixpath(path), res));
00284     return res;
00285 }

int macos_mkdir | ( | const char * | path,
 |  | int | oflag
 | ) |

Definition at line 178 of file macos_filesys.c.

00179 {
00180     int res = mkdir( macos_fixpath(path) );
00181     TRACE((stderr, "mkdir %s -> %d", macos_fixpath(path), res));
00182     return res;
00183 }

int macos_open | ( | const char * | path,
 |  | int | oflag,
 |  | ... |
 | ) |

Definition at line 186 of file macos_filesys.c.

00187 {
00188     int r;
00189     char    *macPath;
00190
00191     macPath = macos_fixpath(path);
00192
00193     r = open( macPath, oflag );
00194     TRACE((stderr, "open %s -> %d", macPath, r));
00195     if( r < 0 )
00196     {
00197         r = open( macPath+1, oflag );
00198         TRACE((stderr, "open %s -> %d", macPath + 1, r));
00199     }
00200
00201     return r;
00202 }

DIR* macos_opendir ( const char * path )

Definition at line 264 of file macos_filesys.c.

00265 {
00266     DIR *res = opendir( macos_fixpath(path) );
00267     TRACE((stderr, "opendir %s -> %d", macos_fixpath(path), res != 0L));
00268     return res;
00269 }

int macos_rename | ( | const char * | path,
 |  | const char * | newpath
 | ) |

Definition at line 288 of file macos_filesys.c.

00289 {
00290     char    macPath_from[1024], macPath_to[1024];
00291     int res;
00292
00293     strcpy( macPath_from, macos_fixpath(path) );
00294     strcpy( macPath_to, macos_fixpath(newpath) );
00295
00296     res = rename( macPath_from, macPath_to );
00297     TRACE((stderr, "rename %s %s -> %d", macPath_from, macPath_to, res));
00298     return res;
00299 }

int macos_rmdir ( const char * path )

Definition at line 302 of file macos_filesys.c.

00303 {
00304     int res = rmdir( macos_fixpath(path) );
00305     TRACE((stderr, "rmdir %s -> %d", macos_fixpath(path), res));
00306     return res;
00307 }

void macos_shutdown_server ( int to_server )

Definition at line 70 of file server_if.c.

00071 {
00072     if( read_fd != 0 && close (read_fd) != 0 )
00073         error(0, errno, "close on read_fd");
00074     if( write_fd != 0 && close (write_fd) != 0 )
00075         error(0, errno, "close on write_fd");
00076 }

void macos_start_server | ( | int * | tofd,
 |  | int * | fromfd,
 |  | char * | client_user,
 |  | char * | server_user,
 |  | char * | server_host,
 |  | char * | server_cvsroot
 | ) |

Definition at line 17 of file server_if.c.

00022 {
00023     char *cvs_server;
00024     char *command;
00025     char *portenv;
00026     struct servent *sptr;
00027     unsigned short port;
00028
00029     if (! (cvs_server = getenv ("CVS_SERVER")))
00030         cvs_server = "cvs";
00031     command = xmalloc (strlen (cvs_server)
00032                + strlen (server_cvsroot)
00033                + 50);
00034     sprintf (command, "%s -d %s server", cvs_server, server_cvsroot);
00035
00036     portenv = getenv("CVS_RCMD_PORT");
00037     if (portenv)
00038     port = atoi(portenv);
00039     else if ((sptr = getservbyname("shell", "tcp")) != NULL)
00040     port = sptr->s_port;
00041     else
00042     /* This is the normal case.  Macs will generally lack a /etc/services
00043        file (causing getservbyname to fail), and getenv is only something
00044        that we provide via our own AppleEvents stuff, not a standard
00045        Mac feature.  */
00046     port = 514;
00047
00048     read_fd = rcmd (&server_host,
00049                     port,
00050                     client_user,
00051                 (server_user ? server_user : client_user),
00052                 command,
00053                 0);
00054     if (read_fd < 0)
00055     error (1, errno, "cannot start server via rcmd");
00056
00057     write_fd = read_fd;
00058     {
00059         struct linger ling = {1, 2};
00060         setsockopt(read_fd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));
00061     }
00062
00063     *tofd = write_fd;
00064     *fromfd = read_fd;
00065     free (command);
00066 }

int macos_stat | ( | const char * | path,
 |  | struct stat * | ststr
 | ) |

Definition at line 272 of file macos_filesys.c.

00273 {
00274     int res = stat( macos_fixpath(path), ststr );
00275     TRACE((stderr, "stat %s -> %d", macos_fixpath(path), res));
00276     return res;
00277 }

int macos_unlink ( const char * path )

Definition at line 310 of file macos_filesys.c.

00311 {
00312     int res;
00313     chmod(path, S_IRWXU);
00314     res = unlink( macos_fixpath(path) );
00315     TRACE((stderr, "unlink %s -> %d", macos_fixpath(path), res));
00316     return res;
00317 }

Generated on Sun Oct 21 12:42:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/config.h Source File

cvs-1.10/macintosh/config.h

Go to the documentation of this file.
00001 /*
00002  * config.h --- configuration file for MacOS
00003  * Handbuilt for MetroWerks CodeWarrier 7 and GUSI 1.6.4
00004  *
00005  * This file lives in the CVSHOME/macintosh directory
00006  *
00007  * MDLadwig <mike@twinpeaks.prc.com> --- Nov 1995
00008  * Modified : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00009  */
00010
00011 #ifndef _CONFIG_H__
00012 #define _CONFIG_H__
00013
00014 #define O_BINARY        0x8000      /* open the file in binary mode (default is text mode) */
00015
00016 #include <ansi_parms.h>
00017
00018 #ifdef CVSGUI_SHL
00019 #   define MAC_SHL
00020 #   define CVSGUI
00021 #   include "dll_garbage.h"
00022 #   include "dll_glue.h"
00023 #endif /* CVSGUI_SHL */
00024
00025 #include <sys/types.h>
00026 #include <sys/stat.h>
00027 #include <dirent.h>
00028 #include <stdio.h>
00029 #include <fcntl.h>
00030 #include <unistd.h>
00031
00032 #if __MSL__ >= 0x6000 && __MSL__ < 0x7000
00033 #   include <unistd.h>
00034 #   define getlogin _getlogin
00035 #   define posixparams mode_t
00036     _MSL_IMP_EXP_C char*            _getlogin(void);
00037     _MSL_IMP_EXP_C posixparams _umask(posixparams);         /*cc Feb 10 2000 */
00038     __inline  posixparams  umask(posixparams _a)         {return  _umask(_a)         ;}
00039 #endif
00040
00041 /* Enumerated values can be trouble on 68K machines.  */
00042 #if !__POWERPC__
00043 #define ENUMS_CAN_BE_TROUBLE 1
00044 #endif
00045
00046 /* Don't offer user (or server) the ability to try client-side gzip subprocessing */
00047 #define NO_CLIENT_GZIP_PROCESS 1
00048
00049 /* Define if CR-LF conversion is broken.  */
00050 #define BROKEN_READWRITE_CONVERSION 1
00051
00052 /* Define if 'patch' is not to be used.  */
00053 #define DONT_USE_PATCH 1
00054
00055 /* Define if files are crlf terminated.  */
00056 /*#define LINES_CRLF_TERMINATED 1*/
00057
00058 /* Define if you support file names longer than 14 characters.  */
00059 #define HAVE_LONG_FILE_NAMES 1
00060
00061 /* Define if your struct stat has st_blksize.  */
00062 #define HAVE_ST_BLKSIZE 1
00063
00064 /* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
00065 #undef HAVE_SYS_WAIT_H
00066
00067 /* Define if utime(file, NULL) sets file's timestamp to the present.  */
00068 #define HAVE_UTIME_NULL 1
00069
00070 /* Define if you have <vfork.h>.  */
00071 #undef HAVE_VFORK_H
00072
00073 /* Define if on MINIX.  */
00074 #undef _MINIX
00075
00076 /* Define if the system does not provide POSIX.1 features except
00077    with this defined.  */
00078 #undef _POSIX_1_SOURCE
00079
00080 /* Define if you need to in order for stat and other things to work.  */
00081 #undef _POSIX_SOURCE
00082
00083 /* Define as the return type of signal handlers (int or void).  */
00084 #define RETSIGTYPE void
00085
00086 /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
00087 #undef STAT_MACROS_BROKEN
00088
00089 /* Define if you have the ANSI C header files.  */
00090 #define STDC_HEADERS 1
00091
00092 /* Define if you can safely include both <sys/time.h> and <time.h>.  */
00093 #define TIME_WITH_SYS_TIME 1
00094
00095 /* Define if you have MIT Kerberos version 4 available.  */
00096 #undef HAVE_KERBEROS
00097
00098 /* Define if you have GSSAPI with MIT Kerberos version 5 available.  */
00099 #undef HAVE_GSSAPI
00100
00101 /* Define if GSS_C_NT_HOSTBASED_SERVICE is defined in the gssapi.h
00102    header file.  Only relevant when using GSSAPI.  */
00103 #undef HAVE_GSS_C_NT_HOSTBASED_SERVICE
00104
00105 /* Define if you want CVS to be able to be a remote repository client.  */
00106 #define CLIENT_SUPPORT 1
00107
00108 /* Define if you want CVS to be able to serve repositories to remote
00109    clients.  */
00110 #undef SERVER_SUPPORT
00111
00112 /* Define if you want to use the password authenticated server.  */
00113 #undef AUTH_SERVER_SUPPORT
00114
00115 /* Define if you want encryption support.  */
00116 #undef ENCRYPTION
00117
00118 /* Define if you have the connect function.  */
00119 #define HAVE_CONNECT
00120
00121 /* Define if this system supports chown(), link(), and friends.  */
00122 #undef PRESERVE_PERMISSIONS_SUPPORT
00123
00124 /* Define if you have memchr (always for CVS).  */
00125 #undef HAVE_MEMCHR
00126
00127 /* Define if you have strchr (always for CVS).  */
00128 #undef HAVE_STRCHR
00129
00130 /* Define if utime requires write access to the file (true on Windows,
00131    but not Unix).  */
00132 #undef UTIME_EXPECTS_WRITABLE
00133
00134 /* Define if setmode is required when writing binary data to stdout.  */
00135 #undef USE_SETMODE_STDOUT
00136
00137 /* Define if the diff library should use setmode for binary files.
00138    FIXME: Why two different macros for setmode?  */
00139 #undef HAVE_SETMODE
00140
00141 /* Define if you have the crypt function.  */
00142 #undef HAVE_CRYPT
00143
00144 /* Define if you have the getspnam function.  */
00145 #undef HAVE_GETSPNAM
00146
00147 /* Define to force lib/regex.c to use malloc instead of alloca.  */
00148 #undef REGEX_MALLOC
00149
00150 /* Define to force lib/regex.c to define re_comp et al.  */
00151 #define _REGEX_RE_COMP 1
00152
00153 /* Define if you have the dup2 function.  */
00154 #undef HAVE_DUP2
00155
00156 /* Define if you have the fchdir function.  */
00157 #undef HAVE_FCHDIR
00158
00159 /* Define if you have the fchmod function.  */
00160 #undef HAVE_FCHMOD
00161
00162 /* Define if you have the fsync function.  */
00163 #define HAVE_FSYNC 1
00164
00165 /* Define if you have the ftime function.  */
00166 #define HAVE_FTIME 1
00167
00168 /* Define if you have the ftruncate function.  */
00169 #define HAVE_FTRUNCATE 1
00170
00171 /* Define if you have the getpagesize function.  */
00172 #undef HAVE_GETPAGESIZE
00173
00174 /* Define if you have the getspnam function.  */
00175 #undef HAVE_GETSPNAM
00176
00177 /* Define if you have the initgroups function.  */
00178 #undef HAVE_INITGROUPS
00179
00180 /* Define if you have the krb_get_err_text function.  */
00181 #undef HAVE_KRB_GET_ERR_TEXT
00182
00183 /* Define if you have the mktemp function.  */
00184 #undef HAVE_MKTEMP
00185
00186 /* Define if you have the putenv function.  */
00187 #undef HAVE_PUTENV
00188
00189 /* Define if you have the readlink function.  */
00190 #define HAVE_READLINK 1
00191
00192 /* Define if you have the sigaction function.  */
00193 #define HAVE_SIGACTION 1
00194
00195 /* Define if you have the sigblock function.  */
00196 #undef HAVE_SIGBLOCK
00197
00198 /* Define if you have the sigprocmask function.  */
00199 #define HAVE_SIGPROCMASK 1
00200
00201 /* Define if you have the sigsetmask function.  */
00202 #undef HAVE_SIGSETMASK
00203
00204 /* Define if you have the sigvec function.  */
00205 #undef HAVE_SIGVEC
00206
00207 /* Define if you have the tempnam function.  */
00208 #undef HAVE_TEMPNAM
00209
00210 /* Define if you have the timezone function.  */
00211 #undef HAVE_TIMEZONE
00212
00213 /* Define if you have the tzset function.  */
00214 #undef HAVE_TZSET
00215
00216 /* Define if you have the vprintf function.  */
00217 #define HAVE_VPRINTF 1
00218
00219 /* Define if you have the wait3 function.  */
00220 #undef HAVE_WAIT3
00221
00222 /* Define if you have the <direct.h> header file.  */
00223 #undef HAVE_DIRECT_H
00224
00225 /* Define if you have the <dirent.h> header file.  */
00226 #define HAVE_DIRENT_H 1
00227
00228 /* Define if you have the <errno.h> header file */
00229 #define HAVE_ERRNO_H 1
00230
00231 /* Define if you have the <fcntl.h> header file.  */
00232 #define HAVE_FCNTL_H 1
00233
00234 /* Define if you have the <gssapi.h> header file.  */
00235 #undef HAVE_GSSAPI_H
00236
00237 /* Define if you have the <gssapi/gssapi.h> header file.  */
00238 #undef HAVE_GSSAPI_GSSAPI_H
00239
00240 /* Define if you have the <gssapi/gssapi_generic.h> header file.  */
00241 #undef HAVE_GSSAPI_GSSAPI_GENERIC_H
00242
00243 /* Define if you have the <io.h> header file.  */
00244 #undef HAVE_IO_H
00245
00246 /* Define if you have the <limits.h> header file.  */
00247 #define HAVE_LIMITS_H 1
00248
00249 /* Define if you have the <memory.h> header file.  */
00250 #undef HAVE_MEMORY_H
00251
00252 /* Define if you have the <ndbm.h> header file.  */
00253 #undef HAVE_NDBM_H
00254
00255 /* Define if you have the <ndir.h> header file.  */
00256 #undef HAVE_NDIR_H
00257
00258 /* Define if you have the <string.h> header file.  */
00259 #define HAVE_STRING_H 1
00260
00261 /* Define if you have the <sys/bsdtypes.h> header file.  */
00262 #undef HAVE_SYS_BSDTYPES_H
00263
00264 /* Define if you have the <sys/dir.h> header file.  */
00265 #undef HAVE_SYS_DIR_H
00266
00267 /* Define if you have the <sys/file.h> header file.  */
00268 #undef HAVE_SYS_FILE_H
00269
00270 /* Define if you have the <sys/ndir.h> header file.  */
00271 #undef HAVE_SYS_NDIR_H
00272
00273 /* Define if you have the <sys/param.h> header file.  */
00274 #undef HAVE_SYS_PARAM_H
00275
00276 /* Define if you have the <sys/resource.h> header file.  */
00277 #undef HAVE_SYS_RESOURCE_H
00278
00279 /* Define if you have the <sys/select.h> header file.  */
00280 #undef HAVE_SYS_SELECT_H
00281
00282 /* Define if you have the <sys/time.h> header file.  */
00283 #define HAVE_SYS_TIME_H 1
00284
00285 /* Define if you have the <sys/timeb.h> header file.  */
00286 #undef HAVE_SYS_TIMEB_H
00287
00288 /* Define if you have the <unistd.h> header file.  */
00289 #define HAVE_UNISTD_H 1
00290
00291 /* Define if you have the <utime.h> header file.  */
00292 #define HAVE_UTIME_H 1
00293
00294 /* Define if you have the crypt library (-lcrypt).  */
00295 #undef HAVE_LIBCRYPT
00296
00297 /* Define if you have the gen library (-lgen).  */
00298 #undef HAVE_LIBGEN
00299
00300 /* Define if you have the inet library (-linet).  */
00301 #undef HAVE_LIBINET
00302
00303 /* Define if you have the nsl library (-lnsl).  */
00304 #undef HAVE_LIBNSL
00305
00306 /* Define if you have the nsl_s library (-lnsl_s).  */
00307 #undef HAVE_LIBNSL_S
00308
00309 /* Define if you have the sec library (-lsec).  */
00310 #undef HAVE_LIBSEC
00311
00312 /* Define if you have the socket library (-lsocket).  */
00313 #undef HAVE_LIBSOCKET
00314
00315 #ifdef MACCVS_KERBEROS
00316     /* Define if you have kerberos v4 support */
00317 #   define HAVE_KERBEROS 1
00318
00319     /* Define if you are using KClient for Kerberos v4 on the Mac (this is the only supported option right now) */
00320 #   define USE_KCLIENT 1
00321
00322     /* Some weird kerberos #if statements want this */
00323 #   define USE_DIRECT_TCP 1
00324 #endif
00325
00326 /* GUSI filesystem stuff doesn't take the last parameter (permissions).  */
00327 #define CVS_MKDIR macos_mkdir
00328 #define mkdir macos_mkdir
00329 #define CVS_OPEN macos_open
00330 #define open macos_open
00331 #define CVS_CREAT macos_creat
00332 #define creat macos_creat
00333 #define CVS_FOPEN macos_fopen
00334 #define fopen macos_fopen
00335 #define CVS_CHDIR macos_chdir
00336 #define chdir macos_chdir
00337 #define CVS_ACCESS macos_access
00338 #define access macos_access
00339 #define CVS_OPENDIR macos_opendir
00340 #define opendir macos_opendir
00341 #define CVS_STAT macos_stat
00342 #define stat(a,b) macos_stat(a,b)
00343 #define CVS_RENAME macos_rename
00344 #define rename macos_rename
00345 #define CVS_RMDIR macos_rmdir
00346 #define rmdir macos_rmdir
00347 #define CVS_UNLINK macos_unlink
00348 #define unlink macos_unlink
00349 #define CVS_CHMOD macos_chmod
00350 #define chmod macos_chmod
00351 #define CVS_LSTAT macos_lstat
00352 #define lstat macos_lstat
00353
00354 #ifdef __cplusplus
00355 extern "C" {
00356 #endif
00357
00358 extern int macos_rmdir (const char *);
00359 extern int macos_rename (const char *, const char *);
00360 extern int macos_stat (const char *, struct stat *);
00361 extern int macos_lstat (const char *, struct stat *);
00362 extern DIR * macos_opendir (const char *);
00363 extern int macos_access(const char *, int);
00364 extern int macos_chdir( const char *path );
00365 extern FILE * macos_fopen( const char *path, const char *mode );
00366 extern int macos_creat( const char *path, mode_t mode );
00367 extern int macos_open( const char *path, int oflag, ... );
00368 extern int macos_mkdir( const char *path, int oflag );
00369 extern int macos_unlink (const char *);
00370 extern int macos_chmod( const char *path, mode_t mode );
00371
00372 /* Kludges from pwd.c  */
00373 extern struct passwd *getpwnam (char *name);
00374 extern pid_t getpid (void);
00375
00376 #ifdef __cplusplus
00377 }
00378 #endif
00379
00380 /* We have prototypes.  */
00381 #define USE_PROTOTYPES 1
00382
00383 /* Compare filenames */
00384 /* should we use stricmp instead ? */
00385 #define fncmp strcmp
00386
00387 /* Don't use rsh */
00388 #define RSH_NOT_TRANSPARENT 1
00389
00390 #define START_SERVER macos_start_server
00391 #define SHUTDOWN_SERVER macos_shutdown_server
00392 #define SYSTEM_CLEANUP macos_cleanup
00393 #define SYSTEM_INITIALIZE macos_initialize
00394
00395 #ifdef __cplusplus
00396 extern "C" {
00397 #endif
00398
00399 extern void macos_start_server (int *tofd, int *fromfd,
00400                   char *client_user,
00401                   char *server_user,
00402                   char *server_host,
00403                   char *server_cvsroot);
00404 extern void macos_shutdown_server (int to);
00405 extern void macos_cleanup(void);
00406 extern void macos_initialize(int *argc, char ***argv);
00407
00408 #ifdef __cplusplus
00409 }
00410 #endif
00411
00412 /* convert non-text files with rsrc fork in hqx */
00413 #define BINHEX_STUFF
00414
00415 /* see cvs.h */
00416 #define DIRTY_MODDATE
00417 #define DO_NOT_LOCK_DIRTY
00418
00419 /* only for us ! */
00420 #define STRATA_HACK
00421
00422 #endif // _CONFIG_H__
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/cvs_hqx.cpp Source File

cvs-1.10/macintosh/cvs_hqx.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 #include "config.h"
00022
00023 #include <GUSIInternal.h>
00024 #include <GUSIFileSpec.h>
00025 #include <sys/types.h>
00026 #include <errno.h>
00027 #include <fcntl.h>
00028 #include "hqx.h"
00029 #include "cvs_hqx.h"
00030 #include "FileCopy.h"
00031 #include "apsingle.h"
00032
00033 #include <PLStringFuncs.h>
00034 #include <stdio.h>
00035 #include <stdlib.h>
00036 #include <string.h>
00037 #include <Resources.h>
00038 #include <TextUtils.h>
00039 #include <Strings.h>
00040 #include <Finder.h>
00041
00042 #include <InternetConfig.h>
00043
00044 #if 0
00045 // if you want some files to be handled as plain binary
00046 // (even if the file has a resource fork), open the
00047 // application with ResEdit or Resorcerer and change
00048 // the 'bin#' resource :
00049
00050 static const    OSType      kTypesListResType   = 'bin#';
00051 static const    short       kTypesListResID     = 128;
00052 #endif
00053
00054 extern "C" char *macos_fixpath (const char *path);
00055
00056 static void fillSemiColonTypes(const char *envVar, OSType *& allTypes, int & numTypes)
00057 {
00058     allTypes = 0L;
00059     numTypes = 0;
00060     const char *envRes = getenv(envVar);
00061     if(envRes == 0L)
00062         return;
00063
00064     char *tmpStr = (char *)malloc(strlen(envRes) + 1);
00065     if(tmpStr == 0L)
00066     {
00067         fprintf(stderr, "Running out of memory !\n");
00068         exit(1);
00069     }
00070     strcpy(tmpStr, envRes);
00071
00072     char *tmp = tmpStr, *colon = 0L, *start = tmpStr;
00073     while((tmp = strchr(tmp, ';')) != 0L)
00074     {
00075         *tmp = '\0';
00076         if((tmp - start) == 4)
00077         {
00078             if(allTypes == 0L)
00079                 allTypes = (OSType *)malloc(sizeof(OSType));
00080             else
00081                 allTypes = (OSType *)realloc(allTypes, (numTypes + 1) * sizeof(OSType));
00082             if(allTypes == 0L)
00083             {
00084                 fprintf(stderr, "Running out of memory !\n");
00085                 exit(1);
00086             }
00087             OSType atype;
00088             ((char *)&atype)[0] = *start++;
00089             ((char *)&atype)[1] = *start++;
00090             ((char *)&atype)[2] = *start++;
00091             ((char *)&atype)[3] = *start;
00092             allTypes[numTypes++] = atype;
00093         }
00094         else
00095         {
00096             fprintf(stderr, "Warning unknown signature %s (variable : %s) !\n", start, envRes);
00097         }
00098
00099         start = ++tmp;
00100     }
00101 }
00102
00103 static Boolean isPlainBinary(OSType ftype)
00104 {
00105 #if 1
00106     static OSType *allTypes = (OSType *)-1;
00107     static int numTypes;
00108     if(allTypes == (OSType *)-1)
00109     {
00110         fillSemiColonTypes("MAC_BINARY_TYPES_PLAIN", allTypes, numTypes);
00111     }
00112     if(allTypes == 0L)
00113         return false;
00114     for(int i = 0; i < numTypes; i++)
00115     {
00116         if(allTypes[i] == ftype)
00117             return true;
00118     }
00119     return false;
00120 #else
00121     Handle  typesHandle = Get1Resource (kTypesListResType, kTypesListResID);
00122     if (typesHandle == nil)
00123     {
00124         fprintf(stderr, "Unable to get the ""bin#"" resource (error %d) !\n", ResError());
00125         return false;
00126     }
00127
00128     HLock(typesHandle);
00129     Ptr typesPtr = *typesHandle;
00130
00131     short       typesCount = *(short*)typesPtr;
00132     typesPtr += (2 * sizeof(short)) / sizeof(char); // count + align
00133     OSType*     walker = (OSType *)typesPtr;
00134
00135     while (typesCount-- > 0) {
00136         if (*walker == ftype)
00137         {
00138             HUnlock(typesHandle);
00139             return true;
00140         }
00141         walker++;
00142     }
00143     HUnlock(typesHandle);
00144
00145     return false;
00146 #endif
00147 }
00148
00149 static Boolean testHQXEncoding(OSType ftype)
00150 {
00151     static OSType *allTypes = (OSType *)-1;
00152     static int numTypes;
00153     if(allTypes == (OSType *)-1)
00154     {
00155         fillSemiColonTypes("MAC_BINARY_TYPES_HQX", allTypes, numTypes);
00156     }
00157     if(allTypes == 0L)
00158         return false;
00159     for(int i = 0; i < numTypes; i++)
00160     {
00161         if(allTypes[i] == ftype)
00162             return true;
00163     }
00164     return false;
00165 }
00166
00167 static Boolean testAppleSingleEncoding(OSType ftype)
00168 {
00169     static OSType *allTypes = (OSType *)-1;
00170     static int numTypes;
00171     if(allTypes == (OSType *)-1)
00172     {
00173         fillSemiColonTypes("MAC_BINARY_TYPES_SINGLE", allTypes, numTypes);
00174     }
00175     if(allTypes == 0L)
00176         return false;
00177     for(int i = 0; i < numTypes; i++)
00178     {
00179         if(allTypes[i] == ftype)
00180             return true;
00181     }
00182     return false;
00183 }
00184
00185 // - Tells which encoder to use. Check the env. variables "MAC_BINARY_TYPES_HQX"
00186 // and "MAC_BINARY_TYPES_SINGLE". If the type is not inside, return the
00187 // default encoder "MAC_DEFAULT_RESOURCE_ENCODING".
00188 // - Note that the plain binary test has to overide this one in every cases.
00189
00190 typedef enum
00191 {
00192     eEncodeDefault = -1,
00193     eEncodeHQX,
00194     eEncodeAppleSingle,
00195     eEncodePlainBinary
00196 } encodingPolicy;
00197
00198 static void determineEncodingPolicy(OSType ftype, encodingPolicy *policy)
00199 {
00200     if(isPlainBinary(ftype))
00201     {
00202         *policy = eEncodePlainBinary;
00203     }
00204     else if(testHQXEncoding(ftype))
00205     {
00206         *policy = eEncodeHQX;
00207     }
00208     else if(testAppleSingleEncoding(ftype))
00209     {
00210         *policy = eEncodeAppleSingle;
00211     }
00212     else
00213     {
00214         *policy = eEncodeDefault;
00215     }
00216 }
00217
00218 static void getDefaultEncodingPolicy(encodingPolicy *policy)
00219 {
00220     // get the default encoder
00221     char *envRes = getenv("MAC_DEFAULT_RESOURCE_ENCODING");
00222     if(envRes == 0L)
00223     {
00224         // default was eEncodeHQX, so MWCVS users won't complain
00225         // if they don't set this flag
00226         *policy = eEncodeHQX;
00227         return;
00228     }
00229
00230     if(strcmp(envRes, "HQX") == 0)
00231     {
00232         *policy = eEncodeHQX;
00233         return;
00234     }
00235     else if(strcmp(envRes, "AppleSingle") == 0)
00236     {
00237         *policy = eEncodeAppleSingle;
00238         return;
00239     }
00240
00241     fprintf(stderr, "Unknown resource encoding '%s' !\n", envRes);
00242     exit(1);
00243 }
00244
00245 static FILE *gDestFile;
00246 static FILE *gSrcFile;
00247 static FSSpec gDestFileSpec;
00248
00249 static OSErr MyDest(void* buffer, long count, long param) {
00250     fwrite(buffer, count, 1, gDestFile);
00251     return noErr;
00252 }
00253
00254 static OSErr MySource(void* buffer, long *count, long param) {
00255     *count =  fread(buffer, 1, *count, gSrcFile);
00256     return noErr;
00257 }
00258
00259 static OSErr MyNameFilter(StringPtr name, short *vol, long *dir, long param) {
00260     PLstrcpy(name, gDestFileSpec.name);
00261     *vol = gDestFileSpec.vRefNum;
00262     *dir = gDestFileSpec.parID;
00263     return noErr;
00264 }
00265
00266 int
00267 convert_hqx_file (const char *infile,  int inflags,
00268     const char *outfile, int outflags, int *bin)
00269 {
00270     OSErr err = fnfErr;
00271     FInfo fileinfo;
00272     encodingPolicy inFileType;
00273
00274     GUSIFileSpec inspec(infile);
00275     if(inspec.Error() != noErr)
00276         goto panic;
00277
00278     GUSIFileSpec outspec(outfile);
00279     if(outspec.Error() != noErr)
00280         goto panic;
00281
00282     Boolean encode;
00283
00284     if (inflags & O_BINARY)
00285     {
00286         encode = false;
00287
00288         // the cvswrapper has to be coherent !!!
00289         if((*bin) == 0)
00290             return 0;
00291
00292         gSrcFile = fopen(infile, "r");
00293         if(gSrcFile == NULL)
00294             goto panic;
00295
00296         char buf[100];
00297         static char hqxheader[] = "(This file must be converted with BinHex 4.0)";
00298         UInt32 asheader = AS_MAGIC_NUM;
00299         fread (buf, sizeof(char), 100, gSrcFile);
00300
00301         // Determine whether the file is one of the known encodings
00302         if ( memcmp(hqxheader, buf, strlen(hqxheader) * sizeof(char)) == 0)
00303         {
00304             inFileType = eEncodeHQX;
00305             fseek(gSrcFile, 0, SEEK_SET);
00306         }
00307         else if  ( memcmp(&asheader, buf, sizeof(asheader)) == 0 )
00308         {
00309             fclose(gSrcFile);
00310             inFileType = eEncodeAppleSingle;
00311         }
00312         else
00313         {
00314             // it is a "plain" binary
00315             fclose(gSrcFile);
00316             return 0;
00317         }
00318     }
00319     else
00320     {
00321         encode = true;
00322
00323         // check if it is a text file
00324         CInfoPBRec cbrec;
00325         DirInfo * cb;
00326
00327         cb = (DirInfo *)&cbrec;
00328         cb->ioNamePtr   =   (unsigned char *)inspec->name;
00329         cb->ioDrDirID   =   inspec->parID;
00330         cb->ioVRefNum   =   inspec->vRefNum;
00331         cb->ioFDirIndex =   0;
00332
00333         err = PBGetCatInfoSync((CInfoPBRec *)cb);
00334         if(err != noErr)
00335             goto panic;
00336
00337         fileinfo = ((HFileInfo *)cb)->ioFlFndrInfo;
00338         if(fileinfo.fdType == 'TEXT')
00339             return 0;
00340     }
00341
00342     if(encode)
00343     {
00344         encodingPolicy policy;
00345         determineEncodingPolicy(fileinfo.fdType, &policy);
00346
00347         // special case, some files may be forced as plain binary.
00348         // (env. variable "MAC_BINARY_TYPES_PLAIN")
00349         if(policy == eEncodePlainBinary)
00350         {
00351             *bin = 1;
00352             return 0;
00353         }
00354         else if(policy == eEncodeDefault)
00355         {
00356             // Never encode any files that have no resource fork
00357             // Should we just use the test: if (
00358             short fileRsrc = FSpOpenResFile(&inspec, fsRdPerm);
00359             if(fileRsrc < 0)
00360             {
00361                 // it is a "plain" binary
00362                 *bin = 1;
00363                 return 0;
00364             }
00365             CloseResFile(fileRsrc);
00366
00367             // get default policy
00368             getDefaultEncodingPolicy(&policy);
00369         }
00370
00371         if(policy == eEncodeHQX)
00372         {
00373             gDestFile = fopen(outfile, "w");
00374             if(gDestFile == NULL)
00375                 goto panic;
00376             err = HQXEncode((unsigned char *)inspec->name, inspec->vRefNum, inspec->parID, MyDest, 0);
00377             fflush(gDestFile);
00378             fclose(gDestFile);
00379             if(err != noErr)
00380                 goto panic;
00381         }
00382         else if ( policy == eEncodeAppleSingle )
00383         {
00384 #define APPLESINGLE_WANTED_ENTRIES ((UInt32)AS_DATA_BIT | AS_RESOURCE_BIT | AS_COMMENT_BIT | AS_FINDERINFO_BIT | AS_MACINFO_BIT)
00385             UInt32 wantedEntries = APPLESINGLE_WANTED_ENTRIES;
00386             err = encodeAppleSingle(&inspec, outfile, wantedEntries);
00387             if (err != noErr)
00388                 goto panic;
00389         }
00390         else
00391         {
00392             fprintf( stderr, "Internal error: %s, %s\n", __FILE__, __LINE__);
00393             goto panic;
00394         }
00395     }
00396     else    // decoding
00397     {
00398         if ( inFileType == eEncodeHQX )
00399         {
00400             gDestFileSpec = outspec;
00401
00402             err = HQXDecode(MySource, MyNameFilter, true, true, 0);
00403             fclose(gSrcFile);
00404             if(err != noErr)
00405                 goto panic;
00406         }
00407         else if ( inFileType == eEncodeAppleSingle)
00408         {
00409             UInt32 wantedEntries = APPLESINGLE_WANTED_ENTRIES;
00410             FSSpec macSpec = outspec;
00411             err = decodeAppleSingle(infile, &macSpec, wantedEntries);
00412             if (err != noErr)
00413                 goto panic;
00414
00415
00416             // Sometimes, type/creator information is not encoded inside the AS file
00417             // If so, we want to set type/creator using Internet Config
00418             CInfoPBRec cbrec;
00419             cbrec.hFileInfo.ioNamePtr = macSpec.name;
00420             cbrec.hFileInfo.ioDirID = macSpec.parID;
00421             cbrec.hFileInfo.ioVRefNum = macSpec.vRefNum;
00422             cbrec.hFileInfo.ioFDirIndex =0;
00423
00424             err = PBGetCatInfoSync(&cbrec);
00425             if(err != noErr)
00426                 goto panic;
00427
00428             fileinfo = cbrec.hFileInfo.ioFlFndrInfo;
00429             if( (fileinfo.fdType == AS_DEFAULT_TYPE)
00430                  && ( fileinfo.fdCreator == AS_DEFAULT_CREATOR))
00431             {
00432                 GUSIFileSpec newSpec( macSpec);
00433                 char * fullPath = newSpec.FullPath();
00434                 set_file_type(  fullPath, true );
00435             }
00436         }
00437         else
00438         {
00439             fprintf( stderr, "Internal error: %s, %s\n", __FILE__, __LINE__);
00440             goto panic;
00441         }
00442     }
00443
00444     return 1;
00445 panic:
00446     fprintf(stderr, "Panic error code %d, exiting\n", err);
00447     exit(1);
00448
00449     return 0;
00450 }
00451
00452 void set_file_type(const char *outfile, Boolean warnOnFail)
00453 {
00454     OSStatus err;
00455     ICInstance inst;
00456     Str255 filename;
00457
00458     c2pstrcpy(filename, outfile);
00459
00460     err = ICStart(&inst, 'CVS ');           // Use your creator code if you have one!
00461     if (err != noErr)
00462     {
00463         static Boolean firsttime = true;
00464         if(firsttime)
00465         {
00466             fprintf(stderr, "WARNING Internet config's missing !\n");
00467             firsttime = false;
00468         }
00469         return;
00470     }
00471
00472 #if !TARGET_API_MAC_CARBON
00473     err = ICFindConfigFile(inst, 0, nil);
00474     if (err != noErr)
00475     {
00476         static Boolean firsttime2 = true;
00477         if(firsttime2)
00478         {
00479             fprintf(stderr, "WARNING Internet config file's missing !\n");
00480             firsttime2 = false;
00481         }
00482         goto exitall;
00483     }
00484 #endif
00485
00486     ICMapEntry entry;
00487     err = ICMapFilename(inst, filename, &entry);
00488     if (err != noErr)
00489     {
00490         if (warnOnFail)
00491             fprintf(stderr, "WARNING: Internet Config cannot map file %s\n", outfile);
00492         goto exitall;
00493     }
00494     OSErr oserr;
00495     GUSIFileSpec outspec(outfile);
00496     FInfo fndrInfo;
00497
00498     FSSpec macSpec = outspec;
00499     oserr = HGetFInfo(macSpec.vRefNum, macSpec.parID, macSpec.name, &fndrInfo);
00500     if (oserr != noErr)
00501         goto exitall;
00502
00503 #if UNIVERSAL_INTERFACES_VERSION < 0x0331
00504     if(entry.file_creator != 0)
00505         fndrInfo.fdCreator = entry.file_creator;
00506 #else
00507     if(entry.fileCreator != 0)
00508         fndrInfo.fdCreator = entry.fileCreator;
00509 #endif
00510     if(entry.fileType != 0)
00511         fndrInfo.fdType = entry.fileType;
00512     oserr = HSetFInfo(macSpec.vRefNum, macSpec.parID, macSpec.name, &fndrInfo);
00513     if (oserr != noErr)
00514         goto exitall;
00515
00516 exitall:
00517     ICStop(inst);
00518 }
00519
00520 int mac_duplicate (const char *from, const char *to)
00521 {
00522     GUSIFileSpec fromspec(macos_fixpath(from));
00523     if(fromspec.Error() != noErr)
00524         return fromspec.Error();
00525
00526     GUSIFileSpec tospec(macos_fixpath(to));
00527     if(tospec.Error() != noErr && tospec.Error() != fnfErr)
00528         return tospec.Error();
00529
00530     FSSpec macfromspec = fromspec;
00531     FSSpec mactospec = tospec;
00532     OSErr err = FileCopy(macfromspec.vRefNum,
00533                          macfromspec.parID,
00534                          macfromspec.name,
00535                          mactospec.vRefNum,
00536                          mactospec.parID,
00537                          nil,
00538                          mactospec.name,
00539                          nil,
00540                          0,
00541                         true);
00542
00543     if(err == fnfErr)
00544         errno = ENOENT;
00545     else if(err != noErr)
00546         errno = err;
00547
00548     return err;
00549 }
00550
00551 unsigned char convert_iso(int convert_from, int iso, unsigned char c)
00552 {
00553     static bool tableLoaded = false;
00554     static unsigned char iso_to_mac[256];
00555     static unsigned char mac_to_iso[256];
00556     extern FSSpec sCvsContainerFileSpec;
00557
00558     if(iso != 1) // only Latin 1 available right now
00559         return c;
00560
00561     if(!tableLoaded)
00562     {
00563         short oldRefNum = ::CurResFile();
00564         short refNum = ::FSpOpenResFile(&sCvsContainerFileSpec, fsRdPerm);
00565         if(refNum == -1)
00566         {
00567             fprintf(stderr, "WARNING Cannot open cvs resources !\n");
00568             return c;
00569         }
00570         UseResFile(refNum);
00571
00572         Handle iso_to_mac_hdl = GetResource('taBL', 1001);
00573         Handle mac_to_iso_hdl = GetResource('taBL', 1002);
00574
00575         if(iso_to_mac_hdl == 0L || mac_to_iso_hdl == 0L ||
00576             ::GetHandleSize(iso_to_mac_hdl) != 256 || ::GetHandleSize(mac_to_iso_hdl) != 256)
00577         {
00578             fprintf(stderr, "WARNING ISO8559 tables are missing !\n");
00579             UseResFile(oldRefNum);
00580             return c;
00581         }
00582
00583         memcpy(iso_to_mac, *iso_to_mac_hdl, 256 * sizeof(char));
00584         memcpy(mac_to_iso, *mac_to_iso_hdl, 256 * sizeof(char));
00585
00586         CloseResFile(refNum);
00587         UseResFile(oldRefNum);
00588
00589         tableLoaded = true;
00590     }
00591
00592     return convert_from ? iso_to_mac[c] : mac_to_iso[c];
00593 }
00594
00595 #if !TARGET_API_MAC_CARBON
00596 void
00597 c2pstrcpy                       (Str255                 dst,
00598                                  const char *           src)
00599 {
00600     strcpy((char *)dst, src);
00601     c2pstr((char *)dst);
00602 }
00603
00604 void
00605 p2cstrcpy                       (char *                 dst,
00606                                  ConstStr255Param       src)
00607 {
00608     unsigned char len = src[0];
00609     memcpy(dst, &src[1], len);
00610     dst[len] = '\0';
00611 }
00612 #endif
00613
00614 #if __MSL__ >= 0x6001 && __MSL__ < 0x7000
00615 #ifdef _POSIX
00616 extern "C" {
00617 _MSL_IMP_EXP_C char*            _getlogin(void);
00618 _MSL_IMP_EXP_C mode_t _umask(mode_t);       /*cc Feb 10 2000 */
00619 char*           getlogin(void)     {return _getlogin()    ;}
00620 mode_t  umask(mode_t _a)             {return  _umask(_a)         ;}
00621 }
00622 #endif
00623 #endif
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/cvs_hqx.h Source File

cvs-1.10/macintosh/cvs_hqx.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 #ifndef CVS_HQX_H
00022 #define CVS_HQX_H
00023
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027
00028 // will try to encode/decode file.
00029 // Encoding :
00030 // 1) if the signature is not 'TEXT' :
00031 //   1a) if there is a resource fork => encode and return 1
00032 //   1b) if there is NO resource fork => adjust bin = 1 and return 0
00033 //       (so the "cvs import" is correct)
00034 // 2) if the signature is 'TEXT' => return 0
00035 // Decoding :
00036 // 1) if !bin => return 0 (!!! THE CVSWRAPPER has to be coherent !)
00037 // 2) if has the HQX header => decode and return 1
00038 // 3) return 0
00039
00040 int convert_hqx_file(const char *infile, int inflags, const char *outfile, int outflags, int *bin);
00041
00042 // set file type according to Internet Config
00043 void set_file_type(const char *outfile, Boolean warnOnFail);
00044
00045 // convert a character from and to an ISO8559_xxx character set
00046 unsigned char convert_iso(int convert_from, int iso, unsigned char c);
00047
00048 // implements a file duplicate so we have a chance to
00049 // duplicate the resource fork as well
00050 int mac_duplicate (const char *from, const char *to);
00051
00052 #ifdef __cplusplus
00053 }
00054 #endif
00055
00056 #endif /* CVS_HQX_H */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/GUSIlsh.h Source File

cvs-1.10/macintosh/GUSIlsh.h

Go to the documentation of this file.
00001 #ifndef _GUSILSH_
00002 #define _GUSILSH_
00003
00004 #include <sys/signal.h>
00005 #include "lsh_dll.h"
00006
00007 #ifdef __cplusplus
00008 extern "C" {
00009 #endif
00010
00011 typedef struct
00012 {
00013     lshctx              *lsh_ctx;
00014     struct sigaction    oldHandler;
00015     int                 doAbort;
00016 } gusilsh_ctx;
00017
00018 void GUSIwithLSHSockets(void);
00019 void GUSIwithoutLSHSockets(void);
00020 void GUSILSH_set_context(gusilsh_ctx *ctx);
00021 void GUSILSH_cleanup (int sig);
00022 void GUSILSH_hdlevt(long userData, long sleepTime);
00023
00024 #ifdef __cplusplus
00025 }
00026 #endif
00027
00028 #endif /* _GUSILSH_ */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/hqx.c Source File

cvs-1.10/macintosh/hqx.c

Go to the documentation of this file.
00001
00002 /* file hqx.c
00003     BinHex decoder/encoder routines, implementation.
00004     Copyright (c) 1995, 1996, 1997 by John Montbriand.  All Rights Reserved.
00005     Permission hereby granted for public use.
00006         Distribute freely in areas where the laws of copyright apply.
00007     USE AT YOUR OWN RISK.
00008     DO NOT DISTRIBUTE MODIFIED COPIES.
00009     Comments/questions/postcards* to the author at the address:
00010       John Montbriand
00011       P.O. Box. 1133
00012       Saskatoon Saskatchewan Canada
00013       S7K 3N2
00014     or by email at:
00015       tinyjohn@sk.sympatico.ca
00016     *if you mail a postcard, then I will provide you with technical support
00017     regarding questions you may have about this file.
00018 */
00019
00020 #include "hqx.h"
00021 #include <string.h>
00022 #include <Errors.h>
00023 #include <TextUtils.h>
00024 #include <PLStringFuncs.h>
00025 #include <Finder.h>
00026
00027 #define CVS_CHANGES
00028     /* due to the fact we want to avoid some informations which are going
00029     to screw-up the server in his attempt to compare if the file *really* differs with the repository,
00030     we have to suppress some enclosed informations which could be only specific to a user */
00031
00032     /* constants */
00033 #define kBinHexMagic 0x1021
00034 #define kRLEFlag 0x90
00035 #define kCopyBufLen 4096
00036 #define HT ((char) 9) /* horizontal tab */
00037 #define LF ((char) 10) /* line feed, newline */
00038 #define CR ((char) 13) /* carriage return */
00039
00040     /* types */
00041 typedef struct {
00042     unsigned char fInBuffer[4*1024];
00043     unsigned char fOutBuffer[4*1024];
00044     unsigned char *fOutBufp;
00045     long fBitBuffer, fBitBufferBits;
00046     long fNOutChars;
00047     long fRLECount;
00048     unsigned char fRLECharacter;
00049     unsigned short fCRC;
00050     HQXSink fSink;
00051     long fSinkRefCon;
00052 } HQXEncodeVars, *HQXEncVarsPtr;
00053
00054 typedef struct {
00055     unsigned char fInBuffer[4*1024];
00056     unsigned char fOutBuffer[4*1024];
00057     unsigned char *fInBufp, *fInBufMax;
00058     long fBitBuffer, fBitBufferBits;
00059     long fRLECount;
00060     unsigned char fRLECharacter;
00061     Boolean fInHqxData;
00062     unsigned short fCRC;
00063     HQXSource fSource;
00064     long fSourceRefCon;
00065 } HQXDecodeVars, *HQXDecVarsPtr;
00066
00067     /* globals */
00068 static Boolean gHQXinited = false;
00069 static char *gHQX = "!\"#$%&'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr";
00070 static short hqxtab[256];
00071 static short ihqxtab[256];
00072 static unsigned short crctab[256];
00073
00074
00075 /* CRC CALCULATION */
00076
00077 static void BuildCRCTable(unsigned short magic_number) {
00078     unsigned long i, magic, mgc, val, bit;
00079     for (i = 0; i < 256; i++) {
00080         magic = (magic_number << 8);
00081         mgc = (magic >> 1);
00082         val = (i << 16);
00083         for (bit = 23; bit > 15; bit--) {
00084             if ((val & (1 << bit)) != 0) val ^= mgc;
00085             mgc >>= 1;
00086         }
00087         crctab[i] = val & 0xFFFF;
00088     }
00089 }
00090
00091 static unsigned short initial_crc(void) {
00092     return 0;
00093 }
00094
00095 static unsigned short crc_byte(unsigned short crc, unsigned char byte) {
00096     return ( (crctab[(crc >> 8) & 255] ^ ((crc << 8) | byte)) & 0xFFFF );
00097 }
00098
00099 static unsigned short crc_run(unsigned short crc, void* buf, long len) {
00100     unsigned char *ch = buf;
00101     long i;
00102     unsigned short crcv = crc;
00103     for (i = 0; i < len; i++)
00104          crcv = (crctab[(crcv >> 8) & 255] ^ ((crcv << 8) | (*ch++))) & 0xFFFF;
00105     return crcv;
00106 }
00107
00108 static void HQXInit(void) {
00109     if (!gHQXinited) {
00110         long i, n;
00111         for (i = 0;i < 256;i++) {
00112             hqxtab[i] = -1;
00113             ihqxtab[i] = -1;
00114         }
00115         for (i = 0, n = strlen(gHQX); i < n; i++) {
00116             hqxtab[gHQX[i]] = i;
00117             ihqxtab[i] = gHQX[i];
00118         }
00119         hqxtab[CR] = -2;
00120         hqxtab[LF] = -2;
00121         hqxtab[HT] = -2;
00122         hqxtab[' '] = -2;
00123         hqxtab[':'] = -3;
00124         BuildCRCTable(kBinHexMagic);
00125         gHQXinited = true;
00126     }
00127 }
00128
00129
00130 /* BUFFERED OUTPUT */
00131
00132
00133 static OSErr BUFFWrite(HQXEncVarsPtr encv, void* buffer, long count) {
00134     unsigned char* ch;
00135     long i;
00136     OSErr err;
00137     ch = (unsigned char*) buffer;
00138     for (i = 0;i < count;i++) {
00139         if (encv->fOutBufp - encv->fOutBuffer == sizeof(encv->fOutBuffer)) {
00140             if ((err = encv->fSink(encv->fOutBuffer, sizeof(encv->fOutBuffer), encv->fSinkRefCon)) != noErr) return err;
00141             encv->fOutBufp = encv->fOutBuffer;
00142         }
00143         *encv->fOutBufp++ = *ch++;
00144     }
00145     return noErr;
00146 }
00147
00148 static OSErr BUFFWriteEnd(HQXEncVarsPtr encv) {
00149     if (encv->fOutBufp - encv->fOutBuffer > 0)
00150         return encv->fSink(encv->fOutBuffer, encv->fOutBufp - encv->fOutBuffer, encv->fSinkRefCon);
00151     else return noErr;
00152 }
00153
00154
00155 /* HQX OUTPUT */
00156
00157 static OSErr HQXWrite(HQXEncVarsPtr encv, void* buffer, long count) {
00158     unsigned char* ch, code;
00159     long i, v;
00160     OSErr err;
00161     ch = (unsigned char*) buffer;
00162     for (i = 0; i < count; i++, ch++) {
00163         encv->fBitBuffer = (encv->fBitBuffer << 8) | ((*ch)&255);
00164         encv->fBitBufferBits += 8;
00165         while (encv->fBitBufferBits >= 6) {
00166             v = (encv->fBitBuffer >> (encv->fBitBufferBits-6)) & 0x003F;
00167             encv->fBitBufferBits -= 6;
00168             code = ihqxtab[v];
00169             if ((err = BUFFWrite(encv, &code, 1)) != noErr) return err;
00170             encv->fNOutChars++;
00171             if ((encv->fNOutChars % 64) == 0) {
00172                 if ((err = BUFFWrite(encv, "\n", 1)) != noErr) return err;
00173             }
00174         }
00175     }
00176     return noErr;
00177 }
00178
00179 static OSErr HQXWriteEnd(HQXEncVarsPtr encv) {
00180     unsigned char code;
00181     OSErr err;
00182     if (encv->fBitBufferBits > 0) {
00183         code = ihqxtab[encv->fBitBuffer<<(6-encv->fBitBufferBits) & 0x03F];
00184         if ((err = BUFFWrite(encv, &code, 1)) != noErr) return err;
00185         encv->fNOutChars++;
00186     }
00187     return BUFFWrite(encv, ":\n", 2);
00188 }
00189
00190
00191 /* RLE OUTPUT */
00192
00193
00194 static OSErr FlushRLE(HQXEncVarsPtr encv) {
00195     long n;
00196     OSErr err;
00197     unsigned char buffer[10], *putp;
00198     while (encv->fRLECount > 0) {
00199         n = encv->fRLECount > 255 ? 255 : encv->fRLECount;
00200         putp = buffer;
00201         *putp++ = encv->fRLECharacter;
00202         if (encv->fRLECharacter == kRLEFlag) {
00203             *putp++ = 0;    /* literal flag value */
00204             if (n == 2) {
00205                 *putp++ = kRLEFlag;
00206                 *putp++ = 0;    /* literal flag value */
00207             } else if (n > 2) {
00208                 *putp++ = kRLEFlag;
00209                 *putp++ = n;    /* repeat count */
00210             }
00211         } else {
00212             if (n == 2)
00213                 *putp++ = encv->fRLECharacter;
00214             else if (n == 3) {
00215                 *putp++ = encv->fRLECharacter;
00216                 *putp++ = encv->fRLECharacter;
00217             } else if (n > 3) {
00218                 *putp++ = kRLEFlag;
00219                 *putp++ = n;
00220             }
00221         }
00222         if ((err = HQXWrite(encv, buffer, putp - buffer)) != noErr) return err;
00223         encv->fRLECount -= n;
00224     }
00225     return err;
00226 }
00227
00228 static OSErr RLEWrite(HQXEncVarsPtr encv, void* buffer, long count) {
00229     unsigned char *ch;
00230     long i;
00231     OSErr err;
00232     ch = (unsigned char*) buffer;
00233     err = noErr;
00234     for (ch = (unsigned char*) buffer, i = 0; i < count; i++, ch++) {
00235         if (encv->fRLECount == 0) {
00236             encv->fRLECharacter = *ch;
00237             encv->fRLECount = 1;
00238         } else if (*ch == encv->fRLECharacter)
00239             encv->fRLECount += 1;
00240         else {
00241             if ((err = FlushRLE(encv)) != noErr) return err;
00242             encv->fRLECharacter = *ch;
00243             encv->fRLECount = 1;
00244         }
00245     }
00246     return err;
00247 }
00248
00249 static OSErr RLEWriteEnd(HQXEncVarsPtr encv) {
00250     OSErr err;
00251     if ((err = FlushRLE(encv)) != noErr) return err;
00252     if ((err = HQXWriteEnd(encv)) != noErr) return err;
00253     return BUFFWriteEnd(encv);
00254 }
00255
00256
00257 static OSErr WriterInit(HQXEncVarsPtr encv, HQXSink dst, long refcon) {
00258     OSErr err;
00259     char *p;
00260     p = "(This file must be converted with BinHex 4.0)\n:";
00261     encv->fRLECount = 0;
00262     encv->fOutBufp = encv->fOutBuffer;
00263     encv->fSink = dst;
00264     encv->fSinkRefCon = refcon;
00265     if ((err = BUFFWrite(encv, p, strlen(p))) != noErr) return err;
00266     encv->fNOutChars = 1;
00267     encv->fBitBuffer = encv->fBitBufferBits = 0;
00268     return noErr;
00269 }
00270
00271 /* CRC OUTPUT */
00272
00273
00274 static OSErr CRCWriteInit(HQXEncVarsPtr encv) {
00275     encv->fCRC = initial_crc();
00276     return noErr;
00277 }
00278
00279 static OSErr CRCWrite(HQXEncVarsPtr encv, void* buffer, long count) {
00280     encv->fCRC = crc_run(encv->fCRC, buffer, count);
00281     return RLEWrite(encv, buffer, count);
00282 }
00283
00284 static OSErr CRCWriteEnd(HQXEncVarsPtr encv) {
00285     encv->fCRC = crc_byte(encv->fCRC, 0);
00286     encv->fCRC = crc_byte(encv->fCRC, 0);
00287     return RLEWrite(encv, &encv->fCRC, 2);
00288 }
00289
00290
00291 OSErr HQXEncode(StringPtr name, short vol, long dir, HQXSink dst, long refcon) {
00292     OSErr err;
00293     long zero, bytecount, actcount;
00294     short refnum;
00295     HParamBlockRec pb;
00296     HQXEncVarsPtr encv;
00297 #ifdef CVS_CHANGES
00298     Point zeroPoint = {0, 0};
00299 #endif
00300
00301         /* set up */
00302     zero = 0;
00303     refnum = 0;
00304     encv = NULL;
00305     HQXInit();
00306     encv = (HQXEncVarsPtr) NewPtrClear(sizeof(HQXEncodeVars));
00307     if ((err = MemError()) != noErr) goto bail;
00308     encv->fRLECount = 0;
00309
00310     err = WriterInit(encv, dst, refcon);
00311     if (err != noErr) goto bail;
00312
00313         /* hqx file header */
00314     err = CRCWriteInit(encv);
00315     if (err != noErr) goto bail;
00316         memset(&pb, 0, sizeof(pb));
00317         pb.fileParam.ioNamePtr = name;
00318         pb.fileParam.ioDirID = dir;
00319         pb.fileParam.ioVRefNum = vol;
00320         pb.fileParam.ioFDirIndex = 0;
00321         pb.fileParam.ioFVersNum = 0;
00322         err = PBHGetFInfoSync(&pb);
00323         if (err != noErr) goto bail;
00324 #ifdef CVS_CHANGES
00325         /* the name is no use for cvs */
00326         err = CRCWrite(encv, "\p", 1);
00327 #else
00328         err = CRCWrite(encv, name, *name + 1);
00329 #endif
00330         if (err != noErr) goto bail;
00331         err = CRCWrite(encv, &zero, 1);
00332         if (err != noErr) goto bail;
00333 #ifdef CVS_CHANGES
00334         /* let remove some user specific flags which may differ with the repository file */
00335         pb.fileParam.ioFlFndrInfo.fdFldr = 0;
00336         pb.fileParam.ioFlFndrInfo.fdLocation = zeroPoint;
00337         pb.fileParam.ioFlFndrInfo.fdFlags &= ~(kNameLocked | kHasBeenInited);
00338 #endif
00339         err = CRCWrite(encv, &pb.fileParam.ioFlFndrInfo, 10);
00340         if (err != noErr) goto bail;
00341         err = CRCWrite(encv, &pb.fileParam.ioFlLgLen, 4);
00342         if (err != noErr) goto bail;
00343         err = CRCWrite(encv, &pb.fileParam.ioFlRLgLen, 4);
00344         if (err != noErr) goto bail;
00345     err = CRCWriteEnd(encv);
00346     if (err != noErr) goto bail;
00347
00348         /*  file data fork */
00349     err = CRCWriteInit(encv);
00350     if (err != noErr) goto bail;
00351         err = HOpenDF(vol, dir, name, fsRdPerm, &refnum);
00352         if (err != noErr) goto bail;
00353         for (bytecount = 0; bytecount < pb.fileParam.ioFlLgLen; bytecount += actcount) {
00354             actcount = pb.fileParam.ioFlLgLen - bytecount;
00355             if (actcount > sizeof(encv->fInBuffer)) actcount = sizeof(encv->fInBuffer);
00356             err = FSRead(refnum, &actcount, encv->fInBuffer);
00357             if (err != noErr) goto bail;
00358             err = CRCWrite(encv, encv->fInBuffer, actcount);
00359             if (err != noErr) goto bail;
00360         }
00361         FSClose(refnum); refnum = 0;
00362     err = CRCWriteEnd(encv);
00363     if (err != noErr) goto bail;
00364
00365         /* file resource fork */
00366     err = CRCWriteInit(encv);
00367     if (err != noErr) goto bail;
00368         err = HOpenRF(vol, dir, name, fsRdPerm, &refnum);
00369         if (err != noErr) goto bail;
00370         for (bytecount = 0; bytecount < pb.fileParam.ioFlRLgLen; bytecount += actcount) {
00371             actcount = pb.fileParam.ioFlRLgLen - bytecount;
00372             if (actcount > sizeof(encv->fInBuffer)) actcount = sizeof(encv->fInBuffer);
00373             err = FSRead(refnum, &actcount, encv->fInBuffer);
00374             if (err != noErr) goto bail;
00375             err = CRCWrite(encv, encv->fInBuffer, actcount);
00376             if (err != noErr) goto bail;
00377         }
00378         FSClose(refnum); refnum = 0;
00379     err = CRCWriteEnd(encv);
00380     if (err != noErr) goto bail;
00381
00382     err = RLEWriteEnd(encv);
00383     if (err != noErr) goto bail;
00384     DisposePtr((Ptr) encv);
00385
00386     return noErr;
00387
00388 bail:
00389     if (refnum != 0) FSClose(refnum);
00390     if (encv != NULL) DisposePtr((Ptr) encv);
00391     return err;
00392 }
00393
00394
00395
00396
00397 /* BINHEX DECODER */
00398
00399
00400 /* HQX INPUT, HQXSource calls */
00401
00402 static OSErr GetNextCharacter(HQXDecVarsPtr decv, unsigned char* the_char) {
00403     OSErr err;
00404     long bytes;
00405     if (decv->fInBufp >= decv->fInBufMax) {
00406         err = decv->fSource(decv->fInBuffer, (bytes = sizeof(decv->fInBuffer), &bytes), decv->fSourceRefCon);
00407         if (err == eofErr) err = noErr;
00408         if (err != noErr) return err;
00409         decv->fInBufp = decv->fInBuffer;
00410         decv->fInBufMax = decv->fInBuffer + bytes;
00411         if (decv->fInBufp >= decv->fInBufMax) return eofErr;
00412     }
00413     *the_char = *decv->fInBufp++;
00414     return noErr;
00415 }
00416
00417 static OSErr HQXRead(HQXDecVarsPtr decv, void* buffer, long count) {
00418     unsigned char *dst, code;
00419     long i;
00420     long readcode;
00421     OSErr err;
00422
00423     dst = (unsigned char*) buffer;
00424     for ( i = 0; i < count; i++) {
00425         while (decv->fBitBufferBits < 8)  {
00426             readcode = -1;
00427             while (readcode < 0) {
00428                     /* get the next character */
00429                 err = GetNextCharacter(decv, &code);
00430                 if (err != noErr) return err;
00431                     /* look up the code in the table and dispatch on the value */
00432                 readcode = hqxtab[code];
00433                 if (readcode == -3) {
00434                     decv->fInHqxData = !decv->fInHqxData;
00435                 } else if (!decv->fInHqxData)
00436                     readcode = -1;
00437             }
00438             decv->fBitBuffer = (decv->fBitBuffer<<6) | readcode;
00439             decv->fBitBufferBits += 6;
00440         }
00441         *dst++ = (decv->fBitBuffer>>(decv->fBitBufferBits-8));
00442         decv->fBitBufferBits -= 8;
00443     }
00444
00445     return noErr;
00446 }
00447
00448
00449 /* RLE INPUT,  HQXRead calls */
00450
00451 static OSErr RLERead(HQXDecVarsPtr decv, void* buffer, long count) {
00452     unsigned char *ch, nextchar, countvalue;
00453     long i;
00454     OSErr err;
00455
00456     ch = (unsigned char*) buffer;
00457     err = noErr;
00458     for ( i=0; i < count; )
00459         if (decv->fRLECount > 0) {
00460             *ch++ = decv->fRLECharacter;
00461             decv->fRLECount--;
00462             i++;
00463         } else {
00464             if ((err = HQXRead(decv, &nextchar, 1)) != noErr) return err;
00465             if (nextchar == kRLEFlag) {
00466                 if ((err = HQXRead(decv, &countvalue, 1)) != noErr) return err;
00467                 if (countvalue == 0) {
00468                     decv->fRLECharacter = kRLEFlag;
00469                     decv->fRLECount = 1;
00470                 } else decv->fRLECount = countvalue - 1;
00471             } else {
00472                 decv->fRLECharacter = nextchar;
00473                 decv->fRLECount = 1;
00474             }
00475         }
00476
00477     return noErr;
00478 }
00479
00480
00481 /* CRC INPUT, RLERead calls */
00482
00483 static OSErr CRCReadInit(HQXDecVarsPtr decv) {
00484     decv->fCRC = initial_crc();
00485     return noErr;
00486 }
00487
00488 static OSErr CRCRead(HQXDecVarsPtr decv, void* buffer, long count) {
00489     OSErr err;
00490     if ((err = RLERead(decv, buffer, count)) != noErr) return err;
00491     decv->fCRC = crc_run(decv->fCRC, buffer, count);
00492     return noErr;
00493 }
00494
00495 static OSErr CRCReadEnd(HQXDecVarsPtr decv) {
00496     OSErr err;
00497     unsigned short saved_crc;
00498     if ((err = RLERead(decv, &saved_crc, 2)) != noErr) return err;
00499     decv->fCRC = crc_byte(decv->fCRC, 0);
00500     decv->fCRC = crc_byte(decv->fCRC, 0);
00501     if (saved_crc != decv->fCRC) return paramErr; else return noErr;
00502 }
00503
00504
00505
00506 /* FILE INPUT, CRCRead calls */
00507
00508 OSErr HQXDecode(HQXSource src, HQXNameFilter fname, Boolean can_replace, Boolean header_search, long refcon) {
00509     OSErr err;
00510     FInfo info, tinfo;
00511     long zero, bytecount, actcount, dir, data_length, rsrc_length;
00512     short refnum, vol;
00513     Str255 name;
00514     Boolean file_exists;
00515     HQXDecVarsPtr decv;
00516
00517         /* set up */
00518     HQXInit();
00519     decv = NULL;
00520     zero = 0;
00521     refnum = 0;
00522     vol = 0;
00523     dir = 0;
00524     file_exists = false;
00525
00526         /* allocate shared variables */
00527     decv = (HQXDecVarsPtr) NewPtrClear(sizeof(HQXDecodeVars));
00528     if ((err = MemError()) != noErr) goto bail;
00529
00530         /* reader globals */
00531     decv->fRLECount = 0;
00532     decv->fInBufMax = decv->fInBufp = decv->fInBuffer;
00533     decv->fSource = src;
00534     decv->fSourceRefCon = refcon;
00535     decv->fBitBuffer = decv->fBitBufferBits = 0;
00536     decv->fInHqxData = false;
00537
00538         /* search for the header string */
00539     if (header_search) {
00540         char *header, *headerp, inputchar;
00541         headerp = header = "(This file must be converted with BinHex 4.0)";
00542         while (*headerp != '\0') {
00543             err = GetNextCharacter(decv, (unsigned char*) &inputchar);
00544             if (err != noErr) goto bail;
00545             if (inputchar == *headerp) headerp++; else headerp = header;
00546         }
00547     }
00548
00549         /* hqx file header */
00550     err = CRCReadInit(decv);
00551     if (err != noErr) goto bail;
00552     err = CRCRead(decv, name, 1);
00553     if (err != noErr) goto bail;
00554     err = CRCRead(decv, name+1, *name);
00555     if (err != noErr) goto bail;
00556     err = CRCRead(decv, &zero, 1);
00557     if (err != noErr) goto bail;
00558     err = CRCRead(decv, &info, 10);
00559     if (err != noErr) goto bail;
00560     err = CRCRead(decv, &data_length, 4);
00561     if (err != noErr) goto bail;
00562     err = CRCRead(decv, &rsrc_length, 4);
00563     if (err != noErr) goto bail;
00564     err = CRCReadEnd(decv);
00565     if (err != noErr) goto bail;
00566
00567         /* create destination file */
00568     if (fname != NULL) {
00569         err = fname(name, &vol, &dir, refcon);
00570         if (err != noErr) goto bail;
00571     }
00572     if (can_replace) {
00573         err = HDelete(vol, dir, name);
00574         if (err == fnfErr) err = noErr;
00575         if (err != noErr) goto bail;
00576     }
00577     err = HCreate(vol, dir, name, info.fdCreator, info.fdType);
00578     if (err != noErr) goto bail;
00579     file_exists = true;
00580     err = HGetFInfo(vol, dir, name, &tinfo);
00581     if (err != noErr) goto bail;
00582 #ifdef CVS_CHANGES
00583     tinfo.fdFlags = info.fdFlags & (~(kNameLocked | kHasBeenInited));
00584 #else
00585     tinfo.fdFlags = info.fdFlags & (~kHasBeenInited);
00586 #endif
00587     err = HSetFInfo(vol, dir, name, &tinfo);
00588     if (err != noErr) goto bail;
00589
00590         /* file data fork */
00591     err = CRCReadInit(decv);
00592     if (err != noErr) goto bail;
00593     err = HOpenDF(vol, dir, name, fsRdWrPerm, &refnum);
00594     if (err != noErr) goto bail;
00595     for (bytecount = 0; bytecount < data_length; bytecount += actcount) {
00596         actcount = data_length - bytecount;
00597         if (actcount > sizeof(decv->fOutBuffer)) actcount = sizeof(decv->fOutBuffer);
00598         err = CRCRead(decv, decv->fOutBuffer, actcount);
00599         if (err != noErr) goto bail;
00600         err = FSWrite(refnum, &actcount, decv->fOutBuffer);
00601         if (err != noErr) goto bail;
00602     }
00603     FSClose(refnum); refnum = 0;
00604     err = CRCReadEnd(decv);
00605     if (err != noErr) goto bail;
00606
00607         /* file resource fork */
00608     err = CRCReadInit(decv);
00609     if (err != noErr) goto bail;
00610     err = HOpenRF(vol, dir, name, fsRdWrPerm, &refnum);
00611     if (err != noErr) goto bail;
00612     for (bytecount = 0; bytecount < rsrc_length; bytecount += actcount) {
00613         actcount = rsrc_length - bytecount;
00614         if (actcount > sizeof(decv->fOutBuffer)) actcount = sizeof(decv->fOutBuffer);
00615         err = CRCRead(decv, decv->fOutBuffer, actcount);
00616         if (err != noErr) goto bail;
00617         err = FSWrite(refnum, &actcount, decv->fOutBuffer);
00618         if (err != noErr) goto bail;
00619     }
00620     FSClose(refnum); refnum = 0;
00621     err = CRCReadEnd(decv);
00622     if (err != noErr) goto bail;
00623
00624     DisposePtr((Ptr) decv);
00625     return noErr;
00626
00627 bail:
00628     if (refnum != 0) FSClose(refnum);
00629     if (file_exists) HDelete(vol, dir, name);
00630     if (decv != NULL) DisposePtr((Ptr) decv);
00631     return err;
00632 }
00633
00634
00635 /* end of file hqx.c */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/hqx.h Source File

cvs-1.10/macintosh/hqx.h

Go to the documentation of this file.
00001
00002 #ifndef __HQX__
00003 #define __HQX__
00004
00005 /* file hqx.h
00006     BinHex decoder/encoder routines, definitions.
00007     Copyright (c) 1995, 1996, 1997 by John Montbriand.  All Rights Reserved.
00008     Permission hereby granted for public use.
00009         Distribute freely in areas where the laws of copyright apply.
00010     USE AT YOUR OWN RISK.
00011     DO NOT DISTRIBUTE MODIFIED COPIES.
00012     Comments/questions/postcards* to the author at the address:
00013       John Montbriand
00014       P.O. Box. 1133
00015       Saskatoon Saskatchewan Canada
00016       S7K 3N2
00017     or by email at:
00018       tinyjohn@sk.sympatico.ca
00019     *if you mail a postcard, then I will provide you with technical support
00020     regarding questions you may have about this file.
00021 */
00022
00023 /* routines for encoding or decoding binhex files.  These routines are designed
00024 for use with any data source/sink.  They are re-entrant so they can be used
00025 in several threads simultaneously. System 6 on up...  Can handle any file
00026 size.  Uses a chained read/write algorithm so memory requirements are low.  */
00027
00028 #include <Types.h>
00029 #include <Files.h>
00030
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034
00035 /* BINHEX ENCODER -- encode a macintosh file in binhex format */
00036 /*    output is sent to a user-defined output sink. */
00037
00038 /* HQXSink defines a function that will receive data produced by
00039     the HQXEncode routine.  refcon is available for your application's
00040     use and is the same refcon value passed to HQXEncode.  returning
00041     any error code other than noErr will abort HQXEncode.  HQXEncode
00042     implements a buffering scheme of its own, so there is no need for
00043     your sink function to be concerned about buffering data. */
00044 typedef OSErr (*HQXSink)(void* buffer, long count, long refcon);
00045
00046 /* HQXEncode reads the indicated macintosh file and outputs the binhex
00047     equivalent to the sink.  If the HQXSink returns a non-zero result code,
00048     then execution stops and HQXEncode will return the result.  refcon
00049     is a value passed to the sink function.  */
00050 OSErr HQXEncode(StringPtr name, short vol, long dir, HQXSink dst, long refcon);
00051
00052
00053
00054 /* BINHEX DECODER -- decode binhex input extracted from a user */
00055 /* defined input source.   Only Binhex characters delimited by colons */
00056 /* are converted and multiple binhex data sections are allowed. */
00057 /* For example,  the data: */
00058 /*       :"@KaH#jS!:     ...some garbage characters...  :&4&@&40: */
00059 /* is processed the same as the binhex sequence:*/
00060 /*       :"@KaH#jS!&4&@&40: */
00061
00062
00063 /* HQXSource defines a function providing a data source for the HQXDecode
00064     routine.  Your function should attempt to read *count bytes to the
00065     buffer.  Before returning, your function should set *count to the
00066     actual number of bytes read into the buffer.  If count is zero, or the
00067     source function returns some result other than eofErr, HQXDecode
00068     aborts processing.  HQXDecode implements its own buffering scheme
00069     so your source function need not be concerned about buffering.  */
00070 typedef OSErr (*HQXSource)(void* buffer, long *count, long refcon);
00071
00072 /* HQXNameFilter is an optional routine allowing your application oportunity
00073     to modify the file name and location of the macintosh file being decoded.
00074     If your filter function returns a non-zero result code, HQXDecode stops
00075     processing data from the source and returns the result code.  when
00076     HQXNameFilter is called, name is the name of the file and *vol and
00077     *dir will be zero.  Your routine can modify any or all of these parameters
00078     to specify a different output file.  */
00079 typedef OSErr (*HQXNameFilter)(StringPtr name, short *vol, long *dir, long refcon);
00080
00081 /* HQXDecode decodes a binhex file using data from the source function.
00082     fname, if not NULL, is called once the file name has been extracted from
00083     the binhex data so you can change where the file is saved.  if can_replace
00084     is true then decoded files will replace files with the same name.  refcon
00085     is an application-specific parameter passed to both the name filter function
00086     and the source function.  if header_search is true, the routine does a
00087     search for the string "(This file must be converted with BinHex 4.0)"
00088     before beginning decoding binhex data.  */
00089 OSErr HQXDecode(HQXSource src, HQXNameFilter fname, Boolean can_replace,
00090     Boolean header_search, long refcon);
00091
00092 #ifdef __cplusplus
00093 }
00094 #endif
00095
00096 #endif
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/kclient_if.c Source File

cvs-1.10/macintosh/kclient_if.c

Go to the documentation of this file.
00001 /*
00002  *   Copyright ©1997 by the Massachusetts Institute of Technology
00003  *   All rights reserved.
00004  */
00005
00006 /* Warning: this is a hack!
00007  * This file contains functions that are supposed to look like kerberos calls, feel like
00008  * kerberos calls, but they actually make some really gross assumptions. They work for
00009  * CVS, and they make some assumptions about the way they are called from CVS.
00010  * Details below.
00011  */
00012
00013 #ifdef HAVE_CONFIG_H
00014 #include "config.h"
00015 #endif /* HAVE_CONFIG_H */
00016
00017 #if defined (HAVE_KERBEROS) && defined (USE_KCLIENT)
00018
00019 #include "kclient_if.h"
00020
00021 char errorStr [64];
00022
00023 KClientSessionInfo KSession;
00024
00025 /*
00026  * This does -not- work in the same way krb_sendauth is supposed to work on any other
00027  * platform.
00028  * - The only option it understands is KOPT_DO_MUTUAL. It ignores all other options.
00029  * - It pays no attention to ticket. It will never return the ticket to the caller
00030  *      (in the case of CVS, the ticket doesn't matter anyways.)
00031  * - It ignores msg_data. CVS ignores it as well.
00032  * - It ignores credentials. So does CVS.
00033  */
00034
00035 int
00036 krb_sendauth (
00037     long options,
00038     int fd,
00039     KTEXT ticket,
00040     char *service,
00041     char *inst,
00042     char *realm,
00043     u_long checksum,
00044     MSG_DAT *msg_data,
00045     CREDENTIALS *cred,
00046     Key_schedule schedule,
00047     struct sockaddr_in *laddr,
00048     struct sockaddr_in *faddr,
00049     char *version)
00050      /* options: bit-pattern of options */
00051      /* fd: file descriptor to write onto */
00052      /* ticket: where to put ticket (return); or supplied in case of KOPT_DONT_MK_REQ */
00053      /* service, inst, realm: service name, instance, realm */
00054      /* checksum: checksum to include in request */
00055      /* msg_data: mutual auth MSG_DAT (return) */
00056      /* cred: credentials (return) */
00057      /* schedule: key schedule (return) */
00058      /* laddr: local address */
00059      /* faddr: address of foreign host on fd */
00060      /* version: version string */
00061 {
00062 #pragma unused (ticket)
00063 #pragma unused (msg_data)
00064 #pragma unused (cred)
00065 #pragma unused (schedule)
00066
00067     OSErr err = noErr;
00068     char KService [SNAME_SZ + INST_SZ + 2];
00069     char KBuf [BUFSIZ];
00070     unsigned long KBuflen = BUFSIZ;
00071     long KChecksum = checksum;
00072     char* KVersion = version;
00073
00074     err = KClientInitSession (&KSession, laddr -> sin_addr.s_addr, laddr -> sin_port, faddr -> sin_addr.s_addr, faddr -> sin_port);
00075
00076     if (err != noErr)
00077         return err;
00078
00079     err = KClientSetLocalRealm (realm);
00080
00081     if (err != noErr)
00082         return err;
00083
00084     /* Truncate inst at the first period */
00085     inst [strcspn (inst, ".")] = '\0';
00086
00087     sprintf (KService, "%s.%s", service, inst);
00088
00089     err = KClientMakeSendAuth (&KSession, KService, KBuf, &KBuflen, KChecksum, KVersion);
00090
00091     if (err != noErr)
00092         return err;
00093
00094     if (write (fd, KBuf, KBuflen) != KBuflen)
00095         return KFAILURE;
00096
00097     if (options & KOPT_DO_MUTUAL)
00098     {
00099         unsigned long bytesRead = 0;
00100 /* first read the size of the data blob */
00101
00102         if (read (fd, KBuf, sizeof (KBuflen)) != sizeof (KBuflen))
00103             return KFAILURE;
00104
00105 /* then read the data */
00106         KBuflen = *(unsigned long*) KBuf;
00107
00108         while (bytesRead < KBuflen)
00109         {
00110             unsigned long chunkRead = read (fd, KBuf + bytesRead + sizeof (KBuflen), KBuflen - bytesRead);
00111             if (chunkRead < 0)
00112                 return KFAILURE;
00113             bytesRead += chunkRead;
00114         }
00115
00116         err = KClientVerifySendAuth (&KSession, KBuf, &KBuflen);
00117         if (err != noErr)
00118             return err;
00119     }
00120
00121     return KSUCCESS;
00122 }
00123
00124 char*
00125 krb_realmofhost (
00126     char *host)
00127 {
00128     char*   realm = malloc (REALM_SZ);
00129     KClientGetRealm (host, realm);
00130     return realm;
00131 }
00132
00133 char*
00134 krb_get_err_text (
00135     int status)
00136 {
00137     KClientErrorText (status, errorStr);
00138     return errorStr;
00139 }
00140
00141 #endif /* HAVE_KERBEROS && USE_KCLIENT */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/kclient_if.h Source File

cvs-1.10/macintosh/kclient_if.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright ©1997 by the Massachusetts Institute of Technology
00003  *   All rights reserved.
00004  */
00005
00006 #include <KrbDriver.h>
00007 #include <KClient.h>
00008
00009 extern char *krb_get_err_text(int status);
00010 #define HAVE_KRB_GET_ERR_TEXT
00011
00012 extern  KClientSessionInfo  KSession;
00013
00014 /*
00015  * In order to get CVS to build right we need to provide some things from
00016  * krb.h, because we are pretending to use MIT krb v4 interface
00017  */
00018
00019 /* Defines for krb_sendauth and krb_recvauth */
00020
00021 #define KOPT_DO_MUTUAL   0x00000002 /* do mutual auth */
00022
00023 /* General definitions */
00024 #define     KSUCCESS    0
00025 #define     KFAILURE    255
00026
00027 /* Text describing error codes */
00028 //#define       MAX_KRB_ERRORS  256
00029 //extern char *krb_err_txt[MAX_KRB_ERRORS];
00030
00031 /* function prototypes from sendauth.c */
00032 int krb_sendauth(long options, int fd, KTEXT ticket, char *service,
00033                  char *inst, char *realm, u_long checksum, MSG_DAT *msg_data,
00034          CREDENTIALS *cred, Key_schedule schedule,
00035          struct sockaddr_in *laddr, struct sockaddr_in *faddr,
00036          char *version);
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/lsh_dll.h Source File

cvs-1.10/macintosh/lsh_dll.h

Go to the documentation of this file.
00001 /*
00002  * lsh_dll.h
00003  * (c) 2000 Jean-Pierre Stierlin.
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License as
00007  * published by the Free Software Foundation; either version 2 of the
00008  * License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful, but
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013  * General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 #ifndef LSH_DLL_H_
00020 #define LSH_DLL_H_
00021
00022 typedef void *lshctx;
00023
00024 typedef void (*hdlevtfunc)(long userData, long sleepTime);
00025 typedef void (*logfunc)(long userData, const char *message);
00026 typedef char *(*getpassfunc)(long userData, const char *prompt);
00027 typedef int (*yesornofunc)(long userData, const char *prompt, int def);
00028
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032
00033 /*
00034  * lsh_new
00035  *
00036  * input:
00037  *
00038  *  - argstr:    argument string (see Usage below).
00039  *  - hdlevt     callback to main event handler
00040  *  - log:       callback for lsh logs
00041  *  - getpass:   called upon password request
00042  *  - yes_or_no: called upon new host keys confirmation request
00043  *
00044  *  returns:
00045  *
00046  *  - opaque lshctx struct to use for further calls
00047  *
00048  * --------------------------------------------------------------------------------
00049  *
00050  *  Usage: lsh [OPTION...] host
00051  *    or:  lsh [OPTION...] host command ...
00052  *  Connects to a remote machine
00053  *
00054  *        --capture-to=File      When a new hostkey is received, append an ACL
00055  *                               expressing trust in the key. In sloppy mode, the
00056  *                               default is captured_keys.
00057  *        --dh-keyexchange       Enable DH support (default, unless SRP is being
00058  *                               used).
00059  *        --host-db=Filename     By default, known_hosts
00060  *    -i, --identity=Identity key   Use this key to authenticate.
00061  *        --no-dh-keyexchange    Disable DH support.
00062  *        --no-publickey         Don't try publickey user authentication.
00063  *        --no-srp-keyexchange   Disable experimental SRP support (default).
00064  *        --no-userauth          Request the ssh-userauth service (default if SRP
00065  *                               is used).
00066  *        --publickey            Try publickey user authentication (default).
00067  *        --sloppy-host-authentication
00068  *                               Allow untrusted hostkeys.
00069  *        --srp-keyexchange      Enable experimental SRP support.
00070  *        --strict-host-authentication
00071  *                               Never, never, ever trust an unknown hostkey.
00072  *                               (default)
00073  *        --userauth             Request the ssh-userauth service (default, unless
00074  *                               SRP is being used).
00075  *        --debug                Print huge amounts of debug information
00076  *    -q, --quiet                Suppress all warnings and diagnostic messages
00077  *        --trace                Detailed trace
00078  *    -v, --verbose              Verbose diagnostic messages
00079  *
00080  *   Algorithm selection:
00081  *    -c, --crypto=Algorithm
00082  *        --hostkey-algorithm=Algorithm
00083  *        --list-algorithms      List supported algorithms.
00084  *    -m, --mac=Algorithm
00085  *    -z, --compression[=Algorithm]   Default is zlib.
00086  *
00087  *    -l, --user=User name       Login as this user.
00088  *    -p, --port=Port            Connect to this port.
00089  *
00090  *   Actions:
00091  *    -E, --execute=command      Execute a command on the remote machine
00092  *    -L, --forward-local-port=local-port:target-host:target-port
00093  *    -N, --nop                  No operation (suppresses the default action, which
00094  *                               is to spawn a remote shell)
00095  *    -S, --shell=command        Spawn a remote shell
00096  *
00097  *   Universal not:
00098  *    -n, --no                   Inverts the effect of the next modifier
00099  *
00100  *   Modifiers that apply to port forwarding:
00101  *    -g, --remote-peers         Allow remote access to forwarded ports
00102  *        --no-remote-peers      Disallow remote access to forwarded ports
00103  *                               (default).
00104  *
00105  *   Modifiers that apply to remote execution:
00106  *        --no-pty               Don't request a remote pty.
00107  *        --no-stderr            Redirect stderr to /dev/null
00108  *        --no-stdin             Redirect stdin from /dev/null
00109  *        --no-stdout            Redirect stdout to /dev/null
00110  *        --stderr=Filename      Redirect stderr
00111  *        --stdin=Filename       Redirect stdin
00112  *        --stdout=Filename      Redirect stdout
00113  *    -t, --pty                  Request a remote pty (default).
00114  *
00115  *    -R, --forward-remote-port=remote-port:target-host:target-port
00116  *
00117  *    -?, --help                 Give this help list
00118  *        --usage                Give a short usage message
00119  *    -V, --version              Print program version
00120  *
00121  *  Mandatory or optional arguments to long options are also mandatory or optional
00122  *  for any corresponding short options.
00123  *
00124  *  Connects to the remote machine, and then performs one or more actions, i.e.
00125  *  command execution, various forwarding services. The default action is to start
00126  *  a remote interactive shell or execute a given command on the remote machine.
00127  *
00128  * --------------------------------------------------------------------------------
00129  *  Sample argstr:
00130  *
00131  *  lsh -lusername -iidentityfile --sloppy-host-authentication 192.168.1.41
00132  *
00133  *  *IMPORTANT* all the data after the first argument (i.e. the hostname)
00134  *      are passed as a command to launch on the server.
00135  */
00136
00137 lshctx *lsh_new(char *argstr, hdlevtfunc hdlevt, logfunc log, getpassfunc getpass, yesornofunc yes_or_no, long userData);
00138
00139 void lsh_delete(lshctx *ctx);
00140
00141 void lsh_yield();
00142
00143 int lsh_read(lshctx *ctx, void *buffer, long inbytes);
00144
00145 long lsh_write(lshctx *ctx, const void *buffer, long inbytes);
00146
00147 int lsh_canread(lshctx *ctx);
00148
00149 int lsh_canwrite(lshctx *ctx);
00150
00151 char *lsh_getprefsd();
00152
00153 lshctx *lsh_current();
00154
00155 Boolean lsh_running(lshctx *ctx);
00156
00157 void lsh_init(void);
00158
00159 void lsh_terminate(void);
00160
00161 #ifdef __cplusplus
00162 }
00163 #endif
00164
00165 #endif
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/mac_filesubr.c Source File

cvs-1.10/macintosh/mac_filesubr.c

Go to the documentation of this file.
00001 /* filesubr.c --- subroutines for dealing with files
00002    Jim Blandy <jimb@cyclic.com>
00003
00004    This file is part of GNU CVS.
00005
00006    GNU CVS is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published by the
00008    Free Software Foundation; either version 2, or (at your option) any
00009    later version.
00010
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.  */
00015
00016 /* These functions were moved out of subr.c because they need different
00017    definitions under operating systems (like, say, Windows NT) with different
00018    file system semantics.  */
00019
00020 #include "cvs.h"
00021
00022 #ifdef macintosh
00023 /* I don't know why this file was extracted from the src folder. The differences
00024 with the other one are not that big and we should pretty fast merge with the
00025 official one (alexp) */
00026 #include "cvs_hqx.h"
00027 #endif
00028
00029 static int deep_remove_dir PROTO((const char *path));
00030
00031 /*
00032  * Copies "from" to "to".
00033  */
00034 void
00035 copy_file (from, to)
00036     const char *from;
00037     const char *to;
00038 {
00039     struct stat sb;
00040     struct utimbuf t;
00041     int fdin, fdout;
00042
00043     if (trace)
00044     (void) fprintf (stderr, "%s-> copy(%s,%s)\n",
00045             CLIENT_SERVER_STR, from, to);
00046     if (noexec)
00047     return;
00048
00049 #ifdef macintosh
00050     CVS_UNLINK(to); /* MacOS doesn't expect that */
00051     if(mac_duplicate(from, to) != 0)
00052         error (1, errno, "cannot copy %s to %s", from, to);
00053     return;
00054 #endif
00055
00056     /* If the file to be copied is a link or a device, then just create
00057        the new link or device appropriately. */
00058     if (islink (from))
00059     {
00060     char *source = xreadlink (from);
00061     symlink (source, to);
00062     free (source);
00063     return;
00064     }
00065
00066     if (isdevice (from))
00067     {
00068     if (stat (from, &sb) < 0)
00069         error (1, errno, "cannot stat %s", from);
00070     mknod (to, sb.st_mode, sb.st_rdev);
00071     }
00072     else
00073     {
00074     /* Not a link or a device... probably a regular file. */
00075     if ((fdin = open (from, O_RDONLY)) < 0)
00076         error (1, errno, "cannot open %s for copying", from);
00077     if (fstat (fdin, &sb) < 0)
00078         error (1, errno, "cannot fstat %s", from);
00079     if ((fdout = creat (to, (int) sb.st_mode & 07777)) < 0)
00080         error (1, errno, "cannot create %s for copying", to);
00081     if (sb.st_size > 0)
00082     {
00083         char buf[BUFSIZ];
00084         int n;
00085
00086         for (;;)
00087         {
00088         n = read (fdin, buf, sizeof(buf));
00089         if (n == -1)
00090         {
00091 #ifdef EINTR
00092             if (errno == EINTR)
00093             continue;
00094 #endif
00095             error (1, errno, "cannot read file %s for copying", from);
00096         }
00097         else if (n == 0)
00098             break;
00099
00100         if (write(fdout, buf, n) != n) {
00101             error (1, errno, "cannot write file %s for copying", to);
00102         }
00103         }
00104
00105 #ifdef HAVE_FSYNC
00106         if (fsync (fdout))
00107         error (1, errno, "cannot fsync file %s after copying", to);
00108 #endif
00109     }
00110
00111     if (close (fdin) < 0)
00112         error (0, errno, "cannot close %s", from);
00113     if (close (fdout) < 0)
00114         error (1, errno, "cannot close %s", to);
00115     }
00116
00117     /* now, set the times for the copied file to match those of the original */
00118     memset ((char *) &t, 0, sizeof (t));
00119     t.actime = sb.st_atime;
00120     t.modtime = sb.st_mtime;
00121     (void) utime (to, &t);
00122 }
00123
00124 /* FIXME-krp: these functions would benefit from caching the char * &
00125    stat buf.  */
00126
00127 /*
00128  * Returns non-zero if the argument file is a directory, or is a symbolic
00129  * link which points to a directory.
00130  */
00131 int
00132 isdir (file)
00133     const char *file;
00134 {
00135     struct stat sb;
00136
00137     if ( CVS_STAT (file, &sb) < 0)
00138     return (0);
00139     return (S_ISDIR (sb.st_mode));
00140 }
00141
00142 /*
00143  * Returns non-zero if the argument file is a symbolic link.
00144  */
00145 int
00146 islink (file)
00147     const char *file;
00148 {
00149 #ifdef S_ISLNK
00150     struct stat sb;
00151
00152     if (CVS_LSTAT (file, &sb) < 0)
00153     return (0);
00154     return (S_ISLNK (sb.st_mode));
00155 #else
00156     return (0);
00157 #endif
00158 }
00159
00160 /*
00161  * Returns non-zero if the argument file is a block or
00162  * character special device.
00163  */
00164 int
00165 isdevice (file)
00166     const char *file;
00167 {
00168     struct stat sb;
00169
00170     if (CVS_LSTAT (file, &sb) < 0)
00171     return (0);
00172 #ifdef S_ISBLK
00173     if (S_ISBLK (sb.st_mode))
00174     return 1;
00175 #endif
00176 #ifdef S_ISCHR
00177     if (S_ISCHR (sb.st_mode))
00178     return 1;
00179 #endif
00180     return 0;
00181 }
00182
00183 /*
00184  * Returns non-zero if the argument file exists.
00185  */
00186 int
00187 isfile (file)
00188     const char *file;
00189 {
00190     return isaccessible(file, F_OK);
00191 }
00192
00193 /*
00194  * Returns non-zero if the argument file is readable.
00195  */
00196 int
00197 isreadable (file)
00198     const char *file;
00199 {
00200     return isaccessible(file, R_OK);
00201 }
00202
00203 /*
00204  * Returns non-zero if the argument file is writable.
00205  */
00206 int
00207 iswritable (file)
00208     const char *file;
00209 {
00210     return isaccessible(file, W_OK);
00211 }
00212
00213 /*
00214  * Returns non-zero if the argument file is accessable according to
00215  * mode.  If compiled with SETXID_SUPPORT also works if cvs has setxid
00216  * bits set.
00217  */
00218 int
00219 isaccessible (file, mode)
00220     const char *file;
00221     const int mode;
00222 {
00223 #ifdef SETXID_SUPPORT
00224     struct stat sb;
00225     int umask = 0;
00226     int gmask = 0;
00227     int omask = 0;
00228     int uid;
00229
00230     if ( CVS_STAT (file, &sb) == -1)
00231     return 0;
00232     if (mode == F_OK)
00233     return 1;
00234
00235     uid = geteuid();
00236     if (uid == 0)       /* superuser */
00237     {
00238     if (mode & X_OK)
00239         return sb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH);
00240     else
00241         return 1;
00242     }
00243
00244     if (mode & R_OK)
00245     {
00246     umask |= S_IRUSR;
00247     gmask |= S_IRGRP;
00248     omask |= S_IROTH;
00249     }
00250     if (mode & W_OK)
00251     {
00252     umask |= S_IWUSR;
00253     gmask |= S_IWGRP;
00254     omask |= S_IWOTH;
00255     }
00256     if (mode & X_OK)
00257     {
00258     umask |= S_IXUSR;
00259     gmask |= S_IXGRP;
00260     omask |= S_IXOTH;
00261     }
00262
00263     if (sb.st_uid == uid)
00264     return (sb.st_mode & umask) == umask;
00265     else if (sb.st_gid == getegid())
00266     return (sb.st_mode & gmask) == gmask;
00267     else
00268     return (sb.st_mode & omask) == omask;
00269 #else
00270     return CVS_ACCESS (file, mode) == 0;
00271 #endif
00272 }
00273
00274 /*
00275  * Open a file and die if it fails
00276  */
00277 FILE *
00278 open_file (name, mode)
00279     const char *name;
00280     const char *mode;
00281 {
00282     FILE *fp;
00283
00284     if ((fp = CVS_FOPEN (name, mode)) == NULL)
00285     error (1, errno, "cannot open %s", name);
00286     return (fp);
00287 }
00288
00289 /*
00290  * Make a directory and die if it fails
00291  */
00292 void
00293 make_directory (name)
00294     const char *name;
00295 {
00296     struct stat sb;
00297
00298     if ( CVS_STAT (name, &sb) == 0 && (!S_ISDIR (sb.st_mode)))
00299         error (0, 0, "%s already exists but is not a directory", name);
00300     if (!noexec && CVS_MKDIR (name, 0777) < 0)
00301     error (1, errno, "cannot make directory %s", name);
00302 }
00303
00304 /*
00305  * Make a path to the argument directory, printing a message if something
00306  * goes wrong.
00307  */
00308 void
00309 make_directories (name)
00310     const char *name;
00311 {
00312     char *cp;
00313
00314     if (noexec)
00315     return;
00316
00317     if ( CVS_MKDIR (name, 0777) == 0 || errno == EEXIST)
00318     return;
00319     if (! existence_error (errno))
00320     {
00321     error (0, errno, "cannot make path to %s", name);
00322     return;
00323     }
00324     if ((cp = strrchr (name, '/')) == NULL)
00325     return;
00326     *cp = '\0';
00327     make_directories (name);
00328     *cp++ = '/';
00329     if (*cp == '\0')
00330     return;
00331     (void) CVS_MKDIR (name, 0777);
00332 }
00333
00334 /* Create directory NAME if it does not already exist; fatal error for
00335    other errors.  Returns 0 if directory was created; 1 if it already
00336    existed.  */
00337 int
00338 mkdir_if_needed (name)
00339     char *name;
00340 {
00341     if (CVS_MKDIR (name, 0777) < 0)
00342     {
00343     if (!(errno == EEXIST
00344           || (errno == EACCES && isdir (name))))
00345         error (1, errno, "cannot make directory %s", name);
00346     return 1;
00347     }
00348     return 0;
00349 }
00350
00351 /*
00352  * Change the mode of a file, either adding write permissions, or removing
00353  * all write permissions.  Either change honors the current umask setting.
00354  *
00355  * Don't do anything if PreservePermissions is set to `yes'.  This may
00356  * have unexpected consequences for some uses of xchmod.
00357  */
00358 void
00359 xchmod (fname, writable)
00360     char *fname;
00361     int writable;
00362 {
00363     struct stat sb;
00364     mode_t mode, oumask;
00365
00366     if (preserve_perms)
00367     return;
00368
00369     if ( CVS_STAT (fname, &sb) < 0)
00370     {
00371     if (!noexec)
00372         error (0, errno, "cannot stat %s", fname);
00373     return;
00374     }
00375     oumask = umask (0);
00376     (void) umask (oumask);
00377     if (writable)
00378     {
00379     mode = sb.st_mode | (~oumask
00380                  & (((sb.st_mode & S_IRUSR) ? S_IWUSR : 0)
00381                 | ((sb.st_mode & S_IRGRP) ? S_IWGRP : 0)
00382                 | ((sb.st_mode & S_IROTH) ? S_IWOTH : 0)));
00383     }
00384     else
00385     {
00386     mode = sb.st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH) & ~oumask;
00387     }
00388
00389     if (trace)
00390     (void) fprintf (stderr, "%s-> chmod(%s,%o)\n",
00391             CLIENT_SERVER_STR, fname,
00392             (unsigned int) mode);
00393     if (noexec)
00394     return;
00395
00396     if (chmod (fname, mode) < 0)
00397     error (0, errno, "cannot change mode of file %s", fname);
00398 }
00399
00400 /*
00401  * Rename a file and die if it fails
00402  */
00403 void
00404 rename_file (from, to)
00405     const char *from;
00406     const char *to;
00407 {
00408     if (trace)
00409     (void) fprintf (stderr, "%s-> rename(%s,%s)\n",
00410             CLIENT_SERVER_STR, from, to);
00411     if (noexec)
00412     return;
00413
00414 #ifdef macintosh
00415     CVS_UNLINK(to);
00416 #endif
00417     if ( CVS_RENAME (from, to) < 0)
00418     error (1, errno, "cannot rename file %s to %s", from, to);
00419 }
00420
00421 /*
00422  * unlink a file, if possible.
00423  */
00424 int
00425 unlink_file (f)
00426     const char *f;
00427 {
00428     if (trace)
00429     (void) fprintf (stderr, "%s-> unlink(%s)\n",
00430             CLIENT_SERVER_STR, f);
00431     if (noexec)
00432     return (0);
00433
00434     return ( CVS_UNLINK (f));
00435 }
00436
00437 /*
00438  * Unlink a file or dir, if possible.  If it is a directory do a deep
00439  * removal of all of the files in the directory.  Return -1 on error
00440  * (in which case errno is set).
00441  */
00442 int
00443 unlink_file_dir (f)
00444     const char *f;
00445 {
00446     struct stat sb;
00447
00448     if (trace
00449 #ifdef SERVER_SUPPORT
00450     /* This is called by the server parent process in contexts where
00451        it is not OK to send output (e.g. after we sent "ok" to the
00452        client).  */
00453     && !server_active
00454 #endif
00455     )
00456     (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f);
00457
00458     if (noexec)
00459     return (0);
00460
00461     /* For at least some unices, if root tries to unlink() a directory,
00462        instead of doing something rational like returning EISDIR,
00463        the system will gleefully go ahead and corrupt the filesystem.
00464        So we first call stat() to see if it is OK to call unlink().  This
00465        doesn't quite work--if someone creates a directory between the
00466        call to stat() and the call to unlink(), we'll still corrupt
00467        the filesystem.  Where is the Unix Haters Handbook when you need
00468        it?  */
00469     if (CVS_STAT (f, &sb) < 0)
00470     {
00471     if (existence_error (errno))
00472     {
00473         /* The file or directory doesn't exist anyhow.  */
00474         return -1;
00475     }
00476     }
00477     else if (S_ISDIR (sb.st_mode))
00478     return deep_remove_dir (f);
00479
00480     return CVS_UNLINK (f);
00481 }
00482
00483 /* Remove a directory and everything it contains.  Returns 0 for
00484  * success, -1 for failure (in which case errno is set).
00485  */
00486
00487 static int
00488 deep_remove_dir (path)
00489     const char *path;
00490 {
00491     DIR       *dirp;
00492     struct dirent *dp;
00493     char       buf[PATH_MAX];
00494 #ifdef macintosh
00495     char **files_to_delete = NULL;
00496     int num_files_to_delete = 0, i;
00497     int return_code = 0;
00498 #endif
00499
00500     if (CVS_RMDIR (path) != 0 && (errno == ENOTEMPTY || errno == EEXIST
00501 #ifdef macintosh
00502     || errno == EBUSY /* wrong mapping of GUSI */
00503 #endif
00504     ))
00505     {
00506     if ((dirp = CVS_OPENDIR (path)) == NULL)
00507         /* If unable to open the directory return
00508          * an error
00509          */
00510         return -1;
00511
00512     while ((dp = readdir (dirp)) != NULL)
00513     {
00514         if (strcmp (dp->d_name, ".") == 0 ||
00515             strcmp (dp->d_name, "..") == 0)
00516         continue;
00517
00518         sprintf (buf, "%s/%s", path, dp->d_name);
00519
00520         /* See comment in unlink_file_dir explanation of why we use
00521            isdir instead of just calling unlink and checking the
00522            status.  */
00523         if (isdir(buf))
00524         {
00525         if (deep_remove_dir(buf))
00526         {
00527             closedir(dirp);
00528             return -1;
00529         }
00530         }
00531         else
00532         {
00533 #ifdef macintosh
00534         if(files_to_delete == NULL)
00535             files_to_delete = (char **)xmalloc(sizeof(char *));
00536         else
00537             files_to_delete = (char **)xrealloc(files_to_delete, (num_files_to_delete + 1) * sizeof(char *));
00538         files_to_delete[num_files_to_delete++] = xstrdup(buf);
00539 #else
00540         if (CVS_UNLINK (buf) != 0)
00541         {
00542             closedir(dirp);
00543             return -1;
00544         }
00545 #endif
00546         }
00547     }
00548     closedir (dirp);
00549
00550 #ifdef macintosh
00551     for(i = 0; i < num_files_to_delete; i++)
00552     {
00553         int err = CVS_UNLINK (files_to_delete[i]);
00554         if(err != 0)
00555             return_code = err;
00556         free(files_to_delete[i]);
00557     }
00558     if(files_to_delete != NULL)
00559         free(files_to_delete);
00560
00561     return return_code == 0 ? CVS_RMDIR (path) : return_code;
00562 #else
00563     return CVS_RMDIR (path);
00564 #endif
00565     }
00566
00567
00568     /* Was able to remove the directory return 0 */
00569     return 0;
00570 }
00571
00572 /* Read NCHARS bytes from descriptor FD into BUF.
00573    Return the number of characters successfully read.
00574    The number returned is always NCHARS unless end-of-file or error.  */
00575 static size_t
00576 block_read (fd, buf, nchars)
00577     int fd;
00578     char *buf;
00579     size_t nchars;
00580 {
00581     char *bp = buf;
00582     size_t nread;
00583
00584     do
00585     {
00586     nread = read (fd, bp, nchars);
00587     if (nread == (size_t)-1)
00588     {
00589 #ifdef EINTR
00590         if (errno == EINTR)
00591         continue;
00592 #endif
00593         return (size_t)-1;
00594     }
00595
00596     if (nread == 0)
00597         break;
00598
00599     bp += nread;
00600     nchars -= nread;
00601     } while (nchars != 0);
00602
00603     return bp - buf;
00604 }
00605
00606
00607 /*
00608  * Compare "file1" to "file2". Return non-zero if they don't compare exactly.
00609  * If FILE1 and FILE2 are special files, compare their salient characteristics
00610  * (i.e. major/minor device numbers, links, etc.
00611  */
00612 int
00613 xcmp (file1, file2)
00614     const char *file1;
00615     const char *file2;
00616 {
00617     char *buf1, *buf2;
00618     struct stat sb1, sb2;
00619     int fd1, fd2;
00620     int ret;
00621
00622     if (CVS_LSTAT (file1, &sb1) < 0)
00623     error (1, errno, "cannot lstat %s", file1);
00624     if (CVS_LSTAT (file2, &sb2) < 0)
00625     error (1, errno, "cannot lstat %s", file2);
00626
00627     /* If FILE1 and FILE2 are not the same file type, they are unequal. */
00628     if ((sb1.st_mode & S_IFMT) != (sb2.st_mode & S_IFMT))
00629     return 1;
00630
00631     /* If FILE1 and FILE2 are symlinks, they are equal if they point to
00632        the same thing. */
00633     if (S_ISLNK (sb1.st_mode) && S_ISLNK (sb2.st_mode))
00634     {
00635     int result;
00636     buf1 = xreadlink (file1);
00637     buf2 = xreadlink (file2);
00638     result = (strcmp (buf1, buf2) == 0);
00639     free (buf1);
00640     free (buf2);
00641     return result;
00642     }
00643
00644     /* If FILE1 and FILE2 are devices, they are equal if their device
00645        numbers match. */
00646     if (S_ISBLK (sb1.st_mode) || S_ISCHR (sb1.st_mode))
00647     {
00648     if (sb1.st_rdev == sb2.st_rdev)
00649         return 0;
00650     else
00651         return 1;
00652     }
00653
00654     if ((fd1 = CVS_OPEN (file1, O_RDONLY)) < 0)
00655     error (1, errno, "cannot open file %s for comparing", file1);
00656     if ((fd2 = CVS_OPEN (file2, O_RDONLY)) < 0)
00657     error (1, errno, "cannot open file %s for comparing", file2);
00658
00659     /* A generic file compare routine might compare st_dev & st_ino here
00660        to see if the two files being compared are actually the same file.
00661        But that won't happen in CVS, so we won't bother. */
00662
00663     if (sb1.st_size != sb2.st_size)
00664     ret = 1;
00665     else if (sb1.st_size == 0)
00666     ret = 0;
00667     else
00668     {
00669     /* FIXME: compute the optimal buffer size by computing the least
00670        common multiple of the files st_blocks field */
00671     size_t buf_size = 8 * 1024;
00672     size_t read1;
00673     size_t read2;
00674
00675     buf1 = xmalloc (buf_size);
00676     buf2 = xmalloc (buf_size);
00677
00678     do
00679     {
00680         read1 = block_read (fd1, buf1, buf_size);
00681         if (read1 == (size_t)-1)
00682         error (1, errno, "cannot read file %s for comparing", file1);
00683
00684         read2 = block_read (fd2, buf2, buf_size);
00685         if (read2 == (size_t)-1)
00686         error (1, errno, "cannot read file %s for comparing", file2);
00687
00688         /* assert (read1 == read2); */
00689
00690         ret = memcmp(buf1, buf2, read1);
00691     } while (ret == 0 && read1 == buf_size);
00692
00693     free (buf1);
00694     free (buf2);
00695     }
00696
00697     (void) close (fd1);
00698     (void) close (fd2);
00699     return (ret);
00700 }
00701
00702 /* Generate a unique temporary filename.  Returns a pointer to a newly
00703    malloc'd string containing the name.  Returns successfully or not at
00704    all.  */
00705 /* There are at least three functions for generating temporary
00706    filenames.  We use tempnam (SVID 3) if possible, else mktemp (BSD
00707    4.3), and as last resort tmpnam (POSIX). Reason is that tempnam and
00708    mktemp both allow to specify the directory in which the temporary
00709    file will be created.  */
00710 #ifdef HAVE_TEMPNAM
00711 char *
00712 cvs_temp_name ()
00713 {
00714     char *retval;
00715
00716     retval = tempnam (Tmpdir, "cvs");
00717     if (retval == NULL)
00718     error (1, errno, "cannot generate temporary filename");
00719     /* tempnam returns a pointer to a newly malloc'd string, so there's
00720        no need for a xstrdup  */
00721     return retval;
00722 }
00723 #else
00724 char *
00725 cvs_temp_name ()
00726 {
00727 #  ifdef HAVE_MKTEMP
00728     char *value;
00729     char *retval;
00730
00731     value = xmalloc (strlen (Tmpdir) + 40);
00732     sprintf (value, "%s/%s", Tmpdir, "cvsXXXXXX" );
00733     retval = mktemp (value);
00734
00735     if (retval == NULL)
00736     error (1, errno, "cannot generate temporary filename");
00737     return value;
00738 #  else
00739     char value[L_tmpnam + 1];
00740     char *retval;
00741
00742     retval = tmpnam (value);
00743     if (retval == NULL)
00744     error (1, errno, "cannot generate temporary filename");
00745     return xstrdup (value);
00746 #  endif
00747 }
00748 #endif
00749
00750 /* Return non-zero iff FILENAME is absolute.
00751    Trivial under Unix, but more complicated under other systems.  */
00752 int
00753 isabsolute (filename)
00754     const char *filename;
00755 {
00756     /* MacOS note : copied from the WIN32 side. Originally reported
00757      * by Roman Dementiev. This hack allows to use a Windows server
00758      * with a CVSROOT like C:/CVS/ROOT (alexp 4/7/98)
00759      */
00760     return (ISDIRSEP (filename[0])
00761             || (filename[0] != '\0'
00762                 && filename[1] == ':'
00763                 && ISDIRSEP (filename[2])));
00764 }
00765
00766 /*
00767  * Return a string (dynamically allocated) with the name of the file to which
00768  * LINK is symlinked.
00769  */
00770 char *
00771 xreadlink (link)
00772     const char *link;
00773 {
00774     char *file = NULL;
00775     char *tfile;
00776     int buflen = 128;
00777     int link_name_len;
00778
00779     if (!islink (link))
00780     return NULL;
00781
00782     /* Get the name of the file to which `from' is linked.
00783        FIXME: what portability issues arise here?  Are readlink &
00784        ENAMETOOLONG defined on all systems? -twp */
00785     do
00786     {
00787     file = xrealloc (file, buflen);
00788     link_name_len = readlink (link, file, buflen - 1);
00789     buflen *= 2;
00790     }
00791     while (link_name_len < 0 && errno == ENAMETOOLONG);
00792
00793     if (link_name_len < 0)
00794     error (1, errno, "cannot readlink %s", link);
00795
00796     file[link_name_len] = '\0';
00797
00798     tfile = xstrdup (file);
00799     free (file);
00800
00801     return tfile;
00802 }
00803
00804
00805 /* Return a pointer into PATH's last component.  */
00806 char *
00807 last_component (path)
00808     char *path;
00809 {
00810     char *last = strrchr (path, '/');
00811
00812     if (last && (last != path))
00813         return last + 1;
00814     else
00815         return path;
00816 }
00817
00818 /* Return the home directory.  Returns a pointer to storage
00819    managed by this function or its callees (currently getenv).
00820    This function will return the same thing every time it is
00821    called.  Returns NULL if there is no home directory.
00822
00823    Note that for a pserver server, this may return root's home
00824    directory.  What typically happens is that upon being started from
00825    inetd, before switching users, the code in cvsrc.c calls
00826    get_homedir which remembers root's home directory in the static
00827    variable.  Then the switch happens and get_homedir might return a
00828    directory that we don't even have read or execute permissions for
00829    (which is bad, when various parts of CVS try to read there).  One
00830    fix would be to make the value returned by get_homedir only good
00831    until the next call (which would free the old value).  Another fix
00832    would be to just always malloc our answer, and let the caller free
00833    it (that is best, because some day we may need to be reentrant).
00834
00835    The workaround is to put -f in inetd.conf which means that
00836    get_homedir won't get called until after the switch in user ID.
00837
00838    The whole concept of a "home directory" on the server is pretty
00839    iffy, although I suppose some people probably are relying on it for
00840    .cvsrc and such, in the cases where it works.  */
00841 char *
00842 get_homedir ()
00843 {
00844     char *result, *tmp;
00845     int len;
00846     static char *home_cache = 0L;
00847     if(home_cache != 0L)
00848         return home_cache;
00849
00850     result = getenv ("HOME");
00851     if(result == 0L)
00852         return 0L;
00853
00854     // Make it a Unix path if necessary cause
00855     // cvs will attempt to concatenate it
00856     // with Unix paths.
00857     tmp = xstrdup(result);
00858     len = strlen(tmp);
00859     if(len > 0 && tmp[len - 1] == ':')
00860     {
00861         tmp[len - 1] = '\0';
00862         len--;
00863     }
00864
00865     home_cache = xmalloc((len + 2) * sizeof(char));
00866     strcpy(home_cache, "/");
00867     strcat(home_cache, tmp);
00868     free(tmp);
00869
00870     tmp = home_cache;
00871     while((tmp = strchr(tmp, ':')) != 0L)
00872     {
00873         *tmp++ = '/';
00874     }
00875
00876     return home_cache;
00877 }
00878
00879 /* See cvs.h for description.  On unix this does nothing, because the
00880    shell expands the wildcards.  */
00881 void
00882 expand_wild (argc, argv, pargc, pargv)
00883     int argc;
00884     char **argv;
00885     int *pargc;
00886     char ***pargv;
00887 {
00888     int i;
00889     *pargc = argc;
00890     *pargv = (char **) xmalloc (argc * sizeof (char *));
00891     for (i = 0; i < argc; ++i)
00892     (*pargv)[i] = xstrdup (argv[i]);
00893 }
00894
00895 #ifdef SERVER_SUPPORT
00896 /* Case-insensitive string compare.  I know that some systems
00897    have such a routine, but I'm not sure I see any reasons for
00898    dealing with the hair of figuring out whether they do (I haven't
00899    looked into whether this is a performance bottleneck; I would guess
00900    not).  */
00901 int
00902 cvs_casecmp (str1, str2)
00903     char *str1;
00904     char *str2;
00905 {
00906     char *p;
00907     char *q;
00908     int pqdiff;
00909
00910     p = str1;
00911     q = str2;
00912     while ((pqdiff = tolower (*p) - tolower (*q)) == 0)
00913     {
00914     if (*p == '\0')
00915         return 0;
00916     ++p;
00917     ++q;
00918     }
00919     return pqdiff;
00920 }
00921
00922 /* Case-insensitive file open.  As you can see, this is an expensive
00923    call.  We don't regard it as our main strategy for dealing with
00924    case-insensitivity.  Returns errno code or 0 for success.  Puts the
00925    new file in *FP.  NAME and MODE are as for fopen.  If PATHP is not
00926    NULL, then put a malloc'd string containing the pathname as found
00927    into *PATHP.  *PATHP is only set if the return value is 0.
00928
00929    Might be cleaner to separate the file finding (which just gives
00930    *PATHP) from the file opening (which the caller can do).  For one
00931    thing, might make it easier to know whether to put NAME or *PATHP
00932    into error messages.  */
00933 int
00934 fopen_case (name, mode, fp, pathp)
00935     char *name;
00936     char *mode;
00937     FILE **fp;
00938     char **pathp;
00939 {
00940     struct dirent *dp;
00941     DIR *dirp;
00942     char *dir;
00943     char *fname;
00944     char *found_name;
00945     int retval;
00946
00947     /* Separate NAME into directory DIR and filename within the directory
00948        FNAME.  */
00949     dir = xstrdup (name);
00950     fname = strrchr (dir, '/');
00951     if (fname == NULL)
00952     error (1, 0, "internal error: relative pathname in fopen_case");
00953     *fname++ = '\0';
00954
00955     found_name = NULL;
00956     dirp = CVS_OPENDIR (dir);
00957     if (dirp == NULL)
00958     {
00959     if (existence_error (errno))
00960     {
00961         /* This can happen if we are looking in the Attic and the Attic
00962            directory does not exist.  Return the error to the caller;
00963            they know what to do with it.  */
00964         retval = errno;
00965         goto out;
00966     }
00967     else
00968     {
00969         /* Give a fatal error; that way the error message can be
00970            more specific than if we returned the error to the caller.  */
00971         error (1, errno, "cannot read directory %s", dir);
00972     }
00973     }
00974     errno = 0;
00975     while ((dp = readdir (dirp)) != NULL)
00976     {
00977     if (cvs_casecmp (dp->d_name, fname) == 0)
00978     {
00979         if (found_name != NULL)
00980         error (1, 0, "%s is ambiguous; could mean %s or %s",
00981                fname, dp->d_name, found_name);
00982         found_name = xstrdup (dp->d_name);
00983     }
00984     }
00985     if (errno != 0)
00986     error (1, errno, "cannot read directory %s", dir);
00987     closedir (dirp);
00988
00989     if (found_name == NULL)
00990     {
00991     *fp = NULL;
00992     retval = ENOENT;
00993     }
00994     else
00995     {
00996     char *p;
00997
00998     /* Copy the found name back into DIR.  We are assuming that
00999        found_name is the same length as fname, which is true as
01000        long as the above code is just ignoring case and not other
01001        aspects of filename syntax.  */
01002     p = dir + strlen (dir);
01003     *p++ = '/';
01004     strcpy (p, found_name);
01005     *fp = fopen (dir, mode);
01006     if (*fp == NULL)
01007         retval = errno;
01008     else
01009         retval = 0;
01010     }
01011
01012     if (pathp == NULL)
01013     free (dir);
01014     else if (retval != 0)
01015     free (dir);
01016     else
01017     *pathp = dir;
01018     free (found_name);
01019  out:
01020     return retval;
01021 }
01022 #endif /* SERVER_SUPPORT */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/mac_run.c Source File

cvs-1.10/macintosh/mac_run.c

Go to the documentation of this file.
00001 /*
00002  * run.c --- stubs for unused cvs functions in 'src/run.c'
00003  *
00004  * MDLadwig <mike@twinpeaks.prc.com> --- Nov 1995
00005  * Modified : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00006  */
00007
00008 #include "config.h"
00009 #include <sys/types.h>
00010 #include <stdio.h>
00011 #include <stdlib.h>
00012 #include <MacErrors.h>
00013
00014 #include "GUSIlsh.h"
00015
00016 #ifdef MAC_SHL
00017 #   include <Folders.h>
00018 #   include <errno.h>
00019 #   include "dll_loader.h"
00020 #   include "cvs.h"
00021 #   include "VolsPaths.h"
00022 #   include "FSpCompat.h"
00023 #   include "lsh_dll.h"
00024 #endif /* MAC_SHL */
00025
00026 #define CLOSE_ON_EXEC_MAX 10
00027 static int _close_on_exec_num = 0;
00028 static int _close_on_exec_list[CLOSE_ON_EXEC_MAX];
00029
00030 void close_on_exec (int s)
00031 {
00032     if(_close_on_exec_num < CLOSE_ON_EXEC_MAX)
00033         _close_on_exec_list[_close_on_exec_num++] = s;
00034 }
00035
00036 void macos_cleanup(void)
00037 {
00038     int i;
00039     for(i = 0; i < _close_on_exec_num; i++)
00040         close(_close_on_exec_list[i]);
00041     GUSIwithoutLSHSockets();
00042
00043 }
00044
00045 void macos_initialize(int *argc, char ***argv)
00046 {
00047     GUSIwithLSHSockets();
00048 }
00049
00050 void run_arg (const char *s) { }
00051 void run_print (FILE * fp) { }
00052 void run_setup (const char *fmt/*,...*/) { }
00053 void run_args (const char *fmt/*,...*/) { }
00054 int run_exec (const char *stin, const char *stout, const char *sterr, int flags) { return 0; }
00055 int piped_child (char **, int *, int *) { return 0; }
00056 int filter_stream_through_program (int, int, char **, pid_t *) { return 0; }
00057 void *alloca (size_t size) {return malloc(size);} /* MacCVS garbages allocations anyway */
00058
00059 char *getpass (const char *prompt)
00060 {
00061 #ifndef MAC_SHL
00062     return NULL;
00063 #else /* MAC_SHL */
00064     char *value = (char *)xmalloc(strlen(prompt) + strlen("CVS_GETPASS") + 2);
00065     char *res;
00066     strcpy(value, "CVS_GETPASS");
00067     strcat(value, "=");
00068     strcat(value, prompt);
00069     res = getenv(value); /* let MacCvs get the password */
00070     free(value);
00071     return res;
00072 #endif /* MAC_SHL */
00073 }
00074
00075 #ifdef MAC_SHL
00076 static FILE *gRunOut = 0L;
00077
00078 static long consoleout(char *txt, long len)
00079 {
00080     FILE *stream = gRunOut != 0L ? gRunOut : stdout;
00081
00082     int tmp = len;
00083     while(tmp--)
00084     {
00085         char c = *txt++;
00086         if(c == 0x0d)
00087             c = 0x0a;
00088         putc(c, stream);
00089     }
00090     return len;
00091 }
00092
00093 static long consoleerr(char *txt, long len)
00094 {
00095     int tmp = len;
00096     while(tmp--)
00097     {
00098         char c = *txt++;
00099         if(c == 0x0a)
00100             c = 0x0a;
00101         putc(c, stderr);
00102     }
00103     return len;
00104 }
00105
00106 static long consolein(char *txt, long len)
00107 {
00108     int tmp = len;
00109     int c;
00110
00111     while((c = getc(stdin)) != EOF && tmp > 0)
00112     {
00113         *txt++ = (char)c;
00114         tmp--;
00115     }
00116     return len - tmp;
00117 }
00118
00119 static int myeventdispatcher(EventRecord *ev)
00120 {
00121     return dllglue_dispatchevent(ev);
00122 }
00123
00124 static char *mygetenv(char *name)
00125 {
00126     return getenv(name);
00127 }
00128
00129 static int loadCVS(CompatConnectID * connID)
00130 {
00131     int result = 0;
00132     const char *name_dll;
00133
00134     /* get cvs shared library */
00135 #if TARGET_API_MAC_CARBON
00136 #if qCvsDebug
00137     name_dll = "cvsXDbgLib";
00138 #else
00139     name_dll = "cvsXLib";
00140 #endif
00141 #else
00142 #if qCvsDebug
00143     name_dll = "cvs2DbgLib";
00144 #else
00145     name_dll = "cvs2Lib";
00146 #endif
00147 #endif
00148
00149     /* open the library */
00150     if(!CompatLoadLibrary(connID, name_dll))
00151     {
00152         fprintf(stderr, "Error: Unable to load the library %s\n", name_dll);
00153         return false;
00154     }
00155
00156     /* set the console out */
00157     if(!CompatCallLibrary1(*connID, result, uppSetGlueProcInfo, "dllglue_setconsoleout",
00158         dllglue_setglue_func, CompatFuncArg(uppConsoleOutProcInfo, consoleout)))
00159     {
00160         fprintf(stderr, "Error : Cannot find symbol ""dllglue_setconsoleout""\n");
00161         CompatCloseLibrary(connID);
00162         return false;
00163     }
00164
00165     /* set the console err */
00166     if(!CompatCallLibrary1(*connID, result, uppSetGlueProcInfo, "dllglue_setconsoleerr",
00167         dllglue_setglue_func, CompatFuncArg(uppConsoleOutProcInfo, consoleerr)))
00168     {
00169         fprintf(stderr, "Error : Cannot find symbol ""dllglue_setconsoleerr""\n");
00170         CompatCloseLibrary(connID);
00171         return false;
00172     }
00173
00174     /* set the console in */
00175     if(!CompatCallLibrary1(*connID, result, uppSetGlueProcInfo, "dllglue_setconsolein",
00176         dllglue_setglue_func, CompatFuncArg(uppConsoleInProcInfo, consolein)))
00177     {
00178         fprintf(stderr, "Error : Cannot find symbol ""dllglue_setconsolein""\n");
00179         CompatCloseLibrary(connID);
00180         return false;
00181     }
00182
00183     /* set the getenv */
00184     if(!CompatCallLibrary1(*connID, result, uppSetGlueProcInfo, "dllglue_setgetenv",
00185         dllglue_setglue_func, CompatFuncArg(uppGetEnvProcInfo, mygetenv)))
00186     {
00187         fprintf(stderr, "Error : Cannot find symbol ""dllglue_setgetenv""\n");
00188         CompatCloseLibrary(connID);
00189         return false;
00190     }
00191
00192     /* set the event dispatcher */
00193     if(!CompatCallLibrary1(*connID, result, uppSetGlueProcInfo, "dllglue_seteventdispatch",
00194         dllglue_setglue_func, CompatFuncArg(uppEventDispatchProcInfo, myeventdispatcher)))
00195     {
00196         fprintf(stderr, "Error : Cannot find symbol ""dllglue_seteventdispatch""\n");
00197         CompatCloseLibrary(connID);
00198         return false;
00199     }
00200
00201     return true;
00202 }
00203
00204 static void unloadCVS(CompatConnectID connID)
00205 {
00206     CompatCloseLibrary(&connID);
00207 }
00208
00209 static int launchCVS(const char *path, int argc, char **argv)
00210 {
00211     CompatConnectID connID;
00212     int exitc = 0;
00213
00214     if(!loadCVS(&connID))
00215         return 1;
00216
00217     /* call the main */
00218     if(!CompatCallLibrary3(connID, exitc, uppMainProcInfo, "dllglue_main",
00219         dllglue_main_func, path, argc, argv))
00220     {
00221         fprintf(stderr, "Error : Cannot find symbol ""dllglue_main""\n");
00222         exitc = 1;
00223     }
00224
00225     unloadCVS(connID);
00226
00227     return exitc;
00228 }
00229
00230 static char **split_cmdline(const char *cmd, int *resargc)
00231 {
00232 #   define MAX_ARGS 40
00233 #   define MAX_CMD_LEN 2048
00234
00235     char *argv[MAX_ARGS];
00236     int argc = 0, i;
00237     char **result;
00238
00239     char    Quote = '\0';               /*  Contains the quote character if we are
00240                                             inside "" or '', or \0 otherwise */
00241     const char* walker1 = cmd;              /*  walker1 traverses the original
00242                                             command line */
00243     char*   walker2;                    /*  walker2 traverses the parsed copy of
00244                                             the command line */
00245     char    theChar;                    /*  theChar is the character we are currently
00246                                             parsing */
00247     char    arguments [MAX_CMD_LEN];            /*  will contain a parsed copy of the
00248                                             command line */
00249     if(cmd == 0L || cmd[0] == '\0')
00250         return 0L;
00251
00252     walker2 = arguments;                                        /*  copy into arguments */
00253     while ((theChar = *walker1++) != '\0') {                    /*  parse command line to \0 */
00254         if (theChar == ' ')                                     /*  skip leading space before an argument */
00255             continue;
00256         argv [argc++] = walker2;                                /*  set argv to point to the space
00257                                                                     where we copy the next argument */
00258         if (argc > MAX_ARGS) {                                  /*  if we filled argv, skip the rest */
00259             argc--;
00260             break;
00261         }
00262         do {                                                    /*  parse an argument */
00263             if (theChar == '\\' && *walker1++)                  /*  skip \s */
00264                 theChar = *walker1++;
00265             else
00266                 if ((theChar == '"') || (theChar == '\'')) {    /*  when we find a quote... */
00267                     if (Quote == '\0') {                        /*  if we are not inside quotes already, */
00268                         Quote = theChar;                        /*  remember we are inside quotes now */
00269                         continue;                               /*  go to the next character */
00270                     }
00271                     if (theChar == Quote) {                     /*  if we are already inside that kind of quotes */
00272                         Quote = '\0';                           /*  close quotes */
00273                         continue;                               /*  go to the next character */
00274                     }
00275                 }
00276             *walker2++ = theChar;                               /*  copy the character into args */
00277                                                                 /*  repeat until we reach the end of arguments
00278                                                                     or we reach a space that is not inside quotes */
00279         } while ((*walker1 != '\0') && (((theChar = *walker1++) != ' ') || (Quote != '\0')));
00280         *walker2++ = 0;                                         /* null-terminate the last argument */
00281     }
00282
00283     *resargc = argc;
00284     result = (char **)xmalloc(argc * sizeof(char *));
00285     for (i = 0; i < argc; i++)
00286         result[i] = xstrdup(argv[i]);
00287
00288     return result;
00289 }
00290
00291 static OSErr
00292 MacGetPrefsFolder(FSSpec * theFolder, Str255 thePath)
00293 {
00294     short foundVRefNum;
00295     long foundDirID;
00296     OSErr err;
00297     char theCPath[256];
00298
00299     err = FindFolder(kOnSystemDisk, kPreferencesFolderType,
00300         kDontCreateFolder, &foundVRefNum, &foundDirID);
00301     if (err != noErr)
00302     {
00303         fprintf(stderr, "MacCvs: Unable to find the preferences folder (error %d)\n", err);
00304         return err;
00305     }
00306
00307     if(PathNameFromDirID(foundDirID, foundVRefNum, theCPath) != noErr)
00308     {
00309         fprintf(stderr, "MacCvs: Unable to convert path name\n");
00310         return fnfErr;
00311     }
00312     c2pstrcpy(thePath, theCPath);
00313
00314     err = FSMakeFSSpecCompat(foundVRefNum, foundDirID, "\p", theFolder);
00315     if (err != noErr)
00316     {
00317         fprintf(stderr, "MacCvs: Unable to find the preferences folder (error %d)\n", err);
00318         return err;
00319     }
00320     return err;
00321 }
00322 #endif /* MAC_SHL */
00323
00324 FILE * run_popen(const char *cmd, const char *perm)
00325 {
00326 #ifndef MAC_SHL
00327     return NULL;
00328 #else /* MAC_SHL */
00329     char **argv = 0L;
00330     int argc, i;
00331     const char *tmp;
00332     FSSpec theFolder;
00333     Str255 thePath;
00334     FILE *result = 0L;
00335     char cur_wd[512];
00336
00337     getcwd(cur_wd, 512);
00338
00339     /* resign if it is not something we know about */
00340     if(cmd == 0L || strncmp(cmd, program_path, strlen(program_path)) != 0)
00341         goto abort;
00342
00343     if(MacGetPrefsFolder(&theFolder, thePath) != noErr)
00344         goto abort;
00345
00346     p2cstrcpy((char *)thePath);
00347     if(thePath[strlen((char *)thePath) - 1] != ':')
00348         strcat((char *)thePath, ":");
00349     strcat((char *)thePath, "__maccvsTmpPopen");
00350     gRunOut = fopen((char *)thePath, "w");
00351     if(gRunOut == 0L)
00352     {
00353         fprintf(stderr, "Impossible to open '%s' (error %d)\n", "__maccvsTmpPopen", errno);
00354         goto abort;
00355     }
00356
00357     /* split the command line */
00358     argv = split_cmdline(cmd, &argc);
00359     if(argv == 0L)
00360         goto abort;
00361
00362     launchCVS(cur_wd, argc, argv);
00363
00364     fclose(gRunOut);
00365     gRunOut = 0L;
00366     gRunOut = fopen((char *)thePath, "r");
00367     if(gRunOut == 0L)
00368     {
00369         fprintf(stderr, "Impossible to open '%s' (error %d)\n", "__maccvsTmpPopen", errno);
00370         goto abort;
00371     }
00372
00373     result = gRunOut;
00374     gRunOut = 0L;
00375
00376 abort:
00377     if(gRunOut != 0L)
00378     {
00379         fclose(gRunOut);
00380         gRunOut = 0L;
00381     }
00382     if(argv != 0L)
00383     {
00384         for(i = 0; i < argc; i++)
00385         {
00386             free(argv[i]);
00387         }
00388         free(argv);
00389     }
00390
00391     return result;
00392 #endif /* MAC_SHL */
00393 }
00394
00395 #ifndef MAC_SHL
00396 int pclose(FILE *fp) {return 0;}
00397 #else /* MAC_SHL */
00398 int run_pclose(FILE *fp)
00399 {
00400     return fclose(fp);
00401 }
00402 #endif /* MAC_SHL */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/macos_filesys.c Source File

cvs-1.10/macintosh/macos_filesys.c

Go to the documentation of this file.
00001 /*
00002  * macos_filesys.c
00003  * Filesystem handling stuff for macos
00004  *
00005  * Michael Ladwig <mike@twinpeaks.prc.com> --- November 1995 (Initial version)
00006  *                                                       --- May 1996 (Handled relative paths better)
00007  *                                                       --- June 1996 (Have open look absolute and relative)
00008  * Modified : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00009  * Modified : Richard Wesley <hawkfish@electricfish.com> --- December 2000
00010  */
00011
00012 #include "cvs.h"
00013
00014 #include <fcntl.h>
00015 #include <stdio.h>
00016 #include <stdlib.h>
00017 #include <string.h>
00018 #include <errno.h>
00019 #include <CodeFragments.h>
00020
00021 #include "cvs_hqx.h"
00022 #include "FileCopy.h"
00023 #include "FullPath.h"
00024
00025 /*
00026  * the trick is : if inflags & OPEN_BINARY, it means we decode from
00027  * the server format (HQX or ISO) into the local format (Mac resource or
00028  * Mac Text encoding). outflags depends if we try to open a Mac CR file
00029  * or a Unix LF file. The MSL fopen, fread, fwrite... toggles
00030  * automatically CR<->LF when opening as TEXT ("r", "w"). While
00031  * the GUSI open, read, write makes no conversion at all (alexp)
00032  */
00033
00034 void
00035 convert_file (char *infile,  int inflags,
00036           char *outfile, int outflags, int binary)
00037 {
00038     FILE *infd, *outfd;
00039     char buf[8192];
00040     int len;
00041     int decode; /* 1 : server to client format, 0: client to server format */
00042 #ifdef BINHEX_STUFF
00043 #   define ISO8559_VALID(iso) ((iso) == 1)
00044     static int set_text_signature = -1;
00045     static int convert_iso8559 = -1;
00046
00047     if(convert_iso8559 == -1)
00048     {
00049         const char *iso = getenv("ISO8859");
00050         if(iso == NULL || sscanf(iso, "%d", &convert_iso8559) != 1 ||
00051             !ISO8559_VALID(convert_iso8559))
00052                 convert_iso8559 = 0;
00053     }
00054     if(set_text_signature == -1)
00055     {
00056         set_text_signature = getenv("IC_ON_TXT") != NULL ? 1 : 0;
00057     }
00058
00059     /* "update" doesn't check if we can erase the dest file */
00060     chmod(outfile, S_IRWXU);
00061
00062     if(convert_hqx_file(infile, inflags, outfile, outflags, &binary))
00063         return;
00064 #endif /* BINHEX_STUFF */
00065
00066     if (inflags & OPEN_BINARY) {
00067         decode = true;
00068     } else {
00069         decode = false;
00070     }
00071
00072     if ((infd = fopen (infile, (binary || (inflags & OPEN_BINARY)) ? "rb" : "r")) == NULL)
00073         error (1, errno, "couldn't read %s", infile);
00074     if ((outfd = fopen (outfile, (binary || (outflags & OPEN_BINARY)) ? "wb" : "w")) == NULL)
00075         error (1, errno, "couldn't write %s", outfile);
00076
00077     while ((len = fread (buf, sizeof (char), sizeof (buf) / sizeof(char), infd)) > 0) {
00078         char * conv     = buf;
00079         int    convlen  = len;
00080 #ifdef BINHEX_STUFF
00081         if(binary == 0 && convert_iso8559) while (convlen--)
00082         {
00083             *conv = (char)convert_iso(decode, convert_iso8559, (unsigned char)*conv);
00084             conv++;
00085         }
00086 #endif /* BINHEX_STUFF */
00087
00088         if (fwrite (buf, sizeof(char), len, outfd) < 0)
00089             error (1, errno, "error writing %s", outfile);
00090     }
00091     if (len < 0)
00092         error (1, errno, "error reading %s", infile);
00093
00094     if (fclose (outfd) != 0)
00095         error (0, errno, "warning: couldn't close %s", outfile);
00096     if (fclose (infd) != 0)
00097         error (0, errno, "warning: couldn't close %s", infile);
00098
00099 #ifdef BINHEX_STUFF
00100     if((binary || set_text_signature) && decode)
00101         set_file_type(outfile, !quiet);
00102 #endif /* BINHEX_STUFF */
00103 }
00104
00105 /*
00106     Utility for decoding a file we just got back raw from the server.  Useful for external
00107     diff.
00108
00109      - Richard Wesley <mailto:hawkfish2electricfish.com>
00110
00111 */
00112
00113 int
00114 decode_file (char *infile)
00115 {
00116     OSErr   err;
00117     FSSpec  inspec;
00118     FSSpec  tempSpec;
00119     FSSpec  tempDirSpec;
00120     char*   temp_filename = cvs_temp_name ();
00121     Str31   temp_name_str;
00122     int     bin = 0;
00123
00124     /* Make source spec */
00125     err = FSpLocationFromFullPath (strlen (infile), infile, &inspec);
00126     if (noErr != err) return err;
00127
00128     /* Make temp dir spec */
00129     BlockMoveData (temp_filename, temp_name_str + 1, temp_name_str[0] = strlen (temp_filename));
00130     err = FSMakeFSSpec (0, 0, temp_name_str, &tempSpec);
00131     err = FSMakeFSSpec (tempSpec.vRefNum, tempSpec.parID, nil, &tempDirSpec);
00132     if (noErr != err) return err;
00133
00134     /* Copy to the temp file */
00135     err = FSpFileCopy (&inspec, &tempDirSpec, tempSpec.name, nil, 0, true);
00136     if (noErr != err) return err;
00137
00138     /* Convert temp file back over infile */
00139     convert_file (temp_filename, O_RDONLY | OPEN_BINARY, infile, O_WRONLY | O_CREAT | O_TRUNC, bin);
00140
00141     /* Delete the temp file */
00142     FSpDelete (&tempSpec);
00143
00144     return 0;
00145 }
00146
00147 char *macos_fixpath (const char *path);
00148 char scratchPath[1024];
00149
00150 #undef mkdir
00151 #undef open
00152 #undef creat
00153 #undef fopen
00154 #undef chdir
00155 #undef access
00156 #undef opendir
00157 #undef stat
00158 #undef rename
00159 #undef rmdir
00160 #undef unlink
00161 #undef chmod
00162 #undef lstat
00163
00164 #if 0
00165 #   define TRACE(arg) \
00166     { \
00167         char cur_wd[512]; \
00168         getcwd(cur_wd, 512); \
00169         fprintf(stderr,"%.40s> ", cur_wd); \
00170         fprintf arg; \
00171         fprintf(stderr,"\n"); \
00172     }
00173 #else
00174 #   define TRACE(arg)
00175 #endif
00176
00177 int
00178 macos_mkdir( const char *path, int oflag )
00179 {
00180     int res = mkdir( macos_fixpath(path) );
00181     TRACE((stderr, "mkdir %s -> %d", macos_fixpath(path), res));
00182     return res;
00183 }
00184
00185 int
00186 macos_open( const char *path, int oflag, ... )
00187 {
00188     int r;
00189     char    *macPath;
00190
00191     macPath = macos_fixpath(path);
00192
00193     r = open( macPath, oflag );
00194     TRACE((stderr, "open %s -> %d", macPath, r));
00195     if( r < 0 )
00196     {
00197         r = open( macPath+1, oflag );
00198         TRACE((stderr, "open %s -> %d", macPath + 1, r));
00199     }
00200
00201     return r;
00202 }
00203
00204 int
00205 macos_chmod( const char *path, mode_t mode )
00206 {
00207     int res = chmod(macos_fixpath(path), mode);
00208     TRACE((stderr, "chmod %s %x -> %d", macos_fixpath(path), mode, res));
00209     return res;
00210 }
00211
00212 int
00213 macos_creat( const char *path, mode_t mode )
00214 {
00215     int res = creat( macos_fixpath(path) );
00216     TRACE((stderr, "creat %s -> %d", macos_fixpath(path), res));
00217     return res;
00218 }
00219
00220 FILE *
00221 macos_fopen( const char *path, const char *mode )
00222 {
00223     FILE    *fp;
00224
00225     fp = fopen(macos_fixpath(path), mode);
00226
00227     TRACE((stderr, "fopen %s %x -> %d", macos_fixpath(path), mode, fp != 0L));
00228
00229     /* I'm getting ENOTDIR, CVS expects ENOENT */
00230
00231     if( (fp == NULL) && (errno == ENOTDIR) ) errno = ENOENT;
00232
00233     return fp;
00234 }
00235
00236 int
00237 macos_chdir( const char *path )
00238 {
00239     int r;
00240     char    *macPath;
00241
00242     macPath = macos_fixpath(path);
00243
00244     r = chdir(macPath);
00245     TRACE((stderr, "chdir %s -> %d", macPath, r));
00246     if( r < 0 )
00247     {
00248         r = chdir(macPath+1);
00249         TRACE((stderr, "chdir %s -> %d", macPath+1, r));
00250     }
00251
00252     return r;
00253 }
00254
00255 int
00256 macos_access(const char *path, int amode)
00257 {
00258     int res = access( macos_fixpath(path), amode );
00259     TRACE((stderr, "access %s %x -> %d", macos_fixpath(path), amode, res));
00260     return res;
00261 }
00262
00263 DIR *
00264 macos_opendir(const char *path)
00265 {
00266     DIR *res = opendir( macos_fixpath(path) );
00267     TRACE((stderr, "opendir %s -> %d", macos_fixpath(path), res != 0L));
00268     return res;
00269 }
00270
00271 int
00272 macos_stat (const char *path, struct stat *ststr)
00273 {
00274     int res = stat( macos_fixpath(path), ststr );
00275     TRACE((stderr, "stat %s -> %d", macos_fixpath(path), res));
00276     return res;
00277 }
00278
00279 int
00280 macos_lstat (const char *path, struct stat *ststr)
00281 {
00282     int res = lstat( macos_fixpath(path), ststr );
00283     TRACE((stderr, "lstat %s -> %d", macos_fixpath(path), res));
00284     return res;
00285 }
00286
00287 int
00288 macos_rename (const char *path, const char *newpath)
00289 {
00290     char    macPath_from[1024], macPath_to[1024];
00291     int res;
00292
00293     strcpy( macPath_from, macos_fixpath(path) );
00294     strcpy( macPath_to, macos_fixpath(newpath) );
00295
00296     res = rename( macPath_from, macPath_to );
00297     TRACE((stderr, "rename %s %s -> %d", macPath_from, macPath_to, res));
00298     return res;
00299 }
00300
00301 int
00302 macos_rmdir (const char *path)
00303 {
00304     int res = rmdir( macos_fixpath(path) );
00305     TRACE((stderr, "rmdir %s -> %d", macos_fixpath(path), res));
00306     return res;
00307 }
00308
00309 int
00310 macos_unlink (const char *path)
00311 {
00312     int res;
00313     chmod(path, S_IRWXU);
00314     res = unlink( macos_fixpath(path) );
00315     TRACE((stderr, "unlink %s -> %d", macos_fixpath(path), res));
00316     return res;
00317 }
00318
00319 char *
00320 macos_fixpath (const char *path)
00321 {
00322     char        *sepCh;
00323
00324     // tip to not make unix->mac path conversion when
00325     // this should not happen.
00326     // - this should be obsolete now (4/7/98). Instead
00327     // gives a Mac path for the HOME env. variable
00328     // like "System:Preferences" and cvs will convert it
00329     // back to a Unix path.
00330     if(strncmp(path, "@@@", 3) == 0)
00331     {
00332         strcpy( scratchPath, path + 3 );
00333         Debugger();
00334             // we should never get here anymore
00335         return scratchPath;
00336     }
00337
00338     // special case chdir("..")
00339     if(strcmp(path, "..") == 0)
00340     {
00341         strcpy( scratchPath, "::" );
00342         return scratchPath;
00343     }
00344
00345     // if it is an absolute Unix path, do
00346     // not prefix by ':'
00347     if(path[0] != '/')
00348         strcpy( scratchPath, ":" );
00349     else
00350     {
00351         scratchPath[0] = '\0';
00352         ++path;
00353     }
00354
00355     // Unix "./xxx" is equivalent to ":xxx"
00356     if( (*path == '.') && (*(path+1) == '/') )
00357         strcat( scratchPath, path+2 );
00358     // ???
00359     else if( strcmp(path, ".") != 0 )
00360         strcat( scratchPath, path );
00361
00362     // Finally replace '/' by ':'
00363     while( (sepCh = strchr(scratchPath, '/')) != NULL )
00364         *sepCh = ':';
00365
00366     return scratchPath;
00367 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs_hqx.cpp File Reference

cvs-1.10/macintosh/cvs_hqx.cpp File Reference

#include "config.h"
#include <GUSIInternal.h>
#include <GUSIFileSpec.h>
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include "hqx.h"
#include "cvs_hqx.h"
#include "FileCopy.h"
#include "apsingle.h"
#include <PLStringFuncs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Resources.h>
#include <TextUtils.h>
#include <Strings.h>
#include <Finder.h>
#include <InternetConfig.h>

Include dependency graph for cvs_hqx.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | APPLESINGLE_WANTED_ENTRIES ((UInt32)AS_DATA_BIT | AS_RESOURCE_BIT | AS_COMMENT_BIT | AS_FINDERINFO_BIT | AS_MACINFO_BIT)

Enumerations

enum | encodingPolicy { eEncodeDefault = -1, eEncodeHQX, eEncodeAppleSingle, eEncodePlainBinary }

Functions

char * | macos_fixpath (const char *path)
void | fillSemiColonTypes (const char *envVar, OSType *&allTypes, int &numTypes)
Boolean | isPlainBinary (OSType ftype)
Boolean | testHQXEncoding (OSType ftype)
Boolean | testAppleSingleEncoding (OSType ftype)
void | determineEncodingPolicy (OSType ftype, encodingPolicy *policy)
void | getDefaultEncodingPolicy (encodingPolicy *policy)
OSErr | MyDest (void *buffer, long count, long param)
OSErr | MySource (void *buffer, long *count, long param)
OSErr | MyNameFilter (StringPtr name, short *vol, long *dir, long param)
int | convert_hqx_file (const char *infile, int inflags, const char *outfile, int outflags, int *bin)
void | set_file_type (const char *outfile, Boolean warnOnFail)
int | mac_duplicate (const char *from, const char *to)
unsigned char | convert_iso (int convert_from, int iso, unsigned char c)
void | c2pstrcpy (Str255 dst, const char *src)
void | p2cstrcpy (char *dst, ConstStr255Param src)

Variables

FILE * | gDestFile
FILE * | gSrcFile
FSSpec gDestFileSpec

Define Documentation

#define APPLESINGLE_WANTED_ENTRIES ((UInt32)AS_DATA_BIT | AS_RESOURCE_BIT | AS_COMMENT_BIT | AS_FINDERINFO_BIT | AS_MACINFO_BIT)

Enumeration Type Documentation

enum encodingPolicy

Enumeration values:
eEncodeDefault
eEncodeHQX
eEncodeAppleSingle
eEncodePlainBinary

Definition at line 190 of file cvs_hqx.cpp.

00191 {
00192     eEncodeDefault = -1,
00193     eEncodeHQX,
00194     eEncodeAppleSingle,
00195     eEncodePlainBinary
00196 } encodingPolicy;

Function Documentation

OSErr MyDest | ( | void * | buffer,
 |  | long | count,
 |  | long | param
 | ) | [static]

Definition at line 249 of file cvs_hqx.cpp.

00249                                                           {
00250     fwrite(buffer, count, 1, gDestFile);
00251     return noErr;
00252 }

OSErr MyNameFilter | ( | StringPtr | name,
 |  | short * | vol,
 |  | long * | dir,
 |  | long | param
 | ) | [static]

Definition at line 259 of file cvs_hqx.cpp.

00259                                                                              {
00260     PLstrcpy(name, gDestFileSpec.name);
00261     *vol = gDestFileSpec.vRefNum;
00262     *dir = gDestFileSpec.parID;
00263     return noErr;
00264 }

OSErr MySource | ( | void * | buffer,
 |  | long * | count,
 |  | long | param
 | ) | [static]

Definition at line 254 of file cvs_hqx.cpp.

00254                                                              {
00255     *count =  fread(buffer, 1, *count, gSrcFile);
00256     return noErr;
00257 }

void c2pstrcpy | ( | Str255 | dst,
 |  | const char * | src
 | ) |

Definition at line 597 of file cvs_hqx.cpp.

Referenced by CompatLoadLibrary(), CMacBinItem::GetDrawContentsSelf(), and set_file_type().

00599 {
00600     strcpy((char *)dst, src);
00601     c2pstr((char *)dst);
00602 }

int convert_hqx_file | ( | const char * | infile,
 |  | int | inflags,
 |  | const char * | outfile,
 |  | int | outflags,
 |  | int * | bin
 | ) |

Definition at line 267 of file cvs_hqx.cpp.

00269 {
00270     OSErr err = fnfErr;
00271     FInfo fileinfo;
00272     encodingPolicy inFileType;
00273
00274     GUSIFileSpec inspec(infile);
00275     if(inspec.Error() != noErr)
00276         goto panic;
00277
00278     GUSIFileSpec outspec(outfile);
00279     if(outspec.Error() != noErr)
00280         goto panic;
00281
00282     Boolean encode;
00283
00284     if (inflags & O_BINARY)
00285     {
00286         encode = false;
00287
00288         // the cvswrapper has to be coherent !!!
00289         if((*bin) == 0)
00290             return 0;
00291
00292         gSrcFile = fopen(infile, "r");
00293         if(gSrcFile == NULL)
00294             goto panic;
00295
00296         char buf[100];
00297         static char hqxheader[] = "(This file must be converted with BinHex 4.0)";
00298         UInt32 asheader = AS_MAGIC_NUM;
00299         fread (buf, sizeof(char), 100, gSrcFile);
00300
00301         // Determine whether the file is one of the known encodings
00302         if ( memcmp(hqxheader, buf, strlen(hqxheader) * sizeof(char)) == 0)
00303         {
00304             inFileType = eEncodeHQX;
00305             fseek(gSrcFile, 0, SEEK_SET);
00306         }
00307         else if  ( memcmp(&asheader, buf, sizeof(asheader)) == 0 )
00308         {
00309             fclose(gSrcFile);
00310             inFileType = eEncodeAppleSingle;
00311         }
00312         else
00313         {
00314             // it is a "plain" binary
00315             fclose(gSrcFile);
00316             return 0;
00317         }
00318     }
00319     else
00320     {
00321         encode = true;
00322
00323         // check if it is a text file
00324         CInfoPBRec cbrec;
00325         DirInfo * cb;
00326
00327         cb = (DirInfo *)&cbrec;
00328         cb->ioNamePtr   =   (unsigned char *)inspec->name;
00329         cb->ioDrDirID   =   inspec->parID;
00330         cb->ioVRefNum   =   inspec->vRefNum;
00331         cb->ioFDirIndex =   0;
00332
00333         err = PBGetCatInfoSync((CInfoPBRec *)cb);
00334         if(err != noErr)
00335             goto panic;
00336
00337         fileinfo = ((HFileInfo *)cb)->ioFlFndrInfo;
00338         if(fileinfo.fdType == 'TEXT')
00339             return 0;
00340     }
00341
00342     if(encode)
00343     {
00344         encodingPolicy policy;
00345         determineEncodingPolicy(fileinfo.fdType, &policy);
00346
00347         // special case, some files may be forced as plain binary.
00348         // (env. variable "MAC_BINARY_TYPES_PLAIN")
00349         if(policy == eEncodePlainBinary)
00350         {
00351             *bin = 1;
00352             return 0;
00353         }
00354         else if(policy == eEncodeDefault)
00355         {
00356             // Never encode any files that have no resource fork
00357             // Should we just use the test: if (
00358             short fileRsrc = FSpOpenResFile(&inspec, fsRdPerm);
00359             if(fileRsrc < 0)
00360             {
00361                 // it is a "plain" binary
00362                 *bin = 1;
00363                 return 0;
00364             }
00365             CloseResFile(fileRsrc);
00366
00367             // get default policy
00368             getDefaultEncodingPolicy(&policy);
00369         }
00370
00371         if(policy == eEncodeHQX)
00372         {
00373             gDestFile = fopen(outfile, "w");
00374             if(gDestFile == NULL)
00375                 goto panic;
00376             err = HQXEncode((unsigned char *)inspec->name, inspec->vRefNum, inspec->parID, MyDest, 0);
00377             fflush(gDestFile);
00378             fclose(gDestFile);
00379             if(err != noErr)
00380                 goto panic;
00381         }
00382         else if ( policy == eEncodeAppleSingle )
00383         {
00384 #define APPLESINGLE_WANTED_ENTRIES ((UInt32)AS_DATA_BIT | AS_RESOURCE_BIT | AS_COMMENT_BIT | AS_FINDERINFO_BIT | AS_MACINFO_BIT)
00385             UInt32 wantedEntries = APPLESINGLE_WANTED_ENTRIES;
00386             err = encodeAppleSingle(&inspec, outfile, wantedEntries);
00387             if (err != noErr)
00388                 goto panic;
00389         }
00390         else
00391         {
00392             fprintf( stderr, "Internal error: %s, %s\n", __FILE__, __LINE__);
00393             goto panic;
00394         }
00395     }
00396     else    // decoding
00397     {
00398         if ( inFileType == eEncodeHQX )
00399         {
00400             gDestFileSpec = outspec;
00401
00402             err = HQXDecode(MySource, MyNameFilter, true, true, 0);
00403             fclose(gSrcFile);
00404             if(err != noErr)
00405                 goto panic;
00406         }
00407         else if ( inFileType == eEncodeAppleSingle)
00408         {
00409             UInt32 wantedEntries = APPLESINGLE_WANTED_ENTRIES;
00410             FSSpec macSpec = outspec;
00411             err = decodeAppleSingle(infile, &macSpec, wantedEntries);
00412             if (err != noErr)
00413                 goto panic;
00414
00415
00416             // Sometimes, type/creator information is not encoded inside the AS file
00417             // If so, we want to set type/creator using Internet Config
00418             CInfoPBRec cbrec;
00419             cbrec.hFileInfo.ioNamePtr = macSpec.name;
00420             cbrec.hFileInfo.ioDirID = macSpec.parID;
00421             cbrec.hFileInfo.ioVRefNum = macSpec.vRefNum;
00422             cbrec.hFileInfo.ioFDirIndex =0;
00423
00424             err = PBGetCatInfoSync(&cbrec);
00425             if(err != noErr)
00426                 goto panic;
00427
00428             fileinfo = cbrec.hFileInfo.ioFlFndrInfo;
00429             if( (fileinfo.fdType == AS_DEFAULT_TYPE)
00430                  && ( fileinfo.fdCreator == AS_DEFAULT_CREATOR))
00431             {
00432                 GUSIFileSpec newSpec( macSpec);
00433                 char * fullPath = newSpec.FullPath();
00434                 set_file_type(  fullPath, true );
00435             }
00436         }
00437         else
00438         {
00439             fprintf( stderr, "Internal error: %s, %s\n", __FILE__, __LINE__);
00440             goto panic;
00441         }
00442     }
00443
00444     return 1;
00445 panic:
00446     fprintf(stderr, "Panic error code %d, exiting\n", err);
00447     exit(1);
00448
00449     return 0;
00450 }

unsigned char convert_iso | ( | int | convert_from,
 |  | int | iso,
 |  | unsigned char | c
 | ) |

Definition at line 551 of file cvs_hqx.cpp.

00552 {
00553     static bool tableLoaded = false;
00554     static unsigned char iso_to_mac[256];
00555     static unsigned char mac_to_iso[256];
00556     extern FSSpec sCvsContainerFileSpec;
00557
00558     if(iso != 1) // only Latin 1 available right now
00559         return c;
00560
00561     if(!tableLoaded)
00562     {
00563         short oldRefNum = ::CurResFile();
00564         short refNum = ::FSpOpenResFile(&sCvsContainerFileSpec, fsRdPerm);
00565         if(refNum == -1)
00566         {
00567             fprintf(stderr, "WARNING Cannot open cvs resources !\n");
00568             return c;
00569         }
00570         UseResFile(refNum);
00571
00572         Handle iso_to_mac_hdl = GetResource('taBL', 1001);
00573         Handle mac_to_iso_hdl = GetResource('taBL', 1002);
00574
00575         if(iso_to_mac_hdl == 0L || mac_to_iso_hdl == 0L ||
00576             ::GetHandleSize(iso_to_mac_hdl) != 256 || ::GetHandleSize(mac_to_iso_hdl) != 256)
00577         {
00578             fprintf(stderr, "WARNING ISO8559 tables are missing !\n");
00579             UseResFile(oldRefNum);
00580             return c;
00581         }
00582
00583         memcpy(iso_to_mac, *iso_to_mac_hdl, 256 * sizeof(char));
00584         memcpy(mac_to_iso, *mac_to_iso_hdl, 256 * sizeof(char));
00585
00586         CloseResFile(refNum);
00587         UseResFile(oldRefNum);
00588
00589         tableLoaded = true;
00590     }
00591
00592     return convert_from ? iso_to_mac[c] : mac_to_iso[c];
00593 }

void determineEncodingPolicy | ( | OSType | ftype,
 |  | encodingPolicy * | policy
 | ) | [static]

Definition at line 198 of file cvs_hqx.cpp.

Referenced by convert_hqx_file().

00199 {
00200     if(isPlainBinary(ftype))
00201     {
00202         *policy = eEncodePlainBinary;
00203     }
00204     else if(testHQXEncoding(ftype))
00205     {
00206         *policy = eEncodeHQX;
00207     }
00208     else if(testAppleSingleEncoding(ftype))
00209     {
00210         *policy = eEncodeAppleSingle;
00211     }
00212     else
00213     {
00214         *policy = eEncodeDefault;
00215     }
00216 }

void fillSemiColonTypes | ( | const char * | envVar,
 |  | OSType *& | allTypes,
 |  | int & | numTypes
 | ) | [static]

Definition at line 56 of file cvs_hqx.cpp.

Referenced by isPlainBinary(), testAppleSingleEncoding(), and testHQXEncoding().

00057 {
00058     allTypes = 0L;
00059     numTypes = 0;
00060     const char *envRes = getenv(envVar);
00061     if(envRes == 0L)
00062         return;
00063
00064     char *tmpStr = (char *)malloc(strlen(envRes) + 1);
00065     if(tmpStr == 0L)
00066     {
00067         fprintf(stderr, "Running out of memory !\n");
00068         exit(1);
00069     }
00070     strcpy(tmpStr, envRes);
00071
00072     char *tmp = tmpStr, *colon = 0L, *start = tmpStr;
00073     while((tmp = strchr(tmp, ';')) != 0L)
00074     {
00075         *tmp = '\0';
00076         if((tmp - start) == 4)
00077         {
00078             if(allTypes == 0L)
00079                 allTypes = (OSType *)malloc(sizeof(OSType));
00080             else
00081                 allTypes = (OSType *)realloc(allTypes, (numTypes + 1) * sizeof(OSType));
00082             if(allTypes == 0L)
00083             {
00084                 fprintf(stderr, "Running out of memory !\n");
00085                 exit(1);
00086             }
00087             OSType atype;
00088             ((char *)&atype)[0] = *start++;
00089             ((char *)&atype)[1] = *start++;
00090             ((char *)&atype)[2] = *start++;
00091             ((char *)&atype)[3] = *start;
00092             allTypes[numTypes++] = atype;
00093         }
00094         else
00095         {
00096             fprintf(stderr, "Warning unknown signature %s (variable : %s) !\n", start, envRes);
00097         }
00098
00099         start = ++tmp;
00100     }
00101 }

void getDefaultEncodingPolicy ( encodingPolicy * policy ) [static]

Definition at line 218 of file cvs_hqx.cpp.

Referenced by convert_hqx_file().

00219 {
00220     // get the default encoder
00221     char *envRes = getenv("MAC_DEFAULT_RESOURCE_ENCODING");
00222     if(envRes == 0L)
00223     {
00224         // default was eEncodeHQX, so MWCVS users won't complain
00225         // if they don't set this flag
00226         *policy = eEncodeHQX;
00227         return;
00228     }
00229
00230     if(strcmp(envRes, "HQX") == 0)
00231     {
00232         *policy = eEncodeHQX;
00233         return;
00234     }
00235     else if(strcmp(envRes, "AppleSingle") == 0)
00236     {
00237         *policy = eEncodeAppleSingle;
00238         return;
00239     }
00240
00241     fprintf(stderr, "Unknown resource encoding '%s' !\n", envRes);
00242     exit(1);
00243 }

Boolean isPlainBinary ( OSType ftype ) [static]

Definition at line 103 of file cvs_hqx.cpp.

Referenced by determineEncodingPolicy().

00104 {
00105 #if 1
00106     static OSType *allTypes = (OSType *)-1;
00107     static int numTypes;
00108     if(allTypes == (OSType *)-1)
00109     {
00110         fillSemiColonTypes("MAC_BINARY_TYPES_PLAIN", allTypes, numTypes);
00111     }
00112     if(allTypes == 0L)
00113         return false;
00114     for(int i = 0; i < numTypes; i++)
00115     {
00116         if(allTypes[i] == ftype)
00117             return true;
00118     }
00119     return false;
00120 #else
00121     Handle  typesHandle = Get1Resource (kTypesListResType, kTypesListResID);
00122     if (typesHandle == nil)
00123     {
00124         fprintf(stderr, "Unable to get the ""bin#"" resource (error %d) !\n", ResError());
00125         return false;
00126     }
00127
00128     HLock(typesHandle);
00129     Ptr typesPtr = *typesHandle;
00130
00131     short       typesCount = *(short*)typesPtr;
00132     typesPtr += (2 * sizeof(short)) / sizeof(char); // count + align
00133     OSType*     walker = (OSType *)typesPtr;
00134
00135     while (typesCount-- > 0) {
00136         if (*walker == ftype)
00137         {
00138             HUnlock(typesHandle);
00139             return true;
00140         }
00141         walker++;
00142     }
00143     HUnlock(typesHandle);
00144
00145     return false;
00146 #endif
00147 }

int mac_duplicate | ( | const char * | from,
 |  | const char * | to
 | ) |

Definition at line 520 of file cvs_hqx.cpp.

00521 {
00522     GUSIFileSpec fromspec(macos_fixpath(from));
00523     if(fromspec.Error() != noErr)
00524         return fromspec.Error();
00525
00526     GUSIFileSpec tospec(macos_fixpath(to));
00527     if(tospec.Error() != noErr && tospec.Error() != fnfErr)
00528         return tospec.Error();
00529
00530     FSSpec macfromspec = fromspec;
00531     FSSpec mactospec = tospec;
00532     OSErr err = FileCopy(macfromspec.vRefNum,
00533                          macfromspec.parID,
00534                          macfromspec.name,
00535                          mactospec.vRefNum,
00536                          mactospec.parID,
00537                          nil,
00538                          mactospec.name,
00539                          nil,
00540                          0,
00541                         true);
00542
00543     if(err == fnfErr)
00544         errno = ENOENT;
00545     else if(err != noErr)
00546         errno = err;
00547
00548     return err;
00549 }

char * macos_fixpath ( const char * path )

Definition at line 320 of file macos_filesys.c.

00321 {
00322     char        *sepCh;
00323
00324     // tip to not make unix->mac path conversion when
00325     // this should not happen.
00326     // - this should be obsolete now (4/7/98). Instead
00327     // gives a Mac path for the HOME env. variable
00328     // like "System:Preferences" and cvs will convert it
00329     // back to a Unix path.
00330     if(strncmp(path, "@@@", 3) == 0)
00331     {
00332         strcpy( scratchPath, path + 3 );
00333         Debugger();
00334             // we should never get here anymore
00335         return scratchPath;
00336     }
00337
00338     // special case chdir("..")
00339     if(strcmp(path, "..") == 0)
00340     {
00341         strcpy( scratchPath, "::" );
00342         return scratchPath;
00343     }
00344
00345     // if it is an absolute Unix path, do
00346     // not prefix by ':'
00347     if(path[0] != '/')
00348         strcpy( scratchPath, ":" );
00349     else
00350     {
00351         scratchPath[0] = '\0';
00352         ++path;
00353     }
00354
00355     // Unix "./xxx" is equivalent to ":xxx"
00356     if( (*path == '.') && (*(path+1) == '/') )
00357         strcat( scratchPath, path+2 );
00358     // ???
00359     else if( strcmp(path, ".") != 0 )
00360         strcat( scratchPath, path );
00361
00362     // Finally replace '/' by ':'
00363     while( (sepCh = strchr(scratchPath, '/')) != NULL )
00364         *sepCh = ':';
00365
00366     return scratchPath;
00367 }

void p2cstrcpy | ( | char * | dst,
 |  | ConstStr255Param | src
 | ) |

Definition at line 605 of file cvs_hqx.cpp.

Referenced by MacBinMaps::LoadDefaults(), VolName2VRef(), glue_getenv(), and run_popen().

00607 {
00608     unsigned char len = src[0];
00609     memcpy(dst, &src[1], len);
00610     dst[len] = '\0';
00611 }

void set_file_type | ( | const char * | outfile,
 |  | Boolean | warnOnFail
 | ) |

Definition at line 452 of file cvs_hqx.cpp.

00453 {
00454     OSStatus err;
00455     ICInstance inst;
00456     Str255 filename;
00457
00458     c2pstrcpy(filename, outfile);
00459
00460     err = ICStart(&inst, 'CVS ');           // Use your creator code if you have one!
00461     if (err != noErr)
00462     {
00463         static Boolean firsttime = true;
00464         if(firsttime)
00465         {
00466             fprintf(stderr, "WARNING Internet config's missing !\n");
00467             firsttime = false;
00468         }
00469         return;
00470     }
00471
00472 #if !TARGET_API_MAC_CARBON
00473     err = ICFindConfigFile(inst, 0, nil);
00474     if (err != noErr)
00475     {
00476         static Boolean firsttime2 = true;
00477         if(firsttime2)
00478         {
00479             fprintf(stderr, "WARNING Internet config file's missing !\n");
00480             firsttime2 = false;
00481         }
00482         goto exitall;
00483     }
00484 #endif
00485
00486     ICMapEntry entry;
00487     err = ICMapFilename(inst, filename, &entry);
00488     if (err != noErr)
00489     {
00490         if (warnOnFail)
00491             fprintf(stderr, "WARNING: Internet Config cannot map file %s\n", outfile);
00492         goto exitall;
00493     }
00494     OSErr oserr;
00495     GUSIFileSpec outspec(outfile);
00496     FInfo fndrInfo;
00497
00498     FSSpec macSpec = outspec;
00499     oserr = HGetFInfo(macSpec.vRefNum, macSpec.parID, macSpec.name, &fndrInfo);
00500     if (oserr != noErr)
00501         goto exitall;
00502
00503 #if UNIVERSAL_INTERFACES_VERSION < 0x0331
00504     if(entry.file_creator != 0)
00505         fndrInfo.fdCreator = entry.file_creator;
00506 #else
00507     if(entry.fileCreator != 0)
00508         fndrInfo.fdCreator = entry.fileCreator;
00509 #endif
00510     if(entry.fileType != 0)
00511         fndrInfo.fdType = entry.fileType;
00512     oserr = HSetFInfo(macSpec.vRefNum, macSpec.parID, macSpec.name, &fndrInfo);
00513     if (oserr != noErr)
00514         goto exitall;
00515
00516 exitall:
00517     ICStop(inst);
00518 }

Boolean testAppleSingleEncoding ( OSType ftype ) [static]

Definition at line 167 of file cvs_hqx.cpp.

Referenced by determineEncodingPolicy().

00168 {
00169     static OSType *allTypes = (OSType *)-1;
00170     static int numTypes;
00171     if(allTypes == (OSType *)-1)
00172     {
00173         fillSemiColonTypes("MAC_BINARY_TYPES_SINGLE", allTypes, numTypes);
00174     }
00175     if(allTypes == 0L)
00176         return false;
00177     for(int i = 0; i < numTypes; i++)
00178     {
00179         if(allTypes[i] == ftype)
00180             return true;
00181     }
00182     return false;
00183 }

Boolean testHQXEncoding ( OSType ftype ) [static]

Definition at line 149 of file cvs_hqx.cpp.

Referenced by determineEncodingPolicy().

00150 {
00151     static OSType *allTypes = (OSType *)-1;
00152     static int numTypes;
00153     if(allTypes == (OSType *)-1)
00154     {
00155         fillSemiColonTypes("MAC_BINARY_TYPES_HQX", allTypes, numTypes);
00156     }
00157     if(allTypes == 0L)
00158         return false;
00159     for(int i = 0; i < numTypes; i++)
00160     {
00161         if(allTypes[i] == ftype)
00162             return true;
00163     }
00164     return false;
00165 }

Variable Documentation

FILE* gDestFile [static]

Definition at line 245 of file cvs_hqx.cpp.

FSSpec gDestFileSpec [static]

Definition at line 247 of file cvs_hqx.cpp.

FILE* gSrcFile [static]

Definition at line 246 of file cvs_hqx.cpp.

Generated on Sun Oct 21 12:43:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs_hqx.h File Reference

cvs-1.10/macintosh/cvs_hqx.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int | convert_hqx_file (const char *infile, int inflags, const char *outfile, int outflags, int *bin)
void | set_file_type (const char *outfile, Boolean warnOnFail)
unsigned char | convert_iso (int convert_from, int iso, unsigned char c)
int | mac_duplicate (const char *from, const char *to)

Function Documentation

int convert_hqx_file | ( | const char * | infile,
 |  | int | inflags,
 |  | const char * | outfile,
 |  | int | outflags,
 |  | int * | bin
 | ) |

Definition at line 267 of file cvs_hqx.cpp.

Referenced by convert_file().

00269 {
00270     OSErr err = fnfErr;
00271     FInfo fileinfo;
00272     encodingPolicy inFileType;
00273
00274     GUSIFileSpec inspec(infile);
00275     if(inspec.Error() != noErr)
00276         goto panic;
00277
00278     GUSIFileSpec outspec(outfile);
00279     if(outspec.Error() != noErr)
00280         goto panic;
00281
00282     Boolean encode;
00283
00284     if (inflags & O_BINARY)
00285     {
00286         encode = false;
00287
00288         // the cvswrapper has to be coherent !!!
00289         if((*bin) == 0)
00290             return 0;
00291
00292         gSrcFile = fopen(infile, "r");
00293         if(gSrcFile == NULL)
00294             goto panic;
00295
00296         char buf[100];
00297         static char hqxheader[] = "(This file must be converted with BinHex 4.0)";
00298         UInt32 asheader = AS_MAGIC_NUM;
00299         fread (buf, sizeof(char), 100, gSrcFile);
00300
00301         // Determine whether the file is one of the known encodings
00302         if ( memcmp(hqxheader, buf, strlen(hqxheader) * sizeof(char)) == 0)
00303         {
00304             inFileType = eEncodeHQX;
00305             fseek(gSrcFile, 0, SEEK_SET);
00306         }
00307         else if  ( memcmp(&asheader, buf, sizeof(asheader)) == 0 )
00308         {
00309             fclose(gSrcFile);
00310             inFileType = eEncodeAppleSingle;
00311         }
00312         else
00313         {
00314             // it is a "plain" binary
00315             fclose(gSrcFile);
00316             return 0;
00317         }
00318     }
00319     else
00320     {
00321         encode = true;
00322
00323         // check if it is a text file
00324         CInfoPBRec cbrec;
00325         DirInfo * cb;
00326
00327         cb = (DirInfo *)&cbrec;
00328         cb->ioNamePtr   =   (unsigned char *)inspec->name;
00329         cb->ioDrDirID   =   inspec->parID;
00330         cb->ioVRefNum   =   inspec->vRefNum;
00331         cb->ioFDirIndex =   0;
00332
00333         err = PBGetCatInfoSync((CInfoPBRec *)cb);
00334         if(err != noErr)
00335             goto panic;
00336
00337         fileinfo = ((HFileInfo *)cb)->ioFlFndrInfo;
00338         if(fileinfo.fdType == 'TEXT')
00339             return 0;
00340     }
00341
00342     if(encode)
00343     {
00344         encodingPolicy policy;
00345         determineEncodingPolicy(fileinfo.fdType, &policy);
00346
00347         // special case, some files may be forced as plain binary.
00348         // (env. variable "MAC_BINARY_TYPES_PLAIN")
00349         if(policy == eEncodePlainBinary)
00350         {
00351             *bin = 1;
00352             return 0;
00353         }
00354         else if(policy == eEncodeDefault)
00355         {
00356             // Never encode any files that have no resource fork
00357             // Should we just use the test: if (
00358             short fileRsrc = FSpOpenResFile(&inspec, fsRdPerm);
00359             if(fileRsrc < 0)
00360             {
00361                 // it is a "plain" binary
00362                 *bin = 1;
00363                 return 0;
00364             }
00365             CloseResFile(fileRsrc);
00366
00367             // get default policy
00368             getDefaultEncodingPolicy(&policy);
00369         }
00370
00371         if(policy == eEncodeHQX)
00372         {
00373             gDestFile = fopen(outfile, "w");
00374             if(gDestFile == NULL)
00375                 goto panic;
00376             err = HQXEncode((unsigned char *)inspec->name, inspec->vRefNum, inspec->parID, MyDest, 0);
00377             fflush(gDestFile);
00378             fclose(gDestFile);
00379             if(err != noErr)
00380                 goto panic;
00381         }
00382         else if ( policy == eEncodeAppleSingle )
00383         {
00384 #define APPLESINGLE_WANTED_ENTRIES ((UInt32)AS_DATA_BIT | AS_RESOURCE_BIT | AS_COMMENT_BIT | AS_FINDERINFO_BIT | AS_MACINFO_BIT)
00385             UInt32 wantedEntries = APPLESINGLE_WANTED_ENTRIES;
00386             err = encodeAppleSingle(&inspec, outfile, wantedEntries);
00387             if (err != noErr)
00388                 goto panic;
00389         }
00390         else
00391         {
00392             fprintf( stderr, "Internal error: %s, %s\n", __FILE__, __LINE__);
00393             goto panic;
00394         }
00395     }
00396     else    // decoding
00397     {
00398         if ( inFileType == eEncodeHQX )
00399         {
00400             gDestFileSpec = outspec;
00401
00402             err = HQXDecode(MySource, MyNameFilter, true, true, 0);
00403             fclose(gSrcFile);
00404             if(err != noErr)
00405                 goto panic;
00406         }
00407         else if ( inFileType == eEncodeAppleSingle)
00408         {
00409             UInt32 wantedEntries = APPLESINGLE_WANTED_ENTRIES;
00410             FSSpec macSpec = outspec;
00411             err = decodeAppleSingle(infile, &macSpec, wantedEntries);
00412             if (err != noErr)
00413                 goto panic;
00414
00415
00416             // Sometimes, type/creator information is not encoded inside the AS file
00417             // If so, we want to set type/creator using Internet Config
00418             CInfoPBRec cbrec;
00419             cbrec.hFileInfo.ioNamePtr = macSpec.name;
00420             cbrec.hFileInfo.ioDirID = macSpec.parID;
00421             cbrec.hFileInfo.ioVRefNum = macSpec.vRefNum;
00422             cbrec.hFileInfo.ioFDirIndex =0;
00423
00424             err = PBGetCatInfoSync(&cbrec);
00425             if(err != noErr)
00426                 goto panic;
00427
00428             fileinfo = cbrec.hFileInfo.ioFlFndrInfo;
00429             if( (fileinfo.fdType == AS_DEFAULT_TYPE)
00430                  && ( fileinfo.fdCreator == AS_DEFAULT_CREATOR))
00431             {
00432                 GUSIFileSpec newSpec( macSpec);
00433                 char * fullPath = newSpec.FullPath();
00434                 set_file_type(  fullPath, true );
00435             }
00436         }
00437         else
00438         {
00439             fprintf( stderr, "Internal error: %s, %s\n", __FILE__, __LINE__);
00440             goto panic;
00441         }
00442     }
00443
00444     return 1;
00445 panic:
00446     fprintf(stderr, "Panic error code %d, exiting\n", err);
00447     exit(1);
00448
00449     return 0;
00450 }

unsigned char convert_iso | ( | int | convert_from,
 |  | int | iso,
 |  | unsigned char | c
 | ) |

Definition at line 551 of file cvs_hqx.cpp.

Referenced by convert_file().

00552 {
00553     static bool tableLoaded = false;
00554     static unsigned char iso_to_mac[256];
00555     static unsigned char mac_to_iso[256];
00556     extern FSSpec sCvsContainerFileSpec;
00557
00558     if(iso != 1) // only Latin 1 available right now
00559         return c;
00560
00561     if(!tableLoaded)
00562     {
00563         short oldRefNum = ::CurResFile();
00564         short refNum = ::FSpOpenResFile(&sCvsContainerFileSpec, fsRdPerm);
00565         if(refNum == -1)
00566         {
00567             fprintf(stderr, "WARNING Cannot open cvs resources !\n");
00568             return c;
00569         }
00570         UseResFile(refNum);
00571
00572         Handle iso_to_mac_hdl = GetResource('taBL', 1001);
00573         Handle mac_to_iso_hdl = GetResource('taBL', 1002);
00574
00575         if(iso_to_mac_hdl == 0L || mac_to_iso_hdl == 0L ||
00576             ::GetHandleSize(iso_to_mac_hdl) != 256 || ::GetHandleSize(mac_to_iso_hdl) != 256)
00577         {
00578             fprintf(stderr, "WARNING ISO8559 tables are missing !\n");
00579             UseResFile(oldRefNum);
00580             return c;
00581         }
00582
00583         memcpy(iso_to_mac, *iso_to_mac_hdl, 256 * sizeof(char));
00584         memcpy(mac_to_iso, *mac_to_iso_hdl, 256 * sizeof(char));
00585
00586         CloseResFile(refNum);
00587         UseResFile(oldRefNum);
00588
00589         tableLoaded = true;
00590     }
00591
00592     return convert_from ? iso_to_mac[c] : mac_to_iso[c];
00593 }

int mac_duplicate | ( | const char * | from,
 |  | const char * | to
 | ) |

Definition at line 520 of file cvs_hqx.cpp.

00521 {
00522     GUSIFileSpec fromspec(macos_fixpath(from));
00523     if(fromspec.Error() != noErr)
00524         return fromspec.Error();
00525
00526     GUSIFileSpec tospec(macos_fixpath(to));
00527     if(tospec.Error() != noErr && tospec.Error() != fnfErr)
00528         return tospec.Error();
00529
00530     FSSpec macfromspec = fromspec;
00531     FSSpec mactospec = tospec;
00532     OSErr err = FileCopy(macfromspec.vRefNum,
00533                          macfromspec.parID,
00534                          macfromspec.name,
00535                          mactospec.vRefNum,
00536                          mactospec.parID,
00537                          nil,
00538                          mactospec.name,
00539                          nil,
00540                          0,
00541                         true);
00542
00543     if(err == fnfErr)
00544         errno = ENOENT;
00545     else if(err != noErr)
00546         errno = err;
00547
00548     return err;
00549 }

void set_file_type | ( | const char * | outfile,
 |  | Boolean | warnOnFail
 | ) |

Definition at line 452 of file cvs_hqx.cpp.

Referenced by convert_file(), and convert_hqx_file().

00453 {
00454     OSStatus err;
00455     ICInstance inst;
00456     Str255 filename;
00457
00458     c2pstrcpy(filename, outfile);
00459
00460     err = ICStart(&inst, 'CVS ');           // Use your creator code if you have one!
00461     if (err != noErr)
00462     {
00463         static Boolean firsttime = true;
00464         if(firsttime)
00465         {
00466             fprintf(stderr, "WARNING Internet config's missing !\n");
00467             firsttime = false;
00468         }
00469         return;
00470     }
00471
00472 #if !TARGET_API_MAC_CARBON
00473     err = ICFindConfigFile(inst, 0, nil);
00474     if (err != noErr)
00475     {
00476         static Boolean firsttime2 = true;
00477         if(firsttime2)
00478         {
00479             fprintf(stderr, "WARNING Internet config file's missing !\n");
00480             firsttime2 = false;
00481         }
00482         goto exitall;
00483     }
00484 #endif
00485
00486     ICMapEntry entry;
00487     err = ICMapFilename(inst, filename, &entry);
00488     if (err != noErr)
00489     {
00490         if (warnOnFail)
00491             fprintf(stderr, "WARNING: Internet Config cannot map file %s\n", outfile);
00492         goto exitall;
00493     }
00494     OSErr oserr;
00495     GUSIFileSpec outspec(outfile);
00496     FInfo fndrInfo;
00497
00498     FSSpec macSpec = outspec;
00499     oserr = HGetFInfo(macSpec.vRefNum, macSpec.parID, macSpec.name, &fndrInfo);
00500     if (oserr != noErr)
00501         goto exitall;
00502
00503 #if UNIVERSAL_INTERFACES_VERSION < 0x0331
00504     if(entry.file_creator != 0)
00505         fndrInfo.fdCreator = entry.file_creator;
00506 #else
00507     if(entry.fileCreator != 0)
00508         fndrInfo.fdCreator = entry.fileCreator;
00509 #endif
00510     if(entry.fileType != 0)
00511         fndrInfo.fdType = entry.fileType;
00512     oserr = HSetFInfo(macSpec.vRefNum, macSpec.parID, macSpec.name, &fndrInfo);
00513     if (oserr != noErr)
00514         goto exitall;
00515
00516 exitall:
00517     ICStop(inst);
00518 }

Generated on Sun Oct 21 12:43:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GUSIlsh.h File Reference

cvs-1.10/macintosh/GUSIlsh.h File Reference

#include <sys/signal.h>
#include "lsh_dll.h"

Include dependency graph for GUSIlsh.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | gusilsh_ctx

Functions

void | GUSIwithLSHSockets (void)
void | GUSIwithoutLSHSockets (void)
void | GUSILSH_set_context (gusilsh_ctx *ctx)
void | GUSILSH_cleanup (int sig)
void | GUSILSH_hdlevt (long userData, long sleepTime)

Function Documentation

void GUSILSH_cleanup ( int sig )

void GUSILSH_hdlevt | ( | long | userData,
 |  | long | sleepTime
 | ) |

void GUSILSH_set_context ( gusilsh_ctx * ctx )

void GUSIwithLSHSockets ( void )

Referenced by macos_initialize().

void GUSIwithoutLSHSockets ( void )

Referenced by macos_cleanup().

Generated on Sun Oct 21 12:43:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


hqx.c File Reference

cvs-1.10/macintosh/hqx.c File Reference

#include "hqx.h"
#include <string.h>
#include <Errors.h>
#include <TextUtils.h>
#include <PLStringFuncs.h>
#include <Finder.h>

Include dependency graph for hqx.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | HQXDecodeVars
struct | HQXEncodeVars

Defines

#define | CVS_CHANGES
#define | kBinHexMagic 0x1021
#define | kRLEFlag 0x90
#define | kCopyBufLen 4096
#define | HT ((char) 9)
#define | LF ((char) 10)
#define | CR ((char) 13)

Typedefs

typedef * | HQXEncVarsPtr
typedef * | HQXDecVarsPtr

Functions

void | BuildCRCTable (unsigned short magic_number)
unsigned short | initial_crc (void)
unsigned short | crc_byte (unsigned short crc, unsigned char byte)
unsigned short | crc_run (unsigned short crc, void *buf, long len)
void | HQXInit (void)
OSErr | BUFFWrite (HQXEncVarsPtr encv, void *buffer, long count)
OSErr | BUFFWriteEnd (HQXEncVarsPtr encv)
OSErr | HQXWrite (HQXEncVarsPtr encv, void *buffer, long count)
OSErr | HQXWriteEnd (HQXEncVarsPtr encv)
OSErr | FlushRLE (HQXEncVarsPtr encv)
OSErr | RLEWrite (HQXEncVarsPtr encv, void *buffer, long count)
OSErr | RLEWriteEnd (HQXEncVarsPtr encv)
OSErr | WriterInit (HQXEncVarsPtr encv, HQXSink dst, long refcon)
OSErr | CRCWriteInit (HQXEncVarsPtr encv)
OSErr | CRCWrite (HQXEncVarsPtr encv, void *buffer, long count)
OSErr | CRCWriteEnd (HQXEncVarsPtr encv)
OSErr | HQXEncode (StringPtr name, short vol, long dir, HQXSink dst, long refcon)
OSErr | GetNextCharacter (HQXDecVarsPtr decv, unsigned char *the_char)
OSErr | HQXRead (HQXDecVarsPtr decv, void *buffer, long count)
OSErr | RLERead (HQXDecVarsPtr decv, void *buffer, long count)
OSErr | CRCReadInit (HQXDecVarsPtr decv)
OSErr | CRCRead (HQXDecVarsPtr decv, void *buffer, long count)
OSErr | CRCReadEnd (HQXDecVarsPtr decv)
OSErr | HQXDecode (HQXSource src, HQXNameFilter fname, Boolean can_replace, Boolean header_search, long refcon)

Variables

Boolean | gHQXinited = false
char * | gHQX = "!\"#$%&'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr"
short | hqxtab [256]
short | ihqxtab [256]
unsigned short | crctab [256]

Define Documentation

#define CR ((char) 13)

Definition at line 38 of file hqx.c.

#define CVS_CHANGES

Definition at line 27 of file hqx.c.

#define HT ((char) 9)

Definition at line 36 of file hqx.c.

#define LF ((char) 10)

Definition at line 37 of file hqx.c.

#define kBinHexMagic 0x1021

Definition at line 33 of file hqx.c.

#define kCopyBufLen 4096

Definition at line 35 of file hqx.c.

#define kRLEFlag 0x90

Definition at line 34 of file hqx.c.

Typedef Documentation

typedef * HQXDecVarsPtr

typedef * HQXEncVarsPtr

Function Documentation

OSErr BUFFWrite | ( | HQXEncVarsPtr | encv,
 |  | void * | buffer,
 |  | long | count
 | ) | [static]

Definition at line 133 of file hqx.c.

Referenced by HQXWrite(), HQXWriteEnd(), and WriterInit().

00133                                                                      {
00134     unsigned char* ch;
00135     long i;
00136     OSErr err;
00137     ch = (unsigned char*) buffer;
00138     for (i = 0;i < count;i++) {
00139         if (encv->fOutBufp - encv->fOutBuffer == sizeof(encv->fOutBuffer)) {
00140             if ((err = encv->fSink(encv->fOutBuffer, sizeof(encv->fOutBuffer), encv->fSinkRefCon)) != noErr) return err;
00141             encv->fOutBufp = encv->fOutBuffer;
00142         }
00143         *encv->fOutBufp++ = *ch++;
00144     }
00145     return noErr;
00146 }

OSErr BUFFWriteEnd ( HQXEncVarsPtr encv ) [static]

Definition at line 148 of file hqx.c.

Referenced by RLEWriteEnd().

00148                                               {
00149     if (encv->fOutBufp - encv->fOutBuffer > 0)
00150         return encv->fSink(encv->fOutBuffer, encv->fOutBufp - encv->fOutBuffer, encv->fSinkRefCon);
00151     else return noErr;
00152 }

void BuildCRCTable ( unsigned short magic_number ) [static]

Definition at line 77 of file hqx.c.

Referenced by HQXInit().

00077                                                        {
00078     unsigned long i, magic, mgc, val, bit;
00079     for (i = 0; i < 256; i++) {
00080         magic = (magic_number << 8);
00081         mgc = (magic >> 1);
00082         val = (i << 16);
00083         for (bit = 23; bit > 15; bit--) {
00084             if ((val & (1 << bit)) != 0) val ^= mgc;
00085             mgc >>= 1;
00086         }
00087         crctab[i] = val & 0xFFFF;
00088     }
00089 }

OSErr CRCRead | ( | HQXDecVarsPtr | decv,
 |  | void * | buffer,
 |  | long | count
 | ) | [static]

Definition at line 488 of file hqx.c.

Referenced by HQXDecode().

00488                                                                    {
00489     OSErr err;
00490     if ((err = RLERead(decv, buffer, count)) != noErr) return err;
00491     decv->fCRC = crc_run(decv->fCRC, buffer, count);
00492     return noErr;
00493 }

OSErr CRCReadEnd ( HQXDecVarsPtr decv ) [static]

Definition at line 495 of file hqx.c.

Referenced by HQXDecode().

00495                                             {
00496     OSErr err;
00497     unsigned short saved_crc;
00498     if ((err = RLERead(decv, &saved_crc, 2)) != noErr) return err;
00499     decv->fCRC = crc_byte(decv->fCRC, 0);
00500     decv->fCRC = crc_byte(decv->fCRC, 0);
00501     if (saved_crc != decv->fCRC) return paramErr; else return noErr;
00502 }

OSErr CRCReadInit ( HQXDecVarsPtr decv ) [static]

Definition at line 483 of file hqx.c.

Referenced by HQXDecode().

00483                                              {
00484     decv->fCRC = initial_crc();
00485     return noErr;
00486 }

OSErr CRCWrite | ( | HQXEncVarsPtr | encv,
 |  | void * | buffer,
 |  | long | count
 | ) | [static]

Definition at line 279 of file hqx.c.

Referenced by HQXEncode().

00279                                                                     {
00280     encv->fCRC = crc_run(encv->fCRC, buffer, count);
00281     return RLEWrite(encv, buffer, count);
00282 }

OSErr CRCWriteEnd ( HQXEncVarsPtr encv ) [static]

Definition at line 284 of file hqx.c.

Referenced by HQXEncode().

00284                                              {
00285     encv->fCRC = crc_byte(encv->fCRC, 0);
00286     encv->fCRC = crc_byte(encv->fCRC, 0);
00287     return RLEWrite(encv, &encv->fCRC, 2);
00288 }

OSErr CRCWriteInit ( HQXEncVarsPtr encv ) [static]

Definition at line 274 of file hqx.c.

Referenced by HQXEncode().

00274                                               {
00275     encv->fCRC = initial_crc();
00276     return noErr;
00277 }

OSErr FlushRLE ( HQXEncVarsPtr encv ) [static]

Definition at line 194 of file hqx.c.

Referenced by RLEWrite(), and RLEWriteEnd().

00194                                           {
00195     long n;
00196     OSErr err;
00197     unsigned char buffer[10], *putp;
00198     while (encv->fRLECount > 0) {
00199         n = encv->fRLECount > 255 ? 255 : encv->fRLECount;
00200         putp = buffer;
00201         *putp++ = encv->fRLECharacter;
00202         if (encv->fRLECharacter == kRLEFlag) {
00203             *putp++ = 0;    /* literal flag value */
00204             if (n == 2) {
00205                 *putp++ = kRLEFlag;
00206                 *putp++ = 0;    /* literal flag value */
00207             } else if (n > 2) {
00208                 *putp++ = kRLEFlag;
00209                 *putp++ = n;    /* repeat count */
00210             }
00211         } else {
00212             if (n == 2)
00213                 *putp++ = encv->fRLECharacter;
00214             else if (n == 3) {
00215                 *putp++ = encv->fRLECharacter;
00216                 *putp++ = encv->fRLECharacter;
00217             } else if (n > 3) {
00218                 *putp++ = kRLEFlag;
00219                 *putp++ = n;
00220             }
00221         }
00222         if ((err = HQXWrite(encv, buffer, putp - buffer)) != noErr) return err;
00223         encv->fRLECount -= n;
00224     }
00225     return err;
00226 }

OSErr GetNextCharacter | ( | HQXDecVarsPtr | decv,
 |  | unsigned char * | the_char
 | ) | [static]

Definition at line 402 of file hqx.c.

Referenced by HQXDecode(), and HQXRead().

00402                                                                            {
00403     OSErr err;
00404     long bytes;
00405     if (decv->fInBufp >= decv->fInBufMax) {
00406         err = decv->fSource(decv->fInBuffer, (bytes = sizeof(decv->fInBuffer), &bytes), decv->fSourceRefCon);
00407         if (err == eofErr) err = noErr;
00408         if (err != noErr) return err;
00409         decv->fInBufp = decv->fInBuffer;
00410         decv->fInBufMax = decv->fInBuffer + bytes;
00411         if (decv->fInBufp >= decv->fInBufMax) return eofErr;
00412     }
00413     *the_char = *decv->fInBufp++;
00414     return noErr;
00415 }

OSErr HQXDecode | ( | HQXSource | src,
 |  | HQXNameFilter | fname,
 |  | Boolean | can_replace,
 |  | Boolean | header_search,
 |  | long | refcon
 | ) |

Definition at line 508 of file hqx.c.

00508                                                                                                              {
00509     OSErr err;
00510     FInfo info, tinfo;
00511     long zero, bytecount, actcount, dir, data_length, rsrc_length;
00512     short refnum, vol;
00513     Str255 name;
00514     Boolean file_exists;
00515     HQXDecVarsPtr decv;
00516
00517         /* set up */
00518     HQXInit();
00519     decv = NULL;
00520     zero = 0;
00521     refnum = 0;
00522     vol = 0;
00523     dir = 0;
00524     file_exists = false;
00525
00526         /* allocate shared variables */
00527     decv = (HQXDecVarsPtr) NewPtrClear(sizeof(HQXDecodeVars));
00528     if ((err = MemError()) != noErr) goto bail;
00529
00530         /* reader globals */
00531     decv->fRLECount = 0;
00532     decv->fInBufMax = decv->fInBufp = decv->fInBuffer;
00533     decv->fSource = src;
00534     decv->fSourceRefCon = refcon;
00535     decv->fBitBuffer = decv->fBitBufferBits = 0;
00536     decv->fInHqxData = false;
00537
00538         /* search for the header string */
00539     if (header_search) {
00540         char *header, *headerp, inputchar;
00541         headerp = header = "(This file must be converted with BinHex 4.0)";
00542         while (*headerp != '\0') {
00543             err = GetNextCharacter(decv, (unsigned char*) &inputchar);
00544             if (err != noErr) goto bail;
00545             if (inputchar == *headerp) headerp++; else headerp = header;
00546         }
00547     }
00548
00549         /* hqx file header */
00550     err = CRCReadInit(decv);
00551     if (err != noErr) goto bail;
00552     err = CRCRead(decv, name, 1);
00553     if (err != noErr) goto bail;
00554     err = CRCRead(decv, name+1, *name);
00555     if (err != noErr) goto bail;
00556     err = CRCRead(decv, &zero, 1);
00557     if (err != noErr) goto bail;
00558     err = CRCRead(decv, &info, 10);
00559     if (err != noErr) goto bail;
00560     err = CRCRead(decv, &data_length, 4);
00561     if (err != noErr) goto bail;
00562     err = CRCRead(decv, &rsrc_length, 4);
00563     if (err != noErr) goto bail;
00564     err = CRCReadEnd(decv);
00565     if (err != noErr) goto bail;
00566
00567         /* create destination file */
00568     if (fname != NULL) {
00569         err = fname(name, &vol, &dir, refcon);
00570         if (err != noErr) goto bail;
00571     }
00572     if (can_replace) {
00573         err = HDelete(vol, dir, name);
00574         if (err == fnfErr) err = noErr;
00575         if (err != noErr) goto bail;
00576     }
00577     err = HCreate(vol, dir, name, info.fdCreator, info.fdType);
00578     if (err != noErr) goto bail;
00579     file_exists = true;
00580     err = HGetFInfo(vol, dir, name, &tinfo);
00581     if (err != noErr) goto bail;
00582 #ifdef CVS_CHANGES
00583     tinfo.fdFlags = info.fdFlags & (~(kNameLocked | kHasBeenInited));
00584 #else
00585     tinfo.fdFlags = info.fdFlags & (~kHasBeenInited);
00586 #endif
00587     err = HSetFInfo(vol, dir, name, &tinfo);
00588     if (err != noErr) goto bail;
00589
00590         /* file data fork */
00591     err = CRCReadInit(decv);
00592     if (err != noErr) goto bail;
00593     err = HOpenDF(vol, dir, name, fsRdWrPerm, &refnum);
00594     if (err != noErr) goto bail;
00595     for (bytecount = 0; bytecount < data_length; bytecount += actcount) {
00596         actcount = data_length - bytecount;
00597         if (actcount > sizeof(decv->fOutBuffer)) actcount = sizeof(decv->fOutBuffer);
00598         err = CRCRead(decv, decv->fOutBuffer, actcount);
00599         if (err != noErr) goto bail;
00600         err = FSWrite(refnum, &actcount, decv->fOutBuffer);
00601         if (err != noErr) goto bail;
00602     }
00603     FSClose(refnum); refnum = 0;
00604     err = CRCReadEnd(decv);
00605     if (err != noErr) goto bail;
00606
00607         /* file resource fork */
00608     err = CRCReadInit(decv);
00609     if (err != noErr) goto bail;
00610     err = HOpenRF(vol, dir, name, fsRdWrPerm, &refnum);
00611     if (err != noErr) goto bail;
00612     for (bytecount = 0; bytecount < rsrc_length; bytecount += actcount) {
00613         actcount = rsrc_length - bytecount;
00614         if (actcount > sizeof(decv->fOutBuffer)) actcount = sizeof(decv->fOutBuffer);
00615         err = CRCRead(decv, decv->fOutBuffer, actcount);
00616         if (err != noErr) goto bail;
00617         err = FSWrite(refnum, &actcount, decv->fOutBuffer);
00618         if (err != noErr) goto bail;
00619     }
00620     FSClose(refnum); refnum = 0;
00621     err = CRCReadEnd(decv);
00622     if (err != noErr) goto bail;
00623
00624     DisposePtr((Ptr) decv);
00625     return noErr;
00626
00627 bail:
00628     if (refnum != 0) FSClose(refnum);
00629     if (file_exists) HDelete(vol, dir, name);
00630     if (decv != NULL) DisposePtr((Ptr) decv);
00631     return err;
00632 }

OSErr HQXEncode | ( | StringPtr | name,
 |  | short | vol,
 |  | long | dir,
 |  | HQXSink | dst,
 |  | long | refcon
 | ) |

Definition at line 291 of file hqx.c.

00291                                                                                {
00292     OSErr err;
00293     long zero, bytecount, actcount;
00294     short refnum;
00295     HParamBlockRec pb;
00296     HQXEncVarsPtr encv;
00297 #ifdef CVS_CHANGES
00298     Point zeroPoint = {0, 0};
00299 #endif
00300
00301         /* set up */
00302     zero = 0;
00303     refnum = 0;
00304     encv = NULL;
00305     HQXInit();
00306     encv = (HQXEncVarsPtr) NewPtrClear(sizeof(HQXEncodeVars));
00307     if ((err = MemError()) != noErr) goto bail;
00308     encv->fRLECount = 0;
00309
00310     err = WriterInit(encv, dst, refcon);
00311     if (err != noErr) goto bail;
00312
00313         /* hqx file header */
00314     err = CRCWriteInit(encv);
00315     if (err != noErr) goto bail;
00316         memset(&pb, 0, sizeof(pb));
00317         pb.fileParam.ioNamePtr = name;
00318         pb.fileParam.ioDirID = dir;
00319         pb.fileParam.ioVRefNum = vol;
00320         pb.fileParam.ioFDirIndex = 0;
00321         pb.fileParam.ioFVersNum = 0;
00322         err = PBHGetFInfoSync(&pb);
00323         if (err != noErr) goto bail;
00324 #ifdef CVS_CHANGES
00325         /* the name is no use for cvs */
00326         err = CRCWrite(encv, "\p", 1);
00327 #else
00328         err = CRCWrite(encv, name, *name + 1);
00329 #endif
00330         if (err != noErr) goto bail;
00331         err = CRCWrite(encv, &zero, 1);
00332         if (err != noErr) goto bail;
00333 #ifdef CVS_CHANGES
00334         /* let remove some user specific flags which may differ with the repository file */
00335         pb.fileParam.ioFlFndrInfo.fdFldr = 0;
00336         pb.fileParam.ioFlFndrInfo.fdLocation = zeroPoint;
00337         pb.fileParam.ioFlFndrInfo.fdFlags &= ~(kNameLocked | kHasBeenInited);
00338 #endif
00339         err = CRCWrite(encv, &pb.fileParam.ioFlFndrInfo, 10);
00340         if (err != noErr) goto bail;
00341         err = CRCWrite(encv, &pb.fileParam.ioFlLgLen, 4);
00342         if (err != noErr) goto bail;
00343         err = CRCWrite(encv, &pb.fileParam.ioFlRLgLen, 4);
00344         if (err != noErr) goto bail;
00345     err = CRCWriteEnd(encv);
00346     if (err != noErr) goto bail;
00347
00348         /*  file data fork */
00349     err = CRCWriteInit(encv);
00350     if (err != noErr) goto bail;
00351         err = HOpenDF(vol, dir, name, fsRdPerm, &refnum);
00352         if (err != noErr) goto bail;
00353         for (bytecount = 0; bytecount < pb.fileParam.ioFlLgLen; bytecount += actcount) {
00354             actcount = pb.fileParam.ioFlLgLen - bytecount;
00355             if (actcount > sizeof(encv->fInBuffer)) actcount = sizeof(encv->fInBuffer);
00356             err = FSRead(refnum, &actcount, encv->fInBuffer);
00357             if (err != noErr) goto bail;
00358             err = CRCWrite(encv, encv->fInBuffer, actcount);
00359             if (err != noErr) goto bail;
00360         }
00361         FSClose(refnum); refnum = 0;
00362     err = CRCWriteEnd(encv);
00363     if (err != noErr) goto bail;
00364
00365         /* file resource fork */
00366     err = CRCWriteInit(encv);
00367     if (err != noErr) goto bail;
00368         err = HOpenRF(vol, dir, name, fsRdPerm, &refnum);
00369         if (err != noErr) goto bail;
00370         for (bytecount = 0; bytecount < pb.fileParam.ioFlRLgLen; bytecount += actcount) {
00371             actcount = pb.fileParam.ioFlRLgLen - bytecount;
00372             if (actcount > sizeof(encv->fInBuffer)) actcount = sizeof(encv->fInBuffer);
00373             err = FSRead(refnum, &actcount, encv->fInBuffer);
00374             if (err != noErr) goto bail;
00375             err = CRCWrite(encv, encv->fInBuffer, actcount);
00376             if (err != noErr) goto bail;
00377         }
00378         FSClose(refnum); refnum = 0;
00379     err = CRCWriteEnd(encv);
00380     if (err != noErr) goto bail;
00381
00382     err = RLEWriteEnd(encv);
00383     if (err != noErr) goto bail;
00384     DisposePtr((Ptr) encv);
00385
00386     return noErr;
00387
00388 bail:
00389     if (refnum != 0) FSClose(refnum);
00390     if (encv != NULL) DisposePtr((Ptr) encv);
00391     return err;
00392 }

void HQXInit ( void ) [static]

Definition at line 108 of file hqx.c.

Referenced by HQXDecode(), and HQXEncode().

00108                           {
00109     if (!gHQXinited) {
00110         long i, n;
00111         for (i = 0;i < 256;i++) {
00112             hqxtab[i] = -1;
00113             ihqxtab[i] = -1;
00114         }
00115         for (i = 0, n = strlen(gHQX); i < n; i++) {
00116             hqxtab[gHQX[i]] = i;
00117             ihqxtab[i] = gHQX[i];
00118         }
00119         hqxtab[CR] = -2;
00120         hqxtab[LF] = -2;
00121         hqxtab[HT] = -2;
00122         hqxtab[' '] = -2;
00123         hqxtab[':'] = -3;
00124         BuildCRCTable(kBinHexMagic);
00125         gHQXinited = true;
00126     }
00127 }

OSErr HQXRead | ( | HQXDecVarsPtr | decv,
 |  | void * | buffer,
 |  | long | count
 | ) | [static]

Definition at line 417 of file hqx.c.

Referenced by RLERead().

00417                                                                    {
00418     unsigned char *dst, code;
00419     long i;
00420     long readcode;
00421     OSErr err;
00422
00423     dst = (unsigned char*) buffer;
00424     for ( i = 0; i < count; i++) {
00425         while (decv->fBitBufferBits < 8)  {
00426             readcode = -1;
00427             while (readcode < 0) {
00428                     /* get the next character */
00429                 err = GetNextCharacter(decv, &code);
00430                 if (err != noErr) return err;
00431                     /* look up the code in the table and dispatch on the value */
00432                 readcode = hqxtab[code];
00433                 if (readcode == -3) {
00434                     decv->fInHqxData = !decv->fInHqxData;
00435                 } else if (!decv->fInHqxData)
00436                     readcode = -1;
00437             }
00438             decv->fBitBuffer = (decv->fBitBuffer<<6) | readcode;
00439             decv->fBitBufferBits += 6;
00440         }
00441         *dst++ = (decv->fBitBuffer>>(decv->fBitBufferBits-8));
00442         decv->fBitBufferBits -= 8;
00443     }
00444
00445     return noErr;
00446 }

OSErr HQXWrite | ( | HQXEncVarsPtr | encv,
 |  | void * | buffer,
 |  | long | count
 | ) | [static]

Definition at line 157 of file hqx.c.

Referenced by FlushRLE().

00157                                                                     {
00158     unsigned char* ch, code;
00159     long i, v;
00160     OSErr err;
00161     ch = (unsigned char*) buffer;
00162     for (i = 0; i < count; i++, ch++) {
00163         encv->fBitBuffer = (encv->fBitBuffer << 8) | ((*ch)&255);
00164         encv->fBitBufferBits += 8;
00165         while (encv->fBitBufferBits >= 6) {
00166             v = (encv->fBitBuffer >> (encv->fBitBufferBits-6)) & 0x003F;
00167             encv->fBitBufferBits -= 6;
00168             code = ihqxtab[v];
00169             if ((err = BUFFWrite(encv, &code, 1)) != noErr) return err;
00170             encv->fNOutChars++;
00171             if ((encv->fNOutChars % 64) == 0) {
00172                 if ((err = BUFFWrite(encv, "\n", 1)) != noErr) return err;
00173             }
00174         }
00175     }
00176     return noErr;
00177 }

OSErr HQXWriteEnd ( HQXEncVarsPtr encv ) [static]

Definition at line 179 of file hqx.c.

Referenced by RLEWriteEnd().

00179                                              {
00180     unsigned char code;
00181     OSErr err;
00182     if (encv->fBitBufferBits > 0) {
00183         code = ihqxtab[encv->fBitBuffer<<(6-encv->fBitBufferBits) & 0x03F];
00184         if ((err = BUFFWrite(encv, &code, 1)) != noErr) return err;
00185         encv->fNOutChars++;
00186     }
00187     return BUFFWrite(encv, ":\n", 2);
00188 }

OSErr RLERead | ( | HQXDecVarsPtr | decv,
 |  | void * | buffer,
 |  | long | count
 | ) | [static]

Definition at line 451 of file hqx.c.

Referenced by CRCRead(), and CRCReadEnd().

00451                                                                    {
00452     unsigned char *ch, nextchar, countvalue;
00453     long i;
00454     OSErr err;
00455
00456     ch = (unsigned char*) buffer;
00457     err = noErr;
00458     for ( i=0; i < count; )
00459         if (decv->fRLECount > 0) {
00460             *ch++ = decv->fRLECharacter;
00461             decv->fRLECount--;
00462             i++;
00463         } else {
00464             if ((err = HQXRead(decv, &nextchar, 1)) != noErr) return err;
00465             if (nextchar == kRLEFlag) {
00466                 if ((err = HQXRead(decv, &countvalue, 1)) != noErr) return err;
00467                 if (countvalue == 0) {
00468                     decv->fRLECharacter = kRLEFlag;
00469                     decv->fRLECount = 1;
00470                 } else decv->fRLECount = countvalue - 1;
00471             } else {
00472                 decv->fRLECharacter = nextchar;
00473                 decv->fRLECount = 1;
00474             }
00475         }
00476
00477     return noErr;
00478 }

OSErr RLEWrite | ( | HQXEncVarsPtr | encv,
 |  | void * | buffer,
 |  | long | count
 | ) | [static]

Definition at line 228 of file hqx.c.

Referenced by CRCWrite(), and CRCWriteEnd().

00228                                                                     {
00229     unsigned char *ch;
00230     long i;
00231     OSErr err;
00232     ch = (unsigned char*) buffer;
00233     err = noErr;
00234     for (ch = (unsigned char*) buffer, i = 0; i < count; i++, ch++) {
00235         if (encv->fRLECount == 0) {
00236             encv->fRLECharacter = *ch;
00237             encv->fRLECount = 1;
00238         } else if (*ch == encv->fRLECharacter)
00239             encv->fRLECount += 1;
00240         else {
00241             if ((err = FlushRLE(encv)) != noErr) return err;
00242             encv->fRLECharacter = *ch;
00243             encv->fRLECount = 1;
00244         }
00245     }
00246     return err;
00247 }

OSErr RLEWriteEnd ( HQXEncVarsPtr encv ) [static]

Definition at line 249 of file hqx.c.

Referenced by HQXEncode().

00249                                              {
00250     OSErr err;
00251     if ((err = FlushRLE(encv)) != noErr) return err;
00252     if ((err = HQXWriteEnd(encv)) != noErr) return err;
00253     return BUFFWriteEnd(encv);
00254 }

OSErr WriterInit | ( | HQXEncVarsPtr | encv,
 |  | HQXSink | dst,
 |  | long | refcon
 | ) | [static]

Definition at line 257 of file hqx.c.

Referenced by HQXEncode().

00257                                                                       {
00258     OSErr err;
00259     char *p;
00260     p = "(This file must be converted with BinHex 4.0)\n:";
00261     encv->fRLECount = 0;
00262     encv->fOutBufp = encv->fOutBuffer;
00263     encv->fSink = dst;
00264     encv->fSinkRefCon = refcon;
00265     if ((err = BUFFWrite(encv, p, strlen(p))) != noErr) return err;
00266     encv->fNOutChars = 1;
00267     encv->fBitBuffer = encv->fBitBufferBits = 0;
00268     return noErr;
00269 }

unsigned short crc_byte | ( | unsigned short | crc,
 |  | unsigned char | byte
 | ) | [static]

Definition at line 95 of file hqx.c.

Referenced by CRCReadEnd(), and CRCWriteEnd().

00095                                                                        {
00096     return ( (crctab[(crc >> 8) & 255] ^ ((crc << 8) | byte)) & 0xFFFF );
00097 }

unsigned short crc_run | ( | unsigned short | crc,
 |  | void * | buf,
 |  | long | len
 | ) | [static]

Definition at line 99 of file hqx.c.

Referenced by CRCRead(), and CRCWrite().

00099                                                                        {
00100     unsigned char *ch = buf;
00101     long i;
00102     unsigned short crcv = crc;
00103     for (i = 0; i < len; i++)
00104          crcv = (crctab[(crcv >> 8) & 255] ^ ((crcv << 8) | (*ch++))) & 0xFFFF;
00105     return crcv;
00106 }

unsigned short initial_crc ( void ) [static]

Definition at line 91 of file hqx.c.

Referenced by CRCReadInit(), and CRCWriteInit().

00091                                         {
00092     return 0;
00093 }

Variable Documentation

unsigned short crctab[256] [static]

Definition at line 72 of file hqx.c.

char* gHQX = "!\"#$%&'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr" [static]

Definition at line 69 of file hqx.c.

Boolean gHQXinited = false [static]

Definition at line 68 of file hqx.c.

short hqxtab[256] [static]

Definition at line 70 of file hqx.c.

short ihqxtab[256] [static]

Definition at line 71 of file hqx.c.

Generated on Sun Oct 21 12:43:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


hqx.h File Reference

cvs-1.10/macintosh/hqx.h File Reference

#include <Types.h>
#include <Files.h>

Include dependency graph for hqx.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Typedefs

typedef OSErr(* | HQXSink )(void *buffer, long count, long refcon)
typedef OSErr(* | HQXSource )(void *buffer, long *count, long refcon)
typedef OSErr(* | HQXNameFilter )(StringPtr name, short *vol, long *dir, long refcon)

Functions

OSErr | HQXEncode (StringPtr name, short vol, long dir, HQXSink dst, long refcon)
OSErr | HQXDecode (HQXSource src, HQXNameFilter fname, Boolean can_replace, Boolean header_search, long refcon)

Typedef Documentation

typedef OSErr(* HQXNameFilter)(StringPtr name, short *vol, long *dir, long refcon)

Definition at line 79 of file hqx.h.

typedef OSErr(* HQXSink)(void* buffer, long count, long refcon)

Definition at line 44 of file hqx.h.

typedef OSErr(* HQXSource)(void* buffer, long *count, long refcon)

Definition at line 70 of file hqx.h.

Function Documentation

OSErr HQXDecode | ( | HQXSource | src,
 |  | HQXNameFilter | fname,
 |  | Boolean | can_replace,
 |  | Boolean | header_search,
 |  | long | refcon
 | ) |

Definition at line 508 of file hqx.c.

Referenced by convert_hqx_file().

00508                                                                                                              {
00509     OSErr err;
00510     FInfo info, tinfo;
00511     long zero, bytecount, actcount, dir, data_length, rsrc_length;
00512     short refnum, vol;
00513     Str255 name;
00514     Boolean file_exists;
00515     HQXDecVarsPtr decv;
00516
00517         /* set up */
00518     HQXInit();
00519     decv = NULL;
00520     zero = 0;
00521     refnum = 0;
00522     vol = 0;
00523     dir = 0;
00524     file_exists = false;
00525
00526         /* allocate shared variables */
00527     decv = (HQXDecVarsPtr) NewPtrClear(sizeof(HQXDecodeVars));
00528     if ((err = MemError()) != noErr) goto bail;
00529
00530         /* reader globals */
00531     decv->fRLECount = 0;
00532     decv->fInBufMax = decv->fInBufp = decv->fInBuffer;
00533     decv->fSource = src;
00534     decv->fSourceRefCon = refcon;
00535     decv->fBitBuffer = decv->fBitBufferBits = 0;
00536     decv->fInHqxData = false;
00537
00538         /* search for the header string */
00539     if (header_search) {
00540         char *header, *headerp, inputchar;
00541         headerp = header = "(This file must be converted with BinHex 4.0)";
00542         while (*headerp != '\0') {
00543             err = GetNextCharacter(decv, (unsigned char*) &inputchar);
00544             if (err != noErr) goto bail;
00545             if (inputchar == *headerp) headerp++; else headerp = header;
00546         }
00547     }
00548
00549         /* hqx file header */
00550     err = CRCReadInit(decv);
00551     if (err != noErr) goto bail;
00552     err = CRCRead(decv, name, 1);
00553     if (err != noErr) goto bail;
00554     err = CRCRead(decv, name+1, *name);
00555     if (err != noErr) goto bail;
00556     err = CRCRead(decv, &zero, 1);
00557     if (err != noErr) goto bail;
00558     err = CRCRead(decv, &info, 10);
00559     if (err != noErr) goto bail;
00560     err = CRCRead(decv, &data_length, 4);
00561     if (err != noErr) goto bail;
00562     err = CRCRead(decv, &rsrc_length, 4);
00563     if (err != noErr) goto bail;
00564     err = CRCReadEnd(decv);
00565     if (err != noErr) goto bail;
00566
00567         /* create destination file */
00568     if (fname != NULL) {
00569         err = fname(name, &vol, &dir, refcon);
00570         if (err != noErr) goto bail;
00571     }
00572     if (can_replace) {
00573         err = HDelete(vol, dir, name);
00574         if (err == fnfErr) err = noErr;
00575         if (err != noErr) goto bail;
00576     }
00577     err = HCreate(vol, dir, name, info.fdCreator, info.fdType);
00578     if (err != noErr) goto bail;
00579     file_exists = true;
00580     err = HGetFInfo(vol, dir, name, &tinfo);
00581     if (err != noErr) goto bail;
00582 #ifdef CVS_CHANGES
00583     tinfo.fdFlags = info.fdFlags & (~(kNameLocked | kHasBeenInited));
00584 #else
00585     tinfo.fdFlags = info.fdFlags & (~kHasBeenInited);
00586 #endif
00587     err = HSetFInfo(vol, dir, name, &tinfo);
00588     if (err != noErr) goto bail;
00589
00590         /* file data fork */
00591     err = CRCReadInit(decv);
00592     if (err != noErr) goto bail;
00593     err = HOpenDF(vol, dir, name, fsRdWrPerm, &refnum);
00594     if (err != noErr) goto bail;
00595     for (bytecount = 0; bytecount < data_length; bytecount += actcount) {
00596         actcount = data_length - bytecount;
00597         if (actcount > sizeof(decv->fOutBuffer)) actcount = sizeof(decv->fOutBuffer);
00598         err = CRCRead(decv, decv->fOutBuffer, actcount);
00599         if (err != noErr) goto bail;
00600         err = FSWrite(refnum, &actcount, decv->fOutBuffer);
00601         if (err != noErr) goto bail;
00602     }
00603     FSClose(refnum); refnum = 0;
00604     err = CRCReadEnd(decv);
00605     if (err != noErr) goto bail;
00606
00607         /* file resource fork */
00608     err = CRCReadInit(decv);
00609     if (err != noErr) goto bail;
00610     err = HOpenRF(vol, dir, name, fsRdWrPerm, &refnum);
00611     if (err != noErr) goto bail;
00612     for (bytecount = 0; bytecount < rsrc_length; bytecount += actcount) {
00613         actcount = rsrc_length - bytecount;
00614         if (actcount > sizeof(decv->fOutBuffer)) actcount = sizeof(decv->fOutBuffer);
00615         err = CRCRead(decv, decv->fOutBuffer, actcount);
00616         if (err != noErr) goto bail;
00617         err = FSWrite(refnum, &actcount, decv->fOutBuffer);
00618         if (err != noErr) goto bail;
00619     }
00620     FSClose(refnum); refnum = 0;
00621     err = CRCReadEnd(decv);
00622     if (err != noErr) goto bail;
00623
00624     DisposePtr((Ptr) decv);
00625     return noErr;
00626
00627 bail:
00628     if (refnum != 0) FSClose(refnum);
00629     if (file_exists) HDelete(vol, dir, name);
00630     if (decv != NULL) DisposePtr((Ptr) decv);
00631     return err;
00632 }

OSErr HQXEncode | ( | StringPtr | name,
 |  | short | vol,
 |  | long | dir,
 |  | HQXSink | dst,
 |  | long | refcon
 | ) |

Definition at line 291 of file hqx.c.

Referenced by convert_hqx_file().

00291                                                                                {
00292     OSErr err;
00293     long zero, bytecount, actcount;
00294     short refnum;
00295     HParamBlockRec pb;
00296     HQXEncVarsPtr encv;
00297 #ifdef CVS_CHANGES
00298     Point zeroPoint = {0, 0};
00299 #endif
00300
00301         /* set up */
00302     zero = 0;
00303     refnum = 0;
00304     encv = NULL;
00305     HQXInit();
00306     encv = (HQXEncVarsPtr) NewPtrClear(sizeof(HQXEncodeVars));
00307     if ((err = MemError()) != noErr) goto bail;
00308     encv->fRLECount = 0;
00309
00310     err = WriterInit(encv, dst, refcon);
00311     if (err != noErr) goto bail;
00312
00313         /* hqx file header */
00314     err = CRCWriteInit(encv);
00315     if (err != noErr) goto bail;
00316         memset(&pb, 0, sizeof(pb));
00317         pb.fileParam.ioNamePtr = name;
00318         pb.fileParam.ioDirID = dir;
00319         pb.fileParam.ioVRefNum = vol;
00320         pb.fileParam.ioFDirIndex = 0;
00321         pb.fileParam.ioFVersNum = 0;
00322         err = PBHGetFInfoSync(&pb);
00323         if (err != noErr) goto bail;
00324 #ifdef CVS_CHANGES
00325         /* the name is no use for cvs */
00326         err = CRCWrite(encv, "\p", 1);
00327 #else
00328         err = CRCWrite(encv, name, *name + 1);
00329 #endif
00330         if (err != noErr) goto bail;
00331         err = CRCWrite(encv, &zero, 1);
00332         if (err != noErr) goto bail;
00333 #ifdef CVS_CHANGES
00334         /* let remove some user specific flags which may differ with the repository file */
00335         pb.fileParam.ioFlFndrInfo.fdFldr = 0;
00336         pb.fileParam.ioFlFndrInfo.fdLocation = zeroPoint;
00337         pb.fileParam.ioFlFndrInfo.fdFlags &= ~(kNameLocked | kHasBeenInited);
00338 #endif
00339         err = CRCWrite(encv, &pb.fileParam.ioFlFndrInfo, 10);
00340         if (err != noErr) goto bail;
00341         err = CRCWrite(encv, &pb.fileParam.ioFlLgLen, 4);
00342         if (err != noErr) goto bail;
00343         err = CRCWrite(encv, &pb.fileParam.ioFlRLgLen, 4);
00344         if (err != noErr) goto bail;
00345     err = CRCWriteEnd(encv);
00346     if (err != noErr) goto bail;
00347
00348         /*  file data fork */
00349     err = CRCWriteInit(encv);
00350     if (err != noErr) goto bail;
00351         err = HOpenDF(vol, dir, name, fsRdPerm, &refnum);
00352         if (err != noErr) goto bail;
00353         for (bytecount = 0; bytecount < pb.fileParam.ioFlLgLen; bytecount += actcount) {
00354             actcount = pb.fileParam.ioFlLgLen - bytecount;
00355             if (actcount > sizeof(encv->fInBuffer)) actcount = sizeof(encv->fInBuffer);
00356             err = FSRead(refnum, &actcount, encv->fInBuffer);
00357             if (err != noErr) goto bail;
00358             err = CRCWrite(encv, encv->fInBuffer, actcount);
00359             if (err != noErr) goto bail;
00360         }
00361         FSClose(refnum); refnum = 0;
00362     err = CRCWriteEnd(encv);
00363     if (err != noErr) goto bail;
00364
00365         /* file resource fork */
00366     err = CRCWriteInit(encv);
00367     if (err != noErr) goto bail;
00368         err = HOpenRF(vol, dir, name, fsRdPerm, &refnum);
00369         if (err != noErr) goto bail;
00370         for (bytecount = 0; bytecount < pb.fileParam.ioFlRLgLen; bytecount += actcount) {
00371             actcount = pb.fileParam.ioFlRLgLen - bytecount;
00372             if (actcount > sizeof(encv->fInBuffer)) actcount = sizeof(encv->fInBuffer);
00373             err = FSRead(refnum, &actcount, encv->fInBuffer);
00374             if (err != noErr) goto bail;
00375             err = CRCWrite(encv, encv->fInBuffer, actcount);
00376             if (err != noErr) goto bail;
00377         }
00378         FSClose(refnum); refnum = 0;
00379     err = CRCWriteEnd(encv);
00380     if (err != noErr) goto bail;
00381
00382     err = RLEWriteEnd(encv);
00383     if (err != noErr) goto bail;
00384     DisposePtr((Ptr) encv);
00385
00386     return noErr;
00387
00388 bail:
00389     if (refnum != 0) FSClose(refnum);
00390     if (encv != NULL) DisposePtr((Ptr) encv);
00391     return err;
00392 }

Generated on Sun Oct 21 12:43:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


kclient_if.c File Reference

cvs-1.10/macintosh/kclient_if.c File Reference

Go to the source code of this file.

Generated on Sun Oct 21 12:43:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


kclient_if.h File Reference

cvs-1.10/macintosh/kclient_if.h File Reference

#include <KrbDriver.h>
#include <KClient.h>

Include dependency graph for kclient_if.h:

Include dependency graph

Go to the source code of this file.

Defines

#define | HAVE_KRB_GET_ERR_TEXT
#define | KOPT_DO_MUTUAL 0x00000002
#define | KSUCCESS 0
#define | KFAILURE 255

Functions

char * | krb_get_err_text (int status)
int | krb_sendauth (long options, int fd, KTEXT ticket, char *service, char *inst, char *realm, u_long checksum, MSG_DAT *msg_data, CREDENTIALS *cred, Key_schedule schedule, struct sockaddr_in *laddr, struct sockaddr_in *faddr, char *version)

Variables

KClientSessionInfo | KSession

Define Documentation

#define HAVE_KRB_GET_ERR_TEXT

Definition at line 10 of file kclient_if.h.

#define KFAILURE 255

Definition at line 25 of file kclient_if.h.

#define KOPT_DO_MUTUAL 0x00000002

Definition at line 21 of file kclient_if.h.

#define KSUCCESS 0

Definition at line 24 of file kclient_if.h.

Function Documentation

char* krb_get_err_text ( int status )

int krb_sendauth | ( | long | options,
 |  | int | fd,
 |  | KTEXT | ticket,
 |  | char * | service,
 |  | char * | inst,
 |  | char * | realm,
 |  | u_long | checksum,
 |  | MSG_DAT * | msg_data,
 |  | CREDENTIALS * | cred,
 |  | Key_schedule | schedule,
 |  | struct sockaddr_in * | laddr,
 |  | struct sockaddr_in * | faddr,
 |  | char * | version
 | ) |

Variable Documentation

KClientSessionInfo KSession

Definition at line 12 of file kclient_if.h.

Generated on Sun Oct 21 12:43:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


lsh_dll.h File Reference

cvs-1.10/macintosh/lsh_dll.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Typedefs

typedef void * | lshctx
typedef void(* | hdlevtfunc )(long userData, long sleepTime)
typedef void(* | logfunc )(long userData, const char *message)
typedef char *(* | getpassfunc )(long userData, const char *prompt)
typedef int(* | yesornofunc )(long userData, const char *prompt, int def)

Functions

lshctx * | lsh_new (char *argstr, hdlevtfunc hdlevt, logfunc log, getpassfunc getpass, yesornofunc yes_or_no, long userData)
void | lsh_delete (lshctx *ctx)
void | lsh_yield ()
int | lsh_read (lshctx *ctx, void *buffer, long inbytes)
long | lsh_write (lshctx *ctx, const void *buffer, long inbytes)
int | lsh_canread (lshctx *ctx)
int | lsh_canwrite (lshctx *ctx)
char * | lsh_getprefsd ()
lshctx * lsh_current ()
Boolean | lsh_running (lshctx *ctx)
void | lsh_init (void)
void | lsh_terminate (void)

Typedef Documentation

typedef char*(* getpassfunc)(long userData, const char *prompt)

Definition at line 26 of file lsh_dll.h.

typedef void(* hdlevtfunc)(long userData, long sleepTime)

Definition at line 24 of file lsh_dll.h.

typedef void(* logfunc)(long userData, const char *message)

Definition at line 25 of file lsh_dll.h.

typedef void* lshctx

Definition at line 22 of file lsh_dll.h.

typedef int(* yesornofunc)(long userData, const char *prompt, int def)

Definition at line 27 of file lsh_dll.h.

Function Documentation

int lsh_canread ( lshctx * ctx )

int lsh_canwrite ( lshctx * ctx )

lshctx* lsh_current ( )

void lsh_delete ( lshctx * ctx )

char* lsh_getprefsd ( )

void lsh_init ( void )

lshctx* lsh_new | ( | char * | argstr,
 |  | hdlevtfunc | hdlevt,
 |  | logfunc | log,
 |  | getpassfunc | getpass,
 |  | yesornofunc | yes_or_no,
 |  | long | userData
 | ) |

int lsh_read | ( | lshctx * | ctx,
 |  | void * | buffer,
 |  | long | inbytes
 | ) |

Boolean lsh_running ( lshctx * ctx )

void lsh_terminate ( void )

long lsh_write | ( | lshctx * | ctx,
 |  | const void * | buffer,
 |  | long | inbytes
 | ) |

void lsh_yield ( )

Generated on Sun Oct 21 12:43:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


mac_filesubr.c File Reference

cvs-1.10/macintosh/mac_filesubr.c File Reference

#include "cvs.h"

Include dependency graph for mac_filesubr.c:

Include dependency graph

Go to the source code of this file.

Functions

int deep_remove_dir | PROTO ((const char *path))
void | copy_file (from, to) const char *from

Variables

const char * | to
const int | mode
int | writable
char * | buf
size_t | nchars
const char * | file2
char ** | argv
int * | pargc
char *** | pargv

Function Documentation

int deep_remove_dir PROTO ( (const char *path) ) [static]

void copy_file | ( | from | ,
 |  | to |
 | ) | const

Variable Documentation

char** argv

Definition at line 884 of file mac_filesubr.c.

char* buf

Definition at line 578 of file mac_filesubr.c.

const char* file2

Definition at line 615 of file mac_filesubr.c.

const char* mode

Definition at line 280 of file mac_filesubr.c.

size_t nchars

Definition at line 579 of file mac_filesubr.c.

int* pargc

Definition at line 885 of file mac_filesubr.c.

char*** pargv

Definition at line 886 of file mac_filesubr.c.

const char* to

Definition at line 406 of file mac_filesubr.c.

int writable

Definition at line 361 of file mac_filesubr.c.

Generated on Sun Oct 21 12:43:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


mac_run.c File Reference

cvs-1.10/macintosh/mac_run.c File Reference

#include "config.h"
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <MacErrors.h>
#include "GUSIlsh.h"

Include dependency graph for mac_run.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | CLOSE_ON_EXEC_MAX 10

Functions

void | close_on_exec (int s)
void | macos_cleanup (void)
void | macos_initialize (int *argc, char ***argv)
void | run_arg (const char *s)
void | run_print (FILE *fp)
void | run_setup (const char *fmt)
void | run_args (const char *fmt)
int | run_exec (const char *stin, const char *stout, const char *sterr, int flags)
int | piped_child (char **, int *, int *)
int | filter_stream_through_program (int, int, char **, pid_t *)
void * | alloca (size_t size)
char * | getpass (const char *prompt)
FILE * | run_popen (const char *cmd, const char *perm)
int | pclose (FILE *fp)

Variables

int | _close_on_exec_num = 0
int | _close_on_exec_list [10]

Define Documentation

#define CLOSE_ON_EXEC_MAX 10

Definition at line 26 of file mac_run.c.

Function Documentation

void* alloca ( size_t size )

Definition at line 57 of file mac_run.c.

00057 {return malloc(size);} /* MacCVS garbages allocations anyway */

void close_on_exec ( int s )

Definition at line 30 of file mac_run.c.

00031 {
00032     if(_close_on_exec_num < CLOSE_ON_EXEC_MAX)
00033         _close_on_exec_list[_close_on_exec_num++] = s;
00034 }

int filter_stream_through_program | ( | int | ,
 |  | int | ,
 |  | char ** | ,
 |  | pid_t * |
 | ) |

Definition at line 56 of file mac_run.c.

00056 { return 0; }

char* getpass ( const char * prompt )

Definition at line 59 of file mac_run.c.

00060 {
00061 #ifndef MAC_SHL
00062     return NULL;
00063 #else /* MAC_SHL */
00064     char *value = (char *)xmalloc(strlen(prompt) + strlen("CVS_GETPASS") + 2);
00065     char *res;
00066     strcpy(value, "CVS_GETPASS");
00067     strcat(value, "=");
00068     strcat(value, prompt);
00069     res = getenv(value); /* let MacCvs get the password */
00070     free(value);
00071     return res;
00072 #endif /* MAC_SHL */
00073 }

void macos_cleanup ( void )

Definition at line 36 of file mac_run.c.

00037 {
00038     int i;
00039     for(i = 0; i < _close_on_exec_num; i++)
00040         close(_close_on_exec_list[i]);
00041     GUSIwithoutLSHSockets();
00042
00043 }

void macos_initialize | ( | int * | argc,
 |  | char *** | argv
 | ) |

Definition at line 45 of file mac_run.c.

Referenced by SYSTEM_INITIALIZE().

00046 {
00047     GUSIwithLSHSockets();
00048 }

int pclose ( FILE * stream )

Definition at line 396 of file mac_run.c.

00396 {return 0;}

int piped_child | ( | char ** | argv,
 |  | int * | to,
 |  | int * | from
 | ) |

Definition at line 55 of file mac_run.c.

00055 { return 0; }

void run_arg ( const char * s )

Definition at line 50 of file mac_run.c.

00050 { }

void run_args ( const char * fmt )

Definition at line 53 of file mac_run.c.

00053 { }

int run_exec | ( | const char * | stin,
 |  | const char * | stout,
 |  | const char * | sterr,
 |  | int | flags
 | ) |

Definition at line 54 of file mac_run.c.

00054 { return 0; }

FILE* run_popen | ( | const char * | cmd,
 |  | const char * | perm
 | ) |

Definition at line 324 of file mac_run.c.

00325 {
00326 #ifndef MAC_SHL
00327     return NULL;
00328 #else /* MAC_SHL */
00329     char **argv = 0L;
00330     int argc, i;
00331     const char *tmp;
00332     FSSpec theFolder;
00333     Str255 thePath;
00334     FILE *result = 0L;
00335     char cur_wd[512];
00336
00337     getcwd(cur_wd, 512);
00338
00339     /* resign if it is not something we know about */
00340     if(cmd == 0L || strncmp(cmd, program_path, strlen(program_path)) != 0)
00341         goto abort;
00342
00343     if(MacGetPrefsFolder(&theFolder, thePath) != noErr)
00344         goto abort;
00345
00346     p2cstrcpy((char *)thePath);
00347     if(thePath[strlen((char *)thePath) - 1] != ':')
00348         strcat((char *)thePath, ":");
00349     strcat((char *)thePath, "__maccvsTmpPopen");
00350     gRunOut = fopen((char *)thePath, "w");
00351     if(gRunOut == 0L)
00352     {
00353         fprintf(stderr, "Impossible to open '%s' (error %d)\n", "__maccvsTmpPopen", errno);
00354         goto abort;
00355     }
00356
00357     /* split the command line */
00358     argv = split_cmdline(cmd, &argc);
00359     if(argv == 0L)
00360         goto abort;
00361
00362     launchCVS(cur_wd, argc, argv);
00363
00364     fclose(gRunOut);
00365     gRunOut = 0L;
00366     gRunOut = fopen((char *)thePath, "r");
00367     if(gRunOut == 0L)
00368     {
00369         fprintf(stderr, "Impossible to open '%s' (error %d)\n", "__maccvsTmpPopen", errno);
00370         goto abort;
00371     }
00372
00373     result = gRunOut;
00374     gRunOut = 0L;
00375
00376 abort:
00377     if(gRunOut != 0L)
00378     {
00379         fclose(gRunOut);
00380         gRunOut = 0L;
00381     }
00382     if(argv != 0L)
00383     {
00384         for(i = 0; i < argc; i++)
00385         {
00386             free(argv[i]);
00387         }
00388         free(argv);
00389     }
00390
00391     return result;
00392 #endif /* MAC_SHL */
00393 }

void run_print ( FILE * fp )

Definition at line 51 of file mac_run.c.

00051 { }

void run_setup ( const char * prog )

Definition at line 52 of file mac_run.c.

00052 { }

Variable Documentation

int _close_on_exec_list[ 10 ] [static]

Definition at line 28 of file mac_run.c.

int _close_on_exec_num = 0 [static]

Definition at line 27 of file mac_run.c.

Generated on Sun Oct 21 12:43:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


macos_filesys.c File Reference

cvs-1.10/macintosh/macos_filesys.c File Reference

#include "cvs.h"
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <CodeFragments.h>
#include "cvs_hqx.h"
#include "FileCopy.h"
#include "FullPath.h"

Include dependency graph for macos_filesys.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | TRACE(arg)

Functions

void | convert_file (char *infile, int inflags, char *outfile, int outflags, int binary)
int | decode_file (char *infile)
char * | macos_fixpath (const char *path)
int | macos_mkdir (const char *path, int oflag)
int | macos_open (const char *path, int oflag,...)
int | macos_chmod (const char *path, mode_t mode)
int | macos_creat (const char *path, mode_t mode)
FILE * | macos_fopen (const char *path, const char *mode)
int | macos_chdir (const char *path)
int | macos_access (const char *path, int amode)
DIR * | macos_opendir (const char *path)
int | macos_stat (const char *path, struct stat *ststr)
int | macos_lstat (const char *path, struct stat *ststr)
int | macos_rename (const char *path, const char *newpath)
int | macos_rmdir (const char *path)
int | macos_unlink (const char *path)

Variables

char | scratchPath [1024]

Define Documentation

#define TRACE ( arg )

Definition at line 174 of file macos_filesys.c.

Referenced by CCJCaption::Create(), CCJMenu::LoadMenu(), CHistComboBoxEx::NewRoot(), macos_access(), macos_chdir(), macos_chmod(), macos_creat(), macos_fopen(), macos_lstat(), macos_mkdir(), macos_open(), macos_opendir(), macos_rename(), macos_rmdir(), macos_stat(), and macos_unlink().

Function Documentation

void convert_file | ( | char * | infile,
 |  | int | inflags,
 |  | char * | outfile,
 |  | int | outflags,
 |  | int | binary
 | ) |

Definition at line 35 of file macos_filesys.c.

Referenced by decode_file().

00037 {
00038     FILE *infd, *outfd;
00039     char buf[8192];
00040     int len;
00041     int decode; /* 1 : server to client format, 0: client to server format */
00042 #ifdef BINHEX_STUFF
00043 #   define ISO8559_VALID(iso) ((iso) == 1)
00044     static int set_text_signature = -1;
00045     static int convert_iso8559 = -1;
00046
00047     if(convert_iso8559 == -1)
00048     {
00049         const char *iso = getenv("ISO8859");
00050         if(iso == NULL || sscanf(iso, "%d", &convert_iso8559) != 1 ||
00051             !ISO8559_VALID(convert_iso8559))
00052                 convert_iso8559 = 0;
00053     }
00054     if(set_text_signature == -1)
00055     {
00056         set_text_signature = getenv("IC_ON_TXT") != NULL ? 1 : 0;
00057     }
00058
00059     /* "update" doesn't check if we can erase the dest file */
00060     chmod(outfile, S_IRWXU);
00061
00062     if(convert_hqx_file(infile, inflags, outfile, outflags, &binary))
00063         return;
00064 #endif /* BINHEX_STUFF */
00065
00066     if (inflags & OPEN_BINARY) {
00067         decode = true;
00068     } else {
00069         decode = false;
00070     }
00071
00072     if ((infd = fopen (infile, (binary || (inflags & OPEN_BINARY)) ? "rb" : "r")) == NULL)
00073         error (1, errno, "couldn't read %s", infile);
00074     if ((outfd = fopen (outfile, (binary || (outflags & OPEN_BINARY)) ? "wb" : "w")) == NULL)
00075         error (1, errno, "couldn't write %s", outfile);
00076
00077     while ((len = fread (buf, sizeof (char), sizeof (buf) / sizeof(char), infd)) > 0) {
00078         char * conv     = buf;
00079         int    convlen  = len;
00080 #ifdef BINHEX_STUFF
00081         if(binary == 0 && convert_iso8559) while (convlen--)
00082         {
00083             *conv = (char)convert_iso(decode, convert_iso8559, (unsigned char)*conv);
00084             conv++;
00085         }
00086 #endif /* BINHEX_STUFF */
00087
00088         if (fwrite (buf, sizeof(char), len, outfd) < 0)
00089             error (1, errno, "error writing %s", outfile);
00090     }
00091     if (len < 0)
00092         error (1, errno, "error reading %s", infile);
00093
00094     if (fclose (outfd) != 0)
00095         error (0, errno, "warning: couldn't close %s", outfile);
00096     if (fclose (infd) != 0)
00097         error (0, errno, "warning: couldn't close %s", infile);
00098
00099 #ifdef BINHEX_STUFF
00100     if((binary || set_text_signature) && decode)
00101         set_file_type(outfile, !quiet);
00102 #endif /* BINHEX_STUFF */
00103 }

int decode_file ( char * infile )

Definition at line 114 of file macos_filesys.c.

Referenced by dllglue_decode_file().

00115 {
00116     OSErr   err;
00117     FSSpec  inspec;
00118     FSSpec  tempSpec;
00119     FSSpec  tempDirSpec;
00120     char*   temp_filename = cvs_temp_name ();
00121     Str31   temp_name_str;
00122     int     bin = 0;
00123
00124     /* Make source spec */
00125     err = FSpLocationFromFullPath (strlen (infile), infile, &inspec);
00126     if (noErr != err) return err;
00127
00128     /* Make temp dir spec */
00129     BlockMoveData (temp_filename, temp_name_str + 1, temp_name_str[0] = strlen (temp_filename));
00130     err = FSMakeFSSpec (0, 0, temp_name_str, &tempSpec);
00131     err = FSMakeFSSpec (tempSpec.vRefNum, tempSpec.parID, nil, &tempDirSpec);
00132     if (noErr != err) return err;
00133
00134     /* Copy to the temp file */
00135     err = FSpFileCopy (&inspec, &tempDirSpec, tempSpec.name, nil, 0, true);
00136     if (noErr != err) return err;
00137
00138     /* Convert temp file back over infile */
00139     convert_file (temp_filename, O_RDONLY | OPEN_BINARY, infile, O_WRONLY | O_CREAT | O_TRUNC, bin);
00140
00141     /* Delete the temp file */
00142     FSpDelete (&tempSpec);
00143
00144     return 0;
00145 }

int macos_access | ( | const char * | path,
 |  | int | amode
 | ) |

Definition at line 256 of file macos_filesys.c.

Referenced by lstat().

00257 {
00258     int res = access( macos_fixpath(path), amode );
00259     TRACE((stderr, "access %s %x -> %d", macos_fixpath(path), amode, res));
00260     return res;
00261 }

int macos_chdir ( const char * path )

Definition at line 237 of file macos_filesys.c.

Referenced by lstat().

00238 {
00239     int r;
00240     char    *macPath;
00241
00242     macPath = macos_fixpath(path);
00243
00244     r = chdir(macPath);
00245     TRACE((stderr, "chdir %s -> %d", macPath, r));
00246     if( r < 0 )
00247     {
00248         r = chdir(macPath+1);
00249         TRACE((stderr, "chdir %s -> %d", macPath+1, r));
00250     }
00251
00252     return r;
00253 }

int macos_chmod | ( | const char * | path,
 |  | mode_t | mode
 | ) |

Definition at line 205 of file macos_filesys.c.

Referenced by lstat().

00206 {
00207     int res = chmod(macos_fixpath(path), mode);
00208     TRACE((stderr, "chmod %s %x -> %d", macos_fixpath(path), mode, res));
00209     return res;
00210 }

int macos_creat | ( | const char * | path,
 |  | mode_t | mode
 | ) |

Definition at line 213 of file macos_filesys.c.

Referenced by lstat().

00214 {
00215     int res = creat( macos_fixpath(path) );
00216     TRACE((stderr, "creat %s -> %d", macos_fixpath(path), res));
00217     return res;
00218 }

char* macos_fixpath ( const char * path )

Definition at line 320 of file macos_filesys.c.

Referenced by mac_duplicate(), macos_access(), macos_chdir(), macos_chmod(), macos_creat(), macos_fopen(), macos_lstat(), macos_mkdir(), macos_open(), macos_opendir(), macos_rename(), macos_rmdir(), macos_stat(), and macos_unlink().

00321 {
00322     char        *sepCh;
00323
00324     // tip to not make unix->mac path conversion when
00325     // this should not happen.
00326     // - this should be obsolete now (4/7/98). Instead
00327     // gives a Mac path for the HOME env. variable
00328     // like "System:Preferences" and cvs will convert it
00329     // back to a Unix path.
00330     if(strncmp(path, "@@@", 3) == 0)
00331     {
00332         strcpy( scratchPath, path + 3 );
00333         Debugger();
00334             // we should never get here anymore
00335         return scratchPath;
00336     }
00337
00338     // special case chdir("..")
00339     if(strcmp(path, "..") == 0)
00340     {
00341         strcpy( scratchPath, "::" );
00342         return scratchPath;
00343     }
00344
00345     // if it is an absolute Unix path, do
00346     // not prefix by ':'
00347     if(path[0] != '/')
00348         strcpy( scratchPath, ":" );
00349     else
00350     {
00351         scratchPath[0] = '\0';
00352         ++path;
00353     }
00354
00355     // Unix "./xxx" is equivalent to ":xxx"
00356     if( (*path == '.') && (*(path+1) == '/') )
00357         strcat( scratchPath, path+2 );
00358     // ???
00359     else if( strcmp(path, ".") != 0 )
00360         strcat( scratchPath, path );
00361
00362     // Finally replace '/' by ':'
00363     while( (sepCh = strchr(scratchPath, '/')) != NULL )
00364         *sepCh = ':';
00365
00366     return scratchPath;
00367 }

FILE* macos_fopen | ( | const char * | path,
 |  | const char * | mode
 | ) |

Definition at line 221 of file macos_filesys.c.

Referenced by lstat().

00222 {
00223     FILE    *fp;
00224
00225     fp = fopen(macos_fixpath(path), mode);
00226
00227     TRACE((stderr, "fopen %s %x -> %d", macos_fixpath(path), mode, fp != 0L));
00228
00229     /* I'm getting ENOTDIR, CVS expects ENOENT */
00230
00231     if( (fp == NULL) && (errno == ENOTDIR) ) errno = ENOENT;
00232
00233     return fp;
00234 }

int macos_lstat | ( | const char * | path,
 |  | struct stat * | ststr
 | ) |

Definition at line 280 of file macos_filesys.c.

Referenced by lstat().

00281 {
00282     int res = lstat( macos_fixpath(path), ststr );
00283     TRACE((stderr, "lstat %s -> %d", macos_fixpath(path), res));
00284     return res;
00285 }

int macos_mkdir | ( | const char * | path,
 |  | int | oflag
 | ) |

Definition at line 178 of file macos_filesys.c.

Referenced by lstat().

00179 {
00180     int res = mkdir( macos_fixpath(path) );
00181     TRACE((stderr, "mkdir %s -> %d", macos_fixpath(path), res));
00182     return res;
00183 }

int macos_open | ( | const char * | path,
 |  | int | oflag,
 |  | ... |
 | ) |

Definition at line 186 of file macos_filesys.c.

Referenced by lstat().

00187 {
00188     int r;
00189     char    *macPath;
00190
00191     macPath = macos_fixpath(path);
00192
00193     r = open( macPath, oflag );
00194     TRACE((stderr, "open %s -> %d", macPath, r));
00195     if( r < 0 )
00196     {
00197         r = open( macPath+1, oflag );
00198         TRACE((stderr, "open %s -> %d", macPath + 1, r));
00199     }
00200
00201     return r;
00202 }

DIR* macos_opendir ( const char * path )

Definition at line 264 of file macos_filesys.c.

Referenced by lstat().

00265 {
00266     DIR *res = opendir( macos_fixpath(path) );
00267     TRACE((stderr, "opendir %s -> %d", macos_fixpath(path), res != 0L));
00268     return res;
00269 }

int macos_rename | ( | const char * | path,
 |  | const char * | newpath
 | ) |

Definition at line 288 of file macos_filesys.c.

Referenced by lstat().

00289 {
00290     char    macPath_from[1024], macPath_to[1024];
00291     int res;
00292
00293     strcpy( macPath_from, macos_fixpath(path) );
00294     strcpy( macPath_to, macos_fixpath(newpath) );
00295
00296     res = rename( macPath_from, macPath_to );
00297     TRACE((stderr, "rename %s %s -> %d", macPath_from, macPath_to, res));
00298     return res;
00299 }

int macos_rmdir ( const char * path )

Definition at line 302 of file macos_filesys.c.

Referenced by lstat().

00303 {
00304     int res = rmdir( macos_fixpath(path) );
00305     TRACE((stderr, "rmdir %s -> %d", macos_fixpath(path), res));
00306     return res;
00307 }

int macos_stat | ( | const char * | path,
 |  | struct stat * | ststr
 | ) |

Definition at line 272 of file macos_filesys.c.

Referenced by lstat().

00273 {
00274     int res = stat( macos_fixpath(path), ststr );
00275     TRACE((stderr, "stat %s -> %d", macos_fixpath(path), res));
00276     return res;
00277 }

int macos_unlink ( const char * path )

Definition at line 310 of file macos_filesys.c.

Referenced by lstat().

00311 {
00312     int res;
00313     chmod(path, S_IRWXU);
00314     res = unlink( macos_fixpath(path) );
00315     TRACE((stderr, "unlink %s -> %d", macos_fixpath(path), res));
00316     return res;
00317 }

Variable Documentation

char scratchPath[1024]

Definition at line 148 of file macos_filesys.c.

Generated on Sun Oct 21 12:43:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


options.h File Reference

cvs-1.10/macintosh/options.h File Reference

Go to the source code of this file.

Defines

#define | PATCH_PROGRAM "patch"
#define | TMPDIR_DFLT "/tmp"
#define | EDITOR_DFLT "vi"
#define | UMASK_DFLT 002
#define | RELATIVE_REPOS 1
#define | SERVER_FLOWCONTROL
#define | SERVER_HI_WATER (2 * 1024 * 1024)
#define | SERVER_LO_WATER (1 * 1024 * 1024)

Functions

void | exit ()

Define Documentation

#define EDITOR_DFLT "vi"

Definition at line 53 of file options.h.

#define PATCH_PROGRAM "patch"

Definition at line 34 of file options.h.

#define RELATIVE_REPOS 1

Definition at line 96 of file options.h.

#define SERVER_FLOWCONTROL

Definition at line 188 of file options.h.

#define SERVER_HI_WATER (2 * 1024 * 1024)

Definition at line 189 of file options.h.

#define SERVER_LO_WATER (1 * 1024 * 1024)

Definition at line 190 of file options.h.

#define TMPDIR_DFLT "/tmp"

Definition at line 42 of file options.h.

#define UMASK_DFLT 002

Definition at line 66 of file options.h.

Function Documentation

void exit ( )

Generated on Sun Oct 21 12:42:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/options.h Source File

cvs-1.10/macintosh/options.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * This file holds (most of) the configuration tweaks that can be made to
00009  * customize CVS for your site.  CVS comes configured for a typical SunOS 4.x
00010  * environment.  The comments for each configurable item are intended to be
00011  * self-explanatory.  All #defines are tested first to see if an over-riding
00012  * option was specified on the "make" command line.
00013  *
00014  * If special libraries are needed, you will have to edit the Makefile.in file
00015  * or the configure script directly.  Sorry.
00016  */
00017
00018 /* By default, CVS stores its modules and other such items in flat
00019    text files (MY_NDBM enables this).  Turning off MY_NDBM causes CVS
00020    to look for a system-supplied ndbm database library and use it
00021    instead.  That may speed things up, but the default setting
00022    generally works fine too.  */
00023
00024 #ifndef MY_NDBM
00025 #define MY_NDBM
00026 #endif
00027
00028 /*
00029  * The "patch" program to run when using the CVS server and accepting
00030  * patches across the network.  Specify a full pathname if your site
00031  * wants to use a particular patch.
00032  */
00033 #ifndef PATCH_PROGRAM
00034 #define PATCH_PROGRAM   "patch"
00035 #endif
00036
00037 /* Directory used for storing temporary files, if not overridden by
00038    environment variables or the -T global option.  There should be little
00039    need to change this (-T is a better mechanism if you need to use a
00040    different directory for temporary files).  */
00041 #ifndef TMPDIR_DFLT
00042 #define TMPDIR_DFLT "/tmp"
00043 #endif
00044
00045 /*
00046  * The default editor to use, if one does not specify the "-e" option
00047  * to cvs, or does not have an EDITOR environment variable.  I set
00048  * this to just "vi", and use the shell to find where "vi" actually
00049  * is.  This allows sites with /usr/bin/vi or /usr/ucb/vi to work
00050  * equally well (assuming that your PATH is reasonable).
00051  */
00052 #ifndef EDITOR_DFLT
00053 #define EDITOR_DFLT "vi"
00054 #endif
00055
00056 /*
00057  * The default umask to use when creating or otherwise setting file or
00058  * directory permissions in the repository.  Must be a value in the
00059  * range of 0 through 0777.  For example, a value of 002 allows group
00060  * rwx access and world rx access; a value of 007 allows group rwx
00061  * access but no world access.  This value is overridden by the value
00062  * of the CVSUMASK environment variable, which is interpreted as an
00063  * octal number.
00064  */
00065 #ifndef UMASK_DFLT
00066 #define UMASK_DFLT  002
00067 #endif
00068
00069 /*
00070  * The cvs admin command is restricted to the members of the group
00071  * CVS_ADMIN_GROUP.  If this group does not exist, all users are
00072  * allowed to run cvs admin.  To disable the cvs admin for all users,
00073  * create an empty group CVS_ADMIN_GROUP.  To disable access control
00074  * for cvs admin, comment out the define below.
00075  */
00076 #ifndef CVS_ADMIN_GROUP
00077 /*#define CVS_ADMIN_GROUP "cvsadmin"*/
00078 #endif
00079
00080 /*
00081  * The Repository file holds the path to the directory within the
00082  * source repository that contains the RCS ,v files for each CVS
00083  * working directory.  This path is either a full-path or a path
00084  * relative to CVSROOT.
00085  *
00086  * The big advantage that I can see to having a relative path is that
00087  * one can change the physical location of the master source
00088  * repository, change the contents of CVS/Root files in your
00089  * checked-out code, and CVS will work without problems.
00090  *
00091  * Therefore, RELATIVE_REPOS is now the default.  In the future, this
00092  * is likely to disappear entirely as a compile-time (or other) option,
00093  * so if you have other software which relies on absolute pathnames,
00094  * update them.
00095  */
00096 #define RELATIVE_REPOS 1
00097
00098 /*
00099  * When committing or importing files, you must enter a log message.
00100  * Normally, you can do this either via the -m flag on the command
00101  * line or an editor will be started for you.  If you like to use
00102  * logging templates (the rcsinfo file within the $CVSROOT/CVSROOT
00103  * directory), you might want to force people to use the editor even
00104  * if they specify a message with -m.  Enabling FORCE_USE_EDITOR will
00105  * cause the -m message to be appended to the temp file when the
00106  * editor is started.
00107  */
00108 #ifndef FORCE_USE_EDITOR
00109 /* #define  FORCE_USE_EDITOR */
00110 #endif
00111
00112 /*
00113  * When locking the repository, some sites like to remove locks and
00114  * assume the program that created them went away if the lock has
00115  * existed for a long time.  This used to be the default for previous
00116  * versions of CVS.  CVS now attempts to be much more robust, so lock
00117  * files should not be left around by mistake. The new behaviour will
00118  * never remove old locks (they must now be removed by hand).
00119  * Enabling CVS_FUDGELOCKS will cause CVS to remove locks that are
00120  * older than CVSLCKAGE seconds.
00121  *
00122  * Use of this option is NOT recommended.
00123  */
00124 #ifndef CVS_FUDGELOCKS
00125 /* #define CVS_FUDGELOCKS */
00126 #endif
00127
00128 /*
00129  * When committing a permanent change, CVS and RCS make a log entry of
00130  * who committed the change.  If you are committing the change logged
00131  * in as "root" (not under "su" or other root-priv giving program),
00132  * CVS/RCS cannot determine who is actually making the change.
00133  *
00134  * As such, by default, CVS disallows changes to be committed by users
00135  * logged in as "root".  You can disable this option by commenting out
00136  * the lines below.
00137  */
00138 #ifndef CVS_BADROOT
00139 #define CVS_BADROOT
00140 #endif
00141
00142 /* Define this to enable the SETXID support.  The way to use this is
00143    to create a group with no users in it (except perhaps cvs
00144    administrators), set the cvs executable to setgid that group, chown
00145    all the repository files to that group, and change all directory
00146    permissions in the repository to 770.  The last person to modify a
00147    file will own it, but as long as directory permissions are set
00148    right that won't matter.  You'll need a system which inherits file
00149    groups from the parent directory (WARNING: using the wrong kind of
00150    system (I think Solaris 2.4 is the wrong kind, for example) will
00151    create a security hole!  You will receive no warning other than the
00152    fact that files in the working directory are owned by the group
00153    which cvs is setgid to).
00154
00155    One security hole which has been reported is that setgid is not
00156    turned off when the editor is invoked--most editors provide a way
00157    to execute a shell, or the user can specify an editor (this one is
00158    large enough to drive a truck through).  Don't assume that the
00159    holes described here are the only ones; I don't know how carefully
00160    SETXID has been inspected for security holes.  */
00161 #ifndef SETXID_SUPPORT
00162 /* #define SETXID_SUPPORT */
00163 #endif
00164
00165 /*
00166  * Should we build the password-authenticating client?  Whether to
00167  * include the password-authenticating _server_, on the other hand, is
00168  * set in config.h.
00169  */
00170 #ifdef CLIENT_SUPPORT
00171 #define AUTH_CLIENT_SUPPORT 1
00172 #endif
00173
00174 /*
00175  * If you are working with a large remote repository and a 'cvs
00176  * checkout' is swamping your network and memory, define these to
00177  * enable flow control.  You will end up with even less probability of
00178  * a consistent checkout (see Concurrency in cvs.texinfo), but CVS
00179  * doesn't try to guarantee that anyway.  The master server process
00180  * will monitor how far it is getting behind, if it reaches the high
00181  * water mark, it will signal the child process to stop generating
00182  * data when convenient (ie: no locks are held, currently at the
00183  * beginning of a new directory).  Once the buffer has drained
00184  * sufficiently to reach the low water mark, it will be signalled to
00185  * start again.  You may override the default hi/low watermarks here
00186  * too.
00187  */
00188 #define SERVER_FLOWCONTROL
00189 #define SERVER_HI_WATER (2 * 1024 * 1024)
00190 #define SERVER_LO_WATER (1 * 1024 * 1024)
00191
00192 /* End of CVS configuration section */
00193
00194 /*
00195  * Externs that are included in libc, but are used frequently enough
00196  * to warrant defining here.
00197  */
00198 #ifndef STDC_HEADERS
00199 extern void exit ();
00200 #endif
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pwd.c File Reference

cvs-1.10/macintosh/pwd.c File Reference

#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Include dependency graph for pwd.c:

Include dependency graph

Go to the source code of this file.

Functions

pid_t | getpid (void)
pid_t | waitpid (pid_t, int *, int)
passwd * | getpwuid (int uid)
passwd * | getpwnam (char *name)
int | getuid ()
int | geteuid ()
int | getegid ()

Variables

char * | home_dir = "."
passwd pw
group gr

Function Documentation

int getegid ( void )

Definition at line 53 of file pwd.c.

00053 { return 0; }

int geteuid ( void )

Definition at line 52 of file pwd.c.

00052 { return 0; }

pid_t getpid ( void )

Definition at line 32 of file pwd.c.

00032 { return 0; }                   /* getpid */

struct passwd* getpwnam ( char * name )

Definition at line 50 of file pwd.c.

00050 { return (struct passwd *) 0; }

struct passwd* getpwuid ( int uid )

Definition at line 38 of file pwd.c.

00039 {
00040   pw.pw_name = NULL; /* getlogin (); */
00041   pw.pw_dir = home_dir;
00042   pw.pw_shell = NULL;
00043   pw.pw_uid = 0;
00044
00045   return &pw;
00046 }

int getuid ( void )

Definition at line 51 of file pwd.c.

00051 { return 0; }

pid_t waitpid | ( | pid_t | ,
 |  | int * | ,
 |  | int |
 | ) |

Definition at line 33 of file pwd.c.

00033 { return 0; }   /* waitpid */

Variable Documentation

struct group gr [static]

Definition at line 30 of file pwd.c.

char* home_dir = "." [static]

Definition at line 28 of file pwd.c.

struct passwd pw [static]

Definition at line 29 of file pwd.c.

Generated on Sun Oct 21 12:43:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/pwd.c Source File

cvs-1.10/macintosh/pwd.c

Go to the documentation of this file.
00001 /*  pwd.c - Try to approximate UN*X's getuser...() functions under MS-DOS.
00002     Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
00003
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 1, or (at your option)
00007     any later version.
00008
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013
00014 */
00015
00016 /* This 'implementation' is conjectured from the use of this functions in
00017    the RCS and BASH distributions.  Of course these functions don't do too
00018    much useful things under MS-DOS, but using them avoids many "#ifdef
00019    MSDOS" in ported UN*X code ...  */
00020
00021 /* Stripped out stuff - MDLadwig <mike@twinpeaks.prc.com> --- Nov 1995 */
00022
00023 #include <pwd.h>
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 #include <string.h>
00027
00028 static char *home_dir = ".";    /* we feel (no|every)where at home */
00029 static struct passwd pw;    /* should we return a malloc()'d structure   */
00030 static struct group gr;     /* instead of pointers to static structures? */
00031
00032 pid_t getpid( void ) { return 0; }                  /* getpid */
00033 pid_t waitpid(pid_t, int *, int) { return 0; }  /* waitpid */
00034
00035 /* return something like a username in a (butchered!) passwd structure. */
00036
00037 struct passwd *
00038 getpwuid (int uid)
00039 {
00040   pw.pw_name = NULL; /* getlogin (); */
00041   pw.pw_dir = home_dir;
00042   pw.pw_shell = NULL;
00043   pw.pw_uid = 0;
00044
00045   return &pw;
00046 }
00047
00048 /* Misc uid stuff */
00049
00050 struct passwd * getpwnam (char *name) { return (struct passwd *) 0; }
00051 int getuid () { return 0; }
00052 int geteuid () { return 0; }
00053 int getegid () { return 0; }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pwd.h File Reference

cvs-1.10/macintosh/pwd.h File Reference

#include <sys/types.h>

Include dependency graph for pwd.h:

Include dependency graph

Go to the source code of this file.

Compounds

struct | group
struct | passwd

Generated on Sun Oct 21 12:43:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/pwd.h Source File

cvs-1.10/macintosh/pwd.h

Go to the documentation of this file.
00001 /*********************************************************************
00002 Project :   GUSI                -   Grand Unified Socket Interface
00003 File        :   pwd.h           -   Provide mission header ioctl.h for CodeWarrior
00004 Author  :   Matthias Neeracher
00005 Language    :   MPW C/C++
00006 $Log: pwd.h,v $
00007 Revision 1.1.1.1  1999/01/14 02:05:23  alexp
00008 First in
00009
00010 Revision 1.1  1996/07/26 20:08:29  kingdon
00011 Check in new macintosh directory from Mike Ladwig.  I believe that this
00012 checkin contains exactly the tarfile he sent to me, with the exception
00013 of the files SIOUX.c SIOUXGlobals.h SIOUXMenus.h SIOUXWindows.h which
00014 are copyright Metrowerks and which we therefore cannot distribute.
00015
00016 *********************************************************************/
00017
00018 #include <sys/types.h>
00019
00020 struct  group { /* see getgrent(3) */
00021         char    *gr_name;
00022         char    *gr_passwd;
00023         gid_t   gr_gid;
00024         char    **gr_mem;
00025 };
00026
00027 struct passwd {
00028         char    *pw_name;
00029         char    *pw_passwd;
00030         uid_t   pw_uid;
00031         gid_t   pw_gid;
00032         char    *pw_age;
00033         char    *pw_comment;
00034         char    *pw_gecos;
00035         char    *pw_dir;
00036         char    *pw_shell;
00037 };
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcmd.c File Reference

cvs-1.10/macintosh/rcmd.c File Reference

#include "cvs.h"
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <assert.h>

Include dependency graph for rcmd.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | closesocket close
#define | SOCK_ERRNO errno
#define | SOCK_STRERROR strerror
#define | WSAEADDRINUSE EADDRINUSE
#define | SOCKET_ERROR -1
#define | INVALID_SOCKET -1

Typedefs

typedef int | SOCKET

Functions

int | resolve_address (char **ahost, struct sockaddr_in *sai)
SOCKET | bind_and_connect (struct sockaddr_in *server_sai)
int | rcmd_authenticate (int fd, const char *locuser, const char *remuser, const char *command)
int | rcmd (char **ahost, int inport, const char *locuser, const char *remuser, const char *cmd, int *fd2p)

Define Documentation

#define INVALID_SOCKET -1

Definition at line 43 of file rcmd.c.

#define SOCKET_ERROR -1

Definition at line 42 of file rcmd.c.

#define SOCK_ERRNO errno

Definition at line 36 of file rcmd.c.

#define SOCK_STRERROR strerror

Definition at line 37 of file rcmd.c.

#define WSAEADDRINUSE EADDRINUSE

Definition at line 39 of file rcmd.c.

#define closesocket close

Definition at line 35 of file rcmd.c.

Referenced by bind_and_connect(), and wnt_shutdown_server().

Typedef Documentation

typedef int SOCKET

Definition at line 34 of file rcmd.c.

Function Documentation

SOCKET bind_and_connect ( struct sockaddr_in * server_sai ) [static]

Definition at line 90 of file rcmd.c.

00091 {
00092     SOCKET s;
00093     struct sockaddr_in client_sai;
00094     u_short client_port;
00095
00096     client_sai.sin_family = AF_INET;
00097     client_sai.sin_addr.s_addr = htonl (INADDR_ANY);
00098
00099     for (client_port = IPPORT_RESERVED - 1;
00100          client_port >= IPPORT_RESERVED/2;
00101          client_port--)
00102     {
00103     int result, errcode;
00104     client_sai.sin_port = htons (client_port);
00105
00106         if ((s = socket (PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
00107         error (1, 0, "cannot create socket: %s",
00108            SOCK_STRERROR (SOCK_ERRNO));
00109
00110     result = bind (s, (struct sockaddr *) &client_sai,
00111                    sizeof (client_sai));
00112     errcode = SOCK_ERRNO;
00113     if (result == SOCKET_ERROR)
00114     {
00115         closesocket (s);
00116         if (errcode == WSAEADDRINUSE)
00117         continue;
00118         else
00119         error (1, 0, "cannot bind to socket: %s",
00120                SOCK_STRERROR (errcode));
00121     }
00122
00123     result = connect (s, (struct sockaddr *) server_sai,
00124                       sizeof (*server_sai));
00125     errcode = SOCK_ERRNO;
00126     if (result == SOCKET_ERROR)
00127     {
00128         closesocket (s);
00129         if (errcode == WSAEADDRINUSE)
00130         continue;
00131         else
00132         error (1, 0, "cannot connect to socket: %s",
00133                SOCK_STRERROR (errcode));
00134     }
00135
00136     return s;
00137     }
00138
00139     error (1, 0, "cannot find free port");
00140     /* Shut up gcc -Wall.  */
00141     return s;
00142 }

int rcmd | ( | char ** | ahost,
 |  | int | inport,
 |  | const char * | locuser,
 |  | const char * | remuser,
 |  | const char * | cmd,
 |  | int * | fd2p
 | ) |

Definition at line 187 of file rcmd.c.

00193 {
00194     struct sockaddr_in sai;
00195     SOCKET s;
00196
00197     assert (fd2p == 0);
00198
00199     if (resolve_address (ahost, &sai) < 0)
00200         error (1, 0, "internal error: resolve_address < 0");
00201
00202     sai.sin_port = htons (inport);
00203
00204     if ((s = bind_and_connect (&sai)) == INVALID_SOCKET)
00205     error (1, 0, "internal error: bind_and_connect < 0");
00206
00207     if (rcmd_authenticate (s, locuser, remuser, cmd) < 0)
00208     error (1, 0, "internal error: rcmd_authenticate < 0");
00209
00210     return s;
00211 }

int rcmd_authenticate | ( | int | fd,
 |  | const char * | locuser,
 |  | const char * | remuser,
 |  | const char * | command
 | ) | [static]

Definition at line 145 of file rcmd.c.

00146 {
00147     /* Send them a bunch of information, each terminated by '\0':
00148        - secondary stream port number (we don't use this)
00149        - username on local machine
00150        - username on server machine
00151        - command
00152        Now, the Ultrix man page says you transmit the username on the
00153        server first, but that doesn't seem to work.  Transmitting the
00154        client username first does.  Go figure.  The Linux man pages
00155        get it right --- hee hee.  */
00156     if ((send (fd, "0\0", 2, 0) == SOCKET_ERROR)
00157     || (send (fd, locuser, strlen (locuser) + 1, 0) == SOCKET_ERROR)
00158     || (send (fd, remuser, strlen (remuser) + 1, 0) == SOCKET_ERROR)
00159     || (send (fd, command, strlen (command) + 1, 0) == SOCKET_ERROR))
00160     error (1, 0, "cannot send authentication info to rshd: %s",
00161            SOCK_STRERROR (SOCK_ERRNO));
00162
00163     /* They sniff our butt, and send us a '\0' character if they
00164        like us.  */
00165     {
00166         char c;
00167     if (recv (fd, &c, 1, 0) == SOCKET_ERROR)
00168     {
00169         error (1, 0, "cannot receive authentication info from rshd: %s",
00170            SOCK_STRERROR (SOCK_ERRNO));
00171     }
00172     if (c != '\0')
00173     {
00174         /* All the junk with USER, LOGNAME, GetUserName, &c, is so
00175            confusing that we better give some clue as to what sort
00176            of user name we decided on.  */
00177         error (0, 0, "cannot log in as local user '%s', remote user '%s'",
00178            locuser, remuser);
00179         error (1, 0, "Permission denied by rshd");
00180     }
00181     }
00182
00183     return 0;
00184 }

int resolve_address | ( | char ** | ahost,
 |  | struct sockaddr_in * | sai
 | ) | [static]

Definition at line 57 of file rcmd.c.

00058 {
00059     {
00060     unsigned long addr = inet_addr (*ahost);
00061
00062     if (addr != (unsigned long) -1)
00063     {
00064         sai->sin_family = AF_INET;
00065         sai->sin_addr.s_addr = addr;
00066         return 0;
00067     }
00068     }
00069
00070     {
00071         struct hostent *e = gethostbyname (*ahost);
00072
00073     if (e)
00074     {
00075         assert (e->h_addrtype == AF_INET);
00076         assert (e->h_addr);
00077         *ahost = e->h_name;
00078         sai->sin_family = AF_INET;
00079         memcpy (&sai->sin_addr, e->h_addr, sizeof (sai->sin_addr));
00080         return 0;
00081     }
00082     }
00083
00084     error (1, 0, "no such host %s", *ahost);
00085     /* Shut up gcc -Wall.  */
00086     return 1;
00087 }

Generated on Sun Oct 21 12:43:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/rcmd.c Source File

cvs-1.10/macintosh/rcmd.c

Go to the documentation of this file.
00001 /* rcmd.c --- execute a command on a remote host from Windows NT
00002
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; either version 2, or (at your option)
00006    any later version.
00007
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.
00012
00013    Jim Blandy <jimb@cyclic.com> --- August 1995  */
00014
00015 /* Modified : Alexandre Parenteau <aubonbeurre@hotmail.com --- February 2001 */
00016
00017 #include "cvs.h"
00018
00019 #ifdef WIN32
00020 #   include <io.h>
00021 #   include <malloc.h>
00022 #endif
00023
00024 #include <fcntl.h>
00025 #include <errno.h>
00026
00027 #ifdef HAVE_WINSOCK_H
00028   #include <winsock.h>
00029 #else
00030   #include <sys/types.h>
00031   #include <sys/socket.h>
00032   #include <netinet/in.h>
00033   #include <netdb.h>
00034   typedef int SOCKET;
00035   #define closesocket close
00036   #define SOCK_ERRNO errno
00037   #define SOCK_STRERROR strerror
00038   /* Probably would be cleaner to just use EADDRINUSE, as NT has that too.  */
00039   #define WSAEADDRINUSE EADDRINUSE
00040   /* Probably would be cleaner to just check for < 0.  Might want to
00041      double-check that doing so would seem to work on NT.  */
00042   #define SOCKET_ERROR -1
00043   #define INVALID_SOCKET -1
00044 #endif
00045
00046 #include <stdio.h>
00047 #include <assert.h>
00048
00049 /* The rest of this file contains the rcmd() code, which is used
00050    only by START_SERVER.  The idea for a long-term direction is
00051    that this code can be made portable (by using SOCK_ERRNO and
00052    so on), and then moved to client.c or someplace it can be
00053    shared with the VMS port and any other ports which may want it.  */
00054
00055
00056 static int
00057 resolve_address (char **ahost, struct sockaddr_in *sai)
00058 {
00059     {
00060     unsigned long addr = inet_addr (*ahost);
00061
00062     if (addr != (unsigned long) -1)
00063     {
00064         sai->sin_family = AF_INET;
00065         sai->sin_addr.s_addr = addr;
00066         return 0;
00067     }
00068     }
00069
00070     {
00071         struct hostent *e = gethostbyname (*ahost);
00072
00073     if (e)
00074     {
00075         assert (e->h_addrtype == AF_INET);
00076         assert (e->h_addr);
00077         *ahost = e->h_name;
00078         sai->sin_family = AF_INET;
00079         memcpy (&sai->sin_addr, e->h_addr, sizeof (sai->sin_addr));
00080         return 0;
00081     }
00082     }
00083
00084     error (1, 0, "no such host %s", *ahost);
00085     /* Shut up gcc -Wall.  */
00086     return 1;
00087 }
00088
00089 static SOCKET
00090 bind_and_connect (struct sockaddr_in *server_sai)
00091 {
00092     SOCKET s;
00093     struct sockaddr_in client_sai;
00094     u_short client_port;
00095
00096     client_sai.sin_family = AF_INET;
00097     client_sai.sin_addr.s_addr = htonl (INADDR_ANY);
00098
00099     for (client_port = IPPORT_RESERVED - 1;
00100          client_port >= IPPORT_RESERVED/2;
00101          client_port--)
00102     {
00103     int result, errcode;
00104     client_sai.sin_port = htons (client_port);
00105
00106         if ((s = socket (PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
00107         error (1, 0, "cannot create socket: %s",
00108            SOCK_STRERROR (SOCK_ERRNO));
00109
00110     result = bind (s, (struct sockaddr *) &client_sai,
00111                    sizeof (client_sai));
00112     errcode = SOCK_ERRNO;
00113     if (result == SOCKET_ERROR)
00114     {
00115         closesocket (s);
00116         if (errcode == WSAEADDRINUSE)
00117         continue;
00118         else
00119         error (1, 0, "cannot bind to socket: %s",
00120                SOCK_STRERROR (errcode));
00121     }
00122
00123     result = connect (s, (struct sockaddr *) server_sai,
00124                       sizeof (*server_sai));
00125     errcode = SOCK_ERRNO;
00126     if (result == SOCKET_ERROR)
00127     {
00128         closesocket (s);
00129         if (errcode == WSAEADDRINUSE)
00130         continue;
00131         else
00132         error (1, 0, "cannot connect to socket: %s",
00133                SOCK_STRERROR (errcode));
00134     }
00135
00136     return s;
00137     }
00138
00139     error (1, 0, "cannot find free port");
00140     /* Shut up gcc -Wall.  */
00141     return s;
00142 }
00143
00144 static int
00145 rcmd_authenticate (int fd, const char *locuser, const char *remuser, const char *command)
00146 {
00147     /* Send them a bunch of information, each terminated by '\0':
00148        - secondary stream port number (we don't use this)
00149        - username on local machine
00150        - username on server machine
00151        - command
00152        Now, the Ultrix man page says you transmit the username on the
00153        server first, but that doesn't seem to work.  Transmitting the
00154        client username first does.  Go figure.  The Linux man pages
00155        get it right --- hee hee.  */
00156     if ((send (fd, "0\0", 2, 0) == SOCKET_ERROR)
00157     || (send (fd, locuser, strlen (locuser) + 1, 0) == SOCKET_ERROR)
00158     || (send (fd, remuser, strlen (remuser) + 1, 0) == SOCKET_ERROR)
00159     || (send (fd, command, strlen (command) + 1, 0) == SOCKET_ERROR))
00160     error (1, 0, "cannot send authentication info to rshd: %s",
00161            SOCK_STRERROR (SOCK_ERRNO));
00162
00163     /* They sniff our butt, and send us a '\0' character if they
00164        like us.  */
00165     {
00166         char c;
00167     if (recv (fd, &c, 1, 0) == SOCKET_ERROR)
00168     {
00169         error (1, 0, "cannot receive authentication info from rshd: %s",
00170            SOCK_STRERROR (SOCK_ERRNO));
00171     }
00172     if (c != '\0')
00173     {
00174         /* All the junk with USER, LOGNAME, GetUserName, &c, is so
00175            confusing that we better give some clue as to what sort
00176            of user name we decided on.  */
00177         error (0, 0, "cannot log in as local user '%s', remote user '%s'",
00178            locuser, remuser);
00179         error (1, 0, "Permission denied by rshd");
00180     }
00181     }
00182
00183     return 0;
00184 }
00185
00186 int
00187 rcmd (char **ahost,
00188       int inport,
00189       const char *locuser,
00190       const char *remuser,
00191       const char *cmd,
00192       int *fd2p)
00193 {
00194     struct sockaddr_in sai;
00195     SOCKET s;
00196
00197     assert (fd2p == 0);
00198
00199     if (resolve_address (ahost, &sai) < 0)
00200         error (1, 0, "internal error: resolve_address < 0");
00201
00202     sai.sin_port = htons (inport);
00203
00204     if ((s = bind_and_connect (&sai)) == INVALID_SOCKET)
00205     error (1, 0, "internal error: bind_and_connect < 0");
00206
00207     if (rcmd_authenticate (s, locuser, remuser, cmd) < 0)
00208     error (1, 0, "internal error: rcmd_authenticate < 0");
00209
00210     return s;
00211 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/macintosh/server_if.c Source File

cvs-1.10/macintosh/server_if.c

Go to the documentation of this file.
00001 /*
00002  * server_if.c
00003  * Open connection to the CVS server under MacOS
00004  *
00005  * Michael Ladwig <mike@twinpeaks.prc.com> --- November 1995
00006  */
00007
00008 #include "cvs.h"
00009
00010 #include <sys/types.h>
00011 #include <sys/socket.h>
00012 #include <netdb.h>
00013
00014 static int read_fd, write_fd;
00015
00016 void
00017 macos_start_server (int *tofd, int *fromfd,
00018           char *client_user,
00019           char *server_user,
00020           char *server_host,
00021           char *server_cvsroot)
00022 {
00023     char *cvs_server;
00024     char *command;
00025     char *portenv;
00026     struct servent *sptr;
00027     unsigned short port;
00028
00029     if (! (cvs_server = getenv ("CVS_SERVER")))
00030         cvs_server = "cvs";
00031     command = xmalloc (strlen (cvs_server)
00032                + strlen (server_cvsroot)
00033                + 50);
00034     sprintf (command, "%s -d %s server", cvs_server, server_cvsroot);
00035
00036     portenv = getenv("CVS_RCMD_PORT");
00037     if (portenv)
00038     port = atoi(portenv);
00039     else if ((sptr = getservbyname("shell", "tcp")) != NULL)
00040     port = sptr->s_port;
00041     else
00042     /* This is the normal case.  Macs will generally lack a /etc/services
00043        file (causing getservbyname to fail), and getenv is only something
00044        that we provide via our own AppleEvents stuff, not a standard
00045        Mac feature.  */
00046     port = 514;
00047
00048     read_fd = rcmd (&server_host,
00049                     port,
00050                     client_user,
00051                 (server_user ? server_user : client_user),
00052                 command,
00053                 0);
00054     if (read_fd < 0)
00055     error (1, errno, "cannot start server via rcmd");
00056
00057     write_fd = read_fd;
00058     {
00059         struct linger ling = {1, 2};
00060         setsockopt(read_fd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));
00061     }
00062
00063     *tofd = write_fd;
00064     *fromfd = read_fd;
00065     free (command);
00066 }
00067
00068
00069 void
00070 macos_shutdown_server (int to_server)
00071 {
00072     if( read_fd != 0 && close (read_fd) != 0 )
00073         error(0, errno, "close on read_fd");
00074     if( write_fd != 0 && close (write_fd) != 0 )
00075         error(0, errno, "close on write_fd");
00076 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


server_if.c File Reference

cvs-1.10/macintosh/server_if.c File Reference

#include "cvs.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

Include dependency graph for server_if.c:

Include dependency graph

Go to the source code of this file.

Functions

void | macos_start_server (int *tofd, int *fromfd, char *client_user, char *server_user, char *server_host, char *server_cvsroot)
void | macos_shutdown_server (int to_server)

Variables

int | read_fd
int | write_fd

Function Documentation

void macos_shutdown_server ( int to_server )

Definition at line 70 of file server_if.c.

Referenced by SYSTEM_INITIALIZE().

00071 {
00072     if( read_fd != 0 && close (read_fd) != 0 )
00073         error(0, errno, "close on read_fd");
00074     if( write_fd != 0 && close (write_fd) != 0 )
00075         error(0, errno, "close on write_fd");
00076 }

void macos_start_server | ( | int * | tofd,
 |  | int * | fromfd,
 |  | char * | client_user,
 |  | char * | server_user,
 |  | char * | server_host,
 |  | char * | server_cvsroot
 | ) |

Definition at line 17 of file server_if.c.

Referenced by SYSTEM_INITIALIZE().

00022 {
00023     char *cvs_server;
00024     char *command;
00025     char *portenv;
00026     struct servent *sptr;
00027     unsigned short port;
00028
00029     if (! (cvs_server = getenv ("CVS_SERVER")))
00030         cvs_server = "cvs";
00031     command = xmalloc (strlen (cvs_server)
00032                + strlen (server_cvsroot)
00033                + 50);
00034     sprintf (command, "%s -d %s server", cvs_server, server_cvsroot);
00035
00036     portenv = getenv("CVS_RCMD_PORT");
00037     if (portenv)
00038     port = atoi(portenv);
00039     else if ((sptr = getservbyname("shell", "tcp")) != NULL)
00040     port = sptr->s_port;
00041     else
00042     /* This is the normal case.  Macs will generally lack a /etc/services
00043        file (causing getservbyname to fail), and getenv is only something
00044        that we provide via our own AppleEvents stuff, not a standard
00045        Mac feature.  */
00046     port = 514;
00047
00048     read_fd = rcmd (&server_host,
00049                     port,
00050                     client_user,
00051                 (server_user ? server_user : client_user),
00052                 command,
00053                 0);
00054     if (read_fd < 0)
00055     error (1, errno, "cannot start server via rcmd");
00056
00057     write_fd = read_fd;
00058     {
00059         struct linger ling = {1, 2};
00060         setsockopt(read_fd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));
00061     }
00062
00063     *tofd = write_fd;
00064     *fromfd = read_fd;
00065     free (command);
00066 }

Variable Documentation

int read_fd [static]

Definition at line 14 of file server_if.c.

int write_fd [static]

Definition at line 14 of file server_if.c.

Generated on Sun Oct 21 12:43:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


config.h File Reference

cvs-1.10/os2/config.h File Reference

#include <stdio.h>
#include <errno.h>
#include <process.h>
#include "os2inc.h"

Include dependency graph for config.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | __STDC__ 1
#define | EACCES EACCESS
#define | gid_t int
#define | HAVE_LONG_FILE_NAMES 1
#define | HAVE_UTIME_NULL 1
#define | mode_t int
#define | pid_t int
#define | RETSIGTYPE void
#define | STAT_MACROS_BROKEN 1
#define | STDC_HEADERS 1
#define | uid_t int
#define | CLIENT_SUPPORT
#define | HAVE_CONNECT
#define | HAVE_FTIME 1
#define | HAVE_PUTENV 1
#define | HAVE_TZSET 1
#define | HAVE_VPRINTF 1
#define | HAVE_DIRECT_H 1
#define | HAVE_DIRENT_H 1
#define | HAVE_ERRNO_H 1
#define | HAVE_FCNTL_H 1
#define | HAVE_IO_H 1
#define | HAVE_MEMORY_H 1
#define | HAVE_STRING_H 1
#define | HAVE_SYS_TIMEB_H 1
#define | HAVE_SYS_UTIME_H 1
#define | CVS_MKDIR os2_mkdir
#define | CVS_CHDIR os2_chdir
#define | USE_PROTOTYPES 1
#define | FOLD_FN_CHAR(c) (OS2_filename_classes[(unsigned char) (c)])
#define | ISDIRSEP(c) (FOLD_FN_CHAR(c) == '/')
#define | DEVNULL "nul"
#define | CLIENT_ONLY
#define | RSH_NEEDS_BINARY_FLAG 1
#define | NEED_DECOY_PERMISSIONS 1
#define | R_OK 04
#define | W_OK 02
#define | F_OK 00
#define | X_OK R_OK
#define | USE_OWN_TCPIP_H 1
#define | SYSTEM_INITIALIZE(pargc, pargv) init_sockets()
#define | USE_OWN_POPEN 1
#define | START_RSH_WITH_POPEN_RW 1
#define | NO_SOCKET_TO_FD 1
#define | CHMOD_BROKEN 1
#define | sleep(x) DosSleep(((long)(x))*1000L)
#define | KFF_DEBUG(call)

Functions

int | os2_mkdir (const char *PATH, int MODE)
int | os2_chdir (const char *Dir)
int | readlink (char *path, char *buf, int buf_size)
int | getpid (void)
int | fncmp (const char *n1, const char *n2)
void | fnfold (char *FILENAME)
void | init_sockets ()

Variables

unsigned char | OS2_filename_classes []

Define Documentation

#define CHMOD_BROKEN 1

Definition at line 390 of file config.h.

#define CLIENT_ONLY

Definition at line 331 of file config.h.

#define CLIENT_SUPPORT

Definition at line 140 of file config.h.

#define CVS_CHDIR os2_chdir

Definition at line 291 of file config.h.

#define CVS_MKDIR os2_mkdir

Definition at line 287 of file config.h.

#define DEVNULL "nul"

Definition at line 325 of file config.h.

#define EACCES EACCESS

Definition at line 38 of file config.h.

#define FOLD_FN_CHAR ( c ) (OS2_filename_classes[(unsigned char) (c)])

Definition at line 307 of file config.h.

#define F_OK 00

Definition at line 359 of file config.h.

#define HAVE_CONNECT

Definition at line 152 of file config.h.

#define HAVE_DIRECT_H 1

Definition at line 210 of file config.h.

#define HAVE_DIRENT_H 1

Definition at line 217 of file config.h.

#define HAVE_ERRNO_H 1

Definition at line 221 of file config.h.

#define HAVE_FCNTL_H 1

Definition at line 224 of file config.h.

#define HAVE_FTIME 1

Definition at line 164 of file config.h.

#define HAVE_IO_H 1

Definition at line 228 of file config.h.

#define HAVE_LONG_FILE_NAMES 1

Definition at line 74 of file config.h.

#define HAVE_MEMORY_H 1

Definition at line 231 of file config.h.

#define HAVE_PUTENV 1

Definition at line 176 of file config.h.

#define HAVE_STRING_H 1

Definition at line 240 of file config.h.

#define HAVE_SYS_TIMEB_H 1

Definition at line 261 of file config.h.

#define HAVE_SYS_UTIME_H 1

Definition at line 270 of file config.h.

#define HAVE_TZSET 1

Definition at line 201 of file config.h.

#define HAVE_UTIME_NULL 1

Definition at line 86 of file config.h.

#define HAVE_VPRINTF 1

Definition at line 207 of file config.h.

#define ISDIRSEP ( c ) (FOLD_FN_CHAR(c) == '/')

Definition at line 312 of file config.h.

#define KFF_DEBUG ( call )

Definition at line 405 of file config.h.

#define NEED_DECOY_PERMISSIONS 1

Definition at line 349 of file config.h.

#define NO_SOCKET_TO_FD 1

Definition at line 383 of file config.h.

#define RETSIGTYPE void

Definition at line 110 of file config.h.

#define RSH_NEEDS_BINARY_FLAG 1

Definition at line 336 of file config.h.

#define R_OK 04

Definition at line 357 of file config.h.

#define START_RSH_WITH_POPEN_RW 1

Definition at line 375 of file config.h.

#define STAT_MACROS_BROKEN 1

Definition at line 120 of file config.h.

#define STDC_HEADERS 1

Definition at line 124 of file config.h.

#define SYSTEM_INITIALIZE | ( | pargc,
 |  | pargv | ) | init_sockets()

Definition at line 369 of file config.h.

#define USE_OWN_POPEN 1

Definition at line 373 of file config.h.

#define USE_OWN_TCPIP_H 1

Definition at line 367 of file config.h.

#define USE_PROTOTYPES 1

Definition at line 303 of file config.h.

#define W_OK 02

Definition at line 358 of file config.h.

#define X_OK R_OK

Definition at line 360 of file config.h.

#define __STDC__ 1

Definition at line 31 of file config.h.

#define gid_t int

Definition at line 70 of file config.h.

#define mode_t int

Definition at line 93 of file config.h.

#define pid_t int

Definition at line 96 of file config.h.

#define sleep ( x ) DosSleep(((long)(x))*1000L)

Definition at line 397 of file config.h.

#define uid_t int

Definition at line 132 of file config.h.

Function Documentation

int fncmp | ( | const char * | n1,
 |  | const char * | n2
 | ) |

Definition at line 667 of file filesubr.c.

00668 {
00669     while (*n1 && *n2
00670            && (OS2_filename_classes[(unsigned char) *n1]
00671            == OS2_filename_classes[(unsigned char) *n2]))
00672         n1++, n2++;
00673     return (OS2_filename_classes[(unsigned char) *n1]
00674             - OS2_filename_classes[(unsigned char) *n2]);
00675 }

void fnfold ( char * filename )

Definition at line 681 of file filesubr.c.

00682 {
00683     while (*filename)
00684     {
00685         *filename = FOLD_FN_CHAR (*filename);
00686     filename++;
00687     }
00688 }

int getpid ( void )

Definition at line 166 of file win32.c.

00167 {
00168     return (pid_t) GetCurrentProcessId();
00169 }

void init_sockets ( )

Definition at line 28 of file rcmd.c.

00029 {
00030     int rc;
00031
00032     rc = sock_init ();
00033     if (rc != 0)
00034     {
00035       fprintf (stderr, "sock_init() failed -- returned %d!\n", rc);
00036       exit (1);
00037     }
00038 }

int os2_chdir ( const char * Dir )

int os2_mkdir | ( | const char * | path,
 |  | int | mode
 | ) |

Definition at line 9 of file mkdir.c.

00010 {
00011   /* This is true for all extant calls to CVS_MKDIR.  If
00012      someone adds a call that uses something else later,
00013      we should tweak this function to handle that.  */
00014   assert (mode == 0777);
00015
00016   return mkdir (path);
00017 }

int readlink | ( | char * | path,
 |  | char * | buf,
 |  | int | buf_size
 | ) |

Definition at line 1 of file readlink.c.

00002 {
00003   /* OpenVMS dosen't have symbolic links in the UNIX sense */
00004   return -1;
00005 }

Variable Documentation

unsigned char OS2_filename_classes[]

Definition at line 308 of file config.h.

Generated on Sun Oct 21 12:42:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/config.h Source File

cvs-1.10/os2/config.h

Go to the documentation of this file.
00001 /* config.h --- configuration file for OS/2
00002    Karl Fogel <kfogel@cyclic.com> --- Oct 1995  */
00003
00004 /* This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 /* This file lives in the os2/ subdirectory, which is only included
00015  * in your header search path if you're working under IBM C++,
00016  * and use os2/makefile (with GNU make for OS/2).  Thus, this is the
00017  * right place to put configuration information for OS/2.
00018  */
00019
00020
00021 /* We need some system header files here since we evaluate values from
00022  * these files below.
00023  */
00024 #include <stdio.h>
00025 #include <errno.h>
00026
00027
00028
00029 #ifndef __STDC__
00030 /* You bet! */
00031 #define __STDC__ 1
00032 #endif
00033
00034 /* The IBM compiler uses the (non-standard) error code EACCESS instead of
00035    EACCES (note: one 'S'). Define EACCESS to be EACCES and use the standard
00036    name in the code. */
00037 #ifndef EACCES
00038 #define EACCES EACCESS
00039 #endif
00040
00041 /* Handle some other name differences between the IBM and the Watcom
00042  * compiler.
00043  */
00044 #ifdef __WATCOMC__
00045 #define _setmode        setmode
00046 #define _cwait          cwait
00047 #endif
00048
00049 /* Some more WATCOM stuff: The watcom compiler defines va_list as an array,
00050  * not as a pointer, which will make the vasprintf code break without the
00051  * following define:
00052  */
00053 #ifdef  __WATCOMC__
00054 #define VA_LIST_IS_ARRAY
00055 #endif
00056
00057 /* Define if on AIX 3.
00058    System headers sometimes define this.
00059    We just want to avoid a redefinition error message.  */
00060 #undef _ALL_SOURCE
00061
00062 /* Define to empty if the keyword does not work.  */
00063 /* Const is working.  */
00064 #undef const
00065
00066 /* Define to `int' if <sys/types.h> doesn't define.  */
00067 /* OS/2 doesn't have gid_t.  It doesn't even really have group
00068    numbers, I think.  This will take more thought to get right, but
00069    let's get it running first.  */
00070 #define gid_t int
00071
00072 /* Define if you support file names longer than 14 characters.  */
00073 /* We support long file names, but not long corporate acronyms. */
00074 #define HAVE_LONG_FILE_NAMES 1
00075
00076 /* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
00077 /* If POSIX.1 requires this, why doesn't WNT have it?  */
00078 /* Maybe POSIX only says that if it is present, it must behave a
00079    certain way, but that it can simply be not present too.  I
00080    dunno. */
00081 /* Anyway, OS/2 ain't got it. */
00082 #undef HAVE_SYS_WAIT_H
00083
00084 /* Define if utime(file, NULL) sets file's timestamp to the present.  */
00085 /* Documentation says yup; haven't verified experimentally. */
00086 #define HAVE_UTIME_NULL 1
00087
00088 /* Define if on MINIX.  */
00089 /* Hah.  */
00090 #undef _MINIX
00091
00092 /* Define to `int' if <sys/types.h> doesn't define.  */
00093 #define mode_t int
00094
00095 /* Define to `int' if <sys/types.h> doesn't define.  */
00096 #define pid_t int
00097
00098 /* Define if the system does not provide POSIX.1 features except
00099    with this defined.  */
00100 /* This string doesn't appear anywhere in the system header files,
00101    so I assume it's irrelevant.  */
00102 #undef _POSIX_1_SOURCE
00103
00104 /* Define if you need to in order for stat and other things to work.  */
00105 /* Same as for _POSIX_1_SOURCE, above.  */
00106 #undef _POSIX_SOURCE
00107
00108 /* Define as the return type of signal handlers (int or void).  */
00109 /* IBMCPP manual indicates they are void.  */
00110 #define RETSIGTYPE void
00111
00112 /* Define to `unsigned' if <sys/types.h> doesn't define.  */
00113 /* sys/types.h doesn't define it, but stdio.h does, which cvs.h
00114    #includes, so things should be okay.  */
00115 /* #undef size_t */
00116
00117 /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
00118 /* sys/stat.h apparently doesn't even have them; setting this will let
00119    ../lib/system.h define them. */
00120 #define STAT_MACROS_BROKEN 1
00121
00122 /* Define if you have the ANSI C header files.  */
00123 /* We have at least a reasonable facsimile thereof. */
00124 #define STDC_HEADERS 1
00125
00126 /* Define if you can safely include both <sys/time.h> and <time.h>.  */
00127 /* We don't have <sys/time.h> at all.  Why isn't there a definition
00128    for HAVE_SYS_TIME_H anywhere in config.h.in?  */
00129 #undef TIME_WITH_SYS_TIME
00130
00131 /* Define to `int' if <sys/types.h> doesn't define.  */
00132 #define uid_t int
00133
00134 /* Define if you have MIT Kerberos version 4 available.  */
00135 /* We don't. */
00136 #undef HAVE_KERBEROS
00137
00138 /* Define if you want CVS to be able to be a remote repository client.  */
00139 /* That's all we want.  */
00140 #define CLIENT_SUPPORT
00141
00142 /* Define if you want CVS to be able to serve repositories to remote
00143    clients.  */
00144 /* No server support yet.  Note that you don't have to define
00145    CLIENT_SUPPORT or SERVER_SUPPORT to enable the non-remote code;
00146    that's always there.  */
00147 #undef SERVER_SUPPORT
00148
00149 /* Define if you have the connect function.  */
00150 /* Not used?  */
00151 /* It appears to be used in client.c now... don't know yet it OS/2 has it. */
00152 #define HAVE_CONNECT
00153
00154 /* Define if you have the fchdir function.  */
00155 #undef HAVE_FCHDIR
00156
00157 /* Define if you have the fchmod function.  */
00158 #undef HAVE_FCHMOD
00159
00160 /* Define if you have the fsync function.  */
00161 #undef HAVE_FSYNC
00162
00163 /* Define if you have the ftime function.  */
00164 #define HAVE_FTIME 1
00165
00166 /* Define if you have the ftruncate function.  */
00167 #undef HAVE_FTRUNCATE
00168
00169 /* Define if you have the getpagesize function.  */
00170 #undef HAVE_GETPAGESIZE
00171
00172 /* Define if you have the krb_get_err_text function.  */
00173 #undef HAVE_KRB_GET_ERR_TEXT
00174
00175 /* Define if you have the putenv function.  */
00176 #define HAVE_PUTENV 1
00177
00178 /* Define if you have the sigaction function.  */
00179 #undef HAVE_SIGACTION
00180
00181 /* Define if you have the sigblock function.  */
00182 #undef HAVE_SIGBLOCK
00183
00184 /* Define if you have the sigprocmask function.  */
00185 #undef HAVE_SIGPROCMASK
00186
00187 /* Define if you have the sigsetmask function.  */
00188 #undef HAVE_SIGSETMASK
00189
00190 /* Define if you have the sigvec function.  */
00191 #undef HAVE_SIGVEC
00192
00193 /* Define if you have the timezone function.  */
00194 /* Hmm, I actually rather think it's an extern long
00195    variable; that message was mechanically generated
00196    by autoconf.  And I don't see any actual uses of
00197    this function in the code anyway, hmm.  */
00198 #undef HAVE_TIMEZONE
00199
00200 /* Define if you have the tzset function.  */
00201 #define HAVE_TZSET 1
00202
00203 /* Define if you have the vfork function.  */
00204 #undef HAVE_VFORK
00205
00206 /* Define if you have the vprintf function.  */
00207 #define HAVE_VPRINTF 1
00208
00209 /* Define if you have the <direct.h> header file.  */
00210 #define HAVE_DIRECT_H 1
00211
00212 /* Define if you have the <dirent.h> header file.  */
00213 /* We have our own dirent.h and dirent.c. */
00214 #ifdef __WATCOMC__
00215 #undef HAVE_DIRENT_H
00216 #else
00217 #define HAVE_DIRENT_H 1
00218 #endif
00219
00220 /* Define if you have the <errno.h> header file.  */
00221 #define HAVE_ERRNO_H 1
00222
00223 /* Define if you have the <fcntl.h> header file.  */
00224 #define HAVE_FCNTL_H 1
00225
00226 /* Define if you have the <io.h> header file.  */
00227 /* Low-level Unix I/O routines like open, creat, etc.  */
00228 #define HAVE_IO_H 1
00229
00230 /* Define if you have the <memory.h> header file.  */
00231 #define HAVE_MEMORY_H 1
00232
00233 /* Define if you have the <ndbm.h> header file.  */
00234 #undef HAVE_NDBM_H
00235
00236 /* Define if you have the <ndir.h> header file.  */
00237 #undef HAVE_NDIR_H
00238
00239 /* Define if you have the <string.h> header file.  */
00240 #define HAVE_STRING_H 1
00241
00242 /* Define if you have the <sys/bsdtypes.h> header file.  */
00243 #undef HAVE_SYS_BSDTYPES_H
00244
00245 /* Define if you have the <sys/dir.h> header file.  */
00246 #undef HAVE_SYS_DIR_H
00247
00248 /* Define if you have the <sys/ndir.h> header file.  */
00249 #undef HAVE_SYS_NDIR_H
00250
00251 /* Define if you have the <sys/param.h> header file.  */
00252 #undef HAVE_SYS_PARAM_H
00253
00254 /* Define if you have the <sys/select.h> header file.  */
00255 #undef HAVE_SYS_SELECT_H
00256
00257 /* Define if you have the <sys/time.h> header file.  */
00258 #undef HAVE_SYS_TIME_H
00259
00260 /* Define if you have the <sys/timeb.h> header file.  */
00261 #define HAVE_SYS_TIMEB_H 1
00262
00263 /* Define if you have the <unistd.h> header file.  */
00264 #undef HAVE_UNISTD_H
00265
00266 /* Define if you have the <utime.h> header file.  */
00267 #undef HAVE_UTIME_H
00268
00269 /* Define if you have the <sys/utime.h> header file.  */
00270 #define HAVE_SYS_UTIME_H 1
00271
00272 /* Define if you have the inet library (-linet).  */
00273 #undef HAVE_LIBINET
00274
00275 /* Define if you have the nsl library (-lnsl).  */
00276 /* This is not used anywhere in the source code.  */
00277 #undef HAVE_LIBNSL
00278
00279 /* Define if you have the nsl_s library (-lnsl_s).  */
00280 #undef HAVE_LIBNSL_S
00281
00282 /* Define if you have the socket library (-lsocket).  */
00283 /* This isn't ever used either.  */
00284 #undef HAVE_LIBSOCKET
00285
00286 /* Under OS/2, mkdir only takes one argument.  */
00287 #define CVS_MKDIR os2_mkdir
00288 extern int os2_mkdir (const char *PATH, int MODE);
00289
00290 /* OS/2 needs a special chdir functions that handles drives */
00291 #define CVS_CHDIR os2_chdir
00292 extern int os2_chdir (const char *Dir);
00293
00294 /* This function doesn't exist under OS/2; we provide a stub. */
00295 extern int readlink (char *path, char *buf, int buf_size);
00296
00297 /* This is just a call to GetCurrentProcessID.  */
00298 #ifndef __WATCOMC__
00299 extern pid_t getpid (void);
00300 #endif
00301
00302 /* We definitely have prototypes.  */
00303 #define USE_PROTOTYPES 1
00304
00305 /* Under OS/2, filenames are case-insensitive, and both / and \
00306    are path component separators.  */
00307 #define FOLD_FN_CHAR(c) (OS2_filename_classes[(unsigned char) (c)])
00308 extern unsigned char OS2_filename_classes[];
00309
00310 /* Is the character C a path name separator?  Under OS/2, you can use
00311    either / or \.  */
00312 #define ISDIRSEP(c) (FOLD_FN_CHAR(c) == '/')
00313
00314 /* Like strcmp, but with the appropriate tweaks for file names.
00315    Under OS/2, filenames are case-insensitive but case-preserving,
00316    and both \ and / are path element separators.  */
00317 extern int fncmp (const char *n1, const char *n2);
00318
00319 /* Fold characters in FILENAME to their canonical forms.
00320    If FOLD_FN_CHAR is not #defined, the system provides a default
00321    definition for this.  */
00322 extern void fnfold (char *FILENAME);
00323
00324 /* This is where old bits go to die under OS/2 as well as WinNT.  */
00325 #define DEVNULL "nul"
00326
00327 /* Make sure that we don't try to perform operations on RCS files on the
00328    local machine.  I think I neglected to apply some changes from
00329    MHI's port in that area of code, or found some issues I didn't want
00330    to deal with.  */
00331 #define CLIENT_ONLY
00332
00333 /* We actually do have a transparent rsh, whew. */
00334 #undef RSH_NOT_TRANSPARENT
00335 /* But it won't be transparent unless we ask it nicely! */
00336 #define RSH_NEEDS_BINARY_FLAG 1
00337
00338 /* OS/2 doesn't really have user/group permissions, at least not
00339    according to the C library manual pages.  So we'll make decoys.
00340    (This was partly introduced for an obsolete reason, now taken care
00341    of by CHMOD_BROKEN, but I haven't carefully looked at every case
00342    (in particular mode_to_string), so it might still be needed).
00343    We do not need that for the watcom compiler since watcom already
00344    all those permission bits defined. It would probably be better to
00345    include the necessary system header files in system.h, and then make
00346    each permission define only if it is not already defined.
00347 */
00348 #ifndef __WATCOMC__
00349 #define NEED_DECOY_PERMISSIONS 1     /* see system.h */
00350 #endif
00351
00352
00353
00354 /* For the access() function, for which IBM OS/2 compiler has no pre-defined
00355    mnemonic masks. */
00356 #ifndef __WATCOMC__
00357 #define R_OK 04
00358 #define W_OK 02
00359 #define F_OK 00
00360 #define X_OK R_OK  /* I think this is right for OS/2. */
00361 #endif
00362
00363 /* For getpid() */
00364 #include <process.h>
00365
00366 /* So "tcpip.h" gets included in lib/system.h: */
00367 #define USE_OWN_TCPIP_H 1
00368 /* The IBM TCP/IP library gets initialized in main(): */
00369 #define SYSTEM_INITIALIZE(pargc,pargv) init_sockets()
00370 extern void init_sockets();
00371
00372 /* Under OS/2, we have our own popen() and pclose()... */
00373 #define USE_OWN_POPEN 1
00374 /* ... and we use popenRW to start the rsh server. */
00375 #define START_RSH_WITH_POPEN_RW 1
00376
00377 /*
00378  * This tells the client that it must use send()/recv() to talk to the
00379  * server if it is connected to the server via a socket.  Sigh.
00380  * Windows 95 and VMS cannot convert sockets to file descriptors either,
00381  * apparently.
00382  */
00383 #define NO_SOCKET_TO_FD 1
00384
00385 /* chmod() doesn't seem to work -- IBM's own example program does not
00386  * behave as its documentation claims, in fact!  I suspect that
00387  * DosSetPathInfo is the way to go, but can't seem to make that work
00388  * either.  For now, we can deal with some cases by invoking the DOS
00389  * "attrib" command via system().  */
00390 #define CHMOD_BROKEN 1
00391
00392 /* Rule Number 1 of OS/2 Programming: If the function you're looking
00393    for doesn't exist, try putting "Dos" in front of it.
00394    Do not forget to include the os2 header file if we use DosSleep. */
00395 #ifndef sleep
00396 #include "os2inc.h"
00397 #define sleep(x) DosSleep(((long)(x))*1000L)
00398 #endif /* sleep */
00399
00400 /* Set to 1 for some debugging messages. */
00401 #if 0
00402 #define KFF_DEBUG(call) printf("*** %s:%d: ", __FILE__, __LINE__); \
00403                         call; fflush(stdout);
00404 #else
00405 #define KFF_DEBUG(call)
00406 #endif
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/dirent.c Source File

cvs-1.10/os2/dirent.c

Go to the documentation of this file.
00001 /*
00002  *              Author:     Bob Withers
00003  *              Copyright (c) 1993, All Rights Reserved
00004  *
00005  *                              NOTICE
00006  *
00007  * Permission to use, copy, modify, and distribute this software and
00008  * its documentation for any purpose and without fee is hereby granted
00009  * provided that the above copyright notice appears in all copies and
00010  * that both the copyright notice and this permission notice appear in
00011  * supporting documentation.
00012  *
00013  * The author makes no representations about the suitability of this
00014  * software for any purpose.  This software is provided ``as is''
00015  * without express or implied warranty.
00016  */
00017
00018 #include <stdlib.h>
00019 #include <string.h>
00020
00021 #define INCL_DOSFILEMGR
00022 #define INCL_DOSERRORS
00023 #include <os2.h>
00024
00025 #include "dirent.h"
00026
00027
00028 #define DIRENT_INCR             25
00029
00030
00031 DIR *opendir(char *filename)
00032 {
00033     auto     size_t             len;
00034     auto     DIR               *dirp;
00035     auto     char              *p;
00036     auto     HDIR               hdir;
00037
00038 #ifdef OS2_16
00039     auto     USHORT             rc;         /* for 16 bit OS/2          */
00040     auto     FILEFINDBUF        ff;
00041     auto     USHORT             cnt;
00042 #else
00043     auto     APIRET             rc;         /* for 32 bit OS/2          */
00044     auto     FILEFINDBUF3       ff;
00045     auto     ULONG              cnt;
00046 #endif  /* OS2_16 */
00047
00048     if (NULL == filename || '\0' == filename[0])
00049         filename = ".";
00050
00051     dirp = malloc(sizeof(*dirp));
00052     if (NULL == dirp)
00053         return(NULL);
00054
00055     len = strlen(filename);
00056     dirp->dirname = malloc(len + 5);
00057     if (NULL == dirp->dirname)
00058     {
00059         free(dirp);
00060         return(NULL);
00061     }
00062
00063     dirp->max_ent = 0;
00064     dirp->tot_ent = 0;
00065     dirp->cur_ent = 0;
00066     dirp->entp    = NULL;
00067     strcpy(dirp->dirname, filename);
00068     for (p = dirp->dirname; *p; ++p)
00069     {
00070         if ('/' == *p)
00071             *p = '\\';
00072     }
00073
00074     if ('\\' != dirp->dirname[len - 1])
00075         strcat(dirp->dirname, "\\");
00076
00077     strcat(dirp->dirname, "*.*");
00078
00079     hdir = HDIR_SYSTEM;
00080     cnt  = 1;
00081     rc = DosFindFirst(dirp->dirname, &hdir,
00082                       FILE_NORMAL | FILE_READONLY | FILE_HIDDEN |
00083                       FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED,
00084                       &ff, sizeof(ff), &cnt, FIL_STANDARD);
00085
00086     while (NO_ERROR == rc)
00087     {
00088         auto     struct dirent     *entp;
00089
00090         if (dirp->tot_ent >= dirp->max_ent)
00091         {
00092             auto     struct dirent    **p;
00093
00094             dirp->max_ent += DIRENT_INCR;
00095             p = realloc(dirp->entp, dirp->max_ent * sizeof(entp));
00096             if (NULL == p)
00097             {
00098                 rc = ERROR_NOT_ENOUGH_MEMORY;
00099                 break;
00100             }
00101
00102             dirp->entp = p;
00103         }
00104
00105         entp = malloc(sizeof(*entp) + (size_t) ff.cchName);
00106         if (NULL == entp)
00107         {
00108             rc = ERROR_NOT_ENOUGH_MEMORY;
00109             break;
00110         }
00111
00112         entp->d_ino = 0;
00113         entp->d_off = dirp->tot_ent;
00114         entp->d_namlen = (unsigned short) ff.cchName;
00115         memcpy(entp->d_name, ff.achName, entp->d_namlen);
00116         entp->d_name[entp->d_namlen] = '\0';
00117         dirp->entp[dirp->tot_ent++] = entp;
00118
00119         cnt = 1;
00120         rc = DosFindNext(hdir, &ff, sizeof(ff), &cnt);
00121     }
00122
00123     DosFindClose(hdir);
00124     if (ERROR_NO_MORE_FILES == rc)
00125         return(dirp);
00126
00127     closedir(dirp);
00128     return(NULL);
00129 }
00130
00131
00132 struct dirent *readdir(DIR *dirp)
00133 {
00134     if (dirp->cur_ent < 0 || dirp->cur_ent >= dirp->tot_ent)
00135         return(NULL);
00136
00137     return(dirp->entp[dirp->cur_ent++]);
00138 }
00139
00140
00141 long telldir(DIR *dirp)
00142 {
00143     return((long) dirp->cur_ent);
00144 }
00145
00146
00147 void seekdir(DIR *dirp, long loc)
00148 {
00149     dirp->cur_ent = (int) loc;
00150     return;
00151 }
00152
00153
00154 void rewinddir(DIR *dirp)
00155 {
00156     dirp->cur_ent = 0;
00157     return;
00158 }
00159
00160
00161 void closedir(DIR *dirp)
00162 {
00163     if (dirp)
00164     {
00165         if (dirp->dirname)
00166             free(dirp->dirname);
00167
00168         if (dirp->entp)
00169         {
00170             register int        i;
00171
00172             for (i = 0; i < dirp->tot_ent; ++i)
00173                 free(dirp->entp[i]);
00174
00175             free(dirp->entp);
00176         }
00177     }
00178
00179     return;
00180 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/dirent.h Source File

cvs-1.10/os2/dirent.h

Go to the documentation of this file.
00001 /*
00002  *              Author:     Bob Withers
00003  *              Copyright (c) 1993, All Rights Reserved
00004  *
00005  *                              NOTICE
00006  *
00007  * Permission to use, copy, modify, and distribute this software and
00008  * its documentation for any purpose and without fee is hereby granted
00009  * provided that the above copyright notice appears in all copies and
00010  * that both the copyright notice and this permission notice appear in
00011  * supporting documentation.
00012  *
00013  * The author makes no representations about the suitability of this
00014  * software for any purpose.  This software is provided ``as is''
00015  * without express or implied warranty.
00016  */
00017
00018 #ifndef DIRENT_H
00019 #define DIRENT_H
00020
00021 /*  Unix style directory(3C) support for OS/2 V2.x                      */
00022
00023 struct dirent
00024 {
00025     long            d_ino;      /* not used in this implementation      */
00026     long            d_off;      /* not used in this implementation      */
00027     unsigned short  d_namlen;
00028     char            d_name[1];
00029 };
00030
00031
00032 struct S_Dir
00033 {
00034     char           *dirname;
00035     int             max_ent;
00036     int             tot_ent;
00037     int             cur_ent;
00038     struct dirent **entp;
00039 };
00040 typedef struct S_Dir            DIR;
00041
00042
00043 DIR *               opendir(char *filename);
00044 struct dirent *     readdir(DIR *dirp);
00045 long                telldir(DIR *dirp);
00046 void                seekdir(DIR *dirp, long loc);
00047 void                rewinddir(DIR *dirp);
00048 void                closedir(DIR *dirp);
00049
00050 #endif      /* DIRENT_H */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dirent.c File Reference

cvs-1.10/os2/dirent.c File Reference

#include <stdlib.h>
#include <string.h>
#include <os2.h>
#include "dirent.h"

Include dependency graph for dirent.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | INCL_DOSFILEMGR
#define | INCL_DOSERRORS
#define | DIRENT_INCR 25

Functions

DIR * | opendir (char *filename)
dirent * | readdir (DIR *dirp)
long | telldir (DIR *dirp)
void | seekdir (DIR *dirp, long loc)
void | rewinddir (DIR *dirp)
void | closedir (DIR *dirp)

Define Documentation

#define DIRENT_INCR 25

Definition at line 28 of file dirent.c.

#define INCL_DOSERRORS

Definition at line 22 of file dirent.c.

#define INCL_DOSFILEMGR

Definition at line 21 of file dirent.c.

Function Documentation

void closedir ( DIR * dirp )

Definition at line 161 of file dirent.c.

00162 {
00163     if (dirp)
00164     {
00165         if (dirp->dirname)
00166             free(dirp->dirname);
00167
00168         if (dirp->entp)
00169         {
00170             register int        i;
00171
00172             for (i = 0; i < dirp->tot_ent; ++i)
00173                 free(dirp->entp[i]);
00174
00175             free(dirp->entp);
00176         }
00177     }
00178
00179     return;
00180 }

DIR* opendir ( char * filename )

Definition at line 31 of file dirent.c.

00032 {
00033     auto     size_t             len;
00034     auto     DIR               *dirp;
00035     auto     char              *p;
00036     auto     HDIR               hdir;
00037
00038 #ifdef OS2_16
00039     auto     USHORT             rc;         /* for 16 bit OS/2          */
00040     auto     FILEFINDBUF        ff;
00041     auto     USHORT             cnt;
00042 #else
00043     auto     APIRET             rc;         /* for 32 bit OS/2          */
00044     auto     FILEFINDBUF3       ff;
00045     auto     ULONG              cnt;
00046 #endif  /* OS2_16 */
00047
00048     if (NULL == filename || '\0' == filename[0])
00049         filename = ".";
00050
00051     dirp = malloc(sizeof(*dirp));
00052     if (NULL == dirp)
00053         return(NULL);
00054
00055     len = strlen(filename);
00056     dirp->dirname = malloc(len + 5);
00057     if (NULL == dirp->dirname)
00058     {
00059         free(dirp);
00060         return(NULL);
00061     }
00062
00063     dirp->max_ent = 0;
00064     dirp->tot_ent = 0;
00065     dirp->cur_ent = 0;
00066     dirp->entp    = NULL;
00067     strcpy(dirp->dirname, filename);
00068     for (p = dirp->dirname; *p; ++p)
00069     {
00070         if ('/' == *p)
00071             *p = '\\';
00072     }
00073
00074     if ('\\' != dirp->dirname[len - 1])
00075         strcat(dirp->dirname, "\\");
00076
00077     strcat(dirp->dirname, "*.*");
00078
00079     hdir = HDIR_SYSTEM;
00080     cnt  = 1;
00081     rc = DosFindFirst(dirp->dirname, &hdir,
00082                       FILE_NORMAL | FILE_READONLY | FILE_HIDDEN |
00083                       FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED,
00084                       &ff, sizeof(ff), &cnt, FIL_STANDARD);
00085
00086     while (NO_ERROR == rc)
00087     {
00088         auto     struct dirent     *entp;
00089
00090         if (dirp->tot_ent >= dirp->max_ent)
00091         {
00092             auto     struct dirent    **p;
00093
00094             dirp->max_ent += DIRENT_INCR;
00095             p = realloc(dirp->entp, dirp->max_ent * sizeof(entp));
00096             if (NULL == p)
00097             {
00098                 rc = ERROR_NOT_ENOUGH_MEMORY;
00099                 break;
00100             }
00101
00102             dirp->entp = p;
00103         }
00104
00105         entp = malloc(sizeof(*entp) + (size_t) ff.cchName);
00106         if (NULL == entp)
00107         {
00108             rc = ERROR_NOT_ENOUGH_MEMORY;
00109             break;
00110         }
00111
00112         entp->d_ino = 0;
00113         entp->d_off = dirp->tot_ent;
00114         entp->d_namlen = (unsigned short) ff.cchName;
00115         memcpy(entp->d_name, ff.achName, entp->d_namlen);
00116         entp->d_name[entp->d_namlen] = '\0';
00117         dirp->entp[dirp->tot_ent++] = entp;
00118
00119         cnt = 1;
00120         rc = DosFindNext(hdir, &ff, sizeof(ff), &cnt);
00121     }
00122
00123     DosFindClose(hdir);
00124     if (ERROR_NO_MORE_FILES == rc)
00125         return(dirp);
00126
00127     closedir(dirp);
00128     return(NULL);
00129 }

struct dirent* readdir ( DIR * dirp )

Definition at line 132 of file dirent.c.

00133 {
00134     if (dirp->cur_ent < 0 || dirp->cur_ent >= dirp->tot_ent)
00135         return(NULL);
00136
00137     return(dirp->entp[dirp->cur_ent++]);
00138 }

void rewinddir ( DIR * dirp )

Definition at line 154 of file dirent.c.

00155 {
00156     dirp->cur_ent = 0;
00157     return;
00158 }

void seekdir | ( | DIR * | dirp,
 |  | long | off
 | ) |

Definition at line 147 of file dirent.c.

00148 {
00149     dirp->cur_ent = (int) loc;
00150     return;
00151 }

long telldir ( DIR * dirp )

Definition at line 141 of file dirent.c.

00142 {
00143     return((long) dirp->cur_ent);
00144 }

Generated on Sun Oct 21 12:43:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dirent.h File Reference

cvs-1.10/os2/dirent.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | dirent
struct | S_Dir

Typedefs

typedef S_Dir | DIR

Functions

DIR * | opendir (char *filename)
dirent * | readdir (DIR *dirp)
long | telldir (DIR *dirp)
void | seekdir (DIR *dirp, long loc)
void | rewinddir (DIR *dirp)
void | closedir (DIR *dirp)

Typedef Documentation

typedef struct S_Dir DIR

Definition at line 40 of file dirent.h.

Function Documentation

void closedir ( DIR * dirp )

Definition at line 112 of file ndir.c.

00113 {
00114   free_dircontents (dirp->dd_contents);
00115   free ((char *) dirp);
00116 }

DIR* opendir ( char * filename )

struct dirent* readdir ( DIR * dirp )

Definition at line 120 of file ndir.c.

00121 {
00122   static struct direct dp;
00123
00124   if (dirp->dd_cp == (struct _dircontents *)0)
00125     return (struct direct *)0;
00126   dp.d_namlen = dp.d_reclen =
00127     strlen (strcpy (dp.d_name, dirp->dd_cp->_d_entry));
00128 #if 0 /* JB */
00129   strlwr (dp.d_name);       /* JF */
00130 #endif
00131   dp.d_ino = 0;
00132   dirp->dd_cp = dirp->dd_cp->_d_next;
00133   dirp->dd_loc++;
00134
00135   return &dp;
00136 }

void rewinddir ( DIR * dirp )

Definition at line 154 of file dirent.c.

00155 {
00156     dirp->cur_ent = 0;
00157     return;
00158 }

void seekdir | ( | DIR * | dirp,
 |  | long | off
 | ) |

Definition at line 140 of file ndir.c.

00141 {
00142   long i = off;
00143   struct _dircontents *dp;
00144
00145   if (off < 0)
00146     return;
00147   for (dp = dirp->dd_contents; --i >= 0 && dp; dp = dp->_d_next)
00148     ;
00149   dirp->dd_loc = off - (i + 1);
00150   dirp->dd_cp = dp;
00151 }

long telldir ( DIR * dirp )

Definition at line 155 of file ndir.c.

00156 {
00157   return dirp->dd_loc;
00158 }

Generated on Sun Oct 21 12:43:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


filesubr.c File Reference

cvs-1.10/os2/filesubr.c File Reference

#include <io.h>
#include "os2inc.h"
#include "cvs.h"

Include dependency graph for filesubr.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | ALL_FILES (FILE_ARCHIVED|FILE_DIRECTORY|FILE_SYSTEM|FILE_HIDDEN|FILE_READONLY)

Functions

int deep_remove_dir | PROTO ((const char *path))
void | copy_file (from, to) const char *from
int | fncmp (const char *n1, const char *n2)
void | fnfold (char *filename)
char * | cvs_temp_name ()
int | isabsolute (filename) const char *filename

Variables

const char * | to
const int | mode
int | writable
char * | buf
size_t | nchars
const char * | file2
char ** | argv
int * | pargc
char *** | pargv

Define Documentation

#define ALL_FILES (FILE_ARCHIVED|FILE_DIRECTORY|FILE_SYSTEM|FILE_HIDDEN|FILE_READONLY)

Function Documentation

int deep_remove_dir PROTO ( (const char *path) ) [static]

void copy_file | ( | from | ,
 |  | to |
 | ) | const

char* cvs_temp_name ( )

Definition at line 695 of file filesubr.c.

00696 {
00697     char value[L_tmpnam + 1];
00698     char *retval;
00699
00700     /* FIXME: Does OS/2 have some equivalent to TMPDIR?  */
00701     retval = tmpnam (value);
00702     if (retval == NULL)
00703     error (1, errno, "cannot generate temporary filename");
00704     return xstrdup (retval);
00705 }

int fncmp | ( | const char * | n1,
 |  | const char * | n2
 | ) |

Definition at line 667 of file filesubr.c.

00668 {
00669     while (*n1 && *n2
00670            && (OS2_filename_classes[(unsigned char) *n1]
00671            == OS2_filename_classes[(unsigned char) *n2]))
00672         n1++, n2++;
00673     return (OS2_filename_classes[(unsigned char) *n1]
00674             - OS2_filename_classes[(unsigned char) *n2]);
00675 }

void fnfold ( char * filename )

Definition at line 681 of file filesubr.c.

00682 {
00683     while (*filename)
00684     {
00685         *filename = FOLD_FN_CHAR (*filename);
00686     filename++;
00687     }
00688 }

int isabsolute ( filename ) const

Variable Documentation

char** argv

Definition at line 749 of file filesubr.c.

char* buf

Definition at line 496 of file filesubr.c.

const char* file2

Definition at line 531 of file filesubr.c.

const char* mode

Definition at line 190 of file filesubr.c.

size_t nchars

Definition at line 497 of file filesubr.c.

int* pargc

Definition at line 750 of file filesubr.c.

char*** pargv

Definition at line 751 of file filesubr.c.

const char* to

Definition at line 472 of file filesubr.c.

int writable

Definition at line 287 of file filesubr.c.

Generated on Sun Oct 21 12:42:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/filesubr.c Source File

cvs-1.10/os2/filesubr.c

Go to the documentation of this file.
00001 /* filesubr.c --- subroutines for dealing with files under OS/2
00002    Jim Blandy <jimb@cyclic.com> and Karl Fogel <kfogel@cyclic.com>
00003
00004    This file is part of GNU CVS.
00005
00006    GNU CVS is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published by the
00008    Free Software Foundation; either version 2, or (at your option) any
00009    later version.
00010
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.  */
00015
00016 /* These functions were moved out of subr.c because they need different
00017    definitions under operating systems (like, say, Windows NT) with different
00018    file system semantics.  */
00019
00020 #include <io.h>
00021
00022 #include "os2inc.h"
00023 #include "cvs.h"
00024
00025 static int deep_remove_dir PROTO((const char *path));
00026
00027 /*
00028  * Copies "from" to "to".
00029  */
00030 void
00031 copy_file (from, to)
00032     const char *from;
00033     const char *to;
00034 {
00035     struct stat sb;
00036     struct utimbuf t;
00037     int fdin, fdout;
00038
00039     if (trace)
00040 #ifdef SERVER_SUPPORT
00041     (void) fprintf (stderr, "%c-> copy(%s,%s)\n",
00042             (server_active) ? 'S' : ' ', from, to);
00043 #else
00044     (void) fprintf (stderr, "-> copy(%s,%s)\n", from, to);
00045 #endif
00046     if (noexec)
00047     return;
00048
00049     if ((fdin = open (from, O_RDONLY | O_BINARY)) < 0)
00050     error (1, errno, "cannot open %s for copying", from);
00051     if (fstat (fdin, &sb) < 0)
00052     error (1, errno, "cannot fstat %s", from);
00053     if ((fdout = open (to, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY,
00054                        (int) sb.st_mode & 07777)) < 0)
00055     error (1, errno, "cannot create %s for copying", to);
00056     if (sb.st_size > 0)
00057     {
00058     char buf[BUFSIZ];
00059     int n;
00060
00061     for (;;)
00062     {
00063         n = read (fdin, buf, sizeof(buf));
00064         if (n == -1)
00065         {
00066 #ifdef EINTR
00067         if (errno == EINTR)
00068             continue;
00069 #endif
00070         error (1, errno, "cannot read file %s for copying", from);
00071         }
00072             else if (n == 0)
00073         break;
00074
00075         if (write(fdout, buf, n) != n) {
00076         error (1, errno, "cannot write file %s for copying", to);
00077         }
00078     }
00079
00080 #ifdef HAVE_FSYNC
00081     if (fsync (fdout))
00082         error (1, errno, "cannot fsync file %s after copying", to);
00083 #endif
00084     }
00085
00086     if (close (fdin) < 0)
00087     error (0, errno, "cannot close %s", from);
00088     if (close (fdout) < 0)
00089     error (1, errno, "cannot close %s", to);
00090
00091     /* now, set the times for the copied file to match those of the original */
00092     memset ((char *) &t, 0, sizeof (t));
00093     t.actime = sb.st_atime;
00094     t.modtime = sb.st_mtime;
00095     (void) utime ((char *)to, &t);
00096 }
00097
00098 /* FIXME-krp: these functions would benefit from caching the char * &
00099    stat buf.  */
00100
00101 /*
00102  * Returns non-zero if the argument file is a directory, or is a symbolic
00103  * link which points to a directory.
00104  */
00105 int
00106 isdir (file)
00107     const char *file;
00108 {
00109     struct stat sb;
00110
00111     if (stat (file, &sb) < 0)
00112     return (0);
00113     return (S_ISDIR (sb.st_mode));
00114 }
00115
00116 /*
00117  * Returns non-zero if the argument file is a symbolic link.
00118  */
00119 int
00120 islink (file)
00121     const char *file;
00122 {
00123 #ifdef S_ISLNK
00124     struct stat sb;
00125
00126     if (lstat (file, &sb) < 0)
00127     return (0);
00128     return (S_ISLNK (sb.st_mode));
00129 #else
00130     return (0);
00131 #endif
00132 }
00133
00134 /*
00135  * Returns non-zero if the argument file exists.
00136  */
00137 int
00138 isfile (file)
00139     const char *file;
00140 {
00141     struct stat sb;
00142
00143     if (stat (file, &sb) < 0)
00144     return (0);
00145     return (1);
00146 }
00147
00148 /*
00149  * Returns non-zero if the argument file is readable.
00150  * XXX - must be careful if "cvs" is ever made setuid!
00151  */
00152 int
00153 isreadable (file)
00154     const char *file;
00155 {
00156     return (access (file, R_OK) != -1);
00157 }
00158
00159 /*
00160  * Returns non-zero if the argument file is writable
00161  * XXX - muct be careful if "cvs" is ever made setuid!
00162  */
00163 int
00164 iswritable (file)
00165     const char *file;
00166 {
00167     return (access (file, W_OK) != -1);
00168 }
00169
00170 /*
00171  * Returns non-zero if the argument file is accessable according to
00172  * mode.  If compiled with SETXID_SUPPORT also works if cvs has setxid
00173  * bits set.
00174  */
00175 int
00176 isaccessible (file, mode)
00177     const char *file;
00178     const int mode;
00179 {
00180     return access(file, mode) == 0;
00181 }
00182
00183
00184 /*
00185  * Open a file and die if it fails
00186  */
00187 FILE *
00188 open_file (name, mode)
00189     const char *name;
00190     const char *mode;
00191 {
00192     FILE *fp;
00193
00194     if ((fp = fopen (name, mode)) == NULL)
00195     error (1, errno, "cannot open %s", name);
00196     return (fp);
00197 }
00198
00199 /*
00200  * Make a directory and die if it fails
00201  */
00202 void
00203 make_directory (name)
00204     const char *name;
00205 {
00206     struct stat buf;
00207
00208     if (stat (name, &buf) == 0 && (!S_ISDIR (buf.st_mode)))
00209         error (0, 0, "%s already exists but is not a directory", name);
00210     if (!noexec && mkdir ((char *)name) < 0)
00211     error (1, errno, "cannot make directory %s", name);
00212 }
00213
00214 /*
00215  * Make a path to the argument directory, printing a message if something
00216  * goes wrong.
00217  */
00218 void
00219 make_directories (name)
00220     const char *name;
00221 {
00222     char *cp;
00223
00224     if (noexec)
00225     return;
00226
00227     if (mkdir ((char *)name) == 0 || errno == EACCES)
00228     return;
00229     if (! existence_error (errno))
00230     {
00231     error (0, errno, "cannot make path to %s", name);
00232     return;
00233     }
00234     if ((cp = strrchr (name, '/')) == NULL)
00235     return;
00236     *cp = '\0';
00237     make_directories (name);
00238     *cp++ = '/';
00239     if (*cp == '\0')
00240     return;
00241     (void) mkdir ((char *)name);
00242 }
00243
00244 /* Create directory NAME if it does not already exist; fatal error for
00245    other errors.  Returns 0 if directory was created; 1 if it already
00246    existed.  */
00247 int
00248 mkdir_if_needed (name)
00249     char *name;
00250 {
00251     if (mkdir (name) < 0)
00252     {
00253     /* Now, let me get this straight.  In IBM C/C++
00254        under OS/2, the error string for EEXIST is:
00255
00256            "The file already exists",
00257
00258            and the error string for EACCES is:
00259
00260            "The file or directory specified is read-only".
00261
00262            Nonetheless, mkdir() will set EACCES if the
00263        directory *exists*, according both to the
00264        documentation and its actual behavior.
00265
00266        I'm sure that this made sense, to someone,
00267        somewhere, sometime.  Just not me, here, now.  */
00268     if (errno != EEXIST
00269 #ifdef EACCES
00270             && errno != EACCES
00271 #endif
00272         )
00273         error (1, errno, "cannot make directory %s", name);
00274     return 1;
00275     }
00276     return 0;
00277 }
00278
00279 /*
00280  * Change the mode of a file, either adding write permissions, or removing
00281  * all write permissions.  Adding write permissions honors the current umask
00282  * setting.
00283  */
00284 void
00285 xchmod (fname, writable)
00286     char *fname;
00287     int writable;
00288 {
00289     char *attrib_cmd;
00290     char *attrib_option;
00291     char *whole_cmd;
00292     char *p;
00293     char *q;
00294
00295     if (!isfile (fname))
00296     {
00297     error (0, 0, "cannot change mode of file %s; it does not exist",
00298            fname);
00299     return;
00300     }
00301
00302     attrib_cmd = "attrib "; /* No, really? */
00303
00304     if (writable)
00305         attrib_option = "-r ";  /* make writeable */
00306     else
00307         attrib_option = "+r ";  /* make read-only */
00308
00309     whole_cmd = xmalloc (strlen (attrib_cmd)
00310                          + strlen (attrib_option)
00311                          + strlen (fname)
00312                          + 1);
00313
00314     strcpy (whole_cmd, attrib_cmd);
00315     strcat (whole_cmd, attrib_option);
00316
00317     /* Copy fname to the end of whole_cmd, translating / to \.
00318        Attrib doesn't take / but many parts of CVS rely
00319        on being able to use it.  */
00320     p = whole_cmd + strlen (whole_cmd);
00321     q = fname;
00322     while (*q)
00323     {
00324     if (*q == '/')
00325         *p++ = '\\';
00326     else
00327         *p++ = *q;
00328     ++q;
00329     }
00330     *p = '\0';
00331
00332     system (whole_cmd);
00333     free (whole_cmd);
00334 }
00335
00336
00337 /* Read the value of a symbolic link.
00338    Under OS/2, this function always returns EINVAL.  */
00339 int
00340 readlink (char *path, char *buf, int buf_size)
00341 {
00342     errno = EINVAL;
00343     return -1;
00344 }
00345
00346 /*
00347  * unlink a file, if possible.
00348  */
00349 int
00350 unlink_file (f)
00351     const char *f;
00352 {
00353     if (trace)
00354 #ifdef SERVER_SUPPORT
00355     (void) fprintf (stderr, "%c-> unlink(%s)\n",
00356             (server_active) ? 'S' : ' ', f);
00357 #else
00358     (void) fprintf (stderr, "-> unlink(%s)\n", f);
00359 #endif
00360     if (noexec)
00361     return (0);
00362
00363    /* Win32 unlink is stupid - it fails if the file is read-only.
00364     * OS/2 is similarly stupid.  It does have a remove() function,
00365     * but the documentation does not make clear why remove() is or
00366     * isn't preferable to unlink().  I'll use unlink() because the
00367     * name is closer to our interface, what the heck.  Also, we know
00368     * unlink()'s error code when trying to remove a directory.
00369     */
00370     if (isfile (f))
00371     xchmod ((char *)f, 1);
00372     return (unlink (f));
00373 }
00374
00375 /*
00376  * Unlink a file or dir, if possible.  If it is a directory do a deep
00377  * removal of all of the files in the directory.  Return -1 on error
00378  * (in which case errno is set).
00379  */
00380 int
00381 unlink_file_dir (f)
00382     const char *f;
00383 {
00384     if (trace)
00385 #ifdef SERVER_SUPPORT
00386     (void) fprintf (stderr, "%c-> unlink_file_dir(%s)\n",
00387             (server_active) ? 'S' : ' ', f);
00388 #else
00389     (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f);
00390 #endif
00391     if (noexec)
00392     return (0);
00393
00394     if (unlink_file (f) != 0)
00395     {
00396         /* under OS/2, unlink returns EACCES if the path
00397        is a directory.  */
00398         if (errno == EACCES)
00399                 return deep_remove_dir (f);
00400         else
00401         /* The file wasn't a directory and some other
00402          * error occured
00403          */
00404                 return -1;
00405     }
00406     /* We were able to remove the file from the disk */
00407     return 0;
00408 }
00409
00410 /* Remove a directory and everything it contains.  Returns 0 for
00411  * success, -1 for failure (in which case errno is set).
00412  */
00413
00414 static int
00415 deep_remove_dir (path)
00416     const char *path;
00417 {
00418     DIR       *dirp;
00419     struct dirent *dp;
00420     char       buf[PATH_MAX];
00421
00422     if (rmdir ((char *)path) != 0 && errno == EACCES)
00423     {
00424     if ((dirp = opendir ((char *)path)) == NULL)
00425         /* If unable to open the directory return
00426          * an error
00427          */
00428         return -1;
00429
00430     while ((dp = readdir (dirp)) != NULL)
00431     {
00432         if (strcmp (dp->d_name, ".") == 0 ||
00433             strcmp (dp->d_name, "..") == 0)
00434         continue;
00435
00436         sprintf (buf, "%s/%s", path, dp->d_name);
00437
00438         if (unlink_file (buf) != 0 )
00439         {
00440         if (errno == EACCES)
00441         {
00442             if (deep_remove_dir (buf))
00443             {
00444             closedir (dirp);
00445             return -1;
00446             }
00447         }
00448         else
00449         {
00450             /* buf isn't a directory, or there are
00451              * some sort of permision problems
00452              */
00453             closedir (dirp);
00454             return -1;
00455         }
00456         }
00457     }
00458     closedir (dirp);
00459     return rmdir ((char *)path);
00460     }
00461     /* Was able to remove the directory return 0 */
00462     return 0;
00463 }
00464
00465
00466 /*
00467  * Rename a file and die if it fails
00468  */
00469 void
00470 rename_file (from, to)
00471     const char *from;
00472     const char *to;
00473 {
00474     if (trace)
00475 #ifdef SERVER_SUPPORT
00476     (void) fprintf (stderr, "%c-> rename(%s,%s)\n",
00477             (server_active) ? 'S' : ' ', from, to);
00478 #else
00479     (void) fprintf (stderr, "-> rename(%s,%s)\n", from, to);
00480 #endif
00481     if (noexec)
00482     return;
00483
00484     unlink_file (to);
00485     if (rename (from, to) != 0)
00486     error (1, errno, "cannot rename file %s to %s", from, to);
00487 }
00488
00489
00490 /* Read NCHARS bytes from descriptor FD into BUF.
00491    Return the number of characters successfully read.
00492    The number returned is always NCHARS unless end-of-file or error.  */
00493 static size_t
00494 block_read (fd, buf, nchars)
00495     int fd;
00496     char *buf;
00497     size_t nchars;
00498 {
00499     char *bp = buf;
00500     size_t nread;
00501
00502     do
00503     {
00504     nread = read (fd, bp, nchars);
00505     if (nread == (size_t)-1)
00506     {
00507 #ifdef EINTR
00508         if (errno == EINTR)
00509         continue;
00510 #endif
00511         return (size_t)-1;
00512     }
00513
00514     if (nread == 0)
00515         break;
00516
00517     bp += nread;
00518     nchars -= nread;
00519     } while (nchars != 0);
00520
00521     return bp - buf;
00522 }
00523
00524
00525 /*
00526  * Compare "file1" to "file2". Return non-zero if they don't compare exactly.
00527  */
00528 int
00529 xcmp (file1, file2)
00530     const char *file1;
00531     const char *file2;
00532 {
00533     char *buf1, *buf2;
00534     struct stat sb1, sb2;
00535     int fd1, fd2;
00536     int ret;
00537
00538     if ((fd1 = open (file1, O_RDONLY | O_BINARY)) < 0)
00539     error (1, errno, "cannot open file %s for comparing", file1);
00540     if ((fd2 = open (file2, O_RDONLY | O_BINARY)) < 0)
00541     error (1, errno, "cannot open file %s for comparing", file2);
00542     if (fstat (fd1, &sb1) < 0)
00543     error (1, errno, "cannot fstat %s", file1);
00544     if (fstat (fd2, &sb2) < 0)
00545     error (1, errno, "cannot fstat %s", file2);
00546
00547     /* A generic file compare routine might compare st_dev & st_ino here
00548        to see if the two files being compared are actually the same file.
00549        But that won't happen in CVS, so we won't bother. */
00550
00551     if (sb1.st_size != sb2.st_size)
00552     ret = 1;
00553     else if (sb1.st_size == 0)
00554     ret = 0;
00555     else
00556     {
00557     /* FIXME: compute the optimal buffer size by computing the least
00558        common multiple of the files st_blocks field */
00559     size_t buf_size = 8 * 1024;
00560     size_t read1;
00561     size_t read2;
00562
00563     buf1 = xmalloc (buf_size);
00564     buf2 = xmalloc (buf_size);
00565
00566     do
00567     {
00568         read1 = block_read (fd1, buf1, buf_size);
00569         if (read1 == (size_t)-1)
00570         error (1, errno, "cannot read file %s for comparing", file1);
00571
00572         read2 = block_read (fd2, buf2, buf_size);
00573         if (read2 == (size_t)-1)
00574         error (1, errno, "cannot read file %s for comparing", file2);
00575
00576         /* assert (read1 == read2); */
00577
00578         ret = memcmp(buf1, buf2, read1);
00579     } while (ret == 0 && read1 == buf_size);
00580
00581     free (buf1);
00582     free (buf2);
00583     }
00584
00585     (void) close (fd1);
00586     (void) close (fd2);
00587     return (ret);
00588 }
00589
00590
00591 /* The equivalence class mapping for filenames.
00592    OS/2 filenames are case-insensitive, but case-preserving.  Both /
00593    and \ are path element separators.
00594    Thus, this table maps both upper and lower case to lower case, and
00595    both / and \ to /.
00596
00597    Much thanks to Jim Blandy, who already invented this wheel in the
00598    Windows NT port. */
00599
00600 #if 0
00601 main ()
00602 {
00603   int c;
00604
00605   for (c = 0; c < 256; c++)
00606     {
00607       int t;
00608
00609       if (c == '\\')
00610         t = '/';
00611       else
00612         t = tolower (c);
00613
00614       if ((c & 0x7) == 0x0)
00615          printf ("    ");
00616       printf ("0x%02x,", t);
00617       if ((c & 0x7) == 0x7)
00618          putchar ('\n');
00619       else if ((c & 0x7) == 0x3)
00620          putchar (' ');
00621     }
00622 }
00623 #endif
00624
00625
00626 unsigned char
00627 OS2_filename_classes[] =
00628 {
00629     0x00,0x01,0x02,0x03, 0x04,0x05,0x06,0x07,
00630     0x08,0x09,0x0a,0x0b, 0x0c,0x0d,0x0e,0x0f,
00631     0x10,0x11,0x12,0x13, 0x14,0x15,0x16,0x17,
00632     0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f,
00633     0x20,0x21,0x22,0x23, 0x24,0x25,0x26,0x27,
00634     0x28,0x29,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f,
00635     0x30,0x31,0x32,0x33, 0x34,0x35,0x36,0x37,
00636     0x38,0x39,0x3a,0x3b, 0x3c,0x3d,0x3e,0x3f,
00637     0x40,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
00638     0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
00639     0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
00640     0x78,0x79,0x7a,0x5b, 0x2f,0x5d,0x5e,0x5f,
00641     0x60,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
00642     0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
00643     0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
00644     0x78,0x79,0x7a,0x7b, 0x7c,0x7d,0x7e,0x7f,
00645     0x80,0x81,0x82,0x83, 0x84,0x85,0x86,0x87,
00646     0x88,0x89,0x8a,0x8b, 0x8c,0x8d,0x8e,0x8f,
00647     0x90,0x91,0x92,0x93, 0x94,0x95,0x96,0x97,
00648     0x98,0x99,0x9a,0x9b, 0x9c,0x9d,0x9e,0x9f,
00649     0xa0,0xa1,0xa2,0xa3, 0xa4,0xa5,0xa6,0xa7,
00650     0xa8,0xa9,0xaa,0xab, 0xac,0xad,0xae,0xaf,
00651     0xb0,0xb1,0xb2,0xb3, 0xb4,0xb5,0xb6,0xb7,
00652     0xb8,0xb9,0xba,0xbb, 0xbc,0xbd,0xbe,0xbf,
00653     0xc0,0xc1,0xc2,0xc3, 0xc4,0xc5,0xc6,0xc7,
00654     0xc8,0xc9,0xca,0xcb, 0xcc,0xcd,0xce,0xcf,
00655     0xd0,0xd1,0xd2,0xd3, 0xd4,0xd5,0xd6,0xd7,
00656     0xd8,0xd9,0xda,0xdb, 0xdc,0xdd,0xde,0xdf,
00657     0xe0,0xe1,0xe2,0xe3, 0xe4,0xe5,0xe6,0xe7,
00658     0xe8,0xe9,0xea,0xeb, 0xec,0xed,0xee,0xef,
00659     0xf0,0xf1,0xf2,0xf3, 0xf4,0xf5,0xf6,0xf7,
00660     0xf8,0xf9,0xfa,0xfb, 0xfc,0xfd,0xfe,0xff,
00661 };
00662
00663 /* Like strcmp, but with the appropriate tweaks for file names.
00664    Under OS/2, filenames are case-insensitive but case-preserving, and
00665    both \ and / are path element separators.  */
00666 int
00667 fncmp (const char *n1, const char *n2)
00668 {
00669     while (*n1 && *n2
00670            && (OS2_filename_classes[(unsigned char) *n1]
00671            == OS2_filename_classes[(unsigned char) *n2]))
00672         n1++, n2++;
00673     return (OS2_filename_classes[(unsigned char) *n1]
00674             - OS2_filename_classes[(unsigned char) *n2]);
00675 }
00676
00677 /* Fold characters in FILENAME to their canonical forms.
00678    If FOLD_FN_CHAR is not #defined, the system provides a default
00679    definition for this.  */
00680 void
00681 fnfold (char *filename)
00682 {
00683     while (*filename)
00684     {
00685         *filename = FOLD_FN_CHAR (*filename);
00686     filename++;
00687     }
00688 }
00689
00690
00691 /* Generate a unique temporary filename.  Returns a pointer to a newly
00692    malloc'd string containing the name.  Returns successfully or not at
00693    all.  */
00694 char *
00695 cvs_temp_name ()
00696 {
00697     char value[L_tmpnam + 1];
00698     char *retval;
00699
00700     /* FIXME: Does OS/2 have some equivalent to TMPDIR?  */
00701     retval = tmpnam (value);
00702     if (retval == NULL)
00703     error (1, errno, "cannot generate temporary filename");
00704     return xstrdup (retval);
00705 }
00706
00707 /* Return non-zero iff FILENAME is absolute.
00708    Trivial under Unix, but more complicated under other systems.  */
00709 int
00710 isabsolute (filename)
00711     const char *filename;
00712 {
00713     return (ISDIRSEP (filename[0])
00714             || (filename[0] != '\0'
00715                 && filename[1] == ':'
00716                 && ISDIRSEP (filename[2])));
00717 }
00718
00719 /* Return a pointer into PATH's last component.  */
00720 char *
00721 last_component (char *path)
00722 {
00723     char *scan;
00724     char *last = 0;
00725
00726     for (scan = path; *scan; scan++)
00727         if (ISDIRSEP (*scan))
00728         last = scan;
00729
00730     if (last && (last != path))
00731         return last + 1;
00732     else
00733         return path;
00734 }
00735
00736
00737 /* Return the home directory.  Returns a pointer to storage
00738    managed by this function or its callees (currently getenv).  */
00739 char *
00740 get_homedir ()
00741 {
00742     return getenv ("HOME");
00743 }
00744
00745 /* See cvs.h for description.  */
00746 void
00747 expand_wild (argc, argv, pargc, pargv)
00748     int argc;
00749     char **argv;
00750     int *pargc;
00751     char ***pargv;
00752 {
00753     int i;
00754     int new_argc;
00755     char **new_argv;
00756     /* Allocated size of new_argv.  We arrange it so there is always room for
00757        one more element.  */
00758     int max_new_argc;
00759
00760     new_argc = 0;
00761     /* Add one so this is never zero.  */
00762     max_new_argc = argc + 1;
00763     new_argv = (char **) xmalloc (max_new_argc * sizeof (char *));
00764     for (i = 0; i < argc; ++i)
00765     {
00766     HDIR          FindHandle = 0x0001;
00767     FILEFINDBUF3  FindBuffer;
00768     ULONG         FindCount = 1;
00769     APIRET        rc;          /* Return code */
00770 #define ALL_FILES (FILE_ARCHIVED|FILE_DIRECTORY|FILE_SYSTEM|FILE_HIDDEN|FILE_READONLY)
00771
00772     /* DosFindFirst, called with a string like 'dir/file' will return
00773      * *only* the file part. So what we have to do here is to save the
00774      * directory part, and add it later to the returned filename.
00775      */
00776
00777     /* Path + name */
00778     char *PathName = argv [i];
00779
00780     /* Path only, including slash */
00781     char *Path = NULL;
00782
00783     /* Name without path */
00784     char *Name = last_component (PathName);
00785
00786     if (Name > PathName)
00787     {
00788         /* We have a path component, save it */
00789         Path = xmalloc (Name - PathName + 1);
00790         memcpy (Path, PathName, Name - PathName);
00791         Path [Name - PathName] = '\0';
00792     }
00793
00794     rc = DosFindFirst(PathName,          /* File pattern */
00795               &FindHandle,           /* Directory search handle */
00796               ALL_FILES,             /* Search attribute */
00797               (PVOID) &FindBuffer,   /* Result buffer */
00798               sizeof(FindBuffer),    /* Result buffer length */
00799               &FindCount,            /* Number of entries to find */
00800               FIL_STANDARD);     /* Return level 1 file info */
00801
00802     if (rc != 0)
00803     {
00804         if (rc == ERROR_NO_MORE_FILES)
00805         {
00806         /* No match.  The file specified didn't contain a wildcard (in which case
00807            we clearly should return it unchanged), or it contained a wildcard which
00808            didn't match (in which case it might be better for it to be an error,
00809            but we don't try to do that).  */
00810         new_argv [new_argc++] = xstrdup (argv[i]);
00811         if (new_argc == max_new_argc)
00812         {
00813             max_new_argc *= 2;
00814             new_argv = xrealloc (new_argv, max_new_argc * sizeof (char *));
00815         }
00816         }
00817         else
00818         {
00819                 error (1, rc, "cannot find %s", PathName);
00820         }
00821     }
00822     else
00823     {
00824         while (1)
00825         {
00826         /*
00827          * Don't match ".", "..", and files starting with '.'
00828          * (unless pattern also starts with '.').  This is
00829          * (more or less) what standard Unix globbing does.
00830          */
00831         if ((strcmp(FindBuffer.achName, ".") != 0) &&
00832             (strcmp(FindBuffer.achName, "..") != 0) &&
00833             ((argv[i][0] == '.') || (FindBuffer.achName[0] != '.')))
00834         {
00835             /* Be sure to add the path if needed */
00836             char *NewArg;
00837             if (Path)
00838             {
00839             unsigned Len =
00840                 strlen (Path) + strlen (FindBuffer.achName) + 1;
00841             NewArg = xmalloc (Len);
00842             strcpy (NewArg, Path);
00843             strcat (NewArg, FindBuffer.achName);
00844             }
00845             else
00846             {
00847             NewArg = xstrdup (FindBuffer.achName);
00848             }
00849             new_argv [new_argc++] = NewArg;
00850             if (new_argc == max_new_argc)
00851             {
00852             max_new_argc *= 2;
00853             new_argv = xrealloc (new_argv, max_new_argc * sizeof (char *));
00854             }
00855         }
00856
00857         rc = DosFindNext (FindHandle,
00858                   (PVOID) &FindBuffer,
00859                   sizeof(FindBuffer),
00860                   &FindCount);
00861         if (rc == ERROR_NO_MORE_FILES)
00862             break;
00863         else if (rc != NO_ERROR)
00864             error (1, rc, "cannot find %s", argv[i]);
00865         }
00866         rc = DosFindClose(FindHandle);
00867         if (rc != 0)
00868         error (1, rc, "cannot close %s", argv[i]);
00869     }
00870     if (Path != NULL)
00871         free (Path);
00872     }
00873     *pargc = new_argc;
00874     *pargv = new_argv;
00875 }
00876
00877 /* Change drive and directory to path DIR.  */
00878
00879 int
00880 os2_chdir (const char *Dir)
00881 {
00882     /* If the path includes a drive, change the current drive to the one
00883        given.  */
00884     if (strlen (Dir) >= 2 && Dir [1] == ':')
00885     {
00886     /* A drive is given in Dir. Extract the drive from the string, then
00887      * remove the drive from Dir by incrementing it.
00888      */
00889     int Drive = Dir [0];
00890     Dir += 2;
00891
00892     /* Check if the given drive is valid, convert to a drive number
00893      * (A: == 1, B: == 2, etc.). The compare below assumes ascii, but
00894      * that is not a problem with OS/2.
00895      */
00896     if (Drive >= 'a' && Drive <= 'z')
00897     {
00898         Drive -= 'a' - 1;
00899     }
00900     else if (Drive >= 'A' && Drive <= 'Z')
00901     {
00902         Drive -= 'A' - 1;
00903     }
00904     else
00905     {
00906         /* An invalid drive letter. Set errno and return an error */
00907         errno = EACCES;
00908         return -1;
00909     }
00910
00911     /* We have a valid drive given, so change the drive now */
00912     if (DosSetDefaultDisk (Drive) != 0)
00913     {
00914         /* We had an error. Assume that the drive does not exist */
00915 #ifdef ENODEV
00916         errno = ENODEV;
00917 #else
00918         /* IBM C/C++ Tools 2.01 seems to lack ENODEV.  */
00919         errno = ENOENT;
00920 #endif
00921         return -1;
00922     }
00923
00924     }
00925
00926     /* Now we have a path without a drive left. Make it the current dir */
00927     return chdir (Dir);
00928 }
00929
00930
00931
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getdate.c File Reference

cvs-1.10/os2/getdate.c File Reference

#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <time.h>
#include <sys/timeb.h>
#include <string.h>

Include dependency graph for getdate.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | _TABLE
union | YYSTYPE
struct | yytoktype

Defines

#define | yyparse getdate_yyparse
#define | yylex getdate_yylex
#define | yyerror getdate_yyerror
#define | EPOCH 1970
#define | HOUR(x) ((time_t)(x) * 60)
#define | SECSPERDAY (24L * 60L * 60L)
#define | tAGO 257
#define | tDAY 258
#define | tDAYZONE 259
#define | tID 260
#define | tMERIDIAN 261
#define | tMINUTE_UNIT 262
#define | tMONTH 263
#define | tMONTH_UNIT 264
#define | tSEC_UNIT 265
#define | tSNUMBER 266
#define | tUNUMBER 267
#define | tZONE 268
#define | tDST 269
#define | yyclearin yychar = -1
#define | yyerrok yyerrflag = 0
#define | YYMAXDEPTH 150
#define | YYERRCODE 256
#define | TM_YEAR_ORIGIN 1900
#define | YYNPROD 42
#define | YYLAST 228
#define | YYDEBUG 0
#define | YYERROR goto yyerrlab
#define | YYACCEPT { free(yys); free(yyv); return(0); }
#define | YYABORT { free(yys); free(yyv); return(1); }
#define | YYBACKUP(newtoken, newvalue)
#define | YYRECOVERING() (!!yyerrflag)
#define | YYFLAG (-1000)

Typedefs

typedef _TABLE | TABLE
typedef enum _DSTMODE | DSTMODE
typedef enum _MERIDIAN | MERIDIAN

Enumerations

enum | _DSTMODE { DSTon, DSToff, DSTmaybe }
enum | _MERIDIAN { MERam, MERpm, MER24 }

Functions

tm * | gmtime ()
tm * | localtime ()
int | getdate_yylex ()
int | getdate_yyerror ()
int | getdate_yyerror (s) char *s
int | getdate_yyparse ()

Variables

char | RCS [] = "$CVSid: @(#)getdate.y 1.11 94/09/21 $"
char * | yyInput
DSTMODE yyDSTmode
time_t | yyDayOrdinal
time_t | yyDayNumber
int | yyHaveDate
int | yyHaveDay
int | yyHaveRel
int | yyHaveTime
int | yyHaveZone
time_t | yyTimezone
time_t | yyDay
time_t | yyHour
time_t | yyMinutes
time_t | yyMonth
time_t | yySeconds
time_t | yyYear
MERIDIAN yyMeridian
time_t | yyRelMonth
time_t | yyRelSeconds
int | yychar
int | yyerrflag
YYSTYPE yylval
YYSTYPE yyval
TABLE const | MonthDayTable []
TABLE const | UnitsTable []
TABLE const | OtherTable []
TABLE const | TimezoneTable []
TABLE const | MilitaryTable []
time_t | Minutes
time_t | Seconds
MERIDIAN Meridian
time_t | Day
time_t | Year
time_t | Hours
DSTMODE DSTmode
time_t | Future
time_t | DayOrdinal
time_t | DayNumber
time_t | RelMonth
* b
timeb * now
int | yyact []
int | yypact []
int | yypgo []
int | yyr1 []
int | yyr2 []
int | yychk []
int | yydef []
int | yydebug
YYSTYPE * yyv
int * | yys
YYSTYPE * yypv
int * | yyps
int | yystate
int | yytmp
int | yynerrs

Define Documentation

#define EPOCH 1970

Definition at line 88 of file getdate.c.

#define HOUR ( x ) ((time_t)(x) * 60)

Definition at line 89 of file getdate.c.

#define SECSPERDAY (24L * 60L * 60L)

Definition at line 90 of file getdate.c.

#define TM_YEAR_ORIGIN 1900

#define YYABORT { free(yys); free(yyv); return(1); }

Definition at line 938 of file getdate.c.

#define YYACCEPT { free(yys); free(yyv); return(0); }

Definition at line 937 of file getdate.c.

#define YYBACKUP | ( | newtoken,
 |  | newvalue | )

Value:

{\
    if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
    {\
        yyerror( "syntax error - cannot backup" );\
        goto yyerrlab;\
    }\
    yychar = newtoken;\
    yystate = *yyps;\
    yylval = newvalue;\
    goto yynewstate;\
}

Definition at line 939 of file getdate.c.

#define YYDEBUG 0

Definition at line 858 of file getdate.c.

#define YYERRCODE 256

Definition at line 170 of file getdate.c.

#define YYERROR goto yyerrlab

Definition at line 936 of file getdate.c.

#define YYFLAG (-1000)

Definition at line 964 of file getdate.c.

#define YYLAST 228

Definition at line 788 of file getdate.c.

#define YYMAXDEPTH 150

Definition at line 167 of file getdate.c.

#define YYNPROD 42

Definition at line 787 of file getdate.c.

#define YYRECOVERING ( ) (!!yyerrflag)

Definition at line 951 of file getdate.c.

#define tAGO 257

Definition at line 149 of file getdate.c.

#define tDAY 258

Definition at line 150 of file getdate.c.

#define tDAYZONE 259

Definition at line 151 of file getdate.c.

#define tDST 269

Definition at line 161 of file getdate.c.

#define tID 260

Definition at line 152 of file getdate.c.

#define tMERIDIAN 261

Definition at line 153 of file getdate.c.

#define tMINUTE_UNIT 262

Definition at line 154 of file getdate.c.

#define tMONTH 263

Definition at line 155 of file getdate.c.

#define tMONTH_UNIT 264

Definition at line 156 of file getdate.c.

#define tSEC_UNIT 265

Definition at line 157 of file getdate.c.

#define tSNUMBER 266

Definition at line 158 of file getdate.c.

#define tUNUMBER 267

Definition at line 159 of file getdate.c.

#define tZONE 268

Definition at line 160 of file getdate.c.

#define yyclearin yychar = -1

Definition at line 162 of file getdate.c.

#define yyerrok yyerrflag = 0

Definition at line 163 of file getdate.c.

#define yyerror getdate_yyerror

Definition at line 79 of file getdate.c.

#define yylex getdate_yylex

Definition at line 78 of file getdate.c.

#define yyparse getdate_yyparse

Definition at line 77 of file getdate.c.

Typedef Documentation

typedef enum _DSTMODE DSTMODE

typedef enum _MERIDIAN MERIDIAN

typedef struct _TABLE TABLE

Enumeration Type Documentation

enum _DSTMODE

Enumeration values:
DSTon
DSToff
DSTmaybe

Definition at line 106 of file getdate.c.

00106                       {
00107     DSTon, DSToff, DSTmaybe
00108 } DSTMODE;

enum _MERIDIAN

Enumeration values:
MERam
MERpm
MER24

Definition at line 113 of file getdate.c.

00113                        {
00114     MERam, MERpm, MER24
00115 } MERIDIAN;

Function Documentation

int getdate_yyerror ( s ) [static]

int getdate_yyerror ( ) [static]

int getdate_yylex ( ) [static]

int getdate_yyparse ( )

Definition at line 988 of file getdate.c.

00989 {
00990     register YYSTYPE *yypvt;    /* top of value stack for $vars */
00991     unsigned yymaxdepth = YYMAXDEPTH;
00992
00993     /*
00994     ** Initialize externals - yyparse may be called more than once
00995     */
00996     yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE));
00997     yys = (int*)malloc(yymaxdepth*sizeof(int));
00998     if (!yyv || !yys)
00999     {
01000         yyerror( "out of memory" );
01001         return(1);
01002     }
01003     yypv = &yyv[-1];
01004     yyps = &yys[-1];
01005     yystate = 0;
01006     yytmp = 0;
01007     yynerrs = 0;
01008     yyerrflag = 0;
01009     yychar = -1;
01010
01011     goto yystack;
01012     {
01013         register YYSTYPE *yy_pv;    /* top of value stack */
01014         register int *yy_ps;        /* top of state stack */
01015         register int yy_state;      /* current state */
01016         register int  yy_n;     /* internal state number info */
01017
01018         /*
01019         ** get globals into registers.
01020         ** branch to here only if YYBACKUP was called.
01021         */
01022     yynewstate:
01023         yy_pv = yypv;
01024         yy_ps = yyps;
01025         yy_state = yystate;
01026         goto yy_newstate;
01027
01028         /*
01029         ** get globals into registers.
01030         ** either we just started, or we just finished a reduction
01031         */
01032     yystack:
01033         yy_pv = yypv;
01034         yy_ps = yyps;
01035         yy_state = yystate;
01036
01037         /*
01038         ** top of for (;;) loop while no reductions done
01039         */
01040     yy_stack:
01041         /*
01042         ** put a state and value onto the stacks
01043         */
01044 #if YYDEBUG
01045         /*
01046         ** if debugging, look up token value in list of value vs.
01047         ** name pairs.  0 and negative (-1) are special values.
01048         ** Note: linear search is used since time is not a real
01049         ** consideration while debugging.
01050         */
01051         if ( yydebug )
01052         {
01053             register int yy_i;
01054
01055             (void)printf( "State %d, token ", yy_state );
01056             if ( yychar == 0 )
01057                 (void)printf( "end-of-file\n" );
01058             else if ( yychar < 0 )
01059                 (void)printf( "-none-\n" );
01060             else
01061             {
01062                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
01063                     yy_i++ )
01064                 {
01065                     if ( yytoks[yy_i].t_val == yychar )
01066                         break;
01067                 }
01068                 (void)printf( "%s\n", yytoks[yy_i].t_name );
01069             }
01070         }
01071 #endif /* YYDEBUG */
01072         if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
01073         {
01074             /*
01075             ** reallocate and recover.  Note that pointers
01076             ** have to be reset, or bad things will happen
01077             */
01078             int yyps_index = (yy_ps - yys);
01079             int yypv_index = (yy_pv - yyv);
01080             int yypvt_index = (yypvt - yyv);
01081             yymaxdepth += YYMAXDEPTH;
01082             yyv = (YYSTYPE*)realloc((char*)yyv,
01083                 yymaxdepth * sizeof(YYSTYPE));
01084             yys = (int*)realloc((char*)yys,
01085                 yymaxdepth * sizeof(int));
01086             if (!yyv || !yys)
01087             {
01088                 yyerror( "yacc stack overflow" );
01089                 return(1);
01090             }
01091             yy_ps = yys + yyps_index;
01092             yy_pv = yyv + yypv_index;
01093             yypvt = yyv + yypvt_index;
01094         }
01095         *yy_ps = yy_state;
01096         *++yy_pv = yyval;
01097
01098         /*
01099         ** we have a new state - find out what to do
01100         */
01101     yy_newstate:
01102         if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
01103             goto yydefault;     /* simple state */
01104 #if YYDEBUG
01105         /*
01106         ** if debugging, need to mark whether new token grabbed
01107         */
01108         yytmp = yychar < 0;
01109 #endif
01110         if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
01111             yychar = 0;     /* reached EOF */
01112 #if YYDEBUG
01113         if ( yydebug && yytmp )
01114         {
01115             register int yy_i;
01116
01117             (void)printf( "Received token " );
01118             if ( yychar == 0 )
01119                 (void)printf( "end-of-file\n" );
01120             else if ( yychar < 0 )
01121                 (void)printf( "-none-\n" );
01122             else
01123             {
01124                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
01125                     yy_i++ )
01126                 {
01127                     if ( yytoks[yy_i].t_val == yychar )
01128                         break;
01129                 }
01130                 (void)printf( "%s\n", yytoks[yy_i].t_name );
01131             }
01132         }
01133 #endif /* YYDEBUG */
01134         if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
01135             goto yydefault;
01136         if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )  /*valid shift*/
01137         {
01138             yychar = -1;
01139             yyval = yylval;
01140             yy_state = yy_n;
01141             if ( yyerrflag > 0 )
01142                 yyerrflag--;
01143             goto yy_stack;
01144         }
01145
01146     yydefault:
01147         if ( ( yy_n = yydef[ yy_state ] ) == -2 )
01148         {
01149 #if YYDEBUG
01150             yytmp = yychar < 0;
01151 #endif
01152             if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
01153                 yychar = 0;     /* reached EOF */
01154 #if YYDEBUG
01155             if ( yydebug && yytmp )
01156             {
01157                 register int yy_i;
01158
01159                 (void)printf( "Received token " );
01160                 if ( yychar == 0 )
01161                     (void)printf( "end-of-file\n" );
01162                 else if ( yychar < 0 )
01163                     (void)printf( "-none-\n" );
01164                 else
01165                 {
01166                     for ( yy_i = 0;
01167                         yytoks[yy_i].t_val >= 0;
01168                         yy_i++ )
01169                     {
01170                         if ( yytoks[yy_i].t_val
01171                             == yychar )
01172                         {
01173                             break;
01174                         }
01175                     }
01176                     (void)printf( "%s\n", yytoks[yy_i].t_name );
01177                 }
01178             }
01179 #endif /* YYDEBUG */
01180             /*
01181             ** look through exception table
01182             */
01183             {
01184                 register int *yyxi = yyexca;
01185
01186                 while ( ( *yyxi != -1 ) ||
01187                     ( yyxi[1] != yy_state ) )
01188                 {
01189                     yyxi += 2;
01190                 }
01191                 while ( ( *(yyxi += 2) >= 0 ) &&
01192                     ( *yyxi != yychar ) )
01193                     ;
01194                 if ( ( yy_n = yyxi[1] ) < 0 )
01195                     YYACCEPT;
01196             }
01197         }
01198
01199         /*
01200         ** check for syntax error
01201         */
01202         if ( yy_n == 0 )    /* have an error */
01203         {
01204             /* no worry about speed here! */
01205             switch ( yyerrflag )
01206             {
01207             case 0:     /* new error */
01208                 yyerror( "syntax error" );
01209                 goto skip_init;
01210             yyerrlab:
01211                 /*
01212                 ** get globals into registers.
01213                 ** we have a user generated syntax type error
01214                 */
01215                 yy_pv = yypv;
01216                 yy_ps = yyps;
01217                 yy_state = yystate;
01218                 yynerrs++;
01219             skip_init:
01220             case 1:
01221             case 2:     /* incompletely recovered error */
01222                     /* try again... */
01223                 yyerrflag = 3;
01224                 /*
01225                 ** find state where "error" is a legal
01226                 ** shift action
01227                 */
01228                 while ( yy_ps >= yys )
01229                 {
01230                     yy_n = yypact[ *yy_ps ] + YYERRCODE;
01231                     if ( yy_n >= 0 && yy_n < YYLAST &&
01232                         yychk[yyact[yy_n]] == YYERRCODE)                    {
01233                         /*
01234                         ** simulate shift of "error"
01235                         */
01236                         yy_state = yyact[ yy_n ];
01237                         goto yy_stack;
01238                     }
01239                     /*
01240                     ** current state has no shift on
01241                     ** "error", pop stack
01242                     */
01243 #if YYDEBUG
01244 #   define _POP_ "Error recovery pops state %d, uncovers state %d\n"
01245                     if ( yydebug )
01246                         (void)printf( _POP_, *yy_ps,
01247                             yy_ps[-1] );
01248 #   undef _POP_
01249 #endif
01250                     yy_ps--;
01251                     yy_pv--;
01252                 }
01253                 /*
01254                 ** there is no state on stack with "error" as
01255                 ** a valid shift.  give up.
01256                 */
01257                 YYABORT;
01258             case 3:     /* no shift yet; eat a token */
01259 #if YYDEBUG
01260                 /*
01261                 ** if debugging, look up token in list of
01262                 ** pairs.  0 and negative shouldn't occur,
01263                 ** but since timing doesn't matter when
01264                 ** debugging, it doesn't hurt to leave the
01265                 ** tests here.
01266                 */
01267                 if ( yydebug )
01268                 {
01269                     register int yy_i;
01270
01271                     (void)printf( "Error recovery discards " );
01272                     if ( yychar == 0 )
01273                         (void)printf( "token end-of-file\n" );
01274                     else if ( yychar < 0 )
01275                         (void)printf( "token -none-\n" );
01276                     else
01277                     {
01278                         for ( yy_i = 0;
01279                             yytoks[yy_i].t_val >= 0;
01280                             yy_i++ )
01281                         {
01282                             if ( yytoks[yy_i].t_val
01283                                 == yychar )
01284                             {
01285                                 break;
01286                             }
01287                         }
01288                         (void)printf( "token %s\n",
01289                             yytoks[yy_i].t_name );
01290                     }
01291                 }
01292 #endif /* YYDEBUG */
01293                 if ( yychar == 0 )  /* reached EOF. quit */
01294                     YYABORT;
01295                 yychar = -1;
01296                 goto yy_newstate;
01297             }
01298         }/* end if ( yy_n == 0 ) */
01299         /*
01300         ** reduction by production yy_n
01301         ** put stack tops, etc. so things right after switch
01302         */
01303 #if YYDEBUG
01304         /*
01305         ** if debugging, print the string that is the user's
01306         ** specification of the reduction which is just about
01307         ** to be done.
01308         */
01309         if ( yydebug )
01310             (void)printf( "Reduce by (%d) \"%s\"\n",
01311                 yy_n, yyreds[ yy_n ] );
01312 #endif
01313         yytmp = yy_n;           /* value to switch over */
01314         yypvt = yy_pv;          /* $vars top of value stack */
01315         /*
01316         ** Look in goto table for next state
01317         ** Sorry about using yy_state here as temporary
01318         ** register variable, but why not, if it works...
01319         ** If yyr2[ yy_n ] doesn't have the low order bit
01320         ** set, then there is no action to be done for
01321         ** this reduction.  So, no saving & unsaving of
01322         ** registers done.  The only difference between the
01323         ** code just after the if and the body of the if is
01324         ** the goto yy_stack in the body.  This way the test
01325         ** can be made before the choice of what to do is needed.
01326         */
01327         {
01328             /* length of production doubled with extra bit */
01329             register int yy_len = yyr2[ yy_n ];
01330
01331             if ( !( yy_len & 01 ) )
01332             {
01333                 yy_len >>= 1;
01334                 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
01335                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
01336                     *( yy_ps -= yy_len ) + 1;
01337                 if ( yy_state >= YYLAST ||
01338                     yychk[ yy_state =
01339                     yyact[ yy_state ] ] != -yy_n )
01340                 {
01341                     yy_state = yyact[ yypgo[ yy_n ] ];
01342                 }
01343                 goto yy_stack;
01344             }
01345             yy_len >>= 1;
01346             yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
01347             yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
01348                 *( yy_ps -= yy_len ) + 1;
01349             if ( yy_state >= YYLAST ||
01350                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
01351             {
01352                 yy_state = yyact[ yypgo[ yy_n ] ];
01353             }
01354         }
01355                     /* save until reenter driver code */
01356         yystate = yy_state;
01357         yyps = yy_ps;
01358         yypv = yy_pv;
01359     }
01360     /*
01361     ** code supplied by user is placed in this switch
01362     */
01363     switch( yytmp )
01364     {
01365
01366 case 3:
01367 {
01368         yyHaveTime++;
01369     } break;
01370 case 4:
01371 {
01372         yyHaveZone++;
01373     } break;
01374 case 5:
01375 {
01376         yyHaveDate++;
01377     } break;
01378 case 6:
01379 {
01380         yyHaveDay++;
01381     } break;
01382 case 7:
01383 {
01384         yyHaveRel++;
01385     } break;
01386 case 9:
01387 {
01388         yyHour = yypvt[-1].Number;
01389         yyMinutes = 0;
01390         yySeconds = 0;
01391         yyMeridian = yypvt[-0].Meridian;
01392     } break;
01393 case 10:
01394 {
01395         yyHour = yypvt[-3].Number;
01396         yyMinutes = yypvt[-1].Number;
01397         yySeconds = 0;
01398         yyMeridian = yypvt[-0].Meridian;
01399     } break;
01400 case 11:
01401 {
01402         yyHour = yypvt[-3].Number;
01403         yyMinutes = yypvt[-1].Number;
01404         yyMeridian = MER24;
01405         yyDSTmode = DSToff;
01406         yyTimezone = - (yypvt[-0].Number % 100 + (yypvt[-0].Number / 100) * 60);
01407     } break;
01408 case 12:
01409 {
01410         yyHour = yypvt[-5].Number;
01411         yyMinutes = yypvt[-3].Number;
01412         yySeconds = yypvt[-1].Number;
01413         yyMeridian = yypvt[-0].Meridian;
01414     } break;
01415 case 13:
01416 {
01417         yyHour = yypvt[-5].Number;
01418         yyMinutes = yypvt[-3].Number;
01419         yySeconds = yypvt[-1].Number;
01420         yyMeridian = MER24;
01421         yyDSTmode = DSToff;
01422         yyTimezone = - (yypvt[-0].Number % 100 + (yypvt[-0].Number / 100) * 60);
01423     } break;
01424 case 14:
01425 {
01426         yyTimezone = yypvt[-0].Number;
01427         yyDSTmode = DSToff;
01428     } break;
01429 case 15:
01430 {
01431         yyTimezone = yypvt[-0].Number;
01432         yyDSTmode = DSTon;
01433     } break;
01434 case 16:
01435 {
01436         yyTimezone = yypvt[-1].Number;
01437         yyDSTmode = DSTon;
01438     } break;
01439 case 17:
01440 {
01441         yyDayOrdinal = 1;
01442         yyDayNumber = yypvt[-0].Number;
01443     } break;
01444 case 18:
01445 {
01446         yyDayOrdinal = 1;
01447         yyDayNumber = yypvt[-1].Number;
01448     } break;
01449 case 19:
01450 {
01451         yyDayOrdinal = yypvt[-1].Number;
01452         yyDayNumber = yypvt[-0].Number;
01453     } break;
01454 case 20:
01455 {
01456         yyMonth = yypvt[-2].Number;
01457         yyDay = yypvt[-0].Number;
01458     } break;
01459 case 21:
01460 {
01461         yyMonth = yypvt[-4].Number;
01462         yyDay = yypvt[-2].Number;
01463         yyYear = yypvt[-0].Number;
01464     } break;
01465 case 22:
01466 {
01467         /* ISO 8601 format.  yyyy-mm-dd.  */
01468         yyYear = yypvt[-2].Number;
01469         yyMonth = -yypvt[-1].Number;
01470         yyDay = -yypvt[-0].Number;
01471     } break;
01472 case 23:
01473 {
01474         /* e.g. 17-JUN-1992.  */
01475         yyDay = yypvt[-2].Number;
01476         yyMonth = yypvt[-1].Number;
01477         yyYear = -yypvt[-0].Number;
01478     } break;
01479 case 24:
01480 {
01481         yyMonth = yypvt[-1].Number;
01482         yyDay = yypvt[-0].Number;
01483     } break;
01484 case 25:
01485 {
01486         yyMonth = yypvt[-3].Number;
01487         yyDay = yypvt[-2].Number;
01488         yyYear = yypvt[-0].Number;
01489     } break;
01490 case 26:
01491 {
01492         yyMonth = yypvt[-0].Number;
01493         yyDay = yypvt[-1].Number;
01494     } break;
01495 case 27:
01496 {
01497         yyMonth = yypvt[-1].Number;
01498         yyDay = yypvt[-2].Number;
01499         yyYear = yypvt[-0].Number;
01500     } break;
01501 case 28:
01502 {
01503         yyRelSeconds = -yyRelSeconds;
01504         yyRelMonth = -yyRelMonth;
01505     } break;
01506 case 30:
01507 {
01508         yyRelSeconds += yypvt[-1].Number * yypvt[-0].Number * 60L;
01509     } break;
01510 case 31:
01511 {
01512         yyRelSeconds += yypvt[-1].Number * yypvt[-0].Number * 60L;
01513     } break;
01514 case 32:
01515 {
01516         yyRelSeconds += yypvt[-0].Number * 60L;
01517     } break;
01518 case 33:
01519 {
01520         yyRelSeconds += yypvt[-1].Number;
01521     } break;
01522 case 34:
01523 {
01524         yyRelSeconds += yypvt[-1].Number;
01525     } break;
01526 case 35:
01527 {
01528         yyRelSeconds++;
01529     } break;
01530 case 36:
01531 {
01532         yyRelMonth += yypvt[-1].Number * yypvt[-0].Number;
01533     } break;
01534 case 37:
01535 {
01536         yyRelMonth += yypvt[-1].Number * yypvt[-0].Number;
01537     } break;
01538 case 38:
01539 {
01540         yyRelMonth += yypvt[-0].Number;
01541     } break;
01542 case 39:
01543 {
01544         if (yyHaveTime && yyHaveDate && !yyHaveRel)
01545         yyYear = yypvt[-0].Number;
01546         else {
01547         if(yypvt[-0].Number>10000) {
01548             yyHaveDate++;
01549             yyDay= (yypvt[-0].Number)%100;
01550             yyMonth= (yypvt[-0].Number/100)%100;
01551             yyYear = yypvt[-0].Number/10000;
01552         }
01553         else {
01554             yyHaveTime++;
01555             if (yypvt[-0].Number < 100) {
01556             yyHour = yypvt[-0].Number;
01557             yyMinutes = 0;
01558             }
01559             else {
01560                 yyHour = yypvt[-0].Number / 100;
01561                 yyMinutes = yypvt[-0].Number % 100;
01562             }
01563             yySeconds = 0;
01564             yyMeridian = MER24;
01565             }
01566         }
01567     } break;
01568 case 40:
01569 {
01570         yyval.Meridian = MER24;
01571     } break;
01572 case 41:
01573 {
01574         yyval.Meridian = yypvt[-0].Meridian;
01575     } break;
01576     }
01577     goto yystack;       /* reset registers in driver code */
01578 }

struct tm* gmtime ( )

Referenced by Entries_SetVisited(), FileTimeToUnixTime(), get_date(), now(), and unmodified().

struct tm* localtime ( )

Referenced by Convert(), DSTcorrect(), RelativeDate(), RelativeMonth(), get_date(), and now().

Variable Documentation

DSTMODE DSTmode

Definition at line 408 of file getdate.c.

time_t Day

Definition at line 402 of file getdate.c.

time_t DayNumber

Definition at line 463 of file getdate.c.

time_t DayOrdinal

Definition at line 462 of file getdate.c.

time_t Future

Definition at line 448 of file getdate.c.

time_t Hours

Definition at line 404 of file getdate.c.

MERIDIAN Meridian

Definition at line 407 of file getdate.c.

TABLE const MilitaryTable[] [static]

Initial value:

 {
    { "a",   268 ,  ((time_t)( 1 ) * 60) },
    { "b",   268 ,  ((time_t)( 2 ) * 60) },
    { "c",   268 ,  ((time_t)( 3 ) * 60) },
    { "d",   268 ,  ((time_t)( 4 ) * 60) },
    { "e",   268 ,  ((time_t)( 5 ) * 60) },
    { "f",   268 ,  ((time_t)( 6 ) * 60) },
    { "g",   268 ,  ((time_t)( 7 ) * 60) },
    { "h",   268 ,  ((time_t)( 8 ) * 60) },
    { "i",   268 ,  ((time_t)( 9 ) * 60) },
    { "k",   268 ,  ((time_t)( 10 ) * 60) },
    { "l",   268 ,  ((time_t)( 11 ) * 60) },
    { "m",   268 ,  ((time_t)( 12 ) * 60) },
    { "n",   268 ,  ((time_t)( - 1 ) * 60) },
    { "o",   268 ,  ((time_t)( - 2 ) * 60) },
    { "p",   268 ,  ((time_t)( - 3 ) * 60) },
    { "q",   268 ,  ((time_t)( - 4 ) * 60) },
    { "r",   268 ,  ((time_t)( - 5 ) * 60) },
    { "s",   268 ,  ((time_t)( - 6 ) * 60) },
    { "t",   268 ,  ((time_t)( - 7 ) * 60) },
    { "u",   268 ,  ((time_t)( - 8 ) * 60) },
    { "v",   268 ,  ((time_t)( - 9 ) * 60) },
    { "w",   268 ,  ((time_t)( -10 ) * 60) },
    { "x",   268 ,  ((time_t)( -11 ) * 60) },
    { "y",   268 ,  ((time_t)( -12 ) * 60) },
    { "z",   268 ,  ((time_t)( 0 ) * 60) },
    { NULL }
}

Definition at line 329 of file getdate.c.

time_t Minutes

Definition at line 405 of file getdate.c.

TABLE const MonthDayTable[] [static]

Initial value:

 {
    { "january",     263 ,  1 },
    { "february",    263 ,  2 },
    { "march",       263 ,  3 },
    { "april",       263 ,  4 },
    { "may",         263 ,  5 },
    { "june",        263 ,  6 },
    { "july",        263 ,  7 },
    { "august",      263 ,  8 },
    { "september",   263 ,  9 },
    { "sept",        263 ,  9 },
    { "october",     263 , 10 },
    { "november",    263 , 11 },
    { "december",    263 , 12 },
    { "sunday",      258 , 0 },
    { "monday",      258 , 1 },
    { "tuesday",     258 , 2 },
    { "tues",        258 , 2 },
    { "wednesday",   258 , 3 },
    { "wednes",      258 , 3 },
    { "thursday",    258 , 4 },
    { "thur",        258 , 4 },
    { "thurs",       258 , 4 },
    { "friday",      258 , 5 },
    { "saturday",    258 , 6 },
    { NULL }
}

Definition at line 175 of file getdate.c.

TABLE const OtherTable[] [static]

Initial value:

 {
    { "tomorrow",    262 ,  1 * 24 * 60 },
    { "yesterday",   262 ,  -1 * 24 * 60 },
    { "today",       262 ,  0 },
    { "now",         262 ,  0 },
    { "last",        267 ,  -1 },
    { "this",        262 ,  0 },
    { "next",        267 ,  2 },
    { "first",       267 ,  1 },

    { "third",       267 ,  3 },
    { "fourth",      267 ,  4 },
    { "fifth",       267 ,  5 },
    { "sixth",       267 ,  6 },
    { "seventh",     267 ,  7 },
    { "eighth",      267 ,  8 },
    { "ninth",       267 ,  9 },
    { "tenth",       267 ,  10 },
    { "eleventh",    267 ,  11 },
    { "twelfth",     267 ,  12 },
    { "ago",         257 ,  1 },
    { NULL }
}

Definition at line 219 of file getdate.c.

char RCS[] = "$CVSid: @(#)getdate.y 1.11 94/09/21 $" [static]

Definition at line 82 of file getdate.c.

time_t RelMonth

Definition at line 479 of file getdate.c.

time_t Seconds

Definition at line 406 of file getdate.c.

TABLE const TimezoneTable[] [static]

Definition at line 245 of file getdate.c.

TABLE const UnitsTable[] [static]

Initial value:

 {
    { "year",        264 ,  12 },
    { "month",       264 ,  1 },
    { "fortnight",   262 ,  14 * 24 * 60 },
    { "week",        262 ,  7 * 24 * 60 },
    { "day",         262 ,  1 * 24 * 60 },
    { "hour",        262 ,  60 },
    { "minute",      262 ,  1 },
    { "min",         262 ,  1 },
    { "second",      265 ,  1 },
    { "sec",         265 ,  1 },
    { NULL }
}

Definition at line 204 of file getdate.c.

time_t Year

Definition at line 403 of file getdate.c.

* b

Definition at line 662 of file getdate.c.

struct timeb* now

Definition at line 684 of file getdate.c.

DSTMODE yyDSTmode [static]

Definition at line 125 of file getdate.c.

time_t yyDay [static]

Definition at line 134 of file getdate.c.

time_t yyDayNumber [static]

Definition at line 127 of file getdate.c.

time_t yyDayOrdinal [static]

Definition at line 126 of file getdate.c.

int yyHaveDate [static]

Definition at line 128 of file getdate.c.

int yyHaveDay [static]

Definition at line 129 of file getdate.c.

int yyHaveRel [static]

Definition at line 130 of file getdate.c.

int yyHaveTime [static]

Definition at line 131 of file getdate.c.

int yyHaveZone [static]

Definition at line 132 of file getdate.c.

time_t yyHour [static]

Definition at line 135 of file getdate.c.

char* yyInput [static]

Definition at line 124 of file getdate.c.

MERIDIAN yyMeridian [static]

Definition at line 140 of file getdate.c.

time_t yyMinutes [static]

Definition at line 136 of file getdate.c.

time_t yyMonth [static]

Definition at line 137 of file getdate.c.

time_t yyRelMonth [static]

Definition at line 141 of file getdate.c.

time_t yyRelSeconds [static]

Definition at line 142 of file getdate.c.

time_t yySeconds [static]

Definition at line 138 of file getdate.c.

time_t yyTimezone [static]

Definition at line 133 of file getdate.c.

time_t yyYear [static]

Definition at line 139 of file getdate.c.

int yyact[]

Initial value:

{

    13,    11,    22,    28,    16,    12,    18,    17,    15,     9,
    10,    38,    39,    20,    48,    44,    47,    46,    36,    43,
    50,    32,    35,    34,    33,    29,    37,    31,    41,    45,
    40,    30,    14,     8,     7,     6,     5,     4,     3,     2,
     1,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,    49,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,    21,     0,     0,    19,    25,    24,    27,
    26,    23,    44,     0,     0,     0,     0,    42 }

Definition at line 789 of file getdate.c.

int yychar

Definition at line 981 of file getdate.c.

int yychk[]

Initial value:

{

 -1000,    -2,    -3,    -4,    -5,    -6,    -7,    -8,    -9,   267,
   268,   259,   263,   258,   -10,   266,   262,   265,   264,   261,
    58,   258,    47,   266,   263,   262,   265,   264,   269,   267,
    44,   257,   262,   265,   264,   267,   267,   266,   266,   267,
    44,    -1,   266,    58,   261,    47,   267,   267,   267,    -1,
   266 }

Definition at line 840 of file getdate.c.

int yydebug

Definition at line 959 of file getdate.c.

int yydef[]

Initial value:

{

     1,    -2,     2,     3,     4,     5,     6,     7,     8,    39,
    14,    15,     0,    17,    29,     0,    32,    35,    38,     9,
     0,    19,     0,     0,    26,    30,    34,    37,    16,    24,
    18,    28,    31,    33,    36,    40,    20,    22,    23,    27,
     0,    10,    11,     0,    41,     0,    25,    40,    21,    12,
    13 }

Definition at line 848 of file getdate.c.

int yyerrflag

Definition at line 980 of file getdate.c.

YYSTYPE yylval

Definition at line 169 of file getdate.c.

int yynerrs

Definition at line 978 of file getdate.c.

int yypact[]

Initial value:

{

 -1000,  -258, -1000, -1000, -1000, -1000, -1000, -1000, -1000,   -45,
  -266, -1000,  -242,   -13,  -230,  -241, -1000, -1000, -1000, -1000,
  -245, -1000,  -249,  -240,  -255, -1000, -1000, -1000, -1000,   -14,
 -1000, -1000, -1000, -1000, -1000,   -39,   -18, -1000, -1000, -1000,
  -250, -1000, -1000,  -251, -1000,  -253, -1000,  -246, -1000, -1000,
 -1000 }

Definition at line 814 of file getdate.c.

int yypgo[]

Initial value:

{

     0,    28,    40,    39,    38,    37,    36,    35,    34,    33,
    32 }

Definition at line 822 of file getdate.c.

int* yyps [static]

Definition at line 973 of file getdate.c.

YYSTYPE* yypv [static]

Definition at line 972 of file getdate.c.

int yyr1[]

Initial value:

{

     0,     2,     2,     3,     3,     3,     3,     3,     3,     4,
     4,     4,     4,     4,     5,     5,     5,     7,     7,     7,
     6,     6,     6,     6,     6,     6,     6,     6,     8,     8,
    10,    10,    10,    10,    10,    10,    10,    10,    10,     9,
     1,     1 }

Definition at line 826 of file getdate.c.

int yyr2[]

Initial value:

{

     0,     0,     4,     3,     3,     3,     3,     3,     2,     5,
     9,     9,    13,    13,     3,     3,     5,     3,     5,     5,
     7,    11,     7,     7,     5,     9,     5,     7,     5,     2,
     5,     5,     3,     5,     5,     3,     5,     5,     3,     3,
     1,     3 }

Definition at line 833 of file getdate.c.

int* yys [static]

Definition at line 970 of file getdate.c.

int yystate [static]

Definition at line 975 of file getdate.c.

int yytmp [static]

Definition at line 976 of file getdate.c.

YYSTYPE* yyv [static]

Definition at line 969 of file getdate.c.

YYSTYPE yyval

Definition at line 169 of file getdate.c.

Generated on Sun Oct 21 12:43:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/getdate.c Source File

cvs-1.10/os2/getdate.c

Go to the documentation of this file.
00001 /* stolen from lib/getdate.c */
00002
00003 #include "config.h"
00004 #include <stdlib.h>
00005 #include <stdio.h>
00006 #include <ctype.h>
00007
00008 /* The code at the top of get_date which figures out the offset of the
00009    current time zone checks various CPP symbols to see if special
00010    tricks are need, but defaults to using the gettimeofday system call.
00011    Include <sys/time.h> if that will be used.  */
00012
00013 #if defined(vms)
00014
00015 #include <types.h>
00016 #include <time.h>
00017
00018 #else
00019
00020 #include <sys/types.h>
00021
00022 #ifdef TIME_WITH_SYS_TIME
00023 #include <sys/time.h>
00024 #include <time.h>
00025 #else
00026 #ifdef HAVE_SYS_TIME_H
00027 #include <sys/time.h>
00028 #else
00029 #include <time.h>
00030 #endif
00031 #endif
00032
00033 #ifdef timezone
00034 #undef timezone /* needed for sgi */
00035 #endif
00036
00037 #if defined(HAVE_SYS_TIMEB_H)
00038 #include <sys/timeb.h>
00039 #else
00040 /*
00041 ** We use the obsolete `struct timeb' as part of our interface!
00042 ** Since the system doesn't have it, we define it here;
00043 ** our callers must do likewise.
00044 */
00045 struct timeb {
00046     time_t      time;       /* Seconds since the epoch  */
00047     unsigned short  millitm;    /* Field not used       */
00048     short       timezone;   /* Minutes west of GMT      */
00049     short       dstflag;    /* Field not used       */
00050 };
00051 #endif /* defined(HAVE_SYS_TIMEB_H) */
00052
00053 #endif  /* defined(vms) */
00054
00055 #if defined (STDC_HEADERS) || defined (USG)
00056 #include <string.h>
00057 #endif
00058
00059 /* Some old versions of bison generate parsers that use bcopy.
00060    That loses on systems that don't provide the function, so we have
00061    to redefine it here.  */
00062 #if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
00063 #define bcopy(from, to, len) memcpy ((to), (from), (len))
00064 #endif
00065
00066 #if defined (STDC_HEADERS)
00067 #include <stdlib.h>
00068 #endif
00069
00070 #if defined (HAVE_ALLOCA_H)
00071 #include <alloca.h>
00072 #endif
00073
00074 extern struct tm    *gmtime();
00075 extern struct tm    *localtime();
00076
00077 #define yyparse getdate_yyparse
00078 #define yylex getdate_yylex
00079 #define yyerror getdate_yyerror
00080
00081 #if !defined(lint) && !defined(SABER)
00082 static char RCS[] = "$CVSid: @(#)getdate.y 1.11 94/09/21 $";
00083 #endif  /* !defined(lint) && !defined(SABER) */
00084
00085 static int yylex ();
00086 static int yyerror ();
00087
00088 #define EPOCH       1970
00089 #define HOUR(x)     ((time_t)(x) * 60)
00090 #define SECSPERDAY  (24L * 60L * 60L)
00091
00092
00093 /*
00094 **  An entry in the lexical lookup table.
00095 */
00096 typedef struct _TABLE {
00097     char    *name;
00098     int     type;
00099     time_t  value;
00100 } TABLE;
00101
00102
00103 /*
00104 **  Daylight-savings mode:  on, off, or not yet known.
00105 */
00106 typedef enum _DSTMODE {
00107     DSTon, DSToff, DSTmaybe
00108 } DSTMODE;
00109
00110 /*
00111 **  Meridian:  am, pm, or 24-hour style.
00112 */
00113 typedef enum _MERIDIAN {
00114     MERam, MERpm, MER24
00115 } MERIDIAN;
00116
00117
00118 /*
00119 **  Global variables.  We could get rid of most of these by using a good
00120 **  union as the yacc stack.  (This routine was originally written before
00121 **  yacc had the %union construct.)  Maybe someday; right now we only use
00122 **  the %union very rarely.
00123 */
00124 static char *yyInput;
00125 static DSTMODE  yyDSTmode;
00126 static time_t   yyDayOrdinal;
00127 static time_t   yyDayNumber;
00128 static int  yyHaveDate;
00129 static int  yyHaveDay;
00130 static int  yyHaveRel;
00131 static int  yyHaveTime;
00132 static int  yyHaveZone;
00133 static time_t   yyTimezone;
00134 static time_t   yyDay;
00135 static time_t   yyHour;
00136 static time_t   yyMinutes;
00137 static time_t   yyMonth;
00138 static time_t   yySeconds;
00139 static time_t   yyYear;
00140 static MERIDIAN yyMeridian;
00141 static time_t   yyRelMonth;
00142 static time_t   yyRelSeconds;
00143
00144
00145 typedef union  {
00146     time_t      Number;
00147     enum _MERIDIAN  Meridian;
00148 } YYSTYPE;
00149 # define tAGO 257
00150 # define tDAY 258
00151 # define tDAYZONE 259
00152 # define tID 260
00153 # define tMERIDIAN 261
00154 # define tMINUTE_UNIT 262
00155 # define tMONTH 263
00156 # define tMONTH_UNIT 264
00157 # define tSEC_UNIT 265
00158 # define tSNUMBER 266
00159 # define tUNUMBER 267
00160 # define tZONE 268
00161 # define tDST 269
00162 #define yyclearin yychar = -1
00163 #define yyerrok yyerrflag = 0
00164 extern int yychar;
00165 extern int yyerrflag;
00166 #ifndef YYMAXDEPTH
00167 #define YYMAXDEPTH 150
00168 #endif
00169 YYSTYPE yylval, yyval;
00170 # define YYERRCODE 256
00171
00172
00173
00174 /* Month and day table. */
00175 static TABLE const MonthDayTable[] = {
00176     { "january",    tMONTH,  1 },
00177     { "february",   tMONTH,  2 },
00178     { "march",      tMONTH,  3 },
00179     { "april",      tMONTH,  4 },
00180     { "may",        tMONTH,  5 },
00181     { "june",       tMONTH,  6 },
00182     { "july",       tMONTH,  7 },
00183     { "august",     tMONTH,  8 },
00184     { "september",  tMONTH,  9 },
00185     { "sept",       tMONTH,  9 },
00186     { "october",    tMONTH, 10 },
00187     { "november",   tMONTH, 11 },
00188     { "december",   tMONTH, 12 },
00189     { "sunday",     tDAY, 0 },
00190     { "monday",     tDAY, 1 },
00191     { "tuesday",    tDAY, 2 },
00192     { "tues",       tDAY, 2 },
00193     { "wednesday",  tDAY, 3 },
00194     { "wednes",     tDAY, 3 },
00195     { "thursday",   tDAY, 4 },
00196     { "thur",       tDAY, 4 },
00197     { "thurs",      tDAY, 4 },
00198     { "friday",     tDAY, 5 },
00199     { "saturday",   tDAY, 6 },
00200     { NULL }
00201 };
00202
00203 /* Time units table. */
00204 static TABLE const UnitsTable[] = {
00205     { "year",       tMONTH_UNIT,    12 },
00206     { "month",      tMONTH_UNIT,    1 },
00207     { "fortnight",  tMINUTE_UNIT,   14 * 24 * 60 },
00208     { "week",       tMINUTE_UNIT,   7 * 24 * 60 },
00209     { "day",        tMINUTE_UNIT,   1 * 24 * 60 },
00210     { "hour",       tMINUTE_UNIT,   60 },
00211     { "minute",     tMINUTE_UNIT,   1 },
00212     { "min",        tMINUTE_UNIT,   1 },
00213     { "second",     tSEC_UNIT,  1 },
00214     { "sec",        tSEC_UNIT,  1 },
00215     { NULL }
00216 };
00217
00218 /* Assorted relative-time words. */
00219 static TABLE const OtherTable[] = {
00220     { "tomorrow",   tMINUTE_UNIT,   1 * 24 * 60 },
00221     { "yesterday",  tMINUTE_UNIT,   -1 * 24 * 60 },
00222     { "today",      tMINUTE_UNIT,   0 },
00223     { "now",        tMINUTE_UNIT,   0 },
00224     { "last",       tUNUMBER,   -1 },
00225     { "this",       tMINUTE_UNIT,   0 },
00226     { "next",       tUNUMBER,   2 },
00227     { "first",      tUNUMBER,   1 },
00228 /*  { "second",     tUNUMBER,   2 }, */
00229     { "third",      tUNUMBER,   3 },
00230     { "fourth",     tUNUMBER,   4 },
00231     { "fifth",      tUNUMBER,   5 },
00232     { "sixth",      tUNUMBER,   6 },
00233     { "seventh",    tUNUMBER,   7 },
00234     { "eighth",     tUNUMBER,   8 },
00235     { "ninth",      tUNUMBER,   9 },
00236     { "tenth",      tUNUMBER,   10 },
00237     { "eleventh",   tUNUMBER,   11 },
00238     { "twelfth",    tUNUMBER,   12 },
00239     { "ago",        tAGO,   1 },
00240     { NULL }
00241 };
00242
00243 /* The timezone table. */
00244 /* Some of these are commented out because a time_t can't store a float. */
00245 static TABLE const TimezoneTable[] = {
00246     { "gmt",    tZONE,     HOUR( 0) },  /* Greenwich Mean */
00247     { "ut", tZONE,     HOUR( 0) },  /* Universal (Coordinated) */
00248     { "utc",    tZONE,     HOUR( 0) },
00249     { "wet",    tZONE,     HOUR( 0) },  /* Western European */
00250     { "bst",    tDAYZONE,  HOUR( 0) },  /* British Summer */
00251     { "wat",    tZONE,     HOUR( 1) },  /* West Africa */
00252     { "at", tZONE,     HOUR( 2) },  /* Azores */
00253 #if 0
00254     /* For completeness.  BST is also British Summer, and GST is
00255      * also Guam Standard. */
00256     { "bst",    tZONE,     HOUR( 3) },  /* Brazil Standard */
00257     { "gst",    tZONE,     HOUR( 3) },  /* Greenland Standard */
00258 #endif
00259 #if 0
00260     { "nft",    tZONE,     HOUR(3.5) }, /* Newfoundland */
00261     { "nst",    tZONE,     HOUR(3.5) }, /* Newfoundland Standard */
00262     { "ndt",    tDAYZONE,  HOUR(3.5) }, /* Newfoundland Daylight */
00263 #endif
00264     { "ast",    tZONE,     HOUR( 4) },  /* Atlantic Standard */
00265     { "adt",    tDAYZONE,  HOUR( 4) },  /* Atlantic Daylight */
00266     { "est",    tZONE,     HOUR( 5) },  /* Eastern Standard */
00267     { "edt",    tDAYZONE,  HOUR( 5) },  /* Eastern Daylight */
00268     { "cst",    tZONE,     HOUR( 6) },  /* Central Standard */
00269     { "cdt",    tDAYZONE,  HOUR( 6) },  /* Central Daylight */
00270     { "mst",    tZONE,     HOUR( 7) },  /* Mountain Standard */
00271     { "mdt",    tDAYZONE,  HOUR( 7) },  /* Mountain Daylight */
00272     { "pst",    tZONE,     HOUR( 8) },  /* Pacific Standard */
00273     { "pdt",    tDAYZONE,  HOUR( 8) },  /* Pacific Daylight */
00274     { "yst",    tZONE,     HOUR( 9) },  /* Yukon Standard */
00275     { "ydt",    tDAYZONE,  HOUR( 9) },  /* Yukon Daylight */
00276     { "hst",    tZONE,     HOUR(10) },  /* Hawaii Standard */
00277     { "hdt",    tDAYZONE,  HOUR(10) },  /* Hawaii Daylight */
00278     { "cat",    tZONE,     HOUR(10) },  /* Central Alaska */
00279     { "ahst",   tZONE,     HOUR(10) },  /* Alaska-Hawaii Standard */
00280     { "nt", tZONE,     HOUR(11) },  /* Nome */
00281     { "idlw",   tZONE,     HOUR(12) },  /* International Date Line West */
00282     { "cet",    tZONE,     -HOUR(1) },  /* Central European */
00283     { "met",    tZONE,     -HOUR(1) },  /* Middle European */
00284     { "mewt",   tZONE,     -HOUR(1) },  /* Middle European Winter */
00285     { "mest",   tDAYZONE,  -HOUR(1) },  /* Middle European Summer */
00286     { "swt",    tZONE,     -HOUR(1) },  /* Swedish Winter */
00287     { "sst",    tDAYZONE,  -HOUR(1) },  /* Swedish Summer */
00288     { "fwt",    tZONE,     -HOUR(1) },  /* French Winter */
00289     { "fst",    tDAYZONE,  -HOUR(1) },  /* French Summer */
00290     { "eet",    tZONE,     -HOUR(2) },  /* Eastern Europe, USSR Zone 1 */
00291     { "bt", tZONE,     -HOUR(3) },  /* Baghdad, USSR Zone 2 */
00292 #if 0
00293     { "it", tZONE,     -HOUR(3.5) },/* Iran */
00294 #endif
00295     { "zp4",    tZONE,     -HOUR(4) },  /* USSR Zone 3 */
00296     { "zp5",    tZONE,     -HOUR(5) },  /* USSR Zone 4 */
00297 #if 0
00298     { "ist",    tZONE,     -HOUR(5.5) },/* Indian Standard */
00299 #endif
00300     { "zp6",    tZONE,     -HOUR(6) },  /* USSR Zone 5 */
00301 #if 0
00302     /* For completeness.  NST is also Newfoundland Stanard, and SST is
00303      * also Swedish Summer. */
00304     { "nst",    tZONE,     -HOUR(6.5) },/* North Sumatra */
00305     { "sst",    tZONE,     -HOUR(7) },  /* South Sumatra, USSR Zone 6 */
00306 #endif  /* 0 */
00307     { "wast",   tZONE,     -HOUR(7) },  /* West Australian Standard */
00308     { "wadt",   tDAYZONE,  -HOUR(7) },  /* West Australian Daylight */
00309 #if 0
00310     { "jt", tZONE,     -HOUR(7.5) },/* Java (3pm in Cronusland!) */
00311 #endif
00312     { "cct",    tZONE,     -HOUR(8) },  /* China Coast, USSR Zone 7 */
00313     { "jst",    tZONE,     -HOUR(9) },  /* Japan Standard, USSR Zone 8 */
00314 #if 0
00315     { "cast",   tZONE,     -HOUR(9.5) },/* Central Australian Standard */
00316     { "cadt",   tDAYZONE,  -HOUR(9.5) },/* Central Australian Daylight */
00317 #endif
00318     { "east",   tZONE,     -HOUR(10) }, /* Eastern Australian Standard */
00319     { "eadt",   tDAYZONE,  -HOUR(10) }, /* Eastern Australian Daylight */
00320     { "gst",    tZONE,     -HOUR(10) }, /* Guam Standard, USSR Zone 9 */
00321     { "nzt",    tZONE,     -HOUR(12) }, /* New Zealand */
00322     { "nzst",   tZONE,     -HOUR(12) }, /* New Zealand Standard */
00323     { "nzdt",   tDAYZONE,  -HOUR(12) }, /* New Zealand Daylight */
00324     { "idle",   tZONE,     -HOUR(12) }, /* International Date Line East */
00325     {  NULL  }
00326 };
00327
00328 /* Military timezone table. */
00329 static TABLE const MilitaryTable[] = {
00330     { "a",  tZONE,  HOUR(  1) },
00331     { "b",  tZONE,  HOUR(  2) },
00332     { "c",  tZONE,  HOUR(  3) },
00333     { "d",  tZONE,  HOUR(  4) },
00334     { "e",  tZONE,  HOUR(  5) },
00335     { "f",  tZONE,  HOUR(  6) },
00336     { "g",  tZONE,  HOUR(  7) },
00337     { "h",  tZONE,  HOUR(  8) },
00338     { "i",  tZONE,  HOUR(  9) },
00339     { "k",  tZONE,  HOUR( 10) },
00340     { "l",  tZONE,  HOUR( 11) },
00341     { "m",  tZONE,  HOUR( 12) },
00342     { "n",  tZONE,  HOUR(- 1) },
00343     { "o",  tZONE,  HOUR(- 2) },
00344     { "p",  tZONE,  HOUR(- 3) },
00345     { "q",  tZONE,  HOUR(- 4) },
00346     { "r",  tZONE,  HOUR(- 5) },
00347     { "s",  tZONE,  HOUR(- 6) },
00348     { "t",  tZONE,  HOUR(- 7) },
00349     { "u",  tZONE,  HOUR(- 8) },
00350     { "v",  tZONE,  HOUR(- 9) },
00351     { "w",  tZONE,  HOUR(-10) },
00352     { "x",  tZONE,  HOUR(-11) },
00353     { "y",  tZONE,  HOUR(-12) },
00354     { "z",  tZONE,  HOUR(  0) },
00355     { NULL }
00356 };
00357
00358
00359
00360
00361 /* ARGSUSED */
00362 static int
00363 yyerror(s)
00364     char    *s;
00365 {
00366   return 0;
00367 }
00368
00369
00370 static time_t
00371 ToSeconds(Hours, Minutes, Seconds, Meridian)
00372     time_t  Hours;
00373     time_t  Minutes;
00374     time_t  Seconds;
00375     MERIDIAN    Meridian;
00376 {
00377     if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59)
00378     return -1;
00379     switch (Meridian) {
00380     case MER24:
00381     if (Hours < 0 || Hours > 23)
00382         return -1;
00383     return (Hours * 60L + Minutes) * 60L + Seconds;
00384     case MERam:
00385     if (Hours < 1 || Hours > 12)
00386         return -1;
00387     return (Hours * 60L + Minutes) * 60L + Seconds;
00388     case MERpm:
00389     if (Hours < 1 || Hours > 12)
00390         return -1;
00391     return ((Hours + 12) * 60L + Minutes) * 60L + Seconds;
00392     default:
00393     abort ();
00394     }
00395     /* NOTREACHED */
00396 }
00397
00398
00399 static time_t
00400 Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
00401     time_t  Month;
00402     time_t  Day;
00403     time_t  Year;
00404     time_t  Hours;
00405     time_t  Minutes;
00406     time_t  Seconds;
00407     MERIDIAN    Meridian;
00408     DSTMODE DSTmode;
00409 {
00410     static int DaysInMonth[12] = {
00411     31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
00412     };
00413     time_t  tod;
00414     time_t  Julian;
00415     int     i;
00416
00417     if (Year < 0)
00418     Year = -Year;
00419     if (Year < 100)
00420     Year += 1900;
00421     DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
00422             ? 29 : 28;
00423     if (Year < EPOCH || Year > 1999
00424      || Month < 1 || Month > 12
00425      /* Lint fluff:  "conversion from long may lose accuracy" */
00426      || Day < 1 || Day > DaysInMonth[(int)--Month])
00427     return -1;
00428
00429     for (Julian = Day - 1, i = 0; i < Month; i++)
00430     Julian += DaysInMonth[i];
00431     for (i = EPOCH; i < Year; i++)
00432     Julian += 365 + (i % 4 == 0);
00433     Julian *= SECSPERDAY;
00434     Julian += yyTimezone * 60L;
00435     if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
00436     return -1;
00437     Julian += tod;
00438     if (DSTmode == DSTon
00439      || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
00440     Julian -= 60 * 60;
00441     return Julian;
00442 }
00443
00444
00445 static time_t
00446 DSTcorrect(Start, Future)
00447     time_t  Start;
00448     time_t  Future;
00449 {
00450     time_t  StartDay;
00451     time_t  FutureDay;
00452
00453     StartDay = (localtime(&Start)->tm_hour + 1) % 24;
00454     FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
00455     return (Future - Start) + (StartDay - FutureDay) * 60L * 60L;
00456 }
00457
00458
00459 static time_t
00460 RelativeDate(Start, DayOrdinal, DayNumber)
00461     time_t  Start;
00462     time_t  DayOrdinal;
00463     time_t  DayNumber;
00464 {
00465     struct tm   *tm;
00466     time_t  now;
00467
00468     now = Start;
00469     tm = localtime(&now);
00470     now += SECSPERDAY * ((DayNumber - tm->tm_wday + 7) % 7);
00471     now += 7 * SECSPERDAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
00472     return DSTcorrect(Start, now);
00473 }
00474
00475
00476 static time_t
00477 RelativeMonth(Start, RelMonth)
00478     time_t  Start;
00479     time_t  RelMonth;
00480 {
00481     struct tm   *tm;
00482     time_t  Month;
00483     time_t  Year;
00484
00485     if (RelMonth == 0)
00486     return 0;
00487     tm = localtime(&Start);
00488     Month = 12 * tm->tm_year + tm->tm_mon + RelMonth;
00489     Year = Month / 12;
00490     Month = Month % 12 + 1;
00491     return DSTcorrect(Start,
00492         Convert(Month, (time_t)tm->tm_mday, Year,
00493         (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
00494         MER24, DSTmaybe));
00495 }
00496
00497
00498 static int
00499 LookupWord(buff)
00500     char        *buff;
00501 {
00502     register char   *p;
00503     register char   *q;
00504     register const TABLE    *tp;
00505     int         i;
00506     int         abbrev;
00507
00508     /* Make it lowercase. */
00509     for (p = buff; *p; p++)
00510     if (isupper(*p))
00511         *p = tolower(*p);
00512
00513     if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
00514     yylval.Meridian = MERam;
00515     return tMERIDIAN;
00516     }
00517     if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
00518     yylval.Meridian = MERpm;
00519     return tMERIDIAN;
00520     }
00521
00522     /* See if we have an abbreviation for a month. */
00523     if (strlen(buff) == 3)
00524     abbrev = 1;
00525     else if (strlen(buff) == 4 && buff[3] == '.') {
00526     abbrev = 1;
00527     buff[3] = '\0';
00528     }
00529     else
00530     abbrev = 0;
00531
00532     for (tp = MonthDayTable; tp->name; tp++) {
00533     if (abbrev) {
00534         if (strncmp(buff, tp->name, 3) == 0) {
00535         yylval.Number = tp->value;
00536         return tp->type;
00537         }
00538     }
00539     else if (strcmp(buff, tp->name) == 0) {
00540         yylval.Number = tp->value;
00541         return tp->type;
00542     }
00543     }
00544
00545     for (tp = TimezoneTable; tp->name; tp++)
00546     if (strcmp(buff, tp->name) == 0) {
00547         yylval.Number = tp->value;
00548         return tp->type;
00549     }
00550
00551     if (strcmp(buff, "dst") == 0)
00552     return tDST;
00553
00554     for (tp = UnitsTable; tp->name; tp++)
00555     if (strcmp(buff, tp->name) == 0) {
00556         yylval.Number = tp->value;
00557         return tp->type;
00558     }
00559
00560     /* Strip off any plural and try the units table again. */
00561     i = strlen(buff) - 1;
00562     if (buff[i] == 's') {
00563     buff[i] = '\0';
00564     for (tp = UnitsTable; tp->name; tp++)
00565         if (strcmp(buff, tp->name) == 0) {
00566         yylval.Number = tp->value;
00567         return tp->type;
00568         }
00569     buff[i] = 's';      /* Put back for "this" in OtherTable. */
00570     }
00571
00572     for (tp = OtherTable; tp->name; tp++)
00573     if (strcmp(buff, tp->name) == 0) {
00574         yylval.Number = tp->value;
00575         return tp->type;
00576     }
00577
00578     /* Military timezones. */
00579     if (buff[1] == '\0' && isalpha(*buff)) {
00580     for (tp = MilitaryTable; tp->name; tp++)
00581         if (strcmp(buff, tp->name) == 0) {
00582         yylval.Number = tp->value;
00583         return tp->type;
00584         }
00585     }
00586
00587     /* Drop out any periods and try the timezone table again. */
00588     for (i = 0, p = q = buff; *q; q++)
00589     if (*q != '.')
00590         *p++ = *q;
00591     else
00592         i++;
00593     *p = '\0';
00594     if (i)
00595     for (tp = TimezoneTable; tp->name; tp++)
00596         if (strcmp(buff, tp->name) == 0) {
00597         yylval.Number = tp->value;
00598         return tp->type;
00599         }
00600
00601     return tID;
00602 }
00603
00604
00605 static int
00606 yylex()
00607 {
00608     register char   c;
00609     register char   *p;
00610     char        buff[20];
00611     int         Count;
00612     int         sign;
00613
00614     for ( ; ; ) {
00615     while (isspace(*yyInput))
00616         yyInput++;
00617
00618     if (isdigit(c = *yyInput) || c == '-' || c == '+') {
00619         if (c == '-' || c == '+') {
00620         sign = c == '-' ? -1 : 1;
00621         if (!isdigit(*++yyInput))
00622             /* skip the '-' sign */
00623             continue;
00624         }
00625         else
00626         sign = 0;
00627         for (yylval.Number = 0; isdigit(c = *yyInput++); )
00628         yylval.Number = 10 * yylval.Number + c - '0';
00629         yyInput--;
00630         if (sign < 0)
00631         yylval.Number = -yylval.Number;
00632         return sign ? tSNUMBER : tUNUMBER;
00633     }
00634     if (isalpha(c)) {
00635         for (p = buff; isalpha(c = *yyInput++) || c == '.'; )
00636         if (p < &buff[sizeof buff - 1])
00637             *p++ = c;
00638         *p = '\0';
00639         yyInput--;
00640         return LookupWord(buff);
00641     }
00642     if (c != '(')
00643         return *yyInput++;
00644     Count = 0;
00645     do {
00646         c = *yyInput++;
00647         if (c == '\0')
00648         return c;
00649         if (c == '(')
00650         Count++;
00651         else if (c == ')')
00652         Count--;
00653     } while (Count > 0);
00654     }
00655 }
00656
00657 #define TM_YEAR_ORIGIN 1900
00658
00659 /* Yield A - B, measured in seconds.  */
00660 static long
00661 difftm (a, b)
00662      struct tm *a, *b;
00663 {
00664   int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
00665   int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
00666   int days = (
00667           /* difference in day of year */
00668           a->tm_yday - b->tm_yday
00669           /* + intervening leap days */
00670           +  ((ay >> 2) - (by >> 2))
00671           -  (ay/100 - by/100)
00672           +  ((ay/100 >> 2) - (by/100 >> 2))
00673           /* + difference in years * 365 */
00674           +  (long)(ay-by) * 365
00675           );
00676   return (60*(60*(24*days + (a->tm_hour - b->tm_hour))
00677           + (a->tm_min - b->tm_min))
00678       + (a->tm_sec - b->tm_sec));
00679 }
00680
00681 time_t
00682 get_date(p, now)
00683     char        *p;
00684     struct timeb    *now;
00685 {
00686     struct tm       *tm, gmt;
00687     struct timeb    ftz;
00688     time_t      Start;
00689     time_t      tod;
00690
00691     yyInput = p;
00692     if (now == NULL) {
00693         now = &ftz;
00694     (void)time(&ftz.time);
00695
00696     if (! (tm = gmtime (&ftz.time)))
00697         return -1;
00698     gmt = *tm;  /* Make a copy, in case localtime modifies *tm.  */
00699
00700     if (! (tm = localtime (&ftz.time)))
00701         return -1;
00702
00703     ftz.timezone = difftm (&gmt, tm) / 60;
00704     if(tm->tm_isdst)
00705         ftz.timezone += 60;
00706     }
00707
00708     tm = localtime(&now->time);
00709     yyYear = tm->tm_year;
00710     yyMonth = tm->tm_mon + 1;
00711     yyDay = tm->tm_mday;
00712     yyTimezone = now->timezone;
00713     yyDSTmode = DSTmaybe;
00714     yyHour = 0;
00715     yyMinutes = 0;
00716     yySeconds = 0;
00717     yyMeridian = MER24;
00718     yyRelSeconds = 0;
00719     yyRelMonth = 0;
00720     yyHaveDate = 0;
00721     yyHaveDay = 0;
00722     yyHaveRel = 0;
00723     yyHaveTime = 0;
00724     yyHaveZone = 0;
00725
00726     if (yyparse()
00727      || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
00728     return -1;
00729
00730     if (yyHaveDate || yyHaveTime || yyHaveDay) {
00731     Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
00732             yyMeridian, yyDSTmode);
00733     if (Start < 0)
00734         return -1;
00735     }
00736     else {
00737     Start = now->time;
00738     if (!yyHaveRel)
00739         Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) + tm->tm_sec;
00740     }
00741
00742     Start += yyRelSeconds;
00743     Start += RelativeMonth(Start, yyRelMonth);
00744
00745     if (yyHaveDay && !yyHaveDate) {
00746     tod = RelativeDate(Start, yyDayOrdinal, yyDayNumber);
00747     Start += tod;
00748     }
00749
00750     /* Have to do *something* with a legitimate -1 so it's distinguishable
00751      * from the error return value.  (Alternately could set errno on error.) */
00752     return Start == -1 ? 0 : Start;
00753 }
00754
00755
00756 #if defined(TEST)
00757
00758 /* ARGSUSED */
00759 int
00760 main(ac, av)
00761     int     ac;
00762     char    *av[];
00763 {
00764     char    buff[128];
00765     time_t  d;
00766
00767     (void)printf("Enter date, or blank line to exit.\n\t> ");
00768     (void)fflush(stdout);
00769     while (gets(buff) && buff[0]) {
00770     d = get_date(buff, (struct timeb *)NULL);
00771     if (d == -1)
00772         (void)printf("Bad format - couldn't convert.\n");
00773     else
00774         (void)printf("%s", ctime(&d));
00775     (void)printf("\t> ");
00776     (void)fflush(stdout);
00777     }
00778     exit(0);
00779     /* NOTREACHED */
00780 }
00781 #endif  /* defined(TEST) */
00782 int yyexca[] ={
00783 -1, 1,
00784     0, -1,
00785     -2, 0,
00786     };
00787 # define YYNPROD 42
00788 # define YYLAST 228
00789 int yyact[]={
00790
00791     13,    11,    22,    28,    16,    12,    18,    17,    15,     9,
00792     10,    38,    39,    20,    48,    44,    47,    46,    36,    43,
00793     50,    32,    35,    34,    33,    29,    37,    31,    41,    45,
00794     40,    30,    14,     8,     7,     6,     5,     4,     3,     2,
00795      1,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00796      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00797      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00798      0,     0,     0,     0,     0,     0,    49,     0,     0,     0,
00799      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00800      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00801      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00802      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00803      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00804      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00805      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00806      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00807      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00808      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00809      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00810      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00811      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00812      0,     0,     0,    21,     0,     0,    19,    25,    24,    27,
00813     26,    23,    44,     0,     0,     0,     0,    42 };
00814 int yypact[]={
00815
00816  -1000,  -258, -1000, -1000, -1000, -1000, -1000, -1000, -1000,   -45,
00817   -266, -1000,  -242,   -13,  -230,  -241, -1000, -1000, -1000, -1000,
00818   -245, -1000,  -249,  -240,  -255, -1000, -1000, -1000, -1000,   -14,
00819  -1000, -1000, -1000, -1000, -1000,   -39,   -18, -1000, -1000, -1000,
00820   -250, -1000, -1000,  -251, -1000,  -253, -1000,  -246, -1000, -1000,
00821  -1000 };
00822 int yypgo[]={
00823
00824      0,    28,    40,    39,    38,    37,    36,    35,    34,    33,
00825     32 };
00826 int yyr1[]={
00827
00828      0,     2,     2,     3,     3,     3,     3,     3,     3,     4,
00829      4,     4,     4,     4,     5,     5,     5,     7,     7,     7,
00830      6,     6,     6,     6,     6,     6,     6,     6,     8,     8,
00831     10,    10,    10,    10,    10,    10,    10,    10,    10,     9,
00832      1,     1 };
00833 int yyr2[]={
00834
00835      0,     0,     4,     3,     3,     3,     3,     3,     2,     5,
00836      9,     9,    13,    13,     3,     3,     5,     3,     5,     5,
00837      7,    11,     7,     7,     5,     9,     5,     7,     5,     2,
00838      5,     5,     3,     5,     5,     3,     5,     5,     3,     3,
00839      1,     3 };
00840 int yychk[]={
00841
00842  -1000,    -2,    -3,    -4,    -5,    -6,    -7,    -8,    -9,   267,
00843    268,   259,   263,   258,   -10,   266,   262,   265,   264,   261,
00844     58,   258,    47,   266,   263,   262,   265,   264,   269,   267,
00845     44,   257,   262,   265,   264,   267,   267,   266,   266,   267,
00846     44,    -1,   266,    58,   261,    47,   267,   267,   267,    -1,
00847    266 };
00848 int yydef[]={
00849
00850      1,    -2,     2,     3,     4,     5,     6,     7,     8,    39,
00851     14,    15,     0,    17,    29,     0,    32,    35,    38,     9,
00852      0,    19,     0,     0,    26,    30,    34,    37,    16,    24,
00853     18,    28,    31,    33,    36,    40,    20,    22,    23,    27,
00854      0,    10,    11,     0,    41,     0,    25,    40,    21,    12,
00855     13 };
00856 typedef struct { char *t_name; int t_val; } yytoktype;
00857 #ifndef YYDEBUG
00858 #   define YYDEBUG  0   /* don't allow debugging */
00859 #endif
00860
00861 #if YYDEBUG
00862
00863 yytoktype yytoks[] =
00864 {
00865     "tAGO", 257,
00866     "tDAY", 258,
00867     "tDAYZONE", 259,
00868     "tID",  260,
00869     "tMERIDIAN",    261,
00870     "tMINUTE_UNIT", 262,
00871     "tMONTH",   263,
00872     "tMONTH_UNIT",  264,
00873     "tSEC_UNIT",    265,
00874     "tSNUMBER", 266,
00875     "tUNUMBER", 267,
00876     "tZONE",    268,
00877     "tDST", 269,
00878     "-unknown-",    -1  /* ends search */
00879 };
00880
00881 char * yyreds[] =
00882 {
00883     "-no such reduction-",
00884     "spec : /* empty */",
00885     "spec : spec item",
00886     "item : time",
00887     "item : zone",
00888     "item : date",
00889     "item : day",
00890     "item : rel",
00891     "item : number",
00892     "time : tUNUMBER tMERIDIAN",
00893     "time : tUNUMBER ':' tUNUMBER o_merid",
00894     "time : tUNUMBER ':' tUNUMBER tSNUMBER",
00895     "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid",
00896     "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER",
00897     "zone : tZONE",
00898     "zone : tDAYZONE",
00899     "zone : tZONE tDST",
00900     "day : tDAY",
00901     "day : tDAY ','",
00902     "day : tUNUMBER tDAY",
00903     "date : tUNUMBER '/' tUNUMBER",
00904     "date : tUNUMBER '/' tUNUMBER '/' tUNUMBER",
00905     "date : tUNUMBER tSNUMBER tSNUMBER",
00906     "date : tUNUMBER tMONTH tSNUMBER",
00907     "date : tMONTH tUNUMBER",
00908     "date : tMONTH tUNUMBER ',' tUNUMBER",
00909     "date : tUNUMBER tMONTH",
00910     "date : tUNUMBER tMONTH tUNUMBER",
00911     "rel : relunit tAGO",
00912     "rel : relunit",
00913     "relunit : tUNUMBER tMINUTE_UNIT",
00914     "relunit : tSNUMBER tMINUTE_UNIT",
00915     "relunit : tMINUTE_UNIT",
00916     "relunit : tSNUMBER tSEC_UNIT",
00917     "relunit : tUNUMBER tSEC_UNIT",
00918     "relunit : tSEC_UNIT",
00919     "relunit : tSNUMBER tMONTH_UNIT",
00920     "relunit : tUNUMBER tMONTH_UNIT",
00921     "relunit : tMONTH_UNIT",
00922     "number : tUNUMBER",
00923     "o_merid : /* empty */",
00924     "o_merid : tMERIDIAN",
00925 };
00926 #endif /* YYDEBUG */
00927 /*  @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10   */
00928
00929 /*
00930 ** Skeleton parser driver for yacc output
00931 */
00932
00933 /*
00934 ** yacc user known macros and defines
00935 */
00936 #define YYERROR     goto yyerrlab
00937 #define YYACCEPT    { free(yys); free(yyv); return(0); }
00938 #define YYABORT     { free(yys); free(yyv); return(1); }
00939 #define YYBACKUP( newtoken, newvalue )\
00940 {\
00941     if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
00942     {\
00943         yyerror( "syntax error - cannot backup" );\
00944         goto yyerrlab;\
00945     }\
00946     yychar = newtoken;\
00947     yystate = *yyps;\
00948     yylval = newvalue;\
00949     goto yynewstate;\
00950 }
00951 #define YYRECOVERING()  (!!yyerrflag)
00952 #ifndef YYDEBUG
00953 #   define YYDEBUG  1   /* make debugging available */
00954 #endif
00955
00956 /*
00957 ** user known globals
00958 */
00959 int yydebug;            /* set to 1 to get debugging */
00960
00961 /*
00962 ** driver internal defines
00963 */
00964 #define YYFLAG      (-1000)
00965
00966 /*
00967 ** static variables used by the parser
00968 */
00969 static YYSTYPE *yyv;            /* value stack */
00970 static int *yys;            /* state stack */
00971
00972 static YYSTYPE *yypv;           /* top of value stack */
00973 static int *yyps;           /* top of state stack */
00974
00975 static int yystate;         /* current state */
00976 static int yytmp;           /* extra var (lasts between blocks) */
00977
00978 int yynerrs;            /* number of errors */
00979
00980 int yyerrflag;          /* error recovery flag */
00981 int yychar;         /* current input token number */
00982
00983
00984 /*
00985 ** yyparse - return 0 if worked, 1 if syntax error not recovered from
00986 */
00987 int
00988 yyparse()
00989 {
00990     register YYSTYPE *yypvt;    /* top of value stack for $vars */
00991     unsigned yymaxdepth = YYMAXDEPTH;
00992
00993     /*
00994     ** Initialize externals - yyparse may be called more than once
00995     */
00996     yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE));
00997     yys = (int*)malloc(yymaxdepth*sizeof(int));
00998     if (!yyv || !yys)
00999     {
01000         yyerror( "out of memory" );
01001         return(1);
01002     }
01003     yypv = &yyv[-1];
01004     yyps = &yys[-1];
01005     yystate = 0;
01006     yytmp = 0;
01007     yynerrs = 0;
01008     yyerrflag = 0;
01009     yychar = -1;
01010
01011     goto yystack;
01012     {
01013         register YYSTYPE *yy_pv;    /* top of value stack */
01014         register int *yy_ps;        /* top of state stack */
01015         register int yy_state;      /* current state */
01016         register int  yy_n;     /* internal state number info */
01017
01018         /*
01019         ** get globals into registers.
01020         ** branch to here only if YYBACKUP was called.
01021         */
01022     yynewstate:
01023         yy_pv = yypv;
01024         yy_ps = yyps;
01025         yy_state = yystate;
01026         goto yy_newstate;
01027
01028         /*
01029         ** get globals into registers.
01030         ** either we just started, or we just finished a reduction
01031         */
01032     yystack:
01033         yy_pv = yypv;
01034         yy_ps = yyps;
01035         yy_state = yystate;
01036
01037         /*
01038         ** top of for (;;) loop while no reductions done
01039         */
01040     yy_stack:
01041         /*
01042         ** put a state and value onto the stacks
01043         */
01044 #if YYDEBUG
01045         /*
01046         ** if debugging, look up token value in list of value vs.
01047         ** name pairs.  0 and negative (-1) are special values.
01048         ** Note: linear search is used since time is not a real
01049         ** consideration while debugging.
01050         */
01051         if ( yydebug )
01052         {
01053             register int yy_i;
01054
01055             (void)printf( "State %d, token ", yy_state );
01056             if ( yychar == 0 )
01057                 (void)printf( "end-of-file\n" );
01058             else if ( yychar < 0 )
01059                 (void)printf( "-none-\n" );
01060             else
01061             {
01062                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
01063                     yy_i++ )
01064                 {
01065                     if ( yytoks[yy_i].t_val == yychar )
01066                         break;
01067                 }
01068                 (void)printf( "%s\n", yytoks[yy_i].t_name );
01069             }
01070         }
01071 #endif /* YYDEBUG */
01072         if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
01073         {
01074             /*
01075             ** reallocate and recover.  Note that pointers
01076             ** have to be reset, or bad things will happen
01077             */
01078             int yyps_index = (yy_ps - yys);
01079             int yypv_index = (yy_pv - yyv);
01080             int yypvt_index = (yypvt - yyv);
01081             yymaxdepth += YYMAXDEPTH;
01082             yyv = (YYSTYPE*)realloc((char*)yyv,
01083                 yymaxdepth * sizeof(YYSTYPE));
01084             yys = (int*)realloc((char*)yys,
01085                 yymaxdepth * sizeof(int));
01086             if (!yyv || !yys)
01087             {
01088                 yyerror( "yacc stack overflow" );
01089                 return(1);
01090             }
01091             yy_ps = yys + yyps_index;
01092             yy_pv = yyv + yypv_index;
01093             yypvt = yyv + yypvt_index;
01094         }
01095         *yy_ps = yy_state;
01096         *++yy_pv = yyval;
01097
01098         /*
01099         ** we have a new state - find out what to do
01100         */
01101     yy_newstate:
01102         if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
01103             goto yydefault;     /* simple state */
01104 #if YYDEBUG
01105         /*
01106         ** if debugging, need to mark whether new token grabbed
01107         */
01108         yytmp = yychar < 0;
01109 #endif
01110         if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
01111             yychar = 0;     /* reached EOF */
01112 #if YYDEBUG
01113         if ( yydebug && yytmp )
01114         {
01115             register int yy_i;
01116
01117             (void)printf( "Received token " );
01118             if ( yychar == 0 )
01119                 (void)printf( "end-of-file\n" );
01120             else if ( yychar < 0 )
01121                 (void)printf( "-none-\n" );
01122             else
01123             {
01124                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
01125                     yy_i++ )
01126                 {
01127                     if ( yytoks[yy_i].t_val == yychar )
01128                         break;
01129                 }
01130                 (void)printf( "%s\n", yytoks[yy_i].t_name );
01131             }
01132         }
01133 #endif /* YYDEBUG */
01134         if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
01135             goto yydefault;
01136         if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )  /*valid shift*/
01137         {
01138             yychar = -1;
01139             yyval = yylval;
01140             yy_state = yy_n;
01141             if ( yyerrflag > 0 )
01142                 yyerrflag--;
01143             goto yy_stack;
01144         }
01145
01146     yydefault:
01147         if ( ( yy_n = yydef[ yy_state ] ) == -2 )
01148         {
01149 #if YYDEBUG
01150             yytmp = yychar < 0;
01151 #endif
01152             if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
01153                 yychar = 0;     /* reached EOF */
01154 #if YYDEBUG
01155             if ( yydebug && yytmp )
01156             {
01157                 register int yy_i;
01158
01159                 (void)printf( "Received token " );
01160                 if ( yychar == 0 )
01161                     (void)printf( "end-of-file\n" );
01162                 else if ( yychar < 0 )
01163                     (void)printf( "-none-\n" );
01164                 else
01165                 {
01166                     for ( yy_i = 0;
01167                         yytoks[yy_i].t_val >= 0;
01168                         yy_i++ )
01169                     {
01170                         if ( yytoks[yy_i].t_val
01171                             == yychar )
01172                         {
01173                             break;
01174                         }
01175                     }
01176                     (void)printf( "%s\n", yytoks[yy_i].t_name );
01177                 }
01178             }
01179 #endif /* YYDEBUG */
01180             /*
01181             ** look through exception table
01182             */
01183             {
01184                 register int *yyxi = yyexca;
01185
01186                 while ( ( *yyxi != -1 ) ||
01187                     ( yyxi[1] != yy_state ) )
01188                 {
01189                     yyxi += 2;
01190                 }
01191                 while ( ( *(yyxi += 2) >= 0 ) &&
01192                     ( *yyxi != yychar ) )
01193                     ;
01194                 if ( ( yy_n = yyxi[1] ) < 0 )
01195                     YYACCEPT;
01196             }
01197         }
01198
01199         /*
01200         ** check for syntax error
01201         */
01202         if ( yy_n == 0 )    /* have an error */
01203         {
01204             /* no worry about speed here! */
01205             switch ( yyerrflag )
01206             {
01207             case 0:     /* new error */
01208                 yyerror( "syntax error" );
01209                 goto skip_init;
01210             yyerrlab:
01211                 /*
01212                 ** get globals into registers.
01213                 ** we have a user generated syntax type error
01214                 */
01215                 yy_pv = yypv;
01216                 yy_ps = yyps;
01217                 yy_state = yystate;
01218                 yynerrs++;
01219             skip_init:
01220             case 1:
01221             case 2:     /* incompletely recovered error */
01222                     /* try again... */
01223                 yyerrflag = 3;
01224                 /*
01225                 ** find state where "error" is a legal
01226                 ** shift action
01227                 */
01228                 while ( yy_ps >= yys )
01229                 {
01230                     yy_n = yypact[ *yy_ps ] + YYERRCODE;
01231                     if ( yy_n >= 0 && yy_n < YYLAST &&
01232                         yychk[yyact[yy_n]] == YYERRCODE)                    {
01233                         /*
01234                         ** simulate shift of "error"
01235                         */
01236                         yy_state = yyact[ yy_n ];
01237                         goto yy_stack;
01238                     }
01239                     /*
01240                     ** current state has no shift on
01241                     ** "error", pop stack
01242                     */
01243 #if YYDEBUG
01244 #   define _POP_ "Error recovery pops state %d, uncovers state %d\n"
01245                     if ( yydebug )
01246                         (void)printf( _POP_, *yy_ps,
01247                             yy_ps[-1] );
01248 #   undef _POP_
01249 #endif
01250                     yy_ps--;
01251                     yy_pv--;
01252                 }
01253                 /*
01254                 ** there is no state on stack with "error" as
01255                 ** a valid shift.  give up.
01256                 */
01257                 YYABORT;
01258             case 3:     /* no shift yet; eat a token */
01259 #if YYDEBUG
01260                 /*
01261                 ** if debugging, look up token in list of
01262                 ** pairs.  0 and negative shouldn't occur,
01263                 ** but since timing doesn't matter when
01264                 ** debugging, it doesn't hurt to leave the
01265                 ** tests here.
01266                 */
01267                 if ( yydebug )
01268                 {
01269                     register int yy_i;
01270
01271                     (void)printf( "Error recovery discards " );
01272                     if ( yychar == 0 )
01273                         (void)printf( "token end-of-file\n" );
01274                     else if ( yychar < 0 )
01275                         (void)printf( "token -none-\n" );
01276                     else
01277                     {
01278                         for ( yy_i = 0;
01279                             yytoks[yy_i].t_val >= 0;
01280                             yy_i++ )
01281                         {
01282                             if ( yytoks[yy_i].t_val
01283                                 == yychar )
01284                             {
01285                                 break;
01286                             }
01287                         }
01288                         (void)printf( "token %s\n",
01289                             yytoks[yy_i].t_name );
01290                     }
01291                 }
01292 #endif /* YYDEBUG */
01293                 if ( yychar == 0 )  /* reached EOF. quit */
01294                     YYABORT;
01295                 yychar = -1;
01296                 goto yy_newstate;
01297             }
01298         }/* end if ( yy_n == 0 ) */
01299         /*
01300         ** reduction by production yy_n
01301         ** put stack tops, etc. so things right after switch
01302         */
01303 #if YYDEBUG
01304         /*
01305         ** if debugging, print the string that is the user's
01306         ** specification of the reduction which is just about
01307         ** to be done.
01308         */
01309         if ( yydebug )
01310             (void)printf( "Reduce by (%d) \"%s\"\n",
01311                 yy_n, yyreds[ yy_n ] );
01312 #endif
01313         yytmp = yy_n;           /* value to switch over */
01314         yypvt = yy_pv;          /* $vars top of value stack */
01315         /*
01316         ** Look in goto table for next state
01317         ** Sorry about using yy_state here as temporary
01318         ** register variable, but why not, if it works...
01319         ** If yyr2[ yy_n ] doesn't have the low order bit
01320         ** set, then there is no action to be done for
01321         ** this reduction.  So, no saving & unsaving of
01322         ** registers done.  The only difference between the
01323         ** code just after the if and the body of the if is
01324         ** the goto yy_stack in the body.  This way the test
01325         ** can be made before the choice of what to do is needed.
01326         */
01327         {
01328             /* length of production doubled with extra bit */
01329             register int yy_len = yyr2[ yy_n ];
01330
01331             if ( !( yy_len & 01 ) )
01332             {
01333                 yy_len >>= 1;
01334                 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
01335                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
01336                     *( yy_ps -= yy_len ) + 1;
01337                 if ( yy_state >= YYLAST ||
01338                     yychk[ yy_state =
01339                     yyact[ yy_state ] ] != -yy_n )
01340                 {
01341                     yy_state = yyact[ yypgo[ yy_n ] ];
01342                 }
01343                 goto yy_stack;
01344             }
01345             yy_len >>= 1;
01346             yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
01347             yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
01348                 *( yy_ps -= yy_len ) + 1;
01349             if ( yy_state >= YYLAST ||
01350                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
01351             {
01352                 yy_state = yyact[ yypgo[ yy_n ] ];
01353             }
01354         }
01355                     /* save until reenter driver code */
01356         yystate = yy_state;
01357         yyps = yy_ps;
01358         yypv = yy_pv;
01359     }
01360     /*
01361     ** code supplied by user is placed in this switch
01362     */
01363     switch( yytmp )
01364     {
01365
01366 case 3:
01367 {
01368         yyHaveTime++;
01369     } break;
01370 case 4:
01371 {
01372         yyHaveZone++;
01373     } break;
01374 case 5:
01375 {
01376         yyHaveDate++;
01377     } break;
01378 case 6:
01379 {
01380         yyHaveDay++;
01381     } break;
01382 case 7:
01383 {
01384         yyHaveRel++;
01385     } break;
01386 case 9:
01387 {
01388         yyHour = yypvt[-1].Number;
01389         yyMinutes = 0;
01390         yySeconds = 0;
01391         yyMeridian = yypvt[-0].Meridian;
01392     } break;
01393 case 10:
01394 {
01395         yyHour = yypvt[-3].Number;
01396         yyMinutes = yypvt[-1].Number;
01397         yySeconds = 0;
01398         yyMeridian = yypvt[-0].Meridian;
01399     } break;
01400 case 11:
01401 {
01402         yyHour = yypvt[-3].Number;
01403         yyMinutes = yypvt[-1].Number;
01404         yyMeridian = MER24;
01405         yyDSTmode = DSToff;
01406         yyTimezone = - (yypvt[-0].Number % 100 + (yypvt[-0].Number / 100) * 60);
01407     } break;
01408 case 12:
01409 {
01410         yyHour = yypvt[-5].Number;
01411         yyMinutes = yypvt[-3].Number;
01412         yySeconds = yypvt[-1].Number;
01413         yyMeridian = yypvt[-0].Meridian;
01414     } break;
01415 case 13:
01416 {
01417         yyHour = yypvt[-5].Number;
01418         yyMinutes = yypvt[-3].Number;
01419         yySeconds = yypvt[-1].Number;
01420         yyMeridian = MER24;
01421         yyDSTmode = DSToff;
01422         yyTimezone = - (yypvt[-0].Number % 100 + (yypvt[-0].Number / 100) * 60);
01423     } break;
01424 case 14:
01425 {
01426         yyTimezone = yypvt[-0].Number;
01427         yyDSTmode = DSToff;
01428     } break;
01429 case 15:
01430 {
01431         yyTimezone = yypvt[-0].Number;
01432         yyDSTmode = DSTon;
01433     } break;
01434 case 16:
01435 {
01436         yyTimezone = yypvt[-1].Number;
01437         yyDSTmode = DSTon;
01438     } break;
01439 case 17:
01440 {
01441         yyDayOrdinal = 1;
01442         yyDayNumber = yypvt[-0].Number;
01443     } break;
01444 case 18:
01445 {
01446         yyDayOrdinal = 1;
01447         yyDayNumber = yypvt[-1].Number;
01448     } break;
01449 case 19:
01450 {
01451         yyDayOrdinal = yypvt[-1].Number;
01452         yyDayNumber = yypvt[-0].Number;
01453     } break;
01454 case 20:
01455 {
01456         yyMonth = yypvt[-2].Number;
01457         yyDay = yypvt[-0].Number;
01458     } break;
01459 case 21:
01460 {
01461         yyMonth = yypvt[-4].Number;
01462         yyDay = yypvt[-2].Number;
01463         yyYear = yypvt[-0].Number;
01464     } break;
01465 case 22:
01466 {
01467         /* ISO 8601 format.  yyyy-mm-dd.  */
01468         yyYear = yypvt[-2].Number;
01469         yyMonth = -yypvt[-1].Number;
01470         yyDay = -yypvt[-0].Number;
01471     } break;
01472 case 23:
01473 {
01474         /* e.g. 17-JUN-1992.  */
01475         yyDay = yypvt[-2].Number;
01476         yyMonth = yypvt[-1].Number;
01477         yyYear = -yypvt[-0].Number;
01478     } break;
01479 case 24:
01480 {
01481         yyMonth = yypvt[-1].Number;
01482         yyDay = yypvt[-0].Number;
01483     } break;
01484 case 25:
01485 {
01486         yyMonth = yypvt[-3].Number;
01487         yyDay = yypvt[-2].Number;
01488         yyYear = yypvt[-0].Number;
01489     } break;
01490 case 26:
01491 {
01492         yyMonth = yypvt[-0].Number;
01493         yyDay = yypvt[-1].Number;
01494     } break;
01495 case 27:
01496 {
01497         yyMonth = yypvt[-1].Number;
01498         yyDay = yypvt[-2].Number;
01499         yyYear = yypvt[-0].Number;
01500     } break;
01501 case 28:
01502 {
01503         yyRelSeconds = -yyRelSeconds;
01504         yyRelMonth = -yyRelMonth;
01505     } break;
01506 case 30:
01507 {
01508         yyRelSeconds += yypvt[-1].Number * yypvt[-0].Number * 60L;
01509     } break;
01510 case 31:
01511 {
01512         yyRelSeconds += yypvt[-1].Number * yypvt[-0].Number * 60L;
01513     } break;
01514 case 32:
01515 {
01516         yyRelSeconds += yypvt[-0].Number * 60L;
01517     } break;
01518 case 33:
01519 {
01520         yyRelSeconds += yypvt[-1].Number;
01521     } break;
01522 case 34:
01523 {
01524         yyRelSeconds += yypvt[-1].Number;
01525     } break;
01526 case 35:
01527 {
01528         yyRelSeconds++;
01529     } break;
01530 case 36:
01531 {
01532         yyRelMonth += yypvt[-1].Number * yypvt[-0].Number;
01533     } break;
01534 case 37:
01535 {
01536         yyRelMonth += yypvt[-1].Number * yypvt[-0].Number;
01537     } break;
01538 case 38:
01539 {
01540         yyRelMonth += yypvt[-0].Number;
01541     } break;
01542 case 39:
01543 {
01544         if (yyHaveTime && yyHaveDate && !yyHaveRel)
01545         yyYear = yypvt[-0].Number;
01546         else {
01547         if(yypvt[-0].Number>10000) {
01548             yyHaveDate++;
01549             yyDay= (yypvt[-0].Number)%100;
01550             yyMonth= (yypvt[-0].Number/100)%100;
01551             yyYear = yypvt[-0].Number/10000;
01552         }
01553         else {
01554             yyHaveTime++;
01555             if (yypvt[-0].Number < 100) {
01556             yyHour = yypvt[-0].Number;
01557             yyMinutes = 0;
01558             }
01559             else {
01560                 yyHour = yypvt[-0].Number / 100;
01561                 yyMinutes = yypvt[-0].Number % 100;
01562             }
01563             yySeconds = 0;
01564             yyMeridian = MER24;
01565             }
01566         }
01567     } break;
01568 case 40:
01569 {
01570         yyval.Meridian = MER24;
01571     } break;
01572 case 41:
01573 {
01574         yyval.Meridian = yypvt[-0].Meridian;
01575     } break;
01576     }
01577     goto yystack;       /* reset registers in driver code */
01578 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getpass.c File Reference

cvs-1.10/os2/getpass.c File Reference

#include <stdio.h>
#include <string.h>
#include "cvs.h"
#include "os2inc.h"

Include dependency graph for getpass.c:

Include dependency graph

Go to the source code of this file.

Functions

void | EchoOff (void)
void | EchoOn (void)
char * | getpass (char *prompt)

Function Documentation

void EchoOff ( void ) [static]

Definition at line 12 of file getpass.c.

Referenced by getpass().

00013 {
00014   KBDINFO KbdInfo;
00015
00016   KbdGetStatus (&KbdInfo, 0);
00017   KbdInfo.fsMask = (KbdInfo.fsMask & ~KEYBOARD_ECHO_ON) | KEYBOARD_ECHO_OFF;
00018   KbdSetStatus (&KbdInfo, 0);
00019 }

void EchoOn ( void ) [static]

Definition at line 23 of file getpass.c.

Referenced by getpass().

00024 {
00025   KBDINFO KbdInfo;
00026
00027   KbdGetStatus (&KbdInfo, 0);
00028   KbdInfo.fsMask = (KbdInfo.fsMask & ~KEYBOARD_ECHO_OFF) | KEYBOARD_ECHO_ON;
00029   KbdSetStatus (&KbdInfo, 0);
00030 }

char* getpass ( char * prompt )

Definition at line 33 of file getpass.c.

00034 {
00035   static char Buf[80];
00036   STRINGINBUF StringInBuf;
00037
00038   printf ("%s", prompt);
00039   fflush (stdout);
00040
00041   EchoOff ();
00042
00043   StringInBuf.cb = sizeof (Buf) - 1;
00044   StringInBuf.cchIn = 0;
00045   KbdStringIn ((PSZ) Buf, &StringInBuf, IO_WAIT, 0);
00046   Buf[StringInBuf.cchIn] = '\0';
00047
00048   EchoOn ();
00049
00050   return Buf;
00051 }

Generated on Sun Oct 21 12:43:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/getpass.c Source File

cvs-1.10/os2/getpass.c

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <string.h>
00003 #include "cvs.h"
00004 #include "os2inc.h"
00005
00006 /* Only define this if you're testing and want to compile this file
00007    standalone. */
00008 /* #define DIAGNOSTIC */
00009
00010 /* Turn off keyboard echo.  Does not check error returns. */
00011 static void
00012 EchoOff (void)
00013 {
00014   KBDINFO KbdInfo;
00015
00016   KbdGetStatus (&KbdInfo, 0);
00017   KbdInfo.fsMask = (KbdInfo.fsMask & ~KEYBOARD_ECHO_ON) | KEYBOARD_ECHO_OFF;
00018   KbdSetStatus (&KbdInfo, 0);
00019 }
00020
00021 /* Turn on keyboard echo.  Does not check error returns. */
00022 static void
00023 EchoOn( void )
00024 {
00025   KBDINFO KbdInfo;
00026
00027   KbdGetStatus (&KbdInfo, 0);
00028   KbdInfo.fsMask = (KbdInfo.fsMask & ~KEYBOARD_ECHO_OFF) | KEYBOARD_ECHO_ON;
00029   KbdSetStatus (&KbdInfo, 0);
00030 }
00031
00032 char *
00033 getpass (char *prompt)
00034 {
00035   static char Buf[80];
00036   STRINGINBUF StringInBuf;
00037
00038   printf ("%s", prompt);
00039   fflush (stdout);
00040
00041   EchoOff ();
00042
00043   StringInBuf.cb = sizeof (Buf) - 1;
00044   StringInBuf.cchIn = 0;
00045   KbdStringIn ((PSZ) Buf, &StringInBuf, IO_WAIT, 0);
00046   Buf[StringInBuf.cchIn] = '\0';
00047
00048   EchoOn ();
00049
00050   return Buf;
00051 }
00052
00053
00054 #ifdef DIAGNOSTIC
00055 main()
00056 {
00057   char *s;
00058   s = getpass ("Input password (no echo): ");
00059   printf ("String was \"%s\"\n", s);
00060   fflush (stdout);
00061 }
00062 #endif /* DIAGNOSTIC */
00063
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


mkdir.c File Reference

cvs-1.10/os2/mkdir.c File Reference

#include <assert.h>
#include "cvs.h"

Include dependency graph for mkdir.c:

Include dependency graph

Go to the source code of this file.

Functions

int os2_mkdir (const char *path, int mode)

Function Documentation

int os2_mkdir | ( | const char * | path,
 |  | int | mode
 | ) |

Definition at line 9 of file mkdir.c.

00010 {
00011   /* This is true for all extant calls to CVS_MKDIR.  If
00012      someone adds a call that uses something else later,
00013      we should tweak this function to handle that.  */
00014   assert (mode == 0777);
00015
00016   return mkdir (path);
00017 }

Generated on Sun Oct 21 12:43:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/mkdir.c Source File

cvs-1.10/os2/mkdir.c

Go to the documentation of this file.
00001 /* mkdir.c --- mkdir for OS/2
00002    Karl Fogel <kfogel@cyclic.com> --- October 1995  */
00003
00004 #include <assert.h>
00005
00006 #include "cvs.h"
00007
00008 int
00009 os2_mkdir (const char *path, int mode)
00010 {
00011   /* This is true for all extant calls to CVS_MKDIR.  If
00012      someone adds a call that uses something else later,
00013      we should tweak this function to handle that.  */
00014   assert (mode == 0777);
00015
00016   return mkdir (path);
00017 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


options.h File Reference

cvs-1.10/os2/options.h File Reference

Go to the source code of this file.

Defines

#define | PATCH_PROGRAM "cvspatch"
#define | TMPDIR_DFLT "c:\\temp"
#define | EDITOR_DFLT "notepad"
#define | UMASK_DFLT 002
#define | RELATIVE_REPOS 1
#define | AUTH_CLIENT_SUPPORT 1

Functions

void | exit ()
char * | getpass (char *passbuf)

Define Documentation

#define AUTH_CLIENT_SUPPORT 1

Definition at line 161 of file options.h.

#define EDITOR_DFLT "notepad"

Definition at line 59 of file options.h.

#define PATCH_PROGRAM "cvspatch"

Definition at line 38 of file options.h.

#define RELATIVE_REPOS 1

Definition at line 105 of file options.h.

#define TMPDIR_DFLT "c:\\temp"

Definition at line 46 of file options.h.

#define UMASK_DFLT 002

Definition at line 72 of file options.h.

Function Documentation

void exit ( )

char* getpass ( char * prompt )

Definition at line 27 of file getpass.c.

00028 {
00029     int status;
00030     unsigned short chan;
00031     static $DESCRIPTOR (sys_command, "SYS$COMMAND");
00032     unsigned short iosb[4];
00033     /* Arbitrary limit.  It doesn't seem worth going through multiple
00034        SYS$QIOW calls and who knows what to get rid of it, I don't
00035        think.  */
00036     static char buf[2048];
00037
00038     /* Try to ensure that we avoid stepping on whatever output has
00039        been sent to stdout.  */
00040     printf ("\n");
00041     fflush (stdout);
00042
00043     status = sys$assign (&sys_command, &chan, 0, 0);
00044     if (!(status & 1))
00045     error (1, 0, "sys$assign failed in getpass");
00046     status = sys$qiow (0, chan, IO$_READPROMPT | IO$M_NOECHO, &iosb, 0, 0,
00047                buf, sizeof (buf) - 1, 0, 0, prompt, strlen (prompt));
00048     if (!(status & 1))
00049     error (1, 0, "sys$qiow failed in getpass");
00050     if (!(iosb[0] & 1))
00051     error (1, 0, "sys$qiow (iosb) failed in getpass");
00052     buf[iosb[1]] = '\0';
00053     status = sys$dassgn (chan);
00054     if (!(status & 1))
00055     error (0, 0, "sys$dassgn failed in getpass");
00056     /* Since there is no echo, we better go to the next line ourselves.  */
00057     printf ("\n");
00058     return buf;
00059 }

Generated on Sun Oct 21 12:42:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/options.h Source File

cvs-1.10/os2/options.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS 1.4 kit.
00007  *
00008  * This file holds (most of) the configuration tweaks that can be made to
00009  * customize CVS for your site.  CVS comes configured for a typical SunOS 4.x
00010  * environment.  The comments for each configurable item are intended to be
00011  * self-explanatory.  All #defines are tested first to see if an over-riding
00012  * option was specified on the "make" command line.
00013  *
00014  * If special libraries are needed, you will have to edit the Makefile.in file
00015  * or the configure script directly.  Sorry.
00016  */
00017
00018 /*
00019  * For portability and heterogeneity reasons, CVS is shipped by default using
00020  * my own text-file version of the ndbm database library in the src/myndbm.c
00021  * file.  If you want better performance and are not concerned about
00022  * heterogeneous hosts accessing your modules file, turn this option off.
00023  */
00024 #ifndef MY_NDBM
00025 #define MY_NDBM
00026 #endif
00027
00028 /*
00029  * The "patch" program to run when using the CVS server and accepting
00030  * patches across the network.  Specify a full pathname if your site
00031  * wants to use a particular patch.
00032  *
00033  * We call this "cvspatch" because of reports of a native OS/2 "patch"
00034  * program that does not behave the way CVS expects.  So OS/2 users
00035  * should get a GNU patch and call it "cvspatch.exe".
00036  */
00037 #ifndef PATCH_PROGRAM
00038 #define PATCH_PROGRAM   "cvspatch"
00039 #endif
00040
00041 /* Directory used for storing temporary files, if not overridden by
00042    environment variables or the -T global option.  There should be little
00043    need to change this (-T is a better mechanism if you need to use a
00044    different directory for temporary files).  */
00045 #ifndef TMPDIR_DFLT
00046 #define TMPDIR_DFLT "c:\\temp"
00047 #endif
00048
00049 /*
00050  * The default editor to use, if one does not specify the "-e" option to cvs,
00051  * or does not have an EDITOR environment variable.  I set this to just "vi",
00052  * and use the shell to find where "vi" actually is.  This allows sites with
00053  * /usr/bin/vi or /usr/ucb/vi to work equally well (assuming that your PATH
00054  * is reasonable).
00055  *
00056  * The notepad program seems to be Windows NT's bare-bones text editor.
00057  */
00058 #ifndef EDITOR_DFLT
00059 #define EDITOR_DFLT "notepad"
00060 #endif
00061
00062 /*
00063  * The default umask to use when creating or otherwise setting file or
00064  * directory permissions in the repository.  Must be a value in the
00065  * range of 0 through 0777.  For example, a value of 002 allows group
00066  * rwx access and world rx access; a value of 007 allows group rwx
00067  * access but no world access.  This value is overridden by the value
00068  * of the CVSUMASK environment variable, which is interpreted as an
00069  * octal number.
00070  */
00071 #ifndef UMASK_DFLT
00072 #define UMASK_DFLT  002
00073 #endif
00074
00075 /*
00076  * The cvs admin command is restricted to the members of the group
00077  * CVS_ADMIN_GROUP.  If this group does not exist, all users are
00078  * allowed to run cvs admin.  To disable the cvs admin for all users,
00079  * create an empty group CVS_ADMIN_GROUP.  To disable access control for
00080  * cvs admin, comment out the define below.
00081  *
00082  * Under Windows NT and OS/2, this must not be used because it tries
00083  * to include <grp.h>.
00084  */
00085 #ifdef CVS_ADMIN_GROUP
00086 /* #define CVS_ADMIN_GROUP "cvsadmin" */
00087 #endif
00088
00089 /*
00090  * The Repository file holds the path to the directory within the
00091  * source repository that contains the RCS ,v files for each CVS
00092  * working directory.  This path is either a full-path or a path
00093  * relative to CVSROOT.
00094  *
00095  * The big advantage that I can see to having a relative path is that
00096  * one can change the physical location of the master source
00097  * repository, change the contents of CVS/Root files in your
00098  * checked-out code, and CVS will work without problems.
00099  *
00100  * Therefore, RELATIVE_REPOS is now the default.  In the future, this
00101  * is likely to disappear entirely as a compile-time (or other) option,
00102  * so if you have other software which relies on absolute pathnames,
00103  * update them.
00104  */
00105 #define RELATIVE_REPOS 1
00106
00107 /*
00108  * When committing or importing files, you must enter a log message.
00109  * Normally, you can do this either via the -m flag on the command line or an
00110  * editor will be started for you.  If you like to use logging templates (the
00111  * rcsinfo file within the $CVSROOT/CVSROOT directory), you might want to
00112  * force people to use the editor even if they specify a message with -m.
00113  * Enabling FORCE_USE_EDITOR will cause the -m message to be appended to the
00114  * temp file when the editor is started.
00115  */
00116 #ifndef FORCE_USE_EDITOR
00117 /* #define  FORCE_USE_EDITOR */
00118 #endif
00119
00120 /*
00121  * When locking the repository, some sites like to remove locks and assume
00122  * the program that created them went away if the lock has existed for a long
00123  * time.  This used to be the default for previous versions of CVS.  CVS now
00124  * attempts to be much more robust, so lock files should not be left around
00125  * by mistake. The new behaviour will never remove old locks (they must now
00126  * be removed by hand).  Enabling CVS_FUDGELOCKS will cause CVS to remove
00127  * locks that are older than CVSLCKAGE seconds.
00128  * Use of this option is NOT recommended.
00129  */
00130 #ifndef CVS_FUDGELOCKS
00131 /* #define CVS_FUDGELOCKS */
00132 #endif
00133
00134 /*
00135  * When committing a permanent change, CVS and RCS make a log entry of
00136  * who committed the change.  If you are committing the change logged in
00137  * as "root" (not under "su" or other root-priv giving program), CVS/RCS
00138  * cannot determine who is actually making the change.
00139  *
00140  * As such, by default, CVS disallows changes to be committed by users
00141  * logged in as "root".  You can disable this option by commenting
00142  * out the lines below.
00143  *
00144  * Under Windows NT, privileges are associated with groups, not users,
00145  * so the case in which someone has logged in as root does not occur.
00146  * Thus, there is no need for this hack.
00147  *
00148  * todo: I don't know about OS/2 yet.  -kff
00149  */
00150 #undef CVS_BADROOT
00151
00152 /*
00153  * define this to enable the SETXID support (see FAQ 4D.13)
00154  * [ We have no such thing under OS/2, so far as I know. ]
00155  */
00156 #undef SETXID_SUPPORT
00157
00158 /*
00159  * Under OS/2, we build the authenticated client by default.
00160  */
00161 #define AUTH_CLIENT_SUPPORT 1
00162
00163 /* End of CVS configuration section */
00164
00165 /*
00166  * Externs that are included in libc, but are used frequently enough to
00167  * warrant defining here.
00168  */
00169 #ifndef STDC_HEADERS
00170 extern void exit ();
00171 #endif
00172
00173 #ifdef AUTH_CLIENT_SUPPORT
00174 char *getpass (char *passbuf);
00175 #endif /* AUTH_CLIENT_SUPPORT */
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/os2inc.h Source File

cvs-1.10/os2/os2inc.h

Go to the documentation of this file.
00001 /* This file is used to make the os/2 header files idempotent.
00002    Written 11/96 by Ullrich von Bassewitz (uz@musoftware.com)
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #ifndef IN_OS2INC_H
00015 #define IN_OS2INC_H
00016
00017 #define INCL_BASE
00018 #define INCL_SUB
00019 #define INCL_KBD
00020 #include <os2.h>
00021
00022 #endif
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/popen.c Source File

cvs-1.10/os2/popen.c

Go to the documentation of this file.
00001 /* popen.c -- popen/pclose for OS/2. */
00002
00003 /* Set to 0 for distribution.
00004    Search for "DIAGNOSTIC" in the code to see what it's for. */
00005 #define DIAGNOSTIC 0
00006
00007 #include    <process.h>
00008
00009 #include    <stdio.h>
00010 #include    <stdlib.h>
00011 #include    <sys/types.h>
00012 #include    <sys/stat.h>
00013 #include    <ctype.h>
00014 #include    <string.h>
00015 #include    <fcntl.h>
00016
00017 #include    "config.h"
00018 #include    "os2inc.h"
00019
00020 #define LL_VAL ULONG
00021 #define LL_KEY PID    /* also ULONG, really */
00022
00023 #define STDIN       0
00024 #define STDOUT      1
00025 #define STDERR      2
00026
00027 /* ********************************************************************* *
00028  *                                                                       *
00029  *   First, a little linked-list library to help keep track of pipes:    *
00030  *                                                                       *
00031  * ********************************************************************* */
00032
00033 /* Map integer PID's onto integer termination codes. */
00034 struct pid_list
00035 {
00036   HFILE pid;              /* key */
00037   ULONG term_code;        /* val */
00038   struct pid_list *next;  /* duh */
00039 };
00040
00041 static struct pid_list *pid_ll = (struct pid_list *) NULL;
00042
00043 /* The ll_*() functions all make use of the global var `pid_ll'. */
00044
00045 void
00046 ll_insert (HFILE key, ULONG val)
00047 {
00048   struct pid_list *new;
00049   new = (struct pid_list *) malloc (sizeof (*new));
00050
00051   new->pid       = key;
00052   new->term_code = val;
00053   new->next      = pid_ll;
00054
00055   pid_ll = new;
00056 }
00057
00058
00059 void
00060 ll_delete (int key)
00061 {
00062   struct pid_list *this, *last;
00063
00064   this = pid_ll;
00065   last = (struct pid_list *) NULL;
00066
00067   while (this)
00068     {
00069       if (this->pid == key)
00070         {
00071           /* Delete this node and leave. */
00072           if (last)
00073             last->next = this->next;
00074           else
00075             pid_ll = this->next;
00076           free (this);
00077           return;
00078         }
00079
00080       /* Else no match, so try the next one. */
00081       last = this;
00082       this = this->next;
00083     }
00084 }
00085
00086 ULONG
00087 ll_lookup (HFILE key)
00088 {
00089   struct pid_list *this = pid_ll;
00090
00091   while (this)
00092     {
00093       if (this->pid == key)
00094         return this->term_code;
00095
00096       /* Else no match, so try the next one. */
00097       this = this->next;
00098     }
00099
00100   /* Zero is special in this context anyway. */
00101   return 0;
00102 }
00103
00104 #if DIAGNOSTIC
00105 ULONG
00106 ll_length ()
00107 {
00108   struct pid_list *this = pid_ll;
00109   unsigned long int len;
00110
00111   for (len = 0; this; len++)
00112     this = this->next;
00113
00114   return len;
00115 }
00116
00117 ULONG
00118 ll_print ()
00119 {
00120   struct pid_list *this = pid_ll;
00121   unsigned long int i;
00122
00123   for (i = 0; this; i++)
00124     {
00125       printf ("pid_ll[%d] == (%5d --> %5d)\n",
00126               i, this->pid, this->term_code);
00127       this = this->next;
00128     }
00129
00130   if (i == 0)
00131     printf ("No entries.\n");
00132
00133   return i;
00134 }
00135 #endif /* DIAGNOSTIC */
00136
00137 /* ********************************************************************* *
00138  *                                                                       *
00139  *       End of linked-list library, beginning of popen/pclose:          *
00140  *                                                                       *
00141  * ********************************************************************* */
00142
00143 /*
00144  *  Routine: popen
00145  *  Returns: FILE pointer to pipe.
00146  *  Action : Exec program connected via pipe, connect a FILE * to the
00147  *           pipe and return it.
00148  *  Params : Command - Program to run
00149  *           Mode    - Mode to open pipe.  "r" implies pipe is connected
00150  *                     to the programs stdout, "w" connects to stdin.
00151  */
00152 FILE *
00153 popen (const char *Command, const char *Mode)
00154 {
00155     HFILE End1, End2, Std, Old1, Old2, Tmp;
00156
00157     FILE *File;
00158
00159     char    Fail[256],
00160             *Args,
00161             CmdLine[256],
00162             *CmdExe;
00163
00164     RESULTCODES
00165             Result;
00166
00167     int     Rc;
00168
00169     if (DosCreatePipe (&End1, &End2, 4096))
00170         return NULL;
00171
00172     Std = (*Mode == 'w') ? STDIN : STDOUT ;
00173     if (Std == STDIN)
00174     {
00175         Tmp = End1; End1 = End2; End2 = Tmp;
00176     }
00177
00178     Old1 = -1; /* save stdin or stdout */
00179     DosDupHandle (Std, &Old1);
00180     DosSetFHState (Old1, OPEN_FLAGS_NOINHERIT);
00181     Tmp = Std; /* redirect stdin or stdout */
00182     DosDupHandle (End2, &Tmp);
00183
00184     if (Std == 1)
00185     {
00186         Old2 = -1; /* save stderr */
00187         DosDupHandle (STDERR, &Old2);
00188         DosSetFHState (Old2, OPEN_FLAGS_NOINHERIT);
00189         Tmp = STDERR;
00190         DosDupHandle (End2, &Tmp);
00191     }
00192
00193     DosClose (End2);
00194     DosSetFHState (End1, OPEN_FLAGS_NOINHERIT);
00195
00196     if ((CmdExe = getenv ("COMSPEC")) == NULL )
00197         CmdExe = "cmd.exe";
00198
00199     strcpy (CmdLine, CmdExe);
00200     Args = CmdLine + strlen (CmdLine) + 1; /* skip zero */
00201     strcpy (Args, "/c ");
00202     strcat (Args, Command);
00203     Args[strlen (Args) + 1] = '\0'; /* two zeroes */
00204     Rc = DosExecPgm (Fail, sizeof (Fail), EXEC_ASYNCRESULT,
00205                      (unsigned char *) CmdLine, 0, &Result,
00206                      (unsigned char *) CmdExe);
00207
00208     Tmp = Std; /* restore stdin or stdout */
00209     DosDupHandle (Old1, &Tmp);
00210     DosClose (Old1);
00211
00212     if (Std == STDOUT)
00213     {
00214         Tmp = STDERR;   /* restore stderr */
00215         DosDupHandle (Old2, &Tmp);
00216         DosClose (Old2);
00217     }
00218
00219     if (Rc)
00220     {
00221         DosClose (End1);
00222         return NULL;
00223     }
00224
00225 #ifdef __WATCOMC__
00226     /* Watcom does not allow mixing operating system handles and
00227      * C library handles, so we have to convert.
00228      */
00229     File = fdopen (_hdopen (End1, *Mode == 'w'? O_WRONLY : O_RDONLY), Mode);
00230 #else
00231     File = fdopen (End1, Mode);
00232 #endif
00233     ll_insert ((LL_KEY) End1, (LL_VAL) Result.codeTerminate);
00234
00235     return File;
00236 }
00237
00238
00239 /*
00240  *  Routine: popenRW
00241  *  Returns: PID of child process
00242  *  Action : Exec program connected via pipe, connect int fd's to
00243  *           both the stdin and stdout of the process.
00244  *  Params : Command - Program to run
00245  *           Pipes   - Array of 2 ints to store the pipe descriptors
00246  *                     Pipe[0] writes to child's stdin,
00247  *                     Pipe[1] reads from child's stdout/stderr
00248  */
00249 int
00250 popenRW (const char **argv, int *pipes)
00251 {
00252     HFILE Out1, Out2, In1, In2;
00253     HFILE Old0 = -1, Old1 = -1, Old2 = -1, Tmp;
00254
00255     int pid;
00256
00257     if (DosCreatePipe (&Out2, &Out1, 4096))
00258         return FALSE;
00259
00260     if (DosCreatePipe (&In1, &In2, 4096))
00261     {
00262         DosClose (Out1);
00263         DosClose (Out2);
00264         return FALSE;
00265     }
00266
00267     /* Save std{in,out,err} */
00268     DosDupHandle (STDIN, &Old0);
00269     DosSetFHState (Old1, OPEN_FLAGS_NOINHERIT);
00270     DosDupHandle (STDOUT, &Old1);
00271     DosSetFHState (Old2, OPEN_FLAGS_NOINHERIT);
00272     DosDupHandle (STDERR, &Old2);
00273     DosSetFHState (Old2, OPEN_FLAGS_NOINHERIT);
00274
00275     /* Redirect std{in,out,err} */
00276     Tmp = STDIN;
00277     DosDupHandle (In1, &Tmp);
00278     Tmp = STDOUT;
00279     DosDupHandle (Out1, &Tmp);
00280     Tmp = STDERR;
00281     DosDupHandle (Out1, &Tmp);
00282
00283     /* Close file handles not needed in child */
00284
00285     DosClose (In1);
00286     DosClose (Out1);
00287     DosSetFHState (In2, OPEN_FLAGS_NOINHERIT);
00288     DosSetFHState (Out2, OPEN_FLAGS_NOINHERIT);
00289
00290     /* Spawn we now our hoary brood. */
00291     pid = spawnvp (P_NOWAIT, argv[0], argv);
00292
00293     /* Restore std{in,out,err} */
00294     Tmp = STDIN;
00295     DosDupHandle (Old0, &Tmp);
00296     DosClose (Old0);
00297     Tmp = STDOUT;
00298     DosDupHandle (Old1, &Tmp);
00299     DosClose (Old1);
00300     Tmp = STDERR;
00301     DosDupHandle (Old2, &Tmp);
00302     DosClose (Old2);
00303
00304     if(pid < 0)
00305       {
00306         DosClose (In2);
00307         DosClose (Out2);
00308         return -1;
00309       }
00310
00311     pipes[0] = In2;
00312     _setmode (pipes[0], O_BINARY);
00313     pipes[1] = Out2;
00314     _setmode (pipes[1], O_BINARY);
00315
00316     /* Save ID of write-to-child pipe for pclose() */
00317     ll_insert ((LL_KEY) In2, (LL_VAL) pid);
00318
00319     return pid;
00320 }
00321
00322
00323 /*
00324  *  Routine: pclose
00325  *  Returns: TRUE on success
00326  *  Action : Close a pipe opened with popen();
00327  *  Params : Pipe - pipe to close
00328  */
00329 int
00330 pclose (FILE *Pipe)
00331 {
00332     RESULTCODES rc;
00333     PID pid, pid1;
00334     int Handle = fileno (Pipe);
00335
00336     fclose (Pipe);
00337
00338     rc.codeTerminate = -1;
00339
00340     pid1 = (PID) ll_lookup ((LL_KEY) Handle);
00341     /* if pid1 is zero, something's seriously wrong */
00342     if (pid1 != 0)
00343       {
00344         DosWaitChild (DCWA_PROCESSTREE, DCWW_WAIT, &rc, &pid, pid1);
00345         ll_delete ((LL_KEY) Handle);
00346       }
00347     return rc.codeTerminate == 0 ? rc.codeResult : -1;
00348 }
00349
00350
00351 #if DIAGNOSTIC
00352 void
00353 main ()
00354 {
00355   FILE *fp1, *fp2, *fp3;
00356   int c;
00357
00358   ll_print ();
00359   fp1 = popen ("gcc --version", "r");
00360   ll_print ();
00361   fp2 = popen ("link386 /?", "r");
00362   ll_print ();
00363   fp3 = popen ("dir", "r");
00364   ll_print ();
00365
00366   while ((c = getc (fp1)) != EOF)
00367     printf ("%c", c);
00368
00369   while ((c = getc (fp2)) != EOF)
00370     printf ("%c", c);
00371
00372   while ((c = getc (fp3)) != EOF)
00373     printf ("%c", c);
00374
00375   pclose (fp1);
00376   ll_print ();
00377   pclose (fp2);
00378   ll_print ();
00379   pclose (fp3);
00380   ll_print ();
00381
00382   return;
00383 }
00384
00385 #endif /* DIAGNOSTIC */
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/popen.h Source File

cvs-1.10/os2/popen.h

Go to the documentation of this file.
00001 /* We roll our own popen()/pclose() in OS/2.
00002    Thanks, Glenn Gribble! */
00003
00004 FILE *popen (const char *cmd, const char *mode);
00005 int popenRW (char **cmd, int *pipes);
00006 int pclose (FILE *stream);
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/porttcp.c Source File

cvs-1.10/os2/porttcp.c

Go to the documentation of this file.
00001 /****************************************************************
00002 **
00003 **  PORTTCP.C   - Support for portable TCP/IP
00004 **
00005 ****************************************************************/
00006
00007 #define TCPIP_IBM_NOHIDE
00008 #include    <stdio.h>
00009 #include    "tcpip.h"
00010
00011 /*
00012  * Common unknown error buffer
00013  */
00014 static char ErrUnknownBuf[36];
00015
00016 #ifndef SockStrError
00017
00018 /****************************************************************
00019  *  Routine: SockStrError
00020  *  Returns: Pointer to static buffer
00021  *  Action : Convert SOCK_ERRNO into error text
00022  ****************************************************************/
00023
00024 const char *
00025 SockStrError(int SockErrno)
00026 {
00027 #if defined (TCPIP_IBM)  && defined (IBM_CPP)
00028   switch (SockErrno)
00029     {
00030     case SOCEPERM:      return "Not owner";
00031     case SOCESRCH:      return "No such process";
00032     case SOCEINTR:      return "Interrupted system call";
00033     case SOCENXIO:      return "No such device or address";
00034     case SOCEBADF:      return "Bad file number";
00035     case SOCEACCES:     return "Permission denied";
00036     case SOCEFAULT:     return "Bad address";
00037     case SOCEINVAL:     return "Invalid argument";
00038     case SOCEMFILE:     return "Too many open files";
00039     case SOCEPIPE:      return "Broken pipe";
00040     case SOCEOS2ERR:        return "OS/2 Error";
00041     case SOCEWOULDBLOCK:    return "Operation would block";
00042     case SOCEINPROGRESS:    return "Operation now in progress";
00043     case SOCEALREADY:       return "Operation already in progress";
00044     case SOCENOTSOCK:       return "Socket operation on non-socket";
00045     case SOCEDESTADDRREQ:   return "Destination address required";
00046     case SOCEMSGSIZE:       return "Message too long";
00047     case SOCEPROTOTYPE:     return "Protocol wrong type for socket";
00048     case SOCENOPROTOOPT:    return "Protocol not available";
00049     case SOCEPROTONOSUPPORT:    return "Protocol not supported";
00050     case SOCESOCKTNOSUPPORT:    return "Socket type not supported";
00051     case SOCEOPNOTSUPP:     return "Operation not supported on socket";
00052     case SOCEPFNOSUPPORT:   return "Protocol family not supported";
00053     case SOCEAFNOSUPPORT:
00054       return "Address family not supported by protocol family";
00055     case SOCEADDRINUSE:     return "Address already in use";
00056     case SOCEADDRNOTAVAIL:  return "Can't assign requested address";
00057     case SOCENETDOWN:       return "Network is down";
00058     case SOCENETUNREACH:    return "Network is unreachable";
00059     case SOCENETRESET:      return "Network dropped connection on reset";
00060     case SOCECONNABORTED:   return "Software caused connection abort";
00061     case SOCECONNRESET:     return "Connection reset by peer";
00062     case SOCENOBUFS:        return "No buffer space available";
00063     case SOCEISCONN:        return "Socket is already connected";
00064     case SOCENOTCONN:       return "Socket is not connected";
00065     case SOCESHUTDOWN:      return "Can't send after socket shutdown";
00066     case SOCETOOMANYREFS:   return "Too many references: can't splice";
00067     case SOCETIMEDOUT:      return "Connection timed out";
00068     case SOCECONNREFUSED:   return "Connection refused";
00069     case SOCELOOP:      return "Too many levels of symbolic links";
00070     case SOCENAMETOOLONG:   return "File name too long";
00071     case SOCEHOSTDOWN:      return "Host is down";
00072     case SOCEHOSTUNREACH:   return "No route to host";
00073     case SOCENOTEMPTY:      return "Directory not empty";
00074
00075     default:
00076       sprintf( ErrUnknownBuf, "SockStrErrno( %d ) unknown", SockErrno );
00077       return ErrUnknownBuf;
00078     }
00079 #else
00080 #error  SockStrError not supported for this OS
00081 #endif
00082 }
00083
00084 #endif /* SockStrError */
00085
00086
00087 /****************************************************************
00088  *  Routine: HostStrError
00089  *  Returns: Pointer to static buffer
00090  *  Action : Convert HOST_ERRNO into error text
00091  ****************************************************************/
00092
00093 const char *
00094 HostStrError(int HostErrno)
00095 {
00096   switch (HostErrno)
00097     {
00098     case HOST_NOT_FOUND:
00099       return "Host not found";
00100     case TRY_AGAIN:
00101       return "Host not found (suggest try again)";
00102     case NO_RECOVERY:
00103       return "Non-recoverable error: FORMERR, REFUSED, NOTIMP";
00104     case NO_DATA:
00105       return "No Data (valid name, but no record of requested type)";
00106
00107     default:
00108       sprintf( ErrUnknownBuf, "HostStrErrno( %d ) unknown", HostErrno );
00109       return ErrUnknownBuf;
00110     }
00111 }
00112
00113
00114 #if defined( TCPIP_IBM )
00115 /****************************************************************
00116  * Routine: IbmSockSend
00117  * Returns: same as send
00118  * Action : Do the right thing for IBM TCP/IP which includes
00119  *      the following two stupidities:
00120  *      1) Never try to send more than 32K
00121  *      2) Never pass a buffer that crosses a 64K boundary
00122  *       If Flags is non-zero, this function only attempts
00123  *   to deal with condition (1) above.
00124  ****************************************************************/
00125
00126 int
00127 IbmSockSend (int Socket, const void *Buffer, int Len, int Flags)
00128 {
00129     int Sent, ToSend, TotalSent = 0;
00130
00131     const char *Tmp = Buffer;
00132
00133     /*
00134      * If Flags have been passed in, the 64K boundary optimization
00135      * can not be performed.  For example, MSG_PEEK would not work
00136      * correctly.
00137      */
00138     if (Flags)
00139           return send (Socket, (char *) Buffer, min (0x7FFF, Len), Flags);
00140
00141     do
00142         {
00143           /* Never send across a 64K boundary */
00144           ToSend = min (Len, (int) (0x10000 -  (0xFFFF & (long) Tmp)));
00145
00146           /* Never send more than 32K */
00147           if (ToSend > 0x7FFF)
00148             ToSend = 0x7FFF;
00149
00150           Sent = send (Socket, (char *) Tmp, ToSend, 0);
00151           if (Sent < 0)
00152             {
00153               if ((TotalSent > 0) && (SOCK_ERRNO == EWOULDBLOCK))
00154                 return TotalSent;
00155               if (SOCK_ERRNO == EINTR)
00156                 continue;
00157               return Sent;
00158             }
00159           if (Sent < ToSend)
00160             return TotalSent + Sent;
00161
00162           Tmp += Sent;
00163           TotalSent += Sent;
00164           Len -= Sent;
00165     } while (Len > 0);
00166
00167     return TotalSent;
00168 }
00169
00170
00171
00172 /****************************************************************
00173  * Routine: IbmSockRecv
00174  * Returns: same as recv
00175  * Action : Do the right thing for IBM TCP/IP which includes
00176  *          the following two stupidities:
00177  *          1) Never try to recv more than 32K
00178  *          2) Never pass a buffer that crosses a 64K boundary
00179  *       If Flags is non-zero, this function only attempts
00180  *       to deal with condition (1) above.
00181  ****************************************************************/
00182
00183 int
00184 IbmSockRecv (int Socket, const void *Buffer, int Len, int Flags)
00185 {
00186   int Recvd, ToRecv, TotalRecvd = 0;
00187
00188   char *Tmp = Buffer;
00189
00190   /* If Flags have been passed in, the 64K boundary optimization
00191      probably can not be performed. */
00192
00193     if (Flags)
00194           return recv (Socket, Buffer, min (0x7FFF, Len), Flags);
00195
00196     do
00197     {
00198           /* Never send across a 64K boundary */
00199           ToRecv = min( Len, (int)( 0x10000 - ( 0xFFFF & (long)Tmp )));
00200
00201           /* Never send more than 32K */
00202           if( ToRecv > 0x7FFF )
00203             ToRecv = 0x7FFF;
00204
00205           Recvd = recv (Socket, Tmp, ToRecv, 0);
00206           if (Recvd <= 0)
00207             {
00208               if ((TotalRecvd > 0)
00209                   && (Recvd == 0 || (SOCK_ERRNO == EWOULDBLOCK )))
00210                 return TotalRecvd;
00211               if (SOCK_ERRNO == EINTR)
00212                 continue;
00213
00214               return Recvd;
00215             }
00216           if (Recvd < ToRecv)
00217             return TotalRecvd + Recvd;
00218
00219           Tmp += Recvd;
00220           TotalRecvd += Recvd;
00221           Len -= Recvd;
00222     } while (Len > 0);
00223
00224     return TotalRecvd;
00225 }
00226 #endif /* defined( TCPIP_IBM ) */
00227
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


os2inc.h File Reference

cvs-1.10/os2/os2inc.h File Reference

#include <os2.h>

Include dependency graph for os2inc.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | INCL_BASE
#define | INCL_SUB
#define | INCL_KBD

Define Documentation

#define INCL_BASE

Definition at line 17 of file os2inc.h.

#define INCL_KBD

Definition at line 19 of file os2inc.h.

#define INCL_SUB

Definition at line 18 of file os2inc.h.

Generated on Sun Oct 21 12:43:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


popen.c File Reference

cvs-1.10/os2/popen.c File Reference

#include <process.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <string.h>
#include <fcntl.h>
#include "config.h"
#include "os2inc.h"

Include dependency graph for popen.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | pid_list

Defines

#define | DIAGNOSTIC 0
#define | LL_VAL ULONG
#define | LL_KEY PID
#define | STDIN 0
#define | STDOUT 1
#define | STDERR 2

Functions

void | ll_insert (HFILE key, ULONG val)
void | ll_delete (int key)
ULONG | ll_lookup (HFILE key)
FILE * | popen (const char *Command, const char *Mode)
int | popenRW (const char **argv, int *pipes)
int | pclose (FILE *Pipe)

Variables

pid_list * | pid_ll = (struct pid_list *) NULL

Define Documentation

#define DIAGNOSTIC 0

Definition at line 5 of file popen.c.

#define LL_KEY PID

Definition at line 21 of file popen.c.

#define LL_VAL ULONG

Definition at line 20 of file popen.c.

#define STDERR 2

Definition at line 25 of file popen.c.

#define STDIN 0

Definition at line 23 of file popen.c.

#define STDOUT 1

Definition at line 24 of file popen.c.

Function Documentation

void ll_delete ( int key )

Definition at line 60 of file popen.c.

Referenced by pclose().

00061 {
00062   struct pid_list *this, *last;
00063
00064   this = pid_ll;
00065   last = (struct pid_list *) NULL;
00066
00067   while (this)
00068     {
00069       if (this->pid == key)
00070         {
00071           /* Delete this node and leave. */
00072           if (last)
00073             last->next = this->next;
00074           else
00075             pid_ll = this->next;
00076           free (this);
00077           return;
00078         }
00079
00080       /* Else no match, so try the next one. */
00081       last = this;
00082       this = this->next;
00083     }
00084 }

void ll_insert | ( | HFILE | key,
 |  | ULONG | val
 | ) |

Definition at line 46 of file popen.c.

Referenced by popen(), and popenRW().

00047 {
00048   struct pid_list *new;
00049   new = (struct pid_list *) malloc (sizeof (*new));
00050
00051   new->pid       = key;
00052   new->term_code = val;
00053   new->next      = pid_ll;
00054
00055   pid_ll = new;
00056 }

ULONG ll_lookup ( HFILE key )

Definition at line 87 of file popen.c.

Referenced by pclose().

00088 {
00089   struct pid_list *this = pid_ll;
00090
00091   while (this)
00092     {
00093       if (this->pid == key)
00094         return this->term_code;
00095
00096       /* Else no match, so try the next one. */
00097       this = this->next;
00098     }
00099
00100   /* Zero is special in this context anyway. */
00101   return 0;
00102 }

int pclose ( FILE * stream )

Definition at line 330 of file popen.c.

00331 {
00332     RESULTCODES rc;
00333     PID pid, pid1;
00334     int Handle = fileno (Pipe);
00335
00336     fclose (Pipe);
00337
00338     rc.codeTerminate = -1;
00339
00340     pid1 = (PID) ll_lookup ((LL_KEY) Handle);
00341     /* if pid1 is zero, something's seriously wrong */
00342     if (pid1 != 0)
00343       {
00344         DosWaitChild (DCWA_PROCESSTREE, DCWW_WAIT, &rc, &pid, pid1);
00345         ll_delete ((LL_KEY) Handle);
00346       }
00347     return rc.codeTerminate == 0 ? rc.codeResult : -1;
00348 }

FILE* popen | ( | const char * | cmd,
 |  | const char * | mode
 | ) |

Definition at line 153 of file popen.c.

00154 {
00155     HFILE End1, End2, Std, Old1, Old2, Tmp;
00156
00157     FILE *File;
00158
00159     char    Fail[256],
00160             *Args,
00161             CmdLine[256],
00162             *CmdExe;
00163
00164     RESULTCODES
00165             Result;
00166
00167     int     Rc;
00168
00169     if (DosCreatePipe (&End1, &End2, 4096))
00170         return NULL;
00171
00172     Std = (*Mode == 'w') ? STDIN : STDOUT ;
00173     if (Std == STDIN)
00174     {
00175         Tmp = End1; End1 = End2; End2 = Tmp;
00176     }
00177
00178     Old1 = -1; /* save stdin or stdout */
00179     DosDupHandle (Std, &Old1);
00180     DosSetFHState (Old1, OPEN_FLAGS_NOINHERIT);
00181     Tmp = Std; /* redirect stdin or stdout */
00182     DosDupHandle (End2, &Tmp);
00183
00184     if (Std == 1)
00185     {
00186         Old2 = -1; /* save stderr */
00187         DosDupHandle (STDERR, &Old2);
00188         DosSetFHState (Old2, OPEN_FLAGS_NOINHERIT);
00189         Tmp = STDERR;
00190         DosDupHandle (End2, &Tmp);
00191     }
00192
00193     DosClose (End2);
00194     DosSetFHState (End1, OPEN_FLAGS_NOINHERIT);
00195
00196     if ((CmdExe = getenv ("COMSPEC")) == NULL )
00197         CmdExe = "cmd.exe";
00198
00199     strcpy (CmdLine, CmdExe);
00200     Args = CmdLine + strlen (CmdLine) + 1; /* skip zero */
00201     strcpy (Args, "/c ");
00202     strcat (Args, Command);
00203     Args[strlen (Args) + 1] = '\0'; /* two zeroes */
00204     Rc = DosExecPgm (Fail, sizeof (Fail), EXEC_ASYNCRESULT,
00205                      (unsigned char *) CmdLine, 0, &Result,
00206                      (unsigned char *) CmdExe);
00207
00208     Tmp = Std; /* restore stdin or stdout */
00209     DosDupHandle (Old1, &Tmp);
00210     DosClose (Old1);
00211
00212     if (Std == STDOUT)
00213     {
00214         Tmp = STDERR;   /* restore stderr */
00215         DosDupHandle (Old2, &Tmp);
00216         DosClose (Old2);
00217     }
00218
00219     if (Rc)
00220     {
00221         DosClose (End1);
00222         return NULL;
00223     }
00224
00225 #ifdef __WATCOMC__
00226     /* Watcom does not allow mixing operating system handles and
00227      * C library handles, so we have to convert.
00228      */
00229     File = fdopen (_hdopen (End1, *Mode == 'w'? O_WRONLY : O_RDONLY), Mode);
00230 #else
00231     File = fdopen (End1, Mode);
00232 #endif
00233     ll_insert ((LL_KEY) End1, (LL_VAL) Result.codeTerminate);
00234
00235     return File;
00236 }

int popenRW | ( | const char ** | argv,
 |  | int * | pipes
 | ) |

Definition at line 250 of file popen.c.

00251 {
00252     HFILE Out1, Out2, In1, In2;
00253     HFILE Old0 = -1, Old1 = -1, Old2 = -1, Tmp;
00254
00255     int pid;
00256
00257     if (DosCreatePipe (&Out2, &Out1, 4096))
00258         return FALSE;
00259
00260     if (DosCreatePipe (&In1, &In2, 4096))
00261     {
00262         DosClose (Out1);
00263         DosClose (Out2);
00264         return FALSE;
00265     }
00266
00267     /* Save std{in,out,err} */
00268     DosDupHandle (STDIN, &Old0);
00269     DosSetFHState (Old1, OPEN_FLAGS_NOINHERIT);
00270     DosDupHandle (STDOUT, &Old1);
00271     DosSetFHState (Old2, OPEN_FLAGS_NOINHERIT);
00272     DosDupHandle (STDERR, &Old2);
00273     DosSetFHState (Old2, OPEN_FLAGS_NOINHERIT);
00274
00275     /* Redirect std{in,out,err} */
00276     Tmp = STDIN;
00277     DosDupHandle (In1, &Tmp);
00278     Tmp = STDOUT;
00279     DosDupHandle (Out1, &Tmp);
00280     Tmp = STDERR;
00281     DosDupHandle (Out1, &Tmp);
00282
00283     /* Close file handles not needed in child */
00284
00285     DosClose (In1);
00286     DosClose (Out1);
00287     DosSetFHState (In2, OPEN_FLAGS_NOINHERIT);
00288     DosSetFHState (Out2, OPEN_FLAGS_NOINHERIT);
00289
00290     /* Spawn we now our hoary brood. */
00291     pid = spawnvp (P_NOWAIT, argv[0], argv);
00292
00293     /* Restore std{in,out,err} */
00294     Tmp = STDIN;
00295     DosDupHandle (Old0, &Tmp);
00296     DosClose (Old0);
00297     Tmp = STDOUT;
00298     DosDupHandle (Old1, &Tmp);
00299     DosClose (Old1);
00300     Tmp = STDERR;
00301     DosDupHandle (Old2, &Tmp);
00302     DosClose (Old2);
00303
00304     if(pid < 0)
00305       {
00306         DosClose (In2);
00307         DosClose (Out2);
00308         return -1;
00309       }
00310
00311     pipes[0] = In2;
00312     _setmode (pipes[0], O_BINARY);
00313     pipes[1] = Out2;
00314     _setmode (pipes[1], O_BINARY);
00315
00316     /* Save ID of write-to-child pipe for pclose() */
00317     ll_insert ((LL_KEY) In2, (LL_VAL) pid);
00318
00319     return pid;
00320 }

Variable Documentation

struct pid_list* pid_ll = (struct pid_list *) NULL [static]

Definition at line 41 of file popen.c.

Generated on Sun Oct 21 12:43:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


popen.h File Reference

cvs-1.10/os2/popen.h File Reference

Go to the source code of this file.

Functions

FILE * | popen (const char *cmd, const char *mode)
int | popenRW (char **cmd, int *pipes)
int | pclose (FILE *stream)

Function Documentation

int pclose ( FILE * stream )

FILE* popen | ( | const char * | cmd,
 |  | const char * | mode
 | ) |

int popenRW | ( | char ** | cmd,
 |  | int * | pipes
 | ) |

Generated on Sun Oct 21 12:43:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


porttcp.c File Reference

cvs-1.10/os2/porttcp.c File Reference

#include <stdio.h>
#include "tcpip.h"

Include dependency graph for porttcp.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | TCPIP_IBM_NOHIDE

Functions

const char * | SockStrError (int SockErrno)
const char * | HostStrError (int HostErrno)

Variables

char | ErrUnknownBuf [36]

Define Documentation

#define TCPIP_IBM_NOHIDE

Definition at line 7 of file porttcp.c.

Function Documentation

const char* HostStrError ( int HostErrno )

Definition at line 94 of file porttcp.c.

00095 {
00096   switch (HostErrno)
00097     {
00098     case HOST_NOT_FOUND:
00099       return "Host not found";
00100     case TRY_AGAIN:
00101       return "Host not found (suggest try again)";
00102     case NO_RECOVERY:
00103       return "Non-recoverable error: FORMERR, REFUSED, NOTIMP";
00104     case NO_DATA:
00105       return "No Data (valid name, but no record of requested type)";
00106
00107     default:
00108       sprintf( ErrUnknownBuf, "HostStrErrno( %d ) unknown", HostErrno );
00109       return ErrUnknownBuf;
00110     }
00111 }

const char* SockStrError ( int SockErrno )

Definition at line 25 of file porttcp.c.

00026 {
00027 #if defined (TCPIP_IBM)  && defined (IBM_CPP)
00028   switch (SockErrno)
00029     {
00030     case SOCEPERM:      return "Not owner";
00031     case SOCESRCH:      return "No such process";
00032     case SOCEINTR:      return "Interrupted system call";
00033     case SOCENXIO:      return "No such device or address";
00034     case SOCEBADF:      return "Bad file number";
00035     case SOCEACCES:     return "Permission denied";
00036     case SOCEFAULT:     return "Bad address";
00037     case SOCEINVAL:     return "Invalid argument";
00038     case SOCEMFILE:     return "Too many open files";
00039     case SOCEPIPE:      return "Broken pipe";
00040     case SOCEOS2ERR:        return "OS/2 Error";
00041     case SOCEWOULDBLOCK:    return "Operation would block";
00042     case SOCEINPROGRESS:    return "Operation now in progress";
00043     case SOCEALREADY:       return "Operation already in progress";
00044     case SOCENOTSOCK:       return "Socket operation on non-socket";
00045     case SOCEDESTADDRREQ:   return "Destination address required";
00046     case SOCEMSGSIZE:       return "Message too long";
00047     case SOCEPROTOTYPE:     return "Protocol wrong type for socket";
00048     case SOCENOPROTOOPT:    return "Protocol not available";
00049     case SOCEPROTONOSUPPORT:    return "Protocol not supported";
00050     case SOCESOCKTNOSUPPORT:    return "Socket type not supported";
00051     case SOCEOPNOTSUPP:     return "Operation not supported on socket";
00052     case SOCEPFNOSUPPORT:   return "Protocol family not supported";
00053     case SOCEAFNOSUPPORT:
00054       return "Address family not supported by protocol family";
00055     case SOCEADDRINUSE:     return "Address already in use";
00056     case SOCEADDRNOTAVAIL:  return "Can't assign requested address";
00057     case SOCENETDOWN:       return "Network is down";
00058     case SOCENETUNREACH:    return "Network is unreachable";
00059     case SOCENETRESET:      return "Network dropped connection on reset";
00060     case SOCECONNABORTED:   return "Software caused connection abort";
00061     case SOCECONNRESET:     return "Connection reset by peer";
00062     case SOCENOBUFS:        return "No buffer space available";
00063     case SOCEISCONN:        return "Socket is already connected";
00064     case SOCENOTCONN:       return "Socket is not connected";
00065     case SOCESHUTDOWN:      return "Can't send after socket shutdown";
00066     case SOCETOOMANYREFS:   return "Too many references: can't splice";
00067     case SOCETIMEDOUT:      return "Connection timed out";
00068     case SOCECONNREFUSED:   return "Connection refused";
00069     case SOCELOOP:      return "Too many levels of symbolic links";
00070     case SOCENAMETOOLONG:   return "File name too long";
00071     case SOCEHOSTDOWN:      return "Host is down";
00072     case SOCEHOSTUNREACH:   return "No route to host";
00073     case SOCENOTEMPTY:      return "Directory not empty";
00074
00075     default:
00076       sprintf( ErrUnknownBuf, "SockStrErrno( %d ) unknown", SockErrno );
00077       return ErrUnknownBuf;
00078     }
00079 #else
00080 #error  SockStrError not supported for this OS
00081 #endif
00082 }

Variable Documentation

char ErrUnknownBuf[36] [static]

Definition at line 14 of file porttcp.c.

Generated on Sun Oct 21 12:43:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pwd.c File Reference

cvs-1.10/os2/pwd.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>

Include dependency graph for pwd.c:

Include dependency graph

Go to the source code of this file.

Functions

char * | lookup_env (char **)
passwd * | getpwuid (int uid)
passwd * | getpwnam (char *name)
group * | getgrgid (int uid)
group * | getgrnam (char *name)
char * | getlogin ()
char * | getgr_name ()
int | getuid ()
int | getgid ()
int | geteuid ()
int | getegid ()
passwd * getpwent ()
void | setpwent ()
void | endpwent ()
void | endgrent ()
int | getgroups (int ngroups, int *groups)
char * | lookup_env (char *table[])

Variables

char * | login_strings []
char * | group_strings []
char * | anonymous = "anonymous"
char * | home_dir = "."
char * | login_shell = "not cmd.exe!"
char * | login = (char *) 0
char * | group = (char *) 0
passwd pw
group gr

Function Documentation

void endgrent ( void )

Definition at line 153 of file pwd.c.

00154 {
00155 }

void endpwent ( void )

Definition at line 148 of file pwd.c.

00149 {
00150 }

int getegid ( void )

Definition at line 131 of file pwd.c.

00132 {
00133   return 0;
00134 }

int geteuid ( void )

Definition at line 125 of file pwd.c.

00126 {
00127   return 0;
00128 }

int getgid ( void )

Definition at line 119 of file pwd.c.

00120 {
00121   return 0;
00122 }

char* getgr_name ( void )

Definition at line 100 of file pwd.c.

Referenced by getgrgid().

00101 {
00102   if (!group)           /* have we been called before? */
00103     group = lookup_env (group_strings);
00104
00105   if (!group)           /* have we been successful? */
00106     group = anonymous;
00107
00108   return group;
00109 }

struct group* getgrgid ( int uid )

Definition at line 71 of file pwd.c.

00072 {
00073   gr.gr_name = getgr_name ();
00074   gr.gr_gid = 0;
00075
00076   return &gr;
00077 }

struct group* getgrnam ( char * name )

Definition at line 80 of file pwd.c.

00081 {
00082   return (struct group *) 0;
00083 }

int getgroups | ( | int | ngroups,
 |  | int * | groups
 | ) |

Definition at line 159 of file pwd.c.

00160 {
00161   *groups = 0;
00162   return 1;
00163 }

char* getlogin ( void )

Definition at line 87 of file pwd.c.

Referenced by getpwuid().

00088 {
00089   if (!login)           /* have we been called before? */
00090     login = lookup_env (login_strings);
00091
00092   if (!login)           /* have we been successful? */
00093     login = anonymous;
00094
00095   return login;
00096 }

struct passwd* getpwent ( void )

Definition at line 137 of file pwd.c.

00138 {
00139   return (struct passwd *) 0;
00140 }

struct passwd* getpwnam ( char * name )

Definition at line 64 of file pwd.c.

00065 {
00066   return (struct passwd *) 0;
00067 }

struct passwd* getpwuid ( int uid )

Definition at line 53 of file pwd.c.

00054 {
00055   pw.pw_name = getlogin ();
00056   pw.pw_dir = home_dir;
00057   pw.pw_shell = login_shell;
00058   pw.pw_uid = 0;
00059
00060   return &pw;
00061 }

int getuid ( void )

Definition at line 113 of file pwd.c.

00114 {
00115   return 0;         /* every user is a super user ... */
00116 }

char* lookup_env ( char * table[] ) [static]

Definition at line 167 of file pwd.c.

00168 {
00169   char *ptr;
00170   char *entry;
00171   size_t len;
00172
00173   while (*table && !(ptr = getenv (*table++))) ;    /* scan table */
00174
00175   if (!ptr)
00176     return (char *) 0;
00177
00178   len = strcspn (ptr, " \n\t\n\r"); /* any WS?    */
00179   if (!(entry = malloc (len + 1)))
00180     {
00181       fprintf (stderr, "Out of memory.\nStop.");
00182       exit (-1);
00183     }
00184
00185   strncpy (entry, ptr, len);
00186   entry[len] = '\0';
00187
00188   return entry;
00189
00190 }

char* lookup_env ( char ** ) [static]

void setpwent ( void )

Definition at line 143 of file pwd.c.

00144 {
00145 }

Variable Documentation

char* anonymous = "anonymous" [static]

Definition at line 40 of file pwd.c.

struct group gr [static]

Definition at line 49 of file pwd.c.

char* group = (char *) 0 [static]

Definition at line 46 of file pwd.c.

char* group_strings[] [static]

Initial value:

{
  "GROUP", (char *) 0
}

Definition at line 34 of file pwd.c.

char* home_dir = "." [static]

Definition at line 42 of file pwd.c.

char* login = (char *) 0 [static]

Definition at line 45 of file pwd.c.

char* login_shell = "not cmd.exe!" [static]

Definition at line 43 of file pwd.c.

char* login_strings[] [static]

Initial value:

{
  "LOGIN", "USER", "MAILNAME", (char *) 0
}

Definition at line 29 of file pwd.c.

struct passwd pw [static]

Definition at line 48 of file pwd.c.

Generated on Sun Oct 21 12:43:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/pwd.c Source File

cvs-1.10/os2/pwd.c

Go to the documentation of this file.
00001 /*  pwd.c - Try to approximate UN*X's getuser...() functions under MS-DOS.
00002     Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
00003
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 1, or (at your option)
00007     any later version.
00008
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.  */
00013
00014 /* This 'implementation' is conjectured from the use of this functions in
00015    the RCS and BASH distributions.  Of course these functions don't do too
00016    much useful things under MS-DOS, but using them avoids many "#ifdef
00017    MSDOS" in ported UN*X code ...  */
00018
00019
00020 #include <stdio.h>
00021 #include <stdlib.h>
00022 #include <string.h>
00023 #include <pwd.h>
00024
00025 static char *lookup_env (char **);
00026
00027 /* where people might scribble their name into the environment ... */
00028
00029 static char *login_strings[] =
00030 {
00031   "LOGIN", "USER", "MAILNAME", (char *) 0
00032 };
00033
00034 static char *group_strings[] =
00035 {
00036   "GROUP", (char *) 0
00037 };
00038
00039
00040 static char *anonymous = "anonymous";   /* if all else fails ... */
00041
00042 static char *home_dir = ".";    /* we feel (no|every)where at home */
00043 static char *login_shell = "not cmd.exe!";
00044
00045 static char *login = (char *) 0;/* cache the names here */
00046 static char *group = (char *) 0;
00047
00048 static struct passwd pw;    /* should we return a malloc()'d structure   */
00049 static struct group gr;     /* instead of pointers to static structures? */
00050
00051 /* return something like a username in a (butchered!) passwd structure. */
00052 struct passwd *
00053 getpwuid (int uid)
00054 {
00055   pw.pw_name = getlogin ();
00056   pw.pw_dir = home_dir;
00057   pw.pw_shell = login_shell;
00058   pw.pw_uid = 0;
00059
00060   return &pw;
00061 }
00062
00063 struct passwd *
00064 getpwnam (char *name)
00065 {
00066   return (struct passwd *) 0;
00067 }
00068
00069 /* return something like a groupname in a (butchered!) group structure. */
00070 struct group *
00071 getgrgid (int uid)
00072 {
00073   gr.gr_name = getgr_name ();
00074   gr.gr_gid = 0;
00075
00076   return &gr;
00077 }
00078
00079 struct group *
00080 getgrnam (char *name)
00081 {
00082   return (struct group *) 0;
00083 }
00084
00085 /* return something like a username. */
00086 char *
00087 getlogin ()
00088 {
00089   if (!login)           /* have we been called before? */
00090     login = lookup_env (login_strings);
00091
00092   if (!login)           /* have we been successful? */
00093     login = anonymous;
00094
00095   return login;
00096 }
00097
00098 /* return something like a group.  */
00099 char *
00100 getgr_name ()
00101 {
00102   if (!group)           /* have we been called before? */
00103     group = lookup_env (group_strings);
00104
00105   if (!group)           /* have we been successful? */
00106     group = anonymous;
00107
00108   return group;
00109 }
00110
00111 /* return something like a uid.  */
00112 int
00113 getuid ()
00114 {
00115   return 0;         /* every user is a super user ... */
00116 }
00117
00118 int
00119 getgid ()
00120 {
00121   return 0;
00122 }
00123
00124 int
00125 geteuid ()
00126 {
00127   return 0;
00128 }
00129
00130 int
00131 getegid ()
00132 {
00133   return 0;
00134 }
00135
00136 struct passwd *
00137 getpwent ()
00138 {
00139   return (struct passwd *) 0;
00140 }
00141
00142 void
00143 setpwent ()
00144 {
00145 }
00146
00147 void
00148 endpwent ()
00149 {
00150 }
00151
00152 void
00153 endgrent ()
00154 {
00155 }
00156
00157 /* return groups.  */
00158 int
00159 getgroups (int ngroups, int *groups)
00160 {
00161   *groups = 0;
00162   return 1;
00163 }
00164
00165 /* lookup environment.  */
00166 static char *
00167 lookup_env (char *table[])
00168 {
00169   char *ptr;
00170   char *entry;
00171   size_t len;
00172
00173   while (*table && !(ptr = getenv (*table++))) ;    /* scan table */
00174
00175   if (!ptr)
00176     return (char *) 0;
00177
00178   len = strcspn (ptr, " \n\t\n\r"); /* any WS?    */
00179   if (!(entry = malloc (len + 1)))
00180     {
00181       fprintf (stderr, "Out of memory.\nStop.");
00182       exit (-1);
00183     }
00184
00185   strncpy (entry, ptr, len);
00186   entry[len] = '\0';
00187
00188   return entry;
00189
00190 }
00191
00192 /*
00193  * Local Variables:
00194  * mode:C
00195  * ChangeLog:ChangeLog
00196  * compile-command:make
00197  * End:
00198  */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pwd.h File Reference

cvs-1.10/os2/pwd.h File Reference

Go to the source code of this file.

Compounds

struct | group
struct | passwd

Functions

passwd * | getpwuid (int)
passwd * | getpwnam (char *)
group * | getgrgid (int)
group * | getgrnam (char *)
char * | getlogin (void)
char * | getgr_name (void)
int | getuid (void)
int | getgid (void)
int | geteuid (void)
int | getegid (void)
int | getgroups (int, int *)
passwd * | getpwent (void)
void | setpwent (void)
void | endpwent (void)
void | endgrent (void)

Variables

int * | groups
int | ngroups

Function Documentation

void endgrent ( void )

Definition at line 160 of file pwd.c.

00161 {
00162 }

void endpwent ( void )

Definition at line 155 of file pwd.c.

00156 {
00157 }

int getegid ( void )

Definition at line 138 of file pwd.c.

00139 {
00140   return 0;
00141 }

int geteuid ( void )

Definition at line 132 of file pwd.c.

00133 {
00134   return 0;
00135 }

int getgid ( void )

Definition at line 126 of file pwd.c.

00127 {
00128   return 0;
00129 }

char* getgr_name ( void )

Definition at line 107 of file pwd.c.

00108 {
00109   if (!group)           /* have we been called before? */
00110     group = lookup_env (group_strings);
00111
00112   if (!group)           /* have we been successful? */
00113     group = anonymous;
00114
00115   return group;
00116 }

struct group* getgrgid ( int uid )

Definition at line 72 of file pwd.c.

00073 {
00074   gr.gr_name = getgr_name ();
00075   gr.gr_gid = 0;
00076
00077   return &gr;
00078 }

struct group* getgrnam ( char * name )

Definition at line 81 of file pwd.c.

00082 {
00083   return (struct group *) 0;
00084 }

int getgroups | ( | int | ngroups,
 |  | int * | groups
 | ) |

Definition at line 166 of file pwd.c.

00167 {
00168   *groups = 0;
00169   return 1;
00170 }

char* getlogin ( void )

Definition at line 16 of file pwd.c.

00017 {
00018   static char login[256];
00019   return cuserid(login);
00020 }

struct passwd* getpwent ( void )

Definition at line 144 of file pwd.c.

00145 {
00146   return (struct passwd *) 0;
00147 }

struct passwd* getpwnam ( char * name )

Definition at line 65 of file pwd.c.

00066 {
00067   return (struct passwd *) 0;
00068 }

struct passwd* getpwuid ( int uid )

Definition at line 54 of file pwd.c.

00055 {
00056   pw.pw_name = getlogin ();
00057   pw.pw_dir = home_dir;
00058   pw.pw_shell = login_shell;
00059   pw.pw_uid = 0;
00060
00061   return &pw;
00062 }

int getuid ( void )

Definition at line 120 of file pwd.c.

00121 {
00122   return 0;         /* every user is a super user ... */
00123 }

void setpwent ( void )

Definition at line 150 of file pwd.c.

00151 {
00152 }

Variable Documentation

int* groups

Definition at line 55 of file pwd.h.

int ngroups

Definition at line 56 of file pwd.h.

Generated on Sun Oct 21 12:43:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/pwd.h Source File

cvs-1.10/os2/pwd.h

Go to the documentation of this file.
00001 /*  pwd.h - Try to approximate UN*X's getuser...() functions under MS-DOS.
00002     Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
00003
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 1, or (at your option)
00007     any later version.
00008
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.  */
00013
00014 /* This 'implementation' is conjectured from the use of this functions in
00015    the RCS and BASH distributions.  Of course these functions don't do too
00016    much useful things under MS-DOS, but using them avoids many "#ifdef
00017    MSDOS" in ported UN*X code ...  */
00018
00019 #if 0
00020 /* This is taken care of in Windows-NT/config.h.  */
00021 typedef int uid_t;
00022 #endif
00023
00024 struct passwd
00025 {
00026   /*    ...     */
00027   /*    missing stuff   */
00028   /*    ...     */
00029   char *pw_name;        /* login user id        */
00030   char *pw_dir;         /* home directory       */
00031   char *pw_shell;       /* login shell          */
00032   int  pw_uid;
00033 };
00034
00035 struct group
00036 {
00037   /*    ...     */
00038   /*    missing stuff   */
00039   /*    ...     */
00040   char *gr_name;        /* login user id        */
00041   int  gr_gid;
00042 };
00043
00044 extern struct passwd *getpwuid (int);
00045 extern struct passwd *getpwnam (char *);
00046 extern struct group *getgrgid (int);
00047 extern struct group *getgrnam (char *);
00048 extern char *getlogin (void);
00049 extern char *getgr_name (void);
00050 extern int getuid (void);
00051 extern int getgid (void);
00052 extern int geteuid (void);
00053 extern int getegid (void);
00054
00055 extern int *groups;
00056 extern int ngroups;
00057 extern int getgroups (int, int *);
00058
00059 extern struct passwd *getpwent (void);
00060 extern void setpwent (void);
00061 extern void endpwent (void);
00062 extern void endgrent (void);
00063
00064 /*
00065  * Local Variables:
00066  * mode:C
00067  * ChangeLog:ChangeLog
00068  * compile-command:make
00069  * End:
00070  */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcmd.c File Reference

cvs-1.10/os2/rcmd.c File Reference

#include <io.h>
#include <stdio.h>
#include <fcntl.h>
#include <malloc.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <assert.h>
#include "rcmd.h"

Include dependency graph for rcmd.c:

Include dependency graph

Go to the source code of this file.

Functions

void | init_sockets ()
int | resolve_address (const char **ahost, struct sockaddr_in *sai)
int | bind_and_connect (struct sockaddr_in *server_sai)
int | rcmd_authenticate (int fd, char *locuser, char *remuser, char *command)
int | rcmd (const char **ahost, unsigned short inport, char *locuser, char *remuser, char *cmd, int *fd2p)

Function Documentation

int bind_and_connect ( struct sockaddr_in * server_sai ) [static]

Definition at line 50 of file rcmd.c.

00051 {
00052     fprintf (stderr,
00053              "Error: bind_and_connect() doesn't work.\n");
00054     exit (1);
00055 }

void init_sockets ( )

Definition at line 28 of file rcmd.c.

00029 {
00030     int rc;
00031
00032     rc = sock_init ();
00033     if (rc != 0)
00034     {
00035       fprintf (stderr, "sock_init() failed -- returned %d!\n", rc);
00036       exit (1);
00037     }
00038 }

int rcmd | ( | const char ** | AHOST,
 |  | unsigned short | INPORT,
 |  | char * | LOCUSER,
 |  | char * | REMUSER,
 |  | char * | CMD,
 |  | int * | fd2p
 | ) |

Definition at line 66 of file rcmd.c.

00072 {
00073     fprintf (stderr,
00074              "Error: rcmd() doesn't work.\n");
00075     exit (1);
00076 }

int rcmd_authenticate | ( | int | fd,
 |  | char * | locuser,
 |  | char * | remuser,
 |  | char * | command
 | ) | [static]

Definition at line 58 of file rcmd.c.

00059 {
00060     fprintf (stderr,
00061              "Error: rcmd_authenticate() doesn't work.\n");
00062     exit (1);
00063 }

int resolve_address | ( | const char ** | ahost,
 |  | struct sockaddr_in * | sai
 | ) | [static]

Definition at line 42 of file rcmd.c.

00043 {
00044     fprintf (stderr,
00045              "Error: resolve_address() doesn't work.\n");
00046     exit (1);
00047 }

Generated on Sun Oct 21 12:43:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/rcmd.c Source File

cvs-1.10/os2/rcmd.c

Go to the documentation of this file.
00001 /* rcmd.c --- execute a command on a remote host from OS/2
00002    Karl Fogel <kfogel@cyclic.com> --- November 1995  */
00003
00004 /* This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #include <io.h>
00015 #include <stdio.h>
00016 #include <fcntl.h>
00017 #include <malloc.h>
00018 #include <errno.h>
00019 /* <sys/socket.h> wants `off_t': */
00020 #include <sys/types.h>
00021 /* This should get us ibmtcpip\include\sys\socket.h: */
00022 #include <sys/socket.h>
00023 #include <assert.h>
00024
00025 #include "rcmd.h"
00026
00027 void
00028 init_sockets ()
00029 {
00030     int rc;
00031
00032     rc = sock_init ();
00033     if (rc != 0)
00034     {
00035       fprintf (stderr, "sock_init() failed -- returned %d!\n", rc);
00036       exit (1);
00037     }
00038 }
00039
00040
00041 static int
00042 resolve_address (const char **ahost, struct sockaddr_in *sai)
00043 {
00044     fprintf (stderr,
00045              "Error: resolve_address() doesn't work.\n");
00046     exit (1);
00047 }
00048
00049 static int
00050 bind_and_connect (struct sockaddr_in *server_sai)
00051 {
00052     fprintf (stderr,
00053              "Error: bind_and_connect() doesn't work.\n");
00054     exit (1);
00055 }
00056
00057 static int
00058 rcmd_authenticate (int fd, char *locuser, char *remuser, char *command)
00059 {
00060     fprintf (stderr,
00061              "Error: rcmd_authenticate() doesn't work.\n");
00062     exit (1);
00063 }
00064
00065 int
00066 rcmd (const char **ahost,
00067       unsigned short inport,
00068       char *locuser,
00069       char *remuser,
00070       char *cmd,
00071       int *fd2p)
00072 {
00073     fprintf (stderr,
00074              "Error: rcmd() doesn't work.\n");
00075     exit (1);
00076 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcmd.h File Reference

cvs-1.10/os2/rcmd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int rcmd (const char **AHOST, unsigned short INPORT, char *LOCUSER, char *REMUSER, char *CMD, int *fd2p)

Function Documentation

int rcmd | ( | const char ** | AHOST,
 |  | unsigned short | INPORT,
 |  | char * | LOCUSER,
 |  | char * | REMUSER,
 |  | char * | CMD,
 |  | int * | fd2p
 | ) |

Definition at line 183 of file rcmd.c.

00189 {
00190     struct sockaddr_in sai;
00191     SOCKET s;
00192
00193     assert (fd2p == 0);
00194
00195     if (resolve_address (ahost, &sai) < 0)
00196         error (1, 0, "internal error: resolve_address < 0");
00197
00198     sai.sin_port = htons (inport);
00199
00200     if ((s = bind_and_connect (&sai)) == INVALID_SOCKET)
00201     error (1, 0, "internal error: bind_and_connect < 0");
00202
00203     if (rcmd_authenticate (s, locuser, remuser, cmd) < 0)
00204     error (1, 0, "internal error: rcmd_authenticate < 0");
00205
00206     return s;
00207 }

Generated on Sun Oct 21 12:42:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/rcmd.h Source File

cvs-1.10/os2/rcmd.h

Go to the documentation of this file.
00001 /* rcmd.h --- interface to executing commands on remote hosts
00002    Karl Fogel <kfogel@cyclic.com> --- November 1995  */
00003
00004 /* This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 /* Run the command CMD on the host *AHOST, and return a file descriptor for
00015    a bidirectional stream socket connected to the command's standard input
00016    and output.
00017
00018    rcmd looks up *AHOST using gethostbyname, and sets *AHOST to the host's
00019    canonical name.  If *AHOST is not found, rcmd returns -1.
00020
00021    rcmd connects to the remote host at TCP port INPORT.  This should
00022    probably be the "shell" service, port 514.
00023
00024    LOCUSER is the name of the user on the local machine, and REMUSER is
00025    the name of the user on the remote machine; the remote machine uses this,
00026    along with the source address of the TCP connection, to authenticate
00027    the connection.
00028
00029    CMD is the command to execute.  The remote host will tokenize it any way
00030    it damn well pleases.  Welcome to Unix.
00031
00032    FD2P is a feature we don't support, but there's no point in making mindless
00033    deviations from the interface.  Callers should always pass this argument
00034    as zero.  */
00035 extern int rcmd (const char **AHOST,
00036          unsigned short INPORT,
00037          char *LOCUSER,
00038          char *REMUSER,
00039          char *CMD,
00040          int *fd2p);
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


run.c File Reference

cvs-1.10/os2/run.c File Reference

#include "cvs.h"
#include "os2inc.h"
#include <process.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <io.h>

Include dependency graph for run.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | STDIN 0
#define | STDOUT 1
#define | STDERR 2

Functions

void run_add_arg | PROTO ((const char *s))
void run_init_prog | PROTO ((void))
char * | strtok ()
void | run_setup (const char *prog)
void | run_arg (s) const char *s

Variables

char ** | run_argv
int | run_argc
int | run_argc_allocated
char * | stout
char * | sterr
int | flags
const char * | mode

Define Documentation

#define STDERR 2

Definition at line 32 of file run.c.

#define STDIN 0

Definition at line 30 of file run.c.

#define STDOUT 1

Definition at line 31 of file run.c.

Function Documentation

void run_init_prog PROTO ( (void) ) [static]

void run_add_arg PROTO ( (const char *s) ) [static]

void run_arg ( s ) const

void run_setup ( const char * prog )

Definition at line 58 of file run.c.

00059 {
00060     char *cp;
00061     int i;
00062
00063     char *run_prog;
00064
00065     /* clean out any malloc'ed values from run_argv */
00066     for (i = 0; i < run_argc; i++)
00067     {
00068     if (run_argv[i])
00069     {
00070         free (run_argv[i]);
00071         run_argv[i] = (char *) 0;
00072     }
00073     }
00074     run_argc = 0;
00075
00076     run_prog = xstrdup (prog);
00077
00078     /* put each word into run_argv, allocating it as we go */
00079     for (cp = strtok (run_prog, " \t"); cp; cp = strtok ((char *) NULL, " \t"))
00080     run_add_arg (cp);
00081
00082     free (run_prog)
00083 }

char* strtok ( )

Referenced by KoFilterModel::SetMask(), and run_setup().

Variable Documentation

int flags

Definition at line 136 of file run.c.

const char* mode

Definition at line 302 of file run.c.

int run_argc [static]

Definition at line 54 of file run.c.

int run_argc_allocated [static]

Definition at line 55 of file run.c.

char** run_argv [static]

Definition at line 53 of file run.c.

char* sterr

Definition at line 135 of file run.c.

char* stout

Definition at line 134 of file run.c.

Generated on Sun Oct 21 12:43:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/run.c Source File

cvs-1.10/os2/run.c

Go to the documentation of this file.
00001 /* run.c --- routines for executing subprocesses under OS/2.
00002
00003    This file is part of GNU CVS.
00004
00005    GNU CVS is free software; you can redistribute it and/or modify it
00006    under the terms of the GNU General Public License as published by the
00007    Free Software Foundation; either version 2, or (at your option) any
00008    later version.
00009
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.  */
00014
00015 #include "cvs.h"
00016
00017 #include "os2inc.h"
00018
00019 #include <process.h>
00020
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023 #include <sys/types.h>
00024 #include <sys/stat.h>
00025 #include <string.h>
00026 #include <fcntl.h>
00027 #include <errno.h>
00028 #include <io.h>
00029
00030 #define STDIN       0
00031 #define STDOUT      1
00032 #define STDERR      2
00033
00034 static void run_add_arg PROTO((const char *s));
00035 static void run_init_prog PROTO((void));
00036
00037 extern char *strtok ();
00038
00039 /*
00040  * To exec a program under CVS, first call run_setup() to setup any initial
00041  * arguments.  The options to run_setup are essentially like printf(). The
00042  * arguments will be parsed into whitespace separated words and added to the
00043  * global run_argv list.
00044  *
00045  * Then, optionally call run_arg() for each additional argument that you'd like
00046  * to pass to the executed program.
00047  *
00048  * Finally, call run_exec() to execute the program with the specified
00049  * arguments.
00050  * The execvp() syscall will be used, so that the PATH is searched correctly.
00051  * File redirections can be performed in the call to run_exec().
00052  */
00053 static char **run_argv;
00054 static int run_argc;
00055 static int run_argc_allocated;
00056
00057 void
00058 run_setup (const char *prog)
00059 {
00060     char *cp;
00061     int i;
00062
00063     char *run_prog;
00064
00065     /* clean out any malloc'ed values from run_argv */
00066     for (i = 0; i < run_argc; i++)
00067     {
00068     if (run_argv[i])
00069     {
00070         free (run_argv[i]);
00071         run_argv[i] = (char *) 0;
00072     }
00073     }
00074     run_argc = 0;
00075
00076     run_prog = xstrdup (prog);
00077
00078     /* put each word into run_argv, allocating it as we go */
00079     for (cp = strtok (run_prog, " \t"); cp; cp = strtok ((char *) NULL, " \t"))
00080     run_add_arg (cp);
00081
00082     free (run_prog)
00083 }
00084
00085 void
00086 run_arg (s)
00087     const char *s;
00088 {
00089     run_add_arg (s);
00090 }
00091
00092 /* Return a malloc'd copy of s, with double quotes around it.  */
00093 static char *
00094 quote (const char *s)
00095 {
00096     size_t s_len = strlen (s);
00097     char *copy = xmalloc (s_len + 3);
00098     char *scan = copy;
00099
00100     *scan++ = '"';
00101     strcpy (scan, s);
00102     scan += s_len;
00103     *scan++ = '"';
00104     *scan++ = '\0';
00105
00106     return copy;
00107 }
00108
00109 static void
00110 run_add_arg (s)
00111     const char *s;
00112 {
00113     /* allocate more argv entries if we've run out */
00114     if (run_argc >= run_argc_allocated)
00115     {
00116     run_argc_allocated += 50;
00117     run_argv = (char **) xrealloc ((char *) run_argv,
00118                      run_argc_allocated * sizeof (char **));
00119     }
00120
00121     if (s)
00122     {
00123     run_argv[run_argc] = (run_argc ? quote (s) : xstrdup (s));
00124     run_argc++;
00125     }
00126     else
00127         /* not post-incremented on purpose! */
00128     run_argv[run_argc] = (char *) 0;
00129 }
00130
00131 int
00132 run_exec (stin, stout, sterr, flags)
00133     char *stin;
00134     char *stout;
00135     char *sterr;
00136     int flags;
00137 {
00138     int shin, shout, sherr;
00139     int sain, saout, saerr; /* saved handles */
00140     int mode_out, mode_err;
00141     int status = -1;
00142     int rerrno = 0;
00143     int rval   = -1;
00144     void (*old_sigint) (int);
00145
00146     if (trace)          /* if in trace mode */
00147     {
00148     (void) fprintf (stderr, "-> system(");
00149     run_print (stderr);
00150     (void) fprintf (stderr, ")\n");
00151     }
00152     if (noexec && (flags & RUN_REALLY) == 0) /* if in noexec mode */
00153     return (0);
00154
00155     /*
00156      * start the engine and take off
00157      */
00158
00159     /* make sure that we are null terminated, since we didn't calloc */
00160     run_add_arg ((char *) 0);
00161
00162     /* setup default file descriptor numbers */
00163     shin = 0;
00164     shout = 1;
00165     sherr = 2;
00166
00167     /* set the file modes for stdout and stderr */
00168     mode_out = mode_err = O_WRONLY | O_CREAT;
00169     mode_out |= ((flags & RUN_STDOUT_APPEND) ? O_APPEND : O_TRUNC);
00170     mode_err |= ((flags & RUN_STDERR_APPEND) ? O_APPEND : O_TRUNC);
00171
00172     /* open the files as required, shXX are shadows of stdin... */
00173     if (stin && (shin = open (stin, O_RDONLY)) == -1)
00174     {
00175     rerrno = errno;
00176     error (0, errno, "cannot open %s for reading (prog %s)",
00177            stin, run_argv[0]);
00178     goto out0;
00179     }
00180     if (stout && (shout = open (stout, mode_out, 0666)) == -1)
00181     {
00182     rerrno = errno;
00183     error (0, errno, "cannot open %s for writing (prog %s)",
00184            stout, run_argv[0]);
00185     goto out1;
00186     }
00187     if (sterr && (flags & RUN_COMBINED) == 0)
00188     {
00189     if ((sherr = open (sterr, mode_err, 0666)) == -1)
00190     {
00191         rerrno = errno;
00192         error (0, errno, "cannot open %s for writing (prog %s)",
00193            sterr, run_argv[0]);
00194         goto out2;
00195     }
00196     }
00197     /* now save the standard handles */
00198     sain = saout = saerr = -1;
00199     sain  = dup( 0); /* dup stdin  */
00200     saout = dup( 1); /* dup stdout */
00201     saerr = dup( 2); /* dup stderr */
00202
00203     /* the new handles will be dup'd to the standard handles
00204      * for the spawn.
00205      */
00206
00207     if (shin != 0)
00208       {
00209     (void) dup2 (shin, 0);
00210     (void) close (shin);
00211       }
00212     if (shout != 1)
00213       {
00214     (void) dup2 (shout, 1);
00215     (void) close (shout);
00216       }
00217     if (flags & RUN_COMBINED)
00218       (void) dup2 (1, 2);
00219     else if (sherr != 2)
00220       {
00221     (void) dup2 (sherr, 2);
00222     (void) close (sherr);
00223       }
00224
00225     /* Ignore signals while we're running this.  */
00226     old_sigint = signal (SIGINT, SIG_IGN);
00227
00228     /* dup'ing is done.  try to run it now */
00229     rval = spawnvp ( P_WAIT, run_argv[0], run_argv);
00230
00231     /* Restore signal handling.  */
00232     signal (SIGINT, old_sigint);
00233
00234     /* restore the original file handles   */
00235     if (sain  != -1) {
00236       (void) dup2( sain, 0);    /* re-connect stdin  */
00237       (void) close( sain);
00238     }
00239     if (saout != -1) {
00240       (void) dup2( saout, 1);   /* re-connect stdout */
00241       (void) close( saout);
00242     }
00243     if (saerr != -1) {
00244       (void) dup2( saerr, 2);   /* re-connect stderr */
00245       (void) close( saerr);
00246     }
00247
00248     /* Recognize the return code for a failed subprocess.  */
00249     if (rval == -1)
00250         return 2;
00251     else
00252         return rval;        /* return child's exit status */
00253
00254     /* error cases */
00255     /* cleanup the open file descriptors */
00256   out2:
00257     if (stout)
00258     (void) close (shout);
00259   out1:
00260     if (stin)
00261     (void) close (shin);
00262
00263   out0:
00264     if (rerrno)
00265     errno = rerrno;
00266     return (status);
00267 }
00268
00269
00270 void
00271 run_print (fp)
00272     FILE *fp;
00273 {
00274     int i;
00275
00276     for (i = 0; i < run_argc; i++)
00277     {
00278     (void) fprintf (fp, "'%s'", run_argv[i]);
00279     if (i != run_argc - 1)
00280         (void) fprintf (fp, " ");
00281     }
00282 }
00283
00284 static char *
00285 requote (const char *cmd)
00286 {
00287     char *requoted = xmalloc (strlen (cmd) + 1);
00288     char *p = requoted;
00289
00290     strcpy (requoted, cmd);
00291     while ((p = strchr (p, '\'')) != NULL)
00292     {
00293         *p++ = '"';
00294     }
00295
00296     return requoted;
00297 }
00298
00299 FILE *
00300 run_popen (cmd, mode)
00301     const char *cmd;
00302     const char *mode;
00303 {
00304     if (trace)
00305 #ifdef SERVER_SUPPORT
00306     (void) fprintf (stderr, "%c-> run_popen(%s,%s)\n",
00307             (server_active) ? 'S' : ' ', cmd, mode);
00308 #else
00309     (void) fprintf (stderr, "-> run_popen(%s,%s)\n", cmd, mode);
00310 #endif
00311
00312     if (noexec)
00313     return (NULL);
00314
00315     /* If the command string uses single quotes, turn them into
00316        double quotes.  */
00317     {
00318         char *requoted = requote (cmd);
00319     FILE *result = popen (requoted, mode);
00320     free (requoted);
00321     return result;
00322     }
00323 }
00324
00325
00326 /* Running children with pipes connected to them.  */
00327
00328 /* Create a pipe.  Set READWRITE[0] to its reading end, and
00329    READWRITE[1] to its writing end.  */
00330
00331 static int
00332 my_pipe (int *readwrite)
00333 {
00334     fprintf (stderr,
00335              "Error: my_pipe() is unimplemented.\n");
00336     exit (1);
00337 }
00338
00339
00340 /* Create a child process running COMMAND with IN as its standard input,
00341    and OUT as its standard output.  Return a handle to the child, or
00342    INVALID_HANDLE_VALUE.  */
00343 static int
00344 start_child (char *command, int in, int out)
00345 {
00346     fprintf (stderr,
00347              "Error: start_child() is unimplemented.\n");
00348     exit (1);
00349 }
00350
00351
00352 /* Given an array of arguments that one might pass to spawnv,
00353    construct a command line that one might pass to CreateProcess.
00354    Try to quote things appropriately.  */
00355 static char *
00356 build_command (char **argv)
00357 {
00358     int len;
00359
00360     /* Compute the total length the command will have.  */
00361     {
00362         int i;
00363
00364     len = 0;
00365         for (i = 0; argv[i]; i++)
00366     {
00367         char *p;
00368
00369         len += 2;  /* for the double quotes */
00370
00371         for (p = argv[i]; *p; p++)
00372         {
00373             if (*p == '"')
00374             len += 2;
00375         else
00376             len++;
00377         }
00378     }
00379         len++;  /* for the space or the '\0'  */
00380     }
00381
00382     {
00383         char *command = (char *) malloc (len);
00384     int i;
00385     char *p;
00386
00387     if (! command)
00388     {
00389         errno = ENOMEM;
00390         return command;
00391     }
00392
00393     p = command;
00394     /* copy each element of argv to command, putting each command
00395        in double quotes, and backslashing any quotes that appear
00396        within an argument.  */
00397     for (i = 0; argv[i]; i++)
00398     {
00399         char *a;
00400         *p++ = '"';
00401         for (a = argv[i]; *a; a++)
00402         {
00403             if (*a == '"')
00404             *p++ = '\\', *p++ = '"';
00405         else
00406             *p++ = *a;
00407         }
00408         *p++ = '"';
00409         *p++ = ' ';
00410     }
00411     p[-1] = '\0';
00412
00413         return command;
00414     }
00415 }
00416
00417
00418 /* Create an asynchronous child process executing ARGV,
00419    with its standard input and output connected to the
00420    parent with pipes.  Set *TO to the file descriptor on
00421    which one writes data for the child; set *FROM to
00422    the file descriptor from which one reads data from the child.
00423    Return the handle of the child process (this is what
00424    _cwait and waitpid expect).  */
00425 int
00426 piped_child (char **argv, int *to, int *from)
00427 {
00428     fprintf (stderr,
00429              "Error: piped_child() is unimplemented.\n");
00430     exit (1);
00431 }
00432
00433 /*
00434  * dir = 0 : main proc writes to new proc, which writes to oldfd
00435  * dir = 1 : main proc reads from new proc, which reads from oldfd
00436  *
00437  * If this returns at all, then it was successful and the return value
00438  * is a file descriptor; else it errors and exits.
00439  */
00440 int
00441 filter_stream_through_program (int oldfd, int dir,
00442                char **prog, int *pidp)
00443 {
00444     int newfd;  /* Gets set to one end of the pipe and returned. */
00445     HFILE from, to;
00446     HFILE Old0 = -1, Old1 = -1, Old2 = -1, Tmp;
00447
00448     if (DosCreatePipe (&from, &to, 4096))
00449         return FALSE;
00450
00451     /* Save std{in,out,err} */
00452     DosDupHandle (STDIN, &Old0);
00453     DosSetFHState (Old1, OPEN_FLAGS_NOINHERIT);
00454     DosDupHandle (STDOUT, &Old1);
00455     DosSetFHState (Old2, OPEN_FLAGS_NOINHERIT);
00456     DosDupHandle (STDERR, &Old2);
00457     DosSetFHState (Old2, OPEN_FLAGS_NOINHERIT);
00458
00459     /* Redirect std{in,out,err} */
00460     if (dir)    /* Who goes where? */
00461     {
00462         Tmp = STDIN;
00463         DosDupHandle (oldfd, &Tmp);
00464         Tmp = STDOUT;
00465         DosDupHandle (to, &Tmp);
00466         Tmp = STDERR;
00467         DosDupHandle (to, &Tmp);
00468
00469         newfd = from;
00470         _setmode (newfd, O_BINARY);
00471
00472         DosClose (oldfd);
00473         DosClose (to);
00474         DosSetFHState (from, OPEN_FLAGS_NOINHERIT);
00475     }
00476     else
00477     {
00478         Tmp = STDIN;
00479         DosDupHandle (from, &Tmp);
00480         Tmp = STDOUT;
00481         DosDupHandle (oldfd, &Tmp);
00482         Tmp = STDERR;
00483         DosDupHandle (oldfd, &Tmp);
00484
00485         newfd = to;
00486         _setmode (newfd, O_BINARY);
00487
00488         DosClose (oldfd);
00489         DosClose (from);
00490         DosSetFHState (to, OPEN_FLAGS_NOINHERIT);
00491     }
00492
00493     /* Spawn we now our hoary brood. */
00494     *pidp = spawnvp (P_NOWAIT, prog[0], prog);
00495
00496     /* Restore std{in,out,err} */
00497     Tmp = STDIN;
00498     DosDupHandle (Old0, &Tmp);
00499     DosClose (Old0);
00500     Tmp = STDOUT;
00501     DosDupHandle (Old1, &Tmp);
00502     DosClose (Old1);
00503     Tmp = STDERR;
00504     DosDupHandle (Old2, &Tmp);
00505     DosClose (Old2);
00506
00507     if(*pidp < 0)
00508     {
00509         DosClose (from);
00510         DosClose (to);
00511         error (1, 0, "error spawning %s", prog[0]);
00512     }
00513
00514     return newfd;
00515 }
00516
00517
00518 int
00519 pipe (int *filedesc)
00520 {
00521   /* todo: actually, we can use DosCreatePipe().  Fix this. */
00522   fprintf (stderr,
00523            "Error: pipe() should not have been called in client.\n");
00524   exit (1);
00525 }
00526
00527
00528 void
00529 close_on_exec (int fd)
00530 {
00531   /* Just does nothing for now... */
00532
00533   /* Actually, we probably *can* implement this one.  Let's see... */
00534   /* Nope.  OS/2 has <fcntl.h>, but no fcntl() !  Wow. */
00535   /* Well, I'll leave this stuff in for future reference. */
00536 }
00537
00538
00539 /* Actually, we #define sleep() in config.h now. */
00540 #ifndef sleep
00541 unsigned int
00542 sleep (unsigned int seconds)
00543 {
00544   /* I don't want to interfere with alarm signals, so I'm going to do
00545      this the nasty way. */
00546
00547   time_t base;
00548   time_t tick;
00549   int i;
00550
00551   /* Init. */
00552   time (&base);
00553   time (&tick);
00554
00555   /* Loop until time has passed. */
00556   while (difftime (tick, base) < seconds)
00557     {
00558       /* This might be more civilized than calling time over and over
00559          again. */
00560       for (i = 0; i < 10000; i++)
00561         ;
00562       time (&tick);
00563     }
00564
00565   return 0;
00566 }
00567 #endif /* sleep */
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


stripslash.c File Reference

cvs-1.10/os2/stripslash.c File Reference

#include <string.h>

Include dependency graph for stripslash.c:

Include dependency graph

Go to the source code of this file.

Functions

void strip_trailing_slashes (path) char *path

Function Documentation

void strip_trailing_slashes ( path )

Generated on Sun Oct 21 12:42:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/stripslash.c Source File

cvs-1.10/os2/stripslash.c

Go to the documentation of this file.
00001 /* stripslash.c -- remove trailing slashes from a string
00002    Copyright (C) 1990 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #include <string.h>
00015
00016 /* Remove trailing slashes from PATH. */
00017
00018 void
00019 strip_trailing_slashes (path)
00020      char *path;
00021 {
00022   int last;
00023
00024   last = strlen (path) - 1;
00025   while (last > 0 && (path[last] == '/' || path[last] == '\\'))
00026     path[last--] = '\0';
00027 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/tcpip.h Source File

cvs-1.10/os2/tcpip.h

Go to the documentation of this file.
00001 /****************************************************************
00002  *
00003  * TCPIP.H - Portable TCP/IP header file
00004  *
00005  * TCP/IP on OS/2 is an add-on and thus is not fully integrated
00006  * with the operating system. To ensure portability, follow
00007  * these rules:
00008  *
00009  *  * Always call SockInit() at the beginning of your program
00010  *    and check that it returns TRUE.
00011  *
00012  *  * Use SockSend() & SockRecv() instead of read(), write(),
00013  *    send(), or recv() when working with sockets.
00014  *
00015  *  * Use SockClose() instead of close() with sockets.
00016  *
00017  *  * Use SOCK_ERRNO when using functions that use or return
00018  *    sockets, such as SockSend() or accept().
00019  *
00020  *  * Use HOST_ERRNO when using gethostbyname() or gethostbyaddr()
00021  *    functions.
00022  *
00023  *  * As far as I can tell, getservbyname() and related functions
00024  *    never set any error variable.
00025  *
00026  *  * Use SockStrError() & HostStrError() to convert SOCK_ERRNO
00027  *    and HOST_ERRNO to error strings.
00028  *
00029  *  * In .MAK files, include $(TCPIP_MAK) & use $(TCPIPLIB)
00030  *    when linking applications using TCP/IP.
00031  *
00032  ****************************************************************/
00033
00034 #if !defined( IN_TCPIP_H )
00035 #define IN_TCPIP_H
00036
00037 #include    <sys/types.h>
00038 #include    <sys/stat.h>
00039 #include    <sys/socket.h>
00040 #include    <sys/ioctl.h>
00041 #include    <netinet/in.h>
00042 #include    <netdb.h>
00043 #include    <errno.h>
00044
00045 #if defined( TCPIP_IBM )
00046 /* Here comes some ugly stuff: The watcom compiler and the IBM TCPIP
00047  * toolkit do not work together very well. The return codes for the
00048  * socket calls are not integrated into the usual error codes, there
00049  * are separate values instead. This results in a crash for two values.
00050  * Since these values are not needed for socket access as far as I can
00051  * see, I will save those values and redefine them after including
00052  * nerrno.h (types.h will include nerrno.h, so this is needed here).
00053  */
00054 #       ifdef __WATCOMC__
00055                 /* First check the numeric values */
00056 #               if ENAMETOOLONG != 35
00057 #                       error "ENAMETOOLONG: value unknown"
00058 #               endif
00059 #               if ENOTEMPTY != 39
00060 #                       error "ENOTEMPTY: value unknown"
00061 #               endif
00062 #               undef  ENAMETOOLONG
00063 #               undef  ENOTEMPTY
00064 #               include <nerrno.h>
00065 #               undef  ENAMETOOLONG
00066 #               undef  ENOTEMPTY
00067 #               define ENAMETOOLONG     35
00068 #               define ENOTEMPTY        39
00069 #       endif
00070 #   include <types.h>
00071 #   if !defined( TCPIP_IBM_NOHIDE )
00072 #       define send IbmSockSend
00073 #       define recv IbmSockRecv
00074 #   endif
00075 #endif
00076
00077 #if defined( TCPIP_IBM )
00078 #   define  BSD_SELECT
00079 #   include <sys/select.h>
00080 #   include <sys/time.h>
00081 #   include <nerrno.h>
00082 #   include <utils.h>
00083 #   if defined( MICROSOFT )
00084 #       define  SOCK_ERRNO      (tcperrno())
00085 #   else
00086 #       define  SOCK_ERRNO      (sock_errno())
00087 #   endif
00088 #   define  HOST_ERRNO      (h_errno)
00089 #   define  SockClose(S)    soclose(S)
00090 #   define  SockInit()      (!sock_init())
00091 #   define  SockSend        IbmSockSend
00092 #   define  SockRecv        IbmSockRecv
00093
00094 const char *HostStrError(int HostErrno);
00095 const char *SockStrError(int SockErrno);
00096
00097 int IbmSockSend (int Socket, const void *Buffer, int Len, int Flags);
00098 int IbmSockRecv (int Socket, const void *Buffer, int Len, int Flags);
00099
00100 #if !defined( h_errno )
00101 extern int h_errno; /* IBM forgot to declare this in current header files */
00102 #endif
00103
00104 #elif defined( __unix )
00105 #   if defined( sgi ) /* SGI incorrectly defines FD_ZERO in sys/select.h */
00106 #       include <bstring.h>
00107 #   endif
00108 #   if defined( sunos )
00109 extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
00110 #   else
00111 #       include <sys/select.h>
00112 #   endif
00113 #   include <sys/time.h>
00114 #   include <errno.h>
00115 #   include <arpa/inet.h>
00116 #   define  SOCK_ERRNO      errno
00117 #   define  HOST_ERRNO      h_errno
00118 #   define  SockClose(S)    close(S)
00119 #   define  SockInit()      TRUE
00120 #   define  SockSend        send
00121 #   define  SockRecv        recv
00122 #   define  SockStrError(E) strerror(E)
00123
00124 const char *HostStrError( int HostErrno );
00125
00126 #else
00127 #   error Undefined version of TCP/IP specified
00128
00129 #endif
00130
00131 #endif
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


tcpip.h File Reference

cvs-1.10/os2/tcpip.h File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>

Include dependency graph for tcpip.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define IN_TCPIP_H

Define Documentation

#define IN_TCPIP_H

Definition at line 35 of file tcpip.h.

Generated on Sun Oct 21 12:43:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


waitpid.c File Reference

cvs-1.10/os2/waitpid.c File Reference

#include <assert.h>
#include <stdio.h>
#include <process.h>
#include <errno.h>
#include "config.h"

Include dependency graph for waitpid.c:

Include dependency graph

Go to the source code of this file.

Functions

int | waitpid (pid, statusp, options) int pid

Variables

int * | statusp
int | options

Function Documentation

int waitpid | ( | pid | ,
 |  | statusp | ,
 |  | options |
 | ) |

Variable Documentation

int options

Definition at line 16 of file waitpid.c.

int* statusp

Definition at line 15 of file waitpid.c.

Generated on Sun Oct 21 12:43:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/os2/waitpid.c Source File

cvs-1.10/os2/waitpid.c

Go to the documentation of this file.
00001 /* waitpid.c --- waiting for process termination, under OS/2
00002    Karl Fogel <kfogel@cyclic.com> --- November 1995  */
00003
00004 #include <assert.h>
00005 #include <stdio.h>
00006 #include <process.h>
00007 #include <errno.h>
00008
00009 #include "config.h"
00010
00011 /* Wait for the process PID to exit.  Put the return status in *statusp.
00012    OPTIONS is not supported yet under OS/2.  We hope it's always zero.  */
00013 pid_t waitpid (pid, statusp, options)
00014      pid_t pid;
00015      int *statusp;
00016      int options;
00017 {
00018   pid_t rc;
00019
00020   /* We don't know how to deal with any options yet.  */
00021   assert (options == 0);
00022
00023   rc = _cwait (statusp, pid, WAIT_CHILD);
00024
00025   if (rc == -1)
00026     {
00027       if (errno == ECHILD)
00028         return pid;
00029       else
00030         return -1;
00031     }
00032   else if (rc == pid)
00033     return pid;
00034   else
00035     return -1;
00036 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/add.c Source File

cvs-1.10/src/add.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Add
00009  *
00010  * Adds a file or directory to the RCS source repository.  For a file,
00011  * the entry is marked as "needing to be added" in the user's own CVS
00012  * directory, and really added to the repository when it is committed.
00013  * For a directory, it is added at the appropriate place in the source
00014  * repository and a CVS directory is generated within the directory.
00015  *
00016  * The -m option is currently the only supported option.  Some may wish to
00017  * supply standard "rcs" options here, but I've found that this causes more
00018  * trouble than anything else.
00019  *
00020  * The user files or directories must already exist.  For a directory, it must
00021  * not already have a CVS file in it.
00022  *
00023  * An "add" on a file that has been "remove"d but not committed will cause the
00024  * file to be resurrected.
00025  */
00026
00027 #include "cvs.h"
00028 #include "savecwd.h"
00029 #include "fileattr.h"
00030
00031 static int add_directory PROTO ((struct file_info *finfo));
00032 static int build_entry PROTO((char *repository, char *user, char *options,
00033                 char *message, List * entries, char *tag));
00034
00035 static const char *const add_usage[] =
00036 {
00037     "Usage: %s %s [-k rcs-kflag] [-m message] files...\n",
00038     "\t-k\tUse \"rcs-kflag\" to add the file with the specified kflag.\n",
00039     "\t-m\tUse \"message\" for the creation log.\n",
00040     "(Specify the --help global option for a list of other help options)\n",
00041     NULL
00042 };
00043
00044 int
00045 add (argc, argv)
00046     int argc;
00047     char **argv;
00048 {
00049     char *message = NULL;
00050     int i;
00051     char *repository;
00052     int c;
00053     int err = 0;
00054     int added_files = 0;
00055     char *options = NULL;
00056     List *entries;
00057     Vers_TS *vers;
00058     struct saved_cwd cwd;
00059     /* Nonzero if we found a slash, and are thus adding files in a
00060        subdirectory.  */
00061     int found_slash = 0;
00062     size_t cvsroot_len;
00063
00064     if (argc == 1 || argc == -1)
00065     usage (add_usage);
00066
00067     wrap_setup ();
00068
00069     /* parse args */
00070     optind = 0;
00071     while ((c = getopt (argc, argv, "+k:m:")) != -1)
00072     {
00073     switch (c)
00074     {
00075         case 'k':
00076         if (options)
00077             free (options);
00078         options = RCS_check_kflag (optarg);
00079         break;
00080
00081         case 'm':
00082         message = xstrdup (optarg);
00083         break;
00084         case '?':
00085         default:
00086         usage (add_usage);
00087         break;
00088     }
00089     }
00090     argc -= optind;
00091     argv += optind;
00092
00093     if (argc <= 0)
00094     usage (add_usage);
00095
00096     cvsroot_len = strlen (CVSroot_directory);
00097
00098     /* First some sanity checks.  I know that the CVS case is (sort of)
00099        also handled by add_directory, but we need to check here so the
00100        client won't get all confused in send_file_names.  */
00101     for (i = 0; i < argc; i++)
00102     {
00103     int skip_file = 0;
00104
00105     /* If it were up to me I'd probably make this a fatal error.
00106        But some people are really fond of their "cvs add *", and
00107        don't seem to object to the warnings.
00108        Whatever.  */
00109     strip_trailing_slashes (argv[i]);
00110     if (strcmp (argv[i], ".") == 0
00111         || strcmp (argv[i], "..") == 0
00112         || fncmp (argv[i], CVSADM) == 0)
00113     {
00114         error (0, 0, "cannot add special file `%s'; skipping", argv[i]);
00115         skip_file = 1;
00116     }
00117     else
00118     {
00119         char *p;
00120         p = argv[i];
00121         while (*p != '\0')
00122         {
00123         if (ISDIRSEP (*p))
00124         {
00125             found_slash = 1;
00126             break;
00127         }
00128         ++p;
00129         }
00130     }
00131
00132     if (skip_file)
00133     {
00134         int j;
00135
00136         /* FIXME: We don't do anything about free'ing argv[i].  But
00137            the problem is that it is only sometimes allocated (see
00138            cvsrc.c).  */
00139
00140         for (j = i; j < argc - 1; ++j)
00141         argv[j] = argv[j + 1];
00142         --argc;
00143         /* Check the new argv[i] again.  */
00144         --i;
00145         ++err;
00146     }
00147     }
00148
00149 #ifdef CLIENT_SUPPORT
00150     if (client_active)
00151     {
00152     int i;
00153
00154     if (argc == 0)
00155         /* We snipped out all the arguments in the above sanity
00156            check.  We can just forget the whole thing (and we
00157            better, because if we fired up the server and passed it
00158            nothing, it would spit back a usage message).  */
00159         return err;
00160
00161     start_server ();
00162     ign_setup ();
00163     if (options)
00164     {
00165         send_arg (options);
00166         free (options);
00167     }
00168     option_with_arg ("-m", message);
00169
00170     /* If !found_slash, refrain from sending "Directory", for
00171        CVS 1.9 compatibility.  If we only tried to deal with servers
00172        which are at least CVS 1.9.26 or so, we wouldn't have to
00173        special-case this.  */
00174     if (found_slash)
00175     {
00176         repository = Name_Repository (NULL, NULL);
00177         send_a_repository ("", repository, "");
00178         free (repository);
00179     }
00180
00181     for (i = 0; i < argc; ++i)
00182     {
00183         /* FIXME: Does this erroneously call Create_Admin in error
00184            conditions which are only detected once the server gets its
00185            hands on things?  */
00186         /* FIXME-also: if filenames are case-insensitive on the
00187            client, and the directory in the repository already
00188            exists and is named "foo", and the command is "cvs add
00189            FOO", this call to Create_Admin puts the wrong thing in
00190            CVS/Repository and so a subsequent "cvs update" will
00191            give an error.  The fix will be to have the server report
00192            back what it actually did (e.g. use tagged text for the
00193            "Directory %s added" message), and then Create_Admin,
00194            which should also fix the error handling concerns.  */
00195
00196         if (isdir (argv[i]))
00197         {
00198         char *tag;
00199         char *date;
00200         int nonbranch;
00201         char *rcsdir;
00202         char *p;
00203         char *update_dir;
00204         /* This is some mungeable storage into which we can point
00205            with p and/or update_dir.  */
00206         char *filedir;
00207
00208         if (save_cwd (&cwd))
00209             error_exit ();
00210
00211         filedir = xstrdup (argv[i]);
00212         p = last_component (filedir);
00213         if (p == filedir)
00214         {
00215             update_dir = "";
00216         }
00217         else
00218         {
00219             p[-1] = '\0';
00220             update_dir = filedir;
00221             if (CVS_CHDIR (update_dir) < 0)
00222             error (1, errno,
00223                    "could not chdir to %s", update_dir);
00224         }
00225
00226         /* find the repository associated with our current dir */
00227         repository = Name_Repository (NULL, update_dir);
00228
00229         /* don't add stuff to Emptydir */
00230         if (strncmp (repository, CVSroot_directory, cvsroot_len) == 0
00231             && ISDIRSEP (repository[cvsroot_len])
00232             && strncmp (repository + cvsroot_len + 1,
00233                 CVSROOTADM,
00234                 sizeof CVSROOTADM - 1) == 0
00235             && ISDIRSEP (repository[cvsroot_len + sizeof CVSROOTADM])
00236             && strcmp (repository + cvsroot_len + sizeof CVSROOTADM + 1,
00237                    CVSNULLREPOS) == 0)
00238             error (1, 0, "cannot add to %s", repository);
00239
00240         /* before we do anything else, see if we have any
00241            per-directory tags */
00242         ParseTag (&tag, &date, &nonbranch);
00243
00244         rcsdir = xmalloc (strlen (repository) + strlen (p) + 5);
00245         sprintf (rcsdir, "%s/%s", repository, p);
00246
00247         Create_Admin (p, argv[i], rcsdir, tag, date,
00248                   nonbranch, 0, 1);
00249
00250         if (found_slash)
00251             send_a_repository ("", repository, update_dir);
00252
00253         if (restore_cwd (&cwd, NULL))
00254             error_exit ();
00255         free_cwd (&cwd);
00256
00257         if (tag)
00258             free (tag);
00259         if (date)
00260             free (date);
00261         free (rcsdir);
00262
00263         if (p == filedir)
00264             Subdir_Register ((List *) NULL, (char *) NULL, argv[i]);
00265         else
00266         {
00267             Subdir_Register ((List *) NULL, update_dir, p);
00268         }
00269         free (repository);
00270         free (filedir);
00271         }
00272     }
00273     send_files (argc, argv, 0, 0, SEND_BUILD_DIRS | SEND_NO_CONTENTS);
00274     send_file_names (argc, argv, SEND_EXPAND_WILD);
00275     send_to_server ("add\012", 0);
00276     if (message)
00277         free (message);
00278     return err + get_responses_and_close ();
00279     }
00280 #endif
00281
00282     /* walk the arg list adding files/dirs */
00283     for (i = 0; i < argc; i++)
00284     {
00285     int begin_err = err;
00286 #ifdef SERVER_SUPPORT
00287     int begin_added_files = added_files;
00288 #endif
00289     struct file_info finfo;
00290     char *p;
00291 #if defined (SERVER_SUPPORT) && !defined (FILENAMES_CASE_INSENSITIVE)
00292     char *found_name;
00293 #endif
00294
00295     memset (&finfo, 0, sizeof finfo);
00296
00297     if (save_cwd (&cwd))
00298         error_exit ();
00299
00300     finfo.fullname = xstrdup (argv[i]);
00301     p = last_component (argv[i]);
00302     if (p == argv[i])
00303     {
00304         finfo.update_dir = "";
00305         finfo.file = p;
00306     }
00307     else
00308     {
00309         p[-1] = '\0';
00310         finfo.update_dir = argv[i];
00311         finfo.file = p;
00312         if (CVS_CHDIR (finfo.update_dir) < 0)
00313         error (1, errno, "could not chdir to %s", finfo.update_dir);
00314     }
00315
00316     /* Add wrappers for this directory.  They exist only until
00317        the next call to wrap_add_file.  */
00318     wrap_add_file (CVSDOTWRAPPER, 1);
00319
00320     finfo.rcs = NULL;
00321
00322     /* Find the repository associated with our current dir.  */
00323     repository = Name_Repository (NULL, finfo.update_dir);
00324
00325     /* don't add stuff to Emptydir */
00326     if (strncmp (repository, CVSroot_directory, cvsroot_len) == 0
00327         && ISDIRSEP (repository[cvsroot_len])
00328         && strncmp (repository + cvsroot_len + 1,
00329             CVSROOTADM,
00330             sizeof CVSROOTADM - 1) == 0
00331         && ISDIRSEP (repository[cvsroot_len + sizeof CVSROOTADM])
00332         && strcmp (repository + cvsroot_len + sizeof CVSROOTADM + 1,
00333                CVSNULLREPOS) == 0)
00334         error (1, 0, "cannot add to %s", repository);
00335
00336     entries = Entries_Open (0, NULL);
00337
00338     finfo.repository = repository;
00339     finfo.entries = entries;
00340
00341 #if defined (SERVER_SUPPORT) && !defined (FILENAMES_CASE_INSENSITIVE)
00342     if (ign_case)
00343     {
00344         /* Need to check whether there is a directory with the
00345            same name but different case.  We'll check for files
00346            with the same name later (when Version_TS calls
00347            RCS_parse which calls fopen_case).  If CVS some day
00348            records directories in the RCS files, then we should be
00349            able to skip the separate check here, which would be
00350            cleaner.  */
00351         DIR *dirp;
00352         struct dirent *dp;
00353
00354         dirp = CVS_OPENDIR (finfo.repository);
00355         if (dirp == NULL)
00356         error (1, errno, "cannot read directory %s", finfo.repository);
00357         found_name = NULL;
00358         errno = 0;
00359         while ((dp = readdir (dirp)) != NULL)
00360         {
00361         if (cvs_casecmp (dp->d_name, finfo.file) == 0)
00362         {
00363             if (found_name != NULL)
00364             error (1, 0, "%s is ambiguous; could mean %s or %s",
00365                    finfo.file, dp->d_name, found_name);
00366             found_name = xstrdup (dp->d_name);
00367         }
00368         }
00369         if (errno != 0)
00370         error (1, errno, "cannot read directory %s", finfo.repository);
00371         closedir (dirp);
00372
00373         if (found_name != NULL)
00374         {
00375         /* OK, we are about to patch up the name, so patch up
00376            the temporary directory too to match.  The isdir
00377            should "always" be true (since files have ,v), but
00378            I guess we might as well make some attempt to not
00379            get confused by stray files in the repository.  */
00380         if (isdir (finfo.file))
00381         {
00382             if (CVS_MKDIR (found_name, 0777) < 0
00383             && errno != EEXIST)
00384             error (0, errno, "cannot create %s", finfo.file);
00385         }
00386
00387         /* OK, we found a directory with the same name, maybe in
00388            a different case.  Treat it as if the name were the
00389            same.  */
00390         finfo.file = found_name;
00391         }
00392     }
00393 #endif
00394
00395     /* We pass force_tag_match as 1.  If the directory has a
00396            sticky branch tag, and there is already an RCS file which
00397            does not have that tag, then the head revision is
00398            meaningless to us.  */
00399     vers = Version_TS (&finfo, options, NULL, NULL, 1, 0);
00400     if (vers->vn_user == NULL)
00401     {
00402         /* No entry available, ts_rcs is invalid */
00403         if (vers->vn_rcs == NULL)
00404         {
00405         /* There is no RCS file either */
00406         if (vers->ts_user == NULL)
00407         {
00408             /* There is no user file either */
00409             error (0, 0, "nothing known about %s", finfo.fullname);
00410             err++;
00411         }
00412         else if (!isdir (finfo.file)
00413              || wrap_name_has (finfo.file, WRAP_TOCVS))
00414         {
00415             /*
00416              * See if a directory exists in the repository with
00417              * the same name.  If so, blow this request off.
00418              */
00419             char *dname = xmalloc (strlen (repository)
00420                        + strlen (finfo.file)
00421                        + 10);
00422             (void) sprintf (dname, "%s/%s", repository, finfo.file);
00423             if (isdir (dname))
00424             {
00425             error (0, 0,
00426                    "cannot add file `%s' since the directory",
00427                    finfo.fullname);
00428             error (0, 0, "`%s' already exists in the repository",
00429                    dname);
00430             error (1, 0, "illegal filename overlap");
00431             }
00432             free (dname);
00433
00434             if (vers->options == NULL || *vers->options == '\0')
00435             {
00436             /* No options specified on command line (or in
00437                rcs file if it existed, e.g. the file exists
00438                on another branch).  Check for a value from
00439                the wrapper stuff.  */
00440             if (wrap_name_has (finfo.file, WRAP_RCSOPTION))
00441             {
00442                 if (vers->options)
00443                 free (vers->options);
00444                 vers->options = wrap_rcsoption (finfo.file, 1);
00445             }
00446             }
00447
00448             if (vers->nonbranch)
00449             {
00450             error (0, 0,
00451                    "cannot add file on non-branch tag %s",
00452                    vers->tag);
00453             ++err;
00454             }
00455             else
00456             {
00457             /* There is a user file, so build the entry for it */
00458             if (build_entry (repository, finfo.file, vers->options,
00459                      message, entries, vers->tag) != 0)
00460                 err++;
00461             else
00462             {
00463                 added_files++;
00464                 if (!quiet)
00465                 {
00466                 if (vers->tag)
00467                     error (0, 0, "\
00468 scheduling %s `%s' for addition on branch `%s'",
00469                        (wrap_name_has (finfo.file,
00470                                WRAP_TOCVS)
00471                         ? "wrapper"
00472                         : "file"),
00473                        finfo.fullname, vers->tag);
00474                 else
00475                     error (0, 0,
00476                        "scheduling %s `%s' for addition",
00477                        (wrap_name_has (finfo.file,
00478                                WRAP_TOCVS)
00479                         ? "wrapper"
00480                         : "file"),
00481                        finfo.fullname);
00482                 }
00483             }
00484             }
00485         }
00486         }
00487         else if (RCS_isdead (vers->srcfile, vers->vn_rcs))
00488         {
00489         if (isdir (finfo.file)
00490             && !wrap_name_has (finfo.file, WRAP_TOCVS))
00491         {
00492             error (0, 0, "\
00493 the directory `%s' cannot be added because a file of the", finfo.fullname);
00494             error (1, 0, "\
00495 same name already exists in the repository.");
00496         }
00497         else
00498         {
00499             if (vers->nonbranch)
00500             {
00501             error (0, 0,
00502                    "cannot add file on non-branch tag %s",
00503                    vers->tag);
00504             ++err;
00505             }
00506             else
00507             {
00508             if (vers->tag)
00509                 error (0, 0, "\
00510 file `%s' will be added on branch `%s' from version %s",
00511                    finfo.fullname, vers->tag, vers->vn_rcs);
00512             else
00513                 /* I'm not sure that mentioning
00514                    vers->vn_rcs makes any sense here; I
00515                    can't think of a way to word the
00516                    message which is not confusing.  */
00517                 error (0, 0, "\
00518 re-adding file %s (in place of dead revision %s)",
00519                    finfo.fullname, vers->vn_rcs);
00520             Register (entries, finfo.file, "0", vers->ts_user,
00521                   vers->options,
00522                   vers->tag, NULL, NULL);
00523             ++added_files;
00524             }
00525         }
00526         }
00527         else
00528         {
00529         /*
00530          * There is an RCS file already, so somebody else must've
00531          * added it
00532          */
00533         error (0, 0, "%s added independently by second party",
00534                finfo.fullname);
00535         err++;
00536         }
00537     }
00538     else if (vers->vn_user[0] == '0' && vers->vn_user[1] == '\0')
00539     {
00540
00541         /*
00542          * An entry for a new-born file, ts_rcs is dummy, but that is
00543          * inappropriate here
00544          */
00545         error (0, 0, "%s has already been entered", finfo.fullname);
00546         err++;
00547     }
00548     else if (vers->vn_user[0] == '-')
00549     {
00550         /* An entry for a removed file, ts_rcs is invalid */
00551         if (vers->ts_user == NULL)
00552         {
00553         /* There is no user file (as it should be) */
00554         if (vers->vn_rcs == NULL)
00555         {
00556
00557             /*
00558              * There is no RCS file, so somebody else must've removed
00559              * it from under us
00560              */
00561             error (0, 0, "\
00562 cannot resurrect %s; RCS file removed by second party", finfo.fullname);
00563             err++;
00564         }
00565         else
00566         {
00567
00568             /*
00569              * There is an RCS file, so remove the "-" from the
00570              * version number and restore the file
00571              */
00572             char *tmp = xmalloc (strlen (finfo.file) + 50);
00573
00574             (void) strcpy (tmp, vers->vn_user + 1);
00575             (void) strcpy (vers->vn_user, tmp);
00576             (void) sprintf (tmp, "Resurrected %s", finfo.file);
00577             Register (entries, finfo.file, vers->vn_user, tmp,
00578                   vers->options,
00579                   vers->tag, vers->date, vers->ts_conflict);
00580             free (tmp);
00581
00582             /* XXX - bugs here; this really resurrect the head */
00583             /* Note that this depends on the Register above actually
00584                having written Entries, or else it won't really
00585                check the file out.  */
00586             if (update (2, argv + i - 1) == 0)
00587             {
00588             error (0, 0, "%s, version %s, resurrected",
00589                    finfo.fullname,
00590                    vers->vn_user);
00591             }
00592             else
00593             {
00594             error (0, 0, "could not resurrect %s", finfo.fullname);
00595             err++;
00596             }
00597         }
00598         }
00599         else
00600         {
00601         /* The user file shouldn't be there */
00602         error (0, 0, "\
00603 %s should be removed and is still there (or is back again)", finfo.fullname);
00604         err++;
00605         }
00606     }
00607     else
00608     {
00609         /* A normal entry, ts_rcs is valid, so it must already be there */
00610         error (0, 0, "%s already exists, with version number %s",
00611            finfo.fullname,
00612            vers->vn_user);
00613         err++;
00614     }
00615     freevers_ts (&vers);
00616
00617     /* passed all the checks.  Go ahead and add it if its a directory */
00618     if (begin_err == err
00619         && isdir (finfo.file)
00620         && !wrap_name_has (finfo.file, WRAP_TOCVS))
00621     {
00622         err += add_directory (&finfo);
00623     }
00624     else
00625     {
00626 #ifdef SERVER_SUPPORT
00627         if (server_active && begin_added_files != added_files)
00628         server_checked_in (finfo.file, finfo.update_dir, repository);
00629 #endif
00630     }
00631     free (repository);
00632     Entries_Close (entries);
00633
00634     if (restore_cwd (&cwd, NULL))
00635         error_exit ();
00636     free_cwd (&cwd);
00637
00638     free (finfo.fullname);
00639 #if defined (SERVER_SUPPORT) && !defined (FILENAMES_CASE_INSENSITIVE)
00640     if (ign_case && found_name != NULL)
00641         free (found_name);
00642 #endif
00643     }
00644     if (added_files)
00645     error (0, 0, "use '%s commit' to add %s permanently",
00646            program_name,
00647            (added_files == 1) ? "this file" : "these files");
00648
00649     if (message)
00650     free (message);
00651     if (options)
00652     free (options);
00653
00654     return (err);
00655 }
00656
00657 /*
00658  * The specified user file is really a directory.  So, let's make sure that
00659  * it is created in the RCS source repository, and that the user's directory
00660  * is updated to include a CVS directory.
00661  *
00662  * Returns 1 on failure, 0 on success.
00663  */
00664 static int
00665 add_directory (finfo)
00666     struct file_info *finfo;
00667 {
00668     char *repository = finfo->repository;
00669     List *entries = finfo->entries;
00670     char *dir = finfo->file;
00671
00672     char *rcsdir = NULL;
00673     struct saved_cwd cwd;
00674     char *message = NULL;
00675     char *tag, *date;
00676     int nonbranch;
00677     char *attrs;
00678
00679     if (strchr (dir, '/') != NULL)
00680     {
00681     /* "Can't happen".  */
00682     error (0, 0,
00683            "directory %s not added; must be a direct sub-directory", dir);
00684     return (1);
00685     }
00686     if (fncmp (dir, CVSADM) == 0)
00687     {
00688     error (0, 0, "cannot add a `%s' directory", CVSADM);
00689     return (1);
00690     }
00691
00692     /* before we do anything else, see if we have any per-directory tags */
00693     ParseTag (&tag, &date, &nonbranch);
00694
00695     /* Remember the default attributes from this directory, so we can apply
00696        them to the new directory.  */
00697     fileattr_startdir (repository);
00698     attrs = fileattr_getall (NULL);
00699     fileattr_free ();
00700
00701     /* now, remember where we were, so we can get back */
00702     if (save_cwd (&cwd))
00703     return (1);
00704     if ( CVS_CHDIR (dir) < 0)
00705     {
00706     error (0, errno, "cannot chdir to %s", finfo->fullname);
00707     return (1);
00708     }
00709 #ifdef SERVER_SUPPORT
00710     if (!server_active && isfile (CVSADM))
00711 #else
00712     if (isfile (CVSADM))
00713 #endif
00714     {
00715     error (0, 0, "%s/%s already exists", finfo->fullname, CVSADM);
00716     goto out;
00717     }
00718
00719     rcsdir = xmalloc (strlen (repository) + strlen (dir) + 5);
00720     sprintf (rcsdir, "%s/%s", repository, dir);
00721     if (isfile (rcsdir) && !isdir (rcsdir))
00722     {
00723     error (0, 0, "%s is not a directory; %s not added", rcsdir,
00724            finfo->fullname);
00725     goto out;
00726     }
00727
00728     /* setup the log message */
00729     message = xmalloc (strlen (rcsdir)
00730                + 80
00731                + (tag == NULL ? 0 : strlen (tag) + 80)
00732                + (date == NULL ? 0 : strlen (date) + 80));
00733     (void) sprintf (message, "Directory %s added to the repository\n", rcsdir);
00734     if (tag)
00735     {
00736     (void) strcat (message, "--> Using per-directory sticky tag `");
00737     (void) strcat (message, tag);
00738     (void) strcat (message, "'\n");
00739     }
00740     if (date)
00741     {
00742     (void) strcat (message, "--> Using per-directory sticky date `");
00743     (void) strcat (message, date);
00744     (void) strcat (message, "'\n");
00745     }
00746
00747     if (!isdir (rcsdir))
00748     {
00749     mode_t omask;
00750     Node *p;
00751     List *ulist;
00752     struct logfile_info *li;
00753
00754     /* There used to be some code here which would prompt for
00755        whether to add the directory.  The details of that code had
00756        bitrotted, but more to the point it can't work
00757        client/server, doesn't ask in the right way for GUIs, etc.
00758        A better way of making it harder to accidentally add
00759        directories would be to have to add and commit directories
00760        like for files.  The code was #if 0'd at least since CVS 1.5.  */
00761
00762     if (!noexec)
00763     {
00764         omask = umask (cvsumask);
00765         if (CVS_MKDIR (rcsdir, 0777) < 0)
00766         {
00767         error (0, errno, "cannot mkdir %s", rcsdir);
00768         (void) umask (omask);
00769         goto out;
00770         }
00771         (void) umask (omask);
00772     }
00773
00774     /* Now set the default file attributes to the ones we inherited
00775        from the parent directory.  */
00776     fileattr_startdir (rcsdir);
00777     fileattr_setall (NULL, attrs);
00778     fileattr_write ();
00779     fileattr_free ();
00780     if (attrs != NULL)
00781         free (attrs);
00782
00783     /*
00784      * Set up an update list with a single title node for Update_Logfile
00785      */
00786     ulist = getlist ();
00787     p = getnode ();
00788     p->type = UPDATE;
00789     p->delproc = update_delproc;
00790     p->key = xstrdup ("- New directory");
00791     li = (struct logfile_info *) xmalloc (sizeof (struct logfile_info));
00792     li->type = T_TITLE;
00793     li->tag = xstrdup (tag);
00794     li->rev_old = li->rev_new = NULL;
00795     p->data = (char *) li;
00796     (void) addnode (ulist, p);
00797     Update_Logfile (rcsdir, message, (FILE *) NULL, ulist);
00798     dellist (&ulist);
00799     }
00800
00801 #ifdef SERVER_SUPPORT
00802     if (!server_active)
00803 #endif
00804         Create_Admin (".", finfo->fullname, rcsdir, tag, date, nonbranch, 0, 1);
00805     if (tag)
00806     free (tag);
00807     if (date)
00808     free (date);
00809
00810     if (restore_cwd (&cwd, NULL))
00811     error_exit ();
00812     free_cwd (&cwd);
00813
00814     Subdir_Register (entries, (char *) NULL, dir);
00815
00816     cvs_output (message, 0);
00817
00818     free (rcsdir);
00819     free (message);
00820
00821     return (0);
00822
00823 out:
00824     if (restore_cwd (&cwd, NULL))
00825     error_exit ();
00826     free_cwd (&cwd);
00827     if (rcsdir != NULL)
00828     free (rcsdir);
00829     return (0);
00830 }
00831
00832 /*
00833  * Builds an entry for a new file and sets up "CVS/file",[pt] by
00834  * interrogating the user.  Returns non-zero on error.
00835  */
00836 static int
00837 build_entry (repository, user, options, message, entries, tag)
00838     char *repository;
00839     char *user;
00840     char *options;
00841     char *message;
00842     List *entries;
00843     char *tag;
00844 {
00845     char *fname;
00846     char *line;
00847     FILE *fp;
00848
00849     if (noexec)
00850     return (0);
00851
00852     /*
00853      * The requested log is read directly from the user and stored in the
00854      * file user,t.  If the "message" argument is set, use it as the
00855      * initial creation log (which typically describes the file).
00856      */
00857     fname = xmalloc (strlen (user) + 80);
00858     (void) sprintf (fname, "%s/%s%s", CVSADM, user, CVSEXT_LOG);
00859     fp = open_file (fname, "w+");
00860     if (message && fputs (message, fp) == EOF)
00861         error (1, errno, "cannot write to %s", fname);
00862     if (fclose(fp) == EOF)
00863         error(1, errno, "cannot close %s", fname);
00864     free (fname);
00865
00866     /*
00867      * Create the entry now, since this allows the user to interrupt us above
00868      * without needing to clean anything up (well, we could clean up the
00869      * ,t file, but who cares).
00870      */
00871     line = xmalloc (strlen (user) + 20);
00872     (void) sprintf (line, "Initial %s", user);
00873     Register (entries, user, "0", line, options, tag, (char *) 0, (char *) 0);
00874     free (line);
00875     return (0);
00876 }
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/admin.c Source File

cvs-1.10/src/admin.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Administration ("cvs admin")
00009  *
00010  */
00011
00012 #include "cvs.h"
00013 #ifdef CVS_ADMIN_GROUP
00014 #include <grp.h>
00015 #endif
00016 #include <assert.h>
00017
00018 static Dtype admin_dirproc PROTO ((void *callerdat, char *dir,
00019                    char *repos, char *update_dir,
00020                    List *entries));
00021 static int admin_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00022
00023 static const char *const admin_usage[] =
00024 {
00025     "Usage: %s %s [options] files...\n",
00026     "\t-a users   Append (comma-separated) user names to access list.\n",
00027     "\t-A file    Append another file's access list.\n",
00028     "\t-b[rev]    Set default branch (highest branch on trunk if omitted).\n",
00029     "\t-c string  Set comment leader.\n",
00030     "\t-e[users]  Remove (comma-separated) user names from access list\n",
00031     "\t           (all names if omitted).\n",
00032     "\t-I         Run interactively.\n",
00033     "\t-k subst   Set keyword substitution mode:\n",
00034     "\t   kv   (Default) Substitue keyword and value.\n",
00035     "\t   kvl  Substitue keyword, value, and locker (if any).\n",
00036     "\t   k    Substitue keyword only.\n",
00037     "\t   o    Preserve original string.\n",
00038     "\t   b    Like o, but mark file as binary.\n",
00039     "\t   v    Substitue value only.\n",
00040     "\t-l[rev]    Lock revision (latest revision on branch,\n",
00041     "\t           latest revision on trunk if omitted).\n",
00042     "\t-L         Set strict locking.\n",
00043     "\t-m rev:msg  Replace revision's log message.\n",
00044     "\t-n tag[:[rev]]  Tag branch or revision.  If :rev is omitted,\n",
00045     "\t                delete the tag; if rev is omitted, tag the latest\n",
00046     "\t                revision on the default branch.\n",
00047     "\t-N tag[:[rev]]  Same as -n except override existing tag.\n",
00048     "\t-o range   Delete (outdate) specified range of revisions:\n",
00049     "\t   rev1::rev2  Between rev1 and rev2, excluding rev1 and rev2.\n",
00050     "\t   rev::       After rev on the same branch.\n",
00051     "\t   ::rev       Before rev on the same branch.\n",
00052     "\t   rev         Just rev.\n",
00053     "\t   rev1:rev2   Between rev1 and rev2, including rev1 and rev2.\n",
00054     "\t   rev:        rev and following revisions on the same branch.\n",
00055     "\t   :rev        rev and previous revisions on the same branch.\n",
00056     "\t-q         Run quietly.\n",
00057     "\t-s state[:rev]  Set revision state (latest revision on branch,\n",
00058     "\t                latest revision on trunk if omitted).\n",
00059     "\t-t[file]   Get descriptive text from file (stdin if omitted).\n",
00060     "\t-t-string  Set descriptive text.\n",
00061     "\t-u[rev]    Unlock the revision (latest revision on branch,\n",
00062     "\t           latest revision on trunk if omitted).\n",
00063     "\t-U         Unset strict locking.\n",
00064     "(Specify the --help global option for a list of other help options)\n",
00065     NULL
00066 };
00067
00068 /* This structure is used to pass information through start_recursion.  */
00069 struct admin_data
00070 {
00071     /* Set default branch (-b).  It is "-b" followed by the value
00072        given, or NULL if not specified, or merely "-b" if -b is
00073        specified without a value.  */
00074     char *branch;
00075
00076     /* Set comment leader (-c).  It is "-c" followed by the value
00077        given, or NULL if not specified.  The comment leader is
00078        relevant only for old versions of RCS, but we let people set it
00079        anyway.  */
00080     char *comment;
00081
00082     /* Set strict locking (-L).  */
00083     int set_strict;
00084
00085     /* Set nonstrict locking (-U).  */
00086     int set_nonstrict;
00087
00088     /* Delete revisions (-o).  It is "-o" followed by the value specified.  */
00089     char *delete_revs;
00090
00091     /* Keyword substitution mode (-k), e.g. "-kb".  */
00092     char *kflag;
00093
00094     /* Description (-t).  */
00095     char *desc;
00096
00097     /* Interactive (-I).  Problematic with client/server.  */
00098     int interactive;
00099
00100     /* Quiet (-q).  Not the same as the global -q option, which is a bit
00101        on the confusing side, perhaps.  */
00102     int quiet;
00103
00104     /* This is the cheesy part.  It is a vector with the options which
00105        we don't deal with above (e.g. "-afoo" "-abar,baz").  In the future
00106        this presumably will be replaced by other variables which break
00107        out the data in a more convenient fashion.  AV as well as each of
00108        the strings it points to is malloc'd.  */
00109     int ac;
00110     char **av;
00111     int av_alloc;
00112 };
00113
00114 /* Add an argument.  OPT is the option letter, e.g. 'a'.  ARG is the
00115    argument to that option, or NULL if omitted (whether NULL can actually
00116    happen depends on whether the option was specified as optional to
00117    getopt).  */
00118 static void
00119 arg_add (dat, opt, arg)
00120     struct admin_data *dat;
00121     int opt;
00122     char *arg;
00123 {
00124     char *newelt = xmalloc ((arg == NULL ? 0 : strlen (arg)) + 3);
00125     strcpy (newelt, "-");
00126     newelt[1] = opt;
00127     if (arg == NULL)
00128     newelt[2] = '\0';
00129     else
00130     strcpy (newelt + 2, arg);
00131
00132     if (dat->av_alloc == 0)
00133     {
00134     dat->av_alloc = 1;
00135     dat->av = (char **) xmalloc (dat->av_alloc * sizeof (*dat->av));
00136     }
00137     else if (dat->ac >= dat->av_alloc)
00138     {
00139     dat->av_alloc *= 2;
00140     dat->av = (char **) xrealloc (dat->av,
00141                       dat->av_alloc * sizeof (*dat->av));
00142     }
00143     dat->av[dat->ac++] = newelt;
00144 }
00145
00146 int
00147 admin (argc, argv)
00148     int argc;
00149     char **argv;
00150 {
00151     int err;
00152 #ifdef CVS_ADMIN_GROUP
00153     struct group *grp;
00154     struct group *getgrnam();
00155 #endif
00156     struct admin_data admin_data;
00157     int c;
00158     int i;
00159     int only_k_option;
00160
00161     if (argc <= 1)
00162     usage (admin_usage);
00163
00164     wrap_setup ();
00165
00166     memset (&admin_data, 0, sizeof admin_data);
00167
00168     /* TODO: get rid of `-' switch notation in admin_data.  For
00169        example, admin_data->branch should be not `-bfoo' but simply `foo'. */
00170
00171     optind = 0;
00172     only_k_option = 1;
00173     while ((c = getopt (argc, argv,
00174             "+ib::c:a:A:e::l::u::LUn:N:m:o:s:t::IqxV:k:")) != -1)
00175     {
00176     if (c != 'k')
00177         only_k_option = 0;
00178
00179     switch (c)
00180     {
00181         case 'i':
00182         /* This has always been documented as useless in cvs.texinfo
00183            and it really is--admin_fileproc silently does nothing
00184            if vers->vn_user is NULL. */
00185         error (0, 0, "the -i option to admin is not supported");
00186         error (0, 0, "run add or import to create an RCS file");
00187         goto usage_error;
00188
00189         case 'b':
00190         if (admin_data.branch != NULL)
00191         {
00192             error (0, 0, "duplicate 'b' option");
00193             goto usage_error;
00194         }
00195         if (optarg == NULL)
00196             admin_data.branch = xstrdup ("-b");
00197         else
00198         {
00199             admin_data.branch = xmalloc (strlen (optarg) + 5);
00200             strcpy (admin_data.branch, "-b");
00201             strcat (admin_data.branch, optarg);
00202         }
00203         break;
00204
00205         case 'c':
00206         if (admin_data.comment != NULL)
00207         {
00208             error (0, 0, "duplicate 'c' option");
00209             goto usage_error;
00210         }
00211         admin_data.comment = xmalloc (strlen (optarg) + 5);
00212         strcpy (admin_data.comment, "-c");
00213         strcat (admin_data.comment, optarg);
00214         break;
00215
00216         case 'a':
00217         arg_add (&admin_data, 'a', optarg);
00218         break;
00219
00220         case 'A':
00221         /* In the client/server case, this is cheesy because
00222            we just pass along the name of the RCS file, which
00223            then will want to exist on the server.  This is
00224            accidental; having the client specify a pathname on
00225            the server is not a design feature of the protocol.  */
00226         arg_add (&admin_data, 'A', optarg);
00227         break;
00228
00229         case 'e':
00230         arg_add (&admin_data, 'e', optarg);
00231         break;
00232
00233         case 'l':
00234         /* Note that multiple -l options are legal.  */
00235         arg_add (&admin_data, 'l', optarg);
00236         break;
00237
00238         case 'u':
00239         /* Note that multiple -u options are legal.  */
00240         arg_add (&admin_data, 'u', optarg);
00241         break;
00242
00243         case 'L':
00244         /* Probably could also complain if -L is specified multiple
00245            times, although RCS doesn't and I suppose it is reasonable
00246            just to have it mean the same as a single -L.  */
00247         if (admin_data.set_nonstrict)
00248         {
00249             error (0, 0, "-U and -L are incompatible");
00250             goto usage_error;
00251         }
00252         admin_data.set_strict = 1;
00253         break;
00254
00255         case 'U':
00256         /* Probably could also complain if -U is specified multiple
00257            times, although RCS doesn't and I suppose it is reasonable
00258            just to have it mean the same as a single -U.  */
00259         if (admin_data.set_strict)
00260         {
00261             error (0, 0, "-U and -L are incompatible");
00262             goto usage_error;
00263         }
00264         admin_data.set_nonstrict = 1;
00265         break;
00266
00267         case 'n':
00268         /* Mostly similar to cvs tag.  Could also be parsing
00269            the syntax of optarg, although for now we just pass
00270            it to rcs as-is.  Note that multiple -n options are
00271            legal.  */
00272         arg_add (&admin_data, 'n', optarg);
00273         break;
00274
00275         case 'N':
00276         /* Mostly similar to cvs tag.  Could also be parsing
00277            the syntax of optarg, although for now we just pass
00278            it to rcs as-is.  Note that multiple -N options are
00279            legal.  */
00280         arg_add (&admin_data, 'N', optarg);
00281         break;
00282
00283         case 'm':
00284         /* Change log message.  Could also be parsing the syntax
00285            of optarg, although for now we just pass it to rcs
00286            as-is.  Note that multiple -m options are legal.  */
00287         arg_add (&admin_data, 'm', optarg);
00288         break;
00289
00290         case 'o':
00291         /* Delete revisions.  Probably should also be parsing the
00292            syntax of optarg, so that the client can give errors
00293            rather than making the server take care of that.
00294            Other than that I'm not sure whether it matters much
00295            whether we parse it here or in admin_fileproc.
00296
00297            Note that multiple -o options are illegal, in RCS
00298            as well as here.  */
00299
00300         if (admin_data.delete_revs != NULL)
00301         {
00302             error (0, 0, "duplicate '-o' option");
00303             goto usage_error;
00304         }
00305         admin_data.delete_revs = xmalloc (strlen (optarg) + 5);
00306         strcpy (admin_data.delete_revs, "-o");
00307         strcat (admin_data.delete_revs, optarg);
00308         break;
00309
00310         case 's':
00311         /* Note that multiple -s options are legal.  */
00312         arg_add (&admin_data, 's', optarg);
00313         break;
00314
00315         case 't':
00316         if (admin_data.desc != NULL)
00317         {
00318             error (0, 0, "duplicate 't' option");
00319             goto usage_error;
00320         }
00321         if (optarg != NULL && optarg[0] == '-')
00322             admin_data.desc = xstrdup (optarg + 1);
00323         else
00324         {
00325             size_t bufsize = 0;
00326             size_t len;
00327
00328             get_file (optarg, optarg, "r", &admin_data.desc,
00329                   &bufsize, &len);
00330         }
00331         break;
00332
00333         case 'I':
00334         /* At least in RCS this can be specified several times,
00335            with the same meaning as being specified once.  */
00336         admin_data.interactive = 1;
00337         break;
00338
00339         case 'q':
00340         admin_data.quiet = 1;
00341         break;
00342
00343         case 'x':
00344         error (0, 0, "the -x option has never done anything useful");
00345         error (0, 0, "RCS files in CVS always end in ,v");
00346         goto usage_error;
00347
00348         case 'V':
00349         /* No longer supported. */
00350         error (0, 0, "the `-V' option is obsolete");
00351         break;
00352
00353         case 'k':
00354         if (admin_data.kflag != NULL)
00355         {
00356             error (0, 0, "duplicate '-k' option");
00357             goto usage_error;
00358         }
00359         admin_data.kflag = RCS_check_kflag (optarg);
00360         break;
00361         default:
00362         case '?':
00363         /* getopt will have printed an error message.  */
00364
00365         usage_error:
00366         /* Don't use command_name; it might be "server".  */
00367             error (1, 0, "specify %s -H admin for usage information",
00368                program_name);
00369     }
00370     }
00371     argc -= optind;
00372     argv += optind;
00373
00374 #ifdef CVS_ADMIN_GROUP
00375     grp = getgrnam(CVS_ADMIN_GROUP);
00376      /* skip usage right check if group CVS_ADMIN_GROUP does not exist */
00377     if (grp != NULL)
00378     {
00379     char *me = getcaller();
00380     char **grnam = grp->gr_mem;
00381     /* The use of `cvs admin -k' is unrestricted.  However, any
00382        other option is restricted.  */
00383     int denied = ! only_k_option;
00384
00385     while (*grnam)
00386     {
00387         if (strcmp(*grnam, me) == 0)
00388         {
00389         denied = 0;
00390         break;
00391         }
00392         grnam++;
00393     }
00394
00395     if (denied)
00396         error (1, 0, "usage is restricted to members of the group %s",
00397            CVS_ADMIN_GROUP);
00398     }
00399 #endif
00400
00401     for (i = 0; i < admin_data.ac; ++i)
00402     {
00403     assert (admin_data.av[i][0] == '-');
00404     switch (admin_data.av[i][1])
00405     {
00406         case 'm':
00407         case 'l':
00408         case 'u':
00409         check_numeric (&admin_data.av[i][2], argc, argv);
00410         break;
00411         default:
00412         break;
00413     }
00414     }
00415     if (admin_data.branch != NULL)
00416     check_numeric (admin_data.branch + 2, argc, argv);
00417     if (admin_data.delete_revs != NULL)
00418     {
00419     char *p;
00420
00421     check_numeric (admin_data.delete_revs + 2, argc, argv);
00422     p = strchr (admin_data.delete_revs + 2, ':');
00423     if (p != NULL && isdigit ((unsigned char) p[1]))
00424         check_numeric (p + 1, argc, argv);
00425     else if (p != NULL && p[1] == ':' && isdigit ((unsigned char) p[2]))
00426         check_numeric (p + 2, argc, argv);
00427     }
00428
00429 #ifdef CLIENT_SUPPORT
00430     if (client_active)
00431     {
00432     /* We're the client side.  Fire up the remote server.  */
00433     start_server ();
00434
00435     ign_setup ();
00436
00437     /* Note that option_with_arg does not work for us, because some
00438        of the options must be sent without a space between the option
00439        and its argument.  */
00440     if (admin_data.interactive)
00441         error (1, 0, "-I option not useful with client/server");
00442     if (admin_data.branch != NULL)
00443         send_arg (admin_data.branch);
00444     if (admin_data.comment != NULL)
00445         send_arg (admin_data.comment);
00446     if (admin_data.set_strict)
00447         send_arg ("-L");
00448     if (admin_data.set_nonstrict)
00449         send_arg ("-U");
00450     if (admin_data.delete_revs != NULL)
00451         send_arg (admin_data.delete_revs);
00452     if (admin_data.desc != NULL)
00453     {
00454         char *p = admin_data.desc;
00455         send_to_server ("Argument -t-", 0);
00456         while (*p)
00457         {
00458         if (*p == '\n')
00459         {
00460             send_to_server ("\012Argumentx ", 0);
00461             ++p;
00462         }
00463         else
00464         {
00465             char *q = strchr (p, '\n');
00466             if (q == NULL) q = p + strlen (p);
00467             send_to_server (p, q - p);
00468             p = q;
00469         }
00470         }
00471         send_to_server ("\012", 1);
00472     }
00473     if (admin_data.quiet)
00474         send_arg ("-q");
00475     if (admin_data.kflag != NULL)
00476         send_arg (admin_data.kflag);
00477
00478     for (i = 0; i < admin_data.ac; ++i)
00479         send_arg (admin_data.av[i]);
00480
00481     send_files (argc, argv, 0, 0, SEND_NO_CONTENTS);
00482     send_file_names (argc, argv, SEND_EXPAND_WILD);
00483     send_to_server ("admin\012", 0);
00484         err = get_responses_and_close ();
00485     goto return_it;
00486     }
00487 #endif /* CLIENT_SUPPORT */
00488
00489     lock_tree_for_write (argc, argv, 0, 0);
00490
00491     err = start_recursion (admin_fileproc, (FILESDONEPROC) NULL, admin_dirproc,
00492                (DIRLEAVEPROC) NULL, (void *)&admin_data,
00493                argc, argv, 0,
00494                W_LOCAL, 0, 0, (char *) NULL, 1);
00495     Lock_Cleanup ();
00496
00497  return_it:
00498     if (admin_data.branch != NULL)
00499     free (admin_data.branch);
00500     if (admin_data.comment != NULL)
00501     free (admin_data.comment);
00502     if (admin_data.delete_revs != NULL)
00503     free (admin_data.delete_revs);
00504     if (admin_data.kflag != NULL)
00505     free (admin_data.kflag);
00506     if (admin_data.desc != NULL)
00507     free (admin_data.desc);
00508     for (i = 0; i < admin_data.ac; ++i)
00509     free (admin_data.av[i]);
00510     if (admin_data.av != NULL)
00511     free (admin_data.av);
00512
00513     return (err);
00514 }
00515
00516 /*
00517  * Called to run "rcs" on a particular file.
00518  */
00519 /* ARGSUSED */
00520 static int
00521 admin_fileproc (callerdat, finfo)
00522     void *callerdat;
00523     struct file_info *finfo;
00524 {
00525     struct admin_data *admin_data = (struct admin_data *) callerdat;
00526     Vers_TS *vers;
00527     char *version;
00528     int i;
00529     int status = 0;
00530     RCSNode *rcs, *rcs2;
00531
00532     vers = Version_TS (finfo, NULL, NULL, NULL, 0, 0);
00533
00534     version = vers->vn_user;
00535     if (version == NULL)
00536     goto exitfunc;
00537     else if (strcmp (version, "0") == 0)
00538     {
00539     error (0, 0, "cannot admin newly added file `%s'", finfo->file);
00540     goto exitfunc;
00541     }
00542
00543     rcs = vers->srcfile;
00544     if (rcs->flags & PARTIAL)
00545     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
00546
00547     status = 0;
00548
00549     if (!admin_data->quiet)
00550     {
00551     cvs_output ("RCS file: ", 0);
00552     cvs_output (rcs->path, 0);
00553     cvs_output ("\n", 1);
00554     }
00555
00556     if (admin_data->branch != NULL)
00557     {
00558     char *branch = &admin_data->branch[2];
00559     if (*branch != '\0' && ! isdigit ((unsigned char) *branch))
00560     {
00561         branch = RCS_whatbranch (rcs, admin_data->branch + 2);
00562         if (branch == NULL)
00563         {
00564         error (0, 0, "%s: Symbolic name %s is undefined.",
00565                 rcs->path, admin_data->branch + 2);
00566         status = 1;
00567         }
00568     }
00569     if (status == 0)
00570         RCS_setbranch (rcs, branch);
00571     if (branch != NULL && branch != &admin_data->branch[2])
00572         free (branch);
00573     }
00574     if (admin_data->comment != NULL)
00575     {
00576     if (rcs->comment != NULL)
00577         free (rcs->comment);
00578     rcs->comment = xstrdup (admin_data->comment + 2);
00579     }
00580     if (admin_data->set_strict)
00581     rcs->strict_locks = 1;
00582     if (admin_data->set_nonstrict)
00583     rcs->strict_locks = 0;
00584     if (admin_data->delete_revs != NULL)
00585     {
00586     char *s, *t, *rev1, *rev2;
00587     /* Set for :, clear for ::.  */
00588     int inclusive;
00589     char *t2;
00590
00591     s = admin_data->delete_revs + 2;
00592     inclusive = 1;
00593     t = strchr (s, ':');
00594     if (t != NULL)
00595     {
00596         if (t[1] == ':')
00597         {
00598         inclusive = 0;
00599         t2 = t + 2;
00600         }
00601         else
00602         t2 = t + 1;
00603     }
00604
00605     /* Note that we don't support '-' for ranges.  RCS considers it
00606        obsolete and it is problematic with tags containing '-'.  "cvs log"
00607        has made the same decision.  */
00608
00609     if (t == NULL)
00610     {
00611         /* -orev */
00612         rev1 = xstrdup (s);
00613         rev2 = xstrdup (s);
00614     }
00615     else if (t == s)
00616     {
00617         /* -o:rev2 */
00618         rev1 = NULL;
00619         rev2 = xstrdup (t2);
00620     }
00621     else
00622     {
00623         *t = '\0';
00624         rev1 = xstrdup (s);
00625         *t = ':';   /* probably unnecessary */
00626         if (*t2 == '\0')
00627         /* -orev1: */
00628         rev2 = NULL;
00629         else
00630         /* -orev1:rev2 */
00631         rev2 = xstrdup (t2);
00632     }
00633
00634     if (rev1 == NULL && rev2 == NULL)
00635     {
00636         /* RCS segfaults if `-o:' is given */
00637         error (0, 0, "no valid revisions specified in `%s' option",
00638            admin_data->delete_revs);
00639         status = 1;
00640     }
00641     else
00642     {
00643         status |= RCS_delete_revs (rcs, rev1, rev2, inclusive);
00644         if (rev1)
00645         free (rev1);
00646         if (rev2)
00647         free (rev2);
00648     }
00649     }
00650     if (admin_data->desc != NULL)
00651     {
00652     free (rcs->desc);
00653     rcs->desc = xstrdup (admin_data->desc);
00654     }
00655     if (admin_data->kflag != NULL)
00656     {
00657     char *kflag = admin_data->kflag + 2;
00658     char *oldexpand = RCS_getexpand (rcs);
00659     if (oldexpand == NULL || strcmp (oldexpand, kflag) != 0)
00660         RCS_setexpand (rcs, kflag);
00661     }
00662
00663     /* Handle miscellaneous options.  TODO: decide whether any or all
00664        of these should have their own fields in the admin_data
00665        structure. */
00666     for (i = 0; i < admin_data->ac; ++i)
00667     {
00668     char *arg;
00669     char *p, *rev, *revnum, *tag, *msg;
00670     char **users;
00671     int argc, u;
00672     Node *n;
00673     RCSVers *delta;
00674
00675     arg = admin_data->av[i];
00676     switch (arg[1])
00677     {
00678         case 'a': /* fall through */
00679         case 'e':
00680             line2argv (&argc, &users, arg + 2, " ,\t\n");
00681         if (arg[1] == 'a')
00682             for (u = 0; u < argc; ++u)
00683             RCS_addaccess (rcs, users[u]);
00684         else if (argc == 0)
00685             RCS_delaccess (rcs, NULL);
00686         else
00687             for (u = 0; u < argc; ++u)
00688             RCS_delaccess (rcs, users[u]);
00689         free_names (&argc, users);
00690         break;
00691         case 'A':
00692
00693         /* See admin-19a-admin and friends in sanity.sh for
00694            relative pathnames.  It makes sense to think in
00695            terms of a syntax which give pathnames relative to
00696            the repository or repository corresponding to the
00697            current directory or some such (and perhaps don't
00698            include ,v), but trying to worry about such things
00699            is a little pointless unless you first worry about
00700            whether "cvs admin -A" as a whole makes any sense
00701            (currently probably not, as access lists don't
00702            affect the behavior of CVS).  */
00703
00704         rcs2 = RCS_parsercsfile (arg + 2);
00705         if (rcs2 == NULL)
00706             error (1, 0, "cannot continue");
00707
00708         p = xstrdup (RCS_getaccess (rcs2));
00709             line2argv (&argc, &users, p, " \t\n");
00710         free (p);
00711         freercsnode (&rcs2);
00712
00713         for (u = 0; u < argc; ++u)
00714             RCS_addaccess (rcs, users[u]);
00715         free_names (&argc, users);
00716         break;
00717         case 'n': /* fall through */
00718         case 'N':
00719         if (arg[2] == '\0')
00720         {
00721             cvs_outerr ("missing symbolic name after ", 0);
00722             cvs_outerr (arg, 0);
00723             cvs_outerr ("\n", 1);
00724             break;
00725         }
00726         p = strchr (arg, ':');
00727         if (p == NULL)
00728         {
00729             if (RCS_deltag (rcs, arg + 2) != 0)
00730             {
00731             error (0, 0, "%s: Symbolic name %s is undefined.",
00732                    rcs->path,
00733                    arg + 2);
00734             status = 1;
00735             continue;
00736             }
00737             break;
00738         }
00739         *p = '\0';
00740         tag = xstrdup (arg + 2);
00741         *p++ = ':';
00742
00743         /* Option `n' signals an error if this tag is already bound. */
00744         if (arg[1] == 'n')
00745         {
00746             n = findnode (RCS_symbols (rcs), tag);
00747             if (n != NULL)
00748             {
00749             error (0, 0,
00750                    "%s: symbolic name %s already bound to %s",
00751                    rcs->path,
00752                    tag, n->data);
00753             status = 1;
00754             free (tag);
00755             continue;
00756             }
00757         }
00758
00759                 /* Attempt to perform the requested tagging.  */
00760
00761         if ((*p == 0 && (rev = RCS_head (rcs)))
00762                     || (rev = RCS_tag2rev (rcs, p))) /* tag2rev may exit */
00763         {
00764             RCS_check_tag (tag); /* exit if not a valid tag */
00765             RCS_settag (rcs, tag, rev);
00766             free (rev);
00767         }
00768                 else
00769         {
00770             error (0, 0,
00771               "%s: Symbolic name or revision %s is undefined",
00772                rcs->path, p);
00773             status = 1;
00774         }
00775         free (tag);
00776         break;
00777         case 's':
00778             p = strchr (arg, ':');
00779         if (p == NULL)
00780         {
00781             tag = xstrdup (arg + 2);
00782             rev = RCS_head (rcs);
00783         }
00784         else
00785         {
00786             *p = '\0';
00787             tag = xstrdup (arg + 2);
00788             *p++ = ':';
00789             rev = xstrdup (p);
00790         }
00791         revnum = RCS_gettag (rcs, rev, 0, NULL);
00792         if (revnum != NULL)
00793         {
00794             n = findnode (rcs->versions, revnum);
00795             free (revnum);
00796         }
00797         else
00798             n = NULL;
00799         if (n == NULL)
00800         {
00801             error (0, 0,
00802                "%s: can't set state of nonexisting revision %s",
00803                rcs->path,
00804                rev);
00805             free (rev);
00806             status = 1;
00807             continue;
00808         }
00809         free (rev);
00810         delta = (RCSVers *) n->data;
00811         free (delta->state);
00812         delta->state = tag;
00813         break;
00814
00815         case 'm':
00816             p = strchr (arg, ':');
00817         if (p == NULL)
00818         {
00819             error (0, 0, "%s: -m option lacks revision number",
00820                rcs->path);
00821             status = 1;
00822             continue;
00823         }
00824         *p = '\0';
00825         rev = RCS_gettag (rcs, arg + 2, 0, NULL);
00826         if (rev == NULL)
00827         {
00828             error (0, 0, "%s: no such revision %s", rcs->path, rev);
00829             status = 1;
00830             continue;
00831         }
00832         *p++ = ':';
00833         msg = p;
00834
00835         n = findnode (rcs->versions, rev);
00836         free (rev);
00837         delta = (RCSVers *) n->data;
00838         if (delta->text == NULL)
00839         {
00840             delta->text = (Deltatext *) xmalloc (sizeof (Deltatext));
00841             memset ((void *) delta->text, 0, sizeof (Deltatext));
00842         }
00843         delta->text->version = xstrdup (delta->version);
00844         delta->text->log = make_message_rcslegal (msg);
00845         break;
00846
00847         case 'l':
00848             status |= RCS_lock (rcs, arg[2] ? arg + 2 : NULL, 0);
00849         break;
00850         case 'u':
00851         status |= RCS_unlock (rcs, arg[2] ? arg + 2 : NULL, 0);
00852         break;
00853         default: assert(0); /* can't happen */
00854     }
00855     }
00856
00857     /* TODO: reconcile the weird discrepancies between
00858        admin_data->quiet and quiet. */
00859     if (status == 0)
00860     {
00861     RCS_rewrite (rcs, NULL, NULL);
00862     if (!admin_data->quiet)
00863         cvs_output ("done\n", 5);
00864     }
00865     else
00866     {
00867     /* Note that this message should only occur after another
00868        message has given a more specific error.  The point of this
00869        additional message is to make it clear that the previous problems
00870        caused CVS to forget about the idea of modifying the RCS file.  */
00871     error (0, 0, "cannot modify RCS file for `%s'", finfo->file);
00872     RCS_abandon (rcs);
00873     }
00874
00875   exitfunc:
00876     freevers_ts (&vers);
00877     return status;
00878 }
00879
00880 /*
00881  * Print a warm fuzzy message
00882  */
00883 /* ARGSUSED */
00884 static Dtype
00885 admin_dirproc (callerdat, dir, repos, update_dir, entries)
00886     void *callerdat;
00887     char *dir;
00888     char *repos;
00889     char *update_dir;
00890     List *entries;
00891 {
00892     if (!quiet)
00893     error (0, 0, "Administrating %s", update_dir);
00894     return (R_PROCESS);
00895 }
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/buffer.c Source File

cvs-1.10/src/buffer.c

Go to the documentation of this file.
00001 /* Code for the buffer data structure.  */
00002
00003 #include <assert.h>
00004 #include "cvs.h"
00005 #include "buffer.h"
00006
00007 #if defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT)
00008
00009 /* OS/2 doesn't have EIO.  FIXME: this whole notion of turning
00010    a different error into EIO strikes me as pretty dubious.  */
00011 #if !defined (EIO)
00012 #define EIO EBADPOS
00013 #endif
00014
00015 /* Linked list of available buffer_data structures.  */
00016 static struct buffer_data *free_buffer_data;
00017
00018 /* Local functions.  */
00019 static void buf_default_memory_error PROTO ((struct buffer *));
00020 static void allocate_buffer_datas PROTO((void));
00021 static struct buffer_data *get_buffer_data PROTO((void));
00022
00023 /* Initialize a buffer structure.  */
00024
00025 struct buffer *
00026 buf_initialize (input, output, flush, block, shutdown, memory, closure)
00027      int (*input) PROTO((void *, char *, int, int, int *));
00028      int (*output) PROTO((void *, const char *, int, int *));
00029      int (*flush) PROTO((void *));
00030      int (*block) PROTO((void *, int));
00031      int (*shutdown) PROTO((void *));
00032      void (*memory) PROTO((struct buffer *));
00033      void *closure;
00034 {
00035     struct buffer *buf;
00036
00037     buf = (struct buffer *) xmalloc (sizeof (struct buffer));
00038     buf->data = NULL;
00039     buf->last = NULL;
00040     buf->nonblocking = 0;
00041     buf->input = input;
00042     buf->output = output;
00043     buf->flush = flush;
00044     buf->block = block;
00045     buf->shutdown = shutdown;
00046     buf->memory_error = memory ? memory : buf_default_memory_error;
00047     buf->closure = closure;
00048     return buf;
00049 }
00050
00051 /* Free a buffer structure.  */
00052
00053 void
00054 buf_free (buf)
00055      struct buffer *buf;
00056 {
00057     if (buf->data != NULL)
00058     {
00059     buf->last->next = free_buffer_data;
00060     free_buffer_data = buf->data;
00061     }
00062     free (buf);
00063 }
00064
00065 /* Initialize a buffer structure which is not to be used for I/O.  */
00066
00067 struct buffer *
00068 buf_nonio_initialize (memory)
00069      void (*memory) PROTO((struct buffer *));
00070 {
00071     return (buf_initialize
00072         ((int (*) PROTO((void *, char *, int, int, int *))) NULL,
00073          (int (*) PROTO((void *, const char *, int, int *))) NULL,
00074          (int (*) PROTO((void *))) NULL,
00075          (int (*) PROTO((void *, int))) NULL,
00076          (int (*) PROTO((void *))) NULL,
00077          memory,
00078          (void *) NULL));
00079 }
00080
00081 /* Default memory error handler.  */
00082
00083 static void
00084 buf_default_memory_error (buf)
00085      struct buffer *buf;
00086 {
00087     error (1, 0, "out of memory");
00088 }
00089
00090 /* Allocate more buffer_data structures.  */
00091
00092 static void
00093 allocate_buffer_datas ()
00094 {
00095     struct buffer_data *alc;
00096     char *space;
00097     int i;
00098
00099     /* Allocate buffer_data structures in blocks of 16.  */
00100 #define ALLOC_COUNT (16)
00101
00102     alc = ((struct buffer_data *)
00103        malloc (ALLOC_COUNT * sizeof (struct buffer_data)));
00104     space = (char *) valloc (ALLOC_COUNT * BUFFER_DATA_SIZE);
00105     if (alc == NULL || space == NULL)
00106     return;
00107     for (i = 0; i < ALLOC_COUNT; i++, alc++, space += BUFFER_DATA_SIZE)
00108     {
00109     alc->next = free_buffer_data;
00110     free_buffer_data = alc;
00111     alc->text = space;
00112     }
00113 }
00114
00115 /* Get a new buffer_data structure.  */
00116
00117 static struct buffer_data *
00118 get_buffer_data ()
00119 {
00120     struct buffer_data *ret;
00121
00122     if (free_buffer_data == NULL)
00123     {
00124     allocate_buffer_datas ();
00125     if (free_buffer_data == NULL)
00126         return NULL;
00127     }
00128
00129     ret = free_buffer_data;
00130     free_buffer_data = ret->next;
00131     return ret;
00132 }
00133
00134 /* See whether a buffer is empty.  */
00135
00136 int
00137 buf_empty_p (buf)
00138     struct buffer *buf;
00139 {
00140     struct buffer_data *data;
00141
00142     for (data = buf->data; data != NULL; data = data->next)
00143     if (data->size > 0)
00144         return 0;
00145     return 1;
00146 }
00147
00148 #ifdef SERVER_FLOWCONTROL
00149 /*
00150  * Count how much data is stored in the buffer..
00151  * Note that each buffer is a malloc'ed chunk BUFFER_DATA_SIZE.
00152  */
00153
00154 int
00155 buf_count_mem (buf)
00156     struct buffer *buf;
00157 {
00158     struct buffer_data *data;
00159     int mem = 0;
00160
00161     for (data = buf->data; data != NULL; data = data->next)
00162     mem += BUFFER_DATA_SIZE;
00163
00164     return mem;
00165 }
00166 #endif /* SERVER_FLOWCONTROL */
00167
00168 /* Add data DATA of length LEN to BUF.  */
00169
00170 void
00171 buf_output (buf, data, len)
00172     struct buffer *buf;
00173     const char *data;
00174     int len;
00175 {
00176     if (buf->data != NULL
00177     && (((buf->last->text + BUFFER_DATA_SIZE)
00178          - (buf->last->bufp + buf->last->size))
00179         >= len))
00180     {
00181     memcpy (buf->last->bufp + buf->last->size, data, len);
00182     buf->last->size += len;
00183     return;
00184     }
00185
00186     while (1)
00187     {
00188     struct buffer_data *newdata;
00189
00190     newdata = get_buffer_data ();
00191     if (newdata == NULL)
00192     {
00193         (*buf->memory_error) (buf);
00194         return;
00195     }
00196
00197     if (buf->data == NULL)
00198         buf->data = newdata;
00199     else
00200         buf->last->next = newdata;
00201     newdata->next = NULL;
00202     buf->last = newdata;
00203
00204     newdata->bufp = newdata->text;
00205
00206     if (len <= BUFFER_DATA_SIZE)
00207     {
00208         newdata->size = len;
00209         memcpy (newdata->text, data, len);
00210         return;
00211     }
00212
00213     newdata->size = BUFFER_DATA_SIZE;
00214     memcpy (newdata->text, data, BUFFER_DATA_SIZE);
00215
00216     data += BUFFER_DATA_SIZE;
00217     len -= BUFFER_DATA_SIZE;
00218     }
00219
00220     /*NOTREACHED*/
00221 }
00222
00223 /* Add a '\0' terminated string to BUF.  */
00224
00225 void
00226 buf_output0 (buf, string)
00227     struct buffer *buf;
00228     const char *string;
00229 {
00230     buf_output (buf, string, strlen (string));
00231 }
00232
00233 /* Add a single character to BUF.  */
00234
00235 void
00236 buf_append_char (buf, ch)
00237     struct buffer *buf;
00238     int ch;
00239 {
00240     if (buf->data != NULL
00241     && (buf->last->text + BUFFER_DATA_SIZE
00242         != buf->last->bufp + buf->last->size))
00243     {
00244     *(buf->last->bufp + buf->last->size) = ch;
00245     ++buf->last->size;
00246     }
00247     else
00248     {
00249     char b;
00250
00251     b = ch;
00252     buf_output (buf, &b, 1);
00253     }
00254 }
00255
00256 /*
00257  * Send all the output we've been saving up.  Returns 0 for success or
00258  * errno code.  If the buffer has been set to be nonblocking, this
00259  * will just write until the write would block.
00260  */
00261
00262 int
00263 buf_send_output (buf)
00264      struct buffer *buf;
00265 {
00266     if (buf->output == NULL)
00267     abort ();
00268
00269     while (buf->data != NULL)
00270     {
00271     struct buffer_data *data;
00272
00273     data = buf->data;
00274
00275     if (data->size > 0)
00276     {
00277         int status, nbytes;
00278
00279         status = (*buf->output) (buf->closure, data->bufp, data->size,
00280                      &nbytes);
00281         if (status != 0)
00282         {
00283         /* Some sort of error.  Discard the data, and return.  */
00284
00285         buf->last->next = free_buffer_data;
00286         free_buffer_data = buf->data;
00287         buf->data = NULL;
00288         buf->last = NULL;
00289
00290             return status;
00291         }
00292
00293         if (nbytes != data->size)
00294         {
00295         /* Not all the data was written out.  This is only
00296                    permitted in nonblocking mode.  Adjust the buffer,
00297                    and return.  */
00298
00299         assert (buf->nonblocking);
00300
00301         data->size -= nbytes;
00302         data->bufp += nbytes;
00303
00304         return 0;
00305         }
00306     }
00307
00308     buf->data = data->next;
00309     data->next = free_buffer_data;
00310     free_buffer_data = data;
00311     }
00312
00313     buf->last = NULL;
00314
00315     return 0;
00316 }
00317
00318 /*
00319  * Flush any data queued up in the buffer.  If BLOCK is nonzero, then
00320  * if the buffer is in nonblocking mode, put it into blocking mode for
00321  * the duration of the flush.  This returns 0 on success, or an error
00322  * code.
00323  */
00324
00325 int
00326 buf_flush (buf, block)
00327      struct buffer *buf;
00328      int block;
00329 {
00330     int nonblocking;
00331     int status;
00332
00333     if (buf->flush == NULL)
00334         abort ();
00335
00336     nonblocking = buf->nonblocking;
00337     if (nonblocking && block)
00338     {
00339         status = set_block (buf);
00340     if (status != 0)
00341         return status;
00342     }
00343
00344     status = buf_send_output (buf);
00345     if (status == 0)
00346         status = (*buf->flush) (buf->closure);
00347
00348     if (nonblocking && block)
00349     {
00350         int blockstat;
00351
00352         blockstat = set_nonblock (buf);
00353     if (status == 0)
00354         status = blockstat;
00355     }
00356
00357     return status;
00358 }
00359
00360 /*
00361  * Set buffer BUF to nonblocking I/O.  Returns 0 for success or errno
00362  * code.
00363  */
00364
00365 int
00366 set_nonblock (buf)
00367      struct buffer *buf;
00368 {
00369     int status;
00370
00371     if (buf->nonblocking)
00372     return 0;
00373     if (buf->block == NULL)
00374         abort ();
00375     status = (*buf->block) (buf->closure, 0);
00376     if (status != 0)
00377     return status;
00378     buf->nonblocking = 1;
00379     return 0;
00380 }
00381
00382 /*
00383  * Set buffer BUF to blocking I/O.  Returns 0 for success or errno
00384  * code.
00385  */
00386
00387 int
00388 set_block (buf)
00389      struct buffer *buf;
00390 {
00391     int status;
00392
00393     if (! buf->nonblocking)
00394     return 0;
00395     if (buf->block == NULL)
00396         abort ();
00397     status = (*buf->block) (buf->closure, 1);
00398     if (status != 0)
00399     return status;
00400     buf->nonblocking = 0;
00401     return 0;
00402 }
00403
00404 /*
00405  * Send a character count and some output.  Returns errno code or 0 for
00406  * success.
00407  *
00408  * Sending the count in binary is OK since this is only used on a pipe
00409  * within the same system.
00410  */
00411
00412 int
00413 buf_send_counted (buf)
00414      struct buffer *buf;
00415 {
00416     int size;
00417     struct buffer_data *data;
00418
00419     size = 0;
00420     for (data = buf->data; data != NULL; data = data->next)
00421     size += data->size;
00422
00423     data = get_buffer_data ();
00424     if (data == NULL)
00425     {
00426     (*buf->memory_error) (buf);
00427     return ENOMEM;
00428     }
00429
00430     data->next = buf->data;
00431     buf->data = data;
00432     if (buf->last == NULL)
00433     buf->last = data;
00434
00435     data->bufp = data->text;
00436     data->size = sizeof (int);
00437
00438     *((int *) data->text) = size;
00439
00440     return buf_send_output (buf);
00441 }
00442
00443 /*
00444  * Send a special count.  COUNT should be negative.  It will be
00445  * handled speciallyi by buf_copy_counted.  This function returns 0 or
00446  * an errno code.
00447  *
00448  * Sending the count in binary is OK since this is only used on a pipe
00449  * within the same system.
00450  */
00451
00452 int
00453 buf_send_special_count (buf, count)
00454      struct buffer *buf;
00455      int count;
00456 {
00457     struct buffer_data *data;
00458
00459     data = get_buffer_data ();
00460     if (data == NULL)
00461     {
00462     (*buf->memory_error) (buf);
00463     return ENOMEM;
00464     }
00465
00466     data->next = buf->data;
00467     buf->data = data;
00468     if (buf->last == NULL)
00469     buf->last = data;
00470
00471     data->bufp = data->text;
00472     data->size = sizeof (int);
00473
00474     *((int *) data->text) = count;
00475
00476     return buf_send_output (buf);
00477 }
00478
00479 /* Append a list of buffer_data structures to an buffer.  */
00480
00481 void
00482 buf_append_data (buf, data, last)
00483      struct buffer *buf;
00484      struct buffer_data *data;
00485      struct buffer_data *last;
00486 {
00487     if (data != NULL)
00488     {
00489     if (buf->data == NULL)
00490         buf->data = data;
00491     else
00492         buf->last->next = data;
00493     buf->last = last;
00494     }
00495 }
00496
00497 /* Append the data on one buffer to another.  This removes the data
00498    from the source buffer.  */
00499
00500 void
00501 buf_append_buffer (to, from)
00502      struct buffer *to;
00503      struct buffer *from;
00504 {
00505     buf_append_data (to, from->data, from->last);
00506     from->data = NULL;
00507     from->last = NULL;
00508 }
00509
00510 /*
00511  * Copy the contents of file F into buffer_data structures.  We can't
00512  * copy directly into an buffer, because we want to handle failure and
00513  * succeess differently.  Returns 0 on success, or -2 if out of
00514  * memory, or a status code on error.  Since the caller happens to
00515  * know the size of the file, it is passed in as SIZE.  On success,
00516  * this function sets *RETP and *LASTP, which may be passed to
00517  * buf_append_data.
00518  */
00519
00520 int
00521 buf_read_file (f, size, retp, lastp)
00522     FILE *f;
00523     long size;
00524     struct buffer_data **retp;
00525     struct buffer_data **lastp;
00526 {
00527     int status;
00528
00529     *retp = NULL;
00530     *lastp = NULL;
00531
00532     while (size > 0)
00533     {
00534     struct buffer_data *data;
00535     int get;
00536
00537     data = get_buffer_data ();
00538     if (data == NULL)
00539     {
00540         status = -2;
00541         goto error_return;
00542     }
00543
00544     if (*retp == NULL)
00545         *retp = data;
00546     else
00547         (*lastp)->next = data;
00548     data->next = NULL;
00549     *lastp = data;
00550
00551     data->bufp = data->text;
00552     data->size = 0;
00553
00554     if (size > BUFFER_DATA_SIZE)
00555         get = BUFFER_DATA_SIZE;
00556     else
00557         get = size;
00558
00559     errno = EIO;
00560     if (fread (data->text, get, 1, f) != 1)
00561     {
00562         status = errno;
00563         goto error_return;
00564     }
00565
00566     data->size += get;
00567     size -= get;
00568     }
00569
00570     return 0;
00571
00572   error_return:
00573     if (*retp != NULL)
00574     {
00575     (*lastp)->next = free_buffer_data;
00576     free_buffer_data = *retp;
00577     }
00578     return status;
00579 }
00580
00581 /*
00582  * Copy the contents of file F into buffer_data structures.  We can't
00583  * copy directly into an buffer, because we want to handle failure and
00584  * succeess differently.  Returns 0 on success, or -2 if out of
00585  * memory, or a status code on error.  On success, this function sets
00586  * *RETP and *LASTP, which may be passed to buf_append_data.
00587  */
00588
00589 int
00590 buf_read_file_to_eof (f, retp, lastp)
00591      FILE *f;
00592      struct buffer_data **retp;
00593      struct buffer_data **lastp;
00594 {
00595     int status;
00596
00597     *retp = NULL;
00598     *lastp = NULL;
00599
00600     while (!feof (f))
00601     {
00602     struct buffer_data *data;
00603     int get, nread;
00604
00605     data = get_buffer_data ();
00606     if (data == NULL)
00607     {
00608         status = -2;
00609         goto error_return;
00610     }
00611
00612     if (*retp == NULL)
00613         *retp = data;
00614     else
00615         (*lastp)->next = data;
00616     data->next = NULL;
00617     *lastp = data;
00618
00619     data->bufp = data->text;
00620     data->size = 0;
00621
00622     get = BUFFER_DATA_SIZE;
00623
00624     errno = EIO;
00625     nread = fread (data->text, 1, get, f);
00626     if (nread == 0 && !feof (f))
00627     {
00628         status = errno;
00629         goto error_return;
00630     }
00631
00632     data->size = nread;
00633     }
00634
00635     return 0;
00636
00637   error_return:
00638     if (*retp != NULL)
00639     {
00640     (*lastp)->next = free_buffer_data;
00641     free_buffer_data = *retp;
00642     }
00643     return status;
00644 }
00645
00646 /* Return the number of bytes in a chain of buffer_data structures.  */
00647
00648 int
00649 buf_chain_length (buf)
00650      struct buffer_data *buf;
00651 {
00652     int size = 0;
00653     while (buf)
00654     {
00655     size += buf->size;
00656     buf = buf->next;
00657     }
00658     return size;
00659 }
00660
00661 /* Return the number of bytes in a buffer.  */
00662
00663 int
00664 buf_length (buf)
00665     struct buffer *buf;
00666 {
00667     return buf_chain_length (buf->data);
00668 }
00669
00670 /*
00671  * Read an arbitrary amount of data into an input buffer.  The buffer
00672  * will be in nonblocking mode, and we just grab what we can.  Return
00673  * 0 on success, or -1 on end of file, or -2 if out of memory, or an
00674  * error code.  If COUNTP is not NULL, *COUNTP is set to the number of
00675  * bytes read.
00676  */
00677
00678 int
00679 buf_input_data (buf, countp)
00680      struct buffer *buf;
00681      int *countp;
00682 {
00683     if (buf->input == NULL)
00684     abort ();
00685
00686     if (countp != NULL)
00687     *countp = 0;
00688
00689     while (1)
00690     {
00691     int get;
00692     int status, nbytes;
00693
00694     if (buf->data == NULL
00695         || (buf->last->bufp + buf->last->size
00696         == buf->last->text + BUFFER_DATA_SIZE))
00697     {
00698         struct buffer_data *data;
00699
00700         data = get_buffer_data ();
00701         if (data == NULL)
00702         {
00703         (*buf->memory_error) (buf);
00704         return -2;
00705         }
00706
00707         if (buf->data == NULL)
00708         buf->data = data;
00709         else
00710         buf->last->next = data;
00711         data->next = NULL;
00712         buf->last = data;
00713
00714         data->bufp = data->text;
00715         data->size = 0;
00716     }
00717
00718     get = ((buf->last->text + BUFFER_DATA_SIZE)
00719            - (buf->last->bufp + buf->last->size));
00720
00721     status = (*buf->input) (buf->closure,
00722                 buf->last->bufp + buf->last->size,
00723                 0, get, &nbytes);
00724     if (status != 0)
00725         return status;
00726
00727     buf->last->size += nbytes;
00728     if (countp != NULL)
00729         *countp += nbytes;
00730
00731     if (nbytes < get)
00732     {
00733         /* If we did not fill the buffer, then presumably we read
00734                all the available data.  */
00735         return 0;
00736     }
00737     }
00738
00739     /*NOTREACHED*/
00740 }
00741
00742 /*
00743  * Read a line (characters up to a \012) from an input buffer.  (We
00744  * use \012 rather than \n for the benefit of non Unix clients for
00745  * which \n means something else).  This returns 0 on success, or -1
00746  * on end of file, or -2 if out of memory, or an error code.  If it
00747  * succeeds, it sets *LINE to an allocated buffer holding the contents
00748  * of the line.  The trailing \012 is not included in the buffer.  If
00749  * LENP is not NULL, then *LENP is set to the number of bytes read;
00750  * strlen may not work, because there may be embedded null bytes.
00751  */
00752
00753 int
00754 buf_read_line (buf, line, lenp)
00755      struct buffer *buf;
00756      char **line;
00757      int *lenp;
00758 {
00759     if (buf->input == NULL)
00760         abort ();
00761
00762     *line = NULL;
00763
00764     while (1)
00765     {
00766     int len, finallen = 0;
00767     struct buffer_data *data;
00768     char *nl;
00769
00770     /* See if there is a newline in BUF.  */
00771     len = 0;
00772     for (data = buf->data; data != NULL; data = data->next)
00773     {
00774         nl = memchr (data->bufp, '\012', data->size);
00775         if (nl != NULL)
00776         {
00777             finallen = nl - data->bufp;
00778             len += finallen;
00779         break;
00780         }
00781         len += data->size;
00782     }
00783
00784     /* If we found a newline, copy the line into a memory buffer,
00785            and remove it from BUF.  */
00786     if (data != NULL)
00787     {
00788         char *p;
00789         struct buffer_data *nldata;
00790
00791         p = malloc (len + 1);
00792         if (p == NULL)
00793         return -2;
00794         *line = p;
00795
00796         nldata = data;
00797         data = buf->data;
00798         while (data != nldata)
00799         {
00800         struct buffer_data *next;
00801
00802         memcpy (p, data->bufp, data->size);
00803         p += data->size;
00804         next = data->next;
00805         data->next = free_buffer_data;
00806         free_buffer_data = data;
00807         data = next;
00808         }
00809
00810         memcpy (p, data->bufp, finallen);
00811         p[finallen] = '\0';
00812
00813         data->size -= finallen + 1;
00814         data->bufp = nl + 1;
00815         buf->data = data;
00816
00817         if (lenp != NULL)
00818             *lenp = len;
00819
00820         return 0;
00821     }
00822
00823     /* Read more data until we get a newline.  */
00824     while (1)
00825     {
00826         int size, status, nbytes;
00827         char *mem;
00828
00829         if (buf->data == NULL
00830         || (buf->last->bufp + buf->last->size
00831             == buf->last->text + BUFFER_DATA_SIZE))
00832         {
00833         data = get_buffer_data ();
00834         if (data == NULL)
00835         {
00836             (*buf->memory_error) (buf);
00837             return -2;
00838         }
00839
00840         if (buf->data == NULL)
00841             buf->data = data;
00842         else
00843             buf->last->next = data;
00844         data->next = NULL;
00845         buf->last = data;
00846
00847         data->bufp = data->text;
00848         data->size = 0;
00849         }
00850
00851         mem = buf->last->bufp + buf->last->size;
00852         size = (buf->last->text + BUFFER_DATA_SIZE) - mem;
00853
00854         /* We need to read at least 1 byte.  We can handle up to
00855                SIZE bytes.  This will only be efficient if the
00856                underlying communication stream does its own buffering,
00857                or is clever about getting more than 1 byte at a time.  */
00858         status = (*buf->input) (buf->closure, mem, 1, size, &nbytes);
00859         if (status != 0)
00860         return status;
00861
00862         buf->last->size += nbytes;
00863
00864         /* Optimize slightly to avoid an unnecessary call to
00865                memchr.  */
00866         if (nbytes == 1)
00867         {
00868         if (*mem == '\012')
00869             break;
00870         }
00871         else
00872         {
00873         if (memchr (mem, '\012', nbytes) != NULL)
00874             break;
00875         }
00876     }
00877     }
00878 }
00879
00880 /*
00881  * Extract data from the input buffer BUF.  This will read up to WANT
00882  * bytes from the buffer.  It will set *RETDATA to point at the bytes,
00883  * and set *GOT to the number of bytes to be found there.  Any buffer
00884  * call which uses BUF may change the contents of the buffer at *DATA,
00885  * so the data should be fully processed before any further calls are
00886  * made.  This returns 0 on success, or -1 on end of file, or -2 if
00887  * out of memory, or an error code.
00888  */
00889
00890 int
00891 buf_read_data (buf, want, retdata, got)
00892      struct buffer *buf;
00893      int want;
00894      char **retdata;
00895      int *got;
00896 {
00897     if (buf->input == NULL)
00898     abort ();
00899
00900     while (buf->data != NULL && buf->data->size == 0)
00901     {
00902     struct buffer_data *next;
00903
00904     next = buf->data->next;
00905     buf->data->next = free_buffer_data;
00906     free_buffer_data = buf->data;
00907     buf->data = next;
00908     if (next == NULL)
00909         buf->last = NULL;
00910     }
00911
00912     if (buf->data == NULL)
00913     {
00914     struct buffer_data *data;
00915     int get, status, nbytes;
00916
00917     data = get_buffer_data ();
00918     if (data == NULL)
00919     {
00920         (*buf->memory_error) (buf);
00921         return -2;
00922     }
00923
00924     buf->data = data;
00925     buf->last = data;
00926     data->next = NULL;
00927     data->bufp = data->text;
00928     data->size = 0;
00929
00930     if (want < BUFFER_DATA_SIZE)
00931         get = want;
00932     else
00933         get = BUFFER_DATA_SIZE;
00934     status = (*buf->input) (buf->closure, data->bufp, get,
00935                 BUFFER_DATA_SIZE, &nbytes);
00936     if (status != 0)
00937         return status;
00938
00939     data->size = nbytes;
00940     }
00941
00942     *retdata = buf->data->bufp;
00943     if (want < buf->data->size)
00944     {
00945         *got = want;
00946     buf->data->size -= want;
00947     buf->data->bufp += want;
00948     }
00949     else
00950     {
00951         *got = buf->data->size;
00952     buf->data->size = 0;
00953     }
00954
00955     return 0;
00956 }
00957
00958 /*
00959  * Copy lines from an input buffer to an output buffer.  This copies
00960  * all complete lines (characters up to a newline) from INBUF to
00961  * OUTBUF.  Each line in OUTBUF is preceded by the character COMMAND
00962  * and a space.
00963  */
00964
00965 void
00966 buf_copy_lines (outbuf, inbuf, command)
00967      struct buffer *outbuf;
00968      struct buffer *inbuf;
00969      int command;
00970 {
00971     while (1)
00972     {
00973     struct buffer_data *data;
00974     struct buffer_data *nldata;
00975     char *nl;
00976     int len;
00977
00978     /* See if there is a newline in INBUF.  */
00979     nldata = NULL;
00980     nl = NULL;
00981     for (data = inbuf->data; data != NULL; data = data->next)
00982     {
00983         nl = memchr (data->bufp, '\n', data->size);
00984         if (nl != NULL)
00985         {
00986         nldata = data;
00987         break;
00988         }
00989     }
00990
00991     if (nldata == NULL)
00992     {
00993         /* There are no more lines in INBUF.  */
00994         return;
00995     }
00996
00997     /* Put in the command.  */
00998     buf_append_char (outbuf, command);
00999     buf_append_char (outbuf, ' ');
01000
01001     if (inbuf->data != nldata)
01002     {
01003         /*
01004          * Simply move over all the buffers up to the one containing
01005          * the newline.
01006          */
01007         for (data = inbuf->data; data->next != nldata; data = data->next)
01008         ;
01009         data->next = NULL;
01010         buf_append_data (outbuf, inbuf->data, data);
01011         inbuf->data = nldata;
01012     }
01013
01014     /*
01015      * If the newline is at the very end of the buffer, just move
01016      * the buffer onto OUTBUF.  Otherwise we must copy the data.
01017      */
01018     len = nl + 1 - nldata->bufp;
01019     if (len == nldata->size)
01020     {
01021         inbuf->data = nldata->next;
01022         if (inbuf->data == NULL)
01023         inbuf->last = NULL;
01024
01025         nldata->next = NULL;
01026         buf_append_data (outbuf, nldata, nldata);
01027     }
01028     else
01029     {
01030         buf_output (outbuf, nldata->bufp, len);
01031         nldata->bufp += len;
01032         nldata->size -= len;
01033     }
01034     }
01035 }
01036
01037 /*
01038  * Copy counted data from one buffer to another.  The count is an
01039  * integer, host size, host byte order (it is only used across a
01040  * pipe).  If there is enough data, it should be moved over.  If there
01041  * is not enough data, it should remain on the original buffer.  A
01042  * negative count is a special case.  if one is seen, *SPECIAL is set
01043  * to the (negative) count value and no additional data is gathered
01044  * from the buffer; normally *SPECIAL is set to 0.  This function
01045  * returns the number of bytes it needs to see in order to actually
01046  * copy something over.
01047  */
01048
01049 int
01050 buf_copy_counted (outbuf, inbuf, special)
01051      struct buffer *outbuf;
01052      struct buffer *inbuf;
01053      int *special;
01054 {
01055     *special = 0;
01056
01057     while (1)
01058     {
01059     struct buffer_data *data;
01060     int need;
01061     union
01062     {
01063         char intbuf[sizeof (int)];
01064         int i;
01065     } u;
01066     char *intp;
01067     int count;
01068     struct buffer_data *start;
01069     int startoff;
01070     struct buffer_data *stop;
01071     int stopwant;
01072
01073     /* See if we have enough bytes to figure out the count.  */
01074     need = sizeof (int);
01075     intp = u.intbuf;
01076     for (data = inbuf->data; data != NULL; data = data->next)
01077     {
01078         if (data->size >= need)
01079         {
01080         memcpy (intp, data->bufp, need);
01081         break;
01082         }
01083         memcpy (intp, data->bufp, data->size);
01084         intp += data->size;
01085         need -= data->size;
01086     }
01087     if (data == NULL)
01088     {
01089         /* We don't have enough bytes to form an integer.  */
01090         return need;
01091     }
01092
01093     count = u.i;
01094     start = data;
01095     startoff = need;
01096
01097     if (count < 0)
01098     {
01099         /* A negative COUNT is a special case meaning that we
01100                don't need any further information.  */
01101         stop = start;
01102         stopwant = 0;
01103     }
01104     else
01105     {
01106         /*
01107          * We have an integer in COUNT.  We have gotten all the
01108          * data from INBUF in all buffers before START, and we
01109          * have gotten STARTOFF bytes from START.  See if we have
01110          * enough bytes remaining in INBUF.
01111          */
01112         need = count - (start->size - startoff);
01113         if (need <= 0)
01114         {
01115         stop = start;
01116         stopwant = count;
01117         }
01118         else
01119         {
01120         for (data = start->next; data != NULL; data = data->next)
01121         {
01122             if (need <= data->size)
01123             break;
01124             need -= data->size;
01125         }
01126         if (data == NULL)
01127         {
01128             /* We don't have enough bytes.  */
01129             return need;
01130         }
01131         stop = data;
01132         stopwant = need;
01133         }
01134     }
01135
01136     /*
01137      * We have enough bytes.  Free any buffers in INBUF before
01138      * START, and remove STARTOFF bytes from START, so that we can
01139      * forget about STARTOFF.
01140      */
01141     start->bufp += startoff;
01142     start->size -= startoff;
01143
01144     if (start->size == 0)
01145         start = start->next;
01146
01147     if (stop->size == stopwant)
01148     {
01149         stop = stop->next;
01150         stopwant = 0;
01151     }
01152
01153     while (inbuf->data != start)
01154     {
01155         data = inbuf->data;
01156         inbuf->data = data->next;
01157         data->next = free_buffer_data;
01158         free_buffer_data = data;
01159     }
01160
01161     /* If COUNT is negative, set *SPECIAL and get out now.  */
01162     if (count < 0)
01163     {
01164         *special = count;
01165         return 0;
01166     }
01167
01168     /*
01169      * We want to copy over the bytes from START through STOP.  We
01170      * only want STOPWANT bytes from STOP.
01171      */
01172
01173     if (start != stop)
01174     {
01175         /* Attach the buffers from START through STOP to OUTBUF.  */
01176         for (data = start; data->next != stop; data = data->next)
01177         ;
01178         inbuf->data = stop;
01179         data->next = NULL;
01180         buf_append_data (outbuf, start, data);
01181     }
01182
01183     if (stopwant > 0)
01184     {
01185         buf_output (outbuf, stop->bufp, stopwant);
01186         stop->bufp += stopwant;
01187         stop->size -= stopwant;
01188     }
01189     }
01190
01191     /*NOTREACHED*/
01192 }
01193
01194 /* Shut down a buffer.  This returns 0 on success, or an errno code.  */
01195
01196 int
01197 buf_shutdown (buf)
01198      struct buffer *buf;
01199 {
01200     if (buf->shutdown)
01201     return (*buf->shutdown) (buf->closure);
01202     return 0;
01203 }
01204
01205 /* The simplest type of buffer is one built on top of a stdio FILE.
01206    For simplicity, and because it is all that is required, we do not
01207    implement setting this type of buffer into nonblocking mode.  The
01208    closure field is just a FILE *.  */
01209
01210 static int stdio_buffer_input PROTO((void *, char *, int, int, int *));
01211 static int stdio_buffer_output PROTO((void *, const char *, int, int *));
01212 static int stdio_buffer_flush PROTO((void *));
01213
01214 /* Initialize a buffer built on a stdio FILE.  */
01215
01216 struct buffer *
01217 stdio_buffer_initialize (fp, input, memory)
01218      FILE *fp;
01219      int input;
01220      void (*memory) PROTO((struct buffer *));
01221 {
01222     return buf_initialize (input ? stdio_buffer_input : NULL,
01223                input ? NULL : stdio_buffer_output,
01224                input ? NULL : stdio_buffer_flush,
01225                (int (*) PROTO((void *, int))) NULL,
01226                (int (*) PROTO((void *))) NULL,
01227                memory,
01228                (void *) fp);
01229 }
01230
01231 /* The buffer input function for a buffer built on a stdio FILE.  */
01232
01233 static int
01234 stdio_buffer_input (closure, data, need, size, got)
01235      void *closure;
01236      char *data;
01237      int need;
01238      int size;
01239      int *got;
01240 {
01241     FILE *fp = (FILE *) closure;
01242     int nbytes;
01243
01244     /* Since stdio does its own buffering, we don't worry about
01245        getting more bytes than we need.  */
01246
01247     if (need == 0 || need == 1)
01248     {
01249         int ch;
01250
01251     ch = getc (fp);
01252
01253     if (ch == EOF)
01254     {
01255         if (feof (fp))
01256         return -1;
01257         else if (errno == 0)
01258         return EIO;
01259         else
01260         return errno;
01261     }
01262
01263     *data = ch;
01264     *got = 1;
01265     return 0;
01266     }
01267
01268     nbytes = fread (data, 1, need, fp);
01269
01270     if (nbytes == 0)
01271     {
01272     *got = 0;
01273     if (feof (fp))
01274         return -1;
01275     else if (errno == 0)
01276         return EIO;
01277     else
01278         return errno;
01279     }
01280
01281     *got = nbytes;
01282
01283     return 0;
01284 }
01285
01286 /* The buffer output function for a buffer built on a stdio FILE.  */
01287
01288 static int
01289 stdio_buffer_output (closure, data, have, wrote)
01290      void *closure;
01291      const char *data;
01292      int have;
01293      int *wrote;
01294 {
01295     FILE *fp = (FILE *) closure;
01296
01297     *wrote = 0;
01298
01299     while (have > 0)
01300     {
01301     int nbytes;
01302
01303     nbytes = fwrite (data, 1, have, fp);
01304
01305     if (nbytes != have)
01306     {
01307         if (errno == 0)
01308         return EIO;
01309         else
01310         return errno;
01311     }
01312
01313     *wrote += nbytes;
01314     have -= nbytes;
01315     data += nbytes;
01316     }
01317
01318     return 0;
01319 }
01320
01321 /* The buffer flush function for a buffer built on a stdio FILE.  */
01322
01323 static int
01324 stdio_buffer_flush (closure)
01325      void *closure;
01326 {
01327     FILE *fp = (FILE *) closure;
01328
01329     if (fflush (fp) != 0)
01330     {
01331     if (errno == 0)
01332         return EIO;
01333     else
01334         return errno;
01335     }
01336
01337     return 0;
01338 }
01339
01340 /* Certain types of communication input and output data in packets,
01341    where each packet is translated in some fashion.  The packetizing
01342    buffer type supports that, given a buffer which handles lower level
01343    I/O and a routine to translate the data in a packet.
01344
01345    This code uses two bytes for the size of a packet, so packets are
01346    restricted to 65536 bytes in total.
01347
01348    The translation functions should just translate; they may not
01349    significantly increase or decrease the amount of data.  The actual
01350    size of the initial data is part of the translated data.  The
01351    output translation routine may add up to PACKET_SLOP additional
01352    bytes, and the input translation routine should shrink the data
01353    correspondingly.  */
01354
01355 #define PACKET_SLOP (100)
01356
01357 /* This structure is the closure field of a packetizing buffer.  */
01358
01359 struct packetizing_buffer
01360 {
01361     /* The underlying buffer.  */
01362     struct buffer *buf;
01363     /* The input translation function.  Exactly one of inpfn and outfn
01364        will be NULL.  The input translation function should
01365        untranslate the data in INPUT, storing the result in OUTPUT.
01366        SIZE is the amount of data in INPUT, and is also the size of
01367        OUTPUT.  This should return 0 on success, or an errno code.  */
01368     int (*inpfn) PROTO((void *fnclosure, const char *input, char *output,
01369             int size));
01370     /* The output translation function.  This should translate the
01371        data in INPUT, storing the result in OUTPUT.  The first two
01372        bytes in INPUT will be the size of the data, and so will SIZE.
01373        This should set *TRANSLATED to the amount of translated data in
01374        OUTPUT.  OUTPUT is large enough to hold SIZE + PACKET_SLOP
01375        bytes.  This should return 0 on success, or an errno code.  */
01376     int (*outfn) PROTO((void *fnclosure, const char *input, char *output,
01377             int size, int *translated));
01378     /* A closure for the translation function.  */
01379     void *fnclosure;
01380     /* For an input buffer, we may have to buffer up data here.  */
01381     /* This is non-zero if the buffered data has been translated.
01382        Otherwise, the buffered data has not been translated, and starts
01383        with the two byte packet size.  */
01384     int translated;
01385     /* The amount of buffered data.  */
01386     int holdsize;
01387     /* The buffer allocated to hold the data.  */
01388     char *holdbuf;
01389     /* The size of holdbuf.  */
01390     int holdbufsize;
01391     /* If translated is set, we need another data pointer to track
01392        where we are in holdbuf.  If translated is clear, then this
01393        pointer is not used.  */
01394     char *holddata;
01395 };
01396
01397 static int packetizing_buffer_input PROTO((void *, char *, int, int, int *));
01398 static int packetizing_buffer_output PROTO((void *, const char *, int, int *));
01399 static int packetizing_buffer_flush PROTO((void *));
01400 static int packetizing_buffer_block PROTO((void *, int));
01401 static int packetizing_buffer_shutdown PROTO((void *));
01402
01403 /* Create a packetizing buffer.  */
01404
01405 struct buffer *
01406 packetizing_buffer_initialize (buf, inpfn, outfn, fnclosure, memory)
01407      struct buffer *buf;
01408      int (*inpfn) PROTO ((void *, const char *, char *, int));
01409      int (*outfn) PROTO ((void *, const char *, char *, int, int *));
01410      void *fnclosure;
01411      void (*memory) PROTO((struct buffer *));
01412 {
01413     struct packetizing_buffer *pb;
01414
01415     pb = (struct packetizing_buffer *) xmalloc (sizeof *pb);
01416     memset (pb, 0, sizeof *pb);
01417
01418     pb->buf = buf;
01419     pb->inpfn = inpfn;
01420     pb->outfn = outfn;
01421     pb->fnclosure = fnclosure;
01422
01423     if (inpfn != NULL)
01424     {
01425     /* Add PACKET_SLOP to handle larger translated packets, and
01426            add 2 for the count.  This buffer is increased if
01427            necessary.  */
01428     pb->holdbufsize = BUFFER_DATA_SIZE + PACKET_SLOP + 2;
01429     pb->holdbuf = xmalloc (pb->holdbufsize);
01430     }
01431
01432     return buf_initialize (inpfn != NULL ? packetizing_buffer_input : NULL,
01433                inpfn != NULL ? NULL : packetizing_buffer_output,
01434                inpfn != NULL ? NULL : packetizing_buffer_flush,
01435                packetizing_buffer_block,
01436                packetizing_buffer_shutdown,
01437                memory,
01438                pb);
01439 }
01440
01441 /* Input data from a packetizing buffer.  */
01442
01443 static int
01444 packetizing_buffer_input (closure, data, need, size, got)
01445      void *closure;
01446      char *data;
01447      int need;
01448      int size;
01449      int *got;
01450 {
01451     struct packetizing_buffer *pb = (struct packetizing_buffer *) closure;
01452
01453     *got = 0;
01454
01455     if (pb->holdsize > 0 && pb->translated)
01456     {
01457     int copy;
01458
01459     copy = pb->holdsize;
01460
01461     if (copy > size)
01462     {
01463         memcpy (data, pb->holddata, size);
01464         pb->holdsize -= size;
01465         pb->holddata += size;
01466         *got = size;
01467         return 0;
01468     }
01469
01470     memcpy (data, pb->holddata, copy);
01471     pb->holdsize = 0;
01472     pb->translated = 0;
01473
01474     data += copy;
01475     need -= copy;
01476     size -= copy;
01477     *got = copy;
01478     }
01479
01480     while (need > 0 || *got == 0)
01481     {
01482     int get, status, nread, count, tcount;
01483     char *bytes;
01484     char stackoutbuf[BUFFER_DATA_SIZE + PACKET_SLOP];
01485     char *inbuf, *outbuf;
01486
01487     /* If we don't already have the two byte count, get it.  */
01488     if (pb->holdsize < 2)
01489     {
01490         get = 2 - pb->holdsize;
01491         status = buf_read_data (pb->buf, get, &bytes, &nread);
01492         if (status != 0)
01493         {
01494         /* buf_read_data can return -2, but a buffer input
01495                    function is only supposed to return -1, 0, or an
01496                    error code.  */
01497         if (status == -2)
01498             status = ENOMEM;
01499         return status;
01500         }
01501
01502         if (nread == 0)
01503         {
01504         /* The buffer is in nonblocking mode, and we didn't
01505                    manage to read anything.  */
01506         return 0;
01507         }
01508
01509         if (get == 1)
01510         pb->holdbuf[1] = bytes[0];
01511         else
01512         {
01513         pb->holdbuf[0] = bytes[0];
01514         if (nread < 2)
01515         {
01516             /* We only got one byte, but we needed two.  Stash
01517                        the byte we got, and try again.  */
01518             pb->holdsize = 1;
01519             continue;
01520         }
01521         pb->holdbuf[1] = bytes[1];
01522         }
01523         pb->holdsize = 2;
01524     }
01525
01526     /* Read the packet.  */
01527
01528     count = (((pb->holdbuf[0] & 0xff) << 8)
01529          + (pb->holdbuf[1] & 0xff));
01530
01531     if (count + 2 > pb->holdbufsize)
01532     {
01533         char *n;
01534
01535         /* We didn't allocate enough space in the initialize
01536                function.  */
01537
01538         n = realloc (pb->holdbuf, count + 2);
01539         if (n == NULL)
01540         {
01541         (*pb->buf->memory_error) (pb->buf);
01542         return ENOMEM;
01543         }
01544         pb->holdbuf = n;
01545         pb->holdbufsize = count + 2;
01546     }
01547
01548     get = count - (pb->holdsize - 2);
01549
01550     status = buf_read_data (pb->buf, get, &bytes, &nread);
01551     if (status != 0)
01552     {
01553         /* buf_read_data can return -2, but a buffer input
01554                function is only supposed to return -1, 0, or an error
01555                code.  */
01556         if (status == -2)
01557         status = ENOMEM;
01558         return status;
01559     }
01560
01561     if (nread == 0)
01562     {
01563         /* We did not get any data.  Presumably the buffer is in
01564                nonblocking mode.  */
01565         return 0;
01566     }
01567
01568     if (nread < get)
01569     {
01570         /* We did not get all the data we need to fill the packet.
01571                buf_read_data does not promise to return all the bytes
01572                requested, so we must try again.  */
01573         memcpy (pb->holdbuf + pb->holdsize, bytes, nread);
01574         pb->holdsize += nread;
01575         continue;
01576     }
01577
01578     /* We have a complete untranslated packet of COUNT bytes.  */
01579
01580     if (pb->holdsize == 2)
01581     {
01582         /* We just read the entire packet (the 2 bytes in
01583                PB->HOLDBUF are the size).  Save a memcpy by
01584                translating directly from BYTES.  */
01585         inbuf = bytes;
01586     }
01587     else
01588     {
01589         /* We already had a partial packet in PB->HOLDBUF.  We
01590                need to copy the new data over to make the input
01591                contiguous.  */
01592         memcpy (pb->holdbuf + pb->holdsize, bytes, nread);
01593         inbuf = pb->holdbuf + 2;
01594     }
01595
01596     if (count <= sizeof stackoutbuf)
01597         outbuf = stackoutbuf;
01598     else
01599     {
01600         outbuf = malloc (count);
01601         if (outbuf == NULL)
01602         {
01603         (*pb->buf->memory_error) (pb->buf);
01604         return ENOMEM;
01605         }
01606     }
01607
01608     status = (*pb->inpfn) (pb->fnclosure, inbuf, outbuf, count);
01609     if (status != 0)
01610         return status;
01611
01612     /* The first two bytes in the translated buffer are the real
01613            length of the translated data.  */
01614     tcount = ((outbuf[0] & 0xff) << 8) + (outbuf[1] & 0xff);
01615
01616     if (tcount > count)
01617         error (1, 0, "Input translation failure");
01618
01619     if (tcount > size)
01620     {
01621         /* We have more data than the caller has provided space
01622                for.  We need to save some of it for the next call.  */
01623
01624         memcpy (data, outbuf + 2, size);
01625         *got += size;
01626
01627         pb->holdsize = tcount - size;
01628         memcpy (pb->holdbuf, outbuf + 2 + size, tcount - size);
01629         pb->holddata = pb->holdbuf;
01630         pb->translated = 1;
01631
01632         if (outbuf != stackoutbuf)
01633         free (outbuf);
01634
01635         return 0;
01636     }
01637
01638     memcpy (data, outbuf + 2, tcount);
01639
01640     if (outbuf != stackoutbuf)
01641         free (outbuf);
01642
01643     pb->holdsize = 0;
01644
01645     data += tcount;
01646     need -= tcount;
01647     size -= tcount;
01648     *got += tcount;
01649     }
01650
01651     return 0;
01652 }
01653
01654 /* Output data to a packetizing buffer.  */
01655
01656 static int
01657 packetizing_buffer_output (closure, data, have, wrote)
01658      void *closure;
01659      const char *data;
01660      int have;
01661      int *wrote;
01662 {
01663     struct packetizing_buffer *pb = (struct packetizing_buffer *) closure;
01664     char inbuf[BUFFER_DATA_SIZE + 2];
01665     char stack_outbuf[BUFFER_DATA_SIZE + PACKET_SLOP + 4];
01666     struct buffer_data *outdata;
01667     char *outbuf;
01668     int size, status, translated;
01669
01670     if (have > BUFFER_DATA_SIZE)
01671     {
01672     /* It would be easy to malloc a buffer, but I don't think this
01673            case can ever arise.  */
01674     abort ();
01675     }
01676
01677     inbuf[0] = (have >> 8) & 0xff;
01678     inbuf[1] = have & 0xff;
01679     memcpy (inbuf + 2, data, have);
01680
01681     size = have + 2;
01682
01683     /* The output function is permitted to add up to PACKET_SLOP
01684        bytes, and we need 2 bytes for the size of the translated data.
01685        If we can guarantee that the result will fit in a buffer_data,
01686        we translate directly into one to avoid a memcpy in buf_output.  */
01687     if (size + PACKET_SLOP + 2 > BUFFER_DATA_SIZE)
01688     outbuf = stack_outbuf;
01689     else
01690     {
01691     outdata = get_buffer_data ();
01692     if (outdata == NULL)
01693     {
01694         (*pb->buf->memory_error) (pb->buf);
01695         return ENOMEM;
01696     }
01697
01698     outdata->next = NULL;
01699     outdata->bufp = outdata->text;
01700
01701     outbuf = outdata->text;
01702     }
01703
01704     status = (*pb->outfn) (pb->fnclosure, inbuf, outbuf + 2, size,
01705                &translated);
01706     if (status != 0)
01707     return status;
01708
01709     /* The output function is permitted to add up to PACKET_SLOP
01710        bytes.  */
01711     if (translated > size + PACKET_SLOP)
01712     abort ();
01713
01714     outbuf[0] = (translated >> 8) & 0xff;
01715     outbuf[1] = translated & 0xff;
01716
01717     if (outbuf == stack_outbuf)
01718     buf_output (pb->buf, outbuf, translated + 2);
01719     else
01720     {
01721     outdata->size = translated + 2;
01722     buf_append_data (pb->buf, outdata, outdata);
01723     }
01724
01725     *wrote = have;
01726
01727     /* We will only be here because buf_send_output was called on the
01728        packetizing buffer.  That means that we should now call
01729        buf_send_output on the underlying buffer.  */
01730     return buf_send_output (pb->buf);
01731 }
01732
01733 /* Flush data to a packetizing buffer.  */
01734
01735 static int
01736 packetizing_buffer_flush (closure)
01737      void *closure;
01738 {
01739     struct packetizing_buffer *pb = (struct packetizing_buffer *) closure;
01740
01741     /* Flush the underlying buffer.  Note that if the original call to
01742        buf_flush passed 1 for the BLOCK argument, then the buffer will
01743        already have been set into blocking mode, so we should always
01744        pass 0 here.  */
01745     return buf_flush (pb->buf, 0);
01746 }
01747
01748 /* The block routine for a packetizing buffer.  */
01749
01750 static int
01751 packetizing_buffer_block (closure, block)
01752      void *closure;
01753      int block;
01754 {
01755     struct packetizing_buffer *pb = (struct packetizing_buffer *) closure;
01756
01757     if (block)
01758     return set_block (pb->buf);
01759     else
01760     return set_nonblock (pb->buf);
01761 }
01762
01763 /* Shut down a packetizing buffer.  */
01764
01765 static int
01766 packetizing_buffer_shutdown (closure)
01767      void *closure;
01768 {
01769     struct packetizing_buffer *pb = (struct packetizing_buffer *) closure;
01770
01771     return buf_shutdown (pb->buf);
01772 }
01773
01774 #endif /* defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT) */
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/buffer.h Source File

cvs-1.10/src/buffer.h

Go to the documentation of this file.
00001 /* Declarations concerning the buffer data structure.  */
00002
00003 #if defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT)
00004
00005 /*
00006  * We must read data from a child process and send it across the
00007  * network.  We do not want to block on writing to the network, so we
00008  * store the data from the child process in memory.  A BUFFER
00009  * structure holds the status of one communication, and uses a linked
00010  * list of buffer_data structures to hold data.
00011  */
00012
00013 struct buffer
00014 {
00015     /* Data.  */
00016     struct buffer_data *data;
00017
00018     /* Last buffer on data chain.  */
00019     struct buffer_data *last;
00020
00021     /* Nonzero if the buffer is in nonblocking mode.  */
00022     int nonblocking;
00023
00024     /* Functions must be provided to transfer data in and out of the
00025        buffer.  Either the input or output field must be set, but not
00026        both.  */
00027
00028     /* Read data into the buffer DATA.  There is room for up to SIZE
00029        bytes.  In blocking mode, wait until some input, at least NEED
00030        bytes, is available (NEED may be 0 but that is the same as NEED
00031        == 1).  In non-blocking mode return immediately no matter how
00032        much input is available; NEED is ignored. Return 0 on success,
00033        or -1 on end of file, or an errno code.  Set the number of
00034        bytes read in *GOT.
00035
00036        If there are a nonzero number of bytes available, less than NEED,
00037        followed by end of file, just read those bytes and return 0.  */
00038     int (*input) PROTO((void *closure, char *data, int need, int size,
00039             int *got));
00040
00041     /* Write data.  This should write up to HAVE bytes from DATA.
00042        This should return 0 on success, or an errno code.  It should
00043        set the number of bytes written in *WROTE.  */
00044     int (*output) PROTO((void *closure, const char *data, int have,
00045              int *wrote));
00046
00047     /* Flush any data which may be buffered up after previous calls to
00048        OUTPUT.  This should return 0 on success, or an errno code.  */
00049     int (*flush) PROTO((void *closure));
00050
00051     /* Change the blocking mode of the underlying communication
00052        stream.  If BLOCK is non-zero, it should be placed into
00053        blocking mode.  Otherwise, it should be placed into
00054        non-blocking mode.  This should return 0 on success, or an
00055        errno code.  */
00056     int (*block) PROTO ((void *closure, int block));
00057
00058     /* Shut down the communication stream.  This does not mean that it
00059        should be closed.  It merely means that no more data will be
00060        read or written, and that any final processing that is
00061        appropriate should be done at this point.  This may be NULL.
00062        It should return 0 on success, or an errno code.  This entry
00063        point exists for the compression code.  */
00064     int (*shutdown) PROTO((void *closure));
00065
00066     /* This field is passed to the INPUT, OUTPUT, and BLOCK functions.  */
00067     void *closure;
00068
00069     /* Function to call if we can't allocate memory.  */
00070     void (*memory_error) PROTO((struct buffer *));
00071 };
00072
00073 /* Data is stored in lists of these structures.  */
00074
00075 struct buffer_data
00076 {
00077     /* Next buffer in linked list.  */
00078     struct buffer_data *next;
00079
00080     /*
00081      * A pointer into the data area pointed to by the text field.  This
00082      * is where to find data that has not yet been written out.
00083      */
00084     char *bufp;
00085
00086     /* The number of data bytes found at BUFP.  */
00087     int size;
00088
00089     /*
00090      * Actual buffer.  This never changes after the structure is
00091      * allocated.  The buffer is BUFFER_DATA_SIZE bytes.
00092      */
00093     char *text;
00094 };
00095
00096 /* The size we allocate for each buffer_data structure.  */
00097 #define BUFFER_DATA_SIZE (4096)
00098
00099 /* The type of a function passed as a memory error handler.  */
00100 typedef void (*BUFMEMERRPROC) PROTO ((struct buffer *));
00101
00102 extern struct buffer *buf_initialize PROTO((int (*) (void *, char *, int,
00103                              int, int *),
00104                         int (*) (void *, const char *,
00105                              int, int *),
00106                         int (*) (void *),
00107                         int (*) (void *, int),
00108                         int (*) (void *),
00109                         void (*) (struct buffer *),
00110                         void *));
00111 extern void buf_free PROTO((struct buffer *));
00112 extern struct buffer *buf_nonio_initialize PROTO((void (*) (struct buffer *)));
00113 extern struct buffer *stdio_buffer_initialize
00114   PROTO((FILE *, int, void (*) (struct buffer *)));
00115 extern struct buffer *compress_buffer_initialize
00116   PROTO((struct buffer *, int, int, void (*) (struct buffer *)));
00117 extern struct buffer *packetizing_buffer_initialize
00118   PROTO((struct buffer *, int (*) (void *, const char *, char *, int),
00119      int (*) (void *, const char *, char *, int, int *), void *,
00120      void (*) (struct buffer *)));
00121 extern int buf_empty_p PROTO((struct buffer *));
00122 extern void buf_output PROTO((struct buffer *, const char *, int));
00123 extern void buf_output0 PROTO((struct buffer *, const char *));
00124 extern void buf_append_char PROTO((struct buffer *, int));
00125 extern int buf_send_output PROTO((struct buffer *));
00126 extern int buf_flush PROTO((struct buffer *, int));
00127 extern int set_nonblock PROTO((struct buffer *));
00128 extern int set_block PROTO((struct buffer *));
00129 extern int buf_send_counted PROTO((struct buffer *));
00130 extern int buf_send_special_count PROTO((struct buffer *, int));
00131 extern void buf_append_data PROTO((struct buffer *,
00132                    struct buffer_data *,
00133                    struct buffer_data *));
00134 extern void buf_append_buffer PROTO((struct buffer *, struct buffer *));
00135 extern int buf_read_file PROTO((FILE *, long, struct buffer_data **,
00136                 struct buffer_data **));
00137 extern int buf_read_file_to_eof PROTO((FILE *, struct buffer_data **,
00138                        struct buffer_data **));
00139 extern int buf_input_data PROTO((struct buffer *, int *));
00140 extern int buf_read_line PROTO((struct buffer *, char **, int *));
00141 extern int buf_read_data PROTO((struct buffer *, int, char **, int *));
00142 extern void buf_copy_lines PROTO((struct buffer *, struct buffer *, int));
00143 extern int buf_copy_counted PROTO((struct buffer *, struct buffer *, int *));
00144 extern int buf_chain_length PROTO((struct buffer_data *));
00145 extern int buf_length PROTO((struct buffer *));
00146 extern int buf_shutdown PROTO((struct buffer *));
00147
00148 #ifdef SERVER_FLOWCONTROL
00149 extern int buf_count_mem PROTO((struct buffer *));
00150 #endif /* SERVER_FLOWCONTROL */
00151
00152 #endif /* defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT) */
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/checkin.c Source File

cvs-1.10/src/checkin.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Check In
00009  *
00010  * Does a very careful checkin of the file "user", and tries not to spoil its
00011  * modification time (to avoid needless recompilations). When RCS ID keywords
00012  * get expanded on checkout, however, the modification time is updated and
00013  * there is no good way to get around this.
00014  *
00015  * Returns non-zero on error.
00016  */
00017
00018 #include "cvs.h"
00019 #include "fileattr.h"
00020 #include "edit.h"
00021
00022 int
00023 Checkin (type, finfo, rcs, rev, tag, options, message)
00024     int type;
00025     struct file_info *finfo;
00026     char *rcs;
00027     char *rev;
00028     char *tag;
00029     char *options;
00030     char *message;
00031 {
00032     Vers_TS *vers;
00033     int set_time;
00034     char *tocvsPath = NULL;
00035
00036     /* Hmm.  This message goes to stdout and the "foo,v  <--  foo"
00037        message from "ci" goes to stderr.  This doesn't make a whole
00038        lot of sense, but making everything go to stdout can only be
00039        gracefully achieved once RCS_checkin is librarified.  */
00040     cvs_output ("Checking in ", 0);
00041     cvs_output (finfo->fullname, 0);
00042     cvs_output (";\n", 0);
00043
00044     tocvsPath = wrap_tocvs_process_file (finfo->file);
00045     if (!noexec)
00046     {
00047         if (tocvsPath)
00048     {
00049         if (unlink_file_dir (finfo->file) < 0)
00050         if (! existence_error (errno))
00051             error (1, errno, "cannot remove %s", finfo->fullname);
00052         rename_file (tocvsPath, finfo->file);
00053     }
00054     }
00055
00056     if (finfo->rcs == NULL)
00057     finfo->rcs = RCS_parse (finfo->file, finfo->repository);
00058
00059     switch (RCS_checkin (finfo->rcs, NULL, message, rev, RCS_FLAGS_KEEPFILE))
00060     {
00061     case 0:         /* everything normal */
00062
00063         /* The checkin succeeded.  If checking the file out again
00064                would not cause any changes, we are done.  Otherwise,
00065                we need to check out the file, which will change the
00066                modification time of the file.
00067
00068            The only way checking out the file could cause any
00069            changes is if the file contains RCS keywords.  So we if
00070            we are not expanding RCS keywords, we are done.  */
00071
00072         if (strcmp (options, "-V4") == 0) /* upgrade to V5 now */
00073         options[0] = '\0';
00074
00075         /* FIXME: If PreservePermissions is on, RCS_cmp_file is
00076                going to call RCS_checkout into a temporary file
00077                anyhow.  In that case, it would be more efficient to
00078                call RCS_checkout here, compare the resulting files
00079                using xcmp, and rename if necessary.  I think this
00080                should be fixed in RCS_cmp_file.  */
00081         if ((! preserve_perms
00082          && options != NULL
00083          && (strcmp (options, "-ko") == 0
00084              || strcmp (options, "-kb") == 0))
00085         || RCS_cmp_file (finfo->rcs, rev, options, finfo->file) == 0)
00086         {
00087         /* The existing file is correct.  We don't have to do
00088                    anything.  */
00089         set_time = 0;
00090         }
00091         else
00092         {
00093         /* The existing file is incorrect.  We need to check
00094                    out the correct file contents.  */
00095         if (RCS_checkout (finfo->rcs, finfo->file, rev, (char *) NULL,
00096                   options, RUN_TTY, (RCSCHECKOUTPROC) NULL,
00097                   (void *) NULL) != 0)
00098             error (1, 0, "failed when checking out new copy of %s",
00099                finfo->fullname);
00100         xchmod (finfo->file, 1);
00101         set_time = 1;
00102         }
00103
00104         wrap_fromcvs_process_file (finfo->file);
00105
00106         /*
00107          * If we want read-only files, muck the permissions here, before
00108          * getting the file time-stamp.
00109          */
00110         if (!cvswrite || fileattr_get (finfo->file, "_watched"))
00111         xchmod (finfo->file, 0);
00112
00113         /* Re-register with the new data.  */
00114         vers = Version_TS (finfo, NULL, tag, NULL, 1, set_time);
00115         if (strcmp (vers->options, "-V4") == 0)
00116         vers->options[0] = '\0';
00117         Register (finfo->entries, finfo->file, vers->vn_rcs, vers->ts_user,
00118               vers->options, vers->tag, vers->date, (char *) 0);
00119         history_write (type, NULL, vers->vn_rcs,
00120                finfo->file, finfo->repository);
00121
00122         if (tocvsPath)
00123         if (unlink_file_dir (tocvsPath) < 0)
00124             error (0, errno, "cannot remove %s", tocvsPath);
00125
00126         break;
00127
00128     case -1:            /* fork failed */
00129         if (tocvsPath)
00130         if (unlink_file_dir (tocvsPath) < 0)
00131             error (0, errno, "cannot remove %s", tocvsPath);
00132
00133         if (!noexec)
00134         error (1, errno, "could not check in %s -- fork failed",
00135                finfo->fullname);
00136         return (1);
00137
00138     default:            /* ci failed */
00139
00140         /* The checkin failed, for some unknown reason, so we
00141            print an error, and return an error.  We assume that
00142            the original file has not been touched.  */
00143         if (tocvsPath)
00144         if (unlink_file_dir (tocvsPath) < 0)
00145             error (0, errno, "cannot remove %s", tocvsPath);
00146
00147         if (!noexec)
00148         error (0, 0, "could not check in %s", finfo->fullname);
00149         return (1);
00150     }
00151
00152     /*
00153      * When checking in a specific revision, we may have locked the wrong
00154      * branch, so to be sure, we do an extra unlock here before
00155      * returning.
00156      */
00157     if (rev)
00158     {
00159     (void) RCS_unlock (finfo->rcs, NULL, 1);
00160     RCS_rewrite (finfo->rcs, NULL, NULL);
00161     }
00162
00163 #ifdef SERVER_SUPPORT
00164     if (server_active)
00165     {
00166     if (set_time)
00167         /* Need to update the checked out file on the client side.  */
00168         server_updated (finfo, vers, SERVER_UPDATED,
00169                 (mode_t) -1, (unsigned char *) NULL,
00170                 (struct buffer *) NULL);
00171     else
00172         server_checked_in (finfo->file, finfo->update_dir, finfo->repository);
00173     }
00174     else
00175 #endif
00176     mark_up_to_date (finfo->file);
00177
00178     freevers_ts (&vers);
00179     return (0);
00180 }
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/checkout.c Source File

cvs-1.10/src/checkout.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Create Version
00009  *
00010  * "checkout" creates a "version" of an RCS repository.  This version is owned
00011  * totally by the user and is actually an independent copy, to be dealt with
00012  * as seen fit.  Once "checkout" has been called in a given directory, it
00013  * never needs to be called again.  The user can keep up-to-date by calling
00014  * "update" when he feels like it; this will supply him with a merge of his
00015  * own modifications and the changes made in the RCS original.  See "update"
00016  * for details.
00017  *
00018  * "checkout" can be given a list of directories or files to be updated and in
00019  * the case of a directory, will recursivley create any sub-directories that
00020  * exist in the repository.
00021  *
00022  * When the user is satisfied with his own modifications, the present version
00023  * can be committed by "commit"; this keeps the present version in tact,
00024  * usually.
00025  *
00026  * The call is cvs checkout [options] <module-name>...
00027  *
00028  * "checkout" creates a directory ./CVS, in which it keeps its administration,
00029  * in two files, Repository and Entries. The first contains the name of the
00030  * repository.  The second contains one line for each registered file,
00031  * consisting of the version number it derives from, its time stamp at
00032  * derivation time and its name.  Both files are normal files and can be
00033  * edited by the user, if necessary (when the repository is moved, e.g.)
00034  */
00035
00036 #include <assert.h>
00037 #include "cvs.h"
00038
00039 static char *findslash PROTO((char *start, char *p));
00040 static int checkout_proc PROTO((int argc, char **argv, char *where,
00041                   char *mwhere, char *mfile, int shorten,
00042                   int local_specified, char *omodule,
00043                   char *msg));
00044
00045 static const char *const checkout_usage[] =
00046 {
00047     "Usage:\n  %s %s [-ANPRcflnps] [-r rev | -D date] [-d dir]\n",
00048     "    [-j rev1] [-j rev2] [-k kopt] modules...\n",
00049     "\t-A\tReset any sticky tags/date/kopts.\n",
00050     "\t-N\tDon't shorten module paths if -d specified.\n",
00051     "\t-P\tPrune empty directories.\n",
00052     "\t-R\tProcess directories recursively.\n",
00053     "\t-c\t\"cat\" the module database.\n",
00054     "\t-f\tForce a head revision match if tag/date not found.\n",
00055     "\t-l\tLocal directory only, not recursive\n",
00056     "\t-n\tDo not run module program (if any).\n",
00057     "\t-p\tCheck out files to standard output (avoids stickiness).\n",
00058     "\t-s\tLike -c, but include module status.\n",
00059     "\t-r rev\tCheck out revision or tag. (implies -P) (is sticky)\n",
00060     "\t-D date\tCheck out revisions as of date. (implies -P) (is sticky)\n",
00061     "\t-d dir\tCheck out into dir instead of module name.\n",
00062     "\t-k kopt\tUse RCS kopt -k option on checkout.\n",
00063     "\t-j rev\tMerge in changes made between current revision and rev.\n",
00064     "(Specify the --help global option for a list of other help options)\n",
00065     NULL
00066 };
00067
00068 static const char *const export_usage[] =
00069 {
00070     "Usage: %s %s [-NRfln] [-r rev | -D date] [-d dir] [-k kopt] module...\n",
00071     "\t-N\tDon't shorten module paths if -d specified.\n",
00072     "\t-f\tForce a head revision match if tag/date not found.\n",
00073     "\t-l\tLocal directory only, not recursive\n",
00074     "\t-R\tProcess directories recursively (default).\n",
00075     "\t-n\tDo not run module program (if any).\n",
00076     "\t-r rev\tExport revision or tag.\n",
00077     "\t-D date\tExport revisions as of date.\n",
00078     "\t-d dir\tExport into dir instead of module name.\n",
00079     "\t-k kopt\tUse RCS kopt -k option on checkout.\n",
00080     "(Specify the --help global option for a list of other help options)\n",
00081     NULL
00082 };
00083
00084 static int checkout_prune_dirs;
00085 static int force_tag_match = 1;
00086 static int pipeout;
00087 static int aflag;
00088 static char *options = NULL;
00089 static char *tag = NULL;
00090 static int tag_validated = 0;
00091 static char *date = NULL;
00092 static char *join_rev1 = NULL;
00093 static char *join_rev2 = NULL;
00094 static int join_tags_validated = 0;
00095 static char *preload_update_dir = NULL;
00096 static char *history_name = NULL;
00097 static enum mtype m_type;
00098
00099 int
00100 checkout (argc, argv)
00101     int argc;
00102     char **argv;
00103 {
00104     int i;
00105     int c;
00106     DBM *db;
00107     int cat = 0, err = 0, status = 0;
00108     int run_module_prog = 1;
00109     int local = 0;
00110     int shorten = -1;
00111     char *where = NULL;
00112     char *valid_options;
00113     const char *const *valid_usage;
00114
00115     /*
00116      * A smaller subset of options are allowed for the export command, which
00117      * is essentially like checkout, except that it hard-codes certain
00118      * options to be default (like -kv) and takes care to remove the CVS
00119      * directory when it has done its duty
00120      */
00121     if (strcmp (command_name, "export") == 0)
00122     {
00123         m_type = EXPORT;
00124     valid_options = "+Nnk:d:flRQqr:D:";
00125     valid_usage = export_usage;
00126     }
00127     else
00128     {
00129         m_type = CHECKOUT;
00130     valid_options = "+ANnk:d:flRpQqcsr:D:j:P";
00131     valid_usage = checkout_usage;
00132     }
00133
00134     if (argc == -1)
00135     usage (valid_usage);
00136
00137     ign_setup ();
00138     wrap_setup ();
00139
00140     optind = 0;
00141     while ((c = getopt (argc, argv, valid_options)) != -1)
00142     {
00143     switch (c)
00144     {
00145         case 'A':
00146         aflag = 1;
00147         break;
00148         case 'N':
00149         shorten = 0;
00150         break;
00151         case 'k':
00152         if (options)
00153             free (options);
00154         options = RCS_check_kflag (optarg);
00155         break;
00156         case 'n':
00157         run_module_prog = 0;
00158         break;
00159         case 'Q':
00160         case 'q':
00161 #ifdef SERVER_SUPPORT
00162         /* The CVS 1.5 client sends these options (in addition to
00163            Global_option requests), so we must ignore them.  */
00164         if (!server_active)
00165 #endif
00166             error (1, 0,
00167                "-q or -Q must be specified before \"%s\"",
00168                command_name);
00169         break;
00170         case 'l':
00171         local = 1;
00172         break;
00173         case 'R':
00174         local = 0;
00175         break;
00176         case 'P':
00177         checkout_prune_dirs = 1;
00178         break;
00179         case 'p':
00180         pipeout = 1;
00181         run_module_prog = 0;    /* don't run module prog when piping */
00182         noexec = 1;     /* so no locks will be created */
00183         break;
00184         case 'c':
00185         cat = 1;
00186         break;
00187         case 'd':
00188         where = optarg;
00189         if (shorten == -1)
00190             shorten = 1;
00191         break;
00192         case 's':
00193         status = 1;
00194         break;
00195         case 'f':
00196         force_tag_match = 0;
00197         break;
00198         case 'r':
00199         tag = optarg;
00200         checkout_prune_dirs = 1;
00201         break;
00202         case 'D':
00203         date = Make_Date (optarg);
00204         checkout_prune_dirs = 1;
00205         break;
00206         case 'j':
00207         if (join_rev2)
00208             error (1, 0, "only two -j options can be specified");
00209         if (join_rev1)
00210             join_rev2 = optarg;
00211         else
00212             join_rev1 = optarg;
00213         break;
00214         case '?':
00215         default:
00216         usage (valid_usage);
00217         break;
00218     }
00219     }
00220     argc -= optind;
00221     argv += optind;
00222
00223 #ifdef DIRTY_MODDATE
00224     enable_dirty = 1;
00225 #endif
00226
00227     if (shorten == -1)
00228     shorten = 0;
00229
00230     if ((cat || status) && argc != 0)
00231     error (1, 0, "-c and -s must not get any arguments");
00232
00233     if (!(cat || status) && argc == 0)
00234     error (1, 0, "must specify at least one module or directory");
00235
00236     if (where && pipeout)
00237     error (1, 0, "-d and -p are mutually exclusive");
00238
00239     if (m_type == EXPORT)
00240     {
00241     if (!tag && !date)
00242         error (1, 0, "must specify a tag or date");
00243
00244     if (tag && isdigit ((unsigned char) tag[0]))
00245         error (1, 0, "tag `%s' must be a symbolic tag", tag);
00246     }
00247
00248 #ifdef SERVER_SUPPORT
00249     if (server_active && where != NULL)
00250     {
00251     server_pathname_check (where);
00252     }
00253 #endif
00254
00255     if (!safe_location()) {
00256         error(1, 0, "Cannot check out files into the repository itself");
00257     }
00258
00259 #ifdef CLIENT_SUPPORT
00260     if (client_active)
00261     {
00262     int expand_modules;
00263
00264     start_server ();
00265
00266     ign_setup ();
00267
00268     /* We have to expand names here because the "expand-modules"
00269            directive to the server has the side-effect of having the
00270            server send the check-in and update programs for the
00271            various modules/dirs requested.  If we turn this off and
00272            simply request the names of the modules and directories (as
00273            below in !expand_modules), those files (CVS/Checkin.prog
00274            or CVS/Update.prog) don't get created.  Grrr.  */
00275
00276     expand_modules = (!cat && !status && !pipeout
00277               && supported_request ("expand-modules"));
00278
00279     if (expand_modules)
00280     {
00281         /* This is done here because we need to read responses
00282                from the server before we send the command checkout or
00283                export files. */
00284
00285         client_expand_modules (argc, argv, local);
00286     }
00287
00288     if (!run_module_prog)
00289         send_arg ("-n");
00290     if (local)
00291         send_arg ("-l");
00292     if (pipeout)
00293         send_arg ("-p");
00294     if (!force_tag_match)
00295         send_arg ("-f");
00296     if (aflag)
00297         send_arg("-A");
00298     if (!shorten)
00299         send_arg("-N");
00300     if (checkout_prune_dirs && m_type == CHECKOUT)
00301         send_arg("-P");
00302     client_prune_dirs = checkout_prune_dirs;
00303     if (cat)
00304         send_arg("-c");
00305     if (where != NULL)
00306         option_with_arg ("-d", where);
00307     if (status)
00308         send_arg("-s");
00309     if (options != NULL && options[0] != '\0')
00310         send_arg (options);
00311     option_with_arg ("-r", tag);
00312     if (date)
00313         client_senddate (date);
00314     if (join_rev1 != NULL)
00315         option_with_arg ("-j", join_rev1);
00316     if (join_rev2 != NULL)
00317         option_with_arg ("-j", join_rev2);
00318
00319     if (expand_modules)
00320     {
00321         client_send_expansions (local, where, 1);
00322     }
00323     else
00324     {
00325         int i;
00326         for (i = 0; i < argc; ++i)
00327         send_arg (argv[i]);
00328         client_nonexpanded_setup ();
00329     }
00330
00331     send_to_server (m_type == EXPORT ? "export\012" : "co\012", 0);
00332     return get_responses_and_close ();
00333     }
00334 #endif /* CLIENT_SUPPORT */
00335
00336     if (cat || status)
00337     {
00338     cat_module (status);
00339     if (options)
00340         free (options);
00341     return (0);
00342     }
00343     db = open_module ();
00344
00345
00346     /* If we've specified something like "cvs co foo/bar baz/quux"
00347        don't try to shorten names.  There are a few cases in which we
00348        could shorten (e.g. "cvs co foo/bar foo/baz"), but we don't
00349        handle those yet.  Better to have an extra directory created
00350        than the thing checked out under the wrong directory name. */
00351
00352     if (argc > 1)
00353     shorten = 0;
00354
00355
00356     /* If we will be calling history_write, work out the name to pass
00357        it.  */
00358     if (m_type == CHECKOUT && !pipeout)
00359     {
00360     if (tag && date)
00361     {
00362         history_name = xmalloc (strlen (tag) + strlen (date) + 2);
00363         sprintf (history_name, "%s:%s", tag, date);
00364     }
00365     else if (tag)
00366         history_name = tag;
00367     else
00368         history_name = date;
00369     }
00370
00371
00372     for (i = 0; i < argc; i++)
00373     err += do_module (db, argv[i], m_type, "Updating", checkout_proc,
00374               where, shorten, local, run_module_prog,
00375               (char *) NULL);
00376     close_module (db);
00377     if (options)
00378     free (options);
00379     return (err);
00380 }
00381
00382 /* FIXME: This is and emptydir_name are in checkout.c for historical
00383    reasons, probably want to move them.  */
00384
00385 int
00386 safe_location ()
00387 {
00388     char *current;
00389     char hardpath[PATH_MAX+5];
00390     size_t hardpath_len;
00391     int  x;
00392     int retval;
00393
00394 #ifdef HAVE_READLINK
00395     /* FIXME-arbitrary limit: should be retrying this like xgetwd.
00396        But how does readlink let us know that the buffer was too small?
00397        (by returning sizeof hardpath - 1?).  */
00398     x = readlink(CVSroot_directory, hardpath, sizeof hardpath - 1);
00399 #else
00400     x = -1;
00401 #endif
00402     if (x == -1)
00403     {
00404         strcpy(hardpath, CVSroot_directory);
00405     }
00406     else
00407     {
00408         hardpath[x] = '\0';
00409     }
00410     current = xgetwd ();
00411     if (current == NULL)
00412     error (1, errno, "could not get working directory");
00413     hardpath_len = strlen (hardpath);
00414     if (strlen (current) >= hardpath_len
00415     && strncmp (current, hardpath, hardpath_len) == 0)
00416     {
00417     if (/* Current is a subdirectory of hardpath.  */
00418         current[hardpath_len] == '/'
00419
00420         /* Current is hardpath itself.  */
00421         || current[hardpath_len] == '\0')
00422         retval = 0;
00423     else
00424         /* It isn't a problem.  For example, current is
00425            "/foo/cvsroot-bar" and hardpath is "/foo/cvsroot".  */
00426         retval = 1;
00427     }
00428     else
00429     retval = 1;
00430     free (current);
00431     return retval;
00432 }
00433
00434 struct dir_to_build
00435 {
00436     /* What to put in CVS/Repository.  */
00437     char *repository;
00438     /* The path to the directory.  */
00439     char *dirpath;
00440
00441     /* If set, don't build the directory, just change to it.
00442        The caller will also want to set REPOSITORY to NULL.  */
00443     int just_chdir;
00444
00445     struct dir_to_build *next;
00446 };
00447
00448 static int build_dirs_and_chdir PROTO ((struct dir_to_build *list,
00449                     int sticky));
00450
00451 static void build_one_dir PROTO ((char *, char *, int));
00452
00453 static void
00454 build_one_dir (repository, dirpath, sticky)
00455     char *repository;
00456     char *dirpath;
00457     int sticky;
00458 {
00459     FILE *fp;
00460
00461     if (isfile (CVSADM))
00462     {
00463     if (m_type == EXPORT)
00464         error (1, 0, "cannot export into a working directory");
00465     }
00466     else if (m_type == CHECKOUT)
00467     {
00468     /* I suspect that this check could be omitted.  */
00469     if (!isdir (repository))
00470         error (1, 0, "there is no repository %s", repository);
00471
00472     if (Create_Admin (".", dirpath, repository,
00473               sticky ? (char *) NULL : tag,
00474               sticky ? (char *) NULL : date,
00475
00476               /* FIXME?  This is a guess.  If it is important
00477                  for nonbranch to be set correctly here I
00478                  think we need to write it one way now and
00479                  then rewrite it later via WriteTag, once
00480                  we've had a chance to call RCS_nodeisbranch
00481                  on each file.  */
00482               0, 1, 1))
00483         return;
00484
00485     if (!noexec)
00486     {
00487         fp = open_file (CVSADM_ENTSTAT, "w+");
00488         if (fclose (fp) == EOF)
00489         error (1, errno, "cannot close %s", CVSADM_ENTSTAT);
00490 #ifdef SERVER_SUPPORT
00491         if (server_active)
00492         server_set_entstat (dirpath, repository);
00493 #endif
00494     }
00495     }
00496 }
00497
00498 /*
00499  * process_module calls us back here so we do the actual checkout stuff
00500  */
00501 /* ARGSUSED */
00502 static int
00503 checkout_proc (argc, argv, where_orig, mwhere, mfile, shorten,
00504            local_specified, omodule, msg)
00505     int argc;
00506     char **argv;
00507     char *where_orig;
00508     char *mwhere;
00509     char *mfile;
00510     int shorten;
00511     int local_specified;
00512     char *omodule;
00513     char *msg;
00514 {
00515     char *myargv[2];
00516     int err = 0;
00517     int which;
00518     char *cp;
00519     char *repository;
00520     char *oldupdate = NULL;
00521     char *where;
00522
00523     /*
00524      * OK, so we're doing the checkout! Our args are as follows:
00525      *  argc,argv contain either dir or dir followed by a list of files
00526      *  where contains where to put it (if supplied by checkout)
00527      *  mwhere contains the module name or -d from module file
00528      *  mfile says do only that part of the module
00529      *  shorten = 1 says shorten as much as possible
00530      *  omodule is the original arg to do_module()
00531      */
00532
00533     /* Set up the repository (maybe) for the bottom directory.
00534        Allocate more space than we need so we don't need to keep
00535        reallocating this string. */
00536     repository = xmalloc (strlen (CVSroot_directory)
00537               + strlen (argv[0])
00538               + (mfile == NULL ? 0 : strlen (mfile))
00539               + 10);
00540     (void) sprintf (repository, "%s/%s", CVSroot_directory, argv[0]);
00541     Sanitize_Repository_Name (repository);
00542
00543
00544     /* save the original value of preload_update_dir */
00545     if (preload_update_dir != NULL)
00546     oldupdate = xstrdup (preload_update_dir);
00547
00548
00549     /* Allocate space and set up the where variable.  We allocate more
00550        space than necessary here so that we don't have to keep
00551        reallocaing it later on. */
00552
00553     where = xmalloc (strlen (argv[0])
00554              + (mfile == NULL ? 0 : strlen (mfile))
00555              + (mwhere == NULL ? 0 : strlen (mwhere))
00556              + (where_orig == NULL ? 0 : strlen (where_orig))
00557              + 10);
00558
00559     /* Yes, this could be written in a less verbose way, but in this
00560        form it is quite easy to read.
00561
00562        FIXME?  The following code that sets should probably be moved
00563        to do_module in modules.c, since there is similar code in
00564        patch.c and rtag.c. */
00565
00566     if (shorten)
00567     {
00568     if (where_orig != NULL)
00569     {
00570         /* If the user has specified a directory with `-d' on the
00571            command line, use it preferentially, even over the `-d'
00572            flag in the modules file. */
00573
00574         (void) strcpy (where, where_orig);
00575     }
00576     else if (mwhere != NULL)
00577     {
00578         /* Second preference is the value of mwhere, which is from
00579            the `-d' flag in the modules file. */
00580
00581         (void) strcpy (where, mwhere);
00582     }
00583     else
00584     {
00585         /* Third preference is the directory specified in argv[0]
00586            which is this module'e directory in the repository. */
00587
00588         (void) strcpy (where, argv[0]);
00589     }
00590     }
00591     else
00592     {
00593     /* Use the same preferences here, bug don't shorten -- that
00594            is, tack on where_orig if it exists. */
00595
00596     *where = '\0';
00597
00598     if (where_orig != NULL)
00599     {
00600         (void) strcat (where, where_orig);
00601         (void) strcat (where, "/");
00602     }
00603
00604     /* If the -d flag in the modules file specified an absolute
00605            directory, let the user override it with the command-line
00606            -d option. */
00607
00608     if ((mwhere != NULL) && (! isabsolute (mwhere)))
00609         (void) strcat (where, mwhere);
00610     else
00611         (void) strcat (where, argv[0]);
00612     }
00613     strip_trailing_slashes (where); /* necessary? */
00614
00615
00616     /* At this point, the user may have asked for a single file or
00617        directory from within a module.  In that case, we should modify
00618        where, repository, and argv as appropriate. */
00619
00620     if (mfile != NULL)
00621     {
00622     /* The mfile variable can have one or more path elements.  If
00623        it has multiple elements, we want to tack those onto both
00624        repository and where.  The last element may refer to either
00625        a file or directory.  Here's what to do:
00626
00627        it refers to a directory
00628          -> simply tack it on to where and repository
00629        it refers to a file
00630          -> munge argv to contain `basename mfile` */
00631
00632     char *cp;
00633     char *path;
00634
00635
00636     /* Paranoia check. */
00637
00638     if (mfile[strlen (mfile) - 1] == '/')
00639     {
00640         error (0, 0, "checkout_proc: trailing slash on mfile (%s)!",
00641            mfile);
00642     }
00643
00644
00645     /* Does mfile have multiple path elements? */
00646
00647     cp = strrchr (mfile, '/');
00648     if (cp != NULL)
00649     {
00650         *cp = '\0';
00651         (void) strcat (repository, "/");
00652         (void) strcat (repository, mfile);
00653         (void) strcat (where, "/");
00654         (void) strcat (where, mfile);
00655         mfile = cp + 1;
00656     }
00657
00658
00659     /* Now mfile is a single path element. */
00660
00661     path = xmalloc (strlen (repository) + strlen (mfile) + 5);
00662     (void) sprintf (path, "%s/%s", repository, mfile);
00663     if (isdir (path))
00664     {
00665         /* It's a directory, so tack it on to repository and
00666                where, as we did above. */
00667
00668         (void) strcat (repository, "/");
00669         (void) strcat (repository, mfile);
00670         (void) strcat (where, "/");
00671         (void) strcat (where, mfile);
00672     }
00673     else
00674     {
00675         /* It's a file, which means we have to screw around with
00676                argv. */
00677         myargv[0] = argv[0];
00678         myargv[1] = mfile;
00679         argc = 2;
00680         argv = myargv;
00681     }
00682     free (path);
00683     }
00684
00685     if (preload_update_dir != NULL)
00686     {
00687     preload_update_dir =
00688         xrealloc (preload_update_dir,
00689               strlen (preload_update_dir) + strlen (where) + 5);
00690     strcat (preload_update_dir, "/");
00691     strcat (preload_update_dir, where);
00692     }
00693     else
00694     preload_update_dir = xstrdup (where);
00695
00696     /*
00697      * At this point, where is the directory we want to build, repository is
00698      * the repository for the lowest level of the path.
00699      *
00700      * We need to tell build_dirs not only the path we want it to
00701      * build, but also the repositories we want it to populate the
00702      * path with.  To accomplish this, we walk the path backwards, one
00703      * pathname component at a time, constucting a linked list of
00704      * struct dir_to_build.
00705      */
00706
00707     /*
00708      * If we are sending everything to stdout, we can skip a whole bunch of
00709      * work from here
00710      */
00711     if (!pipeout)
00712     {
00713     struct dir_to_build *head;
00714     char *reposcopy;
00715
00716     if (strncmp (repository, CVSroot_directory,
00717              strlen (CVSroot_directory)) != 0)
00718         error (1, 0, "\
00719 internal error: %s doesn't start with %s in checkout_proc",
00720            repository, CVSroot_directory);
00721
00722     /* We always create at least one directory, which corresponds to
00723        the entire strings for WHERE and REPOSITORY.  */
00724     head = (struct dir_to_build *) xmalloc (sizeof (struct dir_to_build));
00725     /* Special marker to indicate that we don't want build_dirs_and_chdir
00726        to create the CVSADM directory for us.  */
00727     head->repository = NULL;
00728     head->dirpath = xstrdup (where);
00729     head->next = NULL;
00730     head->just_chdir = 0;
00731
00732
00733     /* Make a copy of the repository name to play with. */
00734     reposcopy = xstrdup (repository);
00735
00736     /* FIXME: this should be written in terms of last_component
00737        instead of hardcoding '/'.  This presumably affects OS/2,
00738        NT, &c, if the user specifies '\'.  Likewise for the call
00739        to findslash.  */
00740     cp = where + strlen (where);
00741     while (cp > where)
00742     {
00743         struct dir_to_build *new;
00744
00745         cp = findslash (where, cp - 1);
00746         if (cp == NULL)
00747         break;      /* we're done */
00748
00749         new = (struct dir_to_build *)
00750         xmalloc (sizeof (struct dir_to_build));
00751         new->dirpath = xmalloc (strlen (where));
00752
00753         /* If the user specified an absolute path for where, the
00754                last path element we create should be the top-level
00755                directory. */
00756
00757         if (cp > where)
00758         {
00759         strncpy (new->dirpath, where, cp - where);
00760         new->dirpath[cp - where] = '\0';
00761         }
00762         else
00763         {
00764         /* where should always be at least one character long. */
00765         assert (where[0] != '\0');
00766         strcpy (new->dirpath, "/");
00767         }
00768         new->next = head;
00769         head = new;
00770
00771         /* If where consists of multiple pathname components,
00772            then we want to just cd into it, without creating
00773            directories or modifying CVS directories as we go.
00774            In CVS 1.9 and earlier, the code actually does a
00775            CVS_CHDIR up-front; I'm not going to try to go back
00776            to that exact code but this is somewhat similar
00777            in spirit.  */
00778         if (where_orig != NULL
00779         && cp - where < strlen (where_orig))
00780         {
00781         new->repository = NULL;
00782         new->just_chdir = 1;
00783         continue;
00784         }
00785
00786         new->just_chdir = 0;
00787
00788         /* Now figure out what repository directory to generate.
00789                The most complete case would be something like this:
00790
00791            The modules file contains
00792              foo -d bar/baz quux
00793
00794            The command issued was:
00795              cvs co -d what/ever -N foo
00796
00797            The results in the CVS/Repository files should be:
00798              .     -> (don't touch CVS/Repository)
00799               (I think this case might be buggy currently)
00800          what  -> (don't touch CVS/Repository)
00801          ever  -> .          (same as "cd what/ever; cvs co -N foo")
00802          bar   -> Emptydir   (generated dir -- not in repos)
00803          baz   -> quux       (finally!) */
00804
00805         if (strcmp (reposcopy, CVSroot_directory) == 0)
00806         {
00807         /* We can't walk up past CVSROOT.  Instead, the
00808                    repository should be Emptydir. */
00809         new->repository = emptydir_name ();
00810         }
00811         else
00812         {
00813         if ((where_orig != NULL)
00814             && (strcmp (new->dirpath, where_orig) == 0))
00815         {
00816             /* It's the case that the user specified a
00817              * destination directory with the "-d" flag.  The
00818              * repository in this directory should be "."
00819              * since the user's command is equivalent to:
00820              *
00821              *   cd <dir>; cvs co blah   */
00822
00823             strcpy (reposcopy, CVSroot_directory);
00824             goto allocate_repos;
00825         }
00826         else if (mwhere != NULL)
00827         {
00828             /* This is a generated directory, so point to
00829                        CVSNULLREPOS. */
00830
00831             new->repository = emptydir_name ();
00832         }
00833         else
00834         {
00835             /* It's a directory in the repository! */
00836
00837             char *rp;
00838
00839             /* We'll always be below CVSROOT, but check for
00840                paranoia's sake. */
00841             rp = strrchr (reposcopy, '/');
00842             if (rp == NULL)
00843             error (1, 0,
00844                    "internal error: %s doesn't contain a slash",
00845                    reposcopy);
00846
00847             *rp = '\0';
00848
00849         allocate_repos:
00850             new->repository = xmalloc (strlen (reposcopy) + 5);
00851             (void) strcpy (new->repository, reposcopy);
00852
00853             if (strcmp (reposcopy, CVSroot_directory) == 0)
00854             {
00855             /* Special case -- the repository name needs
00856                to be "/path/to/repos/." (the trailing dot
00857                is important).  We might be able to get rid
00858                of this after the we check out the other
00859                code that handles repository names. */
00860             (void) strcat (new->repository, "/.");
00861             }
00862         }
00863         }
00864     }
00865
00866     /* clean up */
00867     free (reposcopy);
00868
00869     {
00870         int where_is_absolute = isabsolute (where);
00871
00872         /* The top-level CVSADM directory should always be
00873            CVSroot_directory.  Create it, but only if WHERE is
00874            relative.  If WHERE is absolute, our current directory
00875            may not have a thing to do with where the sources are
00876            being checked out.  If it does, build_dirs_and_chdir
00877            will take care of creating adm files here. */
00878         /* FIXME: checking where_is_absolute is a horrid kludge;
00879            I suspect we probably can just skip the call to
00880            build_one_dir whenever the -d command option was specified
00881            to checkout.  */
00882
00883         if (! where_is_absolute && top_level_admin)
00884         {
00885         /* It may be argued that we shouldn't set any sticky
00886            bits for the top-level repository.  FIXME?  */
00887         build_one_dir (CVSroot_directory, ".", argc <= 1);
00888
00889 #ifdef SERVER_SUPPORT
00890         /* We _always_ want to have a top-level admin
00891            directory.  If we're running in client/server mode,
00892            send a "Clear-static-directory" command to make
00893            sure it is created on the client side.  (See 5.10
00894            in cvsclient.dvi to convince yourself that this is
00895            OK.)  If this is a duplicate command being sent, it
00896            will be ignored on the client side.  */
00897
00898         if (server_active)
00899             server_clear_entstat (".", CVSroot_directory);
00900 #endif
00901         }
00902
00903
00904         /* Build dirs on the path if necessary and leave us in the
00905            bottom directory (where if where was specified) doesn't
00906            contain a CVS subdir yet, but all the others contain
00907            CVS and Entries.Static files */
00908
00909         if (build_dirs_and_chdir (head, argc <= 1) != 0)
00910         {
00911         error (0, 0, "ignoring module %s", omodule);
00912         err = 1;
00913         goto out;
00914         }
00915     }
00916
00917     /* set up the repository (or make sure the old one matches) */
00918     if (!isfile (CVSADM))
00919     {
00920         FILE *fp;
00921
00922         if (!noexec && argc > 1)
00923         {
00924         /* I'm not sure whether this check is redundant.  */
00925         if (!isdir (repository))
00926             error (1, 0, "there is no repository %s", repository);
00927
00928         Create_Admin (".", preload_update_dir, repository,
00929                   (char *) NULL, (char *) NULL, 0, 0,
00930                   m_type == CHECKOUT);
00931         fp = open_file (CVSADM_ENTSTAT, "w+");
00932         if (fclose(fp) == EOF)
00933             error(1, errno, "cannot close %s", CVSADM_ENTSTAT);
00934 #ifdef SERVER_SUPPORT
00935         if (server_active)
00936             server_set_entstat (where, repository);
00937 #endif
00938         }
00939         else
00940         {
00941         /* I'm not sure whether this check is redundant.  */
00942         if (!isdir (repository))
00943             error (1, 0, "there is no repository %s", repository);
00944
00945         Create_Admin (".", preload_update_dir, repository, tag, date,
00946
00947                   /* FIXME?  This is a guess.  If it is important
00948                  for nonbranch to be set correctly here I
00949                  think we need to write it one way now and
00950                  then rewrite it later via WriteTag, once
00951                  we've had a chance to call RCS_nodeisbranch
00952                  on each file.  */
00953                   0, 0, m_type == CHECKOUT);
00954         }
00955     }
00956     else
00957     {
00958         char *repos;
00959
00960         if (m_type == EXPORT)
00961         error (1, 0, "cannot export into working directory");
00962
00963         /* get the contents of the previously existing repository */
00964         repos = Name_Repository ((char *) NULL, preload_update_dir);
00965         if (fncmp (repository, repos) != 0)
00966         {
00967         error (0, 0, "existing repository %s does not match %s",
00968                repos, repository);
00969         error (0, 0, "ignoring module %s", omodule);
00970         free (repos);
00971         err = 1;
00972         goto out;
00973         }
00974         free (repos);
00975     }
00976     }
00977
00978     /*
00979      * If we are going to be updating to stdout, we need to cd to the
00980      * repository directory so the recursion processor can use the current
00981      * directory as the place to find repository information
00982      */
00983     if (pipeout)
00984     {
00985     if ( CVS_CHDIR (repository) < 0)
00986     {
00987         error (0, errno, "cannot chdir to %s", repository);
00988         err = 1;
00989         goto out;
00990     }
00991     which = W_REPOS;
00992     if (tag != NULL && !tag_validated)
00993     {
00994         tag_check_valid (tag, argc - 1, argv + 1, 0, aflag, NULL);
00995         tag_validated = 1;
00996     }
00997     }
00998     else
00999     {
01000     which = W_LOCAL | W_REPOS;
01001     if (tag != NULL && !tag_validated)
01002     {
01003         tag_check_valid (tag, argc - 1, argv + 1, 0, aflag,
01004                  repository);
01005         tag_validated = 1;
01006     }
01007     }
01008
01009     if (tag != NULL || date != NULL || join_rev1 != NULL)
01010     which |= W_ATTIC;
01011
01012     if (! join_tags_validated)
01013     {
01014         if (join_rev1 != NULL)
01015         tag_check_valid_join (join_rev1, argc - 1, argv + 1, 0, aflag,
01016                   repository);
01017     if (join_rev2 != NULL)
01018         tag_check_valid_join (join_rev2, argc - 1, argv + 1, 0, aflag,
01019                   repository);
01020     join_tags_validated = 1;
01021     }
01022
01023     /*
01024      * if we are going to be recursive (building dirs), go ahead and call the
01025      * update recursion processor.  We will be recursive unless either local
01026      * only was specified, or we were passed arguments
01027      */
01028     if (!(local_specified || argc > 1))
01029     {
01030     if (m_type == CHECKOUT && !pipeout)
01031         history_write ('O', preload_update_dir, history_name, where,
01032                repository);
01033     else if (m_type == EXPORT && !pipeout)
01034         history_write ('E', preload_update_dir, tag ? tag : date, where,
01035                repository);
01036     err += do_update (0, (char **) NULL, options, tag, date,
01037               force_tag_match, 0 /* !local */ ,
01038               1 /* update -d */ , aflag, checkout_prune_dirs,
01039               pipeout, which, join_rev1, join_rev2,
01040               preload_update_dir);
01041     goto out;
01042     }
01043
01044     if (!pipeout)
01045     {
01046     int i;
01047     List *entries;
01048
01049     /* we are only doing files, so register them */
01050     entries = Entries_Open (0, NULL);
01051     for (i = 1; i < argc; i++)
01052     {
01053         char *line;
01054         Vers_TS *vers;
01055         struct file_info finfo;
01056
01057         memset (&finfo, 0, sizeof finfo);
01058         finfo.file = argv[i];
01059         /* Shouldn't be used, so set to arbitrary value.  */
01060         finfo.update_dir = NULL;
01061         finfo.fullname = argv[i];
01062         finfo.repository = repository;
01063         finfo.entries = entries;
01064         /* The rcs slot is needed to get the options from the RCS
01065                file */
01066         finfo.rcs = RCS_parse (finfo.file, repository);
01067
01068         vers = Version_TS (&finfo, options, tag, date,
01069                    force_tag_match, 0);
01070         if (vers->ts_user == NULL)
01071         {
01072         line = xmalloc (strlen (finfo.file) + 15);
01073         (void) sprintf (line, "Initial %s", finfo.file);
01074         Register (entries, finfo.file,
01075               vers->vn_rcs ? vers->vn_rcs : "0",
01076               line, vers->options, vers->tag,
01077               vers->date, (char *) 0);
01078         free (line);
01079         }
01080         freevers_ts (&vers);
01081         freercsnode (&finfo.rcs);
01082     }
01083
01084     Entries_Close (entries);
01085     }
01086
01087     /* Don't log "export", just regular "checkouts" */
01088     if (m_type == CHECKOUT && !pipeout)
01089     history_write ('O', preload_update_dir, history_name, where,
01090                repository);
01091
01092     /* go ahead and call update now that everything is set */
01093     err += do_update (argc - 1, argv + 1, options, tag, date,
01094               force_tag_match, local_specified, 1 /* update -d */,
01095               aflag, checkout_prune_dirs, pipeout, which, join_rev1,
01096               join_rev2, preload_update_dir);
01097 out:
01098     free (preload_update_dir);
01099     preload_update_dir = oldupdate;
01100     free (where);
01101     free (repository);
01102     return (err);
01103 }
01104
01105 static char *
01106 findslash (start, p)
01107     char *start;
01108     char *p;
01109 {
01110     for (;;)
01111     {
01112     if (*p == '/') return p;
01113     if (p == start) break;
01114     --p;
01115     }
01116     return NULL;
01117 }
01118
01119 /* Return a newly malloc'd string containing a pathname for CVSNULLREPOS,
01120    and make sure that it exists.  If there is an error creating the
01121    directory, give a fatal error.  Otherwise, the directory is guaranteed
01122    to exist when we return.  */
01123 char *
01124 emptydir_name ()
01125 {
01126     char *repository;
01127
01128     repository = xmalloc (strlen (CVSroot_directory)
01129               + sizeof (CVSROOTADM)
01130               + sizeof (CVSNULLREPOS)
01131               + 10);
01132     (void) sprintf (repository, "%s/%s/%s", CVSroot_directory,
01133             CVSROOTADM, CVSNULLREPOS);
01134     if (!isfile (repository))
01135     {
01136     mode_t omask;
01137     omask = umask (cvsumask);
01138     if (CVS_MKDIR (repository, 0777) < 0)
01139         error (1, errno, "cannot create %s", repository);
01140     (void) umask (omask);
01141     }
01142     return repository;
01143 }
01144
01145 /* Build all the dirs along the path to DIRS with CVS subdirs with appropriate
01146    repositories.  If ->repository is NULL, do not create a CVSADM directory
01147    for that subdirectory; just CVS_CHDIR into it.  */
01148 static int
01149 build_dirs_and_chdir (dirs, sticky)
01150     struct dir_to_build *dirs;
01151     int sticky;
01152 {
01153     int retval = 0;
01154     struct dir_to_build *nextdir;
01155
01156     while (dirs != NULL)
01157     {
01158     char *dir = last_component (dirs->dirpath);
01159
01160     if (!dirs->just_chdir)
01161     {
01162         mkdir_if_needed (dir);
01163         Subdir_Register (NULL, NULL, dir);
01164     }
01165
01166     if (CVS_CHDIR (dir) < 0)
01167     {
01168         error (0, errno, "cannot chdir to %s", dir);
01169         retval = 1;
01170         goto out;
01171     }
01172     if (dirs->repository != NULL)
01173     {
01174         build_one_dir (dirs->repository, dirs->dirpath, sticky);
01175         free (dirs->repository);
01176     }
01177     nextdir = dirs->next;
01178     free (dirs->dirpath);
01179     free (dirs);
01180     dirs = nextdir;
01181     }
01182
01183  out:
01184     while (dirs != NULL)
01185     {
01186     if (dirs->repository != NULL)
01187         free (dirs->repository);
01188     nextdir = dirs->next;
01189     free (dirs->dirpath);
01190     free (dirs);
01191     dirs = nextdir;
01192     }
01193     return retval;
01194 }
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/classify.c Source File

cvs-1.10/src/classify.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  */
00009
00010 #include "cvs.h"
00011
00012 static void sticky_ck PROTO ((struct file_info *finfo, int aflag,
00013                   Vers_TS * vers));
00014
00015 /*
00016  * Classify the state of a file
00017  */
00018 Ctype
00019 Classify_File (finfo, tag, date, options, force_tag_match, aflag, versp,
00020            pipeout)
00021     struct file_info *finfo;
00022     char *tag;
00023     char *date;
00024
00025     /* Keyword expansion options.  Can be either NULL or "" to
00026        indicate none are specified here.  */
00027     char *options;
00028
00029     int force_tag_match;
00030     int aflag;
00031     Vers_TS **versp;
00032     int pipeout;
00033 {
00034     Vers_TS *vers;
00035     Ctype ret;
00036
00037     /* get all kinds of good data about the file */
00038     vers = Version_TS (finfo, options, tag, date,
00039                force_tag_match, 0);
00040
00041     if (vers->vn_user == NULL)
00042     {
00043     /* No entry available, ts_rcs is invalid */
00044     if (vers->vn_rcs == NULL)
00045     {
00046         /* there is no RCS file either */
00047         if (vers->ts_user == NULL)
00048         {
00049         /* there is no user file */
00050         /* FIXME: Why do we skip this message if vers->tag or
00051            vers->date is set?  It causes "cvs update -r tag98 foo"
00052            to silently do nothing, which is seriously confusing
00053            behavior.  "cvs update foo" gives this message, which
00054            is what I would expect.  */
00055         if (!force_tag_match || !(vers->tag || vers->date))
00056             if (!really_quiet)
00057             error (0, 0, "nothing known about %s", finfo->fullname);
00058         ret = T_UNKNOWN;
00059         }
00060         else
00061         {
00062         /* there is a user file */
00063         /* FIXME: Why do we skip this message if vers->tag or
00064            vers->date is set?  It causes "cvs update -r tag98 foo"
00065            to silently do nothing, which is seriously confusing
00066            behavior.  "cvs update foo" gives this message, which
00067            is what I would expect.  */
00068         if (!force_tag_match || !(vers->tag || vers->date))
00069             if (!really_quiet)
00070             error (0, 0, "use `%s add' to create an entry for %s",
00071                    program_name, finfo->fullname);
00072         ret = T_UNKNOWN;
00073         }
00074     }
00075     else if (RCS_isdead (vers->srcfile, vers->vn_rcs))
00076     {
00077         if (vers->ts_user == NULL)
00078         ret = T_UPTODATE;
00079         else
00080         {
00081         error (0, 0, "use `%s add' to create an entry for %s",
00082                program_name, finfo->fullname);
00083         ret = T_UNKNOWN;
00084         }
00085     }
00086     else
00087     {
00088         /* there is an rcs file */
00089
00090         if (vers->ts_user == NULL)
00091         {
00092         /* There is no user file; needs checkout */
00093         ret = T_CHECKOUT;
00094         }
00095         else
00096         {
00097         if (pipeout)
00098         {
00099             /*
00100              * The user file doesn't necessarily have anything
00101              * to do with this.
00102              */
00103             ret = T_CHECKOUT;
00104         }
00105         /*
00106          * There is a user file; print a warning and add it to the
00107          * conflict list, only if it is indeed different from what we
00108          * plan to extract
00109          */
00110         else if (No_Difference (finfo, vers))
00111         {
00112             /* the files were different so it is a conflict */
00113             if (!really_quiet)
00114             error (0, 0, "move away %s; it is in the way",
00115                    finfo->fullname);
00116             ret = T_CONFLICT;
00117         }
00118         else
00119             /* since there was no difference, still needs checkout */
00120             ret = T_CHECKOUT;
00121         }
00122     }
00123     }
00124     else if (strcmp (vers->vn_user, "0") == 0)
00125     {
00126     /* An entry for a new-born file; ts_rcs is dummy */
00127
00128     if (vers->ts_user == NULL)
00129     {
00130         /*
00131          * There is no user file, but there should be one; remove the
00132          * entry
00133          */
00134         if (!really_quiet)
00135         error (0, 0, "warning: new-born %s has disappeared", finfo->fullname);
00136         ret = T_REMOVE_ENTRY;
00137     }
00138     else
00139     {
00140         /* There is a user file */
00141
00142         if (vers->vn_rcs == NULL)
00143         /* There is no RCS file, added file */
00144         ret = T_ADDED;
00145         else if (RCS_isdead (vers->srcfile, vers->vn_rcs))
00146         /* we are resurrecting. */
00147         ret = T_ADDED;
00148         else
00149         {
00150         if (vers->srcfile->flags & INATTIC
00151             && vers->srcfile->flags & VALID)
00152         {
00153             /* This file has been added on some branch other than
00154                the one we are looking at.  In the branch we are
00155                looking at, the file was already valid.  */
00156             if (!really_quiet)
00157             error (0, 0,
00158                    "\
00159 conflict: %s has been added, but already exists",
00160                    finfo->fullname);
00161         }
00162         else
00163         {
00164             /*
00165              * There is an RCS file, so someone else must have checked
00166              * one in behind our back; conflict
00167              */
00168             if (!really_quiet)
00169             error (0, 0,
00170                    "\
00171 conflict: %s created independently by second party",
00172                    finfo->fullname);
00173         }
00174         ret = T_CONFLICT;
00175         }
00176     }
00177     }
00178     else if (vers->vn_user[0] == '-')
00179     {
00180     /* An entry for a removed file, ts_rcs is invalid */
00181
00182     if (vers->ts_user == NULL)
00183     {
00184         /* There is no user file (as it should be) */
00185
00186         if (vers->vn_rcs == NULL
00187         || RCS_isdead (vers->srcfile, vers->vn_rcs))
00188         {
00189
00190         /*
00191          * There is no RCS file; this is all-right, but it has been
00192          * removed independently by a second party; remove the entry
00193          */
00194         ret = T_REMOVE_ENTRY;
00195         }
00196         else if (vers->vn_rcs == NULL
00197              ? vers->vn_user[1] == '\0'
00198              : strcmp (vers->vn_rcs, vers->vn_user + 1) == 0)
00199         /*
00200          * The RCS file is the same version as the user file was, and
00201          * that's OK; remove it
00202          */
00203         ret = T_REMOVED;
00204         else
00205         {
00206
00207         /*
00208          * The RCS file is a newer version than the removed user file
00209          * and this is definitely not OK; make it a conflict.
00210          */
00211         if (!really_quiet)
00212             error (0, 0,
00213                "conflict: removed %s was modified by second party",
00214                finfo->fullname);
00215         ret = T_CONFLICT;
00216         }
00217     }
00218     else
00219     {
00220         /* The user file shouldn't be there */
00221         if (!really_quiet)
00222         error (0, 0, "%s should be removed and is still there",
00223                finfo->fullname);
00224         ret = T_REMOVED;
00225     }
00226     }
00227     else
00228     {
00229     /* A normal entry, TS_Rcs is valid */
00230     if (vers->vn_rcs == NULL)
00231     {
00232         /* There is no RCS file */
00233
00234         if (vers->ts_user == NULL)
00235         {
00236         /* There is no user file, so just remove the entry */
00237         if (!really_quiet)
00238             error (0, 0, "warning: %s is not (any longer) pertinent",
00239                finfo->fullname);
00240         ret = T_REMOVE_ENTRY;
00241         }
00242         else if (strcmp (vers->ts_user, vers->ts_rcs) == 0)
00243         {
00244
00245         /*
00246          * The user file is still unmodified, so just remove it from
00247          * the entry list
00248          */
00249         if (!really_quiet)
00250             error (0, 0, "%s is no longer in the repository",
00251                finfo->fullname);
00252         ret = T_REMOVE_ENTRY;
00253         }
00254         else
00255         {
00256         /*
00257          * The user file has been modified and since it is no longer
00258          * in the repository, a conflict is raised
00259          */
00260         if (No_Difference (finfo, vers))
00261         {
00262             /* they are different -> conflict */
00263             if (!really_quiet)
00264             error (0, 0,
00265            "conflict: %s is modified but no longer in the repository",
00266                finfo->fullname);
00267             ret = T_CONFLICT;
00268         }
00269         else
00270         {
00271             /* they weren't really different */
00272             if (!really_quiet)
00273             error (0, 0,
00274                    "warning: %s is not (any longer) pertinent",
00275                    finfo->fullname);
00276             ret = T_REMOVE_ENTRY;
00277         }
00278         }
00279     }
00280     else if (strcmp (vers->vn_rcs, vers->vn_user) == 0)
00281     {
00282         /* The RCS file is the same version as the user file */
00283
00284         if (vers->ts_user == NULL)
00285         {
00286
00287         /*
00288          * There is no user file, so note that it was lost and
00289          * extract a new version
00290          */
00291         /* Comparing the command_name against "update", in
00292            addition to being an ugly way to operate, means
00293            that this message does not get printed by the
00294            server.  That might be considered just a straight
00295            bug, although there is one subtlety: that case also
00296            gets hit when a patch fails and the client fetches
00297            a file.  I'm not sure there is currently any way
00298            for the server to distinguish those two cases.  */
00299         if (strcmp (command_name, "update") == 0)
00300             if (!really_quiet)
00301             error (0, 0, "warning: %s was lost", finfo->fullname);
00302         ret = T_CHECKOUT;
00303         }
00304         else if (strcmp (vers->ts_user, vers->ts_rcs) == 0)
00305         {
00306
00307         /*
00308          * The user file is still unmodified, so nothing special at
00309          * all to do -- no lists updated, unless the sticky -k option
00310          * has changed.  If the sticky tag has changed, we just need
00311          * to re-register the entry
00312          */
00313         /* TODO: decide whether we need to check file permissions
00314            for a mismatch, and return T_CONFLICT if so. */
00315         if (vers->entdata->options &&
00316             strcmp (vers->entdata->options, vers->options) != 0)
00317             ret = T_CHECKOUT;
00318         else
00319         {
00320             sticky_ck (finfo, aflag, vers);
00321             ret = T_UPTODATE;
00322         }
00323         }
00324         else
00325         {
00326
00327         /*
00328          * The user file appears to have been modified, but we call
00329          * No_Difference to verify that it really has been modified
00330          */
00331         if (No_Difference (finfo, vers))
00332         {
00333
00334             /*
00335              * they really are different; modified if we aren't
00336              * changing any sticky -k options, else needs merge
00337              */
00338 #ifdef XXX_FIXME_WHEN_RCSMERGE_IS_FIXED
00339             if (strcmp (vers->entdata->options ?
00340                vers->entdata->options : "", vers->options) == 0)
00341             ret = T_MODIFIED;
00342             else
00343             ret = T_NEEDS_MERGE;
00344 #else
00345             ret = T_MODIFIED;
00346             sticky_ck (finfo, aflag, vers);
00347 #endif
00348         }
00349         else
00350         {
00351             /* file has not changed; check out if -k changed */
00352             if (strcmp (vers->entdata->options ?
00353                vers->entdata->options : "", vers->options) != 0)
00354             {
00355             ret = T_CHECKOUT;
00356             }
00357             else
00358             {
00359
00360             /*
00361              * else -> note that No_Difference will Register the
00362              * file already for us, using the new tag/date. This
00363              * is the desired behaviour
00364              */
00365             ret = T_UPTODATE;
00366             }
00367         }
00368         }
00369     }
00370     else
00371     {
00372         /* The RCS file is a newer version than the user file */
00373
00374         if (vers->ts_user == NULL)
00375         {
00376         /* There is no user file, so just get it */
00377
00378         /* See comment at other "update" compare, for more
00379            thoughts on this comparison.  */
00380         if (strcmp (command_name, "update") == 0)
00381             if (!really_quiet)
00382             error (0, 0, "warning: %s was lost", finfo->fullname);
00383         ret = T_CHECKOUT;
00384         }
00385         else if (strcmp (vers->ts_user, vers->ts_rcs) == 0)
00386         {
00387
00388         /*
00389          * The user file is still unmodified, so just get it as well
00390          */
00391 #ifdef SERVER_SUPPORT
00392         if (strcmp (vers->entdata->options ?
00393                 vers->entdata->options : "", vers->options) != 0
00394             || (vers->srcfile != NULL
00395             && (vers->srcfile->flags & INATTIC) != 0))
00396             ret = T_CHECKOUT;
00397         else
00398             ret = T_PATCH;
00399 #else
00400         ret = T_CHECKOUT;
00401 #endif
00402         }
00403         else
00404         {
00405         if (No_Difference (finfo, vers))
00406             /* really modified, needs to merge */
00407             ret = T_NEEDS_MERGE;
00408 #ifdef SERVER_SUPPORT
00409             else if ((strcmp (vers->entdata->options ?
00410                   vers->entdata->options : "", vers->options)
00411               != 0)
00412              || (vers->srcfile != NULL
00413                  && (vers->srcfile->flags & INATTIC) != 0))
00414             /* not really modified, check it out */
00415             ret = T_CHECKOUT;
00416         else
00417             ret = T_PATCH;
00418 #else
00419         else
00420             /* not really modified, check it out */
00421             ret = T_CHECKOUT;
00422 #endif
00423         }
00424     }
00425     }
00426
00427     /* free up the vers struct, or just return it */
00428     if (versp != (Vers_TS **) NULL)
00429     *versp = vers;
00430     else
00431     freevers_ts (&vers);
00432
00433     /* return the status of the file */
00434     return (ret);
00435 }
00436
00437 static void
00438 sticky_ck (finfo, aflag, vers)
00439     struct file_info *finfo;
00440     int aflag;
00441     Vers_TS *vers;
00442 {
00443     if (aflag || vers->tag || vers->date)
00444     {
00445     char *enttag = vers->entdata->tag;
00446     char *entdate = vers->entdata->date;
00447
00448     if ((enttag && vers->tag && strcmp (enttag, vers->tag)) ||
00449         ((enttag && !vers->tag) || (!enttag && vers->tag)) ||
00450         (entdate && vers->date && strcmp (entdate, vers->date)) ||
00451         ((entdate && !vers->date) || (!entdate && vers->date)))
00452     {
00453         Register (finfo->entries, finfo->file, vers->vn_user, vers->ts_rcs,
00454               vers->options, vers->tag, vers->date, vers->ts_conflict);
00455
00456 #ifdef SERVER_SUPPORT
00457         if (server_active)
00458         {
00459         /* We need to update the entries line on the client side.
00460            It is possible we will later update it again via
00461            server_updated or some such, but that is OK.  */
00462         server_update_entries
00463           (finfo->file, finfo->update_dir, finfo->repository,
00464            strcmp (vers->ts_rcs, vers->ts_user) == 0 ?
00465            SERVER_UPDATED : SERVER_MERGED);
00466         }
00467 #endif
00468     }
00469     }
00470 }
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/client.c Source File

cvs-1.10/src/client.c

Go to the documentation of this file.
00001 /* JT thinks BeOS is worth the trouble. */
00002
00003 /* CVS client-related stuff.
00004
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2, or (at your option)
00008    any later version.
00009
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.  */
00014
00015 #ifdef HAVE_CONFIG_H
00016 #include "config.h"
00017 #endif /* HAVE_CONFIG_H */
00018
00019 #include <assert.h>
00020 #include "cvs.h"
00021 #include "getline.h"
00022 #include "edit.h"
00023 #include "buffer.h"
00024
00025 #ifdef CLIENT_SUPPORT
00026
00027 #include "md5.h"
00028
00029 #if defined(AUTH_CLIENT_SUPPORT) || HAVE_KERBEROS || defined(SOCK_ERRNO) || defined(SOCK_STRERROR)
00030 #  ifdef HAVE_WINSOCK_H
00031 #    include <winsock.h>
00032 #  else /* No winsock.h */
00033 #    include <sys/socket.h>
00034 #    include <netinet/in.h>
00035 #    include <netdb.h>
00036 #  endif /* No winsock.h */
00037 #endif
00038
00039 /* If SOCK_ERRNO is defined, then send()/recv() and other socket calls
00040    do not set errno, but that this macro should be used to obtain an
00041    error code.  This probably doesn't make sense unless
00042    NO_SOCKET_TO_FD is also defined. */
00043 #ifndef SOCK_ERRNO
00044 #define SOCK_ERRNO errno
00045 #endif
00046
00047 /* If SOCK_STRERROR is defined, then the error codes returned by
00048    socket operations are not known to strerror, and this macro must be
00049    used instead to convert those error codes to strings. */
00050 #ifndef SOCK_STRERROR
00051 #  define SOCK_STRERROR strerror
00052
00053 #  if STDC_HEADERS
00054 #    include <string.h>
00055 #  endif
00056
00057 #  ifndef strerror
00058 extern char *strerror ();
00059 #  endif
00060 #endif /* ! SOCK_STRERROR */
00061
00062 #if HAVE_KERBEROS
00063 #define CVS_PORT 1999
00064
00065 #if USE_KCLIENT
00066 #   include "kclient_if.h"
00067 #else
00068 #   include <krb.h>
00069 #endif
00070
00071 extern char *krb_realmofhost ();
00072 #ifndef HAVE_KRB_GET_ERR_TEXT
00073 #define krb_get_err_text(status) krb_err_txt[status]
00074 #endif /* HAVE_KRB_GET_ERR_TEXT */
00075
00076 /* Information we need if we are going to use Kerberos encryption.  */
00077 static C_Block kblock;
00078 static Key_schedule sched;
00079
00080 #endif /* HAVE_KERBEROS */
00081
00082 #ifdef HAVE_GSSAPI
00083
00084 #ifdef HAVE_GSSAPI_H
00085 #include <gssapi.h>
00086 #endif
00087 #ifdef HAVE_GSSAPI_GSSAPI_H
00088 #include <gssapi/gssapi.h>
00089 #endif
00090 #ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
00091 #include <gssapi/gssapi_generic.h>
00092 #endif
00093
00094 #ifndef HAVE_GSS_C_NT_HOSTBASED_SERVICE
00095 #define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
00096 #endif
00097
00098 /* This is needed for GSSAPI encryption.  */
00099 static gss_ctx_id_t gcontext;
00100
00101 static int connect_to_gserver PROTO((int, struct hostent *));
00102
00103 #endif /* HAVE_GSSAPI */
00104
00105 #ifdef macintosh
00106 #   include "GUSIlsh.h"
00107 #   include "GUSIMSLSetup.h"
00108     static void start_lsh_server PROTO((int *, int *));
00109 #endif
00110
00111
00112 static void add_prune_candidate PROTO((char *));
00113
00114 /* All the commands.  */
00115 int add PROTO((int argc, char **argv));
00116 int admin PROTO((int argc, char **argv));
00117 int checkout PROTO((int argc, char **argv));
00118 int commit PROTO((int argc, char **argv));
00119 int diff PROTO((int argc, char **argv));
00120 int history PROTO((int argc, char **argv));
00121 int import PROTO((int argc, char **argv));
00122 int cvslog PROTO((int argc, char **argv));
00123 int patch PROTO((int argc, char **argv));
00124 int release PROTO((int argc, char **argv));
00125 int cvsremove PROTO((int argc, char **argv));
00126 int rtag PROTO((int argc, char **argv));
00127 int status PROTO((int argc, char **argv));
00128 int tag PROTO((int argc, char **argv));
00129 int update PROTO((int argc, char **argv));
00130
00131 /* All the response handling functions.  */
00132 static void handle_ok PROTO((char *, int));
00133 static void handle_error PROTO((char *, int));
00134 static void handle_valid_requests PROTO((char *, int));
00135 static void handle_checked_in PROTO((char *, int));
00136 static void handle_new_entry PROTO((char *, int));
00137 static void handle_checksum PROTO((char *, int));
00138 static void handle_copy_file PROTO((char *, int));
00139 static void handle_updated PROTO((char *, int));
00140 static void handle_merged PROTO((char *, int));
00141 static void handle_patched PROTO((char *, int));
00142 static void handle_rcs_diff PROTO((char *, int));
00143 static void handle_removed PROTO((char *, int));
00144 static void handle_remove_entry PROTO((char *, int));
00145 static void handle_set_static_directory PROTO((char *, int));
00146 static void handle_clear_static_directory PROTO((char *, int));
00147 static void handle_set_sticky PROTO((char *, int));
00148 static void handle_clear_sticky PROTO((char *, int));
00149 static void handle_set_checkin_prog PROTO((char *, int));
00150 static void handle_set_update_prog PROTO((char *, int));
00151 static void handle_module_expansion PROTO((char *, int));
00152 static void handle_wrapper_rcs_option PROTO((char *, int));
00153 static void handle_m PROTO((char *, int));
00154 static void handle_e PROTO((char *, int));
00155 static void handle_f PROTO((char *, int));
00156 static void handle_notified PROTO((char *, int));
00157
00158 static size_t try_read_from_server PROTO ((char *, size_t));
00159 #endif /* CLIENT_SUPPORT */
00160
00161 #ifdef CLIENT_SUPPORT
00162
00163 /* We need to keep track of the list of directories we've sent to the
00164    server.  This list, along with the current CVSROOT, will help us
00165    decide which command-line arguments to send.  */
00166 List *dirs_sent_to_server = NULL;
00167
00168 static int is_arg_a_parent_or_listed_dir PROTO((Node *, void *));
00169
00170 static int
00171 is_arg_a_parent_or_listed_dir (n, d)
00172     Node *n;
00173     void *d;
00174 {
00175     char *directory = n->key;   /* name of the dir sent to server */
00176     char *this_argv_elem = (char *) d;  /* this argv element */
00177
00178     /* Say we should send this argument if the argument matches the
00179        beginning of a directory name sent to the server.  This way,
00180        the server will know to start at the top of that directory
00181        hierarchy and descend. */
00182
00183     if (strncmp (directory, this_argv_elem, strlen (this_argv_elem)) == 0)
00184     return 1;
00185
00186     return 0;
00187 }
00188
00189 static int arg_should_not_be_sent_to_server PROTO((char *));
00190
00191 /* Return nonzero if this argument should not be sent to the
00192    server. */
00193
00194 static int
00195 arg_should_not_be_sent_to_server (arg)
00196     char *arg;
00197 {
00198     /* Decide if we should send this directory name to the server.  We
00199        should always send argv[i] if:
00200
00201        1) the list of directories sent to the server is empty (as it
00202        will be for checkout, etc.).
00203
00204        2) the argument is "."
00205
00206        3) the argument is a file in the cwd and the cwd is checked out
00207        from the current root
00208
00209        4) the argument lies within one of the paths in
00210        dirs_sent_to_server.
00211
00212        4) */
00213
00214     if (list_isempty (dirs_sent_to_server))
00215     return 0;       /* always send it */
00216
00217     if (strcmp (arg, ".") == 0)
00218     return 0;       /* always send it */
00219
00220     /* We should send arg if it is one of the directories sent to the
00221        server or the parent of one; this tells the server to descend
00222        the hierarchy starting at this level. */
00223     if (isdir (arg))
00224     {
00225     if (walklist (dirs_sent_to_server, is_arg_a_parent_or_listed_dir, arg))
00226         return 0;
00227
00228     /* If arg wasn't a parent, we don't know anything about it (we
00229        would have seen something related to it during the
00230        send_files phase).  Don't send it.  */
00231     return 1;
00232     }
00233
00234     /* Try to decide whether we should send arg to the server by
00235        checking the contents of the corresponding CVSADM directory. */
00236     {
00237     char *t, *this_root;
00238
00239     /* Calculate "dirname arg" */
00240     for (t = arg + strlen (arg) - 1; t >= arg; t--)
00241     {
00242         if (ISDIRSEP(*t))
00243         break;
00244     }
00245
00246     /* Now we're either poiting to the beginning of the
00247        string, or we found a path separator. */
00248     if (t >= arg)
00249     {
00250         /* Found a path separator.  */
00251         char c = *t;
00252         *t = '\0';
00253
00254         /* First, check to see if we sent this directory to the
00255                server, because it takes less time than actually
00256                opening the stuff in the CVSADM directory.  */
00257         if (walklist (dirs_sent_to_server, is_arg_a_parent_or_listed_dir,
00258               arg))
00259         {
00260         *t = c;     /* make sure to un-truncate the arg */
00261         return 0;
00262         }
00263
00264         /* Since we didn't find it in the list, check the CVSADM
00265                files on disk.  */
00266         this_root = Name_Root (arg, (char *) NULL);
00267         *t = c;
00268     }
00269     else
00270     {
00271         /* We're at the beginning of the string.  Look at the
00272                CVSADM files in cwd.  */
00273         this_root = Name_Root ((char *) NULL, (char *) NULL);
00274     }
00275
00276     /* Now check the value for root. */
00277     if (this_root && current_root
00278         && (strcmp (this_root, current_root) != 0))
00279     {
00280         /* Don't send this, since the CVSROOTs don't match. */
00281         free (this_root);
00282         return 1;
00283     }
00284     free (this_root);
00285     }
00286
00287     /* OK, let's send it. */
00288     return 0;
00289 }
00290
00291
00292 #endif /* CLIENT_SUPPORT */
00293
00294 #if defined(CLIENT_SUPPORT) || defined(SERVER_SUPPORT)
00295
00296 /* Shared with server.  */
00297
00298 /*
00299  * Return a malloc'd, '\0'-terminated string
00300  * corresponding to the mode in SB.
00301  */
00302 char *
00303 #ifdef __STDC__
00304 mode_to_string (mode_t mode)
00305 #else /* ! __STDC__ */
00306 mode_to_string (mode)
00307     mode_t mode;
00308 #endif /* __STDC__ */
00309 {
00310     char buf[18], u[4], g[4], o[4];
00311     int i;
00312
00313     i = 0;
00314     if (mode & S_IRUSR) u[i++] = 'r';
00315     if (mode & S_IWUSR) u[i++] = 'w';
00316     if (mode & S_IXUSR) u[i++] = 'x';
00317     u[i] = '\0';
00318
00319     i = 0;
00320     if (mode & S_IRGRP) g[i++] = 'r';
00321     if (mode & S_IWGRP) g[i++] = 'w';
00322     if (mode & S_IXGRP) g[i++] = 'x';
00323     g[i] = '\0';
00324
00325     i = 0;
00326     if (mode & S_IROTH) o[i++] = 'r';
00327     if (mode & S_IWOTH) o[i++] = 'w';
00328     if (mode & S_IXOTH) o[i++] = 'x';
00329     o[i] = '\0';
00330
00331     sprintf(buf, "u=%s,g=%s,o=%s", u, g, o);
00332     return xstrdup(buf);
00333 }
00334
00335 /*
00336  * Change mode of FILENAME to MODE_STRING.
00337  * Returns 0 for success or errno code.
00338  * If RESPECT_UMASK is set, then honor the umask.
00339  */
00340 int
00341 change_mode (filename, mode_string, respect_umask)
00342     char *filename;
00343     char *mode_string;
00344     int respect_umask;
00345 {
00346 #ifdef CHMOD_BROKEN
00347     char *p;
00348     int writeable = 0;
00349
00350     /* We can only distinguish between
00351          1) readable
00352          2) writeable
00353          3) Picasso's "Blue Period"
00354        We handle the first two. */
00355     p = mode_string;
00356     while (*p != '\0')
00357     {
00358     if ((p[0] == 'u' || p[0] == 'g' || p[0] == 'o') && p[1] == '=')
00359     {
00360         char *q = p + 2;
00361         while (*q != ',' && *q != '\0')
00362         {
00363         if (*q == 'w')
00364             writeable = 1;
00365         ++q;
00366         }
00367     }
00368     /* Skip to the next field.  */
00369     while (*p != ',' && *p != '\0')
00370         ++p;
00371     if (*p == ',')
00372         ++p;
00373     }
00374
00375     /* xchmod honors the umask for us.  In the !respect_umask case, we
00376        don't try to cope with it (probably to handle that well, the server
00377        needs to deal with modes in data structures, rather than via the
00378        modes in temporary files).  */
00379     xchmod (filename, writeable);
00380     return 0;
00381
00382 #else /* ! CHMOD_BROKEN */
00383
00384     char *p;
00385     mode_t mode = 0;
00386     mode_t oumask;
00387
00388     p = mode_string;
00389     while (*p != '\0')
00390     {
00391     if ((p[0] == 'u' || p[0] == 'g' || p[0] == 'o') && p[1] == '=')
00392     {
00393         int can_read = 0, can_write = 0, can_execute = 0;
00394         char *q = p + 2;
00395         while (*q != ',' && *q != '\0')
00396         {
00397         if (*q == 'r')
00398             can_read = 1;
00399         else if (*q == 'w')
00400             can_write = 1;
00401         else if (*q == 'x')
00402             can_execute = 1;
00403         ++q;
00404         }
00405         if (p[0] == 'u')
00406         {
00407         if (can_read)
00408             mode |= S_IRUSR;
00409         if (can_write)
00410             mode |= S_IWUSR;
00411         if (can_execute)
00412             mode |= S_IXUSR;
00413         }
00414         else if (p[0] == 'g')
00415         {
00416         if (can_read)
00417             mode |= S_IRGRP;
00418         if (can_write)
00419             mode |= S_IWGRP;
00420         if (can_execute)
00421             mode |= S_IXGRP;
00422         }
00423         else if (p[0] == 'o')
00424         {
00425         if (can_read)
00426             mode |= S_IROTH;
00427         if (can_write)
00428             mode |= S_IWOTH;
00429         if (can_execute)
00430             mode |= S_IXOTH;
00431         }
00432     }
00433     /* Skip to the next field.  */
00434     while (*p != ',' && *p != '\0')
00435         ++p;
00436     if (*p == ',')
00437         ++p;
00438     }
00439
00440     if (respect_umask)
00441     {
00442     oumask = umask (0);
00443     (void) umask (oumask);
00444     mode &= ~oumask;
00445     }
00446
00447     if (chmod (filename, mode) < 0)
00448     return errno;
00449     return 0;
00450 #endif /* ! CHMOD_BROKEN */
00451 }
00452
00453 #endif /* CLIENT_SUPPORT or SERVER_SUPPORT */
00454
00455 #ifdef CLIENT_SUPPORT
00456
00457 int client_prune_dirs;
00458
00459 static List *ignlist = (List *) NULL;
00460
00461 /* Buffer to write to the server.  */
00462 static struct buffer *to_server;
00463 /* The stream underlying to_server, if we are using a stream.  */
00464 static FILE *to_server_fp;
00465
00466 /* Buffer used to read from the server.  */
00467 static struct buffer *from_server;
00468 /* The stream underlying from_server, if we are using a stream.  */
00469 static FILE *from_server_fp;
00470
00471 /* Process ID of rsh subprocess.  */
00472 static int rsh_pid = -1;
00473
00474
00475 /* We want to be able to log data sent between us and the server.  We
00476    do it using log buffers.  Each log buffer has another buffer which
00477    handles the actual I/O, and a file to log information to.
00478
00479    This structure is the closure field of a log buffer.  */
00480
00481 struct log_buffer
00482 {
00483     /* The underlying buffer.  */
00484     struct buffer *buf;
00485     /* The file to log information to.  */
00486     FILE *log;
00487 };
00488
00489 static struct buffer *log_buffer_initialize
00490   PROTO((struct buffer *, FILE *, int, void (*) (struct buffer *)));
00491 static int log_buffer_input PROTO((void *, char *, int, int, int *));
00492 static int log_buffer_output PROTO((void *, const char *, int, int *));
00493 static int log_buffer_flush PROTO((void *));
00494 static int log_buffer_block PROTO((void *, int));
00495 static int log_buffer_shutdown PROTO((void *));
00496
00497 /* Create a log buffer.  */
00498
00499 static struct buffer *
00500 log_buffer_initialize (buf, fp, input, memory)
00501      struct buffer *buf;
00502      FILE *fp;
00503      int input;
00504      void (*memory) PROTO((struct buffer *));
00505 {
00506     struct log_buffer *n;
00507
00508     n = (struct log_buffer *) xmalloc (sizeof *n);
00509     n->buf = buf;
00510     n->log = fp;
00511     return buf_initialize (input ? log_buffer_input : NULL,
00512                input ? NULL : log_buffer_output,
00513                input ? NULL : log_buffer_flush,
00514                log_buffer_block,
00515                log_buffer_shutdown,
00516                memory,
00517                n);
00518 }
00519
00520 /* The input function for a log buffer.  */
00521
00522 static int
00523 log_buffer_input (closure, data, need, size, got)
00524      void *closure;
00525      char *data;
00526      int need;
00527      int size;
00528      int *got;
00529 {
00530     struct log_buffer *lb = (struct log_buffer *) closure;
00531     int status;
00532     size_t n_to_write;
00533
00534     if (lb->buf->input == NULL)
00535     abort ();
00536
00537     status = (*lb->buf->input) (lb->buf->closure, data, need, size, got);
00538     if (status != 0)
00539     return status;
00540
00541     if (*got > 0)
00542     {
00543     n_to_write = *got;
00544     if (fwrite (data, 1, n_to_write, lb->log) != n_to_write)
00545         error (0, errno, "writing to log file");
00546     }
00547
00548     return 0;
00549 }
00550
00551 /* The output function for a log buffer.  */
00552
00553 static int
00554 log_buffer_output (closure, data, have, wrote)
00555      void *closure;
00556      const char *data;
00557      int have;
00558      int *wrote;
00559 {
00560     struct log_buffer *lb = (struct log_buffer *) closure;
00561     int status;
00562     size_t n_to_write;
00563
00564     if (lb->buf->output == NULL)
00565     abort ();
00566
00567     status = (*lb->buf->output) (lb->buf->closure, data, have, wrote);
00568     if (status != 0)
00569     return status;
00570
00571     if (*wrote > 0)
00572     {
00573     n_to_write = *wrote;
00574     if (fwrite (data, 1, n_to_write, lb->log) != n_to_write)
00575         error (0, errno, "writing to log file");
00576     }
00577
00578     return 0;
00579 }
00580
00581 /* The flush function for a log buffer.  */
00582
00583 static int
00584 log_buffer_flush (closure)
00585      void *closure;
00586 {
00587     struct log_buffer *lb = (struct log_buffer *) closure;
00588
00589     if (lb->buf->flush == NULL)
00590     abort ();
00591
00592     /* We don't really have to flush the log file here, but doing it
00593        will let tail -f on the log file show what is sent to the
00594        network as it is sent.  */
00595     if (fflush (lb->log) != 0)
00596         error (0, errno, "flushing log file");
00597
00598     return (*lb->buf->flush) (lb->buf->closure);
00599 }
00600
00601 /* The block function for a log buffer.  */
00602
00603 static int
00604 log_buffer_block (closure, block)
00605      void *closure;
00606      int block;
00607 {
00608     struct log_buffer *lb = (struct log_buffer *) closure;
00609
00610     if (block)
00611     return set_block (lb->buf);
00612     else
00613     return set_nonblock (lb->buf);
00614 }
00615
00616 /* The shutdown function for a log buffer.  */
00617
00618 static int
00619 log_buffer_shutdown (closure)
00620      void *closure;
00621 {
00622     struct log_buffer *lb = (struct log_buffer *) closure;
00623     int retval;
00624
00625     retval = buf_shutdown (lb->buf);
00626     if (fclose (lb->log) < 0)
00627     error (0, errno, "closing log file");
00628     return retval;
00629 }
00630
00631 #ifdef NO_SOCKET_TO_FD
00632
00633 /* Under certain circumstances, we must communicate with the server
00634    via a socket using send() and recv().  This is because under some
00635    operating systems (OS/2 and Windows 95 come to mind), a socket
00636    cannot be converted to a file descriptor -- it must be treated as a
00637    socket and nothing else.
00638
00639    We may also need to deal with socket routine error codes differently
00640    in these cases.  This is handled through the SOCK_ERRNO and
00641    SOCK_STRERROR macros. */
00642
00643 static int use_socket_style = 0;
00644 static int server_sock;
00645
00646 /* These routines implement a buffer structure which uses send and
00647    recv.  The buffer is always in blocking mode so we don't implement
00648    the block routine.  */
00649
00650 /* Note that it is important that these routines always handle errors
00651    internally and never return a positive errno code, since it would in
00652    general be impossible for the caller to know in general whether any
00653    error code came from a socket routine (to decide whether to use
00654    SOCK_STRERROR or simply strerror to print an error message). */
00655
00656 /* We use an instance of this structure as the closure field.  */
00657
00658 struct socket_buffer
00659 {
00660     /* The socket number.  */
00661     int socket;
00662 };
00663
00664 static struct buffer *socket_buffer_initialize
00665   PROTO ((int, int, void (*) (struct buffer *)));
00666 static int socket_buffer_input PROTO((void *, char *, int, int, int *));
00667 static int socket_buffer_output PROTO((void *, const char *, int, int *));
00668 static int socket_buffer_flush PROTO((void *));
00669
00670 /* Create a buffer based on a socket.  */
00671
00672 static struct buffer *
00673 socket_buffer_initialize (socket, input, memory)
00674      int socket;
00675      int input;
00676      void (*memory) PROTO((struct buffer *));
00677 {
00678     struct socket_buffer *n;
00679
00680     n = (struct socket_buffer *) xmalloc (sizeof *n);
00681     n->socket = socket;
00682     return buf_initialize (input ? socket_buffer_input : NULL,
00683                input ? NULL : socket_buffer_output,
00684                input ? NULL : socket_buffer_flush,
00685                (int (*) PROTO((void *, int))) NULL,
00686                (int (*) PROTO((void *))) NULL,
00687                memory,
00688                n);
00689 }
00690
00691 /* The buffer input function for a buffer built on a socket.  */
00692
00693 static int
00694 socket_buffer_input (closure, data, need, size, got)
00695      void *closure;
00696      char *data;
00697      int need;
00698      int size;
00699      int *got;
00700 {
00701     struct socket_buffer *sb = (struct socket_buffer *) closure;
00702     int nbytes;
00703
00704     /* I believe that the recv function gives us exactly the semantics
00705        we want.  If there is a message, it returns immediately with
00706        whatever it could get.  If there is no message, it waits until
00707        one comes in.  In other words, it is not like read, which in
00708        blocking mode normally waits until all the requested data is
00709        available.  */
00710
00711     *got = 0;
00712
00713     do
00714     {
00715
00716     /* Note that for certain (broken?) networking stacks, like
00717        VMS's UCX (not sure what version, problem reported with
00718        recv() in 1997), and (according to windows-NT/config.h)
00719        Windows NT 3.51, we must call recv or send with a
00720        moderately sized buffer (say, less than 200K or something),
00721        or else there may be network errors (somewhat hard to
00722        produce, e.g. WAN not LAN or some such).  buf_read_data
00723        makes sure that we only recv() BUFFER_DATA_SIZE bytes at
00724        a time.  */
00725
00726     nbytes = recv (sb->socket, data, size, 0);
00727     if (nbytes < 0)
00728         error (1, 0, "reading from server: %s", SOCK_STRERROR (SOCK_ERRNO));
00729     if (nbytes == 0)
00730     {
00731         /* End of file (for example, the server has closed
00732            the connection).  If we've already read something, we
00733            just tell the caller about the data, not about the end of
00734            file.  If we've read nothing, we return end of file.  */
00735         if (*got == 0)
00736         return -1;
00737         else
00738         return 0;
00739     }
00740     need -= nbytes;
00741     size -= nbytes;
00742     data += nbytes;
00743     *got += nbytes;
00744     }
00745     while (need > 0);
00746
00747     return 0;
00748 }
00749
00750 /* The buffer output function for a buffer built on a socket.  */
00751
00752 static int
00753 socket_buffer_output (closure, data, have, wrote)
00754      void *closure;
00755      const char *data;
00756      int have;
00757      int *wrote;
00758 {
00759     struct socket_buffer *sb = (struct socket_buffer *) closure;
00760
00761     *wrote = have;
00762
00763     /* See comment in socket_buffer_input regarding buffer size we pass
00764        to send and recv.  */
00765
00766 #ifdef SEND_NEVER_PARTIAL
00767     /* If send() never will produce a partial write, then just do it.  This
00768        is needed for systems where its return value is something other than
00769        the number of bytes written.  */
00770     if (send (sb->socket, data, have, 0) < 0)
00771     error (1, 0, "writing to server socket: %s", SOCK_STRERROR (SOCK_ERRNO));
00772 #else
00773     while (have > 0)
00774     {
00775     int nbytes;
00776
00777     nbytes = send (sb->socket, data, have, 0);
00778     if (nbytes < 0)
00779         error (1, 0, "writing to server socket: %s", SOCK_STRERROR (SOCK_ERRNO));
00780
00781     have -= nbytes;
00782     data += nbytes;
00783     }
00784 #endif
00785
00786     return 0;
00787 }
00788
00789 /* The buffer flush function for a buffer built on a socket.  */
00790
00791 /*ARGSUSED*/
00792 static int
00793 socket_buffer_flush (closure)
00794      void *closure;
00795 {
00796     /* Nothing to do.  Sockets are always flushed.  */
00797     return 0;
00798 }
00799
00800 #endif /* NO_SOCKET_TO_FD */
00801
00802 /*
00803  * Read a line from the server.  Result does not include the terminating \n.
00804  *
00805  * Space for the result is malloc'd and should be freed by the caller.
00806  *
00807  * Returns number of bytes read.
00808  */
00809 static int
00810 read_line (resultp)
00811     char **resultp;
00812 {
00813     int status;
00814     char *result;
00815     int len;
00816
00817     status = buf_flush (to_server, 1);
00818     if (status != 0)
00819     error (1, status, "writing to server");
00820
00821     status = buf_read_line (from_server, &result, &len);
00822     if (status != 0)
00823     {
00824     if (status == -1)
00825         error (1, 0, "end of file from server (consult above messages if any)");
00826     else if (status == -2)
00827         error (1, 0, "out of memory");
00828     else
00829         error (1, status, "reading from server");
00830     }
00831
00832     if (resultp != NULL)
00833     *resultp = result;
00834     else
00835     free (result);
00836
00837     return len;
00838 }
00839
00840 #endif /* CLIENT_SUPPORT */
00841
00842
00843 #if defined(CLIENT_SUPPORT) || defined(SERVER_SUPPORT)
00844
00845 /*
00846  * Zero if compression isn't supported or requested; non-zero to indicate
00847  * a compression level to request from gzip.
00848  */
00849 int gzip_level;
00850
00851 /*
00852  * Level of compression to use when running gzip on a single file.
00853  */
00854 int file_gzip_level;
00855
00856 #endif /* CLIENT_SUPPORT or SERVER_SUPPORT */
00857
00858 #ifdef CLIENT_SUPPORT
00859
00860 /*
00861  * The Repository for the top level of this command (not necessarily
00862  * the CVSROOT, just the current directory at the time we do it).
00863  */
00864 static char *toplevel_repos = NULL;
00865
00866 /* Working directory when we first started.  Note: we could speed things
00867    up on some systems by using savecwd.h here instead of just always
00868    storing a name.  */
00869 char *toplevel_wd;
00870
00871 static void
00872 handle_ok (args, len)
00873     char *args;
00874     int len;
00875 {
00876     return;
00877 }
00878
00879 static void
00880 handle_error (args, len)
00881     char *args;
00882     int len;
00883 {
00884 #ifndef CVSGUI_PIPE
00885     int something_printed;
00886 #endif
00887
00888     /*
00889      * First there is a symbolic error code followed by a space, which
00890      * we ignore.
00891      */
00892     char *p = strchr (args, ' ');
00893     if (p == NULL)
00894     {
00895     error (0, 0, "invalid data from cvs server");
00896     return;
00897     }
00898     ++p;
00899
00900     /* Next we print the text of the message from the server.  We
00901        probably should be prefixing it with "server error" or some
00902        such, because if it is something like "Out of memory", the
00903        current behavior doesn't say which machine is out of
00904        memory.  */
00905
00906     len -= p - args;
00907 #ifdef CVSGUI_PIPE
00908     cvs_outerr(p, len);
00909     cvs_outerr("\n", 1);
00910 #else
00911     something_printed = 0;
00912     for (; len > 0; --len)
00913     {
00914     something_printed = 1;
00915     putc (*p++, stderr);
00916     }
00917     if (something_printed)
00918     putc ('\n', stderr);
00919 #endif
00920 }
00921
00922 static void
00923 handle_valid_requests (args, len)
00924     char *args;
00925     int len;
00926 {
00927     char *p = args;
00928     char *q;
00929     struct request *rq;
00930     do
00931     {
00932     q = strchr (p, ' ');
00933     if (q != NULL)
00934         *q++ = '\0';
00935     for (rq = requests; rq->name != NULL; ++rq)
00936     {
00937         if (strcmp (rq->name, p) == 0)
00938         break;
00939     }
00940     if (rq->name == NULL)
00941         /*
00942          * It is a request we have never heard of (and thus never
00943          * will want to use).  So don't worry about it.
00944          */
00945         ;
00946     else
00947     {
00948         if (rq->flags & RQ_ENABLEME)
00949         {
00950         /*
00951          * Server wants to know if we have this, to enable the
00952          * feature.
00953          */
00954         send_to_server (rq->name, 0);
00955                 send_to_server ("\012", 0);
00956         }
00957         else
00958         rq->flags |= RQ_SUPPORTED;
00959     }
00960     p = q;
00961     } while (q != NULL);
00962     for (rq = requests; rq->name != NULL; ++rq)
00963     {
00964     if ((rq->flags & RQ_SUPPORTED)
00965         || (rq->flags & RQ_ENABLEME))
00966         continue;
00967     if (rq->flags & RQ_ESSENTIAL)
00968         error (1, 0, "request `%s' not supported by server", rq->name);
00969     }
00970 }
00971
00972 /* This variable holds the result of Entries_Open, so that we can
00973    close Entries_Close on it when we move on to a new directory, or
00974    when we finish.  */
00975 static List *last_entries;
00976
00977 /*
00978  * Do all the processing for PATHNAME, where pathname consists of the
00979  * repository and the filename.  The parameters we pass to FUNC are:
00980  * DATA is just the DATA parameter which was passed to
00981  * call_in_directory; ENT_LIST is a pointer to an entries list (which
00982  * we manage the storage for); SHORT_PATHNAME is the pathname of the
00983  * file relative to the (overall) directory in which the command is
00984  * taking place; and FILENAME is the filename portion only of
00985  * SHORT_PATHNAME.  When we call FUNC, the curent directory points to
00986  * the directory portion of SHORT_PATHNAME.  */
00987
00988 static char *last_dir_name;
00989
00990 static void
00991 call_in_directory (pathname, func, data)
00992     char *pathname;
00993     void (*func) PROTO((char *data, List *ent_list, char *short_pathname,
00994               char *filename));
00995     char *data;
00996 {
00997     char *dir_name;
00998     char *filename;
00999     /* This is what we get when we hook up the directory (working directory
01000        name) from PATHNAME with the filename from REPOSNAME.  For example:
01001        pathname: ccvs/src/
01002        reposname: /u/src/master/ccvs/foo/ChangeLog
01003        short_pathname: ccvs/src/ChangeLog
01004        */
01005     char *short_pathname;
01006     char *p;
01007
01008     /*
01009      * Do the whole descent in parallel for the repositories, so we
01010      * know what to put in CVS/Repository files.  I'm not sure the
01011      * full hair is necessary since the server does a similar
01012      * computation; I suspect that we only end up creating one
01013      * directory at a time anyway.
01014      *
01015      * Also note that we must *only* worry about this stuff when we
01016      * are creating directories; `cvs co foo/bar; cd foo/bar; cvs co
01017      * CVSROOT; cvs update' is legitimate, but in this case
01018      * foo/bar/CVSROOT/CVS/Repository is not a subdirectory of
01019      * foo/bar/CVS/Repository.
01020      */
01021     char *reposname;
01022     char *short_repos;
01023     char *reposdirname;
01024     char *rdirp;
01025     int reposdirname_absolute;
01026
01027     reposname = NULL;
01028     read_line (&reposname);
01029     assert (reposname != NULL);
01030
01031     reposdirname_absolute = 0;
01032     if (strncmp (reposname, toplevel_repos, strlen (toplevel_repos)) != 0)
01033     {
01034     reposdirname_absolute = 1;
01035     short_repos = reposname;
01036     }
01037     else
01038     {
01039     short_repos = reposname + strlen (toplevel_repos) + 1;
01040     if (short_repos[-1] != '/')
01041     {
01042         reposdirname_absolute = 1;
01043         short_repos = reposname;
01044     }
01045     }
01046     reposdirname = xstrdup (short_repos);
01047     p = strrchr (reposdirname, '/');
01048     if (p == NULL)
01049     {
01050     reposdirname = xrealloc (reposdirname, 2);
01051     reposdirname[0] = '.'; reposdirname[1] = '\0';
01052     }
01053     else
01054     *p = '\0';
01055
01056     dir_name = xstrdup (pathname);
01057     p = strrchr (dir_name, '/');
01058     if (p == NULL)
01059     {
01060     dir_name = xrealloc (dir_name, 2);
01061     dir_name[0] = '.'; dir_name[1] = '\0';
01062     }
01063     else
01064     *p = '\0';
01065     if (client_prune_dirs)
01066     add_prune_candidate (dir_name);
01067
01068     filename = strrchr (short_repos, '/');
01069     if (filename == NULL)
01070     filename = short_repos;
01071     else
01072     ++filename;
01073
01074     short_pathname = xmalloc (strlen (pathname) + strlen (filename) + 5);
01075     strcpy (short_pathname, pathname);
01076     strcat (short_pathname, filename);
01077
01078     if (last_dir_name == NULL
01079     || strcmp (last_dir_name, dir_name) != 0)
01080     {
01081     int newdir;
01082
01083     if (strcmp (command_name, "export") != 0)
01084         if (last_entries)
01085         Entries_Close (last_entries);
01086
01087     if (last_dir_name)
01088         free (last_dir_name);
01089     last_dir_name = dir_name;
01090
01091     if (toplevel_wd == NULL)
01092     {
01093         toplevel_wd = xgetwd ();
01094         if (toplevel_wd == NULL)
01095         error (1, errno, "could not get working directory");
01096     }
01097
01098     if (CVS_CHDIR (toplevel_wd) < 0)
01099         error (1, errno, "could not chdir to %s", toplevel_wd);
01100     newdir = 0;
01101
01102     /* Create the CVS directory at the top level if needed.  The
01103        isdir seems like an unneeded system call, but it *does*
01104        need to be called both if the CVS_CHDIR below succeeds
01105        (e.g.  "cvs co .") or if it fails (e.g. basicb-1a in
01106        testsuite).  We only need to do this for the "." case,
01107        since the server takes care of forcing this directory to be
01108        created in all other cases.  If we don't create CVSADM
01109        here, the call to Entries_Open below will fail.  FIXME:
01110        perhaps this means that we should change our algorithm
01111        below that calls Create_Admin instead of having this code
01112        here? */
01113     if (/* I think the reposdirname_absolute case has to do with
01114            things like "cvs update /foo/bar".  In any event, the
01115            code below which tries to put toplevel_repos into
01116            CVS/Repository is almost surely unsuited to
01117            the reposdirname_absolute case.  */
01118         !reposdirname_absolute
01119         && (strcmp (dir_name, ".") == 0)
01120         && ! isdir (CVSADM))
01121     {
01122         char *repo;
01123         char *r;
01124
01125         newdir = 1;
01126
01127         repo = xmalloc (strlen (toplevel_repos)
01128                 + 10);
01129         strcpy (repo, toplevel_repos);
01130         r = repo + strlen (repo);
01131         if (r[-1] != '.' || r[-2] != '/')
01132             strcpy (r, "/.");
01133
01134         Create_Admin (".", ".", repo, (char *) NULL,
01135               (char *) NULL, 0, 1, 1);
01136
01137         free (repo);
01138     }
01139
01140     if ( CVS_CHDIR (dir_name) < 0)
01141     {
01142         char *dir;
01143         char *dirp;
01144
01145         if (! existence_error (errno))
01146         error (1, errno, "could not chdir to %s", dir_name);
01147
01148         /* Directory does not exist, we need to create it.  */
01149         newdir = 1;
01150
01151         /* Provided we are willing to assume that directories get
01152            created one at a time, we could simplify this a lot.
01153            Do note that one aspect still would need to walk the
01154            dir_name path: the checking for "fncmp (dir, CVSADM)".  */
01155
01156         dir = xmalloc (strlen (dir_name) + 1);
01157         dirp = dir_name;
01158         rdirp = reposdirname;
01159
01160         /* This algorithm makes nested directories one at a time
01161                and create CVS administration files in them.  For
01162                example, we're checking out foo/bar/baz from the
01163                repository:
01164
01165            1) create foo, point CVS/Repository to <root>/foo
01166            2)     .. foo/bar                   .. <root>/foo/bar
01167            3)     .. foo/bar/baz               .. <root>/foo/bar/baz
01168
01169            As you can see, we're just stepping along DIR_NAME (with
01170            DIRP) and REPOSDIRNAME (with RDIRP) respectively.
01171
01172            We need to be careful when we are checking out a
01173            module, however, since DIR_NAME and REPOSDIRNAME are not
01174            going to be the same.  Since modules will not have any
01175            slashes in their names, we should watch the output of
01176            STRCHR to decide whether or not we should use STRCHR on
01177            the RDIRP.  That is, if we're down to a module name,
01178            don't keep picking apart the repository directory name.  */
01179
01180         do
01181         {
01182         dirp = strchr (dirp, '/');
01183         if (dirp)
01184         {
01185             strncpy (dir, dir_name, dirp - dir_name);
01186             dir[dirp - dir_name] = '\0';
01187             /* Skip the slash.  */
01188             ++dirp;
01189             if (rdirp == NULL)
01190             /* This just means that the repository string has
01191                fewer components than the dir_name string.  But
01192                that is OK (e.g. see modules3-8 in testsuite).  */
01193             ;
01194             else
01195             rdirp = strchr (rdirp, '/');
01196         }
01197         else
01198         {
01199             /* If there are no more slashes in the dir name,
01200                        we're down to the most nested directory -OR- to
01201                        the name of a module.  In the first case, we
01202                        should be down to a DIRP that has no slashes,
01203                        so it won't help/hurt to do another STRCHR call
01204                        on DIRP.  It will definitely hurt, however, if
01205                        we're down to a module name, since a module
01206                        name can point to a nested directory (that is,
01207                        DIRP will still have slashes in it.  Therefore,
01208                        we should set it to NULL so the routine below
01209                        copies the contents of REMOTEDIRNAME onto the
01210                        root repository directory (does this if rdirp
01211                        is set to NULL, because we used to do an extra
01212                        STRCHR call here). */
01213
01214             rdirp = NULL;
01215             strcpy (dir, dir_name);
01216         }
01217
01218         if (fncmp (dir, CVSADM) == 0)
01219         {
01220             error (0, 0, "cannot create a directory named %s", dir);
01221             error (0, 0, "because CVS uses \"%s\" for its own uses",
01222                CVSADM);
01223             error (1, 0, "rename the directory and try again");
01224         }
01225
01226         if (mkdir_if_needed (dir))
01227         {
01228             /* It already existed, fine.  Just keep going.  */
01229         }
01230         else if (strcmp (command_name, "export") == 0)
01231             /* Don't create CVSADM directories if this is export.  */
01232             ;
01233         else
01234         {
01235             /*
01236              * Put repository in CVS/Repository.  For historical
01237              * (pre-CVS/Root) reasons, this is an absolute pathname,
01238              * but what really matters is the part of it which is
01239              * relative to cvsroot.
01240              */
01241             char *repo;
01242             char *r, *b;
01243
01244             repo = xmalloc (strlen (reposdirname)
01245                     + strlen (toplevel_repos)
01246                     + 80);
01247             if (reposdirname_absolute)
01248             r = repo;
01249             else
01250             {
01251             strcpy (repo, toplevel_repos);
01252             strcat (repo, "/");
01253             r = repo + strlen (repo);
01254             }
01255
01256             if (rdirp)
01257             {
01258             /* See comment near start of function; the only
01259                way that the server can put the right thing
01260                in each CVS/Repository file is to create the
01261                directories one at a time.  I think that the
01262                CVS server has been doing this all along.  */
01263             error (0, 0, "\
01264 warning: server is not creating directories one at a time");
01265             strncpy (r, reposdirname, rdirp - reposdirname);
01266             r[rdirp - reposdirname] = '\0';
01267             }
01268             else
01269             strcpy (r, reposdirname);
01270
01271             Create_Admin (dir, dir, repo,
01272                   (char *)NULL, (char *)NULL, 0, 0, 1);
01273             free (repo);
01274
01275             b = strrchr (dir, '/');
01276             if (b == NULL)
01277             Subdir_Register ((List *) NULL, (char *) NULL, dir);
01278             else
01279             {
01280             *b = '\0';
01281             Subdir_Register ((List *) NULL, dir, b + 1);
01282             *b = '/';
01283             }
01284         }
01285
01286         if (rdirp != NULL)
01287         {
01288             /* Skip the slash.  */
01289             ++rdirp;
01290         }
01291
01292         } while (dirp != NULL);
01293         free (dir);
01294         /* Now it better work.  */
01295         if ( CVS_CHDIR (dir_name) < 0)
01296         error (1, errno, "could not chdir to %s", dir_name);
01297     }
01298
01299     if (strcmp (command_name, "export") != 0)
01300     {
01301         last_entries = Entries_Open (0, dir_name);
01302
01303         /* If this is a newly created directory, we will record
01304            all subdirectory information, so call Subdirs_Known in
01305            case there are no subdirectories.  If this is not a
01306            newly created directory, it may be an old working
01307            directory from before we recorded subdirectory
01308            information in the Entries file.  We force a search for
01309            all subdirectories now, to make sure our subdirectory
01310            information is up to date.  If the Entries file does
01311            record subdirectory information, then this call only
01312            does list manipulation.  */
01313         if (newdir)
01314         Subdirs_Known (last_entries);
01315         else
01316         {
01317         List *dirlist;
01318
01319         dirlist = Find_Directories ((char *) NULL, W_LOCAL,
01320                         last_entries);
01321         dellist (&dirlist);
01322         }
01323     }
01324     }
01325     else
01326     free (dir_name);
01327     free (reposdirname);
01328     (*func) (data, last_entries, short_pathname, filename);
01329     free (short_pathname);
01330     free (reposname);
01331 }
01332
01333 static void
01334 copy_a_file (data, ent_list, short_pathname, filename)
01335     char *data;
01336     List *ent_list;
01337     char *short_pathname;
01338     char *filename;
01339 {
01340     char *newname;
01341 #ifdef USE_VMS_FILENAMES
01342     char *p;
01343 #endif
01344 #ifdef macintosh
01345     char *truncname;
01346 #endif
01347
01348     read_line (&newname);
01349
01350 #ifdef USE_VMS_FILENAMES
01351     /* Mogrify the filename so VMS is happy with it. */
01352     for(p = newname; *p; p++)
01353        if(*p == '.' || *p == '#') *p = '_';
01354 #endif
01355     /* cvsclient.texi has said for a long time that newname must be in the
01356        same directory.  Wouldn't want a malicious or buggy server overwriting
01357        ~/.profile, /etc/passwd, or anything like that.  */
01358     if (last_component (newname) != newname)
01359     error (1, 0, "protocol error: Copy-file tried to specify directory");
01360 #ifdef macintosh
01361     if(strlen(newname) >= 31)
01362     {
01363         truncname = (char*)malloc(32 * sizeof(char));
01364         memcpy(truncname, newname, 16 * sizeof(char));
01365         memcpy(truncname + 16, newname + strlen(newname) - 15, 15 * sizeof(char));
01366         truncname[31] = '\0';
01367         free(newname);
01368         newname = truncname;
01369     }
01370 #endif
01371
01372     if (unlink_file (newname) && !existence_error (errno))
01373     error (0, errno, "unable to remove %s", newname);
01374     copy_file (filename, newname);
01375     free (newname);
01376 }
01377
01378 static void
01379 handle_copy_file (args, len)
01380     char *args;
01381     int len;
01382 {
01383     call_in_directory (args, copy_a_file, (char *)NULL);
01384 }
01385
01386
01387 static void read_counted_file PROTO ((char *, char *));
01388
01389 /* Read from the server the count for the length of a file, then read
01390    the contents of that file and write them to FILENAME.  FULLNAME is
01391    the name of the file for use in error messages.  FIXME-someday:
01392    extend this to deal with compressed files and make update_entries
01393    use it.  On error, gives a fatal error.  */
01394 static void
01395 read_counted_file (filename, fullname)
01396     char *filename;
01397     char *fullname;
01398 {
01399     char *size_string;
01400     size_t size;
01401     char *buf;
01402
01403     /* Pointers in buf to the place to put data which will be read,
01404        and the data which needs to be written, respectively.  */
01405     char *pread;
01406     char *pwrite;
01407     /* Number of bytes left to read and number of bytes in buf waiting to
01408        be written, respectively.  */
01409     size_t nread;
01410     size_t nwrite;
01411
01412     FILE *fp;
01413
01414     read_line (&size_string);
01415     if (size_string[0] == 'z')
01416     error (1, 0, "\
01417 protocol error: compressed files not supported for that operation");
01418     /* FIXME: should be doing more error checking, probably.  Like using
01419        strtoul and making sure we used up the whole line.  */
01420     size = atoi (size_string);
01421     free (size_string);
01422
01423     /* A more sophisticated implementation would use only a limited amount
01424        of buffer space (8K perhaps), and read that much at a time.  We allocate
01425        a buffer for the whole file only to make it easy to keep track what
01426        needs to be read and written.  */
01427     buf = xmalloc (size);
01428
01429     /* FIXME-someday: caller should pass in a flag saying whether it
01430        is binary or not.  I haven't carefully looked into whether
01431        CVS/Template files should use local text file conventions or
01432        not.  */
01433     fp = CVS_FOPEN (filename, "wb");
01434     if (fp == NULL)
01435     error (1, errno, "cannot write %s", fullname);
01436     nread = size;
01437     nwrite = 0;
01438     pread = buf;
01439     pwrite = buf;
01440     while (nread > 0 || nwrite > 0)
01441     {
01442     size_t n;
01443
01444     if (nread > 0)
01445     {
01446         n = try_read_from_server (pread, nread);
01447         nread -= n;
01448         pread += n;
01449         nwrite += n;
01450     }
01451
01452     if (nwrite > 0)
01453     {
01454         n = fwrite (pwrite, 1, nwrite, fp);
01455         if (ferror (fp))
01456         error (1, errno, "cannot write %s", fullname);
01457         nwrite -= n;
01458         pwrite += n;
01459     }
01460     }
01461     free (buf);
01462     if (fclose (fp) < 0)
01463     error (1, errno, "cannot close %s", fullname);
01464 }
01465
01466 /* OK, we want to swallow the "U foo.c" response and then output it only
01467    if we can update the file.  In the future we probably want some more
01468    systematic approach to parsing tagged text, but for now we keep it
01469    ad hoc.  "Why," I hear you cry, "do we not just look at the
01470    Update-existing and Created responses?"  That is an excellent question,
01471    and the answer is roughly conservatism/laziness--I haven't read through
01472    update.c enough to figure out the exact correspondence or lack thereof
01473    between those responses and a "U foo.c" line (note that Merged, from
01474    join_file, can be either "C foo" or "U foo" depending on the context).  */
01475 /* Nonzero if we have seen +updated and not -updated.  */
01476 static int updated_seen;
01477 /* Filename from an "fname" tagged response within +updated/-updated.  */
01478 static char *updated_fname;
01479
01480 /* This struct is used to hold data when reading the +importmergecmd
01481    and -importmergecmd tags.  We put the variables in a struct only
01482    for namespace issues.  FIXME: As noted above, we need to develop a
01483    more systematic approach.  */
01484 static struct
01485 {
01486     /* Nonzero if we have seen +importmergecmd and not -importmergecmd.  */
01487     int seen;
01488     /* Number of conflicts, from a "conflicts" tagged response.  */
01489     int conflicts;
01490     /* First merge tag, from a "mergetag1" tagged response.  */
01491     char *mergetag1;
01492     /* Second merge tag, from a "mergetag2" tagged response.  */
01493     char *mergetag2;
01494     /* Repository, from a "repository" tagged response.  */
01495     char *repository;
01496 } importmergecmd;
01497
01498 /* Nonzero if we should arrange to return with a failure exit status.  */
01499 static int failure_exit;
01500
01501
01502 /*
01503  * The time stamp of the last file we registered.
01504  */
01505 static time_t last_register_time;
01506
01507 /*
01508  * The Checksum response gives the checksum for the file transferred
01509  * over by the next Updated, Merged or Patch response.  We just store
01510  * it here, and then check it in update_entries.
01511  */
01512
01513 static int stored_checksum_valid;
01514 static unsigned char stored_checksum[16];
01515
01516 static void
01517 handle_checksum (args, len)
01518     char *args;
01519     int len;
01520 {
01521     char *s;
01522     char buf[3];
01523     int i;
01524
01525     if (stored_checksum_valid)
01526         error (1, 0, "Checksum received before last one was used");
01527
01528     s = args;
01529     buf[2] = '\0';
01530     for (i = 0; i < 16; i++)
01531     {
01532         char *bufend;
01533
01534     buf[0] = *s++;
01535     buf[1] = *s++;
01536     stored_checksum[i] = (char) strtol (buf, &bufend, 16);
01537     if (bufend != buf + 2)
01538         break;
01539     }
01540
01541     if (i < 16 || *s != '\0')
01542         error (1, 0, "Invalid Checksum response: `%s'", args);
01543
01544     stored_checksum_valid = 1;
01545 }
01546
01547 /* Mode that we got in a "Mode" response (malloc'd), or NULL if none.  */
01548 static char *stored_mode;
01549
01550 static void handle_mode PROTO ((char *, int));
01551
01552 static void
01553 handle_mode (args, len)
01554     char *args;
01555     int len;
01556 {
01557     if (stored_mode != NULL)
01558     error (1, 0, "protocol error: duplicate Mode");
01559     stored_mode = xstrdup (args);
01560 }
01561
01562 /* Nonzero if time was specified in Mod-time.  */
01563 static int stored_modtime_valid;
01564 /* Time specified in Mod-time.  */
01565 static time_t stored_modtime;
01566
01567 static void handle_mod_time PROTO ((char *, int));
01568
01569 static void
01570 handle_mod_time (args, len)
01571     char *args;
01572     int len;
01573 {
01574     if (stored_modtime_valid)
01575     error (0, 0, "protocol error: duplicate Mod-time");
01576     stored_modtime = get_date (args, NULL);
01577     if (stored_modtime == (time_t) -1)
01578     error (0, 0, "protocol error: cannot parse date %s", args);
01579     else
01580     {
01581     stored_modtime_valid = 1;
01582     /* that doesn't work. Turn it on when OK */
01583 #if 0/*def macintosh*/
01584     {
01585     int i;
01586     unsigned long mac_1900_1970_epoch_offset = 0;
01587     for (i = 1900; i < 1970; i++)
01588         mac_1900_1970_epoch_offset += 365 + ((i % 4) == 0 ? 1 : 0);
01589     mac_1900_1970_epoch_offset *= 24L * 60L * 60L; /*SECSPERDAY*/
01590     stored_modtime += mac_1900_1970_epoch_offset;
01591     }
01592 #endif
01593 #ifdef macintosh
01594     stored_modtime_valid = 0;
01595 #endif
01596     }
01597 }
01598
01599 /*
01600  * If we receive a patch, but the patch program fails to apply it, we
01601  * want to request the original file.  We keep a list of files whose
01602  * patches have failed.
01603  */
01604
01605 char **failed_patches;
01606 int failed_patches_count;
01607
01608 struct update_entries_data
01609 {
01610     enum {
01611       /*
01612        * We are just getting an Entries line; the local file is
01613        * correct.
01614        */
01615       UPDATE_ENTRIES_CHECKIN,
01616       /* We are getting the file contents as well.  */
01617       UPDATE_ENTRIES_UPDATE,
01618       /*
01619        * We are getting a patch against the existing local file, not
01620        * an entire new file.
01621        */
01622       UPDATE_ENTRIES_PATCH,
01623       /*
01624        * We are getting an RCS change text (diff -n output) against
01625        * the existing local file, not an entire new file.
01626        */
01627       UPDATE_ENTRIES_RCS_DIFF
01628     } contents;
01629
01630     enum {
01631     /* We are replacing an existing file.  */
01632     UPDATE_ENTRIES_EXISTING,
01633     /* We are creating a new file.  */
01634     UPDATE_ENTRIES_NEW,
01635     /* We don't know whether it is existing or new.  */
01636     UPDATE_ENTRIES_EXISTING_OR_NEW
01637     } existp;
01638
01639     /*
01640      * String to put in the timestamp field or NULL to use the timestamp
01641      * of the file.
01642      */
01643     char *timestamp;
01644 };
01645
01646 /* Update the Entries line for this file.  */
01647 static void
01648 update_entries (data_arg, ent_list, short_pathname, filename)
01649     char *data_arg;
01650     List *ent_list;
01651     char *short_pathname;
01652     char *filename;
01653 {
01654     char *entries_line;
01655     struct update_entries_data *data = (struct update_entries_data *)data_arg;
01656
01657     char *cp;
01658     char *user;
01659     char *vn;
01660     /* Timestamp field.  Always empty according to the protocol.  */
01661     char *ts;
01662     char *options = NULL;
01663     char *tag = NULL;
01664     char *date = NULL;
01665     char *tag_or_date;
01666     char *scratch_entries = NULL;
01667     int bin;
01668
01669 #ifdef UTIME_EXPECTS_WRITABLE
01670     int change_it_back = 0;
01671 #endif
01672
01673     read_line (&entries_line);
01674
01675     /*
01676      * Parse the entries line.
01677      */
01678     scratch_entries = xstrdup (entries_line);
01679
01680     if (scratch_entries[0] != '/')
01681         error (1, 0, "bad entries line `%s' from server", entries_line);
01682     user = scratch_entries + 1;
01683     if ((cp = strchr (user, '/')) == NULL)
01684         error (1, 0, "bad entries line `%s' from server", entries_line);
01685     *cp++ = '\0';
01686     vn = cp;
01687     if ((cp = strchr (vn, '/')) == NULL)
01688         error (1, 0, "bad entries line `%s' from server", entries_line);
01689     *cp++ = '\0';
01690
01691     ts = cp;
01692     if ((cp = strchr (ts, '/')) == NULL)
01693         error (1, 0, "bad entries line `%s' from server", entries_line);
01694     *cp++ = '\0';
01695     options = cp;
01696     if ((cp = strchr (options, '/')) == NULL)
01697         error (1, 0, "bad entries line `%s' from server", entries_line);
01698     *cp++ = '\0';
01699     tag_or_date = cp;
01700
01701     /* If a slash ends the tag_or_date, ignore everything after it.  */
01702     cp = strchr (tag_or_date, '/');
01703     if (cp != NULL)
01704         *cp = '\0';
01705     if (*tag_or_date == 'T')
01706         tag = tag_or_date + 1;
01707     else if (*tag_or_date == 'D')
01708         date = tag_or_date + 1;
01709
01710     /* Done parsing the entries line. */
01711
01712     if (data->contents == UPDATE_ENTRIES_UPDATE
01713     || data->contents == UPDATE_ENTRIES_PATCH
01714     || data->contents == UPDATE_ENTRIES_RCS_DIFF)
01715     {
01716     char *size_string;
01717     char *mode_string;
01718     int size;
01719     char *buf;
01720     char *temp_filename;
01721     int use_gzip;
01722     int patch_failed;
01723
01724     read_line (&mode_string);
01725
01726     read_line (&size_string);
01727     if (size_string[0] == 'z')
01728     {
01729         use_gzip = 1;
01730         size = atoi (size_string+1);
01731     }
01732     else
01733     {
01734         use_gzip = 0;
01735         size = atoi (size_string);
01736     }
01737     free (size_string);
01738
01739     /* Note that checking this separately from writing the file is
01740        a race condition: if the existence or lack thereof of the
01741        file changes between now and the actual calls which
01742        operate on it, we lose.  However (a) there are so many
01743        cases, I'm reluctant to try to fix them all, (b) in some
01744        cases the system might not even have a system call which
01745        does the right thing, and (c) it isn't clear this needs to
01746        work.  */
01747     if (data->existp == UPDATE_ENTRIES_EXISTING
01748         && !isfile (filename))
01749         /* Emit a warning and update the file anyway.  */
01750         error (0, 0, "warning: %s unexpectedly disappeared",
01751            short_pathname);
01752
01753     if (data->existp == UPDATE_ENTRIES_NEW
01754         && isfile (filename))
01755     {
01756         /* Emit a warning and refuse to update the file; we don't want
01757            to clobber a user's file.  */
01758         size_t nread;
01759         size_t toread;
01760
01761         /* size should be unsigned, but until we get around to fixing
01762            that, work around it.  */
01763         size_t usize;
01764
01765         char buf[8192];
01766
01767         /* This error might be confusing; it isn't really clear to
01768            the user what to do about it.  Keep in mind that it has
01769            several causes: (1) something/someone creates the file
01770            during the time that CVS is running, (2) the repository
01771            has two files whose names clash for the client because
01772            of case-insensitivity or similar causes, (3) a special
01773            case of this is that a file gets renamed for example
01774            from a.c to A.C.  A "cvs update" on a case-insensitive
01775            client will get this error.  Repeating the update takes
01776            care of the problem, but is it clear to the user what
01777            is going on and what to do about it?, (4) the client
01778            has a file which the server doesn't know about (e.g. "?
01779            foo" file), and that name clashes with a file the
01780            server does know about, (5) classify.c will print the same
01781            message for other reasons.
01782
01783            I hope the above paragraph makes it clear that making this
01784            clearer is not a one-line fix.  */
01785         error (0, 0, "move away %s; it is in the way", short_pathname);
01786         if (updated_fname != NULL)
01787         {
01788         cvs_output ("C ", 0);
01789         cvs_output (updated_fname, 0);
01790         cvs_output ("\n", 1);
01791         }
01792         failure_exit = 1;
01793
01794     discard_file_and_return:
01795         /* Now read and discard the file contents.  */
01796         usize = size;
01797         nread = 0;
01798         while (nread < usize)
01799         {
01800         toread = usize - nread;
01801         if (toread > sizeof buf)
01802             toread = sizeof buf;
01803
01804         nread += try_read_from_server (buf, toread);
01805         if (nread == usize)
01806             break;
01807         }
01808
01809         free (mode_string);
01810         free (scratch_entries);
01811         free (entries_line);
01812
01813         /* The Mode, Mod-time, and Checksum responses should not carry
01814            over to a subsequent Created (or whatever) response, even
01815            in the error case.  */
01816         if (stored_mode != NULL)
01817         {
01818         free (stored_mode);
01819         stored_mode = NULL;
01820         }
01821         stored_modtime_valid = 0;
01822         stored_checksum_valid = 0;
01823
01824         if (updated_fname != NULL)
01825         {
01826         free (updated_fname);
01827         updated_fname = NULL;
01828         }
01829         return;
01830     }
01831
01832     temp_filename = xmalloc (strlen (filename) + 80);
01833 #ifdef USE_VMS_FILENAMES
01834         /* A VMS rename of "blah.dat" to "foo" to implies a
01835            destination of "foo.dat" which is unfortinate for CVS */
01836        sprintf (temp_filename, "%s_new_", filename);
01837 #else
01838 #ifdef _POSIX_NO_TRUNC
01839     sprintf (temp_filename, ".new.%.9s", filename);
01840 #else /* _POSIX_NO_TRUNC */
01841     sprintf (temp_filename, ".new.%s", filename);
01842 #endif /* _POSIX_NO_TRUNC */
01843 #endif /* USE_VMS_FILENAMES */
01844
01845     buf = xmalloc (size);
01846
01847         /* Some systems, like OS/2 and Windows NT, end lines with CRLF
01848            instead of just LF.  Format translation is done in the C
01849            library I/O funtions.  Here we tell them whether or not to
01850            convert -- if this file is marked "binary" with the RCS -kb
01851            flag, then we don't want to convert, else we do (because
01852            CVS assumes text files by default). */
01853
01854     if (options)
01855         bin = !(strcmp (options, "-kb"));
01856     else
01857         bin = 0;
01858
01859     if (data->contents == UPDATE_ENTRIES_RCS_DIFF)
01860     {
01861         /* This is an RCS change text.  We just hold the change
01862            text in memory.  */
01863
01864         if (use_gzip)
01865         error (1, 0,
01866                "server error: gzip invalid with RCS change text");
01867
01868         read_from_server (buf, size);
01869     }
01870     else
01871     {
01872         int fd;
01873
01874 #ifdef macintosh
01875     if ( strlen( filename ) > 31 )
01876     {
01877         error (0, 0, "You may experience an error here because '%s' is too long", filename);
01878         error (0, 0, "(more than 32 characters). HFS+ support is not yet provided.");
01879         /* what about HFS+ ??? At least Mozilla is checking-out with that */
01880         error (0, 0, "cannot write %s", filename);
01881         goto discard_file_and_return;
01882     }
01883 #endif
01884
01885         fd = CVS_OPEN (temp_filename,
01886                (O_WRONLY | O_CREAT | O_TRUNC
01887                 | (bin ? OPEN_BINARY : 0)),
01888                0777);
01889
01890         if (fd < 0)
01891         {
01892         /* I can see a case for making this a fatal error; for
01893            a condition like disk full or network unreachable
01894            (for a file server), carrying on and giving an
01895            error on each file seems unnecessary.  But if it is
01896            a permission problem, or some such, then it is
01897            entirely possible that future files will not have
01898            the same problem.  */
01899         error (0, errno, "cannot write %s", short_pathname);
01900         goto discard_file_and_return;
01901         }
01902
01903         if (size > 0)
01904         {
01905         read_from_server (buf, size);
01906
01907         if (use_gzip)
01908         {
01909             if (gunzip_and_write (fd, short_pathname,
01910                       (unsigned char *) buf, size))
01911             error (1, 0, "aborting due to compression error");
01912         }
01913         else if (write (fd, buf, size) != size)
01914             error (1, errno, "writing %s", short_pathname);
01915         }
01916
01917         if (close (fd) < 0)
01918         error (1, errno, "writing %s", short_pathname);
01919     }
01920
01921     /* This is after we have read the file from the net (a change
01922        from previous versions, where the server would send us
01923        "M U foo.c" before Update-existing or whatever), but before
01924        we finish writing the file (arguably a bug).  The timing
01925        affects a user who wants status info about how far we have
01926        gotten, and also affects whether "U foo.c" appears in addition
01927        to various error messages.  */
01928     if (updated_fname != NULL)
01929     {
01930         cvs_output ("U ", 0);
01931         cvs_output (updated_fname, 0);
01932         cvs_output ("\n", 1);
01933         free (updated_fname);
01934         updated_fname = 0;
01935     }
01936
01937     patch_failed = 0;
01938
01939     if (data->contents == UPDATE_ENTRIES_UPDATE)
01940     {
01941 #ifdef BINHEX_STUFF
01942         /* decode from server format to client format :
01943         at this point temp_filename has \012 inside. So
01944         we want to open as binary and save as TEXT to toggle to \015 */
01945         convert_file (temp_filename, O_RDONLY | OPEN_BINARY,
01946                 filename, O_WRONLY | O_CREAT | O_TRUNC, bin);
01947
01948         if (CVS_UNLINK (temp_filename) < 0)
01949             error (0, errno, "warning: can't remove temp file %s", temp_filename);
01950 #else
01951         rename_file (temp_filename, filename);
01952 #endif
01953     }
01954     else if (data->contents == UPDATE_ENTRIES_PATCH)
01955     {
01956         /* You might think we could just leave Patched out of
01957            Valid-responses and not get this response.  However, if
01958            memory serves, the CVS 1.9 server bases this on -u
01959            (update-patches), and there is no way for us to send -u
01960            or not based on whether the server supports "Rcs-diff".
01961
01962            Fall back to transmitting entire files.  */
01963         patch_failed = 1;
01964     }
01965     else
01966     {
01967         char *filebuf;
01968         size_t filebufsize;
01969         size_t nread;
01970         char *patchedbuf;
01971         size_t patchedlen;
01972
01973         /* Handle UPDATE_ENTRIES_RCS_DIFF.  */
01974
01975         if (!isfile (filename))
01976             error (1, 0, "patch original file %s does not exist",
01977                short_pathname);
01978         filebuf = NULL;
01979         filebufsize = 0;
01980         nread = 0;
01981
01982 #ifdef BINHEX_STUFF
01983         /* encode from client format to server format, so the
01984         patch can apply on  :
01985         at this point filename has \015 inside. So we want to open as TEXT
01986         and save as TEXT in order to keep \0x15 inside temp_filename */
01987         convert_file (filename, O_RDONLY,
01988             temp_filename, O_WRONLY | O_CREAT | O_TRUNC/* | OPEN_BINARY*/, bin);
01989
01990         get_file (temp_filename, short_pathname, bin ? FOPEN_BINARY_READ : "r",
01991               &filebuf, &filebufsize, &nread);
01992
01993         if (CVS_UNLINK (temp_filename) < 0)
01994             error (0, errno, "warning: can't remove temp file %s", temp_filename);
01995 #else
01996
01997         get_file (filename, short_pathname, bin ? FOPEN_BINARY_READ : "r",
01998               &filebuf, &filebufsize, &nread);
01999 #endif
02000         /* At this point the contents of the existing file are in
02001                FILEBUF, and the length of the contents is in NREAD.
02002                The contents of the patch from the network are in BUF,
02003                and the length of the patch is in SIZE.  */
02004
02005         if (! rcs_change_text (short_pathname, filebuf, nread, buf, size,
02006                    &patchedbuf, &patchedlen))
02007         patch_failed = 1;
02008         else
02009         {
02010         if (stored_checksum_valid)
02011         {
02012             struct cvs_MD5Context context;
02013             unsigned char checksum[16];
02014
02015             /* We have a checksum.  Check it before writing
02016                the file out, so that we don't have to read it
02017                back in again.  */
02018             cvs_MD5Init (&context);
02019             cvs_MD5Update (&context,
02020                    (unsigned char *) patchedbuf, patchedlen);
02021             cvs_MD5Final (checksum, &context);
02022             if (memcmp (checksum, stored_checksum, 16) != 0)
02023             {
02024             error (0, 0,
02025                    "checksum failure after patch to %s; will refetch",
02026                    short_pathname);
02027
02028             patch_failed = 1;
02029             }
02030
02031             stored_checksum_valid = 0;
02032         }
02033
02034         if (! patch_failed)
02035         {
02036             FILE *e;
02037
02038             e = open_file (temp_filename,
02039                    bin ? FOPEN_BINARY_WRITE : "w");
02040             if (fwrite (patchedbuf, 1, patchedlen, e) != patchedlen)
02041             error (1, errno, "cannot write %s", temp_filename);
02042             if (fclose (e) == EOF)
02043             error (1, errno, "cannot close %s", temp_filename);
02044 #ifdef BINHEX_STUFF
02045             /* decode from server format to client format, after
02046             the patch applied  :
02047             at this point temp_filename has \015 inside. So
02048             we want to open BINARY and save BINARY to keep \0x15
02049             inside the filename */
02050             convert_file (temp_filename, O_RDONLY | OPEN_BINARY,
02051                     filename, O_WRONLY | O_CREAT | O_TRUNC | OPEN_BINARY, bin);
02052
02053             if (CVS_UNLINK (temp_filename) < 0)
02054                 error (0, errno, "warning: can't remove temp file %s", temp_filename);
02055 #else
02056             rename_file (temp_filename, filename);
02057 #endif
02058         }
02059
02060         free (patchedbuf);
02061         }
02062
02063         free (filebuf);
02064     }
02065
02066     free (temp_filename);
02067
02068     if (stored_checksum_valid && ! patch_failed)
02069     {
02070         FILE *e;
02071         struct cvs_MD5Context context;
02072         unsigned char buf[8192];
02073         unsigned len;
02074         unsigned char checksum[16];
02075
02076         /*
02077          * Compute the MD5 checksum.  This will normally only be
02078          * used when receiving a patch, so we always compute it
02079          * here on the final file, rather than on the received
02080          * data.
02081          *
02082          * Note that if the file is a text file, we should read it
02083          * here using text mode, so its lines will be terminated the same
02084          * way they were transmitted.
02085          */
02086         e = CVS_FOPEN (filename, "r");
02087         if (e == NULL)
02088             error (1, errno, "could not open %s", short_pathname);
02089
02090         cvs_MD5Init (&context);
02091         while ((len = fread (buf, 1, sizeof buf, e)) != 0)
02092         cvs_MD5Update (&context, buf, len);
02093         if (ferror (e))
02094         error (1, errno, "could not read %s", short_pathname);
02095         cvs_MD5Final (checksum, &context);
02096
02097         fclose (e);
02098
02099         stored_checksum_valid = 0;
02100
02101         if (memcmp (checksum, stored_checksum, 16) != 0)
02102         {
02103             if (data->contents != UPDATE_ENTRIES_PATCH)
02104             error (1, 0, "checksum failure on %s",
02105                short_pathname);
02106
02107         error (0, 0,
02108                "checksum failure after patch to %s; will refetch",
02109                short_pathname);
02110
02111         patch_failed = 1;
02112         }
02113     }
02114
02115     if (patch_failed)
02116     {
02117         /* Save this file to retrieve later.  */
02118         failed_patches = (char **) xrealloc ((char *) failed_patches,
02119                          ((failed_patches_count + 1)
02120                           * sizeof (char *)));
02121         failed_patches[failed_patches_count] = xstrdup (short_pathname);
02122         ++failed_patches_count;
02123
02124         stored_checksum_valid = 0;
02125
02126         free (mode_string);
02127         free (buf);
02128         free (scratch_entries);
02129         free (entries_line);
02130
02131         return;
02132     }
02133
02134         {
02135         int status = change_mode (filename, mode_string, 1);
02136         if (status != 0)
02137         error (0, status, "cannot change mode of %s", short_pathname);
02138     }
02139
02140     free (mode_string);
02141     free (buf);
02142     }
02143
02144     if (stored_mode != NULL)
02145     {
02146     change_mode (filename, stored_mode, 1);
02147     free (stored_mode);
02148     stored_mode = NULL;
02149     }
02150
02151     if (stored_modtime_valid)
02152     {
02153     struct utimbuf t;
02154
02155     memset (&t, 0, sizeof (t));
02156     /* There is probably little point in trying to preserved the
02157        actime (or is there? What about Checked-in?).  */
02158     t.modtime = t.actime = stored_modtime;
02159
02160 #ifdef UTIME_EXPECTS_WRITABLE
02161     if (!iswritable (filename))
02162     {
02163         xchmod (filename, 1);
02164         change_it_back = 1;
02165     }
02166 #endif  /* UTIME_EXPECTS_WRITABLE  */
02167
02168     if (utime (filename, &t) < 0)
02169         error (0, errno, "cannot set time on %s", filename);
02170
02171 #ifdef UTIME_EXPECTS_WRITABLE
02172     if (change_it_back == 1)
02173     {
02174         xchmod (filename, 0);
02175         change_it_back = 0;
02176     }
02177 #endif  /*  UTIME_EXPECTS_WRITABLE  */
02178
02179     stored_modtime_valid = 0;
02180     }
02181
02182     /*
02183      * Process the entries line.  Do this after we've written the file,
02184      * since we need the timestamp.
02185      */
02186     if (strcmp (command_name, "export") != 0)
02187     {
02188     char *local_timestamp;
02189     char *file_timestamp;
02190
02191     (void) time (&last_register_time);
02192
02193     local_timestamp = data->timestamp;
02194     if (local_timestamp == NULL || ts[0] == '+')
02195         file_timestamp = time_stamp (filename);
02196     else
02197         file_timestamp = NULL;
02198
02199     /*
02200      * These special version numbers signify that it is not up to
02201      * date.  Create a dummy timestamp which will never compare
02202      * equal to the timestamp of the file.
02203      */
02204     if (vn[0] == '\0' || vn[0] == '0' || vn[0] == '-')
02205         local_timestamp = "dummy timestamp";
02206     else if (local_timestamp == NULL)
02207     {
02208         local_timestamp = file_timestamp;
02209
02210         /* Checking for command_name of "commit" doesn't seem like
02211            the cleanest way to handle this, but it seem to roughly
02212            parallel what the :local: code which calls
02213            mark_up_to_date ends up amounting to.  Some day, should
02214            think more about what the Checked-in response means
02215            vis-a-vis both Entries and Base and clarify
02216            cvsclient.texi accordingly.  */
02217
02218         if (!strcmp (command_name, "commit"))
02219         mark_up_to_date (filename);
02220     }
02221
02222     Register (ent_list, filename, vn, local_timestamp,
02223           options, tag, date, ts[0] == '+' ? file_timestamp : NULL);
02224
02225     if (file_timestamp)
02226         free (file_timestamp);
02227
02228     }
02229     free (scratch_entries);
02230     free (entries_line);
02231 }
02232
02233 static void
02234 handle_checked_in (args, len)
02235     char *args;
02236     int len;
02237 {
02238     struct update_entries_data dat;
02239     dat.contents = UPDATE_ENTRIES_CHECKIN;
02240     dat.existp = UPDATE_ENTRIES_EXISTING_OR_NEW;
02241     dat.timestamp = NULL;
02242     call_in_directory (args, update_entries, (char *)&dat);
02243 }
02244
02245 static void
02246 handle_new_entry (args, len)
02247     char *args;
02248     int len;
02249 {
02250     struct update_entries_data dat;
02251     dat.contents = UPDATE_ENTRIES_CHECKIN;
02252     dat.existp = UPDATE_ENTRIES_EXISTING_OR_NEW;
02253     dat.timestamp = "dummy timestamp from new-entry";
02254     call_in_directory (args, update_entries, (char *)&dat);
02255 }
02256
02257 static void
02258 handle_updated (args, len)
02259     char *args;
02260     int len;
02261 {
02262     struct update_entries_data dat;
02263     dat.contents = UPDATE_ENTRIES_UPDATE;
02264     dat.existp = UPDATE_ENTRIES_EXISTING_OR_NEW;
02265     dat.timestamp = NULL;
02266     call_in_directory (args, update_entries, (char *)&dat);
02267 }
02268
02269 static void handle_created PROTO((char *, int));
02270
02271 static void
02272 handle_created (args, len)
02273     char *args;
02274     int len;
02275 {
02276     struct update_entries_data dat;
02277     dat.contents = UPDATE_ENTRIES_UPDATE;
02278     dat.existp = UPDATE_ENTRIES_NEW;
02279     dat.timestamp = NULL;
02280     call_in_directory (args, update_entries, (char *)&dat);
02281 }
02282
02283 static void handle_update_existing PROTO((char *, int));
02284
02285 static void
02286 handle_update_existing (args, len)
02287     char *args;
02288     int len;
02289 {
02290     struct update_entries_data dat;
02291     dat.contents = UPDATE_ENTRIES_UPDATE;
02292     dat.existp = UPDATE_ENTRIES_EXISTING;
02293     dat.timestamp = NULL;
02294     call_in_directory (args, update_entries, (char *)&dat);
02295 }
02296
02297 static void
02298 handle_merged (args, len)
02299     char *args;
02300     int len;
02301 {
02302     struct update_entries_data dat;
02303     dat.contents = UPDATE_ENTRIES_UPDATE;
02304     /* Think this could be UPDATE_ENTRIES_EXISTING, but just in case...  */
02305     dat.existp = UPDATE_ENTRIES_EXISTING_OR_NEW;
02306     dat.timestamp = "Result of merge";
02307     call_in_directory (args, update_entries, (char *)&dat);
02308 }
02309
02310 static void
02311 handle_patched (args, len)
02312      char *args;
02313      int len;
02314 {
02315     struct update_entries_data dat;
02316     dat.contents = UPDATE_ENTRIES_PATCH;
02317     /* Think this could be UPDATE_ENTRIES_EXISTING, but just in case...  */
02318     dat.existp = UPDATE_ENTRIES_EXISTING_OR_NEW;
02319     dat.timestamp = NULL;
02320     call_in_directory (args, update_entries, (char *)&dat);
02321 }
02322
02323 static void
02324 handle_rcs_diff (args, len)
02325      char *args;
02326      int len;
02327 {
02328     struct update_entries_data dat;
02329     dat.contents = UPDATE_ENTRIES_RCS_DIFF;
02330     /* Think this could be UPDATE_ENTRIES_EXISTING, but just in case...  */
02331     dat.existp = UPDATE_ENTRIES_EXISTING_OR_NEW;
02332     dat.timestamp = NULL;
02333     call_in_directory (args, update_entries, (char *)&dat);
02334 }
02335
02336 static void
02337 remove_entry (data, ent_list, short_pathname, filename)
02338     char *data;
02339     List *ent_list;
02340     char *short_pathname;
02341     char *filename;
02342 {
02343     Scratch_Entry (ent_list, filename);
02344 }
02345
02346 static void
02347 handle_remove_entry (args, len)
02348     char *args;
02349     int len;
02350 {
02351     call_in_directory (args, remove_entry, (char *)NULL);
02352 }
02353
02354 static void
02355 remove_entry_and_file (data, ent_list, short_pathname, filename)
02356     char *data;
02357     List *ent_list;
02358     char *short_pathname;
02359     char *filename;
02360 {
02361     Scratch_Entry (ent_list, filename);
02362     /* Note that we don't ignore existence_error's here.  The server
02363        should be sending Remove-entry rather than Removed in cases
02364        where the file does not exist.  And if the user removes the
02365        file halfway through a cvs command, we should be printing an
02366        error.  */
02367     if (unlink_file (filename) < 0)
02368     error (0, errno, "unable to remove %s", short_pathname);
02369 }
02370
02371 static void
02372 handle_removed (args, len)
02373     char *args;
02374     int len;
02375 {
02376     call_in_directory (args, remove_entry_and_file, (char *)NULL);
02377 }
02378
02379 /* Is this the top level (directory containing CVSROOT)?  */
02380 static int
02381 is_cvsroot_level (pathname)
02382     char *pathname;
02383 {
02384     if (strcmp (toplevel_repos, CVSroot_directory) != 0)
02385     return 0;
02386
02387     return strchr (pathname, '/') == NULL;
02388 }
02389
02390 static void
02391 set_static (data, ent_list, short_pathname, filename)
02392     char *data;
02393     List *ent_list;
02394     char *short_pathname;
02395     char *filename;
02396 {
02397     FILE *fp;
02398     fp = open_file (CVSADM_ENTSTAT, "w+");
02399     if (fclose (fp) == EOF)
02400         error (1, errno, "cannot close %s", CVSADM_ENTSTAT);
02401 }
02402
02403 static void
02404 handle_set_static_directory (args, len)
02405     char *args;
02406     int len;
02407 {
02408     if (strcmp (command_name, "export") == 0)
02409     {
02410     /* Swallow the repository.  */
02411     read_line (NULL);
02412     return;
02413     }
02414     call_in_directory (args, set_static, (char *)NULL);
02415 }
02416
02417 static void
02418 clear_static (data, ent_list, short_pathname, filename)
02419     char *data;
02420     List *ent_list;
02421     char *short_pathname;
02422     char *filename;
02423 {
02424     if (unlink_file (CVSADM_ENTSTAT) < 0 && ! existence_error (errno))
02425         error (1, errno, "cannot remove file %s", CVSADM_ENTSTAT);
02426 }
02427
02428 static void
02429 handle_clear_static_directory (pathname, len)
02430     char *pathname;
02431     int len;
02432 {
02433     if (strcmp (command_name, "export") == 0)
02434     {
02435     /* Swallow the repository.  */
02436     read_line (NULL);
02437     return;
02438     }
02439
02440     if (is_cvsroot_level (pathname))
02441     {
02442         /*
02443      * Top level (directory containing CVSROOT).  This seems to normally
02444      * lack a CVS directory, so don't try to create files in it.
02445      */
02446     return;
02447     }
02448     call_in_directory (pathname, clear_static, (char *)NULL);
02449 }
02450
02451 static void
02452 set_sticky (data, ent_list, short_pathname, filename)
02453     char *data;
02454     List *ent_list;
02455     char *short_pathname;
02456     char *filename;
02457 {
02458     char *tagspec;
02459     FILE *f;
02460
02461     read_line (&tagspec);
02462
02463     /* FIXME-update-dir: error messages should include the directory.  */
02464     f = CVS_FOPEN (CVSADM_TAG, "w+");
02465     if (f == NULL)
02466     {
02467     /* Making this non-fatal is a bit of a kludge (see dirs2
02468        in testsuite).  A better solution would be to avoid having
02469        the server tell us about a directory we shouldn't be doing
02470        anything with anyway (e.g. by handling directory
02471        addition/removal better).  */
02472     error (0, errno, "cannot open %s", CVSADM_TAG);
02473     free (tagspec);
02474     return;
02475     }
02476     if (fprintf (f, "%s\n", tagspec) < 0)
02477     error (1, errno, "writing %s", CVSADM_TAG);
02478     if (fclose (f) == EOF)
02479     error (1, errno, "closing %s", CVSADM_TAG);
02480     free (tagspec);
02481 }
02482
02483 static void
02484 handle_set_sticky (pathname, len)
02485     char *pathname;
02486     int len;
02487 {
02488     if (strcmp (command_name, "export") == 0)
02489     {
02490     /* Swallow the repository.  */
02491     read_line (NULL);
02492         /* Swallow the tag line.  */
02493     read_line (NULL);
02494     return;
02495     }
02496     if (is_cvsroot_level (pathname))
02497     {
02498         /*
02499      * Top level (directory containing CVSROOT).  This seems to normally
02500      * lack a CVS directory, so don't try to create files in it.
02501      */
02502
02503     /* Swallow the repository.  */
02504     read_line (NULL);
02505         /* Swallow the tag line.  */
02506     read_line (NULL);
02507     return;
02508     }
02509
02510     call_in_directory (pathname, set_sticky, (char *)NULL);
02511 }
02512
02513 static void
02514 clear_sticky (data, ent_list, short_pathname, filename)
02515     char *data;
02516     List *ent_list;
02517     char *short_pathname;
02518     char *filename;
02519 {
02520     if (unlink_file (CVSADM_TAG) < 0 && ! existence_error (errno))
02521     error (1, errno, "cannot remove %s", CVSADM_TAG);
02522 }
02523
02524 static void
02525 handle_clear_sticky (pathname, len)
02526     char *pathname;
02527     int len;
02528 {
02529     if (strcmp (command_name, "export") == 0)
02530     {
02531     /* Swallow the repository.  */
02532     read_line (NULL);
02533     return;
02534     }
02535
02536     if (is_cvsroot_level (pathname))
02537     {
02538         /*
02539      * Top level (directory containing CVSROOT).  This seems to normally
02540      * lack a CVS directory, so don't try to create files in it.
02541      */
02542     return;
02543     }
02544
02545     call_in_directory (pathname, clear_sticky, (char *)NULL);
02546 }
02547
02548
02549 static void template PROTO ((char *, List *, char *, char *));
02550
02551 static void
02552 template (data, ent_list, short_pathname, filename)
02553     char *data;
02554     List *ent_list;
02555     char *short_pathname;
02556     char *filename;
02557 {
02558     /* FIXME: should be computing second argument from CVSADM_TEMPLATE
02559        and short_pathname.  */
02560     read_counted_file (CVSADM_TEMPLATE, "<CVS/Template file>");
02561 }
02562
02563 static void handle_template PROTO ((char *, int));
02564
02565 static void
02566 handle_template (pathname, len)
02567     char *pathname;
02568     int len;
02569 {
02570     call_in_directory (pathname, template, NULL);
02571 }
02572
02573
02574 struct save_prog {
02575     char *name;
02576     char *dir;
02577     struct save_prog *next;
02578 };
02579
02580 static struct save_prog *checkin_progs;
02581 static struct save_prog *update_progs;
02582
02583 /*
02584  * Unlike some responses this doesn't include the repository.  So we can't
02585  * just call call_in_directory and have the right thing happen; we save up
02586  * the requests and do them at the end.
02587  */
02588 static void
02589 handle_set_checkin_prog (args, len)
02590     char *args;
02591     int len;
02592 {
02593     char *prog;
02594     struct save_prog *p;
02595
02596     read_line (&prog);
02597     if (strcmp (command_name, "export") == 0)
02598     return;
02599
02600     p = (struct save_prog *) xmalloc (sizeof (struct save_prog));
02601     p->next = checkin_progs;
02602     p->dir = xstrdup (args);
02603     p->name = prog;
02604     checkin_progs = p;
02605 }
02606
02607 static void
02608 handle_set_update_prog (args, len)
02609     char *args;
02610     int len;
02611 {
02612     char *prog;
02613     struct save_prog *p;
02614
02615     read_line (&prog);
02616     if (strcmp (command_name, "export") == 0)
02617     return;
02618
02619     p = (struct save_prog *) xmalloc (sizeof (struct save_prog));
02620     p->next = update_progs;
02621     p->dir = xstrdup (args);
02622     p->name = prog;
02623     update_progs = p;
02624 }
02625
02626 static void do_deferred_progs PROTO((void));
02627
02628 static void
02629 do_deferred_progs ()
02630 {
02631     struct save_prog *p;
02632     struct save_prog *q;
02633
02634     char *fname;
02635     FILE *f;
02636
02637     if (toplevel_wd != NULL)
02638     {
02639     if (CVS_CHDIR (toplevel_wd) < 0)
02640         error (1, errno, "could not chdir to %s", toplevel_wd);
02641     }
02642     for (p = checkin_progs; p != NULL; )
02643     {
02644     fname = xmalloc (strlen (p->dir) + sizeof CVSADM_CIPROG + 10);
02645     sprintf (fname, "%s/%s", p->dir, CVSADM_CIPROG);
02646     f = open_file (fname, "w");
02647     if (fprintf (f, "%s\n", p->name) < 0)
02648         error (1, errno, "writing %s", fname);
02649     if (fclose (f) == EOF)
02650         error (1, errno, "closing %s", fname);
02651     free (p->name);
02652     free (p->dir);
02653     q = p->next;
02654     free (p);
02655     p = q;
02656     free (fname);
02657     }
02658     checkin_progs = NULL;
02659     for (p = update_progs; p != NULL; )
02660     {
02661     fname = xmalloc (strlen (p->dir) + sizeof CVSADM_UPROG + 10);
02662     sprintf (fname, "%s/%s", p->dir, CVSADM_UPROG);
02663     f = open_file (fname, "w");
02664     if (fprintf (f, "%s\n", p->name) < 0)
02665         error (1, errno, "writing %s", fname);
02666     if (fclose (f) == EOF)
02667         error (1, errno, "closing %s", fname);
02668     free (p->name);
02669     free (p->dir);
02670     q = p->next;
02671     free (p);
02672     p = q;
02673     free (fname);
02674     }
02675     update_progs = NULL;
02676 }
02677
02678 struct save_dir {
02679     char *dir;
02680     struct save_dir *next;
02681 };
02682
02683 struct save_dir *prune_candidates;
02684
02685 static void
02686 add_prune_candidate (dir)
02687     char *dir;
02688 {
02689     struct save_dir *p;
02690
02691     if ((dir[0] == '.' && dir[1] == '\0')
02692     || (prune_candidates != NULL
02693         && strcmp (dir, prune_candidates->dir) == 0))
02694     return;
02695     p = (struct save_dir *) xmalloc (sizeof (struct save_dir));
02696     p->dir = xstrdup (dir);
02697     p->next = prune_candidates;
02698     prune_candidates = p;
02699 }
02700
02701 static void process_prune_candidates PROTO((void));
02702
02703 static void
02704 process_prune_candidates ()
02705 {
02706     struct save_dir *p;
02707     struct save_dir *q;
02708
02709     if (toplevel_wd != NULL)
02710     {
02711     if (CVS_CHDIR (toplevel_wd) < 0)
02712         error (1, errno, "could not chdir to %s", toplevel_wd);
02713     }
02714     for (p = prune_candidates; p != NULL; )
02715     {
02716     if (isemptydir (p->dir, 1))
02717     {
02718         char *b;
02719
02720         if (unlink_file_dir (p->dir) < 0)
02721         error (0, errno, "cannot remove %s", p->dir);
02722         b = strrchr (p->dir, '/');
02723         if (b == NULL)
02724         Subdir_Deregister ((List *) NULL, (char *) NULL, p->dir);
02725         else
02726         {
02727         *b = '\0';
02728         Subdir_Deregister ((List *) NULL, p->dir, b + 1);
02729         }
02730     }
02731     free (p->dir);
02732     q = p->next;
02733     free (p);
02734     p = q;
02735     }
02736     prune_candidates = NULL;
02737 }
02738
02739 /* Send a Repository line.  */
02740
02741 static char *last_repos;
02742 static char *last_update_dir;
02743
02744 static void send_repository PROTO((char *, char *, char *));
02745
02746 static void
02747 send_repository (dir, repos, update_dir)
02748     char *dir;
02749     char *repos;
02750     char *update_dir;
02751 {
02752     char *adm_name;
02753
02754     /* FIXME: this is probably not the best place to check; I wish I
02755      * knew where in here's callers to really trap this bug.  To
02756      * reproduce the bug, just do this:
02757      *
02758      *       mkdir junk
02759      *       cd junk
02760      *       cvs -d some_repos update foo
02761      *
02762      * Poof, CVS seg faults and dies!  It's because it's trying to
02763      * send a NULL string to the server but dies in send_to_server.
02764      * That string was supposed to be the repository, but it doesn't
02765      * get set because there's no CVSADM dir, and somehow it's not
02766      * getting set from the -d argument either... ?
02767      */
02768     if (repos == NULL)
02769     {
02770         /* Lame error.  I want a real fix but can't stay up to track
02771            this down right now. */
02772         error (1, 0, "no repository");
02773     }
02774
02775     if (update_dir == NULL || update_dir[0] == '\0')
02776     update_dir = ".";
02777
02778     if (last_repos != NULL
02779     && strcmp (repos, last_repos) == 0
02780     && last_update_dir != NULL
02781     && strcmp (update_dir, last_update_dir) == 0)
02782     /* We've already sent it.  */
02783     return;
02784
02785     if (client_prune_dirs)
02786     add_prune_candidate (update_dir);
02787
02788     /* Add a directory name to the list of those sent to the
02789        server. */
02790     if (update_dir && (*update_dir != '\0')
02791     && (strcmp (update_dir, ".") != 0)
02792     && (findnode (dirs_sent_to_server, update_dir) == NULL))
02793     {
02794     Node *n;
02795     n = getnode ();
02796     n->type = NT_UNKNOWN;
02797     n->key = xstrdup (update_dir);
02798     n->data = NULL;
02799
02800     if (addnode (dirs_sent_to_server, n))
02801         error (1, 0, "cannot add directory %s to list", n->key);
02802     }
02803
02804     /* 80 is large enough for any of CVSADM_*.  */
02805     adm_name = xmalloc (strlen (dir) + 80);
02806
02807     send_to_server ("Directory ", 0);
02808     {
02809     /* Send the directory name.  I know that this
02810        sort of duplicates code elsewhere, but each
02811        case seems slightly different...  */
02812     char buf[1];
02813     char *p = update_dir;
02814     while (*p != '\0')
02815     {
02816         assert (*p != '\012');
02817         if (ISDIRSEP (*p))
02818         {
02819         buf[0] = '/';
02820         send_to_server (buf, 1);
02821         }
02822         else
02823         {
02824         buf[0] = *p;
02825         send_to_server (buf, 1);
02826         }
02827         ++p;
02828     }
02829     }
02830     send_to_server ("\012", 1);
02831     send_to_server (repos, 0);
02832     send_to_server ("\012", 1);
02833
02834     if (supported_request ("Static-directory"))
02835     {
02836     adm_name[0] = '\0';
02837     if (dir[0] != '\0')
02838     {
02839         strcat (adm_name, dir);
02840         strcat (adm_name, "/");
02841     }
02842     strcat (adm_name, CVSADM_ENTSTAT);
02843     if (isreadable (adm_name))
02844     {
02845         send_to_server ("Static-directory\012", 0);
02846     }
02847     }
02848     if (supported_request ("Sticky"))
02849     {
02850     FILE *f;
02851     if (dir[0] == '\0')
02852         strcpy (adm_name, CVSADM_TAG);
02853     else
02854         sprintf (adm_name, "%s/%s", dir, CVSADM_TAG);
02855
02856     f = CVS_FOPEN (adm_name, "r");
02857     if (f == NULL)
02858     {
02859         if (! existence_error (errno))
02860         error (1, errno, "reading %s", adm_name);
02861     }
02862     else
02863     {
02864         char line[80];
02865         char *nl = NULL;
02866         send_to_server ("Sticky ", 0);
02867         while (fgets (line, sizeof (line), f) != NULL)
02868         {
02869         send_to_server (line, 0);
02870         nl = strchr (line, '\n');
02871         if (nl != NULL)
02872             break;
02873         }
02874         if (nl == NULL)
02875                 send_to_server ("\012", 1);
02876         if (fclose (f) == EOF)
02877         error (0, errno, "closing %s", adm_name);
02878     }
02879     }
02880     if (supported_request ("Checkin-prog"))
02881     {
02882     FILE *f;
02883     if (dir[0] == '\0')
02884         strcpy (adm_name, CVSADM_CIPROG);
02885     else
02886         sprintf (adm_name, "%s/%s", dir, CVSADM_CIPROG);
02887
02888     f = CVS_FOPEN (adm_name, "r");
02889     if (f == NULL)
02890     {
02891         if (! existence_error (errno))
02892         error (1, errno, "reading %s", adm_name);
02893     }
02894     else
02895     {
02896         char line[80];
02897         char *nl = NULL;
02898
02899         send_to_server ("Checkin-prog ", 0);
02900
02901         while (fgets (line, sizeof (line), f) != NULL)
02902         {
02903         send_to_server (line, 0);
02904
02905         nl = strchr (line, '\n');
02906         if (nl != NULL)
02907             break;
02908         }
02909         if (nl == NULL)
02910         send_to_server ("\012", 1);
02911         if (fclose (f) == EOF)
02912         error (0, errno, "closing %s", adm_name);
02913     }
02914     }
02915     if (supported_request ("Update-prog"))
02916     {
02917     FILE *f;
02918     if (dir[0] == '\0')
02919         strcpy (adm_name, CVSADM_UPROG);
02920     else
02921         sprintf (adm_name, "%s/%s", dir, CVSADM_UPROG);
02922
02923     f = CVS_FOPEN (adm_name, "r");
02924     if (f == NULL)
02925     {
02926         if (! existence_error (errno))
02927         error (1, errno, "reading %s", adm_name);
02928     }
02929     else
02930     {
02931         char line[80];
02932         char *nl = NULL;
02933
02934         send_to_server ("Update-prog ", 0);
02935
02936         while (fgets (line, sizeof (line), f) != NULL)
02937         {
02938         send_to_server (line, 0);
02939
02940         nl = strchr (line, '\n');
02941         if (nl != NULL)
02942             break;
02943         }
02944         if (nl == NULL)
02945         send_to_server ("\012", 1);
02946         if (fclose (f) == EOF)
02947         error (0, errno, "closing %s", adm_name);
02948     }
02949     }
02950     free (adm_name);
02951     if (last_repos != NULL)
02952     free (last_repos);
02953     if (last_update_dir != NULL)
02954     free (last_update_dir);
02955     last_repos = xstrdup (repos);
02956     last_update_dir = xstrdup (update_dir);
02957 }
02958
02959 /* Send a Repository line and set toplevel_repos.  */
02960
02961 void
02962 send_a_repository (dir, repository, update_dir)
02963     char *dir;
02964     char *repository;
02965     char *update_dir;
02966 {
02967     if (toplevel_repos == NULL && repository != NULL)
02968     {
02969     if (update_dir[0] == '\0'
02970         || (update_dir[0] == '.' && update_dir[1] == '\0'))
02971         toplevel_repos = xstrdup (repository);
02972     else
02973     {
02974         /*
02975          * Get the repository from a CVS/Repository file if update_dir
02976          * is absolute.  This is not correct in general, because
02977          * the CVS/Repository file might not be the top-level one.
02978          * This is for cases like "cvs update /foo/bar" (I'm not
02979          * sure it matters what toplevel_repos we get, but it does
02980          * matter that we don't hit the "internal error" code below).
02981          */
02982         if (update_dir[0] == '/')
02983         toplevel_repos = Name_Repository (update_dir, update_dir);
02984         else
02985         {
02986         /*
02987          * Guess the repository of that directory by looking at a
02988          * subdirectory and removing as many pathname components
02989          * as are in update_dir.  I think that will always (or at
02990          * least almost always) be 1.
02991          *
02992          * So this deals with directories which have been
02993          * renamed, though it doesn't necessarily deal with
02994          * directories which have been put inside other
02995          * directories (and cvs invoked on the containing
02996          * directory).  I'm not sure the latter case needs to
02997          * work.
02998          *
02999          * 21 Aug 1998: Well, Mr. Above-Comment-Writer, it
03000          * does need to work after all.  When we are using the
03001          * client in a multi-cvsroot environment, it will be
03002          * fairly common that we have the above case (e.g.,
03003          * cwd checked out from one repository but
03004          * subdirectory checked out from another).  We can't
03005          * assume that by walking up a directory in our wd we
03006          * necessarily walk up a directory in the repository.
03007          */
03008         /*
03009          * This gets toplevel_repos wrong for "cvs update ../foo"
03010          * but I'm not sure toplevel_repos matters in that case.
03011          */
03012
03013         int repository_len, update_dir_len;
03014
03015         strip_trailing_slashes (update_dir);
03016
03017         repository_len = strlen (repository);
03018         update_dir_len = strlen (update_dir);
03019
03020         /* Try to remove the path components in UPDATE_DIR
03021                    from REPOSITORY.  If the path elements don't exist
03022                    in REPOSITORY, or the removal of those path
03023                    elements mean that we "step above"
03024                    CVSroot_directory, set toplevel_repos to
03025                    CVSroot_directory. */
03026         if ((repository_len > update_dir_len)
03027             && (strcmp (repository + repository_len - update_dir_len,
03028                 update_dir) == 0)
03029             /* TOPLEVEL_REPOS shouldn't be above CVSroot_directory */
03030             && ((repository_len - update_dir_len)
03031             > strlen (CVSroot_directory)))
03032         {
03033             /* The repository name contains UPDATE_DIR.  Set
03034                        toplevel_repos to the repository name without
03035                        UPDATE_DIR. */
03036
03037             toplevel_repos = xmalloc (repository_len - update_dir_len);
03038             /* Note that we don't copy the trailing '/'.  */
03039             strncpy (toplevel_repos, repository,
03040                  repository_len - update_dir_len - 1);
03041             toplevel_repos[repository_len - update_dir_len - 1] = '\0';
03042         }
03043         else
03044         {
03045             toplevel_repos = xstrdup (CVSroot_directory);
03046         }
03047         }
03048     }
03049     }
03050
03051     send_repository (dir, repository, update_dir);
03052 }
03053
03054 /* The "expanded" modules.  */
03055 static int modules_count;
03056 static int modules_allocated;
03057 static char **modules_vector;
03058
03059 static void
03060 handle_module_expansion (args, len)
03061     char *args;
03062     int len;
03063 {
03064     if (modules_vector == NULL)
03065     {
03066     modules_allocated = 1; /* Small for testing */
03067     modules_vector = (char **) xmalloc
03068       (modules_allocated * sizeof (modules_vector[0]));
03069     }
03070     else if (modules_count >= modules_allocated)
03071     {
03072     modules_allocated *= 2;
03073     modules_vector = (char **) xrealloc
03074       ((char *) modules_vector,
03075        modules_allocated * sizeof (modules_vector[0]));
03076     }
03077     modules_vector[modules_count] = xmalloc (strlen (args) + 1);
03078     strcpy (modules_vector[modules_count], args);
03079     ++modules_count;
03080 }
03081
03082 /* Original, not "expanded" modules.  */
03083 static int module_argc;
03084 static char **module_argv;
03085
03086 void
03087 client_expand_modules (argc, argv, local)
03088     int argc;
03089     char **argv;
03090     int local;
03091 {
03092     int errs;
03093     int i;
03094
03095     module_argc = argc;
03096     module_argv = (char **) xmalloc ((argc + 1) * sizeof (module_argv[0]));
03097     for (i = 0; i < argc; ++i)
03098     module_argv[i] = xstrdup (argv[i]);
03099     module_argv[argc] = NULL;
03100
03101     for (i = 0; i < argc; ++i)
03102     send_arg (argv[i]);
03103     send_a_repository ("", CVSroot_directory, "");
03104
03105     send_to_server ("expand-modules\012", 0);
03106
03107     errs = get_server_responses ();
03108     if (last_repos != NULL)
03109         free (last_repos);
03110     last_repos = NULL;
03111     if (last_update_dir != NULL)
03112         free (last_update_dir);
03113     last_update_dir = NULL;
03114     if (errs)
03115     error (errs, 0, "cannot expand modules");
03116 }
03117
03118 void
03119 client_send_expansions (local, where, build_dirs)
03120     int local;
03121     char *where;
03122     int build_dirs;
03123 {
03124     int i;
03125     char *argv[1];
03126
03127     /* Send the original module names.  The "expanded" module name might
03128        not be suitable as an argument to a co request (e.g. it might be
03129        the result of a -d argument in the modules file).  It might be
03130        cleaner if we genuinely expanded module names, all the way to a
03131        local directory and repository, but that isn't the way it works
03132        now.  */
03133     send_file_names (module_argc, module_argv, 0);
03134
03135     for (i = 0; i < modules_count; ++i)
03136     {
03137     argv[0] = where ? where : modules_vector[i];
03138     if (isfile (argv[0]))
03139         send_files (1, argv, local, 0, build_dirs ? SEND_BUILD_DIRS : 0);
03140     }
03141     send_a_repository ("", CVSroot_directory, "");
03142 }
03143
03144 void
03145 client_nonexpanded_setup ()
03146 {
03147     send_a_repository ("", CVSroot_directory, "");
03148 }
03149
03150 /* Receive a cvswrappers line from the server; it must be a line
03151    containing an RCS option (e.g., "*.exe   -k 'b'").
03152
03153    Note that this doesn't try to handle -t/-f options (which are a
03154    whole separate issue which noone has thought much about, as far
03155    as I know).
03156
03157    We need to know the keyword expansion mode so we know whether to
03158    read the file in text or binary mode.  */
03159
03160 static void
03161 handle_wrapper_rcs_option (args, len)
03162     char *args;
03163     int len;
03164 {
03165     char *p;
03166
03167     /* Enforce the notes in cvsclient.texi about how the response is not
03168        as free-form as it looks.  */
03169     p = strchr (args, ' ');
03170     if (p == NULL)
03171     goto handle_error;
03172     if (*++p != '-'
03173     || *++p != 'k'
03174     || *++p != ' '
03175     || *++p != '\'')
03176     goto handle_error;
03177     if (strchr (p, '\'') == NULL)
03178     goto handle_error;
03179
03180     /* Add server-side cvswrappers line to our wrapper list. */
03181     wrap_add (args, 0);
03182     return;
03183  handle_error:
03184     error (0, errno, "protocol error: ignoring invalid wrappers %s", args);
03185 }
03186
03187
03188 static void
03189 handle_m (args, len)
03190     char *args;
03191     int len;
03192 {
03193     /* In the case where stdout and stderr point to the same place,
03194        fflushing stderr will make output happen in the correct order.
03195        Often stderr will be line-buffered and this won't be needed,
03196        but not always (is that true?  I think the comment is probably
03197        based on being confused between default buffering between
03198        stdout and stderr.  But I'm not sure).  */
03199     fflush (stderr);
03200 #ifdef CVSGUI_PIPE
03201     cvs_output(args, len);
03202     cvs_output("\n", 1);
03203 #else
03204     fwrite (args, len, sizeof (*args), stdout);
03205     putc ('\n', stdout);
03206 #endif
03207 }
03208
03209 static void handle_mbinary PROTO ((char *, int));
03210
03211 static void
03212 handle_mbinary (args, len)
03213     char *args;
03214     int len;
03215 {
03216     char *size_string;
03217     size_t size;
03218     size_t totalread;
03219     size_t nread;
03220     size_t toread;
03221     char buf[8192];
03222
03223     /* See comment at handle_m about (non)flush of stderr.  */
03224
03225     /* Get the size.  */
03226     read_line (&size_string);
03227     size = atoi (size_string);
03228     free (size_string);
03229
03230     /* OK, now get all the data.  The algorithm here is that we read
03231        as much as the network wants to give us in
03232        try_read_from_server, and then we output it all, and then
03233        repeat, until we get all the data.  */
03234     totalread = 0;
03235     while (totalread < size)
03236     {
03237     toread = size - totalread;
03238     if (toread > sizeof buf)
03239         toread = sizeof buf;
03240
03241     nread = try_read_from_server (buf, toread);
03242     cvs_output_binary (buf, nread);
03243     totalread += nread;
03244     }
03245 }
03246
03247 static void
03248 handle_e (args, len)
03249     char *args;
03250     int len;
03251 {
03252     /* In the case where stdout and stderr point to the same place,
03253        fflushing stdout will make output happen in the correct order.  */
03254     fflush (stdout);
03255 #ifdef CVSGUI_PIPE
03256     cvs_outerr(args, len);
03257     cvs_outerr("\n", 1);
03258 #else
03259     fwrite (args, len, sizeof (*args), stderr);
03260     putc ('\n', stderr);
03261 #endif
03262 }
03263
03264 /*ARGSUSED*/
03265 static void
03266 handle_f (args, len)
03267     char *args;
03268     int len;
03269 {
03270     fflush (stderr);
03271 }
03272
03273 static void handle_mt PROTO ((char *, int));
03274
03275 static void
03276 handle_mt (args, len)
03277     char *args;
03278     int len;
03279 {
03280     char *p;
03281     char *tag = args;
03282     char *text;
03283
03284     /* See comment at handle_m for more details.  */
03285     fflush (stderr);
03286
03287     p = strchr (args, ' ');
03288     if (p == NULL)
03289     text = NULL;
03290     else
03291     {
03292     *p++ = '\0';
03293     text = p;
03294     }
03295
03296     switch (tag[0])
03297     {
03298     case '+':
03299         if (strcmp (tag, "+updated") == 0)
03300         updated_seen = 1;
03301         else if (strcmp (tag, "+importmergecmd") == 0)
03302         importmergecmd.seen = 1;
03303         break;
03304     case '-':
03305         if (strcmp (tag, "-updated") == 0)
03306         updated_seen = 0;
03307         else if (strcmp (tag, "-importmergecmd") == 0)
03308         {
03309         char buf[80];
03310
03311         /* Now that we have gathered the information, we can
03312                    output the suggested merge command.  */
03313
03314         if (importmergecmd.conflicts == 0
03315             || importmergecmd.mergetag1 == NULL
03316             || importmergecmd.mergetag2 == NULL
03317             || importmergecmd.repository == NULL)
03318         {
03319             error (0, 0,
03320                "invalid server: incomplete importmergecmd tags");
03321             break;
03322         }
03323
03324         sprintf (buf, "\n%d conflicts created by this import.\n",
03325              importmergecmd.conflicts);
03326         cvs_output (buf, 0);
03327         cvs_output ("Use the following command to help the merge:\n\n",
03328                 0);
03329         cvs_output ("\t", 1);
03330         cvs_output (program_name, 0);
03331         if (CVSroot_cmdline != NULL)
03332         {
03333             cvs_output (" -d ", 0);
03334             cvs_output (CVSroot_cmdline, 0);
03335         }
03336         cvs_output (" checkout -j", 0);
03337         cvs_output (importmergecmd.mergetag1, 0);
03338         cvs_output (" -j", 0);
03339         cvs_output (importmergecmd.mergetag2, 0);
03340         cvs_output (" ", 1);
03341         cvs_output (importmergecmd.repository, 0);
03342         cvs_output ("\n\n", 0);
03343
03344         /* Clear the static variables so that everything is
03345                    ready for any subsequent importmergecmd tag.  */
03346         importmergecmd.conflicts = 0;
03347         free (importmergecmd.mergetag1);
03348         importmergecmd.mergetag1 = NULL;
03349         free (importmergecmd.mergetag2);
03350         importmergecmd.mergetag2 = NULL;
03351         free (importmergecmd.repository);
03352         importmergecmd.repository = NULL;
03353
03354         importmergecmd.seen = 0;
03355         }
03356         break;
03357     default:
03358         if (updated_seen)
03359         {
03360         if (strcmp (tag, "fname") == 0)
03361         {
03362             if (updated_fname != NULL)
03363             {
03364             /* Output the previous message now.  This can happen
03365                if there was no Update-existing or other such
03366                response, due to the -n global option.  */
03367             cvs_output ("U ", 0);
03368             cvs_output (updated_fname, 0);
03369             cvs_output ("\n", 1);
03370             free (updated_fname);
03371             }
03372             updated_fname = xstrdup (text);
03373         }
03374         /* Swallow all other tags.  Either they are extraneous
03375            or they reflect future extensions that we can
03376            safely ignore.  */
03377         }
03378         else if (importmergecmd.seen)
03379         {
03380         if (strcmp (tag, "conflicts") == 0)
03381             importmergecmd.conflicts = atoi (text);
03382         else if (strcmp (tag, "mergetag1") == 0)
03383             importmergecmd.mergetag1 = xstrdup (text);
03384         else if (strcmp (tag, "mergetag2") == 0)
03385             importmergecmd.mergetag2 = xstrdup (text);
03386         else if (strcmp (tag, "repository") == 0)
03387             importmergecmd.repository = xstrdup (text);
03388         /* Swallow all other tags.  Either they are text for
03389                    which we are going to print our own version when we
03390                    see -importmergecmd, or they are future extensions
03391                    we can safely ignore.  */
03392         }
03393         else if (strcmp (tag, "newline") == 0)
03394 #ifdef CVSGUI_PIPE
03395         cvs_output("\n", 1);
03396 #else
03397         printf ("\n");
03398 #endif
03399         else if (text != NULL)
03400 #ifdef CVSGUI_PIPE
03401         cvs_output(text, 0);
03402 #else
03403         printf ("%s", text);
03404 #endif
03405     }
03406 }
03407
03408 #endif /* CLIENT_SUPPORT */
03409 #if defined(CLIENT_SUPPORT) || defined(SERVER_SUPPORT)
03410
03411 /* This table must be writeable if the server code is included.  */
03412 struct response responses[] =
03413 {
03414 #ifdef CLIENT_SUPPORT
03415 #define RSP_LINE(n, f, t, s) {n, f, t, s}
03416 #else /* ! CLIENT_SUPPORT */
03417 #define RSP_LINE(n, f, t, s) {n, s}
03418 #endif /* CLIENT_SUPPORT */
03419
03420     RSP_LINE("ok", handle_ok, response_type_ok, rs_essential),
03421     RSP_LINE("error", handle_error, response_type_error, rs_essential),
03422     RSP_LINE("Valid-requests", handle_valid_requests, response_type_normal,
03423        rs_essential),
03424     RSP_LINE("Checked-in", handle_checked_in, response_type_normal,
03425        rs_essential),
03426     RSP_LINE("New-entry", handle_new_entry, response_type_normal, rs_optional),
03427     RSP_LINE("Checksum", handle_checksum, response_type_normal, rs_optional),
03428     RSP_LINE("Copy-file", handle_copy_file, response_type_normal, rs_optional),
03429     RSP_LINE("Updated", handle_updated, response_type_normal, rs_essential),
03430     RSP_LINE("Created", handle_created, response_type_normal, rs_optional),
03431     RSP_LINE("Update-existing", handle_update_existing, response_type_normal,
03432        rs_optional),
03433     RSP_LINE("Merged", handle_merged, response_type_normal, rs_essential),
03434     RSP_LINE("Patched", handle_patched, response_type_normal, rs_optional),
03435     RSP_LINE("Rcs-diff", handle_rcs_diff, response_type_normal, rs_optional),
03436     RSP_LINE("Mode", handle_mode, response_type_normal, rs_optional),
03437     RSP_LINE("Mod-time", handle_mod_time, response_type_normal, rs_optional),
03438     RSP_LINE("Removed", handle_removed, response_type_normal, rs_essential),
03439     RSP_LINE("Remove-entry", handle_remove_entry, response_type_normal,
03440        rs_optional),
03441     RSP_LINE("Set-static-directory", handle_set_static_directory,
03442        response_type_normal,
03443        rs_optional),
03444     RSP_LINE("Clear-static-directory", handle_clear_static_directory,
03445        response_type_normal,
03446        rs_optional),
03447     RSP_LINE("Set-sticky", handle_set_sticky, response_type_normal,
03448        rs_optional),
03449     RSP_LINE("Clear-sticky", handle_clear_sticky, response_type_normal,
03450        rs_optional),
03451     RSP_LINE("Template", handle_template, response_type_normal,
03452        rs_optional),
03453     RSP_LINE("Set-checkin-prog", handle_set_checkin_prog, response_type_normal,
03454        rs_optional),
03455     RSP_LINE("Set-update-prog", handle_set_update_prog, response_type_normal,
03456        rs_optional),
03457     RSP_LINE("Notified", handle_notified, response_type_normal, rs_optional),
03458     RSP_LINE("Module-expansion", handle_module_expansion, response_type_normal,
03459        rs_optional),
03460     RSP_LINE("Wrapper-rcsOption", handle_wrapper_rcs_option,
03461        response_type_normal,
03462        rs_optional),
03463     RSP_LINE("M", handle_m, response_type_normal, rs_essential),
03464     RSP_LINE("Mbinary", handle_mbinary, response_type_normal, rs_optional),
03465     RSP_LINE("E", handle_e, response_type_normal, rs_essential),
03466     RSP_LINE("F", handle_f, response_type_normal, rs_optional),
03467     RSP_LINE("MT", handle_mt, response_type_normal, rs_optional),
03468     /* Possibly should be response_type_error.  */
03469     RSP_LINE(NULL, NULL, response_type_normal, rs_essential)
03470
03471 #undef RSP_LINE
03472 };
03473
03474 #endif /* CLIENT_SUPPORT or SERVER_SUPPORT */
03475 #ifdef CLIENT_SUPPORT
03476
03477 /*
03478  * If LEN is 0, then send_to_server() computes string's length itself.
03479  *
03480  * Therefore, pass the real length when transmitting data that might
03481  * contain 0's.
03482  */
03483 void
03484 send_to_server (str, len)
03485      char *str;
03486      size_t len;
03487 {
03488     static int nbytes;
03489
03490     if (len == 0)
03491     len = strlen (str);
03492
03493     buf_output (to_server, str, len);
03494
03495     /* There is no reason not to send data to the server, so do it
03496        whenever we've accumulated enough information in the buffer to
03497        make it worth sending.  */
03498     nbytes += len;
03499     if (nbytes >= 2 * BUFFER_DATA_SIZE)
03500     {
03501     int status;
03502
03503         status = buf_send_output (to_server);
03504     if (status != 0)
03505         error (1, status, "error writing to server");
03506     nbytes = 0;
03507     }
03508 }
03509
03510 /* Read up to LEN bytes from the server.  Returns actual number of
03511    bytes read, which will always be at least one; blocks if there is
03512    no data available at all.  Gives a fatal error on EOF or error.  */
03513 static size_t
03514 try_read_from_server (buf, len)
03515     char *buf;
03516     size_t len;
03517 {
03518     int status, nread;
03519     char *data;
03520
03521     status = buf_read_data (from_server, len, &data, &nread);
03522     if (status != 0)
03523     {
03524     if (status == -1)
03525         error (1, 0,
03526            "end of file from server (consult above messages if any)");
03527     else if (status == -2)
03528         error (1, 0, "out of memory");
03529     else
03530         error (1, status, "reading from server");
03531     }
03532
03533     memcpy (buf, data, nread);
03534
03535     return nread;
03536 }
03537
03538 /*
03539  * Read LEN bytes from the server or die trying.
03540  */
03541 void
03542 read_from_server (buf, len)
03543     char *buf;
03544     size_t len;
03545 {
03546     size_t red = 0;
03547     while (red < len)
03548     {
03549     red += try_read_from_server (buf + red, len - red);
03550     if (red == len)
03551         break;
03552     }
03553 }
03554
03555 /*
03556  * Get some server responses and process them.  Returns nonzero for
03557  * error, 0 for success.  */
03558 int
03559 get_server_responses ()
03560 {
03561     struct response *rs;
03562     do
03563     {
03564     char *cmd;
03565     int len;
03566
03567     len = read_line (&cmd);
03568     for (rs = responses; rs->name != NULL; ++rs)
03569         if (strncmp (cmd, rs->name, strlen (rs->name)) == 0)
03570         {
03571         int cmdlen = strlen (rs->name);
03572         if (cmd[cmdlen] == '\0')
03573             ;
03574         else if (cmd[cmdlen] == ' ')
03575             ++cmdlen;
03576         else
03577             /*
03578              * The first len characters match, but it's a different
03579              * response.  e.g. the response is "oklahoma" but we
03580              * matched "ok".
03581              */
03582             continue;
03583         (*rs->func) (cmd + cmdlen, len - cmdlen);
03584         break;
03585         }
03586     if (rs->name == NULL)
03587         /* It's OK to print just to the first '\0'.  */
03588         /* We might want to handle control characters and the like
03589            in some other way other than just sending them to stdout.
03590            One common reason for this error is if people use :ext:
03591            with a version of rsh which is doing CRLF translation or
03592            something, and so the client gets "ok^M" instead of "ok".
03593            Right now that will tend to print part of this error
03594            message over the other part of it.  It seems like we could
03595            do better (either in general, by quoting or omitting all
03596            control characters, and/or specifically, by detecting the CRLF
03597            case and printing a specific error message).  */
03598         error (0, 0,
03599            "warning: unrecognized response `%s' from cvs server",
03600            cmd);
03601     free (cmd);
03602     } while (rs->type == response_type_normal);
03603
03604     if (updated_fname != NULL)
03605     {
03606     /* Output the previous message now.  This can happen
03607        if there was no Update-existing or other such
03608        response, due to the -n global option.  */
03609     cvs_output ("U ", 0);
03610     cvs_output (updated_fname, 0);
03611     cvs_output ("\n", 1);
03612     free (updated_fname);
03613     updated_fname = NULL;
03614     }
03615
03616     if (rs->type == response_type_error)
03617     return 1;
03618     if (failure_exit)
03619     return 1;
03620     return 0;
03621 }
03622
03623 /* Get the responses and then close the connection.  */
03624 int server_fd = -1;
03625
03626 /*
03627  * Flag var; we'll set it in start_server() and not one of its
03628  * callees, such as start_rsh_server().  This means that there might
03629  * be a small window between the starting of the server and the
03630  * setting of this var, but all the code in that window shouldn't care
03631  * because it's busy checking return values to see if the server got
03632  * started successfully anyway.
03633  */
03634 int server_started = 0;
03635
03636 int
03637 get_responses_and_close ()
03638 {
03639     int errs = get_server_responses ();
03640     int status;
03641
03642     if (last_entries != NULL)
03643     {
03644     Entries_Close (last_entries);
03645     last_entries = NULL;
03646     }
03647
03648     do_deferred_progs ();
03649
03650     if (client_prune_dirs)
03651     process_prune_candidates ();
03652
03653     /* The calls to buf_shutdown are currently only meaningful when we
03654        are using compression.  First we shut down TO_SERVER.  That
03655        tells the server that its input is finished.  It then shuts
03656        down the buffer it is sending to us, at which point our shut
03657        down of FROM_SERVER will complete.  */
03658
03659     status = buf_shutdown (to_server);
03660     if (status != 0)
03661         error (0, status, "shutting down buffer to server");
03662     status = buf_shutdown (from_server);
03663     if (status != 0)
03664     error (0, status, "shutting down buffer from server");
03665
03666 #ifdef NO_SOCKET_TO_FD
03667     if (use_socket_style)
03668     {
03669     if (shutdown (server_sock, 2) < 0)
03670         error (1, 0, "shutting down server socket: %s", SOCK_STRERROR (SOCK_ERRNO));
03671     }
03672     else
03673 #endif /* NO_SOCKET_TO_FD */
03674     {
03675 #if defined(HAVE_KERBEROS) || defined(AUTH_CLIENT_SUPPORT)
03676     if (server_fd != -1)
03677     {
03678         if (shutdown (server_fd, 1) < 0)
03679         error (1, 0, "shutting down connection to %s: %s",
03680                CVSroot_hostname, SOCK_STRERROR (SOCK_ERRNO));
03681             /*
03682              * This test will always be true because we dup the descriptor
03683              */
03684         if (fileno (from_server_fp) != fileno (to_server_fp))
03685         {
03686         if (fclose (to_server_fp) != 0)
03687             error (1, errno,
03688                "closing down connection to %s",
03689                CVSroot_hostname);
03690         }
03691     }
03692         else
03693 #endif
03694
03695 #ifdef SHUTDOWN_SERVER
03696         SHUTDOWN_SERVER (fileno (to_server_fp));
03697 #else /* ! SHUTDOWN_SERVER */
03698     {
03699
03700 #ifdef START_RSH_WITH_POPEN_RW
03701         if (pclose (to_server_fp) == EOF)
03702 #else /* ! START_RSH_WITH_POPEN_RW */
03703         if (fclose (to_server_fp) == EOF)
03704 #endif /* START_RSH_WITH_POPEN_RW */
03705         {
03706             error (1, errno, "closing connection to %s",
03707                CVSroot_hostname);
03708         }
03709         }
03710
03711     if (! buf_empty_p (from_server)
03712         || getc (from_server_fp) != EOF)
03713         error (0, 0, "dying gasps from %s unexpected", CVSroot_hostname);
03714     else if (ferror (from_server_fp))
03715         error (0, errno, "reading from %s", CVSroot_hostname);
03716
03717     fclose (from_server_fp);
03718 #endif /* SHUTDOWN_SERVER */
03719     }
03720
03721     if (rsh_pid != -1
03722     && waitpid (rsh_pid, (int *) 0, 0) == -1)
03723     error (1, errno, "waiting for process %d", rsh_pid);
03724
03725     buf_free (to_server);
03726     buf_free (from_server);
03727     server_started = 0;
03728
03729     /* see if we need to sleep before returning to avoid time-stamp races */
03730     if (last_register_time)
03731     {
03732     while (time ((time_t *) NULL) == last_register_time)
03733         sleep (1);
03734     }
03735
03736     return errs;
03737 }
03738
03739 #ifndef NO_EXT_METHOD
03740 static void start_rsh_server PROTO((int *, int *));
03741 #endif
03742
03743 int
03744 supported_request (name)
03745     char *name;
03746 {
03747     struct request *rq;
03748
03749     for (rq = requests; rq->name; rq++)
03750     if (!strcmp (rq->name, name))
03751         return (rq->flags & RQ_SUPPORTED) != 0;
03752     error (1, 0, "internal error: testing support for unknown option?");
03753     /* NOTREACHED */
03754     return 0;
03755 }
03756
03757
03758 #if defined (AUTH_CLIENT_SUPPORT) || defined (HAVE_KERBEROS)
03759 static struct hostent *init_sockaddr PROTO ((struct sockaddr_in *, char *,
03760                          unsigned int));
03761
03762 static struct hostent *
03763 init_sockaddr (name, hostname, port)
03764     struct sockaddr_in *name;
03765     char *hostname;
03766     unsigned int port;
03767 {
03768     struct hostent *hostinfo;
03769     unsigned short shortport = port;
03770
03771     memset (name, 0, sizeof (*name));
03772     name->sin_family = AF_INET;
03773     name->sin_port = htons (shortport);
03774     hostinfo = gethostbyname (hostname);
03775     if (hostinfo == NULL)
03776     {
03777     fprintf (stderr, "Unknown host %s.\n", hostname);
03778     error_exit ();
03779     }
03780     name->sin_addr = *(struct in_addr *) hostinfo->h_addr;
03781     return hostinfo;
03782 }
03783
03784 #endif /* defined (AUTH_CLIENT_SUPPORT) || defined (HAVE_KERBEROS) */
03785
03786 #ifdef AUTH_CLIENT_SUPPORT
03787
03788 static int auth_server_port_number PROTO ((void));
03789
03790 static int
03791 auth_server_port_number ()
03792 {
03793 #if defined(CVSGUI)
03794     char *portenv;
03795 #endif /* CVSGUI */
03796     struct servent *s;
03797
03798     /* If the user explicitly specified a port use that one.  */
03799     if (CVSroot_port != 0)
03800        return CVSroot_port;
03801
03802     s = getservbyname ("cvspserver", "tcp");
03803
03804 #if defined(CVSGUI)
03805     portenv = getenv("CVS_PSERVER_PORT");
03806     if (portenv)
03807         return atoi(portenv);
03808 #endif /* CVSGUI */
03809
03810     if (s)
03811     return ntohs (s->s_port);
03812     else
03813     return CVS_AUTH_PORT;
03814 }
03815
03816
03817 /* Read a line from socket SOCK.  Result does not include the
03818    terminating linefeed.  This is only used by the authentication
03819    protocol, which we call before we set up all the buffering stuff.
03820    It is possible it should use the buffers too, which would be faster
03821    (unlike the server, there isn't really a security issue in terms of
03822    separating authentication from the rest of the code).
03823
03824    Space for the result is malloc'd and should be freed by the caller.
03825
03826    Returns number of bytes read.  */
03827 static int
03828 recv_line (sock, resultp)
03829     int sock;
03830     char **resultp;
03831 {
03832     char *result;
03833     size_t input_index = 0;
03834     size_t result_size = 80;
03835
03836     result = (char *) xmalloc (result_size);
03837
03838     while (1)
03839     {
03840     char ch;
03841     int n;
03842     n = recv (sock, &ch, 1, 0);
03843     if (n <= 0)
03844         error (1, 0, "recv() from server %s: %s", CVSroot_hostname,
03845            n == 0 ? "EOF" : SOCK_STRERROR (SOCK_ERRNO));
03846
03847     if (ch == '\012')
03848         break;
03849
03850     result[input_index++] = ch;
03851     while (input_index + 1 >= result_size)
03852     {
03853         result_size *= 2;
03854         result = (char *) xrealloc (result, result_size);
03855     }
03856     }
03857
03858     if (resultp)
03859     *resultp = result;
03860
03861     /* Terminate it just for kicks, but we *can* deal with embedded NULs.  */
03862     result[input_index] = '\0';
03863
03864     if (resultp == NULL)
03865     free (result);
03866     return input_index;
03867 }
03868
03869 /* Connect to a forked server process. */
03870
03871 void
03872 connect_to_forked_server (tofdp, fromfdp)
03873      int *tofdp, *fromfdp;
03874 {
03875     /* This is pretty simple.  All we need to do is choose the correct
03876        cvs binary and call piped_child. */
03877
03878     char *command[3];
03879
03880     command[0] = getenv ("CVS_SERVER");
03881     if (! command[0])
03882     command[0] = "cvs";
03883
03884     command[1] = "server";
03885     command[2] = NULL;
03886
03887     if (! piped_child (command, tofdp, fromfdp))
03888     error (1, 0, "could not fork server process");
03889 }
03890
03891 /* Connect to the authenticating server.
03892
03893    If VERIFY_ONLY is non-zero, then just verify that the password is
03894    correct and then shutdown the connection.
03895
03896    If VERIFY_ONLY is 0, then really connect to the server.
03897
03898    If DO_GSSAPI is non-zero, then we use GSSAPI authentication rather
03899    than the pserver password authentication.
03900
03901    If we fail to connect or if access is denied, then die with fatal
03902    error.  */
03903 void
03904 connect_to_pserver (tofdp, fromfdp, verify_only, do_gssapi)
03905      int *tofdp, *fromfdp;
03906      int verify_only;
03907      int do_gssapi;
03908 {
03909     int sock;
03910 #ifndef NO_SOCKET_TO_FD
03911     int tofd, fromfd;
03912 #endif
03913     int port_number;
03914     struct sockaddr_in client_sai;
03915     struct hostent *hostinfo;
03916     char no_passwd = 0;   /* gets set if no password found */
03917
03918     sock = socket (AF_INET, SOCK_STREAM, 0);
03919     if (sock == -1)
03920     {
03921     error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO));
03922     }
03923     port_number = auth_server_port_number ();
03924     /* if we have a proxy connect to that instead */
03925     if (CVSroot_proxy)
03926     {
03927        hostinfo = init_sockaddr (&client_sai, CVSroot_proxy, CVSroot_proxy_port);
03928     }
03929     else
03930     {
03931        hostinfo = init_sockaddr (&client_sai, CVSroot_hostname, port_number);
03932     }
03933
03934     if (connect (sock, (struct sockaddr *) &client_sai, sizeof (client_sai))
03935     < 0)
03936        error (1, 0, "connect to %s:%d failed: %s",
03937               CVSroot_proxy ? CVSroot_proxy :CVSroot_hostname,
03938               CVSroot_proxy ? CVSroot_proxy_port : port_number,
03939               SOCK_STRERROR (SOCK_ERRNO));
03940
03941     /* if we have proxy then connect to the proxy first */
03942     if (CVSroot_proxy)
03943     {
03944 #define CONNECT_STRING "CONNECT %s:%d HTTP/1.0\r\n\r\n"
03945        /* Send a "CONNECT" command to proxy: */
03946        char* read_buf;
03947        int codenum, count;
03948        /* 4 characters for port covered by the length of %s & %d */
03949        char* write_buf = xmalloc (strlen (CONNECT_STRING)
03950                                   + strlen (CVSroot_hostname) + 1);
03951        sprintf (write_buf, CONNECT_STRING,
03952                 CVSroot_hostname, port_number);
03953        send (sock, write_buf, strlen (write_buf), 0);
03954
03955        /* Wait for HTTP status code, bail out if you don't get back a 2xx code.*/
03956        count = recv_line (sock, &read_buf);
03957        sscanf (read_buf, "%s %d", write_buf, &codenum);
03958
03959        if ((codenum / 100) != 2)
03960            error (1, 0, "proxy server %s:%d does not support http tunnelling",
03961                   CVSroot_proxy, CVSroot_proxy_port);
03962        free (read_buf);
03963        free (write_buf);
03964
03965        /* Skip through remaining part of MIME header, recv_line
03966            consumes the trailing \n */
03967        while(recv_line (sock, &read_buf) > 0)
03968        {
03969            if (read_buf[0] == '\r' || read_buf[0] == 0)
03970            {
03971                free (read_buf);
03972                break;
03973            }
03974            free (read_buf);
03975        }
03976     }
03977
03978
03979     /* Run the authorization mini-protocol before anything else. */
03980     if (do_gssapi)
03981     {
03982 #ifdef HAVE_GSSAPI
03983     if (! connect_to_gserver (sock, hostinfo))
03984         goto rejected;
03985 #else
03986     error (1, 0, "This client does not support GSSAPI authentication");
03987 #endif
03988     }
03989     else
03990     {
03991     char *begin      = NULL;
03992     char *repository = CVSroot_directory;
03993     char *username   = CVSroot_username;
03994     char *password   = NULL;
03995     char *end        = NULL;
03996
03997     if (verify_only)
03998     {
03999         begin = "BEGIN VERIFICATION REQUEST\012";
04000         end   = "END VERIFICATION REQUEST\012";
04001     }
04002     else
04003     {
04004         begin = "BEGIN AUTH REQUEST\012";
04005         end   = "END AUTH REQUEST\012";
04006     }
04007
04008     /* Get the password, probably from ~/.cvspass. */
04009     password = get_cvs_password ();
04010
04011         /* Send the empty string by default.  This is so anonymous CVS
04012            access doesn't require client to have done "cvs login". */
04013         if (password == NULL)
04014         {
04015             no_passwd = 1;
04016             password = scramble ("");
04017         }
04018
04019     /* Announce that we're starting the authorization protocol. */
04020     if (send (sock, begin, strlen (begin), 0) < 0)
04021         error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
04022
04023     /* Send the data the server needs. */
04024     if (send (sock, repository, strlen (repository), 0) < 0)
04025         error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
04026     if (send (sock, "\012", 1, 0) < 0)
04027         error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
04028     if (send (sock, username, strlen (username), 0) < 0)
04029         error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
04030     if (send (sock, "\012", 1, 0) < 0)
04031         error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
04032     if (send (sock, password, strlen (password), 0) < 0)
04033         error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
04034     if (send (sock, "\012", 1, 0) < 0)
04035         error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
04036
04037     /* Announce that we're ending the authorization protocol. */
04038     if (send (sock, end, strlen (end), 0) < 0)
04039         error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
04040
04041         /* Paranoia. */
04042         memset (password, 0, strlen (password));
04043     }
04044
04045     {
04046     char *read_buf;
04047
04048     /* Loop, getting responses from the server.  */
04049     while (1)
04050     {
04051         recv_line (sock, &read_buf);
04052
04053         if (strcmp (read_buf, "I HATE YOU") == 0)
04054         {
04055         /* Authorization not granted. */
04056         goto rejected;
04057         }
04058         else if (strncmp (read_buf, "E ", 2) == 0)
04059         {
04060         fprintf (stderr, "%s\n", read_buf + 2);
04061
04062         /* Continue with the authentication protocol.  */
04063         }
04064         else if (strncmp (read_buf, "error ", 6) == 0)
04065         {
04066         char *p;
04067
04068         /* First skip the code.  */
04069         p = read_buf + 6;
04070         while (*p != ' ' && *p != '\0')
04071             ++p;
04072
04073         /* Skip the space that follows the code.  */
04074         if (*p == ' ')
04075             ++p;
04076
04077         /* Now output the text.  */
04078         fprintf (stderr, "%s\n", p);
04079         goto rejected;
04080         }
04081         else if (strcmp (read_buf, "I LOVE YOU") == 0)
04082         {
04083         free (read_buf);
04084         break;
04085         }
04086         else
04087         {
04088         /* Unrecognized response from server. */
04089         if (shutdown (sock, 2) < 0)
04090         {
04091             error (0, 0,
04092                "unrecognized auth response from %s: %s",
04093                CVSroot_hostname, read_buf);
04094             error (1, 0,
04095                "shutdown() failed, server %s: %s",
04096                CVSroot_hostname,
04097                SOCK_STRERROR (SOCK_ERRNO));
04098         }
04099         error (1, 0,
04100                "unrecognized auth response from %s: %s",
04101                CVSroot_hostname, read_buf);
04102         }
04103         free (read_buf);
04104     }
04105     }
04106
04107     if (verify_only)
04108     {
04109     if (shutdown (sock, 2) < 0)
04110         error (0, 0, "shutdown() failed, server %s: %s", CVSroot_hostname,
04111            SOCK_STRERROR (SOCK_ERRNO));
04112     return;
04113     }
04114     else
04115     {
04116 #ifdef NO_SOCKET_TO_FD
04117     use_socket_style = 1;
04118     server_sock = sock;
04119     /* Try to break mistaken callers: */
04120     *tofdp = 0;
04121     *fromfdp = 0;
04122 #else /* ! NO_SOCKET_TO_FD */
04123     server_fd = sock;
04124     close_on_exec (server_fd);
04125     tofd = fromfd = sock;
04126     /* Hand them back to the caller. */
04127     *tofdp   = tofd;
04128     *fromfdp = fromfd;
04129 #endif /* NO_SOCKET_TO_FD */
04130     }
04131
04132     return;
04133
04134   rejected:
04135     error (0, 0,
04136     "authorization failed: server %s rejected access to %s for user %s",
04137     CVSroot_hostname, CVSroot_directory, CVSroot_username);
04138
04139     /* Output a special error message if authentication was attempted
04140        with no password -- the user should be made aware that they may
04141        have missed a step. */
04142     if (no_passwd)
04143     {
04144         error (0, 0,
04145                "used empty password; try \"cvs login\" with a real password");
04146     }
04147
04148     if (shutdown (sock, 2) < 0)
04149     {
04150     error (0, 0,
04151            "shutdown() failed (server %s): %s",
04152            CVSroot_hostname,
04153            SOCK_STRERROR (SOCK_ERRNO));
04154     }
04155
04156     error_exit();
04157 }
04158 #endif /* AUTH_CLIENT_SUPPORT */
04159
04160
04161 #if HAVE_KERBEROS
04162
04163 /* This function has not been changed to deal with NO_SOCKET_TO_FD
04164    (i.e., systems on which sockets cannot be converted to file
04165    descriptors).  The first person to try building a kerberos client
04166    on such a system (OS/2, Windows 95, and maybe others) will have to
04167    make take care of this.  */
04168 void
04169 start_tcp_server (tofdp, fromfdp)
04170     int *tofdp, *fromfdp;
04171 {
04172     int s;
04173     const char *portenv;
04174     int port;
04175     struct hostent *hp;
04176     struct sockaddr_in sin;
04177     char *hname;
04178
04179     s = socket (AF_INET, SOCK_STREAM, 0);
04180     if (s < 0)
04181     error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO));
04182
04183     /* Get CVS_CLIENT_PORT or look up cvs/tcp with CVS_PORT as default */
04184     portenv = getenv ("CVS_CLIENT_PORT");
04185     if (portenv != NULL)
04186     {
04187     port = atoi (portenv);
04188     if (port <= 0)
04189     {
04190         error (0, 0, "CVS_CLIENT_PORT must be a positive number!  If you");
04191         error (0, 0, "are trying to force a connection via rsh, please");
04192         error (0, 0, "put \":server:\" at the beginning of your CVSROOT");
04193         error (1, 0, "variable.");
04194     }
04195     if (trace)
04196         fprintf(stderr, "Using TCP port %d to contact server.\n", port);
04197     }
04198     else
04199     {
04200     struct servent *sp;
04201
04202     sp = getservbyname ("cvs", "tcp");
04203     if (sp == NULL)
04204         port = CVS_PORT;
04205     else
04206         port = ntohs (sp->s_port);
04207     }
04208
04209     hp = init_sockaddr (&sin, CVSroot_hostname, port);
04210
04211     hname = xmalloc (strlen (hp->h_name) + 1);
04212     strcpy (hname, hp->h_name);
04213
04214     if (connect (s, (struct sockaddr *) &sin, sizeof sin) < 0)
04215     error (1, 0, "connect to %s:%d failed: %s", CVSroot_hostname,
04216            port, SOCK_STRERROR (SOCK_ERRNO));
04217
04218 #ifdef HAVE_KERBEROS
04219     {
04220     char *realm;
04221     struct sockaddr_in laddr;
04222     int laddrlen;
04223     KTEXT_ST ticket;
04224     MSG_DAT msg_data;
04225     CREDENTIALS cred;
04226     int status;
04227
04228     realm = krb_realmofhost (hname);
04229
04230     laddrlen = sizeof (laddr);
04231     if (getsockname (s, (struct sockaddr *) &laddr, &laddrlen) < 0)
04232         error (1, 0, "getsockname failed: %s", SOCK_STRERROR (SOCK_ERRNO));
04233
04234     /* We don't care about the checksum, and pass it as zero.  */
04235     status = krb_sendauth (KOPT_DO_MUTUAL, s, &ticket, "rcmd",
04236                    hname, realm, (unsigned long) 0, &msg_data,
04237                    &cred, sched, &laddr, &sin, "KCVSV1.0");
04238     if (status != KSUCCESS)
04239         error (1, 0, "kerberos authentication failed: %s",
04240            krb_get_err_text (status));
04241     memcpy (kblock, cred.session, sizeof (C_Block));
04242     }
04243 #endif /* HAVE_KERBEROS */
04244
04245     server_fd = s;
04246     close_on_exec (server_fd);
04247
04248     free (hname);
04249
04250     /* Give caller the values it wants. */
04251     *tofdp   = s;
04252     *fromfdp = s;
04253 }
04254
04255 #endif /* HAVE_KERBEROS */
04256
04257 #ifdef HAVE_GSSAPI
04258
04259 /* Receive a given number of bytes.  */
04260
04261 static void
04262 recv_bytes (sock, buf, need)
04263      int sock;
04264      char *buf;
04265      int need;
04266 {
04267     while (need > 0)
04268     {
04269     int got;
04270
04271     got = recv (sock, buf, need, 0);
04272     if (got < 0)
04273         error (1, 0, "recv() from server %s: %s", CVSroot_hostname,
04274            SOCK_STRERROR (SOCK_ERRNO));
04275     buf += got;
04276     need -= got;
04277     }
04278 }
04279
04280 /* Connect to the server using GSSAPI authentication.  */
04281
04282 static int
04283 connect_to_gserver (sock, hostinfo)
04284      int sock;
04285      struct hostent *hostinfo;
04286 {
04287     char *str;
04288     char buf[1024];
04289     gss_buffer_desc *tok_in_ptr, tok_in, tok_out;
04290     OM_uint32 stat_min, stat_maj;
04291     gss_name_t server_name;
04292
04293     str = "BEGIN GSSAPI REQUEST\012";
04294
04295     if (send (sock, str, strlen (str), 0) < 0)
04296     error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
04297
04298     sprintf (buf, "cvs@%s", hostinfo->h_name);
04299     tok_in.length = strlen (buf);
04300     tok_in.value = buf;
04301     gss_import_name (&stat_min, &tok_in, GSS_C_NT_HOSTBASED_SERVICE,
04302              &server_name);
04303
04304     tok_in_ptr = GSS_C_NO_BUFFER;
04305     gcontext = GSS_C_NO_CONTEXT;
04306
04307     do
04308     {
04309     stat_maj = gss_init_sec_context (&stat_min, GSS_C_NO_CREDENTIAL,
04310                      &gcontext, server_name,
04311                      GSS_C_NULL_OID,
04312                      (GSS_C_MUTUAL_FLAG
04313                       | GSS_C_REPLAY_FLAG),
04314                      0, NULL, tok_in_ptr, NULL, &tok_out,
04315                      NULL, NULL);
04316     if (stat_maj != GSS_S_COMPLETE && stat_maj != GSS_S_CONTINUE_NEEDED)
04317     {
04318         OM_uint32 message_context;
04319         OM_uint32 new_stat_min;
04320
04321         message_context = 0;
04322         gss_display_status (&new_stat_min, stat_maj, GSS_C_GSS_CODE,
04323                                 GSS_C_NULL_OID, &message_context, &tok_out);
04324         error (0, 0, "GSSAPI authentication failed: %s",
04325            (char *) tok_out.value);
04326
04327         message_context = 0;
04328         gss_display_status (&new_stat_min, stat_min, GSS_C_MECH_CODE,
04329                 GSS_C_NULL_OID, &message_context, &tok_out);
04330         error (1, 0, "GSSAPI authentication failed: %s",
04331            (char *) tok_out.value);
04332     }
04333
04334     if (tok_out.length == 0)
04335     {
04336         tok_in.length = 0;
04337     }
04338     else
04339     {
04340         char cbuf[2];
04341         int need;
04342
04343         cbuf[0] = (tok_out.length >> 8) & 0xff;
04344         cbuf[1] = tok_out.length & 0xff;
04345         if (send (sock, cbuf, 2, 0) < 0)
04346         error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
04347         if (send (sock, tok_out.value, tok_out.length, 0) < 0)
04348         error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
04349
04350         recv_bytes (sock, cbuf, 2);
04351         need = ((cbuf[0] & 0xff) << 8) | (cbuf[1] & 0xff);
04352
04353         if (need > sizeof buf)
04354         {
04355         int got;
04356
04357         /* This usually means that the server sent us an error
04358            message.  Read it byte by byte and print it out.
04359            FIXME: This is a terrible error handling strategy.
04360            However, even if we fix the server, we will still
04361            want to do this to work with older servers.  */
04362         buf[0] = cbuf[0];
04363         buf[1] = cbuf[1];
04364         got = recv (sock, buf + 2, sizeof buf - 2, 0);
04365         if (got < 0)
04366             error (1, 0, "recv() from server %s: %s",
04367                CVSroot_hostname, SOCK_STRERROR (SOCK_ERRNO));
04368         buf[got + 2] = '\0';
04369         if (buf[got + 1] == '\n')
04370             buf[got + 1] = '\0';
04371         error (1, 0, "error from server %s: %s", CVSroot_hostname,
04372                buf);
04373         }
04374
04375         recv_bytes (sock, buf, need);
04376         tok_in.length = need;
04377     }
04378
04379     tok_in.value = buf;
04380     tok_in_ptr = &tok_in;
04381     }
04382     while (stat_maj == GSS_S_CONTINUE_NEEDED);
04383
04384     return 1;
04385 }
04386
04387 #endif /* HAVE_GSSAPI */
04388
04389 static int send_variable_proc PROTO ((Node *, void *));
04390
04391 static int
04392 send_variable_proc (node, closure)
04393     Node *node;
04394     void *closure;
04395 {
04396     send_to_server ("Set ", 0);
04397     send_to_server (node->key, 0);
04398     send_to_server ("=", 1);
04399     send_to_server (node->data, 0);
04400     send_to_server ("\012", 1);
04401     return 0;
04402 }
04403
04404 /* Contact the server.  */
04405 void
04406 start_server ()
04407 {
04408     int tofd, fromfd, rootless;
04409     char *log = getenv ("CVS_CLIENT_LOG");
04410
04411
04412     /* Clear our static variables for this invocation. */
04413     if (toplevel_repos != NULL)
04414     free (toplevel_repos);
04415     toplevel_repos = NULL;
04416
04417
04418     /* Note that generally speaking we do *not* fall back to a different
04419        way of connecting if the first one does not work.  This is slow
04420        (*really* slow on a 14.4kbps link); the clean way to have a CVS
04421        which supports several ways of connecting is with access methods.  */
04422
04423     switch (CVSroot_method)
04424     {
04425
04426 #ifdef AUTH_CLIENT_SUPPORT
04427     case pserver_method:
04428         /* Toss the return value.  It will die with error if anything
04429            goes wrong anyway. */
04430         connect_to_pserver (&tofd, &fromfd, 0, 0);
04431         break;
04432 #endif
04433
04434 #if HAVE_KERBEROS
04435     case kserver_method:
04436         start_tcp_server (&tofd, &fromfd);
04437         break;
04438 #endif
04439
04440 #if HAVE_GSSAPI
04441     case gserver_method:
04442         /* GSSAPI authentication is handled by the pserver.  */
04443         connect_to_pserver (&tofd, &fromfd, 0, 1);
04444         break;
04445 #endif
04446
04447     case ext_method:
04448 #if defined (NO_EXT_METHOD)
04449         error (0, 0, ":ext: method not supported by this port of CVS");
04450         error (1, 0, "try :server: instead");
04451 #elif !defined(macintosh)
04452         start_rsh_server (&tofd, &fromfd);
04453 #else
04454         start_lsh_server (&tofd, &fromfd);
04455 #endif
04456         break;
04457
04458     case server_method:
04459 #if defined(START_SERVER)
04460         START_SERVER (&tofd, &fromfd, getcaller (),
04461               CVSroot_username, CVSroot_hostname,
04462               CVSroot_directory);
04463 #  if defined (START_SERVER_RETURNS_SOCKET) && defined (NO_SOCKET_TO_FD)
04464         /* This is a system on which we can only write to a socket
04465            using send/recv.  Therefore its START_SERVER needs to
04466            return a socket.  */
04467         use_socket_style = 1;
04468         server_sock = tofd;
04469 #  endif
04470
04471 #else
04472         /* FIXME: It should be possible to implement this portably,
04473            like pserver, which would get rid of the duplicated code
04474            in {vms,windows-NT,...}/startserver.c.  */
04475         error (1, 0, "\
04476 the :server: access method is not supported by this port of CVS");
04477 #endif
04478         break;
04479
04480         case fork_method:
04481         connect_to_forked_server (&tofd, &fromfd);
04482         break;
04483
04484     default:
04485         error (1, 0, "\
04486 (start_server internal error): unknown access method");
04487         break;
04488     }
04489
04490     /* "Hi, I'm Darlene and I'll be your server tonight..." */
04491     server_started = 1;
04492
04493 #ifdef NO_SOCKET_TO_FD
04494     if (use_socket_style)
04495     {
04496     to_server = socket_buffer_initialize (server_sock, 0,
04497                           (BUFMEMERRPROC) NULL);
04498     from_server = socket_buffer_initialize (server_sock, 1,
04499                         (BUFMEMERRPROC) NULL);
04500     }
04501     else
04502 #endif /* NO_SOCKET_TO_FD */
04503     {
04504         /* todo: some OS's don't need these calls... */
04505         close_on_exec (tofd);
04506         close_on_exec (fromfd);
04507
04508 /* this is not valid (nor useful) for macintosh, because of the line before.
04509 Or we should add a close_on_exec (fromfd) after (CVSGUI) */
04510 #ifndef macintosh
04511     /* SCO 3 and AIX have a nasty bug in the I/O libraries which precludes
04512        fdopening the same file descriptor twice, so dup it if it is the
04513        same.  */
04514     if (tofd == fromfd)
04515     {
04516         fromfd = dup (tofd);
04517         if (fromfd < 0)
04518         error (1, errno, "cannot dup net connection");
04519     }
04520 #endif
04521
04522         /* These will use binary mode on systems which have it.  */
04523         to_server_fp = fdopen (tofd, FOPEN_BINARY_WRITE);
04524         if (to_server_fp == NULL)
04525         error (1, errno, "cannot fdopen %d for write", tofd);
04526     to_server = stdio_buffer_initialize (to_server_fp, 0,
04527                          (BUFMEMERRPROC) NULL);
04528
04529         from_server_fp = fdopen (fromfd, FOPEN_BINARY_READ);
04530         if (from_server_fp == NULL)
04531         error (1, errno, "cannot fdopen %d for read", fromfd);
04532     from_server = stdio_buffer_initialize (from_server_fp, 1,
04533                            (BUFMEMERRPROC) NULL);
04534     }
04535
04536     /* Set up logfiles, if any. */
04537     if (log)
04538     {
04539     int len = strlen (log);
04540     char *buf = xmalloc (len + 5);
04541     char *p;
04542     FILE *fp;
04543
04544     strcpy (buf, log);
04545     p = buf + len;
04546
04547     /* Open logfiles in binary mode so that they reflect
04548        exactly what was transmitted and received (that is
04549        more important than that they be maximally
04550        convenient to view).  */
04551     /* Note that if we create several connections in a single CVS client
04552        (currently used by update.c), then the last set of logfiles will
04553        overwrite the others.  There is currently no way around this.  */
04554     strcpy (p, ".in");
04555     fp = open_file (buf, "wb");
04556         if (fp == NULL)
04557         error (0, errno, "opening to-server logfile %s", buf);
04558     else
04559         to_server = log_buffer_initialize (to_server, fp, 0,
04560                            (BUFMEMERRPROC) NULL);
04561
04562     strcpy (p, ".out");
04563     fp = open_file (buf, "wb");
04564         if (fp == NULL)
04565         error (0, errno, "opening from-server logfile %s", buf);
04566     else
04567         from_server = log_buffer_initialize (from_server, fp, 1,
04568                          (BUFMEMERRPROC) NULL);
04569
04570     free (buf);
04571     }
04572
04573     /* Clear static variables.  */
04574     if (toplevel_repos != NULL)
04575     free (toplevel_repos);
04576     toplevel_repos = NULL;
04577     if (last_dir_name != NULL)
04578     free (last_dir_name);
04579     last_dir_name = NULL;
04580     if (last_repos != NULL)
04581     free (last_repos);
04582     last_repos = NULL;
04583     if (last_update_dir != NULL)
04584     free (last_update_dir);
04585     last_update_dir = NULL;
04586     stored_checksum_valid = 0;
04587     if (stored_mode != NULL)
04588     {
04589     free (stored_mode);
04590     stored_mode = NULL;
04591     }
04592
04593     rootless = (strcmp (command_name, "init") == 0);
04594     if (!rootless)
04595     {
04596     send_to_server ("Root ", 0);
04597     send_to_server (CVSroot_directory, 0);
04598     send_to_server ("\012", 1);
04599     }
04600
04601     {
04602     struct response *rs;
04603
04604     send_to_server ("Valid-responses", 0);
04605
04606     for (rs = responses; rs->name != NULL; ++rs)
04607     {
04608         send_to_server (" ", 0);
04609         send_to_server (rs->name, 0);
04610     }
04611     send_to_server ("\012", 1);
04612     }
04613     send_to_server ("valid-requests\012", 0);
04614
04615     if (get_server_responses ())
04616     error_exit ();
04617
04618     /*
04619      * Now handle global options.
04620      *
04621      * -H, -f, -d, -e should be handled OK locally.
04622      *
04623      * -b we ignore (treating it as a server installation issue).
04624      * FIXME: should be an error message.
04625      *
04626      * -v we print local version info; FIXME: Add a protocol request to get
04627      * the version from the server so we can print that too.
04628      *
04629      * -l -t -r -w -q -n and -Q need to go to the server.
04630      */
04631
04632     {
04633     int have_global = supported_request ("Global_option");
04634
04635     if (noexec)
04636     {
04637         if (have_global)
04638         {
04639         send_to_server ("Global_option -n\012", 0);
04640         }
04641         else
04642         error (1, 0,
04643                "This server does not support the global -n option.");
04644     }
04645     if (quiet)
04646     {
04647         if (have_global)
04648         {
04649         send_to_server ("Global_option -q\012", 0);
04650         }
04651         else
04652         error (1, 0,
04653                "This server does not support the global -q option.");
04654     }
04655     if (really_quiet)
04656     {
04657         if (have_global)
04658         {
04659         send_to_server ("Global_option -Q\012", 0);
04660         }
04661         else
04662         error (1, 0,
04663                "This server does not support the global -Q option.");
04664     }
04665     if (!cvswrite)
04666     {
04667         if (have_global)
04668         {
04669         send_to_server ("Global_option -r\012", 0);
04670         }
04671         else
04672         error (1, 0,
04673                "This server does not support the global -r option.");
04674     }
04675     if (trace)
04676     {
04677         if (have_global)
04678         {
04679         send_to_server ("Global_option -t\012", 0);
04680         }
04681         else
04682         error (1, 0,
04683                "This server does not support the global -t option.");
04684     }
04685     if (logoff)
04686     {
04687         if (have_global)
04688         {
04689         send_to_server ("Global_option -l\012", 0);
04690         }
04691         else
04692         error (1, 0,
04693                "This server does not support the global -l option.");
04694     }
04695     }
04696
04697     /* Find out about server-side cvswrappers.  An extra network
04698        turnaround for cvs import seems to be unavoidable, unless we
04699        want to add some kind of client-side place to configure which
04700        filenames imply binary.  For cvs add, we could avoid the
04701        problem by keeping a copy of the wrappers in CVSADM (the main
04702        reason to bother would be so we could make add work without
04703        contacting the server, I suspect).  */
04704
04705     if ((strcmp (command_name, "import") == 0)
04706         || (strcmp (command_name, "add") == 0))
04707     {
04708     if (supported_request ("wrapper-sendme-rcsOptions"))
04709     {
04710         int err;
04711         send_to_server ("wrapper-sendme-rcsOptions\012", 0);
04712         err = get_server_responses ();
04713         if (err != 0)
04714         error (err, 0, "error reading from server");
04715     }
04716     }
04717
04718     if (cvsencrypt && !rootless)
04719     {
04720 #ifdef ENCRYPTION
04721     /* Turn on encryption before turning on compression.  We do
04722            not want to try to compress the encrypted stream.  Instead,
04723            we want to encrypt the compressed stream.  If we can't turn
04724            on encryption, bomb out; don't let the user think the data
04725            is being encrypted when it is not.  */
04726 #ifdef HAVE_KERBEROS
04727     if (CVSroot_method == kserver_method)
04728     {
04729         if (! supported_request ("Kerberos-encrypt"))
04730         error (1, 0, "This server does not support encryption");
04731         send_to_server ("Kerberos-encrypt\012", 0);
04732         to_server = krb_encrypt_buffer_initialize (to_server, 0, sched,
04733                                kblock,
04734                                (BUFMEMERRPROC) NULL);
04735         from_server = krb_encrypt_buffer_initialize (from_server, 1,
04736                              sched, kblock,
04737                              (BUFMEMERRPROC) NULL);
04738     }
04739     else
04740 #endif /* HAVE_KERBEROS */
04741 #ifdef HAVE_GSSAPI
04742     if (CVSroot_method == gserver_method)
04743     {
04744         if (! supported_request ("Gssapi-encrypt"))
04745         error (1, 0, "This server does not support encryption");
04746         send_to_server ("Gssapi-encrypt\012", 0);
04747         to_server = cvs_gssapi_wrap_buffer_initialize (to_server, 0,
04748                                gcontext,
04749                                ((BUFMEMERRPROC)
04750                                 NULL));
04751         from_server = cvs_gssapi_wrap_buffer_initialize (from_server, 1,
04752                                  gcontext,
04753                                  ((BUFMEMERRPROC)
04754                                   NULL));
04755         cvs_gssapi_encrypt = 1;
04756     }
04757     else
04758 #endif /* HAVE_GSSAPI */
04759         error (1, 0, "Encryption is only supported when using GSSAPI or Kerberos");
04760 #else /* ! ENCRYPTION */
04761     error (1, 0, "This client does not support encryption");
04762 #endif /* ! ENCRYPTION */
04763     }
04764
04765     if (gzip_level && !rootless)
04766     {
04767     if (supported_request ("Gzip-stream"))
04768     {
04769         char gzip_level_buf[5];
04770         send_to_server ("Gzip-stream ", 0);
04771         sprintf (gzip_level_buf, "%d", gzip_level);
04772         send_to_server (gzip_level_buf, 0);
04773         send_to_server ("\012", 1);
04774
04775         /* All further communication with the server will be
04776                compressed.  */
04777
04778         to_server = compress_buffer_initialize (to_server, 0, gzip_level,
04779                             (BUFMEMERRPROC) NULL);
04780         from_server = compress_buffer_initialize (from_server, 1,
04781                               gzip_level,
04782                               (BUFMEMERRPROC) NULL);
04783     }
04784 #ifndef NO_CLIENT_GZIP_PROCESS
04785     else if (supported_request ("gzip-file-contents"))
04786     {
04787             char gzip_level_buf[5];
04788         send_to_server ("gzip-file-contents ", 0);
04789             sprintf (gzip_level_buf, "%d", gzip_level);
04790         send_to_server (gzip_level_buf, 0);
04791
04792         send_to_server ("\012", 1);
04793
04794         file_gzip_level = gzip_level;
04795     }
04796 #endif
04797     else
04798     {
04799         fprintf (stderr, "server doesn't support gzip-file-contents\n");
04800         /* Setting gzip_level to 0 prevents us from giving the
04801                error twice if update has to contact the server again
04802                to fetch unpatchable files.  */
04803         gzip_level = 0;
04804     }
04805     }
04806
04807     if (cvsauthenticate && ! cvsencrypt && !rootless)
04808     {
04809     /* Turn on authentication after turning on compression, so
04810        that we can compress the authentication information.  We
04811        assume that encrypted data is always authenticated--the
04812        ability to decrypt the data stream is itself a form of
04813        authentication.  */
04814 #ifdef HAVE_GSSAPI
04815     if (CVSroot_method == gserver_method)
04816     {
04817         if (! supported_request ("Gssapi-authenticate"))
04818         error (1, 0,
04819                "This server does not support stream authentication");
04820         send_to_server ("Gssapi-authenticate\012", 0);
04821         to_server = cvs_gssapi_wrap_buffer_initialize (to_server, 0,
04822                                gcontext,
04823                                ((BUFMEMERRPROC)
04824                                 NULL));
04825         from_server = cvs_gssapi_wrap_buffer_initialize (from_server, 1,
04826                                  gcontext,
04827                                  ((BUFMEMERRPROC)
04828                                   NULL));
04829     }
04830     else
04831         error (1, 0, "Stream authentication is only supported when using GSSAPI");
04832 #else /* ! HAVE_GSSAPI */
04833     error (1, 0, "This client does not support stream authentication");
04834 #endif /* ! HAVE_GSSAPI */
04835     }
04836
04837 #ifdef FILENAMES_CASE_INSENSITIVE
04838     if (supported_request ("Case") && !rootless)
04839     send_to_server ("Case\012", 0);
04840 #endif
04841
04842     /* If "Set" is not supported, just silently fail to send the variables.
04843        Users with an old server should get a useful error message when it
04844        fails to recognize the ${=foo} syntax.  This way if someone uses
04845        several servers, some of which are new and some old, they can still
04846        set user variables in their .cvsrc without trouble.  */
04847     if (supported_request ("Set"))
04848     walklist (variable_list, send_variable_proc, NULL);
04849 }
04850
04851 #ifndef NO_EXT_METHOD
04852
04853 #ifdef RSA_IDENTITY_SUPPORT
04854 #define MAX_ARGS 40
04855 #define MAX_CMD_LEN 2048
04856
04857 // from CvsGui
04858 static int StringToArgv(const char *cmdLine, char **argv)
04859 {
04860     int argc = 0;
04861
04862     char    Quote = '\0';               /*  Contains the quote character if we are
04863                                             inside "" or '', or \0 otherwise */
04864     const char* walker1 = cmdLine;      /*  walker1 traverses the original
04865                                             command line */
04866     char*   walker2;                    /*  walker2 traverses the parsed copy of
04867                                             the command line */
04868     char    theChar;                    /*  theChar is the character we are currently
04869                                             parsing */
04870     char    arguments [MAX_CMD_LEN];            /*  will contain a parsed copy of the
04871                                             command line */
04872
04873     walker2 = arguments;                                        /*  copy into arguments */
04874     while ((theChar = *walker1++) != '\0') {                    /*  parse command line to \0 */
04875         if (theChar == ' ')                                     /*  skip leading space before an argument */
04876             continue;
04877         argv [argc++] = walker2;                                /*  set argv to point to the space
04878                                                                     where we copy the next argument */
04879         if (argc > MAX_ARGS) {                                  /*  if we filled argv, skip the rest */
04880             argc--;
04881             break;
04882         }
04883         do {                                                    /*  parse an argument */
04884             if (theChar == '\\' && *walker1++)                  /*  skip \s */
04885                 theChar = *walker1++;
04886             else
04887                 if ((theChar == '"') || (theChar == '\'')) {    /*  when we find a quote... */
04888                     if (Quote == '\0') {                        /*  if we are not inside quotes already, */
04889                         Quote = theChar;                        /*  remember we are inside quotes now */
04890                         continue;                               /*  go to the next character */
04891                     }
04892                     if (theChar == Quote) {                     /*  if we are already inside that kind of quotes */
04893                         Quote = '\0';                           /*  close quotes */
04894                         continue;                               /*  go to the next character */
04895                     }
04896                 }
04897             *walker2++ = theChar;                               /*  copy the character into args */
04898                                                                 /*  repeat until we reach the end of arguments
04899                                                                     or we reach a space that is not inside quotes */
04900         } while ((*walker1 != '\0') && (((theChar = *walker1++) != ' ') || (Quote != '\0')));
04901         *walker2++ = 0;                                         /* null-terminate the last argument */
04902     }
04903
04904     return argc;
04905 }
04906 #endif
04907
04908 /* Contact the server by starting it with rsh.  */
04909
04910 /* Right now, we have two different definitions for this function,
04911    depending on whether we start the rsh server using popenRW or not.
04912    This isn't ideal, and the best thing would probably be to change
04913    the OS/2 port to be more like the regular Unix client (i.e., by
04914    implementing piped_child)... but I'm doing something else at the
04915    moment, and wish to make only one change at a time.  -Karl */
04916
04917 #ifdef START_RSH_WITH_POPEN_RW
04918
04919 /* This is actually a crock -- it's OS/2-specific, for no one else
04920    uses it.  If I get time, I want to make piped_child and all the
04921    other stuff in os2/run.c work right.  In the meantime, this gets us
04922    up and running, and that's most important. */
04923
04924 static void
04925 start_rsh_server (tofdp, fromfdp)
04926     int *tofdp, *fromfdp;
04927 {
04928     int pipes[2];
04929
04930     /* If you're working through firewalls, you can set the
04931        CVS_RSH environment variable to a script which uses rsh to
04932        invoke another rsh on a proxy machine.  */
04933     char *cvs_rsh = getenv ("CVS_RSH");
04934     char *cvs_server = getenv ("CVS_SERVER");
04935 #ifdef RSA_IDENTITY_SUPPORT
04936     char *rsa_identity_file = getenv ("CVS_RSA_IDENTITY");
04937 #endif /* RSA_IDENTITY_SUPPORT */
04938     int i = 0;
04939     /* This needs to fit "rsh", "-b", "-i", "rsa-identity-file", "-l", "USER", "host",
04940        "cmd (w/ args)", and NULL.  We leave some room to grow. */
04941     char *rsh_argv[12];
04942
04943     if (!cvs_rsh)
04944     /* People sometimes suggest or assume that this should default
04945        to "remsh" on systems like HPUX in which that is the
04946        system-supplied name for the rsh program.  However, that
04947        causes various problems (keep in mind that systems such as
04948        HPUX might have non-system-supplied versions of "rsh", like
04949        a Kerberized one, which one might want to use).  If we
04950        based the name on what is found in the PATH of the person
04951        who runs configure, that would make it harder to
04952        consistently produce the same result in the face of
04953        different people producing binary distributions.  If we
04954        based it on "remsh" always being the default for HPUX
04955        (e.g. based on uname), that might be slightly better but
04956        would require us to keep track of what the defaults are for
04957        each system type, and probably would cope poorly if the
04958        existence of remsh or rsh varies from OS version to OS
04959        version.  Therefore, it seems best to have the default
04960        remain "rsh", and tell HPUX users to specify remsh, for
04961        example in CVS_RSH or other such mechanisms to be devised,
04962        if that is what they want (the manual already tells them
04963        that).  */
04964     cvs_rsh = "rsh";
04965     if (!cvs_server)
04966     cvs_server = "cvs";
04967
04968     /* The command line starts out with rsh. */
04969     rsh_argv[i++] = cvs_rsh;
04970
04971 #ifdef RSH_NEEDS_BINARY_FLAG
04972     /* "-b" for binary, under OS/2. */
04973     rsh_argv[i++] = "-b";
04974 #endif /* RSH_NEEDS_BINARY_FLAG */
04975
04976 #ifdef RSA_IDENTITY_SUPPORT
04977     /* "-i" for RSA identity file */
04978     if( rsa_identity_file && rsa_identity_file[ 0 ] )
04979     {
04980         rsh_argv[i++] = "-i";
04981         rsh_argv[i++] = rsa_identity_file;
04982     }
04983 #endif /* RSA_IDENTITY_SUPPORT */
04984
04985     /* Then we strcat more things on the end one by one. */
04986     if (CVSroot_username != NULL)
04987     {
04988     rsh_argv[i++] = "-l";
04989     rsh_argv[i++] = CVSroot_username;
04990     }
04991
04992     rsh_argv[i++] = CVSroot_hostname;
04993     rsh_argv[i++] = cvs_server;
04994     rsh_argv[i++] = "server";
04995
04996     /* Mark the end of the arg list. */
04997     rsh_argv[i]   = (char *) NULL;
04998
04999     if (trace)
05000     {
05001     fprintf (stderr, " -> Starting server: ");
05002     putc ('\n', stderr);
05003     }
05004
05005     /* Do the deed. */
05006     rsh_pid = popenRW (rsh_argv, pipes);
05007     if (rsh_pid < 0)
05008     error (1, errno, "cannot start server via rsh");
05009
05010     /* Give caller the file descriptors. */
05011     *tofdp   = pipes[0];
05012     *fromfdp = pipes[1];
05013 }
05014
05015 #else /* ! START_RSH_WITH_POPEN_RW */
05016
05017 static void
05018 start_rsh_server (tofdp, fromfdp)
05019      int *tofdp;
05020      int *fromfdp;
05021 {
05022     /* If you're working through firewalls, you can set the
05023        CVS_RSH environment variable to a script which uses rsh to
05024        invoke another rsh on a proxy machine.  */
05025     char *cvs_rsh = getenv ("CVS_RSH");
05026     char *cvs_server = getenv ("CVS_SERVER");
05027 #ifdef RSA_IDENTITY_SUPPORT
05028     char *rsa_identity_file = getenv ("CVS_RSA_IDENTITY");
05029     char *rsa_options = getenv ("CVS_RSA_OPTIONS");
05030 #endif /* RSA_IDENTITY_SUPPORT */
05031     char *command;
05032
05033     if (!cvs_rsh)
05034     cvs_rsh = "rsh";
05035     if (!cvs_server)
05036     cvs_server = "cvs";
05037
05038     /* Pass the command to rsh as a single string.  This shouldn't
05039        affect most rsh servers at all, and will pacify some buggy
05040        versions of rsh that grab switches out of the middle of the
05041        command (they're calling the GNU getopt routines incorrectly).  */
05042     command = xmalloc (strlen (cvs_server)
05043                + strlen (CVSroot_directory)
05044                + 50);
05045
05046     /* If you are running a very old (Nov 3, 1994, before 1.5)
05047      * version of the server, you need to make sure that your .bashrc
05048      * on the server machine does not set CVSROOT to something
05049      * containing a colon (or better yet, upgrade the server).  */
05050     sprintf (command, "%s server", cvs_server);
05051
05052     {
05053         char *argv[12];
05054     char **p = argv;
05055
05056     *p++ = cvs_rsh;
05057     *p++ = CVSroot_hostname;
05058
05059 #ifdef RSA_IDENTITY_SUPPORT
05060         /* "-i" for RSA identity file */
05061         if( rsa_identity_file && rsa_identity_file[ 0 ] )
05062         {
05063             *p++ = "-i";
05064             *p++ = rsa_identity_file;
05065         }
05066         /* other RSA options */
05067         if( rsa_options && rsa_options[ 0 ] )
05068         {
05069             int argc, arg;
05070             char *argv[MAX_ARGS];
05071
05072             argc = StringToArgv(rsa_options, argv);
05073             for(arg = 0; arg < argc; arg++)
05074             {
05075                 *p++ = argv[arg];
05076             }
05077         }
05078 #endif /* RSA_IDENTITY_SUPPORT */
05079
05080     /* If the login names differ between client and server
05081      * pass it on to rsh.
05082      */
05083     if (CVSroot_username != NULL)
05084     {
05085         *p++ = "-l";
05086         *p++ = CVSroot_username;
05087     }
05088
05089     *p++ = command;
05090     *p++ = NULL;
05091
05092     if (trace)
05093         {
05094         int i;
05095
05096             fprintf (stderr, " -> Starting server: ");
05097         for (i = 0; argv[i]; i++)
05098             fprintf (stderr, "%s ", argv[i]);
05099         putc ('\n', stderr);
05100     }
05101     rsh_pid = piped_child (argv, tofdp, fromfdp);
05102
05103     if (rsh_pid < 0)
05104         error (1, errno, "cannot start server via rsh");
05105     }
05106     free (command);
05107 }
05108
05109 #endif /* START_RSH_WITH_POPEN_RW */
05110
05111 #endif /* NO_EXT_METHOD */
05112
05113
05114
05115 /* Send an argument STRING.  */
05116 void
05117 send_arg (string)
05118     char *string;
05119 {
05120     char buf[1];
05121     char *p = string;
05122
05123     send_to_server ("Argument ", 0);
05124
05125     while (*p)
05126     {
05127     if (*p == '\n')
05128     {
05129         send_to_server ("\012Argumentx ", 0);
05130     }
05131     else
05132         {
05133         buf[0] = *p;
05134         send_to_server (buf, 1);
05135         }
05136     ++p;
05137     }
05138     send_to_server ("\012", 1);
05139 }
05140
05141 static void send_modified PROTO ((char *, char *, Vers_TS *));
05142
05143 /* VERS->OPTIONS specifies whether the file is binary or not.  NOTE: BEFORE
05144    using any other fields of the struct vers, we would need to fix
05145    client_process_import_file to set them up.  */
05146
05147 static void
05148 send_modified (file, short_pathname, vers)
05149     char *file;
05150     char *short_pathname;
05151     Vers_TS *vers;
05152 {
05153     /* File was modified, send it.  */
05154     struct stat sb;
05155     int fd;
05156     char *buf;
05157     char *mode_string;
05158     size_t bufsize;
05159     int bin;
05160
05161     if (trace)
05162     (void) fprintf (stderr, " -> Sending file `%s' to server\n", file);
05163
05164     /* Don't think we can assume fstat exists.  */
05165     if ( CVS_STAT (file, &sb) < 0)
05166     error (1, errno, "reading %s", short_pathname);
05167
05168     mode_string = mode_to_string (sb.st_mode);
05169
05170     /* Beware: on systems using CRLF line termination conventions,
05171        the read and write functions will convert CRLF to LF, so the
05172        number of characters read is not the same as sb.st_size.  Text
05173        files should always be transmitted using the LF convention, so
05174        we don't want to disable this conversion.  */
05175     bufsize = sb.st_size;
05176     buf = xmalloc (bufsize);
05177
05178     /* Is the file marked as containing binary data by the "-kb" flag?
05179        If so, make sure to open it in binary mode: */
05180
05181     if (vers && vers->options)
05182       bin = !(strcmp (vers->options, "-kb"));
05183     else
05184       bin = 0;
05185
05186 #ifdef BROKEN_READWRITE_CONVERSION
05187 #   ifndef BINHEX_STUFF
05188     if (!bin)
05189 #   else
05190     if (1)
05191 #   endif
05192     {
05193     /* If only stdio, not open/write/etc., do text/binary
05194        conversion, use convert_file which can compensate
05195        (FIXME: we could just use stdio instead which would
05196        avoid the whole problem).  */
05197 #   ifndef _POSIX_NO_TRUNC
05198     char tfile[1024]; strcpy(tfile, file); strcat(tfile, ".CVSBFCTMP");
05199 #   else
05200     char tfile[1024]; sprintf (tfile, "%.9s%s", file, ".CVSBFCTMP");
05201 #   endif
05202     convert_file (file, O_RDONLY,
05203               tfile, O_WRONLY | O_CREAT | O_TRUNC | OPEN_BINARY, bin);
05204 #   ifdef BINHEX_STUFF
05205     /* encode from client format to server format in order
05206     to send to the server :
05207     at this point file has \015 inside. So
05208     we want to open TEXT and save BINARY in order to have \012
05209     inside tfile. Note that we have to re-stat since the file
05210     may be slightly different after encoding */
05211     free (buf);
05212     if ( CVS_STAT (tfile, &sb) < 0)
05213         error (1, errno, "reading %s", tfile);
05214     bufsize = sb.st_size;
05215     buf = xmalloc (bufsize);
05216 #   endif
05217     fd = CVS_OPEN (tfile, O_RDONLY | OPEN_BINARY);
05218     if (fd < 0)
05219         error (1, errno, "reading %s", short_pathname);
05220     }
05221     else
05222     fd = CVS_OPEN (file, O_RDONLY | OPEN_BINARY);
05223 #else
05224     fd = CVS_OPEN (file, O_RDONLY | (bin ? OPEN_BINARY : 0));
05225 #endif
05226
05227     if (fd < 0)
05228     error (1, errno, "reading %s", short_pathname);
05229
05230     if (file_gzip_level && sb.st_size > 100)
05231     {
05232     size_t newsize = 0;
05233
05234     if (read_and_gzip (fd, short_pathname, (unsigned char **)&buf,
05235                &bufsize, &newsize,
05236                file_gzip_level))
05237         error (1, 0, "aborting due to compression error");
05238
05239     if (close (fd) < 0)
05240         error (0, errno, "warning: can't close %s", short_pathname);
05241
05242         {
05243           char tmp[80];
05244
05245       send_to_server ("Modified ", 0);
05246       send_to_server (file, 0);
05247       send_to_server ("\012", 1);
05248       send_to_server (mode_string, 0);
05249       send_to_server ("\012z", 2);
05250       sprintf (tmp, "%lu\n", (unsigned long) newsize);
05251       send_to_server (tmp, 0);
05252
05253           send_to_server (buf, newsize);
05254         }
05255     }
05256     else
05257     {
05258         int newsize;
05259
05260         {
05261         char *bufp = buf;
05262         int len;
05263
05264         /* FIXME: This is gross.  It assumes that we might read
05265            less than st_size bytes (true on NT), but not more.
05266            Instead of this we should just be reading a block of
05267            data (e.g. 8192 bytes), writing it to the network, and
05268            so on until EOF.  */
05269         while ((len = read (fd, bufp, (buf + sb.st_size) - bufp)) > 0)
05270             bufp += len;
05271
05272         if (len < 0)
05273             error (1, errno, "reading %s", short_pathname);
05274
05275         newsize = bufp - buf;
05276     }
05277     if (close (fd) < 0)
05278         error (0, errno, "warning: can't close %s", short_pathname);
05279
05280         {
05281           char tmp[80];
05282
05283       send_to_server ("Modified ", 0);
05284       send_to_server (file, 0);
05285       send_to_server ("\012", 1);
05286       send_to_server (mode_string, 0);
05287       send_to_server ("\012", 1);
05288           sprintf (tmp, "%lu\012", (unsigned long) newsize);
05289           send_to_server (tmp, 0);
05290         }
05291 #ifdef BROKEN_READWRITE_CONVERSION
05292 #   ifndef BINHEX_STUFF
05293     if (!bin)
05294 #   else
05295     if (1)
05296 #   endif
05297     {
05298 #   ifndef _POSIX_NO_TRUNC
05299         char tfile[1024]; strcpy(tfile, file); strcat(tfile, ".CVSBFCTMP");
05300 #   else
05301         char tfile[1024]; sprintf (tfile, "%.9s%s", file, ".CVSBFCTMP");
05302 #   endif
05303         if (CVS_UNLINK (tfile) < 0)
05304         error (0, errno, "warning: can't remove temp file %s", tfile);
05305     }
05306 #endif
05307
05308     /*
05309      * Note that this only ends with a newline if the file ended with
05310      * one.
05311      */
05312     if (newsize > 0)
05313         send_to_server (buf, newsize);
05314     }
05315     free (buf);
05316     free (mode_string);
05317 }
05318
05319 /* The address of an instance of this structure is passed to
05320    send_fileproc, send_filesdoneproc, and send_direntproc, as the
05321    callerdat parameter.  */
05322
05323 struct send_data
05324 {
05325     /* Each of the following flags are zero for clear or nonzero for set.  */
05326     int build_dirs;
05327     int force;
05328     int no_contents;
05329     int backup_modified;
05330 };
05331
05332 static int send_fileproc PROTO ((void *callerdat, struct file_info *finfo));
05333
05334 /* Deal with one file.  */
05335 static int
05336 send_fileproc (callerdat, finfo)
05337     void *callerdat;
05338     struct file_info *finfo;
05339 {
05340     struct send_data *args = (struct send_data *) callerdat;
05341     Vers_TS *vers;
05342     struct file_info xfinfo;
05343     /* File name to actually use.  Might differ in case from
05344        finfo->file.  */
05345     char *filename;
05346
05347     send_a_repository ("", finfo->repository, finfo->update_dir);
05348
05349     xfinfo = *finfo;
05350     xfinfo.repository = NULL;
05351     xfinfo.rcs = NULL;
05352     vers = Version_TS (&xfinfo, NULL, NULL, NULL, 0, 0);
05353
05354     if (vers->entdata != NULL)
05355     filename = vers->entdata->user;
05356     else
05357     filename = finfo->file;
05358
05359     if (vers->vn_user != NULL)
05360     {
05361     /* The Entries request.  */
05362     send_to_server ("Entry /", 0);
05363     send_to_server (filename, 0);
05364     send_to_server ("/", 0);
05365     send_to_server (vers->vn_user, 0);
05366     send_to_server ("/", 0);
05367     if (vers->ts_conflict != NULL)
05368     {
05369         if (vers->ts_user != NULL &&
05370         strcmp (vers->ts_conflict, vers->ts_user) == 0)
05371         send_to_server ("+=", 0);
05372         else
05373         send_to_server ("+modified", 0);
05374     }
05375     send_to_server ("/", 0);
05376     send_to_server (vers->entdata != NULL
05377             ? vers->entdata->options
05378             : vers->options,
05379             0);
05380     send_to_server ("/", 0);
05381     if (vers->entdata != NULL && vers->entdata->tag)
05382     {
05383         send_to_server ("T", 0);
05384         send_to_server (vers->entdata->tag, 0);
05385     }
05386     else if (vers->entdata != NULL && vers->entdata->date)
05387           {
05388         send_to_server ("D", 0);
05389         send_to_server (vers->entdata->date, 0);
05390           }
05391     send_to_server ("\012", 1);
05392     }
05393     else
05394     {
05395     /* It seems a little silly to re-read this on each file, but
05396        send_dirent_proc doesn't get called if filenames are specified
05397        explicitly on the command line.  */
05398     wrap_add_file (CVSDOTWRAPPER, 1);
05399
05400     if (wrap_name_has (filename, WRAP_RCSOPTION))
05401     {
05402         /* No "Entry", but the wrappers did give us a kopt so we better
05403            send it with "Kopt".  As far as I know this only happens
05404            for "cvs add".  Question: is there any reason why checking
05405            for options from wrappers isn't done in Version_TS?
05406
05407            Note: it might have been better to just remember all the
05408            kopts on the client side, rather than send them to the server,
05409            and have it send us back the same kopts.  But that seemed like
05410            a bigger change than I had in mind making now.  */
05411
05412         if (supported_request ("Kopt"))
05413         {
05414         char *opt;
05415
05416         send_to_server ("Kopt ", 0);
05417         opt = wrap_rcsoption (filename, 1);
05418         send_to_server (opt, 0);
05419         send_to_server ("\012", 1);
05420         free (opt);
05421         }
05422         else
05423         error (0, 0,
05424                "\
05425 warning: ignoring -k options due to server limitations");
05426     }
05427     }
05428
05429     if (vers->ts_user == NULL)
05430     {
05431     /*
05432      * Do we want to print "file was lost" like normal CVS?
05433      * Would it always be appropriate?
05434      */
05435     /* File no longer exists.  Don't do anything, missing files
05436        just happen.  */
05437     }
05438     else if ((!enable_dirty || !isdirty_file(finfo->file)) &&
05439         (vers->ts_rcs == NULL
05440          || args->force
05441          || strcmp (vers->ts_user, vers->ts_rcs) != 0))
05442     {
05443     if (args->no_contents
05444         && supported_request ("Is-modified"))
05445     {
05446         send_to_server ("Is-modified ", 0);
05447         send_to_server (filename, 0);
05448         send_to_server ("\012", 1);
05449     }
05450     else
05451         send_modified (filename, finfo->fullname, vers);
05452
05453         if (args->backup_modified)
05454         {
05455             char *bakname;
05456             bakname = backup_file (filename, vers->vn_user);
05457             /* This behavior is sufficiently unexpected to
05458                justify overinformativeness, I think. */
05459             if (! really_quiet)
05460                 printf ("(Locally modified %s moved to %s)\n",
05461                         filename, bakname);
05462             free (bakname);
05463         }
05464     }
05465     else
05466     {
05467     /* a dirty file is a file which will auto-modify himself.
05468     We won't send the modification on this file unless
05469     enable_dirty is true */
05470     if(!quiet && enable_dirty && isdirty_file(finfo->file) && (vers->ts_rcs == NULL
05471         || args->force || strcmp (vers->ts_user, vers->ts_rcs) != 0))
05472             error (0, 0, "Skip a modified dirty file : %s", finfo->file);
05473
05474     send_to_server ("Unchanged ", 0);
05475     send_to_server (filename, 0);
05476     send_to_server ("\012", 1);
05477     }
05478
05479     /* if this directory has an ignore list, add this file to it */
05480     if (ignlist)
05481     {
05482     Node *p;
05483
05484     p = getnode ();
05485     p->type = FILES;
05486     p->key = xstrdup (finfo->file);
05487     (void) addnode (ignlist, p);
05488     }
05489
05490     freevers_ts (&vers);
05491     return 0;
05492 }
05493
05494 static void send_ignproc PROTO ((char *, char *));
05495
05496 static void
05497 send_ignproc (file, dir)
05498     char *file;
05499     char *dir;
05500 {
05501     if (ign_inhibit_server || !supported_request ("Questionable"))
05502     {
05503     if (dir[0] != '\0')
05504         (void) printf ("? %s/%s\n", dir, file);
05505     else
05506         (void) printf ("? %s\n", file);
05507     }
05508     else
05509     {
05510     send_to_server ("Questionable ", 0);
05511     send_to_server (file, 0);
05512     send_to_server ("\012", 1);
05513     }
05514 }
05515
05516 static int send_filesdoneproc PROTO ((void *, int, char *, char *, List *));
05517
05518 static int
05519 send_filesdoneproc (callerdat, err, repository, update_dir, entries)
05520     void *callerdat;
05521     int err;
05522     char *repository;
05523     char *update_dir;
05524     List *entries;
05525 {
05526     /* if this directory has an ignore list, process it then free it */
05527     if (ignlist)
05528     {
05529     ignore_files (ignlist, entries, update_dir, send_ignproc);
05530     dellist (&ignlist);
05531     }
05532
05533     return (err);
05534 }
05535
05536 static Dtype send_dirent_proc PROTO ((void *, char *, char *, char *, List *));
05537
05538 /*
05539  * send_dirent_proc () is called back by the recursion processor before a
05540  * sub-directory is processed for update.
05541  * A return code of 0 indicates the directory should be
05542  * processed by the recursion code.  A return of non-zero indicates the
05543  * recursion code should skip this directory.
05544  *
05545  */
05546 static Dtype
05547 send_dirent_proc (callerdat, dir, repository, update_dir, entries)
05548     void *callerdat;
05549     char *dir;
05550     char *repository;
05551     char *update_dir;
05552     List *entries;
05553 {
05554     struct send_data *args = (struct send_data *) callerdat;
05555     int dir_exists;
05556     char *cvsadm_name;
05557
05558     if (ignore_directory (update_dir))
05559     {
05560     /* print the warm fuzzy message */
05561     if (!quiet)
05562         error (0, 0, "Ignoring %s", update_dir);
05563         return (R_SKIP_ALL);
05564     }
05565
05566     /*
05567      * If the directory does not exist yet (e.g. "cvs update -d foo"),
05568      * no need to send any files from it.  If the directory does not
05569      * have a CVS directory, then we pretend that it does not exist.
05570      * Otherwise, we will fail when trying to open the Entries file.
05571      * This case will happen when checking out a module defined as
05572      * ``-a .''.
05573      */
05574     cvsadm_name = xmalloc (strlen (dir) + sizeof (CVSADM) + 10);
05575     sprintf (cvsadm_name, "%s/%s", dir, CVSADM);
05576     dir_exists = isdir (cvsadm_name);
05577     free (cvsadm_name);
05578
05579     /*
05580      * If there is an empty directory (e.g. we are doing `cvs add' on a
05581      * newly-created directory), the server still needs to know about it.
05582      */
05583
05584     if (dir_exists)
05585     {
05586     /*
05587      * Get the repository from a CVS/Repository file whenever possible.
05588      * The repository variable is wrong if the names in the local
05589      * directory don't match the names in the repository.
05590      */
05591     char *repos = Name_Repository (dir, update_dir);
05592     send_a_repository (dir, repos, update_dir);
05593     free (repos);
05594
05595     /* initialize the ignore list for this directory */
05596     ignlist = getlist ();
05597     }
05598     else
05599     {
05600     /* It doesn't make sense to send a non-existent directory,
05601        because there is no way to get the correct value for
05602        the repository (I suppose maybe via the expand-modules
05603        request).  In the case where the "obvious" choice for
05604        repository is correct, the server can figure out whether
05605        to recreate the directory; in the case where it is wrong
05606        (that is, does not match what modules give us), we might as
05607        well just fail to recreate it.
05608
05609        Checking for noexec is a kludge for "cvs -n add dir".  */
05610     /* Don't send a non-existent directory unless we are building
05611            new directories (build_dirs is true).  Otherwise, CVS may
05612            see a D line in an Entries file, and recreate a directory
05613            which the user removed by hand.  */
05614     if (args->build_dirs && noexec)
05615         send_a_repository (dir, repository, update_dir);
05616     }
05617
05618     return (dir_exists ? R_PROCESS : R_SKIP_ALL);
05619 }
05620
05621 static int send_dirleave_proc PROTO ((void *, char *, int, char *, List *));
05622
05623 /*
05624  * send_dirleave_proc () is called back by the recursion code upon leaving
05625  * a directory.  All it does is delete the ignore list if it hasn't already
05626  * been done (by send_filesdone_proc).
05627  */
05628 /* ARGSUSED */
05629 static int
05630 send_dirleave_proc (callerdat, dir, err, update_dir, entries)
05631     void *callerdat;
05632     char *dir;
05633     int err;
05634     char *update_dir;
05635     List *entries;
05636 {
05637
05638     /* Delete the ignore list if it hasn't already been done.  */
05639     if (ignlist)
05640     dellist (&ignlist);
05641     return err;
05642 }
05643
05644 /*
05645  * Send each option in a string to the server, one by one.
05646  * This assumes that the options are separated by spaces, for example
05647  * STRING might be "--foo -C5 -y".
05648  */
05649
05650 void
05651 send_option_string (string)
05652     char *string;
05653 {
05654     char *copy;
05655     char *p;
05656
05657     copy = xstrdup (string);
05658     p = copy;
05659     while (1)
05660     {
05661         char *s;
05662     char l;
05663
05664     for (s = p; *s != ' ' && *s != '\0'; s++)
05665         ;
05666     l = *s;
05667     *s = '\0';
05668     if (s != p)
05669         send_arg (p);
05670     if (l == '\0')
05671         break;
05672     p = s + 1;
05673     }
05674     free (copy);
05675 }
05676
05677
05678 /* Send the names of all the argument files to the server.  */
05679
05680 void
05681 send_file_names (argc, argv, flags)
05682     int argc;
05683     char **argv;
05684     unsigned int flags;
05685 {
05686     int i;
05687     int level;
05688     int max_level;
05689
05690     /* The fact that we do this here as well as start_recursion is a bit
05691        of a performance hit.  Perhaps worth cleaning up someday.  */
05692     if (flags & SEND_EXPAND_WILD)
05693     expand_wild (argc, argv, &argc, &argv);
05694
05695     /* Send Max-dotdot if needed.  */
05696     max_level = 0;
05697     for (i = 0; i < argc; ++i)
05698     {
05699     level = pathname_levels (argv[i]);
05700     if (level > max_level)
05701         max_level = level;
05702     }
05703     if (max_level > 0)
05704     {
05705     if (supported_request ("Max-dotdot"))
05706     {
05707             char buf[10];
05708             sprintf (buf, "%d", max_level);
05709
05710         send_to_server ("Max-dotdot ", 0);
05711         send_to_server (buf, 0);
05712         send_to_server ("\012", 1);
05713     }
05714     else
05715         /*
05716          * "leading .." is not strictly correct, as this also includes
05717          * cases like "foo/../..".  But trying to explain that in the
05718          * error message would probably just confuse users.
05719          */
05720         error (1, 0,
05721            "leading .. not supported by old (pre-Max-dotdot) servers");
05722     }
05723
05724     for (i = 0; i < argc; ++i)
05725     {
05726     char buf[1];
05727     char *p = argv[i];
05728     char *line = NULL;
05729
05730     if (arg_should_not_be_sent_to_server (argv[i]))
05731         continue;
05732
05733 #ifdef FILENAMES_CASE_INSENSITIVE
05734     /* We want to send the file name as it appears
05735        in CVS/Entries.  We put this inside an ifdef
05736        to avoid doing all these system calls in
05737        cases where fncmp is just strcmp anyway.  */
05738     /* For now just do this for files in the local
05739        directory.  Would be nice to handle the
05740        non-local case too, though.  */
05741     /* The isdir check could more gracefully be replaced
05742        with a way of having Entries_Open report back the
05743        error to us and letting us ignore existence_error.
05744        Or some such.  */
05745     if (p == last_component (p) && isdir (CVSADM))
05746     {
05747         List *entries;
05748         Node *node;
05749
05750         /* If we were doing non-local directory,
05751            we would save_cwd, CVS_CHDIR
05752            like in update.c:isemptydir.  */
05753         /* Note that if we are adding a directory,
05754            the following will read the entry
05755            that we just wrote there, that is, we
05756            will get the case specified on the
05757            command line, not the case of the
05758            directory in the filesystem.  This
05759            is correct behavior.  */
05760         entries = Entries_Open (0, NULL);
05761         node = findnode_fn (entries, p);
05762         if (node != NULL)
05763         {
05764         line = xstrdup (node->key);
05765         p = line;
05766         delnode (node);
05767         }
05768         Entries_Close (entries);
05769     }
05770 #endif /* FILENAMES_CASE_INSENSITIVE */
05771
05772     send_to_server ("Argument ", 0);
05773
05774     while (*p)
05775     {
05776         if (*p == '\n')
05777         {
05778         send_to_server ("\012Argumentx ", 0);
05779         }
05780         else if (ISDIRSEP (*p))
05781         {
05782         buf[0] = '/';
05783         send_to_server (buf, 1);
05784         }
05785         else
05786         {
05787         buf[0] = *p;
05788         send_to_server (buf, 1);
05789         }
05790         ++p;
05791     }
05792     send_to_server ("\012", 1);
05793     if (line != NULL)
05794         free (line);
05795     }
05796
05797     if (flags & SEND_EXPAND_WILD)
05798     {
05799     int i;
05800     for (i = 0; i < argc; ++i)
05801         free (argv[i]);
05802     free (argv);
05803     }
05804 }
05805
05806
05807 /* Send Repository, Modified and Entry.  argc and argv contain only
05808   the files to operate on (or empty for everything), not options.
05809   local is nonzero if we should not recurse (-l option).  flags &
05810   SEND_BUILD_DIRS is nonzero if nonexistent directories should be
05811   sent.  flags & SEND_FORCE is nonzero if we should send unmodified
05812   files to the server as though they were modified.  flags &
05813   SEND_NO_CONTENTS means that this command only needs to know
05814   _whether_ a file is modified, not the contents.  Also sends Argument
05815   lines for argc and argv, so should be called after options are sent.  */
05816 void
05817 send_files (argc, argv, local, aflag, flags)
05818     int argc;
05819     char **argv;
05820     int local;
05821     int aflag;
05822     unsigned int flags;
05823 {
05824     struct send_data args;
05825     int err;
05826
05827     /*
05828      * aflag controls whether the tag/date is copied into the vers_ts.
05829      * But we don't actually use it, so I don't think it matters what we pass
05830      * for aflag here.
05831      */
05832     args.build_dirs = flags & SEND_BUILD_DIRS;
05833     args.force = flags & SEND_FORCE;
05834     args.no_contents = flags & SEND_NO_CONTENTS;
05835     args.backup_modified = flags & BACKUP_MODIFIED_FILES;
05836     err = start_recursion
05837     (send_fileproc, send_filesdoneproc,
05838      send_dirent_proc, send_dirleave_proc, (void *) &args,
05839      argc, argv, local, W_LOCAL, aflag, 0, (char *)NULL, 0);
05840     if (err)
05841     error_exit ();
05842     if (toplevel_repos == NULL)
05843     /*
05844      * This happens if we are not processing any files,
05845      * or for checkouts in directories without any existing stuff
05846      * checked out.  The following assignment is correct for the
05847      * latter case; I don't think toplevel_repos matters for the
05848      * former.
05849      */
05850     toplevel_repos = xstrdup (CVSroot_directory);
05851     send_repository ("", toplevel_repos, ".");
05852 }
05853
05854 void
05855 client_import_setup (repository)
05856     char *repository;
05857 {
05858     if (toplevel_repos == NULL)     /* should always be true */
05859         send_a_repository ("", repository, "");
05860 }
05861
05862 /*
05863  * Process the argument import file.
05864  */
05865 int
05866 client_process_import_file (message, vfile, vtag, targc, targv, repository,
05867                             all_files_binary, modtime)
05868     char *message;
05869     char *vfile;
05870     char *vtag;
05871     int targc;
05872     char *targv[];
05873     char *repository;
05874     int all_files_binary;
05875
05876     /* Nonzero for "import -d".  */
05877     int modtime;
05878 {
05879     char *update_dir;
05880     char *fullname;
05881     Vers_TS vers;
05882
05883     assert (toplevel_repos != NULL);
05884
05885     if (strncmp (repository, toplevel_repos, strlen (toplevel_repos)) != 0)
05886     error (1, 0,
05887            "internal error: pathname `%s' doesn't specify file in `%s'",
05888            repository, toplevel_repos);
05889
05890     if (strcmp (repository, toplevel_repos) == 0)
05891     {
05892     update_dir = "";
05893     fullname = xstrdup (vfile);
05894     }
05895     else
05896     {
05897     update_dir = repository + strlen (toplevel_repos) + 1;
05898
05899     fullname = xmalloc (strlen (vfile) + strlen (update_dir) + 10);
05900     strcpy (fullname, update_dir);
05901     strcat (fullname, "/");
05902     strcat (fullname, vfile);
05903     }
05904
05905     send_a_repository ("", repository, update_dir);
05906     if (all_files_binary)
05907     {
05908     vers.options = xmalloc (4); /* strlen("-kb") + 1 */
05909     strcpy (vers.options, "-kb");
05910     }
05911     else
05912     {
05913     vers.options = wrap_rcsoption (vfile, 1);
05914     }
05915     if (vers.options != NULL)
05916     {
05917     if (supported_request ("Kopt"))
05918     {
05919         send_to_server ("Kopt ", 0);
05920         send_to_server (vers.options, 0);
05921         send_to_server ("\012", 1);
05922     }
05923     else
05924         error (0, 0,
05925            "warning: ignoring -k options due to server limitations");
05926     }
05927     if (modtime)
05928     {
05929     if (supported_request ("Checkin-time"))
05930     {
05931         struct stat sb;
05932         char *rcsdate;
05933         char netdate[MAXDATELEN];
05934
05935         if (CVS_STAT (vfile, &sb) < 0)
05936         error (1, errno, "cannot stat %s", fullname);
05937         rcsdate = date_from_time_t (sb.st_mtime);
05938         date_to_internet (netdate, rcsdate);
05939         free (rcsdate);
05940
05941         send_to_server ("Checkin-time ", 0);
05942         send_to_server (netdate, 0);
05943         send_to_server ("\012", 1);
05944     }
05945     else
05946         error (0, 0,
05947            "warning: ignoring -d option due to server limitations");
05948     }
05949     send_modified (vfile, fullname, &vers);
05950     if (vers.options != NULL)
05951     free (vers.options);
05952     free (fullname);
05953     return 0;
05954 }
05955
05956 void
05957 client_import_done ()
05958 {
05959     if (toplevel_repos == NULL)
05960     /*
05961      * This happens if we are not processing any files,
05962      * or for checkouts in directories without any existing stuff
05963      * checked out.  The following assignment is correct for the
05964      * latter case; I don't think toplevel_repos matters for the
05965      * former.
05966      */
05967         /* FIXME: "can't happen" now that we call client_import_setup
05968        at the beginning.  */
05969     toplevel_repos = xstrdup (CVSroot_directory);
05970     send_repository ("", toplevel_repos, ".");
05971 }
05972
05973 static void
05974 notified_a_file (data, ent_list, short_pathname, filename)
05975     char *data;
05976     List *ent_list;
05977     char *short_pathname;
05978     char *filename;
05979 {
05980     FILE *fp;
05981     FILE *newf;
05982     size_t line_len = 8192;
05983     char *line = xmalloc (line_len);
05984     char *cp;
05985     int nread;
05986     int nwritten;
05987     char *p;
05988
05989     fp = open_file (CVSADM_NOTIFY, "r");
05990     if (getline (&line, &line_len, fp) < 0)
05991     {
05992     if (feof (fp))
05993         error (0, 0, "cannot read %s: end of file", CVSADM_NOTIFY);
05994     else
05995         error (0, errno, "cannot read %s", CVSADM_NOTIFY);
05996     goto error_exit;
05997     }
05998     cp = strchr (line, '\t');
05999     if (cp == NULL)
06000     {
06001     error (0, 0, "malformed %s file", CVSADM_NOTIFY);
06002     goto error_exit;
06003     }
06004     *cp = '\0';
06005     if (strcmp (filename, line + 1) != 0)
06006     {
06007     error (0, 0, "protocol error: notified %s, expected %s", filename,
06008            line + 1);
06009     }
06010
06011     if (getline (&line, &line_len, fp) < 0)
06012     {
06013     if (feof (fp))
06014     {
06015         free (line);
06016         if (fclose (fp) < 0)
06017         error (0, errno, "cannot close %s", CVSADM_NOTIFY);
06018         if ( CVS_UNLINK (CVSADM_NOTIFY) < 0)
06019         error (0, errno, "cannot remove %s", CVSADM_NOTIFY);
06020         return;
06021     }
06022     else
06023     {
06024         error (0, errno, "cannot read %s", CVSADM_NOTIFY);
06025         goto error_exit;
06026     }
06027     }
06028     newf = open_file (CVSADM_NOTIFYTMP, "w");
06029     if (fputs (line, newf) < 0)
06030     {
06031     error (0, errno, "cannot write %s", CVSADM_NOTIFYTMP);
06032     goto error2;
06033     }
06034     while ((nread = fread (line, 1, line_len, fp)) > 0)
06035     {
06036     p = line;
06037     while ((nwritten = fwrite (p, 1, nread, newf)) > 0)
06038     {
06039         nread -= nwritten;
06040         p += nwritten;
06041     }
06042     if (ferror (newf))
06043     {
06044         error (0, errno, "cannot write %s", CVSADM_NOTIFYTMP);
06045         goto error2;
06046     }
06047     }
06048     if (ferror (fp))
06049     {
06050     error (0, errno, "cannot read %s", CVSADM_NOTIFY);
06051     goto error2;
06052     }
06053     if (fclose (newf) < 0)
06054     {
06055     error (0, errno, "cannot close %s", CVSADM_NOTIFYTMP);
06056     goto error_exit;
06057     }
06058     free (line);
06059     if (fclose (fp) < 0)
06060     {
06061     error (0, errno, "cannot close %s", CVSADM_NOTIFY);
06062     return;
06063     }
06064
06065     {
06066         /* In this case, we want rename_file() to ignore noexec. */
06067         int saved_noexec = noexec;
06068         noexec = 0;
06069         rename_file (CVSADM_NOTIFYTMP, CVSADM_NOTIFY);
06070         noexec = saved_noexec;
06071     }
06072
06073     return;
06074   error2:
06075     (void) fclose (newf);
06076   error_exit:
06077     free (line);
06078     (void) fclose (fp);
06079 }
06080
06081 static void
06082 handle_notified (args, len)
06083     char *args;
06084     int len;
06085 {
06086     call_in_directory (args, notified_a_file, NULL);
06087 }
06088
06089 void
06090 client_notify (repository, update_dir, filename, notif_type, val)
06091     char *repository;
06092     char *update_dir;
06093     char *filename;
06094     int notif_type;
06095     char *val;
06096 {
06097     char buf[2];
06098
06099     send_a_repository ("", repository, update_dir);
06100     send_to_server ("Notify ", 0);
06101     send_to_server (filename, 0);
06102     send_to_server ("\012", 1);
06103     buf[0] = notif_type;
06104     buf[1] = '\0';
06105     send_to_server (buf, 1);
06106     send_to_server ("\t", 1);
06107     send_to_server (val, 0);
06108 }
06109
06110 /*
06111  * Send an option with an argument, dealing correctly with newlines in
06112  * the argument.  If ARG is NULL, forget the whole thing.
06113  */
06114 void
06115 option_with_arg (option, arg)
06116     char *option;
06117     char *arg;
06118 {
06119     if (arg == NULL)
06120     return;
06121
06122     send_to_server ("Argument ", 0);
06123     send_to_server (option, 0);
06124     send_to_server ("\012", 1);
06125
06126     send_arg (arg);
06127 }
06128
06129 /* Send a date to the server.  The input DATE is in RCS format.
06130    The time will be GMT.
06131
06132    We then convert that to the format required in the protocol
06133    (including the "-D" option) and send it.  According to
06134    cvsclient.texi, RFC 822/1123 format is preferred.  */
06135
06136 void
06137 client_senddate (date)
06138     const char *date;
06139 {
06140     char buf[MAXDATELEN];
06141
06142     date_to_internet (buf, (char *)date);
06143     option_with_arg ("-D", buf);
06144 }
06145
06146 void
06147 send_init_command ()
06148 {
06149     /* This is here because we need the CVSroot_directory variable.  */
06150     send_to_server ("init ", 0);
06151     send_to_server (CVSroot_directory, 0);
06152     send_to_server ("\012", 0);
06153 }
06154
06155 /* see cvs.h for details */
06156 int enable_dirty = 0;
06157
06158 static char *dirty_extensions[] = {
06159     ".mcp", /* Metrowerks Pro 2 projects files */
06160     NULL /* don't remove ! */
06161 };
06162
06163 int isdirty_file(const char *path)
06164 {
06165     int l, lt;
06166     char **tmp = dirty_extensions;
06167
06168     char *dirty_env = getenv("DIRTY_MCP");
06169     if(dirty_env != 0L)
06170     {
06171         if(strcmp(dirty_env, "no") == 0)
06172             return 0;
06173     }
06174
06175     while(*tmp != NULL)
06176     {
06177         l = strlen(path);
06178         lt = strlen(*tmp);
06179         if(l >= lt && strcmp(path + l - lt, *tmp) == 0)
06180             return 1;
06181         tmp++;
06182     }
06183
06184     return 0;
06185 }
06186
06187 #ifdef macintosh
06188 static void my_log(long userData, const char *message)
06189 {
06190     cvs_output(message, strlen(message));
06191 }
06192
06193 static char *append_str(char *str, const char *what)
06194 {
06195     if(str == 0L)
06196     {
06197         str = (char *)xmalloc(strlen(what) + 1);
06198         strcpy(str, what);
06199     }
06200     else
06201     {
06202         str = (char *)xrealloc(str, strlen(str) + strlen(what) + 1);
06203         strcat(str, what);
06204     }
06205
06206     return str;
06207 }
06208
06209 static char *my_getpass(long userData, const char *prompt)
06210 {
06211     int isPassPrompt = strchr(prompt, '@') != 0L;
06212     const char *passPrompt = "Enter passphrase for private key : ";
06213     char *realPrompt;
06214     char *res;
06215     static int firstTime = true;
06216     char *cmd;
06217
06218     if(isPassPrompt)
06219     {
06220         if(firstTime)
06221         {
06222             /* most of the time the passphrase is blank, try that first */
06223             firstTime = false;
06224             return "";
06225         }
06226         realPrompt = append_str(0L, passPrompt);
06227         realPrompt = append_str(realPrompt, prompt);
06228     }
06229     else
06230     {
06231         realPrompt = append_str(0L, prompt);
06232         realPrompt = append_str(realPrompt, "@");
06233         realPrompt = append_str(realPrompt, CVSroot_hostname);
06234     }
06235
06236     cmd = append_str(0L, "prompt=");
06237     cmd = append_str(cmd, realPrompt);
06238     free(realPrompt);
06239
06240     if(isPassPrompt)
06241     {
06242         /* we don't want to read the IP number of the localhost, cause of dhcp or bootp */
06243         cmd = append_str(cmd, "&host=localhost");
06244         cmd = append_str(cmd, "&user=");
06245         cmd = append_str(cmd, CVSroot_username);
06246         cmd = append_str(cmd, "&authen=lsh_passphrase");
06247     }
06248     else
06249     {
06250         cmd = append_str(cmd, "&host=");
06251         cmd = append_str(cmd, CVSroot_hostname);
06252         cmd = append_str(cmd, "&user=");
06253         cmd = append_str(cmd, CVSroot_username);
06254         cmd = append_str(cmd, "&dir=");
06255         cmd = append_str(cmd, CVSroot_directory);
06256         cmd = append_str(cmd, "&authen=lsh");
06257     }
06258
06259     res = getpass(cmd);
06260     free(cmd);
06261     return res;
06262 }
06263
06264 static int my_yes_or_no(long userData, const char *prompt, int def)
06265 {
06266     cvs_output(prompt, strlen(prompt));
06267     return yesno();
06268 }
06269
06270 static void start_lsh_server (int *tofd, int *fromfd)
06271 {
06272     gusilsh_ctx *my_ctx;
06273     lshctx      *lsh_ctx;
06274     char        argstr[1024];
06275     int         count;
06276     char        buf[4096];
06277     struct response *rs;
06278     long start;
06279     char *env;
06280     struct sigaction    act;
06281     sigset_t sigset_mask, sigset_omask;
06282
06283     if(lsh_init == 0L)
06284     {
06285         error(1, errno, "could not find the lsh library");
06286     }
06287
06288     my_ctx = xmalloc(sizeof(gusilsh_ctx));
06289     my_ctx->lsh_ctx = 0L;
06290     my_ctx->doAbort = 0;
06291
06292     /* we need to remember the previous SIGNINT handler (cvs one), cause
06293     lsh is going to call sigaction and it doesn't do what we expect so
06294     we are going to replace it with our one which *does* the good thing
06295     and then call the cvs one.
06296     */
06297     memset(&my_ctx->oldHandler, 0, sizeof(my_ctx->oldHandler));
06298     if (sigaction(SIGINT, NULL, &my_ctx->oldHandler) < 0) {
06299         error(1, errno, "warning: failed to get the default SIGINT handler");
06300     }
06301
06302     strcpy(argstr, "lsh");
06303     strcat(argstr, " -l");
06304     strcat(argstr, CVSroot_username);
06305
06306     env = getenv("LSH_SEND_IDENTITY");
06307     if(env == 0L || strcmp(env, "yes") == 0)
06308     {
06309         strcat(argstr, " -i \"");
06310         strcat(argstr, lsh_getprefsd());
06311         strcat(argstr, "identity\"");
06312     }
06313
06314     strcat(argstr, " -N");
06315
06316     strcat(argstr, " --host-db \"");
06317     strcat(argstr, lsh_getprefsd());
06318     strcat(argstr, "known_hosts\"");
06319
06320     strcat(argstr, " --capture-to \"");
06321     strcat(argstr, lsh_getprefsd());
06322     strcat(argstr, "known_hosts\"");
06323
06324     strcat(argstr, " --sloppy-host-authentication");
06325
06326     env = getenv("LSH_ENCRYPTION");
06327     if(env != 0L && env[0] != '\0')
06328     {
06329         strcat(argstr, " ");
06330         strcat(argstr, env);
06331     }
06332     else
06333         strcat(argstr, " -call");
06334
06335     /* default is hmac-sha1, hmac-md5 */
06336     env = getenv("LSH_AUTHENTICATION");
06337     if(env != 0L && env[0] != '\0')
06338     {
06339         strcat(argstr, " ");
06340         strcat(argstr, env);
06341     }
06342
06343     env = getenv("LSH_ZLIB");
06344     if(env != 0L && env[0] != '\0')
06345     {
06346         strcat(argstr, " ");
06347         strcat(argstr, env);
06348     }
06349     else
06350         strcat(argstr, " -zzlib");
06351
06352     env = getenv("LSH_MORE_ARGS");
06353     if(env != 0L && env[0] != '\0')
06354     {
06355         strcat(argstr, " ");
06356         strcat(argstr, env); /* --verbose, --trace, --debug */
06357     }
06358
06359     env = getenv("LSH_PORT");
06360     if(env != 0L && env[0] != '\0' && atoi(env) > 0)
06361     {
06362         strcat(argstr, " -p");
06363         strcat(argstr, env);
06364     }
06365
06366     strcat(argstr, " --stdin dev:ttyin --stdout dev:ttyout --stderr dev:ttyerr");
06367
06368     strcat(argstr, " ");
06369     strcat(argstr, CVSroot_hostname);
06370
06371     strcat(argstr, " cvs -d ");
06372     strcat(argstr, CVSroot_directory);
06373     strcat(argstr, " server");
06374     if (!quiet)
06375         error(0, 0, "Invoking lsh : %s", argstr);
06376     fflush(stdout);
06377
06378     lsh_ctx = lsh_new(argstr, GUSILSH_hdlevt, my_log, my_getpass, my_yes_or_no, (long)my_ctx);
06379
06380     if(lsh_ctx == 0L)
06381         error(1, errno, "lsh failed to connect");
06382
06383     lsh_yield(); /* to start the thread and create the context */
06384
06385     act.sa_handler = GUSILSH_cleanup;
06386     (void) sigemptyset(&act.sa_mask);
06387     act.sa_flags = 0;
06388     if(sigaction(SIGINT, &act, NULL /* lsh one, forget about it for now*/) < 0) {
06389         error(1, errno, "warning: failed to set the lsh SIGINT handler");
06390     }
06391
06392 //  if (sigaction(SIGINT, &interrupt, NULL) < 0) {
06393 //      error(1, errno, "warning: failed to install the default SIGINT handler");
06394 //  }
06395
06396     my_ctx->lsh_ctx = lsh_ctx;
06397
06398     GUSILSH_set_context(my_ctx);
06399
06400     *fromfd = *tofd = open("dev:lsh", O_RDWR);
06401     if(*tofd == -1)
06402     {
06403         lsh_delete(lsh_ctx);
06404         error(1, errno, "could not create the lsh socket");
06405     }
06406 }
06407 #endif
06408
06409 #ifdef DO_NOT_LOCK_DIRTY
06410 #   undef chmod
06411 #   ifdef macintosh
06412 #       define chmod macos_chmod
06413 #   endif
06414     int dirty_chmod( const char *path, mode_t mode )
06415     {
06416         if(isdirty_file(path))
06417             return 0;
06418
06419         return chmod(path, mode);
06420     }
06421 #endif
06422
06423 #endif /* CLIENT_SUPPORT */
Generated on Sun Oct 21 12:41:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/client.h Source File

cvs-1.10/src/client.h

Go to the documentation of this file.
00001 /* Interface between the client and the rest of CVS.  */
00002
00003 /* Stuff shared with the server.  */
00004 extern char *mode_to_string PROTO((mode_t));
00005 extern int change_mode PROTO((char *, char *, int));
00006
00007 extern int gzip_level;
00008 extern int file_gzip_level;
00009
00010 #if defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT)
00011
00012 /* Whether the connection should be encrypted.  */
00013 extern int cvsencrypt;
00014
00015 /* Whether the connection should use per-packet authentication.  */
00016 extern int cvsauthenticate;
00017
00018 #ifdef ENCRYPTION
00019
00020 #ifdef HAVE_KERBEROS
00021
00022 /* We can't declare the arguments without including krb.h, and I don't
00023    want to do that in every file.  */
00024 extern struct buffer *krb_encrypt_buffer_initialize ();
00025
00026 #endif /* HAVE_KERBEROS */
00027
00028 #ifdef HAVE_GSSAPI
00029
00030 /* Set this to turn on GSSAPI encryption.  */
00031 extern int cvs_gssapi_encrypt;
00032
00033 #endif /* HAVE_GSSAPI */
00034
00035 #endif /* ENCRYPTION */
00036
00037 #ifdef HAVE_GSSAPI
00038
00039 /* We can't declare the arguments without including gssapi.h, and I
00040    don't want to do that in every file.  */
00041 extern struct buffer *cvs_gssapi_wrap_buffer_initialize ();
00042
00043 #endif /* HAVE_GSSAPI */
00044
00045 #endif /* defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT) */
00046
00047 #ifdef CLIENT_SUPPORT
00048 /*
00049  * Flag variable for seeing whether the server has been started yet.
00050  * As of this writing, only edit.c:notify_check() uses it.
00051  */
00052 extern int server_started;
00053
00054 /* Is the -P option to checkout or update specified?  */
00055 extern int client_prune_dirs;
00056
00057 #ifdef AUTH_CLIENT_SUPPORT
00058 extern int use_authenticating_server;
00059 void connect_to_pserver PROTO ((int *tofdp, int* fromfdp, int verify_only,
00060                 int do_gssapi));
00061 # ifndef CVS_AUTH_PORT
00062 # define CVS_AUTH_PORT 2401
00063 # endif /* CVS_AUTH_PORT */
00064 # ifndef CVS_PROXY_PORT
00065 # define CVS_PROXY_PORT 80
00066 # endif /* CVS_PROXY_PORT */
00067 #endif /* AUTH_CLIENT_SUPPORT */
00068
00069 #if defined (AUTH_SERVER_SUPPORT) || (defined (SERVER_SUPPORT) && defined (HAVE_GSSAPI))
00070 extern void pserver_authenticate_connection PROTO ((void));
00071 #endif
00072
00073 #if defined (SERVER_SUPPORT) && defined (HAVE_KERBEROS)
00074 extern void kserver_authenticate_connection PROTO ((void));
00075 #endif
00076
00077 /* Talking to the server. */
00078 void send_to_server PROTO((char *str, size_t len));
00079 void read_from_server PROTO((char *buf, size_t len));
00080
00081 /* Internal functions that handle client communication to server, etc.  */
00082 int supported_request PROTO ((char *));
00083 void option_with_arg PROTO((char *option, char *arg));
00084
00085 /* Get the responses and then close the connection.  */
00086 extern int get_responses_and_close PROTO((void));
00087
00088 extern int get_server_responses PROTO((void));
00089
00090 /* Start up the connection to the server on the other end.  */
00091 void
00092 start_server PROTO((void));
00093
00094 /* Send the names of all the argument files to the server.  */
00095 void
00096 send_file_names PROTO((int argc, char **argv, unsigned int flags));
00097
00098 /* Flags for send_file_names.  */
00099 /* Expand wild cards?  */
00100 #define SEND_EXPAND_WILD 1
00101
00102 /*
00103  * Send Repository, Modified and Entry.  argc and argv contain only
00104  * the files to operate on (or empty for everything), not options.
00105  * local is nonzero if we should not recurse (-l option).
00106  */
00107 void
00108 send_files PROTO((int argc, char **argv, int local, int aflag,
00109           unsigned int flags));
00110
00111 /* Flags for send_files.  */
00112 #define SEND_BUILD_DIRS 1
00113 #define SEND_FORCE 2
00114 #define SEND_NO_CONTENTS 4
00115 #define BACKUP_MODIFIED_FILES 8
00116
00117 /* Send an argument to the remote server.  */
00118 void
00119 send_arg PROTO((char *string));
00120
00121 /* Send a string of single-char options to the remote server, one by one.  */
00122 void
00123 send_option_string PROTO((char *string));
00124
00125 extern void send_a_repository PROTO ((char *, char *, char *));
00126
00127 #endif /* CLIENT_SUPPORT */
00128
00129 /*
00130  * This structure is used to catalog the responses the client is
00131  * prepared to see from the server.
00132  */
00133
00134 struct response
00135 {
00136     /* Name of the response.  */
00137     char *name;
00138
00139 #ifdef CLIENT_SUPPORT
00140     /*
00141      * Function to carry out the response.  ARGS is the text of the
00142      * command after name and, if present, a single space, have been
00143      * stripped off.  The function can scribble into ARGS if it wants.
00144      * Note that although LEN is given, ARGS is also guaranteed to be
00145      * '\0' terminated.
00146      */
00147     void (*func) PROTO((char *args, int len));
00148
00149     /*
00150      * ok and error are special; they indicate we are at the end of the
00151      * responses, and error indicates we should exit with nonzero
00152      * exitstatus.
00153      */
00154     enum {response_type_normal, response_type_ok, response_type_error} type;
00155 #endif
00156
00157     /* Used by the server to indicate whether response is supported by
00158        the client, as set by the Valid-responses request.  */
00159     enum {
00160       /*
00161        * Failure to implement this response can imply a fatal
00162        * error.  This should be set only for responses which were in the
00163        * original version of the protocol; it should not be set for new
00164        * responses.
00165        */
00166       rs_essential,
00167
00168       /* Some clients might not understand this response.  */
00169       rs_optional,
00170
00171       /*
00172        * Set by the server to one of the following based on what this
00173        * client actually supports.
00174        */
00175       rs_supported,
00176       rs_not_supported
00177       } status;
00178 };
00179
00180 /* Table of responses ending in an entry with a NULL name.  */
00181
00182 extern struct response responses[];
00183
00184 #ifdef CLIENT_SUPPORT
00185
00186 extern void client_senddate PROTO((const char *date));
00187 extern void client_expand_modules PROTO((int argc, char **argv, int local));
00188 extern void client_send_expansions PROTO((int local, char *where,
00189                       int build_dirs));
00190 extern void client_nonexpanded_setup PROTO((void));
00191
00192 extern void send_init_command PROTO ((void));
00193
00194 extern char **failed_patches;
00195 extern int failed_patches_count;
00196 extern char *toplevel_wd;
00197 extern void client_import_setup PROTO((char *repository));
00198 extern int client_process_import_file
00199     PROTO((char *message, char *vfile, char *vtag,
00200        int targc, char *targv[], char *repository, int all_files_binary,
00201        int modtime));
00202 extern void client_import_done PROTO((void));
00203 extern void client_notify PROTO((char *, char *, char *, int, char *));
00204 #endif /* CLIENT_SUPPORT */
Generated on Sun Oct 21 12:41:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/commit.c Source File

cvs-1.10/src/commit.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Commit Files
00009  *
00010  * "commit" commits the present version to the RCS repository, AFTER
00011  * having done a test on conflicts.
00012  *
00013  * The call is: cvs commit [options] files...
00014  *
00015  */
00016
00017 #include <assert.h>
00018 #include "cvs.h"
00019 #include "getline.h"
00020 #include "edit.h"
00021 #include "fileattr.h"
00022 #include "hardlink.h"
00023
00024 static Dtype check_direntproc PROTO ((void *callerdat, char *dir,
00025                       char *repos, char *update_dir,
00026                       List *entries));
00027 static int check_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00028 static int check_filesdoneproc PROTO ((void *callerdat, int err,
00029                        char *repos, char *update_dir,
00030                        List *entries));
00031 static int checkaddfile PROTO((char *file, char *repository, char *tag,
00032                    char *options, RCSNode **rcsnode));
00033 static Dtype commit_direntproc PROTO ((void *callerdat, char *dir,
00034                        char *repos, char *update_dir,
00035                        List *entries));
00036 static int commit_dirleaveproc PROTO ((void *callerdat, char *dir,
00037                        int err, char *update_dir,
00038                        List *entries));
00039 static int commit_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00040 static int commit_filesdoneproc PROTO ((void *callerdat, int err,
00041                     char *repository, char *update_dir,
00042                     List *entries));
00043 static int finaladd PROTO((struct file_info *finfo, char *revision, char *tag,
00044                char *options));
00045 static int findmaxrev PROTO((Node * p, void *closure));
00046 static int lock_RCS PROTO((char *user, RCSNode *rcs, char *rev,
00047                char *repository));
00048 static int precommit_list_proc PROTO((Node * p, void *closure));
00049 static int precommit_proc PROTO((char *repository, char *filter));
00050 static int remove_file PROTO ((struct file_info *finfo, char *tag,
00051                    char *message));
00052 static void fixaddfile PROTO((char *file, char *repository));
00053 static void fixbranch PROTO((RCSNode *, char *branch));
00054 static void unlockrcs PROTO((RCSNode *rcs));
00055 static void ci_delproc PROTO((Node *p));
00056 static void masterlist_delproc PROTO((Node *p));
00057 static char *locate_rcs PROTO((char *file, char *repository));
00058
00059 struct commit_info
00060 {
00061     Ctype status;           /* as returned from Classify_File() */
00062     char *rev;              /* a numeric rev, if we know it */
00063     char *tag;              /* any sticky tag, or -r option */
00064     char *options;          /* Any sticky -k option */
00065 };
00066 struct master_lists
00067 {
00068     List *ulist;            /* list for Update_Logfile */
00069     List *cilist;           /* list with commit_info structs */
00070 };
00071
00072 static int force_ci = 0;
00073 static int got_message;
00074 static int run_module_prog = 1;
00075 static int aflag;
00076 static char *saved_tag;
00077 static char *write_dirtag;
00078 static int write_dirnonbranch;
00079 static char *logfile;
00080 static List *mulist;
00081 static List *saved_ulist;
00082 static char *saved_message;
00083 static time_t last_register_time;
00084
00085 static const char *const commit_usage[] =
00086 {
00087     "Usage: %s %s [-nRlf] [-m msg | -F logfile] [-r rev] files...\n",
00088     "\t-n\tDo not run the module program (if any).\n",
00089     "\t-R\tProcess directories recursively.\n",
00090     "\t-l\tLocal directory only (not recursive).\n",
00091     "\t-f\tForce the file to be committed; disables recursion.\n",
00092     "\t-F file\tRead the log message from file.\n",
00093     "\t-m msg\tLog message.\n",
00094     "\t-r rev\tCommit to this branch or trunk revision.\n",
00095     "(Specify the --help global option for a list of other help options)\n",
00096     NULL
00097 };
00098
00099 #ifdef CLIENT_SUPPORT
00100 /* Identify a file which needs "? foo" or a Questionable request.  */
00101 struct question {
00102     /* The two fields for the Directory request.  */
00103     char *dir;
00104     char *repos;
00105
00106     /* The file name.  */
00107     char *file;
00108
00109     struct question *next;
00110 };
00111
00112 struct find_data {
00113     List *ulist;
00114     int argc;
00115     char **argv;
00116
00117     /* This is used from dirent to filesdone time, for each directory,
00118        to make a list of files we have already seen.  */
00119     List *ignlist;
00120
00121     /* Linked list of files which need "? foo" or a Questionable request.  */
00122     struct question *questionables;
00123
00124     /* Only good within functions called from the filesdoneproc.  Stores
00125        the repository (pointer into storage managed by the recursion
00126        processor.  */
00127     char *repository;
00128
00129     /* Non-zero if we should force the commit.  This is enabled by
00130        either -f or -r options, unlike force_ci which is just -f.  */
00131     int force;
00132 };
00133
00134 static Dtype find_dirent_proc PROTO ((void *callerdat, char *dir,
00135                       char *repository, char *update_dir,
00136                       List *entries));
00137
00138 static Dtype
00139 find_dirent_proc (callerdat, dir, repository, update_dir, entries)
00140     void *callerdat;
00141     char *dir;
00142     char *repository;
00143     char *update_dir;
00144     List *entries;
00145 {
00146     struct find_data *find_data = (struct find_data *)callerdat;
00147
00148     /* This check seems to slowly be creeping throughout CVS (update
00149        and send_dirent_proc by CVS 1.5, diff in 31 Oct 1995.  My guess
00150        is that it (or some variant thereof) should go in all the
00151        dirent procs.  Unless someone has some better idea...  */
00152     if (!isdir (dir))
00153     return (R_SKIP_ALL);
00154
00155     /* initialize the ignore list for this directory */
00156     find_data->ignlist = getlist ();
00157
00158     /* Print the same warm fuzzy as in check_direntproc, since that
00159        code will never be run during client/server operation and we
00160        want the messages to match. */
00161     if (!quiet)
00162     error (0, 0, "Examining %s", update_dir);
00163
00164     return R_PROCESS;
00165 }
00166
00167 /* Here as a static until we get around to fixing ignore_files to pass
00168    it along as an argument.  */
00169 static struct find_data *find_data_static;
00170
00171 static void find_ignproc PROTO ((char *, char *));
00172
00173 static void
00174 find_ignproc (file, dir)
00175     char *file;
00176     char *dir;
00177 {
00178     struct question *p;
00179
00180     p = (struct question *) xmalloc (sizeof (struct question));
00181     p->dir = xstrdup (dir);
00182     p->repos = xstrdup (find_data_static->repository);
00183     p->file = xstrdup (file);
00184     p->next = find_data_static->questionables;
00185     find_data_static->questionables = p;
00186 }
00187
00188 static int find_filesdoneproc PROTO ((void *callerdat, int err,
00189                       char *repository, char *update_dir,
00190                       List *entries));
00191
00192 static int
00193 find_filesdoneproc (callerdat, err, repository, update_dir, entries)
00194     void *callerdat;
00195     int err;
00196     char *repository;
00197     char *update_dir;
00198     List *entries;
00199 {
00200     struct find_data *find_data = (struct find_data *)callerdat;
00201     find_data->repository = repository;
00202
00203     /* if this directory has an ignore list, process it then free it */
00204     if (find_data->ignlist)
00205     {
00206     find_data_static = find_data;
00207     ignore_files (find_data->ignlist, entries, update_dir, find_ignproc);
00208     dellist (&find_data->ignlist);
00209     }
00210
00211     find_data->repository = NULL;
00212
00213     return err;
00214 }
00215
00216 static int find_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00217
00218 /* Machinery to find out what is modified, added, and removed.  It is
00219    possible this should be broken out into a new client_classify function;
00220    merging it with classify_file is almost sure to be a mess, though,
00221    because classify_file has all kinds of repository processing.  */
00222 static int
00223 find_fileproc (callerdat, finfo)
00224     void *callerdat;
00225     struct file_info *finfo;
00226 {
00227     Vers_TS *vers;
00228     enum classify_type status;
00229     Node *node;
00230     struct find_data *args = (struct find_data *)callerdat;
00231     struct logfile_info *data;
00232     struct file_info xfinfo;
00233
00234     /* if this directory has an ignore list, add this file to it */
00235     if (args->ignlist)
00236     {
00237     Node *p;
00238
00239     p = getnode ();
00240     p->type = FILES;
00241     p->key = xstrdup (finfo->file);
00242     if (addnode (args->ignlist, p) != 0)
00243         freenode (p);
00244     }
00245
00246     xfinfo = *finfo;
00247     xfinfo.repository = NULL;
00248     xfinfo.rcs = NULL;
00249
00250     vers = Version_TS (&xfinfo, NULL, saved_tag, NULL, 0, 0);
00251     if (vers->ts_user == NULL
00252     && vers->vn_user != NULL
00253     && vers->vn_user[0] == '-')
00254     /* FIXME: If vn_user is starts with "-" but ts_user is
00255        non-NULL, what classify_file does is print "%s should be
00256        removed and is still there".  I'm not sure what it does
00257        then.  We probably should do the same.  */
00258     status = T_REMOVED;
00259     else if (vers->vn_user == NULL)
00260     {
00261     if (vers->ts_user == NULL)
00262         error (0, 0, "nothing known about `%s'", finfo->fullname);
00263     else
00264         error (0, 0, "use `%s add' to create an entry for %s",
00265            program_name, finfo->fullname);
00266     freevers_ts (&vers);
00267     return 1;
00268     }
00269     else if (vers->ts_user != NULL
00270          && vers->vn_user != NULL
00271          && vers->vn_user[0] == '0')
00272     /* FIXME: If vn_user is "0" but ts_user is NULL, what classify_file
00273        does is print "new-born %s has disappeared" and removes the entry.
00274        We probably should do the same.  */
00275     status = T_ADDED;
00276     else if (vers->ts_user != NULL
00277          && vers->ts_rcs != NULL
00278          && (args->force || strcmp (vers->ts_user, vers->ts_rcs) != 0))
00279     /* If we are forcing commits, pretend that the file is
00280            modified.  */
00281     status = T_MODIFIED;
00282     else
00283     {
00284     /* This covers unmodified files, as well as a variety of other
00285        cases.  FIXME: we probably should be printing a message and
00286        returning 1 for many of those cases (but I'm not sure
00287        exactly which ones).  */
00288     freevers_ts (&vers);
00289     return 0;
00290     }
00291
00292     node = getnode ();
00293     node->key = xstrdup (finfo->fullname);
00294
00295     data = (struct logfile_info *) xmalloc (sizeof (struct logfile_info));
00296     data->type = status;
00297     data->tag = xstrdup (vers->tag);
00298     data->rev_old = data->rev_new = NULL;
00299
00300     node->type = UPDATE;
00301     node->delproc = update_delproc;
00302     node->data = (char *) data;
00303     (void)addnode (args->ulist, node);
00304
00305     ++args->argc;
00306
00307     freevers_ts (&vers);
00308     return 0;
00309 }
00310
00311 static int copy_ulist PROTO ((Node *, void *));
00312
00313 static int
00314 copy_ulist (node, data)
00315     Node *node;
00316     void *data;
00317 {
00318     struct find_data *args = (struct find_data *)data;
00319     args->argv[args->argc++] = node->key;
00320     return 0;
00321 }
00322 #endif /* CLIENT_SUPPORT */
00323
00324 int
00325 commit (argc, argv)
00326     int argc;
00327     char **argv;
00328 {
00329     int c;
00330     int err = 0;
00331     int local = 0;
00332
00333     if (argc == -1)
00334     usage (commit_usage);
00335
00336 #ifdef CVS_BADROOT
00337     /*
00338      * For log purposes, do not allow "root" to commit files.  If you look
00339      * like root, but are really logged in as a non-root user, it's OK.
00340      */
00341     /* FIXME: Shouldn't this check be much more closely related to the
00342        readonly user stuff (CVSROOT/readers, &c).  That is, why should
00343        root be able to "cvs init", "cvs import", &c, but not "cvs ci"?  */
00344     if (geteuid () == (uid_t) 0
00345 #  ifdef CLIENT_SUPPORT
00346     /* Who we are on the client side doesn't affect logging.  */
00347     && !client_active
00348 #  endif
00349     )
00350     {
00351     struct passwd *pw;
00352
00353     if ((pw = (struct passwd *) getpwnam (getcaller ())) == NULL)
00354         error (1, 0, "you are unknown to this system");
00355     if (pw->pw_uid == (uid_t) 0)
00356         error (1, 0, "cannot commit files as 'root'");
00357     }
00358 #endif /* CVS_BADROOT */
00359
00360     optind = 0;
00361     while ((c = getopt (argc, argv, "+nlRm:fF:r:")) != -1)
00362     {
00363     switch (c)
00364     {
00365         case 'n':
00366         run_module_prog = 0;
00367         break;
00368         case 'm':
00369 #ifdef FORCE_USE_EDITOR
00370         use_editor = 1;
00371 #else
00372         use_editor = 0;
00373 #endif
00374         if (saved_message)
00375         {
00376             free (saved_message);
00377             saved_message = NULL;
00378         }
00379
00380         saved_message = xstrdup(optarg);
00381         break;
00382         case 'r':
00383         if (saved_tag)
00384             free (saved_tag);
00385         saved_tag = xstrdup (optarg);
00386         break;
00387         case 'l':
00388         local = 1;
00389         break;
00390         case 'R':
00391         local = 0;
00392         break;
00393         case 'f':
00394         force_ci = 1;
00395         local = 1;      /* also disable recursion */
00396         break;
00397         case 'F':
00398 #ifdef FORCE_USE_EDITOR
00399         use_editor = 1;
00400 #else
00401         use_editor = 0;
00402 #endif
00403         logfile = optarg;
00404         break;
00405         case '?':
00406         default:
00407         usage (commit_usage);
00408         break;
00409     }
00410     }
00411     argc -= optind;
00412     argv += optind;
00413
00414 #ifdef DIRTY_MODDATE
00415     enable_dirty = 1;
00416     if(argc == 1 && isdirty_file(argv[0]))
00417         enable_dirty = 0;
00418 #endif
00419
00420     /* numeric specified revision means we ignore sticky tags... */
00421     if (saved_tag && isdigit ((unsigned char) *saved_tag))
00422     {
00423     aflag = 1;
00424     /* strip trailing dots */
00425     while (saved_tag[strlen (saved_tag) - 1] == '.')
00426         saved_tag[strlen (saved_tag) - 1] = '\0';
00427     }
00428
00429     /* some checks related to the "-F logfile" option */
00430     if (logfile)
00431     {
00432     size_t size = 0, len;
00433
00434     if (saved_message)
00435         error (1, 0, "cannot specify both a message and a log file");
00436
00437     get_file (logfile, logfile, "r", &saved_message, &size, &len);
00438     }
00439
00440 #ifdef CLIENT_SUPPORT
00441     if (client_active)
00442     {
00443     struct find_data find_args;
00444
00445     ign_setup ();
00446
00447     find_args.ulist = getlist ();
00448     find_args.argc = 0;
00449     find_args.questionables = NULL;
00450     find_args.ignlist = NULL;
00451     find_args.repository = NULL;
00452
00453     /* It is possible that only a numeric tag should set this.
00454        I haven't really thought about it much.
00455        Anyway, I suspect that setting it unnecessarily only causes
00456        a little unneeded network traffic.  */
00457     find_args.force = force_ci || saved_tag != NULL;
00458
00459     err = start_recursion (find_fileproc, find_filesdoneproc,
00460                    find_dirent_proc, (DIRLEAVEPROC) NULL,
00461                    (void *)&find_args,
00462                    argc, argv, local, W_LOCAL, 0, 0,
00463                    (char *)NULL, 0);
00464     if (err)
00465         error (1, 0, "correct above errors first!");
00466
00467     if (find_args.argc == 0)
00468     {
00469         /* Nothing to commit.  Exit now without contacting the
00470            server (note that this means that we won't print "?
00471            foo" for files which merit it, because we don't know
00472            what is in the CVSROOT/cvsignore file).  */
00473         dellist (&find_args.ulist);
00474         return 0;
00475     }
00476
00477     /* Now we keep track of which files we actually are going to
00478        operate on, and only work with those files in the future.
00479        This saves time--we don't want to search the file system
00480        of the working directory twice.  */
00481     find_args.argv = (char **) xmalloc (find_args.argc * sizeof (char **));
00482     find_args.argc = 0;
00483     walklist (find_args.ulist, copy_ulist, &find_args);
00484
00485     /* Do this before calling do_editor; don't ask for a log
00486        message if we can't talk to the server.  But do it after we
00487        have made the checks that we can locally (to more quickly
00488        catch syntax errors, the case where no files are modified,
00489        added or removed, etc.).
00490
00491        On the other hand, calling start_server before do_editor
00492        means that we chew up server resources the whole time that
00493        the user has the editor open (hours or days if the user
00494        forgets about it), which seems dubious.  */
00495     start_server ();
00496
00497     /*
00498      * We do this once, not once for each directory as in normal CVS.
00499      * The protocol is designed this way.  This is a feature.
00500      */
00501     if (use_editor)
00502         do_editor (".", &saved_message, (char *)NULL, find_args.ulist);
00503
00504     /* Run the user-defined script to verify/check information in
00505      *the log message
00506      */
00507     do_verify (saved_message, (char *)NULL);
00508
00509     /* We always send some sort of message, even if empty.  */
00510     /* FIXME: is that true?  There seems to be some code in do_editor
00511        which can leave the message NULL.  */
00512     option_with_arg ("-m", saved_message);
00513
00514     /* OK, now process all the questionable files we have been saving
00515        up.  */
00516     {
00517         struct question *p;
00518         struct question *q;
00519
00520         p = find_args.questionables;
00521         while (p != NULL)
00522         {
00523         if (ign_inhibit_server || !supported_request ("Questionable"))
00524         {
00525             cvs_output ("? ", 2);
00526             if (p->dir[0] != '\0')
00527             {
00528             cvs_output (p->dir, 0);
00529             cvs_output ("/", 1);
00530             }
00531             cvs_output (p->file, 0);
00532             cvs_output ("\n", 1);
00533         }
00534         else
00535         {
00536             send_to_server ("Directory ", 0);
00537             send_to_server (p->dir[0] == '\0' ? "." : p->dir, 0);
00538             send_to_server ("\012", 1);
00539             send_to_server (p->repos, 0);
00540             send_to_server ("\012", 1);
00541
00542             send_to_server ("Questionable ", 0);
00543             send_to_server (p->file, 0);
00544             send_to_server ("\012", 1);
00545         }
00546         free (p->dir);
00547         free (p->repos);
00548         free (p->file);
00549         q = p->next;
00550         free (p);
00551         p = q;
00552         }
00553     }
00554
00555     if (local)
00556         send_arg("-l");
00557     if (force_ci)
00558         send_arg("-f");
00559     if (!run_module_prog)
00560         send_arg("-n");
00561     option_with_arg ("-r", saved_tag);
00562
00563     /* FIXME: This whole find_args.force/SEND_FORCE business is a
00564        kludge.  It would seem to be a server bug that we have to
00565        say that files are modified when they are not.  This makes
00566        "cvs commit -r 2" across a whole bunch of files a very slow
00567        operation (and it isn't documented in cvsclient.texi).  I
00568        haven't looked at the server code carefully enough to be
00569        _sure_ why this is needed, but if it is because the "ci"
00570        program, which we used to call, wanted the file to exist,
00571        then it would be relatively simple to fix in the server.  */
00572     send_files (find_args.argc, find_args.argv, local, 0,
00573             find_args.force ? SEND_FORCE : 0);
00574
00575     /* Sending only the names of the files which were modified, added,
00576        or removed means that the server will only do an up-to-date
00577        check on those files.  This is different from local CVS and
00578        previous versions of client/server CVS, but it probably is a Good
00579        Thing, or at least Not Such A Bad Thing.  */
00580     send_file_names (find_args.argc, find_args.argv, 0);
00581     free (find_args.argv);
00582     dellist (&find_args.ulist);
00583
00584     send_to_server ("ci\012", 0);
00585     err = get_responses_and_close ();
00586     if (err != 0 && use_editor && saved_message != NULL)
00587     {
00588         /* If there was an error, don't nuke the user's carefully
00589            constructed prose.  This is something of a kludge; a better
00590            solution is probably more along the lines of #150 in TODO
00591            (doing a second up-to-date check before accepting the
00592            log message has also been suggested, but that seems kind of
00593            iffy because the real up-to-date check could still fail,
00594            another error could occur, &c.  Also, a second check would
00595            slow things down).  */
00596
00597         char *fname;
00598         FILE *fp;
00599
00600         fname = cvs_temp_name ();
00601         fp = CVS_FOPEN (fname, "w+");
00602         if (fp == NULL)
00603         error (1, 0, "cannot create temporary file %s", fname);
00604         if (fwrite (saved_message, 1, strlen (saved_message), fp)
00605         != strlen (saved_message))
00606         error (1, errno, "cannot write temporary file %s", fname);
00607         if (fclose (fp) < 0)
00608         error (0, errno, "cannot close temporary file %s", fname);
00609         error (0, 0, "saving log message in %s", fname);
00610     }
00611     return err;
00612     }
00613 #endif
00614
00615     if (saved_tag != NULL)
00616     tag_check_valid (saved_tag, argc, argv, local, aflag, "");
00617
00618     /* XXX - this is not the perfect check for this */
00619     if (argc <= 0)
00620     write_dirtag = saved_tag;
00621
00622     wrap_setup ();
00623
00624     lock_tree_for_write (argc, argv, local, aflag);
00625
00626     /*
00627      * Set up the master update list and hard link list
00628      */
00629     mulist = getlist ();
00630
00631 #ifdef PRESERVE_PERMISSIONS_SUPPORT
00632     if (preserve_perms)
00633     {
00634     hardlist = getlist ();
00635
00636     /*
00637      * We need to save the working directory so that
00638      * check_fileproc can construct a full pathname for each file.
00639      */
00640     working_dir = xgetwd();
00641     }
00642 #endif
00643
00644     /*
00645      * Run the recursion processor to verify the files are all up-to-date
00646      */
00647     err = start_recursion (check_fileproc, check_filesdoneproc,
00648                check_direntproc, (DIRLEAVEPROC) NULL, NULL, argc,
00649                argv, local, W_LOCAL, aflag, 0, (char *) NULL, 1);
00650     if (err)
00651     {
00652     Lock_Cleanup ();
00653     error (1, 0, "correct above errors first!");
00654     }
00655
00656     /*
00657      * Run the recursion processor to commit the files
00658      */
00659     write_dirnonbranch = 0;
00660     if (noexec == 0)
00661     err = start_recursion (commit_fileproc, commit_filesdoneproc,
00662                    commit_direntproc, commit_dirleaveproc, NULL,
00663                    argc, argv, local, W_LOCAL, aflag, 0,
00664                    (char *) NULL, 1);
00665
00666     /*
00667      * Unlock all the dirs and clean up
00668      */
00669     Lock_Cleanup ();
00670     dellist (&mulist);
00671
00672     /* see if we need to sleep before returning to avoid time-stamp races */
00673     if (last_register_time)
00674     {
00675     while (time ((time_t *) NULL) == last_register_time)
00676         sleep (1);
00677     }
00678
00679     return (err);
00680 }
00681
00682 /* This routine determines the status of a given file and retrieves
00683    the version information that is associated with that file. */
00684
00685 static
00686 Ctype
00687 classify_file_internal (finfo, vers)
00688     struct file_info *finfo;
00689     Vers_TS **vers;
00690 {
00691     int save_noexec, save_quiet, save_really_quiet;
00692     Ctype status;
00693
00694     /* FIXME: Do we need to save quiet as well as really_quiet?  Last
00695        time I glanced at Classify_File I only saw it looking at really_quiet
00696        not quiet.  */
00697     save_noexec = noexec;
00698     save_quiet = quiet;
00699     save_really_quiet = really_quiet;
00700     noexec = quiet = really_quiet = 1;
00701
00702     /* handle specified numeric revision specially */
00703     if (saved_tag && isdigit ((unsigned char) *saved_tag))
00704     {
00705     /* If the tag is for the trunk, make sure we're at the head */
00706     if (numdots (saved_tag) < 2)
00707     {
00708         status = Classify_File (finfo, (char *) NULL, (char *) NULL,
00709                     (char *) NULL, 1, aflag, vers, 0);
00710         if (status == T_UPTODATE || status == T_MODIFIED ||
00711         status == T_ADDED)
00712         {
00713         Ctype xstatus;
00714
00715         freevers_ts (vers);
00716         xstatus = Classify_File (finfo, saved_tag, (char *) NULL,
00717                      (char *) NULL, 1, aflag, vers, 0);
00718         if (xstatus == T_REMOVE_ENTRY)
00719             status = T_MODIFIED;
00720         else if (status == T_MODIFIED && xstatus == T_CONFLICT)
00721             status = T_MODIFIED;
00722         else
00723             status = xstatus;
00724         }
00725     }
00726     else
00727     {
00728         char *xtag, *cp;
00729
00730         /*
00731          * The revision is off the main trunk; make sure we're
00732          * up-to-date with the head of the specified branch.
00733          */
00734         xtag = xstrdup (saved_tag);
00735         if ((numdots (xtag) & 1) != 0)
00736         {
00737         cp = strrchr (xtag, '.');
00738         *cp = '\0';
00739         }
00740         status = Classify_File (finfo, xtag, (char *) NULL,
00741                     (char *) NULL, 1, aflag, vers, 0);
00742         if ((status == T_REMOVE_ENTRY || status == T_CONFLICT)
00743         && (cp = strrchr (xtag, '.')) != NULL)
00744         {
00745         /* pluck one more dot off the revision */
00746         *cp = '\0';
00747         freevers_ts (vers);
00748         status = Classify_File (finfo, xtag, (char *) NULL,
00749                     (char *) NULL, 1, aflag, vers, 0);
00750         if (status == T_UPTODATE || status == T_REMOVE_ENTRY)
00751             status = T_MODIFIED;
00752         }
00753         /* now, muck with vers to make the tag correct */
00754         free ((*vers)->tag);
00755         (*vers)->tag = xstrdup (saved_tag);
00756         free (xtag);
00757     }
00758     }
00759     else
00760     status = Classify_File (finfo, saved_tag, (char *) NULL, (char *) NULL,
00761                 1, 0, vers, 0);
00762     noexec = save_noexec;
00763     quiet = save_quiet;
00764     really_quiet = save_really_quiet;
00765
00766     return status;
00767 }
00768
00769 /*
00770  * Check to see if a file is ok to commit and make sure all files are
00771  * up-to-date
00772  */
00773 /* ARGSUSED */
00774 static int
00775 check_fileproc (callerdat, finfo)
00776     void *callerdat;
00777     struct file_info *finfo;
00778 {
00779     Ctype status;
00780     char *xdir;
00781     Node *p;
00782     List *ulist, *cilist;
00783     Vers_TS *vers;
00784     struct commit_info *ci;
00785     struct logfile_info *li;
00786
00787     size_t cvsroot_len = strlen (CVSroot_directory);
00788
00789     if (!finfo->repository)
00790     {
00791     error (0, 0, "nothing known about `%s'", finfo->fullname);
00792     return (1);
00793     }
00794
00795     if (strncmp (finfo->repository, CVSroot_directory, cvsroot_len) == 0
00796     && ISDIRSEP (finfo->repository[cvsroot_len])
00797     && strncmp (finfo->repository + cvsroot_len + 1,
00798             CVSROOTADM,
00799             sizeof (CVSROOTADM) - 1) == 0
00800     && ISDIRSEP (finfo->repository[cvsroot_len + sizeof (CVSROOTADM)])
00801     && strcmp (finfo->repository + cvsroot_len + sizeof (CVSROOTADM) + 1,
00802            CVSNULLREPOS) == 0
00803     )
00804     error (1, 0, "cannot check in to %s", finfo->repository);
00805
00806     status = classify_file_internal (finfo, &vers);
00807
00808     /*
00809      * If the force-commit option is enabled, and the file in question
00810      * appears to be up-to-date, just make it look modified so that
00811      * it will be committed.
00812      */
00813     if (force_ci && status == T_UPTODATE)
00814     status = T_MODIFIED;
00815
00816     switch (status)
00817     {
00818     case T_CHECKOUT:
00819 #ifdef SERVER_SUPPORT
00820     case T_PATCH:
00821 #endif
00822     case T_NEEDS_MERGE:
00823     case T_CONFLICT:
00824     case T_REMOVE_ENTRY:
00825         error (0, 0, "Up-to-date check failed for `%s'", finfo->fullname);
00826         freevers_ts (&vers);
00827         return (1);
00828     case T_MODIFIED:
00829     case T_ADDED:
00830     case T_REMOVED:
00831         /*
00832          * some quick sanity checks; if no numeric -r option specified:
00833          *  - can't have a sticky date
00834          *  - can't have a sticky tag that is not a branch
00835          * Also,
00836          *  - if status is T_REMOVED, can't have a numeric tag
00837          *  - if status is T_ADDED, rcs file must not exist unless on
00838          *    a branch
00839          *  - if status is T_ADDED, can't have a non-trunk numeric rev
00840          *  - if status is T_MODIFIED and a Conflict marker exists, don't
00841          *    allow the commit if timestamp is identical or if we find
00842          *    an RCS_MERGE_PAT in the file.
00843          */
00844         if (!saved_tag || !isdigit ((unsigned char) *saved_tag))
00845         {
00846         if (vers->date)
00847         {
00848             error (0, 0,
00849                "cannot commit with sticky date for file `%s'",
00850                finfo->fullname);
00851             freevers_ts (&vers);
00852             return (1);
00853         }
00854         if (status == T_MODIFIED && vers->tag &&
00855             !RCS_isbranch (finfo->rcs, vers->tag))
00856         {
00857             error (0, 0,
00858                "sticky tag `%s' for file `%s' is not a branch",
00859                vers->tag, finfo->fullname);
00860             freevers_ts (&vers);
00861             return (1);
00862         }
00863         }
00864         if (status == T_MODIFIED && !force_ci && vers->ts_conflict)
00865         {
00866         char *filestamp;
00867         int retcode;
00868
00869         /*
00870          * We found a "conflict" marker.
00871          *
00872          * If the timestamp on the file is the same as the
00873          * timestamp stored in the Entries file, we block the commit.
00874          */
00875 #ifdef SERVER_SUPPORT
00876         if (server_active)
00877             retcode = vers->ts_conflict[0] != '=';
00878         else {
00879             filestamp = time_stamp (finfo->file);
00880             retcode = strcmp (vers->ts_conflict, filestamp);
00881             free (filestamp);
00882         }
00883 #else
00884         filestamp = time_stamp (finfo->file);
00885         retcode = strcmp (vers->ts_conflict, filestamp);
00886         free (filestamp);
00887 #endif
00888         if (retcode == 0)
00889         {
00890             error (0, 0,
00891               "file `%s' had a conflict and has not been modified",
00892                finfo->fullname);
00893             freevers_ts (&vers);
00894             return (1);
00895         }
00896
00897         if (file_has_markers (finfo))
00898         {
00899             /* Make this a warning, not an error, because we have
00900                no way of knowing whether the "conflict indicators"
00901                are really from a conflict or whether they are part
00902                of the document itself (cvs.texinfo and sanity.sh in
00903                CVS itself, for example, tend to want to have strings
00904                like ">>>>>>>" at the start of a line).  Making people
00905                kludge this the way they need to kludge keyword
00906                expansion seems undesirable.  And it is worse than
00907                keyword expansion, because there is no -ko
00908                analogue.  */
00909             error (0, 0,
00910                "\
00911 warning: file `%s' seems to still contain conflict indicators",
00912                finfo->fullname);
00913         }
00914         }
00915
00916         if (status == T_REMOVED
00917         && vers->tag
00918         && isdigit ((unsigned char) *vers->tag))
00919         {
00920         /* Remove also tries to forbid this, but we should check
00921            here.  I'm only _sure_ about somewhat obscure cases
00922            (hacking the Entries file, using an old version of
00923            CVS for the remove and a new one for the commit), but
00924            there might be other cases.  */
00925         error (0, 0,
00926     "cannot remove file `%s' which has a numeric sticky tag of `%s'",
00927                finfo->fullname, vers->tag);
00928         freevers_ts (&vers);
00929         return (1);
00930         }
00931         if (status == T_ADDED)
00932         {
00933             if (vers->tag == NULL)
00934         {
00935             char *rcs;
00936
00937             rcs = xmalloc (strlen (finfo->repository)
00938                    + strlen (finfo->file)
00939                    + sizeof RCSEXT
00940                    + 5);
00941
00942             /* Don't look in the attic; if it exists there we
00943                will move it back out in checkaddfile.  */
00944             sprintf(rcs, "%s/%s%s", finfo->repository, finfo->file,
00945                 RCSEXT);
00946             if (isreadable (rcs))
00947             {
00948             error (0, 0,
00949             "cannot add file `%s' when RCS file `%s' already exists",
00950                    finfo->fullname, rcs);
00951             freevers_ts (&vers);
00952             free (rcs);
00953             return (1);
00954             }
00955             free (rcs);
00956         }
00957         if (vers->tag && isdigit ((unsigned char) *vers->tag) &&
00958             numdots (vers->tag) > 1)
00959         {
00960             error (0, 0,
00961         "cannot add file `%s' with revision `%s'; must be on trunk",
00962                    finfo->fullname, vers->tag);
00963             freevers_ts (&vers);
00964             return (1);
00965         }
00966         }
00967
00968         /* done with consistency checks; now, to get on with the commit */
00969         if (finfo->update_dir[0] == '\0')
00970         xdir = ".";
00971         else
00972         xdir = finfo->update_dir;
00973         if ((p = findnode (mulist, xdir)) != NULL)
00974         {
00975         ulist = ((struct master_lists *) p->data)->ulist;
00976         cilist = ((struct master_lists *) p->data)->cilist;
00977         }
00978         else
00979         {
00980         struct master_lists *ml;
00981
00982         ulist = getlist ();
00983         cilist = getlist ();
00984         p = getnode ();
00985         p->key = xstrdup (xdir);
00986         p->type = UPDATE;
00987         ml = (struct master_lists *)
00988             xmalloc (sizeof (struct master_lists));
00989         ml->ulist = ulist;
00990         ml->cilist = cilist;
00991         p->data = (char *) ml;
00992         p->delproc = masterlist_delproc;
00993         (void) addnode (mulist, p);
00994         }
00995
00996         /* first do ulist, then cilist */
00997         p = getnode ();
00998         p->key = xstrdup (finfo->file);
00999         p->type = UPDATE;
01000         p->delproc = update_delproc;
01001         li = ((struct logfile_info *)
01002           xmalloc (sizeof (struct logfile_info)));
01003         li->type = status;
01004         li->tag = xstrdup (vers->tag);
01005         li->rev_old = xstrdup (vers->vn_rcs);
01006         li->rev_new = NULL;
01007         p->data = (char *) li;
01008         (void) addnode (ulist, p);
01009
01010         p = getnode ();
01011         p->key = xstrdup (finfo->file);
01012         p->type = UPDATE;
01013         p->delproc = ci_delproc;
01014         ci = (struct commit_info *) xmalloc (sizeof (struct commit_info));
01015         ci->status = status;
01016         if (vers->tag)
01017         if (isdigit ((unsigned char) *vers->tag))
01018             ci->rev = xstrdup (vers->tag);
01019         else
01020             ci->rev = RCS_whatbranch (finfo->rcs, vers->tag);
01021         else
01022         ci->rev = (char *) NULL;
01023         ci->tag = xstrdup (vers->tag);
01024         ci->options = xstrdup(vers->options);
01025         p->data = (char *) ci;
01026         (void) addnode (cilist, p);
01027
01028 #ifdef PRESERVE_PERMISSIONS_SUPPORT
01029         if (preserve_perms)
01030         {
01031         /* Add this file to hardlist, indexed on its inode.  When
01032            we are done, we can find out what files are hardlinked
01033            to a given file by looking up its inode in hardlist. */
01034         char *fullpath;
01035         Node *linkp;
01036         struct hardlink_info *hlinfo;
01037
01038         /* Get the full pathname of the current file. */
01039         fullpath = xmalloc (strlen(working_dir) +
01040                     strlen(finfo->fullname) + 2);
01041         sprintf (fullpath, "%s/%s", working_dir, finfo->fullname);
01042
01043         /* To permit following links in subdirectories, files
01044                    are keyed on finfo->fullname, not on finfo->name. */
01045         linkp = lookup_file_by_inode (fullpath);
01046
01047         /* If linkp is NULL, the file doesn't exist... maybe
01048            we're doing a remove operation? */
01049         if (linkp != NULL)
01050         {
01051             /* Create a new hardlink_info node, which will record
01052                the current file's status and the links listed in its
01053                `hardlinks' delta field.  We will append this
01054                hardlink_info node to the appropriate hardlist entry. */
01055             hlinfo = (struct hardlink_info *)
01056             xmalloc (sizeof (struct hardlink_info));
01057             hlinfo->status = status;
01058             linkp->data = (char *) hlinfo;
01059         }
01060         }
01061 #endif
01062
01063         break;
01064     case T_UNKNOWN:
01065         error (0, 0, "nothing known about `%s'", finfo->fullname);
01066         freevers_ts (&vers);
01067         return (1);
01068     case T_UPTODATE:
01069         break;
01070     default:
01071         error (0, 0, "CVS internal error: unknown status %d", status);
01072         break;
01073     }
01074
01075     freevers_ts (&vers);
01076     return (0);
01077 }
01078
01079 /*
01080  * By default, return the code that tells do_recursion to examine all
01081  * directories
01082  */
01083 /* ARGSUSED */
01084 static Dtype
01085 check_direntproc (callerdat, dir, repos, update_dir, entries)
01086     void *callerdat;
01087     char *dir;
01088     char *repos;
01089     char *update_dir;
01090     List *entries;
01091 {
01092     if (!isdir (dir))
01093     return (R_SKIP_ALL);
01094
01095     if (!quiet)
01096     error (0, 0, "Examining %s", update_dir);
01097
01098     return (R_PROCESS);
01099 }
01100
01101 /*
01102  * Walklist proc to run pre-commit checks
01103  */
01104 static int
01105 precommit_list_proc (p, closure)
01106     Node *p;
01107     void *closure;
01108 {
01109     struct logfile_info *li;
01110
01111     li = (struct logfile_info *) p->data;
01112     if (li->type == T_ADDED
01113     || li->type == T_MODIFIED
01114     || li->type == T_REMOVED)
01115     {
01116     run_arg (p->key);
01117     }
01118     return (0);
01119 }
01120
01121 /*
01122  * Callback proc for pre-commit checking
01123  */
01124 static int
01125 precommit_proc (repository, filter)
01126     char *repository;
01127     char *filter;
01128 {
01129     /* see if the filter is there, only if it's a full path */
01130     if (isabsolute (filter))
01131     {
01132         char *s, *cp;
01133
01134     s = xstrdup (filter);
01135     for (cp = s; *cp; cp++)
01136         if (isspace ((unsigned char) *cp))
01137         {
01138         *cp = '\0';
01139         break;
01140         }
01141     if (!isfile (s))
01142     {
01143         error (0, errno, "cannot find pre-commit filter `%s'", s);
01144         free (s);
01145         return (1);         /* so it fails! */
01146     }
01147     free (s);
01148     }
01149
01150     run_setup (filter);
01151     run_arg (repository);
01152     (void) walklist (saved_ulist, precommit_list_proc, NULL);
01153     return (run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY));
01154 }
01155
01156 /*
01157  * Run the pre-commit checks for the dir
01158  */
01159 /* ARGSUSED */
01160 static int
01161 check_filesdoneproc (callerdat, err, repos, update_dir, entries)
01162     void *callerdat;
01163     int err;
01164     char *repos;
01165     char *update_dir;
01166     List *entries;
01167 {
01168     int n;
01169     Node *p;
01170
01171     /* find the update list for this dir */
01172     p = findnode (mulist, update_dir);
01173     if (p != NULL)
01174     saved_ulist = ((struct master_lists *) p->data)->ulist;
01175     else
01176     saved_ulist = (List *) NULL;
01177
01178     /* skip the checks if there's nothing to do */
01179     if (saved_ulist == NULL || saved_ulist->list->next == saved_ulist->list)
01180     return (err);
01181
01182     /* run any pre-commit checks */
01183     if ((n = Parse_Info (CVSROOTADM_COMMITINFO, repos, precommit_proc, 1)) > 0)
01184     {
01185     error (0, 0, "Pre-commit check failed");
01186     err += n;
01187     }
01188
01189     return (err);
01190 }
01191
01192 /*
01193  * Do the work of committing a file
01194  */
01195 static int maxrev;
01196 static char *sbranch;
01197
01198 /* ARGSUSED */
01199 static int
01200 commit_fileproc (callerdat, finfo)
01201     void *callerdat;
01202     struct file_info *finfo;
01203 {
01204     Node *p;
01205     int err = 0;
01206     List *ulist, *cilist;
01207     struct commit_info *ci;
01208
01209     /* Keep track of whether write_dirtag is a branch tag.
01210        Note that if it is a branch tag in some files and a nonbranch tag
01211        in others, treat it as a nonbranch tag.  It is possible that case
01212        should elicit a warning or an error.  */
01213     if (write_dirtag != NULL
01214     && finfo->rcs != NULL)
01215     {
01216     char *rev = RCS_getversion (finfo->rcs, write_dirtag, NULL, 1, NULL);
01217     if (rev != NULL
01218         && !RCS_nodeisbranch (finfo->rcs, write_dirtag))
01219         write_dirnonbranch = 1;
01220     if (rev != NULL)
01221         free (rev);
01222     }
01223
01224     if (finfo->update_dir[0] == '\0')
01225     p = findnode (mulist, ".");
01226     else
01227     p = findnode (mulist, finfo->update_dir);
01228
01229     /*
01230      * if p is null, there were file type command line args which were
01231      * all up-to-date so nothing really needs to be done
01232      */
01233     if (p == NULL)
01234     return (0);
01235     ulist = ((struct master_lists *) p->data)->ulist;
01236     cilist = ((struct master_lists *) p->data)->cilist;
01237
01238     /*
01239      * At this point, we should have the commit message unless we were called
01240      * with files as args from the command line.  In that latter case, we
01241      * need to get the commit message ourselves
01242      */
01243     if (!(got_message))
01244     {
01245     got_message = 1;
01246     if (use_editor)
01247         do_editor (finfo->update_dir, &saved_message,
01248                finfo->repository, ulist);
01249     do_verify (saved_message, finfo->repository);
01250     }
01251
01252     p = findnode (cilist, finfo->file);
01253     if (p == NULL)
01254     return (0);
01255
01256     ci = (struct commit_info *) p->data;
01257     if (ci->status == T_MODIFIED)
01258     {
01259     if (finfo->rcs == NULL)
01260         error (1, 0, "internal error: no parsed RCS file");
01261     if (lock_RCS (finfo->file, finfo->rcs, ci->rev,
01262               finfo->repository) != 0)
01263     {
01264         unlockrcs (finfo->rcs);
01265         err = 1;
01266         goto out;
01267     }
01268     }
01269     else if (ci->status == T_ADDED)
01270     {
01271     if (checkaddfile (finfo->file, finfo->repository, ci->tag, ci->options,
01272               &finfo->rcs) != 0)
01273     {
01274         fixaddfile (finfo->file, finfo->repository);
01275         err = 1;
01276         goto out;
01277     }
01278
01279     /* adding files with a tag, now means adding them on a branch.
01280        Since the branch test was done in check_fileproc for
01281        modified files, we need to stub it in again here. */
01282
01283     if (ci->tag
01284
01285         /* If numeric, it is on the trunk; check_fileproc enforced
01286            this.  */
01287         && !isdigit ((unsigned char) ci->tag[0]))
01288     {
01289         if (finfo->rcs == NULL)
01290         error (1, 0, "internal error: no parsed RCS file");
01291         if (ci->rev)
01292         free (ci->rev);
01293         ci->rev = RCS_whatbranch (finfo->rcs, ci->tag);
01294         err = Checkin ('A', finfo, finfo->rcs->path, ci->rev,
01295                ci->tag, ci->options, saved_message);
01296         if (err != 0)
01297         {
01298         unlockrcs (finfo->rcs);
01299         fixbranch (finfo->rcs, sbranch);
01300         }
01301
01302         (void) time (&last_register_time);
01303
01304         ci->status = T_UPTODATE;
01305     }
01306     }
01307
01308     /*
01309      * Add the file for real
01310      */
01311     if (ci->status == T_ADDED)
01312     {
01313     char *xrev = (char *) NULL;
01314
01315     if (ci->rev == NULL)
01316     {
01317         /* find the max major rev number in this directory */
01318         maxrev = 0;
01319         (void) walklist (finfo->entries, findmaxrev, NULL);
01320         if (maxrev == 0)
01321         maxrev = 1;
01322         xrev = xmalloc (20);
01323         (void) sprintf (xrev, "%d", maxrev);
01324     }
01325
01326     /* XXX - an added file with symbolic -r should add tag as well */
01327     err = finaladd (finfo, ci->rev ? ci->rev : xrev, ci->tag, ci->options);
01328     if (xrev)
01329         free (xrev);
01330     }
01331     else if (ci->status == T_MODIFIED)
01332     {
01333     err = Checkin ('M', finfo,
01334                finfo->rcs->path, ci->rev, ci->tag,
01335                ci->options, saved_message);
01336
01337     (void) time (&last_register_time);
01338
01339     if (err != 0)
01340     {
01341         unlockrcs (finfo->rcs);
01342         fixbranch (finfo->rcs, sbranch);
01343     }
01344     }
01345     else if (ci->status == T_REMOVED)
01346     {
01347     err = remove_file (finfo, ci->tag, saved_message);
01348 #ifdef SERVER_SUPPORT
01349     if (server_active) {
01350         server_scratch_entry_only ();
01351         server_updated (finfo,
01352                 NULL,
01353
01354                 /* Doesn't matter, it won't get checked.  */
01355                 SERVER_UPDATED,
01356
01357                 (mode_t) -1,
01358                 (unsigned char *) NULL,
01359                 (struct buffer *) NULL);
01360     }
01361 #endif
01362     }
01363
01364     /* Clearly this is right for T_MODIFIED.  I haven't thought so much
01365        about T_ADDED or T_REMOVED.  */
01366     notify_do ('C', finfo->file, getcaller (), NULL, NULL, finfo->repository);
01367
01368 out:
01369     if (err != 0)
01370     {
01371     /* on failure, remove the file from ulist */
01372     p = findnode (ulist, finfo->file);
01373     if (p)
01374         delnode (p);
01375     }
01376     else
01377     {
01378     /* On success, retrieve the new version number of the file and
01379            copy it into the log information (see logmsg.c
01380            (logfile_write) for more details).  We should only update
01381            the version number for files that have been added or
01382            modified but not removed.  Why?  classify_file_internal
01383            will return the version number of a file even after it has
01384            been removed from the archive, which is not the behavior we
01385            want for our commitlog messages; we want the old version
01386            number and then "NONE." */
01387
01388     if (ci->status != T_REMOVED)
01389     {
01390         p = findnode (ulist, finfo->file);
01391         if (p)
01392         {
01393         Vers_TS *vers;
01394         struct logfile_info *li;
01395
01396         (void) classify_file_internal (finfo, &vers);
01397         li = (struct logfile_info *) p->data;
01398         li->rev_new = xstrdup (vers->vn_rcs);
01399         freevers_ts (&vers);
01400         }
01401     }
01402     }
01403     if (SIG_inCrSect ())
01404     SIG_endCrSect ();
01405
01406     return (err);
01407 }
01408
01409 /*
01410  * Log the commit and clean up the update list
01411  */
01412 /* ARGSUSED */
01413 static int
01414 commit_filesdoneproc (callerdat, err, repository, update_dir, entries)
01415     void *callerdat;
01416     int err;
01417     char *repository;
01418     char *update_dir;
01419     List *entries;
01420 {
01421     Node *p;
01422     List *ulist;
01423
01424     p = findnode (mulist, update_dir);
01425     if (p == NULL)
01426     return (err);
01427
01428     ulist = ((struct master_lists *) p->data)->ulist;
01429
01430     got_message = 0;
01431
01432
01433     Update_Logfile (repository, saved_message, (FILE *) 0, ulist);
01434
01435     /* Build the administrative files if necessary.  */
01436     {
01437     char *p;
01438
01439     if (strncmp (CVSroot_directory, repository,
01440              strlen (CVSroot_directory)) != 0)
01441         error (0, 0,
01442          "internal error: repository (%s) doesn't begin with root (%s)",
01443            repository, CVSroot_directory);
01444     p = repository + strlen (CVSroot_directory);
01445     if (*p == '/')
01446         ++p;
01447     if (strcmp ("CVSROOT", p) == 0
01448         /* Check for subdirectories because people may want to create
01449            subdirectories and list files therein in checkoutlist.  */
01450         || strncmp ("CVSROOT/", p, strlen ("CVSROOT/")) == 0
01451         )
01452     {
01453         /* "Database" might a little bit grandiose and/or vague,
01454            but "checked-out copies of administrative files, unless
01455            in the case of modules and you are using ndbm in which
01456            case modules.{pag,dir,db}" is verbose and excessively
01457            focused on how the database is implemented.  */
01458
01459         /* mkmodules requires the absolute name of the CVSROOT directory.
01460            Remove anything after the `CVSROOT' component -- this is
01461            necessary when committing in a subdirectory of CVSROOT.  */
01462         char *admin_dir = xstrdup (repository);
01463         int cvsrootlen = strlen ("CVSROOT");
01464         assert (admin_dir[p - repository + cvsrootlen] == '\0'
01465             || admin_dir[p - repository + cvsrootlen] == '/');
01466         admin_dir[p - repository + cvsrootlen] = '\0';
01467
01468         cvs_output (program_name, 0);
01469         cvs_output (" ", 1);
01470         cvs_output (command_name, 0);
01471         cvs_output (": Rebuilding administrative file database\n", 0);
01472         mkmodules (admin_dir);
01473         free (admin_dir);
01474     }
01475     }
01476
01477     if (err == 0 && run_module_prog)
01478     {
01479     FILE *fp;
01480
01481     if ((fp = CVS_FOPEN (CVSADM_CIPROG, "r")) != NULL)
01482     {
01483         char *line;
01484         int line_length;
01485         size_t line_chars_allocated;
01486         char *repos;
01487
01488         line = NULL;
01489         line_chars_allocated = 0;
01490         line_length = getline (&line, &line_chars_allocated, fp);
01491         if (line_length > 0)
01492         {
01493         /* Remove any trailing newline.  */
01494         if (line[line_length - 1] == '\n')
01495             line[--line_length] = '\0';
01496         repos = Name_Repository ((char *) NULL, update_dir);
01497         run_setup (line);
01498         run_arg (repos);
01499         cvs_output (program_name, 0);
01500         cvs_output (" ", 1);
01501         cvs_output (command_name, 0);
01502         cvs_output (": Executing '", 0);
01503         run_print (stdout);
01504         cvs_output ("'\n", 0);
01505         cvs_flushout ();
01506         (void) run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL);
01507         free (repos);
01508         }
01509         else
01510         {
01511         if (ferror (fp))
01512             error (0, errno, "warning: error reading %s",
01513                CVSADM_CIPROG);
01514         }
01515         if (line != NULL)
01516         free (line);
01517         if (fclose (fp) < 0)
01518         error (0, errno, "warning: cannot close %s", CVSADM_CIPROG);
01519     }
01520     else
01521     {
01522         if (! existence_error (errno))
01523         error (0, errno, "warning: cannot open %s", CVSADM_CIPROG);
01524     }
01525     }
01526
01527     return (err);
01528 }
01529
01530 /*
01531  * Get the log message for a dir
01532  */
01533 /* ARGSUSED */
01534 static Dtype
01535 commit_direntproc (callerdat, dir, repos, update_dir, entries)
01536     void *callerdat;
01537     char *dir;
01538     char *repos;
01539     char *update_dir;
01540     List *entries;
01541 {
01542     Node *p;
01543     List *ulist;
01544     char *real_repos;
01545
01546     if (!isdir (dir))
01547     return (R_SKIP_ALL);
01548
01549     /* find the update list for this dir */
01550     p = findnode (mulist, update_dir);
01551     if (p != NULL)
01552     ulist = ((struct master_lists *) p->data)->ulist;
01553     else
01554     ulist = (List *) NULL;
01555
01556     /* skip the files as an optimization */
01557     if (ulist == NULL || ulist->list->next == ulist->list)
01558     return (R_SKIP_FILES);
01559
01560     /* get commit message */
01561     real_repos = Name_Repository (dir, update_dir);
01562     got_message = 1;
01563     if (use_editor)
01564     do_editor (update_dir, &saved_message, real_repos, ulist);
01565     do_verify (saved_message, real_repos);
01566     free (real_repos);
01567     return (R_PROCESS);
01568 }
01569
01570 /*
01571  * Process the post-commit proc if necessary
01572  */
01573 /* ARGSUSED */
01574 static int
01575 commit_dirleaveproc (callerdat, dir, err, update_dir, entries)
01576     void *callerdat;
01577     char *dir;
01578     int err;
01579     char *update_dir;
01580     List *entries;
01581 {
01582     /* update the per-directory tag info */
01583     /* FIXME?  Why?  The "commit examples" node of cvs.texinfo briefly
01584        mentions commit -r being sticky, but apparently in the context of
01585        this being a confusing feature!  */
01586     if (err == 0 && write_dirtag != NULL)
01587     {
01588     char *repos = Name_Repository (dir, update_dir);
01589     WriteTag (NULL, write_dirtag, NULL, write_dirnonbranch,
01590           update_dir, repos);
01591     free (repos);
01592     }
01593
01594     return (err);
01595 }
01596
01597 /*
01598  * find the maximum major rev number in an entries file
01599  */
01600 static int
01601 findmaxrev (p, closure)
01602     Node *p;
01603     void *closure;
01604 {
01605     char *cp;
01606     int thisrev;
01607     Entnode *entdata;
01608
01609     entdata = (Entnode *) p->data;
01610     if (entdata->type != ENT_FILE)
01611     return (0);
01612     cp = strchr (entdata->version, '.');
01613     if (cp != NULL)
01614     *cp = '\0';
01615     thisrev = atoi (entdata->version);
01616     if (cp != NULL)
01617     *cp = '.';
01618     if (thisrev > maxrev)
01619     maxrev = thisrev;
01620     return (0);
01621 }
01622
01623 /*
01624  * Actually remove a file by moving it to the attic
01625  * XXX - if removing a ,v file that is a relative symbolic link to
01626  * another ,v file, we probably should add a ".." component to the
01627  * link to keep it relative after we move it into the attic.
01628
01629    Return value is 0 on success, or >0 on error (in which case we have
01630    printed an error message).  */
01631 static int
01632 remove_file (finfo, tag, message)
01633     struct file_info *finfo;
01634     char *tag;
01635     char *message;
01636 {
01637     int retcode;
01638
01639     int branch;
01640     int lockflag;
01641     char *corev;
01642     char *rev;
01643     char *prev_rev;
01644     char *old_path;
01645
01646     corev = NULL;
01647     rev = NULL;
01648     prev_rev = NULL;
01649
01650     retcode = 0;
01651
01652     if (finfo->rcs == NULL)
01653     error (1, 0, "internal error: no parsed RCS file");
01654
01655     branch = 0;
01656     if (tag && !(branch = RCS_nodeisbranch (finfo->rcs, tag)))
01657     {
01658     /* a symbolic tag is specified; just remove the tag from the file */
01659     if ((retcode = RCS_deltag (finfo->rcs, tag)) != 0)
01660     {
01661         if (!quiet)
01662         error (0, retcode == -1 ? errno : 0,
01663                "failed to remove tag `%s' from `%s'", tag,
01664                finfo->fullname);
01665         return (1);
01666     }
01667     RCS_rewrite (finfo->rcs, NULL, NULL);
01668     Scratch_Entry (finfo->entries, finfo->file);
01669     return (0);
01670     }
01671
01672     /* we are removing the file from either the head or a branch */
01673     /* commit a new, dead revision. */
01674
01675     /* Print message indicating that file is going to be removed. */
01676     cvs_output ("Removing ", 0);
01677     cvs_output (finfo->fullname, 0);
01678     cvs_output (";\n", 0);
01679
01680     rev = NULL;
01681     lockflag = 1;
01682     if (branch)
01683     {
01684     char *branchname;
01685
01686     rev = RCS_whatbranch (finfo->rcs, tag);
01687     if (rev == NULL)
01688     {
01689         error (0, 0, "cannot find branch \"%s\".", tag);
01690         return (1);
01691     }
01692
01693     branchname = RCS_getbranch (finfo->rcs, rev, 1);
01694     if (branchname == NULL)
01695     {
01696         /* no revision exists on this branch.  use the previous
01697            revision but do not lock. */
01698         corev = RCS_gettag (finfo->rcs, tag, 1, (int *) NULL);
01699         prev_rev = xstrdup(rev);
01700         lockflag = 0;
01701     } else
01702     {
01703         corev = xstrdup (rev);
01704         prev_rev = xstrdup(branchname);
01705         free (branchname);
01706     }
01707
01708     } else  /* Not a branch */
01709     {
01710         /* Get current head revision of file. */
01711     prev_rev = RCS_head (finfo->rcs);
01712     }
01713
01714     /* if removing without a tag or a branch, then make sure the default
01715        branch is the trunk. */
01716     if (!tag && !branch)
01717     {
01718         if (RCS_setbranch (finfo->rcs, NULL) != 0)
01719     {
01720         error (0, 0, "cannot change branch to default for %s",
01721            finfo->fullname);
01722         return (1);
01723     }
01724     RCS_rewrite (finfo->rcs, NULL, NULL);
01725     }
01726
01727     /* check something out.  Generally this is the head.  If we have a
01728        particular rev, then name it.  */
01729     retcode = RCS_checkout (finfo->rcs, finfo->file, rev ? corev : NULL,
01730                 (char *) NULL, (char *) NULL, RUN_TTY,
01731                 (RCSCHECKOUTPROC) NULL, (void *) NULL);
01732     if (retcode != 0)
01733     {
01734     error (0, 0,
01735            "failed to check out `%s'", finfo->fullname);
01736     return (1);
01737     }
01738
01739     /* Except when we are creating a branch, lock the revision so that
01740        we can check in the new revision.  */
01741     if (lockflag)
01742     {
01743     if (RCS_lock (finfo->rcs, rev ? corev : NULL, 1) == 0)
01744         RCS_rewrite (finfo->rcs, NULL, NULL);
01745     }
01746
01747     if (corev != NULL)
01748     free (corev);
01749
01750     retcode = RCS_checkin (finfo->rcs, finfo->file, message, rev,
01751                RCS_FLAGS_DEAD | RCS_FLAGS_QUIET);
01752     if (retcode != 0)
01753     {
01754     if (!quiet)
01755         error (0, retcode == -1 ? errno : 0,
01756            "failed to commit dead revision for `%s'", finfo->fullname);
01757     return (1);
01758     }
01759     /* At this point, the file has been committed as removed.  We should
01760        probably tell the history file about it  */
01761     history_write ('R', NULL, finfo->rcs->head, finfo->file, finfo->repository);
01762
01763     if (rev != NULL)
01764     free (rev);
01765
01766     old_path = xstrdup (finfo->rcs->path);
01767     if (!branch)
01768     RCS_setattic (finfo->rcs, 1);
01769
01770     /* Print message that file was removed. */
01771     cvs_output (old_path, 0);
01772     cvs_output ("  <--  ", 0);
01773     cvs_output (finfo->file, 0);
01774     cvs_output ("\nnew revision: delete; previous revision: ", 0);
01775     cvs_output (prev_rev, 0);
01776     cvs_output ("\ndone\n", 0);
01777     free(prev_rev);
01778
01779     free (old_path);
01780
01781     Scratch_Entry (finfo->entries, finfo->file);
01782     return (0);
01783 }
01784
01785 /*
01786  * Do the actual checkin for added files
01787  */
01788 static int
01789 finaladd (finfo, rev, tag, options)
01790     struct file_info *finfo;
01791     char *rev;
01792     char *tag;
01793     char *options;
01794 {
01795     int ret;
01796     char *rcs;
01797
01798     rcs = locate_rcs (finfo->file, finfo->repository);
01799     ret = Checkin ('A', finfo, rcs, rev, tag, options, saved_message);
01800     if (ret == 0)
01801     {
01802     char *tmp = xmalloc (strlen (finfo->file) + sizeof (CVSADM)
01803                  + sizeof (CVSEXT_LOG) + 10);
01804     (void) sprintf (tmp, "%s/%s%s", CVSADM, finfo->file, CVSEXT_LOG);
01805     if (unlink_file (tmp) < 0
01806         && !existence_error (errno))
01807         error (0, errno, "cannot remove %s", tmp);
01808     free (tmp);
01809     }
01810     else
01811     fixaddfile (finfo->file, finfo->repository);
01812
01813     (void) time (&last_register_time);
01814     free (rcs);
01815
01816     return (ret);
01817 }
01818
01819 /*
01820  * Unlock an rcs file
01821  */
01822 static void
01823 unlockrcs (rcs)
01824     RCSNode *rcs;
01825 {
01826     int retcode;
01827
01828     if ((retcode = RCS_unlock (rcs, NULL, 0)) != 0)
01829     error (retcode == -1 ? 1 : 0, retcode == -1 ? errno : 0,
01830            "could not unlock %s", rcs->path);
01831     else
01832     RCS_rewrite (rcs, NULL, NULL);
01833 }
01834
01835 /*
01836  * remove a partially added file.  if we can parse it, leave it alone.
01837  */
01838 static void
01839 fixaddfile (file, repository)
01840     char *file;
01841     char *repository;
01842 {
01843     RCSNode *rcsfile;
01844     char *rcs;
01845     int save_really_quiet;
01846
01847     rcs = locate_rcs (file, repository);
01848     save_really_quiet = really_quiet;
01849     really_quiet = 1;
01850     if ((rcsfile = RCS_parsercsfile (rcs)) == NULL)
01851     {
01852     if (unlink_file (rcs) < 0)
01853         error (0, errno, "cannot remove %s", rcs);
01854     }
01855     else
01856     freercsnode (&rcsfile);
01857     really_quiet = save_really_quiet;
01858     free (rcs);
01859 }
01860
01861 /*
01862  * put the branch back on an rcs file
01863  */
01864 static void
01865 fixbranch (rcs, branch)
01866     RCSNode *rcs;
01867     char *branch;
01868 {
01869     int retcode;
01870
01871     if (branch != NULL)
01872     {
01873     if ((retcode = RCS_setbranch (rcs, branch)) != 0)
01874         error (retcode == -1 ? 1 : 0, retcode == -1 ? errno : 0,
01875            "cannot restore branch to %s for %s", branch, rcs->path);
01876     RCS_rewrite (rcs, NULL, NULL);
01877     }
01878 }
01879
01880 /*
01881  * do the initial part of a file add for the named file.  if adding
01882  * with a tag, put the file in the Attic and point the symbolic tag
01883  * at the committed revision.
01884  */
01885
01886 static int
01887 checkaddfile (file, repository, tag, options, rcsnode)
01888     char *file;
01889     char *repository;
01890     char *tag;
01891     char *options;
01892     RCSNode **rcsnode;
01893 {
01894     char *rcs;
01895     char *fname;
01896     mode_t omask;
01897     int retcode = 0;
01898     int newfile = 0;
01899     RCSNode *rcsfile = NULL;
01900     int retval;
01901     int adding_on_branch;
01902
01903     /* Callers expect to be able to use either "" or NULL to mean the
01904        default keyword expansion.  */
01905     if (options != NULL && options[0] == '\0')
01906     options = NULL;
01907     if (options != NULL)
01908     assert (options[0] == '-' && options[1] == 'k');
01909
01910     /* If numeric, it is on the trunk; check_fileproc enforced
01911        this.  */
01912     adding_on_branch = tag != NULL && !isdigit ((unsigned char) tag[0]);
01913
01914     if (adding_on_branch)
01915     {
01916     rcs = xmalloc (strlen (repository) + strlen (file)
01917                + sizeof (RCSEXT) + sizeof (CVSATTIC) + 10);
01918         (void) sprintf (rcs, "%s/%s%s", repository, file, RCSEXT);
01919     if (! isreadable (rcs))
01920     {
01921         (void) sprintf(rcs, "%s/%s", repository, CVSATTIC);
01922         omask = umask (cvsumask);
01923         if (CVS_MKDIR (rcs, 0777) != 0 && errno != EEXIST)
01924         error (1, errno, "cannot make directory `%s'", rcs);;
01925         (void) umask (omask);
01926         (void) sprintf (rcs, "%s/%s/%s%s", repository, CVSATTIC, file,
01927                 RCSEXT);
01928     }
01929     }
01930     else
01931     rcs = locate_rcs (file, repository);
01932
01933     if (isreadable (rcs))
01934     {
01935     /* file has existed in the past.  Prepare to resurrect. */
01936     char *rev;
01937     char *oldexpand;
01938
01939     if ((rcsfile = *rcsnode) == NULL)
01940     {
01941         error (0, 0, "could not find parsed rcsfile %s", file);
01942         retval = 1;
01943         goto out;
01944     }
01945
01946     oldexpand = RCS_getexpand (rcsfile);
01947     if ((oldexpand != NULL
01948          && options != NULL
01949          && strcmp (options + 2, oldexpand) != 0)
01950         || (oldexpand == NULL && options != NULL))
01951     {
01952         /* We tell the user about this, because it means that the
01953            old revisions will no longer retrieve the way that they
01954            used to.  */
01955         error (0, 0, "changing keyword expansion mode to %s", options);
01956         RCS_setexpand (rcsfile, options + 2);
01957     }
01958
01959     if (!adding_on_branch)
01960     {
01961         /* We are adding on the trunk, so move the file out of the
01962            Attic.  */
01963         if (!(rcsfile->flags & INATTIC))
01964         {
01965         error (0, 0, "internal error: confused about attic for %s",
01966                rcsfile->path);
01967         retval = 1;
01968         goto out;
01969         }
01970
01971         sprintf (rcs, "%s/%s%s", repository, file, RCSEXT);
01972
01973         /* Begin a critical section around the code that spans the
01974            first commit on the trunk of a file that's already been
01975            committed on a branch.  */
01976         SIG_beginCrSect ();
01977
01978         if (RCS_setattic (rcsfile, 0))
01979         {
01980         retval = 1;
01981         goto out;
01982         }
01983     }
01984
01985     rev = RCS_getversion (rcsfile, tag, NULL, 1, (int *) NULL);
01986     /* and lock it */
01987     if (lock_RCS (file, rcsfile, rev, repository))
01988     {
01989         error (0, 0, "cannot lock `%s'.", rcs);
01990         if (rev != NULL)
01991         free (rev);
01992         retval = 1;
01993         goto out;
01994     }
01995
01996     if (rev != NULL)
01997         free (rev);
01998     }
01999     else
02000     {
02001     /* this is the first time we have ever seen this file; create
02002        an rcs file.  */
02003
02004     char *desc;
02005     size_t descalloc;
02006     size_t desclen;
02007
02008     char *opt;
02009
02010     desc = NULL;
02011     descalloc = 0;
02012     desclen = 0;
02013     fname = xmalloc (strlen (file) + sizeof (CVSADM)
02014              + sizeof (CVSEXT_LOG) + 10);
02015     (void) sprintf (fname, "%s/%s%s", CVSADM, file, CVSEXT_LOG);
02016     /* If the file does not exist, no big deal.  In particular, the
02017        server does not (yet at least) create CVSEXT_LOG files.  */
02018     if (isfile (fname))
02019         /* FIXME: Should be including update_dir in the appropriate
02020            place here.  */
02021         get_file (fname, fname, "r", &desc, &descalloc, &desclen);
02022     free (fname);
02023
02024     /* From reading the RCS 5.7 source, "rcs -i" adds a newline to the
02025        end of the log message if the message is nonempty.
02026        Do it.  RCS also deletes certain whitespace, in cleanlogmsg,
02027        which we don't try to do here.  */
02028     if (desclen > 0)
02029     {
02030         expand_string (&desc, &descalloc, desclen + 1);
02031         desc[desclen++] = '\012';
02032     }
02033
02034     /* Set RCS keyword expansion options.  */
02035     if (options != NULL)
02036         opt = options + 2;
02037     else
02038         opt = NULL;
02039
02040     /* This message is an artifact of the time when this
02041        was implemented via "rcs -i".  It should be revised at
02042        some point (does the "initial revision" in the message from
02043        RCS_checkin indicate that this is a new file?  Or does the
02044        "RCS file" message serve some function?).  */
02045     cvs_output ("RCS file: ", 0);
02046     cvs_output (rcs, 0);
02047     cvs_output ("\ndone\n", 0);
02048
02049     if (add_rcs_file (NULL, rcs, file, NULL, opt,
02050               NULL, NULL, 0, NULL,
02051               desc, desclen, NULL) != 0)
02052     {
02053         retval = 1;
02054         goto out;
02055     }
02056     rcsfile = RCS_parsercsfile (rcs);
02057     newfile = 1;
02058     if (desc != NULL)
02059         free (desc);
02060     if (rcsnode != NULL)
02061     {
02062         assert (*rcsnode == NULL);
02063         *rcsnode = rcsfile;
02064     }
02065     }
02066
02067     /* when adding a file for the first time, and using a tag, we need
02068        to create a dead revision on the trunk.  */
02069     if (adding_on_branch)
02070     {
02071     if (newfile)
02072     {
02073         char *tmp;
02074         FILE *fp;
02075
02076         /* move the new file out of the way. */
02077         fname = xmalloc (strlen (file) + sizeof (CVSADM)
02078                  + sizeof (CVSPREFIX) + 10);
02079         (void) sprintf (fname, "%s/%s%s", CVSADM, CVSPREFIX, file);
02080         rename_file (file, fname);
02081
02082         /* Create empty FILE.  Can't use copy_file with a DEVNULL
02083            argument -- copy_file now ignores device files. */
02084         fp = fopen (file, "w");
02085         if (fp == NULL)
02086         error (1, errno, "cannot open %s for writing", file);
02087         if (fclose (fp) < 0)
02088         error (0, errno, "cannot close %s", file);
02089
02090         tmp = xmalloc (strlen (file) + strlen (tag) + 80);
02091         /* commit a dead revision. */
02092         (void) sprintf (tmp, "file %s was initially added on branch %s.",
02093                 file, tag);
02094         retcode = RCS_checkin (rcsfile, NULL, tmp, NULL,
02095                    RCS_FLAGS_DEAD | RCS_FLAGS_QUIET);
02096         free (tmp);
02097         if (retcode != 0)
02098         {
02099         error (retcode == -1 ? 1 : 0, retcode == -1 ? errno : 0,
02100                "could not create initial dead revision %s", rcs);
02101         retval = 1;
02102         goto out;
02103         }
02104
02105         /* put the new file back where it was */
02106         rename_file (fname, file);
02107         free (fname);
02108
02109         /* double-check that the file was written correctly */
02110         freercsnode (&rcsfile);
02111         rcsfile = RCS_parse (file, repository);
02112         if (rcsfile == NULL)
02113         {
02114         error (0, 0, "could not read %s", rcs);
02115         retval = 1;
02116         goto out;
02117         }
02118         if (rcsnode != NULL)
02119         *rcsnode = rcsfile;
02120
02121         /* and lock it once again. */
02122         if (lock_RCS (file, rcsfile, NULL, repository))
02123         {
02124         error (0, 0, "cannot lock `%s'.", rcs);
02125         retval = 1;
02126         goto out;
02127         }
02128     }
02129
02130     /* when adding with a tag, we need to stub a branch, if it
02131        doesn't already exist.  */
02132
02133     if (rcsfile == NULL)
02134     {
02135         if (rcsnode != NULL && *rcsnode != NULL)
02136         rcsfile = *rcsnode;
02137         else
02138         {
02139         rcsfile = RCS_parse (file, repository);
02140         if (rcsfile == NULL)
02141         {
02142             error (0, 0, "could not read %s", rcs);
02143             retval = 1;
02144             goto out;
02145         }
02146         }
02147     }
02148
02149     if (!RCS_nodeisbranch (rcsfile, tag))
02150     {
02151         /* branch does not exist.  Stub it.  */
02152         char *head;
02153         char *magicrev;
02154
02155         head = RCS_getversion (rcsfile, NULL, NULL, 0, (int *) NULL);
02156         magicrev = RCS_magicrev (rcsfile, head);
02157
02158         retcode = RCS_settag (rcsfile, tag, magicrev);
02159         RCS_rewrite (rcsfile, NULL, NULL);
02160
02161         free (head);
02162         free (magicrev);
02163
02164         if (retcode != 0)
02165         {
02166         error (retcode == -1 ? 1 : 0, retcode == -1 ? errno : 0,
02167                "could not stub branch %s for %s", tag, rcs);
02168         retval = 1;
02169         goto out;
02170         }
02171     }
02172     else
02173     {
02174         /* lock the branch. (stubbed branches need not be locked.)  */
02175         if (lock_RCS (file, rcsfile, NULL, repository))
02176         {
02177         error (0, 0, "cannot lock `%s'.", rcs);
02178         retval = 1;
02179         goto out;
02180         }
02181     }
02182
02183     if (rcsnode && *rcsnode != rcsfile)
02184     {
02185         freercsnode(rcsnode);
02186         *rcsnode = rcsfile;
02187     }
02188     }
02189
02190     fileattr_newfile (file);
02191
02192     /* At this point, we used to set the file mode of the RCS file
02193        based on the mode of the file in the working directory.  If we
02194        are creating the RCS file for the first time, add_rcs_file does
02195        this already.  If we are re-adding the file, then perhaps it is
02196        consistent to preserve the old file mode, just as we preserve
02197        the old keyword expansion mode.
02198
02199        If we decide that we should change the modes, then we can't do
02200        it here anyhow.  At this point, the RCS file may be owned by
02201        somebody else, so a chmod will fail.  We need to instead do the
02202        chmod after rewriting it.
02203
02204        FIXME: In general, I think the file mode (and the keyword
02205        expansion mode) should be associated with a particular revision
02206        of the file, so that it is possible to have different revisions
02207        of a file have different modes.  */
02208
02209     retval = 0;
02210
02211  out:
02212     if (retval != 0 && SIG_inCrSect ())
02213     SIG_endCrSect ();
02214     free (rcs);
02215     return retval;
02216 }
02217
02218 /*
02219  * Attempt to place a lock on the RCS file; returns 0 if it could and 1 if it
02220  * couldn't.  If the RCS file currently has a branch as the head, we must
02221  * move the head back to the trunk before locking the file, and be sure to
02222  * put the branch back as the head if there are any errors.
02223  */
02224 static int
02225 lock_RCS (user, rcs, rev, repository)
02226     char *user;
02227     RCSNode *rcs;
02228     char *rev;
02229     char *repository;
02230 {
02231     char *branch = NULL;
02232     int err = 0;
02233
02234     /*
02235      * For a specified, numeric revision of the form "1" or "1.1", (or when
02236      * no revision is specified ""), definitely move the branch to the trunk
02237      * before locking the RCS file.
02238      *
02239      * The assumption is that if there is more than one revision on the trunk,
02240      * the head points to the trunk, not a branch... and as such, it's not
02241      * necessary to move the head in this case.
02242      */
02243     if (rev == NULL
02244     || (rev && isdigit ((unsigned char) *rev) && numdots (rev) < 2))
02245     {
02246     branch = xstrdup (rcs->branch);
02247     if (branch != NULL)
02248     {
02249         if (RCS_setbranch (rcs, NULL) != 0)
02250         {
02251         error (0, 0, "cannot change branch to default for %s",
02252                rcs->path);
02253         if (branch)
02254             free (branch);
02255         return (1);
02256         }
02257     }
02258     err = RCS_lock(rcs, NULL, 1);
02259     }
02260     else
02261     {
02262     (void) RCS_lock(rcs, rev, 1);
02263     }
02264
02265     /* We used to call RCS_rewrite here, and that might seem
02266        appropriate in order to write out the locked revision
02267        information.  However, such a call would actually serve no
02268        purpose.  CVS locks will prevent any interference from other
02269        CVS processes.  The comment above rcs_internal_lockfile
02270        explains that it is already unsafe to use RCS and CVS
02271        simultaneously.  It follows that writing out the locked
02272        revision information here would add no additional security.
02273
02274        If we ever do care about it, the proper fix is to create the
02275        RCS lock file before calling this function, and maintain it
02276        until the checkin is complete.
02277
02278        The call to RCS_lock is still required at present, since in
02279        some cases RCS_checkin will determine which revision to check
02280        in by looking for a lock.  FIXME: This is rather roundabout,
02281        and a more straightforward approach would probably be easier to
02282        understand.  */
02283
02284     if (err == 0)
02285     {
02286     if (sbranch != NULL)
02287         free (sbranch);
02288     sbranch = branch;
02289     return (0);
02290     }
02291
02292     /* try to restore the branch if we can on error */
02293     if (branch != NULL)
02294     fixbranch (rcs, branch);
02295
02296     if (branch)
02297     free (branch);
02298     return (1);
02299 }
02300
02301 /*
02302  * free an UPDATE node's data
02303  */
02304 void
02305 update_delproc (p)
02306     Node *p;
02307 {
02308     struct logfile_info *li;
02309
02310     li = (struct logfile_info *) p->data;
02311     if (li->tag)
02312     free (li->tag);
02313     if (li->rev_old)
02314     free (li->rev_old);
02315     if (li->rev_new)
02316     free (li->rev_new);
02317     free (li);
02318 }
02319
02320 /*
02321  * Free the commit_info structure in p.
02322  */
02323 static void
02324 ci_delproc (p)
02325     Node *p;
02326 {
02327     struct commit_info *ci;
02328
02329     ci = (struct commit_info *) p->data;
02330     if (ci->rev)
02331     free (ci->rev);
02332     if (ci->tag)
02333     free (ci->tag);
02334     if (ci->options)
02335     free (ci->options);
02336     free (ci);
02337 }
02338
02339 /*
02340  * Free the commit_info structure in p.
02341  */
02342 static void
02343 masterlist_delproc (p)
02344     Node *p;
02345 {
02346     struct master_lists *ml;
02347
02348     ml = (struct master_lists *) p->data;
02349     dellist (&ml->ulist);
02350     dellist (&ml->cilist);
02351     free (ml);
02352 }
02353
02354 /* Find an RCS file in the repository.  Most parts of CVS will want to
02355    rely instead on RCS_parse which performs a similar operation and is
02356    called by recurse.c which then puts the result in useful places
02357    like the rcs field of struct file_info.
02358
02359    REPOSITORY is the repository (including the directory) and FILE is
02360    the filename within that directory (without RCSEXT).  Returns a
02361    newly-malloc'd array containing the absolute pathname of the RCS
02362    file that was found.  */
02363 static char *
02364 locate_rcs (file, repository)
02365     char *file;
02366     char *repository;
02367 {
02368     char *rcs;
02369
02370     rcs = xmalloc (strlen (repository) + strlen (file) + sizeof (RCSEXT) + 10);
02371     (void) sprintf (rcs, "%s/%s%s", repository, file, RCSEXT);
02372     if (!isreadable (rcs))
02373     {
02374     (void) sprintf (rcs, "%s/%s/%s%s", repository, CVSATTIC, file, RCSEXT);
02375     if (!isreadable (rcs))
02376         (void) sprintf (rcs, "%s/%s%s", repository, file, RCSEXT);
02377     }
02378     return rcs;
02379 }
Generated on Sun Oct 21 12:41:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/create_adm.c Source File

cvs-1.10/src/create_adm.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Create Administration.
00009  *
00010  * Creates a CVS administration directory based on the argument repository; the
00011  * "Entries" file is prefilled from the "initrecord" argument.
00012  */
00013
00014 #include "cvs.h"
00015
00016 /* update_dir includes dir as its last component.
00017
00018    Return value is 0 for success, or 1 if we printed a warning message.
00019    Note that many errors are still fatal; particularly for unlikely errors
00020    a fatal error is probably better than a warning which might be missed
00021    or after which CVS might do something non-useful.  If WARN is zero, then
00022    don't print warnings; all errors are fatal then.  */
00023
00024 int
00025 Create_Admin (dir, update_dir, repository, tag, date, nonbranch, warn,
00026           dotemplate)
00027     char *dir;
00028     char *update_dir;
00029     char *repository;
00030     char *tag;
00031     char *date;
00032     int nonbranch;
00033     int warn;
00034     int dotemplate;
00035 {
00036     FILE *fout;
00037     char *cp;
00038     char *reposcopy;
00039     char *tmp;
00040
00041     if (trace)
00042     {
00043     fprintf (stderr, "%s-> Create_Admin (%s, %s, %s, %s, %s, %d, %d)\n",
00044          CLIENT_SERVER_STR,
00045          dir, update_dir, repository, tag ? tag : "",
00046          date ? date : "", nonbranch, warn);
00047     }
00048
00049     if (noexec)
00050     return 0;
00051
00052     tmp = xmalloc (strlen (dir) + 100);
00053     if (dir != NULL)
00054     (void) sprintf (tmp, "%s/%s", dir, CVSADM);
00055     else
00056     (void) strcpy (tmp, CVSADM);
00057     if (isfile (tmp))
00058     error (1, 0, "there is a version in %s already", update_dir);
00059
00060     if (CVS_MKDIR (tmp, 0777) < 0)
00061     {
00062     /* We want to print out the entire update_dir, since a lot of
00063        our code calls this function with dir == "." or dir ==
00064        NULL.  I hope that gives enough information in cases like
00065        absolute pathnames; printing out xgetwd or something would
00066        be way too verbose in the common cases.  */
00067
00068     if (warn)
00069     {
00070         /* The reason that this is a warning, rather than silently
00071            just skipping creating the directory, is that we don't want
00072            CVS's behavior to vary subtly based on factors (like directory
00073            permissions) which are not made clear to the user.  With
00074            the warning at least we let them know what is going on.  */
00075         error (0, errno, "warning: cannot make directory %s in %s",
00076            CVSADM, update_dir);
00077         free (tmp);
00078         return 1;
00079     }
00080     else
00081         error (1, errno, "cannot make directory %s in %s",
00082            CVSADM, update_dir);
00083     }
00084
00085     /* record the current cvs root for later use */
00086
00087     Create_Root (dir, CVSroot_original);
00088     if (dir != NULL)
00089     (void) sprintf (tmp, "%s/%s", dir, CVSADM_REP);
00090     else
00091     (void) strcpy (tmp, CVSADM_REP);
00092     fout = CVS_FOPEN (tmp, "w+");
00093     if (fout == NULL)
00094     {
00095     if (update_dir[0] == '\0')
00096         error (1, errno, "cannot open %s", tmp);
00097     else
00098         error (1, errno, "cannot open %s/%s", update_dir, CVSADM_REP);
00099     }
00100     reposcopy = xstrdup (repository);
00101     Sanitize_Repository_Name (reposcopy);
00102
00103     /* The top level of the repository is a special case -- we need to
00104        write it with an extra dot at the end.  This trailing `.' stuff
00105        rubs me the wrong way -- on the other hand, I don't want to
00106        spend the time making sure all of the code can handle it if we
00107        don't do it. */
00108
00109     if (strcmp (reposcopy, CVSroot_directory) == 0)
00110     {
00111     reposcopy = xrealloc (reposcopy, strlen (reposcopy) + 3);
00112     strcat (reposcopy, "/.");
00113     }
00114
00115     cp = reposcopy;
00116
00117 #ifdef RELATIVE_REPOS
00118     /*
00119      * If the Repository file is to hold a relative path, try to strip off
00120      * the leading CVSroot argument.
00121      */
00122     if (CVSroot_directory != NULL)
00123     {
00124     char *path = xmalloc (strlen (CVSroot_directory) + 10);
00125
00126     (void) sprintf (path, "%s/", CVSroot_directory);
00127     if (strncmp (cp, path, strlen (path)) == 0)
00128         cp += strlen (path);
00129     free (path);
00130     }
00131 #endif
00132
00133     if (fprintf (fout, "%s\n", cp) < 0)
00134     {
00135     if (update_dir[0] == '\0')
00136         error (1, errno, "write to %s failed", tmp);
00137     else
00138         error (1, errno, "write to %s/%s failed", update_dir, CVSADM_REP);
00139     }
00140     if (fclose (fout) == EOF)
00141     {
00142     if (update_dir[0] == '\0')
00143         error (1, errno, "cannot close %s", tmp);
00144     else
00145         error (1, errno, "cannot close %s/%s", update_dir, CVSADM_REP);
00146     }
00147
00148     /* now, do the Entries file */
00149     if (dir != NULL)
00150     (void) sprintf (tmp, "%s/%s", dir, CVSADM_ENT);
00151     else
00152     (void) strcpy (tmp, CVSADM_ENT);
00153     fout = CVS_FOPEN (tmp, "w+");
00154     if (fout == NULL)
00155     {
00156     if (update_dir[0] == '\0')
00157         error (1, errno, "cannot open %s", tmp);
00158     else
00159         error (1, errno, "cannot open %s/%s", update_dir, CVSADM_ENT);
00160     }
00161     if (fclose (fout) == EOF)
00162     {
00163     if (update_dir[0] == '\0')
00164         error (1, errno, "cannot close %s", tmp);
00165     else
00166         error (1, errno, "cannot close %s/%s", update_dir, CVSADM_ENT);
00167     }
00168
00169     /* Create a new CVS/Tag file */
00170     WriteTag (dir, tag, date, nonbranch, update_dir, repository);
00171
00172 #ifdef SERVER_SUPPORT
00173     if (server_active && dotemplate)
00174     {
00175     server_template (update_dir, repository);
00176     }
00177
00178     if (trace)
00179     {
00180     fprintf (stderr, "%c<- Create_Admin\n",
00181          (server_active) ? 'S' : ' ');
00182     }
00183 #endif
00184
00185     free (reposcopy);
00186     free (tmp);
00187     return 0;
00188 }
Generated on Sun Oct 21 12:41:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/cvs.h Source File

cvs-1.10/src/cvs.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS kit.
00007  */
00008
00009 /*
00010  * basic information used in all source files
00011  *
00012  */
00013
00014
00015 #include "config.h"     /* this is stuff found via autoconf */
00016 #include "options.h"        /* these are some larger questions which
00017                    can't easily be automatically checked
00018                    for */
00019
00020 /* Changed from if __STDC__ to ifdef __STDC__ because of Sun's acc compiler */
00021
00022 #ifdef __STDC__
00023 #define PTR void *
00024 #else
00025 #define PTR char *
00026 #endif
00027
00028 /* Add prototype support.  */
00029 #ifndef PROTO
00030 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
00031 #define PROTO(ARGS) ARGS
00032 #else
00033 #define PROTO(ARGS) ()
00034 #endif
00035 #endif
00036
00037 #include <stdio.h>
00038
00039 /* Under OS/2, <stdio.h> doesn't define popen()/pclose(). */
00040 #ifdef USE_OWN_POPEN
00041 #include "popen.h"
00042 #endif
00043
00044 #ifdef STDC_HEADERS
00045 #include <stdlib.h>
00046 #else
00047 extern void exit ();
00048 extern char *getenv();
00049 #endif
00050
00051 #ifdef HAVE_UNISTD_H
00052 #include <unistd.h>
00053 #endif
00054
00055 #ifdef HAVE_STRING_H
00056 #include <string.h>
00057 #else
00058 #include <strings.h>
00059 #endif
00060
00061 #ifdef SERVER_SUPPORT
00062 /* If the system doesn't provide strerror, it won't be declared in
00063    string.h.  */
00064 char *strerror ();
00065 #endif
00066
00067 #include <fnmatch.h> /* This is supposed to be available on Posix systems */
00068
00069 #include <ctype.h>
00070 #include <pwd.h>
00071 #include <signal.h>
00072
00073 #ifdef HAVE_ERRNO_H
00074 #include <errno.h>
00075 #else
00076 #ifndef errno
00077 extern int errno;
00078 #endif /* !errno */
00079 #endif /* HAVE_ERRNO_H */
00080
00081 #include "system.h"
00082
00083 #include "hash.h"
00084 #if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)
00085 #include "client.h"
00086 #endif
00087
00088 #ifdef MY_NDBM
00089 #include "myndbm.h"
00090 #else
00091 #include <ndbm.h>
00092 #endif /* MY_NDBM */
00093
00094 #include "regex.h"
00095 #include "getopt.h"
00096 #include "wait.h"
00097
00098 #include "rcs.h"
00099
00100
00101 /* This actually gets set in system.h.  Note that the _ONLY_ reason for
00102    this is if various system calls (getwd, getcwd, readlink) require/want
00103    us to use it.  All other parts of CVS allocate pathname buffers
00104    dynamically, and we want to keep it that way.  */
00105 #ifndef PATH_MAX
00106 #ifdef MAXPATHLEN
00107 #define PATH_MAX MAXPATHLEN+2
00108 #else
00109 #define PATH_MAX 1024+2
00110 #endif
00111 #endif /* PATH_MAX */
00112
00113 /* Definitions for the CVS Administrative directory and the files it contains.
00114    Here as #define's to make changing the names a simple task.  */
00115
00116 #ifdef USE_VMS_FILENAMES
00117 #define CVSADM          "CVS"
00118 #define CVSADM_ENT      "CVS/Entries."
00119 #define CVSADM_ENTBAK   "CVS/Entries.Backup"
00120 #define CVSADM_ENTLOG   "CVS/Entries.Log"
00121 #define CVSADM_ENTSTAT  "CVS/Entries.Static"
00122 #define CVSADM_REP      "CVS/Repository."
00123 #define CVSADM_ROOT     "CVS/Root."
00124 #define CVSADM_CIPROG   "CVS/Checkin.prog"
00125 #define CVSADM_UPROG    "CVS/Update.prog"
00126 #define CVSADM_TAG      "CVS/Tag."
00127 #define CVSADM_NOTIFY   "CVS/Notify."
00128 #define CVSADM_NOTIFYTMP "CVS/Notify.tmp"
00129 #define CVSADM_BASE      "CVS/Base"
00130 #define CVSADM_BASEREV   "CVS/Baserev."
00131 #define CVSADM_BASEREVTMP "CVS/Baserev.tmp"
00132 #define CVSADM_TEMPLATE "CVS/Template."
00133 #else /* USE_VMS_FILENAMES */
00134 #define CVSADM      "CVS"
00135 #define CVSADM_ENT  "CVS/Entries"
00136 #define CVSADM_ENTBAK   "CVS/Entries.Backup"
00137 #define CVSADM_ENTLOG   "CVS/Entries.Log"
00138 #define CVSADM_ENTSTAT  "CVS/Entries.Static"
00139 #define CVSADM_REP  "CVS/Repository"
00140 #define CVSADM_ROOT "CVS/Root"
00141 #define CVSADM_CIPROG   "CVS/Checkin.prog"
00142 #define CVSADM_UPROG    "CVS/Update.prog"
00143 #define CVSADM_TAG  "CVS/Tag"
00144 #define CVSADM_NOTIFY   "CVS/Notify"
00145 #define CVSADM_NOTIFYTMP "CVS/Notify.tmp"
00146 /* A directory in which we store base versions of files we currently are
00147    editing with "cvs edit".  */
00148 #define CVSADM_BASE     "CVS/Base"
00149 #define CVSADM_BASEREV  "CVS/Baserev"
00150 #define CVSADM_BASEREVTMP "CVS/Baserev.tmp"
00151 /* File which contains the template for use in log messages.  */
00152 #define CVSADM_TEMPLATE "CVS/Template"
00153 #endif /* USE_VMS_FILENAMES */
00154
00155 /* This is the special directory which we use to store various extra
00156    per-directory information in the repository.  It must be the same as
00157    CVSADM to avoid creating a new reserved directory name which users cannot
00158    use, but is a separate #define because if anyone changes it (which I don't
00159    recommend), one needs to deal with old, unconverted, repositories.
00160
00161    See fileattr.h for details about file attributes, the only thing stored
00162    in CVSREP currently.  */
00163 #define CVSREP "CVS"
00164
00165 /*
00166  * Definitions for the CVSROOT Administrative directory and the files it
00167  * contains.  This directory is created as a sub-directory of the $CVSROOT
00168  * environment variable, and holds global administration information for the
00169  * entire source repository beginning at $CVSROOT.
00170  */
00171 #define CVSROOTADM      "CVSROOT"
00172 #define CVSROOTADM_MODULES  "modules"
00173 #define CVSROOTADM_LOGINFO  "loginfo"
00174 #define CVSROOTADM_RCSINFO  "rcsinfo"
00175 #define CVSROOTADM_COMMITINFO   "commitinfo"
00176 #define CVSROOTADM_TAGINFO      "taginfo"
00177 #define CVSROOTADM_EDITINFO "editinfo"
00178 #define CVSROOTADM_VERIFYMSG    "verifymsg"
00179 #define CVSROOTADM_HISTORY  "history"
00180 #define CVSROOTADM_VALTAGS  "val-tags"
00181 #define CVSROOTADM_IGNORE   "cvsignore"
00182 #define CVSROOTADM_CHECKOUTLIST "checkoutlist"
00183 #define CVSROOTADM_WRAPPER  "cvswrappers"
00184 #define CVSROOTADM_NOTIFY   "notify"
00185 #define CVSROOTADM_USERS    "users"
00186 #define CVSROOTADM_READERS  "readers"
00187 #define CVSROOTADM_WRITERS  "writers"
00188 #define CVSROOTADM_PASSWD   "passwd"
00189 #define CVSROOTADM_CONFIG   "config"
00190
00191 #define CVSNULLREPOS        "Emptydir"  /* an empty directory */
00192
00193 /* Other CVS file names */
00194
00195 /* Files go in the attic if the head main branch revision is dead,
00196    otherwise they go in the regular repository directories.  The whole
00197    concept of having an attic is sort of a relic from before death
00198    support but on the other hand, it probably does help the speed of
00199    some operations (such as main branch checkouts and updates).  */
00200 #define CVSATTIC    "Attic"
00201
00202 #define CVSLCK      "#cvs.lock"
00203 #define CVSRFL      "#cvs.rfl"
00204 #define CVSWFL      "#cvs.wfl"
00205 #define CVSRFLPAT   "#cvs.rfl.*"    /* wildcard expr to match read locks */
00206 #define CVSEXT_LOG  ",t"
00207 #define CVSPREFIX   ",,"
00208 #define CVSDOTIGNORE    ".cvsignore"
00209 #define CVSDOTWRAPPER   ".cvswrappers"
00210
00211 /* Command attributes -- see function lookup_command_attribute(). */
00212 #define CVS_CMD_IGNORE_ADMROOT        1
00213
00214 /* Set if CVS needs to create a CVS/Root file upon completion of this
00215    command.  The name may be slightly confusing, because the flag
00216    isn't really as general purpose as it seems (it is not set for cvs
00217    release).  */
00218
00219 #define CVS_CMD_USES_WORK_DIR         2
00220
00221 #define CVS_CMD_MODIFIES_REPOSITORY   4
00222
00223 /* miscellaneous CVS defines */
00224
00225 /* This is the string which is at the start of the non-log-message lines
00226    that we put up for the user when they edit the log message.  */
00227 #define CVSEDITPREFIX   "CVS: "
00228 /* Number of characters in CVSEDITPREFIX to compare when deciding to strip
00229    off those lines.  We don't check for the space, to accomodate users who
00230    have editors which strip trailing spaces.  */
00231 #define CVSEDITPREFIXLEN 4
00232
00233 #define CVSLCKAGE   (60*60)     /* 1-hour old lock files cleaned up */
00234 #define CVSLCKSLEEP 30      /* wait 30 seconds before retrying */
00235 #define CVSBRANCH   "1.1.1"     /* RCS branch used for vendor srcs */
00236
00237 #ifdef USE_VMS_FILENAMES
00238 #define BAKPREFIX       "_$"
00239 #define DEVNULL         "NLA0:"
00240 #else /* USE_VMS_FILENAMES */
00241 #define BAKPREFIX   ".#"        /* when rcsmerge'ing */
00242 #ifndef DEVNULL
00243 #define DEVNULL     "/dev/null"
00244 #endif
00245 #endif /* USE_VMS_FILENAMES */
00246
00247 /*
00248  * Special tags. -rHEAD refers to the head of an RCS file, regardless of any
00249  * sticky tags. -rBASE  refers to the current revision the user has checked
00250  * out This mimics the behaviour of RCS.
00251  */
00252 #define TAG_HEAD    "HEAD"
00253 #define TAG_BASE    "BASE"
00254
00255 /* Environment variable used by CVS */
00256 #define CVSREAD_ENV "CVSREAD"   /* make files read-only */
00257 #define CVSREAD_DFLT    0       /* writable files by default */
00258
00259 #define TMPDIR_ENV  "TMPDIR"    /* Temporary directory */
00260 /* #define  TMPDIR_DFLT        Set by options.h */
00261
00262 #define EDITOR1_ENV "CVSEDITOR" /* which editor to use */
00263 #define EDITOR2_ENV "VISUAL"    /* which editor to use */
00264 #define EDITOR3_ENV "EDITOR"    /* which editor to use */
00265 /* #define  EDITOR_DFLT        Set by options.h */
00266
00267 #define CVSROOT_ENV "CVSROOT"   /* source directory root */
00268 #define CVSROOT_DFLT    NULL        /* No dflt; must set for checkout */
00269
00270 #define IGNORE_ENV  "CVSIGNORE" /* More files to ignore */
00271 #define WRAPPER_ENV     "CVSWRAPPERS"   /* name of the wrapper file */
00272
00273 #define CVSUMASK_ENV    "CVSUMASK"  /* Effective umask for repository */
00274 /* #define  CVSUMASK_DFLT          Set by options.h */
00275
00276 /*
00277  * If the beginning of the Repository matches the following string, strip it
00278  * so that the output to the logfile does not contain a full pathname.
00279  *
00280  * If the CVSROOT environment variable is set, it overrides this define.
00281  */
00282 #define REPOS_STRIP "/master/"
00283
00284 /* Large enough to hold DATEFORM.  Not an arbitrary limit as long as
00285    it is used for that purpose, and not to hold a string from the
00286    command line, the client, etc.  */
00287 #define MAXDATELEN  50
00288
00289 /* The type of an entnode.  */
00290 enum ent_type
00291 {
00292     ENT_FILE, ENT_SUBDIR
00293 };
00294
00295 /* structure of a entry record */
00296 struct entnode
00297 {
00298     enum ent_type type;
00299     char *user;
00300     char *version;
00301
00302     /* Timestamp, or "" if none (never NULL).  */
00303     char *timestamp;
00304
00305     /* Keyword expansion options, or "" if none (never NULL).  */
00306     char *options;
00307
00308     char *tag;
00309     char *date;
00310     char *conflict;
00311 };
00312 typedef struct entnode Entnode;
00313
00314 /* The type of request that is being done in do_module() */
00315 enum mtype
00316 {
00317     CHECKOUT, TAG, PATCH, EXPORT
00318 };
00319
00320 /*
00321  * structure used for list-private storage by Entries_Open() and
00322  * Version_TS() and Find_Directories().
00323  */
00324 struct stickydirtag
00325 {
00326     /* These fields pass sticky tag information from Entries_Open() to
00327        Version_TS().  */
00328     int aflag;
00329     char *tag;
00330     char *date;
00331     int nonbranch;
00332
00333     /* This field is set by Entries_Open() if there was subdirectory
00334        information; Find_Directories() uses it to see whether it needs
00335        to scan the directory itself.  */
00336     int subdirs;
00337 };
00338
00339 /* Flags for find_{names,dirs} routines */
00340 #define W_LOCAL         0x01    /* look for files locally */
00341 #define W_REPOS         0x02    /* look for files in the repository */
00342 #define W_ATTIC         0x04    /* look for files in the attic */
00343
00344 /* Flags for return values of direnter procs for the recursion processor */
00345 enum direnter_type
00346 {
00347     R_PROCESS = 1,          /* process files and maybe dirs */
00348     R_SKIP_FILES,           /* don't process files in this dir */
00349     R_SKIP_DIRS,            /* don't process sub-dirs */
00350     R_SKIP_ALL              /* don't process files or dirs */
00351 };
00352 #ifdef ENUMS_CAN_BE_TROUBLE
00353 typedef int Dtype;
00354 #else
00355 typedef enum direnter_type Dtype;
00356 #endif
00357
00358 extern char *program_name, *program_path, *command_name;
00359 extern char *Tmpdir, *Editor;
00360 extern int cvsadmin_root;
00361 extern char *CurDir;
00362 extern int really_quiet, quiet;
00363 extern int use_editor;
00364 extern int cvswrite;
00365 extern mode_t cvsumask;
00366
00367 /* Access method specified in CVSroot. */
00368 typedef enum {
00369   local_method, server_method, pserver_method, kserver_method, gserver_method,
00370   ext_method, fork_method
00371 } CVSmethod;
00372 extern char *method_names[];    /* change this in root.c if you change
00373                    the enum above */
00374
00375 /* This global variable holds the global -d option.  It is NULL if -d
00376    was not used, which means that we must get the CVSroot information
00377    from the CVSROOT environment variable or from a CVS/Root file.  */
00378 extern char *CVSroot_cmdline;
00379
00380 extern char *CVSroot_original;  /* the active, complete CVSroot string */
00381 extern int client_active;   /* nonzero if we are doing remote access */
00382 extern CVSmethod CVSroot_method; /* one of the enum values above */
00383 extern char *CVSroot_username;  /* the username or NULL if method == local */
00384 extern char *CVSroot_hostname;  /* the hostname or NULL if method == local */
00385 extern char *CVSroot_directory; /* the directory name */
00386
00387 /*
00388  * Options for non-standard ports etc
00389  */
00390 extern int CVSroot_port;       /* port on the remote cvs server */
00391 extern int CVSroot_proxy_port; /* the port on the proxy through which to tunnel */
00392 extern char* CVSroot_proxy; /* proxy to tunnel through */
00393
00394                              /* These variables keep track of all of the CVSROOT directories that
00395    have been seen by the client and the current one of those selected.  */
00396 extern List *root_directories;
00397 extern char *current_root;
00398
00399 extern char *emptydir_name PROTO ((void));
00400 extern int safe_location PROTO ((void));
00401
00402 extern int trace;       /* Show all commands */
00403 extern int noexec;      /* Don't modify disk anywhere */
00404 extern int logoff;      /* Don't write history entry */
00405
00406 extern int top_level_admin;
00407
00408 #ifdef CLIENT_SUPPORT
00409 extern List *dirs_sent_to_server; /* used to decide which "Argument
00410                      xxx" commands to send to each
00411                      server in multiroot mode. */
00412 #endif
00413
00414 extern char hostname[];
00415
00416 /* Externs that are included directly in the CVS sources */
00417
00418 int RCS_merge PROTO((RCSNode *, char *, char *, char *, char *, char *));
00419 /* Flags used by RCS_* functions.  See the description of the individual
00420    functions for which flags mean what for each function.  */
00421 #define RCS_FLAGS_FORCE 1
00422 #define RCS_FLAGS_DEAD 2
00423 #define RCS_FLAGS_QUIET 4
00424 #define RCS_FLAGS_MODTIME 8
00425 #define RCS_FLAGS_KEEPFILE 16
00426
00427 extern int RCS_exec_rcsdiff PROTO ((RCSNode *rcsfile,
00428                     char *opts, char *options,
00429                     char *rev1, char *rev2,
00430                     char *label1, char *label2,
00431                     char *workfile));
00432 extern int diff_exec PROTO ((char *file1, char *file2, char *options,
00433                  char *out));
00434 extern int diff_execv PROTO ((char *file1, char *file2,
00435                   char *label1, char *label2,
00436                   char *options, char *out));
00437
00438
00439
00440 #include "error.h"
00441
00442 DBM *open_module PROTO((void));
00443 FILE *open_file PROTO((const char *, const char *));
00444 List *Find_Directories PROTO((char *repository, int which, List *entries));
00445 void Entries_Close PROTO((List *entries));
00446 List *Entries_Open PROTO ((int aflag, char *update_dir));
00447 void Subdirs_Known PROTO((List *entries));
00448 void Subdir_Register PROTO((List *, const char *, const char *));
00449 void Subdir_Deregister PROTO((List *, const char *, const char *));
00450
00451 char *Make_Date PROTO((char *rawdate));
00452 char *date_from_time_t PROTO ((time_t));
00453 void date_to_internet PROTO ((char *, char *));
00454
00455 char *Name_Repository PROTO((char *dir, char *update_dir));
00456 char *Short_Repository PROTO((char *repository));
00457 void Sanitize_Repository_Name PROTO((char *repository));
00458
00459 char *Name_Root PROTO((char *dir, char *update_dir));
00460 int parse_cvsroot PROTO((char *CVSroot));
00461 void set_local_cvsroot PROTO((char *dir));
00462 void Create_Root PROTO((char *dir, char *rootdir));
00463 void root_allow_add PROTO ((char *));
00464 void root_allow_free PROTO ((void));
00465 int root_allow_ok PROTO ((char *));
00466
00467 char *gca PROTO((const char *rev1, const char *rev2));
00468 extern void check_numeric PROTO ((const char *, int, char **));
00469 char *getcaller PROTO((void));
00470 char *time_stamp PROTO((char *file));
00471
00472 #ifndef CVSGUI_SHL
00473     void *xmalloc PROTO((size_t bytes));
00474     void *xrealloc PROTO((void *ptr, size_t bytes));
00475 #else /* CVSGUI_SHL */
00476 #   if qCvsDebug
00477 #       define xmalloc(s) xmalloc_glue(s, __LINE__, __FILE__)
00478 #       define xrealloc(p, s) xrealloc_glue(p, s, __LINE__, __FILE__)
00479         void *xmalloc_glue PROTO((size_t bytes, int line, const char *file));
00480         void *xrealloc_glue PROTO((void *ptr, size_t bytes, int line, const char *file));
00481 #   else /* !qCvsDebug */
00482         void *xmalloc PROTO((size_t bytes));
00483         void *xrealloc PROTO((void *ptr, size_t bytes));
00484 #   endif /* !qCvsDebug */
00485 #endif /* CVSGUI_SHL */
00486
00487 void expand_string PROTO ((char **, size_t *, size_t));
00488 char *xstrdup PROTO((const char *str));
00489 void strip_trailing_newlines PROTO((char *str));
00490 int pathname_levels PROTO ((char *path));
00491
00492 typedef int (*CALLPROC) PROTO((char *repository, char *value));
00493 int Parse_Info PROTO((char *infofile, char *repository, CALLPROC callproc, int all));
00494 extern int parse_config PROTO ((char *));
00495
00496 typedef RETSIGTYPE (*SIGCLEANUPPROC)    PROTO(());
00497 int SIG_register PROTO((int sig, SIGCLEANUPPROC sigcleanup));
00498 int isdir PROTO((const char *file));
00499 int isfile PROTO((const char *file));
00500 int islink PROTO((const char *file));
00501 int isdevice PROTO ((const char *));
00502 int isreadable PROTO((const char *file));
00503 int iswritable PROTO((const char *file));
00504 int isaccessible PROTO((const char *file, const int mode));
00505 int isabsolute PROTO((const char *filename));
00506 char *xreadlink PROTO((const char *link));
00507 char *last_component PROTO((char *path));
00508 char *get_homedir PROTO ((void));
00509 char *cvs_temp_name PROTO ((void));
00510
00511 int numdots PROTO((const char *s));
00512 char *increment_revnum PROTO ((const char *));
00513 int compare_revnums PROTO ((const char *, const char *));
00514 int unlink_file PROTO((const char *f));
00515 int unlink_file_dir PROTO((const char *f));
00516 int update PROTO((int argc, char *argv[]));
00517 int xcmp PROTO((const char *file1, const char *file2));
00518 int yesno PROTO((void));
00519 void *valloc PROTO((size_t bytes));
00520 time_t get_date PROTO((char *date, struct timeb *now));
00521 extern int Create_Admin PROTO ((char *dir, char *update_dir,
00522                 char *repository, char *tag, char *date,
00523                 int nonbranch, int warn, int dotemplate));
00524 extern int expand_at_signs PROTO ((char *, off_t, FILE *));
00525
00526 /* Locking subsystem (implemented in lock.c).  */
00527
00528 int Reader_Lock PROTO((char *xrepository));
00529 void Lock_Cleanup PROTO((void));
00530
00531 /* Writelock an entire subtree, well the part specified by ARGC, ARGV, LOCAL,
00532    and AFLAG, anyway.  */
00533 void lock_tree_for_write PROTO ((int argc, char **argv, int local, int aflag));
00534
00535 /* See lock.c for description.  */
00536 extern void lock_dir_for_write PROTO ((char *));
00537
00538 /* LockDir setting from CVSROOT/config.  */
00539 extern char *lock_dir;
00540
00541 void Scratch_Entry PROTO((List * list, char *fname));
00542 void ParseTag PROTO((char **tagp, char **datep, int *nonbranchp));
00543 void WriteTag PROTO ((char *dir, char *tag, char *date, int nonbranch,
00544               char *update_dir, char *repository));
00545 void cat_module PROTO((int status));
00546 void check_entries PROTO((char *dir));
00547 void close_module PROTO((DBM * db));
00548 void copy_file PROTO((const char *from, const char *to));
00549 void fperrmsg PROTO((FILE * fp, int status, int errnum, char *message,...));
00550 void free_names PROTO((int *pargc, char *argv[]));
00551
00552 extern int ign_name PROTO ((char *name));
00553 void ign_add PROTO((char *ign, int hold));
00554 void ign_add_file PROTO((char *file, int hold));
00555 void ign_setup PROTO((void));
00556 void ign_dir_add PROTO((char *name));
00557 int ignore_directory PROTO((char *name));
00558 typedef void (*Ignore_proc) PROTO ((char *, char *));
00559 extern void ignore_files PROTO ((List *, List *, char *, Ignore_proc));
00560 extern int ign_inhibit_server;
00561 extern int ign_case;
00562
00563 #include "update.h"
00564
00565 void line2argv PROTO ((int *pargc, char ***argv, char *line, char *sepchars));
00566 void make_directories PROTO((const char *name));
00567 void make_directory PROTO((const char *name));
00568 extern int mkdir_if_needed PROTO ((char *name));
00569 void rename_file PROTO((const char *from, const char *to));
00570 char *backup_file PROTO((const char *file, const char *suffix));
00571 /* Expand wildcards in each element of (ARGC,ARGV).  This is according to the
00572    files which exist in the current directory, and accordingly to OS-specific
00573    conventions regarding wildcard syntax.  It might be desirable to change the
00574    former in the future (e.g. "cvs status *.h" including files which don't exist
00575    in the working directory).  The result is placed in *PARGC and *PARGV;
00576    the *PARGV array itself and all the strings it contains are newly
00577    malloc'd.  It is OK to call it with PARGC == &ARGC or PARGV == &ARGV.  */
00578 extern void expand_wild PROTO ((int argc, char **argv,
00579                                 int *pargc, char ***pargv));
00580
00581 #ifdef SERVER_SUPPORT
00582 extern int cvs_casecmp PROTO ((char *, char *));
00583 extern int fopen_case PROTO ((char *, char *, FILE **, char **));
00584 #endif
00585
00586 void strip_trailing_slashes PROTO((char *path));
00587 void update_delproc PROTO((Node * p));
00588 void usage PROTO((const char *const *cpp));
00589 void xchmod PROTO((char *fname, int writable));
00590 char *xgetwd PROTO((void));
00591 List *Find_Names PROTO((char *repository, int which, int aflag,
00592           List ** optentries));
00593 void Register PROTO((List * list, char *fname, char *vn, char *ts,
00594            char *options, char *tag, char *date, char *ts_conflict));
00595 void Update_Logfile PROTO((char *repository, char *xmessage, FILE * xlogfp,
00596              List * xchanges));
00597 void do_editor PROTO((char *dir, char **messagep,
00598               char *repository, List * changes));
00599
00600 void do_verify PROTO((char *message, char *repository));
00601
00602 typedef int (*CALLBACKPROC) PROTO((int argc, char *argv[], char *where,
00603     char *mwhere, char *mfile, int shorten, int local_specified,
00604     char *omodule, char *msg));
00605
00606 /* This is the structure that the recursion processor passes to the
00607    fileproc to tell it about a particular file.  */
00608 struct file_info
00609 {
00610     /* Name of the file, without any directory component.  */
00611     char *file;
00612
00613     /* Name of the directory we are in, relative to the directory in
00614        which this command was issued.  We have cd'd to this directory
00615        (either in the working directory or in the repository, depending
00616        on which sort of recursion we are doing).  If we are in the directory
00617        in which the command was issued, this is "".  */
00618     char *update_dir;
00619
00620     /* update_dir and file put together, with a slash between them as
00621        necessary.  This is the proper way to refer to the file in user
00622        messages.  */
00623     char *fullname;
00624
00625     /* Name of the directory corresponding to the repository which contains
00626        this file.  */
00627     char *repository;
00628
00629     /* The pre-parsed entries for this directory.  */
00630     List *entries;
00631
00632     RCSNode *rcs;
00633 };
00634
00635 typedef int (*FILEPROC) PROTO ((void *callerdat, struct file_info *finfo));
00636 typedef int (*FILESDONEPROC) PROTO ((void *callerdat, int err,
00637                      char *repository, char *update_dir,
00638                      List *entries));
00639 typedef Dtype (*DIRENTPROC) PROTO ((void *callerdat, char *dir,
00640                     char *repos, char *update_dir,
00641                     List *entries));
00642 typedef int (*DIRLEAVEPROC) PROTO ((void *callerdat, char *dir, int err,
00643                     char *update_dir, List *entries));
00644
00645 extern int mkmodules PROTO ((char *dir));
00646 extern int init PROTO ((int argc, char **argv));
00647
00648 int do_module PROTO((DBM * db, char *mname, enum mtype m_type, char *msg,
00649         CALLBACKPROC callback_proc, char *where, int shorten,
00650         int local_specified, int run_module_prog, char *extra_arg));
00651 void history_write PROTO((int type, char *update_dir, char *revs, char *name,
00652             char *repository));
00653 int start_recursion PROTO((FILEPROC fileproc, FILESDONEPROC filesdoneproc,
00654              DIRENTPROC direntproc, DIRLEAVEPROC dirleaveproc,
00655              void *callerdat,
00656              int argc, char *argv[], int local, int which,
00657              int aflag, int readlock, char *update_preload,
00658              int dosrcs));
00659 void SIG_beginCrSect PROTO((void));
00660 void SIG_endCrSect PROTO((void));
00661 int SIG_inCrSect PROTO((void));
00662 void read_cvsrc PROTO((int *argc, char ***argv, char *cmdname));
00663
00664 char *make_message_rcslegal PROTO((char *message));
00665 extern int file_has_markers PROTO ((const struct file_info *));
00666 extern void get_file PROTO ((const char *, const char *, const char *,
00667                  char **, size_t *, size_t *));
00668 extern void resolve_symlink PROTO ((char **filename));
00669
00670 /* flags for run_exec(), the fast system() for CVS */
00671 #define RUN_NORMAL      0x0000  /* no special behaviour */
00672 #define RUN_COMBINED        0x0001  /* stdout is duped to stderr */
00673 #define RUN_REALLY      0x0002  /* do the exec, even if noexec is on */
00674 #define RUN_STDOUT_APPEND   0x0004  /* append to stdout, don't truncate */
00675 #define RUN_STDERR_APPEND   0x0008  /* append to stderr, don't truncate */
00676 #define RUN_SIGIGNORE       0x0010  /* ignore interrupts for command */
00677 #define RUN_TTY     (char *)0   /* for the benefit of lint */
00678
00679 void run_arg PROTO((const char *s));
00680 void run_print PROTO((FILE * fp));
00681 void run_setup PROTO ((const char *prog));
00682 int run_exec PROTO((const char *stin, const char *stout, const char *sterr,
00683             int flags));
00684
00685 /* other similar-minded stuff from run.c.  */
00686 FILE *run_popen PROTO((const char *, const char *));
00687 #if defined(CVSGUI_SHL)
00688     int run_pclose PROTO((FILE *));
00689 #else /* !CVSGUI_SHL */
00690 #   define run_pclose pclose
00691 #endif /*  !CVSGUI_SHL */
00692 int piped_child PROTO((char **, int *, int *));
00693 void close_on_exec PROTO((int));
00694
00695 pid_t waitpid PROTO((pid_t, int *, int));
00696
00697 /*
00698  * a struct vers_ts contains all the information about a file including the
00699  * user and rcs file names, and the version checked out and the head.
00700  *
00701  * this is usually obtained from a call to Version_TS which takes a
00702  * tag argument for the RCS file if desired
00703  */
00704 struct vers_ts
00705 {
00706     /* rcs version user file derives from, from CVS/Entries.
00707        It can have the following special values:
00708
00709        NULL = file is not mentioned in Entries (this is also used for a
00710           directory).
00711        "" = ILLEGAL!  The comment used to say that it meant "no user file"
00712         but as far as I know CVS didn't actually use it that way.
00713         Note that according to cvs.texinfo, "" is not legal in the
00714         Entries file.
00715        0 = user file is new
00716        -vers = user file to be removed.  */
00717     char *vn_user;
00718
00719     /* Numeric revision number corresponding to ->vn_tag (->vn_tag
00720        will often be symbolic).  */
00721     char *vn_rcs;
00722     /* If ->tag is a simple tag in the RCS file--a tag which really
00723        exists which is not a magic revision--and if ->date is NULL,
00724        then this is a copy of ->tag.  Otherwise, it is a copy of
00725        ->vn_rcs.  */
00726     char *vn_tag;
00727
00728     /* This is the timestamp from stating the file in the working directory.
00729        It is NULL if there is no file in the working directory.  It is
00730        "Is-modified" if we know the file is modified but don't have its
00731        contents.  */
00732     char *ts_user;
00733     /* Timestamp from CVS/Entries.  For the server, ts_user and ts_rcs
00734        are computed in a slightly different way, but the fact remains that
00735        if they are equal the file in the working directory is unmodified
00736        and if they differ it is modified.  */
00737     char *ts_rcs;
00738
00739     /* Options from CVS/Entries (keyword expansion), malloc'd.  If none,
00740        then it is an empty string (never NULL).  */
00741     char *options;
00742
00743     /* If non-NULL, there was a conflict (or merely a merge?  See merge_file)
00744        and the time stamp in this field is the time stamp of the working
00745        directory file which was created with the conflict markers in it.
00746        This is from CVS/Entries.  */
00747     char *ts_conflict;
00748
00749     /* Tag specified on the command line, or if none, tag stored in
00750        CVS/Entries.  */
00751     char *tag;
00752     /* Date specified on the command line, or if none, date stored in
00753        CVS/Entries.  */
00754     char *date;
00755     /* If this is 1, then tag is not a branch tag.  If this is 0, then
00756        tag may or may not be a branch tag.  */
00757     int nonbranch;
00758
00759     /* Pointer to entries file node  */
00760     Entnode *entdata;
00761
00762     /* Pointer to parsed src file info */
00763     RCSNode *srcfile;
00764 };
00765 typedef struct vers_ts Vers_TS;
00766
00767 Vers_TS *Version_TS PROTO ((struct file_info *finfo, char *options, char *tag,
00768                 char *date, int force_tag_match,
00769                 int set_time));
00770 void freevers_ts PROTO ((Vers_TS ** versp));
00771
00772 /* Miscellaneous CVS infrastructure which layers on top of the recursion
00773    processor (for example, needs struct file_info).  */
00774
00775 int Checkin PROTO ((int type, struct file_info *finfo, char *rcs, char *rev,
00776             char *tag, char *options, char *message));
00777 int No_Difference PROTO ((struct file_info *finfo, Vers_TS *vers));
00778 /* TODO: can the finfo argument to special_file_mismatch be changed? -twp */
00779 int special_file_mismatch PROTO ((struct file_info *finfo,
00780                   char *rev1, char *rev2));
00781
00782 /* CVSADM_BASEREV stuff, from entries.c.  */
00783 extern char *base_get PROTO ((struct file_info *));
00784 extern void base_register PROTO ((struct file_info *, char *));
00785 extern void base_deregister PROTO ((struct file_info *));
00786
00787 /*
00788  * defines for Classify_File() to determine the current state of a file.
00789  * These are also used as types in the data field for the list we make for
00790  * Update_Logfile in commit, import, and add.
00791  */
00792 enum classify_type
00793 {
00794     T_UNKNOWN = 1,          /* no old-style analog existed   */
00795     T_CONFLICT,             /* C (conflict) list         */
00796     T_NEEDS_MERGE,          /* G (needs merging) list    */
00797     T_MODIFIED,             /* M (needs checked in) list     */
00798     T_CHECKOUT,             /* O (needs checkout) list   */
00799     T_ADDED,                /* A (added file) list       */
00800     T_REMOVED,              /* R (removed file) list     */
00801     T_REMOVE_ENTRY,         /* W (removed entry) list    */
00802     T_UPTODATE,             /* File is up-to-date        */
00803 #ifdef SERVER_SUPPORT
00804     T_PATCH,                /* P Like C, but can patch   */
00805 #endif
00806     T_TITLE             /* title for node type       */
00807 };
00808 typedef enum classify_type Ctype;
00809
00810 Ctype Classify_File PROTO
00811     ((struct file_info *finfo, char *tag, char *date, char *options,
00812       int force_tag_match, int aflag, Vers_TS **versp, int pipeout));
00813
00814 /*
00815  * structure used for list nodes passed to Update_Logfile() and
00816  * do_editor().
00817  */
00818 struct logfile_info
00819 {
00820   enum classify_type type;
00821   char *tag;
00822   char *rev_old;        /* rev number before a commit/modify,
00823                    NULL for add or import */
00824   char *rev_new;        /* rev number after a commit/modify,
00825                    add, or import, NULL for remove */
00826 };
00827
00828 /* Wrappers.  */
00829
00830 typedef enum { WRAP_MERGE, WRAP_COPY } WrapMergeMethod;
00831 typedef enum {
00832     /* -t and -f wrapper options.  Treating directories as single files.  */
00833     WRAP_TOCVS,
00834     WRAP_FROMCVS,
00835     /* -k wrapper option.  Default keyword expansion options.  */
00836     WRAP_RCSOPTION
00837 } WrapMergeHas;
00838
00839 void  wrap_setup PROTO((void));
00840 int   wrap_name_has PROTO((const char *name,WrapMergeHas has));
00841 char *wrap_rcsoption PROTO ((const char *fileName, int asFlag));
00842 char *wrap_tocvs_process_file PROTO((const char *fileName));
00843 int   wrap_merge_is_copy PROTO((const char *fileName));
00844 void wrap_fromcvs_process_file PROTO ((const char *fileName));
00845 void wrap_add_file PROTO((const char *file,int temp));
00846 void wrap_add PROTO((char *line,int temp));
00847 void wrap_send PROTO ((void));
00848 #if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)
00849 void wrap_unparse_rcs_options PROTO ((char **, int));
00850 #endif /* SERVER_SUPPORT || CLIENT_SUPPORT */
00851
00852 /* Pathname expansion */
00853 char *expand_path PROTO((char *name, char *file, int line));
00854
00855 /* User variables.  */
00856 extern List *variable_list;
00857
00858 extern void variable_set PROTO ((char *nameval));
00859
00860 int watch PROTO ((int argc, char **argv));
00861 int edit PROTO ((int argc, char **argv));
00862 int unedit PROTO ((int argc, char **argv));
00863 int editors PROTO ((int argc, char **argv));
00864 int watchers PROTO ((int argc, char **argv));
00865 extern int annotate PROTO ((int argc, char **argv));
00866 extern int add PROTO ((int argc, char **argv));
00867 extern int admin PROTO ((int argc, char **argv));
00868 extern int checkout PROTO ((int argc, char **argv));
00869 extern int commit PROTO ((int argc, char **argv));
00870 extern int diff PROTO ((int argc, char **argv));
00871 extern int history PROTO ((int argc, char **argv));
00872 extern int import PROTO ((int argc, char **argv));
00873 extern int cvslog PROTO ((int argc, char **argv));
00874 #ifdef AUTH_CLIENT_SUPPORT
00875 extern int login PROTO((int argc, char **argv));
00876 int logout PROTO((int argc, char **argv));
00877 #endif /* AUTH_CLIENT_SUPPORT */
00878 extern int patch PROTO((int argc, char **argv));
00879 extern int release PROTO((int argc, char **argv));
00880 extern int cvsremove PROTO((int argc, char **argv));
00881 extern int rtag PROTO((int argc, char **argv));
00882 extern int cvsstatus PROTO((int argc, char **argv));
00883 extern int cvstag PROTO((int argc, char **argv));
00884 extern int version PROTO((int argc, char **argv));
00885
00886 extern unsigned long int lookup_command_attribute PROTO((char *));
00887
00888 #if defined(AUTH_CLIENT_SUPPORT) || defined(AUTH_SERVER_SUPPORT)
00889 char *scramble PROTO ((char *str));
00890 char *descramble PROTO ((char *str));
00891 #endif /* AUTH_CLIENT_SUPPORT || AUTH_SERVER_SUPPORT */
00892
00893 #ifdef AUTH_CLIENT_SUPPORT
00894 char *get_cvs_password PROTO((void));
00895 #endif /* AUTH_CLIENT_SUPPORT */
00896
00897 extern void tag_check_valid PROTO ((char *, int, char **, int, int, char *));
00898 extern void tag_check_valid_join PROTO ((char *, int, char **, int, int,
00899                      char *));
00900
00901 #include "server.h"
00902
00903 /* From server.c and documented there.  */
00904 extern void cvs_output PROTO ((const char *, size_t));
00905 extern void cvs_output_binary PROTO ((char *, size_t));
00906 extern void cvs_outerr PROTO ((const char *, size_t));
00907 extern void cvs_flusherr PROTO ((void));
00908 extern void cvs_flushout PROTO ((void));
00909 extern void cvs_output_tagged PROTO ((char *, char *));
00910
00911  /* Special handling for dirty files (i.e. cannot be locked and modify
00912  * them regarding where they are) like CW Pro 2 Projects or Visual C++ 4.0
00913  * makefiles. This file are not sent to the server when modified. The only
00914  * way to check-in a dirty file is to commit them by once */
00915 extern int enable_dirty;
00916 extern int isdirty_file(const char *);
00917
00918 /* do not lock dirty files. Make sure chown doesn't hurt them. */
00919 #ifdef DO_NOT_LOCK_DIRTY
00920 #   ifdef chmod
00921 #       undef chmod
00922 #   endif
00923 #   define chmod dirty_chmod
00924     extern int dirty_chmod( const char *path, mode_t mode );
00925 #endif
00926
Generated on Sun Oct 21 12:41:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/cvsrc.c Source File

cvs-1.10/src/cvsrc.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1993 david d zuhn
00003  *
00004  * Written by david d `zoo' zuhn while at Cygnus Support
00005  *
00006  * You may distribute under the terms of the GNU General Public License as
00007  * specified in the README file that comes with the CVS source distribution.
00008  *
00009  */
00010
00011
00012 #include "cvs.h"
00013 #include "getline.h"
00014
00015 /* this file is to be found in the user's home directory */
00016
00017 #ifndef CVSRC_FILENAME
00018 #define CVSRC_FILENAME  ".cvsrc"
00019 #endif
00020 char cvsrc[] = CVSRC_FILENAME;
00021
00022 #define GROW    10
00023
00024 extern char *strtok ();
00025
00026 /* Read cvsrc, processing options matching CMDNAME ("cvs" for global
00027    options, and update *ARGC and *ARGV accordingly.  */
00028
00029 void
00030 read_cvsrc (argc, argv, cmdname)
00031     int *argc;
00032     char ***argv;
00033     char *cmdname;
00034 {
00035     char *homedir;
00036     char *homeinit;
00037     FILE *cvsrcfile;
00038
00039     char *line;
00040     int line_length;
00041     size_t line_chars_allocated;
00042
00043     char *optstart;
00044
00045     int command_len;
00046     int found = 0;
00047
00048     int i;
00049
00050     int new_argc;
00051     int max_new_argv;
00052     char **new_argv;
00053
00054     /* old_argc and old_argv hold the values returned from the
00055        previous invocation of read_cvsrc and are used to free the
00056        allocated memory.  The first invocation of read_cvsrc gets argv
00057        from the system, this memory must not be free'd.  */
00058     static int old_argc = 0;
00059     static char **old_argv = NULL;
00060
00061     /* don't do anything if argc is -1, since that implies "help" mode */
00062     if (*argc == -1)
00063     return;
00064
00065     /* determine filename for ~/.cvsrc */
00066
00067     homedir = get_homedir ();
00068     /* If we can't find a home directory, ignore ~/.cvsrc.  This may
00069        make tracking down problems a bit of a pain, but on the other
00070        hand it might be obnoxious to complain when CVS will function
00071        just fine without .cvsrc (and many users won't even know what
00072        .cvsrc is).  */
00073     if (!homedir)
00074     return;
00075
00076     homeinit = (char *) xmalloc (strlen (homedir) + strlen (cvsrc) + 10);
00077     strcpy (homeinit, homedir);
00078     strcat (homeinit, "/");
00079     strcat (homeinit, cvsrc);
00080
00081     /* if it can't be read, there's no point to continuing */
00082
00083     if (!isreadable (homeinit))
00084     {
00085     free (homeinit);
00086     return;
00087     }
00088
00089     /* now scan the file until we find the line for the command in question */
00090
00091     line = NULL;
00092     line_chars_allocated = 0;
00093     command_len = strlen (cmdname);
00094     cvsrcfile = open_file (homeinit, "r");
00095     while ((line_length = getline (&line, &line_chars_allocated, cvsrcfile))
00096        >= 0)
00097     {
00098     /* skip over comment lines */
00099     if (line[0] == '#')
00100         continue;
00101
00102     /* stop if we match the current command */
00103     if (!strncmp (line, cmdname, command_len)
00104         && isspace ((unsigned char) *(line + command_len)))
00105     {
00106         found = 1;
00107         break;
00108     }
00109     }
00110
00111     if (line_length < 0 && !feof (cvsrcfile))
00112     error (0, errno, "cannot read %s", homeinit);
00113
00114     fclose (cvsrcfile);
00115
00116     /* setup the new options list */
00117
00118     new_argc = 1;
00119     max_new_argv = (*argc) + GROW;
00120     new_argv = (char **) xmalloc (max_new_argv * sizeof (char*));
00121     new_argv[0] = xstrdup ((*argv)[0]);
00122
00123     if (found)
00124     {
00125     /* skip over command in the options line */
00126     for (optstart = strtok (line + command_len, "\t \n");
00127          optstart;
00128          optstart = strtok (NULL, "\t \n"))
00129     {
00130         new_argv [new_argc++] = xstrdup (optstart);
00131
00132         if (new_argc >= max_new_argv)
00133         {
00134         max_new_argv += GROW;
00135         new_argv = (char **) xrealloc (new_argv, max_new_argv * sizeof (char*));
00136         }
00137     }
00138     }
00139
00140     if (line != NULL)
00141     free (line);
00142
00143     /* now copy the remaining arguments */
00144
00145     if (new_argc + *argc > max_new_argv)
00146     {
00147     max_new_argv = new_argc + *argc;
00148     new_argv = (char **) xrealloc (new_argv, max_new_argv * sizeof (char*));
00149     }
00150     for (i=1; i < *argc; i++)
00151     {
00152     new_argv [new_argc++] = xstrdup ((*argv)[i]);
00153     }
00154
00155     if (old_argv != NULL)
00156     {
00157     /* Free the memory which was allocated in the previous
00158            read_cvsrc call.  */
00159     free_names (&old_argc, old_argv);
00160     }
00161
00162     old_argc = *argc = new_argc;
00163     old_argv = *argv = new_argv;
00164
00165     free (homeinit);
00166     return;
00167 }
Generated on Sun Oct 21 12:41:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


add.c File Reference

cvs-1.10/src/add.c File Reference

#include "cvs.h"
#include "savecwd.h"
#include "fileattr.h"

Include dependency graph for add.c:

Include dependency graph

Go to the source code of this file.

Functions

int | add_directory ()
int | build_entry ()
int | add (argc, argv) int argc

Variables

const char *const | add_usage []
char ** | argv
char * | user
char * | options
char * | message
List * entries
char * | tag = NULL

Function Documentation

int add | ( | argc | ,
 |  | argv |
 | ) |

int add_directory ( ) [static]

int build_entry ( ) [static]

Variable Documentation

const char* const add_usage[] [static]

Initial value:

{
    "Usage: %s %s [-k rcs-kflag] [-m message] files...\n",
    "\t-k\tUse \"rcs-kflag\" to add the file with the specified kflag.\n",
    "\t-m\tUse \"message\" for the creation log.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 35 of file add.c.

char** argv

Definition at line 47 of file add.c.

List * entries

Definition at line 1059 of file update.c.

char * message

Definition at line 639 of file logmsg.c.

char* options

Definition at line 840 of file add.c.

char * tag = NULL

Definition at line 8396 of file rcs.c.

char * user

Definition at line 5943 of file rcs.c.

Generated on Sun Oct 21 12:43:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


admin.c File Reference

cvs-1.10/src/admin.c File Reference

#include "cvs.h"
#include <assert.h>

Include dependency graph for admin.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | admin_data

Functions

Dtype admin_dirproc ()
int | admin_fileproc ()
void | arg_add (dat, opt, arg) struct admin_data *dat

Variables

const char *const | admin_usage []
int | opt
char * | arg
char ** | argv
file_info * finfo
char * | dir
char * | repos
char * | update_dir
List * entries

Function Documentation

Dtype admin_dirproc ( ) [static]

int admin_fileproc ( ) [static]

void arg_add | ( | dat | ,
 |  | opt | ,
 |  | arg |
 | ) | [static]

Variable Documentation

const char* const admin_usage[] [static]

Definition at line 23 of file admin.c.

char* arg

Definition at line 122 of file admin.c.

char** argv

Definition at line 149 of file admin.c.

char* dir

Definition at line 887 of file admin.c.

List* entries

Definition at line 890 of file admin.c.

struct file_info * finfo

Definition at line 431 of file watch.c.

int opt

Definition at line 121 of file admin.c.

char * repos

Definition at line 670 of file tag.c.

char * update_dir

Definition at line 1058 of file update.c.

Generated on Sun Oct 21 12:43:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


buffer.c File Reference

cvs-1.10/src/buffer.c File Reference

#include <assert.h>
#include "cvs.h"
#include "buffer.h"

Include dependency graph for buffer.c:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:43:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


buffer.h File Reference

cvs-1.10/src/buffer.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:43:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


checkin.c File Reference

cvs-1.10/src/checkin.c File Reference

#include "cvs.h"
#include "fileattr.h"
#include "edit.h"

Include dependency graph for checkin.c:

Include dependency graph

Go to the source code of this file.

Functions

int | Checkin (type, finfo, rcs, rev, tag, options, message) int type

Variables

file_info * finfo
char * | rcs
char * | rev
char * | tag
char * | options
char * | message

Function Documentation

int Checkin | ( | type | ,
 |  | finfo | ,
 |  | rcs | ,
 |  | rev | ,
 |  | tag | ,
 |  | options | ,
 |  | message |
 | ) |

Variable Documentation

struct file_info* finfo

Definition at line 25 of file checkin.c.

char* message

Definition at line 30 of file checkin.c.

char* options

Definition at line 29 of file checkin.c.

RCSNode * rcs

Definition at line 1334 of file log.c.

char * rev

Definition at line 8534 of file rcs.c.

char* tag

Definition at line 28 of file checkin.c.

Generated on Sun Oct 21 12:43:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


checkout.c File Reference

cvs-1.10/src/checkout.c File Reference

#include <assert.h>
#include "cvs.h"

Include dependency graph for checkout.c:

Include dependency graph

Go to the source code of this file.

Functions

char * | findslash ()
int | checkout_proc ()
int | checkout (argc, argv) int argc
int | build_dirs_and_chdir ()
void | build_one_dir ()
void | build_one_dir (repository, dirpath, sticky) char *repository

Variables

const char *const | checkout_usage []
const char *const | export_usage []
int | checkout_prune_dirs
int | force_tag_match = 1
int | pipeout
int | aflag
char * | options = NULL
char * | tag = NULL
int | tag_validated = 0
char * | date = NULL
char * | join_rev1 = NULL
char * | join_rev2 = NULL
int | join_tags_validated = 0
char * | preload_update_dir = NULL
char * | history_name = NULL
enum mtype | m_type
char ** | argv
char * | dirpath
int | sticky
char * | where_orig
char * | mwhere
char * | mfile
int | shorten
int | local_specified
char * | omodule
char * | msg
char * | p

Function Documentation

int build_dirs_and_chdir ( ) [static]

void build_one_dir | ( | repository | ,
 |  | dirpath | ,
 |  | sticky |
 | ) | [static]

void build_one_dir ( ) [static]

Referenced by sticky().

int checkout | ( | argc | ,
 |  | argv |
 | ) |

int checkout_proc ( ) [static]

char* findslash ( ) [static]

Variable Documentation

int aflag [static]

Definition at line 87 of file checkout.c.

char** argv

Definition at line 506 of file checkout.c.

int checkout_prune_dirs [static]

Definition at line 84 of file checkout.c.

const char* const checkout_usage[] [static]

Initial value:

{
    "Usage:\n  %s %s [-ANPRcflnps] [-r rev | -D date] [-d dir]\n",
    "    [-j rev1] [-j rev2] [-k kopt] modules...\n",
    "\t-A\tReset any sticky tags/date/kopts.\n",
    "\t-N\tDon't shorten module paths if -d specified.\n",
    "\t-P\tPrune empty directories.\n",
    "\t-R\tProcess directories recursively.\n",
    "\t-c\t\"cat\" the module database.\n",
    "\t-f\tForce a head revision match if tag/date not found.\n",
    "\t-l\tLocal directory only, not recursive\n",
    "\t-n\tDo not run module program (if any).\n",
    "\t-p\tCheck out files to standard output (avoids stickiness).\n",
    "\t-s\tLike -c, but include module status.\n",
    "\t-r rev\tCheck out revision or tag. (implies -P) (is sticky)\n",
    "\t-D date\tCheck out revisions as of date. (implies -P) (is sticky)\n",
    "\t-d dir\tCheck out into dir instead of module name.\n",
    "\t-k kopt\tUse RCS kopt -k option on checkout.\n",
    "\t-j rev\tMerge in changes made between current revision and rev.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 45 of file checkout.c.

char* date = NULL [static]

Definition at line 91 of file checkout.c.

char* dirpath

Definition at line 456 of file checkout.c.

const char* const export_usage[] [static]

Initial value:

{
    "Usage: %s %s [-NRfln] [-r rev | -D date] [-d dir] [-k kopt] module...\n",
    "\t-N\tDon't shorten module paths if -d specified.\n",
    "\t-f\tForce a head revision match if tag/date not found.\n",
    "\t-l\tLocal directory only, not recursive\n",
    "\t-R\tProcess directories recursively (default).\n",
    "\t-n\tDo not run module program (if any).\n",
    "\t-r rev\tExport revision or tag.\n",
    "\t-D date\tExport revisions as of date.\n",
    "\t-d dir\tExport into dir instead of module name.\n",
    "\t-k kopt\tUse RCS kopt -k option on checkout.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 68 of file checkout.c.

int force_tag_match = 1 [static]

Definition at line 85 of file checkout.c.

char* history_name = NULL [static]

Definition at line 96 of file checkout.c.

char* join_rev1 = NULL [static]

Definition at line 92 of file checkout.c.

char* join_rev2 = NULL [static]

Definition at line 93 of file checkout.c.

int join_tags_validated = 0 [static]

Definition at line 94 of file checkout.c.

int local_specified

Definition at line 511 of file checkout.c.

enum mtype m_type [static]

Definition at line 97 of file checkout.c.

char* mfile

Definition at line 509 of file checkout.c.

char* msg

Definition at line 513 of file checkout.c.

char* mwhere

Definition at line 508 of file checkout.c.

char* omodule

Definition at line 512 of file checkout.c.

char* options = NULL [static]

Definition at line 88 of file checkout.c.

Node * p

Definition at line 291 of file hash.c.

int pipeout [static]

Definition at line 86 of file checkout.c.

char* preload_update_dir = NULL [static]

Definition at line 95 of file checkout.c.

int shorten

Definition at line 510 of file checkout.c.

int sticky

Definition at line 1151 of file checkout.c.

char* tag = NULL [static]

Definition at line 89 of file checkout.c.

int tag_validated = 0 [static]

Definition at line 90 of file checkout.c.

char* where_orig

Definition at line 507 of file checkout.c.

Generated on Sun Oct 21 12:43:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


classify.c File Reference

cvs-1.10/src/classify.c File Reference

#include "cvs.h"

Include dependency graph for classify.c:

Include dependency graph

Go to the source code of this file.

Functions

void | sticky_ck ()
Ctype | Classify_File (finfo, tag, date, options, force_tag_match, aflag, versp, pipeout) struct file_info *finfo

Variables

char * | tag
char * | date = NULL
char * | options
int | force_tag_match
int | aflag
Vers_TS ** versp
int | pipeout
Vers_TS * vers

Function Documentation

Ctype Classify_File | ( | finfo | ,
 |  | tag | ,
 |  | date | ,
 |  | options | ,
 |  | force_tag_match | ,
 |  | aflag | ,
 |  | versp | ,
 |  | pipeout |
 | ) |

void sticky_ck ( ) [static]

Variable Documentation

int aflag

Definition at line 914 of file tag.c.

char * date = NULL

Definition at line 8397 of file rcs.c.

int force_tag_match

Definition at line 2826 of file rcs.c.

char* options

Definition at line 27 of file classify.c.

int pipeout

Definition at line 32 of file classify.c.

char* tag

Definition at line 22 of file classify.c.

Vers_TS * vers

Definition at line 2100 of file update.c.

Vers_TS** versp

Definition at line 31 of file classify.c.

Generated on Sun Oct 21 12:43:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


client.c File Reference

cvs-1.10/src/client.c File Reference

#include <assert.h>
#include "cvs.h"
#include "getline.h"
#include "edit.h"
#include "buffer.h"

Include dependency graph for client.c:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:43:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


client.h File Reference

cvs-1.10/src/client.h File Reference

Go to the source code of this file.

Compounds

struct | response

Functions

char *mode_to_string | PROTO ((mode_t))
int change_mode | PROTO ((char *, char *, int))

Variables

int | gzip_level
int | file_gzip_level
response responses []

Function Documentation

int change_mode PROTO ( (char *, char *, int) )

char* mode_to_string PROTO ( (mode_t) )

Variable Documentation

int file_gzip_level

Definition at line 8 of file client.h.

int gzip_level

Definition at line 7 of file client.h.

struct response responses[]

Definition at line 182 of file client.h.

Generated on Sun Oct 21 12:43:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


commit.c File Reference

cvs-1.10/src/commit.c File Reference

#include <assert.h>
#include "cvs.h"
#include "getline.h"
#include "edit.h"
#include "fileattr.h"
#include "hardlink.h"

Include dependency graph for commit.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | commit_info
struct | master_lists

Functions

Dtype check_direntproc ()
int | check_fileproc ()
int | check_filesdoneproc ()
int | checkaddfile ()
Dtype commit_direntproc ()
int | commit_dirleaveproc ()
int | commit_fileproc ()
int | commit_filesdoneproc ()
int | finaladd ()
int | findmaxrev ()
int | lock_RCS ()
int | precommit_list_proc ()
int | precommit_proc ()
int | remove_file ()
void | fixaddfile ()
void | fixbranch ()
void | unlockrcs ()
void | ci_delproc ()
void | masterlist_delproc ()
char * | locate_rcs ()
int | commit (argc, argv) int argc
int | commit_fileproc (callerdat, finfo) void *callerdat

Variables

int | force_ci = 0
int | got_message
int | run_module_prog = 1
int | aflag
char * | saved_tag
char * | write_dirtag
int | write_dirnonbranch
char * | logfile
List * mulist
List * saved_ulist
char * | saved_message
time_t | last_register_time
const char *const | commit_usage []
char ** | argv
Vers_TS ** vers
file_info * finfo
char * | dir
char * | repos
char * | update_dir
List * entries
void * | closure
char * | filter
int | err
char * | sbranch
char * | repository
char * | tag
char * | message
char * | rev
char * | options
char * | branch
RCSNode ** rcsnode
RCSNode * rcs

Function Documentation

Dtype check_direntproc ( ) [static]

int check_fileproc ( ) [static]

int check_filesdoneproc ( ) [static]

int checkaddfile ( ) [static]

void ci_delproc ( ) [static]

int commit | ( | argc | ,
 |  | argv |
 | ) |

Dtype commit_direntproc ( ) [static]

int commit_dirleaveproc ( ) [static]

int commit_fileproc | ( | callerdat | ,
 |  | finfo |
 | ) | [static]

int commit_fileproc ( ) [static]

int commit_filesdoneproc ( ) [static]

int finaladd ( ) [static]

int findmaxrev ( ) [static]

void fixaddfile ( ) [static]

void fixbranch ( ) [static]

char* locate_rcs ( ) [static]

int lock_RCS ( ) [static]

void masterlist_delproc ( ) [static]

int precommit_list_proc ( ) [static]

int precommit_proc ( ) [static]

int remove_file ( ) [static]

void unlockrcs ( ) [static]

Variable Documentation

int aflag [static]

Definition at line 75 of file commit.c.

char** argv

Definition at line 327 of file commit.c.

const char * branch

Definition at line 4672 of file rcs.c.

void * closure

Definition at line 1158 of file recurse.c.

const char* const commit_usage[] [static]

Initial value:

{
    "Usage: %s %s [-nRlf] [-m msg | -F logfile] [-r rev] files...\n",
    "\t-n\tDo not run the module program (if any).\n",
    "\t-R\tProcess directories recursively.\n",
    "\t-l\tLocal directory only (not recursive).\n",
    "\t-f\tForce the file to be committed; disables recursion.\n",
    "\t-F file\tRead the log message from file.\n",
    "\t-m msg\tLog message.\n",
    "\t-r rev\tCommit to this branch or trunk revision.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 85 of file commit.c.

char* dir

Definition at line 1577 of file commit.c.

List* entries

Definition at line 1580 of file commit.c.

int err

Definition at line 1057 of file update.c.

char * filter

Definition at line 638 of file logmsg.c.

struct file_info* finfo

Definition at line 1202 of file commit.c.

int force_ci = 0 [static]

Definition at line 72 of file commit.c.

int got_message [static]

Definition at line 73 of file commit.c.

time_t last_register_time [static]

Definition at line 83 of file commit.c.

char* logfile [static]

Definition at line 79 of file commit.c.

char* message

Definition at line 1635 of file commit.c.

List* mulist [static]

Definition at line 80 of file commit.c.

char* options

Definition at line 1891 of file commit.c.

RCSNode* rcs

Definition at line 2227 of file commit.c.

RCSNode** rcsnode

Definition at line 1892 of file commit.c.

char* repos

Definition at line 1538 of file commit.c.

char * repository

Definition at line 902 of file update.c.

char* rev

Definition at line 2228 of file commit.c.

int run_module_prog = 1 [static]

Definition at line 74 of file commit.c.

char* saved_message [static]

Definition at line 82 of file commit.c.

char* saved_tag [static]

Definition at line 76 of file commit.c.

List* saved_ulist [static]

Definition at line 81 of file commit.c.

char* sbranch [static]

Definition at line 1196 of file commit.c.

char* tag

Definition at line 1890 of file commit.c.

char* update_dir

Definition at line 1579 of file commit.c.

Vers_TS** vers

Definition at line 689 of file commit.c.

int write_dirnonbranch [static]

Definition at line 78 of file commit.c.

char* write_dirtag [static]

Definition at line 77 of file commit.c.

Generated on Sun Oct 21 12:43:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


create_adm.c File Reference

cvs-1.10/src/create_adm.c File Reference

#include "cvs.h"

Include dependency graph for create_adm.c:

Include dependency graph

Go to the source code of this file.

Functions

int | Create_Admin (dir, update_dir, repository, tag, date, nonbranch, warn, dotemplate) char *dir

Variables

char * | update_dir
char * | repository
char * | tag
char * | date
int | nonbranch
int | warn
int | dotemplate

Function Documentation

int Create_Admin | ( | dir | ,
 |  | update_dir | ,
 |  | repository | ,
 |  | tag | ,
 |  | date | ,
 |  | nonbranch | ,
 |  | warn | ,
 |  | dotemplate |
 | ) |

Variable Documentation

char* date

Definition at line 31 of file create_adm.c.

int dotemplate

Definition at line 34 of file create_adm.c.

int nonbranch

Definition at line 32 of file create_adm.c.

char* repository

Definition at line 29 of file create_adm.c.

char* tag

Definition at line 30 of file create_adm.c.

char* update_dir

Definition at line 28 of file create_adm.c.

int warn

Definition at line 33 of file create_adm.c.

Generated on Sun Oct 21 12:43:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs.h File Reference

cvs-1.10/src/cvs.h File Reference

#include "config.h"
#include "options.h"
#include <stdio.h>
#include <strings.h>
#include <fnmatch.h>
#include <ctype.h>
#include <pwd.h>
#include <signal.h>
#include "system.h"
#include "hash.h"
#include <ndbm.h>
#include "regex.h"
#include "getopt.h"
#include "wait.h"
#include "rcs.h"
#include "error.h"
#include "update.h"
#include "server.h"

Include dependency graph for cvs.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | entnode
struct | file_info
struct | logfile_info
struct | stickydirtag
struct | vers_ts

Defines

#define | PTR char *
#define | PROTO(ARGS) ()
#define | PATH_MAX 1024+2
#define | CVSADM "CVS"
#define | CVSADM_ENT "CVS/Entries"
#define | CVSADM_ENTBAK "CVS/Entries.Backup"
#define | CVSADM_ENTLOG "CVS/Entries.Log"
#define | CVSADM_ENTSTAT "CVS/Entries.Static"
#define | CVSADM_REP "CVS/Repository"
#define | CVSADM_ROOT "CVS/Root"
#define | CVSADM_CIPROG "CVS/Checkin.prog"
#define | CVSADM_UPROG "CVS/Update.prog"
#define | CVSADM_TAG "CVS/Tag"
#define | CVSADM_NOTIFY "CVS/Notify"
#define | CVSADM_NOTIFYTMP "CVS/Notify.tmp"
#define | CVSADM_BASE "CVS/Base"
#define | CVSADM_BASEREV "CVS/Baserev"
#define | CVSADM_BASEREVTMP "CVS/Baserev.tmp"
#define | CVSADM_TEMPLATE "CVS/Template"
#define | CVSREP "CVS"
#define | CVSROOTADM "CVSROOT"
#define | CVSROOTADM_MODULES "modules"
#define | CVSROOTADM_LOGINFO "loginfo"
#define | CVSROOTADM_RCSINFO "rcsinfo"
#define | CVSROOTADM_COMMITINFO "commitinfo"
#define | CVSROOTADM_TAGINFO "taginfo"
#define | CVSROOTADM_EDITINFO "editinfo"
#define | CVSROOTADM_VERIFYMSG "verifymsg"
#define | CVSROOTADM_HISTORY "history"
#define | CVSROOTADM_VALTAGS "val-tags"
#define | CVSROOTADM_IGNORE "cvsignore"
#define | CVSROOTADM_CHECKOUTLIST "checkoutlist"
#define | CVSROOTADM_WRAPPER "cvswrappers"
#define | CVSROOTADM_NOTIFY "notify"
#define | CVSROOTADM_USERS "users"
#define | CVSROOTADM_READERS "readers"
#define | CVSROOTADM_WRITERS "writers"
#define | CVSROOTADM_PASSWD "passwd"
#define | CVSROOTADM_CONFIG "config"
#define | CVSNULLREPOS "Emptydir"
#define | CVSATTIC "Attic"
#define | CVSLCK "#cvs.lock"
#define | CVSRFL "#cvs.rfl"
#define | CVSWFL "#cvs.wfl"
#define | CVSRFLPAT "#cvs.rfl.*"
#define | CVSEXT_LOG ",t"
#define | CVSPREFIX ",,"
#define | CVSDOTIGNORE ".cvsignore"
#define | CVSDOTWRAPPER ".cvswrappers"
#define | CVS_CMD_IGNORE_ADMROOT 1
#define | CVS_CMD_USES_WORK_DIR 2
#define | CVS_CMD_MODIFIES_REPOSITORY 4
#define | CVSEDITPREFIX "CVS: "
#define | CVSEDITPREFIXLEN 4
#define | CVSLCKAGE (60*60)
#define | CVSLCKSLEEP 30
#define | CVSBRANCH "1.1.1"
#define | BAKPREFIX ".#"
#define | DEVNULL "/dev/null"
#define | TAG_HEAD "HEAD"
#define | TAG_BASE "BASE"
#define | CVSREAD_ENV "CVSREAD"
#define | CVSREAD_DFLT 0
#define | TMPDIR_ENV "TMPDIR"
#define | EDITOR1_ENV "CVSEDITOR"
#define | EDITOR2_ENV "VISUAL"
#define | EDITOR3_ENV "EDITOR"
#define | CVSROOT_ENV "CVSROOT"
#define | CVSROOT_DFLT NULL
#define | IGNORE_ENV "CVSIGNORE"
#define | WRAPPER_ENV "CVSWRAPPERS"
#define | CVSUMASK_ENV "CVSUMASK"
#define | REPOS_STRIP "/master/"
#define | MAXDATELEN 50
#define | W_LOCAL 0x01
#define | W_REPOS 0x02
#define | W_ATTIC 0x04
#define | RCS_FLAGS_FORCE 1
#define | RCS_FLAGS_DEAD 2
#define | RCS_FLAGS_QUIET 4
#define | RCS_FLAGS_MODTIME 8
#define | RCS_FLAGS_KEEPFILE 16
#define | RUN_NORMAL 0x0000
#define | RUN_COMBINED 0x0001
#define | RUN_REALLY 0x0002
#define | RUN_STDOUT_APPEND 0x0004
#define | RUN_STDERR_APPEND 0x0008
#define | RUN_SIGIGNORE 0x0010
#define | RUN_TTY (char *)0
#define | run_pclose pclose

Typedefs

typedef entnode | Entnode
typedef enum direnter_type | Dtype
typedef int(* | CALLPROC )()
typedef RETSIGTYPE(* | SIGCLEANUPPROC )()
typedef void(* | Ignore_proc )()
typedef int(* | CALLBACKPROC )()
typedef int(* | FILEPROC )()
typedef int(* | FILESDONEPROC )()
typedef Dtype(* | DIRENTPROC )()
typedef int(* | DIRLEAVEPROC )()
typedef vers_ts | Vers_TS
typedef enum classify_type | Ctype

Enumerations

enum | ent_type { ENT_FILE, ENT_SUBDIR }
enum | mtype { CHECKOUT, TAG, PATCH, EXPORT }
enum | direnter_type { R_PROCESS = 1, R_SKIP_FILES, R_SKIP_DIRS, R_SKIP_ALL }
enum CVSmethod {
local_method, server_method, pserver_method, kserver_method,
gserver_method, ext_method, fork_method
}
enum classify_type {
T_UNKNOWN = 1, T_CONFLICT, T_NEEDS_MERGE, T_MODIFIED,
T_CHECKOUT, T_ADDED, T_REMOVED, T_REMOVE_ENTRY,
T_UPTODATE, T_TITLE
}
enum | WrapMergeMethod { WRAP_MERGE, WRAP_COPY }
enum | WrapMergeHas { WRAP_TOCVS, WRAP_FROMCVS, WRAP_RCSOPTION }

Functions

void | exit ()
char * | getenv ()
char * | emptydir_name ()
int | safe_location ()
int | RCS_merge ()
int | RCS_exec_rcsdiff ()
int | diff_exec ()
int | diff_execv ()
DBM * | open_module ()
FILE * | open_file ()
List * Find_Directories ()
void | Entries_Close ()
List * Entries_Open ()
void | Subdirs_Known ()
void | Subdir_Register ()
void | Subdir_Deregister ()
char * | Make_Date ()
char * | date_from_time_t ()
void | date_to_internet ()
char * | Name_Repository ()
char * | Short_Repository ()
void | Sanitize_Repository_Name ()
char * | Name_Root ()
int | parse_cvsroot ()
void | set_local_cvsroot ()
void | Create_Root ()
void | root_allow_add ()
void | root_allow_free ()
int | root_allow_ok ()
char * | gca ()
void | check_numeric ()
char * | getcaller ()
char * | time_stamp ()
void * | xmalloc ()
void * | xrealloc ()
void | expand_string ()
char * | xstrdup ()
void | strip_trailing_newlines ()
int | pathname_levels ()
int | Parse_Info ()
int | parse_config ()
int | SIG_register ()
int | isdir ()
int | isfile ()
int | islink ()
int | isdevice ()
int | isreadable ()
int | iswritable ()
int | isaccessible ()
int | isabsolute ()
char * | xreadlink ()
char * | last_component ()
char * | get_homedir ()
char * | cvs_temp_name ()
int | numdots ()
char * | increment_revnum ()
int | compare_revnums ()
int | unlink_file ()
int | unlink_file_dir ()
int | update ()
int | xcmp ()
int | yesno ()
void * | valloc ()
time_t | get_date ()
int | Create_Admin ()
int | expand_at_signs ()
int | Reader_Lock ()
void | Lock_Cleanup ()
void | lock_tree_for_write ()
void | lock_dir_for_write ()
void | Scratch_Entry ()
void | ParseTag ()
void | WriteTag ()
void | cat_module ()
void | check_entries ()
void | close_module ()
void | copy_file ()
void | fperrmsg ()
void | free_names ()
int | ign_name ()
void | ign_add ()
void | ign_add_file ()
void | ign_setup ()
void | ign_dir_add ()
int | ignore_directory ()
void | ignore_files ()
void | line2argv ()
void | make_directories ()
void | make_directory ()
int | mkdir_if_needed ()
void | rename_file ()
char * | backup_file ()
void | expand_wild ()
void | strip_trailing_slashes ()
void | update_delproc ()
void | usage ()
void | xchmod ()
char * | xgetwd ()
List * Find_Names ()
void | Register ()
void | Update_Logfile ()
void | do_editor ()
void | do_verify ()
int | mkmodules ()
int | init ()
int | do_module ()
void | history_write ()
int | start_recursion ()
void | SIG_beginCrSect ()
void | SIG_endCrSect ()
int | SIG_inCrSect ()
void | read_cvsrc ()
char * | make_message_rcslegal ()
int | file_has_markers ()
void | get_file ()
void | resolve_symlink ()
void | run_arg ()
void | run_print ()
void | run_setup ()
int | run_exec ()
FILE * | run_popen ()
int | piped_child ()
void | close_on_exec ()
pid_t | waitpid ()
Vers_TS * Version_TS ()
void | freevers_ts ()
int | Checkin ()
int | No_Difference ()
int | special_file_mismatch ()
char * | base_get ()
void | base_register ()
void | base_deregister ()
Ctype Classify_File ()
void | wrap_setup ()
int | wrap_name_has ()
char * | wrap_rcsoption ()
char * | wrap_tocvs_process_file ()
int | wrap_merge_is_copy ()
void | wrap_fromcvs_process_file ()
void | wrap_add_file ()
void | wrap_add ()
void | wrap_send ()
char * | expand_path ()
void | variable_set ()
int | watch ()
int | edit ()
int | unedit ()
int | editors ()
int | watchers ()
int | annotate ()
int | add ()
int | admin ()
int | checkout ()
int | commit ()
int | diff ()
int | history ()
int | import ()
int | cvslog ()
int | patch ()
int | release ()
int | cvsremove ()
int | rtag ()
int | cvsstatus ()
int | cvstag ()
int | version ()
unsigned long int | lookup_command_attribute ()
void | tag_check_valid ()
void | tag_check_valid_join ()
void | cvs_output ()
void | cvs_output_binary ()
void | cvs_outerr ()
void | cvs_flusherr ()
void | cvs_flushout ()
void | cvs_output_tagged ()
int | isdirty_file (const char *)

Variables

int | errno
char * | program_name
char * | program_path
char * | command_name
char * | Tmpdir
char * | Editor
int | cvsadmin_root
char * | CurDir
int | really_quiet
int | quiet
int | use_editor
int | cvswrite
mode_t | cvsumask
char * | method_names []
char * | CVSroot_cmdline
char * | CVSroot_original
int | client_active
CVSmethod CVSroot_method
char * | CVSroot_username
char * | CVSroot_hostname
char * | CVSroot_directory
int | CVSroot_port
int | CVSroot_proxy_port
char * | CVSroot_proxy
List * root_directories
char * | current_root
int | trace
int | noexec
int | logoff
int | top_level_admin
char | hostname []
char * | lock_dir
int | ign_inhibit_server
int | ign_case
List * variable_list
int | enable_dirty

Define Documentation

#define BAKPREFIX ".#"

Definition at line 241 of file cvs.h.

#define CVSADM "CVS"

Definition at line 134 of file cvs.h.

#define CVSADM_BASE "CVS/Base"

Definition at line 148 of file cvs.h.

#define CVSADM_BASEREV "CVS/Baserev"

Definition at line 149 of file cvs.h.

#define CVSADM_BASEREVTMP "CVS/Baserev.tmp"

Definition at line 150 of file cvs.h.

#define CVSADM_CIPROG "CVS/Checkin.prog"

Definition at line 141 of file cvs.h.

#define CVSADM_ENT "CVS/Entries"

Definition at line 135 of file cvs.h.

#define CVSADM_ENTBAK "CVS/Entries.Backup"

Definition at line 136 of file cvs.h.

#define CVSADM_ENTLOG "CVS/Entries.Log"

Definition at line 137 of file cvs.h.

#define CVSADM_ENTSTAT "CVS/Entries.Static"

Definition at line 138 of file cvs.h.

#define CVSADM_NOTIFY "CVS/Notify"

Definition at line 144 of file cvs.h.

#define CVSADM_NOTIFYTMP "CVS/Notify.tmp"

Definition at line 145 of file cvs.h.

#define CVSADM_REP "CVS/Repository"

Definition at line 139 of file cvs.h.

#define CVSADM_ROOT "CVS/Root"

Definition at line 140 of file cvs.h.

#define CVSADM_TAG "CVS/Tag"

Definition at line 143 of file cvs.h.

#define CVSADM_TEMPLATE "CVS/Template"

Definition at line 152 of file cvs.h.

#define CVSADM_UPROG "CVS/Update.prog"

Definition at line 142 of file cvs.h.

#define CVSATTIC "Attic"

Definition at line 200 of file cvs.h.

#define CVSBRANCH "1.1.1"

Definition at line 235 of file cvs.h.

#define CVSDOTIGNORE ".cvsignore"

Definition at line 208 of file cvs.h.

#define CVSDOTWRAPPER ".cvswrappers"

Definition at line 209 of file cvs.h.

#define CVSEDITPREFIX "CVS: "

Definition at line 227 of file cvs.h.

#define CVSEDITPREFIXLEN 4

Definition at line 231 of file cvs.h.

#define CVSEXT_LOG ",t"

Definition at line 206 of file cvs.h.

#define CVSLCK "#cvs.lock"

Definition at line 202 of file cvs.h.

#define CVSLCKAGE (60*60)

Definition at line 233 of file cvs.h.

#define CVSLCKSLEEP 30

Definition at line 234 of file cvs.h.

#define CVSNULLREPOS "Emptydir"

Definition at line 191 of file cvs.h.

#define CVSPREFIX ",,"

Definition at line 207 of file cvs.h.

#define CVSREAD_DFLT 0

Definition at line 257 of file cvs.h.

#define CVSREAD_ENV "CVSREAD"

Definition at line 256 of file cvs.h.

#define CVSREP "CVS"

Definition at line 163 of file cvs.h.

#define CVSRFL "#cvs.rfl"

Definition at line 203 of file cvs.h.

#define CVSRFLPAT "#cvs.rfl.*"

Definition at line 205 of file cvs.h.

#define CVSROOTADM "CVSROOT"

Definition at line 171 of file cvs.h.

#define CVSROOTADM_CHECKOUTLIST "checkoutlist"

Definition at line 182 of file cvs.h.

#define CVSROOTADM_COMMITINFO "commitinfo"

Definition at line 175 of file cvs.h.

#define CVSROOTADM_CONFIG "config"

Definition at line 189 of file cvs.h.

#define CVSROOTADM_EDITINFO "editinfo"

Definition at line 177 of file cvs.h.

#define CVSROOTADM_HISTORY "history"

Definition at line 179 of file cvs.h.

#define CVSROOTADM_IGNORE "cvsignore"

Definition at line 181 of file cvs.h.

#define CVSROOTADM_LOGINFO "loginfo"

Definition at line 173 of file cvs.h.

#define CVSROOTADM_MODULES "modules"

Definition at line 172 of file cvs.h.

#define CVSROOTADM_NOTIFY "notify"

Definition at line 184 of file cvs.h.

#define CVSROOTADM_PASSWD "passwd"

Definition at line 188 of file cvs.h.

#define CVSROOTADM_RCSINFO "rcsinfo"

Definition at line 174 of file cvs.h.

#define CVSROOTADM_READERS "readers"

Definition at line 186 of file cvs.h.

#define CVSROOTADM_TAGINFO "taginfo"

Definition at line 176 of file cvs.h.

#define CVSROOTADM_USERS "users"

Definition at line 185 of file cvs.h.

#define CVSROOTADM_VALTAGS "val-tags"

Definition at line 180 of file cvs.h.

#define CVSROOTADM_VERIFYMSG "verifymsg"

Definition at line 178 of file cvs.h.

#define CVSROOTADM_WRAPPER "cvswrappers"

Definition at line 183 of file cvs.h.

#define CVSROOTADM_WRITERS "writers"

Definition at line 187 of file cvs.h.

#define CVSROOT_DFLT NULL

Definition at line 268 of file cvs.h.

#define CVSROOT_ENV "CVSROOT"

Definition at line 267 of file cvs.h.

#define CVSUMASK_ENV "CVSUMASK"

Definition at line 273 of file cvs.h.

#define CVSWFL "#cvs.wfl"

Definition at line 204 of file cvs.h.

#define CVS_CMD_IGNORE_ADMROOT 1

Definition at line 212 of file cvs.h.

#define CVS_CMD_MODIFIES_REPOSITORY 4

Definition at line 221 of file cvs.h.

#define CVS_CMD_USES_WORK_DIR 2

Definition at line 219 of file cvs.h.

#define DEVNULL "/dev/null"

Definition at line 243 of file cvs.h.

#define EDITOR1_ENV "CVSEDITOR"

Definition at line 262 of file cvs.h.

#define EDITOR2_ENV "VISUAL"

Definition at line 263 of file cvs.h.

#define EDITOR3_ENV "EDITOR"

Definition at line 264 of file cvs.h.

#define IGNORE_ENV "CVSIGNORE"

Definition at line 270 of file cvs.h.

#define MAXDATELEN 50

Definition at line 287 of file cvs.h.

#define PATH_MAX 1024+2

Definition at line 109 of file cvs.h.

#define PROTO ( ARGS ) ()

Definition at line 33 of file cvs.h.

#define PTR char *

Definition at line 25 of file cvs.h.

#define RCS_FLAGS_DEAD 2

Definition at line 422 of file cvs.h.

#define RCS_FLAGS_FORCE 1

Definition at line 421 of file cvs.h.

#define RCS_FLAGS_KEEPFILE 16

Definition at line 425 of file cvs.h.

#define RCS_FLAGS_MODTIME 8

Definition at line 424 of file cvs.h.

#define RCS_FLAGS_QUIET 4

Definition at line 423 of file cvs.h.

#define REPOS_STRIP "/master/"

Definition at line 282 of file cvs.h.

#define RUN_COMBINED 0x0001

Definition at line 672 of file cvs.h.

#define RUN_NORMAL 0x0000

Definition at line 671 of file cvs.h.

#define RUN_REALLY 0x0002

Definition at line 673 of file cvs.h.

#define RUN_SIGIGNORE 0x0010

Definition at line 676 of file cvs.h.

#define RUN_STDERR_APPEND 0x0008

Definition at line 675 of file cvs.h.

#define RUN_STDOUT_APPEND 0x0004

Definition at line 674 of file cvs.h.

#define RUN_TTY (char *)0

Definition at line 677 of file cvs.h.

#define TAG_BASE "BASE"

Definition at line 253 of file cvs.h.

#define TAG_HEAD "HEAD"

Definition at line 252 of file cvs.h.

#define TMPDIR_ENV "TMPDIR"

Definition at line 259 of file cvs.h.

#define WRAPPER_ENV "CVSWRAPPERS"

Definition at line 271 of file cvs.h.

#define W_ATTIC 0x04

Definition at line 342 of file cvs.h.

#define W_LOCAL 0x01

Definition at line 340 of file cvs.h.

#define W_REPOS 0x02

Definition at line 341 of file cvs.h.

#define run_pclose pclose

Definition at line 690 of file cvs.h.

Typedef Documentation

typedef int(* CALLBACKPROC)()

Definition at line 604 of file cvs.h.

typedef int(* CALLPROC)()

Definition at line 492 of file cvs.h.

typedef enum classify_type Ctype

Definition at line 808 of file cvs.h.

typedef Dtype(* DIRENTPROC)()

Definition at line 641 of file cvs.h.

typedef int(* DIRLEAVEPROC)()

Definition at line 643 of file cvs.h.

typedef enum direnter_type Dtype

Definition at line 355 of file cvs.h.

typedef struct entnode Entnode

Definition at line 312 of file cvs.h.

typedef int(* FILEPROC)()

Definition at line 635 of file cvs.h.

typedef int(* FILESDONEPROC)()

Definition at line 638 of file cvs.h.

typedef void(* Ignore_proc)()

Definition at line 558 of file cvs.h.

typedef RETSIGTYPE(* SIGCLEANUPPROC)()

Definition at line 496 of file cvs.h.

typedef struct vers_ts Vers_TS

Definition at line 765 of file cvs.h.

Enumeration Type Documentation

enum CVSmethod

Enumeration values:
local_method
server_method
pserver_method
kserver_method
gserver_method
ext_method
fork_method

Definition at line 368 of file cvs.h.

00368              {
00369   local_method, server_method, pserver_method, kserver_method, gserver_method,
00370   ext_method, fork_method
00371 } CVSmethod;

enum WrapMergeHas

Enumeration values:
WRAP_TOCVS
WRAP_FROMCVS
WRAP_RCSOPTION

Definition at line 831 of file cvs.h.

00831              {
00832     /* -t and -f wrapper options.  Treating directories as single files.  */
00833     WRAP_TOCVS,
00834     WRAP_FROMCVS,
00835     /* -k wrapper option.  Default keyword expansion options.  */
00836     WRAP_RCSOPTION
00837 } WrapMergeHas;

enum WrapMergeMethod

Enumeration values:
WRAP_MERGE
WRAP_COPY

Definition at line 830 of file cvs.h.

00830 { WRAP_MERGE, WRAP_COPY } WrapMergeMethod;

enum classify_type

Enumeration values:
T_UNKNOWN
T_CONFLICT
T_NEEDS_MERGE
T_MODIFIED
T_CHECKOUT
T_ADDED
T_REMOVED
T_REMOVE_ENTRY
T_UPTODATE
T_TITLE

Definition at line 792 of file cvs.h.

00793 {
00794     T_UNKNOWN = 1,          /* no old-style analog existed   */
00795     T_CONFLICT,             /* C (conflict) list         */
00796     T_NEEDS_MERGE,          /* G (needs merging) list    */
00797     T_MODIFIED,             /* M (needs checked in) list     */
00798     T_CHECKOUT,             /* O (needs checkout) list   */
00799     T_ADDED,                /* A (added file) list       */
00800     T_REMOVED,              /* R (removed file) list     */
00801     T_REMOVE_ENTRY,         /* W (removed entry) list    */
00802     T_UPTODATE,             /* File is up-to-date        */
00803 #ifdef SERVER_SUPPORT
00804     T_PATCH,                /* P Like C, but can patch   */
00805 #endif
00806     T_TITLE             /* title for node type       */
00807 };

enum direnter_type

Enumeration values:
R_PROCESS
R_SKIP_FILES
R_SKIP_DIRS
R_SKIP_ALL

Definition at line 345 of file cvs.h.

00346 {
00347     R_PROCESS = 1,          /* process files and maybe dirs */
00348     R_SKIP_FILES,           /* don't process files in this dir */
00349     R_SKIP_DIRS,            /* don't process sub-dirs */
00350     R_SKIP_ALL              /* don't process files or dirs */
00351 };

enum ent_type

Enumeration values:
ENT_FILE
ENT_SUBDIR

Definition at line 290 of file cvs.h.

00291 {
00292     ENT_FILE, ENT_SUBDIR
00293 };

enum mtype

Enumeration values:
CHECKOUT
TAG
PATCH
EXPORT

Definition at line 315 of file cvs.h.

00316 {
00317     CHECKOUT, TAG, PATCH, EXPORT
00318 };

Function Documentation

int Checkin ( )

Ctype Classify_File ( )

Referenced by vers().

int Create_Admin ( )

void Create_Root ( )

void Entries_Close ( )

List* Entries_Open ( )

Referenced by TBrowserFill::EnterDirectory(), TViewFill::EnterDirectory(), CFillTclEntries::EnterDirectory(), CFillPyEntries::EnterDirectory(), CGraphDoc::SetNode(), and UCvsGraph::UCvsGraph().

List* Find_Directories ( )

List* Find_Names ( )

void Lock_Cleanup ( )

Referenced by error_exit().

char* Make_Date ( )

Referenced by preload_update_dir().

char* Name_Repository ( )

Referenced by entries().

char* Name_Root ( )

int No_Difference ( )

void ParseTag ( )

int Parse_Info ( )

int RCS_exec_rcsdiff ( )

int RCS_merge ( )

int Reader_Lock ( )

void Register ( )

Referenced by CPersistent::CPersistent().

void SIG_beginCrSect ( )

void SIG_endCrSect ( )

int SIG_inCrSect ( )

int SIG_register ( )

void Sanitize_Repository_Name ( )

void Scratch_Entry ( )

char* Short_Repository ( )

void Subdir_Deregister ( )

void Subdir_Register ( )

Referenced by sticky().

void Subdirs_Known ( )

void Update_Logfile ( )

Vers_TS* Version_TS ( )

void WriteTag ( )

Referenced by entries().

int add ( )

int admin ( )

int annotate ( )

char* backup_file ( )

void base_deregister ( )

char* base_get ( )

void base_register ( )

void cat_module ( )

void check_entries ( )

void check_numeric ( )

int checkout ( )

void close_module ( )

void close_on_exec ( )

int commit ( )

int compare_revnums ( )

void copy_file ( )

void cvs_flusherr ( )

void cvs_flushout ( )

void cvs_outerr ( )

Referenced by extra_arg().

void cvs_output ( )

Referenced by repository(), and yesno().

void cvs_output_binary ( )

void cvs_output_tagged ( )

Referenced by letter().

char* cvs_temp_name ( )

Definition at line 739 of file filesubr.c.

00740 {
00741     char value[L_tmpnam + 1];
00742     char *retval;
00743
00744     /* FIXME: what is the VMS equivalent to TMPDIR?  */
00745     retval = tmpnam (value);
00746     if (retval == NULL)
00747     error (1, errno, "cannot generate temporary filename");
00748     return xstrdup (retval);
00749 }

int cvslog ( )

int cvsremove ( )

int cvsstatus ( )

int cvstag ( )

char* date_from_time_t ( )

void date_to_internet ( )

int diff ( )

int diff_exec ( )

int diff_execv ( )

void do_editor ( )

int do_module ( )

void do_verify ( )

int edit ( )

int editors ( )

char* emptydir_name ( )

void exit ( )

int expand_at_signs ( )

char* expand_path ( )

void expand_string ( )

Referenced by ptr().

void expand_wild ( )

int file_has_markers ( )

void fperrmsg ( )

void free_names ( )

void freevers_ts ( )

Referenced by vers().

char* gca ( )

time_t get_date ( )

Referenced by KoDateColumn::Compare(), and get_date().

void get_file ( )

char* get_homedir ( )

Referenced by ign_setup(), and wrap_setup().

char* getcaller ( )

char* getenv ( )

int history ( )

void history_write ( )

void ign_add ( )

Referenced by BuildIgnoredList(), ReadIgnoredFile(), and ign_setup().

void ign_add_file ( )

Referenced by ign_setup().

void ign_dir_add ( )

int ign_name ( )

void ign_setup ( )

Definition at line 54 of file ignore.c.

Referenced by local().

00055 {
00056     char *home_dir;
00057     char *tmp;
00058
00059     ign_inhibit_server = 0;
00060
00061     /* Start with default list and special case */
00062     tmp = xstrdup (ign_default);
00063     ign_add (tmp, 0);
00064     free (tmp);
00065
00066 #ifdef CLIENT_SUPPORT
00067     /* The client handles another way, by (after it does its own ignore file
00068        processing, and only if !ign_inhibit_server), letting the server
00069        know about the files and letting it decide whether to ignore
00070        them based on CVSROOOTADM_IGNORE.  */
00071     if (!client_active)
00072 #endif
00073     {
00074     char *file = xmalloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM)
00075                   + sizeof (CVSROOTADM_IGNORE) + 10);
00076     /* Then add entries found in repository, if it exists */
00077     (void) sprintf (file, "%s/%s/%s", CVSroot_directory,
00078             CVSROOTADM, CVSROOTADM_IGNORE);
00079     ign_add_file (file, 0);
00080     free (file);
00081     }
00082
00083     /* Then add entries found in home dir, (if user has one) and file exists */
00084     home_dir = get_homedir ();
00085     /* If we can't find a home directory, ignore ~/.cvsignore.  This may
00086        make tracking down problems a bit of a pain, but on the other
00087        hand it might be obnoxious to complain when CVS will function
00088        just fine without .cvsignore (and many users won't even know what
00089        .cvsignore is).  */
00090     if (home_dir)
00091     {
00092     char *file = xmalloc (strlen (home_dir) + sizeof (CVSDOTIGNORE) + 10);
00093     (void) sprintf (file, "%s/%s", home_dir, CVSDOTIGNORE);
00094     ign_add_file (file, 0);
00095     free (file);
00096     }
00097
00098     /* Then add entries found in CVSIGNORE environment variable. */
00099     ign_add (getenv (IGNORE_ENV), 0);
00100
00101     /* Later, add ignore entries found in -I arguments */
00102 }

int ignore_directory ( )

void ignore_files ( )

int import ( )

char* increment_revnum ( )

int init ( )

int isabsolute ( )

int isaccessible ( )

int isdevice ( )

int isdir ( )

int isdirty_file ( const char * )

int isfile ( )

Referenced by filter(), update_server(), and wrap_setup().

int islink ( )

int isreadable ( )

int iswritable ( )

char* last_component ( )

Referenced by sticky().

void line2argv ( )

void lock_dir_for_write ( )

void lock_tree_for_write ( )

unsigned long int lookup_command_attribute ( )

void make_directories ( )

void make_directory ( )

char* make_message_rcslegal ( )

int mkdir_if_needed ( )

Referenced by sticky().

int mkmodules ( )

int numdots ( )

Referenced by default_branch(), and vers().

FILE* open_file ( )

Referenced by rootdir().

DBM* open_module ( )

Definition at line 63 of file modules.c.

00064 {
00065     char *mfile;
00066     DBM *retval;
00067
00068     if (CVSroot_original == NULL)
00069     {
00070     error (0, 0, "must set the CVSROOT environment variable");
00071     error (1, 0, "or specify the '-d' global option");
00072     }
00073     mfile = xmalloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM)
00074              + sizeof (CVSROOTADM_MODULES) + 20);
00075     (void) sprintf (mfile, "%s/%s/%s", CVSroot_directory,
00076             CVSROOTADM, CVSROOTADM_MODULES);
00077     retval = dbm_open (mfile, O_RDONLY, 0666);
00078     free (mfile);
00079     return retval;
00080 }

int parse_config ( )

int parse_cvsroot ( )

int patch ( )

int pathname_levels ( )

int piped_child ( )

Referenced by argv().

void read_cvsrc ( )

int release ( )

void rename_file ( )

Referenced by update_server().

void resolve_symlink ( )

void root_allow_add ( )

void root_allow_free ( )

int root_allow_ok ( )

int rtag ( )

void run_arg ( )

Referenced by closure().

int run_exec ( )

FILE* run_popen ( )

void run_print ( )

void run_setup ( )

int safe_location ( )

void set_local_cvsroot ( )

int special_file_mismatch ( )

int start_recursion ( )

Referenced by local().

void strip_trailing_newlines ( )

void strip_trailing_slashes ( )

void tag_check_valid ( )

void tag_check_valid_join ( )

char* time_stamp ( )

Referenced by sawdir().

int unedit ( )

int unlink_file ( )

int unlink_file_dir ( )

Referenced by update_server().

int update ( )

void update_delproc ( )

void usage ( void )

void* valloc ( )

void variable_set ( )

int version ( )

pid_t waitpid ( )

Referenced by cvs_process_close().

int watch ( )

int watchers ( )

void wrap_add ( )

Referenced by wrap_setup().

void wrap_add_file ( )

Referenced by wrap_setup().

void wrap_fromcvs_process_file ( )

int wrap_merge_is_copy ( )

int wrap_name_has ( )

char* wrap_rcsoption ( )

void wrap_send ( )

void wrap_setup ( )

Definition at line 85 of file wrapper.c.

00086 {
00087     /* FIXME-reentrancy: if we do a multithreaded server, will need to
00088        move this to a per-connection data structure, or better yet
00089        think about a cleaner solution.  */
00090     static int wrap_setup_already_done = 0;
00091     char *homedir;
00092
00093     if (wrap_setup_already_done != 0)
00094         return;
00095     else
00096         wrap_setup_already_done = 1;
00097
00098 #ifdef CLIENT_SUPPORT
00099     if (!client_active)
00100 #endif
00101     {
00102     char *file;
00103
00104     file = xmalloc (strlen (CVSroot_directory)
00105             + sizeof (CVSROOTADM)
00106             + sizeof (CVSROOTADM_WRAPPER)
00107             + 10);
00108     /* Then add entries found in repository, if it exists.  */
00109     (void) sprintf (file, "%s/%s/%s", CVSroot_directory, CVSROOTADM,
00110             CVSROOTADM_WRAPPER);
00111     if (isfile (file))
00112     {
00113         wrap_add_file(file,0);
00114     }
00115     free (file);
00116     }
00117
00118     /* Then add entries found in home dir, (if user has one) and file
00119        exists.  */
00120     homedir = get_homedir ();
00121     /* If we can't find a home directory, ignore ~/.cvswrappers.  This may
00122        make tracking down problems a bit of a pain, but on the other
00123        hand it might be obnoxious to complain when CVS will function
00124        just fine without .cvswrappers (and many users won't even know what
00125        .cvswrappers is).  */
00126     if (homedir != NULL)
00127     {
00128     char *file;
00129
00130     file = xmalloc (strlen (homedir) + sizeof (CVSDOTWRAPPER) + 10);
00131     (void) sprintf (file, "%s/%s", homedir, CVSDOTWRAPPER);
00132     if (isfile (file))
00133     {
00134         wrap_add_file (file, 0);
00135     }
00136     free (file);
00137     }
00138
00139     /* FIXME: calling wrap_add() below implies that the CVSWRAPPERS
00140      * environment variable contains exactly one "wrapper" -- a line
00141      * of the form
00142      *
00143      *    FILENAME_PATTERN  FLAG  OPTS [ FLAG OPTS ...]
00144      *
00145      * This may disagree with the documentation, which states:
00146      *
00147      *   `$CVSWRAPPERS'
00148      *      A whitespace-separated list of file name patterns that CVS
00149      *      should treat as wrappers. *Note Wrappers::.
00150      *
00151      * Does this mean the environment variable can hold multiple
00152      * wrappers lines?  If so, a single call to wrap_add() is
00153      * insufficient.
00154      */
00155
00156     /* Then add entries found in CVSWRAPPERS environment variable. */
00157     wrap_add (getenv (WRAPPER_ENV), 0);
00158 }

char* wrap_tocvs_process_file ( )

void xchmod ( )

int xcmp ( )

char* xgetwd ( )

Definition at line 18 of file getwd.c.

00019 {
00020     char pathname[256];
00021
00022     return xstrdup (getcwd (pathname, sizeof (pathname) - 2, 0));
00023 }

void* xmalloc ( )

char* xreadlink ( )

void* xrealloc ( )

char* xstrdup ( )

Referenced by argstring(), attrs(), cvs_temp_name(), default_branch(), filter(), hold(), ign_setup(), rev(), rootdir(), run_setup(), val(), vers(), and xgetwd().

int yesno ( )

Definition at line 29 of file yesno.c.

00030 {
00031   int c;
00032   int rv;
00033
00034 #ifdef CVSGUI_SHL
00035     char *response;
00036
00037     printf("\n");
00038     dllglue_flushconsole();
00039     response = getenv("CVSLIB_YESNO");
00040     if(response != 0L)
00041         return strcmp(response, "yes") == 0;
00042 #endif /* CVSGUI_SHL */
00043 #ifdef CVSGUI_PIPE
00044     char *response;
00045
00046     cvs_output("\n", 1);
00047     response = getenv("CVSLIB_YESNO");
00048     if(response != 0L)
00049         return strcmp(response, "yes") == 0;
00050 #endif /* CVSGUI_PIPE*/
00051
00052   fflush (stderr);
00053   fflush (stdout);
00054   c = getchar ();
00055   rv = (c == 'y') || (c == 'Y');
00056   while (c != EOF && c != '\n')
00057     c = getchar ();
00058
00059   return rv;
00060 }

Variable Documentation

char* CVSroot_cmdline

Definition at line 378 of file cvs.h.

char* CVSroot_directory

Definition at line 385 of file cvs.h.

char* CVSroot_hostname

Definition at line 384 of file cvs.h.

CVSmethod CVSroot_method

Definition at line 382 of file cvs.h.

char* CVSroot_original

Definition at line 380 of file cvs.h.

int CVSroot_port

Definition at line 390 of file cvs.h.

char* CVSroot_proxy

Definition at line 392 of file cvs.h.

int CVSroot_proxy_port

Definition at line 391 of file cvs.h.

char* CVSroot_username

Definition at line 383 of file cvs.h.

char* CurDir

Definition at line 361 of file cvs.h.

char * Editor

Definition at line 359 of file cvs.h.

char* Tmpdir

Definition at line 359 of file cvs.h.

int client_active

Definition at line 381 of file cvs.h.

char * command_name

Definition at line 358 of file cvs.h.

char* current_root

Definition at line 397 of file cvs.h.

int cvsadmin_root

Definition at line 360 of file cvs.h.

mode_t cvsumask

Definition at line 365 of file cvs.h.

int cvswrite

Definition at line 364 of file cvs.h.

int enable_dirty

Definition at line 915 of file cvs.h.

int errno

Definition at line 77 of file cvs.h.

char hostname[]

Definition at line 414 of file cvs.h.

int ign_case

Definition at line 561 of file cvs.h.

int ign_inhibit_server

Definition at line 560 of file cvs.h.

char* lock_dir

Definition at line 539 of file cvs.h.

int logoff

Definition at line 404 of file cvs.h.

char* method_names[]

Definition at line 372 of file cvs.h.

int noexec

Definition at line 403 of file cvs.h.

char* program_name

Definition at line 358 of file cvs.h.

char * program_path

Definition at line 358 of file cvs.h.

int quiet

Definition at line 362 of file cvs.h.

int really_quiet

Definition at line 362 of file cvs.h.

List* root_directories

Definition at line 396 of file cvs.h.

int top_level_admin

Definition at line 406 of file cvs.h.

int trace

Definition at line 402 of file cvs.h.

int use_editor

Definition at line 363 of file cvs.h.

List* variable_list

Definition at line 856 of file cvs.h.

Generated on Sun Oct 21 12:43:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvsrc.c File Reference

cvs-1.10/src/cvsrc.c File Reference

#include "cvs.h"
#include "getline.h"

Include dependency graph for cvsrc.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | CVSRC_FILENAME ".cvsrc"
#define | GROW 10

Functions

char * | strtok ()
void | read_cvsrc (argc, argv, cmdname) int *argc

Variables

char | cvsrc [] = ".cvsrc"
char *** | argv
char * | cmdname

Define Documentation

#define CVSRC_FILENAME ".cvsrc"

Definition at line 18 of file cvsrc.c.

#define GROW 10

Definition at line 22 of file cvsrc.c.

Function Documentation

void read_cvsrc | ( | argc | ,
 |  | argv | ,
 |  | cmdname |
 | ) |

char* strtok ( )

Variable Documentation

char*** argv

Definition at line 32 of file cvsrc.c.

char* cmdname

Definition at line 33 of file cvsrc.c.

char cvsrc[] = ".cvsrc"

Definition at line 20 of file cvsrc.c.

Generated on Sun Oct 21 12:43:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


diff.c File Reference

cvs-1.10/src/diff.c File Reference

#include "cvs.h"

Include dependency graph for diff.c:

Include dependency graph

Go to the source code of this file.

Enumerations

enum diff_file {
DIFF_ERROR, DIFF_ADDED, DIFF_REMOVED, DIFF_DIFFERENT,
DIFF_SAME
}

Functions

Dtype diff_dirproc ()
int | diff_filesdoneproc ()
int | diff_dirleaveproc ()
enum diff_file | diff_file_nodiff ()
int | diff_fileproc ()
void | diff_mark_errors ()
void | strcat_and_allocate ()
void | strcat_and_allocate (str, lenp, src) char **str

Variables

char * | diff_rev1
char * | diff_rev2
char * | diff_date1
char * | diff_date2
char * | use_rev1
char * | use_rev2
int | have_rev1_label
int | have_rev2_label
char * | user_file_rev
char * | options
char * | opts
size_t | opts_allocated = 1
int | diff_errors
int | empty_files = 0
const char *const | diff_usage []
option const | longopts []
size_t * | lenp
const char * | src
char ** | argv
file_info * finfo
char * | dir
char * | pos_repos
char * | update_dir
List * entries
int | err
char * | repos
Vers_TS * vers
enum diff_file | empty_file

Enumeration Type Documentation

enum diff_file

Enumeration values:
DIFF_ERROR
DIFF_ADDED
DIFF_REMOVED
DIFF_DIFFERENT
DIFF_SAME

Definition at line 19 of file diff.c.

00020 {
00021     DIFF_ERROR,
00022     DIFF_ADDED,
00023     DIFF_REMOVED,
00024     DIFF_DIFFERENT,
00025     DIFF_SAME
00026 };

Function Documentation

int diff_dirleaveproc ( ) [static]

Dtype diff_dirproc ( ) [static]

enum diff_file diff_file_nodiff ( ) [static]

int diff_fileproc ( ) [static]

int diff_filesdoneproc ( ) [static]

void diff_mark_errors ( ) [static]

void strcat_and_allocate | ( | str | ,
 |  | lenp | ,
 |  | src |
 | ) | [static]

void strcat_and_allocate ( ) [static]

Variable Documentation

char** argv

Definition at line 214 of file diff.c.

char* diff_date1 [static]

Definition at line 50 of file diff.c.

char * diff_date2 [static]

Definition at line 50 of file diff.c.

int diff_errors [static]

Definition at line 61 of file diff.c.

char* diff_rev1 [static]

Definition at line 48 of file diff.c.

char * diff_rev2 [static]

Definition at line 48 of file diff.c.

const char* const diff_usage[] [static]

Initial value:

{
    "Usage: %s %s [-lNR] [rcsdiff-options]\n",
    "    [[-r rev1 | -D date1] [-r rev2 | -D date2]] [files...] \n",
    "\t-l\tLocal directory only, not recursive\n",
    "\t-R\tProcess directories recursively.\n",
    "\t-D d1\tDiff revision for date against working file.\n",
    "\t-D d2\tDiff rev1/date1 against date2.\n",
    "\t-N\tinclude diffs for added and removed files.\n",
    "\t-r rev1\tDiff revision for rev1 against working file.\n",
    "\t-r rev2\tDiff rev1/date1 against rev2.\n",
    "\t--ifdef=arg\tOutput diffs in ifdef format.\n",
    "(consult the documentation for your diff program for rcsdiff-options.\n",
    "The most popular is -c for context diffs but there are many more).\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 67 of file diff.c.

char* dir

Definition at line 812 of file diff.c.

enum diff_file empty_file

Definition at line 827 of file diff.c.

int empty_files = 0 [static]

Definition at line 62 of file diff.c.

List* entries

Definition at line 815 of file diff.c.

int err

Definition at line 813 of file diff.c.

struct file_info* finfo

Definition at line 417 of file diff.c.

int have_rev1_label [static]

Definition at line 52 of file diff.c.

int have_rev2_label [static]

Definition at line 52 of file diff.c.

size_t* lenp

Definition at line 196 of file diff.c.

struct option const longopts[] [static]

Definition at line 110 of file diff.c.

char* options [static]

Definition at line 58 of file diff.c.

char* opts [static]

Definition at line 59 of file diff.c.

size_t opts_allocated = 1 [static]

Definition at line 60 of file diff.c.

char* pos_repos

Definition at line 775 of file diff.c.

char* repos

Definition at line 798 of file diff.c.

const char* src

Definition at line 197 of file diff.c.

char* update_dir

Definition at line 814 of file diff.c.

char* use_rev1 [static]

Definition at line 51 of file diff.c.

char * use_rev2 [static]

Definition at line 51 of file diff.c.

char* user_file_rev [static]

Definition at line 56 of file diff.c.

Vers_TS* vers

Definition at line 826 of file diff.c.

Generated on Sun Oct 21 12:42:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/diff.c Source File

cvs-1.10/src/diff.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Difference
00009  *
00010  * Run diff against versions in the repository.  Options that are specified are
00011  * passed on directly to "rcsdiff".
00012  *
00013  * Without any file arguments, runs diff against all the currently modified
00014  * files.
00015  */
00016
00017 #include "cvs.h"
00018
00019 enum diff_file
00020 {
00021     DIFF_ERROR,
00022     DIFF_ADDED,
00023     DIFF_REMOVED,
00024     DIFF_DIFFERENT,
00025     DIFF_SAME
00026 };
00027
00028 static Dtype diff_dirproc PROTO ((void *callerdat, char *dir,
00029                   char *pos_repos, char *update_dir,
00030                   List *entries));
00031 static int diff_filesdoneproc PROTO ((void *callerdat, int err,
00032                       char *repos, char *update_dir,
00033                       List *entries));
00034 static int diff_dirleaveproc PROTO ((void *callerdat, char *dir,
00035                      int err, char *update_dir,
00036                      List *entries));
00037 static enum diff_file diff_file_nodiff PROTO ((struct file_info *finfo,
00038                            Vers_TS *vers,
00039                            enum diff_file));
00040 static int diff_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00041 static void diff_mark_errors PROTO((int err));
00042
00043
00044 /* Global variables.  Would be cleaner if we just put this stuff in a
00045    struct like log.c does.  */
00046
00047 /* Command line tags, from -r option.  Points into argv.  */
00048 static char *diff_rev1, *diff_rev2;
00049 /* Command line dates, from -D option.  Malloc'd.  */
00050 static char *diff_date1, *diff_date2;
00051 static char *use_rev1, *use_rev2;
00052 static int have_rev1_label, have_rev2_label;
00053
00054 /* Revision of the user file, if it is unchanged from something in the
00055    repository and we want to use that fact.  */
00056 static char *user_file_rev;
00057
00058 static char *options;
00059 static char *opts;
00060 static size_t opts_allocated = 1;
00061 static int diff_errors;
00062 static int empty_files = 0;
00063
00064 /* FIXME: should be documenting all the options here.  They don't
00065    perfectly match rcsdiff options (for example, we always support
00066    --ifdef and --context, but rcsdiff only does if diff does).  */
00067 static const char *const diff_usage[] =
00068 {
00069     "Usage: %s %s [-lNR] [rcsdiff-options]\n",
00070     "    [[-r rev1 | -D date1] [-r rev2 | -D date2]] [files...] \n",
00071     "\t-l\tLocal directory only, not recursive\n",
00072     "\t-R\tProcess directories recursively.\n",
00073     "\t-D d1\tDiff revision for date against working file.\n",
00074     "\t-D d2\tDiff rev1/date1 against date2.\n",
00075     "\t-N\tinclude diffs for added and removed files.\n",
00076     "\t-r rev1\tDiff revision for rev1 against working file.\n",
00077     "\t-r rev2\tDiff rev1/date1 against rev2.\n",
00078     "\t--ifdef=arg\tOutput diffs in ifdef format.\n",
00079     "(consult the documentation for your diff program for rcsdiff-options.\n",
00080     "The most popular is -c for context diffs but there are many more).\n",
00081     "(Specify the --help global option for a list of other help options)\n",
00082     NULL
00083 };
00084
00085 /* I copied this array directly out of diff.c in diffutils 2.7, after
00086    removing the following entries, none of which seem relevant to use
00087    with CVS:
00088      --help
00089      --version
00090      --recursive
00091      --unidirectional-new-file
00092      --starting-file
00093      --exclude
00094      --exclude-from
00095      --sdiff-merge-assist
00096
00097    I changed the options which take optional arguments (--context and
00098    --unified) to return a number rather than a letter, so that the
00099    optional argument could be handled more easily.  I changed the
00100    --paginate and --brief options to return a number, since -l and -q
00101    mean something else to cvs diff.
00102
00103    The numbers 129- that appear in the fourth element of some entries
00104    tell the big switch in `diff' how to process those options. -- Ian
00105
00106    The following options, which diff lists as "An alias, no longer
00107    recommended" have been removed: --file-label --entire-new-file
00108    --ascii --print.  */
00109
00110 static struct option const longopts[] =
00111 {
00112     {"ignore-blank-lines", 0, 0, 'B'},
00113     {"context", 2, 0, 143},
00114     {"ifdef", 1, 0, 131},
00115     {"show-function-line", 1, 0, 'F'},
00116     {"speed-large-files", 0, 0, 'H'},
00117     {"ignore-matching-lines", 1, 0, 'I'},
00118     {"label", 1, 0, 'L'},
00119     {"new-file", 0, 0, 'N'},
00120     {"initial-tab", 0, 0, 148},
00121     {"width", 1, 0, 'W'},
00122     {"text", 0, 0, 'a'},
00123     {"ignore-space-change", 0, 0, 'b'},
00124     {"minimal", 0, 0, 'd'},
00125     {"ed", 0, 0, 'e'},
00126     {"forward-ed", 0, 0, 'f'},
00127     {"ignore-case", 0, 0, 'i'},
00128     {"paginate", 0, 0, 144},
00129     {"rcs", 0, 0, 'n'},
00130     {"show-c-function", 0, 0, 'p'},
00131
00132     /* This is a potentially very useful option, except the output is so
00133        silly.  It would be much better for it to look like "cvs rdiff -s"
00134        which displays all the same info, minus quite a few lines of
00135        extraneous garbage.  */
00136     {"brief", 0, 0, 145},
00137
00138     {"report-identical-files", 0, 0, 's'},
00139     {"expand-tabs", 0, 0, 't'},
00140     {"ignore-all-space", 0, 0, 'w'},
00141     {"side-by-side", 0, 0, 147},
00142     {"unified", 2, 0, 146},
00143     {"left-column", 0, 0, 129},
00144     {"suppress-common-lines", 0, 0, 130},
00145     {"old-line-format", 1, 0, 132},
00146     {"new-line-format", 1, 0, 133},
00147     {"unchanged-line-format", 1, 0, 134},
00148     {"line-format", 1, 0, 135},
00149     {"old-group-format", 1, 0, 136},
00150     {"new-group-format", 1, 0, 137},
00151     {"unchanged-group-format", 1, 0, 138},
00152     {"changed-group-format", 1, 0, 139},
00153     {"horizon-lines", 1, 0, 140},
00154     {"binary", 0, 0, 142},
00155     {0, 0, 0, 0}
00156 };
00157
00158 /* CVS 1.9 and similar versions seemed to have pretty weird handling
00159    of -y and -T.  In the cases where it called rcsdiff,
00160    they would have the meanings mentioned below.  In the cases where it
00161    called diff, they would have the meanings mentioned in "longopts".
00162    Noone seems to have missed them, so I think the right thing to do is
00163    just to remove the options altogether (which I have done).
00164
00165    In the case of -z and -q, "cvs diff" did not accept them even back
00166    when we called rcsdiff (at least, it hasn't accepted them
00167    recently).
00168
00169    In comparing rcsdiff to the new CVS implementation, I noticed that
00170    the following rcsdiff flags are not handled by CVS diff:
00171
00172        -y: perform diff even when the requested revisions are the
00173            same revision number
00174        -q: run quietly
00175        -T: preserve modification time on the RCS file
00176        -z: specify timezone for use in file labels
00177
00178    I think these are not really relevant.  -y is undocumented even in
00179    RCS 5.7, and seems like a minor change at best.  According to RCS
00180    documentation, -T only applies when a RCS file has been modified
00181    because of lock changes; doesn't CVS sidestep RCS's entire lock
00182    structure?  -z seems to be unsupported by CVS diff, and has a
00183    different meaning as a global option anyway.  (Adding it could be
00184    a feature, but if it is left out for now, it should not break
00185    anything.)  For the purposes of producing output, CVS diff appears
00186    mostly to ignore -q.  Maybe this should be fixed, but I think it's
00187    a larger issue than the changes included here.  */
00188
00189 static void strcat_and_allocate PROTO ((char **, size_t *, const char *));
00190
00191 /* *STR is a pointer to a malloc'd string.  *LENP is its allocated
00192    length.  Add SRC to the end of it, reallocating if necessary.  */
00193 static void
00194 strcat_and_allocate (str, lenp, src)
00195     char **str;
00196     size_t *lenp;
00197     const char *src;
00198 {
00199     size_t new_size;
00200
00201     new_size = strlen (*str) + strlen (src) + 1;
00202     if (*str == NULL || new_size >= *lenp)
00203     {
00204     while (new_size >= *lenp)
00205         *lenp *= 2;
00206     *str = xrealloc (*str, *lenp);
00207     }
00208     strcat (*str, src);
00209 }
00210
00211 int
00212 diff (argc, argv)
00213     int argc;
00214     char **argv;
00215 {
00216     char tmp[50];
00217     int c, err = 0;
00218     int local = 0;
00219     int which;
00220     int option_index;
00221
00222     if (argc == -1)
00223     usage (diff_usage);
00224
00225     have_rev1_label = have_rev2_label = 0;
00226
00227     /*
00228      * Note that we catch all the valid arguments here, so that we can
00229      * intercept the -r arguments for doing revision diffs; and -l/-R for a
00230      * non-recursive/recursive diff.
00231      */
00232
00233     /* Clean out our global variables (multiroot can call us multiple
00234        times and the server can too, if the client sends several
00235        diff commands).  */
00236     if (opts == NULL)
00237     {
00238     opts_allocated = 1;
00239     opts = xmalloc (opts_allocated);
00240     }
00241     opts[0] = '\0';
00242     diff_rev1 = NULL;
00243     diff_rev2 = NULL;
00244     diff_date1 = NULL;
00245     diff_date2 = NULL;
00246
00247     optind = 0;
00248     while ((c = getopt_long (argc, argv,
00249            "+abcdefhilnpstuw0123456789BHNRC:D:F:I:L:U:V:W:k:r:",
00250                  longopts, &option_index)) != -1)
00251     {
00252     switch (c)
00253     {
00254         case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
00255         case 'h': case 'i': case 'n': case 'p': case 's': case 't':
00256         case 'u': case 'w': case '0': case '1': case '2':
00257         case '3': case '4': case '5': case '6': case '7': case '8':
00258         case '9': case 'B': case 'H':
00259         (void) sprintf (tmp, " -%c", (char) c);
00260         strcat_and_allocate (&opts, &opts_allocated, tmp);
00261         break;
00262         case 'L':
00263         if (have_rev1_label++)
00264             if (have_rev2_label++)
00265             {
00266             error (0, 0, "extra -L arguments ignored");
00267             break;
00268             }
00269
00270             strcat_and_allocate (&opts, &opts_allocated, " -L");
00271             strcat_and_allocate (&opts, &opts_allocated, optarg);
00272         break;
00273         case 'C': case 'F': case 'I': case 'U': case 'V': case 'W':
00274         (void) sprintf (tmp, " -%c", (char) c);
00275         strcat_and_allocate (&opts, &opts_allocated, tmp);
00276         strcat_and_allocate (&opts, &opts_allocated, optarg);
00277         break;
00278         case 131:
00279         /* --ifdef.  */
00280         strcat_and_allocate (&opts, &opts_allocated, " --ifdef=");
00281         strcat_and_allocate (&opts, &opts_allocated, optarg);
00282         break;
00283         case 129: case 130:           case 132: case 133: case 134:
00284         case 135: case 136: case 137: case 138: case 139: case 140:
00285         case 141: case 142: case 143: case 144: case 145: case 146:
00286         case 147: case 148:
00287         strcat_and_allocate (&opts, &opts_allocated, " --");
00288         strcat_and_allocate (&opts, &opts_allocated,
00289                      longopts[option_index].name);
00290         if (longopts[option_index].has_arg == 1
00291             || (longopts[option_index].has_arg == 2
00292             && optarg != NULL))
00293         {
00294             strcat_and_allocate (&opts, &opts_allocated, "=");
00295             strcat_and_allocate (&opts, &opts_allocated, optarg);
00296         }
00297         break;
00298         case 'R':
00299         local = 0;
00300         break;
00301         case 'l':
00302         local = 1;
00303         break;
00304         case 'k':
00305         if (options)
00306             free (options);
00307         options = RCS_check_kflag (optarg);
00308         break;
00309         case 'r':
00310         if (diff_rev2 != NULL || diff_date2 != NULL)
00311             error (1, 0,
00312                "no more than two revisions/dates can be specified");
00313         if (diff_rev1 != NULL || diff_date1 != NULL)
00314             diff_rev2 = optarg;
00315         else
00316             diff_rev1 = optarg;
00317         break;
00318         case 'D':
00319         if (diff_rev2 != NULL || diff_date2 != NULL)
00320             error (1, 0,
00321                "no more than two revisions/dates can be specified");
00322         if (diff_rev1 != NULL || diff_date1 != NULL)
00323             diff_date2 = Make_Date (optarg);
00324         else
00325             diff_date1 = Make_Date (optarg);
00326         break;
00327         case 'N':
00328         empty_files = 1;
00329         break;
00330         case '?':
00331         default:
00332         usage (diff_usage);
00333         break;
00334     }
00335     }
00336     argc -= optind;
00337     argv += optind;
00338
00339     /* make sure options is non-null */
00340     if (!options)
00341     options = xstrdup ("");
00342
00343 #ifdef CLIENT_SUPPORT
00344     if (client_active) {
00345     /* We're the client side.  Fire up the remote server.  */
00346     start_server ();
00347
00348     ign_setup ();
00349
00350     if (local)
00351         send_arg("-l");
00352     if (empty_files)
00353         send_arg("-N");
00354     send_option_string (opts);
00355     if (options[0] != '\0')
00356         send_arg (options);
00357     if (diff_rev1)
00358         option_with_arg ("-r", diff_rev1);
00359     if (diff_date1)
00360         client_senddate (diff_date1);
00361     if (diff_rev2)
00362         option_with_arg ("-r", diff_rev2);
00363     if (diff_date2)
00364         client_senddate (diff_date2);
00365
00366     /* Send the current files unless diffing two revs from the archive */
00367     if (diff_rev2 == NULL && diff_date2 == NULL)
00368         send_files (argc, argv, local, 0, 0);
00369     else
00370         send_files (argc, argv, local, 0, SEND_NO_CONTENTS);
00371
00372     send_file_names (argc, argv, SEND_EXPAND_WILD);
00373
00374     send_to_server ("diff\012", 0);
00375         err = get_responses_and_close ();
00376     free (options);
00377     options = NULL;
00378     return (err);
00379     }
00380 #endif
00381
00382     if (diff_rev1 != NULL)
00383     tag_check_valid (diff_rev1, argc, argv, local, 0, "");
00384     if (diff_rev2 != NULL)
00385     tag_check_valid (diff_rev2, argc, argv, local, 0, "");
00386
00387     which = W_LOCAL;
00388     if (diff_rev1 != NULL || diff_date1 != NULL)
00389     which |= W_REPOS | W_ATTIC;
00390
00391     wrap_setup ();
00392
00393     /* start the recursion processor */
00394     err = start_recursion (diff_fileproc, diff_filesdoneproc, diff_dirproc,
00395                diff_dirleaveproc, NULL, argc, argv, local,
00396                which, 0, 1, (char *) NULL, 1);
00397
00398     /* clean up */
00399     free (options);
00400     options = NULL;
00401
00402     if (diff_date1 != NULL)
00403     free (diff_date1);
00404     if (diff_date2 != NULL)
00405     free (diff_date2);
00406
00407     return (err);
00408 }
00409
00410 /*
00411  * Do a file diff
00412  */
00413 /* ARGSUSED */
00414 static int
00415 diff_fileproc (callerdat, finfo)
00416     void *callerdat;
00417     struct file_info *finfo;
00418 {
00419     int status, err = 2;        /* 2 == trouble, like rcsdiff */
00420     Vers_TS *vers;
00421     enum diff_file empty_file = DIFF_DIFFERENT;
00422     char *tmp;
00423     char *tocvsPath;
00424     char *fname;
00425
00426     /* Initialize these solely to avoid warnings from gcc -Wall about
00427        variables that might be used uninitialized.  */
00428     tmp = NULL;
00429     fname = NULL;
00430
00431     user_file_rev = 0;
00432     vers = Version_TS (finfo, NULL, NULL, NULL, 1, 0);
00433
00434     if (diff_rev2 != NULL || diff_date2 != NULL)
00435     {
00436     /* Skip all the following checks regarding the user file; we're
00437        not using it.  */
00438     }
00439     else if (vers->vn_user == NULL)
00440     {
00441     /* The file does not exist in the working directory.  */
00442     if ((diff_rev1 != NULL || diff_date1 != NULL)
00443         && vers->srcfile != NULL)
00444     {
00445         /* The file does exist in the repository.  */
00446         if (empty_files)
00447         empty_file = DIFF_REMOVED;
00448         else
00449         {
00450         int exists;
00451
00452         exists = 0;
00453         /* special handling for TAG_HEAD */
00454         if (diff_rev1 && strcmp (diff_rev1, TAG_HEAD) == 0)
00455         {
00456             char *head =
00457             (vers->vn_rcs == NULL
00458              ? NULL
00459              : RCS_branch_head (vers->srcfile, vers->vn_rcs));
00460             exists = head != NULL;
00461             if (head != NULL)
00462             free (head);
00463         }
00464         else
00465         {
00466             Vers_TS *xvers;
00467
00468             xvers = Version_TS (finfo, NULL, diff_rev1, diff_date1,
00469                     1, 0);
00470             exists = xvers->vn_rcs != NULL;
00471             freevers_ts (&xvers);
00472         }
00473         if (exists)
00474             error (0, 0,
00475                "%s no longer exists, no comparison available",
00476                finfo->fullname);
00477         freevers_ts (&vers);
00478         diff_mark_errors (err);
00479         return (err);
00480         }
00481     }
00482     else
00483     {
00484         error (0, 0, "I know nothing about %s", finfo->fullname);
00485         freevers_ts (&vers);
00486         diff_mark_errors (err);
00487         return (err);
00488     }
00489     }
00490     else if (vers->vn_user[0] == '0' && vers->vn_user[1] == '\0')
00491     {
00492     if (empty_files)
00493         empty_file = DIFF_ADDED;
00494     else
00495     {
00496         error (0, 0, "%s is a new entry, no comparison available",
00497            finfo->fullname);
00498         freevers_ts (&vers);
00499         diff_mark_errors (err);
00500         return (err);
00501     }
00502     }
00503     else if (vers->vn_user[0] == '-')
00504     {
00505     if (empty_files)
00506         empty_file = DIFF_REMOVED;
00507     else
00508     {
00509         error (0, 0, "%s was removed, no comparison available",
00510            finfo->fullname);
00511         freevers_ts (&vers);
00512         diff_mark_errors (err);
00513         return (err);
00514     }
00515     }
00516     else
00517     {
00518     if (vers->vn_rcs == NULL && vers->srcfile == NULL)
00519     {
00520         error (0, 0, "cannot find revision control file for %s",
00521            finfo->fullname);
00522         freevers_ts (&vers);
00523         diff_mark_errors (err);
00524         return (err);
00525     }
00526     else
00527     {
00528         if (vers->ts_user == NULL)
00529         {
00530         error (0, 0, "cannot find %s", finfo->fullname);
00531         freevers_ts (&vers);
00532         diff_mark_errors (err);
00533         return (err);
00534         }
00535         else if (!strcmp (vers->ts_user, vers->ts_rcs))
00536         {
00537         /* The user file matches some revision in the repository
00538            Diff against the repository (for remote CVS, we might not
00539            have a copy of the user file around).  */
00540         user_file_rev = vers->vn_user;
00541         }
00542     }
00543     }
00544
00545     empty_file = diff_file_nodiff (finfo, vers, empty_file);
00546     if (empty_file == DIFF_SAME || empty_file == DIFF_ERROR)
00547     {
00548     freevers_ts (&vers);
00549     if (empty_file == DIFF_SAME)
00550     {
00551         /* In the server case, would be nice to send a "Checked-in"
00552            response, so that the client can rewrite its timestamp.
00553            server_checked_in by itself isn't the right thing (it
00554            needs a server_register), but I'm not sure what is.
00555            It isn't clear to me how "cvs status" handles this (that
00556            is, for a client which sends Modified not Is-modified to
00557            "cvs status"), but it does.  */
00558         return (0);
00559     }
00560     else
00561     {
00562         diff_mark_errors (err);
00563         return (err);
00564     }
00565     }
00566
00567     if (empty_file == DIFF_DIFFERENT)
00568     {
00569     int dead1, dead2;
00570
00571     if (use_rev1 == NULL)
00572         dead1 = 0;
00573     else
00574         dead1 = RCS_isdead (vers->srcfile, use_rev1);
00575     if (use_rev2 == NULL)
00576         dead2 = 0;
00577     else
00578         dead2 = RCS_isdead (vers->srcfile, use_rev2);
00579
00580     if (dead1 && dead2)
00581     {
00582         freevers_ts (&vers);
00583         return (0);
00584     }
00585     else if (dead1)
00586     {
00587         if (empty_files)
00588             empty_file = DIFF_ADDED;
00589         else
00590         {
00591         error (0, 0, "%s is a new entry, no comparison available",
00592                finfo->fullname);
00593         freevers_ts (&vers);
00594         diff_mark_errors (err);
00595         return (err);
00596         }
00597     }
00598     else if (dead2)
00599     {
00600         if (empty_files)
00601         empty_file = DIFF_REMOVED;
00602         else
00603         {
00604         error (0, 0, "%s was removed, no comparison available",
00605                finfo->fullname);
00606         freevers_ts (&vers);
00607         diff_mark_errors (err);
00608         return (err);
00609         }
00610     }
00611     }
00612
00613     /* Output an "Index:" line for patch to use */
00614     cvs_output ("Index: ", 0);
00615     cvs_output (finfo->fullname, 0);
00616     cvs_output ("\n", 1);
00617
00618     tocvsPath = wrap_tocvs_process_file(finfo->file);
00619     if (tocvsPath)
00620     {
00621     /* Backup the current version of the file to CVS/,,filename */
00622     fname = xmalloc (strlen (finfo->file)
00623              + sizeof CVSADM
00624              + sizeof CVSPREFIX
00625              + 10);
00626     sprintf(fname,"%s/%s%s",CVSADM, CVSPREFIX, finfo->file);
00627     if (unlink_file_dir (fname) < 0)
00628         if (! existence_error (errno))
00629         error (1, errno, "cannot remove %s", fname);
00630     rename_file (finfo->file, fname);
00631     /* Copy the wrapped file to the current directory then go to work */
00632     copy_file (tocvsPath, finfo->file);
00633     }
00634
00635     if (empty_file == DIFF_ADDED || empty_file == DIFF_REMOVED)
00636     {
00637     /* This is file, not fullname, because it is the "Index:" line which
00638        is supposed to contain the directory.  */
00639     cvs_output ("\
00640 ===================================================================\n\
00641 RCS file: ", 0);
00642     cvs_output (finfo->file, 0);
00643     cvs_output ("\n", 1);
00644
00645     cvs_output ("diff -N ", 0);
00646     cvs_output (finfo->file, 0);
00647     cvs_output ("\n", 1);
00648
00649     if (empty_file == DIFF_ADDED)
00650     {
00651         if (use_rev2 == NULL)
00652         status = diff_exec (DEVNULL, finfo->file, opts, RUN_TTY);
00653         else
00654         {
00655         int retcode;
00656
00657         tmp = cvs_temp_name ();
00658         retcode = RCS_checkout (vers->srcfile, (char *) NULL,
00659                     use_rev2, (char *) NULL,
00660                     (*options
00661                      ? options
00662                      : vers->options),
00663                     tmp, (RCSCHECKOUTPROC) NULL,
00664                     (void *) NULL);
00665         if (retcode != 0)
00666         {
00667             diff_mark_errors (err);
00668             return err;
00669         }
00670
00671         status = diff_exec (DEVNULL, tmp, opts, RUN_TTY);
00672         }
00673     }
00674     else
00675     {
00676         int retcode;
00677
00678         tmp = cvs_temp_name ();
00679         retcode = RCS_checkout (vers->srcfile, (char *) NULL,
00680                     use_rev1, (char *) NULL,
00681                     *options ? options : vers->options,
00682                     tmp, (RCSCHECKOUTPROC) NULL,
00683                     (void *) NULL);
00684         if (retcode != 0)
00685         {
00686         diff_mark_errors (err);
00687         return err;
00688         }
00689
00690         status = diff_exec (tmp, DEVNULL, opts, RUN_TTY);
00691     }
00692     }
00693     else
00694     {
00695     char *label1 = NULL;
00696     char *label2 = NULL;
00697
00698     if (!have_rev1_label)
00699         label1 =
00700         make_file_label (finfo->fullname, use_rev1, vers->srcfile);
00701
00702     if (!have_rev2_label)
00703         label2 =
00704         make_file_label (finfo->fullname, use_rev2, vers->srcfile);
00705
00706     status = RCS_exec_rcsdiff (vers->srcfile, opts,
00707                    *options ? options : vers->options,
00708                    use_rev1, use_rev2,
00709                    label1, label2,
00710                    finfo->file);
00711
00712     if (label1) free (label1);
00713     if (label2) free (label2);
00714     }
00715
00716     switch (status)
00717     {
00718     case -1:            /* fork failed */
00719         error (1, errno, "fork failed while diffing %s",
00720            vers->srcfile->path);
00721     case 0:             /* everything ok */
00722         err = 0;
00723         break;
00724     default:            /* other error */
00725         err = status;
00726         break;
00727     }
00728
00729     if (tocvsPath)
00730     {
00731     if (unlink_file_dir (finfo->file) < 0)
00732         if (! existence_error (errno))
00733         error (1, errno, "cannot remove %s", finfo->file);
00734
00735     rename_file (fname, finfo->file);
00736     if (unlink_file (tocvsPath) < 0)
00737         error (1, errno, "cannot remove %s", tocvsPath);
00738     free (fname);
00739     }
00740
00741     if (empty_file == DIFF_REMOVED
00742     || (empty_file == DIFF_ADDED && use_rev2 != NULL))
00743     {
00744     if (CVS_UNLINK (tmp) < 0)
00745         error (0, errno, "cannot remove %s", tmp);
00746     free (tmp);
00747     }
00748
00749     freevers_ts (&vers);
00750     diff_mark_errors (err);
00751     return (err);
00752 }
00753
00754 /*
00755  * Remember the exit status for each file.
00756  */
00757 static void
00758 diff_mark_errors (err)
00759     int err;
00760 {
00761     if (err > diff_errors)
00762     diff_errors = err;
00763 }
00764
00765 /*
00766  * Print a warm fuzzy message when we enter a dir
00767  *
00768  * Don't try to diff directories that don't exist! -- DW
00769  */
00770 /* ARGSUSED */
00771 static Dtype
00772 diff_dirproc (callerdat, dir, pos_repos, update_dir, entries)
00773     void *callerdat;
00774     char *dir;
00775     char *pos_repos;
00776     char *update_dir;
00777     List *entries;
00778 {
00779     /* XXX - check for dirs we don't want to process??? */
00780
00781     /* YES ... for instance dirs that don't exist!!! -- DW */
00782     if (!isdir (dir))
00783     return (R_SKIP_ALL);
00784
00785     if (!quiet)
00786     error (0, 0, "Diffing %s", update_dir);
00787     return (R_PROCESS);
00788 }
00789
00790 /*
00791  * Concoct the proper exit status - done with files
00792  */
00793 /* ARGSUSED */
00794 static int
00795 diff_filesdoneproc (callerdat, err, repos, update_dir, entries)
00796     void *callerdat;
00797     int err;
00798     char *repos;
00799     char *update_dir;
00800     List *entries;
00801 {
00802     return (diff_errors);
00803 }
00804
00805 /*
00806  * Concoct the proper exit status - leaving directories
00807  */
00808 /* ARGSUSED */
00809 static int
00810 diff_dirleaveproc (callerdat, dir, err, update_dir, entries)
00811     void *callerdat;
00812     char *dir;
00813     int err;
00814     char *update_dir;
00815     List *entries;
00816 {
00817     return (diff_errors);
00818 }
00819
00820 /*
00821  * verify that a file is different
00822  */
00823 static enum diff_file
00824 diff_file_nodiff (finfo, vers, empty_file)
00825     struct file_info *finfo;
00826     Vers_TS *vers;
00827     enum diff_file empty_file;
00828 {
00829     Vers_TS *xvers;
00830     int retcode;
00831
00832     /* free up any old use_rev* variables and reset 'em */
00833     if (use_rev1)
00834     free (use_rev1);
00835     if (use_rev2)
00836     free (use_rev2);
00837     use_rev1 = use_rev2 = (char *) NULL;
00838
00839     if (diff_rev1 || diff_date1)
00840     {
00841     /* special handling for TAG_HEAD */
00842     if (diff_rev1 && strcmp (diff_rev1, TAG_HEAD) == 0)
00843         use_rev1 = ((vers->vn_rcs == NULL || vers->srcfile == NULL)
00844             ? NULL
00845             : RCS_branch_head (vers->srcfile, vers->vn_rcs));
00846     else
00847     {
00848         xvers = Version_TS (finfo, NULL, diff_rev1, diff_date1, 1, 0);
00849         if (xvers->vn_rcs != NULL)
00850         use_rev1 = xstrdup (xvers->vn_rcs);
00851         freevers_ts (&xvers);
00852     }
00853     }
00854     if (diff_rev2 || diff_date2)
00855     {
00856     /* special handling for TAG_HEAD */
00857     if (diff_rev2 && strcmp (diff_rev2, TAG_HEAD) == 0)
00858         use_rev2 = ((vers->vn_rcs == NULL || vers->srcfile == NULL)
00859             ? NULL
00860             : RCS_branch_head (vers->srcfile, vers->vn_rcs));
00861     else
00862     {
00863         xvers = Version_TS (finfo, NULL, diff_rev2, diff_date2, 1, 0);
00864         if (xvers->vn_rcs != NULL)
00865         use_rev2 = xstrdup (xvers->vn_rcs);
00866         freevers_ts (&xvers);
00867     }
00868
00869     if (use_rev1 == NULL)
00870     {
00871         /* The first revision does not exist.  If EMPTY_FILES is
00872                true, treat this as an added file.  Otherwise, warn
00873                about the missing tag.  */
00874         if (use_rev2 == NULL)
00875         /* At least in the case where DIFF_REV1 and DIFF_REV2
00876            are both numeric, we should be returning some kind
00877            of error (see basicb-8a0 in testsuite).  The symbolic
00878            case may be more complicated.  */
00879         return DIFF_SAME;
00880         else if (empty_files)
00881         return DIFF_ADDED;
00882         else if (diff_rev1)
00883         error (0, 0, "tag %s is not in file %s", diff_rev1,
00884                finfo->fullname);
00885         else
00886         error (0, 0, "no revision for date %s in file %s",
00887                diff_date1, finfo->fullname);
00888         return DIFF_ERROR;
00889     }
00890
00891     if (use_rev2 == NULL)
00892     {
00893         /* The second revision does not exist.  If EMPTY_FILES is
00894                true, treat this as a removed file.  Otherwise warn
00895                about the missing tag.  */
00896         if (empty_files)
00897         return DIFF_REMOVED;
00898         else if (diff_rev2)
00899         error (0, 0, "tag %s is not in file %s", diff_rev2,
00900                finfo->fullname);
00901         else
00902         error (0, 0, "no revision for date %s in file %s",
00903                diff_date2, finfo->fullname);
00904         return DIFF_ERROR;
00905     }
00906
00907     /* now, see if we really need to do the diff */
00908     if (strcmp (use_rev1, use_rev2) == 0)
00909         return DIFF_SAME;
00910     else
00911         return DIFF_DIFFERENT;
00912     }
00913
00914     if ((diff_rev1 || diff_date1) && use_rev1 == NULL)
00915     {
00916     /* The first revision does not exist, and no second revision
00917            was given.  */
00918     if (empty_files)
00919     {
00920         if (empty_file == DIFF_REMOVED)
00921         return DIFF_SAME;
00922         else
00923         {
00924         if (user_file_rev && use_rev2 == NULL)
00925             use_rev2 = xstrdup (user_file_rev);
00926         return DIFF_ADDED;
00927         }
00928     }
00929     else
00930     {
00931         if (diff_rev1)
00932         error (0, 0, "tag %s is not in file %s", diff_rev1,
00933                finfo->fullname);
00934         else
00935         error (0, 0, "no revision for date %s in file %s",
00936                diff_date1, finfo->fullname);
00937         return DIFF_ERROR;
00938     }
00939     }
00940
00941     if (user_file_rev)
00942     {
00943         /* drop user_file_rev into first unused use_rev */
00944         if (!use_rev1)
00945         use_rev1 = xstrdup (user_file_rev);
00946     else if (!use_rev2)
00947         use_rev2 = xstrdup (user_file_rev);
00948     /* and if not, it wasn't needed anyhow */
00949     user_file_rev = 0;
00950     }
00951
00952     /* now, see if we really need to do the diff */
00953     if (use_rev1 && use_rev2)
00954     {
00955     if (strcmp (use_rev1, use_rev2) == 0)
00956         return DIFF_SAME;
00957     else
00958         return DIFF_DIFFERENT;
00959     }
00960
00961     if (use_rev1 == NULL
00962     || (vers->vn_user != NULL && strcmp (use_rev1, vers->vn_user) == 0))
00963     {
00964     if (empty_file == DIFF_DIFFERENT
00965         && vers->ts_user != NULL
00966         && strcmp (vers->ts_rcs, vers->ts_user) == 0
00967         && (!(*options) || strcmp (options, vers->options) == 0))
00968     {
00969         return DIFF_SAME;
00970     }
00971     if (use_rev1 == NULL
00972         && (vers->vn_user[0] != '0' || vers->vn_user[1] != '\0'))
00973     {
00974         if (vers->vn_user[0] == '-')
00975         use_rev1 = xstrdup (vers->vn_user + 1);
00976         else
00977         use_rev1 = xstrdup (vers->vn_user);
00978     }
00979     }
00980
00981     /* If we already know that the file is being added or removed,
00982        then we don't want to do an actual file comparison here.  */
00983     if (empty_file != DIFF_DIFFERENT)
00984     return empty_file;
00985
00986     /*
00987      * with 0 or 1 -r option specified, run a quick diff to see if we
00988      * should bother with it at all.
00989      */
00990
00991     retcode = RCS_cmp_file (vers->srcfile, use_rev1,
00992                 *options ? options : vers->options,
00993                 finfo->file);
00994
00995     return retcode == 0 ? DIFF_SAME : DIFF_DIFFERENT;
00996 }
Generated on Sun Oct 21 12:41:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/edit.c Source File

cvs-1.10/src/edit.c

Go to the documentation of this file.
00001 /* Implementation for "cvs edit", "cvs watch on", and related commands
00002
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; either version 2, or (at your option)
00006    any later version.
00007
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.  */
00012
00013 #include "cvs.h"
00014 #include "getline.h"
00015 #include "watch.h"
00016 #include "edit.h"
00017 #include "fileattr.h"
00018
00019 static int watch_onoff PROTO ((int, char **));
00020
00021 static int setting_default;
00022 static int turning_on;
00023
00024 static int setting_tedit;
00025 static int setting_tunedit;
00026 static int setting_tcommit;
00027
00028 static int onoff_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00029
00030 static int
00031 onoff_fileproc (callerdat, finfo)
00032     void *callerdat;
00033     struct file_info *finfo;
00034 {
00035     fileattr_set (finfo->file, "_watched", turning_on ? "" : NULL);
00036     return 0;
00037 }
00038
00039 static int onoff_filesdoneproc PROTO ((void *, int, char *, char *, List *));
00040
00041 static int
00042 onoff_filesdoneproc (callerdat, err, repository, update_dir, entries)
00043     void *callerdat;
00044     int err;
00045     char *repository;
00046     char *update_dir;
00047     List *entries;
00048 {
00049     if (setting_default)
00050     fileattr_set (NULL, "_watched", turning_on ? "" : NULL);
00051     return err;
00052 }
00053
00054 static int
00055 watch_onoff (argc, argv)
00056     int argc;
00057     char **argv;
00058 {
00059     int c;
00060     int local = 0;
00061     int err;
00062
00063     optind = 0;
00064     while ((c = getopt (argc, argv, "+lR")) != -1)
00065     {
00066     switch (c)
00067     {
00068         case 'l':
00069         local = 1;
00070         break;
00071         case 'R':
00072         local = 0;
00073         break;
00074         case '?':
00075         default:
00076         usage (watch_usage);
00077         break;
00078     }
00079     }
00080     argc -= optind;
00081     argv += optind;
00082
00083 #ifdef CLIENT_SUPPORT
00084     if (client_active)
00085     {
00086     start_server ();
00087
00088     ign_setup ();
00089
00090     if (local)
00091         send_arg ("-l");
00092     send_files (argc, argv, local, 0, SEND_NO_CONTENTS);
00093     send_file_names (argc, argv, SEND_EXPAND_WILD);
00094     send_to_server (turning_on ? "watch-on\012" : "watch-off\012", 0);
00095     return get_responses_and_close ();
00096     }
00097 #endif /* CLIENT_SUPPORT */
00098
00099     setting_default = (argc <= 0);
00100
00101     lock_tree_for_write (argc, argv, local, 0);
00102
00103     err = start_recursion (onoff_fileproc, onoff_filesdoneproc,
00104                (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
00105                argc, argv, local, W_LOCAL, 0, 0, (char *)NULL,
00106                0);
00107
00108     Lock_Cleanup ();
00109     return err;
00110 }
00111
00112 int
00113 watch_on (argc, argv)
00114     int argc;
00115     char **argv;
00116 {
00117     turning_on = 1;
00118     return watch_onoff (argc, argv);
00119 }
00120
00121 int
00122 watch_off (argc, argv)
00123     int argc;
00124     char **argv;
00125 {
00126     turning_on = 0;
00127     return watch_onoff (argc, argv);
00128 }
00129
00130 static int dummy_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00131
00132 static int
00133 dummy_fileproc (callerdat, finfo)
00134     void *callerdat;
00135     struct file_info *finfo;
00136 {
00137     /* This is a pretty hideous hack, but the gist of it is that recurse.c
00138        won't call notify_check unless there is a fileproc, so we can't just
00139        pass NULL for fileproc.  */
00140     return 0;
00141 }
00142
00143 static int ncheck_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00144
00145 /* Check for and process notifications.  Local only.  I think that doing
00146    this as a fileproc is the only way to catch all the
00147    cases (e.g. foo/bar.c), even though that means checking over and over
00148    for the same CVSADM_NOTIFY file which we removed the first time we
00149    processed the directory.  */
00150
00151 static int
00152 ncheck_fileproc (callerdat, finfo)
00153     void *callerdat;
00154     struct file_info *finfo;
00155 {
00156     int notif_type;
00157     char *filename;
00158     char *val;
00159     char *cp;
00160     char *watches;
00161
00162     FILE *fp;
00163     char *line = NULL;
00164     size_t line_len = 0;
00165
00166     /* We send notifications even if noexec.  I'm not sure which behavior
00167        is most sensible.  */
00168
00169     fp = CVS_FOPEN (CVSADM_NOTIFY, "r");
00170     if (fp == NULL)
00171     {
00172     if (!existence_error (errno))
00173         error (0, errno, "cannot open %s", CVSADM_NOTIFY);
00174     return 0;
00175     }
00176
00177     while (getline (&line, &line_len, fp) > 0)
00178     {
00179     notif_type = line[0];
00180     if (notif_type == '\0')
00181         continue;
00182     filename = line + 1;
00183     cp = strchr (filename, '\t');
00184     if (cp == NULL)
00185         continue;
00186     *cp++ = '\0';
00187     val = cp;
00188     cp = strchr (val, '\t');
00189     if (cp == NULL)
00190         continue;
00191     *cp++ = '+';
00192     cp = strchr (cp, '\t');
00193     if (cp == NULL)
00194         continue;
00195     *cp++ = '+';
00196     cp = strchr (cp, '\t');
00197     if (cp == NULL)
00198         continue;
00199     *cp++ = '\0';
00200     watches = cp;
00201     cp = strchr (cp, '\n');
00202     if (cp == NULL)
00203         continue;
00204     *cp = '\0';
00205
00206     notify_do (notif_type, filename, getcaller (), val, watches,
00207            finfo->repository);
00208     }
00209     free (line);
00210
00211     if (ferror (fp))
00212     error (0, errno, "cannot read %s", CVSADM_NOTIFY);
00213     if (fclose (fp) < 0)
00214     error (0, errno, "cannot close %s", CVSADM_NOTIFY);
00215
00216     if ( CVS_UNLINK (CVSADM_NOTIFY) < 0)
00217     error (0, errno, "cannot remove %s", CVSADM_NOTIFY);
00218
00219     return 0;
00220 }
00221
00222 static int send_notifications PROTO ((int, char **, int));
00223
00224 /* Look through the CVSADM_NOTIFY file and process each item there
00225    accordingly.  */
00226 static int
00227 send_notifications (argc, argv, local)
00228     int argc;
00229     char **argv;
00230     int local;
00231 {
00232     int err = 0;
00233
00234 #ifdef CLIENT_SUPPORT
00235     /* OK, we've done everything which needs to happen on the client side.
00236        Now we can try to contact the server; if we fail, then the
00237        notifications stay in CVSADM_NOTIFY to be sent next time.  */
00238     if (client_active)
00239     {
00240     if (strcmp (command_name, "release") != 0)
00241     {
00242         start_server ();
00243         ign_setup ();
00244     }
00245
00246     err += start_recursion (dummy_fileproc, (FILESDONEPROC) NULL,
00247                 (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
00248                 argc, argv, local, W_LOCAL, 0, 0, (char *)NULL,
00249                 0);
00250
00251     send_to_server ("noop\012", 0);
00252     if (strcmp (command_name, "release") == 0)
00253         err += get_server_responses ();
00254     else
00255         err += get_responses_and_close ();
00256     }
00257     else
00258 #endif
00259     {
00260     /* Local.  */
00261
00262     lock_tree_for_write (argc, argv, local, 0);
00263     err += start_recursion (ncheck_fileproc, (FILESDONEPROC) NULL,
00264                 (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
00265                 argc, argv, local, W_LOCAL, 0, 0, (char *)NULL,
00266                 0);
00267     Lock_Cleanup ();
00268     }
00269     return err;
00270 }
00271
00272 static int edit_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00273
00274 static int
00275 edit_fileproc (callerdat, finfo)
00276     void *callerdat;
00277     struct file_info *finfo;
00278 {
00279     FILE *fp;
00280     time_t now;
00281     char *ascnow;
00282     char *basefilename;
00283
00284     if (noexec)
00285     return 0;
00286
00287     /* This is a somewhat screwy way to check for this, because it
00288        doesn't help errors other than the nonexistence of the file
00289        (e.g. permissions problems).  It might be better to rearrange
00290        the code so that CVSADM_NOTIFY gets written only after the
00291        various actions succeed (but what if only some of them
00292        succeed).  */
00293     if (!isfile (finfo->file))
00294     {
00295     error (0, 0, "no such file %s; ignored", finfo->fullname);
00296     return 0;
00297     }
00298
00299     fp = open_file (CVSADM_NOTIFY, "a");
00300
00301     (void) time (&now);
00302     ascnow = asctime (gmtime (&now));
00303     ascnow[24] = '\0';
00304     /* Fix non-standard format.  */
00305     if (ascnow[8] == '0') ascnow[8] = ' ';
00306     fprintf (fp, "E%s\t%s GMT\t%s\t%s\t", finfo->file,
00307          ascnow, hostname, CurDir);
00308     if (setting_tedit)
00309     fprintf (fp, "E");
00310     if (setting_tunedit)
00311     fprintf (fp, "U");
00312     if (setting_tcommit)
00313     fprintf (fp, "C");
00314     fprintf (fp, "\n");
00315
00316     if (fclose (fp) < 0)
00317     {
00318     if (finfo->update_dir[0] == '\0')
00319         error (0, errno, "cannot close %s", CVSADM_NOTIFY);
00320     else
00321         error (0, errno, "cannot close %s/%s", finfo->update_dir,
00322            CVSADM_NOTIFY);
00323     }
00324
00325     xchmod (finfo->file, 1);
00326
00327     /* Now stash the file away in CVSADM so that unedit can revert even if
00328        it can't communicate with the server.  We stash away a writable
00329        copy so that if the user removes the working file, then restores it
00330        with "cvs update" (which clears _editors but does not update
00331        CVSADM_BASE), then a future "cvs edit" can still win.  */
00332     /* Could save a system call by only calling mkdir_if_needed if
00333        trying to create the output file fails.  But copy_file isn't
00334        set up to facilitate that.  */
00335     mkdir_if_needed (CVSADM_BASE);
00336     basefilename = xmalloc (10 + sizeof CVSADM_BASE + strlen (finfo->file));
00337     strcpy (basefilename, CVSADM_BASE);
00338     strcat (basefilename, "/");
00339     strcat (basefilename, finfo->file);
00340     copy_file (finfo->file, basefilename);
00341     free (basefilename);
00342
00343     {
00344     Node *node;
00345
00346     node = findnode_fn (finfo->entries, finfo->file);
00347     if (node != NULL)
00348         base_register (finfo, ((Entnode *) node->data)->version);
00349     }
00350
00351     return 0;
00352 }
00353
00354 static const char *const edit_usage[] =
00355 {
00356     "Usage: %s %s [-lR] [files...]\n",
00357     "-l: Local directory only, not recursive\n",
00358     "-R: Process directories recursively\n",
00359     "-a: Specify what actions for temporary watch, one of\n",
00360     "    edit,unedit,commit,all,none\n",
00361     "(Specify the --help global option for a list of other help options)\n",
00362     NULL
00363 };
00364
00365 int
00366 edit (argc, argv)
00367     int argc;
00368     char **argv;
00369 {
00370     int local = 0;
00371     int c;
00372     int err;
00373     int a_omitted;
00374
00375     if (argc == -1)
00376     usage (edit_usage);
00377
00378     a_omitted = 1;
00379     setting_tedit = 0;
00380     setting_tunedit = 0;
00381     setting_tcommit = 0;
00382     optind = 0;
00383     while ((c = getopt (argc, argv, "+lRa:")) != -1)
00384     {
00385     switch (c)
00386     {
00387         case 'l':
00388         local = 1;
00389         break;
00390         case 'R':
00391         local = 0;
00392         break;
00393         case 'a':
00394         a_omitted = 0;
00395         if (strcmp (optarg, "edit") == 0)
00396             setting_tedit = 1;
00397         else if (strcmp (optarg, "unedit") == 0)
00398             setting_tunedit = 1;
00399         else if (strcmp (optarg, "commit") == 0)
00400             setting_tcommit = 1;
00401         else if (strcmp (optarg, "all") == 0)
00402         {
00403             setting_tedit = 1;
00404             setting_tunedit = 1;
00405             setting_tcommit = 1;
00406         }
00407         else if (strcmp (optarg, "none") == 0)
00408         {
00409             setting_tedit = 0;
00410             setting_tunedit = 0;
00411             setting_tcommit = 0;
00412         }
00413         else
00414             usage (edit_usage);
00415         break;
00416         case '?':
00417         default:
00418         usage (edit_usage);
00419         break;
00420     }
00421     }
00422     argc -= optind;
00423     argv += optind;
00424
00425     if (a_omitted)
00426     {
00427     setting_tedit = 1;
00428     setting_tunedit = 1;
00429     setting_tcommit = 1;
00430     }
00431
00432     if (strpbrk (hostname, "+,>;=\t\n") != NULL)
00433     error (1, 0,
00434            "host name (%s) contains an invalid character (+,>;=\\t\\n)",
00435            hostname);
00436     if (strpbrk (CurDir, "+,>;=\t\n") != NULL)
00437     error (1, 0,
00438 "current directory (%s) contains an invalid character (+,>;=\\t\\n)",
00439            CurDir);
00440
00441     /* No need to readlock since we aren't doing anything to the
00442        repository.  */
00443     err = start_recursion (edit_fileproc, (FILESDONEPROC) NULL,
00444                (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
00445                argc, argv, local, W_LOCAL, 0, 0, (char *)NULL,
00446                0);
00447
00448     err += send_notifications (argc, argv, local);
00449
00450     return err;
00451 }
00452
00453 static int unedit_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00454
00455 static int
00456 unedit_fileproc (callerdat, finfo)
00457     void *callerdat;
00458     struct file_info *finfo;
00459 {
00460     FILE *fp;
00461     time_t now;
00462     char *ascnow;
00463     char *basefilename;
00464
00465     if (noexec)
00466     return 0;
00467
00468     basefilename = xmalloc (10 + sizeof CVSADM_BASE + strlen (finfo->file));
00469     strcpy (basefilename, CVSADM_BASE);
00470     strcat (basefilename, "/");
00471     strcat (basefilename, finfo->file);
00472     if (!isfile (basefilename))
00473     {
00474     /* This file apparently was never cvs edit'd (e.g. we are uneditting
00475        a directory where only some of the files were cvs edit'd.  */
00476     free (basefilename);
00477     return 0;
00478     }
00479
00480     if (xcmp (finfo->file, basefilename) != 0)
00481     {
00482     printf ("%s has been modified; revert changes? ", finfo->fullname);
00483     if (!yesno ())
00484     {
00485         /* "no".  */
00486         free (basefilename);
00487         return 0;
00488     }
00489     }
00490     rename_file (basefilename, finfo->file);
00491     free (basefilename);
00492
00493     fp = open_file (CVSADM_NOTIFY, "a");
00494
00495     (void) time (&now);
00496     ascnow = asctime (gmtime (&now));
00497     ascnow[24] = '\0';
00498     /* Fix non-standard format.  */
00499     if (ascnow[8] == '0') ascnow[8] = ' ';
00500     fprintf (fp, "U%s\t%s GMT\t%s\t%s\t\n", finfo->file,
00501          ascnow, hostname, CurDir);
00502
00503     if (fclose (fp) < 0)
00504     {
00505     if (finfo->update_dir[0] == '\0')
00506         error (0, errno, "cannot close %s", CVSADM_NOTIFY);
00507     else
00508         error (0, errno, "cannot close %s/%s", finfo->update_dir,
00509            CVSADM_NOTIFY);
00510     }
00511
00512     /* Now update the revision number in CVS/Entries from CVS/Baserev.
00513        The basic idea here is that we are reverting to the revision
00514        that the user edited.  If we wanted "cvs update" to update
00515        CVS/Base as we go along (so that an unedit could revert to the
00516        current repository revision), we would need:
00517
00518        update (or all send_files?) (client) needs to send revision in
00519        new Entry-base request.  update (server/local) needs to check
00520        revision against repository and send new Update-base response
00521        (like Update-existing in that the file already exists.  While
00522        we are at it, might try to clean up the syntax by having the
00523        mode only in a "Mode" response, not in the Update-base itself).  */
00524     {
00525     char *baserev;
00526     Node *node;
00527     Entnode *entdata;
00528
00529     baserev = base_get (finfo);
00530     node = findnode_fn (finfo->entries, finfo->file);
00531     /* The case where node is NULL probably should be an error or
00532        something, but I don't want to think about it too hard right
00533        now.  */
00534     if (node != NULL)
00535     {
00536         entdata = (Entnode *) node->data;
00537         if (baserev == NULL)
00538         {
00539         /* This can only happen if the CVS/Baserev file got
00540            corrupted.  We suspect it might be possible if the
00541            user interrupts CVS, although I haven't verified
00542            that.  */
00543         error (0, 0, "%s not mentioned in %s", finfo->fullname,
00544                CVSADM_BASEREV);
00545
00546         /* Since we don't know what revision the file derives from,
00547            keeping it around would be asking for trouble.  */
00548         if (unlink_file (finfo->file) < 0)
00549             error (0, errno, "cannot remove %s", finfo->fullname);
00550
00551         /* This is cheesy, in a sense; why shouldn't we do the
00552            update for the user?  However, doing that would require
00553            contacting the server, so maybe this is OK.  */
00554         error (0, 0, "run update to complete the unedit");
00555         return 0;
00556         }
00557         Register (finfo->entries, finfo->file, baserev, entdata->timestamp,
00558               entdata->options, entdata->tag, entdata->date,
00559               entdata->conflict);
00560     }
00561     free (baserev);
00562     base_deregister (finfo);
00563     }
00564
00565     xchmod (finfo->file, 0);
00566     return 0;
00567 }
00568
00569 static const char *const unedit_usage[] =
00570 {
00571     "Usage: %s %s [-lR] [files...]\n",
00572     "-l: Local directory only, not recursive\n",
00573     "-R: Process directories recursively\n",
00574     "(Specify the --help global option for a list of other help options)\n",
00575     NULL
00576 };
00577
00578 int
00579 unedit (argc, argv)
00580     int argc;
00581     char **argv;
00582 {
00583     int local = 0;
00584     int c;
00585     int err;
00586
00587     if (argc == -1)
00588     usage (unedit_usage);
00589
00590     optind = 0;
00591     while ((c = getopt (argc, argv, "+lR")) != -1)
00592     {
00593     switch (c)
00594     {
00595         case 'l':
00596         local = 1;
00597         break;
00598         case 'R':
00599         local = 0;
00600         break;
00601         case '?':
00602         default:
00603         usage (unedit_usage);
00604         break;
00605     }
00606     }
00607     argc -= optind;
00608     argv += optind;
00609
00610     /* No need to readlock since we aren't doing anything to the
00611        repository.  */
00612     err = start_recursion (unedit_fileproc, (FILESDONEPROC) NULL,
00613                (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
00614                argc, argv, local, W_LOCAL, 0, 0, (char *)NULL,
00615                0);
00616
00617     err += send_notifications (argc, argv, local);
00618
00619     return err;
00620 }
00621
00622 void
00623 mark_up_to_date (file)
00624     char *file;
00625 {
00626     char *base;
00627
00628     /* The file is up to date, so we better get rid of an out of
00629        date file in CVSADM_BASE.  */
00630     base = xmalloc (strlen (file) + 80);
00631     strcpy (base, CVSADM_BASE);
00632     strcat (base, "/");
00633     strcat (base, file);
00634     if (unlink_file (base) < 0 && ! existence_error (errno))
00635     error (0, errno, "cannot remove %s", file);
00636     free (base);
00637 }
00638
00639
00640 void
00641 editor_set (filename, editor, val)
00642     char *filename;
00643     char *editor;
00644     char *val;
00645 {
00646     char *edlist;
00647     char *newlist;
00648
00649     edlist = fileattr_get0 (filename, "_editors");
00650     newlist = fileattr_modify (edlist, editor, val, '>', ',');
00651     /* If the attributes is unchanged, don't rewrite the attribute file.  */
00652     if (!((edlist == NULL && newlist == NULL)
00653       || (edlist != NULL
00654           && newlist != NULL
00655           && strcmp (edlist, newlist) == 0)))
00656     fileattr_set (filename, "_editors", newlist);
00657     if (edlist != NULL)
00658     free (edlist);
00659     if (newlist != NULL)
00660     free (newlist);
00661 }
00662
00663 struct notify_proc_args {
00664     /* What kind of notification, "edit", "tedit", etc.  */
00665     char *type;
00666     /* User who is running the command which causes notification.  */
00667     char *who;
00668     /* User to be notified.  */
00669     char *notifyee;
00670     /* File.  */
00671     char *file;
00672 };
00673
00674 /* Pass as a static until we get around to fixing Parse_Info to pass along
00675    a void * where we can stash it.  */
00676 static struct notify_proc_args *notify_args;
00677
00678 static int notify_proc PROTO ((char *repository, char *filter));
00679
00680 static int
00681 notify_proc (repository, filter)
00682     char *repository;
00683     char *filter;
00684 {
00685     FILE *pipefp;
00686     char *prog;
00687     char *expanded_prog;
00688     char *p;
00689     char *q;
00690     char *srepos;
00691     struct notify_proc_args *args = notify_args;
00692
00693     srepos = Short_Repository (repository);
00694     prog = xmalloc (strlen (filter) + strlen (args->notifyee) + 1);
00695     /* Copy FILTER to PROG, replacing the first occurrence of %s with
00696        the notifyee.  We only allocated enough memory for one %s, and I doubt
00697        there is a need for more.  */
00698     for (p = filter, q = prog; *p != '\0'; ++p)
00699     {
00700     if (p[0] == '%')
00701     {
00702         if (p[1] == 's')
00703         {
00704         strcpy (q, args->notifyee);
00705         q += strlen (q);
00706         strcpy (q, p + 2);
00707         q += strlen (q);
00708         break;
00709         }
00710         else
00711         continue;
00712     }
00713     *q++ = *p;
00714     }
00715     *q = '\0';
00716
00717     /* FIXME: why are we calling expand_proc?  Didn't we already
00718        expand it in Parse_Info, before passing it to notify_proc?  */
00719     expanded_prog = expand_path (prog, "notify", 0);
00720     if (!expanded_prog)
00721     {
00722     free (prog);
00723     return 1;
00724     }
00725
00726     pipefp = run_popen (expanded_prog, "w");
00727     if (pipefp == NULL)
00728     {
00729     error (0, errno, "cannot write entry to notify filter: %s", prog);
00730     free (prog);
00731     free (expanded_prog);
00732     return 1;
00733     }
00734
00735     fprintf (pipefp, "%s %s\n---\n", srepos, args->file);
00736     fprintf (pipefp, "Triggered %s watch on %s\n", args->type, repository);
00737     fprintf (pipefp, "By %s\n", args->who);
00738
00739     /* Lots more potentially useful information we could add here; see
00740        logfile_write for inspiration.  */
00741
00742     free (prog);
00743     free (expanded_prog);
00744     return (run_pclose (pipefp));
00745 }
00746
00747 /* FIXME: this function should have a way to report whether there was
00748    an error so that server.c can know whether to report Notified back
00749    to the client.  */
00750 void
00751 notify_do (type, filename, who, val, watches, repository)
00752     int type;
00753     char *filename;
00754     char *who;
00755     char *val;
00756     char *watches;
00757     char *repository;
00758 {
00759     static struct addremove_args blank;
00760     struct addremove_args args;
00761     char *watchers;
00762     char *p;
00763     char *endp;
00764     char *nextp;
00765
00766     /* Initialize fields to 0, NULL, or 0.0.  */
00767     args = blank;
00768     switch (type)
00769     {
00770     case 'E':
00771         if (strpbrk (val, ",>;=\n") != NULL)
00772         {
00773         error (0, 0, "invalid character in editor value");
00774         return;
00775         }
00776         editor_set (filename, who, val);
00777         break;
00778     case 'U':
00779     case 'C':
00780         editor_set (filename, who, NULL);
00781         break;
00782     default:
00783         return;
00784     }
00785
00786     watchers = fileattr_get0 (filename, "_watchers");
00787     p = watchers;
00788     while (p != NULL)
00789     {
00790     char *q;
00791     char *endq;
00792     char *nextq;
00793     char *notif;
00794
00795     endp = strchr (p, '>');
00796     if (endp == NULL)
00797         break;
00798     nextp = strchr (p, ',');
00799
00800     if ((size_t)(endp - p) == strlen (who) && strncmp (who, p, endp - p) == 0)
00801     {
00802         /* Don't notify user of their own changes.  Would perhaps
00803            be better to check whether it is the same working
00804            directory, not the same user, but that is hairy.  */
00805         p = nextp == NULL ? nextp : nextp + 1;
00806         continue;
00807     }
00808
00809     /* Now we point q at a string which looks like
00810        "edit+unedit+commit,"... and walk down it.  */
00811     q = endp + 1;
00812     notif = NULL;
00813     while (q != NULL)
00814     {
00815         endq = strchr (q, '+');
00816         if (endq == NULL || (nextp != NULL && endq > nextp))
00817         {
00818         if (nextp == NULL)
00819             endq = q + strlen (q);
00820         else
00821             endq = nextp;
00822         nextq = NULL;
00823         }
00824         else
00825         nextq = endq + 1;
00826
00827         /* If there is a temporary and a regular watch, send a single
00828            notification, for the regular watch.  */
00829         if (type == 'E' && endq - q == 4 && strncmp ("edit", q, 4) == 0)
00830         {
00831         notif = "edit";
00832         }
00833         else if (type == 'U'
00834              && endq - q == 6 && strncmp ("unedit", q, 6) == 0)
00835         {
00836         notif = "unedit";
00837         }
00838         else if (type == 'C'
00839              && endq - q == 6 && strncmp ("commit", q, 6) == 0)
00840         {
00841         notif = "commit";
00842         }
00843         else if (type == 'E'
00844              && endq - q == 5 && strncmp ("tedit", q, 5) == 0)
00845         {
00846         if (notif == NULL)
00847             notif = "temporary edit";
00848         }
00849         else if (type == 'U'
00850              && endq - q == 7 && strncmp ("tunedit", q, 7) == 0)
00851         {
00852         if (notif == NULL)
00853             notif = "temporary unedit";
00854         }
00855         else if (type == 'C'
00856              && endq - q == 7 && strncmp ("tcommit", q, 7) == 0)
00857         {
00858         if (notif == NULL)
00859             notif = "temporary commit";
00860         }
00861         q = nextq;
00862     }
00863     if (nextp != NULL)
00864         ++nextp;
00865
00866     if (notif != NULL)
00867     {
00868         struct notify_proc_args args;
00869         size_t len = endp - p;
00870         FILE *fp;
00871         char *usersname;
00872         char *line = NULL;
00873         size_t line_len = 0;
00874
00875         args.notifyee = NULL;
00876         usersname = xmalloc (strlen (CVSroot_directory)
00877                  + sizeof CVSROOTADM
00878                  + sizeof CVSROOTADM_USERS
00879                  + 20);
00880         strcpy (usersname, CVSroot_directory);
00881         strcat (usersname, "/");
00882         strcat (usersname, CVSROOTADM);
00883         strcat (usersname, "/");
00884         strcat (usersname, CVSROOTADM_USERS);
00885         fp = CVS_FOPEN (usersname, "r");
00886         if (fp == NULL && !existence_error (errno))
00887         error (0, errno, "cannot read %s", usersname);
00888         if (fp != NULL)
00889         {
00890         while (getline (&line, &line_len, fp) >= 0)
00891         {
00892             if (strncmp (line, p, len) == 0
00893             && line[len] == ':')
00894             {
00895             char *cp;
00896             args.notifyee = xstrdup (line + len + 1);
00897
00898                         /* There may or may not be more
00899                            colon-separated fields added to this in the
00900                            future; in any case, we ignore them right
00901                            now, and if there are none we make sure to
00902                            chop off the final newline, if any. */
00903             cp = strpbrk (args.notifyee, ":\n");
00904
00905             if (cp != NULL)
00906                 *cp = '\0';
00907             break;
00908             }
00909         }
00910         if (ferror (fp))
00911             error (0, errno, "cannot read %s", usersname);
00912         if (fclose (fp) < 0)
00913             error (0, errno, "cannot close %s", usersname);
00914         }
00915         free (usersname);
00916         if (line != NULL)
00917         free (line);
00918
00919         if (args.notifyee == NULL)
00920         {
00921         args.notifyee = xmalloc (endp - p + 1);
00922         strncpy (args.notifyee, p, endp - p);
00923         args.notifyee[endp - p] = '\0';
00924         }
00925
00926         notify_args = &args;
00927         args.type = notif;
00928         args.who = who;
00929         args.file = filename;
00930
00931         (void) Parse_Info (CVSROOTADM_NOTIFY, repository, notify_proc, 1);
00932         free (args.notifyee);
00933     }
00934
00935     p = nextp;
00936     }
00937     if (watchers != NULL)
00938     free (watchers);
00939
00940     switch (type)
00941     {
00942     case 'E':
00943         if (*watches == 'E')
00944         {
00945         args.add_tedit = 1;
00946         ++watches;
00947         }
00948         if (*watches == 'U')
00949         {
00950         args.add_tunedit = 1;
00951         ++watches;
00952         }
00953         if (*watches == 'C')
00954         {
00955         args.add_tcommit = 1;
00956         }
00957         watch_modify_watchers (filename, &args);
00958         break;
00959     case 'U':
00960     case 'C':
00961         args.remove_temp = 1;
00962         watch_modify_watchers (filename, &args);
00963         break;
00964     }
00965 }
00966
00967 #ifdef CLIENT_SUPPORT
00968 /* Check and send notifications.  This is only for the client.  */
00969 void
00970 notify_check (repository, update_dir)
00971     char *repository;
00972     char *update_dir;
00973 {
00974     FILE *fp;
00975     char *line = NULL;
00976     size_t line_len = 0;
00977
00978     if (! server_started)
00979     /* We are in the midst of a command which is not to talk to
00980        the server (e.g. the first phase of a cvs edit).  Just chill
00981        out, we'll catch the notifications on the flip side.  */
00982     return;
00983
00984     /* We send notifications even if noexec.  I'm not sure which behavior
00985        is most sensible.  */
00986
00987     fp = CVS_FOPEN (CVSADM_NOTIFY, "r");
00988     if (fp == NULL)
00989     {
00990     if (!existence_error (errno))
00991         error (0, errno, "cannot open %s", CVSADM_NOTIFY);
00992     return;
00993     }
00994     while (getline (&line, &line_len, fp) > 0)
00995     {
00996     int notif_type;
00997     char *filename;
00998     char *val;
00999     char *cp;
01000
01001     notif_type = line[0];
01002     if (notif_type == '\0')
01003         continue;
01004     filename = line + 1;
01005     cp = strchr (filename, '\t');
01006     if (cp == NULL)
01007         continue;
01008     *cp++ = '\0';
01009     val = cp;
01010
01011     client_notify (repository, update_dir, filename, notif_type, val);
01012     }
01013     if (line)
01014     free (line);
01015     if (ferror (fp))
01016     error (0, errno, "cannot read %s", CVSADM_NOTIFY);
01017     if (fclose (fp) < 0)
01018     error (0, errno, "cannot close %s", CVSADM_NOTIFY);
01019
01020     /* Leave the CVSADM_NOTIFY file there, until the server tells us it
01021        has dealt with it.  */
01022 }
01023 #endif /* CLIENT_SUPPORT */
01024
01025
01026 static const char *const editors_usage[] =
01027 {
01028     "Usage: %s %s [-lR] [files...]\n",
01029     "\t-l\tProcess this directory only (not recursive).\n",
01030     "\t-R\tProcess directories recursively.\n",
01031     "(Specify the --help global option for a list of other help options)\n",
01032     NULL
01033 };
01034
01035 static int editors_fileproc PROTO ((void *callerdat, struct file_info *finfo));
01036
01037 static int
01038 editors_fileproc (callerdat, finfo)
01039     void *callerdat;
01040     struct file_info *finfo;
01041 {
01042     char *them;
01043     char *p;
01044
01045     them = fileattr_get0 (finfo->file, "_editors");
01046     if (them == NULL)
01047     return 0;
01048
01049     cvs_output (finfo->fullname, 0);
01050
01051     p = them;
01052     while (1)
01053     {
01054     cvs_output ("\t", 1);
01055     while (*p != '>' && *p != '\0')
01056         cvs_output (p++, 1);
01057     if (*p == '\0')
01058     {
01059         /* Only happens if attribute is misformed.  */
01060         cvs_output ("\n", 1);
01061         break;
01062     }
01063     ++p;
01064     cvs_output ("\t", 1);
01065     while (1)
01066     {
01067         while (*p != '+' && *p != ',' && *p != '\0')
01068         cvs_output (p++, 1);
01069         if (*p == '\0')
01070         {
01071         cvs_output ("\n", 1);
01072         goto out;
01073         }
01074         if (*p == ',')
01075         {
01076         ++p;
01077         break;
01078         }
01079         ++p;
01080         cvs_output ("\t", 1);
01081     }
01082     cvs_output ("\n", 1);
01083     }
01084   out:;
01085     free (them);
01086     return 0;
01087 }
01088
01089 int
01090 editors (argc, argv)
01091     int argc;
01092     char **argv;
01093 {
01094     int local = 0;
01095     int c;
01096
01097     if (argc == -1)
01098     usage (editors_usage);
01099
01100     optind = 0;
01101     while ((c = getopt (argc, argv, "+lR")) != -1)
01102     {
01103     switch (c)
01104     {
01105         case 'l':
01106         local = 1;
01107         break;
01108         case 'R':
01109         local = 0;
01110         break;
01111         case '?':
01112         default:
01113         usage (editors_usage);
01114         break;
01115     }
01116     }
01117     argc -= optind;
01118     argv += optind;
01119
01120 #ifdef CLIENT_SUPPORT
01121     if (client_active)
01122     {
01123     start_server ();
01124     ign_setup ();
01125
01126     if (local)
01127         send_arg ("-l");
01128     send_files (argc, argv, local, 0, SEND_NO_CONTENTS);
01129     send_file_names (argc, argv, SEND_EXPAND_WILD);
01130     send_to_server ("editors\012", 0);
01131     return get_responses_and_close ();
01132     }
01133 #endif /* CLIENT_SUPPORT */
01134
01135     return start_recursion (editors_fileproc, (FILESDONEPROC) NULL,
01136                 (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
01137                 argc, argv, local, W_LOCAL, 0, 1, (char *)NULL,
01138                 0);
01139 }
Generated on Sun Oct 21 12:41:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/edit.h Source File

cvs-1.10/src/edit.h

Go to the documentation of this file.
00001 /* Interface to "cvs edit", "cvs watch on", and related features
00002
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; either version 2, or (at your option)
00006    any later version.
00007
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.  */
00012
00013 extern int watch_on PROTO ((int argc, char **argv));
00014 extern int watch_off PROTO ((int argc, char **argv));
00015
00016 #ifdef CLIENT_SUPPORT
00017 /* Check to see if any notifications are sitting around in need of being
00018    sent.  These are the notifications stored in CVSADM_NOTIFY (edit,unedit);
00019    commit calls notify_do directly.  */
00020 extern void notify_check PROTO ((char *repository, char *update_dir));
00021 #endif /* CLIENT_SUPPORT */
00022
00023 /* Issue a notification for file FILENAME.  TYPE is 'E' for edit, 'U'
00024    for unedit, and 'C' for commit.  WHO is the user currently running.
00025    For TYPE 'E', VAL is the time+host+directory data which goes in
00026    _editors, and WATCHES is zero or more of E,U,C, in that order, to specify
00027    what kinds of temporary watches to set.  */
00028 extern void notify_do PROTO ((int type, char *filename, char *who,
00029                   char *val, char *watches, char *repository));
00030
00031 /* Set attributes to reflect the fact that EDITOR is editing FILENAME.
00032    VAL is time+host+directory, or NULL if we are to say that EDITOR is
00033    *not* editing FILENAME.  */
00034 extern void editor_set PROTO ((char *filename, char *editor, char *val));
00035
00036 /* Take note of the fact that FILE is up to date (this munges CVS/Base;
00037    processing of CVS/Entries is done separately).  */
00038 extern void mark_up_to_date PROTO ((char *file));
Generated on Sun Oct 21 12:41:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/entries.c Source File

cvs-1.10/src/entries.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Entries file to Files file
00009  *
00010  * Creates the file Files containing the names that comprise the project, from
00011  * the Entries file.
00012  */
00013
00014 #include "cvs.h"
00015 #include "getline.h"
00016
00017 static Node *AddEntryNode PROTO((List * list, Entnode *entnode));
00018
00019 static Entnode *fgetentent PROTO((FILE *, char *, int *));
00020 static int   fputentent PROTO((FILE *, Entnode *));
00021
00022 static Entnode *subdir_record PROTO((int, const char *, const char *));
00023
00024 static FILE *entfile;
00025 static char *entfilename;       /* for error messages */
00026
00027 /*
00028  * Construct an Entnode
00029  */
00030 static Entnode *Entnode_Create PROTO ((enum ent_type, const char *,
00031                        const char *, const char *,
00032                        const char *, const char *,
00033                        const char *, const char *));
00034
00035 static Entnode *
00036 Entnode_Create(type, user, vn, ts, options, tag, date, ts_conflict)
00037     enum ent_type type;
00038     const char *user;
00039     const char *vn;
00040     const char *ts;
00041     const char *options;
00042     const char *tag;
00043     const char *date;
00044     const char *ts_conflict;
00045 {
00046     Entnode *ent;
00047
00048     /* Note that timestamp and options must be non-NULL */
00049     ent = (Entnode *) xmalloc (sizeof (Entnode));
00050     ent->type      = type;
00051     ent->user      = xstrdup (user);
00052     ent->version   = xstrdup (vn);
00053     ent->timestamp = xstrdup (ts ? ts : "");
00054     ent->options   = xstrdup (options ? options : "");
00055     ent->tag       = xstrdup (tag);
00056     ent->date      = xstrdup (date);
00057     ent->conflict  = xstrdup (ts_conflict);
00058
00059     return ent;
00060 }
00061
00062 /*
00063  * Destruct an Entnode
00064  */
00065 static void Entnode_Destroy PROTO ((Entnode *));
00066
00067 static void
00068 Entnode_Destroy (ent)
00069     Entnode *ent;
00070 {
00071     free (ent->user);
00072     free (ent->version);
00073     free (ent->timestamp);
00074     free (ent->options);
00075     if (ent->tag)
00076     free (ent->tag);
00077     if (ent->date)
00078     free (ent->date);
00079     if (ent->conflict)
00080     free (ent->conflict);
00081     free (ent);
00082 }
00083
00084 /*
00085  * Write out the line associated with a node of an entries file
00086  */
00087 static int write_ent_proc PROTO ((Node *, void *));
00088 static int
00089 write_ent_proc (node, closure)
00090      Node *node;
00091      void *closure;
00092 {
00093     Entnode *entnode;
00094
00095     entnode = (Entnode *) node->data;
00096
00097     if (closure != NULL && entnode->type != ENT_FILE)
00098     *(int *) closure = 1;
00099
00100     if (fputentent(entfile, entnode))
00101     error (1, errno, "cannot write %s", entfilename);
00102
00103     return (0);
00104 }
00105
00106 /*
00107  * write out the current entries file given a list,  making a backup copy
00108  * first of course
00109  */
00110 static void
00111 write_entries (list)
00112     List *list;
00113 {
00114     int sawdir;
00115
00116     sawdir = 0;
00117
00118     /* open the new one and walk the list writing entries */
00119     entfilename = CVSADM_ENTBAK;
00120     entfile = CVS_FOPEN (entfilename, "w+");
00121     if (entfile == NULL)
00122     {
00123     /* Make this a warning, not an error.  For example, one user might
00124        have checked out a working directory which, for whatever reason,
00125        contains an Entries.Log file.  A second user, without write access
00126        to that working directory, might want to do a "cvs log".  The
00127        problem rewriting Entries shouldn't affect the ability of "cvs log"
00128        to work, although the warning is probably a good idea so that
00129        whether Entries gets rewritten is not an inexplicable process.  */
00130     /* FIXME: should be including update_dir in message.  */
00131     error (0, errno, "cannot rewrite %s", entfilename);
00132
00133     /* Now just return.  We leave the Entries.Log file around.  As far
00134        as I know, there is never any data lying around in 'list' that
00135        is not in Entries.Log at this time (if there is an error writing
00136        Entries.Log that is a separate problem).  */
00137     return;
00138     }
00139
00140     (void) walklist (list, write_ent_proc, (void *) &sawdir);
00141     if (! sawdir)
00142     {
00143     struct stickydirtag *sdtp;
00144
00145     /* We didn't write out any directories.  Check the list
00146            private data to see whether subdirectory information is
00147            known.  If it is, we need to write out an empty D line.  */
00148     sdtp = (struct stickydirtag *) list->list->data;
00149     if (sdtp == NULL || sdtp->subdirs)
00150         if (fprintf (entfile, "D\n") < 0)
00151         error (1, errno, "cannot write %s", entfilename);
00152     }
00153     if (fclose (entfile) == EOF)
00154     error (1, errno, "error closing %s", entfilename);
00155
00156     /* now, atomically (on systems that support it) rename it */
00157     rename_file (entfilename, CVSADM_ENT);
00158
00159     /* now, remove the log file */
00160     if (unlink_file (CVSADM_ENTLOG) < 0
00161     && !existence_error (errno))
00162     error (0, errno, "cannot remove %s", CVSADM_ENTLOG);
00163 }
00164
00165 /*
00166  * Removes the argument file from the Entries file if necessary.
00167  */
00168 void
00169 Scratch_Entry (list, fname)
00170     List *list;
00171     char *fname;
00172 {
00173     Node *node;
00174
00175     if (trace)
00176     (void) fprintf (stderr, "%s-> Scratch_Entry(%s)\n",
00177             CLIENT_SERVER_STR, fname);
00178
00179     /* hashlookup to see if it is there */
00180     if ((node = findnode_fn (list, fname)) != NULL)
00181     {
00182     if (!noexec)
00183     {
00184         entfilename = CVSADM_ENTLOG;
00185         entfile = open_file (entfilename, "a");
00186
00187         if (fprintf (entfile, "R ") < 0)
00188         error (1, errno, "cannot write %s", entfilename);
00189
00190         write_ent_proc (node, NULL);
00191
00192         if (fclose (entfile) == EOF)
00193         error (1, errno, "error closing %s", entfilename);
00194     }
00195
00196     delnode (node);         /* delete the node */
00197
00198 #ifdef SERVER_SUPPORT
00199     if (server_active)
00200         server_scratch (fname);
00201 #endif
00202     }
00203 }
00204
00205 /*
00206  * Enters the given file name/version/time-stamp into the Entries file,
00207  * removing the old entry first, if necessary.
00208  */
00209 void
00210 Register (list, fname, vn, ts, options, tag, date, ts_conflict)
00211     List *list;
00212     char *fname;
00213     char *vn;
00214     char *ts;
00215     char *options;
00216     char *tag;
00217     char *date;
00218     char *ts_conflict;
00219 {
00220     Entnode *entnode;
00221     Node *node;
00222
00223 #ifdef SERVER_SUPPORT
00224     if (server_active)
00225     {
00226     server_register (fname, vn, ts, options, tag, date, ts_conflict);
00227     }
00228 #endif
00229
00230     if (trace)
00231     {
00232     (void) fprintf (stderr, "%s-> Register(%s, %s, %s%s%s, %s, %s %s)\n",
00233             CLIENT_SERVER_STR,
00234             fname, vn, ts ? ts : "",
00235             ts_conflict ? "+" : "", ts_conflict ? ts_conflict : "",
00236             options, tag ? tag : "", date ? date : "");
00237     }
00238
00239     entnode = Entnode_Create (ENT_FILE, fname, vn, ts, options, tag, date,
00240                   ts_conflict);
00241     node = AddEntryNode (list, entnode);
00242
00243     if (!noexec)
00244     {
00245     entfilename = CVSADM_ENTLOG;
00246     entfile = CVS_FOPEN (entfilename, "a");
00247
00248     if (entfile == NULL)
00249     {
00250         /* Warning, not error, as in write_entries.  */
00251         /* FIXME-update-dir: should be including update_dir in message.  */
00252         error (0, errno, "cannot open %s", entfilename);
00253         return;
00254     }
00255
00256     if (fprintf (entfile, "A ") < 0)
00257         error (1, errno, "cannot write %s", entfilename);
00258
00259     write_ent_proc (node, NULL);
00260
00261         if (fclose (entfile) == EOF)
00262         error (1, errno, "error closing %s", entfilename);
00263     }
00264 }
00265
00266 /*
00267  * Node delete procedure for list-private sticky dir tag/date info
00268  */
00269 static void
00270 freesdt (p)
00271     Node *p;
00272 {
00273     struct stickydirtag *sdtp;
00274
00275     sdtp = (struct stickydirtag *) p->data;
00276     if (sdtp->tag)
00277     free (sdtp->tag);
00278     if (sdtp->date)
00279     free (sdtp->date);
00280     free ((char *) sdtp);
00281 }
00282
00283 /* Return the next real Entries line.  On end of file, returns NULL.
00284    On error, prints an error message and returns NULL.  */
00285
00286 static Entnode *
00287 fgetentent(fpin, cmd, sawdir)
00288     FILE *fpin;
00289     char *cmd;
00290     int *sawdir;
00291 {
00292     Entnode *ent;
00293     char *line;
00294     size_t line_chars_allocated;
00295     register char *cp;
00296     enum ent_type type;
00297     char *l, *user, *vn, *ts, *options;
00298     char *tag_or_date, *tag, *date, *ts_conflict;
00299     int line_length;
00300
00301     line = NULL;
00302     line_chars_allocated = 0;
00303
00304     ent = NULL;
00305     while ((line_length = getline (&line, &line_chars_allocated, fpin)) > 0)
00306     {
00307     l = line;
00308
00309     /* If CMD is not NULL, we are reading an Entries.Log file.
00310        Each line in the Entries.Log file starts with a single
00311        character command followed by a space.  For backward
00312        compatibility, the absence of a space indicates an add
00313        command.  */
00314     if (cmd != NULL)
00315     {
00316         if (l[1] != ' ')
00317         *cmd = 'A';
00318         else
00319         {
00320         *cmd = l[0];
00321         l += 2;
00322         }
00323     }
00324
00325     type = ENT_FILE;
00326
00327     if (l[0] == 'D')
00328     {
00329         type = ENT_SUBDIR;
00330         *sawdir = 1;
00331         ++l;
00332         /* An empty D line is permitted; it is a signal that this
00333            Entries file lists all known subdirectories.  */
00334     }
00335
00336     if (l[0] != '/')
00337         continue;
00338
00339     user = l + 1;
00340     if ((cp = strchr (user, '/')) == NULL)
00341         continue;
00342     *cp++ = '\0';
00343     vn = cp;
00344     if ((cp = strchr (vn, '/')) == NULL)
00345         continue;
00346     *cp++ = '\0';
00347     ts = cp;
00348     if ((cp = strchr (ts, '/')) == NULL)
00349         continue;
00350     *cp++ = '\0';
00351     options = cp;
00352     if ((cp = strchr (options, '/')) == NULL)
00353         continue;
00354     *cp++ = '\0';
00355     tag_or_date = cp;
00356     if ((cp = strchr (tag_or_date, '\n')) == NULL)
00357         continue;
00358     *cp = '\0';
00359     tag = (char *) NULL;
00360     date = (char *) NULL;
00361     if (*tag_or_date == 'T')
00362         tag = tag_or_date + 1;
00363     else if (*tag_or_date == 'D')
00364         date = tag_or_date + 1;
00365
00366     if ((ts_conflict = strchr (ts, '+')))
00367         *ts_conflict++ = '\0';
00368
00369     /*
00370      * XXX - Convert timestamp from old format to new format.
00371      *
00372      * If the timestamp doesn't match the file's current
00373      * mtime, we'd have to generate a string that doesn't
00374      * match anyways, so cheat and base it on the existing
00375      * string; it doesn't have to match the same mod time.
00376      *
00377      * For an unmodified file, write the correct timestamp.
00378      */
00379     {
00380         struct stat sb;
00381         if (strlen (ts) > 30 && CVS_STAT (user, &sb) == 0)
00382         {
00383         char *c = ctime (&sb.st_mtime);
00384         /* Fix non-standard format.  */
00385         if (c[8] == '0') c[8] = ' ';
00386
00387         if (!strncmp (ts + 25, c, 24))
00388             ts = time_stamp (user);
00389         else
00390         {
00391             ts += 24;
00392             ts[0] = '*';
00393         }
00394         }
00395     }
00396
00397     ent = Entnode_Create (type, user, vn, ts, options, tag, date,
00398                   ts_conflict);
00399     break;
00400     }
00401
00402     if (line_length < 0 && !feof (fpin))
00403     error (0, errno, "cannot read entries file");
00404
00405     free (line);
00406     return ent;
00407 }
00408
00409 static int
00410 fputentent(fp, p)
00411     FILE *fp;
00412     Entnode *p;
00413 {
00414     switch (p->type)
00415     {
00416     case ENT_FILE:
00417         break;
00418     case ENT_SUBDIR:
00419         if (fprintf (fp, "D") < 0)
00420         return 1;
00421     break;
00422     }
00423
00424     if (fprintf (fp, "/%s/%s/%s", p->user, p->version, p->timestamp) < 0)
00425     return 1;
00426     if (p->conflict)
00427     {
00428     if (fprintf (fp, "+%s", p->conflict) < 0)
00429         return 1;
00430     }
00431     if (fprintf (fp, "/%s/", p->options) < 0)
00432     return 1;
00433
00434     if (p->tag)
00435     {
00436     if (fprintf (fp, "T%s\n", p->tag) < 0)
00437         return 1;
00438     }
00439     else if (p->date)
00440     {
00441     if (fprintf (fp, "D%s\n", p->date) < 0)
00442         return 1;
00443     }
00444     else
00445     {
00446     if (fprintf (fp, "\n") < 0)
00447         return 1;
00448     }
00449
00450     return 0;
00451 }
00452
00453
00454 /* Read the entries file into a list, hashing on the file name.
00455
00456    UPDATE_DIR is the name of the current directory, for use in error
00457    messages, or NULL if not known (that is, noone has gotten around
00458    to updating the caller to pass in the information).  */
00459 List *
00460 Entries_Open (aflag, update_dir)
00461     int aflag;
00462     char *update_dir;
00463 {
00464     List *entries;
00465     struct stickydirtag *sdtp = NULL;
00466     Entnode *ent;
00467     char *dirtag, *dirdate;
00468     int dirnonbranch;
00469     int do_rewrite = 0;
00470     FILE *fpin;
00471     int sawdir;
00472
00473     /* get a fresh list... */
00474     entries = getlist ();
00475
00476     /*
00477      * Parse the CVS/Tag file, to get any default tag/date settings. Use
00478      * list-private storage to tuck them away for Version_TS().
00479      */
00480     ParseTag (&dirtag, &dirdate, &dirnonbranch);
00481     if (aflag || dirtag || dirdate)
00482     {
00483     sdtp = (struct stickydirtag *) xmalloc (sizeof (*sdtp));
00484     memset ((char *) sdtp, 0, sizeof (*sdtp));
00485     sdtp->aflag = aflag;
00486     sdtp->tag = xstrdup (dirtag);
00487     sdtp->date = xstrdup (dirdate);
00488     sdtp->nonbranch = dirnonbranch;
00489
00490     /* feed it into the list-private area */
00491     entries->list->data = (char *) sdtp;
00492     entries->list->delproc = freesdt;
00493     }
00494
00495     sawdir = 0;
00496
00497     fpin = CVS_FOPEN (CVSADM_ENT, "r");
00498     if (fpin == NULL)
00499     {
00500     if (update_dir != NULL)
00501         error (0, 0, "in directory %s:", update_dir);
00502     error (0, errno, "cannot open %s for reading", CVSADM_ENT);
00503     }
00504     else
00505     {
00506     while ((ent = fgetentent (fpin, (char *) NULL, &sawdir)) != NULL)
00507     {
00508         (void) AddEntryNode (entries, ent);
00509     }
00510
00511     if (fclose (fpin) < 0)
00512         /* FIXME-update-dir: should include update_dir in message.  */
00513         error (0, errno, "cannot close %s", CVSADM_ENT);
00514     }
00515
00516     fpin = CVS_FOPEN (CVSADM_ENTLOG, "r");
00517     if (fpin != NULL)
00518     {
00519     char cmd;
00520     Node *node;
00521
00522     while ((ent = fgetentent (fpin, &cmd, &sawdir)) != NULL)
00523     {
00524         switch (cmd)
00525         {
00526         case 'A':
00527         (void) AddEntryNode (entries, ent);
00528         break;
00529         case 'R':
00530         node = findnode_fn (entries, ent->user);
00531         if (node != NULL)
00532             delnode (node);
00533         Entnode_Destroy (ent);
00534         break;
00535         default:
00536         /* Ignore unrecognized commands.  */
00537             break;
00538         }
00539     }
00540     do_rewrite = 1;
00541     if (fclose (fpin) < 0)
00542         /* FIXME-update-dir: should include update_dir in message.  */
00543         error (0, errno, "cannot close %s", CVSADM_ENTLOG);
00544     }
00545
00546     /* Update the list private data to indicate whether subdirectory
00547        information is known.  Nonexistent list private data is taken
00548        to mean that it is known.  */
00549     if (sdtp != NULL)
00550     sdtp->subdirs = sawdir;
00551     else if (! sawdir)
00552     {
00553     sdtp = (struct stickydirtag *) xmalloc (sizeof (*sdtp));
00554     memset ((char *) sdtp, 0, sizeof (*sdtp));
00555     sdtp->subdirs = 0;
00556     entries->list->data = (char *) sdtp;
00557     entries->list->delproc = freesdt;
00558     }
00559
00560     if (do_rewrite && !noexec)
00561     write_entries (entries);
00562
00563     /* clean up and return */
00564     if (dirtag)
00565     free (dirtag);
00566     if (dirdate)
00567     free (dirdate);
00568     return (entries);
00569 }
00570
00571 void
00572 Entries_Close(list)
00573     List *list;
00574 {
00575     if (list)
00576     {
00577     if (!noexec)
00578         {
00579             if (isfile (CVSADM_ENTLOG))
00580         write_entries (list);
00581     }
00582     dellist(&list);
00583     }
00584 }
00585
00586
00587 /*
00588  * Free up the memory associated with the data section of an ENTRIES type
00589  * node
00590  */
00591 static void
00592 Entries_delproc (node)
00593     Node *node;
00594 {
00595     Entnode *p;
00596
00597     p = (Entnode *) node->data;
00598     Entnode_Destroy(p);
00599 }
00600
00601 /*
00602  * Get an Entries file list node, initialize it, and add it to the specified
00603  * list
00604  */
00605 static Node *
00606 AddEntryNode (list, entdata)
00607     List *list;
00608     Entnode *entdata;
00609 {
00610     Node *p;
00611
00612     /* was it already there? */
00613     if ((p  = findnode_fn (list, entdata->user)) != NULL)
00614     {
00615     /* take it out */
00616     delnode (p);
00617     }
00618
00619     /* get a node and fill in the regular stuff */
00620     p = getnode ();
00621     p->type = ENTRIES;
00622     p->delproc = Entries_delproc;
00623
00624     /* this one gets a key of the name for hashing */
00625     /* FIXME This results in duplicated data --- the hash package shouldn't
00626        assume that the key is dynamically allocated.  The user's free proc
00627        should be responsible for freeing the key. */
00628     p->key = xstrdup (entdata->user);
00629     p->data = (char *) entdata;
00630
00631     /* put the node into the list */
00632     addnode (list, p);
00633     return (p);
00634 }
00635
00636 /*
00637  * Write out/Clear the CVS/Tag file.
00638  */
00639 void
00640 WriteTag (dir, tag, date, nonbranch, update_dir, repository)
00641     char *dir;
00642     char *tag;
00643     char *date;
00644     int nonbranch;
00645     char *update_dir;
00646     char *repository;
00647 {
00648     FILE *fout;
00649     char *tmp;
00650
00651     if (noexec)
00652     return;
00653
00654     tmp = xmalloc ((dir ? strlen (dir) : 0)
00655            + sizeof (CVSADM_TAG)
00656            + 10);
00657     if (dir == NULL)
00658     (void) strcpy (tmp, CVSADM_TAG);
00659     else
00660     (void) sprintf (tmp, "%s/%s", dir, CVSADM_TAG);
00661
00662     if (tag || date)
00663     {
00664     fout = open_file (tmp, "w+");
00665     if (tag)
00666     {
00667         if (nonbranch)
00668         {
00669         if (fprintf (fout, "N%s\n", tag) < 0)
00670             error (1, errno, "write to %s failed", tmp);
00671         }
00672         else
00673         {
00674         if (fprintf (fout, "T%s\n", tag) < 0)
00675             error (1, errno, "write to %s failed", tmp);
00676         }
00677     }
00678     else
00679     {
00680         if (fprintf (fout, "D%s\n", date) < 0)
00681         error (1, errno, "write to %s failed", tmp);
00682     }
00683     if (fclose (fout) == EOF)
00684         error (1, errno, "cannot close %s", tmp);
00685     }
00686     else
00687     if (unlink_file (tmp) < 0 && ! existence_error (errno))
00688         error (1, errno, "cannot remove %s", tmp);
00689     free (tmp);
00690 #ifdef SERVER_SUPPORT
00691     if (server_active)
00692     server_set_sticky (update_dir, repository, tag, date, nonbranch);
00693 #endif
00694 }
00695
00696 /* Parse the CVS/Tag file for the current directory.
00697
00698    If it contains a date, sets *DATEP to the date in a newly malloc'd
00699    string, *TAGP to NULL, and *NONBRANCHP to an unspecified value.
00700
00701    If it contains a branch tag, sets *TAGP to the tag in a newly
00702    malloc'd string, *NONBRANCHP to 0, and *DATEP to NULL.
00703
00704    If it contains a nonbranch tag, sets *TAGP to the tag in a newly
00705    malloc'd string, *NONBRANCHP to 1, and *DATEP to NULL.
00706
00707    If it does not exist, or contains something unrecognized by this
00708    version of CVS, set *DATEP and *TAGP to NULL and *NONBRANCHP to
00709    an unspecified value.
00710
00711    If there is an error, print an error message, set *DATEP and *TAGP
00712    to NULL, and return.  */
00713 void
00714 ParseTag (tagp, datep, nonbranchp)
00715     char **tagp;
00716     char **datep;
00717     int *nonbranchp;
00718 {
00719     FILE *fp;
00720
00721     if (tagp)
00722     *tagp = (char *) NULL;
00723     if (datep)
00724     *datep = (char *) NULL;
00725     /* Always store a value here, even in the 'D' case where the value
00726        is unspecified.  Shuts up tools which check for references to
00727        uninitialized memory.  */
00728     if (nonbranchp != NULL)
00729     *nonbranchp = 0;
00730     fp = CVS_FOPEN (CVSADM_TAG, "r");
00731     if (fp)
00732     {
00733     char *line;
00734     int line_length;
00735     size_t line_chars_allocated;
00736
00737     line = NULL;
00738     line_chars_allocated = 0;
00739
00740     if ((line_length = getline (&line, &line_chars_allocated, fp)) > 0)
00741     {
00742         /* Remove any trailing newline.  */
00743         if (line[line_length - 1] == '\n')
00744             line[--line_length] = '\0';
00745         switch (*line)
00746         {
00747         case 'T':
00748             if (tagp != NULL)
00749             *tagp = xstrdup (line + 1);
00750             break;
00751         case 'D':
00752             if (datep != NULL)
00753             *datep = xstrdup (line + 1);
00754             break;
00755         case 'N':
00756             if (tagp != NULL)
00757             *tagp = xstrdup (line + 1);
00758             if (nonbranchp != NULL)
00759             *nonbranchp = 1;
00760             break;
00761         default:
00762             /* Silently ignore it; it may have been
00763                written by a future version of CVS which extends the
00764                syntax.  */
00765             break;
00766         }
00767     }
00768
00769     if (line_length < 0)
00770     {
00771         /* FIXME-update-dir: should include update_dir in messages.  */
00772         if (feof (fp))
00773         error (0, 0, "cannot read %s: end of file", CVSADM_TAG);
00774         else
00775         error (0, errno, "cannot read %s", CVSADM_TAG);
00776     }
00777
00778     if (fclose (fp) < 0)
00779         /* FIXME-update-dir: should include update_dir in message.  */
00780         error (0, errno, "cannot close %s", CVSADM_TAG);
00781
00782     free (line);
00783     }
00784     else if (!existence_error (errno))
00785     /* FIXME-update-dir: should include update_dir in message.  */
00786     error (0, errno, "cannot open %s", CVSADM_TAG);
00787 }
00788
00789 /*
00790  * This is called if all subdirectory information is known, but there
00791  * aren't any subdirectories.  It records that fact in the list
00792  * private data.
00793  */
00794
00795 void
00796 Subdirs_Known (entries)
00797      List *entries;
00798 {
00799     struct stickydirtag *sdtp;
00800
00801     /* If there is no list private data, that means that the
00802        subdirectory information is known.  */
00803     sdtp = (struct stickydirtag *) entries->list->data;
00804     if (sdtp != NULL && ! sdtp->subdirs)
00805     {
00806     FILE *fp;
00807
00808     sdtp->subdirs = 1;
00809     if (!noexec)
00810     {
00811         /* Create Entries.Log so that Entries_Close will do something.  */
00812         entfilename = CVSADM_ENTLOG;
00813         fp = CVS_FOPEN (entfilename, "a");
00814         if (fp == NULL)
00815         {
00816         int save_errno = errno;
00817
00818         /* As in subdir_record, just silently skip the whole thing
00819            if there is no CVSADM directory.  */
00820         if (! isdir (CVSADM))
00821             return;
00822         error (1, save_errno, "cannot open %s", entfilename);
00823         }
00824         else
00825         {
00826         if (fclose (fp) == EOF)
00827             error (1, errno, "cannot close %s", entfilename);
00828         }
00829     }
00830     }
00831 }
00832
00833 /* Record subdirectory information.  */
00834
00835 static Entnode *
00836 subdir_record (cmd, parent, dir)
00837      int cmd;
00838      const char *parent;
00839      const char *dir;
00840 {
00841     Entnode *entnode;
00842
00843     /* None of the information associated with a directory is
00844        currently meaningful.  */
00845     entnode = Entnode_Create (ENT_SUBDIR, dir, "", "", "",
00846                   (char *) NULL, (char *) NULL,
00847                   (char *) NULL);
00848
00849     if (!noexec)
00850     {
00851     if (parent == NULL)
00852         entfilename = CVSADM_ENTLOG;
00853     else
00854     {
00855         entfilename = xmalloc (strlen (parent)
00856                    + sizeof CVSADM_ENTLOG
00857                    + 10);
00858         sprintf (entfilename, "%s/%s", parent, CVSADM_ENTLOG);
00859     }
00860
00861     entfile = CVS_FOPEN (entfilename, "a");
00862     if (entfile == NULL)
00863     {
00864         int save_errno = errno;
00865
00866         /* It is not an error if there is no CVS administration
00867                directory.  Permitting this case simplifies some
00868                calling code.  */
00869
00870         if (parent == NULL)
00871         {
00872         if (! isdir (CVSADM))
00873             return entnode;
00874         }
00875         else
00876         {
00877         sprintf (entfilename, "%s/%s", parent, CVSADM);
00878         if (! isdir (entfilename))
00879         {
00880             free (entfilename);
00881             entfilename = NULL;
00882             return entnode;
00883         }
00884         }
00885
00886         error (1, save_errno, "cannot open %s", entfilename);
00887     }
00888
00889     if (fprintf (entfile, "%c ", cmd) < 0)
00890         error (1, errno, "cannot write %s", entfilename);
00891
00892     if (fputentent (entfile, entnode) != 0)
00893         error (1, errno, "cannot write %s", entfilename);
00894
00895     if (fclose (entfile) == EOF)
00896         error (1, errno, "error closing %s", entfilename);
00897
00898     if (parent != NULL)
00899     {
00900         free (entfilename);
00901         entfilename = NULL;
00902     }
00903     }
00904
00905     return entnode;
00906 }
00907
00908 /*
00909  * Record the addition of a new subdirectory DIR in PARENT.  PARENT
00910  * may be NULL, which means the current directory.  ENTRIES is the
00911  * current entries list; it may be NULL, which means that it need not
00912  * be updated.
00913  */
00914
00915 void
00916 Subdir_Register (entries, parent, dir)
00917      List *entries;
00918      const char *parent;
00919      const char *dir;
00920 {
00921     Entnode *entnode;
00922
00923     /* Ignore attempts to register ".".  These can happen in the
00924        server code.  */
00925     if (dir[0] == '.' && dir[1] == '\0')
00926     return;
00927
00928     entnode = subdir_record ('A', parent, dir);
00929
00930     if (entries != NULL && (parent == NULL || strcmp (parent, ".") == 0))
00931     (void) AddEntryNode (entries, entnode);
00932     else
00933     Entnode_Destroy (entnode);
00934 }
00935
00936 /*
00937  * Record the removal of a subdirectory.  The arguments are the same
00938  * as for Subdir_Register.
00939  */
00940
00941 void
00942 Subdir_Deregister (entries, parent, dir)
00943      List *entries;
00944      const char *parent;
00945      const char *dir;
00946 {
00947     Entnode *entnode;
00948
00949     entnode = subdir_record ('R', parent, dir);
00950     Entnode_Destroy (entnode);
00951
00952     if (entries != NULL && (parent == NULL || strcmp (parent, ".") == 0))
00953     {
00954     Node *p;
00955
00956     p = findnode_fn (entries, dir);
00957     if (p != NULL)
00958         delnode (p);
00959     }
00960 }
00961
00962
00963
00964 /* OK, the following base_* code tracks the revisions of the files in
00965    CVS/Base.  We do this in a file CVS/Baserev.  Separate from
00966    CVS/Entries because it needs to go in separate data structures
00967    anyway (the name in Entries must be unique), so this seemed
00968    cleaner.  The business of rewriting the whole file in
00969    base_deregister and base_register is the kind of thing we used to
00970    do for Entries and which turned out to be slow, which is why there
00971    is now the Entries.Log machinery.  So maybe from that point of
00972    view it is a mistake to do this separately from Entries, I dunno.
00973
00974    We also need something analogous for:
00975
00976    1. CVS/Template (so we can update the Template file automagically
00977    without the user needing to check out a new working directory).
00978    Updating would probably print a message (that part might be
00979    optional, although probably it should be visible because not all
00980    cvs commands would make the update happen and so it is a
00981    user-visible behavior).  Constructing version number for template
00982    is a bit hairy (base it on the timestamp on the server?  Or see if
00983    the template is in checkoutlist and if yes use its versioning and
00984    if no don't version it?)....
00985
00986    2.  cvsignore (need to keep a copy in the working directory to do
00987    "cvs release" on the client side; see comment at src/release.c
00988    (release).  Would also allow us to stop needing Questionable.  */
00989
00990 enum base_walk {
00991     /* Set the revision for FILE to *REV.  */
00992     BASE_REGISTER,
00993     /* Get the revision for FILE and put it in a newly malloc'd string
00994        in *REV, or put NULL if not mentioned.  */
00995     BASE_GET,
00996     /* Remove FILE.  */
00997     BASE_DEREGISTER
00998 };
00999
01000 static void base_walk PROTO ((enum base_walk, struct file_info *, char **));
01001
01002 /* Read through the lines in CVS/Baserev, taking the actions as documented
01003    for CODE.  */
01004
01005 static void
01006 base_walk (code, finfo, rev)
01007     enum base_walk code;
01008     struct file_info *finfo;
01009     char **rev;
01010 {
01011     FILE *fp;
01012     char *line;
01013     size_t line_allocated;
01014     FILE *newf;
01015     char *baserev_fullname;
01016     char *baserevtmp_fullname;
01017
01018     line = NULL;
01019     line_allocated = 0;
01020     newf = NULL;
01021
01022     /* First compute the fullnames for the error messages.  This
01023        computation probably should be broken out into a separate function,
01024        as recurse.c does it too and places like Entries_Open should be
01025        doing it.  */
01026     baserev_fullname = xmalloc (sizeof (CVSADM_BASEREV)
01027                 + strlen (finfo->update_dir)
01028                 + 2);
01029     baserev_fullname[0] = '\0';
01030     baserevtmp_fullname = xmalloc (sizeof (CVSADM_BASEREVTMP)
01031                    + strlen (finfo->update_dir)
01032                    + 2);
01033     baserevtmp_fullname[0] = '\0';
01034     if (finfo->update_dir[0] != '\0')
01035     {
01036     strcat (baserev_fullname, finfo->update_dir);
01037     strcat (baserev_fullname, "/");
01038     strcat (baserevtmp_fullname, finfo->update_dir);
01039     strcat (baserevtmp_fullname, "/");
01040     }
01041     strcat (baserev_fullname, CVSADM_BASEREV);
01042     strcat (baserevtmp_fullname, CVSADM_BASEREVTMP);
01043
01044     fp = CVS_FOPEN (CVSADM_BASEREV, "r");
01045     if (fp == NULL)
01046     {
01047     if (!existence_error (errno))
01048     {
01049         error (0, errno, "cannot open %s for reading", baserev_fullname);
01050         goto out;
01051     }
01052     }
01053
01054     switch (code)
01055     {
01056     case BASE_REGISTER:
01057     case BASE_DEREGISTER:
01058         newf = CVS_FOPEN (CVSADM_BASEREVTMP, "w");
01059         if (newf == NULL)
01060         {
01061         error (0, errno, "cannot open %s for writing",
01062                baserevtmp_fullname);
01063         goto out;
01064         }
01065         break;
01066     case BASE_GET:
01067         *rev = NULL;
01068         break;
01069     }
01070
01071     if (fp != NULL)
01072     {
01073     while (getline (&line, &line_allocated, fp) >= 0)
01074     {
01075         char *linefile;
01076         char *p;
01077         char *linerev;
01078
01079         if (line[0] != 'B')
01080         /* Ignore, for future expansion.  */
01081         continue;
01082
01083         linefile = line + 1;
01084         p = strchr (linefile, '/');
01085         if (p == NULL)
01086         /* Syntax error, ignore.  */
01087         continue;
01088         linerev = p + 1;
01089         p = strchr (linerev, '/');
01090         if (p == NULL)
01091         continue;
01092
01093         linerev[-1] = '\0';
01094         if (fncmp (linefile, finfo->file) == 0)
01095         {
01096         switch (code)
01097         {
01098         case BASE_REGISTER:
01099         case BASE_DEREGISTER:
01100             /* Don't copy over the old entry, we don't want it.  */
01101             break;
01102         case BASE_GET:
01103             *p = '\0';
01104             *rev = xstrdup (linerev);
01105             *p = '/';
01106             goto got_it;
01107         }
01108         }
01109         else
01110         {
01111         linerev[-1] = '/';
01112         switch (code)
01113         {
01114         case BASE_REGISTER:
01115         case BASE_DEREGISTER:
01116             if (fprintf (newf, "%s\n", line) < 0)
01117             error (0, errno, "error writing %s",
01118                    baserevtmp_fullname);
01119             break;
01120         case BASE_GET:
01121             break;
01122         }
01123         }
01124     }
01125     if (ferror (fp))
01126         error (0, errno, "cannot read %s", baserev_fullname);
01127     }
01128  got_it:
01129
01130     if (code == BASE_REGISTER)
01131     {
01132     if (fprintf (newf, "B%s/%s/\n", finfo->file, *rev) < 0)
01133         error (0, errno, "error writing %s",
01134            baserevtmp_fullname);
01135     }
01136
01137  out:
01138
01139     if (line != NULL)
01140     free (line);
01141
01142     if (fp != NULL)
01143     {
01144     if (fclose (fp) < 0)
01145         error (0, errno, "cannot close %s", baserev_fullname);
01146     }
01147     if (newf != NULL)
01148     {
01149     if (fclose (newf) < 0)
01150         error (0, errno, "cannot close %s", baserevtmp_fullname);
01151     rename_file (CVSADM_BASEREVTMP, CVSADM_BASEREV);
01152     }
01153
01154     free (baserev_fullname);
01155     free (baserevtmp_fullname);
01156 }
01157
01158 /* Return, in a newly malloc'd string, the revision for FILE in CVS/Baserev,
01159    or NULL if not listed.  */
01160
01161 char *
01162 base_get (finfo)
01163     struct file_info *finfo;
01164 {
01165     char *rev;
01166     base_walk (BASE_GET, finfo, &rev);
01167     return rev;
01168 }
01169
01170 /* Set the revision for FILE to REV.  */
01171
01172 void
01173 base_register (finfo, rev)
01174     struct file_info *finfo;
01175     char *rev;
01176 {
01177     base_walk (BASE_REGISTER, finfo, &rev);
01178 }
01179
01180 /* Remove FILE.  */
01181
01182 void
01183 base_deregister (finfo)
01184     struct file_info *finfo;
01185 {
01186     base_walk (BASE_DEREGISTER, finfo, NULL);
01187 }
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/error.c Source File

cvs-1.10/src/error.c

Go to the documentation of this file.
00001 /* error.c -- error handler for noninteractive utilities
00002    Copyright (C) 1990-1992 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 /* David MacKenzie */
00015 /* Brian Berliner added support for CVS */
00016
00017 #include "cvs.h"
00018
00019 #include <stdio.h>
00020
00021 /* If non-zero, error will use the CVS protocol to stdout to report error
00022    messages.  This will only be set in the CVS server parent process;
00023    most other code is run via do_cvs_command, which forks off a child
00024    process and packages up its stderr in the protocol.  */
00025 int error_use_protocol;
00026
00027 #ifdef HAVE_VPRINTF
00028
00029 #ifdef __STDC__
00030 #include <stdarg.h>
00031 #define VA_START(args, lastarg) va_start(args, lastarg)
00032 #else /* ! __STDC__ */
00033 #include <varargs.h>
00034 #define VA_START(args, lastarg) va_start(args)
00035 #endif /* __STDC__ */
00036
00037 #else /* ! HAVE_VPRINTF */
00038
00039 #ifdef HAVE_DOPRNT
00040 #define va_alist args
00041 #define va_dcl int args;
00042 #else /* ! HAVE_DOPRNT */
00043 #define va_alist a1, a2, a3, a4, a5, a6, a7, a8
00044 #define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
00045 #endif /* HAVE_DOPRNT */
00046
00047 #endif /* HAVE_VPRINTF */
00048
00049 #if STDC_HEADERS
00050 #include <stdlib.h>
00051 #include <string.h>
00052 #else /* ! STDC_HEADERS */
00053 #ifdef __STDC__
00054 void exit(int status);
00055 #else /* ! __STDC__ */
00056 void exit ();
00057 #endif /* __STDC__ */
00058 #endif /* STDC_HEADERS */
00059
00060 #ifndef strerror
00061 extern char *strerror ();
00062 #endif
00063
00064 void
00065 error_exit PROTO ((void))
00066 {
00067     rcs_cleanup ();
00068     Lock_Cleanup ();
00069 #ifdef SERVER_SUPPORT
00070     if (server_active)
00071     server_cleanup (0);
00072 #endif
00073 #ifdef SYSTEM_CLEANUP
00074     /* Hook for OS-specific behavior, for example socket subsystems on
00075        NT and OS2 or dealing with windows and arguments on Mac.  */
00076     SYSTEM_CLEANUP ();
00077 #endif
00078     exit (EXIT_FAILURE);
00079 }
00080
00081 /* Print the program name and error message MESSAGE, which is a printf-style
00082    format string with optional args.  This is a very limited printf subset:
00083    %s, %d, %c, %x and %% only (without anything between the % and the s,
00084    d, &c).  Callers who want something fancier can use sprintf.
00085
00086    If ERRNUM is nonzero, print its corresponding system error message.
00087    Exit with status EXIT_FAILURE if STATUS is nonzero.  If MESSAGE is "",
00088    no need to print a message.
00089
00090    I think this is largely cleaned up to the point where it does the right
00091    thing for the server, whether the normal server_active (child process)
00092    case or the error_use_protocol (parent process) case.  The one exception
00093    is that STATUS nonzero for error_use_protocol probably doesn't work yet;
00094    in that case still need to use the pending_error machinery in server.c.
00095
00096    error() does not molest errno; some code (e.g. Entries_Open) depends
00097    on being able to say something like:
00098       error (0, 0, "foo");
00099       error (0, errno, "bar");
00100
00101    */
00102
00103 /* VARARGS */
00104 void
00105 #if defined (__STDC__)
00106 error (int status, int errnum, const char *message, ...)
00107 #else
00108 error (status, errnum, message, va_alist)
00109     int status;
00110     int errnum;
00111     const char *message;
00112     va_dcl
00113 #endif
00114 {
00115     int save_errno = errno;
00116
00117     if (message[0] != '\0')
00118     {
00119     va_list args;
00120     const char *p;
00121     char *q;
00122     char *str;
00123     int num;
00124     unsigned int unum;
00125     int ch;
00126     char buf[100];
00127
00128     cvs_outerr (program_name, 0);
00129     if (command_name && *command_name)
00130     {
00131         cvs_outerr (" ", 1);
00132         if (status != 0)
00133         cvs_outerr ("[", 1);
00134         cvs_outerr (command_name, 0);
00135         if (status != 0)
00136         cvs_outerr (" aborted]", 0);
00137     }
00138     cvs_outerr (": ", 2);
00139
00140     VA_START (args, message);
00141     p = message;
00142     while ((q = strchr (p, '%')) != NULL)
00143     {
00144         static const char msg[] =
00145         "\ninternal error: bad % in error()\n";
00146         if (q - p > 0)
00147         cvs_outerr (p, q - p);
00148
00149         switch (q[1])
00150         {
00151         case 's':
00152         str = va_arg (args, char *);
00153         cvs_outerr (str, strlen (str));
00154         break;
00155         case 'd':
00156         num = va_arg (args, int);
00157         sprintf ((char *)buf, "%d", num);
00158         cvs_outerr ((char *)buf, strlen ((char *)buf));
00159         break;
00160         case 'x':
00161         unum = va_arg (args, unsigned int);
00162         sprintf ((char *)buf, "%x", unum);
00163         cvs_outerr ((char *)buf, strlen ((char *)buf));
00164         break;
00165         case 'c':
00166         ch = va_arg (args, int);
00167         buf[0] = ch;
00168         cvs_outerr ((char *)buf, 1);
00169         break;
00170         case '%':
00171         cvs_outerr ("%", 1);
00172         break;
00173         default:
00174         cvs_outerr (msg, sizeof (msg) - 1);
00175         /* Don't just keep going, because q + 1 might point to the
00176            terminating '\0'.  */
00177         goto out;
00178         }
00179         p = q + 2;
00180     }
00181     cvs_outerr (p, strlen (p));
00182     out:
00183     va_end (args);
00184
00185     if (errnum != 0)
00186     {
00187         cvs_outerr (": ", 2);
00188         cvs_outerr (strerror (errnum), 0);
00189     }
00190     cvs_outerr ("\n", 1);
00191     }
00192
00193 #ifdef CVSGUI_SHL
00194     dllglue_flushconsole();
00195 #endif /* CVSGUI_SHL */
00196
00197     if (status)
00198     error_exit ();
00199     errno = save_errno;
00200 }
00201
00202 /* Print the program name and error message MESSAGE, which is a printf-style
00203    format string with optional args to the file specified by FP.
00204    If ERRNUM is nonzero, print its corresponding system error message.
00205    Exit with status EXIT_FAILURE if STATUS is nonzero.  */
00206 /* VARARGS */
00207 void
00208 #if defined (HAVE_VPRINTF) && defined (__STDC__)
00209 fperrmsg (FILE *fp, int status, int errnum, char *message, ...)
00210 #else
00211 fperrmsg (fp, status, errnum, message, va_alist)
00212     FILE *fp;
00213     int status;
00214     int errnum;
00215     char *message;
00216     va_dcl
00217 #endif
00218 {
00219 #ifdef HAVE_VPRINTF
00220     va_list args;
00221 #endif
00222
00223     fprintf (fp, "%s: ", program_name);
00224 #ifdef HAVE_VPRINTF
00225     VA_START (args, message);
00226     vfprintf (fp, message, args);
00227     va_end (args);
00228 #else
00229 #ifdef HAVE_DOPRNT
00230     _doprnt (message, &args, fp);
00231 #else
00232     fprintf (fp, message, a1, a2, a3, a4, a5, a6, a7, a8);
00233 #endif
00234 #endif
00235     if (errnum)
00236     fprintf (fp, ": %s", strerror (errnum));
00237     putc ('\n', fp);
00238     fflush (fp);
00239     if (status)
00240     error_exit ();
00241 }
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/error.h Source File

cvs-1.10/src/error.h

Go to the documentation of this file.
00001 /* error.h -- declaration for error-reporting function
00002    Copyright (C) 1995 Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #ifndef _error_h_
00015 #define _error_h_
00016
00017 /* Add prototype support.  Normally this is done in cvs.h, but that
00018    doesn't get included from lib/savecwd.c.  */
00019 #ifndef PROTO
00020 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
00021 #define PROTO(ARGS) ARGS
00022 #else
00023 #define PROTO(ARGS) ()
00024 #endif
00025 #endif
00026
00027 #ifndef __attribute__
00028 /* This feature is available in gcc versions 2.5 and later.  */
00029 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
00030 #  define __attribute__(Spec) /* empty */
00031 # endif
00032 /* The __-protected variants of `format' and `printf' attributes
00033    are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
00034 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
00035 #  define __format__ format
00036 #  define __printf__ printf
00037 # endif
00038 #endif
00039
00040 #ifdef __STDC__
00041 void error (int, int, const char *, ...) \
00042   __attribute__ ((__format__ (__printf__, 3, 4)));
00043 #else
00044 void error ();
00045 #endif
00046
00047 /* Exit due to an error.  Similar to error (1, 0, "message"), but call
00048    it in the case where the message has already been printed.  */
00049 extern void error_exit PROTO ((void));
00050
00051 /* If non-zero, error will use the CVS protocol to report error
00052    messages.  This will only be set in the CVS server parent process;
00053    most other code is run via do_cvs_command, which forks off a child
00054    process and packages up its stderr in the protocol.  */
00055 extern int error_use_protocol;
00056
00057 #endif /* _error_h_ */
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/expand_path.c Source File

cvs-1.10/src/expand_path.c

Go to the documentation of this file.
00001 /* expand_path.c -- expand environmental variables in passed in string
00002  *
00003  * The main routine is expand_path(), it is the routine that handles
00004  * the '~' character in four forms:
00005  *     ~name
00006  *     ~name/
00007  *     ~/
00008  *     ~
00009  * and handles environment variables contained within the pathname
00010  * which are defined by:
00011  *     ${var_name}   (var_name is the name of the environ variable)
00012  *     $var_name     (var_name ends w/ non-alphanumeric char other than '_')
00013  */
00014
00015 #include "cvs.h"
00016 #include <sys/types.h>
00017
00018 static char *expand_variable PROTO((char *env, char *file, int line));
00019
00020
00021 /* User variables.  */
00022
00023 List *variable_list = NULL;
00024
00025 static void variable_delproc PROTO ((Node *));
00026
00027 static void
00028 variable_delproc (node)
00029     Node *node;
00030 {
00031     free (node->data);
00032 }
00033
00034 /* Currently used by -s option; we might want a way to set user
00035    variables in a file in the $CVSROOT/CVSROOT directory too.  */
00036
00037 void
00038 variable_set (nameval)
00039     char *nameval;
00040 {
00041     char *p;
00042     char *name;
00043     Node *node;
00044
00045     p = nameval;
00046     while (isalnum ((unsigned char) *p) || *p == '_')
00047     ++p;
00048     if (*p != '=')
00049     error (1, 0, "illegal character in user variable name in %s", nameval);
00050     if (p == nameval)
00051     error (1, 0, "empty user variable name in %s", nameval);
00052     name = xmalloc (p - nameval + 1);
00053     strncpy (name, nameval, p - nameval);
00054     name[p - nameval] = '\0';
00055     /* Make p point to the value.  */
00056     ++p;
00057     if (strchr (p, '\012') != NULL)
00058     error (1, 0, "linefeed in user variable value in %s", nameval);
00059
00060     if (variable_list == NULL)
00061     variable_list = getlist ();
00062
00063     node = findnode (variable_list, name);
00064     if (node == NULL)
00065     {
00066     node = getnode ();
00067     node->type = VARIABLE;
00068     node->delproc = variable_delproc;
00069     node->key = name;
00070     node->data = xstrdup (p);
00071     (void) addnode (variable_list, node);
00072     }
00073     else
00074     {
00075     /* Replace the old value.  For example, this means that -s
00076        options on the command line override ones from .cvsrc.  */
00077     free (node->data);
00078     node->data = xstrdup (p);
00079     free (name);
00080     }
00081 }
00082
00083 /* This routine will expand the pathname to account for ~ and $
00084    characters as described above.  Returns a pointer to a newly
00085    malloc'd string.  If an error occurs, an error message is printed
00086    via error() and NULL is returned.  FILE and LINE are the filename
00087    and linenumber to include in the error message.  FILE must point
00088    to something; LINE can be zero to indicate the line number is not
00089    known.  */
00090 char *
00091 expand_path (name, file, line)
00092     char *name;
00093     char *file;
00094     int line;
00095 {
00096     char *s;
00097     char *d;
00098
00099     char *mybuf = NULL;
00100     size_t mybuf_size = 0;
00101     char *buf = NULL;
00102     size_t buf_size = 0;
00103
00104     size_t doff;
00105
00106     char *result;
00107
00108     /* Sorry this routine is so ugly; it is a head-on collision
00109        between the `traditional' unix *d++ style and the need to
00110        dynamically allocate.  It would be much cleaner (and probably
00111        faster, not that this is a bottleneck for CVS) with more use of
00112        strcpy & friends, but I haven't taken the effort to rewrite it
00113        thusly.  */
00114
00115     /* First copy from NAME to MYBUF, expanding $<foo> as we go.  */
00116     s = name;
00117     d = mybuf;
00118     doff = d - mybuf;
00119     expand_string (&mybuf, &mybuf_size, doff + 1);
00120     d = mybuf + doff;
00121     while ((*d++ = *s))
00122     {
00123     if (*s++ == '$')
00124     {
00125         char *p = d;
00126         char *e;
00127         int flag = (*s == '{');
00128
00129         doff = d - mybuf;
00130         expand_string (&mybuf, &mybuf_size, doff + 1);
00131         d = mybuf + doff;
00132         for (; (*d++ = *s); s++)
00133         {
00134         if (flag
00135             ? *s =='}'
00136             : isalnum ((unsigned char) *s) == 0 && *s != '_')
00137             break;
00138         doff = d - mybuf;
00139         expand_string (&mybuf, &mybuf_size, doff + 1);
00140         d = mybuf + doff;
00141         }
00142         *--d = '\0';
00143         e = expand_variable (&p[flag], file, line);
00144
00145         if (e)
00146         {
00147         doff = d - mybuf;
00148         expand_string (&mybuf, &mybuf_size, doff + 1);
00149         d = mybuf + doff;
00150         for (d = &p[-1]; (*d++ = *e++);)
00151         {
00152             doff = d - mybuf;
00153             expand_string (&mybuf, &mybuf_size, doff + 1);
00154             d = mybuf + doff;
00155         }
00156         --d;
00157         if (flag && *s)
00158             s++;
00159         }
00160         else
00161         /* expand_variable has already printed an error message.  */
00162         goto error_exit;
00163     }
00164     doff = d - mybuf;
00165     expand_string (&mybuf, &mybuf_size, doff + 1);
00166     d = mybuf + doff;
00167     }
00168     doff = d - mybuf;
00169     expand_string (&mybuf, &mybuf_size, doff + 1);
00170     d = mybuf + doff;
00171     *d = '\0';
00172
00173     /* Then copy from MYBUF to BUF, expanding ~.  */
00174     s = mybuf;
00175     d = buf;
00176     /* If you don't want ~username ~/ to be expanded simply remove
00177      * This entire if statement including the else portion
00178      */
00179     if (*s++ == '~')
00180     {
00181     char *t;
00182     char *p=s;
00183     if (*s=='/' || *s==0)
00184         t = get_homedir ();
00185     else
00186     {
00187 #ifdef GETPWNAM_MISSING
00188         for (; *p!='/' && *p; p++)
00189         ;
00190         *p = 0;
00191         if (line != 0)
00192         error (0, 0,
00193                "%s:%d:tilde expansion not supported on this system",
00194                file, line);
00195         else
00196         error (0, 0, "%s:tilde expansion not supported on this system",
00197                file);
00198         return NULL;
00199 #else
00200         struct passwd *ps;
00201         for (; *p!='/' && *p; p++)
00202         ;
00203         *p = 0;
00204         ps = getpwnam (s);
00205         if (ps == 0)
00206         {
00207         if (line != 0)
00208             error (0, 0, "%s:%d: no such user %s",
00209                file, line, s);
00210         else
00211             error (0, 0, "%s: no such user %s", file, s);
00212         return NULL;
00213         }
00214         t = ps->pw_dir;
00215 #endif
00216     }
00217     if (t == NULL)
00218         error (1, 0, "cannot find home directory");
00219
00220     doff = d - buf;
00221     expand_string (&buf, &buf_size, doff + 1);
00222     d = buf + doff;
00223     while ((*d++ = *t++))
00224     {
00225         doff = d - buf;
00226         expand_string (&buf, &buf_size, doff + 1);
00227         d = buf + doff;
00228     }
00229     --d;
00230     if (*p == 0)
00231         *p = '/';          /* always add / */
00232     s=p;
00233     }
00234     else
00235     --s;
00236     /* Kill up to here */
00237     doff = d - buf;
00238     expand_string (&buf, &buf_size, doff + 1);
00239     d = buf + doff;
00240     while ((*d++ = *s++))
00241     {
00242     doff = d - buf;
00243     expand_string (&buf, &buf_size, doff + 1);
00244     d = buf + doff;
00245     }
00246     doff = d - buf;
00247     expand_string (&buf, &buf_size, doff + 1);
00248     d = buf + doff;
00249     *d = '\0';
00250
00251     /* OK, buf contains the value we want to return.  Clean up and return
00252        it.  */
00253     free (mybuf);
00254     /* Save a little memory with xstrdup; buf will tend to allocate
00255        more than it needs to.  */
00256     result = xstrdup (buf);
00257     free (buf);
00258     return result;
00259
00260  error_exit:
00261     if (mybuf != NULL)
00262     free (mybuf);
00263     if (buf != NULL)
00264     free (buf);
00265     return NULL;
00266 }
00267
00268 static char *
00269 expand_variable (name, file, line)
00270     char *name;
00271     char *file;
00272     int line;
00273 {
00274     if (strcmp (name, CVSROOT_ENV) == 0)
00275     return CVSroot_original;
00276     else if (strcmp (name, "RCSBIN") == 0)
00277     {
00278     error (0, 0, "RCSBIN internal variable is no longer supported");
00279     return NULL;
00280     }
00281     else if (strcmp (name, EDITOR1_ENV) == 0)
00282     return Editor;
00283     else if (strcmp (name, EDITOR2_ENV) == 0)
00284     return Editor;
00285     else if (strcmp (name, EDITOR3_ENV) == 0)
00286     return Editor;
00287     else if (strcmp (name, "USER") == 0)
00288     return getcaller ();
00289     else if (isalpha ((unsigned char) name[0]))
00290     {
00291     /* These names are reserved for future versions of CVS,
00292        so that is why it is an error.  */
00293     if (line != 0)
00294         error (0, 0, "%s:%d: no such internal variable $%s",
00295            file, line, name);
00296     else
00297         error (0, 0, "%s: no such internal variable $%s",
00298            file, name);
00299     return NULL;
00300     }
00301     else if (name[0] == '=')
00302     {
00303     Node *node;
00304     /* Crazy syntax for a user variable.  But we want
00305        *something* that lets the user name a user variable
00306        anything he wants, without interference from
00307        (existing or future) internal variables.  */
00308     node = findnode (variable_list, name + 1);
00309     if (node == NULL)
00310     {
00311         if (line != 0)
00312         error (0, 0, "%s:%d: no such user variable ${%s}",
00313                file, line, name);
00314         else
00315         error (0, 0, "%s: no such user variable ${%s}",
00316                file, name);
00317         return NULL;
00318     }
00319     return node->data;
00320     }
00321     else
00322     {
00323     /* It is an unrecognized character.  We return an error to
00324        reserve these for future versions of CVS; it is plausible
00325        that various crazy syntaxes might be invented for inserting
00326        information about revisions, branches, etc.  */
00327     if (line != 0)
00328         error (0, 0, "%s:%d: unrecognized variable syntax %s",
00329            file, line, name);
00330     else
00331         error (0, 0, "%s: unrecognized variable syntax %s",
00332            file, name);
00333     return NULL;
00334     }
00335 }
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/fileattr.c Source File

cvs-1.10/src/fileattr.c

Go to the documentation of this file.
00001 /* Implementation for file attribute munging features.
00002
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; either version 2, or (at your option)
00006    any later version.
00007
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.  */
00012
00013 #include "cvs.h"
00014 #include "getline.h"
00015 #include "fileattr.h"
00016 #include <assert.h>
00017
00018 static void fileattr_read PROTO ((void));
00019 static int writeattr_proc PROTO ((Node *, void *));
00020
00021 /* Where to look for CVSREP_FILEATTR.  */
00022 static char *fileattr_stored_repos;
00023
00024 /* The in-memory attributes.  */
00025 static List *attrlist;
00026 static char *fileattr_default_attrs;
00027 /* We have already tried to read attributes and failed in this directory
00028    (for example, there is no CVSREP_FILEATTR file).  */
00029 static int attr_read_attempted;
00030
00031 /* Have the in-memory attributes been modified since we read them?  */
00032 static int attrs_modified;
00033
00034 /* More in-memory attributes: linked list of unrecognized
00035    fileattr lines.  We pass these on unchanged.  */
00036 struct unrecog {
00037     char *line;
00038     struct unrecog *next;
00039 };
00040 static struct unrecog *unrecog_head;
00041
00042 /* Note that if noone calls fileattr_get, this is very cheap.  No stat(),
00043    no open(), no nothing.  */
00044 void
00045 fileattr_startdir (repos)
00046     char *repos;
00047 {
00048     assert (fileattr_stored_repos == NULL);
00049     fileattr_stored_repos = xstrdup (repos);
00050     assert (attrlist == NULL);
00051     attr_read_attempted = 0;
00052     assert (unrecog_head == NULL);
00053 }
00054
00055 static void
00056 fileattr_delproc (node)
00057     Node *node;
00058 {
00059     assert (node->data != NULL);
00060     free (node->data);
00061     node->data = NULL;
00062 }
00063
00064 /* Read all the attributes for the current directory into memory.  */
00065 static void
00066 fileattr_read ()
00067 {
00068     char *fname;
00069     FILE *fp;
00070     char *line = NULL;
00071     size_t line_len = 0;
00072
00073     /* If there are no attributes, don't waste time repeatedly looking
00074        for the CVSREP_FILEATTR file.  */
00075     if (attr_read_attempted)
00076     return;
00077
00078     /* If NULL was passed to fileattr_startdir, then it isn't kosher to look
00079        at attributes.  */
00080     assert (fileattr_stored_repos != NULL);
00081
00082     fname = xmalloc (strlen (fileattr_stored_repos)
00083              + 1
00084              + sizeof (CVSREP_FILEATTR)
00085              + 1);
00086
00087     strcpy (fname, fileattr_stored_repos);
00088     strcat (fname, "/");
00089     strcat (fname, CVSREP_FILEATTR);
00090
00091     attr_read_attempted = 1;
00092     fp = CVS_FOPEN (fname, FOPEN_BINARY_READ);
00093     if (fp == NULL)
00094     {
00095     if (!existence_error (errno))
00096         error (0, errno, "cannot read %s", fname);
00097     free (fname);
00098     return;
00099     }
00100     attrlist = getlist ();
00101     while (1) {
00102     int nread;
00103     nread = getline (&line, &line_len, fp);
00104     if (nread < 0)
00105         break;
00106     /* Remove trailing newline.  */
00107     line[nread - 1] = '\0';
00108     if (line[0] == 'F')
00109     {
00110         char *p;
00111         Node *newnode;
00112
00113         p = strchr (line, '\t');
00114         if (p == NULL)
00115         error (1, 0,
00116                "file attribute database corruption: tab missing in %s",
00117                fname);
00118         *p++ = '\0';
00119         newnode = getnode ();
00120         newnode->type = FILEATTR;
00121         newnode->delproc = fileattr_delproc;
00122         newnode->key = xstrdup (line + 1);
00123         newnode->data = xstrdup (p);
00124         if (addnode (attrlist, newnode) != 0)
00125         /* If the same filename appears twice in the file, discard
00126            any line other than the first for that filename.  This
00127            is the way that CVS has behaved since file attributes
00128            were first introduced.  */
00129         freenode (newnode);
00130     }
00131     else if (line[0] == 'D')
00132     {
00133         char *p;
00134         /* Currently nothing to skip here, but for future expansion,
00135            ignore anything located here.  */
00136         p = strchr (line, '\t');
00137         if (p == NULL)
00138         error (1, 0,
00139                "file attribute database corruption: tab missing in %s",
00140                fname);
00141         ++p;
00142         fileattr_default_attrs = xstrdup (p);
00143     }
00144     else
00145     {
00146         /* Unrecognized type, we want to just preserve the line without
00147            changing it, for future expansion.  */
00148         struct unrecog *new;
00149
00150         new = (struct unrecog *) xmalloc (sizeof (struct unrecog));
00151         new->line = xstrdup (line);
00152         new->next = unrecog_head;
00153         unrecog_head = new;
00154     }
00155     }
00156     if (ferror (fp))
00157     error (0, errno, "cannot read %s", fname);
00158     if (line != NULL)
00159     free (line);
00160     if (fclose (fp) < 0)
00161     error (0, errno, "cannot close %s", fname);
00162     attrs_modified = 0;
00163     free (fname);
00164 }
00165
00166 char *
00167 fileattr_get (filename, attrname)
00168     const char *filename;
00169     const char *attrname;
00170 {
00171     Node *node;
00172     size_t attrname_len = strlen (attrname);
00173     char *p;
00174
00175     if (attrlist == NULL)
00176     fileattr_read ();
00177     if (attrlist == NULL)
00178     /* Either nothing has any attributes, or fileattr_read already printed
00179        an error message.  */
00180     return NULL;
00181
00182     if (filename == NULL)
00183     p = fileattr_default_attrs;
00184     else
00185     {
00186     node = findnode (attrlist, filename);
00187     if (node == NULL)
00188         /* A file not mentioned has no attributes.  */
00189         return NULL;
00190     p = node->data;
00191     }
00192     while (p)
00193     {
00194     if (strncmp (attrname, p, attrname_len) == 0
00195         && p[attrname_len] == '=')
00196     {
00197         /* Found it.  */
00198         return p + attrname_len + 1;
00199     }
00200     p = strchr (p, ';');
00201     if (p == NULL)
00202         break;
00203     ++p;
00204     }
00205     /* The file doesn't have this attribute.  */
00206     return NULL;
00207 }
00208
00209 char *
00210 fileattr_get0 (filename, attrname)
00211     const char *filename;
00212     const char *attrname;
00213 {
00214     char *cp;
00215     char *cpend;
00216     char *retval;
00217
00218     cp = fileattr_get (filename, attrname);
00219     if (cp == NULL)
00220     return NULL;
00221     cpend = strchr (cp, ';');
00222     if (cpend == NULL)
00223     cpend = cp + strlen (cp);
00224     retval = xmalloc (cpend - cp + 1);
00225     strncpy (retval, cp, cpend - cp);
00226     retval[cpend - cp] = '\0';
00227     return retval;
00228 }
00229
00230 char *
00231 fileattr_modify (list, attrname, attrval, namevalsep, entsep)
00232     char *list;
00233     const char *attrname;
00234     const char *attrval;
00235     int namevalsep;
00236     int entsep;
00237 {
00238     char *retval;
00239     char *rp;
00240     size_t attrname_len = strlen (attrname);
00241
00242     /* Portion of list before the attribute to be replaced.  */
00243     char *pre;
00244     char *preend;
00245     /* Portion of list after the attribute to be replaced.  */
00246     char *post;
00247
00248     char *p;
00249     char *p2;
00250
00251     p = list;
00252     pre = list;
00253     preend = NULL;
00254     /* post is NULL unless set otherwise.  */
00255     post = NULL;
00256     p2 = NULL;
00257     if (list != NULL)
00258     {
00259     while (1) {
00260         p2 = strchr (p, entsep);
00261         if (p2 == NULL)
00262         {
00263         p2 = p + strlen (p);
00264         if (preend == NULL)
00265             preend = p2;
00266         }
00267         else
00268         ++p2;
00269         if (strncmp (attrname, p, attrname_len) == 0
00270         && p[attrname_len] == namevalsep)
00271         {
00272         /* Found it.  */
00273         preend = p;
00274         if (preend > list)
00275             /* Don't include the preceding entsep.  */
00276             --preend;
00277
00278         post = p2;
00279         }
00280         if (p2[0] == '\0')
00281         break;
00282         p = p2;
00283     }
00284     }
00285     if (post == NULL)
00286     post = p2;
00287
00288     if (preend == pre && attrval == NULL && post == p2)
00289     return NULL;
00290
00291     retval = xmalloc ((preend - pre)
00292               + 1
00293               + (attrval == NULL ? 0 : (attrname_len + 1
00294                         + strlen (attrval)))
00295               + 1
00296               + (p2 - post)
00297               + 1);
00298     if (preend != pre)
00299     {
00300     strncpy (retval, pre, preend - pre);
00301     rp = retval + (preend - pre);
00302     if (attrval != NULL)
00303         *rp++ = entsep;
00304     *rp = '\0';
00305     }
00306     else
00307     retval[0] = '\0';
00308     if (attrval != NULL)
00309     {
00310     strcat (retval, attrname);
00311     rp = retval + strlen (retval);
00312     *rp++ = namevalsep;
00313     strcpy (rp, attrval);
00314     }
00315     if (post != p2)
00316     {
00317     rp = retval + strlen (retval);
00318     if (preend != pre || attrval != NULL)
00319         *rp++ = entsep;
00320     strncpy (rp, post, p2 - post);
00321     rp += p2 - post;
00322     *rp = '\0';
00323     }
00324     return retval;
00325 }
00326
00327 void
00328 fileattr_set (filename, attrname, attrval)
00329     const char *filename;
00330     const char *attrname;
00331     const char *attrval;
00332 {
00333     Node *node;
00334     char *p;
00335
00336     if (filename == NULL)
00337     {
00338     p = fileattr_modify (fileattr_default_attrs, attrname, attrval,
00339                  '=', ';');
00340     if (fileattr_default_attrs != NULL)
00341         free (fileattr_default_attrs);
00342     fileattr_default_attrs = p;
00343     attrs_modified = 1;
00344     return;
00345     }
00346     if (attrlist == NULL)
00347     fileattr_read ();
00348     if (attrlist == NULL)
00349     {
00350     /* Not sure this is a graceful way to handle things
00351        in the case where fileattr_read was unable to read the file.  */
00352         /* No attributes existed previously.  */
00353     attrlist = getlist ();
00354     }
00355
00356     node = findnode (attrlist, filename);
00357     if (node == NULL)
00358     {
00359     if (attrval == NULL)
00360         /* Attempt to remove an attribute which wasn't there.  */
00361         return;
00362
00363     /* First attribute for this file.  */
00364     node = getnode ();
00365     node->type = FILEATTR;
00366     node->delproc = fileattr_delproc;
00367     node->key = xstrdup (filename);
00368     node->data = xmalloc (strlen (attrname) + 1 + strlen (attrval) + 1);
00369     strcpy (node->data, attrname);
00370     strcat (node->data, "=");
00371     strcat (node->data, attrval);
00372     addnode (attrlist, node);
00373     }
00374
00375     p = fileattr_modify (node->data, attrname, attrval, '=', ';');
00376     if (p == NULL)
00377     delnode (node);
00378     else
00379     {
00380     free (node->data);
00381     node->data = p;
00382     }
00383
00384     attrs_modified = 1;
00385 }
00386
00387 char *
00388 fileattr_getall (filename)
00389     const char *filename;
00390 {
00391     Node *node;
00392     char *p;
00393
00394     if (attrlist == NULL)
00395     fileattr_read ();
00396     if (attrlist == NULL)
00397     /* Either nothing has any attributes, or fileattr_read already printed
00398        an error message.  */
00399     return NULL;
00400
00401     if (filename == NULL)
00402     p = fileattr_default_attrs;
00403     else
00404     {
00405     node = findnode (attrlist, filename);
00406     if (node == NULL)
00407         /* A file not mentioned has no attributes.  */
00408         return NULL;
00409     p = node->data;
00410     }
00411     return xstrdup (p);
00412 }
00413
00414 void
00415 fileattr_setall (filename, attrs)
00416     const char *filename;
00417     const char *attrs;
00418 {
00419     Node *node;
00420
00421     if (filename == NULL)
00422     {
00423     if (fileattr_default_attrs != NULL)
00424         free (fileattr_default_attrs);
00425     fileattr_default_attrs = xstrdup (attrs);
00426     attrs_modified = 1;
00427     return;
00428     }
00429     if (attrlist == NULL)
00430     fileattr_read ();
00431     if (attrlist == NULL)
00432     {
00433     /* Not sure this is a graceful way to handle things
00434        in the case where fileattr_read was unable to read the file.  */
00435         /* No attributes existed previously.  */
00436     attrlist = getlist ();
00437     }
00438
00439     node = findnode (attrlist, filename);
00440     if (node == NULL)
00441     {
00442     /* The file had no attributes.  Add them if we have any to add.  */
00443     if (attrs != NULL)
00444     {
00445         node = getnode ();
00446         node->type = FILEATTR;
00447         node->delproc = fileattr_delproc;
00448         node->key = xstrdup (filename);
00449         node->data = xstrdup (attrs);
00450         addnode (attrlist, node);
00451     }
00452     }
00453     else
00454     {
00455     if (attrs == NULL)
00456         delnode (node);
00457     else
00458     {
00459         free (node->data);
00460         node->data = xstrdup (attrs);
00461     }
00462     }
00463
00464     attrs_modified = 1;
00465 }
00466
00467 void
00468 fileattr_newfile (filename)
00469     const char *filename;
00470 {
00471     Node *node;
00472
00473     if (attrlist == NULL)
00474     fileattr_read ();
00475
00476     if (fileattr_default_attrs == NULL)
00477     return;
00478
00479     if (attrlist == NULL)
00480     {
00481     /* Not sure this is a graceful way to handle things
00482        in the case where fileattr_read was unable to read the file.  */
00483         /* No attributes existed previously.  */
00484     attrlist = getlist ();
00485     }
00486
00487     node = getnode ();
00488     node->type = FILEATTR;
00489     node->delproc = fileattr_delproc;
00490     node->key = xstrdup (filename);
00491     node->data = xstrdup (fileattr_default_attrs);
00492     addnode (attrlist, node);
00493     attrs_modified = 1;
00494 }
00495
00496 static int
00497 writeattr_proc (node, data)
00498     Node *node;
00499     void *data;
00500 {
00501     FILE *fp = (FILE *)data;
00502     fputs ("F", fp);
00503     fputs (node->key, fp);
00504     fputs ("\t", fp);
00505     fputs (node->data, fp);
00506     fputs ("\012", fp);
00507     return 0;
00508 }
00509
00510 void
00511 fileattr_write ()
00512 {
00513     FILE *fp;
00514     char *fname;
00515     mode_t omask;
00516     struct unrecog *p;
00517
00518     if (!attrs_modified)
00519     return;
00520
00521     if (noexec)
00522     return;
00523
00524     /* If NULL was passed to fileattr_startdir, then it isn't kosher to set
00525        attributes.  */
00526     assert (fileattr_stored_repos != NULL);
00527
00528     fname = xmalloc (strlen (fileattr_stored_repos)
00529              + 1
00530              + sizeof (CVSREP_FILEATTR)
00531              + 1);
00532
00533     strcpy (fname, fileattr_stored_repos);
00534     strcat (fname, "/");
00535     strcat (fname, CVSREP_FILEATTR);
00536
00537     if (list_isempty (attrlist)
00538     && fileattr_default_attrs == NULL
00539     && unrecog_head == NULL)
00540     {
00541     /* There are no attributes.  */
00542     if (unlink_file (fname) < 0)
00543     {
00544         if (!existence_error (errno))
00545         {
00546         error (0, errno, "cannot remove %s", fname);
00547         }
00548     }
00549
00550     /* Now remove CVSREP directory, if empty.  The main reason we bother
00551        is that CVS 1.6 and earlier will choke if a CVSREP directory
00552        exists, so provide the user a graceful way to remove it.  */
00553     strcpy (fname, fileattr_stored_repos);
00554     strcat (fname, "/");
00555     strcat (fname, CVSREP);
00556     if (CVS_RMDIR (fname) < 0)
00557     {
00558         if (errno != ENOTEMPTY
00559
00560         /* Don't know why we would be here if there is no CVSREP
00561            directory, but it seemed to be happening anyway, so
00562            check for it.  */
00563         && !existence_error (errno))
00564         error (0, errno, "cannot remove %s", fname);
00565     }
00566
00567     free (fname);
00568     return;
00569     }
00570
00571     omask = umask (cvsumask);
00572     fp = CVS_FOPEN (fname, FOPEN_BINARY_WRITE);
00573     if (fp == NULL)
00574     {
00575     if (existence_error (errno))
00576     {
00577         /* Maybe the CVSREP directory doesn't exist.  Try creating it.  */
00578         char *repname;
00579
00580         repname = xmalloc (strlen (fileattr_stored_repos)
00581                    + 1
00582                    + sizeof (CVSREP)
00583                    + 1);
00584         strcpy (repname, fileattr_stored_repos);
00585         strcat (repname, "/");
00586         strcat (repname, CVSREP);
00587
00588         if (CVS_MKDIR (repname, 0777) < 0 && errno != EEXIST)
00589         {
00590         error (0, errno, "cannot make directory %s", repname);
00591         (void) umask (omask);
00592         free (repname);
00593         return;
00594         }
00595         free (repname);
00596
00597         fp = CVS_FOPEN (fname, FOPEN_BINARY_WRITE);
00598     }
00599     if (fp == NULL)
00600     {
00601         error (0, errno, "cannot write %s", fname);
00602         (void) umask (omask);
00603         return;
00604     }
00605     }
00606     (void) umask (omask);
00607
00608     /* First write the "F" attributes.  */
00609     walklist (attrlist, writeattr_proc, fp);
00610
00611     /* Then the "D" attribute.  */
00612     if (fileattr_default_attrs != NULL)
00613     {
00614     fputs ("D\t", fp);
00615     fputs (fileattr_default_attrs, fp);
00616     fputs ("\012", fp);
00617     }
00618
00619     /* Then any other attributes.  */
00620     for (p = unrecog_head; p != NULL; p = p->next)
00621     {
00622     fputs (p->line, fp);
00623     fputs ("\012", fp);
00624     }
00625
00626     if (fclose (fp) < 0)
00627     error (0, errno, "cannot close %s", fname);
00628     attrs_modified = 0;
00629     free (fname);
00630 }
00631
00632 void
00633 fileattr_free ()
00634 {
00635     /* Note that attrs_modified will ordinarily be zero, but there are
00636        a few cases in which fileattr_write will fail to zero it (if
00637        noexec is set, or error conditions).  This probably is the way
00638        it should be.  */
00639     dellist (&attrlist);
00640     if (fileattr_stored_repos != NULL)
00641     free (fileattr_stored_repos);
00642     fileattr_stored_repos = NULL;
00643     if (fileattr_default_attrs != NULL)
00644     free (fileattr_default_attrs);
00645     fileattr_default_attrs = NULL;
00646     while (unrecog_head)
00647     {
00648     struct unrecog *p = unrecog_head;
00649     unrecog_head = p->next;
00650     free (p->line);
00651     free (p);
00652     }
00653 }
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/fileattr.h Source File

cvs-1.10/src/fileattr.h

Go to the documentation of this file.
00001 /* Declarations for file attribute munging features.
00002
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; either version 2, or (at your option)
00006    any later version.
00007
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.  */
00012
00013 #ifndef FILEATTR_H
00014
00015 /* File containing per-file attributes.  The format of this file is in
00016    cvs.texinfo but here is a quick summary.  The file contains a
00017    series of entries:
00018
00019    ENT-TYPE FILENAME <tab> ATTRNAME = ATTRVAL
00020      {; ATTRNAME = ATTRVAL} <linefeed>
00021
00022    ENT-TYPE is 'F' for a file.
00023
00024    ENT-TYPE is 'D', and FILENAME empty, for default attributes.
00025
00026    Other ENT-TYPE are reserved for future expansion.
00027
00028    Note that the order of the line is not significant; CVS is free to
00029    rearrange them at its convenience.
00030
00031    FIXME: this implementation doesn't handle '\0' in any of the
00032    fields.  We are encouraged to fix this (by cvs.texinfo).
00033
00034    By convention, ATTRNAME starting with '_' is for an attribute given
00035    special meaning by CVS; other ATTRNAMEs are for user-defined attributes
00036    (or will be, once we add commands to manipulate user-defined attributes).
00037
00038    Builtin attributes:
00039
00040    _watched: Present means the file is watched and should be checked out
00041    read-only.
00042
00043    _watchers: Users with watches for this file.  Value is
00044    WATCHER > TYPE { , WATCHER > TYPE }
00045    where WATCHER is a username, and TYPE is edit,unedit,commit separated by
00046    + (or nothing if none; there is no "none" or "all" keyword).
00047
00048    _editors: Users editing this file.  Value is
00049    EDITOR > VAL { , EDITOR > VAL }
00050    where EDITOR is a username, and VAL is TIME+HOSTNAME+PATHNAME, where
00051    TIME is when the "cvs edit" command happened,
00052    and HOSTNAME and PATHNAME are for the working directory.  */
00053
00054 #define CVSREP_FILEATTR "CVS/fileattr"
00055
00056 /* Prepare for a new directory with repository REPOS.  If REPOS is NULL,
00057    then prepare for a "non-directory"; the caller can call fileattr_write
00058    and fileattr_free, but must not call fileattr_get or fileattr_set.  */
00059 extern void fileattr_startdir PROTO ((char *repos));
00060
00061 /* Get the attribute ATTRNAME for file FILENAME.  The return value
00062    points into memory managed by the fileattr_* routines, should not
00063    be altered by the caller, and is only good until the next call to
00064    fileattr_clear or fileattr_set.  It points to the value, terminated
00065    by '\0' or ';'.  Return NULL if said file lacks said attribute.
00066    If FILENAME is NULL, return default attributes (attributes for
00067    files created in the future).  */
00068 extern char *fileattr_get PROTO ((const char *filename, const char *attrname));
00069
00070 /* Like fileattr_get, but return a pointer to a newly malloc'd string
00071    terminated by '\0' (or NULL if said file lacks said attribute).  */
00072 extern char *fileattr_get0 PROTO ((const char *filename,
00073                    const char *attrname));
00074
00075 /* This is just a string manipulation function; it does not manipulate
00076    file attributes as such.
00077
00078    LIST is in the format
00079
00080    ATTRNAME NAMEVALSEP ATTRVAL {ENTSEP ATTRNAME NAMEVALSEP ATTRVAL}
00081
00082    And we want to put in an attribute with name NAME and value VAL,
00083    replacing the already-present attribute with name NAME if there is
00084    one.  Or if VAL is NULL remove attribute NAME.  Return a new
00085    malloc'd list; don't muck with the one passed in.  If we are removing
00086    the last attribute return NULL.  LIST can be NULL to mean that we
00087    started out without any attributes.
00088
00089    Examples:
00090
00091    fileattr_modify ("abc=def", "xxx", "val", '=', ';')) => "abc=def;xxx=val"
00092    fileattr_modify ("abc=def", "abc", "val", '=', ';')) => "abc=val"
00093    fileattr_modify ("abc=v1;def=v2", "abc", "val", '=', ';'))
00094      => "abc=val;def=v2"
00095    fileattr_modify ("abc=v1;def=v2", "def", "val", '=', ';'))
00096      => "abc=v1;def=val"
00097    fileattr_modify ("abc=v1;def=v2", "xxx", "val", '=', ';'))
00098      => "abc=v1;def=v2;xxx=val"
00099    fileattr_modify ("abc=v1;def=v2;ghi=v3", "def", "val", '=', ';'))
00100      => "abc=v1;def=val;ghi=v3"
00101 */
00102
00103 extern char *fileattr_modify PROTO ((char *list, const char *attrname,
00104                      const char *attrval, int namevalsep,
00105                      int entsep));
00106
00107 /* Set attribute ATTRNAME for file FILENAME to ATTRVAL.  If ATTRVAL is NULL,
00108    the attribute is removed.  Changes are not written to disk until the
00109    next call to fileattr_write.  If FILENAME is NULL, set attributes for
00110    files created in the future.  If ATTRVAL is NULL, remove that attribute.  */
00111 extern void fileattr_set PROTO ((const char *filename, const char *attrname,
00112                  const char *attrval));
00113
00114 /* Get all the attributes for file FILENAME.  They are returned as malloc'd
00115    data in an unspecified format which is guaranteed only to be good for
00116    passing to fileattr_setall, or NULL if no attributes.  If FILENAME is
00117    NULL, get default attributes.  */
00118 extern char *fileattr_getall PROTO ((const char *filename));
00119
00120 /* Set the attributes for file FILENAME to ATTRS, overwriting all previous
00121    attributes for that file.  ATTRS was obtained from a previous call to
00122    fileattr_getall (malloc'd data or NULL).  */
00123 extern void fileattr_setall PROTO ((const char *filename, const char *attrs));
00124
00125 /* Set the attributes for file FILENAME in whatever manner is appropriate
00126    for a newly created file.  */
00127 extern void fileattr_newfile PROTO ((const char *filename));
00128
00129 /* Write out all modified attributes.  */
00130 extern void fileattr_write PROTO ((void));
00131
00132 /* Free all memory allocated by fileattr_*.  */
00133 extern void fileattr_free PROTO ((void));
00134
00135 #define FILEATTR_H 1
00136 #endif /* fileattr.h */
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


edit.c File Reference

cvs-1.10/src/edit.c File Reference

#include "cvs.h"
#include "getline.h"
#include "watch.h"
#include "edit.h"
#include "fileattr.h"

Include dependency graph for edit.c:

Include dependency graph

Go to the source code of this file.

Functions

int | watch_onoff ()
int | onoff_fileproc ()
int | onoff_fileproc (callerdat, finfo) void *callerdat
int | onoff_filesdoneproc (callerdat, err, repository, update_dir, entries) void *callerdat
int | dummy_fileproc (callerdat, finfo) void *callerdat
int | ncheck_fileproc (callerdat, finfo) void *callerdat
int | send_notifications (argc, argv, local) int argc
int | edit_fileproc (callerdat, finfo) void *callerdat
int | edit (argc, argv) int argc
int | unedit_fileproc (callerdat, finfo) void *callerdat
int | unedit (argc, argv) int argc
int | notify_proc ()
int | notify_proc (repository, filter) char *repository
int | editors_fileproc ()
int | editors_fileproc (callerdat, finfo) void *callerdat

Variables

int | setting_default
int | turning_on
int | setting_tedit
int | setting_tunedit
int | setting_tcommit
file_info * finfo
int | err
char * | repository
char * | update_dir
List * entries
char ** | argv
int | local
char * | editor
char * | val
notify_proc_args * | notify_args
char * | filter
char * | filename
char * | who
char * | watches

Function Documentation

int dummy_fileproc | ( | callerdat | ,
 |  | finfo |
 | ) | [static]

int edit | ( | argc | ,
 |  | argv |
 | ) |

int edit_fileproc | ( | callerdat | ,
 |  | finfo |
 | ) | [static]

int editors_fileproc | ( | callerdat | ,
 |  | finfo |
 | ) | [static]

int editors_fileproc ( ) [static]

int ncheck_fileproc | ( | callerdat | ,
 |  | finfo |
 | ) | [static]

int notify_proc | ( | repository | ,
 |  | filter |
 | ) | [static]

int notify_proc ( ) [static]

int onoff_fileproc | ( | callerdat | ,
 |  | finfo |
 | ) | [static]

int onoff_fileproc ( ) [static]

int onoff_filesdoneproc | ( | callerdat | ,
 |  | err | ,
 |  | repository | ,
 |  | update_dir | ,
 |  | entries |
 | ) | [static]

int send_notifications | ( | argc | ,
 |  | argv | ,
 |  | local |
 | ) | [static]

int unedit | ( | argc | ,
 |  | argv |
 | ) |

int unedit_fileproc | ( | callerdat | ,
 |  | finfo |
 | ) | [static]

int watch_onoff ( ) [static]

Variable Documentation

char** argv

Definition at line 1092 of file edit.c.

char* editor

Definition at line 643 of file edit.c.

List* entries

Definition at line 47 of file edit.c.

int err

Definition at line 44 of file edit.c.

const char * filename

Definition at line 5435 of file rcs.c.

char* filter

Definition at line 683 of file edit.c.

struct file_info* finfo

Definition at line 1040 of file edit.c.

int local

Definition at line 230 of file edit.c.

struct notify_proc_args* notify_args [static]

Definition at line 676 of file edit.c.

char* repository

Definition at line 757 of file edit.c.

int setting_default [static]

Definition at line 21 of file edit.c.

int setting_tcommit [static]

Definition at line 26 of file edit.c.

int setting_tedit [static]

Definition at line 24 of file edit.c.

int setting_tunedit [static]

Definition at line 25 of file edit.c.

int turning_on [static]

Definition at line 22 of file edit.c.

char* update_dir

Definition at line 46 of file edit.c.

char * val

Definition at line 2037 of file rcs.c.

char* watches

Definition at line 756 of file edit.c.

char* who

Definition at line 754 of file edit.c.

Generated on Sun Oct 21 12:43:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


edit.h File Reference

cvs-1.10/src/edit.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int watch_on | PROTO ((int argc, char **argv))
void notify_do | PROTO ((int type, char *filename, char *who, char *val, char *watches, char *repository))
void editor_set | PROTO ((char *filename, char *editor, char *val))
void mark_up_to_date | PROTO ((char *file))

Function Documentation

void mark_up_to_date PROTO ( (char *file) )

void editor_set PROTO ( (char *filename, char *editor, char *val) )

void notify_do PROTO ( (int type, char *filename, char *who, char *val, char *watches, char *repository) )

int watch_on PROTO ( (int argc, char **argv) )

Generated on Sun Oct 21 12:43:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


entries.c File Reference

cvs-1.10/src/entries.c File Reference

#include "cvs.h"
#include "getline.h"

Include dependency graph for entries.c:

Include dependency graph

Go to the source code of this file.

Functions

Node * AddEntryNode ()
Entnode * fgetentent ()
int | fputentent ()
Entnode * subdir_record ()
Entnode * Entnode_Create ()
Entnode * | Entnode_Create (type, user, vn, ts, options, tag, date, ts_conflict) enum ent_type type
void | Entnode_Destroy (ent) Entnode *ent
int | write_ent_proc (node, closure) Node *node
void | base_walk ()
void | base_walk (code, finfo, rev) enum base_walk code

Variables

FILE * | entfile
char * | entfilename
const char * | user
const char * | vn
const char * | ts
const char * | options
const char * | tag
const char * | date
const char * | ts_conflict
void * | closure
char * | fname
char * | cmd
int * | sawdir
Entnode * p
char * | update_dir
Entnode * entdata
int | nonbranch
char * | repository
char ** | datep
int * | nonbranchp
const char * | parent
const char * | dir
file_info * finfo
char ** | rev

Function Documentation

Node* AddEntryNode ( ) [static]

Entnode* Entnode_Create | ( | type | ,
 |  | user | ,
 |  | vn | ,
 |  | ts | ,
 |  | options | ,
 |  | tag | ,
 |  | date | ,
 |  | ts_conflict |
 | ) | [static]

Entnode* Entnode_Create ( ) [static]

Referenced by sawdir().

void Entnode_Destroy ( ent ) [static]

void base_walk | ( | code | ,
 |  | finfo | ,
 |  | rev |
 | ) | [static]

void base_walk ( ) [static]

Entnode* fgetentent ( ) [static]

Referenced by Entries_Open().

int fputentent ( ) [static]

Entnode* subdir_record ( ) [static]

int write_ent_proc | ( | node | ,
 |  | closure |
 | ) | [static]

Variable Documentation

void* closure

Definition at line 91 of file entries.c.

char* cmd

Definition at line 289 of file entries.c.

Referenced by CCustomizeMenus::OnInitDialog(), and WININFO::Search().

char* date

Definition at line 643 of file entries.c.

char** datep

Definition at line 716 of file entries.c.

const char* dir

Definition at line 945 of file entries.c.

Entnode* entdata

Definition at line 608 of file entries.c.

FILE* entfile [static]

Definition at line 24 of file entries.c.

char* entfilename [static]

Definition at line 25 of file entries.c.

struct file_info* finfo

Definition at line 1008 of file entries.c.

char * fname

Definition at line 212 of file entries.c.

int nonbranch

Definition at line 644 of file entries.c.

int* nonbranchp

Definition at line 717 of file entries.c.

char* options

Definition at line 215 of file entries.c.

Entnode* p

Definition at line 412 of file entries.c.

const char * parent

Definition at line 944 of file entries.c.

Referenced by UWidget::OnTreeDelete().

char* repository

Definition at line 646 of file entries.c.

char* rev

Definition at line 1175 of file entries.c.

int* sawdir

Definition at line 290 of file entries.c.

char* tag

Definition at line 642 of file entries.c.

char * ts

Definition at line 214 of file entries.c.

char * ts_conflict

Definition at line 218 of file entries.c.

char* update_dir

Definition at line 645 of file entries.c.

const char* user

Definition at line 38 of file entries.c.

char * vn

Definition at line 213 of file entries.c.

Generated on Sun Oct 21 12:43:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


error.c File Reference

cvs-1.10/src/error.c File Reference

#include "cvs.h"
#include <stdio.h>

Include dependency graph for error.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | va_alist a1, a2, a3, a4, a5, a6, a7, a8
#define | va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;

Functions

void | exit ()
char * | strerror ()
void | error_exit ()
void | error (status, errnum, message, a1, a2, a3, a4, a5, a6, a7, a8) int status

Variables

int | error_use_protocol
int | errnum
const char * | message
char * | a1
char * | a2
char * | a3
char * | a4
char * | a5
char * | a6
char * | a7
char * | a8
int | status

Define Documentation

#define va_alist a1, a2, a3, a4, a5, a6, a7, a8

Definition at line 43 of file error.c.

#define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;

Definition at line 44 of file error.c.

Function Documentation

void error | ( | status | ,
 |  | errnum | ,
 |  | message | ,
 |  | a1 | ,
 |  | a2 | ,
 |  | a3 | ,
 |  | a4 | ,
 |  | a5 | ,
 |  | a6 | ,
 |  | a7 | ,
 |  | a8 |
 | ) |

void error_exit ( )

Definition at line 65 of file error.c.

00066 {
00067     rcs_cleanup ();
00068     Lock_Cleanup ();
00069 #ifdef SERVER_SUPPORT
00070     if (server_active)
00071     server_cleanup (0);
00072 #endif
00073 #ifdef SYSTEM_CLEANUP
00074     /* Hook for OS-specific behavior, for example socket subsystems on
00075        NT and OS2 or dealing with windows and arguments on Mac.  */
00076     SYSTEM_CLEANUP ();
00077 #endif
00078     exit (EXIT_FAILURE);
00079 }

void exit ( )

char* strerror ( )

Variable Documentation

char * a1

Definition at line 216 of file error.c.

char * a2

Definition at line 216 of file error.c.

char * a3

Definition at line 216 of file error.c.

char * a4

Definition at line 216 of file error.c.

char * a5

Definition at line 216 of file error.c.

char * a6

Definition at line 216 of file error.c.

char * a7

Definition at line 216 of file error.c.

char * a8

Definition at line 216 of file error.c.

int errnum

Definition at line 214 of file error.c.

int error_use_protocol

Definition at line 25 of file error.c.

char* message

Definition at line 215 of file error.c.

int status

Definition at line 213 of file error.c.

Generated on Sun Oct 21 12:43:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


error.h File Reference

cvs-1.10/src/error.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | PROTO(ARGS) ()
#define | __attribute__(Spec)
#define | __format__ format
#define | __printf__ printf

Functions

void | error ()
void | error_exit ()

Variables

int | error_use_protocol

Define Documentation

#define PROTO ( ARGS ) ()

Definition at line 23 of file error.h.

#define __attribute__ ( Spec )

Definition at line 30 of file error.h.

#define __format__ format

Definition at line 35 of file error.h.

#define __printf__ printf

Definition at line 36 of file error.h.

Function Documentation

void error ( )

Referenced by CVSroot_proxy_port(), CompareTargetDate(), GetTimeZoneBias(), IsDST(), _statcore(), all(), argv(), bind_and_connect(), convert_file(), cvs_temp_name(), default_branch(), delvers(), dest(), dirpath(), entries(), filter(), finfo(), getpass(), inclusive(), line(), macos_shutdown_server(), macos_start_server(), might_not_exist(), open_module(), os2_shutdown_server(), os2_start_server(), out(), prcsbuf(), rcmd(), rcmd_authenticate(), rcsbuf(), repository(), resolve_address(), rev(), rev2(), rootdir(), sticky(), to(), update_server(), vms_start_server(), wnt_shutdown_server(), wnt_start_server(), and writable().

void error_exit ( )

Definition at line 65 of file error.c.

00066 {
00067     rcs_cleanup ();
00068     Lock_Cleanup ();
00069 #ifdef SERVER_SUPPORT
00070     if (server_active)
00071     server_cleanup (0);
00072 #endif
00073 #ifdef SYSTEM_CLEANUP
00074     /* Hook for OS-specific behavior, for example socket subsystems on
00075        NT and OS2 or dealing with windows and arguments on Mac.  */
00076     SYSTEM_CLEANUP ();
00077 #endif
00078     exit (EXIT_FAILURE);
00079 }

Variable Documentation

int error_use_protocol

Definition at line 55 of file error.h.

Generated on Sun Oct 21 12:43:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


expand_path.c File Reference

cvs-1.10/src/expand_path.c File Reference

#include "cvs.h"
#include <sys/types.h>

Include dependency graph for expand_path.c:

Include dependency graph

Go to the source code of this file.

Functions

char * | expand_variable ()
void | variable_delproc ()
void | variable_delproc (node) Node *node

Variables

List * | variable_list = NULL
char * | file
int | line

Function Documentation

char* expand_variable ( ) [static]

void variable_delproc ( node ) [static]

void variable_delproc ( ) [static]

Variable Documentation

char* file

Definition at line 271 of file expand_path.c.

int line

Definition at line 272 of file expand_path.c.

List* variable_list = NULL

Definition at line 23 of file expand_path.c.

Generated on Sun Oct 21 12:43:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


fileattr.c File Reference

cvs-1.10/src/fileattr.c File Reference

#include "cvs.h"
#include "getline.h"
#include "fileattr.h"
#include <assert.h>

Include dependency graph for fileattr.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | unrecog

Functions

void | fileattr_read ()
int | writeattr_proc ()
void | fileattr_startdir (repos) char *repos

Variables

char * | fileattr_stored_repos
List * attrlist
char * | fileattr_default_attrs
int | attr_read_attempted
int | attrs_modified
unrecog * unrecog_head
const char * | attrname
const char * | attrval
int | namevalsep
int | entsep
const char * | attrs
void * | data

Function Documentation

void fileattr_read ( ) [static]

void fileattr_startdir ( repos )

int writeattr_proc ( ) [static]

Variable Documentation

int attr_read_attempted [static]

Definition at line 29 of file fileattr.c.

List* attrlist [static]

Definition at line 25 of file fileattr.c.

const char * attrname

Definition at line 330 of file fileattr.c.

const char* attrs

Definition at line 417 of file fileattr.c.

int attrs_modified [static]

Definition at line 32 of file fileattr.c.

const char * attrval

Definition at line 331 of file fileattr.c.

void* data

Definition at line 499 of file fileattr.c.

int entsep

Definition at line 236 of file fileattr.c.

char* fileattr_default_attrs [static]

Definition at line 26 of file fileattr.c.

char* fileattr_stored_repos [static]

Definition at line 22 of file fileattr.c.

int namevalsep

Definition at line 235 of file fileattr.c.

struct unrecog* unrecog_head [static]

Definition at line 40 of file fileattr.c.

Generated on Sun Oct 21 12:43:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


fileattr.h File Reference

cvs-1.10/src/fileattr.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | CVSREP_FILEATTR "CVS/fileattr"
#define | FILEATTR_H 1

Functions

void fileattr_startdir | PROTO ((char *repos))
char *fileattr_get | PROTO ((const char *filename, const char *attrname))
char *fileattr_modify | PROTO ((char *list, const char *attrname, const char *attrval, int namevalsep, int entsep))
void fileattr_set | PROTO ((const char *filename, const char *attrname, const char *attrval))
char *fileattr_getall | PROTO ((const char *filename))
void fileattr_setall | PROTO ((const char *filename, const char *attrs))
void fileattr_write | PROTO ((void))

Define Documentation

#define CVSREP_FILEATTR "CVS/fileattr"

Definition at line 54 of file fileattr.h.

#define FILEATTR_H 1

Definition at line 135 of file fileattr.h.

Function Documentation

void fileattr_write PROTO ( (void) )

void fileattr_setall PROTO ( (const char *filename, const char *attrs) )

char* fileattr_getall PROTO ( (const char *filename) )

void fileattr_set PROTO ( (const char *filename, const char *attrname, const char *attrval) )

char* fileattr_modify PROTO ( (char *list, const char *attrname, const char *attrval, int namevalsep, int entsep) )

char* fileattr_get PROTO ( (const char *filename, const char *attrname) )

void fileattr_startdir PROTO ( (char *repos) )

Generated on Sun Oct 21 12:43:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


filesubr.c File Reference

cvs-1.10/src/filesubr.c File Reference

#include "cvs.h"

Include dependency graph for filesubr.c:

Include dependency graph

Go to the source code of this file.

Functions

int | deep_remove_dir ()
void | copy_file (from, to) const char *from

Variables

const char * | to
const int | mode
int | writable
char * | buf
size_t | nchars
const char * | file2
char ** | argv
int * | pargc
char *** | pargv

Function Documentation

void copy_file | ( | from | ,
 |  | to |
 | ) | const

int deep_remove_dir ( ) [static]

Variable Documentation

char** argv

Definition at line 844 of file filesubr.c.

char* buf

Definition at line 557 of file filesubr.c.

const char* file2

Definition at line 594 of file filesubr.c.

const char* mode

Definition at line 270 of file filesubr.c.

size_t nchars

Definition at line 558 of file filesubr.c.

int* pargc

Definition at line 845 of file filesubr.c.

char*** pargv

Definition at line 846 of file filesubr.c.

const char* to

Definition at line 396 of file filesubr.c.

int writable

Definition at line 351 of file filesubr.c.

Generated on Sun Oct 21 12:42:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/filesubr.c Source File

cvs-1.10/src/filesubr.c

Go to the documentation of this file.
00001 /* filesubr.c --- subroutines for dealing with files
00002    Jim Blandy <jimb@cyclic.com>
00003
00004    This file is part of GNU CVS.
00005
00006    GNU CVS is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published by the
00008    Free Software Foundation; either version 2, or (at your option) any
00009    later version.
00010
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.  */
00015
00016 /* These functions were moved out of subr.c because they need different
00017    definitions under operating systems (like, say, Windows NT) with different
00018    file system semantics.  */
00019
00020 #include "cvs.h"
00021
00022 static int deep_remove_dir PROTO((const char *path));
00023
00024 /*
00025  * Copies "from" to "to".
00026  */
00027 void
00028 copy_file (from, to)
00029     const char *from;
00030     const char *to;
00031 {
00032     struct stat sb;
00033     struct utimbuf t;
00034     int fdin, fdout;
00035
00036     if (trace)
00037     (void) fprintf (stderr, "%s-> copy(%s,%s)\n",
00038             CLIENT_SERVER_STR, from, to);
00039     if (noexec)
00040     return;
00041
00042     /* If the file to be copied is a link or a device, then just create
00043        the new link or device appropriately. */
00044     if (islink (from))
00045     {
00046     char *source = xreadlink (from);
00047     symlink (source, to);
00048     free (source);
00049     return;
00050     }
00051
00052     if (isdevice (from))
00053     {
00054 #if defined(HAVE_MKNOD) && defined(HAVE_ST_RDEV)
00055     if (stat (from, &sb) < 0)
00056         error (1, errno, "cannot stat %s", from);
00057     mknod (to, sb.st_mode, sb.st_rdev);
00058 #else
00059     error (1, 0, "cannot copy device files on this system (%s)", from);
00060 #endif
00061     }
00062     else
00063     {
00064     /* Not a link or a device... probably a regular file. */
00065     if ((fdin = open (from, O_RDONLY)) < 0)
00066         error (1, errno, "cannot open %s for copying", from);
00067     if (fstat (fdin, &sb) < 0)
00068         error (1, errno, "cannot fstat %s", from);
00069     if ((fdout = creat (to, (int) sb.st_mode & 07777)) < 0)
00070         error (1, errno, "cannot create %s for copying", to);
00071     if (sb.st_size > 0)
00072     {
00073         char buf[BUFSIZ];
00074         int n;
00075
00076         for (;;)
00077         {
00078         n = read (fdin, buf, sizeof(buf));
00079         if (n == -1)
00080         {
00081 #ifdef EINTR
00082             if (errno == EINTR)
00083             continue;
00084 #endif
00085             error (1, errno, "cannot read file %s for copying", from);
00086         }
00087         else if (n == 0)
00088             break;
00089
00090         if (write(fdout, buf, n) != n) {
00091             error (1, errno, "cannot write file %s for copying", to);
00092         }
00093         }
00094
00095 #ifdef HAVE_FSYNC
00096         if (fsync (fdout))
00097         error (1, errno, "cannot fsync file %s after copying", to);
00098 #endif
00099     }
00100
00101     if (close (fdin) < 0)
00102         error (0, errno, "cannot close %s", from);
00103     if (close (fdout) < 0)
00104         error (1, errno, "cannot close %s", to);
00105     }
00106
00107     /* now, set the times for the copied file to match those of the original */
00108     memset ((char *) &t, 0, sizeof (t));
00109     t.actime = sb.st_atime;
00110     t.modtime = sb.st_mtime;
00111     (void) utime (to, &t);
00112 }
00113
00114 /* FIXME-krp: these functions would benefit from caching the char * &
00115    stat buf.  */
00116
00117 /*
00118  * Returns non-zero if the argument file is a directory, or is a symbolic
00119  * link which points to a directory.
00120  */
00121 int
00122 isdir (file)
00123     const char *file;
00124 {
00125     struct stat sb;
00126
00127     if (stat (file, &sb) < 0)
00128     return (0);
00129     return (S_ISDIR (sb.st_mode));
00130 }
00131
00132 /*
00133  * Returns non-zero if the argument file is a symbolic link.
00134  */
00135 int
00136 islink (file)
00137     const char *file;
00138 {
00139 #ifdef S_ISLNK
00140     struct stat sb;
00141
00142     if (CVS_LSTAT (file, &sb) < 0)
00143     return (0);
00144     return (S_ISLNK (sb.st_mode));
00145 #else
00146     return (0);
00147 #endif
00148 }
00149
00150 /*
00151  * Returns non-zero if the argument file is a block or
00152  * character special device.
00153  */
00154 int
00155 isdevice (file)
00156     const char *file;
00157 {
00158     struct stat sb;
00159
00160     if (CVS_LSTAT (file, &sb) < 0)
00161     return (0);
00162 #ifdef S_ISBLK
00163     if (S_ISBLK (sb.st_mode))
00164     return 1;
00165 #endif
00166 #ifdef S_ISCHR
00167     if (S_ISCHR (sb.st_mode))
00168     return 1;
00169 #endif
00170     return 0;
00171 }
00172
00173 /*
00174  * Returns non-zero if the argument file exists.
00175  */
00176 int
00177 isfile (file)
00178     const char *file;
00179 {
00180     return isaccessible(file, F_OK);
00181 }
00182
00183 /*
00184  * Returns non-zero if the argument file is readable.
00185  */
00186 int
00187 isreadable (file)
00188     const char *file;
00189 {
00190     return isaccessible(file, R_OK);
00191 }
00192
00193 /*
00194  * Returns non-zero if the argument file is writable.
00195  */
00196 int
00197 iswritable (file)
00198     const char *file;
00199 {
00200     return isaccessible(file, W_OK);
00201 }
00202
00203 /*
00204  * Returns non-zero if the argument file is accessable according to
00205  * mode.  If compiled with SETXID_SUPPORT also works if cvs has setxid
00206  * bits set.
00207  */
00208 int
00209 isaccessible (file, mode)
00210     const char *file;
00211     const int mode;
00212 {
00213 #ifdef SETXID_SUPPORT
00214     struct stat sb;
00215     int umask = 0;
00216     int gmask = 0;
00217     int omask = 0;
00218     int uid;
00219
00220     if (stat(file, &sb) == -1)
00221     return 0;
00222     if (mode == F_OK)
00223     return 1;
00224
00225     uid = geteuid();
00226     if (uid == 0)       /* superuser */
00227     {
00228     if (mode & X_OK)
00229         return sb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH);
00230     else
00231         return 1;
00232     }
00233
00234     if (mode & R_OK)
00235     {
00236     umask |= S_IRUSR;
00237     gmask |= S_IRGRP;
00238     omask |= S_IROTH;
00239     }
00240     if (mode & W_OK)
00241     {
00242     umask |= S_IWUSR;
00243     gmask |= S_IWGRP;
00244     omask |= S_IWOTH;
00245     }
00246     if (mode & X_OK)
00247     {
00248     umask |= S_IXUSR;
00249     gmask |= S_IXGRP;
00250     omask |= S_IXOTH;
00251     }
00252
00253     if (sb.st_uid == uid)
00254     return (sb.st_mode & umask) == umask;
00255     else if (sb.st_gid == getegid())
00256     return (sb.st_mode & gmask) == gmask;
00257     else
00258     return (sb.st_mode & omask) == omask;
00259 #else
00260     return access(file, mode) == 0;
00261 #endif
00262 }
00263
00264 /*
00265  * Open a file and die if it fails
00266  */
00267 FILE *
00268 open_file (name, mode)
00269     const char *name;
00270     const char *mode;
00271 {
00272     FILE *fp;
00273
00274     if ((fp = fopen (name, mode)) == NULL)
00275     error (1, errno, "cannot open %s", name);
00276     return (fp);
00277 }
00278
00279 /*
00280  * Make a directory and die if it fails
00281  */
00282 void
00283 make_directory (name)
00284     const char *name;
00285 {
00286     struct stat sb;
00287
00288     if (stat (name, &sb) == 0 && (!S_ISDIR (sb.st_mode)))
00289         error (0, 0, "%s already exists but is not a directory", name);
00290     if (!noexec && mkdir (name, 0777) < 0)
00291     error (1, errno, "cannot make directory %s", name);
00292 }
00293
00294 /*
00295  * Make a path to the argument directory, printing a message if something
00296  * goes wrong.
00297  */
00298 void
00299 make_directories (name)
00300     const char *name;
00301 {
00302     char *cp;
00303
00304     if (noexec)
00305     return;
00306
00307     if (mkdir (name, 0777) == 0 || errno == EEXIST)
00308     return;
00309     if (! existence_error (errno))
00310     {
00311     error (0, errno, "cannot make path to %s", name);
00312     return;
00313     }
00314     if ((cp = strrchr (name, '/')) == NULL)
00315     return;
00316     *cp = '\0';
00317     make_directories (name);
00318     *cp++ = '/';
00319     if (*cp == '\0')
00320     return;
00321     (void) mkdir (name, 0777);
00322 }
00323
00324 /* Create directory NAME if it does not already exist; fatal error for
00325    other errors.  Returns 0 if directory was created; 1 if it already
00326    existed.  */
00327 int
00328 mkdir_if_needed (name)
00329     char *name;
00330 {
00331     if (mkdir (name, 0777) < 0)
00332     {
00333     if (!(errno == EEXIST
00334           || (errno == EACCES && isdir (name))))
00335         error (1, errno, "cannot make directory %s", name);
00336     return 1;
00337     }
00338     return 0;
00339 }
00340
00341 /*
00342  * Change the mode of a file, either adding write permissions, or removing
00343  * all write permissions.  Either change honors the current umask setting.
00344  *
00345  * Don't do anything if PreservePermissions is set to `yes'.  This may
00346  * have unexpected consequences for some uses of xchmod.
00347  */
00348 void
00349 xchmod (fname, writable)
00350     char *fname;
00351     int writable;
00352 {
00353     struct stat sb;
00354     mode_t mode, oumask;
00355
00356     if (preserve_perms)
00357     return;
00358
00359     if (stat (fname, &sb) < 0)
00360     {
00361     if (!noexec)
00362         error (0, errno, "cannot stat %s", fname);
00363     return;
00364     }
00365     oumask = umask (0);
00366     (void) umask (oumask);
00367     if (writable)
00368     {
00369     mode = sb.st_mode | (~oumask
00370                  & (((sb.st_mode & S_IRUSR) ? S_IWUSR : 0)
00371                 | ((sb.st_mode & S_IRGRP) ? S_IWGRP : 0)
00372                 | ((sb.st_mode & S_IROTH) ? S_IWOTH : 0)));
00373     }
00374     else
00375     {
00376     mode = sb.st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH) & ~oumask;
00377     }
00378
00379     if (trace)
00380     (void) fprintf (stderr, "%s-> chmod(%s,%o)\n",
00381             CLIENT_SERVER_STR, fname,
00382             (unsigned int) mode);
00383     if (noexec)
00384     return;
00385
00386     if (chmod (fname, mode) < 0)
00387     error (0, errno, "cannot change mode of file %s", fname);
00388 }
00389
00390 /*
00391  * Rename a file and die if it fails
00392  */
00393 void
00394 rename_file (from, to)
00395     const char *from;
00396     const char *to;
00397 {
00398     if (trace)
00399     (void) fprintf (stderr, "%s-> rename(%s,%s)\n",
00400             CLIENT_SERVER_STR, from, to);
00401     if (noexec)
00402     return;
00403
00404     if (rename (from, to) < 0)
00405     error (1, errno, "cannot rename file %s to %s", from, to);
00406 }
00407
00408 /*
00409  * unlink a file, if possible.
00410  */
00411 int
00412 unlink_file (f)
00413     const char *f;
00414 {
00415     if (trace)
00416     (void) fprintf (stderr, "%s-> unlink(%s)\n",
00417             CLIENT_SERVER_STR, f);
00418     if (noexec)
00419     return (0);
00420
00421     return (unlink (f));
00422 }
00423
00424 /*
00425  * Unlink a file or dir, if possible.  If it is a directory do a deep
00426  * removal of all of the files in the directory.  Return -1 on error
00427  * (in which case errno is set).
00428  */
00429 int
00430 unlink_file_dir (f)
00431     const char *f;
00432 {
00433     struct stat sb;
00434
00435     if (trace
00436 #ifdef SERVER_SUPPORT
00437     /* This is called by the server parent process in contexts where
00438        it is not OK to send output (e.g. after we sent "ok" to the
00439        client).  */
00440     && !server_active
00441 #endif
00442     )
00443     (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f);
00444
00445     if (noexec)
00446     return (0);
00447
00448     /* For at least some unices, if root tries to unlink() a directory,
00449        instead of doing something rational like returning EISDIR,
00450        the system will gleefully go ahead and corrupt the filesystem.
00451        So we first call stat() to see if it is OK to call unlink().  This
00452        doesn't quite work--if someone creates a directory between the
00453        call to stat() and the call to unlink(), we'll still corrupt
00454        the filesystem.  Where is the Unix Haters Handbook when you need
00455        it?  */
00456     if (stat (f, &sb) < 0)
00457     {
00458     if (existence_error (errno))
00459     {
00460         /* The file or directory doesn't exist anyhow.  */
00461         return -1;
00462     }
00463     }
00464     else if (S_ISDIR (sb.st_mode))
00465     return deep_remove_dir (f);
00466
00467     return unlink (f);
00468 }
00469
00470 /* Remove a directory and everything it contains.  Returns 0 for
00471  * success, -1 for failure (in which case errno is set).
00472  */
00473
00474 static int
00475 deep_remove_dir (path)
00476     const char *path;
00477 {
00478     DIR       *dirp;
00479     struct dirent *dp;
00480
00481     if (rmdir (path) != 0)
00482     {
00483     if (errno == ENOTEMPTY
00484         || errno == EEXIST
00485         /* Ugly workaround for ugly AIX 4.1 (and 3.2) header bug
00486            (it defines ENOTEMPTY and EEXIST to 17 but actually
00487            returns 87).  */
00488         || (ENOTEMPTY == 17 && EEXIST == 17 && errno == 87))
00489     {
00490         if ((dirp = opendir (path)) == NULL)
00491         /* If unable to open the directory return
00492          * an error
00493          */
00494         return -1;
00495
00496         errno = 0;
00497         while ((dp = readdir (dirp)) != NULL)
00498         {
00499         char *buf;
00500
00501         if (strcmp (dp->d_name, ".") == 0 ||
00502                 strcmp (dp->d_name, "..") == 0)
00503             continue;
00504
00505         buf = xmalloc (strlen (path) + strlen (dp->d_name) + 5);
00506         sprintf (buf, "%s/%s", path, dp->d_name);
00507
00508         /* See comment in unlink_file_dir explanation of why we use
00509            isdir instead of just calling unlink and checking the
00510            status.  */
00511         if (isdir(buf))
00512         {
00513             if (deep_remove_dir(buf))
00514             {
00515             closedir(dirp);
00516             free (buf);
00517             return -1;
00518             }
00519         }
00520         else
00521         {
00522             if (unlink (buf) != 0)
00523             {
00524             closedir(dirp);
00525             free (buf);
00526             return -1;
00527             }
00528         }
00529         free (buf);
00530
00531         errno = 0;
00532         }
00533         if (errno != 0)
00534         {
00535         int save_errno = errno;
00536         closedir (dirp);
00537         errno = save_errno;
00538         return -1;
00539         }
00540         closedir (dirp);
00541         return rmdir (path);
00542     }
00543     else
00544         return -1;
00545     }
00546
00547     /* Was able to remove the directory return 0 */
00548     return 0;
00549 }
00550
00551 /* Read NCHARS bytes from descriptor FD into BUF.
00552    Return the number of characters successfully read.
00553    The number returned is always NCHARS unless end-of-file or error.  */
00554 static size_t
00555 block_read (fd, buf, nchars)
00556     int fd;
00557     char *buf;
00558     size_t nchars;
00559 {
00560     char *bp = buf;
00561     size_t nread;
00562
00563     do
00564     {
00565     nread = read (fd, bp, nchars);
00566     if (nread == (size_t)-1)
00567     {
00568 #ifdef EINTR
00569         if (errno == EINTR)
00570         continue;
00571 #endif
00572         return (size_t)-1;
00573     }
00574
00575     if (nread == 0)
00576         break;
00577
00578     bp += nread;
00579     nchars -= nread;
00580     } while (nchars != 0);
00581
00582     return bp - buf;
00583 }
00584
00585
00586 /*
00587  * Compare "file1" to "file2". Return non-zero if they don't compare exactly.
00588  * If FILE1 and FILE2 are special files, compare their salient characteristics
00589  * (i.e. major/minor device numbers, links, etc.
00590  */
00591 int
00592 xcmp (file1, file2)
00593     const char *file1;
00594     const char *file2;
00595 {
00596     char *buf1, *buf2;
00597     struct stat sb1, sb2;
00598     int fd1, fd2;
00599     int ret;
00600
00601     if (CVS_LSTAT (file1, &sb1) < 0)
00602     error (1, errno, "cannot lstat %s", file1);
00603     if (CVS_LSTAT (file2, &sb2) < 0)
00604     error (1, errno, "cannot lstat %s", file2);
00605
00606     /* If FILE1 and FILE2 are not the same file type, they are unequal. */
00607     if ((sb1.st_mode & S_IFMT) != (sb2.st_mode & S_IFMT))
00608     return 1;
00609
00610     /* If FILE1 and FILE2 are symlinks, they are equal if they point to
00611        the same thing. */
00612     if (S_ISLNK (sb1.st_mode) && S_ISLNK (sb2.st_mode))
00613     {
00614     int result;
00615     buf1 = xreadlink (file1);
00616     buf2 = xreadlink (file2);
00617     result = (strcmp (buf1, buf2) == 0);
00618     free (buf1);
00619     free (buf2);
00620     return result;
00621     }
00622
00623     /* If FILE1 and FILE2 are devices, they are equal if their device
00624        numbers match. */
00625     if (S_ISBLK (sb1.st_mode) || S_ISCHR (sb1.st_mode))
00626     {
00627 #ifdef HAVE_ST_RDEV
00628     if (sb1.st_rdev == sb2.st_rdev)
00629         return 0;
00630     else
00631         return 1;
00632 #else
00633     error (1, 0, "cannot compare device files on this system (%s and %s)",
00634            file1, file2);
00635 #endif
00636     }
00637
00638     if ((fd1 = open (file1, O_RDONLY)) < 0)
00639     error (1, errno, "cannot open file %s for comparing", file1);
00640     if ((fd2 = open (file2, O_RDONLY)) < 0)
00641     error (1, errno, "cannot open file %s for comparing", file2);
00642
00643     /* A generic file compare routine might compare st_dev & st_ino here
00644        to see if the two files being compared are actually the same file.
00645        But that won't happen in CVS, so we won't bother. */
00646
00647     if (sb1.st_size != sb2.st_size)
00648     ret = 1;
00649     else if (sb1.st_size == 0)
00650     ret = 0;
00651     else
00652     {
00653     /* FIXME: compute the optimal buffer size by computing the least
00654        common multiple of the files st_blocks field */
00655     size_t buf_size = 8 * 1024;
00656     size_t read1;
00657     size_t read2;
00658
00659     buf1 = xmalloc (buf_size);
00660     buf2 = xmalloc (buf_size);
00661
00662     do
00663     {
00664         read1 = block_read (fd1, buf1, buf_size);
00665         if (read1 == (size_t)-1)
00666         error (1, errno, "cannot read file %s for comparing", file1);
00667
00668         read2 = block_read (fd2, buf2, buf_size);
00669         if (read2 == (size_t)-1)
00670         error (1, errno, "cannot read file %s for comparing", file2);
00671
00672         /* assert (read1 == read2); */
00673
00674         ret = memcmp(buf1, buf2, read1);
00675     } while (ret == 0 && read1 == buf_size);
00676
00677     free (buf1);
00678     free (buf2);
00679     }
00680
00681     (void) close (fd1);
00682     (void) close (fd2);
00683     return (ret);
00684 }
00685
00686 /* Generate a unique temporary filename.  Returns a pointer to a newly
00687    malloc'd string containing the name.  Returns successfully or not at
00688    all.  */
00689 /* There are at least three functions for generating temporary
00690    filenames.  We use tempnam (SVID 3) if possible, else mktemp (BSD
00691    4.3), and as last resort tmpnam (POSIX). Reason is that tempnam and
00692    mktemp both allow to specify the directory in which the temporary
00693    file will be created.  */
00694 #ifdef HAVE_TEMPNAM
00695 char *
00696 cvs_temp_name ()
00697 {
00698     char *retval;
00699
00700     retval = tempnam (Tmpdir, "cvs");
00701     if (retval == NULL)
00702     error (1, errno, "cannot generate temporary filename");
00703     /* tempnam returns a pointer to a newly malloc'd string, so there's
00704        no need for a xstrdup  */
00705     return retval;
00706 }
00707 #else
00708 char *
00709 cvs_temp_name ()
00710 {
00711 #  ifdef HAVE_MKTEMP
00712     char *value;
00713     char *retval;
00714
00715     value = xmalloc (strlen (Tmpdir) + 40);
00716     sprintf (value, "%s/%s", Tmpdir, "cvsXXXXXX" );
00717     retval = mktemp (value);
00718
00719     if (retval == NULL)
00720     error (1, errno, "cannot generate temporary filename");
00721     return value;
00722 #  else
00723     char value[L_tmpnam + 1];
00724     char *retval;
00725
00726     retval = tmpnam (value);
00727     if (retval == NULL)
00728     error (1, errno, "cannot generate temporary filename");
00729     return xstrdup (value);
00730 #  endif
00731 }
00732 #endif
00733
00734 /* Return non-zero iff FILENAME is absolute.
00735    Trivial under Unix, but more complicated under other systems.  */
00736 int
00737 isabsolute (filename)
00738     const char *filename;
00739 {
00740     return filename[0] == '/';
00741 }
00742
00743 /*
00744  * Return a string (dynamically allocated) with the name of the file to which
00745  * LINK is symlinked.
00746  */
00747 char *
00748 xreadlink (link)
00749     const char *link;
00750 {
00751     char *file = NULL;
00752     char *tfile;
00753     int buflen = 128;
00754     int link_name_len;
00755
00756     if (!islink (link))
00757     return NULL;
00758
00759     /* Get the name of the file to which `from' is linked.
00760        FIXME: what portability issues arise here?  Are readlink &
00761        ENAMETOOLONG defined on all systems? -twp */
00762     do
00763     {
00764     file = xrealloc (file, buflen);
00765     link_name_len = readlink (link, file, buflen - 1);
00766     buflen *= 2;
00767     }
00768     while (link_name_len < 0 && errno == ENAMETOOLONG);
00769
00770     if (link_name_len < 0)
00771     error (1, errno, "cannot readlink %s", link);
00772
00773     file[link_name_len] = '\0';
00774
00775     tfile = xstrdup (file);
00776     free (file);
00777
00778     return tfile;
00779 }
00780
00781
00782 /* Return a pointer into PATH's last component.  */
00783 char *
00784 last_component (path)
00785     char *path;
00786 {
00787     char *last = strrchr (path, '/');
00788
00789     if (last && (last != path))
00790         return last + 1;
00791     else
00792         return path;
00793 }
00794
00795 /* Return the home directory.  Returns a pointer to storage
00796    managed by this function or its callees (currently getenv).
00797    This function will return the same thing every time it is
00798    called.  Returns NULL if there is no home directory.
00799
00800    Note that for a pserver server, this may return root's home
00801    directory.  What typically happens is that upon being started from
00802    inetd, before switching users, the code in cvsrc.c calls
00803    get_homedir which remembers root's home directory in the static
00804    variable.  Then the switch happens and get_homedir might return a
00805    directory that we don't even have read or execute permissions for
00806    (which is bad, when various parts of CVS try to read there).  One
00807    fix would be to make the value returned by get_homedir only good
00808    until the next call (which would free the old value).  Another fix
00809    would be to just always malloc our answer, and let the caller free
00810    it (that is best, because some day we may need to be reentrant).
00811
00812    The workaround is to put -f in inetd.conf which means that
00813    get_homedir won't get called until after the switch in user ID.
00814
00815    The whole concept of a "home directory" on the server is pretty
00816    iffy, although I suppose some people probably are relying on it for
00817    .cvsrc and such, in the cases where it works.  */
00818 char *
00819 get_homedir ()
00820 {
00821     static char *home = NULL;
00822     char *env = getenv ("HOME");
00823     struct passwd *pw;
00824
00825     if (home != NULL)
00826     return home;
00827
00828     if (env)
00829     home = env;
00830     else if ((pw = (struct passwd *) getpwuid (getuid ()))
00831          && pw->pw_dir)
00832     home = xstrdup (pw->pw_dir);
00833     else
00834     return 0;
00835
00836     return home;
00837 }
00838
00839 /* See cvs.h for description.  On unix this does nothing, because the
00840    shell expands the wildcards.  */
00841 void
00842 expand_wild (argc, argv, pargc, pargv)
00843     int argc;
00844     char **argv;
00845     int *pargc;
00846     char ***pargv;
00847 {
00848     int i;
00849     *pargc = argc;
00850     *pargv = (char **) xmalloc (argc * sizeof (char *));
00851     for (i = 0; i < argc; ++i)
00852     (*pargv)[i] = xstrdup (argv[i]);
00853 }
00854
00855 #ifdef SERVER_SUPPORT
00856 /* Case-insensitive string compare.  I know that some systems
00857    have such a routine, but I'm not sure I see any reasons for
00858    dealing with the hair of figuring out whether they do (I haven't
00859    looked into whether this is a performance bottleneck; I would guess
00860    not).  */
00861 int
00862 cvs_casecmp (str1, str2)
00863     char *str1;
00864     char *str2;
00865 {
00866     char *p;
00867     char *q;
00868     int pqdiff;
00869
00870     p = str1;
00871     q = str2;
00872     while ((pqdiff = tolower (*p) - tolower (*q)) == 0)
00873     {
00874     if (*p == '\0')
00875         return 0;
00876     ++p;
00877     ++q;
00878     }
00879     return pqdiff;
00880 }
00881
00882 /* Case-insensitive file open.  As you can see, this is an expensive
00883    call.  We don't regard it as our main strategy for dealing with
00884    case-insensitivity.  Returns errno code or 0 for success.  Puts the
00885    new file in *FP.  NAME and MODE are as for fopen.  If PATHP is not
00886    NULL, then put a malloc'd string containing the pathname as found
00887    into *PATHP.  *PATHP is only set if the return value is 0.
00888
00889    Might be cleaner to separate the file finding (which just gives
00890    *PATHP) from the file opening (which the caller can do).  For one
00891    thing, might make it easier to know whether to put NAME or *PATHP
00892    into error messages.  */
00893 int
00894 fopen_case (name, mode, fp, pathp)
00895     char *name;
00896     char *mode;
00897     FILE **fp;
00898     char **pathp;
00899 {
00900     struct dirent *dp;
00901     DIR *dirp;
00902     char *dir;
00903     char *fname;
00904     char *found_name;
00905     int retval;
00906
00907     /* Separate NAME into directory DIR and filename within the directory
00908        FNAME.  */
00909     dir = xstrdup (name);
00910     fname = strrchr (dir, '/');
00911     if (fname == NULL)
00912     error (1, 0, "internal error: relative pathname in fopen_case");
00913     *fname++ = '\0';
00914
00915     found_name = NULL;
00916     dirp = CVS_OPENDIR (dir);
00917     if (dirp == NULL)
00918     {
00919     if (existence_error (errno))
00920     {
00921         /* This can happen if we are looking in the Attic and the Attic
00922            directory does not exist.  Return the error to the caller;
00923            they know what to do with it.  */
00924         retval = errno;
00925         goto out;
00926     }
00927     else
00928     {
00929         /* Give a fatal error; that way the error message can be
00930            more specific than if we returned the error to the caller.  */
00931         error (1, errno, "cannot read directory %s", dir);
00932     }
00933     }
00934     errno = 0;
00935     while ((dp = readdir (dirp)) != NULL)
00936     {
00937     if (cvs_casecmp (dp->d_name, fname) == 0)
00938     {
00939         if (found_name != NULL)
00940         error (1, 0, "%s is ambiguous; could mean %s or %s",
00941                fname, dp->d_name, found_name);
00942         found_name = xstrdup (dp->d_name);
00943     }
00944     }
00945     if (errno != 0)
00946     error (1, errno, "cannot read directory %s", dir);
00947     closedir (dirp);
00948
00949     if (found_name == NULL)
00950     {
00951     *fp = NULL;
00952     retval = ENOENT;
00953     }
00954     else
00955     {
00956     char *p;
00957
00958     /* Copy the found name back into DIR.  We are assuming that
00959        found_name is the same length as fname, which is true as
00960        long as the above code is just ignoring case and not other
00961        aspects of filename syntax.  */
00962     p = dir + strlen (dir);
00963     *p++ = '/';
00964     strcpy (p, found_name);
00965     *fp = fopen (dir, mode);
00966     if (*fp == NULL)
00967         retval = errno;
00968     else
00969         retval = 0;
00970     }
00971
00972     if (pathp == NULL)
00973     free (dir);
00974     else if (retval != 0)
00975     free (dir);
00976     else
00977     *pathp = dir;
00978     free (found_name);
00979  out:
00980     return retval;
00981 }
00982 #endif /* SERVER_SUPPORT */
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/find_names.c Source File

cvs-1.10/src/find_names.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Find Names
00009  *
00010  * Finds all the pertinent file names, both from the administration and from the
00011  * repository
00012  *
00013  * Find Dirs
00014  *
00015  * Finds all pertinent sub-directories of the checked out instantiation and the
00016  * repository (and optionally the attic)
00017  */
00018
00019 #include "cvs.h"
00020
00021 static int find_dirs PROTO((char *dir, List * list, int checkadm,
00022                 List *entries));
00023 static int find_rcs PROTO((char *dir, List * list));
00024 static int add_subdir_proc PROTO((Node *, void *));
00025 static int register_subdir_proc PROTO((Node *, void *));
00026
00027 static List *filelist;
00028
00029 /*
00030  * add the key from entry on entries list to the files list
00031  */
00032 static int add_entries_proc PROTO((Node *, void *));
00033 static int
00034 add_entries_proc (node, closure)
00035      Node *node;
00036      void *closure;
00037 {
00038     Entnode *entnode;
00039     Node *fnode;
00040
00041     entnode = (Entnode *) node->data;
00042     if (entnode->type != ENT_FILE)
00043     return (0);
00044
00045     fnode = getnode ();
00046     fnode->type = FILES;
00047     fnode->key = xstrdup (node->key);
00048     if (addnode (filelist, fnode) != 0)
00049     freenode (fnode);
00050     return (0);
00051 }
00052
00053 /* Find files in the repository and/or working directory.  On error,
00054    may either print a nonfatal error and return NULL, or just give
00055    a fatal error.  On success, return non-NULL (even if it is an empty
00056    list).  */
00057
00058 List *
00059 Find_Names (repository, which, aflag, optentries)
00060     char *repository;
00061     int which;
00062     int aflag;
00063     List **optentries;
00064 {
00065     List *entries;
00066     List *files;
00067
00068     /* make a list for the files */
00069     files = filelist = getlist ();
00070
00071     /* look at entries (if necessary) */
00072     if (which & W_LOCAL)
00073     {
00074     /* parse the entries file (if it exists) */
00075     entries = Entries_Open (aflag, NULL);
00076     if (entries != NULL)
00077     {
00078         /* walk the entries file adding elements to the files list */
00079         (void) walklist (entries, add_entries_proc, NULL);
00080
00081         /* if our caller wanted the entries list, return it; else free it */
00082         if (optentries != NULL)
00083         *optentries = entries;
00084         else
00085         Entries_Close (entries);
00086     }
00087     }
00088
00089     if ((which & W_REPOS) && repository && !isreadable (CVSADM_ENTSTAT))
00090     {
00091     /* search the repository */
00092     if (find_rcs (repository, files) != 0)
00093     {
00094         error (0, errno, "cannot open directory %s", repository);
00095         goto error_exit;
00096     }
00097
00098     /* search the attic too */
00099     if (which & W_ATTIC)
00100     {
00101         char *dir;
00102         dir = xmalloc (strlen (repository) + sizeof (CVSATTIC) + 10);
00103         (void) sprintf (dir, "%s/%s", repository, CVSATTIC);
00104         if (find_rcs (dir, files) != 0
00105         && !existence_error (errno))
00106         /* For now keep this a fatal error, seems less useful
00107            for access control than the case above.  */
00108         error (1, errno, "cannot open directory %s", dir);
00109         free (dir);
00110     }
00111     }
00112
00113     /* sort the list into alphabetical order and return it */
00114     sortlist (files, fsortcmp);
00115     return (files);
00116  error_exit:
00117     dellist (&files);
00118     return NULL;
00119 }
00120
00121 /*
00122  * Add an entry from the subdirs list to the directories list.  This
00123  * is called via walklist.
00124  */
00125
00126 static int
00127 add_subdir_proc (p, closure)
00128      Node *p;
00129      void *closure;
00130 {
00131     List *dirlist = (List *) closure;
00132     Entnode *entnode;
00133     Node *dnode;
00134
00135     entnode = (Entnode *) p->data;
00136     if (entnode->type != ENT_SUBDIR)
00137     return 0;
00138
00139     dnode = getnode ();
00140     dnode->type = DIRS;
00141     dnode->key = xstrdup (entnode->user);
00142     if (addnode (dirlist, dnode) != 0)
00143     freenode (dnode);
00144     return 0;
00145 }
00146
00147 /*
00148  * Register a subdirectory.  This is called via walklist.
00149  */
00150
00151 /*ARGSUSED*/
00152 static int
00153 register_subdir_proc (p, closure)
00154      Node *p;
00155      void *closure;
00156 {
00157     List *entries = (List *) closure;
00158
00159     Subdir_Register (entries, (char *) NULL, p->key);
00160     return 0;
00161 }
00162
00163 /*
00164  * create a list of directories to traverse from the current directory
00165  */
00166 List *
00167 Find_Directories (repository, which, entries)
00168     char *repository;
00169     int which;
00170     List *entries;
00171 {
00172     List *dirlist;
00173
00174     /* make a list for the directories */
00175     dirlist = getlist ();
00176
00177     /* find the local ones */
00178     if (which & W_LOCAL)
00179     {
00180     List *tmpentries;
00181     struct stickydirtag *sdtp;
00182
00183     /* Look through the Entries file.  */
00184
00185     if (entries != NULL)
00186         tmpentries = entries;
00187     else if (isfile (CVSADM_ENT))
00188         tmpentries = Entries_Open (0, NULL);
00189     else
00190         tmpentries = NULL;
00191
00192     if (tmpentries != NULL)
00193         sdtp = (struct stickydirtag *) tmpentries->list->data;
00194
00195     /* If we do have an entries list, then if sdtp is NULL, or if
00196            sdtp->subdirs is nonzero, all subdirectory information is
00197            recorded in the entries list.  */
00198     if (tmpentries != NULL && (sdtp == NULL || sdtp->subdirs))
00199         walklist (tmpentries, add_subdir_proc, (void *) dirlist);
00200     else
00201     {
00202         /* This is an old working directory, in which subdirectory
00203                information is not recorded in the Entries file.  Find
00204                the subdirectories the hard way, and, if possible, add
00205                it to the Entries file for next time.  */
00206
00207         /* FIXME-maybe: find_dirs is bogus for this usage because
00208            it skips CVSATTIC and CVSLCK directories--those names
00209            should be special only in the repository.  However, in
00210            the interests of not perturbing this code, we probably
00211            should leave well enough alone unless we want to write
00212            a sanity.sh test case (which would operate by manually
00213            hacking on the CVS/Entries file).  */
00214
00215         if (find_dirs (".", dirlist, 1, tmpentries) != 0)
00216         error (1, errno, "cannot open current directory");
00217         if (tmpentries != NULL)
00218         {
00219         if (! list_isempty (dirlist))
00220             walklist (dirlist, register_subdir_proc,
00221                   (void *) tmpentries);
00222         else
00223             Subdirs_Known (tmpentries);
00224         }
00225     }
00226
00227     if (entries == NULL && tmpentries != NULL)
00228         Entries_Close (tmpentries);
00229     }
00230
00231     /* look for sub-dirs in the repository */
00232     if ((which & W_REPOS) && repository)
00233     {
00234     /* search the repository */
00235     if (find_dirs (repository, dirlist, 0, entries) != 0)
00236         error (1, errno, "cannot open directory %s", repository);
00237
00238     /* We don't need to look in the attic because directories
00239        never go in the attic.  In the future, there hopefully will
00240        be a better mechanism for detecting whether a directory in
00241        the repository is alive or dead; it may or may not involve
00242        moving directories to the attic.  */
00243     }
00244
00245     /* sort the list into alphabetical order and return it */
00246     sortlist (dirlist, fsortcmp);
00247     return (dirlist);
00248 }
00249
00250 /*
00251  * Finds all the ,v files in the argument directory, and adds them to the
00252  * files list.  Returns 0 for success and non-zero if the argument directory
00253  * cannot be opened, in which case errno is set to indicate the error.
00254  * In the error case LIST is left in some reasonable state (unchanged, or
00255  * containing the files which were found before the error occurred).
00256  */
00257 static int
00258 find_rcs (dir, list)
00259     char *dir;
00260     List *list;
00261 {
00262     Node *p;
00263     struct dirent *dp;
00264     DIR *dirp;
00265
00266     /* set up to read the dir */
00267     if ((dirp = CVS_OPENDIR (dir)) == NULL)
00268     return (1);
00269
00270     /* read the dir, grabbing the ,v files */
00271     errno = 0;
00272     while ((dp = readdir (dirp)) != NULL)
00273     {
00274     if (CVS_FNMATCH (RCSPAT, dp->d_name, 0) == 0)
00275     {
00276         char *comma;
00277
00278         comma = strrchr (dp->d_name, ',');  /* strip the ,v */
00279         *comma = '\0';
00280         p = getnode ();
00281         p->type = FILES;
00282         p->key = xstrdup (dp->d_name);
00283         if (addnode (list, p) != 0)
00284         freenode (p);
00285     }
00286     errno = 0;
00287     }
00288     if (errno != 0)
00289     {
00290     int save_errno = errno;
00291     (void) closedir (dirp);
00292     errno = save_errno;
00293     return 1;
00294     }
00295     (void) closedir (dirp);
00296     return (0);
00297 }
00298
00299 /*
00300  * Finds all the subdirectories of the argument dir and adds them to
00301  * the specified list.  Sub-directories without a CVS administration
00302  * directory are optionally ignored.  If ENTRIES is not NULL, all
00303  * files on the list are ignored.  Returns 0 for success or 1 on
00304  * error, in which case errno is set to indicate the error.
00305  */
00306 static int
00307 find_dirs (dir, list, checkadm, entries)
00308     char *dir;
00309     List *list;
00310     int checkadm;
00311     List *entries;
00312 {
00313     Node *p;
00314     char *tmp = NULL;
00315     size_t tmp_size = 0;
00316     struct dirent *dp;
00317     DIR *dirp;
00318     int skip_emptydir = 0;
00319
00320     /* First figure out whether we need to skip directories named
00321        Emptydir.  Except in the CVSNULLREPOS case, Emptydir is just
00322        a normal directory name.  */
00323     if (isabsolute (dir)
00324     && strncmp (dir, CVSroot_directory, strlen (CVSroot_directory)) == 0
00325     && ISDIRSEP (dir[strlen (CVSroot_directory)])
00326     && strcmp (dir + strlen (CVSroot_directory) + 1, CVSROOTADM) == 0)
00327     skip_emptydir = 1;
00328
00329     /* set up to read the dir */
00330     if ((dirp = CVS_OPENDIR (dir)) == NULL)
00331     return (1);
00332
00333     /* read the dir, grabbing sub-dirs */
00334     errno = 0;
00335     while ((dp = readdir (dirp)) != NULL)
00336     {
00337     if (strcmp (dp->d_name, ".") == 0 ||
00338         strcmp (dp->d_name, "..") == 0 ||
00339         strcmp (dp->d_name, CVSATTIC) == 0 ||
00340         strcmp (dp->d_name, CVSLCK) == 0 ||
00341         strcmp (dp->d_name, CVSREP) == 0)
00342         goto do_it_again;
00343
00344     /* findnode() is going to be significantly faster than stat()
00345        because it involves no system calls.  That is why we bother
00346        with the entries argument, and why we check this first.  */
00347     if (entries != NULL && findnode (entries, dp->d_name) != NULL)
00348         goto do_it_again;
00349
00350     if (skip_emptydir
00351         && strcmp (dp->d_name, CVSNULLREPOS) == 0)
00352         goto do_it_again;
00353
00354 #ifdef DT_DIR
00355     if (dp->d_type != DT_DIR)
00356     {
00357         if (dp->d_type != DT_UNKNOWN && dp->d_type != DT_LNK)
00358         goto do_it_again;
00359 #endif
00360         /* don't bother stating ,v files */
00361         if (CVS_FNMATCH (RCSPAT, dp->d_name, 0) == 0)
00362         goto do_it_again;
00363
00364         expand_string (&tmp,
00365                &tmp_size,
00366                strlen (dir) + strlen (dp->d_name) + 10);
00367         sprintf (tmp, "%s/%s", dir, dp->d_name);
00368         if (!isdir (tmp))
00369         goto do_it_again;
00370
00371 #ifdef DT_DIR
00372     }
00373 #endif
00374
00375     /* check for administration directories (if needed) */
00376     if (checkadm)
00377     {
00378         /* blow off symbolic links to dirs in local dir */
00379 #ifdef DT_DIR
00380         if (dp->d_type != DT_DIR)
00381         {
00382         /* we're either unknown or a symlink at this point */
00383         if (dp->d_type == DT_LNK)
00384             goto do_it_again;
00385 #endif
00386         /* Note that we only get here if we already set tmp
00387            above.  */
00388         if (islink (tmp))
00389             goto do_it_again;
00390 #ifdef DT_DIR
00391         }
00392 #endif
00393
00394         /* check for new style */
00395         expand_string (&tmp,
00396                &tmp_size,
00397                (strlen (dir) + strlen (dp->d_name)
00398                 + sizeof (CVSADM) + 10));
00399         (void) sprintf (tmp, "%s/%s/%s", dir, dp->d_name, CVSADM);
00400         if (!isdir (tmp))
00401         goto do_it_again;
00402     }
00403
00404     /* put it in the list */
00405     p = getnode ();
00406     p->type = DIRS;
00407     p->key = xstrdup (dp->d_name);
00408     if (addnode (list, p) != 0)
00409         freenode (p);
00410
00411     do_it_again:
00412     errno = 0;
00413     }
00414     if (errno != 0)
00415     {
00416     int save_errno = errno;
00417     (void) closedir (dirp);
00418     errno = save_errno;
00419     return 1;
00420     }
00421     (void) closedir (dirp);
00422     if (tmp != NULL)
00423     free (tmp);
00424     return (0);
00425 }
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/hardlink.c Source File

cvs-1.10/src/hardlink.c

Go to the documentation of this file.
00001 /* This program is free software; you can redistribute it and/or modify
00002    it under the terms of the GNU General Public License as published by
00003    the Free Software Foundation; either version 2, or (at your option)
00004    any later version.
00005
00006    This program is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009    GNU General Public License for more details.  */
00010
00011 /* Collect and manage hardlink info associated with a particular file.  */
00012
00013 #include "cvs.h"
00014 #include "hardlink.h"
00015
00016 /* The structure currently used to manage hardlink info is a list.
00017    Therefore, most of the functions which manipulate hardlink data
00018    are walklist procedures.  This is not a very efficient implementation;
00019    if someone decides to use a real hash table (for instance), then
00020    much of this code can be rewritten to be a little less arcane.
00021
00022    Each element of `hardlist' represents an inode.  It is keyed on the
00023    inode number, and points to a list of files.  This is to make it
00024    easy to find out what files are linked to a given file FOO: find
00025    FOO's inode, look it up in hardlist, and retrieve the list of files
00026    associated with that inode.
00027
00028    Each file node, in turn, is represented by a `hardlink_info' struct,
00029    which includes `status' and `links' fields.  The `status' field should
00030    be used by a procedure like commit_fileproc or update_fileproc to
00031    record each file's status; that way, after all file links have been
00032    recorded, CVS can check the linkage of files which are in doubt
00033    (i.e. T_NEEDS_MERGE files).
00034
00035    TODO: a diagram of an example hardlist would help here. */
00036
00037 /* TODO: change this to something with a marginal degree of
00038    efficiency, like maybe a hash table.  Yeah. */
00039
00040 List *hardlist;     /* Record hardlink information for working files */
00041 char *working_dir;  /* The top-level working directory, used for
00042                constructing full pathnames. */
00043
00044 /* Return a pointer to FILEPATH's node in the hardlist.  This means
00045    looking up its inode, retrieving the list of files linked to that
00046    inode, and then looking up FILE in that list.  If the file doesn't
00047    seem to exist, return NULL. */
00048 Node *
00049 lookup_file_by_inode (filepath)
00050     const char *filepath;
00051 {
00052     char *inodestr, *file;
00053     struct stat sb;
00054     Node *hp, *p;
00055
00056     /* Get file's basename, so that we can stat it. */
00057     file = strrchr (filepath, '/');
00058     if (file)
00059     ++file;
00060     else
00061     file = (char *) filepath;
00062
00063     /* inodestr contains the hexadecimal representation of an
00064        inode, so it requires two bytes of text to represent
00065        each byte of the inode number. */
00066     inodestr = (char *) xmalloc (2*sizeof(ino_t) + 1);
00067     if (stat (file, &sb) < 0)
00068     {
00069     if (existence_error (errno))
00070     {
00071         /* The file doesn't exist; we may be doing an update on a
00072            file that's been removed.  A nonexistent file has no
00073            link information, so return without changing hardlist. */
00074         free (inodestr);
00075         return NULL;
00076     }
00077     error (1, errno, "cannot stat %s", file);
00078     }
00079
00080     sprintf (inodestr, "%lx", (unsigned long) sb.st_ino);
00081
00082     /* Find out if this inode is already in the hardlist, adding
00083        a new entry to the list if not. */
00084     hp = findnode (hardlist, inodestr);
00085     if (hp == NULL)
00086     {
00087     hp = getnode ();
00088     hp->type = NT_UNKNOWN;
00089     hp->key = inodestr;
00090     hp->data = (char *) getlist();
00091     hp->delproc = dellist;
00092     (void) addnode (hardlist, hp);
00093     }
00094     else
00095     {
00096     free (inodestr);
00097     }
00098
00099     p = findnode ((List *) hp->data, filepath);
00100     if (p == NULL)
00101     {
00102     p = getnode();
00103     p->type = NT_UNKNOWN;
00104     p->key = xstrdup (filepath);
00105     p->data = NULL;
00106     (void) addnode ((List *) hp->data, p);
00107     }
00108
00109     return p;
00110 }
00111
00112 /* After a file has been checked out, add a node for it to the hardlist
00113    (if necessary) and mark it as checked out. */
00114 void
00115 update_hardlink_info (file)
00116     const char *file;
00117 {
00118     char *path;
00119     Node *n;
00120     struct hardlink_info *hlinfo;
00121
00122     if (file[0] == '/')
00123     {
00124     path = xstrdup (file);
00125     }
00126     else
00127     {
00128     /* file is a relative pathname; assume it's from the current
00129        working directory. */
00130     char *dir = xgetwd();
00131     path = xmalloc (strlen(dir) + strlen(file) + 2);
00132     sprintf (path, "%s/%s", dir, file);
00133     free (dir);
00134     }
00135
00136     n = lookup_file_by_inode (path);
00137     if (n == NULL)
00138     {
00139     /* Something is *really* wrong if the file doesn't exist here;
00140        update_hardlink_info should be called only when a file has
00141        just been checked out to a working directory. */
00142     error (1, 0, "lost hardlink info for %s", file);
00143     }
00144
00145     if (n->data == NULL)
00146     n->data = (char *) xmalloc (sizeof (struct hardlink_info));
00147     hlinfo = (struct hardlink_info *) n->data;
00148     hlinfo->status = T_UPTODATE;
00149     hlinfo->checked_out = 1;
00150 }
00151
00152 /* Return a List with all the files known to be linked to FILE in
00153    the working directory.  Used by special_file_mismatch, to determine
00154    whether it is safe to merge two files.
00155
00156    FIXME: What is the memory allocation for the return value?  We seem
00157    to sometimes allocate a new list (getlist() call below) and sometimes
00158    return an existing list (where we return n->data).  */
00159 List *
00160 list_linked_files_on_disk (file)
00161     char *file;
00162 {
00163     char *inodestr, *path;
00164     struct stat sb;
00165     Node *n;
00166
00167     /* If hardlist is NULL, we have not been doing an operation that
00168        would permit us to know anything about the file's hardlinks
00169        (cvs update, cvs commit, etc).  Return an empty list. */
00170     if (hardlist == NULL)
00171     return getlist();
00172
00173     /* Get the full pathname of file (assuming the working directory) */
00174     if (file[0] == '/')
00175     path = xstrdup (file);
00176     else
00177     {
00178     char *dir = xgetwd();
00179     path = (char *) xmalloc (strlen(dir) + strlen(file) + 2);
00180     sprintf (path, "%s/%s", dir, file);
00181     free (dir);
00182     }
00183
00184     /* We do an extra lookup_file here just to make sure that there
00185        is a node for `path' in the hardlist.  If that were not so,
00186        comparing the working directory linkage against the repository
00187        linkage for a file would always fail. */
00188     (void) lookup_file_by_inode (path);
00189
00190     if (stat (path, &sb) < 0)
00191     error (1, errno, "cannot stat %s", file);
00192     /* inodestr contains the hexadecimal representation of an
00193        inode, so it requires two bytes of text to represent
00194        each byte of the inode number. */
00195     inodestr = (char *) xmalloc (2*sizeof(ino_t) + 1);
00196     sprintf (inodestr, "%lx", (unsigned long) sb.st_ino);
00197
00198     /* Make sure the files linked to this inode are sorted. */
00199     n = findnode (hardlist, inodestr);
00200     sortlist ((List *) n->data, fsortcmp);
00201
00202     free (inodestr);
00203     return (List *) n->data;
00204 }
00205
00206 /* Compare the files in the `key' fields of two lists, returning 1 if
00207    the lists are equivalent and 0 otherwise.
00208
00209    Only the basenames of each file are compared. This is an awful hack
00210    that exists because list_linked_files_on_disk returns full paths
00211    and the `hardlinks' structure of a RCSVers node contains only
00212    basenames.  That in turn is a result of the awful hack that only
00213    basenames are stored in the RCS file.  If anyone ever solves the
00214    problem of correctly managing cross-directory hardlinks, this
00215    function (along with most functions in this file) must be fixed. */
00216
00217 int
00218 compare_linkage_lists (links1, links2)
00219     List *links1;
00220     List *links2;
00221 {
00222     Node *n1, *n2;
00223     char *p1, *p2;
00224
00225     sortlist (links1, fsortcmp);
00226     sortlist (links2, fsortcmp);
00227
00228     n1 = links1->list->next;
00229     n2 = links2->list->next;
00230
00231     while (n1 != links1->list && n2 != links2->list)
00232     {
00233     /* Get the basenames of both files. */
00234     p1 = strrchr (n1->key, '/');
00235     if (p1 == NULL)
00236         p1 = n1->key;
00237     else
00238         ++p1;
00239
00240     p2 = strrchr (n2->key, '/');
00241     if (p2 == NULL)
00242         p2 = n2->key;
00243     else
00244         ++p2;
00245
00246     /* Compare the files' basenames. */
00247     if (strcmp (p1, p2) != 0)
00248         return 0;
00249
00250     n1 = n1->next;
00251     n2 = n2->next;
00252     }
00253
00254     /* At this point we should be at the end of both lists; if not,
00255        one file has more links than the other, and return 1. */
00256     return (n1 == links1->list && n2 == links2->list);
00257 }
00258
00259 /* Find a checked-out file in a list of filenames.  Used by RCS_checkout
00260    when checking out a new hardlinked file, to decide whether this file
00261    can be linked to any others that already exist.  The return value
00262    is not currently used. */
00263
00264 int
00265 find_checkedout_proc (node, data)
00266     Node *node;
00267     void *data;
00268 {
00269     Node **uptodate = (Node **) data;
00270     Node *link;
00271     char *dir = xgetwd();
00272     char *path;
00273     struct hardlink_info *hlinfo;
00274
00275     /* If we have already found a file, don't do anything. */
00276     if (*uptodate != NULL)
00277     return 0;
00278
00279     /* Look at this file in the hardlist and see whether the checked_out
00280        field is 1, meaning that it has been checked out during this CVS run. */
00281     path = (char *)
00282     xmalloc (strlen (dir) + strlen (node->key) + 2);
00283     sprintf (path, "%s/%s", dir, node->key);
00284     link = lookup_file_by_inode (path);
00285     free (path);
00286     free (dir);
00287
00288     if (link == NULL)
00289     {
00290     /* We haven't seen this file -- maybe it hasn't been checked
00291        out yet at all. */
00292     return 0;
00293     }
00294
00295     hlinfo = (struct hardlink_info *) link->data;
00296     if (hlinfo->checked_out)
00297     {
00298     /* This file has been checked out recently, so it's safe to
00299            link to it. */
00300     *uptodate = link;
00301     }
00302
00303     return 0;
00304 }
00305
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/hardlink.h Source File

cvs-1.10/src/hardlink.h

Go to the documentation of this file.
00001 /* This program is free software; you can redistribute it and/or modify
00002    it under the terms of the GNU General Public License as published by
00003    the Free Software Foundation; either version 2, or (at your option)
00004    any later version.
00005
00006    This program is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009    GNU General Public License for more details.  */
00010
00011 /* Data type definitions and declarations for hardlink management.  */
00012
00013 /* This file should be #included in CVS source files after cvs.h
00014    since it relies on types and macros defined there. */
00015
00016 /* The `checked_out' member of a hardlink_info struct is used only
00017    when files are being checked out or updated.  It is used only when
00018    hardlinked files are being checked out. */
00019
00020 struct hardlink_info
00021 {
00022     Ctype status;       /* as returned from Classify_File() */
00023     int checked_out;        /* has this file been checked out lately? */
00024 };
00025
00026 extern List *hardlist;
00027 extern char *working_dir;
00028
00029 Node *lookup_file_by_inode PROTO ((const char *));
00030 void update_hardlink_info PROTO ((const char *));
00031 List *list_linked_files_on_disk PROTO ((char *));
00032 int compare_linkage_lists PROTO ((List *, List *));
00033 int find_checkedout_proc PROTO ((Node *, void *));
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/hash.c Source File

cvs-1.10/src/hash.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  *
00004  * You may distribute under the terms of the GNU General Public License as
00005  * specified in the README file that comes with the CVS source distribution.
00006  *
00007  * Polk's hash list manager.  So cool.
00008  */
00009
00010 #include "cvs.h"
00011 #include <assert.h>
00012
00013 /* Global caches.  The idea is that we maintain a linked list of "free"d
00014    nodes or lists, and get new items from there.  It has been suggested
00015    to use an obstack instead, but off the top of my head, I'm not sure
00016    that would gain enough to be worth worrying about.  */
00017 static List *listcache = NULL;
00018 static Node *nodecache = NULL;
00019
00020 static void freenode_mem PROTO((Node * p));
00021
00022 /* hash function */
00023 static int
00024 hashp (key)
00025     const char *key;
00026 {
00027     unsigned int h = 0;
00028     unsigned int g;
00029
00030     assert(key != NULL);
00031
00032     while (*key != 0)
00033     {
00034     unsigned int c = *key++;
00035     /* The FOLD_FN_CHAR is so that findnode_fn works.  */
00036     h = (h << 4) + FOLD_FN_CHAR (c);
00037     if ((g = h & 0xf0000000) != 0)
00038         h = (h ^ (g >> 24)) ^ g;
00039     }
00040
00041     return (h % HASHSIZE);
00042 }
00043
00044 /*
00045  * create a new list (or get an old one from the cache)
00046  */
00047 List *
00048 getlist ()
00049 {
00050     int i;
00051     List *list;
00052     Node *node;
00053
00054     if (listcache != NULL)
00055     {
00056     /* get a list from the cache and clear it */
00057     list = listcache;
00058     listcache = listcache->next;
00059     list->next = (List *) NULL;
00060     for (i = 0; i < HASHSIZE; i++)
00061         list->hasharray[i] = (Node *) NULL;
00062     }
00063     else
00064     {
00065     /* make a new list from scratch */
00066     list = (List *) xmalloc (sizeof (List));
00067     memset ((char *) list, 0, sizeof (List));
00068     node = getnode ();
00069     list->list = node;
00070     node->type = HEADER;
00071     node->next = node->prev = node;
00072     }
00073     return (list);
00074 }
00075
00076 /*
00077  * free up a list
00078  */
00079 void
00080 dellist (listp)
00081     List **listp;
00082 {
00083     int i;
00084     Node *p;
00085
00086     if (*listp == (List *) NULL)
00087     return;
00088
00089     p = (*listp)->list;
00090
00091     /* free each node in the list (except header) */
00092     while (p->next != p)
00093     delnode (p->next);
00094
00095     /* free any list-private data, without freeing the actual header */
00096     freenode_mem (p);
00097
00098     /* free up the header nodes for hash lists (if any) */
00099     for (i = 0; i < HASHSIZE; i++)
00100     {
00101     if ((p = (*listp)->hasharray[i]) != (Node *) NULL)
00102     {
00103         /* put the nodes into the cache */
00104 #ifndef NOCACHE
00105         p->type = NT_UNKNOWN;
00106         p->next = nodecache;
00107         nodecache = p;
00108 #else
00109         /* If NOCACHE is defined we turn off the cache.  This can make
00110            it easier to tools to determine where items were allocated
00111            and freed, for tracking down memory leaks and the like.  */
00112         free (p);
00113 #endif
00114     }
00115     }
00116
00117     /* put it on the cache */
00118 #ifndef NOCACHE
00119     (*listp)->next = listcache;
00120     listcache = *listp;
00121 #else
00122     free ((*listp)->list);
00123     free (*listp);
00124 #endif
00125     *listp = (List *) NULL;
00126 }
00127
00128 /*
00129  * get a new list node
00130  */
00131 Node *
00132 getnode ()
00133 {
00134     Node *p;
00135
00136     if (nodecache != (Node *) NULL)
00137     {
00138     /* get one from the cache */
00139     p = nodecache;
00140     nodecache = p->next;
00141     }
00142     else
00143     {
00144     /* make a new one */
00145     p = (Node *) xmalloc (sizeof (Node));
00146     }
00147
00148     /* always make it clean */
00149     memset ((char *) p, 0, sizeof (Node));
00150     p->type = NT_UNKNOWN;
00151
00152     return (p);
00153 }
00154
00155 /*
00156  * remove a node from it's list (maybe hash list too) and free it
00157  */
00158 void
00159 delnode (p)
00160     Node *p;
00161 {
00162     if (p == (Node *) NULL)
00163     return;
00164
00165     /* take it out of the list */
00166     p->next->prev = p->prev;
00167     p->prev->next = p->next;
00168
00169     /* if it was hashed, remove it from there too */
00170     if (p->hashnext != (Node *) NULL)
00171     {
00172     p->hashnext->hashprev = p->hashprev;
00173     p->hashprev->hashnext = p->hashnext;
00174     }
00175
00176     /* free up the storage */
00177     freenode (p);
00178 }
00179
00180 /*
00181  * free up the storage associated with a node
00182  */
00183 static void
00184 freenode_mem (p)
00185     Node *p;
00186 {
00187     if (p->delproc != (void (*) ()) NULL)
00188     p->delproc (p);         /* call the specified delproc */
00189     else
00190     {
00191     if (p->data != NULL)        /* otherwise free() it if necessary */
00192         free (p->data);
00193     }
00194     if (p->key != NULL)         /* free the key if necessary */
00195     free (p->key);
00196
00197     /* to be safe, re-initialize these */
00198     p->key = p->data = (char *) NULL;
00199     p->delproc = (void (*) ()) NULL;
00200 }
00201
00202 /*
00203  * free up the storage associated with a node and recycle it
00204  */
00205 void
00206 freenode (p)
00207     Node *p;
00208 {
00209     /* first free the memory */
00210     freenode_mem (p);
00211
00212     /* then put it in the cache */
00213 #ifndef NOCACHE
00214     p->type = NT_UNKNOWN;
00215     p->next = nodecache;
00216     nodecache = p;
00217 #else
00218     free (p);
00219 #endif
00220 }
00221
00222 /*
00223  * Link item P into list LIST before item MARKER.  If P->KEY is non-NULL and
00224  * that key is already in the hash table, return -1 without modifying any
00225  * parameter.
00226  *
00227  * return 0 on success
00228  */
00229 int
00230 insert_before (list, marker, p)
00231     List *list;
00232     Node *marker;
00233     Node *p;
00234 {
00235     if (p->key != NULL)         /* hash it too? */
00236     {
00237     int hashval;
00238     Node *q;
00239
00240     hashval = hashp (p->key);
00241     if (list->hasharray[hashval] == NULL)   /* make a header for list? */
00242     {
00243         q = getnode ();
00244         q->type = HEADER;
00245         list->hasharray[hashval] = q->hashnext = q->hashprev = q;
00246     }
00247
00248     /* put it into the hash list if it's not already there */
00249     for (q = list->hasharray[hashval]->hashnext;
00250          q != list->hasharray[hashval]; q = q->hashnext)
00251     {
00252         if (strcmp (p->key, q->key) == 0)
00253         return (-1);
00254     }
00255     q = list->hasharray[hashval];
00256     p->hashprev = q->hashprev;
00257     p->hashnext = q;
00258     p->hashprev->hashnext = p;
00259     q->hashprev = p;
00260     }
00261
00262     p->next = marker;
00263     p->prev = marker->prev;
00264     marker->prev->next = p;
00265     marker->prev = p;
00266
00267     return (0);
00268 }
00269
00270 /*
00271  * insert item p at end of list "list" (maybe hash it too) if hashing and it
00272  * already exists, return -1 and don't actually put it in the list
00273  *
00274  * return 0 on success
00275  */
00276 int
00277 addnode (list, p)
00278     List *list;
00279     Node *p;
00280 {
00281   return insert_before (list, list->list, p);
00282 }
00283
00284 /*
00285  * Like addnode, but insert p at the front of `list'.  This bogosity is
00286  * necessary to preserve last-to-first output order for some RCS functions.
00287  */
00288 int
00289 addnode_at_front (list, p)
00290     List *list;
00291     Node *p;
00292 {
00293   return insert_before (list, list->list->next, p);
00294 }
00295
00296 /* Look up an entry in hash list table and return a pointer to the
00297    node.  Return NULL if not found.  Abort with a fatal error for
00298    errors.  */
00299 Node *
00300 findnode (list, key)
00301     List *list;
00302     const char *key;
00303 {
00304     Node *head, *p;
00305
00306     /* This probably should be "assert (list != NULL)" (or if not we
00307        should document the current behavior), but only if we check all
00308        the callers to see if any are relying on this behavior.  */
00309     if ((list == (List *) NULL))
00310     return ((Node *) NULL);
00311
00312     assert (key != NULL);
00313
00314     head = list->hasharray[hashp (key)];
00315     if (head == (Node *) NULL)
00316     /* Not found.  */
00317     return ((Node *) NULL);
00318
00319     for (p = head->hashnext; p != head; p = p->hashnext)
00320     if (strcmp (p->key, key) == 0)
00321         return (p);
00322     return ((Node *) NULL);
00323 }
00324
00325 /*
00326  * Like findnode, but for a filename.
00327  */
00328 Node *
00329 findnode_fn (list, key)
00330     List *list;
00331     const char *key;
00332 {
00333     Node *head, *p;
00334
00335     /* This probably should be "assert (list != NULL)" (or if not we
00336        should document the current behavior), but only if we check all
00337        the callers to see if any are relying on this behavior.  */
00338     if (list == (List *) NULL)
00339     return ((Node *) NULL);
00340
00341     assert (key != NULL);
00342
00343     head = list->hasharray[hashp (key)];
00344     if (head == (Node *) NULL)
00345     return ((Node *) NULL);
00346
00347     for (p = head->hashnext; p != head; p = p->hashnext)
00348     if (fncmp (p->key, key) == 0)
00349         return (p);
00350     return ((Node *) NULL);
00351 }
00352
00353 /*
00354  * walk a list with a specific proc
00355  */
00356 int
00357 walklist (list, proc, closure)
00358     List *list;
00359     int (*proc) PROTO ((Node *, void *));
00360     void *closure;
00361 {
00362     Node *head, *p;
00363     int err = 0;
00364
00365     if (list == NULL)
00366     return (0);
00367
00368     head = list->list;
00369     for (p = head->next; p != head; p = p->next)
00370     err += proc (p, closure);
00371     return (err);
00372 }
00373
00374 int
00375 list_isempty (list)
00376     List *list;
00377 {
00378     return list == NULL || list->list->next == list->list;
00379 }
00380
00381 static int (*client_comp) PROTO ((const Node *, const Node *));
00382 static int qsort_comp PROTO ((const void *, const void *));
00383
00384 static int
00385 qsort_comp (elem1, elem2)
00386     const void *elem1;
00387     const void *elem2;
00388 {
00389     Node **node1 = (Node **) elem1;
00390     Node **node2 = (Node **) elem2;
00391     return client_comp (*node1, *node2);
00392 }
00393
00394 /*
00395  * sort the elements of a list (in place)
00396  */
00397 void
00398 sortlist (list, comp)
00399     List *list;
00400     int (*comp) PROTO ((const Node *, const Node *));
00401 {
00402     Node *head, *remain, *p, **array;
00403     int i, n;
00404
00405     /* save the old first element of the list */
00406     head = list->list;
00407     remain = head->next;
00408
00409     /* count the number of nodes in the list */
00410     n = 0;
00411     for (p = remain; p != head; p = p->next)
00412     n++;
00413
00414     /* allocate an array of nodes and populate it */
00415     array = (Node **) xmalloc (sizeof(Node *) * n);
00416     i = 0;
00417     for (p = remain; p != head; p = p->next)
00418     array[i++] = p;
00419
00420     /* sort the array of nodes */
00421     client_comp = comp;
00422     qsort (array, n, sizeof(Node *), qsort_comp);
00423
00424     /* rebuild the list from beginning to end */
00425     head->next = head->prev = head;
00426     for (i = 0; i < n; i++)
00427     {
00428     p = array[i];
00429     p->next = head;
00430     p->prev = head->prev;
00431     p->prev->next = p;
00432     head->prev = p;
00433     }
00434
00435     /* release the array of nodes */
00436     free (array);
00437 }
00438
00439 /*
00440  * compare two files list node (for sort)
00441  */
00442 int
00443 fsortcmp (p, q)
00444     const Node *p;
00445     const Node *q;
00446 {
00447     return (strcmp (p->key, q->key));
00448 }
00449
00450 /* Debugging functions.  Quite useful to call from within gdb. */
00451
00452 static char *nodetypestring PROTO ((Ntype));
00453
00454 static char *
00455 nodetypestring (type)
00456     Ntype type;
00457 {
00458     switch (type) {
00459     case NT_UNKNOWN:    return("UNKNOWN");
00460     case HEADER:    return("HEADER");
00461     case ENTRIES:   return("ENTRIES");
00462     case FILES:     return("FILES");
00463     case LIST:      return("LIST");
00464     case RCSNODE:   return("RCSNODE");
00465     case RCSVERS:   return("RCSVERS");
00466     case DIRS:      return("DIRS");
00467     case UPDATE:    return("UPDATE");
00468     case LOCK:      return("LOCK");
00469     case NDBMNODE:  return("NDBMNODE");
00470     case FILEATTR:  return("FILEATTR");
00471     case VARIABLE:  return("VARIABLE");
00472     case RCSFIELD:  return("RCSFIELD");
00473     case RCSCMPFLD: return("RCSCMPFLD");
00474     }
00475
00476     return("<trash>");
00477 }
00478
00479 static int printnode PROTO ((Node *, void *));
00480 static int
00481 printnode (node, closure)
00482      Node *node;
00483      void *closure;
00484 {
00485     if (node == NULL)
00486     {
00487     (void) printf("NULL node.\n");
00488     return(0);
00489     }
00490
00491     (void) printf("Node at 0x%p: type = %s, key = 0x%p = \"%s\", data = 0x%p, next = 0x%p, prev = 0x%p\n",
00492        node, nodetypestring(node->type), node->key, node->key, node->data, node->next, node->prev);
00493
00494     return(0);
00495 }
00496
00497 /* This is global, not static, so that its name is unique and to avoid
00498    compiler warnings about it not being used.  But it is not used by CVS;
00499    it exists so one can call it from a debugger.  */
00500 void printlist PROTO ((List *));
00501
00502 void
00503 printlist (list)
00504     List *list;
00505 {
00506     if (list == NULL)
00507     {
00508     (void) printf("NULL list.\n");
00509     return;
00510     }
00511
00512     (void) printf("List at 0x%p: list = 0x%p, HASHSIZE = %d, next = 0x%p\n",
00513        list, list->list, HASHSIZE, list->next);
00514
00515     (void) walklist(list, printnode, NULL);
00516
00517     return;
00518 }
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/hash.h Source File

cvs-1.10/src/hash.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  *
00004  * You may distribute under the terms of the GNU General Public License as
00005  * specified in the README file that comes with the CVS source distribution.
00006  */
00007
00008 /*
00009  * The number of buckets for the hash table contained in each list.  This
00010  * should probably be prime.
00011  */
00012 #define HASHSIZE    151
00013
00014 /*
00015  * Types of nodes
00016  */
00017 enum ntype
00018 {
00019     NT_UNKNOWN, HEADER, ENTRIES, FILES, LIST, RCSNODE,
00020     RCSVERS, DIRS, UPDATE, LOCK, NDBMNODE, FILEATTR,
00021     VARIABLE, RCSFIELD, RCSCMPFLD
00022 };
00023 typedef enum ntype Ntype;
00024
00025 struct node
00026 {
00027     Ntype type;
00028     struct node *next;
00029     struct node *prev;
00030     struct node *hashnext;
00031     struct node *hashprev;
00032     char *key;
00033     char *data;
00034     void (*delproc) ();
00035 };
00036 typedef struct node Node;
00037
00038 struct list
00039 {
00040     Node *list;
00041     Node *hasharray[HASHSIZE];
00042     struct list *next;
00043 };
00044 typedef struct list List;
00045
00046 List *getlist PROTO((void));
00047 Node *findnode PROTO((List * list, const char *key));
00048 Node *findnode_fn PROTO((List * list, const char *key));
00049 Node *getnode PROTO((void));
00050 int insert_before PROTO((List * list, Node * marker, Node * p));
00051 int addnode PROTO((List * list, Node * p));
00052 int addnode_at_front PROTO((List * list, Node * p));
00053 int walklist PROTO((List * list, int (*)(Node *n, void *closure), void *closure));
00054 int list_isempty PROTO ((List *list));
00055 void dellist PROTO((List ** listp));
00056 void delnode PROTO((Node * p));
00057 void freenode PROTO((Node * p));
00058 void sortlist PROTO((List * list, int (*)(const Node *, const Node *)));
00059 int fsortcmp PROTO((const Node * p, const Node * q));
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/history.c Source File

cvs-1.10/src/history.c

Go to the documentation of this file.
00001 /*
00002  *
00003  *    You may distribute under the terms of the GNU General Public License
00004  *    as specified in the README file that comes with the CVS 1.0 kit.
00005  *
00006  * **************** History of Users and Module ****************
00007  *
00008  * LOGGING:  Append record to "${CVSROOT}/CVSROOTADM/CVSROOTADM_HISTORY".
00009  *
00010  * On For each Tag, Add, Checkout, Commit, Update or Release command,
00011  * one line of text is written to a History log.
00012  *
00013  *  X date | user | CurDir | special | rev(s) | argument '\n'
00014  *
00015  * where: [The spaces in the example line above are not in the history file.]
00016  *
00017  *  X       is a single character showing the type of event:
00018  *      T   "Tag" cmd.
00019  *      O   "Checkout" cmd.
00020  *              E       "Export" cmd.
00021  *      F   "Release" cmd.
00022  *      W   "Update" cmd - No User file, Remove from Entries file.
00023  *      U   "Update" cmd - File was checked out over User file.
00024  *      G   "Update" cmd - File was merged successfully.
00025  *      C   "Update" cmd - File was merged and shows overlaps.
00026  *      M   "Commit" cmd - "Modified" file.
00027  *      A   "Commit" cmd - "Added" file.
00028  *      R   "Commit" cmd - "Removed" file.
00029  *
00030  *  date    is a fixed length 8-char hex representation of a Unix time_t.
00031  *      [Starting here, variable fields are delimited by '|' chars.]
00032  *
00033  *  user    is the username of the person who typed the command.
00034  *
00035  *  CurDir  The directory where the action occurred.  This should be the
00036  *      absolute path of the directory which is at the same level as
00037  *      the "Repository" field (for W,U,G,C & M,A,R).
00038  *
00039  *  Repository  For record types [W,U,G,C,M,A,R] this field holds the
00040  *      repository read from the administrative data where the
00041  *      command was typed.
00042  *      T   "A" --> New Tag, "D" --> Delete Tag
00043  *          Otherwise it is the Tag or Date to modify.
00044  *      O,F,E   A "" (null field)
00045  *
00046  *  rev(s)  Revision number or tag.
00047  *      T   The Tag to apply.
00048  *      O,E The Tag or Date, if specified, else "" (null field).
00049  *      F   "" (null field)
00050  *      W   The Tag or Date, if specified, else "" (null field).
00051  *      U   The Revision checked out over the User file.
00052  *      G,C The Revision(s) involved in merge.
00053  *      M,A,R   RCS Revision affected.
00054  *
00055  *  argument    The module (for [TOEUF]) or file (for [WUGCMAR]) affected.
00056  *
00057  *
00058  *** Report categories: "User" and "Since" modifiers apply to all reports.
00059  *          [For "sort" ordering see the "sort_order" routine.]
00060  *
00061  *   Extract list of record types
00062  *
00063  *  -e, -x [TOEFWUGCMAR]
00064  *
00065  *      Extracted records are simply printed, No analysis is performed.
00066  *      All "field" modifiers apply.  -e chooses all types.
00067  *
00068  *   Checked 'O'ut modules
00069  *
00070  *  -o, -w
00071  *      Checked out modules.  'F' and 'O' records are examined and if
00072  *      the last record for a repository/file is an 'O', a line is
00073  *      printed.  "-w" forces the "working dir" to be used in the
00074  *      comparison instead of the repository.
00075  *
00076  *   Committed (Modified) files
00077  *
00078  *  -c, -l, -w
00079  *      All 'M'odified, 'A'dded and 'R'emoved records are examined.
00080  *      "Field" modifiers apply.  -l forces a sort by file within user
00081  *      and shows only the last modifier.  -w works as in Checkout.
00082  *
00083  *      Warning: Be careful with what you infer from the output of
00084  *           "cvs hi -c -l".  It means the last time *you*
00085  *           changed the file, not the list of files for which
00086  *           you were the last changer!!!
00087  *
00088  *   Module history for named modules.
00089  *  -m module, -l
00090  *
00091  *      This is special.  If one or more modules are specified, the
00092  *      module names are remembered and the files making up the
00093  *      modules are remembered.  Only records matching exactly those
00094  *      files and repositories are shown.  Sorting by "module", then
00095  *      filename, is implied.  If -l ("last modified") is specified,
00096  *      then "update" records (types WUCG), tag and release records
00097  *      are ignored and the last (by date) "modified" record.
00098  *
00099  *   TAG history
00100  *
00101  *  -T  All Tag records are displayed.
00102  *
00103  *** Modifiers.
00104  *
00105  *   Since ...      [All records contain a timestamp, so any report
00106  *           category can be limited by date.]
00107  *
00108  *  -D date     - The "date" is parsed into a Unix "time_t" and
00109  *            records with an earlier time stamp are ignored.
00110  *  -r rev/tag  - A "rev" begins with a digit.  A "tag" does not.  If
00111  *            you use this option, every file is searched for the
00112  *            indicated rev/tag.
00113  *  -t tag      - The "tag" is searched for in the history file and no
00114  *            record is displayed before the tag is found.  An
00115  *            error is printed if the tag is never found.
00116  *  -b string   - Records are printed only back to the last reference
00117  *            to the string in the "module", "file" or
00118  *            "repository" fields.
00119  *
00120  *   Field Selections   [Simple comparisons on existing fields.  All field
00121  *           selections are repeatable.]
00122  *
00123  *  -a      - All users.
00124  *  -u user     - If no user is given and '-a' is not given, only
00125  *            records for the user typing the command are shown.
00126  *            ==> If -a or -u is not specified, just use "self".
00127  *
00128  *  -f filematch    - Only records in which the "file" field contains the
00129  *            string "filematch" are considered.
00130  *
00131  *  -p repository   - Only records in which the "repository" string is a
00132  *            prefix of the "repos" field are considered.
00133  *
00134  *  -m modulename   - Only records which contain "modulename" in the
00135  *            "module" field are considered.
00136  *
00137  *
00138  * EXAMPLES: ("cvs history", "cvs his" or "cvs hi")
00139  *
00140  *** Checked out files for username.  (default self, e.g. "dgg")
00141  *  cvs hi          [equivalent to: "cvs hi -o -u dgg"]
00142  *  cvs hi -u user      [equivalent to: "cvs hi -o -u user"]
00143  *  cvs hi -o       [equivalent to: "cvs hi -o -u dgg"]
00144  *
00145  *** Committed (modified) files from the beginning of the file.
00146  *  cvs hi -c [-u user]
00147  *
00148  *** Committed (modified) files since Midnight, January 1, 1990:
00149  *  cvs hi -c -D 'Jan 1 1990' [-u user]
00150  *
00151  *** Committed (modified) files since tag "TAG" was stored in the history file:
00152  *  cvs hi -c -t TAG [-u user]
00153  *
00154  *** Committed (modified) files since tag "TAG" was placed on the files:
00155  *  cvs hi -c -r TAG [-u user]
00156  *
00157  *** Who last committed file/repository X?
00158  *  cvs hi -c -l -[fp] X
00159  *
00160  *** Modified files since tag/date/file/repos?
00161  *  cvs hi -c {-r TAG | -D Date | -b string}
00162  *
00163  *** Tag history
00164  *  cvs hi -T
00165  *
00166  *** History of file/repository/module X.
00167  *  cvs hi -[fpn] X
00168  *
00169  *** History of user "user".
00170  *  cvs hi -e -u user
00171  *
00172  *** Dump (eXtract) specified record types
00173  *  cvs hi -x [TOFWUGCMAR]
00174  *
00175  *
00176  * FUTURE:      J[Join], I[Import]  (Not currently implemented.)
00177  *
00178  */
00179
00180 #include "cvs.h"
00181 #include "savecwd.h"
00182
00183 static struct hrec
00184 {
00185     char *type;     /* Type of record (In history record) */
00186     char *user;     /* Username (In history record) */
00187     char *dir;      /* "Compressed" Working dir (In history record) */
00188     char *repos;    /* (Tag is special.) Repository (In history record) */
00189     char *rev;      /* Revision affected (In history record) */
00190     char *file;     /* Filename (In history record) */
00191     char *end;      /* Ptr into repository to copy at end of workdir */
00192     char *mod;      /* The module within which the file is contained */
00193     time_t date;    /* Calculated from date stored in record */
00194     int idx;        /* Index of record, for "stable" sort. */
00195 } *hrec_head;
00196
00197
00198 static void fill_hrec PROTO((char *line, struct hrec * hr));
00199 static int accept_hrec PROTO((struct hrec * hr, struct hrec * lr));
00200 static int select_hrec PROTO((struct hrec * hr));
00201 static int sort_order PROTO((const PTR l, const PTR r));
00202 static int within PROTO((char *find, char *string));
00203 static void expand_modules PROTO((void));
00204 static void read_hrecs PROTO((char *fname));
00205 static void report_hrecs PROTO((void));
00206 static void save_file PROTO((char *dir, char *name, char *module));
00207 static void save_module PROTO((char *module));
00208 static void save_user PROTO((char *name));
00209
00210 #define ALL_REC_TYPES "TOEFWUCGMAR"
00211 #define USER_INCREMENT  2
00212 #define FILE_INCREMENT  128
00213 #define MODULE_INCREMENT 5
00214 #define HREC_INCREMENT  128
00215
00216 static short report_count;
00217
00218 static short extract;
00219 static short v_checkout;
00220 static short modified;
00221 static short tag_report;
00222 static short module_report;
00223 static short working;
00224 static short last_entry;
00225 static short all_users;
00226
00227 static short user_sort;
00228 static short repos_sort;
00229 static short file_sort;
00230 static short module_sort;
00231
00232 static short tz_local;
00233 static time_t tz_seconds_east_of_GMT;
00234 static char *tz_name = "+0000";
00235
00236 char *logHistory = ALL_REC_TYPES;
00237
00238 /* -r, -t, or -b options, malloc'd.  These are "" if the option in
00239    question is not specified or is overridden by another option.  The
00240    main reason for using "" rather than NULL is historical.  Together
00241    with since_date, these are a mutually exclusive set; one overrides the
00242    others.  */
00243 static char *since_rev;
00244 static char *since_tag;
00245 static char *backto;
00246 /* -D option, or 0 if not specified.  RCS format.  */
00247 static char * since_date;
00248
00249 static struct hrec *last_since_tag;
00250 static struct hrec *last_backto;
00251
00252 /* Record types to look for, malloc'd.  Probably could be statically
00253    allocated, but only if we wanted to check for duplicates more than
00254    we do.  */
00255 static char *rec_types;
00256
00257 static int hrec_count;
00258 static int hrec_max;
00259
00260 static char **user_list;    /* Ptr to array of ptrs to user names */
00261 static int user_max;        /* Number of elements allocated */
00262 static int user_count;      /* Number of elements used */
00263
00264 static struct file_list_str
00265 {
00266     char *l_file;
00267     char *l_module;
00268 } *file_list;           /* Ptr to array file name structs */
00269 static int file_max;        /* Number of elements allocated */
00270 static int file_count;      /* Number of elements used */
00271
00272 static char **mod_list;     /* Ptr to array of ptrs to module names */
00273 static int mod_max;     /* Number of elements allocated */
00274 static int mod_count;       /* Number of elements used */
00275
00276 static char *histfile;      /* Ptr to the history file name */
00277
00278 /* This is pretty unclear.  First of all, separating "flags" vs.
00279    "options" (I think the distinction is that "options" take arguments)
00280    is nonstandard, and not something we do elsewhere in CVS.  Second of
00281    all, what does "reports" mean?  I think it means that you can only
00282    supply one of those options, but "reports" hardly has that meaning in
00283    a self-explanatory way.  */
00284 static const char *const history_usg[] =
00285 {
00286     "Usage: %s %s [-report] [-flags] [-options args] [files...]\n\n",
00287     "   Reports:\n",
00288     "        -T              Produce report on all TAGs\n",
00289     "        -c              Committed (Modified) files\n",
00290     "        -o              Checked out modules\n",
00291     "        -m <module>     Look for specified module (repeatable)\n",
00292     "        -x [TOEFWUCGMAR] Extract by record type\n",
00293     "        -e              Everything (same as -x, but all record types)\n",
00294     "   Flags:\n",
00295     "        -a              All users (Default is self)\n",
00296     "        -l              Last modified (committed or modified report)\n",
00297     "        -w              Working directory must match\n",
00298     "   Options:\n",
00299     "        -D <date>       Since date (Many formats)\n",
00300     "        -b <str>        Back to record with str in module/file/repos field\n",
00301     "        -f <file>       Specified file (same as command line) (repeatable)\n",
00302     "        -n <modulename> In module (repeatable)\n",
00303     "        -p <repos>      In repository (repeatable)\n",
00304     "        -r <rev/tag>    Since rev or tag (looks inside RCS files!)\n",
00305     "        -t <tag>        Since tag record placed in history file (by anyone).\n",
00306     "        -u <user>       For user name (repeatable)\n",
00307     "        -z <tz>         Output for time zone <tz> (e.g. -z -0700)\n",
00308     NULL};
00309
00310 /* Sort routine for qsort:
00311    - If a user is selected at all, sort it first. User-within-file is useless.
00312    - If a module was selected explicitly, sort next on module.
00313    - Then sort by file.  "File" is "repository/file" unless "working" is set,
00314      then it is "workdir/file".  (Revision order should always track date.)
00315    - Always sort timestamp last.
00316 */
00317 static int
00318 sort_order (l, r)
00319     const PTR l;
00320     const PTR r;
00321 {
00322     int i;
00323     const struct hrec *left = (const struct hrec *) l;
00324     const struct hrec *right = (const struct hrec *) r;
00325
00326     if (user_sort)  /* If Sort by username, compare users */
00327     {
00328     if ((i = strcmp (left->user, right->user)) != 0)
00329         return (i);
00330     }
00331     if (module_sort)    /* If sort by modules, compare module names */
00332     {
00333     if (left->mod && right->mod)
00334         if ((i = strcmp (left->mod, right->mod)) != 0)
00335         return (i);
00336     }
00337     if (repos_sort) /* If sort by repository, compare them. */
00338     {
00339     if ((i = strcmp (left->repos, right->repos)) != 0)
00340         return (i);
00341     }
00342     if (file_sort)  /* If sort by filename, compare files, NOT dirs. */
00343     {
00344     if ((i = strcmp (left->file, right->file)) != 0)
00345         return (i);
00346
00347     if (working)
00348     {
00349         if ((i = strcmp (left->dir, right->dir)) != 0)
00350         return (i);
00351
00352         if ((i = strcmp (left->end, right->end)) != 0)
00353         return (i);
00354     }
00355     }
00356
00357     /*
00358      * By default, sort by date, time
00359      * XXX: This fails after 2030 when date slides into sign bit
00360      */
00361     if ((i = ((long) (left->date) - (long) (right->date))) != 0)
00362     return (i);
00363
00364     /* For matching dates, keep the sort stable by using record index */
00365     return (left->idx - right->idx);
00366 }
00367
00368 int
00369 history (argc, argv)
00370     int argc;
00371     char **argv;
00372 {
00373     int i, c;
00374     char *fname;
00375
00376     if (argc == -1)
00377     usage (history_usg);
00378
00379     since_rev = xstrdup ("");
00380     since_tag = xstrdup ("");
00381     backto = xstrdup ("");
00382     rec_types = xstrdup ("");
00383     optind = 0;
00384     while ((c = getopt (argc, argv, "+Tacelow?D:b:f:m:n:p:r:t:u:x:X:z:")) != -1)
00385     {
00386     switch (c)
00387     {
00388         case 'T':           /* Tag list */
00389         report_count++;
00390         tag_report++;
00391         break;
00392         case 'a':           /* For all usernames */
00393         all_users++;
00394         break;
00395         case 'c':
00396         report_count++;
00397         modified = 1;
00398         break;
00399         case 'e':
00400         report_count++;
00401         extract++;
00402         free (rec_types);
00403         rec_types = xstrdup (ALL_REC_TYPES);
00404         break;
00405         case 'l':           /* Find Last file record */
00406         last_entry = 1;
00407         break;
00408         case 'o':
00409         report_count++;
00410         v_checkout = 1;
00411         break;
00412         case 'w':           /* Match Working Dir (CurDir) fields */
00413         working = 1;
00414         break;
00415         case 'X':           /* Undocumented debugging flag */
00416         histfile = optarg;
00417         break;
00418         case 'D':           /* Since specified date */
00419         if (*since_rev || *since_tag || *backto)
00420         {
00421             error (0, 0, "date overriding rev/tag/backto");
00422             *since_rev = *since_tag = *backto = '\0';
00423         }
00424         since_date = Make_Date (optarg);
00425         break;
00426         case 'b':           /* Since specified file/Repos */
00427         if (since_date || *since_rev || *since_tag)
00428         {
00429             error (0, 0, "backto overriding date/rev/tag");
00430             *since_rev = *since_tag = '\0';
00431             if (since_date != NULL)
00432             free (since_date);
00433             since_date = NULL;
00434         }
00435         free (backto);
00436         backto = xstrdup (optarg);
00437         break;
00438         case 'f':           /* For specified file */
00439         save_file ("", optarg, (char *) NULL);
00440         break;
00441         case 'm':           /* Full module report */
00442         report_count++;
00443         module_report++;
00444         case 'n':           /* Look for specified module */
00445         save_module (optarg);
00446         break;
00447         case 'p':           /* For specified directory */
00448         save_file (optarg, "", (char *) NULL);
00449         break;
00450         case 'r':           /* Since specified Tag/Rev */
00451         if (since_date || *since_tag || *backto)
00452         {
00453             error (0, 0, "rev overriding date/tag/backto");
00454             *since_tag = *backto = '\0';
00455             if (since_date != NULL)
00456             free (since_date);
00457             since_date = NULL;
00458         }
00459         free (since_rev);
00460         since_rev = xstrdup (optarg);
00461         break;
00462         case 't':           /* Since specified Tag/Rev */
00463         if (since_date || *since_rev || *backto)
00464         {
00465             error (0, 0, "tag overriding date/marker/file/repos");
00466             *since_rev = *backto = '\0';
00467             if (since_date != NULL)
00468             free (since_date);
00469             since_date = NULL;
00470         }
00471         free (since_tag);
00472         since_tag = xstrdup (optarg);
00473         break;
00474         case 'u':           /* For specified username */
00475         save_user (optarg);
00476         break;
00477         case 'x':
00478         report_count++;
00479         extract++;
00480         {
00481             char *cp;
00482
00483             for (cp = optarg; *cp; cp++)
00484             if (!strchr (ALL_REC_TYPES, *cp))
00485                 error (1, 0, "%c is not a valid report type", *cp);
00486         }
00487         free (rec_types);
00488         rec_types = xstrdup (optarg);
00489         break;
00490         case 'z':
00491         tz_local =
00492             (optarg[0] == 'l' || optarg[0] == 'L')
00493             && (optarg[1] == 't' || optarg[1] == 'T')
00494             && !optarg[2];
00495         if (tz_local)
00496             tz_name = optarg;
00497         else
00498         {
00499             /*
00500              * Convert a known time with the given timezone to time_t.
00501              * Use the epoch + 23 hours, so timezones east of GMT work.
00502              */
00503             static char f[] = "1/1/1970 23:00 %s";
00504             char *buf = xmalloc (sizeof (f) - 2 + strlen (optarg));
00505             time_t t;
00506             sprintf (buf, f, optarg);
00507             t = get_date (buf, (struct timeb *) NULL);
00508             free (buf);
00509             if (t == (time_t) -1)
00510             error (0, 0, "%s is not a known time zone", optarg);
00511             else
00512             {
00513             /*
00514              * Convert to seconds east of GMT, removing the
00515              * 23-hour offset mentioned above.
00516              */
00517             tz_seconds_east_of_GMT = (time_t)23 * 60 * 60  -  t;
00518             tz_name = optarg;
00519             }
00520         }
00521         break;
00522         case '?':
00523         default:
00524         usage (history_usg);
00525         break;
00526     }
00527     }
00528     argc -= optind;
00529     argv += optind;
00530     for (i = 0; i < argc; i++)
00531     save_file ("", argv[i], (char *) NULL);
00532
00533
00534     /* ================ Now analyze the arguments a bit */
00535     if (!report_count)
00536     v_checkout++;
00537     else if (report_count > 1)
00538     error (1, 0, "Only one report type allowed from: \"-Tcomxe\".");
00539
00540 #ifdef CLIENT_SUPPORT
00541     if (client_active)
00542     {
00543     struct file_list_str *f1;
00544     char **mod;
00545
00546     /* We're the client side.  Fire up the remote server.  */
00547     start_server ();
00548
00549     ign_setup ();
00550
00551     if (tag_report)
00552         send_arg("-T");
00553     if (all_users)
00554         send_arg("-a");
00555     if (modified)
00556         send_arg("-c");
00557     if (last_entry)
00558         send_arg("-l");
00559     if (v_checkout)
00560         send_arg("-o");
00561     if (working)
00562         send_arg("-w");
00563     if (histfile)
00564         send_arg("-X");
00565     if (since_date)
00566         client_senddate (since_date);
00567     if (backto[0] != '\0')
00568         option_with_arg ("-b", backto);
00569     for (f1 = file_list; f1 < &file_list[file_count]; ++f1)
00570     {
00571         if (f1->l_file[0] == '*')
00572         option_with_arg ("-p", f1->l_file + 1);
00573         else
00574         option_with_arg ("-f", f1->l_file);
00575     }
00576     if (module_report)
00577         send_arg("-m");
00578     for (mod = mod_list; mod < &mod_list[mod_count]; ++mod)
00579         option_with_arg ("-n", *mod);
00580     if (*since_rev)
00581         option_with_arg ("-r", since_rev);
00582     if (*since_tag)
00583         option_with_arg ("-t", since_tag);
00584     for (mod = user_list; mod < &user_list[user_count]; ++mod)
00585         option_with_arg ("-u", *mod);
00586     if (extract)
00587         option_with_arg ("-x", rec_types);
00588     option_with_arg ("-z", tz_name);
00589
00590     send_to_server ("history\012", 0);
00591         return get_responses_and_close ();
00592     }
00593 #endif
00594
00595     if (all_users)
00596     save_user ("");
00597
00598     if (mod_list)
00599     expand_modules ();
00600
00601     if (tag_report)
00602     {
00603     if (!strchr (rec_types, 'T'))
00604     {
00605         rec_types = xrealloc (rec_types, strlen (rec_types) + 5);
00606         (void) strcat (rec_types, "T");
00607     }
00608     }
00609     else if (extract)
00610     {
00611     if (user_list)
00612         user_sort++;
00613     }
00614     else if (modified)
00615     {
00616     free (rec_types);
00617     rec_types = xstrdup ("MAR");
00618     /*
00619      * If the user has not specified a date oriented flag ("Since"), sort
00620      * by Repository/file before date.  Default is "just" date.
00621      */
00622     if (last_entry
00623         || (!since_date && !*since_rev && !*since_tag && !*backto))
00624     {
00625         repos_sort++;
00626         file_sort++;
00627         /*
00628          * If we are not looking for last_modified and the user specified
00629          * one or more users to look at, sort by user before filename.
00630          */
00631         if (!last_entry && user_list)
00632         user_sort++;
00633     }
00634     }
00635     else if (module_report)
00636     {
00637     free (rec_types);
00638     rec_types = xstrdup (last_entry ? "OMAR" : ALL_REC_TYPES);
00639     module_sort++;
00640     repos_sort++;
00641     file_sort++;
00642     working = 0;            /* User's workdir doesn't count here */
00643     }
00644     else
00645     /* Must be "checkout" or default */
00646     {
00647     free (rec_types);
00648     rec_types = xstrdup ("OF");
00649     /* See comments in "modified" above */
00650     if (!last_entry && user_list)
00651         user_sort++;
00652     if (last_entry
00653         || (!since_date && !*since_rev && !*since_tag && !*backto))
00654         file_sort++;
00655     }
00656
00657     /* If no users were specified, use self (-a saves a universal ("") user) */
00658     if (!user_list)
00659     save_user (getcaller ());
00660
00661     /* If we're looking back to a Tag value, must consider "Tag" records */
00662     if (*since_tag && !strchr (rec_types, 'T'))
00663     {
00664     rec_types = xrealloc (rec_types, strlen (rec_types) + 5);
00665     (void) strcat (rec_types, "T");
00666     }
00667
00668     if (histfile)
00669     fname = xstrdup (histfile);
00670     else
00671     {
00672     fname = xmalloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM)
00673              + sizeof (CVSROOTADM_HISTORY) + 10);
00674     (void) sprintf (fname, "%s/%s/%s", CVSroot_directory,
00675             CVSROOTADM, CVSROOTADM_HISTORY);
00676     }
00677
00678     read_hrecs (fname);
00679     if(hrec_count>0)
00680     {
00681     qsort ((PTR) hrec_head, hrec_count,
00682         sizeof (struct hrec), sort_order);
00683     }
00684     report_hrecs ();
00685     free (fname);
00686     if (since_date != NULL)
00687     free (since_date);
00688     free (since_rev);
00689     free (since_tag);
00690     free (backto);
00691     free (rec_types);
00692
00693     return (0);
00694 }
00695
00696 void
00697 history_write (type, update_dir, revs, name, repository)
00698     int type;
00699     char *update_dir;
00700     char *revs;
00701     char *name;
00702     char *repository;
00703 {
00704     char *fname;
00705     char *workdir;
00706     char *username = getcaller ();
00707     int fd;
00708     char *line;
00709     char *slash = "", *cp, *cp2, *repos;
00710     int i;
00711     static char *tilde = "";
00712     static char *PrCurDir = NULL;
00713
00714     if (logoff)         /* History is turned off by cmd line switch */
00715     return;
00716     if ( strchr(logHistory, type) == NULL )
00717     return;
00718     fname = xmalloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM)
00719              + sizeof (CVSROOTADM_HISTORY) + 10);
00720     (void) sprintf (fname, "%s/%s/%s", CVSroot_directory,
00721             CVSROOTADM, CVSROOTADM_HISTORY);
00722
00723     /* turn off history logging if the history file does not exist */
00724     if (!isfile (fname))
00725     {
00726     logoff = 1;
00727     goto out;
00728     }
00729
00730     if (trace)
00731     fprintf (stderr, "%s-> fopen(%s,a)\n",
00732          CLIENT_SERVER_STR, fname);
00733     if (noexec)
00734     goto out;
00735     fd = CVS_OPEN (fname, O_WRONLY | O_APPEND | O_CREAT | OPEN_BINARY, 0666);
00736     if (fd < 0)
00737     {
00738     if (! really_quiet)
00739         {
00740             error (0, errno, "warning: cannot write to history file %s",
00741                    fname);
00742         }
00743         goto out;
00744     }
00745
00746     repos = Short_Repository (repository);
00747
00748     if (!PrCurDir)
00749     {
00750     char *pwdir;
00751
00752     pwdir = get_homedir ();
00753     PrCurDir = CurDir;
00754     if (pwdir != NULL)
00755     {
00756         /* Assumes neither CurDir nor pwdir ends in '/' */
00757         i = strlen (pwdir);
00758         if (!strncmp (CurDir, pwdir, i))
00759         {
00760         PrCurDir += i;      /* Point to '/' separator */
00761         tilde = "~";
00762         }
00763         else
00764         {
00765         /* Try harder to find a "homedir" */
00766         struct saved_cwd cwd;
00767         char *homedir;
00768
00769         if (save_cwd (&cwd))
00770             error_exit ();
00771
00772         if ( CVS_CHDIR (pwdir) < 0)
00773             error (1, errno, "can't chdir(%s)", pwdir);
00774         homedir = xgetwd ();
00775         if (homedir == NULL)
00776             error (1, errno, "can't getwd in %s", pwdir);
00777
00778         if (restore_cwd (&cwd, NULL))
00779             error_exit ();
00780         free_cwd (&cwd);
00781
00782         i = strlen (homedir);
00783         if (!strncmp (CurDir, homedir, i))
00784         {
00785             PrCurDir += i;  /* Point to '/' separator */
00786             tilde = "~";
00787         }
00788         free (homedir);
00789         }
00790     }
00791     }
00792
00793     if (type == 'T')
00794     {
00795     repos = update_dir;
00796     update_dir = "";
00797     }
00798     else if (update_dir && *update_dir)
00799     slash = "/";
00800     else
00801     update_dir = "";
00802
00803     workdir = xmalloc (strlen (tilde) + strlen (PrCurDir) + strlen (slash)
00804                + strlen (update_dir) + 10);
00805     (void) sprintf (workdir, "%s%s%s%s", tilde, PrCurDir, slash, update_dir);
00806
00807     /*
00808      * "workdir" is the directory where the file "name" is. ("^~" == $HOME)
00809      * "repos"  is the Repository, relative to $CVSROOT where the RCS file is.
00810      *
00811      * "$workdir/$name" is the working file name.
00812      * "$CVSROOT/$repos/$name,v" is the RCS file in the Repository.
00813      *
00814      * First, note that the history format was intended to save space, not
00815      * to be human readable.
00816      *
00817      * The working file directory ("workdir") and the Repository ("repos")
00818      * usually end with the same one or more directory elements.  To avoid
00819      * duplication (and save space), the "workdir" field ends with
00820      * an integer offset into the "repos" field.  This offset indicates the
00821      * beginning of the "tail" of "repos", after which all characters are
00822      * duplicates.
00823      *
00824      * In other words, if the "workdir" field has a '*' (a very stupid thing
00825      * to put in a filename) in it, then every thing following the last '*'
00826      * is a hex offset into "repos" of the first character from "repos" to
00827      * append to "workdir" to finish the pathname.
00828      *
00829      * It might be easier to look at an example:
00830      *
00831      *  M273b3463|dgg|~/work*9|usr/local/cvs/examples|1.2|loginfo
00832      *
00833      * Indicates that the workdir is really "~/work/cvs/examples", saving
00834      * 10 characters, where "~/work*d" would save 6 characters and mean that
00835      * the workdir is really "~/work/examples".  It will mean more on
00836      * directories like: usr/local/gnu/emacs/dist-19.17/lisp/term
00837      *
00838      * "workdir" is always an absolute pathname (~/xxx is an absolute path)
00839      * "repos" is always a relative pathname.  So we can assume that we will
00840      * never run into the top of "workdir" -- there will always be a '/' or
00841      * a '~' at the head of "workdir" that is not matched by anything in
00842      * "repos".  On the other hand, we *can* run off the top of "repos".
00843      *
00844      * Only "compress" if we save characters.
00845      */
00846
00847     if (!repos)
00848     repos = "";
00849
00850     cp = workdir + strlen (workdir) - 1;
00851     cp2 = repos + strlen (repos) - 1;
00852     for (i = 0; cp2 >= repos && cp > workdir && *cp == *cp2--; cp--)
00853     i++;
00854
00855     if (i > 2)
00856     {
00857     i = strlen (repos) - i;
00858     (void) sprintf ((cp + 1), "*%x", i);
00859     }
00860
00861     if (!revs)
00862     revs = "";
00863     line = xmalloc (strlen (username) + strlen (workdir) + strlen (repos)
00864             + strlen (revs) + strlen (name) + 100);
00865     sprintf (line, "%c%08lx|%s|%s|%s|%s|%s\n",
00866          type, (long) time ((time_t *) NULL),
00867          username, workdir, repos, revs, name);
00868
00869     /* Lessen some race conditions on non-Posix-compliant hosts.  */
00870     if (lseek (fd, (off_t) 0, SEEK_END) == -1)
00871     error (1, errno, "cannot seek to end of history file: %s", fname);
00872
00873     if (write (fd, line, strlen (line)) < 0)
00874     error (1, errno, "cannot write to history file: %s", fname);
00875     free (line);
00876     if (close (fd) != 0)
00877     error (1, errno, "cannot close history file: %s", fname);
00878     free (workdir);
00879  out:
00880     free (fname);
00881 }
00882
00883 /*
00884  * save_user() adds a user name to the user list to select.  Zero-length
00885  *      username ("") matches any user.
00886  */
00887 static void
00888 save_user (name)
00889     char *name;
00890 {
00891     if (user_count == user_max)
00892     {
00893     user_max += USER_INCREMENT;
00894     user_list = (char **) xrealloc ((char *) user_list,
00895                     (int) user_max * sizeof (char *));
00896     }
00897     user_list[user_count++] = xstrdup (name);
00898 }
00899
00900 /*
00901  * save_file() adds file name and associated module to the file list to select.
00902  *
00903  * If "dir" is null, store a file name as is.
00904  * If "name" is null, store a directory name with a '*' on the front.
00905  * Else, store concatenated "dir/name".
00906  *
00907  * Later, in the "select" stage:
00908  *  - if it starts with '*', it is prefix-matched against the repository.
00909  *  - if it has a '/' in it, it is matched against the repository/file.
00910  *  - else it is matched against the file name.
00911  */
00912 static void
00913 save_file (dir, name, module)
00914     char *dir;
00915     char *name;
00916     char *module;
00917 {
00918     char *cp;
00919     struct file_list_str *fl;
00920
00921     if (file_count == file_max)
00922     {
00923     file_max += FILE_INCREMENT;
00924     file_list = (struct file_list_str *) xrealloc ((char *) file_list,
00925                            file_max * sizeof (*fl));
00926     }
00927     fl = &file_list[file_count++];
00928     fl->l_file = cp = xmalloc (strlen (dir) + strlen (name) + 2);
00929     fl->l_module = module;
00930
00931     if (dir && *dir)
00932     {
00933     if (name && *name)
00934     {
00935         (void) strcpy (cp, dir);
00936         (void) strcat (cp, "/");
00937         (void) strcat (cp, name);
00938     }
00939     else
00940     {
00941         *cp++ = '*';
00942         (void) strcpy (cp, dir);
00943     }
00944     }
00945     else
00946     {
00947     if (name && *name)
00948     {
00949         (void) strcpy (cp, name);
00950     }
00951     else
00952     {
00953         error (0, 0, "save_file: null dir and file name");
00954     }
00955     }
00956 }
00957
00958 static void
00959 save_module (module)
00960     char *module;
00961 {
00962     if (mod_count == mod_max)
00963     {
00964     mod_max += MODULE_INCREMENT;
00965     mod_list = (char **) xrealloc ((char *) mod_list,
00966                        mod_max * sizeof (char *));
00967     }
00968     mod_list[mod_count++] = xstrdup (module);
00969 }
00970
00971 static void
00972 expand_modules ()
00973 {
00974 }
00975
00976 /* fill_hrec
00977  *
00978  * Take a ptr to 7-part history line, ending with a newline, for example:
00979  *
00980  *  M273b3463|dgg|~/work*9|usr/local/cvs/examples|1.2|loginfo
00981  *
00982  * Split it into 7 parts and drop the parts into a "struct hrec".
00983  * Return a pointer to the character following the newline.
00984  *
00985  */
00986
00987 #define NEXT_BAR(here) do { while (isspace(*line)) line++; hr->here = line; while ((c = *line++) && c != '|') ; if (!c) return; *(line - 1) = '\0'; } while (0)
00988
00989 static void
00990 fill_hrec (line, hr)
00991     char *line;
00992     struct hrec *hr;
00993 {
00994     char *cp;
00995     int c;
00996     int off;
00997     static int idx = 0;
00998     unsigned long date;
00999
01000     memset ((char *) hr, 0, sizeof (*hr));
01001
01002     while (isspace ((unsigned char) *line))
01003     line++;
01004
01005     hr->type = line++;
01006     (void) sscanf (line, "%lx", &date);
01007     hr->date = date;
01008     while (*line && strchr ("0123456789abcdefABCDEF", *line))
01009     line++;
01010     if (*line == '\0')
01011     return;
01012
01013     line++;
01014     NEXT_BAR (user);
01015     NEXT_BAR (dir);
01016     if ((cp = strrchr (hr->dir, '*')) != NULL)
01017     {
01018     *cp++ = '\0';
01019     (void) sscanf (cp, "%x", &off);
01020     hr->end = line + off;
01021     }
01022     else
01023     hr->end = line - 1;     /* A handy pointer to '\0' */
01024     NEXT_BAR (repos);
01025     NEXT_BAR (rev);
01026     hr->idx = idx++;
01027     if (strchr ("FOET", *(hr->type)))
01028     hr->mod = line;
01029
01030     NEXT_BAR (file);
01031 }
01032
01033
01034 #ifndef STAT_BLOCKSIZE
01035 #if HAVE_ST_BLKSIZE
01036 #define STAT_BLOCKSIZE(s) (s).st_blksize
01037 #else
01038 #define STAT_BLOCKSIZE(s) (4 * 1024)
01039 #endif
01040 #endif
01041
01042
01043 /* read_hrecs's job is to read the history file and fill in all the "hrec"
01044  * (history record) array elements with the ones we need to print.
01045  *
01046  * Logic:
01047  * - Read a block from the file.
01048  * - Walk through the block parsing line into hr records.
01049  * - if the hr isn't used, free its strings, if it is, bump the hrec counter
01050  * - at the end of a block, copy the end of the current block to the start
01051  * of space for the next block, then read in the next block.  If we get less
01052  * than the whole block, we're done.
01053  */
01054 static void
01055 read_hrecs (fname)
01056     char *fname;
01057 {
01058     unsigned char *cpstart, *cp, *nl;
01059     char *hrline;
01060     int i;
01061     int fd;
01062     struct stat st_buf;
01063
01064     if ((fd = CVS_OPEN (fname, O_RDONLY | OPEN_BINARY)) < 0)
01065     error (1, errno, "cannot open history file: %s", fname);
01066
01067     if (fstat (fd, &st_buf) < 0)
01068     error (1, errno, "can't stat history file");
01069
01070     if (!(st_buf.st_size))
01071     error (1, 0, "history file is empty");
01072
01073     cpstart = xmalloc (2 * STAT_BLOCKSIZE(st_buf));
01074     cpstart[0] = '\0';
01075     cp = cpstart;
01076
01077     hrec_max = HREC_INCREMENT;
01078     hrec_head = xmalloc (hrec_max * sizeof (struct hrec));
01079
01080     for (;;)
01081     {
01082     for (nl = cp; *nl && *nl != '\n'; nl++)
01083         if (!isprint(*nl)) *nl = ' ';
01084
01085     if (!*nl)
01086     {
01087         if (nl - cp >= STAT_BLOCKSIZE(st_buf))
01088         {
01089         error(1, 0, "history line too long (> %lu)",
01090               (unsigned long) STAT_BLOCKSIZE(st_buf));
01091         }
01092         if (nl > cp)
01093         memmove (cpstart, cp, nl - cp);
01094         nl = cpstart + (nl - cp);
01095         cp = cpstart;
01096         i = read (fd, nl, STAT_BLOCKSIZE(st_buf));
01097         if (i > 0)
01098         {
01099         nl[i] = '\0';
01100         continue;
01101         }
01102         if (i < 0)
01103         error (1, errno, "error reading history file");
01104         if (nl == cp) break;
01105         nl[1] = '\0';
01106     }
01107     *nl = '\0';
01108
01109     if (hrec_count == hrec_max)
01110     {
01111         struct hrec *old_head = hrec_head;
01112
01113         hrec_max += HREC_INCREMENT;
01114         hrec_head = xrealloc ((char *) hrec_head,
01115                   hrec_max * sizeof (struct hrec));
01116         if (last_since_tag)
01117         last_since_tag = hrec_head + (last_since_tag - old_head);
01118         if (last_backto)
01119         last_backto = hrec_head + (last_backto - old_head);
01120     }
01121
01122     /* fill_hrec dates from when history read the entire
01123        history file in one chunk, and then records were pulled out
01124        by pointing to the various parts of this big chunk.  This is
01125        why there are ugly hacks here:  I don't want to completely
01126        re-write the whole history stuff right now.  */
01127
01128     hrline = xstrdup ((char *)cp);
01129     fill_hrec (hrline, &hrec_head[hrec_count]);
01130     if (select_hrec (&hrec_head[hrec_count]))
01131         hrec_count++;
01132     else
01133         free(hrline);
01134
01135     cp = nl + 1;
01136     }
01137     free (cpstart);
01138     close (fd);
01139
01140     /* Special selection problem: If "since_tag" is set, we have saved every
01141      * record from the 1st occurrence of "since_tag", when we want to save
01142      * records since the *last* occurrence of "since_tag".  So what we have
01143      * to do is bump hrec_head forward and reduce hrec_count accordingly.
01144      */
01145     if (last_since_tag)
01146     {
01147     hrec_count -= (last_since_tag - hrec_head);
01148     hrec_head = last_since_tag;
01149     }
01150
01151     /* Much the same thing is necessary for the "backto" option. */
01152     if (last_backto)
01153     {
01154     hrec_count -= (last_backto - hrec_head);
01155     hrec_head = last_backto;
01156     }
01157 }
01158
01159 /* Utility program for determining whether "find" is inside "string" */
01160 static int
01161 within (find, string)
01162     char *find, *string;
01163 {
01164     int c, len;
01165
01166     if (!find || !string)
01167     return (0);
01168
01169     c = *find++;
01170     len = strlen (find);
01171
01172     while (*string)
01173     {
01174     if (!(string = strchr (string, c)))
01175         return (0);
01176     string++;
01177     if (!strncmp (find, string, len))
01178         return (1);
01179     }
01180     return (0);
01181 }
01182
01183 /* The purpose of "select_hrec" is to apply the selection criteria based on
01184  * the command arguments and defaults and return a flag indicating whether
01185  * this record should be remembered for printing.
01186  */
01187 static int
01188 select_hrec (hr)
01189     struct hrec *hr;
01190 {
01191     char **cpp, *cp, *cp2;
01192     struct file_list_str *fl;
01193     int count;
01194
01195     /* "Since" checking:  The argument parser guarantees that only one of the
01196      *            following four choices is set:
01197      *
01198      * 1. If "since_date" is set, it contains the date specified on the
01199      *    command line. hr->date fields earlier than "since_date" are ignored.
01200      * 2. If "since_rev" is set, it contains either an RCS "dotted" revision
01201      *    number (which is of limited use) or a symbolic TAG.  Each RCS file
01202      *    is examined and the date on the specified revision (or the revision
01203      *    corresponding to the TAG) in the RCS file (CVSROOT/repos/file) is
01204      *    compared against hr->date as in 1. above.
01205      * 3. If "since_tag" is set, matching tag records are saved.  The field
01206      *    "last_since_tag" is set to the last one of these.  Since we don't
01207      *    know where the last one will be, all records are saved from the
01208      *    first occurrence of the TAG.  Later, at the end of "select_hrec"
01209      *    records before the last occurrence of "since_tag" are skipped.
01210      * 4. If "backto" is set, all records with a module name or file name
01211      *    matching "backto" are saved.  In addition, all records with a
01212      *    repository field with a *prefix* matching "backto" are saved.
01213      *    The field "last_backto" is set to the last one of these.  As in
01214      *    3. above, "select_hrec" adjusts to include the last one later on.
01215      */
01216     if (since_date)
01217     {
01218     char *ourdate = date_from_time_t (hr->date);
01219     count = RCS_datecmp (ourdate, since_date);
01220     free (ourdate);
01221     if (count < 0)
01222         return (0);
01223     }
01224     else if (*since_rev)
01225     {
01226     Vers_TS *vers;
01227     time_t t;
01228     struct file_info finfo;
01229
01230     memset (&finfo, 0, sizeof finfo);
01231     finfo.file = hr->file;
01232     /* Not used, so don't worry about it.  */
01233     finfo.update_dir = NULL;
01234     finfo.fullname = finfo.file;
01235     finfo.repository = hr->repos;
01236     finfo.entries = NULL;
01237     finfo.rcs = NULL;
01238
01239     vers = Version_TS (&finfo, (char *) NULL, since_rev, (char *) NULL,
01240                1, 0);
01241     if (vers->vn_rcs)
01242     {
01243         if ((t = RCS_getrevtime (vers->srcfile, vers->vn_rcs, (char *) 0, 0))
01244         != (time_t) 0)
01245         {
01246         if (hr->date < t)
01247         {
01248             freevers_ts (&vers);
01249             return (0);
01250         }
01251         }
01252     }
01253     freevers_ts (&vers);
01254     }
01255     else if (*since_tag)
01256     {
01257     if (*(hr->type) == 'T')
01258     {
01259         /*
01260          * A 'T'ag record, the "rev" field holds the tag to be set,
01261          * while the "repos" field holds "D"elete, "A"dd or a rev.
01262          */
01263         if (within (since_tag, hr->rev))
01264         {
01265         last_since_tag = hr;
01266         return (1);
01267         }
01268         else
01269         return (0);
01270     }
01271     if (!last_since_tag)
01272         return (0);
01273     }
01274     else if (*backto)
01275     {
01276     if (within (backto, hr->file) || within (backto, hr->mod) ||
01277         within (backto, hr->repos))
01278         last_backto = hr;
01279     else
01280         return (0);
01281     }
01282
01283     /* User checking:
01284      *
01285      * Run down "user_list", match username ("" matches anything)
01286      * If "" is not there and actual username is not there, return failure.
01287      */
01288     if (user_list && hr->user)
01289     {
01290     for (cpp = user_list, count = user_count; count; cpp++, count--)
01291     {
01292         if (!**cpp)
01293         break;          /* null user == accept */
01294         if (!strcmp (hr->user, *cpp))   /* found listed user */
01295         break;
01296     }
01297     if (!count)
01298         return (0);         /* Not this user */
01299     }
01300
01301     /* Record type checking:
01302      *
01303      * 1. If Record type is not in rec_types field, skip it.
01304      * 2. If mod_list is null, keep everything.  Otherwise keep only modules
01305      *    on mod_list.
01306      * 3. If neither a 'T', 'F' nor 'O' record, run through "file_list".  If
01307      *    file_list is null, keep everything.  Otherwise, keep only files on
01308      *    file_list, matched appropriately.
01309      */
01310     if (!strchr (rec_types, *(hr->type)))
01311     return (0);
01312     if (!strchr ("TFOE", *(hr->type)))  /* Don't bother with "file" if "TFOE" */
01313     {
01314     if (file_list)          /* If file_list is null, accept all */
01315     {
01316         for (fl = file_list, count = file_count; count; fl++, count--)
01317         {
01318         /* 1. If file_list entry starts with '*', skip the '*' and
01319          *    compare it against the repository in the hrec.
01320          * 2. If file_list entry has a '/' in it, compare it against
01321          *    the concatenation of the repository and file from hrec.
01322          * 3. Else compare the file_list entry against the hrec file.
01323          */
01324         char *cmpfile = NULL;
01325
01326         if (*(cp = fl->l_file) == '*')
01327         {
01328             cp++;
01329             /* if argument to -p is a prefix of repository */
01330             if (!strncmp (cp, hr->repos, strlen (cp)))
01331             {
01332             hr->mod = fl->l_module;
01333             break;
01334             }
01335         }
01336         else
01337         {
01338             if (strchr (cp, '/'))
01339             {
01340             cmpfile = xmalloc (strlen (hr->repos)
01341                        + strlen (hr->file)
01342                        + 10);
01343             (void) sprintf (cmpfile, "%s/%s",
01344                     hr->repos, hr->file);
01345             cp2 = cmpfile;
01346             }
01347             else
01348             {
01349             cp2 = hr->file;
01350             }
01351
01352             /* if requested file is found within {repos}/file fields */
01353             if (within (cp, cp2))
01354             {
01355             hr->mod = fl->l_module;
01356             break;
01357             }
01358             if (cmpfile != NULL)
01359             free (cmpfile);
01360         }
01361         }
01362         if (!count)
01363         return (0);     /* String specified and no match */
01364     }
01365     }
01366     if (mod_list)
01367     {
01368     for (cpp = mod_list, count = mod_count; count; cpp++, count--)
01369     {
01370         if (hr->mod && !strcmp (hr->mod, *cpp)) /* found module */
01371         break;
01372     }
01373     if (!count)
01374         return (0); /* Module specified & this record is not one of them. */
01375     }
01376
01377     return (1);     /* Select this record unless rejected above. */
01378 }
01379
01380 /* The "sort_order" routine (when handed to qsort) has arranged for the
01381  * hrecs files to be in the right order for the report.
01382  *
01383  * Most of the "selections" are done in the select_hrec routine, but some
01384  * selections are more easily done after the qsort by "accept_hrec".
01385  */
01386 static void
01387 report_hrecs ()
01388 {
01389     struct hrec *hr, *lr;
01390     struct tm *tm;
01391     int i, count, ty;
01392     char *cp;
01393     int user_len, file_len, rev_len, mod_len, repos_len;
01394
01395     if (*since_tag && !last_since_tag)
01396     {
01397     (void) printf ("No tag found: %s\n", since_tag);
01398     return;
01399     }
01400     else if (*backto && !last_backto)
01401     {
01402     (void) printf ("No module, file or repository with: %s\n", backto);
01403     return;
01404     }
01405     else if (hrec_count < 1)
01406     {
01407     (void) printf ("No records selected.\n");
01408     return;
01409     }
01410
01411     user_len = file_len = rev_len = mod_len = repos_len = 0;
01412
01413     /* Run through lists and find maximum field widths */
01414     hr = lr = hrec_head;
01415     hr++;
01416     for (count = hrec_count; count--; lr = hr, hr++)
01417     {
01418     char *repos;
01419
01420     if (!count)
01421         hr = NULL;
01422     if (!accept_hrec (lr, hr))
01423         continue;
01424
01425     ty = *(lr->type);
01426     repos = xstrdup (lr->repos);
01427     if ((cp = strrchr (repos, '/')) != NULL)
01428     {
01429         if (lr->mod && !strcmp (++cp, lr->mod))
01430         {
01431         (void) strcpy (cp, "*");
01432         }
01433     }
01434     if ((i = strlen (lr->user)) > user_len)
01435         user_len = i;
01436     if ((i = strlen (lr->file)) > file_len)
01437         file_len = i;
01438     if (ty != 'T' && (i = strlen (repos)) > repos_len)
01439         repos_len = i;
01440     if (ty != 'T' && (i = strlen (lr->rev)) > rev_len)
01441         rev_len = i;
01442     if (lr->mod && (i = strlen (lr->mod)) > mod_len)
01443         mod_len = i;
01444     free (repos);
01445     }
01446
01447     /* Walk through hrec array setting "lr" (Last Record) to each element.
01448      * "hr" points to the record following "lr" -- It is NULL in the last
01449      * pass.
01450      *
01451      * There are two sections in the loop below:
01452      * 1. Based on the report type (e.g. extract, checkout, tag, etc.),
01453      *    decide whether the record should be printed.
01454      * 2. Based on the record type, format and print the data.
01455      */
01456     for (lr = hrec_head, hr = (lr + 1); hrec_count--; lr = hr, hr++)
01457     {
01458     char *workdir;
01459     char *repos;
01460
01461     if (!hrec_count)
01462         hr = NULL;
01463     if (!accept_hrec (lr, hr))
01464         continue;
01465
01466     ty = *(lr->type);
01467     if (!tz_local)
01468     {
01469         time_t t = lr->date + tz_seconds_east_of_GMT;
01470         tm = gmtime (&t);
01471     }
01472     else
01473         tm = localtime (&(lr->date));
01474
01475     (void) printf ("%c %04d-%02d-%02d %02d:%02d %s %-*s", ty,
01476           tm->tm_year+1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
01477           tm->tm_min, tz_name, user_len, lr->user);
01478
01479     workdir = xmalloc (strlen (lr->dir) + strlen (lr->end) + 10);
01480     (void) sprintf (workdir, "%s%s", lr->dir, lr->end);
01481     if ((cp = strrchr (workdir, '/')) != NULL)
01482     {
01483         if (lr->mod && !strcmp (++cp, lr->mod))
01484         {
01485         (void) strcpy (cp, "*");
01486         }
01487     }
01488     repos = xmalloc (strlen (lr->repos) + 10);
01489     (void) strcpy (repos, lr->repos);
01490     if ((cp = strrchr (repos, '/')) != NULL)
01491     {
01492         if (lr->mod && !strcmp (++cp, lr->mod))
01493         {
01494         (void) strcpy (cp, "*");
01495         }
01496     }
01497
01498     switch (ty)
01499     {
01500         case 'T':
01501         /* 'T'ag records: repository is a "tag type", rev is the tag */
01502         (void) printf (" %-*s [%s:%s]", mod_len, lr->mod, lr->rev,
01503                    repos);
01504         if (working)
01505             (void) printf (" {%s}", workdir);
01506         break;
01507         case 'F':
01508         case 'E':
01509         case 'O':
01510         if (lr->rev && *(lr->rev))
01511             (void) printf (" [%s]", lr->rev);
01512         (void) printf (" %-*s =%s%-*s %s", repos_len, repos, lr->mod,
01513                    mod_len + 1 - (int) strlen (lr->mod),
01514                    "=", workdir);
01515         break;
01516         case 'W':
01517         case 'U':
01518         case 'C':
01519         case 'G':
01520         case 'M':
01521         case 'A':
01522         case 'R':
01523         (void) printf (" %-*s %-*s %-*s =%s= %s", rev_len, lr->rev,
01524                    file_len, lr->file, repos_len, repos,
01525                    lr->mod ? lr->mod : "", workdir);
01526         break;
01527         default:
01528         (void) printf ("Hey! What is this junk? RecType[0x%2.2x]", ty);
01529         break;
01530     }
01531     (void) putchar ('\n');
01532     free (workdir);
01533     free (repos);
01534     }
01535 }
01536
01537 static int
01538 accept_hrec (lr, hr)
01539     struct hrec *hr, *lr;
01540 {
01541     int ty;
01542
01543     ty = *(lr->type);
01544
01545     if (last_since_tag && ty == 'T')
01546     return (1);
01547
01548     if (v_checkout)
01549     {
01550     if (ty != 'O')
01551         return (0);         /* Only interested in 'O' records */
01552
01553     /* We want to identify all the states that cause the next record
01554      * ("hr") to be different from the current one ("lr") and only
01555      * print a line at the allowed boundaries.
01556      */
01557
01558     if (!hr ||          /* The last record */
01559         strcmp (hr->user, lr->user) ||  /* User has changed */
01560         strcmp (hr->mod, lr->mod) ||/* Module has changed */
01561         (working &&         /* If must match "workdir" */
01562          (strcmp (hr->dir, lr->dir) ||  /*    and the 1st parts or */
01563           strcmp (hr->end, lr->end))))  /*    the 2nd parts differ */
01564
01565         return (1);
01566     }
01567     else if (modified)
01568     {
01569     if (!last_entry ||      /* Don't want only last rec */
01570         !hr ||          /* Last entry is a "last entry" */
01571         strcmp (hr->repos, lr->repos) ||    /* Repository has changed */
01572         strcmp (hr->file, lr->file))/* File has changed */
01573         return (1);
01574
01575     if (working)
01576     {               /* If must match "workdir" */
01577         if (strcmp (hr->dir, lr->dir) ||    /*    and the 1st parts or */
01578         strcmp (hr->end, lr->end))  /*    the 2nd parts differ */
01579         return (1);
01580     }
01581     }
01582     else if (module_report)
01583     {
01584     if (!last_entry ||      /* Don't want only last rec */
01585         !hr ||          /* Last entry is a "last entry" */
01586         strcmp (hr->mod, lr->mod) ||/* Module has changed */
01587         strcmp (hr->repos, lr->repos) ||    /* Repository has changed */
01588         strcmp (hr->file, lr->file))/* File has changed */
01589         return (1);
01590     }
01591     else
01592     {
01593     /* "extract" and "tag_report" always print selected records. */
01594     return (1);
01595     }
01596
01597     return (0);
01598 }
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/ignore.c Source File

cvs-1.10/src/ignore.c

Go to the documentation of this file.
00001 /* This program is free software; you can redistribute it and/or modify
00002    it under the terms of the GNU General Public License as published by
00003    the Free Software Foundation; either version 2, or (at your option)
00004    any later version.
00005
00006    This program is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009    GNU General Public License for more details.  */
00010
00011 /*
00012  * .cvsignore file support contributed by David G. Grubbs <dgg@odi.com>
00013  */
00014
00015 #include "cvs.h"
00016 #include "getline.h"
00017
00018 /*
00019  * Ignore file section.
00020  *
00021  *  "!" may be included any time to reset the list (i.e. ignore nothing);
00022  *  "*" may be specified to ignore everything.  It stays as the first
00023  *      element forever, unless a "!" clears it out.
00024  */
00025
00026 static char **ign_list;         /* List of files to ignore in update
00027                      * and import */
00028 static char **s_ign_list = NULL;
00029 static int ign_count;           /* Number of active entries */
00030 static int s_ign_count = 0;
00031 static int ign_size;            /* This many slots available (plus
00032                      * one for a NULL) */
00033 static int ign_hold = -1;       /* Index where first "temporary" item
00034                      * is held */
00035
00036 const char *ign_default = ". .. core RCSLOG tags TAGS RCS SCCS .make.state\
00037  .nse_depinfo #* .#* cvslog.* ,* CVS CVS.adm .del-* *.a *.olb *.o *.obj\
00038  *.so *.Z *~ *.old *.elc *.ln *.bak *.BAK *.orig *.rej *.exe _$* *$";
00039
00040 #define IGN_GROW 16         /* grow the list by 16 elements at a
00041                      * time */
00042
00043 /* Nonzero if we have encountered an -I ! directive, which means one should
00044    no longer ask the server about what is in CVSROOTADM_IGNORE.  */
00045 int ign_inhibit_server;
00046
00047 /*
00048  * To the "ignore list", add the hard-coded default ignored wildcards above,
00049  * the wildcards found in $CVSROOT/CVSROOT/cvsignore, the wildcards found in
00050  * ~/.cvsignore and the wildcards found in the CVSIGNORE environment
00051  * variable.
00052  */
00053 void
00054 ign_setup ()
00055 {
00056     char *home_dir;
00057     char *tmp;
00058
00059     ign_inhibit_server = 0;
00060
00061     /* Start with default list and special case */
00062     tmp = xstrdup (ign_default);
00063     ign_add (tmp, 0);
00064     free (tmp);
00065
00066 #ifdef CLIENT_SUPPORT
00067     /* The client handles another way, by (after it does its own ignore file
00068        processing, and only if !ign_inhibit_server), letting the server
00069        know about the files and letting it decide whether to ignore
00070        them based on CVSROOOTADM_IGNORE.  */
00071     if (!client_active)
00072 #endif
00073     {
00074     char *file = xmalloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM)
00075                   + sizeof (CVSROOTADM_IGNORE) + 10);
00076     /* Then add entries found in repository, if it exists */
00077     (void) sprintf (file, "%s/%s/%s", CVSroot_directory,
00078             CVSROOTADM, CVSROOTADM_IGNORE);
00079     ign_add_file (file, 0);
00080     free (file);
00081     }
00082
00083     /* Then add entries found in home dir, (if user has one) and file exists */
00084     home_dir = get_homedir ();
00085     /* If we can't find a home directory, ignore ~/.cvsignore.  This may
00086        make tracking down problems a bit of a pain, but on the other
00087        hand it might be obnoxious to complain when CVS will function
00088        just fine without .cvsignore (and many users won't even know what
00089        .cvsignore is).  */
00090     if (home_dir)
00091     {
00092     char *file = xmalloc (strlen (home_dir) + sizeof (CVSDOTIGNORE) + 10);
00093     (void) sprintf (file, "%s/%s", home_dir, CVSDOTIGNORE);
00094     ign_add_file (file, 0);
00095     free (file);
00096     }
00097
00098     /* Then add entries found in CVSIGNORE environment variable. */
00099     ign_add (getenv (IGNORE_ENV), 0);
00100
00101     /* Later, add ignore entries found in -I arguments */
00102 }
00103
00104 /*
00105  * Open a file and read lines, feeding each line to a line parser. Arrange
00106  * for keeping a temporary list of wildcards at the end, if the "hold"
00107  * argument is set.
00108  */
00109 void
00110 ign_add_file (file, hold)
00111     char *file;
00112     int hold;
00113 {
00114     FILE *fp;
00115     char *line = NULL;
00116     size_t line_allocated = 0;
00117
00118     /* restore the saved list (if any) */
00119     if (s_ign_list != NULL)
00120     {
00121     int i;
00122
00123     for (i = 0; i < s_ign_count; i++)
00124         ign_list[i] = s_ign_list[i];
00125     ign_count = s_ign_count;
00126     ign_list[ign_count] = NULL;
00127
00128     s_ign_count = 0;
00129     free (s_ign_list);
00130     s_ign_list = NULL;
00131     }
00132
00133     /* is this a temporary ignore file? */
00134     if (hold)
00135     {
00136     /* re-set if we had already done a temporary file */
00137     if (ign_hold >= 0)
00138     {
00139         int i;
00140
00141         for (i = ign_hold; i < ign_count; i++)
00142         free (ign_list[i]);
00143         ign_count = ign_hold;
00144         ign_list[ign_count] = NULL;
00145     }
00146     else
00147     {
00148         ign_hold = ign_count;
00149     }
00150     }
00151
00152     /* load the file */
00153     fp = CVS_FOPEN (file, "r");
00154     if (fp == NULL)
00155     {
00156     if (! existence_error (errno))
00157         error (0, errno, "cannot open %s", file);
00158     return;
00159     }
00160     while (getline (&line, &line_allocated, fp) >= 0)
00161     ign_add (line, hold);
00162     if (ferror (fp))
00163     error (0, errno, "cannot read %s", file);
00164     if (fclose (fp) < 0)
00165     error (0, errno, "cannot close %s", file);
00166     free (line);
00167 }
00168
00169 /* Parse a line of space-separated wildcards and add them to the list. */
00170 void
00171 ign_add (ign, hold)
00172     char *ign;
00173     int hold;
00174 {
00175     if (!ign || !*ign)
00176     return;
00177
00178     for (; *ign; ign++)
00179     {
00180     char *mark;
00181     char save;
00182
00183     /* ignore whitespace before the token */
00184     if (isspace ((unsigned char) *ign))
00185         continue;
00186
00187     /*
00188      * if we find a single character !, we must re-set the ignore list
00189      * (saving it if necessary).  We also catch * as a special case in a
00190      * global ignore file as an optimization
00191      */
00192     if ((!*(ign+1) || isspace ((unsigned char) *(ign+1)))
00193         && (*ign == '!' || *ign == '*'))
00194     {
00195         if (!hold)
00196         {
00197         /* permanently reset the ignore list */
00198         int i;
00199
00200         for (i = 0; i < ign_count; i++)
00201             free (ign_list[i]);
00202         ign_count = 0;
00203         ign_list[0] = NULL;
00204
00205         /* if we are doing a '!', continue; otherwise add the '*' */
00206         if (*ign == '!')
00207         {
00208             ign_inhibit_server = 1;
00209             continue;
00210         }
00211         }
00212         else if (*ign == '!')
00213         {
00214         /* temporarily reset the ignore list */
00215         int i;
00216
00217         if (ign_hold >= 0)
00218         {
00219             for (i = ign_hold; i < ign_count; i++)
00220             free (ign_list[i]);
00221             ign_hold = -1;
00222         }
00223         s_ign_list = (char **) xmalloc (ign_count * sizeof (char *));
00224         for (i = 0; i < ign_count; i++)
00225             s_ign_list[i] = ign_list[i];
00226         s_ign_count = ign_count;
00227         ign_count = 0;
00228         ign_list[0] = NULL;
00229         continue;
00230         }
00231     }
00232
00233     /* If we have used up all the space, add some more */
00234     if (ign_count >= ign_size)
00235     {
00236         ign_size += IGN_GROW;
00237         ign_list = (char **) xrealloc ((char *) ign_list,
00238                        (ign_size + 1) * sizeof (char *));
00239     }
00240
00241     /* find the end of this token */
00242     for (mark = ign; *mark && !isspace ((unsigned char) *mark); mark++)
00243          /* do nothing */ ;
00244
00245     save = *mark;
00246     *mark = '\0';
00247
00248     ign_list[ign_count++] = xstrdup (ign);
00249     ign_list[ign_count] = NULL;
00250
00251     *mark = save;
00252     if (save)
00253         ign = mark;
00254     else
00255         ign = mark - 1;
00256     }
00257 }
00258
00259 /* Set to 1 if filenames should be matched in a case-insensitive
00260    fashion.  Note that, contrary to the name and placement in ignore.c,
00261    this is no longer just for ignore patterns.  */
00262 int ign_case;
00263
00264 /* Return 1 if the given filename should be ignored by update or import. */
00265 int
00266 ign_name (name)
00267     char *name;
00268 {
00269     char **cpp = ign_list;
00270
00271     if (cpp == NULL)
00272     return (0);
00273
00274     if (ign_case)
00275     {
00276     /* We do a case-insensitive match by calling fnmatch on copies of
00277        the pattern and the name which have been converted to
00278        lowercase.  FIXME: would be much cleaner to just unify this
00279        with the other case-insensitive fnmatch stuff (FOLD_FN_CHAR
00280        in lib/fnmatch.c; os2_fnmatch in emx/system.c).  */
00281     char *name_lower;
00282     char *pat_lower;
00283     char *p;
00284
00285     name_lower = xstrdup (name);
00286     for (p = name_lower; *p != '\0'; ++p)
00287         *p = tolower (*p);
00288     while (*cpp)
00289     {
00290         pat_lower = xstrdup (*cpp++);
00291         for (p = pat_lower; *p != '\0'; ++p)
00292         *p = tolower (*p);
00293         if (CVS_FNMATCH (pat_lower, name_lower, 0) == 0)
00294         goto matched;
00295         free (pat_lower);
00296     }
00297     free (name_lower);
00298     return 0;
00299       matched:
00300     free (name_lower);
00301     free (pat_lower);
00302     return 1;
00303     }
00304     else
00305     {
00306     while (*cpp)
00307         if (CVS_FNMATCH (*cpp++, name, 0) == 0)
00308         return 1;
00309     return 0;
00310     }
00311 }
00312
00313 /* FIXME: This list of dirs to ignore stuff seems not to be used.
00314    Really?  send_dirent_proc and update_dirent_proc both call
00315    ignore_directory and do_module calls ign_dir_add.  No doubt could
00316    use some documentation/testsuite work.  */
00317
00318 static char **dir_ign_list = NULL;
00319 static int dir_ign_max = 0;
00320 static int dir_ign_current = 0;
00321
00322 /* Add a directory to list of dirs to ignore.  */
00323 void
00324 ign_dir_add (name)
00325     char *name;
00326 {
00327     /* Make sure we've got the space for the entry.  */
00328     if (dir_ign_current <= dir_ign_max)
00329     {
00330     dir_ign_max += IGN_GROW;
00331     dir_ign_list =
00332         (char **) xrealloc (dir_ign_list,
00333                 (dir_ign_max + 1) * sizeof (char *));
00334     }
00335
00336     dir_ign_list[dir_ign_current++] = xstrdup (name);
00337 }
00338
00339
00340 /* Return nonzero if NAME is part of the list of directories to ignore.  */
00341
00342 int
00343 ignore_directory (name)
00344     char *name;
00345 {
00346     int i;
00347
00348     if (!dir_ign_list)
00349     return 0;
00350
00351     i = dir_ign_current;
00352     while (i--)
00353     {
00354     if (strncmp (name, dir_ign_list[i], strlen (dir_ign_list[i])) == 0)
00355         return 1;
00356     }
00357
00358     return 0;
00359 }
00360
00361 /*
00362  * Process the current directory, looking for files not in ILIST and
00363  * not on the global ignore list for this directory.  If we find one,
00364  * call PROC passing it the name of the file and the update dir.
00365  * ENTRIES is the entries list, which is used to identify known
00366  * directories.  ENTRIES may be NULL, in which case we assume that any
00367  * directory with a CVS administration directory is known.
00368  */
00369 void
00370 ignore_files (ilist, entries, update_dir, proc)
00371     List *ilist;
00372     List *entries;
00373     char *update_dir;
00374     Ignore_proc proc;
00375 {
00376     int subdirs;
00377     DIR *dirp;
00378     struct dirent *dp;
00379     struct stat sb;
00380     char *file;
00381     char *xdir;
00382
00383     /* Set SUBDIRS if we have subdirectory information in ENTRIES.  */
00384     if (entries == NULL)
00385     subdirs = 0;
00386     else
00387     {
00388     struct stickydirtag *sdtp;
00389
00390     sdtp = (struct stickydirtag *) entries->list->data;
00391     subdirs = sdtp == NULL || sdtp->subdirs;
00392     }
00393
00394     /* we get called with update_dir set to "." sometimes... strip it */
00395     if (strcmp (update_dir, ".") == 0)
00396     xdir = "";
00397     else
00398     xdir = update_dir;
00399
00400     dirp = CVS_OPENDIR (".");
00401     if (dirp == NULL)
00402     {
00403     error (0, errno, "cannot open current directory");
00404     return;
00405     }
00406
00407     ign_add_file (CVSDOTIGNORE, 1);
00408     wrap_add_file (CVSDOTWRAPPER, 1);
00409
00410     errno = 0;
00411     while ((dp = readdir (dirp)) != NULL)
00412     {
00413     file = dp->d_name;
00414     if (strcmp (file, ".") == 0 || strcmp (file, "..") == 0)
00415         goto continue_loop;
00416     if (findnode_fn (ilist, file) != NULL)
00417         goto continue_loop;
00418     if (subdirs)
00419     {
00420         Node *node;
00421
00422         node = findnode_fn (entries, file);
00423         if (node != NULL
00424         && ((Entnode *) node->data)->type == ENT_SUBDIR)
00425         {
00426         char *p;
00427         int dir;
00428
00429         /* For consistency with past behaviour, we only ignore
00430            this directory if there is a CVS subdirectory.
00431            This will normally be the case, but the user may
00432            have messed up the working directory somehow.  */
00433         p = xmalloc (strlen (file) + sizeof CVSADM + 10);
00434         sprintf (p, "%s/%s", file, CVSADM);
00435         dir = isdir (p);
00436         free (p);
00437         if (dir)
00438             goto continue_loop;
00439         }
00440     }
00441
00442     /* We could be ignoring FIFOs and other files which are neither
00443        regular files nor directories here.  */
00444     if (ign_name (file))
00445         goto continue_loop;
00446
00447     if (
00448 #ifdef DT_DIR
00449         dp->d_type != DT_UNKNOWN ||
00450 #endif
00451         lstat(file, &sb) != -1)
00452     {
00453
00454         if (
00455 #ifdef DT_DIR
00456         dp->d_type == DT_DIR
00457         || (dp->d_type == DT_UNKNOWN && S_ISDIR (sb.st_mode))
00458 #else
00459         S_ISDIR (sb.st_mode)
00460 #endif
00461         )
00462         {
00463         if (! subdirs)
00464         {
00465             char *temp;
00466
00467             temp = xmalloc (strlen (file) + sizeof (CVSADM) + 10);
00468             (void) sprintf (temp, "%s/%s", file, CVSADM);
00469             if (isdir (temp))
00470             {
00471             free (temp);
00472             goto continue_loop;
00473             }
00474             free (temp);
00475         }
00476         }
00477 #ifdef S_ISLNK
00478         else if (
00479 #ifdef DT_DIR
00480              dp->d_type == DT_LNK
00481              || (dp->d_type == DT_UNKNOWN && S_ISLNK(sb.st_mode))
00482 #else
00483              S_ISLNK (sb.st_mode)
00484 #endif
00485              )
00486         {
00487         goto continue_loop;
00488         }
00489 #endif
00490         }
00491
00492     (*proc) (file, xdir);
00493     continue_loop:
00494     errno = 0;
00495     }
00496     if (errno != 0)
00497     error (0, errno, "error reading current directory");
00498     (void) closedir (dirp);
00499 }
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/import.c Source File

cvs-1.10/src/import.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * "import" checks in the vendor release located in the current directory into
00009  * the CVS source repository.  The CVS vendor branch support is utilized.
00010  *
00011  * At least three arguments are expected to follow the options:
00012  *  repository  Where the source belongs relative to the CVSROOT
00013  *  VendorTag   Vendor's major tag
00014  *  VendorReleTag   Tag for this particular release
00015  *
00016  * Additional arguments specify more Vendor Release Tags.
00017  */
00018
00019 #include "cvs.h"
00020 #include "savecwd.h"
00021 #include <assert.h>
00022
00023 static char *get_comment PROTO((char *user));
00024 static int add_rev PROTO((char *message, RCSNode *rcs, char *vfile,
00025               char *vers));
00026 static int add_tags PROTO((RCSNode *rcs, char *vfile, char *vtag, int targc,
00027              char *targv[]));
00028 static int import_descend PROTO((char *message, char *vtag, int targc, char *targv[]));
00029 static int import_descend_dir PROTO((char *message, char *dir, char *vtag,
00030                    int targc, char *targv[]));
00031 static int process_import_file PROTO((char *message, char *vfile, char *vtag,
00032                 int targc, char *targv[]));
00033 static int update_rcs_file PROTO((char *message, char *vfile, char *vtag, int targc,
00034                 char *targv[], int inattic));
00035 static void add_log PROTO((int ch, char *fname));
00036
00037 static int repos_len;
00038 static char *vhead;
00039 static char *vbranch;
00040 static FILE *logfp;
00041 static char *repository;
00042 static int conflicts;
00043 static int use_file_modtime;
00044 static char *keyword_opt = NULL;
00045
00046 static const char *const import_usage[] =
00047 {
00048     "Usage: %s %s [-d] [-k subst] [-I ign] [-m msg] [-b branch]\n",
00049     "    [-W spec] repository vendor-tag release-tags...\n",
00050     "\t-d\tUse the file's modification time as the time of import.\n",
00051     "\t-k sub\tSet default RCS keyword substitution mode.\n",
00052     "\t-I ign\tMore files to ignore (! to reset).\n",
00053     "\t-b bra\tVendor branch id.\n",
00054     "\t-m msg\tLog message.\n",
00055     "\t-W spec\tWrappers specification line.\n",
00056     "(Specify the --help global option for a list of other help options)\n",
00057     NULL
00058 };
00059
00060 int
00061 import (argc, argv)
00062     int argc;
00063     char **argv;
00064 {
00065     char *message = NULL;
00066     char *tmpfile;
00067     char *cp;
00068     int i, c, msglen, err;
00069     List *ulist;
00070     Node *p;
00071     struct logfile_info *li;
00072
00073     if (argc == -1)
00074     usage (import_usage);
00075
00076     ign_setup ();
00077     wrap_setup ();
00078
00079     vbranch = xstrdup (CVSBRANCH);
00080     optind = 0;
00081     while ((c = getopt (argc, argv, "+Qqdb:m:I:k:W:")) != -1)
00082     {
00083     switch (c)
00084     {
00085         case 'Q':
00086         case 'q':
00087 #ifdef SERVER_SUPPORT
00088         /* The CVS 1.5 client sends these options (in addition to
00089            Global_option requests), so we must ignore them.  */
00090         if (!server_active)
00091 #endif
00092             error (1, 0,
00093                "-q or -Q must be specified before \"%s\"",
00094                command_name);
00095         break;
00096         case 'd':
00097 #ifdef SERVER_SUPPORT
00098         if (server_active)
00099         {
00100             /* CVS 1.10 and older clients will send this, but it
00101                doesn't do any good.  So tell the user we can't
00102                cope, rather than silently losing.  */
00103             error (0, 0,
00104                "warning: not setting the time of import from the file");
00105             error (0, 0, "due to client limitations");
00106         }
00107 #endif
00108         use_file_modtime = 1;
00109         break;
00110         case 'b':
00111         free (vbranch);
00112         vbranch = xstrdup (optarg);
00113         break;
00114         case 'm':
00115 #ifdef FORCE_USE_EDITOR
00116         use_editor = 1;
00117 #else
00118         use_editor = 0;
00119 #endif
00120         message = xstrdup(optarg);
00121         break;
00122         case 'I':
00123         ign_add (optarg, 0);
00124         break;
00125             case 'k':
00126         /* RCS_check_kflag returns strings of the form -kxx.  We
00127            only use it for validation, so we can free the value
00128            as soon as it is returned. */
00129         free (RCS_check_kflag (optarg));
00130         keyword_opt = optarg;
00131         break;
00132         case 'W':
00133         wrap_add (optarg, 0);
00134         break;
00135         case '?':
00136         default:
00137         usage (import_usage);
00138         break;
00139     }
00140     }
00141     argc -= optind;
00142     argv += optind;
00143     if (argc < 3)
00144     usage (import_usage);
00145
00146 #ifdef SERVER_SUPPORT
00147     /* This is for handling the Checkin-time request.  It might seem a
00148        bit odd to enable the use_file_modtime code even in the case
00149        where Checkin-time was not sent for a particular file.  The
00150        effect is that we use the time of upload, rather than the time
00151        when we call RCS_checkin.  Since those times are both during
00152        CVS's run, that seems OK, and it is easier to implement than
00153        putting the "was Checkin-time sent" flag in CVS/Entries or some
00154        such place.  */
00155
00156     if (server_active)
00157     use_file_modtime = 1;
00158 #endif
00159
00160     for (i = 1; i < argc; i++)      /* check the tags for validity */
00161     {
00162     int j;
00163
00164     RCS_check_tag (argv[i]);
00165     for (j = 1; j < i; j++)
00166         if (strcmp (argv[j], argv[i]) == 0)
00167         error (1, 0, "tag `%s' was specified more than once", argv[i]);
00168     }
00169
00170     /* XXX - this should be a module, not just a pathname */
00171     if (! isabsolute (argv[0])
00172     && pathname_levels (argv[0]) == 0)
00173     {
00174     if (CVSroot_directory == NULL)
00175     {
00176         error (0, 0, "missing CVSROOT environment variable\n");
00177         error (1, 0, "Set it or specify the '-d' option to %s.",
00178            program_name);
00179     }
00180     repository = xmalloc (strlen (CVSroot_directory) + strlen (argv[0])
00181                   + 10);
00182     (void) sprintf (repository, "%s/%s", CVSroot_directory, argv[0]);
00183     repos_len = strlen (CVSroot_directory);
00184     }
00185     else
00186     {
00187     /* It is somewhere between a security hole and "unexpected" to
00188        let the client start mucking around outside the cvsroot
00189        (wouldn't get the right CVSROOT configuration, &c).  */
00190     error (1, 0, "directory %s not relative within the repository",
00191            argv[0]);
00192     }
00193
00194     /*
00195      * Consistency checks on the specified vendor branch.  It must be
00196      * composed of only numbers and dots ('.').  Also, for now we only
00197      * support branching to a single level, so the specified vendor branch
00198      * must only have two dots in it (like "1.1.1").
00199      */
00200     for (cp = vbranch; *cp != '\0'; cp++)
00201     if (!isdigit ((unsigned char) *cp) && *cp != '.')
00202         error (1, 0, "%s is not a numeric branch", vbranch);
00203     if (numdots (vbranch) != 2)
00204     error (1, 0, "Only branches with two dots are supported: %s", vbranch);
00205     vhead = xstrdup (vbranch);
00206     cp = strrchr (vhead, '.');
00207     *cp = '\0';
00208
00209 #ifdef CLIENT_SUPPORT
00210     if (client_active)
00211     {
00212     /* For rationale behind calling start_server before do_editor, see
00213        commit.c  */
00214     start_server ();
00215     }
00216 #endif
00217
00218     if (use_editor)
00219     {
00220     do_editor ((char *) NULL, &message, repository,
00221            (List *) NULL);
00222     }
00223     do_verify (message, repository);
00224     msglen = message == NULL ? 0 : strlen (message);
00225     if (msglen == 0 || message[msglen - 1] != '\n')
00226     {
00227     char *nm = xmalloc (msglen + 2);
00228     *nm = '\0';
00229     if (message != NULL)
00230     {
00231         (void) strcpy (nm, message);
00232         free (message);
00233     }
00234     (void) strcat (nm + msglen, "\n");
00235     message = nm;
00236     }
00237
00238 #ifdef CLIENT_SUPPORT
00239     if (client_active)
00240     {
00241     int err;
00242
00243     if (vbranch[0] != '\0')
00244         option_with_arg ("-b", vbranch);
00245     if (message)
00246         option_with_arg ("-m", message);
00247     if (keyword_opt != NULL)
00248         option_with_arg ("-k", keyword_opt);
00249     /* The only ignore processing which takes place on the server side
00250        is the CVSROOT/cvsignore file.  But if the user specified -I !,
00251        the documented behavior is to not process said file.  */
00252     if (ign_inhibit_server)
00253     {
00254         send_arg ("-I");
00255         send_arg ("!");
00256     }
00257     wrap_send ();
00258
00259     {
00260         int i;
00261         for (i = 0; i < argc; ++i)
00262         send_arg (argv[i]);
00263     }
00264
00265     logfp = stdin;
00266     client_import_setup (repository);
00267     err = import_descend (message, argv[1], argc - 2, argv + 2);
00268     client_import_done ();
00269     if (message)
00270         free (message);
00271     free (repository);
00272     free (vbranch);
00273     free (vhead);
00274     send_to_server ("import\012", 0);
00275     err += get_responses_and_close ();
00276     return err;
00277     }
00278 #endif
00279
00280     if (!safe_location ())
00281     {
00282     error (1, 0, "attempt to import the repository");
00283     }
00284
00285     /*
00286      * Make all newly created directories writable.  Should really use a more
00287      * sophisticated security mechanism here.
00288      */
00289     (void) umask (cvsumask);
00290     make_directories (repository);
00291
00292     /* Create the logfile that will be logged upon completion */
00293     tmpfile = cvs_temp_name ();
00294     if ((logfp = CVS_FOPEN (tmpfile, "w+")) == NULL)
00295     error (1, errno, "cannot create temporary file `%s'", tmpfile);
00296     /* On systems where we can unlink an open file, do so, so it will go
00297        away no matter how we exit.  FIXME-maybe: Should be checking for
00298        errors but I'm not sure which error(s) we get if we are on a system
00299        where one can't unlink open files.  */
00300     (void) CVS_UNLINK (tmpfile);
00301     (void) fprintf (logfp, "\nVendor Tag:\t%s\n", argv[1]);
00302     (void) fprintf (logfp, "Release Tags:\t");
00303     for (i = 2; i < argc; i++)
00304     (void) fprintf (logfp, "%s\n\t\t", argv[i]);
00305     (void) fprintf (logfp, "\n");
00306
00307     /* Just Do It.  */
00308     err = import_descend (message, argv[1], argc - 2, argv + 2);
00309     if (conflicts)
00310     {
00311     if (!really_quiet)
00312     {
00313         char buf[20];
00314         char *buf2;
00315
00316         cvs_output_tagged ("+importmergecmd", NULL);
00317         cvs_output_tagged ("newline", NULL);
00318         sprintf (buf, "%d", conflicts);
00319         cvs_output_tagged ("conflicts", buf);
00320         cvs_output_tagged ("text", " conflicts created by this import.");
00321         cvs_output_tagged ("newline", NULL);
00322         cvs_output_tagged ("text",
00323                    "Use the following command to help the merge:");
00324         cvs_output_tagged ("newline", NULL);
00325         cvs_output_tagged ("newline", NULL);
00326         cvs_output_tagged ("text", "\t");
00327         cvs_output_tagged ("text", program_name);
00328         if (CVSroot_cmdline != NULL)
00329         {
00330         cvs_output_tagged ("text", " -d ");
00331         cvs_output_tagged ("text", CVSroot_cmdline);
00332         }
00333         cvs_output_tagged ("text", " checkout -j");
00334         buf2 = xmalloc (strlen (argv[1]) + 20);
00335         sprintf (buf2, "%s:yesterday", argv[1]);
00336         cvs_output_tagged ("mergetag1", buf2);
00337         free (buf2);
00338         cvs_output_tagged ("text", " -j");
00339         cvs_output_tagged ("mergetag2", argv[1]);
00340         cvs_output_tagged ("text", " ");
00341         cvs_output_tagged ("repository", argv[0]);
00342         cvs_output_tagged ("newline", NULL);
00343         cvs_output_tagged ("newline", NULL);
00344         cvs_output_tagged ("-importmergecmd", NULL);
00345     }
00346
00347     /* FIXME: I'm not sure whether we need to put this information
00348            into the loginfo.  If we do, then note that it does not
00349            report any required -d option.  There is no particularly
00350            clean way to tell the server about the -d option used by
00351            the client.  */
00352     (void) fprintf (logfp, "\n%d conflicts created by this import.\n",
00353             conflicts);
00354     (void) fprintf (logfp,
00355             "Use the following command to help the merge:\n\n");
00356     (void) fprintf (logfp, "\t%s checkout ", program_name);
00357     (void) fprintf (logfp, "-j%s:yesterday -j%s %s\n\n",
00358             argv[1], argv[1], argv[0]);
00359     }
00360     else
00361     {
00362     if (!really_quiet)
00363         cvs_output ("\nNo conflicts created by this import\n\n", 0);
00364     (void) fprintf (logfp, "\nNo conflicts created by this import\n\n");
00365     }
00366
00367     /*
00368      * Write out the logfile and clean up.
00369      */
00370     ulist = getlist ();
00371     p = getnode ();
00372     p->type = UPDATE;
00373     p->delproc = update_delproc;
00374     p->key = xstrdup ("- Imported sources");
00375     li = (struct logfile_info *) xmalloc (sizeof (struct logfile_info));
00376     li->type = T_TITLE;
00377     li->tag = xstrdup (vbranch);
00378     li->rev_old = li->rev_new = NULL;
00379     p->data = (char *) li;
00380     (void) addnode (ulist, p);
00381     Update_Logfile (repository, message, logfp, ulist);
00382     dellist (&ulist);
00383     if (fclose (logfp) < 0)
00384     error (0, errno, "error closing %s", tmpfile);
00385
00386     /* Make sure the temporary file goes away, even on systems that don't let
00387        you delete a file that's in use.  */
00388     if (CVS_UNLINK (tmpfile) < 0 && !existence_error (errno))
00389     error (0, errno, "cannot remove %s", tmpfile);
00390     free (tmpfile);
00391
00392     if (message)
00393     free (message);
00394     free (repository);
00395     free (vbranch);
00396     free (vhead);
00397
00398     return (err);
00399 }
00400
00401 /* Process all the files in ".", then descend into other directories.
00402    Returns 0 for success, or >0 on error (in which case a message
00403    will have been printed).  */
00404 static int
00405 import_descend (message, vtag, targc, targv)
00406     char *message;
00407     char *vtag;
00408     int targc;
00409     char *targv[];
00410 {
00411     DIR *dirp;
00412     struct dirent *dp;
00413     int err = 0;
00414     List *dirlist = NULL;
00415
00416     /* first, load up any per-directory ignore lists */
00417     ign_add_file (CVSDOTIGNORE, 1);
00418     wrap_add_file (CVSDOTWRAPPER, 1);
00419
00420     if ((dirp = CVS_OPENDIR (".")) == NULL)
00421     {
00422     error (0, errno, "cannot open directory");
00423     err++;
00424     }
00425     else
00426     {
00427     errno = 0;
00428     while ((dp = readdir (dirp)) != NULL)
00429     {
00430         if (strcmp (dp->d_name, ".") == 0 || strcmp (dp->d_name, "..") == 0)
00431         goto one_more_time_boys;
00432 #ifdef SERVER_SUPPORT
00433         /* CVS directories are created in the temp directory by
00434            server.c because it doesn't special-case import.  So
00435            don't print a message about them, regardless of -I!.  */
00436         if (server_active && strcmp (dp->d_name, CVSADM) == 0)
00437         goto one_more_time_boys;
00438 #endif
00439         if (ign_name (dp->d_name))
00440         {
00441         add_log ('I', dp->d_name);
00442         goto one_more_time_boys;
00443         }
00444
00445         if (
00446 #ifdef DT_DIR
00447         (dp->d_type == DT_DIR
00448          || (dp->d_type == DT_UNKNOWN && isdir (dp->d_name)))
00449 #else
00450         isdir (dp->d_name)
00451 #endif
00452         && !wrap_name_has (dp->d_name, WRAP_TOCVS)
00453         )
00454         {
00455         Node *n;
00456
00457         if (dirlist == NULL)
00458             dirlist = getlist();
00459
00460         n = getnode();
00461         n->key = xstrdup (dp->d_name);
00462         addnode(dirlist, n);
00463         }
00464         else if (
00465 #ifdef DT_DIR
00466              dp->d_type == DT_LNK
00467              || (dp->d_type == DT_UNKNOWN && islink (dp->d_name))
00468 #else
00469              islink (dp->d_name)
00470 #endif
00471              )
00472         {
00473         add_log ('L', dp->d_name);
00474         err++;
00475         }
00476         else
00477         {
00478 #ifdef CLIENT_SUPPORT
00479         if (client_active)
00480             err += client_process_import_file (message, dp->d_name,
00481                                                        vtag, targc, targv,
00482                                                        repository,
00483                                                        keyword_opt != NULL &&
00484                                keyword_opt[0] == 'b',
00485                                use_file_modtime);
00486         else
00487 #endif
00488             err += process_import_file (message, dp->d_name,
00489                         vtag, targc, targv);
00490         }
00491     one_more_time_boys:
00492         errno = 0;
00493     }
00494     if (errno != 0)
00495     {
00496         error (0, errno, "cannot read directory");
00497         ++err;
00498     }
00499     (void) closedir (dirp);
00500     }
00501
00502     if (dirlist != NULL)
00503     {
00504     Node *head, *p;
00505
00506     head = dirlist->list;
00507     for (p = head->next; p != head; p = p->next)
00508     {
00509         err += import_descend_dir (message, p->key, vtag, targc, targv);
00510     }
00511
00512     dellist(&dirlist);
00513     }
00514
00515     return (err);
00516 }
00517
00518 /*
00519  * Process the argument import file.
00520  */
00521 static int
00522 process_import_file (message, vfile, vtag, targc, targv)
00523     char *message;
00524     char *vfile;
00525     char *vtag;
00526     int targc;
00527     char *targv[];
00528 {
00529     char *rcs;
00530     int inattic = 0;
00531
00532     rcs = xmalloc (strlen (repository) + strlen (vfile) + sizeof (RCSEXT)
00533            + 5);
00534     (void) sprintf (rcs, "%s/%s%s", repository, vfile, RCSEXT);
00535     if (!isfile (rcs))
00536     {
00537     char *attic_name;
00538
00539     attic_name = xmalloc (strlen (repository) + strlen (vfile) +
00540                   sizeof (CVSATTIC) + sizeof (RCSEXT) + 10);
00541     (void) sprintf (attic_name, "%s/%s/%s%s", repository, CVSATTIC,
00542             vfile, RCSEXT);
00543     if (!isfile (attic_name))
00544     {
00545         int retval;
00546         char *free_opt = NULL;
00547         char *our_opt = keyword_opt;
00548
00549         free (attic_name);
00550         /*
00551          * A new import source file; it doesn't exist as a ,v within the
00552          * repository nor in the Attic -- create it anew.
00553          */
00554         add_log ('N', vfile);
00555
00556 #ifdef SERVER_SUPPORT
00557         /* The most reliable information on whether the file is binary
00558            is what the client told us.  That is because if the client had
00559            the wrong idea about binaryness, it corrupted the file, so
00560            we might as well believe the client.  */
00561         if (server_active)
00562         {
00563         Node *node;
00564         List *entries;
00565
00566         /* Reading all the entries for each file is fairly silly, and
00567            probably slow.  But I am too lazy at the moment to do
00568            anything else.  */
00569         entries = Entries_Open (0, NULL);
00570         node = findnode_fn (entries, vfile);
00571         if (node != NULL)
00572         {
00573             Entnode *entdata = (Entnode *) node->data;
00574             if (entdata->type == ENT_FILE)
00575             {
00576             assert (entdata->options[0] == '-'
00577                 && entdata->options[1] == 'k');
00578             our_opt = xstrdup (entdata->options + 2);
00579             free_opt = our_opt;
00580             }
00581         }
00582         Entries_Close (entries);
00583         }
00584 #endif
00585
00586         retval = add_rcs_file (message, rcs, vfile, vhead, our_opt,
00587                    vbranch, vtag, targc, targv,
00588                    NULL, 0, logfp);
00589         if (free_opt != NULL)
00590         free (free_opt);
00591         free (rcs);
00592         return retval;
00593     }
00594     free (attic_name);
00595     inattic = 1;
00596     }
00597
00598     free (rcs);
00599     /*
00600      * an rcs file exists. have to do things the official, slow, way.
00601      */
00602     return (update_rcs_file (message, vfile, vtag, targc, targv, inattic));
00603 }
00604
00605 /*
00606  * The RCS file exists; update it by adding the new import file to the
00607  * (possibly already existing) vendor branch.
00608  */
00609 static int
00610 update_rcs_file (message, vfile, vtag, targc, targv, inattic)
00611     char *message;
00612     char *vfile;
00613     char *vtag;
00614     int targc;
00615     char *targv[];
00616     int inattic;
00617 {
00618     Vers_TS *vers;
00619     int letter;
00620     char *tocvsPath;
00621     struct file_info finfo;
00622
00623     memset (&finfo, 0, sizeof finfo);
00624     finfo.file = vfile;
00625     /* Not used, so don't worry about it.  */
00626     finfo.update_dir = NULL;
00627     finfo.fullname = finfo.file;
00628     finfo.repository = repository;
00629     finfo.entries = NULL;
00630     finfo.rcs = NULL;
00631     vers = Version_TS (&finfo, (char *) NULL, vbranch, (char *) NULL,
00632                1, 0);
00633     if (vers->vn_rcs != NULL
00634     && !RCS_isdead(vers->srcfile, vers->vn_rcs))
00635     {
00636     int different;
00637
00638     /*
00639      * The rcs file does have a revision on the vendor branch. Compare
00640      * this revision with the import file; if they match exactly, there
00641      * is no need to install the new import file as a new revision to the
00642      * branch.  Just tag the revision with the new import tags.
00643      *
00644      * This is to try to cut down the number of "C" conflict messages for
00645      * locally modified import source files.
00646      */
00647     tocvsPath = wrap_tocvs_process_file (vfile);
00648     /* FIXME: Why don't we pass tocvsPath to RCS_cmp_file if it is
00649            not NULL?  */
00650     different = RCS_cmp_file (vers->srcfile, vers->vn_rcs, "-ko", vfile);
00651     if (tocvsPath)
00652         if (unlink_file_dir (tocvsPath) < 0)
00653         error (0, errno, "cannot remove %s", tocvsPath);
00654
00655     if (!different)
00656     {
00657         int retval = 0;
00658
00659         /*
00660          * The two files are identical.  Just update the tags, print the
00661          * "U", signifying that the file has changed, but needs no
00662          * attention, and we're done.
00663          */
00664         if (add_tags (vers->srcfile, vfile, vtag, targc, targv))
00665         retval = 1;
00666         add_log ('U', vfile);
00667         freevers_ts (&vers);
00668         return (retval);
00669     }
00670     }
00671
00672     /* We may have failed to parse the RCS file; check just in case */
00673     if (vers->srcfile == NULL ||
00674     add_rev (message, vers->srcfile, vfile, vers->vn_rcs) ||
00675     add_tags (vers->srcfile, vfile, vtag, targc, targv))
00676     {
00677     freevers_ts (&vers);
00678     return (1);
00679     }
00680
00681     if (vers->srcfile->branch == NULL || inattic ||
00682     strcmp (vers->srcfile->branch, vbranch) != 0)
00683     {
00684     conflicts++;
00685     letter = 'C';
00686     }
00687     else
00688     letter = 'U';
00689     add_log (letter, vfile);
00690
00691     freevers_ts (&vers);
00692     return (0);
00693 }
00694
00695 /*
00696  * Add the revision to the vendor branch
00697  */
00698 static int
00699 add_rev (message, rcs, vfile, vers)
00700     char *message;
00701     RCSNode *rcs;
00702     char *vfile;
00703     char *vers;
00704 {
00705     int locked, status, ierrno;
00706     char *tocvsPath;
00707
00708     if (noexec)
00709     return (0);
00710
00711     locked = 0;
00712     if (vers != NULL)
00713     {
00714     /* Before RCS_lock existed, we were directing stdout, as well as
00715        stderr, from the RCS command, to DEVNULL.  I wouldn't guess that
00716        was necessary, but I don't know for sure.  */
00717     /* Earlier versions of this function printed a `fork failed' error
00718        when RCS_lock returned an error code.  That's not appropriate
00719        now that RCS_lock is librarified, but should the error text be
00720        preserved? */
00721     if (RCS_lock (rcs, vbranch, 1) != 0)
00722         return 1;
00723     locked = 1;
00724     RCS_rewrite (rcs, NULL, NULL);
00725     }
00726     tocvsPath = wrap_tocvs_process_file (vfile);
00727
00728     status = RCS_checkin (rcs, tocvsPath == NULL ? vfile : tocvsPath,
00729               message, vbranch,
00730               (RCS_FLAGS_QUIET | RCS_FLAGS_KEEPFILE
00731                | (use_file_modtime ? RCS_FLAGS_MODTIME : 0)));
00732     ierrno = errno;
00733
00734     if ((tocvsPath != NULL) && (unlink_file_dir (tocvsPath) < 0))
00735     error (0, errno, "cannot remove %s", tocvsPath);
00736
00737     if (status)
00738     {
00739     if (!noexec)
00740     {
00741         fperrmsg (logfp, 0, status == -1 ? ierrno : 0,
00742               "ERROR: Check-in of %s failed", rcs->path);
00743         error (0, status == -1 ? ierrno : 0,
00744            "ERROR: Check-in of %s failed", rcs->path);
00745     }
00746     if (locked)
00747     {
00748         (void) RCS_unlock(rcs, vbranch, 0);
00749         RCS_rewrite (rcs, NULL, NULL);
00750     }
00751     return (1);
00752     }
00753     return (0);
00754 }
00755
00756 /*
00757  * Add the vendor branch tag and all the specified import release tags to the
00758  * RCS file.  The vendor branch tag goes on the branch root (1.1.1) while the
00759  * vendor release tags go on the newly added leaf of the branch (1.1.1.1,
00760  * 1.1.1.2, ...).
00761  */
00762 static int
00763 add_tags (rcs, vfile, vtag, targc, targv)
00764     RCSNode *rcs;
00765     char *vfile;
00766     char *vtag;
00767     int targc;
00768     char *targv[];
00769 {
00770     int i, ierrno;
00771     Vers_TS *vers;
00772     int retcode = 0;
00773     struct file_info finfo;
00774
00775     if (noexec)
00776     return (0);
00777
00778     if ((retcode = RCS_settag(rcs, vtag, vbranch)) != 0)
00779     {
00780     ierrno = errno;
00781     fperrmsg (logfp, 0, retcode == -1 ? ierrno : 0,
00782           "ERROR: Failed to set tag %s in %s", vtag, rcs->path);
00783     error (0, retcode == -1 ? ierrno : 0,
00784            "ERROR: Failed to set tag %s in %s", vtag, rcs->path);
00785     return (1);
00786     }
00787     RCS_rewrite (rcs, NULL, NULL);
00788
00789     memset (&finfo, 0, sizeof finfo);
00790     finfo.file = vfile;
00791     /* Not used, so don't worry about it.  */
00792     finfo.update_dir = NULL;
00793     finfo.fullname = finfo.file;
00794     finfo.repository = repository;
00795     finfo.entries = NULL;
00796     finfo.rcs = NULL;
00797     vers = Version_TS (&finfo, NULL, vtag, NULL, 1, 0);
00798     for (i = 0; i < targc; i++)
00799     {
00800     if ((retcode = RCS_settag (rcs, targv[i], vers->vn_rcs)) == 0)
00801         RCS_rewrite (rcs, NULL, NULL);
00802     else
00803     {
00804         ierrno = errno;
00805         fperrmsg (logfp, 0, retcode == -1 ? ierrno : 0,
00806               "WARNING: Couldn't add tag %s to %s", targv[i],
00807               rcs->path);
00808         error (0, retcode == -1 ? ierrno : 0,
00809            "WARNING: Couldn't add tag %s to %s", targv[i],
00810            rcs->path);
00811     }
00812     }
00813     freevers_ts (&vers);
00814     return (0);
00815 }
00816
00817 /*
00818  * Stolen from rcs/src/rcsfnms.c, and adapted/extended.
00819  */
00820 struct compair
00821 {
00822     char *suffix, *comlead;
00823 };
00824
00825 static const struct compair comtable[] =
00826 {
00827
00828 /*
00829  * comtable pairs each filename suffix with a comment leader. The comment
00830  * leader is placed before each line generated by the $Log keyword. This
00831  * table is used to guess the proper comment leader from the working file's
00832  * suffix during initial ci (see InitAdmin()). Comment leaders are needed for
00833  * languages without multiline comments; for others they are optional.
00834  *
00835  * I believe that the comment leader is unused if you are using RCS 5.7, which
00836  * decides what leader to use based on the text surrounding the $Log keyword
00837  * rather than a specified comment leader.
00838  */
00839     {"a", "-- "},           /* Ada       */
00840     {"ada", "-- "},
00841     {"adb", "-- "},
00842     {"asm", ";; "},         /* assembler (MS-DOS) */
00843     {"ads", "-- "},         /* Ada       */
00844     {"bas", "' "},              /* Visual Basic code */
00845     {"bat", ":: "},         /* batch (MS-DOS) */
00846     {"body", "-- "},            /* Ada       */
00847     {"c", " * "},           /* C         */
00848     {"c++", "// "},         /* C++ in all its infinite guises */
00849     {"cc", "// "},
00850     {"cpp", "// "},
00851     {"cxx", "// "},
00852     {"m", "// "},           /* Objective-C */
00853     {"cl", ";;; "},         /* Common Lisp   */
00854     {"cmd", ":: "},         /* command (OS/2) */
00855     {"cmf", "c "},          /* CM Fortran    */
00856     {"cs", " * "},          /* C*        */
00857     {"csh", "# "},          /* shell     */
00858     {"dlg", " * "},             /* MS Windows dialog file */
00859     {"e", "# "},            /* efl       */
00860     {"epsf", "% "},         /* encapsulated postscript */
00861     {"epsi", "% "},         /* encapsulated postscript */
00862     {"el", "; "},           /* Emacs Lisp    */
00863     {"f", "c "},            /* Fortran   */
00864     {"for", "c "},
00865     {"frm", "' "},              /* Visual Basic form */
00866     {"h", " * "},           /* C-header  */
00867     {"hh", "// "},          /* C++ header    */
00868     {"hpp", "// "},
00869     {"hxx", "// "},
00870     {"in", "# "},           /* for Makefile.in */
00871     {"l", " * "},           /* lex (conflict between lex and
00872                      * franzlisp) */
00873     {"mac", ";; "},         /* macro (DEC-10, MS-DOS, PDP-11,
00874                      * VMS, etc) */
00875     {"mak", "# "},              /* makefile, e.g. Visual C++ */
00876     {"me", ".\\\" "},           /* me-macros    t/nroff  */
00877     {"ml", "; "},           /* mocklisp  */
00878     {"mm", ".\\\" "},           /* mm-macros    t/nroff  */
00879     {"ms", ".\\\" "},           /* ms-macros    t/nroff  */
00880     {"man", ".\\\" "},          /* man-macros   t/nroff  */
00881     {"1", ".\\\" "},            /* feeble attempt at man pages... */
00882     {"2", ".\\\" "},
00883     {"3", ".\\\" "},
00884     {"4", ".\\\" "},
00885     {"5", ".\\\" "},
00886     {"6", ".\\\" "},
00887     {"7", ".\\\" "},
00888     {"8", ".\\\" "},
00889     {"9", ".\\\" "},
00890     {"p", " * "},           /* pascal    */
00891     {"pas", " * "},
00892     {"pl", "# "},           /* perl (conflict with Prolog) */
00893     {"ps", "% "},           /* postscript    */
00894     {"psw", "% "},          /* postscript wrap */
00895     {"pswm", "% "},         /* postscript wrap */
00896     {"r", "# "},            /* ratfor    */
00897     {"rc", " * "},          /* Microsoft Windows resource file */
00898     {"red", "% "},          /* psl/rlisp     */
00899 #ifdef sparc
00900     {"s", "! "},            /* assembler     */
00901 #endif
00902 #ifdef mc68000
00903     {"s", "| "},            /* assembler     */
00904 #endif
00905 #ifdef pdp11
00906     {"s", "/ "},            /* assembler     */
00907 #endif
00908 #ifdef vax
00909     {"s", "# "},            /* assembler     */
00910 #endif
00911 #ifdef __ksr__
00912     {"s", "# "},            /* assembler     */
00913     {"S", "# "},            /* Macro assembler */
00914 #endif
00915     {"sh", "# "},           /* shell     */
00916     {"sl", "% "},           /* psl       */
00917     {"spec", "-- "},            /* Ada       */
00918     {"tex", "% "},          /* tex       */
00919     {"y", " * "},           /* yacc      */
00920     {"ye", " * "},          /* yacc-efl  */
00921     {"yr", " * "},          /* yacc-ratfor   */
00922     {"", "# "},             /* default for empty suffix  */
00923     {NULL, "# "}            /* default for unknown suffix;   */
00924 /* must always be last       */
00925 };
00926
00927 static char *
00928 get_comment (user)
00929     char *user;
00930 {
00931     char *cp, *suffix;
00932     char *suffix_path;
00933     int i;
00934     char *retval;
00935
00936     suffix_path = xmalloc (strlen (user) + 5);
00937     cp = strrchr (user, '.');
00938     if (cp != NULL)
00939     {
00940     cp++;
00941
00942     /*
00943      * Convert to lower-case, since we are not concerned about the
00944      * case-ness of the suffix.
00945      */
00946     (void) strcpy (suffix_path, cp);
00947     for (cp = suffix_path; *cp; cp++)
00948         if (isupper ((unsigned char) *cp))
00949         *cp = tolower (*cp);
00950     suffix = suffix_path;
00951     }
00952     else
00953     suffix = "";            /* will use the default */
00954     for (i = 0;; i++)
00955     {
00956     if (comtable[i].suffix == NULL)
00957     {
00958         /* Default.  Note we'll always hit this case before we
00959            ever return NULL.  */
00960         retval = comtable[i].comlead;
00961         break;
00962     }
00963     if (strcmp (suffix, comtable[i].suffix) == 0)
00964     {
00965         retval = comtable[i].comlead;
00966         break;
00967     }
00968     }
00969     free (suffix_path);
00970     return retval;
00971 }
00972
00973 /* Create a new RCS file from scratch.
00974
00975    This probably should be moved to rcs.c now that it is called from
00976    places outside import.c.
00977
00978    Return value is 0 for success, or nonzero for failure (in which
00979    case an error message will have already been printed).  */
00980 int
00981 add_rcs_file (message, rcs, user, add_vhead, key_opt,
00982           add_vbranch, vtag, targc, targv,
00983           desctext, desclen, add_logfp)
00984     /* Log message for the addition.  Not used if add_vhead == NULL.  */
00985     char *message;
00986     /* Filename of the RCS file to create.  */
00987     char *rcs;
00988     /* Filename of the file to serve as the contents of the initial
00989        revision.  Even if add_vhead is NULL, we use this to determine
00990        the modes to give the new RCS file.  */
00991     char *user;
00992
00993     /* Revision number of head that we are adding.  Normally 1.1 but
00994        could be another revision as long as ADD_VBRANCH is a branch
00995        from it.  If NULL, then just add an empty file without any
00996        revisions (similar to the one created by "rcs -i").  */
00997     char *add_vhead;
00998
00999     /* Keyword expansion mode, e.g., "b" for binary.  NULL means the
01000        default behavior.  */
01001     char *key_opt;
01002
01003     /* Vendor branch to import to, or NULL if none.  If non-NULL, then
01004        vtag should also be non-NULL.  */
01005     char *add_vbranch;
01006     char *vtag;
01007     int targc;
01008     char *targv[];
01009
01010     /* If non-NULL, description for the file.  If NULL, the description
01011        will be empty.  */
01012     char *desctext;
01013     size_t desclen;
01014
01015     /* Write errors to here as well as via error (), or NULL if we should
01016        use only error ().  */
01017     FILE *add_logfp;
01018 {
01019     FILE *fprcs, *fpuser;
01020     struct stat sb;
01021     struct tm *ftm;
01022     time_t now;
01023     char altdate1[MAXDATELEN];
01024     char *author;
01025     int i, ierrno, err = 0;
01026     mode_t mode;
01027     char *tocvsPath;
01028     char *userfile;
01029     char *local_opt = key_opt;
01030     char *free_opt = NULL;
01031     mode_t file_type;
01032
01033     if (noexec)
01034     return (0);
01035
01036     /* Note that as the code stands now, the -k option overrides any
01037        settings in wrappers (whether CVSROOT/cvswrappers, -W, or
01038        whatever).  Some have suggested this should be the other way
01039        around.  As far as I know the documentation doesn't say one way
01040        or the other.  Before making a change of this sort, should think
01041        about what is best, document it (in cvs.texinfo and NEWS), &c.  */
01042
01043     if (local_opt == NULL)
01044     {
01045     if (wrap_name_has (user, WRAP_RCSOPTION))
01046     {
01047         local_opt = free_opt = wrap_rcsoption (user, 0);
01048     }
01049     }
01050
01051     tocvsPath = wrap_tocvs_process_file (user);
01052     userfile = (tocvsPath == NULL ? user : tocvsPath);
01053
01054     /* Opening in text mode is probably never the right thing for the
01055        server (because the protocol encodes text files in a fashion
01056        which does not depend on what the client or server OS is, as
01057        documented in cvsclient.texi), but as long as the server just
01058        runs on unix it is a moot point.  */
01059
01060     /* If PreservePermissions is set, then make sure that the file
01061        is a plain file before trying to open it.  Longstanding (although
01062        often unpopular) CVS behavior has been to follow symlinks, so we
01063        maintain that behavior if PreservePermissions is not on.
01064
01065        NOTE: this error message used to be `cannot fstat', but is now
01066        `cannot lstat'.  I don't see a way around this, since we must
01067        stat the file before opening it. -twp */
01068
01069     if (CVS_LSTAT (userfile, &sb) < 0)
01070     {
01071     /* not fatal, continue import */
01072     if (add_logfp != NULL)
01073         fperrmsg (add_logfp, 0, errno,
01074               "ERROR: cannot lstat file %s", userfile);
01075     error (0, errno, "cannot lstat file %s", userfile);
01076     goto read_error;
01077     }
01078     file_type = sb.st_mode & S_IFMT;
01079
01080     fpuser = NULL;
01081     if (!preserve_perms || file_type == S_IFREG)
01082     {
01083     fpuser = CVS_FOPEN (userfile,
01084                 ((local_opt != NULL && strcmp (local_opt, "b") == 0)
01085                  ? "rb"
01086                  : "r")
01087         );
01088     if (fpuser == NULL)
01089     {
01090         /* not fatal, continue import */
01091         if (add_logfp != NULL)
01092         fperrmsg (add_logfp, 0, errno,
01093               "ERROR: cannot read file %s", userfile);
01094         error (0, errno, "ERROR: cannot read file %s", userfile);
01095         goto read_error;
01096     }
01097     }
01098
01099     fprcs = CVS_FOPEN (rcs, "w+b");
01100     if (fprcs == NULL)
01101     {
01102     ierrno = errno;
01103     goto write_error_noclose;
01104     }
01105
01106     /*
01107      * putadmin()
01108      */
01109     if (add_vhead != NULL)
01110     {
01111     if (fprintf (fprcs, "head     %s;\012", add_vhead) < 0)
01112         goto write_error;
01113     }
01114     else
01115     {
01116     if (fprintf (fprcs, "head     ;\012") < 0)
01117         goto write_error;
01118     }
01119
01120     if (add_vbranch != NULL)
01121     {
01122     if (fprintf (fprcs, "branch   %s;\012", add_vbranch) < 0)
01123         goto write_error;
01124     }
01125     if (fprintf (fprcs, "access   ;\012") < 0 ||
01126     fprintf (fprcs, "symbols  ") < 0)
01127     {
01128     goto write_error;
01129     }
01130
01131     for (i = targc - 1; i >= 0; i--)
01132     {
01133     /* RCS writes the symbols backwards */
01134     assert (add_vbranch != NULL);
01135     if (fprintf (fprcs, "%s:%s.1 ", targv[i], add_vbranch) < 0)
01136         goto write_error;
01137     }
01138
01139     if (add_vbranch != NULL)
01140     {
01141     if (fprintf (fprcs, "%s:%s", vtag, add_vbranch) < 0)
01142         goto write_error;
01143     }
01144     if (fprintf (fprcs, ";\012") < 0)
01145     goto write_error;
01146
01147     if (fprintf (fprcs, "locks    ; strict;\012") < 0 ||
01148     /* XXX - make sure @@ processing works in the RCS file */
01149     fprintf (fprcs, "comment  @%s@;\012", get_comment (user)) < 0)
01150     {
01151     goto write_error;
01152     }
01153
01154     if (local_opt != NULL)
01155     {
01156     if (fprintf (fprcs, "expand   @%s@;\012", local_opt) < 0)
01157     {
01158         goto write_error;
01159     }
01160     }
01161
01162     if (fprintf (fprcs, "\012") < 0)
01163       goto write_error;
01164
01165     /* Write the revision(s), with the date and author and so on
01166        (that is "delta" rather than "deltatext" from rcsfile(5)).  */
01167     if (add_vhead != NULL)
01168     {
01169     if (use_file_modtime)
01170         now = sb.st_mtime;
01171     else
01172         (void) time (&now);
01173     ftm = gmtime (&now);
01174     (void) sprintf (altdate1, DATEFORM,
01175             ftm->tm_year + (ftm->tm_year < 100 ? 0 : 1900),
01176             ftm->tm_mon + 1, ftm->tm_mday, ftm->tm_hour,
01177             ftm->tm_min, ftm->tm_sec);
01178     author = getcaller ();
01179
01180     if (fprintf (fprcs, "\012%s\012", add_vhead) < 0 ||
01181     fprintf (fprcs, "date     %s;  author %s;  state Exp;\012",
01182          altdate1, author) < 0)
01183     goto write_error;
01184
01185     if (fprintf (fprcs, "branches") < 0)
01186         goto write_error;
01187     if (add_vbranch != NULL)
01188     {
01189         if (fprintf (fprcs, " %s.1", add_vbranch) < 0)
01190         goto write_error;
01191     }
01192     if (fprintf (fprcs, ";\012") < 0)
01193         goto write_error;
01194
01195     if (fprintf (fprcs, "next     ;\012") < 0)
01196         goto write_error;
01197
01198 #ifdef PRESERVE_PERMISSIONS_SUPPORT
01199     /* Store initial permissions if necessary. */
01200     if (preserve_perms)
01201     {
01202         if (file_type == S_IFLNK)
01203         {
01204         char *link = xreadlink (userfile);
01205         if (fprintf (fprcs, "symlink\t@") < 0 ||
01206             expand_at_signs (link, strlen (link), fprcs) < 0 ||
01207             fprintf (fprcs, "@;\012") < 0)
01208             goto write_error;
01209         free (link);
01210         }
01211         else
01212         {
01213         if (fprintf (fprcs, "owner\t%u;\012", sb.st_uid) < 0)
01214             goto write_error;
01215         if (fprintf (fprcs, "group\t%u;\012", sb.st_gid) < 0)
01216             goto write_error;
01217         if (fprintf (fprcs, "permissions\t%o;\012",
01218                  sb.st_mode & 07777) < 0)
01219             goto write_error;
01220         switch (file_type)
01221         {
01222             case S_IFREG: break;
01223             case S_IFCHR:
01224             case S_IFBLK:
01225 #ifdef HAVE_ST_RDEV
01226             if (fprintf (fprcs, "special\t%s %lu;\012",
01227                      (file_type == S_IFCHR
01228                       ? "character"
01229                       : "block"),
01230                      (unsigned long) sb.st_rdev) < 0)
01231                 goto write_error;
01232 #else
01233             error (0, 0,
01234 "can't import %s: unable to import device files on this system",
01235 userfile);
01236 #endif
01237             break;
01238             default:
01239             error (0, 0,
01240                    "can't import %s: unknown kind of special file",
01241                    userfile);
01242         }
01243         }
01244     }
01245 #endif
01246
01247     if (add_vbranch != NULL)
01248     {
01249         if (fprintf (fprcs, "\012%s.1\012", add_vbranch) < 0 ||
01250         fprintf (fprcs, "date     %s;  author %s;  state Exp;\012",
01251              altdate1, author) < 0 ||
01252         fprintf (fprcs, "branches ;\012") < 0 ||
01253         fprintf (fprcs, "next     ;\012") < 0)
01254         goto write_error;
01255
01256 #ifdef PRESERVE_PERMISSIONS_SUPPORT
01257         /* Store initial permissions if necessary. */
01258         if (preserve_perms)
01259         {
01260         if (file_type == S_IFLNK)
01261         {
01262             char *link = xreadlink (userfile);
01263             if (fprintf (fprcs, "symlink\t@") < 0 ||
01264             expand_at_signs (link, strlen (link), fprcs) < 0 ||
01265             fprintf (fprcs, "@;\012") < 0)
01266             goto write_error;
01267             free (link);
01268         }
01269         else
01270         {
01271             if (fprintf (fprcs, "owner\t%u;\012", sb.st_uid) < 0 ||
01272             fprintf (fprcs, "group\t%u;\012", sb.st_gid) < 0 ||
01273             fprintf (fprcs, "permissions\t%o;\012",
01274                  sb.st_mode & 07777) < 0)
01275             goto write_error;
01276
01277             switch (file_type)
01278             {
01279             case S_IFREG: break;
01280             case S_IFCHR:
01281             case S_IFBLK:
01282 #ifdef HAVE_ST_RDEV
01283                 if (fprintf (fprcs, "special\t%s %lu;\012",
01284                      (file_type == S_IFCHR
01285                       ? "character"
01286                       : "block"),
01287                      (unsigned long) sb.st_rdev) < 0)
01288                 goto write_error;
01289 #else
01290                 error (0, 0,
01291 "can't import %s: unable to import device files on this system",
01292 userfile);
01293 #endif
01294                 break;
01295             default:
01296                 error (0, 0,
01297                   "cannot import %s: special file of unknown type",
01298                    userfile);
01299             }
01300         }
01301         }
01302 #endif
01303
01304         if (fprintf (fprcs, "\012") < 0)
01305         goto write_error;
01306     }
01307     }
01308
01309     /* Now write the description (possibly empty).  */
01310     if (fprintf (fprcs, "\012desc\012") < 0 ||
01311     fprintf (fprcs, "@") < 0)
01312     goto write_error;
01313     if (desctext != NULL)
01314     {
01315     /* The use of off_t not size_t for the second argument is very
01316        strange, since we are dealing with something which definitely
01317        fits in memory.  */
01318     if (expand_at_signs (desctext, (off_t) desclen, fprcs) < 0)
01319         goto write_error;
01320     }
01321     if (fprintf (fprcs, "@\012\012\012") < 0)
01322     goto write_error;
01323
01324     /* Now write the log messages and contents for the revision(s) (that
01325        is, "deltatext" rather than "delta" from rcsfile(5)).  */
01326     if (add_vhead != NULL)
01327     {
01328     if (fprintf (fprcs, "\012%s\012", add_vhead) < 0 ||
01329         fprintf (fprcs, "log\012@") < 0)
01330         goto write_error;
01331     if (add_vbranch != NULL)
01332     {
01333         /* We are going to put the log message in the revision on the
01334            branch.  So putting it here too seems kind of redundant, I
01335            guess (and that is what CVS has always done, anyway).  */
01336         if (fprintf (fprcs, "Initial revision\012") < 0)
01337         goto write_error;
01338     }
01339     else
01340     {
01341         if (expand_at_signs (message, (off_t) strlen (message), fprcs) < 0)
01342         goto write_error;
01343     }
01344     if (fprintf (fprcs, "@\012") < 0 ||
01345         fprintf (fprcs, "text\012@") < 0)
01346     {
01347         goto write_error;
01348     }
01349
01350     /* Now copy over the contents of the file, expanding at signs.
01351        If preserve_perms is set, do this only for regular files. */
01352     if (!preserve_perms || file_type == S_IFREG)
01353     {
01354         char buf[8192];
01355         unsigned int len;
01356
01357         while (1)
01358         {
01359         len = fread (buf, 1, sizeof buf, fpuser);
01360         if (len == 0)
01361         {
01362             if (ferror (fpuser))
01363             error (1, errno, "cannot read file %s for copying",
01364                    user);
01365             break;
01366         }
01367         if (expand_at_signs (buf, len, fprcs) < 0)
01368             goto write_error;
01369         }
01370     }
01371     if (fprintf (fprcs, "@\012\012") < 0)
01372         goto write_error;
01373     if (add_vbranch != NULL)
01374     {
01375         if (fprintf (fprcs, "\012%s.1\012", add_vbranch) < 0 ||
01376         fprintf (fprcs, "log\012@") < 0 ||
01377         expand_at_signs (message,
01378                  (off_t) strlen (message), fprcs) < 0 ||
01379         fprintf (fprcs, "@\012text\012") < 0 ||
01380         fprintf (fprcs, "@@\012") < 0)
01381         goto write_error;
01382     }
01383     }
01384
01385     if (fclose (fprcs) == EOF)
01386     {
01387     ierrno = errno;
01388     goto write_error_noclose;
01389     }
01390     /* Close fpuser only if we opened it to begin with. */
01391     if (fpuser != NULL)
01392     {
01393     if (fclose (fpuser) < 0)
01394         error (0, errno, "cannot close %s", user);
01395     }
01396
01397     /*
01398      * Fix the modes on the RCS files.  The user modes of the original
01399      * user file are propagated to the group and other modes as allowed
01400      * by the repository umask, except that all write permissions are
01401      * turned off.
01402      */
01403     mode = (sb.st_mode |
01404         (sb.st_mode & S_IRWXU) >> 3 |
01405         (sb.st_mode & S_IRWXU) >> 6) &
01406        ~cvsumask &
01407        ~(S_IWRITE | S_IWGRP | S_IWOTH);
01408     if (chmod (rcs, mode) < 0)
01409     {
01410     ierrno = errno;
01411     if (add_logfp != NULL)
01412         fperrmsg (add_logfp, 0, ierrno,
01413               "WARNING: cannot change mode of file %s", rcs);
01414     error (0, ierrno, "WARNING: cannot change mode of file %s", rcs);
01415     err++;
01416     }
01417     if (tocvsPath)
01418     if (unlink_file_dir (tocvsPath) < 0)
01419         error (0, errno, "cannot remove %s", tocvsPath);
01420     if (free_opt != NULL)
01421     free (free_opt);
01422     return (err);
01423
01424 write_error:
01425     ierrno = errno;
01426     if (fclose (fprcs) < 0)
01427     error (0, errno, "cannot close %s", rcs);
01428 write_error_noclose:
01429     if (fclose (fpuser) < 0)
01430     error (0, errno, "cannot close %s", user);
01431     if (add_logfp != NULL)
01432     fperrmsg (add_logfp, 0, ierrno, "ERROR: cannot write file %s", rcs);
01433     error (0, ierrno, "ERROR: cannot write file %s", rcs);
01434     if (ierrno == ENOSPC)
01435     {
01436     if (CVS_UNLINK (rcs) < 0)
01437         error (0, errno, "cannot remove %s", rcs);
01438     if (add_logfp != NULL)
01439         fperrmsg (add_logfp, 0, 0, "ERROR: out of space - aborting");
01440     error (1, 0, "ERROR: out of space - aborting");
01441     }
01442 read_error:
01443     if (tocvsPath)
01444     if (unlink_file_dir (tocvsPath) < 0)
01445         error (0, errno, "cannot remove %s", tocvsPath);
01446
01447     if (free_opt != NULL)
01448     free (free_opt);
01449
01450     return (err + 1);
01451 }
01452
01453 /*
01454  * Write SIZE bytes at BUF to FP, expanding @ signs into double @
01455  * signs.  If an error occurs, return a negative value and set errno
01456  * to indicate the error.  If not, return a nonnegative value.
01457  */
01458 int
01459 expand_at_signs (buf, size, fp)
01460     char *buf;
01461     off_t size;
01462     FILE *fp;
01463 {
01464     register char *cp, *next;
01465
01466     cp = buf;
01467     while ((next = memchr (cp, '@', size)) != NULL)
01468     {
01469     int len;
01470
01471     ++next;
01472     len = next - cp;
01473     if (fwrite (cp, 1, len, fp) != len)
01474         return EOF;
01475     if (putc ('@', fp) == EOF)
01476         return EOF;
01477     cp = next;
01478     size -= len;
01479     }
01480
01481     if (fwrite (cp, 1, size, fp) != size)
01482     return EOF;
01483
01484     return 1;
01485 }
01486
01487 /*
01488  * Write an update message to (potentially) the screen and the log file.
01489  */
01490 static void
01491 add_log (ch, fname)
01492     int ch;
01493     char *fname;
01494 {
01495     if (!really_quiet)          /* write to terminal */
01496     {
01497     char buf[2];
01498     buf[0] = ch;
01499     buf[1] = ' ';
01500     cvs_output (buf, 2);
01501     if (repos_len)
01502     {
01503         cvs_output (repository + repos_len + 1, 0);
01504         cvs_output ("/", 1);
01505     }
01506     else if (repository[0] != '\0')
01507     {
01508         cvs_output (repository, 0);
01509         cvs_output ("/", 1);
01510     }
01511     cvs_output (fname, 0);
01512     cvs_output ("\n", 1);
01513     }
01514
01515     if (repos_len)          /* write to logfile */
01516     (void) fprintf (logfp, "%c %s/%s\n", ch,
01517             repository + repos_len + 1, fname);
01518     else if (repository[0])
01519     (void) fprintf (logfp, "%c %s/%s\n", ch, repository, fname);
01520     else
01521     (void) fprintf (logfp, "%c %s\n", ch, fname);
01522 }
01523
01524 /*
01525  * This is the recursive function that walks the argument directory looking
01526  * for sub-directories that have CVS administration files in them and updates
01527  * them recursively.
01528  *
01529  * Note that we do not follow symbolic links here, which is a feature!
01530  */
01531 static int
01532 import_descend_dir (message, dir, vtag, targc, targv)
01533     char *message;
01534     char *dir;
01535     char *vtag;
01536     int targc;
01537     char *targv[];
01538 {
01539     struct saved_cwd cwd;
01540     char *cp;
01541     int ierrno, err;
01542     char *rcs = NULL;
01543
01544     if (islink (dir))
01545     return (0);
01546     if (save_cwd (&cwd))
01547     {
01548     fperrmsg (logfp, 0, 0, "ERROR: cannot get working directory");
01549     return (1);
01550     }
01551
01552     /* Concatenate DIR to the end of REPOSITORY.  */
01553     if (repository[0] == '\0')
01554     {
01555     char *new = xstrdup (dir);
01556     free (repository);
01557     repository = new;
01558     }
01559     else
01560     {
01561     char *new = xmalloc (strlen (repository) + strlen (dir) + 10);
01562     strcpy (new, repository);
01563     (void) strcat (new, "/");
01564     (void) strcat (new, dir);
01565     free (repository);
01566     repository = new;
01567     }
01568
01569 #ifdef CLIENT_SUPPORT
01570     if (!quiet && !client_active)
01571 #else
01572     if (!quiet)
01573 #endif
01574     error (0, 0, "Importing %s", repository);
01575
01576     if ( CVS_CHDIR (dir) < 0)
01577     {
01578     ierrno = errno;
01579     fperrmsg (logfp, 0, ierrno, "ERROR: cannot chdir to %s", repository);
01580     error (0, ierrno, "ERROR: cannot chdir to %s", repository);
01581     err = 1;
01582     goto out;
01583     }
01584 #ifdef CLIENT_SUPPORT
01585     if (!client_active && !isdir (repository))
01586 #else
01587     if (!isdir (repository))
01588 #endif
01589     {
01590     rcs = xmalloc (strlen (repository) + sizeof (RCSEXT) + 5);
01591     (void) sprintf (rcs, "%s%s", repository, RCSEXT);
01592     if (isfile (repository) || isfile(rcs))
01593     {
01594         fperrmsg (logfp, 0, 0,
01595               "ERROR: %s is a file, should be a directory!",
01596               repository);
01597         error (0, 0, "ERROR: %s is a file, should be a directory!",
01598            repository);
01599         err = 1;
01600         goto out;
01601     }
01602     if (noexec == 0 && CVS_MKDIR (repository, 0777) < 0)
01603     {
01604         ierrno = errno;
01605         fperrmsg (logfp, 0, ierrno,
01606               "ERROR: cannot mkdir %s -- not added", repository);
01607         error (0, ierrno,
01608            "ERROR: cannot mkdir %s -- not added", repository);
01609         err = 1;
01610         goto out;
01611     }
01612     }
01613     err = import_descend (message, vtag, targc, targv);
01614   out:
01615     if (rcs != NULL)
01616     free (rcs);
01617     if ((cp = strrchr (repository, '/')) != NULL)
01618     *cp = '\0';
01619     else
01620     repository[0] = '\0';
01621     if (restore_cwd (&cwd, NULL))
01622     error_exit ();
01623     free_cwd (&cwd);
01624     return (err);
01625 }
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/lock.c Source File

cvs-1.10/src/lock.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Set Lock
00009  *
00010  * Lock file support for CVS.
00011  */
00012
00013 /* The node Concurrency in doc/cvs.texinfo has a brief introduction to
00014    how CVS locks function, and some of the user-visible consequences of
00015    their existence.  Here is a summary of why they exist (and therefore,
00016    the consequences of hacking CVS to read a repository without creating
00017    locks):
00018
00019    There are two uses.  One is the ability to prevent there from being
00020    two writers at the same time.  This is necessary for any number of
00021    reasons (fileattr code, probably others).  Commit needs to lock the
00022    whole tree so that nothing happens between the up-to-date check and
00023    the actual checkin.
00024
00025    The second use is the ability to ensure that there is not a writer
00026    and a reader at the same time (several readers are allowed).  Reasons
00027    for this are:
00028
00029    * Readlocks ensure that once CVS has found a collection of rcs
00030    files using Find_Names, the files will still exist when it reads
00031    them (they may have moved in or out of the attic).
00032
00033    * Readlocks provide some modicum of consistency, although this is
00034    kind of limited--see the node Concurrency in cvs.texinfo.
00035
00036    * Readlocks ensure that the RCS file does not change between
00037    RCS_parse and RCS_reparsercsfile time.  This one strikes me as
00038    important, although I haven't thought up what bad scenarios might
00039    be.
00040
00041    * Readlocks ensure that we won't find the file in the state in
00042    which it is in between the calls to add_rcs_file and RCS_checkin in
00043    commit.c (when a file is being added).  This state is a state in
00044    which the RCS file parsing routines in rcs.c cannot parse the file.
00045
00046    * Readlocks ensure that a reader won't try to look at a
00047    half-written fileattr file (fileattr is not updated atomically).
00048
00049    (see also the description of anonymous read-only access in
00050    "Password authentication security" node in doc/cvs.texinfo).
00051
00052    While I'm here, I'll try to summarize a few random suggestions
00053    which periodically get made about how locks might be different:
00054
00055    1.  Check for EROFS.  Maybe useful, although in the presence of NFS
00056    EROFS does *not* mean that the file system is unchanging.
00057
00058    2.  Provide a means to put the cvs locks in some directory apart from
00059    the repository (CVSROOT/locks; a -l option in modules; etc.).
00060
00061    3.  Provide an option to disable locks for operations which only
00062    read (see above for some of the consequences).
00063
00064    4.  Have a server internally do the locking.  Probably a good
00065    long-term solution, and many people have been working hard on code
00066    changes which would eventually make it possible to have a server
00067    which can handle various connections in one process, but there is
00068    much, much work still to be done before this is feasible.
00069
00070    5.  Like #4 but use shared memory or something so that the servers
00071    merely need to all be on the same machine.  This is a much smaller
00072    change to CVS (it functions much like #2; shared memory might be an
00073    unneeded complication although it presumably would be faster).  */
00074
00075 #include "cvs.h"
00076 #include <assert.h>
00077
00078 struct lock {
00079     /* This is the directory in which we may have a lock named by the
00080        readlock variable, a lock named by the writelock variable, and/or
00081        a lock named CVSLCK.  The storage is not allocated along with the
00082        struct lock; it is allocated by the Reader_Lock caller or in the
00083        case of writelocks, it is just a pointer to the storage allocated
00084        for the ->key field.  */
00085     char *repository;
00086     /* Do we have a lock named CVSLCK?  */
00087     int have_lckdir;
00088     /* Note there is no way of knowing whether the readlock and writelock
00089        exist.  The code which sets the locks doesn't use SIG_beginCrSect
00090        to set a flag like we do for CVSLCK.  */
00091 };
00092
00093 static void remove_locks PROTO((void));
00094 static int readers_exist PROTO((char *repository));
00095 static int set_lock PROTO ((struct lock *lock, int will_wait));
00096 static void clear_lock PROTO ((struct lock *lock));
00097 static void set_lockers_name PROTO((struct stat *statp));
00098 static int set_writelock_proc PROTO((Node * p, void *closure));
00099 static int unlock_proc PROTO((Node * p, void *closure));
00100 static int write_lock PROTO ((struct lock *lock));
00101 static void lock_simple_remove PROTO ((struct lock *lock));
00102 static void lock_wait PROTO((char *repository));
00103 static void lock_obtained PROTO((char *repository));
00104
00105 /* Malloc'd array containing the username of the whoever has the lock.
00106    Will always be non-NULL in the cases where it is needed.  */
00107 static char *lockers_name;
00108 /* Malloc'd array specifying name of a readlock within a directory.
00109    Or NULL if none.  */
00110 static char *readlock;
00111 /* Malloc'd array specifying name of a writelock within a directory.
00112    Or NULL if none.  */
00113 static char *writelock;
00114 /* Malloc'd array specifying the name of a CVSLCK file (absolute pathname).
00115    Will always be non-NULL in the cases where it is used.  */
00116 static char *masterlock;
00117 static List *locklist;
00118
00119 #define L_OK        0       /* success */
00120 #define L_ERROR     1       /* error condition */
00121 #define L_LOCKED    2       /* lock owned by someone else */
00122
00123 /* This is the (single) readlock which is set by Reader_Lock.  The
00124    repository field is NULL if there is no such lock.  */
00125 static struct lock global_readlock;
00126
00127 /* List of locks set by lock_tree_for_write.  This is redundant
00128    with locklist, sort of.  */
00129 static List *lock_tree_list;
00130
00131 /* If we set locks with lock_dir_for_write, then locked_dir contains
00132    the malloc'd name of the repository directory which we have locked.
00133    locked_list is the same thing packaged into a list and is redundant
00134    with locklist the same way that lock_tree_list is.  */
00135 static char *locked_dir;
00136 static List *locked_list;
00137
00138 /* LockDir from CVSROOT/config.  */
00139 char *lock_dir;
00140
00141 static char *lock_name PROTO ((char *repository, char *name));
00142
00143 /* Return a newly malloc'd string containing the name of the lock for the
00144    repository REPOSITORY and the lock file name within that directory
00145    NAME.  Also create the directories in which to put the lock file
00146    if needed (if we need to, could save system call(s) by doing
00147    that only if the actual operation fails.  But for now we'll keep
00148    things simple).  */
00149 static char *
00150 lock_name (repository, name)
00151     char *repository;
00152     char *name;
00153 {
00154     char *retval;
00155     char *p;
00156     char *q;
00157     char *short_repos;
00158     mode_t save_umask;
00159     int saved_umask = 0;
00160
00161     if (lock_dir == NULL)
00162     {
00163     /* This is the easy case.  Because the lock files go directly
00164        in the repository, no need to create directories or anything.  */
00165     retval = xmalloc (strlen (repository) + strlen (name) + 10);
00166     (void) sprintf (retval, "%s/%s", repository, name);
00167     }
00168     else
00169     {
00170     struct stat sb;
00171     mode_t new_mode = 0;
00172
00173     /* The interesting part of the repository is the part relative
00174        to CVSROOT.  */
00175     assert (CVSroot_directory != NULL);
00176     assert (strncmp (repository, CVSroot_directory,
00177              strlen (CVSroot_directory)) == 0);
00178     short_repos = repository + strlen (CVSroot_directory) + 1;
00179
00180     if (strcmp (repository, CVSroot_directory) == 0)
00181         short_repos = ".";
00182     else
00183         assert (short_repos[-1] == '/');
00184
00185     retval = xmalloc (strlen (lock_dir)
00186               + strlen (short_repos)
00187               + strlen (name)
00188               + 10);
00189     strcpy (retval, lock_dir);
00190     q = retval + strlen (retval);
00191     *q++ = '/';
00192
00193     strcpy (q, short_repos);
00194
00195     /* In the common case, where the directory already exists, let's
00196        keep it to one system call.  */
00197     if (CVS_STAT (retval, &sb) < 0)
00198     {
00199         /* If we need to be creating more than one directory, we'll
00200            get the existence_error here.  */
00201         if (!existence_error (errno))
00202         error (1, errno, "cannot stat directory %s", retval);
00203     }
00204     else
00205     {
00206         if (S_ISDIR (sb.st_mode))
00207         goto created;
00208         else
00209         error (1, 0, "%s is not a directory", retval);
00210     }
00211
00212     /* Now add the directories one at a time, so we can create
00213        them if needed.
00214
00215        The idea behind the new_mode stuff is that the directory we
00216        end up creating will inherit permissions from its parent
00217        directory (we re-set new_mode with each EEXIST).  CVSUMASK
00218        isn't right, because typically the reason for LockDir is to
00219        use a different set of permissions.  We probably want to
00220        inherit group ownership also (but we don't try to deal with
00221        that, some systems do it for us either always or when g+s is on).
00222
00223        We don't try to do anything about the permissions on the lock
00224        files themselves.  The permissions don't really matter so much
00225        because the locks will generally be removed by the process
00226        which created them.  */
00227
00228     if (CVS_STAT (lock_dir, &sb) < 0)
00229         error (1, errno, "cannot stat %s", lock_dir);
00230     new_mode = sb.st_mode;
00231     save_umask = umask (0000);
00232     saved_umask = 1;
00233
00234     p = short_repos;
00235     while (1)
00236     {
00237         while (!ISDIRSEP (*p) && *p != '\0')
00238         ++p;
00239         if (ISDIRSEP (*p))
00240         {
00241         strncpy (q, short_repos, p - short_repos);
00242         q[p - short_repos] = '\0';
00243         if (!ISDIRSEP (q[p - short_repos - 1])
00244             && CVS_MKDIR (retval, new_mode) < 0)
00245         {
00246             int saved_errno = errno;
00247             if (saved_errno != EEXIST)
00248             error (1, errno, "cannot make directory %s", retval);
00249             else
00250             {
00251             if (CVS_STAT (retval, &sb) < 0)
00252                 error (1, errno, "cannot stat %s", retval);
00253             new_mode = sb.st_mode;
00254             }
00255         }
00256         ++p;
00257         }
00258         else
00259         {
00260         strcpy (q, short_repos);
00261         if (CVS_MKDIR (retval, new_mode) < 0
00262             && errno != EEXIST)
00263             error (1, errno, "cannot make directory %s", retval);
00264         goto created;
00265         }
00266     }
00267     created:;
00268
00269     strcat (retval, "/");
00270     strcat (retval, name);
00271
00272     if (saved_umask)
00273     {
00274         assert (umask (save_umask) == 0000);
00275         saved_umask = 0;
00276     }
00277     }
00278     return retval;
00279 }
00280
00281 /*
00282  * Clean up all outstanding locks
00283  */
00284 void
00285 Lock_Cleanup ()
00286 {
00287     /* FIXME: error handling here is kind of bogus; we sometimes will call
00288        error, which in turn can call us again.  For the moment work around
00289        this by refusing to reenter this function (this is a kludge).  */
00290     /* FIXME-reentrancy: the workaround isn't reentrant.  */
00291     static int in_lock_cleanup = 0;
00292
00293     if (in_lock_cleanup)
00294     return;
00295     in_lock_cleanup = 1;
00296
00297     remove_locks ();
00298
00299     dellist (&lock_tree_list);
00300
00301     if (locked_dir != NULL)
00302     {
00303     dellist (&locked_list);
00304     free (locked_dir);
00305     locked_dir = NULL;
00306     locked_list = NULL;
00307     }
00308     in_lock_cleanup = 0;
00309 }
00310
00311 /*
00312  * Remove locks without discarding the lock information
00313  */
00314 static void
00315 remove_locks ()
00316 {
00317     /* clean up simple locks (if any) */
00318     if (global_readlock.repository != NULL)
00319     {
00320     lock_simple_remove (&global_readlock);
00321     global_readlock.repository = NULL;
00322     }
00323
00324     /* clean up multiple locks (if any) */
00325     if (locklist != (List *) NULL)
00326     {
00327     (void) walklist (locklist, unlock_proc, NULL);
00328     locklist = (List *) NULL;
00329     }
00330 }
00331
00332 /*
00333  * walklist proc for removing a list of locks
00334  */
00335 static int
00336 unlock_proc (p, closure)
00337     Node *p;
00338     void *closure;
00339 {
00340     lock_simple_remove ((struct lock *)p->data);
00341     return (0);
00342 }
00343
00344 /* Remove the lock files.  */
00345 static void
00346 lock_simple_remove (lock)
00347     struct lock *lock;
00348 {
00349     char *tmp;
00350
00351     /* If readlock is set, the lock directory *might* have been created, but
00352        since Reader_Lock doesn't use SIG_beginCrSect the way that set_lock
00353        does, we don't know that.  That is why we need to check for
00354        existence_error here.  */
00355     if (readlock != NULL)
00356     {
00357     tmp = lock_name (lock->repository, readlock);
00358     if ( CVS_UNLINK (tmp) < 0 && ! existence_error (errno))
00359         error (0, errno, "failed to remove lock %s", tmp);
00360     free (tmp);
00361     }
00362
00363     /* If writelock is set, the lock directory *might* have been created, but
00364        since write_lock doesn't use SIG_beginCrSect the way that set_lock
00365        does, we don't know that.  That is why we need to check for
00366        existence_error here.  */
00367     if (writelock != NULL)
00368     {
00369     tmp = lock_name (lock->repository, writelock);
00370     if ( CVS_UNLINK (tmp) < 0 && ! existence_error (errno))
00371         error (0, errno, "failed to remove lock %s", tmp);
00372     free (tmp);
00373     }
00374
00375     if (lock->have_lckdir)
00376     {
00377     tmp = lock_name (lock->repository, CVSLCK);
00378     SIG_beginCrSect ();
00379     if (CVS_RMDIR (tmp) < 0)
00380         error (0, errno, "failed to remove lock dir %s", tmp);
00381     lock->have_lckdir = 0;
00382     SIG_endCrSect ();
00383     free (tmp);
00384     }
00385 }
00386
00387 /*
00388  * Create a lock file for readers
00389  */
00390 int
00391 Reader_Lock (xrepository)
00392     char *xrepository;
00393 {
00394     int err = 0;
00395     FILE *fp;
00396     char *tmp;
00397
00398     if (noexec)
00399     return (0);
00400
00401     /* we only do one directory at a time for read locks! */
00402     if (global_readlock.repository != NULL)
00403     {
00404     error (0, 0, "Reader_Lock called while read locks set - Help!");
00405     return (1);
00406     }
00407
00408     if (readlock == NULL)
00409     {
00410     readlock = xmalloc (strlen (hostname) + sizeof (CVSRFL) + 40);
00411     (void) sprintf (readlock,
00412 #ifdef HAVE_LONG_FILE_NAMES
00413             "%s.%s.%ld", CVSRFL, hostname,
00414 #else
00415             "%s.%ld", CVSRFL,
00416 #endif
00417             (long) getpid ());
00418     }
00419
00420     /* remember what we're locking (for Lock_Cleanup) */
00421     global_readlock.repository = xrepository;
00422
00423     /* get the lock dir for our own */
00424     if (set_lock (&global_readlock, 1) != L_OK)
00425     {
00426     error (0, 0, "failed to obtain dir lock in repository `%s'",
00427            xrepository);
00428     if (readlock != NULL)
00429         free (readlock);
00430     readlock = NULL;
00431     /* We don't set global_readlock.repository to NULL.  I think this
00432        only works because recurse.c will give a fatal error if we return
00433        a nonzero value.  */
00434     return (1);
00435     }
00436
00437     /* write a read-lock */
00438     tmp = lock_name (xrepository, readlock);
00439     if ((fp = CVS_FOPEN (tmp, "w+")) == NULL || fclose (fp) == EOF)
00440     {
00441     error (0, errno, "cannot create read lock in repository `%s'",
00442            xrepository);
00443     if (readlock != NULL)
00444         free (readlock);
00445     readlock = NULL;
00446     err = 1;
00447     }
00448     free (tmp);
00449
00450     /* free the lock dir */
00451     clear_lock (&global_readlock);
00452
00453     return (err);
00454 }
00455
00456 /*
00457  * Lock a list of directories for writing
00458  */
00459 static char *lock_error_repos;
00460 static int lock_error;
00461
00462 static int Writer_Lock PROTO ((List * list));
00463
00464 static int
00465 Writer_Lock (list)
00466     List *list;
00467 {
00468     char *wait_repos;
00469
00470     if (noexec)
00471     return (0);
00472
00473     /* We only know how to do one list at a time */
00474     if (locklist != (List *) NULL)
00475     {
00476     error (0, 0, "Writer_Lock called while write locks set - Help!");
00477     return (1);
00478     }
00479
00480     wait_repos = NULL;
00481     for (;;)
00482     {
00483     /* try to lock everything on the list */
00484     lock_error = L_OK;      /* init for set_writelock_proc */
00485     lock_error_repos = (char *) NULL; /* init for set_writelock_proc */
00486     locklist = list;        /* init for Lock_Cleanup */
00487     if (lockers_name != NULL)
00488         free (lockers_name);
00489     lockers_name = xstrdup ("unknown");
00490
00491     (void) walklist (list, set_writelock_proc, NULL);
00492
00493     switch (lock_error)
00494     {
00495         case L_ERROR:       /* Real Error */
00496         if (wait_repos != NULL)
00497             free (wait_repos);
00498         Lock_Cleanup ();    /* clean up any locks we set */
00499         error (0, 0, "lock failed - giving up");
00500         return (1);
00501
00502         case L_LOCKED:      /* Someone already had a lock */
00503         remove_locks ();    /* clean up any locks we set */
00504         lock_wait (lock_error_repos); /* sleep a while and try again */
00505         wait_repos = xstrdup (lock_error_repos);
00506         continue;
00507
00508         case L_OK:          /* we got the locks set */
00509             if (wait_repos != NULL)
00510         {
00511             lock_obtained (wait_repos);
00512             free (wait_repos);
00513         }
00514         return (0);
00515
00516         default:
00517         if (wait_repos != NULL)
00518             free (wait_repos);
00519         error (0, 0, "unknown lock status %d in Writer_Lock",
00520                lock_error);
00521         return (1);
00522     }
00523     }
00524 }
00525
00526 /*
00527  * walklist proc for setting write locks
00528  */
00529 static int
00530 set_writelock_proc (p, closure)
00531     Node *p;
00532     void *closure;
00533 {
00534     /* if some lock was not OK, just skip this one */
00535     if (lock_error != L_OK)
00536     return (0);
00537
00538     /* apply the write lock */
00539     lock_error_repos = p->key;
00540     lock_error = write_lock ((struct lock *)p->data);
00541     return (0);
00542 }
00543
00544 /*
00545  * Create a lock file for writers returns L_OK if lock set ok, L_LOCKED if
00546  * lock held by someone else or L_ERROR if an error occurred
00547  */
00548 static int
00549 write_lock (lock)
00550     struct lock *lock;
00551 {
00552     int status;
00553     FILE *fp;
00554     char *tmp;
00555
00556     if (writelock == NULL)
00557     {
00558     writelock = xmalloc (strlen (hostname) + sizeof (CVSWFL) + 40);
00559     (void) sprintf (writelock,
00560 #ifdef HAVE_LONG_FILE_NAMES
00561             "%s.%s.%ld", CVSWFL, hostname,
00562 #else
00563             "%s.%ld", CVSWFL,
00564 #endif
00565             (long) getpid());
00566     }
00567
00568     /* make sure the lock dir is ours (not necessarily unique to us!) */
00569     status = set_lock (lock, 0);
00570     if (status == L_OK)
00571     {
00572     /* we now own a writer - make sure there are no readers */
00573     if (readers_exist (lock->repository))
00574     {
00575         /* clean up the lock dir if we created it */
00576         if (status == L_OK)
00577         {
00578         clear_lock (lock);
00579         }
00580
00581         /* indicate we failed due to read locks instead of error */
00582         return (L_LOCKED);
00583     }
00584
00585     /* write the write-lock file */
00586     tmp = lock_name (lock->repository, writelock);
00587     if ((fp = CVS_FOPEN (tmp, "w+")) == NULL || fclose (fp) == EOF)
00588     {
00589         int xerrno = errno;
00590
00591         if ( CVS_UNLINK (tmp) < 0 && ! existence_error (errno))
00592         error (0, errno, "failed to remove lock %s", tmp);
00593
00594         /* free the lock dir if we created it */
00595         if (status == L_OK)
00596         {
00597         clear_lock (lock);
00598         }
00599
00600         /* return the error */
00601         error (0, xerrno, "cannot create write lock in repository `%s'",
00602            lock->repository);
00603         free (tmp);
00604         return (L_ERROR);
00605     }
00606     free (tmp);
00607     return (L_OK);
00608     }
00609     else
00610     return (status);
00611 }
00612
00613 /*
00614  * readers_exist() returns 0 if there are no reader lock files remaining in
00615  * the repository; else 1 is returned, to indicate that the caller should
00616  * sleep a while and try again.
00617  */
00618 static int
00619 readers_exist (repository)
00620     char *repository;
00621 {
00622     char *line;
00623     DIR *dirp;
00624     struct dirent *dp;
00625     struct stat sb;
00626     int ret = 0;
00627
00628 #ifdef CVS_FUDGELOCKS
00629 again:
00630 #endif
00631
00632     if ((dirp = CVS_OPENDIR (repository)) == NULL)
00633     error (1, 0, "cannot open directory %s", repository);
00634
00635     errno = 0;
00636     while ((dp = readdir (dirp)) != NULL)
00637     {
00638     if (CVS_FNMATCH (CVSRFLPAT, dp->d_name, 0) == 0)
00639     {
00640 #ifdef CVS_FUDGELOCKS
00641         time_t now;
00642         (void) time (&now);
00643 #endif
00644
00645         line = xmalloc (strlen (repository) + strlen (dp->d_name) + 5);
00646         (void) sprintf (line, "%s/%s", repository, dp->d_name);
00647         if ( CVS_STAT (line, &sb) != -1)
00648         {
00649 #ifdef CVS_FUDGELOCKS
00650         /*
00651          * If the create time of the file is more than CVSLCKAGE
00652          * seconds ago, try to clean-up the lock file, and if
00653          * successful, re-open the directory and try again.
00654          */
00655         if (now >= (sb.st_ctime + CVSLCKAGE) && CVS_UNLINK (line) != -1)
00656         {
00657             (void) closedir (dirp);
00658             free (line);
00659             goto again;
00660         }
00661 #endif
00662         set_lockers_name (&sb);
00663         }
00664         else
00665         {
00666         /* If the file doesn't exist, it just means that it disappeared
00667            between the time we did the readdir and the time we did
00668            the stat.  */
00669         if (!existence_error (errno))
00670             error (0, errno, "cannot stat %s", line);
00671         }
00672         errno = 0;
00673         free (line);
00674
00675         ret = 1;
00676         break;
00677     }
00678     errno = 0;
00679     }
00680     if (errno != 0)
00681     error (0, errno, "error reading directory %s", repository);
00682
00683     closedir (dirp);
00684     return (ret);
00685 }
00686
00687 /*
00688  * Set the static variable lockers_name appropriately, based on the stat
00689  * structure passed in.
00690  */
00691 static void
00692 set_lockers_name (statp)
00693     struct stat *statp;
00694 {
00695     struct passwd *pw;
00696
00697     if (lockers_name != NULL)
00698     free (lockers_name);
00699     if ((pw = (struct passwd *) getpwuid (statp->st_uid)) !=
00700     (struct passwd *) NULL)
00701     {
00702     lockers_name = xstrdup (pw->pw_name);
00703     }
00704     else
00705     {
00706     lockers_name = xmalloc (20);
00707     (void) sprintf (lockers_name, "uid%lu", (unsigned long) statp->st_uid);
00708     }
00709 }
00710
00711 /*
00712  * Persistently tries to make the directory "lckdir",, which serves as a
00713  * lock. If the create time on the directory is greater than CVSLCKAGE
00714  * seconds old, just try to remove the directory.
00715  */
00716 static int
00717 set_lock (lock, will_wait)
00718     struct lock *lock;
00719     int will_wait;
00720 {
00721     int waited;
00722     struct stat sb;
00723     mode_t omask;
00724 #ifdef CVS_FUDGELOCKS
00725     time_t now;
00726 #endif
00727
00728     if (masterlock != NULL)
00729     free (masterlock);
00730     masterlock = lock_name (lock->repository, CVSLCK);
00731
00732     /*
00733      * Note that it is up to the callers of set_lock() to arrange for signal
00734      * handlers that do the appropriate things, like remove the lock
00735      * directory before they exit.
00736      */
00737     waited = 0;
00738     lock->have_lckdir = 0;
00739     for (;;)
00740     {
00741     int status = -1;
00742     omask = umask (cvsumask);
00743     SIG_beginCrSect ();
00744     if (CVS_MKDIR (masterlock, 0777) == 0)
00745     {
00746         lock->have_lckdir = 1;
00747         SIG_endCrSect ();
00748         status = L_OK;
00749         if (waited)
00750             lock_obtained (lock->repository);
00751         goto out;
00752     }
00753     SIG_endCrSect ();
00754       out:
00755     (void) umask (omask);
00756     if (status != -1)
00757         return status;
00758
00759     if (errno != EEXIST)
00760     {
00761         error (0, errno,
00762            "failed to create lock directory for `%s' (%s)",
00763            lock->repository, masterlock);
00764         return (L_ERROR);
00765     }
00766
00767     /* Find out who owns the lock.  If the lock directory is
00768        non-existent, re-try the loop since someone probably just
00769        removed it (thus releasing the lock).  */
00770     if (CVS_STAT (masterlock, &sb) < 0)
00771     {
00772         if (existence_error (errno))
00773         continue;
00774
00775         error (0, errno, "couldn't stat lock directory `%s'", masterlock);
00776         return (L_ERROR);
00777     }
00778
00779 #ifdef CVS_FUDGELOCKS
00780     /*
00781      * If the create time of the directory is more than CVSLCKAGE seconds
00782      * ago, try to clean-up the lock directory, and if successful, just
00783      * quietly retry to make it.
00784      */
00785     (void) time (&now);
00786     if (now >= (sb.st_ctime + CVSLCKAGE))
00787     {
00788         if (CVS_RMDIR (masterlock) >= 0)
00789         continue;
00790     }
00791 #endif
00792
00793     /* set the lockers name */
00794     set_lockers_name (&sb);
00795
00796     /* if he wasn't willing to wait, return an error */
00797     if (!will_wait)
00798         return (L_LOCKED);
00799     lock_wait (lock->repository);
00800     waited = 1;
00801     }
00802 }
00803
00804 /*
00805  * Clear master lock.  We don't have to recompute the lock name since
00806  * clear_lock is never called except after a successful set_lock().
00807  */
00808 static void
00809 clear_lock (lock)
00810     struct lock *lock;
00811 {
00812     SIG_beginCrSect ();
00813     if (CVS_RMDIR (masterlock) < 0)
00814     error (0, errno, "failed to remove lock dir `%s'", masterlock);
00815     lock->have_lckdir = 0;
00816     SIG_endCrSect ();
00817 }
00818
00819 /*
00820  * Print out a message that the lock is still held, then sleep a while.
00821  */
00822 static void
00823 lock_wait (repos)
00824     char *repos;
00825 {
00826     time_t now;
00827     char *msg;
00828
00829     (void) time (&now);
00830     msg = xmalloc (100 + strlen (lockers_name) + strlen (repos));
00831     sprintf (msg, "[%8.8s] waiting for %s's lock in %s", ctime (&now) + 11,
00832          lockers_name, repos);
00833     error (0, 0, "%s", msg);
00834     /* Call cvs_flusherr to ensure that the user sees this message as
00835        soon as possible.  */
00836     cvs_flusherr ();
00837     free (msg);
00838     (void) sleep (CVSLCKSLEEP);
00839 }
00840
00841 /*
00842  * Print out a message when we obtain a lock.
00843  */
00844 static void
00845 lock_obtained (repos)
00846      char *repos;
00847 {
00848     time_t now;
00849     char *msg;
00850
00851     (void) time (&now);
00852     msg = xmalloc (100 + strlen (repos));
00853     sprintf (msg, "[%8.8s] obtained lock in %s", ctime (&now) + 11, repos);
00854     error (0, 0, "%s", msg);
00855     /* Call cvs_flusherr to ensure that the user sees this message as
00856        soon as possible.  */
00857     cvs_flusherr ();
00858     free (msg);
00859 }
00860
00861 static int lock_filesdoneproc PROTO ((void *callerdat, int err,
00862                       char *repository, char *update_dir,
00863                       List *entries));
00864
00865 /*
00866  * Create a list of repositories to lock
00867  */
00868 /* ARGSUSED */
00869 static int
00870 lock_filesdoneproc (callerdat, err, repository, update_dir, entries)
00871     void *callerdat;
00872     int err;
00873     char *repository;
00874     char *update_dir;
00875     List *entries;
00876 {
00877     Node *p;
00878
00879     p = getnode ();
00880     p->type = LOCK;
00881     p->key = xstrdup (repository);
00882     p->data = xmalloc (sizeof (struct lock));
00883     ((struct lock *)p->data)->repository = p->key;
00884     ((struct lock *)p->data)->have_lckdir = 0;
00885
00886     /* FIXME-KRP: this error condition should not simply be passed by. */
00887     if (p->key == NULL || addnode (lock_tree_list, p) != 0)
00888     freenode (p);
00889     return (err);
00890 }
00891
00892 void
00893 lock_tree_for_write (argc, argv, local, aflag)
00894     int argc;
00895     char **argv;
00896     int local;
00897     int aflag;
00898 {
00899     int err;
00900     /*
00901      * Run the recursion processor to find all the dirs to lock and lock all
00902      * the dirs
00903      */
00904     lock_tree_list = getlist ();
00905     err = start_recursion ((FILEPROC) NULL, lock_filesdoneproc,
00906                (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL, argc,
00907                argv, local, W_LOCAL, aflag, 0, (char *) NULL, 0);
00908     sortlist (lock_tree_list, fsortcmp);
00909     if (Writer_Lock (lock_tree_list) != 0)
00910     error (1, 0, "lock failed - giving up");
00911 }
00912
00913 /* Lock a single directory in REPOSITORY.  It is OK to call this if
00914    a lock has been set with lock_dir_for_write; the new lock will replace
00915    the old one.  If REPOSITORY is NULL, don't do anything.  */
00916 void
00917 lock_dir_for_write (repository)
00918      char *repository;
00919 {
00920     if (repository != NULL
00921     && (locked_dir == NULL
00922         || strcmp (locked_dir, repository) != 0))
00923     {
00924     Node *node;
00925
00926     if (locked_dir != NULL)
00927         Lock_Cleanup ();
00928
00929     locked_dir = xstrdup (repository);
00930     locked_list = getlist ();
00931     node = getnode ();
00932     node->type = LOCK;
00933     node->key = xstrdup (repository);
00934     node->data = xmalloc (sizeof (struct lock));
00935     ((struct lock *)node->data)->repository = node->key;
00936     ((struct lock *)node->data)->have_lckdir = 0;
00937
00938     (void) addnode (locked_list, node);
00939     Writer_Lock (locked_list);
00940     }
00941 }
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/log.c Source File

cvs-1.10/src/log.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Print Log Information
00009  *
00010  * Prints the RCS "log" (rlog) information for the specified files.  With no
00011  * argument, prints the log information for all the files in the directory
00012  * (recursive by default).
00013  */
00014
00015 #include "cvs.h"
00016
00017 /* This structure holds information parsed from the -r option.  */
00018
00019 struct option_revlist
00020 {
00021     /* The next -r option.  */
00022     struct option_revlist *next;
00023     /* The first revision to print.  This is NULL if the range is
00024        :rev, or if no revision is given.  */
00025     char *first;
00026     /* The last revision to print.  This is NULL if the range is rev:,
00027        or if no revision is given.  If there is no colon, first and
00028        last are the same.  */
00029     char *last;
00030     /* Nonzero if there was a trailing `.', which means to print only
00031        the head revision of a branch.  */
00032     int branchhead;
00033 };
00034
00035 /* This structure holds information derived from option_revlist given
00036    a particular RCS file.  */
00037
00038 struct revlist
00039 {
00040     /* The next pair.  */
00041     struct revlist *next;
00042     /* The first numeric revision to print.  */
00043     char *first;
00044     /* The last numeric revision to print.  */
00045     char *last;
00046     /* The number of fields in these revisions (one more than
00047        numdots).  */
00048     int fields;
00049 };
00050
00051 /* This structure holds information parsed from the -d option.  */
00052
00053 struct datelist
00054 {
00055     /* The next date.  */
00056     struct datelist *next;
00057     /* The starting date.  */
00058     char *start;
00059     /* The ending date.  */
00060     char *end;
00061     /* Nonzero if the range is inclusive rather than exclusive.  */
00062     int inclusive;
00063 };
00064
00065 /* This structure is used to pass information through start_recursion.  */
00066 struct log_data
00067 {
00068     /* Nonzero if the -R option was given, meaning that only the name
00069        of the RCS file should be printed.  */
00070     int nameonly;
00071     /* Nonzero if the -h option was given, meaning that only header
00072        information should be printed.  */
00073     int header;
00074     /* Nonzero if the -t option was given, meaning that only the
00075        header and the descriptive text should be printed.  */
00076     int long_header;
00077     /* Nonzero if the -N option was seen, meaning that tag information
00078        should not be printed.  */
00079     int notags;
00080     /* Nonzero if the -b option was seen, meaning that only revisions
00081        on the default branch should be printed.  */
00082     int default_branch;
00083     /* If not NULL, the value given for the -r option, which lists
00084        sets of revisions to be printed.  */
00085     struct option_revlist *revlist;
00086     /* If not NULL, the date pairs given for the -d option, which
00087        select date ranges to print.  */
00088     struct datelist *datelist;
00089     /* If not NULL, the single dates given for the -d option, which
00090        select specific revisions to print based on a date.  */
00091     struct datelist *singledatelist;
00092     /* If not NULL, the list of states given for the -s option, which
00093        only prints revisions of given states.  */
00094     List *statelist;
00095     /* If not NULL, the list of login names given for the -w option,
00096        which only prints revisions checked in by given users.  */
00097     List *authorlist;
00098 };
00099
00100 /* This structure is used to pass information through walklist.  */
00101 struct log_data_and_rcs
00102 {
00103     struct log_data *log_data;
00104     struct revlist *revlist;
00105     RCSNode *rcs;
00106 };
00107
00108 static Dtype log_dirproc PROTO ((void *callerdat, char *dir,
00109                  char *repository, char *update_dir,
00110                  List *entries));
00111 static int log_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00112 static struct option_revlist *log_parse_revlist PROTO ((const char *));
00113 static void log_parse_date PROTO ((struct log_data *, const char *));
00114 static void log_parse_list PROTO ((List **, const char *));
00115 static struct revlist *log_expand_revlist PROTO ((RCSNode *,
00116                           struct option_revlist *,
00117                           int));
00118 static void log_free_revlist PROTO ((struct revlist *));
00119 static int log_version_requested PROTO ((struct log_data *, struct revlist *,
00120                      RCSNode *, RCSVers *));
00121 static int log_symbol PROTO ((Node *, void *));
00122 static int log_count PROTO ((Node *, void *));
00123 static int log_fix_singledate PROTO ((Node *, void *));
00124 static int log_count_print PROTO ((Node *, void *));
00125 static void log_tree PROTO ((struct log_data *, struct revlist *,
00126                  RCSNode *, const char *));
00127 static void log_abranch PROTO ((struct log_data *, struct revlist *,
00128                 RCSNode *, const char *));
00129 static void log_version PROTO ((struct log_data *, struct revlist *,
00130                 RCSNode *, RCSVers *, int));
00131 static int log_branch PROTO ((Node *, void *));
00132 static int version_compare PROTO ((const char *, const char *, int));
00133
00134 static const char *const log_usage[] =
00135 {
00136     "Usage: %s %s [-lRhtNb] [-r[revisions]] [-d dates] [-s states]\n",
00137     "    [-w[logins]] [files...]\n",
00138     "\t-l\tLocal directory only, no recursion.\n",
00139     "\t-R\tOnly print name of RCS file.\n",
00140     "\t-h\tOnly print header.\n",
00141     "\t-t\tOnly print header and descriptive text.\n",
00142     "\t-N\tDo not list tags.\n",
00143     "\t-b\tOnly list revisions on the default branch.\n",
00144     "\t-r[revisions]\tSpecify revision(s)s to list.\n",
00145     "\t-d dates\tSpecify dates (D1<D2 for range, D for latest before).\n",
00146     "\t-s states\tOnly list revisions with specified states.\n",
00147     "\t-w[logins]\tOnly list revisions checked in by specified logins.\n",
00148     "(Specify the --help global option for a list of other help options)\n",
00149     NULL
00150 };
00151
00152 #ifdef CLIENT_SUPPORT
00153
00154 /* Helper function for send_arg_list.  */
00155 static int send_one PROTO ((Node *, void *));
00156
00157 static int
00158 send_one (node, closure)
00159     Node *node;
00160     void *closure;
00161 {
00162     char *option = (char *) closure;
00163
00164     send_to_server ("Argument ", 0);
00165     send_to_server (option, 0);
00166     if (strcmp (node->key, "@@MYSELF") == 0)
00167     /* It is a bare -w option.  Note that we must send it as
00168        -w rather than messing with getcaller() or something (which on
00169        the client will return garbage).  */
00170     ;
00171     else
00172     send_to_server (node->key, 0);
00173     send_to_server ("\012", 0);
00174     return 0;
00175 }
00176
00177 /* For each element in ARG, send an argument consisting of OPTION
00178    concatenated with that element.  */
00179 static void send_arg_list PROTO ((char *, List *));
00180
00181 static void
00182 send_arg_list (option, arg)
00183     char *option;
00184     List *arg;
00185 {
00186     if (arg == NULL)
00187     return;
00188     walklist (arg, send_one, (void *)option);
00189 }
00190
00191 #endif
00192
00193 int
00194 cvslog (argc, argv)
00195     int argc;
00196     char **argv;
00197 {
00198     int c;
00199     int err = 0;
00200     int local = 0;
00201     struct log_data log_data;
00202     struct option_revlist **prl;
00203
00204     if (argc == -1)
00205     usage (log_usage);
00206
00207     memset (&log_data, 0, sizeof log_data);
00208     prl = &log_data.revlist;
00209
00210     optind = 0;
00211     while ((c = getopt (argc, argv, "+bd:hlNRr::s:tw::")) != -1)
00212     {
00213     switch (c)
00214     {
00215         case 'b':
00216         log_data.default_branch = 1;
00217         break;
00218         case 'd':
00219         log_parse_date (&log_data, optarg);
00220         break;
00221         case 'h':
00222         log_data.header = 1;
00223         break;
00224         case 'l':
00225         local = 1;
00226         break;
00227         case 'N':
00228         log_data.notags = 1;
00229         break;
00230         case 'R':
00231         log_data.nameonly = 1;
00232         break;
00233         case 'r':
00234         *prl = log_parse_revlist (optarg);
00235         prl = &(*prl)->next;
00236         break;
00237         case 's':
00238         log_parse_list (&log_data.statelist, optarg);
00239         break;
00240         case 't':
00241         log_data.long_header = 1;
00242         break;
00243         case 'w':
00244         if (optarg != NULL)
00245             log_parse_list (&log_data.authorlist, optarg);
00246         else
00247             log_parse_list (&log_data.authorlist, "@@MYSELF");
00248         break;
00249         case '?':
00250         default:
00251         usage (log_usage);
00252         break;
00253     }
00254     }
00255
00256     wrap_setup ();
00257
00258 #ifdef CLIENT_SUPPORT
00259     if (client_active)
00260     {
00261     struct datelist *p;
00262     struct option_revlist *rp;
00263     char datetmp[MAXDATELEN];
00264
00265     /* We're the local client.  Fire up the remote server.  */
00266     start_server ();
00267
00268     ign_setup ();
00269
00270     if (log_data.default_branch)
00271         send_arg ("-b");
00272
00273     while (log_data.datelist != NULL)
00274     {
00275         p = log_data.datelist;
00276         log_data.datelist = p->next;
00277         send_to_server ("Argument -d\012", 0);
00278         send_to_server ("Argument ", 0);
00279         date_to_internet (datetmp, p->start);
00280         send_to_server (datetmp, 0);
00281         if (p->inclusive)
00282         send_to_server ("<=", 0);
00283         else
00284         send_to_server ("<", 0);
00285         date_to_internet (datetmp, p->end);
00286         send_to_server (datetmp, 0);
00287         send_to_server ("\012", 0);
00288         if (p->start)
00289         free (p->start);
00290         if (p->end)
00291         free (p->end);
00292         free (p);
00293     }
00294     while (log_data.singledatelist != NULL)
00295     {
00296         p = log_data.singledatelist;
00297         log_data.singledatelist = p->next;
00298         send_to_server ("Argument -d\012", 0);
00299         send_to_server ("Argument ", 0);
00300         date_to_internet (datetmp, p->end);
00301         send_to_server (datetmp, 0);
00302         send_to_server ("\012", 0);
00303         if (p->end)
00304         free (p->end);
00305         free (p);
00306     }
00307
00308     if (log_data.header)
00309         send_arg ("-h");
00310     if (local)
00311         send_arg("-l");
00312     if (log_data.notags)
00313         send_arg("-N");
00314     if (log_data.nameonly)
00315         send_arg("-R");
00316     if (log_data.long_header)
00317         send_arg("-t");
00318
00319     while (log_data.revlist != NULL)
00320     {
00321         rp = log_data.revlist;
00322         log_data.revlist = rp->next;
00323         send_to_server ("Argument -r", 0);
00324         if (rp->branchhead)
00325         {
00326         if (rp->first != NULL)
00327             send_to_server (rp->first, 0);
00328         send_to_server (".", 1);
00329         }
00330         else
00331         {
00332         if (rp->first != NULL)
00333             send_to_server (rp->first, 0);
00334         send_to_server (":", 1);
00335         if (rp->last != NULL)
00336             send_to_server (rp->last, 0);
00337         }
00338         send_to_server ("\012", 0);
00339         if (rp->first)
00340         free (rp->first);
00341         if (rp->last)
00342         free (rp->last);
00343         free (rp);
00344     }
00345     send_arg_list ("-s", log_data.statelist);
00346     dellist (&log_data.statelist);
00347     send_arg_list ("-w", log_data.authorlist);
00348     dellist (&log_data.authorlist);
00349
00350     send_files (argc - optind, argv + optind, local, 0, SEND_NO_CONTENTS);
00351     send_file_names (argc - optind, argv + optind, SEND_EXPAND_WILD);
00352
00353     send_to_server ("log\012", 0);
00354         err = get_responses_and_close ();
00355     return err;
00356     }
00357 #endif
00358
00359     /* OK, now that we know we are local/server, we can resolve @@MYSELF
00360        into our user name.  */
00361     if (findnode (log_data.authorlist, "@@MYSELF") != NULL)
00362     log_parse_list (&log_data.authorlist, getcaller ());
00363
00364     err = start_recursion (log_fileproc, (FILESDONEPROC) NULL, log_dirproc,
00365                (DIRLEAVEPROC) NULL, (void *) &log_data,
00366                argc - optind, argv + optind, local,
00367                W_LOCAL | W_REPOS | W_ATTIC, 0, 1,
00368                (char *) NULL, 1);
00369
00370     while (log_data.revlist)
00371     {
00372     struct option_revlist *rl = log_data.revlist->next;
00373     if (log_data.revlist->first)
00374         free (log_data.revlist->first);
00375     if (log_data.revlist->last)
00376         free (log_data.revlist->last);
00377     free (log_data.revlist);
00378     log_data.revlist = rl;
00379     }
00380     while (log_data.datelist)
00381     {
00382     struct datelist *nd = log_data.datelist->next;
00383     if (log_data.datelist->start)
00384         free (log_data.datelist->start);
00385     if (log_data.datelist->end)
00386         free (log_data.datelist->end);
00387     free (log_data.datelist);
00388     log_data.datelist = nd;
00389     }
00390     while (log_data.singledatelist)
00391     {
00392     struct datelist *nd = log_data.singledatelist->next;
00393     if (log_data.singledatelist->start)
00394         free (log_data.singledatelist->start);
00395     if (log_data.singledatelist->end)
00396         free (log_data.singledatelist->end);
00397     free (log_data.singledatelist);
00398     log_data.singledatelist = nd;
00399     }
00400     dellist (&log_data.statelist);
00401     dellist (&log_data.authorlist);
00402
00403     return (err);
00404 }
00405
00406 /*
00407  * Parse a revision list specification.
00408  */
00409
00410 static struct option_revlist *
00411 log_parse_revlist (argstring)
00412     const char *argstring;
00413 {
00414     char *orig_copy, *copy;
00415     struct option_revlist *ret, **pr;
00416
00417     /* Unfortunately, rlog accepts -r without an argument to mean that
00418        latest revision on the default branch, so we must support that
00419        for compatibility.  */
00420     if (argstring == NULL)
00421     argstring = "";
00422
00423     ret = NULL;
00424     pr = &ret;
00425
00426     /* Copy the argument into memory so that we can change it.  We
00427        don't want to change the argument because, at least as of this
00428        writing, we will use it if we send the arguments to the server.  */
00429     orig_copy = copy = xstrdup (argstring);
00430     while (copy != NULL)
00431     {
00432     char *comma;
00433     struct option_revlist *r;
00434
00435     comma = strchr (copy, ',');
00436     if (comma != NULL)
00437         *comma++ = '\0';
00438
00439     r = (struct option_revlist *) xmalloc (sizeof *r);
00440     r->next = NULL;
00441     r->first = copy;
00442     r->branchhead = 0;
00443     r->last = strchr (copy, ':');
00444     if (r->last != NULL)
00445         *r->last++ = '\0';
00446     else
00447     {
00448         r->last = r->first;
00449         if (r->first[0] != '\0' && r->first[strlen (r->first) - 1] == '.')
00450         {
00451         r->branchhead = 1;
00452         r->first[strlen (r->first) - 1] = '\0';
00453         }
00454     }
00455
00456     if (*r->first == '\0')
00457         r->first = NULL;
00458     if (*r->last == '\0')
00459         r->last = NULL;
00460
00461     if (r->first != NULL)
00462         r->first = xstrdup (r->first);
00463     if (r->last != NULL)
00464         r->last = xstrdup (r->last);
00465
00466     *pr = r;
00467     pr = &r->next;
00468
00469     copy = comma;
00470     }
00471
00472     free (orig_copy);
00473     return ret;
00474 }
00475
00476 /*
00477  * Parse a date specification.
00478  */
00479 static void
00480 log_parse_date (log_data, argstring)
00481     struct log_data *log_data;
00482     const char *argstring;
00483 {
00484     char *orig_copy, *copy;
00485
00486     /* Copy the argument into memory so that we can change it.  We
00487        don't want to change the argument because, at least as of this
00488        writing, we will use it if we send the arguments to the server.  */
00489     orig_copy = copy = xstrdup (argstring);
00490     while (copy != NULL)
00491     {
00492     struct datelist *nd, **pd;
00493     char *cpend, *cp, *ds, *de;
00494
00495     nd = (struct datelist *) xmalloc (sizeof *nd);
00496
00497     cpend = strchr (copy, ';');
00498     if (cpend != NULL)
00499         *cpend++ = '\0';
00500
00501     pd = &log_data->datelist;
00502     nd->inclusive = 0;
00503
00504     if ((cp = strchr (copy, '>')) != NULL)
00505     {
00506         *cp++ = '\0';
00507         if (*cp == '=')
00508         {
00509         ++cp;
00510         nd->inclusive = 1;
00511         }
00512         ds = cp;
00513         de = copy;
00514     }
00515     else if ((cp = strchr (copy, '<')) != NULL)
00516     {
00517         *cp++ = '\0';
00518         if (*cp == '=')
00519         {
00520         ++cp;
00521         nd->inclusive = 1;
00522         }
00523         ds = copy;
00524         de = cp;
00525     }
00526     else
00527     {
00528         ds = NULL;
00529         de = copy;
00530         pd = &log_data->singledatelist;
00531     }
00532
00533     if (ds == NULL)
00534         nd->start = NULL;
00535     else if (*ds != '\0')
00536         nd->start = Make_Date (ds);
00537     else
00538     {
00539       /* 1970 was the beginning of time, as far as get_date and
00540          Make_Date are concerned.  FIXME: That is true only if time_t
00541          is a POSIX-style time and there is nothing in ANSI that
00542          mandates that.  It would be cleaner to set a flag saying
00543          whether or not there is a start date.  */
00544         nd->start = Make_Date ("1/1/1970 UTC");
00545     }
00546
00547     if (*de != '\0')
00548         nd->end = Make_Date (de);
00549     else
00550     {
00551         /* We want to set the end date to some time sufficiently far
00552            in the future to pick up all revisions that have been
00553            created since the specified date and the time `cvs log'
00554            completes.  FIXME: The date in question only makes sense
00555            if time_t is a POSIX-style time and it is 32 bits
00556            and signed.  We should instead be setting a flag saying
00557            whether or not there is an end date.  Note that using
00558            something like "next week" would break the testsuite (and,
00559            perhaps less importantly, loses if the clock is set grossly
00560            wrong).  */
00561         nd->end = Make_Date ("2038-01-01");
00562     }
00563
00564     nd->next = *pd;
00565     *pd = nd;
00566
00567     copy = cpend;
00568     }
00569
00570     free (orig_copy);
00571 }
00572
00573 /*
00574  * Parse a comma separated list of items, and add each one to *PLIST.
00575  */
00576 static void
00577 log_parse_list (plist, argstring)
00578     List **plist;
00579     const char *argstring;
00580 {
00581     while (1)
00582     {
00583     Node *p;
00584     char *cp;
00585
00586     p = getnode ();
00587
00588     cp = strchr (argstring, ',');
00589     if (cp == NULL)
00590         p->key = xstrdup (argstring);
00591     else
00592     {
00593         size_t len;
00594
00595         len = cp - argstring;
00596         p->key = xmalloc (len + 1);
00597         strncpy (p->key, argstring, len);
00598         p->key[len + 1] = '\0';
00599     }
00600
00601     if (*plist == NULL)
00602         *plist = getlist ();
00603     if (addnode (*plist, p) != 0)
00604         freenode (p);
00605
00606     if (cp == NULL)
00607         break;
00608
00609     argstring = cp + 1;
00610     }
00611 }
00612
00613 static int printlock_proc PROTO ((Node *, void *));
00614
00615 static int
00616 printlock_proc (lock, foo)
00617     Node *lock;
00618     void *foo;
00619 {
00620     cvs_output ("\n\t", 2);
00621     cvs_output (lock->data, 0);
00622     cvs_output (": ", 2);
00623     cvs_output (lock->key, 0);
00624     return 0;
00625 }
00626
00627 /*
00628  * Do an rlog on a file
00629  */
00630 static int
00631 log_fileproc (callerdat, finfo)
00632     void *callerdat;
00633     struct file_info *finfo;
00634 {
00635     struct log_data *log_data = (struct log_data *) callerdat;
00636     Node *p;
00637     RCSNode *rcsfile;
00638     char buf[50];
00639     struct revlist *revlist;
00640     struct log_data_and_rcs log_data_and_rcs;
00641
00642     if ((rcsfile = finfo->rcs) == NULL)
00643     {
00644     /* no rcs file.  What *do* we know about this file? */
00645     p = findnode (finfo->entries, finfo->file);
00646     if (p != NULL)
00647     {
00648         Entnode *e;
00649
00650         e = (Entnode *) p->data;
00651         if (e->version[0] == '0' && e->version[1] == '\0')
00652         {
00653         if (!really_quiet)
00654             error (0, 0, "%s has been added, but not committed",
00655                finfo->file);
00656         return(0);
00657         }
00658     }
00659
00660     if (!really_quiet)
00661         error (0, 0, "nothing known about %s", finfo->file);
00662
00663     return (1);
00664     }
00665
00666     if (log_data->nameonly)
00667     {
00668     cvs_output (rcsfile->path, 0);
00669     cvs_output ("\n", 1);
00670     return 0;
00671     }
00672
00673     /* We will need all the information in the RCS file.  */
00674     RCS_fully_parse (rcsfile);
00675
00676     /* Turn any symbolic revisions in the revision list into numeric
00677        revisions.  */
00678     revlist = log_expand_revlist (rcsfile, log_data->revlist,
00679                   log_data->default_branch);
00680
00681     /* The output here is intended to be exactly compatible with the
00682        output of rlog.  I'm not sure whether this code should be here
00683        or in rcs.c; I put it here because it is specific to the log
00684        function, even though it uses information gathered by the
00685        functions in rcs.c.  */
00686
00687     cvs_output ("\n", 1);
00688
00689     cvs_output ("RCS file: ", 0);
00690     cvs_output (rcsfile->path, 0);
00691
00692     cvs_output ("\nWorking file: ", 0);
00693     if (finfo->update_dir[0] == '\0')
00694     cvs_output (finfo->file, 0);
00695     else
00696     {
00697     cvs_output (finfo->update_dir, 0);
00698     cvs_output ("/", 0);
00699     cvs_output (finfo->file, 0);
00700
00701     }
00702
00703     cvs_output ("\nhead:", 0);
00704     if (rcsfile->head != NULL)
00705     {
00706     cvs_output (" ", 1);
00707     cvs_output (rcsfile->head, 0);
00708     }
00709
00710     cvs_output ("\nbranch:", 0);
00711     if (rcsfile->branch != NULL)
00712     {
00713     cvs_output (" ", 1);
00714     cvs_output (rcsfile->branch, 0);
00715     }
00716
00717     cvs_output ("\nlocks:", 0);
00718     if (rcsfile->strict_locks)
00719     cvs_output (" strict", 0);
00720     walklist (RCS_getlocks (rcsfile), printlock_proc, NULL);
00721
00722     cvs_output ("\naccess list:", 0);
00723     if (rcsfile->access != NULL)
00724     {
00725     const char *cp;
00726
00727     cp = rcsfile->access;
00728     while (*cp != '\0')
00729     {
00730         const char *cp2;
00731
00732         cvs_output ("\n\t", 2);
00733         cp2 = cp;
00734         while (! isspace ((unsigned char) *cp2) && *cp2 != '\0')
00735             ++cp2;
00736         cvs_output (cp, cp2 - cp);
00737         cp = cp2;
00738         while (isspace ((unsigned char) *cp) && *cp != '\0')
00739             ++cp;
00740     }
00741     }
00742
00743     if (! log_data->notags)
00744     {
00745     List *syms;
00746
00747     cvs_output ("\nsymbolic names:", 0);
00748     syms = RCS_symbols (rcsfile);
00749     walklist (syms, log_symbol, NULL);
00750     }
00751
00752     cvs_output ("\nkeyword substitution: ", 0);
00753     if (rcsfile->expand == NULL)
00754     cvs_output ("kv", 2);
00755     else
00756     cvs_output (rcsfile->expand, 0);
00757
00758     cvs_output ("\ntotal revisions: ", 0);
00759     sprintf (buf, "%d", walklist (rcsfile->versions, log_count, NULL));
00760     cvs_output (buf, 0);
00761
00762     if (! log_data->header && ! log_data->long_header)
00763     {
00764     cvs_output (";\tselected revisions: ", 0);
00765
00766     log_data_and_rcs.log_data = log_data;
00767     log_data_and_rcs.revlist = revlist;
00768     log_data_and_rcs.rcs = rcsfile;
00769
00770     /* If any single dates were specified, we need to identify the
00771        revisions they select.  Each one selects the single
00772        revision, which is otherwise selected, of that date or
00773        earlier.  The log_fix_singledate routine will fill in the
00774        start date for each specific revision.  */
00775     if (log_data->singledatelist != NULL)
00776         walklist (rcsfile->versions, log_fix_singledate,
00777               (void *) &log_data_and_rcs);
00778
00779     sprintf (buf, "%d", walklist (rcsfile->versions, log_count_print,
00780                       (void *) &log_data_and_rcs));
00781     cvs_output (buf, 0);
00782     }
00783
00784     cvs_output ("\n", 1);
00785
00786     if (! log_data->header || log_data->long_header)
00787     {
00788     cvs_output ("description:\n", 0);
00789     if (rcsfile->desc != NULL)
00790         cvs_output (rcsfile->desc, 0);
00791     }
00792
00793     if (! log_data->header && ! log_data->long_header && rcsfile->head != NULL)
00794     {
00795     p = findnode (rcsfile->versions, rcsfile->head);
00796     if (p == NULL)
00797         error (1, 0, "can not find head revision in `%s'",
00798            finfo->fullname);
00799     while (p != NULL)
00800     {
00801         RCSVers *vers;
00802
00803         vers = (RCSVers *) p->data;
00804         log_version (log_data, revlist, rcsfile, vers, 1);
00805         if (vers->next == NULL)
00806         p = NULL;
00807         else
00808         {
00809         p = findnode (rcsfile->versions, vers->next);
00810         if (p == NULL)
00811             error (1, 0, "can not find next revision `%s' in `%s'",
00812                vers->next, finfo->fullname);
00813         }
00814     }
00815
00816     log_tree (log_data, revlist, rcsfile, rcsfile->head);
00817     }
00818
00819     cvs_output("\
00820 =============================================================================\n",
00821            0);
00822
00823     /* Free up the new revlist and restore the old one.  */
00824     log_free_revlist (revlist);
00825
00826     /* If singledatelist is not NULL, free up the start dates we added
00827        to it.  */
00828     if (log_data->singledatelist != NULL)
00829     {
00830     struct datelist *d;
00831
00832     for (d = log_data->singledatelist; d != NULL; d = d->next)
00833     {
00834         if (d->start != NULL)
00835         free (d->start);
00836         d->start = NULL;
00837     }
00838     }
00839
00840     return 0;
00841 }
00842
00843 /*
00844  * Fix up a revision list in order to compare it against versions.
00845  * Expand any symbolic revisions.
00846  */
00847 static struct revlist *
00848 log_expand_revlist (rcs, revlist, default_branch)
00849     RCSNode *rcs;
00850     struct option_revlist *revlist;
00851     int default_branch;
00852 {
00853     struct option_revlist *r;
00854     struct revlist *ret, **pr;
00855
00856     ret = NULL;
00857     pr = &ret;
00858     for (r = revlist; r != NULL; r = r->next)
00859     {
00860     struct revlist *nr;
00861
00862     nr = (struct revlist *) xmalloc (sizeof *nr);
00863
00864     if (r->first == NULL && r->last == NULL)
00865     {
00866         /* If both first and last are NULL, it means that we want
00867            just the head of the default branch, which is RCS_head.  */
00868         nr->first = RCS_head (rcs);
00869         nr->last = xstrdup (nr->first);
00870         nr->fields = numdots (nr->first) + 1;
00871     }
00872     else if (r->branchhead)
00873     {
00874         char *branch;
00875
00876         /* Print just the head of the branch.  */
00877         if (isdigit ((unsigned char) r->first[0]))
00878         nr->first = RCS_getbranch (rcs, r->first, 1);
00879         else
00880         {
00881         branch = RCS_whatbranch (rcs, r->first);
00882         if (branch == NULL)
00883         {
00884             error (0, 0, "warning: `%s' is not a branch in `%s'",
00885                r->first, rcs->path);
00886             free (nr);
00887             continue;
00888         }
00889         nr->first = RCS_getbranch (rcs, branch, 1);
00890         free (branch);
00891         }
00892         if (nr->first == NULL)
00893         {
00894         error (0, 0, "warning: no revision `%s' in `%s'",
00895                r->first, rcs->path);
00896         free (nr);
00897         continue;
00898         }
00899         nr->last = xstrdup (nr->first);
00900         nr->fields = numdots (nr->first) + 1;
00901     }
00902     else
00903     {
00904         if (r->first == NULL || isdigit ((unsigned char) r->first[0]))
00905         nr->first = xstrdup (r->first);
00906         else
00907         {
00908         if (RCS_nodeisbranch (rcs, r->first))
00909             nr->first = RCS_whatbranch (rcs, r->first);
00910         else
00911             nr->first = RCS_gettag (rcs, r->first, 1, (int *) NULL);
00912         if (nr->first == NULL)
00913         {
00914             error (0, 0, "warning: no revision `%s' in `%s'",
00915                r->first, rcs->path);
00916             free (nr);
00917             continue;
00918         }
00919         }
00920
00921         if (r->last == r->first)
00922         nr->last = xstrdup (nr->first);
00923         else if (r->last == NULL || isdigit ((unsigned char) r->last[0]))
00924         nr->last = xstrdup (r->last);
00925         else
00926         {
00927         if (RCS_nodeisbranch (rcs, r->last))
00928             nr->last = RCS_whatbranch (rcs, r->last);
00929         else
00930             nr->last = RCS_gettag (rcs, r->last, 1, (int *) NULL);
00931         if (nr->last == NULL)
00932         {
00933             error (0, 0, "warning: no revision `%s' in `%s'",
00934                r->last, rcs->path);
00935             if (nr->first != NULL)
00936             free (nr->first);
00937             free (nr);
00938             continue;
00939         }
00940         }
00941
00942         /* Process the revision numbers the same way that rlog
00943                does.  This code is a bit cryptic for my tastes, but
00944                keeping the same implementation as rlog ensures a
00945                certain degree of compatibility.  */
00946         if (r->first == NULL)
00947         {
00948         nr->fields = numdots (nr->last) + 1;
00949         if (nr->fields < 2)
00950             nr->first = xstrdup (".0");
00951         else
00952         {
00953             char *cp;
00954
00955             nr->first = xstrdup (nr->last);
00956             cp = strrchr (nr->first, '.');
00957             strcpy (cp, ".0");
00958         }
00959         }
00960         else if (r->last == NULL)
00961         {
00962         nr->fields = numdots (nr->first) + 1;
00963         nr->last = xstrdup (nr->first);
00964         if (nr->fields < 2)
00965             nr->last[0] = '\0';
00966         else
00967         {
00968             char *cp;
00969
00970             cp = strrchr (nr->last, '.');
00971             *cp = '\0';
00972         }
00973         }
00974         else
00975         {
00976         nr->fields = numdots (nr->first) + 1;
00977         if (nr->fields != numdots (nr->last) + 1
00978             || (nr->fields > 2
00979             && version_compare (nr->first, nr->last,
00980                         nr->fields - 1) != 0))
00981         {
00982             error (0, 0,
00983                "invalid branch or revision pair %s:%s in `%s'",
00984                r->first, r->last, rcs->path);
00985             free (nr->first);
00986             free (nr->last);
00987             free (nr);
00988             continue;
00989         }
00990         if (version_compare (nr->first, nr->last, nr->fields) > 0)
00991         {
00992             char *tmp;
00993
00994             tmp = nr->first;
00995             nr->first = nr->last;
00996             nr->last = tmp;
00997         }
00998         }
00999     }
01000
01001     nr->next = NULL;
01002     *pr = nr;
01003     pr = &nr->next;
01004     }
01005
01006     /* If the default branch was requested, add a revlist entry for
01007        it.  This is how rlog handles this option.  */
01008     if (default_branch
01009     && (rcs->head != NULL || rcs->branch != NULL))
01010     {
01011     struct revlist *nr;
01012
01013     nr = (struct revlist *) xmalloc (sizeof *nr);
01014     if (rcs->branch != NULL)
01015         nr->first = xstrdup (rcs->branch);
01016     else
01017     {
01018         char *cp;
01019
01020         nr->first = xstrdup (rcs->head);
01021         cp = strrchr (nr->first, '.');
01022         *cp = '\0';
01023     }
01024     nr->last = xstrdup (nr->first);
01025     nr->fields = numdots (nr->first) + 1;
01026
01027     nr->next = NULL;
01028     *pr = nr;
01029     }
01030
01031     return ret;
01032 }
01033
01034 /*
01035  * Free a revlist created by log_expand_revlist.
01036  */
01037 static void
01038 log_free_revlist (revlist)
01039     struct revlist *revlist;
01040 {
01041     struct revlist *r;
01042
01043     r = revlist;
01044     while (r != NULL)
01045     {
01046     struct revlist *next;
01047
01048     if (r->first != NULL)
01049         free (r->first);
01050     if (r->last != NULL)
01051         free (r->last);
01052     next = r->next;
01053     free (r);
01054     r = next;
01055     }
01056 }
01057
01058 /*
01059  * Return nonzero if a revision should be printed, based on the
01060  * options provided.
01061  */
01062 static int
01063 log_version_requested (log_data, revlist, rcs, vnode)
01064     struct log_data *log_data;
01065     struct revlist *revlist;
01066     RCSNode *rcs;
01067     RCSVers *vnode;
01068 {
01069     /* Handle the list of states from the -s option.  */
01070     if (log_data->statelist != NULL
01071     && findnode (log_data->statelist, vnode->state) == NULL)
01072     {
01073     return 0;
01074     }
01075
01076     /* Handle the list of authors from the -w option.  */
01077     if (log_data->authorlist != NULL)
01078     {
01079     if (vnode->author != NULL
01080         && findnode (log_data->authorlist, vnode->author) == NULL)
01081     {
01082         return 0;
01083     }
01084     }
01085
01086     /* rlog considers all the -d options together when it decides
01087        whether to print a revision, so we must be compatible.  */
01088     if (log_data->datelist != NULL || log_data->singledatelist != NULL)
01089     {
01090     struct datelist *d;
01091
01092     for (d = log_data->datelist; d != NULL; d = d->next)
01093     {
01094         int cmp;
01095
01096         cmp = RCS_datecmp (vnode->date, d->start);
01097         if (cmp > 0 || (cmp == 0 && d->inclusive))
01098         {
01099         cmp = RCS_datecmp (vnode->date, d->end);
01100         if (cmp < 0 || (cmp == 0 && d->inclusive))
01101             break;
01102         }
01103     }
01104
01105     if (d == NULL)
01106     {
01107         /* Look through the list of specific dates.  We want to
01108            select the revision with the exact date found in the
01109            start field.  The commit code ensures that it is
01110            impossible to check in multiple revisions of a single
01111            file in a single second, so checking the date this way
01112            should never select more than one revision.  */
01113         for (d = log_data->singledatelist; d != NULL; d = d->next)
01114         {
01115         if (d->start != NULL
01116             && RCS_datecmp (vnode->date, d->start) == 0)
01117         {
01118             break;
01119         }
01120         }
01121
01122         if (d == NULL)
01123         return 0;
01124     }
01125     }
01126
01127     /* If the -r or -b options were used, REVLIST will be non NULL,
01128        and we print the union of the specified revisions.  */
01129     if (revlist != NULL)
01130     {
01131     char *v;
01132     int vfields;
01133     struct revlist *r;
01134
01135     /* This code is taken from rlog.  */
01136     v = vnode->version;
01137     vfields = numdots (v) + 1;
01138     for (r = revlist; r != NULL; r = r->next)
01139     {
01140         if (vfields == r->fields + (r->fields & 1)
01141         && version_compare (v, r->first, r->fields) >= 0
01142         && version_compare (v, r->last, r->fields) <= 0)
01143         {
01144         return 1;
01145         }
01146     }
01147
01148     /* If we get here, then the -b and/or the -r option was used,
01149            but did not match this revision, so we reject it.  */
01150
01151     return 0;
01152     }
01153
01154     /* By default, we print all revisions.  */
01155     return 1;
01156 }
01157
01158 /*
01159  * Output a single symbol.  This is called via walklist.
01160  */
01161 /*ARGSUSED*/
01162 static int
01163 log_symbol (p, closure)
01164     Node *p;
01165     void *closure;
01166 {
01167     cvs_output ("\n\t", 2);
01168     cvs_output (p->key, 0);
01169     cvs_output (": ", 2);
01170     cvs_output (p->data, 0);
01171     return 0;
01172 }
01173
01174 /*
01175  * Count the number of entries on a list.  This is called via walklist.
01176  */
01177 /*ARGSUSED*/
01178 static int
01179 log_count (p, closure)
01180     Node *p;
01181     void *closure;
01182 {
01183     return 1;
01184 }
01185
01186 /*
01187  * Sort out a single date specification by narrowing down the date
01188  * until we find the specific selected revision.
01189  */
01190 static int
01191 log_fix_singledate (p, closure)
01192     Node *p;
01193     void *closure;
01194 {
01195     struct log_data_and_rcs *data = (struct log_data_and_rcs *) closure;
01196     Node *pv;
01197     RCSVers *vnode;
01198     struct datelist *holdsingle, *holddate;
01199     int requested;
01200
01201     pv = findnode (data->rcs->versions, p->key);
01202     if (pv == NULL)
01203     error (1, 0, "missing version `%s' in RCS file `%s'",
01204            p->key, data->rcs->path);
01205     vnode = (RCSVers *) pv->data;
01206
01207     /* We are only interested if this revision passes any other tests.
01208        Temporarily clear log_data->singledatelist to avoid confusing
01209        log_version_requested.  We also clear log_data->datelist,
01210        because rlog considers all the -d options together.  We don't
01211        want to reject a revision because it does not match a date pair
01212        if we are going to select it on the basis of the singledate.  */
01213     holdsingle = data->log_data->singledatelist;
01214     data->log_data->singledatelist = NULL;
01215     holddate = data->log_data->datelist;
01216     data->log_data->datelist = NULL;
01217     requested = log_version_requested (data->log_data, data->revlist,
01218                        data->rcs, vnode);
01219     data->log_data->singledatelist = holdsingle;
01220     data->log_data->datelist = holddate;
01221
01222     if (requested)
01223     {
01224     struct datelist *d;
01225
01226     /* For each single date, if this revision is before the
01227        specified date, but is closer than the previously selected
01228        revision, select it instead.  */
01229     for (d = data->log_data->singledatelist; d != NULL; d = d->next)
01230     {
01231         if (RCS_datecmp (vnode->date, d->end) <= 0
01232         && (d->start == NULL
01233             || RCS_datecmp (vnode->date, d->start) > 0))
01234         {
01235         if (d->start != NULL)
01236             free (d->start);
01237         d->start = xstrdup (vnode->date);
01238         }
01239     }
01240     }
01241
01242     return 0;
01243 }
01244
01245 /*
01246  * Count the number of revisions we are going to print.
01247  */
01248 static int
01249 log_count_print (p, closure)
01250     Node *p;
01251     void *closure;
01252 {
01253     struct log_data_and_rcs *data = (struct log_data_and_rcs *) closure;
01254     Node *pv;
01255
01256     pv = findnode (data->rcs->versions, p->key);
01257     if (pv == NULL)
01258     error (1, 0, "missing version `%s' in RCS file `%s'",
01259            p->key, data->rcs->path);
01260     if (log_version_requested (data->log_data, data->revlist, data->rcs,
01261                    (RCSVers *) pv->data))
01262     return 1;
01263     else
01264     return 0;
01265 }
01266
01267 /*
01268  * Print the list of changes, not including the trunk, in reverse
01269  * order for each branch.
01270  */
01271 static void
01272 log_tree (log_data, revlist, rcs, ver)
01273     struct log_data *log_data;
01274     struct revlist *revlist;
01275     RCSNode *rcs;
01276     const char *ver;
01277 {
01278     Node *p;
01279     RCSVers *vnode;
01280
01281     p = findnode (rcs->versions, ver);
01282     if (p == NULL)
01283     error (1, 0, "missing version `%s' in RCS file `%s'",
01284            ver, rcs->path);
01285     vnode = (RCSVers *) p->data;
01286     if (vnode->next != NULL)
01287     log_tree (log_data, revlist, rcs, vnode->next);
01288     if (vnode->branches != NULL)
01289     {
01290     Node *head, *branch;
01291
01292     /* We need to do the branches in reverse order.  This breaks
01293            the List abstraction, but so does most of the branch
01294            manipulation in rcs.c.  */
01295     head = vnode->branches->list;
01296     for (branch = head->prev; branch != head; branch = branch->prev)
01297     {
01298         log_abranch (log_data, revlist, rcs, branch->key);
01299         log_tree (log_data, revlist, rcs, branch->key);
01300     }
01301     }
01302 }
01303
01304 /*
01305  * Log the changes for a branch, in reverse order.
01306  */
01307 static void
01308 log_abranch (log_data, revlist, rcs, ver)
01309     struct log_data *log_data;
01310     struct revlist *revlist;
01311     RCSNode *rcs;
01312     const char *ver;
01313 {
01314     Node *p;
01315     RCSVers *vnode;
01316
01317     p = findnode (rcs->versions, ver);
01318     if (p == NULL)
01319     error (1, 0, "missing version `%s' in RCS file `%s'",
01320            ver, rcs->path);
01321     vnode = (RCSVers *) p->data;
01322     if (vnode->next != NULL)
01323     log_abranch (log_data, revlist, rcs, vnode->next);
01324     log_version (log_data, revlist, rcs, vnode, 0);
01325 }
01326
01327 /*
01328  * Print the log output for a single version.
01329  */
01330 static void
01331 log_version (log_data, revlist, rcs, ver, trunk)
01332     struct log_data *log_data;
01333     struct revlist *revlist;
01334     RCSNode *rcs;
01335     RCSVers *ver;
01336     int trunk;
01337 {
01338     Node *p;
01339     int year, mon, mday, hour, min, sec;
01340     char buf[100];
01341     Node *padd, *pdel;
01342
01343     if (! log_version_requested (log_data, revlist, rcs, ver))
01344     return;
01345
01346     cvs_output ("----------------------------\nrevision ", 0);
01347     cvs_output (ver->version, 0);
01348
01349     p = findnode (RCS_getlocks (rcs), ver->version);
01350     if (p != NULL)
01351     {
01352     cvs_output ("\tlocked by: ", 0);
01353     cvs_output (p->data, 0);
01354     cvs_output (";", 1);
01355     }
01356
01357     cvs_output ("\ndate: ", 0);
01358     (void) sscanf (ver->date, SDATEFORM, &year, &mon, &mday, &hour, &min,
01359            &sec);
01360     if (year < 1900)
01361     year += 1900;
01362     sprintf (buf, "%04d/%02d/%02d %02d:%02d:%02d", year, mon, mday,
01363          hour, min, sec);
01364     cvs_output (buf, 0);
01365
01366     cvs_output (";  author: ", 0);
01367     cvs_output (ver->author, 0);
01368
01369     cvs_output (";  state: ", 0);
01370     cvs_output (ver->state, 0);
01371     cvs_output (";", 1);
01372
01373     if (! trunk)
01374     {
01375     padd = findnode (ver->other, ";add");
01376     pdel = findnode (ver->other, ";delete");
01377     }
01378     else if (ver->next == NULL)
01379     {
01380     padd = NULL;
01381     pdel = NULL;
01382     }
01383     else
01384     {
01385     Node *nextp;
01386     RCSVers *nextver;
01387
01388     nextp = findnode (rcs->versions, ver->next);
01389     if (nextp == NULL)
01390         error (1, 0, "missing version `%s' in `%s'", ver->next,
01391            rcs->path);
01392     nextver = (RCSVers *) nextp->data;
01393     pdel = findnode (nextver->other, ";add");
01394     padd = findnode (nextver->other, ";delete");
01395     }
01396
01397     if (padd != NULL)
01398     {
01399     cvs_output ("  lines: +", 0);
01400     cvs_output (padd->data, 0);
01401     cvs_output (" -", 2);
01402     cvs_output (pdel->data, 0);
01403     }
01404
01405     if (ver->branches != NULL)
01406     {
01407     cvs_output ("\nbranches:", 0);
01408     walklist (ver->branches, log_branch, (void *) NULL);
01409     }
01410
01411     cvs_output ("\n", 1);
01412
01413     p = findnode (ver->other, "log");
01414     /* The p->date == NULL case is the normal one for an empty log
01415        message (rcs-14 in sanity.sh).  I don't think the case where
01416        p->data is "" can happen (getrcskey in rcs.c checks for an
01417        empty string and set the value to NULL in that case).  My guess
01418        would be the p == NULL case would mean an RCS file which was
01419        missing the "log" keyword (which is illegal according to
01420        rcsfile.5).  */
01421     if (p == NULL || p->data == NULL || p->data[0] == '\0')
01422     cvs_output ("*** empty log message ***\n", 0);
01423     else
01424     {
01425     /* FIXME: Technically, the log message could contain a null
01426            byte.  */
01427     cvs_output (p->data, 0);
01428     if (p->data[strlen (p->data) - 1] != '\n')
01429         cvs_output ("\n", 1);
01430     }
01431 }
01432
01433 /*
01434  * Output a branch version.  This is called via walklist.
01435  */
01436 /*ARGSUSED*/
01437 static int
01438 log_branch (p, closure)
01439     Node *p;
01440     void *closure;
01441 {
01442     cvs_output ("  ", 2);
01443     if ((numdots (p->key) & 1) == 0)
01444     cvs_output (p->key, 0);
01445     else
01446     {
01447     char *f, *cp;
01448
01449     f = xstrdup (p->key);
01450     cp = strrchr (f, '.');
01451     *cp = '\0';
01452     cvs_output (f, 0);
01453     free (f);
01454     }
01455     cvs_output (";", 1);
01456     return 0;
01457 }
01458
01459 /*
01460  * Print a warm fuzzy message
01461  */
01462 /* ARGSUSED */
01463 static Dtype
01464 log_dirproc (callerdat, dir, repository, update_dir, entries)
01465     void *callerdat;
01466     char *dir;
01467     char *repository;
01468     char *update_dir;
01469     List *entries;
01470 {
01471     if (!isdir (dir))
01472     return (R_SKIP_ALL);
01473
01474     if (!quiet)
01475     error (0, 0, "Logging %s", update_dir);
01476     return (R_PROCESS);
01477 }
01478
01479 /*
01480  * Compare versions.  This is taken from RCS compartial.
01481  */
01482 static int
01483 version_compare (v1, v2, len)
01484     const char *v1;
01485     const char *v2;
01486     int len;
01487 {
01488     while (1)
01489     {
01490     int d1, d2, r;
01491
01492     if (*v1 == '\0')
01493         return 1;
01494     if (*v2 == '\0')
01495         return -1;
01496
01497     while (*v1 == '0')
01498         ++v1;
01499     for (d1 = 0; isdigit ((unsigned char) v1[d1]); ++d1)
01500         ;
01501
01502     while (*v2 == '0')
01503         ++v2;
01504     for (d2 = 0; isdigit ((unsigned char) v2[d2]); ++d2)
01505         ;
01506
01507     if (d1 != d2)
01508         return d1 < d2 ? -1 : 1;
01509
01510     r = memcmp (v1, v2, d1);
01511     if (r != 0)
01512         return r;
01513
01514     --len;
01515     if (len == 0)
01516         return 0;
01517
01518     v1 += d1;
01519     v2 += d1;
01520
01521     if (*v1 == '.')
01522         ++v1;
01523     if (*v2 == '.')
01524         ++v2;
01525     }
01526 }
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/login.c Source File

cvs-1.10/src/login.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1995, Cyclic Software, Bloomington, IN, USA
00003  *
00004  * You may distribute under the terms of the GNU General Public License as
00005  * specified in the README file that comes with CVS.
00006  *
00007  * Allow user to log in for an authenticating server.
00008  */
00009
00010 #include "cvs.h"
00011 #include "getline.h"
00012
00013 #ifdef AUTH_CLIENT_SUPPORT   /* This covers the rest of the file. */
00014
00015 #ifdef HAVE_GETPASSPHRASE
00016 #define GETPASS getpassphrase
00017 #else
00018 #define GETPASS getpass
00019 #endif
00020
00021 /* There seems to be very little agreement on which system header
00022    getpass is declared in.  With a lot of fancy autoconfiscation,
00023    we could perhaps detect this, but for now we'll just rely on
00024    _CRAY, since Cray is perhaps the only system on which our own
00025    declaration won't work (some Crays declare the 2#$@% thing as
00026    varadic, believe it or not).  On Cray, getpass will be declared
00027    in either stdlib.h or unistd.h.  */
00028 #ifndef _CRAY
00029 extern char *GETPASS ();
00030 #endif
00031
00032 #ifndef CVS_PASSWORD_FILE
00033 #define CVS_PASSWORD_FILE ".cvspass"
00034 #endif
00035
00036 /* If non-NULL, get_cvs_password() will just return this. */
00037 static char *cvs_password = NULL;
00038
00039 static char *construct_cvspass_filename PROTO ((void));
00040
00041 /* The return value will need to be freed. */
00042 static char *
00043 construct_cvspass_filename ()
00044 {
00045     char *homedir;
00046     char *passfile;
00047
00048     /* Environment should override file. */
00049     if ((passfile = getenv ("CVS_PASSFILE")) != NULL)
00050     return xstrdup (passfile);
00051
00052     /* Construct absolute pathname to user's password file. */
00053     /* todo: does this work under OS/2 ? */
00054     homedir = get_homedir ();
00055     if (! homedir)
00056     {
00057     /* FIXME?  This message confuses a lot of users, at least
00058        on Win95 (which doesn't set HOMEDRIVE and HOMEPATH like
00059        NT does).  I suppose the answer for Win95 is to store the
00060        passwords in the registry or something (??).  And .cvsrc
00061        and such too?  Wonder what WinCVS does (about .cvsrc, the
00062        right thing for a GUI is to just store the password in
00063        memory only)...  */
00064     error (1, 0, "could not find out home directory");
00065     return (char *) NULL;
00066     }
00067
00068     passfile =
00069     (char *) xmalloc (strlen (homedir) + strlen (CVS_PASSWORD_FILE) + 3);
00070     strcpy (passfile, homedir);
00071 #ifndef NO_SLASH_AFTER_HOME
00072     /* NO_SLASH_AFTER_HOME is defined for VMS, where foo:[bar]/.cvspass is not
00073        a legal filename but foo:[bar].cvspass is.  A more clean solution would
00074        be something more along the lines of a "join a directory to a filename"
00075        kind of thing....  */
00076     strcat (passfile, "/");
00077 #endif
00078     strcat (passfile, CVS_PASSWORD_FILE);
00079
00080     /* Safety first and last, Scouts. */
00081     if (isfile (passfile))
00082     /* xchmod() is too polite. */
00083     chmod (passfile, 0600);
00084
00085     return passfile;
00086 }
00087
00088 static const char *const login_usage[] =
00089 {
00090     "Usage: %s %s\n",
00091     "(Specify the --help global option for a list of other help options)\n",
00092     NULL
00093 };
00094
00095 /* Prompt for a password, and store it in the file "CVS/.cvspass".
00096  *
00097  * Because the user might be accessing multiple repositories, with
00098  * different passwords for each one, the format of ~/.cvspass is:
00099  *
00100  * user@host:/path Acleartext_password
00101  * user@host:/path Acleartext_password
00102  * ...
00103  *
00104  * Of course, the "user@" might be left off -- it's just based on the
00105  * value of CVSroot.
00106  *
00107  * The "A" before "cleartext_password" is a literal capital A.  It's a
00108  * version number indicating which form of scrambling we're doing on
00109  * the password -- someday we might provide something more secure than
00110  * the trivial encoding we do now, and when that day comes, it would
00111  * be nice to remain backward-compatible.
00112  *
00113  * Like .netrc, the file's permissions are the only thing preventing
00114  * it from being read by others.  Unlike .netrc, we will not be
00115  * fascist about it, at most issuing a warning, and never refusing to
00116  * work.
00117  */
00118 int
00119 login (argc, argv)
00120     int argc;
00121     char **argv;
00122 {
00123     char *passfile;
00124     FILE *fp;
00125     char *typed_password, *found_password;
00126     char *linebuf = (char *) NULL;
00127     size_t linebuf_len;
00128     int root_len, already_entered = 0;
00129     int line_length;
00130
00131     if (argc < 0)
00132     usage (login_usage);
00133
00134     if (CVSroot_method != pserver_method)
00135     {
00136     error (0, 0, "can only use pserver method with `login' command");
00137     error (1, 0, "CVSROOT: %s", CVSroot_original);
00138     }
00139
00140     if (! CVSroot_username)
00141     {
00142     error (0, 0, "CVSROOT \"%s\" is not fully-qualified.",
00143            CVSroot_original);
00144     error (1, 0, "Please make sure to specify \"user@host\"!");
00145     }
00146
00147     printf ("(Logging in to %s@%s)\n", CVSroot_username, CVSroot_hostname);
00148     fflush (stdout);
00149
00150     passfile = construct_cvspass_filename ();
00151     typed_password = GETPASS ("CVS password: ");
00152     typed_password = scramble (typed_password);
00153
00154     /* Force get_cvs_password() to use this one (when the client
00155      * confirms the new password with the server), instead of
00156      * consulting the file.  We make a new copy because cvs_password
00157      * will get zeroed by connect_to_server().  */
00158
00159     cvs_password = xstrdup (typed_password);
00160
00161     connect_to_pserver (NULL, NULL, 1, 0);
00162
00163     /* IF we have a password for this "[user@]host:/path" already
00164      *  THEN
00165      *    IF it's the same as the password we read from the prompt
00166      *     THEN
00167      *       do nothing
00168      *     ELSE
00169      *       replace the old password with the new one
00170      *  ELSE
00171      *    append new entry to the end of the file.
00172      */
00173
00174     root_len = strlen (CVSroot_original);
00175
00176     /* Yes, the method below reads the user's password file twice.  It's
00177        inefficient, but we're not talking about a gig of data here. */
00178
00179     fp = CVS_FOPEN (passfile, "r");
00180     /* FIXME: should be printing a message if fp == NULL and not
00181        existence_error (errno).  */
00182     if (fp != NULL)
00183     {
00184     /* Check each line to see if we have this entry already. */
00185     while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
00186         {
00187           if (strncmp (CVSroot_original, linebuf, root_len) == 0)
00188             {
00189         already_entered = 1;
00190         break;
00191             }
00192         }
00193     if (fclose (fp) < 0)
00194         error (0, errno, "cannot close %s", passfile);
00195     }
00196     else if (!existence_error (errno))
00197     error (0, errno, "cannot open %s", passfile);
00198
00199     if (already_entered)
00200     {
00201     /* This user/host has a password in the file already. */
00202
00203     strtok (linebuf, " ");
00204     found_password = strtok (NULL, "\n");
00205     if (strcmp (found_password, typed_password))
00206         {
00207         /* typed_password and found_password don't match, so we'll
00208          * have to update passfile.  We replace the old password
00209          * with the new one by writing a tmp file whose contents are
00210          * exactly the same as passfile except that this one entry
00211          * gets typed_password instead of found_password.  Then we
00212          * rename the tmp file on top of passfile.
00213          */
00214         char *tmp_name;
00215         FILE *tmp_fp;
00216
00217         tmp_name = cvs_temp_name ();
00218         if ((tmp_fp = CVS_FOPEN (tmp_name, "w")) == NULL)
00219             {
00220         error (1, errno, "unable to open temp file %s", tmp_name);
00221         return 1;
00222             }
00223         chmod (tmp_name, 0600);
00224
00225         fp = CVS_FOPEN (passfile, "r");
00226         if (fp == NULL)
00227             {
00228         error (1, errno, "unable to open %s", passfile);
00229         if (linebuf)
00230             free (linebuf);
00231         return 1;
00232             }
00233         /* I'm not paranoid, they really ARE out to get me: */
00234         chmod (passfile, 0600);
00235
00236         while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
00237             {
00238         if (strncmp (CVSroot_original, linebuf, root_len))
00239         {
00240             if (fprintf (tmp_fp, "%s", linebuf) == EOF)
00241             error (0, errno, "cannot write %s", tmp_name);
00242         }
00243         else
00244         {
00245             if (fprintf (tmp_fp, "%s %s\n", CVSroot_original,
00246                  typed_password) == EOF)
00247             error (0, errno, "cannot write %s", tmp_name);
00248         }
00249             }
00250         if (line_length < 0 && !feof (fp))
00251         error (0, errno, "cannot read %s", passfile);
00252             if (linebuf)
00253                 free (linebuf);
00254         if (fclose (tmp_fp) < 0)
00255         error (0, errno, "cannot close %s", tmp_name);
00256         if (fclose (fp) < 0)
00257         error (0, errno, "cannot close %s", passfile);
00258
00259         /* FIXME: rename_file would make more sense (e.g. almost
00260            always faster).  */
00261         copy_file (tmp_name, passfile);
00262         if (unlink_file (tmp_name) < 0)
00263         error (0, errno, "cannot remove %s", tmp_name);
00264         chmod (passfile, 0600);
00265
00266         free (tmp_name);
00267         }
00268     }
00269     else
00270     {
00271     if (linebuf)
00272         free (linebuf);
00273     if ((fp = CVS_FOPEN (passfile, "a")) == NULL)
00274         {
00275         error (1, errno, "could not open %s", passfile);
00276         free (passfile);
00277         return 1;
00278         }
00279
00280     if (fprintf (fp, "%s %s\n", CVSroot_original, typed_password) == EOF)
00281         error (0, errno, "cannot write %s", passfile);
00282     if (fclose (fp) < 0)
00283         error (0, errno, "cannot close %s", passfile);
00284     }
00285
00286     /* Utter, total, raving paranoia, I know. */
00287     chmod (passfile, 0600);
00288     memset (typed_password, 0, strlen (typed_password));
00289     free (typed_password);
00290
00291     free (passfile);
00292     free (cvs_password);
00293     cvs_password = NULL;
00294     return 0;
00295 }
00296
00297 /* Returns the _scrambled_ password.  The server must descramble
00298    before hashing and comparing.  If password file not found, or
00299    password not found in the file, just return NULL. */
00300 char *
00301 get_cvs_password ()
00302 {
00303     int found_it = 0;
00304     int root_len;
00305     char *password = NULL;
00306     char *linebuf = NULL;
00307     size_t linebuf_len;
00308     FILE *fp;
00309     char *passfile;
00310     int line_length;
00311
00312     /* If someone (i.e., login()) is calling connect_to_pserver() out of
00313        context, then assume they have supplied the correct, scrambled
00314        password. */
00315     if (cvs_password)
00316     return cvs_password;
00317
00318     if (getenv ("CVS_PASSWORD") != NULL)
00319     {
00320     /* In previous versions of CVS one could specify a password in
00321        CVS_PASSWORD.  This is a bad idea, because in BSD variants
00322        of unix anyone can see the environment variable with 'ps'.
00323        But for users who were using that feature we want to at
00324        least let them know what is going on.  After printing this
00325        warning, we should fall through to the regular error where
00326        we tell them to run "cvs login" (unless they already ran
00327        it, of course).  */
00328     error (0, 0, "CVS_PASSWORD is no longer supported; ignored");
00329     }
00330
00331     /* Else get it from the file.  First make sure that the CVSROOT
00332        variable has the appropriate fields filled in. */
00333
00334     if (CVSroot_method != pserver_method)
00335     {
00336     error (0, 0, "can only call GET_CVS_PASSWORD  with pserver method");
00337     error (1, 0, "CVSROOT: %s", CVSroot_original);
00338     }
00339
00340     if (! CVSroot_username)
00341     {
00342     error (0, 0, "CVSROOT \"%s\" is not fully-qualified.",
00343            CVSroot_original);
00344     error (1, 0, "Please make sure to specify \"user@host\"!");
00345     }
00346
00347     passfile = construct_cvspass_filename ();
00348     fp = CVS_FOPEN (passfile, "r");
00349     if (fp == NULL)
00350     {
00351     free (passfile);
00352     return NULL;
00353     }
00354
00355     root_len = strlen (CVSroot_original);
00356
00357     /* Check each line to see if we have this entry already. */
00358     while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
00359     {
00360     if (strncmp (CVSroot_original, linebuf, root_len) == 0)
00361         {
00362         /* This is it!  So break out and deal with linebuf. */
00363         found_it = 1;
00364         break;
00365         }
00366     }
00367     if (line_length < 0 && !feof (fp))
00368     error (0, errno, "cannot read %s", passfile);
00369     if (fclose (fp) < 0)
00370     error (0, errno, "cannot close %s", passfile);
00371
00372     if (found_it)
00373     {
00374     /* linebuf now contains the line with the password. */
00375     char *tmp;
00376
00377     strtok (linebuf, " ");
00378     tmp = strtok (NULL, "\n");
00379     if (tmp == NULL)
00380         error (1, 0, "bad entry in %s for %s", passfile, CVSroot_original);
00381
00382     /* Give it permanent storage. */
00383     password = xstrdup (tmp);
00384     memset (tmp, 0, strlen (password));
00385     }
00386
00387     if (linebuf)
00388         free (linebuf);
00389     free (passfile);
00390     return password;
00391 }
00392
00393 static const char *const logout_usage[] =
00394 {
00395     "Usage: %s %s\n",
00396     "(Specify the --help global option for a list of other help options)\n",
00397     NULL
00398 };
00399
00400 /* Remove any entry for the CVSRoot repository found in .cvspass. */
00401 int
00402 logout (argc, argv)
00403     int argc;
00404     char **argv;
00405 {
00406     char *passfile;
00407     FILE *fp;
00408     char *tmp_name = NULL;
00409     FILE *tmp_fp;
00410     char *linebuf = (char *) NULL;
00411     size_t linebuf_len;
00412     int root_len, found = 0;
00413     int line_length;
00414
00415     if (argc < 0)
00416     usage (logout_usage);
00417
00418     if (CVSroot_method != pserver_method)
00419     {
00420     error (0, 0, "can only use pserver method with `logout' command");
00421     error (1, 0, "CVSROOT: %s", CVSroot_original);
00422     }
00423
00424     if (! CVSroot_username)
00425     {
00426     error (0, 0, "CVSROOT \"%s\" is not fully-qualified.",
00427            CVSroot_original);
00428     error (1, 0, "Please make sure to specify \"user@host\"!");
00429     }
00430
00431     /* Hmm.  Do we want a variant of this command which deletes _all_
00432        the entries from the current .cvspass?  Might be easier to
00433        remember than "rm ~/.cvspass" but then again if people are
00434        mucking with HOME (common in Win95 as the system doesn't set
00435        it), then this variant of "cvs logout" might give a false sense
00436        of security, in that it wouldn't delete entries from any
00437        .cvspass files but the current one.  */
00438
00439     printf ("(Logging out of %s@%s)\n", CVSroot_username, CVSroot_hostname);
00440     fflush (stdout);
00441
00442     /* IF we have a password for this "[user@]host:/path" already
00443      *  THEN
00444      *    drop the entry
00445      *  ELSE
00446      *    do nothing
00447      */
00448
00449     passfile = construct_cvspass_filename ();
00450     /* FIXME: This should not be in /tmp; that is almost surely a security
00451        hole.  Probably should just keep it in memory.  */
00452     tmp_name = cvs_temp_name ();
00453     if ((tmp_fp = CVS_FOPEN (tmp_name, "w")) == NULL)
00454     {
00455     error (1, errno, "unable to open temp file %s", tmp_name);
00456     return 1;
00457     }
00458     chmod (tmp_name, 0600);
00459
00460     root_len = strlen (CVSroot_original);
00461
00462     fp = CVS_FOPEN (passfile, "r");
00463     if (fp == NULL)
00464         error (1, errno, "Error opening %s", passfile);
00465
00466     /* Check each line to see if we have this entry. */
00467     /* Copy only those lines that do not match this entry */
00468     while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
00469     {
00470     if (strncmp (CVSroot_original, linebuf, root_len))
00471     {
00472         if (fprintf (tmp_fp, "%s", linebuf) == EOF)
00473         error (0, errno, "cannot write %s", tmp_name);
00474     }
00475     else
00476         found = 1;
00477     }
00478     if (line_length < 0 && !feof (fp))
00479     error (0, errno, "cannot read %s", passfile);
00480
00481     if (linebuf)
00482         free (linebuf);
00483     if (fclose (fp) < 0)
00484     error (0, errno, "cannot close %s", passfile);
00485     if (fclose (tmp_fp) < 0)
00486     error (0, errno, "cannot close %s", tmp_name);
00487
00488     if (! found)
00489     {
00490     printf ("Entry not found for %s\n", CVSroot_original);
00491     if (unlink_file (tmp_name) < 0)
00492         error (0, errno, "cannot remove %s", tmp_name);
00493     }
00494     else
00495     {
00496     /* FIXME: rename_file would make more sense (e.g. almost
00497        always faster).  */
00498     copy_file (tmp_name, passfile);
00499     if (unlink_file (tmp_name) < 0)
00500         error (0, errno, "cannot remove %s", tmp_name);
00501     chmod (passfile, 0600);
00502     }
00503
00504     if (tmp_name)
00505         free (tmp_name);
00506
00507     return 0;
00508 }
00509
00510 #endif /* AUTH_CLIENT_SUPPORT from beginning of file. */
Generated on Sun Oct 21 12:41:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/logmsg.c Source File

cvs-1.10/src/logmsg.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  */
00008
00009 #include "cvs.h"
00010 #include "getline.h"
00011
00012 static int find_type PROTO((Node * p, void *closure));
00013 static int fmt_proc PROTO((Node * p, void *closure));
00014 static int logfile_write PROTO((char *repository, char *filter,
00015               char *message, FILE * logfp, List * changes));
00016 static int rcsinfo_proc PROTO((char *repository, char *template));
00017 static int title_proc PROTO((Node * p, void *closure));
00018 static int update_logfile_proc PROTO((char *repository, char *filter));
00019 static void setup_tmpfile PROTO((FILE * xfp, char *xprefix, List * changes));
00020 static int editinfo_proc PROTO((char *repository, char *template));
00021 static int verifymsg_proc PROTO((char *repository, char *script));
00022
00023 static FILE *fp;
00024 static char *str_list;
00025 static char *str_list_format;   /* The format for str_list's contents. */
00026 static char *editinfo_editor;
00027 static char *verifymsg_script;
00028 static Ctype type;
00029
00030 /*
00031  * Puts a standard header on the output which is either being prepared for an
00032  * editor session, or being sent to a logfile program.  The modified, added,
00033  * and removed files are included (if any) and formatted to look pretty. */
00034 static char *prefix;
00035 static int col;
00036 static char *tag;
00037 static void
00038 setup_tmpfile (xfp, xprefix, changes)
00039     FILE *xfp;
00040     char *xprefix;
00041     List *changes;
00042 {
00043     /* set up statics */
00044     fp = xfp;
00045     prefix = xprefix;
00046
00047     type = T_MODIFIED;
00048     if (walklist (changes, find_type, NULL) != 0)
00049     {
00050     (void) fprintf (fp, "%sModified Files:\n", prefix);
00051     col = 0;
00052     (void) walklist (changes, fmt_proc, NULL);
00053     (void) fprintf (fp, "\n");
00054     if (tag != NULL)
00055     {
00056         free (tag);
00057         tag = NULL;
00058     }
00059     }
00060     type = T_ADDED;
00061     if (walklist (changes, find_type, NULL) != 0)
00062     {
00063     (void) fprintf (fp, "%sAdded Files:\n", prefix);
00064     col = 0;
00065     (void) walklist (changes, fmt_proc, NULL);
00066     (void) fprintf (fp, "\n");
00067     if (tag != NULL)
00068     {
00069         free (tag);
00070         tag = NULL;
00071     }
00072     }
00073     type = T_REMOVED;
00074     if (walklist (changes, find_type, NULL) != 0)
00075     {
00076     (void) fprintf (fp, "%sRemoved Files:\n", prefix);
00077     col = 0;
00078     (void) walklist (changes, fmt_proc, NULL);
00079     (void) fprintf (fp, "\n");
00080     if (tag != NULL)
00081     {
00082         free (tag);
00083         tag = NULL;
00084     }
00085     }
00086 }
00087
00088 /*
00089  * Looks for nodes of a specified type and returns 1 if found
00090  */
00091 static int
00092 find_type (p, closure)
00093     Node *p;
00094     void *closure;
00095 {
00096     struct logfile_info *li;
00097
00098     li = (struct logfile_info *) p->data;
00099     if (li->type == type)
00100     return (1);
00101     else
00102     return (0);
00103 }
00104
00105 /*
00106  * Breaks the files list into reasonable sized lines to avoid line wrap...
00107  * all in the name of pretty output.  It only works on nodes whose types
00108  * match the one we're looking for
00109  */
00110 static int
00111 fmt_proc (p, closure)
00112     Node *p;
00113     void *closure;
00114 {
00115     struct logfile_info *li;
00116
00117     li = (struct logfile_info *) p->data;
00118     if (li->type == type)
00119     {
00120         if (li->tag == NULL
00121         ? tag != NULL
00122         : tag == NULL || strcmp (tag, li->tag) != 0)
00123     {
00124         if (col > 0)
00125             (void) fprintf (fp, "\n");
00126         (void) fprintf (fp, "%s", prefix);
00127         col = strlen (prefix);
00128         while (col < 6)
00129         {
00130             (void) fprintf (fp, " ");
00131         ++col;
00132         }
00133
00134         if (li->tag == NULL)
00135             (void) fprintf (fp, "No tag");
00136         else
00137             (void) fprintf (fp, "Tag: %s", li->tag);
00138
00139         if (tag != NULL)
00140             free (tag);
00141         tag = xstrdup (li->tag);
00142
00143         /* Force a new line.  */
00144         col = 70;
00145     }
00146
00147     if (col == 0)
00148     {
00149         (void) fprintf (fp, "%s\t", prefix);
00150         col = 8;
00151     }
00152     else if (col > 8 && (col + (int) strlen (p->key)) > 70)
00153     {
00154         (void) fprintf (fp, "\n%s\t", prefix);
00155         col = 8;
00156     }
00157     (void) fprintf (fp, "%s ", p->key);
00158     col += strlen (p->key) + 1;
00159     }
00160     return (0);
00161 }
00162
00163 /*
00164  * Builds a temporary file using setup_tmpfile() and invokes the user's
00165  * editor on the file.  The header garbage in the resultant file is then
00166  * stripped and the log message is stored in the "message" argument.
00167  *
00168  * If REPOSITORY is non-NULL, process rcsinfo for that repository; if it
00169  * is NULL, use the CVSADM_TEMPLATE file instead.
00170  */
00171 void
00172 do_editor (dir, messagep, repository, changes)
00173     char *dir;
00174     char **messagep;
00175     char *repository;
00176     List *changes;
00177 {
00178     static int reuse_log_message = 0;
00179     char *line;
00180     int line_length;
00181     size_t line_chars_allocated;
00182     char *fname;
00183     struct stat pre_stbuf, post_stbuf;
00184     int retcode = 0;
00185
00186     if (noexec || reuse_log_message)
00187     return;
00188
00189     /* Abort creation of temp file if no editor is defined */
00190     if (strcmp (Editor, "") == 0 && !editinfo_editor)
00191     error(1, 0, "no editor defined, must use -e or -m");
00192
00193
00194     /* Create a temporary file */
00195     fname = cvs_temp_name ();
00196   again:
00197     if ((fp = CVS_FOPEN (fname, "w+")) == NULL)
00198     error (1, 0, "cannot create temporary file %s", fname);
00199
00200     if (*messagep)
00201     {
00202     (void) fprintf (fp, "%s", *messagep);
00203
00204     if ((*messagep)[0] == '\0' ||
00205         (*messagep)[strlen (*messagep) - 1] != '\n')
00206         (void) fprintf (fp, "\n");
00207     }
00208     else
00209     (void) fprintf (fp, "\n");
00210
00211     if (repository != NULL)
00212     /* tack templates on if necessary */
00213     (void) Parse_Info (CVSROOTADM_RCSINFO, repository, rcsinfo_proc, 1);
00214     else
00215     {
00216     FILE *tfp;
00217     char buf[1024];
00218     size_t n;
00219     size_t nwrite;
00220
00221     /* Why "b"?  */
00222     tfp = CVS_FOPEN (CVSADM_TEMPLATE, "rb");
00223     if (tfp == NULL)
00224     {
00225         if (!existence_error (errno))
00226         error (1, errno, "cannot read %s", CVSADM_TEMPLATE);
00227     }
00228     else
00229     {
00230         while (!feof (tfp))
00231         {
00232         char *p = buf;
00233         n = fread (buf, 1, sizeof buf, tfp);
00234         nwrite = n;
00235         while (nwrite > 0)
00236         {
00237             n = fwrite (p, 1, nwrite, fp);
00238             nwrite -= n;
00239             p += n;
00240         }
00241         if (ferror (tfp))
00242             error (1, errno, "cannot read %s", CVSADM_TEMPLATE);
00243         }
00244         if (fclose (tfp) < 0)
00245         error (0, errno, "cannot close %s", CVSADM_TEMPLATE);
00246     }
00247     }
00248
00249     (void) fprintf (fp,
00250   "%s----------------------------------------------------------------------\n",
00251             CVSEDITPREFIX);
00252     (void) fprintf (fp,
00253   "%sEnter Log.  Lines beginning with `%.*s' are removed automatically\n%s\n",
00254             CVSEDITPREFIX, CVSEDITPREFIXLEN, CVSEDITPREFIX,
00255             CVSEDITPREFIX);
00256     if (dir != NULL && *dir)
00257     (void) fprintf (fp, "%sCommitting in %s\n%s\n", CVSEDITPREFIX,
00258             dir, CVSEDITPREFIX);
00259     if (changes != NULL)
00260     setup_tmpfile (fp, CVSEDITPREFIX, changes);
00261     (void) fprintf (fp,
00262   "%s----------------------------------------------------------------------\n",
00263             CVSEDITPREFIX);
00264
00265     /* finish off the temp file */
00266     if (fclose (fp) == EOF)
00267         error (1, errno, "%s", fname);
00268     if ( CVS_STAT (fname, &pre_stbuf) == -1)
00269     pre_stbuf.st_mtime = 0;
00270
00271     if (editinfo_editor)
00272     free (editinfo_editor);
00273     editinfo_editor = (char *) NULL;
00274 #ifdef CLIENT_SUPPORT
00275     if (client_active)
00276     ; /* nothing, leave editinfo_editor NULL */
00277     else
00278 #endif
00279     if (repository != NULL)
00280     (void) Parse_Info (CVSROOTADM_EDITINFO, repository, editinfo_proc, 0);
00281
00282     /* run the editor */
00283     run_setup (editinfo_editor ? editinfo_editor : Editor);
00284     run_arg (fname);
00285     if ((retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY,
00286                  RUN_NORMAL | RUN_SIGIGNORE)) != 0)
00287     error (editinfo_editor ? 1 : 0, retcode == -1 ? errno : 0,
00288            editinfo_editor ? "Logfile verification failed" :
00289            "warning: editor session failed");
00290
00291     /* put the entire message back into the *messagep variable */
00292
00293     fp = open_file (fname, "r");
00294
00295     if (*messagep)
00296     free (*messagep);
00297
00298     if ( CVS_STAT (fname, &post_stbuf) != 0)
00299         error (1, errno, "cannot find size of temp file %s", fname);
00300
00301     if (post_stbuf.st_size == 0)
00302     *messagep = NULL;
00303     else
00304     {
00305     /* On NT, we might read less than st_size bytes, but we won't
00306        read more.  So this works.  */
00307     *messagep = (char *) xmalloc (post_stbuf.st_size + 1);
00308     *messagep[0] = '\0';
00309     }
00310
00311     line = NULL;
00312     line_chars_allocated = 0;
00313
00314     if (*messagep)
00315     {
00316     size_t message_len = post_stbuf.st_size + 1;
00317     size_t offset = 0;
00318     while (1)
00319     {
00320         line_length = getline (&line, &line_chars_allocated, fp);
00321         if (line_length == -1)
00322         {
00323         if (ferror (fp))
00324             error (0, errno, "warning: cannot read %s", fname);
00325         break;
00326         }
00327         if (strncmp (line, CVSEDITPREFIX, CVSEDITPREFIXLEN) == 0)
00328         continue;
00329         if (offset + line_length >= message_len)
00330         expand_string (messagep, &message_len,
00331                 offset + line_length + 1);
00332         (void) strcpy (*messagep + offset, line);
00333         offset += line_length;
00334     }
00335     }
00336     if (fclose (fp) < 0)
00337     error (0, errno, "warning: cannot close %s", fname);
00338
00339     if (pre_stbuf.st_mtime == post_stbuf.st_mtime ||
00340     *messagep == NULL ||
00341     strcmp (*messagep, "\n") == 0)
00342     {
00343     for (;;)
00344     {
00345         (void) printf ("\nLog message unchanged or not specified\n");
00346         (void) printf ("a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs\n");
00347         (void) printf ("Action: (continue) ");
00348         (void) fflush (stdout);
00349         line_length = getline (&line, &line_chars_allocated, stdin);
00350         if (line_length < 0)
00351         {
00352         error (0, errno, "cannot read from stdin");
00353         if (unlink_file (fname) < 0)
00354             error (0, errno,
00355                "warning: cannot remove temp file %s", fname);
00356         error (1, 0, "aborting");
00357         }
00358         else if (line_length == 0
00359              || *line == '\n' || *line == 'c' || *line == 'C')
00360         break;
00361         if (*line == 'a' || *line == 'A')
00362         {
00363             if (unlink_file (fname) < 0)
00364             error (0, errno, "warning: cannot remove temp file %s", fname);
00365             error (1, 0, "aborted by user");
00366         }
00367         if (*line == 'e' || *line == 'E')
00368         goto again;
00369         if (*line == '!')
00370         {
00371         reuse_log_message = 1;
00372         break;
00373         }
00374         (void) printf ("Unknown input\n");
00375     }
00376     }
00377     if (line)
00378     free (line);
00379     if (unlink_file (fname) < 0)
00380     error (0, errno, "warning: cannot remove temp file %s", fname);
00381     free (fname);
00382 }
00383
00384 /* Runs the user-defined verification script as part of the commit or import
00385    process.  This verification is meant to be run whether or not the user
00386    included the -m atribute.  unlike the do_editor function, this is
00387    independant of the running of an editor for getting a message.
00388  */
00389 void
00390 do_verify (message, repository)
00391     char *message;
00392     char *repository;
00393 {
00394     FILE *fp;
00395     char *fname;
00396     int retcode = 0;
00397
00398 #ifdef CLIENT_SUPPORT
00399     if (client_active)
00400     /* The verification will happen on the server.  */
00401     return;
00402 #endif
00403
00404     /* FIXME? Do we really want to skip this on noexec?  What do we do
00405        for the other administrative files?  */
00406     if (noexec)
00407     return;
00408
00409     /* If there's no message, then we have nothing to verify.  Can this
00410        case happen?  And if so why would we print a message?  */
00411     if (message == NULL)
00412     {
00413     cvs_output ("No message to verify\n", 0);
00414     return;
00415     }
00416
00417     /* Get a temp filename, open a temporary file, write the message to the
00418        temp file, and close the file.  */
00419
00420     fname = cvs_temp_name ();
00421
00422     fp = fopen (fname, "w");
00423     if (fp == NULL)
00424     error (1, errno, "cannot create temporary file %s", fname);
00425     else
00426     {
00427     fprintf (fp, "%s", message);
00428     if ((message)[0] == '\0' ||
00429         (message)[strlen (message) - 1] != '\n')
00430         (void) fprintf (fp, "%s", "\n");
00431     if (fclose (fp) == EOF)
00432         error (1, errno, "%s", fname);
00433
00434     /* Get the name of the verification script to run  */
00435
00436     if (repository != NULL)
00437         (void) Parse_Info (CVSROOTADM_VERIFYMSG, repository,
00438                    verifymsg_proc, 0);
00439
00440     /* Run the verification script  */
00441
00442     if (verifymsg_script)
00443     {
00444         run_setup (verifymsg_script);
00445         run_arg (fname);
00446         if ((retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY,
00447                      RUN_NORMAL | RUN_SIGIGNORE)) != 0)
00448         {
00449         /* Since following error() exits, delete the temp file
00450            now.  */
00451         if (unlink_file (fname) < 0)
00452             error (0, errno, "cannot remove %s", fname);
00453
00454         error (1, retcode == -1 ? errno : 0,
00455                "Message verification failed");
00456         }
00457     }
00458
00459     /* Delete the temp file  */
00460
00461     if (unlink_file (fname) < 0)
00462         error (0, errno, "cannot remove %s", fname);
00463     free (fname);
00464     }
00465 }
00466
00467 /*
00468  * callback proc for Parse_Info for rcsinfo templates this routine basically
00469  * copies the matching template onto the end of the tempfile we are setting
00470  * up
00471  */
00472 /* ARGSUSED */
00473 static int
00474 rcsinfo_proc (repository, template)
00475     char *repository;
00476     char *template;
00477 {
00478     static char *last_template;
00479     FILE *tfp;
00480
00481     /* nothing to do if the last one included is the same as this one */
00482     if (last_template && strcmp (last_template, template) == 0)
00483     return (0);
00484     if (last_template)
00485     free (last_template);
00486     last_template = xstrdup (template);
00487
00488     if ((tfp = CVS_FOPEN (template, "r")) != NULL)
00489     {
00490     char *line = NULL;
00491     size_t line_chars_allocated = 0;
00492
00493     while (getline (&line, &line_chars_allocated, tfp) >= 0)
00494         (void) fputs (line, fp);
00495     if (ferror (tfp))
00496         error (0, errno, "warning: cannot read %s", template);
00497     if (fclose (tfp) < 0)
00498         error (0, errno, "warning: cannot close %s", template);
00499     if (line)
00500         free (line);
00501     return (0);
00502     }
00503     else
00504     {
00505     error (0, errno, "Couldn't open rcsinfo template file %s", template);
00506     return (1);
00507     }
00508 }
00509
00510 /*
00511  * Uses setup_tmpfile() to pass the updated message on directly to any
00512  * logfile programs that have a regular expression match for the checked in
00513  * directory in the source repository.  The log information is fed into the
00514  * specified program as standard input.
00515  */
00516 static FILE *logfp;
00517 static char *message;
00518 static List *changes;
00519
00520 void
00521 Update_Logfile (repository, xmessage, xlogfp, xchanges)
00522     char *repository;
00523     char *xmessage;
00524     FILE *xlogfp;
00525     List *xchanges;
00526 {
00527     /* nothing to do if the list is empty */
00528     if (xchanges == NULL || xchanges->list->next == xchanges->list)
00529     return;
00530
00531     /* set up static vars for update_logfile_proc */
00532     message = xmessage;
00533     logfp = xlogfp;
00534     changes = xchanges;
00535
00536     /* call Parse_Info to do the actual logfile updates */
00537     (void) Parse_Info (CVSROOTADM_LOGINFO, repository, update_logfile_proc, 1);
00538 }
00539
00540 /*
00541  * callback proc to actually do the logfile write from Update_Logfile
00542  */
00543 static int
00544 update_logfile_proc (repository, filter)
00545     char *repository;
00546     char *filter;
00547 {
00548     return (logfile_write (repository, filter, message, logfp, changes));
00549 }
00550
00551 /*
00552  * concatenate each filename/version onto str_list
00553  */
00554 static int
00555 title_proc (p, closure)
00556     Node *p;
00557     void *closure;
00558 {
00559     struct logfile_info *li;
00560     char *c;
00561
00562     li = (struct logfile_info *) p->data;
00563     if (li->type == type)
00564     {
00565     /* Until we decide on the correct logging solution when we add
00566        directories or perform imports, T_TITLE nodes will only
00567        tack on the name provided, regardless of the format string.
00568        You can verify that this assumption is safe by checking the
00569        code in add.c (add_directory) and import.c (import). */
00570
00571     str_list = xrealloc (str_list, strlen (str_list) + 5);
00572     (void) strcat (str_list, " ");
00573
00574     if (li->type == T_TITLE)
00575     {
00576         str_list = xrealloc (str_list,
00577                  strlen (str_list) + strlen (p->key) + 5);
00578         (void) strcat (str_list, p->key);
00579     }
00580     else
00581     {
00582         /* All other nodes use the format string. */
00583
00584         for (c = str_list_format; *c != '\0'; c++)
00585         {
00586         switch (*c)
00587         {
00588         case 's':
00589             str_list =
00590             xrealloc (str_list,
00591                   strlen (str_list) + strlen (p->key) + 5);
00592             (void) strcat (str_list, p->key);
00593             break;
00594         case 'V':
00595             str_list =
00596             xrealloc (str_list,
00597                   (strlen (str_list)
00598                    + (li->rev_old ? strlen (li->rev_old) : 0)
00599                    + 10)
00600                   );
00601             (void) strcat (str_list, (li->rev_old
00602                           ? li->rev_old : "NONE"));
00603             break;
00604         case 'v':
00605             str_list =
00606             xrealloc (str_list,
00607                   (strlen (str_list)
00608                    + (li->rev_new ? strlen (li->rev_new) : 0)
00609                    + 10)
00610                   );
00611             (void) strcat (str_list, (li->rev_new
00612                           ? li->rev_new : "NONE"));
00613             break;
00614         /* All other characters, we insert an empty field (but
00615            we do put in the comma separating it from other
00616            fields).  This way if future CVS versions add formatting
00617            characters, one can write a loginfo file which at least
00618            won't blow up on an old CVS.  */
00619         }
00620         if (*(c + 1) != '\0')
00621         {
00622             str_list = xrealloc (str_list, strlen (str_list) + 5);
00623             (void) strcat (str_list, ",");
00624         }
00625         }
00626     }
00627     }
00628     return (0);
00629 }
00630
00631 /*
00632  * Writes some stuff to the logfile "filter" and returns the status of the
00633  * filter program.
00634  */
00635 static int
00636 logfile_write (repository, filter, message, logfp, changes)
00637     char *repository;
00638     char *filter;
00639     char *message;
00640     FILE *logfp;
00641     List *changes;
00642 {
00643     FILE *pipefp;
00644     char *prog;
00645     char *cp;
00646     int c;
00647     int pipestatus;
00648     char *fmt_percent;      /* the location of the percent sign
00649                    that starts the format string. */
00650
00651     /* The user may specify a format string as part of the filter.
00652        Originally, `%s' was the only valid string.  The string that
00653        was substituted for it was:
00654
00655          <repository-name> <file1> <file2> <file3> ...
00656
00657        Each file was either a new directory/import (T_TITLE), or a
00658        added (T_ADDED), modified (T_MODIFIED), or removed (T_REMOVED)
00659        file.
00660
00661        It is desirable to preserve that behavior so lots of commitlog
00662        scripts won't die when they get this new code.  At the same
00663        time, we'd like to pass other information about the files (like
00664        version numbers, statuses, or checkin times).
00665
00666        The solution is to allow a format string that allows us to
00667        specify those other pieces of information.  The format string
00668        will be composed of `%' followed by a single format character,
00669        or followed by a set of format characters surrounded by `{' and
00670        `}' as separators.  The format characters are:
00671
00672          s = file name
00673      V = old version number (pre-checkin)
00674      v = new version number (post-checkin)
00675
00676        For example, valid format strings are:
00677
00678          %{}
00679      %s
00680      %{s}
00681      %{sVv}
00682
00683        There's no reason that more items couldn't be added (like
00684        modification date or file status [added, modified, updated,
00685        etc.]) -- the code modifications would be minimal (logmsg.c
00686        (title_proc) and commit.c (check_fileproc)).
00687
00688        The output will be a string of tokens separated by spaces.  For
00689        backwards compatibility, the the first token will be the
00690        repository name.  The rest of the tokens will be
00691        comma-delimited lists of the information requested in the
00692        format string.  For example, if `/u/src/master' is the
00693        repository, `%{sVv}' is the format string, and three files
00694        (ChangeLog, Makefile, foo.c) were modified, the output might
00695        be:
00696
00697          /u/src/master ChangeLog,1.1,1.2 Makefile,1.3,1.4 foo.c,1.12,1.13
00698
00699        Why this duplicates the old behavior when the format string is
00700        `%s' is left as an exercise for the reader. */
00701
00702     fmt_percent = strchr (filter, '%');
00703     if (fmt_percent)
00704     {
00705     int len;
00706     char *srepos;
00707     char *fmt_begin, *fmt_end;  /* beginning and end of the
00708                        format string specified in
00709                        filter. */
00710     char *fmt_continue;     /* where the string continues
00711                        after the format string (we
00712                        might skip a '}') somewhere
00713                        in there... */
00714
00715     /* Grab the format string. */
00716
00717     if ((*(fmt_percent + 1) == ' ') || (*(fmt_percent + 1) == '\0'))
00718     {
00719         /* The percent stands alone.  This is an error.  We could
00720            be treating ' ' like any other formatting character, but
00721            using it as a formatting character seems like it would be
00722            a mistake.  */
00723
00724         /* Would be nice to also be giving the line number.  */
00725         error (0, 0, "loginfo: '%%' not followed by formatting character");
00726         fmt_begin = fmt_percent + 1;
00727         fmt_end = fmt_begin;
00728         fmt_continue = fmt_begin;
00729     }
00730     else if (*(fmt_percent + 1) == '{')
00731     {
00732         /* The percent has a set of characters following it. */
00733
00734         fmt_begin = fmt_percent + 2;
00735         fmt_end = strchr (fmt_begin, '}');
00736         if (fmt_end)
00737         {
00738         /* Skip over the '}' character. */
00739
00740         fmt_continue = fmt_end + 1;
00741         }
00742         else
00743         {
00744         /* There was no close brace -- assume that format
00745                    string continues to the end of the line. */
00746
00747         /* Would be nice to also be giving the line number.  */
00748         error (0, 0, "loginfo: '}' missing");
00749         fmt_end = fmt_begin + strlen (fmt_begin);
00750         fmt_continue = fmt_end;
00751         }
00752     }
00753     else
00754     {
00755         /* The percent has a single character following it.  FIXME:
00756            %% should expand to a regular percent sign.  */
00757
00758         fmt_begin = fmt_percent + 1;
00759         fmt_end = fmt_begin + 1;
00760         fmt_continue = fmt_end;
00761     }
00762
00763     len = fmt_end - fmt_begin;
00764     str_list_format = xmalloc (len + 1);
00765     strncpy (str_list_format, fmt_begin, len);
00766     str_list_format[len] = '\0';
00767
00768     /* Allocate an initial chunk of memory.  As we build up the string
00769        we will realloc it.  */
00770     if (!str_list)
00771         str_list = xmalloc (1);
00772     str_list[0] = '\0';
00773
00774     /* Add entries to the string.  Don't bother looking for
00775            entries if the format string is empty. */
00776
00777     if (str_list_format[0] != '\0')
00778     {
00779         type = T_TITLE;
00780         (void) walklist (changes, title_proc, NULL);
00781         type = T_ADDED;
00782         (void) walklist (changes, title_proc, NULL);
00783         type = T_MODIFIED;
00784         (void) walklist (changes, title_proc, NULL);
00785         type = T_REMOVED;
00786         (void) walklist (changes, title_proc, NULL);
00787     }
00788
00789     free (str_list_format);
00790
00791     /* Construct the final string. */
00792
00793     srepos = Short_Repository (repository);
00794
00795     prog = xmalloc ((fmt_percent - filter) + strlen (srepos)
00796             + strlen (str_list) + strlen (fmt_continue)
00797             + 10);
00798     (void) strncpy (prog, filter, fmt_percent - filter);
00799     prog[fmt_percent - filter] = '\0';
00800     (void) strcat (prog, "'");
00801     (void) strcat (prog, srepos);
00802     (void) strcat (prog, str_list);
00803     (void) strcat (prog, "'");
00804     (void) strcat (prog, fmt_continue);
00805
00806     /* To be nice, free up some memory. */
00807
00808     free (str_list);
00809     str_list = (char *) NULL;
00810     }
00811     else
00812     {
00813     /* There's no format string. */
00814     prog = xstrdup (filter);
00815     }
00816
00817     if ((pipefp = run_popen (prog, "w")) == NULL)
00818     {
00819     if (!noexec)
00820         error (0, 0, "cannot write entry to log filter: %s", prog);
00821     free (prog);
00822     return (1);
00823     }
00824     (void) fprintf (pipefp, "Update of %s\n", repository);
00825     (void) fprintf (pipefp, "In directory %s:", hostname);
00826     cp = xgetwd ();
00827     if (cp == NULL)
00828     fprintf (pipefp, "<cannot get working directory: %s>\n\n",
00829          strerror (errno));
00830     else
00831     {
00832     fprintf (pipefp, "%s\n\n", cp);
00833     free (cp);
00834     }
00835
00836     setup_tmpfile (pipefp, "", changes);
00837     (void) fprintf (pipefp, "Log Message:\n%s\n", message);
00838     if (logfp != (FILE *) 0)
00839     {
00840     (void) fprintf (pipefp, "Status:\n");
00841     rewind (logfp);
00842     while ((c = getc (logfp)) != EOF)
00843         (void) putc ((char) c, pipefp);
00844     }
00845     free (prog);
00846     pipestatus = run_pclose (pipefp);
00847     return ((pipestatus == -1) || (pipestatus == 127)) ? 1 : 0;
00848 }
00849
00850 /*
00851  * We choose to use the *last* match within the editinfo file for this
00852  * repository.  This allows us to have a global editinfo program for the
00853  * root of some hierarchy, for example, and different ones within different
00854  * sub-directories of the root (like a special checker for changes made to
00855  * the "src" directory versus changes made to the "doc" or "test"
00856  * directories.
00857  */
00858 /* ARGSUSED */
00859 static int
00860 editinfo_proc(repository, editor)
00861     char *repository;
00862     char *editor;
00863 {
00864     /* nothing to do if the last match is the same as this one */
00865     if (editinfo_editor && strcmp (editinfo_editor, editor) == 0)
00866     return (0);
00867     if (editinfo_editor)
00868     free (editinfo_editor);
00869
00870     editinfo_editor = xstrdup (editor);
00871     return (0);
00872 }
00873
00874 /*  This routine is calld by Parse_Info.  it asigns the name of the
00875  *  message verification script to the global variable verify_script
00876  */
00877 static int
00878 verifymsg_proc (repository, script)
00879     char *repository;
00880     char *script;
00881 {
00882     if (verifymsg_script && strcmp (verifymsg_script, script) == 0)
00883     return (0);
00884     if (verifymsg_script)
00885     free (verifymsg_script);
00886     verifymsg_script = xstrdup (script);
00887     return (0);
00888 }
Generated on Sun Oct 21 12:41:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/main.c Source File

cvs-1.10/src/main.c

Go to the documentation of this file.
00001 /*
00002  *    Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  *    Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  *    You may distribute under the terms of the GNU General Public License
00006  *    as specified in the README file that comes with the CVS source distribution.
00007  *
00008  * This is the main C driver for the CVS system.
00009  *
00010  * Credit to Dick Grune, Vrije Universiteit, Amsterdam, for writing
00011  * the shell-script CVS system that this is based on.
00012  *
00013  */
00014
00015 #include <assert.h>
00016 #include "cvs.h"
00017
00018 #ifdef HAVE_WINSOCK_H
00019 #include <winsock.h>
00020 #else
00021 extern int gethostname ();
00022 #endif
00023
00024 char *program_name;
00025 char *program_path;
00026 char *command_name;
00027
00028 /* I'd dynamically allocate this, but it seems like gethostname
00029    requires a fixed size array.  If I'm remembering the RFCs right,
00030    256 should be enough.  */
00031 #ifndef MAXHOSTNAMELEN
00032 #define MAXHOSTNAMELEN  256
00033 #endif
00034
00035 char hostname[MAXHOSTNAMELEN];
00036
00037 int use_editor = 1;
00038 int use_cvsrc = 1;
00039 int cvswrite = !CVSREAD_DFLT;
00040 int really_quiet = 0;
00041 int quiet = 0;
00042 int trace = 0;
00043 int noexec = 0;
00044 int logoff = 0;
00045
00046 /* Set if we should be writing CVSADM directories at top level.  At
00047    least for now we'll make the default be off (the CVS 1.9, not CVS
00048    1.9.2, behavior). */
00049 int top_level_admin = 0;
00050
00051 mode_t cvsumask = UMASK_DFLT;
00052
00053 char *CurDir;
00054
00055 /*
00056  * Defaults, for the environment variables that are not set
00057  */
00058 char *Tmpdir = TMPDIR_DFLT;
00059 char *Editor = EDITOR_DFLT;
00060
00061
00062 /* When our working directory contains subdirectories with different
00063    values in CVS/Root files, we maintain a list of them.  */
00064 List *root_directories = NULL;
00065
00066 /* We step through the above values.  This variable is set to reflect
00067    the currently active value. */
00068 char *current_root = NULL;
00069
00070
00071 static const struct cmd
00072 {
00073     char *fullname;     /* Full name of the function (e.g. "commit") */
00074
00075     /* Synonyms for the command, nick1 and nick2.  We supply them
00076        mostly for two reasons: (1) CVS has always supported them, and
00077        we need to maintain compatibility, (2) if there is a need for a
00078        version which is shorter than the fullname, for ease in typing.
00079        Synonyms have the disadvantage that people will see "new" and
00080        then have to think about it, or look it up, to realize that is
00081        the operation they know as "add".  Also, this means that one
00082        cannot create a command "cvs new" with a different meaning.  So
00083        new synonyms are probably best used sparingly, and where used
00084        should be abbreviations of the fullname (preferably consisting
00085        of the first 2 or 3 or so letters).
00086
00087        One thing that some systems do is to recognize any unique
00088        abbreviation, for example "annotat" "annota", etc., for
00089        "annotate".  The problem with this is that scripts and user
00090        habits will expect a certain abbreviation to be unique, and in
00091        a future release of CVS it may not be.  So it is better to
00092        accept only an explicit list of abbreviations and plan on
00093        supporting them in the future as well as now.  */
00094
00095     char *nick1;
00096     char *nick2;
00097
00098     int (*func) ();     /* Function takes (argc, argv) arguments. */
00099 } cmds[] =
00100
00101 {
00102     { "add",      "ad",       "new",       add },
00103     { "admin",    "adm",      "rcs",       admin },
00104     { "annotate", "ann",      NULL,        annotate },
00105     { "checkout", "co",       "get",       checkout },
00106     { "commit",   "ci",       "com",       commit },
00107     { "diff",     "di",       "dif",       diff },
00108     { "edit",     NULL,       NULL,    edit },
00109     { "editors",  NULL,       NULL,    editors },
00110     { "export",   "exp",      "ex",        checkout },
00111     { "history",  "hi",       "his",       history },
00112     { "import",   "im",       "imp",       import },
00113     { "init",     NULL,       NULL,        init },
00114 #if defined (HAVE_KERBEROS) && defined (SERVER_SUPPORT)
00115     { "kserver",  NULL,       NULL,        server }, /* placeholder */
00116 #endif
00117     { "log",      "lo",       "rlog",      cvslog },
00118 #ifdef AUTH_CLIENT_SUPPORT
00119     { "login",    "logon",    "lgn",       login },
00120     { "logout",   NULL,       NULL,        logout },
00121 #endif /* AUTH_CLIENT_SUPPORT */
00122 #if (defined(AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)) && defined(SERVER_SUPPORT)
00123     { "pserver",  NULL,       NULL,        server }, /* placeholder */
00124 #endif
00125     { "rdiff",    "patch",    "pa",        patch },
00126     { "release",  "re",       "rel",       release },
00127     { "remove",   "rm",       "delete",    cvsremove },
00128     { "rtag",     "rt",       "rfreeze",   rtag },
00129 #ifdef SERVER_SUPPORT
00130     { "server",   NULL,       NULL,        server },
00131 #endif
00132     { "status",   "st",       "stat",      cvsstatus },
00133     { "tag",      "ta",       "freeze",    cvstag },
00134     { "unedit",   NULL,       NULL,    unedit },
00135     { "update",   "up",       "upd",       update },
00136     { "version",  "ve",       "ver",       version },
00137     { "watch",    NULL,       NULL,    watch },
00138     { "watchers", NULL,       NULL,    watchers },
00139     { NULL, NULL, NULL, NULL },
00140 };
00141
00142 static const char *const usg[] =
00143 {
00144     /* CVS usage messages never have followed the GNU convention of
00145        putting metavariables in uppercase.  I don't know whether that
00146        is a good convention or not, but if it changes it would have to
00147        change in all the usage messages.  For now, they consistently
00148        use lowercase, as far as I know.  Puncutation is pretty funky,
00149        though.  Sometimes they use none, as here.  Sometimes they use
00150        single quotes (not the TeX-ish `' stuff), as in --help-options.
00151        Sometimes they use double quotes, as in cvs -H add.
00152
00153        Most (not all) of the usage messages seem to have periods at
00154        the end of each line.  I haven't tried to duplicate this style
00155        in --help as it is a rather different format from the rest.  */
00156
00157     "Usage: %s [cvs-options] command [command-options-and-arguments]\n",
00158     "  where cvs-options are -q, -n, etc.\n",
00159     "    (specify --help-options for a list of options)\n",
00160     "  where command is add, admin, etc.\n",
00161     "    (specify --help-commands for a list of commands\n",
00162     "     or --help-synonyms for a list of command synonyms)\n",
00163     "  where command-options-and-arguments depend on the specific command\n",
00164     "    (specify -H followed by a command name for command-specific help)\n",
00165     "  Specify --help to receive this message\n",
00166     "\n",
00167
00168     /* Some people think that a bug-reporting address should go here.  IMHO,
00169        the web sites are better because anything else is very likely to go
00170        obsolete in the years between a release and when someone might be
00171        reading this help.  Besides, we could never adequately discuss
00172        bug reporting in a concise enough way to put in a help message.  */
00173
00174     /* I was going to put this at the top, but usage() wants the %s to
00175        be in the first line.  */
00176     "The Concurrent Versions System (CVS) is a tool for version control.\n",
00177     /* I really don't think I want to try to define "version control"
00178        in one line.  I'm not sure one can get more concise than the
00179        paragraph in ../cvs.spec without assuming the reader knows what
00180        version control means.  */
00181
00182     "For CVS updates and additional information, see\n",
00183     "    the CVS home page at http://www.cvshome.org/ or\n",
00184     "    Pascal Molli's CVS site at http://www.loria.fr/~molli/cvs-index.html\n",
00185     NULL,
00186 };
00187
00188 static const char *const cmd_usage[] =
00189 {
00190     "CVS commands are:\n",
00191     "        add          Add a new file/directory to the repository\n",
00192     "        admin        Administration front end for rcs\n",
00193     "        annotate     Show last revision where each line was modified\n",
00194     "        checkout     Checkout sources for editing\n",
00195     "        commit       Check files into the repository\n",
00196     "        diff         Show differences between revisions\n",
00197     "        edit         Get ready to edit a watched file\n",
00198     "        editors      See who is editing a watched file\n",
00199     "        export       Export sources from CVS, similar to checkout\n",
00200     "        history      Show repository access history\n",
00201     "        import       Import sources into CVS, using vendor branches\n",
00202     "        init         Create a CVS repository if it doesn't exist\n",
00203 #if defined (HAVE_KERBEROS) && defined (SERVER_SUPPORT)
00204     "        kserver      Kerberos server mode\n",
00205 #endif
00206     "        log          Print out history information for files\n",
00207 #ifdef AUTH_CLIENT_SUPPORT
00208     "        login        Prompt for password for authenticating server\n",
00209     "        logout       Removes entry in .cvspass for remote repository\n",
00210 #endif /* AUTH_CLIENT_SUPPORT */
00211 #if (defined(AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)) && defined(SERVER_SUPPORT)
00212     "        pserver      Password server mode\n",
00213 #endif
00214     "        rdiff        Create 'patch' format diffs between releases\n",
00215     "        release      Indicate that a Module is no longer in use\n",
00216     "        remove       Remove an entry from the repository\n",
00217     "        rtag         Add a symbolic tag to a module\n",
00218 #ifdef SERVER_SUPPORT
00219     "        server       Server mode\n",
00220 #endif
00221     "        status       Display status information on checked out files\n",
00222     "        tag          Add a symbolic tag to checked out version of files\n",
00223     "        unedit       Undo an edit command\n",
00224     "        update       Bring work tree in sync with repository\n",
00225     "        watch        Set watches\n",
00226     "        watchers     See who is watching a file\n",
00227     "(Specify the --help option for a list of other help options)\n",
00228     NULL,
00229 };
00230
00231 static const char *const opt_usage[] =
00232 {
00233     /* Omit -b because it is just for compatibility.  */
00234     "CVS global options (specified before the command name) are:\n",
00235     "    -H           Displays usage information for command.\n",
00236     "    -Q           Cause CVS to be really quiet.\n",
00237     "    -q           Cause CVS to be somewhat quiet.\n",
00238     "    -r           Make checked-out files read-only.\n",
00239     "    -w           Make checked-out files read-write (default).\n",
00240     "    -l           Turn history logging off.\n",
00241     "    -n           Do not execute anything that will change the disk.\n",
00242     "    -t           Show trace of program execution -- try with -n.\n",
00243     "    -v           CVS version and copyright.\n",
00244 #if defined(WIN32) && defined(CVSGUI)
00245     "    --crlf       Use the Dos line feed for text files (default).\n",
00246     "    --lf         Use the Unix line feed for text files.\n",
00247 #endif
00248     "    -T tmpdir    Use 'tmpdir' for temporary files.\n",
00249     "    -e editor    Use 'editor' for editing log information.\n",
00250     "    -d CVS_root  Overrides $CVSROOT as the root of the CVS tree.\n",
00251     "    -f           Do not use the ~/.cvsrc file.\n",
00252 #ifdef CLIENT_SUPPORT
00253     "    -z #         Use compression level '#' for net traffic.\n",
00254 #ifdef ENCRYPTION
00255     "    -x           Encrypt all net traffic.\n",
00256 #endif
00257     "    -a           Authenticate all net traffic.\n",
00258 #endif
00259     "    -s VAR=VAL   Set CVS user variable.\n",
00260     "(Specify the --help option for a list of other help options)\n",
00261     NULL
00262 };
00263
00264
00265 static int
00266 set_root_directory (p, ignored)
00267     Node *p;
00268     void *ignored;
00269 {
00270     if (current_root == NULL && p->data == NULL)
00271     {
00272     current_root = p->key;
00273     return 1;
00274     }
00275     return 0;
00276 }
00277
00278
00279 static const char * const*
00280 cmd_synonyms ()
00281 {
00282     char ** synonyms;
00283     char ** line;
00284     const struct cmd *c = &cmds[0];
00285     /* Three more for title, "specify --help" line, and NULL.  */
00286     int numcmds = 3;
00287
00288     while (c->fullname != NULL)
00289     {
00290     numcmds++;
00291     c++;
00292     }
00293
00294     synonyms = (char **) xmalloc(numcmds * sizeof(char *));
00295     line = synonyms;
00296     *line++ = "CVS command synonyms are:\n";
00297     for (c = &cmds[0]; c->fullname != NULL; c++)
00298     {
00299     if (c->nick1 || c->nick2)
00300     {
00301         *line = xmalloc (strlen (c->fullname)
00302                  + (c->nick1 != NULL ? strlen (c->nick1) : 0)
00303                  + (c->nick2 != NULL ? strlen (c->nick2) : 0)
00304                  + 40);
00305         sprintf(*line, "        %-12s %s %s\n", c->fullname,
00306             c->nick1 ? c->nick1 : "",
00307             c->nick2 ? c->nick2 : "");
00308         line++;
00309     }
00310     }
00311     *line++ = "(Specify the --help option for a list of other help options)\n";
00312     *line = NULL;
00313
00314     return (const char * const*) synonyms; /* will never be freed */
00315 }
00316
00317
00318 unsigned long int
00319 lookup_command_attribute (cmd_name)
00320      char *cmd_name;
00321 {
00322     unsigned long int ret = 0;
00323
00324     if (strcmp (cmd_name, "import") != 0)
00325     {
00326         ret |= CVS_CMD_IGNORE_ADMROOT;
00327     }
00328
00329
00330     /* The following commands do not use a checked-out working
00331        directory.  We conservatively assume that everything else does.
00332        Feel free to add to this list if you are _certain_ something
00333        something doesn't use the WD. */
00334     if ((strcmp (cmd_name, "checkout") != 0) &&
00335         (strcmp (cmd_name, "init") != 0) &&
00336         (strcmp (cmd_name, "login") != 0) &&
00337     (strcmp (cmd_name, "logout") != 0) &&
00338         (strcmp (cmd_name, "rdiff") != 0) &&
00339         (strcmp (cmd_name, "release") != 0) &&
00340         (strcmp (cmd_name, "rtag") != 0))
00341     {
00342         ret |= CVS_CMD_USES_WORK_DIR;
00343     }
00344
00345
00346     /* The following commands do not modify the repository; we
00347        conservatively assume that everything else does.  Feel free to
00348        add to this list if you are _certain_ something is safe. */
00349     if ((strcmp (cmd_name, "annotate") != 0) &&
00350         (strcmp (cmd_name, "checkout") != 0) &&
00351         (strcmp (cmd_name, "diff") != 0) &&
00352         (strcmp (cmd_name, "rdiff") != 0) &&
00353         (strcmp (cmd_name, "update") != 0) &&
00354         (strcmp (cmd_name, "editors") != 0) &&
00355         (strcmp (cmd_name, "export") != 0) &&
00356         (strcmp (cmd_name, "history") != 0) &&
00357         (strcmp (cmd_name, "log") != 0) &&
00358         (strcmp (cmd_name, "noop") != 0) &&
00359         (strcmp (cmd_name, "watchers") != 0) &&
00360         (strcmp (cmd_name, "release") != 0) &&
00361         (strcmp (cmd_name, "status") != 0))
00362     {
00363         ret |= CVS_CMD_MODIFIES_REPOSITORY;
00364     }
00365
00366     return ret;
00367 }
00368
00369
00370 static RETSIGTYPE
00371 main_cleanup (sig)
00372     int sig;
00373 {
00374 #ifndef DONT_USE_SIGNALS
00375     const char *name;
00376     char temp[10];
00377
00378     switch (sig)
00379     {
00380 #ifdef SIGABRT
00381     case SIGABRT:
00382     name = "abort";
00383     break;
00384 #endif
00385 #ifdef SIGHUP
00386     case SIGHUP:
00387     name = "hangup";
00388     break;
00389 #endif
00390 #ifdef SIGINT
00391     case SIGINT:
00392     name = "interrupt";
00393     break;
00394 #endif
00395 #ifdef SIGQUIT
00396     case SIGQUIT:
00397     name = "quit";
00398     break;
00399 #endif
00400 #ifdef SIGPIPE
00401     case SIGPIPE:
00402     name = "broken pipe";
00403     break;
00404 #endif
00405 #ifdef SIGTERM
00406     case SIGTERM:
00407     name = "termination";
00408     break;
00409 #endif
00410     default:
00411     /* This case should never be reached, because we list above all
00412        the signals for which we actually establish a signal handler.  */
00413     sprintf (temp, "%d", sig);
00414     name = temp;
00415     break;
00416     }
00417
00418     error (1, 0, "received %s signal", name);
00419 #endif /* !DONT_USE_SIGNALS */
00420 }
00421
00422 #if defined(WIN32) && defined(CVSGUI)
00423 static void winUseDosLineFeed(int useDos)
00424 {
00425    if(useDos)
00426     _fmode = _O_TEXT;
00427    else
00428     _fmode = _O_BINARY;
00429 }
00430 #endif
00431
00432 int
00433 main (argc, argv)
00434     int argc;
00435     char **argv;
00436 {
00437     char *CVSroot = CVSROOT_DFLT;
00438     char *cp, *end;
00439     const struct cmd *cm;
00440     int c, err = 0;
00441     int tmpdir_update_env, cvs_update_env;
00442     int free_CVSroot = 0;
00443     int free_Editor = 0;
00444     int free_Tmpdir = 0;
00445
00446     int help = 0;       /* Has the user asked for help?  This
00447                    lets us support the `cvs -H cmd'
00448                    convention to give help for cmd. */
00449     static const char short_options[] = "+Qqrwtnlvb:T:e:d:Hfz:s:xa";
00450     static struct option long_options[] =
00451     {
00452         {"help", 0, NULL, 'H'},
00453         {"version", 0, NULL, 'v'},
00454     {"help-commands", 0, NULL, 1},
00455     {"help-synonyms", 0, NULL, 2},
00456     {"help-options", 0, NULL, 4},
00457     {"allow-root", required_argument, NULL, 3},
00458 #if defined(WIN32) && defined(CVSGUI)
00459     {"crlf", 0, NULL, 5},
00460     {"lf", 0, NULL, 6},
00461 #endif
00462         {0, 0, 0, 0}
00463     };
00464     /* `getopt_long' stores the option index here, but right now we
00465         don't use it. */
00466     int option_index = 0;
00467
00468 #ifdef SYSTEM_INITIALIZE
00469     /* Hook for OS-specific behavior, for example socket subsystems on
00470        NT and OS2 or dealing with windows and arguments on Mac.  */
00471     SYSTEM_INITIALIZE (&argc, &argv);
00472 #endif
00473
00474 #ifdef HAVE_TZSET
00475     /* On systems that have tzset (which is almost all the ones I know
00476        of), it's a good idea to call it.  */
00477     tzset ();
00478 #endif
00479
00480     /*
00481      * Just save the last component of the path for error messages
00482      */
00483     program_path = xstrdup (argv[0]);
00484 #ifdef ARGV0_NOT_PROGRAM_NAME
00485     /* On some systems, e.g. VMS, argv[0] is not the name of the command
00486        which the user types to invoke the program.  */
00487     program_name = "cvs";
00488 #else
00489     program_name = last_component (argv[0]);
00490 #endif
00491
00492     /*
00493      * Query the environment variables up-front, so that
00494      * they can be overridden by command line arguments
00495      */
00496     cvs_update_env = 0;
00497     tmpdir_update_env = *Tmpdir;    /* TMPDIR_DFLT must be set */
00498     if ((cp = getenv (TMPDIR_ENV)) != NULL)
00499     {
00500     Tmpdir = cp;
00501     tmpdir_update_env = 0;      /* it's already there */
00502     }
00503     if ((cp = getenv (EDITOR1_ENV)) != NULL)
00504     Editor = cp;
00505     else if ((cp = getenv (EDITOR2_ENV)) != NULL)
00506     Editor = cp;
00507     else if ((cp = getenv (EDITOR3_ENV)) != NULL)
00508     Editor = cp;
00509     if ((cp = getenv (CVSROOT_ENV)) != NULL)
00510     {
00511     CVSroot = cp;
00512     cvs_update_env = 0;     /* it's already there */
00513     }
00514     if (getenv (CVSREAD_ENV) != NULL)
00515     cvswrite = 0;
00516
00517     /* Set this to 0 to force getopt initialization.  getopt() sets
00518        this to 1 internally.  */
00519     optind = 0;
00520
00521     /* We have to parse the options twice because else there is no
00522        chance to avoid reading the global options from ".cvsrc".  Set
00523        opterr to 0 for avoiding error messages about invalid options.
00524        */
00525     opterr = 0;
00526
00527     while ((c = getopt_long
00528             (argc, argv, short_options, long_options, &option_index))
00529            != EOF)
00530     {
00531     if (c == 'f')
00532         use_cvsrc = 0;
00533     }
00534
00535     /*
00536      * Scan cvsrc file for global options.
00537      */
00538     if (use_cvsrc)
00539     read_cvsrc (&argc, &argv, "cvs");
00540
00541 #if defined(WIN32) && defined(CVSGUI)
00542     /* in order to checkout the text files with the Unix Line Feed
00543     (usefull for Cygwin users). */
00544     if(getenv("CVSUSEUNIXLF") != 0L)
00545     winUseDosLineFeed(0);
00546 #endif
00547
00548     optind = 0;
00549     opterr = 1;
00550
00551     while ((c = getopt_long
00552             (argc, argv, short_options, long_options, &option_index))
00553            != EOF)
00554     {
00555     switch (c)
00556     {
00557 #if defined(WIN32) && defined(CVSGUI)
00558             case 5:
00559             /* --crlf */
00560                 winUseDosLineFeed(1);
00561                 break;
00562             case 6:
00563             /* --lf */
00564                 winUseDosLineFeed(0);
00565                 break;
00566 #endif
00567             case 1:
00568             /* --help-commands */
00569                 usage (cmd_usage);
00570                 break;
00571             case 2:
00572             /* --help-synonyms */
00573                 usage (cmd_synonyms());
00574                 break;
00575         case 4:
00576         /* --help-options */
00577         usage (opt_usage);
00578         break;
00579         case 3:
00580         /* --allow-root */
00581         root_allow_add (optarg);
00582         break;
00583         case 'Q':
00584         really_quiet = 1;
00585         /* FALL THROUGH */
00586         case 'q':
00587         quiet = 1;
00588         break;
00589         case 'r':
00590         cvswrite = 0;
00591         break;
00592         case 'w':
00593         cvswrite = 1;
00594         break;
00595         case 't':
00596         trace = 1;
00597         break;
00598         case 'n':
00599         noexec = 1;
00600         case 'l':           /* Fall through */
00601         logoff = 1;
00602         break;
00603         case 'v':
00604         (void) fputs ("\n", stdout);
00605         version (0, (char **) NULL);
00606         (void) fputs ("\n", stdout);
00607         (void) fputs ("\
00608 Copyright (c) 1989-2000 Brian Berliner, david d `zoo' zuhn, \n\
00609                         Jeff Polk, and other authors\n", stdout);
00610         (void) fputs ("\n", stdout);
00611         (void) fputs ("CVS may be copied only under the terms of the GNU General Public License,\n", stdout);
00612         (void) fputs ("a copy of which can be found with the CVS distribution kit.\n", stdout);
00613         (void) fputs ("\n", stdout);
00614
00615         (void) fputs ("Specify the --help option for further information about CVS\n", stdout);
00616
00617         exit (0);
00618         break;
00619         case 'b':
00620         /* This option used to specify the directory for RCS
00621            executables.  But since we don't run them any more,
00622            this is a noop.  Silently ignore it so that .cvsrc
00623            and scripts and inetd.conf and such can work with
00624            either new or old CVS.  */
00625         break;
00626         case 'T':
00627         Tmpdir = xstrdup (optarg);
00628         free_Tmpdir = 1;
00629         tmpdir_update_env = 1;  /* need to update environment */
00630         break;
00631         case 'e':
00632         Editor = xstrdup (optarg);
00633         free_Editor = 1;
00634         break;
00635         case 'd':
00636         if (CVSroot_cmdline != NULL)
00637             free (CVSroot_cmdline);
00638         CVSroot_cmdline = xstrdup (optarg);
00639         CVSroot = xstrdup (optarg);
00640         free_CVSroot = 1;
00641         cvs_update_env = 1; /* need to update environment */
00642         break;
00643         case 'H':
00644             help = 1;
00645         break;
00646             case 'f':
00647         use_cvsrc = 0; /* unnecessary, since we've done it above */
00648         break;
00649         case 'z':
00650 #ifdef CLIENT_SUPPORT
00651         gzip_level = atoi (optarg);
00652         if (gzip_level < 0 || gzip_level > 9)
00653           error (1, 0,
00654              "gzip compression level must be between 0 and 9");
00655 #endif
00656         /* If no CLIENT_SUPPORT, we just silently ignore the gzip
00657            level, so that users can have it in their .cvsrc and not
00658            cause any trouble.  */
00659         break;
00660         case 's':
00661         variable_set (optarg);
00662         break;
00663         case 'x':
00664 #ifdef CLIENT_SUPPORT
00665             cvsencrypt = 1;
00666 #endif /* CLIENT_SUPPORT */
00667         /* If no CLIENT_SUPPORT, ignore -x, so that users can
00668                    have it in their .cvsrc and not cause any trouble.
00669                    If no ENCRYPTION, we still accept -x, but issue an
00670                    error if we are being run as a client.  */
00671         break;
00672         case 'a':
00673 #ifdef CLIENT_SUPPORT
00674         cvsauthenticate = 1;
00675 #endif
00676         /* If no CLIENT_SUPPORT, ignore -a, so that users can
00677                    have it in their .cvsrc and not cause any trouble.
00678                    We will issue an error later if stream
00679                    authentication is not supported.  */
00680         break;
00681         case '?':
00682         default:
00683                 usage (usg);
00684     }
00685     }
00686
00687     argc -= optind;
00688     argv += optind;
00689     if (argc < 1)
00690     usage (usg);
00691
00692
00693     /* Look up the command name. */
00694
00695     command_name = argv[0];
00696     for (cm = cmds; cm->fullname; cm++)
00697     {
00698     if (cm->nick1 && !strcmp (command_name, cm->nick1))
00699         break;
00700     if (cm->nick2 && !strcmp (command_name, cm->nick2))
00701         break;
00702     if (!strcmp (command_name, cm->fullname))
00703         break;
00704     }
00705
00706     if (!cm->fullname)
00707     {
00708     fprintf (stderr, "Unknown command: `%s'\n\n", command_name);
00709     usage (cmd_usage);
00710     }
00711     else
00712     command_name = cm->fullname;    /* Global pointer for later use */
00713
00714     /* This should probably remain a warning, rather than an error,
00715        for quite a while.  For one thing the version of VC distributed
00716        with GNU emacs 19.34 invokes 'cvs rlog' instead of 'cvs log'.  */
00717     if (strcmp (argv[0], "rlog") == 0)
00718     {
00719     error (0, 0, "warning: the rlog command is deprecated");
00720     error (0, 0, "use the synonymous log command instead");
00721     }
00722
00723     if (help)
00724     {
00725     argc = -1;      /* some functions only check for this */
00726     err = (*(cm->func)) (argc, argv);
00727     }
00728     else
00729     {
00730     /* The user didn't ask for help, so go ahead and authenticate,
00731            set up CVSROOT, and the rest of it. */
00732
00733     /* The UMASK environment variable isn't handled with the
00734        others above, since we don't want to signal errors if the
00735        user has asked for help.  This won't work if somebody adds
00736        a command-line flag to set the umask, since we'll have to
00737        parse it before we get here. */
00738
00739     if ((cp = getenv (CVSUMASK_ENV)) != NULL)
00740     {
00741         /* FIXME: Should be accepting symbolic as well as numeric mask.  */
00742         cvsumask = strtol (cp, &end, 8) & 0777;
00743         if (*end != '\0')
00744         error (1, errno, "invalid umask value in %s (%s)",
00745                CVSUMASK_ENV, cp);
00746     }
00747
00748 #if defined (HAVE_KERBEROS) && defined (SERVER_SUPPORT)
00749     /* If we are invoked with a single argument "kserver", then we are
00750        running as Kerberos server as root.  Do the authentication as
00751        the very first thing, to minimize the amount of time we are
00752        running as root.  */
00753     if (strcmp (command_name, "kserver") == 0)
00754     {
00755         kserver_authenticate_connection ();
00756
00757         /* Pretend we were invoked as a plain server.  */
00758         command_name = "server";
00759     }
00760 #endif /* HAVE_KERBEROS */
00761
00762
00763 #if (defined(AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)) && defined(SERVER_SUPPORT)
00764     if (strcmp (command_name, "pserver") == 0)
00765     {
00766         /* The reason that --allow-root is not a command option
00767            is mainly the comment in server() about how argc,argv
00768            might be from .cvsrc.  I'm not sure about that, and
00769            I'm not sure it is only true of command options, but
00770            it seems easier to make it a global option.  */
00771
00772         /* Gets username and password from client, authenticates, then
00773            switches to run as that user and sends an ACK back to the
00774            client. */
00775         pserver_authenticate_connection ();
00776
00777         /* Pretend we were invoked as a plain server.  */
00778         command_name = "server";
00779     }
00780 #endif /* (AUTH_SERVER_SUPPORT || HAVE_GSSAPI) && SERVER_SUPPORT */
00781
00782 #ifdef SERVER_SUPPORT
00783     server_active = strcmp (command_name, "server") == 0;
00784 #endif
00785
00786     /* This is only used for writing into the history file.  For
00787        remote connections, it might be nice to have hostname
00788        and/or remote path, on the other hand I'm not sure whether
00789        it is worth the trouble.  */
00790
00791 #ifdef SERVER_SUPPORT
00792     if (server_active)
00793         CurDir = xstrdup ("<remote>");
00794     else
00795 #endif
00796     {
00797         CurDir = xgetwd ();
00798             if (CurDir == NULL)
00799         error (1, errno, "cannot get working directory");
00800     }
00801
00802     if (Tmpdir == NULL || Tmpdir[0] == '\0')
00803         Tmpdir = "/tmp";
00804
00805 #ifdef HAVE_PUTENV
00806     if (tmpdir_update_env)
00807     {
00808         char *env;
00809         env = xmalloc (strlen (TMPDIR_ENV) + strlen (Tmpdir) + 1 + 1);
00810         (void) sprintf (env, "%s=%s", TMPDIR_ENV, Tmpdir);
00811         (void) putenv (env);
00812         /* do not free env, as putenv has control of it */
00813     }
00814 #endif
00815
00816 #ifndef DONT_USE_SIGNALS
00817     /* make sure we clean up on error */
00818 #ifdef SIGABRT
00819     (void) SIG_register (SIGABRT, main_cleanup);
00820 #endif
00821 #ifdef SIGHUP
00822     (void) SIG_register (SIGHUP, main_cleanup);
00823 #endif
00824 #ifdef SIGINT
00825     (void) SIG_register (SIGINT, main_cleanup);
00826 #endif
00827 #ifdef SIGQUIT
00828     (void) SIG_register (SIGQUIT, main_cleanup);
00829 #endif
00830 #ifdef SIGPIPE
00831     (void) SIG_register (SIGPIPE, main_cleanup);
00832 #endif
00833 #ifdef SIGTERM
00834     (void) SIG_register (SIGTERM, main_cleanup);
00835 #endif
00836 #endif /* !DONT_USE_SIGNALS */
00837
00838     gethostname(hostname, sizeof (hostname));
00839
00840 #ifdef KLUDGE_FOR_WNT_TESTSUITE
00841     /* Probably the need for this will go away at some point once
00842        we call fflush enough places (e.g. fflush (stdout) in
00843        cvs_outerr).  */
00844     (void) setvbuf (stdout, (char *) NULL, _IONBF, 0);
00845     (void) setvbuf (stderr, (char *) NULL, _IONBF, 0);
00846 #endif /* KLUDGE_FOR_WNT_TESTSUITE */
00847
00848     if (use_cvsrc)
00849         read_cvsrc (&argc, &argv, command_name);
00850
00851 #ifdef SERVER_SUPPORT
00852     /* Fiddling with CVSROOT doesn't make sense if we're running
00853            in server mode, since the client will send the repository
00854            directory after the connection is made. */
00855
00856     if (!server_active)
00857 #endif
00858     {
00859         char *CVSADM_Root;
00860
00861         /* See if we are able to find a 'better' value for CVSroot
00862            in the CVSADM_ROOT directory. */
00863
00864         CVSADM_Root = NULL;
00865
00866         /* "cvs import" shouldn't check CVS/Root; in general it
00867            ignores CVS directories and CVS/Root is likely to
00868            specify a different repository than the one we are
00869            importing to.  */
00870
00871         if ((lookup_command_attribute (command_name)
00872          & CVS_CMD_IGNORE_ADMROOT)
00873
00874         /* -d overrides CVS/Root, so don't give an error if the
00875            latter points to a nonexistent repository.  */
00876         && CVSroot_cmdline == NULL)
00877         {
00878         CVSADM_Root = Name_Root((char *) NULL, (char *) NULL);
00879         }
00880
00881         if (CVSADM_Root != NULL)
00882         {
00883         if (CVSroot == NULL || !cvs_update_env)
00884         {
00885             CVSroot = CVSADM_Root;
00886             cvs_update_env = 1; /* need to update environment */
00887         }
00888         }
00889
00890         /* Now we've reconciled CVSROOT from the command line, the
00891            CVS/Root file, and the environment variable.  Do the
00892            last sanity checks on the variable. */
00893
00894         if (! CVSroot)
00895         {
00896         error (0, 0,
00897                "No CVSROOT specified!  Please use the `-d' option");
00898         error (1, 0,
00899                "or set the %s environment variable.", CVSROOT_ENV);
00900         }
00901
00902         if (! *CVSroot)
00903         {
00904         error (0, 0,
00905                "CVSROOT is set but empty!  Make sure that the");
00906         error (0, 0,
00907                "specification of CVSROOT is legal, either via the");
00908         error (0, 0,
00909                "`-d' option, the %s environment variable, or the",
00910                CVSROOT_ENV);
00911         error (1, 0,
00912                "CVS/Root file (if any).");
00913         }
00914     }
00915
00916     /* Here begins the big loop over unique cvsroot values.  We
00917            need to call do_recursion once for each unique value found
00918            in CVS/Root.  Prime the list with the current value. */
00919
00920     /* Create the list. */
00921     assert (root_directories == NULL);
00922     root_directories = getlist ();
00923
00924     /* Prime it. */
00925     if (CVSroot != NULL)
00926     {
00927         Node *n;
00928         n = getnode ();
00929         n->type = NT_UNKNOWN;
00930         n->key = xstrdup (CVSroot);
00931         n->data = NULL;
00932
00933         if (addnode (root_directories, n))
00934         error (1, 0, "cannot add initial CVSROOT %s", n->key);
00935     }
00936
00937     assert (current_root == NULL);
00938
00939     /* If we're running the server, we want to execute this main
00940        loop once and only once (we won't be serving multiple roots
00941        from this connection, so there's no need to do it more than
00942        once).  To get out of the loop, we perform a "break" at the
00943        end of things.  */
00944
00945     while (
00946 #ifdef SERVER_SUPPORT
00947            server_active ||
00948 #endif
00949            walklist (root_directories, set_root_directory, NULL)
00950            )
00951     {
00952 #ifdef SERVER_SUPPORT
00953         /* Fiddling with CVSROOT doesn't make sense if we're running
00954            in server mode, since the client will send the repository
00955            directory after the connection is made. */
00956
00957         if (!server_active)
00958 #endif
00959         {
00960         /* Now we're 100% sure that we have a valid CVSROOT
00961            variable.  Parse it to see if we're supposed to do
00962            remote accesses or use a special access method. */
00963
00964         if (parse_cvsroot (current_root))
00965             error (1, 0, "Bad CVSROOT.");
00966
00967         if (trace)
00968             error (0, 0, "notice: main loop with CVSROOT=%s",
00969                current_root);
00970
00971         /*
00972          * Check to see if the repository exists.
00973          */
00974         if (!client_active)
00975         {
00976             char *path;
00977             int save_errno;
00978
00979             path = xmalloc (strlen (CVSroot_directory)
00980                     + sizeof (CVSROOTADM)
00981                     + 20);
00982             (void) sprintf (path, "%s/%s", CVSroot_directory, CVSROOTADM);
00983             if (!isaccessible (path, R_OK | X_OK))
00984             {
00985             save_errno = errno;
00986             /* If this is "cvs init", the root need not exist yet.  */
00987             if (strcmp (command_name, "init") != 0)
00988             {
00989                 error (1, save_errno, "%s", path);
00990             }
00991             }
00992             free (path);
00993         }
00994
00995 #ifdef HAVE_PUTENV
00996         /* Update the CVSROOT environment variable if necessary. */
00997         /* FIXME (njc): should we always set this with the CVSROOT from the command line? */
00998         if (cvs_update_env)
00999         {
01000             static char *prev;
01001             char *env;
01002             env = xmalloc (strlen (CVSROOT_ENV) + strlen (CVSroot)
01003                    + 1 + 1);
01004             (void) sprintf (env, "%s=%s", CVSROOT_ENV, CVSroot);
01005             (void) putenv (env);
01006             /* do not free env yet, as putenv has control of it */
01007             /* but do free the previous value, if any */
01008             if (prev != NULL)
01009             free (prev);
01010             prev = env;
01011         }
01012 #endif
01013         }
01014
01015         /* Parse the CVSROOT/config file, but only for local.  For the
01016            server, we parse it after we know $CVSROOT.  For the
01017            client, it doesn't get parsed at all, obviously.  The
01018            presence of the parse_config call here is not mean to
01019            predetermine whether CVSROOT/config overrides things from
01020            read_cvsrc and other such places or vice versa.  That sort
01021            of thing probably needs more thought.  */
01022         if (1
01023 #ifdef SERVER_SUPPORT
01024         && !server_active
01025 #endif
01026 #ifdef CLIENT_SUPPORT
01027         && !client_active
01028 #endif
01029         )
01030         {
01031         /* If there was an error parsing the config file, parse_config
01032            already printed an error.  We keep going.  Why?  Because
01033            if we didn't, then there would be no way to check in a new
01034            CVSROOT/config file to fix the broken one!  */
01035         parse_config (CVSroot_directory);
01036         }
01037
01038 #ifdef CLIENT_SUPPORT
01039         if (client_active)
01040         {
01041         /* Create a new list for directory names that we've
01042            sent to the server. */
01043         if (dirs_sent_to_server != NULL)
01044             dellist (&dirs_sent_to_server);
01045         dirs_sent_to_server = getlist ();
01046         }
01047 #endif
01048
01049         err = (*(cm->func)) (argc, argv);
01050
01051         /* Mark this root directory as done.  When the server is
01052                active, current_root will be NULL -- don't try and
01053                remove it from the list. */
01054
01055         if (current_root != NULL)
01056         {
01057         Node *n = findnode (root_directories, current_root);
01058         assert (n != NULL);
01059         n->data = (void *) 1;
01060         current_root = NULL;
01061         }
01062
01063 #if 0
01064         /* This will not work yet, since it tries to free (void *) 1. */
01065         dellist (&root_directories);
01066 #endif
01067
01068 #ifdef SERVER_SUPPORT
01069         if (server_active)
01070           break;
01071 #endif
01072     } /* end of loop for cvsroot values */
01073
01074     } /* end of stuff that gets done if the user DOESN'T ask for help */
01075
01076     Lock_Cleanup ();
01077
01078     free (program_path);
01079     if (CVSroot_cmdline != NULL)
01080     free (CVSroot_cmdline);
01081     if (free_CVSroot)
01082     free (CVSroot);
01083     if (free_Editor)
01084     free (Editor);
01085     if (free_Tmpdir)
01086     free (Tmpdir);
01087     root_allow_free ();
01088
01089 #ifdef SYSTEM_CLEANUP
01090     /* Hook for OS-specific behavior, for example socket subsystems on
01091        NT and OS2 or dealing with windows and arguments on Mac.  */
01092     SYSTEM_CLEANUP ();
01093 #endif
01094
01095     /* This is exit rather than return because apparently that keeps
01096        some tools which check for memory leaks happier.  */
01097     exit (err ? EXIT_FAILURE : 0);
01098     /* Keep picky/stupid compilers (e.g. Visual C++ 5.0) happy.  */
01099     return 0;
01100 }
01101
01102 char *
01103 Make_Date (rawdate)
01104     char *rawdate;
01105 {
01106     time_t unixtime;
01107
01108     unixtime = get_date (rawdate, (struct timeb *) NULL);
01109     if (unixtime == (time_t) - 1)
01110     error (1, 0, "Can't parse date/time: %s", rawdate);
01111     return date_from_time_t (unixtime);
01112 }
01113
01114 /* Convert a time_t to an RCS format date.  This is mainly for the
01115    use of "cvs history", because the CVSROOT/history file contains
01116    time_t format dates; most parts of CVS will want to avoid using
01117    time_t's directly, and instead use RCS_datecmp, Make_Date, &c.
01118    Assuming that the time_t is in GMT (as it generally should be),
01119    then the result will be in GMT too.
01120
01121    Returns a newly malloc'd string.  */
01122
01123 char *
01124 date_from_time_t (unixtime)
01125     time_t unixtime;
01126 {
01127     struct tm *ftm;
01128     char date[MAXDATELEN];
01129     char *ret;
01130
01131     ftm = gmtime (&unixtime);
01132     if (ftm == NULL)
01133     /* This is a system, like VMS, where the system clock is in local
01134        time.  Hopefully using localtime here matches the "zero timezone"
01135        hack I added to get_date (get_date of course being the relevant
01136        issue for Make_Date, and for history.c too I think).  */
01137     ftm = localtime (&unixtime);
01138
01139     (void) sprintf (date, DATEFORM,
01140             ftm->tm_year + (ftm->tm_year < 100 ? 0 : 1900),
01141             ftm->tm_mon + 1, ftm->tm_mday, ftm->tm_hour,
01142             ftm->tm_min, ftm->tm_sec);
01143     ret = xstrdup (date);
01144     return (ret);
01145 }
01146
01147 /* Convert a date to RFC822/1123 format.  This is used in contexts like
01148    dates to send in the protocol; it should not vary based on locale or
01149    other such conventions for users.  We should have another routine which
01150    does that kind of thing.
01151
01152    The SOURCE date is in our internal RCS format.  DEST should point to
01153    storage managed by the caller, at least MAXDATELEN characters.  */
01154 void
01155 date_to_internet (dest, source)
01156     char *dest;
01157     char *source;
01158 {
01159     int year, month, day, hour, minute, second;
01160
01161     /* Just to reiterate, these strings are from RFC822 and do not vary
01162        according to locale.  */
01163     static const char *const month_names[] =
01164       {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
01165      "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
01166
01167     if (sscanf (source, SDATEFORM,
01168         &year, &month, &day, &hour, &minute, &second)
01169     != 6)
01170     /* Is there a better way to handle errors here?  I made this
01171        non-fatal in case we are called from the code which can't
01172        deal with fatal errors.  */
01173     error (0, 0, "internal error: bad date %s", source);
01174
01175     /* Always send a four digit year.  */
01176     if (year < 100)
01177     year += 1900;
01178
01179     sprintf (dest, "%d %s %d %02d:%02d:%02d -0000", day,
01180          month < 1 || month > 12 ? "???" : month_names[month - 1],
01181          year, hour, minute, second);
01182 }
01183
01184 void
01185 usage (cpp)
01186     register const char *const *cpp;
01187 {
01188     (void) fprintf (stderr, *cpp++, program_name, command_name);
01189     for (; *cpp; cpp++)
01190     (void) fprintf (stderr, *cpp);
01191     error_exit ();
01192 }
Generated on Sun Oct 21 12:41:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/mkmodules.c Source File

cvs-1.10/src/mkmodules.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS kit.  */
00007
00008 #include "cvs.h"
00009 #include "savecwd.h"
00010 #include "getline.h"
00011
00012 #ifndef DBLKSIZ
00013 #define DBLKSIZ 4096            /* since GNU ndbm doesn't define it */
00014 #endif
00015
00016 static int checkout_file PROTO((char *file, char *temp));
00017 static char *make_tempfile PROTO((void));
00018 static void rename_rcsfile PROTO((char *temp, char *real));
00019
00020 #ifndef MY_NDBM
00021 static void rename_dbmfile PROTO((char *temp));
00022 static void write_dbmfile PROTO((char *temp));
00023 #endif              /* !MY_NDBM */
00024
00025 /* Structure which describes an administrative file.  */
00026 struct admin_file {
00027    /* Name of the file, within the CVSROOT directory.  */
00028    char *filename;
00029
00030    /* This is a one line description of what the file is for.  It is not
00031       currently used, although one wonders whether it should be, somehow.
00032       If NULL, then don't process this file in mkmodules (FIXME?: a bit of
00033       a kludge; probably should replace this with a flags field).  */
00034    char *errormsg;
00035
00036    /* Contents which the file should have in a new repository.  To avoid
00037       problems with brain-dead compilers which choke on long string constants,
00038       this is a pointer to an array of char * terminated by NULL--each of
00039       the strings is concatenated.
00040
00041       If this field is NULL, the file is not created in a new
00042       repository, but it can be added with "cvs add" (just as if one
00043       had created the repository with a version of CVS which didn't
00044       know about the file) and the checked-out copy will be updated
00045       without having to add it to checkoutlist.  */
00046    const char * const *contents;
00047 };
00048
00049 static const char *const loginfo_contents[] = {
00050     "# The \"loginfo\" file controls where \"cvs commit\" log information\n",
00051     "# is sent.  The first entry on a line is a regular expression which must match\n",
00052     "# the directory that the change is being made to, relative to the\n",
00053     "# $CVSROOT.  If a match is found, then the remainder of the line is a filter\n",
00054     "# program that should expect log information on its standard input.\n",
00055     "#\n",
00056     "# If the repository name does not match any of the regular expressions in this\n",
00057     "# file, the \"DEFAULT\" line is used, if it is specified.\n",
00058     "#\n",
00059     "# If the name ALL appears as a regular expression it is always used\n",
00060     "# in addition to the first matching regex or DEFAULT.\n",
00061     "#\n",
00062     "# You may specify a format string as part of the\n",
00063     "# filter.  The string is composed of a `%' followed\n",
00064     "# by a single format character, or followed by a set of format\n",
00065     "# characters surrounded by `{' and `}' as separators.  The format\n",
00066     "# characters are:\n",
00067     "#\n",
00068     "#   s = file name\n",
00069     "#   V = old version number (pre-checkin)\n",
00070     "#   v = new version number (post-checkin)\n",
00071     "#\n",
00072     "# For example:\n",
00073     "#DEFAULT (echo \"\"; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog\n",
00074     "# or\n",
00075     "#DEFAULT (echo \"\"; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog\n",
00076     NULL
00077 };
00078
00079 static const char *const rcsinfo_contents[] = {
00080     "# The \"rcsinfo\" file is used to control templates with which the editor\n",
00081     "# is invoked on commit and import.\n",
00082     "#\n",
00083     "# The first entry on a line is a regular expression which is tested\n",
00084     "# against the directory that the change is being made to, relative to the\n",
00085     "# $CVSROOT.  For the first match that is found, then the remainder of the\n",
00086     "# line is the name of the file that contains the template.\n",
00087     "#\n",
00088     "# If the repository name does not match any of the regular expressions in this\n",
00089     "# file, the \"DEFAULT\" line is used, if it is specified.\n",
00090     "#\n",
00091     "# If the name \"ALL\" appears as a regular expression it is always used\n",
00092     "# in addition to the first matching regex or \"DEFAULT\".\n",
00093     NULL
00094 };
00095
00096 static const char *const editinfo_contents[] = {
00097     "# The \"editinfo\" file is used to allow verification of logging\n",
00098     "# information.  It works best when a template (as specified in the\n",
00099     "# rcsinfo file) is provided for the logging procedure.  Given a\n",
00100     "# template with locations for, a bug-id number, a list of people who\n",
00101     "# reviewed the code before it can be checked in, and an external\n",
00102     "# process to catalog the differences that were code reviewed, the\n",
00103     "# following test can be applied to the code:\n",
00104     "#\n",
00105     "#   Making sure that the entered bug-id number is correct.\n",
00106     "#   Validating that the code that was reviewed is indeed the code being\n",
00107     "#       checked in (using the bug-id number or a seperate review\n",
00108     "#       number to identify this particular code set.).\n",
00109     "#\n",
00110     "# If any of the above test failed, then the commit would be aborted.\n",
00111     "#\n",
00112     "# Actions such as mailing a copy of the report to each reviewer are\n",
00113     "# better handled by an entry in the loginfo file.\n",
00114     "#\n",
00115     "# One thing that should be noted is the the ALL keyword is not\n",
00116     "# supported.  There can be only one entry that matches a given\n",
00117     "# repository.\n",
00118     NULL
00119 };
00120
00121 static const char *const verifymsg_contents[] = {
00122     "# The \"verifymsg\" file is used to allow verification of logging\n",
00123     "# information.  It works best when a template (as specified in the\n",
00124     "# rcsinfo file) is provided for the logging procedure.  Given a\n",
00125     "# template with locations for, a bug-id number, a list of people who\n",
00126     "# reviewed the code before it can be checked in, and an external\n",
00127     "# process to catalog the differences that were code reviewed, the\n",
00128     "# following test can be applied to the code:\n",
00129     "#\n",
00130     "#   Making sure that the entered bug-id number is correct.\n",
00131     "#   Validating that the code that was reviewed is indeed the code being\n",
00132     "#       checked in (using the bug-id number or a seperate review\n",
00133     "#       number to identify this particular code set.).\n",
00134     "#\n",
00135     "# If any of the above test failed, then the commit would be aborted.\n",
00136     "#\n",
00137     "# Actions such as mailing a copy of the report to each reviewer are\n",
00138     "# better handled by an entry in the loginfo file.\n",
00139     "#\n",
00140     "# One thing that should be noted is the the ALL keyword is not\n",
00141     "# supported.  There can be only one entry that matches a given\n",
00142     "# repository.\n",
00143     NULL
00144 };
00145
00146 static const char *const commitinfo_contents[] = {
00147     "# The \"commitinfo\" file is used to control pre-commit checks.\n",
00148     "# The filter on the right is invoked with the repository and a list \n",
00149     "# of files to check.  A non-zero exit of the filter program will \n",
00150     "# cause the commit to be aborted.\n",
00151     "#\n",
00152     "# The first entry on a line is a regular expression which is tested\n",
00153     "# against the directory that the change is being committed to, relative\n",
00154     "# to the $CVSROOT.  For the first match that is found, then the remainder\n",
00155     "# of the line is the name of the filter to run.\n",
00156     "#\n",
00157     "# If the repository name does not match any of the regular expressions in this\n",
00158     "# file, the \"DEFAULT\" line is used, if it is specified.\n",
00159     "#\n",
00160     "# If the name \"ALL\" appears as a regular expression it is always used\n",
00161     "# in addition to the first matching regex or \"DEFAULT\".\n",
00162     NULL
00163 };
00164
00165 static const char *const taginfo_contents[] = {
00166     "# The \"taginfo\" file is used to control pre-tag checks.\n",
00167     "# The filter on the right is invoked with the following arguments:\n",
00168     "#\n",
00169     "# $1 -- tagname\n",
00170     "# $2 -- operation \"add\" for tag, \"mov\" for tag -F, and \"del\" for tag -d\n",
00171     "# $3 -- repository\n",
00172     "# $4->  file revision [file revision ...]\n",
00173     "#\n",
00174     "# A non-zero exit of the filter program will cause the tag to be aborted.\n",
00175     "#\n",
00176     "# The first entry on a line is a regular expression which is tested\n",
00177     "# against the directory that the change is being committed to, relative\n",
00178     "# to the $CVSROOT.  For the first match that is found, then the remainder\n",
00179     "# of the line is the name of the filter to run.\n",
00180     "#\n",
00181     "# If the repository name does not match any of the regular expressions in this\n",
00182     "# file, the \"DEFAULT\" line is used, if it is specified.\n",
00183     "#\n",
00184     "# If the name \"ALL\" appears as a regular expression it is always used\n",
00185     "# in addition to the first matching regex or \"DEFAULT\".\n",
00186     NULL
00187 };
00188
00189 static const char *const checkoutlist_contents[] = {
00190     "# The \"checkoutlist\" file is used to support additional version controlled\n",
00191     "# administrative files in $CVSROOT/CVSROOT, such as template files.\n",
00192     "#\n",
00193     "# The first entry on a line is a filename which will be checked out from\n",
00194     "# the corresponding RCS file in the $CVSROOT/CVSROOT directory.\n",
00195     "# The remainder of the line is an error message to use if the file cannot\n",
00196     "# be checked out.\n",
00197     "#\n",
00198     "# File format:\n",
00199     "#\n",
00200     "#  [<whitespace>]<filename><whitespace><error message><end-of-line>\n",
00201     "#\n",
00202     "# comment lines begin with '#'\n",
00203     NULL
00204 };
00205
00206 static const char *const cvswrappers_contents[] = {
00207     "# This file affects handling of files based on their names.\n",
00208     "#\n",
00209     "# The -t/-f options allow one to treat directories of files\n",
00210     "# as a single file, or to transform a file in other ways on\n",
00211     "# its way in and out of CVS.\n",
00212     "#\n",
00213     "# The -m option specifies whether CVS attempts to merge files.\n",
00214     "#\n",
00215     "# The -k option specifies keyword expansion (e.g. -kb for binary).\n",
00216     "#\n",
00217     "# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)\n",
00218     "#\n",
00219     "#  wildcard    [option value][option value]...\n",
00220     "#\n",
00221     "#  where option is one of\n",
00222     "#  -f      from cvs filter     value: path to filter\n",
00223     "#  -t      to cvs filter       value: path to filter\n",
00224     "#  -m      update methodology  value: MERGE or COPY\n",
00225     "#  -k      expansion mode      value: b, o, kkv, &c\n",
00226     "#\n",
00227     "#  and value is a single-quote delimited value.\n",
00228     "# For example:\n",
00229     "#*.gif -k 'b'\n",
00230     NULL
00231 };
00232
00233 static const char *const notify_contents[] = {
00234     "# The \"notify\" file controls where notifications from watches set by\n",
00235     "# \"cvs watch add\" or \"cvs edit\" are sent.  The first entry on a line is\n",
00236     "# a regular expression which is tested against the directory that the\n",
00237     "# change is being made to, relative to the $CVSROOT.  If it matches,\n",
00238     "# then the remainder of the line is a filter program that should contain\n",
00239     "# one occurrence of %s for the user to notify, and information on its\n",
00240     "# standard input.\n",
00241     "#\n",
00242     "# \"ALL\" or \"DEFAULT\" can be used in place of the regular expression.\n",
00243     "#\n",
00244     "# For example:\n",
00245     "#ALL mail %s -s \"CVS notification\"\n",
00246     NULL
00247 };
00248
00249 static const char *const modules_contents[] = {
00250     "# Three different line formats are valid:\n",
00251     "#  key -a    aliases...\n",
00252     "#  key [options] directory\n",
00253     "#  key [options] directory files...\n",
00254     "#\n",
00255     "# Where \"options\" are composed of:\n",
00256     "#  -i prog     Run \"prog\" on \"cvs commit\" from top-level of module.\n",
00257     "#  -o prog     Run \"prog\" on \"cvs checkout\" of module.\n",
00258     "#  -e prog     Run \"prog\" on \"cvs export\" of module.\n",
00259     "#  -t prog     Run \"prog\" on \"cvs rtag\" of module.\n",
00260     "#  -u prog     Run \"prog\" on \"cvs update\" of module.\n",
00261     "#  -d dir      Place module in directory \"dir\" instead of module name.\n",
00262     "#  -l      Top-level directory only -- do not recurse.\n",
00263     "#\n",
00264     "# NOTE:  If you change any of the \"Run\" options above, you'll have to\n",
00265     "# release and re-checkout any working directories of these modules.\n",
00266     "#\n",
00267     "# And \"directory\" is a path to a directory relative to $CVSROOT.\n",
00268     "#\n",
00269     "# The \"-a\" option specifies an alias.  An alias is interpreted as if\n",
00270     "# everything on the right of the \"-a\" had been typed on the command line.\n",
00271     "#\n",
00272     "# You can encode a module within a module by using the special '&'\n",
00273     "# character to interpose another module into the current module.  This\n",
00274     "# can be useful for creating a module that consists of many directories\n",
00275     "# spread out over the entire source repository.\n",
00276     NULL
00277 };
00278
00279 static const char *const config_contents[] = {
00280     "# Set this to \"no\" if pserver shouldn't check system users/passwords\n",
00281     "#SystemAuth=no\n",
00282     "\n",
00283     "# Put CVS lock files in this directory rather than directly in the repository.\n",
00284     "#LockDir=/var/lock/cvs\n",
00285     "\n",
00286 #ifdef PRESERVE_PERMISSIONS_SUPPORT
00287     "# Set `PreservePermissions' to `yes' to save file status information\n",
00288     "# in the repository.\n",
00289     "#PreservePermissions=no\n",
00290     "\n",
00291 #endif
00292     "# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top\n",
00293     "# level of the new working directory when using the `cvs checkout'\n",
00294     "# command.\n",
00295     "#TopLevelAdmin=no\n",
00296     "\n",
00297     "# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the\n",
00298     "# history file, or a subset as needed (ie `TMAR' logs all write operations)\n",
00299     "#LogHistory=TOFEWGCMAR\n",
00300     NULL
00301 };
00302
00303 static const struct admin_file filelist[] = {
00304     {CVSROOTADM_LOGINFO,
00305     "no logging of 'cvs commit' messages is done without a %s file",
00306     &loginfo_contents[0]},
00307     {CVSROOTADM_RCSINFO,
00308     "a %s file can be used to configure 'cvs commit' templates",
00309     rcsinfo_contents},
00310     {CVSROOTADM_EDITINFO,
00311     "a %s file can be used to validate log messages",
00312     editinfo_contents},
00313     {CVSROOTADM_VERIFYMSG,
00314     "a %s file can be used to validate log messages",
00315     verifymsg_contents},
00316     {CVSROOTADM_COMMITINFO,
00317     "a %s file can be used to configure 'cvs commit' checking",
00318     commitinfo_contents},
00319     {CVSROOTADM_TAGINFO,
00320     "a %s file can be used to configure 'cvs tag' checking",
00321     taginfo_contents},
00322     {CVSROOTADM_IGNORE,
00323     "a %s file can be used to specify files to ignore",
00324     NULL},
00325     {CVSROOTADM_CHECKOUTLIST,
00326     "a %s file can specify extra CVSROOT files to auto-checkout",
00327     checkoutlist_contents},
00328     {CVSROOTADM_WRAPPER,
00329     "a %s file can be used to specify files to treat as wrappers",
00330     cvswrappers_contents},
00331     {CVSROOTADM_NOTIFY,
00332     "a %s file can be used to specify where notifications go",
00333     notify_contents},
00334     {CVSROOTADM_MODULES,
00335     /* modules is special-cased in mkmodules.  */
00336     NULL,
00337     modules_contents},
00338     {CVSROOTADM_READERS,
00339     "a %s file specifies read-only users",
00340     NULL},
00341     {CVSROOTADM_WRITERS,
00342     "a %s file specifies read/write users",
00343     NULL},
00344
00345     /* Some have suggested listing CVSROOTADM_PASSWD here too.  This
00346        would mean that CVS commands which operate on the
00347        CVSROOTADM_PASSWD file would transmit hashed passwords over the
00348        net.  This might seem to be no big deal, as pserver normally
00349        transmits cleartext passwords, but the difference is that
00350        CVSROOTADM_PASSWD contains *all* passwords, not just the ones
00351        currently being used.  For example, it could be too easy to
00352        accidentally give someone readonly access to CVSROOTADM_PASSWD
00353        (e.g. via anonymous CVS or cvsweb), and then if there are any
00354        guessable passwords for read/write access (usually there will be)
00355        they get read/write access.
00356
00357        Another worry is the implications of storing old passwords--if
00358        someone used a password in the past they might be using it
00359        elsewhere, using a similar password, etc, and so saving old
00360        passwords, even hashed, is probably not a good idea.  */
00361
00362     {CVSROOTADM_CONFIG,
00363      "a %s file configures various behaviors",
00364      config_contents},
00365     {NULL, NULL, NULL}
00366 };
00367
00368 /* Rebuild the checked out administrative files in directory DIR.  */
00369 int
00370 mkmodules (dir)
00371     char *dir;
00372 {
00373     struct saved_cwd cwd;
00374     char *temp;
00375     char *cp, *last, *fname;
00376 #ifdef MY_NDBM
00377     DBM *db;
00378 #endif
00379     FILE *fp;
00380     char *line = NULL;
00381     size_t line_allocated = 0;
00382     const struct admin_file *fileptr;
00383
00384     if (noexec)
00385     return 0;
00386
00387     if (save_cwd (&cwd))
00388     error_exit ();
00389
00390     if ( CVS_CHDIR (dir) < 0)
00391     error (1, errno, "cannot chdir to %s", dir);
00392
00393     /*
00394      * First, do the work necessary to update the "modules" database.
00395      */
00396     temp = make_tempfile ();
00397     switch (checkout_file (CVSROOTADM_MODULES, temp))
00398     {
00399
00400     case 0:         /* everything ok */
00401 #ifdef MY_NDBM
00402         /* open it, to generate any duplicate errors */
00403         if ((db = dbm_open (temp, O_RDONLY, 0666)) != NULL)
00404         dbm_close (db);
00405 #else
00406         write_dbmfile (temp);
00407         rename_dbmfile (temp);
00408 #endif
00409         rename_rcsfile (temp, CVSROOTADM_MODULES);
00410         break;
00411
00412     default:
00413         error (0, 0,
00414         "'cvs checkout' is less functional without a %s file",
00415         CVSROOTADM_MODULES);
00416         break;
00417     }                   /* switch on checkout_file() */
00418
00419     if (unlink_file (temp) < 0
00420     && !existence_error (errno))
00421     error (0, errno, "cannot remove %s", temp);
00422     free (temp);
00423
00424     /* Checkout the files that need it in CVSROOT dir */
00425     for (fileptr = filelist; fileptr && fileptr->filename; fileptr++) {
00426     if (fileptr->errormsg == NULL)
00427         continue;
00428     temp = make_tempfile ();
00429     if (checkout_file (fileptr->filename, temp) == 0)
00430         rename_rcsfile (temp, fileptr->filename);
00431 #if 0
00432     /*
00433      * If there was some problem other than the file not existing,
00434      * checkout_file already printed a real error message.  If the
00435      * file does not exist, it is harmless--it probably just means
00436      * that the repository was created with an old version of CVS
00437      * which didn't have so many files in CVSROOT.
00438      */
00439     else if (fileptr->errormsg)
00440         error (0, 0, fileptr->errormsg, fileptr->filename);
00441 #endif
00442     if (unlink_file (temp) < 0
00443         && !existence_error (errno))
00444         error (0, errno, "cannot remove %s", temp);
00445     free (temp);
00446     }
00447
00448     fp = CVS_FOPEN (CVSROOTADM_CHECKOUTLIST, "r");
00449     if (fp)
00450     {
00451     /*
00452      * File format:
00453      *  [<whitespace>]<filename><whitespace><error message><end-of-line>
00454      *
00455      * comment lines begin with '#'
00456      */
00457     while (getline (&line, &line_allocated, fp) >= 0)
00458     {
00459         /* skip lines starting with # */
00460         if (line[0] == '#')
00461         continue;
00462
00463         if ((last = strrchr (line, '\n')) != NULL)
00464         *last = '\0';           /* strip the newline */
00465
00466         /* Skip leading white space. */
00467         for (fname = line;
00468          *fname && isspace ((unsigned char) *fname);
00469          fname++)
00470         ;
00471
00472         /* Find end of filename. */
00473         for (cp = fname; *cp && !isspace ((unsigned char) *cp); cp++)
00474         ;
00475         *cp = '\0';
00476
00477         temp = make_tempfile ();
00478         if (checkout_file (fname, temp) == 0)
00479         {
00480         rename_rcsfile (temp, fname);
00481         }
00482         else
00483         {
00484         for (cp++;
00485              cp < last && *last && isspace ((unsigned char) *last);
00486              cp++)
00487             ;
00488         if (cp < last && *cp)
00489             error (0, 0, cp, fname);
00490         }
00491         if (unlink_file (temp) < 0
00492         && !existence_error (errno))
00493         error (0, errno, "cannot remove %s", temp);
00494         free (temp);
00495     }
00496     if (line)
00497         free (line);
00498     if (ferror (fp))
00499         error (0, errno, "cannot read %s", CVSROOTADM_CHECKOUTLIST);
00500     if (fclose (fp) < 0)
00501         error (0, errno, "cannot close %s", CVSROOTADM_CHECKOUTLIST);
00502     }
00503     else
00504     {
00505     /* Error from CVS_FOPEN.  */
00506     if (!existence_error (errno))
00507         error (0, errno, "cannot open %s", CVSROOTADM_CHECKOUTLIST);
00508     }
00509
00510     if (restore_cwd (&cwd, NULL))
00511     error_exit ();
00512     free_cwd (&cwd);
00513
00514     return (0);
00515 }
00516
00517 /*
00518  * Yeah, I know, there are NFS race conditions here.
00519  */
00520 static char *
00521 make_tempfile ()
00522 {
00523     static int seed = 0;
00524     int fd;
00525     char *temp;
00526
00527     if (seed == 0)
00528     seed = getpid ();
00529     temp = xmalloc (sizeof (BAKPREFIX) + 40);
00530     while (1)
00531     {
00532     (void) sprintf (temp, "%s%d", BAKPREFIX, seed++);
00533     if ((fd = CVS_OPEN (temp, O_CREAT|O_EXCL|O_RDWR, 0666)) != -1)
00534         break;
00535     if (errno != EEXIST)
00536         error (1, errno, "cannot create temporary file %s", temp);
00537     }
00538     if (close(fd) < 0)
00539     error(1, errno, "cannot close temporary file %s", temp);
00540     return temp;
00541 }
00542
00543 /* Get a file.  If the file does not exist, return 1 silently.  If
00544    there is an error, print a message and return 1 (FIXME: probably
00545    not a very clean convention).  On success, return 0.  */
00546
00547 static int
00548 checkout_file (file, temp)
00549     char *file;
00550     char *temp;
00551 {
00552     char *rcs;
00553     RCSNode *rcsnode;
00554     int retcode = 0;
00555
00556     if (noexec)
00557     return 0;
00558
00559     rcs = xmalloc (strlen (file) + 5);
00560     strcpy (rcs, file);
00561     strcat (rcs, RCSEXT);
00562     if (!isfile (rcs))
00563     {
00564     free (rcs);
00565     return (1);
00566     }
00567     rcsnode = RCS_parsercsfile (rcs);
00568     retcode = RCS_checkout (rcsnode, NULL, NULL, NULL, NULL, temp,
00569                 (RCSCHECKOUTPROC) NULL, (void *) NULL);
00570     if (retcode != 0)
00571     {
00572     /* Probably not necessary (?); RCS_checkout already printed a
00573        message.  */
00574     error (0, 0, "failed to check out %s file",
00575            file);
00576     }
00577     freercsnode (&rcsnode);
00578     free (rcs);
00579     return (retcode);
00580 }
00581
00582 #ifndef MY_NDBM
00583
00584 static void
00585 write_dbmfile (temp)
00586     char *temp;
00587 {
00588     char line[DBLKSIZ], value[DBLKSIZ];
00589     FILE *fp;
00590     DBM *db;
00591     char *cp, *vp;
00592     datum key, val;
00593     int len, cont, err = 0;
00594
00595     fp = open_file (temp, "r");
00596     if ((db = dbm_open (temp, O_RDWR | O_CREAT | O_TRUNC, 0666)) == NULL)
00597     error (1, errno, "cannot open dbm file %s for creation", temp);
00598     for (cont = 0; fgets (line, sizeof (line), fp) != NULL;)
00599     {
00600     if ((cp = strrchr (line, '\n')) != NULL)
00601         *cp = '\0';         /* strip the newline */
00602
00603     /*
00604      * Add the line to the value, at the end if this is a continuation
00605      * line; otherwise at the beginning, but only after any trailing
00606      * backslash is removed.
00607      */
00608     vp = value;
00609     if (cont)
00610         vp += strlen (value);
00611
00612     /*
00613      * See if the line we read is a continuation line, and strip the
00614      * backslash if so.
00615      */
00616     len = strlen (line);
00617     if (len > 0)
00618         cp = &line[len - 1];
00619     else
00620         cp = line;
00621     if (*cp == '\\')
00622     {
00623         cont = 1;
00624         *cp = '\0';
00625     }
00626     else
00627     {
00628         cont = 0;
00629     }
00630     (void) strcpy (vp, line);
00631     if (value[0] == '#')
00632         continue;           /* comment line */
00633     vp = value;
00634     while (*vp && isspace ((unsigned char) *vp))
00635         vp++;
00636     if (*vp == '\0')
00637         continue;           /* empty line */
00638
00639     /*
00640      * If this was not a continuation line, add the entry to the database
00641      */
00642     if (!cont)
00643     {
00644         key.dptr = vp;
00645         while (*vp && !isspace ((unsigned char) *vp))
00646         vp++;
00647         key.dsize = vp - key.dptr;
00648         *vp++ = '\0';       /* NULL terminate the key */
00649         while (*vp && isspace ((unsigned char) *vp))
00650         vp++;           /* skip whitespace to value */
00651         if (*vp == '\0')
00652         {
00653         error (0, 0, "warning: NULL value for key `%s'", key.dptr);
00654         continue;
00655         }
00656         val.dptr = vp;
00657         val.dsize = strlen (vp);
00658         if (dbm_store (db, key, val, DBM_INSERT) == 1)
00659         {
00660         error (0, 0, "duplicate key found for `%s'", key.dptr);
00661         err++;
00662         }
00663     }
00664     }
00665     dbm_close (db);
00666     if (fclose (fp) < 0)
00667     error (0, errno, "cannot close %s", temp);
00668     if (err)
00669     {
00670     /* I think that the size of the buffer needed here is
00671        just determined by sizeof (CVSROOTADM_MODULES), the
00672        filenames created by make_tempfile, and other things that won't
00673        overflow.  */
00674     char dotdir[50], dotpag[50], dotdb[50];
00675
00676     (void) sprintf (dotdir, "%s.dir", temp);
00677     (void) sprintf (dotpag, "%s.pag", temp);
00678     (void) sprintf (dotdb, "%s.db", temp);
00679     if (unlink_file (dotdir) < 0
00680         && !existence_error (errno))
00681         error (0, errno, "cannot remove %s", dotdir);
00682     if (unlink_file (dotpag) < 0
00683         && !existence_error (errno))
00684         error (0, errno, "cannot remove %s", dotpag);
00685     if (unlink_file (dotdb) < 0
00686         && !existence_error (errno))
00687         error (0, errno, "cannot remove %s", dotdb);
00688     error (1, 0, "DBM creation failed; correct above errors");
00689     }
00690 }
00691
00692 static void
00693 rename_dbmfile (temp)
00694     char *temp;
00695 {
00696     /* I think that the size of the buffer needed here is
00697        just determined by sizeof (CVSROOTADM_MODULES), the
00698        filenames created by make_tempfile, and other things that won't
00699        overflow.  */
00700     char newdir[50], newpag[50], newdb[50];
00701     char dotdir[50], dotpag[50], dotdb[50];
00702     char bakdir[50], bakpag[50], bakdb[50];
00703
00704     int dir1_errno = 0, pag1_errno = 0, db1_errno = 0;
00705     int dir2_errno = 0, pag2_errno = 0, db2_errno = 0;
00706     int dir3_errno = 0, pag3_errno = 0, db3_errno = 0;
00707
00708     (void) sprintf (dotdir, "%s.dir", CVSROOTADM_MODULES);
00709     (void) sprintf (dotpag, "%s.pag", CVSROOTADM_MODULES);
00710     (void) sprintf (dotdb, "%s.db", CVSROOTADM_MODULES);
00711     (void) sprintf (bakdir, "%s%s.dir", BAKPREFIX, CVSROOTADM_MODULES);
00712     (void) sprintf (bakpag, "%s%s.pag", BAKPREFIX, CVSROOTADM_MODULES);
00713     (void) sprintf (bakdb, "%s%s.db", BAKPREFIX, CVSROOTADM_MODULES);
00714     (void) sprintf (newdir, "%s.dir", temp);
00715     (void) sprintf (newpag, "%s.pag", temp);
00716     (void) sprintf (newdb, "%s.db", temp);
00717
00718     (void) chmod (newdir, 0666);
00719     (void) chmod (newpag, 0666);
00720     (void) chmod (newdb, 0666);
00721
00722     /* don't mess with me */
00723     SIG_beginCrSect ();
00724
00725     /* rm .#modules.dir .#modules.pag */
00726     if (unlink_file (bakdir) < 0)
00727     dir1_errno = errno;
00728     if (unlink_file (bakpag) < 0)
00729     pag1_errno = errno;
00730     if (unlink_file (bakdb) < 0)
00731     db1_errno = errno;
00732
00733     /* mv modules.dir .#modules.dir */
00734     if (CVS_RENAME (dotdir, bakdir) < 0)
00735     dir2_errno = errno;
00736     /* mv modules.pag .#modules.pag */
00737     if (CVS_RENAME (dotpag, bakpag) < 0)
00738     pag2_errno = errno;
00739     /* mv modules.db .#modules.db */
00740     if (CVS_RENAME (dotdb, bakdb) < 0)
00741     db2_errno = errno;
00742
00743     /* mv "temp".dir modules.dir */
00744     if (CVS_RENAME (newdir, dotdir) < 0)
00745     dir3_errno = errno;
00746     /* mv "temp".pag modules.pag */
00747     if (CVS_RENAME (newpag, dotpag) < 0)
00748     pag3_errno = errno;
00749     /* mv "temp".db modules.db */
00750     if (CVS_RENAME (newdb, dotdb) < 0)
00751     db3_errno = errno;
00752
00753     /* OK -- make my day */
00754     SIG_endCrSect ();
00755
00756     /* I didn't want to call error() when we had signals blocked
00757        (unnecessary?), but do it now.  */
00758     if (dir1_errno && !existence_error (dir1_errno))
00759     error (0, dir1_errno, "cannot remove %s", bakdir);
00760     if (pag1_errno && !existence_error (pag1_errno))
00761     error (0, pag1_errno, "cannot remove %s", bakpag);
00762     if (db1_errno && !existence_error (db1_errno))
00763     error (0, db1_errno, "cannot remove %s", bakdb);
00764
00765     if (dir2_errno && !existence_error (dir2_errno))
00766     error (0, dir2_errno, "cannot remove %s", bakdir);
00767     if (pag2_errno && !existence_error (pag2_errno))
00768     error (0, pag2_errno, "cannot remove %s", bakpag);
00769     if (db2_errno && !existence_error (db2_errno))
00770     error (0, db2_errno, "cannot remove %s", bakdb);
00771
00772     if (dir3_errno && !existence_error (dir3_errno))
00773     error (0, dir3_errno, "cannot remove %s", bakdir);
00774     if (pag3_errno && !existence_error (pag3_errno))
00775     error (0, pag3_errno, "cannot remove %s", bakpag);
00776     if (db3_errno && !existence_error (db3_errno))
00777     error (0, db3_errno, "cannot remove %s", bakdb);
00778 }
00779
00780 #endif              /* !MY_NDBM */
00781
00782 static void
00783 rename_rcsfile (temp, real)
00784     char *temp;
00785     char *real;
00786 {
00787     char *bak;
00788     struct stat statbuf;
00789     char *rcs;
00790
00791     /* Set "x" bits if set in original. */
00792     rcs = xmalloc (strlen (real) + sizeof (RCSEXT) + 10);
00793     (void) sprintf (rcs, "%s%s", real, RCSEXT);
00794     statbuf.st_mode = 0; /* in case rcs file doesn't exist, but it should... */
00795     if (CVS_STAT (rcs, &statbuf) < 0
00796     && !existence_error (errno))
00797     error (0, errno, "cannot stat %s", rcs);
00798     free (rcs);
00799
00800     if (chmod (temp, 0444 | (statbuf.st_mode & 0111)) < 0)
00801     error (0, errno, "warning: cannot chmod %s", temp);
00802     bak = xmalloc (strlen (real) + sizeof (BAKPREFIX) + 10);
00803     (void) sprintf (bak, "%s%s", BAKPREFIX, real);
00804
00805     /* rm .#loginfo */
00806     if (unlink_file (bak) < 0
00807     && !existence_error (errno))
00808     error (0, errno, "cannot remove %s", bak);
00809
00810     /* mv loginfo .#loginfo */
00811     if (CVS_RENAME (real, bak) < 0
00812     && !existence_error (errno))
00813     error (0, errno, "cannot rename %s to %s", real, bak);
00814
00815     /* mv "temp" loginfo */
00816     if (CVS_RENAME (temp, real) < 0
00817     && !existence_error (errno))
00818     error (0, errno, "cannot rename %s to %s", temp, real);
00819
00820     free (bak);
00821 }
00822
00823 const char *const init_usage[] = {
00824     "Usage: %s %s\n",
00825     "(Specify the --help global option for a list of other help options)\n",
00826     NULL
00827 };
00828
00829 int
00830 init (argc, argv)
00831     int argc;
00832     char **argv;
00833 {
00834     /* Name of CVSROOT directory.  */
00835     char *adm;
00836     /* Name of this administrative file.  */
00837     char *info;
00838     /* Name of ,v file for this administrative file.  */
00839     char *info_v;
00840     /* Exit status.  */
00841     int err;
00842
00843     const struct admin_file *fileptr;
00844
00845     umask (cvsumask);
00846
00847     if (argc == -1 || argc > 1)
00848     usage (init_usage);
00849
00850 #ifdef CLIENT_SUPPORT
00851     if (client_active)
00852     {
00853     start_server ();
00854
00855     ign_setup ();
00856     send_init_command ();
00857     return get_responses_and_close ();
00858     }
00859 #endif /* CLIENT_SUPPORT */
00860
00861     /* Note: we do *not* create parent directories as needed like the
00862        old cvsinit.sh script did.  Few utilities do that, and a
00863        non-existent parent directory is as likely to be a typo as something
00864        which needs to be created.  */
00865     mkdir_if_needed (CVSroot_directory);
00866
00867     adm = xmalloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM) + 10);
00868     strcpy (adm, CVSroot_directory);
00869     strcat (adm, "/");
00870     strcat (adm, CVSROOTADM);
00871     mkdir_if_needed (adm);
00872
00873     /* This is needed because we pass "fileptr->filename" not "info"
00874        to add_rcs_file below.  I think this would be easy to change,
00875        thus nuking the need for CVS_CHDIR here, but I haven't looked
00876        closely (e.g. see wrappers calls within add_rcs_file).  */
00877     if ( CVS_CHDIR (adm) < 0)
00878     error (1, errno, "cannot change to directory %s", adm);
00879
00880     /* Make Emptydir so it's there if we need it */
00881     mkdir_if_needed (CVSNULLREPOS);
00882
00883     /* 80 is long enough for all the administrative file names, plus
00884        "/" and so on.  */
00885     info = xmalloc (strlen (adm) + 80);
00886     info_v = xmalloc (strlen (adm) + 80);
00887     for (fileptr = filelist; fileptr && fileptr->filename; ++fileptr)
00888     {
00889     if (fileptr->contents == NULL)
00890         continue;
00891     strcpy (info, adm);
00892     strcat (info, "/");
00893     strcat (info, fileptr->filename);
00894     strcpy (info_v, info);
00895     strcat (info_v, RCSEXT);
00896     if (isfile (info_v))
00897         /* We will check out this file in the mkmodules step.
00898            Nothing else is required.  */
00899         ;
00900     else
00901     {
00902         int retcode;
00903
00904         if (!isfile (info))
00905         {
00906         FILE *fp;
00907         const char * const *p;
00908
00909         fp = open_file (info, "w");
00910         for (p = fileptr->contents; *p != NULL; ++p)
00911             if (fputs (*p, fp) < 0)
00912             error (1, errno, "cannot write %s", info);
00913         if (fclose (fp) < 0)
00914             error (1, errno, "cannot close %s", info);
00915         }
00916         /* The message used to say " of " and fileptr->filename after
00917            "initial checkin" but I fail to see the point as we know what
00918            file it is from the name.  */
00919         retcode = add_rcs_file ("initial checkin", info_v,
00920                     fileptr->filename, "1.1", NULL,
00921
00922                     /* No vendor branch.  */
00923                     NULL, NULL, 0, NULL,
00924
00925                     NULL, 0, NULL);
00926         if (retcode != 0)
00927         /* add_rcs_file already printed an error message.  */
00928         err = 1;
00929     }
00930     }
00931
00932     /* Turn on history logging by default.  The user can remove the file
00933        to disable it.  */
00934     strcpy (info, adm);
00935     strcat (info, "/");
00936     strcat (info, CVSROOTADM_HISTORY);
00937     if (!isfile (info))
00938     {
00939     FILE *fp;
00940
00941     fp = open_file (info, "w");
00942     if (fclose (fp) < 0)
00943         error (1, errno, "cannot close %s", info);
00944
00945         /* Make the new history file world-writeable, since every CVS
00946            user will need to be able to write to it.  We use chmod()
00947            because xchmod() is too shy. */
00948         chmod (info, 0666);
00949     }
00950
00951     /* Make an empty val-tags file to prevent problems creating it later.  */
00952     strcpy (info, adm);
00953     strcat (info, "/");
00954     strcat (info, CVSROOTADM_VALTAGS);
00955     if (!isfile (info))
00956     {
00957     FILE *fp;
00958
00959     fp = open_file (info, "w");
00960     if (fclose (fp) < 0)
00961         error (1, errno, "cannot close %s", info);
00962
00963         /* Make the new val-tags file world-writeable, since every CVS
00964            user will need to be able to write to it.  We use chmod()
00965            because xchmod() is too shy. */
00966         chmod (info, 0666);
00967     }
00968
00969     free (info);
00970     free (info_v);
00971
00972     mkmodules (adm);
00973
00974     free (adm);
00975     return 0;
00976 }
Generated on Sun Oct 21 12:41:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/modules.c Source File

cvs-1.10/src/modules.c

Go to the documentation of this file.
00001 /*
00002  *    Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  *    Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  *    You may distribute under the terms of the GNU General Public License
00006  *    as specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Modules
00009  *
00010  *  Functions for accessing the modules file.
00011  *
00012  *  The modules file supports basically three formats of lines:
00013  *      key [options] directory files... [ -x directory [files] ] ...
00014  *      key [options] directory [ -x directory [files] ] ...
00015  *      key -a aliases...
00016  *
00017  *  The -a option allows an aliasing step in the parsing of the modules
00018  *  file.  The "aliases" listed on a line following the -a are
00019  *  processed one-by-one, as if they were specified as arguments on the
00020  *  command line.
00021  */
00022
00023 #include <assert.h>
00024 #include "cvs.h"
00025 #include "savecwd.h"
00026
00027
00028 /* Defines related to the syntax of the modules file.  */
00029
00030 /* Options in modules file.  Note that it is OK to use GNU getopt features;
00031    we already are arranging to make sure we are using the getopt distributed
00032    with CVS.  */
00033 #define CVSMODULE_OPTS  "+ad:i:lo:e:s:t:u:"
00034
00035 /* Special delimiter.  */
00036 #define CVSMODULE_SPEC  '&'
00037
00038 struct sortrec
00039 {
00040     /* Name of the module, malloc'd.  */
00041     char *modname;
00042     /* If Status variable is set, this is either def_status or the malloc'd
00043        name of the status.  If Status is not set, the field is left
00044        uninitialized.  */
00045     char *status;
00046     /* Pointer to a malloc'd array which contains (1) the raw contents
00047        of the options and arguments, excluding comments, (2) a '\0',
00048        and (3) the storage for the "comment" field.  */
00049     char *rest;
00050     char *comment;
00051 };
00052
00053 static int sort_order PROTO((const PTR l, const PTR r));
00054 static void save_d PROTO((char *k, int ks, char *d, int ds));
00055
00056
00057 /*
00058  * Open the modules file, and die if the CVSROOT environment variable
00059  * was not set.  If the modules file does not exist, that's fine, and
00060  * a warning message is displayed and a NULL is returned.
00061  */
00062 DBM *
00063 open_module ()
00064 {
00065     char *mfile;
00066     DBM *retval;
00067
00068     if (CVSroot_original == NULL)
00069     {
00070     error (0, 0, "must set the CVSROOT environment variable");
00071     error (1, 0, "or specify the '-d' global option");
00072     }
00073     mfile = xmalloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM)
00074              + sizeof (CVSROOTADM_MODULES) + 20);
00075     (void) sprintf (mfile, "%s/%s/%s", CVSroot_directory,
00076             CVSROOTADM, CVSROOTADM_MODULES);
00077     retval = dbm_open (mfile, O_RDONLY, 0666);
00078     free (mfile);
00079     return retval;
00080 }
00081
00082 /*
00083  * Close the modules file, if the open succeeded, that is
00084  */
00085 void
00086 close_module (db)
00087     DBM *db;
00088 {
00089     if (db != NULL)
00090     dbm_close (db);
00091 }
00092
00093 /*
00094  * This is the recursive function that processes a module name.
00095  * It calls back the passed routine for each directory of a module
00096  * It runs the post checkout or post tag proc from the modules file
00097  */
00098 int
00099 do_module (db, mname, m_type, msg, callback_proc, where,
00100        shorten, local_specified, run_module_prog, extra_arg)
00101     DBM *db;
00102     char *mname;
00103     enum mtype m_type;
00104     char *msg;
00105     CALLBACKPROC callback_proc;
00106     char *where;
00107     int shorten;
00108     int local_specified;
00109     int run_module_prog;
00110     char *extra_arg;
00111 {
00112     char *checkin_prog = NULL;
00113     char *checkout_prog = NULL;
00114     char *export_prog = NULL;
00115     char *tag_prog = NULL;
00116     char *update_prog = NULL;
00117     struct saved_cwd cwd;
00118     int cwd_saved = 0;
00119     char *line;
00120     int modargc;
00121     int xmodargc;
00122     char **modargv;
00123     char **xmodargv = NULL;
00124     /* Found entry from modules file, including options and such.  */
00125     char *value = NULL;
00126     char *mwhere = NULL;
00127     char *mfile = NULL;
00128     char *spec_opt = NULL;
00129     char *xvalue = NULL;
00130     int alias = 0;
00131     datum key, val;
00132     char *cp;
00133     int c, err = 0;
00134     int nonalias_opt = 0;
00135
00136 #ifdef SERVER_SUPPORT
00137     int restore_server_dir = 0;
00138     char *server_dir_to_restore = NULL;
00139     if (trace)
00140     {
00141     char *buf;
00142
00143     /* We use cvs_outerr, rather than fprintf to stderr, because
00144        this may be called by server code with error_use_protocol
00145        set.  */
00146     buf = xmalloc (100
00147                + strlen (mname)
00148                + strlen (msg)
00149                + (where ? strlen (where) : 0)
00150                + (extra_arg ? strlen (extra_arg) : 0));
00151     sprintf (buf, "%s-> do_module (%s, %s, %s, %s)\n",
00152          CLIENT_SERVER_STR,
00153          mname, msg, where ? where : "",
00154          extra_arg ? extra_arg : "");
00155     cvs_outerr (buf, 0);
00156     free (buf);
00157     }
00158 #endif
00159
00160     /* if this is a directory to ignore, add it to that list */
00161     if (mname[0] == '!' && mname[1] != '\0')
00162     {
00163     ign_dir_add (mname+1);
00164     goto do_module_return;
00165     }
00166
00167     /* strip extra stuff from the module name */
00168     strip_trailing_slashes (mname);
00169
00170     /*
00171      * Look up the module using the following scheme:
00172      *  1) look for mname as a module name
00173      *  2) look for mname as a directory
00174      *  3) look for mname as a file
00175      *  4) take mname up to the first slash and look it up as a module name
00176      *     (this is for checking out only part of a module)
00177      */
00178
00179     /* look it up as a module name */
00180     key.dptr = mname;
00181     key.dsize = strlen (key.dptr);
00182     if (db != NULL)
00183     val = dbm_fetch (db, key);
00184     else
00185     val.dptr = NULL;
00186     if (val.dptr != NULL)
00187     {
00188     /* copy and null terminate the value */
00189     value = xmalloc (val.dsize + 1);
00190     memcpy (value, val.dptr, val.dsize);
00191     value[val.dsize] = '\0';
00192
00193     /* If the line ends in a comment, strip it off */
00194     if ((cp = strchr (value, '#')) != NULL)
00195         *cp = '\0';
00196     else
00197         cp = value + val.dsize;
00198
00199     /* Always strip trailing spaces */
00200     while (cp > value && isspace ((unsigned char) *--cp))
00201         *cp = '\0';
00202
00203     mwhere = xstrdup (mname);
00204     goto found;
00205     }
00206     else
00207     {
00208     char *file;
00209     char *attic_file;
00210     char *acp;
00211     int is_found = 0;
00212
00213     /* check to see if mname is a directory or file */
00214     file = xmalloc (strlen (CVSroot_directory) + strlen (mname) + 10);
00215     (void) sprintf (file, "%s/%s", CVSroot_directory, mname);
00216     attic_file = xmalloc (strlen (CVSroot_directory) + strlen (mname)
00217                   + sizeof (CVSATTIC) + sizeof (RCSEXT) + 15);
00218     if ((acp = strrchr (mname, '/')) != NULL)
00219     {
00220         *acp = '\0';
00221         (void) sprintf (attic_file, "%s/%s/%s/%s%s", CVSroot_directory,
00222                 mname, CVSATTIC, acp + 1, RCSEXT);
00223         *acp = '/';
00224     }
00225     else
00226         (void) sprintf (attic_file, "%s/%s/%s%s", CVSroot_directory,
00227                 CVSATTIC, mname, RCSEXT);
00228
00229     if (isdir (file))
00230     {
00231         modargv = xmalloc (sizeof (*modargv));
00232         modargv[0] = xstrdup (mname);
00233         modargc = 1;
00234         is_found = 1;
00235     }
00236     else
00237     {
00238         (void) strcat (file, RCSEXT);
00239         if (isfile (file) || isfile (attic_file))
00240         {
00241         /* if mname was a file, we have to split it into "dir file" */
00242         if ((cp = strrchr (mname, '/')) != NULL && cp != mname)
00243         {
00244             modargv = xmalloc (2 * sizeof (*modargv));
00245             modargv[0] = xmalloc (strlen (mname) + 2);
00246             strncpy (modargv[0], mname, cp - mname);
00247             modargv[0][cp - mname] = '\0';
00248             modargv[1] = xstrdup (cp + 1);
00249             modargc = 2;
00250         }
00251         else
00252         {
00253             /*
00254              * the only '/' at the beginning or no '/' at all
00255              * means the file we are interested in is in CVSROOT
00256              * itself so the directory should be '.'
00257              */
00258             if (cp == mname)
00259             {
00260             /* drop the leading / if specified */
00261             modargv = xmalloc (2 * sizeof (*modargv));
00262             modargv[0] = xstrdup (".");
00263             modargv[1] = xstrdup (mname + 1);
00264             modargc = 2;
00265             }
00266             else
00267             {
00268             /* otherwise just copy it */
00269             modargv = xmalloc (2 * sizeof (*modargv));
00270             modargv[0] = xstrdup (".");
00271             modargv[1] = xstrdup (mname);
00272             modargc = 2;
00273             }
00274         }
00275         is_found = 1;
00276         }
00277     }
00278     free (attic_file);
00279     free (file);
00280
00281     if (is_found)
00282     {
00283         assert (value == NULL);
00284
00285         /* OK, we have now set up modargv with the actual
00286            file/directory we want to work on.  We duplicate a
00287            small amount of code here because the vast majority of
00288            the code after the "found" label does not pertain to
00289            the case where we found a file/directory rather than
00290            finding an entry in the modules file.  */
00291         if (save_cwd (&cwd))
00292         error_exit ();
00293         cwd_saved = 1;
00294
00295         err += callback_proc (modargc, modargv, where, mwhere, mfile,
00296                   shorten,
00297                   local_specified, mname, msg);
00298
00299         free_names (&modargc, modargv);
00300
00301         /* cd back to where we started.  */
00302         if (restore_cwd (&cwd, NULL))
00303         error_exit ();
00304         free_cwd (&cwd);
00305         cwd_saved = 0;
00306
00307         goto do_module_return;
00308     }
00309     }
00310
00311     /* look up everything to the first / as a module */
00312     if (mname[0] != '/' && (cp = strchr (mname, '/')) != NULL)
00313     {
00314     /* Make the slash the new end of the string temporarily */
00315     *cp = '\0';
00316     key.dptr = mname;
00317     key.dsize = strlen (key.dptr);
00318
00319     /* do the lookup */
00320     if (db != NULL)
00321         val = dbm_fetch (db, key);
00322     else
00323         val.dptr = NULL;
00324
00325     /* if we found it, clean up the value and life is good */
00326     if (val.dptr != NULL)
00327     {
00328         char *cp2;
00329
00330         /* copy and null terminate the value */
00331         value = xmalloc (val.dsize + 1);
00332         memcpy (value, val.dptr, val.dsize);
00333         value[val.dsize] = '\0';
00334
00335         /* If the line ends in a comment, strip it off */
00336         if ((cp2 = strchr (value, '#')) != NULL)
00337         *cp2 = '\0';
00338         else
00339         cp2 = value + val.dsize;
00340
00341         /* Always strip trailing spaces */
00342         while (cp2 > value  &&  isspace ((unsigned char) *--cp2))
00343         *cp2 = '\0';
00344
00345         /* mwhere gets just the module name */
00346         mwhere = xstrdup (mname);
00347         mfile = cp + 1;
00348
00349         /* put the / back in mname */
00350         *cp = '/';
00351
00352         goto found;
00353     }
00354
00355     /* put the / back in mname */
00356     *cp = '/';
00357     }
00358
00359     /* if we got here, we couldn't find it using our search, so give up */
00360     error (0, 0, "cannot find module `%s' - ignored", mname);
00361     err++;
00362     goto do_module_return;
00363
00364
00365     /*
00366      * At this point, we found what we were looking for in one
00367      * of the many different forms.
00368      */
00369   found:
00370
00371     /* remember where we start */
00372     if (save_cwd (&cwd))
00373     error_exit ();
00374     cwd_saved = 1;
00375
00376     assert (value != NULL);
00377
00378     /* search the value for the special delimiter and save for later */
00379     if ((cp = strchr (value, CVSMODULE_SPEC)) != NULL)
00380     {
00381     *cp = '\0';         /* null out the special char */
00382     spec_opt = cp + 1;      /* save the options for later */
00383
00384     /* strip whitespace if necessary */
00385     while (cp > value  &&  isspace ((unsigned char) *--cp))
00386         *cp = '\0';
00387     }
00388
00389     /* don't do special options only part of a module was specified */
00390     if (mfile != NULL)
00391     spec_opt = NULL;
00392
00393     /*
00394      * value now contains one of the following:
00395      *    1) dir
00396      *    2) dir file
00397      *    3) the value from modules without any special args
00398      *          [ args ] dir [file] [file] ...
00399      *       or     -a module [ module ] ...
00400      */
00401
00402     /* Put the value on a line with XXX prepended for getopt to eat */
00403     line = xmalloc (strlen (value) + 10);
00404     strcpy(line, "XXX ");
00405     strcpy(line + 4, value);
00406
00407     /* turn the line into an argv[] array */
00408     line2argv (&xmodargc, &xmodargv, line, " \t");
00409     free (line);
00410     modargc = xmodargc;
00411     modargv = xmodargv;
00412
00413     /* parse the args */
00414     optind = 0;
00415     while ((c = getopt (modargc, modargv, CVSMODULE_OPTS)) != -1)
00416     {
00417     switch (c)
00418     {
00419         case 'a':
00420         alias = 1;
00421         break;
00422         case 'd':
00423         if (mwhere)
00424             free (mwhere);
00425         mwhere = xstrdup (optarg);
00426         nonalias_opt = 1;
00427         break;
00428         case 'i':
00429         if (checkin_prog)
00430             free (checkin_prog);
00431         checkin_prog = xstrdup (optarg);
00432         nonalias_opt = 1;
00433         break;
00434         case 'l':
00435         local_specified = 1;
00436         nonalias_opt = 1;
00437         break;
00438         case 'o':
00439         if (checkout_prog)
00440             free (checkout_prog);
00441         checkout_prog = xstrdup (optarg);
00442         nonalias_opt = 1;
00443         break;
00444         case 'e':
00445         if (export_prog)
00446             free (export_prog);
00447         export_prog = xstrdup (optarg);
00448         nonalias_opt = 1;
00449         break;
00450         case 't':
00451         if (tag_prog)
00452             free (tag_prog);
00453         tag_prog = xstrdup (optarg);
00454         nonalias_opt = 1;
00455         break;
00456         case 'u':
00457         if (update_prog)
00458             free (update_prog);
00459         update_prog = xstrdup (optarg);
00460         nonalias_opt = 1;
00461         break;
00462         case '?':
00463         error (0, 0,
00464                "modules file has invalid option for key %s value %s",
00465                key.dptr, value);
00466         err++;
00467         goto do_module_return;
00468     }
00469     }
00470     modargc -= optind;
00471     modargv += optind;
00472     if (modargc == 0  &&  spec_opt == NULL)
00473     {
00474     error (0, 0, "modules file missing directory for module %s", mname);
00475     ++err;
00476     goto do_module_return;
00477     }
00478
00479     if (alias && nonalias_opt)
00480     {
00481     /* The documentation has never said it is legal to specify
00482        -a along with another option.  And I believe that in the past
00483        CVS has ignored the options other than -a, more or less, in this
00484        situation.  */
00485     error (0, 0, "\
00486 -a cannot be specified in the modules file along with other options");
00487     ++err;
00488     goto do_module_return;
00489     }
00490
00491     /* if this was an alias, call ourselves recursively for each module */
00492     if (alias)
00493     {
00494     int i;
00495
00496     for (i = 0; i < modargc; i++)
00497     {
00498         if (strcmp (mname, modargv[i]) == 0)
00499         error (0, 0,
00500                "module `%s' in modules file contains infinite loop",
00501                mname);
00502         else
00503         err += do_module (db, modargv[i], m_type, msg, callback_proc,
00504                   where, shorten, local_specified,
00505                   run_module_prog, extra_arg);
00506     }
00507     goto do_module_return;
00508     }
00509
00510     if (mfile != NULL && modargc > 1)
00511     {
00512     error (0, 0, "\
00513 module `%s' is a request for a file in a module which is not a directory",
00514            mname);
00515     ++err;
00516     goto do_module_return;
00517     }
00518
00519     /* otherwise, process this module */
00520     if (modargc > 0)
00521     {
00522     err += callback_proc (modargc, modargv, where, mwhere, mfile, shorten,
00523                   local_specified, mname, msg);
00524     }
00525     else
00526     {
00527     /*
00528      * we had nothing but special options, so we must
00529      * make the appropriate directory and cd to it
00530      */
00531     char *dir;
00532
00533     /* XXX - XXX - MAJOR HACK - DO NOT SHIP - this needs to
00534        be !pipeout, but we don't know that here yet */
00535     if (!run_module_prog)
00536         goto do_special;
00537
00538     dir = where ? where : (mwhere ? mwhere : mname);
00539     /* XXX - think about making null repositories at each dir here
00540          instead of just at the bottom */
00541     make_directories (dir);
00542     if ( CVS_CHDIR (dir) < 0)
00543     {
00544         error (0, errno, "cannot chdir to %s", dir);
00545         spec_opt = NULL;
00546         err++;
00547         goto do_special;
00548     }
00549     if (!isfile (CVSADM))
00550     {
00551         char *nullrepos;
00552
00553         nullrepos = emptydir_name ();
00554
00555         Create_Admin (".", dir,
00556               nullrepos, (char *) NULL, (char *) NULL, 0, 0, 1);
00557         if (!noexec)
00558         {
00559         FILE *fp;
00560
00561         fp = open_file (CVSADM_ENTSTAT, "w+");
00562         if (fclose (fp) == EOF)
00563             error (1, errno, "cannot close %s", CVSADM_ENTSTAT);
00564 #ifdef SERVER_SUPPORT
00565         if (server_active)
00566             server_set_entstat (dir, nullrepos);
00567 #endif
00568         }
00569         free (nullrepos);
00570     }
00571     }
00572
00573     /* if there were special include args, process them now */
00574
00575   do_special:
00576
00577     free_names (&xmodargc, xmodargv);
00578     xmodargv = NULL;
00579
00580     /* blow off special options if -l was specified */
00581     if (local_specified)
00582     spec_opt = NULL;
00583
00584 #ifdef SERVER_SUPPORT
00585     /* We want to check out into the directory named by the module.
00586        So we set a global variable which tells the server to glom that
00587        directory name onto the front.  A cleaner approach would be some
00588        way of passing it down to the recursive call, through the
00589        callback_proc, to start_recursion, and then into the update_dir in
00590        the struct file_info.  That way the "Updating foo" message could
00591        print the actual directory we are checking out into.
00592
00593        For local CVS, this is handled by the chdir call above
00594        (directly or via the callback_proc).  */
00595     if (server_active && spec_opt != NULL)
00596     {
00597     char *change_to;
00598
00599     change_to = where ? where : (mwhere ? mwhere : mname);
00600     server_dir_to_restore = server_dir;
00601     restore_server_dir = 1;
00602     server_dir =
00603         xmalloc ((server_dir_to_restore != NULL
00604               ? strlen (server_dir_to_restore)
00605               : 0)
00606              + strlen (change_to)
00607              + 5);
00608     server_dir[0] = '\0';
00609     if (server_dir_to_restore != NULL)
00610     {
00611         strcat (server_dir, server_dir_to_restore);
00612         strcat (server_dir, "/");
00613     }
00614     strcat (server_dir, change_to);
00615     }
00616 #endif
00617
00618     while (spec_opt != NULL)
00619     {
00620     char *next_opt;
00621
00622     cp = strchr (spec_opt, CVSMODULE_SPEC);
00623     if (cp != NULL)
00624     {
00625         /* save the beginning of the next arg */
00626         next_opt = cp + 1;
00627
00628         /* strip whitespace off the end */
00629         do
00630         *cp = '\0';
00631         while (cp > spec_opt  &&  isspace ((unsigned char) *--cp));
00632     }
00633     else
00634         next_opt = NULL;
00635
00636     /* strip whitespace from front */
00637     while (isspace ((unsigned char) *spec_opt))
00638         spec_opt++;
00639
00640     if (*spec_opt == '\0')
00641         error (0, 0, "Mal-formed %c option for module %s - ignored",
00642            CVSMODULE_SPEC, mname);
00643     else
00644         err += do_module (db, spec_opt, m_type, msg, callback_proc,
00645                   (char *) NULL, 0, local_specified,
00646                   run_module_prog, extra_arg);
00647     spec_opt = next_opt;
00648     }
00649
00650 #ifdef SERVER_SUPPORT
00651     if (server_active && restore_server_dir)
00652     {
00653     free (server_dir);
00654     server_dir = server_dir_to_restore;
00655     }
00656 #endif
00657
00658     /* write out the checkin/update prog files if necessary */
00659 #ifdef SERVER_SUPPORT
00660     if (err == 0 && !noexec && m_type == CHECKOUT && server_expanding)
00661     {
00662     if (checkin_prog != NULL)
00663         server_prog (where ? where : mname, checkin_prog, PROG_CHECKIN);
00664     if (update_prog != NULL)
00665         server_prog (where ? where : mname, update_prog, PROG_UPDATE);
00666     }
00667     else
00668 #endif
00669     if (err == 0 && !noexec && m_type == CHECKOUT && run_module_prog)
00670     {
00671     FILE *fp;
00672
00673     if (checkin_prog != NULL)
00674     {
00675         fp = open_file (CVSADM_CIPROG, "w+");
00676         (void) fprintf (fp, "%s\n", checkin_prog);
00677         if (fclose (fp) == EOF)
00678         error (1, errno, "cannot close %s", CVSADM_CIPROG);
00679     }
00680     if (update_prog != NULL)
00681     {
00682         fp = open_file (CVSADM_UPROG, "w+");
00683         (void) fprintf (fp, "%s\n", update_prog);
00684         if (fclose (fp) == EOF)
00685         error (1, errno, "cannot close %s", CVSADM_UPROG);
00686     }
00687     }
00688
00689     /* cd back to where we started */
00690     if (restore_cwd (&cwd, NULL))
00691     error_exit ();
00692     free_cwd (&cwd);
00693     cwd_saved = 0;
00694
00695     /* run checkout or tag prog if appropriate */
00696     if (err == 0 && run_module_prog)
00697     {
00698     if ((m_type == TAG && tag_prog != NULL) ||
00699         (m_type == CHECKOUT && checkout_prog != NULL) ||
00700         (m_type == EXPORT && export_prog != NULL))
00701     {
00702         /*
00703          * If a relative pathname is specified as the checkout, tag
00704          * or export proc, try to tack on the current "where" value.
00705          * if we can't find a matching program, just punt and use
00706          * whatever is specified in the modules file.
00707          */
00708         char *real_prog = NULL;
00709         char *prog = (m_type == TAG ? tag_prog :
00710               (m_type == CHECKOUT ? checkout_prog : export_prog));
00711         char *real_where = (where != NULL ? where : mwhere);
00712         char *expanded_path;
00713
00714         if ((*prog != '/') && (*prog != '.'))
00715         {
00716         real_prog = xmalloc (strlen (real_where) + strlen (prog)
00717                      + 10);
00718         (void) sprintf (real_prog, "%s/%s", real_where, prog);
00719         if (isfile (real_prog))
00720             prog = real_prog;
00721         }
00722
00723         /* XXX can we determine the line number for this entry??? */
00724         expanded_path = expand_path (prog, "modules", 0);
00725         if (expanded_path != NULL)
00726         {
00727         run_setup (expanded_path);
00728         run_arg (real_where);
00729
00730         if (extra_arg)
00731             run_arg (extra_arg);
00732
00733         if (!quiet)
00734         {
00735             cvs_output (program_name, 0);
00736             cvs_output (" ", 1);
00737             cvs_output (command_name, 0);
00738             cvs_output (": Executing '", 0);
00739             run_print (stdout);
00740             cvs_output ("'\n", 0);
00741             cvs_flushout ();
00742         }
00743         err += run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL);
00744         free (expanded_path);
00745         }
00746         free (real_prog);
00747     }
00748     }
00749
00750  do_module_return:
00751     /* clean up */
00752     if (xmodargv != NULL)
00753     free_names (&xmodargc, xmodargv);
00754     if (mwhere)
00755     free (mwhere);
00756     if (checkin_prog)
00757     free (checkin_prog);
00758     if (checkout_prog)
00759     free (checkout_prog);
00760     if (export_prog)
00761     free (export_prog);
00762     if (tag_prog)
00763     free (tag_prog);
00764     if (update_prog)
00765     free (update_prog);
00766     if (cwd_saved)
00767     free_cwd (&cwd);
00768     if (value != NULL)
00769     free (value);
00770
00771     if (xvalue != NULL)
00772     free (xvalue);
00773     return (err);
00774 }
00775
00776 /* - Read all the records from the modules database into an array.
00777    - Sort the array depending on what format is desired.
00778    - Print the array in the format desired.
00779
00780    Currently, there are only two "desires":
00781
00782    1. Sort by module name and format the whole entry including switches,
00783       files and the comment field: (Including aliases)
00784
00785       modulename    -s switches, one per line, even if
00786             -i it has many switches.
00787             Directories and files involved, formatted
00788             to cover multiple lines if necessary.
00789             # Comment, also formatted to cover multiple
00790             # lines if necessary.
00791
00792    2. Sort by status field string and print:  (*not* including aliases)
00793
00794       modulename    STATUS  Directories and files involved, formatted
00795                 to cover multiple lines if necessary.
00796                 # Comment, also formatted to cover multiple
00797                 # lines if necessary.
00798 */
00799
00800 static struct sortrec *s_head;
00801
00802 static int s_max = 0;           /* Number of elements allocated */
00803 static int s_count = 0;         /* Number of elements used */
00804
00805 static int Status;              /* Nonzero if the user is
00806                        interested in status
00807                        information as well as
00808                        module name */
00809 static char def_status[] = "NONE";
00810
00811 /* Sort routine for qsort:
00812    - If we want the "Status" field to be sorted, check it first.
00813    - Then compare the "module name" fields.  Since they are unique, we don't
00814      have to look further.
00815 */
00816 static int
00817 sort_order (l, r)
00818     const PTR l;
00819     const PTR r;
00820 {
00821     int i;
00822     const struct sortrec *left = (const struct sortrec *) l;
00823     const struct sortrec *right = (const struct sortrec *) r;
00824
00825     if (Status)
00826     {
00827     /* If Sort by status field, compare them. */
00828     if ((i = strcmp (left->status, right->status)) != 0)
00829         return (i);
00830     }
00831     return (strcmp (left->modname, right->modname));
00832 }
00833
00834 static void
00835 save_d (k, ks, d, ds)
00836     char *k;
00837     int ks;
00838     char *d;
00839     int ds;
00840 {
00841     char *cp, *cp2;
00842     struct sortrec *s_rec;
00843
00844     if (Status && *d == '-' && *(d + 1) == 'a')
00845     return;             /* We want "cvs co -s" and it is an alias! */
00846
00847     if (s_count == s_max)
00848     {
00849     s_max += 64;
00850     s_head = (struct sortrec *) xrealloc ((char *) s_head, s_max * sizeof (*s_head));
00851     }
00852     s_rec = &s_head[s_count];
00853     s_rec->modname = cp = xmalloc (ks + 1);
00854     (void) strncpy (cp, k, ks);
00855     *(cp + ks) = '\0';
00856
00857     s_rec->rest = cp2 = xmalloc (ds + 1);
00858     cp = d;
00859     *(cp + ds) = '\0';  /* Assumes an extra byte at end of static dbm buffer */
00860
00861     while (isspace ((unsigned char) *cp))
00862     cp++;
00863     /* Turn <spaces> into one ' ' -- makes the rest of this routine simpler */
00864     while (*cp)
00865     {
00866     if (isspace ((unsigned char) *cp))
00867     {
00868         *cp2++ = ' ';
00869         while (isspace ((unsigned char) *cp))
00870         cp++;
00871     }
00872     else
00873         *cp2++ = *cp++;
00874     }
00875     *cp2 = '\0';
00876
00877     /* Look for the "-s statusvalue" text */
00878     if (Status)
00879     {
00880     s_rec->status = def_status;
00881
00882     for (cp = s_rec->rest; (cp2 = strchr (cp, '-')) != NULL; cp = ++cp2)
00883     {
00884         if (*(cp2 + 1) == 's' && *(cp2 + 2) == ' ')
00885         {
00886         char *status_start;
00887
00888         cp2 += 3;
00889         status_start = cp2;
00890         while (*cp2 != ' ' && *cp2 != '\0')
00891             cp2++;
00892         s_rec->status = xmalloc (cp2 - status_start + 1);
00893         strncpy (s_rec->status, status_start, cp2 - status_start);
00894         s_rec->status[cp2 - status_start] = '\0';
00895         cp = cp2;
00896         break;
00897         }
00898     }
00899     }
00900     else
00901     cp = s_rec->rest;
00902
00903     /* Find comment field, clean up on all three sides & compress blanks */
00904     if ((cp2 = cp = strchr (cp, '#')) != NULL)
00905     {
00906     if (*--cp2 == ' ')
00907         *cp2 = '\0';
00908     if (*++cp == ' ')
00909         cp++;
00910     s_rec->comment = cp;
00911     }
00912     else
00913     s_rec->comment = "";
00914
00915     s_count++;
00916 }
00917
00918 /* Print out the module database as we know it.  If STATUS is
00919    non-zero, print out status information for each module. */
00920
00921 void
00922 cat_module (status)
00923     int status;
00924 {
00925     DBM *db;
00926     datum key, val;
00927     int i, c, wid, argc, cols = 80, indent, fill;
00928     int moduleargc;
00929     struct sortrec *s_h;
00930     char *cp, *cp2, **argv;
00931     char **moduleargv;
00932
00933     Status = status;
00934
00935     /* Read the whole modules file into allocated records */
00936     if (!(db = open_module ()))
00937     error (1, 0, "failed to open the modules file");
00938
00939     for (key = dbm_firstkey (db); key.dptr != NULL; key = dbm_nextkey (db))
00940     {
00941     val = dbm_fetch (db, key);
00942     if (val.dptr != NULL)
00943         save_d (key.dptr, key.dsize, val.dptr, val.dsize);
00944     }
00945
00946     close_module (db);
00947
00948     /* Sort the list as requested */
00949     qsort ((PTR) s_head, s_count, sizeof (struct sortrec), sort_order);
00950
00951     /*
00952      * Run through the sorted array and format the entries
00953      * indent = space for modulename + space for status field
00954      */
00955     indent = 12 + (status * 12);
00956     fill = cols - (indent + 2);
00957     for (s_h = s_head, i = 0; i < s_count; i++, s_h++)
00958     {
00959     char *line;
00960
00961     /* Print module name (and status, if wanted) */
00962     line = xmalloc (strlen (s_h->modname) + 15);
00963     sprintf (line, "%-12s", s_h->modname);
00964     cvs_output (line, 0);
00965     free (line);
00966     if (status)
00967     {
00968         line = xmalloc (strlen (s_h->status) + 15);
00969         sprintf (line, " %-11s", s_h->status);
00970         cvs_output (line, 0);
00971         free (line);
00972     }
00973
00974     line = xmalloc (strlen (s_h->modname) + strlen (s_h->rest) + 15);
00975     /* Parse module file entry as command line and print options */
00976     (void) sprintf (line, "%s %s", s_h->modname, s_h->rest);
00977     line2argv (&moduleargc, &moduleargv, line, " \t");
00978     free (line);
00979     argc = moduleargc;
00980     argv = moduleargv;
00981
00982     optind = 0;
00983     wid = 0;
00984     while ((c = getopt (argc, argv, CVSMODULE_OPTS)) != -1)
00985     {
00986         if (!status)
00987         {
00988         if (c == 'a' || c == 'l')
00989         {
00990             char buf[5];
00991
00992             sprintf (buf, " -%c", c);
00993             cvs_output (buf, 0);
00994             wid += 3;       /* Could just set it to 3 */
00995         }
00996         else
00997         {
00998             char buf[10];
00999
01000             if (strlen (optarg) + 4 + wid > (unsigned) fill)
01001             {
01002             int j;
01003
01004             cvs_output ("\n", 1);
01005             for (j = 0; j < indent; ++j)
01006                 cvs_output (" ", 1);
01007             wid = 0;
01008             }
01009             sprintf (buf, " -%c ", c);
01010             cvs_output (buf, 0);
01011             cvs_output (optarg, 0);
01012             wid += strlen (optarg) + 4;
01013         }
01014         }
01015     }
01016     argc -= optind;
01017     argv += optind;
01018
01019     /* Format and Print all the files and directories */
01020     for (; argc--; argv++)
01021     {
01022         if (strlen (*argv) + wid > (unsigned) fill)
01023         {
01024         int j;
01025
01026         cvs_output ("\n", 1);
01027         for (j = 0; j < indent; ++j)
01028             cvs_output (" ", 1);
01029         wid = 0;
01030         }
01031         cvs_output (" ", 1);
01032         cvs_output (*argv, 0);
01033         wid += strlen (*argv) + 1;
01034     }
01035     cvs_output ("\n", 1);
01036
01037     /* Format the comment field -- save_d (), compressed spaces */
01038     for (cp2 = cp = s_h->comment; *cp; cp2 = cp)
01039     {
01040         int j;
01041
01042         for (j = 0; j < indent; ++j)
01043         cvs_output (" ", 1);
01044         cvs_output (" # ", 0);
01045         if (strlen (cp2) < (unsigned) (fill - 2))
01046         {
01047         cvs_output (cp2, 0);
01048         cvs_output ("\n", 1);
01049         break;
01050         }
01051         cp += fill - 2;
01052         while (*cp != ' ' && cp > cp2)
01053         cp--;
01054         if (cp == cp2)
01055         {
01056         cvs_output (cp2, 0);
01057         cvs_output ("\n", 1);
01058         break;
01059         }
01060
01061         *cp++ = '\0';
01062         cvs_output (cp2, 0);
01063         cvs_output ("\n", 1);
01064     }
01065
01066     free_names(&moduleargc, moduleargv);
01067     /* FIXME-leak: here is where we would free s_h->modname, s_h->rest,
01068        and if applicable, s_h->status.  Not exactly a memory leak,
01069        in the sense that we are about to exit(), but may be worth
01070        noting if we ever do a multithreaded server or something of
01071        the sort.  */
01072     }
01073     /* FIXME-leak: as above, here is where we would free s_head.  */
01074 }
Generated on Sun Oct 21 12:41:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/myndbm.c Source File

cvs-1.10/src/myndbm.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner
00003  *
00004  * You may distribute under the terms of the GNU General Public License as
00005  * specified in the README file that comes with the CVS source distribution.
00006  *
00007  * A simple ndbm-emulator for CVS.  It parses a text file of the format:
00008  *
00009  * key  value
00010  *
00011  * at dbm_open time, and loads the entire file into memory.  As such, it is
00012  * probably only good for fairly small modules files.  Ours is about 30K in
00013  * size, and this code works fine.
00014  */
00015
00016 #include <assert.h>
00017 #include "cvs.h"
00018 #include "getline.h"
00019
00020 #ifdef MY_NDBM
00021
00022 static void mydbm_load_file PROTO ((FILE *, List *));
00023
00024 /* Returns NULL on error in which case errno has been set to indicate
00025    the error.  Can also call error() itself.  */
00026 /* ARGSUSED */
00027 DBM *
00028 mydbm_open (file, flags, mode)
00029     char *file;
00030     int flags;
00031     int mode;
00032 {
00033     FILE *fp;
00034     DBM *db;
00035
00036     fp = CVS_FOPEN (file, FOPEN_BINARY_READ);
00037     if (fp == NULL && !(existence_error (errno) && (flags & O_CREAT)))
00038     return ((DBM *) 0);
00039
00040     db = (DBM *) xmalloc (sizeof (*db));
00041     db->dbm_list = getlist ();
00042     db->modified = 0;
00043     db->name = xstrdup (file);
00044
00045     if (fp != NULL)
00046     {
00047     mydbm_load_file (fp, db->dbm_list);
00048     if (fclose (fp) < 0)
00049         error (0, errno, "cannot close %s", file);
00050     }
00051     return (db);
00052 }
00053
00054 static int write_item PROTO ((Node *, void *));
00055
00056 static int
00057 write_item (node, data)
00058     Node *node;
00059     void *data;
00060 {
00061     FILE *fp = (FILE *)data;
00062     fputs (node->key, fp);
00063     fputs (" ", fp);
00064     fputs (node->data, fp);
00065     fputs ("\012", fp);
00066     return 0;
00067 }
00068
00069 void
00070 mydbm_close (db)
00071     DBM *db;
00072 {
00073     if (db->modified)
00074     {
00075     FILE *fp;
00076     fp = CVS_FOPEN (db->name, FOPEN_BINARY_WRITE);
00077     if (fp == NULL)
00078         error (1, errno, "cannot write %s", db->name);
00079     walklist (db->dbm_list, write_item, (void *)fp);
00080     if (fclose (fp) < 0)
00081         error (0, errno, "cannot close %s", db->name);
00082     }
00083     free (db->name);
00084     dellist (&db->dbm_list);
00085     free ((char *) db);
00086 }
00087
00088 datum
00089 mydbm_fetch (db, key)
00090     DBM *db;
00091     datum key;
00092 {
00093     Node *p;
00094     char *s;
00095     datum val;
00096
00097     /* make sure it's null-terminated */
00098     s = xmalloc (key.dsize + 1);
00099     (void) strncpy (s, key.dptr, key.dsize);
00100     s[key.dsize] = '\0';
00101
00102     p = findnode (db->dbm_list, s);
00103     if (p)
00104     {
00105     val.dptr = p->data;
00106     val.dsize = strlen (p->data);
00107     }
00108     else
00109     {
00110     val.dptr = (char *) NULL;
00111     val.dsize = 0;
00112     }
00113     free (s);
00114     return (val);
00115 }
00116
00117 datum
00118 mydbm_firstkey (db)
00119     DBM *db;
00120 {
00121     Node *head, *p;
00122     datum key;
00123
00124     head = db->dbm_list->list;
00125     p = head->next;
00126     if (p != head)
00127     {
00128     key.dptr = p->key;
00129     key.dsize = strlen (p->key);
00130     }
00131     else
00132     {
00133     key.dptr = (char *) NULL;
00134     key.dsize = 0;
00135     }
00136     db->dbm_next = p->next;
00137     return (key);
00138 }
00139
00140 datum
00141 mydbm_nextkey (db)
00142     DBM *db;
00143 {
00144     Node *head, *p;
00145     datum key;
00146
00147     head = db->dbm_list->list;
00148     p = db->dbm_next;
00149     if (p != head)
00150     {
00151     key.dptr = p->key;
00152     key.dsize = strlen (p->key);
00153     }
00154     else
00155     {
00156     key.dptr = (char *) NULL;
00157     key.dsize = 0;
00158     }
00159     db->dbm_next = p->next;
00160     return (key);
00161 }
00162
00163 /* Note: only updates the in-memory copy, which is written out at
00164    mydbm_close time.  Note: Also differs from DBM in that on duplication,
00165    it gives a warning, rather than either DBM_INSERT or DBM_REPLACE
00166    behavior.  */
00167 int
00168 mydbm_store (db, key, value, flags)
00169     DBM *db;
00170     datum key;
00171     datum value;
00172     int flags;
00173 {
00174     Node *node;
00175
00176     node = getnode ();
00177     node->type = NDBMNODE;
00178
00179     node->key = xmalloc (key.dsize + 1);
00180     strncpy (node->key, key.dptr, key.dsize);
00181     node->key[key.dsize] = '\0';
00182
00183     node->data = xmalloc (value.dsize + 1);
00184     strncpy (node->data, value.dptr, value.dsize);
00185     node->data[value.dsize] = '\0';
00186
00187     db->modified = 1;
00188     if (addnode (db->dbm_list, node) == -1)
00189     {
00190     error (0, 0, "attempt to insert duplicate key `%s'", node->key);
00191     freenode (node);
00192     return 0;
00193     }
00194     return 0;
00195 }
00196
00197 static void
00198 mydbm_load_file (fp, list)
00199     FILE *fp;
00200     List *list;
00201 {
00202     char *line = NULL;
00203     size_t line_size;
00204     char *value;
00205     size_t value_allocated;
00206     char *cp, *vp;
00207     int cont;
00208     int line_length;
00209
00210     value_allocated = 1;
00211     value = xmalloc (value_allocated);
00212
00213     cont = 0;
00214     while ((line_length =
00215             getstr (&line, &line_size, fp, '\012', 0, GETLINE_NO_LIMIT)) >= 0)
00216     {
00217     if (line_length > 0 && line[line_length - 1] == '\012')
00218     {
00219         /* Strip the newline.  */
00220         --line_length;
00221         line[line_length] = '\0';
00222     }
00223     if (line_length > 0 && line[line_length - 1] == '\015')
00224     {
00225         /* If the file (e.g. modules) was written on an NT box, it will
00226            contain CRLF at the ends of lines.  Strip them (we can't do
00227            this by opening the file in text mode because we might be
00228            running on unix).  */
00229         --line_length;
00230         line[line_length] = '\0';
00231     }
00232
00233     /*
00234      * Add the line to the value, at the end if this is a continuation
00235      * line; otherwise at the beginning, but only after any trailing
00236      * backslash is removed.
00237      */
00238     if (!cont)
00239         value[0] = '\0';
00240
00241     /*
00242      * See if the line we read is a continuation line, and strip the
00243      * backslash if so.
00244      */
00245     if (line_length > 0)
00246         cp = &line[line_length - 1];
00247     else
00248         cp = line;
00249     if (*cp == '\\')
00250     {
00251         cont = 1;
00252         *cp = '\0';
00253         --line_length;
00254     }
00255     else
00256     {
00257         cont = 0;
00258     }
00259     expand_string (&value,
00260                &value_allocated,
00261                strlen (value) + line_length + 5);
00262     strcat (value, line);
00263
00264     if (value[0] == '#')
00265         continue;           /* comment line */
00266     vp = value;
00267     while (*vp && isspace ((unsigned char) *vp))
00268         vp++;
00269     if (*vp == '\0')
00270         continue;           /* empty line */
00271
00272     /*
00273      * If this was not a continuation line, add the entry to the database
00274      */
00275     if (!cont)
00276     {
00277         Node *p = getnode ();
00278         char *kp;
00279
00280         kp = vp;
00281         while (*vp && !isspace ((unsigned char) *vp))
00282         vp++;
00283         *vp++ = '\0';       /* NULL terminate the key */
00284         p->type = NDBMNODE;
00285         p->key = xstrdup (kp);
00286         while (*vp && isspace ((unsigned char) *vp))
00287         vp++;           /* skip whitespace to value */
00288         if (*vp == '\0')
00289         {
00290         error (0, 0, "warning: NULL value for key `%s'", p->key);
00291         freenode (p);
00292         continue;
00293         }
00294         p->data = xstrdup (vp);
00295         if (addnode (list, p) == -1)
00296         {
00297         error (0, 0, "duplicate key found for `%s'", p->key);
00298         freenode (p);
00299         }
00300     }
00301     }
00302     if (line_length < 0 && !feof (fp))
00303     /* FIXME: should give the name of the file.  */
00304     error (0, errno, "cannot read file in mydbm_load_file");
00305
00306     free (line);
00307     free (value);
00308 }
00309
00310 #endif              /* MY_NDBM */
Generated on Sun Oct 21 12:41:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/myndbm.h Source File

cvs-1.10/src/myndbm.h

Go to the documentation of this file.
00001 #ifdef MY_NDBM
00002
00003 #define DBLKSIZ 4096
00004
00005 typedef struct
00006 {
00007     List *dbm_list;         /* cached database */
00008     Node *dbm_next;         /* next key to return for nextkey() */
00009
00010     /* Name of the file to write to if modified is set.  malloc'd.  */
00011     char *name;
00012
00013     /* Nonzero if the database has been modified and dbm_close needs to
00014        write it out to disk.  */
00015     int modified;
00016 } DBM;
00017
00018 typedef struct
00019 {
00020     char *dptr;
00021     int dsize;
00022 } datum;
00023
00024 /*
00025  * So as not to conflict with other dbm_open, etc., routines that may
00026  * be included by someone's libc, all of my emulation routines are prefixed
00027  * by "my" and we define the "standard" ones to be "my" ones here.
00028  */
00029 #define dbm_open    mydbm_open
00030 #define dbm_close   mydbm_close
00031 #define dbm_fetch   mydbm_fetch
00032 #define dbm_firstkey    mydbm_firstkey
00033 #define dbm_nextkey mydbm_nextkey
00034 #define dbm_store   mydbm_store
00035 #define  DBM_INSERT  0
00036 #define  DBM_REPLACE 1
00037
00038 DBM *mydbm_open PROTO((char *file, int flags, int mode));
00039 void mydbm_close PROTO((DBM * db));
00040 datum mydbm_fetch PROTO((DBM * db, datum key));
00041 datum mydbm_firstkey PROTO((DBM * db));
00042 datum mydbm_nextkey PROTO((DBM * db));
00043 extern int mydbm_store PROTO ((DBM *, datum, datum, int));
00044
00045 #endif              /* MY_NDBM */
Generated on Sun Oct 21 12:41:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/no_diff.c Source File

cvs-1.10/src/no_diff.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * No Difference
00009  *
00010  * The user file looks modified judging from its time stamp; however it needn't
00011  * be.  No_difference() finds out whether it is or not. If it is not, it
00012  * updates the administration.
00013  *
00014  * returns 0 if no differences are found and non-zero otherwise
00015  */
00016
00017 #include "cvs.h"
00018
00019 int
00020 No_Difference (finfo, vers)
00021     struct file_info *finfo;
00022     Vers_TS *vers;
00023 {
00024     Node *p;
00025     int ret;
00026     char *ts, *options;
00027     int retcode = 0;
00028     char *tocvsPath;
00029
00030     /* If ts_user is "Is-modified", we can only conclude the files are
00031        different (since we don't have the file's contents).  */
00032     if (vers->ts_user != NULL
00033     && strcmp (vers->ts_user, "Is-modified") == 0)
00034     return -1;
00035
00036     if (!vers->srcfile || !vers->srcfile->path)
00037     return (-1);            /* different since we couldn't tell */
00038
00039 #ifdef PRESERVE_PERMISSIONS_SUPPORT
00040     /* If special files are in use, then any mismatch of file metadata
00041        information also means that the files should be considered different. */
00042     if (preserve_perms && special_file_mismatch (finfo, vers->vn_user, NULL))
00043     return 1;
00044 #endif
00045
00046     if (vers->entdata && vers->entdata->options)
00047     options = xstrdup (vers->entdata->options);
00048     else
00049     options = xstrdup ("");
00050
00051     tocvsPath = wrap_tocvs_process_file (finfo->file);
00052     retcode = RCS_cmp_file (vers->srcfile, vers->vn_user, options,
00053                 tocvsPath == NULL ? finfo->file : tocvsPath);
00054     if (retcode == 0)
00055     {
00056     /* no difference was found, so fix the entries file */
00057     ts = time_stamp (finfo->file);
00058     Register (finfo->entries, finfo->file,
00059           vers->vn_user ? vers->vn_user : vers->vn_rcs, ts,
00060           options, vers->tag, vers->date, (char *) 0);
00061 #ifdef SERVER_SUPPORT
00062     if (server_active)
00063     {
00064         /* We need to update the entries line on the client side.  */
00065         server_update_entries
00066           (finfo->file, finfo->update_dir, finfo->repository, SERVER_UPDATED);
00067     }
00068 #endif
00069     free (ts);
00070
00071     /* update the entdata pointer in the vers_ts structure */
00072     p = findnode (finfo->entries, finfo->file);
00073     vers->entdata = (Entnode *) p->data;
00074
00075     ret = 0;
00076     }
00077     else
00078     ret = 1;            /* files were really different */
00079
00080     if (tocvsPath)
00081     {
00082     /* Need to call unlink myself because the noexec variable
00083      * has been set to 1.  */
00084     if (trace)
00085         (void) fprintf (stderr, "%s-> unlink (%s)\n",
00086                 CLIENT_SERVER_STR, tocvsPath);
00087     if ( CVS_UNLINK (tocvsPath) < 0)
00088         error (0, errno, "could not remove %s", tocvsPath);
00089     }
00090
00091     free (options);
00092     return (ret);
00093 }
Generated on Sun Oct 21 12:41:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/parseinfo.c Source File

cvs-1.10/src/parseinfo.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  */
00008
00009 #include "cvs.h"
00010 #include "getline.h"
00011 #include <assert.h>
00012
00013 extern char *logHistory;
00014
00015 /*
00016  * Parse the INFOFILE file for the specified REPOSITORY.  Invoke CALLPROC for
00017  * the first line in the file that matches the REPOSITORY, or if ALL != 0, any lines
00018  * matching "ALL", or if no lines match, the last line matching "DEFAULT".
00019  *
00020  * Return 0 for success, -1 if there was not an INFOFILE, and >0 for failure.
00021  */
00022 int
00023 Parse_Info (infofile, repository, callproc, all)
00024     char *infofile;
00025     char *repository;
00026     CALLPROC callproc;
00027     int all;
00028 {
00029     int err = 0;
00030     FILE *fp_info;
00031     char *infopath;
00032     char *line = NULL;
00033     size_t line_allocated = 0;
00034     char *default_value = NULL;
00035     char *expanded_value= NULL;
00036     int callback_done, line_number;
00037     char *cp, *exp, *value, *srepos, bad;
00038     const char *regex_err;
00039
00040     if (CVSroot_original == NULL)
00041     {
00042     /* XXX - should be error maybe? */
00043     error (0, 0, "CVSROOT variable not set");
00044     return (1);
00045     }
00046
00047     /* find the info file and open it */
00048     infopath = xmalloc (strlen (CVSroot_directory)
00049             + strlen (infofile)
00050             + sizeof (CVSROOTADM)
00051             + 10);
00052     (void) sprintf (infopath, "%s/%s/%s", CVSroot_directory,
00053             CVSROOTADM, infofile);
00054     fp_info = CVS_FOPEN (infopath, "r");
00055     if (fp_info == NULL)
00056     {
00057     /* If no file, don't do anything special.  */
00058     if (!existence_error (errno))
00059         error (0, errno, "cannot open %s", infopath);
00060     free (infopath);
00061     return 0;
00062     }
00063
00064     /* strip off the CVSROOT if repository was absolute */
00065     srepos = Short_Repository (repository);
00066
00067     if (trace)
00068     (void) fprintf (stderr, " -> ParseInfo(%s, %s, %s)\n",
00069             infopath, srepos, all ? "ALL" : "not ALL");
00070
00071     /* search the info file for lines that match */
00072     callback_done = line_number = 0;
00073     while (getline (&line, &line_allocated, fp_info) >= 0)
00074     {
00075     line_number++;
00076
00077     /* skip lines starting with # */
00078     if (line[0] == '#')
00079         continue;
00080
00081     /* skip whitespace at beginning of line */
00082     for (cp = line; *cp && isspace ((unsigned char) *cp); cp++)
00083         ;
00084
00085     /* if *cp is null, the whole line was blank */
00086     if (*cp == '\0')
00087         continue;
00088
00089     /* the regular expression is everything up to the first space */
00090     for (exp = cp; *cp && !isspace ((unsigned char) *cp); cp++)
00091         ;
00092     if (*cp != '\0')
00093         *cp++ = '\0';
00094
00095     /* skip whitespace up to the start of the matching value */
00096     while (*cp && isspace ((unsigned char) *cp))
00097         cp++;
00098
00099     /* no value to match with the regular expression is an error */
00100     if (*cp == '\0')
00101     {
00102         error (0, 0, "syntax error at line %d file %s; ignored",
00103            line_number, infofile);
00104         continue;
00105     }
00106     value = cp;
00107
00108     /* strip the newline off the end of the value */
00109     if ((cp = strrchr (value, '\n')) != NULL)
00110         *cp = '\0';
00111
00112     if (expanded_value != NULL)
00113         free (expanded_value);
00114     expanded_value = expand_path (value, infofile, line_number);
00115
00116     /*
00117      * At this point, exp points to the regular expression, and value
00118      * points to the value to call the callback routine with.  Evaluate
00119      * the regular expression against srepos and callback with the value
00120      * if it matches.
00121      */
00122
00123     /* save the default value so we have it later if we need it */
00124     if (strcmp (exp, "DEFAULT") == 0)
00125     {
00126         /* Is it OK to silently ignore all but the last DEFAULT
00127                expression?  */
00128         if (default_value != NULL && default_value != &bad)
00129         free (default_value);
00130         default_value = (expanded_value != NULL ?
00131                  xstrdup (expanded_value) : &bad);
00132         continue;
00133     }
00134
00135     /*
00136      * For a regular expression of "ALL", do the callback always We may
00137      * execute lots of ALL callbacks in addition to *one* regular matching
00138      * callback or default
00139      */
00140     if (strcmp (exp, "ALL") == 0)
00141     {
00142         if (!all)
00143         error(0, 0, "Keyword `ALL' is ignored at line %d in %s file",
00144               line_number, infofile);
00145         else if (expanded_value != NULL)
00146         err += callproc (repository, expanded_value);
00147         else
00148         err++;
00149         continue;
00150     }
00151
00152     if (callback_done)
00153         /* only first matching, plus "ALL"'s */
00154         continue;
00155
00156     /* see if the repository matched this regular expression */
00157     if ((regex_err = re_comp (exp)) != NULL)
00158     {
00159         error (0, 0, "bad regular expression at line %d file %s: %s",
00160            line_number, infofile, regex_err);
00161         continue;
00162     }
00163     if (re_exec (srepos) == 0)
00164         continue;               /* no match */
00165
00166     /* it did, so do the callback and note that we did one */
00167     if (expanded_value != NULL)
00168         err += callproc (repository, expanded_value);
00169     else
00170         err++;
00171     callback_done = 1;
00172     }
00173     if (ferror (fp_info))
00174     error (0, errno, "cannot read %s", infopath);
00175     if (fclose (fp_info) < 0)
00176     error (0, errno, "cannot close %s", infopath);
00177
00178     /* if we fell through and didn't callback at all, do the default */
00179     if (callback_done == 0 && default_value != NULL)
00180     {
00181     if (default_value != &bad)
00182         err += callproc (repository, default_value);
00183     else
00184         err++;
00185     }
00186
00187     /* free up space if necessary */
00188     if (default_value != NULL && default_value != &bad)
00189     free (default_value);
00190     if (expanded_value != NULL)
00191     free (expanded_value);
00192     free (infopath);
00193     if (line != NULL)
00194     free (line);
00195
00196     return (err);
00197 }
00198
00199
00200 /* Parse the CVS config file.  The syntax right now is a bit ad hoc
00201    but tries to draw on the best or more common features of the other
00202    *info files and various unix (or non-unix) config file syntaxes.
00203    Lines starting with # are comments.  Settings are lines of the form
00204    KEYWORD=VALUE.  There is currently no way to have a multi-line
00205    VALUE (would be nice if there was, probably).
00206
00207    CVSROOT is the $CVSROOT directory (CVSroot_directory might not be
00208    set yet).
00209
00210    Returns 0 for success, negative value for failure.  Call
00211    error(0, ...) on errors in addition to the return value.  */
00212 int
00213 parse_config (cvsroot)
00214     char *cvsroot;
00215 {
00216     char *infopath;
00217     FILE *fp_info;
00218     char *line = NULL;
00219     size_t line_allocated = 0;
00220     size_t len;
00221     char *p;
00222     /* FIXME-reentrancy: If we do a multi-threaded server, this would need
00223        to go to the per-connection data structures.  */
00224     static int parsed = 0;
00225
00226     /* Authentication code and serve_root might both want to call us.
00227        Let this happen smoothly.  */
00228     if (parsed)
00229     return 0;
00230     parsed = 1;
00231
00232     infopath = malloc (strlen (cvsroot)
00233             + sizeof (CVSROOTADM_CONFIG)
00234             + sizeof (CVSROOTADM)
00235             + 10);
00236     if (infopath == NULL)
00237     {
00238     error (0, 0, "out of memory; cannot allocate infopath");
00239     goto error_return;
00240     }
00241
00242     strcpy (infopath, cvsroot);
00243     strcat (infopath, "/");
00244     strcat (infopath, CVSROOTADM);
00245     strcat (infopath, "/");
00246     strcat (infopath, CVSROOTADM_CONFIG);
00247
00248     fp_info = CVS_FOPEN (infopath, "r");
00249     if (fp_info == NULL)
00250     {
00251     /* If no file, don't do anything special.  */
00252     if (!existence_error (errno))
00253     {
00254         /* Just a warning message; doesn't affect return
00255            value, currently at least.  */
00256         error (0, errno, "cannot open %s", infopath);
00257     }
00258     free (infopath);
00259     return 0;
00260     }
00261
00262     while (getline (&line, &line_allocated, fp_info) >= 0)
00263     {
00264     /* Skip comments.  */
00265     if (line[0] == '#')
00266         continue;
00267
00268     /* At least for the moment we don't skip whitespace at the start
00269        of the line.  Too picky?  Maybe.  But being insufficiently
00270        picky leads to all sorts of confusion, and it is a lot easier
00271        to start out picky and relax it than the other way around.
00272
00273        Is there any kind of written standard for the syntax of this
00274        sort of config file?  Anywhere in POSIX for example (I guess
00275        makefiles are sort of close)?  Red Hat Linux has a bunch of
00276        these too (with some GUI tools which edit them)...
00277
00278        Along the same lines, we might want a table of keywords,
00279        with various types (boolean, string, &c), as a mechanism
00280        for making sure the syntax is consistent.  Any good examples
00281        to follow there (Apache?)?  */
00282
00283     /* Strip the training newline.  There will be one unless we
00284        read a partial line without a newline, and then got end of
00285        file (or error?).  */
00286
00287     len = strlen (line) - 1;
00288     if (line[len] == '\n')
00289         line[len] = '\0';
00290
00291     /* Skip blank lines.  */
00292     if (line[0] == '\0')
00293         continue;
00294
00295     /* The first '=' separates keyword from value.  */
00296     p = strchr (line, '=');
00297     if (p == NULL)
00298     {
00299         /* Probably should be printing line number.  */
00300         error (0, 0, "syntax error in %s: line '%s' is missing '='",
00301            infopath, line);
00302         goto error_return;
00303     }
00304
00305     *p++ = '\0';
00306
00307     if (strcmp (line, "RCSBIN") == 0)
00308     {
00309         /* This option used to specify the directory for RCS
00310            executables.  But since we don't run them any more,
00311            this is a noop.  Silently ignore it so that a
00312            repository can work with either new or old CVS.  */
00313         ;
00314     }
00315     else if (strcmp (line, "SystemAuth") == 0)
00316     {
00317         if (strcmp (p, "no") == 0)
00318 #ifdef AUTH_SERVER_SUPPORT
00319         system_auth = 0;
00320 #else
00321         /* Still parse the syntax but ignore the
00322            option.  That way the same config file can
00323            be used for local and server.  */
00324         ;
00325 #endif
00326         else if (strcmp (p, "yes") == 0)
00327 #ifdef AUTH_SERVER_SUPPORT
00328         system_auth = 1;
00329 #else
00330         ;
00331 #endif
00332         else
00333         {
00334         error (0, 0, "unrecognized value '%s' for SystemAuth", p);
00335         goto error_return;
00336         }
00337     }
00338     else if (strcmp (line, "PreservePermissions") == 0)
00339     {
00340         if (strcmp (p, "no") == 0)
00341         preserve_perms = 0;
00342         else if (strcmp (p, "yes") == 0)
00343         {
00344 #ifdef PRESERVE_PERMISSIONS_SUPPORT
00345         preserve_perms = 1;
00346 #else
00347         error (0, 0, "\
00348 warning: this CVS does not support PreservePermissions");
00349 #endif
00350         }
00351         else
00352         {
00353         error (0, 0, "unrecognized value '%s' for PreservePermissions",
00354                p);
00355         goto error_return;
00356         }
00357     }
00358     else if (strcmp (line, "TopLevelAdmin") == 0)
00359     {
00360         if (strcmp (p, "no") == 0)
00361         top_level_admin = 0;
00362         else if (strcmp (p, "yes") == 0)
00363         top_level_admin = 1;
00364         else
00365         {
00366         error (0, 0, "unrecognized value '%s' for TopLevelAdmin", p);
00367         goto error_return;
00368         }
00369     }
00370     else if (strcmp (line, "LockDir") == 0)
00371     {
00372         if (lock_dir != NULL)
00373         free (lock_dir);
00374         lock_dir = xstrdup (p);
00375         /* Could try some validity checking, like whether we can
00376            opendir it or something, but I don't see any particular
00377            reason to do that now rather than waiting until lock.c.  */
00378     }
00379     else if (strcmp (line, "LogHistory") == 0)
00380     {
00381         if (strcmp (p, "all") != 0)
00382         {
00383         logHistory=malloc(strlen (p) + 1);
00384         strcpy (logHistory, p);
00385         }
00386     }
00387     else
00388     {
00389         /* We may be dealing with a keyword which was added in a
00390            subsequent version of CVS.  In that case it is a good idea
00391            to complain, as (1) the keyword might enable a behavior like
00392            alternate locking behavior, in which it is dangerous and hard
00393            to detect if some CVS's have it one way and others have it
00394            the other way, (2) in general, having us not do what the user
00395            had in mind when they put in the keyword violates the
00396            principle of least surprise.  Note that one corollary is
00397            adding new keywords to your CVSROOT/config file is not
00398            particularly recommended unless you are planning on using
00399            the new features.  */
00400         error (0, 0, "%s: unrecognized keyword '%s'",
00401            infopath, line);
00402         goto error_return;
00403     }
00404     }
00405     if (ferror (fp_info))
00406     {
00407     error (0, errno, "cannot read %s", infopath);
00408     goto error_return;
00409     }
00410     if (fclose (fp_info) < 0)
00411     {
00412     error (0, errno, "cannot close %s", infopath);
00413     goto error_return;
00414     }
00415     free (infopath);
00416     if (line != NULL)
00417     free (line);
00418     return 0;
00419
00420  error_return:
00421     if (infopath != NULL)
00422     free (infopath);
00423     if (line != NULL)
00424     free (line);
00425     return -1;
00426 }
Generated on Sun Oct 21 12:41:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/patch.c Source File

cvs-1.10/src/patch.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Patch
00009  *
00010  * Create a Larry Wall format "patch" file between a previous release and the
00011  * current head of a module, or between two releases.  Can specify the
00012  * release as either a date or a revision number.
00013  */
00014
00015 #include "cvs.h"
00016 #include "getline.h"
00017
00018 static RETSIGTYPE patch_cleanup PROTO((void));
00019 static Dtype patch_dirproc PROTO ((void *callerdat, char *dir,
00020                    char *repos, char *update_dir,
00021                    List *entries));
00022 static int patch_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00023 static int patch_proc PROTO((int argc, char **argv, char *xwhere,
00024                char *mwhere, char *mfile, int shorten,
00025                int local_specified, char *mname, char *msg));
00026
00027 static int force_tag_match = 1;
00028 static int patch_short = 0;
00029 static int toptwo_diffs = 0;
00030 static int local = 0;
00031 static char *options = NULL;
00032 static char *rev1 = NULL;
00033 static int rev1_validated = 0;
00034 static char *rev2 = NULL;
00035 static int rev2_validated = 0;
00036 static char *date1 = NULL;
00037 static char *date2 = NULL;
00038 static char *tmpfile1 = NULL;
00039 static char *tmpfile2 = NULL;
00040 static char *tmpfile3 = NULL;
00041 static int unidiff = 0;
00042
00043 static const char *const patch_usage[] =
00044 {
00045     "Usage: %s %s [-flR] [-c|-u] [-s|-t] [-V %%d]\n",
00046     "    -r rev|-D date [-r rev2 | -D date2] modules...\n",
00047     "\t-f\tForce a head revision match if tag/date not found.\n",
00048     "\t-l\tLocal directory only, not recursive\n",
00049     "\t-R\tProcess directories recursively.\n",
00050     "\t-c\tContext diffs (default)\n",
00051     "\t-u\tUnidiff format.\n",
00052     "\t-s\tShort patch - one liner per file.\n",
00053     "\t-t\tTop two diffs - last change made to the file.\n",
00054     "\t-D date\tDate.\n",
00055     "\t-r rev\tRevision - symbolic or numeric.\n",
00056     "\t-V vers\tUse RCS Version \"vers\" for keyword expansion.\n",
00057     "(Specify the --help global option for a list of other help options)\n",
00058     NULL
00059 };
00060
00061 int
00062 patch (argc, argv)
00063     int argc;
00064     char **argv;
00065 {
00066     register int i;
00067     int c;
00068     int err = 0;
00069     DBM *db;
00070
00071     if (argc == -1)
00072     usage (patch_usage);
00073
00074     optind = 0;
00075     while ((c = getopt (argc, argv, "+V:k:cuftsQqlRD:r:")) != -1)
00076     {
00077     switch (c)
00078     {
00079         case 'Q':
00080         case 'q':
00081 #ifdef SERVER_SUPPORT
00082         /* The CVS 1.5 client sends these options (in addition to
00083            Global_option requests), so we must ignore them.  */
00084         if (!server_active)
00085 #endif
00086             error (1, 0,
00087                "-q or -Q must be specified before \"%s\"",
00088                command_name);
00089         break;
00090         case 'f':
00091         force_tag_match = 0;
00092         break;
00093         case 'l':
00094         local = 1;
00095         break;
00096         case 'R':
00097         local = 0;
00098         break;
00099         case 't':
00100         toptwo_diffs = 1;
00101         break;
00102         case 's':
00103         patch_short = 1;
00104         break;
00105         case 'D':
00106         if (rev2 != NULL || date2 != NULL)
00107             error (1, 0,
00108                "no more than two revisions/dates can be specified");
00109         if (rev1 != NULL || date1 != NULL)
00110             date2 = Make_Date (optarg);
00111         else
00112             date1 = Make_Date (optarg);
00113         break;
00114         case 'r':
00115         if (rev2 != NULL || date2 != NULL)
00116             error (1, 0,
00117                "no more than two revisions/dates can be specified");
00118         if (rev1 != NULL || date1 != NULL)
00119             rev2 = optarg;
00120         else
00121             rev1 = optarg;
00122         break;
00123         case 'k':
00124         if (options)
00125             free (options);
00126         options = RCS_check_kflag (optarg);
00127         break;
00128         case 'V':
00129         /* This option is pretty seriously broken:
00130            1.  It is not clear what it does (does it change keyword
00131            expansion behavior?  If so, how?  Or does it have
00132            something to do with what version of RCS we are using?
00133            Or the format we write RCS files in?).
00134            2.  Because both it and -k use the options variable,
00135            specifying both -V and -k doesn't work.
00136            3.  At least as of CVS 1.9, it doesn't work (failed
00137            assertion in RCS_checkout where it asserts that options
00138            starts with -k).  Few people seem to be complaining.
00139            In the future (perhaps the near future), I have in mind
00140            removing it entirely, and updating NEWS and cvs.texinfo,
00141            but in case it is a good idea to give people more time
00142            to complain if they would miss it, I'll just add this
00143            quick and dirty error message for now.  */
00144         error (1, 0,
00145                "the -V option is obsolete and should not be used");
00146 #if 0
00147         if (atoi (optarg) <= 0)
00148             error (1, 0, "must specify a version number to -V");
00149         if (options)
00150             free (options);
00151         options = xmalloc (strlen (optarg) + 1 + 2);    /* for the -V */
00152         (void) sprintf (options, "-V%s", optarg);
00153 #endif
00154         break;
00155         case 'u':
00156         unidiff = 1;        /* Unidiff */
00157         break;
00158         case 'c':           /* Context diff */
00159         unidiff = 0;
00160         break;
00161         case '?':
00162         default:
00163         usage (patch_usage);
00164         break;
00165     }
00166     }
00167     argc -= optind;
00168     argv += optind;
00169
00170     /* Sanity checks */
00171     if (argc < 1)
00172     usage (patch_usage);
00173
00174     if (toptwo_diffs && patch_short)
00175     error (1, 0, "-t and -s options are mutually exclusive");
00176     if (toptwo_diffs && (date1 != NULL || date2 != NULL ||
00177              rev1 != NULL || rev2 != NULL))
00178     error (1, 0, "must not specify revisions/dates with -t option!");
00179
00180     if (!toptwo_diffs && (date1 == NULL && date2 == NULL &&
00181               rev1 == NULL && rev2 == NULL))
00182     error (1, 0, "must specify at least one revision/date!");
00183     if (date1 != NULL && date2 != NULL)
00184     if (RCS_datecmp (date1, date2) >= 0)
00185         error (1, 0, "second date must come after first date!");
00186
00187     /* if options is NULL, make it a NULL string */
00188     if (options == NULL)
00189     options = xstrdup ("");
00190
00191 #ifdef CLIENT_SUPPORT
00192     if (client_active)
00193     {
00194     /* We're the client side.  Fire up the remote server.  */
00195     start_server ();
00196
00197     ign_setup ();
00198
00199     if (local)
00200         send_arg("-l");
00201     if (!force_tag_match)
00202         send_arg("-f");
00203     if (toptwo_diffs)
00204         send_arg("-t");
00205     if (patch_short)
00206         send_arg("-s");
00207     if (unidiff)
00208         send_arg("-u");
00209
00210     if (rev1)
00211         option_with_arg ("-r", rev1);
00212     if (date1)
00213         client_senddate (date1);
00214     if (rev2)
00215         option_with_arg ("-r", rev2);
00216     if (date2)
00217         client_senddate (date2);
00218     if (options[0] != '\0')
00219         send_arg (options);
00220
00221     {
00222         int i;
00223         for (i = 0; i < argc; ++i)
00224         send_arg (argv[i]);
00225     }
00226
00227     send_to_server ("rdiff\012", 0);
00228         return get_responses_and_close ();
00229     }
00230 #endif
00231
00232     /* clean up if we get a signal */
00233 #ifdef SIGABRT
00234     (void) SIG_register (SIGABRT, patch_cleanup);
00235 #endif
00236 #ifdef SIGHUP
00237     (void) SIG_register (SIGHUP, patch_cleanup);
00238 #endif
00239 #ifdef SIGINT
00240     (void) SIG_register (SIGINT, patch_cleanup);
00241 #endif
00242 #ifdef SIGQUIT
00243     (void) SIG_register (SIGQUIT, patch_cleanup);
00244 #endif
00245 #ifdef SIGPIPE
00246     (void) SIG_register (SIGPIPE, patch_cleanup);
00247 #endif
00248 #ifdef SIGTERM
00249     (void) SIG_register (SIGTERM, patch_cleanup);
00250 #endif
00251
00252     db = open_module ();
00253     for (i = 0; i < argc; i++)
00254     err += do_module (db, argv[i], PATCH, "Patching", patch_proc,
00255               (char *) NULL, 0, 0, 0, (char *) NULL);
00256     close_module (db);
00257     free (options);
00258     patch_cleanup ();
00259     return (err);
00260 }
00261
00262 /*
00263  * callback proc for doing the real work of patching
00264  */
00265 /* ARGSUSED */
00266 static int
00267 patch_proc (argc, argv, xwhere, mwhere, mfile, shorten, local_specified,
00268         mname, msg)
00269     int argc;
00270     char **argv;
00271     char *xwhere;
00272     char *mwhere;
00273     char *mfile;
00274     int shorten;
00275     int local_specified;
00276     char *mname;
00277     char *msg;
00278 {
00279     char *myargv[2];
00280     int err = 0;
00281     int which;
00282     char *repository;
00283     char *where;
00284
00285     repository = xmalloc (strlen (CVSroot_directory) + strlen (argv[0])
00286               + (mfile == NULL ? 0 : strlen (mfile)) + 30);
00287     (void) sprintf (repository, "%s/%s", CVSroot_directory, argv[0]);
00288     where = xmalloc (strlen (argv[0]) + (mfile == NULL ? 0 : strlen (mfile))
00289              + 10);
00290     (void) strcpy (where, argv[0]);
00291
00292     /* if mfile isn't null, we need to set up to do only part of the module */
00293     if (mfile != NULL)
00294     {
00295     char *cp;
00296     char *path;
00297
00298     /* if the portion of the module is a path, put the dir part on repos */
00299     if ((cp = strrchr (mfile, '/')) != NULL)
00300     {
00301         *cp = '\0';
00302         (void) strcat (repository, "/");
00303         (void) strcat (repository, mfile);
00304         (void) strcat (where, "/");
00305         (void) strcat (where, mfile);
00306         mfile = cp + 1;
00307     }
00308
00309     /* take care of the rest */
00310     path = xmalloc (strlen (repository) + strlen (mfile) + 5);
00311     (void) sprintf (path, "%s/%s", repository, mfile);
00312     if (isdir (path))
00313     {
00314         /* directory means repository gets the dir tacked on */
00315         (void) strcpy (repository, path);
00316         (void) strcat (where, "/");
00317         (void) strcat (where, mfile);
00318     }
00319     else
00320     {
00321         myargv[0] = argv[0];
00322         myargv[1] = mfile;
00323         argc = 2;
00324         argv = myargv;
00325     }
00326     free (path);
00327     }
00328
00329     /* cd to the starting repository */
00330     if ( CVS_CHDIR (repository) < 0)
00331     {
00332     error (0, errno, "cannot chdir to %s", repository);
00333     free (repository);
00334     return (1);
00335     }
00336     free (repository);
00337
00338     if (force_tag_match)
00339     which = W_REPOS | W_ATTIC;
00340     else
00341     which = W_REPOS;
00342
00343     if (rev1 != NULL && !rev1_validated)
00344     {
00345     tag_check_valid (rev1, argc - 1, argv + 1, local, 0, NULL);
00346     rev1_validated = 1;
00347     }
00348     if (rev2 != NULL && !rev2_validated)
00349     {
00350     tag_check_valid (rev2, argc - 1, argv + 1, local, 0, NULL);
00351     rev2_validated = 1;
00352     }
00353
00354     /* start the recursion processor */
00355     err = start_recursion (patch_fileproc, (FILESDONEPROC) NULL, patch_dirproc,
00356                (DIRLEAVEPROC) NULL, NULL,
00357                argc - 1, argv + 1, local,
00358                which, 0, 1, where, 1);
00359     free (where);
00360
00361     return (err);
00362 }
00363
00364 /*
00365  * Called to examine a particular RCS file, as appropriate with the options
00366  * that were set above.
00367  */
00368 /* ARGSUSED */
00369 static int
00370 patch_fileproc (callerdat, finfo)
00371     void *callerdat;
00372     struct file_info *finfo;
00373 {
00374     struct utimbuf t;
00375     char *vers_tag, *vers_head;
00376     char *rcs = NULL;
00377     RCSNode *rcsfile;
00378     FILE *fp1, *fp2, *fp3;
00379     int ret = 0;
00380     int isattic = 0;
00381     int retcode = 0;
00382     char *file1;
00383     char *file2;
00384     char *strippath;
00385     char *line1, *line2;
00386     size_t line1_chars_allocated;
00387     size_t line2_chars_allocated;
00388     char *cp1, *cp2;
00389     FILE *fp;
00390     int line_length;
00391
00392     line1 = NULL;
00393     line1_chars_allocated = 0;
00394     line2 = NULL;
00395     line2_chars_allocated = 0;
00396
00397     /* find the parsed rcs file */
00398     if ((rcsfile = finfo->rcs) == NULL)
00399     {
00400     ret = 1;
00401     goto out2;
00402     }
00403     if ((rcsfile->flags & VALID) && (rcsfile->flags & INATTIC))
00404     isattic = 1;
00405
00406     rcs = xmalloc (strlen (finfo->file) + sizeof (RCSEXT) + 5);
00407     (void) sprintf (rcs, "%s%s", finfo->file, RCSEXT);
00408
00409     /* if vers_head is NULL, may have been removed from the release */
00410     if (isattic && rev2 == NULL && date2 == NULL)
00411     vers_head = NULL;
00412     else
00413     {
00414     vers_head = RCS_getversion (rcsfile, rev2, date2, force_tag_match,
00415                     (int *) NULL);
00416     if (vers_head != NULL && RCS_isdead (rcsfile, vers_head))
00417     {
00418         free (vers_head);
00419         vers_head = NULL;
00420     }
00421     }
00422
00423     if (toptwo_diffs)
00424     {
00425     if (vers_head == NULL)
00426     {
00427         ret = 1;
00428         goto out2;
00429     }
00430
00431     if (!date1)
00432         date1 = xmalloc (MAXDATELEN);
00433     *date1 = '\0';
00434     if (RCS_getrevtime (rcsfile, vers_head, date1, 1) == -1)
00435     {
00436         if (!really_quiet)
00437         error (0, 0, "cannot find date in rcs file %s revision %s",
00438                rcs, vers_head);
00439         ret = 1;
00440         goto out2;
00441     }
00442     }
00443     vers_tag = RCS_getversion (rcsfile, rev1, date1, force_tag_match,
00444                    (int *) NULL);
00445     if (vers_tag != NULL && RCS_isdead (rcsfile, vers_tag))
00446     {
00447         free (vers_tag);
00448     vers_tag = NULL;
00449     }
00450
00451     if (vers_tag == NULL && vers_head == NULL)
00452     {
00453     /* Nothing known about specified revs.  */
00454     ret = 0;
00455     goto out2;
00456     }
00457
00458     if (vers_tag && vers_head && strcmp (vers_head, vers_tag) == 0)
00459     {
00460     /* Not changed between releases.  */
00461     ret = 0;
00462     goto out2;
00463     }
00464
00465     if (patch_short)
00466     {
00467     cvs_output ("File ", 0);
00468     cvs_output (finfo->fullname, 0);
00469     if (vers_tag == NULL)
00470     {
00471         cvs_output (" is new; current revision ", 0);
00472         cvs_output (vers_head, 0);
00473         cvs_output ("\n", 1);
00474     }
00475     else if (vers_head == NULL)
00476     {
00477         cvs_output (" is removed; not included in ", 0);
00478         if (rev2 != NULL)
00479         {
00480         cvs_output ("release tag ", 0);
00481         cvs_output (rev2, 0);
00482         }
00483         else if (date2 != NULL)
00484         {
00485         cvs_output ("release date ", 0);
00486         cvs_output (date2, 0);
00487         }
00488         else
00489         cvs_output ("current release", 0);
00490         cvs_output ("\n", 1);
00491     }
00492     else
00493     {
00494         cvs_output (" changed from revision ", 0);
00495         cvs_output (vers_tag, 0);
00496         cvs_output (" to ", 0);
00497         cvs_output (vers_head, 0);
00498         cvs_output ("\n", 1);
00499     }
00500     ret = 0;
00501     goto out2;
00502     }
00503
00504     /* Create 3 empty files.  I'm not really sure there is any advantage
00505        to doing so now rather than just waiting until later.  */
00506     tmpfile1 = cvs_temp_name ();
00507     fp1 = CVS_FOPEN (tmpfile1, "w+");
00508     if (fp1 == NULL)
00509     {
00510     error (0, errno, "cannot create temporary file %s", tmpfile1);
00511     ret = 1;
00512     goto out;
00513     }
00514     else
00515     if (fclose (fp1) < 0)
00516         error (0, errno, "warning: cannot close %s", tmpfile1);
00517     tmpfile2 = cvs_temp_name ();
00518     fp2 = CVS_FOPEN (tmpfile2, "w+");
00519     if (fp2 == NULL)
00520     {
00521     error (0, errno, "cannot create temporary file %s", tmpfile2);
00522     ret = 1;
00523     goto out;
00524     }
00525     else
00526     if (fclose (fp2) < 0)
00527         error (0, errno, "warning: cannot close %s", tmpfile2);
00528     tmpfile3 = cvs_temp_name ();
00529     fp3 = CVS_FOPEN (tmpfile3, "w+");
00530     if (fp3 == NULL)
00531     {
00532     error (0, errno, "cannot create temporary file %s", tmpfile3);
00533     ret = 1;
00534     goto out;
00535     }
00536     else
00537     if (fclose (fp3) < 0)
00538         error (0, errno, "warning: cannot close %s", tmpfile3);
00539
00540     if (vers_tag != NULL)
00541     {
00542     retcode = RCS_checkout (rcsfile, (char *) NULL, vers_tag,
00543                 rev1, options, tmpfile1,
00544                 (RCSCHECKOUTPROC) NULL, (void *) NULL);
00545     if (retcode != 0)
00546     {
00547         error (0, 0,
00548            "cannot check out revision %s of %s", vers_tag, rcs);
00549         ret = 1;
00550         goto out;
00551     }
00552     memset ((char *) &t, 0, sizeof (t));
00553     if ((t.actime = t.modtime = RCS_getrevtime (rcsfile, vers_tag,
00554                             (char *) 0, 0)) != -1)
00555         /* I believe this timestamp only affects the dates in our diffs,
00556            and therefore should be on the server, not the client.  */
00557         (void) utime (tmpfile1, &t);
00558     }
00559     else if (toptwo_diffs)
00560     {
00561     ret = 1;
00562     goto out;
00563     }
00564     if (vers_head != NULL)
00565     {
00566     retcode = RCS_checkout (rcsfile, (char *) NULL, vers_head,
00567                 rev2, options, tmpfile2,
00568                 (RCSCHECKOUTPROC) NULL, (void *) NULL);
00569     if (retcode != 0)
00570     {
00571         error (0, 0,
00572            "cannot check out revision %s of %s", vers_head, rcs);
00573         ret = 1;
00574         goto out;
00575     }
00576     if ((t.actime = t.modtime = RCS_getrevtime (rcsfile, vers_head,
00577                             (char *) 0, 0)) != -1)
00578         /* I believe this timestamp only affects the dates in our diffs,
00579            and therefore should be on the server, not the client.  */
00580         (void) utime (tmpfile2, &t);
00581     }
00582
00583     switch (diff_exec (tmpfile1, tmpfile2, unidiff ? "-u" : "-c", tmpfile3))
00584     {
00585     case -1:            /* fork/wait failure */
00586         error (1, errno, "fork for diff failed on %s", rcs);
00587         break;
00588     case 0:             /* nothing to do */
00589         break;
00590     case 1:
00591         /*
00592          * The two revisions are really different, so read the first two
00593          * lines of the diff output file, and munge them to include more
00594          * reasonable file names that "patch" will understand.
00595          */
00596
00597         /* Output an "Index:" line for patch to use */
00598         cvs_output ("Index: ", 0);
00599         cvs_output (finfo->fullname, 0);
00600         cvs_output ("\n", 1);
00601
00602         fp = open_file (tmpfile3, "r");
00603         if (getline (&line1, &line1_chars_allocated, fp) < 0 ||
00604         getline (&line2, &line2_chars_allocated, fp) < 0)
00605         {
00606         if (feof (fp))
00607             error (0, 0, "\
00608 failed to read diff file header %s for %s: end of file", tmpfile3, rcs);
00609         else
00610             error (0, errno,
00611                "failed to read diff file header %s for %s",
00612                tmpfile3, rcs);
00613         ret = 1;
00614         if (fclose (fp) < 0)
00615             error (0, errno, "error closing %s", tmpfile3);
00616         goto out;
00617         }
00618         if (!unidiff)
00619         {
00620         if (strncmp (line1, "*** ", 4) != 0 ||
00621             strncmp (line2, "--- ", 4) != 0 ||
00622             (cp1 = strchr (line1, '\t')) == NULL ||
00623             (cp2 = strchr (line2, '\t')) == NULL)
00624         {
00625             error (0, 0, "invalid diff header for %s", rcs);
00626             ret = 1;
00627             if (fclose (fp) < 0)
00628             error (0, errno, "error closing %s", tmpfile3);
00629             goto out;
00630         }
00631         }
00632         else
00633         {
00634         if (strncmp (line1, "--- ", 4) != 0 ||
00635             strncmp (line2, "+++ ", 4) != 0 ||
00636             (cp1 = strchr (line1, '\t')) == NULL ||
00637             (cp2 = strchr  (line2, '\t')) == NULL)
00638         {
00639             error (0, 0, "invalid unidiff header for %s", rcs);
00640             ret = 1;
00641             if (fclose (fp) < 0)
00642             error (0, errno, "error closing %s", tmpfile3);
00643             goto out;
00644         }
00645         }
00646         if (CVSroot_directory != NULL)
00647         {
00648         strippath = xmalloc (strlen (CVSroot_directory) + 10);
00649         (void) sprintf (strippath, "%s/", CVSroot_directory);
00650         }
00651         else
00652         strippath = xstrdup (REPOS_STRIP);
00653         if (strncmp (rcs, strippath, strlen (strippath)) == 0)
00654         rcs += strlen (strippath);
00655         free (strippath);
00656         if (vers_tag != NULL)
00657         {
00658         file1 = xmalloc (strlen (finfo->fullname)
00659                  + strlen (vers_tag)
00660                  + 10);
00661         (void) sprintf (file1, "%s:%s", finfo->fullname, vers_tag);
00662         }
00663         else
00664         {
00665         file1 = xstrdup (DEVNULL);
00666         }
00667         file2 = xmalloc (strlen (finfo->fullname)
00668                  + (vers_head != NULL ? strlen (vers_head) : 10)
00669                  + 10);
00670         (void) sprintf (file2, "%s:%s", finfo->fullname,
00671                 vers_head ? vers_head : "removed");
00672
00673         /* Note that the string "diff" is specified by POSIX (for -c)
00674            and is part of the diff output format, not the name of a
00675            program.  */
00676         if (unidiff)
00677         {
00678         cvs_output ("diff -u ", 0);
00679         cvs_output (file1, 0);
00680         cvs_output (" ", 1);
00681         cvs_output (file2, 0);
00682         cvs_output ("\n", 1);
00683
00684         cvs_output ("--- ", 0);
00685         cvs_output (file1, 0);
00686         cvs_output (cp1, 0);
00687         cvs_output ("+++ ", 0);
00688         }
00689         else
00690         {
00691         cvs_output ("diff -c ", 0);
00692         cvs_output (file1, 0);
00693         cvs_output (" ", 1);
00694         cvs_output (file2, 0);
00695         cvs_output ("\n", 1);
00696
00697         cvs_output ("*** ", 0);
00698         cvs_output (file1, 0);
00699         cvs_output (cp1, 0);
00700         cvs_output ("--- ", 0);
00701         }
00702
00703         cvs_output (finfo->fullname, 0);
00704         cvs_output (cp2, 0);
00705
00706         /* spew the rest of the diff out */
00707         while ((line_length
00708             = getline (&line1, &line1_chars_allocated, fp))
00709            >= 0)
00710         cvs_output (line1, 0);
00711         if (line_length < 0 && !feof (fp))
00712         error (0, errno, "cannot read %s", tmpfile3);
00713
00714         if (fclose (fp) < 0)
00715         error (0, errno, "cannot close %s", tmpfile3);
00716         free (file1);
00717         free (file2);
00718         break;
00719     default:
00720         error (0, 0, "diff failed for %s", finfo->fullname);
00721     }
00722   out:
00723     if (line1)
00724         free (line1);
00725     if (line2)
00726         free (line2);
00727     if (CVS_UNLINK (tmpfile1) < 0)
00728     error (0, errno, "cannot unlink %s", tmpfile1);
00729     if (CVS_UNLINK (tmpfile2) < 0)
00730     error (0, errno, "cannot unlink %s", tmpfile2);
00731     if (CVS_UNLINK (tmpfile3) < 0)
00732     error (0, errno, "cannot unlink %s", tmpfile3);
00733     free (tmpfile1);
00734     free (tmpfile2);
00735     free (tmpfile3);
00736     tmpfile1 = tmpfile2 = tmpfile3 = NULL;
00737
00738  out2:
00739     if (vers_tag != NULL)
00740     free (vers_tag);
00741     if (vers_head != NULL)
00742     free (vers_head);
00743     if (rcs != NULL)
00744     free (rcs);
00745     return (ret);
00746 }
00747
00748 /*
00749  * Print a warm fuzzy message
00750  */
00751 /* ARGSUSED */
00752 static Dtype
00753 patch_dirproc (callerdat, dir, repos, update_dir, entries)
00754     void *callerdat;
00755     char *dir;
00756     char *repos;
00757     char *update_dir;
00758     List *entries;
00759 {
00760     if (!quiet)
00761     error (0, 0, "Diffing %s", update_dir);
00762     return (R_PROCESS);
00763 }
00764
00765 /*
00766  * Clean up temporary files
00767  */
00768 static RETSIGTYPE
00769 patch_cleanup ()
00770 {
00771     /* Note that the checks for existence_error are because we are
00772        called from a signal handler, without SIG_begincrsect, so
00773        we don't know whether the files got created.  */
00774
00775     if (tmpfile1 != NULL)
00776     {
00777     if (unlink_file (tmpfile1) < 0
00778         && !existence_error (errno))
00779         error (0, errno, "cannot remove %s", tmpfile1);
00780     free (tmpfile1);
00781     }
00782     if (tmpfile2 != NULL)
00783     {
00784     if (unlink_file (tmpfile2) < 0
00785         && !existence_error (errno))
00786         error (0, errno, "cannot remove %s", tmpfile2);
00787     free (tmpfile2);
00788     }
00789     if (tmpfile3 != NULL)
00790     {
00791     if (unlink_file (tmpfile3) < 0
00792         && !existence_error (errno))
00793         error (0, errno, "cannot remove %s", tmpfile3);
00794     free (tmpfile3);
00795     }
00796     tmpfile1 = tmpfile2 = tmpfile3 = NULL;
00797 }
Generated on Sun Oct 21 12:41:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/rcs.c Source File

cvs-1.10/src/rcs.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  *
00004  * You may distribute under the terms of the GNU General Public License as
00005  * specified in the README file that comes with the CVS source distribution.
00006  *
00007  * The routines contained in this file do all the rcs file parsing and
00008  * manipulation
00009  */
00010
00011 #include <assert.h>
00012 #include "cvs.h"
00013 #include "edit.h"
00014 #include "hardlink.h"
00015
00016 int preserve_perms = 0;
00017
00018 /* The RCS -k options, and a set of enums that must match the array.
00019    These come first so that we can use enum kflag in function
00020    prototypes.  */
00021 static const char *const kflags[] =
00022   {"kv", "kvl", "k", "v", "o", "b", (char *) NULL};
00023 enum kflag { KFLAG_KV = 0, KFLAG_KVL, KFLAG_K, KFLAG_V, KFLAG_O, KFLAG_B };
00024
00025 /* A structure we use to buffer the contents of an RCS file.  The
00026    various fields are only referenced directly by the rcsbuf_*
00027    functions.  We declare the struct here so that we can allocate it
00028    on the stack, rather than in memory.  */
00029
00030 struct rcsbuffer
00031 {
00032     /* Points to the current position in the buffer.  */
00033     char *ptr;
00034     /* Points just after the last valid character in the buffer.  */
00035     char *ptrend;
00036     /* The file.  */
00037     FILE *fp;
00038     /* The name of the file, used for error messages.  */
00039     const char *filename;
00040     /* The starting file position of the data in the buffer.  */
00041     unsigned long pos;
00042     /* The length of the value.  */
00043     size_t vlen;
00044     /* Whether the value contains an '@' string.  If so, we can not
00045        compress whitespace characters.  */
00046     int at_string;
00047     /* The number of embedded '@' characters in an '@' string.  If
00048        this is non-zero, we must search the string for pairs of '@'
00049        and convert them to a single '@'.  */
00050     int embedded_at;
00051 };
00052
00053 static RCSNode *RCS_parsercsfile_i PROTO((FILE * fp, const char *rcsfile));
00054 static char *RCS_getdatebranch PROTO((RCSNode * rcs, char *date, char *branch));
00055 static void rcsbuf_open PROTO ((struct rcsbuffer *, FILE *fp,
00056                 const char *filename, unsigned long pos));
00057 static void rcsbuf_close PROTO ((struct rcsbuffer *));
00058 static int rcsbuf_getkey PROTO ((struct rcsbuffer *, char **keyp,
00059                  char **valp));
00060 static int rcsbuf_getrevnum PROTO ((struct rcsbuffer *, char **revp));
00061 static char *rcsbuf_fill PROTO ((struct rcsbuffer *, char *ptr, char **keyp,
00062                  char **valp));
00063 static int rcsbuf_valcmp PROTO ((struct rcsbuffer *));
00064 static char *rcsbuf_valcopy PROTO ((struct rcsbuffer *, char *val, int polish,
00065                     size_t *lenp));
00066 static void rcsbuf_valpolish PROTO ((struct rcsbuffer *, char *val, int polish,
00067                      size_t *lenp));
00068 static void rcsbuf_valpolish_internal PROTO ((struct rcsbuffer *, char *to,
00069                           const char *from, size_t *lenp));
00070 static unsigned long rcsbuf_ftell PROTO ((struct rcsbuffer *));
00071 static void rcsbuf_get_buffered PROTO ((struct rcsbuffer *, char **datap,
00072                     size_t *lenp));
00073 static void rcsbuf_cache PROTO ((RCSNode *, struct rcsbuffer *));
00074 static void rcsbuf_cache_close PROTO ((void));
00075 static void rcsbuf_cache_open PROTO ((RCSNode *, long, FILE **,
00076                       struct rcsbuffer *));
00077 static int checkmagic_proc PROTO((Node *p, void *closure));
00078 static void do_branches PROTO((List * list, char *val));
00079 static void do_symbols PROTO((List * list, char *val));
00080 static void do_locks PROTO((List * list, char *val));
00081 static void free_rcsnode_contents PROTO((RCSNode *));
00082 static void free_rcsvers_contents PROTO((RCSVers *));
00083 static void rcsvers_delproc PROTO((Node * p));
00084 static char *translate_symtag PROTO((RCSNode *, const char *));
00085 static char *RCS_addbranch PROTO ((RCSNode *, const char *));
00086 static char *truncate_revnum_in_place PROTO ((char *));
00087 static char *truncate_revnum PROTO ((const char *));
00088 static char *printable_date PROTO((const char *));
00089 static char *escape_keyword_value PROTO ((const char *, int *));
00090 static void expand_keywords PROTO((RCSNode *, RCSVers *, const char *,
00091                    const char *, size_t, enum kflag, char *,
00092                    size_t, char **, size_t *));
00093 static void cmp_file_buffer PROTO((void *, const char *, size_t));
00094
00095 enum rcs_delta_op {RCS_ANNOTATE, RCS_FETCH};
00096 static void RCS_deltas PROTO ((RCSNode *, FILE *, struct rcsbuffer *, char *,
00097                    enum rcs_delta_op, char **, size_t *,
00098                    char **, size_t *));
00099
00100 /* Routines for reading, parsing and writing RCS files. */
00101 static RCSVers *getdelta PROTO ((struct rcsbuffer *, char *, char **,
00102                  char **));
00103 static Deltatext *RCS_getdeltatext PROTO ((RCSNode *, FILE *,
00104                        struct rcsbuffer *));
00105 static void freedeltatext PROTO ((Deltatext *));
00106
00107 static void RCS_putadmin PROTO ((RCSNode *, FILE *));
00108 static void RCS_putdtree PROTO ((RCSNode *, char *, FILE *));
00109 static void RCS_putdesc PROTO ((RCSNode *, FILE *));
00110 static void putdelta PROTO ((RCSVers *, FILE *));
00111 static int putrcsfield_proc PROTO ((Node *, void *));
00112 static int putsymbol_proc PROTO ((Node *, void *));
00113 static void RCS_copydeltas PROTO ((RCSNode *, FILE *, struct rcsbuffer *,
00114                    FILE *, Deltatext *, char *));
00115 static int count_delta_actions PROTO ((Node *, void *));
00116 static void putdeltatext PROTO ((FILE *, Deltatext *));
00117
00118 static FILE *rcs_internal_lockfile PROTO ((char *));
00119 static void rcs_internal_unlockfile PROTO ((FILE *, char *));
00120 static char *rcs_lockfilename PROTO ((char *));
00121
00122 /* The RCS file reading functions are called a lot, and they do some
00123    string comparisons.  This macro speeds things up a bit by skipping
00124    the function call when the first characters are different.  It
00125    evaluates its arguments multiple times.  */
00126 #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp ((a), (b)) == 0)
00127
00128 /*
00129  * We don't want to use isspace() from the C library because:
00130  *
00131  * 1. The definition of "whitespace" in RCS files includes ASCII
00132  *    backspace, but the C locale doesn't.
00133  * 2. isspace is an very expensive function call in some implementations
00134  *    due to the addition of wide character support.
00135  */
00136 static const char spacetab[] = {
00137         0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, /* 0x00 - 0x0f */
00138         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1f */
00139         1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 - 0x2f */
00140         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x30 - 0x3f */
00141         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 - 0x4f */
00142         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 - 0x5f */
00143         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x8f */
00144         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x7f */
00145         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8f */
00146         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9f */
00147         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0 - 0xaf */
00148         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xb0 - 0xbf */
00149         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xc0 - 0xcf */
00150         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xd0 - 0xdf */
00151         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xe0 - 0xef */
00152         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  /* 0xf0 - 0xff */
00153 };
00154
00155 #define whitespace(c)   (spacetab[(unsigned char)c] != 0)
00156
00157 static char *rcs_lockfile;
00158 static int rcs_lockfd = -1;
00159
00160 /* A few generic thoughts on error handling, in particular the
00161    printing of unexpected characters that we find in the RCS file
00162    (that is, why we use '\x%x' rather than %c or some such).
00163
00164    * Avoiding %c means we don't have to worry about what is printable
00165    and other such stuff.  In error handling, often better to keep it
00166    simple.
00167
00168    * Hex rather than decimal or octal because character set standards
00169    tend to use hex.
00170
00171    * Saying "character 0x%x" might make it sound like we are printing
00172    a file offset.  So we use '\x%x'.
00173
00174    * Would be nice to print the offset within the file, but I can
00175    imagine various portability hassles (in particular, whether
00176    unsigned long is always big enough to hold file offsets).  */
00177
00178 /* Parse an rcsfile given a user file name and a repository.  If there is
00179    an error, we print an error message and return NULL.  If the file
00180    does not exist, we return NULL without printing anything (I'm not
00181    sure this allows the caller to do anything reasonable, but it is
00182    the current behavior).  */
00183 RCSNode *
00184 RCS_parse (file, repos)
00185     const char *file;
00186     const char *repos;
00187 {
00188     RCSNode *rcs;
00189     FILE *fp;
00190     RCSNode *retval;
00191     char *rcsfile;
00192
00193     /* We're creating a new RCSNode, so there is no hope of finding it
00194        in the cache.  */
00195     rcsbuf_cache_close ();
00196
00197     rcsfile = xmalloc (strlen (repos) + strlen (file)
00198                + sizeof (RCSEXT) + sizeof (CVSATTIC) + 10);
00199     (void) sprintf (rcsfile, "%s/%s%s", repos, file, RCSEXT);
00200     if ((fp = CVS_FOPEN (rcsfile, FOPEN_BINARY_READ)) != NULL)
00201     {
00202         rcs = RCS_parsercsfile_i(fp, rcsfile);
00203     if (rcs != NULL)
00204         rcs->flags |= VALID;
00205
00206     retval = rcs;
00207     goto out;
00208     }
00209     else if (! existence_error (errno))
00210     {
00211     error (0, errno, "cannot open %s", rcsfile);
00212     retval = NULL;
00213     goto out;
00214     }
00215
00216     (void) sprintf (rcsfile, "%s/%s/%s%s", repos, CVSATTIC, file, RCSEXT);
00217     if ((fp = CVS_FOPEN (rcsfile, FOPEN_BINARY_READ)) != NULL)
00218     {
00219         rcs = RCS_parsercsfile_i(fp, rcsfile);
00220     if (rcs != NULL)
00221     {
00222         rcs->flags |= INATTIC;
00223         rcs->flags |= VALID;
00224     }
00225
00226     retval = rcs;
00227     goto out;
00228     }
00229     else if (! existence_error (errno))
00230     {
00231     error (0, errno, "cannot open %s", rcsfile);
00232     retval = NULL;
00233     goto out;
00234     }
00235 #if defined (SERVER_SUPPORT) && !defined (FILENAMES_CASE_INSENSITIVE)
00236     else if (ign_case)
00237     {
00238     int status;
00239     char *found_path;
00240
00241     /* The client might be asking for a file which we do have
00242        (which the client doesn't know about), but for which the
00243        filename case differs.  We only consider this case if the
00244        regular CVS_FOPENs fail, because fopen_case is such an
00245        expensive call.  */
00246     (void) sprintf (rcsfile, "%s/%s%s", repos, file, RCSEXT);
00247     status = fopen_case (rcsfile, "rb", &fp, &found_path);
00248     if (status == 0)
00249     {
00250         rcs = RCS_parsercsfile_i (fp, rcsfile);
00251         if (rcs != NULL)
00252         rcs->flags |= VALID;
00253
00254         free (rcs->path);
00255         rcs->path = found_path;
00256         retval = rcs;
00257         goto out;
00258     }
00259     else if (! existence_error (status))
00260     {
00261         error (0, status, "cannot open %s", rcsfile);
00262         retval = NULL;
00263         goto out;
00264     }
00265
00266     (void) sprintf (rcsfile, "%s/%s/%s%s", repos, CVSATTIC, file, RCSEXT);
00267     status = fopen_case (rcsfile, "rb", &fp, &found_path);
00268     if (status == 0)
00269     {
00270         rcs = RCS_parsercsfile_i (fp, rcsfile);
00271         if (rcs != NULL)
00272         {
00273         rcs->flags |= INATTIC;
00274         rcs->flags |= VALID;
00275         }
00276
00277         free (rcs->path);
00278         rcs->path = found_path;
00279         retval = rcs;
00280         goto out;
00281     }
00282     else if (! existence_error (status))
00283     {
00284         error (0, status, "cannot open %s", rcsfile);
00285         retval = NULL;
00286         goto out;
00287     }
00288     }
00289 #endif
00290     retval = NULL;
00291
00292  out:
00293     free (rcsfile);
00294
00295     return retval;
00296 }
00297
00298 /*
00299  * Parse a specific rcsfile.
00300  */
00301 RCSNode *
00302 RCS_parsercsfile (rcsfile)
00303     char *rcsfile;
00304 {
00305     FILE *fp;
00306     RCSNode *rcs;
00307
00308     /* We're creating a new RCSNode, so there is no hope of finding it
00309        in the cache.  */
00310     rcsbuf_cache_close ();
00311
00312     /* open the rcsfile */
00313     if ((fp = CVS_FOPEN (rcsfile, FOPEN_BINARY_READ)) == NULL)
00314     {
00315     error (0, errno, "Couldn't open rcs file `%s'", rcsfile);
00316     return (NULL);
00317     }
00318
00319     rcs = RCS_parsercsfile_i (fp, rcsfile);
00320
00321     return (rcs);
00322 }
00323
00324
00325 /*
00326  */
00327 static RCSNode *
00328 RCS_parsercsfile_i (fp, rcsfile)
00329     FILE *fp;
00330     const char *rcsfile;
00331 {
00332     RCSNode *rdata;
00333     struct rcsbuffer rcsbuf;
00334     char *key, *value;
00335
00336     /* make a node */
00337     rdata = (RCSNode *) xmalloc (sizeof (RCSNode));
00338     memset ((char *) rdata, 0, sizeof (RCSNode));
00339     rdata->refcount = 1;
00340     rdata->path = xstrdup (rcsfile);
00341
00342     /* Process HEAD, BRANCH, and EXPAND keywords from the RCS header.
00343
00344        Most cvs operations on the main branch don't need any more
00345        information.  Those that do call RCS_reparsercsfile to parse
00346        the rest of the header and the deltas.  */
00347
00348     rcsbuf_open (&rcsbuf, fp, rcsfile, 0);
00349
00350     if (! rcsbuf_getkey (&rcsbuf, &key, &value))
00351     goto l_error;
00352     if (STREQ (key, RCSDESC))
00353     goto l_error;
00354
00355     if (STREQ (RCSHEAD, key) && value != NULL)
00356     rdata->head = rcsbuf_valcopy (&rcsbuf, value, 0, (size_t *) NULL);
00357
00358     if (! rcsbuf_getkey (&rcsbuf, &key, &value))
00359     goto l_error;
00360     if (STREQ (key, RCSDESC))
00361     goto l_error;
00362
00363     if (STREQ (RCSBRANCH, key) && value != NULL)
00364     {
00365     char *cp;
00366
00367     rdata->branch = rcsbuf_valcopy (&rcsbuf, value, 0, (size_t *) NULL);
00368     if ((numdots (rdata->branch) & 1) != 0)
00369     {
00370         /* turn it into a branch if it's a revision */
00371         cp = strrchr (rdata->branch, '.');
00372         *cp = '\0';
00373     }
00374     }
00375
00376     /* Look ahead for expand, stopping when we see desc or a revision
00377        number.  */
00378     while (1)
00379     {
00380     char *cp;
00381
00382     if (STREQ (RCSEXPAND, key))
00383     {
00384         rdata->expand = rcsbuf_valcopy (&rcsbuf, value, 0,
00385                         (size_t *) NULL);
00386         break;
00387     }
00388
00389     for (cp = key;
00390          (isdigit ((unsigned char) *cp) || *cp == '.') && *cp != '\0';
00391          cp++)
00392         /* do nothing */ ;
00393     if (*cp == '\0')
00394         break;
00395
00396     if (STREQ (RCSDESC, key))
00397         break;
00398
00399     if (! rcsbuf_getkey (&rcsbuf, &key, &value))
00400         break;
00401     }
00402
00403     rdata->flags |= PARTIAL;
00404
00405     rcsbuf_cache (rdata, &rcsbuf);
00406
00407     return rdata;
00408
00409 l_error:
00410     error (0, 0, "`%s' does not appear to be a valid rcs file",
00411        rcsfile);
00412     rcsbuf_close (&rcsbuf);
00413     freercsnode (&rdata);
00414     fclose (fp);
00415     return (NULL);
00416 }
00417
00418
00419 /* Do the real work of parsing an RCS file.
00420
00421    On error, die with a fatal error; if it returns at all it was successful.
00422
00423    If PFP is NULL, close the file when done.  Otherwise, leave it open
00424    and store the FILE * in *PFP.  */
00425 void
00426 RCS_reparsercsfile (rdata, pfp, rcsbufp)
00427     RCSNode *rdata;
00428     FILE **pfp;
00429     struct rcsbuffer *rcsbufp;
00430 {
00431     FILE *fp;
00432     char *rcsfile;
00433     struct rcsbuffer rcsbuf;
00434     Node *q, *kv;
00435     RCSVers *vnode;
00436     int gotkey;
00437     char *cp;
00438     char *key, *value;
00439
00440     assert (rdata != NULL);
00441     rcsfile = rdata->path;
00442
00443     rcsbuf_cache_open (rdata, 0, &fp, &rcsbuf);
00444
00445     /* make a node */
00446     /* This probably shouldn't be done until later: if a file has an
00447        empty revision tree (which is permissible), rdata->versions
00448        should be NULL. -twp */
00449     rdata->versions = getlist ();
00450
00451     /*
00452      * process all the special header information, break out when we get to
00453      * the first revision delta
00454      */
00455     gotkey = 0;
00456     for (;;)
00457     {
00458     /* get the next key/value pair */
00459     if (!gotkey)
00460     {
00461         if (! rcsbuf_getkey (&rcsbuf, &key, &value))
00462         {
00463         error (1, 0, "`%s' does not appear to be a valid rcs file",
00464                rcsfile);
00465         }
00466     }
00467
00468     gotkey = 0;
00469
00470     /* Skip head, branch and expand tags; we already have them. */
00471     if (STREQ (key, RCSHEAD)
00472         || STREQ (key, RCSBRANCH)
00473         || STREQ (key, RCSEXPAND))
00474     {
00475         continue;
00476     }
00477
00478     if (STREQ (key, "access"))
00479     {
00480         if (value != NULL)
00481         {
00482         /* We pass the POLISH parameter as 1 because
00483                    RCS_addaccess expects nothing but spaces.  FIXME:
00484                    It would be easy and more efficient to change
00485                    RCS_addaccess.  */
00486         rdata->access = rcsbuf_valcopy (&rcsbuf, value, 1,
00487                         (size_t *) NULL);
00488         }
00489         continue;
00490     }
00491
00492     /* We always save lock information, so that we can handle
00493            -kkvl correctly when checking out a file. */
00494     if (STREQ (key, "locks"))
00495     {
00496         if (value != NULL)
00497         rdata->locks_data = rcsbuf_valcopy (&rcsbuf, value, 0,
00498                             (size_t *) NULL);
00499         if (! rcsbuf_getkey (&rcsbuf, &key, &value))
00500         {
00501         error (1, 0, "premature end of file reading %s", rcsfile);
00502         }
00503         if (STREQ (key, "strict") && value == NULL)
00504         {
00505         rdata->strict_locks = 1;
00506         }
00507         else
00508         gotkey = 1;
00509         continue;
00510     }
00511
00512     if (STREQ (RCSSYMBOLS, key))
00513     {
00514         if (value != NULL)
00515         rdata->symbols_data = rcsbuf_valcopy (&rcsbuf, value, 0,
00516                               (size_t *) NULL);
00517         continue;
00518     }
00519
00520     /*
00521      * check key for '.''s and digits (probably a rev) if it is a
00522      * revision or `desc', we are done with the headers and are down to the
00523      * revision deltas, so we break out of the loop
00524      */
00525     for (cp = key;
00526          (isdigit ((unsigned char) *cp) || *cp == '.') && *cp != '\0';
00527          cp++)
00528          /* do nothing */ ;
00529     /* Note that when comparing with RCSDATE, we are not massaging
00530            VALUE from the string found in the RCS file.  This is OK
00531            since we know exactly what to expect.  */
00532     if (*cp == '\0' && strncmp (RCSDATE, value, (sizeof RCSDATE) - 1) == 0)
00533         break;
00534
00535     if (STREQ (key, RCSDESC))
00536         break;
00537
00538     if (STREQ (key, "comment"))
00539     {
00540         rdata->comment = rcsbuf_valcopy (&rcsbuf, value, 0,
00541                          (size_t *) NULL);
00542         continue;
00543     }
00544     if (rdata->other == NULL)
00545         rdata->other = getlist ();
00546     kv = getnode ();
00547     kv->type = rcsbuf_valcmp (&rcsbuf) ? RCSCMPFLD : RCSFIELD;
00548     kv->key = xstrdup (key);
00549     kv->data = rcsbuf_valcopy (&rcsbuf, value, kv->type == RCSFIELD,
00550                    (size_t *) NULL);
00551     if (addnode (rdata->other, kv) != 0)
00552     {
00553         error (0, 0, "warning: duplicate key `%s' in RCS file `%s'",
00554            key, rcsfile);
00555         freenode (kv);
00556     }
00557
00558     /* if we haven't grabbed it yet, we didn't want it */
00559     }
00560
00561     /* We got out of the loop, so we have the first part of the first
00562        revision delta in KEY (the revision) and VALUE (the date key
00563        and its value).  This is what getdelta expects to receive.  */
00564
00565     while ((vnode = getdelta (&rcsbuf, rcsfile, &key, &value)) != NULL)
00566     {
00567     /* get the node */
00568     q = getnode ();
00569     q->type = RCSVERS;
00570     q->delproc = rcsvers_delproc;
00571     q->data = (char *) vnode;
00572     q->key = vnode->version;
00573
00574     /* add the nodes to the list */
00575     if (addnode (rdata->versions, q) != 0)
00576     {
00577 #if 0
00578         purify_printf("WARNING: Adding duplicate version: %s (%s)\n",
00579              q->key, rcsfile);
00580         freenode (q);
00581 #endif
00582     }
00583     }
00584
00585     /* Here KEY and VALUE are whatever caused getdelta to return NULL.  */
00586
00587     if (STREQ (key, RCSDESC))
00588     {
00589     if (rdata->desc != NULL)
00590     {
00591         error (0, 0,
00592            "warning: duplicate key `%s' in RCS file `%s'",
00593            key, rcsfile);
00594         free (rdata->desc);
00595     }
00596     rdata->desc = rcsbuf_valcopy (&rcsbuf, value, 1, (size_t *) NULL);
00597     }
00598
00599     rdata->delta_pos = rcsbuf_ftell (&rcsbuf);
00600
00601     if (pfp == NULL)
00602     rcsbuf_cache (rdata, &rcsbuf);
00603     else
00604     {
00605     *pfp = fp;
00606     *rcsbufp = rcsbuf;
00607     }
00608     rdata->flags &= ~PARTIAL;
00609 }
00610
00611 /* Move RCS into or out of the Attic, depending on TOATTIC.  If the
00612    file is already in the desired place, return without doing
00613    anything.  At some point may want to think about how this relates
00614    to RCS_rewrite but that is a bit hairy (if one wants renames to be
00615    atomic, or that kind of thing).  If there is an error, print a message
00616    and return 1.  On success, return 0.  */
00617 int
00618 RCS_setattic (rcs, toattic)
00619     RCSNode *rcs;
00620     int toattic;
00621 {
00622     char *newpath;
00623     char *p;
00624     char *q;
00625
00626     /* Some systems aren't going to let us rename an open file.  */
00627     rcsbuf_cache_close ();
00628
00629     /* Could make the pathname computations in this file, and probably
00630        in other parts of rcs.c too, easier if the REPOS and FILE
00631        arguments to RCS_parse got stashed in the RCSNode.  */
00632
00633     if (toattic)
00634     {
00635     mode_t omask;
00636
00637     if (rcs->flags & INATTIC)
00638         return 0;
00639
00640     /* Example: rcs->path is "/foo/bar/baz,v".  */
00641     newpath = xmalloc (strlen (rcs->path) + sizeof CVSATTIC + 5);
00642     p = last_component (rcs->path);
00643     strncpy (newpath, rcs->path, p - rcs->path);
00644     strcpy (newpath + (p - rcs->path), CVSATTIC);
00645
00646     /* Create the Attic directory if it doesn't exist.  */
00647     omask = umask (cvsumask);
00648     if (CVS_MKDIR (newpath, 0777) < 0 && errno != EEXIST)
00649         error (0, errno, "cannot make directory %s", newpath);
00650     (void) umask (omask);
00651
00652     strcat (newpath, "/");
00653     strcat (newpath, p);
00654
00655     if (CVS_RENAME (rcs->path, newpath) < 0)
00656     {
00657         int save_errno = errno;
00658
00659         /* The checks for isreadable look awfully fishy, but
00660            I'm going to leave them here for now until I
00661            can think harder about whether they take care of
00662            some cases which should be handled somehow.  */
00663
00664         if (isreadable (rcs->path) || !isreadable (newpath))
00665         {
00666         error (0, save_errno, "cannot rename %s to %s",
00667                rcs->path, newpath);
00668         free (newpath);
00669         return 1;
00670         }
00671     }
00672     }
00673     else
00674     {
00675     if (!(rcs->flags & INATTIC))
00676         return 0;
00677
00678     newpath = xmalloc (strlen (rcs->path));
00679
00680     /* Example: rcs->path is "/foo/bar/Attic/baz,v".  */
00681     p = last_component (rcs->path);
00682     strncpy (newpath, rcs->path, p - rcs->path - 1);
00683     newpath[p - rcs->path - 1] = '\0';
00684     q = newpath + (p - rcs->path - 1) - (sizeof CVSATTIC - 1);
00685     assert (strncmp (q, CVSATTIC, sizeof CVSATTIC - 1) == 0);
00686     strcpy (q, p);
00687
00688     if (CVS_RENAME (rcs->path, newpath) < 0)
00689     {
00690         error (0, errno, "failed to move `%s' out of the attic",
00691            rcs->path);
00692         free (newpath);
00693         return 1;
00694     }
00695     }
00696
00697     free (rcs->path);
00698     rcs->path = newpath;
00699
00700     return 0;
00701 }
00702
00703 /*
00704  * Fully parse the RCS file.  Store all keyword/value pairs, fetch the
00705  * log messages for each revision, and fetch add and delete counts for
00706  * each revision (we could fetch the entire text for each revision,
00707  * but the only caller, log_fileproc, doesn't need that information,
00708  * so we don't waste the memory required to store it).  The add and
00709  * delete counts are stored on the OTHER field of the RCSVERSNODE
00710  * structure, under the names ";add" and ";delete", so that we don't
00711  * waste the memory space of extra fields in RCSVERSNODE for code
00712  * which doesn't need this information.
00713  */
00714
00715 void
00716 RCS_fully_parse (rcs)
00717     RCSNode *rcs;
00718 {
00719     FILE *fp;
00720     struct rcsbuffer rcsbuf;
00721
00722     RCS_reparsercsfile (rcs, &fp, &rcsbuf);
00723
00724     while (1)
00725     {
00726     char *key, *value;
00727     Node *vers;
00728     RCSVers *vnode;
00729
00730     /* Rather than try to keep track of how much information we
00731            have read, just read to the end of the file.  */
00732     if (! rcsbuf_getrevnum (&rcsbuf, &key))
00733         break;
00734
00735     vers = findnode (rcs->versions, key);
00736     if (vers == NULL)
00737         error (1, 0,
00738            "mismatch in rcs file %s between deltas and deltatexts",
00739            rcs->path);
00740
00741     vnode = (RCSVers *) vers->data;
00742
00743     while (rcsbuf_getkey (&rcsbuf, &key, &value))
00744     {
00745         if (! STREQ (key, "text"))
00746         {
00747         Node *kv;
00748
00749         if (vnode->other == NULL)
00750             vnode->other = getlist ();
00751         kv = getnode ();
00752         kv->type = rcsbuf_valcmp (&rcsbuf) ? RCSCMPFLD : RCSFIELD;
00753         kv->key = xstrdup (key);
00754         kv->data = rcsbuf_valcopy (&rcsbuf, value, kv->type == RCSFIELD,
00755                        (size_t *) NULL);
00756         if (addnode (vnode->other, kv) != 0)
00757         {
00758             error (0, 0,
00759                "\
00760 warning: duplicate key `%s' in version `%s' of RCS file `%s'",
00761                key, vnode->version, rcs->path);
00762             freenode (kv);
00763         }
00764
00765         continue;
00766         }
00767
00768         if (! STREQ (vnode->version, rcs->head))
00769         {
00770         unsigned long add, del;
00771         char buf[50];
00772         Node *kv;
00773
00774         /* This is a change text.  Store the add and delete
00775                    counts.  */
00776         add = 0;
00777         del = 0;
00778         if (value != NULL)
00779         {
00780             size_t vallen;
00781             const char *cp;
00782
00783             rcsbuf_valpolish (&rcsbuf, value, 0, &vallen);
00784             cp = value;
00785             while (cp < value + vallen)
00786             {
00787             char op;
00788             unsigned long count;
00789
00790             op = *cp++;
00791             if (op != 'a' && op  != 'd')
00792                 error (1, 0, "\
00793 unrecognized operation '\\x%x' in %s",
00794                    op, rcs->path);
00795             (void) strtoul (cp, (char **) &cp, 10);
00796             if (*cp++ != ' ')
00797                 error (1, 0, "space expected in %s",
00798                    rcs->path);
00799             count = strtoul (cp, (char **) &cp, 10);
00800             if (*cp++ != '\012')
00801                 error (1, 0, "linefeed expected in %s",
00802                    rcs->path);
00803
00804             if (op == 'd')
00805                 del += count;
00806             else
00807             {
00808                 add += count;
00809                 while (count != 0)
00810                 {
00811                 if (*cp == '\012')
00812                     --count;
00813                 else if (cp == value + vallen)
00814                 {
00815                     if (count != 1)
00816                     error (1, 0, "\
00817 invalid rcs file %s: premature end of value",
00818                            rcs->path);
00819                     else
00820                     break;
00821                 }
00822                 ++cp;
00823                 }
00824             }
00825             }
00826         }
00827
00828         sprintf (buf, "%lu", add);
00829         kv = getnode ();
00830         kv->type = RCSFIELD;
00831         kv->key = xstrdup (";add");
00832         kv->data = xstrdup (buf);
00833         if (addnode (vnode->other, kv) != 0)
00834         {
00835             error (0, 0,
00836                "\
00837 warning: duplicate key `%s' in version `%s' of RCS file `%s'",
00838                key, vnode->version, rcs->path);
00839             freenode (kv);
00840         }
00841
00842         sprintf (buf, "%lu", del);
00843         kv = getnode ();
00844         kv->type = RCSFIELD;
00845         kv->key = xstrdup (";delete");
00846         kv->data = xstrdup (buf);
00847         if (addnode (vnode->other, kv) != 0)
00848         {
00849             error (0, 0,
00850                "\
00851 warning: duplicate key `%s' in version `%s' of RCS file `%s'",
00852                key, vnode->version, rcs->path);
00853             freenode (kv);
00854         }
00855         }
00856
00857         /* We have found the "text" key which ends the data for
00858                this revision.  Break out of the loop and go on to the
00859                next revision.  */
00860         break;
00861     }
00862     }
00863
00864     rcsbuf_cache (rcs, &rcsbuf);
00865 }
00866
00867 /*
00868  * freercsnode - free up the info for an RCSNode
00869  */
00870 void
00871 freercsnode (rnodep)
00872     RCSNode **rnodep;
00873 {
00874     if (rnodep == NULL || *rnodep == NULL)
00875     return;
00876
00877     ((*rnodep)->refcount)--;
00878     if ((*rnodep)->refcount != 0)
00879     {
00880     *rnodep = (RCSNode *) NULL;
00881     return;
00882     }
00883     free ((*rnodep)->path);
00884     if ((*rnodep)->head != (char *) NULL)
00885     free ((*rnodep)->head);
00886     if ((*rnodep)->branch != (char *) NULL)
00887     free ((*rnodep)->branch);
00888     free_rcsnode_contents (*rnodep);
00889     free ((char *) *rnodep);
00890     *rnodep = (RCSNode *) NULL;
00891 }
00892
00893 /*
00894  * free_rcsnode_contents - free up the contents of an RCSNode without
00895  * freeing the node itself, or the file name, or the head, or the
00896  * path.  This returns the RCSNode to the state it is in immediately
00897  * after a call to RCS_parse.
00898  */
00899 static void
00900 free_rcsnode_contents (rnode)
00901     RCSNode *rnode;
00902 {
00903     dellist (&rnode->versions);
00904     if (rnode->symbols != (List *) NULL)
00905     dellist (&rnode->symbols);
00906     if (rnode->symbols_data != (char *) NULL)
00907     free (rnode->symbols_data);
00908     if (rnode->expand != NULL)
00909     free (rnode->expand);
00910     if (rnode->other != (List *) NULL)
00911     dellist (&rnode->other);
00912     if (rnode->access != NULL)
00913     free (rnode->access);
00914     if (rnode->locks_data != NULL)
00915     free (rnode->locks_data);
00916     if (rnode->locks != (List *) NULL)
00917     dellist (&rnode->locks);
00918     if (rnode->comment != NULL)
00919     free (rnode->comment);
00920     if (rnode->desc != NULL)
00921     free (rnode->desc);
00922 }
00923
00924 /* free_rcsvers_contents -- free up the contents of an RCSVers node,
00925    but also free the pointer to the node itself. */
00926 /* Note: The `hardlinks' list is *not* freed, since it is merely a
00927    pointer into the `hardlist' structure (defined in hardlink.c), and
00928    that structure is freed elsewhere in the program. */
00929
00930 static void
00931 free_rcsvers_contents (rnode)
00932     RCSVers *rnode;
00933 {
00934     if (rnode->branches != (List *) NULL)
00935     dellist (&rnode->branches);
00936     if (rnode->date != (char *) NULL)
00937     free (rnode->date);
00938     if (rnode->next != (char *) NULL)
00939     free (rnode->next);
00940     if (rnode->author != (char *) NULL)
00941     free (rnode->author);
00942     if (rnode->state != (char *) NULL)
00943     free (rnode->state);
00944     if (rnode->other != (List *) NULL)
00945     dellist (&rnode->other);
00946     if (rnode->other_delta != NULL)
00947     dellist (&rnode->other_delta);
00948     if (rnode->text != NULL)
00949     freedeltatext (rnode->text);
00950     free ((char *) rnode);
00951 }
00952
00953 /*
00954  * rcsvers_delproc - free up an RCSVers type node
00955  */
00956 static void
00957 rcsvers_delproc (p)
00958     Node *p;
00959 {
00960     free_rcsvers_contents ((RCSVers *) p->data);
00961 }
00962
00963 /* These functions retrieve keys and values from an RCS file using a
00964    buffer.  We use this somewhat complex approach because it turns out
00965    that for many common operations, CVS spends most of its time
00966    reading keys, so it's worth doing some fairly hairy optimization.  */
00967
00968 /* The number of bytes we try to read each time we need more data.  */
00969
00970 #define RCSBUF_BUFSIZE (8192)
00971
00972 /* The buffer we use to store data.  This grows as needed.  */
00973
00974 static char *rcsbuf_buffer = NULL;
00975 static size_t rcsbuf_buffer_size = 0;
00976
00977 /* Whether rcsbuf_buffer is in use.  This is used as a sanity check.  */
00978
00979 static int rcsbuf_inuse;
00980
00981 /* Set up to start gathering keys and values from an RCS file.  This
00982    initializes RCSBUF.  */
00983
00984 static void
00985 rcsbuf_open (rcsbuf, fp, filename, pos)
00986     struct rcsbuffer *rcsbuf;
00987     FILE *fp;
00988     const char *filename;
00989     unsigned long pos;
00990 {
00991     if (rcsbuf_inuse)
00992     error (1, 0, "rcsbuf_open: internal error");
00993     rcsbuf_inuse = 1;
00994
00995     if (rcsbuf_buffer_size < RCSBUF_BUFSIZE)
00996     expand_string (&rcsbuf_buffer, &rcsbuf_buffer_size, RCSBUF_BUFSIZE);
00997
00998     rcsbuf->ptr = rcsbuf_buffer;
00999     rcsbuf->ptrend = rcsbuf_buffer;
01000     rcsbuf->fp = fp;
01001     rcsbuf->filename = filename;
01002     rcsbuf->pos = pos;
01003     rcsbuf->vlen = 0;
01004     rcsbuf->at_string = 0;
01005     rcsbuf->embedded_at = 0;
01006 }
01007
01008 /* Stop gathering keys from an RCS file.  */
01009
01010 static void
01011 rcsbuf_close (rcsbuf)
01012     struct rcsbuffer *rcsbuf;
01013 {
01014     if (! rcsbuf_inuse)
01015     error (1, 0, "rcsbuf_close: internal error");
01016     rcsbuf_inuse = 0;
01017 }
01018
01019 /* Read a key/value pair from an RCS file.  This sets *KEYP to point
01020    to the key, and *VALUEP to point to the value.  A missing or empty
01021    value is indicated by setting *VALUEP to NULL.
01022
01023    This function returns 1 on success, or 0 on EOF.  If there is an
01024    error reading the file, or an EOF in an unexpected location, it
01025    gives a fatal error.
01026
01027    This sets *KEYP and *VALUEP to point to storage managed by
01028    rcsbuf_getkey.  Moreover, *VALUEP has not been massaged from the
01029    RCS format: it may contain embedded whitespace and embedded '@'
01030    characters.  Call rcsbuf_valcopy or rcsbuf_valpolish to do
01031    appropriate massaging.  */
01032
01033 /* Note that the extreme hair in rcsbuf_getkey is because profiling
01034    statistics show that it was worth it. */
01035
01036 static int
01037 rcsbuf_getkey (rcsbuf, keyp, valp)
01038     struct rcsbuffer *rcsbuf;
01039     char **keyp;
01040     char **valp;
01041 {
01042     register const char * const my_spacetab = spacetab;
01043     register char *ptr, *ptrend;
01044     char c;
01045
01046 #define my_whitespace(c)    (my_spacetab[(unsigned char)c] != 0)
01047
01048     rcsbuf->vlen = 0;
01049     rcsbuf->at_string = 0;
01050     rcsbuf->embedded_at = 0;
01051
01052     ptr = rcsbuf->ptr;
01053     ptrend = rcsbuf->ptrend;
01054
01055     /* Sanity check.  */
01056     if (ptr < rcsbuf_buffer || ptr > rcsbuf_buffer + rcsbuf_buffer_size)
01057     abort ();
01058
01059     /* If the pointer is more than RCSBUF_BUFSIZE bytes into the
01060        buffer, move back to the start of the buffer.  This keeps the
01061        buffer from growing indefinitely.  */
01062     if (ptr - rcsbuf_buffer >= RCSBUF_BUFSIZE)
01063     {
01064     int len;
01065
01066     len = ptrend - ptr;
01067
01068     /* Sanity check: we don't read more than RCSBUF_BUFSIZE bytes
01069            at a time, so we can't have more bytes than that past PTR.  */
01070     if (len > RCSBUF_BUFSIZE)
01071         abort ();
01072
01073     /* Update the POS field, which holds the file offset of the
01074            first byte in the RCSBUF_BUFFER buffer.  */
01075     rcsbuf->pos += ptr - rcsbuf_buffer;
01076
01077     memcpy (rcsbuf_buffer, ptr, len);
01078     ptr = rcsbuf_buffer;
01079     ptrend = ptr + len;
01080     rcsbuf->ptrend = ptrend;
01081     }
01082
01083     /* Skip leading whitespace.  */
01084
01085     while (1)
01086     {
01087     if (ptr >= ptrend)
01088     {
01089         ptr = rcsbuf_fill (rcsbuf, ptr, (char **) NULL, (char **) NULL);
01090         if (ptr == NULL)
01091         return 0;
01092         ptrend = rcsbuf->ptrend;
01093     }
01094
01095     c = *ptr;
01096     if (! my_whitespace (c))
01097         break;
01098
01099     ++ptr;
01100     }
01101
01102     /* We've found the start of the key.  */
01103
01104     *keyp = ptr;
01105
01106     if (c != ';')
01107     {
01108     while (1)
01109     {
01110         ++ptr;
01111         if (ptr >= ptrend)
01112         {
01113         ptr = rcsbuf_fill (rcsbuf, ptr, keyp, (char **) NULL);
01114         if (ptr == NULL)
01115             error (1, 0, "EOF in key in RCS file %s",
01116                rcsbuf->filename);
01117         ptrend = rcsbuf->ptrend;
01118         }
01119         c = *ptr;
01120         if (c == ';' || my_whitespace (c))
01121         break;
01122     }
01123     }
01124
01125     /* Here *KEYP points to the key in the buffer, C is the character
01126        we found at the of the key, and PTR points to the location in
01127        the buffer where we found C.  We must set *PTR to \0 in order
01128        to terminate the key.  If the key ended with ';', then there is
01129        no value.  */
01130
01131     *ptr = '\0';
01132     ++ptr;
01133
01134     if (c == ';')
01135     {
01136     *valp = NULL;
01137     rcsbuf->ptr = ptr;
01138     return 1;
01139     }
01140
01141     /* C must be whitespace.  Skip whitespace between the key and the
01142        value.  If we find ';' now, there is no value.  */
01143
01144     while (1)
01145     {
01146     if (ptr >= ptrend)
01147     {
01148         ptr = rcsbuf_fill (rcsbuf, ptr, keyp, (char **) NULL);
01149         if (ptr == NULL)
01150         error (1, 0, "EOF while looking for value in RCS file %s",
01151                rcsbuf->filename);
01152         ptrend = rcsbuf->ptrend;
01153     }
01154     c = *ptr;
01155     if (c == ';')
01156     {
01157         *valp = NULL;
01158         rcsbuf->ptr = ptr + 1;
01159         return 1;
01160     }
01161     if (! my_whitespace (c))
01162         break;
01163     ++ptr;
01164     }
01165
01166     /* Now PTR points to the start of the value, and C is the first
01167        character of the value.  */
01168
01169     if (c != '@')
01170     *valp = ptr;
01171     else
01172     {
01173     char *pat;
01174     size_t vlen;
01175
01176     /* Optimize the common case of a value composed of a single
01177        '@' string.  */
01178
01179     rcsbuf->at_string = 1;
01180
01181     ++ptr;
01182
01183     *valp = ptr;
01184
01185     while (1)
01186     {
01187         while ((pat = memchr (ptr, '@', ptrend - ptr)) == NULL)
01188         {
01189         /* Note that we pass PTREND as the PTR value to
01190                    rcsbuf_fill, so that we will wind up setting PTR to
01191                    the location corresponding to the old PTREND, so
01192                    that we don't search the same bytes again.  */
01193         ptr = rcsbuf_fill (rcsbuf, ptrend, keyp, valp);
01194         if (ptr == NULL)
01195             error (1, 0,
01196                "EOF while looking for end of string in RCS file %s",
01197                rcsbuf->filename);
01198         ptrend = rcsbuf->ptrend;
01199         }
01200
01201         /* Handle the special case of an '@' right at the end of
01202                the known bytes.  */
01203         if (pat + 1 >= ptrend)
01204         {
01205         /* Note that we pass PAT, not PTR, here.  */
01206         pat = rcsbuf_fill (rcsbuf, pat, keyp, valp);
01207         if (pat == NULL)
01208         {
01209             /* EOF here is OK; it just means that the last
01210                character of the file was an '@' terminating a
01211                value for a key type which does not require a
01212                trailing ';'.  */
01213             pat = rcsbuf->ptrend - 1;
01214
01215         }
01216         ptrend = rcsbuf->ptrend;
01217
01218         /* Note that the value of PTR is bogus here.  This is
01219            OK, because we don't use it.  */
01220         }
01221
01222         if (pat + 1 >= ptrend || pat[1] != '@')
01223         break;
01224
01225         /* We found an '@' pair in the string.  Keep looking.  */
01226         ++rcsbuf->embedded_at;
01227         ptr = pat + 2;
01228     }
01229
01230     /* Here PAT points to the final '@' in the string.  */
01231
01232     *pat = '\0';
01233
01234     vlen = pat - *valp;
01235     if (vlen == 0)
01236         *valp = NULL;
01237     rcsbuf->vlen = vlen;
01238
01239     ptr = pat + 1;
01240     }
01241
01242     /* Certain keywords only have a '@' string.  If there is no '@'
01243        string, then the old getrcskey function assumed that they had
01244        no value, and we do the same.  */
01245
01246     {
01247     char *k;
01248
01249     k = *keyp;
01250     if (STREQ (k, RCSDESC)
01251         || STREQ (k, "text")
01252         || STREQ (k, "log"))
01253     {
01254         if (c != '@')
01255         *valp = NULL;
01256         rcsbuf->ptr = ptr;
01257         return 1;
01258     }
01259     }
01260
01261     /* If we've already gathered a '@' string, try to skip whitespace
01262        and find a ';'.  */
01263     if (c == '@')
01264     {
01265     while (1)
01266     {
01267         char n;
01268
01269         if (ptr >= ptrend)
01270         {
01271         ptr = rcsbuf_fill (rcsbuf, ptr, keyp, valp);
01272         if (ptr == NULL)
01273             error (1, 0, "EOF in value in RCS file %s",
01274                rcsbuf->filename);
01275         ptrend = rcsbuf->ptrend;
01276         }
01277         n = *ptr;
01278         if (n == ';')
01279         {
01280         /* We're done.  We already set everything up for this
01281                    case above.  */
01282         rcsbuf->ptr = ptr + 1;
01283         return 1;
01284         }
01285         if (! my_whitespace (n))
01286         break;
01287         ++ptr;
01288     }
01289
01290     /* The value extends past the '@' string.  We need to undo the
01291            '@' stripping done in the default case above.  This
01292            case never happens in a plain RCS file, but it can happen
01293            if user defined phrases are used.  */
01294     ((*valp)--)[rcsbuf->vlen++] = '@';
01295     }
01296
01297     /* Here we have a value which is not a simple '@' string.  We need
01298        to gather up everything until the next ';', including any '@'
01299        strings.  *VALP points to the start of the value.  If
01300        RCSBUF->VLEN is not zero, then we have already read an '@'
01301        string, and PTR points to the data following the '@' string.
01302        Otherwise, PTR points to the start of the value.  */
01303
01304     while (1)
01305     {
01306     char *start, *psemi, *pat;
01307
01308     /* Find the ';' which must end the value.  */
01309     start = ptr;
01310     while ((psemi = memchr (ptr, ';', ptrend - ptr)) == NULL)
01311     {
01312         int slen;
01313
01314         /* Note that we pass PTREND as the PTR value to
01315            rcsbuf_fill, so that we will wind up setting PTR to the
01316            location corresponding to the old PTREND, so that we
01317            don't search the same bytes again.  */
01318         slen = start - *valp;
01319         ptr = rcsbuf_fill (rcsbuf, ptrend, keyp, valp);
01320         if (ptr == NULL)
01321         error (1, 0, "EOF in value in RCS file %s", rcsbuf->filename);
01322         start = *valp + slen;
01323         ptrend = rcsbuf->ptrend;
01324     }
01325
01326     /* See if there are any '@' strings in the value.  */
01327     pat = memchr (start, '@', psemi - start);
01328
01329     if (pat == NULL)
01330     {
01331         size_t vlen;
01332
01333         /* We're done with the value.  Trim any trailing
01334                whitespace.  */
01335
01336         rcsbuf->ptr = psemi + 1;
01337
01338         start = *valp;
01339         while (psemi > start && my_whitespace (psemi[-1]))
01340         --psemi;
01341         *psemi = '\0';
01342
01343         vlen = psemi - start;
01344         if (vlen == 0)
01345         *valp = NULL;
01346         rcsbuf->vlen = vlen;
01347
01348         return 1;
01349     }
01350
01351     /* We found an '@' string in the value.  We set RCSBUF->AT_STRING
01352        and RCSBUF->EMBEDDED_AT to indicate that we won't be able to
01353        compress whitespace correctly for this type of value.
01354        Since this type of value never arises in a normal RCS file,
01355        this should not be a big deal.  It means that if anybody
01356        adds a phrase which can have both an '@' string and regular
01357        text, they will have to handle whitespace compression
01358        themselves.  */
01359
01360     rcsbuf->at_string = 1;
01361     rcsbuf->embedded_at = -1;
01362
01363     ptr = pat + 1;
01364
01365     while (1)
01366     {
01367         while ((pat = memchr (ptr, '@', ptrend - ptr)) == NULL)
01368         {
01369         /* Note that we pass PTREND as the PTR value to
01370                    rcsbuff_fill, so that we will wind up setting PTR
01371                    to the location corresponding to the old PTREND, so
01372                    that we don't search the same bytes again.  */
01373         ptr = rcsbuf_fill (rcsbuf, ptrend, keyp, valp);
01374         if (ptr == NULL)
01375             error (1, 0,
01376                "EOF while looking for end of string in RCS file %s",
01377                rcsbuf->filename);
01378         ptrend = rcsbuf->ptrend;
01379         }
01380
01381         /* Handle the special case of an '@' right at the end of
01382                the known bytes.  */
01383         if (pat + 1 >= ptrend)
01384         {
01385         ptr = rcsbuf_fill (rcsbuf, ptr, keyp, valp);
01386         if (ptr == NULL)
01387             error (1, 0, "EOF in value in RCS file %s",
01388                rcsbuf->filename);
01389         ptrend = rcsbuf->ptrend;
01390         }
01391
01392         if (pat[1] != '@')
01393         break;
01394
01395         /* We found an '@' pair in the string.  Keep looking.  */
01396         ptr = pat + 2;
01397     }
01398
01399     /* Here PAT points to the final '@' in the string.  */
01400     ptr = pat + 1;
01401     }
01402
01403 #undef my_whitespace
01404 }
01405
01406 /* Read an RCS revision number from an RCS file.  This sets *REVP to
01407    point to the revision number; it will point to space that is
01408    managed by the rcsbuf functions, and is only good until the next
01409    call to rcsbuf_getkey or rcsbuf_getrevnum.
01410
01411    This function returns 1 on success, or 0 on EOF.  If there is an
01412    error reading the file, or an EOF in an unexpected location, it
01413    gives a fatal error.  */
01414
01415 static int
01416 rcsbuf_getrevnum (rcsbuf, revp)
01417     struct rcsbuffer *rcsbuf;
01418     char **revp;
01419 {
01420     char *ptr, *ptrend;
01421     char c;
01422
01423     ptr = rcsbuf->ptr;
01424     ptrend = rcsbuf->ptrend;
01425
01426     *revp = NULL;
01427
01428     /* Skip leading whitespace.  */
01429
01430     while (1)
01431     {
01432     if (ptr >= ptrend)
01433     {
01434         ptr = rcsbuf_fill (rcsbuf, ptr, (char **) NULL, (char **) NULL);
01435         if (ptr == NULL)
01436         return 0;
01437         ptrend = rcsbuf->ptrend;
01438     }
01439
01440     c = *ptr;
01441     if (! whitespace (c))
01442         break;
01443
01444     ++ptr;
01445     }
01446
01447     if (! isdigit ((unsigned char) c) && c != '.')
01448     error (1, 0,
01449            "\
01450 unexpected '\\x%x' reading revision number in RCS file %s",
01451            c, rcsbuf->filename);
01452
01453     *revp = ptr;
01454
01455     do
01456     {
01457     ++ptr;
01458     if (ptr >= ptrend)
01459     {
01460         ptr = rcsbuf_fill (rcsbuf, ptr, revp, (char **) NULL);
01461         if (ptr == NULL)
01462         error (1, 0,
01463                "unexpected EOF reading revision number in RCS file %s",
01464                rcsbuf->filename);
01465         ptrend = rcsbuf->ptrend;
01466     }
01467
01468     c = *ptr;
01469     }
01470     while (isdigit ((unsigned char) c) || c == '.');
01471
01472     if (! whitespace (c))
01473     error (1, 0, "\
01474 unexpected '\\x%x' reading revision number in RCS file %s",
01475            c, rcsbuf->filename);
01476
01477     *ptr = '\0';
01478
01479     rcsbuf->ptr = ptr + 1;
01480
01481     return 1;
01482 }
01483
01484 /* Fill RCSBUF_BUFFER with bytes from the file associated with RCSBUF,
01485    updating PTR and the PTREND field.  If KEYP and *KEYP are not NULL,
01486    then *KEYP points into the buffer, and must be adjusted if the
01487    buffer is changed.  Likewise for VALP.  Returns the new value of
01488    PTR, or NULL on error.  */
01489
01490 static char *
01491 rcsbuf_fill (rcsbuf, ptr, keyp, valp)
01492     struct rcsbuffer *rcsbuf;
01493     char *ptr;
01494     char **keyp;
01495     char **valp;
01496 {
01497     int got;
01498
01499     if (rcsbuf->ptrend - rcsbuf_buffer + RCSBUF_BUFSIZE > rcsbuf_buffer_size)
01500     {
01501     int poff, peoff, koff, voff;
01502
01503     poff = ptr - rcsbuf_buffer;
01504     peoff = rcsbuf->ptrend - rcsbuf_buffer;
01505     if (keyp != NULL && *keyp != NULL)
01506         koff = *keyp - rcsbuf_buffer;
01507     if (valp != NULL && *valp != NULL)
01508         voff = *valp - rcsbuf_buffer;
01509     koff = keyp == NULL ? 0 : *keyp - rcsbuf_buffer;
01510     voff = valp == NULL ? 0 : *valp - rcsbuf_buffer;
01511
01512     expand_string (&rcsbuf_buffer, &rcsbuf_buffer_size,
01513                rcsbuf_buffer_size + RCSBUF_BUFSIZE);
01514
01515     ptr = rcsbuf_buffer + poff;
01516     rcsbuf->ptrend = rcsbuf_buffer + peoff;
01517     if (keyp != NULL && *keyp != NULL)
01518         *keyp = rcsbuf_buffer + koff;
01519     if (valp != NULL && *valp != NULL)
01520         *valp = rcsbuf_buffer + voff;
01521     }
01522
01523     got = fread (rcsbuf->ptrend, 1, RCSBUF_BUFSIZE, rcsbuf->fp);
01524     if (got == 0)
01525     {
01526     if (ferror (rcsbuf->fp))
01527         error (1, errno, "cannot read %s", rcsbuf->filename);
01528     return NULL;
01529     }
01530
01531     rcsbuf->ptrend += got;
01532
01533     return ptr;
01534 }
01535
01536 /* Test whether the last value returned by rcsbuf_getkey is a composite
01537    value or not. */
01538
01539 static int
01540 rcsbuf_valcmp (rcsbuf)
01541     struct rcsbuffer *rcsbuf;
01542 {
01543     return rcsbuf->at_string && rcsbuf->embedded_at < 0;
01544 }
01545
01546 /* Copy the value VAL returned by rcsbuf_getkey into a memory buffer,
01547    returning the memory buffer.  Polish the value like
01548    rcsbuf_valpolish, q.v.  */
01549
01550 static char *
01551 rcsbuf_valcopy (rcsbuf, val, polish, lenp)
01552     struct rcsbuffer *rcsbuf;
01553     char *val;
01554     int polish;
01555     size_t *lenp;
01556 {
01557     size_t vlen;
01558     int embedded_at;
01559     char *ret;
01560
01561     if (val == NULL)
01562     {
01563     if (lenp != NULL)
01564         *lenp = 0;
01565     return NULL;
01566     }
01567
01568     vlen = rcsbuf->vlen;
01569     embedded_at = rcsbuf->embedded_at < 0 ? 0 : rcsbuf->embedded_at;
01570
01571     ret = xmalloc (vlen - embedded_at + 1);
01572
01573     if (rcsbuf->at_string ? embedded_at == 0 : ! polish)
01574     {
01575     /* No special action to take.  */
01576     memcpy (ret, val, vlen + 1);
01577     if (lenp != NULL)
01578         *lenp = vlen;
01579     return ret;
01580     }
01581
01582     rcsbuf_valpolish_internal (rcsbuf, ret, val, lenp);
01583     return ret;
01584 }
01585
01586 /* Polish the value VAL returned by rcsbuf_getkey.  The POLISH
01587    parameter is non-zero if multiple embedded whitespace characters
01588    should be compressed into a single whitespace character.  Note that
01589    leading and trailing whitespace was already removed by
01590    rcsbuf_getkey.  Within an '@' string, pairs of '@' characters are
01591    compressed into a single '@' character regardless of the value of
01592    POLISH.  If LENP is not NULL, set *LENP to the length of the value.  */
01593
01594 static void
01595 rcsbuf_valpolish (rcsbuf, val, polish, lenp)
01596     struct rcsbuffer *rcsbuf;
01597     char *val;
01598     int polish;
01599     size_t *lenp;
01600 {
01601     if (val == NULL)
01602     {
01603     if (lenp != NULL)
01604         *lenp= 0;
01605     return;
01606     }
01607
01608     if (rcsbuf->at_string ? rcsbuf->embedded_at == 0 : ! polish)
01609     {
01610     /* No special action to take.  */
01611     if (lenp != NULL)
01612         *lenp = rcsbuf->vlen;
01613     return;
01614     }
01615
01616     rcsbuf_valpolish_internal (rcsbuf, val, val, lenp);
01617 }
01618
01619 /* Internal polishing routine, called from rcsbuf_valcopy and
01620    rcsbuf_valpolish.  */
01621
01622 static void
01623 rcsbuf_valpolish_internal (rcsbuf, to, from, lenp)
01624     struct rcsbuffer *rcsbuf;
01625     char *to;
01626     const char *from;
01627     size_t *lenp;
01628 {
01629     size_t len;
01630
01631     len = rcsbuf->vlen;
01632
01633     if (! rcsbuf->at_string)
01634     {
01635     char *orig_to;
01636     size_t clen;
01637
01638     orig_to = to;
01639
01640     for (clen = len; clen > 0; ++from, --clen)
01641     {
01642         char c;
01643
01644         c = *from;
01645         if (whitespace (c))
01646         {
01647         /* Note that we know that clen can not drop to zero
01648                    while we have whitespace, because we know there is
01649                    no trailing whitespace.  */
01650         while (whitespace (from[1]))
01651         {
01652             ++from;
01653             --clen;
01654         }
01655         c = ' ';
01656         }
01657         *to++ = c;
01658     }
01659
01660     *to = '\0';
01661
01662     if (lenp != NULL)
01663         *lenp = to - orig_to;
01664     }
01665     else
01666     {
01667     const char *orig_from;
01668     char *orig_to;
01669     int embedded_at;
01670     size_t clen;
01671
01672     orig_from = from;
01673     orig_to = to;
01674
01675     embedded_at = rcsbuf->embedded_at;
01676     assert (embedded_at > 0);
01677
01678     if (lenp != NULL)
01679         *lenp = len - embedded_at;
01680
01681     for (clen = len; clen > 0; ++from, --clen)
01682     {
01683         char c;
01684
01685         c = *from;
01686         *to++ = c;
01687         if (c == '@')
01688         {
01689         ++from;
01690
01691         /* Sanity check.  */
01692         if (*from != '@' || clen == 0)
01693             abort ();
01694
01695         --clen;
01696
01697         --embedded_at;
01698         if (embedded_at == 0)
01699         {
01700             /* We've found all the embedded '@' characters.
01701                        We can just memcpy the rest of the buffer after
01702                        this '@' character.  */
01703             if (orig_to != orig_from)
01704             memcpy (to, from + 1, clen - 1);
01705             else
01706             memmove (to, from + 1, clen - 1);
01707             from += clen;
01708             to += clen - 1;
01709             break;
01710         }
01711         }
01712     }
01713
01714     /* Sanity check.  */
01715     if (from != orig_from + len
01716         || to != orig_to + (len - rcsbuf->embedded_at))
01717     {
01718         abort ();
01719     }
01720
01721     *to = '\0';
01722     }
01723 }
01724
01725 #ifdef PRESERVE_PERMISSIONS_SUPPORT
01726
01727 /* Copy the next word from the value VALP returned by rcsbuf_getkey into a
01728    memory buffer, updating VALP and returning the memory buffer.  Return
01729    NULL when there are no more words. */
01730
01731 static char *
01732 rcsbuf_valword (rcsbuf, valp)
01733     struct rcsbuffer *rcsbuf;
01734     char **valp;
01735 {
01736     register const char * const my_spacetab = spacetab;
01737     register char *ptr, *pat;
01738     char c;
01739
01740 #define my_whitespace(c)    (my_spacetab[(unsigned char)c] != 0)
01741
01742     if (*valp == NULL)
01743     return NULL;
01744
01745     for (ptr = *valp; my_whitespace (*ptr); ++ptr) ;
01746     if (*ptr == '\0')
01747     {
01748     assert (ptr - *valp == rcsbuf->vlen);
01749     *valp = NULL;
01750     rcsbuf->vlen = 0;
01751     return NULL;
01752     }
01753
01754     /* PTR now points to the start of a value.  Find out whether it is
01755        a num, an id, a string or a colon. */
01756     c = *ptr;
01757     if (c == ':')
01758     {
01759     rcsbuf->vlen -= ++ptr - *valp;
01760     *valp = ptr;
01761     return xstrdup (":");
01762     }
01763
01764     if (c == '@')
01765     {
01766     int embedded_at = 0;
01767     size_t vlen;
01768
01769     pat = ++ptr;
01770     while ((pat = strchr (pat, '@')) != NULL)
01771     {
01772         if (pat[1] != '@')
01773         break;
01774         ++embedded_at;
01775         pat += 2;
01776     }
01777
01778     /* Here PAT points to the final '@' in the string.  */
01779     *pat++ = '\0';
01780     assert (rcsbuf->at_string);
01781     vlen = rcsbuf->vlen - (pat - *valp);
01782     rcsbuf->vlen = pat - ptr - 1;
01783     rcsbuf->embedded_at = embedded_at;
01784     ptr = rcsbuf_valcopy (rcsbuf, ptr, 0, (size_t *) NULL);
01785     *valp = pat;
01786     rcsbuf->vlen = vlen;
01787     if (strchr (pat, '@') == NULL)
01788         rcsbuf->at_string = 0;
01789     else
01790         rcsbuf->embedded_at = -1;
01791     return ptr;
01792     }
01793
01794     /* *PTR is neither `:', `;' nor `@', so it should be the start of a num
01795        or an id.  Make sure it is not another special character. */
01796     if (c == '$' || c == '.' || c == ',')
01797     {
01798     error (1, 0, "illegal special character in RCS field in %s",
01799            rcsbuf->filename);
01800     }
01801
01802     pat = ptr;
01803     while (1)
01804     {
01805     /* Legitimate ID characters are digits, dots and any `graphic
01806            printing character that is not a special.' This test ought
01807        to do the trick. */
01808     c = *++pat;
01809     if (!isprint ((unsigned char) c) ||
01810         c == ';' || c == '$' || c == ',' || c == '@' || c == ':')
01811         break;
01812     }
01813
01814     /* PAT points to the last non-id character in this word, and C is
01815        the character in its memory cell.  Check to make sure that it
01816        is a legitimate word delimiter -- whitespace or end. */
01817     if (c != '\0' && !my_whitespace (c))
01818     error (1, 0, "illegal special character in RCS field in %s",
01819            rcsbuf->filename);
01820
01821     *pat = '\0';
01822     rcsbuf->vlen -= pat - *valp;
01823     *valp = pat;
01824     return xstrdup (ptr);
01825
01826 #undef my_whitespace
01827 }
01828
01829 #endif
01830
01831 /* Return the current position of an rcsbuf.  */
01832
01833 static unsigned long
01834 rcsbuf_ftell (rcsbuf)
01835     struct rcsbuffer *rcsbuf;
01836 {
01837     return rcsbuf->pos + (rcsbuf->ptr - rcsbuf_buffer);
01838 }
01839
01840 /* Return a pointer to any data buffered for RCSBUF, along with the
01841    length.  */
01842
01843 static void
01844 rcsbuf_get_buffered (rcsbuf, datap, lenp)
01845     struct rcsbuffer *rcsbuf;
01846     char **datap;
01847     size_t *lenp;
01848 {
01849     *datap = rcsbuf->ptr;
01850     *lenp = rcsbuf->ptrend - rcsbuf->ptr;
01851 }
01852
01853 /* CVS optimizes by quickly reading some header information from a
01854    file.  If it decides it needs to do more with the file, it reopens
01855    it.  We speed that up here by maintaining a cache of a single open
01856    file, to save the time it takes to reopen the file in the common
01857    case.  */
01858
01859 static RCSNode *cached_rcs;
01860 static struct rcsbuffer cached_rcsbuf;
01861
01862 /* Cache RCS and RCSBUF.  This takes responsibility for closing
01863    RCSBUF->FP.  */
01864
01865 static void
01866 rcsbuf_cache (rcs, rcsbuf)
01867     RCSNode *rcs;
01868     struct rcsbuffer *rcsbuf;
01869 {
01870     if (cached_rcs != NULL)
01871     rcsbuf_cache_close ();
01872     cached_rcs = rcs;
01873     ++rcs->refcount;
01874     cached_rcsbuf = *rcsbuf;
01875 }
01876
01877 /* If there is anything in the cache, close it.  */
01878
01879 static void
01880 rcsbuf_cache_close ()
01881 {
01882     if (cached_rcs != NULL)
01883     {
01884     if (fclose (cached_rcsbuf.fp) != 0)
01885         error (0, errno, "cannot close %s", cached_rcsbuf.filename);
01886     rcsbuf_close (&cached_rcsbuf);
01887     freercsnode (&cached_rcs);
01888     cached_rcs = NULL;
01889     }
01890 }
01891
01892 /* Open an rcsbuffer for RCS, getting it from the cache if possible.
01893    Set *FPP to the file, and *RCSBUFP to the rcsbuf.  The file should
01894    be put at position POS.  */
01895
01896 static void
01897 rcsbuf_cache_open (rcs, pos, pfp, prcsbuf)
01898     RCSNode *rcs;
01899     long pos;
01900     FILE **pfp;
01901     struct rcsbuffer *prcsbuf;
01902 {
01903     if (cached_rcs == rcs)
01904     {
01905     if (rcsbuf_ftell (&cached_rcsbuf) != pos)
01906     {
01907         if (fseek (cached_rcsbuf.fp, pos, SEEK_SET) != 0)
01908         error (1, 0, "cannot fseek RCS file %s",
01909                cached_rcsbuf.filename);
01910         cached_rcsbuf.ptr = rcsbuf_buffer;
01911         cached_rcsbuf.ptrend = rcsbuf_buffer;
01912         cached_rcsbuf.pos = pos;
01913     }
01914     *pfp = cached_rcsbuf.fp;
01915
01916     /* When RCS_parse opens a file using fopen_case, it frees the
01917            filename which we cached in CACHED_RCSBUF and stores a new
01918            file name in RCS->PATH.  We avoid problems here by always
01919            copying the filename over.  FIXME: This is hackish.  */
01920     cached_rcsbuf.filename = rcs->path;
01921
01922     *prcsbuf = cached_rcsbuf;
01923
01924     cached_rcs = NULL;
01925
01926     /* Removing RCS from the cache removes a reference to it.  */
01927     --rcs->refcount;
01928     if (rcs->refcount <= 0)
01929         error (1, 0, "rcsbuf_cache_open: internal error");
01930     }
01931     else
01932     {
01933     if (cached_rcs != NULL)
01934         rcsbuf_cache_close ();
01935
01936     *pfp = CVS_FOPEN (rcs->path, FOPEN_BINARY_READ);
01937     if (*pfp == NULL)
01938         error (1, 0, "unable to reopen `%s'", rcs->path);
01939     if (pos != 0)
01940     {
01941         if (fseek (*pfp, pos, SEEK_SET) != 0)
01942         error (1, 0, "cannot fseek RCS file %s", rcs->path);
01943     }
01944     rcsbuf_open (prcsbuf, *pfp, rcs->path, pos);
01945     }
01946 }
01947
01948
01949 /*
01950  * process the symbols list of the rcs file
01951  */
01952 static void
01953 do_symbols (list, val)
01954     List *list;
01955     char *val;
01956 {
01957     Node *p;
01958     char *cp = val;
01959     char *tag, *rev;
01960
01961     for (;;)
01962     {
01963     /* skip leading whitespace */
01964     while (whitespace (*cp))
01965         cp++;
01966
01967     /* if we got to the end, we are done */
01968     if (*cp == '\0')
01969         break;
01970
01971     /* split it up into tag and rev */
01972     tag = cp;
01973     cp = strchr (cp, ':');
01974     *cp++ = '\0';
01975     rev = cp;
01976     while (!whitespace (*cp) && *cp != '\0')
01977         cp++;
01978     if (*cp != '\0')
01979         *cp++ = '\0';
01980
01981     /* make a new node and add it to the list */
01982     p = getnode ();
01983     p->key = xstrdup (tag);
01984     p->data = xstrdup (rev);
01985     (void) addnode (list, p);
01986     }
01987 }
01988
01989 /*
01990  * process the locks list of the rcs file
01991  * Like do_symbols, but hash entries are keyed backwards: i.e.
01992  * an entry like `user:rev' is keyed on REV rather than on USER.
01993  */
01994 static void
01995 do_locks (list, val)
01996     List *list;
01997     char *val;
01998 {
01999     Node *p;
02000     char *cp = val;
02001     char *user, *rev;
02002
02003     for (;;)
02004     {
02005     /* skip leading whitespace */
02006     while (whitespace (*cp))
02007         cp++;
02008
02009     /* if we got to the end, we are done */
02010     if (*cp == '\0')
02011         break;
02012
02013     /* split it up into user and rev */
02014     user = cp;
02015     cp = strchr (cp, ':');
02016     *cp++ = '\0';
02017     rev = cp;
02018     while (!whitespace (*cp) && *cp != '\0')
02019         cp++;
02020     if (*cp != '\0')
02021         *cp++ = '\0';
02022
02023     /* make a new node and add it to the list */
02024     p = getnode ();
02025     p->key = xstrdup (rev);
02026     p->data = xstrdup (user);
02027     (void) addnode (list, p);
02028     }
02029 }
02030
02031 /*
02032  * process the branches list of a revision delta
02033  */
02034 static void
02035 do_branches (list, val)
02036     List *list;
02037     char *val;
02038 {
02039     Node *p;
02040     char *cp = val;
02041     char *branch;
02042
02043     for (;;)
02044     {
02045     /* skip leading whitespace */
02046     while (whitespace (*cp))
02047         cp++;
02048
02049     /* if we got to the end, we are done */
02050     if (*cp == '\0')
02051         break;
02052
02053     /* find the end of this branch */
02054     branch = cp;
02055     while (!whitespace (*cp) && *cp != '\0')
02056         cp++;
02057     if (*cp != '\0')
02058         *cp++ = '\0';
02059
02060     /* make a new node and add it to the list */
02061     p = getnode ();
02062     p->key = xstrdup (branch);
02063     (void) addnode (list, p);
02064     }
02065 }
02066
02067 /*
02068  * Version Number
02069  *
02070  * Returns the requested version number of the RCS file, satisfying tags and/or
02071  * dates, and walking branches, if necessary.
02072  *
02073  * The result is returned; null-string if error.
02074  */
02075 char *
02076 RCS_getversion (rcs, tag, date, force_tag_match, simple_tag)
02077     RCSNode *rcs;
02078     char *tag;
02079     char *date;
02080     int force_tag_match;
02081     int *simple_tag;
02082 {
02083     if (simple_tag != NULL)
02084     *simple_tag = 0;
02085
02086     /* make sure we have something to look at... */
02087     assert (rcs != NULL);
02088
02089     if (tag && date)
02090     {
02091     char *branch, *rev;
02092
02093     if (! RCS_nodeisbranch (rcs, tag))
02094     {
02095         /* We can't get a particular date if the tag is not a
02096                branch.  */
02097         return NULL;
02098     }
02099
02100     /* Work out the branch.  */
02101     if (! isdigit ((unsigned char) tag[0]))
02102         branch = RCS_whatbranch (rcs, tag);
02103     else
02104         branch = xstrdup (tag);
02105
02106     /* Fetch the revision of branch as of date.  */
02107     rev = RCS_getdatebranch (rcs, date, branch);
02108     free (branch);
02109     return (rev);
02110     }
02111     else if (tag)
02112     return (RCS_gettag (rcs, tag, force_tag_match, simple_tag));
02113     else if (date)
02114     return (RCS_getdate (rcs, date, force_tag_match));
02115     else
02116     return (RCS_head (rcs));
02117
02118 }
02119
02120 /*
02121  * Get existing revision number corresponding to tag or revision.
02122  * Similar to RCS_gettag but less interpretation imposed.
02123  * For example:
02124  * -- If tag designates a magic branch, RCS_tag2rev
02125  *    returns the magic branch number.
02126  * -- If tag is a branch tag, returns the branch number, not
02127  *    the revision of the head of the branch.
02128  * If tag or revision is not valid or does not exist in file,
02129  * exit with error.
02130  */
02131 char *
02132 RCS_tag2rev (rcs, tag)
02133     RCSNode *rcs;
02134     char *tag;
02135 {
02136     char *rev, *pa, *pb;
02137     int i;
02138
02139     assert (rcs != NULL);
02140
02141     if (rcs->flags & PARTIAL)
02142     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
02143
02144     /* If a valid revision, try to look it up */
02145     if ( RCS_valid_rev (tag) )
02146     {
02147     /* Make a copy so we can scribble on it */
02148     rev =  xstrdup (tag);
02149
02150     /* If revision exists, return the copy */
02151     if (RCS_exist_rev (rcs, tag))
02152         return rev;
02153
02154     /* Nope, none such. If tag is not a branch we're done. */
02155     i = numdots (rev);
02156     if ((i & 1) == 1 )
02157     {
02158         pa = strrchr (rev, '.');
02159         if (i == 1 || *(pa-1) != RCS_MAGIC_BRANCH || *(pa-2) != '.')
02160         {
02161         free (rev);
02162         error (1, 0, "revision `%s' does not exist", tag);
02163         }
02164     }
02165
02166     /* Try for a real (that is, exists in the RCS deltas) branch
02167        (RCS_exist_rev just checks for real revisions and revisions
02168        which have tags pointing to them).  */
02169     pa = RCS_getbranch (rcs, rev, 1);
02170     if (pa != NULL)
02171     {
02172         free (pa);
02173         return rev;
02174     }
02175
02176        /* Tag is branch, but does not exist, try corresponding
02177     * magic branch tag.
02178     *
02179     * FIXME: assumes all magic branches are of
02180     * form "n.n.n ... .0.n".  I'll fix if somebody can
02181     * send me a method to get a magic branch tag with
02182     * the 0 in some other position -- <dan@gasboy.com>
02183     */
02184     pa = strrchr (rev, '.');
02185     pb = xmalloc (strlen (rev) + 3);
02186     *pa++ = 0;
02187     (void) sprintf (pb, "%s.%d.%s", rev, RCS_MAGIC_BRANCH, pa);
02188     free (rev);
02189     rev = pb;
02190     if (RCS_exist_rev (rcs, rev))
02191         return rev;
02192     error (1, 0, "revision `%s' does not exist", tag);
02193     }
02194
02195
02196     RCS_check_tag (tag); /* exit if not a valid tag */
02197
02198     /* If tag is "HEAD", special case to get head RCS revision */
02199     if (tag && STREQ (tag, TAG_HEAD))
02200         return (RCS_head (rcs));
02201
02202     /* If valid tag let translate_symtag say yea or nay. */
02203     rev = translate_symtag (rcs, tag);
02204
02205     if (rev)
02206         return rev;
02207
02208     error (1, 0, "tag `%s' does not exist", tag);
02209     /* NOT REACHED -- error (1 ... ) does not return here */
02210     return 0;
02211 }
02212
02213 /*
02214  * Find the revision for a specific tag.
02215  * If force_tag_match is set, return NULL if an exact match is not
02216  * possible otherwise return RCS_head ().  We are careful to look for
02217  * and handle "magic" revisions specially.
02218  *
02219  * If the matched tag is a branch tag, find the head of the branch.
02220  *
02221  * Returns pointer to newly malloc'd string, or NULL.
02222  */
02223 char *
02224 RCS_gettag (rcs, symtag, force_tag_match, simple_tag)
02225     RCSNode *rcs;
02226     char *symtag;
02227     int force_tag_match;
02228     int *simple_tag;
02229 {
02230     char *tag = symtag;
02231     int tag_allocated = 0;
02232
02233     if (simple_tag != NULL)
02234     *simple_tag = 0;
02235
02236     /* make sure we have something to look at... */
02237     assert (rcs != NULL);
02238
02239     /* XXX this is probably not necessary, --jtc */
02240     if (rcs->flags & PARTIAL)
02241     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
02242
02243     /* If tag is "HEAD", special case to get head RCS revision */
02244     if (tag && (STREQ (tag, TAG_HEAD) || *tag == '\0'))
02245 #if 0 /* This #if 0 is only in the Cygnus code.  Why?  Death support?  */
02246     if (force_tag_match && (rcs->flags & VALID) && (rcs->flags & INATTIC))
02247         return ((char *) NULL); /* head request for removed file */
02248     else
02249 #endif
02250         return (RCS_head (rcs));
02251
02252     if (!isdigit ((unsigned char) tag[0]))
02253     {
02254     char *version;
02255
02256     /* If we got a symbolic tag, resolve it to a numeric */
02257     version = translate_symtag (rcs, tag);
02258     if (version != NULL)
02259     {
02260         int dots;
02261         char *magic, *branch, *cp;
02262
02263         tag = version;
02264         tag_allocated = 1;
02265
02266         /*
02267          * If this is a magic revision, we turn it into either its
02268          * physical branch equivalent (if one exists) or into
02269          * its base revision, which we assume exists.
02270          */
02271         dots = numdots (tag);
02272         if (dots > 2 && (dots & 1) != 0)
02273         {
02274         branch = strrchr (tag, '.');
02275         cp = branch++ - 1;
02276         while (*cp != '.')
02277             cp--;
02278
02279         /* see if we have .magic-branch. (".0.") */
02280         magic = xmalloc (strlen (tag) + 1);
02281         (void) sprintf (magic, ".%d.", RCS_MAGIC_BRANCH);
02282         if (strncmp (magic, cp, strlen (magic)) == 0)
02283         {
02284             /* it's magic.  See if the branch exists */
02285             *cp = '\0';     /* turn it into a revision */
02286             (void) sprintf (magic, "%s.%s", tag, branch);
02287             branch = RCS_getbranch (rcs, magic, 1);
02288             free (magic);
02289             if (branch != NULL)
02290             {
02291             free (tag);
02292             return (branch);
02293             }
02294             return (tag);
02295         }
02296         free (magic);
02297         }
02298     }
02299     else
02300     {
02301         /* The tag wasn't there, so return the head or NULL */
02302         if (force_tag_match)
02303         return (NULL);
02304         else
02305         return (RCS_head (rcs));
02306     }
02307     }
02308
02309     /*
02310      * numeric tag processing:
02311      *      1) revision number - just return it
02312      *      2) branch number   - find head of branch
02313      */
02314
02315     /* strip trailing dots */
02316     while (tag[strlen (tag) - 1] == '.')
02317     tag[strlen (tag) - 1] = '\0';
02318
02319     if ((numdots (tag) & 1) == 0)
02320     {
02321     char *branch;
02322
02323     /* we have a branch tag, so we need to walk the branch */
02324     branch = RCS_getbranch (rcs, tag, force_tag_match);
02325     if (tag_allocated)
02326         free (tag);
02327     return branch;
02328     }
02329     else
02330     {
02331     Node *p;
02332
02333     /* we have a revision tag, so make sure it exists */
02334     p = findnode (rcs->versions, tag);
02335     if (p != NULL)
02336     {
02337         /* We have found a numeric revision for the revision tag.
02338            To support expanding the RCS keyword Name, if
02339            SIMPLE_TAG is not NULL, tell the the caller that this
02340            is a simple tag which co will recognize.  FIXME: Are
02341            there other cases in which we should set this?  In
02342            particular, what if we expand RCS keywords internally
02343            without calling co?  */
02344         if (simple_tag != NULL)
02345         *simple_tag = 1;
02346         if (! tag_allocated)
02347         tag = xstrdup (tag);
02348         return (tag);
02349     }
02350     else
02351     {
02352         /* The revision wasn't there, so return the head or NULL */
02353         if (tag_allocated)
02354         free (tag);
02355         if (force_tag_match)
02356         return (NULL);
02357         else
02358         return (RCS_head (rcs));
02359     }
02360     }
02361 }
02362
02363 /*
02364  * Return a "magic" revision as a virtual branch off of REV for the RCS file.
02365  * A "magic" revision is one which is unique in the RCS file.  By unique, I
02366  * mean we return a revision which:
02367  *  - has a branch of 0 (see rcs.h RCS_MAGIC_BRANCH)
02368  *  - has a revision component which is not an existing branch off REV
02369  *  - has a revision component which is not an existing magic revision
02370  *  - is an even-numbered revision, to avoid conflicts with vendor branches
02371  * The first point is what makes it "magic".
02372  *
02373  * As an example, if we pass in 1.37 as REV, we will look for an existing
02374  * branch called 1.37.2.  If it did not exist, we would look for an
02375  * existing symbolic tag with a numeric part equal to 1.37.0.2.  If that
02376  * didn't exist, then we know that the 1.37.2 branch can be reserved by
02377  * creating a symbolic tag with 1.37.0.2 as the numeric part.
02378  *
02379  * This allows us to fork development with very little overhead -- just a
02380  * symbolic tag is used in the RCS file.  When a commit is done, a physical
02381  * branch is dynamically created to hold the new revision.
02382  *
02383  * Note: We assume that REV is an RCS revision and not a branch number.
02384  */
02385 static char *check_rev;
02386 char *
02387 RCS_magicrev (rcs, rev)
02388     RCSNode *rcs;
02389     char *rev;
02390 {
02391     int rev_num;
02392     char *xrev, *test_branch;
02393
02394     xrev = xmalloc (strlen (rev) + 14); /* enough for .0.number */
02395     check_rev = xrev;
02396
02397     /* only look at even numbered branches */
02398     for (rev_num = 2; ; rev_num += 2)
02399     {
02400     /* see if the physical branch exists */
02401     (void) sprintf (xrev, "%s.%d", rev, rev_num);
02402     test_branch = RCS_getbranch (rcs, xrev, 1);
02403     if (test_branch != NULL)    /* it did, so keep looking */
02404     {
02405         free (test_branch);
02406         continue;
02407     }
02408
02409     /* now, create a "magic" revision */
02410     (void) sprintf (xrev, "%s.%d.%d", rev, RCS_MAGIC_BRANCH, rev_num);
02411
02412     /* walk the symbols list to see if a magic one already exists */
02413     if (walklist (RCS_symbols(rcs), checkmagic_proc, NULL) != 0)
02414         continue;
02415
02416     /* we found a free magic branch.  Claim it as ours */
02417     return (xrev);
02418     }
02419 }
02420
02421 /*
02422  * walklist proc to look for a match in the symbols list.
02423  * Returns 0 if the symbol does not match, 1 if it does.
02424  */
02425 static int
02426 checkmagic_proc (p, closure)
02427     Node *p;
02428     void *closure;
02429 {
02430     if (STREQ (check_rev, p->data))
02431     return (1);
02432     else
02433     return (0);
02434 }
02435
02436 /*
02437  * Given an RCSNode, returns non-zero if the specified revision number
02438  * or symbolic tag resolves to a "branch" within the rcs file.
02439  *
02440  * FIXME: this is the same as RCS_nodeisbranch except for the special
02441  *        case for handling a null rcsnode.
02442  */
02443 int
02444 RCS_isbranch (rcs, rev)
02445     RCSNode *rcs;
02446     const char *rev;
02447 {
02448     /* numeric revisions are easy -- even number of dots is a branch */
02449     if (isdigit ((unsigned char) *rev))
02450     return ((numdots (rev) & 1) == 0);
02451
02452     /* assume a revision if you can't find the RCS info */
02453     if (rcs == NULL)
02454     return (0);
02455
02456     /* now, look for a match in the symbols list */
02457     return (RCS_nodeisbranch (rcs, rev));
02458 }
02459
02460 /*
02461  * Given an RCSNode, returns non-zero if the specified revision number
02462  * or symbolic tag resolves to a "branch" within the rcs file.  We do
02463  * take into account any magic branches as well.
02464  */
02465 int
02466 RCS_nodeisbranch (rcs, rev)
02467     RCSNode *rcs;
02468     const char *rev;
02469 {
02470     int dots;
02471     char *version;
02472
02473     assert (rcs != NULL);
02474
02475     /* numeric revisions are easy -- even number of dots is a branch */
02476     if (isdigit ((unsigned char) *rev))
02477     return ((numdots (rev) & 1) == 0);
02478
02479     version = translate_symtag (rcs, rev);
02480     if (version == NULL)
02481     return (0);
02482     dots = numdots (version);
02483     if ((dots & 1) == 0)
02484     {
02485     free (version);
02486     return (1);
02487     }
02488
02489     /* got a symbolic tag match, but it's not a branch; see if it's magic */
02490     if (dots > 2)
02491     {
02492     char *magic;
02493     char *branch = strrchr (version, '.');
02494     char *cp = branch - 1;
02495     while (*cp != '.')
02496         cp--;
02497
02498     /* see if we have .magic-branch. (".0.") */
02499     magic = xmalloc (strlen (version) + 1);
02500     (void) sprintf (magic, ".%d.", RCS_MAGIC_BRANCH);
02501     if (strncmp (magic, cp, strlen (magic)) == 0)
02502     {
02503         free (magic);
02504         free (version);
02505         return (1);
02506     }
02507     free (magic);
02508     }
02509     free (version);
02510     return (0);
02511 }
02512
02513 /*
02514  * Returns a pointer to malloc'ed memory which contains the branch
02515  * for the specified *symbolic* tag.  Magic branches are handled correctly.
02516  */
02517 char *
02518 RCS_whatbranch (rcs, rev)
02519     RCSNode *rcs;
02520     const char *rev;
02521 {
02522     char *version;
02523     int dots;
02524
02525     /* assume no branch if you can't find the RCS info */
02526     if (rcs == NULL)
02527     return ((char *) NULL);
02528
02529     /* now, look for a match in the symbols list */
02530     version = translate_symtag (rcs, rev);
02531     if (version == NULL)
02532     return ((char *) NULL);
02533     dots = numdots (version);
02534     if ((dots & 1) == 0)
02535     return (version);
02536
02537     /* got a symbolic tag match, but it's not a branch; see if it's magic */
02538     if (dots > 2)
02539     {
02540     char *magic;
02541     char *branch = strrchr (version, '.');
02542     char *cp = branch++ - 1;
02543     while (*cp != '.')
02544         cp--;
02545
02546     /* see if we have .magic-branch. (".0.") */
02547     magic = xmalloc (strlen (version) + 1);
02548     (void) sprintf (magic, ".%d.", RCS_MAGIC_BRANCH);
02549     if (strncmp (magic, cp, strlen (magic)) == 0)
02550     {
02551         /* yep.  it's magic.  now, construct the real branch */
02552         *cp = '\0';         /* turn it into a revision */
02553         (void) sprintf (magic, "%s.%s", version, branch);
02554         free (version);
02555         return (magic);
02556     }
02557     free (magic);
02558     }
02559     free (version);
02560     return ((char *) NULL);
02561 }
02562
02563 /*
02564  * Get the head of the specified branch.  If the branch does not exist,
02565  * return NULL or RCS_head depending on force_tag_match.
02566  * Returns NULL or a newly malloc'd string.
02567  */
02568 char *
02569 RCS_getbranch (rcs, tag, force_tag_match)
02570     RCSNode *rcs;
02571     char *tag;
02572     int force_tag_match;
02573 {
02574     Node *p, *head;
02575     RCSVers *vn;
02576     char *xtag;
02577     char *nextvers;
02578     char *cp;
02579
02580     /* make sure we have something to look at... */
02581     assert (rcs != NULL);
02582
02583     if (rcs->flags & PARTIAL)
02584     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
02585
02586     /* find out if the tag contains a dot, or is on the trunk */
02587     cp = strrchr (tag, '.');
02588
02589     /* trunk processing is the special case */
02590     if (cp == NULL)
02591     {
02592     xtag = xmalloc (strlen (tag) + 1 + 1);  /* +1 for an extra . */
02593     (void) strcpy (xtag, tag);
02594     (void) strcat (xtag, ".");
02595     for (cp = rcs->head; cp != NULL;)
02596     {
02597         if (strncmp (xtag, cp, strlen (xtag)) == 0)
02598         break;
02599         p = findnode (rcs->versions, cp);
02600         if (p == NULL)
02601         {
02602         free (xtag);
02603         if (force_tag_match)
02604             return (NULL);
02605         else
02606             return (RCS_head (rcs));
02607         }
02608         vn = (RCSVers *) p->data;
02609         cp = vn->next;
02610     }
02611     free (xtag);
02612     if (cp == NULL)
02613     {
02614         if (force_tag_match)
02615         return (NULL);
02616         else
02617         return (RCS_head (rcs));
02618     }
02619     return (xstrdup (cp));
02620     }
02621
02622     /* if it had a `.', terminate the string so we have the base revision */
02623     *cp = '\0';
02624
02625     /* look up the revision this branch is based on */
02626     p = findnode (rcs->versions, tag);
02627
02628     /* put the . back so we have the branch again */
02629     *cp = '.';
02630
02631     if (p == NULL)
02632     {
02633     /* if the base revision didn't exist, return head or NULL */
02634     if (force_tag_match)
02635         return (NULL);
02636     else
02637         return (RCS_head (rcs));
02638     }
02639
02640     /* find the first element of the branch we are looking for */
02641     vn = (RCSVers *) p->data;
02642     if (vn->branches == NULL)
02643     return (NULL);
02644     xtag = xmalloc (strlen (tag) + 1 + 1);  /* 1 for the extra '.' */
02645     (void) strcpy (xtag, tag);
02646     (void) strcat (xtag, ".");
02647     head = vn->branches->list;
02648     for (p = head->next; p != head; p = p->next)
02649     if (strncmp (p->key, xtag, strlen (xtag)) == 0)
02650         break;
02651     free (xtag);
02652
02653     if (p == head)
02654     {
02655     /* we didn't find a match so return head or NULL */
02656     if (force_tag_match)
02657         return (NULL);
02658     else
02659         return (RCS_head (rcs));
02660     }
02661
02662     /* now walk the next pointers of the branch */
02663     nextvers = p->key;
02664     do
02665     {
02666     p = findnode (rcs->versions, nextvers);
02667     if (p == NULL)
02668     {
02669         /* a link in the chain is missing - return head or NULL */
02670         if (force_tag_match)
02671         return (NULL);
02672         else
02673         return (RCS_head (rcs));
02674     }
02675     vn = (RCSVers *) p->data;
02676     nextvers = vn->next;
02677     } while (nextvers != NULL);
02678
02679     /* we have the version in our hand, so go for it */
02680     return (xstrdup (vn->version));
02681 }
02682
02683 /* Returns the head of the branch which REV is on.  REV can be a
02684    branch tag or non-branch tag; symbolic or numeric.
02685
02686    Returns a newly malloc'd string.  Returns NULL if a symbolic name
02687    isn't found.  */
02688
02689 char *
02690 RCS_branch_head (rcs, rev)
02691     RCSNode *rcs;
02692     char *rev;
02693 {
02694     char *num;
02695     char *br;
02696     char *retval;
02697
02698     assert (rcs != NULL);
02699
02700     if (RCS_nodeisbranch (rcs, rev))
02701     return RCS_getbranch (rcs, rev, 1);
02702
02703     if (isdigit ((unsigned char) *rev))
02704     num = xstrdup (rev);
02705     else
02706     {
02707     num = translate_symtag (rcs, rev);
02708     if (num == NULL)
02709         return NULL;
02710     }
02711     br = truncate_revnum (num);
02712     retval = RCS_getbranch (rcs, br, 1);
02713     free (br);
02714     free (num);
02715     return retval;
02716 }
02717
02718 /* Get the branch point for a particular branch, that is the first
02719    revision on that branch.  For example, RCS_getbranchpoint (rcs,
02720    "1.3.2") will normally return "1.3.2.1".  TARGET may be either a
02721    branch number or a revision number; if a revnum, find the
02722    branchpoint of the branch to which TARGET belongs.
02723
02724    Return RCS_head if TARGET is on the trunk or if the root node could
02725    not be found (this is sort of backwards from our behavior on a branch;
02726    the rationale is that the return value is a revision from which you
02727    can start walking the next fields and end up at TARGET).
02728    Return NULL on error.  */
02729
02730 static char *
02731 RCS_getbranchpoint (rcs, target)
02732     RCSNode *rcs;
02733     char *target;
02734 {
02735     char *branch, *bp;
02736     Node *vp;
02737     RCSVers *rev;
02738     int dots, isrevnum, brlen;
02739
02740     dots = numdots (target);
02741     isrevnum = dots & 1;
02742
02743     if (dots == 1)
02744     /* TARGET is a trunk revision; return rcs->head. */
02745     return (RCS_head (rcs));
02746
02747     /* Get the revision number of the node at which TARGET's branch is
02748        rooted.  If TARGET is a branch number, lop off the last field;
02749        if it's a revision number, lop off the last *two* fields. */
02750     branch = xstrdup (target);
02751     bp = strrchr (branch, '.');
02752     if (bp == NULL)
02753     error (1, 0, "%s: confused revision number %s",
02754            rcs->path, target);
02755     if (isrevnum)
02756     while (*--bp != '.')
02757         ;
02758     *bp = '\0';
02759
02760     vp = findnode (rcs->versions, branch);
02761     if (vp == NULL)
02762     {
02763     error (0, 0, "%s: can't find branch point %s", rcs->path, target);
02764     return NULL;
02765     }
02766     rev = (RCSVers *) vp->data;
02767
02768     *bp++ = '.';
02769     while (*bp && *bp != '.')
02770     ++bp;
02771     brlen = bp - branch;
02772
02773     vp = rev->branches->list->next;
02774     while (vp != rev->branches->list)
02775     {
02776     /* BRANCH may be a genuine branch number, e.g. `1.1.3', or
02777        maybe a full revision number, e.g. `1.1.3.6'.  We have
02778        found our branch point if the first BRANCHLEN characters
02779        of the revision number match, *and* if the following
02780        character is a dot. */
02781     if (strncmp (vp->key, branch, brlen) == 0 && vp->key[brlen] == '.')
02782         break;
02783     vp = vp->next;
02784     }
02785
02786     free (branch);
02787     if (vp == rev->branches->list)
02788     {
02789     error (0, 0, "%s: can't find branch point %s", rcs->path, target);
02790     return NULL;
02791     }
02792     else
02793     return (xstrdup (vp->key));
02794 }
02795
02796 /*
02797  * Get the head of the RCS file.  If branch is set, this is the head of the
02798  * branch, otherwise the real head.
02799  * Returns NULL or a newly malloc'd string.
02800  */
02801 char *
02802 RCS_head (rcs)
02803     RCSNode *rcs;
02804 {
02805     /* make sure we have something to look at... */
02806     assert (rcs != NULL);
02807
02808     /*
02809      * NOTE: we call getbranch with force_tag_match set to avoid any
02810      * possibility of recursion
02811      */
02812     if (rcs->branch)
02813     return (RCS_getbranch (rcs, rcs->branch, 1));
02814     else
02815     return (xstrdup (rcs->head));
02816 }
02817
02818 /*
02819  * Get the most recent revision, based on the supplied date, but use some
02820  * funky stuff and follow the vendor branch maybe
02821  */
02822 char *
02823 RCS_getdate (rcs, date, force_tag_match)
02824     RCSNode *rcs;
02825     char *date;
02826     int force_tag_match;
02827 {
02828     char *cur_rev = NULL;
02829     char *retval = NULL;
02830     Node *p;
02831     RCSVers *vers = NULL;
02832
02833     /* make sure we have something to look at... */
02834     assert (rcs != NULL);
02835
02836     if (rcs->flags & PARTIAL)
02837     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
02838
02839     /* if the head is on a branch, try the branch first */
02840     if (rcs->branch != NULL)
02841     retval = RCS_getdatebranch (rcs, date, rcs->branch);
02842
02843     /* if we found a match, we are done */
02844     if (retval != NULL)
02845     return (retval);
02846
02847     /* otherwise if we have a trunk, try it */
02848     if (rcs->head)
02849     {
02850     p = findnode (rcs->versions, rcs->head);
02851     while (p != NULL)
02852     {
02853         /* if the date of this one is before date, take it */
02854         vers = (RCSVers *) p->data;
02855         if (RCS_datecmp (vers->date, date) <= 0)
02856         {
02857         cur_rev = vers->version;
02858         break;
02859         }
02860
02861         /* if there is a next version, find the node */
02862         if (vers->next != NULL)
02863         p = findnode (rcs->versions, vers->next);
02864         else
02865         p = (Node *) NULL;
02866     }
02867     }
02868
02869     /*
02870      * at this point, either we have the revision we want, or we have the
02871      * first revision on the trunk (1.1?) in our hands
02872      */
02873
02874     /* if we found what we're looking for, and it's not 1.1 return it */
02875     if (cur_rev != NULL)
02876     {
02877     if (! STREQ (cur_rev, "1.1"))
02878         return (xstrdup (cur_rev));
02879
02880     /* This is 1.1;  if the date of 1.1 is not the same as that for the
02881        1.1.1.1 version, then return 1.1.  This happens when the first
02882        version of a file is created by a regular cvs add and commit,
02883        and there is a subsequent cvs import of the same file.  */
02884     p = findnode (rcs->versions, "1.1.1.1");
02885     if (p)
02886     {
02887         vers = (RCSVers *) p->data;
02888         if (RCS_datecmp (vers->date, date) != 0)
02889         return xstrdup ("1.1");
02890     }
02891     }
02892
02893     /* look on the vendor branch */
02894     retval = RCS_getdatebranch (rcs, date, CVSBRANCH);
02895
02896     /*
02897      * if we found a match, return it; otherwise, we return the first
02898      * revision on the trunk or NULL depending on force_tag_match and the
02899      * date of the first rev
02900      */
02901     if (retval != NULL)
02902     return (retval);
02903
02904     if (!force_tag_match || RCS_datecmp (vers->date, date) <= 0)
02905     return (xstrdup (vers->version));
02906     else
02907     return (NULL);
02908 }
02909
02910 /*
02911  * Look up the last element on a branch that was put in before the specified
02912  * date (return the rev or NULL)
02913  */
02914 static char *
02915 RCS_getdatebranch (rcs, date, branch)
02916     RCSNode *rcs;
02917     char *date;
02918     char *branch;
02919 {
02920     char *cur_rev = NULL;
02921     char *cp;
02922     char *xbranch, *xrev;
02923     Node *p;
02924     RCSVers *vers;
02925
02926     /* look up the first revision on the branch */
02927     xrev = xstrdup (branch);
02928     cp = strrchr (xrev, '.');
02929     if (cp == NULL)
02930     {
02931     free (xrev);
02932     return (NULL);
02933     }
02934     *cp = '\0';             /* turn it into a revision */
02935
02936     assert (rcs != NULL);
02937
02938     if (rcs->flags & PARTIAL)
02939     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
02940
02941     p = findnode (rcs->versions, xrev);
02942     free (xrev);
02943     if (p == NULL)
02944     return (NULL);
02945     vers = (RCSVers *) p->data;
02946
02947     /* Tentatively use this revision, if it is early enough.  */
02948     if (RCS_datecmp (vers->date, date) <= 0)
02949     cur_rev = vers->version;
02950
02951     /* If no branches list, return now.  This is what happens if the branch
02952        is a (magic) branch with no revisions yet.  */
02953     if (vers->branches == NULL)
02954     return xstrdup (cur_rev);
02955
02956     /* walk the branches list looking for the branch number */
02957     xbranch = xmalloc (strlen (branch) + 1 + 1); /* +1 for the extra dot */
02958     (void) strcpy (xbranch, branch);
02959     (void) strcat (xbranch, ".");
02960     for (p = vers->branches->list->next; p != vers->branches->list; p = p->next)
02961     if (strncmp (p->key, xbranch, strlen (xbranch)) == 0)
02962         break;
02963     free (xbranch);
02964     if (p == vers->branches->list)
02965     {
02966     /* This is what happens if the branch is a (magic) branch with
02967        no revisions yet.  Similar to the case where vers->branches ==
02968        NULL, except here there was a another branch off the same
02969        branchpoint.  */
02970     return xstrdup (cur_rev);
02971     }
02972
02973     p = findnode (rcs->versions, p->key);
02974
02975     /* walk the next pointers until you find the end, or the date is too late */
02976     while (p != NULL)
02977     {
02978     vers = (RCSVers *) p->data;
02979     if (RCS_datecmp (vers->date, date) <= 0)
02980         cur_rev = vers->version;
02981     else
02982         break;
02983
02984     /* if there is a next version, find the node */
02985     if (vers->next != NULL)
02986         p = findnode (rcs->versions, vers->next);
02987     else
02988         p = (Node *) NULL;
02989     }
02990
02991     /* Return whatever we found, which may be NULL.  */
02992     return xstrdup (cur_rev);
02993 }
02994
02995 /*
02996  * Compare two dates in RCS format. Beware the change in format on January 1,
02997  * 2000, when years go from 2-digit to full format.
02998  */
02999 int
03000 RCS_datecmp (date1, date2)
03001     char *date1, *date2;
03002 {
03003     int length_diff = strlen (date1) - strlen (date2);
03004
03005     return (length_diff ? length_diff : strcmp (date1, date2));
03006 }
03007
03008 /* Look up revision REV in RCS and return the date specified for the
03009    revision minus FUDGE seconds (FUDGE will generally be one, so that the
03010    logically previous revision will be found later, or zero, if we want
03011    the exact date).
03012
03013    The return value is the date being returned as a time_t, or (time_t)-1
03014    on error (previously was documented as zero on error; I haven't checked
03015    the callers to make sure that they really check for (time_t)-1, but
03016    the latter is what this function really returns).  If DATE is non-NULL,
03017    then it must point to MAXDATELEN characters, and we store the same
03018    return value there in DATEFORM format.  */
03019 time_t
03020 RCS_getrevtime (rcs, rev, date, fudge)
03021     RCSNode *rcs;
03022     char *rev;
03023     char *date;
03024     int fudge;
03025 {
03026     char tdate[MAXDATELEN];
03027     struct tm xtm, *ftm;
03028     time_t revdate = 0;
03029     Node *p;
03030     RCSVers *vers;
03031
03032     /* make sure we have something to look at... */
03033     assert (rcs != NULL);
03034
03035     if (rcs->flags & PARTIAL)
03036     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
03037
03038     /* look up the revision */
03039     p = findnode (rcs->versions, rev);
03040     if (p == NULL)
03041     return (-1);
03042     vers = (RCSVers *) p->data;
03043
03044     /* split up the date */
03045     ftm = &xtm;
03046     (void) sscanf (vers->date, SDATEFORM, &ftm->tm_year, &ftm->tm_mon,
03047            &ftm->tm_mday, &ftm->tm_hour, &ftm->tm_min,
03048            &ftm->tm_sec);
03049
03050     /* If the year is from 1900 to 1999, RCS files contain only two
03051        digits, and sscanf gives us a year from 0-99.  If the year is
03052        2000+, RCS files contain all four digits and we subtract 1900,
03053        because the tm_year field should contain years since 1900.  */
03054
03055     if (ftm->tm_year > 1900)
03056     ftm->tm_year -= 1900;
03057
03058     /* put the date in a form getdate can grok */
03059     (void) sprintf (tdate, "%d/%d/%d GMT %d:%d:%d", ftm->tm_mon,
03060             ftm->tm_mday, ftm->tm_year + 1900, ftm->tm_hour,
03061             ftm->tm_min, ftm->tm_sec);
03062
03063     /* turn it into seconds since the epoch */
03064     revdate = get_date (tdate, (struct timeb *) NULL);
03065     if (revdate != (time_t) -1)
03066     {
03067     revdate -= fudge;       /* remove "fudge" seconds */
03068     if (date)
03069     {
03070         /* put an appropriate string into ``date'' if we were given one */
03071         ftm = gmtime (&revdate);
03072         (void) sprintf (date, DATEFORM,
03073                 ftm->tm_year + (ftm->tm_year < 100 ? 0 : 1900),
03074                 ftm->tm_mon + 1, ftm->tm_mday, ftm->tm_hour,
03075                 ftm->tm_min, ftm->tm_sec);
03076     }
03077     }
03078     return (revdate);
03079 }
03080
03081 List *
03082 RCS_getlocks (rcs)
03083     RCSNode *rcs;
03084 {
03085     assert(rcs != NULL);
03086
03087     if (rcs->flags & PARTIAL)
03088     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
03089
03090     if (rcs->locks_data) {
03091     rcs->locks = getlist ();
03092     do_locks (rcs->locks, rcs->locks_data);
03093     free(rcs->locks_data);
03094     rcs->locks_data = NULL;
03095     }
03096
03097     return rcs->locks;
03098 }
03099
03100 List *
03101 RCS_symbols(rcs)
03102     RCSNode *rcs;
03103 {
03104     assert(rcs != NULL);
03105
03106     if (rcs->flags & PARTIAL)
03107     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
03108
03109     if (rcs->symbols_data) {
03110     rcs->symbols = getlist ();
03111     do_symbols (rcs->symbols, rcs->symbols_data);
03112     free(rcs->symbols_data);
03113     rcs->symbols_data = NULL;
03114     }
03115
03116     return rcs->symbols;
03117 }
03118
03119 /*
03120  * Return the version associated with a particular symbolic tag.
03121  * Returns NULL or a newly malloc'd string.
03122  */
03123 static char *
03124 translate_symtag (rcs, tag)
03125     RCSNode *rcs;
03126     const char *tag;
03127 {
03128     if (rcs->flags & PARTIAL)
03129     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
03130
03131     if (rcs->symbols != NULL)
03132     {
03133     Node *p;
03134
03135     /* The symbols have already been converted into a list.  */
03136     p = findnode (rcs->symbols, tag);
03137     if (p == NULL)
03138         return NULL;
03139
03140     return xstrdup (p->data);
03141     }
03142
03143     if (rcs->symbols_data != NULL)
03144     {
03145     size_t len;
03146     char *cp;
03147
03148     /* Look through the RCS symbols information.  This is like
03149            do_symbols, but we don't add the information to a list.  In
03150            most cases, we will only be called once for this file, so
03151            generating the list is unnecessary overhead.  */
03152
03153     len = strlen (tag);
03154     cp = rcs->symbols_data;
03155     while ((cp = strchr (cp, tag[0])) != NULL)
03156     {
03157         if ((cp == rcs->symbols_data || whitespace (cp[-1]))
03158         && strncmp (cp, tag, len) == 0
03159         && cp[len] == ':')
03160         {
03161         char *v, *r;
03162
03163         /* We found the tag.  Return the version number.  */
03164
03165         cp += len + 1;
03166         v = cp;
03167         while (! whitespace (*cp) && *cp != '\0')
03168             ++cp;
03169         r = xmalloc (cp - v + 1);
03170         strncpy (r, v, cp - v);
03171         r[cp - v] = '\0';
03172         return r;
03173         }
03174
03175         while (! whitespace (*cp) && *cp != '\0')
03176         ++cp;
03177     }
03178     }
03179
03180     return NULL;
03181 }
03182
03183 /*
03184  * The argument ARG is the getopt remainder of the -k option specified on the
03185  * command line.  This function returns malloc'ed space that can be used
03186  * directly in calls to RCS V5, with the -k flag munged correctly.
03187  */
03188 char *
03189 RCS_check_kflag (arg)
03190     const char *arg;
03191 {
03192     static const char *const  keyword_usage[] =
03193     {
03194       "%s %s: invalid RCS keyword expansion mode\n",
03195       "Valid expansion modes include:\n",
03196       "   -kkv\tGenerate keywords using the default form.\n",
03197       "   -kkvl\tLike -kkv, except locker's name inserted.\n",
03198       "   -kk\tGenerate only keyword names in keyword strings.\n",
03199       "   -kv\tGenerate only keyword values in keyword strings.\n",
03200       "   -ko\tGenerate the old keyword string (no changes from checked in file).\n",
03201       "   -kb\tGenerate binary file unmodified (merges not allowed) (RCS 5.7).\n",
03202       "(Specify the --help global option for a list of other help options)\n",
03203       NULL,
03204     };
03205     /* Big enough to hold any of the strings from kflags.  */
03206     char karg[10];
03207     char const *const *cpp = NULL;
03208
03209     if (arg)
03210     {
03211     for (cpp = kflags; *cpp != NULL; cpp++)
03212     {
03213         if (STREQ (arg, *cpp))
03214         break;
03215     }
03216     }
03217
03218     if (arg == NULL || *cpp == NULL)
03219     {
03220     usage (keyword_usage);
03221     }
03222
03223     (void) sprintf (karg, "-k%s", *cpp);
03224     return (xstrdup (karg));
03225 }
03226
03227 /*
03228  * Do some consistency checks on the symbolic tag... These should equate
03229  * pretty close to what RCS checks, though I don't know for certain.
03230  */
03231 void
03232 RCS_check_tag (tag)
03233     const char *tag;
03234 {
03235     char *invalid = "$,.:;@";       /* invalid RCS tag characters */
03236     const char *cp;
03237
03238     /*
03239      * The first character must be an alphabetic letter. The remaining
03240      * characters cannot be non-visible graphic characters, and must not be
03241      * in the set of "invalid" RCS identifier characters.
03242      */
03243     if (isalpha ((unsigned char) *tag))
03244     {
03245     for (cp = tag; *cp; cp++)
03246     {
03247         if (!isgraph ((unsigned char) *cp))
03248         error (1, 0, "tag `%s' has non-visible graphic characters",
03249                tag);
03250         if (strchr (invalid, *cp))
03251         error (1, 0, "tag `%s' must not contain the characters `%s'",
03252                tag, invalid);
03253     }
03254     }
03255     else
03256     error (1, 0, "tag `%s' must start with a letter", tag);
03257 }
03258
03259 /*
03260  * TRUE if argument has valid syntax for an RCS revision or
03261  * branch number.  All characters must be digits or dots, first
03262  * and last characters must be digits, and no two consecutive
03263  * characters may be dots.
03264  *
03265  * Intended for classifying things, so this function doesn't
03266  * call error.
03267  */
03268 int
03269 RCS_valid_rev (rev)
03270     char *rev;
03271 {
03272    char last, c;
03273    last = *rev++;
03274    if (!isdigit ((unsigned char) last))
03275        return 0;
03276    while ((c = *rev++))   /* Extra parens placate -Wall gcc option */
03277    {
03278        if (c == '.')
03279        {
03280            if (last == '.')
03281                return 0;
03282            continue;
03283        }
03284        last = c;
03285        if (!isdigit ((unsigned char) c))
03286            return 0;
03287    }
03288    if (!isdigit ((unsigned char) last))
03289        return 0;
03290    return 1;
03291 }
03292
03293 /*
03294  * Return true if RCS revision with TAG is a dead revision.
03295  */
03296 int
03297 RCS_isdead (rcs, tag)
03298     RCSNode *rcs;
03299     const char *tag;
03300 {
03301     Node *p;
03302     RCSVers *version;
03303
03304     if (rcs->flags & PARTIAL)
03305     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
03306
03307     p = findnode (rcs->versions, tag);
03308     if (p == NULL)
03309     return (0);
03310
03311     version = (RCSVers *) p->data;
03312     return (version->dead);
03313 }
03314
03315 /* Return the RCS keyword expansion mode.  For example "b" for binary.
03316    Returns a pointer into storage which is allocated and freed along with
03317    the rest of the RCS information; the caller should not modify this
03318    storage.  Returns NULL if the RCS file does not specify a keyword
03319    expansion mode; for all other errors, die with a fatal error.  */
03320 char *
03321 RCS_getexpand (rcs)
03322     RCSNode *rcs;
03323 {
03324     /* Since RCS_parsercsfile_i now reads expand, don't need to worry
03325        about RCS_reparsercsfile.  */
03326     assert (rcs != NULL);
03327     return rcs->expand;
03328 }
03329
03330 /* Set keyword expansion mode to EXPAND.  For example "b" for binary.  */
03331 void
03332 RCS_setexpand (rcs, expand)
03333     RCSNode *rcs;
03334     char *expand;
03335 {
03336     /* Since RCS_parsercsfile_i now reads expand, don't need to worry
03337        about RCS_reparsercsfile.  */
03338     assert (rcs != NULL);
03339     if (rcs->expand != NULL)
03340     free (rcs->expand);
03341     rcs->expand = xstrdup (expand);
03342 }
03343
03344 /* RCS keywords, and a matching enum.  */
03345 struct rcs_keyword
03346 {
03347     const char *string;
03348     size_t len;
03349 };
03350 #define KEYWORD_INIT(s) (s), sizeof (s) - 1
03351 static const struct rcs_keyword keywords[] =
03352 {
03353     { KEYWORD_INIT ("Author") },
03354     { KEYWORD_INIT ("Date") },
03355     { KEYWORD_INIT ("Header") },
03356     { KEYWORD_INIT ("Id") },
03357     { KEYWORD_INIT ("Locker") },
03358     { KEYWORD_INIT ("Log") },
03359     { KEYWORD_INIT ("Name") },
03360     { KEYWORD_INIT ("RCSfile") },
03361     { KEYWORD_INIT ("Revision") },
03362     { KEYWORD_INIT ("Source") },
03363     { KEYWORD_INIT ("State") },
03364     { NULL, 0 }
03365 };
03366 enum keyword
03367 {
03368     KEYWORD_AUTHOR = 0,
03369     KEYWORD_DATE,
03370     KEYWORD_HEADER,
03371     KEYWORD_ID,
03372     KEYWORD_LOCKER,
03373     KEYWORD_LOG,
03374     KEYWORD_NAME,
03375     KEYWORD_RCSFILE,
03376     KEYWORD_REVISION,
03377     KEYWORD_SOURCE,
03378     KEYWORD_STATE
03379 };
03380
03381 /* Convert an RCS date string into a readable string.  This is like
03382    the RCS date2str function.  */
03383
03384 static char *
03385 printable_date (rcs_date)
03386      const char *rcs_date;
03387 {
03388     int year, mon, mday, hour, min, sec;
03389     char buf[100];
03390
03391     (void) sscanf (rcs_date, SDATEFORM, &year, &mon, &mday, &hour, &min,
03392            &sec);
03393     if (year < 1900)
03394     year += 1900;
03395     sprintf (buf, "%04d/%02d/%02d %02d:%02d:%02d", year, mon, mday,
03396          hour, min, sec);
03397     return xstrdup (buf);
03398 }
03399
03400 /* Escape the characters in a string so that it can be included in an
03401    RCS value.  */
03402
03403 static char *
03404 escape_keyword_value (value, free_value)
03405      const char *value;
03406      int *free_value;
03407 {
03408     char *ret, *t;
03409     const char *s;
03410
03411     for (s = value; *s != '\0'; s++)
03412     {
03413     char c;
03414
03415     c = *s;
03416     if (c == '\t'
03417         || c == '\n'
03418         || c == '\\'
03419         || c == ' '
03420         || c == '$')
03421     {
03422         break;
03423     }
03424     }
03425
03426     if (*s == '\0')
03427     {
03428     *free_value = 0;
03429     return (char *) value;
03430     }
03431
03432     ret = xmalloc (strlen (value) * 4 + 1);
03433     *free_value = 1;
03434
03435     for (s = value, t = ret; *s != '\0'; s++, t++)
03436     {
03437     switch (*s)
03438     {
03439     default:
03440         *t = *s;
03441         break;
03442     case '\t':
03443         *t++ = '\\';
03444         *t = 't';
03445         break;
03446     case '\n':
03447         *t++ = '\\';
03448         *t = 'n';
03449         break;
03450     case '\\':
03451         *t++ = '\\';
03452         *t = '\\';
03453         break;
03454     case ' ':
03455         *t++ = '\\';
03456         *t++ = '0';
03457         *t++ = '4';
03458         *t = '0';
03459         break;
03460     case '$':
03461         *t++ = '\\';
03462         *t++ = '0';
03463         *t++ = '4';
03464         *t = '4';
03465         break;
03466     }
03467     }
03468
03469     *t = '\0';
03470
03471     return ret;
03472 }
03473
03474 /* Expand RCS keywords in the memory buffer BUF of length LEN.  This
03475    applies to file RCS and version VERS.  If NAME is not NULL, and is
03476    not a numeric revision, then it is the symbolic tag used for the
03477    checkout.  EXPAND indicates how to expand the keywords.  This
03478    function sets *RETBUF and *RETLEN to the new buffer and length.
03479    This function may modify the buffer BUF.  If BUF != *RETBUF, then
03480    RETBUF is a newly allocated buffer.  */
03481
03482 static void
03483 expand_keywords (rcs, ver, name, log, loglen, expand, buf, len, retbuf, retlen)
03484      RCSNode *rcs;
03485      RCSVers *ver;
03486      const char *name;
03487      const char *log;
03488      size_t loglen;
03489      enum kflag expand;
03490      char *buf;
03491      size_t len;
03492      char **retbuf;
03493      size_t *retlen;
03494 {
03495     struct expand_buffer
03496     {
03497     struct expand_buffer *next;
03498     char *data;
03499     size_t len;
03500     int free_data;
03501     } *ebufs = NULL;
03502     struct expand_buffer *ebuf_last = NULL;
03503     size_t ebuf_len = 0;
03504     char *locker;
03505     char *srch, *srch_next;
03506     size_t srch_len;
03507
03508     if (expand == KFLAG_O || expand == KFLAG_B)
03509     {
03510     *retbuf = buf;
03511     *retlen = len;
03512     return;
03513     }
03514
03515     /* If we are using -kkvl, dig out the locker information if any.  */
03516     locker = NULL;
03517     if (expand == KFLAG_KVL)
03518     {
03519     Node *lock;
03520     lock = findnode (RCS_getlocks(rcs), ver->version);
03521     if (lock != NULL)
03522         locker = xstrdup (lock->data);
03523     }
03524
03525     /* RCS keywords look like $STRING$ or $STRING: VALUE$.  */
03526     srch = buf;
03527     srch_len = len;
03528     while ((srch_next = memchr (srch, '$', srch_len)) != NULL)
03529     {
03530     char *s, *send;
03531     size_t slen;
03532     const struct rcs_keyword *keyword;
03533     enum keyword kw;
03534     char *value;
03535     int free_value;
03536     char *sub;
03537     size_t sublen;
03538
03539     srch_len -= (srch_next + 1) - srch;
03540     srch = srch_next + 1;
03541
03542     /* Look for the first non alphabetic character after the '$'.  */
03543     send = srch + srch_len;
03544     for (s = srch; s < send; s++)
03545         if (! isalpha ((unsigned char) *s))
03546         break;
03547
03548     /* If the first non alphabetic character is not '$' or ':',
03549            then this is not an RCS keyword.  */
03550     if (s == send || (*s != '$' && *s != ':'))
03551         continue;
03552
03553     /* See if this is one of the keywords.  */
03554     slen = s - srch;
03555     for (keyword = keywords; keyword->string != NULL; keyword++)
03556     {
03557         if (keyword->len == slen
03558         && strncmp (keyword->string, srch, slen) == 0)
03559         {
03560         break;
03561         }
03562     }
03563     if (keyword->string == NULL)
03564         continue;
03565
03566     kw = (enum keyword) (keyword - keywords);
03567
03568     /* If the keyword ends with a ':', then the old value consists
03569            of the characters up to the next '$'.  If there is no '$'
03570            before the end of the line, though, then this wasn't an RCS
03571            keyword after all.  */
03572     if (*s == ':')
03573     {
03574         for (; s < send; s++)
03575         if (*s == '$' || *s == '\n')
03576             break;
03577         if (s == send || *s != '$')
03578         continue;
03579     }
03580
03581     /* At this point we must replace the string from SRCH to S
03582            with the expansion of the keyword KW.  */
03583
03584     /* Get the value to use.  */
03585     free_value = 0;
03586     if (expand == KFLAG_K)
03587         value = NULL;
03588     else
03589     {
03590         switch (kw)
03591         {
03592         default:
03593         abort ();
03594
03595         case KEYWORD_AUTHOR:
03596         value = ver->author;
03597         break;
03598
03599         case KEYWORD_DATE:
03600         value = printable_date (ver->date);
03601         free_value = 1;
03602         break;
03603
03604         case KEYWORD_HEADER:
03605         case KEYWORD_ID:
03606         {
03607             char *path;
03608             int free_path;
03609             char *date;
03610
03611             if (kw == KEYWORD_HEADER)
03612             path = rcs->path;
03613             else
03614             path = last_component (rcs->path);
03615             path = escape_keyword_value (path, &free_path);
03616             date = printable_date (ver->date);
03617             value = xmalloc (strlen (path)
03618                      + strlen (ver->version)
03619                      + strlen (date)
03620                      + strlen (ver->author)
03621                      + strlen (ver->state)
03622                      + (locker == NULL ? 0 : strlen (locker))
03623                      + 20);
03624
03625             sprintf (value, "%s %s %s %s %s%s%s",
03626                  path, ver->version, date, ver->author,
03627                  ver->state,
03628                  locker != NULL ? " " : "",
03629                  locker != NULL ? locker : "");
03630             if (free_path)
03631             free (path);
03632             free (date);
03633             free_value = 1;
03634         }
03635         break;
03636
03637         case KEYWORD_LOCKER:
03638         value = locker;
03639         break;
03640
03641         case KEYWORD_LOG:
03642         case KEYWORD_RCSFILE:
03643         value = escape_keyword_value (last_component (rcs->path),
03644                           &free_value);
03645         break;
03646
03647         case KEYWORD_NAME:
03648         if (name != NULL && ! isdigit ((unsigned char) *name))
03649             value = (char *) name;
03650         else
03651             value = NULL;
03652         break;
03653
03654         case KEYWORD_REVISION:
03655         value = ver->version;
03656         break;
03657
03658         case KEYWORD_SOURCE:
03659         value = escape_keyword_value (rcs->path, &free_value);
03660         break;
03661
03662         case KEYWORD_STATE:
03663         value = ver->state;
03664         break;
03665         }
03666     }
03667
03668     sub = xmalloc (keyword->len
03669                + (value == NULL ? 0 : strlen (value))
03670                + 10);
03671     if (expand == KFLAG_V)
03672     {
03673         /* Decrement SRCH and increment S to remove the $
03674                characters.  */
03675         --srch;
03676         ++srch_len;
03677         ++s;
03678         sublen = 0;
03679     }
03680     else
03681     {
03682         strcpy (sub, keyword->string);
03683         sublen = strlen (keyword->string);
03684         if (expand != KFLAG_K)
03685         {
03686         sub[sublen] = ':';
03687         sub[sublen + 1] = ' ';
03688         sublen += 2;
03689         }
03690     }
03691     if (value != NULL)
03692     {
03693         strcpy (sub + sublen, value);
03694         sublen += strlen (value);
03695     }
03696     if (expand != KFLAG_V && expand != KFLAG_K)
03697     {
03698         sub[sublen] = ' ';
03699         ++sublen;
03700         sub[sublen] = '\0';
03701     }
03702
03703     if (free_value)
03704         free (value);
03705
03706     /* The Log keyword requires special handling.  This behaviour
03707            is taken from RCS 5.7.  The special log message is what RCS
03708            uses for ci -k.  */
03709     if (kw == KEYWORD_LOG
03710         && (sizeof "checked in with -k by " <= loglen
03711         || log == NULL
03712         || strncmp (log, "checked in with -k by ",
03713                 sizeof "checked in with -k by " - 1) != 0))
03714     {
03715         char *start;
03716         char *leader;
03717         size_t leader_len, leader_sp_len;
03718         const char *logend;
03719         const char *snl;
03720         int cnl;
03721         char *date;
03722         const char *sl;
03723
03724         /* We are going to insert the trailing $ ourselves, before
03725                the log message, so we must remove it from S, if we
03726                haven't done so already.  */
03727         if (expand != KFLAG_V)
03728         ++s;
03729
03730         /* CVS never has empty log messages, but old RCS files might.  */
03731         if (log == NULL)
03732         log = "";
03733
03734         /* Find the start of the line.  */
03735         start = srch;
03736         while (start > buf && start[-1] != '\n')
03737         --start;
03738
03739         /* Copy the start of the line to use as a comment leader.  */
03740         leader_len = srch - start;
03741         if (expand != KFLAG_V)
03742         --leader_len;
03743         leader = xmalloc (leader_len);
03744         memcpy (leader, start, leader_len);
03745         leader_sp_len = leader_len;
03746         while (leader_sp_len > 0 && leader[leader_sp_len - 1] == ' ')
03747         --leader_sp_len;
03748
03749         /* RCS does some checking for an old style of Log here,
03750            but we don't bother.  RCS issues a warning if it
03751            changes anything.  */
03752
03753         /* Count the number of newlines in the log message so that
03754            we know how many copies of the leader we will need.  */
03755         cnl = 0;
03756         logend = log + loglen;
03757         for (snl = log; snl < logend; snl++)
03758         if (*snl == '\n')
03759             ++cnl;
03760
03761         date = printable_date (ver->date);
03762         sub = xrealloc (sub,
03763                 (sublen
03764                  + sizeof "Revision"
03765                  + strlen (ver->version)
03766                  + strlen (date)
03767                  + strlen (ver->author)
03768                  + loglen
03769                  + (cnl + 2) * leader_len
03770                  + 20));
03771         if (expand != KFLAG_V)
03772         {
03773         sub[sublen] = '$';
03774         ++sublen;
03775         }
03776         sub[sublen] = '\n';
03777         ++sublen;
03778         memcpy (sub + sublen, leader, leader_len);
03779         sublen += leader_len;
03780         sprintf (sub + sublen, "Revision %s  %s  %s\n",
03781              ver->version, date, ver->author);
03782         sublen += strlen (sub + sublen);
03783         free (date);
03784
03785         sl = log;
03786         while (sl < logend)
03787         {
03788         if (*sl == '\n')
03789         {
03790             memcpy (sub + sublen, leader, leader_sp_len);
03791             sublen += leader_sp_len;
03792             sub[sublen] = '\n';
03793             ++sublen;
03794             ++sl;
03795         }
03796         else
03797         {
03798             const char *slnl;
03799
03800             memcpy (sub + sublen, leader, leader_len);
03801             sublen += leader_len;
03802             for (slnl = sl; slnl < logend && *slnl != '\n'; ++slnl)
03803             ;
03804             if (slnl < logend)
03805             ++slnl;
03806             memcpy (sub + sublen, sl, slnl - sl);
03807             sublen += slnl - sl;
03808             sl = slnl;
03809         }
03810         }
03811
03812         memcpy (sub + sublen, leader, leader_sp_len);
03813         sublen += leader_sp_len;
03814
03815         free (leader);
03816     }
03817
03818     /* Now SUB contains a string which is to replace the string
03819        from SRCH to S.  SUBLEN is the length of SUB.  */
03820
03821     if (srch + sublen == s)
03822     {
03823         memcpy (srch, sub, sublen);
03824         free (sub);
03825     }
03826     else
03827     {
03828         struct expand_buffer *ebuf;
03829
03830         /* We need to change the size of the buffer.  We build a
03831                list of expand_buffer structures.  Each expand_buffer
03832                structure represents a portion of the final output.  We
03833                concatenate them back into a single buffer when we are
03834                done.  This minimizes the number of potentially large
03835                buffer copies we must do.  */
03836
03837         if (ebufs == NULL)
03838         {
03839         ebufs = (struct expand_buffer *) xmalloc (sizeof *ebuf);
03840         ebufs->next = NULL;
03841         ebufs->data = buf;
03842         ebufs->free_data = 0;
03843         ebuf_len = srch - buf;
03844         ebufs->len = ebuf_len;
03845         ebuf_last = ebufs;
03846         }
03847         else
03848         {
03849         assert (srch >= ebuf_last->data);
03850         assert (srch <= ebuf_last->data + ebuf_last->len);
03851         ebuf_len -= ebuf_last->len - (srch - ebuf_last->data);
03852         ebuf_last->len = srch - ebuf_last->data;
03853         }
03854
03855         ebuf = (struct expand_buffer *) xmalloc (sizeof *ebuf);
03856         ebuf->data = sub;
03857         ebuf->len = sublen;
03858         ebuf->free_data = 1;
03859         ebuf->next = NULL;
03860         ebuf_last->next = ebuf;
03861         ebuf_last = ebuf;
03862         ebuf_len += sublen;
03863
03864         ebuf = (struct expand_buffer *) xmalloc (sizeof *ebuf);
03865         ebuf->data = s;
03866         ebuf->len = srch_len - (s - srch);
03867         ebuf->free_data = 0;
03868         ebuf->next = NULL;
03869         ebuf_last->next = ebuf;
03870         ebuf_last = ebuf;
03871         ebuf_len += srch_len - (s - srch);
03872     }
03873
03874     srch_len -= (s - srch);
03875     srch = s;
03876     }
03877
03878     if (locker != NULL)
03879     free (locker);
03880
03881     if (ebufs == NULL)
03882     {
03883     *retbuf = buf;
03884     *retlen = len;
03885     }
03886     else
03887     {
03888     char *ret;
03889
03890     ret = xmalloc (ebuf_len);
03891     *retbuf = ret;
03892     *retlen = ebuf_len;
03893     while (ebufs != NULL)
03894     {
03895         struct expand_buffer *next;
03896
03897         memcpy (ret, ebufs->data, ebufs->len);
03898         ret += ebufs->len;
03899         if (ebufs->free_data)
03900         free (ebufs->data);
03901         next = ebufs->next;
03902         free (ebufs);
03903         ebufs = next;
03904     }
03905     }
03906 }
03907
03908 /* Check out a revision from an RCS file.
03909
03910    If PFN is not NULL, then ignore WORKFILE and SOUT.  Call PFN zero
03911    or more times with the contents of the file.  CALLERDAT is passed,
03912    uninterpreted, to PFN.  (The current code will always call PFN
03913    exactly once for a non empty file; however, the current code
03914    assumes that it can hold the entire file contents in memory, which
03915    is not a good assumption, and might change in the future).
03916
03917    Otherwise, if WORKFILE is not NULL, check out the revision to
03918    WORKFILE.  However, if WORKFILE is not NULL, and noexec is set,
03919    then don't do anything.
03920
03921    Otherwise, if WORKFILE is NULL, check out the revision to SOUT.  If
03922    SOUT is RUN_TTY, then write the contents of the revision to
03923    standard output.  When using SOUT, the output is generally a
03924    temporary file; don't bother to get the file modes correct.
03925
03926    REV is the numeric revision to check out.  It may be NULL, which
03927    means to check out the head of the default branch.
03928
03929    If NAMETAG is not NULL, and is not a numeric revision, then it is
03930    the tag that should be used when expanding the RCS Name keyword.
03931
03932    OPTIONS is a string such as "-kb" or "-kv" for keyword expansion
03933    options.  It may be NULL to use the default expansion mode of the
03934    file, typically "-kkv".
03935
03936    On an error which prevented checking out the file, either print a
03937    nonfatal error and return 1, or give a fatal error.  On success,
03938    return 0.  */
03939
03940 /* This function mimics the behavior of `rcs co' almost exactly.  The
03941    chief difference is in its support for preserving file ownership,
03942    permissions, and special files across checkin and checkout -- see
03943    comments in RCS_checkin for some issues about this. -twp */
03944
03945 int
03946 RCS_checkout (rcs, workfile, rev, nametag, options, sout, pfn, callerdat)
03947      RCSNode *rcs;
03948      char *workfile;
03949      char *rev;
03950      char *nametag;
03951      char *options;
03952      char *sout;
03953      RCSCHECKOUTPROC pfn;
03954      void *callerdat;
03955 {
03956     int free_rev = 0;
03957     enum kflag expand;
03958     FILE *fp, *ofp;
03959     struct stat sb;
03960     struct rcsbuffer rcsbuf;
03961     char *key;
03962     char *value;
03963     size_t len;
03964     int free_value = 0;
03965     char *log = NULL;
03966     size_t loglen;
03967     Node *vp = NULL;
03968 #ifdef PRESERVE_PERMISSIONS_SUPPORT
03969     uid_t rcs_owner = (uid_t) -1;
03970     gid_t rcs_group = (gid_t) -1;
03971     mode_t rcs_mode;
03972     int change_rcs_owner_or_group = 0;
03973     int change_rcs_mode = 0;
03974     int special_file = 0;
03975     unsigned long devnum_long;
03976     dev_t devnum = 0;
03977 #endif
03978
03979     if (trace)
03980     {
03981     (void) fprintf (stderr, "%s-> checkout (%s, %s, %s, %s)\n",
03982 #ifdef SERVER_SUPPORT
03983             server_active ? "S" : " ",
03984 #else
03985             "",
03986 #endif
03987             rcs->path,
03988             rev != NULL ? rev : "",
03989             options != NULL ? options : "",
03990             (pfn != NULL ? "(function)"
03991              : (workfile != NULL
03992                 ? workfile
03993                 : (sout != RUN_TTY ? sout : "(stdout)"))));
03994     }
03995
03996     assert (rev == NULL || isdigit ((unsigned char) *rev));
03997
03998     if (noexec && workfile != NULL)
03999     return 0;
04000
04001     assert (sout == RUN_TTY || workfile == NULL);
04002     assert (pfn == NULL || (sout == RUN_TTY && workfile == NULL));
04003
04004     /* Some callers, such as Checkin or remove_file, will pass us a
04005        branch.  */
04006     if (rev != NULL && (numdots (rev) & 1) == 0)
04007     {
04008     rev = RCS_getbranch (rcs, rev, 1);
04009     if (rev == NULL)
04010         error (1, 0, "internal error: bad branch tag in checkout");
04011     free_rev = 1;
04012     }
04013
04014     if (rev == NULL || STREQ (rev, rcs->head))
04015     {
04016     int gothead;
04017
04018     /* We want the head revision.  Try to read it directly.  */
04019
04020     if (rcs->flags & PARTIAL)
04021         RCS_reparsercsfile (rcs, &fp, &rcsbuf);
04022     else
04023         rcsbuf_cache_open (rcs, rcs->delta_pos, &fp, &rcsbuf);
04024
04025     gothead = 0;
04026     if (! rcsbuf_getrevnum (&rcsbuf, &key))
04027         error (1, 0, "unexpected EOF reading %s", rcs->path);
04028     while (rcsbuf_getkey (&rcsbuf, &key, &value))
04029     {
04030         if (STREQ (key, "log"))
04031         log = rcsbuf_valcopy (&rcsbuf, value, 0, &loglen);
04032         else if (STREQ (key, "text"))
04033         {
04034         gothead = 1;
04035         break;
04036         }
04037     }
04038
04039     if (! gothead)
04040     {
04041         error (0, 0, "internal error: cannot find head text");
04042         if (free_rev)
04043         free (rev);
04044         return 1;
04045     }
04046
04047     rcsbuf_valpolish (&rcsbuf, value, 0, &len);
04048
04049     if (fstat (fileno (fp), &sb) < 0)
04050         error (1, errno, "cannot fstat %s", rcs->path);
04051
04052     rcsbuf_cache (rcs, &rcsbuf);
04053     }
04054     else
04055     {
04056     struct rcsbuffer *rcsbufp;
04057
04058     /* It isn't the head revision of the trunk.  We'll need to
04059        walk through the deltas.  */
04060
04061     fp = NULL;
04062     if (rcs->flags & PARTIAL)
04063         RCS_reparsercsfile (rcs, &fp, &rcsbuf);
04064
04065     if (fp == NULL)
04066     {
04067         /* If RCS_deltas didn't close the file, we could use fstat
04068            here too.  Probably should change it thusly....  */
04069         if (stat (rcs->path, &sb) < 0)
04070         error (1, errno, "cannot stat %s", rcs->path);
04071         rcsbufp = NULL;
04072     }
04073     else
04074     {
04075         if (fstat (fileno (fp), &sb) < 0)
04076         error (1, errno, "cannot fstat %s", rcs->path);
04077         rcsbufp = &rcsbuf;
04078     }
04079
04080     RCS_deltas (rcs, fp, rcsbufp, rev, RCS_FETCH, &value, &len,
04081             &log, &loglen);
04082     free_value = 1;
04083     }
04084
04085     /* If OPTIONS is NULL or the empty string, then the old code would
04086        invoke the RCS co program with no -k option, which means that
04087        co would use the string we have stored in rcs->expand.  */
04088     if ((options == NULL || options[0] == '\0') && rcs->expand == NULL)
04089     expand = KFLAG_KV;
04090     else
04091     {
04092     const char *ouroptions;
04093     const char * const *cpp;
04094
04095     if (options != NULL && options[0] != '\0')
04096     {
04097         assert (options[0] == '-' && options[1] == 'k');
04098         ouroptions = options + 2;
04099     }
04100     else
04101         ouroptions = rcs->expand;
04102
04103     for (cpp = kflags; *cpp != NULL; cpp++)
04104         if (STREQ (*cpp, ouroptions))
04105         break;
04106
04107     if (*cpp != NULL)
04108         expand = (enum kflag) (cpp - kflags);
04109     else
04110     {
04111         error (0, 0,
04112            "internal error: unsupported substitution string -k%s",
04113            ouroptions);
04114         expand = KFLAG_KV;
04115     }
04116     }
04117
04118 #ifdef PRESERVE_PERMISSIONS_SUPPORT
04119     /* Handle special files and permissions, if that is desired. */
04120     if (preserve_perms)
04121     {
04122     RCSVers *vers;
04123     Node *info;
04124
04125     vp = findnode (rcs->versions, rev == NULL ? rcs->head : rev);
04126     if (vp == NULL)
04127         error (1, 0, "internal error: no revision information for %s",
04128            rev == NULL ? rcs->head : rev);
04129     vers = (RCSVers *) vp->data;
04130
04131     /* First we look for symlinks, which are simplest to handle. */
04132     info = findnode (vers->other_delta, "symlink");
04133     if (info != NULL)
04134     {
04135         char *dest;
04136
04137         if (pfn != NULL || (workfile == NULL && sout == RUN_TTY))
04138         error (1, 0, "symbolic link %s:%s cannot be piped",
04139                rcs->path, vers->version);
04140         if (workfile == NULL)
04141         dest = sout;
04142         else
04143         dest = workfile;
04144
04145         /* Remove `dest', just in case.  It's okay to get ENOENT here,
04146            since we just want the file not to be there.  (TODO: decide
04147            whether it should be considered an error for `dest' to exist
04148            at this point.  If so, the unlink call should be removed and
04149            `symlink' should signal the error. -twp) */
04150         if (unlink (dest) < 0 && !existence_error (errno))
04151         error (1, errno, "cannot remove %s", dest);
04152         if (symlink (info->data, dest) < 0)
04153         error (1, errno, "cannot create symbolic link from %s to %s",
04154                dest, info->data);
04155         if (free_value)
04156         free (value);
04157         if (free_rev)
04158         free (rev);
04159         return 0;
04160     }
04161
04162     /* Next, we look at this file's hardlinks field, and see whether
04163        it is linked to any other file that has been checked out.
04164        If so, we don't do anything else -- just link it to that file.
04165
04166        If we are checking out a file to a pipe or temporary storage,
04167        none of this should matter.  Hence the `workfile != NULL'
04168        wrapper around the whole thing. -twp */
04169
04170     if (workfile != NULL)
04171     {
04172         List *links = vers->hardlinks;
04173         if (links != NULL)
04174         {
04175         Node *uptodate_link;
04176
04177         /* For each file in the hardlinks field, check to see
04178            if it exists, and if so, if it has been checked out
04179            this iteration.  When walklist returns, uptodate_link
04180            should point to a hardlist node representing a file
04181            in `links' which has recently been checked out, or
04182            NULL if no file in `links' has yet been checked out. */
04183
04184         uptodate_link = NULL;
04185         (void) walklist (links, find_checkedout_proc, &uptodate_link);
04186         dellist (&links);
04187
04188         /* If we've found a file that `workfile' is supposed to be
04189            linked to, and it has been checked out since CVS was
04190            invoked, then simply link workfile to that file and return.
04191
04192            If one of these conditions is not met, then
04193            workfile is the first one in its hardlink group to
04194            be checked out, and we must continue with a full
04195            checkout. */
04196
04197         if (uptodate_link != NULL)
04198         {
04199             struct hardlink_info *hlinfo =
04200             (struct hardlink_info *) uptodate_link->data;
04201
04202             if (link (uptodate_link->key, workfile) < 0)
04203             error (1, errno, "cannot link %s to %s",
04204                    workfile, uptodate_link->key);
04205             hlinfo->checked_out = 1;    /* probably unnecessary */
04206             if (free_value)
04207             free (value);
04208             if (free_rev)
04209             free (rev);
04210             return 0;
04211         }
04212         }
04213     }
04214
04215     info = findnode (vers->other_delta, "owner");
04216     if (info != NULL)
04217     {
04218         change_rcs_owner_or_group = 1;
04219         rcs_owner = (uid_t) strtoul (info->data, NULL, 10);
04220     }
04221     info = findnode (vers->other_delta, "group");
04222     if (info != NULL)
04223     {
04224         change_rcs_owner_or_group = 1;
04225         rcs_group = (gid_t) strtoul (info->data, NULL, 10);
04226     }
04227     info = findnode (vers->other_delta, "permissions");
04228     if (info != NULL)
04229     {
04230         change_rcs_mode = 1;
04231         rcs_mode = (mode_t) strtoul (info->data, NULL, 8);
04232     }
04233     info = findnode (vers->other_delta, "special");
04234     if (info != NULL)
04235     {
04236         /* If the size of `devtype' changes, fix the sscanf call also */
04237         char devtype[16];
04238
04239         if (sscanf (info->data, "%16s %lu",
04240             devtype, &devnum_long) < 2)
04241         error (1, 0, "%s:%s has bad `special' newphrase %s",
04242                workfile, vers->version, info->data);
04243         devnum = devnum_long;
04244         if (STREQ (devtype, "character"))
04245         special_file = S_IFCHR;
04246         else if (STREQ (devtype, "block"))
04247         special_file = S_IFBLK;
04248         else
04249         error (0, 0, "%s is a special file of unsupported type `%s'",
04250                workfile, info->data);
04251     }
04252     }
04253 #endif
04254
04255     if (expand != KFLAG_O && expand != KFLAG_B)
04256     {
04257     char *newvalue;
04258
04259     /* Don't fetch the delta node again if we already have it. */
04260     if (vp == NULL)
04261     {
04262         vp = findnode (rcs->versions, rev == NULL ? rcs->head : rev);
04263         if (vp == NULL)
04264         error (1, 0, "internal error: no revision information for %s",
04265                rev == NULL ? rcs->head : rev);
04266     }
04267
04268     expand_keywords (rcs, (RCSVers *) vp->data, nametag, log, loglen,
04269              expand, value, len, &newvalue, &len);
04270
04271     if (newvalue != value)
04272     {
04273         if (free_value)
04274         free (value);
04275         value = newvalue;
04276         free_value = 1;
04277     }
04278     }
04279
04280     if (free_rev)
04281     free (rev);
04282
04283     if (log != NULL)
04284     {
04285     free (log);
04286     log = NULL;
04287     }
04288
04289     if (pfn != NULL)
04290     {
04291 #ifdef PRESERVE_PERMISSIONS_SUPPORT
04292     if (special_file)
04293         error (1, 0, "special file %s cannot be piped to anything",
04294            rcs->path);
04295 #endif
04296     /* The PFN interface is very simple to implement right now, as
04297            we always have the entire file in memory.  */
04298     if (len != 0)
04299         pfn (callerdat, value, len);
04300     }
04301 #ifdef PRESERVE_PERMISSIONS_SUPPORT
04302     else if (special_file)
04303     {
04304 #ifdef HAVE_MKNOD
04305     char *dest;
04306
04307     /* Can send either to WORKFILE or to SOUT, as long as SOUT is
04308        not RUN_TTY. */
04309     dest = workfile;
04310     if (dest == NULL)
04311     {
04312         if (sout == RUN_TTY)
04313         error (1, 0, "special file %s cannot be written to stdout",
04314                rcs->path);
04315         dest = sout;
04316     }
04317
04318     /* Unlink `dest', just in case.  It's okay if this provokes a
04319        ENOENT error. */
04320     if (unlink (dest) < 0 && existence_error (errno))
04321         error (1, errno, "cannot remove %s", dest);
04322     if (mknod (dest, special_file, devnum) < 0)
04323         error (1, errno, "could not create special file %s",
04324            dest);
04325 #else
04326     error (1, 0,
04327 "cannot create %s: unable to create special files on this system",
04328 workfile);
04329 #endif
04330     }
04331 #endif
04332     else
04333     {
04334     /* Not a special file: write to WORKFILE or SOUT. */
04335     if (workfile == NULL)
04336     {
04337         if (sout == RUN_TTY)
04338         ofp = stdout;
04339         else
04340         {
04341         /* Symbolic links should be removed before replacement, so that
04342            `fopen' doesn't follow the link and open the wrong file. */
04343         if (islink (sout))
04344             if (unlink_file (sout) < 0)
04345             error (1, errno, "cannot remove %s", sout);
04346         ofp = CVS_FOPEN (sout, expand == KFLAG_B ? "wb" : "w");
04347         if (ofp == NULL)
04348             error (1, errno, "cannot open %s", sout);
04349         }
04350     }
04351     else
04352     {
04353         /* Output is supposed to go to WORKFILE, so we should open that
04354            file.  Symbolic links should be removed first (see above). */
04355         if (islink (workfile))
04356         if (unlink_file (workfile) < 0)
04357             error (1, errno, "cannot remove %s", workfile);
04358
04359         ofp = CVS_FOPEN (workfile, expand == KFLAG_B ? "wb" : "w");
04360
04361         /* If the open failed because the existing workfile was not
04362            writable, try to chmod the file and retry the open.  */
04363         if (ofp == NULL && errno == EACCES
04364         && isfile (workfile) && !iswritable (workfile))
04365         {
04366         xchmod (workfile, 1);
04367         ofp = CVS_FOPEN (workfile, expand == KFLAG_B ? "wb" : "w");
04368         }
04369
04370         if (ofp == NULL)
04371         {
04372         error (0, errno, "cannot open %s", workfile);
04373         if (free_value)
04374             free (value);
04375         return 1;
04376         }
04377     }
04378
04379     if (workfile == NULL && sout == RUN_TTY)
04380     {
04381         if (expand == KFLAG_B)
04382         cvs_output_binary (value, len);
04383         else
04384         {
04385         /* cvs_output requires the caller to check for zero
04386            length.  */
04387         if (len > 0)
04388             cvs_output (value, len);
04389         }
04390     }
04391     else
04392     {
04393         /* NT 4.0 is said to have trouble writing 2099999 bytes
04394            (for example) in a single fwrite.  So break it down
04395            (there is no need to be writing that much at once
04396            anyway; it is possible that LARGEST_FWRITE should be
04397            somewhat larger for good performance, but for testing I
04398            want to start with a small value until/unless a bigger
04399            one proves useful).  */
04400 #define LARGEST_FWRITE 8192
04401         size_t nleft = len;
04402         size_t nstep = (len < LARGEST_FWRITE ? len : LARGEST_FWRITE);
04403         char *p = value;
04404
04405         while (nleft > 0)
04406         {
04407         if (fwrite (p, 1, nstep, ofp) != nstep)
04408         {
04409             error (0, errno, "cannot write %s",
04410                (workfile != NULL
04411                 ? workfile
04412                 : (sout != RUN_TTY ? sout : "stdout")));
04413             if (free_value)
04414             free (value);
04415             return 1;
04416         }
04417         p += nstep;
04418         nleft -= nstep;
04419         if (nleft < nstep)
04420             nstep = nleft;
04421         }
04422     }
04423     }
04424
04425     if (free_value)
04426     free (value);
04427
04428     if (workfile != NULL)
04429     {
04430     int ret;
04431
04432 #ifdef PRESERVE_PERMISSIONS_SUPPORT
04433     if (!special_file && fclose (ofp) < 0)
04434     {
04435         error (0, errno, "cannot close %s", workfile);
04436         return 1;
04437     }
04438
04439     if (change_rcs_owner_or_group)
04440     {
04441         if (chown (workfile, rcs_owner, rcs_group) < 0)
04442         error (0, errno, "could not change owner or group of %s",
04443                workfile);
04444     }
04445
04446     ret = chmod (workfile,
04447              change_rcs_mode
04448              ? rcs_mode
04449              : sb.st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH));
04450 #else
04451     if (fclose (ofp) < 0)
04452     {
04453         error (0, errno, "cannot close %s", workfile);
04454         return 1;
04455     }
04456
04457     ret = chmod (workfile,
04458              sb.st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH));
04459 #endif
04460     if (ret < 0)
04461     {
04462         error (0, errno, "cannot change mode of file %s",
04463            workfile);
04464     }
04465     }
04466     else if (sout != RUN_TTY)
04467     {
04468     if (
04469 #ifdef PRESERVE_PERMISSIONS_SUPPORT
04470         !special_file &&
04471 #endif
04472         fclose (ofp) < 0)
04473     {
04474         error (0, errno, "cannot close %s", sout);
04475         return 1;
04476     }
04477     }
04478
04479 #ifdef PRESERVE_PERMISSIONS_SUPPORT
04480     /* If we are in the business of preserving hardlinks, then
04481        mark this file as having been checked out. */
04482     if (preserve_perms && workfile != NULL)
04483     update_hardlink_info (workfile);
04484 #endif
04485
04486     return 0;
04487 }
04488
04489 static RCSVers *RCS_findlock_or_tip PROTO ((RCSNode *rcs));
04490
04491 /* Find the delta currently locked by the user.  From the `ci' man page:
04492
04493     "If rev is omitted, ci tries to  derive  the  new  revision
04494      number  from  the  caller's  last lock.  If the caller has
04495      locked the tip revision of a branch, the new  revision  is
04496      appended  to  that  branch.   The  new  revision number is
04497      obtained by incrementing the tip revision number.  If  the
04498      caller  locked a non-tip revision, a new branch is started
04499      at that revision by incrementing the highest branch number
04500      at  that  revision.   The default initial branch and level
04501      numbers are 1.
04502
04503      If rev is omitted and the caller has no lock, but owns the
04504      file  and  locking is not set to strict, then the revision
04505      is appended to the default branch (normally the trunk; see
04506      the -b option of rcs(1))."
04507
04508    RCS_findlock_or_tip finds the unique revision locked by the caller
04509    and returns its delta node.  If the caller has not locked any
04510    revisions (and is permitted to commit to an unlocked delta, as
04511    described above), return the tip of the default branch. */
04512
04513 static RCSVers *
04514 RCS_findlock_or_tip (rcs)
04515     RCSNode *rcs;
04516 {
04517     char *user = getcaller();
04518     Node *lock, *p;
04519     List *locklist;
04520
04521     /* Find unique delta locked by caller. This code is very similar
04522        to the code in RCS_unlock -- perhaps it could be abstracted
04523        into a RCS_findlock function. */
04524     locklist = RCS_getlocks (rcs);
04525     lock = NULL;
04526     for (p = locklist->list->next; p != locklist->list; p = p->next)
04527     {
04528     if (STREQ (p->data, user))
04529     {
04530         if (lock != NULL)
04531         {
04532         error (0, 0, "\
04533 %s: multiple revisions locked by %s; please specify one", rcs->path, user);
04534         return NULL;
04535         }
04536         lock = p;
04537     }
04538     }
04539
04540     if (lock != NULL)
04541     {
04542     /* Found an old lock, but check that the revision still exists. */
04543     p = findnode (rcs->versions, lock->key);
04544     if (p == NULL)
04545     {
04546         error (0, 0, "%s: can't unlock nonexistent revision %s",
04547            rcs->path,
04548            lock->key);
04549         return NULL;
04550     }
04551     return (RCSVers *) p->data;
04552     }
04553
04554     /* No existing lock.  The RCS rule is that this is an error unless
04555        locking is nonstrict AND the file is owned by the current
04556        user.  Trying to determine the latter is a portability nightmare
04557        in the face of NT, VMS, AFS, and other systems with non-unix-like
04558        ideas of users and owners.  In the case of CVS, we should never get
04559        here (as long as the traditional behavior of making sure to call
04560        RCS_lock persists).  Anyway, we skip the RCS error checks
04561        and just return the default branch or head.  The reasoning is that
04562        those error checks are to make users lock before a checkin, and we do
04563        that in other ways if at all anyway (e.g. rcslock.pl).  */
04564
04565     p = findnode (rcs->versions, RCS_getbranch (rcs, rcs->branch, 0));
04566     return (RCSVers *) p->data;
04567 }
04568
04569 /* Revision number string, R, must contain a `.'.
04570    Return a newly-malloc'd copy of the prefix of R up
04571    to but not including the final `.'.  */
04572
04573 static char *
04574 truncate_revnum (r)
04575     const char *r;
04576 {
04577     size_t len;
04578     char *new_r;
04579     char *dot = strrchr (r, '.');
04580
04581     assert (dot);
04582     len = dot - r;
04583     new_r = xmalloc (len + 1);
04584     memcpy (new_r, r, len);
04585     *(new_r + len) = '\0';
04586     return new_r;
04587 }
04588
04589 /* Revision number string, R, must contain a `.'.
04590    R must be writable.  Replace the rightmost `.' in R with
04591    the NUL byte and return a pointer to that NUL byte.  */
04592
04593 static char *
04594 truncate_revnum_in_place (r)
04595     char *r;
04596 {
04597     char *dot = strrchr (r, '.');
04598     assert (dot);
04599     *dot = '\0';
04600     return dot;
04601 }
04602
04603 /* Revision number strings, R and S, must each contain a `.'.
04604    R and S must be writable and must have the same number of dots.
04605    Truncate R and S for the comparison, then restored them to their
04606    original state.
04607    Return the result (see compare_revnums) of comparing R and S
04608    ignoring differences in any component after the rightmost `.'.  */
04609
04610 static int
04611 compare_truncated_revnums (r, s)
04612     char *r;
04613     char *s;
04614 {
04615     char *r_dot = truncate_revnum_in_place (r);
04616     char *s_dot = truncate_revnum_in_place (s);
04617     int cmp;
04618
04619     assert (numdots (r) == numdots (s));
04620
04621     cmp = compare_revnums (r, s);
04622
04623     *r_dot = '.';
04624     *s_dot = '.';
04625
04626     return cmp;
04627 }
04628
04629 /* Return a malloc'd copy of the string representing the highest branch
04630    number on BRANCHNODE.  If there are no branches on BRANCHNODE, return NULL.
04631    FIXME: isn't the max rev always the last one?
04632    If so, we don't even need a loop.  */
04633
04634 static char *max_rev PROTO ((const RCSVers *));
04635
04636 static char *
04637 max_rev (branchnode)
04638     const RCSVers *branchnode;
04639 {
04640     Node *head;
04641     Node *bp;
04642     char *max;
04643
04644     if (branchnode->branches == NULL)
04645     {
04646         return NULL;
04647     }
04648
04649     max = NULL;
04650     head = branchnode->branches->list;
04651     for (bp = head->next; bp != head; bp = bp->next)
04652     {
04653     if (max == NULL || compare_truncated_revnums (max, bp->key) < 0)
04654     {
04655         max = bp->key;
04656     }
04657     }
04658     assert (max);
04659
04660     return truncate_revnum (max);
04661 }
04662
04663 /* Create BRANCH in RCS's delta tree.  BRANCH may be either a branch
04664    number or a revision number.  In the former case, create the branch
04665    with the specified number; in the latter case, create a new branch
04666    rooted at node BRANCH with a higher branch number than any others.
04667    Return the number of the tip node on the new branch. */
04668
04669 static char *
04670 RCS_addbranch (rcs, branch)
04671     RCSNode *rcs;
04672     const char *branch;
04673 {
04674     char *branchpoint, *newrevnum;
04675     Node *nodep, *bp;
04676     Node *marker;
04677     RCSVers *branchnode;
04678
04679     /* Append to end by default.  */
04680     marker = NULL;
04681
04682     branchpoint = xstrdup (branch);
04683     if ((numdots (branchpoint) & 1) == 0)
04684     {
04685     truncate_revnum_in_place (branchpoint);
04686     }
04687
04688     /* Find the branch rooted at BRANCHPOINT. */
04689     nodep = findnode (rcs->versions, branchpoint);
04690     if (nodep == NULL)
04691     {
04692     error (0, 0, "%s: can't find branch point %s", rcs->path, branchpoint);
04693     free (branchpoint);
04694     return NULL;
04695     }
04696     free (branchpoint);
04697     branchnode = (RCSVers *) nodep->data;
04698
04699     /* If BRANCH was a full branch number, make sure it is higher than MAX. */
04700     if ((numdots (branch) & 1) == 1)
04701     {
04702     if (branchnode->branches == NULL)
04703     {
04704         /* We have to create the first branch on this node, which means
04705            appending ".2" to the revision number. */
04706         newrevnum = (char *) xmalloc (strlen (branch) + 3);
04707         strcpy (newrevnum, branch);
04708         strcat (newrevnum, ".2");
04709     }
04710     else
04711     {
04712         char *max = max_rev (branchnode);
04713         assert (max);
04714         newrevnum = increment_revnum (max);
04715         free (max);
04716     }
04717     }
04718     else
04719     {
04720     newrevnum = xstrdup (branch);
04721
04722     if (branchnode->branches != NULL)
04723     {
04724         Node *head;
04725         Node *bp;
04726
04727         /* Find the position of this new branch in the sorted list
04728            of branches.  */
04729         head = branchnode->branches->list;
04730         for (bp = head->next; bp != head; bp = bp->next)
04731         {
04732         char *dot;
04733         int found_pos;
04734
04735         /* The existing list must be sorted on increasing revnum.  */
04736         assert (bp->next == head
04737             || compare_truncated_revnums (bp->key,
04738                               bp->next->key) < 0);
04739         dot = truncate_revnum_in_place (bp->key);
04740         found_pos = (compare_revnums (branch, bp->key) < 0);
04741         *dot = '.';
04742
04743         if (found_pos)
04744         {
04745             break;
04746         }
04747         }
04748         marker = bp;
04749     }
04750     }
04751
04752     newrevnum = (char *) xrealloc (newrevnum, strlen (newrevnum) + 3);
04753     strcat (newrevnum, ".1");
04754
04755     /* Add this new revision number to BRANCHPOINT's branches list. */
04756     if (branchnode->branches == NULL)
04757     branchnode->branches = getlist();
04758     bp = getnode();
04759     bp->key = xstrdup (newrevnum);
04760
04761     /* Append to the end of the list by default, that is, just before
04762        the header node, `list'.  */
04763     if (marker == NULL)
04764     marker = branchnode->branches->list;
04765
04766     {
04767     int fail;
04768     fail = insert_before (branchnode->branches, marker, bp);
04769     assert (!fail);
04770     }
04771
04772     return newrevnum;
04773 }
04774
04775 /* Check in to RCSFILE with revision REV (which must be greater than
04776    the largest revision) and message MESSAGE (which is checked for
04777    legality).  If FLAGS & RCS_FLAGS_DEAD, check in a dead revision.
04778    If FLAGS & RCS_FLAGS_QUIET, tell ci to be quiet.  If FLAGS &
04779    RCS_FLAGS_MODTIME, use the working file's modification time for the
04780    checkin time.  WORKFILE is the working file to check in from, or
04781    NULL to use the usual RCS rules for deriving it from the RCSFILE.
04782    If FLAGS & RCS_FLAGS_KEEPFILE, don't unlink the working file;
04783    unlinking the working file is standard RCS behavior, but is rarely
04784    appropriate for CVS.
04785
04786    This function should almost exactly mimic the behavior of `rcs ci'.  The
04787    principal point of difference is the support here for preserving file
04788    ownership and permissions in the delta nodes.  This is not a clean
04789    solution -- precisely because it diverges from RCS's behavior -- but
04790    it doesn't seem feasible to do this anywhere else in the code. [-twp]
04791
04792    Return value is -1 for error (and errno is set to indicate the
04793    error), positive for error (and an error message has been printed),
04794    or zero for success.  */
04795
04796 int
04797 RCS_checkin (rcs, workfile, message, rev, flags)
04798     RCSNode *rcs;
04799     char *workfile;
04800     char *message;
04801     char *rev;
04802     int flags;
04803 {
04804     RCSVers *delta, *commitpt;
04805     Deltatext *dtext;
04806     Node *nodep;
04807     char *tmpfile, *changefile, *chtext;
04808     char *diffopts;
04809     size_t bufsize;
04810     int buflen, chtextlen;
04811     int status, checkin_quiet, allocated_workfile;
04812     struct tm *ftm;
04813     time_t modtime;
04814     int adding_branch = 0;
04815 #ifdef PRESERVE_PERMISSIONS_SUPPORT
04816     struct stat sb;
04817 #endif
04818
04819     commitpt = NULL;
04820
04821     if (rcs->flags & PARTIAL)
04822     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
04823
04824     /* Get basename of working file.  Is there a library function to
04825        do this?  I couldn't find one. -twp */
04826     allocated_workfile = 0;
04827     if (workfile == NULL)
04828     {
04829     char *p;
04830     int extlen = strlen (RCSEXT);
04831     workfile = xstrdup (last_component (rcs->path));
04832     p = workfile + (strlen (workfile) - extlen);
04833     assert (strncmp (p, RCSEXT, extlen) == 0);
04834     *p = '\0';
04835     allocated_workfile = 1;
04836     }
04837
04838     /* If the filename is a symbolic link, follow it and replace it
04839        with the destination of the link.  We need to do this before
04840        calling rcs_internal_lockfile, or else we won't put the lock in
04841        the right place. */
04842     resolve_symlink (&(rcs->path));
04843
04844     checkin_quiet = flags & RCS_FLAGS_QUIET;
04845     if (!checkin_quiet)
04846     {
04847     cvs_output (rcs->path, 0);
04848     cvs_output ("  <--  ", 7);
04849     cvs_output (workfile, 0);
04850     cvs_output ("\n", 1);
04851     }
04852
04853     /* Create new delta node. */
04854     delta = (RCSVers *) xmalloc (sizeof (RCSVers));
04855     memset (delta, 0, sizeof (RCSVers));
04856     delta->author = xstrdup (getcaller ());
04857     if (flags & RCS_FLAGS_MODTIME)
04858     {
04859     struct stat ws;
04860     if (stat (workfile, &ws) < 0)
04861     {
04862         error (1, errno, "cannot stat %s", workfile);
04863     }
04864     modtime = ws.st_mtime;
04865     }
04866     else
04867     (void) time (&modtime);
04868     ftm = gmtime (&modtime);
04869     delta->date = (char *) xmalloc (MAXDATELEN);
04870     (void) sprintf (delta->date, DATEFORM,
04871             ftm->tm_year + (ftm->tm_year < 100 ? 0 : 1900),
04872             ftm->tm_mon + 1, ftm->tm_mday, ftm->tm_hour,
04873             ftm->tm_min, ftm->tm_sec);
04874     if (flags & RCS_FLAGS_DEAD)
04875     {
04876     delta->state = xstrdup (RCSDEAD);
04877     delta->dead = 1;
04878     }
04879     else
04880     delta->state = xstrdup ("Exp");
04881
04882 #ifdef PRESERVE_PERMISSIONS_SUPPORT
04883     /* If permissions should be preserved on this project, then
04884        save the permission info. */
04885     if (preserve_perms)
04886     {
04887     Node *np;
04888     char buf[64];   /* static buffer should be safe: see usage. -twp */
04889
04890     delta->other_delta = getlist();
04891
04892     if (CVS_LSTAT (workfile, &sb) < 0)
04893         error (1, 1, "cannot lstat %s", workfile);
04894
04895     if (S_ISLNK (sb.st_mode))
04896     {
04897         np = getnode();
04898         np->type = RCSFIELD;
04899         np->key = xstrdup ("symlink");
04900         np->data = xreadlink (workfile);
04901         addnode (delta->other_delta, np);
04902     }
04903     else
04904     {
04905         (void) sprintf (buf, "%u", sb.st_uid);
04906         np = getnode();
04907         np->type = RCSFIELD;
04908         np->key = xstrdup ("owner");
04909         np->data = xstrdup (buf);
04910         addnode (delta->other_delta, np);
04911
04912         (void) sprintf (buf, "%u", sb.st_gid);
04913         np = getnode();
04914         np->type = RCSFIELD;
04915         np->key = xstrdup ("group");
04916         np->data = xstrdup (buf);
04917         addnode (delta->other_delta, np);
04918
04919         (void) sprintf (buf, "%o", sb.st_mode & 07777);
04920         np = getnode();
04921         np->type = RCSFIELD;
04922         np->key = xstrdup ("permissions");
04923         np->data = xstrdup (buf);
04924         addnode (delta->other_delta, np);
04925
04926         /* Save device number. */
04927         switch (sb.st_mode & S_IFMT)
04928         {
04929         case S_IFREG: break;
04930         case S_IFCHR:
04931         case S_IFBLK:
04932 #ifdef HAVE_ST_RDEV
04933             np = getnode();
04934             np->type = RCSFIELD;
04935             np->key = xstrdup ("special");
04936             sprintf (buf, "%s %lu",
04937                  ((sb.st_mode & S_IFMT) == S_IFCHR
04938                   ? "character" : "block"),
04939                  (unsigned long) sb.st_rdev);
04940             np->data = xstrdup (buf);
04941             addnode (delta->other_delta, np);
04942 #else
04943             error (0, 0,
04944 "can't preserve %s: unable to save device files on this system",
04945 workfile);
04946 #endif
04947             break;
04948
04949         default:
04950             error (0, 0, "special file %s has unknown type", workfile);
04951         }
04952
04953         /* Save hardlinks. */
04954         delta->hardlinks = list_linked_files_on_disk (workfile);
04955     }
04956     }
04957 #endif
04958
04959     /* Create a new deltatext node. */
04960     dtext = (Deltatext *) xmalloc (sizeof (Deltatext));
04961     memset (dtext, 0, sizeof (Deltatext));
04962
04963     dtext->log = make_message_rcslegal (message);
04964
04965     /* If the delta tree is empty, then there's nothing to link the
04966        new delta into.  So make a new delta tree, snarf the working
04967        file contents, and just write the new RCS file. */
04968     if (rcs->head == NULL)
04969     {
04970     char *newrev;
04971     FILE *fout;
04972
04973     /* Figure out what the first revision number should be. */
04974     if (rev == NULL || *rev == '\0')
04975         newrev = xstrdup ("1.1");
04976     else if (numdots (rev) == 0)
04977     {
04978         newrev = (char *) xmalloc (strlen (rev) + 3);
04979         strcpy (newrev, rev);
04980         strcat (newrev, ".1");
04981     }
04982     else
04983         newrev = xstrdup (rev);
04984
04985     /* Don't need to xstrdup NEWREV because it's already dynamic, and
04986        not used for anything else.  (Don't need to free it, either.) */
04987     rcs->head = newrev;
04988     delta->version = xstrdup (newrev);
04989     nodep = getnode();
04990     nodep->type = RCSVERS;
04991     nodep->delproc = rcsvers_delproc;
04992     nodep->data = (char *) delta;
04993     nodep->key = delta->version;
04994     (void) addnode (rcs->versions, nodep);
04995
04996     dtext->version = xstrdup (newrev);
04997     bufsize = 0;
04998 #ifdef PRESERVE_PERMISSIONS_SUPPORT
04999     if (preserve_perms && !S_ISREG (sb.st_mode))
05000         /* Pretend file is empty.  */
05001         bufsize = 0;
05002     else
05003 #endif
05004     get_file (workfile, workfile,
05005           rcs->expand != NULL && STREQ (rcs->expand, "b") ? "rb" : "r",
05006           &dtext->text, &bufsize, &dtext->len);
05007
05008     if (!checkin_quiet)
05009     {
05010         cvs_output ("initial revision: ", 0);
05011         cvs_output (rcs->head, 0);
05012         cvs_output ("\n", 1);
05013     }
05014
05015     /* We are probably about to invalidate any cached file.  */
05016     rcsbuf_cache_close ();
05017
05018     fout = rcs_internal_lockfile (rcs->path);
05019     RCS_putadmin (rcs, fout);
05020     RCS_putdtree (rcs, rcs->head, fout);
05021     RCS_putdesc (rcs, fout);
05022     rcs->delta_pos = ftell (fout);
05023     if (rcs->delta_pos == -1)
05024         error (1, errno, "cannot ftell for %s", rcs->path);
05025     putdeltatext (fout, dtext);
05026     rcs_internal_unlockfile (fout, rcs->path);
05027
05028     if ((flags & RCS_FLAGS_KEEPFILE) == 0)
05029     {
05030         if (unlink_file (workfile) < 0)
05031         /* FIXME-update-dir: message does not include update_dir.  */
05032         error (0, errno, "cannot remove %s", workfile);
05033     }
05034
05035     if (!checkin_quiet)
05036         cvs_output ("done\n", 5);
05037
05038     status = 0;
05039     goto checkin_done;
05040     }
05041
05042     /* Derive a new revision number.  From the `ci' man page:
05043
05044      "If rev  is  a revision number, it must be higher than the
05045      latest one on the branch to which  rev  belongs,  or  must
05046      start a new branch.
05047
05048      If  rev is a branch rather than a revision number, the new
05049      revision is appended to that branch.  The level number  is
05050      obtained  by  incrementing the tip revision number of that
05051      branch.  If rev  indicates  a  non-existing  branch,  that
05052      branch  is  created  with  the  initial  revision numbered
05053      rev.1."
05054
05055        RCS_findlock_or_tip handles the case where REV is omitted.
05056        RCS 5.7 also permits REV to be "$" or to begin with a dot, but
05057        we do not address those cases -- every routine that calls
05058        RCS_checkin passes it a numeric revision. */
05059
05060     if (rev == NULL || *rev == '\0')
05061     {
05062     /* Figure out where the commit point is by looking for locks.
05063        If the commit point is at the tip of a branch (or is the
05064        head of the delta tree), then increment its revision number
05065        to obtain the new revnum.  Otherwise, start a new
05066        branch. */
05067     commitpt = RCS_findlock_or_tip (rcs);
05068     if (commitpt == NULL)
05069     {
05070         status = 1;
05071         goto checkin_done;
05072     }
05073     else if (commitpt->next == NULL
05074          || STREQ (commitpt->version, rcs->head))
05075         delta->version = increment_revnum (commitpt->version);
05076     else
05077         delta->version = RCS_addbranch (rcs, commitpt->version);
05078     }
05079     else
05080     {
05081     /* REV is either a revision number or a branch number.  Find the
05082        tip of the target branch. */
05083     char *branch, *tip, *newrev, *p;
05084     int dots, isrevnum;
05085
05086     assert (isdigit ((unsigned char) *rev));
05087
05088     newrev = xstrdup (rev);
05089     dots = numdots (newrev);
05090     isrevnum = dots & 1;
05091
05092     branch = xstrdup (rev);
05093     if (isrevnum)
05094     {
05095         p = strrchr (branch, '.');
05096         *p = '\0';
05097     }
05098
05099     /* Find the tip of the target branch.  If we got a one- or two-digit
05100        revision number, this will be the head of the tree.  Exception:
05101        if rev is a single-field revision equal to the branch number of
05102        the trunk (usually "1") then we want to treat it like an ordinary
05103        branch revision. */
05104     if (dots == 0)
05105     {
05106         tip = xstrdup (rcs->head);
05107         if (atoi (tip) != atoi (branch))
05108         {
05109         newrev = (char *) xrealloc (newrev, strlen (newrev) + 3);
05110         strcat (newrev, ".1");
05111         dots = isrevnum = 1;
05112         }
05113     }
05114     else if (dots == 1)
05115         tip = xstrdup (rcs->head);
05116     else
05117         tip = RCS_getbranch (rcs, branch, 1);
05118
05119     /* If the branch does not exist, and we were supplied an exact
05120        revision number, signal an error.  Otherwise, if we were
05121        given only a branch number, create it and set COMMITPT to
05122        the branch point. */
05123     if (tip == NULL)
05124     {
05125         if (isrevnum)
05126         {
05127         error (0, 0, "%s: can't find branch point %s",
05128                rcs->path, branch);
05129         free (branch);
05130         free (newrev);
05131         status = 1;
05132         goto checkin_done;
05133         }
05134         delta->version = RCS_addbranch (rcs, branch);
05135         if (!delta->version)
05136         {
05137         free (branch);
05138         free (newrev);
05139         status = 1;
05140         goto checkin_done;
05141         }
05142         adding_branch = 1;
05143         p = strrchr (branch, '.');
05144         *p = '\0';
05145         tip = xstrdup (branch);
05146     }
05147     else
05148     {
05149         if (isrevnum)
05150         {
05151         /* NEWREV must be higher than TIP. */
05152         if (compare_revnums (tip, newrev) >= 0)
05153         {
05154             error (0, 0,
05155                "%s: revision %s too low; must be higher than %s",
05156                rcs->path,
05157                newrev, tip);
05158             free (branch);
05159             free (newrev);
05160             free (tip);
05161             status = 1;
05162             goto checkin_done;
05163         }
05164         delta->version = xstrdup (newrev);
05165         }
05166         else
05167         /* Just increment the tip number to get the new revision. */
05168         delta->version = increment_revnum (tip);
05169     }
05170
05171     nodep = findnode (rcs->versions, tip);
05172     commitpt = (RCSVers *) nodep->data;
05173
05174     free (branch);
05175     free (newrev);
05176     free (tip);
05177     }
05178
05179     assert (delta->version != NULL);
05180
05181     /* If COMMITPT is locked by us, break the lock.  If it's locked
05182        by someone else, signal an error. */
05183     nodep = findnode (RCS_getlocks (rcs), commitpt->version);
05184     if (nodep != NULL)
05185     {
05186     if (! STREQ (nodep->data, delta->author))
05187     {
05188         /* If we are adding a branch, then leave the old lock around.
05189            That is sensible in the sense that when adding a branch,
05190            we don't need to use the lock to tell us where to check
05191            in.  It is fishy in the sense that if it is our own lock,
05192            we break it.  However, this is the RCS 5.7 behavior (at
05193            the end of addbranch in ci.c in RCS 5.7, it calls
05194            removelock only if it is our own lock, not someone
05195            else's).  */
05196
05197         if (!adding_branch)
05198         {
05199         error (0, 0, "%s: revision %s locked by %s",
05200                rcs->path,
05201                nodep->key, nodep->data);
05202         status = 1;
05203         goto checkin_done;
05204         }
05205     }
05206     else
05207         delnode (nodep);
05208     }
05209
05210     dtext->version = xstrdup (delta->version);
05211
05212     /* Obtain the change text for the new delta.  If DELTA is to be the
05213        new head of the tree, then its change text should be the contents
05214        of the working file, and LEAFNODE's change text should be a diff.
05215        Else, DELTA's change text should be a diff between LEAFNODE and
05216        the working file. */
05217
05218     tmpfile = cvs_temp_name();
05219     status = RCS_checkout (rcs, NULL, commitpt->version, NULL,
05220                ((rcs->expand != NULL
05221                  && STREQ (rcs->expand, "b"))
05222                 ? "-kb"
05223                 : "-ko"),
05224                tmpfile,
05225                (RCSCHECKOUTPROC)0, NULL);
05226     if (status != 0)
05227     error (1, 0,
05228            "could not check out revision %s of `%s'",
05229            commitpt->version, rcs->path);
05230
05231     bufsize = buflen = 0;
05232     chtext = NULL;
05233     chtextlen = 0;
05234     changefile = cvs_temp_name();
05235
05236     /* Diff options should include --binary if the RCS file has -kb set
05237        in its `expand' field. */
05238     diffopts = (rcs->expand != NULL && STREQ (rcs->expand, "b")
05239         ? "-a -n --binary"
05240         : "-a -n");
05241
05242     if (STREQ (commitpt->version, rcs->head) &&
05243     numdots (delta->version) == 1)
05244     {
05245     /* If this revision is being inserted on the trunk, the change text
05246        for the new delta should be the contents of the working file ... */
05247     bufsize = 0;
05248 #ifdef PRESERVE_PERMISSIONS_SUPPORT
05249     if (preserve_perms && !S_ISREG (sb.st_mode))
05250         /* Pretend file is empty.  */
05251         ;
05252     else
05253 #endif
05254     get_file (workfile, workfile,
05255           rcs->expand != NULL && STREQ (rcs->expand, "b") ? "rb" : "r",
05256           &dtext->text, &bufsize, &dtext->len);
05257
05258     /* ... and the change text for the old delta should be a diff. */
05259     commitpt->text = (Deltatext *) xmalloc (sizeof (Deltatext));
05260     memset (commitpt->text, 0, sizeof (Deltatext));
05261
05262     bufsize = 0;
05263     switch (diff_exec (workfile, tmpfile, diffopts, changefile))
05264     {
05265         case 0:
05266         case 1:
05267         break;
05268         case -1:
05269         /* FIXME-update-dir: message does not include update_dir.  */
05270         error (1, errno, "error diffing %s", workfile);
05271         break;
05272         default:
05273         /* FIXME-update-dir: message does not include update_dir.  */
05274         error (1, 0, "error diffing %s", workfile);
05275         break;
05276     }
05277
05278     /* OK, the text file case here is really dumb.  Logically
05279        speaking we want diff to read the files in text mode,
05280        convert them to the canonical form found in RCS files
05281        (which, we hope at least, is independent of OS--always
05282        bare linefeeds), and then work with change texts in that
05283        format.  However, diff_exec both generates change
05284        texts and produces output for user purposes (e.g. patch.c),
05285        and there is no way to distinguish between the two cases.
05286        So we actually implement the text file case by writing the
05287        change text as a text file, then reading it as a text file.
05288        This should cause no harm, but doesn't strike me as
05289        immensely clean.  */
05290     get_file (changefile, changefile,
05291           rcs->expand != NULL && STREQ (rcs->expand, "b") ? "rb" : "r",
05292           &commitpt->text->text, &bufsize, &commitpt->text->len);
05293
05294     /* If COMMITPT->TEXT->TEXT is NULL, it means that CHANGEFILE
05295        was empty and that there are no differences between revisions.
05296        In that event, we want to force RCS_rewrite to write an empty
05297        string for COMMITPT's change text.  Leaving the change text
05298        field set NULL won't work, since that means "preserve the original
05299        change text for this delta." */
05300     if (commitpt->text->text == NULL)
05301     {
05302         commitpt->text->text = xstrdup ("");
05303         commitpt->text->len = 0;
05304     }
05305     }
05306     else
05307     {
05308     /* This file is not being inserted at the head, but on a side
05309        branch somewhere.  Make a diff from the previous revision
05310        to the working file. */
05311     switch (diff_exec (tmpfile, workfile, diffopts, changefile))
05312     {
05313         case 0:
05314         case 1:
05315         break;
05316         case -1:
05317         /* FIXME-update-dir: message does not include update_dir.  */
05318         error (1, errno, "error diffing %s", workfile);
05319         break;
05320         default:
05321         /* FIXME-update-dir: message does not include update_dir.  */
05322         error (1, 0, "error diffing %s", workfile);
05323         break;
05324     }
05325     /* See the comment above, at the other get_file invocation,
05326        regarding binary vs. text.  */
05327     get_file (changefile, changefile,
05328           rcs->expand != NULL && STREQ (rcs->expand, "b") ? "rb" : "r",
05329           &dtext->text, &bufsize,
05330           &dtext->len);
05331     if (dtext->text == NULL)
05332     {
05333         dtext->text = xstrdup ("");
05334         dtext->len = 0;
05335     }
05336     }
05337
05338     /* Update DELTA linkage.  It is important not to do this before
05339        the very end of RCS_checkin; if an error arises that forces
05340        us to abort checking in, we must not have malformed deltas
05341        partially linked into the tree.
05342
05343        If DELTA and COMMITPT are on different branches, do nothing --
05344        DELTA is linked to the tree through COMMITPT->BRANCHES, and we
05345        don't want to change `next' pointers.
05346
05347        Otherwise, if the nodes are both on the trunk, link DELTA to
05348        COMMITPT; otherwise, link COMMITPT to DELTA. */
05349
05350     if (numdots (commitpt->version) == numdots (delta->version))
05351     {
05352     if (STREQ (commitpt->version, rcs->head))
05353     {
05354         delta->next = rcs->head;
05355         rcs->head = xstrdup (delta->version);
05356     }
05357     else
05358         commitpt->next = xstrdup (delta->version);
05359     }
05360
05361     /* Add DELTA to RCS->VERSIONS. */
05362     if (rcs->versions == NULL)
05363     rcs->versions = getlist();
05364     nodep = getnode();
05365     nodep->type = RCSVERS;
05366     nodep->delproc = rcsvers_delproc;
05367     nodep->data = (char *) delta;
05368     nodep->key = delta->version;
05369     (void) addnode (rcs->versions, nodep);
05370
05371     /* Write the new RCS file, inserting the new delta at COMMITPT. */
05372     if (!checkin_quiet)
05373     {
05374     cvs_output ("new revision: ", 14);
05375     cvs_output (delta->version, 0);
05376     cvs_output ("; previous revision: ", 21);
05377     cvs_output (commitpt->version, 0);
05378     cvs_output ("\n", 1);
05379     }
05380
05381     RCS_rewrite (rcs, dtext, commitpt->version);
05382
05383     if ((flags & RCS_FLAGS_KEEPFILE) == 0)
05384     {
05385     if (unlink_file (workfile) < 0)
05386         /* FIXME-update-dir: message does not include update_dir.  */
05387         error (1, errno, "cannot remove %s", workfile);
05388     }
05389     if (unlink_file (tmpfile) < 0)
05390     error (0, errno, "cannot remove %s", tmpfile);
05391     free (tmpfile);
05392     if (unlink_file (changefile) < 0)
05393     error (0, errno, "cannot remove %s", changefile);
05394     free (changefile);
05395
05396     if (!checkin_quiet)
05397     cvs_output ("done\n", 5);
05398
05399  checkin_done:
05400     if (allocated_workfile)
05401     free (workfile);
05402
05403     if (commitpt != NULL && commitpt->text != NULL)
05404     {
05405     freedeltatext (commitpt->text);
05406     commitpt->text = NULL;
05407     }
05408
05409     freedeltatext (dtext);
05410     if (status != 0)
05411     free_rcsvers_contents (delta);
05412
05413     return status;
05414 }
05415
05416 /* This structure is passed between RCS_cmp_file and cmp_file_buffer.  */
05417
05418 struct cmp_file_data
05419 {
05420     const char *filename;
05421     FILE *fp;
05422     int different;
05423 };
05424
05425 /* Compare the contents of revision REV of RCS file RCS with the
05426    contents of the file FILENAME.  OPTIONS is a string for the keyword
05427    expansion options.  Return 0 if the contents of the revision are
05428    the same as the contents of the file, 1 if they are different.  */
05429
05430 int
05431 RCS_cmp_file (rcs, rev, options, filename)
05432      RCSNode *rcs;
05433      char *rev;
05434      char *options;
05435      const char *filename;
05436 {
05437     int binary;
05438     FILE *fp;
05439     struct cmp_file_data data;
05440     int retcode;
05441
05442     if (options != NULL && options[0] != '\0')
05443     binary = STREQ (options, "-kb");
05444     else
05445     {
05446     char *expand;
05447
05448     expand = RCS_getexpand (rcs);
05449     if (expand != NULL && STREQ (expand, "b"))
05450         binary = 1;
05451     else
05452         binary = 0;
05453     }
05454
05455 #ifdef PRESERVE_PERMISSIONS_SUPPORT
05456     /* If CVS is to deal properly with special files (when
05457        PreservePermissions is on), the best way is to check out the
05458        revision to a temporary file and call `xcmp' on the two disk
05459        files.  xcmp needs to handle non-regular files properly anyway,
05460        so calling it simplifies RCS_cmp_file.  We *could* just yank
05461        the delta node out of the version tree and look for device
05462        numbers, but writing to disk and calling xcmp is a better
05463        abstraction (therefore probably more robust). -twp */
05464
05465     if (preserve_perms)
05466     {
05467     char *tmp;
05468
05469     tmp = cvs_temp_name();
05470     retcode = RCS_checkout(rcs, NULL, rev, NULL, options, tmp, NULL, NULL);
05471     if (retcode != 0)
05472         return 1;
05473
05474     retcode = xcmp (tmp, filename);
05475     if (CVS_UNLINK (tmp) < 0)
05476         error (0, errno, "cannot remove %s", tmp);
05477     free (tmp);
05478     return retcode;
05479     }
05480     else
05481 #endif
05482     {
05483         fp = CVS_FOPEN (filename, binary ? FOPEN_BINARY_READ : "r");
05484     if (fp == NULL)
05485         /* FIXME-update-dir: should include update_dir in message.  */
05486         error (1, errno, "cannot open file %s for comparing", filename);
05487
05488         data.filename = filename;
05489         data.fp = fp;
05490         data.different = 0;
05491
05492         retcode = RCS_checkout (rcs, (char *) NULL, rev, (char *) NULL,
05493                 options, RUN_TTY, cmp_file_buffer,
05494                 (void *) &data);
05495
05496         /* If we have not yet found a difference, make sure that we are at
05497            the end of the file.  */
05498         if (! data.different)
05499         {
05500         if (getc (fp) != EOF)
05501         data.different = 1;
05502         }
05503
05504         fclose (fp);
05505
05506     if (retcode != 0)
05507         return 1;
05508
05509         return data.different;
05510     }
05511 }
05512
05513 /* This is a subroutine of RCS_cmp_file.  It is passed to
05514    RCS_checkout.  */
05515
05516 #define CMP_BUF_SIZE (8 * 1024)
05517
05518 static void
05519 cmp_file_buffer (callerdat, buffer, len)
05520      void *callerdat;
05521      const char *buffer;
05522      size_t len;
05523 {
05524     struct cmp_file_data *data = (struct cmp_file_data *) callerdat;
05525     char *filebuf;
05526
05527     /* If we've already found a difference, we don't need to check
05528        further.  */
05529     if (data->different)
05530     return;
05531
05532     filebuf = xmalloc (len > CMP_BUF_SIZE ? CMP_BUF_SIZE : len);
05533
05534     while (len > 0)
05535     {
05536     size_t checklen;
05537
05538     checklen = len > CMP_BUF_SIZE ? CMP_BUF_SIZE : len;
05539     if (fread (filebuf, 1, checklen, data->fp) != checklen)
05540     {
05541         if (ferror (data->fp))
05542         error (1, errno, "cannot read file %s for comparing",
05543                data->filename);
05544         data->different = 1;
05545         free (filebuf);
05546         return;
05547     }
05548
05549     if (memcmp (filebuf, buffer, checklen) != 0)
05550     {
05551         data->different = 1;
05552         free (filebuf);
05553         return;
05554     }
05555
05556     buffer += checklen;
05557     len -= checklen;
05558     }
05559
05560     free (filebuf);
05561 }
05562
05563 /* For RCS file RCS, make symbolic tag TAG point to revision REV.
05564    This validates that TAG is OK for a user to use.  Return value is
05565    -1 for error (and errno is set to indicate the error), positive for
05566    error (and an error message has been printed), or zero for success.  */
05567
05568 int
05569 RCS_settag (rcs, tag, rev)
05570     RCSNode *rcs;
05571     const char *tag;
05572     const char *rev;
05573 {
05574     List *symbols;
05575     Node *node;
05576
05577     if (rcs->flags & PARTIAL)
05578     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
05579
05580     /* FIXME: This check should be moved to RCS_check_tag.  There is no
05581        reason for it to be here.  */
05582     if (STREQ (tag, TAG_BASE)
05583     || STREQ (tag, TAG_HEAD))
05584     {
05585     /* Print the name of the tag might be considered redundant
05586        with the caller, which also prints it.  Perhaps this helps
05587        clarify why the tag name is considered reserved, I don't
05588        know.  */
05589     error (0, 0, "Attempt to add reserved tag name %s", tag);
05590     return 1;
05591     }
05592
05593     /* A revision number of NULL means use the head or default branch.
05594        If rev is not NULL, it may be a symbolic tag or branch number;
05595        expand it to the correct numeric revision or branch head. */
05596     if (rev == NULL)
05597     rev = rcs->branch ? rcs->branch : rcs->head;
05598
05599     /* At this point rcs->symbol_data may not have been parsed.
05600        Calling RCS_symbols will force it to be parsed into a list
05601        which we can easily manipulate.  */
05602     symbols = RCS_symbols (rcs);
05603     if (symbols == NULL)
05604     {
05605     symbols = getlist ();
05606     rcs->symbols = symbols;
05607     }
05608     node = findnode (symbols, tag);
05609     if (node != NULL)
05610     {
05611     free (node->data);
05612     node->data = xstrdup (rev);
05613     }
05614     else
05615     {
05616     node = getnode ();
05617     node->key = xstrdup (tag);
05618     node->data = xstrdup (rev);
05619     (void) addnode_at_front (symbols, node);
05620     }
05621
05622     return 0;
05623 }
05624
05625 /* Delete the symbolic tag TAG from the RCS file RCS.  Return 0 if
05626    the tag was found (and removed), or 1 if it was not present.  (In
05627    either case, the tag will no longer be in RCS->SYMBOLS.) */
05628
05629 int
05630 RCS_deltag (rcs, tag)
05631     RCSNode *rcs;
05632     const char *tag;
05633 {
05634     List *symbols;
05635     Node *node;
05636     if (rcs->flags & PARTIAL)
05637     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
05638
05639     symbols = RCS_symbols (rcs);
05640     if (symbols == NULL)
05641     return 1;
05642
05643     node = findnode (symbols, tag);
05644     if (node == NULL)
05645     return 1;
05646
05647     delnode (node);
05648
05649     return 0;
05650 }
05651
05652 /* Set the default branch of RCS to REV.  */
05653
05654 int
05655 RCS_setbranch (rcs, rev)
05656      RCSNode *rcs;
05657      const char *rev;
05658 {
05659     if (rcs->flags & PARTIAL)
05660     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
05661
05662     if (rev && ! *rev)
05663     rev = NULL;
05664
05665     if (rev == NULL && rcs->branch == NULL)
05666     return 0;
05667     if (rev != NULL && rcs->branch != NULL && STREQ (rev, rcs->branch))
05668     return 0;
05669
05670     if (rcs->branch != NULL)
05671     free (rcs->branch);
05672     rcs->branch = xstrdup (rev);
05673
05674     return 0;
05675 }
05676
05677 /* Lock revision REV.  LOCK_QUIET is 1 to suppress output.  FIXME:
05678    Most of the callers only call us because RCS_checkin still tends to
05679    like a lock (a relic of old behavior inherited from the RCS ci
05680    program).  If we clean this up, only "cvs admin -l" will still need
05681    to call RCS_lock.  */
05682
05683 /* FIXME-twp: if a lock owned by someone else is broken, should this
05684    send mail to the lock owner?  Prompt user?  It seems like such an
05685    obscure situation for CVS as almost not worth worrying much
05686    about. */
05687
05688 int
05689 RCS_lock (rcs, rev, lock_quiet)
05690      RCSNode *rcs;
05691      const char *rev;
05692      int lock_quiet;
05693 {
05694     List *locks;
05695     Node *p;
05696     char *user;
05697     char *xrev = NULL;
05698
05699     if (rcs->flags & PARTIAL)
05700     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
05701
05702     locks = RCS_getlocks (rcs);
05703     if (locks == NULL)
05704     locks = rcs->locks = getlist();
05705     user = getcaller();
05706
05707     /* A revision number of NULL means lock the head or default branch. */
05708     if (rev == NULL)
05709     xrev = RCS_head (rcs);
05710
05711     /* If rev is a branch number, lock the latest revision on that
05712        branch. I think that if the branch doesn't exist, it's
05713        okay to return 0 -- that just means that the branch is new,
05714        so we don't need to lock it anyway. -twp */
05715     else if (RCS_nodeisbranch (rcs, rev))
05716     {
05717     xrev = RCS_getbranch (rcs, (char *) rev, 1);
05718     if (xrev == NULL)
05719     {
05720         if (!lock_quiet)
05721         error (0, 0, "%s: branch %s absent", rcs->path, rev);
05722         return 1;
05723     }
05724     }
05725
05726     if (xrev == NULL)
05727     xrev = xstrdup (rev);
05728
05729     /* Make sure that the desired revision exists.  Technically,
05730        we can update the locks list without even checking this,
05731        but RCS 5.7 did this.  And it can't hurt. */
05732     if (findnode (rcs->versions, xrev) == NULL)
05733     {
05734     if (!lock_quiet)
05735         error (0, 0, "%s: revision %s absent", rcs->path, xrev);
05736     free (xrev);
05737     return 1;
05738     }
05739
05740     /* Is this rev already locked? */
05741     p = findnode (locks, xrev);
05742     if (p != NULL)
05743     {
05744     if (STREQ (p->data, user))
05745     {
05746         /* We already own the lock on this revision, so do nothing. */
05747         free (xrev);
05748         return 0;
05749     }
05750
05751 #if 0
05752     /* Well, first of all, "rev" below should be "xrev" to avoid
05753        core dumps.  But more importantly, should we really be
05754        breaking the lock unconditionally?  What CVS 1.9 does (via
05755        RCS) is to prompt "Revision 1.1 is already locked by fred.
05756        Do you want to break the lock? [ny](n): ".  Well, we don't
05757        want to interact with the user (certainly not at the
05758        server/protocol level, and probably not in the command-line
05759        client), but isn't it more sensible to give an error and
05760        let the user run "cvs admin -u" if they want to break the
05761        lock?  */
05762
05763     /* Break the lock. */
05764     if (!lock_quiet)
05765     {
05766         cvs_output (rev, 0);
05767         cvs_output (" unlocked\n", 0);
05768     }
05769     delnode (p);
05770 #else
05771     /*error (1, 0, "Revision %s is already locked by %s", xrev, p->data);*/
05772     /*
05773      * CVSGUI Change : if several files are locked,
05774      * the user has no clue which file we're talking about
05775      */
05776     error (1, 0, "Revision %s of %s is already locked by %s", xrev, rcs->path, p->data);
05777 #endif
05778     }
05779
05780     /* Create a new lock. */
05781     p = getnode();
05782     p->key = xrev;  /* already xstrdupped */
05783     p->data = xstrdup (getcaller());
05784     (void) addnode_at_front (locks, p);
05785
05786     if (!lock_quiet)
05787     {
05788     cvs_output (xrev, 0);
05789     cvs_output (" locked\n", 0);
05790     }
05791
05792     return 0;
05793 }
05794
05795 /* Unlock revision REV.  UNLOCK_QUIET is 1 to suppress output.  FIXME:
05796    Like RCS_lock, this can become a no-op if we do the checkin
05797    ourselves.
05798
05799    If REV is not null and is locked by someone else, break their
05800    lock and notify them.  It is an open issue whether RCS_unlock
05801    queries the user about whether or not to break the lock. */
05802
05803 int
05804 RCS_unlock (rcs, rev, unlock_quiet)
05805      RCSNode *rcs;
05806      const char *rev;
05807      int unlock_quiet;
05808 {
05809     Node *lock;
05810     List *locks;
05811     char *user;
05812     char *xrev = NULL;
05813
05814     user = getcaller();
05815     if (rcs->flags & PARTIAL)
05816     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
05817
05818     /* If rev is NULL, unlock the latest revision (first in
05819        rcs->locks) held by the caller. */
05820     if (rev == NULL)
05821     {
05822     Node *p;
05823
05824     /* No-ops: attempts to unlock an empty tree or an unlocked file. */
05825     if (rcs->head == NULL)
05826     {
05827         if (!unlock_quiet)
05828         cvs_outerr ("can't unlock an empty tree\n", 0);
05829         return 0;
05830     }
05831
05832     locks = RCS_getlocks (rcs);
05833     if (locks == NULL)
05834     {
05835         if (!unlock_quiet)
05836         cvs_outerr ("No locks are set.\n", 0);
05837         return 0;
05838     }
05839
05840     lock = NULL;
05841     for (p = locks->list->next; p != locks->list; p = p->next)
05842     {
05843         if (lock != NULL)
05844         {
05845         if (!unlock_quiet)
05846             error (0, 0, "\
05847 %s: multiple revisions locked by %s; please specify one", rcs->path, user);
05848         return 1;
05849         }
05850         lock = p;
05851     }
05852     if (lock == NULL)
05853         return 0;   /* no lock found, ergo nothing to do */
05854     xrev = xstrdup (lock->key);
05855     }
05856     else if (RCS_nodeisbranch (rcs, rev))
05857     {
05858     /* If rev is a branch number, unlock the latest revision on that
05859        branch. */
05860     xrev = RCS_getbranch (rcs, (char *) rev, 1);
05861     if (xrev == NULL)
05862     {
05863         error (0, 0, "%s: branch %s absent", rcs->path, rev);
05864         return 1;
05865     }
05866     }
05867     else
05868     /* REV is an exact revision number. */
05869     xrev = xstrdup (rev);
05870
05871     lock = findnode (RCS_getlocks (rcs), xrev);
05872     if (lock == NULL)
05873     {
05874     /* This revision isn't locked. */
05875     free (xrev);
05876     return 0;
05877     }
05878
05879     if (! STREQ (lock->data, user))
05880     {
05881         /* If the revision is locked by someone else, notify
05882        them.  Note that this shouldn't ever happen if RCS_unlock
05883        is called with a NULL revision, since that means "whatever
05884        revision is currently locked by the caller." */
05885     char *repos, *workfile;
05886     repos = xstrdup (rcs->path);
05887     workfile = strrchr (repos, '/');
05888     *workfile++ = '\0';
05889     notify_do ('C', workfile, user, NULL, NULL, repos);
05890     free (repos);
05891     }
05892
05893     delnode (lock);
05894     if (!unlock_quiet)
05895     {
05896     cvs_output (xrev, 0);
05897     cvs_output (" unlocked\n", 0);
05898     }
05899
05900     free (xrev);
05901     return 0;
05902 }
05903
05904 /* Add USER to the access list of RCS.  Do nothing if already present.
05905    FIXME-twp: check syntax of USER to make sure it's a valid id. */
05906
05907 void
05908 RCS_addaccess (rcs, user)
05909     RCSNode *rcs;
05910     char *user;
05911 {
05912     char *access, *a;
05913
05914     if (rcs->flags & PARTIAL)
05915     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
05916
05917     if (rcs->access == NULL)
05918     rcs->access = xstrdup (user);
05919     else
05920     {
05921     access = xstrdup (rcs->access);
05922     for (a = strtok (access, " "); a != NULL; a = strtok (NULL, " "))
05923     {
05924         if (STREQ (a, user))
05925         {
05926         free (access);
05927         return;
05928         }
05929     }
05930     free (access);
05931     rcs->access = (char *) xrealloc
05932         (rcs->access, strlen (rcs->access) + strlen (user) + 2);
05933     strcat (rcs->access, " ");
05934     strcat (rcs->access, user);
05935     }
05936 }
05937
05938 /* Remove USER from the access list of RCS. */
05939
05940 void
05941 RCS_delaccess (rcs, user)
05942     RCSNode *rcs;
05943     char *user;
05944 {
05945     char *p, *s;
05946     int ulen;
05947
05948     if (rcs->flags & PARTIAL)
05949     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
05950
05951     if (rcs->access == NULL)
05952     return;
05953
05954     if (user == NULL)
05955     {
05956         free (rcs->access);
05957         rcs->access = NULL;
05958         return;
05959     }
05960
05961     p = rcs->access;
05962     ulen = strlen (user);
05963     while (p != NULL)
05964     {
05965     if (strncmp (p, user, ulen) == 0 && (p[ulen] == '\0' || p[ulen] == ' '))
05966         break;
05967     p = strchr (p, ' ');
05968     if (p != NULL)
05969         ++p;
05970     }
05971
05972     if (p == NULL)
05973     return;
05974
05975     s = p + ulen;
05976     while (*s != '\0')
05977     *p++ = *s++;
05978     *p = '\0';
05979 }
05980
05981 char *
05982 RCS_getaccess (rcs)
05983     RCSNode *rcs;
05984 {
05985     if (rcs->flags & PARTIAL)
05986     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
05987
05988     return rcs->access;
05989 }
05990
05991 static int findtag PROTO ((Node *, void *));
05992
05993 /* Return a nonzero value if the revision specified by ARG is found.  */
05994
05995 static int
05996 findtag (node, arg)
05997     Node *node;
05998     void *arg;
05999 {
06000     char *rev = (char *)arg;
06001
06002     if (STREQ (node->data, rev))
06003     return 1;
06004     else
06005     return 0;
06006 }
06007
06008 /* Delete revisions between REV1 and REV2.  The changes between the two
06009    revisions must be collapsed, and the result stored in the revision
06010    immediately preceding the lower one.  Return 0 for successful completion,
06011    1 otherwise.
06012
06013    Solution: check out the revision preceding REV1 and the revision
06014    following REV2.  Use call_diff to find aggregate diffs between
06015    these two revisions, and replace the delta text for the latter one
06016    with the new aggregate diff.  Alternatively, we could write a
06017    function that takes two change texts and combines them to produce a
06018    new change text, without checking out any revs or calling diff.  It
06019    would be hairy, but so, so cool.
06020
06021    If INCLUSIVE is set, then TAG1 and TAG2, if non-NULL, tell us to
06022    delete that revision as well (cvs admin -o tag1:tag2).  If clear,
06023    delete up to but not including that revision (cvs admin -o tag1::tag2).
06024    This does not affect TAG1 or TAG2 being NULL; the meaning of the start
06025    point in ::tag2 and :tag2 is the same and likewise for end points.  */
06026
06027 int
06028 RCS_delete_revs (rcs, tag1, tag2, inclusive)
06029     RCSNode *rcs;
06030     char *tag1;
06031     char *tag2;
06032     int inclusive;
06033 {
06034     char *next;
06035     Node *nodep;
06036     RCSVers *revp = NULL;
06037     RCSVers *beforep;
06038     int status, found;
06039     int save_noexec;
06040
06041     char *branchpoint = NULL;
06042     char *rev1 = NULL;
06043     char *rev2 = NULL;
06044     int rev1_inclusive = inclusive;
06045     int rev2_inclusive = inclusive;
06046     char *before = NULL;
06047     char *after = NULL;
06048     char *beforefile = NULL;
06049     char *afterfile = NULL;
06050     char *outfile = NULL;
06051
06052     if (tag1 == NULL && tag2 == NULL)
06053     return 0;
06054
06055     /* Assume error status until everything is finished. */
06056     status = 1;
06057
06058     /* Make sure both revisions exist. */
06059     if (tag1 != NULL)
06060     {
06061     rev1 = RCS_gettag (rcs, tag1, 1, NULL);
06062     if (rev1 == NULL || (nodep = findnode (rcs->versions, rev1)) == NULL)
06063     {
06064         error (0, 0, "%s: Revision %s doesn't exist.", rcs->path, tag1);
06065         goto delrev_done;
06066     }
06067     }
06068     if (tag2 != NULL)
06069     {
06070     rev2 = RCS_gettag (rcs, tag2, 1, NULL);
06071     if (rev2 == NULL || (nodep = findnode (rcs->versions, rev2)) == NULL)
06072     {
06073         error (0, 0, "%s: Revision %s doesn't exist.", rcs->path, tag2);
06074         goto delrev_done;
06075     }
06076     }
06077
06078     /* If rev1 is on the trunk and rev2 is NULL, rev2 should be
06079        RCS->HEAD.  (*Not* RCS_head(rcs), which may return rcs->branch
06080        instead.)  We need to check this special case early, in order
06081        to make sure that rev1 and rev2 get ordered correctly. */
06082     if (rev2 == NULL && numdots (rev1) == 1)
06083     {
06084     rev2 = xstrdup (rcs->head);
06085     rev2_inclusive = 1;
06086     }
06087
06088     if (rev2 == NULL)
06089     rev2_inclusive = 1;
06090
06091     if (rev1 != NULL && rev2 != NULL)
06092     {
06093     /* A range consisting of a branch number means the latest revision
06094        on that branch. */
06095     if (RCS_isbranch (rcs, rev1) && STREQ (rev1, rev2))
06096         rev1 = rev2 = RCS_getbranch (rcs, rev1, 0);
06097     else
06098     {
06099         /* Make sure REV1 and REV2 are ordered correctly (in the
06100            same order as the next field).  For revisions on the
06101            trunk, REV1 should be higher than REV2; for branches,
06102            REV1 should be lower.  */
06103         /* Shouldn't we just be giving an error in the case where
06104            the user specifies the revisions in the wrong order
06105            (that is, always swap on the trunk, never swap on a
06106            branch, in the non-error cases)?  It is not at all
06107            clear to me that users who specify -o 1.4:1.2 really
06108            meant to type -o 1.2:1.4, and the out of order usage
06109            has never been documented, either by cvs.texinfo or
06110            rcs(1).  */
06111         char *temp;
06112         int temp_inclusive;
06113         if (numdots (rev1) == 1)
06114         {
06115         if (compare_revnums (rev1, rev2) <= 0)
06116         {
06117             temp = rev2;
06118             rev2 = rev1;
06119             rev1 = temp;
06120
06121             temp_inclusive = rev2_inclusive;
06122             rev2_inclusive = rev1_inclusive;
06123             rev1_inclusive = temp_inclusive;
06124         }
06125         }
06126         else if (compare_revnums (rev1, rev2) > 0)
06127         {
06128         temp = rev2;
06129         rev2 = rev1;
06130         rev1 = temp;
06131
06132         temp_inclusive = rev2_inclusive;
06133         rev2_inclusive = rev1_inclusive;
06134         rev1_inclusive = temp_inclusive;
06135         }
06136     }
06137     }
06138
06139     /* Basically the same thing; make sure that the ordering is what we
06140        need.  */
06141     if (rev1 == NULL)
06142     {
06143     assert (rev2 != NULL);
06144     if (numdots (rev2) == 1)
06145     {
06146         /* Swap rev1 and rev2.  */
06147         int temp_inclusive;
06148
06149         rev1 = rev2;
06150         rev2 = NULL;
06151
06152         temp_inclusive = rev2_inclusive;
06153         rev2_inclusive = rev1_inclusive;
06154         rev1_inclusive = temp_inclusive;
06155     }
06156     }
06157
06158     /* Put the revision number preceding the first one to delete into
06159        BEFORE (where "preceding" means according to the next field).
06160        If the first revision to delete is the first revision on its
06161        branch (e.g. 1.3.2.1), BEFORE should be the node on the trunk
06162        at which the branch is rooted.  If the first revision to delete
06163        is the head revision of the trunk, set BEFORE to NULL.
06164
06165        Note that because BEFORE may not be on the same branch as REV1,
06166        it is not very handy for navigating the revision tree.  It's
06167        most useful just for checking out the revision preceding REV1. */
06168     before = NULL;
06169     branchpoint = RCS_getbranchpoint (rcs, rev1 != NULL ? rev1 : rev2);
06170     if (rev1 == NULL)
06171     {
06172     rev1 = xstrdup (branchpoint);
06173     if (numdots (branchpoint) > 1)
06174     {
06175         char *bp;
06176         bp = strrchr (branchpoint, '.');
06177         while (*--bp != '.')
06178         ;
06179         *bp = '\0';
06180         /* Note that this is exclusive, always, because the inclusive
06181            flag doesn't affect the meaning when rev1 == NULL.  */
06182         before = xstrdup (branchpoint);
06183         *bp = '.';
06184     }
06185     }
06186     else if (! STREQ (rev1, branchpoint))
06187     {
06188     /* Walk deltas from BRANCHPOINT on, looking for REV1. */
06189     nodep = findnode (rcs->versions, branchpoint);
06190     revp = (RCSVers *) nodep->data;
06191     while (revp->next != NULL && ! STREQ (revp->next, rev1))
06192     {
06193         revp = (RCSVers *) nodep->data;
06194         nodep = findnode (rcs->versions, revp->next);
06195     }
06196     if (revp->next == NULL)
06197     {
06198         error (0, 0, "%s: Revision %s doesn't exist.", rcs->path, rev1);
06199         goto delrev_done;
06200     }
06201     if (rev1_inclusive)
06202         before = xstrdup (revp->version);
06203     else
06204     {
06205         before = rev1;
06206         nodep = findnode (rcs->versions, before);
06207         rev1 = xstrdup (((RCSVers *)nodep->data)->next);
06208     }
06209     }
06210     else if (!rev1_inclusive)
06211     {
06212     before = rev1;
06213     nodep = findnode (rcs->versions, before);
06214     rev1 = xstrdup (((RCSVers *)nodep->data)->next);
06215     }
06216     else if (numdots (branchpoint) > 1)
06217     {
06218     /* Example: rev1 is "1.3.2.1", branchpoint is "1.3.2.1".
06219        Set before to "1.3".  */
06220     char *bp;
06221     bp = strrchr (branchpoint, '.');
06222     while (*--bp != '.')
06223         ;
06224     *bp = '\0';
06225     before = xstrdup (branchpoint);
06226     *bp = '.';
06227     }
06228
06229     /* If any revision between REV1 and REV2 is locked or is a branch point,
06230        we can't delete that revision and must abort. */
06231     after = NULL;
06232     next = rev1;
06233     found = 0;
06234     while (!found && next != NULL)
06235     {
06236     nodep = findnode (rcs->versions, next);
06237     revp = (RCSVers *) nodep->data;
06238
06239     if (rev2 != NULL)
06240         found = STREQ (revp->version, rev2);
06241     next = revp->next;
06242
06243     if ((!found && next != NULL) || rev2_inclusive || rev2 == NULL)
06244     {
06245         if (findnode (RCS_getlocks (rcs), revp->version))
06246         {
06247         error (0, 0, "%s: can't remove locked revision %s",
06248                rcs->path,
06249                revp->version);
06250         goto delrev_done;
06251         }
06252         if (revp->branches != NULL)
06253         {
06254         error (0, 0, "%s: can't remove branch point %s",
06255                rcs->path,
06256                revp->version);
06257         goto delrev_done;
06258         }
06259
06260         /* Doing this only for the :: syntax is for compatibility.
06261            See cvs.texinfo for somewhat more discussion.  */
06262         if (!inclusive
06263         && walklist (RCS_symbols (rcs), findtag, revp->version))
06264         {
06265         /* We don't print which file this happens to on the theory
06266            that the caller will print the name of the file in a
06267            more useful fashion (fullname not rcs->path).  */
06268         error (0, 0, "cannot remove revision %s because it has tags",
06269                revp->version);
06270         goto delrev_done;
06271         }
06272
06273         /* It's misleading to print the `deleting revision' output
06274            here, since we may not actually delete these revisions.
06275            But that's how RCS does it.  Bleah.  Someday this should be
06276            moved to the point where the revs are actually marked for
06277            deletion. -twp */
06278         cvs_output ("deleting revision ", 0);
06279         cvs_output (revp->version, 0);
06280         cvs_output ("\n", 1);
06281     }
06282     }
06283
06284     if (rev2 == NULL)
06285     ;
06286     else if (found)
06287     {
06288     if (rev2_inclusive)
06289         after = xstrdup (next);
06290     else
06291         after = xstrdup (revp->version);
06292     }
06293     else if (!inclusive)
06294     {
06295     /* In the case of an empty range, for example 1.2::1.2 or
06296        1.2::1.3, we want to just do nothing.  */
06297     status = 0;
06298     goto delrev_done;
06299     }
06300     else
06301     {
06302     /* This looks fishy in the cases where tag1 == NULL or tag2 == NULL.
06303        Are those cases really impossible?  */
06304     assert (tag1 != NULL);
06305     assert (tag2 != NULL);
06306
06307     error (0, 0, "%s: invalid revision range %s:%s", rcs->path,
06308            tag1, tag2);
06309     goto delrev_done;
06310     }
06311
06312     if (after == NULL && before == NULL)
06313     {
06314     /* The user is trying to delete all revisions.  While an
06315        RCS file without revisions makes sense to RCS (e.g. the
06316        state after "rcs -i"), CVS has never been able to cope with
06317        it.  So at least for now we just make this an error.
06318
06319        We don't include rcs->path in the message since "cvs admin"
06320        already printed "RCS file:" and the name.  */
06321     error (1, 0, "attempt to delete all revisions");
06322     }
06323
06324     /* The conditionals at this point get really hairy.  Here is the
06325        general idea:
06326
06327        IF before != NULL and after == NULL
06328          THEN don't check out any revisions, just delete them
06329        IF before == NULL and after != NULL
06330          THEN only check out after's revision, and use it for the new deltatext
06331        ELSE
06332          check out both revisions and diff -n them.  This could use
06333      RCS_exec_rcsdiff with some changes, like being able
06334      to suppress diagnostic messages and to direct output. */
06335
06336     if (after != NULL)
06337     {
06338     char *diffbuf;
06339     size_t bufsize, len;
06340
06341 #if defined (__CYGWIN32__) || defined (_WIN32)
06342     /* FIXME: This is an awful kludge, but at least until I have
06343        time to work on it a little more and test it, I'd rather
06344        give a fatal error than corrupt the file.  I think that we
06345        need to use "-kb" and "--binary" and "rb" to get_file
06346        (probably can do it always, not just for binary files, if
06347        we are consistent between the RCS_checkout and the diff).  */
06348     {
06349         char *expand = RCS_getexpand (rcs);
06350         if (expand != NULL && STREQ (expand, "b"))
06351         error (1, 0,
06352            "admin -o not implemented yet for binary on this system");
06353     }
06354 #endif
06355
06356     afterfile = cvs_temp_name();
06357     status = RCS_checkout (rcs, NULL, after, NULL, "-ko", afterfile,
06358                    (RCSCHECKOUTPROC)0, NULL);
06359     if (status > 0)
06360         goto delrev_done;
06361
06362     if (before == NULL)
06363     {
06364         /* We are deleting revisions from the head of the tree,
06365            so must create a new head. */
06366         diffbuf = NULL;
06367         bufsize = 0;
06368         get_file (afterfile, afterfile, "r", &diffbuf, &bufsize, &len);
06369
06370         save_noexec = noexec;
06371         noexec = 0;
06372         if (unlink_file (afterfile) < 0)
06373         error (0, errno, "cannot remove %s", afterfile);
06374         noexec = save_noexec;
06375
06376         free (afterfile);
06377         afterfile = NULL;
06378
06379         free (rcs->head);
06380         rcs->head = xstrdup (after);
06381     }
06382     else
06383     {
06384         beforefile = cvs_temp_name();
06385         status = RCS_checkout (rcs, NULL, before, NULL, "-ko", beforefile,
06386                    (RCSCHECKOUTPROC)0, NULL);
06387         if (status > 0)
06388         goto delrev_done;
06389
06390         outfile = cvs_temp_name();
06391         status = diff_exec (beforefile, afterfile, "-an", outfile);
06392
06393         if (status == 2)
06394         {
06395         /* Not sure we need this message; will diff_exec already
06396            have printed an error?  */
06397         error (0, 0, "%s: could not diff", rcs->path);
06398         status = 1;
06399         goto delrev_done;
06400         }
06401
06402         diffbuf = NULL;
06403         bufsize = 0;
06404         get_file (outfile, outfile, "r", &diffbuf, &bufsize, &len);
06405     }
06406
06407     /* Save the new change text in after's delta node. */
06408     nodep = findnode (rcs->versions, after);
06409     revp = (RCSVers *) nodep->data;
06410
06411     assert (revp->text == NULL);
06412
06413     revp->text = (Deltatext *) xmalloc (sizeof (Deltatext));
06414     memset ((Deltatext *) revp->text, 0, sizeof (Deltatext));
06415     revp->text->version = xstrdup (revp->version);
06416     revp->text->text = diffbuf;
06417     revp->text->len = len;
06418
06419     /* If DIFFBUF is NULL, it means that OUTFILE is empty and that
06420        there are no differences between the two revisions.  In that
06421        case, we want to force RCS_copydeltas to write an empty string
06422        for the new change text (leaving the text field set NULL
06423        means "preserve the original change text for this delta," so
06424        we don't want that). */
06425     if (revp->text->text == NULL)
06426         revp->text->text = xstrdup ("");
06427     }
06428
06429     /* Walk through the revisions (again) to mark each one as
06430        outdated.  (FIXME: would it be safe to use the `dead' field for
06431        this?  Doubtful.) */
06432     for (next = rev1;
06433      next != NULL && (after == NULL || ! STREQ (next, after));
06434      next = revp->next)
06435     {
06436     nodep = findnode (rcs->versions, next);
06437     revp = (RCSVers *) nodep->data;
06438     revp->outdated = 1;
06439     }
06440
06441     /* Update delta links.  If BEFORE == NULL, we're changing the
06442        head of the tree and don't need to update any `next' links. */
06443     if (before != NULL)
06444     {
06445     /* If REV1 is the first node on its branch, then BEFORE is its
06446        root node (on the trunk) and we have to update its branches
06447        list.  Otherwise, BEFORE is on the same branch as AFTER, and
06448        we can just change BEFORE's `next' field to point to AFTER.
06449        (This should be safe: since findnode manages its lists via
06450        the `hashnext' and `hashprev' fields, rather than `next' and
06451        `prev', mucking with `next' and `prev' should not corrupt the
06452        delta tree's internal structure.  Much. -twp) */
06453
06454     if (rev1 == NULL)
06455         /* beforep's ->next field already should be equal to after,
06456            which I think is always NULL in this case.  */
06457         ;
06458     else if (STREQ (rev1, branchpoint))
06459     {
06460         nodep = findnode (rcs->versions, before);
06461         revp = (RCSVers *) nodep->data;
06462         nodep = revp->branches->list->next;
06463         while (nodep != revp->branches->list &&
06464            ! STREQ (nodep->key, rev1))
06465         nodep = nodep->next;
06466         assert (nodep != revp->branches->list);
06467         if (after == NULL)
06468         delnode (nodep);
06469         else
06470         {
06471         free (nodep->key);
06472         nodep->key = xstrdup (after);
06473         }
06474     }
06475     else
06476     {
06477         nodep = findnode (rcs->versions, before);
06478         beforep = (RCSVers *) nodep->data;
06479         free (beforep->next);
06480         beforep->next = xstrdup (after);
06481     }
06482     }
06483
06484     status = 0;
06485
06486  delrev_done:
06487     if (rev1 != NULL)
06488     free (rev1);
06489     if (rev2 != NULL)
06490     free (rev2);
06491     if (branchpoint != NULL)
06492     free (branchpoint);
06493     if (before != NULL)
06494     free (before);
06495     if (after != NULL)
06496     free (after);
06497
06498     save_noexec = noexec;
06499     noexec = 0;
06500     if (beforefile != NULL)
06501     {
06502     if (unlink_file (beforefile) < 0)
06503         error (0, errno, "cannot remove %s", beforefile);
06504     free (beforefile);
06505     }
06506     if (afterfile != NULL)
06507     {
06508     if (unlink_file (afterfile) < 0)
06509         error (0, errno, "cannot remove %s", afterfile);
06510     free (afterfile);
06511     }
06512     if (outfile != NULL)
06513     {
06514     if (unlink_file (outfile) < 0)
06515         error (0, errno, "cannot remove %s", outfile);
06516     free (outfile);
06517     }
06518     noexec = save_noexec;
06519
06520     return status;
06521 }
06522
06523 /*
06524  * TRUE if there exists a symbolic tag "tag" in file.
06525  */
06526 int
06527 RCS_exist_tag (rcs, tag)
06528     RCSNode *rcs;
06529     char *tag;
06530 {
06531
06532     assert (rcs != NULL);
06533
06534     if (findnode (RCS_symbols (rcs), tag))
06535     return 1;
06536     return 0;
06537
06538 }
06539
06540 /*
06541  * TRUE if RCS revision number "rev" exists.
06542  * This includes magic branch revisions, not found in rcs->versions,
06543  * but only in rcs->symbols, requiring a list walk to find them.
06544  * Take advantage of list walk callback function already used by
06545  * RCS_delete_revs, above.
06546  */
06547 int
06548 RCS_exist_rev (rcs, rev)
06549     RCSNode *rcs;
06550     char *rev;
06551 {
06552
06553     assert (rcs != NULL);
06554
06555     if (rcs->flags & PARTIAL)
06556     RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer *) NULL);
06557
06558     if (findnode(rcs->versions, rev) != 0)
06559     return 1;
06560
06561     if (walklist (RCS_symbols(rcs), findtag, rev) != 0)
06562     return 1;
06563
06564     return 0;
06565
06566 }
06567
06568
06569 /* RCS_deltas and friends.  Processing of the deltas in RCS files.  */
06570
06571 struct line
06572 {
06573     /* Text of this line.  Part of the same malloc'd block as the struct
06574        line itself (we probably should use the "struct hack" (char text[1])
06575        and save ourselves sizeof (char *) bytes).  Does not include \n;
06576        instead has_newline indicates the presence or absence of \n.  */
06577     char *text;
06578     /* Length of this line, not counting \n if has_newline is true.  */
06579     size_t len;
06580     /* Version in which it was introduced.  */
06581     RCSVers *vers;
06582     /* Nonzero if this line ends with \n.  This will always be true
06583        except possibly for the last line.  */
06584     int has_newline;
06585     /* Number of pointers to this struct line.  */
06586     int refcount;
06587 };
06588
06589 struct linevector
06590 {
06591     /* How many lines in use for this linevector?  */
06592     unsigned int nlines;
06593     /* How many lines allocated for this linevector?  */
06594     unsigned int lines_alloced;
06595     /* Pointer to array containing a pointer to each line.  */
06596     struct line **vector;
06597 };
06598
06599 static void linevector_init PROTO ((struct linevector *));
06600
06601 /* Initialize *VEC to be a linevector with no lines.  */
06602 static void
06603 linevector_init (vec)
06604     struct linevector *vec;
06605 {
06606     vec->lines_alloced = 0;
06607     vec->nlines = 0;
06608     vec->vector = NULL;
06609 }
06610
06611 static int linevector_add PROTO ((struct linevector *vec, const char *text,
06612                   size_t len, RCSVers *vers,
06613                   unsigned int pos));
06614
06615 /* Given some text TEXT, add each of its lines to VEC before line POS
06616    (where line 0 is the first line).  The last line in TEXT may or may
06617    not be \n terminated.
06618    Set the version for each of the new lines to VERS.  This
06619    function returns non-zero for success.  It returns zero if the line
06620    number is out of range.
06621
06622    Each of the lines in TEXT are copied to space which is managed with
06623    the linevector (and freed by linevector_free).  So the caller doesn't
06624    need to keep TEXT around after the call to this function.  */
06625 static int
06626 linevector_add (vec, text, len, vers, pos)
06627     struct linevector *vec;
06628     const char *text;
06629     size_t len;
06630     RCSVers *vers;
06631     unsigned int pos;
06632 {
06633     const char *textend;
06634     unsigned int i;
06635     unsigned int nnew;
06636     const char *p;
06637     const char *nextline_text;
06638     size_t nextline_len;
06639     int nextline_newline;
06640     struct line *q;
06641
06642     if (len == 0)
06643     return 1;
06644
06645     textend = text + len;
06646
06647     /* Count the number of lines we will need to add.  */
06648     nnew = 1;
06649     for (p = text; p < textend; ++p)
06650     if (*p == '\n' && p + 1 < textend)
06651         ++nnew;
06652
06653     /* Expand VEC->VECTOR if needed.  */
06654     if (vec->nlines + nnew >= vec->lines_alloced)
06655     {
06656     if (vec->lines_alloced == 0)
06657         vec->lines_alloced = 10;
06658     while (vec->nlines + nnew >= vec->lines_alloced)
06659         vec->lines_alloced *= 2;
06660     vec->vector = xrealloc (vec->vector,
06661                 vec->lines_alloced * sizeof (*vec->vector));
06662     }
06663
06664     /* Make room for the new lines in VEC->VECTOR.  */
06665     for (i = vec->nlines + nnew - 1; i >= pos + nnew; --i)
06666     vec->vector[i] = vec->vector[i - nnew];
06667
06668     if (pos > vec->nlines)
06669     return 0;
06670
06671     /* Actually add the lines, to VEC->VECTOR.  */
06672     i = pos;
06673     nextline_text = text;
06674     nextline_newline = 0;
06675     for (p = text; p < textend; ++p)
06676     if (*p == '\n')
06677     {
06678         nextline_newline = 1;
06679         if (p + 1 == textend)
06680         /* If there are no characters beyond the last newline, we
06681            don't consider it another line.  */
06682         break;
06683         nextline_len = p - nextline_text;
06684         q = (struct line *) xmalloc (sizeof (struct line) + nextline_len);
06685         q->vers = vers;
06686         q->text = (char *)q + sizeof (struct line);
06687         q->len = nextline_len;
06688         q->has_newline = nextline_newline;
06689         q->refcount = 1;
06690         memcpy (q->text, nextline_text, nextline_len);
06691         vec->vector[i++] = q;
06692
06693         nextline_text = (char *)p + 1;
06694         nextline_newline = 0;
06695     }
06696     nextline_len = p - nextline_text;
06697     q = (struct line *) xmalloc (sizeof (struct line) + nextline_len);
06698     q->vers = vers;
06699     q->text = (char *)q + sizeof (struct line);
06700     q->len = nextline_len;
06701     q->has_newline = nextline_newline;
06702     q->refcount = 1;
06703     memcpy (q->text, nextline_text, nextline_len);
06704     vec->vector[i] = q;
06705
06706     vec->nlines += nnew;
06707
06708     return 1;
06709 }
06710
06711 static void linevector_delete PROTO ((struct linevector *, unsigned int,
06712                       unsigned int));
06713
06714 /* Remove NLINES lines from VEC at position POS (where line 0 is the
06715    first line).  */
06716 static void
06717 linevector_delete (vec, pos, nlines)
06718     struct linevector *vec;
06719     unsigned int pos;
06720     unsigned int nlines;
06721 {
06722     unsigned int i;
06723     unsigned int last;
06724
06725     last = vec->nlines - nlines;
06726     for (i = pos; i < pos + nlines; ++i)
06727     {
06728     if (--vec->vector[i]->refcount == 0)
06729         free (vec->vector[i]);
06730     }
06731     for (i = pos; i < last; ++i)
06732     vec->vector[i] = vec->vector[i + nlines];
06733     vec->nlines -= nlines;
06734 }
06735
06736 static void linevector_copy PROTO ((struct linevector *, struct linevector *));
06737
06738 /* Copy FROM to TO, copying the vectors but not the lines pointed to.  */
06739 static void
06740 linevector_copy (to, from)
06741     struct linevector *to;
06742     struct linevector *from;
06743 {
06744     unsigned int ln;
06745
06746     for (ln = 0; ln < to->nlines; ++ln)
06747     {
06748     if (--to->vector[ln]->refcount == 0)
06749         free (to->vector[ln]);
06750     }
06751     if (from->nlines > to->lines_alloced)
06752     {
06753     if (to->lines_alloced == 0)
06754         to->lines_alloced = 10;
06755     while (from->nlines > to->lines_alloced)
06756         to->lines_alloced *= 2;
06757     to->vector = (struct line **)
06758         xrealloc (to->vector, to->lines_alloced * sizeof (*to->vector));
06759     }
06760     memcpy (to->vector, from->vector,
06761         from->nlines * sizeof (*to->vector));
06762     to->nlines = from->nlines;
06763     for (ln = 0; ln < to->nlines; ++ln)
06764     ++to->vector[ln]->refcount;
06765 }
06766
06767 static void linevector_free PROTO ((struct linevector *));
06768
06769 /* Free storage associated with linevector.  */
06770 static void
06771 linevector_free (vec)
06772     struct linevector *vec;
06773 {
06774     unsigned int ln;
06775
06776     if (vec->vector != NULL)
06777     {
06778     for (ln = 0; ln < vec->nlines; ++ln)
06779         if (--vec->vector[ln]->refcount == 0)
06780         free (vec->vector[ln]);
06781
06782     free (vec->vector);
06783     }
06784 }
06785
06786 static char *month_printname PROTO ((char *));
06787
06788 /* Given a textual string giving the month (1-12), terminated with any
06789    character not recognized by atoi, return the 3 character name to
06790    print it with.  I do not think it is a good idea to change these
06791    strings based on the locale; they are standard abbreviations (for
06792    example in rfc822 mail messages) which should be widely understood.
06793    Returns a pointer into static readonly storage.  */
06794 static char *
06795 month_printname (month)
06796     char *month;
06797 {
06798     static const char *const months[] =
06799       {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
06800      "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
06801     int mnum;
06802
06803     mnum = atoi (month);
06804     if (mnum < 1 || mnum > 12)
06805     return "???";
06806     return (char *)months[mnum - 1];
06807 }
06808
06809 static int
06810 apply_rcs_changes PROTO ((struct linevector *, const char *, size_t,
06811               const char *, RCSVers *, RCSVers *));
06812
06813 /* Apply changes to the line vector LINES.  DIFFBUF is a buffer of
06814    length DIFFLEN holding the change text from an RCS file (the output
06815    of diff -n).  NAME is used in error messages.  The VERS field of
06816    any line added is set to ADDVERS.  The VERS field of any line
06817    deleted is set to DELVERS, unless DELVERS is NULL, in which case
06818    the VERS field of deleted lines is unchanged.  The function returns
06819    non-zero if the change text is applied successfully.  It returns
06820    zero if the change text does not appear to apply to LINES (e.g., a
06821    line number is invalid).  If the change text is improperly
06822    formatted (e.g., it is not the output of diff -n), the function
06823    calls error with a status of 1, causing the program to exit.  */
06824
06825 static int
06826 apply_rcs_changes (lines, diffbuf, difflen, name, addvers, delvers)
06827      struct linevector *lines;
06828      const char *diffbuf;
06829      size_t difflen;
06830      const char *name;
06831      RCSVers *addvers;
06832      RCSVers *delvers;
06833 {
06834     const char *p;
06835     const char *q;
06836     int op;
06837     /* The RCS format throws us for a loop in that the deltafrags (if
06838        we define a deltafrag as an add or a delete) need to be applied
06839        in reverse order.  So we stick them into a linked list.  */
06840     struct deltafrag {
06841     enum {FRAG_ADD, FRAG_DELETE} type;
06842     unsigned long pos;
06843     unsigned long nlines;
06844     const char *new_lines;
06845     size_t len;
06846     struct deltafrag *next;
06847     };
06848     struct deltafrag *dfhead;
06849     struct deltafrag *df;
06850
06851     dfhead = NULL;
06852     for (p = diffbuf; p != NULL && p < diffbuf + difflen; )
06853     {
06854     op = *p++;
06855     if (op != 'a' && op != 'd')
06856         /* Can't just skip over the deltafrag, because the value
06857            of op determines the syntax.  */
06858         error (1, 0, "unrecognized operation '\\x%x' in %s",
06859            op, name);
06860     df = (struct deltafrag *) xmalloc (sizeof (struct deltafrag));
06861     df->next = dfhead;
06862     dfhead = df;
06863     df->pos = strtoul (p, (char **) &q, 10);
06864
06865     if (p == q)
06866         error (1, 0, "number expected in %s", name);
06867     p = q;
06868     if (*p++ != ' ')
06869         error (1, 0, "space expected in %s", name);
06870     df->nlines = strtoul (p, (char **) &q, 10);
06871     if (p == q)
06872         error (1, 0, "number expected in %s", name);
06873     p = q;
06874     if (*p++ != '\012')
06875         error (1, 0, "linefeed expected in %s", name);
06876
06877     if (op == 'a')
06878     {
06879         unsigned int i;
06880
06881         df->type = FRAG_ADD;
06882         i = df->nlines;
06883         /* The text we want is the number of lines specified, or
06884            until the end of the value, whichever comes first (it
06885            will be the former except in the case where we are
06886            adding a line which does not end in newline).  */
06887         for (q = p; i != 0; ++q)
06888         if (*q == '\n')
06889             --i;
06890         else if (q == diffbuf + difflen)
06891         {
06892             if (i != 1)
06893             error (1, 0, "premature end of change in %s", name);
06894             else
06895             break;
06896         }
06897
06898         /* Stash away a pointer to the text we are adding.  */
06899         df->new_lines = p;
06900         df->len = q - p;
06901
06902         p = q;
06903     }
06904     else
06905     {
06906         /* Correct for the fact that line numbers in RCS files
06907            start with 1.  */
06908         --df->pos;
06909
06910         assert (op == 'd');
06911         df->type = FRAG_DELETE;
06912     }
06913     }
06914
06915     for (df = dfhead; df != NULL;)
06916     {
06917     unsigned int ln;
06918
06919     switch (df->type)
06920     {
06921     case FRAG_ADD:
06922         if (! linevector_add (lines, df->new_lines, df->len, addvers,
06923                   df->pos))
06924         return 0;
06925         break;
06926     case FRAG_DELETE:
06927         if (df->pos > lines->nlines
06928         || df->pos + df->nlines > lines->nlines)
06929         return 0;
06930         if (delvers != NULL)
06931         for (ln = df->pos; ln < df->pos + df->nlines; ++ln)
06932             lines->vector[ln]->vers = delvers;
06933         linevector_delete (lines, df->pos, df->nlines);
06934         break;
06935     }
06936     df = df->next;
06937     free (dfhead);
06938     dfhead = df;
06939     }
06940
06941     return 1;
06942 }
06943
06944 /* Apply an RCS change text to a buffer.  The function name starts
06945    with rcs rather than RCS because this does not take an RCSNode
06946    argument.  NAME is used in error messages.  TEXTBUF is the text
06947    buffer to change, and TEXTLEN is the size.  DIFFBUF and DIFFLEN are
06948    the change buffer and size.  The new buffer is returned in *RETBUF
06949    and *RETLEN.  The new buffer is allocated by xmalloc.
06950
06951    Return 1 for success.  On failure, call error and return 0.  */
06952
06953 int
06954 rcs_change_text (name, textbuf, textlen, diffbuf, difflen, retbuf, retlen)
06955      const char *name;
06956      char *textbuf;
06957      size_t textlen;
06958      const char *diffbuf;
06959      size_t difflen;
06960      char **retbuf;
06961      size_t *retlen;
06962 {
06963     struct linevector lines;
06964     int ret;
06965
06966     *retbuf = NULL;
06967     *retlen = 0;
06968
06969     linevector_init (&lines);
06970
06971     if (! linevector_add (&lines, textbuf, textlen, NULL, 0))
06972     error (1, 0, "cannot initialize line vector");
06973
06974     if (! apply_rcs_changes (&lines, diffbuf, difflen, name, NULL, NULL))
06975     {
06976     error (0, 0, "invalid change text in %s", name);
06977     ret = 0;
06978     }
06979     else
06980     {
06981     char *p;
06982     size_t n;
06983     unsigned int ln;
06984
06985     n = 0;
06986     for (ln = 0; ln < lines.nlines; ++ln)
06987         /* 1 for \n */
06988         n += lines.vector[ln]->len + 1;
06989
06990     p = xmalloc (n);
06991     *retbuf = p;
06992
06993     for (ln = 0; ln < lines.nlines; ++ln)
06994     {
06995         memcpy (p, lines.vector[ln]->text, lines.vector[ln]->len);
06996         p += lines.vector[ln]->len;
06997         if (lines.vector[ln]->has_newline)
06998         *p++ = '\n';
06999     }
07000
07001     *retlen = p - *retbuf;
07002     assert (*retlen <= n);
07003
07004     ret = 1;
07005     }
07006
07007     linevector_free (&lines);
07008
07009     return ret;
07010 }
07011
07012 /* Walk the deltas in RCS to get to revision VERSION.
07013
07014    If OP is RCS_ANNOTATE, then write annotations using cvs_output.
07015
07016    If OP is RCS_FETCH, then put the contents of VERSION into a
07017    newly-malloc'd array and put a pointer to it in *TEXT.  Each line
07018    is \n terminated; the caller is responsible for converting text
07019    files if desired.  The total length is put in *LEN.
07020
07021    If FP is non-NULL, it should be a file descriptor open to the file
07022    RCS with file position pointing to the deltas.  We close the file
07023    when we are done.
07024
07025    If LOG is non-NULL, then *LOG is set to the log message of VERSION,
07026    and *LOGLEN is set to the length of the log message.
07027
07028    On error, give a fatal error.  */
07029
07030 static void
07031 RCS_deltas (rcs, fp, rcsbuf, version, op, text, len, log, loglen)
07032     RCSNode *rcs;
07033     FILE *fp;
07034     struct rcsbuffer *rcsbuf;
07035     char *version;
07036     enum rcs_delta_op op;
07037     char **text;
07038     size_t *len;
07039     char **log;
07040     size_t *loglen;
07041 {
07042     struct rcsbuffer rcsbuf_local;
07043     char *branchversion;
07044     char *cpversion;
07045     char *key;
07046     char *value;
07047     size_t vallen;
07048     RCSVers *vers;
07049     RCSVers *prev_vers;
07050     RCSVers *trunk_vers;
07051     char *next;
07052     int ishead, isnext, isversion, onbranch;
07053     Node *node;
07054     struct linevector headlines;
07055     struct linevector curlines;
07056     struct linevector trunklines;
07057     int foundhead;
07058
07059     if (fp == NULL)
07060     {
07061     rcsbuf_cache_open (rcs, rcs->delta_pos, &fp, &rcsbuf_local);
07062     rcsbuf = &rcsbuf_local;
07063     }
07064
07065     ishead = 1;
07066     vers = NULL;
07067     prev_vers = NULL;
07068     trunk_vers = NULL;
07069     next = NULL;
07070     onbranch = 0;
07071     foundhead = 0;
07072
07073     linevector_init (&curlines);
07074     linevector_init (&headlines);
07075     linevector_init (&trunklines);
07076
07077     /* We set BRANCHVERSION to the version we are currently looking
07078        for.  Initially, this is the version on the trunk from which
07079        VERSION branches off.  If VERSION is not a branch, then
07080        BRANCHVERSION is just VERSION.  */
07081     branchversion = xstrdup (version);
07082     cpversion = strchr (branchversion, '.');
07083     if (cpversion != NULL)
07084         cpversion = strchr (cpversion + 1, '.');
07085     if (cpversion != NULL)
07086         *cpversion = '\0';
07087
07088     do {
07089     if (! rcsbuf_getrevnum (rcsbuf, &key))
07090         error (1, 0, "unexpected EOF reading RCS file %s", rcs->path);
07091
07092     if (next != NULL && ! STREQ (next, key))
07093     {
07094         /* This is not the next version we need.  It is a branch
07095                version which we want to ignore.  */
07096         isnext = 0;
07097         isversion = 0;
07098     }
07099     else
07100     {
07101         isnext = 1;
07102
07103         /* look up the revision */
07104         node = findnode (rcs->versions, key);
07105         if (node == NULL)
07106             error (1, 0,
07107                "mismatch in rcs file %s between deltas and deltatexts",
07108                rcs->path);
07109
07110         /* Stash the previous version.  */
07111         prev_vers = vers;
07112
07113         vers = (RCSVers *) node->data;
07114         next = vers->next;
07115
07116         /* Compare key and trunkversion now, because key points to
07117            storage controlled by rcsbuf_getkey.  */
07118         if (STREQ (branchversion, key))
07119             isversion = 1;
07120         else
07121             isversion = 0;
07122     }
07123
07124     while (1)
07125     {
07126         if (! rcsbuf_getkey (rcsbuf, &key, &value))
07127         error (1, 0, "%s does not appear to be a valid rcs file",
07128                rcs->path);
07129
07130         if (log != NULL
07131         && isversion
07132         && STREQ (key, "log")
07133         && STREQ (branchversion, version))
07134         {
07135         *log = rcsbuf_valcopy (rcsbuf, value, 0, loglen);
07136         }
07137
07138         if (STREQ (key, "text"))
07139         {
07140         rcsbuf_valpolish (rcsbuf, value, 0, &vallen);
07141         if (ishead)
07142         {
07143             if (! linevector_add (&curlines, value, vallen, NULL, 0))
07144             error (1, 0, "invalid rcs file %s", rcs->path);
07145
07146             ishead = 0;
07147         }
07148         else if (isnext)
07149         {
07150             if (! apply_rcs_changes (&curlines, value, vallen,
07151                          rcs->path,
07152                          onbranch ? vers : NULL,
07153                          onbranch ? NULL : prev_vers))
07154             error (1, 0, "invalid change text in %s", rcs->path);
07155         }
07156         break;
07157         }
07158     }
07159
07160     if (isversion)
07161     {
07162         /* This is either the version we want, or it is the
07163                branchpoint to the version we want.  */
07164         if (STREQ (branchversion, version))
07165         {
07166             /* This is the version we want.  */
07167         linevector_copy (&headlines, &curlines);
07168         foundhead = 1;
07169         if (onbranch)
07170         {
07171             /* We have found this version by tracking up a
07172                        branch.  Restore back to the lines we saved
07173                        when we left the trunk, and continue tracking
07174                        down the trunk.  */
07175             onbranch = 0;
07176             vers = trunk_vers;
07177             next = vers->next;
07178             linevector_copy (&curlines, &trunklines);
07179         }
07180         }
07181         else
07182         {
07183             Node *p;
07184
07185             /* We need to look up the branch.  */
07186             onbranch = 1;
07187
07188         if (numdots (branchversion) < 2)
07189         {
07190             unsigned int ln;
07191
07192             /* We are leaving the trunk; save the current
07193                        lines so that we can restore them when we
07194                        continue tracking down the trunk.  */
07195             trunk_vers = vers;
07196             linevector_copy (&trunklines, &curlines);
07197
07198             /* Reset the version information we have
07199                        accumulated so far.  It only applies to the
07200                        changes from the head to this version.  */
07201             for (ln = 0; ln < curlines.nlines; ++ln)
07202                 curlines.vector[ln]->vers = NULL;
07203         }
07204
07205         /* The next version we want is the entry on
07206                    VERS->branches which matches this branch.  For
07207                    example, suppose VERSION is 1.21.4.3 and
07208                    BRANCHVERSION was 1.21.  Then we look for an entry
07209                    starting with "1.21.4" and we'll put it (probably
07210                    1.21.4.1) in NEXT.  We'll advance BRANCHVERSION by
07211                    two dots (in this example, to 1.21.4.3).  */
07212
07213         if (vers->branches == NULL)
07214             error (1, 0, "missing expected branches in %s",
07215                rcs->path);
07216         *cpversion = '.';
07217         ++cpversion;
07218         cpversion = strchr (cpversion, '.');
07219         if (cpversion == NULL)
07220             error (1, 0, "version number confusion in %s",
07221                rcs->path);
07222         for (p = vers->branches->list->next;
07223              p != vers->branches->list;
07224              p = p->next)
07225             if (strncmp (p->key, branchversion,
07226                  cpversion - branchversion) == 0)
07227             break;
07228         if (p == vers->branches->list)
07229             error (1, 0, "missing expected branch in %s",
07230                rcs->path);
07231
07232         next = p->key;
07233
07234         cpversion = strchr (cpversion + 1, '.');
07235         if (cpversion != NULL)
07236             *cpversion = '\0';
07237         }
07238     }
07239     if (op == RCS_FETCH && foundhead)
07240         break;
07241     } while (next != NULL);
07242
07243     free (branchversion);
07244
07245     rcsbuf_cache (rcs, rcsbuf);
07246
07247     if (! foundhead)
07248         error (1, 0, "could not find desired version %s in %s",
07249            version, rcs->path);
07250
07251     /* Now print out or return the data we have just computed.  */
07252     switch (op)
07253     {
07254     case RCS_ANNOTATE:
07255         {
07256         unsigned int ln;
07257
07258         for (ln = 0; ln < headlines.nlines; ++ln)
07259         {
07260             char buf[80];
07261             /* Period which separates year from month in date.  */
07262             char *ym;
07263             /* Period which separates month from day in date.  */
07264             char *md;
07265             RCSVers *prvers;
07266
07267             prvers = headlines.vector[ln]->vers;
07268             if (prvers == NULL)
07269             prvers = vers;
07270
07271             sprintf (buf, "%-12s (%-8.8s ",
07272                  prvers->version,
07273                  prvers->author);
07274             cvs_output (buf, 0);
07275
07276             /* Now output the date.  */
07277             ym = strchr (prvers->date, '.');
07278             if (ym == NULL)
07279             {
07280             /* ??- is an ANSI trigraph.  The ANSI way to
07281                avoid it is \? but some pre ANSI compilers
07282                complain about the unrecognized escape
07283                sequence.  Of course string concatenation
07284                ("??" "-???") is also an ANSI-ism.  Testing
07285                __STDC__ seems to be a can of worms, since
07286                compilers do all kinds of things with it.  */
07287             cvs_output ("??", 0);
07288             cvs_output ("-???", 0);
07289             cvs_output ("-??", 0);
07290             }
07291             else
07292             {
07293             md = strchr (ym + 1, '.');
07294             if (md == NULL)
07295                 cvs_output ("??", 0);
07296             else
07297                 cvs_output (md + 1, 2);
07298
07299             cvs_output ("-", 1);
07300             cvs_output (month_printname (ym + 1), 0);
07301             cvs_output ("-", 1);
07302             /* Only output the last two digits of the year.  Our output
07303                lines are long enough as it is without printing the
07304                century.  */
07305             cvs_output (ym - 2, 2);
07306             }
07307             cvs_output ("): ", 0);
07308             if (headlines.vector[ln]->len != 0)
07309             cvs_output (headlines.vector[ln]->text,
07310                     headlines.vector[ln]->len);
07311             cvs_output ("\n", 1);
07312         }
07313         }
07314         break;
07315     case RCS_FETCH:
07316         {
07317         char *p;
07318         size_t n;
07319         unsigned int ln;
07320
07321         assert (text != NULL);
07322         assert (len != NULL);
07323
07324         n = 0;
07325         for (ln = 0; ln < headlines.nlines; ++ln)
07326             /* 1 for \n */
07327             n += headlines.vector[ln]->len + 1;
07328         p = xmalloc (n);
07329         *text = p;
07330         for (ln = 0; ln < headlines.nlines; ++ln)
07331         {
07332             memcpy (p, headlines.vector[ln]->text,
07333                 headlines.vector[ln]->len);
07334             p += headlines.vector[ln]->len;
07335             if (headlines.vector[ln]->has_newline)
07336             *p++ = '\n';
07337         }
07338         *len = p - *text;
07339         assert (*len <= n);
07340         }
07341         break;
07342     }
07343
07344     linevector_free (&curlines);
07345     linevector_free (&headlines);
07346     linevector_free (&trunklines);
07347
07348     return;
07349 }
07350
07351 /* Read the information for a single delta from the RCS buffer RCSBUF,
07352    whose name is RCSFILE.  *KEYP and *VALP are either NULL, or the
07353    first key/value pair to read, as set by rcsbuf_getkey. Return NULL
07354    if there are no more deltas.  Store the key/value pair which
07355    terminated the read in *KEYP and *VALP.  */
07356
07357 static RCSVers *
07358 getdelta (rcsbuf, rcsfile, keyp, valp)
07359     struct rcsbuffer *rcsbuf;
07360     char *rcsfile;
07361     char **keyp;
07362     char **valp;
07363 {
07364     RCSVers *vnode;
07365     char *key, *value, *cp;
07366     Node *kv;
07367
07368     /* Get revision number if it wasn't passed in. This uses
07369        rcsbuf_getkey because it doesn't croak when encountering
07370        unexpected input.  As a result, we have to play unholy games
07371        with `key' and `value'. */
07372     if (*keyp != NULL)
07373     {
07374     key = *keyp;
07375     value = *valp;
07376     }
07377     else
07378     {
07379     if (! rcsbuf_getkey (rcsbuf, &key, &value))
07380         error (1, 0, "%s: unexpected EOF", rcsfile);
07381     }
07382
07383     /* Make sure that it is a revision number and not a cabbage
07384        or something. */
07385     for (cp = key;
07386      (isdigit ((unsigned char) *cp) || *cp == '.') && *cp != '\0';
07387      cp++)
07388     /* do nothing */ ;
07389     /* Note that when comparing with RCSDATE, we are not massaging
07390        VALUE from the string found in the RCS file.  This is OK since
07391        we know exactly what to expect.  */
07392     if (*cp != '\0' || strncmp (RCSDATE, value, (sizeof RCSDATE) - 1) != 0)
07393     {
07394     *keyp = key;
07395     *valp = value;
07396     return NULL;
07397     }
07398
07399     vnode = (RCSVers *) xmalloc (sizeof (RCSVers));
07400     memset (vnode, 0, sizeof (RCSVers));
07401
07402     vnode->version = xstrdup (key);
07403
07404     /* Grab the value of the date from value.  Note that we are not
07405        massaging VALUE from the string found in the RCS file.  */
07406     cp = value + (sizeof RCSDATE) - 1;  /* skip the "date" keyword */
07407     while (whitespace (*cp))        /* take space off front of value */
07408     cp++;
07409
07410     vnode->date = xstrdup (cp);
07411
07412     /* Get author field.  */
07413     if (! rcsbuf_getkey (rcsbuf, &key, &value))
07414     {
07415     error (1, 0, "unexpected end of file reading %s", rcsfile);
07416     }
07417     if (! STREQ (key, "author"))
07418     error (1, 0, "\
07419 unable to parse %s; `author' not in the expected place", rcsfile);
07420     vnode->author = rcsbuf_valcopy (rcsbuf, value, 0, (size_t *) NULL);
07421
07422     /* Get state field.  */
07423     if (! rcsbuf_getkey (rcsbuf, &key, &value))
07424     {
07425     error (1, 0, "unexpected end of file reading %s", rcsfile);
07426     }
07427     if (! STREQ (key, "state"))
07428     error (1, 0, "\
07429 unable to parse %s; `state' not in the expected place", rcsfile);
07430     vnode->state = rcsbuf_valcopy (rcsbuf, value, 0, (size_t *) NULL);
07431     /* The value is optional, according to rcsfile(5).  */
07432     if (value != NULL && STREQ (value, "dead"))
07433     {
07434     vnode->dead = 1;
07435     }
07436
07437     /* Note that "branches" and "next" are in fact mandatory, according
07438        to doc/RCSFILES.  */
07439
07440     /* fill in the branch list (if any branches exist) */
07441     if (! rcsbuf_getkey (rcsbuf, &key, &value))
07442     {
07443     error (1, 0, "unexpected end of file reading %s", rcsfile);
07444     }
07445     if (STREQ (key, RCSDESC))
07446     {
07447     *keyp = key;
07448     *valp = value;
07449     /* Probably could/should be a fatal error.  */
07450     error (0, 0, "warning: 'branches' keyword missing from %s", rcsfile);
07451     return vnode;
07452     }
07453     if (value != (char *) NULL)
07454     {
07455     vnode->branches = getlist ();
07456     /* Note that we are not massaging VALUE from the string found
07457            in the RCS file.  */
07458     do_branches (vnode->branches, value);
07459     }
07460
07461     /* fill in the next field if there is a next revision */
07462     if (! rcsbuf_getkey (rcsbuf, &key, &value))
07463     {
07464     error (1, 0, "unexpected end of file reading %s", rcsfile);
07465     }
07466     if (STREQ (key, RCSDESC))
07467     {
07468     *keyp = key;
07469     *valp = value;
07470     /* Probably could/should be a fatal error.  */
07471     error (0, 0, "warning: 'next' keyword missing from %s", rcsfile);
07472     return vnode;
07473     }
07474     if (value != (char *) NULL)
07475     vnode->next = rcsbuf_valcopy (rcsbuf, value, 0, (size_t *) NULL);
07476
07477     /*
07478      * XXX - this is where we put the symbolic link stuff???
07479      * (into newphrases in the deltas).
07480      */
07481     while (1)
07482     {
07483     if (! rcsbuf_getkey (rcsbuf, &key, &value))
07484         error (1, 0, "unexpected end of file reading %s", rcsfile);
07485
07486     /* The `desc' keyword is the end of the deltas. */
07487     if (strcmp (key, RCSDESC) == 0)
07488         break;
07489
07490 #ifdef PRESERVE_PERMISSIONS_SUPPORT
07491
07492     /* The `hardlinks' value is a group of words, which must
07493        be parsed separately and added as a list to vnode->hardlinks. */
07494     if (strcmp (key, "hardlinks") == 0)
07495     {
07496         char *word;
07497
07498         vnode->hardlinks = getlist();
07499         while ((word = rcsbuf_valword (rcsbuf, &value)) != NULL)
07500         {
07501         Node *n = getnode();
07502         n->key = word;
07503         addnode (vnode->hardlinks, n);
07504         }
07505         continue;
07506     }
07507 #endif
07508
07509     /* Enable use of repositories created by certain obsolete
07510        versions of CVS.  This code should remain indefinately;
07511        there is no procedure for converting old repositories, and
07512        checking for it is harmless.  */
07513     if (STREQ (key, RCSDEAD))
07514     {
07515         vnode->dead = 1;
07516         if (vnode->state != NULL)
07517         free (vnode->state);
07518         vnode->state = xstrdup ("dead");
07519         continue;
07520     }
07521     /* if we have a new revision number, we're done with this delta */
07522     for (cp = key;
07523          (isdigit ((unsigned char) *cp) || *cp == '.') && *cp != '\0';
07524          cp++)
07525         /* do nothing */ ;
07526     /* Note that when comparing with RCSDATE, we are not massaging
07527        VALUE from the string found in the RCS file.  This is OK
07528        since we know exactly what to expect.  */
07529     if (*cp == '\0' && strncmp (RCSDATE, value, strlen (RCSDATE)) == 0)
07530         break;
07531
07532     /* At this point, key and value represent a user-defined field
07533        in the delta node. */
07534     if (vnode->other_delta == NULL)
07535         vnode->other_delta = getlist ();
07536     kv = getnode ();
07537     kv->type = rcsbuf_valcmp (rcsbuf) ? RCSCMPFLD : RCSFIELD;
07538     kv->key = xstrdup (key);
07539     kv->data = rcsbuf_valcopy (rcsbuf, value, kv->type == RCSFIELD,
07540                    (size_t *) NULL);
07541     if (addnode (vnode->other_delta, kv) != 0)
07542     {
07543         /* Complaining about duplicate keys in newphrases seems
07544            questionable, in that we don't know what they mean and
07545            doc/RCSFILES has no prohibition on several newphrases
07546            with the same key.  But we can't store more than one as
07547            long as we store them in a List *.  */
07548         error (0, 0, "warning: duplicate key `%s' in RCS file `%s'",
07549            key, rcsfile);
07550         freenode (kv);
07551     }
07552     }
07553
07554     /* Return the key which caused us to fail back to the caller.  */
07555     *keyp = key;
07556     *valp = value;
07557
07558     return vnode;
07559 }
07560
07561 static void
07562 freedeltatext (d)
07563     Deltatext *d;
07564 {
07565     if (d->version != NULL)
07566     free (d->version);
07567     if (d->log != NULL)
07568     free (d->log);
07569     if (d->text != NULL)
07570     free (d->text);
07571     if (d->other != (List *) NULL)
07572     dellist (&d->other);
07573     free (d);
07574 }
07575
07576 static Deltatext *
07577 RCS_getdeltatext (rcs, fp, rcsbuf)
07578     RCSNode *rcs;
07579     FILE *fp;
07580     struct rcsbuffer *rcsbuf;
07581 {
07582     char *num;
07583     char *key, *value;
07584     Node *p;
07585     Deltatext *d;
07586
07587     /* Get the revision number. */
07588     if (! rcsbuf_getrevnum (rcsbuf, &num))
07589     {
07590     /* If num == NULL, it means we reached EOF naturally.  That's
07591        fine. */
07592     if (num == NULL)
07593         return NULL;
07594     else
07595         error (1, 0, "%s: unexpected EOF", rcs->path);
07596     }
07597
07598     p = findnode (rcs->versions, num);
07599     if (p == NULL)
07600     error (1, 0, "mismatch in rcs file %s between deltas and deltatexts",
07601            rcs->path);
07602
07603     d = (Deltatext *) xmalloc (sizeof (Deltatext));
07604     d->version = xstrdup (num);
07605
07606     /* Get the log message. */
07607     if (! rcsbuf_getkey (rcsbuf, &key, &value))
07608     error (1, 0, "%s, delta %s: unexpected EOF", rcs->path, num);
07609     if (! STREQ (key, "log"))
07610     error (1, 0, "%s, delta %s: expected `log', got `%s'",
07611            rcs->path, num, key);
07612     d->log = rcsbuf_valcopy (rcsbuf, value, 0, (size_t *) NULL);
07613
07614     /* Get random newphrases. */
07615     d->other = getlist();
07616     while (1)
07617     {
07618     if (! rcsbuf_getkey (rcsbuf, &key, &value))
07619         error (1, 0, "%s, delta %s: unexpected EOF", rcs->path, num);
07620
07621     if (STREQ (key, "text"))
07622         break;
07623
07624     p = getnode();
07625     p->type = rcsbuf_valcmp (rcsbuf) ? RCSCMPFLD : RCSFIELD;
07626     p->key = xstrdup (key);
07627     p->data = rcsbuf_valcopy (rcsbuf, value, p->type == RCSFIELD,
07628                   (size_t *) NULL);
07629     if (addnode (d->other, p) < 0)
07630     {
07631         error (0, 0, "warning: %s, delta %s: duplicate field `%s'",
07632            rcs->path, num, key);
07633     }
07634     }
07635
07636     /* Get the change text. We already know that this key is `text'. */
07637     d->text = rcsbuf_valcopy (rcsbuf, value, 0, &d->len);
07638
07639     return d;
07640 }
07641
07642 /* RCS output functions, for writing RCS format files from RCSNode
07643    structures.
07644
07645    For most of this work, RCS 5.7 uses an `aprintf' function which aborts
07646    program upon error.  Instead, these functions check the output status
07647    of the stream right before closing it, and aborts if an error condition
07648    is found.  The RCS solution is probably the better one: it produces
07649    more overhead, but will produce a clearer diagnostic in the case of
07650    catastrophic error.  In either case, however, the repository will probably
07651    not get corrupted. */
07652
07653 static int
07654 putsymbol_proc (symnode, fparg)
07655     Node *symnode;
07656     void *fparg;
07657 {
07658     FILE *fp = (FILE *) fparg;
07659
07660     /* A fiddly optimization: this code used to just call fprintf, but
07661        in an old repository with hundreds of tags this can get called
07662        hundreds of thousands of times when doing a cvs tag.  Since
07663        tagging is a relatively common operation, and using putc and
07664        fputs is just as comprehensible, the change is worthwhile.  */
07665     putc ('\n', fp);
07666     putc ('\t', fp);
07667     fputs (symnode->key, fp);
07668     putc (':', fp);
07669     fputs (symnode->data, fp);
07670     return 0;
07671 }
07672
07673 static int putlock_proc PROTO ((Node *, void *));
07674
07675 /* putlock_proc is like putsymbol_proc, but key and data are reversed. */
07676
07677 static int
07678 putlock_proc (symnode, fp)
07679     Node *symnode;
07680     void *fp;
07681 {
07682     return fprintf ((FILE *) fp, "\n\t%s:%s", symnode->data, symnode->key);
07683 }
07684
07685 static int
07686 putrcsfield_proc (node, vfp)
07687     Node *node;
07688     void *vfp;
07689 {
07690     FILE *fp = (FILE *) vfp;
07691
07692     /* Some magic keys used internally by CVS start with `;'. Skip them. */
07693     if (node->key[0] == ';')
07694     return 0;
07695
07696     fprintf (fp, "\n%s\t", node->key);
07697     if (node->data != NULL)
07698     {
07699     /* If the field's value contains evil characters,
07700        it must be stringified. */
07701     /* FIXME: This does not quite get it right.  "7jk8f" is not a legal
07702        value for a value in a newpharse, according to doc/RCSFILES,
07703        because digits are not valid in an "id".  We might do OK by
07704        always writing strings (enclosed in @@).  Would be nice to
07705        explicitly mention this one way or another in doc/RCSFILES.
07706        A case where we are wrong in a much more clear-cut way is that
07707        we let through non-graphic characters such as whitespace and
07708        control characters.  */
07709
07710     if (node->type == RCSCMPFLD || strpbrk (node->data, "$,.:;@") == NULL)
07711         fputs (node->data, fp);
07712     else
07713     {
07714         putc ('@', fp);
07715         expand_at_signs (node->data, (off_t) strlen (node->data), fp);
07716         putc ('@', fp);
07717     }
07718     }
07719
07720     /* desc, log and text fields should not be terminated with semicolon;
07721        all other fields should be. */
07722     if (! STREQ (node->key, "desc") &&
07723     ! STREQ (node->key, "log") &&
07724     ! STREQ (node->key, "text"))
07725     {
07726     putc (';', fp);
07727     }
07728     return 0;
07729 }
07730
07731 #ifdef PRESERVE_PERMISSIONS_SUPPORT
07732
07733 /* Save a filename in a `hardlinks' RCS field.  NODE->KEY will contain
07734    a full pathname, but currently only basenames are stored in the RCS
07735    node.  Assume that the filename includes nasty characters and
07736    @-escape it. */
07737
07738 static int
07739 puthardlink_proc (node, vfp)
07740     Node *node;
07741     void *vfp;
07742 {
07743     FILE *fp = (FILE *) vfp;
07744     char *basename = strrchr (node->key, '/');
07745
07746     if (basename == NULL)
07747     basename = node->key;
07748     else
07749     ++basename;
07750
07751     putc ('\t', fp);
07752     putc ('@', fp);
07753     (void) expand_at_signs (basename, strlen (basename), fp);
07754     putc ('@', fp);
07755
07756     return 0;
07757 }
07758
07759 #endif
07760
07761 /* Output the admin node for RCS into stream FP. */
07762
07763 static void
07764 RCS_putadmin (rcs, fp)
07765     RCSNode *rcs;
07766     FILE *fp;
07767 {
07768     fprintf (fp, "%s\t%s;\n", RCSHEAD, rcs->head ? rcs->head : "");
07769     if (rcs->branch)
07770     fprintf (fp, "%s\t%s;\n", RCSBRANCH, rcs->branch);
07771
07772     fputs ("access", fp);
07773     if (rcs->access)
07774     {
07775     char *p, *s;
07776     s = xstrdup (rcs->access);
07777     for (p = strtok (s, " \n\t"); p != NULL; p = strtok (NULL, " \n\t"))
07778         fprintf (fp, "\n\t%s", p);
07779     free (s);
07780     }
07781     fputs (";\n", fp);
07782
07783     fputs (RCSSYMBOLS, fp);
07784     /* If we haven't had to convert the symbols to a list yet, don't
07785        force a conversion now; just write out the string.  */
07786     if (rcs->symbols == NULL && rcs->symbols_data != NULL)
07787     {
07788     fputs ("\n\t", fp);
07789     fputs (rcs->symbols_data, fp);
07790     }
07791     else
07792     walklist (RCS_symbols (rcs), putsymbol_proc, (void *) fp);
07793     fputs (";\n", fp);
07794
07795     fputs ("locks", fp);
07796     if (rcs->locks_data)
07797     fprintf (fp, "\t%s", rcs->locks_data);
07798     else if (rcs->locks)
07799     walklist (rcs->locks, putlock_proc, (void *) fp);
07800     if (rcs->strict_locks)
07801     fprintf (fp, "; strict");
07802     fputs (";\n", fp);
07803
07804     if (rcs->comment)
07805     {
07806     fprintf (fp, "comment\t@");
07807     expand_at_signs (rcs->comment, (off_t) strlen (rcs->comment), fp);
07808     fputs ("@;\n", fp);
07809     }
07810     if (rcs->expand && ! STREQ (rcs->expand, "kv"))
07811     fprintf (fp, "%s\t@%s@;\n", RCSEXPAND, rcs->expand);
07812
07813     walklist (rcs->other, putrcsfield_proc, (void *) fp);
07814
07815     putc ('\n', fp);
07816 }
07817
07818 static void
07819 putdelta (vers, fp)
07820     RCSVers *vers;
07821     FILE *fp;
07822 {
07823     Node *bp, *start;
07824
07825     /* Skip if no revision was supplied, or if it is outdated (cvs admin -o) */
07826     if (vers == NULL || vers->outdated)
07827     return;
07828
07829     fprintf (fp, "\n%s\n%s\t%s;\t%s %s;\t%s %s;\nbranches",
07830          vers->version,
07831          RCSDATE, vers->date,
07832          "author", vers->author,
07833          "state", vers->state ? vers->state : "");
07834
07835     if (vers->branches != NULL)
07836     {
07837     start = vers->branches->list;
07838     for (bp = start->next; bp != start; bp = bp->next)
07839         fprintf (fp, "\n\t%s", bp->key);
07840     }
07841
07842     fprintf (fp, ";\nnext\t%s;", vers->next ? vers->next : "");
07843
07844     walklist (vers->other_delta, putrcsfield_proc, fp);
07845
07846 #ifdef PRESERVE_PERMISSIONS_SUPPORT
07847     if (vers->hardlinks)
07848     {
07849     fprintf (fp, "\nhardlinks");
07850     walklist (vers->hardlinks, puthardlink_proc, fp);
07851     putc (';', fp);
07852     }
07853 #endif
07854     putc ('\n', fp);
07855 }
07856
07857 static void
07858 RCS_putdtree (rcs, rev, fp)
07859     RCSNode *rcs;
07860     char *rev;
07861     FILE *fp;
07862 {
07863     RCSVers *versp;
07864     Node *p, *branch;
07865
07866     if (rev == NULL)
07867     return;
07868
07869     /* Find the delta node for this revision. */
07870     p = findnode (rcs->versions, rev);
07871     if (p == NULL)
07872     {
07873         error (1, 0,
07874                "error parsing repository file %s, file may be corrupt.",
07875                rcs->path);
07876     }
07877
07878     versp = (RCSVers *) p->data;
07879
07880     /* Print the delta node and recurse on its `next' node.  This prints
07881        the trunk.  If there are any branches printed on this revision,
07882        print those trunks as well. */
07883     putdelta (versp, fp);
07884     RCS_putdtree (rcs, versp->next, fp);
07885     if (versp->branches != NULL)
07886     {
07887     branch = versp->branches->list;
07888     for (p = branch->next; p != branch; p = p->next)
07889         RCS_putdtree (rcs, p->key, fp);
07890     }
07891 }
07892
07893 static void
07894 RCS_putdesc (rcs, fp)
07895     RCSNode *rcs;
07896     FILE *fp;
07897 {
07898     fprintf (fp, "\n\n%s\n@", RCSDESC);
07899     if (rcs->desc != NULL)
07900     {
07901     off_t len = (off_t) strlen (rcs->desc);
07902     if (len > 0)
07903     {
07904         expand_at_signs (rcs->desc, len, fp);
07905         if (rcs->desc[len-1] != '\n')
07906         putc ('\n', fp);
07907     }
07908     }
07909     fputs ("@\n", fp);
07910 }
07911
07912 static void
07913 putdeltatext (fp, d)
07914     FILE *fp;
07915     Deltatext *d;
07916 {
07917     fprintf (fp, "\n\n%s\nlog\n@", d->version);
07918     if (d->log != NULL)
07919     {
07920     int loglen = strlen (d->log);
07921     expand_at_signs (d->log, (off_t) loglen, fp);
07922     if (d->log[loglen-1] != '\n')
07923         putc ('\n', fp);
07924     }
07925     putc ('@', fp);
07926
07927     walklist (d->other, putrcsfield_proc, fp);
07928
07929     fputs ("\ntext\n@", fp);
07930     if (d->text != NULL)
07931     expand_at_signs (d->text, (off_t) d->len, fp);
07932     fputs ("@\n", fp);
07933 }
07934
07935 /* TODO: the whole mechanism for updating deltas is kludgey... more
07936    sensible would be to supply all the necessary info in a `newdeltatext'
07937    field for RCSVers nodes. -twp */
07938
07939 /* Copy delta text nodes from FIN to FOUT.  If NEWDTEXT is non-NULL, it
07940    is a new delta text node, and should be added to the tree at the
07941    node whose revision number is INSERTPT.  (Note that trunk nodes are
07942    written in decreasing order, and branch nodes are written in
07943    increasing order.) */
07944
07945 static void
07946 RCS_copydeltas (rcs, fin, rcsbufin, fout, newdtext, insertpt)
07947     RCSNode *rcs;
07948     FILE *fin;
07949     struct rcsbuffer *rcsbufin;
07950     FILE *fout;
07951     Deltatext *newdtext;
07952     char *insertpt;
07953 {
07954     int actions;
07955     RCSVers *dadmin;
07956     Node *np;
07957     int insertbefore, found;
07958     char *bufrest;
07959     int nls;
07960     size_t buflen;
07961     char buf[8192];
07962     int got;
07963
07964     /* Count the number of versions for which we have to do some
07965        special operation.  */
07966     actions = walklist (rcs->versions, count_delta_actions, (void *) NULL);
07967
07968     /* Make a note of whether NEWDTEXT should be inserted
07969        before or after its INSERTPT. */
07970     insertbefore = (newdtext != NULL && numdots (newdtext->version) == 1);
07971
07972     while (actions != 0 || newdtext != NULL)
07973     {
07974     Deltatext *dtext;
07975
07976     dtext = RCS_getdeltatext (rcs, fin, rcsbufin);
07977
07978     /* We shouldn't hit EOF here, because that would imply that
07979            some action was not taken, or that we could not insert
07980            NEWDTEXT.  */
07981     if (dtext == NULL)
07982         error (1, 0, "internal error: EOF too early in RCS_copydeltas");
07983
07984     found = (insertpt != NULL && STREQ (dtext->version, insertpt));
07985     if (found && insertbefore)
07986     {
07987         putdeltatext (fout, newdtext);
07988         newdtext = NULL;
07989         insertpt = NULL;
07990     }
07991
07992     np = findnode (rcs->versions, dtext->version);
07993     dadmin = (RCSVers *) np->data;
07994
07995     /* If this revision has been outdated, just skip it. */
07996     if (dadmin->outdated)
07997     {
07998         freedeltatext (dtext);
07999         --actions;
08000         continue;
08001     }
08002
08003     /* Update the change text for this delta.  New change text
08004        data may come from cvs admin -m, cvs admin -o, or cvs ci. */
08005     if (dadmin->text != NULL)
08006     {
08007         if (dadmin->text->log != NULL || dadmin->text->text != NULL)
08008         --actions;
08009         if (dadmin->text->log != NULL)
08010         {
08011         free (dtext->log);
08012         dtext->log = dadmin->text->log;
08013         dadmin->text->log = NULL;
08014         }
08015         if (dadmin->text->text != NULL)
08016         {
08017         free (dtext->text);
08018         dtext->text = dadmin->text->text;
08019         dtext->len = dadmin->text->len;
08020         dadmin->text->text = NULL;
08021         }
08022     }
08023     putdeltatext (fout, dtext);
08024     freedeltatext (dtext);
08025
08026     if (found && !insertbefore)
08027     {
08028         putdeltatext (fout, newdtext);
08029         newdtext = NULL;
08030         insertpt = NULL;
08031     }
08032     }
08033
08034     /* Copy the rest of the file directly, without bothering to
08035        interpret it.  The caller will handle error checking by calling
08036        ferror.
08037
08038        We just wrote a newline to the file, either in putdeltatext or
08039        in the caller.  However, we may not have read the corresponding
08040        newline from the file, because rcsbuf_getkey returns as soon as
08041        it finds the end of the '@' string for the desc or text key.
08042        Therefore, we may read three newlines when we should really
08043        only write two, and we check for that case here.  This is not
08044        an semantically important issue; we only do it to make our RCS
08045        files look traditional.  */
08046
08047     nls = 3;
08048
08049     rcsbuf_get_buffered (rcsbufin, &bufrest, &buflen);
08050     if (buflen > 0)
08051     {
08052     if (bufrest[0] != '\n'
08053         || strncmp (bufrest, "\n\n\n", buflen < 3 ? buflen : 3) != 0)
08054     {
08055         nls = 0;
08056     }
08057     else
08058     {
08059         if (buflen < 3)
08060         nls -= buflen;
08061         else
08062         {
08063         ++bufrest;
08064         --buflen;
08065         nls = 0;
08066         }
08067     }
08068
08069     fwrite (bufrest, 1, buflen, fout);
08070     }
08071
08072     while ((got = fread (buf, 1, sizeof buf, fin)) != 0)
08073     {
08074     if (nls > 0
08075         && got >= nls
08076         && buf[0] == '\n'
08077         && strncmp (buf, "\n\n\n", nls) == 0)
08078     {
08079         fwrite (buf + 1, 1, got - 1, fout);
08080     }
08081     else
08082     {
08083         fwrite (buf, 1, got, fout);
08084     }
08085
08086     nls = 0;
08087     }
08088 }
08089
08090 /* A helper procedure for RCS_copydeltas.  This is called via walklist
08091    to count the number of RCS revisions for which some special action
08092    is required.  */
08093
08094 static int
08095 count_delta_actions (np, ignore)
08096     Node *np;
08097     void *ignore;
08098 {
08099     RCSVers *dadmin;
08100
08101     dadmin = (RCSVers *) np->data;
08102
08103     if (dadmin->outdated)
08104     return 1;
08105
08106     if (dadmin->text != NULL
08107     && (dadmin->text->log != NULL || dadmin->text->text != NULL))
08108     {
08109     return 1;
08110     }
08111
08112     return 0;
08113 }
08114
08115 /*
08116  * Clean up temporary files
08117  */
08118 RETSIGTYPE
08119 rcs_cleanup ()
08120 {
08121     /* Note that the checks for existence_error are because we are
08122        called from a signal handler, so we don't know whether the
08123        files got created.  */
08124
08125     /* FIXME: Do not perform buffered I/O from an interrupt handler like
08126        this (via error).  However, I'm leaving the error-calling code there
08127        in the hope that on the rare occasion the error call is actually made
08128        (e.g., a fluky I/O error or permissions problem prevents the deletion
08129        of a just-created file) reentrancy won't be an issue.  */
08130     if (rcs_lockfile != NULL)
08131     {
08132     char *tmp = rcs_lockfile;
08133     rcs_lockfile = NULL;
08134     if (rcs_lockfd >= 0)
08135     {
08136         if (close (rcs_lockfd) != 0)
08137         error (0, errno, "error closing lock file %s", tmp);
08138         rcs_lockfd = -1;
08139     }
08140     if (unlink_file (tmp) < 0
08141         && !existence_error (errno))
08142         error (0, errno, "cannot remove %s", tmp);
08143     }
08144 }
08145
08146 /* RCS_internal_lockfile and RCS_internal_unlockfile perform RCS-style
08147    locking on the specified RCSFILE: for a file called `foo,v', open
08148    for writing a file called `,foo,'.
08149
08150    Note that we what do here is quite different from what RCS does.
08151    RCS creates the ,foo, file before it reads the RCS file (if it
08152    knows that it will be writing later), so that it actually serves as
08153    a lock.  We don't; instead we rely on CVS writelocks.  This means
08154    that if someone is running RCS on the file at the same time they
08155    are running CVS on it, they might lose (we read the file,
08156    then RCS writes it, then we write it, clobbering the
08157    changes made by RCS).  I believe the current sentiment about this
08158    is "well, don't do that".
08159
08160    A concern has been expressed about whether adopting the RCS
08161    strategy would slow us down.  I don't think so, since we need to
08162    write the ,foo, file anyway (unless perhaps if O_EXCL is slower or
08163    something).
08164
08165    These do not perform quite the same function as the RCS -l option
08166    for locking files: they are intended to prevent competing RCS
08167    processes from stomping all over each other's laundry.  Hence,
08168    they are `internal' locking functions.
08169
08170    If there is an error, give a fatal error; if we return we always
08171    return a non-NULL value.  */
08172
08173 static FILE *
08174 rcs_internal_lockfile (rcsfile)
08175     char *rcsfile;
08176 {
08177     struct stat rstat;
08178     FILE *fp;
08179     static int first_call = 1;
08180
08181     if (first_call)
08182     {
08183     first_call = 0;
08184     /* clean up if we get a signal */
08185 #ifdef SIGABRT
08186     (void) SIG_register (SIGABRT, rcs_cleanup);
08187 #endif
08188 #ifdef SIGHUP
08189     (void) SIG_register (SIGHUP, rcs_cleanup);
08190 #endif
08191 #ifdef SIGINT
08192     (void) SIG_register (SIGINT, rcs_cleanup);
08193 #endif
08194 #ifdef SIGQUIT
08195     (void) SIG_register (SIGQUIT, rcs_cleanup);
08196 #endif
08197 #ifdef SIGPIPE
08198     (void) SIG_register (SIGPIPE, rcs_cleanup);
08199 #endif
08200 #ifdef SIGTERM
08201     (void) SIG_register (SIGTERM, rcs_cleanup);
08202 #endif
08203     }
08204
08205     /* Get the lock file name: `,file,' for RCS file `file,v'. */
08206     assert (rcs_lockfile == NULL);
08207     assert (rcs_lockfd < 0);
08208     rcs_lockfile = rcs_lockfilename (rcsfile);
08209
08210     /* Use the existing RCS file mode, or read-only if this is a new
08211        file.  (Really, this is a lie -- if this is a new file,
08212        RCS_checkin uses the permissions from the working copy.  For
08213        actually creating the file, we use 0444 as a safe default mode.) */
08214     if (stat (rcsfile, &rstat) < 0)
08215     {
08216     if (existence_error (errno))
08217         rstat.st_mode = S_IRUSR | S_IRGRP | S_IROTH;
08218     else
08219         error (1, errno, "cannot stat %s", rcsfile);
08220     }
08221
08222     /* Try to open exclusively.  POSIX.1 guarantees that O_EXCL|O_CREAT
08223        guarantees an exclusive open.  According to the RCS source, with
08224        NFS v2 we must also throw in O_TRUNC and use an open mask that makes
08225        the file unwriteable.  For extensive justification, see the comments for
08226        rcswriteopen() in rcsedit.c, in RCS 5.7.  This is kind of pointless
08227        in the CVS case; see comment at the start of this file concerning
08228        general ,foo, file strategy.
08229
08230        There is some sentiment that with NFSv3 and such, that one can
08231        rely on O_EXCL these days.  This might be true for unix (I
08232        don't really know), but I am still pretty skeptical in the case
08233        of the non-unix systems.  */
08234     rcs_lockfd = CVS_OPEN(rcs_lockfile,
08235                OPEN_BINARY | O_WRONLY | O_CREAT | O_EXCL | O_TRUNC,
08236                S_IRUSR | S_IRGRP | S_IROTH);
08237
08238     if (rcs_lockfd < 0)
08239     {
08240     error (1, errno, "could not open lock file `%s'", rcs_lockfile);
08241     }
08242
08243     /* Force the file permissions, and return a stream object. */
08244     /* Because we change the modes later, we don't worry about
08245        this in the non-HAVE_FCHMOD case.  */
08246 #ifdef HAVE_FCHMOD
08247     if (fchmod (rcs_lockfd, rstat.st_mode) < 0)
08248     error (1, errno, "cannot change mode for %s", rcs_lockfile);
08249 #endif
08250     fp = fdopen (rcs_lockfd, FOPEN_BINARY_WRITE);
08251     if (fp == NULL)
08252     error (1, errno, "cannot fdopen %s", rcs_lockfile);
08253
08254     return fp;
08255 }
08256
08257 static void
08258 rcs_internal_unlockfile (fp, rcsfile)
08259     FILE *fp;
08260     char *rcsfile;
08261 {
08262     assert (rcs_lockfile != NULL);
08263     assert (rcs_lockfd >= 0);
08264
08265     /* Abort if we could not write everything successfully to LOCKFILE.
08266        This is not a great error-handling mechanism, but should prevent
08267        corrupting the repository. */
08268
08269     if (ferror (fp))
08270     /* The only case in which using errno here would be meaningful
08271        is if we happen to have left errno unmolested since the call
08272        which produced the error (e.g. fprintf).  That is pretty
08273        fragile even if it happens to sometimes be true.  The real
08274        solution is to check each call to fprintf rather than waiting
08275        until the end like this.  */
08276     error (1, 0, "error writing to lock file %s", rcs_lockfile);
08277     if (fclose (fp) == EOF)
08278     error (1, errno, "error closing lock file %s", rcs_lockfile);
08279     rcs_lockfd = -1;
08280
08281     rename_file (rcs_lockfile, rcsfile);
08282
08283     {
08284     /* Use a temporary to make sure there's no interval
08285        (after rcs_lockfile has been freed but before it's set to NULL)
08286        during which the signal handler's use of rcs_lockfile would
08287        reference freed memory.  */
08288     char *tmp = rcs_lockfile;
08289     rcs_lockfile = NULL;
08290     free (tmp);
08291     }
08292 }
08293
08294 static char *
08295 rcs_lockfilename (rcsfile)
08296     char *rcsfile;
08297 {
08298     char *lockfile, *lockp;
08299     char *rcsbase, *rcsp, *rcsend;
08300     int rcslen;
08301
08302     /* Create the lockfile name. */
08303     rcslen = strlen (rcsfile);
08304     lockfile = (char *) xmalloc (rcslen + 10);
08305     rcsbase = last_component (rcsfile);
08306     rcsend = rcsfile + rcslen - sizeof(RCSEXT);
08307     for (lockp = lockfile, rcsp = rcsfile; rcsp < rcsbase; ++rcsp)
08308     *lockp++ = *rcsp;
08309     *lockp++ = ',';
08310     while (rcsp <= rcsend)
08311     *lockp++ = *rcsp++;
08312     *lockp++ = ',';
08313     *lockp = '\0';
08314
08315     return lockfile;
08316 }
08317
08318 /* Rewrite an RCS file.  The basic idea here is that the caller should
08319    first call RCS_reparsercsfile, then munge the data structures as
08320    desired (via RCS_delete_revs, RCS_settag, &c), then call RCS_rewrite.  */
08321
08322 void
08323 RCS_rewrite (rcs, newdtext, insertpt)
08324     RCSNode *rcs;
08325     Deltatext *newdtext;
08326     char *insertpt;
08327 {
08328     FILE *fin, *fout;
08329     struct rcsbuffer rcsbufin;
08330
08331     if (noexec)
08332     return;
08333
08334     /* Make sure we're operating on an actual file and not a symlink.  */
08335     resolve_symlink (&(rcs->path));
08336
08337     fout = rcs_internal_lockfile (rcs->path);
08338
08339     RCS_putadmin (rcs, fout);
08340     RCS_putdtree (rcs, rcs->head, fout);
08341     RCS_putdesc (rcs, fout);
08342
08343     /* Open the original RCS file and seek to the first delta text. */
08344     rcsbuf_cache_open (rcs, rcs->delta_pos, &fin, &rcsbufin);
08345
08346     /* Update delta_pos to the current position in the output file.
08347        Do NOT move these statements: they must be done after fin has
08348        been positioned at the old delta_pos, but before any delta
08349        texts have been written to fout. */
08350     rcs->delta_pos = ftell (fout);
08351     if (rcs->delta_pos == -1)
08352     error (1, errno, "cannot ftell in RCS file %s", rcs->path);
08353
08354     RCS_copydeltas (rcs, fin, &rcsbufin, fout, newdtext, insertpt);
08355
08356     /* We don't want to call rcsbuf_cache here, since we're about to
08357        delete the file.  */
08358     rcsbuf_close (&rcsbufin);
08359     if (ferror (fin))
08360     /* The only case in which using errno here would be meaningful
08361        is if we happen to have left errno unmolested since the call
08362        which produced the error (e.g. fread).  That is pretty
08363        fragile even if it happens to sometimes be true.  The real
08364        solution is to make sure that all the code which reads
08365        from fin checks for errors itself (some does, some doesn't).  */
08366     error (0, 0, "warning: when closing RCS file `%s'", rcs->path);
08367     if (fclose (fin) < 0)
08368     error (0, errno, "warning: closing RCS file `%s'", rcs->path);
08369
08370     rcs_internal_unlockfile (fout, rcs->path);
08371 }
08372
08373 /* Abandon changes to an RCS file. */
08374
08375 void
08376 RCS_abandon (rcs)
08377     RCSNode *rcs;
08378 {
08379     free_rcsnode_contents (rcs);
08380     rcs->symbols_data = NULL;
08381     rcs->expand = NULL;
08382     rcs->access = NULL;
08383     rcs->locks_data = NULL;
08384     rcs->comment = NULL;
08385     rcs->desc = NULL;
08386     rcs->flags |= PARTIAL;
08387 }
08388
08389
08390 /* Annotate command.  In rcs.c for historical reasons (from back when
08391    what is now RCS_deltas was part of annotate_fileproc).  */
08392
08393 /* Options from the command line.  */
08394
08395 static int force_tag_match = 1;
08396 static char *tag = NULL;
08397 static char *date = NULL;
08398
08399 static int annotate_fileproc PROTO ((void *callerdat, struct file_info *));
08400
08401 static int
08402 annotate_fileproc (callerdat, finfo)
08403     void *callerdat;
08404     struct file_info *finfo;
08405 {
08406     FILE *fp = NULL;
08407     struct rcsbuffer *rcsbufp = NULL;
08408     struct rcsbuffer rcsbuf;
08409     char *version;
08410
08411     if (finfo->rcs == NULL)
08412         return (1);
08413
08414     if (finfo->rcs->flags & PARTIAL)
08415     {
08416         RCS_reparsercsfile (finfo->rcs, &fp, &rcsbuf);
08417     rcsbufp = &rcsbuf;
08418     }
08419
08420     version = RCS_getversion (finfo->rcs, tag, date, force_tag_match,
08421                   (int *) NULL);
08422     if (version == NULL)
08423         return 0;
08424
08425     /* Distinguish output for various files if we are processing
08426        several files.  */
08427     cvs_outerr ("Annotations for ", 0);
08428     cvs_outerr (finfo->fullname, 0);
08429     cvs_outerr ("\n***************\n", 0);
08430
08431     RCS_deltas (finfo->rcs, fp, rcsbufp, version, RCS_ANNOTATE, NULL,
08432         NULL, NULL, NULL);
08433     free (version);
08434     return 0;
08435 }
08436
08437 static const char *const annotate_usage[] =
08438 {
08439     "Usage: %s %s [-lRf] [-r rev|-D date] [files...]\n",
08440     "\t-l\tLocal directory only, no recursion.\n",
08441     "\t-R\tProcess directories recursively.\n",
08442     "\t-f\tUse head revision if tag/date not found.\n",
08443     "\t-r rev\tAnnotate file as of specified revision/tag.\n",
08444     "\t-D date\tAnnotate file as of specified date.\n",
08445     "(Specify the --help global option for a list of other help options)\n",
08446     NULL
08447 };
08448
08449 /* Command to show the revision, date, and author where each line of a
08450    file was modified.  */
08451
08452 int
08453 annotate (argc, argv)
08454     int argc;
08455     char **argv;
08456 {
08457     int local = 0;
08458     int c;
08459
08460     if (argc == -1)
08461     usage (annotate_usage);
08462
08463     optind = 0;
08464     while ((c = getopt (argc, argv, "+lr:D:fR")) != -1)
08465     {
08466     switch (c)
08467     {
08468         case 'l':
08469         local = 1;
08470         break;
08471         case 'R':
08472         local = 0;
08473         break;
08474         case 'r':
08475             tag = optarg;
08476         break;
08477         case 'D':
08478             date = Make_Date (optarg);
08479         break;
08480         case 'f':
08481             force_tag_match = 0;
08482         break;
08483         case '?':
08484         default:
08485         usage (annotate_usage);
08486         break;
08487     }
08488     }
08489     argc -= optind;
08490     argv += optind;
08491
08492 #ifdef CLIENT_SUPPORT
08493     if (client_active)
08494     {
08495     start_server ();
08496     ign_setup ();
08497
08498     if (local)
08499         send_arg ("-l");
08500     if (!force_tag_match)
08501         send_arg ("-f");
08502     option_with_arg ("-r", tag);
08503     if (date)
08504         client_senddate (date);
08505     send_files (argc, argv, local, 0, SEND_NO_CONTENTS);
08506     send_file_names (argc, argv, SEND_EXPAND_WILD);
08507     send_to_server ("annotate\012", 0);
08508     return get_responses_and_close ();
08509     }
08510 #endif /* CLIENT_SUPPORT */
08511
08512     if (tag != NULL)
08513     tag_check_valid (tag, argc, argv, local, 0, "");
08514
08515     return start_recursion (annotate_fileproc, (FILESDONEPROC) NULL,
08516                 (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
08517                 argc, argv, local, W_LOCAL, 0, 1, (char *)NULL,
08518                 1);
08519 }
08520
08521 /*
08522  * For a given file with full pathname PATH and revision number REV,
08523  * produce a file label suitable for passing to diff.  The default
08524  * file label as used by RCS 5.7 looks like this:
08525  *
08526  *  FILENAME <tab> YYYY/MM/DD <sp> HH:MM:SS <tab> REVNUM
08527  *
08528  * The date and time used are the revision's last checkin date and time.
08529  * If REV is NULL, use the working copy's mtime instead.
08530  */
08531 char *
08532 make_file_label (path, rev, rcs)
08533     char *path;
08534     char *rev;
08535     RCSNode *rcs;
08536 {
08537     char datebuf[MAXDATELEN];
08538     char *label;
08539     char *file;
08540
08541     file = last_component (path);
08542     label = (char *) xmalloc (strlen (path)
08543                   + (rev == NULL ? 0 : strlen (rev))
08544                   + 50);
08545
08546     if (rev)
08547     {
08548     char *date;
08549     RCS_getrevtime (rcs, rev, datebuf, 0);
08550     date = printable_date (datebuf);
08551     (void) sprintf (label, "-L%s\t%s\t%s", path, date, rev);
08552     free (date);
08553     }
08554     else
08555     {
08556     struct stat sb;
08557     struct tm *wm;
08558
08559     if (CVS_STAT (file, &sb) < 0)
08560         error (0, 1, "could not get info for `%s'", path);
08561     else
08562     {
08563         wm = gmtime (&sb.st_mtime);
08564         (void) sprintf (datebuf, "%04d/%02d/%02d %02d:%02d:%02d",
08565                 wm->tm_year + 1900, wm->tm_mon + 1,
08566                 wm->tm_mday, wm->tm_hour,
08567                 wm->tm_min, wm->tm_sec);
08568         (void) sprintf (label, "-L%s\t%s", path, datebuf);
08569     }
08570     }
08571     return label;
08572 }
Generated on Sun Oct 21 12:41:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/rcs.h Source File

cvs-1.10/src/rcs.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * RCS source control definitions needed by rcs.c and friends
00009  */
00010
00011 /* Strings which indicate a conflict if they occur at the start of a line.  */
00012 #define RCS_MERGE_PAT_1 "<<<<<<< "
00013 #define RCS_MERGE_PAT_2 "=======\n"
00014 #define RCS_MERGE_PAT_3 ">>>>>>> "
00015
00016 #define RCSEXT      ",v"
00017 #define RCSPAT      "*,v"
00018 #define RCSHEAD     "head"
00019 #define RCSBRANCH   "branch"
00020 #define RCSSYMBOLS  "symbols"
00021 #define RCSDATE     "date"
00022 #define RCSDESC     "desc"
00023 #define RCSEXPAND   "expand"
00024
00025 /* Used by the version of death support which resulted from old
00026    versions of CVS (e.g. 1.5 if you define DEATH_SUPPORT and not
00027    DEATH_STATE).  Only a hacked up RCS (used by those old versions of
00028    CVS) will put this into RCS files.  Considered obsolete.  */
00029 #define RCSDEAD     "dead"
00030
00031 #define DATEFORM    "%02d.%02d.%02d.%02d.%02d.%02d"
00032 #define SDATEFORM   "%d.%d.%d.%d.%d.%d"
00033
00034 /*
00035  * Opaque structure definitions used by RCS specific lookup routines
00036  */
00037 #define VALID   0x1         /* flags field contains valid data */
00038 #define INATTIC 0x2         /* RCS file is located in the Attic */
00039 #define PARTIAL 0x4         /* RCS file not completly parsed */
00040
00041 /* All the "char *" fields in RCSNode, Deltatext, and RCSVers are
00042    '\0'-terminated (except "text" in Deltatext).  This means that we
00043    can't deal with fields containing '\0', which is a limitation that
00044    RCS does not have.  Would be nice to fix this some day.  */
00045
00046 struct rcsnode
00047 {
00048     /* Reference count for this structure.  Used to deal with the
00049        fact that there might be a pointer from the Vers_TS or might
00050        not.  Callers who increment this field are responsible for
00051        calling freercsnode when they are done with their reference.  */
00052     int refcount;
00053
00054     /* Flags (INATTIC, PARTIAL, &c), see above.  */
00055     int flags;
00056
00057     /* File name of the RCS file.  This is not necessarily the name
00058        as specified by the user, but it is a name which can be passed to
00059        system calls and a name which is OK to print in error messages
00060        (the various names might differ in case).  */
00061     char *path;
00062
00063     /* Value for head keyword from RCS header, or NULL if empty.  */
00064     char *head;
00065
00066     /* Value for branch keyword from RCS header, or NULL if omitted.  */
00067     char *branch;
00068
00069     /* Raw data on symbolic revisions.  The first time that RCS_symbols is
00070        called, we parse these into ->symbols, and free ->symbols_data.  */
00071     char *symbols_data;
00072
00073     /* Value for expand keyword from RCS header, or NULL if omitted.  */
00074     char *expand;
00075
00076     /* List of nodes, the key of which is the symbolic name and the data
00077        of which is the numeric revision that it corresponds to (malloc'd).  */
00078     List *symbols;
00079
00080     /* List of nodes (type RCSVERS), the key of which the numeric revision
00081        number, and the data of which is an RCSVers * for the revision.  */
00082     List *versions;
00083
00084     /* Value for access keyword from RCS header, or NULL if empty.
00085        FIXME: RCS_delaccess would also seem to use "" for empty.  We
00086        should pick one or the other.  */
00087     char *access;
00088
00089     /* Raw data on locked revisions.  The first time that RCS_getlocks is
00090        called, we parse these into ->locks, and free ->locks_data.  */
00091     char *locks_data;
00092
00093     /* List of nodes, the key of which is the numeric revision and the
00094        data of which is the user that it corresponds to (malloc'd).  */
00095     List *locks;
00096
00097     /* Set for the strict keyword from the RCS header.  */
00098     int strict_locks;
00099
00100     /* Value for the comment keyword from RCS header (comment leader), or
00101        NULL if omitted.  */
00102     char *comment;
00103
00104     /* Value for the desc field in the RCS file, or NULL if empty.  */
00105     char *desc;
00106
00107     /* File offset of the first deltatext node, so we can seek there.  */
00108     long delta_pos;
00109
00110     /* Newphrases from the RCS header.  List of nodes, the key of which
00111        is the "id" which introduces the newphrase, and the value of which
00112        is the value from the newphrase.  */
00113     List *other;
00114 };
00115
00116 typedef struct rcsnode RCSNode;
00117
00118 struct deltatext {
00119     char *version;
00120
00121     /* Log message, or NULL if we do not intend to change the log message
00122        (that is, RCS_copydeltas should just use the log message from the
00123        file).  */
00124     char *log;
00125
00126     /* Change text, or NULL if we do not intend to change the change text
00127        (that is, RCS_copydeltas should just use the change text from the
00128        file).  Note that it is perfectly legal to have log be NULL and
00129        text non-NULL, or vice-versa.  */
00130     char *text;
00131     size_t len;
00132
00133     /* Newphrase fields from deltatext nodes.  FIXME: duplicates the
00134        other field in the rcsversnode, I think.  */
00135     List *other;
00136 };
00137 typedef struct deltatext Deltatext;
00138
00139 struct rcsversnode
00140 {
00141     /* Duplicate of the key by which this structure is indexed.  */
00142     char *version;
00143
00144     char *date;
00145     char *author;
00146     char *state;
00147     char *next;
00148     int dead;
00149     int outdated;
00150     Deltatext *text;
00151     List *branches;
00152     /* Newphrase fields from deltatext nodes.  Also contains ";add" and
00153        ";delete" magic fields (see rcs.c, log.c).  I think this is
00154        only used by log.c (where it looks up "log").  Duplicates the
00155        other field in struct deltatext, I think.  */
00156     List *other;
00157     /* Newphrase fields from delta nodes.  */
00158     List *other_delta;
00159 #ifdef PRESERVE_PERMISSIONS_SUPPORT
00160     /* Hard link information for each revision. */
00161     List *hardlinks;
00162 #endif
00163 };
00164 typedef struct rcsversnode RCSVers;
00165
00166 /*
00167  * CVS reserves all even-numbered branches for its own use.  "magic" branches
00168  * (see rcs.c) are contained as virtual revision numbers (within symbolic
00169  * tags only) off the RCS_MAGIC_BRANCH, which is 0.  CVS also reserves the
00170  * ".1" branch for vendor revisions.  So, if you do your own branching, you
00171  * should limit your use to odd branch numbers starting at 3.
00172  */
00173 #define RCS_MAGIC_BRANCH    0
00174
00175 /* The type of a function passed to RCS_checkout.  */
00176 typedef void (*RCSCHECKOUTPROC) PROTO ((void *, const char *, size_t));
00177
00178 #ifdef __STDC__
00179 struct rcsbuffer;
00180 #endif
00181
00182 /*
00183  * exported interfaces
00184  */
00185 RCSNode *RCS_parse PROTO((const char *file, const char *repos));
00186 RCSNode *RCS_parsercsfile PROTO((char *rcsfile));
00187 void RCS_fully_parse PROTO((RCSNode *));
00188 void RCS_reparsercsfile PROTO((RCSNode *, FILE **, struct rcsbuffer *));
00189 extern int RCS_setattic PROTO ((RCSNode *, int));
00190
00191 char *RCS_check_kflag PROTO((const char *arg));
00192 char *RCS_getdate PROTO((RCSNode * rcs, char *date, int force_tag_match));
00193 char *RCS_gettag PROTO((RCSNode * rcs, char *symtag, int force_tag_match,
00194             int *simple_tag));
00195 int RCS_exist_rev PROTO((RCSNode *rcs, char *rev));
00196 int RCS_exist_tag PROTO((RCSNode *rcs, char *tag));
00197 char *RCS_tag2rev PROTO((RCSNode *rcs, char *tag));
00198 char *RCS_getversion PROTO((RCSNode * rcs, char *tag, char *date,
00199               int force_tag_match, int *simple_tag));
00200 char *RCS_magicrev PROTO((RCSNode *rcs, char *rev));
00201 int RCS_isbranch PROTO((RCSNode *rcs, const char *rev));
00202 int RCS_nodeisbranch PROTO((RCSNode *rcs, const char *tag));
00203 char *RCS_whatbranch PROTO((RCSNode *rcs, const char *tag));
00204 char *RCS_head PROTO((RCSNode * rcs));
00205 int RCS_datecmp PROTO((char *date1, char *date2));
00206 time_t RCS_getrevtime PROTO((RCSNode * rcs, char *rev, char *date, int fudge));
00207 List *RCS_symbols PROTO((RCSNode *rcs));
00208 void RCS_check_tag PROTO((const char *tag));
00209 int RCS_valid_rev PROTO ((char *rev));
00210 List *RCS_getlocks PROTO((RCSNode *rcs));
00211 void freercsnode PROTO((RCSNode ** rnodep));
00212 char *RCS_getbranch PROTO((RCSNode * rcs, char *tag, int force_tag_match));
00213 char *RCS_branch_head PROTO ((RCSNode *rcs, char *rev));
00214
00215 int RCS_isdead PROTO((RCSNode *, const char *));
00216 char *RCS_getexpand PROTO ((RCSNode *));
00217 void RCS_setexpand PROTO ((RCSNode *, char *));
00218 int RCS_checkout PROTO ((RCSNode *, char *, char *, char *, char *, char *,
00219              RCSCHECKOUTPROC, void *));
00220 int RCS_checkin PROTO ((RCSNode *rcs, char *workfile, char *message,
00221             char *rev, int flags));
00222 int RCS_cmp_file PROTO ((RCSNode *, char *, char *, const char *));
00223 int RCS_settag PROTO ((RCSNode *, const char *, const char *));
00224 int RCS_deltag PROTO ((RCSNode *, const char *));
00225 int RCS_setbranch PROTO((RCSNode *, const char *));
00226 int RCS_lock PROTO ((RCSNode *, const char *, int));
00227 int RCS_unlock PROTO ((RCSNode *, const char *, int));
00228 int RCS_delete_revs PROTO ((RCSNode *, char *, char *, int));
00229 void RCS_addaccess PROTO ((RCSNode *, char *));
00230 void RCS_delaccess PROTO ((RCSNode *, char *));
00231 char *RCS_getaccess PROTO ((RCSNode *));
00232 RETSIGTYPE rcs_cleanup PROTO ((void));
00233 void RCS_rewrite PROTO ((RCSNode *, Deltatext *, char *));
00234 void RCS_abandon PROTO ((RCSNode *));
00235 int rcs_change_text PROTO ((const char *, char *, size_t, const char *,
00236                 size_t, char **, size_t *));
00237 char *make_file_label PROTO ((char *, char *, RCSNode *));
00238
00239 extern int preserve_perms;
00240
00241 /* From import.c.  */
00242 extern int add_rcs_file PROTO ((char *, char *, char *, char *, char *,
00243                 char *, char *, int, char **,
00244                 char *, size_t, FILE *));
Generated on Sun Oct 21 12:41:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/rcscmds.c Source File

cvs-1.10/src/rcscmds.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * The functions in this file provide an interface for performing
00009  * operations directly on RCS files.
00010  */
00011
00012 #include "cvs.h"
00013 #include <assert.h>
00014 #include <stdio.h>
00015 #include "diffrun.h"
00016
00017 /* This file, rcs.h, and rcs.c, together sometimes known as the "RCS
00018    library", are intended to define our interface to RCS files.
00019
00020    Whether there will also be a version of RCS which uses this
00021    library, or whether the library will be packaged for uses beyond
00022    CVS or RCS (many people would like such a thing) is an open
00023    question.  Some considerations:
00024
00025    1.  An RCS library for CVS must have the capabilities of the
00026    existing CVS code which accesses RCS files.  In particular, simple
00027    approaches will often be slow.
00028
00029    2.  An RCS library should not use code from the current RCS
00030    (5.7 and its ancestors).  The code has many problems.  Too few
00031    comments, too many layers of abstraction, too many global variables
00032    (the correct number for a library is zero), too much intricately
00033    interwoven functionality, and too many clever hacks.  Paul Eggert,
00034    the current RCS maintainer, agrees.
00035
00036    3.  More work needs to be done in terms of separating out the RCS
00037    library from the rest of CVS (for example, cvs_output should be
00038    replaced by a callback, and the declarations should be centralized
00039    into rcs.h, and probably other such cleanups).
00040
00041    4.  To be useful for RCS and perhaps for other uses, the library
00042    may need features beyond those needed by CVS.
00043
00044    5.  Any changes to the RCS file format *must* be compatible.  Many,
00045    many tools (not just CVS and RCS) can at least import this format.
00046    RCS and CVS must preserve the current ability to import/export it
00047    (preferably improved--magic branches are currently a roadblock).
00048    See doc/RCSFILES in the CVS distribution for documentation of this
00049    file format.
00050
00051    On a related note, see the comments at diff_exec, later in this file,
00052    for more on the diff library.  */
00053
00054 static void RCS_output_diff_options PROTO ((char *, char *, char *, char *));
00055
00056
00057 /* Stuff to deal with passing arguments the way libdiff.a wants to deal
00058    with them.  This is a crufty interface; there is no good reason for it
00059    to resemble a command line rather than something closer to "struct
00060    log_data" in log.c.  */
00061
00062 /* First call call_diff_setup to setup any initial arguments.  The
00063    argument will be parsed into whitespace separated words and added
00064    to the global call_diff_argv list.
00065
00066    Then, optionally, call call_diff_arg for each additional argument
00067    that you'd like to pass to the diff library.
00068
00069    Finally, call call_diff or call_diff3 to produce the diffs.  */
00070
00071 static char **call_diff_argv;
00072 static int call_diff_argc;
00073 static int call_diff_argc_allocated;
00074
00075 static void call_diff_add_arg PROTO ((const char *));
00076 static void call_diff_setup PROTO ((const char *prog));
00077 static int call_diff PROTO ((char *out));
00078 static int call_diff3 PROTO ((char *out));
00079
00080 static void call_diff_write_output PROTO((const char *, size_t));
00081 static void call_diff_flush_output PROTO((void));
00082 static void call_diff_write_stdout PROTO((const char *));
00083 static void call_diff_error PROTO((const char *, const char *, const char *));
00084
00085 /* VARARGS */
00086 static void
00087 call_diff_setup (prog)
00088     const char *prog;
00089 {
00090     char *cp;
00091     int i;
00092     char *call_diff_prog;
00093
00094     /* clean out any malloc'ed values from call_diff_argv */
00095     for (i = 0; i < call_diff_argc; i++)
00096     {
00097     if (call_diff_argv[i])
00098     {
00099         free (call_diff_argv[i]);
00100         call_diff_argv[i] = (char *) 0;
00101     }
00102     }
00103     call_diff_argc = 0;
00104
00105     call_diff_prog = xstrdup (prog);
00106
00107     /* put each word into call_diff_argv, allocating it as we go */
00108     for (cp = strtok (call_diff_prog, " \t");
00109      cp != NULL;
00110      cp = strtok ((char *) NULL, " \t"))
00111     call_diff_add_arg (cp);
00112     free (call_diff_prog);
00113 }
00114
00115 static void
00116 call_diff_arg (s)
00117     const char *s;
00118 {
00119     call_diff_add_arg (s);
00120 }
00121
00122 static void
00123 call_diff_add_arg (s)
00124     const char *s;
00125 {
00126     /* allocate more argv entries if we've run out */
00127     if (call_diff_argc >= call_diff_argc_allocated)
00128     {
00129     call_diff_argc_allocated += 50;
00130     call_diff_argv = (char **)
00131         xrealloc ((char *) call_diff_argv,
00132               call_diff_argc_allocated * sizeof (char **));
00133     }
00134
00135     if (s)
00136     call_diff_argv[call_diff_argc++] = xstrdup (s);
00137     else
00138     /* Not post-incremented on purpose!  */
00139     call_diff_argv[call_diff_argc] = (char *) 0;
00140 }
00141
00142 /* Callback function for the diff library to write data to the output
00143    file.  This is used when we are producing output to stdout.  */
00144
00145 static void
00146 call_diff_write_output (text, len)
00147     const char *text;
00148     size_t len;
00149 {
00150     if (len > 0)
00151     cvs_output (text, len);
00152 }
00153
00154 /* Call back function for the diff library to flush the output file.
00155    This is used when we are producing output to stdout.  */
00156
00157 static void
00158 call_diff_flush_output ()
00159 {
00160     cvs_flushout ();
00161 }
00162
00163 /* Call back function for the diff library to write to stdout.  */
00164
00165 static void
00166 call_diff_write_stdout (text)
00167     const char *text;
00168 {
00169     cvs_output (text, 0);
00170 }
00171
00172 /* Call back function for the diff library to write to stderr.  */
00173
00174 static void
00175 call_diff_error (format, a1, a2)
00176     const char *format;
00177     const char *a1;
00178     const char *a2;
00179 {
00180     /* FIXME: Should we somehow indicate that this error is coming from
00181        the diff library?  */
00182     error (0, 0, format, a1, a2);
00183 }
00184
00185 /* This set of callback functions is used if we are sending the diff
00186    to stdout.  */
00187
00188 static struct diff_callbacks call_diff_stdout_callbacks =
00189 {
00190     call_diff_write_output,
00191     call_diff_flush_output,
00192     call_diff_write_stdout,
00193     call_diff_error
00194 };
00195
00196 /* This set of callback functions is used if we are sending the diff
00197    to a file.  */
00198
00199 static struct diff_callbacks call_diff_file_callbacks =
00200 {
00201     (void (*) PROTO((const char *, size_t))) NULL,
00202     (void (*) PROTO((void))) NULL,
00203     call_diff_write_stdout,
00204     call_diff_error
00205 };
00206
00207 static int
00208 call_diff (out)
00209     char *out;
00210 {
00211     if (out == RUN_TTY)
00212     return diff_run (call_diff_argc, call_diff_argv, NULL,
00213              &call_diff_stdout_callbacks);
00214     else
00215     return diff_run (call_diff_argc, call_diff_argv, out,
00216              &call_diff_file_callbacks);
00217 }
00218
00219 static int
00220 call_diff3 (out)
00221     char *out;
00222 {
00223     if (out == RUN_TTY)
00224     return diff3_run (call_diff_argc, call_diff_argv, NULL,
00225               &call_diff_stdout_callbacks);
00226     else
00227     return diff3_run (call_diff_argc, call_diff_argv, out,
00228               &call_diff_file_callbacks);
00229 }
00230
00231
00232
00233 /* Merge revisions REV1 and REV2. */
00234
00235 int
00236 RCS_merge(rcs, path, workfile, options, rev1, rev2)
00237     RCSNode *rcs;
00238     char *path;
00239     char *workfile;
00240     char *options;
00241     char *rev1;
00242     char *rev2;
00243 {
00244     char *xrev1, *xrev2;
00245     char *tmp1, *tmp2;
00246     char *diffout = NULL;
00247     int retval;
00248
00249     if (options != NULL && options[0] != '\0')
00250       assert (options[0] == '-' && options[1] == 'k');
00251
00252     cvs_output ("RCS file: ", 0);
00253     cvs_output (rcs->path, 0);
00254     cvs_output ("\n", 1);
00255
00256     /* Calculate numeric revision numbers from rev1 and rev2 (may be
00257        symbolic). */
00258     xrev1 = RCS_gettag (rcs, rev1, 0, NULL);
00259     xrev2 = RCS_gettag (rcs, rev2, 0, NULL);
00260
00261     /* Check out chosen revisions.  The error message when RCS_checkout
00262        fails is not very informative -- it is taken verbatim from RCS 5.7,
00263        and relies on RCS_checkout saying something intelligent upon failure. */
00264     cvs_output ("retrieving revision ", 0);
00265     cvs_output (xrev1, 0);
00266     cvs_output ("\n", 1);
00267
00268     tmp1 = cvs_temp_name();
00269     if (RCS_checkout (rcs, NULL, xrev1, rev1, options, tmp1,
00270               (RCSCHECKOUTPROC)0, NULL))
00271     {
00272     cvs_outerr ("rcsmerge: co failed\n", 0);
00273     error_exit();
00274     }
00275
00276     cvs_output ("retrieving revision ", 0);
00277     cvs_output (xrev2, 0);
00278     cvs_output ("\n", 1);
00279
00280     tmp2 = cvs_temp_name();
00281     if (RCS_checkout (rcs, NULL, xrev2, rev2, options, tmp2,
00282               (RCSCHECKOUTPROC)0, NULL))
00283     {
00284     cvs_outerr ("rcsmerge: co failed\n", 0);
00285     error_exit();
00286     }
00287
00288     /* Merge changes. */
00289     cvs_output ("Merging differences between ", 0);
00290     cvs_output (xrev1, 0);
00291     cvs_output (" and ", 0);
00292     cvs_output (xrev2, 0);
00293     cvs_output (" into ", 0);
00294     cvs_output (workfile, 0);
00295     cvs_output ("\n", 1);
00296
00297     /* Remember that the first word in the `call_diff_setup' string is used now
00298        only for diagnostic messages -- CVS no longer forks to run diff3. */
00299     diffout = cvs_temp_name();
00300     call_diff_setup ("diff3");
00301     call_diff_arg ("-E");
00302     call_diff_arg ("-am");
00303
00304     call_diff_arg ("-L");
00305     call_diff_arg (workfile);
00306     call_diff_arg ("-L");
00307     call_diff_arg (xrev1);
00308     call_diff_arg ("-L");
00309     call_diff_arg (xrev2);
00310
00311     call_diff_arg (workfile);
00312     call_diff_arg (tmp1);
00313     call_diff_arg (tmp2);
00314
00315     retval = call_diff3 (diffout);
00316
00317     if (retval == 1)
00318     cvs_outerr ("rcsmerge: warning: conflicts during merge\n", 0);
00319     else if (retval == 2)
00320     error_exit();
00321
00322     if (diffout)
00323     copy_file (diffout, workfile);
00324
00325     /* Clean up. */
00326     {
00327     int save_noexec = noexec;
00328     noexec = 0;
00329     if (unlink_file (tmp1) < 0)
00330     {
00331         if (!existence_error (errno))
00332         error (0, errno, "cannot remove temp file %s", tmp1);
00333     }
00334     free (tmp1);
00335     if (unlink_file (tmp2) < 0)
00336     {
00337         if (!existence_error (errno))
00338         error (0, errno, "cannot remove temp file %s", tmp2);
00339     }
00340     free (tmp2);
00341     if (diffout)
00342     {
00343         if (unlink_file (diffout) < 0)
00344         {
00345         if (!existence_error (errno))
00346             error (0, errno, "cannot remove temp file %s", diffout);
00347         }
00348         free (diffout);
00349     }
00350     free (xrev1);
00351     free (xrev2);
00352     noexec = save_noexec;
00353     }
00354
00355     return retval;
00356 }
00357
00358 /* Diff revisions and/or files.  OPTS controls the format of the diff
00359    (it contains options such as "-w -c", &c), or "" for the default.
00360    OPTIONS controls keyword expansion, as a string starting with "-k",
00361    or "" to use the default.  REV1 is the first revision to compare
00362    against; it must be non-NULL.  If REV2 is non-NULL, compare REV1
00363    and REV2; if REV2 is NULL compare REV1 with the file in the working
00364    directory, whose name is WORKFILE.  LABEL1 and LABEL2 are default
00365    file labels, and (if non-NULL) should be added as -L options
00366    to diff.  Output goes to stdout.
00367
00368    Return value is 0 for success, -1 for a failure which set errno,
00369    or positive for a failure which printed a message on stderr.
00370
00371    This used to exec rcsdiff, but now calls RCS_checkout and diff_exec.
00372
00373    An issue is what timezone is used for the dates which appear in the
00374    diff output.  rcsdiff uses the -z flag, which is not presently
00375    processed by CVS diff, but I'm not sure exactly how hard to worry
00376    about this--any such features are undocumented in the context of
00377    CVS, and I'm not sure how important to users.  */
00378 int
00379 RCS_exec_rcsdiff (rcsfile, opts, options, rev1, rev2, label1, label2, workfile)
00380     RCSNode *rcsfile;
00381     char *opts;
00382     char *options;
00383     char *rev1;
00384     char *rev2;
00385     char *label1;
00386     char *label2;
00387     char *workfile;
00388 {
00389     char *tmpfile1;
00390     char *tmpfile2;
00391     char *use_file2;
00392     int status, retval;
00393
00394     tmpfile1 = cvs_temp_name ();
00395     tmpfile2 = NULL;
00396
00397     cvs_output ("\
00398 ===================================================================\n\
00399 RCS file: ", 0);
00400     cvs_output (rcsfile->path, 0);
00401     cvs_output ("\n", 1);
00402
00403     /* Historically, `cvs diff' has expanded the $Name keyword to the
00404        empty string when checking out revisions.  This is an accident,
00405        but no one has considered the issue thoroughly enough to determine
00406        what the best behavior is.  Passing NULL for the `nametag' argument
00407        preserves the existing behavior. */
00408
00409     cvs_output ("retrieving revision ", 0);
00410     cvs_output (rev1, 0);
00411     cvs_output ("\n", 1);
00412     status = RCS_checkout (rcsfile, NULL, rev1, NULL, options, tmpfile1,
00413                (RCSCHECKOUTPROC)0, NULL);
00414     if (status > 0)
00415     {
00416     retval = status;
00417     goto error_return;
00418     }
00419     else if (status < 0)
00420     {
00421     error (0, errno,
00422            "cannot check out revision %s of %s", rev1, rcsfile->path);
00423     retval = 1;
00424     goto error_return;
00425     }
00426
00427     if (rev2 == NULL)
00428     {
00429     assert (workfile != NULL);
00430     use_file2 = workfile;
00431     }
00432     else
00433     {
00434     tmpfile2 = cvs_temp_name ();
00435     cvs_output ("retrieving revision ", 0);
00436     cvs_output (rev2, 0);
00437     cvs_output ("\n", 1);
00438     status = RCS_checkout (rcsfile, NULL, rev2, NULL, options,
00439                    tmpfile2, (RCSCHECKOUTPROC)0, NULL);
00440     if (status > 0)
00441     {
00442         retval = status;
00443         goto error_return;
00444     }
00445     else if (status < 0)
00446     {
00447         error (0, errno,
00448            "cannot check out revision %s of %s", rev2, rcsfile->path);
00449         return 1;
00450     }
00451     use_file2 = tmpfile2;
00452     }
00453
00454     RCS_output_diff_options (opts, rev1, rev2, workfile);
00455     status = diff_execv (tmpfile1, use_file2, label1, label2, opts, RUN_TTY);
00456     if (status >= 0)
00457     {
00458     retval = status;
00459     goto error_return;
00460     }
00461     else if (status < 0)
00462     {
00463     error (0, errno,
00464            "cannot diff %s and %s", tmpfile1, use_file2);
00465     retval = 1;
00466     goto error_return;
00467     }
00468
00469  error_return:
00470     {
00471     int save_noexec = noexec;
00472     noexec = 0;
00473     if (unlink_file (tmpfile1) < 0)
00474     {
00475         if (!existence_error (errno))
00476         error (0, errno, "cannot remove temp file %s", tmpfile1);
00477     }
00478     noexec = save_noexec;
00479     }
00480     free (tmpfile1);
00481     if (tmpfile2 != NULL)
00482     {
00483     int save_noexec = noexec;
00484     noexec = 0;
00485     if (unlink_file (tmpfile2) < 0)
00486     {
00487         if (!existence_error (errno))
00488         error (0, errno, "cannot remove temp file %s", tmpfile2);
00489     }
00490     noexec = save_noexec;
00491     free (tmpfile2);
00492     }
00493
00494     return retval;
00495 }
00496
00497
00498 /* Show differences between two files.  This is the start of a diff library.
00499
00500    Some issues:
00501
00502    * Should option parsing be part of the library or the caller?  The
00503    former allows the library to add options without changing the callers,
00504    but it causes various problems.  One is that something like --brief really
00505    wants special handling in CVS, and probably the caller should retain
00506    some flexibility in this area.  Another is online help (the library could
00507    have some feature for providing help, but how does that interact with
00508    the help provided by the caller directly?).  Another is that as things
00509    stand currently, there is no separate namespace for diff options versus
00510    "cvs diff" options like -l (that is, if the library adds an option which
00511    conflicts with a CVS option, it is trouble).
00512
00513    * This isn't required for a first-cut diff library, but if there
00514    would be a way for the caller to specify the timestamps that appear
00515    in the diffs (rather than the library getting them from the files),
00516    that would clean up the kludgy utime() calls in patch.c.
00517
00518    Show differences between FILE1 and FILE2.  Either one can be
00519    DEVNULL to indicate a nonexistent file (same as an empty file
00520    currently, I suspect, but that may be an issue in and of itself).
00521    OPTIONS is a list of diff options, or "" if none.  At a minimum,
00522    CVS expects that -c (update.c, patch.c) and -n (update.c) will be
00523    supported.  Other options, like -u, --speed-large-files, &c, will
00524    be specified if the user specified them.
00525
00526    OUT is a filename to send the diffs to, or RUN_TTY to send them to
00527    stdout.  Error messages go to stderr.  Return value is 0 for
00528    success, -1 for a failure which set errno, 1 for success (and some
00529    differences were found), or >1 for a failure which printed a
00530    message on stderr.  */
00531
00532 int
00533 diff_exec (file1, file2, options, out)
00534     char *file1;
00535     char *file2;
00536     char *options;
00537     char *out;
00538 {
00539     char *args;
00540
00541 #ifdef PRESERVE_PERMISSIONS_SUPPORT
00542     /* If either file1 or file2 are special files, pretend they are
00543        /dev/null.  Reason: suppose a file that represents a block
00544        special device in one revision becomes a regular file.  CVS
00545        must find the `difference' between these files, but a special
00546        file contains no data useful for calculating this metric.  The
00547        safe thing to do is to treat the special file as an empty file,
00548        thus recording the regular file's full contents.  Doing so will
00549        create extremely large deltas at the point of transition
00550        between device files and regular files, but this is probably
00551        very rare anyway.
00552
00553        There may be ways around this, but I think they are fraught
00554        with danger. -twp */
00555
00556     if (preserve_perms &&
00557     strcmp (file1, DEVNULL) != 0 &&
00558     strcmp (file2, DEVNULL) != 0)
00559     {
00560     struct stat sb1, sb2;
00561
00562     if (CVS_LSTAT (file1, &sb1) < 0)
00563         error (1, errno, "cannot get file information for %s", file1);
00564     if (CVS_LSTAT (file2, &sb2) < 0)
00565         error (1, errno, "cannot get file information for %s", file2);
00566
00567     if (!S_ISREG (sb1.st_mode) && !S_ISDIR (sb1.st_mode))
00568         file1 = DEVNULL;
00569     if (!S_ISREG (sb2.st_mode) && !S_ISDIR (sb2.st_mode))
00570         file2 = DEVNULL;
00571     }
00572 #endif
00573
00574     args = xmalloc (strlen (options) + 10);
00575     /* The first word in this string is used only for error reporting. */
00576     sprintf (args, "diff %s", options);
00577     call_diff_setup (args);
00578     call_diff_arg (file1);
00579     call_diff_arg (file2);
00580     free (args);
00581
00582     return call_diff (out);
00583 }
00584
00585 int
00586 diff_execv (file1, file2, label1, label2, options, out)
00587     char *file1;
00588     char *file2;
00589     char *label1;
00590     char *label2;
00591     char *options;
00592     char *out;
00593 {
00594     char *args;
00595
00596 #ifdef PRESERVE_PERMISSIONS_SUPPORT
00597     /* Pretend that special files are /dev/null for purposes of making
00598        diffs.  See comments in diff_exec. */
00599
00600     if (preserve_perms &&
00601     strcmp (file1, DEVNULL) != 0 &&
00602     strcmp (file2, DEVNULL) != 0)
00603     {
00604     struct stat sb1, sb2;
00605
00606     if (CVS_LSTAT (file1, &sb1) < 0)
00607         error (1, errno, "cannot get file information for %s", file1);
00608     if (CVS_LSTAT (file2, &sb2) < 0)
00609         error (1, errno, "cannot get file information for %s", file2);
00610
00611     if (!S_ISREG (sb1.st_mode) && !S_ISDIR (sb1.st_mode))
00612         file1 = DEVNULL;
00613     if (!S_ISREG (sb2.st_mode) && !S_ISDIR (sb2.st_mode))
00614         file2 = DEVNULL;
00615     }
00616 #endif
00617
00618     args = xmalloc (strlen (options) + 10);
00619     /* The first word in this string is used only for error reporting.  */
00620     /* I guess we are pretty confident that options starts with a space.  */
00621     sprintf (args, "diff%s", options);
00622     call_diff_setup (args);
00623     if (label1)
00624     call_diff_arg (label1);
00625     if (label2)
00626     call_diff_arg (label2);
00627     call_diff_arg (file1);
00628     call_diff_arg (file2);
00629     free (args);
00630
00631     return call_diff (out);
00632 }
00633
00634 /* Print the options passed to DIFF, in the format used by rcsdiff.
00635    The rcsdiff code that produces this output is extremely hairy, and
00636    it is not clear how rcsdiff decides which options to print and
00637    which not to print.  The code below reproduces every rcsdiff run
00638    that I have seen. */
00639
00640 static void
00641 RCS_output_diff_options (opts, rev1, rev2, workfile)
00642     char *opts;
00643     char *rev1;
00644     char *rev2;
00645     char *workfile;
00646 {
00647     char *tmp;
00648
00649     tmp = (char *) xmalloc (strlen (opts) + strlen (rev1) + 10);
00650
00651     sprintf (tmp, "diff%s -r%s", opts, rev1);
00652     cvs_output (tmp, 0);
00653     free (tmp);
00654
00655     if (rev2)
00656     {
00657     cvs_output (" -r", 3);
00658     cvs_output (rev2, 0);
00659     }
00660     else
00661     {
00662     assert (workfile != NULL);
00663     cvs_output (" ", 1);
00664     cvs_output (workfile, 0);
00665     }
00666     cvs_output ("\n", 1);
00667 }
Generated on Sun Oct 21 12:41:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/recurse.c Source File

cvs-1.10/src/recurse.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  *
00004  * You may distribute under the terms of the GNU General Public License as
00005  * specified in the README file that comes with the CVS source distribution.
00006  *
00007  * General recursion handler
00008  *
00009  */
00010
00011 #include "cvs.h"
00012 #include "savecwd.h"
00013 #include "fileattr.h"
00014 #include "edit.h"
00015
00016 static int do_dir_proc PROTO((Node * p, void *closure));
00017 static int do_file_proc PROTO((Node * p, void *closure));
00018 static void addlist PROTO((List ** listp, char *key));
00019 static int unroll_files_proc PROTO((Node *p, void *closure));
00020 static void addfile PROTO((List **listp, char *dir, char *file));
00021
00022 static char *update_dir;
00023 static char *repository = NULL;
00024 static List *filelist = NULL; /* holds list of files on which to operate */
00025 static List *dirlist = NULL; /* holds list of directories on which to operate */
00026
00027 struct recursion_frame {
00028     FILEPROC fileproc;
00029     FILESDONEPROC filesdoneproc;
00030     DIRENTPROC direntproc;
00031     DIRLEAVEPROC dirleaveproc;
00032     void *callerdat;
00033     Dtype flags;
00034     int which;
00035     int aflag;
00036     int readlock;
00037     int dosrcs;
00038 };
00039
00040 static int do_recursion PROTO ((struct recursion_frame *frame));
00041
00042 /* I am half tempted to shove a struct file_info * into the struct
00043    recursion_frame (but then we would need to modify or create a
00044    recursion_frame for each file), or shove a struct recursion_frame *
00045    into the struct file_info (more tempting, although it isn't completely
00046    clear that the struct file_info should contain info about recursion
00047    processor internals).  So instead use this struct.  */
00048
00049 struct frame_and_file {
00050     struct recursion_frame *frame;
00051     struct file_info *finfo;
00052 };
00053
00054 /* Similarly, we need to pass the entries list to do_dir_proc.  */
00055
00056 struct frame_and_entries {
00057     struct recursion_frame *frame;
00058     List *entries;
00059 };
00060
00061
00062 /* Start a recursive command.
00063
00064    Command line arguments (ARGC, ARGV) dictate the directories and
00065    files on which we operate.  In the special case of no arguments, we
00066    default to ".".  */
00067 int
00068 start_recursion (fileproc, filesdoneproc, direntproc, dirleaveproc, callerdat,
00069          argc, argv, local, which, aflag, readlock,
00070          update_preload, dosrcs)
00071     FILEPROC fileproc;
00072     FILESDONEPROC filesdoneproc;
00073     DIRENTPROC  direntproc;
00074     DIRLEAVEPROC dirleaveproc;
00075     void *callerdat;
00076
00077     int argc;
00078     char **argv;
00079     int local;
00080
00081     /* This specifies the kind of recursion.  There are several cases:
00082
00083        1.  W_LOCAL is not set but W_REPOS or W_ATTIC is.  The current
00084        directory when we are called must be the repository and
00085        recursion proceeds according to what exists in the repository.
00086
00087        2a.  W_LOCAL is set but W_REPOS and W_ATTIC are not.  The
00088        current directory when we are called must be the working
00089        directory.  Recursion proceeds according to what exists in the
00090        working directory, never (I think) consulting any part of the
00091        repository which does not correspond to the working directory
00092        ("correspond" == Name_Repository).
00093
00094        2b.  W_LOCAL is set and so is W_REPOS or W_ATTIC.  This is the
00095        weird one.  The current directory when we are called must be
00096        the working directory.  We recurse through working directories,
00097        but we recurse into a directory if it is exists in the working
00098        directory *or* it exists in the repository.  If a directory
00099        does not exist in the working directory, the direntproc must
00100        either tell us to skip it (R_SKIP_ALL), or must create it (I
00101        think those are the only two cases).  */
00102     int which;
00103
00104     int aflag;
00105     int readlock;
00106     char *update_preload;
00107     int dosrcs;
00108 {
00109     int i, err = 0;
00110 #ifdef CLIENT_SUPPORT
00111     List *args_to_send_when_finished = NULL;
00112 #endif
00113     List *files_by_dir = NULL;
00114     struct recursion_frame frame;
00115
00116     frame.fileproc = fileproc;
00117     frame.filesdoneproc = filesdoneproc;
00118     frame.direntproc = direntproc;
00119     frame.dirleaveproc = dirleaveproc;
00120     frame.callerdat = callerdat;
00121     frame.flags = local ? R_SKIP_DIRS : R_PROCESS;
00122     frame.which = which;
00123     frame.aflag = aflag;
00124     frame.readlock = readlock;
00125     frame.dosrcs = dosrcs;
00126
00127     expand_wild (argc, argv, &argc, &argv);
00128
00129     if (update_preload == NULL)
00130     update_dir = xstrdup ("");
00131     else
00132     update_dir = xstrdup (update_preload);
00133
00134     /* clean up from any previous calls to start_recursion */
00135     if (repository)
00136     {
00137     free (repository);
00138     repository = (char *) NULL;
00139     }
00140     if (filelist)
00141     dellist (&filelist); /* FIXME-krp: no longer correct. */
00142     if (dirlist)
00143     dellist (&dirlist);
00144
00145 #ifdef SERVER_SUPPORT
00146     if (server_active)
00147     {
00148     for (i = 0; i < argc; ++i)
00149         server_pathname_check (argv[i]);
00150     }
00151 #endif
00152
00153     if (argc == 0)
00154     {
00155     int just_subdirs = (which & W_LOCAL) && !isdir (CVSADM);
00156
00157 #ifdef CLIENT_SUPPORT
00158     if (!just_subdirs
00159         && CVSroot_cmdline == NULL
00160         && client_active)
00161     {
00162         char *root = Name_Root (NULL, update_dir);
00163         if (root && strcmp (root, current_root) != 0)
00164         /* We're skipping this directory because it is for
00165            a different root.  Therefore, we just want to
00166            do the subdirectories only.  Processing files would
00167            cause a working directory from one repository to be
00168            processed against a different repository, which could
00169            cause all kinds of spurious conflicts and such.
00170
00171            Question: what about the case of "cvs update foo"
00172            where we process foo/bar and not foo itself?  That
00173            seems to be handled somewhere (else) but why should
00174            it be a separate case?  Needs investigation...  */
00175         just_subdirs = 1;
00176         free (root);
00177     }
00178 #endif
00179
00180     /*
00181      * There were no arguments, so we'll probably just recurse. The
00182      * exception to the rule is when we are called from a directory
00183      * without any CVS administration files.  That has always meant to
00184      * process each of the sub-directories, so we pretend like we were
00185      * called with the list of sub-dirs of the current dir as args
00186      */
00187     if (just_subdirs)
00188     {
00189         dirlist = Find_Directories ((char *) NULL, W_LOCAL, (List *) NULL);
00190         /* If there are no sub-directories, there is a certain logic in
00191            favor of doing nothing, but in fact probably the user is just
00192            confused about what directory they are in, or whether they
00193            cvs add'd a new directory.  In the case of at least one
00194            sub-directory, at least when we recurse into them we
00195            notice (hopefully) whether they are under CVS control.  */
00196         if (list_isempty (dirlist))
00197         {
00198         if (update_dir[0] == '\0')
00199             error (0, 0, "in directory .:");
00200         else
00201             error (0, 0, "in directory %s:", update_dir);
00202         error (1, 0,
00203                "there is no version here; run '%s checkout' first",
00204                program_name);
00205         }
00206 #ifdef CLIENT_SUPPORT
00207         else if (client_active && server_started)
00208         {
00209         /* In the the case "cvs update foo bar baz", a call to
00210            send_file_names in update.c will have sent the
00211            appropriate "Argument" commands to the server.  In
00212            this case, that won't have happened, so we need to
00213            do it here.  While this example uses "update", this
00214            generalizes to other commands.  */
00215
00216         /* This is the same call to Find_Directories as above.
00217                    FIXME: perhaps it would be better to write a
00218                    function that duplicates a list. */
00219         args_to_send_when_finished = Find_Directories ((char *) NULL,
00220                                    W_LOCAL,
00221                                    (List *) NULL);
00222         }
00223 #endif
00224     }
00225     else
00226         addlist (&dirlist, ".");
00227
00228     goto do_the_work;
00229     }
00230
00231
00232     /*
00233      * There were arguments, so we have to handle them by hand. To do
00234      * that, we set up the filelist and dirlist with the arguments and
00235      * call do_recursion.  do_recursion recognizes the fact that the
00236      * lists are non-null when it starts and doesn't update them.
00237      *
00238      * explicitly named directories are stored in dirlist.
00239      * explicitly named files are stored in filelist.
00240      * other possibility is named entities whicha are not currently in
00241      * the working directory.
00242      */
00243
00244     for (i = 0; i < argc; i++)
00245     {
00246     /* if this argument is a directory, then add it to the list of
00247        directories. */
00248
00249     if (!wrap_name_has (argv[i], WRAP_TOCVS) && isdir (argv[i]))
00250         addlist (&dirlist, argv[i]);
00251     else
00252     {
00253         /* otherwise, split argument into directory and component names. */
00254         char *dir;
00255         char *comp;
00256         char *file_to_try;
00257
00258         /* Now break out argv[i] into directory part (DIR) and file part (COMP).
00259            DIR and COMP will each point to a newly malloc'd string.  */
00260         dir = xstrdup (argv[i]);
00261         comp = last_component (dir);
00262         if (comp == dir)
00263         {
00264         /* no dir component.  What we have is an implied "./" */
00265         dir = xstrdup(".");
00266         }
00267         else
00268         {
00269         char *p = comp;
00270
00271         p[-1] = '\0';
00272         comp = xstrdup (p);
00273         }
00274
00275         /* if this argument exists as a file in the current
00276            working directory tree, then add it to the files list.  */
00277
00278         if (!(which & W_LOCAL))
00279         {
00280         /* If doing rtag, we've done a chdir to the repository. */
00281         file_to_try = xmalloc (strlen (argv[i]) + sizeof (RCSEXT) + 5);
00282         sprintf (file_to_try, "%s%s", argv[i], RCSEXT);
00283         }
00284         else
00285         file_to_try = xstrdup (argv[i]);
00286
00287         if (isfile (file_to_try))
00288         addfile (&files_by_dir, dir, comp);
00289         else if (isdir (dir))
00290         {
00291         if ((which & W_LOCAL) && isdir (CVSADM)
00292 #ifdef CLIENT_SUPPORT
00293             && !client_active
00294 #endif
00295             )
00296         {
00297             /* otherwise, look for it in the repository. */
00298             char *tmp_update_dir;
00299             char *repos;
00300             char *reposfile;
00301
00302             tmp_update_dir = xmalloc (strlen (update_dir)
00303                           + strlen (dir)
00304                           + 5);
00305             strcpy (tmp_update_dir, update_dir);
00306
00307             if (*tmp_update_dir != '\0')
00308             (void) strcat (tmp_update_dir, "/");
00309
00310             (void) strcat (tmp_update_dir, dir);
00311
00312             /* look for it in the repository. */
00313             repos = Name_Repository (dir, tmp_update_dir);
00314             reposfile = xmalloc (strlen (repos)
00315                      + strlen (comp)
00316                      + 5);
00317             (void) sprintf (reposfile, "%s/%s", repos, comp);
00318             free (repos);
00319
00320             if (!wrap_name_has (comp, WRAP_TOCVS) && isdir (reposfile))
00321             addlist (&dirlist, argv[i]);
00322             else
00323             addfile (&files_by_dir, dir, comp);
00324
00325             free (tmp_update_dir);
00326             free (reposfile);
00327         }
00328         else
00329             addfile (&files_by_dir, dir, comp);
00330         }
00331         else
00332         error (1, 0, "no such directory `%s'", dir);
00333
00334         free (file_to_try);
00335         free (dir);
00336         free (comp);
00337     }
00338     }
00339
00340     /* At this point we have looped over all named arguments and built
00341        a coupla lists.  Now we unroll the lists, setting up and
00342        calling do_recursion. */
00343
00344     err += walklist (files_by_dir, unroll_files_proc, (void *) &frame);
00345     dellist(&files_by_dir);
00346
00347     /* then do_recursion on the dirlist. */
00348     if (dirlist != NULL)
00349     {
00350     do_the_work:
00351     err += do_recursion (&frame);
00352     }
00353
00354     /* Free the data which expand_wild allocated.  */
00355     free_names (&argc, argv);
00356
00357     free (update_dir);
00358     update_dir = NULL;
00359
00360 #ifdef CLIENT_SUPPORT
00361     if (args_to_send_when_finished != NULL)
00362     {
00363     /* FIXME (njc): in the multiroot case, we don't want to send
00364        argument commands for those top-level directories which do
00365        not contain any subdirectories which have files checked out
00366        from current_root.  If we do, and two repositories have a
00367        module with the same name, nasty things could happen.
00368
00369        This is hard.  Perhaps we should send the Argument commands
00370        later in this procedure, after we've had a chance to notice
00371        which directores we're using (after do_recursion has been
00372        called once).  This means a _lot_ of rewriting, however.
00373
00374        What we need to do for that to happen is descend the tree
00375        and construct a list of directories which are checked out
00376        from current_cvsroot.  Now, we eliminate from the list all
00377        of those directories which are immediate subdirectories of
00378        another directory in the list.  To say that the opposite
00379        way, we keep the directories which are not immediate
00380        subdirectories of any other in the list.  Here's a picture:
00381
00382                   a
00383                  / \
00384                 B   C
00385                / \
00386               D   e
00387                  / \
00388                 F   G
00389                    / \
00390                   H   I
00391
00392        The node in capitals are those directories which are
00393        checked out from current_cvsroot.  We want the list to
00394        contain B, C, F, and G.  D, H, and I are not included,
00395        because their parents are also checked out from
00396        current_cvsroot.
00397
00398        The algorithm should be:
00399
00400        1) construct a tree of all directory names where each
00401        element contains a directory name and a flag which notes if
00402        that directory is checked out from current_cvsroot
00403
00404                   a0
00405                  / \
00406                 B1  C1
00407                / \
00408               D1  e0
00409                  / \
00410                 F1  G1
00411                    / \
00412                   H1  I1
00413
00414        2) Recursively descend the tree.  For each node, recurse
00415        before processing the node.  If the flag is zero, do
00416        nothing.  If the flag is 1, check the node's parent.  If
00417        the parent's flag is one, change the current entry's flag
00418        to zero.
00419
00420                   a0
00421                  / \
00422                 B1  C1
00423                / \
00424               D0  e0
00425                  / \
00426                 F1  G1
00427                    / \
00428                   H0  I0
00429
00430        3) Walk the tree and spit out "Argument" commands to tell
00431        the server which directories to munge.
00432
00433        Yuck.  It's not clear this is worth spending time on, since
00434        we might want to disable cvs commands entirely from
00435        directories that do not have CVSADM files...
00436
00437        Anyways, the solution as it stands has modified server.c
00438        (dirswitch) to create admin files [via server.c
00439        (create_adm_p)] in all path elements for a client's
00440        "Directory xxx" command, which forces the server to descend
00441        and serve the files there.  client.c (send_file_names) has
00442        also been modified to send only those arguments which are
00443        appropriate to current_root.
00444
00445     */
00446
00447     /* Construct a fake argc/argv pair. */
00448
00449     int our_argc = 0, i;
00450     char **our_argv = NULL;
00451
00452     if (! list_isempty (args_to_send_when_finished))
00453     {
00454         Node *head, *p;
00455
00456         head = args_to_send_when_finished->list;
00457
00458         /* count the number of nodes */
00459         i = 0;
00460         for (p = head->next; p != head; p = p->next)
00461         i++;
00462         our_argc = i;
00463
00464         /* create the argument vector */
00465         our_argv = (char **) xmalloc (sizeof (char *) * our_argc);
00466
00467         /* populate it */
00468         i = 0;
00469         for (p = head->next; p != head; p = p->next)
00470         our_argv[i++] = xstrdup (p->key);
00471     }
00472
00473     /* We don't want to expand widcards, since we've just created
00474        a list of directories directly from the filesystem. */
00475     send_file_names (our_argc, our_argv, 0);
00476
00477     /* Free our argc/argv. */
00478     if (our_argv != NULL)
00479     {
00480         for (i = 0; i < our_argc; i++)
00481         free (our_argv[i]);
00482         free (our_argv);
00483     }
00484
00485     dellist (&args_to_send_when_finished);
00486     }
00487 #endif
00488
00489     return (err);
00490 }
00491
00492 /*
00493  * Implement the recursive policies on the local directory.  This may be
00494  * called directly, or may be called by start_recursion
00495  */
00496 static int
00497 do_recursion (frame)
00498     struct recursion_frame *frame;
00499 {
00500     int err = 0;
00501     int dodoneproc = 1;
00502     char *srepository;
00503     List *entries = NULL;
00504     int should_readlock;
00505     int process_this_directory = 1;
00506
00507     /* do nothing if told */
00508     if (frame->flags == R_SKIP_ALL)
00509     return (0);
00510
00511     should_readlock = noexec ? 0 : frame->readlock;
00512
00513     /* The fact that locks are not active here is what makes us fail to have
00514        the
00515
00516            If someone commits some changes in one cvs command,
00517        then an update by someone else will either get all the
00518        changes, or none of them.
00519
00520        property (see node Concurrency in cvs.texinfo).
00521
00522        The most straightforward fix would just to readlock the whole
00523        tree before starting an update, but that means that if a commit
00524        gets blocked on a big update, it might need to wait a *long*
00525        time.
00526
00527        A more adequate fix would be a two-pass design for update,
00528        checkout, etc.  The first pass would go through the repository,
00529        with the whole tree readlocked, noting what versions of each
00530        file we want to get.  The second pass would release all locks
00531        (except perhaps short-term locks on one file at a
00532        time--although I think RCS already deals with this) and
00533        actually get the files, specifying the particular versions it wants.
00534
00535        This could be sped up by separating out the data needed for the
00536        first pass into a separate file(s)--for example a file
00537        attribute for each file whose value contains the head revision
00538        for each branch.  The structure should be designed so that
00539        commit can relatively quickly update the information for a
00540        single file or a handful of files (file attributes, as
00541        implemented in Jan 96, are probably acceptable; improvements
00542        would be possible such as branch attributes which are in
00543        separate files for each branch).  */
00544
00545 #if defined(SERVER_SUPPORT) && defined(SERVER_FLOWCONTROL)
00546     /*
00547      * Now would be a good time to check to see if we need to stop
00548      * generating data, to give the buffers a chance to drain to the
00549      * remote client.  We should not have locks active at this point.
00550      */
00551     if (server_active
00552     /* If there are writelocks around, we cannot pause here.  */
00553     && (should_readlock || noexec))
00554     server_pause_check();
00555 #endif
00556
00557     /* Check the value in CVSADM_ROOT and see if it's in the list.  If
00558        not, add it to our lists of CVS/Root directories and do not
00559        process the files in this directory.  Otherwise, continue as
00560        usual.  THIS_ROOT might be NULL if we're doing an initial
00561        checkout -- check before using it.  The default should be that
00562        we process a directory's contents and only skip those contents
00563        if a CVS/Root file exists.
00564
00565        If we're running the server, we want to process all
00566        directories, since we're guaranteed to have only one CVSROOT --
00567        our own.  */
00568
00569     if (
00570     /* If -d was specified, it should override CVS/Root.
00571
00572        In the single-repository case, it is long-standing CVS behavior
00573        and makes sense - the user might want another access method,
00574        another server (which mounts the same repository), &c.
00575
00576        In the multiple-repository case, -d overrides all CVS/Root
00577        files.  That is the only plausible generalization I can
00578        think of.  */
00579     CVSroot_cmdline == NULL
00580
00581 #ifdef SERVER_SUPPORT
00582     && ! server_active
00583 #endif
00584     )
00585     {
00586     char *this_root = Name_Root ((char *) NULL, update_dir);
00587     if (this_root != NULL)
00588     {
00589         if (findnode (root_directories, this_root) == NULL)
00590         {
00591         /* Add it to our list. */
00592
00593         Node *n = getnode ();
00594         n->type = NT_UNKNOWN;
00595         n->key = xstrdup (this_root);
00596
00597         if (addnode (root_directories, n))
00598             error (1, 0, "cannot add new CVSROOT %s", this_root);
00599
00600         }
00601
00602         process_this_directory = (strcmp (current_root, this_root) == 0);
00603
00604         free (this_root);
00605     }
00606     }
00607
00608     /*
00609      * Fill in repository with the current repository
00610      */
00611     if (frame->which & W_LOCAL)
00612     {
00613     if (isdir (CVSADM))
00614         repository = Name_Repository ((char *) NULL, update_dir);
00615     else
00616         repository = NULL;
00617     }
00618     else
00619     {
00620     repository = xgetwd ();
00621     if (repository == NULL)
00622         error (1, errno, "could not get working directory");
00623     }
00624     srepository = repository;       /* remember what to free */
00625
00626     fileattr_startdir (repository);
00627
00628     /*
00629      * The filesdoneproc needs to be called for each directory where files
00630      * processed, or each directory that is processed by a call where no
00631      * directories were passed in.  In fact, the only time we don't want to
00632      * call back the filesdoneproc is when we are processing directories that
00633      * were passed in on the command line (or in the special case of `.' when
00634      * we were called with no args
00635      */
00636     if (dirlist != NULL && filelist == NULL)
00637     dodoneproc = 0;
00638
00639     /*
00640      * If filelist or dirlist is already set, we don't look again. Otherwise,
00641      * find the files and directories
00642      */
00643     if (filelist == NULL && dirlist == NULL)
00644     {
00645     /* both lists were NULL, so start from scratch */
00646     if (frame->fileproc != NULL && frame->flags != R_SKIP_FILES)
00647     {
00648         int lwhich = frame->which;
00649
00650         /* be sure to look in the attic if we have sticky tags/date */
00651         if ((lwhich & W_ATTIC) == 0)
00652         if (isreadable (CVSADM_TAG))
00653             lwhich |= W_ATTIC;
00654
00655         /* In the !(which & W_LOCAL) case, we filled in repository
00656            earlier in the function.  In the (which & W_LOCAL) case,
00657            the Find_Names function is going to look through the
00658            Entries file.  If we do not have a repository, that
00659            does not make sense, so we insist upon having a
00660            repository at this point.  Name_Repository will give a
00661            reasonable error message.  */
00662         if (repository == NULL)
00663         repository = Name_Repository ((char *) NULL, update_dir);
00664
00665         /* find the files and fill in entries if appropriate */
00666         if (process_this_directory)
00667         {
00668         filelist = Find_Names (repository, lwhich, frame->aflag,
00669                        &entries);
00670         if (filelist == NULL)
00671         {
00672             error (0, 0, "skipping directory %s", update_dir);
00673             /* Note that Find_Directories and the filesdoneproc
00674                in particular would do bad things ("? foo.c" in
00675                the case of some filesdoneproc's).  */
00676             goto skip_directory;
00677         }
00678         }
00679     }
00680
00681     /* find sub-directories if we will recurse */
00682     if (frame->flags != R_SKIP_DIRS)
00683         dirlist = Find_Directories (
00684         process_this_directory ? repository : NULL,
00685         frame->which, entries);
00686     }
00687     else
00688     {
00689     /* something was passed on the command line */
00690     if (filelist != NULL && frame->fileproc != NULL)
00691     {
00692         /* we will process files, so pre-parse entries */
00693         if (frame->which & W_LOCAL)
00694         entries = Entries_Open (frame->aflag, NULL);
00695     }
00696     }
00697
00698     /* process the files (if any) */
00699     if (process_this_directory && filelist != NULL && frame->fileproc)
00700     {
00701     struct file_info finfo_struct;
00702     struct frame_and_file frfile;
00703
00704     /* read lock it if necessary */
00705     if (should_readlock && repository && Reader_Lock (repository) != 0)
00706         error (1, 0, "read lock failed - giving up");
00707
00708 #ifdef CLIENT_SUPPORT
00709     /* For the server, we handle notifications in a completely different
00710        place (server_notify).  For local, we can't do them here--we don't
00711        have writelocks in place, and there is no way to get writelocks
00712        here.  */
00713     if (client_active)
00714         notify_check (repository, update_dir);
00715 #endif /* CLIENT_SUPPORT */
00716
00717     finfo_struct.repository = repository;
00718     finfo_struct.update_dir = update_dir;
00719     finfo_struct.entries = entries;
00720     /* do_file_proc will fill in finfo_struct.file.  */
00721
00722     frfile.finfo = &finfo_struct;
00723     frfile.frame = frame;
00724
00725     /* process the files */
00726     err += walklist (filelist, do_file_proc, &frfile);
00727
00728     /* unlock it */
00729     if (should_readlock)
00730         Lock_Cleanup ();
00731
00732     /* clean up */
00733     dellist (&filelist);
00734     }
00735
00736     /* call-back files done proc (if any) */
00737     if (process_this_directory && dodoneproc && frame->filesdoneproc != NULL)
00738     err = frame->filesdoneproc (frame->callerdat, err, repository,
00739                     update_dir[0] ? update_dir : ".",
00740                     entries);
00741
00742  skip_directory:
00743     fileattr_write ();
00744     fileattr_free ();
00745
00746     /* process the directories (if necessary) */
00747     if (dirlist != NULL)
00748     {
00749     struct frame_and_entries frent;
00750
00751     frent.frame = frame;
00752     frent.entries = entries;
00753     err += walklist (dirlist, do_dir_proc, (void *) &frent);
00754     }
00755 #if 0
00756     else if (frame->dirleaveproc != NULL)
00757     err += frame->dirleaveproc (frame->callerdat, ".", err, ".");
00758 #endif
00759     dellist (&dirlist);
00760
00761     if (entries)
00762     {
00763     Entries_Close (entries);
00764     entries = NULL;
00765     }
00766
00767     /* free the saved copy of the pointer if necessary */
00768     if (srepository)
00769     {
00770     free (srepository);
00771     repository = (char *) NULL;
00772     }
00773
00774     return (err);
00775 }
00776
00777 /*
00778  * Process each of the files in the list with the callback proc
00779  */
00780 static int
00781 do_file_proc (p, closure)
00782     Node *p;
00783     void *closure;
00784 {
00785     struct frame_and_file *frfile = (struct frame_and_file *)closure;
00786     struct file_info *finfo = frfile->finfo;
00787     int ret;
00788
00789     finfo->file = p->key;
00790     finfo->fullname = xmalloc (strlen (finfo->file)
00791                    + strlen (finfo->update_dir)
00792                    + 2);
00793     finfo->fullname[0] = '\0';
00794     if (finfo->update_dir[0] != '\0')
00795     {
00796     strcat (finfo->fullname, finfo->update_dir);
00797     strcat (finfo->fullname, "/");
00798     }
00799     strcat (finfo->fullname, finfo->file);
00800
00801     if (frfile->frame->dosrcs && repository)
00802     {
00803     finfo->rcs = RCS_parse (finfo->file, repository);
00804
00805     /* OK, without W_LOCAL the error handling becomes relatively
00806        simple.  The file names came from readdir() on the
00807        repository and so we know any ENOENT is an error
00808        (e.g. symlink pointing to nothing).  Now, the logic could
00809        be simpler - since we got the name from readdir, we could
00810        just be calling RCS_parsercsfile.  */
00811     if (finfo->rcs == NULL
00812         && !(frfile->frame->which & W_LOCAL))
00813     {
00814         error (0, 0, "could not read RCS file for %s", finfo->fullname);
00815         free (finfo->fullname);
00816         cvs_flushout ();
00817         return 0;
00818     }
00819     }
00820     else
00821         finfo->rcs = (RCSNode *) NULL;
00822     ret = frfile->frame->fileproc (frfile->frame->callerdat, finfo);
00823
00824     freercsnode(&finfo->rcs);
00825     free (finfo->fullname);
00826
00827     /* Allow the user to monitor progress with tail -f.  Doing this once
00828        per file should be no big deal, but we don't want the performance
00829        hit of flushing on every line like previous versions of CVS.  */
00830     cvs_flushout ();
00831
00832     return (ret);
00833 }
00834
00835 /*
00836  * Process each of the directories in the list (recursing as we go)
00837  */
00838 static int
00839 do_dir_proc (p, closure)
00840     Node *p;
00841     void *closure;
00842 {
00843     struct frame_and_entries *frent = (struct frame_and_entries *) closure;
00844     struct recursion_frame *frame = frent->frame;
00845     struct recursion_frame xframe;
00846     char *dir = p->key;
00847     char *newrepos;
00848     List *sdirlist;
00849     char *srepository;
00850     Dtype dir_return = R_PROCESS;
00851     int stripped_dot = 0;
00852     int err = 0;
00853     struct saved_cwd cwd;
00854     char *saved_update_dir;
00855     int process_this_directory = 1;
00856
00857     if (fncmp (dir, CVSADM) == 0)
00858     {
00859     /* This seems to most often happen when users (beginning users,
00860        generally), try "cvs ci *" or something similar.  On that
00861        theory, it is possible that we should just silently skip the
00862        CVSADM directories, but on the other hand, using a wildcard
00863        like this isn't necessarily a practice to encourage (it operates
00864        only on files which exist in the working directory, unlike
00865        regular CVS recursion).  */
00866
00867     /* FIXME-reentrancy: printed_cvs_msg should be in a "command
00868        struct" or some such, so that it gets cleared for each new
00869        command (this is possible using the remote protocol and a
00870        custom-written client).  The struct recursion_frame is not
00871        far back enough though, some commands (commit at least)
00872        will call start_recursion several times.  An alternate solution
00873        would be to take this whole check and move it to a new function
00874        validate_arguments or some such that all the commands call
00875        and which snips the offending directory from the argc,argv
00876        vector.  */
00877     static int printed_cvs_msg = 0;
00878     if (!printed_cvs_msg)
00879     {
00880         error (0, 0, "warning: directory %s specified in argument",
00881            dir);
00882         error (0, 0, "\
00883 but CVS uses %s for its own purposes; skipping %s directory",
00884            CVSADM, dir);
00885         printed_cvs_msg = 1;
00886     }
00887     return 0;
00888     }
00889
00890     saved_update_dir = update_dir;
00891     update_dir = xmalloc (strlen (saved_update_dir)
00892               + strlen (dir)
00893               + 5);
00894     strcpy (update_dir, saved_update_dir);
00895
00896     /* set up update_dir - skip dots if not at start */
00897     if (strcmp (dir, ".") != 0)
00898     {
00899     if (update_dir[0] != '\0')
00900     {
00901         (void) strcat (update_dir, "/");
00902         (void) strcat (update_dir, dir);
00903     }
00904     else
00905         (void) strcpy (update_dir, dir);
00906
00907     /*
00908      * Here we need a plausible repository name for the sub-directory. We
00909      * create one by concatenating the new directory name onto the
00910      * previous repository name.  The only case where the name should be
00911      * used is in the case where we are creating a new sub-directory for
00912      * update -d and in that case the generated name will be correct.
00913      */
00914     if (repository == NULL)
00915         newrepos = xstrdup ("");
00916     else
00917     {
00918         newrepos = xmalloc (strlen (repository) + strlen (dir) + 5);
00919         sprintf (newrepos, "%s/%s", repository, dir);
00920     }
00921     }
00922     else
00923     {
00924     if (update_dir[0] == '\0')
00925         (void) strcpy (update_dir, dir);
00926
00927     if (repository == NULL)
00928         newrepos = xstrdup ("");
00929     else
00930         newrepos = xstrdup (repository);
00931     }
00932
00933     /* Check to see that the CVSADM directory, if it exists, seems to be
00934        well-formed.  It can be missing files if the user hit ^C in the
00935        middle of a previous run.  We want to (a) make this a nonfatal
00936        error, and (b) make sure we print which directory has the
00937        problem.
00938
00939        Do this before the direntproc, so that (1) the direntproc
00940        doesn't have to guess/deduce whether we will skip the directory
00941        (e.g. send_dirent_proc and whether to send the directory), and
00942        (2) so that the warm fuzzy doesn't get printed if we skip the
00943        directory.  */
00944     if (frame->which & W_LOCAL)
00945     {
00946     char *cvsadmdir;
00947
00948     cvsadmdir = xmalloc (strlen (dir)
00949                  + sizeof (CVSADM_REP)
00950                  + sizeof (CVSADM_ENT)
00951                  + 80);
00952
00953     strcpy (cvsadmdir, dir);
00954     strcat (cvsadmdir, "/");
00955     strcat (cvsadmdir, CVSADM);
00956     if (isdir (cvsadmdir))
00957     {
00958         strcpy (cvsadmdir, dir);
00959         strcat (cvsadmdir, "/");
00960         strcat (cvsadmdir, CVSADM_REP);
00961         if (!isfile (cvsadmdir))
00962         {
00963         /* Some commands like update may have printed "? foo" but
00964            if we were planning to recurse, and don't on account of
00965            CVS/Repository, we want to say why.  */
00966         error (0, 0, "ignoring %s (%s missing)", update_dir,
00967                CVSADM_REP);
00968         dir_return = R_SKIP_ALL;
00969         }
00970
00971         /* Likewise for CVS/Entries.  */
00972         if (dir_return != R_SKIP_ALL)
00973         {
00974         strcpy (cvsadmdir, dir);
00975         strcat (cvsadmdir, "/");
00976         strcat (cvsadmdir, CVSADM_ENT);
00977         if (!isfile (cvsadmdir))
00978         {
00979             /* Some commands like update may have printed "? foo" but
00980                if we were planning to recurse, and don't on account of
00981                CVS/Repository, we want to say why.  */
00982             error (0, 0, "ignoring %s (%s missing)", update_dir,
00983                CVSADM_ENT);
00984             dir_return = R_SKIP_ALL;
00985         }
00986         }
00987     }
00988     free (cvsadmdir);
00989     }
00990
00991     /* Only process this directory if the root matches.  This nearly
00992        duplicates code in do_recursion. */
00993
00994     if (
00995     /* If -d was specified, it should override CVS/Root.
00996
00997        In the single-repository case, it is long-standing CVS behavior
00998        and makes sense - the user might want another access method,
00999        another server (which mounts the same repository), &c.
01000
01001        In the multiple-repository case, -d overrides all CVS/Root
01002        files.  That is the only plausible generalization I can
01003        think of.  */
01004     CVSroot_cmdline == NULL
01005
01006 #ifdef SERVER_SUPPORT
01007     && ! server_active
01008 #endif
01009     )
01010     {
01011     char *this_root = Name_Root (dir, update_dir);
01012     if (this_root != NULL)
01013     {
01014         if (findnode (root_directories, this_root) == NULL)
01015         {
01016         /* Add it to our list. */
01017
01018         Node *n = getnode ();
01019         n->type = NT_UNKNOWN;
01020         n->key = xstrdup (this_root);
01021
01022         if (addnode (root_directories, n))
01023             error (1, 0, "cannot add new CVSROOT %s", this_root);
01024
01025         }
01026
01027         process_this_directory = (strcmp (current_root, this_root) == 0);
01028         free (this_root);
01029     }
01030     }
01031
01032     /* call-back dir entry proc (if any) */
01033     if (dir_return == R_SKIP_ALL)
01034     ;
01035     else if (frame->direntproc != NULL)
01036     {
01037     /* If we're doing the actual processing, call direntproc.
01038            Otherwise, assume that we need to process this directory
01039            and recurse. FIXME. */
01040
01041     if (process_this_directory)
01042         dir_return = frame->direntproc (frame->callerdat, dir, newrepos,
01043                         update_dir, frent->entries);
01044     else
01045         dir_return = R_PROCESS;
01046     }
01047     else
01048     {
01049     /* Generic behavior.  I don't see a reason to make the caller specify
01050        a direntproc just to get this.  */
01051     if ((frame->which & W_LOCAL) && !isdir (dir))
01052         dir_return = R_SKIP_ALL;
01053     }
01054
01055     free (newrepos);
01056
01057     /* only process the dir if the return code was 0 */
01058     if (dir_return != R_SKIP_ALL)
01059     {
01060     /* save our current directory and static vars */
01061         if (save_cwd (&cwd))
01062         error_exit ();
01063     sdirlist = dirlist;
01064     srepository = repository;
01065     dirlist = NULL;
01066
01067     /* cd to the sub-directory */
01068     if ( CVS_CHDIR (dir) < 0)
01069         error (1, errno, "could not chdir to %s", dir);
01070
01071     /* honor the global SKIP_DIRS (a.k.a. local) */
01072     if (frame->flags == R_SKIP_DIRS)
01073         dir_return = R_SKIP_DIRS;
01074
01075     /* remember if the `.' will be stripped for subsequent dirs */
01076     if (strcmp (update_dir, ".") == 0)
01077     {
01078         update_dir[0] = '\0';
01079         stripped_dot = 1;
01080     }
01081
01082     /* make the recursive call */
01083     xframe = *frame;
01084     xframe.flags = dir_return;
01085     err += do_recursion (&xframe);
01086
01087     /* put the `.' back if necessary */
01088     if (stripped_dot)
01089         (void) strcpy (update_dir, ".");
01090
01091     /* call-back dir leave proc (if any) */
01092     if (process_this_directory && frame->dirleaveproc != NULL)
01093         err = frame->dirleaveproc (frame->callerdat, dir, err, update_dir,
01094                        frent->entries);
01095
01096     /* get back to where we started and restore state vars */
01097     if (restore_cwd (&cwd, NULL))
01098         error_exit ();
01099     free_cwd (&cwd);
01100     dirlist = sdirlist;
01101     repository = srepository;
01102     }
01103
01104     free (update_dir);
01105     update_dir = saved_update_dir;
01106
01107     return (err);
01108 }
01109
01110 /*
01111  * Add a node to a list allocating the list if necessary.
01112  */
01113 static void
01114 addlist (listp, key)
01115     List **listp;
01116     char *key;
01117 {
01118     Node *p;
01119
01120     if (*listp == NULL)
01121     *listp = getlist ();
01122     p = getnode ();
01123     p->type = FILES;
01124     p->key = xstrdup (key);
01125     if (addnode (*listp, p) != 0)
01126     freenode (p);
01127 }
01128
01129 static void
01130 addfile (listp, dir, file)
01131     List **listp;
01132     char *dir;
01133     char *file;
01134 {
01135     Node *n;
01136     List *fl;
01137
01138     /* add this dir. */
01139     addlist (listp, dir);
01140
01141     n = findnode (*listp, dir);
01142     if (n == NULL)
01143     {
01144     error (1, 0, "can't find recently added dir node `%s' in start_recursion.",
01145            dir);
01146     }
01147
01148     n->type = DIRS;
01149     fl = (List *) n->data;
01150     addlist (&fl, file);
01151     n->data = (char *) fl;
01152     return;
01153 }
01154
01155 static int
01156 unroll_files_proc (p, closure)
01157     Node *p;
01158     void *closure;
01159 {
01160     Node *n;
01161     struct recursion_frame *frame = (struct recursion_frame *) closure;
01162     int err = 0;
01163     List *save_dirlist;
01164     char *save_update_dir = NULL;
01165     struct saved_cwd cwd;
01166
01167     /* if this dir was also an explicitly named argument, then skip
01168        it.  We'll catch it later when we do dirs. */
01169     n = findnode (dirlist, p->key);
01170     if (n != NULL)
01171     return (0);
01172
01173     /* otherwise, call dorecusion for this list of files. */
01174     filelist = (List *) p->data;
01175     p->data = NULL;
01176     save_dirlist = dirlist;
01177     dirlist = NULL;
01178
01179     if (strcmp(p->key, ".") != 0)
01180     {
01181         if (save_cwd (&cwd))
01182         error_exit ();
01183     if ( CVS_CHDIR (p->key) < 0)
01184         error (1, errno, "could not chdir to %s", p->key);
01185
01186     save_update_dir = update_dir;
01187     update_dir = xmalloc (strlen (save_update_dir)
01188                   + strlen (p->key)
01189                   + 5);
01190     strcpy (update_dir, save_update_dir);
01191
01192     if (*update_dir != '\0')
01193         (void) strcat (update_dir, "/");
01194
01195     (void) strcat (update_dir, p->key);
01196     }
01197
01198     err += do_recursion (frame);
01199
01200     if (save_update_dir != NULL)
01201     {
01202     free (update_dir);
01203     update_dir = save_update_dir;
01204
01205     if (restore_cwd (&cwd, NULL))
01206         error_exit ();
01207     free_cwd (&cwd);
01208     }
01209
01210     dirlist = save_dirlist;
01211     if (filelist)
01212     dellist (&filelist);
01213     return(err);
01214 }
Generated on Sun Oct 21 12:41:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/release.c Source File

cvs-1.10/src/release.c

Go to the documentation of this file.
00001 /*
00002  * Release: "cancel" a checkout in the history log.
00003  *
00004  * - Enter a line in the history log indicating the "release". - If asked to,
00005  * delete the local working directory.
00006  */
00007
00008 #include "cvs.h"
00009 #include "savecwd.h"
00010 #include "getline.h"
00011
00012 static const char *const release_usage[] =
00013 {
00014     "Usage: %s %s [-d] directories...\n",
00015     "\t-d\tDelete the given directory.\n",
00016     "(Specify the --help global option for a list of other help options)\n",
00017     NULL
00018 };
00019
00020 #ifdef SERVER_SUPPORT
00021 static int release_server PROTO ((int argc, char **argv));
00022
00023 /* This is the server side of cvs release.  */
00024 static int
00025 release_server (argc, argv)
00026     int argc;
00027     char **argv;
00028 {
00029     int i;
00030
00031     /* Note that we skip argv[0].  */
00032     for (i = 1; i < argc; ++i)
00033     history_write ('F', argv[i], "", argv[i], "");
00034     return 0;
00035 }
00036
00037 #endif /* SERVER_SUPPORT */
00038
00039 /* There are various things to improve about this implementation:
00040
00041    1.  Using run_popen to run "cvs update" could be replaced by a
00042    fairly simple start_recursion/classify_file loop--a win for
00043    portability, performance, and cleanliness.  In particular, there is
00044    no particularly good way to find the right "cvs".
00045
00046    2.  The fact that "cvs update" contacts the server slows things down;
00047    it undermines the case for using "cvs release" rather than "rm -rf".
00048    However, for correctly printing "? foo" and correctly handling
00049    CVSROOTADM_IGNORE, we currently need to contact the server.  (One
00050    idea for how to fix this is to stash a copy of CVSROOTADM_IGNORE in
00051    the working directories; see comment at base_* in entries.c for a
00052    few thoughts on that).
00053
00054    3.  Would be nice to take processing things on the client side one step
00055    further, and making it like edit/unedit in terms of working well if
00056    disconnected from the network, and then sending a delayed
00057    notification.
00058
00059    4.  Having separate network turnarounds for the "Notify" request
00060    which we do as part of unedit, and for the "release" itself, is slow
00061    and unnecessary.  */
00062
00063 int
00064 release (argc, argv)
00065     int argc;
00066     char **argv;
00067 {
00068     FILE *fp;
00069     int i, c;
00070     char *repository;
00071     char *line = NULL;
00072     size_t line_allocated = 0;
00073     char *update_cmd;
00074     char *thisarg;
00075     int arg_start_idx;
00076     int err = 0;
00077     short delete_flag = 0;
00078     struct saved_cwd cwd;
00079
00080 #ifdef SERVER_SUPPORT
00081     if (server_active)
00082     return release_server (argc, argv);
00083 #endif
00084
00085     /* Everything from here on is client or local.  */
00086     if (argc == -1)
00087     usage (release_usage);
00088     optind = 0;
00089     while ((c = getopt (argc, argv, "+Qdq")) != -1)
00090     {
00091     switch (c)
00092     {
00093         case 'Q':
00094         case 'q':
00095         error (1, 0,
00096                "-q or -Q must be specified before \"%s\"",
00097                command_name);
00098         break;
00099         case 'd':
00100         delete_flag++;
00101         break;
00102         case '?':
00103         default:
00104         usage (release_usage);
00105         break;
00106     }
00107     }
00108     argc -= optind;
00109     argv += optind;
00110
00111     /* We're going to run "cvs -n -q update" and check its output; if
00112      * the output is sufficiently unalarming, then we release with no
00113      * questions asked.  Else we prompt, then maybe release.
00114      * (Well, actually we ask no matter what.  Our notion of "sufficiently
00115      * unalarming" doesn't take into account "? foo.c" files, so it is
00116      * up to the user to take note of them, at least currently
00117      * (ignore-193 in testsuite)).
00118      */
00119     /* Construct the update command. */
00120     update_cmd = xmalloc (strlen (program_path)
00121               + strlen (CVSroot_original)
00122               + 20);
00123     sprintf (update_cmd, "%s -n -q -d %s update",
00124              program_path, CVSroot_original);
00125
00126 #ifdef CLIENT_SUPPORT
00127     /* Start the server; we'll close it after looping. */
00128     if (client_active)
00129     {
00130     start_server ();
00131     ign_setup ();
00132     }
00133 #endif /* CLIENT_SUPPORT */
00134
00135     /* Remember the directory where "cvs release" was invoked because
00136        all args are relative to this directory and we chdir around.
00137        */
00138     if (save_cwd (&cwd))
00139         error_exit ();
00140
00141     arg_start_idx = 0;
00142
00143     for (i = arg_start_idx; i < argc; i++)
00144     {
00145     thisarg = argv[i];
00146
00147         if (isdir (thisarg))
00148         {
00149         if (CVS_CHDIR (thisarg) < 0)
00150         {
00151         if (!really_quiet)
00152             error (0, errno, "can't chdir to: %s", thisarg);
00153         continue;
00154         }
00155         if (!isdir (CVSADM))
00156         {
00157         if (!really_quiet)
00158             error (0, 0, "no repository directory: %s", thisarg);
00159         if (restore_cwd (&cwd, NULL))
00160             error_exit ();
00161         continue;
00162         }
00163     }
00164     else
00165         {
00166         if (!really_quiet)
00167         error (0, 0, "no such directory: %s", thisarg);
00168         continue;
00169     }
00170
00171     repository = Name_Repository ((char *) NULL, (char *) NULL);
00172
00173     if (!really_quiet)
00174     {
00175         int line_length;
00176
00177         /* The "release" command piggybacks on "update", which
00178            does the real work of finding out if anything is not
00179            up-to-date with the repository.  Then "release" prompts
00180            the user, telling her how many files have been
00181            modified, and asking if she still wants to do the
00182            release.  */
00183         fp = run_popen (update_cmd, "r");
00184         if (fp == NULL)
00185         error (1, 0, "cannot run command %s", update_cmd);
00186
00187         c = 0;
00188
00189         while ((line_length = getline (&line, &line_allocated, fp)) >= 0)
00190         {
00191         if (strchr ("MARCZ", *line))
00192             c++;
00193         (void) fputs (line, stdout);
00194         }
00195         if (line_length < 0 && !feof (fp))
00196         error (0, errno, "cannot read from subprocess");
00197
00198         /* If the update exited with an error, then we just want to
00199            complain and go on to the next arg.  Especially, we do
00200            not want to delete the local copy, since it's obviously
00201            not what the user thinks it is.  */
00202         if ((run_pclose (fp)) != 0)
00203         {
00204         error (0, 0, "unable to release `%s'", thisarg);
00205         free (repository);
00206         if (restore_cwd (&cwd, NULL))
00207             error_exit ();
00208         continue;
00209         }
00210
00211         printf ("You have [%d] altered files in this repository.\n",
00212             c);
00213         printf ("Are you sure you want to release %sdirectory `%s': ",
00214             delete_flag ? "(and delete) " : "", thisarg);
00215         c = !yesno ();
00216         if (c)          /* "No" */
00217         {
00218         (void) fprintf (stderr, "** `%s' aborted by user choice.\n",
00219                 command_name);
00220         free (repository);
00221         if (restore_cwd (&cwd, NULL))
00222             error_exit ();
00223         continue;
00224         }
00225     }
00226
00227     if (1
00228 #ifdef CLIENT_SUPPORT
00229         && !(client_active
00230          && (!supported_request ("noop")
00231              || !supported_request ("Notify")))
00232 #endif
00233         )
00234     {
00235         /* We are chdir'ed into the directory in question.
00236            So don't pass args to unedit.  */
00237         int argc = 1;
00238         char *argv[3];
00239         argv[0] = "dummy";
00240         argv[1] = NULL;
00241         err += unedit (argc, argv);
00242     }
00243
00244 #ifdef CLIENT_SUPPORT
00245         if (client_active)
00246         {
00247         send_to_server ("Argument ", 0);
00248         send_to_server (thisarg, 0);
00249         send_to_server ("\012", 1);
00250         send_to_server ("release\012", 0);
00251     }
00252         else
00253 #endif /* CLIENT_SUPPORT */
00254         {
00255         history_write ('F', thisarg, "", thisarg, ""); /* F == Free */
00256         }
00257
00258         free (repository);
00259
00260     if (restore_cwd (&cwd, NULL))
00261         error_exit ();
00262
00263     if (delete_flag)
00264     {
00265         /* FIXME?  Shouldn't this just delete the CVS-controlled
00266            files and, perhaps, the files that would normally be
00267            ignored and leave everything else?  */
00268
00269         if (unlink_file_dir (thisarg) < 0)
00270         error (0, errno, "deletion of directory %s failed", thisarg);
00271     }
00272
00273 #ifdef CLIENT_SUPPORT
00274         if (client_active)
00275         err += get_server_responses ();
00276 #endif /* CLIENT_SUPPORT */
00277     }
00278
00279     if (restore_cwd (&cwd, NULL))
00280     error_exit ();
00281     free_cwd (&cwd);
00282
00283 #ifdef CLIENT_SUPPORT
00284     if (client_active)
00285     {
00286     /* Unfortunately, client.c doesn't offer a way to close
00287        the connection without waiting for responses.  The extra
00288        network turnaround here is quite unnecessary other than
00289        that....  */
00290     send_to_server ("noop\012", 0);
00291     err += get_responses_and_close ();
00292     }
00293 #endif /* CLIENT_SUPPORT */
00294
00295     free (update_cmd);
00296     if (line != NULL)
00297     free (line);
00298     return err;
00299 }
Generated on Sun Oct 21 12:41:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/remove.c Source File

cvs-1.10/src/remove.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Remove a File
00009  *
00010  * Removes entries from the present version. The entries will be removed from
00011  * the RCS repository upon the next "commit".
00012  *
00013  * "remove" accepts no options, only file names that are to be removed.  The
00014  * file must not exist in the current directory for "remove" to work
00015  * correctly.
00016  */
00017
00018 #include "cvs.h"
00019
00020 #ifdef CLIENT_SUPPORT
00021 static int remove_force_fileproc PROTO ((void *callerdat,
00022                      struct file_info *finfo));
00023 #endif
00024 static int remove_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00025 static Dtype remove_dirproc PROTO ((void *callerdat, char *dir,
00026                     char *repos, char *update_dir,
00027                     List *entries));
00028
00029 static int force;
00030 static int local;
00031 static int removed_files;
00032 static int existing_files;
00033
00034 static const char *const remove_usage[] =
00035 {
00036     "Usage: %s %s [-flR] [files...]\n",
00037     "\t-f\tDelete the file before removing it.\n",
00038     "\t-l\tProcess this directory only (not recursive).\n",
00039     "\t-R\tProcess directories recursively.\n",
00040     "(Specify the --help global option for a list of other help options)\n",
00041     NULL
00042 };
00043
00044 int
00045 cvsremove (argc, argv)
00046     int argc;
00047     char **argv;
00048 {
00049     int c, err;
00050
00051     if (argc == -1)
00052     usage (remove_usage);
00053
00054     optind = 0;
00055     while ((c = getopt (argc, argv, "+flR")) != -1)
00056     {
00057     switch (c)
00058     {
00059         case 'f':
00060         force = 1;
00061         break;
00062         case 'l':
00063         local = 1;
00064         break;
00065         case 'R':
00066         local = 0;
00067         break;
00068         case '?':
00069         default:
00070         usage (remove_usage);
00071         break;
00072     }
00073     }
00074     argc -= optind;
00075     argv += optind;
00076
00077     wrap_setup ();
00078
00079 #ifdef CLIENT_SUPPORT
00080     if (client_active) {
00081     /* Call expand_wild so that the local removal of files will
00082            work.  It's ok to do it always because we have to send the
00083            file names expanded anyway.  */
00084     expand_wild (argc, argv, &argc, &argv);
00085
00086     if (force)
00087     {
00088         if (!noexec)
00089         {
00090         start_recursion (remove_force_fileproc, (FILESDONEPROC) NULL,
00091                  (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL,
00092                  (void *) NULL, argc, argv, local, W_LOCAL,
00093                  0, 0, (char *) NULL, 0);
00094         }
00095         /* else FIXME should probably act as if the file doesn't exist
00096            in doing the following checks.  */
00097     }
00098
00099     start_server ();
00100     ign_setup ();
00101     if (local)
00102         send_arg("-l");
00103     /* FIXME: Can't we set SEND_NO_CONTENTS here?  Needs investigation.  */
00104     send_files (argc, argv, local, 0, 0);
00105     send_file_names (argc, argv, 0);
00106     free_names (&argc, argv);
00107     send_to_server ("remove\012", 0);
00108         return get_responses_and_close ();
00109     }
00110 #endif
00111
00112     /* start the recursion processor */
00113     err = start_recursion (remove_fileproc, (FILESDONEPROC) NULL,
00114                            remove_dirproc, (DIRLEAVEPROC) NULL, NULL,
00115                argc, argv,
00116                            local, W_LOCAL, 0, 1, (char *) NULL, 1);
00117
00118     if (removed_files)
00119     error (0, 0, "use '%s commit' to remove %s permanently", program_name,
00120            (removed_files == 1) ? "this file" : "these files");
00121
00122     if (existing_files)
00123     error (0, 0,
00124            ((existing_files == 1) ?
00125         "%d file exists; remove it first" :
00126         "%d files exist; remove them first"),
00127            existing_files);
00128
00129     return (err);
00130 }
00131
00132 #ifdef CLIENT_SUPPORT
00133
00134 /*
00135  * This is called via start_recursion if we are running as the client
00136  * and the -f option was used.  We just physically remove the file.
00137  */
00138
00139 /*ARGSUSED*/
00140 static int
00141 remove_force_fileproc (callerdat, finfo)
00142      void *callerdat;
00143      struct file_info *finfo;
00144 {
00145     if (CVS_UNLINK (finfo->file) < 0 && ! existence_error (errno))
00146     error (0, errno, "unable to remove %s", finfo->fullname);
00147     return 0;
00148 }
00149
00150 #endif
00151
00152 /*
00153  * remove the file, only if it has already been physically removed
00154  */
00155 /* ARGSUSED */
00156 static int
00157 remove_fileproc (callerdat, finfo)
00158     void *callerdat;
00159     struct file_info *finfo;
00160 {
00161     Vers_TS *vers;
00162
00163     if (force)
00164     {
00165     if (!noexec)
00166     {
00167         if ( CVS_UNLINK (finfo->file) < 0 && ! existence_error (errno))
00168         {
00169         error (0, errno, "unable to remove %s", finfo->fullname);
00170         }
00171     }
00172     /* else FIXME should probably act as if the file doesn't exist
00173        in doing the following checks.  */
00174     }
00175
00176     vers = Version_TS (finfo, NULL, NULL, NULL, 0, 0);
00177
00178     if (vers->ts_user != NULL)
00179     {
00180     existing_files++;
00181     if (!quiet)
00182         error (0, 0, "file `%s' still in working directory",
00183            finfo->fullname);
00184     }
00185     else if (vers->vn_user == NULL)
00186     {
00187     if (!quiet)
00188         error (0, 0, "nothing known about `%s'", finfo->fullname);
00189     }
00190     else if (vers->vn_user[0] == '0' && vers->vn_user[1] == '\0')
00191     {
00192     char *fname;
00193
00194     /*
00195      * It's a file that has been added, but not commited yet. So,
00196      * remove the ,t file for it and scratch it from the
00197      * entries file.  */
00198     Scratch_Entry (finfo->entries, finfo->file);
00199     fname = xmalloc (strlen (finfo->file)
00200              + sizeof (CVSADM)
00201              + sizeof (CVSEXT_LOG)
00202              + 10);
00203     (void) sprintf (fname, "%s/%s%s", CVSADM, finfo->file, CVSEXT_LOG);
00204     if (unlink_file (fname) < 0
00205         && !existence_error (errno))
00206         error (0, errno, "cannot remove %s", CVSEXT_LOG);
00207     if (!quiet)
00208         error (0, 0, "removed `%s'", finfo->fullname);
00209
00210 #ifdef SERVER_SUPPORT
00211     if (server_active)
00212         server_checked_in (finfo->file, finfo->update_dir, finfo->repository);
00213 #endif
00214     free (fname);
00215     }
00216     else if (vers->vn_user[0] == '-')
00217     {
00218     if (!quiet)
00219         error (0, 0, "file `%s' already scheduled for removal",
00220            finfo->fullname);
00221     }
00222     else if (vers->tag != NULL && isdigit ((unsigned char) *vers->tag))
00223     {
00224     /* Commit will just give an error, and so there seems to be
00225        little reason to allow the remove.  I mean, conflicts that
00226        arise out of parallel development are one thing, but conflicts
00227        that arise from sticky tags are quite another.
00228
00229        I would have thought that non-branch sticky tags should be the
00230        same but at least now, removing a file with a non-branch sticky
00231        tag means to delete the tag from the file.  I'm not sure that
00232        is a good behavior, but until it is changed, we need to allow
00233        it.  */
00234     error (0, 0, "\
00235 cannot remove file `%s' which has a numeric sticky tag of `%s'",
00236            finfo->fullname, vers->tag);
00237     }
00238     else
00239     {
00240     char *fname;
00241
00242     /* Re-register it with a negative version number.  */
00243     fname = xmalloc (strlen (vers->vn_user) + 5);
00244     (void) strcpy (fname, "-");
00245     (void) strcat (fname, vers->vn_user);
00246     Register (finfo->entries, finfo->file, fname, vers->ts_rcs, vers->options,
00247           vers->tag, vers->date, vers->ts_conflict);
00248     if (!quiet)
00249         error (0, 0, "scheduling `%s' for removal", finfo->fullname);
00250     removed_files++;
00251
00252 #ifdef SERVER_SUPPORT
00253     if (server_active)
00254         server_checked_in (finfo->file, finfo->update_dir, finfo->repository);
00255 #endif
00256     free (fname);
00257     }
00258
00259     freevers_ts (&vers);
00260     return (0);
00261 }
00262
00263 /*
00264  * Print a warm fuzzy message
00265  */
00266 /* ARGSUSED */
00267 static Dtype
00268 remove_dirproc (callerdat, dir, repos, update_dir, entries)
00269     void *callerdat;
00270     char *dir;
00271     char *repos;
00272     char *update_dir;
00273     List *entries;
00274 {
00275     if (!quiet)
00276     error (0, 0, "Removing %s", update_dir);
00277     return (R_PROCESS);
00278 }
Generated on Sun Oct 21 12:41:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/repos.c Source File

cvs-1.10/src/repos.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  */
00008
00009 #include <assert.h>
00010 #include "cvs.h"
00011 #include "getline.h"
00012
00013 /* Determine the name of the RCS repository for directory DIR in the
00014    current working directory, or for the current working directory
00015    itself if DIR is NULL.  Returns the name in a newly-malloc'd
00016    string.  On error, gives a fatal error and does not return.
00017    UPDATE_DIR is the path from where cvs was invoked (for use in error
00018    messages), and should contain DIR as its last component.
00019    UPDATE_DIR can be NULL to signify the directory in which cvs was
00020    invoked.  */
00021
00022 char *
00023 Name_Repository (dir, update_dir)
00024     char *dir;
00025     char *update_dir;
00026 {
00027     FILE *fpin;
00028     char *xupdate_dir;
00029     char *repos = NULL;
00030     size_t repos_allocated = 0;
00031     char *tmp;
00032     char *cp;
00033
00034     if (update_dir && *update_dir)
00035     xupdate_dir = update_dir;
00036     else
00037     xupdate_dir = ".";
00038
00039     if (dir != NULL)
00040     {
00041     tmp = xmalloc (strlen (dir) + sizeof (CVSADM_REP) + 10);
00042     (void) sprintf (tmp, "%s/%s", dir, CVSADM_REP);
00043     }
00044     else
00045     tmp = xstrdup (CVSADM_REP);
00046
00047     /*
00048      * The assumption here is that the repository is always contained in the
00049      * first line of the "Repository" file.
00050      */
00051     fpin = CVS_FOPEN (tmp, "r");
00052
00053     if (fpin == NULL)
00054     {
00055     int save_errno = errno;
00056     char *cvsadm;
00057
00058     if (dir != NULL)
00059     {
00060         cvsadm = xmalloc (strlen (dir) + sizeof (CVSADM) + 10);
00061         (void) sprintf (cvsadm, "%s/%s", dir, CVSADM);
00062     }
00063     else
00064         cvsadm = xstrdup (CVSADM);
00065
00066     if (!isdir (cvsadm))
00067     {
00068         error (0, 0, "in directory %s:", xupdate_dir);
00069         error (1, 0, "there is no version here; do '%s checkout' first",
00070            program_name);
00071     }
00072     free (cvsadm);
00073
00074     if (existence_error (save_errno))
00075     {
00076         /* FIXME: This is a very poorly worded error message.  It
00077            occurs at least in the case where the user manually
00078            creates a directory named CVS, so the error message
00079            should be more along the lines of "CVS directory found
00080            without administrative files; use CVS to create the CVS
00081            directory, or rename it to something else if the
00082            intention is to store something besides CVS
00083            administrative files".  */
00084         error (0, 0, "in directory %s:", xupdate_dir);
00085         error (1, 0, "*PANIC* administration files missing");
00086     }
00087
00088     error (1, save_errno, "cannot open %s", tmp);
00089     }
00090
00091     if (getline (&repos, &repos_allocated, fpin) < 0)
00092     {
00093     /* FIXME: should be checking for end of file separately.  */
00094     error (0, 0, "in directory %s:", xupdate_dir);
00095     error (1, errno, "cannot read %s", CVSADM_REP);
00096     }
00097     if (fclose (fpin) < 0)
00098     error (0, errno, "cannot close %s", tmp);
00099     free (tmp);
00100
00101     if ((cp = strrchr (repos, '\n')) != NULL)
00102     *cp = '\0';         /* strip the newline */
00103
00104     /*
00105      * If this is a relative repository pathname, turn it into an absolute
00106      * one by tacking on the CVSROOT environment variable. If the CVSROOT
00107      * environment variable is not set, die now.
00108      */
00109     if (! isabsolute(repos))
00110     {
00111     char *newrepos;
00112
00113     if (CVSroot_original == NULL)
00114     {
00115         error (0, 0, "in directory %s:", xupdate_dir);
00116         error (0, 0, "must set the CVSROOT environment variable\n");
00117         error (0, 0, "or specify the '-d' option to %s.", program_name);
00118         error (1, 0, "illegal repository setting");
00119     }
00120     if (pathname_levels (repos) > 0)
00121     {
00122         error (0, 0, "in directory %s:", xupdate_dir);
00123         error (0, 0, "`..'-relative repositories are not supported.");
00124         error (1, 0, "illegal source repository");
00125     }
00126     newrepos = xmalloc (strlen (CVSroot_directory) + strlen (repos) + 10);
00127     (void) sprintf (newrepos, "%s/%s", CVSroot_directory, repos);
00128     free (repos);
00129     repos = newrepos;
00130     }
00131
00132     Sanitize_Repository_Name (repos);
00133
00134     return repos;
00135 }
00136
00137 /*
00138  * Return a pointer to the repository name relative to CVSROOT from a
00139  * possibly fully qualified repository
00140  */
00141 char *
00142 Short_Repository (repository)
00143     char *repository;
00144 {
00145     if (repository == NULL)
00146     return (NULL);
00147
00148     /* If repository matches CVSroot at the beginning, strip off CVSroot */
00149     /* And skip leading '/' in rep, in case CVSroot ended with '/'. */
00150     if (strncmp (CVSroot_directory, repository,
00151          strlen (CVSroot_directory)) == 0)
00152     {
00153     char *rep = repository + strlen (CVSroot_directory);
00154     return (*rep == '/') ? rep+1 : rep;
00155     }
00156     else
00157     return (repository);
00158 }
00159
00160 /* Sanitize the repository name (in place) by removing trailing
00161  * slashes and a trailing "." if present.  It should be safe for
00162  * callers to use strcat and friends to create repository names.
00163  * Without this check, names like "/path/to/repos/./foo" and
00164  * "/path/to/repos//foo" would be created.  For example, one
00165  * significant case is the CVSROOT-detection code in commit.c.  It
00166  * decides whether or not it needs to rebuild the administrative file
00167  * database by doing a string compare.  If we've done a `cvs co .' to
00168  * get the CVSROOT files, "/path/to/repos/./CVSROOT" and
00169  * "/path/to/repos/CVSROOT" are the arguments that are compared!
00170  *
00171  * This function ends up being called from the same places as
00172  * strip_path, though what it does is much more conservative.  Many
00173  * comments about this operation (which was scattered around in
00174  * several places in the source code) ran thus:
00175  *
00176  *    ``repository ends with "/."; omit it.  This sort of thing used
00177  *    to be taken care of by strip_path.  Now we try to be more
00178  *    selective.  I suspect that it would be even better to push it
00179  *    back further someday, so that the trailing "/." doesn't get into
00180  *    repository in the first place, but we haven't taken things that
00181  *    far yet.''        --Jim Kingdon (recurse.c, 07-Sep-97)
00182  *
00183  * Ahh, all too true.  The major consideration is RELATIVE_REPOS.  If
00184  * the "/." doesn't end up in the repository while RELATIVE_REPOS is
00185  * defined, there will be nothing in the CVS/Repository file.  I
00186  * haven't verified that the remote protocol will handle that
00187  * correctly yet, so I've not made that change. */
00188
00189 void
00190 Sanitize_Repository_Name (repository)
00191     char *repository;
00192 {
00193     size_t len;
00194
00195     assert (repository != NULL);
00196
00197     strip_trailing_slashes (repository);
00198
00199     len = strlen (repository);
00200     if (len >= 2
00201     && repository[len - 1] == '.'
00202     && ISDIRSEP (repository[len - 2]))
00203     {
00204     repository[len - 2] = '\0';
00205     }
00206 }
Generated on Sun Oct 21 12:41:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/root.c Source File

cvs-1.10/src/root.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Mark D. Baushke
00003  *
00004  * You may distribute under the terms of the GNU General Public License as
00005  * specified in the README file that comes with the CVS source distribution.
00006  *
00007  * Name of Root
00008  *
00009  * Determine the path to the CVSROOT and set "Root" accordingly.
00010  */
00011
00012 #include "cvs.h"
00013 #include "getline.h"
00014
00015 /* Printable names for things in the CVSroot_method enum variable.
00016    Watch out if the enum is changed in cvs.h! */
00017
00018 char *method_names[] = {
00019     "local", "server (rsh)", "pserver", "kserver", "gserver", "ext", "fork"
00020 };
00021
00022 #ifndef DEBUG
00023
00024 char *
00025 Name_Root (dir, update_dir)
00026     char *dir;
00027     char *update_dir;
00028 {
00029     FILE *fpin;
00030     char *ret, *xupdate_dir;
00031     char *root = NULL;
00032     size_t root_allocated = 0;
00033     char *tmp;
00034     char *cvsadm;
00035     char *cp;
00036
00037     if (update_dir && *update_dir)
00038     xupdate_dir = update_dir;
00039     else
00040     xupdate_dir = ".";
00041
00042     if (dir != NULL)
00043     {
00044     cvsadm = xmalloc (strlen (dir) + sizeof (CVSADM) + 10);
00045     (void) sprintf (cvsadm, "%s/%s", dir, CVSADM);
00046     tmp = xmalloc (strlen (dir) + sizeof (CVSADM_ROOT) + 10);
00047     (void) sprintf (tmp, "%s/%s", dir, CVSADM_ROOT);
00048     }
00049     else
00050     {
00051     cvsadm = xstrdup (CVSADM);
00052     tmp = xstrdup (CVSADM_ROOT);
00053     }
00054
00055     /*
00056      * Do not bother looking for a readable file if there is no cvsadm
00057      * directory present.
00058      *
00059      * It is possible that not all repositories will have a CVS/Root
00060      * file. This is ok, but the user will need to specify -d
00061      * /path/name or have the environment variable CVSROOT set in
00062      * order to continue.  */
00063     if ((!isdir (cvsadm)) || (!isreadable (tmp)))
00064     {
00065     ret = NULL;
00066     goto out;
00067     }
00068
00069     /*
00070      * The assumption here is that the CVS Root is always contained in the
00071      * first line of the "Root" file.
00072      */
00073     fpin = open_file (tmp, "r");
00074
00075     if (getline (&root, &root_allocated, fpin) < 0)
00076     {
00077     /* FIXME: should be checking for end of file separately; errno
00078        is not set in that case.  */
00079     error (0, 0, "in directory %s:", xupdate_dir);
00080     error (0, errno, "cannot read %s", CVSADM_ROOT);
00081     error (0, 0, "please correct this problem");
00082     ret = NULL;
00083     goto out;
00084     }
00085     (void) fclose (fpin);
00086     if ((cp = strrchr (root, '\n')) != NULL)
00087     *cp = '\0';         /* strip the newline */
00088
00089     /*
00090      * root now contains a candidate for CVSroot. It must be an
00091      * absolute pathname or specify a remote server.
00092      */
00093
00094     if (
00095 #ifdef CLIENT_SUPPORT
00096     (strchr (root, ':') == NULL) &&
00097 #endif
00098         ! isabsolute (root))
00099     {
00100     error (0, 0, "in directory %s:", xupdate_dir);
00101     error (0, 0,
00102            "ignoring %s because it does not contain an absolute pathname.",
00103            CVSADM_ROOT);
00104     ret = NULL;
00105     goto out;
00106     }
00107
00108 #ifdef CLIENT_SUPPORT
00109     if ((strchr (root, ':') == NULL) && !isdir (root))
00110 #else /* ! CLIENT_SUPPORT */
00111     if (!isdir (root))
00112 #endif /* CLIENT_SUPPORT */
00113     {
00114     error (0, 0, "in directory %s:", xupdate_dir);
00115     error (0, 0,
00116            "ignoring %s because it specifies a non-existent repository %s",
00117            CVSADM_ROOT, root);
00118     ret = NULL;
00119     goto out;
00120     }
00121
00122     /* allocate space to return and fill it in */
00123     strip_trailing_slashes (root);
00124     ret = xstrdup (root);
00125  out:
00126     free (cvsadm);
00127     free (tmp);
00128     if (root != NULL)
00129     free (root);
00130     return (ret);
00131 }
00132
00133 /*
00134  * Write the CVS/Root file so that the environment variable CVSROOT
00135  * and/or the -d option to cvs will be validated or not necessary for
00136  * future work.
00137  */
00138 void
00139 Create_Root (dir, rootdir)
00140     char *dir;
00141     char *rootdir;
00142 {
00143     FILE *fout;
00144     char *tmp;
00145
00146     if (noexec)
00147     return;
00148
00149     /* record the current cvs root */
00150
00151     if (rootdir != NULL)
00152     {
00153         if (dir != NULL)
00154     {
00155         tmp = xmalloc (strlen (dir) + sizeof (CVSADM_ROOT) + 10);
00156         (void) sprintf (tmp, "%s/%s", dir, CVSADM_ROOT);
00157     }
00158         else
00159         tmp = xstrdup (CVSADM_ROOT);
00160
00161         fout = open_file (tmp, "w+");
00162         if (fprintf (fout, "%s\n", rootdir) < 0)
00163         error (1, errno, "write to %s failed", tmp);
00164         if (fclose (fout) == EOF)
00165         error (1, errno, "cannot close %s", tmp);
00166     free (tmp);
00167     }
00168 }
00169
00170 #endif /* ! DEBUG */
00171
00172
00173 /* The root_allow_* stuff maintains a list of legal CVSROOT
00174    directories.  Then we can check against them when a remote user
00175    hands us a CVSROOT directory.  */
00176
00177 static int root_allow_count;
00178 static char **root_allow_vector;
00179 static int root_allow_size;
00180
00181 void
00182 root_allow_add (arg)
00183     char *arg;
00184 {
00185     char *p;
00186
00187     if (root_allow_size <= root_allow_count)
00188     {
00189     if (root_allow_size == 0)
00190     {
00191         root_allow_size = 1;
00192         root_allow_vector =
00193         (char **) malloc (root_allow_size * sizeof (char *));
00194     }
00195     else
00196     {
00197         root_allow_size *= 2;
00198         root_allow_vector =
00199         (char **) realloc (root_allow_vector,
00200                    root_allow_size * sizeof (char *));
00201     }
00202
00203     if (root_allow_vector == NULL)
00204     {
00205     no_memory:
00206         /* Strictly speaking, we're not supposed to output anything
00207            now.  But we're about to exit(), give it a try.  */
00208         printf ("E Fatal server error, aborting.\n\
00209 error ENOMEM Virtual memory exhausted.\n");
00210
00211         /* I'm doing this manually rather than via error_exit ()
00212            because I'm not sure whether we want to call server_cleanup.
00213            Needs more investigation....  */
00214
00215 #ifdef SYSTEM_CLEANUP
00216         /* Hook for OS-specific behavior, for example socket
00217            subsystems on NT and OS2 or dealing with windows
00218            and arguments on Mac.  */
00219         SYSTEM_CLEANUP ();
00220 #endif
00221
00222         exit (EXIT_FAILURE);
00223     }
00224     }
00225     p = malloc (strlen (arg) + 1);
00226     if (p == NULL)
00227     goto no_memory;
00228     strcpy (p, arg);
00229     root_allow_vector[root_allow_count++] = p;
00230 }
00231
00232 void
00233 root_allow_free ()
00234 {
00235     if (root_allow_vector != NULL)
00236     free_names (&root_allow_count, root_allow_vector);
00237     root_allow_size = 0;
00238 }
00239
00240 int
00241 root_allow_ok (arg)
00242     char *arg;
00243 {
00244     int i;
00245
00246     if (root_allow_count == 0)
00247     {
00248     /* Probably someone upgraded from CVS before 1.9.10 to 1.9.10
00249        or later without reading the documentation about
00250        --allow-root.  Printing an error here doesn't disclose any
00251        particularly useful information to an attacker because a
00252        CVS server configured in this way won't let *anyone* in.  */
00253
00254     /* Note that we are called from a context where we can spit
00255        back "error" rather than waiting for the next request which
00256        expects responses.  */
00257     printf ("\
00258 error 0 Server configuration missing --allow-root in inetd.conf\n");
00259     error_exit ();
00260     }
00261
00262     for (i = 0; i < root_allow_count; ++i)
00263     if (strcmp (root_allow_vector[i], arg) == 0)
00264         return 1;
00265     return 0;
00266 }
00267
00268 /* This global variable holds the global -d option.  It is NULL if -d
00269    was not used, which means that we must get the CVSroot information
00270    from the CVSROOT environment variable or from a CVS/Root file.  */
00271
00272 char *CVSroot_cmdline;
00273
00274 /* Parse a CVSROOT variable into its constituent parts -- method,
00275  * username, hostname, directory.  The prototypical CVSROOT variable
00276  * looks like:
00277  *
00278  * :method:user@host:path
00279  *
00280  * Some methods may omit fields; local, for example, doesn't need user
00281  * and host.
00282  *
00283  * Returns zero on success, non-zero on failure. */
00284
00285 char *CVSroot_original = NULL;  /* the CVSroot that was passed in */
00286 int client_active;      /* nonzero if we are doing remote access */
00287 CVSmethod CVSroot_method;   /* one of the enum values defined in cvs.h */
00288 char *CVSroot_username;     /* the username or NULL if method == local */
00289 char *CVSroot_hostname;     /* the hostname or NULL if method == local */
00290 char *CVSroot_directory;    /* the directory name */
00291 char *CVSroot_proxy = NULL;    /* the proxy to tunnel through */
00292 int CVSroot_port = 0;          /* the remote port to use */
00293 int CVSroot_proxy_port = CVS_PROXY_PORT; /* the proxy port to tunnel through */
00294
00295 int
00296 parse_cvsroot (CVSroot)
00297     char *CVSroot;
00298 {
00299     static int cvsroot_parsed = 0;
00300     char *cvsroot_copy, *cvsroot_save, *p;
00301     int check_hostname;
00302
00303     /* Don't go through the trouble twice. */
00304     if (cvsroot_parsed)
00305     {
00306     error (0, 0, "WARNING (parse_cvsroot): someone called me twice!\n");
00307     return 0;
00308     }
00309
00310     if (CVSroot_original != NULL)
00311     free (CVSroot_original);
00312     if (CVSroot_directory != NULL)
00313     free (CVSroot_directory);
00314     if (CVSroot_username != NULL)
00315     free (CVSroot_username);
00316     if (CVSroot_hostname != NULL)
00317     free (CVSroot_hostname);
00318
00319     CVSroot_original = xstrdup (CVSroot);
00320     cvsroot_save = cvsroot_copy = xstrdup (CVSroot);
00321
00322     if (*cvsroot_copy == ':')
00323     {
00324     char *method = ++cvsroot_copy;
00325     int have_semicolon;
00326
00327     /* Access method specified, as in
00328      * "cvs -d :pserver:user@host:/path",
00329      * "cvs -d :local:e:\path",
00330      * "cvs -d :kserver:user@host:/path", or
00331      * "cvs -d :fork:/path".
00332      * We need to get past that part of CVSroot before parsing the
00333      * rest of it.
00334      */
00335
00336     if (! (p = strchr (method, ':')))
00337     {
00338         error (0, 0, "bad CVSroot: %s", CVSroot);
00339         free (cvsroot_save);
00340         return 1;
00341     }
00342     p = strpbrk (method, ":;#");
00343     if (p == NULL)
00344     {
00345         error (0, 0, "bad CVSroot: %s", CVSroot);
00346         return 1;
00347     }
00348     have_semicolon = (*p == ';' || *p == '#');
00349     *p = '\0';
00350     cvsroot_copy = ++p;
00351
00352     /* Now we have an access method -- see if it's valid. */
00353
00354     if (strcmp (method, "local") == 0)
00355         CVSroot_method = local_method;
00356     else if (strcmp (method, "pserver") == 0)
00357         CVSroot_method = pserver_method;
00358     else if (strcmp (method, "kserver") == 0)
00359         CVSroot_method = kserver_method;
00360     else if (strcmp (method, "gserver") == 0)
00361         CVSroot_method = gserver_method;
00362     else if (strcmp (method, "server") == 0)
00363         CVSroot_method = server_method;
00364     else if (strcmp (method, "ext") == 0)
00365         CVSroot_method = ext_method;
00366     else if (strcmp (method, "fork") == 0)
00367         CVSroot_method = fork_method;
00368     else
00369     {
00370         error (0, 0, "unknown method in CVSroot: %s", CVSroot);
00371         free (cvsroot_save);
00372         return 1;
00373    }
00374
00375    while (have_semicolon)
00376    {
00377        /* More elaborate implementation would allow multiple
00378           semicolons, for example:
00379
00380               :server;rsh=34;command=cvs-1.6:
00381
00382            we will allow
00383               :server;port=22;proxy=www-proxy;proxyport=8080:
00384
00385            we will also allow # as well as ; as a separator to
00386            avoid having to quote the root in a shell.
00387        */
00388        /* FIXME: lots of error conditions should be better handled,
00389           e.g. garbage after the number or no valid number.
00390
00391           Would be nice to have testcases for some of these cases
00392           including the error cases.  */
00393        p = strpbrk (cvsroot_copy, ":;#");
00394        if (p == NULL)
00395            error (1, 0, "[semi]colon missing in %s", CVSroot);
00396
00397        /* pick up more options if we have them */
00398        have_semicolon = (*p == ';' || *p == '#');
00399        *p = '\0';
00400
00401        if (strncmp (cvsroot_copy, "port=", 5) == 0)
00402        {
00403            if (cvsroot_copy [5] == '\0')
00404                error (1, 0, "no port specified in CVSROOT: %s",
00405                       cvsroot_copy);
00406            CVSroot_port = atoi (cvsroot_copy + 5);
00407        }
00408        else if (strncmp (cvsroot_copy, "proxy=", 6) == 0)
00409        {
00410            CVSroot_proxy = xstrdup (cvsroot_copy + 6);
00411            if (*CVSroot_proxy == '\0')
00412                error (1, 0, "no proxy specified in CVSROOT: %s",
00413                       cvsroot_copy);
00414        }
00415        else if (strncmp (cvsroot_copy, "proxyport=", 10) == 0)
00416        {
00417            if (cvsroot_copy [10] == '\0')
00418                error (1, 0, "no proxy port specified in CVSROOT: %s",
00419                       cvsroot_copy);
00420            CVSroot_proxy_port = atoi (cvsroot_copy + 10);
00421        }
00422        else
00423            error (1, 0, "invalid semicolon expression in CVSROOT: %s",
00424                   cvsroot_copy);
00425        cvsroot_copy = ++p;
00426     }
00427     }
00428     else
00429     {
00430     /* If the method isn't specified, assume
00431        SERVER_METHOD/EXT_METHOD if the string contains a colon or
00432        LOCAL_METHOD otherwise.  */
00433
00434     CVSroot_method = ((strchr (cvsroot_copy, ':'))
00435 #ifdef RSH_NOT_TRANSPARENT
00436               ? server_method
00437 #else
00438               ? ext_method
00439 #endif
00440               : local_method);
00441     }
00442
00443     client_active = (CVSroot_method != local_method);
00444
00445     /* Check for username/hostname if we're not LOCAL_METHOD. */
00446
00447     CVSroot_username = NULL;
00448     CVSroot_hostname = NULL;
00449
00450     if ((CVSroot_method != local_method)
00451     && (CVSroot_method != fork_method))
00452     {
00453     /* Check to see if there is a username in the string. */
00454
00455     if ((p = strchr (cvsroot_copy, '@')) != NULL)
00456     {
00457         *p = '\0';
00458         CVSroot_username = xstrdup (cvsroot_copy);
00459         cvsroot_copy = ++p;
00460         if (*CVSroot_username == '\0')
00461         CVSroot_username = NULL;
00462     }
00463
00464     if ((p = strchr (cvsroot_copy, ':')) != NULL)
00465     {
00466         *p = '\0';
00467         CVSroot_hostname = xstrdup (cvsroot_copy);
00468         cvsroot_copy = ++p;
00469
00470         if (*CVSroot_hostname == '\0')
00471         CVSroot_hostname = NULL;
00472     }
00473     }
00474
00475     CVSroot_directory = xstrdup(cvsroot_copy);
00476     free (cvsroot_save);
00477
00478 #if ! defined (CLIENT_SUPPORT) && ! defined (DEBUG)
00479     if (CVSroot_method != local_method)
00480     {
00481     error (0, 0, "Your CVSROOT is set for a remote access method");
00482     error (0, 0, "but your CVS executable doesn't support it");
00483     error (0, 0, "(%s)", CVSroot);
00484     return 1;
00485     }
00486 #endif
00487
00488     /* Do various sanity checks. */
00489
00490     if (CVSroot_username && ! CVSroot_hostname)
00491     {
00492     error (0, 0, "missing hostname in CVSROOT: %s", CVSroot);
00493     return 1;
00494     }
00495
00496     check_hostname = 0;
00497     switch (CVSroot_method)
00498     {
00499     case local_method:
00500     if (CVSroot_username || CVSroot_hostname)
00501     {
00502         error (0, 0, "can't specify hostname and username in CVSROOT");
00503         error (0, 0, "when using local access method");
00504         error (0, 0, "(%s)", CVSroot);
00505         return 1;
00506     }
00507     /* cvs.texinfo has always told people that CVSROOT must be an
00508        absolute pathname.  Furthermore, attempts to use a relative
00509        pathname produced various errors (I couldn't get it to work),
00510        so there would seem to be little risk in making this a fatal
00511        error.  */
00512     if (!isabsolute (CVSroot_directory))
00513         error (1, 0, "CVSROOT %s must be an absolute pathname",
00514            CVSroot_directory);
00515     break;
00516     case fork_method:
00517     /* We want :fork: to behave the same as other remote access
00518            methods.  Therefore, don't check to see that the repository
00519            name is absolute -- let the server do it.  */
00520     if (CVSroot_username || CVSroot_hostname)
00521     {
00522         error (0, 0, "can't specify hostname and username in CVSROOT");
00523         error (0, 0, "when using fork access method");
00524         error (0, 0, "(%s)", CVSroot);
00525         return 1;
00526     }
00527     break;
00528     case kserver_method:
00529 #ifndef HAVE_KERBEROS
00530     error (0, 0, "Your CVSROOT is set for a kerberos access method");
00531     error (0, 0, "but your CVS executable doesn't support it");
00532     error (0, 0, "(%s)", CVSroot);
00533     return 1;
00534 #else
00535     check_hostname = 1;
00536     break;
00537 #endif
00538     case gserver_method:
00539 #ifndef HAVE_GSSAPI
00540     error (0, 0, "Your CVSROOT is set for a GSSAPI access method");
00541     error (0, 0, "but your CVS executable doesn't support it");
00542     error (0, 0, "(%s)", CVSroot);
00543     return 1;
00544 #else
00545     check_hostname = 1;
00546     break;
00547 #endif
00548     case server_method:
00549     case ext_method:
00550     case pserver_method:
00551     check_hostname = 1;
00552     break;
00553     }
00554
00555     if (check_hostname)
00556     {
00557     if (! CVSroot_hostname)
00558     {
00559         error (0, 0, "didn't specify hostname in CVSROOT: %s", CVSroot);
00560         return 1;
00561     }
00562     }
00563
00564     if (*CVSroot_directory == '\0')
00565     {
00566     error (0, 0, "missing directory in CVSROOT: %s", CVSroot);
00567     return 1;
00568     }
00569
00570     /* Hooray!  We finally parsed it! */
00571     return 0;
00572 }
00573
00574
00575 /* Set up the global CVSroot* variables as if we're using the local
00576    repository DIR.  */
00577
00578 void
00579 set_local_cvsroot (dir)
00580     char *dir;
00581 {
00582     if (CVSroot_original != NULL)
00583     free (CVSroot_original);
00584     CVSroot_original = xstrdup(dir);
00585     CVSroot_method = local_method;
00586     if (CVSroot_directory != NULL)
00587     free (CVSroot_directory);
00588     CVSroot_directory = xstrdup(dir);
00589     if (CVSroot_username != NULL)
00590     free (CVSroot_username);
00591     CVSroot_username = NULL;
00592     if (CVSroot_hostname != NULL)
00593     free (CVSroot_hostname);
00594     CVSroot_hostname = NULL;
00595     client_active = 0;
00596 }
00597
00598
00599 #ifdef DEBUG
00600 /* This is for testing the parsing function.  Use
00601
00602      gcc -I. -I.. -I../lib -DDEBUG root.c -o root
00603
00604    to compile.  */
00605
00606 #include <stdio.h>
00607
00608 char *CVSroot;
00609 char *program_name = "testing";
00610 char *command_name = "parse_cvsroot";       /* XXX is this used??? */
00611
00612 /* Toy versions of various functions when debugging under unix.  Yes,
00613    these make various bad assumptions, but they're pretty easy to
00614    debug when something goes wrong.  */
00615
00616 void
00617 error_exit PROTO ((void))
00618 {
00619     exit (1);
00620 }
00621
00622 char *
00623 xstrdup (str)
00624      const char *str;
00625 {
00626     return strdup (str);
00627 }
00628
00629 int
00630 isabsolute (dir)
00631     const char *dir;
00632 {
00633     return (dir && (*dir == '/'));
00634 }
00635
00636 void
00637 main (argc, argv)
00638     int argc;
00639     char *argv[];
00640 {
00641     program_name = argv[0];
00642
00643     if (argc != 2)
00644     {
00645     fprintf (stderr, "Usage: %s <CVSROOT>\n", program_name);
00646     exit (2);
00647     }
00648
00649     if (parse_cvsroot (argv[1]))
00650     {
00651     fprintf (stderr, "%s: Parsing failed.\n", program_name);
00652     exit (1);
00653     }
00654     printf ("CVSroot: %s\n", argv[1]);
00655     printf ("CVSroot_method: %s\n", method_names[CVSroot_method]);
00656     printf ("CVSroot_username: %s\n",
00657         CVSroot_username ? CVSroot_username : "NULL");
00658     printf ("CVSroot_hostname: %s\n",
00659         CVSroot_hostname ? CVSroot_hostname : "NULL");
00660     printf ("CVSroot_directory: %s\n", CVSroot_directory);
00661
00662    exit (0);
00663    /* NOTREACHED */
00664 }
00665 #endif
Generated on Sun Oct 21 12:41:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/rtag.c Source File

cvs-1.10/src/rtag.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Rtag
00009  *
00010  * Add or delete a symbolic name to an RCS file, or a collection of RCS files.
00011  * Uses the modules database, if necessary.
00012  */
00013
00014 #include "cvs.h"
00015
00016 static int check_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00017 static int check_filesdoneproc PROTO ((void *callerdat, int err,
00018                        char *repos, char *update_dir,
00019                        List *entries));
00020 static int pretag_proc PROTO((char *repository, char *filter));
00021 static void masterlist_delproc PROTO((Node *p));
00022 static void tag_delproc PROTO((Node *p));
00023 static int pretag_list_proc PROTO((Node *p, void *closure));
00024
00025 static Dtype rtag_dirproc PROTO ((void *callerdat, char *dir,
00026                   char *repos, char *update_dir,
00027                   List *entries));
00028 static int rtag_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00029 static int rtag_filesdoneproc PROTO ((void *callerdat, int err,
00030                       char *repos, char *update_dir,
00031                       List *entries));
00032 static int rtag_proc PROTO((int argc, char **argv, char *xwhere,
00033               char *mwhere, char *mfile, int shorten,
00034               int local_specified, char *mname, char *msg));
00035 static int rtag_delete PROTO((RCSNode *rcsfile));
00036
00037
00038 struct tag_info
00039 {
00040     Ctype status;
00041     char *rev;
00042     char *tag;
00043     char *options;
00044 };
00045
00046 struct master_lists
00047 {
00048     List *tlist;
00049 };
00050
00051 static List *mtlist;
00052 static List *tlist;
00053
00054 static char *symtag;
00055 static char *numtag;
00056 static int numtag_validated = 0;
00057 static int delete_flag;         /* adding a tag by default */
00058 static int attic_too;           /* remove tag from Attic files */
00059 static int branch_mode;         /* make an automagic "branch" tag */
00060 static char *date;
00061 static int local;           /* recursive by default */
00062 static int force_tag_match = 1;     /* force by default */
00063 static int force_tag_move;              /* don't move existing tags by default */
00064
00065 static const char *const rtag_usage[] =
00066 {
00067     "Usage: %s %s [-aflRnF] [-b] [-d] [-r rev|-D date] tag modules...\n",
00068     "\t-a\tClear tag from removed files that would not otherwise be tagged.\n",
00069     "\t-f\tForce a head revision match if tag/date not found.\n",
00070     "\t-l\tLocal directory only, not recursive\n",
00071     "\t-R\tProcess directories recursively.\n",
00072     "\t-n\tNo execution of 'tag program'\n",
00073     "\t-d\tDelete the given Tag.\n",
00074     "\t-b\tMake the tag a \"branch\" tag, allowing concurrent development.\n",
00075     "\t-r rev\tExisting revision/tag.\n",
00076     "\t-D\tExisting date.\n",
00077     "\t-F\tMove tag if it already exists\n",
00078     "(Specify the --help global option for a list of other help options)\n",
00079     NULL
00080 };
00081
00082 int
00083 rtag (argc, argv)
00084     int argc;
00085     char **argv;
00086 {
00087     register int i;
00088     int c;
00089     DBM *db;
00090     int run_module_prog = 1;
00091     int err = 0;
00092
00093     if (argc == -1)
00094     usage (rtag_usage);
00095
00096     optind = 0;
00097     while ((c = getopt (argc, argv, "+FanfQqlRdbr:D:")) != -1)
00098     {
00099     switch (c)
00100     {
00101         case 'a':
00102         attic_too = 1;
00103         break;
00104         case 'n':
00105         run_module_prog = 0;
00106         break;
00107         case 'Q':
00108         case 'q':
00109 #ifdef SERVER_SUPPORT
00110         /* The CVS 1.5 client sends these options (in addition to
00111            Global_option requests), so we must ignore them.  */
00112         if (!server_active)
00113 #endif
00114             error (1, 0,
00115                "-q or -Q must be specified before \"%s\"",
00116                command_name);
00117         break;
00118         case 'l':
00119         local = 1;
00120         break;
00121         case 'R':
00122         local = 0;
00123         break;
00124         case 'd':
00125         delete_flag = 1;
00126         break;
00127         case 'f':
00128         force_tag_match = 0;
00129         break;
00130         case 'b':
00131         branch_mode = 1;
00132         break;
00133         case 'r':
00134         numtag = optarg;
00135         break;
00136         case 'D':
00137         if (date)
00138             free (date);
00139         date = Make_Date (optarg);
00140         break;
00141         case 'F':
00142         force_tag_move = 1;
00143         break;
00144         case '?':
00145         default:
00146         usage (rtag_usage);
00147         break;
00148     }
00149     }
00150     argc -= optind;
00151     argv += optind;
00152     if (argc < 2)
00153     usage (rtag_usage);
00154     symtag = argv[0];
00155     argc--;
00156     argv++;
00157
00158     if (date && numtag)
00159     error (1, 0, "-r and -D options are mutually exclusive");
00160     if (delete_flag && branch_mode)
00161     error (0, 0, "warning: -b ignored with -d options");
00162     RCS_check_tag (symtag);
00163
00164 #ifdef CLIENT_SUPPORT
00165     if (client_active)
00166     {
00167     /* We're the client side.  Fire up the remote server.  */
00168     start_server ();
00169
00170     ign_setup ();
00171
00172     if (!force_tag_match)
00173         send_arg ("-f");
00174     if (local)
00175         send_arg("-l");
00176     if (delete_flag)
00177         send_arg("-d");
00178     if (branch_mode)
00179         send_arg("-b");
00180     if (force_tag_move)
00181         send_arg("-F");
00182     if (!run_module_prog)
00183         send_arg("-n");
00184     if (attic_too)
00185         send_arg("-a");
00186
00187     if (numtag)
00188         option_with_arg ("-r", numtag);
00189     if (date)
00190         client_senddate (date);
00191
00192     send_arg (symtag);
00193
00194     {
00195         int i;
00196         for (i = 0; i < argc; ++i)
00197         send_arg (argv[i]);
00198     }
00199
00200     send_to_server ("rtag\012", 0);
00201         return get_responses_and_close ();
00202     }
00203 #endif
00204
00205     db = open_module ();
00206     for (i = 0; i < argc; i++)
00207     {
00208     /* XXX last arg should be repository, but doesn't make sense here */
00209     history_write ('T', (delete_flag ? "D" : (numtag ? numtag :
00210                (date ? date : "A"))), symtag, argv[i], "");
00211     err += do_module (db, argv[i], TAG,
00212               delete_flag ? "Untagging" : "Tagging",
00213               rtag_proc, (char *) NULL, 0, 0, run_module_prog,
00214               symtag);
00215     }
00216     close_module (db);
00217     return (err);
00218 }
00219
00220 /*
00221  * callback proc for doing the real work of tagging
00222  */
00223 /* ARGSUSED */
00224 static int
00225 rtag_proc (argc, argv, xwhere, mwhere, mfile, shorten, local_specified,
00226        mname, msg)
00227     int argc;
00228     char **argv;
00229     char *xwhere;
00230     char *mwhere;
00231     char *mfile;
00232     int shorten;
00233     int local_specified;
00234     char *mname;
00235     char *msg;
00236 {
00237     /* Begin section which is identical to patch_proc--should this
00238        be abstracted out somehow?  */
00239     char *myargv[2];
00240     int err = 0;
00241     int which;
00242     char *repository;
00243     char *where;
00244
00245     repository = xmalloc (strlen (CVSroot_directory) + strlen (argv[0])
00246               + (mfile == NULL ? 0 : strlen (mfile)) + 30);
00247     (void) sprintf (repository, "%s/%s", CVSroot_directory, argv[0]);
00248     where = xmalloc (strlen (argv[0]) + (mfile == NULL ? 0 : strlen (mfile))
00249              + 10);
00250     (void) strcpy (where, argv[0]);
00251
00252     /* if mfile isn't null, we need to set up to do only part of the module */
00253     if (mfile != NULL)
00254     {
00255     char *cp;
00256     char *path;
00257
00258     /* if the portion of the module is a path, put the dir part on repos */
00259     if ((cp = strrchr (mfile, '/')) != NULL)
00260     {
00261         *cp = '\0';
00262         (void) strcat (repository, "/");
00263         (void) strcat (repository, mfile);
00264         (void) strcat (where, "/");
00265         (void) strcat (where, mfile);
00266         mfile = cp + 1;
00267     }
00268
00269     /* take care of the rest */
00270     path = xmalloc (strlen (repository) + strlen (mfile) + 5);
00271     (void) sprintf (path, "%s/%s", repository, mfile);
00272     if (isdir (path))
00273     {
00274         /* directory means repository gets the dir tacked on */
00275         (void) strcpy (repository, path);
00276         (void) strcat (where, "/");
00277         (void) strcat (where, mfile);
00278     }
00279     else
00280     {
00281         myargv[0] = argv[0];
00282         myargv[1] = mfile;
00283         argc = 2;
00284         argv = myargv;
00285     }
00286     free (path);
00287     }
00288
00289     /* cd to the starting repository */
00290     if ( CVS_CHDIR (repository) < 0)
00291     {
00292     error (0, errno, "cannot chdir to %s", repository);
00293     free (repository);
00294     return (1);
00295     }
00296     free (repository);
00297     /* End section which is identical to patch_proc.  */
00298
00299     if (delete_flag || attic_too || (force_tag_match && numtag))
00300     which = W_REPOS | W_ATTIC;
00301     else
00302     which = W_REPOS;
00303
00304     if (numtag != NULL && !numtag_validated)
00305     {
00306     tag_check_valid (numtag, argc - 1, argv + 1, local, 0, NULL);
00307     numtag_validated = 1;
00308     }
00309
00310     /* check to make sure they are authorized to tag all the
00311        specified files in the repository */
00312
00313     mtlist = getlist();
00314     err = start_recursion (check_fileproc, check_filesdoneproc,
00315                            (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
00316                            argc - 1, argv + 1, local, which, 0, 1,
00317                            where, 1);
00318
00319     if (err)
00320     {
00321        error (1, 0, "correct the above errors first!");
00322     }
00323
00324     /* start the recursion processor */
00325     err = start_recursion (rtag_fileproc, rtag_filesdoneproc, rtag_dirproc,
00326                (DIRLEAVEPROC) NULL, NULL,
00327                argc - 1, argv + 1, local,
00328                which, 0, 0, where, 1);
00329     free (where);
00330     dellist(&mtlist);
00331
00332     return (err);
00333 }
00334
00335 /* check file that is to be tagged */
00336 /* All we do here is add it to our list */
00337
00338 static int
00339 check_fileproc (callerdat, finfo)
00340     void *callerdat;
00341     struct file_info *finfo;
00342 {
00343     char *xdir;
00344     Node *p;
00345     Vers_TS *vers;
00346
00347     if (finfo->update_dir[0] == '\0')
00348     xdir = ".";
00349     else
00350     xdir = finfo->update_dir;
00351     if ((p = findnode (mtlist, xdir)) != NULL)
00352     {
00353     tlist = ((struct master_lists *) p->data)->tlist;
00354     }
00355     else
00356     {
00357     struct master_lists *ml;
00358
00359     tlist = getlist ();
00360     p = getnode ();
00361     p->key = xstrdup (xdir);
00362     p->type = UPDATE;
00363     ml = (struct master_lists *)
00364         xmalloc (sizeof (struct master_lists));
00365     ml->tlist = tlist;
00366     p->data = (char *) ml;
00367     p->delproc = masterlist_delproc;
00368     (void) addnode (mtlist, p);
00369     }
00370     /* do tlist */
00371     p = getnode ();
00372     p->key = xstrdup (finfo->file);
00373     p->type = UPDATE;
00374     p->delproc = tag_delproc;
00375     vers = Version_TS (finfo, NULL, NULL, NULL, 0, 0);
00376     p->data = RCS_getversion(vers->srcfile, numtag, date, force_tag_match,
00377                  (int *) NULL);
00378     if (p->data != NULL)
00379     {
00380         int addit = 1;
00381         char *oversion;
00382
00383         oversion = RCS_getversion (vers->srcfile, symtag, (char *) NULL, 1,
00384                    (int *) NULL);
00385         if (oversion == NULL)
00386         {
00387             if (delete_flag)
00388             {
00389         /* Deleting a tag which did not exist is a noop and
00390            should not be logged.  */
00391                 addit = 0;
00392             }
00393         }
00394     else if (delete_flag)
00395     {
00396         free (p->data);
00397         p->data = xstrdup (oversion);
00398     }
00399         else if (strcmp(oversion, p->data) == 0)
00400         {
00401             addit = 0;
00402         }
00403         else if (!force_tag_move)
00404         {
00405             addit = 0;
00406         }
00407         if (oversion != NULL)
00408         {
00409             free(oversion);
00410         }
00411         if (!addit)
00412         {
00413             free(p->data);
00414             p->data = NULL;
00415         }
00416     }
00417     freevers_ts (&vers);
00418     (void) addnode (tlist, p);
00419     return (0);
00420 }
00421
00422 static int
00423 check_filesdoneproc (callerdat, err, repos, update_dir, entries)
00424     void *callerdat;
00425     int err;
00426     char *repos;
00427     char *update_dir;
00428     List *entries;
00429 {
00430     int n;
00431     Node *p;
00432
00433     p = findnode(mtlist, update_dir);
00434     if (p != NULL)
00435     {
00436         tlist = ((struct master_lists *) p->data)->tlist;
00437     }
00438     else
00439     {
00440         tlist = (List *) NULL;
00441     }
00442     if ((tlist == NULL) || (tlist->list->next == tlist->list))
00443     {
00444         return (err);
00445     }
00446     if ((n = Parse_Info(CVSROOTADM_TAGINFO, repos, pretag_proc, 1)) > 0)
00447     {
00448         error (0, 0, "Pre-tag check failed");
00449         err += n;
00450     }
00451     return (err);
00452 }
00453
00454 static int
00455 pretag_proc(repository, filter)
00456     char *repository;
00457     char *filter;
00458 {
00459     if (filter[0] == '/')
00460     {
00461         char *s, *cp;
00462
00463         s = xstrdup(filter);
00464         for (cp=s; *cp; cp++)
00465         {
00466             if (isspace ((unsigned char) *cp))
00467             {
00468                 *cp = '\0';
00469                 break;
00470             }
00471         }
00472         if (!isfile(s))
00473         {
00474             error (0, errno, "cannot find pre-tag filter '%s'", s);
00475             free(s);
00476             return (1);
00477         }
00478         free(s);
00479     }
00480     run_setup (filter);
00481     run_arg (symtag);
00482     run_arg (delete_flag ? "del" : force_tag_move ? "mov" : "add");
00483     run_arg (repository);
00484     walklist(tlist, pretag_list_proc, NULL);
00485     return (run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL));
00486 }
00487
00488 static void
00489 masterlist_delproc(p)
00490     Node *p;
00491 {
00492     struct master_lists *ml;
00493
00494     ml = (struct master_lists *)p->data;
00495     dellist(&ml->tlist);
00496     free(ml);
00497     return;
00498 }
00499
00500 static void
00501 tag_delproc(p)
00502     Node *p;
00503 {
00504     if (p->data != NULL)
00505     {
00506         free(p->data);
00507         p->data = NULL;
00508     }
00509     return;
00510 }
00511
00512 static int
00513 pretag_list_proc(p, closure)
00514     Node *p;
00515     void *closure;
00516 {
00517     if (p->data != NULL)
00518     {
00519         run_arg(p->key);
00520         run_arg(p->data);
00521     }
00522     return (0);
00523 }
00524
00525 /*
00526  * Called to tag a particular file, as appropriate with the options that were
00527  * set above.
00528  */
00529 /* ARGSUSED */
00530 static int
00531 rtag_fileproc (callerdat, finfo)
00532     void *callerdat;
00533     struct file_info *finfo;
00534 {
00535     RCSNode *rcsfile;
00536     char *version, *rev;
00537     int retcode = 0;
00538
00539     /* Lock the directory if it is not already locked.  We might be
00540        able to rely on rtag_dirproc for this.  */
00541
00542     /* It would be nice to provide consistency with respect to
00543        commits; however CVS lacks the infrastructure to do that (see
00544        Concurrency in cvs.texinfo and comment in do_recursion).  We
00545        can and will prevent simultaneous tag operations from
00546        interfering with each other, by write locking each directory as
00547        we enter it, and unlocking it as we leave it.  */
00548
00549     lock_dir_for_write (finfo->repository);
00550
00551     /* find the parsed RCS data */
00552     if ((rcsfile = finfo->rcs) == NULL)
00553     return (1);
00554
00555     /*
00556      * For tagging an RCS file which is a symbolic link, you'd best be
00557      * running with RCS 5.6, since it knows how to handle symbolic links
00558      * correctly without breaking your link!
00559      */
00560
00561     if (delete_flag)
00562     return (rtag_delete (rcsfile));
00563
00564     /*
00565      * If we get here, we are adding a tag.  But, if -a was specified, we
00566      * need to check to see if a -r or -D option was specified.  If neither
00567      * was specified and the file is in the Attic, remove the tag.
00568      */
00569     if (attic_too && (!numtag && !date))
00570     {
00571     if ((rcsfile->flags & VALID) && (rcsfile->flags & INATTIC))
00572         return (rtag_delete (rcsfile));
00573     }
00574
00575     version = RCS_getversion (rcsfile, numtag, date, force_tag_match,
00576                   (int *) NULL);
00577     if (version == NULL)
00578     {
00579     /* If -a specified, clean up any old tags */
00580     if (attic_too)
00581         (void) rtag_delete (rcsfile);
00582
00583     if (!quiet && !force_tag_match)
00584     {
00585         error (0, 0, "cannot find tag `%s' in `%s'",
00586            numtag ? numtag : "head", rcsfile->path);
00587         return (1);
00588     }
00589     return (0);
00590     }
00591     if (numtag
00592     && isdigit ((unsigned char) *numtag)
00593     && strcmp (numtag, version) != 0)
00594     {
00595
00596     /*
00597      * We didn't find a match for the numeric tag that was specified, but
00598      * that's OK.  just pass the numeric tag on to rcs, to be tagged as
00599      * specified.  Could get here if one tried to tag "1.1.1" and there
00600      * was a 1.1.1 branch with some head revision.  In this case, we want
00601      * the tag to reference "1.1.1" and not the revision at the head of
00602      * the branch.  Use a symbolic tag for that.
00603      */
00604     rev = branch_mode ? RCS_magicrev (rcsfile, version) : numtag;
00605     retcode = RCS_settag(rcsfile, symtag, numtag);
00606     if (retcode == 0)
00607         RCS_rewrite (rcsfile, NULL, NULL);
00608     }
00609     else
00610     {
00611     char *oversion;
00612
00613     /*
00614      * As an enhancement for the case where a tag is being re-applied to
00615      * a large body of a module, make one extra call to RCS_getversion to
00616      * see if the tag is already set in the RCS file.  If so, check to
00617      * see if it needs to be moved.  If not, do nothing.  This will
00618      * likely save a lot of time when simply moving the tag to the
00619      * "current" head revisions of a module -- which I have found to be a
00620      * typical tagging operation.
00621      */
00622     rev = branch_mode ? RCS_magicrev (rcsfile, version) : version;
00623     oversion = RCS_getversion (rcsfile, symtag, (char *) NULL, 1,
00624                    (int *) NULL);
00625     if (oversion != NULL)
00626     {
00627         int isbranch = RCS_nodeisbranch (finfo->rcs, symtag);
00628
00629         /*
00630          * if versions the same and neither old or new are branches don't
00631          * have to do anything
00632          */
00633         if (strcmp (version, oversion) == 0 && !branch_mode && !isbranch)
00634         {
00635         free (oversion);
00636         free (version);
00637         return (0);
00638         }
00639
00640         if (!force_tag_move)
00641         {
00642         /* we're NOT going to move the tag */
00643         (void) printf ("W %s", finfo->fullname);
00644
00645         (void) printf (" : %s already exists on %s %s",
00646                    symtag, isbranch ? "branch" : "version",
00647                    oversion);
00648         (void) printf (" : NOT MOVING tag to %s %s\n",
00649                    branch_mode ? "branch" : "version", rev);
00650         free (oversion);
00651         free (version);
00652         return (0);
00653         }
00654         free (oversion);
00655     }
00656     retcode = RCS_settag(rcsfile, symtag, rev);
00657     if (retcode == 0)
00658         RCS_rewrite (rcsfile, NULL, NULL);
00659     }
00660
00661     if (retcode != 0)
00662     {
00663     error (1, retcode == -1 ? errno : 0,
00664            "failed to set tag `%s' to revision `%s' in `%s'",
00665            symtag, rev, rcsfile->path);
00666         if (branch_mode)
00667         free (rev);
00668         free (version);
00669         return (1);
00670     }
00671     if (branch_mode)
00672     free (rev);
00673     free (version);
00674     return (0);
00675 }
00676
00677 /*
00678  * If -d is specified, "force_tag_match" is set, so that this call to
00679  * RCS_getversion() will return a NULL version string if the symbolic
00680  * tag does not exist in the RCS file.
00681  *
00682  * If the -r flag was used, numtag is set, and we only delete the
00683  * symtag from files that have numtag.
00684  *
00685  * This is done here because it's MUCH faster than just blindly calling
00686  * "rcs" to remove the tag... trust me.
00687  */
00688 static int
00689 rtag_delete (rcsfile)
00690     RCSNode *rcsfile;
00691 {
00692     char *version;
00693     int retcode;
00694
00695     if (numtag)
00696     {
00697     version = RCS_getversion (rcsfile, numtag, (char *) NULL, 1,
00698                   (int *) NULL);
00699     if (version == NULL)
00700         return (0);
00701     free (version);
00702     }
00703
00704     version = RCS_getversion (rcsfile, symtag, (char *) NULL, 1,
00705                   (int *) NULL);
00706     if (version == NULL)
00707     return (0);
00708     free (version);
00709
00710     if ((retcode = RCS_deltag(rcsfile, symtag)) != 0)
00711     {
00712     if (!quiet)
00713         error (0, retcode == -1 ? errno : 0,
00714            "failed to remove tag `%s' from `%s'", symtag,
00715            rcsfile->path);
00716     return (1);
00717     }
00718     RCS_rewrite (rcsfile, NULL, NULL);
00719     return (0);
00720 }
00721
00722 /* Clear any lock we may hold on the current directory.  */
00723
00724 static int
00725 rtag_filesdoneproc (callerdat, err, repos, update_dir, entries)
00726     void *callerdat;
00727     int err;
00728     char *repos;
00729     char *update_dir;
00730     List *entries;
00731 {
00732     Lock_Cleanup ();
00733
00734     return (err);
00735 }
00736
00737 /*
00738  * Print a warm fuzzy message
00739  */
00740 /* ARGSUSED */
00741 static Dtype
00742 rtag_dirproc (callerdat, dir, repos, update_dir, entries)
00743     void *callerdat;
00744     char *dir;
00745     char *repos;
00746     char *update_dir;
00747     List *entries;
00748 {
00749     if (ignore_directory (update_dir))
00750     {
00751     /* print the warm fuzzy message */
00752     if (!quiet)
00753       error (0, 0, "Ignoring %s", update_dir);
00754         return R_SKIP_ALL;
00755     }
00756
00757     if (!quiet)
00758     error (0, 0, "%s %s", delete_flag ? "Untagging" : "Tagging",
00759            update_dir);
00760     return (R_PROCESS);
00761 }
00762
00763
00764
Generated on Sun Oct 21 12:41:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


find_names.c File Reference

cvs-1.10/src/find_names.c File Reference

#include "cvs.h"

Include dependency graph for find_names.c:

Include dependency graph

Go to the source code of this file.

Functions

int | find_dirs ()
int | find_rcs ()
int | add_subdir_proc ()
int | register_subdir_proc ()
int | add_entries_proc ()
int | add_entries_proc (node, closure) Node *node

Variables

List * filelist
void * | closure
int | which
int | aflag
List ** optentries
List * entries
List * list
int | checkadm

Function Documentation

int add_entries_proc | ( | node | ,
 |  | closure |
 | ) | [static]

int add_entries_proc ( ) [static]

int add_subdir_proc ( ) [static]

int find_dirs ( ) [static]

int find_rcs ( ) [static]

int register_subdir_proc ( ) [static]

Variable Documentation

int aflag

Definition at line 62 of file find_names.c.

int checkadm

Definition at line 310 of file find_names.c.

void* closure

Definition at line 155 of file find_names.c.

List* entries

Definition at line 311 of file find_names.c.

List* filelist [static]

Definition at line 27 of file find_names.c.

List * list

Definition at line 309 of file find_names.c.

List** optentries

Definition at line 63 of file find_names.c.

int which

Definition at line 169 of file find_names.c.

Generated on Sun Oct 21 12:43:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


hardlink.c File Reference

cvs-1.10/src/hardlink.c File Reference

#include "cvs.h"
#include "hardlink.h"

Include dependency graph for hardlink.c:

Include dependency graph

Go to the source code of this file.

Functions

Node * | lookup_file_by_inode (filepath) const char *filepath

Variables

List * hardlist
char * | working_dir
List * links2
void * | data

Function Documentation

Node* lookup_file_by_inode ( filepath ) const

Variable Documentation

void* data

Definition at line 267 of file hardlink.c.

Referenced by closure().

List* hardlist

Definition at line 40 of file hardlink.c.

List* links2

Definition at line 220 of file hardlink.c.

char* working_dir

Definition at line 41 of file hardlink.c.

Generated on Sun Oct 21 12:43:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


hardlink.h File Reference

cvs-1.10/src/hardlink.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | hardlink_info

Functions

Node *lookup_file_by_inode | PROTO ((const char *))
List *list_linked_files_on_disk | PROTO ((char *))
int compare_linkage_lists | PROTO ((List *, List *))
int find_checkedout_proc | PROTO ((Node *, void *))

Variables

List * hardlist
char * | working_dir

Function Documentation

int find_checkedout_proc PROTO ( (Node *, void *) )

int compare_linkage_lists PROTO ( (List *, List *) )

List* list_linked_files_on_disk PROTO ( (char *) )

Node* lookup_file_by_inode PROTO ( (const char *) )

Variable Documentation

List* hardlist

Definition at line 26 of file hardlink.h.

char* working_dir

Definition at line 27 of file hardlink.h.

Generated on Sun Oct 21 12:43:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


hash.c File Reference

cvs-1.10/src/hash.c File Reference

#include "cvs.h"
#include <assert.h>

Include dependency graph for hash.c:

Include dependency graph

Go to the source code of this file.

Functions

void | freenode_mem ()
int | hashp (key) const char *key
int | qsort_comp ()
int | qsort_comp (elem1, elem2) const void *elem1
char * | nodetypestring (type) Ntype type
int | printnode (node, closure) Node *node
void | printlist (list) List *list

Variables

List * | listcache = NULL
Node * | nodecache = NULL
Node * marker
Node * p
const char * | key
int(* | proc )()
void * | closure
const void * | elem2
int(* | comp )()
const Node * | q

Function Documentation

void freenode_mem ( ) [static]

int hashp ( key ) const [static]

char* nodetypestring ( type ) [static]

void printlist ( list )

int printnode | ( | node | ,
 |  | closure |
 | ) | [static]

int qsort_comp | ( | elem1 | ,
 |  | elem2 |
 | ) | const [static]

int qsort_comp ( ) [static]

Variable Documentation

void* closure

Definition at line 483 of file hash.c.

int(* comp)()

Definition at line 400 of file hash.c.

const void* elem2

Definition at line 387 of file hash.c.

const char * key

Definition at line 331 of file hash.c.

List* listcache = NULL [static]

Definition at line 17 of file hash.c.

Node* marker

Definition at line 232 of file hash.c.

Node* nodecache = NULL [static]

Definition at line 18 of file hash.c.

Node* p

Definition at line 291 of file hash.c.

int(* proc)()

Definition at line 359 of file hash.c.

const Node* q

Definition at line 445 of file hash.c.

Generated on Sun Oct 21 12:43:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


hash.h File Reference

cvs-1.10/src/hash.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | list
struct | node

Defines

#define | HASHSIZE 151

Typedefs

typedef enum ntype | Ntype
typedef node | Node
typedef list | List

Enumerations

enum ntype {
NT_UNKNOWN, HEADER, ENTRIES, FILES,
LIST, RCSNODE, RCSVERS, DIRS,
UPDATE, LOCK, NDBMNODE, FILEATTR,
VARIABLE, RCSFIELD, RCSCMPFLD
}

Functions

List *getlist | PROTO ((void))
Node *findnode | PROTO ((List *list, const char *key))
int insert_before | PROTO ((List *list, Node *marker, Node *p))
int addnode | PROTO ((List *list, Node *p))
int walklist | PROTO ((List *list, int(*)(Node *n, void *closure), void *closure))
int list_isempty | PROTO ((List *list))
void dellist | PROTO ((List **listp))
void delnode | PROTO ((Node *p))
void sortlist | PROTO ((List *list, int(*)(const Node *, const Node *)))
int fsortcmp | PROTO ((const Node *p, const Node *q))

Define Documentation

#define HASHSIZE 151

Definition at line 12 of file hash.h.

Typedef Documentation

typedef struct list List

Definition at line 44 of file hash.h.

typedef struct node Node

Definition at line 36 of file hash.h.

Referenced by NotificationManager::CheckIn().

typedef enum ntype Ntype

Definition at line 23 of file hash.h.

Enumeration Type Documentation

enum ntype

Enumeration values:
NT_UNKNOWN
HEADER
ENTRIES
FILES
LIST
RCSNODE
RCSVERS
DIRS
UPDATE
LOCK
NDBMNODE
FILEATTR
VARIABLE
RCSFIELD
RCSCMPFLD

Definition at line 17 of file hash.h.

00018 {
00019     NT_UNKNOWN, HEADER, ENTRIES, FILES, LIST, RCSNODE,
00020     RCSVERS, DIRS, UPDATE, LOCK, NDBMNODE, FILEATTR,
00021     VARIABLE, RCSFIELD, RCSCMPFLD
00022 };

Function Documentation

int fsortcmp PROTO ( (const Node *p, const Node *q) )

void sortlist PROTO ( (List *list, int(* )(const Node *, const Node *)) )

void delnode PROTO ( (Node *p) )

void dellist PROTO ( (List **listp) )

int list_isempty PROTO ( (List *list) )

int walklist PROTO ( (List *list, int(* )(Node *n, void *closure), void *closure) )

int addnode PROTO ( (List *list, Node *p) )

int insert_before PROTO ( (List *list, Node *marker, Node *p) )

Node* findnode PROTO ( (List *list, const char *key) )

List* getlist PROTO ( (void) )

Generated on Sun Oct 21 12:43:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


history.c File Reference

cvs-1.10/src/history.c File Reference

#include "cvs.h"
#include "savecwd.h"

Include dependency graph for history.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | file_list_str
struct | hrec

Defines

#define | ALL_REC_TYPES "TOEFWUCGMAR"
#define | USER_INCREMENT 2
#define | FILE_INCREMENT 128
#define | MODULE_INCREMENT 5
#define | HREC_INCREMENT 128
#define | NEXT_BAR(here) do { while (isspace(*line)) line++; hr->here = line; while ((c = *line++) && c != '|') ; if (!c) return; *(line - 1) = '\0'; } while (0)
#define | STAT_BLOCKSIZE(s) (4 * 1024)

Functions

void | fill_hrec ()
int | accept_hrec ()
int | select_hrec ()
int | sort_order ()
int | within ()
void | expand_modules ()
void | read_hrecs ()
void | report_hrecs ()
void | save_file ()
void | save_module ()
void | save_user ()
int | sort_order (l, r) const char *l

Variables

hrec * hrec_head
short | report_count
short | extract
short | v_checkout
short | modified
short | tag_report
short | module_report
short | working
short | last_entry
short | all_users
short | user_sort
short | repos_sort
short | file_sort
short | module_sort
short | tz_local
time_t | tz_seconds_east_of_GMT
char * | tz_name = "+0000"
char * | logHistory = "TOEFWUCGMAR"
char * | since_rev
char * | since_tag
char * | backto
char * | since_date
hrec * last_since_tag
hrec * last_backto
char * | rec_types
int | hrec_count
int | hrec_max
char ** | user_list
int | user_max
int | user_count
file_list_str * file_list
int | file_max
int | file_count
char ** | mod_list
int | mod_max
int | mod_count
char * | histfile
const char *const | history_usg []
const char * | r
char ** | argv
char * | update_dir
char * | revs
char * | name
char * | repository
char * | module
hrec * hr
* string
* lr

Define Documentation

#define ALL_REC_TYPES "TOEFWUCGMAR"

Definition at line 210 of file history.c.

#define FILE_INCREMENT 128

Definition at line 212 of file history.c.

#define HREC_INCREMENT 128

Definition at line 214 of file history.c.

#define MODULE_INCREMENT 5

Definition at line 213 of file history.c.

#define NEXT_BAR ( here ) do { while (isspace(*line)) line++; hr->here = line; while ((c = *line++) && c != '|') ; if (!c) return; *(line - 1) = '\0'; } while (0)

#define STAT_BLOCKSIZE ( s ) (4 * 1024)

#define USER_INCREMENT 2

Definition at line 211 of file history.c.

Function Documentation

int accept_hrec ( ) [static]

void expand_modules ( ) [static]

void fill_hrec ( ) [static]

void read_hrecs ( ) [static]

void report_hrecs ( ) [static]

void save_file ( ) [static]

void save_module ( ) [static]

void save_user ( ) [static]

int select_hrec ( ) [static]

int sort_order | ( | l | ,
 |  | r |
 | ) | const [static]

int sort_order ( ) [static]

int within ( ) [static]

Variable Documentation

short all_users [static]

Definition at line 225 of file history.c.

char** argv

Definition at line 371 of file history.c.

char* backto [static]

Definition at line 245 of file history.c.

short extract [static]

Definition at line 218 of file history.c.

int file_count [static]

Definition at line 270 of file history.c.

struct file_list_str * file_list [static]

int file_max [static]

Definition at line 269 of file history.c.

short file_sort [static]

Definition at line 229 of file history.c.

char* histfile [static]

Definition at line 276 of file history.c.

const char* const history_usg[] [static]

Initial value:

{
    "Usage: %s %s [-report] [-flags] [-options args] [files...]\n\n",
    "   Reports:\n",
    "        -T              Produce report on all TAGs\n",
    "        -c              Committed (Modified) files\n",
    "        -o              Checked out modules\n",
    "        -m <module>     Look for specified module (repeatable)\n",
    "        -x [TOEFWUCGMAR] Extract by record type\n",
    "        -e              Everything (same as -x, but all record types)\n",
    "   Flags:\n",
    "        -a              All users (Default is self)\n",
    "        -l              Last modified (committed or modified report)\n",
    "        -w              Working directory must match\n",
    "   Options:\n",
    "        -D <date>       Since date (Many formats)\n",
    "        -b <str>        Back to record with str in module/file/repos field\n",
    "        -f <file>       Specified file (same as command line) (repeatable)\n",
    "        -n <modulename> In module (repeatable)\n",
    "        -p <repos>      In repository (repeatable)\n",
    "        -r <rev/tag>    Since rev or tag (looks inside RCS files!)\n",
    "        -t <tag>        Since tag record placed in history file (by anyone).\n",
    "        -u <user>       For user name (repeatable)\n",
    "        -z <tz>         Output for time zone <tz> (e.g. -z -0700)\n",
    NULL}

Definition at line 284 of file history.c.

struct hrec* hr

Definition at line 992 of file history.c.

int hrec_count [static]

Definition at line 257 of file history.c.

struct hrec * hrec_head [static]

int hrec_max [static]

Definition at line 258 of file history.c.

struct hrec* last_backto [static]

Definition at line 250 of file history.c.

short last_entry [static]

Definition at line 224 of file history.c.

struct hrec* last_since_tag [static]

Definition at line 249 of file history.c.

char* logHistory = "TOEFWUCGMAR"

Definition at line 236 of file history.c.

* lr

Definition at line 1539 of file history.c.

int mod_count [static]

Definition at line 274 of file history.c.

char** mod_list [static]

Definition at line 272 of file history.c.

int mod_max [static]

Definition at line 273 of file history.c.

short modified [static]

Definition at line 220 of file history.c.

char* module

Definition at line 916 of file history.c.

short module_report [static]

Definition at line 222 of file history.c.

short module_sort [static]

Definition at line 230 of file history.c.

char* name

Definition at line 915 of file history.c.

const char* r

Definition at line 320 of file history.c.

char* rec_types [static]

Definition at line 255 of file history.c.

short report_count [static]

Definition at line 216 of file history.c.

short repos_sort [static]

Definition at line 228 of file history.c.

char* repository

Definition at line 702 of file history.c.

char* revs

Definition at line 700 of file history.c.

char* since_date [static]

Definition at line 247 of file history.c.

char* since_rev [static]

Definition at line 243 of file history.c.

char* since_tag [static]

Definition at line 244 of file history.c.

* string

Definition at line 1162 of file history.c.

Referenced by ansiAttrCvt::AnsiSeq::AnsiSeq(), CTCP2Parse::ParseIt(), and findTcl().

short tag_report [static]

Definition at line 221 of file history.c.

short tz_local [static]

Definition at line 232 of file history.c.

char* tz_name = "+0000" [static]

Definition at line 234 of file history.c.

time_t tz_seconds_east_of_GMT [static]

Definition at line 233 of file history.c.

char* update_dir

Definition at line 699 of file history.c.

int user_count [static]

Definition at line 262 of file history.c.

char** user_list [static]

Definition at line 260 of file history.c.

int user_max [static]

Definition at line 261 of file history.c.

short user_sort [static]

Definition at line 227 of file history.c.

short v_checkout [static]

Definition at line 219 of file history.c.

short working [static]

Definition at line 223 of file history.c.

Generated on Sun Oct 21 12:43:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ignore.c File Reference

cvs-1.10/src/ignore.c File Reference

#include "cvs.h"
#include "getline.h"

Include dependency graph for ignore.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | IGN_GROW 16

Functions

void | ign_setup ()
void | ign_add_file (file, hold) char *file
int | ign_name (name) char *name
void | ign_dir_add (name) char *name

Variables

char ** | ign_list
char ** | s_ign_list = NULL
int | ign_count
int | s_ign_count = 0
int | ign_size
int | ign_hold = -1
const char * | ign_default
int | ign_inhibit_server
int | hold
int | dir_ign_max = 0
int | dir_ign_current = 0
List * entries
char * | update_dir
Ignore_proc proc

Define Documentation

#define IGN_GROW 16

Definition at line 40 of file ignore.c.

Function Documentation

void ign_add_file | ( | file | ,
 |  | hold |
 | ) |

void ign_dir_add ( name )

int ign_name ( name )

void ign_setup ( )

Definition at line 54 of file ignore.c.

00055 {
00056     char *home_dir;
00057     char *tmp;
00058
00059     ign_inhibit_server = 0;
00060
00061     /* Start with default list and special case */
00062     tmp = xstrdup (ign_default);
00063     ign_add (tmp, 0);
00064     free (tmp);
00065
00066 #ifdef CLIENT_SUPPORT
00067     /* The client handles another way, by (after it does its own ignore file
00068        processing, and only if !ign_inhibit_server), letting the server
00069        know about the files and letting it decide whether to ignore
00070        them based on CVSROOOTADM_IGNORE.  */
00071     if (!client_active)
00072 #endif
00073     {
00074     char *file = xmalloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM)
00075                   + sizeof (CVSROOTADM_IGNORE) + 10);
00076     /* Then add entries found in repository, if it exists */
00077     (void) sprintf (file, "%s/%s/%s", CVSroot_directory,
00078             CVSROOTADM, CVSROOTADM_IGNORE);
00079     ign_add_file (file, 0);
00080     free (file);
00081     }
00082
00083     /* Then add entries found in home dir, (if user has one) and file exists */
00084     home_dir = get_homedir ();
00085     /* If we can't find a home directory, ignore ~/.cvsignore.  This may
00086        make tracking down problems a bit of a pain, but on the other
00087        hand it might be obnoxious to complain when CVS will function
00088        just fine without .cvsignore (and many users won't even know what
00089        .cvsignore is).  */
00090     if (home_dir)
00091     {
00092     char *file = xmalloc (strlen (home_dir) + sizeof (CVSDOTIGNORE) + 10);
00093     (void) sprintf (file, "%s/%s", home_dir, CVSDOTIGNORE);
00094     ign_add_file (file, 0);
00095     free (file);
00096     }
00097
00098     /* Then add entries found in CVSIGNORE environment variable. */
00099     ign_add (getenv (IGNORE_ENV), 0);
00100
00101     /* Later, add ignore entries found in -I arguments */
00102 }

Variable Documentation

int dir_ign_current = 0 [static]

Definition at line 320 of file ignore.c.

int dir_ign_max = 0 [static]

Definition at line 319 of file ignore.c.

List* entries

Definition at line 372 of file ignore.c.

int hold

Definition at line 173 of file ignore.c.

int ign_count [static]

Definition at line 29 of file ignore.c.

const char* ign_default

Initial value:

 ". .. core RCSLOG tags TAGS RCS SCCS .make.state\
 .nse_depinfo #* .#* cvslog.* ,* CVS CVS.adm .del-* *.a *.olb *.o *.obj\
 *.so *.Z *~ *.old *.elc *.ln *.bak *.BAK *.orig *.rej *.exe _$* *$"

Definition at line 36 of file ignore.c.

Referenced by BuildIgnoredList().

int ign_hold = -1 [static]

Definition at line 33 of file ignore.c.

int ign_inhibit_server

Definition at line 45 of file ignore.c.

char** ign_list [static]

Definition at line 26 of file ignore.c.

int ign_size [static]

Definition at line 31 of file ignore.c.

Ignore_proc proc

Definition at line 374 of file ignore.c.

int s_ign_count = 0 [static]

Definition at line 30 of file ignore.c.

char** s_ign_list = NULL [static]

Definition at line 28 of file ignore.c.

char* update_dir

Definition at line 373 of file ignore.c.

Generated on Sun Oct 21 12:43:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


import.c File Reference

cvs-1.10/src/import.c File Reference

#include "cvs.h"
#include "savecwd.h"
#include <assert.h>

Include dependency graph for import.c:

Include dependency graph

Go to the source code of this file.

Functions

char * | get_comment ()
int | add_rev ()
int | add_tags ()
int | import_descend ()
int | import_descend_dir ()
int | process_import_file ()
int | update_rcs_file ()
void | add_log ()
int | import (argc, argv) int argc
char * | get_comment (user) char *user

Variables

int | repos_len
char * | vhead
char * | vbranch
FILE * | logfp
char * | repository
int | conflicts
int | use_file_modtime
char * | keyword_opt = NULL
const char *const | import_usage []
char ** | argv
char * | vtag
int | targc
char * | targv []
char * | vfile
int | inattic
RCSNode * rcs
char * | vers
const struct compair | comtable []
char * | user
char * | add_vhead
char * | key_opt
char * | add_vbranch
char * | desctext
size_t | desclen
FILE * | add_logfp
off_t | size
FILE * | fp
char * | fname
char * | dir

Function Documentation

void add_log ( ) [static]

int add_rev ( ) [static]

int add_tags ( ) [static]

char* get_comment ( user ) [static]

char* get_comment ( ) [static]

int import | ( | argc | ,
 |  | argv |
 | ) |

int import_descend ( ) [static]

int import_descend_dir ( ) [static]

int process_import_file ( ) [static]

int update_rcs_file ( ) [static]

Variable Documentation

FILE* add_logfp

Definition at line 1017 of file import.c.

char* add_vbranch

Definition at line 1005 of file import.c.

char* add_vhead

Definition at line 997 of file import.c.

char** argv

Definition at line 63 of file import.c.

const struct compair comtable[] [static]

Definition at line 825 of file import.c.

int conflicts [static]

Definition at line 42 of file import.c.

size_t desclen

Definition at line 1013 of file import.c.

char* desctext

Definition at line 1012 of file import.c.

char* dir

Definition at line 1534 of file import.c.

char* fname

Definition at line 1493 of file import.c.

Referenced by HQXDecode().

FILE * fp

Definition at line 7896 of file rcs.c.

const char* const import_usage[] [static]

Initial value:

{
    "Usage: %s %s [-d] [-k subst] [-I ign] [-m msg] [-b branch]\n",
    "    [-W spec] repository vendor-tag release-tags...\n",
    "\t-d\tUse the file's modification time as the time of import.\n",
    "\t-k sub\tSet default RCS keyword substitution mode.\n",
    "\t-I ign\tMore files to ignore (! to reset).\n",
    "\t-b bra\tVendor branch id.\n",
    "\t-m msg\tLog message.\n",
    "\t-W spec\tWrappers specification line.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 46 of file import.c.

int inattic

Definition at line 616 of file import.c.

char* key_opt

Definition at line 1001 of file import.c.

char* keyword_opt = NULL [static]

Definition at line 44 of file import.c.

FILE* logfp [static]

Definition at line 40 of file import.c.

char* rcs

Definition at line 987 of file import.c.

int repos_len [static]

Definition at line 37 of file import.c.

char* repository [static]

Definition at line 41 of file import.c.

off_t size

Definition at line 1461 of file import.c.

int targc

Definition at line 1536 of file import.c.

char * targv

Definition at line 1537 of file import.c.

int use_file_modtime [static]

Definition at line 43 of file import.c.

char* user

Definition at line 991 of file import.c.

char* vbranch [static]

Definition at line 39 of file import.c.

char* vers

Definition at line 703 of file import.c.

char * vfile

Definition at line 765 of file import.c.

char* vhead [static]

Definition at line 38 of file import.c.

char * vtag

Definition at line 1535 of file import.c.

Generated on Sun Oct 21 12:43:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


lock.c File Reference

cvs-1.10/src/lock.c File Reference

#include "cvs.h"
#include <assert.h>

Include dependency graph for lock.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | lock

Defines

#define | L_OK 0
#define | L_ERROR 1
#define | L_LOCKED 2

Functions

void | remove_locks ()
int | readers_exist ()
int | set_lock ()
void | clear_lock ()
void | set_lockers_name ()
int | set_writelock_proc ()
int | unlock_proc ()
int | write_lock ()
void | lock_simple_remove ()
void | lock_wait ()
void | lock_obtained ()
char * | lock_name ()
char * | lock_name (repository, name) char *repository
int | Writer_Lock ()
int | Writer_Lock (list) List *list
int | lock_filesdoneproc (callerdat, err, repository, update_dir, entries) void *callerdat

Variables

char * | lockers_name
char * | readlock
char * | writelock
char * | masterlock
List * locklist
lock global_readlock
List * lock_tree_list
char * | locked_dir
List * locked_list
char * | lock_dir
char * | name
void * | closure
int | lock_error
int | will_wait
int | err
char * | repository
char * | update_dir
List * entries
char ** | argv
int | local
int | aflag

Define Documentation

#define L_ERROR 1

Definition at line 120 of file lock.c.

#define L_LOCKED 2

Definition at line 121 of file lock.c.

#define L_OK 0

Definition at line 119 of file lock.c.

Function Documentation

int Writer_Lock ( list ) [static]

int Writer_Lock ( ) [static]

void clear_lock ( ) [static]

int lock_filesdoneproc | ( | callerdat | ,
 |  | err | ,
 |  | repository | ,
 |  | update_dir | ,
 |  | entries |
 | ) | [static]

char* lock_name | ( | repository | ,
 |  | name |
 | ) | [static]

char* lock_name ( ) [static]

void lock_obtained ( ) [static]

void lock_simple_remove ( ) [static]

void lock_wait ( ) [static]

int readers_exist ( ) [static]

void remove_locks ( ) [static]

int set_lock ( ) [static]

void set_lockers_name ( ) [static]

int set_writelock_proc ( ) [static]

int unlock_proc ( ) [static]

int write_lock ( ) [static]

Variable Documentation

int aflag

Definition at line 897 of file lock.c.

char** argv

Definition at line 895 of file lock.c.

void* closure

Definition at line 532 of file lock.c.

List* entries

Definition at line 875 of file lock.c.

int err

Definition at line 872 of file lock.c.

struct lock global_readlock [static]

Definition at line 125 of file lock.c.

int local

Definition at line 896 of file lock.c.

char* lock_dir

Definition at line 139 of file lock.c.

int lock_error [static]

Definition at line 460 of file lock.c.

List* lock_tree_list [static]

Definition at line 129 of file lock.c.

char* locked_dir [static]

Definition at line 135 of file lock.c.

List* locked_list [static]

Definition at line 136 of file lock.c.

char* lockers_name [static]

Definition at line 107 of file lock.c.

List* locklist [static]

Definition at line 117 of file lock.c.

char* masterlock [static]

Definition at line 116 of file lock.c.

char* name

Definition at line 152 of file lock.c.

char* readlock [static]

Definition at line 110 of file lock.c.

char* repository

Definition at line 873 of file lock.c.

char* update_dir

Definition at line 874 of file lock.c.

int will_wait

Definition at line 719 of file lock.c.

char* writelock [static]

Definition at line 113 of file lock.c.

Generated on Sun Oct 21 12:43:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


log.c File Reference

cvs-1.10/src/log.c File Reference

#include "cvs.h"

Include dependency graph for log.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | datelist
struct | log_data
struct | log_data_and_rcs
struct | option_revlist
struct | revlist

Functions

Dtype log_dirproc ()
int | log_fileproc ()
option_revlist * log_parse_revlist ()
void | log_parse_date ()
void | log_parse_list ()
revlist * log_expand_revlist ()
void | log_free_revlist ()
int | log_version_requested ()
int | log_symbol ()
int | log_count ()
int | log_fix_singledate ()
int | log_count_print ()
void | log_tree ()
void | log_abranch ()
void | log_version ()
int | log_branch ()
int | version_compare ()
int | cvslog (argc, argv) int argc
int | printlock_proc (lock, foo) Node *lock

Variables

const char *const | log_usage []
char ** | argv
const char * | argstring
void * | foo
file_info * finfo
option_revlist * revlist
int | default_branch
RCSNode * rcs
RCSVers * vnode
void * | closure
const char * | ver
int | trunk
char * | dir
char * | repository
char * | update_dir
List * entries
const char * | v2
int | len

Function Documentation

int cvslog | ( | argc | ,
 |  | argv |
 | ) |

void log_abranch ( ) [static]

int log_branch ( ) [static]

int log_count ( ) [static]

int log_count_print ( ) [static]

Dtype log_dirproc ( ) [static]

struct revlist* log_expand_revlist ( ) [static]

int log_fileproc ( ) [static]

int log_fix_singledate ( ) [static]

void log_free_revlist ( ) [static]

void log_parse_date ( ) [static]

void log_parse_list ( ) [static]

struct option_revlist* log_parse_revlist ( ) [static]

int log_symbol ( ) [static]

void log_tree ( ) [static]

void log_version ( ) [static]

int log_version_requested ( ) [static]

Referenced by default_branch().

int printlock_proc | ( | lock | ,
 |  | foo |
 | ) | [static]

int version_compare ( ) [static]

Referenced by default_branch().

Variable Documentation

const char * argstring

Definition at line 579 of file log.c.

char** argv

Definition at line 196 of file log.c.

void* closure

Definition at line 1440 of file log.c.

int default_branch

Definition at line 851 of file log.c.

char* dir

Definition at line 1466 of file log.c.

List* entries

Definition at line 1469 of file log.c.

struct file_info* finfo

Definition at line 633 of file log.c.

void* foo

Definition at line 618 of file log.c.

int len

Definition at line 1486 of file log.c.

const char* const log_usage[] [static]

Initial value:

{
    "Usage: %s %s [-lRhtNb] [-r[revisions]] [-d dates] [-s states]\n",
    "    [-w[logins]] [files...]\n",
    "\t-l\tLocal directory only, no recursion.\n",
    "\t-R\tOnly print name of RCS file.\n",
    "\t-h\tOnly print header.\n",
    "\t-t\tOnly print header and descriptive text.\n",
    "\t-N\tDo not list tags.\n",
    "\t-b\tOnly list revisions on the default branch.\n",
    "\t-r[revisions]\tSpecify revision(s)s to list.\n",
    "\t-d dates\tSpecify dates (D1<D2 for range, D for latest before).\n",
    "\t-s states\tOnly list revisions with specified states.\n",
    "\t-w[logins]\tOnly list revisions checked in by specified logins.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 134 of file log.c.

RCSNode* rcs

Definition at line 1334 of file log.c.

char* repository

Definition at line 1467 of file log.c.

struct revlist * revlist

Definition at line 1333 of file log.c.

int trunk

Definition at line 1336 of file log.c.

char* update_dir

Definition at line 1468 of file log.c.

const char* v2

Definition at line 1485 of file log.c.

RCSVers * ver

Definition at line 1335 of file log.c.

RCSVers* vnode

Definition at line 1067 of file log.c.

Generated on Sun Oct 21 12:43:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


login.c File Reference

cvs-1.10/src/login.c File Reference

#include "cvs.h"
#include "getline.h"

Include dependency graph for login.c:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:43:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


logmsg.c File Reference

cvs-1.10/src/logmsg.c File Reference

#include "cvs.h"
#include "getline.h"

Include dependency graph for logmsg.c:

Include dependency graph

Go to the source code of this file.

Functions

int | find_type ()
int | fmt_proc ()
int | logfile_write ()
int | rcsinfo_proc ()
int | title_proc ()
int | update_logfile_proc ()
void | setup_tmpfile ()
int | editinfo_proc ()
int | verifymsg_proc ()
void | setup_tmpfile (xfp, xprefix, changes) FILE *xfp
void | Update_Logfile (repository, xmessage, xlogfp, xchanges) char *repository
void | fprintf (pipefp,"In directory%s:", hostname)
if (cp==NULL) fprintf(pipefp,"< cannot get working directory
setup_tmpfile (pipefp,"", changes)
void | fprintf (pipefp,"Log Message:\n%s\n", message)
if (logfp!=(FILE *) 0)
free (prog)
return ((pipestatus==-1)||(pipestatus==127))?1
int | verifymsg_proc (repository, script) char *repository

Variables

FILE * | fp
char * | str_list
char * | str_list_format
char * | editinfo_editor
char * | verifymsg_script
Ctype type
char * | prefix
int | col
char * | tag
char * | xprefix
List * changes
void * | closure
char ** | messagep
char * | repository
char * | template
char * | message
char * | xmessage
FILE * | xlogfp
List * xchanges
char * | filter
FILE * | logfp
cp = xgetwd ()
pipestatus = pclose (pipefp)
char * | script

Function Documentation

void Update_Logfile | ( | repository | ,
 |  | xmessage | ,
 |  | xlogfp | ,
 |  | xchanges |
 | ) |

int editinfo_proc ( ) [static]

int find_type ( ) [static]

int fmt_proc ( ) [static]

void fprintf | ( | pipefp | ,
 |  | "Log Message:\n%s\n" | ,
 |  | message |
 | ) |

Referenced by CPersistent::SaveAllSettings(), SccAddFromScc(), SccCheckout(), SccCloseProject(), SccGet(), SccGetProjPath(), SccInitialize(), SccOpenProject(), argv(), bind_and_connect(), callerdat(), convert_hqx_file(), convert_iso(), cvs_process_open(), decodeAppleSingle(), dllglue_main(), dotemplate(), encodeAppleSingle(), fillSemiColonTypes(), getDefaultEncodingPolicy(), gp_getenv_read(), if(), init_sockets(), init_winsock(), isPlainBinary(), listAddCell(), listNew(), lookup_env(), myflush(), n(), os2_start_server(), outputXML(), p(), rcmd(), rcmd_authenticate(), reopen_consoles(), resolve_address(), rootdir(), run_popen(), set_file_type(), usage(), vms_start_server(), wnt_cleanup(), xprefix(), and yylex().

void fprintf | ( | pipefp | ,
 |  | "In directory%s:" | ,
 |  | hostname |
 | ) |

free ( prog )

if ( logfp! = (FILE *) 0 )

Definition at line 838 of file logmsg.c.

00839     {
00840     (void) fprintf (pipefp, "Status:\n");
00841     rewind (logfp);
00842     while ((c = getc (logfp)) != EOF)
00843         (void) putc ((char) c, pipefp);
00844     }

if ( cp = = NULL )

Definition at line 827 of file logmsg.c.

00828                                                    : %s>\n\n",
00829          strerror (errno));
00830     else
00831     {
00832     fprintf (pipefp, "%s\n\n", cp);
00833     free (cp);
00834     }

int logfile_write ( ) [static]

int rcsinfo_proc ( ) [static]

return ( (pipestatus==-1)||(pipestatus==127) )

Definition at line 847 of file logmsg.c.

00847                                                            : 0;
00848 }
00849
00850 /*
00851  * We choose to use the *last* match within the editinfo file for this
00852  * repository.  This allows us to have a global editinfo program for the
00853  * root of some hierarchy, for example, and different ones within different
00854  * sub-directories of the root (like a special checker for changes made to
00855  * the "src" directory versus changes made to the "doc" or "test"
00856  * directories.
00857  */
00858 /* ARGSUSED */
00859 static int
00860 editinfo_proc(repository, editor)
00861     char *repository;
00862     char *editor;
00863 {
00864     /* nothing to do if the last match is the same as this one */
00865     if (editinfo_editor && strcmp (editinfo_editor, editor) == 0)
00866     return (0);
00867     if (editinfo_editor)
00868     free (editinfo_editor);
00869
00870     editinfo_editor = xstrdup (editor);
00871     return (0);
00872 }

setup_tmpfile | ( | pipefp | ,
 |  | "" | ,
 |  | changes |
 | ) |

void setup_tmpfile | ( | xfp | ,
 |  | xprefix | ,
 |  | changes |
 | ) | [static]

void setup_tmpfile ( ) [static]

int title_proc ( ) [static]

int update_logfile_proc ( ) [static]

int verifymsg_proc | ( | repository | ,
 |  | script |
 | ) | [static]

int verifymsg_proc ( ) [static]

Variable Documentation

List * changes

Definition at line 641 of file logmsg.c.

void* closure

Definition at line 557 of file logmsg.c.

int col [static]

Definition at line 35 of file logmsg.c.

cp = xgetwd ()

Definition at line 826 of file logmsg.c.

char* editinfo_editor [static]

Definition at line 26 of file logmsg.c.

char* filter

Definition at line 638 of file logmsg.c.

FILE* fp [static]

Definition at line 23 of file logmsg.c.

FILE* logfp

Definition at line 640 of file logmsg.c.

char* message [static]

Definition at line 639 of file logmsg.c.

char** messagep

Definition at line 174 of file logmsg.c.

pipestatus = pclose (pipefp)

Definition at line 846 of file logmsg.c.

char* prefix [static]

Definition at line 34 of file logmsg.c.

char* repository

Definition at line 392 of file logmsg.c.

char* script

Definition at line 880 of file logmsg.c.

char* str_list [static]

Definition at line 24 of file logmsg.c.

char* str_list_format [static]

Definition at line 25 of file logmsg.c.

char* tag [static]

Definition at line 36 of file logmsg.c.

char* template

Definition at line 476 of file logmsg.c.

Ctype type [static]

Definition at line 28 of file logmsg.c.

char* verifymsg_script [static]

Definition at line 27 of file logmsg.c.

List* xchanges

Definition at line 525 of file logmsg.c.

FILE* xlogfp

Definition at line 524 of file logmsg.c.

char* xmessage

Definition at line 523 of file logmsg.c.

char* xprefix

Definition at line 40 of file logmsg.c.

Generated on Sun Oct 21 12:43:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


main.c File Reference

cvs-1.10/src/main.c File Reference

#include <assert.h>
#include "cvs.h"

Include dependency graph for main.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | cmd

Defines

#define | MAXHOSTNAMELEN 256

Functions

int | gethostname ()
int | set_root_directory (p, ignored) Node *p

Variables

char * | program_name
char * | program_path
char * | command_name
char | hostname [256]
int | use_editor = 1
int | use_cvsrc = 1
int | cvswrite = ! 0
int | really_quiet = 0
int | quiet = 0
int | trace = 0
int | noexec = 0
int | logoff = 0
int | top_level_admin = 0
mode_t | cvsumask = UMASK_DFLT
char * | CurDir
char * | Tmpdir = TMPDIR_DFLT
char * | Editor = EDITOR_DFLT
List * | root_directories = NULL
char * | current_root = NULL
const struct cmd | cmds []
const char *const | usg []
const char *const | cmd_usage []
const char *const | opt_usage []
void * | ignored
char ** | argv
char * | source

Define Documentation

#define MAXHOSTNAMELEN 256

Definition at line 32 of file main.c.

Function Documentation

int gethostname ( )

Referenced by rcmd().

int set_root_directory | ( | p | ,
 |  | ignored |
 | ) | [static]

Variable Documentation

char* CurDir

Definition at line 53 of file main.c.

char* Editor = EDITOR_DFLT

Definition at line 59 of file main.c.

char* Tmpdir = TMPDIR_DFLT

Definition at line 58 of file main.c.

char** argv

Definition at line 435 of file main.c.

const char* const cmd_usage[] [static]

Definition at line 188 of file main.c.

const struct cmd cmds[] [static]

char* command_name

Definition at line 26 of file main.c.

char* current_root = NULL

Definition at line 68 of file main.c.

mode_t cvsumask = UMASK_DFLT

Definition at line 51 of file main.c.

int cvswrite = ! 0

Definition at line 39 of file main.c.

char hostname[ 256 ]

Definition at line 35 of file main.c.

void* ignored

Definition at line 268 of file main.c.

int logoff = 0

Definition at line 44 of file main.c.

int noexec = 0

Definition at line 43 of file main.c.

const char* const opt_usage[] [static]

Definition at line 231 of file main.c.

char* program_name

Definition at line 24 of file main.c.

char* program_path

Definition at line 25 of file main.c.

int quiet = 0

Definition at line 41 of file main.c.

int really_quiet = 0

Definition at line 40 of file main.c.

List* root_directories = NULL

Definition at line 64 of file main.c.

char* source

Definition at line 1157 of file main.c.

int top_level_admin = 0

Definition at line 49 of file main.c.

int trace = 0

Definition at line 42 of file main.c.

int use_cvsrc = 1

Definition at line 38 of file main.c.

int use_editor = 1

Definition at line 37 of file main.c.

const char* const usg[] [static]

Initial value:

{

    "Usage: %s [cvs-options] command [command-options-and-arguments]\n",
    "  where cvs-options are -q, -n, etc.\n",
    "    (specify --help-options for a list of options)\n",
    "  where command is add, admin, etc.\n",
    "    (specify --help-commands for a list of commands\n",
    "     or --help-synonyms for a list of command synonyms)\n",
    "  where command-options-and-arguments depend on the specific command\n",
    "    (specify -H followed by a command name for command-specific help)\n",
    "  Specify --help to receive this message\n",
    "\n",

    "The Concurrent Versions System (CVS) is a tool for version control.\n",

    "For CVS updates and additional information, see\n",
    "    the CVS home page at http://www.cvshome.org/ or\n",
    "    Pascal Molli's CVS site at http://www.loria.fr/~molli/cvs-index.html\n",
    NULL,
}

Definition at line 142 of file main.c.

Generated on Sun Oct 21 12:43:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


mkmodules.c File Reference

cvs-1.10/src/mkmodules.c File Reference

#include "cvs.h"
#include "savecwd.h"
#include "getline.h"

Include dependency graph for mkmodules.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | admin_file

Defines

#define | DBLKSIZ 4096

Functions

int | checkout_file ()
char * | make_tempfile ()
void | rename_rcsfile ()
void | rename_dbmfile ()
void | write_dbmfile ()
int | mkmodules (dir) char *dir
int | init (argc, argv) int argc

Variables

const char *const | loginfo_contents []
const char *const | rcsinfo_contents []
const char *const | editinfo_contents []
const char *const | verifymsg_contents []
const char *const | commitinfo_contents []
const char *const | taginfo_contents []
const char *const | checkoutlist_contents []
const char *const | cvswrappers_contents []
const char *const | notify_contents []
const char *const | modules_contents []
const char *const | config_contents []
const struct admin_file | filelist []
char * | temp
char * | real
char ** | argv

Define Documentation

#define DBLKSIZ 4096

Definition at line 13 of file mkmodules.c.

Function Documentation

int checkout_file ( ) [static]

int init | ( | argc | ,
 |  | argv |
 | ) |

char* make_tempfile ( ) [static]

int mkmodules ( dir )

void rename_dbmfile ( ) [static]

void rename_rcsfile ( ) [static]

void write_dbmfile ( ) [static]

Variable Documentation

char** argv

Definition at line 832 of file mkmodules.c.

const char* const checkoutlist_contents[] [static]

Initial value:

 {
    "# The \"checkoutlist\" file is used to support additional version controlled\n",
    "# administrative files in $CVSROOT/CVSROOT, such as template files.\n",
    "#\n",
    "# The first entry on a line is a filename which will be checked out from\n",
    "# the corresponding RCS file in the $CVSROOT/CVSROOT directory.\n",
    "# The remainder of the line is an error message to use if the file cannot\n",
    "# be checked out.\n",
    "#\n",
    "# File format:\n",
    "#\n",
    "#  [<whitespace>]<filename><whitespace><error message><end-of-line>\n",
    "#\n",
    "# comment lines begin with '#'\n",
    NULL
}

Definition at line 189 of file mkmodules.c.

const char* const commitinfo_contents[] [static]

Initial value:

 {
    "# The \"commitinfo\" file is used to control pre-commit checks.\n",
    "# The filter on the right is invoked with the repository and a list \n",
    "# of files to check.  A non-zero exit of the filter program will \n",
    "# cause the commit to be aborted.\n",
    "#\n",
    "# The first entry on a line is a regular expression which is tested\n",
    "# against the directory that the change is being committed to, relative\n",
    "# to the $CVSROOT.  For the first match that is found, then the remainder\n",
    "# of the line is the name of the filter to run.\n",
    "#\n",
    "# If the repository name does not match any of the regular expressions in this\n",
    "# file, the \"DEFAULT\" line is used, if it is specified.\n",
    "#\n",
    "# If the name \"ALL\" appears as a regular expression it is always used\n",
    "# in addition to the first matching regex or \"DEFAULT\".\n",
    NULL
}

Definition at line 146 of file mkmodules.c.

const char* const config_contents[] [static]

Initial value:

 {
    "# Set this to \"no\" if pserver shouldn't check system users/passwords\n",
    "#SystemAuth=no\n",
    "\n",
    "# Put CVS lock files in this directory rather than directly in the repository.\n",
    "#LockDir=/var/lock/cvs\n",
    "\n",

    "# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top\n",
    "# level of the new working directory when using the `cvs checkout'\n",
    "# command.\n",
    "#TopLevelAdmin=no\n",
    "\n",
    "# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the\n",
    "# history file, or a subset as needed (ie `TMAR' logs all write operations)\n",
    "#LogHistory=TOFEWGCMAR\n",
    NULL
}

Definition at line 279 of file mkmodules.c.

const char* const cvswrappers_contents[] [static]

Initial value:

 {
    "# This file affects handling of files based on their names.\n",
    "#\n",
    "# The -t/-f options allow one to treat directories of files\n",
    "# as a single file, or to transform a file in other ways on\n",
    "# its way in and out of CVS.\n",
    "#\n",
    "# The -m option specifies whether CVS attempts to merge files.\n",
    "#\n",
    "# The -k option specifies keyword expansion (e.g. -kb for binary).\n",
    "#\n",
    "# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)\n",
    "#\n",
    "#  wildcard    [option value][option value]...\n",
    "#\n",
    "#  where option is one of\n",
    "#  -f      from cvs filter     value: path to filter\n",
    "#  -t      to cvs filter       value: path to filter\n",
    "#  -m      update methodology  value: MERGE or COPY\n",
    "#  -k      expansion mode      value: b, o, kkv, &c\n",
    "#\n",
    "#  and value is a single-quote delimited value.\n",
    "# For example:\n",
    "#*.gif -k 'b'\n",
    NULL
}

Definition at line 206 of file mkmodules.c.

const char* const editinfo_contents[] [static]

Initial value:

 {
    "# The \"editinfo\" file is used to allow verification of logging\n",
    "# information.  It works best when a template (as specified in the\n",
    "# rcsinfo file) is provided for the logging procedure.  Given a\n",
    "# template with locations for, a bug-id number, a list of people who\n",
    "# reviewed the code before it can be checked in, and an external\n",
    "# process to catalog the differences that were code reviewed, the\n",
    "# following test can be applied to the code:\n",
    "#\n",
    "#   Making sure that the entered bug-id number is correct.\n",
    "#   Validating that the code that was reviewed is indeed the code being\n",
    "#       checked in (using the bug-id number or a seperate review\n",
    "#       number to identify this particular code set.).\n",
    "#\n",
    "# If any of the above test failed, then the commit would be aborted.\n",
    "#\n",
    "# Actions such as mailing a copy of the report to each reviewer are\n",
    "# better handled by an entry in the loginfo file.\n",
    "#\n",
    "# One thing that should be noted is the the ALL keyword is not\n",
    "# supported.  There can be only one entry that matches a given\n",
    "# repository.\n",
    NULL
}

Definition at line 96 of file mkmodules.c.

const struct admin_file filelist[] [static]

Definition at line 303 of file mkmodules.c.

const char* const loginfo_contents[] [static]

Initial value:

 {
    "# The \"loginfo\" file controls where \"cvs commit\" log information\n",
    "# is sent.  The first entry on a line is a regular expression which must match\n",
    "# the directory that the change is being made to, relative to the\n",
    "# $CVSROOT.  If a match is found, then the remainder of the line is a filter\n",
    "# program that should expect log information on its standard input.\n",
    "#\n",
    "# If the repository name does not match any of the regular expressions in this\n",
    "# file, the \"DEFAULT\" line is used, if it is specified.\n",
    "#\n",
    "# If the name ALL appears as a regular expression it is always used\n",
    "# in addition to the first matching regex or DEFAULT.\n",
    "#\n",
    "# You may specify a format string as part of the\n",
    "# filter.  The string is composed of a `%' followed\n",
    "# by a single format character, or followed by a set of format\n",
    "# characters surrounded by `{' and `}' as separators.  The format\n",
    "# characters are:\n",
    "#\n",
    "#   s = file name\n",
    "#   V = old version number (pre-checkin)\n",
    "#   v = new version number (post-checkin)\n",
    "#\n",
    "# For example:\n",
    "#DEFAULT (echo \"\"; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog\n",
    "# or\n",
    "#DEFAULT (echo \"\"; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog\n",
    NULL
}

Definition at line 49 of file mkmodules.c.

const char* const modules_contents[] [static]

Initial value:

 {
    "# Three different line formats are valid:\n",
    "#  key -a    aliases...\n",
    "#  key [options] directory\n",
    "#  key [options] directory files...\n",
    "#\n",
    "# Where \"options\" are composed of:\n",
    "#  -i prog     Run \"prog\" on \"cvs commit\" from top-level of module.\n",
    "#  -o prog     Run \"prog\" on \"cvs checkout\" of module.\n",
    "#  -e prog     Run \"prog\" on \"cvs export\" of module.\n",
    "#  -t prog     Run \"prog\" on \"cvs rtag\" of module.\n",
    "#  -u prog     Run \"prog\" on \"cvs update\" of module.\n",
    "#  -d dir      Place module in directory \"dir\" instead of module name.\n",
    "#  -l      Top-level directory only -- do not recurse.\n",
    "#\n",
    "# NOTE:  If you change any of the \"Run\" options above, you'll have to\n",
    "# release and re-checkout any working directories of these modules.\n",
    "#\n",
    "# And \"directory\" is a path to a directory relative to $CVSROOT.\n",
    "#\n",
    "# The \"-a\" option specifies an alias.  An alias is interpreted as if\n",
    "# everything on the right of the \"-a\" had been typed on the command line.\n",
    "#\n",
    "# You can encode a module within a module by using the special '&'\n",
    "# character to interpose another module into the current module.  This\n",
    "# can be useful for creating a module that consists of many directories\n",
    "# spread out over the entire source repository.\n",
    NULL
}

Definition at line 249 of file mkmodules.c.

const char* const notify_contents[] [static]

Initial value:

 {
    "# The \"notify\" file controls where notifications from watches set by\n",
    "# \"cvs watch add\" or \"cvs edit\" are sent.  The first entry on a line is\n",
    "# a regular expression which is tested against the directory that the\n",
    "# change is being made to, relative to the $CVSROOT.  If it matches,\n",
    "# then the remainder of the line is a filter program that should contain\n",
    "# one occurrence of %s for the user to notify, and information on its\n",
    "# standard input.\n",
    "#\n",
    "# \"ALL\" or \"DEFAULT\" can be used in place of the regular expression.\n",
    "#\n",
    "# For example:\n",
    "#ALL mail %s -s \"CVS notification\"\n",
    NULL
}

Definition at line 233 of file mkmodules.c.

const char* const rcsinfo_contents[] [static]

Initial value:

 {
    "# The \"rcsinfo\" file is used to control templates with which the editor\n",
    "# is invoked on commit and import.\n",
    "#\n",
    "# The first entry on a line is a regular expression which is tested\n",
    "# against the directory that the change is being made to, relative to the\n",
    "# $CVSROOT.  For the first match that is found, then the remainder of the\n",
    "# line is the name of the file that contains the template.\n",
    "#\n",
    "# If the repository name does not match any of the regular expressions in this\n",
    "# file, the \"DEFAULT\" line is used, if it is specified.\n",
    "#\n",
    "# If the name \"ALL\" appears as a regular expression it is always used\n",
    "# in addition to the first matching regex or \"DEFAULT\".\n",
    NULL
}

Definition at line 79 of file mkmodules.c.

char* real

Definition at line 785 of file mkmodules.c.

const char* const taginfo_contents[] [static]

Initial value:

 {
    "# The \"taginfo\" file is used to control pre-tag checks.\n",
    "# The filter on the right is invoked with the following arguments:\n",
    "#\n",
    "# $1 -- tagname\n",
    "# $2 -- operation \"add\" for tag, \"mov\" for tag -F, and \"del\" for tag -d\n",
    "# $3 -- repository\n",
    "# $4->  file revision [file revision ...]\n",
    "#\n",
    "# A non-zero exit of the filter program will cause the tag to be aborted.\n",
    "#\n",
    "# The first entry on a line is a regular expression which is tested\n",
    "# against the directory that the change is being committed to, relative\n",
    "# to the $CVSROOT.  For the first match that is found, then the remainder\n",
    "# of the line is the name of the filter to run.\n",
    "#\n",
    "# If the repository name does not match any of the regular expressions in this\n",
    "# file, the \"DEFAULT\" line is used, if it is specified.\n",
    "#\n",
    "# If the name \"ALL\" appears as a regular expression it is always used\n",
    "# in addition to the first matching regex or \"DEFAULT\".\n",
    NULL
}

Definition at line 165 of file mkmodules.c.

int temp

Definition at line 490 of file wrapper.c.

const char* const verifymsg_contents[] [static]

Initial value:

 {
    "# The \"verifymsg\" file is used to allow verification of logging\n",
    "# information.  It works best when a template (as specified in the\n",
    "# rcsinfo file) is provided for the logging procedure.  Given a\n",
    "# template with locations for, a bug-id number, a list of people who\n",
    "# reviewed the code before it can be checked in, and an external\n",
    "# process to catalog the differences that were code reviewed, the\n",
    "# following test can be applied to the code:\n",
    "#\n",
    "#   Making sure that the entered bug-id number is correct.\n",
    "#   Validating that the code that was reviewed is indeed the code being\n",
    "#       checked in (using the bug-id number or a seperate review\n",
    "#       number to identify this particular code set.).\n",
    "#\n",
    "# If any of the above test failed, then the commit would be aborted.\n",
    "#\n",
    "# Actions such as mailing a copy of the report to each reviewer are\n",
    "# better handled by an entry in the loginfo file.\n",
    "#\n",
    "# One thing that should be noted is the the ALL keyword is not\n",
    "# supported.  There can be only one entry that matches a given\n",
    "# repository.\n",
    NULL
}

Definition at line 121 of file mkmodules.c.

Generated on Sun Oct 21 12:43:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


modules.c File Reference

cvs-1.10/src/modules.c File Reference

#include <assert.h>
#include "cvs.h"
#include "savecwd.h"

Include dependency graph for modules.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | sortrec

Defines

#define | CVSMODULE_OPTS "+ad:i:lo:e:s:t:u:"
#define | CVSMODULE_SPEC '&'

Functions

int | sort_order ()
void | save_d ()
DBM * | open_module ()
void | close_module (db) DBM *db
int | sort_order (l, r) const char *l

Variables

char * | mname
enum mtype | m_type
char * | msg
CALLBACKPROC callback_proc
char * | where
int | shorten
int | local_specified
int | run_module_prog
char * | extra_arg
int | s_max = 0
int | s_count = 0
int | Status
char | def_status [] = "NONE"
const char * | r
int | ks
char * | d
int | ds

Define Documentation

#define CVSMODULE_OPTS "+ad:i:lo:e:s:t:u:"

Definition at line 33 of file modules.c.

#define CVSMODULE_SPEC '&'

Definition at line 36 of file modules.c.

Function Documentation

void close_module ( db )

DBM* open_module ( )

Definition at line 63 of file modules.c.

00064 {
00065     char *mfile;
00066     DBM *retval;
00067
00068     if (CVSroot_original == NULL)
00069     {
00070     error (0, 0, "must set the CVSROOT environment variable");
00071     error (1, 0, "or specify the '-d' global option");
00072     }
00073     mfile = xmalloc (strlen (CVSroot_directory) + sizeof (CVSROOTADM)
00074              + sizeof (CVSROOTADM_MODULES) + 20);
00075     (void) sprintf (mfile, "%s/%s/%s", CVSroot_directory,
00076             CVSROOTADM, CVSROOTADM_MODULES);
00077     retval = dbm_open (mfile, O_RDONLY, 0666);
00078     free (mfile);
00079     return retval;
00080 }

void save_d ( ) [static]

int sort_order | ( | l | ,
 |  | r |
 | ) | const [static]

int sort_order ( ) [static]

Variable Documentation

int Status [static]

Definition at line 805 of file modules.c.

CALLBACKPROC callback_proc

Definition at line 105 of file modules.c.

char* d

Definition at line 838 of file modules.c.

char def_status[] = "NONE" [static]

Definition at line 809 of file modules.c.

int ds

Definition at line 839 of file modules.c.

char* extra_arg

Definition at line 110 of file modules.c.

int ks

Definition at line 837 of file modules.c.

int local_specified

Definition at line 108 of file modules.c.

enum mtype m_type

Definition at line 103 of file modules.c.

char* mname

Definition at line 102 of file modules.c.

char* msg

Definition at line 104 of file modules.c.

const char* r

Definition at line 819 of file modules.c.

int run_module_prog

Definition at line 109 of file modules.c.

int s_count = 0 [static]

Definition at line 803 of file modules.c.

int s_max = 0 [static]

Definition at line 802 of file modules.c.

int shorten

Definition at line 107 of file modules.c.

char* where

Definition at line 106 of file modules.c.

Generated on Sun Oct 21 12:43:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


myndbm.c File Reference

cvs-1.10/src/myndbm.c File Reference

#include <assert.h>
#include "cvs.h"
#include "getline.h"

Include dependency graph for myndbm.c:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:43:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


myndbm.h File Reference

cvs-1.10/src/myndbm.h File Reference

Go to the source code of this file.

Generated on Sun Oct 21 12:43:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


no_diff.c File Reference

cvs-1.10/src/no_diff.c File Reference

#include "cvs.h"

Include dependency graph for no_diff.c:

Include dependency graph

Go to the source code of this file.

Functions

int No_Difference (finfo, vers) struct file_info *finfo

Variables

Vers_TS * vers

Function Documentation

int No_Difference | ( | finfo | ,
 |  | vers |
 | ) |

Variable Documentation

Vers_TS* vers

Definition at line 22 of file no_diff.c.

Generated on Sun Oct 21 12:43:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


parseinfo.c File Reference

cvs-1.10/src/parseinfo.c File Reference

#include "cvs.h"
#include "getline.h"
#include <assert.h>

Include dependency graph for parseinfo.c:

Include dependency graph

Go to the source code of this file.

Functions

int | Parse_Info (infofile, repository, callproc, all) char *infofile

Variables

char * | logHistory
char * | repository
CALLPROC callproc
int | all

Function Documentation

int Parse_Info | ( | infofile | ,
 |  | repository | ,
 |  | callproc | ,
 |  | all |
 | ) |

Variable Documentation

int all

Definition at line 27 of file parseinfo.c.

CALLPROC callproc

Definition at line 26 of file parseinfo.c.

char* logHistory

Definition at line 13 of file parseinfo.c.

char* repository

Definition at line 25 of file parseinfo.c.

Generated on Sun Oct 21 12:43:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


patch.c File Reference

cvs-1.10/src/patch.c File Reference

#include "cvs.h"
#include "getline.h"

Include dependency graph for patch.c:

Include dependency graph

Go to the source code of this file.

Functions

RETSIGTYPE | patch_cleanup ()
Dtype patch_dirproc ()
int | patch_fileproc ()
int | patch_proc ()
int | patch (argc, argv) int argc

Variables

int | force_tag_match = 1
int | patch_short = 0
int | toptwo_diffs = 0
int | local = 0
char * | options = NULL
char * | rev1 = NULL
int | rev1_validated = 0
char * | rev2 = NULL
int | rev2_validated = 0
char * | date1 = NULL
char * | date2 = NULL
char * | tmpfile1 = NULL
char * | tmpfile2 = NULL
char * | tmpfile3 = NULL
int | unidiff = 0
const char *const | patch_usage []
char ** | argv
char * | xwhere
char * | mwhere
char * | mfile
int | shorten
int | local_specified
char * | mname
char * | msg
file_info * finfo
char * | dir
char * | repos
char * | update_dir
List * entries

Function Documentation

int patch | ( | argc | ,
 |  | argv |
 | ) |

RETSIGTYPE patch_cleanup ( ) [static]

Dtype patch_dirproc ( ) [static]

int patch_fileproc ( ) [static]

int patch_proc ( ) [static]

Variable Documentation

char** argv

Definition at line 270 of file patch.c.

char* date1 = NULL [static]

Definition at line 36 of file patch.c.

char* date2 = NULL [static]

Definition at line 37 of file patch.c.

char* dir

Definition at line 755 of file patch.c.

List* entries

Definition at line 758 of file patch.c.

struct file_info* finfo

Definition at line 372 of file patch.c.

int force_tag_match = 1 [static]

Definition at line 27 of file patch.c.

int local = 0 [static]

Definition at line 30 of file patch.c.

int local_specified

Definition at line 275 of file patch.c.

char* mfile

Definition at line 273 of file patch.c.

char* mname

Definition at line 276 of file patch.c.

char* msg

Definition at line 277 of file patch.c.

char* mwhere

Definition at line 272 of file patch.c.

char* options = NULL [static]

Definition at line 31 of file patch.c.

int patch_short = 0 [static]

Definition at line 28 of file patch.c.

const char* const patch_usage[] [static]

Initial value:

{
    "Usage: %s %s [-flR] [-c|-u] [-s|-t] [-V %%d]\n",
    "    -r rev|-D date [-r rev2 | -D date2] modules...\n",
    "\t-f\tForce a head revision match if tag/date not found.\n",
    "\t-l\tLocal directory only, not recursive\n",
    "\t-R\tProcess directories recursively.\n",
    "\t-c\tContext diffs (default)\n",
    "\t-u\tUnidiff format.\n",
    "\t-s\tShort patch - one liner per file.\n",
    "\t-t\tTop two diffs - last change made to the file.\n",
    "\t-D date\tDate.\n",
    "\t-r rev\tRevision - symbolic or numeric.\n",
    "\t-V vers\tUse RCS Version \"vers\" for keyword expansion.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 43 of file patch.c.

char* repos

Definition at line 756 of file patch.c.

char* rev1 = NULL [static]

Definition at line 32 of file patch.c.

int rev1_validated = 0 [static]

Definition at line 33 of file patch.c.

char* rev2 = NULL [static]

Definition at line 34 of file patch.c.

int rev2_validated = 0 [static]

Definition at line 35 of file patch.c.

int shorten

Definition at line 274 of file patch.c.

char* tmpfile1 = NULL [static]

Definition at line 38 of file patch.c.

char* tmpfile2 = NULL [static]

Definition at line 39 of file patch.c.

char* tmpfile3 = NULL [static]

Definition at line 40 of file patch.c.

int toptwo_diffs = 0 [static]

Definition at line 29 of file patch.c.

int unidiff = 0 [static]

Definition at line 41 of file patch.c.

char* update_dir

Definition at line 757 of file patch.c.

char* xwhere

Definition at line 271 of file patch.c.

Generated on Sun Oct 21 12:43:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcs.c File Reference

cvs-1.10/src/rcs.c File Reference

#include <assert.h>
#include "cvs.h"
#include "edit.h"
#include "hardlink.h"

Include dependency graph for rcs.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | linevector
struct | rcsbuffer

Defines

#define | STREQ(a, b) ((a)[0] == (b)[0] && strcmp ((a), (b)) == 0)
#define | whitespace(c) (spacetab[(unsigned char)c] != 0)
#define | RCSBUF_BUFSIZE (8192)
#define | my_whitespace(c) (my_spacetab[(unsigned char)c] != 0)
#define | KEYWORD_INIT(s) (s), sizeof (s) - 1
#define | LARGEST_FWRITE 8192
#define | CMP_BUF_SIZE (8 * 1024)

Enumerations

enum kflag {
KFLAG_KV = 0, KFLAG_KVL, KFLAG_K, KFLAG_V,
KFLAG_O, KFLAG_B
}
enum | rcs_delta_op { RCS_ANNOTATE, RCS_FETCH }
enum keyword {
KEYWORD_AUTHOR = 0, KEYWORD_DATE, KEYWORD_HEADER, KEYWORD_ID,
KEYWORD_LOCKER, KEYWORD_LOG, KEYWORD_NAME, KEYWORD_RCSFILE,
KEYWORD_REVISION, KEYWORD_SOURCE, KEYWORD_STATE
}

Functions

RCSNode * RCS_parsercsfile_i ()
char * | RCS_getdatebranch ()
void | rcsbuf_open ()
void | rcsbuf_close ()
int | rcsbuf_getkey ()
int | rcsbuf_getrevnum ()
char * | rcsbuf_fill ()
int | rcsbuf_valcmp ()
char * | rcsbuf_valcopy ()
void | rcsbuf_valpolish ()
void | rcsbuf_valpolish_internal ()
unsigned long | rcsbuf_ftell ()
void | rcsbuf_get_buffered ()
void | rcsbuf_cache ()
void | rcsbuf_cache_close ()
void | rcsbuf_cache_open ()
int | checkmagic_proc ()
void | do_branches ()
void | do_symbols ()
void | do_locks ()
void | free_rcsnode_contents ()
void | free_rcsvers_contents ()
void | rcsvers_delproc ()
char * | translate_symtag ()
char * | RCS_addbranch ()
char * | truncate_revnum_in_place ()
char * | truncate_revnum ()
char * | printable_date ()
char * | escape_keyword_value ()
void | expand_keywords ()
void | cmp_file_buffer ()
void | RCS_deltas ()
RCSVers * getdelta ()
Deltatext * RCS_getdeltatext ()
void | freedeltatext ()
void | RCS_putadmin ()
void | RCS_putdtree ()
void | RCS_putdesc ()
void | putdelta ()
int | putrcsfield_proc ()
int | putsymbol_proc ()
void | RCS_copydeltas ()
int | count_delta_actions ()
void | putdeltatext ()
FILE * | rcs_internal_lockfile ()
void | rcs_internal_unlockfile ()
char * | rcs_lockfilename ()
RCSNode * | RCS_parse (file, repos) const char *file
void | rcsbuf_open (rcsbuf, fp, filename, pos) struct rcsbuffer *rcsbuf
void | rcsbuf_cache (rcs, rcsbuf) RCSNode *rcs
char * | RCS_magicrev (rcs, rev) RCSNode *rcs
char * | printable_date (rcs_date) const char *rcs_date
RCSVers * RCS_findlock_or_tip (rcs) RCSNode *rcs
char * | max_rev (branchnode) const RCSVers *branchnode
int | RCS_cmp_file (rcs, rev, options, filename) RCSNode *rcs
int | findtag (node, arg) Node *node
void | linevector_init ()
void | linevector_init (vec) struct linevector *vec
int | linevector_add (vec, text, len, vers, pos) struct linevector *vec
void | linevector_delete (vec, pos, nlines) struct linevector *vec
void | linevector_copy (to, from) struct linevector *to
void | linevector_free (vec) struct linevector *vec
char * | month_printname (month) char *month
int | apply_rcs_changes (lines, diffbuf, difflen, name, addvers, delvers) struct linevector *lines
int | putlock_proc (symnode, fp) Node *symnode
int | annotate_fileproc ()
int | annotate_fileproc (callerdat, finfo) void *callerdat
int | annotate (argc, argv) int argc

Variables

int | preserve_perms = 0
const char *const | kflags []
const char | spacetab []
char * | rcs_lockfile
int | rcs_lockfd = -1
const char * | repos
const char * | rcsfile
FILE ** | pfp
rcsbuffer * rcsbufp
int | toattic
size_t | rcsbuf_buffer_size = 0
int | rcsbuf_inuse
FILE * | fp
const char * | filename
unsigned long | pos
char ** | keyp
char ** | valp
char ** | revp
char * | ptr
char * | val
int | polish
size_t * | lenp
char * | to
const char * | from
char ** | datap
rcsbuffer cached_rcsbuf
rcsbuffer * rcsbuf
rcsbuffer * prcsbuf
char * | tag = NULL
char * | date = NULL
int | force_tag_match
int * | simple_tag
char * | symtag
char * | rev
void * | closure
char * | target
char * | branch
* date2
int | fudge
char * | expand
const struct rcs_keyword | keywords []
int * | free_value
RCSVers * ver
const char * | name
const char * | log
size_t | loglen
char * | buf
size_t | len
char ** | retbuf
size_t * | retlen
char * | workfile
char * | nametag
char * | options
char * | sout
RCSCHECKOUTPROC | pfn
void * | callerdat
char * | s
char * | message
int | flags
const char * | buffer
int | lock_quiet
int | unlock_quiet
char * | user
void * | arg
char * | tag1
char * | tag2
int | inclusive
const char * | text
RCSVers * vers
unsigned int | nlines
const char * | diffbuf
size_t | difflen
RCSVers * addvers
RCSVers * delvers
char * | textbuf
size_t | textlen
char * | version
enum rcs_delta_op | op
void * | fparg
void * | vfp
Deltatext * d
FILE * | fin
rcsbuffer * rcsbufin
FILE * | fout
Deltatext * newdtext
char * | insertpt
void * | ignore
file_info * finfo
char ** | argv
RCSNode * rcs

Define Documentation

#define CMP_BUF_SIZE (8 * 1024)

#define KEYWORD_INIT ( s ) (s), sizeof (s) - 1

Definition at line 3350 of file rcs.c.

Referenced by keywords().

#define LARGEST_FWRITE 8192

#define RCSBUF_BUFSIZE (8192)

#define STREQ | ( | a,
 |  | b | ) | ((a)[0] == (b)[0] && strcmp ((a), (b)) == 0)

Definition at line 126 of file rcs.c.

#define my_whitespace ( c ) (my_spacetab[(unsigned char)c] != 0)

#define whitespace ( c ) (spacetab[(unsigned char)c] != 0)

Definition at line 155 of file rcs.c.

Referenced by revp(), to(), and val().

Enumeration Type Documentation

enum keyword

Enumeration values:
KEYWORD_AUTHOR
KEYWORD_DATE
KEYWORD_HEADER
KEYWORD_ID
KEYWORD_LOCKER
KEYWORD_LOG
KEYWORD_NAME
KEYWORD_RCSFILE
KEYWORD_REVISION
KEYWORD_SOURCE
KEYWORD_STATE

Definition at line 3366 of file rcs.c.

03367 {
03368     KEYWORD_AUTHOR = 0,
03369     KEYWORD_DATE,
03370     KEYWORD_HEADER,
03371     KEYWORD_ID,
03372     KEYWORD_LOCKER,
03373     KEYWORD_LOG,
03374     KEYWORD_NAME,
03375     KEYWORD_RCSFILE,
03376     KEYWORD_REVISION,
03377     KEYWORD_SOURCE,
03378     KEYWORD_STATE
03379 };

enum kflag

Enumeration values:
KFLAG_KV
KFLAG_KVL
KFLAG_K
KFLAG_V
KFLAG_O
KFLAG_B

Definition at line 23 of file rcs.c.

00023 { KFLAG_KV = 0, KFLAG_KVL, KFLAG_K, KFLAG_V, KFLAG_O, KFLAG_B };

enum rcs_delta_op

Enumeration values:
RCS_ANNOTATE
RCS_FETCH

Definition at line 95 of file rcs.c.

00095 {RCS_ANNOTATE, RCS_FETCH};

Function Documentation

char* RCS_addbranch ( ) [static]

int RCS_cmp_file | ( | rcs | ,
 |  | rev | ,
 |  | options | ,
 |  | filename |
 | ) |

void RCS_copydeltas ( ) [static]

void RCS_deltas ( ) [static]

RCSVers* RCS_findlock_or_tip ( rcs ) [static]

char* RCS_getdatebranch ( ) [static]

Deltatext* RCS_getdeltatext ( ) [static]

char* RCS_magicrev | ( | rcs | ,
 |  | rev |
 | ) |

RCSNode* RCS_parse | ( | file | ,
 |  | repos |
 | ) | const

RCSNode* RCS_parsercsfile_i ( ) [static]

void RCS_putadmin ( ) [static]

void RCS_putdesc ( ) [static]

void RCS_putdtree ( ) [static]

int annotate | ( | argc | ,
 |  | argv |
 | ) |

int annotate_fileproc | ( | callerdat | ,
 |  | finfo |
 | ) | [static]

int annotate_fileproc ( ) [static]

int apply_rcs_changes | ( | lines | ,
 |  | diffbuf | ,
 |  | difflen | ,
 |  | name | ,
 |  | addvers | ,
 |  | delvers |
 | ) | [static]

int checkmagic_proc ( ) [static]

void cmp_file_buffer ( ) [static]

int count_delta_actions ( ) [static]

void do_branches ( ) [static]

void do_locks ( ) [static]

void do_symbols ( ) [static]

char* escape_keyword_value ( ) [static]

void expand_keywords ( ) [static]

int findtag | ( | node | ,
 |  | arg |
 | ) | [static]

void free_rcsnode_contents ( ) [static]

void free_rcsvers_contents ( ) [static]

void freedeltatext ( ) [static]

RCSVers* getdelta ( ) [static]

int linevector_add | ( | vec | ,
 |  | text | ,
 |  | len | ,
 |  | vers | ,
 |  | pos |
 | ) | [static]

void linevector_copy | ( | to | ,
 |  | from |
 | ) | [static]

void linevector_delete | ( | vec | ,
 |  | pos | ,
 |  | nlines |
 | ) | [static]

void linevector_free ( vec ) [static]

void linevector_init ( vec ) [static]

void linevector_init ( ) [static]

char* max_rev ( branchnode ) const [static]

char* month_printname ( month ) [static]

char* printable_date ( rcs_date ) const [static]

char* printable_date ( ) [static]

void putdelta ( ) [static]

void putdeltatext ( ) [static]

int putlock_proc | ( | symnode | ,
 |  | fp |
 | ) | [static]

int putrcsfield_proc ( ) [static]

int putsymbol_proc ( ) [static]

FILE* rcs_internal_lockfile ( ) [static]

void rcs_internal_unlockfile ( ) [static]

char* rcs_lockfilename ( ) [static]

void rcsbuf_cache | ( | rcs | ,
 |  | rcsbuf |
 | ) | [static]

void rcsbuf_cache ( ) [static]

void rcsbuf_cache_close ( ) [static]

void rcsbuf_cache_open ( ) [static]

Referenced by loglen().

void rcsbuf_close ( ) [static]

char* rcsbuf_fill ( ) [static]

Referenced by revp().

unsigned long rcsbuf_ftell ( ) [static]

Referenced by prcsbuf().

void rcsbuf_get_buffered ( ) [static]

int rcsbuf_getkey ( ) [static]

int rcsbuf_getrevnum ( ) [static]

void rcsbuf_open | ( | rcsbuf | ,
 |  | fp | ,
 |  | filename | ,
 |  | pos |
 | ) | [static]

void rcsbuf_open ( ) [static]

int rcsbuf_valcmp ( ) [static]

char* rcsbuf_valcopy ( ) [static]

void rcsbuf_valpolish ( ) [static]

void rcsbuf_valpolish_internal ( ) [static]

void rcsvers_delproc ( ) [static]

char* translate_symtag ( ) [static]

char* truncate_revnum ( ) [static]

char* truncate_revnum_in_place ( ) [static]

Variable Documentation

RCSVers* addvers

Definition at line 6831 of file rcs.c.

void* arg

Definition at line 5998 of file rcs.c.

char** argv

Definition at line 8455 of file rcs.c.

const char* branch

Definition at line 4672 of file rcs.c.

Referenced by default_branch().

char* buf

Definition at line 3490 of file rcs.c.

const char* buffer

Definition at line 5521 of file rcs.c.

struct rcsbuffer cached_rcsbuf [static]

Definition at line 1860 of file rcs.c.

void* callerdat

Definition at line 3954 of file rcs.c.

void* closure

Definition at line 2428 of file rcs.c.

Deltatext* d

Definition at line 7915 of file rcs.c.

char** datap

Definition at line 1846 of file rcs.c.

char* date = NULL

Definition at line 8397 of file rcs.c.

* date2

Definition at line 3001 of file rcs.c.

RCSVers* delvers

Definition at line 6832 of file rcs.c.

const char * diffbuf

Definition at line 6958 of file rcs.c.

size_t difflen

Definition at line 6959 of file rcs.c.

enum kflag expand

Definition at line 3489 of file rcs.c.

const char* filename

Definition at line 5435 of file rcs.c.

FILE* fin

Definition at line 7948 of file rcs.c.

struct file_info* finfo

Definition at line 8404 of file rcs.c.

int flags

Definition at line 4802 of file rcs.c.

int force_tag_match

Definition at line 2826 of file rcs.c.

FILE* fout

Definition at line 7950 of file rcs.c.

FILE* fp

Definition at line 7896 of file rcs.c.

void* fparg

Definition at line 7656 of file rcs.c.

int* free_value

Definition at line 3406 of file rcs.c.

struct linevector * from

Definition at line 6742 of file rcs.c.

int fudge

Definition at line 3024 of file rcs.c.

void* ignore

Definition at line 8097 of file rcs.c.

int inclusive

Definition at line 6032 of file rcs.c.

char * insertpt

Definition at line 8326 of file rcs.c.

char ** keyp

Definition at line 7361 of file rcs.c.

const struct rcs_keyword keywords[] [static]

Initial value:

{
    { ( "Author" ), sizeof ( "Author" ) - 1 },
    { ( "Date" ), sizeof ( "Date" ) - 1 },
    { ( "Header" ), sizeof ( "Header" ) - 1 },
    { ( "Id" ), sizeof ( "Id" ) - 1 },
    { ( "Locker" ), sizeof ( "Locker" ) - 1 },
    { ( "Log" ), sizeof ( "Log" ) - 1 },
    { ( "Name" ), sizeof ( "Name" ) - 1 },
    { ( "RCSfile" ), sizeof ( "RCSfile" ) - 1 },
    { ( "Revision" ), sizeof ( "Revision" ) - 1 },
    { ( "Source" ), sizeof ( "Source" ) - 1 },
    { ( "State" ), sizeof ( "State" ) - 1 },
    { NULL, 0 }
}

Definition at line 3351 of file rcs.c.

const char* const kflags[] [static]

Initial value:

  {"kv", "kvl", "k", "v", "o", "b", (char *) NULL}

Definition at line 21 of file rcs.c.

size_t* len

Definition at line 7038 of file rcs.c.

size_t* lenp

Definition at line 1847 of file rcs.c.

int lock_quiet

Definition at line 5692 of file rcs.c.

char ** log

Definition at line 7039 of file rcs.c.

size_t * loglen

Definition at line 7040 of file rcs.c.

char* message

Definition at line 4800 of file rcs.c.

const char* name

Definition at line 6830 of file rcs.c.

Referenced by CreateMainMenubar(), and CCustInvertTable::Initialize().

char* nametag

Definition at line 3950 of file rcs.c.

Deltatext * newdtext

Definition at line 8325 of file rcs.c.

unsigned int nlines

Definition at line 6720 of file rcs.c.

enum rcs_delta_op op

Definition at line 7036 of file rcs.c.

char* options

Definition at line 5434 of file rcs.c.

RCSCHECKOUTPROC pfn

Definition at line 3953 of file rcs.c.

FILE ** pfp

Definition at line 1900 of file rcs.c.

int polish

Definition at line 1598 of file rcs.c.

unsigned int pos

Definition at line 6719 of file rcs.c.

struct rcsbuffer* prcsbuf

Definition at line 1901 of file rcs.c.

int preserve_perms = 0

Definition at line 16 of file rcs.c.

char* ptr

Definition at line 1493 of file rcs.c.

RCSNode* rcs

Definition at line 8535 of file rcs.c.

int rcs_lockfd = -1 [static]

Definition at line 158 of file rcs.c.

char* rcs_lockfile [static]

Definition at line 157 of file rcs.c.

struct rcsbuffer * rcsbuf

Definition at line 7580 of file rcs.c.

size_t rcsbuf_buffer_size = 0 [static]

Definition at line 975 of file rcs.c.

int rcsbuf_inuse [static]

Definition at line 979 of file rcs.c.

struct rcsbuffer* rcsbufin

Definition at line 7949 of file rcs.c.

struct rcsbuffer* rcsbufp

Definition at line 429 of file rcs.c.

char * rcsfile

Definition at line 8260 of file rcs.c.

const char* repos

Definition at line 186 of file rcs.c.

char ** retbuf

Definition at line 6960 of file rcs.c.

size_t * retlen

Definition at line 6961 of file rcs.c.

char* rev

Definition at line 8534 of file rcs.c.

char** revp

Definition at line 1418 of file rcs.c.

uInt s

Definition at line 385 of file inftrees.c.

int * simple_tag

Definition at line 2228 of file rcs.c.

char* sout

Definition at line 3952 of file rcs.c.

const char spacetab[] [static]

Initial value:

 {
        0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}

Definition at line 136 of file rcs.c.

char* symtag

Definition at line 2226 of file rcs.c.

char* tag = NULL

Definition at line 8396 of file rcs.c.

char* tag1

Definition at line 6030 of file rcs.c.

char* tag2

Definition at line 6031 of file rcs.c.

char* target

Definition at line 2733 of file rcs.c.

char ** text

Definition at line 7037 of file rcs.c.

char* textbuf

Definition at line 6956 of file rcs.c.

size_t textlen

Definition at line 6957 of file rcs.c.

char* to

Definition at line 1625 of file rcs.c.

int toattic

Definition at line 620 of file rcs.c.

int unlock_quiet

Definition at line 5807 of file rcs.c.

char* user

Definition at line 5943 of file rcs.c.

char* val

Definition at line 2037 of file rcs.c.

Referenced by UWidget::AddPage(), UWidget::AddTooltip(), UWidget::OnInitWidget(), UWidget::OnListInsert(), LPseudoWinAttachment::SearchWidID(), LPseudoWinAttachment::SetPageValue(), and UCmdTarget::UCmdTarget().

char ** valp

Definition at line 7362 of file rcs.c.

RCSVers* ver

Definition at line 3485 of file rcs.c.

RCSVers* vers

Definition at line 6630 of file rcs.c.

const char * version

Definition at line 142 of file inflate.c.

void* vfp

Definition at line 7688 of file rcs.c.

char * workfile

Definition at line 645 of file rcscmds.c.

Generated on Sun Oct 21 12:43:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcs.h File Reference

cvs-1.10/src/rcs.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | deltatext
struct | rcsnode
struct | rcsversnode

Defines

#define | RCS_MERGE_PAT_1 "<<<<<<< "
#define | RCS_MERGE_PAT_2 "=======\n"
#define | RCS_MERGE_PAT_3 ">>>>>>> "
#define | RCSEXT ",v"
#define | RCSPAT "*,v"
#define | RCSHEAD "head"
#define | RCSBRANCH "branch"
#define | RCSSYMBOLS "symbols"
#define | RCSDATE "date"
#define | RCSDESC "desc"
#define | RCSEXPAND "expand"
#define | RCSDEAD "dead"
#define | DATEFORM "%02d.%02d.%02d.%02d.%02d.%02d"
#define | SDATEFORM "%d.%d.%d.%d.%d.%d"
#define | VALID 0x1
#define | INATTIC 0x2
#define | PARTIAL 0x4
#define | RCS_MAGIC_BRANCH 0

Typedefs

typedef rcsnode | RCSNode
typedef deltatext | Deltatext
typedef rcsversnode | RCSVers
typedef void RCSCHECKOUTPROC | PROTO ((void *, const char *, size_t))

Functions

RCSNode *RCS_parse | PROTO ((const char *file, const char *repos))
RCSNode *RCS_parsercsfile | PROTO ((char *rcsfile))
void RCS_fully_parse | PROTO ((RCSNode *))
void RCS_reparsercsfile | PROTO ((RCSNode *, FILE **, struct rcsbuffer *))
int RCS_setattic | PROTO ((RCSNode *, int))
char *RCS_check_kflag | PROTO ((const char *arg))
char *RCS_getdate | PROTO ((RCSNode *rcs, char *date, int force_tag_match))
char *RCS_gettag | PROTO ((RCSNode *rcs, char *symtag, int force_tag_match, int *simple_tag))
int RCS_exist_rev | PROTO ((RCSNode *rcs, char *rev))
int RCS_exist_tag | PROTO ((RCSNode *rcs, char *tag))
char *RCS_getversion | PROTO ((RCSNode *rcs, char *tag, char *date, int force_tag_match, int *simple_tag))
int RCS_isbranch | PROTO ((RCSNode *rcs, const char *rev))
int RCS_nodeisbranch | PROTO ((RCSNode *rcs, const char *tag))
char *RCS_head | PROTO ((RCSNode *rcs))
int RCS_datecmp | PROTO ((char *date1, char *date2))
time_t RCS_getrevtime | PROTO ((RCSNode *rcs, char *rev, char *date, int fudge))
void RCS_check_tag | PROTO ((const char *tag))
int RCS_valid_rev | PROTO ((char *rev))
void freercsnode | PROTO ((RCSNode **rnodep))
char *RCS_getbranch | PROTO ((RCSNode *rcs, char *tag, int force_tag_match))
int RCS_isdead | PROTO ((RCSNode *, const char *))
void RCS_setexpand | PROTO ((RCSNode *, char *))
int RCS_checkout | PROTO ((RCSNode *, char *, char *, char *, char *, char *, RCSCHECKOUTPROC, void *))
int RCS_checkin | PROTO ((RCSNode *rcs, char *workfile, char *message, char *rev, int flags))
int RCS_cmp_file | PROTO ((RCSNode *, char *, char *, const char *))
int RCS_settag | PROTO ((RCSNode *, const char *, const char *))
int RCS_lock | PROTO ((RCSNode *, const char *, int))
int RCS_delete_revs | PROTO ((RCSNode *, char *, char *, int))
RETSIGTYPE rcs_cleanup | PROTO ((void))
void RCS_rewrite | PROTO ((RCSNode *, Deltatext *, char *))
int rcs_change_text | PROTO ((const char *, char *, size_t, const char *, size_t, char **, size_t *))
char *make_file_label | PROTO ((char *, char *, RCSNode *))
int add_rcs_file | PROTO ((char *, char *, char *, char *, char *, char *, char *, int, char **, char *, size_t, FILE *))

Variables

int | preserve_perms

Define Documentation

#define DATEFORM "%02d.%02d.%02d.%02d.%02d.%02d"

Definition at line 31 of file rcs.h.

#define INATTIC 0x2

Definition at line 38 of file rcs.h.

#define PARTIAL 0x4

Definition at line 39 of file rcs.h.

#define RCSBRANCH "branch"

Definition at line 19 of file rcs.h.

#define RCSDATE "date"

Definition at line 21 of file rcs.h.

#define RCSDEAD "dead"

Definition at line 29 of file rcs.h.

#define RCSDESC "desc"

Definition at line 22 of file rcs.h.

#define RCSEXPAND "expand"

Definition at line 23 of file rcs.h.

#define RCSEXT ",v"

Definition at line 16 of file rcs.h.

#define RCSHEAD "head"

Definition at line 18 of file rcs.h.

#define RCSPAT "*,v"

Definition at line 17 of file rcs.h.

#define RCSSYMBOLS "symbols"

Definition at line 20 of file rcs.h.

#define RCS_MAGIC_BRANCH 0

Definition at line 173 of file rcs.h.

#define RCS_MERGE_PAT_1 "<<<<<<< "

Definition at line 12 of file rcs.h.

#define RCS_MERGE_PAT_2 "=======\n"

Definition at line 13 of file rcs.h.

#define RCS_MERGE_PAT_3 ">>>>>>> "

Definition at line 14 of file rcs.h.

#define SDATEFORM "%d.%d.%d.%d.%d.%d"

Definition at line 32 of file rcs.h.

#define VALID 0x1

Definition at line 37 of file rcs.h.

Typedef Documentation

typedef struct deltatext Deltatext

Definition at line 137 of file rcs.h.

int watch_remove PROTO

Definition at line 176 of file rcs.h.

typedef struct rcsnode RCSNode

Definition at line 116 of file rcs.h.

typedef struct rcsversnode RCSVers

Definition at line 164 of file rcs.h.

Function Documentation

int add_rcs_file PROTO ( (char *, char *, char *, char *, char *, char *, char *, int, char **, char *, size_t, FILE *) )

char* make_file_label PROTO ( (char *, char *, RCSNode *) )

int rcs_change_text PROTO ( (const char *, char *, size_t, const char *, size_t, char **, size_t *) )

void RCS_rewrite PROTO ( (RCSNode *, Deltatext *, char *) )

RETSIGTYPE rcs_cleanup PROTO ( (void) )

int RCS_delete_revs PROTO ( (RCSNode *, char *, char *, int) )

int RCS_lock PROTO ( (RCSNode *, const char *, int) )

int RCS_settag PROTO ( (RCSNode *, const char *, const char *) )

int RCS_cmp_file PROTO ( (RCSNode *, char *, char *, const char *) )

int RCS_checkin PROTO ( (RCSNode *rcs, char *workfile, char *message, char *rev, int flags) )

int RCS_checkout PROTO ( (RCSNode *, char *, char *, char *, char *, char *, RCSCHECKOUTPROC, void *) )

void RCS_setexpand PROTO ( (RCSNode *, char *) )

int RCS_isdead PROTO ( (RCSNode *, const char *) )

char* RCS_getbranch PROTO ( (RCSNode *rcs, char *tag, int force_tag_match) )

void freercsnode PROTO ( (RCSNode **rnodep) )

int RCS_valid_rev PROTO ( (char *rev) )

void RCS_check_tag PROTO ( (const char *tag) )

time_t RCS_getrevtime PROTO ( (RCSNode *rcs, char *rev, char *date, int fudge) )

int RCS_datecmp PROTO ( (char *date1, char *date2) )

char* RCS_head PROTO ( (RCSNode *rcs) )

int RCS_nodeisbranch PROTO ( (RCSNode *rcs, const char *tag) )

int RCS_isbranch PROTO ( (RCSNode *rcs, const char *rev) )

char* RCS_getversion PROTO ( (RCSNode *rcs, char *tag, char *date, int force_tag_match, int *simple_tag) )

int RCS_exist_tag PROTO ( (RCSNode *rcs, char *tag) )

int RCS_exist_rev PROTO ( (RCSNode *rcs, char *rev) )

char* RCS_gettag PROTO ( (RCSNode *rcs, char *symtag, int force_tag_match, int *simple_tag) )

char* RCS_getdate PROTO ( (RCSNode *rcs, char *date, int force_tag_match) )

char* RCS_check_kflag PROTO ( (const char *arg) )

int RCS_setattic PROTO ( (RCSNode *, int) )

void RCS_reparsercsfile PROTO ( (RCSNode *, FILE **, struct rcsbuffer *) )

void RCS_fully_parse PROTO ( (RCSNode *) )

RCSNode* RCS_parsercsfile PROTO ( (char *rcsfile) )

RCSNode* RCS_parse PROTO ( (const char *file, const char *repos) )

Variable Documentation

int preserve_perms

Definition at line 239 of file rcs.h.

Generated on Sun Oct 21 12:43:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcscmds.c File Reference

cvs-1.10/src/rcscmds.c File Reference

#include "cvs.h"
#include <assert.h>
#include <stdio.h>
#include "diffrun.h"

Include dependency graph for rcscmds.c:

Include dependency graph

Go to the source code of this file.

Functions

void | RCS_output_diff_options ()
void | call_diff_add_arg ()
void | call_diff_setup ()
int | call_diff ()
int | call_diff3 ()
void | call_diff_write_output ()
void | call_diff_flush_output ()
void | call_diff_write_stdout ()
void | call_diff_error ()
void | call_diff_setup (prog) const char *prog
int | call_diff (out) char *out

Variables

char ** | call_diff_argv
int | call_diff_argc
int | call_diff_argc_allocated
size_t | len
const char * | a1
const char * | a2
diff_callbacks call_diff_file_callbacks
char * | path
char * | workfile
char * | options
char * | rev1
char * | rev2
char * | opts
char * | label1
char * | label2
char * | file2
char * | out

Function Documentation

void RCS_output_diff_options ( ) [static]

int call_diff ( out ) [static]

int call_diff ( ) [static]

int call_diff3 ( ) [static]

void call_diff_add_arg ( ) [static]

void call_diff_error ( ) [static]

void call_diff_flush_output ( ) [static]

void call_diff_setup ( prog ) const [static]

void call_diff_setup ( ) [static]

void call_diff_write_output ( ) [static]

void call_diff_write_stdout ( ) [static]

Variable Documentation

const char* a1

Definition at line 177 of file rcscmds.c.

const char* a2

Definition at line 178 of file rcscmds.c.

int call_diff_argc [static]

Definition at line 72 of file rcscmds.c.

int call_diff_argc_allocated [static]

Definition at line 73 of file rcscmds.c.

char** call_diff_argv [static]

Definition at line 71 of file rcscmds.c.

struct diff_callbacks call_diff_file_callbacks [static]

Initial value:

{
    (void (*) ()) NULL,
    (void (*) ()) NULL,
    call_diff_write_stdout,
    call_diff_error
}

Definition at line 199 of file rcscmds.c.

char* file2

Definition at line 588 of file rcscmds.c.

char * label1

Definition at line 589 of file rcscmds.c.

char * label2

Definition at line 590 of file rcscmds.c.

size_t len

Definition at line 148 of file rcscmds.c.

char* options

Definition at line 591 of file rcscmds.c.

char* opts

Definition at line 381 of file rcscmds.c.

char* out

Definition at line 592 of file rcscmds.c.

char* path

Definition at line 238 of file rcscmds.c.

Referenced by CvsCmdCheckoutModule(), CvsCmdImportModule(), CPersistent::SaveAllSettings(), default_branch(), and tclCvsEntriesProc().

char * rev1

Definition at line 643 of file rcscmds.c.

const char * rev2

Definition at line 419 of file subr.c.

char* workfile

Definition at line 645 of file rcscmds.c.

Generated on Sun Oct 21 12:43:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


recurse.c File Reference

cvs-1.10/src/recurse.c File Reference

#include "cvs.h"
#include "savecwd.h"
#include "fileattr.h"
#include "edit.h"

Include dependency graph for recurse.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | frame_and_entries
struct | frame_and_file
struct | recursion_frame

Functions

int | do_dir_proc ()
int | do_file_proc ()
void | addlist ()
int | unroll_files_proc ()
void | addfile ()
int | do_recursion ()
int | start_recursion (fileproc, filesdoneproc, direntproc, dirleaveproc, callerdat, argc, argv, local, which, aflag, readlock, update_preload, dosrcs) FILEPROC fileproc

Variables

char * | update_dir
char * | repository = NULL
List * | filelist = NULL
List * | dirlist = NULL
FILESDONEPROC filesdoneproc
DIRENTPROC direntproc
DIRLEAVEPROC dirleaveproc
void * | callerdat
int | argc
char ** | argv
int | local
int | which
int | aflag
int | readlock
char * | update_preload
int | dosrcs
void * | closure
char * | key
char * | dir
char * | file

Function Documentation

void addfile ( ) [static]

void addlist ( ) [static]

int do_dir_proc ( ) [static]

int do_file_proc ( ) [static]

int do_recursion ( ) [static]

int start_recursion | ( | fileproc | ,
 |  | filesdoneproc | ,
 |  | direntproc | ,
 |  | dirleaveproc | ,
 |  | callerdat | ,
 |  | argc | ,
 |  | argv | ,
 |  | local | ,
 |  | which | ,
 |  | aflag | ,
 |  | readlock | ,
 |  | update_preload | ,
 |  | dosrcs |
 | ) |

int unroll_files_proc ( ) [static]

Variable Documentation

int aflag

Definition at line 104 of file recurse.c.

int argc

Definition at line 911 of file tag.c.

char** argv

Definition at line 78 of file recurse.c.

void* callerdat

Definition at line 75 of file recurse.c.

void* closure

Definition at line 1158 of file recurse.c.

char* dir

Definition at line 1132 of file recurse.c.

DIRENTPROC direntproc

Definition at line 73 of file recurse.c.

DIRLEAVEPROC dirleaveproc

Definition at line 74 of file recurse.c.

List* dirlist = NULL [static]

Definition at line 25 of file recurse.c.

int dosrcs

Definition at line 107 of file recurse.c.

char* file

Definition at line 1133 of file recurse.c.

Referenced by CCJMemFile::Duplicate(), CCJMemFile::Extract(), CCJMemFile::Insert(), and MultiFiles::add().

List* filelist = NULL [static]

Definition at line 24 of file recurse.c.

FILESDONEPROC filesdoneproc

Definition at line 72 of file recurse.c.

char* key

Definition at line 1116 of file recurse.c.

Referenced by CustGetByKey(), CCJMenu::FindKeyboardShortcut(), and closure().

int local

Definition at line 79 of file recurse.c.

int readlock

Definition at line 105 of file recurse.c.

char* repository = NULL [static]

Definition at line 23 of file recurse.c.

char* update_dir [static]

Definition at line 22 of file recurse.c.

char* update_preload

Definition at line 106 of file recurse.c.

int which

Definition at line 102 of file recurse.c.

Generated on Sun Oct 21 12:43:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


release.c File Reference

cvs-1.10/src/release.c File Reference

#include "cvs.h"
#include "savecwd.h"
#include "getline.h"

Include dependency graph for release.c:

Include dependency graph

Go to the source code of this file.

Functions

int | release (argc, argv) int argc

Variables

const char *const | release_usage []
char ** | argv

Function Documentation

int release | ( | argc | ,
 |  | argv |
 | ) |

Variable Documentation

char** argv

Definition at line 66 of file release.c.

const char* const release_usage[] [static]

Initial value:

{
    "Usage: %s %s [-d] directories...\n",
    "\t-d\tDelete the given directory.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 12 of file release.c.

Generated on Sun Oct 21 12:43:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


remove.c File Reference

cvs-1.10/src/remove.c File Reference

#include "cvs.h"

Include dependency graph for remove.c:

Include dependency graph

Go to the source code of this file.

Functions

int | remove_fileproc ()
Dtype remove_dirproc ()
int | cvsremove (argc, argv) int argc

Variables

int | force
int | local
int | removed_files
int | existing_files
const char *const | remove_usage []
char ** | argv
file_info * finfo
char * | dir
char * | repos
char * | update_dir
List * entries

Function Documentation

int cvsremove | ( | argc | ,
 |  | argv |
 | ) |

Dtype remove_dirproc ( ) [static]

int remove_fileproc ( ) [static]

Variable Documentation

char** argv

Definition at line 47 of file remove.c.

char* dir

Definition at line 270 of file remove.c.

List* entries

Definition at line 273 of file remove.c.

int existing_files [static]

Definition at line 32 of file remove.c.

struct file_info* finfo

Definition at line 159 of file remove.c.

int force [static]

Definition at line 29 of file remove.c.

int local [static]

Definition at line 30 of file remove.c.

const char* const remove_usage[] [static]

Initial value:

{
    "Usage: %s %s [-flR] [files...]\n",
    "\t-f\tDelete the file before removing it.\n",
    "\t-l\tProcess this directory only (not recursive).\n",
    "\t-R\tProcess directories recursively.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 34 of file remove.c.

int removed_files [static]

Definition at line 31 of file remove.c.

char* repos

Definition at line 271 of file remove.c.

char* update_dir

Definition at line 272 of file remove.c.

Generated on Sun Oct 21 12:43:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


repos.c File Reference

cvs-1.10/src/repos.c File Reference

#include <assert.h>
#include "cvs.h"
#include "getline.h"

Include dependency graph for repos.c:

Include dependency graph

Go to the source code of this file.

Functions

char * | Name_Repository (dir, update_dir) char *dir

Variables

char * | update_dir

Function Documentation

char* Name_Repository | ( | dir | ,
 |  | update_dir |
 | ) |

Variable Documentation

char* update_dir

Definition at line 25 of file repos.c.

Generated on Sun Oct 21 12:43:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


root.c File Reference

cvs-1.10/src/root.c File Reference

#include "cvs.h"
#include "getline.h"

Include dependency graph for root.c:

Include dependency graph

Go to the source code of this file.

Functions

char * | Name_Root (dir, update_dir) char *dir
void | root_allow_add (arg) char *arg
int | parse_cvsroot (CVSroot) char *CVSroot

Variables

char * | method_names []
char * | update_dir
char * | rootdir
char ** | root_allow_vector
int | root_allow_size
char * | CVSroot_original = NULL
int | client_active
CVSmethod CVSroot_method
char * | CVSroot_username
char * | CVSroot_hostname
char * | CVSroot_directory
char * | CVSroot_proxy = NULL
int | CVSroot_port = 0
int | CVSroot_proxy_port = CVS_PROXY_PORT

Function Documentation

char* Name_Root | ( | dir | ,
 |  | update_dir |
 | ) |

int parse_cvsroot ( CVSroot )

void root_allow_add ( arg )

Variable Documentation

char* CVSroot_directory

Definition at line 290 of file root.c.

char* CVSroot_hostname

Definition at line 289 of file root.c.

CVSmethod CVSroot_method

Definition at line 287 of file root.c.

char* CVSroot_original = NULL

Definition at line 285 of file root.c.

int CVSroot_port = 0

Definition at line 292 of file root.c.

char* CVSroot_proxy = NULL

Definition at line 291 of file root.c.

int CVSroot_proxy_port = CVS_PROXY_PORT

Definition at line 293 of file root.c.

char* CVSroot_username

Definition at line 288 of file root.c.

int client_active

Definition at line 286 of file root.c.

char* method_names[]

Initial value:

 {
    "local", "server (rsh)", "pserver", "kserver", "gserver", "ext", "fork"
}

Definition at line 18 of file root.c.

int root_allow_size [static]

Definition at line 179 of file root.c.

char** root_allow_vector [static]

Definition at line 178 of file root.c.

char* rootdir

Definition at line 141 of file root.c.

char* update_dir

Definition at line 27 of file root.c.

Generated on Sun Oct 21 12:43:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rtag.c File Reference

cvs-1.10/src/rtag.c File Reference

#include "cvs.h"

Include dependency graph for rtag.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | master_lists
struct | tag_info

Functions

int | check_fileproc ()
int | check_filesdoneproc ()
int | pretag_proc ()
void | masterlist_delproc ()
void | tag_delproc ()
int | pretag_list_proc ()
Dtype rtag_dirproc ()
int | rtag_fileproc ()
int | rtag_filesdoneproc ()
int | rtag_proc ()
int | rtag_delete ()
int | rtag (argc, argv) int argc

Variables

List * mtlist
List * tlist
char * | symtag
char * | numtag
int | numtag_validated = 0
int | delete_flag
int | attic_too
int | branch_mode
char * | date
int | local
int | force_tag_match = 1
int | force_tag_move
const char *const | rtag_usage []
char ** | argv
char * | xwhere
char * | mwhere
char * | mfile
int | shorten
int | local_specified
char * | mname
char * | msg
file_info * finfo
int | err
char * | repos
char * | update_dir
List * entries
char * | filter
void * | closure
char * | dir

Function Documentation

int check_fileproc ( ) [static]

int check_filesdoneproc ( ) [static]

void masterlist_delproc ( ) [static]

int pretag_list_proc ( ) [static]

int pretag_proc ( ) [static]

int rtag | ( | argc | ,
 |  | argv |
 | ) |

int rtag_delete ( ) [static]

Dtype rtag_dirproc ( ) [static]

int rtag_fileproc ( ) [static]

int rtag_filesdoneproc ( ) [static]

int rtag_proc ( ) [static]

void tag_delproc ( ) [static]

Variable Documentation

char** argv

Definition at line 228 of file rtag.c.

int attic_too [static]

Definition at line 58 of file rtag.c.

int branch_mode [static]

Definition at line 59 of file rtag.c.

void* closure

Definition at line 515 of file rtag.c.

char* date [static]

Definition at line 60 of file rtag.c.

int delete_flag [static]

Definition at line 57 of file rtag.c.

char* dir

Definition at line 744 of file rtag.c.

List* entries

Definition at line 747 of file rtag.c.

int err

Definition at line 727 of file rtag.c.

char* filter

Definition at line 457 of file rtag.c.

struct file_info* finfo

Definition at line 533 of file rtag.c.

int force_tag_match = 1 [static]

Definition at line 62 of file rtag.c.

int force_tag_move [static]

Definition at line 63 of file rtag.c.

int local [static]

Definition at line 61 of file rtag.c.

int local_specified

Definition at line 233 of file rtag.c.

char* mfile

Definition at line 231 of file rtag.c.

char* mname

Definition at line 234 of file rtag.c.

char* msg

Definition at line 235 of file rtag.c.

Referenced by f().

List* mtlist [static]

Definition at line 51 of file rtag.c.

char* mwhere

Definition at line 230 of file rtag.c.

char* numtag [static]

Definition at line 55 of file rtag.c.

int numtag_validated = 0 [static]

Definition at line 56 of file rtag.c.

char* repos

Definition at line 745 of file rtag.c.

const char* const rtag_usage[] [static]

Initial value:

{
    "Usage: %s %s [-aflRnF] [-b] [-d] [-r rev|-D date] tag modules...\n",
    "\t-a\tClear tag from removed files that would not otherwise be tagged.\n",
    "\t-f\tForce a head revision match if tag/date not found.\n",
    "\t-l\tLocal directory only, not recursive\n",
    "\t-R\tProcess directories recursively.\n",
    "\t-n\tNo execution of 'tag program'\n",
    "\t-d\tDelete the given Tag.\n",
    "\t-b\tMake the tag a \"branch\" tag, allowing concurrent development.\n",
    "\t-r rev\tExisting revision/tag.\n",
    "\t-D\tExisting date.\n",
    "\t-F\tMove tag if it already exists\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 65 of file rtag.c.

int shorten

Definition at line 232 of file rtag.c.

char* symtag [static]

Definition at line 54 of file rtag.c.

List* tlist [static]

Definition at line 52 of file rtag.c.

char* update_dir

Definition at line 746 of file rtag.c.

char* xwhere

Definition at line 229 of file rtag.c.

Generated on Sun Oct 21 12:43:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


run.c File Reference

cvs-1.10/src/run.c File Reference

#include "cvs.h"

Include dependency graph for run.c:

Include dependency graph

Go to the source code of this file.

Functions

int | execvp ()
void | run_add_arg ()
char * | strtok ()
void | run_setup (prog) const char *prog

Variables

char ** | run_argv
int | run_argc
int | run_argc_allocated
const char * | stout
const char * | sterr
int | flags
const char * | mode
int * | tofdp
int * | fromfdp

Function Documentation

int execvp ( )

Referenced by cvs_process_open().

void run_add_arg ( ) [static]

Referenced by run_setup().

void run_setup ( prog ) const

char* strtok ( )

Variable Documentation

int flags

Definition at line 99 of file run.c.

int* fromfdp

Definition at line 393 of file run.c.

const char* mode

Definition at line 378 of file run.c.

int run_argc [static]

Definition at line 38 of file run.c.

int run_argc_allocated [static]

Definition at line 39 of file run.c.

char** run_argv [static]

Definition at line 37 of file run.c.

const char* sterr

Definition at line 98 of file run.c.

const char* stout

Definition at line 97 of file run.c.

int* tofdp

Definition at line 392 of file run.c.

Generated on Sun Oct 21 12:43:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/run.c Source File

cvs-1.10/src/run.c

Go to the documentation of this file.
00001 /* run.c --- routines for executing subprocesses.
00002
00003    This file is part of GNU CVS.
00004
00005    GNU CVS is free software; you can redistribute it and/or modify it
00006    under the terms of the GNU General Public License as published by the
00007    Free Software Foundation; either version 2, or (at your option) any
00008    later version.
00009
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.  */
00014
00015 #include "cvs.h"
00016
00017 #ifndef HAVE_UNISTD_H
00018 extern int execvp PROTO((char *file, char **argv));
00019 #endif
00020
00021 static void run_add_arg PROTO((const char *s));
00022
00023 extern char *strtok ();
00024
00025 /*
00026  * To exec a program under CVS, first call run_setup() to setup initial
00027  * arguments.  The argument to run_setup will be parsed into whitespace
00028  * separated words and added to the global run_argv list.
00029  *
00030  * Then, optionally call run_arg() for each additional argument that you'd like
00031  * to pass to the executed program.
00032  *
00033  * Finally, call run_exec() to execute the program with the specified arguments.
00034  * The execvp() syscall will be used, so that the PATH is searched correctly.
00035  * File redirections can be performed in the call to run_exec().
00036  */
00037 static char **run_argv;
00038 static int run_argc;
00039 static int run_argc_allocated;
00040
00041 /* VARARGS */
00042 void
00043 run_setup (prog)
00044     const char *prog;
00045 {
00046     char *cp;
00047     int i;
00048     char *run_prog;
00049
00050     /* clean out any malloc'ed values from run_argv */
00051     for (i = 0; i < run_argc; i++)
00052     {
00053     if (run_argv[i])
00054     {
00055         free (run_argv[i]);
00056         run_argv[i] = (char *) 0;
00057     }
00058     }
00059     run_argc = 0;
00060
00061     run_prog = xstrdup (prog);
00062
00063     /* put each word into run_argv, allocating it as we go */
00064     for (cp = strtok (run_prog, " \t"); cp; cp = strtok ((char *) NULL, " \t"))
00065     run_add_arg (cp);
00066     free (run_prog);
00067 }
00068
00069 void
00070 run_arg (s)
00071     const char *s;
00072 {
00073     run_add_arg (s);
00074 }
00075
00076 static void
00077 run_add_arg (s)
00078     const char *s;
00079 {
00080     /* allocate more argv entries if we've run out */
00081     if (run_argc >= run_argc_allocated)
00082     {
00083     run_argc_allocated += 50;
00084     run_argv = (char **) xrealloc ((char *) run_argv,
00085                      run_argc_allocated * sizeof (char **));
00086     }
00087
00088     if (s)
00089     run_argv[run_argc++] = xstrdup (s);
00090     else
00091     run_argv[run_argc] = (char *) 0;    /* not post-incremented on purpose! */
00092 }
00093
00094 int
00095 run_exec (stin, stout, sterr, flags)
00096     const char *stin;
00097     const char *stout;
00098     const char *sterr;
00099     int flags;
00100 {
00101     int shin, shout, sherr;
00102     int mode_out, mode_err;
00103     int status;
00104     int rc = -1;
00105     int rerrno = 0;
00106     int pid, w;
00107
00108 #ifdef POSIX_SIGNALS
00109     sigset_t sigset_mask, sigset_omask;
00110     struct sigaction act, iact, qact;
00111
00112 #else
00113 #ifdef BSD_SIGNALS
00114     int mask;
00115     struct sigvec vec, ivec, qvec;
00116
00117 #else
00118     RETSIGTYPE (*istat) (), (*qstat) ();
00119 #endif
00120 #endif
00121
00122     if (trace)
00123     {
00124 #ifdef SERVER_SUPPORT
00125     cvs_outerr (server_active ? "S" : " ", 1);
00126 #endif
00127     cvs_outerr ("-> system(", 0);
00128     run_print (stderr);
00129     cvs_outerr (")\n", 0);
00130     }
00131     if (noexec && (flags & RUN_REALLY) == 0)
00132     return (0);
00133
00134     /* make sure that we are null terminated, since we didn't calloc */
00135     run_add_arg ((char *) 0);
00136
00137     /* setup default file descriptor numbers */
00138     shin = 0;
00139     shout = 1;
00140     sherr = 2;
00141
00142     /* set the file modes for stdout and stderr */
00143     mode_out = mode_err = O_WRONLY | O_CREAT;
00144     mode_out |= ((flags & RUN_STDOUT_APPEND) ? O_APPEND : O_TRUNC);
00145     mode_err |= ((flags & RUN_STDERR_APPEND) ? O_APPEND : O_TRUNC);
00146
00147     if (stin && (shin = open (stin, O_RDONLY)) == -1)
00148     {
00149     rerrno = errno;
00150     error (0, errno, "cannot open %s for reading (prog %s)",
00151            stin, run_argv[0]);
00152     goto out0;
00153     }
00154     if (stout && (shout = open (stout, mode_out, 0666)) == -1)
00155     {
00156     rerrno = errno;
00157     error (0, errno, "cannot open %s for writing (prog %s)",
00158            stout, run_argv[0]);
00159     goto out1;
00160     }
00161     if (sterr && (flags & RUN_COMBINED) == 0)
00162     {
00163     if ((sherr = open (sterr, mode_err, 0666)) == -1)
00164     {
00165         rerrno = errno;
00166         error (0, errno, "cannot open %s for writing (prog %s)",
00167            sterr, run_argv[0]);
00168         goto out2;
00169     }
00170     }
00171
00172     /* Make sure we don't flush this twice, once in the subprocess.  */
00173     fflush (stdout);
00174     fflush (stderr);
00175
00176     /* The output files, if any, are now created.  Do the fork and dups.
00177
00178        We use vfork not so much for a performance boost (the
00179        performance boost, if any, is modest on most modern unices),
00180        but for the sake of systems without a memory management unit,
00181        which find it difficult or impossible to implement fork at all
00182        (e.g. Amiga).  The other solution is spawn (see
00183        windows-NT/run.c).  */
00184
00185 #ifdef HAVE_VFORK
00186     pid = vfork ();
00187 #else
00188     pid = fork ();
00189 #endif
00190     if (pid == 0)
00191     {
00192     if (shin != 0)
00193     {
00194         (void) dup2 (shin, 0);
00195         (void) close (shin);
00196     }
00197     if (shout != 1)
00198     {
00199         (void) dup2 (shout, 1);
00200         (void) close (shout);
00201     }
00202     if (flags & RUN_COMBINED)
00203         (void) dup2 (1, 2);
00204     else if (sherr != 2)
00205     {
00206         (void) dup2 (sherr, 2);
00207         (void) close (sherr);
00208     }
00209
00210 #ifdef SETXID_SUPPORT
00211     /*
00212     ** This prevents a user from creating a privileged shell
00213     ** from the text editor when the SETXID_SUPPORT option is selected.
00214     */
00215     if (!strcmp (run_argv[0], Editor) && setegid (getgid ()))
00216     {
00217         error (0, errno, "cannot set egid to gid");
00218         _exit (127);
00219     }
00220 #endif
00221
00222     /* dup'ing is done.  try to run it now */
00223     (void) execvp (run_argv[0], run_argv);
00224     error (0, errno, "cannot exec %s", run_argv[0]);
00225     _exit (127);
00226     }
00227     else if (pid == -1)
00228     {
00229     rerrno = errno;
00230     goto out;
00231     }
00232
00233     /* the parent.  Ignore some signals for now */
00234 #ifdef POSIX_SIGNALS
00235     if (flags & RUN_SIGIGNORE)
00236     {
00237     act.sa_handler = SIG_IGN;
00238     (void) sigemptyset (&act.sa_mask);
00239     act.sa_flags = 0;
00240     (void) sigaction (SIGINT, &act, &iact);
00241     (void) sigaction (SIGQUIT, &act, &qact);
00242     }
00243     else
00244     {
00245     (void) sigemptyset (&sigset_mask);
00246     (void) sigaddset (&sigset_mask, SIGINT);
00247     (void) sigaddset (&sigset_mask, SIGQUIT);
00248     (void) sigprocmask (SIG_SETMASK, &sigset_mask, &sigset_omask);
00249     }
00250 #else
00251 #ifdef BSD_SIGNALS
00252     if (flags & RUN_SIGIGNORE)
00253     {
00254     memset ((char *) &vec, 0, sizeof (vec));
00255     vec.sv_handler = SIG_IGN;
00256     (void) sigvec (SIGINT, &vec, &ivec);
00257     (void) sigvec (SIGQUIT, &vec, &qvec);
00258     }
00259     else
00260     mask = sigblock (sigmask (SIGINT) | sigmask (SIGQUIT));
00261 #else
00262     istat = signal (SIGINT, SIG_IGN);
00263     qstat = signal (SIGQUIT, SIG_IGN);
00264 #endif
00265 #endif
00266
00267     /* wait for our process to die and munge return status */
00268 #ifdef POSIX_SIGNALS
00269     while ((w = waitpid (pid, &status, 0)) == -1 && errno == EINTR)
00270     ;
00271 #else
00272     while ((w = wait (&status)) != pid)
00273     {
00274     if (w == -1 && errno != EINTR)
00275         break;
00276     }
00277 #endif
00278
00279     if (w == -1)
00280     {
00281     rc = -1;
00282     rerrno = errno;
00283     }
00284 #ifndef VMS /* status is return status */
00285     else if (WIFEXITED (status))
00286     rc = WEXITSTATUS (status);
00287     else if (WIFSIGNALED (status))
00288     {
00289     if (WTERMSIG (status) == SIGPIPE)
00290         error (1, 0, "broken pipe");
00291     rc = 2;
00292     }
00293     else
00294     rc = 1;
00295 #else /* VMS */
00296     rc = WEXITSTATUS (status);
00297 #endif /* VMS */
00298
00299     /* restore the signals */
00300 #ifdef POSIX_SIGNALS
00301     if (flags & RUN_SIGIGNORE)
00302     {
00303     (void) sigaction (SIGINT, &iact, (struct sigaction *) NULL);
00304     (void) sigaction (SIGQUIT, &qact, (struct sigaction *) NULL);
00305     }
00306     else
00307     (void) sigprocmask (SIG_SETMASK, &sigset_omask, (sigset_t *) NULL);
00308 #else
00309 #ifdef BSD_SIGNALS
00310     if (flags & RUN_SIGIGNORE)
00311     {
00312     (void) sigvec (SIGINT, &ivec, (struct sigvec *) NULL);
00313     (void) sigvec (SIGQUIT, &qvec, (struct sigvec *) NULL);
00314     }
00315     else
00316     (void) sigsetmask (mask);
00317 #else
00318     (void) signal (SIGINT, istat);
00319     (void) signal (SIGQUIT, qstat);
00320 #endif
00321 #endif
00322
00323     /* cleanup the open file descriptors */
00324   out:
00325     if (sterr)
00326     (void) close (sherr);
00327   out2:
00328     if (stout)
00329     (void) close (shout);
00330   out1:
00331     if (stin)
00332     (void) close (shin);
00333
00334   out0:
00335     if (rerrno)
00336     errno = rerrno;
00337     return (rc);
00338 }
00339
00340 void
00341 run_print (fp)
00342     FILE *fp;
00343 {
00344     int i;
00345     void (*outfn) PROTO ((const char *, size_t));
00346
00347     if (fp == stderr)
00348     outfn = cvs_outerr;
00349     else if (fp == stdout)
00350     outfn = cvs_output;
00351     else
00352     {
00353     error (1, 0, "internal error: bad argument to run_print");
00354     /* Solely to placate gcc -Wall.
00355        FIXME: it'd be better to use a function named `fatal' that
00356        is known never to return.  Then kludges wouldn't be necessary.  */
00357     outfn = NULL;
00358     }
00359
00360     for (i = 0; i < run_argc; i++)
00361     {
00362     (*outfn) ("'", 1);
00363     (*outfn) (run_argv[i], 0);
00364     (*outfn) ("'", 1);
00365     if (i != run_argc - 1)
00366         (*outfn) (" ", 1);
00367     }
00368 }
00369
00370 /* Return value is NULL for error, or if noexec was set.  If there was an
00371    error, return NULL and I'm not sure whether errno was set (the Red Hat
00372    Linux 4.1 popen manpage was kind of vague but discouraging; and the noexec
00373    case complicates this even aside from popen behavior).  */
00374
00375 FILE *
00376 run_popen (cmd, mode)
00377     const char *cmd;
00378     const char *mode;
00379 {
00380     if (trace)
00381     (void) fprintf (stderr, "%s-> run_popen(%s,%s)\n",
00382             CLIENT_SERVER_STR, cmd, mode);
00383     if (noexec)
00384     return (NULL);
00385
00386     return (popen (cmd, mode));
00387 }
00388
00389 int
00390 piped_child (command, tofdp, fromfdp)
00391      char **command;
00392      int *tofdp;
00393      int *fromfdp;
00394 {
00395     int pid;
00396     int to_child_pipe[2];
00397     int from_child_pipe[2];
00398
00399     if (pipe (to_child_pipe) < 0)
00400     error (1, errno, "cannot create pipe");
00401     if (pipe (from_child_pipe) < 0)
00402     error (1, errno, "cannot create pipe");
00403
00404 #ifdef USE_SETMODE_BINARY
00405     setmode (to_child_pipe[0], O_BINARY);
00406     setmode (to_child_pipe[1], O_BINARY);
00407     setmode (from_child_pipe[0], O_BINARY);
00408     setmode (from_child_pipe[1], O_BINARY);
00409 #endif
00410
00411 #ifdef HAVE_VFORK
00412     pid = vfork ();
00413 #else
00414     pid = fork ();
00415 #endif
00416     if (pid < 0)
00417     error (1, errno, "cannot fork");
00418     if (pid == 0)
00419     {
00420     if (dup2 (to_child_pipe[0], STDIN_FILENO) < 0)
00421         error (1, errno, "cannot dup2 pipe");
00422     if (close (to_child_pipe[1]) < 0)
00423         error (1, errno, "cannot close pipe");
00424     if (close (from_child_pipe[0]) < 0)
00425         error (1, errno, "cannot close pipe");
00426     if (dup2 (from_child_pipe[1], STDOUT_FILENO) < 0)
00427         error (1, errno, "cannot dup2 pipe");
00428
00429     execvp (command[0], command);
00430     error (1, errno, "cannot exec %s", command[0]);
00431     }
00432     if (close (to_child_pipe[0]) < 0)
00433     error (1, errno, "cannot close pipe");
00434     if (close (from_child_pipe[1]) < 0)
00435     error (1, errno, "cannot close pipe");
00436
00437     *tofdp = to_child_pipe[1];
00438     *fromfdp = from_child_pipe[0];
00439     return pid;
00440 }
00441
00442
00443 void
00444 close_on_exec (fd)
00445      int fd;
00446 {
00447 #if defined (FD_CLOEXEC) && defined (F_SETFD)
00448     if (fcntl (fd, F_SETFD, 1))
00449     error (1, errno, "can't set close-on-exec flag on %d", fd);
00450 #endif
00451 }
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/scramble.c Source File

cvs-1.10/src/scramble.c

Go to the documentation of this file.
00001 /*
00002  * Trivially encode strings to protect them from innocent eyes (i.e.,
00003  * inadvertent password compromises, like a network administrator
00004  * who's watching packets for legitimate reasons and accidentally sees
00005  * the password protocol go by).
00006  *
00007  * This is NOT secure encryption.
00008  *
00009  * It would be tempting to encode the password according to username
00010  * and repository, so that the same password would encode to a
00011  * different string when used with different usernames and/or
00012  * repositories.  However, then users would not be able to cut and
00013  * paste passwords around.  They're not supposed to anyway, but we all
00014  * know they will, and there's no reason to make it harder for them if
00015  * we're not trying to provide real security anyway.
00016  */
00017
00018 /* Set this to test as a standalone program. */
00019 /* #define DIAGNOSTIC */
00020
00021 #ifndef DIAGNOSTIC
00022 #include "cvs.h"
00023 #else /* ! DIAGNOSTIC */
00024 /* cvs.h won't define this for us */
00025 #define AUTH_CLIENT_SUPPORT
00026 #define xmalloc malloc
00027 /* Use "gcc -fwritable-strings". */
00028 #include <stdio.h>
00029 #include <stdio.h>
00030 #include <string.h>
00031 #endif /* ! DIAGNOSTIC */
00032
00033 #if defined(AUTH_CLIENT_SUPPORT) || defined(AUTH_SERVER_SUPPORT)
00034
00035 /* Map characters to each other randomly and symmetrically, A <--> B.
00036  *
00037  * We divide the ASCII character set into 3 domains: control chars (0
00038  * thru 31), printing chars (32 through 126), and "meta"-chars (127
00039  * through 255).  The control chars map _to_ themselves, the printing
00040  * chars map _among_ themselves, and the meta chars map _among_
00041  * themselves.  Why is this thus?
00042  *
00043  * No character in any of these domains maps to a character in another
00044  * domain, because I'm not sure what characters are legal in
00045  * passwords, or what tools people are likely to use to cut and paste
00046  * them.  It seems prudent not to introduce control or meta chars,
00047  * unless the user introduced them first.  And having the control
00048  * chars all map to themselves insures that newline and
00049  * carriage-return are safely handled.
00050  */
00051
00052 static unsigned char
00053 shifts[] = {
00054     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
00055    16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
00056   114,120, 53, 79, 96,109, 72,108, 70, 64, 76, 67,116, 74, 68, 87,
00057   111, 52, 75,119, 49, 34, 82, 81, 95, 65,112, 86,118,110,122,105,
00058    41, 57, 83, 43, 46,102, 40, 89, 38,103, 45, 50, 42,123, 91, 35,
00059   125, 55, 54, 66,124,126, 59, 47, 92, 71,115, 78, 88,107,106, 56,
00060    36,121,117,104,101,100, 69, 73, 99, 63, 94, 93, 39, 37, 61, 48,
00061    58,113, 32, 90, 44, 98, 60, 51, 33, 97, 62, 77, 84, 80, 85,223,
00062   225,216,187,166,229,189,222,188,141,249,148,200,184,136,248,190,
00063   199,170,181,204,138,232,218,183,255,234,220,247,213,203,226,193,
00064   174,172,228,252,217,201,131,230,197,211,145,238,161,179,160,212,
00065   207,221,254,173,202,146,224,151,140,196,205,130,135,133,143,246,
00066   192,159,244,239,185,168,215,144,139,165,180,157,147,186,214,176,
00067   227,231,219,169,175,156,206,198,129,164,150,210,154,177,134,127,
00068   182,128,158,208,162,132,167,209,149,241,153,251,237,236,171,195,
00069   243,233,253,240,194,250,191,155,142,137,245,235,163,242,178,152 };
00070
00071
00072 /* SCRAMBLE and DESCRAMBLE work like this:
00073  *
00074  * scramble(STR) returns SCRM, a scrambled copy of STR.  SCRM[0] is a
00075  * single letter indicating the scrambling method.  As of this
00076  * writing, the only legal method is 'A', but check the code for more
00077  * up-to-date information.  The copy will have been allocated with
00078  * malloc().
00079  *
00080  * descramble(SCRM) returns STR, again in its own malloc'd space.
00081  * descramble() uses SCRM[0] to determine which method of unscrambling
00082  * to use.  If it does not recognize the method, it dies with error.
00083  */
00084
00085 /* Return a malloc'd, scrambled version of STR. */
00086 char *
00087 scramble (str)
00088     char *str;
00089 {
00090     int i;
00091     char *s;
00092
00093     /* +2 to hold the 'A' prefix that indicates which version of
00094        scrambling this is (the first, obviously, since we only do one
00095        kind of scrambling so far), and then the '\0' of course.  */
00096     s = (char *) xmalloc (strlen (str) + 2);
00097
00098     /* Scramble (TM) version prefix. */
00099     s[0] = 'A';
00100     strcpy (s + 1, str);
00101
00102     for (i = 1; s[i]; i++)
00103     s[i] = shifts[(unsigned char)(s[i])];
00104
00105     return s;
00106 }
00107
00108 /* Decode the string in place. */
00109 char *
00110 descramble (str)
00111     char *str;
00112 {
00113     char *s;
00114     int i;
00115
00116     /* For now we can only handle one kind of scrambling.  In the future
00117        there may be other kinds, and this `if' will become a `switch'.  */
00118     if (str[0] != 'A')
00119 #ifndef DIAGNOSTIC
00120     error (1, 0, "descramble: unknown scrambling method");
00121 #else  /* DIAGNOSTIC */
00122     {
00123     fprintf (stderr, "descramble: unknown scrambling method\n", str);
00124     fflush (stderr);
00125     exit (EXIT_FAILURE);
00126     }
00127 #endif  /* DIAGNOSTIC */
00128
00129     /* Method `A' is symmetrical, so scramble again to decrypt. */
00130     s = scramble (str + 1);
00131
00132     /* Shift the whole string one char to the left, pushing the unwanted
00133        'A' off the left end.  Safe, because s is null-terminated. */
00134     for (i = 0; s[i]; i++)
00135     s[i] = s[i + 1];
00136
00137     return s;
00138 }
00139
00140 #endif /* (AUTH_CLIENT_SUPPORT || AUTH_SERVER_SUPPORT) from top of file */
00141
00142 #ifdef DIAGNOSTIC
00143 int
00144 main ()
00145 {
00146     int i;
00147     char *e, *m, biggie[256];
00148
00149     char *cleartexts[5];
00150     cleartexts[0] = "first";
00151     cleartexts[1] = "the second";
00152     cleartexts[2] = "this is the third";
00153     cleartexts[3] = "$#% !!\\3";
00154     cleartexts[4] = biggie;
00155
00156     /* Set up the most important test string: */
00157     /* Can't have a real ASCII zero in the string, because we want to
00158        use printf, so we substitute the character zero. */
00159     biggie[0] = '0';
00160     /* The rest of the string gets straight ascending ASCII. */
00161     for (i = 1; i < 256; i++)
00162     biggie[i] = i;
00163
00164     /* Test all the strings. */
00165     for (i = 0; i < 5; i++)
00166     {
00167     printf ("clear%d: %s\n", i, cleartexts[i]);
00168     e = scramble (cleartexts[i]);
00169     printf ("scram%d: %s\n", i, e);
00170     m = descramble (e);
00171     free (e);
00172     printf ("clear%d: %s\n\n", i, m);
00173     free (m);
00174     }
00175
00176     fflush (stdout);
00177     return 0;
00178 }
00179 #endif /* DIAGNOSTIC */
00180
00181 /*
00182  * ;;; The Emacs Lisp that did the dirty work ;;;
00183  * (progn
00184  *
00185  *   ;; Helper func.
00186  *   (defun random-elt (lst)
00187  *     (let* ((len (length lst))
00188  *            (rnd (random len)))
00189  *       (nth rnd lst)))
00190  *
00191  *   ;; A list of all characters under 127, each appearing once.
00192  *   (setq non-meta-chars
00193  *         (let ((i 0)
00194  *               (l nil))
00195  *           (while (< i 127)
00196  *             (setq l (cons i l)
00197  *                   i (1+ i)))
00198  *           l))
00199  *
00200  *   ;; A list of all characters 127 and above, each appearing once.
00201  *   (setq meta-chars
00202  *         (let ((i 127)
00203  *               (l nil))
00204  *           (while (< i 256)
00205  *             (setq l (cons i l)
00206  *                   i (1+ i)))
00207  *           l))
00208  *
00209  *   ;; A vector that will hold the chars in a random order.
00210  *   (setq scrambled-chars (make-vector 256 0))
00211  *
00212  *   ;; These characters should map to themselves.
00213  *   (let ((i 0))
00214  *     (while (< i 32)
00215  *       (aset scrambled-chars i i)
00216  *       (setq non-meta-chars (delete i non-meta-chars)
00217  *             i (1+ i))))
00218  *
00219  *   ;; Assign random (but unique) values, within the non-meta chars.
00220  *   (let ((i 32))
00221  *     (while (< i 127)
00222  *       (let ((ch (random-elt non-meta-chars)))
00223  *         (if (= 0 (aref scrambled-chars i))
00224  *             (progn
00225  *               (aset scrambled-chars i ch)
00226  *               (aset scrambled-chars ch i)
00227  *               (setq non-meta-chars (delete ch non-meta-chars)
00228  *                     non-meta-chars (delete i non-meta-chars))))
00229  *         (setq i (1+ i)))))
00230  *
00231  *   ;; Assign random (but unique) values, within the non-meta chars.
00232  *   (let ((i 127))
00233  *     (while (< i 256)
00234  *       (let ((ch (random-elt meta-chars)))
00235  *         (if (= 0 (aref scrambled-chars i))
00236  *             (progn
00237  *               (aset scrambled-chars i ch)
00238  *               (aset scrambled-chars ch i)
00239  *               (setq meta-chars (delete ch meta-chars)
00240  *                     meta-chars (delete i meta-chars))))
00241  *         (setq i (1+ i)))))
00242  *
00243  *   ;; Now use the `scrambled-chars' vector to get your C array.
00244  *   )
00245  */
Generated on Sun Oct 21 12:41:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/server.c Source File

cvs-1.10/src/server.c

Go to the documentation of this file.
00001 /* This program is free software; you can redistribute it and/or modify
00002    it under the terms of the GNU General Public License as published by
00003    the Free Software Foundation; either version 2, or (at your option)
00004    any later version.
00005
00006    This program is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009    GNU General Public License for more details.  */
00010
00011 #include <assert.h>
00012 #include "cvs.h"
00013 #include "watch.h"
00014 #include "edit.h"
00015 #include "fileattr.h"
00016 #include "getline.h"
00017 #include "buffer.h"
00018
00019 #ifdef CVSGUI_PIPE
00020 #include "cvsgui_protocol.h"
00021 #endif
00022
00023 #ifdef SERVER_SUPPORT
00024
00025 #ifdef HAVE_WINSOCK_H
00026 #include <winsock.h>
00027 #endif
00028
00029 #if defined (AUTH_SERVER_SUPPORT) || defined (HAVE_KERBEROS) || defined (HAVE_GSSAPI)
00030 #include <sys/socket.h>
00031 #endif
00032
00033 #ifdef HAVE_KERBEROS
00034 #  include <netinet/in.h>
00035 #  include <krb.h>
00036 #  ifndef HAVE_KRB_GET_ERR_TEXT
00037 #    define krb_get_err_text(status) krb_err_txt[status]
00038 #  endif
00039
00040 /* Information we need if we are going to use Kerberos encryption.  */
00041 static C_Block kblock;
00042 static Key_schedule sched;
00043
00044 #endif
00045
00046 #ifdef HAVE_GSSAPI
00047
00048 #include <netdb.h>
00049
00050 #ifdef HAVE_GSSAPI_H
00051 #include <gssapi.h>
00052 #endif
00053 #ifdef HAVE_GSSAPI_GSSAPI_H
00054 #include <gssapi/gssapi.h>
00055 #endif
00056 #ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
00057 #include <gssapi/gssapi_generic.h>
00058 #endif
00059
00060 #ifndef HAVE_GSS_C_NT_HOSTBASED_SERVICE
00061 #define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
00062 #endif
00063
00064 /* We use Kerberos 5 routines to map the GSSAPI credential to a user
00065    name.  */
00066 #include <krb5.h>
00067
00068 /* We need this to wrap data.  */
00069 static gss_ctx_id_t gcontext;
00070
00071 static void gserver_authenticate_connection PROTO((void));
00072
00073 /* Whether we are already wrapping GSSAPI communication.  */
00074 static int cvs_gssapi_wrapping;
00075
00076 #  ifdef ENCRYPTION
00077 /* Whether to encrypt GSSAPI communication.  We use a global variable
00078    like this because we use the same buffer type (gssapi_wrap) to
00079    handle both authentication and encryption, and we don't want
00080    multiple instances of that buffer in the communication stream.  */
00081 int cvs_gssapi_encrypt;
00082 #  endif
00083
00084 #endif
00085
00086 /* for select */
00087 #include <sys/types.h>
00088 #ifdef HAVE_SYS_BSDTYPES_H
00089 #include <sys/bsdtypes.h>
00090 #endif
00091
00092 #if TIME_WITH_SYS_TIME
00093 # include <sys/time.h>
00094 # include <time.h>
00095 #else
00096 # if HAVE_SYS_TIME_H
00097 #  include <sys/time.h>
00098 # else
00099 #  include <time.h>
00100 # endif
00101 #endif
00102
00103 #if HAVE_SYS_SELECT_H
00104 #include <sys/select.h>
00105 #endif
00106
00107 #ifndef O_NONBLOCK
00108 #define O_NONBLOCK O_NDELAY
00109 #endif
00110
00111 /* EWOULDBLOCK is not defined by POSIX, but some BSD systems will
00112    return it, rather than EAGAIN, for nonblocking writes.  */
00113 #ifdef EWOULDBLOCK
00114 #define blocking_error(err) ((err) == EWOULDBLOCK || (err) == EAGAIN)
00115 #else
00116 #define blocking_error(err) ((err) == EAGAIN)
00117 #endif
00118
00119 #ifdef AUTH_SERVER_SUPPORT
00120 #ifdef HAVE_GETSPNAM
00121 #include <shadow.h>
00122 #endif
00123 #endif /* AUTH_SERVER_SUPPORT */
00124
00125 /* For initgroups().  */
00126 #if HAVE_INITGROUPS
00127 #include <grp.h>
00128 #endif /* HAVE_INITGROUPS */
00129
00130 #ifdef AUTH_SERVER_SUPPORT
00131
00132 /* The cvs username sent by the client, which might or might not be
00133    the same as the system username the server eventually switches to
00134    run as.  CVS_Username gets set iff password authentication is
00135    successful. */
00136 char *CVS_Username = NULL;
00137
00138 /* Used to check that same repos is transmitted in pserver auth and in
00139    later CVS protocol.  Exported because root.c also uses. */
00140 static char *Pserver_Repos = NULL;
00141
00142 /* Should we check for system usernames/passwords?  Can be changed by
00143    CVSROOT/config.  */
00144 int system_auth = 1;
00145
00146 #endif /* AUTH_SERVER_SUPPORT */
00147
00148
00149 /* While processing requests, this buffer accumulates data to be sent to
00150    the client, and then once we are in do_cvs_command, we use it
00151    for all the data to be sent.  */
00152 static struct buffer *buf_to_net;
00153
00154 /* This buffer is used to read input from the client.  */
00155 static struct buffer *buf_from_net;
00156
00157 /*
00158  * This is where we stash stuff we are going to use.  Format string
00159  * which expects a single directory within it, starting with a slash.
00160  */
00161 static char *server_temp_dir;
00162
00163 /* This is the original value of server_temp_dir, before any possible
00164    changes inserted by serve_max_dotdot.  */
00165 static char *orig_server_temp_dir;
00166
00167 /* Nonzero if we should keep the temp directory around after we exit.  */
00168 static int dont_delete_temp;
00169
00170 static void server_write_entries PROTO((void));
00171
00172 /* All server communication goes through buffer structures.  Most of
00173    the buffers are built on top of a file descriptor.  This structure
00174    is used as the closure field in a buffer.  */
00175
00176 struct fd_buffer
00177 {
00178     /* The file descriptor.  */
00179     int fd;
00180     /* Nonzero if the file descriptor is in blocking mode.  */
00181     int blocking;
00182 };
00183
00184 static struct buffer *fd_buffer_initialize
00185   PROTO ((int, int, void (*) (struct buffer *)));
00186 static int fd_buffer_input PROTO((void *, char *, int, int, int *));
00187 static int fd_buffer_output PROTO((void *, const char *, int, int *));
00188 static int fd_buffer_flush PROTO((void *));
00189 static int fd_buffer_block PROTO((void *, int));
00190 static int fd_buffer_shutdown PROTO((void *));
00191
00192 /* Initialize a buffer built on a file descriptor.  FD is the file
00193    descriptor.  INPUT is nonzero if this is for input, zero if this is
00194    for output.  MEMORY is the function to call when a memory error
00195    occurs.  */
00196
00197 static struct buffer *
00198 fd_buffer_initialize (fd, input, memory)
00199      int fd;
00200      int input;
00201      void (*memory) PROTO((struct buffer *));
00202 {
00203     struct fd_buffer *n;
00204
00205     n = (struct fd_buffer *) xmalloc (sizeof *n);
00206     n->fd = fd;
00207     n->blocking = 1;
00208     return buf_initialize (input ? fd_buffer_input : NULL,
00209                input ? NULL : fd_buffer_output,
00210                input ? NULL : fd_buffer_flush,
00211                fd_buffer_block,
00212                fd_buffer_shutdown,
00213                memory,
00214                n);
00215 }
00216
00217 /* The buffer input function for a buffer built on a file descriptor.  */
00218
00219 static int
00220 fd_buffer_input (closure, data, need, size, got)
00221      void *closure;
00222      char *data;
00223      int need;
00224      int size;
00225      int *got;
00226 {
00227     struct fd_buffer *fd = (struct fd_buffer *) closure;
00228     int nbytes;
00229
00230     if (! fd->blocking)
00231     nbytes = read (fd->fd, data, size);
00232     else
00233     {
00234     /* This case is not efficient.  Fortunately, I don't think it
00235            ever actually happens.  */
00236     nbytes = read (fd->fd, data, need == 0 ? 1 : need);
00237     }
00238
00239     if (nbytes > 0)
00240     {
00241     *got = nbytes;
00242     return 0;
00243     }
00244
00245     *got = 0;
00246
00247     if (nbytes == 0)
00248     {
00249     /* End of file.  This assumes that we are using POSIX or BSD
00250            style nonblocking I/O.  On System V we will get a zero
00251            return if there is no data, even when not at EOF.  */
00252     return -1;
00253     }
00254
00255     /* Some error occurred.  */
00256
00257     if (blocking_error (errno))
00258     {
00259     /* Everything's fine, we just didn't get any data.  */
00260     return 0;
00261     }
00262
00263     return errno;
00264 }
00265
00266 /* The buffer output function for a buffer built on a file descriptor.  */
00267
00268 static int
00269 fd_buffer_output (closure, data, have, wrote)
00270      void *closure;
00271      const char *data;
00272      int have;
00273      int *wrote;
00274 {
00275     struct fd_buffer *fd = (struct fd_buffer *) closure;
00276
00277     *wrote = 0;
00278
00279     while (have > 0)
00280     {
00281     int nbytes;
00282
00283     nbytes = write (fd->fd, data, have);
00284
00285     if (nbytes <= 0)
00286     {
00287         if (! fd->blocking
00288         && (nbytes == 0 || blocking_error (errno)))
00289         {
00290         /* A nonblocking write failed to write any data.  Just
00291                    return.  */
00292         return 0;
00293         }
00294
00295         /* Some sort of error occurred.  */
00296
00297         if (nbytes == 0)
00298             return EIO;
00299
00300         return errno;
00301     }
00302
00303     *wrote += nbytes;
00304     data += nbytes;
00305     have -= nbytes;
00306     }
00307
00308     return 0;
00309 }
00310
00311 /* The buffer flush function for a buffer built on a file descriptor.  */
00312
00313 /*ARGSUSED*/
00314 static int
00315 fd_buffer_flush (closure)
00316      void *closure;
00317 {
00318     /* Nothing to do.  File descriptors are always flushed.  */
00319     return 0;
00320 }
00321
00322 /* The buffer block function for a buffer built on a file descriptor.  */
00323
00324 static int
00325 fd_buffer_block (closure, block)
00326      void *closure;
00327      int block;
00328 {
00329     struct fd_buffer *fd = (struct fd_buffer *) closure;
00330     int flags;
00331
00332     flags = fcntl (fd->fd, F_GETFL, 0);
00333     if (flags < 0)
00334     return errno;
00335
00336     if (block)
00337     flags &= ~O_NONBLOCK;
00338     else
00339     flags |= O_NONBLOCK;
00340
00341     if (fcntl (fd->fd, F_SETFL, flags) < 0)
00342         return errno;
00343
00344     fd->blocking = block;
00345
00346     return 0;
00347 }
00348
00349 /* The buffer shutdown function for a buffer built on a file descriptor.  */
00350
00351 static int
00352 fd_buffer_shutdown (closure)
00353      void *closure;
00354 {
00355     free (closure);
00356     return 0;
00357 }
00358
00359 /* Populate all of the directories between BASE_DIR and its relative
00360    subdirectory DIR with CVSADM directories.  Return 0 for success or
00361    errno value.  */
00362 static int create_adm_p PROTO((char *, char *));
00363
00364 static int
00365 create_adm_p (base_dir, dir)
00366     char *base_dir;
00367     char *dir;
00368 {
00369     char *dir_where_cvsadm_lives, *dir_to_register, *p, *tmp;
00370     int retval, done;
00371     FILE *f;
00372
00373     if (strcmp (dir, ".") == 0)
00374     return 0;           /* nothing to do */
00375
00376     /* Allocate some space for our directory-munging string. */
00377     p = malloc (strlen (dir) + 1);
00378     if (p == NULL)
00379     return ENOMEM;
00380
00381     dir_where_cvsadm_lives = malloc (strlen (base_dir) + strlen (dir) + 100);
00382     if (dir_where_cvsadm_lives == NULL)
00383     return ENOMEM;
00384
00385     /* Allocate some space for the temporary string in which we will
00386        construct filenames. */
00387     tmp = malloc (strlen (base_dir) + strlen (dir) + 100);
00388     if (tmp == NULL)
00389     return ENOMEM;
00390
00391
00392     /* We make several passes through this loop.  On the first pass,
00393        we simply create the CVSADM directory in the deepest directory.
00394        For each subsequent pass, we try to remove the last path
00395        element from DIR, create the CVSADM directory in the remaining
00396        pathname, and register the subdirectory in the newly created
00397        CVSADM directory. */
00398
00399     retval = done = 0;
00400
00401     strcpy (p, dir);
00402     strcpy (dir_where_cvsadm_lives, base_dir);
00403     strcat (dir_where_cvsadm_lives, "/");
00404     strcat (dir_where_cvsadm_lives, p);
00405     dir_to_register = NULL;
00406
00407     while (1)
00408     {
00409     /* Create CVSADM. */
00410     (void) sprintf (tmp, "%s/%s", dir_where_cvsadm_lives, CVSADM);
00411     if ((CVS_MKDIR (tmp, 0777) < 0) && (errno != EEXIST))
00412     {
00413         retval = errno;
00414         goto finish;
00415     }
00416
00417     /* Create CVSADM_REP. */
00418     (void) sprintf (tmp, "%s/%s", dir_where_cvsadm_lives, CVSADM_REP);
00419     if (! isfile (tmp))
00420     {
00421         /* Use Emptydir as the placeholder until the client sends
00422            us the real value.  This code is similar to checkout.c
00423            (emptydir_name), but the code below returns errors
00424            differently.  */
00425
00426         char *empty;
00427         empty = malloc (strlen (CVSroot_directory)
00428                 + sizeof (CVSROOTADM)
00429                 + sizeof (CVSNULLREPOS)
00430                 + 10);
00431         if (! empty)
00432         {
00433         retval = ENOMEM;
00434         goto finish;
00435         }
00436
00437         /* Create the directory name. */
00438         (void) sprintf (empty, "%s/%s/%s", CVSroot_directory,
00439                 CVSROOTADM, CVSNULLREPOS);
00440
00441         /* Create the directory if it doesn't exist. */
00442         if (! isfile (empty))
00443         {
00444         mode_t omask;
00445         omask = umask (cvsumask);
00446         if (CVS_MKDIR (empty, 0777) < 0)
00447         {
00448             retval = errno;
00449             free (empty);
00450             goto finish;
00451         }
00452         (void) umask (omask);
00453         }
00454
00455
00456         f = CVS_FOPEN (tmp, "w");
00457         if (f == NULL)
00458         {
00459         retval = errno;
00460         free (empty);
00461         goto finish;
00462         }
00463         /* Write the directory name to CVSADM_REP. */
00464         if (fprintf (f, "%s\n", empty) < 0)
00465         {
00466         retval = errno;
00467         fclose (f);
00468         free (empty);
00469         goto finish;
00470         }
00471         if (fclose (f) == EOF)
00472         {
00473         retval = errno;
00474         free (empty);
00475         goto finish;
00476         }
00477
00478         /* Clean up after ourselves. */
00479         free (empty);
00480     }
00481
00482     /* Create CVSADM_ENT.  We open in append mode because we
00483        don't want to clobber an existing Entries file.  */
00484     (void) sprintf (tmp, "%s/%s", dir_where_cvsadm_lives, CVSADM_ENT);
00485     f = CVS_FOPEN (tmp, "a");
00486     if (f == NULL)
00487     {
00488         retval = errno;
00489         goto finish;
00490     }
00491     if (fclose (f) == EOF)
00492     {
00493         retval = errno;
00494         goto finish;
00495     }
00496
00497     if (dir_to_register != NULL)
00498     {
00499         /* FIXME: Yes, this results in duplicate entries in the
00500            Entries.Log file, but it doesn't currently matter.  We
00501            might need to change this later on to make sure that we
00502            only write one entry.  */
00503
00504         Subdir_Register ((List *) NULL, dir_where_cvsadm_lives,
00505                  dir_to_register);
00506     }
00507
00508     if (done)
00509         break;
00510
00511     dir_to_register = strrchr (p, '/');
00512     if (dir_to_register == NULL)
00513     {
00514         dir_to_register = p;
00515         strcpy (dir_where_cvsadm_lives, base_dir);
00516         done = 1;
00517     }
00518     else
00519     {
00520         *dir_to_register = '\0';
00521         dir_to_register++;
00522         strcpy (dir_where_cvsadm_lives, base_dir);
00523         strcat (dir_where_cvsadm_lives, "/");
00524         strcat (dir_where_cvsadm_lives, p);
00525     }
00526     }
00527
00528   finish:
00529     free (tmp);
00530     free (dir_where_cvsadm_lives);
00531     free (p);
00532     return retval;
00533 }
00534
00535 /*
00536  * Make directory DIR, including all intermediate directories if necessary.
00537  * Returns 0 for success or errno code.
00538  */
00539 static int mkdir_p PROTO((char *));
00540
00541 static int
00542 mkdir_p (dir)
00543      char *dir;
00544 {
00545     char *p;
00546     char *q = malloc (strlen (dir) + 1);
00547     int retval;
00548
00549     if (q == NULL)
00550     return ENOMEM;
00551
00552     retval = 0;
00553
00554     /*
00555      * Skip over leading slash if present.  We won't bother to try to
00556      * make '/'.
00557      */
00558     p = dir + 1;
00559     while (1)
00560     {
00561     while (*p != '/' && *p != '\0')
00562         ++p;
00563     if (*p == '/')
00564     {
00565         strncpy (q, dir, p - dir);
00566         q[p - dir] = '\0';
00567         if (q[p - dir - 1] != '/'  &&  CVS_MKDIR (q, 0777) < 0)
00568         {
00569         int saved_errno = errno;
00570
00571         if (saved_errno != EEXIST
00572             && ((saved_errno != EACCES && saved_errno != EROFS)
00573             || !isdir (q)))
00574         {
00575             retval = saved_errno;
00576             goto done;
00577         }
00578         }
00579         ++p;
00580     }
00581     else
00582     {
00583         if (CVS_MKDIR (dir, 0777) < 0)
00584         retval = errno;
00585         goto done;
00586     }
00587     }
00588   done:
00589     free (q);
00590     return retval;
00591 }
00592
00593 /*
00594  * Print the error response for error code STATUS.  The caller is
00595  * reponsible for making sure we get back to the command loop without
00596  * any further output occuring.
00597  * Must be called only in contexts where it is OK to send output.
00598  */
00599 static void
00600 print_error (status)
00601     int status;
00602 {
00603     char *msg;
00604     buf_output0 (buf_to_net, "error  ");
00605     msg = strerror (status);
00606     if (msg)
00607     buf_output0 (buf_to_net, msg);
00608     buf_append_char (buf_to_net, '\n');
00609
00610     buf_flush (buf_to_net, 0);
00611 }
00612
00613 static int pending_error;
00614 /*
00615  * Malloc'd text for pending error.  Each line must start with "E ".  The
00616  * last line should not end with a newline.
00617  */
00618 static char *pending_error_text;
00619
00620 /* If an error is pending, print it and return 1.  If not, return 0.
00621    Must be called only in contexts where it is OK to send output.  */
00622 static int
00623 print_pending_error ()
00624 {
00625     if (pending_error_text)
00626     {
00627     buf_output0 (buf_to_net, pending_error_text);
00628     buf_append_char (buf_to_net, '\n');
00629     if (pending_error)
00630         print_error (pending_error);
00631     else
00632         buf_output0 (buf_to_net, "error  \n");
00633
00634     buf_flush (buf_to_net, 0);
00635
00636     pending_error = 0;
00637     free (pending_error_text);
00638     pending_error_text = NULL;
00639     return 1;
00640     }
00641     else if (pending_error)
00642     {
00643     print_error (pending_error);
00644     pending_error = 0;
00645     return 1;
00646     }
00647     else
00648     return 0;
00649 }
00650
00651 /* Is an error pending?  */
00652 #define error_pending() (pending_error || pending_error_text)
00653
00654 static int alloc_pending PROTO ((size_t size));
00655
00656 /* Allocate SIZE bytes for pending_error_text and return nonzero
00657    if we could do it.  */
00658 static int
00659 alloc_pending (size)
00660     size_t size;
00661 {
00662     if (error_pending ())
00663     /* Probably alloc_pending callers will have already checked for
00664        this case.  But we might as well handle it if they don't, I
00665        guess.  */
00666     return 0;
00667     pending_error_text = malloc (size);
00668     if (pending_error_text == NULL)
00669     {
00670     pending_error = ENOMEM;
00671     return 0;
00672     }
00673     return 1;
00674 }
00675
00676 static void serve_is_modified PROTO ((char *));
00677
00678 static int supported_response PROTO ((char *));
00679
00680 static int
00681 supported_response (name)
00682      char *name;
00683 {
00684     struct response *rs;
00685
00686     for (rs = responses; rs->name != NULL; ++rs)
00687     if (strcmp (rs->name, name) == 0)
00688         return rs->status == rs_supported;
00689     error (1, 0, "internal error: testing support for unknown response?");
00690     /* NOTREACHED */
00691     return 0;
00692 }
00693
00694 static void
00695 serve_valid_responses (arg)
00696      char *arg;
00697 {
00698     char *p = arg;
00699     char *q;
00700     struct response *rs;
00701     do
00702     {
00703     q = strchr (p, ' ');
00704     if (q != NULL)
00705         *q++ = '\0';
00706     for (rs = responses; rs->name != NULL; ++rs)
00707     {
00708         if (strcmp (rs->name, p) == 0)
00709         break;
00710     }
00711     if (rs->name == NULL)
00712         /*
00713          * It is a response we have never heard of (and thus never
00714          * will want to use).  So don't worry about it.
00715          */
00716         ;
00717     else
00718         rs->status = rs_supported;
00719     p = q;
00720     } while (q != NULL);
00721     for (rs = responses; rs->name != NULL; ++rs)
00722     {
00723     if (rs->status == rs_essential)
00724     {
00725         buf_output0 (buf_to_net, "E response `");
00726         buf_output0 (buf_to_net, rs->name);
00727         buf_output0 (buf_to_net, "' not supported by client\nerror  \n");
00728
00729         /* FIXME: This call to buf_flush could conceivably
00730            cause deadlock, as noted in server_cleanup.  */
00731         buf_flush (buf_to_net, 1);
00732
00733         /* I'm doing this manually rather than via error_exit ()
00734            because I'm not sure whether we want to call server_cleanup.
00735            Needs more investigation....  */
00736
00737 #ifdef SYSTEM_CLEANUP
00738         /* Hook for OS-specific behavior, for example socket subsystems on
00739            NT and OS2 or dealing with windows and arguments on Mac.  */
00740         SYSTEM_CLEANUP ();
00741 #endif
00742
00743         exit (EXIT_FAILURE);
00744     }
00745     else if (rs->status == rs_optional)
00746         rs->status = rs_not_supported;
00747     }
00748 }
00749
00750 static void
00751 serve_root (arg)
00752     char *arg;
00753 {
00754     char *env;
00755     char *path;
00756
00757     if (error_pending()) return;
00758
00759     if (!isabsolute (arg))
00760     {
00761     if (alloc_pending (80 + strlen (arg)))
00762         sprintf (pending_error_text,
00763              "E Root %s must be an absolute pathname", arg);
00764     return;
00765     }
00766
00767     /* Sending "Root" twice is illegal.
00768
00769        The other way to handle a duplicate Root requests would be as a
00770        request to clear out all state and start over as if it was a
00771        new connection.  Doing this would cause interoperability
00772        headaches, so it should be a different request, if there is
00773        any reason why such a feature is needed.  */
00774     if (CVSroot_directory != NULL)
00775     {
00776     if (alloc_pending (80 + strlen (arg)))
00777         sprintf (pending_error_text,
00778              "E Protocol error: Duplicate Root request, for %s", arg);
00779     return;
00780     }
00781
00782 #ifdef AUTH_SERVER_SUPPORT
00783     if (Pserver_Repos != NULL)
00784     {
00785     if (strcmp (Pserver_Repos, arg) != 0)
00786     {
00787         if (alloc_pending (80 + strlen (Pserver_Repos) + strlen (arg)))
00788         /* The explicitness is to aid people who are writing clients.
00789            I don't see how this information could help an
00790            attacker.  */
00791         sprintf (pending_error_text, "\
00792 E Protocol error: Root says \"%s\" but pserver says \"%s\"",
00793              arg, Pserver_Repos);
00794     }
00795     }
00796 #endif
00797     set_local_cvsroot (arg);
00798
00799     /* For pserver, this will already have happened, and the call will do
00800        nothing.  But for rsh, we need to do it now.  */
00801     parse_config (CVSroot_directory);
00802
00803     path = malloc (strlen (CVSroot_directory)
00804            + sizeof (CVSROOTADM)
00805            + 10);
00806     if (path == NULL)
00807     {
00808     pending_error = ENOMEM;
00809     return;
00810     }
00811     (void) sprintf (path, "%s/%s", CVSroot_directory, CVSROOTADM);
00812     if (!isaccessible (path, R_OK | X_OK))
00813     {
00814     int save_errno = errno;
00815     if (alloc_pending (80 + strlen (path)))
00816         sprintf (pending_error_text, "E Cannot access %s", path);
00817     pending_error = save_errno;
00818     }
00819     free (path);
00820
00821 #ifdef HAVE_PUTENV
00822     env = malloc (strlen (CVSROOT_ENV) + strlen (CVSroot_directory) + 1 + 1);
00823     if (env == NULL)
00824     {
00825     pending_error = ENOMEM;
00826     return;
00827     }
00828     (void) sprintf (env, "%s=%s", CVSROOT_ENV, CVSroot_directory);
00829     (void) putenv (env);
00830     /* do not free env, as putenv has control of it */
00831 #endif
00832 }
00833
00834 static int max_dotdot_limit = 0;
00835
00836 /* Is this pathname OK to recurse into when we are running as the server?
00837    If not, call error() with a fatal error.  */
00838 void
00839 server_pathname_check (path)
00840     char *path;
00841 {
00842     /* An absolute pathname is almost surely a path on the *client* machine,
00843        and is unlikely to do us any good here.  It also is probably capable
00844        of being a security hole in the anonymous readonly case.  */
00845     if (isabsolute (path))
00846     /* Giving an error is actually kind of a cop-out, in the sense
00847        that it would be nice for "cvs co -d /foo/bar/baz" to work.
00848        A quick fix in the server would be requiring Max-dotdot of
00849        at least one if pathnames are absolute, and then putting
00850        /abs/foo/bar/baz in the temp dir beside the /d/d/d stuff.
00851        A cleaner fix in the server might be to decouple the
00852        pathnames we pass back to the client from pathnames in our
00853        temp directory (this would also probably remove the need
00854        for Max-dotdot).  A fix in the client would have the client
00855        turn it into "cd /foo/bar; cvs co -d baz" (more or less).
00856        This probably has some problems with pathnames which appear
00857        in messages.  */
00858     error (1, 0, "absolute pathname `%s' illegal for server", path);
00859     if (pathname_levels (path) > max_dotdot_limit)
00860     {
00861     /* Similar to the isabsolute case in security implications.  */
00862     error (0, 0, "protocol error: `%s' contains more leading ..", path);
00863     error (1, 0, "than the %d which Max-dotdot specified",
00864            max_dotdot_limit);
00865     }
00866 }
00867
00868 static int outside_root PROTO ((char *));
00869
00870 /* Is file or directory REPOS an absolute pathname within the
00871    CVSroot_directory?  If yes, return 0.  If no, set pending_error
00872    and return 1.  */
00873 static int
00874 outside_root (repos)
00875     char *repos;
00876 {
00877     size_t repos_len = strlen (repos);
00878     size_t root_len = strlen (CVSroot_directory);
00879
00880     /* I think isabsolute (repos) should always be true, and that
00881        any RELATIVE_REPOS stuff should only be in CVS/Repository
00882        files, not the protocol (for compatibility), but I'm putting
00883        in the isabsolute check just in case.  */
00884     if (!isabsolute (repos))
00885     {
00886     if (alloc_pending (repos_len + 80))
00887         sprintf (pending_error_text, "\
00888 E protocol error: %s is not absolute", repos);
00889     return 1;
00890     }
00891
00892     if (repos_len < root_len
00893     || strncmp (CVSroot_directory, repos, root_len) != 0)
00894     {
00895     not_within:
00896     if (alloc_pending (strlen (CVSroot_directory)
00897                + strlen (repos)
00898                + 80))
00899         sprintf (pending_error_text, "\
00900 E protocol error: directory '%s' not within root '%s'",
00901              repos, CVSroot_directory);
00902     return 1;
00903     }
00904     if (repos_len > root_len)
00905     {
00906     if (repos[root_len] != '/')
00907         goto not_within;
00908     if (pathname_levels (repos + root_len + 1) > 0)
00909         goto not_within;
00910     }
00911     return 0;
00912 }
00913
00914 static int outside_dir PROTO ((char *));
00915
00916 /* Is file or directory FILE outside the current directory (that is, does
00917    it contain '/')?  If no, return 0.  If yes, set pending_error
00918    and return 1.  */
00919 static int
00920 outside_dir (file)
00921     char *file;
00922 {
00923     if (strchr (file, '/') != NULL)
00924     {
00925     if (alloc_pending (strlen (file)
00926                + 80))
00927         sprintf (pending_error_text, "\
00928 E protocol error: directory '%s' not within current directory",
00929              file);
00930     return 1;
00931     }
00932     return 0;
00933 }
00934
00935 /*
00936  * Add as many directories to the temp directory as the client tells us it
00937  * will use "..", so we never try to access something outside the temp
00938  * directory via "..".
00939  */
00940 static void
00941 serve_max_dotdot (arg)
00942     char *arg;
00943 {
00944     int lim = atoi (arg);
00945     int i;
00946     char *p;
00947
00948     if (lim < 0)
00949     return;
00950     p = malloc (strlen (server_temp_dir) + 2 * lim + 10);
00951     if (p == NULL)
00952     {
00953     pending_error = ENOMEM;
00954     return;
00955     }
00956     strcpy (p, server_temp_dir);
00957     for (i = 0; i < lim; ++i)
00958     strcat (p, "/d");
00959     if (server_temp_dir != orig_server_temp_dir)
00960     free (server_temp_dir);
00961     server_temp_dir = p;
00962     max_dotdot_limit = lim;
00963 }
00964
00965 static char *dir_name;
00966
00967 static void
00968 dirswitch (dir, repos)
00969     char *dir;
00970     char *repos;
00971 {
00972     int status;
00973     FILE *f;
00974     size_t dir_len;
00975
00976     server_write_entries ();
00977
00978     if (error_pending()) return;
00979
00980     /* Check for bad directory name.
00981
00982        FIXME: could/should unify these checks with server_pathname_check
00983        except they need to report errors differently.  */
00984     if (isabsolute (dir))
00985     {
00986     if (alloc_pending (80 + strlen (dir)))
00987         sprintf (pending_error_text,
00988              "E absolute pathname `%s' illegal for server", dir);
00989     return;
00990     }
00991     if (pathname_levels (dir) > max_dotdot_limit)
00992     {
00993     if (alloc_pending (80 + strlen (dir)))
00994         sprintf (pending_error_text,
00995              "E protocol error: `%s' has too many ..", dir);
00996     return;
00997     }
00998
00999     if (dir_name != NULL)
01000     free (dir_name);
01001
01002     dir_len = strlen (dir);
01003
01004     /* Check for a trailing '/'.  This is not ISDIRSEP because \ in the
01005        protocol is an ordinary character, not a directory separator (of
01006        course, it is perhaps unwise to use it in directory names, but that
01007        is another issue).  */
01008     if (dir_len > 0
01009     && dir[dir_len - 1] == '/')
01010     {
01011     if (alloc_pending (80 + dir_len))
01012         sprintf (pending_error_text,
01013              "E protocol error: invalid directory syntax in %s", dir);
01014     return;
01015     }
01016
01017     dir_name = malloc (strlen (server_temp_dir) + dir_len + 40);
01018     if (dir_name == NULL)
01019     {
01020     pending_error = ENOMEM;
01021     return;
01022     }
01023
01024     strcpy (dir_name, server_temp_dir);
01025     strcat (dir_name, "/");
01026     strcat (dir_name, dir);
01027
01028     status = mkdir_p (dir_name);
01029     if (status != 0
01030     && status != EEXIST)
01031     {
01032     if (alloc_pending (80 + strlen (dir_name)))
01033         sprintf (pending_error_text, "E cannot mkdir %s", dir_name);
01034     pending_error = status;
01035     return;
01036     }
01037
01038     /* We need to create adm directories in all path elements because
01039        we want the server to descend them, even if the client hasn't
01040        sent the appropriate "Argument xxx" command to match the
01041        already-sent "Directory xxx" command.  See recurse.c
01042        (start_recursion) for a big discussion of this.  */
01043
01044     status = create_adm_p (server_temp_dir, dir);
01045     if (status != 0)
01046     {
01047     if (alloc_pending (80 + strlen (dir_name)))
01048         sprintf (pending_error_text, "E cannot create_adm_p %s", dir_name);
01049     pending_error = status;
01050     return;
01051     }
01052
01053     if ( CVS_CHDIR (dir_name) < 0)
01054     {
01055     int save_errno = errno;
01056     if (alloc_pending (80 + strlen (dir_name)))
01057         sprintf (pending_error_text, "E cannot change to %s", dir_name);
01058     pending_error = save_errno;
01059     return;
01060     }
01061     /*
01062      * This is pretty much like calling Create_Admin, but Create_Admin doesn't
01063      * report errors in the right way for us.
01064      */
01065     if ((CVS_MKDIR (CVSADM, 0777) < 0) && (errno != EEXIST))
01066     {
01067     int save_errno = errno;
01068     if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM)))
01069         sprintf (pending_error_text,
01070              "E cannot mkdir %s/%s", dir_name, CVSADM);
01071     pending_error = save_errno;
01072     return;
01073     }
01074
01075     /* The following will overwrite the contents of CVSADM_REP.  This
01076        is the correct behavior -- mkdir_p may have written a
01077        placeholder value to this file and we need to insert the
01078        correct value. */
01079
01080     f = CVS_FOPEN (CVSADM_REP, "w");
01081     if (f == NULL)
01082     {
01083     int save_errno = errno;
01084     if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM_REP)))
01085         sprintf (pending_error_text,
01086              "E cannot open %s/%s", dir_name, CVSADM_REP);
01087     pending_error = save_errno;
01088     return;
01089     }
01090     if (fprintf (f, "%s", repos) < 0)
01091     {
01092     int save_errno = errno;
01093     if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM_REP)))
01094         sprintf (pending_error_text,
01095              "E error writing %s/%s", dir_name, CVSADM_REP);
01096     pending_error = save_errno;
01097     fclose (f);
01098     return;
01099     }
01100     /* Non-remote CVS handles a module representing the entire tree
01101        (e.g., an entry like ``world -a .'') by putting /. at the end
01102        of the Repository file, so we do the same.  */
01103     if (strcmp (dir, ".") == 0
01104     && CVSroot_directory != NULL
01105     && strcmp (CVSroot_directory, repos) == 0)
01106     {
01107         if (fprintf (f, "/.") < 0)
01108     {
01109         int save_errno = errno;
01110         if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM_REP)))
01111         sprintf (pending_error_text,
01112              "E error writing %s/%s", dir_name, CVSADM_REP);
01113         pending_error = save_errno;
01114         fclose (f);
01115         return;
01116     }
01117     }
01118     if (fprintf (f, "\n") < 0)
01119     {
01120     int save_errno = errno;
01121     if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM_REP)))
01122         sprintf (pending_error_text,
01123              "E error writing %s/%s", dir_name, CVSADM_REP);
01124     pending_error = save_errno;
01125     fclose (f);
01126     return;
01127     }
01128     if (fclose (f) == EOF)
01129     {
01130     int save_errno = errno;
01131     if (alloc_pending (80 + strlen (dir_name) + strlen (CVSADM_REP)))
01132         sprintf (pending_error_text,
01133              "E error closing %s/%s", dir_name, CVSADM_REP);
01134     pending_error = save_errno;
01135     return;
01136     }
01137     /* We open in append mode because we don't want to clobber an
01138        existing Entries file.  */
01139     f = CVS_FOPEN (CVSADM_ENT, "a");
01140     if (f == NULL)
01141     {
01142     int save_errno = errno;
01143     if (alloc_pending (80 + strlen (CVSADM_ENT)))
01144         sprintf (pending_error_text, "E cannot open %s", CVSADM_ENT);
01145     pending_error = save_errno;
01146     return;
01147     }
01148     if (fclose (f) == EOF)
01149     {
01150     int save_errno = errno;
01151     if (alloc_pending (80 + strlen (CVSADM_ENT)))
01152         sprintf (pending_error_text, "E cannot close %s", CVSADM_ENT);
01153     pending_error = save_errno;
01154     return;
01155     }
01156 }
01157
01158 static void
01159 serve_repository (arg)
01160     char *arg;
01161 {
01162     if (alloc_pending (80))
01163     strcpy (pending_error_text,
01164         "E Repository request is obsolete; aborted");
01165     return;
01166 }
01167
01168 static void
01169 serve_directory (arg)
01170     char *arg;
01171 {
01172     int status;
01173     char *repos;
01174
01175     status = buf_read_line (buf_from_net, &repos, (int *) NULL);
01176     if (status == 0)
01177     {
01178     if (!outside_root (repos))
01179         dirswitch (arg, repos);
01180     free (repos);
01181     }
01182     else if (status == -2)
01183     {
01184         pending_error = ENOMEM;
01185     }
01186     else
01187     {
01188     pending_error_text = malloc (80 + strlen (arg));
01189     if (pending_error_text == NULL)
01190     {
01191         pending_error = ENOMEM;
01192     }
01193     else if (status == -1)
01194     {
01195         sprintf (pending_error_text,
01196              "E end of file reading mode for %s", arg);
01197     }
01198     else
01199     {
01200         sprintf (pending_error_text,
01201              "E error reading mode for %s", arg);
01202         pending_error = status;
01203     }
01204     }
01205 }
01206
01207 static void
01208 serve_static_directory (arg)
01209     char *arg;
01210 {
01211     FILE *f;
01212
01213     if (error_pending ()) return;
01214
01215     f = CVS_FOPEN (CVSADM_ENTSTAT, "w+");
01216     if (f == NULL)
01217     {
01218     int save_errno = errno;
01219     if (alloc_pending (80 + strlen (CVSADM_ENTSTAT)))
01220         sprintf (pending_error_text, "E cannot open %s", CVSADM_ENTSTAT);
01221     pending_error = save_errno;
01222     return;
01223     }
01224     if (fclose (f) == EOF)
01225     {
01226     int save_errno = errno;
01227     if (alloc_pending (80 + strlen (CVSADM_ENTSTAT)))
01228         sprintf (pending_error_text, "E cannot close %s", CVSADM_ENTSTAT);
01229     pending_error = save_errno;
01230     return;
01231     }
01232 }
01233
01234 static void
01235 serve_sticky (arg)
01236     char *arg;
01237 {
01238     FILE *f;
01239
01240     if (error_pending ()) return;
01241
01242     f = CVS_FOPEN (CVSADM_TAG, "w+");
01243     if (f == NULL)
01244     {
01245     int save_errno = errno;
01246     if (alloc_pending (80 + strlen (CVSADM_TAG)))
01247         sprintf (pending_error_text, "E cannot open %s", CVSADM_TAG);
01248     pending_error = save_errno;
01249     return;
01250     }
01251     if (fprintf (f, "%s\n", arg) < 0)
01252     {
01253     int save_errno = errno;
01254     if (alloc_pending (80 + strlen (CVSADM_TAG)))
01255         sprintf (pending_error_text, "E cannot write to %s", CVSADM_TAG);
01256     pending_error = save_errno;
01257     return;
01258     }
01259     if (fclose (f) == EOF)
01260     {
01261     int save_errno = errno;
01262     if (alloc_pending (80 + strlen (CVSADM_TAG)))
01263         sprintf (pending_error_text, "E cannot close %s", CVSADM_TAG);
01264     pending_error = save_errno;
01265     return;
01266     }
01267 }
01268
01269 /*
01270  * Read SIZE bytes from buf_from_net, write them to FILE.
01271  *
01272  * Currently this isn't really used for receiving parts of a file --
01273  * the file is still sent over in one chunk.  But if/when we get
01274  * spiffy in-process gzip support working, perhaps the compressed
01275  * pieces could be sent over as they're ready, if the network is fast
01276  * enough.  Or something.
01277  */
01278 static void
01279 receive_partial_file (size, file)
01280      int size;
01281      int file;
01282 {
01283     while (size > 0)
01284     {
01285     int status, nread;
01286     char *data;
01287
01288     status = buf_read_data (buf_from_net, size, &data, &nread);
01289     if (status != 0)
01290     {
01291         if (status == -2)
01292         pending_error = ENOMEM;
01293         else
01294         {
01295         pending_error_text = malloc (80);
01296         if (pending_error_text == NULL)
01297             pending_error = ENOMEM;
01298         else if (status == -1)
01299         {
01300             sprintf (pending_error_text,
01301                  "E premature end of file from client");
01302             pending_error = 0;
01303         }
01304         else
01305         {
01306             sprintf (pending_error_text,
01307                  "E error reading from client");
01308             pending_error = status;
01309         }
01310         }
01311         return;
01312     }
01313
01314     size -= nread;
01315
01316     while (nread > 0)
01317     {
01318         int nwrote;
01319
01320         nwrote = write (file, data, nread);
01321         if (nwrote < 0)
01322         {
01323             int save_errno = errno;
01324         if (alloc_pending (40))
01325             strcpy (pending_error_text, "E unable to write");
01326         pending_error = save_errno;
01327
01328         /* Read and discard the file data.  */
01329         while (size > 0)
01330         {
01331             int status, nread;
01332             char *data;
01333
01334             status = buf_read_data (buf_from_net, size, &data, &nread);
01335             if (status != 0)
01336             return;
01337             size -= nread;
01338         }
01339
01340         return;
01341         }
01342         nread -= nwrote;
01343         data += nwrote;
01344     }
01345     }
01346 }
01347
01348 /* Receive SIZE bytes, write to filename FILE.  */
01349 static void
01350 receive_file (size, file, gzipped)
01351      int size;
01352      char *file;
01353      int gzipped;
01354 {
01355     int fd;
01356     char *arg = file;
01357
01358     /* Write the file.  */
01359     fd = CVS_OPEN (arg, O_WRONLY | O_CREAT | O_TRUNC, 0600);
01360     if (fd < 0)
01361     {
01362     int save_errno = errno;
01363     if (alloc_pending (40 + strlen (arg)))
01364         sprintf (pending_error_text, "E cannot open %s", arg);
01365     pending_error = save_errno;
01366     return;
01367     }
01368
01369     if (gzipped)
01370     {
01371     /* Using gunzip_and_write isn't really a high-performance
01372        approach, because it keeps the whole thing in memory
01373        (contiguous memory, worse yet).  But it seems easier to
01374        code than the alternative (and less vulnerable to subtle
01375        bugs).  Given that this feature is mainly for
01376        compatibility, that is the better tradeoff.  */
01377
01378     int toread = size;
01379     char *filebuf;
01380     char *p;
01381
01382     filebuf = malloc (size);
01383     p = filebuf;
01384     /* If NULL, we still want to read the data and discard it.  */
01385
01386     while (toread > 0)
01387     {
01388         int status, nread;
01389         char *data;
01390
01391         status = buf_read_data (buf_from_net, toread, &data, &nread);
01392         if (status != 0)
01393         {
01394         if (status == -2)
01395             pending_error = ENOMEM;
01396         else
01397         {
01398             pending_error_text = malloc (80);
01399             if (pending_error_text == NULL)
01400             pending_error = ENOMEM;
01401             else if (status == -1)
01402             {
01403             sprintf (pending_error_text,
01404                  "E premature end of file from client");
01405             pending_error = 0;
01406             }
01407             else
01408             {
01409             sprintf (pending_error_text,
01410                  "E error reading from client");
01411             pending_error = status;
01412             }
01413         }
01414         return;
01415         }
01416
01417         toread -= nread;
01418
01419         if (filebuf != NULL)
01420         {
01421         memcpy (p, data, nread);
01422         p += nread;
01423         }
01424     }
01425     if (filebuf == NULL)
01426     {
01427         pending_error = ENOMEM;
01428         goto out;
01429     }
01430
01431     if (gunzip_and_write (fd, file, (unsigned char *) filebuf, size))
01432     {
01433         if (alloc_pending (80))
01434         sprintf (pending_error_text,
01435              "E aborting due to compression error");
01436     }
01437     free (filebuf);
01438     }
01439     else
01440     receive_partial_file (size, fd);
01441
01442     if (pending_error_text)
01443     {
01444     char *p = realloc (pending_error_text,
01445                strlen (pending_error_text) + strlen (arg) + 30);
01446     if (p)
01447     {
01448         pending_error_text = p;
01449         sprintf (p + strlen (p), ", file %s", arg);
01450     }
01451     /* else original string is supposed to be unchanged */
01452     }
01453
01454  out:
01455     if (close (fd) < 0 && !error_pending ())
01456     {
01457     int save_errno = errno;
01458     if (alloc_pending (40 + strlen (arg)))
01459         sprintf (pending_error_text, "E cannot close %s", arg);
01460     pending_error = save_errno;
01461     return;
01462     }
01463 }
01464
01465 /* Kopt for the next file sent in Modified or Is-modified.  */
01466 static char *kopt;
01467
01468 /* Timestamp (Checkin-time) for next file sent in Modified or
01469    Is-modified.  */
01470 static int checkin_time_valid;
01471 static time_t checkin_time;
01472
01473 static void serve_modified PROTO ((char *));
01474
01475 static void
01476 serve_modified (arg)
01477      char *arg;
01478 {
01479     int size, status;
01480     char *size_text;
01481     char *mode_text;
01482
01483     int gzipped = 0;
01484
01485     /*
01486      * This used to return immediately if error_pending () was true.
01487      * However, that fails, because it causes each line of the file to
01488      * be echoed back to the client as an unrecognized command.  The
01489      * client isn't reading from the socket, so eventually both
01490      * processes block trying to write to the other.  Now, we try to
01491      * read the file if we can.
01492      */
01493
01494     status = buf_read_line (buf_from_net, &mode_text, (int *) NULL);
01495     if (status != 0)
01496     {
01497         if (status == -2)
01498         pending_error = ENOMEM;
01499     else
01500     {
01501         pending_error_text = malloc (80 + strlen (arg));
01502         if (pending_error_text == NULL)
01503         pending_error = ENOMEM;
01504         else
01505         {
01506         if (status == -1)
01507             sprintf (pending_error_text,
01508                  "E end of file reading mode for %s", arg);
01509         else
01510         {
01511             sprintf (pending_error_text,
01512                  "E error reading mode for %s", arg);
01513             pending_error = status;
01514         }
01515         }
01516     }
01517     return;
01518     }
01519
01520     status = buf_read_line (buf_from_net, &size_text, (int *) NULL);
01521     if (status != 0)
01522     {
01523     if (status == -2)
01524         pending_error = ENOMEM;
01525     else
01526     {
01527         pending_error_text = malloc (80 + strlen (arg));
01528         if (pending_error_text == NULL)
01529         pending_error = ENOMEM;
01530         else
01531         {
01532         if (status == -1)
01533             sprintf (pending_error_text,
01534                  "E end of file reading size for %s", arg);
01535         else
01536         {
01537             sprintf (pending_error_text,
01538                  "E error reading size for %s", arg);
01539             pending_error = status;
01540         }
01541         }
01542     }
01543     free (mode_text);
01544     return;
01545     }
01546     if (size_text[0] == 'z')
01547     {
01548     gzipped = 1;
01549     size = atoi (size_text + 1);
01550     }
01551     else
01552     size = atoi (size_text);
01553     free (size_text);
01554
01555     if (error_pending ())
01556     {
01557         /* Now that we know the size, read and discard the file data.  */
01558     while (size > 0)
01559     {
01560         int status, nread;
01561         char *data;
01562
01563         status = buf_read_data (buf_from_net, size, &data, &nread);
01564         if (status != 0)
01565         return;
01566         size -= nread;
01567     }
01568     free (mode_text);
01569     return;
01570     }
01571
01572     if (outside_dir (arg))
01573     {
01574     free (mode_text);
01575     return;
01576     }
01577
01578     if (size >= 0)
01579     {
01580     receive_file (size, arg, gzipped);
01581     if (error_pending ())
01582     {
01583         free (mode_text);
01584         return;
01585     }
01586     }
01587
01588     if (checkin_time_valid)
01589     {
01590     struct utimbuf t;
01591
01592     memset (&t, 0, sizeof (t));
01593     t.modtime = t.actime = checkin_time;
01594     if (utime (arg, &t) < 0)
01595     {
01596         int save_errno = errno;
01597         if (alloc_pending (80 + strlen (arg)))
01598         sprintf (pending_error_text, "E cannot utime %s", arg);
01599         pending_error = save_errno;
01600         free (mode_text);
01601         return;
01602     }
01603     checkin_time_valid = 0;
01604     }
01605
01606     {
01607     int status = change_mode (arg, mode_text, 0);
01608     free (mode_text);
01609     if (status)
01610     {
01611         if (alloc_pending (40 + strlen (arg)))
01612         sprintf (pending_error_text,
01613              "E cannot change mode for %s", arg);
01614         pending_error = status;
01615         return;
01616     }
01617     }
01618
01619     /* Make sure that the Entries indicate the right kopt.  We probably
01620        could do this even in the non-kopt case and, I think, save a stat()
01621        call in time_stamp_server.  But for conservatism I'm leaving the
01622        non-kopt case alone.  */
01623     if (kopt != NULL)
01624     serve_is_modified (arg);
01625 }
01626
01627
01628 static void
01629 serve_enable_unchanged (arg)
01630      char *arg;
01631 {
01632 }
01633
01634 struct an_entry {
01635     struct an_entry *next;
01636     char *entry;
01637 };
01638
01639 static struct an_entry *entries;
01640
01641 static void serve_unchanged PROTO ((char *));
01642
01643 static void
01644 serve_unchanged (arg)
01645     char *arg;
01646 {
01647     struct an_entry *p;
01648     char *name;
01649     char *cp;
01650     char *timefield;
01651
01652     if (error_pending ())
01653     return;
01654
01655     if (outside_dir (arg))
01656     return;
01657
01658     /* Rewrite entries file to have `=' in timestamp field.  */
01659     for (p = entries; p != NULL; p = p->next)
01660     {
01661     name = p->entry + 1;
01662     cp = strchr (name, '/');
01663     if (cp != NULL
01664         && strlen (arg) == cp - name
01665         && strncmp (arg, name, cp - name) == 0)
01666     {
01667         timefield = strchr (cp + 1, '/') + 1;
01668         if (*timefield != '=')
01669         {
01670         cp = timefield + strlen (timefield);
01671         cp[1] = '\0';
01672         while (cp > timefield)
01673         {
01674             *cp = cp[-1];
01675             --cp;
01676         }
01677         *timefield = '=';
01678         }
01679         break;
01680     }
01681     }
01682 }
01683
01684 static void
01685 serve_is_modified (arg)
01686     char *arg;
01687 {
01688     struct an_entry *p;
01689     char *name;
01690     char *cp;
01691     char *timefield;
01692     /* Have we found this file in "entries" yet.  */
01693     int found;
01694
01695     if (error_pending ())
01696     return;
01697
01698     if (outside_dir (arg))
01699     return;
01700
01701     /* Rewrite entries file to have `M' in timestamp field.  */
01702     found = 0;
01703     for (p = entries; p != NULL; p = p->next)
01704     {
01705     name = p->entry + 1;
01706     cp = strchr (name, '/');
01707     if (cp != NULL
01708         && strlen (arg) == cp - name
01709         && strncmp (arg, name, cp - name) == 0)
01710     {
01711         timefield = strchr (cp + 1, '/') + 1;
01712         if (!(timefield[0] == 'M' && timefield[1] == '/'))
01713         {
01714         cp = timefield + strlen (timefield);
01715         cp[1] = '\0';
01716         while (cp > timefield)
01717         {
01718             *cp = cp[-1];
01719             --cp;
01720         }
01721         *timefield = 'M';
01722         }
01723         if (kopt != NULL)
01724         {
01725         if (alloc_pending (strlen (name) + 80))
01726             sprintf (pending_error_text,
01727                  "E protocol error: both Kopt and Entry for %s",
01728                  arg);
01729         free (kopt);
01730         kopt = NULL;
01731         return;
01732         }
01733         found = 1;
01734         break;
01735     }
01736     }
01737     if (!found)
01738     {
01739     /* We got Is-modified but no Entry.  Add a dummy entry.
01740        The "D" timestamp is what makes it a dummy.  */
01741     p = (struct an_entry *) malloc (sizeof (struct an_entry));
01742     if (p == NULL)
01743     {
01744         pending_error = ENOMEM;
01745         return;
01746     }
01747     p->entry = malloc (strlen (arg) + 80);
01748     if (p->entry == NULL)
01749     {
01750         pending_error = ENOMEM;
01751         free (p);
01752         return;
01753     }
01754     strcpy (p->entry, "/");
01755     strcat (p->entry, arg);
01756     strcat (p->entry, "//D/");
01757     if (kopt != NULL)
01758     {
01759         strcat (p->entry, kopt);
01760         free (kopt);
01761         kopt = NULL;
01762     }
01763     strcat (p->entry, "/");
01764     p->next = entries;
01765     entries = p;
01766     }
01767 }
01768
01769 static void serve_entry PROTO ((char *));
01770
01771 static void
01772 serve_entry (arg)
01773      char *arg;
01774 {
01775     struct an_entry *p;
01776     char *cp;
01777     if (error_pending()) return;
01778     p = (struct an_entry *) malloc (sizeof (struct an_entry));
01779     if (p == NULL)
01780     {
01781     pending_error = ENOMEM;
01782     return;
01783     }
01784     /* Leave space for serve_unchanged to write '=' if it wants.  */
01785     cp = malloc (strlen (arg) + 2);
01786     if (cp == NULL)
01787     {
01788     pending_error = ENOMEM;
01789     return;
01790     }
01791     strcpy (cp, arg);
01792     p->next = entries;
01793     p->entry = cp;
01794     entries = p;
01795 }
01796
01797 static void serve_kopt PROTO ((char *));
01798
01799 static void
01800 serve_kopt (arg)
01801      char *arg;
01802 {
01803     if (error_pending ())
01804     return;
01805
01806     if (kopt != NULL)
01807     {
01808     if (alloc_pending (80 + strlen (arg)))
01809         sprintf (pending_error_text,
01810              "E protocol error: duplicate Kopt request: %s", arg);
01811     return;
01812     }
01813
01814     /* Do some sanity checks.  In particular, that it is not too long.
01815        This lets the rest of the code not worry so much about buffer
01816        overrun attacks.  Probably should call RCS_check_kflag here,
01817        but that would mean changing RCS_check_kflag to handle errors
01818        other than via exit(), fprintf(), and such.  */
01819     if (strlen (arg) > 10)
01820     {
01821     if (alloc_pending (80 + strlen (arg)))
01822         sprintf (pending_error_text,
01823              "E protocol error: invalid Kopt request: %s", arg);
01824     return;
01825     }
01826
01827     kopt = malloc (strlen (arg) + 1);
01828     if (kopt == NULL)
01829     {
01830     pending_error = ENOMEM;
01831     return;
01832     }
01833     strcpy (kopt, arg);
01834 }
01835
01836 static void serve_checkin_time PROTO ((char *));
01837
01838 static void
01839 serve_checkin_time (arg)
01840      char *arg;
01841 {
01842     if (error_pending ())
01843     return;
01844
01845     if (checkin_time_valid)
01846     {
01847     if (alloc_pending (80 + strlen (arg)))
01848         sprintf (pending_error_text,
01849              "E protocol error: duplicate Checkin-time request: %s",
01850              arg);
01851     return;
01852     }
01853
01854     checkin_time = get_date (arg, NULL);
01855     if (checkin_time == (time_t)-1)
01856     {
01857     if (alloc_pending (80 + strlen (arg)))
01858         sprintf (pending_error_text, "E cannot parse date %s", arg);
01859     return;
01860     }
01861     checkin_time_valid = 1;
01862 }
01863
01864 static void
01865 server_write_entries ()
01866 {
01867     FILE *f;
01868     struct an_entry *p;
01869     struct an_entry *q;
01870
01871     if (entries == NULL)
01872     return;
01873
01874     f = NULL;
01875     /* Note that we free all the entries regardless of errors.  */
01876     if (!error_pending ())
01877     {
01878     /* We open in append mode because we don't want to clobber an
01879            existing Entries file.  If we are checking out a module
01880            which explicitly lists more than one file in a particular
01881            directory, then we will wind up calling
01882            server_write_entries for each such file.  */
01883     f = CVS_FOPEN (CVSADM_ENT, "a");
01884     if (f == NULL)
01885     {
01886         int save_errno = errno;
01887         if (alloc_pending (80 + strlen (CVSADM_ENT)))
01888         sprintf (pending_error_text, "E cannot open %s", CVSADM_ENT);
01889         pending_error = save_errno;
01890     }
01891     }
01892     for (p = entries; p != NULL;)
01893     {
01894     if (!error_pending ())
01895     {
01896         if (fprintf (f, "%s\n", p->entry) < 0)
01897         {
01898         int save_errno = errno;
01899         if (alloc_pending (80 + strlen(CVSADM_ENT)))
01900             sprintf (pending_error_text,
01901                  "E cannot write to %s", CVSADM_ENT);
01902         pending_error = save_errno;
01903         }
01904     }
01905     free (p->entry);
01906     q = p->next;
01907     free (p);
01908     p = q;
01909     }
01910     entries = NULL;
01911     if (f != NULL && fclose (f) == EOF && !error_pending ())
01912     {
01913     int save_errno = errno;
01914     if (alloc_pending (80 + strlen (CVSADM_ENT)))
01915         sprintf (pending_error_text, "E cannot close %s", CVSADM_ENT);
01916     pending_error = save_errno;
01917     }
01918 }
01919
01920 struct notify_note {
01921     /* Directory in which this notification happens.  malloc'd*/
01922     char *dir;
01923
01924     /* malloc'd.  */
01925     char *filename;
01926
01927     /* The following three all in one malloc'd block, pointed to by TYPE.
01928        Each '\0' terminated.  */
01929     /* "E" or "U".  */
01930     char *type;
01931     /* time+host+dir */
01932     char *val;
01933     char *watches;
01934
01935     struct notify_note *next;
01936 };
01937
01938 static struct notify_note *notify_list;
01939 /* Used while building list, to point to the last node that already exists.  */
01940 static struct notify_note *last_node;
01941
01942 static void serve_notify PROTO ((char *));
01943
01944 static void
01945 serve_notify (arg)
01946     char *arg;
01947 {
01948     struct notify_note *new = NULL;
01949     char *data = NULL;
01950     int status;
01951
01952     if (error_pending ()) return;
01953
01954     if (outside_dir (arg))
01955     return;
01956
01957     if (dir_name == NULL)
01958     goto error;
01959
01960     new = (struct notify_note *) malloc (sizeof (struct notify_note));
01961     if (new == NULL)
01962     {
01963     pending_error = ENOMEM;
01964     return;
01965     }
01966     new->dir = malloc (strlen (dir_name) + 1);
01967     new->filename = malloc (strlen (arg) + 1);
01968     if (new->dir == NULL || new->filename == NULL)
01969     {
01970     pending_error = ENOMEM;
01971     if (new->dir != NULL)
01972         free (new->dir);
01973     free (new);
01974     return;
01975     }
01976     strcpy (new->dir, dir_name);
01977     strcpy (new->filename, arg);
01978
01979     status = buf_read_line (buf_from_net, &data, (int *) NULL);
01980     if (status != 0)
01981     {
01982     if (status == -2)
01983         pending_error = ENOMEM;
01984     else
01985     {
01986         pending_error_text = malloc (80 + strlen (arg));
01987         if (pending_error_text == NULL)
01988         pending_error = ENOMEM;
01989         else
01990         {
01991         if (status == -1)
01992             sprintf (pending_error_text,
01993                  "E end of file reading notification for %s", arg);
01994         else
01995         {
01996             sprintf (pending_error_text,
01997                  "E error reading notification for %s", arg);
01998             pending_error = status;
01999         }
02000         }
02001     }
02002     free (new->filename);
02003     free (new->dir);
02004     free (new);
02005     }
02006     else
02007     {
02008     char *cp;
02009
02010     if (strchr (data, '+'))
02011         goto error;
02012
02013     new->type = data;
02014     if (data[1] != '\t')
02015         goto error;
02016     data[1] = '\0';
02017     cp = data + 2;
02018     new->val = cp;
02019     cp = strchr (cp, '\t');
02020     if (cp == NULL)
02021         goto error;
02022     *cp++ = '+';
02023     cp = strchr (cp, '\t');
02024     if (cp == NULL)
02025         goto error;
02026     *cp++ = '+';
02027     cp = strchr (cp, '\t');
02028     if (cp == NULL)
02029         goto error;
02030     *cp++ = '\0';
02031     new->watches = cp;
02032     /* If there is another tab, ignore everything after it,
02033        for future expansion.  */
02034     cp = strchr (cp, '\t');
02035     if (cp != NULL)
02036     {
02037         *cp = '\0';
02038     }
02039
02040     new->next = NULL;
02041
02042     if (last_node == NULL)
02043     {
02044         notify_list = new;
02045     }
02046     else
02047         last_node->next = new;
02048     last_node = new;
02049     }
02050     return;
02051   error:
02052     pending_error = 0;
02053     if (alloc_pending (80))
02054     strcpy (pending_error_text,
02055         "E Protocol error; misformed Notify request");
02056     if (data != NULL)
02057     free (data);
02058     if (new != NULL)
02059     {
02060     free (new->filename);
02061     free (new->dir);
02062     free (new);
02063     }
02064     return;
02065 }
02066
02067 /* Process all the Notify requests that we have stored up.  Returns 0
02068    if successful, if not prints error message (via error()) and
02069    returns negative value.  */
02070 static int
02071 server_notify ()
02072 {
02073     struct notify_note *p;
02074     char *repos;
02075
02076     while (notify_list != NULL)
02077     {
02078     if ( CVS_CHDIR (notify_list->dir) < 0)
02079     {
02080         error (0, errno, "cannot change to %s", notify_list->dir);
02081         return -1;
02082     }
02083     repos = Name_Repository (NULL, NULL);
02084
02085     lock_dir_for_write (repos);
02086
02087     fileattr_startdir (repos);
02088
02089     notify_do (*notify_list->type, notify_list->filename, getcaller(),
02090            notify_list->val, notify_list->watches, repos);
02091
02092     buf_output0 (buf_to_net, "Notified ");
02093     {
02094         char *dir = notify_list->dir + strlen (server_temp_dir) + 1;
02095         if (dir[0] == '\0')
02096             buf_append_char (buf_to_net, '.');
02097         else
02098             buf_output0 (buf_to_net, dir);
02099         buf_append_char (buf_to_net, '/');
02100         buf_append_char (buf_to_net, '\n');
02101     }
02102     buf_output0 (buf_to_net, repos);
02103     buf_append_char (buf_to_net, '/');
02104     buf_output0 (buf_to_net, notify_list->filename);
02105     buf_append_char (buf_to_net, '\n');
02106     free (repos);
02107
02108     p = notify_list->next;
02109     free (notify_list->filename);
02110     free (notify_list->dir);
02111     free (notify_list->type);
02112     free (notify_list);
02113     notify_list = p;
02114
02115     fileattr_write ();
02116     fileattr_free ();
02117
02118     Lock_Cleanup ();
02119     }
02120
02121     last_node = NULL;
02122
02123     /* The code used to call fflush (stdout) here, but that is no
02124        longer necessary.  The data is now buffered in buf_to_net,
02125        which will be flushed by the caller, do_cvs_command.  */
02126
02127     return 0;
02128 }
02129
02130 static int argument_count;
02131 static char **argument_vector;
02132 static int argument_vector_size;
02133
02134 static void
02135 serve_argument (arg)
02136      char *arg;
02137 {
02138     char *p;
02139
02140     if (error_pending()) return;
02141
02142     if (argument_vector_size <= argument_count)
02143     {
02144     argument_vector_size *= 2;
02145     argument_vector =
02146         (char **) realloc ((char *)argument_vector,
02147                    argument_vector_size * sizeof (char *));
02148     if (argument_vector == NULL)
02149     {
02150         pending_error = ENOMEM;
02151         return;
02152     }
02153     }
02154     p = malloc (strlen (arg) + 1);
02155     if (p == NULL)
02156     {
02157     pending_error = ENOMEM;
02158     return;
02159     }
02160     strcpy (p, arg);
02161     argument_vector[argument_count++] = p;
02162 }
02163
02164 static void
02165 serve_argumentx (arg)
02166      char *arg;
02167 {
02168     char *p;
02169
02170     if (error_pending()) return;
02171
02172     p = argument_vector[argument_count - 1];
02173     p = realloc (p, strlen (p) + 1 + strlen (arg) + 1);
02174     if (p == NULL)
02175     {
02176     pending_error = ENOMEM;
02177     return;
02178     }
02179     strcat (p, "\n");
02180     strcat (p, arg);
02181     argument_vector[argument_count - 1] = p;
02182 }
02183
02184 static void
02185 serve_global_option (arg)
02186     char *arg;
02187 {
02188     if (arg[0] != '-' || arg[1] == '\0' || arg[2] != '\0')
02189     {
02190     error_return:
02191     if (alloc_pending (strlen (arg) + 80))
02192         sprintf (pending_error_text,
02193              "E Protocol error: bad global option %s",
02194              arg);
02195     return;
02196     }
02197     switch (arg[1])
02198     {
02199     case 'n':
02200         noexec = 1;
02201         break;
02202     case 'q':
02203         quiet = 1;
02204         break;
02205     case 'r':
02206         cvswrite = 0;
02207         break;
02208     case 'Q':
02209         really_quiet = 1;
02210         break;
02211     case 'l':
02212         logoff = 1;
02213         break;
02214     case 't':
02215         trace = 1;
02216         break;
02217     default:
02218         goto error_return;
02219     }
02220 }
02221
02222 static void
02223 serve_set (arg)
02224     char *arg;
02225 {
02226     /* FIXME: This sends errors immediately (I think); they should be
02227        put into pending_error.  */
02228     variable_set (arg);
02229 }
02230
02231 #ifdef ENCRYPTION
02232
02233 #ifdef HAVE_KERBEROS
02234
02235 static void
02236 serve_kerberos_encrypt (arg)
02237      char *arg;
02238 {
02239     /* All future communication with the client will be encrypted.  */
02240
02241     buf_to_net = krb_encrypt_buffer_initialize (buf_to_net, 0, sched,
02242                         kblock,
02243                         buf_to_net->memory_error);
02244     buf_from_net = krb_encrypt_buffer_initialize (buf_from_net, 1, sched,
02245                           kblock,
02246                           buf_from_net->memory_error);
02247 }
02248
02249 #endif /* HAVE_KERBEROS */
02250
02251 #ifdef HAVE_GSSAPI
02252
02253 static void
02254 serve_gssapi_encrypt (arg)
02255      char *arg;
02256 {
02257     if (cvs_gssapi_wrapping)
02258     {
02259     /* We're already using a gssapi_wrap buffer for stream
02260            authentication.  Flush everything we've output so far, and
02261            turn on encryption for future data.  On the input side, we
02262            should only have unwrapped as far as the Gssapi-encrypt
02263            command, so future unwrapping will become encrypted.  */
02264     buf_flush (buf_to_net, 1);
02265     cvs_gssapi_encrypt = 1;
02266     return;
02267     }
02268
02269     /* All future communication with the client will be encrypted.  */
02270
02271     cvs_gssapi_encrypt = 1;
02272
02273     buf_to_net = cvs_gssapi_wrap_buffer_initialize (buf_to_net, 0,
02274                             gcontext,
02275                             buf_to_net->memory_error);
02276     buf_from_net = cvs_gssapi_wrap_buffer_initialize (buf_from_net, 1,
02277                               gcontext,
02278                               buf_from_net->memory_error);
02279
02280     cvs_gssapi_wrapping = 1;
02281 }
02282
02283 #endif /* HAVE_GSSAPI */
02284
02285 #endif /* ENCRYPTION */
02286
02287 #ifdef HAVE_GSSAPI
02288
02289 static void
02290 serve_gssapi_authenticate (arg)
02291      char *arg;
02292 {
02293     if (cvs_gssapi_wrapping)
02294     {
02295     /* We're already using a gssapi_wrap buffer for encryption.
02296            That includes authentication, so we don't have to do
02297            anything further.  */
02298     return;
02299     }
02300
02301     buf_to_net = cvs_gssapi_wrap_buffer_initialize (buf_to_net, 0,
02302                             gcontext,
02303                             buf_to_net->memory_error);
02304     buf_from_net = cvs_gssapi_wrap_buffer_initialize (buf_from_net, 1,
02305                               gcontext,
02306                               buf_from_net->memory_error);
02307
02308     cvs_gssapi_wrapping = 1;
02309 }
02310
02311 #endif /* HAVE_GSSAPI */
02312
02313 #ifdef SERVER_FLOWCONTROL
02314 /* The maximum we'll queue to the remote client before blocking.  */
02315 # ifndef SERVER_HI_WATER
02316 #  define SERVER_HI_WATER (2 * 1024 * 1024)
02317 # endif /* SERVER_HI_WATER */
02318 /* When the buffer drops to this, we restart the child */
02319 # ifndef SERVER_LO_WATER
02320 #  define SERVER_LO_WATER (1 * 1024 * 1024)
02321 # endif /* SERVER_LO_WATER */
02322
02323 static int set_nonblock_fd PROTO((int));
02324
02325 /*
02326  * Set buffer BUF to non-blocking I/O.  Returns 0 for success or errno
02327  * code.
02328  */
02329
02330 static int
02331 set_nonblock_fd (fd)
02332      int fd;
02333 {
02334     int flags;
02335
02336     flags = fcntl (fd, F_GETFL, 0);
02337     if (flags < 0)
02338     return errno;
02339     if (fcntl (fd, F_SETFL, flags | O_NONBLOCK) < 0)
02340     return errno;
02341     return 0;
02342 }
02343
02344 #endif /* SERVER_FLOWCONTROL */
02345
02346 static void serve_questionable PROTO((char *));
02347
02348 static void
02349 serve_questionable (arg)
02350     char *arg;
02351 {
02352     static int initted;
02353
02354     if (!initted)
02355     {
02356     /* Pick up ignores from CVSROOTADM_IGNORE, $HOME/.cvsignore on server,
02357        and CVSIGNORE on server.  */
02358     ign_setup ();
02359     initted = 1;
02360     }
02361
02362     if (dir_name == NULL)
02363     {
02364     buf_output0 (buf_to_net, "E Protocol error: 'Directory' missing");
02365     return;
02366     }
02367
02368     if (outside_dir (arg))
02369     return;
02370
02371     if (!ign_name (arg))
02372     {
02373     char *update_dir;
02374
02375     buf_output (buf_to_net, "M ? ", 4);
02376     update_dir = dir_name + strlen (server_temp_dir) + 1;
02377     if (!(update_dir[0] == '.' && update_dir[1] == '\0'))
02378     {
02379         buf_output0 (buf_to_net, update_dir);
02380         buf_output (buf_to_net, "/", 1);
02381     }
02382     buf_output0 (buf_to_net, arg);
02383     buf_output (buf_to_net, "\n", 1);
02384     }
02385 }
02386
02387 static void serve_case PROTO ((char *));
02388
02389 static void
02390 serve_case (arg)
02391     char *arg;
02392 {
02393     ign_case = 1;
02394 }
02395
02396 static struct buffer *protocol;
02397
02398 /* This is the output which we are saving up to send to the server, in the
02399    child process.  We will push it through, via the `protocol' buffer, when
02400    we have a complete line.  */
02401 static struct buffer *saved_output;
02402 /* Likewise, but stuff which will go to stderr.  */
02403 static struct buffer *saved_outerr;
02404
02405 static void
02406 protocol_memory_error (buf)
02407     struct buffer *buf;
02408 {
02409     error (1, ENOMEM, "Virtual memory exhausted");
02410 }
02411
02412 /*
02413  * Process IDs of the subprocess, or negative if that subprocess
02414  * does not exist.
02415  */
02416 static pid_t command_pid;
02417
02418 static void
02419 outbuf_memory_error (buf)
02420     struct buffer *buf;
02421 {
02422     static const char msg[] = "E Fatal server error\n\
02423 error ENOMEM Virtual memory exhausted.\n";
02424     if (command_pid > 0)
02425     kill (command_pid, SIGTERM);
02426
02427     /*
02428      * We have arranged things so that printing this now either will
02429      * be legal, or the "E fatal error" line will get glommed onto the
02430      * end of an existing "E" or "M" response.
02431      */
02432
02433     /* If this gives an error, not much we could do.  syslog() it?  */
02434     write (STDOUT_FILENO, msg, sizeof (msg) - 1);
02435     error_exit ();
02436 }
02437
02438 static void
02439 input_memory_error (buf)
02440      struct buffer *buf;
02441 {
02442     outbuf_memory_error (buf);
02443 }
02444
02445
02446
02447 /* If command is legal, return 1.
02448  * Else if command is illegal and croak_on_illegal is set, then die.
02449  * Else just return 0 to indicate that command is illegal.
02450  */
02451 static int
02452 check_command_legal_p (cmd_name)
02453     char *cmd_name;
02454 {
02455     /* Right now, only pserver notices illegal commands -- namely,
02456      * write attempts by a read-only user.  Therefore, if CVS_Username
02457      * is not set, this just returns 1, because CVS_Username unset
02458      * means pserver is not active.
02459      */
02460 #ifdef AUTH_SERVER_SUPPORT
02461     if (CVS_Username == NULL)
02462         return 1;
02463
02464     if (lookup_command_attribute (cmd_name) & CVS_CMD_MODIFIES_REPOSITORY)
02465     {
02466         /* This command has the potential to modify the repository, so
02467          * we check if the user have permission to do that.
02468          *
02469          * (Only relevant for remote users -- local users can do
02470          * whatever normal Unix file permissions allow them to do.)
02471          *
02472          * The decision method:
02473          *
02474          *    If $CVSROOT/CVSADMROOT_READERS exists and user is listed
02475          *    in it, then read-only access for user.
02476          *
02477          *    Or if $CVSROOT/CVSADMROOT_WRITERS exists and user NOT
02478          *    listed in it, then also read-only access for user.
02479          *
02480          *    Else read-write access for user.
02481          */
02482
02483          char *linebuf = NULL;
02484          int num_red = 0;
02485          size_t linebuf_len = 0;
02486          char *fname;
02487          size_t flen;
02488          FILE *fp;
02489          int found_it = 0;
02490
02491          /* else */
02492          flen = strlen (CVSroot_directory)
02493                 + strlen (CVSROOTADM)
02494                 + strlen (CVSROOTADM_READERS)
02495                 + 3;
02496
02497          fname = xmalloc (flen);
02498          (void) sprintf (fname, "%s/%s/%s", CVSroot_directory,
02499             CVSROOTADM, CVSROOTADM_READERS);
02500
02501          fp = fopen (fname, "r");
02502
02503          if (fp == NULL)
02504      {
02505          if (!existence_error (errno))
02506          {
02507          /* Need to deny access, so that attackers can't fool
02508             us with some sort of denial of service attack.  */
02509          error (0, errno, "cannot open %s", fname);
02510          free (fname);
02511          return 0;
02512          }
02513      }
02514          else  /* successfully opened readers file */
02515          {
02516              while ((num_red = getline (&linebuf, &linebuf_len, fp)) >= 0)
02517              {
02518                  /* Hmmm, is it worth importing my own readline
02519                     library into CVS?  It takes care of chopping
02520                     leading and trailing whitespace, "#" comments, and
02521                     newlines automatically when so requested.  Would
02522                     save some code here...  -kff */
02523
02524                  /* Chop newline by hand, for strcmp()'s sake. */
02525                  if (linebuf[num_red - 1] == '\n')
02526                      linebuf[num_red - 1] = '\0';
02527
02528                  if (strcmp (linebuf, CVS_Username) == 0)
02529                      goto handle_illegal;
02530              }
02531          if (num_red < 0 && !feof (fp))
02532          error (0, errno, "cannot read %s", fname);
02533
02534              /* If not listed specifically as a reader, then this user
02535                 has write access by default unless writers are also
02536                 specified in a file . */
02537          if (fclose (fp) < 0)
02538          error (0, errno, "cannot close %s", fname);
02539          }
02540      free (fname);
02541
02542      /* Now check the writers file.  */
02543
02544          flen = strlen (CVSroot_directory)
02545                 + strlen (CVSROOTADM)
02546                 + strlen (CVSROOTADM_WRITERS)
02547                 + 3;
02548
02549          fname = xmalloc (flen);
02550          (void) sprintf (fname, "%s/%s/%s", CVSroot_directory,
02551             CVSROOTADM, CVSROOTADM_WRITERS);
02552
02553          fp = fopen (fname, "r");
02554
02555          if (fp == NULL)
02556          {
02557          if (linebuf)
02558              free (linebuf);
02559          if (existence_error (errno))
02560          {
02561          /* Writers file does not exist, so everyone is a writer,
02562             by default.  */
02563          free (fname);
02564          return 1;
02565          }
02566          else
02567          {
02568          /* Need to deny access, so that attackers can't fool
02569             us with some sort of denial of service attack.  */
02570          error (0, errno, "cannot read %s", fname);
02571          free (fname);
02572          return 0;
02573          }
02574          }
02575
02576          found_it = 0;
02577          while ((num_red = getline (&linebuf, &linebuf_len, fp)) >= 0)
02578          {
02579              /* Chop newline by hand, for strcmp()'s sake. */
02580              if (linebuf[num_red - 1] == '\n')
02581                  linebuf[num_red - 1] = '\0';
02582
02583              if (strcmp (linebuf, CVS_Username) == 0)
02584              {
02585                  found_it = 1;
02586                  break;
02587              }
02588          }
02589      if (num_red < 0 && !feof (fp))
02590          error (0, errno, "cannot read %s", fname);
02591
02592          if (found_it)
02593          {
02594              if (fclose (fp) < 0)
02595          error (0, errno, "cannot close %s", fname);
02596              if (linebuf)
02597                  free (linebuf);
02598          free (fname);
02599              return 1;
02600          }
02601          else   /* writers file exists, but this user not listed in it */
02602          {
02603          handle_illegal:
02604              if (fclose (fp) < 0)
02605          error (0, errno, "cannot close %s", fname);
02606              if (linebuf)
02607                  free (linebuf);
02608          free (fname);
02609          return 0;
02610          }
02611     }
02612 #endif /* AUTH_SERVER_SUPPORT */
02613
02614     /* If ever reach end of this function, command must be legal. */
02615     return 1;
02616 }
02617
02618
02619
02620 /* Execute COMMAND in a subprocess with the approriate funky things done.  */
02621
02622 static struct fd_set_wrapper { fd_set fds; } command_fds_to_drain;
02623 static int max_command_fd;
02624
02625 #ifdef SERVER_FLOWCONTROL
02626 static int flowcontrol_pipe[2];
02627 #endif /* SERVER_FLOWCONTROL */
02628
02629 static void
02630 do_cvs_command (cmd_name, command)
02631     char *cmd_name;
02632     int (*command) PROTO((int argc, char **argv));
02633 {
02634     /*
02635      * The following file descriptors are set to -1 if that file is not
02636      * currently open.
02637      */
02638
02639     /* Data on these pipes is a series of '\n'-terminated lines.  */
02640     int stdout_pipe[2];
02641     int stderr_pipe[2];
02642
02643     /*
02644      * Data on this pipe is a series of counted (see buf_send_counted)
02645      * packets.  Each packet must be processed atomically (i.e. not
02646      * interleaved with data from stdout_pipe or stderr_pipe).
02647      */
02648     int protocol_pipe[2];
02649
02650     int dev_null_fd = -1;
02651
02652     int errs;
02653
02654     command_pid = -1;
02655     stdout_pipe[0] = -1;
02656     stdout_pipe[1] = -1;
02657     stderr_pipe[0] = -1;
02658     stderr_pipe[1] = -1;
02659     protocol_pipe[0] = -1;
02660     protocol_pipe[1] = -1;
02661
02662     server_write_entries ();
02663
02664     if (print_pending_error ())
02665     goto free_args_and_return;
02666
02667     /* Global `command_name' is probably "server" right now -- only
02668        serve_export() sets it to anything else.  So we will use local
02669        parameter `cmd_name' to determine if this command is legal for
02670        this user.  */
02671     if (!check_command_legal_p (cmd_name))
02672     {
02673     buf_output0 (buf_to_net, "E ");
02674     buf_output0 (buf_to_net, program_name);
02675     buf_output0 (buf_to_net, " [server aborted]: \"");
02676     buf_output0 (buf_to_net, cmd_name);
02677     buf_output0 (buf_to_net, "\" requires write access to the repository\n\
02678 error  \n");
02679     goto free_args_and_return;
02680     }
02681
02682     (void) server_notify ();
02683
02684     /*
02685      * We use a child process which actually does the operation.  This
02686      * is so we can intercept its standard output.  Even if all of CVS
02687      * were written to go to some special routine instead of writing
02688      * to stdout or stderr, we would still need to do the same thing
02689      * for the RCS commands.
02690      */
02691
02692     if (pipe (stdout_pipe) < 0)
02693     {
02694     buf_output0 (buf_to_net, "E pipe failed\n");
02695     print_error (errno);
02696     goto error_exit;
02697     }
02698     if (pipe (stderr_pipe) < 0)
02699     {
02700     buf_output0 (buf_to_net, "E pipe failed\n");
02701     print_error (errno);
02702     goto error_exit;
02703     }
02704     if (pipe (protocol_pipe) < 0)
02705     {
02706     buf_output0 (buf_to_net, "E pipe failed\n");
02707     print_error (errno);
02708     goto error_exit;
02709     }
02710 #ifdef SERVER_FLOWCONTROL
02711     if (pipe (flowcontrol_pipe) < 0)
02712     {
02713     buf_output0 (buf_to_net, "E pipe failed\n");
02714     print_error (errno);
02715     goto error_exit;
02716     }
02717     set_nonblock_fd (flowcontrol_pipe[0]);
02718     set_nonblock_fd (flowcontrol_pipe[1]);
02719 #endif /* SERVER_FLOWCONTROL */
02720
02721     dev_null_fd = CVS_OPEN (DEVNULL, O_RDONLY);
02722     if (dev_null_fd < 0)
02723     {
02724     buf_output0 (buf_to_net, "E open /dev/null failed\n");
02725     print_error (errno);
02726     goto error_exit;
02727     }
02728
02729     /* We shouldn't have any partial lines from cvs_output and
02730        cvs_outerr, but we handle them here in case there is a bug.  */
02731     /* FIXME: appending a newline, rather than using "MT" as we
02732        do in the child process, is probably not really a very good
02733        way to "handle" them.  */
02734     if (! buf_empty_p (saved_output))
02735     {
02736     buf_append_char (saved_output, '\n');
02737     buf_copy_lines (buf_to_net, saved_output, 'M');
02738     }
02739     if (! buf_empty_p (saved_outerr))
02740     {
02741     buf_append_char (saved_outerr, '\n');
02742     buf_copy_lines (buf_to_net, saved_outerr, 'E');
02743     }
02744
02745     /* Flush out any pending data.  */
02746     buf_flush (buf_to_net, 1);
02747
02748     /* Don't use vfork; we're not going to exec().  */
02749     command_pid = fork ();
02750     if (command_pid < 0)
02751     {
02752     buf_output0 (buf_to_net, "E fork failed\n");
02753     print_error (errno);
02754     goto error_exit;
02755     }
02756     if (command_pid == 0)
02757     {
02758     int exitstatus;
02759
02760     /* Since we're in the child, and the parent is going to take
02761        care of packaging up our error messages, we can clear this
02762        flag.  */
02763     error_use_protocol = 0;
02764
02765     protocol = fd_buffer_initialize (protocol_pipe[1], 0,
02766                      protocol_memory_error);
02767
02768     /* At this point we should no longer be using buf_to_net and
02769            buf_from_net.  Instead, everything should go through
02770            protocol.  */
02771     buf_to_net = NULL;
02772     buf_from_net = NULL;
02773
02774     /* These were originally set up to use outbuf_memory_error.
02775            Since we're now in the child, we should use the simpler
02776            protocol_memory_error function.  */
02777     saved_output->memory_error = protocol_memory_error;
02778     saved_outerr->memory_error = protocol_memory_error;
02779
02780     if (dup2 (dev_null_fd, STDIN_FILENO) < 0)
02781         error (1, errno, "can't set up pipes");
02782     if (dup2 (stdout_pipe[1], STDOUT_FILENO) < 0)
02783         error (1, errno, "can't set up pipes");
02784     if (dup2 (stderr_pipe[1], STDERR_FILENO) < 0)
02785         error (1, errno, "can't set up pipes");
02786     close (dev_null_fd);
02787     close (stdout_pipe[0]);
02788     close (stdout_pipe[1]);
02789     close (stderr_pipe[0]);
02790     close (stderr_pipe[1]);
02791     close (protocol_pipe[0]);
02792 #ifdef SERVER_FLOWCONTROL
02793     close (flowcontrol_pipe[1]);
02794 #endif /* SERVER_FLOWCONTROL */
02795
02796     /*
02797      * Set this in .bashrc if you want to give yourself time to attach
02798      * to the subprocess with a debugger.
02799      */
02800     if (getenv ("CVS_SERVER_SLEEP"))
02801     {
02802         int secs = atoi (getenv ("CVS_SERVER_SLEEP"));
02803         sleep (secs);
02804     }
02805
02806     exitstatus = (*command) (argument_count, argument_vector);
02807
02808     /* Output any partial lines.  If the client doesn't support
02809        "MT", we just throw out the partial line, like old versions
02810        of CVS did, since the protocol can't support this.  */
02811     if (supported_response ("MT") && ! buf_empty_p (saved_output))
02812     {
02813         buf_output0 (protocol, "MT text ");
02814         buf_append_buffer (protocol, saved_output);
02815         buf_output (protocol, "\n", 1);
02816         buf_send_counted (protocol);
02817     }
02818     /* For now we just discard partial lines on stderr.  I suspect
02819        that CVS can't write such lines unless there is a bug.  */
02820
02821     /*
02822      * When we exit, that will close the pipes, giving an EOF to
02823      * the parent.
02824      */
02825     buf_free (protocol);
02826     exit (exitstatus);
02827     }
02828
02829     /* OK, sit around getting all the input from the child.  */
02830     {
02831     struct buffer *stdoutbuf;
02832     struct buffer *stderrbuf;
02833     struct buffer *protocol_inbuf;
02834     /* Number of file descriptors to check in select ().  */
02835     int num_to_check;
02836     int count_needed = 0;
02837 #ifdef SERVER_FLOWCONTROL
02838     int have_flowcontrolled = 0;
02839 #endif /* SERVER_FLOWCONTROL */
02840
02841     FD_ZERO (&command_fds_to_drain.fds);
02842     num_to_check = stdout_pipe[0];
02843     FD_SET (stdout_pipe[0], &command_fds_to_drain.fds);
02844     if (stderr_pipe[0] > num_to_check)
02845       num_to_check = stderr_pipe[0];
02846     FD_SET (stderr_pipe[0], &command_fds_to_drain.fds);
02847     if (protocol_pipe[0] > num_to_check)
02848       num_to_check = protocol_pipe[0];
02849     FD_SET (protocol_pipe[0], &command_fds_to_drain.fds);
02850     if (STDOUT_FILENO > num_to_check)
02851       num_to_check = STDOUT_FILENO;
02852     max_command_fd = num_to_check;
02853     /*
02854      * File descriptors are numbered from 0, so num_to_check needs to
02855      * be one larger than the largest descriptor.
02856      */
02857     ++num_to_check;
02858     if (num_to_check > FD_SETSIZE)
02859     {
02860         buf_output0 (buf_to_net,
02861              "E internal error: FD_SETSIZE not big enough.\n\
02862 error  \n");
02863         goto error_exit;
02864     }
02865
02866     stdoutbuf = fd_buffer_initialize (stdout_pipe[0], 1,
02867                       input_memory_error);
02868
02869     stderrbuf = fd_buffer_initialize (stderr_pipe[0], 1,
02870                       input_memory_error);
02871
02872     protocol_inbuf = fd_buffer_initialize (protocol_pipe[0], 1,
02873                            input_memory_error);
02874
02875     set_nonblock (buf_to_net);
02876     set_nonblock (stdoutbuf);
02877     set_nonblock (stderrbuf);
02878     set_nonblock (protocol_inbuf);
02879
02880     if (close (stdout_pipe[1]) < 0)
02881     {
02882         buf_output0 (buf_to_net, "E close failed\n");
02883         print_error (errno);
02884         goto error_exit;
02885     }
02886     stdout_pipe[1] = -1;
02887
02888     if (close (stderr_pipe[1]) < 0)
02889     {
02890         buf_output0 (buf_to_net, "E close failed\n");
02891         print_error (errno);
02892         goto error_exit;
02893     }
02894     stderr_pipe[1] = -1;
02895
02896     if (close (protocol_pipe[1]) < 0)
02897     {
02898         buf_output0 (buf_to_net, "E close failed\n");
02899         print_error (errno);
02900         goto error_exit;
02901     }
02902     protocol_pipe[1] = -1;
02903
02904 #ifdef SERVER_FLOWCONTROL
02905     if (close (flowcontrol_pipe[0]) < 0)
02906     {
02907         buf_output0 (buf_to_net, "E close failed\n");
02908         print_error (errno);
02909         goto error_exit;
02910     }
02911     flowcontrol_pipe[0] = -1;
02912 #endif /* SERVER_FLOWCONTROL */
02913
02914     if (close (dev_null_fd) < 0)
02915     {
02916         buf_output0 (buf_to_net, "E close failed\n");
02917         print_error (errno);
02918         goto error_exit;
02919     }
02920     dev_null_fd = -1;
02921
02922     while (stdout_pipe[0] >= 0
02923            || stderr_pipe[0] >= 0
02924            || protocol_pipe[0] >= 0)
02925     {
02926         fd_set readfds;
02927         fd_set writefds;
02928         int numfds;
02929 #ifdef SERVER_FLOWCONTROL
02930         int bufmemsize;
02931
02932         /*
02933          * See if we are swamping the remote client and filling our VM.
02934          * Tell child to hold off if we do.
02935          */
02936         bufmemsize = buf_count_mem (buf_to_net);
02937         if (!have_flowcontrolled && (bufmemsize > SERVER_HI_WATER))
02938         {
02939         if (write(flowcontrol_pipe[1], "S", 1) == 1)
02940             have_flowcontrolled = 1;
02941         }
02942         else if (have_flowcontrolled && (bufmemsize < SERVER_LO_WATER))
02943         {
02944         if (write(flowcontrol_pipe[1], "G", 1) == 1)
02945             have_flowcontrolled = 0;
02946         }
02947 #endif /* SERVER_FLOWCONTROL */
02948
02949         FD_ZERO (&readfds);
02950         FD_ZERO (&writefds);
02951         if (! buf_empty_p (buf_to_net))
02952             FD_SET (STDOUT_FILENO, &writefds);
02953
02954         if (stdout_pipe[0] >= 0)
02955         {
02956         FD_SET (stdout_pipe[0], &readfds);
02957         }
02958         if (stderr_pipe[0] >= 0)
02959         {
02960         FD_SET (stderr_pipe[0], &readfds);
02961         }
02962         if (protocol_pipe[0] >= 0)
02963         {
02964         FD_SET (protocol_pipe[0], &readfds);
02965         }
02966
02967         /* This process of selecting on the three pipes means that
02968            we might not get output in the same order in which it
02969            was written, thus producing the well-known
02970            "out-of-order" bug.  If the child process uses
02971            cvs_output and cvs_outerr, it will send everything on
02972            the protocol_pipe and avoid this problem, so the
02973            solution is to use cvs_output and cvs_outerr in the
02974            child process.  */
02975         do {
02976         /* This used to select on exceptions too, but as far
02977                    as I know there was never any reason to do that and
02978                    SCO doesn't let you select on exceptions on pipes.  */
02979         numfds = select (num_to_check, &readfds, &writefds,
02980                  (fd_set *)0, (struct timeval *)NULL);
02981         if (numfds < 0
02982             && errno != EINTR)
02983         {
02984             buf_output0 (buf_to_net, "E select failed\n");
02985             print_error (errno);
02986             goto error_exit;
02987         }
02988         } while (numfds < 0);
02989
02990         if (FD_ISSET (STDOUT_FILENO, &writefds))
02991         {
02992         /* What should we do with errors?  syslog() them?  */
02993         buf_send_output (buf_to_net);
02994         }
02995
02996         if (protocol_pipe[0] >= 0
02997         && (FD_ISSET (protocol_pipe[0], &readfds)))
02998         {
02999         int status;
03000         int count_read;
03001         int special;
03002
03003         status = buf_input_data (protocol_inbuf, &count_read);
03004
03005         if (status == -1)
03006         {
03007             close (protocol_pipe[0]);
03008             protocol_pipe[0] = -1;
03009         }
03010         else if (status > 0)
03011         {
03012             buf_output0 (buf_to_net, "E buf_input_data failed\n");
03013             print_error (status);
03014             goto error_exit;
03015         }
03016
03017         /*
03018          * We only call buf_copy_counted if we have read
03019          * enough bytes to make it worthwhile.  This saves us
03020          * from continually recounting the amount of data we
03021          * have.
03022          */
03023         count_needed -= count_read;
03024         while (count_needed <= 0)
03025         {
03026             count_needed = buf_copy_counted (buf_to_net,
03027                              protocol_inbuf,
03028                              &special);
03029
03030             /* What should we do with errors?  syslog() them?  */
03031             buf_send_output (buf_to_net);
03032
03033             /* If SPECIAL got set to -1, it means that the child
03034                wants us to flush the pipe.  We don't want to block
03035                on the network, but we flush what we can.  If the
03036                client supports the 'F' command, we send it.  */
03037             if (special == -1)
03038             {
03039             if (supported_response ("F"))
03040             {
03041                 buf_append_char (buf_to_net, 'F');
03042                 buf_append_char (buf_to_net, '\n');
03043             }
03044
03045             cvs_flusherr ();
03046             }
03047         }
03048         }
03049
03050         if (stdout_pipe[0] >= 0
03051         && (FD_ISSET (stdout_pipe[0], &readfds)))
03052         {
03053             int status;
03054
03055             status = buf_input_data (stdoutbuf, (int *) NULL);
03056
03057         buf_copy_lines (buf_to_net, stdoutbuf, 'M');
03058
03059         if (status == -1)
03060         {
03061             close (stdout_pipe[0]);
03062             stdout_pipe[0] = -1;
03063         }
03064         else if (status > 0)
03065         {
03066             buf_output0 (buf_to_net, "E buf_input_data failed\n");
03067             print_error (status);
03068             goto error_exit;
03069         }
03070
03071         /* What should we do with errors?  syslog() them?  */
03072         buf_send_output (buf_to_net);
03073         }
03074
03075         if (stderr_pipe[0] >= 0
03076         && (FD_ISSET (stderr_pipe[0], &readfds)))
03077         {
03078             int status;
03079
03080             status = buf_input_data (stderrbuf, (int *) NULL);
03081
03082         buf_copy_lines (buf_to_net, stderrbuf, 'E');
03083
03084         if (status == -1)
03085         {
03086             close (stderr_pipe[0]);
03087             stderr_pipe[0] = -1;
03088         }
03089         else if (status > 0)
03090         {
03091             buf_output0 (buf_to_net, "E buf_input_data failed\n");
03092             print_error (status);
03093             goto error_exit;
03094         }
03095
03096         /* What should we do with errors?  syslog() them?  */
03097         buf_send_output (buf_to_net);
03098         }
03099     }
03100
03101     /*
03102      * OK, we've gotten EOF on all the pipes.  If there is
03103      * anything left on stdoutbuf or stderrbuf (this could only
03104      * happen if there was no trailing newline), send it over.
03105      */
03106     if (! buf_empty_p (stdoutbuf))
03107     {
03108         buf_append_char (stdoutbuf, '\n');
03109         buf_copy_lines (buf_to_net, stdoutbuf, 'M');
03110     }
03111     if (! buf_empty_p (stderrbuf))
03112     {
03113         buf_append_char (stderrbuf, '\n');
03114         buf_copy_lines (buf_to_net, stderrbuf, 'E');
03115     }
03116     if (! buf_empty_p (protocol_inbuf))
03117         buf_output0 (buf_to_net,
03118              "E Protocol error: uncounted data discarded\n");
03119
03120 #ifdef SERVER_FLOWCONTROL
03121     close (flowcontrol_pipe[1]);
03122     flowcontrol_pipe[1] = -1;
03123 #endif /* SERVER_FLOWCONTROL */
03124
03125     errs = 0;
03126
03127     while (command_pid > 0)
03128     {
03129         int status;
03130         pid_t waited_pid;
03131         waited_pid = waitpid (command_pid, &status, 0);
03132         if (waited_pid < 0)
03133         {
03134         /*
03135          * Intentionally ignoring EINTR.  Other errors
03136          * "can't happen".
03137          */
03138         continue;
03139         }
03140
03141         if (WIFEXITED (status))
03142         errs += WEXITSTATUS (status);
03143         else
03144         {
03145             int sig = WTERMSIG (status);
03146             char buf[50];
03147         /*
03148          * This is really evil, because signals might be numbered
03149          * differently on the two systems.  We should be using
03150          * signal names (either of the "Terminated" or the "SIGTERM"
03151          * variety).  But cvs doesn't currently use libiberty...we
03152          * could roll our own....  FIXME.
03153          */
03154         buf_output0 (buf_to_net, "E Terminated with fatal signal ");
03155         sprintf (buf, "%d\n", sig);
03156         buf_output0 (buf_to_net, buf);
03157
03158         /* Test for a core dump.  Is this portable?  */
03159         if (status & 0x80)
03160         {
03161             buf_output0 (buf_to_net, "E Core dumped; preserving ");
03162             buf_output0 (buf_to_net, orig_server_temp_dir);
03163             buf_output0 (buf_to_net, " on server.\n\
03164 E CVS locks may need cleaning up.\n");
03165             dont_delete_temp = 1;
03166         }
03167         ++errs;
03168         }
03169         if (waited_pid == command_pid)
03170         command_pid = -1;
03171     }
03172
03173     /*
03174      * OK, we've waited for the child.  By now all CVS locks are free
03175      * and it's OK to block on the network.
03176      */
03177     set_block (buf_to_net);
03178     buf_flush (buf_to_net, 1);
03179     buf_shutdown (protocol_inbuf);
03180     buf_free (protocol_inbuf);
03181     buf_shutdown (stderrbuf);
03182     buf_free (stderrbuf);
03183     buf_shutdown (stdoutbuf);
03184     buf_free (stdoutbuf);
03185     }
03186
03187     if (errs)
03188     /* We will have printed an error message already.  */
03189     buf_output0 (buf_to_net, "error  \n");
03190     else
03191     buf_output0 (buf_to_net, "ok\n");
03192     goto free_args_and_return;
03193
03194  error_exit:
03195     if (command_pid > 0)
03196     kill (command_pid, SIGTERM);
03197
03198     while (command_pid > 0)
03199     {
03200     pid_t waited_pid;
03201     waited_pid = waitpid (command_pid, (int *) 0, 0);
03202     if (waited_pid < 0 && errno == EINTR)
03203         continue;
03204     if (waited_pid == command_pid)
03205         command_pid = -1;
03206     }
03207
03208     close (dev_null_fd);
03209     close (protocol_pipe[0]);
03210     close (protocol_pipe[1]);
03211     close (stderr_pipe[0]);
03212     close (stderr_pipe[1]);
03213     close (stdout_pipe[0]);
03214     close (stdout_pipe[1]);
03215 #ifdef SERVER_FLOWCONTROL
03216     close (flowcontrol_pipe[0]);
03217     close (flowcontrol_pipe[1]);
03218 #endif /* SERVER_FLOWCONTROL */
03219
03220  free_args_and_return:
03221     /* Now free the arguments.  */
03222     {
03223     /* argument_vector[0] is a dummy argument, we don't mess with it.  */
03224     char **cp;
03225     for (cp = argument_vector + 1;
03226          cp < argument_vector + argument_count;
03227          ++cp)
03228         free (*cp);
03229
03230     argument_count = 1;
03231     }
03232
03233     /* Flush out any data not yet sent.  */
03234     set_block (buf_to_net);
03235     buf_flush (buf_to_net, 1);
03236
03237     return;
03238 }
03239
03240 #ifdef SERVER_FLOWCONTROL
03241 /*
03242  * Called by the child at convenient points in the server's execution for
03243  * the server child to block.. ie: when it has no locks active.
03244  */
03245 void
03246 server_pause_check()
03247 {
03248     int paused = 0;
03249     char buf[1];
03250
03251     while (read (flowcontrol_pipe[0], buf, 1) == 1)
03252     {
03253     if (*buf == 'S')    /* Stop */
03254         paused = 1;
03255     else if (*buf == 'G')   /* Go */
03256         paused = 0;
03257     else
03258         return;     /* ??? */
03259     }
03260     while (paused) {
03261     int numfds, numtocheck;
03262     fd_set fds;
03263
03264     FD_ZERO (&fds);
03265     FD_SET (flowcontrol_pipe[0], &fds);
03266     numtocheck = flowcontrol_pipe[0] + 1;
03267
03268     do {
03269         numfds = select (numtocheck, &fds, (fd_set *)0,
03270                  (fd_set *)0, (struct timeval *)NULL);
03271         if (numfds < 0
03272         && errno != EINTR)
03273         {
03274         buf_output0 (buf_to_net, "E select failed\n");
03275         print_error (errno);
03276         return;
03277         }
03278     } while (numfds < 0);
03279
03280     if (FD_ISSET (flowcontrol_pipe[0], &fds))
03281     {
03282         int got;
03283
03284         while ((got = read (flowcontrol_pipe[0], buf, 1)) == 1)
03285         {
03286         if (*buf == 'S')    /* Stop */
03287             paused = 1;
03288         else if (*buf == 'G')   /* Go */
03289             paused = 0;
03290         else
03291             return;     /* ??? */
03292         }
03293
03294         /* This assumes that we are using BSD or POSIX nonblocking
03295                I/O.  System V nonblocking I/O returns zero if there is
03296                nothing to read.  */
03297         if (got == 0)
03298             error (1, 0, "flow control EOF");
03299         if (got < 0 && ! blocking_error (errno))
03300         {
03301             error (1, errno, "flow control read failed");
03302         }
03303     }
03304     }
03305 }
03306 #endif /* SERVER_FLOWCONTROL */
03307
03308 /* This variable commented in server.h.  */
03309 char *server_dir = NULL;
03310
03311 static void output_dir PROTO((char *, char *));
03312
03313 static void
03314 output_dir (update_dir, repository)
03315     char *update_dir;
03316     char *repository;
03317 {
03318     if (server_dir != NULL)
03319     {
03320     buf_output0 (protocol, server_dir);
03321     buf_output0 (protocol, "/");
03322     }
03323     if (update_dir[0] == '\0')
03324     buf_output0 (protocol, ".");
03325     else
03326     buf_output0 (protocol, update_dir);
03327     buf_output0 (protocol, "/\n");
03328     buf_output0 (protocol, repository);
03329     buf_output0 (protocol, "/");
03330 }
03331
03332 /*
03333  * Entries line that we are squirreling away to send to the client when
03334  * we are ready.
03335  */
03336 static char *entries_line;
03337
03338 /*
03339  * File which has been Scratch_File'd, we are squirreling away that fact
03340  * to inform the client when we are ready.
03341  */
03342 static char *scratched_file;
03343
03344 /*
03345  * The scratched_file will need to be removed as well as having its entry
03346  * removed.
03347  */
03348 static int kill_scratched_file;
03349
03350 void
03351 server_register (name, version, timestamp, options, tag, date, conflict)
03352     char *name;
03353     char *version;
03354     char *timestamp;
03355     char *options;
03356     char *tag;
03357     char *date;
03358     char *conflict;
03359 {
03360     int len;
03361
03362     if (options == NULL)
03363     options = "";
03364
03365     if (trace)
03366     {
03367     (void) fprintf (stderr,
03368             "%s-> server_register(%s, %s, %s, %s, %s, %s, %s)\n",
03369             CLIENT_SERVER_STR,
03370             name, version, timestamp ? timestamp : "", options,
03371             tag ? tag : "", date ? date : "",
03372             conflict ? conflict : "");
03373     }
03374
03375     if (entries_line != NULL)
03376     {
03377     /*
03378      * If CVS decides to Register it more than once (which happens
03379      * on "cvs update foo/foo.c" where foo and foo.c are already
03380      * checked out), use the last of the entries lines Register'd.
03381      */
03382     free (entries_line);
03383     }
03384
03385     /*
03386      * I have reports of Scratch_Entry and Register both happening, in
03387      * two different cases.  Using the last one which happens is almost
03388      * surely correct; I haven't tracked down why they both happen (or
03389      * even verified that they are for the same file).
03390      */
03391     if (scratched_file != NULL)
03392     {
03393     free (scratched_file);
03394     scratched_file = NULL;
03395     }
03396
03397     len = (strlen (name) + strlen (version) + strlen (options) + 80);
03398     if (tag)
03399     len += strlen (tag);
03400     if (date)
03401     len += strlen (date);
03402
03403     entries_line = xmalloc (len);
03404     sprintf (entries_line, "/%s/%s/", name, version);
03405     if (conflict != NULL)
03406     {
03407     strcat (entries_line, "+=");
03408     }
03409     strcat (entries_line, "/");
03410     strcat (entries_line, options);
03411     strcat (entries_line, "/");
03412     if (tag != NULL)
03413     {
03414     strcat (entries_line, "T");
03415     strcat (entries_line, tag);
03416     }
03417     else if (date != NULL)
03418     {
03419     strcat (entries_line, "D");
03420     strcat (entries_line, date);
03421     }
03422 }
03423
03424 void
03425 server_scratch (fname)
03426     char *fname;
03427 {
03428     /*
03429      * I have reports of Scratch_Entry and Register both happening, in
03430      * two different cases.  Using the last one which happens is almost
03431      * surely correct; I haven't tracked down why they both happen (or
03432      * even verified that they are for the same file).
03433      */
03434     if (entries_line != NULL)
03435     {
03436     free (entries_line);
03437     entries_line = NULL;
03438     }
03439
03440     if (scratched_file != NULL)
03441     {
03442     buf_output0 (protocol,
03443              "E CVS server internal error: duplicate Scratch_Entry\n");
03444     buf_send_counted (protocol);
03445     return;
03446     }
03447     scratched_file = xstrdup (fname);
03448     kill_scratched_file = 1;
03449 }
03450
03451 void
03452 server_scratch_entry_only ()
03453 {
03454     kill_scratched_file = 0;
03455 }
03456
03457 /* Print a new entries line, from a previous server_register.  */
03458 static void
03459 new_entries_line ()
03460 {
03461     if (entries_line)
03462     {
03463     buf_output0 (protocol, entries_line);
03464     buf_output (protocol, "\n", 1);
03465     }
03466     else
03467     /* Return the error message as the Entries line.  */
03468     buf_output0 (protocol,
03469              "CVS server internal error: Register missing\n");
03470     free (entries_line);
03471     entries_line = NULL;
03472 }
03473
03474
03475 static void
03476 serve_ci (arg)
03477     char *arg;
03478 {
03479     do_cvs_command ("commit", commit);
03480 }
03481
03482 static void
03483 checked_in_response (file, update_dir, repository)
03484     char *file;
03485     char *update_dir;
03486     char *repository;
03487 {
03488     if (supported_response ("Mode"))
03489     {
03490     struct stat sb;
03491     char *mode_string;
03492
03493     if ( CVS_STAT (file, &sb) < 0)
03494     {
03495         /* Not clear to me why the file would fail to exist, but it
03496            was happening somewhere in the testsuite.  */
03497         if (!existence_error (errno))
03498         error (0, errno, "cannot stat %s", file);
03499     }
03500     else
03501     {
03502         buf_output0 (protocol, "Mode ");
03503         mode_string = mode_to_string (sb.st_mode);
03504         buf_output0 (protocol, mode_string);
03505         buf_output0 (protocol, "\n");
03506         free (mode_string);
03507     }
03508     }
03509
03510     buf_output0 (protocol, "Checked-in ");
03511     output_dir (update_dir, repository);
03512     buf_output0 (protocol, file);
03513     buf_output (protocol, "\n", 1);
03514     new_entries_line ();
03515 }
03516
03517 void
03518 server_checked_in (file, update_dir, repository)
03519     char *file;
03520     char *update_dir;
03521     char *repository;
03522 {
03523     if (noexec)
03524     return;
03525     if (scratched_file != NULL && entries_line == NULL)
03526     {
03527     /*
03528      * This happens if we are now doing a "cvs remove" after a previous
03529      * "cvs add" (without a "cvs ci" in between).
03530      */
03531     buf_output0 (protocol, "Remove-entry ");
03532     output_dir (update_dir, repository);
03533     buf_output0 (protocol, file);
03534     buf_output (protocol, "\n", 1);
03535     free (scratched_file);
03536     scratched_file = NULL;
03537     }
03538     else
03539     {
03540     checked_in_response (file, update_dir, repository);
03541     }
03542     buf_send_counted (protocol);
03543 }
03544
03545 void
03546 server_update_entries (file, update_dir, repository, updated)
03547     char *file;
03548     char *update_dir;
03549     char *repository;
03550     enum server_updated_arg4 updated;
03551 {
03552     if (noexec)
03553     return;
03554     if (updated == SERVER_UPDATED)
03555     checked_in_response (file, update_dir, repository);
03556     else
03557     {
03558     if (!supported_response ("New-entry"))
03559         return;
03560     buf_output0 (protocol, "New-entry ");
03561     output_dir (update_dir, repository);
03562     buf_output0 (protocol, file);
03563     buf_output (protocol, "\n", 1);
03564     new_entries_line ();
03565     }
03566
03567     buf_send_counted (protocol);
03568 }
03569
03570 static void
03571 serve_update (arg)
03572     char *arg;
03573 {
03574     do_cvs_command ("update", update);
03575 }
03576
03577 static void
03578 serve_diff (arg)
03579     char *arg;
03580 {
03581     do_cvs_command ("diff", diff);
03582 }
03583
03584 static void
03585 serve_log (arg)
03586     char *arg;
03587 {
03588     do_cvs_command ("log", cvslog);
03589 }
03590
03591 static void
03592 serve_add (arg)
03593     char *arg;
03594 {
03595     do_cvs_command ("add", add);
03596 }
03597
03598 static void
03599 serve_remove (arg)
03600     char *arg;
03601 {
03602     do_cvs_command ("remove", cvsremove);
03603 }
03604
03605 static void
03606 serve_status (arg)
03607     char *arg;
03608 {
03609     do_cvs_command ("status", cvsstatus);
03610 }
03611
03612 static void
03613 serve_rdiff (arg)
03614     char *arg;
03615 {
03616     do_cvs_command ("rdiff", patch);
03617 }
03618
03619 static void
03620 serve_tag (arg)
03621     char *arg;
03622 {
03623     do_cvs_command ("cvstag", cvstag);
03624 }
03625
03626 static void
03627 serve_rtag (arg)
03628     char *arg;
03629 {
03630     do_cvs_command ("rtag", rtag);
03631 }
03632
03633 static void
03634 serve_import (arg)
03635     char *arg;
03636 {
03637     do_cvs_command ("import", import);
03638 }
03639
03640 static void
03641 serve_admin (arg)
03642     char *arg;
03643 {
03644     do_cvs_command ("admin", admin);
03645 }
03646
03647 static void
03648 serve_history (arg)
03649     char *arg;
03650 {
03651     do_cvs_command ("history", history);
03652 }
03653
03654 static void
03655 serve_release (arg)
03656     char *arg;
03657 {
03658     do_cvs_command ("release", release);
03659 }
03660
03661 static void serve_watch_on PROTO ((char *));
03662
03663 static void
03664 serve_watch_on (arg)
03665     char *arg;
03666 {
03667     do_cvs_command ("watch_on", watch_on);
03668 }
03669
03670 static void serve_watch_off PROTO ((char *));
03671
03672 static void
03673 serve_watch_off (arg)
03674     char *arg;
03675 {
03676     do_cvs_command ("watch_off", watch_off);
03677 }
03678
03679 static void serve_watch_add PROTO ((char *));
03680
03681 static void
03682 serve_watch_add (arg)
03683     char *arg;
03684 {
03685     do_cvs_command ("watch_add", watch_add);
03686 }
03687
03688 static void serve_watch_remove PROTO ((char *));
03689
03690 static void
03691 serve_watch_remove (arg)
03692     char *arg;
03693 {
03694     do_cvs_command ("watch_remove", watch_remove);
03695 }
03696
03697 static void serve_watchers PROTO ((char *));
03698
03699 static void
03700 serve_watchers (arg)
03701     char *arg;
03702 {
03703     do_cvs_command ("watchers", watchers);
03704 }
03705
03706 static void serve_editors PROTO ((char *));
03707
03708 static void
03709 serve_editors (arg)
03710     char *arg;
03711 {
03712     do_cvs_command ("editors", editors);
03713 }
03714
03715 static void serve_noop PROTO ((char *));
03716
03717 static void
03718 serve_noop (arg)
03719     char *arg;
03720 {
03721
03722     server_write_entries ();
03723     if (!print_pending_error ())
03724     {
03725     (void) server_notify ();
03726     buf_output0 (buf_to_net, "ok\n");
03727     }
03728     buf_flush (buf_to_net, 1);
03729 }
03730
03731 static void serve_version PROTO ((char *));
03732
03733 static void
03734 serve_version (arg)
03735     char *arg;
03736 {
03737     do_cvs_command ("version", version);
03738 }
03739
03740 static void serve_init PROTO ((char *));
03741
03742 static void
03743 serve_init (arg)
03744     char *arg;
03745 {
03746     if (!isabsolute (arg))
03747     {
03748     if (alloc_pending (80 + strlen (arg)))
03749         sprintf (pending_error_text,
03750              "E Root %s must be an absolute pathname", arg);
03751     /* Fall through to do_cvs_command which will return the
03752        actual error.  */
03753     }
03754     set_local_cvsroot (arg);
03755
03756     do_cvs_command ("init", init);
03757 }
03758
03759 static void serve_annotate PROTO ((char *));
03760
03761 static void
03762 serve_annotate (arg)
03763     char *arg;
03764 {
03765     do_cvs_command ("annotate", annotate);
03766 }
03767
03768 static void
03769 serve_co (arg)
03770     char *arg;
03771 {
03772     char *tempdir;
03773     int status;
03774
03775     if (print_pending_error ())
03776     return;
03777
03778     if (!isdir (CVSADM))
03779     {
03780     /*
03781      * The client has not sent a "Repository" line.  Check out
03782      * into a pristine directory.
03783      */
03784     tempdir = malloc (strlen (server_temp_dir) + 80);
03785     if (tempdir == NULL)
03786     {
03787         buf_output0 (buf_to_net, "E Out of memory\n");
03788         return;
03789     }
03790     strcpy (tempdir, server_temp_dir);
03791     strcat (tempdir, "/checkout-dir");
03792     status = mkdir_p (tempdir);
03793     if (status != 0 && status != EEXIST)
03794     {
03795         buf_output0 (buf_to_net, "E Cannot create ");
03796         buf_output0 (buf_to_net, tempdir);
03797         buf_append_char (buf_to_net, '\n');
03798         print_error (errno);
03799         free (tempdir);
03800         return;
03801     }
03802
03803     if ( CVS_CHDIR (tempdir) < 0)
03804     {
03805         buf_output0 (buf_to_net, "E Cannot change to directory ");
03806         buf_output0 (buf_to_net, tempdir);
03807         buf_append_char (buf_to_net, '\n');
03808         print_error (errno);
03809         free (tempdir);
03810         return;
03811     }
03812     free (tempdir);
03813     }
03814
03815     /* Compensate for server_export()'s setting of command_name.
03816      *
03817      * [It probably doesn't matter if do_cvs_command() gets "export"
03818      *  or "checkout", but we ought to be accurate where possible.]
03819      */
03820     do_cvs_command ((strcmp (command_name, "export") == 0) ?
03821                     "export" : "checkout",
03822                     checkout);
03823 }
03824
03825 static void
03826 serve_export (arg)
03827     char *arg;
03828 {
03829     /* Tell checkout() to behave like export not checkout.  */
03830     command_name = "export";
03831     serve_co (arg);
03832 }
03833
03834 void
03835 server_copy_file (file, update_dir, repository, newfile)
03836     char *file;
03837     char *update_dir;
03838     char *repository;
03839     char *newfile;
03840 {
03841     /* At least for now, our practice is to have the server enforce
03842        noexec for the repository and the client enforce it for the
03843        working directory.  This might want more thought, and/or
03844        documentation in cvsclient.texi (other responses do it
03845        differently).  */
03846
03847     if (!supported_response ("Copy-file"))
03848     return;
03849     buf_output0 (protocol, "Copy-file ");
03850     output_dir (update_dir, repository);
03851     buf_output0 (protocol, file);
03852     buf_output0 (protocol, "\n");
03853     buf_output0 (protocol, newfile);
03854     buf_output0 (protocol, "\n");
03855 }
03856
03857 /* See server.h for description.  */
03858
03859 void
03860 server_modtime (finfo, vers_ts)
03861     struct file_info *finfo;
03862     Vers_TS *vers_ts;
03863 {
03864     char date[MAXDATELEN];
03865     char outdate[MAXDATELEN];
03866
03867     assert (vers_ts->vn_rcs != NULL);
03868
03869     if (!supported_response ("Mod-time"))
03870     return;
03871
03872     if (RCS_getrevtime (finfo->rcs, vers_ts->vn_rcs, date, 0) == (time_t) -1)
03873     /* FIXME? should we be printing some kind of warning?  For one
03874        thing I'm not 100% sure whether this happens in non-error
03875        circumstances.  */
03876     return;
03877     date_to_internet (outdate, date);
03878     buf_output0 (protocol, "Mod-time ");
03879     buf_output0 (protocol, outdate);
03880     buf_output0 (protocol, "\n");
03881 }
03882
03883 /* See server.h for description.  */
03884
03885 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
03886 /* Need to prototype because mode_t might be smaller than int.  */
03887 void
03888 server_updated (
03889     struct file_info *finfo,
03890     Vers_TS *vers,
03891     enum server_updated_arg4 updated,
03892     mode_t mode,
03893     unsigned char *checksum,
03894     struct buffer *filebuf)
03895 #else
03896 void
03897 server_updated (finfo, vers, updated, mode, checksum, filebuf)
03898     struct file_info *finfo;
03899     Vers_TS *vers;
03900     enum server_updated_arg4 updated;
03901     mode_t mode;
03902     unsigned char *checksum;
03903     struct buffer *filebuf;
03904 #endif
03905 {
03906     if (noexec)
03907     {
03908     /* Hmm, maybe if we did the same thing for entries_file, we
03909        could get rid of the kludges in server_register and
03910        server_scratch which refrain from warning if both
03911        Scratch_Entry and Register get called.  Maybe.  */
03912     if (scratched_file)
03913     {
03914         free (scratched_file);
03915         scratched_file = NULL;
03916     }
03917     return;
03918     }
03919
03920     if (entries_line != NULL && scratched_file == NULL)
03921     {
03922     FILE *f;
03923     struct buffer_data *list, *last;
03924     unsigned long size;
03925     char size_text[80];
03926
03927     /* The contents of the file will be in one of filebuf,
03928        list/last, or here.  */
03929     unsigned char *file;
03930     size_t file_allocated;
03931     size_t file_used;
03932
03933     if (filebuf != NULL)
03934     {
03935         size = buf_length (filebuf);
03936         if (mode == (mode_t) -1)
03937         error (1, 0, "\
03938 CVS server internal error: no mode in server_updated");
03939     }
03940     else
03941     {
03942         struct stat sb;
03943
03944         if ( CVS_STAT (finfo->file, &sb) < 0)
03945         {
03946         if (existence_error (errno))
03947         {
03948             /* If we have a sticky tag for a branch on which
03949                the file is dead, and cvs update the directory,
03950                it gets a T_CHECKOUT but no file.  So in this
03951                case just forget the whole thing.  */
03952             free (entries_line);
03953             entries_line = NULL;
03954             goto done;
03955         }
03956         error (1, errno, "reading %s", finfo->fullname);
03957         }
03958         size = sb.st_size;
03959         if (mode == (mode_t) -1)
03960         {
03961         /* FIXME: When we check out files the umask of the
03962            server (set in .bashrc if rsh is in use) affects
03963            what mode we send, and it shouldn't.  */
03964         mode = sb.st_mode;
03965         }
03966     }
03967
03968     if (checksum != NULL)
03969     {
03970         static int checksum_supported = -1;
03971
03972         if (checksum_supported == -1)
03973         {
03974         checksum_supported = supported_response ("Checksum");
03975         }
03976
03977         if (checksum_supported)
03978         {
03979             int i;
03980         char buf[3];
03981
03982             buf_output0 (protocol, "Checksum ");
03983         for (i = 0; i < 16; i++)
03984         {
03985             sprintf (buf, "%02x", (unsigned int) checksum[i]);
03986             buf_output0 (protocol, buf);
03987         }
03988         buf_append_char (protocol, '\n');
03989         }
03990     }
03991
03992     if (updated == SERVER_UPDATED)
03993     {
03994         Node *node;
03995         Entnode *entnode;
03996
03997         if (!(supported_response ("Created")
03998           && supported_response ("Update-existing")))
03999         buf_output0 (protocol, "Updated ");
04000         else
04001         {
04002         assert (vers != NULL);
04003         if (vers->ts_user == NULL)
04004             buf_output0 (protocol, "Created ");
04005         else
04006             buf_output0 (protocol, "Update-existing ");
04007         }
04008
04009         /* Now munge the entries to say that the file is unmodified,
04010            in case we end up processing it again (e.g. modules3-6
04011            in the testsuite).  */
04012         node = findnode_fn (finfo->entries, finfo->file);
04013         entnode = (Entnode *)node->data;
04014         free (entnode->timestamp);
04015         entnode->timestamp = xstrdup ("=");
04016     }
04017     else if (updated == SERVER_MERGED)
04018         buf_output0 (protocol, "Merged ");
04019     else if (updated == SERVER_PATCHED)
04020         buf_output0 (protocol, "Patched ");
04021     else if (updated == SERVER_RCS_DIFF)
04022         buf_output0 (protocol, "Rcs-diff ");
04023     else
04024         abort ();
04025     output_dir (finfo->update_dir, finfo->repository);
04026     buf_output0 (protocol, finfo->file);
04027     buf_output (protocol, "\n", 1);
04028
04029     new_entries_line ();
04030
04031         {
04032         char *mode_string;
04033
04034         mode_string = mode_to_string (mode);
04035         buf_output0 (protocol, mode_string);
04036         buf_output0 (protocol, "\n");
04037         free (mode_string);
04038     }
04039
04040     list = last = NULL;
04041
04042     file = NULL;
04043     file_allocated = 0;
04044     file_used = 0;
04045
04046     if (size > 0)
04047     {
04048         /* Throughout this section we use binary mode to read the
04049            file we are sending.  The client handles any line ending
04050            translation if necessary.  */
04051
04052         if (file_gzip_level
04053         /*
04054          * For really tiny files, the gzip process startup
04055          * time will outweigh the compression savings.  This
04056          * might be computable somehow; using 100 here is just
04057          * a first approximation.
04058          */
04059         && size > 100)
04060         {
04061         /* Basing this routine on read_and_gzip is not a
04062            high-performance approach.  But it seems easier
04063            to code than the alternative (and less
04064            vulnerable to subtle bugs).  Given that this feature
04065            is mainly for compatibility, that is the better
04066            tradeoff.  */
04067
04068         int fd;
04069
04070         /* Callers must avoid passing us a buffer if
04071                    file_gzip_level is set.  We could handle this case,
04072                    but it's not worth it since this case never arises
04073                    with a current client and server.  */
04074         if (filebuf != NULL)
04075             error (1, 0, "\
04076 CVS server internal error: unhandled case in server_updated");
04077
04078         fd = CVS_OPEN (finfo->file, O_RDONLY | OPEN_BINARY, 0);
04079         if (fd < 0)
04080             error (1, errno, "reading %s", finfo->fullname);
04081         if (read_and_gzip (fd, finfo->fullname, &file,
04082                    &file_allocated, &file_used,
04083                    file_gzip_level))
04084             error (1, 0, "aborting due to compression error");
04085         size = file_used;
04086         if (close (fd) < 0)
04087             error (1, errno, "reading %s", finfo->fullname);
04088         /* Prepending length with "z" is flag for using gzip here.  */
04089         buf_output0 (protocol, "z");
04090         }
04091         else if (filebuf == NULL)
04092         {
04093         long status;
04094
04095         f = CVS_FOPEN (finfo->file, "rb");
04096         if (f == NULL)
04097             error (1, errno, "reading %s", finfo->fullname);
04098         status = buf_read_file (f, size, &list, &last);
04099         if (status == -2)
04100             (*protocol->memory_error) (protocol);
04101         else if (status != 0)
04102             error (1, ferror (f) ? errno : 0, "reading %s",
04103                finfo->fullname);
04104         if (fclose (f) == EOF)
04105             error (1, errno, "reading %s", finfo->fullname);
04106         }
04107     }
04108
04109     sprintf (size_text, "%lu\n", size);
04110     buf_output0 (protocol, size_text);
04111
04112     if (file != NULL)
04113     {
04114         buf_output (protocol, (char *) file, file_used);
04115         free (file);
04116         file = NULL;
04117     }
04118     else if (filebuf == NULL)
04119         buf_append_data (protocol, list, last);
04120     else
04121     {
04122         buf_append_buffer (protocol, filebuf);
04123         buf_free (filebuf);
04124     }
04125     /* Note we only send a newline here if the file ended with one.  */
04126
04127     /*
04128      * Avoid using up too much disk space for temporary files.
04129      * A file which does not exist indicates that the file is up-to-date,
04130      * which is now the case.  If this is SERVER_MERGED, the file is
04131      * not up-to-date, and we indicate that by leaving the file there.
04132      * I'm thinking of cases like "cvs update foo/foo.c foo".
04133      */
04134     if ((updated == SERVER_UPDATED
04135          || updated == SERVER_PATCHED
04136          || updated == SERVER_RCS_DIFF)
04137         && filebuf == NULL
04138         /* But if we are joining, we'll need the file when we call
04139            join_file.  */
04140         && !joining ())
04141     {
04142         if (CVS_UNLINK (finfo->file) < 0)
04143         error (0, errno, "cannot remove temp file for %s",
04144                finfo->fullname);
04145     }
04146     }
04147     else if (scratched_file != NULL && entries_line == NULL)
04148     {
04149     if (strcmp (scratched_file, finfo->file) != 0)
04150         error (1, 0,
04151            "CVS server internal error: `%s' vs. `%s' scratched",
04152            scratched_file,
04153            finfo->file);
04154     free (scratched_file);
04155     scratched_file = NULL;
04156
04157     if (kill_scratched_file)
04158         buf_output0 (protocol, "Removed ");
04159     else
04160         buf_output0 (protocol, "Remove-entry ");
04161     output_dir (finfo->update_dir, finfo->repository);
04162     buf_output0 (protocol, finfo->file);
04163     buf_output (protocol, "\n", 1);
04164     }
04165     else if (scratched_file == NULL && entries_line == NULL)
04166     {
04167     /*
04168      * This can happen with death support if we were processing
04169      * a dead file in a checkout.
04170      */
04171     }
04172     else
04173     error (1, 0,
04174            "CVS server internal error: Register *and* Scratch_Entry.\n");
04175     buf_send_counted (protocol);
04176   done:;
04177 }
04178
04179 /* Return whether we should send patches in RCS format.  */
04180
04181 int
04182 server_use_rcs_diff ()
04183 {
04184     return supported_response ("Rcs-diff");
04185 }
04186
04187 void
04188 server_set_entstat (update_dir, repository)
04189     char *update_dir;
04190     char *repository;
04191 {
04192     static int set_static_supported = -1;
04193     if (set_static_supported == -1)
04194     set_static_supported = supported_response ("Set-static-directory");
04195     if (!set_static_supported) return;
04196
04197     buf_output0 (protocol, "Set-static-directory ");
04198     output_dir (update_dir, repository);
04199     buf_output0 (protocol, "\n");
04200     buf_send_counted (protocol);
04201 }
04202
04203 void
04204 server_clear_entstat (update_dir, repository)
04205      char *update_dir;
04206      char *repository;
04207 {
04208     static int clear_static_supported = -1;
04209     if (clear_static_supported == -1)
04210     clear_static_supported = supported_response ("Clear-static-directory");
04211     if (!clear_static_supported) return;
04212
04213     if (noexec)
04214     return;
04215
04216     buf_output0 (protocol, "Clear-static-directory ");
04217     output_dir (update_dir, repository);
04218     buf_output0 (protocol, "\n");
04219     buf_send_counted (protocol);
04220 }
04221
04222 void
04223 server_set_sticky (update_dir, repository, tag, date, nonbranch)
04224     char *update_dir;
04225     char *repository;
04226     char *tag;
04227     char *date;
04228     int nonbranch;
04229 {
04230     static int set_sticky_supported = -1;
04231
04232     assert (update_dir != NULL);
04233
04234     if (set_sticky_supported == -1)
04235     set_sticky_supported = supported_response ("Set-sticky");
04236     if (!set_sticky_supported) return;
04237
04238     if (noexec)
04239     return;
04240
04241     if (tag == NULL && date == NULL)
04242     {
04243     buf_output0 (protocol, "Clear-sticky ");
04244     output_dir (update_dir, repository);
04245     buf_output0 (protocol, "\n");
04246     }
04247     else
04248     {
04249     buf_output0 (protocol, "Set-sticky ");
04250     output_dir (update_dir, repository);
04251     buf_output0 (protocol, "\n");
04252     if (tag != NULL)
04253     {
04254         if (nonbranch)
04255         buf_output0 (protocol, "N");
04256         else
04257         buf_output0 (protocol, "T");
04258         buf_output0 (protocol, tag);
04259     }
04260     else
04261     {
04262         buf_output0 (protocol, "D");
04263         buf_output0 (protocol, date);
04264     }
04265     buf_output0 (protocol, "\n");
04266     }
04267     buf_send_counted (protocol);
04268 }
04269
04270 struct template_proc_data
04271 {
04272     char *update_dir;
04273     char *repository;
04274 };
04275
04276 /* Here as a static until we get around to fixing Parse_Info to pass along
04277    a void * for it.  */
04278 static struct template_proc_data *tpd;
04279
04280 static int
04281 template_proc (repository, template)
04282     char *repository;
04283     char *template;
04284 {
04285     FILE *fp;
04286     char buf[1024];
04287     size_t n;
04288     struct stat sb;
04289     struct template_proc_data *data = tpd;
04290
04291     if (!supported_response ("Template"))
04292     /* Might want to warn the user that the rcsinfo feature won't work.  */
04293     return 0;
04294     buf_output0 (protocol, "Template ");
04295     output_dir (data->update_dir, data->repository);
04296     buf_output0 (protocol, "\n");
04297
04298     fp = CVS_FOPEN (template, "rb");
04299     if (fp == NULL)
04300     {
04301     error (0, errno, "Couldn't open rcsinfo template file %s", template);
04302     return 1;
04303     }
04304     if (fstat (fileno (fp), &sb) < 0)
04305     {
04306     error (0, errno, "cannot stat rcsinfo template file %s", template);
04307     return 1;
04308     }
04309     sprintf (buf, "%ld\n", (long) sb.st_size);
04310     buf_output0 (protocol, buf);
04311     while (!feof (fp))
04312     {
04313     n = fread (buf, 1, sizeof buf, fp);
04314     buf_output (protocol, buf, n);
04315     if (ferror (fp))
04316     {
04317         error (0, errno, "cannot read rcsinfo template file %s", template);
04318         (void) fclose (fp);
04319         return 1;
04320     }
04321     }
04322     if (fclose (fp) < 0)
04323     error (0, errno, "cannot close rcsinfo template file %s", template);
04324     return 0;
04325 }
04326
04327 void
04328 server_template (update_dir, repository)
04329     char *update_dir;
04330     char *repository;
04331 {
04332     struct template_proc_data data;
04333     data.update_dir = update_dir;
04334     data.repository = repository;
04335     tpd = &data;
04336     (void) Parse_Info (CVSROOTADM_RCSINFO, repository, template_proc, 1);
04337 }
04338
04339 static void
04340 serve_gzip_contents (arg)
04341      char *arg;
04342 {
04343     int level;
04344     level = atoi (arg);
04345     if (level == 0)
04346     level = 6;
04347     file_gzip_level = level;
04348 }
04349
04350 static void
04351 serve_gzip_stream (arg)
04352      char *arg;
04353 {
04354     int level;
04355     level = atoi (arg);
04356     if (level == 0)
04357     level = 6;
04358
04359     /* All further communication with the client will be compressed.  */
04360
04361     buf_to_net = compress_buffer_initialize (buf_to_net, 0, level,
04362                          buf_to_net->memory_error);
04363     buf_from_net = compress_buffer_initialize (buf_from_net, 1, level,
04364                            buf_from_net->memory_error);
04365 }
04366
04367 /* Tell the client about RCS options set in CVSROOT/cvswrappers. */
04368 static void
04369 serve_wrapper_sendme_rcs_options (arg)
04370      char *arg;
04371 {
04372     /* Actually, this is kind of sdrawkcab-ssa: the client wants
04373      * verbatim lines from a cvswrappers file, but the server has
04374      * already parsed the cvswrappers file into the wrap_list struct.
04375      * Therefore, the server loops over wrap_list, unparsing each
04376      * entry before sending it.
04377      */
04378     char *wrapper_line = NULL;
04379
04380     wrap_setup ();
04381
04382     for (wrap_unparse_rcs_options (&wrapper_line, 1);
04383          wrapper_line;
04384          wrap_unparse_rcs_options (&wrapper_line, 0))
04385     {
04386     buf_output0 (buf_to_net, "Wrapper-rcsOption ");
04387     buf_output0 (buf_to_net, wrapper_line);
04388     buf_output0 (buf_to_net, "\012");;
04389     free (wrapper_line);
04390     }
04391
04392     buf_output0 (buf_to_net, "ok\012");
04393
04394     /* The client is waiting for us, so we better send the data now.  */
04395     buf_flush (buf_to_net, 1);
04396 }
04397
04398
04399 static void
04400 serve_ignore (arg)
04401     char *arg;
04402 {
04403     /*
04404      * Just ignore this command.  This is used to support the
04405      * update-patches command, which is not a real command, but a signal
04406      * to the client that update will accept the -u argument.
04407      */
04408 }
04409
04410 static int
04411 expand_proc (argc, argv, where, mwhere, mfile, shorten,
04412          local_specified, omodule, msg)
04413     int argc;
04414     char **argv;
04415     char *where;
04416     char *mwhere;
04417     char *mfile;
04418     int shorten;
04419     int local_specified;
04420     char *omodule;
04421     char *msg;
04422 {
04423     int i;
04424     char *dir = argv[0];
04425
04426     /* If mwhere has been specified, the thing we're expanding is a
04427        module -- just return its name so the client will ask for the
04428        right thing later.  If it is an alias or a real directory,
04429        mwhere will not be set, so send out the appropriate
04430        expansion. */
04431
04432     if (mwhere != NULL)
04433     {
04434     buf_output0 (buf_to_net, "Module-expansion ");
04435     if (server_dir != NULL)
04436     {
04437         buf_output0 (buf_to_net, server_dir);
04438         buf_output0 (buf_to_net, "/");
04439     }
04440     buf_output0 (buf_to_net, mwhere);
04441     if (mfile != NULL)
04442     {
04443         buf_append_char (buf_to_net, '/');
04444         buf_output0 (buf_to_net, mfile);
04445     }
04446     buf_append_char (buf_to_net, '\n');
04447     }
04448     else
04449     {
04450     /* We may not need to do this anymore -- check the definition
04451            of aliases before removing */
04452     if (argc == 1)
04453     {
04454         buf_output0 (buf_to_net, "Module-expansion ");
04455         if (server_dir != NULL)
04456         {
04457         buf_output0 (buf_to_net, server_dir);
04458         buf_output0 (buf_to_net, "/");
04459         }
04460         buf_output0 (buf_to_net, dir);
04461         buf_append_char (buf_to_net, '\n');
04462     }
04463     else
04464     {
04465         for (i = 1; i < argc; ++i)
04466         {
04467             buf_output0 (buf_to_net, "Module-expansion ");
04468         if (server_dir != NULL)
04469         {
04470             buf_output0 (buf_to_net, server_dir);
04471             buf_output0 (buf_to_net, "/");
04472         }
04473         buf_output0 (buf_to_net, dir);
04474         buf_append_char (buf_to_net, '/');
04475         buf_output0 (buf_to_net, argv[i]);
04476         buf_append_char (buf_to_net, '\n');
04477         }
04478     }
04479     }
04480     return 0;
04481 }
04482
04483 static void
04484 serve_expand_modules (arg)
04485     char *arg;
04486 {
04487     int i;
04488     int err;
04489     DBM *db;
04490     err = 0;
04491
04492     server_expanding = 1;
04493     db = open_module ();
04494     for (i = 1; i < argument_count; i++)
04495     err += do_module (db, argument_vector[i],
04496               CHECKOUT, "Updating", expand_proc,
04497               NULL, 0, 0, 0,
04498               (char *) NULL);
04499     close_module (db);
04500     server_expanding = 0;
04501     {
04502     /* argument_vector[0] is a dummy argument, we don't mess with it.  */
04503     char **cp;
04504     for (cp = argument_vector + 1;
04505          cp < argument_vector + argument_count;
04506          ++cp)
04507         free (*cp);
04508
04509     argument_count = 1;
04510     }
04511     if (err)
04512     /* We will have printed an error message already.  */
04513     buf_output0 (buf_to_net, "error  \n");
04514     else
04515     buf_output0 (buf_to_net, "ok\n");
04516
04517     /* The client is waiting for the module expansions, so we must
04518        send the output now.  */
04519     buf_flush (buf_to_net, 1);
04520 }
04521
04522 void
04523 server_prog (dir, name, which)
04524     char *dir;
04525     char *name;
04526     enum progs which;
04527 {
04528     if (!supported_response ("Set-checkin-prog"))
04529     {
04530     buf_output0 (buf_to_net, "E \
04531 warning: this client does not support -i or -u flags in the modules file.\n");
04532     return;
04533     }
04534     switch (which)
04535     {
04536     case PROG_CHECKIN:
04537         buf_output0 (buf_to_net, "Set-checkin-prog ");
04538         break;
04539     case PROG_UPDATE:
04540         buf_output0 (buf_to_net, "Set-update-prog ");
04541         break;
04542     }
04543     buf_output0 (buf_to_net, dir);
04544     buf_append_char (buf_to_net, '\n');
04545     buf_output0 (buf_to_net, name);
04546     buf_append_char (buf_to_net, '\n');
04547 }
04548
04549 static void
04550 serve_checkin_prog (arg)
04551     char *arg;
04552 {
04553     FILE *f;
04554     f = CVS_FOPEN (CVSADM_CIPROG, "w+");
04555     if (f == NULL)
04556     {
04557     int save_errno = errno;
04558     if (alloc_pending (80 + strlen (CVSADM_CIPROG)))
04559         sprintf (pending_error_text, "E cannot open %s", CVSADM_CIPROG);
04560     pending_error = save_errno;
04561     return;
04562     }
04563     if (fprintf (f, "%s\n", arg) < 0)
04564     {
04565     int save_errno = errno;
04566     if (alloc_pending (80 + strlen (CVSADM_CIPROG)))
04567         sprintf (pending_error_text,
04568              "E cannot write to %s", CVSADM_CIPROG);
04569     pending_error = save_errno;
04570     return;
04571     }
04572     if (fclose (f) == EOF)
04573     {
04574     int save_errno = errno;
04575     if (alloc_pending (80 + strlen (CVSADM_CIPROG)))
04576         sprintf (pending_error_text, "E cannot close %s", CVSADM_CIPROG);
04577     pending_error = save_errno;
04578     return;
04579     }
04580 }
04581
04582 static void
04583 serve_update_prog (arg)
04584     char *arg;
04585 {
04586     FILE *f;
04587
04588     /* Before we do anything we need to make sure we are not in readonly
04589        mode.  */
04590     if (!check_command_legal_p ("commit"))
04591     {
04592     /* I might be willing to make this a warning, except we lack the
04593        machinery to do so.  */
04594     if (alloc_pending (80))
04595         sprintf (pending_error_text, "\
04596 E Flag -u in modules not allowed in readonly mode");
04597     return;
04598     }
04599
04600     f = CVS_FOPEN (CVSADM_UPROG, "w+");
04601     if (f == NULL)
04602     {
04603     int save_errno = errno;
04604     if (alloc_pending (80 + strlen (CVSADM_UPROG)))
04605         sprintf (pending_error_text, "E cannot open %s", CVSADM_UPROG);
04606     pending_error = save_errno;
04607     return;
04608     }
04609     if (fprintf (f, "%s\n", arg) < 0)
04610     {
04611     int save_errno = errno;
04612     if (alloc_pending (80 + strlen (CVSADM_UPROG)))
04613         sprintf (pending_error_text, "E cannot write to %s", CVSADM_UPROG);
04614     pending_error = save_errno;
04615     return;
04616     }
04617     if (fclose (f) == EOF)
04618     {
04619     int save_errno = errno;
04620     if (alloc_pending (80 + strlen (CVSADM_UPROG)))
04621         sprintf (pending_error_text, "E cannot close %s", CVSADM_UPROG);
04622     pending_error = save_errno;
04623     return;
04624     }
04625 }
04626
04627 static void serve_valid_requests PROTO((char *arg));
04628
04629 #endif /* SERVER_SUPPORT */
04630 #if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)
04631
04632 /*
04633  * Parts of this table are shared with the client code,
04634  * but the client doesn't need to know about the handler
04635  * functions.
04636  */
04637
04638 struct request requests[] =
04639 {
04640 #ifdef SERVER_SUPPORT
04641 #define REQ_LINE(n, f, s) {n, f, s}
04642 #else
04643 #define REQ_LINE(n, f, s) {n, s}
04644 #endif
04645
04646   REQ_LINE("Root", serve_root, RQ_ESSENTIAL | RQ_ROOTLESS),
04647   REQ_LINE("Valid-responses", serve_valid_responses,
04648        RQ_ESSENTIAL | RQ_ROOTLESS),
04649   REQ_LINE("valid-requests", serve_valid_requests,
04650        RQ_ESSENTIAL | RQ_ROOTLESS),
04651   REQ_LINE("Repository", serve_repository, 0),
04652   REQ_LINE("Directory", serve_directory, RQ_ESSENTIAL),
04653   REQ_LINE("Max-dotdot", serve_max_dotdot, 0),
04654   REQ_LINE("Static-directory", serve_static_directory, 0),
04655   REQ_LINE("Sticky", serve_sticky, 0),
04656   REQ_LINE("Checkin-prog", serve_checkin_prog, 0),
04657   REQ_LINE("Update-prog", serve_update_prog, 0),
04658   REQ_LINE("Entry", serve_entry, RQ_ESSENTIAL),
04659   REQ_LINE("Kopt", serve_kopt, 0),
04660   REQ_LINE("Checkin-time", serve_checkin_time, 0),
04661   REQ_LINE("Modified", serve_modified, RQ_ESSENTIAL),
04662   REQ_LINE("Is-modified", serve_is_modified, 0),
04663
04664   /* The client must send this request to interoperate with CVS 1.5
04665      through 1.9 servers.  The server must support it (although it can
04666      be and is a noop) to interoperate with CVS 1.5 to 1.9 clients.  */
04667   REQ_LINE("UseUnchanged", serve_enable_unchanged, RQ_ENABLEME | RQ_ROOTLESS),
04668
04669   REQ_LINE("Unchanged", serve_unchanged, RQ_ESSENTIAL),
04670   REQ_LINE("Notify", serve_notify, 0),
04671   REQ_LINE("Questionable", serve_questionable, 0),
04672   REQ_LINE("Case", serve_case, 0),
04673   REQ_LINE("Argument", serve_argument, RQ_ESSENTIAL),
04674   REQ_LINE("Argumentx", serve_argumentx, RQ_ESSENTIAL),
04675   REQ_LINE("Global_option", serve_global_option, RQ_ROOTLESS),
04676   REQ_LINE("Gzip-stream", serve_gzip_stream, 0),
04677   REQ_LINE("wrapper-sendme-rcsOptions",
04678            serve_wrapper_sendme_rcs_options,
04679            0),
04680   REQ_LINE("Set", serve_set, RQ_ROOTLESS),
04681 #ifdef ENCRYPTION
04682 #  ifdef HAVE_KERBEROS
04683   REQ_LINE("Kerberos-encrypt", serve_kerberos_encrypt, 0),
04684 #  endif
04685 #  ifdef HAVE_GSSAPI
04686   REQ_LINE("Gssapi-encrypt", serve_gssapi_encrypt, 0),
04687 #  endif
04688 #endif
04689 #ifdef HAVE_GSSAPI
04690   REQ_LINE("Gssapi-authenticate", serve_gssapi_authenticate, 0),
04691 #endif
04692   REQ_LINE("expand-modules", serve_expand_modules, 0),
04693   REQ_LINE("ci", serve_ci, RQ_ESSENTIAL),
04694   REQ_LINE("co", serve_co, RQ_ESSENTIAL),
04695   REQ_LINE("update", serve_update, RQ_ESSENTIAL),
04696   REQ_LINE("diff", serve_diff, 0),
04697   REQ_LINE("log", serve_log, 0),
04698   REQ_LINE("add", serve_add, 0),
04699   REQ_LINE("remove", serve_remove, 0),
04700   REQ_LINE("update-patches", serve_ignore, 0),
04701   REQ_LINE("gzip-file-contents", serve_gzip_contents, 0),
04702   REQ_LINE("status", serve_status, 0),
04703   REQ_LINE("rdiff", serve_rdiff, 0),
04704   REQ_LINE("tag", serve_tag, 0),
04705   REQ_LINE("rtag", serve_rtag, 0),
04706   REQ_LINE("import", serve_import, 0),
04707   REQ_LINE("admin", serve_admin, 0),
04708   REQ_LINE("export", serve_export, 0),
04709   REQ_LINE("history", serve_history, 0),
04710   REQ_LINE("release", serve_release, 0),
04711   REQ_LINE("watch-on", serve_watch_on, 0),
04712   REQ_LINE("watch-off", serve_watch_off, 0),
04713   REQ_LINE("watch-add", serve_watch_add, 0),
04714   REQ_LINE("watch-remove", serve_watch_remove, 0),
04715   REQ_LINE("watchers", serve_watchers, 0),
04716   REQ_LINE("editors", serve_editors, 0),
04717   REQ_LINE("init", serve_init, RQ_ROOTLESS),
04718   REQ_LINE("annotate", serve_annotate, 0),
04719   REQ_LINE("noop", serve_noop, RQ_ROOTLESS),
04720   REQ_LINE("version", serve_version, RQ_ROOTLESS),
04721   REQ_LINE(NULL, NULL, 0)
04722
04723 #undef REQ_LINE
04724 };
04725
04726 #endif /* SERVER_SUPPORT or CLIENT_SUPPORT */
04727 #ifdef SERVER_SUPPORT
04728
04729 static void
04730 serve_valid_requests (arg)
04731      char *arg;
04732 {
04733     struct request *rq;
04734     if (print_pending_error ())
04735     return;
04736     buf_output0 (buf_to_net, "Valid-requests");
04737     for (rq = requests; rq->name != NULL; rq++)
04738     {
04739     if (rq->func != NULL)
04740     {
04741         buf_append_char (buf_to_net, ' ');
04742         buf_output0 (buf_to_net, rq->name);
04743     }
04744     }
04745     buf_output0 (buf_to_net, "\nok\n");
04746
04747     /* The client is waiting for the list of valid requests, so we
04748        must send the output now.  */
04749     buf_flush (buf_to_net, 1);
04750 }
04751
04752 #ifdef sun
04753 /*
04754  * Delete temporary files.  SIG is the signal making this happen, or
04755  * 0 if not called as a result of a signal.
04756  */
04757 static int command_pid_is_dead;
04758 static void wait_sig (sig)
04759      int sig;
04760 {
04761     int status;
04762     pid_t r = wait (&status);
04763     if (r == command_pid)
04764     command_pid_is_dead++;
04765 }
04766 #endif
04767
04768 void
04769 server_cleanup (sig)
04770     int sig;
04771 {
04772     /* Do "rm -rf" on the temp directory.  */
04773     int status;
04774     int save_noexec;
04775
04776     if (buf_to_net != NULL)
04777     {
04778     /* FIXME: If this is not the final call from server, this
04779        could deadlock, because the client might be blocked writing
04780        to us.  This should not be a problem in practice, because
04781        we do not generate much output when the client is not
04782        waiting for it.  */
04783     set_block (buf_to_net);
04784     buf_flush (buf_to_net, 1);
04785
04786     /* The calls to buf_shutdown are currently only meaningful
04787        when we are using compression.  First we shut down
04788        BUF_FROM_NET.  That will pick up the checksum generated
04789        when the client shuts down its buffer.  Then, after we have
04790        generated any final output, we shut down BUF_TO_NET.  */
04791
04792     status = buf_shutdown (buf_from_net);
04793     if (status != 0)
04794     {
04795         error (0, status, "shutting down buffer from client");
04796         buf_flush (buf_to_net, 1);
04797     }
04798     }
04799
04800     if (dont_delete_temp)
04801     {
04802     if (buf_to_net != NULL)
04803         (void) buf_shutdown (buf_to_net);
04804     return;
04805     }
04806
04807     /* What a bogus kludge.  This disgusting code makes all kinds of
04808        assumptions about SunOS, and is only for a bug in that system.
04809        So only enable it on Suns.  */
04810 #ifdef sun
04811     if (command_pid > 0)
04812     {
04813     /* To avoid crashes on SunOS due to bugs in SunOS tmpfs
04814        triggered by the use of rename() in RCS, wait for the
04815        subprocess to die.  Unfortunately, this means draining output
04816        while waiting for it to unblock the signal we sent it.  Yuck!  */
04817     int status;
04818     pid_t r;
04819
04820     signal (SIGCHLD, wait_sig);
04821     if (sig)
04822         /* Perhaps SIGTERM would be more correct.  But the child
04823            process will delay the SIGINT delivery until its own
04824            children have exited.  */
04825         kill (command_pid, SIGINT);
04826     /* The caller may also have sent a signal to command_pid, so
04827        always try waiting.  First, though, check and see if it's still
04828        there....  */
04829     do_waitpid:
04830     r = waitpid (command_pid, &status, WNOHANG);
04831     if (r == 0)
04832         ;
04833     else if (r == command_pid)
04834         command_pid_is_dead++;
04835     else if (r == -1)
04836         switch (errno)
04837         {
04838         case ECHILD:
04839             command_pid_is_dead++;
04840             break;
04841         case EINTR:
04842             goto do_waitpid;
04843         }
04844     else
04845         /* waitpid should always return one of the above values */
04846         abort ();
04847     while (!command_pid_is_dead)
04848     {
04849         struct timeval timeout;
04850         struct fd_set_wrapper readfds;
04851         char buf[100];
04852         int i;
04853
04854         /* Use a non-zero timeout to avoid eating up CPU cycles.  */
04855         timeout.tv_sec = 2;
04856         timeout.tv_usec = 0;
04857         readfds = command_fds_to_drain;
04858         switch (select (max_command_fd + 1, &readfds.fds,
04859                 (fd_set *)0, (fd_set *)0,
04860                 &timeout))
04861         {
04862         case -1:
04863             if (errno != EINTR)
04864             abort ();
04865         case 0:
04866             /* timeout */
04867             break;
04868         case 1:
04869             for (i = 0; i <= max_command_fd; i++)
04870             {
04871             if (!FD_ISSET (i, &readfds.fds))
04872                 continue;
04873             /* this fd is non-blocking */
04874             while (read (i, buf, sizeof (buf)) >= 1)
04875                 ;
04876             }
04877             break;
04878         default:
04879             abort ();
04880         }
04881     }
04882     }
04883 #endif
04884
04885     CVS_CHDIR (Tmpdir);
04886     /* Temporarily clear noexec, so that we clean up our temp directory
04887        regardless of it (this could more cleanly be handled by moving
04888        the noexec check to all the unlink_file_dir callers from
04889        unlink_file_dir itself).  */
04890     save_noexec = noexec;
04891     noexec = 0;
04892     /* FIXME?  Would be nice to not ignore errors.  But what should we do?
04893        We could try to do this before we shut down the network connection,
04894        and try to notify the client (but the client might not be waiting
04895        for responses).  We could try something like syslog() or our own
04896        log file.  */
04897     unlink_file_dir (orig_server_temp_dir);
04898     noexec = save_noexec;
04899
04900     if (buf_to_net != NULL)
04901     (void) buf_shutdown (buf_to_net);
04902 }
04903
04904 int server_active = 0;
04905 int server_expanding = 0;
04906
04907 int
04908 server (argc, argv)
04909      int argc;
04910      char **argv;
04911 {
04912     if (argc == -1)
04913     {
04914     static const char *const msg[] =
04915     {
04916         "Usage: %s %s\n",
04917         "  Normally invoked by a cvs client on a remote machine.\n",
04918         NULL
04919     };
04920     usage (msg);
04921     }
04922     /* Ignore argc and argv.  They might be from .cvsrc.  */
04923
04924     buf_to_net = fd_buffer_initialize (STDOUT_FILENO, 0,
04925                        outbuf_memory_error);
04926     buf_from_net = stdio_buffer_initialize (stdin, 1, outbuf_memory_error);
04927
04928     saved_output = buf_nonio_initialize (outbuf_memory_error);
04929     saved_outerr = buf_nonio_initialize (outbuf_memory_error);
04930
04931     /* Since we're in the server parent process, error should use the
04932        protocol to report error messages.  */
04933     error_use_protocol = 1;
04934
04935     /* OK, now figure out where we stash our temporary files.  */
04936     {
04937     char *p;
04938
04939     /* The code which wants to chdir into server_temp_dir is not set
04940        up to deal with it being a relative path.  So give an error
04941        for that case.  */
04942     if (!isabsolute (Tmpdir))
04943     {
04944         if (alloc_pending (80 + strlen (Tmpdir)))
04945         sprintf (pending_error_text,
04946              "E Value of %s for TMPDIR is not absolute", Tmpdir);
04947
04948         /* FIXME: we would like this error to be persistent, that
04949            is, not cleared by print_pending_error.  The current client
04950            will exit as soon as it gets an error, but the protocol spec
04951            does not require a client to do so.  */
04952     }
04953     else
04954     {
04955         int status;
04956         int i = 0;
04957
04958         server_temp_dir = malloc (strlen (Tmpdir) + 80);
04959         if (server_temp_dir == NULL)
04960         {
04961         /*
04962          * Strictly speaking, we're not supposed to output anything
04963          * now.  But we're about to exit(), give it a try.
04964          */
04965         printf ("E Fatal server error, aborting.\n\
04966 error ENOMEM Virtual memory exhausted.\n");
04967
04968         /* I'm doing this manually rather than via error_exit ()
04969            because I'm not sure whether we want to call server_cleanup.
04970            Needs more investigation....  */
04971
04972 #ifdef SYSTEM_CLEANUP
04973         /* Hook for OS-specific behavior, for example socket
04974            subsystems on NT and OS2 or dealing with windows
04975            and arguments on Mac.  */
04976         SYSTEM_CLEANUP ();
04977 #endif
04978
04979         exit (EXIT_FAILURE);
04980         }
04981         strcpy (server_temp_dir, Tmpdir);
04982
04983         /* Remove a trailing slash from TMPDIR if present.  */
04984         p = server_temp_dir + strlen (server_temp_dir) - 1;
04985         if (*p == '/')
04986         *p = '\0';
04987
04988         /*
04989          * I wanted to use cvs-serv/PID, but then you have to worry about
04990          * the permissions on the cvs-serv directory being right.  So
04991          * use cvs-servPID.
04992          */
04993         strcat (server_temp_dir, "/cvs-serv");
04994
04995         p = server_temp_dir + strlen (server_temp_dir);
04996         sprintf (p, "%ld", (long) getpid ());
04997
04998         orig_server_temp_dir = server_temp_dir;
04999
05000         /* Create the temporary directory, and set the mode to
05001                700, to discourage random people from tampering with
05002                it.  */
05003         while ((status = mkdir_p (server_temp_dir)) == EEXIST)
05004         {
05005             static const char suffix[] = "abcdefghijklmnopqrstuvwxyz";
05006
05007             if (i >= sizeof suffix - 1) break;
05008         if (i == 0) p = server_temp_dir + strlen (server_temp_dir);
05009         p[0] = suffix[i++];
05010         p[1] = '\0';
05011         }
05012         if (status != 0)
05013         {
05014         if (alloc_pending (80 + strlen (server_temp_dir)))
05015             sprintf (pending_error_text,
05016                 "E can't create temporary directory %s",
05017                 server_temp_dir);
05018         pending_error = status;
05019         }
05020 #ifndef CHMOD_BROKEN
05021         else
05022         {
05023         if (chmod (server_temp_dir, S_IRWXU) < 0)
05024         {
05025             int save_errno = errno;
05026             if (alloc_pending (80 + strlen (server_temp_dir)))
05027             sprintf (pending_error_text,
05028 "E cannot change permissions on temporary directory %s",
05029                 server_temp_dir);
05030             pending_error = save_errno;
05031         }
05032         }
05033 #endif
05034     }
05035     }
05036
05037 #ifdef SIGABRT
05038     (void) SIG_register (SIGABRT, server_cleanup);
05039 #endif
05040 #ifdef SIGHUP
05041     (void) SIG_register (SIGHUP, server_cleanup);
05042 #endif
05043 #ifdef SIGINT
05044     (void) SIG_register (SIGINT, server_cleanup);
05045 #endif
05046 #ifdef SIGQUIT
05047     (void) SIG_register (SIGQUIT, server_cleanup);
05048 #endif
05049 #ifdef SIGPIPE
05050     (void) SIG_register (SIGPIPE, server_cleanup);
05051 #endif
05052 #ifdef SIGTERM
05053     (void) SIG_register (SIGTERM, server_cleanup);
05054 #endif
05055
05056     /* Now initialize our argument vector (for arguments from the client).  */
05057
05058     /* Small for testing.  */
05059     argument_vector_size = 1;
05060     argument_vector =
05061     (char **) malloc (argument_vector_size * sizeof (char *));
05062     if (argument_vector == NULL)
05063     {
05064     /*
05065      * Strictly speaking, we're not supposed to output anything
05066      * now.  But we're about to exit(), give it a try.
05067      */
05068     printf ("E Fatal server error, aborting.\n\
05069 error ENOMEM Virtual memory exhausted.\n");
05070
05071     /* I'm doing this manually rather than via error_exit ()
05072        because I'm not sure whether we want to call server_cleanup.
05073        Needs more investigation....  */
05074
05075 #ifdef SYSTEM_CLEANUP
05076     /* Hook for OS-specific behavior, for example socket subsystems on
05077        NT and OS2 or dealing with windows and arguments on Mac.  */
05078     SYSTEM_CLEANUP ();
05079 #endif
05080
05081     exit (EXIT_FAILURE);
05082     }
05083
05084     argument_count = 1;
05085     /* This gets printed if the client supports an option which the
05086        server doesn't, causing the server to print a usage message.
05087        FIXME: probably should be using program_name here.
05088        FIXME: just a nit, I suppose, but the usage message the server
05089        prints isn't literally true--it suggests "cvs server" followed
05090        by options which are for a particular command.  Might be nice to
05091        say something like "client apparently supports an option not supported
05092        by this server" or something like that instead of usage message.  */
05093     argument_vector[0] = "cvs server";
05094
05095     while (1)
05096     {
05097     char *cmd, *orig_cmd;
05098     struct request *rq;
05099     int status;
05100
05101     status = buf_read_line (buf_from_net, &cmd, (int *) NULL);
05102     if (status == -2)
05103     {
05104         buf_output0 (buf_to_net, "E Fatal server error, aborting.\n\
05105 error ENOMEM Virtual memory exhausted.\n");
05106         break;
05107     }
05108     if (status != 0)
05109         break;
05110
05111     orig_cmd = cmd;
05112     for (rq = requests; rq->name != NULL; ++rq)
05113         if (strncmp (cmd, rq->name, strlen (rq->name)) == 0)
05114         {
05115         int len = strlen (rq->name);
05116         if (cmd[len] == '\0')
05117             cmd += len;
05118         else if (cmd[len] == ' ')
05119             cmd += len + 1;
05120         else
05121             /*
05122              * The first len characters match, but it's a different
05123              * command.  e.g. the command is "cooperate" but we matched
05124              * "co".
05125              */
05126             continue;
05127
05128         if (!(rq->flags & RQ_ROOTLESS)
05129             && CVSroot_directory == NULL)
05130         {
05131             /* For commands which change the way in which data
05132                is sent and received, for example Gzip-stream,
05133                this does the wrong thing.  Since the client
05134                assumes that everything is being compressed,
05135                unconditionally, there is no way to give this
05136                error to the client without turning on
05137                compression.  The obvious fix would be to make
05138                Gzip-stream RQ_ROOTLESS (with the corresponding
05139                change to the spec), and that might be a good
05140                idea but then again I can see some settings in
05141                CVSROOT about what compression level to allow.
05142                I suppose a more baroque answer would be to
05143                turn on compression (say, at level 1), just
05144                enough to give the "Root request missing"
05145                error.  For now we just lose.  */
05146             if (alloc_pending (80))
05147             sprintf (pending_error_text,
05148                  "E Protocol error: Root request missing");
05149         }
05150         else
05151             (*rq->func) (cmd);
05152         break;
05153         }
05154     if (rq->name == NULL)
05155     {
05156         if (!print_pending_error ())
05157         {
05158             buf_output0 (buf_to_net, "error  unrecognized request `");
05159         buf_output0 (buf_to_net, cmd);
05160         buf_append_char (buf_to_net, '\'');
05161         buf_append_char (buf_to_net, '\n');
05162         }
05163     }
05164     free (orig_cmd);
05165     }
05166     server_cleanup (0);
05167     return 0;
05168 }
05169
05170
05171 #if defined (HAVE_KERBEROS) || defined (AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)
05172 static void switch_to_user PROTO((const char *));
05173
05174 static void
05175 switch_to_user (username)
05176     const char *username;
05177 {
05178     struct passwd *pw;
05179
05180     pw = getpwnam (username);
05181     if (pw == NULL)
05182     {
05183     /* Normally this won't be reached; check_password contains
05184        a similar check.  */
05185
05186     printf ("E Fatal error, aborting.\n\
05187 error 0 %s: no such user\n", username);
05188     /* Don't worry about server_cleanup; server_active isn't set yet.  */
05189     error_exit ();
05190     }
05191
05192 #if HAVE_INITGROUPS
05193     if (initgroups (pw->pw_name, pw->pw_gid) < 0
05194 #  ifdef EPERM
05195     /* At least on the system I tried, initgroups() only works as root.
05196        But we do still want to report ENOMEM and whatever other
05197        errors initgroups() might dish up.  */
05198     && errno != EPERM
05199 #  endif
05200     )
05201     {
05202     /* This could be a warning, but I'm not sure I see the point
05203        in doing that instead of an error given that it would happen
05204        on every connection.  We could log it somewhere and not tell
05205        the user.  But at least for now make it an error.  */
05206     printf ("error 0 initgroups failed: %s\n", strerror (errno));
05207     /* Don't worry about server_cleanup; server_active isn't set yet.  */
05208     error_exit ();
05209     }
05210 #endif /* HAVE_INITGROUPS */
05211
05212 #ifdef SETXID_SUPPORT
05213     /* honor the setgid bit iff set*/
05214     if (getgid() != getegid())
05215     {
05216     if (setgid (getegid ()) < 0)
05217     {
05218         /* See comments at setuid call below for more discussion.  */
05219         printf ("error 0 setgid failed: %s\n", strerror (errno));
05220         /* Don't worry about server_cleanup;
05221            server_active isn't set yet.  */
05222         error_exit ();
05223     }
05224     }
05225     else
05226 #endif
05227     {
05228     if (setgid (pw->pw_gid) < 0)
05229     {
05230         /* See comments at setuid call below for more discussion.  */
05231         printf ("error 0 setgid failed: %s\n", strerror (errno));
05232         /* Don't worry about server_cleanup;
05233            server_active isn't set yet.  */
05234         error_exit ();
05235     }
05236     }
05237
05238     if (setuid (pw->pw_uid) < 0)
05239     {
05240     /* Note that this means that if run as a non-root user,
05241        CVSROOT/passwd must contain the user we are running as
05242        (e.g. "joe:FsEfVcu:cvs" if run as "cvs" user).  This seems
05243        cleaner than ignoring the error like CVS 1.10 and older but
05244        it does mean that some people might need to update their
05245        CVSROOT/passwd file.  */
05246     printf ("error 0 setuid failed: %s\n", strerror (errno));
05247     /* Don't worry about server_cleanup; server_active isn't set yet.  */
05248     error_exit ();
05249     }
05250
05251     /* We don't want our umask to change file modes.  The modes should
05252        be set by the modes used in the repository, and by the umask of
05253        the client.  */
05254     umask (0);
05255
05256 #ifdef AUTH_SERVER_SUPPORT
05257     /* Make sure our CVS_Username has been set. */
05258     if (CVS_Username == NULL)
05259     CVS_Username = xstrdup (username);
05260 #endif
05261
05262 #if HAVE_PUTENV
05263     /* Set LOGNAME and USER in the environment, in case they are
05264        already set to something else.  */
05265     {
05266     char *env;
05267
05268     env = xmalloc (sizeof "LOGNAME=" + strlen (username));
05269     (void) sprintf (env, "LOGNAME=%s", username);
05270     (void) putenv (env);
05271
05272     env = xmalloc (sizeof "USER=" + strlen (username));
05273     (void) sprintf (env, "USER=%s", username);
05274     (void) putenv (env);
05275     }
05276 #endif /* HAVE_PUTENV */
05277 }
05278 #endif
05279
05280 #ifdef AUTH_SERVER_SUPPORT
05281
05282 extern char *crypt PROTO((const char *, const char *));
05283
05284
05285 /*
05286  * 0 means no entry found for this user.
05287  * 1 means entry found and password matches (or found password is empty)
05288  * 2 means entry found, but password does not match.
05289  *
05290  * If 1, host_user_ptr will be set to point at the system
05291  * username (i.e., the "real" identity, which may or may not be the
05292  * CVS username) of this user; caller may free this.  Global
05293  * CVS_Username will point at an allocated copy of cvs username (i.e.,
05294  * the username argument below).
05295  * kff todo: FIXME: last sentence is not true, it applies to caller.
05296  */
05297 static int
05298 check_repository_password (username, password, repository, host_user_ptr)
05299      char *username, *password, *repository, **host_user_ptr;
05300 {
05301     int retval = 0;
05302     FILE *fp;
05303     char *filename;
05304     char *linebuf = NULL;
05305     size_t linebuf_len;
05306     int found_it = 0;
05307     int namelen;
05308
05309     /* We don't use CVSroot_directory because it hasn't been set yet
05310      * -- our `repository' argument came from the authentication
05311      * protocol, not the regular CVS protocol.
05312      */
05313
05314     filename = xmalloc (strlen (repository)
05315             + 1
05316             + strlen (CVSROOTADM)
05317             + 1
05318             + strlen (CVSROOTADM_PASSWD)
05319             + 1);
05320
05321     (void) sprintf (filename, "%s/%s/%s", repository,
05322                     CVSROOTADM, CVSROOTADM_PASSWD);
05323
05324     fp = CVS_FOPEN (filename, "r");
05325     if (fp == NULL)
05326     {
05327     if (!existence_error (errno))
05328         error (0, errno, "cannot open %s", filename);
05329     return 0;
05330     }
05331
05332     /* Look for a relevant line -- one with this user's name. */
05333     namelen = strlen (username);
05334     while (getline (&linebuf, &linebuf_len, fp) >= 0)
05335     {
05336     if ((strncmp (linebuf, username, namelen) == 0)
05337         && (linebuf[namelen] == ':'))
05338         {
05339         found_it = 1;
05340         break;
05341         }
05342     }
05343     if (ferror (fp))
05344     error (0, errno, "cannot read %s", filename);
05345     if (fclose (fp) < 0)
05346     error (0, errno, "cannot close %s", filename);
05347
05348     /* If found_it, then linebuf contains the information we need. */
05349     if (found_it)
05350     {
05351     char *found_password, *host_user_tmp;
05352         char *non_cvsuser_portion;
05353
05354         /* We need to make sure lines such as
05355          *
05356          *    "username::sysuser\n"
05357          *    "username:\n"
05358          *    "username:  \n"
05359          *
05360          * all result in a found_password of NULL, but we also need to
05361          * make sure that
05362          *
05363          *    "username:   :sysuser\n"
05364          *    "username: <whatever>:sysuser\n"
05365          *
05366          * continues to result in an impossible password.  That way,
05367          * an admin would be on safe ground by going in and tacking a
05368          * space onto the front of a password to disable the account
05369          * (a technique some people use to close accounts
05370          * temporarily).
05371          */
05372
05373         /* Make `non_cvsuser_portion' contain everything after the CVS
05374            username, but null out any final newline. */
05375     non_cvsuser_portion = linebuf + namelen;
05376         strtok (non_cvsuser_portion, "\n");
05377
05378         /* If there's a colon now, we just want to inch past it. */
05379         if (strchr (non_cvsuser_portion, ':') == non_cvsuser_portion)
05380             non_cvsuser_portion++;
05381
05382         /* Okay, after this conditional chain, found_password and
05383            host_user_tmp will have useful values: */
05384
05385         if ((non_cvsuser_portion == NULL)
05386             || (strlen (non_cvsuser_portion) == 0)
05387             || ((strspn (non_cvsuser_portion, " \t"))
05388                 == strlen (non_cvsuser_portion)))
05389         {
05390             found_password = NULL;
05391             host_user_tmp = NULL;
05392         }
05393         else if (strncmp (non_cvsuser_portion, ":", 1) == 0)
05394         {
05395             found_password = NULL;
05396             host_user_tmp = non_cvsuser_portion + 1;
05397             if (strlen (host_user_tmp) == 0)
05398                 host_user_tmp = NULL;
05399         }
05400         else
05401         {
05402             found_password = strtok (non_cvsuser_portion, ":");
05403             host_user_tmp = strtok (NULL, ":");
05404         }
05405
05406         /* Of course, maybe there was no system user portion... */
05407     if (host_user_tmp == NULL)
05408             host_user_tmp = username;
05409
05410         /* Verify blank passwords directly, otherwise use crypt(). */
05411         if ((found_password == NULL)
05412             || ((strcmp (found_password, crypt (password, found_password))
05413                  == 0)))
05414         {
05415             /* Give host_user_ptr permanent storage. */
05416             *host_user_ptr = xstrdup (host_user_tmp);
05417         retval = 1;
05418         }
05419     else
05420         {
05421             *host_user_ptr = NULL;
05422         retval         = 2;
05423         }
05424     }
05425     else     /* Didn't find this user, so deny access. */
05426     {
05427     *host_user_ptr = NULL;
05428     retval = 0;
05429     }
05430
05431     free (filename);
05432     if (linebuf)
05433         free (linebuf);
05434
05435     return retval;
05436 }
05437
05438
05439 /* Return a hosting username if password matches, else NULL. */
05440 static char *
05441 check_password (username, password, repository)
05442     char *username, *password, *repository;
05443 {
05444     int rc;
05445     char *host_user = NULL;
05446
05447     /* First we see if this user has a password in the CVS-specific
05448        password file.  If so, that's enough to authenticate with.  If
05449        not, we'll check /etc/passwd. */
05450
05451     rc = check_repository_password (username, password, repository,
05452                     &host_user);
05453
05454     if (rc == 2)
05455     return NULL;
05456
05457     /* else */
05458
05459     if (rc == 1)
05460     {
05461         /* host_user already set by reference, so just return. */
05462         goto handle_return;
05463     }
05464     else if (rc == 0 && system_auth)
05465     {
05466     /* No cvs password found, so try /etc/passwd. */
05467
05468     const char *found_passwd = NULL;
05469     struct passwd *pw;
05470 #ifdef HAVE_GETSPNAM
05471     struct spwd *spw;
05472
05473     spw = getspnam (username);
05474     if (spw != NULL)
05475     {
05476         found_passwd = spw->sp_pwdp;
05477     }
05478 #endif
05479
05480     if (found_passwd == NULL && (pw = getpwnam (username)) != NULL)
05481     {
05482         found_passwd = pw->pw_passwd;
05483     }
05484
05485     if (found_passwd == NULL)
05486     {
05487         printf ("E Fatal error, aborting.\n\
05488 error 0 %s: no such user\n", username);
05489
05490         /* I'm doing this manually rather than via error_exit ()
05491            because I'm not sure whether we want to call server_cleanup.
05492            Needs more investigation....  */
05493
05494 #ifdef SYSTEM_CLEANUP
05495         /* Hook for OS-specific behavior, for example socket subsystems on
05496            NT and OS2 or dealing with windows and arguments on Mac.  */
05497         SYSTEM_CLEANUP ();
05498 #endif
05499
05500         exit (EXIT_FAILURE);
05501     }
05502
05503     if (*found_passwd)
05504         {
05505         /* user exists and has a password */
05506         host_user = ((! strcmp (found_passwd,
05507                                     crypt (password, found_passwd)))
05508                          ? xstrdup (username) : NULL);
05509             goto handle_return;
05510         }
05511     else if (password && *password)
05512         {
05513         /* user exists and has no system password, but we got
05514            one as parameter */
05515         host_user = xstrdup (username);
05516             goto handle_return;
05517         }
05518     else
05519         {
05520         /* user exists but has no password at all */
05521         host_user = NULL;
05522             goto handle_return;
05523         }
05524     }
05525     else if (rc == 0)
05526     {
05527     /* Note that the message _does_ distinguish between the case in
05528        which we check for a system password and the case in which
05529        we do not.  It is a real pain to track down why it isn't
05530        letting you in if it won't say why, and I am not convinced
05531        that the potential information disclosure to an attacker
05532        outweighs this.  */
05533     printf ("error 0 no such user %s in CVSROOT/passwd\n", username);
05534
05535     /* I'm doing this manually rather than via error_exit ()
05536        because I'm not sure whether we want to call server_cleanup.
05537        Needs more investigation....  */
05538
05539 #ifdef SYSTEM_CLEANUP
05540     /* Hook for OS-specific behavior, for example socket subsystems on
05541        NT and OS2 or dealing with windows and arguments on Mac.  */
05542     SYSTEM_CLEANUP ();
05543 #endif
05544     exit (EXIT_FAILURE);
05545     }
05546     else
05547     {
05548     /* Something strange happened.  We don't know what it was, but
05549        we certainly won't grant authorization. */
05550     host_user = NULL;
05551         goto handle_return;
05552     }
05553
05554 handle_return:
05555     if (host_user)
05556     {
05557         /* Set CVS_Username here, in allocated space.
05558            It might or might not be the same as host_user. */
05559         CVS_Username = xmalloc (strlen (username) + 1);
05560         strcpy (CVS_Username, username);
05561     }
05562
05563     return host_user;
05564 }
05565
05566 #endif /* AUTH_SERVER_SUPPORT */
05567
05568 #if defined (AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)
05569
05570 /* Read username and password from client (i.e., stdin).
05571    If correct, then switch to run as that user and send an ACK to the
05572    client via stdout, else send NACK and die. */
05573 void
05574 pserver_authenticate_connection ()
05575 {
05576     char *tmp = NULL;
05577     size_t tmp_allocated = 0;
05578 #ifdef AUTH_SERVER_SUPPORT
05579     char *repository = NULL;
05580     size_t repository_allocated = 0;
05581     char *username = NULL;
05582     size_t username_allocated = 0;
05583     char *password = NULL;
05584     size_t password_allocated = 0;
05585
05586     char *host_user;
05587     char *descrambled_password;
05588 #endif /* AUTH_SERVER_SUPPORT */
05589     int verify_and_exit = 0;
05590
05591     /* The Authentication Protocol.  Client sends:
05592      *
05593      *   BEGIN AUTH REQUEST\n
05594      *   <REPOSITORY>\n
05595      *   <USERNAME>\n
05596      *   <PASSWORD>\n
05597      *   END AUTH REQUEST\n
05598      *
05599      * Server uses above information to authenticate, then sends
05600      *
05601      *   I LOVE YOU\n
05602      *
05603      * if it grants access, else
05604      *
05605      *   I HATE YOU\n
05606      *
05607      * if it denies access (and it exits if denying).
05608      *
05609      * When the client is "cvs login", the user does not desire actual
05610      * repository access, but would like to confirm the password with
05611      * the server.  In this case, the start and stop strings are
05612      *
05613      *   BEGIN VERIFICATION REQUEST\n
05614      *
05615      *            and
05616      *
05617      *   END VERIFICATION REQUEST\n
05618      *
05619      * On a verification request, the server's responses are the same
05620      * (with the obvious semantics), but it exits immediately after
05621      * sending the response in both cases.
05622      *
05623      * Why is the repository sent?  Well, note that the actual
05624      * client/server protocol can't start up until authentication is
05625      * successful.  But in order to perform authentication, the server
05626      * needs to look up the password in the special CVS passwd file,
05627      * before trying /etc/passwd.  So the client transmits the
05628      * repository as part of the "authentication protocol".  The
05629      * repository will be redundantly retransmitted later, but that's no
05630      * big deal.
05631      */
05632
05633 #ifdef SO_KEEPALIVE
05634     /* Set SO_KEEPALIVE on the socket, so that we don't hang forever
05635        if the client dies while we are waiting for input.  */
05636     {
05637     int on = 1;
05638
05639     (void) setsockopt (STDIN_FILENO, SOL_SOCKET, SO_KEEPALIVE,
05640                (char *) &on, sizeof on);
05641     }
05642 #endif
05643
05644     /* Make sure the protocol starts off on the right foot... */
05645     if (getline_safe (&tmp, &tmp_allocated, stdin, PATH_MAX) < 0)
05646     /* FIXME: what?  We could try writing error/eof, but chances
05647        are the network connection is dead bidirectionally.  log it
05648        somewhere?  */
05649     ;
05650
05651     if (strcmp (tmp, "BEGIN VERIFICATION REQUEST\n") == 0)
05652     verify_and_exit = 1;
05653     else if (strcmp (tmp, "BEGIN AUTH REQUEST\n") == 0)
05654     ;
05655     else if (strcmp (tmp, "BEGIN GSSAPI REQUEST\n") == 0)
05656     {
05657 #ifdef HAVE_GSSAPI
05658     free (tmp);
05659     gserver_authenticate_connection ();
05660     return;
05661 #else
05662     error (1, 0, "GSSAPI authentication not supported by this server");
05663 #endif
05664     }
05665     else
05666     error (1, 0, "bad auth protocol start: %s", tmp);
05667
05668 #ifndef AUTH_SERVER_SUPPORT
05669
05670     error (1, 0, "Password authentication not supported by this server");
05671
05672 #else /* AUTH_SERVER_SUPPORT */
05673
05674     /* Get the three important pieces of information in order. */
05675     /* See above comment about error handling.  */
05676     getline_safe (&repository, &repository_allocated, stdin, PATH_MAX);
05677     getline_safe (&username, &username_allocated, stdin, PATH_MAX);
05678     getline_safe (&password, &password_allocated, stdin, PATH_MAX);
05679
05680     /* Make them pure. */
05681     strip_trailing_newlines (repository);
05682     strip_trailing_newlines (username);
05683     strip_trailing_newlines (password);
05684
05685     /* ... and make sure the protocol ends on the right foot. */
05686     /* See above comment about error handling.  */
05687     getline_safe (&tmp, &tmp_allocated, stdin, PATH_MAX);
05688     if (strcmp (tmp,
05689         verify_and_exit ?
05690         "END VERIFICATION REQUEST\n" : "END AUTH REQUEST\n")
05691     != 0)
05692     {
05693     error (1, 0, "bad auth protocol end: %s", tmp);
05694     }
05695     if (!root_allow_ok (repository))
05696     /* Just give a generic I HATE YOU.  This is because CVS 1.9.10
05697        and older clients do not support "error".  Once more recent
05698        clients are more widespread, probably want to fix this (it is
05699        a real pain to track down why it isn't letting you in if it
05700        won't say why, and I am not convinced that the potential
05701        information disclosure to an attacker outweighs this).  */
05702     goto i_hate_you;
05703
05704     /* OK, now parse the config file, so we can use it to control how
05705        to check passwords.  If there was an error parsing the config
05706        file, parse_config already printed an error.  We keep going.
05707        Why?  Because if we didn't, then there would be no way to check
05708        in a new CVSROOT/config file to fix the broken one!  */
05709     parse_config (repository);
05710
05711     /* We need the real cleartext before we hash it. */
05712     descrambled_password = descramble (password);
05713     host_user = check_password (username, descrambled_password, repository);
05714     memset (descrambled_password, 0, strlen (descrambled_password));
05715     free (descrambled_password);
05716     if (host_user == NULL)
05717     {
05718     i_hate_you:
05719     printf ("I HATE YOU\n");
05720     fflush (stdout);
05721
05722     /* Don't worry about server_cleanup, server_active isn't set
05723        yet.  */
05724     error_exit ();
05725     }
05726
05727     /* Don't go any farther if we're just responding to "cvs login". */
05728     if (verify_and_exit)
05729     {
05730     printf ("I LOVE YOU\n");
05731     fflush (stdout);
05732
05733 #ifdef SYSTEM_CLEANUP
05734     /* Hook for OS-specific behavior, for example socket subsystems on
05735        NT and OS2 or dealing with windows and arguments on Mac.  */
05736     SYSTEM_CLEANUP ();
05737 #endif
05738
05739     exit (0);
05740     }
05741
05742     /* Set Pserver_Repos so that we can check later that the same
05743        repository is sent in later client/server protocol. */
05744     Pserver_Repos = xmalloc (strlen (repository) + 1);
05745     strcpy (Pserver_Repos, repository);
05746
05747     /* Switch to run as this user. */
05748     switch_to_user (host_user);
05749     free (host_user);
05750     free (tmp);
05751     free (repository);
05752     free (username);
05753     free (password);
05754
05755     printf ("I LOVE YOU\n");
05756     fflush (stdout);
05757 #endif /* AUTH_SERVER_SUPPORT */
05758 }
05759
05760 #endif /* AUTH_SERVER_SUPPORT || HAVE_GSSAPI */
05761
05762
05763 #ifdef HAVE_KERBEROS
05764 void
05765 kserver_authenticate_connection ()
05766 {
05767     int status;
05768     char instance[INST_SZ];
05769     struct sockaddr_in peer;
05770     struct sockaddr_in laddr;
05771     int len;
05772     KTEXT_ST ticket;
05773     AUTH_DAT auth;
05774     char version[KRB_SENDAUTH_VLEN];
05775     char user[ANAME_SZ];
05776
05777     strcpy (instance, "*");
05778     len = sizeof peer;
05779     if (getpeername (STDIN_FILENO, (struct sockaddr *) &peer, &len) < 0
05780     || getsockname (STDIN_FILENO, (struct sockaddr *) &laddr,
05781             &len) < 0)
05782     {
05783     printf ("E Fatal error, aborting.\n\
05784 error %s getpeername or getsockname failed\n", strerror (errno));
05785 #ifdef SYSTEM_CLEANUP
05786     /* Hook for OS-specific behavior, for example socket subsystems on
05787        NT and OS2 or dealing with windows and arguments on Mac.  */
05788     SYSTEM_CLEANUP ();
05789 #endif
05790     exit (EXIT_FAILURE);
05791     }
05792
05793 #ifdef SO_KEEPALIVE
05794     /* Set SO_KEEPALIVE on the socket, so that we don't hang forever
05795        if the client dies while we are waiting for input.  */
05796     {
05797     int on = 1;
05798
05799     (void) setsockopt (STDIN_FILENO, SOL_SOCKET, SO_KEEPALIVE,
05800                (char *) &on, sizeof on);
05801     }
05802 #endif
05803
05804     status = krb_recvauth (KOPT_DO_MUTUAL, STDIN_FILENO, &ticket, "rcmd",
05805                instance, &peer, &laddr, &auth, "", sched,
05806                version);
05807     if (status != KSUCCESS)
05808     {
05809     printf ("E Fatal error, aborting.\n\
05810 error 0 kerberos: %s\n", krb_get_err_text(status));
05811 #ifdef SYSTEM_CLEANUP
05812     /* Hook for OS-specific behavior, for example socket subsystems on
05813        NT and OS2 or dealing with windows and arguments on Mac.  */
05814     SYSTEM_CLEANUP ();
05815 #endif
05816     exit (EXIT_FAILURE);
05817     }
05818
05819     memcpy (kblock, auth.session, sizeof (C_Block));
05820
05821     /* Get the local name.  */
05822     status = krb_kntoln (&auth, user);
05823     if (status != KSUCCESS)
05824     {
05825     printf ("E Fatal error, aborting.\n\
05826 error 0 kerberos: can't get local name: %s\n", krb_get_err_text(status));
05827 #ifdef SYSTEM_CLEANUP
05828     /* Hook for OS-specific behavior, for example socket subsystems on
05829        NT and OS2 or dealing with windows and arguments on Mac.  */
05830     SYSTEM_CLEANUP ();
05831 #endif
05832     exit (EXIT_FAILURE);
05833     }
05834
05835     /* Switch to run as this user. */
05836     switch_to_user (user);
05837 }
05838 #endif /* HAVE_KERBEROS */
05839
05840 #ifdef HAVE_GSSAPI
05841
05842 #ifndef MAXHOSTNAMELEN
05843 #define MAXHOSTNAMELEN (256)
05844 #endif
05845
05846 /* Authenticate a GSSAPI connection.  This is called from
05847    pserver_authenticate_connection, and it handles success and failure
05848    the same way.  */
05849
05850 static void
05851 gserver_authenticate_connection ()
05852 {
05853     char hostname[MAXHOSTNAMELEN];
05854     struct hostent *hp;
05855     gss_buffer_desc tok_in, tok_out;
05856     char buf[1024];
05857     OM_uint32 stat_min, ret;
05858     gss_name_t server_name, client_name;
05859     gss_cred_id_t server_creds;
05860     int nbytes;
05861     gss_OID mechid;
05862
05863     gethostname (hostname, sizeof hostname);
05864     hp = gethostbyname (hostname);
05865     if (hp == NULL)
05866     error (1, 0, "can't get canonical hostname");
05867
05868     sprintf (buf, "cvs@%s", hp->h_name);
05869     tok_in.value = buf;
05870     tok_in.length = strlen (buf);
05871
05872     if (gss_import_name (&stat_min, &tok_in, GSS_C_NT_HOSTBASED_SERVICE,
05873              &server_name) != GSS_S_COMPLETE)
05874     error (1, 0, "could not import GSSAPI service name %s", buf);
05875
05876     /* Acquire the server credential to verify the client's
05877        authentication.  */
05878     if (gss_acquire_cred (&stat_min, server_name, 0, GSS_C_NULL_OID_SET,
05879               GSS_C_ACCEPT, &server_creds,
05880               NULL, NULL) != GSS_S_COMPLETE)
05881     error (1, 0, "could not acquire GSSAPI server credentials");
05882
05883     gss_release_name (&stat_min, &server_name);
05884
05885     /* The client will send us a two byte length followed by that many
05886        bytes.  */
05887     if (fread (buf, 1, 2, stdin) != 2)
05888     error (1, errno, "read of length failed");
05889
05890     nbytes = ((buf[0] & 0xff) << 8) | (buf[1] & 0xff);
05891     assert (nbytes <= sizeof buf);
05892
05893     if (fread (buf, 1, nbytes, stdin) != nbytes)
05894     error (1, errno, "read of data failed");
05895
05896     gcontext = GSS_C_NO_CONTEXT;
05897     tok_in.length = nbytes;
05898     tok_in.value = buf;
05899
05900     if (gss_accept_sec_context (&stat_min,
05901                                 &gcontext,  /* context_handle */
05902                                 server_creds,   /* verifier_cred_handle */
05903                                 &tok_in,    /* input_token */
05904                                 NULL,       /* channel bindings */
05905                                 &client_name,   /* src_name */
05906                                 &mechid,    /* mech_type */
05907                                 &tok_out,   /* output_token */
05908                                 &ret,
05909                                 NULL,       /* ignore time_rec */
05910                                 NULL)       /* ignore del_cred_handle */
05911     != GSS_S_COMPLETE)
05912     {
05913     error (1, 0, "could not verify credentials");
05914     }
05915
05916     /* FIXME: Use Kerberos v5 specific code to authenticate to a user.
05917        We could instead use an authentication to access mapping.  */
05918     {
05919     krb5_context kc;
05920     krb5_principal p;
05921     gss_buffer_desc desc;
05922
05923     krb5_init_context (&kc);
05924     if (gss_display_name (&stat_min, client_name, &desc,
05925                   &mechid) != GSS_S_COMPLETE
05926         || krb5_parse_name (kc, ((gss_buffer_t) &desc)->value, &p) != 0
05927         || krb5_aname_to_localname (kc, p, sizeof buf, buf) != 0
05928         || krb5_kuserok (kc, p, buf) != TRUE)
05929     {
05930         error (1, 0, "access denied");
05931     }
05932     krb5_free_principal (kc, p);
05933     krb5_free_context (kc);
05934     }
05935
05936     if (tok_out.length != 0)
05937     {
05938     char cbuf[2];
05939
05940     cbuf[0] = (tok_out.length >> 8) & 0xff;
05941     cbuf[1] = tok_out.length & 0xff;
05942     if (fwrite (cbuf, 1, 2, stdout) != 2
05943         || (fwrite (tok_out.value, 1, tok_out.length, stdout)
05944         != tok_out.length))
05945         error (1, errno, "fwrite failed");
05946     }
05947
05948     switch_to_user (buf);
05949
05950     printf ("I LOVE YOU\n");
05951     fflush (stdout);
05952 }
05953
05954 #endif /* HAVE_GSSAPI */
05955
05956 #endif /* SERVER_SUPPORT */
05957
05958 #if defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT)
05959
05960 /* This global variable is non-zero if the user requests encryption on
05961    the command line.  */
05962 int cvsencrypt;
05963
05964 /* This global variable is non-zero if the users requests stream
05965    authentication on the command line.  */
05966 int cvsauthenticate;
05967
05968 #ifdef HAVE_GSSAPI
05969
05970 /* An buffer interface using GSSAPI.  This is built on top of a
05971    packetizing buffer.  */
05972
05973 /* This structure is the closure field of the GSSAPI translation
05974    routines.  */
05975
05976 struct cvs_gssapi_wrap_data
05977 {
05978     /* The GSSAPI context.  */
05979     gss_ctx_id_t gcontext;
05980 };
05981
05982 static int cvs_gssapi_wrap_input PROTO((void *, const char *, char *, int));
05983 static int cvs_gssapi_wrap_output PROTO((void *, const char *, char *, int,
05984                      int *));
05985
05986 /* Create a GSSAPI wrapping buffer.  We use a packetizing buffer with
05987    GSSAPI wrapping routines.  */
05988
05989 struct buffer *
05990 cvs_gssapi_wrap_buffer_initialize (buf, input, gcontext, memory)
05991      struct buffer *buf;
05992      int input;
05993      gss_ctx_id_t gcontext;
05994      void (*memory) PROTO((struct buffer *));
05995 {
05996     struct cvs_gssapi_wrap_data *gd;
05997
05998     gd = (struct cvs_gssapi_wrap_data *) xmalloc (sizeof *gd);
05999     gd->gcontext = gcontext;
06000
06001     return (packetizing_buffer_initialize
06002         (buf,
06003          input ? cvs_gssapi_wrap_input : NULL,
06004          input ? NULL : cvs_gssapi_wrap_output,
06005          gd,
06006          memory));
06007 }
06008
06009 /* Unwrap data using GSSAPI.  */
06010
06011 static int
06012 cvs_gssapi_wrap_input (fnclosure, input, output, size)
06013      void *fnclosure;
06014      const char *input;
06015      char *output;
06016      int size;
06017 {
06018     struct cvs_gssapi_wrap_data *gd =
06019     (struct cvs_gssapi_wrap_data *) fnclosure;
06020     gss_buffer_desc inbuf, outbuf;
06021     OM_uint32 stat_min;
06022     int conf;
06023
06024     inbuf.value = (void *) input;
06025     inbuf.length = size;
06026
06027     if (gss_unwrap (&stat_min, gd->gcontext, &inbuf, &outbuf, &conf, NULL)
06028     != GSS_S_COMPLETE)
06029     {
06030     error (1, 0, "gss_unwrap failed");
06031     }
06032
06033     if (outbuf.length > size)
06034     abort ();
06035
06036     memcpy (output, outbuf.value, outbuf.length);
06037
06038     /* The real packet size is stored in the data, so we don't need to
06039        remember outbuf.length.  */
06040
06041     gss_release_buffer (&stat_min, &outbuf);
06042
06043     return 0;
06044 }
06045
06046 /* Wrap data using GSSAPI.  */
06047
06048 static int
06049 cvs_gssapi_wrap_output (fnclosure, input, output, size, translated)
06050      void *fnclosure;
06051      const char *input;
06052      char *output;
06053      int size;
06054      int *translated;
06055 {
06056     struct cvs_gssapi_wrap_data *gd =
06057     (struct cvs_gssapi_wrap_data *) fnclosure;
06058     gss_buffer_desc inbuf, outbuf;
06059     OM_uint32 stat_min;
06060     int conf_req, conf;
06061
06062     inbuf.value = (void *) input;
06063     inbuf.length = size;
06064
06065 #ifdef ENCRYPTION
06066     conf_req = cvs_gssapi_encrypt;
06067 #else
06068     conf_req = 0;
06069 #endif
06070
06071     if (gss_wrap (&stat_min, gd->gcontext, conf_req, GSS_C_QOP_DEFAULT,
06072           &inbuf, &conf, &outbuf) != GSS_S_COMPLETE)
06073     error (1, 0, "gss_wrap failed");
06074
06075     /* The packetizing buffer only permits us to add 100 bytes.
06076        FIXME: I don't know what, if anything, is guaranteed by GSSAPI.
06077        This may need to be increased for a different GSSAPI
06078        implementation, or we may need a different algorithm.  */
06079     if (outbuf.length > size + 100)
06080     abort ();
06081
06082     memcpy (output, outbuf.value, outbuf.length);
06083
06084     *translated = outbuf.length;
06085
06086     gss_release_buffer (&stat_min, &outbuf);
06087
06088     return 0;
06089 }
06090
06091 #endif /* HAVE_GSSAPI */
06092
06093 #ifdef ENCRYPTION
06094
06095 #ifdef HAVE_KERBEROS
06096
06097 /* An encryption interface using Kerberos.  This is built on top of a
06098    packetizing buffer.  */
06099
06100 /* This structure is the closure field of the Kerberos translation
06101    routines.  */
06102
06103 struct krb_encrypt_data
06104 {
06105     /* The Kerberos key schedule.  */
06106     Key_schedule sched;
06107     /* The Kerberos DES block.  */
06108     C_Block block;
06109 };
06110
06111 static int krb_encrypt_input PROTO((void *, const char *, char *, int));
06112 static int krb_encrypt_output PROTO((void *, const char *, char *, int,
06113                      int *));
06114
06115 /* Create a Kerberos encryption buffer.  We use a packetizing buffer
06116    with Kerberos encryption translation routines.  */
06117
06118 struct buffer *
06119 krb_encrypt_buffer_initialize (buf, input, sched, block, memory)
06120      struct buffer *buf;
06121      int input;
06122      Key_schedule sched;
06123      C_Block block;
06124      void (*memory) PROTO((struct buffer *));
06125 {
06126     struct krb_encrypt_data *kd;
06127
06128     kd = (struct krb_encrypt_data *) xmalloc (sizeof *kd);
06129     memcpy (kd->sched, sched, sizeof (Key_schedule));
06130     memcpy (kd->block, block, sizeof (C_Block));
06131
06132     return packetizing_buffer_initialize (buf,
06133                       input ? krb_encrypt_input : NULL,
06134                       input ? NULL : krb_encrypt_output,
06135                       kd,
06136                       memory);
06137 }
06138
06139 /* Decrypt Kerberos data.  */
06140
06141 static int
06142 krb_encrypt_input (fnclosure, input, output, size)
06143      void *fnclosure;
06144      const char *input;
06145      char *output;
06146      int size;
06147 {
06148     struct krb_encrypt_data *kd = (struct krb_encrypt_data *) fnclosure;
06149     int tcount;
06150
06151     des_cbc_encrypt ((C_Block *) input, (C_Block *) output,
06152              size, kd->sched, &kd->block, 0);
06153
06154     /* SIZE is the size of the buffer, which is set by the encryption
06155        routine.  The packetizing buffer will arrange for the first two
06156        bytes in the decrypted buffer to be the real (unaligned)
06157        length.  As a safety check, make sure that the length in the
06158        buffer corresponds to SIZE.  Note that the length in the buffer
06159        is just the length of the data.  We must add 2 to account for
06160        the buffer count itself.  */
06161     tcount = ((output[0] & 0xff) << 8) + (output[1] & 0xff);
06162     if (((tcount + 2 + 7) & ~7) != size)
06163       error (1, 0, "Decryption failure");
06164
06165     return 0;
06166 }
06167
06168 /* Encrypt Kerberos data.  */
06169
06170 static int
06171 krb_encrypt_output (fnclosure, input, output, size, translated)
06172      void *fnclosure;
06173      const char *input;
06174      char *output;
06175      int size;
06176      int *translated;
06177 {
06178     struct krb_encrypt_data *kd = (struct krb_encrypt_data *) fnclosure;
06179     int aligned;
06180
06181     /* For security against a known plaintext attack, we should
06182        initialize any padding bytes to random values.  Instead, we
06183        just pick up whatever is on the stack, which is at least better
06184        than using zero.  */
06185
06186     /* Align SIZE to an 8 byte boundary.  Note that SIZE includes the
06187        two byte buffer count at the start of INPUT which was added by
06188        the packetizing buffer.  */
06189     aligned = (size + 7) & ~7;
06190
06191     /* We use des_cbc_encrypt rather than krb_mk_priv because the
06192        latter sticks a timestamp in the block, and krb_rd_priv expects
06193        that timestamp to be within five minutes of the current time.
06194        Given the way the CVS server buffers up data, that can easily
06195        fail over a long network connection.  We trust krb_recvauth to
06196        guard against a replay attack.  */
06197
06198     des_cbc_encrypt ((C_Block *) input, (C_Block *) output, aligned,
06199              kd->sched, &kd->block, 1);
06200
06201     *translated = aligned;
06202
06203     return 0;
06204 }
06205
06206 #endif /* HAVE_KERBEROS */
06207 #endif /* ENCRYPTION */
06208 #endif /* defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT) */
06209
06210 /* Output LEN bytes at STR.  If LEN is zero, then output up to (not including)
06211    the first '\0' byte.  */
06212
06213 void
06214 cvs_output (str, len)
06215     const char *str;
06216     size_t len;
06217 {
06218     if (len == 0)
06219     len = strlen (str);
06220 #ifdef SERVER_SUPPORT
06221     if (error_use_protocol)
06222     {
06223     buf_output (saved_output, str, len);
06224     buf_copy_lines (buf_to_net, saved_output, 'M');
06225     }
06226     else if (server_active)
06227     {
06228     buf_output (saved_output, str, len);
06229     buf_copy_lines (protocol, saved_output, 'M');
06230     buf_send_counted (protocol);
06231     }
06232     else
06233 #endif
06234 #ifdef CVSGUI_PIPE
06235     if(_cvsgui_writefd != 0)
06236         gp_console_write (_cvsgui_writefd, str, len, 0);
06237     else
06238 #endif
06239     {
06240     size_t written;
06241     size_t to_write = len;
06242     const char *p = str;
06243
06244     /* For symmetry with cvs_outerr we would call fflush (stderr)
06245        here.  I guess the assumption is that stderr will be
06246        unbuffered, so we don't need to.  That sounds like a sound
06247        assumption from the manpage I looked at, but if there was
06248        something fishy about it, my guess is that calling fflush
06249        would not produce a significant performance problem.  */
06250
06251     while (to_write > 0)
06252     {
06253         written = fwrite (p, 1, to_write, stdout);
06254         if (written == 0)
06255         break;
06256         p += written;
06257         to_write -= written;
06258     }
06259     }
06260 }
06261
06262 /* Output LEN bytes at STR in binary mode.  If LEN is zero, then
06263    output zero bytes.  */
06264
06265 void
06266 cvs_output_binary (str, len)
06267     char *str;
06268     size_t len;
06269 {
06270 #ifdef SERVER_SUPPORT
06271     if (error_use_protocol || server_active)
06272     {
06273     struct buffer *buf;
06274     char size_text[40];
06275
06276     if (error_use_protocol)
06277         buf = buf_to_net;
06278     else
06279         buf = protocol;
06280
06281     if (!supported_response ("Mbinary"))
06282     {
06283         error (0, 0, "\
06284 this client does not support writing binary files to stdout");
06285         return;
06286     }
06287
06288     buf_output0 (buf, "Mbinary\012");
06289     sprintf (size_text, "%lu\012", (unsigned long) len);
06290     buf_output0 (buf, size_text);
06291
06292     /* Not sure what would be involved in using buf_append_data here
06293        without stepping on the toes of our caller (which is responsible
06294        for the memory allocation of STR).  */
06295     buf_output (buf, str, len);
06296
06297     if (!error_use_protocol)
06298         buf_send_counted (protocol);
06299     }
06300     else
06301 #endif
06302 #ifdef CVSGUI_PIPE
06303     if(_cvsgui_writefd != 0)
06304         gp_console_write (_cvsgui_writefd, str, len, 0);
06305     else
06306 #endif
06307     {
06308     size_t written;
06309     size_t to_write = len;
06310     const char *p = str;
06311
06312     /* For symmetry with cvs_outerr we would call fflush (stderr)
06313        here.  I guess the assumption is that stderr will be
06314        unbuffered, so we don't need to.  That sounds like a sound
06315        assumption from the manpage I looked at, but if there was
06316        something fishy about it, my guess is that calling fflush
06317        would not produce a significant performance problem.  */
06318 #ifdef USE_SETMODE_STDOUT
06319     int oldmode;
06320
06321     /* It is possible that this should be the same ifdef as
06322        USE_SETMODE_BINARY but at least for the moment we keep them
06323        separate.  Mostly this is just laziness and/or a question
06324        of what has been tested where.  Also there might be an
06325        issue of setmode vs. _setmode.  */
06326     /* The Windows doc says to call setmode only right after startup.
06327        I assume that what they are talking about can also be helped
06328        by flushing the stream before changing the mode.  */
06329     fflush (stdout);
06330     oldmode = _setmode (_fileno (stdout), OPEN_BINARY);
06331     if (oldmode < 0)
06332         error (0, errno, "failed to setmode on stdout");
06333 #endif
06334
06335     while (to_write > 0)
06336     {
06337         written = fwrite (p, 1, to_write, stdout);
06338         if (written == 0)
06339         break;
06340         p += written;
06341         to_write -= written;
06342     }
06343 #ifdef USE_SETMODE_STDOUT
06344     fflush (stdout);
06345     if (_setmode (_fileno (stdout), oldmode) != OPEN_BINARY)
06346         error (0, errno, "failed to setmode on stdout");
06347 #endif
06348     }
06349 }
06350
06351 /* Like CVS_OUTPUT but output is for stderr not stdout.  */
06352
06353 void
06354 cvs_outerr (str, len)
06355     const char *str;
06356     size_t len;
06357 {
06358     if (len == 0)
06359     len = strlen (str);
06360 #ifdef SERVER_SUPPORT
06361     if (error_use_protocol)
06362     {
06363     buf_output (saved_outerr, str, len);
06364     buf_copy_lines (buf_to_net, saved_outerr, 'E');
06365     }
06366     else if (server_active)
06367     {
06368     buf_output (saved_outerr, str, len);
06369     buf_copy_lines (protocol, saved_outerr, 'E');
06370     buf_send_counted (protocol);
06371     }
06372     else
06373 #endif
06374 #ifdef CVSGUI_PIPE
06375     if(_cvsgui_writefd != 0)
06376         gp_console_write (_cvsgui_writefd, str, len, 1);
06377     else
06378 #endif
06379     {
06380     size_t written;
06381     size_t to_write = len;
06382     const char *p = str;
06383
06384     /* Make sure that output appears in order if stdout and stderr
06385        point to the same place.  For the server case this is taken
06386        care of by the fact that saved_outerr always holds less
06387        than a line.  */
06388     fflush (stdout);
06389
06390     while (to_write > 0)
06391     {
06392         written = fwrite (p, 1, to_write, stderr);
06393         if (written == 0)
06394         break;
06395         p += written;
06396         to_write -= written;
06397     }
06398     }
06399 }
06400
06401 /* Flush stderr.  stderr is normally flushed automatically, of course,
06402    but this function is used to flush information from the server back
06403    to the client.  */
06404
06405 void
06406 cvs_flusherr ()
06407 {
06408 #ifdef SERVER_SUPPORT
06409     if (error_use_protocol)
06410     {
06411     /* Flush what we can to the network, but don't block.  */
06412     buf_flush (buf_to_net, 0);
06413     }
06414     else if (server_active)
06415     {
06416     /* Send a special count to tell the parent to flush.  */
06417     buf_send_special_count (protocol, -1);
06418     }
06419     else
06420 #endif
06421     fflush (stderr);
06422 }
06423
06424 /* Make it possible for the user to see what has been written to
06425    stdout (it is up to the implementation to decide exactly how far it
06426    should go to ensure this).  */
06427
06428 void
06429 cvs_flushout ()
06430 {
06431 #ifdef SERVER_SUPPORT
06432     if (error_use_protocol)
06433     {
06434     /* Flush what we can to the network, but don't block.  */
06435     buf_flush (buf_to_net, 0);
06436     }
06437     else if (server_active)
06438     {
06439     /* Just do nothing.  This is because the code which
06440        cvs_flushout replaces, setting stdout to line buffering in
06441        main.c, didn't get called in the server child process.  But
06442        in the future it is quite plausible that we'll want to make
06443        this case work analogously to cvs_flusherr.  */
06444     }
06445     else
06446 #endif
06447     fflush (stdout);
06448 }
06449
06450 /* Output TEXT, tagging it according to TAG.  There are lots more
06451    details about what TAG means in cvsclient.texi but for the simple
06452    case (e.g. non-client/server), TAG is just "newline" to output a
06453    newline (in which case TEXT must be NULL), and any other tag to
06454    output normal text.
06455
06456    Note that there is no way to output either \0 or \n as part of TEXT.  */
06457
06458 void
06459 cvs_output_tagged (tag, text)
06460     char *tag;
06461     char *text;
06462 {
06463     if (text != NULL && strchr (text, '\n') != NULL)
06464     /* Uh oh.  The protocol has no way to cope with this.  For now
06465        we dump core, although that really isn't such a nice
06466        response given that this probably can be caused by newlines
06467        in filenames and other causes other than bugs in CVS.  Note
06468        that we don't want to turn this into "MT newline" because
06469        this case is a newline within a tagged item, not a newline
06470        as extraneous sugar for the user.  */
06471     assert (0);
06472
06473     /* Start and end tags don't take any text, per cvsclient.texi.  */
06474     if (tag[0] == '+' || tag[0] == '-')
06475     assert (text == NULL);
06476
06477 #ifdef SERVER_SUPPORT
06478     if (server_active && supported_response ("MT"))
06479     {
06480     struct buffer *buf;
06481
06482     if (error_use_protocol)
06483         buf = buf_to_net;
06484     else
06485         buf = protocol;
06486
06487     buf_output0 (buf, "MT ");
06488     buf_output0 (buf, tag);
06489     if (text != NULL)
06490     {
06491         buf_output (buf, " ", 1);
06492         buf_output0 (buf, text);
06493     }
06494     buf_output (buf, "\n", 1);
06495
06496     if (!error_use_protocol)
06497         buf_send_counted (protocol);
06498     }
06499     else
06500 #endif
06501     {
06502     if (strcmp (tag, "newline") == 0)
06503         cvs_output ("\n", 1);
06504     else if (text != NULL)
06505         cvs_output (text, 0);
06506     }
06507 }
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/server.h Source File

cvs-1.10/src/server.h

Go to the documentation of this file.
00001 /* Interface between the server and the rest of CVS.  */
00002
00003 /* Miscellaneous stuff which isn't actually particularly server-specific.  */
00004 #ifndef STDIN_FILENO
00005 #define STDIN_FILENO 0
00006 #define STDOUT_FILENO 1
00007 #define STDERR_FILENO 2
00008 #endif
00009
00010
00011 /*
00012  * Expand to `S', ` ', or the empty string.  Used in `%s-> ...' trace printfs.
00013  */
00014 #ifdef SERVER_SUPPORT
00015 # define CLIENT_SERVER_STR ((server_active) ? "S" : " ")
00016 #else
00017 # define CLIENT_SERVER_STR ""
00018 #endif
00019
00020 #ifdef SERVER_SUPPORT
00021
00022 /*
00023  * Nonzero if we are using the server.  Used by various places to call
00024  * server-specific functions.
00025  */
00026 extern int server_active;
00027 extern int server_expanding;
00028
00029 /* Server functions exported to the rest of CVS.  */
00030
00031 /* Run the server.  */
00032 extern int server PROTO((int argc, char **argv));
00033
00034 /* See server.c for description.  */
00035 extern void server_pathname_check PROTO ((char *));
00036
00037 /* We have a new Entries line for a file.  TAG or DATE can be NULL.  */
00038 extern void server_register
00039     PROTO((char *name, char *version, char *timestamp,
00040          char *options, char *tag, char *date, char *conflict));
00041
00042 /* Set the modification time of the next file sent.  This must be
00043    followed by a call to server_updated on the same file.  */
00044 extern void server_modtime PROTO ((struct file_info *finfo,
00045                    Vers_TS *vers_ts));
00046
00047 /*
00048  * We want to nuke the Entries line for a file, and (unless
00049  * server_scratch_entry_only is subsequently called) the file itself.
00050  */
00051 extern void server_scratch PROTO((char *name));
00052
00053 /*
00054  * The file which just had server_scratch called on it needs to have only
00055  * the Entries line removed, not the file itself.
00056  */
00057 extern void server_scratch_entry_only PROTO((void));
00058
00059 /*
00060  * We just successfully checked in FILE (which is just the bare
00061  * filename, with no directory).  REPOSITORY is the directory for the
00062  * repository.
00063  */
00064 extern void server_checked_in
00065     PROTO((char *file, char *update_dir, char *repository));
00066
00067 extern void server_copy_file
00068     PROTO((char *file, char *update_dir, char *repository, char *newfile));
00069
00070 /* Send the appropriate responses for a file described by FINFO and
00071    VERS.  This is called after server_register or server_scratch.  In
00072    the latter case the file is to be removed (and VERS can be NULL).
00073    In the former case, VERS must be non-NULL, and UPDATED indicates
00074    whether the file is now up to date (SERVER_UPDATED, yes,
00075    SERVER_MERGED, no, SERVER_PATCHED, yes, but file is a diff from
00076    user version to repository version, SERVER_RCS_DIFF, yes, like
00077    SERVER_PATCHED but with an RCS style diff).  MODE is the mode the
00078    file should get, or (mode_t) -1 if this should be obtained from the
00079    file itself.  CHECKSUM is the MD5 checksum of the file, or NULL if
00080    this need not be sent.  If FILEBUF is not NULL, it holds the
00081    contents of the file, in which case the file itself may not exist.
00082    If FILEBUF is not NULL, server_updated will free it.  */
00083 enum server_updated_arg4
00084 {
00085     SERVER_UPDATED,
00086     SERVER_MERGED,
00087     SERVER_PATCHED,
00088     SERVER_RCS_DIFF
00089 };
00090 #ifdef __STDC__
00091 struct buffer;
00092 #endif
00093
00094 extern void server_updated
00095     PROTO((struct file_info *finfo, Vers_TS *vers,
00096        enum server_updated_arg4 updated, mode_t mode,
00097        unsigned char *checksum, struct buffer *filebuf));
00098
00099 /* Whether we should send RCS format patches.  */
00100 extern int server_use_rcs_diff PROTO((void));
00101
00102 /* Set the Entries.Static flag.  */
00103 extern void server_set_entstat PROTO((char *update_dir, char *repository));
00104 /* Clear it.  */
00105 extern void server_clear_entstat PROTO((char *update_dir, char *repository));
00106
00107 /* Set or clear a per-directory sticky tag or date.  */
00108 extern void server_set_sticky PROTO((char *update_dir, char *repository,
00109                      char *tag, char *date, int nonbranch));
00110 /* Send Template response.  */
00111 extern void server_template PROTO ((char *, char *));
00112
00113 extern void server_update_entries
00114     PROTO((char *file, char *update_dir, char *repository,
00115        enum server_updated_arg4 updated));
00116
00117 /* Pointer to a malloc'd string which is the directory which
00118    the server should prepend to the pathnames which it sends
00119    to the client.  */
00120 extern char *server_dir;
00121
00122 enum progs {PROG_CHECKIN, PROG_UPDATE};
00123 extern void server_prog PROTO((char *, char *, enum progs));
00124 extern void server_cleanup PROTO((int sig));
00125
00126 #ifdef SERVER_FLOWCONTROL
00127 /* Pause if it's convenient to avoid memory blowout */
00128 extern void server_pause_check PROTO((void));
00129 #endif /* SERVER_FLOWCONTROL */
00130
00131 #ifdef AUTH_SERVER_SUPPORT
00132 extern char *CVS_Username;
00133 extern int system_auth;
00134 #endif /* AUTH_SERVER_SUPPORT */
00135
00136 #endif /* SERVER_SUPPORT */
00137
00138 /* Stuff shared with the client.  */
00139 struct request
00140 {
00141   /* Name of the request.  */
00142   char *name;
00143
00144 #ifdef SERVER_SUPPORT
00145   /*
00146    * Function to carry out the request.  ARGS is the text of the command
00147    * after name and, if present, a single space, have been stripped off.
00148    */
00149   void (*func) PROTO((char *args));
00150 #endif
00151
00152   /* One or more of the RQ_* flags described below.  */
00153   int flags;
00154
00155   /* If set, failure to implement this request can imply a fatal
00156      error.  This should be set only for commands which were in the
00157      original version of the protocol; it should not be set for new
00158      commands.  */
00159 #define RQ_ESSENTIAL 1
00160
00161   /* Set by the client if the server we are talking to supports it.  */
00162 #define RQ_SUPPORTED 2
00163
00164   /* If set, and client and server both support the request, the
00165      client should tell the server by making the request.  */
00166 #define RQ_ENABLEME 4
00167
00168   /* The server may accept this request before "Root".  */
00169 #define RQ_ROOTLESS 8
00170 };
00171
00172 /* Table of requests ending with an entry with a NULL name.  */
00173 extern struct request requests[];
00174
00175 /* Gzip library, see zlib.c.  */
00176 extern int gunzip_and_write PROTO ((int, char *, unsigned char *, size_t));
00177 extern int read_and_gzip PROTO ((int, char *, unsigned char **, size_t *,
00178                  size_t *, int));
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/status.c Source File

cvs-1.10/src/status.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Status Information
00009  */
00010
00011 #include "cvs.h"
00012
00013 static Dtype status_dirproc PROTO ((void *callerdat, char *dir,
00014                     char *repos, char *update_dir,
00015                     List *entries));
00016 static int status_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00017 static int tag_list_proc PROTO((Node * p, void *closure));
00018
00019 static int local = 0;
00020 static int long_format = 0;
00021 static RCSNode *xrcsnode;
00022
00023 static const char *const status_usage[] =
00024 {
00025     "Usage: %s %s [-vlR] [files...]\n",
00026     "\t-v\tVerbose format; includes tag information for the file\n",
00027     "\t-l\tProcess this directory only (not recursive).\n",
00028     "\t-R\tProcess directories recursively.\n",
00029     "(Specify the --help global option for a list of other help options)\n",
00030     NULL
00031 };
00032
00033 int
00034 cvsstatus (argc, argv)
00035     int argc;
00036     char **argv;
00037 {
00038     int c;
00039     int err = 0;
00040
00041     if (argc == -1)
00042     usage (status_usage);
00043
00044     optind = 0;
00045     while ((c = getopt (argc, argv, "+vlR")) != -1)
00046     {
00047     switch (c)
00048     {
00049         case 'v':
00050         long_format = 1;
00051         break;
00052         case 'l':
00053         local = 1;
00054         break;
00055         case 'R':
00056         local = 0;
00057         break;
00058         case '?':
00059         default:
00060         usage (status_usage);
00061         break;
00062     }
00063     }
00064     argc -= optind;
00065     argv += optind;
00066
00067     wrap_setup ();
00068
00069 #ifdef CLIENT_SUPPORT
00070     if (client_active)
00071     {
00072     start_server ();
00073
00074     ign_setup ();
00075
00076     if (long_format)
00077         send_arg("-v");
00078     if (local)
00079         send_arg("-l");
00080
00081     /* For a while, we tried setting SEND_NO_CONTENTS here so this
00082        could be a fast operation.  That prevents the
00083        server from updating our timestamp if the timestamp is
00084        changed but the file is unmodified.  Worse, it is user-visible
00085        (shows "locally modified" instead of "up to date" if
00086        timestamp is changed but file is not).  And there is no good
00087        workaround (you might not want to run "cvs update"; "cvs -n
00088        update" doesn't update CVS/Entries; "cvs diff --brief" or
00089        something perhaps could be made to work but somehow that
00090        seems nonintuitive to me even if so).  Given that timestamps
00091        seem to have the potential to get munged for any number of
00092        reasons, it seems better to not rely too much on them.  */
00093
00094     send_files (argc, argv, local, 0, 0);
00095
00096     send_file_names (argc, argv, SEND_EXPAND_WILD);
00097
00098     send_to_server ("status\012", 0);
00099     err = get_responses_and_close ();
00100
00101     return err;
00102     }
00103 #endif
00104
00105     /* start the recursion processor */
00106     err = start_recursion (status_fileproc, (FILESDONEPROC) NULL,
00107                status_dirproc, (DIRLEAVEPROC) NULL, NULL,
00108                argc, argv, local,
00109                W_LOCAL, 0, 1, (char *) NULL, 1);
00110
00111     return (err);
00112 }
00113
00114 /*
00115  * display the status of a file
00116  */
00117 /* ARGSUSED */
00118 static int
00119 status_fileproc (callerdat, finfo)
00120     void *callerdat;
00121     struct file_info *finfo;
00122 {
00123     Ctype status;
00124     char *sstat;
00125     Vers_TS *vers;
00126
00127     status = Classify_File (finfo, (char *) NULL, (char *) NULL, (char *) NULL,
00128                 1, 0, &vers, 0);
00129     sstat = "Classify Error";
00130     switch (status)
00131     {
00132     case T_UNKNOWN:
00133         sstat = "Unknown";
00134         break;
00135     case T_CHECKOUT:
00136         sstat = "Needs Checkout";
00137         break;
00138 #ifdef SERVER_SUPPORT
00139     case T_PATCH:
00140         sstat = "Needs Patch";
00141         break;
00142 #endif
00143     case T_CONFLICT:
00144         /* I _think_ that "unresolved" is correct; that if it has
00145            been resolved then the status will change.  But I'm not
00146            sure about that.  */
00147         sstat = "Unresolved Conflict";
00148         break;
00149     case T_ADDED:
00150         sstat = "Locally Added";
00151         break;
00152     case T_REMOVED:
00153         sstat = "Locally Removed";
00154         break;
00155     case T_MODIFIED:
00156         if (vers->ts_conflict)
00157         sstat = "File had conflicts on merge";
00158         else
00159         sstat = "Locally Modified";
00160         break;
00161     case T_REMOVE_ENTRY:
00162         sstat = "Entry Invalid";
00163         break;
00164     case T_UPTODATE:
00165         sstat = "Up-to-date";
00166         break;
00167     case T_NEEDS_MERGE:
00168         sstat = "Needs Merge";
00169         break;
00170     case T_TITLE:
00171         /* I don't think this case can occur here.  Just print
00172            "Classify Error".  */
00173         break;
00174     }
00175
00176     cvs_output ("\
00177 ===================================================================\n", 0);
00178     if (vers->ts_user == NULL)
00179     {
00180     cvs_output ("File: no file ", 0);
00181     cvs_output (finfo->file, 0);
00182     cvs_output ("\t\tStatus: ", 0);
00183     cvs_output (sstat, 0);
00184     cvs_output ("\n\n", 0);
00185     }
00186     else
00187     {
00188     char *buf;
00189     buf = xmalloc (strlen (finfo->file) + strlen (sstat) + 80);
00190     sprintf (buf, "File: %-17s\tStatus: %s\n\n", finfo->file, sstat);
00191     cvs_output (buf, 0);
00192     free (buf);
00193     }
00194
00195     if (vers->vn_user == NULL)
00196     {
00197     cvs_output ("   Working revision:\tNo entry for ", 0);
00198     cvs_output (finfo->file, 0);
00199     cvs_output ("\n", 0);
00200     }
00201     else if (vers->vn_user[0] == '0' && vers->vn_user[1] == '\0')
00202     cvs_output ("   Working revision:\tNew file!\n", 0);
00203 #ifdef SERVER_SUPPORT
00204     else if (server_active)
00205     {
00206     cvs_output ("   Working revision:\t", 0);
00207     cvs_output (vers->vn_user, 0);
00208     cvs_output ("\n", 0);
00209     }
00210 #endif
00211     else
00212     {
00213     cvs_output ("   Working revision:\t", 0);
00214     cvs_output (vers->vn_user, 0);
00215     cvs_output ("\t", 0);
00216     cvs_output (vers->ts_rcs, 0);
00217     cvs_output ("\n", 0);
00218     }
00219
00220     if (vers->vn_rcs == NULL)
00221     cvs_output ("   Repository revision:\tNo revision control file\n", 0);
00222     else
00223     {
00224     cvs_output ("   Repository revision:\t", 0);
00225     cvs_output (vers->vn_rcs, 0);
00226     cvs_output ("\t", 0);
00227     cvs_output (vers->srcfile->path, 0);
00228     cvs_output ("\n", 0);
00229     }
00230
00231     if (vers->entdata)
00232     {
00233     Entnode *edata;
00234
00235     edata = vers->entdata;
00236     if (edata->tag)
00237     {
00238         if (vers->vn_rcs == NULL)
00239         {
00240         cvs_output ("   Sticky Tag:\t\t", 0);
00241         cvs_output (edata->tag, 0);
00242         cvs_output (" - MISSING from RCS file!\n", 0);
00243         }
00244         else
00245         {
00246         if (isdigit ((unsigned char) edata->tag[0]))
00247         {
00248             cvs_output ("   Sticky Tag:\t\t", 0);
00249             cvs_output (edata->tag, 0);
00250             cvs_output ("\n", 0);
00251         }
00252         else
00253         {
00254             char *branch = NULL;
00255
00256             if (RCS_nodeisbranch (finfo->rcs, edata->tag))
00257             branch = RCS_whatbranch(finfo->rcs, edata->tag);
00258
00259             cvs_output ("   Sticky Tag:\t\t", 0);
00260             cvs_output (edata->tag, 0);
00261             cvs_output (" (", 0);
00262             cvs_output (branch ? "branch" : "revision", 0);
00263             cvs_output (": ", 0);
00264             cvs_output (branch ? branch : vers->vn_rcs, 0);
00265             cvs_output (")\n", 0);
00266
00267             if (branch)
00268             free (branch);
00269         }
00270         }
00271     }
00272     else if (!really_quiet)
00273         cvs_output ("   Sticky Tag:\t\t(none)\n", 0);
00274
00275     if (edata->date)
00276     {
00277         cvs_output ("   Sticky Date:\t\t", 0);
00278         cvs_output (edata->date, 0);
00279         cvs_output ("\n", 0);
00280     }
00281     else if (!really_quiet)
00282         cvs_output ("   Sticky Date:\t\t(none)\n", 0);
00283
00284     if (edata->options && edata->options[0])
00285     {
00286         cvs_output ("   Sticky Options:\t", 0);
00287         cvs_output (edata->options, 0);
00288         cvs_output ("\n", 0);
00289     }
00290     else if (!really_quiet)
00291         cvs_output ("   Sticky Options:\t(none)\n", 0);
00292     }
00293
00294     if (long_format && vers->srcfile)
00295     {
00296     List *symbols = RCS_symbols(vers->srcfile);
00297
00298     cvs_output ("\n   Existing Tags:\n", 0);
00299     if (symbols)
00300     {
00301         xrcsnode = finfo->rcs;
00302         (void) walklist (symbols, tag_list_proc, NULL);
00303     }
00304     else
00305         cvs_output ("\tNo Tags Exist\n", 0);
00306     }
00307
00308     cvs_output ("\n", 0);
00309     freevers_ts (&vers);
00310     return (0);
00311 }
00312
00313 /*
00314  * Print a warm fuzzy message
00315  */
00316 /* ARGSUSED */
00317 static Dtype
00318 status_dirproc (callerdat, dir, repos, update_dir, entries)
00319     void *callerdat;
00320     char *dir;
00321     char *repos;
00322     char *update_dir;
00323     List *entries;
00324 {
00325     if (!quiet)
00326     error (0, 0, "Examining %s", update_dir);
00327     return (R_PROCESS);
00328 }
00329
00330 /*
00331  * Print out a tag and its type
00332  */
00333 static int
00334 tag_list_proc (p, closure)
00335     Node *p;
00336     void *closure;
00337 {
00338     char *branch = NULL;
00339     char *buf;
00340
00341     if (RCS_nodeisbranch (xrcsnode, p->key))
00342     branch = RCS_whatbranch(xrcsnode, p->key) ;
00343
00344     buf = xmalloc (80 + strlen (p->key)
00345            + (branch ? strlen (branch) : strlen (p->data)));
00346     sprintf (buf, "\t%-25s\t(%s: %s)\n", p->key,
00347          branch ? "branch" : "revision",
00348          branch ? branch : p->data);
00349     cvs_output (buf, 0);
00350     free (buf);
00351
00352     if (branch)
00353     free (branch);
00354
00355     return (0);
00356 }
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/subr.c Source File

cvs-1.10/src/subr.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Various useful functions for the CVS support code.
00009  */
00010
00011 #include "cvs.h"
00012 #include "getline.h"
00013
00014 extern char *getlogin ();
00015
00016 /*
00017  * malloc some data and die if it fails
00018  */
00019 #ifndef CVSGUI_SHL
00020 void *
00021 xmalloc (bytes)
00022     size_t bytes;
00023 #else /* CVSGUI_SHL */
00024 #   if qCvsDebug
00025 void *xmalloc_glue (size_t bytes, int line, const char *file)
00026 #   else /* !qCvsDebug */
00027 void * xmalloc (size_t bytes)
00028 #   endif /* !qCvsDebug */
00029 #endif /* CVSGUI_SHL */
00030 {
00031     char *cp;
00032
00033     /* Parts of CVS try to xmalloc zero bytes and then free it.  Some
00034        systems have a malloc which returns NULL for zero byte
00035        allocations but a free which can't handle NULL, so compensate. */
00036     if (bytes == 0)
00037     bytes = 1;
00038
00039 #ifndef CVSGUI_SHL
00040     cp = malloc (bytes);
00041 #else /* CVSGUI_SHL */
00042 #   if qCvsDebug
00043     cp = shl_malloc(bytes, line, file);
00044 #   else /* !qCvsDebug */
00045     cp = malloc(bytes);
00046 #   endif /* !qCvsDebug */
00047 #endif /* CVSGUI_SHL */
00048     if (cp == NULL)
00049     {
00050     char buf[80];
00051     sprintf (buf, "out of memory; can not allocate %lu bytes",
00052          (unsigned long) bytes);
00053     error (1, 0, buf);
00054     }
00055     return (cp);
00056 }
00057
00058 /*
00059  * realloc data and die if it fails [I've always wanted to have "realloc" do
00060  * a "malloc" if the argument is NULL, but you can't depend on it.  Here, I
00061  * can *force* it.
00062  */
00063 #ifndef CVSGUI_SHL
00064 void *
00065 xrealloc (ptr, bytes)
00066     void *ptr;
00067     size_t bytes;
00068 #else /* CVSGUI_SHL */
00069 #   if qCvsDebug
00070 void *xrealloc_glue (void *ptr, size_t bytes, int line, const char *file)
00071 #   else /* !qCvsDebug */
00072 void *xrealloc (void *ptr, size_t bytes)
00073 #   endif /* !qCvsDebug */
00074 #endif /* CVSGUI_SHL */
00075 {
00076     char *cp;
00077
00078 #ifndef CVSGUI_SHL
00079     if (!ptr)
00080     cp = malloc (bytes);
00081     else
00082     cp = realloc (ptr, bytes);
00083 #else /* CVSGUI_SHL */
00084 #   if qCvsDebug
00085     if (!ptr)
00086     cp = shl_malloc (bytes, line, file);
00087     else
00088     cp = shl_realloc (ptr, bytes, line, file);
00089 #   else /* !qCvsDebug */
00090     if (!ptr)
00091     cp = malloc (bytes);
00092     else
00093     cp = realloc (ptr, bytes);
00094 #   endif /* !qCvsDebug */
00095 #endif /* CVSGUI_SHL */
00096
00097     if (cp == NULL)
00098     {
00099     char buf[80];
00100     sprintf (buf, "out of memory; can not reallocate %lu bytes",
00101          (unsigned long) bytes);
00102     error (1, 0, buf);
00103     }
00104     return (cp);
00105 }
00106
00107 /* Two constants which tune expand_string.  Having MIN_INCR as large
00108    as 1024 might waste a bit of memory, but it shouldn't be too bad
00109    (CVS used to allocate arrays of, say, 3000, PATH_MAX (8192, often),
00110    or other such sizes).  Probably anything which is going to allocate
00111    memory which is likely to get as big as MAX_INCR shouldn't be doing
00112    it in one block which must be contiguous, but since getrcskey does
00113    so, we might as well limit the wasted memory to MAX_INCR or so
00114    bytes.
00115
00116    MIN_INCR and MAX_INCR should both be powers of two and we generally
00117    try to keep our allocations to powers of two for the most part.
00118    Most malloc implementations these days tend to like that.  */
00119
00120 #define MIN_INCR 1024
00121 #define MAX_INCR (2*1024*1024)
00122
00123 /* *STRPTR is a pointer returned from malloc (or NULL), pointing to *N
00124    characters of space.  Reallocate it so that points to at least
00125    NEWSIZE bytes of space.  Gives a fatal error if out of memory;
00126    if it returns it was successful.  */
00127 void
00128 expand_string (strptr, n, newsize)
00129     char **strptr;
00130     size_t *n;
00131     size_t newsize;
00132 {
00133     if (*n < newsize)
00134     {
00135     while (*n < newsize)
00136     {
00137         if (*n < MIN_INCR)
00138         *n = MIN_INCR;
00139         else if (*n >= MAX_INCR)
00140         *n += MAX_INCR;
00141         else
00142         {
00143         *n *= 2;
00144         if (*n > MAX_INCR)
00145             *n = MAX_INCR;
00146         }
00147     }
00148     *strptr = xrealloc (*strptr, *n);
00149     }
00150 }
00151
00152 /*
00153  * Duplicate a string, calling xmalloc to allocate some dynamic space
00154  */
00155 char *
00156 xstrdup (str)
00157     const char *str;
00158 {
00159     char *s;
00160
00161     if (str == NULL)
00162     return ((char *) NULL);
00163     s = xmalloc (strlen (str) + 1);
00164     (void) strcpy (s, str);
00165     return (s);
00166 }
00167
00168 /* Remove trailing newlines from STRING, destructively. */
00169 void
00170 strip_trailing_newlines (str)
00171      char *str;
00172 {
00173     int len;
00174     len = strlen (str) - 1;
00175
00176     while (str[len] == '\n')
00177     str[len--] = '\0';
00178 }
00179
00180 /* Return the number of levels that path ascends above where it starts.
00181    For example:
00182    "../../foo" -> 2
00183    "foo/../../bar" -> 1
00184    */
00185 /* FIXME: Should be using ISDIRSEP, last_component, or some other
00186    mechanism which is more general than just looking at slashes,
00187    particularly for the client.c caller.  The server.c caller might
00188    want something different, so be careful.  */
00189 int
00190 pathname_levels (path)
00191     char *path;
00192 {
00193     char *p;
00194     char *q;
00195     int level;
00196     int max_level;
00197
00198     max_level = 0;
00199     p = path;
00200     level = 0;
00201     do
00202     {
00203     q = strchr (p, '/');
00204     if (q != NULL)
00205         ++q;
00206     if (p[0] == '.' && p[1] == '.' && (p[2] == '\0' || p[2] == '/'))
00207     {
00208         --level;
00209         if (-level > max_level)
00210         max_level = -level;
00211     }
00212     else if (p[0] == '\0' || p[0] == '/' ||
00213          (p[0] == '.' && (p[1] == '\0' || p[1] == '/')))
00214         ;
00215     else
00216         ++level;
00217     p = q;
00218     } while (p != NULL);
00219     return max_level;
00220 }
00221
00222
00223 /* Free a vector, where (*ARGV)[0], (*ARGV)[1], ... (*ARGV)[*PARGC - 1]
00224    are malloc'd and so is *ARGV itself.  Such a vector is allocated by
00225    line2argv or expand_wild, for example.  */
00226 void
00227 free_names (pargc, argv)
00228     int *pargc;
00229     char **argv;
00230 {
00231     register int i;
00232
00233     for (i = 0; i < *pargc; i++)
00234     {                   /* only do through *pargc */
00235     free (argv[i]);
00236     }
00237     free (argv);
00238     *pargc = 0;             /* and set it to zero when done */
00239 }
00240
00241 /* Convert LINE into arguments separated by SEPCHARS.  Set *ARGC
00242    to the number of arguments found, and (*ARGV)[0] to the first argument,
00243    (*ARGV)[1] to the second, etc.  *ARGV is malloc'd and so are each of
00244    (*ARGV)[0], (*ARGV)[1], ...  Use free_names() to return the memory
00245    allocated here back to the free pool.  */
00246 void
00247 line2argv (pargc, argv, line, sepchars)
00248     int *pargc;
00249     char ***argv;
00250     char *line;
00251     char *sepchars;
00252 {
00253     char *cp;
00254     /* Could make a case for size_t or some other unsigned type, but
00255        we'll stick with int to avoid signed/unsigned warnings when
00256        comparing with *pargc.  */
00257     int argv_allocated;
00258
00259     /* Small for testing.  */
00260     argv_allocated = 1;
00261     *argv = (char **) xmalloc (argv_allocated * sizeof (**argv));
00262
00263     *pargc = 0;
00264     for (cp = strtok (line, sepchars); cp; cp = strtok ((char *) NULL, sepchars))
00265     {
00266     if (*pargc == argv_allocated)
00267     {
00268         argv_allocated *= 2;
00269         *argv = xrealloc (*argv, argv_allocated * sizeof (**argv));
00270     }
00271     (*argv)[*pargc] = xstrdup (cp);
00272     (*pargc)++;
00273     }
00274 }
00275
00276 /*
00277  * Returns the number of dots ('.') found in an RCS revision number
00278  */
00279 int
00280 numdots (s)
00281     const char *s;
00282 {
00283     int dots = 0;
00284
00285     for (; *s; s++)
00286     {
00287     if (*s == '.')
00288         dots++;
00289     }
00290     return (dots);
00291 }
00292
00293 /* Compare revision numbers REV1 and REV2 by consecutive fields.
00294    Return negative, zero, or positive in the manner of strcmp.  The
00295    two revision numbers must have the same number of fields, or else
00296    compare_revnums will return an inaccurate result. */
00297 int
00298 compare_revnums (rev1, rev2)
00299     const char *rev1;
00300     const char *rev2;
00301 {
00302     const char *s, *sp;
00303     const char *t, *tp;
00304     char *snext, *tnext;
00305     int result = 0;
00306
00307     sp = s = rev1;
00308     tp = t = rev2;
00309     while (result == 0)
00310     {
00311     result = strtoul (sp, &snext, 10) - strtoul (tp, &tnext, 10);
00312     if (*snext == '\0' || *tnext == '\0')
00313         break;
00314     sp = snext + 1;
00315     tp = tnext + 1;
00316     }
00317
00318     return result;
00319 }
00320
00321 char *
00322 increment_revnum (rev)
00323     const char *rev;
00324 {
00325     char *newrev, *p;
00326     int lastfield;
00327     size_t len = strlen (rev);
00328
00329     newrev = (char *) xmalloc (len + 2);
00330     memcpy (newrev, rev, len + 1);
00331     p = strrchr (newrev, '.');
00332     if (p == NULL)
00333     {
00334     free (newrev);
00335     return NULL;
00336     }
00337     lastfield = atoi (++p);
00338     sprintf (p, "%d", lastfield + 1);
00339
00340     return newrev;
00341 }
00342
00343 /* Return the username by which the caller should be identified in
00344    CVS, in contexts such as the author field of RCS files, various
00345    logs, etc.  */
00346 char *
00347 getcaller ()
00348 {
00349 #ifndef SYSTEM_GETCALLER
00350     static char *cache;
00351     struct passwd *pw;
00352     uid_t uid;
00353 #endif
00354
00355     /* If there is a CVS username, return it.  */
00356 #ifdef AUTH_SERVER_SUPPORT
00357     if (CVS_Username != NULL)
00358     return CVS_Username;
00359 #endif
00360
00361 #ifdef SYSTEM_GETCALLER
00362     return SYSTEM_GETCALLER ();
00363 #else
00364     /* Get the caller's login from his uid.  If the real uid is "root"
00365        try LOGNAME USER or getlogin(). If getlogin() and getpwuid()
00366        both fail, return the uid as a string.  */
00367
00368     if (cache != NULL)
00369     return cache;
00370
00371     uid = getuid ();
00372     if (uid == (uid_t) 0)
00373     {
00374     char *name;
00375
00376     /* super-user; try getlogin() to distinguish */
00377     if (((name = getlogin ()) || (name = getenv("LOGNAME")) ||
00378          (name = getenv("USER"))) && *name)
00379     {
00380         cache = xstrdup (name);
00381         return cache;
00382     }
00383     }
00384     if ((pw = (struct passwd *) getpwuid (uid)) == NULL)
00385     {
00386     char uidname[20];
00387
00388     (void) sprintf (uidname, "uid%lu", (unsigned long) uid);
00389     cache = xstrdup (uidname);
00390     return cache;
00391     }
00392     cache = xstrdup (pw->pw_name);
00393     return cache;
00394 #endif
00395 }
00396
00397 #ifdef lint
00398 #ifndef __GNUC__
00399 /* ARGSUSED */
00400 time_t
00401 get_date (date, now)
00402     char *date;
00403     struct timeb *now;
00404 {
00405     time_t foo = 0;
00406
00407     return (foo);
00408 }
00409 #endif
00410 #endif
00411
00412 /* Given two revisions, find their greatest common ancestor.  If the
00413    two input revisions exist, then rcs guarantees that the gca will
00414    exist.  */
00415
00416 char *
00417 gca (rev1, rev2)
00418     const char *rev1;
00419     const char *rev2;
00420 {
00421     int dots;
00422     char *gca;
00423     const char *p[2];
00424     int j[2];
00425     char *retval;
00426
00427     if (rev1 == NULL || rev2 == NULL)
00428     {
00429     error (0, 0, "sanity failure in gca");
00430     abort();
00431     }
00432
00433     /* The greatest common ancestor will have no more dots, and numbers
00434        of digits for each component no greater than the arguments.  Therefore
00435        this string will be big enough.  */
00436     gca = xmalloc (strlen (rev1) + strlen (rev2) + 100);
00437
00438     /* walk the strings, reading the common parts. */
00439     gca[0] = '\0';
00440     p[0] = rev1;
00441     p[1] = rev2;
00442     do
00443     {
00444     int i;
00445     char c[2];
00446     char *s[2];
00447
00448     for (i = 0; i < 2; ++i)
00449     {
00450         /* swap out the dot */
00451         s[i] = strchr (p[i], '.');
00452         if (s[i] != NULL) {
00453         c[i] = *s[i];
00454         }
00455
00456         /* read an int */
00457         j[i] = atoi (p[i]);
00458
00459         /* swap back the dot... */
00460         if (s[i] != NULL) {
00461         *s[i] = c[i];
00462         p[i] = s[i] + 1;
00463         }
00464         else
00465         {
00466         /* or mark us at the end */
00467         p[i] = NULL;
00468         }
00469
00470     }
00471
00472     /* use the lowest. */
00473     (void) sprintf (gca + strlen (gca), "%d.",
00474             j[0] < j[1] ? j[0] : j[1]);
00475
00476     } while (j[0] == j[1]
00477          && p[0] != NULL
00478          && p[1] != NULL);
00479
00480     /* back up over that last dot. */
00481     gca[strlen(gca) - 1] = '\0';
00482
00483     /* numbers differ, or we ran out of strings.  we're done with the
00484        common parts.  */
00485
00486     dots = numdots (gca);
00487     if (dots == 0)
00488     {
00489     /* revisions differ in trunk major number.  */
00490
00491     char *q;
00492     const char *s;
00493
00494     s = (j[0] < j[1]) ? p[0] : p[1];
00495
00496     if (s == NULL)
00497     {
00498         /* we only got one number.  this is strange.  */
00499         error (0, 0, "bad revisions %s or %s", rev1, rev2);
00500         abort();
00501     }
00502     else
00503     {
00504         /* we have a minor number.  use it.  */
00505         q = gca + strlen (gca);
00506
00507         *q++ = '.';
00508         for ( ; *s != '.' && *s != '\0'; )
00509         *q++ = *s++;
00510
00511         *q = '\0';
00512     }
00513     }
00514     else if ((dots & 1) == 0)
00515     {
00516     /* if we have an even number of dots, then we have a branch.
00517        remove the last number in order to make it a revision.  */
00518
00519     char *s;
00520
00521     s = strrchr(gca, '.');
00522     *s = '\0';
00523     }
00524
00525     retval = xstrdup (gca);
00526     free (gca);
00527     return retval;
00528 }
00529
00530 /* Give fatal error if REV is numeric and ARGC,ARGV imply we are
00531    planning to operate on more than one file.  The current directory
00532    should be the working directory.  Note that callers assume that we
00533    will only be checking the first character of REV; it need not have
00534    '\0' at the end of the tag name and other niceties.  Right now this
00535    is only called from admin.c, but if people like the concept it probably
00536    should also be called from diff -r, update -r, get -r, and log -r.  */
00537
00538 void
00539 check_numeric (rev, argc, argv)
00540     const char *rev;
00541     int argc;
00542     char **argv;
00543 {
00544     if (rev == NULL || !isdigit ((unsigned char) *rev))
00545     return;
00546
00547     /* Note that the check for whether we are processing more than one
00548        file is (basically) syntactic; that is, we don't behave differently
00549        depending on whether a directory happens to contain only a single
00550        file or whether it contains more than one.  I strongly suspect this
00551        is the least confusing behavior.  */
00552     if (argc != 1
00553     || (!wrap_name_has (argv[0], WRAP_TOCVS) && isdir (argv[0])))
00554     {
00555     error (0, 0, "while processing more than one file:");
00556     error (1, 0, "attempt to specify a numeric revision");
00557     }
00558 }
00559
00560 /*
00561  *  Sanity checks and any required fix-up on message passed to RCS via '-m'.
00562  *  RCS 5.7 requires that a non-total-whitespace, non-null message be provided
00563  *  with '-m'.  Returns a newly allocated, non-empty buffer with whitespace
00564  *  stripped from end of lines and end of buffer.
00565  *
00566  *  TODO: We no longer use RCS to manage repository files, so maybe this
00567  *  nonsense about non-empty log fields can be dropped.
00568  */
00569 char *
00570 make_message_rcslegal (message)
00571      char *message;
00572 {
00573     char *dst, *dp, *mp;
00574
00575     if (message == NULL) message = "";
00576
00577     /* Strip whitespace from end of lines and end of string. */
00578     dp = dst = (char *) xmalloc (strlen (message) + 1);
00579     for (mp = message; *mp != '\0'; ++mp)
00580     {
00581     if (*mp == '\n')
00582     {
00583         /* At end-of-line; backtrack to last non-space. */
00584         while (dp > dst && (dp[-1] == ' ' || dp[-1] == '\t'))
00585         --dp;
00586     }
00587     *dp++ = *mp;
00588     }
00589
00590     /* Backtrack to last non-space at end of string, and truncate. */
00591     while (dp > dst && isspace ((unsigned char) dp[-1]))
00592     --dp;
00593     *dp = '\0';
00594
00595     /* After all that, if there was no non-space in the string,
00596        substitute a non-empty message. */
00597     if (*dst == '\0')
00598     {
00599     free (dst);
00600     dst = xstrdup ("*** empty log message ***");
00601     }
00602
00603     return dst;
00604 }
00605
00606 /* Does the file FINFO contain conflict markers?  The whole concept
00607    of looking at the contents of the file to figure out whether there are
00608    unresolved conflicts is kind of bogus (people do want to manage files
00609    which contain those patterns not as conflict markers), but for now it
00610    is what we do.  */
00611 int
00612 file_has_markers (finfo)
00613     const struct file_info *finfo;
00614 {
00615     FILE *fp;
00616     char *line = NULL;
00617     size_t line_allocated = 0;
00618     int result;
00619
00620     result = 0;
00621     fp = CVS_FOPEN (finfo->file, "r");
00622     if (fp == NULL)
00623     error (1, errno, "cannot open %s", finfo->fullname);
00624     while (getline (&line, &line_allocated, fp) > 0)
00625     {
00626     if (strncmp (line, RCS_MERGE_PAT_1, sizeof RCS_MERGE_PAT_1 - 1) == 0 ||
00627         strncmp (line, RCS_MERGE_PAT_2, sizeof RCS_MERGE_PAT_2 - 1) == 0 ||
00628         strncmp (line, RCS_MERGE_PAT_3, sizeof RCS_MERGE_PAT_3 - 1) == 0)
00629     {
00630         result = 1;
00631         goto out;
00632     }
00633     }
00634     if (ferror (fp))
00635     error (0, errno, "cannot read %s", finfo->fullname);
00636 out:
00637     if (fclose (fp) < 0)
00638     error (0, errno, "cannot close %s", finfo->fullname);
00639     if (line != NULL)
00640     free (line);
00641     return result;
00642 }
00643
00644 /* Read the entire contents of the file NAME into *BUF.
00645    If NAME is NULL, read from stdin.  *BUF
00646    is a pointer returned from malloc (or NULL), pointing to *BUFSIZE
00647    bytes of space.  The actual size is returned in *LEN.  On error,
00648    give a fatal error.  The name of the file to use in error messages
00649    (typically will include a directory if we have changed directory)
00650    is FULLNAME.  MODE is "r" for text or "rb" for binary.  */
00651
00652 void
00653 get_file (name, fullname, mode, buf, bufsize, len)
00654     const char *name;
00655     const char *fullname;
00656     const char *mode;
00657     char **buf;
00658     size_t *bufsize;
00659     size_t *len;
00660 {
00661     struct stat s;
00662     size_t nread;
00663     char *tobuf;
00664     FILE *e;
00665     size_t filesize;
00666
00667     if (name == NULL)
00668     {
00669     e = stdin;
00670     filesize = 100; /* force allocation of minimum buffer */
00671     }
00672     else
00673     {
00674     /* Although it would be cleaner in some ways to just read
00675        until end of file, reallocating the buffer, this function
00676        does get called on files in the working directory which can
00677        be of arbitrary size, so I think we better do all that
00678        extra allocation.  */
00679
00680     if (CVS_STAT (name, &s) < 0)
00681         error (1, errno, "can't stat %s", fullname);
00682
00683     /* Convert from signed to unsigned.  */
00684     filesize = s.st_size;
00685
00686     e = open_file (name, mode);
00687     }
00688
00689     if (*buf == NULL || *bufsize <= filesize)
00690     {
00691     *bufsize = filesize + 1;
00692     *buf = xrealloc (*buf, *bufsize);
00693     }
00694
00695     tobuf = *buf;
00696     nread = 0;
00697     while (1)
00698     {
00699     size_t got;
00700
00701     got = fread (tobuf, 1, *bufsize - (tobuf - *buf), e);
00702     if (ferror (e))
00703         error (1, errno, "can't read %s", fullname);
00704     nread += got;
00705     tobuf += got;
00706
00707     if (feof (e))
00708         break;
00709
00710     /* Allocate more space if needed.  */
00711     if (tobuf == *buf + *bufsize)
00712     {
00713         int c;
00714         long off;
00715
00716         c = getc (e);
00717         if (c == EOF)
00718         break;
00719         off = tobuf - *buf;
00720         expand_string (buf, bufsize, *bufsize + 100);
00721         tobuf = *buf + off;
00722         *tobuf++ = c;
00723         ++nread;
00724     }
00725     }
00726
00727     if (e != stdin && fclose (e) < 0)
00728     error (0, errno, "cannot close %s", fullname);
00729
00730     *len = nread;
00731
00732     /* Force *BUF to be large enough to hold a null terminator. */
00733     if (nread == *bufsize)
00734     expand_string (buf, bufsize, *bufsize + 1);
00735     (*buf)[nread] = '\0';
00736 }
00737
00738
00739 /* Follow a chain of symbolic links to its destination.  FILENAME
00740    should be a handle to a malloc'd block of memory which contains the
00741    beginning of the chain.  This routine will replace the contents of
00742    FILENAME with the destination (a real file).  */
00743
00744 void
00745 resolve_symlink (filename)
00746      char **filename;
00747 {
00748     if ((! filename) || (! *filename))
00749     return;
00750
00751     while (islink (*filename))
00752     {
00753     char *newname;
00754 #ifdef HAVE_READLINK
00755     /* The clean thing to do is probably to have each filesubr.c
00756        implement this (with an error if not supported by the
00757        platform, in which case islink would presumably return 0).
00758        But that would require editing each filesubr.c and so the
00759        expedient hack seems to be looking at HAVE_READLINK.  */
00760     newname = xreadlink (*filename);
00761 #else
00762     error (1, 0, "internal error: islink doesn't like readlink");
00763 #endif
00764
00765     if (isabsolute (newname))
00766     {
00767         free (*filename);
00768         *filename = newname;
00769     }
00770     else
00771     {
00772         char *oldname = last_component (*filename);
00773         int dirlen = oldname - *filename;
00774         char *fullnewname = xmalloc (dirlen + strlen (newname) + 1);
00775         strncpy (fullnewname, *filename, dirlen);
00776         strcpy (fullnewname + dirlen, newname);
00777         free (newname);
00778         free (*filename);
00779         *filename = fullnewname;
00780     }
00781     }
00782 }
00783
00784 /*
00785  * Rename a file to an appropriate backup name based on BAKPREFIX.
00786  * If suffix non-null, then ".<suffix>" is appended to the new name.
00787  *
00788  * Returns the new name, which caller may free() if desired.
00789  */
00790 char *
00791 backup_file (filename, suffix)
00792      const char *filename;
00793      const char *suffix;
00794 {
00795     char *backup_name;
00796
00797     if (suffix == NULL)
00798     {
00799         backup_name = xmalloc (sizeof (BAKPREFIX) + strlen (filename) + 1);
00800         sprintf (backup_name, "%s%s", BAKPREFIX, filename);
00801     }
00802     else
00803     {
00804         backup_name = xmalloc (sizeof (BAKPREFIX)
00805                                + strlen (filename)
00806                                + strlen (suffix)
00807                                + 2);  /* one for dot, one for trailing '\0' */
00808         sprintf (backup_name, "%s%s.%s", BAKPREFIX, filename, suffix);
00809     }
00810
00811     if (isfile (filename))
00812         copy_file (filename, backup_name);
00813
00814     return backup_name;
00815 }
00816
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/tag.c Source File

cvs-1.10/src/tag.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * Tag
00009  *
00010  * Add or delete a symbolic name to an RCS file, or a collection of RCS files.
00011  * Uses the checked out revision in the current directory.
00012  */
00013
00014 #include "cvs.h"
00015 #include "savecwd.h"
00016
00017 static int check_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00018 static int check_filesdoneproc PROTO ((void *callerdat, int err,
00019                        char *repos, char *update_dir,
00020                        List *entries));
00021 static int pretag_proc PROTO((char *repository, char *filter));
00022 static void masterlist_delproc PROTO((Node *p));
00023 static void tag_delproc PROTO((Node *p));
00024 static int pretag_list_proc PROTO((Node *p, void *closure));
00025
00026 static Dtype tag_dirproc PROTO ((void *callerdat, char *dir,
00027                  char *repos, char *update_dir,
00028                  List *entries));
00029 static int tag_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00030 static int tag_filesdoneproc PROTO ((void *callerdat, int err,
00031                      char *repos, char *update_dir,
00032                      List *entries));
00033
00034 static char *numtag;
00035 static char *date = NULL;
00036 static char *symtag;
00037 static int delete_flag;         /* adding a tag by default */
00038 static int branch_mode;         /* make an automagic "branch" tag */
00039 static int local;           /* recursive by default */
00040 static int force_tag_match = 1;         /* force tag to match by default */
00041 static int force_tag_move;      /* don't force tag to move by default */
00042 static int check_uptodate;      /* no uptodate-check by default */
00043
00044 struct tag_info
00045 {
00046     Ctype status;
00047     char *rev;
00048     char *tag;
00049     char *options;
00050 };
00051
00052 struct master_lists
00053 {
00054     List *tlist;
00055 };
00056
00057 static List *mtlist;
00058 static List *tlist;
00059
00060 static const char *const tag_usage[] =
00061 {
00062     "Usage: %s %s [-lRF] [-b] [-d] [-c] [-r rev|-D date] tag [files...]\n",
00063     "\t-l\tLocal directory only, not recursive.\n",
00064     "\t-R\tProcess directories recursively.\n",
00065     "\t-d\tDelete the given tag.\n",
00066     "\t-r rev\tExisting revision/tag.\n",
00067     "\t-D\tExisting date.\n",
00068     "\t-f\tForce a head revision if specified tag not found.\n",
00069     "\t-b\tMake the tag a \"branch\" tag, allowing concurrent development.\n",
00070     "\t-F\tMove tag if it already exists.\n",
00071     "\t-c\tCheck that working files are unmodified.\n",
00072     "(Specify the --help global option for a list of other help options)\n",
00073     NULL
00074 };
00075
00076 int
00077 cvstag (argc, argv)
00078     int argc;
00079     char **argv;
00080 {
00081     int c;
00082     int err = 0;
00083
00084     if (argc == -1)
00085     usage (tag_usage);
00086
00087     optind = 0;
00088     while ((c = getopt (argc, argv, "+FQqlRcdr:D:bf")) != -1)
00089     {
00090     switch (c)
00091     {
00092         case 'Q':
00093         case 'q':
00094 #ifdef SERVER_SUPPORT
00095         /* The CVS 1.5 client sends these options (in addition to
00096            Global_option requests), so we must ignore them.  */
00097         if (!server_active)
00098 #endif
00099             error (1, 0,
00100                "-q or -Q must be specified before \"%s\"",
00101                command_name);
00102         break;
00103         case 'l':
00104         local = 1;
00105         break;
00106         case 'R':
00107         local = 0;
00108         break;
00109         case 'd':
00110         delete_flag = 1;
00111         break;
00112         case 'c':
00113         check_uptodate = 1;
00114         break;
00115             case 'r':
00116                 numtag = optarg;
00117                 break;
00118             case 'D':
00119                 if (date)
00120                     free (date);
00121                 date = Make_Date (optarg);
00122                 break;
00123         case 'f':
00124         force_tag_match = 0;
00125         break;
00126         case 'b':
00127         branch_mode = 1;
00128         break;
00129             case 'F':
00130         force_tag_move = 1;
00131         break;
00132         case '?':
00133         default:
00134         usage (tag_usage);
00135         break;
00136     }
00137     }
00138     argc -= optind;
00139     argv += optind;
00140
00141     if (argc == 0)
00142     usage (tag_usage);
00143     symtag = argv[0];
00144     argc--;
00145     argv++;
00146
00147     if (date && numtag)
00148     error (1, 0, "-r and -D options are mutually exclusive");
00149     if (delete_flag && branch_mode)
00150     error (0, 0, "warning: -b ignored with -d options");
00151     RCS_check_tag (symtag);
00152
00153 #ifdef CLIENT_SUPPORT
00154     if (client_active)
00155     {
00156     /* We're the client side.  Fire up the remote server.  */
00157     start_server ();
00158
00159     ign_setup ();
00160
00161     if (!force_tag_match)
00162         send_arg ("-f");
00163     if (local)
00164         send_arg("-l");
00165     if (delete_flag)
00166         send_arg("-d");
00167     if (check_uptodate)
00168         send_arg("-c");
00169     if (branch_mode)
00170         send_arg("-b");
00171     if (force_tag_move)
00172         send_arg("-F");
00173
00174     if (numtag)
00175         option_with_arg ("-r", numtag);
00176     if (date)
00177         client_senddate (date);
00178
00179     send_arg (symtag);
00180
00181     send_files (argc, argv, local, 0,
00182
00183             /* I think the -c case is like "cvs status", in
00184                which we really better be correct rather than
00185                being fast; it is just too confusing otherwise.  */
00186             check_uptodate ? 0 : SEND_NO_CONTENTS);
00187     send_file_names (argc, argv, SEND_EXPAND_WILD);
00188     send_to_server ("tag\012", 0);
00189         return get_responses_and_close ();
00190     }
00191 #endif
00192
00193     if (numtag != NULL)
00194     tag_check_valid (numtag, argc, argv, local, 0, "");
00195
00196     /* check to make sure they are authorized to tag all the
00197        specified files in the repository */
00198
00199     mtlist = getlist();
00200     err = start_recursion (check_fileproc, check_filesdoneproc,
00201                            (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
00202                            argc, argv, local, W_LOCAL, 0, 1,
00203                            (char *) NULL, 1);
00204
00205     if (err)
00206     {
00207        error (1, 0, "correct the above errors first!");
00208     }
00209
00210     /* start the recursion processor */
00211     err = start_recursion (tag_fileproc, tag_filesdoneproc, tag_dirproc,
00212                (DIRLEAVEPROC) NULL, NULL, argc, argv, local,
00213                W_LOCAL, 0, 0, (char *) NULL, 1);
00214     dellist(&mtlist);
00215     return (err);
00216 }
00217
00218 /* check file that is to be tagged */
00219 /* All we do here is add it to our list */
00220
00221 static int
00222 check_fileproc (callerdat, finfo)
00223     void *callerdat;
00224     struct file_info *finfo;
00225 {
00226     char *xdir;
00227     Node *p;
00228     Vers_TS *vers;
00229
00230     if (check_uptodate)
00231     {
00232     Ctype status = Classify_File (finfo, (char *) NULL, (char *) NULL,
00233                       (char *) NULL, 1, 0, &vers, 0);
00234     if ((status != T_UPTODATE) && (status != T_CHECKOUT))
00235     {
00236         error (0, 0, "%s is locally modified", finfo->fullname);
00237         freevers_ts (&vers);
00238         return (1);
00239     }
00240     }
00241     else
00242     vers = Version_TS (finfo, NULL, NULL, NULL, 0, 0);
00243
00244     if (finfo->update_dir[0] == '\0')
00245     xdir = ".";
00246     else
00247     xdir = finfo->update_dir;
00248     if ((p = findnode (mtlist, xdir)) != NULL)
00249     {
00250     tlist = ((struct master_lists *) p->data)->tlist;
00251     }
00252     else
00253     {
00254     struct master_lists *ml;
00255
00256     tlist = getlist ();
00257     p = getnode ();
00258     p->key = xstrdup (xdir);
00259     p->type = UPDATE;
00260     ml = (struct master_lists *)
00261         xmalloc (sizeof (struct master_lists));
00262     ml->tlist = tlist;
00263     p->data = (char *) ml;
00264     p->delproc = masterlist_delproc;
00265     (void) addnode (mtlist, p);
00266     }
00267     /* do tlist */
00268     p = getnode ();
00269     p->key = xstrdup (finfo->file);
00270     p->type = UPDATE;
00271     p->delproc = tag_delproc;
00272     if (vers->srcfile == NULL)
00273     {
00274         if (!really_quiet)
00275         error (0, 0, "nothing known about %s", finfo->file);
00276     freevers_ts (&vers);
00277     freenode (p);
00278     return (1);
00279     }
00280
00281     /* Here we duplicate the calculation in tag_fileproc about which
00282        version we are going to tag.  There probably are some subtle races
00283        (e.g. numtag is "foo" which gets moved between here and
00284        tag_fileproc).  */
00285     if (numtag == NULL && date == NULL)
00286     p->data = xstrdup (vers->vn_user);
00287     else
00288     p->data = RCS_getversion (vers->srcfile, numtag, date,
00289                   force_tag_match, NULL);
00290
00291     if (p->data != NULL)
00292     {
00293         int addit = 1;
00294         char *oversion;
00295
00296         oversion = RCS_getversion (vers->srcfile, symtag, (char *) NULL, 1,
00297                    (int *) NULL);
00298         if (oversion == NULL)
00299         {
00300             if (delete_flag)
00301             {
00302         /* Deleting a tag which did not exist is a noop and
00303            should not be logged.  */
00304                 addit = 0;
00305             }
00306         }
00307     else if (delete_flag)
00308     {
00309         free (p->data);
00310         p->data = xstrdup (oversion);
00311     }
00312         else if (strcmp(oversion, p->data) == 0)
00313         {
00314             addit = 0;
00315         }
00316         else if (!force_tag_move)
00317         {
00318             addit = 0;
00319         }
00320         if (oversion != NULL)
00321         {
00322             free(oversion);
00323         }
00324         if (!addit)
00325         {
00326             free(p->data);
00327             p->data = NULL;
00328         }
00329     }
00330     freevers_ts(&vers);
00331     (void) addnode (tlist, p);
00332     return (0);
00333 }
00334
00335 static int
00336 check_filesdoneproc (callerdat, err, repos, update_dir, entries)
00337     void *callerdat;
00338     int err;
00339     char *repos;
00340     char *update_dir;
00341     List *entries;
00342 {
00343     int n;
00344     Node *p;
00345
00346     p = findnode(mtlist, update_dir);
00347     if (p != NULL)
00348     {
00349         tlist = ((struct master_lists *) p->data)->tlist;
00350     }
00351     else
00352     {
00353         tlist = (List *) NULL;
00354     }
00355     if ((tlist == NULL) || (tlist->list->next == tlist->list))
00356     {
00357         return (err);
00358     }
00359     if ((n = Parse_Info(CVSROOTADM_TAGINFO, repos, pretag_proc, 1)) > 0)
00360     {
00361         error (0, 0, "Pre-tag check failed");
00362         err += n;
00363     }
00364     return (err);
00365 }
00366
00367 static int
00368 pretag_proc(repository, filter)
00369     char *repository;
00370     char *filter;
00371 {
00372     if (filter[0] == '/')
00373     {
00374         char *s, *cp;
00375
00376         s = xstrdup(filter);
00377         for (cp=s; *cp; cp++)
00378         {
00379             if (isspace ((unsigned char) *cp))
00380             {
00381                 *cp = '\0';
00382                 break;
00383             }
00384         }
00385         if (!isfile(s))
00386         {
00387             error (0, errno, "cannot find pre-tag filter '%s'", s);
00388             free(s);
00389             return (1);
00390         }
00391         free(s);
00392     }
00393     run_setup (filter);
00394     run_arg (symtag);
00395     run_arg (delete_flag ? "del" : force_tag_move ? "mov" : "add");
00396     run_arg (repository);
00397     walklist(tlist, pretag_list_proc, NULL);
00398     return (run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL));
00399 }
00400
00401 static void
00402 masterlist_delproc(p)
00403     Node *p;
00404 {
00405     struct master_lists *ml;
00406
00407     ml = (struct master_lists *)p->data;
00408     dellist(&ml->tlist);
00409     free(ml);
00410     return;
00411 }
00412
00413 static void
00414 tag_delproc(p)
00415     Node *p;
00416 {
00417     if (p->data != NULL)
00418     {
00419         free(p->data);
00420         p->data = NULL;
00421     }
00422     return;
00423 }
00424
00425 static int
00426 pretag_list_proc(p, closure)
00427     Node *p;
00428     void *closure;
00429 {
00430     if (p->data != NULL)
00431     {
00432         run_arg(p->key);
00433         run_arg(p->data);
00434     }
00435     return (0);
00436 }
00437
00438
00439 /*
00440  * Called to tag a particular file (the currently checked out version is
00441  * tagged with the specified tag - or the specified tag is deleted).
00442  */
00443 /* ARGSUSED */
00444 static int
00445 tag_fileproc (callerdat, finfo)
00446     void *callerdat;
00447     struct file_info *finfo;
00448 {
00449     char *version, *oversion;
00450     char *nversion = NULL;
00451     char *rev;
00452     Vers_TS *vers;
00453     int retcode = 0;
00454
00455     /* Lock the directory if it is not already locked.  We can't rely
00456        on tag_dirproc because it won't handle the case where the user
00457        specifies a list of files on the command line.  */
00458     /* We do not need to acquire a full write lock for the tag operation:
00459        the revisions are obtained from the working directory, so we do not
00460        require consistency across the entire repository.  However, we do
00461        need to prevent simultaneous tag operations from interfering with
00462        each other.  Therefore, we write lock each directory as we enter
00463        it, and unlock it as we leave it.  */
00464     lock_dir_for_write (finfo->repository);
00465
00466     vers = Version_TS (finfo, NULL, NULL, NULL, 0, 0);
00467
00468     if ((numtag != NULL) || (date != NULL))
00469     {
00470         nversion = RCS_getversion(vers->srcfile,
00471                                   numtag,
00472                                   date,
00473                                   force_tag_match,
00474                   (int *) NULL);
00475         if (nversion == NULL)
00476         {
00477         freevers_ts (&vers);
00478             return (0);
00479         }
00480     }
00481     if (delete_flag)
00482     {
00483
00484     /*
00485      * If -d is specified, "force_tag_match" is set, so that this call to
00486      * RCS_getversion() will return a NULL version string if the symbolic
00487      * tag does not exist in the RCS file.
00488      *
00489      * This is done here because it's MUCH faster than just blindly calling
00490      * "rcs" to remove the tag... trust me.
00491      */
00492
00493     version = RCS_getversion (vers->srcfile, symtag, (char *) NULL, 1,
00494                   (int *) NULL);
00495     if (version == NULL || vers->srcfile == NULL)
00496     {
00497         freevers_ts (&vers);
00498         return (0);
00499     }
00500     free (version);
00501
00502     if ((retcode = RCS_deltag(vers->srcfile, symtag)) != 0)
00503     {
00504         if (!quiet)
00505         error (0, retcode == -1 ? errno : 0,
00506                "failed to remove tag %s from %s", symtag,
00507                vers->srcfile->path);
00508         freevers_ts (&vers);
00509         return (1);
00510     }
00511     RCS_rewrite (vers->srcfile, NULL, NULL);
00512
00513     /* warm fuzzies */
00514     if (!really_quiet)
00515     {
00516         cvs_output ("D ", 2);
00517         cvs_output (finfo->fullname, 0);
00518         cvs_output ("\n", 1);
00519     }
00520
00521     freevers_ts (&vers);
00522     return (0);
00523     }
00524
00525     /*
00526      * If we are adding a tag, we need to know which version we have checked
00527      * out and we'll tag that version.
00528      */
00529     if (nversion == NULL)
00530     {
00531         version = vers->vn_user;
00532     }
00533     else
00534     {
00535         version = nversion;
00536     }
00537     if (version == NULL)
00538     {
00539     freevers_ts (&vers);
00540     return (0);
00541     }
00542     else if (strcmp (version, "0") == 0)
00543     {
00544     if (!quiet)
00545         error (0, 0, "couldn't tag added but un-commited file `%s'", finfo->file);
00546     freevers_ts (&vers);
00547     return (0);
00548     }
00549     else if (version[0] == '-')
00550     {
00551     if (!quiet)
00552         error (0, 0, "skipping removed but un-commited file `%s'", finfo->file);
00553     freevers_ts (&vers);
00554     return (0);
00555     }
00556     else if (vers->srcfile == NULL)
00557     {
00558     if (!quiet)
00559         error (0, 0, "cannot find revision control file for `%s'", finfo->file);
00560     freevers_ts (&vers);
00561     return (0);
00562     }
00563
00564     /*
00565      * As an enhancement for the case where a tag is being re-applied to a
00566      * large number of files, make one extra call to RCS_getversion to see
00567      * if the tag is already set in the RCS file.  If so, check to see if it
00568      * needs to be moved.  If not, do nothing.  This will likely save a lot of
00569      * time when simply moving the tag to the "current" head revisions of a
00570      * module -- which I have found to be a typical tagging operation.
00571      */
00572     rev = branch_mode ? RCS_magicrev (vers->srcfile, version) : version;
00573     oversion = RCS_getversion (vers->srcfile, symtag, (char *) NULL, 1,
00574                    (int *) NULL);
00575     if (oversion != NULL)
00576     {
00577     int isbranch = RCS_nodeisbranch (finfo->rcs, symtag);
00578
00579     /*
00580      * if versions the same and neither old or new are branches don't have
00581      * to do anything
00582      */
00583     if (strcmp (version, oversion) == 0 && !branch_mode && !isbranch)
00584     {
00585         free (oversion);
00586         if (branch_mode)
00587         free (rev);
00588         freevers_ts (&vers);
00589         return (0);
00590     }
00591
00592     if (!force_tag_move)
00593     {
00594         /* we're NOT going to move the tag */
00595         cvs_output ("W ", 2);
00596         cvs_output (finfo->fullname, 0);
00597         cvs_output (" : ", 0);
00598         cvs_output (symtag, 0);
00599         cvs_output (" already exists on ", 0);
00600         cvs_output (isbranch ? "branch" : "version", 0);
00601         cvs_output (" ", 0);
00602         cvs_output (oversion, 0);
00603         cvs_output (" : NOT MOVING tag to ", 0);
00604         cvs_output (branch_mode ? "branch" : "version", 0);
00605         cvs_output (" ", 0);
00606         cvs_output (rev, 0);
00607         cvs_output ("\n", 1);
00608         free (oversion);
00609         if (branch_mode)
00610         free (rev);
00611         freevers_ts (&vers);
00612         return (0);
00613     }
00614     free (oversion);
00615     }
00616
00617     if ((retcode = RCS_settag(vers->srcfile, symtag, rev)) != 0)
00618     {
00619     error (1, retcode == -1 ? errno : 0,
00620            "failed to set tag %s to revision %s in %s",
00621            symtag, rev, vers->srcfile->path);
00622     if (branch_mode)
00623         free (rev);
00624     freevers_ts (&vers);
00625     return (1);
00626     }
00627     if (branch_mode)
00628     free (rev);
00629     RCS_rewrite (vers->srcfile, NULL, NULL);
00630
00631     /* more warm fuzzies */
00632     if (!really_quiet)
00633     {
00634     cvs_output ("T ", 2);
00635     cvs_output (finfo->fullname, 0);
00636     cvs_output ("\n", 1);
00637     }
00638
00639     if (nversion != NULL)
00640     {
00641         free (nversion);
00642     }
00643     freevers_ts (&vers);
00644     return (0);
00645 }
00646
00647 /* Clear any lock we may hold on the current directory.  */
00648
00649 static int
00650 tag_filesdoneproc (callerdat, err, repos, update_dir, entries)
00651     void *callerdat;
00652     int err;
00653     char *repos;
00654     char *update_dir;
00655     List *entries;
00656 {
00657     Lock_Cleanup ();
00658
00659     return (err);
00660 }
00661
00662 /*
00663  * Print a warm fuzzy message
00664  */
00665 /* ARGSUSED */
00666 static Dtype
00667 tag_dirproc (callerdat, dir, repos, update_dir, entries)
00668     void *callerdat;
00669     char *dir;
00670     char *repos;
00671     char *update_dir;
00672     List *entries;
00673 {
00674     if (!quiet)
00675     error (0, 0, "%s %s", delete_flag ? "Untagging" : "Tagging", update_dir);
00676     return (R_PROCESS);
00677 }
00678
00679 /* Code relating to the val-tags file.  Note that this file has no way
00680    of knowing when a tag has been deleted.  The problem is that there
00681    is no way of knowing whether a tag still exists somewhere, when we
00682    delete it some places.  Using per-directory val-tags files (in
00683    CVSREP) might be better, but that might slow down the process of
00684    verifying that a tag is correct (maybe not, for the likely cases,
00685    if carefully done), and/or be harder to implement correctly.  */
00686
00687 struct val_args {
00688     char *name;
00689     int found;
00690 };
00691
00692 static int val_fileproc PROTO ((void *callerdat, struct file_info *finfo));
00693
00694 static int
00695 val_fileproc (callerdat, finfo)
00696     void *callerdat;
00697     struct file_info *finfo;
00698 {
00699     RCSNode *rcsdata;
00700     struct val_args *args = (struct val_args *)callerdat;
00701     char *tag;
00702
00703     if ((rcsdata = finfo->rcs) == NULL)
00704     /* Not sure this can happen, after all we passed only
00705        W_REPOS | W_ATTIC.  */
00706     return 0;
00707
00708     tag = RCS_gettag (rcsdata, args->name, 1, (int *) NULL);
00709     if (tag != NULL)
00710     {
00711     /* FIXME: should find out a way to stop the search at this point.  */
00712     args->found = 1;
00713     free (tag);
00714     }
00715     return 0;
00716 }
00717
00718 static Dtype val_direntproc PROTO ((void *, char *, char *, char *, List *));
00719
00720 static Dtype
00721 val_direntproc (callerdat, dir, repository, update_dir, entries)
00722     void *callerdat;
00723     char *dir;
00724     char *repository;
00725     char *update_dir;
00726     List *entries;
00727 {
00728     /* This is not quite right--it doesn't get right the case of "cvs
00729        update -d -r foobar" where foobar is a tag which exists only in
00730        files in a directory which does not exist yet, but which is
00731        about to be created.  */
00732     if (isdir (dir))
00733     return R_PROCESS;
00734     return R_SKIP_ALL;
00735 }
00736
00737 /* Check to see whether NAME is a valid tag.  If so, return.  If not
00738    print an error message and exit.  ARGC, ARGV, LOCAL, and AFLAG specify
00739    which files we will be operating on.
00740
00741    REPOSITORY is the repository if we need to cd into it, or NULL if
00742    we are already there, or "" if we should do a W_LOCAL recursion.
00743    Sorry for three cases, but the "" case is needed in case the
00744    working directories come from diverse parts of the repository, the
00745    NULL case avoids an unneccesary chdir, and the non-NULL, non-""
00746    case is needed for checkout, where we don't want to chdir if the
00747    tag is found in CVSROOTADM_VALTAGS, but there is not (yet) any
00748    local directory.  */
00749 void
00750 tag_check_valid (name, argc, argv, local, aflag, repository)
00751     char *name;
00752     int argc;
00753     char **argv;
00754     int local;
00755     int aflag;
00756     char *repository;
00757 {
00758     DBM *db;
00759     char *valtags_filename;
00760     int err;
00761     datum mytag;
00762     struct val_args the_val_args;
00763     struct saved_cwd cwd;
00764     int which;
00765
00766     /* Numeric tags require only a syntactic check.  */
00767     if (isdigit ((unsigned char) name[0]))
00768     {
00769     char *p;
00770     for (p = name; *p != '\0'; ++p)
00771     {
00772         if (!(isdigit ((unsigned char) *p) || *p == '.'))
00773         error (1, 0, "\
00774 Numeric tag %s contains characters other than digits and '.'", name);
00775     }
00776     return;
00777     }
00778
00779     /* Special tags are always valid.  */
00780     if (strcmp (name, TAG_BASE) == 0
00781     || strcmp (name, TAG_HEAD) == 0)
00782     return;
00783
00784     /* FIXME: This routine doesn't seem to do any locking whatsoever
00785        (and it is called from places which don't have locks in place).
00786        If two processes try to write val-tags at the same time, it would
00787        seem like we are in trouble.  */
00788
00789     mytag.dptr = name;
00790     mytag.dsize = strlen (name);
00791
00792     valtags_filename = xmalloc (strlen (CVSroot_directory)
00793                 + sizeof CVSROOTADM
00794                 + sizeof CVSROOTADM_VALTAGS + 20);
00795     strcpy (valtags_filename, CVSroot_directory);
00796     strcat (valtags_filename, "/");
00797     strcat (valtags_filename, CVSROOTADM);
00798     strcat (valtags_filename, "/");
00799     strcat (valtags_filename, CVSROOTADM_VALTAGS);
00800     db = dbm_open (valtags_filename, O_RDWR, 0666);
00801     if (db == NULL)
00802     {
00803     if (!existence_error (errno))
00804         error (1, errno, "cannot read %s", valtags_filename);
00805
00806     /* If the file merely fails to exist, we just keep going and create
00807        it later if need be.  */
00808     }
00809     else
00810     {
00811     datum val;
00812
00813     val = dbm_fetch (db, mytag);
00814     if (val.dptr != NULL)
00815     {
00816         /* Found.  The tag is valid.  */
00817         dbm_close (db);
00818         free (valtags_filename);
00819         return;
00820     }
00821     /* FIXME: should check errors somehow (add dbm_error to myndbm.c?).  */
00822     }
00823
00824     /* We didn't find the tag in val-tags, so look through all the RCS files
00825        to see whether it exists there.  Yes, this is expensive, but there
00826        is no other way to cope with a tag which might have been created
00827        by an old version of CVS, from before val-tags was invented.
00828
00829        Since we need this code anyway, we also use it to create
00830        entries in val-tags in general (that is, the val-tags entry
00831        will get created the first time the tag is used, not when the
00832        tag is created).  */
00833
00834     the_val_args.name = name;
00835     the_val_args.found = 0;
00836
00837     which = W_REPOS | W_ATTIC;
00838
00839     if (repository != NULL)
00840     {
00841     if (repository[0] == '\0')
00842         which |= W_LOCAL;
00843     else
00844     {
00845         if (save_cwd (&cwd))
00846         error_exit ();
00847         if ( CVS_CHDIR (repository) < 0)
00848         error (1, errno, "cannot change to %s directory", repository);
00849     }
00850     }
00851
00852     err = start_recursion (val_fileproc, (FILESDONEPROC) NULL,
00853                val_direntproc, (DIRLEAVEPROC) NULL,
00854                (void *)&the_val_args,
00855                argc, argv, local, which, aflag,
00856                1, NULL, 1);
00857     if (repository != NULL && repository[0] != '\0')
00858     {
00859     if (restore_cwd (&cwd, NULL))
00860         exit (EXIT_FAILURE);
00861     free_cwd (&cwd);
00862     }
00863
00864     if (!the_val_args.found)
00865     error (1, 0, "no such tag %s", name);
00866     else
00867     {
00868     /* The tags is valid but not mentioned in val-tags.  Add it.  */
00869     datum value;
00870
00871     if (noexec)
00872     {
00873         if (db != NULL)
00874         dbm_close (db);
00875         free (valtags_filename);
00876         return;
00877     }
00878
00879     if (db == NULL)
00880     {
00881         mode_t omask;
00882         omask = umask (cvsumask);
00883         db = dbm_open (valtags_filename, O_RDWR | O_CREAT | O_TRUNC, 0666);
00884         (void) umask (omask);
00885
00886         if (db == NULL)
00887         {
00888         error (0, errno, "cannot create %s", valtags_filename);
00889         free (valtags_filename);
00890         return;
00891         }
00892     }
00893     value.dptr = "y";
00894     value.dsize = 1;
00895     if (dbm_store (db, mytag, value, DBM_REPLACE) < 0)
00896         error (0, errno, "cannot store %s into %s", name,
00897            valtags_filename);
00898     dbm_close (db);
00899     }
00900     free (valtags_filename);
00901 }
00902
00903 /*
00904  * Check whether a join tag is valid.  This is just like
00905  * tag_check_valid, but we must stop before the colon if there is one.
00906  */
00907
00908 void
00909 tag_check_valid_join (join_tag, argc, argv, local, aflag, repository)
00910      char *join_tag;
00911      int argc;
00912      char **argv;
00913      int local;
00914      int aflag;
00915      char *repository;
00916 {
00917     char *c, *s;
00918
00919     c = xstrdup (join_tag);
00920     s = strchr (c, ':');
00921     if (s != NULL)
00922     {
00923         if (isdigit ((unsigned char) join_tag[0]))
00924         error (1, 0,
00925            "Numeric join tag %s may not contain a date specifier",
00926            join_tag);
00927
00928         *s = '\0';
00929     /* hmmm...  I think it makes sense to allow -j:<date>, but
00930      * for now this fixes a bug where CVS just spins and spins (I
00931      * think in the RCS code) looking for a zero length tag.
00932      */
00933     if (!*c)
00934         error (1, 0,
00935            "argument to join may not contain a date specifier without a tag");
00936     }
00937
00938     tag_check_valid (c, argc, argv, local, aflag, repository);
00939
00940     free (c);
00941 }
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/update.c Source File

cvs-1.10/src/update.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  *
00008  * "update" updates the version in the present directory with respect to the RCS
00009  * repository.  The present version must have been created by "checkout". The
00010  * user can keep up-to-date by calling "update" whenever he feels like it.
00011  *
00012  * The present version can be committed by "commit", but this keeps the version
00013  * in tact.
00014  *
00015  * Arguments following the options are taken to be file names to be updated,
00016  * rather than updating the entire directory.
00017  *
00018  * Modified or non-existent RCS files are checked out and reported as U
00019  * <user_file>
00020  *
00021  * Modified user files are reported as M <user_file>.  If both the RCS file and
00022  * the user file have been modified, the user file is replaced by the result
00023  * of rcsmerge, and a backup file is written for the user in .#file.version.
00024  * If this throws up irreconcilable differences, the file is reported as C
00025  * <user_file>, and as M <user_file> otherwise.
00026  *
00027  * Files added but not yet committed are reported as A <user_file>. Files
00028  * removed but not yet committed are reported as R <user_file>.
00029  *
00030  * If the current directory contains subdirectories that hold concurrent
00031  * versions, these are updated too.  If the -d option was specified, new
00032  * directories added to the repository are automatically created and updated
00033  * as well.
00034  */
00035
00036 #include "cvs.h"
00037 #include "savecwd.h"
00038 #ifdef SERVER_SUPPORT
00039 #include "md5.h"
00040 #endif
00041 #include "watch.h"
00042 #include "fileattr.h"
00043 #include "edit.h"
00044 #include "getline.h"
00045 #include "buffer.h"
00046 #include "hardlink.h"
00047
00048 static int checkout_file PROTO ((struct file_info *finfo, Vers_TS *vers_ts,
00049                  int adding, int merging, int update_server));
00050 #ifdef SERVER_SUPPORT
00051 static void checkout_to_buffer PROTO ((void *, const char *, size_t));
00052 #endif
00053 #ifdef SERVER_SUPPORT
00054 static int patch_file PROTO ((struct file_info *finfo,
00055                   Vers_TS *vers_ts,
00056                   int *docheckout, struct stat *file_info,
00057                   unsigned char *checksum));
00058 static void patch_file_write PROTO ((void *, const char *, size_t));
00059 #endif
00060 static int merge_file PROTO ((struct file_info *finfo, Vers_TS *vers));
00061 static int scratch_file PROTO((struct file_info *finfo));
00062 static Dtype update_dirent_proc PROTO ((void *callerdat, char *dir,
00063                     char *repository, char *update_dir,
00064                     List *entries));
00065 static int update_dirleave_proc PROTO ((void *callerdat, char *dir,
00066                     int err, char *update_dir,
00067                     List *entries));
00068 static int update_fileproc PROTO ((void *callerdat, struct file_info *));
00069 static int update_filesdone_proc PROTO ((void *callerdat, int err,
00070                      char *repository, char *update_dir,
00071                      List *entries));
00072 #ifdef PRESERVE_PERMISSIONS_SUPPORT
00073 static int get_linkinfo_proc PROTO ((void *callerdat, struct file_info *));
00074 #endif
00075 static void write_letter PROTO ((struct file_info *finfo, int letter));
00076 static void join_file PROTO ((struct file_info *finfo, Vers_TS *vers_ts));
00077
00078 static char *options = NULL;
00079 static char *tag = NULL;
00080 static char *date = NULL;
00081 /* This is a bit of a kludge.  We call WriteTag at the beginning
00082    before we know whether nonbranch is set or not.  And then at the
00083    end, once we have the right value for nonbranch, we call WriteTag
00084    again.  I don't know whether the first call is necessary or not.
00085    rewrite_tag is nonzero if we are going to have to make that second
00086    call.  */
00087 static int rewrite_tag;
00088 static int nonbranch;
00089
00090 /* If we set the tag or date for a subdirectory, we use this to undo
00091    the setting.  See update_dirent_proc.  */
00092 static char *tag_update_dir;
00093
00094 static char *join_rev1, *date_rev1;
00095 static char *join_rev2, *date_rev2;
00096 static int aflag = 0;
00097 static int toss_local_changes = 0;
00098 static int force_tag_match = 1;
00099 static int update_build_dirs = 0;
00100 static int update_prune_dirs = 0;
00101 static int pipeout = 0;
00102 #ifdef SERVER_SUPPORT
00103 static int patches = 0;
00104 static int rcs_diff_patches = 0;
00105 #endif
00106 static List *ignlist = (List *) NULL;
00107 static time_t last_register_time;
00108 static const char *const update_usage[] =
00109 {
00110     "Usage: %s %s [-APCdflRp] [-k kopt] [-r rev|-D date] [-j rev]\n",
00111     "    [-I ign] [-W spec] [files...]\n",
00112     "\t-A\tReset any sticky tags/date/kopts.\n",
00113     "\t-P\tPrune empty directories.\n",
00114     "\t-C\tOverwrite locally modified files with clean repository copies.\n",
00115     "\t-d\tBuild directories, like checkout does.\n",
00116     "\t-f\tForce a head revision match if tag/date not found.\n",
00117     "\t-l\tLocal directory only, no recursion.\n",
00118     "\t-R\tProcess directories recursively.\n",
00119     "\t-p\tSend updates to standard output (avoids stickiness).\n",
00120     "\t-k kopt\tUse RCS kopt -k option on checkout.\n",
00121     "\t-r rev\tUpdate using specified revision/tag (is sticky).\n",
00122     "\t-D date\tSet date to update from (is sticky).\n",
00123     "\t-j rev\tMerge in changes made between current revision and rev.\n",
00124     "\t-I ign\tMore files to ignore (! to reset).\n",
00125     "\t-W spec\tWrappers specification line.\n",
00126     "(Specify the --help global option for a list of other help options)\n",
00127     NULL
00128 };
00129
00130 /*
00131  * update is the argv,argc based front end for arg parsing
00132  */
00133 int
00134 update (argc, argv)
00135     int argc;
00136     char **argv;
00137 {
00138     int c, err;
00139     int local = 0;          /* recursive by default */
00140     int which;              /* where to look for files and dirs */
00141
00142     if (argc == -1)
00143     usage (update_usage);
00144
00145     ign_setup ();
00146     wrap_setup ();
00147
00148     /* parse the args */
00149     optind = 0;
00150     while ((c = getopt (argc, argv, "+ApCPflRQqduk:r:D:j:I:W:")) != -1)
00151     {
00152     switch (c)
00153     {
00154         case 'A':
00155         aflag = 1;
00156         break;
00157         case 'C':
00158         toss_local_changes = 1;
00159         break;
00160         case 'I':
00161         ign_add (optarg, 0);
00162         break;
00163         case 'W':
00164         wrap_add (optarg, 0);
00165         break;
00166         case 'k':
00167         if (options)
00168             free (options);
00169         options = RCS_check_kflag (optarg);
00170         break;
00171         case 'l':
00172         local = 1;
00173         break;
00174         case 'R':
00175         local = 0;
00176         break;
00177         case 'Q':
00178         case 'q':
00179 #ifdef SERVER_SUPPORT
00180         /* The CVS 1.5 client sends these options (in addition to
00181            Global_option requests), so we must ignore them.  */
00182         if (!server_active)
00183 #endif
00184             error (1, 0,
00185                "-q or -Q must be specified before \"%s\"",
00186                command_name);
00187         break;
00188         case 'd':
00189         update_build_dirs = 1;
00190         break;
00191         case 'f':
00192         force_tag_match = 0;
00193         break;
00194         case 'r':
00195         tag = optarg;
00196         break;
00197         case 'D':
00198         date = Make_Date (optarg);
00199         break;
00200         case 'P':
00201         update_prune_dirs = 1;
00202         break;
00203         case 'p':
00204         pipeout = 1;
00205         noexec = 1;     /* so no locks will be created */
00206         break;
00207         case 'j':
00208         if (join_rev2)
00209             error (1, 0, "only two -j options can be specified");
00210         if (join_rev1)
00211             join_rev2 = optarg;
00212         else
00213             join_rev1 = optarg;
00214         break;
00215         case 'u':
00216 #ifdef SERVER_SUPPORT
00217         if (server_active)
00218         {
00219             patches = 1;
00220             rcs_diff_patches = server_use_rcs_diff ();
00221         }
00222         else
00223 #endif
00224             usage (update_usage);
00225         break;
00226         case '?':
00227         default:
00228         usage (update_usage);
00229         break;
00230     }
00231     }
00232     argc -= optind;
00233     argv += optind;
00234
00235 #ifdef DIRTY_MODDATE
00236     enable_dirty = 1;
00237 #endif
00238
00239 #ifdef CLIENT_SUPPORT
00240     if (client_active)
00241     {
00242     int pass;
00243
00244     /* The first pass does the regular update.  If we receive at least
00245        one patch which failed, we do a second pass and just fetch
00246        those files whose patches failed.  */
00247     pass = 1;
00248     do
00249     {
00250         int status;
00251
00252         start_server ();
00253
00254         if (local)
00255         send_arg("-l");
00256         if (update_build_dirs)
00257         send_arg("-d");
00258         if (pipeout)
00259         send_arg("-p");
00260         if (!force_tag_match)
00261         send_arg("-f");
00262         if (aflag)
00263         send_arg("-A");
00264         if (toss_local_changes)
00265         send_arg("-C");
00266         if (update_prune_dirs)
00267         send_arg("-P");
00268         client_prune_dirs = update_prune_dirs;
00269         option_with_arg ("-r", tag);
00270         if (options && options[0] != '\0')
00271         send_arg (options);
00272         if (date)
00273         client_senddate (date);
00274         if (join_rev1)
00275         option_with_arg ("-j", join_rev1);
00276         if (join_rev2)
00277         option_with_arg ("-j", join_rev2);
00278         wrap_send ();
00279
00280         if (failed_patches_count == 0)
00281         {
00282                 unsigned int flags = 0;
00283
00284         /* If the server supports the command "update-patches", that
00285            means that it knows how to handle the -u argument to update,
00286            which means to send patches instead of complete files.
00287
00288            We don't send -u if failed_patches != NULL, so that the
00289            server doesn't try to send patches which will just fail
00290            again.  At least currently, the client also clobbers the
00291            file and tells the server it is lost, which also will get
00292            a full file instead of a patch, but it seems clean to omit
00293            -u.  */
00294         if (supported_request ("update-patches"))
00295             send_arg ("-u");
00296
00297                 if (update_build_dirs)
00298                     flags |= SEND_BUILD_DIRS;
00299
00300                 if (toss_local_changes) {
00301                     flags |= SEND_NO_CONTENTS;
00302                     flags |= BACKUP_MODIFIED_FILES;
00303                 }
00304
00305         /* If noexec, probably could be setting SEND_NO_CONTENTS.
00306            Same caveats as for "cvs status" apply.  */
00307
00308         send_files (argc, argv, local, aflag, flags);
00309         send_file_names (argc, argv, SEND_EXPAND_WILD);
00310         }
00311         else
00312         {
00313         int i;
00314
00315         (void) printf ("%s client: refetching unpatchable files\n",
00316                    program_name);
00317
00318         if (toplevel_wd != NULL
00319             && CVS_CHDIR (toplevel_wd) < 0)
00320         {
00321             error (1, errno, "could not chdir to %s", toplevel_wd);
00322         }
00323
00324         for (i = 0; i < failed_patches_count; i++)
00325             if (unlink_file (failed_patches[i]) < 0
00326             && !existence_error (errno))
00327             error (0, errno, "cannot remove %s",
00328                    failed_patches[i]);
00329         send_files (failed_patches_count, failed_patches, local,
00330                 aflag, update_build_dirs ? SEND_BUILD_DIRS : 0);
00331         send_file_names (failed_patches_count, failed_patches, 0);
00332         free_names (&failed_patches_count, failed_patches);
00333         }
00334
00335         send_to_server ("update\012", 0);
00336
00337         status = get_responses_and_close ();
00338
00339         /* If there are any conflicts, the server will return a
00340                non-zero exit status.  If any patches failed, we still
00341                want to run the update again.  We use a pass count to
00342                avoid an endless loop.  */
00343
00344         /* Notes: (1) assuming that status != 0 implies a
00345            potential conflict is the best we can cleanly do given
00346            the current protocol.  I suppose that trying to
00347            re-fetch in cases where there was a more serious error
00348            is probably more or less harmless, but it isn't really
00349            ideal.  (2) it would be nice to have a testsuite case for the
00350            conflict-and-patch-failed case.  */
00351
00352         if (status != 0
00353         && (failed_patches_count == 0 || pass > 1))
00354         {
00355         if (failed_patches_count > 0)
00356             free_names (&failed_patches_count, failed_patches);
00357         return status;
00358         }
00359
00360         ++pass;
00361     } while (failed_patches_count > 0);
00362
00363     return 0;
00364     }
00365 #endif
00366
00367     if (tag != NULL)
00368     tag_check_valid (tag, argc, argv, local, aflag, "");
00369     if (join_rev1 != NULL)
00370         tag_check_valid_join (join_rev1, argc, argv, local, aflag, "");
00371     if (join_rev2 != NULL)
00372         tag_check_valid_join (join_rev2, argc, argv, local, aflag, "");
00373
00374     /*
00375      * If we are updating the entire directory (for real) and building dirs
00376      * as we go, we make sure there is no static entries file and write the
00377      * tag file as appropriate
00378      */
00379     if (argc <= 0 && !pipeout)
00380     {
00381     if (update_build_dirs)
00382     {
00383         if (unlink_file (CVSADM_ENTSTAT) < 0 && ! existence_error (errno))
00384         error (1, errno, "cannot remove file %s", CVSADM_ENTSTAT);
00385 #ifdef SERVER_SUPPORT
00386         if (server_active)
00387         {
00388         char *repos = Name_Repository (NULL, NULL);
00389         server_clear_entstat (".", repos);
00390         free (repos);
00391         }
00392 #endif
00393     }
00394
00395     /* keep the CVS/Tag file current with the specified arguments */
00396     if (aflag || tag || date)
00397     {
00398         char *repos = Name_Repository (NULL, NULL);
00399         WriteTag ((char *) NULL, tag, date, 0, ".", repos);
00400         free (repos);
00401         rewrite_tag = 1;
00402         nonbranch = 0;
00403     }
00404     }
00405
00406     /* look for files/dirs locally and in the repository */
00407     which = W_LOCAL | W_REPOS;
00408
00409     /* look in the attic too if a tag or date is specified */
00410     if (tag != NULL || date != NULL || joining())
00411     which |= W_ATTIC;
00412
00413     /* call the command line interface */
00414     err = do_update (argc, argv, options, tag, date, force_tag_match,
00415              local, update_build_dirs, aflag, update_prune_dirs,
00416              pipeout, which, join_rev1, join_rev2, (char *) NULL);
00417
00418     /* free the space Make_Date allocated if necessary */
00419     if (date != NULL)
00420     free (date);
00421
00422     return (err);
00423 }
00424
00425 /*
00426  * Command line interface to update (used by checkout)
00427  */
00428 int
00429 do_update (argc, argv, xoptions, xtag, xdate, xforce, local, xbuild, xaflag,
00430        xprune, xpipeout, which, xjoin_rev1, xjoin_rev2, preload_update_dir)
00431     int argc;
00432     char **argv;
00433     char *xoptions;
00434     char *xtag;
00435     char *xdate;
00436     int xforce;
00437     int local;
00438     int xbuild;
00439     int xaflag;
00440     int xprune;
00441     int xpipeout;
00442     int which;
00443     char *xjoin_rev1;
00444     char *xjoin_rev2;
00445     char *preload_update_dir;
00446 {
00447     int err = 0;
00448     char *cp;
00449
00450     /* fill in the statics */
00451     options = xoptions;
00452     tag = xtag;
00453     date = xdate;
00454     force_tag_match = xforce;
00455     update_build_dirs = xbuild;
00456     aflag = xaflag;
00457     update_prune_dirs = xprune;
00458     pipeout = xpipeout;
00459
00460     /* setup the join support */
00461     join_rev1 = xjoin_rev1;
00462     join_rev2 = xjoin_rev2;
00463     if (join_rev1 && (cp = strchr (join_rev1, ':')) != NULL)
00464     {
00465     *cp++ = '\0';
00466     date_rev1 = Make_Date (cp);
00467     }
00468     else
00469     date_rev1 = (char *) NULL;
00470     if (join_rev2 && (cp = strchr (join_rev2, ':')) != NULL)
00471     {
00472     *cp++ = '\0';
00473     date_rev2 = Make_Date (cp);
00474     }
00475     else
00476     date_rev2 = (char *) NULL;
00477
00478 #ifdef PRESERVE_PERMISSIONS_SUPPORT
00479     if (preserve_perms)
00480     {
00481     /* We need to do an extra recursion, bleah.  It's to make sure
00482        that we know as much as possible about file linkage. */
00483     hardlist = getlist();
00484     working_dir = xgetwd();     /* save top-level working dir */
00485
00486     /* FIXME-twp: the arguments to start_recursion make me dizzy.  This
00487        function call was copied from the update_fileproc call that
00488        follows it; someone should make sure that I did it right. */
00489     err = start_recursion (get_linkinfo_proc, (FILESDONEPROC) NULL,
00490                    (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
00491                    argc, argv, local, which, aflag, 1,
00492                    preload_update_dir, 1);
00493     if (err)
00494         return (err);
00495
00496     /* FIXME-twp: at this point we should walk the hardlist
00497        and update the `links' field of each hardlink_info struct
00498        to list the files that are linked on dist.  That would make
00499        it easier & more efficient to compare the disk linkage with
00500        the repository linkage (a simple strcmp). */
00501     }
00502 #endif
00503
00504     /* call the recursion processor */
00505     err = start_recursion (update_fileproc, update_filesdone_proc,
00506                update_dirent_proc, update_dirleave_proc, NULL,
00507                argc, argv, local, which, aflag, 1,
00508                preload_update_dir, 1);
00509
00510     /* see if we need to sleep before returning to avoid time-stamp races */
00511     if (last_register_time)
00512     {
00513     while (time ((time_t *) NULL) == last_register_time)
00514         sleep (1);
00515     }
00516
00517     return (err);
00518 }
00519
00520 #ifdef PRESERVE_PERMISSIONS_SUPPORT
00521 /*
00522  * The get_linkinfo_proc callback adds each file to the hardlist
00523  * (see hardlink.c).
00524  */
00525
00526 static int
00527 get_linkinfo_proc (callerdat, finfo)
00528     void *callerdat;
00529     struct file_info *finfo;
00530 {
00531     char *fullpath;
00532     Node *linkp;
00533     struct hardlink_info *hlinfo;
00534
00535     /* Get the full pathname of the current file. */
00536     fullpath = xmalloc (strlen(working_dir) +
00537             strlen(finfo->fullname) + 2);
00538     sprintf (fullpath, "%s/%s", working_dir, finfo->fullname);
00539
00540     /* To permit recursing into subdirectories, files
00541        are keyed on the full pathname and not on the basename. */
00542     linkp = lookup_file_by_inode (fullpath);
00543     if (linkp == NULL)
00544     {
00545     /* The file isn't on disk; we are probably restoring
00546        a file that was removed. */
00547     return 0;
00548     }
00549
00550     /* Create a new, empty hardlink_info node. */
00551     hlinfo = (struct hardlink_info *)
00552     xmalloc (sizeof (struct hardlink_info));
00553
00554     hlinfo->status = (Ctype) 0; /* is this dumb? */
00555     hlinfo->checked_out = 0;
00556
00557     linkp->data = (char *) hlinfo;
00558
00559     return 0;
00560 }
00561 #endif
00562
00563 /*
00564  * This is the callback proc for update.  It is called for each file in each
00565  * directory by the recursion code.  The current directory is the local
00566  * instantiation.  file is the file name we are to operate on. update_dir is
00567  * set to the path relative to where we started (for pretty printing).
00568  * repository is the repository. entries and srcfiles are the pre-parsed
00569  * entries and source control files.
00570  *
00571  * This routine decides what needs to be done for each file and does the
00572  * appropriate magic for checkout
00573  */
00574 static int
00575 update_fileproc (callerdat, finfo)
00576     void *callerdat;
00577     struct file_info *finfo;
00578 {
00579     int retval;
00580     Ctype status;
00581     Vers_TS *vers;
00582     int resurrecting;
00583
00584     resurrecting = 0;
00585
00586     status = Classify_File (finfo, tag, date, options, force_tag_match,
00587                 aflag, &vers, pipeout);
00588
00589     /* Keep track of whether TAG is a branch tag.
00590        Note that if it is a branch tag in some files and a nonbranch tag
00591        in others, treat it as a nonbranch tag.  It is possible that case
00592        should elicit a warning or an error.  */
00593     if (rewrite_tag
00594     && tag != NULL
00595     && finfo->rcs != NULL)
00596     {
00597     char *rev = RCS_getversion (finfo->rcs, tag, NULL, 1, NULL);
00598     if (rev != NULL
00599         && !RCS_nodeisbranch (finfo->rcs, tag))
00600         nonbranch = 1;
00601     if (rev != NULL)
00602         free (rev);
00603     }
00604
00605     if (pipeout)
00606     {
00607     /*
00608      * We just return success without doing anything if any of the really
00609      * funky cases occur
00610      *
00611      * If there is still a valid RCS file, do a regular checkout type
00612      * operation
00613      */
00614     switch (status)
00615     {
00616         case T_UNKNOWN:     /* unknown file was explicitly asked
00617                      * about */
00618         case T_REMOVE_ENTRY:    /* needs to be un-registered */
00619         case T_ADDED:       /* added but not committed */
00620         retval = 0;
00621         break;
00622         case T_CONFLICT:        /* old punt-type errors */
00623         retval = 1;
00624         break;
00625         case T_UPTODATE:        /* file was already up-to-date */
00626         case T_NEEDS_MERGE:     /* needs merging */
00627         case T_MODIFIED:        /* locally modified */
00628         case T_REMOVED:     /* removed but not committed */
00629         case T_CHECKOUT:        /* needs checkout */
00630 #ifdef SERVER_SUPPORT
00631         case T_PATCH:       /* needs patch */
00632 #endif
00633         retval = checkout_file (finfo, vers, 0, 0, 0);
00634         break;
00635
00636         default:            /* can't ever happen :-) */
00637         error (0, 0,
00638                "unknown file status %d for file %s", status, finfo->file);
00639         retval = 0;
00640         break;
00641     }
00642     }
00643     else
00644     {
00645     switch (status)
00646     {
00647         case T_UNKNOWN:     /* unknown file was explicitly asked
00648                      * about */
00649         case T_UPTODATE:        /* file was already up-to-date */
00650         retval = 0;
00651         break;
00652         case T_CONFLICT:        /* old punt-type errors */
00653         retval = 1;
00654         write_letter (finfo, 'C');
00655         break;
00656         case T_NEEDS_MERGE:     /* needs merging */
00657         retval = merge_file (finfo, vers);
00658         break;
00659         case T_MODIFIED:        /* locally modified */
00660         retval = 0;
00661                 if (toss_local_changes)
00662                 {
00663                     char *bakname;
00664                     bakname = backup_file (finfo->file, vers->vn_user);
00665                     /* This behavior is sufficiently unexpected to
00666                        justify overinformativeness, I think. */
00667 #ifdef SERVER_SUPPORT
00668                     if ((! really_quiet) && (! server_active))
00669 #else /* ! SERVER_SUPPORT */
00670                     if (! really_quiet)
00671 #endif /* SERVER_SUPPORT */
00672                         (void) printf ("(Locally modified %s moved to %s)\n",
00673                                        finfo->file, bakname);
00674                     free (bakname);
00675
00676                     /* The locally modified file is still present, but
00677                        it will be overwritten by the repository copy
00678                        after this. */
00679                     status = T_CHECKOUT;
00680                     retval = checkout_file (finfo, vers, 0, 0, 1);
00681                 }
00682                 else
00683                 {
00684                     if (vers->ts_conflict)
00685                     {
00686                         char *filestamp;
00687                         int retcode;
00688
00689                         /*
00690                          * If the timestamp has changed and no
00691                          * conflict indicators are found, it isn't a
00692                          * 'C' any more.
00693                          */
00694
00695 #ifdef SERVER_SUPPORT
00696                         if (server_active)
00697                             retcode = vers->ts_conflict[0] != '=';
00698                         else
00699                         {
00700                             filestamp = time_stamp (finfo->file);
00701                             retcode = strcmp (vers->ts_conflict, filestamp);
00702                             free (filestamp);
00703                         }
00704 #else
00705                         filestamp = time_stamp (finfo->file);
00706                         retcode = strcmp (vers->ts_conflict, filestamp);
00707                         free (filestamp);
00708 #endif
00709
00710                         if (retcode)
00711                         {
00712                             /* The timestamps differ.  But if there
00713                                are conflict markers print 'C' anyway.  */
00714                             retcode = !file_has_markers (finfo);
00715                         }
00716
00717                         if (!retcode)
00718                         {
00719                             write_letter (finfo, 'C');
00720                             retval = 1;
00721                         }
00722                         else
00723                         {
00724                             /* Reregister to clear conflict flag. */
00725                             Register (finfo->entries, finfo->file,
00726                                       vers->vn_rcs, vers->ts_rcs,
00727                                       vers->options, vers->tag,
00728                                       vers->date, (char *)0);
00729                         }
00730                     }
00731                     if (!retval)
00732                     {
00733                         write_letter (finfo, 'M');
00734                         retval = 0;
00735                     }
00736                 }
00737         break;
00738 #ifdef SERVER_SUPPORT
00739         case T_PATCH:       /* needs patch */
00740         if (patches)
00741         {
00742             int docheckout;
00743             struct stat file_info;
00744             unsigned char checksum[16];
00745
00746             retval = patch_file (finfo,
00747                      vers, &docheckout,
00748                      &file_info, checksum);
00749             if (! docheckout)
00750             {
00751                 if (server_active && retval == 0)
00752                 server_updated (finfo, vers,
00753                         (rcs_diff_patches
00754                          ? SERVER_RCS_DIFF
00755                          : SERVER_PATCHED),
00756                         file_info.st_mode, checksum,
00757                         (struct buffer *) NULL);
00758             break;
00759             }
00760         }
00761         /* If we're not running as a server, just check the
00762            file out.  It's simpler and faster than producing
00763            and applying patches.  */
00764         /* Fall through.  */
00765 #endif
00766         case T_CHECKOUT:        /* needs checkout */
00767         retval = checkout_file (finfo, vers, 0, 0, 1);
00768         break;
00769         case T_ADDED:       /* added but not committed */
00770         write_letter (finfo, 'A');
00771         retval = 0;
00772         break;
00773         case T_REMOVED:     /* removed but not committed */
00774         write_letter (finfo, 'R');
00775         retval = 0;
00776         break;
00777         case T_REMOVE_ENTRY:    /* needs to be un-registered */
00778         retval = scratch_file (finfo);
00779 #ifdef SERVER_SUPPORT
00780         if (server_active && retval == 0)
00781         {
00782             if (vers->ts_user == NULL)
00783             server_scratch_entry_only ();
00784             server_updated (finfo, vers,
00785                     SERVER_UPDATED, (mode_t) -1,
00786                     (unsigned char *) NULL,
00787                     (struct buffer *) NULL);
00788         }
00789 #endif
00790         break;
00791         default:            /* can't ever happen :-) */
00792         error (0, 0,
00793                "unknown file status %d for file %s", status, finfo->file);
00794         retval = 0;
00795         break;
00796     }
00797     }
00798
00799     /* only try to join if things have gone well thus far */
00800     if (retval == 0 && join_rev1)
00801     join_file (finfo, vers);
00802
00803     /* if this directory has an ignore list, add this file to it */
00804     if (ignlist)
00805     {
00806     Node *p;
00807
00808     p = getnode ();
00809     p->type = FILES;
00810     p->key = xstrdup (finfo->file);
00811     if (addnode (ignlist, p) != 0)
00812         freenode (p);
00813     }
00814
00815     freevers_ts (&vers);
00816     return (retval);
00817 }
00818
00819 static void update_ignproc PROTO ((char *, char *));
00820
00821 static void
00822 update_ignproc (file, dir)
00823     char *file;
00824     char *dir;
00825 {
00826     struct file_info finfo;
00827
00828     memset (&finfo, 0, sizeof (finfo));
00829     finfo.file = file;
00830     finfo.update_dir = dir;
00831     if (dir[0] == '\0')
00832     finfo.fullname = xstrdup (file);
00833     else
00834     {
00835     finfo.fullname = xmalloc (strlen (file) + strlen (dir) + 10);
00836     strcpy (finfo.fullname, dir);
00837     strcat (finfo.fullname, "/");
00838     strcat (finfo.fullname, file);
00839     }
00840
00841     write_letter (&finfo, '?');
00842     free (finfo.fullname);
00843 }
00844
00845 /* ARGSUSED */
00846 static int
00847 update_filesdone_proc (callerdat, err, repository, update_dir, entries)
00848     void *callerdat;
00849     int err;
00850     char *repository;
00851     char *update_dir;
00852     List *entries;
00853 {
00854     if (rewrite_tag)
00855     {
00856     WriteTag (NULL, tag, date, nonbranch, update_dir, repository);
00857     rewrite_tag = 0;
00858     }
00859
00860     /* if this directory has an ignore list, process it then free it */
00861     if (ignlist)
00862     {
00863     ignore_files (ignlist, entries, update_dir, update_ignproc);
00864     dellist (&ignlist);
00865     }
00866
00867     /* Clean up CVS admin dirs if we are export */
00868     if (strcmp (command_name, "export") == 0)
00869     {
00870     /* I'm not sure the existence_error is actually possible (except
00871        in cases where we really should print a message), but since
00872        this code used to ignore all errors, I'll play it safe.  */
00873     if (unlink_file_dir (CVSADM) < 0 && !existence_error (errno))
00874         error (0, errno, "cannot remove %s directory", CVSADM);
00875     }
00876 #ifdef SERVER_SUPPORT
00877     else if (!server_active && !pipeout)
00878 #else
00879     else if (!pipeout)
00880 #endif /* SERVER_SUPPORT */
00881     {
00882         /* If there is no CVS/Root file, add one */
00883         if (!isfile (CVSADM_ROOT))
00884         Create_Root ((char *) NULL, CVSroot_original);
00885     }
00886
00887     return (err);
00888 }
00889
00890 /*
00891  * update_dirent_proc () is called back by the recursion processor before a
00892  * sub-directory is processed for update.  In this case, update_dirent proc
00893  * will probably create the directory unless -d isn't specified and this is a
00894  * new directory.  A return code of 0 indicates the directory should be
00895  * processed by the recursion code.  A return of non-zero indicates the
00896  * recursion code should skip this directory.
00897  */
00898 static Dtype
00899 update_dirent_proc (callerdat, dir, repository, update_dir, entries)
00900     void *callerdat;
00901     char *dir;
00902     char *repository;
00903     char *update_dir;
00904     List *entries;
00905 {
00906     if (ignore_directory (update_dir))
00907     {
00908     /* print the warm fuzzy message */
00909     if (!quiet)
00910       error (0, 0, "Ignoring %s", update_dir);
00911         return R_SKIP_ALL;
00912     }
00913
00914     if (!isdir (dir))
00915     {
00916     /* if we aren't building dirs, blow it off */
00917     if (!update_build_dirs)
00918         return (R_SKIP_ALL);
00919
00920     /* Various CVS administrators are in the habit of removing
00921        the repository directory for things they don't want any
00922        more.  I've even been known to do it myself (on rare
00923        occasions).  Not the usual recommended practice, but we
00924        want to try to come up with some kind of
00925        reasonable/documented/sensible behavior.  Generally
00926        the behavior is to just skip over that directory (see
00927        dirs test in sanity.sh; the case which reaches here
00928        is when update -d is specified, and the working directory
00929        is gone but the subdirectory is still mentioned in
00930        CVS/Entries).  */
00931     if (1
00932 #ifdef SERVER_SUPPORT
00933         /* In the remote case, the client should refrain from
00934            sending us the directory in the first place.  So we
00935            want to continue to give an error, so clients make
00936            sure to do this.  */
00937         && !server_active
00938 #endif
00939         && !isdir (repository))
00940         return R_SKIP_ALL;
00941
00942     if (noexec)
00943     {
00944         /* ignore the missing dir if -n is specified */
00945         error (0, 0, "New directory `%s' -- ignored", update_dir);
00946         return (R_SKIP_ALL);
00947     }
00948     else
00949     {
00950         /* otherwise, create the dir and appropriate adm files */
00951
00952         /* If no tag or date were specified on the command line,
00953                and we're not using -A, we want the subdirectory to use
00954                the tag and date, if any, of the current directory.
00955                That way, update -d will work correctly when working on
00956                a branch.
00957
00958            We use TAG_UPDATE_DIR to undo the tag setting in
00959            update_dirleave_proc.  If we did not do this, we would
00960            not correctly handle a working directory with multiple
00961            tags (and maybe we should prohibit such working
00962            directories, but they work now and we shouldn't make
00963            them stop working without more thought).  */
00964         if ((tag == NULL && date == NULL) && ! aflag)
00965         {
00966         ParseTag (&tag, &date, &nonbranch);
00967         if (tag != NULL || date != NULL)
00968             tag_update_dir = xstrdup (update_dir);
00969         }
00970
00971         make_directory (dir);
00972         Create_Admin (dir, update_dir, repository, tag, date,
00973               /* This is a guess.  We will rewrite it later
00974                  via WriteTag.  */
00975               0,
00976               0,
00977               1);
00978         rewrite_tag = 1;
00979         nonbranch = 0;
00980         Subdir_Register (entries, (char *) NULL, dir);
00981     }
00982     }
00983     /* Do we need to check noexec here? */
00984     else if (!pipeout)
00985     {
00986     char *cvsadmdir;
00987
00988     /* The directory exists.  Check to see if it has a CVS
00989        subdirectory.  */
00990
00991     cvsadmdir = xmalloc (strlen (dir) + 80);
00992     strcpy (cvsadmdir, dir);
00993     strcat (cvsadmdir, "/");
00994     strcat (cvsadmdir, CVSADM);
00995
00996     if (!isdir (cvsadmdir))
00997     {
00998         /* We cannot successfully recurse into a directory without a CVS
00999            subdirectory.  Generally we will have already printed
01000            "? foo".  */
01001         free (cvsadmdir);
01002         return R_SKIP_ALL;
01003     }
01004     free (cvsadmdir);
01005     }
01006
01007     /*
01008      * If we are building dirs and not going to stdout, we make sure there is
01009      * no static entries file and write the tag file as appropriate
01010      */
01011     if (!pipeout)
01012     {
01013     if (update_build_dirs)
01014     {
01015         char *tmp;
01016
01017         tmp = xmalloc (strlen (dir) + sizeof (CVSADM_ENTSTAT) + 10);
01018         (void) sprintf (tmp, "%s/%s", dir, CVSADM_ENTSTAT);
01019         if (unlink_file (tmp) < 0 && ! existence_error (errno))
01020         error (1, errno, "cannot remove file %s", tmp);
01021 #ifdef SERVER_SUPPORT
01022         if (server_active)
01023         server_clear_entstat (update_dir, repository);
01024 #endif
01025         free (tmp);
01026     }
01027
01028     /* keep the CVS/Tag file current with the specified arguments */
01029     if (aflag || tag || date)
01030     {
01031         WriteTag (dir, tag, date, 0, update_dir, repository);
01032         rewrite_tag = 1;
01033         nonbranch = 0;
01034     }
01035
01036     /* initialize the ignore list for this directory */
01037     ignlist = getlist ();
01038     }
01039
01040     /* print the warm fuzzy message */
01041     if (!quiet)
01042     error (0, 0, "Updating %s", update_dir);
01043
01044     return (R_PROCESS);
01045 }
01046
01047 /*
01048  * update_dirleave_proc () is called back by the recursion code upon leaving
01049  * a directory.  It will prune empty directories if needed and will execute
01050  * any appropriate update programs.
01051  */
01052 /* ARGSUSED */
01053 static int
01054 update_dirleave_proc (callerdat, dir, err, update_dir, entries)
01055     void *callerdat;
01056     char *dir;
01057     int err;
01058     char *update_dir;
01059     List *entries;
01060 {
01061     FILE *fp;
01062
01063     /* Delete the ignore list if it hasn't already been done.  */
01064     if (ignlist)
01065     dellist (&ignlist);
01066
01067     /* If we set the tag or date for a new subdirectory in
01068        update_dirent_proc, and we're now done with that subdirectory,
01069        undo the tag/date setting.  Note that we know that the tag and
01070        date were both originally NULL in this case.  */
01071     if (tag_update_dir != NULL && strcmp (update_dir, tag_update_dir) == 0)
01072     {
01073     if (tag != NULL)
01074     {
01075         free (tag);
01076         tag = NULL;
01077     }
01078     if (date != NULL)
01079     {
01080         free (date);
01081         date = NULL;
01082     }
01083     nonbranch = 0;
01084     free (tag_update_dir);
01085     tag_update_dir = NULL;
01086     }
01087
01088     /* run the update_prog if there is one */
01089     /* FIXME: should be checking for errors from CVS_FOPEN and printing
01090        them if not existence_error.  */
01091     if (err == 0 && !pipeout && !noexec &&
01092     (fp = CVS_FOPEN (CVSADM_UPROG, "r")) != NULL)
01093     {
01094     char *cp;
01095     char *repository;
01096     char *line = NULL;
01097     size_t line_allocated = 0;
01098
01099     repository = Name_Repository ((char *) NULL, update_dir);
01100     if (getline (&line, &line_allocated, fp) >= 0)
01101     {
01102         if ((cp = strrchr (line, '\n')) != NULL)
01103         *cp = '\0';
01104         run_setup (line);
01105         run_arg (repository);
01106         cvs_output (program_name, 0);
01107         cvs_output (" ", 1);
01108         cvs_output (command_name, 0);
01109         cvs_output (": Executing '", 0);
01110         run_print (stdout);
01111         cvs_output ("'\n", 0);
01112         cvs_flushout ();
01113         (void) run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL);
01114     }
01115     else if (ferror (fp))
01116         error (0, errno, "cannot read %s", CVSADM_UPROG);
01117     else
01118         error (0, 0, "unexpected end of file on %s", CVSADM_UPROG);
01119
01120     if (fclose (fp) < 0)
01121         error (0, errno, "cannot close %s", CVSADM_UPROG);
01122     if (line != NULL)
01123         free (line);
01124     free (repository);
01125     }
01126
01127     if (strchr (dir, '/') == NULL)
01128     {
01129     /* FIXME: chdir ("..") loses with symlinks.  */
01130     /* Prune empty dirs on the way out - if necessary */
01131     (void) CVS_CHDIR ("..");
01132     if (update_prune_dirs && isemptydir (dir, 0))
01133     {
01134         /* I'm not sure the existence_error is actually possible (except
01135            in cases where we really should print a message), but since
01136            this code used to ignore all errors, I'll play it safe.  */
01137         if (unlink_file_dir (dir) < 0 && !existence_error (errno))
01138         error (0, errno, "cannot remove %s directory", dir);
01139         Subdir_Deregister (entries, (char *) NULL, dir);
01140     }
01141     }
01142
01143     return (err);
01144 }
01145
01146 static int isremoved PROTO ((Node *, void *));
01147
01148 /* Returns 1 if the file indicated by node has been removed.  */
01149 static int
01150 isremoved (node, closure)
01151     Node *node;
01152     void *closure;
01153 {
01154     Entnode *entdata = (Entnode*) node->data;
01155
01156     /* If the first character of the version is a '-', the file has been
01157        removed. */
01158     return (entdata->version && entdata->version[0] == '-') ? 1 : 0;
01159 }
01160
01161 /* Returns 1 if the argument directory is completely empty, other than the
01162    existence of the CVS directory entry.  Zero otherwise.  If MIGHT_NOT_EXIST
01163    and the directory doesn't exist, then just return 0.  */
01164 int
01165 isemptydir (dir, might_not_exist)
01166     char *dir;
01167     int might_not_exist;
01168 {
01169     DIR *dirp;
01170     struct dirent *dp;
01171
01172     if ((dirp = CVS_OPENDIR (dir)) == NULL)
01173     {
01174     if (might_not_exist && existence_error (errno))
01175         return 0;
01176     error (0, errno, "cannot open directory %s for empty check", dir);
01177     return (0);
01178     }
01179     errno = 0;
01180     while ((dp = readdir (dirp)) != NULL)
01181     {
01182     if (strcmp (dp->d_name, ".") != 0
01183         && strcmp (dp->d_name, "..") != 0)
01184     {
01185         if (strcmp (dp->d_name, CVSADM) != 0)
01186         {
01187         /* An entry other than the CVS directory.  The directory
01188            is certainly not empty. */
01189         (void) closedir (dirp);
01190         return (0);
01191         }
01192         else
01193         {
01194         /* The CVS directory entry.  We don't have to worry about
01195            this unless the Entries file indicates that files have
01196            been removed, but not committed, in this directory.
01197            (Removing the directory would prevent people from
01198            comitting the fact that they removed the files!) */
01199         List *l;
01200         int files_removed;
01201         struct saved_cwd cwd;
01202
01203         if (save_cwd (&cwd))
01204             error_exit ();
01205
01206         if (CVS_CHDIR (dir) < 0)
01207             error (1, errno, "cannot change directory to %s", dir);
01208         l = Entries_Open (0, NULL);
01209         files_removed = walklist (l, isremoved, 0);
01210         Entries_Close (l);
01211
01212         if (restore_cwd (&cwd, NULL))
01213             error_exit ();
01214         free_cwd (&cwd);
01215
01216         if (files_removed != 0)
01217         {
01218             /* There are files that have been removed, but not
01219                committed!  Do not consider the directory empty. */
01220             (void) closedir (dirp);
01221             return (0);
01222         }
01223         }
01224     }
01225     errno = 0;
01226     }
01227     if (errno != 0)
01228     {
01229     error (0, errno, "cannot read directory %s", dir);
01230     (void) closedir (dirp);
01231     return (0);
01232     }
01233     (void) closedir (dirp);
01234     return (1);
01235 }
01236
01237 /*
01238  * scratch the Entries file entry associated with a file
01239  */
01240 static int
01241 scratch_file (finfo)
01242     struct file_info *finfo;
01243 {
01244     history_write ('W', finfo->update_dir, "", finfo->file, finfo->repository);
01245     Scratch_Entry (finfo->entries, finfo->file);
01246     if (unlink_file (finfo->file) < 0 && ! existence_error (errno))
01247     error (0, errno, "unable to remove %s", finfo->fullname);
01248     return (0);
01249 }
01250
01251 /*
01252  * Check out a file.
01253  */
01254 static int
01255 checkout_file (finfo, vers_ts, adding, merging, update_server)
01256     struct file_info *finfo;
01257     Vers_TS *vers_ts;
01258     int adding;
01259     int merging;
01260     int update_server;
01261 {
01262     char *backup;
01263     int set_time, retval = 0;
01264     int status;
01265     int file_is_dead;
01266     struct buffer *revbuf;
01267
01268     backup = NULL;
01269     revbuf = NULL;
01270
01271     /* Don't screw with backup files if we're going to stdout, or if
01272        we are the server.  */
01273     if (!pipeout
01274 #ifdef SERVER_SUPPORT
01275     && ! server_active
01276 #endif
01277     )
01278     {
01279     backup = xmalloc (strlen (finfo->file)
01280               + sizeof (CVSADM)
01281               + sizeof (CVSPREFIX)
01282               + 10);
01283     (void) sprintf (backup, "%s/%s%s", CVSADM, CVSPREFIX, finfo->file);
01284     if (isfile (finfo->file))
01285         rename_file (finfo->file, backup);
01286     else
01287     {
01288         /* If -f/-t wrappers are being used to wrap up a directory,
01289            then backup might be a directory instead of just a file.  */
01290         if (unlink_file_dir (backup) < 0)
01291         {
01292         /* Not sure if the existence_error check is needed here.  */
01293         if (!existence_error (errno))
01294             /* FIXME: should include update_dir in message.  */
01295             error (0, errno, "error removing %s", backup);
01296         }
01297         free (backup);
01298         backup = NULL;
01299     }
01300     }
01301
01302     file_is_dead = RCS_isdead (vers_ts->srcfile, vers_ts->vn_rcs);
01303
01304     if (!file_is_dead)
01305     {
01306     /*
01307      * if we are checking out to stdout, print a nice message to
01308      * stderr, and add the -p flag to the command */
01309     if (pipeout)
01310     {
01311         if (!quiet)
01312         {
01313         cvs_outerr ("\
01314 ===================================================================\n\
01315 Checking out ", 0);
01316         cvs_outerr (finfo->fullname, 0);
01317         cvs_outerr ("\n\
01318 RCS:  ", 0);
01319         cvs_outerr (vers_ts->srcfile->path, 0);
01320         cvs_outerr ("\n\
01321 VERS: ", 0);
01322         cvs_outerr (vers_ts->vn_rcs, 0);
01323         cvs_outerr ("\n***************\n", 0);
01324         }
01325     }
01326
01327 #ifdef SERVER_SUPPORT
01328     if (update_server
01329         && server_active
01330         && ! pipeout
01331         && ! file_gzip_level
01332         && ! joining ()
01333         && ! wrap_name_has (finfo->file, WRAP_FROMCVS))
01334     {
01335         revbuf = buf_nonio_initialize ((BUFMEMERRPROC) NULL);
01336         status = RCS_checkout (vers_ts->srcfile, (char *) NULL,
01337                    vers_ts->vn_rcs, vers_ts->vn_tag,
01338                    vers_ts->options, RUN_TTY,
01339                    checkout_to_buffer, revbuf);
01340     }
01341     else
01342 #endif
01343         status = RCS_checkout (vers_ts->srcfile,
01344                    pipeout ? NULL : finfo->file,
01345                    vers_ts->vn_rcs, vers_ts->vn_tag,
01346                    vers_ts->options, RUN_TTY,
01347                    (RCSCHECKOUTPROC) NULL, (void *) NULL);
01348     }
01349     if (file_is_dead || status == 0)
01350     {
01351     mode_t mode;
01352
01353     mode = (mode_t) -1;
01354
01355     if (!pipeout)
01356     {
01357         Vers_TS *xvers_ts;
01358
01359         if (revbuf != NULL && !noexec)
01360         {
01361         struct stat sb;
01362
01363         /* FIXME: We should have RCS_checkout return the mode.
01364            That would also fix the kludge with noexec, above, which
01365            is here only because noexec doesn't write srcfile->path
01366            for us to stat.  */
01367         if (stat (vers_ts->srcfile->path, &sb) < 0)
01368             error (1, errno, "cannot stat %s",
01369                vers_ts->srcfile->path);
01370         mode = sb.st_mode &~ (S_IWRITE | S_IWGRP | S_IWOTH);
01371         }
01372
01373         if (cvswrite
01374         && !file_is_dead
01375         && !fileattr_get (finfo->file, "_watched"))
01376         {
01377         if (revbuf == NULL)
01378             xchmod (finfo->file, 1);
01379         else
01380         {
01381             /* We know that we are the server here, so
01382                        although xchmod checks umask, we don't bother.  */
01383             mode |= (((mode & S_IRUSR) ? S_IWUSR : 0)
01384                  | ((mode & S_IRGRP) ? S_IWGRP : 0)
01385                  | ((mode & S_IROTH) ? S_IWOTH : 0));
01386         }
01387         }
01388
01389         {
01390         /* A newly checked out file is never under the spell
01391            of "cvs edit".  If we think we were editing it
01392            from a previous life, clean up.  Would be better to
01393            check for same the working directory instead of
01394            same user, but that is hairy.  */
01395
01396         struct addremove_args args;
01397
01398         editor_set (finfo->file, getcaller (), NULL);
01399
01400         memset (&args, 0, sizeof args);
01401         args.remove_temp = 1;
01402         watch_modify_watchers (finfo->file, &args);
01403         }
01404
01405         /* set the time from the RCS file iff it was unknown before */
01406         set_time =
01407         (!noexec
01408          && (vers_ts->vn_user == NULL ||
01409              strncmp (vers_ts->ts_rcs, "Initial", 7) == 0)
01410          && !file_is_dead);
01411
01412         wrap_fromcvs_process_file (finfo->file);
01413
01414         xvers_ts = Version_TS (finfo, options, tag, date,
01415                    force_tag_match, set_time);
01416         if (strcmp (xvers_ts->options, "-V4") == 0)
01417         xvers_ts->options[0] = '\0';
01418
01419         if (revbuf != NULL)
01420         {
01421         /* If we stored the file data into a buffer, then we
01422                    didn't create a file at all, so xvers_ts->ts_user
01423                    is wrong.  The correct value is to have it be the
01424                    same as xvers_ts->ts_rcs, meaning that the working
01425                    file is unchanged from the RCS file.
01426
01427            FIXME: We should tell Version_TS not to waste time
01428            statting the nonexistent file.
01429
01430            FIXME: Actually, I don't think the ts_user value
01431            matters at all here.  The only use I know of is
01432            that it is printed in a trace message by
01433            Server_Register.  */
01434
01435         if (xvers_ts->ts_user != NULL)
01436             free (xvers_ts->ts_user);
01437         xvers_ts->ts_user = xstrdup (xvers_ts->ts_rcs);
01438         }
01439
01440         (void) time (&last_register_time);
01441
01442         if (file_is_dead)
01443         {
01444         if (xvers_ts->vn_user != NULL)
01445         {
01446             error (0, 0,
01447                "warning: %s is not (any longer) pertinent",
01448                finfo->fullname);
01449         }
01450         Scratch_Entry (finfo->entries, finfo->file);
01451 #ifdef SERVER_SUPPORT
01452         if (server_active && xvers_ts->ts_user == NULL)
01453             server_scratch_entry_only ();
01454 #endif
01455         /* FIXME: Rather than always unlink'ing, and ignoring the
01456            existence_error, we should do the unlink only if
01457            vers_ts->ts_user is non-NULL.  Then there would be no
01458            need to ignore an existence_error (for example, if the
01459            user removes the file while we are running).  */
01460         if (unlink_file (finfo->file) < 0 && ! existence_error (errno))
01461         {
01462             error (0, errno, "cannot remove %s", finfo->fullname);
01463         }
01464         }
01465         else
01466         Register (finfo->entries, finfo->file,
01467               adding ? "0" : xvers_ts->vn_rcs,
01468               xvers_ts->ts_user, xvers_ts->options,
01469               xvers_ts->tag, xvers_ts->date,
01470               (char *)0); /* Clear conflict flag on fresh checkout */
01471
01472         /* fix up the vers structure, in case it is used by join */
01473         if (join_rev1)
01474         {
01475         if (vers_ts->vn_user != NULL)
01476             free (vers_ts->vn_user);
01477         if (vers_ts->vn_rcs != NULL)
01478             free (vers_ts->vn_rcs);
01479         vers_ts->vn_user = xstrdup (xvers_ts->vn_rcs);
01480         vers_ts->vn_rcs = xstrdup (xvers_ts->vn_rcs);
01481         }
01482
01483         /* If this is really Update and not Checkout, recode history */
01484         if (strcmp (command_name, "update") == 0)
01485         history_write ('U', finfo->update_dir, xvers_ts->vn_rcs, finfo->file,
01486                    finfo->repository);
01487
01488         freevers_ts (&xvers_ts);
01489
01490         if (!really_quiet && !file_is_dead)
01491         {
01492         write_letter (finfo, 'U');
01493         }
01494     }
01495
01496 #ifdef SERVER_SUPPORT
01497     if (update_server && server_active)
01498         server_updated (finfo, vers_ts,
01499                 merging ? SERVER_MERGED : SERVER_UPDATED,
01500                 mode, (unsigned char *) NULL, revbuf);
01501 #endif
01502     }
01503     else
01504     {
01505     if (backup != NULL)
01506     {
01507         rename_file (backup, finfo->file);
01508         free (backup);
01509         backup = NULL;
01510     }
01511
01512     error (0, 0, "could not check out %s", finfo->fullname);
01513
01514     retval = status;
01515     }
01516
01517     if (backup != NULL)
01518     {
01519     /* If -f/-t wrappers are being used to wrap up a directory,
01520        then backup might be a directory instead of just a file.  */
01521     if (unlink_file_dir (backup) < 0)
01522     {
01523         /* Not sure if the existence_error check is needed here.  */
01524         if (!existence_error (errno))
01525         /* FIXME: should include update_dir in message.  */
01526         error (0, errno, "error removing %s", backup);
01527     }
01528     free (backup);
01529     }
01530
01531     return (retval);
01532 }
01533
01534 #ifdef SERVER_SUPPORT
01535
01536 /* This function is used to write data from a file being checked out
01537    into a buffer.  */
01538
01539 static void
01540 checkout_to_buffer (callerdat, data, len)
01541      void *callerdat;
01542      const char *data;
01543      size_t len;
01544 {
01545     struct buffer *buf = (struct buffer *) callerdat;
01546
01547     buf_output (buf, data, len);
01548 }
01549
01550 #endif /* SERVER_SUPPORT */
01551
01552 #ifdef SERVER_SUPPORT
01553
01554 /* This structure is used to pass information between patch_file and
01555    patch_file_write.  */
01556
01557 struct patch_file_data
01558 {
01559     /* File name, for error messages.  */
01560     const char *filename;
01561     /* File to which to write.  */
01562     FILE *fp;
01563     /* Whether to compute the MD5 checksum.  */
01564     int compute_checksum;
01565     /* Data structure for computing the MD5 checksum.  */
01566     struct cvs_MD5Context context;
01567     /* Set if the file has a final newline.  */
01568     int final_nl;
01569 };
01570
01571 /* Patch a file.  Runs diff.  This is only done when running as the
01572  * server.  The hope is that the diff will be smaller than the file
01573  * itself.
01574  */
01575 static int
01576 patch_file (finfo, vers_ts, docheckout, file_info, checksum)
01577     struct file_info *finfo;
01578     Vers_TS *vers_ts;
01579     int *docheckout;
01580     struct stat *file_info;
01581     unsigned char *checksum;
01582 {
01583     char *backup;
01584     char *file1;
01585     char *file2;
01586     int retval = 0;
01587     int retcode = 0;
01588     int fail;
01589     FILE *e;
01590     struct patch_file_data data;
01591
01592     *docheckout = 0;
01593
01594     if (noexec || pipeout || joining ())
01595     {
01596     *docheckout = 1;
01597     return 0;
01598     }
01599
01600     /* If this file has been marked as being binary, then never send a
01601        patch.  */
01602     if (strcmp (vers_ts->options, "-kb") == 0)
01603     {
01604     *docheckout = 1;
01605     return 0;
01606     }
01607
01608     /* First check that the first revision exists.  If it has been nuked
01609        by cvs admin -o, then just fall back to checking out entire
01610        revisions.  In some sense maybe we don't have to do this; after
01611        all cvs.texinfo says "Make sure that no-one has checked out a
01612        copy of the revision you outdate" but then again, that advice
01613        doesn't really make complete sense, because "cvs admin" operates
01614        on a working directory and so _someone_ will almost always have
01615        _some_ revision checked out.  */
01616     {
01617     char *rev;
01618
01619     rev = RCS_gettag (finfo->rcs, vers_ts->vn_user, 1, NULL);
01620     if (rev == NULL)
01621     {
01622         *docheckout = 1;
01623         return 0;
01624     }
01625     else
01626         free (rev);
01627     }
01628
01629     /* If the revision is dead, let checkout_file handle it rather
01630        than duplicating the processing here.  */
01631     if (RCS_isdead (vers_ts->srcfile, vers_ts->vn_rcs))
01632     {
01633     *docheckout = 1;
01634     return 0;
01635     }
01636
01637     backup = xmalloc (strlen (finfo->file)
01638               + sizeof (CVSADM)
01639               + sizeof (CVSPREFIX)
01640               + 10);
01641     (void) sprintf (backup, "%s/%s%s", CVSADM, CVSPREFIX, finfo->file);
01642     if (isfile (finfo->file))
01643         rename_file (finfo->file, backup);
01644     else
01645     {
01646     if (unlink_file (backup) < 0
01647         && !existence_error (errno))
01648         error (0, errno, "cannot remove %s", backup);
01649     }
01650
01651     file1 = xmalloc (strlen (finfo->file)
01652              + sizeof (CVSADM)
01653              + sizeof (CVSPREFIX)
01654              + 10);
01655     (void) sprintf (file1, "%s/%s%s-1", CVSADM, CVSPREFIX, finfo->file);
01656     file2 = xmalloc (strlen (finfo->file)
01657              + sizeof (CVSADM)
01658              + sizeof (CVSPREFIX)
01659              + 10);
01660     (void) sprintf (file2, "%s/%s%s-2", CVSADM, CVSPREFIX, finfo->file);
01661
01662     fail = 0;
01663
01664     /* We need to check out both revisions first, to see if either one
01665        has a trailing newline.  Because of this, we don't use rcsdiff,
01666        but just use diff.  */
01667
01668     e = CVS_FOPEN (file1, "w");
01669     if (e == NULL)
01670     error (1, errno, "cannot open %s", file1);
01671
01672     data.filename = file1;
01673     data.fp = e;
01674     data.final_nl = 0;
01675     data.compute_checksum = 0;
01676
01677     retcode = RCS_checkout (vers_ts->srcfile, (char *) NULL,
01678                 vers_ts->vn_user, (char *) NULL,
01679                 vers_ts->options, RUN_TTY,
01680                 patch_file_write, (void *) &data);
01681
01682     if (fclose (e) < 0)
01683     error (1, errno, "cannot close %s", file1);
01684
01685     if (retcode != 0 || ! data.final_nl)
01686     fail = 1;
01687
01688     if (! fail)
01689     {
01690     e = CVS_FOPEN (file2, "w");
01691     if (e == NULL)
01692         error (1, errno, "cannot open %s", file2);
01693
01694     data.filename = file2;
01695     data.fp = e;
01696     data.final_nl = 0;
01697     data.compute_checksum = 1;
01698     cvs_MD5Init (&data.context);
01699
01700     retcode = RCS_checkout (vers_ts->srcfile, (char *) NULL,
01701                 vers_ts->vn_rcs, vers_ts->vn_tag,
01702                 vers_ts->options, RUN_TTY,
01703                 patch_file_write, (void *) &data);
01704
01705     if (fclose (e) < 0)
01706         error (1, errno, "cannot close %s", file2);
01707
01708     if (retcode != 0 || ! data.final_nl)
01709         fail = 1;
01710     else
01711         cvs_MD5Final (checksum, &data.context);
01712     }
01713
01714     retcode = 0;
01715     if (! fail)
01716     {
01717     char *diff_options;
01718
01719     /* If the client does not support the Rcs-diff command, we
01720            send a context diff, and the client must invoke patch.
01721            That approach was problematical for various reasons.  The
01722            new approach only requires running diff in the server; the
01723            client can handle everything without invoking an external
01724            program.  */
01725     if (! rcs_diff_patches)
01726     {
01727         /* We use -c, not -u, because that is what CVS has
01728            traditionally used.  Kind of a moot point, now that
01729            Rcs-diff is preferred, so there is no point in making
01730            the compatibility issues worse.  */
01731         diff_options = "-c";
01732     }
01733     else
01734     {
01735         /* Now that diff is librarified, we could be passing -a if
01736            we wanted to.  However, it is unclear to me whether we
01737            would want to.  Does diff -a, in any significant
01738            percentage of cases, produce patches which are smaller
01739            than the files it is patching?  I guess maybe text
01740            files with character sets which diff regards as
01741            'binary'.  Conversely, do they tend to be much larger
01742            in the bad cases?  This needs some more
01743            thought/investigation, I suspect.  */
01744
01745         diff_options = "-n";
01746     }
01747     retcode = diff_exec (file1, file2, diff_options, finfo->file);
01748
01749     /* A retcode of 0 means no differences.  1 means some differences.  */
01750     if (retcode != 0
01751         && retcode != 1)
01752     {
01753         fail = 1;
01754     }
01755     else
01756     {
01757 #define BINARY "Binary"
01758         char buf[sizeof BINARY];
01759         unsigned int c;
01760
01761         /* Stat the original RCS file, and then adjust it the way
01762            that RCS_checkout would.  FIXME: This is an abstraction
01763            violation.  */
01764         if (CVS_STAT (vers_ts->srcfile->path, file_info) < 0)
01765         error (1, errno, "could not stat %s", vers_ts->srcfile->path);
01766         if (chmod (finfo->file,
01767                file_info->st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH))
01768         < 0)
01769         error (0, errno, "cannot change mode of file %s", finfo->file);
01770         if (cvswrite
01771         && !fileattr_get (finfo->file, "_watched"))
01772         xchmod (finfo->file, 1);
01773
01774         /* Check the diff output to make sure patch will be handle it.  */
01775         e = CVS_FOPEN (finfo->file, "r");
01776         if (e == NULL)
01777         error (1, errno, "could not open diff output file %s",
01778                finfo->fullname);
01779         c = fread (buf, 1, sizeof BINARY - 1, e);
01780         buf[c] = '\0';
01781         if (strcmp (buf, BINARY) == 0)
01782         {
01783         /* These are binary files.  We could use diff -a, but
01784            patch can't handle that.  */
01785         fail = 1;
01786         }
01787         fclose (e);
01788     }
01789     }
01790
01791     if (! fail)
01792     {
01793         Vers_TS *xvers_ts;
01794
01795         /* This stuff is just copied blindly from checkout_file.  I
01796        don't really know what it does.  */
01797         xvers_ts = Version_TS (finfo, options, tag, date,
01798                    force_tag_match, 0);
01799     if (strcmp (xvers_ts->options, "-V4") == 0)
01800         xvers_ts->options[0] = '\0';
01801
01802     Register (finfo->entries, finfo->file, xvers_ts->vn_rcs,
01803           xvers_ts->ts_user, xvers_ts->options,
01804           xvers_ts->tag, xvers_ts->date, NULL);
01805
01806     if (CVS_STAT (finfo->file, file_info) < 0)
01807         error (1, errno, "could not stat %s", finfo->file);
01808
01809     /* If this is really Update and not Checkout, recode history */
01810     if (strcmp (command_name, "update") == 0)
01811         history_write ('P', finfo->update_dir, xvers_ts->vn_rcs, finfo->file,
01812                finfo->repository);
01813
01814     freevers_ts (&xvers_ts);
01815
01816     if (!really_quiet)
01817     {
01818         write_letter (finfo, 'P');
01819     }
01820     }
01821     else
01822     {
01823     int old_errno = errno;      /* save errno value over the rename */
01824
01825     if (isfile (backup))
01826         rename_file (backup, finfo->file);
01827
01828     if (retcode != 0 && retcode != 1)
01829         error (retcode == -1 ? 1 : 0, retcode == -1 ? old_errno : 0,
01830            "could not diff %s", finfo->fullname);
01831
01832     *docheckout = 1;
01833     retval = retcode;
01834     }
01835
01836     if (unlink_file (backup) < 0
01837     && !existence_error (errno))
01838     error (0, errno, "cannot remove %s", backup);
01839     if (unlink_file (file1) < 0
01840     && !existence_error (errno))
01841     error (0, errno, "cannot remove %s", file1);
01842     if (unlink_file (file2) < 0
01843     && !existence_error (errno))
01844     error (0, errno, "cannot remove %s", file2);
01845
01846     free (backup);
01847     free (file1);
01848     free (file2);
01849     return (retval);
01850 }
01851
01852 /* Write data to a file.  Record whether the last byte written was a
01853    newline.  Optionally compute a checksum.  This is called by
01854    patch_file via RCS_checkout.  */
01855
01856 static void
01857 patch_file_write (callerdat, buffer, len)
01858      void *callerdat;
01859      const char *buffer;
01860      size_t len;
01861 {
01862     struct patch_file_data *data = (struct patch_file_data *) callerdat;
01863
01864     if (fwrite (buffer, 1, len, data->fp) != len)
01865     error (1, errno, "cannot write %s", data->filename);
01866
01867     data->final_nl = (buffer[len - 1] == '\n');
01868
01869     if (data->compute_checksum)
01870     cvs_MD5Update (&data->context, (unsigned char *) buffer, len);
01871 }
01872
01873 #endif /* SERVER_SUPPORT */
01874
01875 /*
01876  * Several of the types we process only print a bit of information consisting
01877  * of a single letter and the name.
01878  */
01879 static void
01880 write_letter (finfo, letter)
01881     struct file_info *finfo;
01882     int letter;
01883 {
01884     if (!really_quiet)
01885     {
01886     char *tag = NULL;
01887     /* Big enough for "+updated" or any of its ilk.  */
01888     char buf[80];
01889
01890     switch (letter)
01891     {
01892         case 'U':
01893         tag = "updated";
01894         break;
01895         default:
01896         /* We don't yet support tagged output except for "U".  */
01897         break;
01898     }
01899
01900     if (tag != NULL)
01901     {
01902         sprintf (buf, "+%s", tag);
01903         cvs_output_tagged (buf, NULL);
01904     }
01905     buf[0] = letter;
01906     buf[1] = ' ';
01907     buf[2] = '\0';
01908     cvs_output_tagged ("text", buf);
01909     cvs_output_tagged ("fname", finfo->fullname);
01910     cvs_output_tagged ("newline", NULL);
01911     if (tag != NULL)
01912     {
01913         sprintf (buf, "-%s", tag);
01914         cvs_output_tagged (buf, NULL);
01915     }
01916     }
01917     return;
01918 }
01919
01920 /*
01921  * Do all the magic associated with a file which needs to be merged
01922  */
01923 static int
01924 merge_file (finfo, vers)
01925     struct file_info *finfo;
01926     Vers_TS *vers;
01927 {
01928     char *backup;
01929     int status;
01930     int retcode = 0;
01931     int retval;
01932
01933     /*
01934      * The users currently modified file is moved to a backup file name
01935      * ".#filename.version", so that it will stay around for a few days
01936      * before being automatically removed by some cron daemon.  The "version"
01937      * is the version of the file that the user was most up-to-date with
01938      * before the merge.
01939      */
01940     backup = xmalloc (strlen (finfo->file)
01941               + strlen (vers->vn_user)
01942               + sizeof (BAKPREFIX)
01943               + 10);
01944     (void) sprintf (backup, "%s%s.%s", BAKPREFIX, finfo->file, vers->vn_user);
01945
01946     if (unlink_file (backup) && !existence_error (errno))
01947     error (0, errno, "unable to remove %s", backup);
01948     copy_file (finfo->file, backup);
01949     xchmod (finfo->file, 1);
01950
01951     if (strcmp (vers->options, "-kb") == 0
01952     || wrap_merge_is_copy (finfo->file)
01953     || special_file_mismatch (finfo, NULL, vers->vn_rcs))
01954     {
01955     /* For binary files, a merge is always a conflict.  Same for
01956        files whose permissions or linkage do not match.  We give the
01957        user the two files, and let them resolve it.  It is possible
01958        that we should require a "touch foo" or similar step before
01959        we allow a checkin.  */
01960
01961     /* TODO: it may not always be necessary to regard a permission
01962        mismatch as a conflict.  The working file and the RCS file
01963        have a common ancestor `A'; if the working file's permissions
01964        match A's, then it's probably safe to overwrite them with the
01965        RCS permissions.  Only if the working file, the RCS file, and
01966        A all disagree should this be considered a conflict.  But more
01967        thought needs to go into this, and in the meantime it is safe
01968        to treat any such mismatch as an automatic conflict. -twp */
01969
01970 #ifdef SERVER_SUPPORT
01971     if (server_active)
01972         server_copy_file (finfo->file, finfo->update_dir,
01973                   finfo->repository, backup);
01974 #endif
01975
01976     status = checkout_file (finfo, vers, 0, 1, 1);
01977
01978     /* Is there a better term than "nonmergeable file"?  What we
01979        really mean is, not something that CVS cannot or does not
01980        want to merge (there might be an external manual or
01981        automatic merge process).  */
01982     error (0, 0, "nonmergeable file needs merge");
01983     error (0, 0, "revision %s from repository is now in %s",
01984            vers->vn_rcs, finfo->fullname);
01985     error (0, 0, "file from working directory is now in %s", backup);
01986     write_letter (finfo, 'C');
01987
01988     history_write ('C', finfo->update_dir, vers->vn_rcs, finfo->file,
01989                finfo->repository);
01990     retval = 0;
01991     goto out;
01992     }
01993
01994     status = RCS_merge(finfo->rcs, vers->srcfile->path, finfo->file,
01995                vers->options, vers->vn_user, vers->vn_rcs);
01996     if (status != 0 && status != 1)
01997     {
01998     error (0, status == -1 ? errno : 0,
01999            "could not merge revision %s of %s", vers->vn_user, finfo->fullname);
02000     error (status == -1 ? 1 : 0, 0, "restoring %s from backup file %s",
02001            finfo->fullname, backup);
02002     rename_file (backup, finfo->file);
02003     retval = 1;
02004     goto out;
02005     }
02006
02007     if (strcmp (vers->options, "-V4") == 0)
02008     vers->options[0] = '\0';
02009
02010     /* This file is the result of a merge, which means that it has
02011        been modified.  We use a special timestamp string which will
02012        not compare equal to any actual timestamp.  */
02013     {
02014     char *cp = 0;
02015
02016     if (status)
02017     {
02018         (void) time (&last_register_time);
02019         cp = time_stamp (finfo->file);
02020     }
02021     Register (finfo->entries, finfo->file, vers->vn_rcs,
02022           "Result of merge", vers->options, vers->tag,
02023           vers->date, cp);
02024     if (cp)
02025         free (cp);
02026     }
02027
02028     /* fix up the vers structure, in case it is used by join */
02029     if (join_rev1)
02030     {
02031     if (vers->vn_user != NULL)
02032         free (vers->vn_user);
02033     vers->vn_user = xstrdup (vers->vn_rcs);
02034     }
02035
02036 #ifdef SERVER_SUPPORT
02037     /* Send the new contents of the file before the message.  If we
02038        wanted to be totally correct, we would have the client write
02039        the message only after the file has safely been written.  */
02040     if (server_active)
02041     {
02042         server_copy_file (finfo->file, finfo->update_dir, finfo->repository,
02043               backup);
02044     server_updated (finfo, vers, SERVER_MERGED,
02045             (mode_t) -1, (unsigned char *) NULL,
02046             (struct buffer *) NULL);
02047     }
02048 #endif
02049
02050     /* FIXME: the noexec case is broken.  RCS_merge could be doing the
02051        xcmp on the temporary files without much hassle, I think.  */
02052     if (!noexec && !xcmp (backup, finfo->file))
02053     {
02054     cvs_output (finfo->fullname, 0);
02055     cvs_output (" already contains the differences between ", 0);
02056     cvs_output (vers->vn_user, 0);
02057     cvs_output (" and ", 0);
02058     cvs_output (vers->vn_rcs, 0);
02059     cvs_output ("\n", 1);
02060
02061     history_write ('G', finfo->update_dir, vers->vn_rcs, finfo->file,
02062                finfo->repository);
02063     retval = 0;
02064     goto out;
02065     }
02066
02067     if (status == 1)
02068     {
02069     error (0, 0, "conflicts found in %s", finfo->fullname);
02070
02071     write_letter (finfo, 'C');
02072
02073     history_write ('C', finfo->update_dir, vers->vn_rcs, finfo->file, finfo->repository);
02074
02075     }
02076     else if (retcode == -1)
02077     {
02078     error (1, errno, "fork failed while examining update of %s",
02079            finfo->fullname);
02080     }
02081     else
02082     {
02083     write_letter (finfo, 'M');
02084     history_write ('G', finfo->update_dir, vers->vn_rcs, finfo->file,
02085                finfo->repository);
02086     }
02087     retval = 0;
02088  out:
02089     free (backup);
02090     return retval;
02091 }
02092
02093 /*
02094  * Do all the magic associated with a file which needs to be joined
02095  * (-j option)
02096  */
02097 static void
02098 join_file (finfo, vers)
02099     struct file_info *finfo;
02100     Vers_TS *vers;
02101 {
02102     char *backup;
02103     char *t_options;
02104     int status;
02105
02106     char *rev1;
02107     char *rev2;
02108     char *jrev1;
02109     char *jrev2;
02110     char *jdate1;
02111     char *jdate2;
02112
02113     jrev1 = join_rev1;
02114     jrev2 = join_rev2;
02115     jdate1 = date_rev1;
02116     jdate2 = date_rev2;
02117
02118     /* Determine if we need to do anything at all.  */
02119     if (vers->srcfile == NULL ||
02120     vers->srcfile->path == NULL)
02121     {
02122     return;
02123     }
02124
02125     /* If only one join revision is specified, it becomes the second
02126        revision.  */
02127     if (jrev2 == NULL)
02128     {
02129     jrev2 = jrev1;
02130     jrev1 = NULL;
02131     jdate2 = jdate1;
02132     jdate1 = NULL;
02133     }
02134
02135     /* Convert the second revision, walking branches and dates.  */
02136     rev2 = RCS_getversion (vers->srcfile, jrev2, jdate2, 1, (int *) NULL);
02137
02138     /* If this is a merge of two revisions, get the first revision.
02139        If only one join tag was specified, then the first revision is
02140        the greatest common ancestor of the second revision and the
02141        working file.  */
02142     if (jrev1 != NULL)
02143     rev1 = RCS_getversion (vers->srcfile, jrev1, jdate1, 1, (int *) NULL);
02144     else
02145     {
02146     /* Note that we use vn_rcs here, since vn_user may contain a
02147            special string such as "-nn".  */
02148     if (vers->vn_rcs == NULL)
02149         rev1 = NULL;
02150     else if (rev2 == NULL)
02151     {
02152         /* This means that the file never existed on the branch.
02153                It does not mean that the file was removed on the
02154                branch: that case is represented by a dead rev2.  If
02155                the file never existed on the branch, then we have
02156                nothing to merge, so we just return.  */
02157         return;
02158     }
02159     else
02160         rev1 = gca (vers->vn_rcs, rev2);
02161     }
02162
02163     /* Handle a nonexistent or dead merge target.  */
02164     if (rev2 == NULL || RCS_isdead (vers->srcfile, rev2))
02165     {
02166     char *mrev;
02167
02168     if (rev2 != NULL)
02169         free (rev2);
02170
02171     /* If the first revision doesn't exist either, then there is
02172            no change between the two revisions, so we don't do
02173            anything.  */
02174     if (rev1 == NULL || RCS_isdead (vers->srcfile, rev1))
02175     {
02176         if (rev1 != NULL)
02177         free (rev1);
02178         return;
02179     }
02180
02181     /* If we are merging two revisions, then the file was removed
02182        between the first revision and the second one.  In this
02183        case we want to mark the file for removal.
02184
02185        If we are merging one revision, then the file has been
02186        removed between the greatest common ancestor and the merge
02187        revision.  From the perspective of the branch on to which
02188        we ar emerging, which may be the trunk, either 1) the file
02189        does not currently exist on the target, or 2) the file has
02190        not been modified on the target branch since the greatest
02191        common ancestor, or 3) the file has been modified on the
02192        target branch since the greatest common ancestor.  In case
02193        1 there is nothing to do.  In case 2 we mark the file for
02194        removal.  In case 3 we have a conflict.
02195
02196        Note that the handling is slightly different depending upon
02197        whether one or two join targets were specified.  If two
02198        join targets were specified, we don't check whether the
02199        file was modified since a given point.  My reasoning is
02200        that if you ask for an explicit merge between two tags,
02201        then you want to merge in whatever was changed between
02202        those two tags.  If a file was removed between the two
02203        tags, then you want it to be removed.  However, if you ask
02204        for a merge of a branch, then you want to merge in all
02205        changes which were made on the branch.  If a file was
02206        removed on the branch, that is a change to the file.  If
02207        the file was also changed on the main line, then that is
02208        also a change.  These two changes--the file removal and the
02209        modification--must be merged.  This is a conflict.  */
02210
02211     /* If the user file is dead, or does not exist, or has been
02212            marked for removal, then there is nothing to do.  */
02213     if (vers->vn_user == NULL
02214         || vers->vn_user[0] == '-'
02215         || RCS_isdead (vers->srcfile, vers->vn_user))
02216     {
02217         if (rev1 != NULL)
02218         free (rev1);
02219         return;
02220     }
02221
02222     /* If the user file has been marked for addition, or has been
02223        locally modified, then we have a conflict which we can not
02224        resolve.  No_Difference will already have been called in
02225        this case, so comparing the timestamps is sufficient to
02226        determine whether the file is locally modified.  */
02227     if (strcmp (vers->vn_user, "0") == 0
02228         || (vers->ts_user != NULL
02229         && strcmp (vers->ts_user, vers->ts_rcs) != 0))
02230     {
02231         if (jdate2 != NULL)
02232         error (0, 0,
02233                "file %s is locally modified, but has been removed in revision %s as of %s",
02234                finfo->fullname, jrev2, jdate2);
02235         else
02236         error (0, 0,
02237                "file %s is locally modified, but has been removed in revision %s",
02238                finfo->fullname, jrev2);
02239
02240         /* FIXME: Should we arrange to return a non-zero exit
02241                status?  */
02242
02243         if (rev1 != NULL)
02244         free (rev1);
02245
02246         return;
02247     }
02248
02249     /* If only one join tag was specified, and the user file has
02250            been changed since the greatest common ancestor (rev1),
02251            then there is a conflict we can not resolve.  See above for
02252            the rationale.  */
02253     if (join_rev2 == NULL
02254         && strcmp (rev1, vers->vn_user) != 0)
02255     {
02256         if (jdate2 != NULL)
02257         error (0, 0,
02258                "file %s has been modified, but has been removed in revision %s as of %s",
02259                finfo->fullname, jrev2, jdate2);
02260         else
02261         error (0, 0,
02262                "file %s has been modified, but has been removed in revision %s",
02263                finfo->fullname, jrev2);
02264
02265         /* FIXME: Should we arrange to return a non-zero exit
02266                status?  */
02267
02268         if (rev1 != NULL)
02269         free (rev1);
02270
02271         return;
02272     }
02273
02274     if (rev1 != NULL)
02275         free (rev1);
02276
02277     /* The user file exists and has not been modified.  Mark it
02278            for removal.  FIXME: If we are doing a checkout, this has
02279            the effect of first checking out the file, and then
02280            removing it.  It would be better to just register the
02281            removal.  */
02282 #ifdef SERVER_SUPPORT
02283     if (server_active)
02284     {
02285         server_scratch (finfo->file);
02286         server_updated (finfo, vers, SERVER_UPDATED, (mode_t) -1,
02287                 (unsigned char *) NULL, (struct buffer *) NULL);
02288     }
02289 #endif
02290     mrev = xmalloc (strlen (vers->vn_user) + 2);
02291     sprintf (mrev, "-%s", vers->vn_user);
02292     Register (finfo->entries, finfo->file, mrev, vers->ts_rcs,
02293           vers->options, vers->tag, vers->date, vers->ts_conflict);
02294     free (mrev);
02295     /* We need to check existence_error here because if we are
02296            running as the server, and the file is up to date in the
02297            working directory, the client will not have sent us a copy.  */
02298     if (unlink_file (finfo->file) < 0 && ! existence_error (errno))
02299         error (0, errno, "cannot remove file %s", finfo->fullname);
02300 #ifdef SERVER_SUPPORT
02301     if (server_active)
02302         server_checked_in (finfo->file, finfo->update_dir,
02303                    finfo->repository);
02304 #endif
02305     if (! really_quiet)
02306         error (0, 0, "scheduling %s for removal", finfo->fullname);
02307
02308     return;
02309     }
02310
02311     /* If the target of the merge is the same as the working file
02312        revision, then there is nothing to do.  */
02313     if (vers->vn_user != NULL && strcmp (rev2, vers->vn_user) == 0)
02314     {
02315     if (rev1 != NULL)
02316         free (rev1);
02317     free (rev2);
02318     return;
02319     }
02320
02321     /* If rev1 is dead or does not exist, then the file was added
02322        between rev1 and rev2.  */
02323     if (rev1 == NULL || RCS_isdead (vers->srcfile, rev1))
02324     {
02325     if (rev1 != NULL)
02326         free (rev1);
02327     free (rev2);
02328
02329     /* If the file does not exist in the working directory, then
02330            we can just check out the new revision and mark it for
02331            addition.  */
02332     if (vers->vn_user == NULL)
02333     {
02334         Vers_TS *xvers;
02335
02336         xvers = Version_TS (finfo, vers->options, jrev2, jdate2, 1, 0);
02337
02338         /* Reset any keyword expansion option.  Otherwise, when a
02339            command like `cvs update -kk -jT1 -jT2' creates a new file
02340            (because a file had the T2 tag, but not T1), the subsequent
02341            commit of that just-added file effectively would set the
02342            admin `-kk' option for that file in the repository.  */
02343         options = NULL;
02344
02345         /* FIXME: If checkout_file fails, we should arrange to
02346                return a non-zero exit status.  */
02347         status = checkout_file (finfo, xvers, 1, 0, 1);
02348
02349         freevers_ts (&xvers);
02350
02351         return;
02352     }
02353
02354     /* The file currently exists in the working directory, so we
02355            have a conflict which we can not resolve.  Note that this
02356            is true even if the file is marked for addition or removal.  */
02357
02358     if (jdate2 != NULL)
02359         error (0, 0,
02360            "file %s exists, but has been added in revision %s as of %s",
02361            finfo->fullname, jrev2, jdate2);
02362     else
02363         error (0, 0,
02364            "file %s exists, but has been added in revision %s",
02365            finfo->fullname, jrev2);
02366
02367     return;
02368     }
02369
02370     /* If the two merge revisions are the same, then there is nothing
02371        to do.  */
02372     if (strcmp (rev1, rev2) == 0)
02373     {
02374     free (rev1);
02375     free (rev2);
02376     return;
02377     }
02378
02379     /* If there is no working file, then we can't do the merge.  */
02380     if (vers->vn_user == NULL)
02381     {
02382     free (rev1);
02383     free (rev2);
02384
02385     if (jdate2 != NULL)
02386         error (0, 0,
02387            "file %s does not exist, but is present in revision %s as of %s",
02388            finfo->fullname, jrev2, jdate2);
02389     else
02390         error (0, 0,
02391            "file %s does not exist, but is present in revision %s",
02392            finfo->fullname, jrev2);
02393
02394     /* FIXME: Should we arrange to return a non-zero exit status?  */
02395
02396     return;
02397     }
02398
02399 #ifdef SERVER_SUPPORT
02400     if (server_active && !isreadable (finfo->file))
02401     {
02402     int retcode;
02403     /* The file is up to date.  Need to check out the current contents.  */
02404     retcode = RCS_checkout (vers->srcfile, finfo->file,
02405                 vers->vn_user, (char *) NULL,
02406                 (char *) NULL, RUN_TTY,
02407                 (RCSCHECKOUTPROC) NULL, (void *) NULL);
02408     if (retcode != 0)
02409         error (1, 0,
02410            "failed to check out %s file", finfo->fullname);
02411     }
02412 #endif
02413
02414     /*
02415      * The users currently modified file is moved to a backup file name
02416      * ".#filename.version", so that it will stay around for a few days
02417      * before being automatically removed by some cron daemon.  The "version"
02418      * is the version of the file that the user was most up-to-date with
02419      * before the merge.
02420      */
02421     backup = xmalloc (strlen (finfo->file)
02422               + strlen (vers->vn_user)
02423               + sizeof (BAKPREFIX)
02424               + 10);
02425     (void) sprintf (backup, "%s%s.%s", BAKPREFIX, finfo->file, vers->vn_user);
02426
02427     if (unlink_file (backup) < 0
02428     && !existence_error (errno))
02429     error (0, errno, "cannot remove %s", backup);
02430     copy_file (finfo->file, backup);
02431     xchmod (finfo->file, 1);
02432
02433     t_options = vers->options;
02434 #if 0
02435     if (*t_options == '\0')
02436     t_options = "-kk";      /* to ignore keyword expansions */
02437 #endif
02438
02439     /* If the source of the merge is the same as the working file
02440        revision, then we can just RCS_checkout the target (no merging
02441        as such).  In the text file case, this is probably quite
02442        similar to the RCS_merge, but in the binary file case,
02443        RCS_merge gives all kinds of trouble.  */
02444     if (vers->vn_user != NULL
02445     && strcmp (rev1, vers->vn_user) == 0
02446     /* See comments above about how No_Difference has already been
02447        called.  */
02448     && vers->ts_user != NULL
02449     && strcmp (vers->ts_user, vers->ts_rcs) == 0
02450
02451     /* This is because of the worry below about $Name.  If that
02452        isn't a problem, I suspect this code probably works for
02453        text files too.  */
02454     && (strcmp (t_options, "-kb") == 0
02455         || wrap_merge_is_copy (finfo->file)))
02456     {
02457     /* FIXME: what about nametag?  What does RCS_merge do with
02458        $Name?  */
02459     if (RCS_checkout (finfo->rcs, finfo->file, rev2, NULL, t_options,
02460               RUN_TTY, (RCSCHECKOUTPROC)0, NULL) != 0)
02461         status = 2;
02462     else
02463         status = 0;
02464
02465     /* OK, this is really stupid.  RCS_checkout carefully removes
02466        write permissions, and we carefully put them back.  But
02467        until someone gets around to fixing it, that seems like the
02468        easiest way to get what would seem to be the right mode.
02469        I don't check CVSWRITE or _watched; I haven't thought about
02470        that in great detail, but it seems like a watched file should
02471        be checked out (writable) after a merge.  */
02472     xchmod (finfo->file, 1);
02473
02474     /* Traditionally, the text file case prints a whole bunch of
02475        scary looking and verbose output which fails to tell the user
02476        what is really going on (it gives them rev1 and rev2 but doesn't
02477        indicate in any way that rev1 == vn_user).  I think just a
02478        simple "U foo" is good here; it seems analogous to the case in
02479        which the file was added on the branch in terms of what to
02480        print.  */
02481     write_letter (finfo, 'U');
02482     }
02483     else if (strcmp (t_options, "-kb") == 0
02484          || wrap_merge_is_copy (finfo->file)
02485          || special_file_mismatch (finfo, rev1, rev2))
02486     {
02487     /* We are dealing with binary files, or files with a
02488        permission/linkage mismatch, and real merging would
02489        need to take place.  This is a conflict.  We give the user
02490        the two files, and let them resolve it.  It is possible
02491        that we should require a "touch foo" or similar step before
02492        we allow a checkin.  */
02493     if (RCS_checkout (finfo->rcs, finfo->file, rev2, NULL, t_options,
02494               RUN_TTY, (RCSCHECKOUTPROC)0, NULL) != 0)
02495         status = 2;
02496     else
02497         status = 0;
02498
02499     /* OK, this is really stupid.  RCS_checkout carefully removes
02500        write permissions, and we carefully put them back.  But
02501        until someone gets around to fixing it, that seems like the
02502        easiest way to get what would seem to be the right mode.
02503        I don't check CVSWRITE or _watched; I haven't thought about
02504        that in great detail, but it seems like a watched file should
02505        be checked out (writable) after a merge.  */
02506     xchmod (finfo->file, 1);
02507
02508     /* Hmm.  We don't give them REV1 anywhere.  I guess most people
02509        probably don't have a 3-way merge tool for the file type in
02510        question, and might just get confused if we tried to either
02511        provide them with a copy of the file from REV1, or even just
02512        told them what REV1 is so they can get it themself, but it
02513        might be worth thinking about.  */
02514     /* See comment in merge_file about the "nonmergeable file"
02515        terminology.  */
02516     error (0, 0, "nonmergeable file needs merge");
02517     error (0, 0, "revision %s from repository is now in %s",
02518            rev2, finfo->fullname);
02519     error (0, 0, "file from working directory is now in %s", backup);
02520     write_letter (finfo, 'C');
02521     }
02522     else
02523     status = RCS_merge (finfo->rcs, vers->srcfile->path, finfo->file,
02524                 t_options, rev1, rev2);
02525
02526     if (status != 0 && status != 1)
02527     {
02528     error (0, status == -1 ? errno : 0,
02529            "could not merge revision %s of %s", rev2, finfo->fullname);
02530     error (status == -1 ? 1 : 0, 0, "restoring %s from backup file %s",
02531            finfo->fullname, backup);
02532     rename_file (backup, finfo->file);
02533     }
02534     free (rev1);
02535     free (rev2);
02536
02537     /* The file has changed, but if we just checked it out it may
02538        still have the same timestamp it did when it was first
02539        registered above in checkout_file.  We register it again with a
02540        dummy timestamp to make sure that later runs of CVS will
02541        recognize that it has changed.
02542
02543        We don't actually need to register again if we called
02544        RCS_checkout above, and we aren't running as the server.
02545        However, that is not the normal case, and calling Register
02546        again won't cost much in that case.  */
02547     {
02548     char *cp = 0;
02549
02550     if (status)
02551     {
02552         (void) time (&last_register_time);
02553         cp = time_stamp (finfo->file);
02554     }
02555     Register (finfo->entries, finfo->file,
02556           vers->vn_rcs ? vers->vn_rcs : "0", "Result of merge",
02557           vers->options, vers->tag, vers->date, cp);
02558     if (cp)
02559         free(cp);
02560     }
02561
02562 #ifdef SERVER_SUPPORT
02563     if (server_active)
02564     {
02565     server_copy_file (finfo->file, finfo->update_dir, finfo->repository,
02566               backup);
02567     server_updated (finfo, vers, SERVER_MERGED,
02568             (mode_t) -1, (unsigned char *) NULL,
02569             (struct buffer *) NULL);
02570     }
02571 #endif
02572     free (backup);
02573 }
02574
02575 /*
02576  * Report whether revisions REV1 and REV2 of FINFO agree on:
02577  *   . file ownership
02578  *   . permissions
02579  *   . major and minor device numbers
02580  *   . symbolic links
02581  *   . hard links
02582  *
02583  * If either REV1 or REV2 is NULL, the working copy is used instead.
02584  *
02585  * Return 1 if the files differ on these data.
02586  */
02587
02588 int
02589 special_file_mismatch (finfo, rev1, rev2)
02590     struct file_info *finfo;
02591     char *rev1;
02592     char *rev2;
02593 {
02594 #ifdef PRESERVE_PERMISSIONS_SUPPORT
02595     struct stat sb;
02596     RCSVers *vp;
02597     Node *n;
02598     uid_t rev1_uid, rev2_uid;
02599     gid_t rev1_gid, rev2_gid;
02600     mode_t rev1_mode, rev2_mode;
02601     unsigned long dev_long;
02602     dev_t rev1_dev, rev2_dev;
02603     char *rev1_symlink = NULL;
02604     char *rev2_symlink = NULL;
02605     List *rev1_hardlinks = NULL;
02606     List *rev2_hardlinks = NULL;
02607     int check_uids, check_gids, check_modes;
02608     int result;
02609
02610     /* If we don't care about special file info, then
02611        don't report a mismatch in any case. */
02612     if (!preserve_perms)
02613     return 0;
02614
02615     /* When special_file_mismatch is called from No_Difference, the
02616        RCS file has been only partially parsed.  We must read the
02617        delta tree in order to compare special file info recorded in
02618        the delta nodes.  (I think this is safe. -twp) */
02619     if (finfo->rcs->flags & PARTIAL)
02620     RCS_reparsercsfile (finfo->rcs, NULL, NULL);
02621
02622     check_uids = check_gids = check_modes = 1;
02623
02624     /* Obtain file information for REV1.  If this is null, then stat
02625        finfo->file and use that info. */
02626     /* If a revision does not know anything about its status,
02627        then presumably it doesn't matter, and indicates no conflict. */
02628
02629     if (rev1 == NULL)
02630     {
02631     if (islink (finfo->file))
02632         rev1_symlink = xreadlink (finfo->file);
02633     else
02634     {
02635 #ifdef HAVE_ST_RDEV
02636         if (CVS_LSTAT (finfo->file, &sb) < 0)
02637         error (1, errno, "could not get file information for %s",
02638                finfo->file);
02639         rev1_uid = sb.st_uid;
02640         rev1_gid = sb.st_gid;
02641         rev1_mode = sb.st_mode;
02642         if (S_ISBLK (rev1_mode) || S_ISCHR (rev1_mode))
02643         rev1_dev = sb.st_rdev;
02644 #else
02645         error (1, 0, "cannot handle device files on this system (%s)",
02646            finfo->file);
02647 #endif
02648     }
02649     rev1_hardlinks = list_linked_files_on_disk (finfo->file);
02650     }
02651     else
02652     {
02653     n = findnode (finfo->rcs->versions, rev1);
02654     vp = (RCSVers *) n->data;
02655
02656     n = findnode (vp->other_delta, "symlink");
02657     if (n != NULL)
02658         rev1_symlink = xstrdup (n->data);
02659     else
02660     {
02661         n = findnode (vp->other_delta, "owner");
02662         if (n == NULL)
02663         check_uids = 0; /* don't care */
02664         else
02665         rev1_uid = strtoul (n->data, NULL, 10);
02666
02667         n = findnode (vp->other_delta, "group");
02668         if (n == NULL)
02669         check_gids = 0; /* don't care */
02670         else
02671         rev1_gid = strtoul (n->data, NULL, 10);
02672
02673         n = findnode (vp->other_delta, "permissions");
02674         if (n == NULL)
02675         check_modes = 0;    /* don't care */
02676         else
02677         rev1_mode = strtoul (n->data, NULL, 8);
02678
02679         n = findnode (vp->other_delta, "special");
02680         if (n == NULL)
02681         rev1_mode |= S_IFREG;
02682         else
02683         {
02684         /* If the size of `ftype' changes, fix the sscanf call also */
02685         char ftype[16];
02686         if (sscanf (n->data, "%16s %lu", ftype,
02687                 &dev_long) < 2)
02688             error (1, 0, "%s:%s has bad `special' newphrase %s",
02689                finfo->file, rev1, n->data);
02690         rev1_dev = dev_long;
02691         if (strcmp (ftype, "character") == 0)
02692             rev1_mode |= S_IFCHR;
02693         else if (strcmp (ftype, "block") == 0)
02694             rev1_mode |= S_IFBLK;
02695         else
02696             error (0, 0, "%s:%s unknown file type `%s'",
02697                finfo->file, rev1, ftype);
02698         }
02699
02700         rev1_hardlinks = vp->hardlinks;
02701         if (rev1_hardlinks == NULL)
02702         rev1_hardlinks = getlist();
02703     }
02704     }
02705
02706     /* Obtain file information for REV2. */
02707     if (rev2 == NULL)
02708     {
02709     if (islink (finfo->file))
02710         rev2_symlink = xreadlink (finfo->file);
02711     else
02712     {
02713 #ifdef HAVE_ST_RDEV
02714         if (CVS_LSTAT (finfo->file, &sb) < 0)
02715         error (1, errno, "could not get file information for %s",
02716                finfo->file);
02717         rev2_uid = sb.st_uid;
02718         rev2_gid = sb.st_gid;
02719         rev2_mode = sb.st_mode;
02720         if (S_ISBLK (rev2_mode) || S_ISCHR (rev2_mode))
02721         rev2_dev = sb.st_rdev;
02722 #else
02723         error (1, 0, "cannot handle device files on this system (%s)",
02724            finfo->file);
02725 #endif
02726     }
02727     rev2_hardlinks = list_linked_files_on_disk (finfo->file);
02728     }
02729     else
02730     {
02731     n = findnode (finfo->rcs->versions, rev2);
02732     vp = (RCSVers *) n->data;
02733
02734     n = findnode (vp->other_delta, "symlink");
02735     if (n != NULL)
02736         rev2_symlink = xstrdup (n->data);
02737     else
02738     {
02739         n = findnode (vp->other_delta, "owner");
02740         if (n == NULL)
02741         check_uids = 0; /* don't care */
02742         else
02743         rev2_uid = strtoul (n->data, NULL, 10);
02744
02745         n = findnode (vp->other_delta, "group");
02746         if (n == NULL)
02747         check_gids = 0; /* don't care */
02748         else
02749         rev2_gid = strtoul (n->data, NULL, 10);
02750
02751         n = findnode (vp->other_delta, "permissions");
02752         if (n == NULL)
02753         check_modes = 0;    /* don't care */
02754         else
02755         rev2_mode = strtoul (n->data, NULL, 8);
02756
02757         n = findnode (vp->other_delta, "special");
02758         if (n == NULL)
02759         rev2_mode |= S_IFREG;
02760         else
02761         {
02762         /* If the size of `ftype' changes, fix the sscanf call also */
02763         char ftype[16];
02764         if (sscanf (n->data, "%16s %lu", ftype,
02765                 &dev_long) < 2)
02766             error (1, 0, "%s:%s has bad `special' newphrase %s",
02767                finfo->file, rev2, n->data);
02768         rev2_dev = dev_long;
02769         if (strcmp (ftype, "character") == 0)
02770             rev2_mode |= S_IFCHR;
02771         else if (strcmp (ftype, "block") == 0)
02772             rev2_mode |= S_IFBLK;
02773         else
02774             error (0, 0, "%s:%s unknown file type `%s'",
02775                finfo->file, rev2, ftype);
02776         }
02777
02778         rev2_hardlinks = vp->hardlinks;
02779         if (rev2_hardlinks == NULL)
02780         rev2_hardlinks = getlist();
02781     }
02782     }
02783
02784     /* Check the user/group ownerships and file permissions, printing
02785        an error for each mismatch found.  Return 0 if all characteristics
02786        matched, and 1 otherwise. */
02787
02788     result = 0;
02789
02790     /* Compare symlinks first, since symlinks are simpler (don't have
02791        any other characteristics). */
02792     if (rev1_symlink != NULL && rev2_symlink == NULL)
02793     {
02794     error (0, 0, "%s is a symbolic link",
02795            (rev1 == NULL ? "working file" : rev1));
02796     result = 1;
02797     }
02798     else if (rev1_symlink == NULL && rev2_symlink != NULL)
02799     {
02800     error (0, 0, "%s is a symbolic link",
02801            (rev2 == NULL ? "working file" : rev2));
02802     result = 1;
02803     }
02804     else if (rev1_symlink != NULL)
02805     result = (strcmp (rev1_symlink, rev2_symlink) == 0);
02806     else
02807     {
02808     /* Compare user ownership. */
02809     if (check_uids && rev1_uid != rev2_uid)
02810     {
02811         error (0, 0, "%s: owner mismatch between %s and %s",
02812            finfo->file,
02813            (rev1 == NULL ? "working file" : rev1),
02814            (rev2 == NULL ? "working file" : rev2));
02815         result = 1;
02816     }
02817
02818     /* Compare group ownership. */
02819     if (check_gids && rev1_gid != rev2_gid)
02820     {
02821         error (0, 0, "%s: group mismatch between %s and %s",
02822            finfo->file,
02823            (rev1 == NULL ? "working file" : rev1),
02824            (rev2 == NULL ? "working file" : rev2));
02825         result = 1;
02826     }
02827
02828     /* Compare permissions. */
02829     if (check_modes &&
02830         (rev1_mode & 07777) != (rev2_mode & 07777))
02831     {
02832         error (0, 0, "%s: permission mismatch between %s and %s",
02833            finfo->file,
02834            (rev1 == NULL ? "working file" : rev1),
02835            (rev2 == NULL ? "working file" : rev2));
02836         result = 1;
02837     }
02838
02839     /* Compare device file characteristics. */
02840     if ((rev1_mode & S_IFMT) != (rev2_mode & S_IFMT))
02841     {
02842         error (0, 0, "%s: %s and %s are different file types",
02843            finfo->file,
02844            (rev1 == NULL ? "working file" : rev1),
02845            (rev2 == NULL ? "working file" : rev2));
02846         result = 1;
02847     }
02848     else if (S_ISBLK (rev1_mode))
02849     {
02850         if (rev1_dev != rev2_dev)
02851         {
02852         error (0, 0, "%s: device numbers of %s and %s do not match",
02853                finfo->file,
02854                (rev1 == NULL ? "working file" : rev1),
02855                (rev2 == NULL ? "working file" : rev2));
02856         result = 1;
02857         }
02858     }
02859
02860     /* Compare hard links. */
02861     if (compare_linkage_lists (rev1_hardlinks, rev2_hardlinks) == 0)
02862     {
02863         error (0, 0, "%s: hard linkage of %s and %s do not match",
02864            finfo->file,
02865            (rev1 == NULL ? "working file" : rev1),
02866            (rev2 == NULL ? "working file" : rev2));
02867         result = 1;
02868     }
02869     }
02870
02871     if (rev1_symlink != NULL)
02872     free (rev1_symlink);
02873     if (rev2_symlink != NULL)
02874     free (rev2_symlink);
02875     if (rev1_hardlinks != NULL)
02876     dellist (&rev1_hardlinks);
02877     if (rev2_hardlinks != NULL)
02878     dellist (&rev2_hardlinks);
02879
02880     return result;
02881 #else
02882     return 0;
02883 #endif
02884 }
02885
02886 int
02887 joining ()
02888 {
02889     return (join_rev1 != NULL);
02890 }
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/update.h Source File

cvs-1.10/src/update.h

Go to the documentation of this file.
00001 /* Declarations for update.c.
00002
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; either version 2, or (at your option)
00006    any later version.
00007
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.  */
00012
00013 int do_update PROTO((int argc, char *argv[], char *xoptions, char *xtag,
00014            char *xdate, int xforce, int local, int xbuild,
00015            int xaflag, int xprune, int xpipeout, int which,
00016            char *xjoin_rev1, char *xjoin_rev2, char *preload_update_dir));
00017 int joining PROTO((void));
00018 extern int isemptydir PROTO ((char *dir, int might_not_exist));
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/vers_ts.c Source File

cvs-1.10/src/vers_ts.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS source distribution.
00007  */
00008
00009 #include "cvs.h"
00010
00011 #ifdef SERVER_SUPPORT
00012 static void time_stamp_server PROTO((char *, Vers_TS *, Entnode *));
00013 #endif
00014
00015 /* Fill in and return a Vers_TS structure for the file FINFO.  TAG and
00016    DATE are from the command line.  */
00017
00018 Vers_TS *
00019 Version_TS (finfo, options, tag, date, force_tag_match, set_time)
00020     struct file_info *finfo;
00021
00022     /* Keyword expansion options, I think generally from the command
00023        line.  Can be either NULL or "" to indicate none are specified
00024        here.  */
00025     char *options;
00026     char *tag;
00027     char *date;
00028     int force_tag_match;
00029     int set_time;
00030 {
00031     Node *p;
00032     RCSNode *rcsdata;
00033     Vers_TS *vers_ts;
00034     struct stickydirtag *sdtp;
00035     Entnode *entdata;
00036
00037 #ifdef UTIME_EXPECTS_WRITABLE
00038     int change_it_back = 0;
00039 #endif
00040
00041     /* get a new Vers_TS struct */
00042     vers_ts = (Vers_TS *) xmalloc (sizeof (Vers_TS));
00043     memset ((char *) vers_ts, 0, sizeof (*vers_ts));
00044
00045     /*
00046      * look up the entries file entry and fill in the version and timestamp
00047      * if entries is NULL, there is no entries file so don't bother trying to
00048      * look it up (used by checkout -P)
00049      */
00050     if (finfo->entries == NULL)
00051     {
00052     sdtp = NULL;
00053     p = NULL;
00054     }
00055     else
00056     {
00057     p = findnode_fn (finfo->entries, finfo->file);
00058     sdtp = (struct stickydirtag *) finfo->entries->list->data; /* list-private */
00059     }
00060
00061     entdata = NULL;
00062     if (p != NULL)
00063     {
00064     entdata = (Entnode *) p->data;
00065
00066     if (entdata->type == ENT_SUBDIR)
00067     {
00068         /* According to cvs.texinfo, the various fields in the Entries
00069            file for a directory (other than the name) do not have a
00070            defined meaning.  We need to pass them along without getting
00071            confused based on what is in them.  Therefore we make sure
00072            not to set vn_user and the like from Entries, add.c and
00073            perhaps other code will expect these fields to be NULL for
00074            a directory.  */
00075         vers_ts->entdata = entdata;
00076     }
00077     else
00078 #ifdef SERVER_SUPPORT
00079     /* An entries line with "D" in the timestamp indicates that the
00080        client sent Is-modified without sending Entry.  So we want to
00081        use the entries line for the sole purpose of telling
00082        time_stamp_server what is up; we don't want the rest of CVS
00083        to think there is an entries line.  */
00084     if (strcmp (entdata->timestamp, "D") != 0)
00085 #endif
00086     {
00087         vers_ts->vn_user = xstrdup (entdata->version);
00088         vers_ts->ts_rcs = xstrdup (entdata->timestamp);
00089         vers_ts->ts_conflict = xstrdup (entdata->conflict);
00090         if (!(tag || date) && !(sdtp && sdtp->aflag))
00091         {
00092         vers_ts->tag = xstrdup (entdata->tag);
00093         vers_ts->date = xstrdup (entdata->date);
00094         }
00095         vers_ts->entdata = entdata;
00096     }
00097     /* Even if we don't have an "entries line" as such
00098        (vers_ts->entdata), we want to pick up options which could
00099        have been from a Kopt protocol request.  */
00100     if (!options || *options == '\0')
00101     {
00102         if (!(sdtp && sdtp->aflag))
00103         vers_ts->options = xstrdup (entdata->options);
00104     }
00105     }
00106
00107     /*
00108      * -k options specified on the command line override (and overwrite)
00109      * options stored in the entries file
00110      */
00111     if (options && *options != '\0')
00112     vers_ts->options = xstrdup (options);
00113     else if (!vers_ts->options || *vers_ts->options == '\0')
00114     {
00115     if (finfo->rcs != NULL)
00116     {
00117         /* If no keyword expansion was specified on command line,
00118            use whatever was in the rcs file (if there is one).  This
00119            is how we, if we are the server, tell the client whether
00120            a file is binary.  */
00121         char *rcsexpand = RCS_getexpand (finfo->rcs);
00122         if (rcsexpand != NULL)
00123         {
00124         if (vers_ts->options != NULL)
00125             free (vers_ts->options);
00126         vers_ts->options = xmalloc (strlen (rcsexpand) + 3);
00127         strcpy (vers_ts->options, "-k");
00128         strcat (vers_ts->options, rcsexpand);
00129         }
00130     }
00131     }
00132     if (!vers_ts->options)
00133     vers_ts->options = xstrdup ("");
00134
00135     /*
00136      * if tags were specified on the command line, they override what is in
00137      * the Entries file
00138      */
00139     if (tag || date)
00140     {
00141     vers_ts->tag = xstrdup (tag);
00142     vers_ts->date = xstrdup (date);
00143     }
00144     else if (!vers_ts->entdata && (sdtp && sdtp->aflag == 0))
00145     {
00146     if (!vers_ts->tag)
00147     {
00148         vers_ts->tag = xstrdup (sdtp->tag);
00149         vers_ts->nonbranch = sdtp->nonbranch;
00150     }
00151     if (!vers_ts->date)
00152         vers_ts->date = xstrdup (sdtp->date);
00153     }
00154
00155     /* Now look up the info on the source controlled file */
00156     if (finfo->rcs != NULL)
00157     {
00158     rcsdata = finfo->rcs;
00159     rcsdata->refcount++;
00160     }
00161     else if (finfo->repository != NULL)
00162     rcsdata = RCS_parse (finfo->file, finfo->repository);
00163     else
00164     rcsdata = NULL;
00165
00166     if (rcsdata != NULL)
00167     {
00168     /* squirrel away the rcsdata pointer for others */
00169     vers_ts->srcfile = rcsdata;
00170
00171     if (vers_ts->tag && strcmp (vers_ts->tag, TAG_BASE) == 0)
00172     {
00173         vers_ts->vn_rcs = xstrdup (vers_ts->vn_user);
00174         vers_ts->vn_tag = xstrdup (vers_ts->vn_user);
00175     }
00176     else
00177     {
00178         int simple;
00179
00180         vers_ts->vn_rcs = RCS_getversion (rcsdata, vers_ts->tag,
00181                           vers_ts->date, force_tag_match,
00182                           &simple);
00183         if (vers_ts->vn_rcs == NULL)
00184         vers_ts->vn_tag = NULL;
00185         else if (simple)
00186         vers_ts->vn_tag = xstrdup (vers_ts->tag);
00187         else
00188         vers_ts->vn_tag = xstrdup (vers_ts->vn_rcs);
00189     }
00190
00191     /*
00192      * If the source control file exists and has the requested revision,
00193      * get the Date the revision was checked in.  If "user" exists, set
00194      * its mtime.
00195      */
00196     if (set_time && vers_ts->vn_rcs != NULL)
00197     {
00198 #ifdef SERVER_SUPPORT
00199         if (server_active)
00200         server_modtime (finfo, vers_ts);
00201         else
00202 #endif
00203         {
00204         struct utimbuf t;
00205
00206         memset (&t, 0, sizeof (t));
00207         t.modtime =
00208             RCS_getrevtime (rcsdata, vers_ts->vn_rcs, 0, 0);
00209         if (t.modtime != (time_t) -1)
00210         {
00211             t.actime = t.modtime;
00212
00213 #ifdef UTIME_EXPECTS_WRITABLE
00214             if (!iswritable (finfo->file))
00215             {
00216             xchmod (finfo->file, 1);
00217             change_it_back = 1;
00218             }
00219 #endif  /* UTIME_EXPECTS_WRITABLE  */
00220
00221             /* This used to need to ignore existence_errors
00222                (for cases like where update.c now clears
00223                set_time if noexec, but didn't used to).  I
00224                think maybe now it doesn't (server_modtime does
00225                not like those kinds of cases).  */
00226             (void) utime (finfo->file, &t);
00227
00228 #ifdef UTIME_EXPECTS_WRITABLE
00229             if (change_it_back == 1)
00230             {
00231             xchmod (finfo->file, 0);
00232             change_it_back = 0;
00233             }
00234 #endif  /*  UTIME_EXPECTS_WRITABLE  */
00235         }
00236         }
00237     }
00238     }
00239
00240     /* get user file time-stamp in ts_user */
00241     if (finfo->entries != (List *) NULL)
00242     {
00243 #ifdef SERVER_SUPPORT
00244     if (server_active)
00245         time_stamp_server (finfo->file, vers_ts, entdata);
00246     else
00247 #endif
00248         vers_ts->ts_user = time_stamp (finfo->file);
00249     }
00250
00251     return (vers_ts);
00252 }
00253
00254 #ifdef SERVER_SUPPORT
00255
00256 /* Set VERS_TS->TS_USER to time stamp for FILE.  */
00257
00258 /* Separate these out to keep the logic below clearer.  */
00259 #define mark_lost(V)        ((V)->ts_user = 0)
00260 #define mark_unchanged(V)   ((V)->ts_user = xstrdup ((V)->ts_rcs))
00261
00262 static void
00263 time_stamp_server (file, vers_ts, entdata)
00264     char *file;
00265     Vers_TS *vers_ts;
00266     Entnode *entdata;
00267 {
00268     struct stat sb;
00269     char *cp;
00270
00271     if (CVS_LSTAT (file, &sb) < 0)
00272     {
00273     if (! existence_error (errno))
00274         error (1, errno, "cannot stat temp file");
00275
00276     /* Missing file means lost or unmodified; check entries
00277        file to see which.
00278
00279        XXX FIXME - If there's no entries file line, we
00280        wouldn't be getting the file at all, so consider it
00281        lost.  I don't know that that's right, but it's not
00282        clear to me that either choice is.  Besides, would we
00283        have an RCS string in that case anyways?  */
00284     if (entdata == NULL)
00285         mark_lost (vers_ts);
00286     else if (entdata->timestamp
00287          && entdata->timestamp[0] == '=')
00288         mark_unchanged (vers_ts);
00289     else if (entdata->timestamp != NULL
00290          && (entdata->timestamp[0] == 'M'
00291              || entdata->timestamp[0] == 'D')
00292          && entdata->timestamp[1] == '\0')
00293         vers_ts->ts_user = xstrdup ("Is-modified");
00294     else
00295         mark_lost (vers_ts);
00296     }
00297     else if (sb.st_mtime == 0)
00298     {
00299     /* We shouldn't reach this case any more!  */
00300     abort ();
00301     }
00302     else
00303     {
00304         struct tm *tm_p;
00305         struct tm local_tm;
00306
00307     vers_ts->ts_user = xmalloc (25);
00308     /* We want to use the same timestamp format as is stored in the
00309        st_mtime.  For unix (and NT I think) this *must* be universal
00310        time (UT), so that files don't appear to be modified merely
00311        because the timezone has changed.  For VMS, or hopefully other
00312        systems where gmtime returns NULL, the modification time is
00313        stored in local time, and therefore it is not possible to cause
00314        st_mtime to be out of sync by changing the timezone.  */
00315     tm_p = gmtime (&sb.st_mtime);
00316     if (tm_p)
00317     {
00318         memcpy (&local_tm, tm_p, sizeof (local_tm));
00319         cp = asctime (&local_tm);   /* copy in the modify time */
00320     }
00321     else
00322         cp = ctime (&sb.st_mtime);
00323
00324     cp[24] = 0;
00325     /* Fix non-standard format.  */
00326     if (cp[8] == '0') cp[8] = ' ';
00327     (void) strcpy (vers_ts->ts_user, cp);
00328     }
00329 }
00330
00331 #endif /* SERVER_SUPPORT */
00332 /*
00333  * Gets the time-stamp for the file "file" and returns it in space it
00334  * allocates
00335  */
00336 char *
00337 time_stamp (file)
00338     char *file;
00339 {
00340     struct stat sb;
00341     char *cp;
00342     char *ts;
00343
00344     if (CVS_LSTAT (file, &sb) < 0)
00345     {
00346     ts = NULL;
00347     }
00348     else
00349     {
00350     struct tm *tm_p;
00351         struct tm local_tm;
00352     ts = xmalloc (25);
00353     /* We want to use the same timestamp format as is stored in the
00354        st_mtime.  For unix (and NT I think) this *must* be universal
00355        time (UT), so that files don't appear to be modified merely
00356        because the timezone has changed.  For VMS, or hopefully other
00357        systems where gmtime returns NULL, the modification time is
00358        stored in local time, and therefore it is not possible to cause
00359        st_mtime to be out of sync by changing the timezone.  */
00360     tm_p = gmtime (&sb.st_mtime);
00361     if (tm_p)
00362     {
00363         memcpy (&local_tm, tm_p, sizeof (local_tm));
00364         cp = asctime (&local_tm);   /* copy in the modify time */
00365     }
00366     else
00367         cp = ctime(&sb.st_mtime);
00368
00369     cp[24] = 0;
00370     /* Fix non-standard format.  */
00371     if (cp[8] == '0') cp[8] = ' ';
00372     (void) strcpy (ts, cp);
00373     }
00374
00375     return (ts);
00376 }
00377
00378 /*
00379  * free up a Vers_TS struct
00380  */
00381 void
00382 freevers_ts (versp)
00383     Vers_TS **versp;
00384 {
00385     if ((*versp)->srcfile)
00386     freercsnode (&((*versp)->srcfile));
00387     if ((*versp)->vn_user)
00388     free ((*versp)->vn_user);
00389     if ((*versp)->vn_rcs)
00390     free ((*versp)->vn_rcs);
00391     if ((*versp)->vn_tag)
00392     free ((*versp)->vn_tag);
00393     if ((*versp)->ts_user)
00394     free ((*versp)->ts_user);
00395     if ((*versp)->ts_rcs)
00396     free ((*versp)->ts_rcs);
00397     if ((*versp)->options)
00398     free ((*versp)->options);
00399     if ((*versp)->tag)
00400     free ((*versp)->tag);
00401     if ((*versp)->date)
00402     free ((*versp)->date);
00403     if ((*versp)->ts_conflict)
00404     free ((*versp)->ts_conflict);
00405     free ((char *) *versp);
00406     *versp = (Vers_TS *) NULL;
00407 }
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


scramble.c File Reference

cvs-1.10/src/scramble.c File Reference

#include "cvs.h"

Include dependency graph for scramble.c:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:43:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


server.c File Reference

cvs-1.10/src/server.c File Reference

#include <assert.h>
#include "cvs.h"
#include "watch.h"
#include "edit.h"
#include "fileattr.h"
#include "getline.h"
#include "buffer.h"

Include dependency graph for server.c:

Include dependency graph

Go to the source code of this file.

Functions

void | cvs_output (str, len) const char *str

Variables

size_t | len
char * | text

Function Documentation

void cvs_output | ( | str | ,
 |  | len |
 | ) | const

Variable Documentation

size_t len

Definition at line 6356 of file server.c.

char* text

Definition at line 6461 of file server.c.

Generated on Sun Oct 21 12:43:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


server.h File Reference

cvs-1.10/src/server.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | request

Defines

#define | STDIN_FILENO 0
#define | STDOUT_FILENO 1
#define | STDERR_FILENO 2
#define | CLIENT_SERVER_STR ""
#define | RQ_ESSENTIAL 1
#define | RQ_SUPPORTED 2
#define | RQ_ENABLEME 4
#define | RQ_ROOTLESS 8

Functions

int gunzip_and_write | PROTO ((int, char *, unsigned char *, size_t))
int read_and_gzip | PROTO ((int, char *, unsigned char **, size_t *, size_t *, int))

Variables

request requests []

Define Documentation

#define CLIENT_SERVER_STR ""

Definition at line 17 of file server.h.

#define RQ_ENABLEME 4

Definition at line 166 of file server.h.

#define RQ_ESSENTIAL 1

Definition at line 159 of file server.h.

#define RQ_ROOTLESS 8

Definition at line 169 of file server.h.

#define RQ_SUPPORTED 2

Definition at line 162 of file server.h.

#define STDERR_FILENO 2

Definition at line 7 of file server.h.

#define STDIN_FILENO 0

Definition at line 5 of file server.h.

#define STDOUT_FILENO 1

Definition at line 6 of file server.h.

Function Documentation

int read_and_gzip PROTO ( (int, char *, unsigned char **, size_t *, size_t *, int) )

int gunzip_and_write PROTO ( (int, char *, unsigned char *, size_t) )

Variable Documentation

struct request requests[]

Definition at line 173 of file server.h.

Generated on Sun Oct 21 12:43:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


status.c File Reference

cvs-1.10/src/status.c File Reference

#include "cvs.h"

Include dependency graph for status.c:

Include dependency graph

Go to the source code of this file.

Functions

Dtype status_dirproc ()
int | status_fileproc ()
int | tag_list_proc ()
int | cvsstatus (argc, argv) int argc

Variables

int | local = 0
int | long_format = 0
RCSNode * xrcsnode
const char *const | status_usage []
char ** | argv
file_info * finfo
char * | dir
char * | repos
char * | update_dir
List * entries
void * | closure

Function Documentation

int cvsstatus | ( | argc | ,
 |  | argv |
 | ) |

Dtype status_dirproc ( ) [static]

int status_fileproc ( ) [static]

int tag_list_proc ( ) [static]

Variable Documentation

char** argv

Definition at line 36 of file status.c.

void* closure

Definition at line 336 of file status.c.

char* dir

Definition at line 320 of file status.c.

List* entries

Definition at line 323 of file status.c.

struct file_info* finfo

Definition at line 121 of file status.c.

int local = 0 [static]

Definition at line 19 of file status.c.

int long_format = 0 [static]

Definition at line 20 of file status.c.

char* repos

Definition at line 321 of file status.c.

const char* const status_usage[] [static]

Initial value:

{
    "Usage: %s %s [-vlR] [files...]\n",
    "\t-v\tVerbose format; includes tag information for the file\n",
    "\t-l\tProcess this directory only (not recursive).\n",
    "\t-R\tProcess directories recursively.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 23 of file status.c.

char* update_dir

Definition at line 322 of file status.c.

RCSNode* xrcsnode [static]

Definition at line 21 of file status.c.

Generated on Sun Oct 21 12:43:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


subr.c File Reference

cvs-1.10/src/subr.c File Reference

#include "cvs.h"
#include "getline.h"

Include dependency graph for subr.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | MIN_INCR 1024
#define | MAX_INCR (2*1024*1024)

Functions

char * | getlogin ()
void * | xmalloc (bytes) size_t bytes

Variables

size_t | bytes
size_t * | n
size_t | newsize
char ** | argv
char * | line
char * | sepchars
const char * | rev2
int | argc
const char * | fullname
const char * | mode
char ** | buf
size_t * | bufsize
size_t * | len
const char * | suffix

Define Documentation

#define MAX_INCR (2*1024*1024)

#define MIN_INCR 1024

Function Documentation

char* getlogin ( void )

Definition at line 16 of file pwd.c.

00017 {
00018   static char login[256];
00019   return cuserid(login);
00020 }

void* xmalloc ( bytes )

Variable Documentation

int argc

Definition at line 541 of file subr.c.

char** argv

Definition at line 542 of file subr.c.

char** buf

Definition at line 657 of file subr.c.

size_t* bufsize

Definition at line 658 of file subr.c.

size_t bytes

Definition at line 67 of file subr.c.

const char* fullname

Definition at line 655 of file subr.c.

size_t* len

Definition at line 659 of file subr.c.

char* line

Definition at line 250 of file subr.c.

const char* mode

Definition at line 656 of file subr.c.

uInt n

Definition at line 384 of file inftrees.c.

size_t newsize

Definition at line 131 of file subr.c.

const char* rev2

Definition at line 419 of file subr.c.

char* sepchars

Definition at line 251 of file subr.c.

const char* suffix

Definition at line 793 of file subr.c.

Generated on Sun Oct 21 12:43:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


tag.c File Reference

cvs-1.10/src/tag.c File Reference

#include "cvs.h"
#include "savecwd.h"

Include dependency graph for tag.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | master_lists
struct | tag_info

Functions

int | check_fileproc ()
int | check_filesdoneproc ()
int | pretag_proc ()
void | masterlist_delproc ()
void | tag_delproc ()
int | pretag_list_proc ()
Dtype tag_dirproc ()
int | tag_fileproc ()
int | tag_filesdoneproc ()
int | cvstag (argc, argv) int argc
int | val_fileproc ()
int | val_fileproc (callerdat, finfo) void *callerdat
Dtype | val_direntproc (callerdat, dir, repository, update_dir, entries) void *callerdat

Variables

char * | numtag
char * | date = NULL
char * | symtag
int | delete_flag
int | branch_mode
int | local
int | force_tag_match = 1
int | force_tag_move
int | check_uptodate
List * mtlist
List * tlist
const char *const | tag_usage []
char ** | argv
file_info * finfo
int | err
char * | repos
char * | update_dir
List * entries
char * | filter
void * | closure
char * | dir
char * | repository
int | argc
int | aflag

Function Documentation

int check_fileproc ( ) [static]

int check_filesdoneproc ( ) [static]

int cvstag | ( | argc | ,
 |  | argv |
 | ) |

void masterlist_delproc ( ) [static]

int pretag_list_proc ( ) [static]

int pretag_proc ( ) [static]

void tag_delproc ( ) [static]

Dtype tag_dirproc ( ) [static]

int tag_fileproc ( ) [static]

int tag_filesdoneproc ( ) [static]

Dtype val_direntproc | ( | callerdat | ,
 |  | dir | ,
 |  | repository | ,
 |  | update_dir | ,
 |  | entries |
 | ) | [static]

int val_fileproc | ( | callerdat | ,
 |  | finfo |
 | ) | [static]

int val_fileproc ( ) [static]

Variable Documentation

int aflag

Definition at line 914 of file tag.c.

int argc

Definition at line 911 of file tag.c.

char** argv

Definition at line 912 of file tag.c.

int branch_mode [static]

Definition at line 38 of file tag.c.

int check_uptodate [static]

Definition at line 42 of file tag.c.

void* closure

Definition at line 428 of file tag.c.

char* date = NULL [static]

Definition at line 35 of file tag.c.

int delete_flag [static]

Definition at line 37 of file tag.c.

char* dir

Definition at line 723 of file tag.c.

List* entries

Definition at line 726 of file tag.c.

int err

Definition at line 652 of file tag.c.

char* filter

Definition at line 370 of file tag.c.

struct file_info* finfo

Definition at line 697 of file tag.c.

int force_tag_match = 1 [static]

Definition at line 40 of file tag.c.

int force_tag_move [static]

Definition at line 41 of file tag.c.

int local [static]

Definition at line 913 of file tag.c.

List* mtlist [static]

Definition at line 57 of file tag.c.

char* numtag [static]

Definition at line 34 of file tag.c.

char* repos

Definition at line 670 of file tag.c.

char* repository

Definition at line 915 of file tag.c.

char* symtag [static]

Definition at line 36 of file tag.c.

const char* const tag_usage[] [static]

Initial value:

{
    "Usage: %s %s [-lRF] [-b] [-d] [-c] [-r rev|-D date] tag [files...]\n",
    "\t-l\tLocal directory only, not recursive.\n",
    "\t-R\tProcess directories recursively.\n",
    "\t-d\tDelete the given tag.\n",
    "\t-r rev\tExisting revision/tag.\n",
    "\t-D\tExisting date.\n",
    "\t-f\tForce a head revision if specified tag not found.\n",
    "\t-b\tMake the tag a \"branch\" tag, allowing concurrent development.\n",
    "\t-F\tMove tag if it already exists.\n",
    "\t-c\tCheck that working files are unmodified.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 60 of file tag.c.

List* tlist [static]

Definition at line 58 of file tag.c.

char* update_dir

Definition at line 725 of file tag.c.

Generated on Sun Oct 21 12:43:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


update.c File Reference

cvs-1.10/src/update.c File Reference

#include "cvs.h"
#include "savecwd.h"
#include "watch.h"
#include "fileattr.h"
#include "edit.h"
#include "getline.h"
#include "buffer.h"
#include "hardlink.h"

Include dependency graph for update.c:

Include dependency graph

Go to the source code of this file.

Functions

int | checkout_file ()
int | merge_file ()
int | scratch_file ()
Dtype update_dirent_proc ()
int | update_dirleave_proc ()
int | update_fileproc ()
int | update_filesdone_proc ()
void | write_letter ()
void | join_file ()
int | update (argc, argv) int argc
void | update_ignproc (file, dir) char *file
int | isremoved (node, closure) Node *node

Variables

char * | options = NULL
char * | tag = NULL
char * | date = NULL
int | rewrite_tag
int | nonbranch
char * | tag_update_dir
char * | join_rev1
char * | date_rev1
char * | join_rev2
char * | date_rev2
int | aflag = 0
int | toss_local_changes = 0
int | force_tag_match = 1
int | update_build_dirs = 0
int | update_prune_dirs = 0
int | pipeout = 0
List * | ignlist = (List *) NULL
time_t | last_register_time
const char *const | update_usage []
char ** | argv
char * | xoptions
char * | xtag
char * | xdate
int | xforce
int | local
int | xbuild
int | xaflag
int | xprune
int | xpipeout
int | which
char * | xjoin_rev1
char * | xjoin_rev2
char * | preload_update_dir
file_info * finfo
char * | dir
int | err
char * | repository
char * | update_dir
List * entries
void * | closure
int | might_not_exist
Vers_TS * vers_ts
int | adding
int | merging
int | update_server
int | letter
Vers_TS * vers
char * | rev1
char * | rev2

Function Documentation

int checkout_file ( ) [static]

int isremoved | ( | node | ,
 |  | closure |
 | ) | [static]

void join_file ( ) [static]

int merge_file ( ) [static]

int scratch_file ( ) [static]

int update | ( | argc | ,
 |  | argv |
 | ) |

Dtype update_dirent_proc ( ) [static]

int update_dirleave_proc ( ) [static]

int update_fileproc ( ) [static]

int update_filesdone_proc ( ) [static]

void update_ignproc | ( | file | ,
 |  | dir |
 | ) | [static]

void write_letter ( ) [static]

Variable Documentation

int adding

Definition at line 1258 of file update.c.

int aflag = 0 [static]

Definition at line 96 of file update.c.

char** argv

Definition at line 432 of file update.c.

void* closure

Definition at line 1152 of file update.c.

char* date = NULL [static]

Definition at line 80 of file update.c.

char * date_rev1 [static]

Definition at line 94 of file update.c.

char * date_rev2 [static]

Definition at line 95 of file update.c.

char* dir

Definition at line 1056 of file update.c.

List* entries

Definition at line 1059 of file update.c.

int err

Definition at line 1057 of file update.c.

struct file_info* finfo

Definition at line 577 of file update.c.

int force_tag_match = 1 [static]

Definition at line 98 of file update.c.

List* ignlist = (List *) NULL [static]

Definition at line 106 of file update.c.

char* join_rev1 [static]

Definition at line 94 of file update.c.

char* join_rev2 [static]

Definition at line 95 of file update.c.

time_t last_register_time [static]

Definition at line 107 of file update.c.

int letter

Definition at line 1882 of file update.c.

int local

Definition at line 437 of file update.c.

int merging

Definition at line 1259 of file update.c.

int might_not_exist

Definition at line 1167 of file update.c.

int nonbranch [static]

Definition at line 88 of file update.c.

char* options = NULL [static]

Definition at line 78 of file update.c.

int pipeout = 0 [static]

Definition at line 101 of file update.c.

char* preload_update_dir

Definition at line 445 of file update.c.

char* repository

Definition at line 902 of file update.c.

char* rev1

Definition at line 2591 of file update.c.

char* rev2

Definition at line 2592 of file update.c.

int rewrite_tag [static]

Definition at line 87 of file update.c.

char* tag = NULL [static]

Definition at line 79 of file update.c.

char* tag_update_dir [static]

Definition at line 92 of file update.c.

int toss_local_changes = 0 [static]

Definition at line 97 of file update.c.

int update_build_dirs = 0 [static]

Definition at line 99 of file update.c.

char* update_dir

Definition at line 1058 of file update.c.

int update_prune_dirs = 0 [static]

Definition at line 100 of file update.c.

int update_server

Definition at line 1260 of file update.c.

const char* const update_usage[] [static]

Initial value:

{
    "Usage: %s %s [-APCdflRp] [-k kopt] [-r rev|-D date] [-j rev]\n",
    "    [-I ign] [-W spec] [files...]\n",
    "\t-A\tReset any sticky tags/date/kopts.\n",
    "\t-P\tPrune empty directories.\n",
    "\t-C\tOverwrite locally modified files with clean repository copies.\n",
    "\t-d\tBuild directories, like checkout does.\n",
    "\t-f\tForce a head revision match if tag/date not found.\n",
    "\t-l\tLocal directory only, no recursion.\n",
    "\t-R\tProcess directories recursively.\n",
    "\t-p\tSend updates to standard output (avoids stickiness).\n",
    "\t-k kopt\tUse RCS kopt -k option on checkout.\n",
    "\t-r rev\tUpdate using specified revision/tag (is sticky).\n",
    "\t-D date\tSet date to update from (is sticky).\n",
    "\t-j rev\tMerge in changes made between current revision and rev.\n",
    "\t-I ign\tMore files to ignore (! to reset).\n",
    "\t-W spec\tWrappers specification line.\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 108 of file update.c.

Vers_TS* vers

Definition at line 2100 of file update.c.

Vers_TS* vers_ts

Definition at line 1257 of file update.c.

int which

Definition at line 442 of file update.c.

int xaflag

Definition at line 439 of file update.c.

int xbuild

Definition at line 438 of file update.c.

char* xdate

Definition at line 435 of file update.c.

int xforce

Definition at line 436 of file update.c.

char* xjoin_rev1

Definition at line 443 of file update.c.

char* xjoin_rev2

Definition at line 444 of file update.c.

char* xoptions

Definition at line 433 of file update.c.

int xpipeout

Definition at line 441 of file update.c.

int xprune

Definition at line 440 of file update.c.

char* xtag

Definition at line 434 of file update.c.

Generated on Sun Oct 21 12:43:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


update.h File Reference

cvs-1.10/src/update.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int do_update | PROTO ((int argc, char *argv[], char *xoptions, char *xtag, char *xdate, int xforce, int local, int xbuild, int xaflag, int xprune, int xpipeout, int which, char *xjoin_rev1, char *xjoin_rev2, char *preload_update_dir))
int joining | PROTO ((void))
int isemptydir | PROTO ((char *dir, int might_not_exist))

Function Documentation

int isemptydir PROTO ( (char *dir, int might_not_exist) )

int joining PROTO ( (void) )

int do_update PROTO ( (int argc, char *argv[], char *xoptions, char *xtag, char *xdate, int xforce, int local, int xbuild, int xaflag, int xprune, int xpipeout, int which, char *xjoin_rev1, char *xjoin_rev2, char *preload_update_dir) )

Generated on Sun Oct 21 12:43:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


vers_ts.c File Reference

cvs-1.10/src/vers_ts.c File Reference

#include "cvs.h"

Include dependency graph for vers_ts.c:

Include dependency graph

Go to the source code of this file.

Functions

Vers_TS * | Version_TS (finfo, options, tag, date, force_tag_match, set_time) struct file_info *finfo

Variables

char * | options
char * | tag
char * | date
int | force_tag_match
int | set_time

Function Documentation

Vers_TS* Version_TS | ( | finfo | ,
 |  | options | ,
 |  | tag | ,
 |  | date | ,
 |  | force_tag_match | ,
 |  | set_time |
 | ) |

Variable Documentation

char* date

Definition at line 27 of file vers_ts.c.

int force_tag_match

Definition at line 28 of file vers_ts.c.

char* options

Definition at line 25 of file vers_ts.c.

int set_time

Definition at line 29 of file vers_ts.c.

char* tag

Definition at line 26 of file vers_ts.c.

Generated on Sun Oct 21 12:43:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


version.c File Reference

cvs-1.10/src/version.c File Reference

#include "cvs.h"

Include dependency graph for version.c:

Include dependency graph

Go to the source code of this file.

Functions

int | version (argc, argv) int argc

Variables

const char * | version_string = "Concurrent Versions System (CVS) 1.11"
const char * | config_string = "\n"
const char *const | version_usage []
char ** | argv

Function Documentation

int version | ( | argc | ,
 |  | argv |
 | ) |

Variable Documentation

char** argv

Definition at line 50 of file version.c.

const char* config_string = "\n"

Definition at line 27 of file version.c.

const char* version_string = "Concurrent Versions System (CVS) 1.11"

Definition at line 15 of file version.c.

const char* const version_usage[] [static]

Initial value:

{
    "Usage: %s %s\n",
    NULL
}

Definition at line 41 of file version.c.

Generated on Sun Oct 21 12:42:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/version.c Source File

cvs-1.10/src/version.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1994 david d `zoo' zuhn
00003  * Copyright (c) 1994 Free Software Foundation, Inc.
00004  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00005  * Copyright (c) 1989-1992, Brian Berliner
00006  *
00007  * You may distribute under the terms of the GNU General Public License as
00008  * specified in the README file that comes with this  CVS source distribution.
00009  *
00010  * version.c - the CVS version number
00011  */
00012
00013 #include "cvs.h"
00014
00015 const char *version_string = "Concurrent Versions System (CVS) 1.11";
00016
00017 #ifdef CLIENT_SUPPORT
00018 #ifdef SERVER_SUPPORT
00019 const char *config_string = " (client/server)\n";
00020 #else
00021 const char *config_string = " (client)\n";
00022 #endif
00023 #else
00024 #ifdef SERVER_SUPPORT
00025 const char *config_string = " (server)\n";
00026 #else
00027 const char *config_string = "\n";
00028 #endif
00029 #endif
00030
00031 #if defined(CVSGUI) && defined(WIN32)
00032 #include "../../WinCVS/version_no.h"
00033 #include "../../WinCVS/version_fu.h"
00034
00035 const char *cvsgui_version_string = "Concurrent Versions System (CVS) "
00036                                 CVSNTDOS_FILEVERSION_STRING "\n"
00037                                 "Part of WinCVS "
00038                                 WINCVS_PRODUCTVERSION_STRING "\n";
00039 #endif  /* CVSGUI */
00040
00041 static const char *const version_usage[] =
00042 {
00043     "Usage: %s %s\n",
00044     NULL
00045 };
00046
00047 int
00048 version (argc, argv)
00049     int argc;
00050     char **argv;
00051 {
00052     int err = 0;
00053
00054     if (argc == -1)
00055     usage (version_usage);
00056
00057 #ifdef CLIENT_SUPPORT
00058     if (client_active)
00059         (void) fputs ("Client: ", stdout);
00060 #endif
00061
00062     /* Having the year here is a good idea, so people have
00063        some idea of how long ago their version of CVS was
00064        released.  */
00065 #if defined(CVSGUI) && defined(WIN32)
00066     (void) fputs (cvsgui_version_string, stdout);
00067 #else
00068     (void) fputs (version_string, stdout);
00069 #endif
00070     (void) fputs (config_string, stdout);
00071
00072 #ifdef CLIENT_SUPPORT
00073     if (client_active)
00074     {
00075     (void) fputs ("Server: ", stdout);
00076     start_server ();
00077     if (supported_request ("version"))
00078         send_to_server ("version\012", 0);
00079     else
00080     {
00081         send_to_server ("noop\012", 0);
00082         fputs ("(unknown)\n", stdout);
00083     }
00084     err = get_responses_and_close ();
00085     }
00086 #endif
00087     return err;
00088 }
00089
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/watch.c Source File

cvs-1.10/src/watch.c

Go to the documentation of this file.
00001 /* Implementation for "cvs watch add", "cvs watchers", and related commands
00002
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; either version 2, or (at your option)
00006    any later version.
00007
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.  */
00012
00013 #include "cvs.h"
00014 #include "edit.h"
00015 #include "fileattr.h"
00016 #include "watch.h"
00017
00018 const char *const watch_usage[] =
00019 {
00020     "Usage: %s %s [on|off|add|remove] [-lR] [-a action] [files...]\n",
00021     "on/off: turn on/off read-only checkouts of files\n",
00022     "add/remove: add or remove notification on actions\n",
00023     "-l (on/off/add/remove): Local directory only, not recursive\n",
00024     "-R (on/off/add/remove): Process directories recursively\n",
00025     "-a (add/remove): Specify what actions, one of\n",
00026     "    edit,unedit,commit,all,none\n",
00027     "(Specify the --help global option for a list of other help options)\n",
00028     NULL
00029 };
00030
00031 static struct addremove_args the_args;
00032
00033 void
00034 watch_modify_watchers (file, what)
00035     char *file;
00036     struct addremove_args *what;
00037 {
00038     char *curattr = fileattr_get0 (file, "_watchers");
00039     char *p;
00040     char *pend;
00041     char *nextp;
00042     char *who;
00043     int who_len;
00044     char *mycurattr;
00045     char *mynewattr;
00046     size_t mynewattr_size;
00047
00048     int add_edit_pending;
00049     int add_unedit_pending;
00050     int add_commit_pending;
00051     int remove_edit_pending;
00052     int remove_unedit_pending;
00053     int remove_commit_pending;
00054     int add_tedit_pending;
00055     int add_tunedit_pending;
00056     int add_tcommit_pending;
00057
00058     who = getcaller ();
00059     who_len = strlen (who);
00060
00061     /* Look for current watcher types for this user.  */
00062     mycurattr = NULL;
00063     if (curattr != NULL)
00064     {
00065     p = curattr;
00066     while (1) {
00067         if (strncmp (who, p, who_len) == 0
00068         && p[who_len] == '>')
00069         {
00070         /* Found this user.  */
00071         mycurattr = p + who_len + 1;
00072         }
00073         p = strchr (p, ',');
00074         if (p == NULL)
00075         break;
00076         ++p;
00077     }
00078     }
00079     if (mycurattr != NULL)
00080     {
00081     mycurattr = xstrdup (mycurattr);
00082     p = strchr (mycurattr, ',');
00083     if (p != NULL)
00084         *p = '\0';
00085     }
00086
00087     /* Now copy mycurattr to mynewattr, making the requisite modifications.
00088        Note that we add a dummy '+' to the start of mynewattr, to reduce
00089        special cases (but then we strip it off when we are done).  */
00090
00091     mynewattr_size = sizeof "+edit+unedit+commit+tedit+tunedit+tcommit";
00092     if (mycurattr != NULL)
00093     mynewattr_size += strlen (mycurattr);
00094     mynewattr = xmalloc (mynewattr_size);
00095     mynewattr[0] = '\0';
00096
00097     add_edit_pending = what->adding && what->edit;
00098     add_unedit_pending = what->adding && what->unedit;
00099     add_commit_pending = what->adding && what->commit;
00100     remove_edit_pending = !what->adding && what->edit;
00101     remove_unedit_pending = !what->adding && what->unedit;
00102     remove_commit_pending = !what->adding && what->commit;
00103     add_tedit_pending = what->add_tedit;
00104     add_tunedit_pending = what->add_tunedit;
00105     add_tcommit_pending = what->add_tcommit;
00106
00107     /* Copy over existing watch types, except those to be removed.  */
00108     p = mycurattr;
00109     while (p != NULL)
00110     {
00111     pend = strchr (p, '+');
00112     if (pend == NULL)
00113     {
00114         pend = p + strlen (p);
00115         nextp = NULL;
00116     }
00117     else
00118         nextp = pend + 1;
00119
00120     /* Process this item.  */
00121     if (pend - p == 4 && strncmp ("edit", p, 4) == 0)
00122     {
00123         if (!remove_edit_pending)
00124         strcat (mynewattr, "+edit");
00125         add_edit_pending = 0;
00126     }
00127     else if (pend - p == 6 && strncmp ("unedit", p, 6) == 0)
00128     {
00129         if (!remove_unedit_pending)
00130         strcat (mynewattr, "+unedit");
00131         add_unedit_pending = 0;
00132     }
00133     else if (pend - p == 6 && strncmp ("commit", p, 6) == 0)
00134     {
00135         if (!remove_commit_pending)
00136         strcat (mynewattr, "+commit");
00137         add_commit_pending = 0;
00138     }
00139     else if (pend - p == 5 && strncmp ("tedit", p, 5) == 0)
00140     {
00141         if (!what->remove_temp)
00142         strcat (mynewattr, "+tedit");
00143         add_tedit_pending = 0;
00144     }
00145     else if (pend - p == 7 && strncmp ("tunedit", p, 7) == 0)
00146     {
00147         if (!what->remove_temp)
00148         strcat (mynewattr, "+tunedit");
00149         add_tunedit_pending = 0;
00150     }
00151     else if (pend - p == 7 && strncmp ("tcommit", p, 7) == 0)
00152     {
00153         if (!what->remove_temp)
00154         strcat (mynewattr, "+tcommit");
00155         add_tcommit_pending = 0;
00156     }
00157     else
00158     {
00159         char *mp;
00160
00161         /* Copy over any unrecognized watch types, for future
00162            expansion.  */
00163         mp = mynewattr + strlen (mynewattr);
00164         *mp++ = '+';
00165         strncpy (mp, p, pend - p);
00166         *(mp + (pend - p)) = '\0';
00167     }
00168
00169     /* Set up for next item.  */
00170     p = nextp;
00171     }
00172
00173     /* Add in new watch types.  */
00174     if (add_edit_pending)
00175     strcat (mynewattr, "+edit");
00176     if (add_unedit_pending)
00177     strcat (mynewattr, "+unedit");
00178     if (add_commit_pending)
00179     strcat (mynewattr, "+commit");
00180     if (add_tedit_pending)
00181     strcat (mynewattr, "+tedit");
00182     if (add_tunedit_pending)
00183     strcat (mynewattr, "+tunedit");
00184     if (add_tcommit_pending)
00185     strcat (mynewattr, "+tcommit");
00186
00187     {
00188     char *curattr_new;
00189
00190     curattr_new =
00191       fileattr_modify (curattr,
00192                who,
00193                mynewattr[0] == '\0' ? NULL : mynewattr + 1,
00194                '>',
00195                ',');
00196     /* If the attribute is unchanged, don't rewrite the attribute file.  */
00197     if (!((curattr_new == NULL && curattr == NULL)
00198           || (curattr_new != NULL
00199           && curattr != NULL
00200           && strcmp (curattr_new, curattr) == 0)))
00201         fileattr_set (file,
00202               "_watchers",
00203               curattr_new);
00204     if (curattr_new != NULL)
00205         free (curattr_new);
00206     }
00207
00208     if (curattr != NULL)
00209     free (curattr);
00210     if (mycurattr != NULL)
00211     free (mycurattr);
00212     if (mynewattr != NULL)
00213     free (mynewattr);
00214 }
00215
00216 static int addremove_fileproc PROTO ((void *callerdat,
00217                       struct file_info *finfo));
00218
00219 static int
00220 addremove_fileproc (callerdat, finfo)
00221     void *callerdat;
00222     struct file_info *finfo;
00223 {
00224     watch_modify_watchers (finfo->file, &the_args);
00225     return 0;
00226 }
00227
00228 static int addremove_filesdoneproc PROTO ((void *, int, char *, char *,
00229                        List *));
00230
00231 static int
00232 addremove_filesdoneproc (callerdat, err, repository, update_dir, entries)
00233     void *callerdat;
00234     int err;
00235     char *repository;
00236     char *update_dir;
00237     List *entries;
00238 {
00239     if (the_args.setting_default)
00240     watch_modify_watchers (NULL, &the_args);
00241     return err;
00242 }
00243
00244 static int watch_addremove PROTO ((int argc, char **argv));
00245
00246 static int
00247 watch_addremove (argc, argv)
00248     int argc;
00249     char **argv;
00250 {
00251     int c;
00252     int local = 0;
00253     int err;
00254     int a_omitted;
00255
00256     a_omitted = 1;
00257     the_args.commit = 0;
00258     the_args.edit = 0;
00259     the_args.unedit = 0;
00260     optind = 0;
00261     while ((c = getopt (argc, argv, "+lRa:")) != -1)
00262     {
00263     switch (c)
00264     {
00265         case 'l':
00266         local = 1;
00267         break;
00268         case 'R':
00269         local = 0;
00270         break;
00271         case 'a':
00272         a_omitted = 0;
00273         if (strcmp (optarg, "edit") == 0)
00274             the_args.edit = 1;
00275         else if (strcmp (optarg, "unedit") == 0)
00276             the_args.unedit = 1;
00277         else if (strcmp (optarg, "commit") == 0)
00278             the_args.commit = 1;
00279         else if (strcmp (optarg, "all") == 0)
00280         {
00281             the_args.edit = 1;
00282             the_args.unedit = 1;
00283             the_args.commit = 1;
00284         }
00285         else if (strcmp (optarg, "none") == 0)
00286         {
00287             the_args.edit = 0;
00288             the_args.unedit = 0;
00289             the_args.commit = 0;
00290         }
00291         else
00292             usage (watch_usage);
00293         break;
00294         case '?':
00295         default:
00296         usage (watch_usage);
00297         break;
00298     }
00299     }
00300     argc -= optind;
00301     argv += optind;
00302
00303     if (a_omitted)
00304     {
00305     the_args.edit = 1;
00306     the_args.unedit = 1;
00307     the_args.commit = 1;
00308     }
00309
00310 #ifdef CLIENT_SUPPORT
00311     if (client_active)
00312     {
00313     start_server ();
00314     ign_setup ();
00315
00316     if (local)
00317         send_arg ("-l");
00318     /* FIXME: copes poorly with "all" if server is extended to have
00319        new watch types and client is still running an old version.  */
00320     if (the_args.edit)
00321     {
00322         send_arg ("-a");
00323         send_arg ("edit");
00324     }
00325     if (the_args.unedit)
00326     {
00327         send_arg ("-a");
00328         send_arg ("unedit");
00329     }
00330     if (the_args.commit)
00331     {
00332         send_arg ("-a");
00333         send_arg ("commit");
00334     }
00335     if (!the_args.edit && !the_args.unedit && !the_args.commit)
00336     {
00337         send_arg ("-a");
00338         send_arg ("none");
00339     }
00340     send_files (argc, argv, local, 0, SEND_NO_CONTENTS);
00341     send_file_names (argc, argv, SEND_EXPAND_WILD);
00342     send_to_server (the_args.adding ?
00343                         "watch-add\012" : "watch-remove\012",
00344                         0);
00345     return get_responses_and_close ();
00346     }
00347 #endif /* CLIENT_SUPPORT */
00348
00349     the_args.setting_default = (argc <= 0);
00350
00351     lock_tree_for_write (argc, argv, local, 0);
00352
00353     err = start_recursion (addremove_fileproc, addremove_filesdoneproc,
00354                (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
00355                argc, argv, local, W_LOCAL, 0, 0, (char *)NULL,
00356                1);
00357
00358     Lock_Cleanup ();
00359     return err;
00360 }
00361
00362 int
00363 watch_add (argc, argv)
00364     int argc;
00365     char **argv;
00366 {
00367     the_args.adding = 1;
00368     return watch_addremove (argc, argv);
00369 }
00370
00371 int
00372 watch_remove (argc, argv)
00373     int argc;
00374     char **argv;
00375 {
00376     the_args.adding = 0;
00377     return watch_addremove (argc, argv);
00378 }
00379
00380 int
00381 watch (argc, argv)
00382     int argc;
00383     char **argv;
00384 {
00385     if (argc <= 1)
00386     usage (watch_usage);
00387     if (strcmp (argv[1], "on") == 0)
00388     {
00389     --argc;
00390     ++argv;
00391     return watch_on (argc, argv);
00392     }
00393     else if (strcmp (argv[1], "off") == 0)
00394     {
00395     --argc;
00396     ++argv;
00397     return watch_off (argc, argv);
00398     }
00399     else if (strcmp (argv[1], "add") == 0)
00400     {
00401     --argc;
00402     ++argv;
00403     return watch_add (argc, argv);
00404     }
00405     else if (strcmp (argv[1], "remove") == 0)
00406     {
00407     --argc;
00408     ++argv;
00409     return watch_remove (argc, argv);
00410     }
00411     else
00412     usage (watch_usage);
00413     return 0;
00414 }
00415
00416 static const char *const watchers_usage[] =
00417 {
00418     "Usage: %s %s [-lR] [files...]\n",
00419     "\t-l\tProcess this directory only (not recursive).\n",
00420     "\t-R\tProcess directories recursively.\n",
00421     "(Specify the --help global option for a list of other help options)\n",
00422     NULL
00423 };
00424
00425 static int watchers_fileproc PROTO ((void *callerdat,
00426                      struct file_info *finfo));
00427
00428 static int
00429 watchers_fileproc (callerdat, finfo)
00430     void *callerdat;
00431     struct file_info *finfo;
00432 {
00433     char *them;
00434     char *p;
00435
00436     them = fileattr_get0 (finfo->file, "_watchers");
00437     if (them == NULL)
00438     return 0;
00439
00440     cvs_output (finfo->fullname, 0);
00441
00442     p = them;
00443     while (1)
00444     {
00445     cvs_output ("\t", 1);
00446     while (*p != '>' && *p != '\0')
00447         cvs_output (p++, 1);
00448     if (*p == '\0')
00449     {
00450         /* Only happens if attribute is misformed.  */
00451         cvs_output ("\n", 1);
00452         break;
00453     }
00454     ++p;
00455     cvs_output ("\t", 1);
00456     while (1)
00457     {
00458         while (*p != '+' && *p != ',' && *p != '\0')
00459         cvs_output (p++, 1);
00460         if (*p == '\0')
00461         {
00462         cvs_output ("\n", 1);
00463         goto out;
00464         }
00465         if (*p == ',')
00466         {
00467         ++p;
00468         break;
00469         }
00470         ++p;
00471         cvs_output ("\t", 1);
00472     }
00473     cvs_output ("\n", 1);
00474     }
00475   out:;
00476     free (them);
00477     return 0;
00478 }
00479
00480 int
00481 watchers (argc, argv)
00482     int argc;
00483     char **argv;
00484 {
00485     int local = 0;
00486     int c;
00487
00488     if (argc == -1)
00489     usage (watchers_usage);
00490
00491     optind = 0;
00492     while ((c = getopt (argc, argv, "+lR")) != -1)
00493     {
00494     switch (c)
00495     {
00496         case 'l':
00497         local = 1;
00498         break;
00499         case 'R':
00500         local = 0;
00501         break;
00502         case '?':
00503         default:
00504         usage (watchers_usage);
00505         break;
00506     }
00507     }
00508     argc -= optind;
00509     argv += optind;
00510
00511 #ifdef CLIENT_SUPPORT
00512     if (client_active)
00513     {
00514     start_server ();
00515     ign_setup ();
00516
00517     if (local)
00518         send_arg ("-l");
00519     send_files (argc, argv, local, 0, SEND_NO_CONTENTS);
00520     send_file_names (argc, argv, SEND_EXPAND_WILD);
00521     send_to_server ("watchers\012", 0);
00522     return get_responses_and_close ();
00523     }
00524 #endif /* CLIENT_SUPPORT */
00525
00526     return start_recursion (watchers_fileproc, (FILESDONEPROC) NULL,
00527                 (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, NULL,
00528                 argc, argv, local, W_LOCAL, 0, 1, (char *)NULL,
00529                 1);
00530 }
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/watch.h Source File

cvs-1.10/src/watch.h

Go to the documentation of this file.
00001 /* Interface to "cvs watch add", "cvs watchers", and related features
00002
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; either version 2, or (at your option)
00006    any later version.
00007
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.  */
00012
00013 extern const char *const watch_usage[];
00014
00015 /* Flags to pass between the various functions making up the
00016    add/remove code.  All in a single structure in case there is some
00017    need to make the code reentrant some day.  */
00018
00019 struct addremove_args {
00020     /* A flag for each watcher type.  */
00021     int edit;
00022     int unedit;
00023     int commit;
00024
00025     /* Are we adding or removing (non-temporary) edit,unedit,and/or commit
00026        watches?  */
00027     int adding;
00028
00029     /* Should we add a temporary edit watch?  */
00030     int add_tedit;
00031     /* Should we add a temporary unedit watch?  */
00032     int add_tunedit;
00033     /* Should we add a temporary commit watch?  */
00034     int add_tcommit;
00035
00036     /* Should we remove all temporary watches?  */
00037     int remove_temp;
00038
00039     /* Should we set the default?  This is here for passing among various
00040        routines in watch.c (a good place for it if there is ever any reason
00041        to make the stuff reentrant), not for watch_modify_watchers.  */
00042     int setting_default;
00043 };
00044
00045 /* Modify the watchers for FILE.  *WHAT tells what to do to them.
00046    If FILE is NULL, modify default args (WHAT->SETTING_DEFAULT is
00047    not used).  */
00048 extern void watch_modify_watchers PROTO ((char *file,
00049                       struct addremove_args *what));
00050
00051 extern int watch_add PROTO ((int argc, char **argv));
00052 extern int watch_remove PROTO ((int argc, char **argv));
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/wrapper.c Source File

cvs-1.10/src/wrapper.c

Go to the documentation of this file.
00001 /* This program is free software; you can redistribute it and/or modify
00002    it under the terms of the GNU General Public License as published by
00003    the Free Software Foundation; either version 2, or (at your option)
00004    any later version.
00005
00006    This program is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009    GNU General Public License for more details.  */
00010
00011 #include "cvs.h"
00012 #include "getline.h"
00013
00014 /*
00015   Original Author:  athan@morgan.com <Andrew C. Athan> 2/1/94
00016   Modified By:      vdemarco@bou.shl.com
00017
00018   This package was written to support the NEXTSTEP concept of
00019   "wrappers."  These are essentially directories that are to be
00020   treated as "files."  This package allows such wrappers to be
00021   "processed" on the way in and out of CVS.  The intended use is to
00022   wrap up a wrapper into a single tar, such that that tar can be
00023   treated as a single binary file in CVS.  To solve the problem
00024   effectively, it was also necessary to be able to prevent rcsmerge
00025   application at appropriate times.
00026
00027   ------------------
00028   Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
00029
00030   wildcard  [option value][option value]...
00031
00032   where option is one of
00033   -f        from cvs filter     value: path to filter
00034   -t        to cvs filter       value: path to filter
00035   -m        update methodology  value: MERGE or COPY
00036   -k        default -k rcs option to use on import or add
00037
00038   and value is a single-quote delimited value.
00039
00040   E.g:
00041   *.nib     -f 'gunzipuntar' -t 'targzip' -m 'COPY'
00042 */
00043
00044
00045 typedef struct {
00046     char *wildCard;
00047     char *tocvsFilter;
00048     char *fromcvsFilter;
00049     char *rcsOption;
00050     WrapMergeMethod mergeMethod;
00051 } WrapperEntry;
00052
00053 static WrapperEntry **wrap_list=NULL;
00054 static WrapperEntry **wrap_saved_list=NULL;
00055
00056 static int wrap_size=0;
00057 static int wrap_count=0;
00058 static int wrap_tempcount=0;
00059
00060 /* FIXME: the relationship between wrap_count, wrap_tempcount,
00061  * wrap_saved_count, and wrap_saved_tempcount is not entirely clear;
00062  * it is certainly suspicious that wrap_saved_count is never set to a
00063  * value other than zero!  If the variable isn't being used, it should
00064  * be removed.  And in general, we should describe how temporary
00065  * vs. permanent wrappers are implemented, and then make sure the
00066  * implementation is actually doing that.
00067  *
00068  * Right now things seem to be working, but that's no guarantee there
00069  * isn't a bug lurking somewhere in the murk.
00070  */
00071
00072 static int wrap_saved_count=0;
00073
00074 static int wrap_saved_tempcount=0;
00075
00076 #define WRAPPER_GROW    8
00077
00078 void wrap_add_entry PROTO((WrapperEntry *e,int temp));
00079 void wrap_kill PROTO((void));
00080 void wrap_kill_temp PROTO((void));
00081 void wrap_free_entry PROTO((WrapperEntry *e));
00082 void wrap_free_entry_internal PROTO((WrapperEntry *e));
00083 void wrap_restore_saved PROTO((void));
00084
00085 void wrap_setup()
00086 {
00087     /* FIXME-reentrancy: if we do a multithreaded server, will need to
00088        move this to a per-connection data structure, or better yet
00089        think about a cleaner solution.  */
00090     static int wrap_setup_already_done = 0;
00091     char *homedir;
00092
00093     if (wrap_setup_already_done != 0)
00094         return;
00095     else
00096         wrap_setup_already_done = 1;
00097
00098 #ifdef CLIENT_SUPPORT
00099     if (!client_active)
00100 #endif
00101     {
00102     char *file;
00103
00104     file = xmalloc (strlen (CVSroot_directory)
00105             + sizeof (CVSROOTADM)
00106             + sizeof (CVSROOTADM_WRAPPER)
00107             + 10);
00108     /* Then add entries found in repository, if it exists.  */
00109     (void) sprintf (file, "%s/%s/%s", CVSroot_directory, CVSROOTADM,
00110             CVSROOTADM_WRAPPER);
00111     if (isfile (file))
00112     {
00113         wrap_add_file(file,0);
00114     }
00115     free (file);
00116     }
00117
00118     /* Then add entries found in home dir, (if user has one) and file
00119        exists.  */
00120     homedir = get_homedir ();
00121     /* If we can't find a home directory, ignore ~/.cvswrappers.  This may
00122        make tracking down problems a bit of a pain, but on the other
00123        hand it might be obnoxious to complain when CVS will function
00124        just fine without .cvswrappers (and many users won't even know what
00125        .cvswrappers is).  */
00126     if (homedir != NULL)
00127     {
00128     char *file;
00129
00130     file = xmalloc (strlen (homedir) + sizeof (CVSDOTWRAPPER) + 10);
00131     (void) sprintf (file, "%s/%s", homedir, CVSDOTWRAPPER);
00132     if (isfile (file))
00133     {
00134         wrap_add_file (file, 0);
00135     }
00136     free (file);
00137     }
00138
00139     /* FIXME: calling wrap_add() below implies that the CVSWRAPPERS
00140      * environment variable contains exactly one "wrapper" -- a line
00141      * of the form
00142      *
00143      *    FILENAME_PATTERN  FLAG  OPTS [ FLAG OPTS ...]
00144      *
00145      * This may disagree with the documentation, which states:
00146      *
00147      *   `$CVSWRAPPERS'
00148      *      A whitespace-separated list of file name patterns that CVS
00149      *      should treat as wrappers. *Note Wrappers::.
00150      *
00151      * Does this mean the environment variable can hold multiple
00152      * wrappers lines?  If so, a single call to wrap_add() is
00153      * insufficient.
00154      */
00155
00156     /* Then add entries found in CVSWRAPPERS environment variable. */
00157     wrap_add (getenv (WRAPPER_ENV), 0);
00158 }
00159
00160 #ifdef CLIENT_SUPPORT
00161 /* Send -W arguments for the wrappers to the server.  The command must
00162    be one that accepts them (e.g. update, import).  */
00163 void
00164 wrap_send ()
00165 {
00166     int i;
00167
00168     for (i = 0; i < wrap_count + wrap_tempcount; ++i)
00169     {
00170     if (wrap_list[i]->tocvsFilter != NULL
00171         || wrap_list[i]->fromcvsFilter != NULL)
00172         /* For greater studliness we would print the offending option
00173            and (more importantly) where we found it.  */
00174         error (0, 0, "\
00175 -t and -f wrapper options are not supported remotely; ignored");
00176     if (wrap_list[i]->mergeMethod == WRAP_COPY)
00177         /* For greater studliness we would print the offending option
00178            and (more importantly) where we found it.  */
00179         error (0, 0, "\
00180 -m wrapper option is not supported remotely; ignored");
00181     if (wrap_list[i]->rcsOption != NULL)
00182     {
00183         send_to_server ("Argument -W\012Argument ", 0);
00184         send_to_server (wrap_list[i]->wildCard, 0);
00185         send_to_server (" -k '", 0);
00186         send_to_server (wrap_list[i]->rcsOption, 0);
00187         send_to_server ("'\012", 0);
00188     }
00189     }
00190 }
00191 #endif /* CLIENT_SUPPORT */
00192
00193 #if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)
00194 /* Output wrapper entries in the format of cvswrappers lines.
00195  *
00196  * This is useful when one side of a client/server connection wants to
00197  * send its wrappers to the other; since the receiving side would like
00198  * to use wrap_add() to incorporate the wrapper, it's best if the
00199  * entry arrives in this format.
00200  *
00201  * The entries are stored in `line', which is allocated here.  Caller
00202  * can free() it.
00203  *
00204  * If first_call_p is nonzero, then start afresh.  */
00205 void
00206 wrap_unparse_rcs_options (line, first_call_p)
00207     char **line;
00208     int first_call_p;
00209 {
00210     /* FIXME-reentrancy: we should design a reentrant interface, like
00211        a callback which gets handed each wrapper (a multithreaded
00212        server being the most concrete reason for this, but the
00213        non-reentrant interface is fairly unnecessary/ugly).  */
00214     static int i;
00215
00216     if (first_call_p)
00217         i = 0;
00218
00219     for (; i < wrap_count + wrap_tempcount; ++i)
00220     {
00221     if (wrap_list[i]->rcsOption != NULL)
00222     {
00223             *line = xmalloc (strlen (wrap_list[i]->wildCard)
00224                              + strlen ("\t")
00225                              + strlen (" -k '")
00226                              + strlen (wrap_list[i]->rcsOption)
00227                              + strlen ("'")
00228                              + 1);  /* leave room for '\0' */
00229
00230             strcpy (*line, wrap_list[i]->wildCard);
00231             strcat (*line, " -k '");
00232             strcat (*line, wrap_list[i]->rcsOption);
00233             strcat (*line, "'");
00234
00235             /* We're going to miss the increment because we return, so
00236                do it by hand. */
00237             ++i;
00238
00239             return;
00240     }
00241     }
00242
00243     *line = NULL;
00244     return;
00245 }
00246 #endif /* SERVER_SUPPORT || CLIENT_SUPPORT */
00247
00248 /*
00249  * Open a file and read lines, feeding each line to a line parser. Arrange
00250  * for keeping a temporary list of wrappers at the end, if the "temp"
00251  * argument is set.
00252  */
00253 void
00254 wrap_add_file (file, temp)
00255     const char *file;
00256     int temp;
00257 {
00258     FILE *fp;
00259     char *line = NULL;
00260     size_t line_allocated = 0;
00261
00262     wrap_restore_saved ();
00263     wrap_kill_temp ();
00264
00265     /* Load the file.  */
00266     fp = CVS_FOPEN (file, "r");
00267     if (fp == NULL)
00268     {
00269     if (!existence_error (errno))
00270         error (0, errno, "cannot open %s", file);
00271     return;
00272     }
00273     while (getline (&line, &line_allocated, fp) >= 0)
00274     wrap_add (line, temp);
00275     if (line)
00276         free (line);
00277     if (ferror (fp))
00278     error (0, errno, "cannot read %s", file);
00279     if (fclose (fp) == EOF)
00280     error (0, errno, "cannot close %s", file);
00281 }
00282
00283 void
00284 wrap_kill()
00285 {
00286     wrap_kill_temp();
00287     while(wrap_count)
00288     wrap_free_entry(wrap_list[--wrap_count]);
00289 }
00290
00291 void
00292 wrap_kill_temp()
00293 {
00294     WrapperEntry **temps=wrap_list+wrap_count;
00295
00296     while(wrap_tempcount)
00297     wrap_free_entry(temps[--wrap_tempcount]);
00298 }
00299
00300 void
00301 wrap_free_entry(e)
00302      WrapperEntry *e;
00303 {
00304     wrap_free_entry_internal(e);
00305     free(e);
00306 }
00307
00308 void
00309 wrap_free_entry_internal(e)
00310     WrapperEntry *e;
00311 {
00312     free (e->wildCard);
00313     if (e->tocvsFilter)
00314     free (e->tocvsFilter);
00315     if (e->fromcvsFilter)
00316     free (e->fromcvsFilter);
00317     if (e->rcsOption)
00318     free (e->rcsOption);
00319 }
00320
00321 void
00322 wrap_restore_saved()
00323 {
00324     if(!wrap_saved_list)
00325     return;
00326
00327     wrap_kill();
00328
00329     free(wrap_list);
00330
00331     wrap_list=wrap_saved_list;
00332     wrap_count=wrap_saved_count;
00333     wrap_tempcount=wrap_saved_tempcount;
00334
00335     wrap_saved_list=NULL;
00336     wrap_saved_count=0;
00337     wrap_saved_tempcount=0;
00338 }
00339
00340 void
00341 wrap_add (line, isTemp)
00342    char *line;
00343    int         isTemp;
00344 {
00345     char *temp;
00346     char ctemp;
00347     WrapperEntry e;
00348     char opt;
00349 #ifdef CVSGUI
00350     int hasQuote = 0;
00351 #endif /* CVSGUI */
00352
00353     if (!line || line[0] == '#')
00354     return;
00355
00356     memset (&e, 0, sizeof(e));
00357
00358     /* Search for the wild card */
00359     while (*line && isspace ((unsigned char) *line))
00360     ++line;
00361 #ifdef CVSGUI
00362     /*
00363      * - Extend that so we handle spaces using
00364      * '"' (ex: "a string")...
00365      * - This rather should be a little flex lexer so
00366      * we could handle strings like "a \"string\"" or 'a string'...
00367      */
00368     if((*line) == '"')
00369     {
00370         hasQuote = 1;
00371         line++;
00372     }
00373     for(temp=line;*line;++line)
00374     {
00375         if((*line) == '"')
00376         {
00377             if(hasQuote)
00378             {
00379                 hasQuote = 0; /* ok doc */
00380                 break;
00381             }
00382         }
00383         if(isspace((unsigned char) *line) && !hasQuote)
00384             break;
00385     }
00386     if(hasQuote) /* mismatch quote */
00387         temp = line;
00388
00389 #else /* CVSGUI */
00390     for (temp = line;
00391      *line && !isspace ((unsigned char) *line);
00392      ++line)
00393     ;
00394 #endif /* CVSGUI */
00395     if(temp==line)
00396     return;
00397
00398     ctemp=*line;
00399     *line='\0';
00400
00401     e.wildCard=xstrdup(temp);
00402     *line=ctemp;
00403
00404     while(*line){
00405         /* Search for the option */
00406     while(*line && *line!='-')
00407         ++line;
00408     if(!*line)
00409         break;
00410     ++line;
00411     if(!*line)
00412         break;
00413     opt=*line;
00414
00415         /* Search for the filter commandline */
00416     for(++line;*line && *line!='\'';++line);
00417     if(!*line)
00418         break;
00419
00420     for(temp=++line;*line && (*line!='\'' || line[-1]=='\\');++line)
00421         ;
00422
00423     /* This used to "break;" (ignore the option) if there was a
00424        single character between the single quotes (I'm guessing
00425        that was accidental).  Now it "break;"s if there are no
00426        characters.  I'm not sure either behavior is particularly
00427        necessary--the current options might not require ''
00428        arguments, but surely some future option legitimately
00429        might.  Also I'm not sure that ignoring the option is a
00430        swift way to handle syntax errors in general.  */
00431     if (line==temp)
00432         break;
00433
00434     ctemp=*line;
00435     *line='\0';
00436     switch(opt){
00437     case 'f':
00438         /* Before this is reenabled, need to address the problem in
00439            commit.c (see http://www.cyclic.com/cvs/dev-wrap.txt).  */
00440         error (1, 0,
00441            "-t/-f wrappers not supported by this version of CVS");
00442
00443         if(e.fromcvsFilter)
00444         free(e.fromcvsFilter);
00445         /* FIXME: error message should say where the bad value
00446            came from.  */
00447         e.fromcvsFilter=expand_path (temp, "<wrapper>", 0);
00448             if (!e.fromcvsFilter)
00449         error (1, 0, "Correct above errors first");
00450         break;
00451     case 't':
00452         /* Before this is reenabled, need to address the problem in
00453            commit.c (see http://www.cyclic.com/cvs/dev-wrap.txt).  */
00454         error (1, 0,
00455            "-t/-f wrappers not supported by this version of CVS");
00456
00457         if(e.tocvsFilter)
00458         free(e.tocvsFilter);
00459         /* FIXME: error message should say where the bad value
00460            came from.  */
00461         e.tocvsFilter=expand_path (temp, "<wrapper>", 0);
00462             if (!e.tocvsFilter)
00463         error (1, 0, "Correct above errors first");
00464         break;
00465     case 'm':
00466         if(*temp=='C' || *temp=='c')
00467         e.mergeMethod=WRAP_COPY;
00468         else
00469         e.mergeMethod=WRAP_MERGE;
00470         break;
00471     case 'k':
00472         if (e.rcsOption)
00473         free (e.rcsOption);
00474         e.rcsOption = xstrdup (temp);
00475         break;
00476     default:
00477         break;
00478     }
00479     *line=ctemp;
00480     if(!*line)break;
00481     ++line;
00482     }
00483
00484     wrap_add_entry(&e, isTemp);
00485 }
00486
00487 void
00488 wrap_add_entry(e, temp)
00489     WrapperEntry *e;
00490     int temp;
00491 {
00492     int x;
00493     if(wrap_count+wrap_tempcount>=wrap_size){
00494     wrap_size += WRAPPER_GROW;
00495     wrap_list = (WrapperEntry **) xrealloc ((char *) wrap_list,
00496                         wrap_size *
00497                         sizeof (WrapperEntry *));
00498     }
00499
00500     if(!temp && wrap_tempcount){
00501     for(x=wrap_count+wrap_tempcount-1;x>=wrap_count;--x)
00502         wrap_list[x+1]=wrap_list[x];
00503     }
00504
00505     x=(temp ? wrap_count+(wrap_tempcount++):(wrap_count++));
00506     wrap_list[x]=(WrapperEntry *)xmalloc(sizeof(WrapperEntry));
00507     wrap_list[x]->wildCard=e->wildCard;
00508     wrap_list[x]->fromcvsFilter=e->fromcvsFilter;
00509     wrap_list[x]->tocvsFilter=e->tocvsFilter;
00510     wrap_list[x]->mergeMethod=e->mergeMethod;
00511     wrap_list[x]->rcsOption = e->rcsOption;
00512 }
00513
00514 /* Return 1 if the given filename is a wrapper filename */
00515 int
00516 wrap_name_has (name,has)
00517     const char   *name;
00518     WrapMergeHas  has;
00519 {
00520     int x,count=wrap_count+wrap_tempcount;
00521     char *temp;
00522
00523     for(x=0;x<count;++x)
00524     if (CVS_FNMATCH (wrap_list[x]->wildCard, name, 0) == 0){
00525         switch(has){
00526         case WRAP_TOCVS:
00527         temp=wrap_list[x]->tocvsFilter;
00528         break;
00529         case WRAP_FROMCVS:
00530         temp=wrap_list[x]->fromcvsFilter;
00531         break;
00532         case WRAP_RCSOPTION:
00533         temp = wrap_list[x]->rcsOption;
00534         break;
00535         default:
00536             abort ();
00537         }
00538         if(temp==NULL)
00539         return (0);
00540         else
00541         return (1);
00542     }
00543     return (0);
00544 }
00545
00546 static WrapperEntry *wrap_matching_entry PROTO ((const char *));
00547
00548 static WrapperEntry *
00549 wrap_matching_entry (name)
00550     const char *name;
00551 {
00552     int x,count=wrap_count+wrap_tempcount;
00553
00554     for(x=0;x<count;++x)
00555     if (CVS_FNMATCH (wrap_list[x]->wildCard, name, 0) == 0)
00556         return wrap_list[x];
00557     return (WrapperEntry *)NULL;
00558 }
00559
00560 /* Return the RCS options for FILENAME in a newly malloc'd string.  If
00561    ASFLAG, then include "-k" at the beginning (e.g. "-kb"), otherwise
00562    just give the option itself (e.g. "b").  */
00563 char *
00564 wrap_rcsoption (filename, asflag)
00565     const char *filename;
00566     int asflag;
00567 {
00568     WrapperEntry *e = wrap_matching_entry (filename);
00569     char *buf;
00570
00571     if (e == NULL || e->rcsOption == NULL || (*e->rcsOption == '\0'))
00572     return NULL;
00573
00574     buf = xmalloc (strlen (e->rcsOption) + 3);
00575     if (asflag)
00576     {
00577     strcpy (buf, "-k");
00578     strcat (buf, e->rcsOption);
00579     }
00580     else
00581     {
00582     strcpy (buf, e->rcsOption);
00583     }
00584     return buf;
00585 }
00586
00587 char *
00588 wrap_tocvs_process_file(fileName)
00589     const char *fileName;
00590 {
00591     WrapperEntry *e=wrap_matching_entry(fileName);
00592     static char *buf = NULL;
00593     char *args;
00594
00595     if(e==NULL || e->tocvsFilter==NULL)
00596     return NULL;
00597
00598     if (buf != NULL)
00599     free (buf);
00600     buf = cvs_temp_name ();
00601
00602     args = xmalloc (strlen (e->tocvsFilter)
00603             + strlen (fileName)
00604             + strlen (buf));
00605     /* FIXME: sprintf will blow up if the format string contains items other
00606        than %s, or contains too many %s's.  We should instead be parsing
00607        e->tocvsFilter ourselves and giving a real error.  */
00608     sprintf (args, e->tocvsFilter, fileName, buf);
00609     run_setup (args);
00610     run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY );
00611     free (args);
00612
00613     return buf;
00614 }
00615
00616 int
00617 wrap_merge_is_copy (fileName)
00618     const char *fileName;
00619 {
00620     WrapperEntry *e=wrap_matching_entry(fileName);
00621     if(e==NULL || e->mergeMethod==WRAP_MERGE)
00622     return 0;
00623
00624     return 1;
00625 }
00626
00627 void
00628 wrap_fromcvs_process_file(fileName)
00629     const char *fileName;
00630 {
00631     char *args;
00632     WrapperEntry *e=wrap_matching_entry(fileName);
00633
00634     if(e==NULL || e->fromcvsFilter==NULL)
00635     return;
00636
00637     args = xmalloc (strlen (e->fromcvsFilter)
00638             + strlen (fileName));
00639     /* FIXME: sprintf will blow up if the format string contains items other
00640        than %s, or contains too many %s's.  We should instead be parsing
00641        e->fromcvsFilter ourselves and giving a real error.  */
00642     sprintf (args, e->fromcvsFilter, fileName);
00643     run_setup (args);
00644     run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL );
00645     free (args);
00646     return;
00647 }
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/src/zlib.c Source File

cvs-1.10/src/zlib.c

Go to the documentation of this file.
00001 /* zlib.c --- interface to the zlib compression library
00002    Ian Lance Taylor <ian@cygnus.com>
00003
00004    This file is part of GNU CVS.
00005
00006    GNU CVS is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published by the
00008    Free Software Foundation; either version 2, or (at your option) any
00009    later version.
00010
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.  */
00015
00016 /* The routines in this file are the interface between the CVS
00017    client/server support and the zlib compression library.  */
00018
00019 #include <assert.h>
00020 #include "cvs.h"
00021 #include "buffer.h"
00022
00023 #if defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT)
00024
00025 #include "zlib.h"
00026
00027 /* OS/2 doesn't have EIO.  FIXME: this whole notion of turning
00028    a different error into EIO strikes me as pretty dubious.  */
00029 #if !defined (EIO)
00030 #define EIO EBADPOS
00031 #endif
00032
00033 /* The compression interface is built upon the buffer data structure.
00034    We provide a buffer type which compresses or decompresses the data
00035    which passes through it.  An input buffer decompresses the data
00036    read from an underlying buffer, and an output buffer compresses the
00037    data before writing it to an underlying buffer.  */
00038
00039 /* This structure is the closure field of the buffer.  */
00040
00041 struct compress_buffer
00042 {
00043     /* The underlying buffer.  */
00044     struct buffer *buf;
00045     /* The compression information.  */
00046     z_stream zstr;
00047 };
00048
00049 static void compress_error PROTO((int, int, z_stream *, const char *));
00050 static int compress_buffer_input PROTO((void *, char *, int, int, int *));
00051 static int compress_buffer_output PROTO((void *, const char *, int, int *));
00052 static int compress_buffer_flush PROTO((void *));
00053 static int compress_buffer_block PROTO((void *, int));
00054 static int compress_buffer_shutdown_input PROTO((void *));
00055 static int compress_buffer_shutdown_output PROTO((void *));
00056
00057 /* Report an error from one of the zlib functions.  */
00058
00059 static void
00060 compress_error (status, zstatus, zstr, msg)
00061      int status;
00062      int zstatus;
00063      z_stream *zstr;
00064      const char *msg;
00065 {
00066     int hold_errno;
00067     const char *zmsg;
00068     char buf[100];
00069
00070     hold_errno = errno;
00071
00072     zmsg = zstr->msg;
00073     if (zmsg == NULL)
00074     {
00075         sprintf (buf, "error %d", zstatus);
00076     zmsg = buf;
00077     }
00078
00079     error (status,
00080        zstatus == Z_ERRNO ? hold_errno : 0,
00081        "%s: %s", msg, zmsg);
00082 }
00083
00084 /* Create a compression buffer.  */
00085
00086 struct buffer *
00087 compress_buffer_initialize (buf, input, level, memory)
00088      struct buffer *buf;
00089      int input;
00090      int level;
00091      void (*memory) PROTO((struct buffer *));
00092 {
00093     struct compress_buffer *n;
00094     int zstatus;
00095
00096     n = (struct compress_buffer *) xmalloc (sizeof *n);
00097     memset (n, 0, sizeof *n);
00098
00099     n->buf = buf;
00100
00101     if (input)
00102     zstatus = inflateInit (&n->zstr);
00103     else
00104     zstatus = deflateInit (&n->zstr, level);
00105     if (zstatus != Z_OK)
00106     compress_error (1, zstatus, &n->zstr, "compression initialization");
00107
00108     /* There may already be data buffered on BUF.  For an output
00109        buffer, this is OK, because these routines will just use the
00110        buffer routines to append data to the (uncompressed) data
00111        already on BUF.  An input buffer expects to handle a single
00112        buffer_data of buffered input to be uncompressed, so that is OK
00113        provided there is only one buffer.  At present that is all
00114        there ever will be; if this changes, compress_buffer_input must
00115        be modified to handle multiple input buffers.  */
00116     assert (! input || buf->data == NULL || buf->data->next == NULL);
00117
00118     return buf_initialize (input ? compress_buffer_input : NULL,
00119                input ? NULL : compress_buffer_output,
00120                input ? NULL : compress_buffer_flush,
00121                compress_buffer_block,
00122                (input
00123                 ? compress_buffer_shutdown_input
00124                 : compress_buffer_shutdown_output),
00125                memory,
00126                n);
00127 }
00128
00129 /* Input data from a compression buffer.  */
00130
00131 static int
00132 compress_buffer_input (closure, data, need, size, got)
00133      void *closure;
00134      char *data;
00135      int need;
00136      int size;
00137      int *got;
00138 {
00139     struct compress_buffer *cb = (struct compress_buffer *) closure;
00140     struct buffer_data *bd;
00141
00142     if (cb->buf->input == NULL)
00143     abort ();
00144
00145     /* We use a single buffer_data structure to buffer up data which
00146        the z_stream structure won't use yet.  We can safely store this
00147        on cb->buf->data, because we never call the buffer routines on
00148        cb->buf; we only call the buffer input routine, since that
00149        gives us the semantics we want.  As noted in
00150        compress_buffer_initialize, the buffer_data structure may
00151        already exist, and hold data which was already read and
00152        buffered before the decompression began.  */
00153     bd = cb->buf->data;
00154     if (bd == NULL)
00155     {
00156     bd = ((struct buffer_data *) malloc (sizeof (struct buffer_data)));
00157     if (bd == NULL)
00158         return -2;
00159     bd->text = (char *) malloc (BUFFER_DATA_SIZE);
00160     if (bd->text == NULL)
00161     {
00162         free (bd);
00163         return -2;
00164     }
00165     bd->bufp = bd->text;
00166     bd->size = 0;
00167     cb->buf->data = bd;
00168     }
00169
00170     cb->zstr.avail_out = size;
00171     cb->zstr.next_out = (Bytef *) data;
00172
00173     while (1)
00174     {
00175     int zstatus, sofar, status, nread;
00176
00177     /* First try to inflate any data we already have buffered up.
00178        This is useful even if we don't have any buffered data,
00179        because there may be data buffered inside the z_stream
00180        structure.  */
00181
00182     cb->zstr.avail_in = bd->size;
00183     cb->zstr.next_in = (Bytef *) bd->bufp;
00184
00185     do
00186     {
00187         zstatus = inflate (&cb->zstr, Z_NO_FLUSH);
00188         if (zstatus == Z_STREAM_END)
00189         break;
00190         if (zstatus != Z_OK && zstatus != Z_BUF_ERROR)
00191         {
00192         compress_error (0, zstatus, &cb->zstr, "inflate");
00193         return EIO;
00194         }
00195     } while (cb->zstr.avail_in > 0
00196          && cb->zstr.avail_out > 0);
00197
00198     bd->size = cb->zstr.avail_in;
00199     bd->bufp = (char *) cb->zstr.next_in;
00200
00201     if (zstatus == Z_STREAM_END)
00202         return -1;
00203
00204     /* why that ? because cvs freeze when closing */
00205     /* is there any other solution ? I can't identify */
00206     /* the problem */
00207 #ifdef WIN32
00208     if (need == 0 && zstatus == Z_BUF_ERROR)
00209         return -1;
00210 #endif /* WIN32 */
00211
00212     /* If we have obtained NEED bytes, then return, unless NEED is
00213            zero and we haven't obtained anything at all.  If NEED is
00214            zero, we will keep reading from the underlying buffer until
00215            we either can't read anything, or we have managed to
00216            inflate at least one byte.  */
00217     sofar = size - cb->zstr.avail_out;
00218     if (sofar > 0 && sofar >= need)
00219         break;
00220
00221     /* All our buffered data should have been processed at this
00222            point.  */
00223     assert (bd->size == 0);
00224
00225     /* This will work well in the server, because this call will
00226        do an unblocked read and fetch all the available data.  In
00227        the client, this will read a single byte from the stdio
00228        stream, which will cause us to call inflate once per byte.
00229        It would be more efficient if we could make a call which
00230        would fetch all the available bytes, and at least one byte.  */
00231
00232     status = (*cb->buf->input) (cb->buf->closure, bd->text,
00233                     need > 0 ? 1 : 0,
00234                     BUFFER_DATA_SIZE, &nread);
00235     if (status != 0)
00236         return status;
00237
00238     /* If we didn't read anything, then presumably the buffer is
00239            in nonblocking mode, and we should just get out now with
00240            whatever we've inflated.  */
00241     if (nread == 0)
00242     {
00243         assert (need == 0);
00244         break;
00245     }
00246
00247     bd->bufp = bd->text;
00248     bd->size = nread;
00249     }
00250
00251     *got = size - cb->zstr.avail_out;
00252
00253     return 0;
00254 }
00255
00256 /* Output data to a compression buffer.  */
00257
00258 static int
00259 compress_buffer_output (closure, data, have, wrote)
00260      void *closure;
00261      const char *data;
00262      int have;
00263      int *wrote;
00264 {
00265     struct compress_buffer *cb = (struct compress_buffer *) closure;
00266
00267     cb->zstr.avail_in = have;
00268     cb->zstr.next_in = (unsigned char *) data;
00269
00270     while (cb->zstr.avail_in > 0)
00271     {
00272     char buffer[BUFFER_DATA_SIZE];
00273     int zstatus;
00274
00275     cb->zstr.avail_out = BUFFER_DATA_SIZE;
00276     cb->zstr.next_out = (unsigned char *) buffer;
00277
00278     zstatus = deflate (&cb->zstr, Z_NO_FLUSH);
00279     if (zstatus != Z_OK)
00280     {
00281         compress_error (0, zstatus, &cb->zstr, "deflate");
00282         return EIO;
00283     }
00284
00285     if (cb->zstr.avail_out != BUFFER_DATA_SIZE)
00286         buf_output (cb->buf, buffer,
00287             BUFFER_DATA_SIZE - cb->zstr.avail_out);
00288     }
00289
00290     *wrote = have;
00291
00292     /* We will only be here because buf_send_output was called on the
00293        compression buffer.  That means that we should now call
00294        buf_send_output on the underlying buffer.  */
00295     return buf_send_output (cb->buf);
00296 }
00297
00298 /* Flush a compression buffer.  */
00299
00300 static int
00301 compress_buffer_flush (closure)
00302      void *closure;
00303 {
00304     struct compress_buffer *cb = (struct compress_buffer *) closure;
00305
00306     cb->zstr.avail_in = 0;
00307     cb->zstr.next_in = NULL;
00308
00309     while (1)
00310     {
00311     char buffer[BUFFER_DATA_SIZE];
00312     int zstatus;
00313
00314     cb->zstr.avail_out = BUFFER_DATA_SIZE;
00315     cb->zstr.next_out = (unsigned char *) buffer;
00316
00317     zstatus = deflate (&cb->zstr, Z_SYNC_FLUSH);
00318
00319     /* The deflate function will return Z_BUF_ERROR if it can't do
00320            anything, which in this case means that all data has been
00321            flushed.  */
00322     if (zstatus == Z_BUF_ERROR)
00323         break;
00324
00325     if (zstatus != Z_OK)
00326     {
00327         compress_error (0, zstatus, &cb->zstr, "deflate flush");
00328         return EIO;
00329     }
00330
00331     if (cb->zstr.avail_out != BUFFER_DATA_SIZE)
00332         buf_output (cb->buf, buffer,
00333             BUFFER_DATA_SIZE - cb->zstr.avail_out);
00334
00335     /* If the deflate function did not fill the output buffer,
00336            then all data has been flushed.  */
00337     if (cb->zstr.avail_out > 0)
00338         break;
00339     }
00340
00341     /* Now flush the underlying buffer.  Note that if the original
00342        call to buf_flush passed 1 for the BLOCK argument, then the
00343        buffer will already have been set into blocking mode, so we
00344        should always pass 0 here.  */
00345     return buf_flush (cb->buf, 0);
00346 }
00347
00348 /* The block routine for a compression buffer.  */
00349
00350 static int
00351 compress_buffer_block (closure, block)
00352      void *closure;
00353      int block;
00354 {
00355     struct compress_buffer *cb = (struct compress_buffer *) closure;
00356
00357     if (block)
00358     return set_block (cb->buf);
00359     else
00360     return set_nonblock (cb->buf);
00361 }
00362
00363 /* Shut down an input buffer.  */
00364
00365 static int
00366 compress_buffer_shutdown_input (closure)
00367      void *closure;
00368 {
00369     struct compress_buffer *cb = (struct compress_buffer *) closure;
00370     int zstatus;
00371
00372     /* Pick up any trailing data, such as the checksum.  */
00373     while (1)
00374     {
00375     int status, nread;
00376     char buf[100];
00377
00378     status = compress_buffer_input (cb, buf, 0, sizeof buf, &nread);
00379     if (status == -1)
00380         break;
00381     if (status != 0)
00382         return status;
00383     }
00384
00385     zstatus = inflateEnd (&cb->zstr);
00386     if (zstatus != Z_OK)
00387     {
00388     compress_error (0, zstatus, &cb->zstr, "inflateEnd");
00389     return EIO;
00390     }
00391
00392     return buf_shutdown (cb->buf);
00393 }
00394
00395 /* Shut down an output buffer.  */
00396
00397 static int
00398 compress_buffer_shutdown_output (closure)
00399      void *closure;
00400 {
00401     struct compress_buffer *cb = (struct compress_buffer *) closure;
00402     int zstatus, status;
00403
00404     do
00405     {
00406     char buffer[BUFFER_DATA_SIZE];
00407
00408     cb->zstr.avail_out = BUFFER_DATA_SIZE;
00409     cb->zstr.next_out = (unsigned char *) buffer;
00410
00411     zstatus = deflate (&cb->zstr, Z_FINISH);
00412     if (zstatus != Z_OK && zstatus != Z_STREAM_END)
00413     {
00414         compress_error (0, zstatus, &cb->zstr, "deflate finish");
00415         return EIO;
00416     }
00417
00418     if (cb->zstr.avail_out != BUFFER_DATA_SIZE)
00419         buf_output (cb->buf, buffer,
00420             BUFFER_DATA_SIZE - cb->zstr.avail_out);
00421     } while (zstatus != Z_STREAM_END);
00422
00423     zstatus = deflateEnd (&cb->zstr);
00424     if (zstatus != Z_OK)
00425     {
00426     compress_error (0, zstatus, &cb->zstr, "deflateEnd");
00427     return EIO;
00428     }
00429
00430     status = buf_flush (cb->buf, 1);
00431     if (status != 0)
00432     return status;
00433
00434     return buf_shutdown (cb->buf);
00435 }
00436
00437
00438
00439 /* Here is our librarified gzip implementation.  It is very minimal
00440    but attempts to be RFC1952 compliant.  */
00441
00442 /* BUF should contain SIZE bytes of gzipped data (RFC1952/RFC1951).
00443    We are to uncompress the data and write the result to the file
00444    descriptor FD.  If something goes wrong, give a nonfatal error message
00445    mentioning FULLNAME as the name of the file for FD.  Return 1 if
00446    it is an error we can't recover from.  */
00447
00448 int
00449 gunzip_and_write (fd, fullname, buf, size)
00450     int fd;
00451     char *fullname;
00452     unsigned char *buf;
00453     size_t size;
00454 {
00455     size_t pos;
00456     z_stream zstr;
00457     int zstatus;
00458 #if defined(__MWERKS__)
00459     unsigned char outbuf[16384];
00460 #else
00461     unsigned char outbuf[32768];
00462 #endif
00463     unsigned long crc;
00464
00465     if (buf[0] != 31 || buf[1] != 139)
00466     {
00467     error (0, 0, "gzipped data does not start with gzip identification");
00468     return 1;
00469     }
00470     if (buf[2] != 8)
00471     {
00472     error (0, 0, "only the deflate compression method is supported");
00473     return 1;
00474     }
00475
00476     /* Skip over the fixed header, and then skip any of the variable-length
00477        fields.  */
00478     pos = 10;
00479     if (buf[3] & 4)
00480     pos += buf[pos] + (buf[pos + 1] << 8) + 2;
00481     if (buf[3] & 8)
00482     pos += strlen ((char *) buf + pos) + 1;
00483     if (buf[3] & 16)
00484     pos += strlen ((char *) buf + pos) + 1;
00485     if (buf[3] & 2)
00486     pos += 2;
00487
00488     memset (&zstr, 0, sizeof zstr);
00489     /* Passing a negative argument tells zlib not to look for a zlib
00490        (RFC1950) header.  This is an undocumented feature; I suppose if
00491        we wanted to be anal we could synthesize a header instead,
00492        but why bother?  */
00493     zstatus = inflateInit2 (&zstr, -15);
00494
00495     if (zstatus != Z_OK)
00496     compress_error (1, zstatus, &zstr, fullname);
00497
00498     /* I don't see why we should have to include the 8 byte trailer in
00499        avail_in.  But I see that zlib/gzio.c does, and it seemed to fix
00500        a fairly rare bug in which we'd get a Z_BUF_ERROR for no obvious
00501        reason.  */
00502     zstr.avail_in = size - pos;
00503     zstr.next_in = buf + pos;
00504
00505     crc = crc32 (0, NULL, 0);
00506
00507     do
00508     {
00509     zstr.avail_out = sizeof (outbuf);
00510     zstr.next_out = outbuf;
00511     zstatus = inflate (&zstr, Z_NO_FLUSH);
00512     if (zstatus != Z_STREAM_END && zstatus != Z_OK)
00513     {
00514         compress_error (0, zstatus, &zstr, fullname);
00515         return 1;
00516     }
00517     if (write (fd, (char *)outbuf, sizeof (outbuf) - zstr.avail_out) < 0)
00518     {
00519         error (0, errno, "writing decompressed file %s", fullname);
00520         return 1;
00521     }
00522     crc = crc32 (crc, outbuf, sizeof (outbuf) - zstr.avail_out);
00523     } while (zstatus != Z_STREAM_END);
00524     zstatus = inflateEnd (&zstr);
00525     if (zstatus != Z_OK)
00526     compress_error (0, zstatus, &zstr, fullname);
00527
00528     if (crc != (buf[zstr.total_in + 10]
00529         + (buf[zstr.total_in + 11] << 8)
00530         + (buf[zstr.total_in + 12] << 16)
00531         + (buf[zstr.total_in + 13] << 24)))
00532     {
00533     error (0, 0, "CRC error uncompressing %s", fullname);
00534     return 1;
00535     }
00536
00537     if (zstr.total_out != (buf[zstr.total_in + 14]
00538                + (buf[zstr.total_in + 15] << 8)
00539                + (buf[zstr.total_in + 16] << 16)
00540                + (buf[zstr.total_in + 17] << 24)))
00541     {
00542     error (0, 0, "invalid length uncompressing %s", fullname);
00543     return 1;
00544     }
00545
00546     return 0;
00547 }
00548
00549 /* Read all of FD and put the gzipped data (RFC1952/RFC1951) into *BUF,
00550    replacing previous contents of *BUF.  *BUF is malloc'd and *SIZE is
00551    its allocated size.  Put the actual number of bytes of data in
00552    *LEN.  If something goes wrong, give a nonfatal error mentioning
00553    FULLNAME as the name of the file for FD, and return 1 if we can't
00554    recover from it).  LEVEL is the compression level (1-9).  */
00555
00556 int
00557 read_and_gzip (fd, fullname, buf, size, len, level)
00558     int fd;
00559     char *fullname;
00560     unsigned char **buf;
00561     size_t *size;
00562     size_t *len;
00563     int level;
00564 {
00565     z_stream zstr;
00566     int zstatus;
00567     unsigned char inbuf[8192];
00568     int nread;
00569     unsigned long crc;
00570
00571     if (*size < 1024)
00572     {
00573     unsigned char *newbuf;
00574
00575     *size = 1024;
00576     newbuf = realloc (*buf, *size);
00577     if (newbuf == NULL)
00578     {
00579         error (0, 0, "out of memory");
00580         return 1;
00581     }
00582     *buf = newbuf;
00583     }
00584     (*buf)[0] = 31;
00585     (*buf)[1] = 139;
00586     (*buf)[2] = 8;
00587     (*buf)[3] = 0;
00588     (*buf)[4] = (*buf)[5] = (*buf)[6] = (*buf)[7] = 0;
00589     /* Could set this based on level, but why bother?  */
00590     (*buf)[8] = 0;
00591     (*buf)[9] = 255;
00592
00593     memset (&zstr, 0, sizeof zstr);
00594     zstatus = deflateInit2 (&zstr, level, Z_DEFLATED, -15, 8,
00595                 Z_DEFAULT_STRATEGY);
00596     crc = crc32 (0, NULL, 0);
00597     if (zstatus != Z_OK)
00598     {
00599     compress_error (0, zstatus, &zstr, fullname);
00600     return 1;
00601     }
00602     zstr.avail_out = *size;
00603     zstr.next_out = *buf + 10;
00604
00605     while (1)
00606     {
00607     int finish = 0;
00608
00609     nread = read (fd, (char *)inbuf, sizeof inbuf);
00610     if (nread < 0)
00611     {
00612         error (0, errno, "cannot read %s", fullname);
00613         return 1;
00614     }
00615     else if (nread == 0)
00616         /* End of file.  */
00617         finish = 1;
00618     crc = crc32 (crc, inbuf, nread);
00619     zstr.next_in = inbuf;
00620     zstr.avail_in = nread;
00621
00622     do
00623     {
00624         size_t offset;
00625
00626         /* I don't see this documented anywhere, but deflate seems
00627            to tend to dump core sometimes if we pass it Z_FINISH and
00628            a small (e.g. 2147 byte) avail_out.  So we insist on at
00629            least 4096 bytes (that is what zlib/gzio.c uses).  */
00630
00631         if (zstr.avail_out < 4096)
00632         {
00633         unsigned char *newbuf;
00634
00635         offset = zstr.next_out - *buf;
00636         *size *= 2;
00637         newbuf = realloc (*buf, *size);
00638         if (newbuf == NULL)
00639         {
00640             error (0, 0, "out of memory");
00641             return 1;
00642         }
00643         *buf = newbuf;
00644         zstr.next_out = *buf + offset;
00645         zstr.avail_out = *size - offset;
00646         }
00647
00648         zstatus = deflate (&zstr, finish ? Z_FINISH : 0);
00649         if (zstatus == Z_STREAM_END)
00650         goto done;
00651         else if (zstatus != Z_OK)
00652         compress_error (0, zstatus, &zstr, fullname);
00653     } while (zstr.avail_out == 0);
00654     }
00655  done:
00656     *(*buf + zstr.total_out + 10) = crc & 0xff;
00657     *(*buf + zstr.total_out + 11) = (crc >> 8) & 0xff;
00658     *(*buf + zstr.total_out + 12) = (crc >> 16) & 0xff;
00659     *(*buf + zstr.total_out + 13) = (crc >> 24) & 0xff;
00660
00661     *(*buf + zstr.total_out + 14) = zstr.total_in & 0xff;
00662     *(*buf + zstr.total_out + 15) = (zstr.total_in >> 8) & 0xff;
00663     *(*buf + zstr.total_out + 16) = (zstr.total_in >> 16) & 0xff;
00664     *(*buf + zstr.total_out + 17) = (zstr.total_in >> 24) & 0xff;
00665
00666     *len = zstr.total_out + 18;
00667
00668     zstatus = deflateEnd (&zstr);
00669     if (zstatus != Z_OK)
00670     compress_error (0, zstatus, &zstr, fullname);
00671
00672     return 0;
00673 }
00674 #endif /* defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT) */
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


watch.c File Reference

cvs-1.10/src/watch.c File Reference

#include "cvs.h"
#include "edit.h"
#include "fileattr.h"
#include "watch.h"

Include dependency graph for watch.c:

Include dependency graph

Go to the source code of this file.

Functions

void | watch_modify_watchers (file, what) char *file
int | addremove_fileproc (callerdat, finfo) void *callerdat
int | addremove_filesdoneproc (callerdat, err, repository, update_dir, entries) void *callerdat
int | watch_addremove (argc, argv) int argc
int | watchers_fileproc ()
int | watchers_fileproc (callerdat, finfo) void *callerdat

Variables

const char *const | watch_usage []
addremove_args the_args
addremove_args * what
file_info * finfo
int | err
char * | repository
char * | update_dir
List * entries
char ** | argv

Function Documentation

int addremove_fileproc | ( | callerdat | ,
 |  | finfo |
 | ) | [static]

int addremove_filesdoneproc | ( | callerdat | ,
 |  | err | ,
 |  | repository | ,
 |  | update_dir | ,
 |  | entries |
 | ) | [static]

int watch_addremove | ( | argc | ,
 |  | argv |
 | ) | [static]

void watch_modify_watchers | ( | file | ,
 |  | what |
 | ) |

int watchers_fileproc | ( | callerdat | ,
 |  | finfo |
 | ) | [static]

int watchers_fileproc ( ) [static]

Variable Documentation

char** argv

Definition at line 483 of file watch.c.

List* entries

Definition at line 237 of file watch.c.

Referenced by CWinCvsBrowser::OnItemexpanding(), UCvsFolders::OnTreeExpanding(), CHistComboBoxEx::SetIcon(), CGraphDoc::SetNode(), UCvsGraph::UCvsGraph(), cvsgui_GetCvsEntries(), and tclCvsEntriesProc().

int err

Definition at line 234 of file watch.c.

struct file_info* finfo

Definition at line 431 of file watch.c.

char* repository

Definition at line 235 of file watch.c.

struct addremove_args the_args [static]

Definition at line 31 of file watch.c.

char* update_dir

Definition at line 236 of file watch.c.

const char* const watch_usage[]

Initial value:

{
    "Usage: %s %s [on|off|add|remove] [-lR] [-a action] [files...]\n",
    "on/off: turn on/off read-only checkouts of files\n",
    "add/remove: add or remove notification on actions\n",
    "-l (on/off/add/remove): Local directory only, not recursive\n",
    "-R (on/off/add/remove): Process directories recursively\n",
    "-a (add/remove): Specify what actions, one of\n",
    "    edit,unedit,commit,all,none\n",
    "(Specify the --help global option for a list of other help options)\n",
    NULL
}

Definition at line 18 of file watch.c.

struct addremove_args* what

Definition at line 36 of file watch.c.

Generated on Sun Oct 21 12:43:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


watch.h File Reference

cvs-1.10/src/watch.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | addremove_args

Functions

void watch_modify_watchers | PROTO ((char *file, struct addremove_args *what))
int watch_add | PROTO ((int argc, char **argv))

Variables

const char *const | watch_usage []

Function Documentation

int watch_add PROTO ( (int argc, char **argv) )

void watch_modify_watchers PROTO ( (char *file, struct addremove_args *what) )

Variable Documentation

const char* const watch_usage[]

Definition at line 13 of file watch.h.

Generated on Sun Oct 21 12:43:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


wrapper.c File Reference

cvs-1.10/src/wrapper.c File Reference

#include "cvs.h"
#include "getline.h"

Include dependency graph for wrapper.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | WrapperEntry

Defines

#define | WRAPPER_GROW 8

Functions

void | wrap_add_entry ()
void | wrap_kill ()
void | wrap_kill_temp ()
void | wrap_free_entry ()
void | wrap_free_entry_internal ()
void | wrap_restore_saved ()
void | wrap_setup ()
void | wrap_add_file (file, temp) const char *file
WrapperEntry * | wrap_matching_entry (name) const char *name

Variables

WrapperEntry ** | wrap_list = NULL
WrapperEntry ** | wrap_saved_list = NULL
int | wrap_size = 0
int | wrap_count = 0
int | wrap_tempcount = 0
int | wrap_saved_count = 0
int | wrap_saved_tempcount = 0
int | temp
int | isTemp
WrapMergeHas has
int | asflag

Define Documentation

#define WRAPPER_GROW 8

Definition at line 76 of file wrapper.c.

Function Documentation

void wrap_add_entry ( )

void wrap_add_file | ( | file | ,
 |  | temp |
 | ) | const

void wrap_free_entry ( )

void wrap_free_entry_internal ( )

void wrap_kill ( )

void wrap_kill_temp ( )

WrapperEntry* wrap_matching_entry ( name ) const [static]

void wrap_restore_saved ( )

void wrap_setup ( )

Definition at line 85 of file wrapper.c.

00086 {
00087     /* FIXME-reentrancy: if we do a multithreaded server, will need to
00088        move this to a per-connection data structure, or better yet
00089        think about a cleaner solution.  */
00090     static int wrap_setup_already_done = 0;
00091     char *homedir;
00092
00093     if (wrap_setup_already_done != 0)
00094         return;
00095     else
00096         wrap_setup_already_done = 1;
00097
00098 #ifdef CLIENT_SUPPORT
00099     if (!client_active)
00100 #endif
00101     {
00102     char *file;
00103
00104     file = xmalloc (strlen (CVSroot_directory)
00105             + sizeof (CVSROOTADM)
00106             + sizeof (CVSROOTADM_WRAPPER)
00107             + 10);
00108     /* Then add entries found in repository, if it exists.  */
00109     (void) sprintf (file, "%s/%s/%s", CVSroot_directory, CVSROOTADM,
00110             CVSROOTADM_WRAPPER);
00111     if (isfile (file))
00112     {
00113         wrap_add_file(file,0);
00114     }
00115     free (file);
00116     }
00117
00118     /* Then add entries found in home dir, (if user has one) and file
00119        exists.  */
00120     homedir = get_homedir ();
00121     /* If we can't find a home directory, ignore ~/.cvswrappers.  This may
00122        make tracking down problems a bit of a pain, but on the other
00123        hand it might be obnoxious to complain when CVS will function
00124        just fine without .cvswrappers (and many users won't even know what
00125        .cvswrappers is).  */
00126     if (homedir != NULL)
00127     {
00128     char *file;
00129
00130     file = xmalloc (strlen (homedir) + sizeof (CVSDOTWRAPPER) + 10);
00131     (void) sprintf (file, "%s/%s", homedir, CVSDOTWRAPPER);
00132     if (isfile (file))
00133     {
00134         wrap_add_file (file, 0);
00135     }
00136     free (file);
00137     }
00138
00139     /* FIXME: calling wrap_add() below implies that the CVSWRAPPERS
00140      * environment variable contains exactly one "wrapper" -- a line
00141      * of the form
00142      *
00143      *    FILENAME_PATTERN  FLAG  OPTS [ FLAG OPTS ...]
00144      *
00145      * This may disagree with the documentation, which states:
00146      *
00147      *   `$CVSWRAPPERS'
00148      *      A whitespace-separated list of file name patterns that CVS
00149      *      should treat as wrappers. *Note Wrappers::.
00150      *
00151      * Does this mean the environment variable can hold multiple
00152      * wrappers lines?  If so, a single call to wrap_add() is
00153      * insufficient.
00154      */
00155
00156     /* Then add entries found in CVSWRAPPERS environment variable. */
00157     wrap_add (getenv (WRAPPER_ENV), 0);
00158 }

Variable Documentation

int asflag

Definition at line 566 of file wrapper.c.

WrapMergeHas has

Definition at line 518 of file wrapper.c.

int isTemp

Definition at line 343 of file wrapper.c.

int temp

Definition at line 490 of file wrapper.c.

int wrap_count = 0 [static]

Definition at line 57 of file wrapper.c.

WrapperEntry** wrap_list = NULL [static]

Definition at line 53 of file wrapper.c.

int wrap_saved_count = 0 [static]

Definition at line 72 of file wrapper.c.

WrapperEntry** wrap_saved_list = NULL [static]

Definition at line 54 of file wrapper.c.

int wrap_saved_tempcount = 0 [static]

Definition at line 74 of file wrapper.c.

int wrap_size = 0 [static]

Definition at line 56 of file wrapper.c.

int wrap_tempcount = 0 [static]

Definition at line 58 of file wrapper.c.

Generated on Sun Oct 21 12:43:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


zlib.c File Reference

cvs-1.10/src/zlib.c File Reference

#include <assert.h>
#include "cvs.h"
#include "buffer.h"

Include dependency graph for zlib.c:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:43:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


config.h File Reference

cvs-1.10/vms/config.h File Reference

Go to the source code of this file.

Defines

#define | CLIENT_SUPPORT 1
#define | USE_VMS_FILENAMES 1
#define | NO_SLASH_AFTER_HOME 1
#define | HAVE_NDIR_H 1
#define | RETSIGTYPE void
#define | STDC_HEADERS 1
#define | HAVE_MKDIR 1
#define | HAVE_RMDIR 1
#define | HAVE_RENAME 1
#define | HAVE_VFORK
#define | HAVE_VPRINTF
#define | HAVE_STRING_H 1
#define | SYS_SOCKET_H_DEFINES_SELECT 1
#define | HAVE_SYS_TIMEB_H 1
#define | HAVE_TIMEB_H 1
#define | HAVE_UNISTD_H 1
#define | FOLD_FN_CHAR(c) (VMS_filename_classes[(unsigned char) (c)])
#define | FILENAMES_CASE_INSENSITIVE 1
#define | RSH_NOT_TRANSPARENT 1
#define | START_SERVER vms_start_server
#define | NO_SOCKET_TO_FD 1
#define | START_SERVER_RETURNS_SOCKET 1
#define | SEND_NEVER_PARTIAL 1
#define | SYSTEM_GETCALLER() getlogin ()
#define | GETPWNAM_MISSING 1
#define | getopt cvs_getopt
#define | optind cvs_optind
#define | optopt cvs_optopt
#define | optarg cvs_optarg
#define | opterr cvs_opterr
#define | ARGV0_NOT_PROGRAM_NAME

Functions

int | fncmp (const char *n1, const char *n2)
void | fnfold (char *FILENAME)

Variables

unsigned char | VMS_filename_classes []

Define Documentation

#define ARGV0_NOT_PROGRAM_NAME

Definition at line 200 of file config.h.

#define CLIENT_SUPPORT 1

Definition at line 5 of file config.h.

#define FILENAMES_CASE_INSENSITIVE 1

Definition at line 166 of file config.h.

#define FOLD_FN_CHAR ( c ) (VMS_filename_classes[(unsigned char) (c)])

Definition at line 164 of file config.h.

#define GETPWNAM_MISSING 1

Definition at line 184 of file config.h.

#define HAVE_MKDIR 1

Definition at line 105 of file config.h.

#define HAVE_NDIR_H 1

Definition at line 47 of file config.h.

#define HAVE_RENAME 1

Definition at line 111 of file config.h.

#define HAVE_RMDIR 1

Definition at line 108 of file config.h.

#define HAVE_STRING_H 1

Definition at line 138 of file config.h.

#define HAVE_SYS_TIMEB_H 1

Definition at line 147 of file config.h.

#define HAVE_TIMEB_H 1

Definition at line 148 of file config.h.

#define HAVE_UNISTD_H 1

Definition at line 151 of file config.h.

#define HAVE_VFORK

Definition at line 120 of file config.h.

#define HAVE_VPRINTF

Definition at line 123 of file config.h.

#define NO_SLASH_AFTER_HOME 1

Definition at line 16 of file config.h.

#define NO_SOCKET_TO_FD 1

Definition at line 180 of file config.h.

#define RETSIGTYPE void

Definition at line 60 of file config.h.

#define RSH_NOT_TRANSPARENT 1

Definition at line 178 of file config.h.

#define SEND_NEVER_PARTIAL 1

Definition at line 182 of file config.h.

#define START_SERVER vms_start_server

Definition at line 179 of file config.h.

#define START_SERVER_RETURNS_SOCKET 1

Definition at line 181 of file config.h.

#define STDC_HEADERS 1

Definition at line 66 of file config.h.

#define SYSTEM_GETCALLER ( ) getlogin ()

Definition at line 183 of file config.h.

#define SYS_SOCKET_H_DEFINES_SELECT 1

Definition at line 144 of file config.h.

#define USE_VMS_FILENAMES 1

Definition at line 13 of file config.h.

#define getopt cvs_getopt

Definition at line 187 of file config.h.

#define optarg cvs_optarg

Definition at line 190 of file config.h.

#define opterr cvs_opterr

Definition at line 191 of file config.h.

#define optind cvs_optind

Definition at line 188 of file config.h.

#define optopt cvs_optopt

Definition at line 189 of file config.h.

Function Documentation

int fncmp | ( | const char * | n1,
 |  | const char * | n2
 | ) |

Definition at line 700 of file filesubr.c.

00701 {
00702     while (*n1 && *n2
00703            && (VMS_filename_classes[(unsigned char) *n1]
00704            == VMS_filename_classes[(unsigned char) *n2]))
00705         n1++, n2++;
00706     return (VMS_filename_classes[(unsigned char) *n1]
00707             - VMS_filename_classes[(unsigned char) *n2]);
00708 }

void fnfold ( char * filename )

Definition at line 726 of file filesubr.c.

00727 {
00728     while (*filename)
00729     {
00730         *filename = FOLD_FN_CHAR (*filename);
00731     filename++;
00732     }
00733 }

Variable Documentation

unsigned char VMS_filename_classes[]

Definition at line 165 of file config.h.

Generated on Sun Oct 21 12:42:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/config.h Source File

cvs-1.10/vms/config.h

Go to the documentation of this file.
00001 /* config.h - OpenVMS/AXP specific configuration
00002               June 1995 - <benjamin@cyclic.com> */
00003
00004 /* We only want to build the client */
00005 #define CLIENT_SUPPORT 1
00006 #undef SERVER_SUPPORT
00007
00008 /* VMS is case insensitive */
00009 /* #define FOLD_FN_CHAR(c) tolower(c) */
00010
00011 /* Temporary files named "#booger.3.6~" aren't legal under VMS,
00012    Define this if you want to use names which are legal for VMS */
00013 #define USE_VMS_FILENAMES 1
00014
00015 /* More issues with how VMS names files, kind of a kludge.  See login.c.  */
00016 #define NO_SLASH_AFTER_HOME 1
00017
00018 /* Define to empty if the keyword does not work.  */
00019 /* #undef const */
00020
00021 /* Define if you have <dirent.h>.  */
00022 /* #undef DIRENT */
00023
00024 /* Define if you have <sys/param.h> */
00025 /* #undef HAVE_SYS_PARAM_H */
00026
00027 /* Define to `int' if <sys/types.h> doesn't define.  */
00028 /* #undef gid_t */
00029
00030 /* Define if you support file names longer than 14 characters.  */
00031 /* #undef HAVE_LONG_FILE_NAMES */
00032
00033 /* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
00034 /* #define HAVE_SYS_WAIT_H 1 OpenVMS POSIX has it, but VMS does not. */
00035 #undef POSIX
00036
00037 /* Define if utime(file, NULL) sets file's timestamp to the present.  */
00038 /* #undef HAVE_UTIME_NULL */
00039
00040 /* Define if on MINIX.  */
00041 /* #undef _MINIX */
00042
00043 /* Define to `int' if <sys/types.h> doesn't define.  */
00044 /* #undef mode_t */
00045
00046 /* Define if you don't have <dirent.h>, but have <ndir.h>.  */
00047 #define HAVE_NDIR_H 1
00048
00049 /* Define to `int' if <sys/types.h> doesn't define.  */
00050 /* #undef pid_t */
00051
00052 /* Define if the system does not provide POSIX.1 features except
00053    with this defined.  */
00054 /* #undef _POSIX_1_SOURCE */
00055
00056 /* Define if you need to in order for stat and other things to work.  */
00057 /* #undef _POSIX_SOURCE */
00058
00059 /* Define as the return type of signal handlers (int or void).  */
00060 #define RETSIGTYPE void
00061
00062 /* Define to `unsigned' if <sys/types.h> doesn't define.  */
00063 /* #undef size_t */
00064
00065 /* Define if you have the ANSI C header files.  */
00066 #define STDC_HEADERS 1
00067
00068 /* Define if you don't have <dirent.h>, but have <sys/dir.h>.  */
00069 /* #undef SYSDIR */
00070
00071 /* Define if you don't have <dirent.h>, but have <sys/ndir.h>.  */
00072 /* #undef SYSNDIR */
00073
00074 /* Define if your <sys/time.h> declares struct tm.  */
00075 /* #undef TM_IN_SYS_TIME */
00076
00077 /* Define to `int' if <sys/types.h> doesn't define.  */
00078 /* #undef uid_t */
00079
00080 /* Define if the closedir function returns void instead of int.  */
00081 /* #undef VOID_CLOSEDIR */
00082
00083 /* Define if you have MIT Kerberos version 4 available.  */
00084 /* #undef HAVE_KERBEROS */
00085
00086 /* Define if you have the fchmod function.  */
00087 /* #undef HAVE_FCHMOD */
00088
00089 /* Define if you have the fsync function.  */
00090 /* #undef HAVE_FSYNC */
00091
00092 /* Define if you have the ftime function.  */
00093 /* #undef HAVE_FTIME */
00094
00095 /* Define if you have the ftruncate function.  */
00096 /* #undef HAVE_FTRUNCATE */
00097
00098 /* Define if you have the getpagesize function.  */
00099 /* #undef HAVE_GETPAGESIZE */
00100
00101 /* Define if you have the krb_get_err_text function.  */
00102 /* #undef HAVE_KRB_GET_ERR_TEXT */
00103
00104 /* Define if you have the mkdir function */
00105 #define HAVE_MKDIR 1
00106
00107 /* Define if you have the rmdir function */
00108 #define HAVE_RMDIR 1
00109
00110 /* Define if you have the rename function */
00111 #define HAVE_RENAME 1
00112
00113 /* Define if you have the putenv function.  */
00114 /* #undef HAVE_PUTENV */
00115
00116 /* Define if you have the timezone function.  */
00117 /* #undef HAVE_TIMEZONE */
00118
00119 /* Define if you have the vfork function.  */
00120 #define HAVE_VFORK
00121
00122 /* Define if you have the vprintf function.  */
00123 #define HAVE_VPRINTF
00124
00125 /* Define if you have the <errno.h> header file.  */
00126 /* #undef HAVE_ERRNO_H */
00127
00128 /* Define if you have the <fcntl.h> header file.  */
00129 /* #undef HAVE_FCNTL_H */
00130
00131 /* Define if you have the <memory.h> header file.  */
00132 /* #undef HAVE_MEMORY_H */
00133
00134 /* Define if you have the <ndbm.h> header file.  */
00135 /* #undef HAVE_NDBM_H */
00136
00137 /* Define if you have the <string.h> header file.  */
00138 #define HAVE_STRING_H 1
00139
00140 /* Define if you have the <sys/select.h> header file.  */
00141 /* #undef HAVE_SYS_SELECT_H */
00142
00143 /* Define this if your <sys/socket.h> defines select() */
00144 #define SYS_SOCKET_H_DEFINES_SELECT 1
00145
00146 /* Define if you have the <sys/timeb.h> header file.  */
00147 #define HAVE_SYS_TIMEB_H 1
00148 #define HAVE_TIMEB_H 1
00149
00150 /* Define if you have the <unistd.h> header file.  */
00151 #define HAVE_UNISTD_H 1
00152
00153 /* Define if you have the <utime.h> header file.  */
00154 /* #undef HAVE_UTIME_H */
00155
00156 /* Define if you have the nsl library (-lnsl).  */
00157 /* #undef HAVE_LIBNSL */
00158
00159 /* Define if you have the socket library (-lsocket).  */
00160 /* #undef HAVE_LIBSOCKET */
00161
00162 /* Under Windows NT, filenames are case-insensitive, and both / and \
00163    are path component separators.  */
00164 #define FOLD_FN_CHAR(c) (VMS_filename_classes[(unsigned char) (c)])
00165 extern unsigned char VMS_filename_classes[];
00166 #define FILENAMES_CASE_INSENSITIVE 1
00167
00168 /* Like strcmp, but with the appropriate tweaks for file names.
00169    Under Windows NT, filenames are case-insensitive but case-preserving,
00170    and both \ and / are path element separators.  */
00171 extern int fncmp (const char *n1, const char *n2);
00172
00173 /* Fold characters in FILENAME to their canonical forms.
00174    If FOLD_FN_CHAR is not #defined, the system provides a default
00175    definition for this.  */
00176 extern void fnfold (char *FILENAME);
00177
00178 #define RSH_NOT_TRANSPARENT 1
00179 #define START_SERVER vms_start_server
00180 #define NO_SOCKET_TO_FD 1
00181 #define START_SERVER_RETURNS_SOCKET 1
00182 #define SEND_NEVER_PARTIAL 1
00183 #define SYSTEM_GETCALLER() getlogin ()
00184 #define GETPWNAM_MISSING 1
00185
00186 /* Avoid name conflicts with VMS libraries.  */
00187 #define getopt cvs_getopt
00188 #define optind cvs_optind
00189 #define optopt cvs_optopt
00190 #define optarg cvs_optarg
00191 #define opterr cvs_opterr
00192
00193 /* argv[0] in VMS is the full pathname which would look really ugly in error
00194    messages.  Even if we stripped out the directory and ".EXE;5", it would
00195    still be misleading, as if one has used "OLDCVS :== ...CVS-JULY.EXE",
00196    then argv[0] does not contain the name of the command which the user
00197    invokes CVS with.  If there is a way for VMS to find the latter, that
00198    might be worth messing with, but it also seems fine to just always call
00199    it "cvs".  */
00200 #define ARGV0_NOT_PROGRAM_NAME
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/dir.h Source File

cvs-1.10/vms/dir.h

Go to the documentation of this file.
00001 /* GNU Emacs VMS directory definition file.
00002    Copyright (C) 1986 Free Software Foundation, Inc.
00003
00004 This file is part of GNU Emacs.
00005
00006 GNU Emacs is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 1, or (at your option)
00009 any later version.
00010
00011 GNU Emacs is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.  */
00015
00016 /*
00017  * Files-11 Ver. 2 directory structure (VMS V4.x - long names)
00018  */
00019 #ifndef DIR$K_LENGTH
00020
00021 #define DIR$C_FID   0
00022 #define DIR$C_LINKNAME  1
00023 #define DIR$K_LENGTH    6
00024 #define DIR$C_LENGTH    6
00025 #define DIR$S_DIRDEF    6
00026 #define DIR$W_SIZE  0
00027 #define DIR$W_VERLIMIT  2
00028 #define DIR$B_FLAGS 4
00029 #define DIR$S_TYPE  3
00030 #define DIR$V_TYPE  0
00031 #define DIR$V_NEXTREC   6
00032 #define DIR$V_PREVREC   7
00033 #define DIR$B_NAMECOUNT 5
00034 #define DIR$S_NAME  80
00035 #define DIR$T_NAME  6
00036
00037 #define DIR$K_VERSION   8
00038 #define DIR$C_VERSION   8
00039 #define DIR$S_DIRDEF1   8
00040 #define DIR$W_VERSION   0
00041 #define DIR$S_FID   6
00042 #define DIR$W_FID   2
00043 #define DIR$W_FID_NUM   2
00044 #define DIR$W_FID_SEQ   4
00045 #define DIR$W_FID_RVN   6
00046 #define DIR$B_FID_RVN   6
00047 #define DIR$B_FID_NMX   7
00048
00049 #define DIR$S_DIRDEF2   1
00050 #define DIR$T_LINKNAME  0
00051
00052 typedef struct dir$_name {
00053 /*  short dir$w_size;       /* if you read with RMS, it eats this... */
00054   short dir$w_verlimit;         /* maximum number of versions */
00055   union {
00056     unsigned char dir_b_flags;
00057 #define dir$b_flags dir__b_flags.dir_b_flags
00058     struct {
00059       unsigned char dir_v_type: DIR$S_TYPE;
00060 #define dir$v_type dir__b_flags.dir___b_flags.dir_v_type
00061       unsigned char: 3;
00062       unsigned char dir_v_nextrec: 1;
00063 #define dir$v_nextrec dir__b_flags.dir___b_flags.dir_v_nextrec
00064       unsigned char dir_v_prevrec: 1;
00065 #define dir$v_prevrec dir__b_flags.dir___b_flags.dir_v_prevrec
00066     } dir___b_flags;
00067   } dir__b_flags;
00068   unsigned char dir$b_namecount;
00069   char dir$t_name[];
00070 } dir$_dirdef;      /* only the fixed first part */
00071
00072 typedef struct dir$_version {
00073   short dir$w_version;
00074   short dir$w_fid_num;
00075   short dir$w_fid_seq;
00076   union {
00077     short dir_w_fid_rvn;
00078 #define dir$w_fid_rvn dir__w_fid_rvn.dir_w_fid_rvn
00079     struct {
00080       char dir_b_fid_rvn;
00081 #define dir$b_fid_rvn dir__w_fid_rvn.dir___w_fid_rvn.dir_b_fid_rvn
00082       char dir_b_fid_nmx;
00083 #define dir$b_fid_nmx dir__w_fid_rvn.dir___w_fid_rvn.dir_b_fid_nmx
00084     } dir___w_fid_rvn;
00085   } dir__w_fid_rvn;
00086 } dir$_dirdef1;     /* one for each version of the file */
00087
00088 typedef
00089 struct dir$_linkname {
00090   char    dir$t_linkname[];
00091 } dir$_dirdef2;
00092
00093 #endif
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dir.h File Reference

cvs-1.10/vms/dir.h File Reference

Go to the source code of this file.

Compounds

struct | _linkname
struct | _name
struct | _version

Defines

#define | DIR $C_FID 0
#define | DIR $C_LINKNAME 1
#define | DIR $K_LENGTH 6
#define | DIR $C_LENGTH 6
#define | DIR $S_DIRDEF 6
#define | DIR $W_SIZE 0
#define | DIR $W_VERLIMIT 2
#define | DIR $B_FLAGS 4
#define | DIR $S_TYPE 3
#define | DIR $V_TYPE 0
#define | DIR $V_NEXTREC 6
#define | DIR $V_PREVREC 7
#define | DIR $B_NAMECOUNT 5
#define | DIR $S_NAME 80
#define | DIR $T_NAME 6
#define | DIR $K_VERSION 8
#define | DIR $C_VERSION 8
#define | DIR $S_DIRDEF1 8
#define | DIR $W_VERSION 0
#define | DIR $S_FID 6
#define | DIR $W_FID 2
#define | DIR $W_FID_NUM 2
#define | DIR $W_FID_SEQ 4
#define | DIR $W_FID_RVN 6
#define | DIR $B_FID_RVN 6
#define | DIR $B_FID_NMX 7
#define | DIR $S_DIRDEF2 1
#define | DIR $T_LINKNAME 0
#define | dir $b_flags dir__b_flags.dir_b_flags
#define | dir $v_type dir__b_flags.dir___b_flags.dir_v_type
#define | dir $v_nextrec dir__b_flags.dir___b_flags.dir_v_nextrec
#define | dir $v_prevrec dir__b_flags.dir___b_flags.dir_v_prevrec
#define | dir $w_fid_rvn dir__w_fid_rvn.dir_w_fid_rvn
#define | dir $b_fid_rvn dir__w_fid_rvn.dir___w_fid_rvn.dir_b_fid_rvn
#define | dir $b_fid_nmx dir__w_fid_rvn.dir___w_fid_rvn.dir_b_fid_nmx

Typedefs

typedef dir _name | _dirdef
typedef b_flags dir__b_flags
dir_b_flags _version 		_dirdef1
typedef b_flags dir__b_flags
dir_b_flags _linkname 		_dirdef2

Define Documentation

#define DIR $T_LINKNAME 0

Definition at line 50 of file dir.h.

#define DIR $S_DIRDEF2 1

Definition at line 50 of file dir.h.

#define DIR $B_FID_NMX 7

Definition at line 50 of file dir.h.

#define DIR $B_FID_RVN 6

Definition at line 50 of file dir.h.

#define DIR $W_FID_RVN 6

Definition at line 50 of file dir.h.

#define DIR $W_FID_SEQ 4

Definition at line 50 of file dir.h.

#define DIR $W_FID_NUM 2

Definition at line 50 of file dir.h.

#define DIR $W_FID 2

Definition at line 50 of file dir.h.

#define DIR $S_FID 6

Definition at line 50 of file dir.h.

#define DIR $W_VERSION 0

Definition at line 50 of file dir.h.

#define DIR $S_DIRDEF1 8

Definition at line 50 of file dir.h.

#define DIR $C_VERSION 8

Definition at line 50 of file dir.h.

#define DIR $K_VERSION 8

Definition at line 50 of file dir.h.

#define DIR $T_NAME 6

Definition at line 50 of file dir.h.

#define DIR $S_NAME 80

Definition at line 50 of file dir.h.

#define DIR $B_NAMECOUNT 5

Definition at line 50 of file dir.h.

#define DIR $V_PREVREC 7

Definition at line 50 of file dir.h.

#define DIR $V_NEXTREC 6

Definition at line 50 of file dir.h.

#define DIR $V_TYPE 0

Definition at line 50 of file dir.h.

#define DIR $S_TYPE 3

Definition at line 50 of file dir.h.

#define DIR $B_FLAGS 4

Definition at line 50 of file dir.h.

#define DIR $W_VERLIMIT 2

Definition at line 50 of file dir.h.

#define DIR $W_SIZE 0

Definition at line 50 of file dir.h.

#define DIR $S_DIRDEF 6

Definition at line 50 of file dir.h.

#define DIR $C_LENGTH 6

Definition at line 50 of file dir.h.

#define DIR $K_LENGTH 6

Definition at line 50 of file dir.h.

#define DIR $C_LINKNAME 1

Definition at line 50 of file dir.h.

#define DIR $C_FID 0

Definition at line 50 of file dir.h.

#define dir $b_fid_nmx dir__w_fid_rvn.dir___w_fid_rvn.dir_b_fid_nmx

Definition at line 83 of file dir.h.

#define dir $b_fid_rvn dir__w_fid_rvn.dir___w_fid_rvn.dir_b_fid_rvn

Definition at line 83 of file dir.h.

#define dir $w_fid_rvn dir__w_fid_rvn.dir_w_fid_rvn

Definition at line 83 of file dir.h.

#define dir $v_prevrec dir__b_flags.dir___b_flags.dir_v_prevrec

Definition at line 83 of file dir.h.

#define dir $v_nextrec dir__b_flags.dir___b_flags.dir_v_nextrec

Definition at line 83 of file dir.h.

#define dir $v_type dir__b_flags.dir___b_flags.dir_v_type

Definition at line 83 of file dir.h.

char * dir $b_flags dir__b_flags.dir_b_flags

Definition at line 83 of file dir.h.

Referenced by CGraphView::OnViewReload().

Typedef Documentation

typedef struct dir _name _dirdef

typedef struct b_flags dir__b_flags dir_b_flags _version _dirdef1

typedef struct b_flags dir__b_flags dir_b_flags _linkname _dirdef2

Generated on Sun Oct 21 12:43:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


filesubr.c File Reference

cvs-1.10/vms/filesubr.c File Reference

#include "cvs.h"

Include dependency graph for filesubr.c:

Include dependency graph

Go to the source code of this file.

Functions

int deep_remove_dir | PROTO ((const char *path))
void | copy_file (from_file, to_file) const char *from_file
int | fncmp (const char *n1, const char *n2)
void | fnfold (char *filename)
char * | cvs_temp_name ()
int | isabsolute (filename) const char *filename

Variables

const char * | to_file
const int | mode
int | writable
char * | buf
size_t | nchars
const char * | file2_file
char ** | argv
int * | pargc
char *** | pargv

Function Documentation

int deep_remove_dir PROTO ( (const char *path) ) [static]

void copy_file | ( | from_file | ,
 |  | to_file |
 | ) | const

char* cvs_temp_name ( )

Definition at line 739 of file filesubr.c.

00740 {
00741     char value[L_tmpnam + 1];
00742     char *retval;
00743
00744     /* FIXME: what is the VMS equivalent to TMPDIR?  */
00745     retval = tmpnam (value);
00746     if (retval == NULL)
00747     error (1, errno, "cannot generate temporary filename");
00748     return xstrdup (retval);
00749 }

int fncmp | ( | const char * | n1,
 |  | const char * | n2
 | ) |

Definition at line 700 of file filesubr.c.

00701 {
00702     while (*n1 && *n2
00703            && (VMS_filename_classes[(unsigned char) *n1]
00704            == VMS_filename_classes[(unsigned char) *n2]))
00705         n1++, n2++;
00706     return (VMS_filename_classes[(unsigned char) *n1]
00707             - VMS_filename_classes[(unsigned char) *n2]);
00708 }

void fnfold ( char * filename )

Definition at line 726 of file filesubr.c.

00727 {
00728     while (*filename)
00729     {
00730         *filename = FOLD_FN_CHAR (*filename);
00731     filename++;
00732     }
00733 }

int isabsolute ( filename ) const

Variable Documentation

char** argv

Definition at line 793 of file filesubr.c.

char* buf

Definition at line 550 of file filesubr.c.

const char* file2_file

Definition at line 585 of file filesubr.c.

const char* mode

Definition at line 240 of file filesubr.c.

size_t nchars

Definition at line 551 of file filesubr.c.

int* pargc

Definition at line 794 of file filesubr.c.

char*** pargv

Definition at line 795 of file filesubr.c.

const char * to_file

Definition at line 377 of file filesubr.c.

int writable

Definition at line 323 of file filesubr.c.

Generated on Sun Oct 21 12:42:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/filesubr.c Source File

cvs-1.10/vms/filesubr.c

Go to the documentation of this file.
00001 /* filesubr.c --- subroutines for dealing with files
00002    Gratuitously adapted toward VMS quirks.
00003
00004    Jim Blandy <jimb@cyclic.com>
00005    Benjamin J. Lee <benjamin@cyclic.com>
00006
00007    This file is part of GNU CVS.
00008
00009    GNU CVS is free software; you can redistribute it and/or modify it
00010    under the terms of the GNU General Public License as published by the
00011    Free Software Foundation; either version 2, or (at your option) any
00012    later version.
00013
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.  */
00018
00019 #include "cvs.h"
00020
00021 static int deep_remove_dir PROTO((const char *path));
00022
00023 /*
00024  * Copies "from" to "to".
00025  */
00026 void
00027 copy_file (from_file, to_file)
00028     const char *from_file;
00029     const char *to_file;
00030 {
00031     char from[PATH_MAX], to[PATH_MAX];
00032     struct stat sb;
00033     struct utimbuf t;
00034     int fdin, fdout;
00035
00036     /* Prefer local relative paths to files at expense of logical name
00037        access to files. */
00038
00039     if (isabsolute(from_file))
00040       strcpy(from, from_file);
00041     else
00042       sprintf(from, "./%s", from_file);
00043
00044     if (isabsolute(to_file))
00045       strcpy(to, to_file);
00046     else
00047       sprintf(to, "./%s", to_file);
00048
00049     if (trace)
00050 #ifdef SERVER_SUPPORT
00051     (void) fprintf (stderr, "%c-> copy(%s,%s)\n",
00052             (server_active) ? 'S' : ' ', from, to);
00053 #else
00054     (void) fprintf (stderr, "-> copy(%s,%s)\n", from, to);
00055 #endif
00056     if (noexec)
00057     return;
00058
00059     if ((fdin = open (from, O_RDONLY)) < 0)
00060     error (1, errno, "cannot open %s for copying", from);
00061     if (fstat (fdin, &sb) < 0)
00062     error (1, errno, "cannot fstat %s", from);
00063     if ((fdout = creat (to, (int) sb.st_mode & 07777)) < 0)
00064     error (1, errno, "cannot create %s for copying", to);
00065     if (sb.st_size > 0)
00066     {
00067     char buf[BUFSIZ];
00068     int n;
00069
00070     for (;;)
00071     {
00072         n = read (fdin, buf, sizeof(buf));
00073         if (n == -1)
00074         {
00075 #ifdef EINTR
00076         if (errno == EINTR)
00077             continue;
00078 #endif
00079         error (1, errno, "cannot read file %s for copying", from);
00080         }
00081             else if (n == 0)
00082         break;
00083
00084         if (write(fdout, buf, n) != n) {
00085         error (1, errno, "cannot write file %s for copying", to);
00086         }
00087     }
00088
00089 #ifdef HAVE_FSYNC
00090     if (fsync (fdout))
00091         error (1, errno, "cannot fsync file %s after copying", to);
00092 #endif
00093     }
00094
00095     if (close (fdin) < 0)
00096     error (0, errno, "cannot close %s", from);
00097     if (close (fdout) < 0)
00098     error (1, errno, "cannot close %s", to);
00099
00100     /* now, set the times for the copied file to match those of the original */
00101     memset ((char *) &t, 0, sizeof (t));
00102     t.actime = sb.st_atime;
00103     t.modtime = sb.st_mtime;
00104     (void) utime (to, &t);
00105 }
00106
00107 /* FIXME-krp: these functions would benefit from caching the char * &
00108    stat buf.  */
00109
00110 /*
00111  * Returns non-zero if the argument file is a directory, or is a symbolic
00112  * link which points to a directory.
00113  */
00114 int
00115 isdir (file)
00116     const char *file;
00117 {
00118     struct stat sb;
00119
00120     if (stat (file, &sb) < 0)
00121     return (0);
00122     return (S_ISDIR (sb.st_mode));
00123 }
00124
00125 /*
00126  * Returns non-zero if the argument file is a symbolic link.
00127  */
00128 int
00129 islink (file)
00130     const char *file;
00131 {
00132 #ifdef S_ISLNK
00133     struct stat sb;
00134
00135     if (lstat (file, &sb) < 0)
00136     return (0);
00137     return (S_ISLNK (sb.st_mode));
00138 #else
00139     return (0);
00140 #endif
00141 }
00142
00143 /*
00144  * Returns non-zero if the argument file exists.
00145  */
00146 int
00147 isfile (file)
00148     const char *file;
00149 {
00150     return isaccessible(file, F_OK);
00151 }
00152
00153 /*
00154  * Returns non-zero if the argument file is readable.
00155  */
00156 int
00157 isreadable (file)
00158     const char *file;
00159 {
00160     return isaccessible(file, R_OK);
00161 }
00162
00163 /*
00164  * Returns non-zero if the argument file is writable.
00165  */
00166 int
00167 iswritable (file)
00168     const char *file;
00169 {
00170     return isaccessible(file, W_OK);
00171 }
00172
00173 /*
00174  * Returns non-zero if the argument file is accessable according to
00175  * mode.  If compiled with SETXID_SUPPORT also works if cvs has setxid
00176  * bits set.
00177  */
00178 int
00179 isaccessible (file, mode)
00180     const char *file;
00181     const int mode;
00182 {
00183 #ifdef SETXID_SUPPORT
00184     struct stat sb;
00185     int umask = 0;
00186     int gmask = 0;
00187     int omask = 0;
00188     int uid;
00189
00190     if (stat(file, &sb) == -1)
00191     return 0;
00192     if (mode == F_OK)
00193     return 1;
00194
00195     uid = geteuid();
00196     if (uid == 0)       /* superuser */
00197     {
00198     if (mode & X_OK)
00199         return sb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH);
00200     else
00201         return 1;
00202     }
00203
00204     if (mode & R_OK)
00205     {
00206     umask |= S_IRUSR;
00207     gmask |= S_IRGRP;
00208     omask |= S_IROTH;
00209     }
00210     if (mode & W_OK)
00211     {
00212     umask |= S_IWUSR;
00213     gmask |= S_IWGRP;
00214     omask |= S_IWOTH;
00215     }
00216     if (mode & X_OK)
00217     {
00218     umask |= S_IXUSR;
00219     gmask |= S_IXGRP;
00220     omask |= S_IXOTH;
00221     }
00222
00223     if (sb.st_uid == uid)
00224     return (sb.st_mode & umask) == umask;
00225     else if (sb.st_gid == getegid())
00226     return (sb.st_mode & gmask) == gmask;
00227     else
00228     return (sb.st_mode & omask) == omask;
00229 #else
00230     return access(file, mode) == 0;
00231 #endif
00232 }
00233
00234 /*
00235  * Open a file and die if it fails
00236  */
00237 FILE *
00238 open_file (name, mode)
00239     const char *name;
00240     const char *mode;
00241 {
00242     FILE *fp;
00243
00244     if ((fp = fopen (name, mode)) == NULL)
00245     error (1, errno, "cannot open %s", name);
00246     return (fp);
00247 }
00248
00249 /*
00250  * Make a directory and die if it fails
00251  */
00252 void
00253 make_directory (name)
00254     const char *name;
00255 {
00256     struct stat sb;
00257
00258     if (stat (name, &sb) == 0 && (!S_ISDIR (sb.st_mode)))
00259         error (0, 0, "%s already exists but is not a directory", name);
00260     if (!noexec && mkdir (name, 0777) < 0)
00261     error (1, errno, "cannot make directory %s", name);
00262 }
00263
00264 /*
00265  * Make a path to the argument directory, printing a message if something
00266  * goes wrong.
00267  */
00268 void
00269 make_directories (name)
00270     const char *name;
00271 {
00272     char *cp;
00273
00274     if (noexec)
00275     return;
00276
00277     if (mkdir (name, 0777) == 0 || errno == EEXIST)
00278     return;
00279     if (! existence_error (errno))
00280     {
00281     error (0, errno, "cannot make path to %s", name);
00282     return;
00283     }
00284     if ((cp = strrchr (name, '/')) == NULL)
00285     return;
00286     *cp = '\0';
00287     make_directories (name);
00288     *cp++ = '/';
00289     if (*cp == '\0')
00290     return;
00291     (void) mkdir (name, 0777);
00292 }
00293
00294 /* Create directory NAME if it does not already exist; fatal error for
00295    other errors.  Returns 0 if directory was created; 1 if it already
00296    existed.  */
00297 int
00298 mkdir_if_needed (name)
00299     char *name;
00300 {
00301     if (mkdir (name, 0777) < 0)
00302     {
00303     if (errno != EEXIST
00304 #ifdef EACCESS
00305         /* This was copied over from the OS/2 code; I would guess it
00306            isn't needed here but that has not been verified.  */
00307         && errno != EACCESS
00308 #endif
00309         )
00310         error (1, errno, "cannot make directory %s", name);
00311     return 1;
00312     }
00313     return 0;
00314 }
00315
00316 /*
00317  * Change the mode of a file, either adding write permissions, or removing
00318  * all write permissions.  Either change honors the current umask setting.
00319  */
00320 void
00321 xchmod (fname_file, writable)
00322     char *fname_file;
00323     int writable;
00324 {
00325     char fname[PATH_MAX];
00326     struct stat sb;
00327     mode_t mode, oumask;
00328
00329     /* Prefer local relative paths to files at expense of logical name
00330        access to files. */
00331
00332     if (isabsolute(fname_file))
00333       strcpy(fname, fname_file);
00334     else
00335       sprintf(fname, "./%s", fname_file);
00336
00337     if (stat (fname, &sb) < 0)
00338     {
00339     if (!noexec)
00340         error (0, errno, "cannot stat %s", fname);
00341     return;
00342     }
00343     oumask = umask (0);
00344     (void) umask (oumask);
00345     if (writable)
00346     {
00347     mode = sb.st_mode | (~oumask
00348                  & (((sb.st_mode & S_IRUSR) ? S_IWUSR : 0)
00349                 | ((sb.st_mode & S_IRGRP) ? S_IWGRP : 0)
00350                 | ((sb.st_mode & S_IROTH) ? S_IWOTH : 0)));
00351     }
00352     else
00353     {
00354     mode = sb.st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH) & ~oumask;
00355     }
00356
00357     if (trace)
00358 #ifdef SERVER_SUPPORT
00359     (void) fprintf (stderr, "%c-> chmod(%s,%o)\n",
00360             (server_active) ? 'S' : ' ', fname, mode);
00361 #else
00362     (void) fprintf (stderr, "-> chmod(%s,%o)\n", fname, mode);
00363 #endif
00364     if (noexec)
00365     return;
00366
00367     if (chmod (fname, mode) < 0)
00368     error (0, errno, "cannot change mode of file %s", fname);
00369 }
00370
00371 /*
00372  * Rename a file and die if it fails
00373  */
00374 void
00375 rename_file (from_file, to_file)
00376     const char *from_file;
00377     const char *to_file;
00378 {
00379     char from[PATH_MAX], to[PATH_MAX];
00380
00381     /* Prefer local relative paths to files at expense of logical name
00382        access to files. */
00383
00384     if (isabsolute(from_file))
00385       strcpy(from, from_file);
00386     else
00387       sprintf(from, "./%s", from_file);
00388
00389     if (isabsolute(to_file))
00390       strcpy(to, to_file);
00391     else
00392       sprintf(to, "./%s", to_file);
00393
00394     if (trace)
00395 #ifdef SERVER_SUPPORT
00396     (void) fprintf (stderr, "%c-> rename(%s,%s)\n",
00397             (server_active) ? 'S' : ' ', from, to);
00398 #else
00399     (void) fprintf (stderr, "-> rename(%s,%s)\n", from, to);
00400 #endif
00401     if (noexec)
00402     return;
00403
00404     if (rename (from, to) < 0)
00405     error (1, errno, "cannot rename file %s to %s", from, to);
00406 }
00407
00408 /*
00409  * unlink a file, if possible.
00410  */
00411 int
00412 unlink_file (f_file)
00413     const char *f_file;
00414 {
00415     char f[PATH_MAX];
00416
00417     /* Prefer local relative paths to files at expense of logical name
00418        access to files. */
00419
00420     if (isabsolute(f_file))
00421       strcpy(f, f_file);
00422     else
00423       sprintf(f, "./%s", f_file);
00424
00425     if (trace)
00426 #ifdef SERVER_SUPPORT
00427     (void) fprintf (stderr, "%c-> unlink(%s)\n",
00428             (server_active) ? 'S' : ' ', f);
00429 #else
00430     (void) fprintf (stderr, "-> unlink(%s)\n", f);
00431 #endif
00432     if (noexec)
00433     return (0);
00434
00435     return (unlink (f));
00436 }
00437
00438 /*
00439  * Unlink a file or dir, if possible.  If it is a directory do a deep
00440  * removal of all of the files in the directory.  Return -1 on error
00441  * (in which case errno is set).
00442  */
00443 int
00444 unlink_file_dir (f_file)
00445     const char *f_file;
00446 {
00447     char f[PATH_MAX];
00448
00449     /* Prefer local relative paths to files at expense of logical name
00450        access to files. */
00451
00452     if (isabsolute(f_file))
00453       strcpy(f, f_file);
00454     else
00455       sprintf(f, "./%s", f_file);
00456
00457     if (trace)
00458 #ifdef SERVER_SUPPORT
00459     (void) fprintf (stderr, "%c-> unlink_file_dir(%s)\n",
00460             (server_active) ? 'S' : ' ', f);
00461 #else
00462     (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f);
00463 #endif
00464     if (noexec)
00465     return (0);
00466
00467     if (unlink (f) != 0)
00468     {
00469     /* under NEXTSTEP errno is set to return EPERM if
00470      * the file is a directory,or if the user is not
00471      * allowed to read or write to the file.
00472      * [This is probably a bug in the O/S]
00473      * other systems will return EISDIR to indicate
00474      * that the path is a directory.
00475      */
00476         if (errno == EISDIR || errno == EPERM)
00477                 return deep_remove_dir (f);
00478         else
00479         /* The file wasn't a directory and some other
00480          * error occured
00481          */
00482                 return -1;
00483     }
00484     /* We were able to remove the file from the disk */
00485     return 0;
00486 }
00487
00488 /* Remove a directory and everything it contains.  Returns 0 for
00489  * success, -1 for failure (in which case errno is set).
00490  */
00491
00492 static int
00493 deep_remove_dir (path)
00494     const char *path;
00495 {
00496     DIR       *dirp;
00497     struct dirent *dp;
00498     char       buf[PATH_MAX];
00499
00500     if (rmdir (path) != 0 && (errno == ENOTEMPTY || errno == EEXIST))
00501     {
00502     if ((dirp = opendir (path)) == NULL)
00503         /* If unable to open the directory return
00504          * an error
00505          */
00506         return -1;
00507
00508     while ((dp = readdir (dirp)) != NULL)
00509     {
00510         if (strcmp (dp->d_name, ".") == 0 ||
00511             strcmp (dp->d_name, "..") == 0)
00512         continue;
00513
00514         sprintf (buf, "%s/%s", path, dp->d_name);
00515
00516         if (unlink (buf) != 0 )
00517         {
00518         if (errno == EISDIR || errno == EPERM)
00519         {
00520             if (deep_remove_dir (buf))
00521             {
00522             closedir (dirp);
00523             return -1;
00524             }
00525         }
00526         else
00527         {
00528             /* buf isn't a directory, or there are
00529              * some sort of permision problems
00530              */
00531             closedir (dirp);
00532             return -1;
00533         }
00534         }
00535     }
00536     closedir (dirp);
00537     return rmdir (path);
00538     }
00539
00540     /* Was able to remove the directory return 0 */
00541     return 0;
00542 }
00543
00544 /* Read NCHARS bytes from descriptor FD into BUF.
00545    Return the number of characters successfully read.
00546    The number returned is always NCHARS unless end-of-file or error.  */
00547 static size_t
00548 block_read (fd, buf, nchars)
00549     int fd;
00550     char *buf;
00551     size_t nchars;
00552 {
00553     char *bp = buf;
00554     size_t nread;
00555
00556     do
00557     {
00558     nread = read (fd, bp, nchars);
00559     if (nread == (size_t)-1)
00560     {
00561 #ifdef EINTR
00562         if (errno == EINTR)
00563         continue;
00564 #endif
00565         return (size_t)-1;
00566     }
00567
00568     if (nread == 0)
00569         break;
00570
00571     bp += nread;
00572     nchars -= nread;
00573     } while (nchars != 0);
00574
00575     return bp - buf;
00576 }
00577
00578
00579 /*
00580  * Compare "file1" to "file2". Return non-zero if they don't compare exactly.
00581  */
00582 int
00583 xcmp (file1_file, file2_file)
00584     const char *file1_file;
00585     const char *file2_file;
00586 {
00587     char file1[PATH_MAX], file2[PATH_MAX];
00588     char *buf1, *buf2;
00589     struct stat sb1, sb2;
00590     int fd1, fd2;
00591     int ret;
00592
00593     /* Prefer local relative paths to files at expense of logical name
00594        access to files. */
00595
00596     if (isabsolute(file1_file))
00597       strcpy(file1, file1_file);
00598     else
00599       sprintf(file1, "./%s", file1_file);
00600
00601     if (isabsolute(file2_file))
00602       strcpy(file2, file2_file);
00603     else
00604       sprintf(file2, "./%s", file2_file);
00605
00606     if ((fd1 = open (file1, O_RDONLY)) < 0)
00607     error (1, errno, "cannot open file %s for comparing", file1);
00608     if ((fd2 = open (file2, O_RDONLY)) < 0)
00609     error (1, errno, "cannot open file %s for comparing", file2);
00610     if (fstat (fd1, &sb1) < 0)
00611     error (1, errno, "cannot fstat %s", file1);
00612     if (fstat (fd2, &sb2) < 0)
00613     error (1, errno, "cannot fstat %s", file2);
00614
00615     /* A generic file compare routine might compare st_dev & st_ino here
00616        to see if the two files being compared are actually the same file.
00617        But that won't happen in CVS, so we won't bother. */
00618
00619     if (sb1.st_size != sb2.st_size)
00620     ret = 1;
00621     else if (sb1.st_size == 0)
00622     ret = 0;
00623     else
00624     {
00625     /* FIXME: compute the optimal buffer size by computing the least
00626        common multiple of the files st_blocks field */
00627     size_t buf_size = 8 * 1024;
00628     size_t read1;
00629     size_t read2;
00630
00631     buf1 = xmalloc (buf_size);
00632     buf2 = xmalloc (buf_size);
00633
00634     do
00635     {
00636         read1 = block_read (fd1, buf1, buf_size);
00637         if (read1 == (size_t)-1)
00638         error (1, errno, "cannot read file %s for comparing", file1);
00639
00640         read2 = block_read (fd2, buf2, buf_size);
00641         if (read2 == (size_t)-1)
00642         error (1, errno, "cannot read file %s for comparing", file2);
00643
00644         /* assert (read1 == read2); */
00645
00646         ret = memcmp(buf1, buf2, read1);
00647     } while (ret == 0 && read1 == buf_size);
00648
00649     free (buf1);
00650     free (buf2);
00651     }
00652
00653     (void) close (fd1);
00654     (void) close (fd2);
00655     return (ret);
00656 }
00657
00658 unsigned char
00659 VMS_filename_classes[] =
00660 {
00661     0x00,0x01,0x02,0x03, 0x04,0x05,0x06,0x07,
00662     0x08,0x09,0x0a,0x0b, 0x0c,0x0d,0x0e,0x0f,
00663     0x10,0x11,0x12,0x13, 0x14,0x15,0x16,0x17,
00664     0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f,
00665     0x20,0x21,0x22,0x23, 0x24,0x25,0x26,0x27,
00666     0x28,0x29,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f,
00667     0x30,0x31,0x32,0x33, 0x34,0x35,0x36,0x37,
00668     0x38,0x39,0x3a,0x3b, 0x3c,0x3d,0x3e,0x3f,
00669     0x40,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
00670     0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
00671     0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
00672     0x78,0x79,0x7a,0x5b, 0x5c,0x5d,0x5e,0x5f,
00673     0x60,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
00674     0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
00675     0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
00676     0x78,0x79,0x7a,0x7b, 0x7c,0x7d,0x7e,0x7f,
00677     0x80,0x81,0x82,0x83, 0x84,0x85,0x86,0x87,
00678     0x88,0x89,0x8a,0x8b, 0x8c,0x8d,0x8e,0x8f,
00679     0x90,0x91,0x92,0x93, 0x94,0x95,0x96,0x97,
00680     0x98,0x99,0x9a,0x9b, 0x9c,0x9d,0x9e,0x9f,
00681     0xa0,0xa1,0xa2,0xa3, 0xa4,0xa5,0xa6,0xa7,
00682     0xa8,0xa9,0xaa,0xab, 0xac,0xad,0xae,0xaf,
00683     0xb0,0xb1,0xb2,0xb3, 0xb4,0xb5,0xb6,0xb7,
00684     0xb8,0xb9,0xba,0xbb, 0xbc,0xbd,0xbe,0xbf,
00685     0xc0,0xc1,0xc2,0xc3, 0xc4,0xc5,0xc6,0xc7,
00686     0xc8,0xc9,0xca,0xcb, 0xcc,0xcd,0xce,0xcf,
00687     0xd0,0xd1,0xd2,0xd3, 0xd4,0xd5,0xd6,0xd7,
00688     0xd8,0xd9,0xda,0xdb, 0xdc,0xdd,0xde,0xdf,
00689     0xe0,0xe1,0xe2,0xe3, 0xe4,0xe5,0xe6,0xe7,
00690     0xe8,0xe9,0xea,0xeb, 0xec,0xed,0xee,0xef,
00691     0xf0,0xf1,0xf2,0xf3, 0xf4,0xf5,0xf6,0xf7,
00692     0xf8,0xf9,0xfa,0xfb, 0xfc,0xfd,0xfe,0xff,
00693 };
00694
00695 /* Like strcmp, but with the appropriate tweaks for file names.
00696    Under VMS, filenames are case-insensitive but case-preserving.
00697    FIXME: this should compare y.tab.c equal with y_tab.c, at least
00698    if fnfold is modified (see below).  */
00699 int
00700 fncmp (const char *n1, const char *n2)
00701 {
00702     while (*n1 && *n2
00703            && (VMS_filename_classes[(unsigned char) *n1]
00704            == VMS_filename_classes[(unsigned char) *n2]))
00705         n1++, n2++;
00706     return (VMS_filename_classes[(unsigned char) *n1]
00707             - VMS_filename_classes[(unsigned char) *n2]);
00708 }
00709
00710 /* Fold characters in FILENAME to their canonical forms.  FIXME: this
00711    probably should be mapping y.tab.c to y_tab.c but first we have to
00712    figure out whether fnfold is the right hook for that functionality
00713    (probable answer: yes, but it should not fold case on OS/2, VMS, or
00714    NT.  You see, fnfold isn't called anywhere, so we can define it to
00715    mean whatever makes sense.  Of course to solve the VMS y.tab.c
00716    problem we'd need to call it where appropriate.  It would need to
00717    be redocumented as "fold to a form we can create in the filesystem"
00718    rather than "canonical form").  The idea is that files we create
00719    would get thusly munged, but CVS can cope with their names being
00720    different the same way that the NT port copes with it if the user
00721    renames a file from "foo" to "FOO".
00722
00723    Alternately, this kind of handling could/should go into CVS_FOPEN
00724    and friends (if we want to do it like the Mac port, anyway).  */
00725 void
00726 fnfold (char *filename)
00727 {
00728     while (*filename)
00729     {
00730         *filename = FOLD_FN_CHAR (*filename);
00731     filename++;
00732     }
00733 }
00734
00735 /* Generate a unique temporary filename.  Returns a pointer to a newly
00736    malloc'd string containing the name.  Returns successfully or not at
00737    all.  */
00738 char *
00739 cvs_temp_name ()
00740 {
00741     char value[L_tmpnam + 1];
00742     char *retval;
00743
00744     /* FIXME: what is the VMS equivalent to TMPDIR?  */
00745     retval = tmpnam (value);
00746     if (retval == NULL)
00747     error (1, errno, "cannot generate temporary filename");
00748     return xstrdup (retval);
00749 }
00750
00751 /* Return non-zero iff FILENAME is absolute.
00752    Trivial under Unix, but more complicated under other systems.  */
00753 int
00754 isabsolute (filename)
00755     const char *filename;
00756 {
00757     if(filename[0] == '/'
00758        || filename[0] == '['
00759        || filename[0] == '<'
00760        || strchr(filename, ':'))
00761         return 1;
00762     else
00763         return 0;
00764 }
00765
00766
00767 /* Return a pointer into PATH's last component.  */
00768 char *
00769 last_component (path)
00770     char *path;
00771 {
00772     char *last = strrchr (path, '/');
00773
00774     if (last && (last != path))
00775         return last + 1;
00776     else
00777         return path;
00778 }
00779
00780 /* Return the home directory.  Returns a pointer to storage
00781    managed by this function or its callees (currently getenv).  */
00782 char *
00783 get_homedir ()
00784 {
00785     return getenv ("HOME");
00786 }
00787
00788 /* See cvs.h for description.  On VMS this currently does nothing, although
00789    I think we should be expanding wildcards here.  */
00790 void
00791 expand_wild (argc, argv, pargc, pargv)
00792     int argc;
00793     char **argv;
00794     int *pargc;
00795     char ***pargv;
00796 {
00797     int i;
00798     *pargc = argc;
00799     *pargv = (char **) xmalloc (argc * sizeof (char *));
00800     for (i = 0; i < argc; ++i)
00801     (*pargv)[i] = xstrdup (argv[i]);
00802 }
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/filutils.c Source File

cvs-1.10/vms/filutils.c

Go to the documentation of this file.
00001 /*
00002  * Copyright © 1994 the Free Software Foundation, Inc.
00003  *
00004  * Author: Richard Levitte (levitte@e.kth.se)
00005  *
00006  * This file is a part of GNU VMSLIB, the GNU library for porting GNU
00007  * software to VMS.
00008  *
00009  * GNU VMSLIB is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * GNU VMSLIB is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  */
00019
00020 #include <string.h>
00021 #include <file.h>
00022 #include <rmsdef.h>
00023 #include <fab.h>
00024 #include <nam.h>
00025 #include <stdlib.h>
00026 #include <lib$routines.h>
00027 #include <descrip.h>
00028 #include "filutils.h"
00029
00030 /* file_name_as_directory was snarfed from src/fileio.c in GNU Emacs.  */
00031
00032 char *
00033 file_name_as_directory (out, in)
00034      char *out, *in;
00035 {
00036   int size = strlen (in) - 1;
00037   int ext_point = 0;
00038
00039   strcpy (out, in);
00040
00041   /* Is it already a directory string? */
00042   if (in[size] == ':' || in[size] == ']' || in[size] == '>')
00043     return out;
00044   /* Is it a VMS directory file name?  If so, hack VMS syntax.  */
00045   else
00046     if (! strchr (in, '/'))
00047       {
00048     ext_point = 1;
00049     if (size > 3 && (! strcmp (&in[size - 3], ".DIR")
00050              || ! strcmp (&in[size - 3], ".dir")))
00051       ext_point = -3;
00052     else
00053       if (size > 5 && (! strncmp (&in[size - 5], ".DIR", 4)
00054                || ! strncmp (&in[size - 5], ".dir", 4))
00055           && (in[size - 1] == '.' || in[size - 1] == ';')
00056           && in[size] == '1')
00057         ext_point = -5;
00058       }
00059   if (ext_point != 0)
00060     {
00061       register char *p, *dot;
00062       char brack;
00063
00064       /* dir:[000000]x.dir --> dir:x.dir --> dir:[x]
00065      dir:[000000.x]y.dir --> dir:[x]y.dir --> dir:[x.y]
00066      but dir:[000000.000000]x.dir --> dir:[000000.000000.x]
00067          dir:[000000.000000.x]y.dir --> dir:[000000.000000.x.y] */
00068       static char tem[256];
00069
00070       p = dot = strchr(in,':');
00071       if (p != 0 && (p[1] == '[' || p[1] == '<'))
00072     {
00073       p += 2;
00074       if (strncmp(p,"000000",6) == 0)
00075         {
00076           p += 6;
00077           if (strncmp(p,".000000",7) != 0
00078           && (*p == ']' || *p == '>' || *p == '.'))
00079         {
00080           size = dot - in + 1;
00081           strncpy(tem, in, size);
00082           if (*p == '.')
00083             tem[size++] = '[';
00084           strcpy(tem + size, p + 1);
00085           in = tem;
00086           size = strlen(in) - 1;
00087         }
00088         }
00089     }
00090       /* x.dir -> [.x]
00091      dir:x.dir --> dir:[x]
00092      dir:[x]y.dir --> dir:[x.y] */
00093       p = in + size;
00094       while (p != in && *p != ':' && *p != '>' && *p != ']') p--;
00095       {
00096     char *emergency_dir = 0;
00097     int emergency_point = 0; /* relative to the end of `out' */
00098
00099     if (p != in)
00100       {
00101         strncpy (out, in, p - in);
00102         out[p - in] = '\0';
00103         if (*p == ':')
00104           {
00105         brack = ']';
00106         strcat (out, ":[");
00107         emergency_dir = "000000";
00108         emergency_point = 0;
00109           }
00110         else
00111           {
00112         brack = *p;
00113         strcat (out, ".");
00114         emergency_dir = "";
00115         emergency_point = -1;
00116           }
00117         p++;
00118       }
00119     else
00120       {
00121         brack = ']';
00122         strcpy (out, "[.");
00123         emergency_dir = "";
00124         emergency_point = -2;
00125       }
00126     if (strncmp (p, "000000.", 7) == 0
00127         && (strncmp (p+7, "000000", 6) != 0
00128         || (p[13] != ']' && p[13] != '>' && p[13] != '.')))
00129       p += 7;
00130     if (p < (in + size + ext_point))
00131       {
00132         register copy_len = ((in + size + ext_point) - p);
00133         size = strlen (out) + copy_len;
00134         strncat (out, p, copy_len);
00135       }
00136     else
00137       {
00138         size = strlen (out) + emergency_point;
00139         strcpy (out + size, emergency_dir);
00140         size += strlen (emergency_dir);
00141       }
00142       }
00143       out[size++] = brack;
00144       out[size] = '\0';
00145     }
00146   return out;
00147 }
00148
00149 /*
00150  * Convert from directory name to filename.
00151  * On VMS:
00152  *       xyzzy:[mukesh.emacs] => xyzzy:[mukesh]emacs.dir.1
00153  *       xyzzy:[mukesh] => xyzzy:[000000]mukesh.dir.1
00154  * On UNIX, it's simple: just make sure there is a terminating /
00155
00156  * Value is nonzero if the string output is different from the input.
00157  */
00158
00159 /* directory_file_name was snarfed from src/fileio.c in GNU Emacs.  */
00160
00161 #include <stdio.h>
00162 directory_file_name (src, dst)
00163      char *src, *dst;
00164 {
00165   long slen;
00166   long rlen;
00167   char * ptr, * rptr;
00168   char bracket;
00169   struct FAB fab = cc$rms_fab;
00170   struct NAM nam = cc$rms_nam;
00171   char esa[NAM$C_MAXRSS];
00172
00173   slen = strlen (src);
00174
00175   if (! strchr (src, '/')
00176       && (src[slen - 1] == ']'
00177       || src[slen - 1] == ':'
00178       || src[slen - 1] == '>'))
00179     {
00180       /* VMS style - convert [x.y.z] to [x.y]z, [x] to [000000]x */
00181       fab.fab$l_fna = src;
00182       fab.fab$b_fns = slen;
00183       fab.fab$l_nam = &nam;
00184       fab.fab$l_fop = FAB$M_NAM;
00185
00186       nam.nam$l_esa = esa;
00187       nam.nam$b_ess = sizeof esa;
00188       nam.nam$b_nop |= NAM$M_SYNCHK;
00189
00190       /* We call SYS$PARSE to handle such things as [--] for us. */
00191       if (SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL)
00192     {
00193       slen = nam.nam$b_esl;
00194       if (esa[slen - 1] == ';' && esa[slen - 2] == '.')
00195         slen -= 2;
00196       esa[slen] = '\0';
00197       src = esa;
00198     }
00199       if (src[slen - 1] != ']' && src[slen - 1] != '>')
00200     {
00201       /* what about when we have logical_name:???? */
00202       if (src[slen - 1] == ':')
00203         {           /* Xlate logical name and see what we get */
00204           ptr = strcpy (dst, src); /* upper case for getenv */
00205           while (*ptr)
00206         {
00207           if ('a' <= *ptr && *ptr <= 'z')
00208             *ptr -= 040;
00209           ptr++;
00210         }
00211           dst[slen - 1] = 0;    /* remove colon */
00212           if (!(src = getenv (dst)))
00213         return 0;
00214           /* should we jump to the beginning of this procedure?
00215          Good points: allows us to use logical names that xlate
00216          to Unix names,
00217          Bad points: can be a problem if we just translated to a device
00218          name...
00219          For now, I'll punt and always expect VMS names, and hope for
00220          the best! */
00221           slen = strlen (src);
00222           if (src[slen - 1] != ']' && src[slen - 1] != '>')
00223         { /* no recursion here! */
00224           strcpy (dst, src);
00225           return 0;
00226         }
00227         }
00228       else
00229         {       /* not a directory spec */
00230           strcpy (dst, src);
00231           return 0;
00232         }
00233     }
00234       bracket = src[slen - 1];
00235
00236       /* If bracket is ']' or '>', bracket - 2 is the corresponding
00237      opening bracket.  */
00238       ptr = strchr (src, bracket - 2);
00239       if (ptr == 0)
00240     { /* no opening bracket */
00241       strcpy (dst, src);
00242       return 0;
00243     }
00244       if (!(rptr = strrchr (src, '.')))
00245     rptr = ptr;
00246       slen = rptr - src;
00247       strncpy (dst, src, slen);
00248       dst[slen] = '\0';
00249 #if 0
00250       fprintf (stderr, "dst = \"%s\"\nsrc = \"%s\"\nslen = %d\n",
00251            dst, src, slen);
00252 #endif
00253       if (*rptr == '.')
00254     {
00255       dst[slen++] = bracket;
00256       dst[slen] = '\0';
00257     }
00258       else
00259     {
00260       /* If we have the top-level of a rooted directory (i.e. xx:[000000]),
00261          then translate the device and recurse. */
00262       if (dst[slen - 1] == ':'
00263           && dst[slen - 2] != ':'   /* skip decnet nodes */
00264           && ((src[slen] == '['
00265            && strcmp(src + slen + 1, "000000]") == 0)
00266           || src[slen] == '<'
00267           && strcmp(src + slen + 1, "000000>") == 0))
00268         {
00269           static char equiv_buf[256];
00270           static struct dsc$descriptor_s equiv
00271         = {sizeof (equiv_buf), DSC$K_DTYPE_T, DSC$K_CLASS_S, equiv_buf};
00272           static struct dsc$descriptor_s d_name
00273         = {0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0};
00274           short eqlen;
00275
00276           dst[slen - 1] = '\0';
00277           d_name.dsc$w_length = strlen (dst);
00278           d_name.dsc$a_pointer = dst;
00279           if (LIB$SYS_TRNLOG (&d_name, &eqlen, &equiv) == 1
00280           && (equiv_buf[eqlen] = '\0', ptr = equiv_buf) != 0
00281           && (rlen = strlen (ptr) - 1) > 0
00282           && (ptr[rlen] == ']' || ptr[rlen] == '>')
00283           && ptr[rlen - 1] == '.')
00284         {
00285           char * buf = (char *) malloc (strlen (ptr) + 1);
00286           int tmp = ptr[rlen];
00287           if (buf == 0)
00288             return 0; /* bad luck */
00289           strcpy (buf, ptr);
00290           buf[rlen - 1] = tmp;
00291           buf[rlen] = '\0';
00292           tmp = directory_file_name (buf, dst);
00293           free (buf);
00294           return tmp;
00295         }
00296           else
00297         dst[slen - 1] = ':';
00298         }
00299       strcat (dst, "[000000]");
00300       slen += 8;
00301     }
00302       rptr++;
00303       rlen = strlen (rptr) - 1;
00304       strncat (dst, rptr, rlen);
00305       dst[slen + rlen] = '\0';
00306       strcat (dst, ".DIR.1");
00307       return 1;
00308     }
00309
00310   /* Process as Unix format: just remove any final slash.
00311      But leave "/" unchanged; do not change it to "".  */
00312   strcpy (dst, src);
00313   if (slen > 1 && dst[slen - 1] == '/')
00314     {
00315       dst[slen - 1] = 0;
00316       return 1;
00317     }
00318   return 0;
00319 }
00320
00321 /* end of snarf.  */
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/filutils.h Source File

cvs-1.10/vms/filutils.h

Go to the documentation of this file.
00001 /*
00002  * Copyright © 1994 the Free Software Foundation, Inc.
00003  *
00004  * Author: Richard Levitte (levitte@e.kth.se)
00005  *
00006  * This file is a part of GNU VMSLIB, the GNU library for porting GNU
00007  * software to VMS.
00008  *
00009  * GNU VMSLIB is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * GNU VMSLIB is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  */
00019
00020 char *file_name_as_directory ();
00021 int directory_file_name ();
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


filutils.c File Reference

cvs-1.10/vms/filutils.c File Reference

#include <string.h>
#include <file.h>
#include <rmsdef.h>
#include <fab.h>
#include <nam.h>
#include <stdlib.h>
#include <lib$routines.h>
#include <descrip.h>
#include "filutils.h"
#include <stdio.h>

Include dependency graph for filutils.c:

Include dependency graph

Go to the source code of this file.

Functions

char * file_name_as_directory (out, in) char *out,*in

Variables

* dst

Function Documentation

char* file_name_as_directory | ( | out | ,
 |  | in |
 | ) |

Variable Documentation

* dst

Definition at line 163 of file filutils.c.

Generated on Sun Oct 21 12:43:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


filutils.h File Reference

cvs-1.10/vms/filutils.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

char * | file_name_as_directory ()
int | directory_file_name ()

Function Documentation

int directory_file_name ( )

char* file_name_as_directory ( )

Generated on Sun Oct 21 12:43:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getpass.c File Reference

cvs-1.10/vms/getpass.c File Reference

#include <stdio.h>
#include <iodef.h>
#include <descrip.h>
#include <starlet.h>
#include <string.h>
#include "cvs.h"

Include dependency graph for getpass.c:

Include dependency graph

Go to the source code of this file.

Functions

char * getpass (char *prompt)

Function Documentation

char* getpass ( char * prompt )

Definition at line 27 of file getpass.c.

00028 {
00029     int status;
00030     unsigned short chan;
00031     static $DESCRIPTOR (sys_command, "SYS$COMMAND");
00032     unsigned short iosb[4];
00033     /* Arbitrary limit.  It doesn't seem worth going through multiple
00034        SYS$QIOW calls and who knows what to get rid of it, I don't
00035        think.  */
00036     static char buf[2048];
00037
00038     /* Try to ensure that we avoid stepping on whatever output has
00039        been sent to stdout.  */
00040     printf ("\n");
00041     fflush (stdout);
00042
00043     status = sys$assign (&sys_command, &chan, 0, 0);
00044     if (!(status & 1))
00045     error (1, 0, "sys$assign failed in getpass");
00046     status = sys$qiow (0, chan, IO$_READPROMPT | IO$M_NOECHO, &iosb, 0, 0,
00047                buf, sizeof (buf) - 1, 0, 0, prompt, strlen (prompt));
00048     if (!(status & 1))
00049     error (1, 0, "sys$qiow failed in getpass");
00050     if (!(iosb[0] & 1))
00051     error (1, 0, "sys$qiow (iosb) failed in getpass");
00052     buf[iosb[1]] = '\0';
00053     status = sys$dassgn (chan);
00054     if (!(status & 1))
00055     error (0, 0, "sys$dassgn failed in getpass");
00056     /* Since there is no echo, we better go to the next line ourselves.  */
00057     printf ("\n");
00058     return buf;
00059 }

Generated on Sun Oct 21 12:43:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/getpass.c Source File

cvs-1.10/vms/getpass.c

Go to the documentation of this file.
00001 /* This program is free software; you can redistribute it and/or modify
00002    it under the terms of the GNU General Public License as published by
00003    the Free Software Foundation; either version 2, or (at your option)
00004    any later version.
00005
00006    This program is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009    GNU General Public License for more details.  */
00010
00011 #undef TEST
00012
00013 #include <stdio.h>
00014 #include <iodef.h>
00015 #include <descrip.h>
00016 #include <starlet.h>
00017 #include <string.h>
00018
00019 #ifdef TEST
00020 #include <stdlib.h>
00021 static void error (int, int, char *);
00022 #else
00023 #  include "cvs.h"
00024 #endif
00025
00026 char *
00027 getpass (char *prompt)
00028 {
00029     int status;
00030     unsigned short chan;
00031     static $DESCRIPTOR (sys_command, "SYS$COMMAND");
00032     unsigned short iosb[4];
00033     /* Arbitrary limit.  It doesn't seem worth going through multiple
00034        SYS$QIOW calls and who knows what to get rid of it, I don't
00035        think.  */
00036     static char buf[2048];
00037
00038     /* Try to ensure that we avoid stepping on whatever output has
00039        been sent to stdout.  */
00040     printf ("\n");
00041     fflush (stdout);
00042
00043     status = sys$assign (&sys_command, &chan, 0, 0);
00044     if (!(status & 1))
00045     error (1, 0, "sys$assign failed in getpass");
00046     status = sys$qiow (0, chan, IO$_READPROMPT | IO$M_NOECHO, &iosb, 0, 0,
00047                buf, sizeof (buf) - 1, 0, 0, prompt, strlen (prompt));
00048     if (!(status & 1))
00049     error (1, 0, "sys$qiow failed in getpass");
00050     if (!(iosb[0] & 1))
00051     error (1, 0, "sys$qiow (iosb) failed in getpass");
00052     buf[iosb[1]] = '\0';
00053     status = sys$dassgn (chan);
00054     if (!(status & 1))
00055     error (0, 0, "sys$dassgn failed in getpass");
00056     /* Since there is no echo, we better go to the next line ourselves.  */
00057     printf ("\n");
00058     return buf;
00059 }
00060
00061 #ifdef TEST
00062 int
00063 main ()
00064 {
00065     printf ("thank you for saying \"%s\"\n", getpass ("What'll it be? "));
00066     return 0;
00067 }
00068
00069 static void error (int x, int y, char *msg)
00070 {
00071     printf ("error: %s\n", msg);
00072     if (x)
00073         exit (EXIT_FAILURE);
00074 }
00075 #endif
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/getwd.c Source File

cvs-1.10/vms/getwd.c

Go to the documentation of this file.
00001 /* This program is free software; you can redistribute it and/or modify
00002    it under the terms of the GNU General Public License as published by
00003    the Free Software Foundation; either version 2, or (at your option)
00004    any later version.
00005
00006    This program is distributed in the hope that it will be useful,
00007    but WITHOUT ANY WARRANTY; without even the implied warranty of
00008    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00009    GNU General Public License for more details.  */
00010
00011 #include <unixlib.h>
00012
00013 #include "cvs.h"
00014
00015 /* Return the current directory, newly allocated, arbitrarily long.
00016    Return NULL and set errno on error. */
00017 char *
00018 xgetwd ()
00019 {
00020     char pathname[256];
00021
00022     return xstrdup (getcwd (pathname, sizeof (pathname) - 2, 0));
00023 }
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/misc.c Source File

cvs-1.10/vms/misc.c

Go to the documentation of this file.
00001 /*
00002  * Copyright © 1994 the Free Software Foundation, Inc.
00003  *
00004  * Author: Roland B. Roberts (roberts@nsrl.rochester.edu)
00005  *
00006  * This file is a part of GNU VMSLIB, the GNU library for porting GNU
00007  * software to VMS.
00008  *
00009  * GNU VMSLIB is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * GNU VMSLIB is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  */
00019
00020 /*
00021  * Miscellaneous utilities used by hackargv().
00022  * Some of these are useful in their own right.
00023  */
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 #include <string.h>
00027 #include <ctype.h>
00028 #include <lib$routines.h>
00029
00030 /* See in misc.h why it is done like this.  */
00031 void x_free (void *block)
00032 {
00033   free (block);
00034 }
00035
00036 /*
00037  * Some string utilities.
00038  */
00039 char *downcase (char *s)
00040 {
00041   register char *t;
00042   for (t = s ; *t; t++)
00043     *t = tolower(*t);
00044   return (s);
00045 }
00046
00047 char *strndup (char *src, int len) {
00048   char *dst = (char *) xmalloc (len + 1);
00049   strncpy (dst, src, len);
00050   dst[len] = 0;
00051   return (dst);
00052 }
00053
00054 #include <string.h>
00055
00056 /*
00057  * int fixpath (char *path)
00058  *
00059  * Synopsis:
00060  *   `Fix' VMS pathnames, converting them to canonical form.
00061  *
00062  * Description:
00063  *   The following conversions are performed
00064  *     x:[y.][000000.z] --> x:[y.z]
00065  *     x:[y.][z]        --> x:[y.z]
00066  *     x:[000000.y]     --> x:[y]
00067  *
00068  * Author:
00069  *   Roland B Roberts (roberts@nsrl.rochester.edu)
00070  *   March 1994
00071  */
00072 int fixpath (char *path)
00073 {
00074   char *s, *d, *t;
00075   int skip = 0;
00076   d = s = path;
00077   if (t = strstr(path ,".][000000"))
00078     skip = 9;
00079   else if (t = strstr(path,"]["))
00080     skip = 2;
00081   else if (t = strstr(path,"[000000."))
00082     t++, skip = 7;
00083   if (t) {
00084     while (s < t)
00085       *d++ = *s++;
00086     s += skip;
00087     while (*d++ = *s++);
00088   }
00089   return 0;
00090 }
00091
00092
00093 #include <ctype.h>
00094 #include <string.h>
00095
00096 #ifndef TRUE
00097 #define TRUE 1
00098 #define FALSE 0
00099 #endif
00100
00101 /*
00102  * char *argvconcat (int argc, char **argv)
00103  *
00104  * Synopsis:
00105  *   Concatenate all elements of argv into a single string suitable for
00106  *   use as a command line.
00107  *
00108  * Description:
00109  *   This is intended for use with hackargv() in order to build a command
00110  *   line for background() or popen().  Each element of argv (except the
00111  *   first) is surrounded by double quotes to insure the command line is
00112  *   unaltered when DCL rereads it.
00113  *
00114  * Side Effect:
00115  *   Space for the new string is allocated with xmalloc().
00116  *
00117  * Author:
00118  *   Roland B Roberts (roberts@nsrl.rochester.edu)
00119  *   March 1994
00120  */
00121
00122 char *argvconcat (int argc, char **argv)
00123 {
00124   int i, j, n, addquotes, flags, pid, status;
00125   char *cmdline;
00126   /*
00127    * Allocate space
00128    */
00129   for (j = n = 0; j < argc; j++)
00130     n += 3 + strlen(argv[j]);   /* Need 3 extra spaces, not 1; see below */
00131   cmdline = (char *) xmalloc ((n + 1) * sizeof (char));
00132   sprintf (cmdline, "%s ", argv[0]);
00133   for (j = 1, addquotes = FALSE; j < argc; j++) {
00134     /*
00135      * Add double quotes to arg if it contains uppercase of spaces.
00136      * Hence, the need to allocate three extra spaces for each argument.
00137      */
00138     for (i = 0; i < strlen(argv[j]); i++)
00139       if (isupper(argv[j][i]) || isspace(argv[j][i])) {
00140     addquotes = TRUE;
00141     break;
00142       }
00143     if (addquotes) {
00144       strcat (cmdline, argv[j]);
00145       strcat (cmdline, " ");
00146     }
00147     else {
00148       strcat (cmdline, "\"");   /* use quotes to preserve case */
00149       strcat (cmdline, argv[j]);
00150       strcat (cmdline, "\" ");
00151     }
00152   }
00153   cmdline[strlen(cmdline)-1] = 0;
00154   return (cmdline);
00155 }
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/misc.h Source File

cvs-1.10/vms/misc.h

Go to the documentation of this file.
00001 /*
00002  * Copyright © 1994 the Free Software Foundation, Inc.
00003  *
00004  * Author: Richard Levitte (levitte@e.kth.se)
00005  *
00006  * This file is a part of GNU VMSLIB, the GNU library for porting GNU
00007  * software to VMS.
00008  *
00009  * GNU VMSLIB is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * GNU VMSLIB is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  */
00019
00020 void x_free();
00021 /* This is a trick, because the linker wants uppercase symbols, and in
00022    that case, xfree is confused with Xfree, which is bad.  */
00023 #define xfree x_free
00024
00025 /*
00026  * Some string utilities.
00027  */
00028 char *downcase ();
00029 char *strndup ();
00030
00031 int fixpath ();
00032 char *argvconcat ();
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


getwd.c File Reference

cvs-1.10/vms/getwd.c File Reference

#include <unixlib.h>
#include "cvs.h"

Include dependency graph for getwd.c:

Include dependency graph

Go to the source code of this file.

Functions

char * xgetwd ()

Function Documentation

char* xgetwd ( )

Definition at line 18 of file getwd.c.

00019 {
00020     char pathname[256];
00021
00022     return xstrdup (getcwd (pathname, sizeof (pathname) - 2, 0));
00023 }

Generated on Sun Oct 21 12:43:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


misc.c File Reference

cvs-1.10/vms/misc.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <lib$routines.h>

Include dependency graph for misc.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | TRUE 1
#define | FALSE 0

Functions

void | x_free (void *block)
char * | downcase (char *s)
char * | strndup (char *src, int len)
int | fixpath (char *path)
char * | argvconcat (int argc, char **argv)

Define Documentation

#define FALSE 0

Definition at line 98 of file misc.c.

#define TRUE 1

Definition at line 97 of file misc.c.

Function Documentation

char* argvconcat | ( | int | argc,
 |  | char ** | argv
 | ) |

Definition at line 122 of file misc.c.

00123 {
00124   int i, j, n, addquotes, flags, pid, status;
00125   char *cmdline;
00126   /*
00127    * Allocate space
00128    */
00129   for (j = n = 0; j < argc; j++)
00130     n += 3 + strlen(argv[j]);   /* Need 3 extra spaces, not 1; see below */
00131   cmdline = (char *) xmalloc ((n + 1) * sizeof (char));
00132   sprintf (cmdline, "%s ", argv[0]);
00133   for (j = 1, addquotes = FALSE; j < argc; j++) {
00134     /*
00135      * Add double quotes to arg if it contains uppercase of spaces.
00136      * Hence, the need to allocate three extra spaces for each argument.
00137      */
00138     for (i = 0; i < strlen(argv[j]); i++)
00139       if (isupper(argv[j][i]) || isspace(argv[j][i])) {
00140     addquotes = TRUE;
00141     break;
00142       }
00143     if (addquotes) {
00144       strcat (cmdline, argv[j]);
00145       strcat (cmdline, " ");
00146     }
00147     else {
00148       strcat (cmdline, "\"");   /* use quotes to preserve case */
00149       strcat (cmdline, argv[j]);
00150       strcat (cmdline, "\" ");
00151     }
00152   }
00153   cmdline[strlen(cmdline)-1] = 0;
00154   return (cmdline);
00155 }

char* downcase ( char * s )

Definition at line 39 of file misc.c.

00040 {
00041   register char *t;
00042   for (t = s ; *t; t++)
00043     *t = tolower(*t);
00044   return (s);
00045 }

int fixpath ( char * path )

Definition at line 72 of file misc.c.

00073 {
00074   char *s, *d, *t;
00075   int skip = 0;
00076   d = s = path;
00077   if (t = strstr(path ,".][000000"))
00078     skip = 9;
00079   else if (t = strstr(path,"]["))
00080     skip = 2;
00081   else if (t = strstr(path,"[000000."))
00082     t++, skip = 7;
00083   if (t) {
00084     while (s < t)
00085       *d++ = *s++;
00086     s += skip;
00087     while (*d++ = *s++);
00088   }
00089   return 0;
00090 }

char* strndup | ( | char * | src,
 |  | int | len
 | ) |

Definition at line 47 of file misc.c.

00047                                    {
00048   char *dst = (char *) xmalloc (len + 1);
00049   strncpy (dst, src, len);
00050   dst[len] = 0;
00051   return (dst);
00052 }

void x_free ( void * block )

Definition at line 31 of file misc.c.

00032 {
00033   free (block);
00034 }

Generated on Sun Oct 21 12:43:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


misc.h File Reference

cvs-1.10/vms/misc.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | xfree x_free

Functions

void | x_free ()
char * | downcase ()
char * | strndup ()
int | fixpath ()
char * | argvconcat ()

Define Documentation

#define xfree x_free

Definition at line 23 of file misc.h.

Function Documentation

char* argvconcat ( )

char* downcase ( )

int fixpath ( )

char* strndup ( )

void x_free ( )

Generated on Sun Oct 21 12:43:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ndir.c File Reference

cvs-1.10/vms/ndir.c File Reference

#include <varargs.h>
#include <rms.h>
#include <descrip.h>
#include <string.h>
#include <errno.h>
#include <stat.h>
#include <lib$routines.h>
#include "ndir.h"
#include "filutils.h"
#include "misc.h"

Include dependency graph for ndir.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | VMS_DIR

Defines

#define | malloc xmalloc
#define | free xfree

Typedefs

typedef int | procedure
typedef char * | pointer

Functions

direct * vms_low_readdir ()
S_NAME * | opendir (infilename, filepattern) char *infilename
direct * | vms_low_readdir (dirp) register$S_NAME 80 *dirp

Variables

char * | filepattern

Define Documentation

#define free xfree

Definition at line 64 of file ndir.c.

#define malloc xmalloc

Definition at line 63 of file ndir.c.

Typedef Documentation

typedef char* pointer

Definition at line 44 of file ndir.c.

typedef int procedure

Definition at line 43 of file ndir.c.

Function Documentation

S_NAME* opendir | ( | infilename | ,
 |  | filepattern |
 | ) |

struct direct* vms_low_readdir ( dirp ) [static]

struct direct* vms_low_readdir ( ) [static]

Variable Documentation

char* filepattern

Definition at line 97 of file ndir.c.

Generated on Sun Oct 21 12:43:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/ndir.c Source File

cvs-1.10/vms/ndir.c

Go to the documentation of this file.
00001 /*
00002  * Copyright © 1994 the Free Software Foundation, Inc.
00003  *
00004  * Author: Richard Levitte (levitte@e.kth.se)
00005  *
00006  * This file is a part of GNU VMSLIB, the GNU library for porting GNU
00007  * software to VMS.
00008  *
00009  * GNU VMSLIB is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * GNU VMSLIB is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  */
00019
00020 #include <varargs.h>
00021 #include <rms.h>
00022 #include <descrip.h>
00023 #include <string.h>
00024 #include <errno.h>
00025
00026 #ifdef __GNUC__
00027 #include <sys/stat.h>
00028 #else
00029 #include <stat.h>
00030 #endif
00031 #include <lib$routines.h>
00032
00033 #include "ndir.h"
00034 #include "filutils.h"
00035
00036 /* The following was snarfed from lib-src/alloca.c in GNU Emacs,
00037    the hacked.  */
00038
00039 #if __STDC__
00040 typedef void procedure;
00041 typedef void *pointer;
00042 #else
00043 typedef int procedure;
00044 typedef char *pointer;
00045 #endif
00046
00047 /* Different portions of Emacs need to call different versions of
00048    malloc.  The Emacs executable needs alloca to call xmalloc, because
00049    ordinary malloc isn't protected from input signals.  On the other
00050    hand, the utilities in lib-src need alloca to call malloc; some of
00051    them are very simple, and don't have an xmalloc routine.
00052
00053    Non-Emacs programs expect this to call use xmalloc.
00054
00055    Callers below should use malloc.
00056
00057    There is some need for BLOCK_INPUT and UNBLOCK_INPUT, but it is really
00058    only used in Emacs, so that's the only time it's used.  Otherwise,
00059    they are just empty statements.  */
00060
00061 #ifndef emacs
00062 #include "misc.h"
00063 #define malloc xmalloc
00064 #define free xfree
00065 #endif
00066
00067 #if 0
00068 extern pointer malloc ();
00069 extern procedure free ();
00070 #endif
00071
00072 /* end of snarf.  */
00073
00074 #ifndef BLOCK_INPUT
00075 #define BLOCK_INPUT
00076 #endif
00077 #ifndef UNBLOCK_INPUT
00078 #define UNBLOCK_INPUT
00079 #endif
00080
00081 static struct direct *vms_low_readdir ();
00082
00083 typedef struct
00084 {
00085   DIR s_dir;
00086   unsigned long context;
00087   unsigned long uflags;
00088   struct dsc$descriptor_s dir_spec;
00089   struct dsc$descriptor_s file_spec;
00090   int version_flag;
00091   unsigned long status;
00092 } VMS_DIR;
00093
00094 DIR *
00095 opendir (infilename, filepattern)
00096      char *infilename;  /* name of directory */
00097      char *filepattern;
00098 {
00099   register VMS_DIR *dirp;   /* -> malloc'ed storage */
00100   register unsigned int length = 1024;
00101   register int fd;      /* file descriptor for read */
00102   char *filename;
00103   struct stat sbuf;     /* result of fstat */
00104
00105   filename = (char *) malloc(length+1);
00106   strcpy(filename, infilename);
00107
00108   strip_trailing_slashes (filename);
00109   if(strcmp(filename, ".") == 0)
00110      {
00111      getcwd(filename, length+1, 1); /* Get a VMS filespec */
00112      length = strlen(filename);
00113      }
00114
00115   BLOCK_INPUT;
00116   if ((filename[length-1] != ']'
00117        && filename[length-1] != '>'
00118        && filename[length-1] != ':'
00119        && (stat (filename, &sbuf) < 0
00120        || (sbuf.st_mode & S_IFMT) != S_IFDIR)))
00121     {
00122       errno = ENOTDIR;
00123       UNBLOCK_INPUT;
00124       free(filename);
00125       return 0;     /* bad luck today */
00126     }
00127
00128   if ((dirp = (VMS_DIR *) xmalloc (sizeof (VMS_DIR))) == 0)
00129     {
00130       errno = ENOMEM;
00131       UNBLOCK_INPUT;
00132       free(filename);
00133       return 0;     /* bad luck today */
00134     }
00135
00136   {
00137     int count;
00138     va_count(count);
00139     if (count == 2)
00140       {
00141     dirp->file_spec.dsc$a_pointer =
00142       (char *) xmalloc (strlen (filepattern) + 1);
00143     strcpy (dirp->file_spec.dsc$a_pointer, filepattern);
00144       }
00145     else
00146       {
00147     dirp->file_spec.dsc$a_pointer =
00148       (char *) xmalloc (4);
00149     strcpy (dirp->file_spec.dsc$a_pointer, "*.*");
00150       }
00151     dirp->file_spec.dsc$w_length = strlen (dirp->file_spec.dsc$a_pointer);
00152     dirp->file_spec.dsc$b_dtype = DSC$K_DTYPE_T;
00153     dirp->file_spec.dsc$b_class = DSC$K_CLASS_S;
00154     dirp->version_flag = strchr (dirp->file_spec.dsc$a_pointer, ';') != 0;
00155   }
00156   dirp->dir_spec.dsc$a_pointer = (char *) xmalloc (strlen (filename) + 10);
00157   UNBLOCK_INPUT;
00158   file_name_as_directory (dirp->dir_spec.dsc$a_pointer, filename);
00159   dirp->dir_spec.dsc$w_length = strlen (dirp->dir_spec.dsc$a_pointer);
00160   dirp->dir_spec.dsc$b_dtype = DSC$K_DTYPE_T;
00161   dirp->dir_spec.dsc$b_class = DSC$K_CLASS_S;
00162   dirp->context = 0;
00163   dirp->uflags = 2;
00164   dirp->s_dir.dd_fd = 0;
00165   dirp->s_dir.dd_loc = dirp->s_dir.dd_size = 0; /* refill needed */
00166
00167   free(filename);
00168
00169   /* In the cases where the filename ended with `]', `>' or `:',
00170      we never checked if it really was a directory, so let's do that
00171      now, by trying to read the first entry.  */
00172   if (vms_low_readdir ((DIR *) dirp) == (struct direct *) -1)
00173     {
00174       closedir (dirp);      /* was: xfree (dirp);  */
00175       errno = ENOENT;
00176       return 0;
00177     }
00178   dirp->s_dir.dd_loc = 0;   /* Make sure the entry just read is
00179                    reused at the next call to readdir.  */
00180
00181   return (DIR *) dirp;      /* I had to cast, for VMS sake.  */
00182 }
00183
00184 int
00185 closedir (dirp)
00186      register DIR *dirp;        /* stream from opendir */
00187 {
00188   {
00189     VMS_DIR *vms_dirp = (VMS_DIR *) dirp;
00190
00191     if (vms_dirp->context != 0)
00192       lib$find_file_end (&(vms_dirp->context));
00193     xfree (vms_dirp->dir_spec.dsc$a_pointer);
00194     xfree (vms_dirp->file_spec.dsc$a_pointer);
00195   }
00196
00197   xfree ((char *) dirp);
00198   return 0;
00199 }
00200
00201 struct direct dir_static;   /* simulated directory contents */
00202
00203 static struct direct *
00204 vms_low_readdir (dirp)
00205      register DIR *dirp;
00206 {
00207   static char rbuf[257];
00208   static struct dsc$descriptor_s rdsc =
00209     { sizeof (rbuf), DSC$K_DTYPE_T, DSC$K_CLASS_S, rbuf };
00210   VMS_DIR * vms_dirp = (VMS_DIR *) dirp;
00211
00212   if (dirp->dd_size == 0)
00213     {
00214       char *cp, *cp2;
00215       unsigned long status;
00216
00217       status = lib$find_file (&vms_dirp->file_spec, &rdsc, &vms_dirp->context,
00218                   &vms_dirp->dir_spec, 0, 0, &vms_dirp->uflags);
00219       vms_dirp->status = status;
00220       if (status == RMS$_NMF || status == RMS$_FNF)
00221     return 0;
00222       if (status != RMS$_NORMAL)
00223     return (struct direct *) -1;
00224
00225       rbuf [256] = '\0';
00226       if (cp = strchr (rbuf, ' '))
00227     *cp = '\0';
00228       if ((cp = strchr (rbuf, ';')) != 0
00229       && !vms_dirp->version_flag)
00230     *cp = '\0';
00231
00232       for (cp2 = rbuf - 1; cp2 != 0;)
00233     {
00234       char *cp2tmp = 0;
00235       cp = cp2 + 1;
00236       cp2 = strchr (cp, ']');
00237       if (cp2 != 0)
00238         cp2tmp = strchr (cp2 + 1, '>');
00239       if (cp2tmp != 0)
00240         cp2 = cp2tmp;
00241     }
00242
00243       /* Propagate names as lower case only,
00244          directories have ".dir" truncated,
00245          do not propagate null extensions "makefile." */
00246       {
00247       char *p, *q;
00248
00249       if(strcmp(cp, "CVS.DIR") == 0)
00250         strcpy(dirp->dd_buf, "CVS");
00251       else
00252         {
00253         for(p = cp, q = dirp->dd_buf; *p;)
00254            {
00255            if(strcmp(p, ".DIR") == 0)
00256               break;
00257            else
00258              *q++ = tolower(*p++);
00259            }
00260         *q = '\0';
00261         if(*(q-1) == '.')
00262           *(q-1) = '\0';
00263         }
00264      }
00265 #if 0
00266       strcpy (dirp->dd_buf, cp);
00267 #endif
00268
00269       dirp->dd_size = strlen (dirp->dd_buf);
00270       dirp->dd_loc = 0;
00271     }
00272
00273   if (vms_dirp->status != RMS$_NORMAL)
00274     return 0;
00275
00276   dir_static.d_ino = -1;    /* Couldn't care less...  */
00277   dir_static.d_namlen = strlen (dirp->dd_buf);
00278   dir_static.d_reclen = sizeof (struct direct)
00279     - MAXNAMLEN + 3
00280       + dir_static.d_namlen - dir_static.d_namlen % 4;
00281   strcpy (dir_static.d_name, dirp->dd_buf);
00282   dir_static.d_name[dir_static.d_namlen] = '\0';
00283   dirp->dd_loc = dirp->dd_size; /* only one record at a time */
00284
00285   return &dir_static;
00286 }
00287
00288 /* ARGUSED */
00289 struct direct *
00290 readdir (dirp)
00291      register DIR *dirp;    /* stream from opendir */
00292 {
00293   register struct direct *dp;
00294
00295   for (; ;)
00296     {
00297       if (dirp->dd_loc >= dirp->dd_size)
00298     dirp->dd_loc = dirp->dd_size = 0;
00299
00300       dp = vms_low_readdir (dirp);
00301       if (dp == 0 || dp == (struct direct *) -1)
00302     return 0;
00303       return dp;
00304     }
00305 }
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ndir.h File Reference

cvs-1.10/vms/ndir.h File Reference

#include <nam.h>

Include dependency graph for ndir.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | direct
struct | S_NAME

Defines

#define | DIR $S_NAME 80
#define | DIRBLKSIZ 512
#define | MAXNAMLEN 15
#define | rewinddir(dirp) seekdir( dirp, 0L )
#define | NDIR_H 1

Functions

S_NAME * opendir ()
direct * readdir ()
long | telldir ()
void | seekdir ()
int | closedir ()

Define Documentation

#define DIR $S_NAME 80

Definition at line 24 of file ndir.h.

#define DIRBLKSIZ 512

Definition at line 27 of file ndir.h.

#define MAXNAMLEN 15

Definition at line 32 of file ndir.h.

#define NDIR_H 1

Definition at line 62 of file ndir.h.

#define rewinddir ( dirp ) seekdir( dirp, 0L )

Definition at line 60 of file ndir.h.

Function Documentation

int closedir ( )

Referenced by FileTraverse(), dirdata(), and opendir().

S_NAME* opendir ( )

struct direct* readdir ( )

Referenced by FileTraverse(), and dirdata().

void seekdir ( )

long telldir ( )

Generated on Sun Oct 21 12:43:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/ndir.h Source File

cvs-1.10/vms/ndir.h

Go to the documentation of this file.
00001 /*
00002     <ndir.h> -- definitions for 4.2BSD-compatible directory access
00003
00004     28-dec-1994 Richard Levitte
00005     See ChangeLog for more recent modification history.
00006 */
00007
00008 #ifndef NDIR_H
00009
00010 #if 0
00011 #ifndef FAB$C_BID
00012 #include <fab.h>
00013 #endif
00014 #endif
00015 #ifndef NAM$C_BID
00016 #include <nam.h>
00017 #endif
00018 #if 0
00019 #ifndef RMS$_SUC
00020 #include <rmsdef.h>
00021 #endif
00022 #include <dir.h>
00023 #else
00024 #define DIR$S_NAME  80
00025 #endif
00026
00027 #define DIRBLKSIZ   512     /* size of directory block */
00028 #ifdef VMS
00029 #define MAXNAMLEN   (DIR$S_NAME + 7) /* 80 plus room for version #.  */
00030 #define MAXFULLSPEC NAM$C_MAXRSS /* Maximum full spec */
00031 #else
00032 #define MAXNAMLEN   15      /* maximum filename length */
00033 #endif /* VMS */
00034     /* NOTE:  MAXNAMLEN must be one less than a multiple of 4 */
00035
00036 struct direct               /* data from readdir() */
00037     {
00038     long        d_ino;      /* inode number of entry */
00039     unsigned short  d_reclen;   /* length of this record */
00040     unsigned short  d_namlen;   /* length of string in d_name */
00041     char        d_name[MAXNAMLEN+1];    /* name of file */
00042     };
00043
00044 typedef struct
00045     {
00046     int dd_fd;          /* file descriptor */
00047     int dd_loc;         /* offset in block */
00048     int dd_size;        /* amount of valid data */
00049     char    dd_buf[DIRBLKSIZ];  /* directory block */
00050     }   DIR;            /* stream data from opendir() */
00051
00052 extern DIR      *opendir();
00053 extern struct direct    *readdir();
00054 #ifndef VMS
00055 extern long     telldir();
00056 extern void     seekdir();
00057 #endif
00058 extern int      closedir();
00059
00060 #define rewinddir( dirp )   seekdir( dirp, 0L )
00061
00062 #define NDIR_H 1
00063 #endif /* ndir.h */
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


options.h File Reference

cvs-1.10/vms/options.h File Reference

#include "vms.h"

Include dependency graph for options.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | PATCH_PROGRAM "patch"
#define | TMPDIR_DFLT "sys$scratch"
#define | EDITOR_DFLT ""
#define | UMASK_DFLT 002
#define | RELATIVE_REPOS 1
#define | AUTH_CLIENT_SUPPORT 1
#define | NO_SOCKET_TO_FD 1

Functions

void | exit ()

Define Documentation

#define AUTH_CLIENT_SUPPORT 1

Definition at line 140 of file options.h.

#define EDITOR_DFLT ""

Definition at line 53 of file options.h.

#define NO_SOCKET_TO_FD 1

Definition at line 178 of file options.h.

#define PATCH_PROGRAM "patch"

Definition at line 34 of file options.h.

#define RELATIVE_REPOS 1

Definition at line 96 of file options.h.

#define TMPDIR_DFLT "sys$scratch"

Definition at line 42 of file options.h.

#define UMASK_DFLT 002

Definition at line 66 of file options.h.

Function Documentation

void exit ( )

Generated on Sun Oct 21 12:42:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/options.h Source File

cvs-1.10/vms/options.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS 1.4 kit.
00007  *
00008  * This file holds (most of) the configuration tweaks that can be made to
00009  * customize CVS for your site.  CVS comes configured for a typical SunOS 4.x
00010  * environment.  The comments for each configurable item are intended to be
00011  * self-explanatory.  All #defines are tested first to see if an over-riding
00012  * option was specified on the "make" command line.
00013  *
00014  * If special libraries are needed, you will have to edit the Makefile.in file
00015  * or the configure script directly.  Sorry.
00016  */
00017
00018 /*
00019  * For portability and heterogeneity reasons, CVS is shipped by default using
00020  * my own text-file version of the ndbm database library in the src/myndbm.c
00021  * file.  If you want better performance and are not concerned about
00022  * heterogeneous hosts accessing your modules file, turn this option off.
00023  */
00024 #ifndef MY_NDBM
00025 #define MY_NDBM
00026 #endif
00027
00028 /*
00029  * The "patch" program to run when using the CVS server and accepting
00030  * patches across the network.  Specify a full pathname if your site
00031  * wants to use a particular patch.
00032  */
00033 #ifndef PATCH_PROGRAM
00034 #define PATCH_PROGRAM   "patch"
00035 #endif
00036
00037 /* Directory used for storing temporary files, if not overridden by
00038    environment variables or the -T global option.  There should be little
00039    need to change this (-T is a better mechanism if you need to use a
00040    different directory for temporary files).  */
00041 #ifndef TMPDIR_DFLT
00042 #define TMPDIR_DFLT "sys$scratch"
00043 #endif
00044
00045 /*
00046  * The default editor to use, if one does not specify the "-e" option to cvs,
00047  * or does not have an EDITOR environment variable.  I set this to just "vi",
00048  * and use the shell to find where "vi" actually is.  This allows sites with
00049  * /usr/bin/vi or /usr/ucb/vi to work equally well (assuming that your PATH
00050  * is reasonable).
00051  */
00052 #ifndef EDITOR_DFLT
00053 #define EDITOR_DFLT ""
00054 #endif
00055
00056 /*
00057  * The default umask to use when creating or otherwise setting file or
00058  * directory permissions in the repository.  Must be a value in the
00059  * range of 0 through 0777.  For example, a value of 002 allows group
00060  * rwx access and world rx access; a value of 007 allows group rwx
00061  * access but no world access.  This value is overridden by the value
00062  * of the CVSUMASK environment variable, which is interpreted as an
00063  * octal number.
00064  */
00065 #ifndef UMASK_DFLT
00066 #define UMASK_DFLT  002
00067 #endif
00068
00069 /*
00070  * The cvs admin command is restricted to the members of the group
00071  * CVS_ADMIN_GROUP.  If this group does not exist, all users are
00072  * allowed to run cvs admin.  To disable the cvs admin for all users,
00073  * create an empty group CVS_ADMIN_GROUP.  To disable access control for
00074  * cvs admin, comment out the define below.
00075  */
00076 #ifndef CVS_ADMIN_GROUP
00077 /* #define CVS_ADMIN_GROUP "cvsadmin" */
00078 #endif
00079
00080 /*
00081  * The Repository file holds the path to the directory within the
00082  * source repository that contains the RCS ,v files for each CVS
00083  * working directory.  This path is either a full-path or a path
00084  * relative to CVSROOT.
00085  *
00086  * The big advantage that I can see to having a relative path is that
00087  * one can change the physical location of the master source
00088  * repository, change the contents of CVS/Root files in your
00089  * checked-out code, and CVS will work without problems.
00090  *
00091  * Therefore, RELATIVE_REPOS is now the default.  In the future, this
00092  * is likely to disappear entirely as a compile-time (or other) option,
00093  * so if you have other software which relies on absolute pathnames,
00094  * update them.
00095  */
00096 #define RELATIVE_REPOS 1
00097
00098 /*
00099  * When committing or importing files, you must enter a log message.
00100  * Normally, you can do this either via the -m flag on the command line or an
00101  * editor will be started for you.  If you like to use logging templates (the
00102  * rcsinfo file within the $CVSROOT/CVSROOT directory), you might want to
00103  * force people to use the editor even if they specify a message with -m.
00104  * Enabling FORCE_USE_EDITOR will cause the -m message to be appended to the
00105  * temp file when the editor is started.
00106  */
00107 #ifndef FORCE_USE_EDITOR
00108 /* #define  FORCE_USE_EDITOR */
00109 #endif
00110
00111 /*
00112  * When locking the repository, some sites like to remove locks and assume
00113  * the program that created them went away if the lock has existed for a long
00114  * time.  This used to be the default for previous versions of CVS.  CVS now
00115  * attempts to be much more robust, so lock files should not be left around
00116  * by mistake. The new behaviour will never remove old locks (they must now
00117  * be removed by hand).  Enabling CVS_FUDGELOCKS will cause CVS to remove
00118  * locks that are older than CVSLCKAGE seconds.
00119  * Use of this option is NOT recommended.
00120  */
00121 #ifndef CVS_FUDGELOCKS
00122 /* #define CVS_FUDGELOCKS */
00123 #endif
00124
00125 /* There is some pretty unixy code in src/commit.c which tries to
00126    prevent people from commiting changes as "root" (which would prevent
00127    CVS from making a log entry with the actual user).  On VMS, I suppose
00128    one could say that SYSTEM is equivalent, but I would think that it
00129    actually is not necessary; at least at the VMS sites I've worked at
00130    people just used their own accounts (turning privileges on and off
00131    as desired).  */
00132
00133 #ifndef CVS_BADROOT
00134 /* #define  CVS_BADROOT */
00135 #endif
00136
00137 /*
00138  * Yes, we can do the authenticated client.
00139  */
00140 #define AUTH_CLIENT_SUPPORT 1
00141
00142 /*
00143  * define this to enable the SETXID support.  Probably has no effect on VMS.
00144  */
00145 #ifndef SETXID_SUPPORT
00146 /* #define SETXID_SUPPORT */
00147 #endif
00148
00149 /*
00150  * If you are working with a large remote repository and a 'cvs checkout' is
00151  * swamping your network and memory, define these to enable flow control.
00152  * You will end up with even less guarantees of a consistant checkout,
00153  * but that may be better than no checkout at all.  The master server process
00154  * will monitor how far it is getting behind, if it reaches the high water
00155  * mark, it will signal the child process to stop generating data when
00156  * convenient (ie: no locks are held, currently at the beginning of a
00157  * new directory).  Once the buffer has drained sufficiently to reach the
00158  * low water mark, it will be signalled to start again.
00159  * -- EXPERIMENTAL! --  A better solution may be in the works.
00160  * You may override the default hi/low watermarks here too.
00161  */
00162 #ifndef SERVER_FLOWCONTROL
00163 /* #define SERVER_FLOWCONTROL */
00164 /* #define SERVER_HI_WATER (2 * 1024 * 1024) */
00165 /* #define SERVER_LO_WATER (1 * 1024 * 1024) */
00166 #endif
00167
00168 /* End of CVS configuration section */
00169
00170 /*
00171  * Externs that are included in libc, but are used frequently enough to
00172  * warrant defining here.
00173  */
00174 #ifndef STDC_HEADERS
00175 extern void exit ();
00176 #endif
00177
00178 #define NO_SOCKET_TO_FD 1
00179 #include "vms.h"
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/pathnames.h Source File

cvs-1.10/vms/pathnames.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1989 The Regents of the University of California.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. All advertising materials mentioning features or use of this software
00014  *    must display the following acknowledgement:
00015  *  This product includes software developed by the University of
00016  *  California, Berkeley and its contributors.
00017  * 4. Neither the name of the University nor the names of its contributors
00018  *    may be used to endorse or promote products derived from this software
00019  *    without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00022  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00024  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00025  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00026  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00027  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00028  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00029  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00030  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  *  from: @(#)pathnames.h   5.2 (Berkeley) 4/9/90
00034  *  $Id: pathnames.h,v 1.1 1996/02/28 08:49:08 benjamin Exp $
00035  */
00036
00037 #define _PATH_RLOGIN    "/usr/bin/rlogin"
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/pc.c Source File

cvs-1.10/vms/pc.c

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <unixio.h>
00003 #include <stdlib.h>
00004 #include <string.h>
00005
00006 int trace = 1;
00007
00008 extern int piped_child();
00009 extern int piped_child_shutdown();
00010
00011 main (argc, argv)
00012   int argc;
00013   char ** argv;
00014 {
00015   static char line[512];
00016   char *linep[] = {line, NULL};
00017   int pid;
00018   int tofd, fromfd;
00019   FILE *in, *out;
00020
00021   while (1)
00022     {
00023     printf("\nEnter a command to run: ");
00024     line[0] = '\0';
00025     fgets(line, 511, stdin);
00026     if (!strlen(line))
00027        exit(2);
00028
00029     line[strlen(line)-1] = '\0';
00030     pid = piped_child(linep, &tofd, &fromfd);
00031
00032     in = fdopen(fromfd, "r");
00033     out = fdopen(tofd, "w");
00034
00035 #if 0
00036     out = fdopen(tofd, "w");
00037     fclose(out);
00038 #endif
00039
00040     do
00041        {
00042        if(!feof(stdin))
00043          {
00044          fprintf(stdout, "> ");
00045          fgets(line, 511, stdin);
00046          fputs(line, out);
00047          }
00048        else
00049          {
00050          fclose(out);
00051          close(tofd);
00052          }
00053
00054        fgets(line, 511, in);
00055        fputs(line, stdout);
00056        line[0] = '\0';
00057        } while (!feof(in));
00058
00059     fprintf(stderr, "waiting for child to stop\n");
00060     piped_child_shutdown(pid);
00061     }
00062 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/pipe.c Source File

cvs-1.10/vms/pipe.c

Go to the documentation of this file.
00001 /*
00002  * Copyright © 1994 the Free Software Foundation, Inc.
00003  *
00004  * Author: Roland B. Roberts (roberts@nsrl.rochester.edu)
00005  *
00006  * This file is a part of GNU VMSLIB, the GNU library for porting GNU
00007  * software to VMS.
00008  *
00009  * GNU VMSLIB is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * GNU VMSLIB is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  */
00019
00020 /*
00021  * Modification History
00022  * 13 Sep 94 - RBR
00023  *    Use event flag one -- zero seems to cause sys$synch to hang.
00024  * 12 Sep 94 - RBR
00025  *    All pipes now use event flag zero.
00026  *    Removed the limit on the number of pipes.
00027  *    Added members to PIPE structure and memory corruption tests.
00028  */
00029
00030 /* This won't work with GCC, but it won't cause any problems either.  */
00031 #define MODULE  PIPE
00032 #define VERSION "V1.5"
00033
00034 #ifdef __DECC
00035 #pragma module MODULE VERSION
00036 #else
00037 #ifdef VAXC
00038 #module MODULE VERSION
00039 #endif
00040 #endif
00041
00042 #include <stdio.h>
00043 #include <stdlib.h>
00044 #include <string.h>
00045 #include <iodef.h>
00046 #include <ssdef.h>
00047 #include <syidef.h>
00048 #include <clidef.h>
00049 #include <stsdef.h>
00050 #include <dvidef.h>
00051 #include <nam.h>
00052 #include <descrip.h>
00053 #include <errno.h>
00054 #include <file.h>
00055 #include <lib$routines.h>
00056 #include <starlet.h>
00057 #include <setjmp.h>
00058 #include "vms-types.h"
00059
00060 /* A linked list of pipes, for internal use only */
00061 struct PIPE
00062 {
00063   struct PIPE *next;            /* next pipe in the chain */
00064   struct PIPE *prev;            /* previous pipe in the chain */
00065   struct PIPE *self;            /* self reference */
00066   int mode;                     /* pipe I/O mode (read or write) */
00067   long status;                  /* subprocess completion status */
00068   struct IOSB iosb;             /* pipe I/O status block */
00069   FILE *file;                   /* pipe file structure */
00070   int pid;                      /* pipe process id */
00071   short chan;                   /* pipe channel */
00072   jmp_buf jmpbuf;       /* jump buffer, if needed */
00073   int has_jmpbuf;       /* flag */
00074 };
00075
00076 /* Head of the pipe chain */
00077 static struct PIPE *phead = NULL, *ptail = NULL;
00078
00079 static unsigned char evf = 1;
00080
00081 /*
00082  * Exit handler for current process, established by popen().
00083  * Force the current process to wait for the completion of children
00084  *   which were started via popen().
00085  * Since
00086  */
00087 static int
00088 pwait (status)
00089   int status;
00090 {
00091   struct IOSB iosb;
00092   struct PIPE *this;
00093   int ret = 0;
00094
00095   this = phead;
00096   while (this)
00097     {
00098       if (this->self != this)
00099         {
00100       ret = -1;
00101       continue;
00102     }
00103       if (!this->iosb.status)
00104     {
00105       fflush (this->file);
00106       if (this->mode == O_WRONLY)
00107         sys$qio (0, this->chan, IO$_WRITEOF, &iosb,
00108              0, 0, 0, 0, 0, 0, 0, 0);
00109       fclose (this->file);
00110       sys$synch (evf, &this->iosb);
00111     }
00112       else
00113     fclose(this->file);
00114       sys$dassgn (this->chan);
00115       this = this->next;
00116     }
00117   return ret;
00118 }
00119
00120 /*
00121  * Close a "pipe" created by popen()
00122  * Return codes
00123  * >0  VMS exit status of process
00124  *  0  success, pipe was closed
00125  * -1  stream not found in list of pipes
00126  * -2  memory corruption detected
00127  */
00128 int
00129 pclose (stream)
00130   FILE *stream;
00131 {
00132   struct IOSB iosb;
00133   struct PIPE *this = phead;
00134
00135   while (this && this->self == this && this->file != stream)
00136     this = this->next;
00137
00138   /* Pipe not found or failed sanity check */
00139   if (!this)
00140     return -1;
00141   else if (this->self != this)
00142     return -2;
00143
00144   /* Flush the I/O buffer and wait for the close to complete */
00145   if (!this->iosb.status)
00146     {
00147       fflush (this->file);
00148       if (this->mode == O_WRONLY)
00149     sys$qio (0, this->chan, IO$_WRITEOF, &iosb,
00150          0, 0, 0, 0, 0, 0, 0, 0);
00151       fclose (this->file);
00152       sys$synch (evf, &this->iosb);
00153     }
00154   else
00155     fclose (this->file);
00156   sys$dassgn (this->chan);
00157
00158   /* Remove `this' from the list of pipes and free its storage */
00159   if (this == ptail)
00160     ptail = this->prev;
00161   if (this == phead)
00162     phead = this->next;
00163   if (this->prev)
00164     this->prev->next = this->next;
00165   if (this->next)
00166     this->next->prev = this->prev;
00167   free (this);
00168
00169   if (this->status & STS$M_SUCCESS != STS$M_SUCCESS)
00170     return this->status;
00171   else
00172     return 0;
00173 }
00174
00175 /*
00176  * Subprocess AST completion routine
00177  * Indicate successful completion in the iosb and clear the pid.
00178  * Note that the channel is *not* deassigned and the file is
00179  *   *not* closed.
00180  */
00181 void
00182 pdone (this)
00183   struct PIPE *this;
00184 {
00185   struct IOSB iosb;
00186
00187   if (this->self != this)
00188     return;
00189   this->iosb.status = 1;
00190   this->pid  = 0;
00191   if (this->has_jmpbuf)
00192     {
00193       this->has_jmpbuf = 0;
00194       longjmp (this->jmpbuf, 1);
00195     }
00196 }
00197
00198 int
00199 pipe_set_fd_jmpbuf (fd, jmpbuf)
00200      int fd;
00201      jmp_buf jmpbuf;
00202 {
00203   struct PIPE *this = phead;
00204
00205   while (this)
00206     if (fileno (this->file) == fd)
00207       {
00208     memcpy (this->jmpbuf, jmpbuf, sizeof (jmp_buf));
00209     this->has_jmpbuf = 1;
00210     if (this->pid == 0)
00211       {
00212         this->has_jmpbuf = 0;
00213         longjmp (this->jmpbuf, 1);
00214       }
00215     return 0;
00216       }
00217     else
00218       this = this->next;
00219   return 1;
00220 }
00221
00222 pipe_unset_fd_jmpbuf (fd)
00223      int fd;
00224 {
00225   struct PIPE *this = phead;
00226
00227   while (this)
00228     if (fileno (this->file) == fd)
00229       {
00230     this->has_jmpbuf = 0;
00231     return 0;
00232       }
00233     else
00234       this = this->next;
00235   return 1;
00236 }
00237
00238 /* Exit handler control block for the current process. */
00239 static struct EXHCB pexhcb = { 0, pwait, 1, &pexhcb.exh$l_status, 0 };
00240
00241 struct Vstring
00242 {
00243   short length;
00244   char body[NAM$C_MAXRSS+1];
00245 };
00246
00247 /*
00248  * Emulate a unix popen() call using lib$spawn
00249  *
00250  * if mode == "w", lib$spawn uses the mailbox for sys$input
00251  * if mode == "r", lib$spawn uses the mailbox for sys$output
00252  *
00253  * Don't now how to handle both read and write
00254  *
00255  * Returns
00256  *   FILE *  file pointer to the pipe
00257  *   NULL    indicates an error ocurred, check errno value
00258  */
00259 FILE *
00260 popen (cmd, mode)
00261   const char *cmd;
00262   const char *mode;
00263 {
00264   int i, status, flags, mbxsize;
00265   struct IOSB iosb;
00266   struct dsc$descriptor_s cmddsc, mbxdsc;
00267   struct Vstring mbxname = { sizeof(mbxname.body) };
00268   struct itm$list3 mbxlist[2] = {
00269     { sizeof(mbxname.body)-1, DVI$_DEVNAM, &mbxname.body, &mbxname.length },
00270     { 0, 0, 0, 0} };
00271   struct itm$list3 syilist[2] = {
00272     { sizeof(mbxsize), SYI$_MAXBUF, &mbxsize, (void *) 0 },
00273     { 0, 0, 0, 0} };
00274   static int noExitHandler = 1;
00275   struct PIPE *this;
00276
00277   /* First allocate space for the new pipe */
00278   this = (struct PIPE *) calloc (1, sizeof(struct PIPE));
00279   if (!this)
00280     {
00281       errno = ENOMEM;
00282       return NULL;
00283     }
00284
00285   /* Sanity check value */
00286   this->self = this;
00287
00288   /* Use the smaller of SYI$_MAXBUF and 2048 for the mailbox size */
00289   status = sys$getsyiw(0, 0, 0, syilist, &iosb, 0, 0, 0);
00290   if (status != SS$_NORMAL && !(iosb.status & STS$M_SUCCESS))
00291     {
00292       vaxc$errno = iosb.status;
00293       errno = EVMSERR;
00294       free (this);
00295       perror ("popen, $GETSYIW failure for SYI$_MAXBUF");
00296       return NULL;
00297     }
00298
00299   if (mbxsize > 2048)
00300     mbxsize = 2048;
00301
00302   status = sys$crembx (0, &this->chan, mbxsize, mbxsize, 0, 0, 0, 0);
00303   if (status != SS$_NORMAL)
00304     {
00305       vaxc$errno = status;
00306       errno = EVMSERR;
00307       free (this);
00308       perror ("popen, $CREMBX failure");
00309       return NULL;
00310     }
00311
00312   /* Retrieve mailbox name, use for fopen */
00313   status = sys$getdviw (0, this->chan, 0, &mbxlist, &iosb, 0, 0, 0);
00314   if (status != SS$_NORMAL && !(iosb.status & STS$M_SUCCESS))
00315     {
00316       vaxc$errno = iosb.status;
00317       errno = EVMSERR;
00318       sys$dassgn (this->chan);
00319       free (this);
00320       perror ("popen, $GETDVIW failure");
00321       return NULL;
00322     }
00323
00324   /* Spawn the command using the mailbox as the name for sys$input */
00325   mbxname.body[mbxname.length] = 0;
00326   mbxdsc.dsc$w_length  = mbxname.length;
00327   mbxdsc.dsc$b_dtype   = DSC$K_DTYPE_T;
00328   mbxdsc.dsc$b_class   = DSC$K_CLASS_S;
00329   mbxdsc.dsc$a_pointer = mbxname.body;
00330
00331   cmddsc.dsc$w_length  = strlen(cmd);
00332   cmddsc.dsc$b_dtype   = DSC$K_DTYPE_T;
00333   cmddsc.dsc$b_class   = DSC$K_CLASS_S;
00334   cmddsc.dsc$a_pointer = (char *)cmd;
00335   flags = CLI$M_NOWAIT;
00336   if (strcmp(mode,"w") == 0)
00337     {
00338       status = lib$spawn (&cmddsc, &mbxdsc, 0, &flags, 0, &this->pid,
00339                           &this->status, &evf, &pdone, this->self);
00340       this->mode = O_WRONLY;
00341     }
00342   else
00343     {
00344       status = lib$spawn (&cmddsc, 0, &mbxdsc, &flags, 0, &this->pid,
00345                           &this->status, &evf, &pdone, this->self);
00346       this->mode = O_RDONLY;
00347     }
00348   if (status != SS$_NORMAL)
00349     {
00350       vaxc$errno = status;
00351       errno = EVMSERR;
00352       sys$dassgn (this->chan);
00353       free (this);
00354       perror("popen, LIB$SPAWN failure");
00355       return NULL;
00356     }
00357
00358   /* Set up an exit handler so the subprocess isn't prematurely killed */
00359   if (noExitHandler)
00360     {
00361       status = sys$dclexh (&pexhcb);
00362       if (status != SS$_NORMAL)
00363         {
00364           vaxc$errno = status;
00365           errno = EVMSERR;
00366           sys$dassgn (this->chan);
00367           sys$delprc (&this->pid, 0);
00368           free (this);
00369           perror("popen, $DCLEXH failure");
00370           return NULL;
00371         }
00372       noExitHandler = 0;
00373     }
00374
00375   /* Pipes are always binary mode devices */
00376   if (this->mode == O_WRONLY)
00377     this->file = fopen (mbxname.body, "wb");
00378   else
00379     this->file = fopen (mbxname.body, "rb");
00380
00381   /* Paranoia, check for failure again */
00382   if (!this->file)
00383     {
00384       sys$dassgn (this->chan);
00385       sys$delprc (this->pid);
00386       free (this);
00387       perror ("popen, fopen failure");
00388       return NULL;
00389     }
00390
00391   this->has_jmpbuf = 0;
00392
00393   /* Insert the new pipe into the list of open pipes */
00394   if (phead)
00395     {
00396       ptail->next = this;
00397       this->prev = ptail;
00398       ptail = this;
00399     }
00400   else
00401     phead = ptail = this;
00402
00403   return (this->file);
00404 }
00405
00406
00407 #ifdef TEST_PIPE
00408 int
00409 main (argc, argv)
00410   int argc;
00411   char **argv;
00412 {
00413   FILE *stdpipe;
00414   char line[512];
00415
00416   while (1)
00417     {
00418       printf ("\nEnter a command to run >> ");
00419       fgets (line, 511, stdin);
00420       if (!strlen(line))
00421         exit (1);
00422       line[strlen(line)-1] = 0;
00423       stdpipe = popen (line, "r");
00424       if (!stdpipe)
00425         {
00426           fprintf (stderr, "popen failed.\n");
00427           exit(44);
00428         }
00429       do {
00430           fgets (line, 511, stdpipe);
00431           fputs (line, stdout);
00432         } while (!feof(stdpipe));
00433       pclose (stdpipe);
00434     }
00435 }
00436 #endif
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/pipe.h Source File

cvs-1.10/vms/pipe.h

Go to the documentation of this file.
00001 /*
00002  * Copyright © 1994 the Free Software Foundation, Inc.
00003  *
00004  * Author: Richard Levitte (levitte@e.kth.se)
00005  *
00006  * This file is a part of GNU VMSLIB, the GNU library for porting GNU
00007  * software to VMS.
00008  *
00009  * GNU VMSLIB is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * GNU VMSLIB is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  */
00019
00020 #include <stdio.h>
00021
00022 int pclose (FILE *);
00023 FILE *popen (const char *, const char *);
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/piped_child.c Source File

cvs-1.10/vms/piped_child.c

Go to the documentation of this file.
00001 /*
00002  * piped_child.c
00003  *
00004  * An experimental VMS implementation of the same routine in [-.src]run.c
00005  * <benjamin@cyclic.com>
00006  *
00007  * Derived in part from pipe.c, in this directory.
00008  */
00009
00010 #include "vms.h"
00011 #include "vms-types.h"
00012
00013 #include <stdio.h>
00014 #include <stdlib.h>
00015 #include <string.h>
00016 #include <iodef.h>
00017 #include <ssdef.h>
00018 #include <syidef.h>
00019 #include <clidef.h>
00020 #include <stsdef.h>
00021 #include <dvidef.h>
00022 #include <nam.h>
00023 #include <descrip.h>
00024 #include <errno.h>
00025 #include <file.h>
00026 #include <lib$routines.h>
00027 #include <starlet.h>
00028
00029 extern int trace;
00030
00031 /* Subprocess IO structure */
00032 typedef struct _SUBIO {
00033   struct _SUBIO *self;
00034   struct _SUBIO *prev;
00035   struct _SUBIO *next;
00036   short read_chan;
00037   short write_chan;
00038   FILE *read_fp;
00039   FILE *write_fp;
00040   struct IOSB read_iosb;
00041   struct IOSB write_iosb;
00042   int pid;
00043   int return_status;
00044   unsigned long event_flag;
00045   unsigned char event_flag_byte;
00046 } SUBIO;
00047
00048 static SUBIO *siop_head = NULL, *siop_tail = NULL;
00049
00050 static int piped_child_exith(int);
00051
00052 static struct EXHCB piped_child_exit_handler_block =
00053   {0, piped_child_exith, 1, &piped_child_exit_handler_block.exh$l_status, 0};
00054
00055 typedef struct
00056 {
00057   short length;
00058   char body[NAM$C_MAXRSS+1];
00059 } Vstring;
00060
00061 /* Subprocess Completion AST */
00062 void piped_child_done(siop)
00063   SUBIO *siop;
00064 {
00065   struct IOSB iosb;
00066   int status;
00067
00068   if (siop->self != siop)
00069      return;
00070   siop->read_iosb.status = SS$_NORMAL;
00071   siop->write_iosb.status = SS$_NORMAL;
00072
00073 }
00074
00075 /* Exit handler, established by piped_child() */
00076 static int
00077 piped_child_exith(status)
00078   int status;
00079 {
00080   struct IOSB iosb;
00081   SUBIO *siop;
00082   int return_value = 0;
00083
00084   siop = siop_head;
00085   while (siop)
00086     {
00087     if (siop->self != siop)
00088       {
00089         return_value = -1;
00090     continue;
00091       }
00092
00093     /* Finish pending reads and shutdown */
00094     if(!siop->read_iosb.status)
00095       {
00096         fflush (siop->read_fp);
00097     fclose (siop->read_fp);
00098       }
00099     else
00100       fclose (siop->read_fp);
00101     sys$dassgn (siop->read_chan);
00102
00103     /* Finish pending writes and shutdown */
00104     if(!siop->write_iosb.status)
00105       {
00106         fflush (siop->write_fp);
00107     sys$qio (0, siop->write_chan, IO$_WRITEOF, &iosb,
00108              0, 0, 0, 0, 0, 0, 0, 0);
00109     fclose (siop->write_fp);
00110       }
00111     else
00112       fclose (siop->write_fp);
00113     sys$dassgn (siop->write_chan);
00114
00115     sys$synch (siop->event_flag, &siop->write_iosb);
00116
00117     siop = siop->next;
00118     }
00119   return return_value;
00120 }
00121
00122 int piped_child(command, tofdp, fromfdp)
00123 char **command;
00124 int *tofdp, *fromfdp;
00125 {
00126   static int exit_handler = 0;
00127   struct IOSB iosb1, iosb2;
00128   int rs1, rs2, i;
00129   unsigned long flags, vmspid, return_status;
00130   char cmd[1024];
00131   struct dsc$descriptor_s cmddsc;
00132   struct dsc$descriptor_s read_mbxdsc, write_mbxdsc;
00133   SUBIO *siop;
00134   static Vstring read_mbxname, write_mbxname;
00135   static struct itm$list3 write_mbxlist[2] = {
00136       {sizeof(write_mbxname.body)-1, DVI$_DEVNAM,
00137       &write_mbxname.body, (size_t *) &write_mbxname.length},
00138       {0, 0, 0, 0} };
00139   static struct itm$list3 read_mbxlist[2] = {
00140       {sizeof(read_mbxname.body)-1, DVI$_DEVNAM,
00141       &read_mbxname.body, (size_t *) &read_mbxname.length},
00142       {0, 0, 0, 0} };
00143
00144   read_mbxname.length = sizeof(read_mbxname.body);
00145   write_mbxname.length = sizeof(write_mbxname.body);
00146
00147   siop = (SUBIO *) calloc(1, sizeof(SUBIO));
00148   if (!siop)
00149     {
00150     perror("piped_child: malloc failed\n");
00151     return -1;
00152     }
00153
00154   siop->self = siop;
00155
00156   /* Construct command line by concatenating argument list */
00157   strcpy(cmd, command[0]);
00158   for(i=1; command[i] != NULL; i++)
00159      {
00160      strcat(cmd, " ");
00161      strcat(cmd, command[i]);
00162      }
00163
00164   if(trace)
00165     fprintf(stderr, "piped_child: running '%s'\n", cmd);
00166
00167   /* Allocate a pair of temporary mailboxes (2kB each) */
00168   rs1 = sys$crembx (0, &siop->read_chan, 2048, 2048, 0, 0, 0, 0);
00169   rs2 = sys$crembx (0, &siop->write_chan, 2048, 2048, 0, 0, 0, 0);
00170
00171   if (rs1 != SS$_NORMAL || rs2 != SS$_NORMAL)
00172     {
00173       vaxc$errno = rs1 | rs2;
00174       errno = EVMSERR;
00175       free (siop);
00176       perror ("piped_child: $CREMBX failure");
00177       return -1;
00178     }
00179
00180   /* Get mailbox names, so we can fopen() them */
00181   rs1 = sys$getdviw (0, siop->read_chan, 0, &read_mbxlist,
00182                     &iosb1, 0, 0, 0);
00183
00184   rs2 = sys$getdviw (0, siop->write_chan, 0, &write_mbxlist,
00185                     &iosb2, 0, 0, 0);
00186
00187   if ((rs1 != SS$_NORMAL && !(iosb1.status & STS$M_SUCCESS)) ||
00188       (rs2 != SS$_NORMAL && !(iosb2.status & STS$M_SUCCESS)))
00189     {
00190       vaxc$errno = iosb1.status | iosb2.status;
00191       errno = EVMSERR;
00192       sys$dassgn (siop->read_chan);
00193       sys$dassgn (siop->write_chan);
00194       free (siop);
00195       perror ("piped_child: $GETDVIW failure, could not get mailbox names");
00196       return -1;
00197     }
00198
00199   if (trace)
00200     {
00201     fprintf(stderr, "piped_child: $GETDVIW succeeded, got mailbox names\n");
00202     fprintf(stderr, "piped_child: ReadMBX: %s, WriteMBX: %s\n",
00203             read_mbxname.body, write_mbxname.body);
00204     }
00205
00206   /* Make C happy */
00207   write_mbxname.body[write_mbxname.length] = '\0';
00208   read_mbxname.body[read_mbxname.length] = '\0';
00209
00210   /* Make VMS happy */
00211   write_mbxdsc.dsc$w_length  = write_mbxname.length;
00212   write_mbxdsc.dsc$b_dtype   = DSC$K_DTYPE_T;
00213   write_mbxdsc.dsc$b_class   = DSC$K_CLASS_S;
00214   write_mbxdsc.dsc$a_pointer = write_mbxname.body;
00215
00216   read_mbxdsc.dsc$w_length  = read_mbxname.length;
00217   read_mbxdsc.dsc$b_dtype   = DSC$K_DTYPE_T;
00218   read_mbxdsc.dsc$b_class   = DSC$K_CLASS_S;
00219   read_mbxdsc.dsc$a_pointer = read_mbxname.body;
00220
00221   /* Build descriptor for command line */
00222   cmddsc.dsc$w_length  = strlen(cmd);
00223   cmddsc.dsc$b_dtype   = DSC$K_DTYPE_T;
00224   cmddsc.dsc$b_class   = DSC$K_CLASS_S;
00225   cmddsc.dsc$a_pointer = (char *) cmd;
00226
00227   flags = CLI$M_NOWAIT;
00228
00229   /* Allocate an event flag to signal process termination */
00230   rs1 = lib$get_ef(&siop->event_flag);
00231   if (rs1 != SS$_NORMAL)
00232      {
00233      vaxc$errno = rs1;
00234      errno = EVMSERR;
00235      sys$dassgn(siop->read_chan);
00236      sys$dassgn(siop->write_chan);
00237      perror("piped_child: LIB$GET_EF failed");
00238      return -1;
00239      }
00240
00241   /* Save the EFN as a byte for later calls to other routines */
00242   siop->event_flag_byte = 0xff & siop->event_flag;
00243
00244   if (trace)
00245      fprintf(stderr, "piped_child: Got an EFN: %d\n", siop->event_flag_byte);
00246
00247   rs1 = lib$spawn(&cmddsc, &write_mbxdsc, &read_mbxdsc, &flags, 0,
00248                   &siop->pid, &siop->return_status, &siop->event_flag_byte,
00249                   &piped_child_done, siop->self);
00250
00251   if (rs1 != SS$_NORMAL)
00252      {
00253        vaxc$errno = rs1;
00254        errno = EVMSERR;
00255        sys$dassgn(siop->read_chan);
00256        sys$dassgn(siop->write_chan);
00257        perror("piped_child: LIB$SPAWN failure");
00258        return -1;
00259      }
00260
00261   if (trace)
00262     fprintf(stderr, "piped_child: LIB$SPAWN succeeded, pid is %08x.\n",
00263             siop->pid);
00264
00265   /* Establish an exit handler so the process isn't prematurely terminated */
00266   if (!exit_handler)
00267     {
00268       rs1 = sys$dclexh (&piped_child_exit_handler_block);
00269       if (rs1 != SS$_NORMAL)
00270         {
00271       vaxc$errno = rs1;
00272       errno = EVMSERR;
00273       sys$dassgn (siop->read_chan);
00274       sys$dassgn (siop->write_chan);
00275       sys$delprc (siop->pid, 0);
00276       free (siop);
00277       perror("piped_child: $DCLEXH failure");
00278       return -1;
00279     }
00280       exit_handler = 1;
00281     }
00282
00283   /* Let's open some files */
00284   siop->read_fp = fopen (read_mbxname.body, "r");
00285   siop->write_fp = fopen (write_mbxname.body, "w");
00286
00287   if (!siop->read_fp || !siop->write_fp)
00288     {
00289       sys$dassgn (siop->read_chan);
00290       sys$dassgn (siop->write_chan);
00291       sys$delprc (siop->pid);
00292       free (siop);
00293       perror("piped_child: fopen() failed");
00294       return -1;
00295     }
00296
00297   *fromfdp = fileno(siop->read_fp);
00298   *tofdp = fileno(siop->write_fp);
00299
00300   if (trace)
00301      fprintf(stderr, "piped_child: file open successful: tofd=%d fromfd=%d\n",
00302              *tofdp, *fromfdp);
00303
00304   /* Keep track of active subprocess I/O (SUBIO) structures */
00305   if (siop_head)
00306     {
00307       siop_tail->next = siop;
00308       siop->prev = siop_tail;
00309       siop_tail = siop;
00310     }
00311   else
00312     siop_head = siop_tail = siop;
00313
00314   return siop->pid;
00315 }
00316
00317 /*
00318  * Return codes
00319  * >0  VMS exit status of subprocess
00320  *  0  success, subprocess was shutdown
00321  * -1  pid not found in list of subprocesses
00322  * -2  memory corruption detected
00323  */
00324 int
00325 piped_child_shutdown(pid)
00326   pid_t pid;
00327 {
00328   int return_status;
00329   struct IOSB iosb;
00330   SUBIO *siop = siop_head;
00331
00332   while (siop && siop->self == siop && siop->pid != pid)
00333     siop = siop->next;
00334
00335   if (!siop)
00336     return -1;
00337   else if (siop->self != siop)
00338     return -2;
00339
00340   /* Finish reading and writing and shutdown */
00341   if (siop->read_iosb.status)
00342     {
00343       fflush (siop->read_fp);
00344       fclose (siop->read_fp);
00345     }
00346   else
00347     fclose(siop->read_fp);
00348   sys$dassgn (siop->read_chan);
00349
00350    if (siop->write_iosb.status)
00351     {
00352       fflush (siop->write_fp);
00353       sys$qio (0, siop->write_chan, IO$_WRITEOF, &iosb,
00354                0, 0, 0, 0, 0, 0, 0, 0);
00355       fclose (siop->write_fp);
00356     }
00357   else
00358     fclose(siop->write_fp);
00359   sys$dassgn (siop->write_chan);
00360
00361   sys$synch (siop->event_flag, &siop->write_iosb);
00362   lib$free_ef(&siop->event_flag);
00363
00364   /* Ditch SUBIO structure */
00365   if (siop == siop_tail)
00366     siop_tail = siop->prev;
00367   if (siop == siop_head)
00368     siop_head = siop->next;
00369   if (siop->prev)
00370     siop->prev->next = siop->next;
00371   if (siop->next)
00372     siop->next->prev = siop->prev;
00373
00374   if (siop->return_status)
00375     return_status = siop->return_status;
00376   else
00377     return_status = 0;
00378
00379   free (siop);
00380
00381   return return_status;
00382 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pathnames.h File Reference

cvs-1.10/vms/pathnames.h File Reference

Go to the source code of this file.

Defines

#define _PATH_RLOGIN "/usr/bin/rlogin"

Define Documentation

#define _PATH_RLOGIN "/usr/bin/rlogin"

Definition at line 37 of file pathnames.h.

Generated on Sun Oct 21 12:43:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pc.c File Reference

cvs-1.10/vms/pc.c File Reference

#include <stdio.h>
#include <unixio.h>
#include <stdlib.h>
#include <string.h>

Include dependency graph for pc.c:

Include dependency graph

Go to the source code of this file.

Functions

int | piped_child ()
int | piped_child_shutdown ()
main (argc, argv) int argc

Variables

int | trace = 1
char ** | argv

Function Documentation

main | ( | argc | ,
 |  | argv |
 | ) |

int piped_child ( )

int piped_child_shutdown ( )

Referenced by argv().

Variable Documentation

char** argv

Definition at line 13 of file pc.c.

int trace = 1

Definition at line 6 of file pc.c.

Generated on Sun Oct 21 12:43:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pipe.c File Reference

cvs-1.10/vms/pipe.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iodef.h>
#include <ssdef.h>
#include <syidef.h>
#include <clidef.h>
#include <stsdef.h>
#include <dvidef.h>
#include <nam.h>
#include <descrip.h>
#include <errno.h>
#include <file.h>
#include <lib$routines.h>
#include <starlet.h>
#include <setjmp.h>
#include "vms-types.h"

Include dependency graph for pipe.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | PIPE
struct | Vstring

Defines

#define | MODULE PIPE
#define | VERSION "V1.5"

Functions

int | pwait (status) int status
FILE * | popen (cmd, mode) const char *cmd

Variables

PIPE * | phead = NULL
PIPE * | ptail = NULL
unsigned char | evf = 1
jmp_buf | jmpbuf
const char * | mode

Define Documentation

#define MODULE PIPE

Definition at line 31 of file pipe.c.

#define VERSION "V1.5"

Definition at line 32 of file pipe.c.

Function Documentation

FILE* popen | ( | cmd | ,
 |  | mode |
 | ) | const

int pwait ( status ) [static]

Variable Documentation

unsigned char evf = 1 [static]

Definition at line 79 of file pipe.c.

jmp_buf jmpbuf

Definition at line 201 of file pipe.c.

const char* mode

Definition at line 262 of file pipe.c.

struct PIPE* phead = NULL [static]

Definition at line 77 of file pipe.c.

struct PIPE * ptail = NULL [static]

Definition at line 77 of file pipe.c.

Generated on Sun Oct 21 12:43:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pipe.h File Reference

cvs-1.10/vms/pipe.h File Reference

#include <stdio.h>

Include dependency graph for pipe.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int | pclose (FILE *)
FILE * | popen (const char *, const char *)

Function Documentation

int pclose ( FILE * stream )

Definition at line 330 of file popen.c.

00331 {
00332     RESULTCODES rc;
00333     PID pid, pid1;
00334     int Handle = fileno (Pipe);
00335
00336     fclose (Pipe);
00337
00338     rc.codeTerminate = -1;
00339
00340     pid1 = (PID) ll_lookup ((LL_KEY) Handle);
00341     /* if pid1 is zero, something's seriously wrong */
00342     if (pid1 != 0)
00343       {
00344         DosWaitChild (DCWA_PROCESSTREE, DCWW_WAIT, &rc, &pid, pid1);
00345         ll_delete ((LL_KEY) Handle);
00346       }
00347     return rc.codeTerminate == 0 ? rc.codeResult : -1;
00348 }

FILE* popen | ( | const char * | cmd,
 |  | const char * | mode
 | ) |

Definition at line 153 of file popen.c.

00154 {
00155     HFILE End1, End2, Std, Old1, Old2, Tmp;
00156
00157     FILE *File;
00158
00159     char    Fail[256],
00160             *Args,
00161             CmdLine[256],
00162             *CmdExe;
00163
00164     RESULTCODES
00165             Result;
00166
00167     int     Rc;
00168
00169     if (DosCreatePipe (&End1, &End2, 4096))
00170         return NULL;
00171
00172     Std = (*Mode == 'w') ? STDIN : STDOUT ;
00173     if (Std == STDIN)
00174     {
00175         Tmp = End1; End1 = End2; End2 = Tmp;
00176     }
00177
00178     Old1 = -1; /* save stdin or stdout */
00179     DosDupHandle (Std, &Old1);
00180     DosSetFHState (Old1, OPEN_FLAGS_NOINHERIT);
00181     Tmp = Std; /* redirect stdin or stdout */
00182     DosDupHandle (End2, &Tmp);
00183
00184     if (Std == 1)
00185     {
00186         Old2 = -1; /* save stderr */
00187         DosDupHandle (STDERR, &Old2);
00188         DosSetFHState (Old2, OPEN_FLAGS_NOINHERIT);
00189         Tmp = STDERR;
00190         DosDupHandle (End2, &Tmp);
00191     }
00192
00193     DosClose (End2);
00194     DosSetFHState (End1, OPEN_FLAGS_NOINHERIT);
00195
00196     if ((CmdExe = getenv ("COMSPEC")) == NULL )
00197         CmdExe = "cmd.exe";
00198
00199     strcpy (CmdLine, CmdExe);
00200     Args = CmdLine + strlen (CmdLine) + 1; /* skip zero */
00201     strcpy (Args, "/c ");
00202     strcat (Args, Command);
00203     Args[strlen (Args) + 1] = '\0'; /* two zeroes */
00204     Rc = DosExecPgm (Fail, sizeof (Fail), EXEC_ASYNCRESULT,
00205                      (unsigned char *) CmdLine, 0, &Result,
00206                      (unsigned char *) CmdExe);
00207
00208     Tmp = Std; /* restore stdin or stdout */
00209     DosDupHandle (Old1, &Tmp);
00210     DosClose (Old1);
00211
00212     if (Std == STDOUT)
00213     {
00214         Tmp = STDERR;   /* restore stderr */
00215         DosDupHandle (Old2, &Tmp);
00216         DosClose (Old2);
00217     }
00218
00219     if (Rc)
00220     {
00221         DosClose (End1);
00222         return NULL;
00223     }
00224
00225 #ifdef __WATCOMC__
00226     /* Watcom does not allow mixing operating system handles and
00227      * C library handles, so we have to convert.
00228      */
00229     File = fdopen (_hdopen (End1, *Mode == 'w'? O_WRONLY : O_RDONLY), Mode);
00230 #else
00231     File = fdopen (End1, Mode);
00232 #endif
00233     ll_insert ((LL_KEY) End1, (LL_VAL) Result.codeTerminate);
00234
00235     return File;
00236 }

Generated on Sun Oct 21 12:43:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


piped_child.c File Reference

cvs-1.10/vms/piped_child.c File Reference

#include "vms.h"
#include "vms-types.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iodef.h>
#include <ssdef.h>
#include <syidef.h>
#include <clidef.h>
#include <stsdef.h>
#include <dvidef.h>
#include <nam.h>
#include <descrip.h>
#include <errno.h>
#include <file.h>
#include <lib$routines.h>
#include <starlet.h>

Include dependency graph for piped_child.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | _SUBIO
struct | Vstring

Typedefs

typedef _SUBIO | SUBIO

Functions

int | piped_child_exith (int)
void | piped_child_done (siop) SUBIO *siop

Variables

int | trace
SUBIO * | siop_head = NULL
SUBIO * | siop_tail = NULL
EXHCB piped_child_exit_handler_block
int * | tofdp
int * | fromfdp

Typedef Documentation

typedef struct _SUBIO SUBIO

Function Documentation

void piped_child_done ( siop )

int piped_child_exith ( int ) [static]

Variable Documentation

int * fromfdp

Definition at line 124 of file piped_child.c.

struct EXHCB piped_child_exit_handler_block [static]

Initial value:

  {0, piped_child_exith, 1, &piped_child_exit_handler_block.exh$l_status, 0}

Definition at line 52 of file piped_child.c.

SUBIO* siop_head = NULL [static]

Definition at line 48 of file piped_child.c.

SUBIO * siop_tail = NULL [static]

Definition at line 48 of file piped_child.c.

int* tofdp

Definition at line 124 of file piped_child.c.

int trace

Definition at line 29 of file piped_child.c.

Generated on Sun Oct 21 12:43:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pwd.c File Reference

cvs-1.10/vms/pwd.c File Reference

#include "pwd.h"
#include <stdio.h>
#include <unixlib.h>

Include dependency graph for pwd.c:

Include dependency graph

Go to the source code of this file.

Functions

passwd * | getpwuid (unsigned int uid)
char * | getlogin ()

Variables

passwd pw

Function Documentation

char* getlogin ( void )

Definition at line 16 of file pwd.c.

00017 {
00018   static char login[256];
00019   return cuserid(login);
00020 }

struct passwd* getpwuid ( unsigned int uid )

Definition at line 11 of file pwd.c.

00012 {
00013     return NULL;
00014 }

Variable Documentation

struct passwd pw [static]

Definition at line 5 of file pwd.c.

Generated on Sun Oct 21 12:43:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/pwd.c Source File

cvs-1.10/vms/pwd.c

Go to the documentation of this file.
00001 #include "pwd.h"
00002 #include <stdio.h>
00003 #include <unixlib.h>
00004
00005 static struct passwd pw;
00006
00007 /* This is only called from one relevant place, lock.c.  In that context
00008    the code is really trying to figure out who owns a directory.  Nothing
00009    which has anything to do with getpwuid or anything of the sort can help
00010    us on VMS (getuid returns only the group part of the UIC).  */
00011 struct passwd *getpwuid(unsigned int uid)
00012 {
00013     return NULL;
00014 }
00015
00016 char *getlogin()
00017 {
00018   static char login[256];
00019   return cuserid(login);
00020 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pwd.h File Reference

cvs-1.10/vms/pwd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | passwd

Defines

#define | pid_t int

Functions

passwd * getpwuid ()
char * | getlogin (void)

Define Documentation

#define pid_t int

Definition at line 11 of file pwd.h.

Function Documentation

char* getlogin ( void )

Definition at line 88 of file pwd.c.

00089 {
00090   /* This is how a windows user would override their login name. */
00091   if (!login)
00092     login = lookup_env (login_strings);
00093
00094   /* In the absence of user override, ask the operating system. */
00095   if (!login)
00096      login = win32getlogin();
00097
00098   /* If all else fails, fall back on Old Faithful. */
00099   if (!login)
00100     login = anonymous;
00101
00102   return login;
00103 }

struct passwd* getpwuid ( )

Generated on Sun Oct 21 12:43:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/pwd.h Source File

cvs-1.10/vms/pwd.h

Go to the documentation of this file.
00001 #ifndef _PWD_H
00002 #define _PWD_H
00003
00004 /* Trying to declare uid_t is a mess.  We tried #include <sys/types.h>, which
00005    only worked on VAX (VMS 6.2, I think), and we tried defining it here
00006    which only worked on alpha, I think.  In any event, the VMS C library's
00007    concept of uid_t is fundamentally broken anyway (getuid() returns only
00008    the group part of the UIC), so we are better off with higher-level
00009    hooks like get_homedir and SYSTEM_GETCALLER.  */
00010
00011 #define pid_t int
00012
00013 struct passwd {
00014    char  *pw_name;
00015 };
00016
00017 struct passwd *getpwuid(/* really uid_t, but see above about declaring it */);
00018 char *getlogin(void);
00019
00020 #else
00021 #endif /* _PWD_H */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcmd.c File Reference

cvs-1.10/vms/rcmd.c File Reference

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unixio.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

Include dependency graph for rcmd.c:

Include dependency graph

Go to the source code of this file.

Functions

int rcmd (char **remote_hostname, int remote_port, char *local_user, char *remote_user, char *command, int zero)

Function Documentation

int rcmd | ( | char ** | remote_hostname,
 |  | int | remote_port,
 |  | char * | local_user,
 |  | char * | remote_user,
 |  | char * | command,
 |  | int | zero
 | ) |

Definition at line 11 of file rcmd.c.

00014 {
00015   struct hostent *remote_hp;
00016   struct hostent *local_hp;
00017   struct sockaddr_in remote_isa;
00018   struct sockaddr_in local_isa;
00019   char local_hostname[80];
00020   char ch;
00021   int s;
00022   int local_port;
00023   int rs;
00024
00025   remote_hp = gethostbyname(*remote_hostname);
00026   if(!remote_hp)
00027     {
00028     perror("couldn't get remote host address");
00029     exit(-1);
00030     }
00031
00032   /* Copy remote IP address into socket address structure */
00033   remote_isa.sin_family = AF_INET;
00034   remote_isa.sin_port = htons(remote_port);
00035   memcpy(&remote_isa.sin_addr, remote_hp->h_addr, sizeof(remote_isa.sin_addr));
00036
00037   gethostname(local_hostname, 80);
00038   local_hp = gethostbyname(local_hostname);
00039   if(!local_hp)
00040     {
00041     perror("couldn't get local host address");
00042     exit(-1);
00043     }
00044
00045   /* Copy local IP address into socket address structure */
00046   local_isa.sin_family = AF_INET;
00047   memcpy(&local_isa.sin_addr, local_hp->h_addr, sizeof(local_isa.sin_addr));
00048
00049   /* Create the local socket */
00050   s = socket(AF_INET, SOCK_STREAM, 0);
00051   if(s < 0)
00052     {
00053     perror("socket failed\n");
00054     exit(-1);
00055     }
00056
00057   /* Bind local socket with a port from IPPORT_RESERVED/2 to IPPORT_RESERVED - 1
00058      this requires the OPER privilege under VMS -- to allow communication with
00059      a stock rshd under UNIX */
00060
00061   for(local_port = IPPORT_RESERVED - 1; local_port >= IPPORT_RESERVED/2; local_port--)
00062     {
00063     local_isa.sin_port = htons(local_port);
00064     rs = bind(s, (struct sockaddr *)&local_isa, sizeof(local_isa));
00065     if(rs == 0)
00066       break;
00067     }
00068
00069   /* Bind local socket to an unprivileged port.  A normal rshd will drop the
00070      connection; you must be running a patched rshd invoked through inetd for
00071      this connection method to work */
00072
00073   if (rs != 0)
00074     for(local_port = IPPORT_USERRESERVED - 1;
00075         local_port > IPPORT_RESERVED;
00076         local_port--)
00077       {
00078       local_isa.sin_port = htons(local_port);
00079       rs = bind(s, (struct sockaddr *)&local_isa, sizeof(local_isa));
00080       if(rs == 0)
00081         break;
00082       }
00083
00084   rs = connect(s, (struct sockaddr *) &remote_isa, sizeof(remote_isa));
00085   if(rs == -1)
00086     {
00087     fprintf(stderr, "connect: errno = %d\n", errno);
00088     close(s);
00089     exit(-2);
00090     }
00091
00092   /* Now supply authentication information */
00093
00094   /* Auxiliary port number for error messages, we don't use it */
00095   write(s, "0\0", 2);
00096
00097   /* Who are we */
00098   write(s, local_user, strlen(local_user) + 1);
00099
00100   /* Who do we want to be */
00101   write(s, remote_user, strlen(remote_user) + 1);
00102
00103   /* What do we want to run */
00104   write(s, command, strlen(command) + 1);
00105
00106   /* NUL is sent back to us if information is acceptable */
00107   read(s, &ch, 1);
00108   if(ch != '\0')
00109     {
00110     errno = EPERM;
00111     return -1;
00112     }
00113
00114   return s;
00115 }

Generated on Sun Oct 21 12:43:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/rcmd.c Source File

cvs-1.10/vms/rcmd.c

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <string.h>
00003 #include <stdlib.h>
00004 #include <unixio.h>
00005
00006 #include <errno.h>
00007 #include <sys/socket.h>
00008 #include <netinet/in.h>
00009 #include <netdb.h>
00010
00011 int rcmd(char **remote_hostname, int remote_port,
00012          char *local_user, char *remote_user,
00013          char *command, int zero)
00014 {
00015   struct hostent *remote_hp;
00016   struct hostent *local_hp;
00017   struct sockaddr_in remote_isa;
00018   struct sockaddr_in local_isa;
00019   char local_hostname[80];
00020   char ch;
00021   int s;
00022   int local_port;
00023   int rs;
00024
00025   remote_hp = gethostbyname(*remote_hostname);
00026   if(!remote_hp)
00027     {
00028     perror("couldn't get remote host address");
00029     exit(-1);
00030     }
00031
00032   /* Copy remote IP address into socket address structure */
00033   remote_isa.sin_family = AF_INET;
00034   remote_isa.sin_port = htons(remote_port);
00035   memcpy(&remote_isa.sin_addr, remote_hp->h_addr, sizeof(remote_isa.sin_addr));
00036
00037   gethostname(local_hostname, 80);
00038   local_hp = gethostbyname(local_hostname);
00039   if(!local_hp)
00040     {
00041     perror("couldn't get local host address");
00042     exit(-1);
00043     }
00044
00045   /* Copy local IP address into socket address structure */
00046   local_isa.sin_family = AF_INET;
00047   memcpy(&local_isa.sin_addr, local_hp->h_addr, sizeof(local_isa.sin_addr));
00048
00049   /* Create the local socket */
00050   s = socket(AF_INET, SOCK_STREAM, 0);
00051   if(s < 0)
00052     {
00053     perror("socket failed\n");
00054     exit(-1);
00055     }
00056
00057   /* Bind local socket with a port from IPPORT_RESERVED/2 to IPPORT_RESERVED - 1
00058      this requires the OPER privilege under VMS -- to allow communication with
00059      a stock rshd under UNIX */
00060
00061   for(local_port = IPPORT_RESERVED - 1; local_port >= IPPORT_RESERVED/2; local_port--)
00062     {
00063     local_isa.sin_port = htons(local_port);
00064     rs = bind(s, (struct sockaddr *)&local_isa, sizeof(local_isa));
00065     if(rs == 0)
00066       break;
00067     }
00068
00069   /* Bind local socket to an unprivileged port.  A normal rshd will drop the
00070      connection; you must be running a patched rshd invoked through inetd for
00071      this connection method to work */
00072
00073   if (rs != 0)
00074     for(local_port = IPPORT_USERRESERVED - 1;
00075         local_port > IPPORT_RESERVED;
00076         local_port--)
00077       {
00078       local_isa.sin_port = htons(local_port);
00079       rs = bind(s, (struct sockaddr *)&local_isa, sizeof(local_isa));
00080       if(rs == 0)
00081         break;
00082       }
00083
00084   rs = connect(s, (struct sockaddr *) &remote_isa, sizeof(remote_isa));
00085   if(rs == -1)
00086     {
00087     fprintf(stderr, "connect: errno = %d\n", errno);
00088     close(s);
00089     exit(-2);
00090     }
00091
00092   /* Now supply authentication information */
00093
00094   /* Auxiliary port number for error messages, we don't use it */
00095   write(s, "0\0", 2);
00096
00097   /* Who are we */
00098   write(s, local_user, strlen(local_user) + 1);
00099
00100   /* Who do we want to be */
00101   write(s, remote_user, strlen(remote_user) + 1);
00102
00103   /* What do we want to run */
00104   write(s, command, strlen(command) + 1);
00105
00106   /* NUL is sent back to us if information is acceptable */
00107   read(s, &ch, 1);
00108   if(ch != '\0')
00109     {
00110     errno = EPERM;
00111     return -1;
00112     }
00113
00114   return s;
00115 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/readlink.c Source File

cvs-1.10/vms/readlink.c

Go to the documentation of this file.
00001 int readlink(char *path, char *buf, int bufsiz)
00002 {
00003   /* OpenVMS dosen't have symbolic links in the UNIX sense */
00004   return -1;
00005 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/rmdir.c Source File

cvs-1.10/vms/rmdir.c

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <unixio.h>
00003
00004 int rmdir(path)
00005 char *path;
00006 {
00007   chmod(path, 0777);
00008   return remove(path);
00009 }
00010
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


readlink.c File Reference

cvs-1.10/vms/readlink.c File Reference

Go to the source code of this file.

Functions

int readlink (char *path, char *buf, int bufsiz)

Function Documentation

int readlink | ( | char * | path,
 |  | char * | buf,
 |  | int | buf_size
 | ) |

Definition at line 1 of file readlink.c.

00002 {
00003   /* OpenVMS dosen't have symbolic links in the UNIX sense */
00004   return -1;
00005 }

Generated on Sun Oct 21 12:43:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rmdir.c File Reference

cvs-1.10/vms/rmdir.c File Reference

#include <stdio.h>
#include <unixio.h>

Include dependency graph for rmdir.c:

Include dependency graph

Go to the source code of this file.

Functions

int rmdir (path) char *path

Function Documentation

int rmdir ( path )

Generated on Sun Oct 21 12:43:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


startserver.c File Reference

cvs-1.10/vms/startserver.c File Reference

#include <socket.h>
#include <netdb.h>
#include <errno.h>
#include "options.h"

Include dependency graph for startserver.c:

Include dependency graph

Go to the source code of this file.

Functions

void | vms_start_server (int *tofd, int *fromfd, char *client_user, char *server_user, char *server_host, char *server_cvsroot)

Variables

char * | cvs_server
char * | command
int | trace

Function Documentation

void vms_start_server | ( | int * | tofd,
 |  | int * | fromfd,
 |  | char * | client_user,
 |  | char * | server_user,
 |  | char * | server_host,
 |  | char * | server_cvsroot
 | ) |

Definition at line 13 of file startserver.c.

00016 {
00017   int fd, port;
00018   char *portenv;
00019   struct servent *sptr;
00020
00021   if (! (cvs_server = getenv ("CVS_SERVER")))
00022       cvs_server = "cvs";
00023   command = xmalloc (strlen (cvs_server)
00024              + strlen (server_cvsroot)
00025              + 50);
00026   sprintf(command, "%s server", cvs_server);
00027
00028   portenv = getenv("CVS_RCMD_PORT");
00029   if (portenv)
00030       port = atoi(portenv);
00031   else if ((sptr = getservbyname("shell", "tcp")) != NULL)
00032       port = sptr->s_port;
00033   else
00034       port = 514; /* shell/tcp */
00035
00036   if(trace)
00037     {
00038     fprintf(stderr, "vms_start_server(): connecting to %s:%d\n",
00039             server_host, port);
00040     fprintf(stderr, "local_user = %s, remote_user = %s, CVSROOT = %s\n",
00041             client_user, (server_user ? server_user : client_user),
00042             server_cvsroot);
00043     }
00044
00045   fd = rcmd(&server_host, port,
00046             client_user,
00047             (server_user ? server_user : client_user),
00048             command, 0);
00049
00050   if (fd < 0)
00051      error (1, errno, "cannot start server via rcmd()");
00052
00053   *tofd = fd;
00054   *fromfd = fd;
00055   free (command);
00056 }

Variable Documentation

char* command [static]

Definition at line 8 of file startserver.c.

char* cvs_server [static]

Definition at line 7 of file startserver.c.

int trace

Definition at line 10 of file startserver.c.

Generated on Sun Oct 21 12:42:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/startserver.c Source File

cvs-1.10/vms/startserver.c

Go to the documentation of this file.
00001 #include <socket.h>
00002 #include <netdb.h>
00003 #include <errno.h>
00004
00005 #include "options.h"
00006
00007 static char *cvs_server;
00008 static char *command;
00009
00010 extern int trace;
00011
00012 void
00013 vms_start_server (int *tofd, int *fromfd,
00014                   char *client_user, char *server_user,
00015                   char *server_host, char *server_cvsroot)
00016 {
00017   int fd, port;
00018   char *portenv;
00019   struct servent *sptr;
00020
00021   if (! (cvs_server = getenv ("CVS_SERVER")))
00022       cvs_server = "cvs";
00023   command = xmalloc (strlen (cvs_server)
00024              + strlen (server_cvsroot)
00025              + 50);
00026   sprintf(command, "%s server", cvs_server);
00027
00028   portenv = getenv("CVS_RCMD_PORT");
00029   if (portenv)
00030       port = atoi(portenv);
00031   else if ((sptr = getservbyname("shell", "tcp")) != NULL)
00032       port = sptr->s_port;
00033   else
00034       port = 514; /* shell/tcp */
00035
00036   if(trace)
00037     {
00038     fprintf(stderr, "vms_start_server(): connecting to %s:%d\n",
00039             server_host, port);
00040     fprintf(stderr, "local_user = %s, remote_user = %s, CVSROOT = %s\n",
00041             client_user, (server_user ? server_user : client_user),
00042             server_cvsroot);
00043     }
00044
00045   fd = rcmd(&server_host, port,
00046             client_user,
00047             (server_user ? server_user : client_user),
00048             command, 0);
00049
00050   if (fd < 0)
00051      error (1, errno, "cannot start server via rcmd()");
00052
00053   *tofd = fd;
00054   *fromfd = fd;
00055   free (command);
00056 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/stat.c Source File

cvs-1.10/vms/stat.c

Go to the documentation of this file.
00001 #include <string.h>
00002 #include <stat.h>
00003 #include <unixlib.h>
00004
00005 int wrapped_stat (path, buffer)
00006 const char *path;
00007 struct stat *buffer;
00008 {
00009   char statpath[1024];
00010   int rs;
00011
00012   strcpy(statpath, path);
00013   strip_trailing_slashes (statpath);
00014   if(strcmp(statpath, ".") == 0)
00015   {
00016       char *wd;
00017       wd = xgetwd ();
00018       rs = stat (wd, buffer);
00019       free (wd);
00020   }
00021   else
00022       rs = stat (statpath, buffer);
00023
00024   if (rs < 0)
00025       {
00026       /* If stat() fails try again after appending ".dir" to the filename
00027          this allows you to stat things like "bloogle/CVS" from VMS 6.1 */
00028       strcat(statpath, ".dir");
00029       rs = stat (statpath, buffer);
00030       }
00031
00032   return rs;
00033 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/unlink.c Source File

cvs-1.10/vms/unlink.c

Go to the documentation of this file.
00001 #include <unixio.h>
00002
00003 /* UNIX-like file deletion, deletes previous VMS file versions so UNIX
00004    style locking through files dosen't lose.  */
00005 int unlink(char *path)
00006 {
00007   int rs, junk_rs;
00008
00009   rs = remove(path);
00010   while(remove(path) >= 0);
00011
00012   return rs;
00013 }
00014
00015 int link(char *from, char *to)
00016 {
00017   int rs = -1;
00018
00019   /* Link always fails */
00020
00021   return rs;
00022 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/utime.c Source File

cvs-1.10/vms/utime.c

Go to the documentation of this file.
00001 /* This is REALLY gross, but at least it is a full implementation */
00002
00003 #include <ctype.h>
00004 #include <time.h>
00005 #include "vmsmunch.h"
00006
00007 #define ASCTIMEMAX 23
00008
00009 struct utimbuf {
00010   long actime;
00011   long modtime;
00012  };
00013
00014 utime(file, buf)
00015 char *file;
00016 struct utimbuf *buf;
00017 {
00018   static struct VMStimbuf vtb;
00019   static char conversion_buf[80];
00020   static char vms_actime[80];
00021   static char vms_modtime[80];
00022
00023   strcpy(conversion_buf, ctime(&buf->actime));
00024   conversion_buf[ASCTIMEMAX + 1] = '\0';
00025   sprintf(vms_actime, "%2.2s-%3.3s-%4.4s %8.5s.00",
00026       &(conversion_buf[8]), &(conversion_buf[4]),
00027       &(conversion_buf[20]), &(conversion_buf[11]));
00028   vms_actime[4] = _toupper(vms_actime[4]);
00029   vms_actime[5] = _toupper(vms_actime[5]);
00030
00031   strcpy(conversion_buf, ctime(&buf->modtime));
00032   conversion_buf[ASCTIMEMAX + 1] = '\0';
00033   sprintf(vms_modtime, "%2.2s-%3.3s-%4.4s %8.5s.00",
00034       &(conversion_buf[8]), &(conversion_buf[4]),
00035       &(conversion_buf[20]), &(conversion_buf[11]));
00036   vms_modtime[4] = _toupper(vms_modtime[4]);
00037   vms_modtime[4] = _toupper(vms_modtime[5]);
00038
00039   vtb.actime = vms_actime;
00040   vtb.modtime = vms_modtime;
00041   VMSmunch(file, SET_TIMES, &vtb);
00042 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/vms-types.h Source File

cvs-1.10/vms/vms-types.h

Go to the documentation of this file.
00001 #ifndef __types_loaded__
00002 #define __types_loaded__ 1
00003
00004 #include <stddef.h>
00005
00006 /*
00007  * Miscellaneous VMS types that are not normally defined
00008  * in any consistent fashion.
00009  */
00010
00011 /* VMS I/O status block */
00012 struct IOSB
00013 {
00014   short status, count;
00015   long devinfo;
00016 };
00017
00018 /* VMS Item List 3 structure */
00019 struct itm$list3
00020 {
00021   short buflen;
00022   short itemcode;
00023   void *buffer;
00024   size_t *retlen;
00025 };
00026
00027 /* VMS Lock status block with value block */
00028 struct LOCK
00029 {
00030   short status, reserved;
00031   long lockid;
00032   long value[4];
00033 };
00034
00035 /* VMS Exit Handler Control block */
00036 struct EXHCB
00037 {
00038   struct exhcb *exh$a_link;
00039   int (*exh$a_routine)();
00040   long exh$l_argcount;
00041   long *exh$a_status;
00042   long exh$l_status;
00043 };
00044
00045 #endif /* __types_loaded__ 1 */
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/vms.h Source File

cvs-1.10/vms/vms.h

Go to the documentation of this file.
00001 /* Determined from CC RTL function prototypes in online documentation */
00002
00003 #define mode_t unsigned int
00004
00005 #define fork(x) vfork(x)
00006
00007 #include <sys/types.h>
00008 #include <unixio.h>
00009 #include <unixlib.h>
00010 #include <stdlib.h>
00011 #include <processes.h>
00012 #include <socket.h>
00013
00014 #define STDIN_FILENO  0
00015 #define STDOUT_FILENO 1
00016 #define STDERR_FILENO 2
00017
00018 extern int fnmatch(char *pattern, char *string, int options);
00019
00020 /* With the define of HAVE_NDIR_H in config.h, lib/system.h and
00021    diff/system.h should include ndir.h for us.  But I'm too lazy to
00022    track down and make _sure_ all bases are covered, so I'm leaving in
00023    this include for now.  */
00024 #include "ndir.h"
00025
00026 #include "pwd.h"
00027 #include "pipe.h"
00028
00029 int unlink(char *path);
00030 int link(char *from, char *to);
00031
00032 #define stat(a, b) wrapped_stat(a, b)
00033
00034 #undef POSIX
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/vmsmunch.c Source File

cvs-1.10/vms/vmsmunch.c

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------
00002
00003   VMSmunch.c                    version 1.3                     28 Apr 1992
00004
00005   This routine is a blatant and unrepentent appropriation of all the nasty
00006   and difficult-to-do and complicated VMS shenanigans which Joe Meadows has
00007   so magnificently captured in his FILE utility.  Not only that, it's even
00008   allowed! (see below).  But let it be clear at the outset that Joe did all
00009   the work; yea, verily, he is truly a godlike unit.
00010
00011   The appropriations and modifications herein were performed primarily by
00012   him known as "Cave Newt," although the Info-ZIP working group probably had
00013   their fingers in it somewhere along the line.  The idea is to put the raw
00014   power of Joe's original routine at the disposal of various routines used
00015   by UnZip (and Zip, possibly), not least among them the utime() function.
00016   Read on for details...
00017
00018     18-JUL-1994 Hunter Goatley <goathunter@WKU.EDU>
00019             Fixed IO$_ACCESS call.
00020
00021     18-Jul-1994 Richard Levitte levitte@e.kth.se
00022             Changed VMSmunch() to deassign the channel before
00023             returning when an error has occured.
00024
00025     02-Apr-1994 Jamie Hanrahan  jeh@cmkrnl.com
00026             Moved definition of VMStimbuf struct from here
00027             to vmsmunch.h
00028   ---------------------------------------------------------------------------
00029
00030   Usage (i.e., "interface," in geek-speak):
00031
00032      int VMSmunch( char *filename, int action, char *ptr );
00033
00034      filename   the name of the file on which to be operated, obviously
00035      action     an integer which specifies what action to take
00036      ptr        pointer to any extra item which may be needed (else NULL)
00037
00038   The possible values for the action argument are as follows:
00039
00040      GET_TIMES      get the creation and revision dates of filename; ptr
00041                     must point to an empty VMStimbuf struct, as defined
00042             in vmsmunch.h
00043                     (with room for at least 24 characters, including term.)
00044      SET_TIMES      set the creation and revision dates of filename (utime
00045                     option); ptr must point to a valid VMStimbuf struct,
00046                     as defined in vmsmunch.h
00047      GET_RTYPE      get the record type of filename; ptr must point to an
00048                     integer which, on return, is set to the type (as defined
00049                     in VMSmunch.h:  FAT$C_* defines)
00050      CHANGE_RTYPE   change the record type to that specified by the integer
00051                     to which ptr points; save the old record type (later
00052                     saves overwrite earlier ones)
00053      RESTORE_RTYPE  restore the record type to the previously saved value;
00054                     or, if none, set it to "fixed-length, 512-byte" record
00055                     format (ptr not used)
00056
00057   ---------------------------------------------------------------------------
00058
00059   Comments from FILE.C, a utility to modify file characteristics:
00060
00061      Written by Joe Meadows Jr, at the Fred Hutchinson Cancer Research Center
00062      BITNET: JOE@FHCRCVAX
00063      PHONE: (206) 467-4970
00064
00065      There are no restrictions on this code, you may sell it, include it
00066      with any commercial package, or feed it to a whale.. However, I would
00067      appreciate it if you kept this comment in the source code so that anyone
00068      receiving this code knows who to contact in case of problems. Note that
00069      I do not demand this condition..
00070
00071   ---------------------------------------------------------------------------*/
00072
00073
00074
00075
00076 /*****************************/
00077 /*  Includes, Defines, etc.  */
00078 /*****************************/
00079
00080 #include <descrip.h>
00081 #include <rms.h>
00082 #include <stdio.h>
00083 #include <iodef.h>
00084 #include <string.h>
00085 #include <starlet.h>
00086 #include <atrdef.h>   /* this gets created with the c3.0 compiler */
00087 #include <fibdef.h>   /* this gets created with the c3.0 compiler */
00088
00089 #include "VMSmunch.h"  /* GET/SET_TIMES, RTYPE, etc. */
00090 #include "VMSmunch_private.h"   /* fatdef.h, etc. */
00091
00092 #define RTYPE     fat$r_rtype_overlay.fat$r_rtype_bits
00093 #define RATTRIB   fat$r_rattrib_overlay.fat$r_rattrib_bits
00094
00095 static void asctim();
00096 static void bintim();
00097
00098 /* from <ssdef.h> */
00099 #ifndef SS$_NORMAL
00100 #  define SS$_NORMAL    1
00101 #  define SS$_BADPARAM  20
00102 #endif
00103
00104
00105
00106
00107
00108 /*************************/
00109 /*  Function VMSmunch()  */
00110 /*************************/
00111
00112 int VMSmunch( filename, action, ptr )
00113     char  *filename, *ptr;
00114     int   action;
00115 {
00116
00117     /* original file.c variables */
00118
00119     static struct FAB Fab;
00120     static struct NAM Nam;
00121     static struct fibdef Fib; /* short fib */
00122
00123     static struct dsc$descriptor FibDesc =
00124       {sizeof(Fib),DSC$K_DTYPE_Z,DSC$K_CLASS_S,(char *)&Fib};
00125     static struct dsc$descriptor_s DevDesc =
00126       {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,&Nam.nam$t_dvi[1]};
00127     static struct fatdef Fat;
00128     static union {
00129       struct fchdef fch;
00130       long int dummy;
00131     } uchar;
00132     static struct fjndef jnl;
00133     static long int Cdate[2],Rdate[2],Edate[2],Bdate[2];
00134     static short int revisions;
00135     static unsigned long uic;
00136     static union {
00137       unsigned short int value;
00138       struct {
00139         unsigned system : 4;
00140         unsigned owner : 4;
00141         unsigned group : 4;
00142         unsigned world : 4;
00143       } bits;
00144     } prot;
00145
00146     static struct atrdef Atr[] = {
00147       {ATR$S_RECATTR,ATR$C_RECATTR,&Fat},        /* record attributes */
00148       {ATR$S_UCHAR,ATR$C_UCHAR,&uchar},      /* File characteristics */
00149       {ATR$S_CREDATE,ATR$C_CREDATE,&Cdate[0]}, /* Creation date */
00150       {ATR$S_REVDATE,ATR$C_REVDATE,&Rdate[0]}, /* Revision date */
00151       {ATR$S_EXPDATE,ATR$C_EXPDATE,&Edate[0]}, /* Expiration date */
00152       {ATR$S_BAKDATE,ATR$C_BAKDATE,&Bdate[0]}, /* Backup date */
00153       {ATR$S_ASCDATES,ATR$C_ASCDATES,&revisions}, /* number of revisions */
00154       {ATR$S_FPRO,ATR$C_FPRO,&prot},         /* file protection  */
00155       {ATR$S_UIC,ATR$C_UIC,&uic},            /* file owner */
00156       {ATR$S_JOURNAL,ATR$C_JOURNAL,&jnl},        /* journal flags */
00157       {0,0,0}
00158     } ;
00159
00160     static char EName[NAM$C_MAXRSS];
00161     static char RName[NAM$C_MAXRSS];
00162     static struct dsc$descriptor_s FileName =
00163       {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
00164     static struct dsc$descriptor_s string = {0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
00165     static short int DevChan;
00166     static short int iosb[4];
00167
00168     static long int i,status;
00169 /*  static char *retval;  */
00170
00171
00172     /* new VMSmunch variables */
00173
00174     static int  old_rtype=FAT$C_FIXED;   /* storage for record type */
00175
00176
00177
00178 /*---------------------------------------------------------------------------
00179     Initialize attribute blocks, parse filename, resolve any wildcards, and
00180     get the file info.
00181   ---------------------------------------------------------------------------*/
00182
00183     /* initialize RMS structures, we need a NAM to retrieve the FID */
00184     Fab = cc$rms_fab;
00185     Fab.fab$l_fna = filename;
00186     Fab.fab$b_fns = strlen(filename);
00187     Fab.fab$l_nam = &Nam; /* FAB has an associated NAM */
00188     Nam = cc$rms_nam;
00189     Nam.nam$l_esa = EName; /* expanded filename */
00190     Nam.nam$b_ess = sizeof(EName);
00191     Nam.nam$l_rsa = RName; /* resultant filename */
00192     Nam.nam$b_rss = sizeof(RName);
00193
00194     /* do $PARSE and $SEARCH here */
00195     status = sys$parse(&Fab);
00196     if (!(status & 1)) return(status);
00197
00198     /* search for the first file.. If none signal error */
00199     status = sys$search(&Fab);
00200     if (!(status & 1)) return(status);
00201
00202     while (status & 1) {
00203         /* initialize Device name length, note that this points into the NAM
00204            to get the device name filled in by the $PARSE, $SEARCH services */
00205         DevDesc.dsc$w_length = Nam.nam$t_dvi[0];
00206
00207         status = sys$assign(&DevDesc,&DevChan,0,0);
00208         if (!(status & 1)) return(status);
00209
00210         FileName.dsc$a_pointer = Nam.nam$l_name;
00211         FileName.dsc$w_length = Nam.nam$b_name+Nam.nam$b_type+Nam.nam$b_ver;
00212
00213         /* Initialize the FIB */
00214         for (i=0;i<3;i++)
00215 #ifdef VAXC
00216             Fib.fib$r_fid_overlay.fib$w_fid[i]=Nam.nam$w_fid[i];
00217 #else
00218         Fib.fib$w_fid[i]=Nam.nam$w_fid[i];
00219 #endif
00220         for (i=0;i<3;i++)
00221 #ifdef VAXC
00222             Fib.fib$r_did_overlay.fib$w_did[i]=Nam.nam$w_did[i];
00223 #else
00224             Fib.fib$w_did[i]=Nam.nam$w_did[i];
00225 #endif
00226
00227         /* Use the IO$_ACCESS function to return info about the file */
00228         /* Note, used this way, the file is not opened, and the expiration */
00229         /* and revision dates are not modified */
00230         status = sys$qiow(0,DevChan,IO$_ACCESS,&iosb,0,0,
00231                           &FibDesc,&FileName,0,0,&Atr,0);
00232         if (!(status & 1))
00233       {
00234         sys$dassgn(DevChan);
00235         return(status);
00236       }
00237         status = iosb[0];
00238         if (!(status & 1))
00239       {
00240         sys$dassgn(DevChan);
00241         return(status);
00242       }
00243
00244     /*-----------------------------------------------------------------------
00245         We have the current information from the file:  now see what user
00246         wants done with it.
00247       -----------------------------------------------------------------------*/
00248
00249         switch (action) {
00250
00251           case GET_TIMES:
00252               asctim(((struct VMStimbuf *)ptr)->modtime, Cdate);
00253               asctim(((struct VMStimbuf *)ptr)->actime, Rdate);
00254               break;
00255
00256           case SET_TIMES:
00257               bintim(((struct VMStimbuf *)ptr)->modtime, Cdate);
00258               bintim(((struct VMStimbuf *)ptr)->actime, Rdate);
00259               break;
00260
00261           case GET_RTYPE:   /* non-modifying */
00262               *(int *)ptr = Fat.RTYPE.fat$v_rtype;
00263               return RMS$_NORMAL;     /* return to user */
00264               break;
00265
00266           case CHANGE_RTYPE:
00267               old_rtype = Fat.RTYPE.fat$v_rtype;         /* save current one */
00268               if ((*(int *)ptr < FAT$C_UNDEFINED) ||
00269                   (*(int *)ptr > FAT$C_STREAMCR))
00270                   Fat.RTYPE.fat$v_rtype = FAT$C_STREAMLF;  /* Unix I/O happy */
00271               else
00272                   Fat.RTYPE.fat$v_rtype = *(int *)ptr;
00273               break;
00274
00275           case RESTORE_RTYPE:
00276               Fat.RTYPE.fat$v_rtype = old_rtype;
00277               break;
00278
00279           default:
00280               return SS$_BADPARAM;   /* anything better? */
00281         }
00282
00283     /*-----------------------------------------------------------------------
00284         Go back and write modified data to the file header.
00285       -----------------------------------------------------------------------*/
00286
00287         /* note, part of the FIB was cleared by earlier QIOW, so reset it */
00288 #ifdef VAXC
00289         Fib.fib$r_acctl_overlay.fib$l_acctl = FIB$M_NORECORD;
00290 #else
00291         Fib.fib$l_acctl = FIB$M_NORECORD;
00292 #endif
00293         for (i=0;i<3;i++)
00294 #ifdef VAXC
00295             Fib.fib$r_fid_overlay.fib$w_fid[i]=Nam.nam$w_fid[i];
00296 #else
00297             Fib.fib$w_fid[i]=Nam.nam$w_fid[i];
00298 #endif
00299         for (i=0;i<3;i++)
00300 #ifdef VAXC
00301             Fib.fib$r_did_overlay.fib$w_did[i]=Nam.nam$w_did[i];
00302 #else
00303             Fib.fib$w_did[i]=Nam.nam$w_did[i];
00304 #endif
00305
00306         /* Use the IO$_MODIFY function to change info about the file */
00307         /* Note, used this way, the file is not opened, however this would */
00308         /* normally cause the expiration and revision dates to be modified. */
00309         /* Using FIB$M_NORECORD prohibits this from happening. */
00310         status = sys$qiow(0,DevChan,IO$_MODIFY,&iosb,0,0,
00311                           &FibDesc,&FileName,0,0,&Atr,0);
00312         if (!(status & 1))
00313       {
00314         sys$dassgn(DevChan);
00315         return(status);
00316       }
00317
00318         status = iosb[0];
00319         if (!(status & 1))
00320       {
00321         sys$dassgn(DevChan);
00322         return(status);
00323       }
00324
00325         status = sys$dassgn(DevChan);
00326         if (!(status & 1)) return(status);
00327
00328         /* look for next file, if none, no big deal.. */
00329         status = sys$search(&Fab);
00330     }
00331 } /* end function VMSmunch() */
00332
00333
00334
00335
00336
00337 /***********************/
00338 /*  Function bintim()  */
00339 /***********************/
00340
00341 void asctim(time,binval)   /* convert 64-bit binval to string, put in time */
00342     char *time;
00343     long int binval[2];
00344 {
00345     static struct dsc$descriptor date_str={23,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
00346       /* dsc$w_length, dsc$b_dtype, dsc$b_class, dsc$a_pointer */
00347
00348     date_str.dsc$a_pointer = time;
00349     sys$asctim(0, &date_str, binval, 0);
00350     time[23] = '\0';
00351 }
00352
00353
00354
00355
00356
00357 /***********************/
00358 /*  Function bintim()  */
00359 /***********************/
00360
00361 void bintim(time,binval)   /* convert time string to 64 bits, put in binval */
00362     char *time;
00363     long int binval[2];
00364 {
00365     static struct dsc$descriptor date_str={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,0};
00366
00367     date_str.dsc$w_length = strlen(time);
00368     date_str.dsc$a_pointer = time;
00369     sys$bintim(&date_str, binval);
00370 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/vmsmunch.h Source File

cvs-1.10/vms/vmsmunch.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------
00002
00003   VMSmunch.h
00004
00005   A few handy #defines, plus the contents of three header files from Joe
00006   Meadows' FILE program.  Used by VMSmunch and by various routines which
00007   call VMSmunch (e.g., in Zip and UnZip).
00008
00009     02-Apr-1994 Jamie Hanrahan  jeh@cmkrnl.com
00010             Moved definition of VMStimbuf struct from vmsmunch.c
00011             to here.
00012
00013     06-Apr-1994 Jamie Hanrahan  jeh@cmkrnl.com
00014             Moved "contents of three header files" (not needed by
00015             callers of vmsmunch) to vmsmunch_private.h .
00016
00017     07-Apr-1994 Richard Levitte levitte@e.kth.se
00018             Inserted a forward declaration of VMSmunch.
00019   ---------------------------------------------------------------------------*/
00020
00021 #define GET_TIMES       4
00022 #define SET_TIMES       0
00023 #define GET_RTYPE       1
00024 #define CHANGE_RTYPE    2
00025 #define RESTORE_RTYPE   3
00026
00027 struct VMStimbuf {      /* VMSmunch */
00028     char *actime;       /* VMS revision date, ASCII format */
00029     char *modtime;      /* VMS creation date, ASCII format */
00030 };
00031
00032 extern int VMSmunch();
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/vmsmunch_private.h Source File

cvs-1.10/vms/vmsmunch_private.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------
00002
00003   VMSmunch_private.h
00004
00005   Contents of three header files from Joe
00006   Meadows' FILE program.  Used by VMSmunch
00007
00008     06-Apr-1994 Jamie Hanrahan  jeh@cmkrnl.com
00009             Moved "contents of three header files" from
00010             vmsmunch.h to vmsmunch_private.h .
00011   ---------------------------------------------------------------------------*/
00012
00013 /*---------------------------------------------------------------------------
00014     fatdef.h
00015   ---------------------------------------------------------------------------*/
00016
00017 /* This header file was created by Joe Meadows, and is not copyrighted
00018    in any way. No guarantee is made as to the accuracy of the contents
00019    of this header file. This header file was last modified on Sep. 22th,
00020    1987. (Modified to include this statement) */
00021 #define FAT$K_LENGTH 32
00022 #define FAT$C_LENGTH 32
00023 #define FAT$S_FATDEF 32
00024
00025 struct fatdef {
00026   union  {
00027     unsigned char fat$b_rtype;
00028     struct  {
00029       unsigned fat$v_rtype : 4;
00030       unsigned fat$v_fileorg : 4;
00031     } fat$r_rtype_bits;
00032   } fat$r_rtype_overlay;
00033 # define FAT$S_RTYPE 4
00034 # define FAT$V_RTYPE 0
00035 #   define FAT$C_UNDEFINED 0
00036 #   define FAT$C_FIXED 1
00037 #   define FAT$C_VARIABLE 2
00038 #   define FAT$C_VFC 3
00039 #   define FAT$C_STREAM 4
00040 #   define FAT$C_STREAMLF 5
00041 #   define FAT$C_STREAMCR 6
00042 # define FAT$S_FILEORG 4
00043 # define FAT$V_FILEORG 4
00044 #   define FAT$C_SEQUENTIAL 0
00045 #   define FAT$C_RELATIVE 1
00046 #   define FAT$C_INDEXED 2
00047 #   define FAT$C_DIRECT 3
00048   union  {
00049     unsigned char fat$b_rattrib;
00050     struct  {
00051       unsigned fat$v_fortrancc : 1;
00052       unsigned fat$v_impliedcc : 1;
00053       unsigned fat$v_printcc : 1;
00054       unsigned fat$v_nospan : 1;
00055     } fat$r_rattrib_bits;
00056   } fat$r_rattrib_overlay;
00057 #   define FAT$V_FORTRANCC 0
00058 #   define FAT$M_FORTRANCC 1
00059 #   define FAT$V_IMPLIEDCC 1
00060 #   define FAT$M_IMPLIEDCC 2
00061 #   define FAT$V_PRINTCC 2
00062 #   define FAT$M_PRINTCC 4
00063 #   define FAT$V_NOSPAN 3
00064 #   define FAT$M_NOSPAN 8
00065   unsigned short int fat$w_rsize;
00066   union
00067   {
00068     unsigned long int fat$l_hiblk;
00069     struct
00070     {
00071       unsigned short int fat$w_hiblkh;
00072       unsigned short int fat$w_hiblkl;
00073     } fat$r_hiblk_fields;
00074   } fat$r_hiblk_overlay;
00075   union
00076   {
00077     unsigned long int fat$l_efblk;
00078     struct
00079     {
00080       unsigned short int fat$w_efblkh;
00081       unsigned short int fat$w_efblkl;
00082     } fat$r_efblk_fields;
00083   } fat$r_efblk_overlay;
00084   unsigned short int fat$w_ffbyte;
00085   unsigned char fat$b_bktsize;
00086   unsigned char fat$b_vfcsize;
00087   unsigned short int fat$w_maxrec;
00088   unsigned short int fat$w_defext;
00089   unsigned short int fat$w_gbc;
00090   char fat$fill[8];
00091   unsigned short int fat$w_versions;
00092 };
00093
00094 /*---------------------------------------------------------------------------
00095     fchdef.h
00096   ---------------------------------------------------------------------------*/
00097
00098 /* This header file was created by Joe Meadows, and is not copyrighted
00099    in any way. No guarantee is made as to the accuracy of the contents
00100    of this header file. This header file was last modified on Sep. 22th,
00101    1987. (Modified to include this statement) */
00102
00103 #define FCH$V_BADACL 0x00B
00104 #define FCH$M_BADACL (1 << FCH$V_ACL)
00105 #define FCH$V_BADBLOCK 0x00E
00106 #define FCH$M_BADBLOCK (1 << FCH$V_BADBLOCK)
00107 #define FCH$V_CONTIG 0x007
00108 #define FCH$M_CONTIG (1 << FCH$V_CONTIG)
00109 #define FCH$V_CONTIGB 0x005
00110 #define FCH$M_CONTIGB (1 << FCH$V_CONTIGB)
00111 #define FCH$V_DIRECTORY 0x00D
00112 #define FCH$M_DIRECTORY (1 << FCH$V_DIRECTORY)
00113 #define FCH$V_ERASE 0x011
00114 #define FCH$M_ERASE (1 << FCH$V_ERASE)
00115 #define FCH$V_LOCKED 0x006
00116 #define FCH$M_LOCKED (1 << FCH$V_LOCKED)
00117 #define FCH$V_MARKDEL 0x00F
00118 #define FCH$M_MARKDEL (1 << FCH$V_MARKDEL)
00119 #define FCH$V_NOBACKUP 0x001
00120 #define FCH$M_NOBACKUP (1 << FCH$V_NOBACKUP)
00121 #define FCH$V_NOCHARGE 0x010
00122 #define FCH$M_NOCHARGE (1 << FCH$V_NOCHARGE)
00123 #define FCH$V_READCHECK 0x003
00124 #define FCH$M_READCHECK (1 << FCH$V_READCHECK)
00125 #define FCH$V_SPOOL 0x00C
00126 #define FCH$M_SPOOL (1 << FCH$V_SPOOL)
00127 #define FCH$V_WRITCHECK 0x004
00128 #define FCH$M_WRITCHECK (1 << FCH$V_WRITCHECK)
00129 #define FCH$V_WRITEBACK 0x002
00130 #define FCH$M_WRITEBACK (1 << FCH$V_WRITEBACK)
00131
00132 struct fchdef  {
00133   unsigned : 1;
00134   unsigned fch$v_nobackup : 1 ;
00135   unsigned fch$v_writeback : 1;
00136   unsigned fch$v_readcheck : 1;
00137   unsigned fch$v_writcheck : 1;
00138   unsigned fch$v_contigb : 1;
00139   unsigned fch$v_locked : 1;
00140   unsigned fch$v_contig : 1;
00141   unsigned : 3;
00142   unsigned fch$v_badacl : 1;
00143   unsigned fch$v_spool : 1;
00144   unsigned fch$v_directory : 1;
00145   unsigned fch$v_badblock : 1;
00146   unsigned fch$v_markdel : 1;
00147   unsigned fch$v_nocharge : 1;
00148   unsigned fch$v_erase : 1;
00149 };
00150
00151 /*---------------------------------------------------------------------------
00152     fjndef.h
00153   ---------------------------------------------------------------------------*/
00154
00155 /* This header file was created by Joe Meadows, and is not copyrighted
00156    in any way. No guarantee is made as to the accuracy of the contents
00157    of this header file. This header file was last modified on Sep. 22th,
00158    1987. (Modified to include this statement) */
00159
00160 #define FJN$M_ONLY_RU 1
00161 #define FJN$M_RUJNL 2
00162 #define FJN$M_BIJNL 4
00163 #define FJN$M_AIJNL 8
00164 #define FJN$M_ATJNL 16
00165 #define FJN$M_NEVER_RU 32
00166 #define FJN$M_JOURNAL_FILE 64
00167 #define FJN$S_FJNDEF 1
00168 struct fjndef  {
00169   unsigned fjn$v_only_ru : 1;
00170   unsigned fjn$v_rujnl : 1;
00171   unsigned fjn$v_bijnl : 1;
00172   unsigned fjn$v_aijnl : 1;
00173   unsigned fjn$v_atjnl : 1;
00174   unsigned fjn$v_never_ru : 1;
00175   unsigned fjn$v_journal_file:1;
00176 } ;
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


stat.c File Reference

cvs-1.10/vms/stat.c File Reference

#include <string.h>
#include <stat.h>
#include <unixlib.h>

Include dependency graph for stat.c:

Include dependency graph

Go to the source code of this file.

Functions

int | wrapped_stat (path, buffer) const char *path

Variables

stat * | buffer

Function Documentation

int wrapped_stat | ( | path | ,
 |  | buffer |
 | ) | const

Variable Documentation

struct stat* buffer

Definition at line 7 of file stat.c.

Referenced by depth().

Generated on Sun Oct 21 12:43:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


unlink.c File Reference

cvs-1.10/vms/unlink.c File Reference

#include <unixio.h>

Include dependency graph for unlink.c:

Include dependency graph

Go to the source code of this file.

Functions

int | unlink (char *path)
int | link (char *from, char *to)

Function Documentation

int link | ( | char * | from,
 |  | char * | to
 | ) |

Definition at line 15 of file unlink.c.

00016 {
00017   int rs = -1;
00018
00019   /* Link always fails */
00020
00021   return rs;
00022 }

int unlink ( char * path )

Definition at line 5 of file unlink.c.

00006 {
00007   int rs, junk_rs;
00008
00009   rs = remove(path);
00010   while(remove(path) >= 0);
00011
00012   return rs;
00013 }

Generated on Sun Oct 21 12:43:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


utime.c File Reference

cvs-1.10/vms/utime.c File Reference

#include <ctype.h>
#include <time.h>
#include "vmsmunch.h"

Include dependency graph for utime.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | utimbuf

Defines

#define | ASCTIMEMAX 23

Functions

utime (file, buf) char *file

Variables

utimbuf * buf

Define Documentation

#define ASCTIMEMAX 23

Definition at line 7 of file utime.c.

Function Documentation

utime | ( | file | ,
 |  | buf |
 | ) |

Variable Documentation

struct utimbuf* buf

Definition at line 16 of file utime.c.

Generated on Sun Oct 21 12:43:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


vms-types.h File Reference

cvs-1.10/vms/vms-types.h File Reference

#include <stddef.h>

Include dependency graph for vms-types.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | EXHCB
struct | IOSB
struct | list3
struct | LOCK

Defines

#define | __types_loaded__ 1

Define Documentation

#define __types_loaded__ 1

Definition at line 2 of file vms-types.h.

Generated on Sun Oct 21 12:43:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


vms.h File Reference

cvs-1.10/vms/vms.h File Reference

#include <sys/types.h>
#include <unixio.h>
#include <unixlib.h>
#include <stdlib.h>
#include <processes.h>
#include <socket.h>
#include "ndir.h"
#include "pwd.h"
#include "pipe.h"

Include dependency graph for vms.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | mode_t unsigned int
#define | fork(x) vfork(x)
#define | STDIN_FILENO 0
#define | STDOUT_FILENO 1
#define | STDERR_FILENO 2
#define | stat(a, b) wrapped_stat(a, b)

Functions

int | fnmatch (char *pattern, char *string, int options)
int | unlink (char *path)
int | link (char *from, char *to)

Define Documentation

#define STDERR_FILENO 2

Definition at line 16 of file vms.h.

#define STDIN_FILENO 0

Definition at line 14 of file vms.h.

#define STDOUT_FILENO 1

Definition at line 15 of file vms.h.

#define fork ( x ) vfork(x)

Definition at line 5 of file vms.h.

Referenced by cvs_process_open(), and to().

#define mode_t unsigned int

Definition at line 3 of file vms.h.

#define stat | ( | a,
 |  | b | ) | wrapped_stat(a, b)

Definition at line 32 of file vms.h.

Function Documentation

int fnmatch | ( | char * | pattern,
 |  | char * | string,
 |  | int | options
 | ) |

int link | ( | char * | from,
 |  | char * | to
 | ) |

Definition at line 15 of file unlink.c.

Referenced by to().

00016 {
00017   int rs = -1;
00018
00019   /* Link always fails */
00020
00021   return rs;
00022 }

int unlink ( char * path )

Generated on Sun Oct 21 12:43:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


vmsmunch.c File Reference

cvs-1.10/vms/vmsmunch.c File Reference

#include <descrip.h>
#include <rms.h>
#include <stdio.h>
#include <iodef.h>
#include <string.h>
#include <starlet.h>
#include <atrdef.h>
#include <fibdef.h>
#include "VMSmunch.h"
#include "VMSmunch_private.h"

Include dependency graph for vmsmunch.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | RTYPE fat$r_rtype_overlay.fat$r_rtype_bits
#define | RATTRIB fat$r_rattrib_overlay.fat$r_rattrib_bits
#define | SS $_NORMAL 1
#define | SS $_BADPARAM 20

Functions

void | asctim ()
void | bintim ()
int | VMSmunch (filename, action, ptr) char *filename,*ptr

Variables

int | action
long int | binval [2]

Define Documentation

#define RATTRIB fat$r_rattrib_overlay.fat$r_rattrib_bits

Definition at line 93 of file vmsmunch.c.

#define RTYPE fat$r_rtype_overlay.fat$r_rtype_bits

Definition at line 92 of file vmsmunch.c.

#define SS $_BADPARAM 20

Definition at line 101 of file vmsmunch.c.

#define SS $_NORMAL 1

Definition at line 101 of file vmsmunch.c.

Function Documentation

int VMSmunch | ( | filename | ,
 |  | action | ,
 |  | ptr |
 | ) |

void asctim ( ) [static]

void bintim ( ) [static]

Variable Documentation

int action

Definition at line 114 of file vmsmunch.c.

long int binval

Definition at line 363 of file vmsmunch.c.

Generated on Sun Oct 21 12:43:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


vmsmunch.h File Reference

cvs-1.10/vms/vmsmunch.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | VMStimbuf

Defines

#define | GET_TIMES 4
#define | SET_TIMES 0
#define | GET_RTYPE 1
#define | CHANGE_RTYPE 2
#define | RESTORE_RTYPE 3

Functions

int | VMSmunch ()

Define Documentation

#define CHANGE_RTYPE 2

Definition at line 24 of file vmsmunch.h.

#define GET_RTYPE 1

Definition at line 23 of file vmsmunch.h.

#define GET_TIMES 4

Definition at line 21 of file vmsmunch.h.

#define RESTORE_RTYPE 3

Definition at line 25 of file vmsmunch.h.

#define SET_TIMES 0

Definition at line 22 of file vmsmunch.h.

Function Documentation

int VMSmunch ( )

Generated on Sun Oct 21 12:43:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


vmsmunch_private.h File Reference

cvs-1.10/vms/vmsmunch_private.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | fatdef
struct | fchdef
struct | fjndef

Defines

#define | FAT $K_LENGTH 32
#define | FAT $C_LENGTH 32
#define | FAT $S_FATDEF 32
#define | FAT $S_RTYPE 4
#define | FAT $V_RTYPE 0
#define | FAT $C_UNDEFINED 0
#define | FAT $C_FIXED 1
#define | FAT $C_VARIABLE 2
#define | FAT $C_VFC 3
#define | FAT $C_STREAM 4
#define | FAT $C_STREAMLF 5
#define | FAT $C_STREAMCR 6
#define | FAT $S_FILEORG 4
#define | FAT $V_FILEORG 4
#define | FAT $C_SEQUENTIAL 0
#define | FAT $C_RELATIVE 1
#define | FAT $C_INDEXED 2
#define | FAT $C_DIRECT 3
#define | FAT $V_FORTRANCC 0
#define | FAT $M_FORTRANCC 1
#define | FAT $V_IMPLIEDCC 1
#define | FAT $M_IMPLIEDCC 2
#define | FAT $V_PRINTCC 2
#define | FAT $M_PRINTCC 4
#define | FAT $V_NOSPAN 3
#define | FAT $M_NOSPAN 8
#define | FCH $V_BADACL 0x00B
#define | FCH $M_BADACL (1 << FCH$V_ACL)
#define | FCH $V_BADBLOCK 0x00E
#define | FCH $M_BADBLOCK (1 << FCH$V_BADBLOCK)
#define | FCH $V_CONTIG 0x007
#define | FCH $M_CONTIG (1 << FCH$V_CONTIG)
#define | FCH $V_CONTIGB 0x005
#define | FCH $M_CONTIGB (1 << FCH$V_CONTIGB)
#define | FCH $V_DIRECTORY 0x00D
#define | FCH $M_DIRECTORY (1 << FCH$V_DIRECTORY)
#define | FCH $V_ERASE 0x011
#define | FCH $M_ERASE (1 << FCH$V_ERASE)
#define | FCH $V_LOCKED 0x006
#define | FCH $M_LOCKED (1 << FCH$V_LOCKED)
#define | FCH $V_MARKDEL 0x00F
#define | FCH $M_MARKDEL (1 << FCH$V_MARKDEL)
#define | FCH $V_NOBACKUP 0x001
#define | FCH $M_NOBACKUP (1 << FCH$V_NOBACKUP)
#define | FCH $V_NOCHARGE 0x010
#define | FCH $M_NOCHARGE (1 << FCH$V_NOCHARGE)
#define | FCH $V_READCHECK 0x003
#define | FCH $M_READCHECK (1 << FCH$V_READCHECK)
#define | FCH $V_SPOOL 0x00C
#define | FCH $M_SPOOL (1 << FCH$V_SPOOL)
#define | FCH $V_WRITCHECK 0x004
#define | FCH $M_WRITCHECK (1 << FCH$V_WRITCHECK)
#define | FCH $V_WRITEBACK 0x002
#define | FCH $M_WRITEBACK (1 << FCH$V_WRITEBACK)
#define | FJN $M_ONLY_RU 1
#define | FJN $M_RUJNL 2
#define | FJN $M_BIJNL 4
#define | FJN $M_AIJNL 8
#define | FJN $M_ATJNL 16
#define | FJN $M_NEVER_RU 32
#define | FJN $M_JOURNAL_FILE 64
#define | FJN $S_FJNDEF 1

Define Documentation

#define FAT $M_NOSPAN 8

Definition at line 64 of file vmsmunch_private.h.

#define FAT $V_NOSPAN 3

Definition at line 64 of file vmsmunch_private.h.

#define FAT $M_PRINTCC 4

Definition at line 64 of file vmsmunch_private.h.

#define FAT $V_PRINTCC 2

Definition at line 64 of file vmsmunch_private.h.

#define FAT $M_IMPLIEDCC 2

Definition at line 64 of file vmsmunch_private.h.

#define FAT $V_IMPLIEDCC 1

Definition at line 64 of file vmsmunch_private.h.

#define FAT $M_FORTRANCC 1

Definition at line 64 of file vmsmunch_private.h.

#define FAT $V_FORTRANCC 0

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_DIRECT 3

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_INDEXED 2

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_RELATIVE 1

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_SEQUENTIAL 0

Definition at line 64 of file vmsmunch_private.h.

#define FAT $V_FILEORG 4

Definition at line 64 of file vmsmunch_private.h.

#define FAT $S_FILEORG 4

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_STREAMCR 6

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_STREAMLF 5

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_STREAM 4

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_VFC 3

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_VARIABLE 2

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_FIXED 1

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_UNDEFINED 0

Definition at line 64 of file vmsmunch_private.h.

#define FAT $V_RTYPE 0

Definition at line 64 of file vmsmunch_private.h.

#define FAT $S_RTYPE 4

Definition at line 64 of file vmsmunch_private.h.

#define FAT $S_FATDEF 32

Definition at line 64 of file vmsmunch_private.h.

#define FAT $C_LENGTH 32

Definition at line 64 of file vmsmunch_private.h.

#define FAT $K_LENGTH 32

Definition at line 64 of file vmsmunch_private.h.

#define FCH $M_WRITEBACK (1 << FCH$V_WRITEBACK)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_WRITEBACK 0x002

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_WRITCHECK (1 << FCH$V_WRITCHECK)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_WRITCHECK 0x004

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_SPOOL (1 << FCH$V_SPOOL)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_SPOOL 0x00C

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_READCHECK (1 << FCH$V_READCHECK)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_READCHECK 0x003

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_NOCHARGE (1 << FCH$V_NOCHARGE)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_NOCHARGE 0x010

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_NOBACKUP (1 << FCH$V_NOBACKUP)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_NOBACKUP 0x001

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_MARKDEL (1 << FCH$V_MARKDEL)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_MARKDEL 0x00F

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_LOCKED (1 << FCH$V_LOCKED)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_LOCKED 0x006

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_ERASE (1 << FCH$V_ERASE)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_ERASE 0x011

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_DIRECTORY (1 << FCH$V_DIRECTORY)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_DIRECTORY 0x00D

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_CONTIGB (1 << FCH$V_CONTIGB)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_CONTIGB 0x005

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_CONTIG (1 << FCH$V_CONTIG)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_CONTIG 0x007

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_BADBLOCK (1 << FCH$V_BADBLOCK)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_BADBLOCK 0x00E

Definition at line 130 of file vmsmunch_private.h.

#define FCH $M_BADACL (1 << FCH$V_ACL)

Definition at line 130 of file vmsmunch_private.h.

#define FCH $V_BADACL 0x00B

Definition at line 130 of file vmsmunch_private.h.

#define FJN $S_FJNDEF 1

Definition at line 167 of file vmsmunch_private.h.

#define FJN $M_JOURNAL_FILE 64

Definition at line 167 of file vmsmunch_private.h.

#define FJN $M_NEVER_RU 32

Definition at line 167 of file vmsmunch_private.h.

#define FJN $M_ATJNL 16

Definition at line 167 of file vmsmunch_private.h.

#define FJN $M_AIJNL 8

Definition at line 167 of file vmsmunch_private.h.

#define FJN $M_BIJNL 4

Definition at line 167 of file vmsmunch_private.h.

#define FJN $M_RUJNL 2

Definition at line 167 of file vmsmunch_private.h.

#define FJN $M_ONLY_RU 1

Definition at line 167 of file vmsmunch_private.h.

Generated on Sun Oct 21 12:43:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


waitpid.c File Reference

cvs-1.10/vms/waitpid.c File Reference

#include "vms.h"

Include dependency graph for waitpid.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | WAITPID_CHILDREN 8

Functions

int | waitpid (pid, stat_loc, options) int pid

Variables

int | waited_pid [8]
int | waited_status [8]
int * | stat_loc
int | options

Define Documentation

#define WAITPID_CHILDREN 8

Definition at line 18 of file waitpid.c.

Function Documentation

int waitpid | ( | pid | ,
 |  | stat_loc | ,
 |  | options |
 | ) |

Variable Documentation

int options

Definition at line 26 of file waitpid.c.

int* stat_loc

Definition at line 25 of file waitpid.c.

int waited_pid[ 8 ] [static]

Definition at line 19 of file waitpid.c.

int waited_status[ 8 ] [static]

Definition at line 20 of file waitpid.c.

Generated on Sun Oct 21 12:43:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/vms/waitpid.c Source File

cvs-1.10/vms/waitpid.c

Go to the documentation of this file.
00001 /* Emulate waitpid on systems that just have wait.
00002    Copyright (C) 1994 Free Software Foundation, Inc.
00003
00004 This file is part of GNU DIFF.
00005
00006 GNU DIFF is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010
00011 GNU DIFF is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.  */
00015
00016 #include "vms.h"
00017
00018 #define WAITPID_CHILDREN 8
00019 static pid_t waited_pid[WAITPID_CHILDREN];
00020 static int waited_status[WAITPID_CHILDREN];
00021
00022 pid_t
00023 waitpid (pid, stat_loc, options)
00024      pid_t pid;
00025      int *stat_loc;
00026      int options;
00027 {
00028   int i;
00029   pid_t p;
00030
00031   if (!options  &&  (0 < pid || pid == -1))
00032     {
00033       /* If we have already waited for this child, return it immediately.  */
00034       for (i = 0;  i < WAITPID_CHILDREN;  i++)
00035     {
00036       p = waited_pid[i];
00037       if (p  &&  (p == pid  ||  pid == -1))
00038         {
00039           waited_pid[i] = 0;
00040           goto success;
00041         }
00042     }
00043
00044       /* The child has not returned yet; wait for it, accumulating status.  */
00045       for (i = 0;  i < WAITPID_CHILDREN;  i++)
00046     if (! waited_pid[i])
00047       {
00048         p = wait (&waited_status[i]);
00049         if (p < 0)
00050           return p;
00051         if (p == pid  ||  pid == -1)
00052           goto success;
00053         waited_pid[i] = p;
00054       }
00055     }
00056
00057   /* We cannot emulate this wait call, e.g. because of too many children.  */
00058   abort ();
00059
00060 success:
00061   if (stat_loc)
00062     *stat_loc = waited_status[i];
00063   return p;
00064 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


config.h File Reference

cvs-1.10/windows-NT/config.h File Reference

#include <sys/stat.h>

Include dependency graph for config.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | wnt_stat

Defines

#define | gid_t int
#define | HAVE_LONG_FILE_NAMES 1
#define | HAVE_UTIME_NULL 1
#define | UTIME_EXPECTS_WRITABLE
#define | mode_t int
#define | pid_t int
#define | RETSIGTYPE void
#define | STAT_MACROS_BROKEN 1
#define | STDC_HEADERS 1
#define | uid_t int
#define | CLIENT_SUPPORT
#define | HAVE_CONNECT
#define | HAVE_FTIME 1
#define | HAVE_PUTENV 1
#define | HAVE_VPRINTF 1
#define | HAVE_DIRECT_H 1
#define | HAVE_ERRNO_H 1
#define | HAVE_FCNTL_H 1
#define | HAVE_IO_H 1
#define | HAVE_MEMORY_H 1
#define | HAVE_NDIR_H 1
#define | HAVE_STRING_H 1
#define | HAVE_SYS_TIMEB_H 1
#define | CVS_MKDIR wnt_mkdir
#define | CVS_STAT wnt_stat
#define | CVS_LSTAT wnt_lstat
#define | CVS_RENAME wnt_rename
#define | USE_PROTOTYPES 1
#define | popen _popen
#define | pclose _pclose
#define | USE_SETMODE_STDOUT 1
#define | HAVE_SETMODE 1
#define | same_file(s, t) (-1)
#define | DEVNULL "nul"
#define | RSH_NOT_TRANSPARENT 1
#define | START_SERVER wnt_start_server
#define | SHUTDOWN_SERVER wnt_shutdown_server
#define | SYSTEM_INITIALIZE(pargc, pargv) init_winsock(pargc,pargv)
#define | SYSTEM_CLEANUP() wnt_cleanup()
#define | HAVE_WINSOCK_H
#define | NO_SOCKET_TO_FD 1
#define | SOCK_ERRNO (WSAGetLastError ())
#define | SOCK_STRERROR sock_strerror
#define | START_SERVER_RETURNS_SOCKET 1
#define | SEND_NEVER_PARTIAL 1
#define | HAVE_TZSET
#define | REGEX_MALLOC 1
#define | _REGEX_RE_COMP 1
#define | DIRTY_MODDATE
#define | DO_NOT_LOCK_DIRTY
#define | STRATA_HACK
#define | fstat wnt_fstat
#define | stat wnt_stat

Functions

int | wnt_mkdir (const char *PATH, int MODE)
int | wnt_stat ()
int | wnt_lstat ()
int | wnt_rename (const char *, const char *)
int | readlink (char *path, char *buf, int buf_size)
int | getpid (void)
unsigned int | sleep (unsigned int)
void | wnt_start_server (int *tofd, int *fromfd, char *client_user, char *server_user, char *server_host, char *server_cvsroot)
void | wnt_shutdown_server (int fd)
void | init_winsock (int *argc, char ***argv)
void | wnt_cleanup (void)
char * | sock_strerror (int errnum)
int | wnt_stat (const char *name, struct wnt_stat *buf)
int | wnt_fstat (int fildes, struct wnt_stat *buf)
int | wnt_lstat (const char *name, struct wnt_stat *buf)

Define Documentation

#define CLIENT_SUPPORT

Definition at line 115 of file config.h.

#define CVS_LSTAT wnt_lstat

Definition at line 257 of file config.h.

#define CVS_MKDIR wnt_mkdir

Definition at line 253 of file config.h.

#define CVS_RENAME wnt_rename

Definition at line 260 of file config.h.

#define CVS_STAT wnt_stat

Definition at line 255 of file config.h.

#define DEVNULL "nul"

Definition at line 295 of file config.h.

#define DIRTY_MODDATE

Definition at line 355 of file config.h.

#define DO_NOT_LOCK_DIRTY

Definition at line 356 of file config.h.

#define HAVE_CONNECT

Definition at line 126 of file config.h.

#define HAVE_DIRECT_H 1

Definition at line 182 of file config.h.

#define HAVE_ERRNO_H 1

Definition at line 189 of file config.h.

#define HAVE_FCNTL_H 1

Definition at line 192 of file config.h.

#define HAVE_FTIME 1

Definition at line 138 of file config.h.

#define HAVE_IO_H 1

Definition at line 197 of file config.h.

#define HAVE_LONG_FILE_NAMES 1

Definition at line 43 of file config.h.

#define HAVE_MEMORY_H 1

Definition at line 200 of file config.h.

#define HAVE_NDIR_H 1

Definition at line 206 of file config.h.

#define HAVE_PUTENV 1

Definition at line 150 of file config.h.

#define HAVE_SETMODE 1

Definition at line 286 of file config.h.

#define HAVE_STRING_H 1

Definition at line 209 of file config.h.

#define HAVE_SYS_TIMEB_H 1

Definition at line 230 of file config.h.

#define HAVE_TZSET

Definition at line 347 of file config.h.

#define HAVE_UTIME_NULL 1

Definition at line 52 of file config.h.

#define HAVE_VPRINTF 1

Definition at line 178 of file config.h.

#define HAVE_WINSOCK_H

Definition at line 314 of file config.h.

#define NO_SOCKET_TO_FD 1

Definition at line 319 of file config.h.

#define REGEX_MALLOC 1

Definition at line 351 of file config.h.

#define RETSIGTYPE void

Definition at line 84 of file config.h.

#define RSH_NOT_TRANSPARENT 1

Definition at line 299 of file config.h.

#define SEND_NEVER_PARTIAL 1

Definition at line 344 of file config.h.

#define SHUTDOWN_SERVER wnt_shutdown_server

Definition at line 307 of file config.h.

#define SOCK_ERRNO (WSAGetLastError ())

Definition at line 325 of file config.h.

#define SOCK_STRERROR sock_strerror

Definition at line 331 of file config.h.

#define START_SERVER wnt_start_server

Definition at line 306 of file config.h.

#define START_SERVER_RETURNS_SOCKET 1

Definition at line 338 of file config.h.

#define STAT_MACROS_BROKEN 1

Definition at line 93 of file config.h.

#define STDC_HEADERS 1

Definition at line 97 of file config.h.

#define STRATA_HACK

Definition at line 359 of file config.h.

#define SYSTEM_CLEANUP ( ) wnt_cleanup()

Definition at line 311 of file config.h.

#define SYSTEM_INITIALIZE | ( | pargc,
 |  | pargv | ) | init_winsock(pargc,pargv)

Definition at line 309 of file config.h.

#define USE_PROTOTYPES 1

Definition at line 271 of file config.h.

#define USE_SETMODE_STDOUT 1

Definition at line 283 of file config.h.

#define UTIME_EXPECTS_WRITABLE

Definition at line 56 of file config.h.

#define _REGEX_RE_COMP 1

Definition at line 352 of file config.h.

#define fstat wnt_fstat

Definition at line 380 of file config.h.

#define gid_t int

Definition at line 39 of file config.h.

#define mode_t int

Definition at line 63 of file config.h.

#define pclose _pclose

Definition at line 279 of file config.h.

#define pid_t int

Definition at line 70 of file config.h.

#define popen _popen

Definition at line 278 of file config.h.

Referenced by depth().

#define same_file | ( | s,
 |  | t | ) | (-1)

Definition at line 292 of file config.h.

#define stat wnt_stat

Definition at line 382 of file config.h.

#define uid_t int

Definition at line 105 of file config.h.

Function Documentation

int getpid ( void )

Definition at line 166 of file win32.c.

00167 {
00168     return (pid_t) GetCurrentProcessId();
00169 }

void init_winsock | ( | int * | argc,
 |  | char *** | argv
 | ) |

Definition at line 98 of file win32.c.

00099 {
00100     WSADATA data;
00101
00102     if (WSAStartup (MAKEWORD (1, 1), &data))
00103     {
00104     fprintf (stderr, "cvs: unable to initialize winsock\n");
00105     exit (1);
00106     }
00107 }

int readlink | ( | char * | path,
 |  | char * | buf,
 |  | int | buf_size
 | ) |

Definition at line 1 of file readlink.c.

00002 {
00003   /* OpenVMS dosen't have symbolic links in the UNIX sense */
00004   return -1;
00005 }

unsigned int sleep ( unsigned seconds )

Definition at line 128 of file win32.c.

00129 {
00130     Sleep(1000*seconds);
00131     return 0;
00132 }

char* sock_strerror ( int errnum )

Definition at line 124 of file sockerror.c.

00125 {
00126     static char buf[40];
00127     int i;
00128
00129     for (i = 0; i < (sizeof sock_errlist / sizeof *sock_errlist); i++)
00130     {
00131     if (errnum >= sock_errlist[i].first && errnum <= sock_errlist[i].last)
00132         return sock_errlist[i].strs[errnum - sock_errlist[i].first];
00133     }
00134     sprintf(buf, "Unknown socket error: %d", errnum);
00135     return buf;
00136 }

void wnt_cleanup ( void )

Definition at line 110 of file win32.c.

00111 {
00112     if (WSACleanup ())
00113     {
00114 #ifdef SERVER_ACTIVE
00115     if (server_active || error_use_protocol)
00116         /* FIXME: how are we supposed to report errors?  As of now
00117            (Sep 98), error() can in turn call us (if it is out of
00118            memory) and in general is built on top of lots of
00119            stuff.  */
00120         ;
00121     else
00122 #endif
00123         fprintf (stderr, "cvs: cannot WSACleanup: %s\n",
00124              sock_strerror (WSAGetLastError ()));
00125     }
00126 }

int wnt_fstat | ( | int | fildes,
 |  | struct wnt_stat * | buf
 | ) |

int wnt_lstat | ( | const char * | name,
 |  | struct wnt_stat * | buf
 | ) |

int wnt_lstat ( )

int wnt_mkdir | ( | const char * | path,
 |  | int | mode
 | ) |

Definition at line 9 of file mkdir.c.

00010 {
00011   /* This is true for all extant calls to CVS_MKDIR.  If
00012      someone adds a call that uses something else later,
00013      we should tweak this function to handle that.  */
00014   assert (mode == 0777);
00015
00016   return mkdir (path);
00017 }

int wnt_rename | ( | const char * | ,
 |  | const char * |
 | ) |

void wnt_shutdown_server ( int fd )

Definition at line 67 of file startserver.c.

00068 {
00069     if (opened_a_socket)
00070     {
00071     SOCKET s;
00072
00073     s = fd;
00074     if (shutdown (s, 2) == SOCKET_ERROR)
00075         error (1, 0, "couldn't shutdown server connection: %s",
00076            SOCK_STRERROR (SOCK_ERRNO));
00077     if (closesocket (s) == SOCKET_ERROR)
00078         error (1, 0, "couldn't close server connection: %s",
00079            SOCK_STRERROR (SOCK_ERRNO));
00080     }
00081     else
00082     {
00083     if (close (fd) < 0)
00084         error (1, errno, "cannot close server connection");
00085     }
00086 }

void wnt_start_server | ( | int * | tofd,
 |  | int * | fromfd,
 |  | char * | client_user,
 |  | char * | server_user,
 |  | char * | server_host,
 |  | char * | server_cvsroot
 | ) |

Definition at line 20 of file startserver.c.

00025 {
00026     char *cvs_server;
00027     char *command;
00028     struct servent *sptr;
00029     unsigned short port;
00030     int read_fd;
00031     char *portenv;
00032
00033     if (! (cvs_server = getenv ("CVS_SERVER")))
00034         cvs_server = "cvs";
00035     command = xmalloc (strlen (cvs_server)
00036                + strlen (server_cvsroot)
00037                + 50);
00038     sprintf (command, "%s -d %s server", cvs_server, server_cvsroot);
00039
00040     portenv = getenv("CVS_RCMD_PORT");
00041     if (portenv)
00042     port = atoi(portenv);
00043     else if ((sptr = getservbyname("shell", "tcp")) != NULL)
00044     port = sptr->s_port;
00045     else
00046     port = IPPORT_CMDSERVER; /* shell/tcp */
00047
00048     read_fd = rcmd (&server_host,
00049                     port,
00050                     client_user,
00051                 (server_user ? server_user : client_user),
00052                 command,
00053                 0);
00054     if (read_fd < 0)
00055     error (1, 0, "cannot start server via rcmd: %s",
00056            SOCK_STRERROR (SOCK_ERRNO));
00057
00058     *tofd = read_fd;
00059     *fromfd = read_fd;
00060     free (command);
00061
00062     opened_a_socket = 1;
00063 }

int wnt_stat | ( | const char * | name,
 |  | struct wnt_stat * | buf
 | ) |

int wnt_stat ( )

Generated on Sun Oct 21 12:42:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/config.h Source File

cvs-1.10/windows-NT/config.h

Go to the documentation of this file.
00001 #ifndef CONFIG__H
00002 #define CONFIG__H
00003 /* config.h --- configuration file for Windows NT
00004    Jim Blandy <jimb@cyclic.com> --- July 1995  */
00005
00006 /* cvs gui options */
00007 #ifdef CVSGUI
00008 #   ifdef _DEBUG
00009 #       define qCvsDebug 1
00010 #   else /* !_DEBUG */
00011 #       define qCvsDebug 0
00012 #   endif /* !_DEBUG */
00013 #   ifdef CVSGUI_PIPE
00014 #       include "cvsgui.h"
00015 #   endif
00016
00017     /* malloc.h is defining alloca _alloca */
00018 #   include <malloc.h>
00019 #endif /* CVSGUI */
00020
00021 /* This file lives in the windows-NT subdirectory, which is only included
00022    in your header search path if you're working under Microsoft Visual C++,
00023    and use ../cvsnt.mak for your project.  Thus, this is the right place to
00024    put configuration information for Windows NT.  */
00025
00026 /* Define if on AIX 3.
00027    System headers sometimes define this.
00028    We just want to avoid a redefinition error message.  */
00029 #undef _ALL_SOURCE
00030
00031 /* Define to empty if the keyword does not work.  */
00032 /* Const is working.  */
00033 #undef const
00034
00035 /* Define to `int' if <sys/types.h> doesn't define.  */
00036 /* Windows NT doesn't have gid_t.  It doesn't even really have group
00037    numbers, I think.  This will take more thought to get right, but
00038    let's get it running first.  */
00039 #define gid_t int
00040
00041 /* Define if you support file names longer than 14 characters.  */
00042 /* Yes.  Woo.  */
00043 #define HAVE_LONG_FILE_NAMES 1
00044
00045 /* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
00046 /* If POSIX.1 requires this, why doesn't WNT have it?  */
00047 #undef HAVE_SYS_WAIT_H
00048
00049 /* Define if utime(file, NULL) sets file's timestamp to the present.  */
00050 /* Experimentation says yes.  Wish I had the full documentation, but
00051    I have neither the CD-ROM nor a CD-ROM drive to put it in.  */
00052 #define HAVE_UTIME_NULL 1
00053
00054 /* On Windows NT, when a file is being watched, utime expects a file
00055    to be writable */
00056 #define UTIME_EXPECTS_WRITABLE
00057
00058 /* Define if on MINIX.  */
00059 /* Hah.  */
00060 #undef _MINIX
00061
00062 /* Define to `int' if <sys/types.h> doesn't define.  */
00063 #define mode_t int
00064
00065 /* Define to `int' if <sys/types.h> doesn't define.  */
00066 /* Under Windows NT, we use the process handle as the pid.
00067    We could #define pid_t to be HANDLE, but that would require
00068    us to #include <windows.h>, which I don't trust, and HANDLE
00069    is a pointer type anyway.  */
00070 #define pid_t int
00071
00072 /* Define if the system does not provide POSIX.1 features except
00073    with this defined.  */
00074 /* This string doesn't appear anywhere in the system header files,
00075    so I assume it's irrelevant.  */
00076 #undef _POSIX_1_SOURCE
00077
00078 /* Define if you need to in order for stat and other things to work.  */
00079 /* Same as for _POSIX_1_SOURCE, above.  */
00080 #undef _POSIX_SOURCE
00081
00082 /* Define as the return type of signal handlers (int or void).  */
00083 /* The manual says they return void.  */
00084 #define RETSIGTYPE void
00085
00086 /* Define to `unsigned' if <sys/types.h> doesn't define.  */
00087 /* sys/types.h doesn't define it, but stdio.h does, which cvs.h
00088    #includes, so things should be okay.  */
00089 /* #undef size_t */
00090
00091 /* Define if the `S_IS*' macros in <sys/stat.h> do not work properly.  */
00092 /* We don't seem to have them at all; let ../lib/system.h define them.  */
00093 #define STAT_MACROS_BROKEN 1
00094
00095 /* Define if you have the ANSI C header files.  */
00096 /* We'd damn well better.  */
00097 #define STDC_HEADERS 1
00098
00099 /* Define if you can safely include both <sys/time.h> and <time.h>.  */
00100 /* We don't have <sys/time.h> at all.  Why isn't there a definition
00101    for HAVE_SYS_TIME_H anywhere in config.h.in?  */
00102 #undef TIME_WITH_SYS_TIME
00103
00104 /* Define to `int' if <sys/types.h> doesn't define.  */
00105 #define uid_t int
00106
00107 /* Define if you have MIT Kerberos version 4 available.  */
00108 /* We don't.  Cygnus says they've ported it to Windows 3.1, but
00109    I don't know if that means that it works under Windows NT as
00110    well.  */
00111 #undef HAVE_KERBEROS
00112
00113 /* Define if you want CVS to be able to be a remote repository client.  */
00114 /* We just want the client stuff.  */
00115 #define CLIENT_SUPPORT
00116
00117 /* Define if you want CVS to be able to serve repositories to remote
00118    clients.  */
00119 /* No server support yet.  Note that you don't have to define
00120    CLIENT_SUPPORT or SERVER_SUPPORT to enable the non-remote code;
00121    that's always there.  */
00122 #undef SERVER_SUPPORT
00123
00124 /* Define if you have the connect function.  */
00125 /* Not used?  */
00126 #define HAVE_CONNECT
00127
00128 /* Define if you have the fchdir function.  */
00129 #undef HAVE_FCHDIR
00130
00131 /* Define if you have the fchmod function.  */
00132 #undef HAVE_FCHMOD
00133
00134 /* Define if you have the fsync function.  */
00135 #undef HAVE_FSYNC
00136
00137 /* Define if you have the ftime function.  */
00138 #define HAVE_FTIME 1
00139
00140 /* Define if you have the ftruncate function.  */
00141 #undef HAVE_FTRUNCATE
00142
00143 /* Define if you have the getpagesize function.  */
00144 #undef HAVE_GETPAGESIZE
00145
00146 /* Define if you have the krb_get_err_text function.  */
00147 #undef HAVE_KRB_GET_ERR_TEXT
00148
00149 /* Define if you have the putenv function.  */
00150 #define HAVE_PUTENV 1
00151
00152 /* Define if you have the sigaction function.  */
00153 #undef HAVE_SIGACTION
00154
00155 /* Define if you have the sigblock function.  */
00156 #undef HAVE_SIGBLOCK
00157
00158 /* Define if you have the sigprocmask function.  */
00159 #undef HAVE_SIGPROCMASK
00160
00161 /* Define if you have the sigsetmask function.  */
00162 #undef HAVE_SIGSETMASK
00163
00164 /* Define if you have the sigvec function.  */
00165 #undef HAVE_SIGVEC
00166
00167 /* Define if you have the timezone function.  */
00168 /* Hmm, I actually rather think it's an extern long
00169    variable; that message was mechanically generated
00170    by autoconf.  And I don't see any actual uses of
00171    this function in the code anyway, hmm.  */
00172 #undef HAVE_TIMEZONE
00173
00174 /* Define if you have the vfork function.  */
00175 #undef HAVE_VFORK
00176
00177 /* Define if you have the vprintf function.  */
00178 #define HAVE_VPRINTF 1
00179
00180 /* Define if you have the <direct.h> header file.  */
00181 /* Windows NT wants this for mkdir and friends.  */
00182 #define HAVE_DIRECT_H 1
00183
00184 /* Define if you have the <dirent.h> header file.  */
00185 /* No, but we have the <direct.h> header file...  */
00186 #undef HAVE_DIRENT_H
00187
00188 /* Define if you have the <errno.h> header file.  */
00189 #define HAVE_ERRNO_H 1
00190
00191 /* Define if you have the <fcntl.h> header file.  */
00192 #define HAVE_FCNTL_H 1
00193
00194 /* Define if you have the <io.h> header file.  */
00195 /* Apparently this is where Windows NT declares all the low-level
00196    Unix I/O routines like open and creat and stuff.  */
00197 #define HAVE_IO_H 1
00198
00199 /* Define if you have the <memory.h> header file.  */
00200 #define HAVE_MEMORY_H 1
00201
00202 /* Define if you have the <ndbm.h> header file.  */
00203 #undef HAVE_NDBM_H
00204
00205 /* Define if you have the <ndir.h> header file.  */
00206 #define HAVE_NDIR_H 1
00207
00208 /* Define if you have the <string.h> header file.  */
00209 #define HAVE_STRING_H 1
00210
00211 /* Define if you have the <sys/bsdtypes.h> header file.  */
00212 #undef HAVE_SYS_BSDTYPES_H
00213
00214 /* Define if you have the <sys/dir.h> header file.  */
00215 #undef HAVE_SYS_DIR_H
00216
00217 /* Define if you have the <sys/ndir.h> header file.  */
00218 #undef HAVE_SYS_NDIR_H
00219
00220 /* Define if you have the <sys/param.h> header file.  */
00221 #undef HAVE_SYS_PARAM_H
00222
00223 /* Define if you have the <sys/select.h> header file.  */
00224 #undef HAVE_SYS_SELECT_H
00225
00226 /* Define if you have the <sys/time.h> header file.  */
00227 #undef HAVE_SYS_TIME_H
00228
00229 /* Define if you have the <sys/timeb.h> header file.  */
00230 #define HAVE_SYS_TIMEB_H 1
00231
00232 /* Define if you have the <unistd.h> header file.  */
00233 #undef HAVE_UNISTD_H
00234
00235 /* Define if you have the <utime.h> header file.  */
00236 #undef HAVE_UTIME_H
00237
00238 /* Define if you have the inet library (-linet).  */
00239 #undef HAVE_LIBINET
00240
00241 /* Define if you have the nsl library (-lnsl).  */
00242 /* This is not used anywhere in the source code.  */
00243 #undef HAVE_LIBNSL
00244
00245 /* Define if you have the nsl_s library (-lnsl_s).  */
00246 #undef HAVE_LIBNSL_S
00247
00248 /* Define if you have the socket library (-lsocket).  */
00249 /* This isn't ever used either.  */
00250 #undef HAVE_LIBSOCKET
00251
00252 /* Under Windows NT, mkdir only takes one argument.  */
00253 #define CVS_MKDIR wnt_mkdir
00254 extern int wnt_mkdir (const char *PATH, int MODE);
00255 #define CVS_STAT wnt_stat
00256 extern int wnt_stat ();
00257 #define CVS_LSTAT wnt_lstat
00258 extern int wnt_lstat ();
00259
00260 #define CVS_RENAME wnt_rename
00261 extern int wnt_rename (const char *, const char *);
00262
00263 /* This function doesn't exist under Windows NT; we
00264    provide a stub.  */
00265 extern int readlink (char *path, char *buf, int buf_size);
00266
00267 /* This is just a call to GetCurrentProcessID.  */
00268 extern pid_t getpid (void);
00269
00270 /* We definitely have prototypes.  */
00271 #define USE_PROTOTYPES 1
00272
00273 /* This is just a call to the Win32 Sleep function.  */
00274 unsigned int sleep (unsigned int);
00275
00276 /* Don't worry, Microsoft, it's okay for these functions to
00277    be in our namespace.  */
00278 #define popen _popen
00279 #define pclose _pclose
00280
00281 /* When writing binary data to stdout, we better set
00282    stdout to binary mode using setmode.  */
00283 #define USE_SETMODE_STDOUT 1
00284
00285 /* Diff also has an ifdef for setmode, and it is HAVE_SETMODE.  */
00286 #define HAVE_SETMODE 1
00287
00288 /* Diff needs us to define this.  I think it could always be
00289    -1 for CVS, because we pass temporary files to diff, but
00290    config.h seems like the easiest place to put this, so for
00291    now we put it here.  */
00292 #define same_file(s,t) (-1)
00293
00294 /* This is where old bits go to die under Windows NT.  */
00295 #define DEVNULL "nul"
00296
00297 /* Don't use an rsh subprocess to connect to the server, because
00298    the rsh does inappropriate translations on the data (CR-LF/LF).  */
00299 #define RSH_NOT_TRANSPARENT 1
00300 extern void wnt_start_server (int *tofd, int *fromfd,
00301                   char *client_user,
00302                   char *server_user,
00303                   char *server_host,
00304                   char *server_cvsroot);
00305 extern void wnt_shutdown_server (int fd);
00306 #define START_SERVER wnt_start_server
00307 #define SHUTDOWN_SERVER wnt_shutdown_server
00308
00309 #define SYSTEM_INITIALIZE(pargc,pargv) init_winsock(pargc,pargv)
00310 extern void init_winsock(int *argc, char ***argv);
00311 #define SYSTEM_CLEANUP() wnt_cleanup()
00312 extern void wnt_cleanup (void);
00313
00314 #define HAVE_WINSOCK_H
00315
00316 /* This tells the client that it must use send()/recv() to talk to the
00317    server if it is connected to the server via a socket; Win95 needs
00318    it because _open_osfhandle doesn't work.  */
00319 #define NO_SOCKET_TO_FD 1
00320
00321 /* This tells the client that, in addition to needing to use
00322    send()/recv() to do socket I/O, the error codes for send()/recv()
00323    and other socket operations are not available through errno.
00324    Instead, this macro should be used to obtain an error code. */
00325 #define SOCK_ERRNO (WSAGetLastError ())
00326
00327 /* This tells the client that, in addition to needing to use
00328    send()/recv() to do socket I/O, the error codes for send()/recv()
00329    and other socket operations are not known to strerror.  Instead,
00330    this macro should be used to convert the error codes to strings. */
00331 #define SOCK_STRERROR sock_strerror
00332 extern char *sock_strerror (int errnum);
00333
00334 /* The internal rsh client uses sockets not file descriptors.  Note
00335    that as the code stands now, it often takes values from a SOCKET and
00336    puts them in an int.  This is ugly but it seems like sizeof
00337    (SOCKET) <= sizeof (int) on win32, even the 64-bit variants.  */
00338 #define START_SERVER_RETURNS_SOCKET 1
00339
00340 /* Is this true on NT?  Seems like I remember reports that NT 3.51 has
00341    problems with 200K writes (of course, the issue of large writes is
00342    moot since the use of buffer.c ensures that writes will only be as big
00343    as the buffers).  */
00344 #define SEND_NEVER_PARTIAL 1
00345
00346 /* a good idea because of Time Saving */
00347 #define HAVE_TZSET
00348
00349 /* Force lib/regex.c to use malloc instead of messing around with alloca
00350    and define the old re_comp routines that we use.  */
00351 #define REGEX_MALLOC 1
00352 #define _REGEX_RE_COMP 1
00353
00354 /* see cvs.h */
00355 #define DIRTY_MODDATE
00356 #define DO_NOT_LOCK_DIRTY
00357
00358 /* only for us ! */
00359 #define STRATA_HACK
00360
00361 /* GMT timestamp stat() fix */
00362 #include <sys/stat.h>
00363 struct wnt_stat {
00364         _dev_t st_dev;
00365         _ino_t st_ino;
00366         unsigned short st_mode;
00367         short st_nlink;
00368         short st_uid;
00369         short st_gid;
00370         _dev_t st_rdev;
00371         _off_t st_size;
00372         time_t st_atime;
00373         time_t st_mtime;
00374         time_t st_ctime;
00375         };
00376 int wnt_stat(const char *name, struct wnt_stat *buf);
00377 int wnt_fstat (int fildes, struct wnt_stat *buf);
00378 int wnt_lstat (const char *name, struct wnt_stat *buf);
00379
00380 #define fstat wnt_fstat
00381 //#define lstat wnt_lstat
00382 #define stat wnt_stat
00383
00384 #endif
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


filesubr.c File Reference

cvs-1.10/windows-NT/filesubr.c File Reference

#include <io.h>
#include <windows.h>
#include "cvs.h"

Include dependency graph for filesubr.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | cvs_max(x, y) ((x >= y) ? (x) : (y))

Functions

int deep_remove_dir | PROTO ((const char *path))
void | copy_file (from, to) const char *from

Variables

const char * | to
const int | mode
int | writable
char * | buf
size_t | nchars
const char * | file2
char ** | argv
int * | pargc
char *** | pargv

Define Documentation

#define cvs_max | ( | x,
 |  | y | ) | ((x >= y) ? (x) : (y))

Function Documentation

int deep_remove_dir PROTO ( (const char *path) ) [static]

void copy_file | ( | from | ,
 |  | to |
 | ) | const

Variable Documentation

char** argv

Definition at line 779 of file filesubr.c.

char* buf

Definition at line 571 of file filesubr.c.

const char* file2

Definition at line 606 of file filesubr.c.

const char* mode

Definition at line 235 of file filesubr.c.

size_t nchars

Definition at line 572 of file filesubr.c.

int* pargc

Definition at line 780 of file filesubr.c.

char*** pargv

Definition at line 781 of file filesubr.c.

const char* to

Definition at line 413 of file filesubr.c.

int writable

Definition at line 324 of file filesubr.c.

Generated on Sun Oct 21 12:42:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/filesubr.c Source File

cvs-1.10/windows-NT/filesubr.c

Go to the documentation of this file.
00001 /* filesubr.c --- subroutines for dealing with files
00002    Jim Blandy <jimb@cyclic.com>
00003
00004    This file is part of GNU CVS.
00005
00006    GNU CVS is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published by the
00008    Free Software Foundation; either version 2, or (at your option) any
00009    later version.
00010
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.  */
00015
00016 /* These functions were moved out of subr.c because they need different
00017    definitions under operating systems (like, say, Windows NT) with different
00018    file system semantics.  */
00019
00020 #include <io.h>
00021 #include <windows.h>
00022
00023 #include "cvs.h"
00024
00025 static int deep_remove_dir PROTO((const char *path));
00026
00027 /* Copies "from" to "to".  Note that the functionality here is similar
00028    to the win32 function CopyFile, but (1) we copy LastAccessTime and
00029    CopyFile doesn't, (2) we set file attributes to the default set by
00030    the C library and CopyFile copies them.  Neither #1 nor #2 was intentional
00031    as far as I know, but changing them could be confusing, unless there
00032    is some reason they should be changed (this would need more
00033    investigation).  */
00034 void
00035 copy_file (from, to)
00036     const char *from;
00037     const char *to;
00038 {
00039     struct stat sb;
00040     struct utimbuf t;
00041     int fdin, fdout;
00042
00043     if (trace)
00044 #ifdef SERVER_SUPPORT
00045     (void) fprintf (stderr, "%c-> copy(%s,%s)\n",
00046             (server_active) ? 'S' : ' ', from, to);
00047 #else
00048     (void) fprintf (stderr, "-> copy(%s,%s)\n", from, to);
00049 #endif
00050     if (noexec)
00051     return;
00052
00053     if ((fdin = open (from, O_RDONLY | O_BINARY)) < 0)
00054     error (1, errno, "cannot open %s for copying", from);
00055     if (fstat (fdin, &sb) < 0)
00056     error (1, errno, "cannot fstat %s", from);
00057     if ((fdout = open (to, O_CREAT | O_TRUNC | O_RDWR | O_BINARY,
00058                (int) sb.st_mode & 07777)) < 0)
00059     error (1, errno, "cannot create %s for copying", to);
00060     if (sb.st_size > 0)
00061     {
00062     char buf[BUFSIZ];
00063     int n;
00064
00065     for (;;)
00066     {
00067         n = read (fdin, buf, sizeof(buf));
00068         if (n == -1)
00069         {
00070 #ifdef EINTR
00071         if (errno == EINTR)
00072             continue;
00073 #endif
00074         error (1, errno, "cannot read file %s for copying", from);
00075         }
00076             else if (n == 0)
00077         break;
00078
00079         if (write(fdout, buf, n) != n) {
00080         error (1, errno, "cannot write file %s for copying", to);
00081         }
00082     }
00083
00084 #ifdef HAVE_FSYNC
00085     if (fsync (fdout))
00086         error (1, errno, "cannot fsync file %s after copying", to);
00087 #endif
00088     }
00089
00090     if (close (fdin) < 0)
00091     error (0, errno, "cannot close %s", from);
00092     if (close (fdout) < 0)
00093     error (1, errno, "cannot close %s", to);
00094
00095     /* now, set the times for the copied file to match those of the original */
00096     memset ((char *) &t, 0, sizeof (t));
00097     t.actime = sb.st_atime;
00098     t.modtime = sb.st_mtime;
00099     (void) utime (to, &t);
00100 }
00101
00102 /* FIXME-krp: these functions would benefit from caching the char * &
00103    stat buf.  */
00104
00105 /*
00106  * Returns non-zero if the argument file is a directory, or is a symbolic
00107  * link which points to a directory.
00108  */
00109 int
00110 isdir (file)
00111     const char *file;
00112 {
00113     struct stat sb;
00114
00115     if (stat (file, &sb) < 0)
00116     return (0);
00117     return (S_ISDIR (sb.st_mode));
00118 }
00119
00120 /*
00121  * Returns non-zero if the argument file is a symbolic link.
00122  */
00123 int
00124 islink (file)
00125     const char *file;
00126 {
00127 #ifdef S_ISLNK
00128     struct stat sb;
00129
00130     if (lstat (file, &sb) < 0)
00131     return (0);
00132     return (S_ISLNK (sb.st_mode));
00133 #else
00134     return (0);
00135 #endif
00136 }
00137
00138 /*
00139  * Returns non-zero if the argument file exists.
00140  */
00141 int
00142 isfile (file)
00143     const char *file;
00144 {
00145     return isaccessible(file, F_OK);
00146 }
00147
00148 /*
00149  * Returns non-zero if the argument file is readable.
00150  */
00151 int
00152 isreadable (file)
00153     const char *file;
00154 {
00155     return isaccessible(file, R_OK);
00156 }
00157
00158 /*
00159  * Returns non-zero if the argument file is writable.
00160  */
00161 int
00162 iswritable (file)
00163     const char *file;
00164 {
00165     return isaccessible(file, W_OK);
00166 }
00167
00168 /*
00169  * Returns non-zero if the argument file is accessable according to
00170  * mode.  If compiled with SETXID_SUPPORT also works if cvs has setxid
00171  * bits set.
00172  */
00173 int
00174 isaccessible (file, mode)
00175     const char *file;
00176     const int mode;
00177 {
00178 #ifdef SETXID_SUPPORT
00179     struct stat sb;
00180     int umask = 0;
00181     int gmask = 0;
00182     int omask = 0;
00183     int uid;
00184
00185     if (stat(file, &sb) == -1)
00186     return 0;
00187     if (mode == F_OK)
00188     return 1;
00189
00190     uid = geteuid();
00191     if (uid == 0)       /* superuser */
00192     {
00193     if (mode & X_OK)
00194         return sb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH);
00195     else
00196         return 1;
00197     }
00198
00199     if (mode & R_OK)
00200     {
00201     umask |= S_IRUSR;
00202     gmask |= S_IRGRP;
00203     omask |= S_IROTH;
00204     }
00205     if (mode & W_OK)
00206     {
00207     umask |= S_IWUSR;
00208     gmask |= S_IWGRP;
00209     omask |= S_IWOTH;
00210     }
00211     if (mode & X_OK)
00212     {
00213     umask |= S_IXUSR;
00214     gmask |= S_IXGRP;
00215     omask |= S_IXOTH;
00216     }
00217
00218     if (sb.st_uid == uid)
00219     return (sb.st_mode & umask) == umask;
00220     else if (sb.st_gid == getegid())
00221     return (sb.st_mode & gmask) == gmask;
00222     else
00223     return (sb.st_mode & omask) == omask;
00224 #else
00225     return access(file, mode) == 0;
00226 #endif
00227 }
00228
00229 /*
00230  * Open a file and die if it fails
00231  */
00232 FILE *
00233 open_file (name, mode)
00234     const char *name;
00235     const char *mode;
00236 {
00237     FILE *fp;
00238
00239     if ((fp = fopen (name, mode)) == NULL)
00240     error (1, errno, "cannot open %s", name);
00241     return (fp);
00242 }
00243
00244 /*
00245  * Make a directory and die if it fails
00246  */
00247 void
00248 make_directory (name)
00249     const char *name;
00250 {
00251     struct stat sb;
00252
00253     if (stat (name, &sb) == 0 && (!S_ISDIR (sb.st_mode)))
00254         error (0, 0, "%s already exists but is not a directory", name);
00255     if (!noexec && mkdir (name) < 0)
00256     error (1, errno, "cannot make directory %s", name);
00257 }
00258
00259 /*
00260  * Make a path to the argument directory, printing a message if something
00261  * goes wrong.
00262  */
00263 void
00264 make_directories (name)
00265     const char *name;
00266 {
00267     char *cp;
00268
00269     if (noexec)
00270     return;
00271
00272     if (mkdir (name) == 0 || errno == EEXIST)
00273     return;
00274     if (errno != ENOENT)
00275     {
00276     error (0, errno, "cannot make path to %s", name);
00277     return;
00278     }
00279     if ((cp = strrchr (name, '/')) == NULL)
00280     return;
00281     *cp = '\0';
00282     make_directories (name);
00283     *cp++ = '/';
00284     if (*cp == '\0')
00285     return;
00286     (void) mkdir (name);
00287 }
00288
00289 /* Create directory NAME if it does not already exist; fatal error for
00290    other errors.  Returns 0 if directory was created; 1 if it already
00291    existed.  */
00292 int
00293 mkdir_if_needed (name)
00294     char *name;
00295 {
00296     if (mkdir (name) < 0)
00297     {
00298     if (errno != EEXIST
00299 #ifdef EACCESS
00300         /* This was copied over from the OS/2 code; I would guess it
00301            isn't needed here but that has not been verified.  */
00302         && errno != EACCESS
00303 #endif
00304 #ifdef EACCES
00305         /* This is said to be needed by NT on Alpha or PowerPC
00306            (not sure what version) --August, 1996.  */
00307         && errno != EACCES
00308 #endif
00309         )
00310         error (1, errno, "cannot make directory %s", name);
00311     return 1;
00312     }
00313     return 0;
00314 }
00315
00316 /*
00317  * Change the mode of a file, either adding write permissions, or removing
00318  * all write permissions.  Adding write permissions honors the current umask
00319  * setting.
00320  */
00321 void
00322 xchmod (fname, writable)
00323     char *fname;
00324     int writable;
00325 {
00326     struct stat sb;
00327     mode_t mode, oumask;
00328
00329     if (stat (fname, &sb) < 0)
00330     {
00331     if (!noexec)
00332         error (0, errno, "cannot stat %s", fname);
00333     return;
00334     }
00335     if (writable)
00336     {
00337     oumask = umask (0);
00338     (void) umask (oumask);
00339     mode = sb.st_mode | ~oumask & (((sb.st_mode & S_IRUSR) ? S_IWUSR : 0) |
00340                        ((sb.st_mode & S_IRGRP) ? S_IWGRP : 0) |
00341                        ((sb.st_mode & S_IROTH) ? S_IWOTH : 0));
00342     }
00343     else
00344     {
00345     mode = sb.st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH);
00346     }
00347
00348     if (trace)
00349 #ifdef SERVER_SUPPORT
00350     (void) fprintf (stderr, "%c-> chmod(%s,%o)\n",
00351             (server_active) ? 'S' : ' ', fname, mode);
00352 #else
00353     (void) fprintf (stderr, "-> chmod(%s,%o)\n", fname, mode);
00354 #endif
00355     if (noexec)
00356     return;
00357
00358     if (chmod (fname, mode) < 0)
00359     error (0, errno, "cannot change mode of file %s", fname);
00360 }
00361
00362
00363 /* Read the value of a symbolic link.
00364    Under Windows NT, this function always returns EINVAL.  */
00365 int
00366 readlink (char *path, char *buf, int buf_size)
00367 {
00368     errno = EINVAL;
00369     return -1;
00370 }
00371
00372 /* Rename for NT which works for read only files.  Apparently if we are
00373    accessing FROM and TO via a Novell network, this is an issue.  */
00374 int
00375 wnt_rename (from, to)
00376     const char *from;
00377     const char *to;
00378 {
00379     int result, save_errno;
00380     int readonly = !iswritable (from);
00381
00382     if (readonly)
00383     {
00384     if (chmod (from, S_IWRITE) < 0)
00385         return -1;
00386     }
00387     result = rename (from, to);
00388     save_errno = errno;
00389     if (readonly)
00390     {
00391     if (result == 0)
00392     {
00393         if (chmod (to, S_IREAD) < 0)
00394         return -1;
00395     }
00396     else
00397     {
00398         /* We have a choice of which error to report, if there is
00399            one here too; report the one from rename ().  */
00400         chmod (from, S_IREAD);
00401     }
00402     errno = save_errno;
00403     }
00404     return result;
00405 }
00406
00407 /*
00408  * Rename a file and die if it fails
00409  */
00410 void
00411 rename_file (from, to)
00412     const char *from;
00413     const char *to;
00414 {
00415     int wasLocked;
00416     if (trace)
00417 #ifdef SERVER_SUPPORT
00418     (void) fprintf (stderr, "%c-> rename(%s,%s)\n",
00419             (server_active) ? 'S' : ' ', from, to);
00420 #else
00421     (void) fprintf (stderr, "-> rename(%s,%s)\n", from, to);
00422 #endif
00423     if (noexec)
00424     return;
00425
00426     /* Win32 unlink is stupid --- it fails if the file is read-only  */
00427     chmod(to, S_IWRITE);
00428     /* And Netware as well  is stupid ! (report of Norbert,Klamann@pobox.com) */
00429     wasLocked = !iswritable (from);
00430     chmod (from, S_IWRITE);
00431     unlink(to);
00432     if (CVS_RENAME (from, to) < 0)
00433     error (1, errno, "cannot rename file %s to %s", from, to);
00434     if(wasLocked)
00435     {
00436         chmod(to, S_IREAD);
00437     }
00438 }
00439
00440 /*
00441  * unlink a file, if possible.
00442  */
00443 int
00444 unlink_file (f)
00445     const char *f;
00446 {
00447     if (trace)
00448 #ifdef SERVER_SUPPORT
00449     (void) fprintf (stderr, "%c-> unlink(%s)\n",
00450             (server_active) ? 'S' : ' ', f);
00451 #else
00452     (void) fprintf (stderr, "-> unlink(%s)\n", f);
00453 #endif
00454     if (noexec)
00455     return (0);
00456
00457     /* Win32 unlink is stupid - it fails if the file is read-only */
00458     chmod (f, _S_IWRITE);
00459     return (unlink (f));
00460 }
00461
00462 /*
00463  * Unlink a file or dir, if possible.  If it is a directory do a deep
00464  * removal of all of the files in the directory.  Return -1 on error
00465  * (in which case errno is set).
00466  */
00467 int
00468 unlink_file_dir (f)
00469     const char *f;
00470 {
00471     if (trace)
00472 #ifdef SERVER_SUPPORT
00473     (void) fprintf (stderr, "%c-> unlink_file_dir(%s)\n",
00474             (server_active) ? 'S' : ' ', f);
00475 #else
00476     (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f);
00477 #endif
00478     if (noexec)
00479     return (0);
00480
00481     /* Win32 unlink is stupid - it fails if the file is read-only */
00482     chmod (f, _S_IWRITE);
00483     if (unlink (f) != 0)
00484     {
00485     /* under Windows NT, unlink returns EACCES if the path
00486        is a directory.  Under Windows 95, ENOENT.  */
00487         if (errno == EISDIR || errno == EACCES || errno == ENOENT)
00488                 return deep_remove_dir (f);
00489         else
00490         /* The file wasn't a directory and some other
00491          * error occured
00492          */
00493                 return -1;
00494     }
00495     /* We were able to remove the file from the disk */
00496     return 0;
00497 }
00498
00499 /* Remove a directory and everything it contains.  Returns 0 for
00500  * success, -1 for failure (in which case errno is set).
00501  */
00502
00503 static int
00504 deep_remove_dir (path)
00505     const char *path;
00506 {
00507     DIR       *dirp;
00508     struct dirent *dp;
00509     char       buf[PATH_MAX];
00510
00511     /* ENOTEMPTY for NT (obvious) but EACCES for Win95 (not obvious) */
00512     if (rmdir (path) != 0
00513     && (errno == ENOTEMPTY || errno == EACCES))
00514     {
00515     if ((dirp = opendir (path)) == NULL)
00516         /* If unable to open the directory return
00517          * an error
00518          */
00519         return -1;
00520
00521     while ((dp = readdir (dirp)) != NULL)
00522     {
00523         if (strcmp (dp->d_name, ".") == 0 ||
00524             strcmp (dp->d_name, "..") == 0)
00525         continue;
00526
00527         sprintf (buf, "%s/%s", path, dp->d_name);
00528
00529         /* Win32 unlink is stupid - it fails if the file is read-only */
00530         chmod (buf, _S_IWRITE);
00531         if (unlink (buf) != 0 )
00532         {
00533         /* Under Windows NT, unlink returns EACCES if the path
00534            is a directory.  Under Windows 95, ENOENT.  It
00535            isn't really clear to me whether checking errno is
00536            better or worse than using _stat to check for a directory.
00537            We aren't really trying to prevent race conditions here
00538            (e.g. what if something changes between readdir and
00539            unlink?)  */
00540         if (errno == EISDIR || errno == EACCES || errno == ENOENT)
00541         {
00542             if (deep_remove_dir (buf))
00543             {
00544             closedir (dirp);
00545             return -1;
00546             }
00547         }
00548         else
00549         {
00550             /* buf isn't a directory, or there are
00551              * some sort of permision problems
00552              */
00553             closedir (dirp);
00554             return -1;
00555         }
00556         }
00557     }
00558     closedir (dirp);
00559     return rmdir (path);
00560     }
00561     /* Was able to remove the directory return 0 */
00562     return 0;
00563 }
00564
00565 /* Read NCHARS bytes from descriptor FD into BUF.
00566    Return the number of characters successfully read.
00567    The number returned is always NCHARS unless end-of-file or error.  */
00568 static size_t
00569 block_read (fd, buf, nchars)
00570     int fd;
00571     char *buf;
00572     size_t nchars;
00573 {
00574     char *bp = buf;
00575     size_t nread;
00576
00577     do
00578     {
00579     nread = read (fd, bp, nchars);
00580     if (nread == (size_t)-1)
00581     {
00582 #ifdef EINTR
00583         if (errno == EINTR)
00584         continue;
00585 #endif
00586         return (size_t)-1;
00587     }
00588
00589     if (nread == 0)
00590         break;
00591
00592     bp += nread;
00593     nchars -= nread;
00594     } while (nchars != 0);
00595
00596     return bp - buf;
00597 }
00598
00599
00600 /*
00601  * Compare "file1" to "file2". Return non-zero if they don't compare exactly.
00602  */
00603 int
00604 xcmp (file1, file2)
00605     const char *file1;
00606     const char *file2;
00607 {
00608     char *buf1, *buf2;
00609     struct stat sb1, sb2;
00610     int fd1, fd2;
00611     int ret;
00612
00613     if ((fd1 = open (file1, O_RDONLY | O_BINARY)) < 0)
00614     error (1, errno, "cannot open file %s for comparing", file1);
00615     if ((fd2 = open (file2, O_RDONLY | O_BINARY)) < 0)
00616     error (1, errno, "cannot open file %s for comparing", file2);
00617     if (fstat (fd1, &sb1) < 0)
00618     error (1, errno, "cannot fstat %s", file1);
00619     if (fstat (fd2, &sb2) < 0)
00620     error (1, errno, "cannot fstat %s", file2);
00621
00622     /* A generic file compare routine might compare st_dev & st_ino here
00623        to see if the two files being compared are actually the same file.
00624        But that won't happen in CVS, so we won't bother. */
00625
00626     if (sb1.st_size != sb2.st_size)
00627     ret = 1;
00628     else if (sb1.st_size == 0)
00629     ret = 0;
00630     else
00631     {
00632     /* FIXME: compute the optimal buffer size by computing the least
00633        common multiple of the files st_blocks field */
00634     size_t buf_size = 8 * 1024;
00635     size_t read1;
00636     size_t read2;
00637
00638     buf1 = xmalloc (buf_size);
00639     buf2 = xmalloc (buf_size);
00640
00641     do
00642     {
00643         read1 = block_read (fd1, buf1, buf_size);
00644         if (read1 == (size_t)-1)
00645         error (1, errno, "cannot read file %s for comparing", file1);
00646
00647         read2 = block_read (fd2, buf2, buf_size);
00648         if (read2 == (size_t)-1)
00649         error (1, errno, "cannot read file %s for comparing", file2);
00650
00651         /* assert (read1 == read2); */
00652
00653         ret = memcmp(buf1, buf2, read1);
00654     } while (ret == 0 && read1 == buf_size);
00655
00656     free (buf1);
00657     free (buf2);
00658     }
00659
00660     (void) close (fd1);
00661     (void) close (fd2);
00662     return (ret);
00663 }
00664
00665
00666 /* Generate a unique temporary filename.  Returns a pointer to a newly
00667    malloc'd string containing the name.  Returns successfully or not at
00668    all.  */
00669 char *
00670 cvs_temp_name ()
00671 {
00672     char *retval;
00673
00674     retval = _tempnam (NULL, NULL);
00675     if (retval == NULL)
00676     error (1, errno, "cannot generate temporary filename");
00677     return retval;
00678 }
00679
00680 /* Return non-zero iff FILENAME is absolute.
00681    Trivial under Unix, but more complicated under other systems.  */
00682 int
00683 isabsolute (filename)
00684     const char *filename;
00685 {
00686     /* FIXME: This routine seems to interact poorly with
00687        strip_trailing_slashes.  For example, specify ":local:r:\" as
00688        CVSROOT.  The CVS/Root file will contain ":local:r:" and then
00689        isabsolute will complain about the root not being an absolute
00690        pathname.  My guess is that strip_trailing_slashes is the right
00691        place to fix this.  */
00692     return (ISDIRSEP (filename[0])
00693             || (filename[0] != '\0'
00694                 && filename[1] == ':'
00695                 && ISDIRSEP (filename[2])));
00696 }
00697
00698 /* Return a pointer into PATH's last component.  */
00699 char *
00700 last_component (char *path)
00701 {
00702     char *scan;
00703     char *last = 0;
00704
00705     for (scan = path; *scan; scan++)
00706         if (ISDIRSEP (*scan))
00707         last = scan;
00708
00709     if (last && (last != path))
00710         return last + 1;
00711     else
00712         return path;
00713 }
00714
00715
00716 /* NT has two evironment variables, HOMEPATH and HOMEDRIVE, which,
00717    when combined as ${HOMEDRIVE}${HOMEPATH}, give the unix equivalent
00718    of HOME.  Some NT users are just too unixy, though, and set the
00719    HOME variable themselves.  Therefore, we check for HOME first, and
00720    then try to combine the other two if that fails.
00721
00722    Looking for HOME strikes me as bogus, particularly if the only reason
00723    is to cater to "unixy users".  On the other hand, if the reasoning is
00724    there should be a single variable, rather than requiring people to
00725    set both HOMEDRIVE and HOMEPATH, then it starts to make a little more
00726    sense.
00727
00728    Win95: The system doesn't set HOME, HOMEDRIVE, or HOMEPATH (at
00729    least if you set it up as the "all users under one user ID" or
00730    whatever the name of that option is).  Based on thing overheard on
00731    the net, it seems that users of the pserver client have gotten in
00732    the habit of setting HOME (if you don't use pserver, you can
00733    probably get away without having a reasonable return from
00734    get_homedir.  Of course you lose .cvsrc and .cvsignore, but many
00735    users won't notice).  So it would seem that we should be somewhat
00736    careful if we try to change the current behavior.
00737
00738    NT 3.51 or NT 4.0: I haven't checked this myself, but I am told
00739    that HOME gets set, but not to the user's home directory.  It is
00740    said to be set to c:\users\default by default.  */
00741
00742 char *
00743 get_homedir ()
00744 {
00745     static char *pathbuf;
00746     char *hd, *hp;
00747
00748     if (pathbuf != NULL)
00749     return pathbuf;
00750     else if ((hd = getenv ("HOME")))
00751     return hd;
00752     else if ((hd = getenv ("HOMEDRIVE")) && (hp = getenv ("HOMEPATH")))
00753     {
00754     pathbuf = xmalloc (strlen (hd) + strlen (hp) + 5);
00755     strcpy (pathbuf, hd);
00756     strcat (pathbuf, hp);
00757
00758 #ifdef _MSC_VER
00759     /*
00760      * the visual c++ c-library won't open anymore "C:\/cvsrc"
00761      * so we have to remove the training '\'
00762      */
00763     if(pathbuf[strlen(pathbuf)-1] == '\\')
00764     {
00765         pathbuf[strlen(pathbuf)-1] = '\0';
00766     }
00767 #endif
00768
00769     return pathbuf;
00770     }
00771     else
00772     return NULL;
00773 }
00774
00775 /* See cvs.h for description.  */
00776 void
00777 expand_wild (argc, argv, pargc, pargv)
00778     int argc;
00779     char **argv;
00780     int *pargc;
00781     char ***pargv;
00782 {
00783     int i;
00784     int new_argc;
00785     char **new_argv;
00786     /* Allocated size of new_argv.  We arrange it so there is always room for
00787        one more element.  */
00788     int max_new_argc;
00789
00790     new_argc = 0;
00791     /* Add one so this is never zero.  */
00792     max_new_argc = argc + 1;
00793     new_argv = (char **) xmalloc (max_new_argc * sizeof (char *));
00794     for (i = 0; i < argc; ++i)
00795     {
00796     HANDLE h;
00797     WIN32_FIND_DATA fdata;
00798
00799     /* These variables help us extract the directory name from the
00800            given pathname. */
00801
00802     char *last_forw_slash, *last_back_slash, *end_of_dirname;
00803     int dirname_length = 0;
00804
00805     /* FIXME: If argv[i] is ".", this code will expand it to the
00806        name of the current directory in its parent directory which
00807        will cause start_recursion to do all manner of strange things
00808        with it (culminating in an error).  This breaks "cvs co .".
00809        As nearly as I can guess, this bug has existed since
00810        expand_wild was first created.  At least, it is in CVS 1.9 (I
00811        just tried it).  */
00812     /* I (Murray Bishop) got failures on sanity.sh death2-diff-5,
00813     branches2-11 and join-4, using Windows NT 4.0 fixpack 3,
00814     Microsoft Visual C++ 4.2.
00815     After getting nowhere with the debugger, I found the note above
00816     and did some experiments on 17 June 98.
00817     FindFirstFile does these strange things when cvs (1.9.27) is
00818     run in /tmp/cvs-sanity/1/first-dir :
00819
00820     argv[i]              fdata.cFileName
00821     .                    first-dir
00822     ../first-dir/.       first-dir */
00823     /* The fix is below... */
00824
00825     /* FindFirstFile doesn't return pathnames, so we have to do
00826        this ourselves.  Luckily, it's no big deal, since globbing
00827        characters under Win32s can only occur in the last segment
00828        of the path.  For example,
00829                 /a/path/q*.h                      valid
00830             /w32/q*.dir/cant/do/this/q*.h     invalid */
00831
00832     /* Win32 can handle both forward and backward slashes as
00833            filenames -- check for both. */
00834
00835     last_forw_slash = strrchr (argv[i], '/');
00836     last_back_slash = strrchr (argv[i], '\\');
00837
00838 #define cvs_max(x,y) ((x >= y) ? (x) : (y))
00839
00840     /* FIXME: this comparing a NULL pointer to a non-NULL one is
00841        extremely ugly, and I strongly suspect *NOT* sanctioned by
00842        ANSI C.  The code should just use last_component instead.  */
00843     end_of_dirname = cvs_max (last_forw_slash, last_back_slash);
00844
00845     if (end_of_dirname == NULL)
00846       dirname_length = 0;   /* no directory name */
00847     else
00848       dirname_length = end_of_dirname - argv[i] + 1; /* include slash */
00849
00850     h = FindFirstFile (argv[i], &fdata);
00851     if (h == INVALID_HANDLE_VALUE)
00852     {
00853         if (GetLastError () == ENOENT)
00854         {
00855         /* No match.  The file specified didn't contain a wildcard (in which case
00856            we clearly should return it unchanged), or it contained a wildcard which
00857            didn't match (in which case it might be better for it to be an error,
00858            but we don't try to do that).  */
00859         new_argv [new_argc++] = xstrdup (argv[i]);
00860         if (new_argc == max_new_argc)
00861         {
00862             max_new_argc *= 2;
00863             new_argv = xrealloc (new_argv, max_new_argc * sizeof (char *));
00864         }
00865         }
00866         else
00867         {
00868         error (1, errno, "cannot find %s", argv[i]);
00869         }
00870     }
00871     else
00872     {
00873         while (1)
00874         {
00875         new_argv[new_argc] =
00876             (char *) xmalloc (strlen (fdata.cFileName) + 1
00877                       + dirname_length);
00878
00879         /* Copy the directory name, if there is one. */
00880
00881         if (dirname_length)
00882         {
00883             strncpy (new_argv[new_argc], argv[i], dirname_length);
00884             new_argv[new_argc][dirname_length] = '\0';
00885         }
00886         else
00887             new_argv[new_argc][0] = '\0';
00888
00889         /* Copy the file name. */
00890
00891         if (fncmp (argv[i] + dirname_length, fdata.cFileName) == 0
00892             || strcmp (argv[i] + dirname_length, ".") == 0)
00893             /* We didn't expand a wildcard; we just matched a filename.
00894                Use the file name as specified rather than the filename
00895                which exists in the directory (they may differ in case).
00896                This is needed to make cvs add on a directory consistently
00897                use the name specified on the command line, but it is
00898                probably a good idea in other contexts too.  */
00899             /* comparison with "." copes with FindFirstFile returning
00900                 name of parent directory when given "." (Thats not a
00901                 feature, its a bug) */
00902             strcpy (new_argv[new_argc], argv[i]);
00903         else
00904             strcat (new_argv[new_argc], fdata.cFileName);
00905
00906         new_argc++;
00907
00908         if (new_argc == max_new_argc)
00909         {
00910             max_new_argc *= 2;
00911             new_argv = xrealloc (new_argv, max_new_argc * sizeof (char *));
00912         }
00913         if (!FindNextFile (h, &fdata))
00914         {
00915             if (GetLastError () == ERROR_NO_MORE_FILES)
00916             break;
00917             else
00918             error (1, errno, "cannot find %s", argv[i]);
00919         }
00920         }
00921         if (!FindClose (h))
00922         error (1, GetLastError (), "cannot close %s", argv[i]);
00923     }
00924     }
00925     *pargc = new_argc;
00926     *pargv = new_argv;
00927 }
00928
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


mkdir.c File Reference

cvs-1.10/windows-NT/mkdir.c File Reference

#include <assert.h>
#include "cvs.h"

Include dependency graph for mkdir.c:

Include dependency graph

Go to the source code of this file.

Functions

int wnt_mkdir (const char *path, int mode)

Function Documentation

int wnt_mkdir | ( | const char * | path,
 |  | int | mode
 | ) |

Definition at line 9 of file mkdir.c.

00010 {
00011   /* This is true for all extant calls to CVS_MKDIR.  If
00012      someone adds a call that uses something else later,
00013      we should tweak this function to handle that.  */
00014   assert (mode == 0777);
00015
00016   return mkdir (path);
00017 }

Generated on Sun Oct 21 12:43:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/mkdir.c Source File

cvs-1.10/windows-NT/mkdir.c

Go to the documentation of this file.
00001 /* mkdir.c --- mkdir for Windows NT
00002    Jim Blandy <jimb@cyclic.com> --- July 1995  */
00003
00004 #include <assert.h>
00005
00006 #include "cvs.h"
00007
00008 int
00009 wnt_mkdir (const char *path, int mode)
00010 {
00011   /* This is true for all extant calls to CVS_MKDIR.  If
00012      someone adds a call that uses something else later,
00013      we should tweak this function to handle that.  */
00014   assert (mode == 0777);
00015
00016   return mkdir (path);
00017 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ndir.c File Reference

cvs-1.10/windows-NT/ndir.c File Reference

#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dos.h>
#include <ndir.h>

Include dependency graph for ndir.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | ATTRIBUTES (_A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_SUBDIR)

Functions

void | free_dircontents (struct _dircontents *)
DIR * | opendir (const char *name)
void | closedir (DIR *dirp)
direct * | readdir (DIR *dirp)
void | seekdir (DIR *dirp, long off)
long | telldir (DIR *dirp)

Define Documentation

#define ATTRIBUTES (_A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_SUBDIR)

Definition at line 34 of file ndir.c.

Function Documentation

void closedir ( DIR * dirp )

Definition at line 112 of file ndir.c.

00113 {
00114   free_dircontents (dirp->dd_contents);
00115   free ((char *) dirp);
00116 }

void free_dircontents ( struct _dircontents * dp ) [static]

Definition at line 164 of file ndir.c.

00165 {
00166   struct _dircontents *odp;
00167
00168   while (dp)
00169     {
00170       if (dp->_d_entry)
00171     free (dp->_d_entry);
00172       dp = (odp = dp)->_d_next;
00173       free (odp);
00174     }
00175 }

DIR* opendir ( const char * name )

Definition at line 39 of file ndir.c.

00040 {
00041   struct _finddata_t find_buf;
00042   DIR *dirp;
00043   struct _dircontents *dp;
00044   char name_buf[_MAX_PATH + 1];
00045   char *slash = "";
00046   long hFile;
00047
00048   if (!name)
00049     name = "";
00050   else if (*name)
00051     {
00052       const char *s;
00053       int l = strlen (name);
00054
00055       s = name + l - 1;
00056       if ( !(l == 2 && *s == ':') && *s != '\\' && *s != '/')
00057     slash = "/";    /* save to insert slash between path and "*.*" */
00058     }
00059
00060   strcat (strcat (strcpy (name_buf, name), slash), "*.*");
00061
00062   dirp = (DIR *) malloc (sizeof (DIR));
00063   if (dirp == (DIR *)0)
00064     return (DIR *)0;
00065
00066   dirp->dd_loc = 0;
00067   dirp->dd_contents = dirp->dd_cp = (struct _dircontents *) 0;
00068
00069   if ((hFile = _findfirst (name_buf, &find_buf)) < 0)
00070     {
00071       free (dirp);
00072       return (DIR *)0;
00073     }
00074
00075   do
00076     {
00077       dp = (struct _dircontents *) malloc (sizeof (struct _dircontents));
00078       if (dp == (struct _dircontents *)0)
00079     {
00080       free_dircontents (dirp->dd_contents);
00081       return (DIR *)0;
00082     }
00083
00084       dp->_d_entry = malloc (strlen (find_buf.name) + 1);
00085       if (dp->_d_entry == (char *)0)
00086     {
00087       free (dp);
00088       free_dircontents (dirp->dd_contents);
00089       return (DIR *)0;
00090     }
00091
00092       if (dirp->dd_contents)
00093     dirp->dd_cp = dirp->dd_cp->_d_next = dp;
00094       else
00095     dirp->dd_contents = dirp->dd_cp = dp;
00096
00097       strcpy (dp->_d_entry, find_buf.name);
00098
00099       dp->_d_next = (struct _dircontents *)0;
00100
00101     } while (!_findnext (hFile, &find_buf));
00102
00103   dirp->dd_cp = dirp->dd_contents;
00104
00105   _findclose(hFile);
00106
00107   return dirp;
00108 }

struct direct* readdir ( DIR * dirp )

Definition at line 120 of file ndir.c.

00121 {
00122   static struct direct dp;
00123
00124   if (dirp->dd_cp == (struct _dircontents *)0)
00125     return (struct direct *)0;
00126   dp.d_namlen = dp.d_reclen =
00127     strlen (strcpy (dp.d_name, dirp->dd_cp->_d_entry));
00128 #if 0 /* JB */
00129   strlwr (dp.d_name);       /* JF */
00130 #endif
00131   dp.d_ino = 0;
00132   dirp->dd_cp = dirp->dd_cp->_d_next;
00133   dirp->dd_loc++;
00134
00135   return &dp;
00136 }

void seekdir | ( | DIR * | dirp,
 |  | long | off
 | ) |

Definition at line 140 of file ndir.c.

00141 {
00142   long i = off;
00143   struct _dircontents *dp;
00144
00145   if (off < 0)
00146     return;
00147   for (dp = dirp->dd_contents; --i >= 0 && dp; dp = dp->_d_next)
00148     ;
00149   dirp->dd_loc = off - (i + 1);
00150   dirp->dd_cp = dp;
00151 }

long telldir ( DIR * dirp )

Definition at line 155 of file ndir.c.

00156 {
00157   return dirp->dd_loc;
00158 }

Generated on Sun Oct 21 12:43:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/ndir.c Source File

cvs-1.10/windows-NT/ndir.c

Go to the documentation of this file.
00001 /*  msd_dir.c - portable directory routines
00002     Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
00003
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 1, or (at your option)
00007     any later version.
00008
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.  */
00013
00014 /* Everything non trivial in this code is from: @(#)msd_dir.c 1.4
00015    87/11/06.  A public domain implementation of BSD directory routines
00016    for MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
00017    August 1897 */
00018
00019
00020 #include <io.h>
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023 #include <string.h>
00024 #include <sys/types.h>
00025 #include <sys/stat.h>
00026
00027 #include <dos.h>
00028
00029 #include <ndir.h>
00030
00031 static void free_dircontents (struct _dircontents *);
00032
00033 /* find ALL files! */
00034 #define ATTRIBUTES  (_A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_SUBDIR)
00035
00036
00037
00038 DIR *
00039 opendir (const char *name)
00040 {
00041   struct _finddata_t find_buf;
00042   DIR *dirp;
00043   struct _dircontents *dp;
00044   char name_buf[_MAX_PATH + 1];
00045   char *slash = "";
00046   long hFile;
00047
00048   if (!name)
00049     name = "";
00050   else if (*name)
00051     {
00052       const char *s;
00053       int l = strlen (name);
00054
00055       s = name + l - 1;
00056       if ( !(l == 2 && *s == ':') && *s != '\\' && *s != '/')
00057     slash = "/";    /* save to insert slash between path and "*.*" */
00058     }
00059
00060   strcat (strcat (strcpy (name_buf, name), slash), "*.*");
00061
00062   dirp = (DIR *) malloc (sizeof (DIR));
00063   if (dirp == (DIR *)0)
00064     return (DIR *)0;
00065
00066   dirp->dd_loc = 0;
00067   dirp->dd_contents = dirp->dd_cp = (struct _dircontents *) 0;
00068
00069   if ((hFile = _findfirst (name_buf, &find_buf)) < 0)
00070     {
00071       free (dirp);
00072       return (DIR *)0;
00073     }
00074
00075   do
00076     {
00077       dp = (struct _dircontents *) malloc (sizeof (struct _dircontents));
00078       if (dp == (struct _dircontents *)0)
00079     {
00080       free_dircontents (dirp->dd_contents);
00081       return (DIR *)0;
00082     }
00083
00084       dp->_d_entry = malloc (strlen (find_buf.name) + 1);
00085       if (dp->_d_entry == (char *)0)
00086     {
00087       free (dp);
00088       free_dircontents (dirp->dd_contents);
00089       return (DIR *)0;
00090     }
00091
00092       if (dirp->dd_contents)
00093     dirp->dd_cp = dirp->dd_cp->_d_next = dp;
00094       else
00095     dirp->dd_contents = dirp->dd_cp = dp;
00096
00097       strcpy (dp->_d_entry, find_buf.name);
00098
00099       dp->_d_next = (struct _dircontents *)0;
00100
00101     } while (!_findnext (hFile, &find_buf));
00102
00103   dirp->dd_cp = dirp->dd_contents;
00104
00105   _findclose(hFile);
00106
00107   return dirp;
00108 }
00109
00110
00111 void
00112 closedir (DIR *dirp)
00113 {
00114   free_dircontents (dirp->dd_contents);
00115   free ((char *) dirp);
00116 }
00117
00118
00119 struct direct *
00120 readdir (DIR *dirp)
00121 {
00122   static struct direct dp;
00123
00124   if (dirp->dd_cp == (struct _dircontents *)0)
00125     return (struct direct *)0;
00126   dp.d_namlen = dp.d_reclen =
00127     strlen (strcpy (dp.d_name, dirp->dd_cp->_d_entry));
00128 #if 0 /* JB */
00129   strlwr (dp.d_name);       /* JF */
00130 #endif
00131   dp.d_ino = 0;
00132   dirp->dd_cp = dirp->dd_cp->_d_next;
00133   dirp->dd_loc++;
00134
00135   return &dp;
00136 }
00137
00138
00139 void
00140 seekdir (DIR *dirp, long off)
00141 {
00142   long i = off;
00143   struct _dircontents *dp;
00144
00145   if (off < 0)
00146     return;
00147   for (dp = dirp->dd_contents; --i >= 0 && dp; dp = dp->_d_next)
00148     ;
00149   dirp->dd_loc = off - (i + 1);
00150   dirp->dd_cp = dp;
00151 }
00152
00153
00154 long
00155 telldir (DIR *dirp)
00156 {
00157   return dirp->dd_loc;
00158 }
00159
00160
00161 /* Garbage collection */
00162
00163 static void
00164 free_dircontents (struct _dircontents *dp)
00165 {
00166   struct _dircontents *odp;
00167
00168   while (dp)
00169     {
00170       if (dp->_d_entry)
00171     free (dp->_d_entry);
00172       dp = (odp = dp)->_d_next;
00173       free (odp);
00174     }
00175 }
00176
00177
00178 #ifdef TEST
00179
00180 void main (int argc, char *argv[]);
00181
00182 void
00183 main (int argc, char *argv[])
00184 {
00185   static DIR *directory;
00186   struct direct *entry = (struct direct *)0;
00187
00188   char *name = "";
00189
00190   if (argc > 1)
00191     name = argv[1];
00192
00193   directory = opendir (name);
00194
00195   if (!directory)
00196     {
00197       fprintf (stderr, "can't open directory `%s'.\n", name);
00198       exit (2);
00199     }
00200
00201   while (entry = readdir (directory))
00202     printf ("> %s\n", entry->d_name);
00203
00204   printf ("done.\n");
00205 }
00206
00207 #endif /* TEST */
00208
00209 /*
00210  * Local Variables:
00211  * mode:C
00212  * ChangeLog:ChangeLog
00213  * compile-command:make
00214  * End:
00215  */
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ndir.h File Reference

cvs-1.10/windows-NT/ndir.h File Reference

#include <sys/types.h>

Include dependency graph for ndir.h:

Include dependency graph

Go to the source code of this file.

Compounds

struct | _dircontents
struct | _dirdesc
struct | direct

Defines

#define | rewinddir(dirp) seekdir(dirp, 0L)
#define | MAXNAMLEN 255

Typedefs

typedef _dirdesc | DIR

Functions

void | seekdir (DIR *, long)
long | telldir (DIR *)
DIR * | opendir (const char *)
void | closedir (DIR *)
direct * readdir (DIR *)

Define Documentation

#define MAXNAMLEN 255

Definition at line 26 of file ndir.h.

#define rewinddir ( dirp ) seekdir(dirp, 0L)

Definition at line 21 of file ndir.h.

Typedef Documentation

typedef struct _dirdesc DIR

Function Documentation

void closedir ( DIR * dirp )

Definition at line 116 of file ndir.c.

00117 {
00118   free_dircontents (dirp->dd_contents);
00119   free ((char *) dirp);
00120 }

DIR* opendir ( const char * name )

Definition at line 43 of file ndir.c.

00044 {
00045   struct _finddata_t find_buf;
00046   DIR *dirp;
00047   struct _dircontents *dp;
00048   char name_buf[_MAX_PATH + 1];
00049   char *slash = "";
00050   long hFile;
00051
00052   if (!name)
00053     name = "";
00054   else if (*name)
00055     {
00056       const char *s;
00057       int l = strlen (name);
00058
00059       s = name + l - 1;
00060       if ( !(l == 2 && *s == ':') && *s != '\\' && *s != '/')
00061     slash = "/";    /* save to insert slash between path and "*.*" */
00062     }
00063
00064   strcat (strcat (strcpy (name_buf, name), slash), "*.*");
00065
00066   dirp = (DIR *) malloc (sizeof (DIR));
00067   if (dirp == (DIR *)0)
00068     return (DIR *)0;
00069
00070   dirp->dd_loc = 0;
00071   dirp->dd_contents = dirp->dd_cp = (struct _dircontents *) 0;
00072
00073   if ((hFile = _findfirst (name_buf, &find_buf)) < 0)
00074     {
00075       free (dirp);
00076       return (DIR *)0;
00077     }
00078
00079   do
00080     {
00081       dp = (struct _dircontents *) malloc (sizeof (struct _dircontents));
00082       if (dp == (struct _dircontents *)0)
00083     {
00084       free_dircontents (dirp->dd_contents);
00085       return (DIR *)0;
00086     }
00087
00088       dp->_d_entry = malloc (strlen (find_buf.name) + 1);
00089       if (dp->_d_entry == (char *)0)
00090     {
00091       free (dp);
00092       free_dircontents (dirp->dd_contents);
00093       return (DIR *)0;
00094     }
00095
00096       if (dirp->dd_contents)
00097     dirp->dd_cp = dirp->dd_cp->_d_next = dp;
00098       else
00099     dirp->dd_contents = dirp->dd_cp = dp;
00100
00101       strcpy (dp->_d_entry, find_buf.name);
00102
00103       dp->_d_next = (struct _dircontents *)0;
00104
00105     } while (!_findnext (hFile, &find_buf));
00106
00107   dirp->dd_cp = dirp->dd_contents;
00108
00109   _findclose(hFile);
00110
00111   return dirp;
00112 }

struct direct* readdir ( DIR * dirp )

Definition at line 124 of file ndir.c.

00125 {
00126   static struct direct dp;
00127
00128   if (dirp->dd_cp == (struct _dircontents *)0)
00129     return (struct direct *)0;
00130   dp.d_namlen = dp.d_reclen =
00131     strlen (strcpy (dp.d_name, dirp->dd_cp->_d_entry));
00132 #if 0 /* JB */
00133   strlwr (dp.d_name);       /* JF */
00134 #endif
00135   dp.d_ino = 0;
00136   dirp->dd_cp = dirp->dd_cp->_d_next;
00137   dirp->dd_loc++;
00138
00139   return &dp;
00140 }

void seekdir | ( | DIR * | dirp,
 |  | long | off
 | ) |

Definition at line 144 of file ndir.c.

00145 {
00146   long i = off;
00147   struct _dircontents *dp;
00148
00149   if (off < 0)
00150     return;
00151   for (dp = dirp->dd_contents; --i >= 0 && dp; dp = dp->_d_next)
00152     ;
00153   dirp->dd_loc = off - (i + 1);
00154   dirp->dd_cp = dp;
00155 }

long telldir ( DIR * dirp )

Definition at line 159 of file ndir.c.

00160 {
00161   return dirp->dd_loc;
00162 }

Generated on Sun Oct 21 12:43:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/ndir.h Source File

cvs-1.10/windows-NT/ndir.h

Go to the documentation of this file.
00001 /*  ndir.c - portable directory routines
00002     Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
00003
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 1, or (at your option)
00007     any later version.
00008
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.  */
00013
00014 /* Everything non trivial in this code is taken from: @(#)msd_dir.c 1.4
00015    87/11/06.  A public domain implementation of BSD directory routines
00016    for MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
00017    August 1897 */
00018
00019 #include <sys/types.h>  /* ino_t definition */
00020
00021 #define rewinddir(dirp) seekdir(dirp, 0L)
00022
00023 /* 255 is said to be big enough for Windows NT.  The more elegant
00024    solution would be declaring d_name as one byte long and allocating
00025    it to the actual size needed.  */
00026 #define MAXNAMLEN   255
00027
00028 struct direct
00029 {
00030   ino_t d_ino;          /* a bit of a farce */
00031   int d_reclen;         /* more farce */
00032   int d_namlen;         /* length of d_name */
00033   char d_name[MAXNAMLEN + 1];   /* garentee null termination */
00034 };
00035
00036 struct _dircontents
00037 {
00038   char *_d_entry;
00039   struct _dircontents *_d_next;
00040 };
00041
00042 typedef struct _dirdesc
00043 {
00044   int dd_id;            /* uniquely identify each open directory */
00045   long dd_loc;          /* where we are in directory entry is this */
00046   struct _dircontents *dd_contents; /* pointer to contents of dir */
00047   struct _dircontents *dd_cp;   /* pointer to current position */
00048 } DIR;
00049
00050 extern void seekdir (DIR *, long);
00051 extern long telldir (DIR *);
00052 extern DIR *opendir (const char *);
00053 extern void closedir (DIR *);
00054 extern struct direct *readdir (DIR *);
00055
00056 /*
00057  * Local Variables:
00058  * mode:C
00059  * ChangeLog:ChangeLog
00060  * compile-command:make
00061  * End:
00062  */
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


options.h File Reference

cvs-1.10/windows-NT/options.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | PATCH_PROGRAM "patch"
#define | TMPDIR_DFLT "c:\\temp"
#define | EDITOR_DFLT "notepad"
#define | UMASK_DFLT 002
#define | RELATIVE_REPOS 1
#define | AUTH_CLIENT_SUPPORT 1
#define | RSA_IDENTITY_SUPPORT 1

Functions

void | exit ()

Define Documentation

#define AUTH_CLIENT_SUPPORT 1

Definition at line 149 of file options.h.

#define EDITOR_DFLT "notepad"

Definition at line 55 of file options.h.

#define PATCH_PROGRAM "patch"

Definition at line 34 of file options.h.

#define RELATIVE_REPOS 1

Definition at line 101 of file options.h.

#define RSA_IDENTITY_SUPPORT 1

Definition at line 150 of file options.h.

#define TMPDIR_DFLT "c:\\temp"

Definition at line 42 of file options.h.

#define UMASK_DFLT 002

Definition at line 68 of file options.h.

Function Documentation

void exit ( )

Generated on Sun Oct 21 12:42:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/options.h Source File

cvs-1.10/windows-NT/options.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1992, Brian Berliner and Jeff Polk
00003  * Copyright (c) 1989-1992, Brian Berliner
00004  *
00005  * You may distribute under the terms of the GNU General Public License as
00006  * specified in the README file that comes with the CVS 1.4 kit.
00007  *
00008  * This file holds (most of) the configuration tweaks that can be made to
00009  * customize CVS for your site.  CVS comes configured for a typical SunOS 4.x
00010  * environment.  The comments for each configurable item are intended to be
00011  * self-explanatory.  All #defines are tested first to see if an over-riding
00012  * option was specified on the "make" command line.
00013  *
00014  * If special libraries are needed, you will have to edit the Makefile.in file
00015  * or the configure script directly.  Sorry.
00016  */
00017
00018 /*
00019  * For portability and heterogeneity reasons, CVS is shipped by default using
00020  * my own text-file version of the ndbm database library in the src/myndbm.c
00021  * file.  If you want better performance and are not concerned about
00022  * heterogeneous hosts accessing your modules file, turn this option off.
00023  */
00024 #ifndef MY_NDBM
00025 #define MY_NDBM
00026 #endif
00027
00028 /*
00029  * The "patch" program to run when using the CVS server and accepting
00030  * patches across the network.  Specify a full pathname if your site
00031  * wants to use a particular patch.
00032  */
00033 #ifndef PATCH_PROGRAM
00034 #define PATCH_PROGRAM   "patch"
00035 #endif
00036
00037 /* Directory used for storing temporary files, if not overridden by
00038    environment variables or the -T global option.  There should be little
00039    need to change this (-T is a better mechanism if you need to use a
00040    different directory for temporary files).  */
00041 #ifndef TMPDIR_DFLT
00042 #define TMPDIR_DFLT "c:\\temp"
00043 #endif
00044
00045 /*
00046  * The default editor to use, if one does not specify the "-e" option to cvs,
00047  * or does not have an EDITOR environment variable.  I set this to just "vi",
00048  * and use the shell to find where "vi" actually is.  This allows sites with
00049  * /usr/bin/vi or /usr/ucb/vi to work equally well (assuming that your PATH
00050  * is reasonable).
00051  *
00052  * The notepad program seems to be Windows NT's bare-bones text editor.
00053  */
00054 #ifndef EDITOR_DFLT
00055 #define EDITOR_DFLT "notepad"
00056 #endif
00057
00058 /*
00059  * The default umask to use when creating or otherwise setting file or
00060  * directory permissions in the repository.  Must be a value in the
00061  * range of 0 through 0777.  For example, a value of 002 allows group
00062  * rwx access and world rx access; a value of 007 allows group rwx
00063  * access but no world access.  This value is overridden by the value
00064  * of the CVSUMASK environment variable, which is interpreted as an
00065  * octal number.
00066  */
00067 #ifndef UMASK_DFLT
00068 #define UMASK_DFLT  002
00069 #endif
00070
00071 /*
00072  * The cvs admin command is restricted to the members of the group
00073  * CVS_ADMIN_GROUP.  If this group does not exist, all users are
00074  * allowed to run cvs admin.  To disable the cvs admin for all users,
00075  * create an empty group CVS_ADMIN_GROUP.  To disable access control for
00076  * cvs admin, comment out the define below.
00077  *
00078  * Under Windows NT, this must not be used because it tries to include
00079  * <grp.h>
00080  */
00081 #ifdef CVS_ADMIN_GROUP
00082 /* #define CVS_ADMIN_GROUP "cvsadmin" */
00083 #endif
00084
00085 /*
00086  * The Repository file holds the path to the directory within the
00087  * source repository that contains the RCS ,v files for each CVS
00088  * working directory.  This path is either a full-path or a path
00089  * relative to CVSROOT.
00090  *
00091  * The big advantage that I can see to having a relative path is that
00092  * one can change the physical location of the master source
00093  * repository, change the contents of CVS/Root files in your
00094  * checked-out code, and CVS will work without problems.
00095  *
00096  * Therefore, RELATIVE_REPOS is now the default.  In the future, this
00097  * is likely to disappear entirely as a compile-time (or other) option,
00098  * so if you have other software which relies on absolute pathnames,
00099  * update them.
00100  */
00101 #define RELATIVE_REPOS 1
00102
00103 /*
00104  * When committing or importing files, you must enter a log message.
00105  * Normally, you can do this either via the -m flag on the command line or an
00106  * editor will be started for you.  If you like to use logging templates (the
00107  * rcsinfo file within the $CVSROOT/CVSROOT directory), you might want to
00108  * force people to use the editor even if they specify a message with -m.
00109  * Enabling FORCE_USE_EDITOR will cause the -m message to be appended to the
00110  * temp file when the editor is started.
00111  */
00112 #ifndef FORCE_USE_EDITOR
00113 /* #define  FORCE_USE_EDITOR */
00114 #endif
00115
00116 /*
00117  * When locking the repository, some sites like to remove locks and assume
00118  * the program that created them went away if the lock has existed for a long
00119  * time.  This used to be the default for previous versions of CVS.  CVS now
00120  * attempts to be much more robust, so lock files should not be left around
00121  * by mistake. The new behaviour will never remove old locks (they must now
00122  * be removed by hand).  Enabling CVS_FUDGELOCKS will cause CVS to remove
00123  * locks that are older than CVSLCKAGE seconds.
00124  * Use of this option is NOT recommended.
00125  */
00126 #ifndef CVS_FUDGELOCKS
00127 /* #define CVS_FUDGELOCKS */
00128 #endif
00129
00130 /*
00131  * When committing a permanent change, CVS and RCS make a log entry of
00132  * who committed the change.  If you are committing the change logged in
00133  * as "root" (not under "su" or other root-priv giving program), CVS/RCS
00134  * cannot determine who is actually making the change.
00135  *
00136  * As such, by default, CVS disallows changes to be committed by users
00137  * logged in as "root".  You can disable this option by commenting
00138  * out the lines below.
00139  *
00140  * Under Windows NT, privileges are associated with groups, not users,
00141  * so the case in which someone has logged in as root does not occur.
00142  * Thus, there is no need for this hack.
00143  */
00144 #undef CVS_BADROOT
00145
00146 /*
00147  * Yes, we can do the authenticated client.
00148  */
00149 #define AUTH_CLIENT_SUPPORT 1
00150 #define RSA_IDENTITY_SUPPORT 1
00151
00152 /* End of CVS configuration section */
00153
00154 /*
00155  * Externs that are included in libc, but are used frequently enough to
00156  * warrant defining here.
00157  */
00158 #ifndef STDC_HEADERS
00159 extern void exit ();
00160 #endif
Generated on Sun Oct 21 12:41:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pwd.c File Reference

cvs-1.10/windows-NT/pwd.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>

Include dependency graph for pwd.c:

Include dependency graph

Go to the source code of this file.

Functions

char * | win32getlogin ()
char * | lookup_env (char **)
passwd * | getpwuid (int uid)
passwd * | getpwnam (char *name)
group * | getgrgid (int uid)
group * | getgrnam (char *name)
char * | getlogin ()
char * | getgr_name ()
int | getuid ()
int | getgid ()
int | geteuid ()
int | getegid ()
passwd * getpwent ()
void | setpwent ()
void | endpwent ()
void | endgrent ()
int | getgroups (int ngroups, int *groups)
char * | lookup_env (char *table[])

Variables

char * | login_strings []
char * | group_strings []
char * | anonymous = "anonymous"
char * | home_dir = "."
char * | login_shell = "not command.com!"
char * | login = (char *) 0
char * | group = (char *) 0
passwd pw
group gr

Function Documentation

void endgrent ( void )

Definition at line 160 of file pwd.c.

00161 {
00162 }

void endpwent ( void )

Definition at line 155 of file pwd.c.

00156 {
00157 }

int getegid ( void )

Definition at line 138 of file pwd.c.

00139 {
00140   return 0;
00141 }

int geteuid ( void )

Definition at line 132 of file pwd.c.

00133 {
00134   return 0;
00135 }

int getgid ( void )

Definition at line 126 of file pwd.c.

00127 {
00128   return 0;
00129 }

char* getgr_name ( void )

Definition at line 107 of file pwd.c.

00108 {
00109   if (!group)           /* have we been called before? */
00110     group = lookup_env (group_strings);
00111
00112   if (!group)           /* have we been successful? */
00113     group = anonymous;
00114
00115   return group;
00116 }

struct group* getgrgid ( int uid )

Definition at line 72 of file pwd.c.

00073 {
00074   gr.gr_name = getgr_name ();
00075   gr.gr_gid = 0;
00076
00077   return &gr;
00078 }

struct group* getgrnam ( char * name )

Definition at line 81 of file pwd.c.

00082 {
00083   return (struct group *) 0;
00084 }

int getgroups | ( | int | ngroups,
 |  | int * | groups
 | ) |

Definition at line 166 of file pwd.c.

00167 {
00168   *groups = 0;
00169   return 1;
00170 }

char* getlogin ( void )

Definition at line 88 of file pwd.c.

00089 {
00090   /* This is how a windows user would override their login name. */
00091   if (!login)
00092     login = lookup_env (login_strings);
00093
00094   /* In the absence of user override, ask the operating system. */
00095   if (!login)
00096      login = win32getlogin();
00097
00098   /* If all else fails, fall back on Old Faithful. */
00099   if (!login)
00100     login = anonymous;
00101
00102   return login;
00103 }

struct passwd* getpwent ( void )

Definition at line 144 of file pwd.c.

00145 {
00146   return (struct passwd *) 0;
00147 }

struct passwd* getpwnam ( char * name )

Definition at line 65 of file pwd.c.

00066 {
00067   return (struct passwd *) 0;
00068 }

struct passwd* getpwuid ( int uid )

Definition at line 54 of file pwd.c.

00055 {
00056   pw.pw_name = getlogin ();
00057   pw.pw_dir = home_dir;
00058   pw.pw_shell = login_shell;
00059   pw.pw_uid = 0;
00060
00061   return &pw;
00062 }

int getuid ( void )

Definition at line 120 of file pwd.c.

00121 {
00122   return 0;         /* every user is a super user ... */
00123 }

char* lookup_env ( char * table[] ) [static]

Definition at line 174 of file pwd.c.

Referenced by getgr_name(), and getlogin().

00175 {
00176   char *ptr;
00177   char *entry;
00178   size_t len;
00179
00180   while (*table && !(ptr = getenv (*table++))) ;    /* scan table */
00181
00182   if (!ptr)
00183     return (char *) 0;
00184
00185   len = strcspn (ptr, " \n\t\n\r"); /* any WS?    */
00186   if (!(entry = malloc (len + 1)))
00187     {
00188       fprintf (stderr, "Out of memory.\nStop.");
00189       exit (-1);
00190     }
00191
00192   strncpy (entry, ptr, len);
00193   entry[len] = '\0';
00194
00195   return entry;
00196
00197 }

char* lookup_env ( char ** ) [static]

void setpwent ( void )

Definition at line 150 of file pwd.c.

00151 {
00152 }

char* win32getlogin ( )

Definition at line 153 of file win32.c.

Referenced by getlogin().

00154 {
00155     static char name[256];
00156     DWORD dw = 256;
00157     GetUserName (name, &dw);
00158     if (name[0] == '\0')
00159     return NULL;
00160     else
00161     return name;
00162 }

Variable Documentation

char* anonymous = "anonymous" [static]

Definition at line 41 of file pwd.c.

struct group gr [static]

Definition at line 50 of file pwd.c.

char* group = (char *) 0 [static]

Definition at line 47 of file pwd.c.

char* group_strings[] [static]

Initial value:

{
  "GROUP", (char *) 0
}

Definition at line 35 of file pwd.c.

char* home_dir = "." [static]

Definition at line 43 of file pwd.c.

char* login = (char *) 0 [static]

Definition at line 46 of file pwd.c.

char* login_shell = "not command.com!" [static]

Definition at line 44 of file pwd.c.

char* login_strings[] [static]

Initial value:

{
  "LOGIN", "USER", "MAILNAME", (char *) 0
}

Definition at line 30 of file pwd.c.

struct passwd pw [static]

Definition at line 49 of file pwd.c.

Generated on Sun Oct 21 12:43:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/pwd.c Source File

cvs-1.10/windows-NT/pwd.c

Go to the documentation of this file.
00001 /*  pwd.c - Try to approximate UN*X's getuser...() functions under MS-DOS.
00002     Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
00003
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 1, or (at your option)
00007     any later version.
00008
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.  */
00013
00014 /* This 'implementation' is conjectured from the use of this functions in
00015    the RCS and BASH distributions.  Of course these functions don't do too
00016    much useful things under MS-DOS, but using them avoids many "#ifdef
00017    MSDOS" in ported UN*X code ...  */
00018
00019
00020 #include <stdio.h>
00021 #include <stdlib.h>
00022 #include <string.h>
00023 #include <pwd.h>
00024
00025 char* win32getlogin();
00026 static char *lookup_env (char **);
00027
00028 /* where people might scribble their name into the environment ... */
00029
00030 static char *login_strings[] =
00031 {
00032   "LOGIN", "USER", "MAILNAME", (char *) 0
00033 };
00034
00035 static char *group_strings[] =
00036 {
00037   "GROUP", (char *) 0
00038 };
00039
00040
00041 static char *anonymous = "anonymous";   /* if all else fails ... */
00042
00043 static char *home_dir = ".";    /* we feel (no|every)where at home */
00044 static char *login_shell = "not command.com!";
00045
00046 static char *login = (char *) 0;/* cache the names here */
00047 static char *group = (char *) 0;
00048
00049 static struct passwd pw;    /* should we return a malloc()'d structure   */
00050 static struct group gr;     /* instead of pointers to static structures? */
00051
00052 /* return something like a username in a (butchered!) passwd structure. */
00053 struct passwd *
00054 getpwuid (int uid)
00055 {
00056   pw.pw_name = getlogin ();
00057   pw.pw_dir = home_dir;
00058   pw.pw_shell = login_shell;
00059   pw.pw_uid = 0;
00060
00061   return &pw;
00062 }
00063
00064 struct passwd *
00065 getpwnam (char *name)
00066 {
00067   return (struct passwd *) 0;
00068 }
00069
00070 /* return something like a groupname in a (butchered!) group structure. */
00071 struct group *
00072 getgrgid (int uid)
00073 {
00074   gr.gr_name = getgr_name ();
00075   gr.gr_gid = 0;
00076
00077   return &gr;
00078 }
00079
00080 struct group *
00081 getgrnam (char *name)
00082 {
00083   return (struct group *) 0;
00084 }
00085
00086 /* return something like a username. */
00087 char *
00088 getlogin ()
00089 {
00090   /* This is how a windows user would override their login name. */
00091   if (!login)
00092     login = lookup_env (login_strings);
00093
00094   /* In the absence of user override, ask the operating system. */
00095   if (!login)
00096      login = win32getlogin();
00097
00098   /* If all else fails, fall back on Old Faithful. */
00099   if (!login)
00100     login = anonymous;
00101
00102   return login;
00103 }
00104
00105 /* return something like a group.  */
00106 char *
00107 getgr_name ()
00108 {
00109   if (!group)           /* have we been called before? */
00110     group = lookup_env (group_strings);
00111
00112   if (!group)           /* have we been successful? */
00113     group = anonymous;
00114
00115   return group;
00116 }
00117
00118 /* return something like a uid.  */
00119 int
00120 getuid ()
00121 {
00122   return 0;         /* every user is a super user ... */
00123 }
00124
00125 int
00126 getgid ()
00127 {
00128   return 0;
00129 }
00130
00131 int
00132 geteuid ()
00133 {
00134   return 0;
00135 }
00136
00137 int
00138 getegid ()
00139 {
00140   return 0;
00141 }
00142
00143 struct passwd *
00144 getpwent ()
00145 {
00146   return (struct passwd *) 0;
00147 }
00148
00149 void
00150 setpwent ()
00151 {
00152 }
00153
00154 void
00155 endpwent ()
00156 {
00157 }
00158
00159 void
00160 endgrent ()
00161 {
00162 }
00163
00164 /* return groups.  */
00165 int
00166 getgroups (int ngroups, int *groups)
00167 {
00168   *groups = 0;
00169   return 1;
00170 }
00171
00172 /* lookup environment.  */
00173 static char *
00174 lookup_env (char *table[])
00175 {
00176   char *ptr;
00177   char *entry;
00178   size_t len;
00179
00180   while (*table && !(ptr = getenv (*table++))) ;    /* scan table */
00181
00182   if (!ptr)
00183     return (char *) 0;
00184
00185   len = strcspn (ptr, " \n\t\n\r"); /* any WS?    */
00186   if (!(entry = malloc (len + 1)))
00187     {
00188       fprintf (stderr, "Out of memory.\nStop.");
00189       exit (-1);
00190     }
00191
00192   strncpy (entry, ptr, len);
00193   entry[len] = '\0';
00194
00195   return entry;
00196
00197 }
00198
00199 /*
00200  * Local Variables:
00201  * mode:C
00202  * ChangeLog:ChangeLog
00203  * compile-command:make
00204  * End:
00205  */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pwd.h File Reference

cvs-1.10/windows-NT/pwd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | group
struct | passwd

Functions

passwd * | getpwuid (int)
passwd * | getpwnam (char *)
group * | getgrgid (int)
group * | getgrnam (char *)
char * | getlogin (void)
char * | getgr_name (void)
int | getuid (void)
int | getgid (void)
int | geteuid (void)
int | getegid (void)
int | getgroups (int, int *)
passwd * | getpwent (void)
void | setpwent (void)
void | endpwent (void)
void | endgrent (void)

Variables

int * | groups
int | ngroups

Function Documentation

void endgrent ( void )

Definition at line 160 of file pwd.c.

00161 {
00162 }

void endpwent ( void )

Definition at line 155 of file pwd.c.

00156 {
00157 }

int getegid ( void )

Definition at line 138 of file pwd.c.

00139 {
00140   return 0;
00141 }

int geteuid ( void )

Definition at line 132 of file pwd.c.

00133 {
00134   return 0;
00135 }

int getgid ( void )

Definition at line 126 of file pwd.c.

00127 {
00128   return 0;
00129 }

char* getgr_name ( void )

Definition at line 107 of file pwd.c.

00108 {
00109   if (!group)           /* have we been called before? */
00110     group = lookup_env (group_strings);
00111
00112   if (!group)           /* have we been successful? */
00113     group = anonymous;
00114
00115   return group;
00116 }

struct group* getgrgid ( int uid )

Definition at line 72 of file pwd.c.

00073 {
00074   gr.gr_name = getgr_name ();
00075   gr.gr_gid = 0;
00076
00077   return &gr;
00078 }

struct group* getgrnam ( char * name )

Definition at line 81 of file pwd.c.

00082 {
00083   return (struct group *) 0;
00084 }

int getgroups | ( | int | ngroups,
 |  | int * | groups
 | ) |

Definition at line 166 of file pwd.c.

00167 {
00168   *groups = 0;
00169   return 1;
00170 }

char* getlogin ( void )

Definition at line 88 of file pwd.c.

00089 {
00090   /* This is how a windows user would override their login name. */
00091   if (!login)
00092     login = lookup_env (login_strings);
00093
00094   /* In the absence of user override, ask the operating system. */
00095   if (!login)
00096      login = win32getlogin();
00097
00098   /* If all else fails, fall back on Old Faithful. */
00099   if (!login)
00100     login = anonymous;
00101
00102   return login;
00103 }

struct passwd* getpwent ( void )

Definition at line 144 of file pwd.c.

00145 {
00146   return (struct passwd *) 0;
00147 }

struct passwd* getpwnam ( char * name )

Definition at line 65 of file pwd.c.

00066 {
00067   return (struct passwd *) 0;
00068 }

struct passwd* getpwuid ( int uid )

Definition at line 54 of file pwd.c.

00055 {
00056   pw.pw_name = getlogin ();
00057   pw.pw_dir = home_dir;
00058   pw.pw_shell = login_shell;
00059   pw.pw_uid = 0;
00060
00061   return &pw;
00062 }

int getuid ( void )

Definition at line 120 of file pwd.c.

00121 {
00122   return 0;         /* every user is a super user ... */
00123 }

void setpwent ( void )

Definition at line 150 of file pwd.c.

00151 {
00152 }

Variable Documentation

int* groups

Definition at line 55 of file pwd.h.

int ngroups

Definition at line 56 of file pwd.h.

Generated on Sun Oct 21 12:43:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/pwd.h Source File

cvs-1.10/windows-NT/pwd.h

Go to the documentation of this file.
00001 /*  pwd.h - Try to approximate UN*X's getuser...() functions under MS-DOS.
00002     Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
00003
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 1, or (at your option)
00007     any later version.
00008
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.  */
00013
00014 /* This 'implementation' is conjectured from the use of this functions in
00015    the RCS and BASH distributions.  Of course these functions don't do too
00016    much useful things under MS-DOS, but using them avoids many "#ifdef
00017    MSDOS" in ported UN*X code ...  */
00018
00019 #if 0
00020 /* This is taken care of in Windows-NT/config.h.  */
00021 typedef int uid_t;
00022 #endif
00023
00024 struct passwd
00025 {
00026   /*    ...     */
00027   /*    missing stuff   */
00028   /*    ...     */
00029   char *pw_name;        /* login user id        */
00030   char *pw_dir;         /* home directory       */
00031   char *pw_shell;       /* login shell          */
00032   int  pw_uid;
00033 };
00034
00035 struct group
00036 {
00037   /*    ...     */
00038   /*    missing stuff   */
00039   /*    ...     */
00040   char *gr_name;        /* login user id        */
00041   int  gr_gid;
00042 };
00043
00044 extern struct passwd *getpwuid (int);
00045 extern struct passwd *getpwnam (char *);
00046 extern struct group *getgrgid (int);
00047 extern struct group *getgrnam (char *);
00048 extern char *getlogin (void);
00049 extern char *getgr_name (void);
00050 extern int getuid (void);
00051 extern int getgid (void);
00052 extern int geteuid (void);
00053 extern int getegid (void);
00054
00055 extern int *groups;
00056 extern int ngroups;
00057 extern int getgroups (int, int *);
00058
00059 extern struct passwd *getpwent (void);
00060 extern void setpwent (void);
00061 extern void endpwent (void);
00062 extern void endgrent (void);
00063
00064 /*
00065  * Local Variables:
00066  * mode:C
00067  * ChangeLog:ChangeLog
00068  * compile-command:make
00069  * End:
00070  */
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcmd.c File Reference

cvs-1.10/windows-NT/rcmd.c File Reference

#include "cvs.h"
#include "rcmd.h"
#include <io.h>
#include <fcntl.h>
#include <malloc.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <assert.h>

Include dependency graph for rcmd.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | closesocket close
#define | SOCK_ERRNO errno
#define | SOCK_STRERROR strerror
#define | WSAEADDRINUSE EADDRINUSE
#define | SOCKET_ERROR -1
#define | INVALID_SOCKET -1

Typedefs

typedef int | SOCKET

Functions

int | resolve_address (const char **ahost, struct sockaddr_in *sai)
SOCKET | bind_and_connect (struct sockaddr_in *server_sai)
int | rcmd_authenticate (int fd, char *locuser, char *remuser, char *command)
int | rcmd (const char **ahost, unsigned short inport, char *locuser, char *remuser, char *cmd, int *fd2p)

Define Documentation

#define INVALID_SOCKET -1

Definition at line 39 of file rcmd.c.

#define SOCKET_ERROR -1

Definition at line 38 of file rcmd.c.

#define SOCK_ERRNO errno

Definition at line 32 of file rcmd.c.

#define SOCK_STRERROR strerror

Definition at line 33 of file rcmd.c.

#define WSAEADDRINUSE EADDRINUSE

Definition at line 35 of file rcmd.c.

#define closesocket close

Definition at line 31 of file rcmd.c.

Typedef Documentation

typedef int SOCKET

Definition at line 30 of file rcmd.c.

Function Documentation

SOCKET bind_and_connect ( struct sockaddr_in * server_sai ) [static]

Definition at line 86 of file rcmd.c.

Referenced by rcmd().

00087 {
00088     SOCKET s;
00089     struct sockaddr_in client_sai;
00090     u_short client_port;
00091
00092     client_sai.sin_family = AF_INET;
00093     client_sai.sin_addr.s_addr = htonl (INADDR_ANY);
00094
00095     for (client_port = IPPORT_RESERVED - 1;
00096          client_port >= IPPORT_RESERVED/2;
00097          client_port--)
00098     {
00099     int result, errcode;
00100     client_sai.sin_port = htons (client_port);
00101
00102         if ((s = socket (PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
00103         error (1, 0, "cannot create socket: %s",
00104            SOCK_STRERROR (SOCK_ERRNO));
00105
00106     result = bind (s, (struct sockaddr *) &client_sai,
00107                    sizeof (client_sai));
00108     errcode = SOCK_ERRNO;
00109     if (result == SOCKET_ERROR)
00110     {
00111         closesocket (s);
00112         if (errcode == WSAEADDRINUSE)
00113         continue;
00114         else
00115         error (1, 0, "cannot bind to socket: %s",
00116                SOCK_STRERROR (errcode));
00117     }
00118
00119     result = connect (s, (struct sockaddr *) server_sai,
00120                       sizeof (*server_sai));
00121     errcode = SOCK_ERRNO;
00122     if (result == SOCKET_ERROR)
00123     {
00124         closesocket (s);
00125         if (errcode == WSAEADDRINUSE)
00126         continue;
00127         else
00128         error (1, 0, "cannot connect to socket: %s",
00129                SOCK_STRERROR (errcode));
00130     }
00131
00132     return s;
00133     }
00134
00135     error (1, 0, "cannot find free port");
00136     /* Shut up gcc -Wall.  */
00137     return s;
00138 }

int rcmd | ( | const char ** | AHOST,
 |  | unsigned short | INPORT,
 |  | char * | LOCUSER,
 |  | char * | REMUSER,
 |  | char * | CMD,
 |  | int * | fd2p
 | ) |

Definition at line 183 of file rcmd.c.

00189 {
00190     struct sockaddr_in sai;
00191     SOCKET s;
00192
00193     assert (fd2p == 0);
00194
00195     if (resolve_address (ahost, &sai) < 0)
00196         error (1, 0, "internal error: resolve_address < 0");
00197
00198     sai.sin_port = htons (inport);
00199
00200     if ((s = bind_and_connect (&sai)) == INVALID_SOCKET)
00201     error (1, 0, "internal error: bind_and_connect < 0");
00202
00203     if (rcmd_authenticate (s, locuser, remuser, cmd) < 0)
00204     error (1, 0, "internal error: rcmd_authenticate < 0");
00205
00206     return s;
00207 }

int rcmd_authenticate | ( | int | fd,
 |  | char * | locuser,
 |  | char * | remuser,
 |  | char * | command
 | ) | [static]

Definition at line 141 of file rcmd.c.

Referenced by rcmd().

00142 {
00143     /* Send them a bunch of information, each terminated by '\0':
00144        - secondary stream port number (we don't use this)
00145        - username on local machine
00146        - username on server machine
00147        - command
00148        Now, the Ultrix man page says you transmit the username on the
00149        server first, but that doesn't seem to work.  Transmitting the
00150        client username first does.  Go figure.  The Linux man pages
00151        get it right --- hee hee.  */
00152     if ((send (fd, "0\0", 2, 0) == SOCKET_ERROR)
00153     || (send (fd, locuser, strlen (locuser) + 1, 0) == SOCKET_ERROR)
00154     || (send (fd, remuser, strlen (remuser) + 1, 0) == SOCKET_ERROR)
00155     || (send (fd, command, strlen (command) + 1, 0) == SOCKET_ERROR))
00156     error (1, 0, "cannot send authentication info to rshd: %s",
00157            SOCK_STRERROR (SOCK_ERRNO));
00158
00159     /* They sniff our butt, and send us a '\0' character if they
00160        like us.  */
00161     {
00162         char c;
00163     if (recv (fd, &c, 1, 0) == SOCKET_ERROR)
00164     {
00165         error (1, 0, "cannot receive authentication info from rshd: %s",
00166            SOCK_STRERROR (SOCK_ERRNO));
00167     }
00168     if (c != '\0')
00169     {
00170         /* All the junk with USER, LOGNAME, GetUserName, &c, is so
00171            confusing that we better give some clue as to what sort
00172            of user name we decided on.  */
00173         error (0, 0, "cannot log in as local user '%s', remote user '%s'",
00174            locuser, remuser);
00175         error (1, 0, "Permission denied by rshd");
00176     }
00177     }
00178
00179     return 0;
00180 }

int resolve_address | ( | const char ** | ahost,
 |  | struct sockaddr_in * | sai
 | ) | [static]

Definition at line 53 of file rcmd.c.

Referenced by rcmd().

00054 {
00055     {
00056     unsigned long addr = inet_addr (*ahost);
00057
00058     if (addr != (unsigned long) -1)
00059     {
00060         sai->sin_family = AF_INET;
00061         sai->sin_addr.s_addr = addr;
00062         return 0;
00063     }
00064     }
00065
00066     {
00067         struct hostent *e = gethostbyname (*ahost);
00068
00069     if (e)
00070     {
00071         assert (e->h_addrtype == AF_INET);
00072         assert (e->h_addr);
00073         *ahost = e->h_name;
00074         sai->sin_family = AF_INET;
00075         memcpy (&sai->sin_addr, e->h_addr, sizeof (sai->sin_addr));
00076         return 0;
00077     }
00078     }
00079
00080     error (1, 0, "no such host %s", *ahost);
00081     /* Shut up gcc -Wall.  */
00082     return 1;
00083 }

Generated on Sun Oct 21 12:43:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/rcmd.c Source File

cvs-1.10/windows-NT/rcmd.c

Go to the documentation of this file.
00001 /* rcmd.c --- execute a command on a remote host from Windows NT
00002
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; either version 2, or (at your option)
00006    any later version.
00007
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.
00012
00013    Jim Blandy <jimb@cyclic.com> --- August 1995  */
00014
00015 #include "cvs.h"
00016 #include "rcmd.h"
00017
00018 #include <io.h>
00019 #include <fcntl.h>
00020 #include <malloc.h>
00021 #include <errno.h>
00022
00023 #ifdef HAVE_WINSOCK_H
00024   #include <winsock.h>
00025 #else
00026   #include <sys/types.h>
00027   #include <sys/socket.h>
00028   #include <netinet/in.h>
00029   #include <netdb.h>
00030   typedef int SOCKET;
00031   #define closesocket close
00032   #define SOCK_ERRNO errno
00033   #define SOCK_STRERROR strerror
00034   /* Probably would be cleaner to just use EADDRINUSE, as NT has that too.  */
00035   #define WSAEADDRINUSE EADDRINUSE
00036   /* Probably would be cleaner to just check for < 0.  Might want to
00037      double-check that doing so would seem to work on NT.  */
00038   #define SOCKET_ERROR -1
00039   #define INVALID_SOCKET -1
00040 #endif
00041
00042 #include <stdio.h>
00043 #include <assert.h>
00044
00045 /* The rest of this file contains the rcmd() code, which is used
00046    only by START_SERVER.  The idea for a long-term direction is
00047    that this code can be made portable (by using SOCK_ERRNO and
00048    so on), and then moved to client.c or someplace it can be
00049    shared with the VMS port and any other ports which may want it.  */
00050
00051
00052 static int
00053 resolve_address (const char **ahost, struct sockaddr_in *sai)
00054 {
00055     {
00056     unsigned long addr = inet_addr (*ahost);
00057
00058     if (addr != (unsigned long) -1)
00059     {
00060         sai->sin_family = AF_INET;
00061         sai->sin_addr.s_addr = addr;
00062         return 0;
00063     }
00064     }
00065
00066     {
00067         struct hostent *e = gethostbyname (*ahost);
00068
00069     if (e)
00070     {
00071         assert (e->h_addrtype == AF_INET);
00072         assert (e->h_addr);
00073         *ahost = e->h_name;
00074         sai->sin_family = AF_INET;
00075         memcpy (&sai->sin_addr, e->h_addr, sizeof (sai->sin_addr));
00076         return 0;
00077     }
00078     }
00079
00080     error (1, 0, "no such host %s", *ahost);
00081     /* Shut up gcc -Wall.  */
00082     return 1;
00083 }
00084
00085 static SOCKET
00086 bind_and_connect (struct sockaddr_in *server_sai)
00087 {
00088     SOCKET s;
00089     struct sockaddr_in client_sai;
00090     u_short client_port;
00091
00092     client_sai.sin_family = AF_INET;
00093     client_sai.sin_addr.s_addr = htonl (INADDR_ANY);
00094
00095     for (client_port = IPPORT_RESERVED - 1;
00096          client_port >= IPPORT_RESERVED/2;
00097          client_port--)
00098     {
00099     int result, errcode;
00100     client_sai.sin_port = htons (client_port);
00101
00102         if ((s = socket (PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
00103         error (1, 0, "cannot create socket: %s",
00104            SOCK_STRERROR (SOCK_ERRNO));
00105
00106     result = bind (s, (struct sockaddr *) &client_sai,
00107                    sizeof (client_sai));
00108     errcode = SOCK_ERRNO;
00109     if (result == SOCKET_ERROR)
00110     {
00111         closesocket (s);
00112         if (errcode == WSAEADDRINUSE)
00113         continue;
00114         else
00115         error (1, 0, "cannot bind to socket: %s",
00116                SOCK_STRERROR (errcode));
00117     }
00118
00119     result = connect (s, (struct sockaddr *) server_sai,
00120                       sizeof (*server_sai));
00121     errcode = SOCK_ERRNO;
00122     if (result == SOCKET_ERROR)
00123     {
00124         closesocket (s);
00125         if (errcode == WSAEADDRINUSE)
00126         continue;
00127         else
00128         error (1, 0, "cannot connect to socket: %s",
00129                SOCK_STRERROR (errcode));
00130     }
00131
00132     return s;
00133     }
00134
00135     error (1, 0, "cannot find free port");
00136     /* Shut up gcc -Wall.  */
00137     return s;
00138 }
00139
00140 static int
00141 rcmd_authenticate (int fd, char *locuser, char *remuser, char *command)
00142 {
00143     /* Send them a bunch of information, each terminated by '\0':
00144        - secondary stream port number (we don't use this)
00145        - username on local machine
00146        - username on server machine
00147        - command
00148        Now, the Ultrix man page says you transmit the username on the
00149        server first, but that doesn't seem to work.  Transmitting the
00150        client username first does.  Go figure.  The Linux man pages
00151        get it right --- hee hee.  */
00152     if ((send (fd, "0\0", 2, 0) == SOCKET_ERROR)
00153     || (send (fd, locuser, strlen (locuser) + 1, 0) == SOCKET_ERROR)
00154     || (send (fd, remuser, strlen (remuser) + 1, 0) == SOCKET_ERROR)
00155     || (send (fd, command, strlen (command) + 1, 0) == SOCKET_ERROR))
00156     error (1, 0, "cannot send authentication info to rshd: %s",
00157            SOCK_STRERROR (SOCK_ERRNO));
00158
00159     /* They sniff our butt, and send us a '\0' character if they
00160        like us.  */
00161     {
00162         char c;
00163     if (recv (fd, &c, 1, 0) == SOCKET_ERROR)
00164     {
00165         error (1, 0, "cannot receive authentication info from rshd: %s",
00166            SOCK_STRERROR (SOCK_ERRNO));
00167     }
00168     if (c != '\0')
00169     {
00170         /* All the junk with USER, LOGNAME, GetUserName, &c, is so
00171            confusing that we better give some clue as to what sort
00172            of user name we decided on.  */
00173         error (0, 0, "cannot log in as local user '%s', remote user '%s'",
00174            locuser, remuser);
00175         error (1, 0, "Permission denied by rshd");
00176     }
00177     }
00178
00179     return 0;
00180 }
00181
00182 int
00183 rcmd (const char **ahost,
00184       unsigned short inport,
00185       char *locuser,
00186       char *remuser,
00187       char *cmd,
00188       int *fd2p)
00189 {
00190     struct sockaddr_in sai;
00191     SOCKET s;
00192
00193     assert (fd2p == 0);
00194
00195     if (resolve_address (ahost, &sai) < 0)
00196         error (1, 0, "internal error: resolve_address < 0");
00197
00198     sai.sin_port = htons (inport);
00199
00200     if ((s = bind_and_connect (&sai)) == INVALID_SOCKET)
00201     error (1, 0, "internal error: bind_and_connect < 0");
00202
00203     if (rcmd_authenticate (s, locuser, remuser, cmd) < 0)
00204     error (1, 0, "internal error: rcmd_authenticate < 0");
00205
00206     return s;
00207 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcmd.h File Reference

cvs-1.10/windows-NT/rcmd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int rcmd (const char **AHOST, unsigned short INPORT, char *LOCUSER, char *REMUSER, char *CMD, int *fd2p)

Function Documentation

int rcmd | ( | const char ** | AHOST,
 |  | unsigned short | INPORT,
 |  | char * | LOCUSER,
 |  | char * | REMUSER,
 |  | char * | CMD,
 |  | int * | fd2p
 | ) |

Definition at line 183 of file rcmd.c.

Referenced by macos_start_server(), os2_start_server(), vms_start_server(), and wnt_start_server().

00189 {
00190     struct sockaddr_in sai;
00191     SOCKET s;
00192
00193     assert (fd2p == 0);
00194
00195     if (resolve_address (ahost, &sai) < 0)
00196         error (1, 0, "internal error: resolve_address < 0");
00197
00198     sai.sin_port = htons (inport);
00199
00200     if ((s = bind_and_connect (&sai)) == INVALID_SOCKET)
00201     error (1, 0, "internal error: bind_and_connect < 0");
00202
00203     if (rcmd_authenticate (s, locuser, remuser, cmd) < 0)
00204     error (1, 0, "internal error: rcmd_authenticate < 0");
00205
00206     return s;
00207 }

Generated on Sun Oct 21 12:42:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/rcmd.h Source File

cvs-1.10/windows-NT/rcmd.h

Go to the documentation of this file.
00001 /* rcmd.h --- interface to executing commands on remote hosts
00002    Jim Blandy <jimb@cyclic.com> --- August 1995  */
00003
00004 /* Run the command CMD on the host *AHOST, and return a file descriptor for
00005    a bidirectional stream socket connected to the command's standard input
00006    and output.
00007
00008    rcmd looks up *AHOST using gethostbyname, and sets *AHOST to the host's
00009    canonical name.  If *AHOST is not found, rcmd returns -1.
00010
00011    rcmd connects to the remote host at TCP port INPORT.  This should
00012    probably be the "shell" service, port 514.
00013
00014    LOCUSER is the name of the user on the local machine, and REMUSER is
00015    the name of the user on the remote machine; the remote machine uses this,
00016    along with the source address of the TCP connection, to authenticate
00017    the connection.
00018
00019    CMD is the command to execute.  The remote host will tokenize it any way
00020    it damn well pleases.  Welcome to Unix.
00021
00022    FD2P is a feature we don't support, but there's no point in making mindless
00023    deviations from the interface.  Callers should always pass this argument
00024    as zero.  */
00025 extern int rcmd (const char **AHOST,
00026          unsigned short INPORT,
00027          char *LOCUSER,
00028          char *REMUSER,
00029          char *CMD,
00030          int *fd2p);
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


run.c File Reference

cvs-1.10/windows-NT/run.c File Reference

#include "cvs.h"
#include <windows.h>
#include <stdlib.h>
#include <process.h>
#include <errno.h>
#include <io.h>
#include <fcntl.h>

Include dependency graph for run.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | WIN32_LEAN_AND_MEAN

Functions

void run_add_arg | PROTO ((const char *s))
void run_init_prog | PROTO ((void))
char * | strtok ()
void | run_setup (const char *prog)
void | run_arg (s) const char *s
int | my_pipe (HANDLE *readwrite, enum inherit_pipe end)
void | init_si (LPSTARTUPINFO lpsi)
int | start_child (char *command, HANDLE in, HANDLE out)
char * | build_command (char **argv)
int | piped_child (char **argv, int *to, int *from)
int | filter_stream_through_program (oldfd, dir, prog, pidp) int oldfd, dir

Variables

char ** | run_argv
int | run_argc
int | run_argc_allocated
const char * | stout
const char * | sterr
int | flags
const char * | mode
char ** | prog
pid_t * | pidp

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 17 of file run.c.

Function Documentation

void run_init_prog PROTO ( (void) ) [static]

void run_add_arg PROTO ( (const char *s) ) [static]

char* build_command ( char ** argv ) [static]

Definition at line 531 of file run.c.

Referenced by cvs_process_open(), and piped_child().

00532 {
00533     int len;
00534
00535     /* Compute the total length the command will have.  */
00536     {
00537         int i;
00538
00539     len = 0;
00540         for (i = 0; argv[i]; i++)
00541     {
00542         char *p;
00543
00544         len += 2;  /* for the double quotes */
00545
00546         for (p = argv[i]; *p; p++)
00547         {
00548             if (*p == '"')
00549             len += 2;
00550         else
00551             len++;
00552         }
00553         len++;  /* for the space or the '\0'  */
00554     }
00555     }
00556
00557     {
00558     /* The + 10 is in case len is 0.  */
00559         char *command = (char *) malloc (len + 10);
00560     int i;
00561     char *p;
00562
00563     if (! command)
00564     {
00565         errno = ENOMEM;
00566         return command;
00567     }
00568
00569     p = command;
00570         *p = '\0';
00571     /* copy each element of argv to command, putting each command
00572        in double quotes, and backslashing any quotes that appear
00573        within an argument.  */
00574     for (i = 0; argv[i]; i++)
00575     {
00576         char *a;
00577         *p++ = '"';
00578         for (a = argv[i]; *a; a++)
00579         {
00580             if (*a == '"')
00581             *p++ = '\\', *p++ = '"';
00582         else
00583             *p++ = *a;
00584         }
00585         *p++ = '"';
00586         *p++ = ' ';
00587     }
00588     if (p > command)
00589         p[-1] = '\0';
00590
00591         return command;
00592     }
00593 }

int filter_stream_through_program | ( | oldfd | ,
 |  | dir | ,
 |  | prog | ,
 |  | pidp |
 | ) |

void init_si ( LPSTARTUPINFO lpsi ) [static]

Definition at line 453 of file run.c.

Referenced by start_child().

00454 {
00455   memset (lpsi, 0, sizeof (*lpsi));
00456   lpsi->cb = sizeof(*lpsi);
00457   lpsi->lpReserved = NULL;
00458   lpsi->lpTitle = NULL;
00459   lpsi->lpReserved2 = NULL;
00460   lpsi->cbReserved2 = 0;
00461   lpsi->lpDesktop = NULL;
00462   lpsi->dwFlags = 0;
00463 }

int my_pipe | ( | HANDLE * | readwrite,
 |  | enum inherit_pipe | end
 | ) | [static]

Definition at line 419 of file run.c.

Referenced by piped_child().

00420 {
00421     HANDLE read, write;
00422     SECURITY_ATTRIBUTES sa;
00423
00424     init_sa (&sa, 0);
00425     if (! CreatePipe (&read, &write, &sa, 1 << 13))
00426     {
00427         errno = EMFILE;
00428         return -1;
00429     }
00430     if (end == inherit_reading)
00431         read = inheritable (read);
00432     else
00433         write = inheritable (write);
00434
00435     if (read == INVALID_HANDLE_VALUE
00436         || write == INVALID_HANDLE_VALUE)
00437     {
00438         CloseHandle (read);
00439     CloseHandle (write);
00440     errno = EMFILE;
00441     return -1;
00442     }
00443
00444     readwrite[0] = read;
00445     readwrite[1] = write;
00446
00447     return 0;
00448 }

int piped_child | ( | char ** | argv,
 |  | int * | to,
 |  | int * | from
 | ) |

Definition at line 604 of file run.c.

00605 {
00606   int child;
00607   HANDLE pipein[2], pipeout[2];
00608   char *command;
00609
00610   /* Turn argv into a form acceptable to CreateProcess.  */
00611   command = build_command (argv);
00612   if (! command)
00613       return -1;
00614
00615   /* Create pipes for communicating with child.  Arrange for
00616      the child not to inherit the ends it won't use.  */
00617   if (my_pipe (pipein, inherit_reading) == -1
00618       || my_pipe (pipeout, inherit_writing) == -1)
00619       return -1;
00620
00621   child = start_child (command, pipein[0], pipeout[1]);
00622   free (command);
00623   if (child == (int) INVALID_HANDLE_VALUE)
00624       return -1;
00625
00626   /* Close the pipe ends the parent doesn't use.  */
00627   CloseHandle (pipein[0]);
00628   CloseHandle (pipeout[1]);
00629
00630   /* Given the pipe handles, turn them into file descriptors for
00631      use by the caller.  */
00632   if ((*to      = _open_osfhandle ((long) pipein[1],  _O_BINARY)) == -1
00633       || (*from = _open_osfhandle ((long) pipeout[0], _O_BINARY)) == -1)
00634       return -1;
00635
00636   return child;
00637 }

void run_arg ( s ) const

void run_setup ( const char * prog )

Definition at line 48 of file run.c.

00049 {
00050     char *cp;
00051     int i;
00052
00053     char *run_prog;
00054
00055     /* clean out any malloc'ed values from run_argv */
00056     for (i = 0; i < run_argc; i++)
00057     {
00058     if (run_argv[i])
00059     {
00060         free (run_argv[i]);
00061         run_argv[i] = (char *) 0;
00062     }
00063     }
00064     run_argc = 0;
00065
00066     run_prog = xstrdup (prog);
00067
00068     /* put each word into run_argv, allocating it as we go */
00069     for (cp = strtok (run_prog, " \t"); cp; cp = strtok ((char *) NULL, " \t"))
00070     run_add_arg (cp);
00071
00072     free (run_prog);
00073 }

int start_child | ( | char * | command,
 |  | HANDLE | in,
 |  | HANDLE | out
 | ) | [static]

Definition at line 470 of file run.c.

Referenced by piped_child().

00471 {
00472   STARTUPINFO si;
00473   PROCESS_INFORMATION pi;
00474   BOOL status;
00475
00476   /* The STARTUPINFO structure can specify handles to pass to the
00477      child as its standard input, output, and error.  */
00478   init_si (&si);
00479   si.hStdInput = in;
00480   si.hStdOutput = out;
00481   si.hStdError  = (HANDLE) _get_osfhandle (2);
00482   si.dwFlags = STARTF_USESTDHANDLES;
00483 #if defined(CVSGUI_PIPE)
00484   si.dwFlags |= STARTF_USESHOWWINDOW;
00485   si.wShowWindow = SW_SHOWMINNOACTIVE;
00486 #endif
00487
00488   status = CreateProcess ((LPCTSTR) NULL,
00489                           (LPTSTR) command,
00490                   (LPSECURITY_ATTRIBUTES) NULL, /* lpsaProcess */
00491                   (LPSECURITY_ATTRIBUTES) NULL, /* lpsaThread */
00492                   TRUE, /* fInheritHandles */
00493                   0,    /* fdwCreate */
00494                   (LPVOID) 0, /* lpvEnvironment */
00495                   (LPCTSTR) 0, /* lpszCurDir */
00496                   &si,  /* lpsiStartInfo */
00497                   &pi); /* lppiProcInfo */
00498
00499   if (! status)
00500   {
00501       DWORD error_code = GetLastError ();
00502       switch (error_code)
00503       {
00504       case ERROR_NOT_ENOUGH_MEMORY:
00505       case ERROR_OUTOFMEMORY:
00506           errno = ENOMEM; break;
00507       case ERROR_BAD_EXE_FORMAT:
00508           errno = ENOEXEC; break;
00509       case ERROR_ACCESS_DENIED:
00510           errno = EACCES; break;
00511       case ERROR_NOT_READY:
00512       case ERROR_FILE_NOT_FOUND:
00513       case ERROR_PATH_NOT_FOUND:
00514       default:
00515           errno = ENOENT; break;
00516       }
00517       return (int) INVALID_HANDLE_VALUE;
00518   }
00519
00520   /* The _spawn and _cwait functions in the C runtime library
00521      seem to operate on raw NT handles, not PID's.  Odd, but we'll
00522      deal.  */
00523   return (int) pi.hProcess;
00524 }

char* strtok ( )

Variable Documentation

int flags

Definition at line 137 of file run.c.

Referenced by CMainFrame::InitialShowWindow(), and CMainFrame::OnClose().

const char* mode

Definition at line 317 of file run.c.

pid_t* pidp

Definition at line 651 of file run.c.

char** prog

Definition at line 650 of file run.c.

int run_argc [static]

Definition at line 44 of file run.c.

int run_argc_allocated [static]

Definition at line 45 of file run.c.

char** run_argv [static]

Definition at line 43 of file run.c.

const char* sterr

Definition at line 136 of file run.c.

const char* stout

Definition at line 135 of file run.c.

Generated on Sun Oct 21 12:43:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/run.c Source File

cvs-1.10/windows-NT/run.c

Go to the documentation of this file.
00001 /* run.c --- routines for executing subprocesses under Windows NT.
00002
00003    This file is part of GNU CVS.
00004
00005    GNU CVS is free software; you can redistribute it and/or modify it
00006    under the terms of the GNU General Public License as published by the
00007    Free Software Foundation; either version 2, or (at your option) any
00008    later version.
00009
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.  */
00014
00015 #include "cvs.h"
00016
00017 #define WIN32_LEAN_AND_MEAN
00018 #include <windows.h>
00019 #include <stdlib.h>
00020 #include <process.h>
00021 #include <errno.h>
00022 #include <io.h>
00023 #include <fcntl.h>
00024
00025 static void run_add_arg PROTO((const char *s));
00026 static void run_init_prog PROTO((void));
00027
00028 extern char *strtok ();
00029
00030 /*
00031  * To exec a program under CVS, first call run_setup() to setup any initial
00032  * arguments.  The options to run_setup are essentially like printf(). The
00033  * arguments will be parsed into whitespace separated words and added to the
00034  * global run_argv list.
00035  *
00036  * Then, optionally call run_arg() for each additional argument that you'd like
00037  * to pass to the executed program.
00038  *
00039  * Finally, call run_exec() to execute the program with the specified arguments.
00040  * The execvp() syscall will be used, so that the PATH is searched correctly.
00041  * File redirections can be performed in the call to run_exec().
00042  */
00043 static char **run_argv;
00044 static int run_argc;
00045 static int run_argc_allocated;
00046
00047 void
00048 run_setup (const char *prog)
00049 {
00050     char *cp;
00051     int i;
00052
00053     char *run_prog;
00054
00055     /* clean out any malloc'ed values from run_argv */
00056     for (i = 0; i < run_argc; i++)
00057     {
00058     if (run_argv[i])
00059     {
00060         free (run_argv[i]);
00061         run_argv[i] = (char *) 0;
00062     }
00063     }
00064     run_argc = 0;
00065
00066     run_prog = xstrdup (prog);
00067
00068     /* put each word into run_argv, allocating it as we go */
00069     for (cp = strtok (run_prog, " \t"); cp; cp = strtok ((char *) NULL, " \t"))
00070     run_add_arg (cp);
00071
00072     free (run_prog);
00073 }
00074
00075 void
00076 run_arg (s)
00077     const char *s;
00078 {
00079     run_add_arg (s);
00080 }
00081
00082 /* Return a malloc'd copy of s, with double quotes around it.  */
00083 static char *
00084 quote (const char *s)
00085 {
00086     size_t s_len = 0;
00087     char *copy = NULL;
00088     char *scan = (char *) s;
00089
00090     /* scan string for extra quotes ... */
00091     while (*scan)
00092     if ('"' == *scan++)
00093         s_len += 2;   /* one extra for the quote character */
00094     else
00095         s_len++;
00096     /* allocate length + byte for ending zero + for double quotes around */
00097     scan = copy = xmalloc(s_len + 3);
00098     *scan++ = '"';
00099     while (*s)
00100     {
00101     if ('"' == *s)
00102         *scan++ = '\\';
00103     *scan++ = *s++;
00104     }
00105     /* ending quote and closing zero */
00106     *scan++ = '"';
00107     *scan++ = '\0';
00108     return copy;
00109 }
00110
00111 static void
00112 run_add_arg (s)
00113     const char *s;
00114 {
00115     /* allocate more argv entries if we've run out */
00116     if (run_argc >= run_argc_allocated)
00117     {
00118     run_argc_allocated += 50;
00119     run_argv = (char **) xrealloc ((char *) run_argv,
00120                      run_argc_allocated * sizeof (char **));
00121     }
00122
00123     if (s)
00124     {
00125     run_argv[run_argc] = (run_argc ? quote (s) : xstrdup (s));
00126     run_argc++;
00127     }
00128     else
00129     run_argv[run_argc] = (char *) 0;    /* not post-incremented on purpose! */
00130 }
00131
00132 int
00133 run_exec (stin, stout, sterr, flags)
00134     const char *stin;
00135     const char *stout;
00136     const char *sterr;
00137     int flags;
00138 {
00139     int shin, shout, sherr;
00140     int sain, saout, saerr; /* saved handles */
00141     int mode_out, mode_err;
00142     int status = -1;
00143     int rerrno = 0;
00144     int rval   = -1;
00145     void (*old_sigint) (int);
00146
00147     if (trace)          /* if in trace mode */
00148     {
00149     (void) fprintf (stderr, "-> system(");
00150     run_print (stderr);
00151     (void) fprintf (stderr, ")\n");
00152     }
00153
00154     /* Flush standard output and standard error, or otherwise we end
00155        up with strange interleavings of stuff called from CYGWIN
00156        vs. CMD.  */
00157
00158     fflush (stderr);
00159     fflush (stdout);
00160
00161     if (noexec && (flags & RUN_REALLY) == 0) /* if in noexec mode */
00162     return (0);
00163
00164     /*
00165      * start the engine and take off
00166      */
00167
00168     /* make sure that we are null terminated, since we didn't calloc */
00169     run_add_arg ((char *) 0);
00170
00171     /* setup default file descriptor numbers */
00172     shin = 0;
00173     shout = 1;
00174     sherr = 2;
00175
00176     /* set the file modes for stdout and stderr */
00177     mode_out = mode_err = O_WRONLY | O_CREAT;
00178     mode_out |= ((flags & RUN_STDOUT_APPEND) ? O_APPEND : O_TRUNC);
00179     mode_err |= ((flags & RUN_STDERR_APPEND) ? O_APPEND : O_TRUNC);
00180
00181     /* open the files as required, shXX are shadows of stdin... */
00182     if (stin && (shin = open (stin, O_RDONLY)) == -1)
00183     {
00184     rerrno = errno;
00185     error (0, errno, "cannot open %s for reading (prog %s)",
00186            stin, run_argv[0]);
00187     goto out0;
00188     }
00189     if (stout && (shout = open (stout, mode_out, 0666)) == -1)
00190     {
00191     rerrno = errno;
00192     error (0, errno, "cannot open %s for writing (prog %s)",
00193            stout, run_argv[0]);
00194     goto out1;
00195     }
00196     if (sterr && (flags & RUN_COMBINED) == 0)
00197     {
00198     if ((sherr = open (sterr, mode_err, 0666)) == -1)
00199     {
00200         rerrno = errno;
00201         error (0, errno, "cannot open %s for writing (prog %s)",
00202            sterr, run_argv[0]);
00203         goto out2;
00204     }
00205     }
00206     /* now save the standard handles */
00207     sain = saout = saerr = -1;
00208     sain  = dup( 0); /* dup stdin  */
00209     saout = dup( 1); /* dup stdout */
00210     saerr = dup( 2); /* dup stderr */
00211
00212     /* the new handles will be dup'd to the standard handles
00213      * for the spawn.
00214      */
00215
00216     if (shin != 0)
00217       {
00218     (void) dup2 (shin, 0);
00219     (void) close (shin);
00220       }
00221     if (shout != 1)
00222       {
00223     (void) dup2 (shout, 1);
00224     (void) close (shout);
00225       }
00226     if (flags & RUN_COMBINED)
00227       (void) dup2 (1, 2);
00228     else if (sherr != 2)
00229       {
00230     (void) dup2 (sherr, 2);
00231     (void) close (sherr);
00232       }
00233
00234     /* Ignore signals while we're running this.  */
00235     old_sigint = signal (SIGINT, SIG_IGN);
00236
00237     /* dup'ing is done.  try to run it now */
00238     rval = spawnvp ( P_WAIT, run_argv[0], run_argv);
00239
00240     /* Restore signal handling.  */
00241     signal (SIGINT, old_sigint);
00242
00243     /* restore the original file handles   */
00244     if (sain  != -1) {
00245       (void) dup2( sain, 0);    /* re-connect stdin  */
00246       (void) close( sain);
00247     }
00248     if (saout != -1) {
00249       (void) dup2( saout, 1);   /* re-connect stdout */
00250       (void) close( saout);
00251     }
00252     if (saerr != -1) {
00253       (void) dup2( saerr, 2);   /* re-connect stderr */
00254       (void) close( saerr);
00255     }
00256
00257     /* Flush standard output and standard error, or otherwise we end
00258        up with strange interleavings of stuff called from CYGWIN
00259        vs. CMD.  */
00260
00261     fflush (stderr);
00262     fflush (stdout);
00263
00264     /* Recognize the return code for an interrupted subprocess.  */
00265     if (rval == CONTROL_C_EXIT)
00266         return 2;
00267     else
00268         return rval;        /* end, if all went coorect */
00269
00270     /* error cases */
00271     /* cleanup the open file descriptors */
00272   out2:
00273     if (stout)
00274     (void) close (shout);
00275   out1:
00276     if (stin)
00277     (void) close (shin);
00278
00279   out0:
00280     if (rerrno)
00281     errno = rerrno;
00282     return (status);
00283 }
00284
00285 void
00286 run_print (fp)
00287     FILE *fp;
00288 {
00289     int i;
00290
00291     for (i = 0; i < run_argc; i++)
00292     {
00293     (void) fprintf (fp, "'%s'", run_argv[i]);
00294     if (i != run_argc - 1)
00295         (void) fprintf (fp, " ");
00296     }
00297 }
00298
00299 static char *
00300 requote (const char *cmd)
00301 {
00302     char *requoted = xmalloc (strlen (cmd) + 1);
00303     char *p = requoted;
00304
00305     strcpy (requoted, cmd);
00306     while ((p = strchr (p, '\'')) != NULL)
00307     {
00308         *p++ = '"';
00309     }
00310
00311     return requoted;
00312 }
00313
00314 FILE *
00315 run_popen (cmd, mode)
00316     const char *cmd;
00317     const char *mode;
00318 {
00319     if (trace)
00320 #ifdef SERVER_SUPPORT
00321     (void) fprintf (stderr, "%c-> run_popen(%s,%s)\n",
00322             (server_active) ? 'S' : ' ', cmd, mode);
00323 #else
00324     (void) fprintf (stderr, "-> run_popen(%s,%s)\n", cmd, mode);
00325 #endif
00326     if (noexec)
00327     return (NULL);
00328
00329     /* If the command string uses single quotes, turn them into
00330        double quotes.  */
00331     {
00332         char *requoted = requote (cmd);
00333     /* Save and restore our file descriptors to work around
00334        apparent bugs in _popen.  We are perhaps better off using
00335        the win32 functions instead of _popen.  */
00336
00337     int old_stdin = dup (STDIN_FILENO);
00338     int old_stdout = dup (STDOUT_FILENO);
00339     int old_stderr = dup (STDERR_FILENO);
00340
00341     FILE *result = popen (requoted, mode);
00342
00343     dup2 (old_stdin, STDIN_FILENO);
00344     dup2 (old_stdout, STDOUT_FILENO);
00345     dup2 (old_stderr, STDERR_FILENO);
00346     close (old_stdin);
00347     close (old_stdout);
00348     close (old_stderr);
00349
00350     free (requoted);
00351     return result;
00352     }
00353 }
00354
00355 /* Running children with pipes connected to them.  */
00356
00357 /* It's kind of ridiculous the hoops we're jumping through to get
00358    this working.  _pipe and dup2 and _spawnmumble work just fine, except
00359    that the child inherits a file descriptor for the writing end of the
00360    pipe, and thus will never receive end-of-file on it.  If you know of
00361    a better way to implement the piped_child function, please let me know.
00362
00363    You can apparently specify _O_NOINHERIT when you open a file, but there's
00364    apparently no fcntl function, so you can't change that bit on an existing
00365    file descriptor.  */
00366
00367 /* Given a handle, make an inheritable duplicate of it, and close
00368    the original.  */
00369 static HANDLE
00370 inheritable (HANDLE in)
00371 {
00372     HANDLE copy;
00373     HANDLE self = GetCurrentProcess ();
00374
00375     if (! DuplicateHandle (self, in, self, &copy,
00376                0, 1 /* fInherit */,
00377                DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
00378         return INVALID_HANDLE_VALUE;
00379
00380     return copy;
00381 }
00382
00383
00384 /* Initialize the SECURITY_ATTRIBUTES structure *LPSA.  Set its
00385    bInheritHandle flag according to INHERIT.  */
00386 static void
00387 init_sa (LPSECURITY_ATTRIBUTES lpsa, BOOL inherit)
00388 {
00389   lpsa->nLength = sizeof(*lpsa);
00390   lpsa->bInheritHandle = inherit;
00391   lpsa->lpSecurityDescriptor = NULL;
00392 }
00393
00394
00395 enum inherit_pipe { inherit_reading, inherit_writing };
00396
00397 /* Create a pipe.  Set READWRITE[0] to its reading end, and
00398    READWRITE[1] to its writing end.  If END is inherit_reading,
00399    make the only the handle for the pipe's reading end inheritable.
00400    If END is inherit_writing, make only the handle for the pipe's
00401    writing end inheritable.  Return 0 if we succeed, -1 if we fail.
00402
00403    Why does inheritability matter?  Consider the case of a
00404    pipe carrying data from the parent process to the child
00405    process.  The child wants to read data from the parent until
00406    it reaches the EOF.  Now, the only way to send an EOF on a pipe
00407    is to close all the handles to its writing end.  Obviously, the
00408    parent has a handle to the writing end when it creates the child.
00409    If the child inherits this handle, then it will never close it
00410    (the child has no idea it's inherited it), and will thus never
00411    receive an EOF on the pipe because it's holding a handle
00412    to it.
00413
00414    In Unix, the child process closes the pipe ends before it execs.
00415    In Windows NT, you create the pipe with uninheritable handles, and then use
00416    DuplicateHandle to make the appropriate ends inheritable.  */
00417
00418 static int
00419 my_pipe (HANDLE *readwrite, enum inherit_pipe end)
00420 {
00421     HANDLE read, write;
00422     SECURITY_ATTRIBUTES sa;
00423
00424     init_sa (&sa, 0);
00425     if (! CreatePipe (&read, &write, &sa, 1 << 13))
00426     {
00427         errno = EMFILE;
00428         return -1;
00429     }
00430     if (end == inherit_reading)
00431         read = inheritable (read);
00432     else
00433         write = inheritable (write);
00434
00435     if (read == INVALID_HANDLE_VALUE
00436         || write == INVALID_HANDLE_VALUE)
00437     {
00438         CloseHandle (read);
00439     CloseHandle (write);
00440     errno = EMFILE;
00441     return -1;
00442     }
00443
00444     readwrite[0] = read;
00445     readwrite[1] = write;
00446
00447     return 0;
00448 }
00449
00450
00451 /* Initialize the STARTUPINFO structure *LPSI.  */
00452 static void
00453 init_si (LPSTARTUPINFO lpsi)
00454 {
00455   memset (lpsi, 0, sizeof (*lpsi));
00456   lpsi->cb = sizeof(*lpsi);
00457   lpsi->lpReserved = NULL;
00458   lpsi->lpTitle = NULL;
00459   lpsi->lpReserved2 = NULL;
00460   lpsi->cbReserved2 = 0;
00461   lpsi->lpDesktop = NULL;
00462   lpsi->dwFlags = 0;
00463 }
00464
00465
00466 /* Create a child process running COMMAND with IN as its standard input,
00467    and OUT as its standard output.  Return a handle to the child, or
00468    INVALID_HANDLE_VALUE.  */
00469 static int
00470 start_child (char *command, HANDLE in, HANDLE out)
00471 {
00472   STARTUPINFO si;
00473   PROCESS_INFORMATION pi;
00474   BOOL status;
00475
00476   /* The STARTUPINFO structure can specify handles to pass to the
00477      child as its standard input, output, and error.  */
00478   init_si (&si);
00479   si.hStdInput = in;
00480   si.hStdOutput = out;
00481   si.hStdError  = (HANDLE) _get_osfhandle (2);
00482   si.dwFlags = STARTF_USESTDHANDLES;
00483 #if defined(CVSGUI_PIPE)
00484   si.dwFlags |= STARTF_USESHOWWINDOW;
00485   si.wShowWindow = SW_SHOWMINNOACTIVE;
00486 #endif
00487
00488   status = CreateProcess ((LPCTSTR) NULL,
00489                           (LPTSTR) command,
00490                   (LPSECURITY_ATTRIBUTES) NULL, /* lpsaProcess */
00491                   (LPSECURITY_ATTRIBUTES) NULL, /* lpsaThread */
00492                   TRUE, /* fInheritHandles */
00493                   0,    /* fdwCreate */
00494                   (LPVOID) 0, /* lpvEnvironment */
00495                   (LPCTSTR) 0, /* lpszCurDir */
00496                   &si,  /* lpsiStartInfo */
00497                   &pi); /* lppiProcInfo */
00498
00499   if (! status)
00500   {
00501       DWORD error_code = GetLastError ();
00502       switch (error_code)
00503       {
00504       case ERROR_NOT_ENOUGH_MEMORY:
00505       case ERROR_OUTOFMEMORY:
00506           errno = ENOMEM; break;
00507       case ERROR_BAD_EXE_FORMAT:
00508           errno = ENOEXEC; break;
00509       case ERROR_ACCESS_DENIED:
00510           errno = EACCES; break;
00511       case ERROR_NOT_READY:
00512       case ERROR_FILE_NOT_FOUND:
00513       case ERROR_PATH_NOT_FOUND:
00514       default:
00515           errno = ENOENT; break;
00516       }
00517       return (int) INVALID_HANDLE_VALUE;
00518   }
00519
00520   /* The _spawn and _cwait functions in the C runtime library
00521      seem to operate on raw NT handles, not PID's.  Odd, but we'll
00522      deal.  */
00523   return (int) pi.hProcess;
00524 }
00525
00526
00527 /* Given an array of arguments that one might pass to spawnv,
00528    construct a command line that one might pass to CreateProcess.
00529    Try to quote things appropriately.  */
00530 static char *
00531 build_command (char **argv)
00532 {
00533     int len;
00534
00535     /* Compute the total length the command will have.  */
00536     {
00537         int i;
00538
00539     len = 0;
00540         for (i = 0; argv[i]; i++)
00541     {
00542         char *p;
00543
00544         len += 2;  /* for the double quotes */
00545
00546         for (p = argv[i]; *p; p++)
00547         {
00548             if (*p == '"')
00549             len += 2;
00550         else
00551             len++;
00552         }
00553         len++;  /* for the space or the '\0'  */
00554     }
00555     }
00556
00557     {
00558     /* The + 10 is in case len is 0.  */
00559         char *command = (char *) malloc (len + 10);
00560     int i;
00561     char *p;
00562
00563     if (! command)
00564     {
00565         errno = ENOMEM;
00566         return command;
00567     }
00568
00569     p = command;
00570         *p = '\0';
00571     /* copy each element of argv to command, putting each command
00572        in double quotes, and backslashing any quotes that appear
00573        within an argument.  */
00574     for (i = 0; argv[i]; i++)
00575     {
00576         char *a;
00577         *p++ = '"';
00578         for (a = argv[i]; *a; a++)
00579         {
00580             if (*a == '"')
00581             *p++ = '\\', *p++ = '"';
00582         else
00583             *p++ = *a;
00584         }
00585         *p++ = '"';
00586         *p++ = ' ';
00587     }
00588     if (p > command)
00589         p[-1] = '\0';
00590
00591         return command;
00592     }
00593 }
00594
00595
00596 /* Create an asynchronous child process executing ARGV,
00597    with its standard input and output connected to the
00598    parent with pipes.  Set *TO to the file descriptor on
00599    which one writes data for the child; set *FROM to
00600    the file descriptor from which one reads data from the child.
00601    Return the handle of the child process (this is what
00602    _cwait and waitpid expect).  */
00603 int
00604 piped_child (char **argv, int *to, int *from)
00605 {
00606   int child;
00607   HANDLE pipein[2], pipeout[2];
00608   char *command;
00609
00610   /* Turn argv into a form acceptable to CreateProcess.  */
00611   command = build_command (argv);
00612   if (! command)
00613       return -1;
00614
00615   /* Create pipes for communicating with child.  Arrange for
00616      the child not to inherit the ends it won't use.  */
00617   if (my_pipe (pipein, inherit_reading) == -1
00618       || my_pipe (pipeout, inherit_writing) == -1)
00619       return -1;
00620
00621   child = start_child (command, pipein[0], pipeout[1]);
00622   free (command);
00623   if (child == (int) INVALID_HANDLE_VALUE)
00624       return -1;
00625
00626   /* Close the pipe ends the parent doesn't use.  */
00627   CloseHandle (pipein[0]);
00628   CloseHandle (pipeout[1]);
00629
00630   /* Given the pipe handles, turn them into file descriptors for
00631      use by the caller.  */
00632   if ((*to      = _open_osfhandle ((long) pipein[1],  _O_BINARY)) == -1
00633       || (*from = _open_osfhandle ((long) pipeout[0], _O_BINARY)) == -1)
00634       return -1;
00635
00636   return child;
00637 }
00638
00639 /*
00640  * dir = 0 : main proc writes to new proc, which writes to oldfd
00641  * dir = 1 : main proc reads from new proc, which reads from oldfd
00642  *
00643  * Returns: a file descriptor.  On failure (e.g., the exec fails),
00644  * then filter_stream_through_program() complains and dies.
00645  */
00646
00647 int
00648 filter_stream_through_program (oldfd, dir, prog, pidp)
00649      int oldfd, dir;
00650      char **prog;
00651      pid_t *pidp;
00652 {
00653     HANDLE pipe[2];
00654     char *command;
00655     int child;
00656     HANDLE oldfd_handle;
00657     HANDLE newfd_handle;
00658     int newfd;
00659
00660     /* Get the OS handle associated with oldfd, to be passed to the child.  */
00661     if ((oldfd_handle = (HANDLE) _get_osfhandle (oldfd)) < 0)
00662     error (1, errno, "cannot _get_osfhandle");
00663
00664     if (dir)
00665     {
00666         /* insert child before parent, pipe goes child->parent.  */
00667     if (my_pipe (pipe, inherit_writing) == -1)
00668         error (1, errno, "cannot my_pipe");
00669     if ((command = build_command (prog)) == NULL)
00670         error (1, errno, "cannot build_command");
00671     child = start_child (command, oldfd_handle, pipe[1]);
00672     free (command);
00673     if (child == (int) INVALID_HANDLE_VALUE)
00674         error (1, errno, "cannot start_child");
00675     close (oldfd);
00676     CloseHandle (pipe[1]);
00677     newfd_handle = pipe[0];
00678     }
00679     else
00680     {
00681         /* insert child after parent, pipe goes parent->child.  */
00682     if (my_pipe (pipe, inherit_reading) == -1)
00683         error (1, errno, "cannot my_pipe");
00684     if ((command = build_command (prog)) == NULL)
00685         error (1, errno, "cannot build_command");
00686     child = start_child (command, pipe[0], oldfd_handle);
00687     free (command);
00688     if (child == (int) INVALID_HANDLE_VALUE)
00689         error (1, errno, "cannot start_child");
00690     close (oldfd);
00691     CloseHandle (pipe[0]);
00692     newfd_handle = pipe[1];
00693     }
00694
00695     if ((newfd = _open_osfhandle ((long) newfd_handle, _O_BINARY)) == -1)
00696         error (1, errno, "cannot _open_osfhandle");
00697
00698     if (pidp)
00699     *pidp = child;
00700     return newfd;
00701 }
00702
00703
00704 /* Arrange for the file descriptor FD to not be inherited by child
00705    processes.  At the moment, CVS uses this function only on pipes
00706    returned by piped_child, and our implementation of piped_child
00707    takes care of setting the file handles' inheritability, so this
00708    can be a no-op.  */
00709 void
00710 close_on_exec (int fd)
00711 {
00712 }
Generated on Sun Oct 21 12:41:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/sockerror.c Source File

cvs-1.10/windows-NT/sockerror.c

Go to the documentation of this file.
00001 /* sockerror.c --- convert WinSock error number to string
00002    Vince Del Vecchio <vdelvecc@spd.analog.com>
00003
00004    This file is part of GNU CVS.
00005
00006    GNU CVS is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published by the
00008    Free Software Foundation; either version 2, or (at your option) any
00009    later version.
00010
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.  */
00015
00016 #include <stdio.h>
00017 #include <winsock.h>
00018
00019 struct err_strs {
00020     char **strs;
00021     int first;
00022     int last;
00023 };
00024
00025 static char *errs1[] = {
00026     /* EINTR        */ "Interrupted system call"
00027 };
00028
00029 static char *errs2[] = {
00030     /* EBADF        */ "Bad file descriptor"
00031 };
00032
00033 static char *errs3[] = {
00034     /* EACCES       */ "Permission denied",
00035     /* EFAULT       */ "Bad address"
00036 };
00037
00038 static char *errs4[] = {
00039     /* EINVAL       */ "Invalid argument"
00040 };
00041
00042 static char *errs5[] = {
00043     /* EMFILE       */ "Too many open files",
00044 };
00045
00046 static char *errs6[] = {
00047     /* EWOULDBLOCK  */ "Resource temporarily unavailable",
00048     /* EINPROGRESS  */ "Operation now in progress",
00049     /* EALREADY     */ "Operation already in progress",
00050     /* ENOTSOCK     */ "Socket operation on non-socket",
00051     /* EDESTADDRREQ */ "Destination address required",
00052     /* EMSGSIZE     */ "Message too long",
00053     /* EPROTOTYPE   */ "Protocol wrong type for socket",
00054     /* ENOPROTOOPT  */ "Protocol not available",
00055     /* EPROTONOSUPPORT  */ "Protocol not supported",
00056     /* ESOCKTNOSUPPORT  */ "Socket type not supported",
00057     /* EOPNOTSUPP   */ "Operation not supported on socket",
00058     /* EPFNOSUPPORT */ "Protocol family not supported",
00059     /* EAFNOSUPPORT */ "Address family not supported by protocol",
00060     /* EADDRINUSE   */ "Address already in use",
00061     /* EADDRNOTAVAIL    */ "Can't assign requested address",
00062     /* ENETDOWN     */ "Network is down",
00063     /* ENETUNREACH  */ "Network is unreachable",
00064     /* ENETRESET    */ "Network connection dropped on reset",
00065     /* ECONNABORTED */ "Software caused connection abort",
00066     /* ECONNRESET   */ "Connection reset by peer",
00067     /* ENOBUFS      */ "No buffer space available",
00068     /* EISCONN      */ "Socket is already connected",
00069     /* ENOTCONN     */ "Socket is not connected",
00070     /* ESHUTDOWN    */ "Can't send after socket shutdown",
00071     /* ETOOMANYREFS */ "Too many references: can't splice",
00072     /* ETIMEDOUT    */ "Connection timed out",
00073     /* ECONNREFUSED */ "Connection refused",
00074     /* ELOOP        */ "Too many levels of symbolic links",
00075     /* ENAMETOOLONG */ "File name too long",
00076     /* EHOSTDOWN    */ "Host is down",
00077     /* EHOSTUNREACH */ "No route to host",
00078     /* ENOTEMPTY    */ "Directory not empty",
00079     /* EPROCLIM     */ "Too many processes",
00080     /* EUSERS       */ "Too many users",
00081     /* EDQUOT       */ "Disc quota exceeded",
00082     /* ESTALE       */ "Stale NFS file handle",
00083     /* EREMOTE      */ "Object is remote"
00084 };
00085
00086 static char *errs7[] = {
00087     /* SYSNOTREADY  */ "Network subsystem unavailable",
00088     /* VERNOTSUPPORTED  */ "Requested WinSock version not supported",
00089     /* NOTINITIALISED   */ "WinSock was not initialized"
00090 };
00091
00092 #ifdef WSAEDISCON
00093 static char *errs8[] = {
00094     /* EDISCON      */ "Graceful shutdown in progress"
00095 };
00096 #endif
00097
00098 static char *errs9[] = {
00099     /* HOST_NOT_FOUND   */ "Unknown host",
00100     /* TRY_AGAIN    */ "Host name lookup failure",
00101     /* NO_RECOVERY  */ "Unknown server error",
00102     /* NO_DATA      */ "No address associated with name",
00103 };
00104
00105 /* Some of these errors are defined in the winsock.h header file I have,
00106    but not in the Winsock 1.1 spec.  I include them some of them anyway,
00107    where it is not too hard to avoid referencing the symbolic constant. */
00108
00109 static struct err_strs sock_errlist[] = {
00110     { errs1,    WSAEINTR,   WSAEINTR },
00111     { errs2,    WSAEBADF,   WSAEBADF },
00112     { errs3,    WSAEACCES,  WSAEFAULT },
00113     { errs4,    WSAEINVAL,  WSAEINVAL },
00114     { errs5,    WSAEMFILE,  WSAEMFILE },
00115     { errs6,    WSAEWOULDBLOCK, WSAEHOSTUNREACH + 6 },
00116     { errs7,    WSASYSNOTREADY, WSANOTINITIALISED },
00117 #ifdef WSAEDISCON
00118     { errs8,    WSAEDISCON, WSAEDISCON },
00119 #endif
00120     { errs9,    WSAHOST_NOT_FOUND, WSANO_DATA }
00121 };
00122
00123 char *
00124 sock_strerror (int errnum)
00125 {
00126     static char buf[40];
00127     int i;
00128
00129     for (i = 0; i < (sizeof sock_errlist / sizeof *sock_errlist); i++)
00130     {
00131     if (errnum >= sock_errlist[i].first && errnum <= sock_errlist[i].last)
00132         return sock_errlist[i].strs[errnum - sock_errlist[i].first];
00133     }
00134     sprintf(buf, "Unknown socket error: %d", errnum);
00135     return buf;
00136 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


sockerror.c File Reference

cvs-1.10/windows-NT/sockerror.c File Reference

#include <stdio.h>
#include <winsock.h>

Include dependency graph for sockerror.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | err_strs

Functions

char * | sock_strerror (int errnum)

Variables

char * | errs1 []
char * | errs2 []
char * | errs3 []
char * | errs4 []
char * | errs5 []
char * | errs6 []
char * | errs7 []
char * | errs9 []
err_strs sock_errlist []

Function Documentation

char* sock_strerror ( int errnum )

Definition at line 124 of file sockerror.c.

00125 {
00126     static char buf[40];
00127     int i;
00128
00129     for (i = 0; i < (sizeof sock_errlist / sizeof *sock_errlist); i++)
00130     {
00131     if (errnum >= sock_errlist[i].first && errnum <= sock_errlist[i].last)
00132         return sock_errlist[i].strs[errnum - sock_errlist[i].first];
00133     }
00134     sprintf(buf, "Unknown socket error: %d", errnum);
00135     return buf;
00136 }

Variable Documentation

char* errs1[] [static]

Initial value:

 {
     "Interrupted system call"
}

Definition at line 25 of file sockerror.c.

char* errs2[] [static]

Initial value:

 {
     "Bad file descriptor"
}

Definition at line 29 of file sockerror.c.

char* errs3[] [static]

Initial value:

 {
     "Permission denied",
     "Bad address"
}

Definition at line 33 of file sockerror.c.

char* errs4[] [static]

Initial value:

 {
     "Invalid argument"
}

Definition at line 38 of file sockerror.c.

char* errs5[] [static]

Initial value:

 {
     "Too many open files",
}

Definition at line 42 of file sockerror.c.

char* errs6[] [static]

Definition at line 46 of file sockerror.c.

char* errs7[] [static]

Initial value:

 {
     "Network subsystem unavailable",
     "Requested WinSock version not supported",
     "WinSock was not initialized"
}

Definition at line 86 of file sockerror.c.

char* errs9[] [static]

Initial value:

 {
     "Unknown host",
     "Host name lookup failure",
     "Unknown server error",
     "No address associated with name",
}

Definition at line 98 of file sockerror.c.

struct err_strs sock_errlist[] [static]

Initial value:

 {
    { errs1,    WSAEINTR,   WSAEINTR },
    { errs2,    WSAEBADF,   WSAEBADF },
    { errs3,    WSAEACCES,  WSAEFAULT },
    { errs4,    WSAEINVAL,  WSAEINVAL },
    { errs5,    WSAEMFILE,  WSAEMFILE },
    { errs6,    WSAEWOULDBLOCK, WSAEHOSTUNREACH + 6 },
    { errs7,    WSASYSNOTREADY, WSANOTINITIALISED },

    { errs9,    WSAHOST_NOT_FOUND, WSANO_DATA }
}

Definition at line 109 of file sockerror.c.

Generated on Sun Oct 21 12:43:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


startserver.c File Reference

cvs-1.10/windows-NT/startserver.c File Reference

#include "cvs.h"
#include "rcmd.h"
#include <stdlib.h>
#include <winsock.h>
#include <malloc.h>
#include <io.h>
#include <errno.h>

Include dependency graph for startserver.c:

Include dependency graph

Go to the source code of this file.

Functions

void | wnt_start_server (int *tofd, int *fromfd, char *client_user, char *server_user, char *server_host, char *server_cvsroot)
void | wnt_shutdown_server (int fd)

Variables

int | opened_a_socket = 0

Function Documentation

void wnt_shutdown_server ( int fd )

Definition at line 67 of file startserver.c.

00068 {
00069     if (opened_a_socket)
00070     {
00071     SOCKET s;
00072
00073     s = fd;
00074     if (shutdown (s, 2) == SOCKET_ERROR)
00075         error (1, 0, "couldn't shutdown server connection: %s",
00076            SOCK_STRERROR (SOCK_ERRNO));
00077     if (closesocket (s) == SOCKET_ERROR)
00078         error (1, 0, "couldn't close server connection: %s",
00079            SOCK_STRERROR (SOCK_ERRNO));
00080     }
00081     else
00082     {
00083     if (close (fd) < 0)
00084         error (1, errno, "cannot close server connection");
00085     }
00086 }

void wnt_start_server | ( | int * | tofd,
 |  | int * | fromfd,
 |  | char * | client_user,
 |  | char * | server_user,
 |  | char * | server_host,
 |  | char * | server_cvsroot
 | ) |

Definition at line 20 of file startserver.c.

00025 {
00026     char *cvs_server;
00027     char *command;
00028     struct servent *sptr;
00029     unsigned short port;
00030     int read_fd;
00031     char *portenv;
00032
00033     if (! (cvs_server = getenv ("CVS_SERVER")))
00034         cvs_server = "cvs";
00035     command = xmalloc (strlen (cvs_server)
00036                + strlen (server_cvsroot)
00037                + 50);
00038     sprintf (command, "%s -d %s server", cvs_server, server_cvsroot);
00039
00040     portenv = getenv("CVS_RCMD_PORT");
00041     if (portenv)
00042     port = atoi(portenv);
00043     else if ((sptr = getservbyname("shell", "tcp")) != NULL)
00044     port = sptr->s_port;
00045     else
00046     port = IPPORT_CMDSERVER; /* shell/tcp */
00047
00048     read_fd = rcmd (&server_host,
00049                     port,
00050                     client_user,
00051                 (server_user ? server_user : client_user),
00052                 command,
00053                 0);
00054     if (read_fd < 0)
00055     error (1, 0, "cannot start server via rcmd: %s",
00056            SOCK_STRERROR (SOCK_ERRNO));
00057
00058     *tofd = read_fd;
00059     *fromfd = read_fd;
00060     free (command);
00061
00062     opened_a_socket = 1;
00063 }

Variable Documentation

int opened_a_socket = 0 [static]

Definition at line 17 of file startserver.c.

Generated on Sun Oct 21 12:42:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/startserver.c Source File

cvs-1.10/windows-NT/startserver.c

Go to the documentation of this file.
00001 /* startserver.c --- open a connection to the CVS server under Windows NT
00002    Jim Blandy <jimb@cyclic.com> --- August 1995  */
00003
00004 #include "cvs.h"
00005 #include "rcmd.h"
00006
00007 #include <stdlib.h>
00008 #include <winsock.h>
00009 #include <malloc.h>
00010 #include <io.h>
00011 #include <errno.h>
00012
00013 /* Keep track of whether we've opened a socket so that wnt_shutdown_server
00014    can do the correct thing.  We don't want to call shutdown or
00015    closesocket on a pipe. */
00016
00017 static int opened_a_socket = 0;
00018
00019 void
00020 wnt_start_server (int *tofd, int *fromfd,
00021           char *client_user,
00022           char *server_user,
00023           char *server_host,
00024           char *server_cvsroot)
00025 {
00026     char *cvs_server;
00027     char *command;
00028     struct servent *sptr;
00029     unsigned short port;
00030     int read_fd;
00031     char *portenv;
00032
00033     if (! (cvs_server = getenv ("CVS_SERVER")))
00034         cvs_server = "cvs";
00035     command = xmalloc (strlen (cvs_server)
00036                + strlen (server_cvsroot)
00037                + 50);
00038     sprintf (command, "%s -d %s server", cvs_server, server_cvsroot);
00039
00040     portenv = getenv("CVS_RCMD_PORT");
00041     if (portenv)
00042     port = atoi(portenv);
00043     else if ((sptr = getservbyname("shell", "tcp")) != NULL)
00044     port = sptr->s_port;
00045     else
00046     port = IPPORT_CMDSERVER; /* shell/tcp */
00047
00048     read_fd = rcmd (&server_host,
00049                     port,
00050                     client_user,
00051                 (server_user ? server_user : client_user),
00052                 command,
00053                 0);
00054     if (read_fd < 0)
00055     error (1, 0, "cannot start server via rcmd: %s",
00056            SOCK_STRERROR (SOCK_ERRNO));
00057
00058     *tofd = read_fd;
00059     *fromfd = read_fd;
00060     free (command);
00061
00062     opened_a_socket = 1;
00063 }
00064
00065
00066 void
00067 wnt_shutdown_server (int fd)
00068 {
00069     if (opened_a_socket)
00070     {
00071     SOCKET s;
00072
00073     s = fd;
00074     if (shutdown (s, 2) == SOCKET_ERROR)
00075         error (1, 0, "couldn't shutdown server connection: %s",
00076            SOCK_STRERROR (SOCK_ERRNO));
00077     if (closesocket (s) == SOCKET_ERROR)
00078         error (1, 0, "couldn't close server connection: %s",
00079            SOCK_STRERROR (SOCK_ERRNO));
00080     }
00081     else
00082     {
00083     if (close (fd) < 0)
00084         error (1, errno, "cannot close server connection");
00085     }
00086 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


stripslash.c File Reference

cvs-1.10/windows-NT/stripslash.c File Reference

#include <string.h>

Include dependency graph for stripslash.c:

Include dependency graph

Go to the source code of this file.

Functions

void strip_trailing_slashes (path) char *path

Function Documentation

void strip_trailing_slashes ( path )

Generated on Sun Oct 21 12:42:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/stripslash.c Source File

cvs-1.10/windows-NT/stripslash.c

Go to the documentation of this file.
00001 /* stripslash.c -- remove trailing slashes from a string
00002    Copyright (C) 1990 Free Software Foundation, Inc.
00003
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.  */
00013
00014 #include <string.h>
00015
00016 /* Remove trailing slashes from PATH. */
00017
00018 void
00019 strip_trailing_slashes (path)
00020      char *path;
00021 {
00022   int last;
00023
00024   last = strlen (path) - 1;
00025   while (last > 0 && (path[last] == '/' || path[last] == '\\'))
00026     path[last--] = '\0';
00027 }
Generated on Sun Oct 21 12:41:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


waitpid.c File Reference

cvs-1.10/windows-NT/waitpid.c File Reference

#include <assert.h>
#include <stdio.h>
#include <process.h>
#include <errno.h>
#include "config.h"

Include dependency graph for waitpid.c:

Include dependency graph

Go to the source code of this file.

Functions

int | waitpid (pid, statusp, options) int pid

Variables

int * | statusp
int | options

Function Documentation

int waitpid | ( | pid | ,
 |  | statusp | ,
 |  | options |
 | ) |

Variable Documentation

int options

Definition at line 16 of file waitpid.c.

Referenced by AuthenPserver::OnSetupEnv(), and AuthenSSH::OnSetupEnv().

int* statusp

Definition at line 15 of file waitpid.c.

Generated on Sun Oct 21 12:43:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/waitpid.c Source File

cvs-1.10/windows-NT/waitpid.c

Go to the documentation of this file.
00001 /* waitpid.c --- waiting for process termination, under Windows NT
00002    Jim Blandy <jimb@cyclic.com> --- August 1995  */
00003
00004 #include <assert.h>
00005 #include <stdio.h>
00006 #include <process.h>
00007 #include <errno.h>
00008
00009 #include "config.h"
00010
00011 /* Wait for the process PID to exit.  Put the return status in *statusp.
00012    OPTIONS is not supported yet under Windows NT.  We hope it's always zero.  */
00013 pid_t waitpid (pid, statusp, options)
00014      pid_t pid;
00015      int *statusp;
00016      int options;
00017 {
00018     /* We don't know how to deal with any options yet.  */
00019     assert (options == 0);
00020
00021     return _cwait (statusp, pid, _WAIT_CHILD);
00022 }
Generated on Sun Oct 21 12:41:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/win32.c Source File

cvs-1.10/windows-NT/win32.c

Go to the documentation of this file.
00001 /*
00002  * win32.c
00003  * - utility functions for cvs under win32
00004  *
00005  */
00006
00007 #include <ctype.h>
00008 #include <stdio.h>
00009 #include <conio.h>
00010
00011 #define WIN32_LEAN_AND_MEAN
00012 #include <windows.h>
00013
00014 #include <config.h>
00015 #include <winsock.h>
00016 #include <stdlib.h>
00017
00018 #include "cvs.h"
00019
00020 /* Try to work out if this is a GMT FS.  There is probably
00021    a way of doing this that works for all FS's, but this
00022    detects FAT at least */
00023 #define GMT_FS(_s) (!strstr(_s,"FAT"))
00024
00025 #define PP_PASTE(x) #x
00026 #define PP_STRINGIZE(x) PP_PASTE(x)
00027
00028 static struct { DWORD err; int dos;} errors[] =
00029 {
00030         {  ERROR_INVALID_FUNCTION,       EINVAL    },  /* 1 */
00031         {  ERROR_FILE_NOT_FOUND,         ENOENT    },  /* 2 */
00032         {  ERROR_PATH_NOT_FOUND,         ENOENT    },  /* 3 */
00033         {  ERROR_TOO_MANY_OPEN_FILES,    EMFILE    },  /* 4 */
00034         {  ERROR_ACCESS_DENIED,          EACCES    },  /* 5 */
00035         {  ERROR_INVALID_HANDLE,         EBADF     },  /* 6 */
00036         {  ERROR_ARENA_TRASHED,          ENOMEM    },  /* 7 */
00037         {  ERROR_NOT_ENOUGH_MEMORY,      ENOMEM    },  /* 8 */
00038         {  ERROR_INVALID_BLOCK,          ENOMEM    },  /* 9 */
00039         {  ERROR_BAD_ENVIRONMENT,        E2BIG     },  /* 10 */
00040         {  ERROR_BAD_FORMAT,             ENOEXEC   },  /* 11 */
00041         {  ERROR_INVALID_ACCESS,         EINVAL    },  /* 12 */
00042         {  ERROR_INVALID_DATA,           EINVAL    },  /* 13 */
00043         {  ERROR_INVALID_DRIVE,          ENOENT    },  /* 15 */
00044         {  ERROR_CURRENT_DIRECTORY,      EACCES    },  /* 16 */
00045         {  ERROR_NOT_SAME_DEVICE,        EXDEV     },  /* 17 */
00046         {  ERROR_NO_MORE_FILES,          ENOENT    },  /* 18 */
00047         {  ERROR_LOCK_VIOLATION,         EACCES    },  /* 33 */
00048         {  ERROR_BAD_NETPATH,            ENOENT    },  /* 53 */
00049         {  ERROR_NETWORK_ACCESS_DENIED,  EACCES    },  /* 65 */
00050         {  ERROR_BAD_NET_NAME,           ENOENT    },  /* 67 */
00051         {  ERROR_FILE_EXISTS,            EEXIST    },  /* 80 */
00052         {  ERROR_CANNOT_MAKE,            EACCES    },  /* 82 */
00053         {  ERROR_FAIL_I24,               EACCES    },  /* 83 */
00054         {  ERROR_INVALID_PARAMETER,      EINVAL    },  /* 87 */
00055         {  ERROR_NO_PROC_SLOTS,          EAGAIN    },  /* 89 */
00056         {  ERROR_DRIVE_LOCKED,           EACCES    },  /* 108 */
00057         {  ERROR_BROKEN_PIPE,            EPIPE     },  /* 109 */
00058         {  ERROR_DISK_FULL,              ENOSPC    },  /* 112 */
00059         {  ERROR_INVALID_TARGET_HANDLE,  EBADF     },  /* 114 */
00060         {  ERROR_INVALID_HANDLE,         EINVAL    },  /* 124 */
00061         {  ERROR_WAIT_NO_CHILDREN,       ECHILD    },  /* 128 */
00062         {  ERROR_CHILD_NOT_COMPLETE,     ECHILD    },  /* 129 */
00063         {  ERROR_DIRECT_ACCESS_HANDLE,   EBADF     },  /* 130 */
00064         {  ERROR_NEGATIVE_SEEK,          EINVAL    },  /* 131 */
00065         {  ERROR_SEEK_ON_DEVICE,         EACCES    },  /* 132 */
00066         {  ERROR_DIR_NOT_EMPTY,          ENOTEMPTY },  /* 145 */
00067         {  ERROR_NOT_LOCKED,             EACCES    },  /* 158 */
00068         {  ERROR_BAD_PATHNAME,           ENOENT    },  /* 161 */
00069         {  ERROR_MAX_THRDS_REACHED,      EAGAIN    },  /* 164 */
00070         {  ERROR_LOCK_FAILED,            EACCES    },  /* 167 */
00071         {  ERROR_ALREADY_EXISTS,         EEXIST    },  /* 183 */
00072         {  ERROR_FILENAME_EXCED_RANGE,   ENOENT    },  /* 206 */
00073         {  ERROR_NESTING_NOT_ALLOWED,    EAGAIN    },  /* 215 */
00074         {  ERROR_NOT_ENOUGH_QUOTA,       ENOMEM    }    /* 1816 */
00075 };
00076
00077 static const WORD month_len [12] =
00078 {
00079     31, /* Jan */
00080     28, /* Feb */
00081     31, /* Mar */
00082     30, /* Apr */
00083     31, /* May */
00084     30, /* Jun */
00085     31, /* Jul */
00086     31, /* Aug */
00087     30, /* Sep */
00088     31, /* Oct */
00089     30, /* Nov */
00090     31  /* Dec */
00091 };
00092
00093 /* One second = 10,000,000 * 100 nsec */
00094     static const ULONGLONG systemtime_second = 10000000L;
00095
00096
00097 void
00098 init_winsock (int *argc, char ***argv)
00099 {
00100     WSADATA data;
00101
00102     if (WSAStartup (MAKEWORD (1, 1), &data))
00103     {
00104     fprintf (stderr, "cvs: unable to initialize winsock\n");
00105     exit (1);
00106     }
00107 }
00108
00109 void
00110 wnt_cleanup (void)
00111 {
00112     if (WSACleanup ())
00113     {
00114 #ifdef SERVER_ACTIVE
00115     if (server_active || error_use_protocol)
00116         /* FIXME: how are we supposed to report errors?  As of now
00117            (Sep 98), error() can in turn call us (if it is out of
00118            memory) and in general is built on top of lots of
00119            stuff.  */
00120         ;
00121     else
00122 #endif
00123         fprintf (stderr, "cvs: cannot WSACleanup: %s\n",
00124              sock_strerror (WSAGetLastError ()));
00125     }
00126 }
00127
00128 unsigned sleep(unsigned seconds)
00129 {
00130     Sleep(1000*seconds);
00131     return 0;
00132 }
00133
00134 #if 0
00135
00136 /* WinSock has a gethostname.  But note that WinSock gethostname may
00137    want to talk to the network, which is kind of bogus in the
00138    non-client/server case.  I'm not sure I can think of any obvious
00139    solution.  Most of the ways I can think of to figure out whether
00140    to call gethostname or GetComputerName seem kind of kludgey, and/or
00141    might result in picking the name in a potentially confusing way
00142    (I'm not sure exactly how the name(s) are set).  */
00143
00144 int gethostname(char* name, int namelen)
00145 {
00146     DWORD dw = namelen;
00147     BOOL ret = GetComputerName(name, &dw);
00148     namelen = dw;
00149     return (ret) ? 0 : -1;
00150 }
00151 #endif
00152
00153 char *win32getlogin()
00154 {
00155     static char name[256];
00156     DWORD dw = 256;
00157     GetUserName (name, &dw);
00158     if (name[0] == '\0')
00159     return NULL;
00160     else
00161     return name;
00162 }
00163
00164
00165 pid_t
00166 getpid ()
00167 {
00168     return (pid_t) GetCurrentProcessId();
00169 }
00170
00171 #ifdef CVSGUI_PIPE
00172 #   undef getpass
00173 #endif
00174
00175 char *
00176 getpass (const char *prompt)
00177 {
00178 #ifndef CVSGUI_SHL
00179     static char pwd_buf[128];
00180     size_t i;
00181
00182     fputs (prompt, stderr);
00183     fflush (stderr);
00184     for (i = 0; i < sizeof (pwd_buf) - 1; ++i)
00185     {
00186     pwd_buf[i] = _getch ();
00187     if (pwd_buf[i] == '\r')
00188         break;
00189     }
00190     pwd_buf[i] = '\0';
00191     fputs ("\n", stderr);
00192     return pwd_buf;
00193 #else /* CVSGUI_SHL */
00194     /* let WinCvs get the password */
00195     return getenv("CVS_GETPASS");
00196 #endif /* CVSGUI_SHL */
00197 }
00198
00199 static void _dosmaperr(DWORD dwErr)
00200 {
00201     int n;
00202     for(n=0; n<sizeof(errors)/sizeof(errors[0]); n++)
00203     {
00204         if(errors[n].err==dwErr)
00205         {
00206             errno=errors[n].dos;
00207             return;
00208         }
00209     }
00210     errno=EFAULT;
00211 }
00212
00213 /* Is the year a leap year?
00214  *
00215  * Use standard Gregorian: every year divisible by 4
00216  * except centuries indivisible by 400.
00217  *
00218  * INPUTS: WORD year the year (AD)
00219  *
00220  * OUTPUTS: TRUE if it's a leap year.
00221  */
00222 BOOL IsLeapYear ( WORD year )
00223 {
00224     return ( (year & 3u == 0)
00225             && ( (year % 100u == 0)
00226                 || (year % 400u == 0) ));
00227 }
00228
00229 /* A fairly complicated comparison:
00230  *
00231  * Compares a test date against a target date.
00232  * If the test date is earlier, return a negative number
00233  * If the test date is later, return a positive number
00234  * If the two dates are equal, return zero.
00235  *
00236  * The comparison is complicated by the way we specify
00237  * TargetDate.
00238  *
00239  * TargetDate is assumed to be the kind of date used in
00240  * TIME_ZONE_INFORMATION.DaylightDate: If wYear is 0,
00241  * then it's a kind of code for things like 1st Sunday
00242  * of the month. As described in the Windows API docs,
00243  * wDay is an index of week:
00244  *      1 = first of month
00245  *      2 = second of month
00246  *      3 = third of month
00247  *      4 = fourth of month
00248  *      5 = last of month (even if there are only four such days).
00249  *
00250  * Thus, if wYear = 0, wMonth = 4, wDay = 2, wDayOfWeek = 4
00251  * it specifies the second Thursday of April.
00252  *
00253  * INPUTS: SYSTEMTIME * p_test_date     The date to be tested
00254  *
00255  *         SYSTEMTIME * p_target_date   The target date. This should be in
00256  *                                      the format for a TIME_ZONE_INFORMATION
00257  *                                      DaylightDate or StandardDate.
00258  *
00259  * OUTPUT:  -4/+4 if test month is less/greater than target month
00260  *          -2/+2 if test day is less/greater than target day
00261  *          -1/+2 if test hour:minute:seconds.milliseconds less/greater than target
00262  *          0     if both dates/times are equal.
00263  *
00264  */
00265 static int CompareTargetDate (
00266     const SYSTEMTIME * p_test_date,
00267     const SYSTEMTIME * p_target_date
00268     )
00269 {
00270     WORD first_day_of_month; /* day of week of the first. Sunday = 0 */
00271     WORD end_of_month;       /* last day of month */
00272     WORD temp_date;
00273     int test_milliseconds, target_milliseconds;
00274
00275     /* Check that p_target_date is in the correct foramt: */
00276     if (p_target_date->wYear)
00277     {
00278         error(0,0,"Internal error: p_target_date is not in TIME_ZONE_INFORMATION format.");
00279         return 0;
00280     }
00281     if (!p_test_date->wYear)
00282     {
00283         error(0,0,"Internal error: p_test_date must be an actual date, not TIME_ZONE_INFORMAATION format.");
00284         return 0;
00285     }
00286
00287     /* Don't waste time calculating if we can shortcut the comparison... */
00288     if (p_test_date->wMonth != p_target_date->wMonth)
00289     {
00290         return (p_test_date->wMonth > p_target_date->wMonth) ? 4 : -4;
00291     }
00292
00293     /* Months equal. Now we neet to do some calculation.
00294      * If we know that y is the day of the week for some arbitrary date x,
00295      * then the day of the week of the first of the month is given by
00296      * (1 + y - x) mod 7.
00297      *
00298      * For instance, if the 19th is a Wednesday (day of week = 3), then
00299      * the date of the first Wednesday of the month is (19 mod 7) = 5.
00300      * If the 5th is a Wednesday (3), then the first of the month is
00301      * four days earlier (it's the first, not the zeroth):
00302      * (3 - 4) = -1; -1 mod 7 = 6. The first is a Saturday.
00303      *
00304      * Check ourselves: The 19th falls on a (6 + 19 - 1) mod 7
00305      * = 24 mod 7 = 3: Wednesday, as it should be.
00306      */
00307     first_day_of_month = (WORD)( (1u + p_test_date->wDayOfWeek - p_test_date->wDay) % 7u);
00308
00309     /* If the first of the month comes on day y, then the first day of week z falls on
00310      * (z - y + 1) mod 7.
00311      *
00312      * For instance, if the first is a Saturday (6), then the first Tuesday (2) falls on a
00313      * (2 - 6 + 1) mod 7 = -3 mod 7 = 4: The fourth. This is correct (see above).
00314      *
00315      * temp_date gets the first <target day of week> in the month.
00316      */
00317     temp_date = (WORD)( (1u + p_target_date->wDayOfWeek - first_day_of_month) % 7u);
00318     /* If we're looking for the third Tuesday in the month, find the date of the first
00319      * Tuesday and add (3 - 1) * 7. In the example, it's the 4 + 14 = 18th.
00320      *
00321      * temp_date now should hold the date for the wDay'th wDayOfWeek of the month.
00322      * we only need to handle the special case of the last <DayOfWeek> of the month.
00323      */
00324     temp_date = (WORD)( temp_date + 7 * p_target_date->wDay );
00325
00326     /* what's the last day of the month? */
00327     end_of_month = month_len [p_target_date->wMonth - 1];
00328     /* Correct if it's February of a leap year? */
00329     if ( p_test_date->wMonth == 2 && IsLeapYear(p_test_date->wYear) )
00330     {
00331         ++ end_of_month;
00332     }
00333
00334     /* if we tried to calculate the fifth Tuesday of the month
00335      * we may well have overshot. Correct for that case.
00336      */
00337     while ( temp_date > end_of_month)
00338         temp_date -= 7;
00339
00340     /* At long last, we're ready to do the comparison. */
00341     if ( p_test_date->wDay != temp_date )
00342     {
00343         return (p_test_date->wDay > temp_date) ? 2 : -2;
00344     }
00345     else
00346     {
00347         test_milliseconds = ((p_test_date->wHour * 60 + p_test_date->wMinute) * 60
00348                                 + p_test_date->wSecond) * 1000 + p_test_date->wMilliseconds;
00349         target_milliseconds = ((p_target_date->wHour * 60 + p_target_date->wMinute) * 60
00350                                 + p_target_date->wSecond) * 1000 + p_target_date->wMilliseconds;
00351         test_milliseconds -= target_milliseconds;
00352         return (test_milliseconds > 0) ? 1 : (test_milliseconds < 0) ? -1 : 0;
00353     }
00354
00355 }
00356
00357 //
00358 //  Get time zone bias for local time *pst.
00359 //
00360 //  UTC time = *pst + bias.
00361 //
00362 static int GetTimeZoneBias( const SYSTEMTIME * pst )
00363 {
00364     TIME_ZONE_INFORMATION tz;
00365     int n, bias;
00366
00367     GetTimeZoneInformation ( &tz );
00368
00369     /*  I only deal with cases where we look at
00370      *  a "last sunday" kind of thing.
00371      */
00372     if (tz.DaylightDate.wYear || tz.StandardDate.wYear)
00373     {
00374         error(0,0, "Cannont handle year-specific DST clues in TIME_ZONE_INFORMATION");
00375         return 0;
00376     }
00377
00378     bias = tz.Bias;
00379
00380     n = CompareTargetDate ( pst, & tz.DaylightDate );
00381     if (n < 0)
00382         bias += tz.StandardBias;
00383     else
00384     {
00385         n = CompareTargetDate ( pst, & tz.StandardDate );
00386         if (n < 0)
00387             bias += tz.DaylightBias;
00388         else
00389             bias += tz.StandardBias;
00390     }
00391     return bias;
00392 }
00393
00394 //
00395 //  Is the (local) time in DST?
00396 //
00397 static int IsDST( const SYSTEMTIME * pst )
00398 {
00399     TIME_ZONE_INFORMATION tz;
00400
00401     GetTimeZoneInformation ( &tz );
00402
00403     /*  I only deal with cases where we look at
00404      *  a "last sunday" kind of thing.
00405      */
00406     if (tz.DaylightDate.wYear || tz.StandardDate.wYear)
00407     {
00408         error(0,0, "Cannont handle year-specific DST clues in TIME_ZONE_INFORMATION");
00409         return 0;
00410     }
00411
00412     return (CompareTargetDate ( pst, & tz.DaylightDate ) >= 0)
00413             && (CompareTargetDate ( pst, & tz.StandardDate ) < 0);
00414 }
00415
00416 /* Convert a system time from local time to UTC time, correctly
00417  * taking DST into account (sort of).
00418  *
00419  * INPUTS:
00420  *      const SYSTEMTIME * p_local:
00421  *              A file time. It may be in UTC or in local
00422  *              time (see local_time, below, for details).
00423  *
00424  *      SYSTEMTIME * p_utc:
00425  *              The destination for the converted time.
00426  *
00427  * OUTPUTS:
00428  *      SYSTEMTIME * p_utc:
00429  *              The destination for the converted time.
00430  */
00431
00432 void LocalSystemTimeToUtcSystemTime( const SYSTEMTIME * p_local, SYSTEMTIME * p_utc)
00433 {
00434     TIME_ZONE_INFORMATION tz;
00435     FILETIME ft;
00436     ULARGE_INTEGER itime, delta;
00437     int bias;
00438
00439     * p_utc = * p_local;
00440
00441     GetTimeZoneInformation(&tz);
00442     bias = tz.Bias;
00443     if ( CompareTargetDate(p_local, & tz.DaylightDate) < 0
00444             || CompareTargetDate(p_local, & tz.StandardDate) >= 0)
00445         bias += tz.StandardBias;
00446     else
00447         bias += tz.DaylightBias;
00448
00449     SystemTimeToFileTime(p_local, & ft);
00450     itime.QuadPart = ((ULARGE_INTEGER *) &ft)->QuadPart;
00451     delta.QuadPart = systemtime_second;
00452     delta.QuadPart *= 60;   // minute
00453     delta.QuadPart *= bias;
00454     itime.QuadPart += delta.QuadPart;
00455     ((ULARGE_INTEGER *) & ft)->QuadPart = itime.QuadPart;
00456     FileTimeToSystemTime(& ft, p_utc);
00457 }
00458
00459
00460 /* Convert a file time to a Unix time_t structure. This function is as
00461  * complicated as it is because it needs to ask what time system the
00462  * filetime describes.
00463  *
00464  * INPUTS:
00465  *      const FILETIME * ft: A file time. It may be in UTC or in local
00466  *                           time (see local_time, below, for details).
00467  *
00468  *      time_t * ut:         The destination for the converted time.
00469  *
00470  *      BOOL local_time:     TRUE if the time in *ft is in local time
00471  *                           and I need to convert to a real UTC time.
00472  *
00473  * OUTPUTS:
00474  *      time_t * ut:         Store the result in *ut.
00475  */
00476 static BOOL FileTimeToUnixTime ( const FILETIME* pft, time_t* put, BOOL local_time )
00477 {
00478     BOOL success = FALSE;
00479
00480    /* FILETIME = number of 100-nanosecond ticks since midnight
00481     * 1 Jan 1601 UTC. time_t = number of 1-second ticks since
00482     * midnight 1 Jan 1970 UTC. To translate, we subtract a
00483     * FILETIME representation of midnight, 1 Jan 1970 from the
00484     * time in question and divide by the number of 100-ns ticks
00485     * in one second.
00486     */
00487
00488     SYSTEMTIME base_st =
00489     {
00490         1970,   /* wYear            */
00491         1,      /* wMonth           */
00492         0,      /* wDayOfWeek       */
00493         1,      /* wDay             */
00494         0,      /* wHour            */
00495         0,      /* wMinute          */
00496         0,      /* wSecond          */
00497         0       /* wMilliseconds    */
00498     };
00499
00500     ULARGE_INTEGER itime;
00501     FILETIME base_ft;
00502     int bias = 0;
00503
00504     if (local_time)
00505     {
00506         SYSTEMTIME temp_st;
00507         success = FileTimeToSystemTime(pft, & temp_st);
00508         bias =  GetTimeZoneBias(& temp_st);
00509     }
00510
00511     success = SystemTimeToFileTime ( &base_st, &base_ft );
00512     if (success)
00513     {
00514         itime.QuadPart = ((ULARGE_INTEGER *)pft)->QuadPart;
00515
00516         itime.QuadPart -= ((ULARGE_INTEGER *)&base_ft)->QuadPart;
00517         itime.QuadPart /= systemtime_second;    // itime is now in seconds.
00518         itime.QuadPart += bias * 60;    // bias is in minutes.
00519
00520         *put = itime.LowPart;
00521     }
00522
00523     if (!success)
00524     {
00525         *put = -1;   /* error value used by mktime() */
00526     }
00527     return success;
00528 }
00529
00530 static int _statcore(HANDLE hFile, const char *filename, struct stat *buf)
00531 {
00532     BY_HANDLE_FILE_INFORMATION bhfi;
00533     int isdev;
00534     char szFs[32];
00535     int is_gmt_fs = -1;
00536
00537     if(hFile)
00538     {
00539         /* Find out what kind of handle underlies filedes
00540         */
00541         isdev = GetFileType(hFile) & ~FILE_TYPE_REMOTE;
00542
00543         if ( isdev != FILE_TYPE_DISK )
00544         {
00545             /* not a disk file. probably a device or pipe
00546              */
00547             if ( (isdev == FILE_TYPE_CHAR) || (isdev == FILE_TYPE_PIPE) )
00548             {
00549                 /* treat pipes and devices similarly. no further info is
00550                  * available from any API, so set the fields as reasonably
00551                  * as possible and return.
00552                  */
00553                 if ( isdev == FILE_TYPE_CHAR )
00554                     buf->st_mode = _S_IFCHR;
00555                 else
00556                     buf->st_mode = _S_IFIFO;
00557
00558                 buf->st_rdev = buf->st_dev = (_dev_t)hFile;
00559                 buf->st_nlink = 1;
00560                 buf->st_uid = buf->st_gid = buf->st_ino = 0;
00561                 buf->st_atime = buf->st_mtime = buf->st_ctime = 0;
00562                 if ( isdev == FILE_TYPE_CHAR )
00563                     buf->st_size = 0;
00564                 else
00565                 {
00566                     unsigned long ulAvail;
00567                     int rc;
00568                     rc = PeekNamedPipe(hFile,NULL,0,NULL,&ulAvail,NULL);
00569                     if (rc)
00570                         buf->st_size = (_off_t)ulAvail;
00571                     else
00572                         buf->st_size = (_off_t)0;
00573                 }
00574
00575                 return 0;
00576             }
00577             else if ( isdev == FILE_TYPE_UNKNOWN )
00578             {
00579                 // Network device
00580                 errno = EBADF;
00581                 return -1;
00582             }
00583         }
00584     }
00585
00586     /* set the common fields
00587      */
00588     buf->st_ino = buf->st_uid = buf->st_gid = buf->st_mode = 0;
00589     buf->st_nlink = 1;
00590
00591     if(hFile)
00592     {
00593         /* use the file handle to get all the info about the file
00594          */
00595         if ( !GetFileInformationByHandle(hFile, &bhfi) )
00596         {
00597             _dosmaperr(GetLastError());
00598             return -1;
00599         }
00600     }
00601     else
00602     {
00603         WIN32_FIND_DATA fd;
00604         HANDLE hFind;
00605
00606         if(strlen(filename)==3 && !stricmp(filename+1,":\\"))
00607         {
00608             // Can't do anything about the root directory...
00609             // Win2k and Win98 can return info, but Win95 can't, so
00610             // it's best to do nothing.
00611             memset(&bhfi,0,sizeof(bhfi));
00612             bhfi.dwFileAttributes=GetFileAttributes(filename);
00613             if(bhfi.dwFileAttributes==0xFFFFFFFF)
00614             {
00615                 _dosmaperr(GetLastError());
00616                 return -1;
00617             }
00618             bhfi.nNumberOfLinks=1;
00619         }
00620         else
00621         {
00622             hFind=FindFirstFile(filename,&fd);
00623             if(hFind==INVALID_HANDLE_VALUE)
00624             {
00625                 _dosmaperr(GetLastError());
00626                 return -1;
00627             }
00628             FindClose(hFind);
00629             memset(&bhfi,0,sizeof(bhfi));
00630             bhfi.dwFileAttributes=fd.dwFileAttributes;
00631             bhfi.ftCreationTime=fd.ftCreationTime;
00632             bhfi.ftLastAccessTime=fd.ftLastAccessTime;
00633             bhfi.ftLastWriteTime=fd.ftLastWriteTime;
00634             bhfi.nFileSizeLow=fd.nFileSizeLow;
00635             bhfi.nFileSizeHigh=fd.nFileSizeHigh;
00636             bhfi.nNumberOfLinks=1;
00637         }
00638     }
00639
00640     if ( bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY )
00641         buf->st_mode |= (_S_IREAD + (_S_IREAD >> 3) + (_S_IREAD >> 6));
00642     else
00643         buf->st_mode |= ((_S_IREAD|_S_IWRITE) + ((_S_IREAD|_S_IWRITE) >> 3)
00644           + ((_S_IREAD|_S_IWRITE) >> 6));
00645     if (bhfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
00646         buf->st_mode |= (_S_IEXEC + (_S_IEXEC >> 3) + (_S_IEXEC >> 6));
00647
00648     // Potential, but unlikely problem... casting DWORD to short.
00649     // Reported by Jerzy Kaczorowski, addressed by Jonathan Gilligan
00650     // if the number of links is greater than 0x7FFF
00651     // there would be an overflow problem.
00652     // This is a problem inherent in the struct stat, and hence
00653     // in the design of the C library.
00654     if (bhfi.nNumberOfLinks > SHRT_MAX) {
00655 #pragma message(__FILE__ "(" PP_STRINGIZE(__LINE__) ") : TODO: should this be a fatal error?")
00656         error(0,0,"Internal error: too many links to a file.");
00657         buf->st_nlink = SHRT_MAX;
00658         }
00659     else {
00660         buf->st_nlink=(short)bhfi.nNumberOfLinks;
00661         }
00662
00663     if(!filename)
00664     {
00665         // We have to assume here that the repository doesn't span drives, so the
00666         // current directory is correct.
00667         *szFs='\0';
00668         GetVolumeInformation(NULL,NULL,0,NULL,NULL,NULL,szFs,32);
00669
00670         is_gmt_fs = GMT_FS(szFs);
00671     }
00672     else
00673     {
00674         if(filename[1]!=':')
00675         {
00676             if((filename[0]=='\\' || filename[0]=='/') && (filename[1]=='\\' || filename[1]=='/'))
00677             {
00678                 // UNC pathname, assumed to be on an NTFS server.  No way to
00679                 // check, actually (GVI doesn't return anything useful).
00680                 is_gmt_fs = 1;
00681             }
00682             else
00683             {
00684                 // Relative path, treat as local
00685                 GetVolumeInformation(NULL,NULL,0,NULL,NULL,NULL,szFs,sizeof(szFs));
00686                 is_gmt_fs = GMT_FS(szFs);
00687             }
00688         }
00689         else
00690         {
00691             // Drive specified...
00692             char szRootPath[4] = "?:\\";
00693             szRootPath[0]=filename[0];
00694             *szFs='\0';
00695             GetVolumeInformation(szRootPath,NULL,0,NULL,NULL,NULL,szFs,sizeof(szFs));
00696             is_gmt_fs = GMT_FS(szFs);
00697         }
00698     }
00699
00700     if(is_gmt_fs) // NTFS or similar - everything is in GMT already
00701     {
00702         FileTimeToUnixTime ( &bhfi.ftLastAccessTime, &buf->st_atime, FALSE );
00703         FileTimeToUnixTime ( &bhfi.ftLastWriteTime, &buf->st_mtime, FALSE );
00704         FileTimeToUnixTime ( &bhfi.ftCreationTime, &buf->st_ctime, FALSE );
00705     }
00706     else
00707     {
00708         // FAT - timestamps are in incorrectly translated local time.
00709         // translate them back and let FileTimeToUnixTime() do the
00710         // job properly.
00711
00712         FILETIME At,Wt,Ct;
00713
00714         FileTimeToLocalFileTime ( &bhfi.ftLastAccessTime, &At );
00715         FileTimeToLocalFileTime ( &bhfi.ftLastWriteTime, &Wt );
00716         FileTimeToLocalFileTime ( &bhfi.ftCreationTime, &Ct );
00717         FileTimeToUnixTime ( &At, &buf->st_atime, TRUE );
00718         FileTimeToUnixTime ( &Wt, &buf->st_mtime, TRUE );
00719         FileTimeToUnixTime ( &Ct, &buf->st_ctime, TRUE );
00720     }
00721
00722     buf->st_size = bhfi.nFileSizeLow;
00723     if(bhfi.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
00724         buf->st_mode |= _S_IFDIR;
00725     else
00726         buf->st_mode |= _S_IFREG;
00727
00728     /* On DOS, this field contains the drive number, but
00729      * the drive number is not available on this platform.
00730      * Also, for UNC network names, there is no drive number.
00731      */
00732     buf->st_rdev = buf->st_dev = 0;
00733     return 0;
00734 }
00735
00736 int wnt_stat(const char *name, struct stat *buf)
00737 {
00738     return _statcore(NULL,name,buf);
00739 }
00740
00741 int wnt_fstat (int fildes, struct stat *buf)
00742 {
00743     return _statcore((HANDLE)_get_osfhandle(fildes),NULL,buf);
00744 }
00745
00746 int wnt_lstat (const char *name, struct stat *buf)
00747 {
00748     return _statcore(NULL,name,buf);
00749 }
00750
00751 #undef asctime
00752 #undef ctime
00753 /* ANSI C compatibility for timestamps - VC pads with zeros, C standard pads with spaces */
00754
00755 char *wnt_asctime(const struct tm *tm)
00756 {
00757     char *buf = asctime(tm);
00758     if(buf[8]=='0') buf[8]=' ';
00759     return buf;
00760 }
00761
00762 char *wnt_ctime(const time_t *t)
00763 {
00764     char *buf = ctime(t);
00765     if(buf[8]=='0') buf[8]=' ';
00766     return buf;
00767 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/SCC/pubscc.h Source File

cvs-1.10/windows-NT/SCC/pubscc.h

Go to the documentation of this file.
00001 /* This file was written by Jim Kingdon, and is hereby placed
00002    in the public domain.  */
00003
00004 /* Bits of the SCC interface.
00005    For paranoia's sake, I'm not using the same names as Microsoft.
00006    I don't imagine copying a few names could be a credible copyright
00007    case, but it seems safer to stick to only what is necessary for
00008    the interface to work.
00009
00010    Note that some of the descriptions here have a certain amount of
00011    guesswork (for example, sometimes I have tried to translate to CVS
00012    terminology without actually verifying that the item means what I
00013    think it does).  If you find errors, please let us know according to
00014    the usual procedures for reporting CVS bugs.  */
00015 typedef long SCC_return;
00016 #define SCC_return_success 0
00017 #define SCC_return_unknown_project -2
00018 /* The file is not under SCC control.  */
00019 #define SCC_return_non_scc_file -11
00020 /* This operation is not supported.  I believe this status can only
00021    be returned from SccGet, SccAdd, SccRemove, SccHistory, or
00022    SccQueryInfo.  I'm not really sure what happens if it is returned
00023    from other calls.  */
00024 #define SCC_return_not_supported -14
00025 #define SCC_return_non_specific_error -15
00026
00027 enum SCC_command
00028 {
00029     SCC_command_get,
00030     SCC_command_checkout,
00031     SCC_command_checkin,
00032     SCC_command_uncheckout,
00033     SCC_command_add,
00034     SCC_command_remove,
00035     SCC_command_diff,
00036     SCC_command_history,
00037     SCC_command_rename,
00038     SCC_command_properties,
00039     SCC_command_options
00040 };
00041
00042 /* Outproc codes, for second argument to outproc.  */
00043 #define SCC_outproc_info 1L
00044 #define SCC_outproc_warning 2L
00045 #define SCC_outproc_error 3L
00046 /* Codes 4-7 relate to cancels and are only supported if the
00047    development environment said so with SccSetOption.  */
00048 /* A status message, typically goes in something analogous to the emacs
00049    minibuffer.  For both this and SCC_outproc_nostatus, the development
00050    environment returns SCC_outproc_return_cancelled if the user has
00051    hit the cancel button.  */
00052 #define SCC_outproc_status 4L
00053 /* Like SCC_outproc_status, but there is no message to report.  */
00054 #define SCC_outproc_nostatus 5L
00055 /* Tell the development environment to offer a cancel button.  */
00056 #define SCC_outproc_cancel_on 6L
00057 /* Tell the development environment to not offer a cancel button.  */
00058 #define SCC_outproc_cancel_off 7L
00059
00060 /* Return values from outproc.  */
00061 #define SCC_outproc_return_success 0L
00062 #define SCC_outproc_return_cancelled -1L
00063 typedef long (*SCC_outproc) (char *, long);
00064
00065 typedef BOOL (*SCC_popul_proc) (LPVOID callerdat, BOOL add_keep,
00066                                 LONG status, LPCSTR file);
00067
00068 /* Maximum sizes of various strings.  These are arbitrary limits
00069    which are imposed by the SCC.  */
00070 /* Name argument to SccInitialize.  */
00071 #define SCC_max_name 31
00072 /* Path argument to SccInitialize.  */
00073 #define SCC_max_init_path 31
00074 /* Various paths many places in the interface.  */
00075 #include <stdlib.h>
00076 #define SCC_max_path _MAX_PATH
00077
00078 /* Status codes, as used by QueryInfo and GetEvents.  */
00079 /* This means that we can't get status.  If the status is not
00080    SCC_status_error, then the status is a set of bit flags, as defined by
00081    the other SCC_status_* codes.  */
00082 #define SCC_status_error -1L
00083
00084 /* The following status codes are things which the development environment
00085    is encouraged to check to determine things like whether to allow
00086    a checkin.  */
00087 /* The current user has the file checked out (that is, under "cvs edit").
00088    It may or may not be in the directory where the development
00089    environment thinks it should be.  */
00090 #define SCC_status_out_me 0x1000L
00091 /* Should be set only if out_me is set.  The file is checked out where
00092    the development environment thinks it should be.  */
00093 #define SCC_status_out_here 2L
00094 /* Some other user has the file checked out.  */
00095 #define SCC_status_out_someoneelse 4L
00096 /* Reserved checkouts are in effect for the file.  */
00097 #define SCC_status_reserved 8L
00098 /* Reserved checkouts are not in effect for the file.  Multiple users
00099    can edit it.  Only one of SCC_status_reserved or SCC_status_nonreserved
00100    should be set.  I think maybe this flag should only be set if there
00101    actually is more than one copy currently checked out.  */
00102 #define SCC_status_nonreserved 0x10L
00103
00104 /* The following flags are intended for the development environment to
00105    display the status of a file.  We are allowed to support them or not
00106    as we choose.  */
00107 /* The file in the working directory is not the latest version in the
00108    repository.  Like when "cvs status" says "Needs Checkout".  */
00109 #define SCC_status_needs_update 0x20L
00110 /* The file is no longer in the project.  I think this is the case where
00111    cvs update prints "file xxx is no longer pertinent" (but I don't know,
00112    there are other statuses involved with removed files).  */
00113 #define SCC_status_not_pertinent 0x40L
00114 /* No checkins are permitted for this file.  No real CVS analogue, because
00115    this sort of thing would be done by commitinfo, &c.  */
00116 #define SCC_status_no_checkins 0x80L
00117 /* There was a merge, but the user hasn't yet dealt with it.  I think this
00118    probably should be used both if there were conflicts on the merge and
00119    if there were not (not sure, though).  */
00120 #define SCC_status_had_conflicts 0x100L
00121 /* This indicates something has happened to the file.  I suspect it mainly
00122    is intended for cases in which we detect that something happened to the
00123    file behind our backs.  I suppose CVS might use this for cases in which
00124    sanity checks on the CVSADM files fail, or in which the file has been
00125    made read/write without a "cvs edit", or that sort of thing.
00126
00127    Or maybe it should be set if the file has been edited in the
00128    normal fashion.  I'm not sure.  */
00129 #define SCC_status_munged 0x800L
00130 /* The file exists in several projects.  In CVS I would suppose the
00131    equivalent probably would be that several modules (using features
00132    like -d) are capable of checking out a given file in the repository
00133    in several locations.  CVS has no current ability to give a different
00134    status when that has happened, but it might be cool.  */
00135 #define SCC_status_several_projects 0x200L
00136 /* There is a sticky tag or date in effect.  */
00137 #define SCC_status_stuck 0x400L
00138
00139 /* Bits to set in the caps used by SccInitialize.  Most of these are
00140    relatively straightforward, for example SCC_cap_QueryInfo is set to
00141    indicate that the SccQueryInfo function is supported.  */
00142 /* CodeWright 5.00b and 5.00c seem to call SccQueryInfo regardless of whether
00143    this bit is set in caps.  */
00144 #define SCC_cap_QueryInfo 0x80L
00145 #define SCC_cap_GetProjPath 0x200L
00146 #define SCC_cap_AddFromScc 0x400L
00147 #define SCC_cap_want_outproc 0x8000L
00148
00149 /* These are command options.  Some of them are specific to a particular
00150    command, some of them are good for more than one command.  Because many
00151    values are reused for different commands, look at the listed commands
00152    to see what a particular value means for a particular command.  */
00153 /* Recurse into directories.  SccGet.  */
00154 #define SCC_cmdopt_recurse 2L
00155 /* This means to get all the files in a directory.  SccGet.  */
00156 #define SCC_cmdopt_dir 1L
00157 /* Without this flag, after a checkin, files are normally not checked
00158    out.  This flag disables that handling, and if it is set files will
00159    still be checked out after the checkin completes.  SccCheckin, SccAdd.  */
00160 #define SCC_cmdopt_no_unedit 0x1000L
00161 /* File is text.  SccAdd.  */
00162 #define SCC_cmdopt_text 1L
00163 /* File is binary.  SccAdd.  */
00164 #define SCC_cmdopt_binary 2L
00165 /* We are supposed to decide whether it is text or binary.  We can use the
00166    CVS wrappers stuff to decide based on the file name.  Obviously, this
00167    constant is just another way of saying that neither SCC_cmdopt_text nor
00168    SCC_cmdopt_binary are set.  SccAdd.  */
00169 #define SCC_cmdopt_auto 0L
00170 /* Maintain only a head revision for the file, no history.  SccAdd.  */
00171 #define SCC_cmdopt_only_one 4L
00172 /* In addition to removing the file from the repository, also delete it
00173    from the working directory.  My guess is that development environments
00174    would generally tend to pass this flag by default.  SccRemove.  */
00175 #define SCC_cmdopt_retain_local 1L
00176 /* Compare files in a case-insensitive fashion.  SccDiff.  */
00177 #define SCC_cmdopt_case_insensitive 2L
00178 /* Ignore whitespace in comparing files.  SccDiff.  */
00179 #define SCC_cmdopt_ignore_all_space 4L
00180 /* Instead of generating diffs, just say whether files are equal, based on
00181    the file contents.  SccDiff.  */
00182 #define SCC_cmdopt_compare_files 0x10L
00183 /* Instead of generating diffs, just say whether files are equal.  This may
00184    use a checksum if we want, or if not, it can be the same as
00185    SCC_cmdopt_compare_files.  */
00186 #define SCC_cmdopt_consult_checksum 0x20L
00187 /* Instead of generating diffs, just say whether files are equal.  This may
00188    use a timestamp if we want, or if not, it can be the same as either
00189    SCC_cmdopt_consult_checksum or SCC_cmdopt_compare_files.  */
00190 #define SCC_cmdopt_consult_timestamp 0x40L
00191
00192 /* Values for the flags argument to OpenProject.  */
00193 /* If this is set, and the development environment tries to open a project
00194    which doesn't exist, then create it.  */
00195 #define SCC_open_autocreate 1L
00196 /* If autocreate is not set, and the development environment tries to
00197    open a project which doesn't exist, and may_prompt is set, we are
00198    allowed to prompt the user to create a new project.  If may_prompt
00199    is not set, we should just return SCC_return_unknown_project and
00200    not open the project.  */
00201 #define SCC_open_may_prompt 2L
00202
00203 /* Constants for SccSetOption.  */
00204 #define SCC_option_background 1L
00205 /* If option is SCC_option_background, then val turns background
00206    processing on or off.  If it is off, we can, if we need to, queue
00207    up events or something which won't disturb the development
00208    environment.  */
00209 #  define SCC_option_background_yes 1L
00210 #  define SCC_option_background_no 0L
00211 #define SCC_option_cancel 3L
00212 /* If option is SCC_option_cancel, then val says whether the development
00213    environment supports the SCC_outproc_* codes related to having the
00214    development environment handle a cancel button.  If this is not set,
00215    we are allowed/encouraged to implement a cancel button ourselves.  */
00216 #  define SCC_option_cancel_on 1L
00217 #  define SCC_option_cancel_off 0L
00218 /* A SCC_option_* value of 10 has also been observed (I think from
00219    CodeWright 5.00).  I have no idea what it means; it isn't documented
00220    by the SCC API from Microsoft (version 0.99.0823).  */
00221
00222 /* The "void *context_arg" argument to most of the Scc* functions
00223    stores a pointer to a structure that the version control system
00224    gets to allocate, so it doesn't need any global variables.  */
00225
00226 /* In addition to context_arg, most of the Scc* functions take a
00227    "HWND window" argument.  This is so that we can put up dialogs.
00228    The window which is passed in is the IDE's window, which we
00229    should use as the parent of dialogs that we put up.  */
00230
00231 #include <windows.h>
00232
00233 /* Return the version of the SCC spec, major version in the high word,
00234    minor version in the low word.  Recommended value is 0x10001 for
00235    version 1.1 of the spec.  */
00236 extern LONG SccGetVersion (void);
00237
00238 /* Set up the version control system.  This should be called before any
00239    other SCC calls other than SccGetVersion.  */
00240 extern SCC_return SccInitialize
00241   (/* The version control system should allocate the context argument
00242       in SccInitialize and store a pointer to it in *contextp.  */
00243    void **contextp,
00244
00245    HWND window, LPSTR caller,
00246    /* Version control system should copy in the
00247       name of the version control system here,
00248       up to SCC_max_name bytes.  */
00249    LPSTR name,
00250
00251    /* Version control system should set *caps to indicate what it
00252       supports, using bits from SCC_cap_*.  */
00253    LPLONG caps,
00254
00255    /* Version control system should copy in a string here, that the
00256       development environment can put places like a makefile to
00257       distinguish this version control system from others.  Up to
00258       SCC_max_init_path bytes.  */
00259    LPSTR path,
00260
00261    /* Version control system should set these to the maximum size for
00262       checkout comments and comments.  I'm not sure whether existing
00263       development environments tend to allocate fixed size arrays
00264       based on the return length (I would recommend that a development
00265       environment not do so, but that is a different question).  */
00266    LPDWORD co_comment_len,
00267    LPDWORD comment_len);
00268
00269 /* The version control system should free any resources it has allocated,
00270    including the context structure itself.  */
00271 extern SCC_return SccUninitialize (void *context_arg);
00272
00273 extern SCC_return SccOpenProject
00274   (void *context_arg, HWND window, LPSTR user,
00275    LPSTR project, LPSTR local_proj,
00276    LPSTR aux_proj,
00277    LPSTR comment,
00278
00279    /* This is the function which the version control system can call
00280       to ask the development environment to display output, or
00281       (SCC_outproc)0 if the development environment doesn't support
00282       the outproc feature.  */
00283    SCC_outproc outproc,
00284
00285    /* One or more of the SCC_open_* settings.  */
00286    LONG flags);
00287
00288 extern SCC_return SccCloseProject (void *context_arg);
00289
00290 /* cvs get.  */
00291 extern SCC_return SccGet
00292   (void *context_arg, HWND window,
00293
00294    /* Files to get, where file_names is an array
00295       of num_files names.  */
00296    /* As with all file names passed to us by the SCC, these file names
00297       are absolute pathnames.  I think they will tend to be paths
00298       within the local directory specified by the local_proj argument
00299       to SccOpenProject, although I don't know whether there are any
00300       exceptions to that.  */
00301    LONG num_files,
00302    LPSTR *file_names,
00303
00304    /* Command options.  */
00305    LONG options,
00306
00307    void *prov_options);
00308
00309 /* cvs edit.  */
00310 extern SCC_return SccCheckout
00311   (void *context_arg, HWND window,
00312
00313    /* Files to operate on, where file_names is an array of num_files
00314       names.  */
00315    LONG num_files,
00316    LPSTR *file_names,
00317
00318    LPSTR comment,
00319
00320    /* Command options.  I'm not sure what command options, if any, are
00321       defined for SccCheckout.  */
00322    LONG options,
00323
00324    void *prov_options);
00325
00326 /* cvs ci.  */
00327 extern SCC_return SccCheckin
00328   (void *context_arg, HWND window,
00329
00330    /* Files to operate on, where file_names is an array of num_files
00331       names.  */
00332    LONG num_files,
00333    LPSTR *file_names,
00334
00335    LPSTR comment,
00336
00337    /* Command options.  */
00338    LONG options,
00339
00340    void *prov_options);
00341
00342 /* cvs unedit.  */
00343 extern SCC_return SccUncheckout
00344   (void *context_arg, HWND window,
00345
00346    /* Files to operate on, where file_names is an array of num_files
00347       names.  */
00348    LONG num_files,
00349    LPSTR *file_names,
00350
00351    /* Command options.  I'm not sure what command options, if any, are
00352       defined for SccUncheckout.  */
00353    LONG options,
00354
00355    void *prov_options);
00356
00357 /* cvs add + cvs ci, more or less, I think (but see also
00358    the "keep checked out" flag in options).  */
00359 extern SCC_return SccAdd
00360   (void *context_arg, HWND window,
00361
00362    /* Files to operate on, where file_names is an array of num_files
00363       names.  */
00364    LONG num_files,
00365    LPSTR *file_names,
00366
00367    LPSTR comment,
00368
00369    /* Array of num_files command options, one for each file.  */
00370    LONG *options,
00371
00372    void *prov_options);
00373
00374 /* cvs rm -f + cvs ci, I think.  Should barf if SCC_REMOVE_KEEP
00375    (or maybe just put the file there, as if the user had removed
00376    it and then done a "copy <saved-file> <filename>".  */
00377 extern SCC_return SccRemove
00378   (void *context_arg, HWND window,
00379
00380    /* Files to operate on, where file_names is an array of num_files
00381       names.  */
00382    LONG num_files,
00383    LPSTR *file_names,
00384
00385    LPSTR comment,
00386
00387    /* Command options.  */
00388    LONG options,
00389
00390    void *prov_options);
00391
00392 /* mv, cvs add, cvs rm, and cvs ci, I think.  */
00393 extern SCC_return SccRename
00394   (void *context_arg, HWND window, LPSTR old_name,
00395    LPSTR new_name);
00396
00397 /* If SCC_cmdopt_compare_files, SCC_cmdopt_consult_checksum, or
00398    SCC_cmdopt_consult_timestamp, then we are supposed to silently
00399    return a status, without providing any information directly to the
00400    user.  For no args or checksum (which we fall back to full compare)
00401    basically a call to No_Diff or ? in the client case.  For
00402    timestamp, just a Classify_File.  Now, if contents not set, then
00403    want to do a cvs diff, and preferably start up WinDiff or something
00404    (to be determined, for now perhaps could just return text via
00405    outproc).  */
00406 extern SCC_return SccDiff
00407   (void *context_arg, HWND window, LPSTR file_name,
00408
00409    /* Command options.  */
00410    LONG options,
00411
00412    void *prov_options);
00413
00414 /* cvs log, I presume.  If we want to get fancier we could bring
00415    up a screen more analogous to the tkCVS log window, let the user
00416    do "cvs update -r", etc.  */
00417 extern SCC_return SccHistory
00418   (void *context_arg, HWND window,
00419
00420    /* Files to operate on, where file_names is an array of num_files
00421       names.  */
00422    LONG num_files,
00423    LPSTR *file_names,
00424
00425    /* Command options.  I'm not sure what command options,
00426       if any, are defined for SccHistory.  */
00427    LONG options,
00428
00429    void *prov_options);
00430
00431 /* cvs status, presumably.  */
00432 extern SCC_return SccProperties
00433   (void *context_arg, HWND window, LPSTR file_name);
00434
00435 /* Not sure what this should do.  The most obvious thing is some
00436    kind of front-end to "cvs admin" but I'm not actually sure that
00437    is the most useful thing.  */
00438 extern SCC_return SccRunScc
00439   (void *context_arg, HWND window,
00440
00441    LONG num_files,
00442    LPSTR *file_names);
00443
00444 /* If the user invokes version-control-system-defined behavior
00445    (typically by clicking an Advanced button in a dialog, e.g. the Get
00446    dialog), and the user clicks on that button, then the development
00447    environment calls SccGetCommandOptions.  The version control system
00448    interacts with the user and then sets *PROV_OPTIONSP to whatever it
00449    wants.  The development environment doesn't do anything with it,
00450    but does pass it to the various commands as prov_options.  If it
00451    calls SccGetCommandOptions again, it will pass the same value (so
00452    user choices from the previous "Advanced" click can serve as
00453    defaults).
00454
00455    Note that "provider options" (prov_options) are unrelated to
00456    "command options" (SCC_cmdopt_*).  */
00457
00458 extern SCC_return SccGetCommandOptions
00459   (void *context_arg, HWND window,
00460    enum SCC_command command,
00461    void **prov_optionsp);
00462
00463 /* Not existing CVS functionality, I don't think.
00464    Need to be able to tell user about what files
00465    are out there without actually getting them.  */
00466 extern SCC_return SccPopulateList
00467   (void *context_arg, enum SCC_command command,
00468
00469    LONG num_files,
00470    LPSTR *file_names,
00471
00472    SCC_popul_proc populate,
00473    void *callerdat,
00474
00475    /* Command options.  I'm not sure what command options,
00476       if any, are defined for SccPopulateList.  */
00477    LONG options);
00478
00479 /* cvs status, sort of.  */
00480 extern SCC_return SccQueryInfo
00481   (void *context_arg,
00482
00483    LONG num_files, LPSTR *file_names,
00484
00485    /* This is an array of NUM_FILES entries.  In each one
00486       we store a SCC_status_* code.  */
00487    LPLONG status);
00488
00489 /* Like QueryInfo, but fast and for only a single file.  For example, the
00490    development environment might call this quite frequently to keep its
00491    screen display updated.  Supposed to only return cached status
00492    information, not go to disk or anything.  I assume that
00493    QueryInfo and probably the usual calls like Get would cause
00494    the version control system to cache the status in the first place.  */
00495 extern SCC_return SccGetEvents
00496   (void *context_arg, LPSTR file_name,
00497
00498    /* Here the version control system stores the SCC_status_* code.  */
00499    LPLONG status,
00500
00501    LPLONG events_remaining);
00502
00503 /* This is where the user gives us the CVSROOT.  */
00504 extern SCC_return SccGetProjPath
00505   (void *context_arg, HWND window, LPSTR user,
00506
00507    /* Version control system copies in the project name
00508       here, up to SCC_max_path bytes.  */
00509    LPSTR proj_name,
00510
00511    /* If allow_change, the version control system may copy
00512       into this field, up to SCC_max_path bytes.  */
00513    LPSTR local_proj,
00514
00515    /* Version control system copies into this field, up to
00516       SCC_max_path bytes.  */
00517    LPSTR aux_proj,
00518
00519    BOOL allow_change, BOOL *new);
00520
00521 /* Pretty much similar to SccPopulateList.  Not sure whether this also
00522    involves getting the files, or whether the development environment will
00523    typically call SccGet after this function.  */
00524 extern SCC_return SccAddFromScc
00525   (void *context_arg, HWND window,
00526
00527    /* Version control system sets *files to the number of files and
00528       *file_names to an array each element of which and contains the
00529       name of one of the files.  The names can be relative pathnames
00530       (e.g. "foo.c").  If files is NULL, that means something different;
00531       the version control system should free the memory that it allocated
00532       for file_names.  */
00533    LONG *files,
00534    char ***file_names);
00535
00536 /* This changes several aspects of how we interact with the IDE.  */
00537 extern SCC_return SccSetOption
00538   (void *context_arg,
00539    /* One of the SCC_option_* codes.  */
00540    LONG option,
00541    /* Meaning of this will depend on the value of option.  */
00542    LONG val);
00543
00544 /* New functions with CodeWright 5.00c: SccAddRef, SccRelease,
00545    SccDiffToRev, SccLabel, SccLock and SccMerge.  I don't have any
00546    details on them.  */
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/windows-NT/SCC/scc.c Source File

cvs-1.10/windows-NT/SCC/scc.c

Go to the documentation of this file.
00001 /* This file was written by Jim Kingdon, and is hereby placed
00002    in the public domain.  */
00003
00004 #include <Wtypes.h>
00005 #include <stdio.h>
00006 #include <direct.h> /* For chdir */
00007
00008 #include "pubscc.h"
00009
00010 /* We get to put whatever we want here, and the caller will pass it
00011    to us, so we don't need any global variables.  This is the
00012    "void *context_arg" argument to most of the Scc* functions.  */
00013 struct context {
00014     FILE *debuglog;
00015     /* Value of the CVSROOT we are currently working with (that is, the
00016        "open project" in SCC terminology), malloc'd, or NULL if there is
00017        no project currently open.  */
00018     char *root;
00019     /* Local directory (working directory in CVS parlance).  */
00020     char *local;
00021     SCC_outproc outproc;
00022 };
00023
00024 /* In addition to context_arg, most of the Scc* functions take a
00025    "HWND window" argument.  This is so that we can put up dialogs.
00026    The window which is passed in is the IDE's window, which we
00027    should use as the parent of dialogs that we put up.  */
00028
00029 #include <windows.h>
00030
00031 /* Report a malloc error and return the SCC_return_* value which the
00032    caller should return to the IDE.  Probably this should be getting
00033    the window argument too, but for the moment we don't need it.
00034    Note that we only use this for errors which occur after the
00035    context->outproc is set up.  */
00036 SCC_return
00037 malloc_error (struct context *context)
00038 {
00039     (*context->outproc) ("Out of memory\n", SCC_outproc_error);
00040     return SCC_return_non_specific_error;
00041 }
00042
00043 /* Return the version of the SCC spec, major version in the high word,
00044    minor version in the low word.  */
00045 LONG
00046 SccGetVersion (void)
00047 {
00048     /* We implement version 1.1 of the spec.  */
00049     return 0x10001;
00050 }
00051
00052 SCC_return
00053 SccInitialize (void **contextp, HWND window, LPSTR caller, LPSTR name,
00054                LPLONG caps, LPSTR path, LPDWORD co_comment_len,
00055                LPDWORD comment_len)
00056 {
00057     struct context *context;
00058     FILE *fp;
00059     fp = fopen ("d:\\debug.scc", "w");
00060     if (fp == NULL)
00061         /* Do what?  Return some error value?  */
00062         abort ();
00063     context = malloc (sizeof (struct context));
00064     if (context == NULL)
00065     {
00066         fprintf (fp, "Out of memory\n");
00067         fclose (fp);
00068         /* Do what?  Return some error?  */
00069         abort ();
00070     }
00071     context->debuglog = fp;
00072     context->root = NULL;
00073     *contextp = context;
00074     fprintf (fp, "Made it into SccInitialize!\n");
00075     *caps = (SCC_cap_GetProjPath
00076          | SCC_cap_AddFromScc
00077          | SCC_cap_want_outproc);
00078
00079     /* I think maybe this should have some more CVS-like
00080        name, like "CVS Root", if we decide that is what
00081        a SCC "project" is.  */
00082     strncpy (path, "CVS Project:", SCC_max_init_path);
00083     fprintf (fp, "Caller name is %s\n", caller);
00084     strncpy (name, "CVS", SCC_max_name);
00085     /* CVS has no limit on comment length.  But I suppose
00086        we need to return a value which is small enough for
00087        a caller to allocate a buffer this big.  Not that I
00088        would write a caller that way, but.....  */
00089     *co_comment_len = 8192;
00090     *comment_len = 8192;
00091     fflush (fp);
00092     return SCC_return_success;
00093 }
00094
00095 SCC_return
00096 SccUninitialize (void *context_arg)
00097 {
00098     struct context *context = (struct context *)context_arg;
00099     if (ferror (context->debuglog))
00100     /* FIXME: return error value...  */
00101     if (fclose (context->debuglog) == EOF)
00102         /* FIXME: return error value, I think.  */
00103         ;
00104     free (context);
00105     return SCC_return_success;
00106 }
00107
00108 SCC_return
00109 SccOpenProject (void *context_arg, HWND window, LPSTR user,
00110         LPSTR project, LPSTR local_proj, LPSTR aux_proj,
00111         LPSTR comment, SCC_outproc outproc,
00112         LONG flags)
00113 {
00114     struct context *context = (struct context *)context_arg;
00115
00116     /* This can happen if the IDE opens a project which is not under
00117        CVS control.  I'm not sure whether checking for aux_proj
00118        being "" is the right way to detect this case, but it seems
00119        it should work because I think that the source code control
00120        system is what has control over the contents of aux_proj.  */
00121     if (aux_proj[0] == '\0')
00122     return SCC_return_unknown_project;
00123
00124     context->root = malloc (strlen (aux_proj) + 5);
00125     if (context->root == NULL)
00126     return SCC_return_non_specific_error;
00127     strcpy (context->root, aux_proj);
00128     /* Since we don't yet support creating projects, we don't
00129        do anything with flags.  */
00130
00131     if (outproc == 0)
00132     {
00133     /* This supposedly can happen if the IDE chooses not to implement
00134        the outproc feature.  */
00135     fprintf (context->debuglog, "Uh oh.  outproc is a null pointer\n");
00136     context->root = NULL;
00137     fflush (context->debuglog);
00138     return SCC_return_non_specific_error;
00139     }
00140     context->outproc = outproc;
00141
00142     fprintf (context->debuglog, "SccOpenProject (aux_proj=%s)\n", aux_proj);
00143
00144     context->local = malloc (strlen (local_proj) + 5);
00145     if (context->local == NULL)
00146     return malloc_error (context);
00147     strcpy (context->local, local_proj);
00148
00149     fflush (context->debuglog);
00150     return SCC_return_success;
00151 }
00152
00153 SCC_return
00154 SccCloseProject (void *context_arg)
00155 {
00156     struct context *context = (struct context *)context_arg;
00157     fprintf (context->debuglog, "SccCloseProject\n");
00158     fflush (context->debuglog);
00159     if (context->root != NULL)
00160     free (context->root);
00161     context->root = NULL;
00162     return SCC_return_success;
00163 }
00164
00165 /* cvs get.  */
00166 SCC_return
00167 SccGet (void *context_arg, HWND window, LONG num_files,
00168         LPSTR *file_names,
00169     LONG options,
00170     void *prov_options)
00171 {
00172     struct context *context = (struct context *)context_arg;
00173     int i;
00174     char *fname;
00175
00176     fprintf (context->debuglog, "SccGet: %d; files:", num_files);
00177 #if 1
00178     for (i = 0; i < num_files; ++i)
00179     {
00180     fprintf (context->debuglog, "%s ", file_names[i]);
00181     }
00182 #endif
00183     fprintf (context->debuglog, "\n");
00184     if (options & SCC_cmdopt_dir)
00185     fprintf (context->debuglog, "  Get all\n");
00186     /* Should be using this flag to set -R vs. -l.  */
00187     if (options & SCC_cmdopt_recurse)
00188     fprintf (context->debuglog, "  recurse\n");
00189
00190     for (i = 0; i < num_files; ++i)
00191     {
00192     /* As with all file names passed to us by the SCC, these
00193        file names are absolute pathnames.  I think they will
00194        tend to be paths within context->local, although I
00195        don't know whether there are any exceptions to that.  */
00196     fname = file_names[i];
00197     fprintf (context->debuglog, "%s ", fname);
00198     /* Here we would write to the file named fname.  */
00199     }
00200     fprintf (context->debuglog, "\nExiting SccGet\n");
00201     fflush (context->debuglog);
00202     return SCC_return_success;
00203 }
00204
00205 /* cvs edit.  */
00206 SCC_return
00207 SccCheckout (void *context_arg, HWND window, LONG num_files,
00208              LPSTR *file_names, LPSTR comment,
00209          LONG options,
00210              void *prov_options)
00211 {
00212     struct context *context = (struct context *)context_arg;
00213     fprintf (context->debuglog, "SccCheckout num_files=%ld\n", num_files);
00214     fflush (context->debuglog);
00215     /* For the moment we say that all files are not ours.  I'm not sure
00216        whether this is ever necessary; that is, whether the IDE will call
00217        us except where we have told the IDE that a file is under source
00218        control.  */
00219     /* I'm not sure what we would do if num_files > 1 and we wanted to
00220        return different statuses for different files.  */
00221     return SCC_return_non_scc_file;
00222 }
00223
00224 /* cvs ci.  */
00225 SCC_return
00226 SccCheckin (void *context_arg, HWND window, LONG num_files,
00227             LPSTR *file_names, LPSTR comment,
00228         LONG options,
00229             void *prov_options)
00230 {
00231     return SCC_return_not_supported;
00232 }
00233
00234 /* cvs unedit.  */
00235 SCC_return
00236 SccUncheckout (void *context_arg, HWND window, LONG num_files,
00237                LPSTR *file_names,
00238            LONG options,
00239            void *prov_options)
00240 {
00241     return SCC_return_not_supported;
00242 }
00243
00244 /* cvs add + cvs ci, more or less, I think (but see also
00245    the "keep checked out" flag in options).  */
00246 SCC_return
00247 SccAdd (void *context_arg, HWND window, LONG num_files,
00248         LPSTR *file_names, LPSTR comment,
00249     LONG *options,
00250         void *prov_options)
00251 {
00252     return SCC_return_not_supported;
00253 }
00254
00255 /* cvs rm -f + cvs ci, I think.  Should barf if SCC_REMOVE_KEEP
00256    (or maybe just put the file there, as if the user had removed
00257    it and then done a "copy <saved-file> <filename>".  */
00258 SCC_return
00259 SccRemove (void *context_arg, HWND window, LONG num_files,
00260            LPSTR *file_names, LPSTR comment,
00261        LONG options,
00262            void *prov_options)
00263 {
00264     return SCC_return_not_supported;
00265 }
00266
00267 /* mv, cvs add, cvs rm, and cvs ci, I think.  */
00268 SCC_return
00269 SccRename (void *context_arg, HWND window, LPSTR old_name,
00270            LPSTR new_name)
00271 {
00272     return SCC_return_not_supported;
00273 }
00274
00275 /* If SCC_cmdopt_compare_files, SCC_cmdopt_consult_checksum, or
00276    SCC_cmdopt_consult_timestamp, then we are supposed to silently
00277    return a status, without providing any information directly to the
00278    user.  For no args or checksum (which we fall back to full compare)
00279    basically a call to No_Diff or ? in the client case.  For
00280    timestamp, just a Classify_File.  Now, if contents not set, then
00281    want to do a cvs diff, and preferably start up WinDiff or something
00282    (to be determined, for now perhaps could just return text via
00283    outproc).  */
00284 SCC_return
00285 SccDiff (void *context_arg, HWND window, LPSTR file_name,
00286          LONG options,
00287      void *prov_options)
00288 {
00289     return SCC_return_not_supported;
00290 }
00291
00292 /* cvs log, I presume.  If we want to get fancier we could bring
00293    up a screen more analogous to the tkCVS log window, let the user
00294    do "cvs update -r", etc.  */
00295 SCC_return
00296 SccHistory (void *context_arg, HWND window, LONG num_files,
00297             LPSTR *file_names,
00298         LONG options,
00299         void *prov_options)
00300 {
00301     return SCC_return_not_supported;
00302 }
00303
00304 /* cvs status, presumably.  */
00305 SCC_return
00306 SccProperties (void *context_arg, HWND window, LPSTR file_name)
00307 {
00308     return SCC_return_not_supported;
00309 }
00310
00311 /* Not sure what this should do.  The most obvious thing is some
00312    kind of front-end to "cvs admin" but I'm not actually sure that
00313    is the most useful thing.  */
00314 SCC_return
00315 SccRunScc (void *context_arg, HWND window, LONG num_files,
00316            LPSTR *file_names)
00317 {
00318     return SCC_return_not_supported;
00319 }
00320
00321 /* Lots of things that we could do here.  Options to get/update
00322    such as -r -D -k etc. just for starters.  Note that the terminology is
00323    a little confusing here.  This function relates to "provider options"
00324    (prov_options) which are a way for us to provide extra dialogs beyond
00325    the basic ones for a particular command.  It is unrelated to "command
00326    options" (SCC_cmdopt_*).  */
00327 SCC_return
00328 SccGetCommandOptions (void *context_arg, HWND window,
00329                       enum SCC_command command,
00330                       void **prov_optionsp)
00331 {
00332     return SCC_return_not_supported;
00333 }
00334
00335 /* Not existing CVS functionality, I don't think.
00336    Need to be able to tell user about what files
00337    are out there without actually getting them.  */
00338 SCC_return
00339 SccPopulateList (void *context_arg, enum SCC_command command,
00340                  LONG num_files,
00341                  LPSTR *file_names, SCC_popul_proc populate,
00342                  void *callerdat,
00343          LONG options)
00344 {
00345     return SCC_return_success;
00346 }
00347
00348 /* cvs status, sort of.  */
00349 SCC_return
00350 SccQueryInfo (void *context_arg, LONG num_files, LPSTR *file_names,
00351               LPLONG status)
00352 {
00353     return SCC_return_not_supported;
00354 }
00355
00356 /* Like QueryInfo, but fast and for only a single file.  For example, the
00357    development environment might call this quite frequently to keep its
00358    screen display updated.  */
00359 SCC_return
00360 SccGetEvents (void *context_arg, LPSTR file_name,
00361           LPLONG status,
00362               LPLONG events_remaining)
00363 {
00364     /* They say this is supposed to only return cached status
00365        information, not go to disk or anything.  I assume that
00366        QueryInfo and probably the usual calls like Get would cause
00367        us to cache the status in the first place.  */
00368     return SCC_return_success;
00369 }
00370
00371 /* This is where the user gives us the CVSROOT.  */
00372 SCC_return
00373 SccGetProjPath (void *context_arg, HWND window, LPSTR user,
00374                 LPSTR proj_name, LPSTR local_proj, LPSTR aux_proj,
00375                 BOOL allow_change, BOOL *new)
00376 {
00377     /* For now we just hardcode the CVSROOT.  In the future we will
00378        of course prompt the user for it (simple implementation would
00379        have them supply a string; potentially better implementation
00380        would have menus or something for access methods and so on,
00381        although it might also have a way of bypassing that in case
00382        CVS supports new features that the GUI code doesn't
00383        understand).  We probably will also at some point want a
00384        "project" to encompass both a CVSROOT and a directory or
00385        module name within that CVSROOT, but we don't try to handle
00386        that yet either.  We also will want to be able to use "user"
00387        instead of having the username encoded in the aux_proj or
00388        proj_name, probably.  */
00389
00390     struct context *context = (struct context *)context_arg;
00391     fprintf (context->debuglog, "SccGetProjPath called\n");
00392
00393     /* At least for now we leave the proj_name alone, and just use
00394        the aux_proj.  */
00395     strncpy (proj_name, "zwork", SCC_max_path);
00396     strncpy (aux_proj, ":server:harvey:/home/kingdon/zwork/cvsroot",
00397          SCC_max_path);
00398     if (local_proj[0] == '\0' && allow_change)
00399     strncpy (local_proj, "d:\\sccwork", SCC_max_path);
00400     /* I don't think I saw anything in the spec about this,
00401        but let's see if it helps.  */
00402     if (_chdir (local_proj) < 0)
00403     fprintf (context->debuglog, "Error in chdir: %s", strerror (errno));
00404
00405     if (*new)
00406     /* It is OK for us to prompt the user for creating a new
00407        project.  */
00408     /* We will say that the user said to create a new one.  */
00409     *new = 1;
00410
00411     fflush (context->debuglog);
00412     return SCC_return_success;
00413 }
00414
00415 /* Pretty much similar to SccPopulateList.  */
00416 SCC_return
00417 SccAddFromScc (void *context_arg, HWND window, LONG *files,
00418                char ***file_names)
00419 {
00420     struct context *context = (struct context *)context_arg;
00421
00422     /* For now we have hardcoded the notion that there are two files,
00423        foo.c and bar.c.  */
00424 #define NUM_FILES 2
00425     if (files == NULL)
00426     {
00427     char **p;
00428
00429     /* This means to free the memory that is allocated for
00430        file_names.  */
00431     for (p = *file_names; *p != NULL; ++p)
00432     {
00433         fprintf (context->debuglog, "Freeing %s\n", *p);
00434         free (*p);
00435     }
00436     }
00437     else
00438     {
00439     *file_names = malloc ((NUM_FILES + 1) * sizeof (char **));
00440     if (*file_names == NULL)
00441         return malloc_error (context);
00442     (*file_names)[0] = malloc (80);
00443     if ((*file_names)[0] == NULL)
00444         return malloc_error (context);
00445     strcpy ((*file_names)[0], "foo.c");
00446     (*file_names)[1] = malloc (80);
00447     if ((*file_names)[1] == NULL)
00448         return malloc_error (context);
00449     strcpy ((*file_names)[1], "bar.c");
00450     (*file_names)[2] = NULL;
00451     *files = 2;
00452
00453     /* Are we supposed to also Get the files?  Or is the IDE
00454        next going to call SccGet on each one?  The spec doesn't
00455        say explicitly.  */
00456     }
00457     fprintf (context->debuglog, "Success in SccAddFromScc\n");
00458     fflush (context->debuglog);
00459     return SCC_return_success;
00460 }
00461
00462 /* This changes several aspects of how we interact with the IDE.  */
00463 SCC_return
00464 SccSetOption (void *context_arg,
00465           LONG option,
00466           LONG val)
00467 {
00468     return SCC_return_success;
00469 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/adler32.c Source File

cvs-1.10/zlib/adler32.c

Go to the documentation of this file.
00001 /* adler32.c -- compute the Adler-32 checksum of a data stream
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* $Id: adler32.c,v 1.10 1996/05/22 11:52:18 me Exp $ */
00007
00008 #include "zlib.h"
00009
00010 #define BASE 65521L /* largest prime smaller than 65536 */
00011 #define NMAX 5552
00012 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
00013
00014 #define DO1(buf,i)  {s1 += buf[i]; s2 += s1;}
00015 #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
00016 #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
00017 #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
00018 #define DO16(buf)   DO8(buf,0); DO8(buf,8);
00019
00020 /* ========================================================================= */
00021 uLong adler32(adler, buf, len)
00022     uLong adler;
00023     const Bytef *buf;
00024     uInt len;
00025 {
00026     unsigned long s1 = adler & 0xffff;
00027     unsigned long s2 = (adler >> 16) & 0xffff;
00028     int k;
00029
00030     if (buf == Z_NULL) return 1L;
00031
00032     while (len > 0) {
00033         k = len < NMAX ? len : NMAX;
00034         len -= k;
00035         while (k >= 16) {
00036             DO16(buf);
00037         buf += 16;
00038             k -= 16;
00039         }
00040         if (k != 0) do {
00041             s1 += *buf++;
00042         s2 += s1;
00043         } while (--k);
00044         s1 %= BASE;
00045         s2 %= BASE;
00046     }
00047     return (s2 << 16) | s1;
00048 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/compress.c Source File

cvs-1.10/zlib/compress.c

Go to the documentation of this file.
00001 /* compress.c -- compress a memory buffer
00002  * Copyright (C) 1995-1996 Jean-loup Gailly.
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* $Id: compress.c,v 1.10 1996/05/23 16:51:12 me Exp $ */
00007
00008 #include "zlib.h"
00009
00010 /* ===========================================================================
00011      Compresses the source buffer into the destination buffer.  sourceLen is
00012    the byte length of the source buffer. Upon entry, destLen is the total
00013    size of the destination buffer, which must be at least 0.1% larger than
00014    sourceLen plus 8 bytes. Upon exit, destLen is the actual size of the
00015    compressed buffer.
00016      This function can be used to compress a whole file at once if the
00017    input file is mmap'ed.
00018      compress returns Z_OK if success, Z_MEM_ERROR if there was not
00019    enough memory, Z_BUF_ERROR if there was not enough room in the output
00020    buffer.
00021 */
00022 int compress (dest, destLen, source, sourceLen)
00023     Bytef *dest;
00024     uLongf *destLen;
00025     const Bytef *source;
00026     uLong sourceLen;
00027 {
00028     z_stream stream;
00029     int err;
00030
00031     stream.next_in = (Bytef*)source;
00032     stream.avail_in = (uInt)sourceLen;
00033 #ifdef MAXSEG_64K
00034     /* Check for source > 64K on 16-bit machine: */
00035     if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
00036 #endif
00037     stream.next_out = dest;
00038     stream.avail_out = (uInt)*destLen;
00039     if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
00040
00041     stream.zalloc = (alloc_func)0;
00042     stream.zfree = (free_func)0;
00043     stream.opaque = (voidpf)0;
00044
00045     err = deflateInit(&stream, Z_DEFAULT_COMPRESSION);
00046     if (err != Z_OK) return err;
00047
00048     err = deflate(&stream, Z_FINISH);
00049     if (err != Z_STREAM_END) {
00050         deflateEnd(&stream);
00051         return err == Z_OK ? Z_BUF_ERROR : err;
00052     }
00053     *destLen = stream.total_out;
00054
00055     err = deflateEnd(&stream);
00056     return err;
00057 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/crc32.c Source File

cvs-1.10/zlib/crc32.c

Go to the documentation of this file.
00001 /* crc32.c -- compute the CRC-32 of a data stream
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* $Id: crc32.c,v 1.8 1996/01/30 21:59:10 me Exp $ */
00007
00008 #include "zlib.h"
00009
00010 #define local static
00011
00012 #ifdef DYNAMIC_CRC_TABLE
00013
00014 local int crc_table_empty = 1;
00015 local uLongf crc_table[256];
00016 local void make_crc_table OF((void));
00017
00018 /*
00019   Generate a table for a byte-wise 32-bit CRC calculation on the polynomial:
00020   x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
00021
00022   Polynomials over GF(2) are represented in binary, one bit per coefficient,
00023   with the lowest powers in the most significant bit.  Then adding polynomials
00024   is just exclusive-or, and multiplying a polynomial by x is a right shift by
00025   one.  If we call the above polynomial p, and represent a byte as the
00026   polynomial q, also with the lowest power in the most significant bit (so the
00027   byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
00028   where a mod b means the remainder after dividing a by b.
00029
00030   This calculation is done using the shift-register method of multiplying and
00031   taking the remainder.  The register is initialized to zero, and for each
00032   incoming bit, x^32 is added mod p to the register if the bit is a one (where
00033   x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
00034   x (which is shifting right by one and adding x^32 mod p if the bit shifted
00035   out is a one).  We start with the highest power (least significant bit) of
00036   q and repeat for all eight bits of q.
00037
00038   The table is simply the CRC of all possible eight bit values.  This is all
00039   the information needed to generate CRC's on data a byte at a time for all
00040   combinations of CRC register values and incoming bytes.
00041 */
00042 local void make_crc_table()
00043 {
00044   uLong c;
00045   int n, k;
00046   uLong poly;            /* polynomial exclusive-or pattern */
00047   /* terms of polynomial defining this crc (except x^32): */
00048   static Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
00049
00050   /* make exclusive-or pattern from polynomial (0xedb88320L) */
00051   poly = 0L;
00052   for (n = 0; n < sizeof(p)/sizeof(Byte); n++)
00053     poly |= 1L << (31 - p[n]);
00054
00055   for (n = 0; n < 256; n++)
00056   {
00057     c = (uLong)n;
00058     for (k = 0; k < 8; k++)
00059       c = c & 1 ? poly ^ (c >> 1) : c >> 1;
00060     crc_table[n] = c;
00061   }
00062   crc_table_empty = 0;
00063 }
00064 #else
00065 /* ========================================================================
00066  * Table of CRC-32's of all single-byte values (made by make_crc_table)
00067  */
00068 local uLongf crc_table[256] = {
00069   0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
00070   0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
00071   0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
00072   0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
00073   0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
00074   0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
00075   0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
00076   0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
00077   0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
00078   0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
00079   0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
00080   0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
00081   0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
00082   0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
00083   0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
00084   0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
00085   0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
00086   0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
00087   0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
00088   0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
00089   0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
00090   0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
00091   0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
00092   0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
00093   0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
00094   0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
00095   0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
00096   0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
00097   0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
00098   0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
00099   0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
00100   0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
00101   0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
00102   0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
00103   0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
00104   0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
00105   0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
00106   0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
00107   0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
00108   0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
00109   0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
00110   0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
00111   0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
00112   0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
00113   0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
00114   0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
00115   0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
00116   0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
00117   0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
00118   0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
00119   0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
00120   0x2d02ef8dL
00121 };
00122 #endif
00123
00124 /* =========================================================================
00125  * This function can be used by asm versions of crc32()
00126  */
00127 uLongf *get_crc_table()
00128 {
00129 #ifdef DYNAMIC_CRC_TABLE
00130   if (crc_table_empty) make_crc_table();
00131 #endif
00132   return (uLongf *)crc_table;
00133 }
00134
00135 /* ========================================================================= */
00136 #define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
00137 #define DO2(buf)  DO1(buf); DO1(buf);
00138 #define DO4(buf)  DO2(buf); DO2(buf);
00139 #define DO8(buf)  DO4(buf); DO4(buf);
00140
00141 /* ========================================================================= */
00142 uLong crc32(crc, buf, len)
00143     uLong crc;
00144     const Bytef *buf;
00145     uInt len;
00146 {
00147     if (buf == Z_NULL) return 0L;
00148 #ifdef DYNAMIC_CRC_TABLE
00149     if (crc_table_empty)
00150       make_crc_table();
00151 #endif
00152     crc = crc ^ 0xffffffffL;
00153     while (len >= 8)
00154     {
00155       DO8(buf);
00156       len -= 8;
00157     }
00158     if (len) do {
00159       DO1(buf);
00160     } while (--len);
00161     return crc ^ 0xffffffffL;
00162 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/deflate.c Source File

cvs-1.10/zlib/deflate.c

Go to the documentation of this file.
00001 /* deflate.c -- compress data using the deflation algorithm
00002  * Copyright (C) 1995-1996 Jean-loup Gailly.
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /*
00007  *  ALGORITHM
00008  *
00009  *      The "deflation" process depends on being able to identify portions
00010  *      of the input text which are identical to earlier input (within a
00011  *      sliding window trailing behind the input currently being processed).
00012  *
00013  *      The most straightforward technique turns out to be the fastest for
00014  *      most input files: try all possible matches and select the longest.
00015  *      The key feature of this algorithm is that insertions into the string
00016  *      dictionary are very simple and thus fast, and deletions are avoided
00017  *      completely. Insertions are performed at each input character, whereas
00018  *      string matches are performed only when the previous match ends. So it
00019  *      is preferable to spend more time in matches to allow very fast string
00020  *      insertions and avoid deletions. The matching algorithm for small
00021  *      strings is inspired from that of Rabin & Karp. A brute force approach
00022  *      is used to find longer strings when a small match has been found.
00023  *      A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
00024  *      (by Leonid Broukhis).
00025  *         A previous version of this file used a more sophisticated algorithm
00026  *      (by Fiala and Greene) which is guaranteed to run in linear amortized
00027  *      time, but has a larger average cost, uses more memory and is patented.
00028  *      However the F&G algorithm may be faster for some highly redundant
00029  *      files if the parameter max_chain_length (described below) is too large.
00030  *
00031  *  ACKNOWLEDGEMENTS
00032  *
00033  *      The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
00034  *      I found it in 'freeze' written by Leonid Broukhis.
00035  *      Thanks to many people for bug reports and testing.
00036  *
00037  *  REFERENCES
00038  *
00039  *      Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
00040  *      Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
00041  *
00042  *      A description of the Rabin and Karp algorithm is given in the book
00043  *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
00044  *
00045  *      Fiala,E.R., and Greene,D.H.
00046  *         Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
00047  *
00048  */
00049
00050 /* $Id: deflate.c,v 1.15 1996/07/24 13:40:58 me Exp $ */
00051
00052 #include "deflate.h"
00053
00054 char deflate_copyright[] = " deflate 1.0.4 Copyright 1995-1996 Jean-loup Gailly ";
00055 /*
00056   If you use the zlib library in a product, an acknowledgment is welcome
00057   in the documentation of your product. If for some reason you cannot
00058   include such an acknowledgment, I would appreciate that you keep this
00059   copyright string in the executable of your product.
00060  */
00061
00062 /* ===========================================================================
00063  *  Function prototypes.
00064  */
00065 typedef enum {
00066     need_more,      /* block not completed, need more input or more output */
00067     block_done,     /* block flush performed */
00068     finish_started, /* finish started, need only more output at next deflate */
00069     finish_done     /* finish done, accept no more input or output */
00070 } block_state;
00071
00072 typedef block_state (*compress_func) OF((deflate_state *s, int flush));
00073 /* Compression function. Returns the block state after the call. */
00074
00075 local void fill_window    OF((deflate_state *s));
00076 local block_state deflate_stored OF((deflate_state *s, int flush));
00077 local block_state deflate_fast   OF((deflate_state *s, int flush));
00078 local block_state deflate_slow   OF((deflate_state *s, int flush));
00079 local void lm_init        OF((deflate_state *s));
00080 local uInt longest_match  OF((deflate_state *s, IPos cur_match));
00081 local void putShortMSB    OF((deflate_state *s, uInt b));
00082 local void flush_pending  OF((z_streamp strm));
00083 local int read_buf        OF((z_streamp strm, charf *buf, unsigned size));
00084 #ifdef ASMV
00085       void match_init OF((void)); /* asm code initialization */
00086 #endif
00087
00088 #ifdef DEBUG
00089 local  void check_match OF((deflate_state *s, IPos start, IPos match,
00090                             int length));
00091 #endif
00092
00093 /* ===========================================================================
00094  * Local data
00095  */
00096
00097 #define NIL 0
00098 /* Tail of hash chains */
00099
00100 #ifndef TOO_FAR
00101 #  define TOO_FAR 4096
00102 #endif
00103 /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
00104
00105 #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
00106 /* Minimum amount of lookahead, except at the end of the input file.
00107  * See deflate.c for comments about the MIN_MATCH+1.
00108  */
00109
00110 /* Values for max_lazy_match, good_match and max_chain_length, depending on
00111  * the desired pack level (0..9). The values given below have been tuned to
00112  * exclude worst case performance for pathological files. Better values may be
00113  * found for specific files.
00114  */
00115 typedef struct config_s {
00116    ush good_length; /* reduce lazy search above this match length */
00117    ush max_lazy;    /* do not perform lazy search above this match length */
00118    ush nice_length; /* quit search above this match length */
00119    ush max_chain;
00120    compress_func func;
00121 } config;
00122
00123 local config configuration_table[10] = {
00124 /*      good lazy nice chain */
00125 /* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
00126 /* 1 */ {4,    4,  8,    4, deflate_fast}, /* maximum speed, no lazy matches */
00127 /* 2 */ {4,    5, 16,    8, deflate_fast},
00128 /* 3 */ {4,    6, 32,   32, deflate_fast},
00129
00130 /* 4 */ {4,    4, 16,   16, deflate_slow},  /* lazy matches */
00131 /* 5 */ {8,   16, 32,   32, deflate_slow},
00132 /* 6 */ {8,   16, 128, 128, deflate_slow},
00133 /* 7 */ {8,   32, 128, 256, deflate_slow},
00134 /* 8 */ {32, 128, 258, 1024, deflate_slow},
00135 /* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */
00136
00137 /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
00138  * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
00139  * meaning.
00140  */
00141
00142 #define EQUAL 0
00143 /* result of memcmp for equal strings */
00144
00145 struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
00146
00147 /* ===========================================================================
00148  * Update a hash value with the given input byte
00149  * IN  assertion: all calls to to UPDATE_HASH are made with consecutive
00150  *    input characters, so that a running hash key can be computed from the
00151  *    previous key instead of complete recalculation each time.
00152  */
00153 #define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
00154
00155
00156 /* ===========================================================================
00157  * Insert string str in the dictionary and set match_head to the previous head
00158  * of the hash chain (the most recent string with same hash key). Return
00159  * the previous length of the hash chain.
00160  * IN  assertion: all calls to to INSERT_STRING are made with consecutive
00161  *    input characters and the first MIN_MATCH bytes of str are valid
00162  *    (except for the last MIN_MATCH-1 bytes of the input file).
00163  */
00164 #define INSERT_STRING(s, str, match_head) \
00165    (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
00166     s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \
00167     s->head[s->ins_h] = (Pos)(str))
00168
00169 /* ===========================================================================
00170  * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
00171  * prev[] will be initialized on the fly.
00172  */
00173 #define CLEAR_HASH(s) \
00174     s->head[s->hash_size-1] = NIL; \
00175     zmemzero((charf *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
00176
00177 /* ========================================================================= */
00178 int deflateInit_(strm, level, version, stream_size)
00179     z_streamp strm;
00180     int level;
00181     const char *version;
00182     int stream_size;
00183 {
00184     return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
00185              Z_DEFAULT_STRATEGY, version, stream_size);
00186     /* To do: ignore strm->next_in if we use it as window */
00187 }
00188
00189 /* ========================================================================= */
00190 int deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
00191           version, stream_size)
00192     z_streamp strm;
00193     int  level;
00194     int  method;
00195     int  windowBits;
00196     int  memLevel;
00197     int  strategy;
00198     const char *version;
00199     int stream_size;
00200 {
00201     deflate_state *s;
00202     int noheader = 0;
00203
00204     ushf *overlay;
00205     /* We overlay pending_buf and d_buf+l_buf. This works since the average
00206      * output size for (length,distance) codes is <= 24 bits.
00207      */
00208
00209     if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
00210         stream_size != sizeof(z_stream)) {
00211     return Z_VERSION_ERROR;
00212     }
00213     if (strm == Z_NULL) return Z_STREAM_ERROR;
00214
00215     strm->msg = Z_NULL;
00216     if (strm->zalloc == Z_NULL) {
00217     strm->zalloc = zcalloc;
00218     strm->opaque = (voidpf)0;
00219     }
00220     if (strm->zfree == Z_NULL) strm->zfree = zcfree;
00221
00222     if (level == Z_DEFAULT_COMPRESSION) level = 6;
00223
00224     if (windowBits < 0) { /* undocumented feature: suppress zlib header */
00225         noheader = 1;
00226         windowBits = -windowBits;
00227     }
00228     if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
00229         windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
00230     strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
00231         return Z_STREAM_ERROR;
00232     }
00233     s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
00234     if (s == Z_NULL) return Z_MEM_ERROR;
00235     strm->state = (struct internal_state FAR *)s;
00236     s->strm = strm;
00237
00238     s->noheader = noheader;
00239     s->w_bits = windowBits;
00240     s->w_size = 1 << s->w_bits;
00241     s->w_mask = s->w_size - 1;
00242
00243     s->hash_bits = memLevel + 7;
00244     s->hash_size = 1 << s->hash_bits;
00245     s->hash_mask = s->hash_size - 1;
00246     s->hash_shift =  ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
00247
00248     s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
00249     s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));
00250     s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));
00251
00252     s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
00253
00254     overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
00255     s->pending_buf = (uchf *) overlay;
00256
00257     if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
00258         s->pending_buf == Z_NULL) {
00259         strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
00260         deflateEnd (strm);
00261         return Z_MEM_ERROR;
00262     }
00263     s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
00264     s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
00265
00266     s->level = level;
00267     s->strategy = strategy;
00268     s->method = (Byte)method;
00269
00270     return deflateReset(strm);
00271 }
00272
00273 /* ========================================================================= */
00274 int deflateSetDictionary (strm, dictionary, dictLength)
00275     z_streamp strm;
00276     const Bytef *dictionary;
00277     uInt  dictLength;
00278 {
00279     deflate_state *s;
00280     uInt length = dictLength;
00281     uInt n;
00282     IPos hash_head = 0;
00283
00284     if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
00285         strm->state->status != INIT_STATE) return Z_STREAM_ERROR;
00286
00287     s = strm->state;
00288     strm->adler = adler32(strm->adler, dictionary, dictLength);
00289
00290     if (length < MIN_MATCH) return Z_OK;
00291     if (length > MAX_DIST(s)) {
00292     length = MAX_DIST(s);
00293     dictionary += dictLength - length;
00294     }
00295     zmemcpy((charf *)s->window, dictionary, length);
00296     s->strstart = length;
00297     s->block_start = (long)length;
00298
00299     /* Insert all strings in the hash table (except for the last two bytes).
00300      * s->lookahead stays null, so s->ins_h will be recomputed at the next
00301      * call of fill_window.
00302      */
00303     s->ins_h = s->window[0];
00304     UPDATE_HASH(s, s->ins_h, s->window[1]);
00305     for (n = 0; n <= length - MIN_MATCH; n++) {
00306     INSERT_STRING(s, n, hash_head);
00307     }
00308     if (hash_head) hash_head = 0;  /* to make compiler happy */
00309     return Z_OK;
00310 }
00311
00312 /* ========================================================================= */
00313 int deflateReset (strm)
00314     z_streamp strm;
00315 {
00316     deflate_state *s;
00317
00318     if (strm == Z_NULL || strm->state == Z_NULL ||
00319         strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR;
00320
00321     strm->total_in = strm->total_out = 0;
00322     strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
00323     strm->data_type = Z_UNKNOWN;
00324
00325     s = (deflate_state *)strm->state;
00326     s->pending = 0;
00327     s->pending_out = s->pending_buf;
00328
00329     if (s->noheader < 0) {
00330         s->noheader = 0; /* was set to -1 by deflate(..., Z_FINISH); */
00331     }
00332     s->status = s->noheader ? BUSY_STATE : INIT_STATE;
00333     strm->adler = 1;
00334     s->last_flush = Z_NO_FLUSH;
00335
00336     _tr_init(s);
00337     lm_init(s);
00338
00339     return Z_OK;
00340 }
00341
00342 /* ========================================================================= */
00343 int deflateParams(strm, level, strategy)
00344     z_streamp strm;
00345     int level;
00346     int strategy;
00347 {
00348     deflate_state *s;
00349     compress_func func;
00350     int err = Z_OK;
00351
00352     if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
00353     s = strm->state;
00354
00355     if (level == Z_DEFAULT_COMPRESSION) {
00356     level = 6;
00357     }
00358     if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
00359     return Z_STREAM_ERROR;
00360     }
00361     func = configuration_table[s->level].func;
00362
00363     if (func != configuration_table[level].func && strm->total_in != 0) {
00364     /* Flush the last buffer: */
00365     err = deflate(strm, Z_PARTIAL_FLUSH);
00366     }
00367     if (s->level != level) {
00368     s->level = level;
00369     s->max_lazy_match   = configuration_table[level].max_lazy;
00370     s->good_match       = configuration_table[level].good_length;
00371     s->nice_match       = configuration_table[level].nice_length;
00372     s->max_chain_length = configuration_table[level].max_chain;
00373     }
00374     s->strategy = strategy;
00375     return err;
00376 }
00377
00378 /* =========================================================================
00379  * Put a short in the pending buffer. The 16-bit value is put in MSB order.
00380  * IN assertion: the stream state is correct and there is enough room in
00381  * pending_buf.
00382  */
00383 local void putShortMSB (s, b)
00384     deflate_state *s;
00385     uInt b;
00386 {
00387     put_byte(s, (Byte)(b >> 8));
00388     put_byte(s, (Byte)(b & 0xff));
00389 }
00390
00391 /* =========================================================================
00392  * Flush as much pending output as possible. All deflate() output goes
00393  * through this function so some applications may wish to modify it
00394  * to avoid allocating a large strm->next_out buffer and copying into it.
00395  * (See also read_buf()).
00396  */
00397 local void flush_pending(strm)
00398     z_streamp strm;
00399 {
00400     unsigned len = strm->state->pending;
00401
00402     if (len > strm->avail_out) len = strm->avail_out;
00403     if (len == 0) return;
00404
00405     zmemcpy(strm->next_out, strm->state->pending_out, len);
00406     strm->next_out  += len;
00407     strm->state->pending_out  += len;
00408     strm->total_out += len;
00409     strm->avail_out  -= len;
00410     strm->state->pending -= len;
00411     if (strm->state->pending == 0) {
00412         strm->state->pending_out = strm->state->pending_buf;
00413     }
00414 }
00415
00416 /* ========================================================================= */
00417 int deflate (strm, flush)
00418     z_streamp strm;
00419     int flush;
00420 {
00421     int old_flush; /* value of flush param for previous deflate call */
00422     deflate_state *s;
00423
00424     if (strm == Z_NULL || strm->state == Z_NULL ||
00425     flush > Z_FINISH || flush < 0) {
00426         return Z_STREAM_ERROR;
00427     }
00428     s = strm->state;
00429
00430     if (strm->next_out == Z_NULL ||
00431         (strm->next_in == Z_NULL && strm->avail_in != 0) ||
00432     (s->status == FINISH_STATE && flush != Z_FINISH)) {
00433         ERR_RETURN(strm, Z_STREAM_ERROR);
00434     }
00435     if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
00436
00437     s->strm = strm; /* just in case */
00438     old_flush = s->last_flush;
00439     s->last_flush = flush;
00440
00441     /* Write the zlib header */
00442     if (s->status == INIT_STATE) {
00443
00444         uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
00445         uInt level_flags = (s->level-1) >> 1;
00446
00447         if (level_flags > 3) level_flags = 3;
00448         header |= (level_flags << 6);
00449     if (s->strstart != 0) header |= PRESET_DICT;
00450         header += 31 - (header % 31);
00451
00452         s->status = BUSY_STATE;
00453         putShortMSB(s, header);
00454
00455     /* Save the adler32 of the preset dictionary: */
00456     if (s->strstart != 0) {
00457         putShortMSB(s, (uInt)(strm->adler >> 16));
00458         putShortMSB(s, (uInt)(strm->adler & 0xffff));
00459     }
00460     strm->adler = 1L;
00461     }
00462
00463     /* Flush as much pending output as possible */
00464     if (s->pending != 0) {
00465         flush_pending(strm);
00466         if (strm->avail_out == 0) {
00467         /* Since avail_out is 0, deflate will be called again with
00468          * more output space, but possibly with both pending and
00469          * avail_in equal to zero. There won't be anything to do,
00470          * but this is not an error situation so make sure we
00471          * return OK instead of BUF_ERROR at next call of deflate:
00472              */
00473         s->last_flush = -1;
00474         return Z_OK;
00475     }
00476
00477     /* Make sure there is something to do and avoid duplicate consecutive
00478      * flushes. For repeated and useless calls with Z_FINISH, we keep
00479      * returning Z_STREAM_END instead of Z_BUFF_ERROR.
00480      */
00481     } else if (strm->avail_in == 0 && flush <= old_flush &&
00482            flush != Z_FINISH) {
00483         ERR_RETURN(strm, Z_BUF_ERROR);
00484     }
00485
00486     /* User must not provide more input after the first FINISH: */
00487     if (s->status == FINISH_STATE && strm->avail_in != 0) {
00488         ERR_RETURN(strm, Z_BUF_ERROR);
00489     }
00490
00491     /* Start a new block or continue the current one.
00492      */
00493     if (strm->avail_in != 0 || s->lookahead != 0 ||
00494         (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
00495         block_state bstate;
00496
00497     bstate = (*(configuration_table[s->level].func))(s, flush);
00498
00499         if (bstate == finish_started || bstate == finish_done) {
00500             s->status = FINISH_STATE;
00501         }
00502         if (bstate == need_more || bstate == finish_started) {
00503         if (strm->avail_out == 0) {
00504             s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
00505         }
00506         return Z_OK;
00507         /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
00508          * of deflate should use the same flush parameter to make sure
00509          * that the flush is complete. So we don't have to output an
00510          * empty block here, this will be done at next call. This also
00511          * ensures that for a very small output buffer, we emit at most
00512          * one empty block.
00513          */
00514     }
00515         if (bstate == block_done) {
00516             if (flush == Z_PARTIAL_FLUSH) {
00517                 _tr_align(s);
00518             } else { /* FULL_FLUSH or SYNC_FLUSH */
00519                 _tr_stored_block(s, (char*)0, 0L, 0);
00520                 /* For a full flush, this empty block will be recognized
00521                  * as a special marker by inflate_sync().
00522                  */
00523                 if (flush == Z_FULL_FLUSH) {
00524                     CLEAR_HASH(s);             /* forget history */
00525                 }
00526             }
00527             flush_pending(strm);
00528         if (strm->avail_out == 0) {
00529           s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
00530           return Z_OK;
00531         }
00532         }
00533     }
00534     Assert(strm->avail_out > 0, "bug2");
00535
00536     if (flush != Z_FINISH) return Z_OK;
00537     if (s->noheader) return Z_STREAM_END;
00538
00539     /* Write the zlib trailer (adler32) */
00540     putShortMSB(s, (uInt)(strm->adler >> 16));
00541     putShortMSB(s, (uInt)(strm->adler & 0xffff));
00542     flush_pending(strm);
00543     /* If avail_out is zero, the application will call deflate again
00544      * to flush the rest.
00545      */
00546     s->noheader = -1; /* write the trailer only once! */
00547     return s->pending != 0 ? Z_OK : Z_STREAM_END;
00548 }
00549
00550 /* ========================================================================= */
00551 int deflateEnd (strm)
00552     z_streamp strm;
00553 {
00554     int status;
00555
00556     if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
00557
00558     /* Deallocate in reverse order of allocations: */
00559     TRY_FREE(strm, strm->state->pending_buf);
00560     TRY_FREE(strm, strm->state->head);
00561     TRY_FREE(strm, strm->state->prev);
00562     TRY_FREE(strm, strm->state->window);
00563
00564     status = strm->state->status;
00565     ZFREE(strm, strm->state);
00566     strm->state = Z_NULL;
00567
00568     return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
00569 }
00570
00571 /* ========================================================================= */
00572 int deflateCopy (dest, source)
00573     z_streamp dest;
00574     z_streamp source;
00575 {
00576     if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
00577         return Z_STREAM_ERROR;
00578     }
00579     *dest = *source;
00580     return Z_STREAM_ERROR; /* to be implemented */
00581 #if 0
00582     dest->state = (struct internal_state FAR *)
00583         (*dest->zalloc)(1, sizeof(deflate_state));
00584     if (dest->state == Z_NULL) return Z_MEM_ERROR;
00585
00586     *(dest->state) = *(source->state);
00587     return Z_OK;
00588 #endif
00589 }
00590
00591 /* ===========================================================================
00592  * Read a new buffer from the current input stream, update the adler32
00593  * and total number of bytes read.  All deflate() input goes through
00594  * this function so some applications may wish to modify it to avoid
00595  * allocating a large strm->next_in buffer and copying from it.
00596  * (See also flush_pending()).
00597  */
00598 local int read_buf(strm, buf, size)
00599     z_streamp strm;
00600     charf *buf;
00601     unsigned size;
00602 {
00603     unsigned len = strm->avail_in;
00604
00605     if (len > size) len = size;
00606     if (len == 0) return 0;
00607
00608     strm->avail_in  -= len;
00609
00610     if (!strm->state->noheader) {
00611         strm->adler = adler32(strm->adler, strm->next_in, len);
00612     }
00613     zmemcpy(buf, strm->next_in, len);
00614     strm->next_in  += len;
00615     strm->total_in += len;
00616
00617     return (int)len;
00618 }
00619
00620 /* ===========================================================================
00621  * Initialize the "longest match" routines for a new zlib stream
00622  */
00623 local void lm_init (s)
00624     deflate_state *s;
00625 {
00626     s->window_size = (ulg)2L*s->w_size;
00627
00628     CLEAR_HASH(s);
00629
00630     /* Set the default configuration parameters:
00631      */
00632     s->max_lazy_match   = configuration_table[s->level].max_lazy;
00633     s->good_match       = configuration_table[s->level].good_length;
00634     s->nice_match       = configuration_table[s->level].nice_length;
00635     s->max_chain_length = configuration_table[s->level].max_chain;
00636
00637     s->strstart = 0;
00638     s->block_start = 0L;
00639     s->lookahead = 0;
00640     s->match_length = s->prev_length = MIN_MATCH-1;
00641     s->match_available = 0;
00642     s->ins_h = 0;
00643 #ifdef ASMV
00644     match_init(); /* initialize the asm code */
00645 #endif
00646 }
00647
00648 /* ===========================================================================
00649  * Set match_start to the longest match starting at the given string and
00650  * return its length. Matches shorter or equal to prev_length are discarded,
00651  * in which case the result is equal to prev_length and match_start is
00652  * garbage.
00653  * IN assertions: cur_match is the head of the hash chain for the current
00654  *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
00655  * OUT assertion: the match length is not greater than s->lookahead.
00656  */
00657 #ifndef ASMV
00658 /* For 80x86 and 680x0, an optimized version will be provided in match.asm or
00659  * match.S. The code will be functionally equivalent.
00660  */
00661 local uInt longest_match(s, cur_match)
00662     deflate_state *s;
00663     IPos cur_match;                             /* current match */
00664 {
00665     unsigned chain_length = s->max_chain_length;/* max hash chain length */
00666     register Bytef *scan = s->window + s->strstart; /* current string */
00667     register Bytef *match;                       /* matched string */
00668     register int len;                           /* length of current match */
00669     int best_len = s->prev_length;              /* best match length so far */
00670     int nice_match = s->nice_match;             /* stop if match long enough */
00671     IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
00672         s->strstart - (IPos)MAX_DIST(s) : NIL;
00673     /* Stop when cur_match becomes <= limit. To simplify the code,
00674      * we prevent matches with the string of window index 0.
00675      */
00676     Posf *prev = s->prev;
00677     uInt wmask = s->w_mask;
00678
00679 #ifdef UNALIGNED_OK
00680     /* Compare two bytes at a time. Note: this is not always beneficial.
00681      * Try with and without -DUNALIGNED_OK to check.
00682      */
00683     register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
00684     register ush scan_start = *(ushf*)scan;
00685     register ush scan_end   = *(ushf*)(scan+best_len-1);
00686 #else
00687     register Bytef *strend = s->window + s->strstart + MAX_MATCH;
00688     register Byte scan_end1  = scan[best_len-1];
00689     register Byte scan_end   = scan[best_len];
00690 #endif
00691
00692     /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
00693      * It is easy to get rid of this optimization if necessary.
00694      */
00695     Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
00696
00697     /* Do not waste too much time if we already have a good match: */
00698     if (s->prev_length >= s->good_match) {
00699         chain_length >>= 2;
00700     }
00701     /* Do not look for matches beyond the end of the input. This is necessary
00702      * to make deflate deterministic.
00703      */
00704     if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
00705
00706     Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
00707
00708     do {
00709         Assert(cur_match < s->strstart, "no future");
00710         match = s->window + cur_match;
00711
00712         /* Skip to next match if the match length cannot increase
00713          * or if the match length is less than 2:
00714          */
00715 #if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
00716         /* This code assumes sizeof(unsigned short) == 2. Do not use
00717          * UNALIGNED_OK if your compiler uses a different size.
00718          */
00719         if (*(ushf*)(match+best_len-1) != scan_end ||
00720             *(ushf*)match != scan_start) continue;
00721
00722         /* It is not necessary to compare scan[2] and match[2] since they are
00723          * always equal when the other bytes match, given that the hash keys
00724          * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
00725          * strstart+3, +5, ... up to strstart+257. We check for insufficient
00726          * lookahead only every 4th comparison; the 128th check will be made
00727          * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
00728          * necessary to put more guard bytes at the end of the window, or
00729          * to check more often for insufficient lookahead.
00730          */
00731         Assert(scan[2] == match[2], "scan[2]?");
00732         scan++, match++;
00733         do {
00734         } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
00735                  *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
00736                  *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
00737                  *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
00738                  scan < strend);
00739         /* The funny "do {}" generates better code on most compilers */
00740
00741         /* Here, scan <= window+strstart+257 */
00742         Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
00743         if (*scan == *match) scan++;
00744
00745         len = (MAX_MATCH - 1) - (int)(strend-scan);
00746         scan = strend - (MAX_MATCH-1);
00747
00748 #else /* UNALIGNED_OK */
00749
00750         if (match[best_len]   != scan_end  ||
00751             match[best_len-1] != scan_end1 ||
00752             *match            != *scan     ||
00753             *++match          != scan[1])      continue;
00754
00755         /* The check at best_len-1 can be removed because it will be made
00756          * again later. (This heuristic is not always a win.)
00757          * It is not necessary to compare scan[2] and match[2] since they
00758          * are always equal when the other bytes match, given that
00759          * the hash keys are equal and that HASH_BITS >= 8.
00760          */
00761         scan += 2, match++;
00762         Assert(*scan == *match, "match[2]?");
00763
00764         /* We check for insufficient lookahead only every 8th comparison;
00765          * the 256th check will be made at strstart+258.
00766          */
00767         do {
00768         } while (*++scan == *++match && *++scan == *++match &&
00769                  *++scan == *++match && *++scan == *++match &&
00770                  *++scan == *++match && *++scan == *++match &&
00771                  *++scan == *++match && *++scan == *++match &&
00772                  scan < strend);
00773
00774         Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
00775
00776         len = MAX_MATCH - (int)(strend - scan);
00777         scan = strend - MAX_MATCH;
00778
00779 #endif /* UNALIGNED_OK */
00780
00781         if (len > best_len) {
00782             s->match_start = cur_match;
00783             best_len = len;
00784             if (len >= nice_match) break;
00785 #ifdef UNALIGNED_OK
00786             scan_end = *(ushf*)(scan+best_len-1);
00787 #else
00788             scan_end1  = scan[best_len-1];
00789             scan_end   = scan[best_len];
00790 #endif
00791         }
00792     } while ((cur_match = prev[cur_match & wmask]) > limit
00793              && --chain_length != 0);
00794
00795     if ((uInt)best_len <= s->lookahead) return best_len;
00796     return s->lookahead;
00797 }
00798 #endif /* ASMV */
00799
00800 #ifdef DEBUG
00801 /* ===========================================================================
00802  * Check that the match at match_start is indeed a match.
00803  */
00804 local void check_match(s, start, match, length)
00805     deflate_state *s;
00806     IPos start, match;
00807     int length;
00808 {
00809     /* check that the match is indeed a match */
00810     if (zmemcmp((charf *)s->window + match,
00811                 (charf *)s->window + start, length) != EQUAL) {
00812         fprintf(stderr, " start %u, match %u, length %d\n",
00813         start, match, length);
00814         do {
00815         fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
00816     } while (--length != 0);
00817         z_error("invalid match");
00818     }
00819     if (verbose > 1) {
00820         fprintf(stderr,"\\[%d,%d]", start-match, length);
00821         do { putc(s->window[start++], stderr); } while (--length != 0);
00822     }
00823 }
00824 #else
00825 #  define check_match(s, start, match, length)
00826 #endif
00827
00828 /* ===========================================================================
00829  * Fill the window when the lookahead becomes insufficient.
00830  * Updates strstart and lookahead.
00831  *
00832  * IN assertion: lookahead < MIN_LOOKAHEAD
00833  * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
00834  *    At least one byte has been read, or avail_in == 0; reads are
00835  *    performed for at least two bytes (required for the zip translate_eol
00836  *    option -- not supported here).
00837  */
00838 local void fill_window(s)
00839     deflate_state *s;
00840 {
00841     register unsigned n, m;
00842     register Posf *p;
00843     unsigned more;    /* Amount of free space at the end of the window. */
00844     uInt wsize = s->w_size;
00845
00846     do {
00847         more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
00848
00849         /* Deal with !@#$% 64K limit: */
00850         if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
00851             more = wsize;
00852
00853         } else if (more == (unsigned)(-1)) {
00854             /* Very unlikely, but possible on 16 bit machine if strstart == 0
00855              * and lookahead == 1 (input done one byte at time)
00856              */
00857             more--;
00858
00859         /* If the window is almost full and there is insufficient lookahead,
00860          * move the upper half to the lower one to make room in the upper half.
00861          */
00862         } else if (s->strstart >= wsize+MAX_DIST(s)) {
00863
00864             zmemcpy((charf *)s->window, (charf *)s->window+wsize,
00865                    (unsigned)wsize);
00866             s->match_start -= wsize;
00867             s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
00868
00869             s->block_start -= (long) wsize;
00870
00871             /* Slide the hash table (could be avoided with 32 bit values
00872                at the expense of memory usage):
00873              */
00874             n = s->hash_size;
00875             p = &s->head[n];
00876             do {
00877                 m = *--p;
00878                 *p = (Pos)(m >= wsize ? m-wsize : NIL);
00879             } while (--n);
00880
00881             n = wsize;
00882             p = &s->prev[n];
00883             do {
00884                 m = *--p;
00885                 *p = (Pos)(m >= wsize ? m-wsize : NIL);
00886                 /* If n is not on any hash chain, prev[n] is garbage but
00887                  * its value will never be used.
00888                  */
00889             } while (--n);
00890
00891             more += wsize;
00892         }
00893         if (s->strm->avail_in == 0) return;
00894
00895         /* If there was no sliding:
00896          *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
00897          *    more == window_size - lookahead - strstart
00898          * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
00899          * => more >= window_size - 2*WSIZE + 2
00900          * In the BIG_MEM or MMAP case (not yet supported),
00901          *   window_size == input_size + MIN_LOOKAHEAD  &&
00902          *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
00903          * Otherwise, window_size == 2*WSIZE so more >= 2.
00904          * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
00905          */
00906         Assert(more >= 2, "more < 2");
00907
00908         n = read_buf(s->strm, (charf *)s->window + s->strstart + s->lookahead,
00909                      more);
00910         s->lookahead += n;
00911
00912         /* Initialize the hash value now that we have some input: */
00913         if (s->lookahead >= MIN_MATCH) {
00914             s->ins_h = s->window[s->strstart];
00915             UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
00916 #if MIN_MATCH != 3
00917             Call UPDATE_HASH() MIN_MATCH-3 more times
00918 #endif
00919         }
00920         /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
00921          * but this is not important since only literal bytes will be emitted.
00922          */
00923
00924     } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
00925 }
00926
00927 /* ===========================================================================
00928  * Flush the current block, with given end-of-file flag.
00929  * IN assertion: strstart is set to the end of the current match.
00930  */
00931 #define FLUSH_BLOCK_ONLY(s, eof) { \
00932    _tr_flush_block(s, (s->block_start >= 0L ? \
00933                    (charf *)&s->window[(unsigned)s->block_start] : \
00934                    (charf *)Z_NULL), \
00935         (ulg)((long)s->strstart - s->block_start), \
00936         (eof)); \
00937    s->block_start = s->strstart; \
00938    flush_pending(s->strm); \
00939    Tracev((stderr,"[FLUSH]")); \
00940 }
00941
00942 /* Same but force premature exit if necessary. */
00943 #define FLUSH_BLOCK(s, eof) { \
00944    FLUSH_BLOCK_ONLY(s, eof); \
00945    if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
00946 }
00947
00948 /* ===========================================================================
00949  * Copy without compression as much as possible from the input stream, return
00950  * the current block state.
00951  * This function does not insert new strings in the dictionary since
00952  * uncompressible data is probably not useful. This function is used
00953  * only for the level=0 compression option.
00954  * NOTE: this function should be optimized to avoid extra copying.
00955  */
00956 local block_state deflate_stored(s, flush)
00957     deflate_state *s;
00958     int flush;
00959 {
00960     for (;;) {
00961         /* Fill the window as much as possible: */
00962         if (s->lookahead <= 1) {
00963
00964             Assert(s->strstart < s->w_size+MAX_DIST(s) ||
00965            s->block_start >= (long)s->w_size, "slide too late");
00966
00967             fill_window(s);
00968             if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
00969
00970             if (s->lookahead == 0) break; /* flush the current block */
00971         }
00972     Assert(s->block_start >= 0L, "block gone");
00973
00974     s->strstart += s->lookahead;
00975     s->lookahead = 0;
00976
00977         /* Stored blocks are limited to 0xffff bytes: */
00978         if (s->strstart == 0 || s->strstart > 0xfffe) {
00979         /* strstart == 0 is possible when wraparound on 16-bit machine */
00980         s->lookahead = s->strstart - 0xffff;
00981         s->strstart = 0xffff;
00982     }
00983
00984     /* Emit a stored block if it is large enough: */
00985         if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
00986             FLUSH_BLOCK(s, 0);
00987     }
00988     }
00989     FLUSH_BLOCK(s, flush == Z_FINISH);
00990     return flush == Z_FINISH ? finish_done : block_done;
00991 }
00992
00993 /* ===========================================================================
00994  * Compress as much as possible from the input stream, return the current
00995  * block state.
00996  * This function does not perform lazy evaluation of matches and inserts
00997  * new strings in the dictionary only for unmatched strings or for short
00998  * matches. It is used only for the fast compression options.
00999  */
01000 local block_state deflate_fast(s, flush)
01001     deflate_state *s;
01002     int flush;
01003 {
01004     IPos hash_head = NIL; /* head of the hash chain */
01005     int bflush;           /* set if current block must be flushed */
01006
01007     for (;;) {
01008         /* Make sure that we always have enough lookahead, except
01009          * at the end of the input file. We need MAX_MATCH bytes
01010          * for the next match, plus MIN_MATCH bytes to insert the
01011          * string following the next match.
01012          */
01013         if (s->lookahead < MIN_LOOKAHEAD) {
01014             fill_window(s);
01015             if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
01016             return need_more;
01017         }
01018             if (s->lookahead == 0) break; /* flush the current block */
01019         }
01020
01021         /* Insert the string window[strstart .. strstart+2] in the
01022          * dictionary, and set hash_head to the head of the hash chain:
01023          */
01024         if (s->lookahead >= MIN_MATCH) {
01025             INSERT_STRING(s, s->strstart, hash_head);
01026         }
01027
01028         /* Find the longest match, discarding those <= prev_length.
01029          * At this point we have always match_length < MIN_MATCH
01030          */
01031         if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
01032             /* To simplify the code, we prevent matches with the string
01033              * of window index 0 (in particular we have to avoid a match
01034              * of the string with itself at the start of the input file).
01035              */
01036             if (s->strategy != Z_HUFFMAN_ONLY) {
01037                 s->match_length = longest_match (s, hash_head);
01038             }
01039             /* longest_match() sets match_start */
01040         }
01041         if (s->match_length >= MIN_MATCH) {
01042             check_match(s, s->strstart, s->match_start, s->match_length);
01043
01044             bflush = _tr_tally(s, s->strstart - s->match_start,
01045                                s->match_length - MIN_MATCH);
01046
01047             s->lookahead -= s->match_length;
01048
01049             /* Insert new strings in the hash table only if the match length
01050              * is not too large. This saves time but degrades compression.
01051              */
01052             if (s->match_length <= s->max_insert_length &&
01053                 s->lookahead >= MIN_MATCH) {
01054                 s->match_length--; /* string at strstart already in hash table */
01055                 do {
01056                     s->strstart++;
01057                     INSERT_STRING(s, s->strstart, hash_head);
01058                     /* strstart never exceeds WSIZE-MAX_MATCH, so there are
01059                      * always MIN_MATCH bytes ahead.
01060                      */
01061                 } while (--s->match_length != 0);
01062                 s->strstart++;
01063             } else {
01064                 s->strstart += s->match_length;
01065                 s->match_length = 0;
01066                 s->ins_h = s->window[s->strstart];
01067                 UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
01068 #if MIN_MATCH != 3
01069                 Call UPDATE_HASH() MIN_MATCH-3 more times
01070 #endif
01071                 /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
01072                  * matter since it will be recomputed at next deflate call.
01073                  */
01074             }
01075         } else {
01076             /* No match, output a literal byte */
01077             Tracevv((stderr,"%c", s->window[s->strstart]));
01078             bflush = _tr_tally (s, 0, s->window[s->strstart]);
01079             s->lookahead--;
01080             s->strstart++;
01081         }
01082         if (bflush) FLUSH_BLOCK(s, 0);
01083     }
01084     FLUSH_BLOCK(s, flush == Z_FINISH);
01085     return flush == Z_FINISH ? finish_done : block_done;
01086 }
01087
01088 /* ===========================================================================
01089  * Same as above, but achieves better compression. We use a lazy
01090  * evaluation for matches: a match is finally adopted only if there is
01091  * no better match at the next window position.
01092  */
01093 local block_state deflate_slow(s, flush)
01094     deflate_state *s;
01095     int flush;
01096 {
01097     IPos hash_head = NIL;    /* head of hash chain */
01098     int bflush;              /* set if current block must be flushed */
01099
01100     /* Process the input block. */
01101     for (;;) {
01102         /* Make sure that we always have enough lookahead, except
01103          * at the end of the input file. We need MAX_MATCH bytes
01104          * for the next match, plus MIN_MATCH bytes to insert the
01105          * string following the next match.
01106          */
01107         if (s->lookahead < MIN_LOOKAHEAD) {
01108             fill_window(s);
01109             if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
01110             return need_more;
01111         }
01112             if (s->lookahead == 0) break; /* flush the current block */
01113         }
01114
01115         /* Insert the string window[strstart .. strstart+2] in the
01116          * dictionary, and set hash_head to the head of the hash chain:
01117          */
01118         if (s->lookahead >= MIN_MATCH) {
01119             INSERT_STRING(s, s->strstart, hash_head);
01120         }
01121
01122         /* Find the longest match, discarding those <= prev_length.
01123          */
01124         s->prev_length = s->match_length, s->prev_match = s->match_start;
01125         s->match_length = MIN_MATCH-1;
01126
01127         if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
01128             s->strstart - hash_head <= MAX_DIST(s)) {
01129             /* To simplify the code, we prevent matches with the string
01130              * of window index 0 (in particular we have to avoid a match
01131              * of the string with itself at the start of the input file).
01132              */
01133             if (s->strategy != Z_HUFFMAN_ONLY) {
01134                 s->match_length = longest_match (s, hash_head);
01135             }
01136             /* longest_match() sets match_start */
01137
01138             if (s->match_length <= 5 && (s->strategy == Z_FILTERED ||
01139                  (s->match_length == MIN_MATCH &&
01140                   s->strstart - s->match_start > TOO_FAR))) {
01141
01142                 /* If prev_match is also MIN_MATCH, match_start is garbage
01143                  * but we will ignore the current match anyway.
01144                  */
01145                 s->match_length = MIN_MATCH-1;
01146             }
01147         }
01148         /* If there was a match at the previous step and the current
01149          * match is not better, output the previous match:
01150          */
01151         if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
01152             uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
01153             /* Do not insert strings in hash table beyond this. */
01154
01155             check_match(s, s->strstart-1, s->prev_match, s->prev_length);
01156
01157             bflush = _tr_tally(s, s->strstart -1 - s->prev_match,
01158                                s->prev_length - MIN_MATCH);
01159
01160             /* Insert in hash table all strings up to the end of the match.
01161              * strstart-1 and strstart are already inserted. If there is not
01162              * enough lookahead, the last two strings are not inserted in
01163              * the hash table.
01164              */
01165             s->lookahead -= s->prev_length-1;
01166             s->prev_length -= 2;
01167             do {
01168                 if (++s->strstart <= max_insert) {
01169                     INSERT_STRING(s, s->strstart, hash_head);
01170                 }
01171             } while (--s->prev_length != 0);
01172             s->match_available = 0;
01173             s->match_length = MIN_MATCH-1;
01174             s->strstart++;
01175
01176             if (bflush) FLUSH_BLOCK(s, 0);
01177
01178         } else if (s->match_available) {
01179             /* If there was no match at the previous position, output a
01180              * single literal. If there was a match but the current match
01181              * is longer, truncate the previous match to a single literal.
01182              */
01183             Tracevv((stderr,"%c", s->window[s->strstart-1]));
01184             if (_tr_tally (s, 0, s->window[s->strstart-1])) {
01185                 FLUSH_BLOCK_ONLY(s, 0);
01186             }
01187             s->strstart++;
01188             s->lookahead--;
01189             if (s->strm->avail_out == 0) return need_more;
01190         } else {
01191             /* There is no previous match to compare with, wait for
01192              * the next step to decide.
01193              */
01194             s->match_available = 1;
01195             s->strstart++;
01196             s->lookahead--;
01197         }
01198     }
01199     Assert (flush != Z_NO_FLUSH, "no flush?");
01200     if (s->match_available) {
01201         Tracevv((stderr,"%c", s->window[s->strstart-1]));
01202         _tr_tally (s, 0, s->window[s->strstart-1]);
01203         s->match_available = 0;
01204     }
01205     FLUSH_BLOCK(s, flush == Z_FINISH);
01206     return flush == Z_FINISH ? finish_done : block_done;
01207 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/deflate.h Source File

cvs-1.10/zlib/deflate.h

Go to the documentation of this file.
00001 /* deflate.h -- internal compression state
00002  * Copyright (C) 1995-1996 Jean-loup Gailly
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* WARNING: this file should *not* be used by applications. It is
00007    part of the implementation of the compression library and is
00008    subject to change. Applications should only use zlib.h.
00009  */
00010
00011 /* $Id: deflate.h,v 1.10 1996/07/02 12:41:00 me Exp $ */
00012
00013 #ifndef _DEFLATE_H
00014 #define _DEFLATE_H
00015
00016 #include "zutil.h"
00017
00018 /* ===========================================================================
00019  * Internal compression state.
00020  */
00021
00022 #define LENGTH_CODES 29
00023 /* number of length codes, not counting the special END_BLOCK code */
00024
00025 #define LITERALS  256
00026 /* number of literal bytes 0..255 */
00027
00028 #define L_CODES (LITERALS+1+LENGTH_CODES)
00029 /* number of Literal or Length codes, including the END_BLOCK code */
00030
00031 #define D_CODES   30
00032 /* number of distance codes */
00033
00034 #define BL_CODES  19
00035 /* number of codes used to transfer the bit lengths */
00036
00037 #define HEAP_SIZE (2*L_CODES+1)
00038 /* maximum heap size */
00039
00040 #define MAX_BITS 15
00041 /* All codes must not exceed MAX_BITS bits */
00042
00043 #define INIT_STATE    42
00044 #define BUSY_STATE   113
00045 #define FINISH_STATE 666
00046 /* Stream status */
00047
00048
00049 /* Data structure describing a single value and its code string. */
00050 typedef struct ct_data_s {
00051     union {
00052         ush  freq;       /* frequency count */
00053         ush  code;       /* bit string */
00054     } fc;
00055     union {
00056         ush  dad;        /* father node in Huffman tree */
00057         ush  len;        /* length of bit string */
00058     } dl;
00059 } FAR ct_data;
00060
00061 #define Freq fc.freq
00062 #define Code fc.code
00063 #define Dad  dl.dad
00064 #define Len  dl.len
00065
00066 typedef struct static_tree_desc_s  static_tree_desc;
00067
00068 typedef struct tree_desc_s {
00069     ct_data *dyn_tree;           /* the dynamic tree */
00070     int     max_code;            /* largest code with non zero frequency */
00071     static_tree_desc *stat_desc; /* the corresponding static tree */
00072 } FAR tree_desc;
00073
00074 typedef ush Pos;
00075 typedef Pos FAR Posf;
00076 typedef unsigned IPos;
00077
00078 /* A Pos is an index in the character window. We use short instead of int to
00079  * save space in the various tables. IPos is used only for parameter passing.
00080  */
00081
00082 typedef struct internal_state {
00083     z_streamp strm;      /* pointer back to this zlib stream */
00084     int   status;        /* as the name implies */
00085     Bytef *pending_buf;  /* output still pending */
00086     Bytef *pending_out;  /* next pending byte to output to the stream */
00087     int   pending;       /* nb of bytes in the pending buffer */
00088     int   noheader;      /* suppress zlib header and adler32 */
00089     Byte  data_type;     /* UNKNOWN, BINARY or ASCII */
00090     Byte  method;        /* STORED (for zip only) or DEFLATED */
00091     int   last_flush;    /* value of flush param for previous deflate call */
00092
00093                 /* used by deflate.c: */
00094
00095     uInt  w_size;        /* LZ77 window size (32K by default) */
00096     uInt  w_bits;        /* log2(w_size)  (8..16) */
00097     uInt  w_mask;        /* w_size - 1 */
00098
00099     Bytef *window;
00100     /* Sliding window. Input bytes are read into the second half of the window,
00101      * and move to the first half later to keep a dictionary of at least wSize
00102      * bytes. With this organization, matches are limited to a distance of
00103      * wSize-MAX_MATCH bytes, but this ensures that IO is always
00104      * performed with a length multiple of the block size. Also, it limits
00105      * the window size to 64K, which is quite useful on MSDOS.
00106      * To do: use the user input buffer as sliding window.
00107      */
00108
00109     ulg window_size;
00110     /* Actual size of window: 2*wSize, except when the user input buffer
00111      * is directly used as sliding window.
00112      */
00113
00114     Posf *prev;
00115     /* Link to older string with same hash index. To limit the size of this
00116      * array to 64K, this link is maintained only for the last 32K strings.
00117      * An index in this array is thus a window index modulo 32K.
00118      */
00119
00120     Posf *head; /* Heads of the hash chains or NIL. */
00121
00122     uInt  ins_h;          /* hash index of string to be inserted */
00123     uInt  hash_size;      /* number of elements in hash table */
00124     uInt  hash_bits;      /* log2(hash_size) */
00125     uInt  hash_mask;      /* hash_size-1 */
00126
00127     uInt  hash_shift;
00128     /* Number of bits by which ins_h must be shifted at each input
00129      * step. It must be such that after MIN_MATCH steps, the oldest
00130      * byte no longer takes part in the hash key, that is:
00131      *   hash_shift * MIN_MATCH >= hash_bits
00132      */
00133
00134     long block_start;
00135     /* Window position at the beginning of the current output block. Gets
00136      * negative when the window is moved backwards.
00137      */
00138
00139     uInt match_length;           /* length of best match */
00140     IPos prev_match;             /* previous match */
00141     int match_available;         /* set if previous match exists */
00142     uInt strstart;               /* start of string to insert */
00143     uInt match_start;            /* start of matching string */
00144     uInt lookahead;              /* number of valid bytes ahead in window */
00145
00146     uInt prev_length;
00147     /* Length of the best match at previous step. Matches not greater than this
00148      * are discarded. This is used in the lazy match evaluation.
00149      */
00150
00151     uInt max_chain_length;
00152     /* To speed up deflation, hash chains are never searched beyond this
00153      * length.  A higher limit improves compression ratio but degrades the
00154      * speed.
00155      */
00156
00157     uInt max_lazy_match;
00158     /* Attempt to find a better match only when the current match is strictly
00159      * smaller than this value. This mechanism is used only for compression
00160      * levels >= 4.
00161      */
00162 #   define max_insert_length  max_lazy_match
00163     /* Insert new strings in the hash table only if the match length is not
00164      * greater than this length. This saves time but degrades compression.
00165      * max_insert_length is used only for compression levels <= 3.
00166      */
00167
00168     int level;    /* compression level (1..9) */
00169     int strategy; /* favor or force Huffman coding*/
00170
00171     uInt good_match;
00172     /* Use a faster search when the previous match is longer than this */
00173
00174     int nice_match; /* Stop searching when current match exceeds this */
00175
00176                 /* used by trees.c: */
00177     /* Didn't use ct_data typedef below to supress compiler warning */
00178     struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
00179     struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
00180     struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
00181
00182     struct tree_desc_s l_desc;               /* desc. for literal tree */
00183     struct tree_desc_s d_desc;               /* desc. for distance tree */
00184     struct tree_desc_s bl_desc;              /* desc. for bit length tree */
00185
00186     ush bl_count[MAX_BITS+1];
00187     /* number of codes at each bit length for an optimal tree */
00188
00189     int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
00190     int heap_len;               /* number of elements in the heap */
00191     int heap_max;               /* element of largest frequency */
00192     /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
00193      * The same heap array is used to build all trees.
00194      */
00195
00196     uch depth[2*L_CODES+1];
00197     /* Depth of each subtree used as tie breaker for trees of equal frequency
00198      */
00199
00200     uchf *l_buf;          /* buffer for literals or lengths */
00201
00202     uInt  lit_bufsize;
00203     /* Size of match buffer for literals/lengths.  There are 4 reasons for
00204      * limiting lit_bufsize to 64K:
00205      *   - frequencies can be kept in 16 bit counters
00206      *   - if compression is not successful for the first block, all input
00207      *     data is still in the window so we can still emit a stored block even
00208      *     when input comes from standard input.  (This can also be done for
00209      *     all blocks if lit_bufsize is not greater than 32K.)
00210      *   - if compression is not successful for a file smaller than 64K, we can
00211      *     even emit a stored file instead of a stored block (saving 5 bytes).
00212      *     This is applicable only for zip (not gzip or zlib).
00213      *   - creating new Huffman trees less frequently may not provide fast
00214      *     adaptation to changes in the input data statistics. (Take for
00215      *     example a binary file with poorly compressible code followed by
00216      *     a highly compressible string table.) Smaller buffer sizes give
00217      *     fast adaptation but have of course the overhead of transmitting
00218      *     trees more frequently.
00219      *   - I can't count above 4
00220      */
00221
00222     uInt last_lit;      /* running index in l_buf */
00223
00224     ushf *d_buf;
00225     /* Buffer for distances. To simplify the code, d_buf and l_buf have
00226      * the same number of elements. To use different lengths, an extra flag
00227      * array would be necessary.
00228      */
00229
00230     ulg opt_len;        /* bit length of current block with optimal trees */
00231     ulg static_len;     /* bit length of current block with static trees */
00232     ulg compressed_len; /* total bit length of compressed file */
00233     uInt matches;       /* number of string matches in current block */
00234     int last_eob_len;   /* bit length of EOB code for last block */
00235
00236 #ifdef DEBUG
00237     ulg bits_sent;      /* bit length of the compressed data */
00238 #endif
00239
00240     ush bi_buf;
00241     /* Output buffer. bits are inserted starting at the bottom (least
00242      * significant bits).
00243      */
00244     int bi_valid;
00245     /* Number of valid bits in bi_buf.  All bits above the last valid bit
00246      * are always zero.
00247      */
00248
00249 } FAR deflate_state;
00250
00251 /* Output a byte on the stream.
00252  * IN assertion: there is enough room in pending_buf.
00253  */
00254 #define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
00255
00256
00257 #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
00258 /* Minimum amount of lookahead, except at the end of the input file.
00259  * See deflate.c for comments about the MIN_MATCH+1.
00260  */
00261
00262 #define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
00263 /* In order to simplify the code, particularly on 16 bit machines, match
00264  * distances are limited to MAX_DIST instead of WSIZE.
00265  */
00266
00267         /* in trees.c */
00268 void _tr_init         OF((deflate_state *s));
00269 int  _tr_tally        OF((deflate_state *s, unsigned dist, unsigned lc));
00270 ulg  _tr_flush_block  OF((deflate_state *s, charf *buf, ulg stored_len,
00271               int eof));
00272 void _tr_align        OF((deflate_state *s));
00273 void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
00274                           int eof));
00275 #endif
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/example.c Source File

cvs-1.10/zlib/example.c

Go to the documentation of this file.
00001 /* example.c -- usage example of the zlib compression library
00002  * Copyright (C) 1995-1996 Jean-loup Gailly.
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* $Id: example.c,v 1.16 1996/05/23 17:11:28 me Exp $ */
00007
00008 #include <stdio.h>
00009 #include "zlib.h"
00010
00011 #ifdef STDC
00012 #  include <string.h>
00013 #  include <stdlib.h>
00014 #else
00015    extern void exit  OF((int));
00016 #endif
00017
00018 #define CHECK_ERR(err, msg) { \
00019     if (err != Z_OK) { \
00020         fprintf(stderr, "%s error: %d\n", msg, err); \
00021         exit(1); \
00022     } \
00023 }
00024
00025 const char hello[] = "hello, hello!";
00026 /* "hello world" would be more standard, but the repeated "hello"
00027  * stresses the compression code better, sorry...
00028  */
00029
00030 const char dictionary[] = "hello";
00031 uLong dictId; /* Adler32 value of the dictionary */
00032
00033 void test_compress      OF((Byte *compr, uLong comprLen,
00034                     Byte *uncompr, uLong uncomprLen));
00035 void test_gzio          OF((const char *out, const char *in,
00036                     Byte *uncompr, int uncomprLen));
00037 void test_deflate       OF((Byte *compr, uLong comprLen));
00038 void test_inflate       OF((Byte *compr, uLong comprLen,
00039                     Byte *uncompr, uLong uncomprLen));
00040 void test_large_deflate OF((Byte *compr, uLong comprLen,
00041                     Byte *uncompr, uLong uncomprLen));
00042 void test_large_inflate OF((Byte *compr, uLong comprLen,
00043                     Byte *uncompr, uLong uncomprLen));
00044 void test_flush         OF((Byte *compr, uLong comprLen));
00045 void test_sync          OF((Byte *compr, uLong comprLen,
00046                     Byte *uncompr, uLong uncomprLen));
00047 void test_dict_deflate  OF((Byte *compr, uLong comprLen));
00048 void test_dict_inflate  OF((Byte *compr, uLong comprLen,
00049                     Byte *uncompr, uLong uncomprLen));
00050 int  main               OF((int argc, char *argv[]));
00051
00052 /* ===========================================================================
00053  * Test compress() and uncompress()
00054  */
00055 void test_compress(compr, comprLen, uncompr, uncomprLen)
00056     Byte *compr, *uncompr;
00057     uLong comprLen, uncomprLen;
00058 {
00059     int err;
00060     uLong len = strlen(hello)+1;
00061
00062     err = compress(compr, &comprLen, (const Bytef*)hello, len);
00063     CHECK_ERR(err, "compress");
00064
00065     strcpy((char*)uncompr, "garbage");
00066
00067     err = uncompress(uncompr, &uncomprLen, compr, comprLen);
00068     CHECK_ERR(err, "uncompress");
00069
00070     if (strcmp((char*)uncompr, hello)) {
00071         fprintf(stderr, "bad uncompress\n");
00072     } else {
00073         printf("uncompress(): %s\n", uncompr);
00074     }
00075 }
00076
00077 /* ===========================================================================
00078  * Test read/write of .gz files
00079  */
00080 void test_gzio(out, in, uncompr, uncomprLen)
00081     const char *out; /* output file */
00082     const char *in;  /* input file */
00083     Byte *uncompr;
00084     int  uncomprLen;
00085 {
00086     int err;
00087     int len = strlen(hello)+1;
00088     gzFile file;
00089
00090     file = gzopen(out, "wb");
00091     if (file == NULL) {
00092         fprintf(stderr, "gzopen error\n");
00093         exit(1);
00094     }
00095
00096     if (gzwrite(file, (const voidp)hello, (unsigned)len) != len) {
00097         fprintf(stderr, "gzwrite err: %s\n", gzerror(file, &err));
00098     }
00099     gzclose(file);
00100
00101     file = gzopen(in, "rb");
00102     if (file == NULL) {
00103         fprintf(stderr, "gzopen error\n");
00104     }
00105     strcpy((char*)uncompr, "garbage");
00106
00107     uncomprLen = gzread(file, uncompr, (unsigned)uncomprLen);
00108     if (uncomprLen != len) {
00109         fprintf(stderr, "gzread err: %s\n", gzerror(file, &err));
00110     }
00111     gzclose(file);
00112
00113     if (strcmp((char*)uncompr, hello)) {
00114         fprintf(stderr, "bad gzread\n");
00115     } else {
00116         printf("gzread(): %s\n", uncompr);
00117     }
00118 }
00119
00120 /* ===========================================================================
00121  * Test deflate() with small buffers
00122  */
00123 void test_deflate(compr, comprLen)
00124     Byte *compr;
00125     uLong comprLen;
00126 {
00127     z_stream c_stream; /* compression stream */
00128     int err;
00129     int len = strlen(hello)+1;
00130
00131     c_stream.zalloc = (alloc_func)0;
00132     c_stream.zfree = (free_func)0;
00133     c_stream.opaque = (voidpf)0;
00134
00135     err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
00136     CHECK_ERR(err, "deflateInit");
00137
00138     c_stream.next_in  = (Bytef*)hello;
00139     c_stream.next_out = compr;
00140
00141     while (c_stream.total_in != (uLong)len && c_stream.total_out < comprLen) {
00142         c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */
00143         err = deflate(&c_stream, Z_NO_FLUSH);
00144         CHECK_ERR(err, "deflate");
00145     }
00146     /* Finish the stream, still forcing small buffers: */
00147     for (;;) {
00148         c_stream.avail_out = 1;
00149         err = deflate(&c_stream, Z_FINISH);
00150         if (err == Z_STREAM_END) break;
00151         CHECK_ERR(err, "deflate");
00152     }
00153
00154     err = deflateEnd(&c_stream);
00155     CHECK_ERR(err, "deflateEnd");
00156 }
00157
00158 /* ===========================================================================
00159  * Test inflate() with small buffers
00160  */
00161 void test_inflate(compr, comprLen, uncompr, uncomprLen)
00162     Byte *compr, *uncompr;
00163     uLong comprLen, uncomprLen;
00164 {
00165     int err;
00166     z_stream d_stream; /* decompression stream */
00167
00168     strcpy((char*)uncompr, "garbage");
00169
00170     d_stream.zalloc = (alloc_func)0;
00171     d_stream.zfree = (free_func)0;
00172     d_stream.opaque = (voidpf)0;
00173
00174     err = inflateInit(&d_stream);
00175     CHECK_ERR(err, "inflateInit");
00176
00177     d_stream.next_in  = compr;
00178     d_stream.next_out = uncompr;
00179
00180     while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) {
00181         d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */
00182         err = inflate(&d_stream, Z_NO_FLUSH);
00183         if (err == Z_STREAM_END) break;
00184         CHECK_ERR(err, "inflate");
00185     }
00186
00187     err = inflateEnd(&d_stream);
00188     CHECK_ERR(err, "inflateEnd");
00189
00190     if (strcmp((char*)uncompr, hello)) {
00191         fprintf(stderr, "bad inflate\n");
00192     } else {
00193         printf("inflate(): %s\n", uncompr);
00194     }
00195 }
00196
00197 /* ===========================================================================
00198  * Test deflate() with large buffers and dynamic change of compression level
00199  */
00200 void test_large_deflate(compr, comprLen, uncompr, uncomprLen)
00201     Byte *compr, *uncompr;
00202     uLong comprLen, uncomprLen;
00203 {
00204     z_stream c_stream; /* compression stream */
00205     int err;
00206
00207     c_stream.zalloc = (alloc_func)0;
00208     c_stream.zfree = (free_func)0;
00209     c_stream.opaque = (voidpf)0;
00210
00211     err = deflateInit(&c_stream, Z_BEST_SPEED);
00212     CHECK_ERR(err, "deflateInit");
00213
00214     c_stream.next_out = compr;
00215     c_stream.avail_out = (uInt)comprLen;
00216
00217     /* At this point, uncompr is still mostly zeroes, so it should compress
00218      * very well:
00219      */
00220     c_stream.next_in = uncompr;
00221     c_stream.avail_in = (uInt)uncomprLen;
00222     err = deflate(&c_stream, Z_NO_FLUSH);
00223     CHECK_ERR(err, "deflate");
00224     if (c_stream.avail_in != 0) {
00225         fprintf(stderr, "deflate not greedy\n");
00226     }
00227
00228     /* Feed in already compressed data and switch to no compression: */
00229     deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
00230     c_stream.next_in = compr;
00231     c_stream.avail_in = (uInt)comprLen/2;
00232     err = deflate(&c_stream, Z_NO_FLUSH);
00233     CHECK_ERR(err, "deflate");
00234
00235     /* Switch back to compressing mode: */
00236     deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
00237     c_stream.next_in = uncompr;
00238     c_stream.avail_in = (uInt)uncomprLen;
00239     err = deflate(&c_stream, Z_NO_FLUSH);
00240     CHECK_ERR(err, "deflate");
00241
00242     err = deflate(&c_stream, Z_FINISH);
00243     if (err != Z_STREAM_END) {
00244         fprintf(stderr, "deflate should report Z_STREAM_END\n");
00245     }
00246     err = deflateEnd(&c_stream);
00247     CHECK_ERR(err, "deflateEnd");
00248 }
00249
00250 /* ===========================================================================
00251  * Test inflate() with large buffers
00252  */
00253 void test_large_inflate(compr, comprLen, uncompr, uncomprLen)
00254     Byte *compr, *uncompr;
00255     uLong comprLen, uncomprLen;
00256 {
00257     int err;
00258     z_stream d_stream; /* decompression stream */
00259
00260     strcpy((char*)uncompr, "garbage");
00261
00262     d_stream.zalloc = (alloc_func)0;
00263     d_stream.zfree = (free_func)0;
00264     d_stream.opaque = (voidpf)0;
00265
00266     err = inflateInit(&d_stream);
00267     CHECK_ERR(err, "inflateInit");
00268
00269     d_stream.next_in  = compr;
00270     d_stream.avail_in = (uInt)comprLen;
00271
00272     for (;;) {
00273         d_stream.next_out = uncompr;            /* discard the output */
00274     d_stream.avail_out = (uInt)uncomprLen;
00275         err = inflate(&d_stream, Z_NO_FLUSH);
00276         if (err == Z_STREAM_END) break;
00277         CHECK_ERR(err, "large inflate");
00278     }
00279
00280     err = inflateEnd(&d_stream);
00281     CHECK_ERR(err, "inflateEnd");
00282
00283     if (d_stream.total_out != 2*uncomprLen + comprLen/2) {
00284         fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out);
00285     } else {
00286         printf("large_inflate(): OK\n");
00287     }
00288 }
00289
00290 /* ===========================================================================
00291  * Test deflate() with full flush
00292  */
00293 void test_flush(compr, comprLen)
00294     Byte *compr;
00295     uLong comprLen;
00296 {
00297     z_stream c_stream; /* compression stream */
00298     int err;
00299     int len = strlen(hello)+1;
00300
00301     c_stream.zalloc = (alloc_func)0;
00302     c_stream.zfree = (free_func)0;
00303     c_stream.opaque = (voidpf)0;
00304
00305     err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
00306     CHECK_ERR(err, "deflateInit");
00307
00308     c_stream.next_in  = (Bytef*)hello;
00309     c_stream.next_out = compr;
00310     c_stream.avail_in = 3;
00311     c_stream.avail_out = (uInt)comprLen;
00312     err = deflate(&c_stream, Z_FULL_FLUSH);
00313     CHECK_ERR(err, "deflate");
00314
00315     compr[3]++; /* force an error in first compressed block */
00316     c_stream.avail_in = len - 3;
00317
00318     err = deflate(&c_stream, Z_FINISH);
00319     if (err != Z_STREAM_END) {
00320         CHECK_ERR(err, "deflate");
00321     }
00322     err = deflateEnd(&c_stream);
00323     CHECK_ERR(err, "deflateEnd");
00324 }
00325
00326 /* ===========================================================================
00327  * Test inflateSync()
00328  */
00329 void test_sync(compr, comprLen, uncompr, uncomprLen)
00330     Byte *compr, *uncompr;
00331     uLong comprLen, uncomprLen;
00332 {
00333     int err;
00334     z_stream d_stream; /* decompression stream */
00335
00336     strcpy((char*)uncompr, "garbage");
00337
00338     d_stream.zalloc = (alloc_func)0;
00339     d_stream.zfree = (free_func)0;
00340     d_stream.opaque = (voidpf)0;
00341
00342     err = inflateInit(&d_stream);
00343     CHECK_ERR(err, "inflateInit");
00344
00345     d_stream.next_in  = compr;
00346     d_stream.next_out = uncompr;
00347     d_stream.avail_in = 2; /* just read the zlib header */
00348     d_stream.avail_out = (uInt)uncomprLen;
00349
00350     inflate(&d_stream, Z_NO_FLUSH);
00351     CHECK_ERR(err, "inflate");
00352
00353     d_stream.avail_in = (uInt)comprLen-2;   /* read all compressed data */
00354     err = inflateSync(&d_stream);           /* but skip the damaged part */
00355     CHECK_ERR(err, "inflateSync");
00356
00357     err = inflate(&d_stream, Z_FINISH);
00358     if (err != Z_DATA_ERROR) {
00359         fprintf(stderr, "inflate should report DATA_ERROR\n");
00360         /* Because of incorrect adler32 */
00361     }
00362     err = inflateEnd(&d_stream);
00363     CHECK_ERR(err, "inflateEnd");
00364
00365     printf("after inflateSync(): hel%s\n", uncompr);
00366 }
00367
00368 /* ===========================================================================
00369  * Test deflate() with preset dictionary
00370  */
00371 void test_dict_deflate(compr, comprLen)
00372     Byte *compr;
00373     uLong comprLen;
00374 {
00375     z_stream c_stream; /* compression stream */
00376     int err;
00377
00378     c_stream.zalloc = (alloc_func)0;
00379     c_stream.zfree = (free_func)0;
00380     c_stream.opaque = (voidpf)0;
00381
00382     err = deflateInit(&c_stream, Z_BEST_COMPRESSION);
00383     CHECK_ERR(err, "deflateInit");
00384
00385     err = deflateSetDictionary(&c_stream,
00386                    (const Bytef*)dictionary, sizeof(dictionary));
00387     CHECK_ERR(err, "deflateSetDictionary");
00388
00389     dictId = c_stream.adler;
00390     c_stream.next_out = compr;
00391     c_stream.avail_out = (uInt)comprLen;
00392
00393     c_stream.next_in = (Bytef*)hello;
00394     c_stream.avail_in = (uInt)strlen(hello)+1;
00395
00396     err = deflate(&c_stream, Z_FINISH);
00397     if (err != Z_STREAM_END) {
00398         fprintf(stderr, "deflate should report Z_STREAM_END\n");
00399     }
00400     err = deflateEnd(&c_stream);
00401     CHECK_ERR(err, "deflateEnd");
00402 }
00403
00404 /* ===========================================================================
00405  * Test inflate() with a preset dictionary
00406  */
00407 void test_dict_inflate(compr, comprLen, uncompr, uncomprLen)
00408     Byte *compr, *uncompr;
00409     uLong comprLen, uncomprLen;
00410 {
00411     int err;
00412     z_stream d_stream; /* decompression stream */
00413
00414     strcpy((char*)uncompr, "garbage");
00415
00416     d_stream.zalloc = (alloc_func)0;
00417     d_stream.zfree = (free_func)0;
00418     d_stream.opaque = (voidpf)0;
00419
00420     err = inflateInit(&d_stream);
00421     CHECK_ERR(err, "inflateInit");
00422
00423     d_stream.next_in  = compr;
00424     d_stream.avail_in = (uInt)comprLen;
00425
00426     d_stream.next_out = uncompr;
00427     d_stream.avail_out = (uInt)uncomprLen;
00428
00429     for (;;) {
00430         err = inflate(&d_stream, Z_NO_FLUSH);
00431         if (err == Z_STREAM_END) break;
00432     if (err == Z_NEED_DICT) {
00433         if (d_stream.adler != dictId) {
00434         fprintf(stderr, "unexpected dictionary");
00435         exit(1);
00436         }
00437         err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,
00438                        sizeof(dictionary));
00439     }
00440         CHECK_ERR(err, "inflate with dict");
00441     }
00442
00443     err = inflateEnd(&d_stream);
00444     CHECK_ERR(err, "inflateEnd");
00445
00446     if (strcmp((char*)uncompr, hello)) {
00447         fprintf(stderr, "bad inflate with dict\n");
00448     } else {
00449         printf("inflate with dictionary: %s\n", uncompr);
00450     }
00451 }
00452
00453 /* ===========================================================================
00454  * Usage:  example [output.gz  [input.gz]]
00455  */
00456
00457 int main(argc, argv)
00458     int argc;
00459     char *argv[];
00460 {
00461     Byte *compr, *uncompr;
00462     uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
00463     uLong uncomprLen = comprLen;
00464
00465     if (zlibVersion()[0] != ZLIB_VERSION[0]) {
00466         fprintf(stderr, "incompatible zlib version\n");
00467         exit(1);
00468
00469     } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) {
00470         fprintf(stderr, "warning: different zlib version\n");
00471     }
00472
00473     compr    = (Byte*)calloc((uInt)comprLen, 1);
00474     uncompr  = (Byte*)calloc((uInt)uncomprLen, 1);
00475     /* compr and uncompr are cleared to avoid reading uninitialized
00476      * data and to ensure that uncompr compresses well.
00477      */
00478     if (compr == Z_NULL || uncompr == Z_NULL) {
00479         printf("out of memory\n");
00480     exit(1);
00481     }
00482
00483     test_compress(compr, comprLen, uncompr, uncomprLen);
00484
00485     test_gzio((argc > 1 ? argv[1] : "foo.gz"),
00486               (argc > 2 ? argv[2] : "foo.gz"),
00487           uncompr, (int)uncomprLen);
00488
00489     test_deflate(compr, comprLen);
00490     test_inflate(compr, comprLen, uncompr, uncomprLen);
00491
00492     test_large_deflate(compr, comprLen, uncompr, uncomprLen);
00493     test_large_inflate(compr, comprLen, uncompr, uncomprLen);
00494
00495     test_flush(compr, comprLen);
00496     test_sync(compr, comprLen, uncompr, uncomprLen);
00497
00498     test_dict_deflate(compr, comprLen);
00499     test_dict_inflate(compr, comprLen, uncompr, uncomprLen);
00500
00501     exit(0);
00502     return 0; /* to avoid warning */
00503 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/gzio.c Source File

cvs-1.10/zlib/gzio.c

Go to the documentation of this file.
00001 /* gzio.c -- IO on .gz files
00002  * Copyright (C) 1995-1996 Jean-loup Gailly.
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* $Id: gzio.c,v 1.14 1996/07/24 13:41:01 me Exp $ */
00007
00008 #include <stdio.h>
00009
00010 #include "zutil.h"
00011
00012 struct internal_state {int dummy;}; /* for buggy compilers */
00013
00014 #define Z_BUFSIZE 4096
00015
00016 #define ALLOC(size) malloc(size)
00017 #define TRYFREE(p) {if (p) free(p);}
00018
00019 static int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
00020
00021 /* gzip flag byte */
00022 #define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
00023 #define HEAD_CRC     0x02 /* bit 1 set: header CRC present */
00024 #define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
00025 #define ORIG_NAME    0x08 /* bit 3 set: original file name present */
00026 #define COMMENT      0x10 /* bit 4 set: file comment present */
00027 #define RESERVED     0xE0 /* bits 5..7: reserved */
00028
00029 typedef struct gz_stream {
00030     z_stream stream;
00031     int      z_err;   /* error code for last stream operation */
00032     int      z_eof;   /* set if end of input file */
00033     FILE     *file;   /* .gz file */
00034     Byte     *inbuf;  /* input buffer */
00035     Byte     *outbuf; /* output buffer */
00036     uLong    crc;     /* crc32 of uncompressed data */
00037     char     *msg;    /* error message */
00038     char     *path;   /* path name for debugging only */
00039     int      transparent; /* 1 if input file is not a .gz file */
00040     char     mode;    /* 'w' or 'r' */
00041 } gz_stream;
00042
00043
00044 local gzFile gz_open      OF((const char *path, const char *mode, int  fd));
00045 local int    get_byte     OF((gz_stream *s));
00046 local void   check_header OF((gz_stream *s));
00047 local int    destroy      OF((gz_stream *s));
00048 local void   putLong      OF((FILE *file, uLong x));
00049 local uLong  getLong      OF((gz_stream *s));
00050
00051 /* ===========================================================================
00052      Opens a gzip (.gz) file for reading or writing. The mode parameter
00053    is as in fopen ("rb" or "wb"). The file is given either by file descriptor
00054    or path name (if fd == -1).
00055      gz_open return NULL if the file could not be opened or if there was
00056    insufficient memory to allocate the (de)compression state; errno
00057    can be checked to distinguish the two cases (if errno is zero, the
00058    zlib error is Z_MEM_ERROR).
00059 */
00060 local gzFile gz_open (path, mode, fd)
00061     const char *path;
00062     const char *mode;
00063     int  fd;
00064 {
00065     int err;
00066     int level = Z_DEFAULT_COMPRESSION; /* compression level */
00067     char *p = (char*)mode;
00068     gz_stream *s;
00069     char fmode[80]; /* copy of mode, without the compression level */
00070     char *m = fmode;
00071
00072     if (!path || !mode) return Z_NULL;
00073
00074     s = (gz_stream *)ALLOC(sizeof(gz_stream));
00075     if (!s) return Z_NULL;
00076
00077     s->stream.zalloc = (alloc_func)0;
00078     s->stream.zfree = (free_func)0;
00079     s->stream.opaque = (voidpf)0;
00080     s->stream.next_in = s->inbuf = Z_NULL;
00081     s->stream.next_out = s->outbuf = Z_NULL;
00082     s->stream.avail_in = s->stream.avail_out = 0;
00083     s->file = NULL;
00084     s->z_err = Z_OK;
00085     s->z_eof = 0;
00086     s->crc = crc32(0L, Z_NULL, 0);
00087     s->msg = NULL;
00088     s->transparent = 0;
00089
00090     s->path = (char*)ALLOC(strlen(path)+1);
00091     if (s->path == NULL) {
00092         return destroy(s), (gzFile)Z_NULL;
00093     }
00094     strcpy(s->path, path); /* do this early for debugging */
00095
00096     s->mode = '\0';
00097     do {
00098         if (*p == 'r') s->mode = 'r';
00099         if (*p == 'w' || *p == 'a') s->mode = 'w';
00100         if (*p >= '0' && *p <= '9') {
00101         level = *p - '0';
00102     } else {
00103         *m++ = *p; /* copy the mode */
00104     }
00105     } while (*p++ && m != fmode + sizeof(fmode));
00106     if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
00107
00108     if (s->mode == 'w') {
00109         err = deflateInit2(&(s->stream), level,
00110                            Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, 0);
00111         /* windowBits is passed < 0 to suppress zlib header */
00112
00113         s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
00114
00115         if (err != Z_OK || s->outbuf == Z_NULL) {
00116             return destroy(s), (gzFile)Z_NULL;
00117         }
00118     } else {
00119         err = inflateInit2(&(s->stream), -MAX_WBITS);
00120         s->stream.next_in  = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
00121
00122         if (err != Z_OK || s->inbuf == Z_NULL) {
00123             return destroy(s), (gzFile)Z_NULL;
00124         }
00125     }
00126     s->stream.avail_out = Z_BUFSIZE;
00127
00128     errno = 0;
00129     s->file = fd < 0 ? FOPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
00130
00131     if (s->file == NULL) {
00132         return destroy(s), (gzFile)Z_NULL;
00133     }
00134     if (s->mode == 'w') {
00135         /* Write a very simple .gz header:
00136          */
00137         fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
00138              Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
00139     } else {
00140     check_header(s); /* skip the .gz header */
00141     }
00142     return (gzFile)s;
00143 }
00144
00145 /* ===========================================================================
00146      Opens a gzip (.gz) file for reading or writing.
00147 */
00148 gzFile gzopen (path, mode)
00149     const char *path;
00150     const char *mode;
00151 {
00152     return gz_open (path, mode, -1);
00153 }
00154
00155 /* ===========================================================================
00156      Associate a gzFile with the file descriptor fd. fd is not dup'ed here
00157    to mimic the behavio(u)r of fdopen.
00158 */
00159 gzFile gzdopen (fd, mode)
00160     int fd;
00161     const char *mode;
00162 {
00163     char name[20];
00164
00165     if (fd < 0) return (gzFile)Z_NULL;
00166     sprintf(name, "<fd:%d>", fd); /* for debugging */
00167
00168     return gz_open (name, mode, fd);
00169 }
00170
00171 /* ===========================================================================
00172      Read a byte from a gz_stream; update next_in and avail_in. Return EOF
00173    for end of file.
00174    IN assertion: the stream s has been sucessfully opened for reading.
00175 */
00176 local int get_byte(s)
00177     gz_stream *s;
00178 {
00179     if (s->z_eof) return EOF;
00180     if (s->stream.avail_in == 0) {
00181     errno = 0;
00182     s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
00183     if (s->stream.avail_in == 0) {
00184         s->z_eof = 1;
00185         if (ferror(s->file)) s->z_err = Z_ERRNO;
00186         return EOF;
00187     }
00188     s->stream.next_in = s->inbuf;
00189     }
00190     s->stream.avail_in--;
00191     return *(s->stream.next_in)++;
00192 }
00193
00194 /* ===========================================================================
00195       Check the gzip header of a gz_stream opened for reading. Set the stream
00196     mode to transparent if the gzip magic header is not present; set s->err
00197     to Z_DATA_ERROR if the magic header is present but the rest of the header
00198     is incorrect.
00199     IN assertion: the stream s has already been created sucessfully;
00200        s->stream.avail_in is zero for the first time, but may be non-zero
00201        for concatenated .gz files.
00202 */
00203 local void check_header(s)
00204     gz_stream *s;
00205 {
00206     int method; /* method byte */
00207     int flags;  /* flags byte */
00208     uInt len;
00209     int c;
00210
00211     /* Check the gzip magic header */
00212     for (len = 0; len < 2; len++) {
00213     c = get_byte(s);
00214     if (c != gz_magic[len]) {
00215         s->transparent = 1;
00216         if (c != EOF) s->stream.avail_in++, s->stream.next_in--;
00217         s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END;
00218         return;
00219     }
00220     }
00221     method = get_byte(s);
00222     flags = get_byte(s);
00223     if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
00224     s->z_err = Z_DATA_ERROR;
00225     return;
00226     }
00227
00228     /* Discard time, xflags and OS code: */
00229     for (len = 0; len < 6; len++) (void)get_byte(s);
00230
00231     if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
00232     len  =  (uInt)get_byte(s);
00233     len += ((uInt)get_byte(s))<<8;
00234     /* len is garbage if EOF but the loop below will quit anyway */
00235     while (len-- != 0 && get_byte(s) != EOF) ;
00236     }
00237     if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
00238     while ((c = get_byte(s)) != 0 && c != EOF) ;
00239     }
00240     if ((flags & COMMENT) != 0) {   /* skip the .gz file comment */
00241     while ((c = get_byte(s)) != 0 && c != EOF) ;
00242     }
00243     if ((flags & HEAD_CRC) != 0) {  /* skip the header crc */
00244     for (len = 0; len < 2; len++) (void)get_byte(s);
00245     }
00246     s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
00247 }
00248
00249  /* ===========================================================================
00250  * Cleanup then free the given gz_stream. Return a zlib error code.
00251    Try freeing in the reverse order of allocations.
00252  */
00253 local int destroy (s)
00254     gz_stream *s;
00255 {
00256     int err = Z_OK;
00257
00258     if (!s) return Z_STREAM_ERROR;
00259
00260     TRYFREE(s->msg);
00261
00262     if (s->stream.state != NULL) {
00263        if (s->mode == 'w') {
00264            err = deflateEnd(&(s->stream));
00265        } else if (s->mode == 'r') {
00266            err = inflateEnd(&(s->stream));
00267        }
00268     }
00269     if (s->file != NULL && fclose(s->file)) {
00270         err = Z_ERRNO;
00271     }
00272     if (s->z_err < 0) err = s->z_err;
00273
00274     TRYFREE(s->inbuf);
00275     TRYFREE(s->outbuf);
00276     TRYFREE(s->path);
00277     TRYFREE(s);
00278     return err;
00279 }
00280
00281 /* ===========================================================================
00282      Reads the given number of uncompressed bytes from the compressed file.
00283    gzread returns the number of bytes actually read (0 for end of file).
00284 */
00285 int gzread (file, buf, len)
00286     gzFile file;
00287     voidp buf;
00288     unsigned len;
00289 {
00290     gz_stream *s = (gz_stream*)file;
00291     Bytef *start = buf; /* starting point for crc computation */
00292     Byte  *next_out; /* == stream.next_out but not forced far (for MSDOS) */
00293
00294     if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
00295
00296     if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
00297     if (s->z_err == Z_STREAM_END) return 0;  /* EOF */
00298
00299     s->stream.next_out = next_out = buf;
00300     s->stream.avail_out = len;
00301
00302     while (s->stream.avail_out != 0) {
00303
00304     if (s->transparent) {
00305         /* Copy first the lookahead bytes: */
00306         uInt n = s->stream.avail_in;
00307         if (n > s->stream.avail_out) n = s->stream.avail_out;
00308         if (n > 0) {
00309         zmemcpy(s->stream.next_out, s->stream.next_in, n);
00310         next_out += n;
00311         s->stream.next_out = next_out;
00312         s->stream.next_in   += n;
00313         s->stream.avail_out -= n;
00314         s->stream.avail_in  -= n;
00315         }
00316         if (s->stream.avail_out > 0) {
00317         s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out,
00318                          s->file);
00319         }
00320         return (int)(len - s->stream.avail_out);
00321     }
00322         if (s->stream.avail_in == 0 && !s->z_eof) {
00323
00324             errno = 0;
00325             s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
00326             if (s->stream.avail_in == 0) {
00327                 s->z_eof = 1;
00328         if (ferror(s->file)) {
00329             s->z_err = Z_ERRNO;
00330             break;
00331         }
00332             }
00333             s->stream.next_in = s->inbuf;
00334         }
00335         s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
00336
00337     if (s->z_err == Z_STREAM_END) {
00338         /* Check CRC and original size */
00339         s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
00340         start = s->stream.next_out;
00341
00342         if (getLong(s) != s->crc || getLong(s) != s->stream.total_out) {
00343         s->z_err = Z_DATA_ERROR;
00344         } else {
00345         /* Check for concatenated .gz files: */
00346         check_header(s);
00347         if (s->z_err == Z_OK) {
00348             inflateReset(&(s->stream));
00349             s->crc = crc32(0L, Z_NULL, 0);
00350         }
00351         }
00352     }
00353     if (s->z_err != Z_OK || s->z_eof) break;
00354     }
00355     s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
00356
00357     return (int)(len - s->stream.avail_out);
00358 }
00359
00360 /* ===========================================================================
00361      Writes the given number of uncompressed bytes into the compressed file.
00362    gzwrite returns the number of bytes actually written (0 in case of error).
00363 */
00364 int gzwrite (file, buf, len)
00365     gzFile file;
00366     const voidp buf;
00367     unsigned len;
00368 {
00369     gz_stream *s = (gz_stream*)file;
00370
00371     if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
00372
00373     s->stream.next_in = buf;
00374     s->stream.avail_in = len;
00375
00376     while (s->stream.avail_in != 0) {
00377
00378         if (s->stream.avail_out == 0) {
00379
00380             s->stream.next_out = s->outbuf;
00381             if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
00382                 s->z_err = Z_ERRNO;
00383                 break;
00384             }
00385             s->stream.avail_out = Z_BUFSIZE;
00386         }
00387         s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
00388         if (s->z_err != Z_OK) break;
00389     }
00390     s->crc = crc32(s->crc, buf, len);
00391
00392     return (int)(len - s->stream.avail_in);
00393 }
00394
00395 /* ===========================================================================
00396      Flushes all pending output into the compressed file. The parameter
00397    flush is as in the deflate() function.
00398      gzflush should be called only when strictly necessary because it can
00399    degrade compression.
00400 */
00401 int gzflush (file, flush)
00402     gzFile file;
00403     int flush;
00404 {
00405     uInt len;
00406     int done = 0;
00407     gz_stream *s = (gz_stream*)file;
00408
00409     if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
00410
00411     s->stream.avail_in = 0; /* should be zero already anyway */
00412
00413     for (;;) {
00414         len = Z_BUFSIZE - s->stream.avail_out;
00415
00416         if (len != 0) {
00417             if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
00418                 s->z_err = Z_ERRNO;
00419                 return Z_ERRNO;
00420             }
00421             s->stream.next_out = s->outbuf;
00422             s->stream.avail_out = Z_BUFSIZE;
00423         }
00424         if (done) break;
00425         s->z_err = deflate(&(s->stream), flush);
00426
00427         /* deflate has finished flushing only when it hasn't used up
00428          * all the available space in the output buffer:
00429          */
00430         done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
00431
00432         if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
00433     }
00434     fflush(s->file);
00435     return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
00436 }
00437
00438 /* ===========================================================================
00439    Outputs a long in LSB order to the given file
00440 */
00441 local void putLong (file, x)
00442     FILE *file;
00443     uLong x;
00444 {
00445     int n;
00446     for (n = 0; n < 4; n++) {
00447         fputc((int)(x & 0xff), file);
00448         x >>= 8;
00449     }
00450 }
00451
00452 /* ===========================================================================
00453    Reads a long in LSB order from the given gz_stream. Sets
00454 */
00455 local uLong getLong (s)
00456     gz_stream *s;
00457 {
00458     uLong x = (uLong)get_byte(s);
00459     int c;
00460
00461     x += ((uLong)get_byte(s))<<8;
00462     x += ((uLong)get_byte(s))<<16;
00463     c = get_byte(s);
00464     if (c == EOF) s->z_err = Z_DATA_ERROR;
00465     x += ((uLong)c)<<24;
00466     return x;
00467 }
00468
00469 /* ===========================================================================
00470      Flushes all pending output if necessary, closes the compressed file
00471    and deallocates all the (de)compression state.
00472 */
00473 int gzclose (file)
00474     gzFile file;
00475 {
00476     int err;
00477     gz_stream *s = (gz_stream*)file;
00478
00479     if (s == NULL) return Z_STREAM_ERROR;
00480
00481     if (s->mode == 'w') {
00482         err = gzflush (file, Z_FINISH);
00483         if (err != Z_OK) return destroy(file);
00484
00485         putLong (s->file, s->crc);
00486         putLong (s->file, s->stream.total_in);
00487
00488     }
00489     return destroy(file);
00490 }
00491
00492 /* ===========================================================================
00493      Returns the error message for the last error which occured on the
00494    given compressed file. errnum is set to zlib error number. If an
00495    error occured in the file system and not in the compression library,
00496    errnum is set to Z_ERRNO and the application may consult errno
00497    to get the exact error code.
00498 */
00499 const char*  gzerror (file, errnum)
00500     gzFile file;
00501     int *errnum;
00502 {
00503     char *m;
00504     gz_stream *s = (gz_stream*)file;
00505
00506     if (s == NULL) {
00507         *errnum = Z_STREAM_ERROR;
00508         return (const char*)ERR_MSG(Z_STREAM_ERROR);
00509     }
00510     *errnum = s->z_err;
00511     if (*errnum == Z_OK) return (const char*)"";
00512
00513     m =  (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
00514
00515     if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
00516
00517     TRYFREE(s->msg);
00518     s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
00519     strcpy(s->msg, s->path);
00520     strcat(s->msg, ": ");
00521     strcat(s->msg, m);
00522     return (const char*)s->msg;
00523 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/infblock.c Source File

cvs-1.10/zlib/infblock.c

Go to the documentation of this file.
00001 /* infblock.c -- interpret and process block types to last block
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 #include "zutil.h"
00007 #include "infblock.h"
00008 #include "inftrees.h"
00009 #include "infcodes.h"
00010 #include "infutil.h"
00011
00012 struct inflate_codes_state {int dummy;}; /* for buggy compilers */
00013
00014 /* Table for deflate from PKZIP's appnote.txt. */
00015 local uInt border[] = { /* Order of the bit length code lengths */
00016         16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
00017
00018 /*
00019    Notes beyond the 1.93a appnote.txt:
00020
00021    1. Distance pointers never point before the beginning of the output
00022       stream.
00023    2. Distance pointers can point back across blocks, up to 32k away.
00024    3. There is an implied maximum of 7 bits for the bit length table and
00025       15 bits for the actual data.
00026    4. If only one code exists, then it is encoded using one bit.  (Zero
00027       would be more efficient, but perhaps a little confusing.)  If two
00028       codes exist, they are coded using one bit each (0 and 1).
00029    5. There is no way of sending zero distance codes--a dummy must be
00030       sent if there are none.  (History: a pre 2.0 version of PKZIP would
00031       store blocks with no distance codes, but this was discovered to be
00032       too harsh a criterion.)  Valid only for 1.93a.  2.04c does allow
00033       zero distance codes, which is sent as one code of zero bits in
00034       length.
00035    6. There are up to 286 literal/length codes.  Code 256 represents the
00036       end-of-block.  Note however that the static length tree defines
00037       288 codes just to fill out the Huffman codes.  Codes 286 and 287
00038       cannot be used though, since there is no length base or extra bits
00039       defined for them.  Similarily, there are up to 30 distance codes.
00040       However, static trees define 32 codes (all 5 bits) to fill out the
00041       Huffman codes, but the last two had better not show up in the data.
00042    7. Unzip can check dynamic Huffman blocks for complete code sets.
00043       The exception is that a single code would not be complete (see #4).
00044    8. The five bits following the block type is really the number of
00045       literal codes sent minus 257.
00046    9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits
00047       (1+6+6).  Therefore, to output three times the length, you output
00048       three codes (1+1+1), whereas to output four times the same length,
00049       you only need two codes (1+3).  Hmm.
00050   10. In the tree reconstruction algorithm, Code = Code + Increment
00051       only if BitLength(i) is not zero.  (Pretty obvious.)
00052   11. Correction: 4 Bits: # of Bit Length codes - 4     (4 - 19)
00053   12. Note: length code 284 can represent 227-258, but length code 285
00054       really is 258.  The last length deserves its own, short code
00055       since it gets used a lot in very redundant files.  The length
00056       258 is special since 258 - 3 (the min match length) is 255.
00057   13. The literal/length and distance code bit lengths are read as a
00058       single stream of lengths.  It is possible (and advantageous) for
00059       a repeat code (16, 17, or 18) to go across the boundary between
00060       the two sets of lengths.
00061  */
00062
00063
00064 void inflate_blocks_reset(s, z, c)
00065 inflate_blocks_statef *s;
00066 z_streamp z;
00067 uLongf *c;
00068 {
00069   if (s->checkfn != Z_NULL)
00070     *c = s->check;
00071   if (s->mode == BTREE || s->mode == DTREE)
00072     ZFREE(z, s->sub.trees.blens);
00073   if (s->mode == CODES)
00074   {
00075     inflate_codes_free(s->sub.decode.codes, z);
00076     inflate_trees_free(s->sub.decode.td, z);
00077     inflate_trees_free(s->sub.decode.tl, z);
00078   }
00079   s->mode = TYPE;
00080   s->bitk = 0;
00081   s->bitb = 0;
00082   s->read = s->write = s->window;
00083   if (s->checkfn != Z_NULL)
00084     z->adler = s->check = (*s->checkfn)(0L, Z_NULL, 0);
00085   Trace((stderr, "inflate:   blocks reset\n"));
00086 }
00087
00088
00089 inflate_blocks_statef *inflate_blocks_new(z, c, w)
00090 z_streamp z;
00091 check_func c;
00092 uInt w;
00093 {
00094   inflate_blocks_statef *s;
00095
00096   if ((s = (inflate_blocks_statef *)ZALLOC
00097        (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)
00098     return s;
00099   if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)
00100   {
00101     ZFREE(z, s);
00102     return Z_NULL;
00103   }
00104   s->end = s->window + w;
00105   s->checkfn = c;
00106   s->mode = TYPE;
00107   Trace((stderr, "inflate:   blocks allocated\n"));
00108   inflate_blocks_reset(s, z, &s->check);
00109   return s;
00110 }
00111
00112
00113 #ifdef DEBUG
00114   extern uInt inflate_hufts;
00115 #endif
00116 int inflate_blocks(s, z, r)
00117 inflate_blocks_statef *s;
00118 z_streamp z;
00119 int r;
00120 {
00121   uInt t;               /* temporary storage */
00122   uLong b;              /* bit buffer */
00123   uInt k;               /* bits in bit buffer */
00124   Bytef *p;             /* input data pointer */
00125   uInt n;               /* bytes available there */
00126   Bytef *q;             /* output window write pointer */
00127   uInt m;               /* bytes to end of window or read pointer */
00128
00129   /* copy input/output information to locals (UPDATE macro restores) */
00130   LOAD
00131
00132   /* process input based on current state */
00133   while (1) switch (s->mode)
00134   {
00135     case TYPE:
00136       NEEDBITS(3)
00137       t = (uInt)b & 7;
00138       s->last = t & 1;
00139       switch (t >> 1)
00140       {
00141         case 0:                         /* stored */
00142           Trace((stderr, "inflate:     stored block%s\n",
00143                  s->last ? " (last)" : ""));
00144           DUMPBITS(3)
00145           t = k & 7;                    /* go to byte boundary */
00146           DUMPBITS(t)
00147           s->mode = LENS;               /* get length of stored block */
00148           break;
00149         case 1:                         /* fixed */
00150           Trace((stderr, "inflate:     fixed codes block%s\n",
00151                  s->last ? " (last)" : ""));
00152           {
00153             uInt bl, bd;
00154             inflate_huft *tl, *td;
00155
00156             inflate_trees_fixed(&bl, &bd, &tl, &td);
00157             s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z);
00158             if (s->sub.decode.codes == Z_NULL)
00159             {
00160               r = Z_MEM_ERROR;
00161               LEAVE
00162             }
00163             s->sub.decode.tl = Z_NULL;  /* don't try to free these */
00164             s->sub.decode.td = Z_NULL;
00165           }
00166           DUMPBITS(3)
00167           s->mode = CODES;
00168           break;
00169         case 2:                         /* dynamic */
00170           Trace((stderr, "inflate:     dynamic codes block%s\n",
00171                  s->last ? " (last)" : ""));
00172           DUMPBITS(3)
00173           s->mode = TABLE;
00174           break;
00175         case 3:                         /* illegal */
00176           DUMPBITS(3)
00177           s->mode = BAD;
00178           z->msg = (char*)"invalid block type";
00179           r = Z_DATA_ERROR;
00180           LEAVE
00181       }
00182       break;
00183     case LENS:
00184       NEEDBITS(32)
00185       if ((((~b) >> 16) & 0xffff) != (b & 0xffff))
00186       {
00187         s->mode = BAD;
00188         z->msg = (char*)"invalid stored block lengths";
00189         r = Z_DATA_ERROR;
00190         LEAVE
00191       }
00192       s->sub.left = (uInt)b & 0xffff;
00193       b = k = 0;                      /* dump bits */
00194       Tracev((stderr, "inflate:       stored length %u\n", s->sub.left));
00195       s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE);
00196       break;
00197     case STORED:
00198       if (n == 0)
00199         LEAVE
00200       NEEDOUT
00201       t = s->sub.left;
00202       if (t > n) t = n;
00203       if (t > m) t = m;
00204       zmemcpy(q, p, t);
00205       p += t;  n -= t;
00206       q += t;  m -= t;
00207       if ((s->sub.left -= t) != 0)
00208         break;
00209       Tracev((stderr, "inflate:       stored end, %lu total out\n",
00210               z->total_out + (q >= s->read ? q - s->read :
00211               (s->end - s->read) + (q - s->window))));
00212       s->mode = s->last ? DRY : TYPE;
00213       break;
00214     case TABLE:
00215       NEEDBITS(14)
00216       s->sub.trees.table = t = (uInt)b & 0x3fff;
00217 #ifndef PKZIP_BUG_WORKAROUND
00218       if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)
00219       {
00220         s->mode = BAD;
00221         z->msg = (char*)"too many length or distance symbols";
00222         r = Z_DATA_ERROR;
00223         LEAVE
00224       }
00225 #endif
00226       t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
00227       if (t < 19)
00228         t = 19;
00229       if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL)
00230       {
00231         r = Z_MEM_ERROR;
00232         LEAVE
00233       }
00234       DUMPBITS(14)
00235       s->sub.trees.index = 0;
00236       Tracev((stderr, "inflate:       table sizes ok\n"));
00237       s->mode = BTREE;
00238     case BTREE:
00239       while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
00240       {
00241         NEEDBITS(3)
00242         s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7;
00243         DUMPBITS(3)
00244       }
00245       while (s->sub.trees.index < 19)
00246         s->sub.trees.blens[border[s->sub.trees.index++]] = 0;
00247       s->sub.trees.bb = 7;
00248       t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb,
00249                              &s->sub.trees.tb, z);
00250       if (t != Z_OK)
00251       {
00252         r = t;
00253         if (r == Z_DATA_ERROR)
00254           s->mode = BAD;
00255         LEAVE
00256       }
00257       s->sub.trees.index = 0;
00258       Tracev((stderr, "inflate:       bits tree ok\n"));
00259       s->mode = DTREE;
00260     case DTREE:
00261       while (t = s->sub.trees.table,
00262              s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
00263       {
00264         inflate_huft *h;
00265         uInt i, j, c;
00266
00267         t = s->sub.trees.bb;
00268         NEEDBITS(t)
00269         h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]);
00270         t = h->word.what.Bits;
00271         c = h->more.Base;
00272         if (c < 16)
00273         {
00274           DUMPBITS(t)
00275           s->sub.trees.blens[s->sub.trees.index++] = c;
00276         }
00277         else /* c == 16..18 */
00278         {
00279           i = c == 18 ? 7 : c - 14;
00280           j = c == 18 ? 11 : 3;
00281           NEEDBITS(t + i)
00282           DUMPBITS(t)
00283           j += (uInt)b & inflate_mask[i];
00284           DUMPBITS(i)
00285           i = s->sub.trees.index;
00286           t = s->sub.trees.table;
00287           if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||
00288               (c == 16 && i < 1))
00289           {
00290             s->mode = BAD;
00291             z->msg = (char*)"invalid bit length repeat";
00292             r = Z_DATA_ERROR;
00293             LEAVE
00294           }
00295           c = c == 16 ? s->sub.trees.blens[i - 1] : 0;
00296           do {
00297             s->sub.trees.blens[i++] = c;
00298           } while (--j);
00299           s->sub.trees.index = i;
00300         }
00301       }
00302       inflate_trees_free(s->sub.trees.tb, z);
00303       s->sub.trees.tb = Z_NULL;
00304       {
00305         uInt bl, bd;
00306         inflate_huft *tl, *td;
00307         inflate_codes_statef *c;
00308
00309         bl = 9;         /* must be <= 9 for lookahead assumptions */
00310         bd = 6;         /* must be <= 9 for lookahead assumptions */
00311         t = s->sub.trees.table;
00312 #ifdef DEBUG
00313       inflate_hufts = 0;
00314 #endif
00315         t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
00316                                   s->sub.trees.blens, &bl, &bd, &tl, &td, z);
00317         if (t != Z_OK)
00318         {
00319           if (t == (uInt)Z_DATA_ERROR)
00320             s->mode = BAD;
00321           r = t;
00322           LEAVE
00323         }
00324         Tracev((stderr, "inflate:       trees ok, %d * %d bytes used\n",
00325               inflate_hufts, sizeof(inflate_huft)));
00326         if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)
00327         {
00328           inflate_trees_free(td, z);
00329           inflate_trees_free(tl, z);
00330           r = Z_MEM_ERROR;
00331           LEAVE
00332         }
00333         ZFREE(z, s->sub.trees.blens);
00334         s->sub.decode.codes = c;
00335         s->sub.decode.tl = tl;
00336         s->sub.decode.td = td;
00337       }
00338       s->mode = CODES;
00339     case CODES:
00340       UPDATE
00341       if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
00342         return inflate_flush(s, z, r);
00343       r = Z_OK;
00344       inflate_codes_free(s->sub.decode.codes, z);
00345       inflate_trees_free(s->sub.decode.td, z);
00346       inflate_trees_free(s->sub.decode.tl, z);
00347       LOAD
00348       Tracev((stderr, "inflate:       codes end, %lu total out\n",
00349               z->total_out + (q >= s->read ? q - s->read :
00350               (s->end - s->read) + (q - s->window))));
00351       if (!s->last)
00352       {
00353         s->mode = TYPE;
00354         break;
00355       }
00356       if (k > 7)              /* return unused byte, if any */
00357       {
00358         Assert(k < 16, "inflate_codes grabbed too many bytes")
00359         k -= 8;
00360         n++;
00361         p--;                    /* can always return one */
00362       }
00363       s->mode = DRY;
00364     case DRY:
00365       FLUSH
00366       if (s->read != s->write)
00367         LEAVE
00368       s->mode = DONE;
00369     case DONE:
00370       r = Z_STREAM_END;
00371       LEAVE
00372     case BAD:
00373       r = Z_DATA_ERROR;
00374       LEAVE
00375     default:
00376       r = Z_STREAM_ERROR;
00377       LEAVE
00378   }
00379 }
00380
00381
00382 int inflate_blocks_free(s, z, c)
00383 inflate_blocks_statef *s;
00384 z_streamp z;
00385 uLongf *c;
00386 {
00387   inflate_blocks_reset(s, z, c);
00388   ZFREE(z, s->window);
00389   ZFREE(z, s);
00390   Trace((stderr, "inflate:   blocks freed\n"));
00391   return Z_OK;
00392 }
00393
00394
00395 void inflate_set_dictionary(s, d, n)
00396 inflate_blocks_statef *s;
00397 const Bytef *d;
00398 uInt  n;
00399 {
00400   zmemcpy((charf *)s->window, d, n);
00401   s->read = s->write = s->window + n;
00402 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/infblock.h Source File

cvs-1.10/zlib/infblock.h

Go to the documentation of this file.
00001 /* infblock.h -- header to use infblock.c
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* WARNING: this file should *not* be used by applications. It is
00007    part of the implementation of the compression library and is
00008    subject to change. Applications should only use zlib.h.
00009  */
00010
00011 struct inflate_blocks_state;
00012 typedef struct inflate_blocks_state FAR inflate_blocks_statef;
00013
00014 extern inflate_blocks_statef * inflate_blocks_new OF((
00015     z_streamp z,
00016     check_func c,               /* check function */
00017     uInt w));                   /* window size */
00018
00019 extern int inflate_blocks OF((
00020     inflate_blocks_statef *,
00021     z_streamp ,
00022     int));                      /* initial return code */
00023
00024 extern void inflate_blocks_reset OF((
00025     inflate_blocks_statef *,
00026     z_streamp ,
00027     uLongf *));                  /* check value on output */
00028
00029 extern int inflate_blocks_free OF((
00030     inflate_blocks_statef *,
00031     z_streamp ,
00032     uLongf *));                  /* check value on output */
00033
00034 extern void inflate_set_dictionary OF((
00035     inflate_blocks_statef *s,
00036     const Bytef *d,  /* dictionary */
00037     uInt  n));       /* dictionary length */
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/infcodes.c Source File

cvs-1.10/zlib/infcodes.c

Go to the documentation of this file.
00001 /* infcodes.c -- process literals and length/distance pairs
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 #include "zutil.h"
00007 #include "inftrees.h"
00008 #include "infblock.h"
00009 #include "infcodes.h"
00010 #include "infutil.h"
00011 #include "inffast.h"
00012
00013 /* simplify the use of the inflate_huft type with some defines */
00014 #define base more.Base
00015 #define next more.Next
00016 #define exop word.what.Exop
00017 #define bits word.what.Bits
00018
00019 /* inflate codes private state */
00020 struct inflate_codes_state {
00021
00022   /* mode */
00023   enum {        /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
00024       START,    /* x: set up for LEN */
00025       LEN,      /* i: get length/literal/eob next */
00026       LENEXT,   /* i: getting length extra (have base) */
00027       DIST,     /* i: get distance next */
00028       DISTEXT,  /* i: getting distance extra */
00029       COPY,     /* o: copying bytes in window, waiting for space */
00030       LIT,      /* o: got literal, waiting for output space */
00031       WASH,     /* o: got eob, possibly still output waiting */
00032       END,      /* x: got eob and all data flushed */
00033       BADCODE}  /* x: got error */
00034     mode;               /* current inflate_codes mode */
00035
00036   /* mode dependent information */
00037   uInt len;
00038   union {
00039     struct {
00040       inflate_huft *tree;       /* pointer into tree */
00041       uInt need;                /* bits needed */
00042     } code;             /* if LEN or DIST, where in tree */
00043     uInt lit;           /* if LIT, literal */
00044     struct {
00045       uInt get;                 /* bits to get for extra */
00046       uInt dist;                /* distance back to copy from */
00047     } copy;             /* if EXT or COPY, where and how much */
00048   } sub;                /* submode */
00049
00050   /* mode independent information */
00051   Byte lbits;           /* ltree bits decoded per branch */
00052   Byte dbits;           /* dtree bits decoder per branch */
00053   inflate_huft *ltree;          /* literal/length/eob tree */
00054   inflate_huft *dtree;          /* distance tree */
00055
00056 };
00057
00058
00059 inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
00060 uInt bl, bd;
00061 inflate_huft *tl;
00062 inflate_huft *td; /* need separate declaration for Borland C++ */
00063 z_streamp z;
00064 {
00065   inflate_codes_statef *c;
00066
00067   if ((c = (inflate_codes_statef *)
00068        ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL)
00069   {
00070     c->mode = START;
00071     c->lbits = (Byte)bl;
00072     c->dbits = (Byte)bd;
00073     c->ltree = tl;
00074     c->dtree = td;
00075     Tracev((stderr, "inflate:       codes new\n"));
00076   }
00077   return c;
00078 }
00079
00080
00081 int inflate_codes(s, z, r)
00082 inflate_blocks_statef *s;
00083 z_streamp z;
00084 int r;
00085 {
00086   uInt j;               /* temporary storage */
00087   inflate_huft *t;      /* temporary pointer */
00088   uInt e;               /* extra bits or operation */
00089   uLong b;              /* bit buffer */
00090   uInt k;               /* bits in bit buffer */
00091   Bytef *p;             /* input data pointer */
00092   uInt n;               /* bytes available there */
00093   Bytef *q;             /* output window write pointer */
00094   uInt m;               /* bytes to end of window or read pointer */
00095   Bytef *f;             /* pointer to copy strings from */
00096   inflate_codes_statef *c = s->sub.decode.codes;  /* codes state */
00097
00098   /* copy input/output information to locals (UPDATE macro restores) */
00099   LOAD
00100
00101   /* process input and output based on current state */
00102   while (1) switch (c->mode)
00103   {             /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
00104     case START:         /* x: set up for LEN */
00105 #ifndef SLOW
00106       if (m >= 258 && n >= 10)
00107       {
00108         UPDATE
00109         r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z);
00110         LOAD
00111         if (r != Z_OK)
00112         {
00113           c->mode = r == Z_STREAM_END ? WASH : BADCODE;
00114           break;
00115         }
00116       }
00117 #endif /* !SLOW */
00118       c->sub.code.need = c->lbits;
00119       c->sub.code.tree = c->ltree;
00120       c->mode = LEN;
00121     case LEN:           /* i: get length/literal/eob next */
00122       j = c->sub.code.need;
00123       NEEDBITS(j)
00124       t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
00125       DUMPBITS(t->bits)
00126       e = (uInt)(t->exop);
00127       if (e == 0)               /* literal */
00128       {
00129         c->sub.lit = t->base;
00130         Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
00131                  "inflate:         literal '%c'\n" :
00132                  "inflate:         literal 0x%02x\n", t->base));
00133         c->mode = LIT;
00134         break;
00135       }
00136       if (e & 16)               /* length */
00137       {
00138         c->sub.copy.get = e & 15;
00139         c->len = t->base;
00140         c->mode = LENEXT;
00141         break;
00142       }
00143       if ((e & 64) == 0)        /* next table */
00144       {
00145         c->sub.code.need = e;
00146         c->sub.code.tree = t->next;
00147         break;
00148       }
00149       if (e & 32)               /* end of block */
00150       {
00151         Tracevv((stderr, "inflate:         end of block\n"));
00152         c->mode = WASH;
00153         break;
00154       }
00155       c->mode = BADCODE;        /* invalid code */
00156       z->msg = (char*)"invalid literal/length code";
00157       r = Z_DATA_ERROR;
00158       LEAVE
00159     case LENEXT:        /* i: getting length extra (have base) */
00160       j = c->sub.copy.get;
00161       NEEDBITS(j)
00162       c->len += (uInt)b & inflate_mask[j];
00163       DUMPBITS(j)
00164       c->sub.code.need = c->dbits;
00165       c->sub.code.tree = c->dtree;
00166       Tracevv((stderr, "inflate:         length %u\n", c->len));
00167       c->mode = DIST;
00168     case DIST:          /* i: get distance next */
00169       j = c->sub.code.need;
00170       NEEDBITS(j)
00171       t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
00172       DUMPBITS(t->bits)
00173       e = (uInt)(t->exop);
00174       if (e & 16)               /* distance */
00175       {
00176         c->sub.copy.get = e & 15;
00177         c->sub.copy.dist = t->base;
00178         c->mode = DISTEXT;
00179         break;
00180       }
00181       if ((e & 64) == 0)        /* next table */
00182       {
00183         c->sub.code.need = e;
00184         c->sub.code.tree = t->next;
00185         break;
00186       }
00187       c->mode = BADCODE;        /* invalid code */
00188       z->msg = (char*)"invalid distance code";
00189       r = Z_DATA_ERROR;
00190       LEAVE
00191     case DISTEXT:       /* i: getting distance extra */
00192       j = c->sub.copy.get;
00193       NEEDBITS(j)
00194       c->sub.copy.dist += (uInt)b & inflate_mask[j];
00195       DUMPBITS(j)
00196       Tracevv((stderr, "inflate:         distance %u\n", c->sub.copy.dist));
00197       c->mode = COPY;
00198     case COPY:          /* o: copying bytes in window, waiting for space */
00199 #ifndef __TURBOC__ /* Turbo C bug for following expression */
00200       f = (uInt)(q - s->window) < c->sub.copy.dist ?
00201           s->end - (c->sub.copy.dist - (q - s->window)) :
00202           q - c->sub.copy.dist;
00203 #else
00204       f = q - c->sub.copy.dist;
00205       if ((uInt)(q - s->window) < c->sub.copy.dist)
00206         f = s->end - (c->sub.copy.dist - (uInt)(q - s->window));
00207 #endif
00208       while (c->len)
00209       {
00210         NEEDOUT
00211         OUTBYTE(*f++)
00212         if (f == s->end)
00213           f = s->window;
00214         c->len--;
00215       }
00216       c->mode = START;
00217       break;
00218     case LIT:           /* o: got literal, waiting for output space */
00219       NEEDOUT
00220       OUTBYTE(c->sub.lit)
00221       c->mode = START;
00222       break;
00223     case WASH:          /* o: got eob, possibly more output */
00224       FLUSH
00225       if (s->read != s->write)
00226         LEAVE
00227       c->mode = END;
00228     case END:
00229       r = Z_STREAM_END;
00230       LEAVE
00231     case BADCODE:       /* x: got error */
00232       r = Z_DATA_ERROR;
00233       LEAVE
00234     default:
00235       r = Z_STREAM_ERROR;
00236       LEAVE
00237   }
00238 }
00239
00240
00241 void inflate_codes_free(c, z)
00242 inflate_codes_statef *c;
00243 z_streamp z;
00244 {
00245   ZFREE(z, c);
00246   Tracev((stderr, "inflate:       codes free\n"));
00247 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/infcodes.h Source File

cvs-1.10/zlib/infcodes.h

Go to the documentation of this file.
00001 /* infcodes.h -- header to use infcodes.c
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* WARNING: this file should *not* be used by applications. It is
00007    part of the implementation of the compression library and is
00008    subject to change. Applications should only use zlib.h.
00009  */
00010
00011 struct inflate_codes_state;
00012 typedef struct inflate_codes_state FAR inflate_codes_statef;
00013
00014 extern inflate_codes_statef *inflate_codes_new OF((
00015     uInt, uInt,
00016     inflate_huft *, inflate_huft *,
00017     z_streamp ));
00018
00019 extern int inflate_codes OF((
00020     inflate_blocks_statef *,
00021     z_streamp ,
00022     int));
00023
00024 extern void inflate_codes_free OF((
00025     inflate_codes_statef *,
00026     z_streamp ));
00027
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/inffast.c Source File

cvs-1.10/zlib/inffast.c

Go to the documentation of this file.
00001 /* inffast.c -- process literals and length/distance pairs fast
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 #include "zutil.h"
00007 #include "inftrees.h"
00008 #include "infblock.h"
00009 #include "infcodes.h"
00010 #include "infutil.h"
00011 #include "inffast.h"
00012
00013 struct inflate_codes_state {int dummy;}; /* for buggy compilers */
00014
00015 /* simplify the use of the inflate_huft type with some defines */
00016 #define base more.Base
00017 #define next more.Next
00018 #define exop word.what.Exop
00019 #define bits word.what.Bits
00020
00021 /* macros for bit input with no checking and for returning unused bytes */
00022 #define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}}
00023 #define UNGRAB {n+=(c=k>>3);p-=c;k&=7;}
00024
00025 /* Called with number of bytes left to write in window at least 258
00026    (the maximum string length) and number of input bytes available
00027    at least ten.  The ten bytes are six bytes for the longest length/
00028    distance pair plus four bytes for overloading the bit buffer. */
00029
00030 int inflate_fast(bl, bd, tl, td, s, z)
00031 uInt bl, bd;
00032 inflate_huft *tl;
00033 inflate_huft *td; /* need separate declaration for Borland C++ */
00034 inflate_blocks_statef *s;
00035 z_streamp z;
00036 {
00037   inflate_huft *t;      /* temporary pointer */
00038   uInt e;               /* extra bits or operation */
00039   uLong b;              /* bit buffer */
00040   uInt k;               /* bits in bit buffer */
00041   Bytef *p;             /* input data pointer */
00042   uInt n;               /* bytes available there */
00043   Bytef *q;             /* output window write pointer */
00044   uInt m;               /* bytes to end of window or read pointer */
00045   uInt ml;              /* mask for literal/length tree */
00046   uInt md;              /* mask for distance tree */
00047   uInt c;               /* bytes to copy */
00048   uInt d;               /* distance back to copy from */
00049   Bytef *r;             /* copy source pointer */
00050
00051   /* load input, output, bit values */
00052   LOAD
00053
00054   /* initialize masks */
00055   ml = inflate_mask[bl];
00056   md = inflate_mask[bd];
00057
00058   /* do until not enough input or output space for fast loop */
00059   do {                          /* assume called with m >= 258 && n >= 10 */
00060     /* get literal/length code */
00061     GRABBITS(20)                /* max bits for literal/length code */
00062     if ((e = (t = tl + ((uInt)b & ml))->exop) == 0)
00063     {
00064       DUMPBITS(t->bits)
00065       Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
00066                 "inflate:         * literal '%c'\n" :
00067                 "inflate:         * literal 0x%02x\n", t->base));
00068       *q++ = (Byte)t->base;
00069       m--;
00070       continue;
00071     }
00072     do {
00073       DUMPBITS(t->bits)
00074       if (e & 16)
00075       {
00076         /* get extra bits for length */
00077         e &= 15;
00078         c = t->base + ((uInt)b & inflate_mask[e]);
00079         DUMPBITS(e)
00080         Tracevv((stderr, "inflate:         * length %u\n", c));
00081
00082         /* decode distance base of block to copy */
00083         GRABBITS(15);           /* max bits for distance code */
00084         e = (t = td + ((uInt)b & md))->exop;
00085         do {
00086           DUMPBITS(t->bits)
00087           if (e & 16)
00088           {
00089             /* get extra bits to add to distance base */
00090             e &= 15;
00091             GRABBITS(e)         /* get extra bits (up to 13) */
00092             d = t->base + ((uInt)b & inflate_mask[e]);
00093             DUMPBITS(e)
00094             Tracevv((stderr, "inflate:         * distance %u\n", d));
00095
00096             /* do the copy */
00097             m -= c;
00098             if ((uInt)(q - s->window) >= d)     /* offset before dest */
00099             {                                   /*  just copy */
00100               r = q - d;
00101               *q++ = *r++;  c--;        /* minimum count is three, */
00102               *q++ = *r++;  c--;        /*  so unroll loop a little */
00103             }
00104             else                        /* else offset after destination */
00105             {
00106               e = d - (uInt)(q - s->window); /* bytes from offset to end */
00107               r = s->end - e;           /* pointer to offset */
00108               if (c > e)                /* if source crosses, */
00109               {
00110                 c -= e;                 /* copy to end of window */
00111                 do {
00112                   *q++ = *r++;
00113                 } while (--e);
00114                 r = s->window;          /* copy rest from start of window */
00115               }
00116             }
00117             do {                        /* copy all or what's left */
00118               *q++ = *r++;
00119             } while (--c);
00120             break;
00121           }
00122           else if ((e & 64) == 0)
00123             e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop;
00124           else
00125           {
00126             z->msg = (char*)"invalid distance code";
00127             UNGRAB
00128             UPDATE
00129             return Z_DATA_ERROR;
00130           }
00131         } while (1);
00132         break;
00133       }
00134       if ((e & 64) == 0)
00135       {
00136         if ((e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop) == 0)
00137         {
00138           DUMPBITS(t->bits)
00139           Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
00140                     "inflate:         * literal '%c'\n" :
00141                     "inflate:         * literal 0x%02x\n", t->base));
00142           *q++ = (Byte)t->base;
00143           m--;
00144           break;
00145         }
00146       }
00147       else if (e & 32)
00148       {
00149         Tracevv((stderr, "inflate:         * end of block\n"));
00150         UNGRAB
00151         UPDATE
00152         return Z_STREAM_END;
00153       }
00154       else
00155       {
00156         z->msg = (char*)"invalid literal/length code";
00157         UNGRAB
00158         UPDATE
00159         return Z_DATA_ERROR;
00160       }
00161     } while (1);
00162   } while (m >= 258 && n >= 10);
00163
00164   /* not enough input or output--restore pointers and return */
00165   UNGRAB
00166   UPDATE
00167   return Z_OK;
00168 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/inffast.h Source File

cvs-1.10/zlib/inffast.h

Go to the documentation of this file.
00001 /* inffast.h -- header to use inffast.c
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* WARNING: this file should *not* be used by applications. It is
00007    part of the implementation of the compression library and is
00008    subject to change. Applications should only use zlib.h.
00009  */
00010
00011 extern int inflate_fast OF((
00012     uInt,
00013     uInt,
00014     inflate_huft *,
00015     inflate_huft *,
00016     inflate_blocks_statef *,
00017     z_streamp ));
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/inflate.c Source File

cvs-1.10/zlib/inflate.c

Go to the documentation of this file.
00001 /* inflate.c -- zlib interface to inflate modules
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 #include "zutil.h"
00007 #include "infblock.h"
00008
00009 struct inflate_blocks_state {int dummy;}; /* for buggy compilers */
00010
00011 /* inflate private state */
00012 struct internal_state {
00013
00014   /* mode */
00015   enum {
00016       METHOD,   /* waiting for method byte */
00017       FLAG,     /* waiting for flag byte */
00018       DICT4,    /* four dictionary check bytes to go */
00019       DICT3,    /* three dictionary check bytes to go */
00020       DICT2,    /* two dictionary check bytes to go */
00021       DICT1,    /* one dictionary check byte to go */
00022       DICT0,    /* waiting for inflateSetDictionary */
00023       BLOCKS,   /* decompressing blocks */
00024       CHECK4,   /* four check bytes to go */
00025       CHECK3,   /* three check bytes to go */
00026       CHECK2,   /* two check bytes to go */
00027       CHECK1,   /* one check byte to go */
00028       DONE,     /* finished check, done */
00029       BAD}      /* got an error--stay here */
00030     mode;               /* current inflate mode */
00031
00032   /* mode dependent information */
00033   union {
00034     uInt method;        /* if FLAGS, method byte */
00035     struct {
00036       uLong was;                /* computed check value */
00037       uLong need;               /* stream check value */
00038     } check;            /* if CHECK, check values to compare */
00039     uInt marker;        /* if BAD, inflateSync's marker bytes count */
00040   } sub;        /* submode */
00041
00042   /* mode independent information */
00043   int  nowrap;          /* flag for no wrapper */
00044   uInt wbits;           /* log2(window size)  (8..15, defaults to 15) */
00045   inflate_blocks_statef
00046     *blocks;            /* current inflate_blocks state */
00047
00048 };
00049
00050
00051 int inflateReset(z)
00052 z_streamp z;
00053 {
00054   uLong c;
00055
00056   if (z == Z_NULL || z->state == Z_NULL)
00057     return Z_STREAM_ERROR;
00058   z->total_in = z->total_out = 0;
00059   z->msg = Z_NULL;
00060   z->state->mode = z->state->nowrap ? BLOCKS : METHOD;
00061   inflate_blocks_reset(z->state->blocks, z, &c);
00062   Trace((stderr, "inflate: reset\n"));
00063   return Z_OK;
00064 }
00065
00066
00067 int inflateEnd(z)
00068 z_streamp z;
00069 {
00070   uLong c;
00071
00072   if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
00073     return Z_STREAM_ERROR;
00074   if (z->state->blocks != Z_NULL)
00075     inflate_blocks_free(z->state->blocks, z, &c);
00076   ZFREE(z, z->state);
00077   z->state = Z_NULL;
00078   Trace((stderr, "inflate: end\n"));
00079   return Z_OK;
00080 }
00081
00082
00083 int inflateInit2_(z, w, version, stream_size)
00084 z_streamp z;
00085 int w;
00086 const char *version;
00087 int stream_size;
00088 {
00089   if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
00090       stream_size != sizeof(z_stream))
00091       return Z_VERSION_ERROR;
00092
00093   /* initialize state */
00094   if (z == Z_NULL)
00095     return Z_STREAM_ERROR;
00096   z->msg = Z_NULL;
00097   if (z->zalloc == Z_NULL)
00098   {
00099     z->zalloc = zcalloc;
00100     z->opaque = (voidpf)0;
00101   }
00102   if (z->zfree == Z_NULL) z->zfree = zcfree;
00103   if ((z->state = (struct internal_state FAR *)
00104        ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL)
00105     return Z_MEM_ERROR;
00106   z->state->blocks = Z_NULL;
00107
00108   /* handle undocumented nowrap option (no zlib header or check) */
00109   z->state->nowrap = 0;
00110   if (w < 0)
00111   {
00112     w = - w;
00113     z->state->nowrap = 1;
00114   }
00115
00116   /* set window size */
00117   if (w < 8 || w > 15)
00118   {
00119     inflateEnd(z);
00120     return Z_STREAM_ERROR;
00121   }
00122   z->state->wbits = (uInt)w;
00123
00124   /* create inflate_blocks state */
00125   if ((z->state->blocks =
00126       inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w))
00127       == Z_NULL)
00128   {
00129     inflateEnd(z);
00130     return Z_MEM_ERROR;
00131   }
00132   Trace((stderr, "inflate: allocated\n"));
00133
00134   /* reset state */
00135   inflateReset(z);
00136   return Z_OK;
00137 }
00138
00139
00140 int inflateInit_(z, version, stream_size)
00141 z_streamp z;
00142 const char *version;
00143 int stream_size;
00144 {
00145   return inflateInit2_(z, DEF_WBITS, version, stream_size);
00146 }
00147
00148
00149 #define NEEDBYTE {if(z->avail_in==0)return r;r=Z_OK;}
00150 #define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
00151
00152 int inflate(z, f)
00153 z_streamp z;
00154 int f;
00155 {
00156   int r;
00157   uInt b;
00158
00159   if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL || f < 0)
00160     return Z_STREAM_ERROR;
00161   r = Z_BUF_ERROR;
00162   while (1) switch (z->state->mode)
00163   {
00164     case METHOD:
00165       NEEDBYTE
00166       if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED)
00167       {
00168         z->state->mode = BAD;
00169         z->msg = (char*)"unknown compression method";
00170         z->state->sub.marker = 5;       /* can't try inflateSync */
00171         break;
00172       }
00173       if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
00174       {
00175         z->state->mode = BAD;
00176         z->msg = (char*)"invalid window size";
00177         z->state->sub.marker = 5;       /* can't try inflateSync */
00178         break;
00179       }
00180       z->state->mode = FLAG;
00181     case FLAG:
00182       NEEDBYTE
00183       b = NEXTBYTE;
00184       if (((z->state->sub.method << 8) + b) % 31)
00185       {
00186         z->state->mode = BAD;
00187         z->msg = (char*)"incorrect header check";
00188         z->state->sub.marker = 5;       /* can't try inflateSync */
00189         break;
00190       }
00191       Trace((stderr, "inflate: zlib header ok\n"));
00192       if (!(b & PRESET_DICT))
00193       {
00194         z->state->mode = BLOCKS;
00195     break;
00196       }
00197       z->state->mode = DICT4;
00198     case DICT4:
00199       NEEDBYTE
00200       z->state->sub.check.need = (uLong)NEXTBYTE << 24;
00201       z->state->mode = DICT3;
00202     case DICT3:
00203       NEEDBYTE
00204       z->state->sub.check.need += (uLong)NEXTBYTE << 16;
00205       z->state->mode = DICT2;
00206     case DICT2:
00207       NEEDBYTE
00208       z->state->sub.check.need += (uLong)NEXTBYTE << 8;
00209       z->state->mode = DICT1;
00210     case DICT1:
00211       NEEDBYTE
00212       z->state->sub.check.need += (uLong)NEXTBYTE;
00213       z->adler = z->state->sub.check.need;
00214       z->state->mode = DICT0;
00215       return Z_NEED_DICT;
00216     case DICT0:
00217       z->state->mode = BAD;
00218       z->msg = (char*)"need dictionary";
00219       z->state->sub.marker = 0;       /* can try inflateSync */
00220       return Z_STREAM_ERROR;
00221     case BLOCKS:
00222       r = inflate_blocks(z->state->blocks, z, r);
00223       if (r == Z_DATA_ERROR)
00224       {
00225         z->state->mode = BAD;
00226         z->state->sub.marker = 0;       /* can try inflateSync */
00227         break;
00228       }
00229       if (r != Z_STREAM_END)
00230         return r;
00231       r = Z_OK;
00232       inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was);
00233       if (z->state->nowrap)
00234       {
00235         z->state->mode = DONE;
00236         break;
00237       }
00238       z->state->mode = CHECK4;
00239     case CHECK4:
00240       NEEDBYTE
00241       z->state->sub.check.need = (uLong)NEXTBYTE << 24;
00242       z->state->mode = CHECK3;
00243     case CHECK3:
00244       NEEDBYTE
00245       z->state->sub.check.need += (uLong)NEXTBYTE << 16;
00246       z->state->mode = CHECK2;
00247     case CHECK2:
00248       NEEDBYTE
00249       z->state->sub.check.need += (uLong)NEXTBYTE << 8;
00250       z->state->mode = CHECK1;
00251     case CHECK1:
00252       NEEDBYTE
00253       z->state->sub.check.need += (uLong)NEXTBYTE;
00254
00255       if (z->state->sub.check.was != z->state->sub.check.need)
00256       {
00257         z->state->mode = BAD;
00258         z->msg = (char*)"incorrect data check";
00259         z->state->sub.marker = 5;       /* can't try inflateSync */
00260         break;
00261       }
00262       Trace((stderr, "inflate: zlib check ok\n"));
00263       z->state->mode = DONE;
00264     case DONE:
00265       return Z_STREAM_END;
00266     case BAD:
00267       return Z_DATA_ERROR;
00268     default:
00269       return Z_STREAM_ERROR;
00270   }
00271 }
00272
00273
00274 int inflateSetDictionary(z, dictionary, dictLength)
00275 z_streamp z;
00276 const Bytef *dictionary;
00277 uInt  dictLength;
00278 {
00279   uInt length = dictLength;
00280
00281   if (z == Z_NULL || z->state == Z_NULL || z->state->mode != DICT0)
00282     return Z_STREAM_ERROR;
00283
00284   if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR;
00285   z->adler = 1L;
00286
00287   if (length >= ((uInt)1<<z->state->wbits))
00288   {
00289     length = (1<<z->state->wbits)-1;
00290     dictionary += dictLength - length;
00291   }
00292   inflate_set_dictionary(z->state->blocks, dictionary, length);
00293   z->state->mode = BLOCKS;
00294   return Z_OK;
00295 }
00296
00297
00298 int inflateSync(z)
00299 z_streamp z;
00300 {
00301   uInt n;       /* number of bytes to look at */
00302   Bytef *p;     /* pointer to bytes */
00303   uInt m;       /* number of marker bytes found in a row */
00304   uLong r, w;   /* temporaries to save total_in and total_out */
00305
00306   /* set up */
00307   if (z == Z_NULL || z->state == Z_NULL)
00308     return Z_STREAM_ERROR;
00309   if (z->state->mode != BAD)
00310   {
00311     z->state->mode = BAD;
00312     z->state->sub.marker = 0;
00313   }
00314   if ((n = z->avail_in) == 0)
00315     return Z_BUF_ERROR;
00316   p = z->next_in;
00317   m = z->state->sub.marker;
00318
00319   /* search */
00320   while (n && m < 4)
00321   {
00322     if (*p == (Byte)(m < 2 ? 0 : 0xff))
00323       m++;
00324     else if (*p)
00325       m = 0;
00326     else
00327       m = 4 - m;
00328     p++, n--;
00329   }
00330
00331   /* restore */
00332   z->total_in += p - z->next_in;
00333   z->next_in = p;
00334   z->avail_in = n;
00335   z->state->sub.marker = m;
00336
00337   /* return no joy or set up to restart on a new block */
00338   if (m != 4)
00339     return Z_DATA_ERROR;
00340   r = z->total_in;  w = z->total_out;
00341   inflateReset(z);
00342   z->total_in = r;  z->total_out = w;
00343   z->state->mode = BLOCKS;
00344   return Z_OK;
00345 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/inftrees.c Source File

cvs-1.10/zlib/inftrees.c

Go to the documentation of this file.
00001 /* inftrees.c -- generate Huffman trees for efficient decoding
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 #include "zutil.h"
00007 #include "inftrees.h"
00008
00009 char inflate_copyright[] = " inflate 1.0.4 Copyright 1995-1996 Mark Adler ";
00010 /*
00011   If you use the zlib library in a product, an acknowledgment is welcome
00012   in the documentation of your product. If for some reason you cannot
00013   include such an acknowledgment, I would appreciate that you keep this
00014   copyright string in the executable of your product.
00015  */
00016 struct internal_state  {int dummy;}; /* for buggy compilers */
00017
00018 /* simplify the use of the inflate_huft type with some defines */
00019 #define base more.Base
00020 #define next more.Next
00021 #define exop word.what.Exop
00022 #define bits word.what.Bits
00023
00024
00025 local int huft_build OF((
00026     uIntf *,            /* code lengths in bits */
00027     uInt,               /* number of codes */
00028     uInt,               /* number of "simple" codes */
00029     uIntf *,            /* list of base values for non-simple codes */
00030     uIntf *,            /* list of extra bits for non-simple codes */
00031     inflate_huft * FAR*,/* result: starting table */
00032     uIntf *,            /* maximum lookup bits (returns actual) */
00033     z_streamp ));       /* for zalloc function */
00034
00035 local voidpf falloc OF((
00036     voidpf,             /* opaque pointer (not used) */
00037     uInt,               /* number of items */
00038     uInt));             /* size of item */
00039
00040 /* Tables for deflate from PKZIP's appnote.txt. */
00041 local uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */
00042         3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
00043         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
00044         /* actually lengths - 2; also see note #13 above about 258 */
00045 local uInt cplext[31] = { /* Extra bits for literal codes 257..285 */
00046         0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
00047         3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 192, 192}; /* 192==invalid */
00048 local uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */
00049         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
00050         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
00051         8193, 12289, 16385, 24577};
00052 local uInt cpdext[30] = { /* Extra bits for distance codes */
00053         0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
00054         7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
00055         12, 12, 13, 13};
00056
00057 /*
00058    Huffman code decoding is performed using a multi-level table lookup.
00059    The fastest way to decode is to simply build a lookup table whose
00060    size is determined by the longest code.  However, the time it takes
00061    to build this table can also be a factor if the data being decoded
00062    is not very long.  The most common codes are necessarily the
00063    shortest codes, so those codes dominate the decoding time, and hence
00064    the speed.  The idea is you can have a shorter table that decodes the
00065    shorter, more probable codes, and then point to subsidiary tables for
00066    the longer codes.  The time it costs to decode the longer codes is
00067    then traded against the time it takes to make longer tables.
00068
00069    This results of this trade are in the variables lbits and dbits
00070    below.  lbits is the number of bits the first level table for literal/
00071    length codes can decode in one step, and dbits is the same thing for
00072    the distance codes.  Subsequent tables are also less than or equal to
00073    those sizes.  These values may be adjusted either when all of the
00074    codes are shorter than that, in which case the longest code length in
00075    bits is used, or when the shortest code is *longer* than the requested
00076    table size, in which case the length of the shortest code in bits is
00077    used.
00078
00079    There are two different values for the two tables, since they code a
00080    different number of possibilities each.  The literal/length table
00081    codes 286 possible values, or in a flat code, a little over eight
00082    bits.  The distance table codes 30 possible values, or a little less
00083    than five bits, flat.  The optimum values for speed end up being
00084    about one bit more than those, so lbits is 8+1 and dbits is 5+1.
00085    The optimum values may differ though from machine to machine, and
00086    possibly even between compilers.  Your mileage may vary.
00087  */
00088
00089
00090 /* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
00091 #define BMAX 15         /* maximum bit length of any code */
00092 #define N_MAX 288       /* maximum number of codes in any set */
00093
00094 #ifdef DEBUG
00095   uInt inflate_hufts;
00096 #endif
00097
00098 local int huft_build(b, n, s, d, e, t, m, zs)
00099 uIntf *b;               /* code lengths in bits (all assumed <= BMAX) */
00100 uInt n;                 /* number of codes (assumed <= N_MAX) */
00101 uInt s;                 /* number of simple-valued codes (0..s-1) */
00102 uIntf *d;               /* list of base values for non-simple codes */
00103 uIntf *e;               /* list of extra bits for non-simple codes */
00104 inflate_huft * FAR *t;  /* result: starting table */
00105 uIntf *m;               /* maximum lookup bits, returns actual */
00106 z_streamp zs;           /* for zalloc function */
00107 /* Given a list of code lengths and a maximum table size, make a set of
00108    tables to decode that set of codes.  Return Z_OK on success, Z_BUF_ERROR
00109    if the given code set is incomplete (the tables are still built in this
00110    case), Z_DATA_ERROR if the input is invalid (all zero length codes or an
00111    over-subscribed set of lengths), or Z_MEM_ERROR if not enough memory. */
00112 {
00113
00114   uInt a;                       /* counter for codes of length k */
00115   uInt c[BMAX+1];               /* bit length count table */
00116   uInt f;                       /* i repeats in table every f entries */
00117   int g;                        /* maximum code length */
00118   int h;                        /* table level */
00119   register uInt i;              /* counter, current code */
00120   register uInt j;              /* counter */
00121   register int k;               /* number of bits in current code */
00122   int l;                        /* bits per table (returned in m) */
00123   register uIntf *p;            /* pointer into c[], b[], or v[] */
00124   inflate_huft *q;              /* points to current table */
00125   struct inflate_huft_s r;      /* table entry for structure assignment */
00126   inflate_huft *u[BMAX];        /* table stack */
00127   uInt v[N_MAX];                /* values in order of bit length */
00128   register int w;               /* bits before this table == (l * h) */
00129   uInt x[BMAX+1];               /* bit offsets, then code stack */
00130   uIntf *xp;                    /* pointer into x */
00131   int y;                        /* number of dummy codes added */
00132   uInt z;                       /* number of entries in current table */
00133
00134
00135   /* Generate counts for each bit length */
00136   p = c;
00137 #define C0 *p++ = 0;
00138 #define C2 C0 C0 C0 C0
00139 #define C4 C2 C2 C2 C2
00140   C4                            /* clear c[]--assume BMAX+1 is 16 */
00141   p = b;  i = n;
00142   do {
00143     c[*p++]++;                  /* assume all entries <= BMAX */
00144   } while (--i);
00145   if (c[0] == n)                /* null input--all zero length codes */
00146   {
00147     *t = (inflate_huft *)Z_NULL;
00148     *m = 0;
00149     return Z_OK;
00150   }
00151
00152
00153   /* Find minimum and maximum length, bound *m by those */
00154   l = *m;
00155   for (j = 1; j <= BMAX; j++)
00156     if (c[j])
00157       break;
00158   k = j;                        /* minimum code length */
00159   if ((uInt)l < j)
00160     l = j;
00161   for (i = BMAX; i; i--)
00162     if (c[i])
00163       break;
00164   g = i;                        /* maximum code length */
00165   if ((uInt)l > i)
00166     l = i;
00167   *m = l;
00168
00169
00170   /* Adjust last length count to fill out codes, if needed */
00171   for (y = 1 << j; j < i; j++, y <<= 1)
00172     if ((y -= c[j]) < 0)
00173       return Z_DATA_ERROR;
00174   if ((y -= c[i]) < 0)
00175     return Z_DATA_ERROR;
00176   c[i] += y;
00177
00178
00179   /* Generate starting offsets into the value table for each length */
00180   x[1] = j = 0;
00181   p = c + 1;  xp = x + 2;
00182   while (--i) {                 /* note that i == g from above */
00183     *xp++ = (j += *p++);
00184   }
00185
00186
00187   /* Make a table of values in order of bit lengths */
00188   p = b;  i = 0;
00189   do {
00190     if ((j = *p++) != 0)
00191       v[x[j]++] = i;
00192   } while (++i < n);
00193
00194
00195   /* Generate the Huffman codes and for each, make the table entries */
00196   x[0] = i = 0;                 /* first Huffman code is zero */
00197   p = v;                        /* grab values in bit order */
00198   h = -1;                       /* no tables yet--level -1 */
00199   w = -l;                       /* bits decoded == (l * h) */
00200   u[0] = (inflate_huft *)Z_NULL;        /* just to keep compilers happy */
00201   q = (inflate_huft *)Z_NULL;   /* ditto */
00202   z = 0;                        /* ditto */
00203
00204   /* go through the bit lengths (k already is bits in shortest code) */
00205   for (; k <= g; k++)
00206   {
00207     a = c[k];
00208     while (a--)
00209     {
00210       /* here i is the Huffman code of length k bits for value *p */
00211       /* make tables up to required level */
00212       while (k > w + l)
00213       {
00214         h++;
00215         w += l;                 /* previous table always l bits */
00216
00217         /* compute minimum size table less than or equal to l bits */
00218         z = g - w;
00219         z = z > (uInt)l ? l : z;        /* table size upper limit */
00220         if ((f = 1 << (j = k - w)) > a + 1)     /* try a k-w bit table */
00221         {                       /* too few codes for k-w bit table */
00222           f -= a + 1;           /* deduct codes from patterns left */
00223           xp = c + k;
00224           if (j < z)
00225             while (++j < z)     /* try smaller tables up to z bits */
00226             {
00227               if ((f <<= 1) <= *++xp)
00228                 break;          /* enough codes to use up j bits */
00229               f -= *xp;         /* else deduct codes from patterns */
00230             }
00231         }
00232         z = 1 << j;             /* table entries for j-bit table */
00233
00234         /* allocate and link in new table */
00235         if ((q = (inflate_huft *)ZALLOC
00236              (zs,z + 1,sizeof(inflate_huft))) == Z_NULL)
00237         {
00238           if (h)
00239             inflate_trees_free(u[0], zs);
00240           return Z_MEM_ERROR;   /* not enough memory */
00241         }
00242 #ifdef DEBUG
00243         inflate_hufts += z + 1;
00244 #endif
00245         *t = q + 1;             /* link to list for huft_free() */
00246         *(t = &(q->next)) = Z_NULL;
00247         u[h] = ++q;             /* table starts after link */
00248
00249         /* connect to last table, if there is one */
00250         if (h)
00251         {
00252           x[h] = i;             /* save pattern for backing up */
00253           r.bits = (Byte)l;     /* bits to dump before this table */
00254           r.exop = (Byte)j;     /* bits in this table */
00255           r.next = q;           /* pointer to this table */
00256           j = i >> (w - l);     /* (get around Turbo C bug) */
00257           u[h-1][j] = r;        /* connect to last table */
00258         }
00259       }
00260
00261       /* set up table entry in r */
00262       r.bits = (Byte)(k - w);
00263       if (p >= v + n)
00264         r.exop = 128 + 64;      /* out of values--invalid code */
00265       else if (*p < s)
00266       {
00267         r.exop = (Byte)(*p < 256 ? 0 : 32 + 64);     /* 256 is end-of-block */
00268         r.base = *p++;          /* simple code is just the value */
00269       }
00270       else
00271       {
00272         r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */
00273         r.base = d[*p++ - s];
00274       }
00275
00276       /* fill code-like entries with r */
00277       f = 1 << (k - w);
00278       for (j = i >> w; j < z; j += f)
00279         q[j] = r;
00280
00281       /* backwards increment the k-bit code i */
00282       for (j = 1 << (k - 1); i & j; j >>= 1)
00283         i ^= j;
00284       i ^= j;
00285
00286       /* backup over finished tables */
00287       while ((i & ((1 << w) - 1)) != x[h])
00288       {
00289         h--;                    /* don't need to update q */
00290         w -= l;
00291       }
00292     }
00293   }
00294
00295
00296   /* Return Z_BUF_ERROR if we were given an incomplete table */
00297   return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
00298 }
00299
00300
00301 int inflate_trees_bits(c, bb, tb, z)
00302 uIntf *c;               /* 19 code lengths */
00303 uIntf *bb;              /* bits tree desired/actual depth */
00304 inflate_huft * FAR *tb; /* bits tree result */
00305 z_streamp z;            /* for zfree function */
00306 {
00307   int r;
00308
00309   r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL, tb, bb, z);
00310   if (r == Z_DATA_ERROR)
00311     z->msg = (char*)"oversubscribed dynamic bit lengths tree";
00312   else if (r == Z_BUF_ERROR)
00313   {
00314     inflate_trees_free(*tb, z);
00315     z->msg = (char*)"incomplete dynamic bit lengths tree";
00316     r = Z_DATA_ERROR;
00317   }
00318   return r;
00319 }
00320
00321
00322 int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, z)
00323 uInt nl;                /* number of literal/length codes */
00324 uInt nd;                /* number of distance codes */
00325 uIntf *c;               /* that many (total) code lengths */
00326 uIntf *bl;              /* literal desired/actual bit depth */
00327 uIntf *bd;              /* distance desired/actual bit depth */
00328 inflate_huft * FAR *tl; /* literal/length tree result */
00329 inflate_huft * FAR *td; /* distance tree result */
00330 z_streamp z;            /* for zfree function */
00331 {
00332   int r;
00333
00334   /* build literal/length tree */
00335   if ((r = huft_build(c, nl, 257, cplens, cplext, tl, bl, z)) != Z_OK)
00336   {
00337     if (r == Z_DATA_ERROR)
00338       z->msg = (char*)"oversubscribed literal/length tree";
00339     else if (r == Z_BUF_ERROR)
00340     {
00341       inflate_trees_free(*tl, z);
00342       z->msg = (char*)"incomplete literal/length tree";
00343       r = Z_DATA_ERROR;
00344     }
00345     return r;
00346   }
00347
00348   /* build distance tree */
00349   if ((r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, z)) != Z_OK)
00350   {
00351     if (r == Z_DATA_ERROR)
00352       z->msg = (char*)"oversubscribed literal/length tree";
00353     else if (r == Z_BUF_ERROR) {
00354 #ifdef PKZIP_BUG_WORKAROUND
00355       r = Z_OK;
00356     }
00357 #else
00358       inflate_trees_free(*td, z);
00359       z->msg = (char*)"incomplete literal/length tree";
00360       r = Z_DATA_ERROR;
00361     }
00362     inflate_trees_free(*tl, z);
00363     return r;
00364 #endif
00365   }
00366
00367   /* done */
00368   return Z_OK;
00369 }
00370
00371
00372 /* build fixed tables only once--keep them here */
00373 local int fixed_built = 0;
00374 #define FIXEDH 530      /* number of hufts used by fixed tables */
00375 local inflate_huft fixed_mem[FIXEDH];
00376 local uInt fixed_bl;
00377 local uInt fixed_bd;
00378 local inflate_huft *fixed_tl;
00379 local inflate_huft *fixed_td;
00380
00381
00382 local voidpf falloc(q, n, s)
00383 voidpf q;       /* opaque pointer */
00384 uInt n;         /* number of items */
00385 uInt s;         /* size of item */
00386 {
00387   Assert(s == sizeof(inflate_huft) && n <= *(intf *)q,
00388          "inflate_trees falloc overflow");
00389   *(intf *)q -= n+s-s; /* s-s to avoid warning */
00390   return (voidpf)(fixed_mem + *(intf *)q);
00391 }
00392
00393
00394 int inflate_trees_fixed(bl, bd, tl, td)
00395 uIntf *bl;               /* literal desired/actual bit depth */
00396 uIntf *bd;               /* distance desired/actual bit depth */
00397 inflate_huft * FAR *tl;  /* literal/length tree result */
00398 inflate_huft * FAR *td;  /* distance tree result */
00399 {
00400   /* build fixed tables if not already (multiple overlapped executions ok) */
00401   if (!fixed_built)
00402   {
00403     int k;              /* temporary variable */
00404     unsigned c[288];    /* length list for huft_build */
00405     z_stream z;         /* for falloc function */
00406     int f = FIXEDH;     /* number of hufts left in fixed_mem */
00407
00408     /* set up fake z_stream for memory routines */
00409     z.zalloc = falloc;
00410     z.zfree = Z_NULL;
00411     z.opaque = (voidpf)&f;
00412
00413     /* literal table */
00414     for (k = 0; k < 144; k++)
00415       c[k] = 8;
00416     for (; k < 256; k++)
00417       c[k] = 9;
00418     for (; k < 280; k++)
00419       c[k] = 7;
00420     for (; k < 288; k++)
00421       c[k] = 8;
00422     fixed_bl = 7;
00423     huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl, &z);
00424
00425     /* distance table */
00426     for (k = 0; k < 30; k++)
00427       c[k] = 5;
00428     fixed_bd = 5;
00429     huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd, &z);
00430
00431     /* done */
00432     Assert(f == 0, "invalid build of fixed tables");
00433     fixed_built = 1;
00434   }
00435   *bl = fixed_bl;
00436   *bd = fixed_bd;
00437   *tl = fixed_tl;
00438   *td = fixed_td;
00439   return Z_OK;
00440 }
00441
00442
00443 int inflate_trees_free(t, z)
00444 inflate_huft *t;        /* table to free */
00445 z_streamp z;            /* for zfree function */
00446 /* Free the malloc'ed tables built by huft_build(), which makes a linked
00447    list of the tables it made, with the links in a dummy first entry of
00448    each table. */
00449 {
00450   register inflate_huft *p, *q, *r;
00451
00452   /* Reverse linked list */
00453   p = Z_NULL;
00454   q = t;
00455   while (q != Z_NULL)
00456   {
00457     r = (q - 1)->next;
00458     (q - 1)->next = p;
00459     p = q;
00460     q = r;
00461   }
00462   /* Go through linked list, freeing from the malloced (t[-1]) address. */
00463   while (p != Z_NULL)
00464   {
00465     q = (--p)->next;
00466     ZFREE(z,p);
00467     p = q;
00468   }
00469   return Z_OK;
00470 }
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/inftrees.h Source File

cvs-1.10/zlib/inftrees.h

Go to the documentation of this file.
00001 /* inftrees.h -- header to use inftrees.c
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* WARNING: this file should *not* be used by applications. It is
00007    part of the implementation of the compression library and is
00008    subject to change. Applications should only use zlib.h.
00009  */
00010
00011 /* Huffman code lookup table entry--this entry is four bytes for machines
00012    that have 16-bit pointers (e.g. PC's in the small or medium model). */
00013
00014 typedef struct inflate_huft_s FAR inflate_huft;
00015
00016 struct inflate_huft_s {
00017   union {
00018     struct {
00019       Byte Exop;        /* number of extra bits or operation */
00020       Byte Bits;        /* number of bits in this code or subcode */
00021     } what;
00022     Bytef *pad;         /* pad structure to a power of 2 (4 bytes for */
00023   } word;               /*  16-bit, 8 bytes for 32-bit machines) */
00024   union {
00025     uInt Base;          /* literal, length base, or distance base */
00026     inflate_huft *Next; /* pointer to next level of table */
00027   } more;
00028 };
00029
00030 #ifdef DEBUG
00031   extern uInt inflate_hufts;
00032 #endif
00033
00034 extern int inflate_trees_bits OF((
00035     uIntf *,                    /* 19 code lengths */
00036     uIntf *,                    /* bits tree desired/actual depth */
00037     inflate_huft * FAR *,       /* bits tree result */
00038     z_streamp ));               /* for zalloc, zfree functions */
00039
00040 extern int inflate_trees_dynamic OF((
00041     uInt,                       /* number of literal/length codes */
00042     uInt,                       /* number of distance codes */
00043     uIntf *,                    /* that many (total) code lengths */
00044     uIntf *,                    /* literal desired/actual bit depth */
00045     uIntf *,                    /* distance desired/actual bit depth */
00046     inflate_huft * FAR *,       /* literal/length tree result */
00047     inflate_huft * FAR *,       /* distance tree result */
00048     z_streamp ));               /* for zalloc, zfree functions */
00049
00050 extern int inflate_trees_fixed OF((
00051     uIntf *,                    /* literal desired/actual bit depth */
00052     uIntf *,                    /* distance desired/actual bit depth */
00053     inflate_huft * FAR *,       /* literal/length tree result */
00054     inflate_huft * FAR *));     /* distance tree result */
00055
00056 extern int inflate_trees_free OF((
00057     inflate_huft *,             /* tables to free */
00058     z_streamp ));               /* for zfree function */
00059
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/infutil.c Source File

cvs-1.10/zlib/infutil.c

Go to the documentation of this file.
00001 /* inflate_util.c -- data and routines common to blocks and codes
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 #include "zutil.h"
00007 #include "infblock.h"
00008 #include "inftrees.h"
00009 #include "infcodes.h"
00010 #include "infutil.h"
00011
00012 struct inflate_codes_state {int dummy;}; /* for buggy compilers */
00013
00014 /* And'ing with mask[n] masks the lower n bits */
00015 uInt inflate_mask[17] = {
00016     0x0000,
00017     0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
00018     0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
00019 };
00020
00021
00022 /* copy as much as possible from the sliding window to the output area */
00023 int inflate_flush(s, z, r)
00024 inflate_blocks_statef *s;
00025 z_streamp z;
00026 int r;
00027 {
00028   uInt n;
00029   Bytef *p;
00030   Bytef *q;
00031
00032   /* local copies of source and destination pointers */
00033   p = z->next_out;
00034   q = s->read;
00035
00036   /* compute number of bytes to copy as far as end of window */
00037   n = (uInt)((q <= s->write ? s->write : s->end) - q);
00038   if (n > z->avail_out) n = z->avail_out;
00039   if (n && r == Z_BUF_ERROR) r = Z_OK;
00040
00041   /* update counters */
00042   z->avail_out -= n;
00043   z->total_out += n;
00044
00045   /* update check information */
00046   if (s->checkfn != Z_NULL)
00047     z->adler = s->check = (*s->checkfn)(s->check, q, n);
00048
00049   /* copy as far as end of window */
00050   zmemcpy(p, q, n);
00051   p += n;
00052   q += n;
00053
00054   /* see if more to copy at beginning of window */
00055   if (q == s->end)
00056   {
00057     /* wrap pointers */
00058     q = s->window;
00059     if (s->write == s->end)
00060       s->write = s->window;
00061
00062     /* compute bytes to copy */
00063     n = (uInt)(s->write - q);
00064     if (n > z->avail_out) n = z->avail_out;
00065     if (n && r == Z_BUF_ERROR) r = Z_OK;
00066
00067     /* update counters */
00068     z->avail_out -= n;
00069     z->total_out += n;
00070
00071     /* update check information */
00072     if (s->checkfn != Z_NULL)
00073       z->adler = s->check = (*s->checkfn)(s->check, q, n);
00074
00075     /* copy */
00076     zmemcpy(p, q, n);
00077     p += n;
00078     q += n;
00079   }
00080
00081   /* update pointers */
00082   z->next_out = p;
00083   s->read = q;
00084
00085   /* done */
00086   return r;
00087 }
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/infutil.h Source File

cvs-1.10/zlib/infutil.h

Go to the documentation of this file.
00001 /* infutil.h -- types and macros common to blocks and codes
00002  * Copyright (C) 1995-1996 Mark Adler
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* WARNING: this file should *not* be used by applications. It is
00007    part of the implementation of the compression library and is
00008    subject to change. Applications should only use zlib.h.
00009  */
00010
00011 #ifndef _INFUTIL_H
00012 #define _INFUTIL_H
00013
00014 typedef enum {
00015       TYPE,     /* get type bits (3, including end bit) */
00016       LENS,     /* get lengths for stored */
00017       STORED,   /* processing stored block */
00018       TABLE,    /* get table lengths */
00019       BTREE,    /* get bit lengths tree for a dynamic block */
00020       DTREE,    /* get length, distance trees for a dynamic block */
00021       CODES,    /* processing fixed or dynamic block */
00022       DRY,      /* output remaining window bytes */
00023       DONE,     /* finished last block, done */
00024       BAD}      /* got a data error--stuck here */
00025 inflate_block_mode;
00026
00027 /* inflate blocks semi-private state */
00028 struct inflate_blocks_state {
00029
00030   /* mode */
00031   inflate_block_mode  mode;     /* current inflate_block mode */
00032
00033   /* mode dependent information */
00034   union {
00035     uInt left;          /* if STORED, bytes left to copy */
00036     struct {
00037       uInt table;               /* table lengths (14 bits) */
00038       uInt index;               /* index into blens (or border) */
00039       uIntf *blens;             /* bit lengths of codes */
00040       uInt bb;                  /* bit length tree depth */
00041       inflate_huft *tb;         /* bit length decoding tree */
00042     } trees;            /* if DTREE, decoding info for trees */
00043     struct {
00044       inflate_huft *tl;
00045       inflate_huft *td;         /* trees to free */
00046       inflate_codes_statef
00047          *codes;
00048     } decode;           /* if CODES, current state */
00049   } sub;                /* submode */
00050   uInt last;            /* true if this block is the last block */
00051
00052   /* mode independent information */
00053   uInt bitk;            /* bits in bit buffer */
00054   uLong bitb;           /* bit buffer */
00055   Bytef *window;        /* sliding window */
00056   Bytef *end;           /* one byte after sliding window */
00057   Bytef *read;          /* window read pointer */
00058   Bytef *write;         /* window write pointer */
00059   check_func checkfn;   /* check function */
00060   uLong check;          /* check on output */
00061
00062 };
00063
00064
00065 /* defines for inflate input/output */
00066 /*   update pointers and return */
00067 #define UPDBITS {s->bitb=b;s->bitk=k;}
00068 #define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
00069 #define UPDOUT {s->write=q;}
00070 #define UPDATE {UPDBITS UPDIN UPDOUT}
00071 #define LEAVE {UPDATE return inflate_flush(s,z,r);}
00072 /*   get bytes and bits */
00073 #define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}
00074 #define NEEDBYTE {if(n)r=Z_OK;else LEAVE}
00075 #define NEXTBYTE (n--,*p++)
00076 #define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}
00077 #define DUMPBITS(j) {b>>=(j);k-=(j);}
00078 /*   output bytes */
00079 #define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)
00080 #define LOADOUT {q=s->write;m=(uInt)WAVAIL;}
00081 #define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
00082 #define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}
00083 #define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
00084 #define OUTBYTE(a) {*q++=(Byte)(a);m--;}
00085 /*   load local pointers */
00086 #define LOAD {LOADIN LOADOUT}
00087
00088 /* masks for lower bits (size given to avoid silly warnings with Visual C++) */
00089 extern uInt inflate_mask[17];
00090
00091 /* copy as much as possible from the sliding window to the output area */
00092 extern int inflate_flush OF((
00093     inflate_blocks_statef *,
00094     z_streamp ,
00095     int));
00096
00097 struct internal_state      {int dummy;}; /* for buggy compilers */
00098
00099 #endif
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/minigzip.c Source File

cvs-1.10/zlib/minigzip.c

Go to the documentation of this file.
00001 /* minigzip.c -- simulate gzip using the zlib compression library
00002  * Copyright (C) 1995-1996 Jean-loup Gailly.
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /*
00007  * minigzip is a minimal implementation of the gzip utility. This is
00008  * only an example of using zlib and isn't meant to replace the
00009  * full-featured gzip. No attempt is made to deal with file systems
00010  * limiting names to 14 or 8+3 characters, etc... Error checking is
00011  * very limited. So use minigzip only for testing; use gzip for the
00012  * real thing. On MSDOS, use only on file names without extension
00013  * or in pipe mode.
00014  */
00015
00016 /* $Id: minigzip.c,v 1.10 1996/07/24 13:41:04 me Exp $ */
00017
00018 #include <stdio.h>
00019 #include "zlib.h"
00020
00021 #ifdef STDC
00022 #  include <string.h>
00023 #  include <stdlib.h>
00024 #else
00025    extern void exit  OF((int));
00026 #endif
00027
00028
00029 #if defined(MSDOS) || defined(OS2) || defined(WIN32)
00030 #  include <fcntl.h>
00031 #  include <io.h>
00032 #  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
00033 #else
00034 #  define SET_BINARY_MODE(file)
00035 #endif
00036
00037 #ifdef VMS
00038 #  define unlink delete
00039 #  define GZ_SUFFIX "-gz"
00040 #endif
00041 #ifdef RISCOS
00042 #  define unlink remove
00043 #  define GZ_SUFFIX "-gz"
00044 #  define fileno(file) file->__file
00045 #endif
00046
00047 #ifndef GZ_SUFFIX
00048 #  define GZ_SUFFIX ".gz"
00049 #endif
00050 #define SUFFIX_LEN sizeof(GZ_SUFFIX)
00051
00052 extern int unlink OF((const char *));
00053
00054 #define BUFLEN 4096
00055 #define MAX_NAME_LEN 1024
00056
00057 #define local static
00058 /* For MSDOS and other systems with limitation on stack size. For Unix,
00059     #define local
00060    works also.
00061  */
00062
00063 char *prog;
00064
00065 void error           OF((const char *msg));
00066 void gz_compress     OF((FILE   *in, gzFile out));
00067 void gz_uncompress   OF((gzFile in, FILE   *out));
00068 void file_compress   OF((char  *file));
00069 void file_uncompress OF((char  *file));
00070 int  main            OF((int argc, char *argv[]));
00071
00072 /* ===========================================================================
00073  * Display error message and exit
00074  */
00075 void error(msg)
00076     const char *msg;
00077 {
00078     fprintf(stderr, "%s: %s\n", prog, msg);
00079     exit(1);
00080 }
00081
00082 /* ===========================================================================
00083  * Compress input to output then close both files.
00084  */
00085 void gz_compress(in, out)
00086     FILE   *in;
00087     gzFile out;
00088 {
00089     local char buf[BUFLEN];
00090     int len;
00091     int err;
00092
00093     for (;;) {
00094         len = fread(buf, 1, sizeof(buf), in);
00095         if (ferror(in)) {
00096             perror("fread");
00097             exit(1);
00098         }
00099         if (len == 0) break;
00100
00101         if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err));
00102     }
00103     fclose(in);
00104     if (gzclose(out) != Z_OK) error("failed gzclose");
00105 }
00106
00107 /* ===========================================================================
00108  * Uncompress input to output then close both files.
00109  */
00110 void gz_uncompress(in, out)
00111     gzFile in;
00112     FILE   *out;
00113 {
00114     local char buf[BUFLEN];
00115     int len;
00116     int err;
00117
00118     for (;;) {
00119         len = gzread(in, buf, sizeof(buf));
00120         if (len < 0) error (gzerror(in, &err));
00121         if (len == 0) break;
00122
00123         if ((int)fwrite(buf, 1, (unsigned)len, out) != len) {
00124         error("failed fwrite");
00125     }
00126     }
00127     if (fclose(out)) error("failed fclose");
00128
00129     if (gzclose(in) != Z_OK) error("failed gzclose");
00130 }
00131
00132
00133 /* ===========================================================================
00134  * Compress the given file: create a corresponding .gz file and remove the
00135  * original.
00136  */
00137 void file_compress(file)
00138     char  *file;
00139 {
00140     local char outfile[MAX_NAME_LEN];
00141     FILE  *in;
00142     gzFile out;
00143
00144     strcpy(outfile, file);
00145     strcat(outfile, GZ_SUFFIX);
00146
00147     in = fopen(file, "rb");
00148     if (in == NULL) {
00149         perror(file);
00150         exit(1);
00151     }
00152     out = gzopen(outfile, "wb"); /* use "wb9" for maximal compression */
00153     if (out == NULL) {
00154         fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile);
00155         exit(1);
00156     }
00157     gz_compress(in, out);
00158
00159     unlink(file);
00160 }
00161
00162
00163 /* ===========================================================================
00164  * Uncompress the given file and remove the original.
00165  */
00166 void file_uncompress(file)
00167     char  *file;
00168 {
00169     local char buf[MAX_NAME_LEN];
00170     char *infile, *outfile;
00171     FILE  *out;
00172     gzFile in;
00173     int len = strlen(file);
00174
00175     strcpy(buf, file);
00176
00177     if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
00178         infile = file;
00179         outfile = buf;
00180         outfile[len-3] = '\0';
00181     } else {
00182         outfile = file;
00183         infile = buf;
00184         strcat(infile, GZ_SUFFIX);
00185     }
00186     in = gzopen(infile, "rb");
00187     if (in == NULL) {
00188         fprintf(stderr, "%s: can't gzopen %s\n", prog, infile);
00189         exit(1);
00190     }
00191     out = fopen(outfile, "wb");
00192     if (out == NULL) {
00193         perror(file);
00194         exit(1);
00195     }
00196
00197     gz_uncompress(in, out);
00198
00199     unlink(infile);
00200 }
00201
00202
00203 /* ===========================================================================
00204  * Usage:  minigzip [-d] [files...]
00205  */
00206
00207 int main(argc, argv)
00208     int argc;
00209     char *argv[];
00210 {
00211     int uncompr = 0;
00212     gzFile file;
00213
00214     prog = argv[0];
00215     argc--, argv++;
00216
00217     if (argc > 0) {
00218         uncompr = (strcmp(*argv, "-d") == 0);
00219         if (uncompr) {
00220             argc--, argv++;
00221         }
00222     }
00223     if (argc == 0) {
00224         SET_BINARY_MODE(stdin);
00225         SET_BINARY_MODE(stdout);
00226         if (uncompr) {
00227             file = gzdopen(fileno(stdin), "rb");
00228             if (file == NULL) error("can't gzdopen stdin");
00229             gz_uncompress(file, stdout);
00230         } else {
00231             file = gzdopen(fileno(stdout), "wb"); /* "wb9" for max compr. */
00232             if (file == NULL) error("can't gzdopen stdout");
00233             gz_compress(stdin, file);
00234         }
00235     } else {
00236         do {
00237             if (uncompr) {
00238                 file_uncompress(*argv);
00239             } else {
00240                 file_compress(*argv);
00241             }
00242         } while (argv++, --argc);
00243     }
00244     exit(0);
00245     return 0; /* to avoid warning */
00246 }
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/trees.c Source File

cvs-1.10/zlib/trees.c

Go to the documentation of this file.
00001 /* trees.c -- output deflated data using Huffman coding
00002  * Copyright (C) 1995-1996 Jean-loup Gailly
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /*
00007  *  ALGORITHM
00008  *
00009  *      The "deflation" process uses several Huffman trees. The more
00010  *      common source values are represented by shorter bit sequences.
00011  *
00012  *      Each code tree is stored in a compressed form which is itself
00013  * a Huffman encoding of the lengths of all the code strings (in
00014  * ascending order by source values).  The actual code strings are
00015  * reconstructed from the lengths in the inflate process, as described
00016  * in the deflate specification.
00017  *
00018  *  REFERENCES
00019  *
00020  *      Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
00021  *      Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
00022  *
00023  *      Storer, James A.
00024  *          Data Compression:  Methods and Theory, pp. 49-50.
00025  *          Computer Science Press, 1988.  ISBN 0-7167-8156-5.
00026  *
00027  *      Sedgewick, R.
00028  *          Algorithms, p290.
00029  *          Addison-Wesley, 1983. ISBN 0-201-06672-6.
00030  */
00031
00032 /* $Id: trees.c,v 1.11 1996/07/24 13:41:06 me Exp $ */
00033
00034 #include "deflate.h"
00035
00036 #ifdef DEBUG
00037 #  include <ctype.h>
00038 #endif
00039
00040 /* ===========================================================================
00041  * Constants
00042  */
00043
00044 #define MAX_BL_BITS 7
00045 /* Bit length codes must not exceed MAX_BL_BITS bits */
00046
00047 #define END_BLOCK 256
00048 /* end of block literal code */
00049
00050 #define REP_3_6      16
00051 /* repeat previous bit length 3-6 times (2 bits of repeat count) */
00052
00053 #define REPZ_3_10    17
00054 /* repeat a zero length 3-10 times  (3 bits of repeat count) */
00055
00056 #define REPZ_11_138  18
00057 /* repeat a zero length 11-138 times  (7 bits of repeat count) */
00058
00059 local int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
00060    = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
00061
00062 local int extra_dbits[D_CODES] /* extra bits for each distance code */
00063    = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
00064
00065 local int extra_blbits[BL_CODES]/* extra bits for each bit length code */
00066    = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
00067
00068 local uch bl_order[BL_CODES]
00069    = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
00070 /* The lengths of the bit length codes are sent in order of decreasing
00071  * probability, to avoid transmitting the lengths for unused bit length codes.
00072  */
00073
00074 #define Buf_size (8 * 2*sizeof(char))
00075 /* Number of bits used within bi_buf. (bi_buf might be implemented on
00076  * more than 16 bits on some systems.)
00077  */
00078
00079 /* ===========================================================================
00080  * Local data. These are initialized only once.
00081  */
00082
00083 local ct_data static_ltree[L_CODES+2];
00084 /* The static literal tree. Since the bit lengths are imposed, there is no
00085  * need for the L_CODES extra codes used during heap construction. However
00086  * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
00087  * below).
00088  */
00089
00090 local ct_data static_dtree[D_CODES];
00091 /* The static distance tree. (Actually a trivial tree since all codes use
00092  * 5 bits.)
00093  */
00094
00095 local uch dist_code[512];
00096 /* distance codes. The first 256 values correspond to the distances
00097  * 3 .. 258, the last 256 values correspond to the top 8 bits of
00098  * the 15 bit distances.
00099  */
00100
00101 local uch length_code[MAX_MATCH-MIN_MATCH+1];
00102 /* length code for each normalized match length (0 == MIN_MATCH) */
00103
00104 local int base_length[LENGTH_CODES];
00105 /* First normalized length for each code (0 = MIN_MATCH) */
00106
00107 local int base_dist[D_CODES];
00108 /* First normalized distance for each code (0 = distance of 1) */
00109
00110 struct static_tree_desc_s {
00111     ct_data *static_tree;        /* static tree or NULL */
00112     intf    *extra_bits;         /* extra bits for each code or NULL */
00113     int     extra_base;          /* base index for extra_bits */
00114     int     elems;               /* max number of elements in the tree */
00115     int     max_length;          /* max bit length for the codes */
00116 };
00117
00118 local static_tree_desc  static_l_desc =
00119 {static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
00120
00121 local static_tree_desc  static_d_desc =
00122 {static_dtree, extra_dbits, 0,          D_CODES, MAX_BITS};
00123
00124 local static_tree_desc  static_bl_desc =
00125 {(ct_data *)0, extra_blbits, 0,      BL_CODES, MAX_BL_BITS};
00126
00127 /* ===========================================================================
00128  * Local (static) routines in this file.
00129  */
00130
00131 local void tr_static_init OF((void));
00132 local void init_block     OF((deflate_state *s));
00133 local void pqdownheap     OF((deflate_state *s, ct_data *tree, int k));
00134 local void gen_bitlen     OF((deflate_state *s, tree_desc *desc));
00135 local void gen_codes      OF((ct_data *tree, int max_code, ushf *bl_count));
00136 local void build_tree     OF((deflate_state *s, tree_desc *desc));
00137 local void scan_tree      OF((deflate_state *s, ct_data *tree, int max_code));
00138 local void send_tree      OF((deflate_state *s, ct_data *tree, int max_code));
00139 local int  build_bl_tree  OF((deflate_state *s));
00140 local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
00141                               int blcodes));
00142 local void compress_block OF((deflate_state *s, ct_data *ltree,
00143                               ct_data *dtree));
00144 local void set_data_type  OF((deflate_state *s));
00145 local unsigned bi_reverse OF((unsigned value, int length));
00146 local void bi_windup      OF((deflate_state *s));
00147 local void bi_flush       OF((deflate_state *s));
00148 local void copy_block     OF((deflate_state *s, charf *buf, unsigned len,
00149                               int header));
00150
00151 #ifndef DEBUG
00152 #  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
00153    /* Send a code of the given tree. c and tree must not have side effects */
00154
00155 #else /* DEBUG */
00156 #  define send_code(s, c, tree) \
00157      { if (verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
00158        send_bits(s, tree[c].Code, tree[c].Len); }
00159 #endif
00160
00161 #define d_code(dist) \
00162    ((dist) < 256 ? dist_code[dist] : dist_code[256+((dist)>>7)])
00163 /* Mapping from a distance to a distance code. dist is the distance - 1 and
00164  * must not have side effects. dist_code[256] and dist_code[257] are never
00165  * used.
00166  */
00167
00168 /* ===========================================================================
00169  * Output a short LSB first on the stream.
00170  * IN assertion: there is enough room in pendingBuf.
00171  */
00172 #define put_short(s, w) { \
00173     put_byte(s, (uch)((w) & 0xff)); \
00174     put_byte(s, (uch)((ush)(w) >> 8)); \
00175 }
00176
00177 /* ===========================================================================
00178  * Send a value on a given number of bits.
00179  * IN assertion: length <= 16 and value fits in length bits.
00180  */
00181 #ifdef DEBUG
00182 local void send_bits      OF((deflate_state *s, int value, int length));
00183
00184 local void send_bits(s, value, length)
00185     deflate_state *s;
00186     int value;  /* value to send */
00187     int length; /* number of bits */
00188 {
00189     Tracevv((stderr," l %2d v %4x ", length, value));
00190     Assert(length > 0 && length <= 15, "invalid length");
00191     s->bits_sent += (ulg)length;
00192
00193     /* If not enough room in bi_buf, use (valid) bits from bi_buf and
00194      * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
00195      * unused bits in value.
00196      */
00197     if (s->bi_valid > (int)Buf_size - length) {
00198         s->bi_buf |= (value << s->bi_valid);
00199         put_short(s, s->bi_buf);
00200         s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
00201         s->bi_valid += length - Buf_size;
00202     } else {
00203         s->bi_buf |= value << s->bi_valid;
00204         s->bi_valid += length;
00205     }
00206 }
00207 #else /* !DEBUG */
00208
00209 #define send_bits(s, value, length) \
00210 { int len = length;\
00211   if (s->bi_valid > (int)Buf_size - len) {\
00212     int val = value;\
00213     s->bi_buf |= (val << s->bi_valid);\
00214     put_short(s, s->bi_buf);\
00215     s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
00216     s->bi_valid += len - Buf_size;\
00217   } else {\
00218     s->bi_buf |= (value) << s->bi_valid;\
00219     s->bi_valid += len;\
00220   }\
00221 }
00222 #endif /* DEBUG */
00223
00224
00225 #define MAX(a,b) (a >= b ? a : b)
00226 /* the arguments must not have side effects */
00227
00228 /* ===========================================================================
00229  * Initialize the various 'constant' tables. In a multi-threaded environment,
00230  * this function may be called by two threads concurrently, but this is
00231  * harmless since both invocations do exactly the same thing.
00232  */
00233 local void tr_static_init()
00234 {
00235     static int static_init_done = 0;
00236     int n;        /* iterates over tree elements */
00237     int bits;     /* bit counter */
00238     int length;   /* length value */
00239     int code;     /* code value */
00240     int dist;     /* distance index */
00241     ush bl_count[MAX_BITS+1];
00242     /* number of codes at each bit length for an optimal tree */
00243
00244     if (static_init_done) return;
00245
00246     /* Initialize the mapping length (0..255) -> length code (0..28) */
00247     length = 0;
00248     for (code = 0; code < LENGTH_CODES-1; code++) {
00249         base_length[code] = length;
00250         for (n = 0; n < (1<<extra_lbits[code]); n++) {
00251             length_code[length++] = (uch)code;
00252         }
00253     }
00254     Assert (length == 256, "tr_static_init: length != 256");
00255     /* Note that the length 255 (match length 258) can be represented
00256      * in two different ways: code 284 + 5 bits or code 285, so we
00257      * overwrite length_code[255] to use the best encoding:
00258      */
00259     length_code[length-1] = (uch)code;
00260
00261     /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
00262     dist = 0;
00263     for (code = 0 ; code < 16; code++) {
00264         base_dist[code] = dist;
00265         for (n = 0; n < (1<<extra_dbits[code]); n++) {
00266             dist_code[dist++] = (uch)code;
00267         }
00268     }
00269     Assert (dist == 256, "tr_static_init: dist != 256");
00270     dist >>= 7; /* from now on, all distances are divided by 128 */
00271     for ( ; code < D_CODES; code++) {
00272         base_dist[code] = dist << 7;
00273         for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
00274             dist_code[256 + dist++] = (uch)code;
00275         }
00276     }
00277     Assert (dist == 256, "tr_static_init: 256+dist != 512");
00278
00279     /* Construct the codes of the static literal tree */
00280     for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
00281     n = 0;
00282     while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
00283     while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
00284     while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
00285     while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
00286     /* Codes 286 and 287 do not exist, but we must include them in the
00287      * tree construction to get a canonical Huffman tree (longest code
00288      * all ones)
00289      */
00290     gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
00291
00292     /* The static distance tree is trivial: */
00293     for (n = 0; n < D_CODES; n++) {
00294         static_dtree[n].Len = 5;
00295         static_dtree[n].Code = bi_reverse((unsigned)n, 5);
00296     }
00297     static_init_done = 1;
00298 }
00299
00300 /* ===========================================================================
00301  * Initialize the tree data structures for a new zlib stream.
00302  */
00303 void _tr_init(s)
00304     deflate_state *s;
00305 {
00306     tr_static_init();
00307
00308     s->compressed_len = 0L;
00309
00310     s->l_desc.dyn_tree = s->dyn_ltree;
00311     s->l_desc.stat_desc = &static_l_desc;
00312
00313     s->d_desc.dyn_tree = s->dyn_dtree;
00314     s->d_desc.stat_desc = &static_d_desc;
00315
00316     s->bl_desc.dyn_tree = s->bl_tree;
00317     s->bl_desc.stat_desc = &static_bl_desc;
00318
00319     s->bi_buf = 0;
00320     s->bi_valid = 0;
00321     s->last_eob_len = 8; /* enough lookahead for inflate */
00322 #ifdef DEBUG
00323     s->bits_sent = 0L;
00324 #endif
00325
00326     /* Initialize the first block of the first file: */
00327     init_block(s);
00328 }
00329
00330 /* ===========================================================================
00331  * Initialize a new block.
00332  */
00333 local void init_block(s)
00334     deflate_state *s;
00335 {
00336     int n; /* iterates over tree elements */
00337
00338     /* Initialize the trees. */
00339     for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;
00340     for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;
00341     for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
00342
00343     s->dyn_ltree[END_BLOCK].Freq = 1;
00344     s->opt_len = s->static_len = 0L;
00345     s->last_lit = s->matches = 0;
00346 }
00347
00348 #define SMALLEST 1
00349 /* Index within the heap array of least frequent node in the Huffman tree */
00350
00351
00352 /* ===========================================================================
00353  * Remove the smallest element from the heap and recreate the heap with
00354  * one less element. Updates heap and heap_len.
00355  */
00356 #define pqremove(s, tree, top) \
00357 {\
00358     top = s->heap[SMALLEST]; \
00359     s->heap[SMALLEST] = s->heap[s->heap_len--]; \
00360     pqdownheap(s, tree, SMALLEST); \
00361 }
00362
00363 /* ===========================================================================
00364  * Compares to subtrees, using the tree depth as tie breaker when
00365  * the subtrees have equal frequency. This minimizes the worst case length.
00366  */
00367 #define smaller(tree, n, m, depth) \
00368    (tree[n].Freq < tree[m].Freq || \
00369    (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
00370
00371 /* ===========================================================================
00372  * Restore the heap property by moving down the tree starting at node k,
00373  * exchanging a node with the smallest of its two sons if necessary, stopping
00374  * when the heap property is re-established (each father smaller than its
00375  * two sons).
00376  */
00377 local void pqdownheap(s, tree, k)
00378     deflate_state *s;
00379     ct_data *tree;  /* the tree to restore */
00380     int k;               /* node to move down */
00381 {
00382     int v = s->heap[k];
00383     int j = k << 1;  /* left son of k */
00384     while (j <= s->heap_len) {
00385         /* Set j to the smallest of the two sons: */
00386         if (j < s->heap_len &&
00387             smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
00388             j++;
00389         }
00390         /* Exit if v is smaller than both sons */
00391         if (smaller(tree, v, s->heap[j], s->depth)) break;
00392
00393         /* Exchange v with the smallest son */
00394         s->heap[k] = s->heap[j];  k = j;
00395
00396         /* And continue down the tree, setting j to the left son of k */
00397         j <<= 1;
00398     }
00399     s->heap[k] = v;
00400 }
00401
00402 /* ===========================================================================
00403  * Compute the optimal bit lengths for a tree and update the total bit length
00404  * for the current block.
00405  * IN assertion: the fields freq and dad are set, heap[heap_max] and
00406  *    above are the tree nodes sorted by increasing frequency.
00407  * OUT assertions: the field len is set to the optimal bit length, the
00408  *     array bl_count contains the frequencies for each bit length.
00409  *     The length opt_len is updated; static_len is also updated if stree is
00410  *     not null.
00411  */
00412 local void gen_bitlen(s, desc)
00413     deflate_state *s;
00414     tree_desc *desc;    /* the tree descriptor */
00415 {
00416     ct_data *tree  = desc->dyn_tree;
00417     int max_code   = desc->max_code;
00418     ct_data *stree = desc->stat_desc->static_tree;
00419     intf *extra    = desc->stat_desc->extra_bits;
00420     int base       = desc->stat_desc->extra_base;
00421     int max_length = desc->stat_desc->max_length;
00422     int h;              /* heap index */
00423     int n, m;           /* iterate over the tree elements */
00424     int bits;           /* bit length */
00425     int xbits;          /* extra bits */
00426     ush f;              /* frequency */
00427     int overflow = 0;   /* number of elements with bit length too large */
00428
00429     for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
00430
00431     /* In a first pass, compute the optimal bit lengths (which may
00432      * overflow in the case of the bit length tree).
00433      */
00434     tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
00435
00436     for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
00437         n = s->heap[h];
00438         bits = tree[tree[n].Dad].Len + 1;
00439         if (bits > max_length) bits = max_length, overflow++;
00440         tree[n].Len = (ush)bits;
00441         /* We overwrite tree[n].Dad which is no longer needed */
00442
00443         if (n > max_code) continue; /* not a leaf node */
00444
00445         s->bl_count[bits]++;
00446         xbits = 0;
00447         if (n >= base) xbits = extra[n-base];
00448         f = tree[n].Freq;
00449         s->opt_len += (ulg)f * (bits + xbits);
00450         if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
00451     }
00452     if (overflow == 0) return;
00453
00454     Trace((stderr,"\nbit length overflow\n"));
00455     /* This happens for example on obj2 and pic of the Calgary corpus */
00456
00457     /* Find the first bit length which could increase: */
00458     do {
00459         bits = max_length-1;
00460         while (s->bl_count[bits] == 0) bits--;
00461         s->bl_count[bits]--;      /* move one leaf down the tree */
00462         s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
00463         s->bl_count[max_length]--;
00464         /* The brother of the overflow item also moves one step up,
00465          * but this does not affect bl_count[max_length]
00466          */
00467         overflow -= 2;
00468     } while (overflow > 0);
00469
00470     /* Now recompute all bit lengths, scanning in increasing frequency.
00471      * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
00472      * lengths instead of fixing only the wrong ones. This idea is taken
00473      * from 'ar' written by Haruhiko Okumura.)
00474      */
00475     for (bits = max_length; bits != 0; bits--) {
00476         n = s->bl_count[bits];
00477         while (n != 0) {
00478             m = s->heap[--h];
00479             if (m > max_code) continue;
00480             if (tree[m].Len != (unsigned) bits) {
00481                 Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
00482                 s->opt_len += ((long)bits - (long)tree[m].Len)
00483                               *(long)tree[m].Freq;
00484                 tree[m].Len = (ush)bits;
00485             }
00486             n--;
00487         }
00488     }
00489 }
00490
00491 /* ===========================================================================
00492  * Generate the codes for a given tree and bit counts (which need not be
00493  * optimal).
00494  * IN assertion: the array bl_count contains the bit length statistics for
00495  * the given tree and the field len is set for all tree elements.
00496  * OUT assertion: the field code is set for all tree elements of non
00497  *     zero code length.
00498  */
00499 local void gen_codes (tree, max_code, bl_count)
00500     ct_data *tree;             /* the tree to decorate */
00501     int max_code;              /* largest code with non zero frequency */
00502     ushf *bl_count;            /* number of codes at each bit length */
00503 {
00504     ush next_code[MAX_BITS+1]; /* next code value for each bit length */
00505     ush code = 0;              /* running code value */
00506     int bits;                  /* bit index */
00507     int n;                     /* code index */
00508
00509     /* The distribution counts are first used to generate the code values
00510      * without bit reversal.
00511      */
00512     for (bits = 1; bits <= MAX_BITS; bits++) {
00513         next_code[bits] = code = (code + bl_count[bits-1]) << 1;
00514     }
00515     /* Check that the bit counts in bl_count are consistent. The last code
00516      * must be all ones.
00517      */
00518     Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
00519             "inconsistent bit counts");
00520     Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
00521
00522     for (n = 0;  n <= max_code; n++) {
00523         int len = tree[n].Len;
00524         if (len == 0) continue;
00525         /* Now reverse the bits */
00526         tree[n].Code = bi_reverse(next_code[len]++, len);
00527
00528         Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
00529              n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
00530     }
00531 }
00532
00533 /* ===========================================================================
00534  * Construct one Huffman tree and assigns the code bit strings and lengths.
00535  * Update the total bit length for the current block.
00536  * IN assertion: the field freq is set for all tree elements.
00537  * OUT assertions: the fields len and code are set to the optimal bit length
00538  *     and corresponding code. The length opt_len is updated; static_len is
00539  *     also updated if stree is not null. The field max_code is set.
00540  */
00541 local void build_tree(s, desc)
00542     deflate_state *s;
00543     tree_desc *desc; /* the tree descriptor */
00544 {
00545     ct_data *tree   = desc->dyn_tree;
00546     ct_data *stree  = desc->stat_desc->static_tree;
00547     int elems       = desc->stat_desc->elems;
00548     int n, m;          /* iterate over heap elements */
00549     int max_code = -1; /* largest code with non zero frequency */
00550     int node;          /* new node being created */
00551
00552     /* Construct the initial heap, with least frequent element in
00553      * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
00554      * heap[0] is not used.
00555      */
00556     s->heap_len = 0, s->heap_max = HEAP_SIZE;
00557
00558     for (n = 0; n < elems; n++) {
00559         if (tree[n].Freq != 0) {
00560             s->heap[++(s->heap_len)] = max_code = n;
00561             s->depth[n] = 0;
00562         } else {
00563             tree[n].Len = 0;
00564         }
00565     }
00566
00567     /* The pkzip format requires that at least one distance code exists,
00568      * and that at least one bit should be sent even if there is only one
00569      * possible code. So to avoid special checks later on we force at least
00570      * two codes of non zero frequency.
00571      */
00572     while (s->heap_len < 2) {
00573         node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
00574         tree[node].Freq = 1;
00575         s->depth[node] = 0;
00576         s->opt_len--; if (stree) s->static_len -= stree[node].Len;
00577         /* node is 0 or 1 so it does not have extra bits */
00578     }
00579     desc->max_code = max_code;
00580
00581     /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
00582      * establish sub-heaps of increasing lengths:
00583      */
00584     for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
00585
00586     /* Construct the Huffman tree by repeatedly combining the least two
00587      * frequent nodes.
00588      */
00589     node = elems;              /* next internal node of the tree */
00590     do {
00591         pqremove(s, tree, n);  /* n = node of least frequency */
00592         m = s->heap[SMALLEST]; /* m = node of next least frequency */
00593
00594         s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
00595         s->heap[--(s->heap_max)] = m;
00596
00597         /* Create a new node father of n and m */
00598         tree[node].Freq = tree[n].Freq + tree[m].Freq;
00599         s->depth[node] = (uch) (MAX(s->depth[n], s->depth[m]) + 1);
00600         tree[n].Dad = tree[m].Dad = (ush)node;
00601 #ifdef DUMP_BL_TREE
00602         if (tree == s->bl_tree) {
00603             fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
00604                     node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
00605         }
00606 #endif
00607         /* and insert the new node in the heap */
00608         s->heap[SMALLEST] = node++;
00609         pqdownheap(s, tree, SMALLEST);
00610
00611     } while (s->heap_len >= 2);
00612
00613     s->heap[--(s->heap_max)] = s->heap[SMALLEST];
00614
00615     /* At this point, the fields freq and dad are set. We can now
00616      * generate the bit lengths.
00617      */
00618     gen_bitlen(s, (tree_desc *)desc);
00619
00620     /* The field len is now set, we can generate the bit codes */
00621     gen_codes ((ct_data *)tree, max_code, s->bl_count);
00622 }
00623
00624 /* ===========================================================================
00625  * Scan a literal or distance tree to determine the frequencies of the codes
00626  * in the bit length tree.
00627  */
00628 local void scan_tree (s, tree, max_code)
00629     deflate_state *s;
00630     ct_data *tree;   /* the tree to be scanned */
00631     int max_code;    /* and its largest code of non zero frequency */
00632 {
00633     int n;                     /* iterates over all tree elements */
00634     int prevlen = -1;          /* last emitted length */
00635     int curlen;                /* length of current code */
00636     int nextlen = tree[0].Len; /* length of next code */
00637     int count = 0;             /* repeat count of the current code */
00638     int max_count = 7;         /* max repeat count */
00639     int min_count = 4;         /* min repeat count */
00640
00641     if (nextlen == 0) max_count = 138, min_count = 3;
00642     tree[max_code+1].Len = (ush)0xffff; /* guard */
00643
00644     for (n = 0; n <= max_code; n++) {
00645         curlen = nextlen; nextlen = tree[n+1].Len;
00646         if (++count < max_count && curlen == nextlen) {
00647             continue;
00648         } else if (count < min_count) {
00649             s->bl_tree[curlen].Freq += count;
00650         } else if (curlen != 0) {
00651             if (curlen != prevlen) s->bl_tree[curlen].Freq++;
00652             s->bl_tree[REP_3_6].Freq++;
00653         } else if (count <= 10) {
00654             s->bl_tree[REPZ_3_10].Freq++;
00655         } else {
00656             s->bl_tree[REPZ_11_138].Freq++;
00657         }
00658         count = 0; prevlen = curlen;
00659         if (nextlen == 0) {
00660             max_count = 138, min_count = 3;
00661         } else if (curlen == nextlen) {
00662             max_count = 6, min_count = 3;
00663         } else {
00664             max_count = 7, min_count = 4;
00665         }
00666     }
00667 }
00668
00669 /* ===========================================================================
00670  * Send a literal or distance tree in compressed form, using the codes in
00671  * bl_tree.
00672  */
00673 local void send_tree (s, tree, max_code)
00674     deflate_state *s;
00675     ct_data *tree; /* the tree to be scanned */
00676     int max_code;       /* and its largest code of non zero frequency */
00677 {
00678     int n;                     /* iterates over all tree elements */
00679     int prevlen = -1;          /* last emitted length */
00680     int curlen;                /* length of current code */
00681     int nextlen = tree[0].Len; /* length of next code */
00682     int count = 0;             /* repeat count of the current code */
00683     int max_count = 7;         /* max repeat count */
00684     int min_count = 4;         /* min repeat count */
00685
00686     /* tree[max_code+1].Len = -1; */  /* guard already set */
00687     if (nextlen == 0) max_count = 138, min_count = 3;
00688
00689     for (n = 0; n <= max_code; n++) {
00690         curlen = nextlen; nextlen = tree[n+1].Len;
00691         if (++count < max_count && curlen == nextlen) {
00692             continue;
00693         } else if (count < min_count) {
00694             do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
00695
00696         } else if (curlen != 0) {
00697             if (curlen != prevlen) {
00698                 send_code(s, curlen, s->bl_tree); count--;
00699             }
00700             Assert(count >= 3 && count <= 6, " 3_6?");
00701             send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
00702
00703         } else if (count <= 10) {
00704             send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
00705
00706         } else {
00707             send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
00708         }
00709         count = 0; prevlen = curlen;
00710         if (nextlen == 0) {
00711             max_count = 138, min_count = 3;
00712         } else if (curlen == nextlen) {
00713             max_count = 6, min_count = 3;
00714         } else {
00715             max_count = 7, min_count = 4;
00716         }
00717     }
00718 }
00719
00720 /* ===========================================================================
00721  * Construct the Huffman tree for the bit lengths and return the index in
00722  * bl_order of the last bit length code to send.
00723  */
00724 local int build_bl_tree(s)
00725     deflate_state *s;
00726 {
00727     int max_blindex;  /* index of last bit length code of non zero freq */
00728
00729     /* Determine the bit length frequencies for literal and distance trees */
00730     scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
00731     scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
00732
00733     /* Build the bit length tree: */
00734     build_tree(s, (tree_desc *)(&(s->bl_desc)));
00735     /* opt_len now includes the length of the tree representations, except
00736      * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
00737      */
00738
00739     /* Determine the number of bit length codes to send. The pkzip format
00740      * requires that at least 4 bit length codes be sent. (appnote.txt says
00741      * 3 but the actual value used is 4.)
00742      */
00743     for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
00744         if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
00745     }
00746     /* Update opt_len to include the bit length tree and counts */
00747     s->opt_len += 3*(max_blindex+1) + 5+5+4;
00748     Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
00749             s->opt_len, s->static_len));
00750
00751     return max_blindex;
00752 }
00753
00754 /* ===========================================================================
00755  * Send the header for a block using dynamic Huffman trees: the counts, the
00756  * lengths of the bit length codes, the literal tree and the distance tree.
00757  * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
00758  */
00759 local void send_all_trees(s, lcodes, dcodes, blcodes)
00760     deflate_state *s;
00761     int lcodes, dcodes, blcodes; /* number of codes for each tree */
00762 {
00763     int rank;                    /* index in bl_order */
00764
00765     Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
00766     Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
00767             "too many codes");
00768     Tracev((stderr, "\nbl counts: "));
00769     send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
00770     send_bits(s, dcodes-1,   5);
00771     send_bits(s, blcodes-4,  4); /* not -3 as stated in appnote.txt */
00772     for (rank = 0; rank < blcodes; rank++) {
00773         Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
00774         send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
00775     }
00776     Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
00777
00778     send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
00779     Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
00780
00781     send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
00782     Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
00783 }
00784
00785 /* ===========================================================================
00786  * Send a stored block
00787  */
00788 void _tr_stored_block(s, buf, stored_len, eof)
00789     deflate_state *s;
00790     charf *buf;       /* input block */
00791     ulg stored_len;   /* length of input block */
00792     int eof;          /* true if this is the last block for a file */
00793 {
00794     send_bits(s, (STORED_BLOCK<<1)+eof, 3);  /* send block type */
00795     s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
00796     s->compressed_len += (stored_len + 4) << 3;
00797
00798     copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
00799 }
00800
00801 /* ===========================================================================
00802  * Send one empty static block to give enough lookahead for inflate.
00803  * This takes 10 bits, of which 7 may remain in the bit buffer.
00804  * The current inflate code requires 9 bits of lookahead. If the
00805  * last two codes for the previous block (real code plus EOB) were coded
00806  * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
00807  * the last real code. In this case we send two empty static blocks instead
00808  * of one. (There are no problems if the previous block is stored or fixed.)
00809  * To simplify the code, we assume the worst case of last real code encoded
00810  * on one bit only.
00811  */
00812 void _tr_align(s)
00813     deflate_state *s;
00814 {
00815     send_bits(s, STATIC_TREES<<1, 3);
00816     send_code(s, END_BLOCK, static_ltree);
00817     s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
00818     bi_flush(s);
00819     /* Of the 10 bits for the empty block, we have already sent
00820      * (10 - bi_valid) bits. The lookahead for the last real code (before
00821      * the EOB of the previous block) was thus at least one plus the length
00822      * of the EOB plus what we have just sent of the empty static block.
00823      */
00824     if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
00825         send_bits(s, STATIC_TREES<<1, 3);
00826         send_code(s, END_BLOCK, static_ltree);
00827         s->compressed_len += 10L;
00828         bi_flush(s);
00829     }
00830     s->last_eob_len = 7;
00831 }
00832
00833 /* ===========================================================================
00834  * Determine the best encoding for the current block: dynamic trees, static
00835  * trees or store, and output the encoded block to the zip file. This function
00836  * returns the total compressed length for the file so far.
00837  */
00838 ulg _tr_flush_block(s, buf, stored_len, eof)
00839     deflate_state *s;
00840     charf *buf;       /* input block, or NULL if too old */
00841     ulg stored_len;   /* length of input block */
00842     int eof;          /* true if this is the last block for a file */
00843 {
00844     ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
00845     int max_blindex = 0;  /* index of last bit length code of non zero freq */
00846
00847     /* Build the Huffman trees unless a stored block is forced */
00848     if (s->level > 0) {
00849
00850      /* Check if the file is ascii or binary */
00851     if (s->data_type == Z_UNKNOWN) set_data_type(s);
00852
00853     /* Construct the literal and distance trees */
00854     build_tree(s, (tree_desc *)(&(s->l_desc)));
00855     Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
00856         s->static_len));
00857
00858     build_tree(s, (tree_desc *)(&(s->d_desc)));
00859     Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
00860         s->static_len));
00861     /* At this point, opt_len and static_len are the total bit lengths of
00862      * the compressed block data, excluding the tree representations.
00863      */
00864
00865     /* Build the bit length tree for the above two trees, and get the index
00866      * in bl_order of the last bit length code to send.
00867      */
00868     max_blindex = build_bl_tree(s);
00869
00870     /* Determine the best encoding. Compute first the block length in bytes*/
00871     opt_lenb = (s->opt_len+3+7)>>3;
00872     static_lenb = (s->static_len+3+7)>>3;
00873
00874     Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
00875         opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
00876         s->last_lit));
00877
00878     if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
00879
00880     } else {
00881         Assert(buf != (char*)0, "lost buf");
00882     opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
00883     }
00884
00885     /* If compression failed and this is the first and last block,
00886      * and if the .zip file can be seeked (to rewrite the local header),
00887      * the whole file is transformed into a stored file:
00888      */
00889 #ifdef STORED_FILE_OK
00890 #  ifdef FORCE_STORED_FILE
00891     if (eof && s->compressed_len == 0L) { /* force stored file */
00892 #  else
00893     if (stored_len <= opt_lenb && eof && s->compressed_len==0L && seekable()) {
00894 #  endif
00895         /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
00896         if (buf == (charf*)0) error ("block vanished");
00897
00898         copy_block(buf, (unsigned)stored_len, 0); /* without header */
00899         s->compressed_len = stored_len << 3;
00900         s->method = STORED;
00901     } else
00902 #endif /* STORED_FILE_OK */
00903
00904 #ifdef FORCE_STORED
00905     if (buf != (char*)0) { /* force stored block */
00906 #else
00907     if (stored_len+4 <= opt_lenb && buf != (char*)0) {
00908                        /* 4: two words for the lengths */
00909 #endif
00910         /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
00911          * Otherwise we can't have processed more than WSIZE input bytes since
00912          * the last block flush, because compression would have been
00913          * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
00914          * transform a block into a stored block.
00915          */
00916         _tr_stored_block(s, buf, stored_len, eof);
00917
00918 #ifdef FORCE_STATIC
00919     } else if (static_lenb >= 0) { /* force static trees */
00920 #else
00921     } else if (static_lenb == opt_lenb) {
00922 #endif
00923         send_bits(s, (STATIC_TREES<<1)+eof, 3);
00924         compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
00925         s->compressed_len += 3 + s->static_len;
00926     } else {
00927         send_bits(s, (DYN_TREES<<1)+eof, 3);
00928         send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
00929                        max_blindex+1);
00930         compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
00931         s->compressed_len += 3 + s->opt_len;
00932     }
00933     Assert (s->compressed_len == s->bits_sent, "bad compressed size");
00934     init_block(s);
00935
00936     if (eof) {
00937         bi_windup(s);
00938         s->compressed_len += 7;  /* align on byte boundary */
00939     }
00940     Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
00941            s->compressed_len-7*eof));
00942
00943     return s->compressed_len >> 3;
00944 }
00945
00946 /* ===========================================================================
00947  * Save the match info and tally the frequency counts. Return true if
00948  * the current block must be flushed.
00949  */
00950 int _tr_tally (s, dist, lc)
00951     deflate_state *s;
00952     unsigned dist;  /* distance of matched string */
00953     unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */
00954 {
00955     s->d_buf[s->last_lit] = (ush)dist;
00956     s->l_buf[s->last_lit++] = (uch)lc;
00957     if (dist == 0) {
00958         /* lc is the unmatched char */
00959         s->dyn_ltree[lc].Freq++;
00960     } else {
00961         s->matches++;
00962         /* Here, lc is the match length - MIN_MATCH */
00963         dist--;             /* dist = match distance - 1 */
00964         Assert((ush)dist < (ush)MAX_DIST(s) &&
00965                (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
00966                (ush)d_code(dist) < (ush)D_CODES,  "_tr_tally: bad match");
00967
00968         s->dyn_ltree[length_code[lc]+LITERALS+1].Freq++;
00969         s->dyn_dtree[d_code(dist)].Freq++;
00970     }
00971
00972     /* Try to guess if it is profitable to stop the current block here */
00973     if (s->level > 2 && (s->last_lit & 0xfff) == 0) {
00974         /* Compute an upper bound for the compressed length */
00975         ulg out_length = (ulg)s->last_lit*8L;
00976         ulg in_length = (ulg)((long)s->strstart - s->block_start);
00977         int dcode;
00978         for (dcode = 0; dcode < D_CODES; dcode++) {
00979             out_length += (ulg)s->dyn_dtree[dcode].Freq *
00980                 (5L+extra_dbits[dcode]);
00981         }
00982         out_length >>= 3;
00983         Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
00984                s->last_lit, in_length, out_length,
00985                100L - out_length*100L/in_length));
00986         if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
00987     }
00988     return (s->last_lit == s->lit_bufsize-1);
00989     /* We avoid equality with lit_bufsize because of wraparound at 64K
00990      * on 16 bit machines and because stored blocks are restricted to
00991      * 64K-1 bytes.
00992      */
00993 }
00994
00995 /* ===========================================================================
00996  * Send the block data compressed using the given Huffman trees
00997  */
00998 local void compress_block(s, ltree, dtree)
00999     deflate_state *s;
01000     ct_data *ltree; /* literal tree */
01001     ct_data *dtree; /* distance tree */
01002 {
01003     unsigned dist;      /* distance of matched string */
01004     int lc;             /* match length or unmatched char (if dist == 0) */
01005     unsigned lx = 0;    /* running index in l_buf */
01006     unsigned code;      /* the code to send */
01007     int extra;          /* number of extra bits to send */
01008
01009     if (s->last_lit != 0) do {
01010         dist = s->d_buf[lx];
01011         lc = s->l_buf[lx++];
01012         if (dist == 0) {
01013             send_code(s, lc, ltree); /* send a literal byte */
01014             Tracecv(isgraph(lc), (stderr," '%c' ", lc));
01015         } else {
01016             /* Here, lc is the match length - MIN_MATCH */
01017             code = length_code[lc];
01018             send_code(s, code+LITERALS+1, ltree); /* send the length code */
01019             extra = extra_lbits[code];
01020             if (extra != 0) {
01021                 lc -= base_length[code];
01022                 send_bits(s, lc, extra);       /* send the extra length bits */
01023             }
01024             dist--; /* dist is now the match distance - 1 */
01025             code = d_code(dist);
01026             Assert (code < D_CODES, "bad d_code");
01027
01028             send_code(s, code, dtree);       /* send the distance code */
01029             extra = extra_dbits[code];
01030             if (extra != 0) {
01031                 dist -= base_dist[code];
01032                 send_bits(s, dist, extra);   /* send the extra distance bits */
01033             }
01034         } /* literal or match pair ? */
01035
01036         /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
01037         Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow");
01038
01039     } while (lx < s->last_lit);
01040
01041     send_code(s, END_BLOCK, ltree);
01042     s->last_eob_len = ltree[END_BLOCK].Len;
01043 }
01044
01045 /* ===========================================================================
01046  * Set the data type to ASCII or BINARY, using a crude approximation:
01047  * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
01048  * IN assertion: the fields freq of dyn_ltree are set and the total of all
01049  * frequencies does not exceed 64K (to fit in an int on 16 bit machines).
01050  */
01051 local void set_data_type(s)
01052     deflate_state *s;
01053 {
01054     int n = 0;
01055     unsigned ascii_freq = 0;
01056     unsigned bin_freq = 0;
01057     while (n < 7)        bin_freq += s->dyn_ltree[n++].Freq;
01058     while (n < 128)    ascii_freq += s->dyn_ltree[n++].Freq;
01059     while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
01060     s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII);
01061 }
01062
01063 /* ===========================================================================
01064  * Reverse the first len bits of a code, using straightforward code (a faster
01065  * method would use a table)
01066  * IN assertion: 1 <= len <= 15
01067  */
01068 local unsigned bi_reverse(code, len)
01069     unsigned code; /* the value to invert */
01070     int len;       /* its bit length */
01071 {
01072     register unsigned res = 0;
01073     do {
01074         res |= code & 1;
01075         code >>= 1, res <<= 1;
01076     } while (--len > 0);
01077     return res >> 1;
01078 }
01079
01080 /* ===========================================================================
01081  * Flush the bit buffer, keeping at most 7 bits in it.
01082  */
01083 local void bi_flush(s)
01084     deflate_state *s;
01085 {
01086     if (s->bi_valid == 16) {
01087         put_short(s, s->bi_buf);
01088         s->bi_buf = 0;
01089         s->bi_valid = 0;
01090     } else if (s->bi_valid >= 8) {
01091         put_byte(s, (Byte)s->bi_buf);
01092         s->bi_buf >>= 8;
01093         s->bi_valid -= 8;
01094     }
01095 }
01096
01097 /* ===========================================================================
01098  * Flush the bit buffer and align the output on a byte boundary
01099  */
01100 local void bi_windup(s)
01101     deflate_state *s;
01102 {
01103     if (s->bi_valid > 8) {
01104         put_short(s, s->bi_buf);
01105     } else if (s->bi_valid > 0) {
01106         put_byte(s, (Byte)s->bi_buf);
01107     }
01108     s->bi_buf = 0;
01109     s->bi_valid = 0;
01110 #ifdef DEBUG
01111     s->bits_sent = (s->bits_sent+7) & ~7;
01112 #endif
01113 }
01114
01115 /* ===========================================================================
01116  * Copy a stored block, storing first the length and its
01117  * one's complement if requested.
01118  */
01119 local void copy_block(s, buf, len, header)
01120     deflate_state *s;
01121     charf    *buf;    /* the input data */
01122     unsigned len;     /* its length */
01123     int      header;  /* true if block header must be written */
01124 {
01125     bi_windup(s);        /* align on byte boundary */
01126     s->last_eob_len = 8; /* enough lookahead for inflate */
01127
01128     if (header) {
01129         put_short(s, (ush)len);
01130         put_short(s, (ush)~len);
01131 #ifdef DEBUG
01132         s->bits_sent += 2*16;
01133 #endif
01134     }
01135 #ifdef DEBUG
01136     s->bits_sent += (ulg)len<<3;
01137 #endif
01138     while (len--) {
01139         put_byte(s, *buf++);
01140     }
01141 }
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/uncompr.c Source File

cvs-1.10/zlib/uncompr.c

Go to the documentation of this file.
00001 /* uncompr.c -- decompress a memory buffer
00002  * Copyright (C) 1995-1996 Jean-loup Gailly.
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* $Id: uncompr.c,v 1.8 1996/01/30 21:59:26 me Exp $ */
00007
00008 #include "zlib.h"
00009
00010 /* ===========================================================================
00011      Decompresses the source buffer into the destination buffer.  sourceLen is
00012    the byte length of the source buffer. Upon entry, destLen is the total
00013    size of the destination buffer, which must be large enough to hold the
00014    entire uncompressed data. (The size of the uncompressed data must have
00015    been saved previously by the compressor and transmitted to the decompressor
00016    by some mechanism outside the scope of this compression library.)
00017    Upon exit, destLen is the actual size of the compressed buffer.
00018      This function can be used to decompress a whole file at once if the
00019    input file is mmap'ed.
00020
00021      uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
00022    enough memory, Z_BUF_ERROR if there was not enough room in the output
00023    buffer, or Z_DATA_ERROR if the input data was corrupted.
00024 */
00025 int uncompress (dest, destLen, source, sourceLen)
00026     Bytef *dest;
00027     uLongf *destLen;
00028     const Bytef *source;
00029     uLong sourceLen;
00030 {
00031     z_stream stream;
00032     int err;
00033
00034     stream.next_in = (Bytef*)source;
00035     stream.avail_in = (uInt)sourceLen;
00036     /* Check for source > 64K on 16-bit machine: */
00037     if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
00038
00039     stream.next_out = dest;
00040     stream.avail_out = (uInt)*destLen;
00041     if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
00042
00043     stream.zalloc = (alloc_func)0;
00044     stream.zfree = (free_func)0;
00045
00046     err = inflateInit(&stream);
00047     if (err != Z_OK) return err;
00048
00049     err = inflate(&stream, Z_FINISH);
00050     if (err != Z_STREAM_END) {
00051         inflateEnd(&stream);
00052         return err;
00053     }
00054     *destLen = stream.total_out;
00055
00056     err = inflateEnd(&stream);
00057     return err;
00058 }
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/zconf.h Source File

cvs-1.10/zlib/zconf.h

Go to the documentation of this file.
00001 /* zconf.h -- configuration of the zlib compression library
00002  * Copyright (C) 1995-1996 Jean-loup Gailly.
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* $Id: zconf.h,v 1.20 1996/07/02 15:09:28 me Exp $ */
00007
00008 #ifndef _ZCONF_H
00009 #define _ZCONF_H
00010
00011 /*
00012  * If you *really* need a unique prefix for all types and library functions,
00013  * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
00014  */
00015 #ifdef Z_PREFIX
00016 #  define deflateInit_  z_deflateInit_
00017 #  define deflate   z_deflate
00018 #  define deflateEnd    z_deflateEnd
00019 #  define inflateInit_  z_inflateInit_
00020 #  define inflate   z_inflate
00021 #  define inflateEnd    z_inflateEnd
00022 #  define deflateInit2_ z_deflateInit2_
00023 #  define deflateSetDictionary z_deflateSetDictionary
00024 #  define deflateCopy   z_deflateCopy
00025 #  define deflateReset  z_deflateReset
00026 #  define deflateParams z_deflateParams
00027 #  define inflateInit2_ z_inflateInit2_
00028 #  define inflateSetDictionary z_inflateSetDictionary
00029 #  define inflateSync   z_inflateSync
00030 #  define inflateReset  z_inflateReset
00031 #  define compress  z_compress
00032 #  define uncompress    z_uncompress
00033 #  define adler32   z_adler32
00034 #  define crc32     z_crc32
00035 #  define get_crc_table z_get_crc_table
00036
00037 #  define Byte      z_Byte
00038 #  define uInt      z_uInt
00039 #  define uLong     z_uLong
00040 #  define Bytef         z_Bytef
00041 #  define charf     z_charf
00042 #  define intf      z_intf
00043 #  define uIntf     z_uIntf
00044 #  define uLongf    z_uLongf
00045 #  define voidpf    z_voidpf
00046 #  define voidp     z_voidp
00047 #endif
00048
00049 #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
00050 #  define WIN32
00051 #endif
00052 #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
00053 #  ifndef __32BIT__
00054 #    define __32BIT__
00055 #  endif
00056 #endif
00057 #if defined(__MSDOS__) && !defined(MSDOS)
00058 #  define MSDOS
00059 #endif
00060
00061 /*
00062  * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
00063  * than 64k bytes at a time (needed on systems with 16-bit int).
00064  */
00065 #if defined(MSDOS) && !defined(__32BIT__)
00066 #  define MAXSEG_64K
00067 #endif
00068 #ifdef MSDOS
00069 #  define UNALIGNED_OK
00070 #endif
00071
00072 #if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32))  && !defined(STDC)
00073 #  define STDC
00074 #endif
00075 #if (defined(__STDC__) || defined(__cplusplus)) && !defined(STDC)
00076 #  define STDC
00077 #endif
00078
00079 #ifndef STDC
00080 #  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
00081 #    define const
00082 #  endif
00083 #endif
00084
00085 /* Some Mac compilers merge all .h files incorrectly: */
00086 #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
00087 #  define NO_DUMMY_DECL
00088 #endif
00089
00090 /* Maximum value for memLevel in deflateInit2 */
00091 #ifndef MAX_MEM_LEVEL
00092 #  ifdef MAXSEG_64K
00093 #    define MAX_MEM_LEVEL 8
00094 #  else
00095 #    define MAX_MEM_LEVEL 9
00096 #  endif
00097 #endif
00098
00099 /* Maximum value for windowBits in deflateInit2 and inflateInit2 */
00100 #ifndef MAX_WBITS
00101 #  define MAX_WBITS   15 /* 32K LZ77 window */
00102 #endif
00103
00104 /* The memory requirements for deflate are (in bytes):
00105             1 << (windowBits+2)   +  1 << (memLevel+9)
00106  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
00107  plus a few kilobytes for small objects. For example, if you want to reduce
00108  the default memory requirements from 256K to 128K, compile with
00109      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
00110  Of course this will generally degrade compression (there's no free lunch).
00111
00112    The memory requirements for inflate are (in bytes) 1 << windowBits
00113  that is, 32K for windowBits=15 (default value) plus a few kilobytes
00114  for small objects.
00115 */
00116
00117                         /* Type declarations */
00118
00119 #ifndef OF /* function prototypes */
00120 #  ifdef STDC
00121 #    define OF(args)  args
00122 #  else
00123 #    define OF(args)  ()
00124 #  endif
00125 #endif
00126
00127 /* The following definitions for FAR are needed only for MSDOS mixed
00128  * model programming (small or medium model with some far allocations).
00129  * This was tested only with MSC; for other MSDOS compilers you may have
00130  * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
00131  * just define FAR to be empty.
00132  */
00133 #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
00134    /* MSC small or medium model */
00135 #  define SMALL_MEDIUM
00136 #  ifdef _MSC_VER
00137 #    define FAR __far
00138 #  else
00139 #    define FAR far
00140 #  endif
00141 #endif
00142 #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
00143 #  ifndef __32BIT__
00144 #    define SMALL_MEDIUM
00145 #    define FAR __far
00146 #  endif
00147 #endif
00148 #ifndef FAR
00149 #   define FAR
00150 #endif
00151
00152 typedef unsigned char  Byte;  /* 8 bits */
00153 typedef unsigned int   uInt;  /* 16 bits or more */
00154 typedef unsigned long  uLong; /* 32 bits or more */
00155
00156 #if defined(__BORLANDC__) && defined(SMALL_MEDIUM)
00157    /* Borland C/C++ ignores FAR inside typedef */
00158 #  define Bytef Byte FAR
00159 #else
00160    typedef Byte  FAR Bytef;
00161 #endif
00162 typedef char  FAR charf;
00163 typedef int   FAR intf;
00164 typedef uInt  FAR uIntf;
00165 typedef uLong FAR uLongf;
00166
00167 #ifdef STDC
00168    typedef void FAR *voidpf;
00169    typedef void     *voidp;
00170 #else
00171    typedef Byte FAR *voidpf;
00172    typedef Byte     *voidp;
00173 #endif
00174
00175
00176 /* Compile with -DZLIB_DLL for Windows DLL support */
00177 #if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL)
00178 #  include <windows.h>
00179 #  define EXPORT  WINAPI
00180 #else
00181 #  define EXPORT
00182 #endif
00183
00184 #endif /* _ZCONF_H */
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/zlib.h Source File

cvs-1.10/zlib/zlib.h

Go to the documentation of this file.
00001 /* zlib.h -- interface of the 'zlib' general purpose compression library
00002   version 1.0.4, Jul 24th, 1996.
00003
00004   Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler
00005
00006   This software is provided 'as-is', without any express or implied
00007   warranty.  In no event will the authors be held liable for any damages
00008   arising from the use of this software.
00009
00010   Permission is granted to anyone to use this software for any purpose,
00011   including commercial applications, and to alter it and redistribute it
00012   freely, subject to the following restrictions:
00013
00014   1. The origin of this software must not be misrepresented; you must not
00015      claim that you wrote the original software. If you use this software
00016      in a product, an acknowledgment in the product documentation would be
00017      appreciated but is not required.
00018   2. Altered source versions must be plainly marked as such, and must not be
00019      misrepresented as being the original software.
00020   3. This notice may not be removed or altered from any source distribution.
00021
00022   Jean-loup Gailly        Mark Adler
00023   gzip@prep.ai.mit.edu    madler@alumni.caltech.edu
00024
00025
00026   The data format used by the zlib library is described by RFCs (Request for
00027   Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
00028   (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
00029 */
00030
00031 #ifndef _ZLIB_H
00032 #define _ZLIB_H
00033
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037
00038 #include "zconf.h"
00039
00040 #define ZLIB_VERSION "1.0.4"
00041
00042 /*
00043      The 'zlib' compression library provides in-memory compression and
00044   decompression functions, including integrity checks of the uncompressed
00045   data.  This version of the library supports only one compression method
00046   (deflation) but other algorithms may be added later and will have the same
00047   stream interface.
00048
00049      For compression the application must provide the output buffer and
00050   may optionally provide the input buffer for optimization. For decompression,
00051   the application must provide the input buffer and may optionally provide
00052   the output buffer for optimization.
00053
00054      Compression can be done in a single step if the buffers are large
00055   enough (for example if an input file is mmap'ed), or can be done by
00056   repeated calls of the compression function.  In the latter case, the
00057   application must provide more input and/or consume the output
00058   (providing more output space) before each call.
00059
00060      The library does not install any signal handler. It is recommended to
00061   add at least a handler for SIGSEGV when decompressing; the library checks
00062   the consistency of the input data whenever possible but may go nuts
00063   for some forms of corrupted input.
00064 */
00065
00066 typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
00067 typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
00068
00069 struct internal_state;
00070
00071 typedef struct z_stream_s {
00072     Bytef    *next_in;  /* next input byte */
00073     uInt     avail_in;  /* number of bytes available at next_in */
00074     uLong    total_in;  /* total nb of input bytes read so far */
00075
00076     Bytef    *next_out; /* next output byte should be put there */
00077     uInt     avail_out; /* remaining free space at next_out */
00078     uLong    total_out; /* total nb of bytes output so far */
00079
00080     char     *msg;      /* last error message, NULL if no error */
00081     struct internal_state FAR *state; /* not visible by applications */
00082
00083     alloc_func zalloc;  /* used to allocate the internal state */
00084     free_func  zfree;   /* used to free the internal state */
00085     voidpf     opaque;  /* private data object passed to zalloc and zfree */
00086
00087     int     data_type;  /* best guess about the data type: ascii or binary */
00088     uLong   adler;      /* adler32 value of the uncompressed data */
00089     uLong   reserved;   /* reserved for future use */
00090 } z_stream;
00091
00092 typedef z_stream FAR *z_streamp;
00093
00094 /*
00095    The application must update next_in and avail_in when avail_in has
00096    dropped to zero. It must update next_out and avail_out when avail_out
00097    has dropped to zero. The application must initialize zalloc, zfree and
00098    opaque before calling the init function. All other fields are set by the
00099    compression library and must not be updated by the application.
00100
00101    The opaque value provided by the application will be passed as the first
00102    parameter for calls of zalloc and zfree. This can be useful for custom
00103    memory management. The compression library attaches no meaning to the
00104    opaque value.
00105
00106    zalloc must return Z_NULL if there is not enough memory for the object.
00107    On 16-bit systems, the functions zalloc and zfree must be able to allocate
00108    exactly 65536 bytes, but will not be required to allocate more than this
00109    if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
00110    pointers returned by zalloc for objects of exactly 65536 bytes *must*
00111    have their offset normalized to zero. The default allocation function
00112    provided by this library ensures this (see zutil.c). To reduce memory
00113    requirements and avoid any allocation of 64K objects, at the expense of
00114    compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
00115
00116    The fields total_in and total_out can be used for statistics or
00117    progress reports. After compression, total_in holds the total size of
00118    the uncompressed data and may be saved for use in the decompressor
00119    (particularly if the decompressor wants to decompress everything in
00120    a single step).
00121 */
00122
00123                         /* constants */
00124
00125 #define Z_NO_FLUSH      0
00126 #define Z_PARTIAL_FLUSH 1
00127 #define Z_SYNC_FLUSH    2
00128 #define Z_FULL_FLUSH    3
00129 #define Z_FINISH        4
00130 /* Allowed flush values; see deflate() below for details */
00131
00132 #define Z_OK            0
00133 #define Z_STREAM_END    1
00134 #define Z_NEED_DICT     2
00135 #define Z_ERRNO        (-1)
00136 #define Z_STREAM_ERROR (-2)
00137 #define Z_DATA_ERROR   (-3)
00138 #define Z_MEM_ERROR    (-4)
00139 #define Z_BUF_ERROR    (-5)
00140 #define Z_VERSION_ERROR (-6)
00141 /* Return codes for the compression/decompression functions. Negative
00142  * values are errors, positive values are used for special but normal events.
00143  */
00144
00145 #define Z_NO_COMPRESSION         0
00146 #define Z_BEST_SPEED             1
00147 #define Z_BEST_COMPRESSION       9
00148 #define Z_DEFAULT_COMPRESSION  (-1)
00149 /* compression levels */
00150
00151 #define Z_FILTERED            1
00152 #define Z_HUFFMAN_ONLY        2
00153 #define Z_DEFAULT_STRATEGY    0
00154 /* compression strategy; see deflateInit2() below for details */
00155
00156 #define Z_BINARY   0
00157 #define Z_ASCII    1
00158 #define Z_UNKNOWN  2
00159 /* Possible values of the data_type field */
00160
00161 #define Z_DEFLATED   8
00162 /* The deflate compression method (the only one supported in this version) */
00163
00164 #define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
00165
00166 #define zlib_version zlibVersion()
00167 /* for compatibility with versions < 1.0.2 */
00168
00169                         /* basic functions */
00170
00171 extern const char * EXPORT zlibVersion OF((void));
00172 /* The application can compare zlibVersion and ZLIB_VERSION for consistency.
00173    If the first character differs, the library code actually used is
00174    not compatible with the zlib.h header file used by the application.
00175    This check is automatically made by deflateInit and inflateInit.
00176  */
00177
00178 /*
00179 extern int EXPORT deflateInit OF((z_streamp strm, int level));
00180
00181      Initializes the internal stream state for compression. The fields
00182    zalloc, zfree and opaque must be initialized before by the caller.
00183    If zalloc and zfree are set to Z_NULL, deflateInit updates them to
00184    use default allocation functions.
00185
00186      The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
00187    1 gives best speed, 9 gives best compression, 0 gives no compression at
00188    all (the input data is simply copied a block at a time).
00189    Z_DEFAULT_COMPRESSION requests a default compromise between speed and
00190    compression (currently equivalent to level 6).
00191
00192      deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
00193    enough memory, Z_STREAM_ERROR if level is not a valid compression level,
00194    Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
00195    with the version assumed by the caller (ZLIB_VERSION).
00196    msg is set to null if there is no error message.  deflateInit does not
00197    perform any compression: this will be done by deflate().
00198 */
00199
00200
00201 extern int EXPORT deflate OF((z_streamp strm, int flush));
00202 /*
00203   Performs one or both of the following actions:
00204
00205   - Compress more input starting at next_in and update next_in and avail_in
00206     accordingly. If not all input can be processed (because there is not
00207     enough room in the output buffer), next_in and avail_in are updated and
00208     processing will resume at this point for the next call of deflate().
00209
00210   - Provide more output starting at next_out and update next_out and avail_out
00211     accordingly. This action is forced if the parameter flush is non zero.
00212     Forcing flush frequently degrades the compression ratio, so this parameter
00213     should be set only when necessary (in interactive applications).
00214     Some output may be provided even if flush is not set.
00215
00216   Before the call of deflate(), the application should ensure that at least
00217   one of the actions is possible, by providing more input and/or consuming
00218   more output, and updating avail_in or avail_out accordingly; avail_out
00219   should never be zero before the call. The application can consume the
00220   compressed output when it wants, for example when the output buffer is full
00221   (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
00222   and with zero avail_out, it must be called again after making room in the
00223   output buffer because there might be more output pending.
00224
00225     If the parameter flush is set to Z_PARTIAL_FLUSH, the current compression
00226   block is terminated and flushed to the output buffer so that the
00227   decompressor can get all input data available so far. For method 9, a future
00228   variant on method 8, the current block will be flushed but not terminated.
00229   Z_SYNC_FLUSH has the same effect as partial flush except that the compressed
00230   output is byte aligned (the compressor can clear its internal bit buffer)
00231   and the current block is always terminated; this can be useful if the
00232   compressor has to be restarted from scratch after an interruption (in which
00233   case the internal state of the compressor may be lost).
00234     If flush is set to Z_FULL_FLUSH, the compression block is terminated, a
00235   special marker is output and the compression dictionary is discarded; this
00236   is useful to allow the decompressor to synchronize if one compressed block
00237   has been damaged (see inflateSync below).  Flushing degrades compression and
00238   so should be used only when necessary.  Using Z_FULL_FLUSH too often can
00239   seriously degrade the compression. If deflate returns with avail_out == 0,
00240   this function must be called again with the same value of the flush
00241   parameter and more output space (updated avail_out), until the flush is
00242   complete (deflate returns with non-zero avail_out).
00243
00244     If the parameter flush is set to Z_FINISH, pending input is processed,
00245   pending output is flushed and deflate returns with Z_STREAM_END if there
00246   was enough output space; if deflate returns with Z_OK, this function must be
00247   called again with Z_FINISH and more output space (updated avail_out) but no
00248   more input data, until it returns with Z_STREAM_END or an error. After
00249   deflate has returned Z_STREAM_END, the only possible operations on the
00250   stream are deflateReset or deflateEnd.
00251
00252     Z_FINISH can be used immediately after deflateInit if all the compression
00253   is to be done in a single step. In this case, avail_out must be at least
00254   0.1% larger than avail_in plus 12 bytes.  If deflate does not return
00255   Z_STREAM_END, then it must be called again as described above.
00256
00257     deflate() may update data_type if it can make a good guess about
00258   the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
00259   binary. This field is only for information purposes and does not affect
00260   the compression algorithm in any manner.
00261
00262     deflate() returns Z_OK if some progress has been made (more input
00263   processed or more output produced), Z_STREAM_END if all input has been
00264   consumed and all output has been produced (only when flush is set to
00265   Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
00266   if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible.
00267 */
00268
00269
00270 extern int EXPORT deflateEnd OF((z_streamp strm));
00271 /*
00272      All dynamically allocated data structures for this stream are freed.
00273    This function discards any unprocessed input and does not flush any
00274    pending output.
00275
00276      deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
00277    stream state was inconsistent, Z_DATA_ERROR if the stream was freed
00278    prematurely (some input or output was discarded). In the error case,
00279    msg may be set but then points to a static string (which must not be
00280    deallocated).
00281 */
00282
00283
00284 /*
00285 extern int EXPORT inflateInit OF((z_streamp strm));
00286
00287      Initializes the internal stream state for decompression. The fields
00288    zalloc, zfree and opaque must be initialized before by the caller.  If
00289    zalloc and zfree are set to Z_NULL, inflateInit updates them to use default
00290    allocation functions.
00291
00292      inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
00293    enough memory, Z_VERSION_ERROR if the zlib library version is incompatible
00294    with the version assumed by the caller.  msg is set to null if there is no
00295    error message. inflateInit does not perform any decompression: this will be
00296    done by inflate().
00297 */
00298
00299
00300 extern int EXPORT inflate OF((z_streamp strm, int flush));
00301 /*
00302   Performs one or both of the following actions:
00303
00304   - Decompress more input starting at next_in and update next_in and avail_in
00305     accordingly. If not all input can be processed (because there is not
00306     enough room in the output buffer), next_in is updated and processing
00307     will resume at this point for the next call of inflate().
00308
00309   - Provide more output starting at next_out and update next_out and avail_out
00310     accordingly.  inflate() provides as much output as possible, until there
00311     is no more input data or no more space in the output buffer (see below
00312     about the flush parameter).
00313
00314   Before the call of inflate(), the application should ensure that at least
00315   one of the actions is possible, by providing more input and/or consuming
00316   more output, and updating the next_* and avail_* values accordingly.
00317   The application can consume the uncompressed output when it wants, for
00318   example when the output buffer is full (avail_out == 0), or after each
00319   call of inflate(). If inflate returns Z_OK and with zero avail_out, it
00320   must be called again after making room in the output buffer because there
00321   might be more output pending.
00322
00323     If the parameter flush is set to Z_PARTIAL_FLUSH, inflate flushes as much
00324   output as possible to the output buffer. The flushing behavior of inflate is
00325   not specified for values of the flush parameter other than Z_PARTIAL_FLUSH
00326   and Z_FINISH, but the current implementation actually flushes as much output
00327   as possible anyway.
00328
00329     inflate() should normally be called until it returns Z_STREAM_END or an
00330   error. However if all decompression is to be performed in a single step
00331   (a single call of inflate), the parameter flush should be set to
00332   Z_FINISH. In this case all pending input is processed and all pending
00333   output is flushed; avail_out must be large enough to hold all the
00334   uncompressed data. (The size of the uncompressed data may have been saved
00335   by the compressor for this purpose.) The next operation on this stream must
00336   be inflateEnd to deallocate the decompression state. The use of Z_FINISH
00337   is never required, but can be used to inform inflate that a faster routine
00338   may be used for the single inflate() call.
00339
00340     inflate() returns Z_OK if some progress has been made (more input
00341   processed or more output produced), Z_STREAM_END if the end of the
00342   compressed data has been reached and all uncompressed output has been
00343   produced, Z_NEED_DICT if a preset dictionary is needed at this point (see
00344   inflateSetDictionary below), Z_DATA_ERROR if the input data was corrupted,
00345   Z_STREAM_ERROR if the stream structure was inconsistent (for example if
00346   next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
00347   Z_BUF_ERROR if no progress is possible or if there was not enough room in
00348   the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the
00349   application may then call inflateSync to look for a good compression block.
00350   In the Z_NEED_DICT case, strm->adler is set to the Adler32 value of the
00351   dictionary chosen by the compressor.
00352 */
00353
00354
00355 extern int EXPORT inflateEnd OF((z_streamp strm));
00356 /*
00357      All dynamically allocated data structures for this stream are freed.
00358    This function discards any unprocessed input and does not flush any
00359    pending output.
00360
00361      inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
00362    was inconsistent. In the error case, msg may be set but then points to a
00363    static string (which must not be deallocated).
00364 */
00365
00366                         /* Advanced functions */
00367
00368 /*
00369     The following functions are needed only in some special applications.
00370 */
00371
00372 /*
00373 extern int EXPORT deflateInit2 OF((z_streamp strm,
00374                                    int  level,
00375                                    int  method,
00376                                    int  windowBits,
00377                                    int  memLevel,
00378                                    int  strategy));
00379
00380      This is another version of deflateInit with more compression options. The
00381    fields next_in, zalloc, zfree and opaque must be initialized before by
00382    the caller.
00383
00384      The method parameter is the compression method. It must be Z_DEFLATED in
00385    this version of the library. (Method 9 will allow a 64K history buffer and
00386    partial block flushes.)
00387
00388      The windowBits parameter is the base two logarithm of the window size
00389    (the size of the history buffer).  It should be in the range 8..15 for this
00390    version of the library (the value 16 will be allowed for method 9). Larger
00391    values of this parameter result in better compression at the expense of
00392    memory usage. The default value is 15 if deflateInit is used instead.
00393
00394      The memLevel parameter specifies how much memory should be allocated
00395    for the internal compression state. memLevel=1 uses minimum memory but
00396    is slow and reduces compression ratio; memLevel=9 uses maximum memory
00397    for optimal speed. The default value is 8. See zconf.h for total memory
00398    usage as a function of windowBits and memLevel.
00399
00400      The strategy parameter is used to tune the compression algorithm. Use the
00401    value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
00402    filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
00403    string match).  Filtered data consists mostly of small values with a
00404    somewhat random distribution. In this case, the compression algorithm is
00405    tuned to compress them better. The effect of Z_FILTERED is to force more
00406    Huffman coding and less string matching; it is somewhat intermediate
00407    between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
00408    the compression ratio but not the correctness of the compressed output even
00409    if it is not set appropriately.
00410
00411      If next_in is not null, the library will use this buffer to hold also
00412    some history information; the buffer must either hold the entire input
00413    data, or have at least 1<<(windowBits+1) bytes and be writable. If next_in
00414    is null, the library will allocate its own history buffer (and leave next_in
00415    null). next_out need not be provided here but must be provided by the
00416    application for the next call of deflate().
00417
00418      If the history buffer is provided by the application, next_in must
00419    must never be changed by the application since the compressor maintains
00420    information inside this buffer from call to call; the application
00421    must provide more input only by increasing avail_in. next_in is always
00422    reset by the library in this case.
00423
00424       deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
00425    not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as
00426    an invalid method). msg is set to null if there is no error message.
00427    deflateInit2 does not perform any compression: this will be done by
00428    deflate().
00429 */
00430
00431 extern int EXPORT deflateSetDictionary OF((z_streamp strm,
00432                                            const Bytef *dictionary,
00433                            uInt  dictLength));
00434 /*
00435      Initializes the compression dictionary (history buffer) from the given
00436    byte sequence without producing any compressed output. This function must
00437    be called immediately after deflateInit or deflateInit2, before any call
00438    of deflate. The compressor and decompressor must use exactly the same
00439    dictionary (see inflateSetDictionary).
00440      The dictionary should consist of strings (byte sequences) that are likely
00441    to be encountered later in the data to be compressed, with the most commonly
00442    used strings preferably put towards the end of the dictionary. Using a
00443    dictionary is most useful when the data to be compressed is short and
00444    can be predicted with good accuracy; the data can then be compressed better
00445    than with the default empty dictionary. In this version of the library,
00446    only the last 32K bytes of the dictionary are used.
00447      Upon return of this function, strm->adler is set to the Adler32 value
00448    of the dictionary; the decompressor may later use this value to determine
00449    which dictionary has been used by the compressor. (The Adler32 value
00450    applies to the whole dictionary even if only a subset of the dictionary is
00451    actually used by the compressor.)
00452
00453      deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
00454    parameter is invalid (such as NULL dictionary) or the stream state
00455    is inconsistent (for example if deflate has already been called for this
00456    stream). deflateSetDictionary does not perform any compression: this will
00457    be done by deflate().
00458 */
00459
00460 extern int EXPORT deflateCopy OF((z_streamp dest,
00461                                   z_streamp source));
00462 /*
00463      Sets the destination stream as a complete copy of the source stream.  If
00464    the source stream is using an application-supplied history buffer, a new
00465    buffer is allocated for the destination stream.  The compressed output
00466    buffer is always application-supplied. It's the responsibility of the
00467    application to provide the correct values of next_out and avail_out for the
00468    next call of deflate.
00469
00470      This function can be useful when several compression strategies will be
00471    tried, for example when there are several ways of pre-processing the input
00472    data with a filter. The streams that will be discarded should then be freed
00473    by calling deflateEnd.  Note that deflateCopy duplicates the internal
00474    compression state which can be quite large, so this strategy is slow and
00475    can consume lots of memory.
00476
00477      deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
00478    enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
00479    (such as zalloc being NULL). msg is left unchanged in both source and
00480    destination.
00481 */
00482
00483 extern int EXPORT deflateReset OF((z_streamp strm));
00484 /*
00485      This function is equivalent to deflateEnd followed by deflateInit,
00486    but does not free and reallocate all the internal compression state.
00487    The stream will keep the same compression level and any other attributes
00488    that may have been set by deflateInit2.
00489
00490       deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
00491    stream state was inconsistent (such as zalloc or state being NULL).
00492 */
00493
00494 extern int EXPORT deflateParams OF((z_streamp strm, int level, int strategy));
00495 /*
00496      Dynamically update the compression level and compression strategy.
00497    This can be used to switch between compression and straight copy of
00498    the input data, or to switch to a different kind of input data requiring
00499    a different strategy. If the compression level is changed, the input
00500    available so far is compressed with the old level (and may be flushed);
00501    the new level will take effect only at the next call of deflate().
00502
00503      Before the call of deflateParams, the stream state must be set as for
00504    a call of deflate(), since the currently available input may have to
00505    be compressed and flushed. In particular, strm->avail_out must be non-zero.
00506
00507      deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
00508    stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
00509    if strm->avail_out was zero.
00510 */
00511
00512 /*
00513 extern int EXPORT inflateInit2 OF((z_streamp strm,
00514                                    int  windowBits));
00515
00516      This is another version of inflateInit with more compression options. The
00517    fields next_out, zalloc, zfree and opaque must be initialized before by
00518    the caller.
00519
00520      The windowBits parameter is the base two logarithm of the maximum window
00521    size (the size of the history buffer).  It should be in the range 8..15 for
00522    this version of the library (the value 16 will be allowed soon). The
00523    default value is 15 if inflateInit is used instead. If a compressed stream
00524    with a larger window size is given as input, inflate() will return with
00525    the error code Z_DATA_ERROR instead of trying to allocate a larger window.
00526
00527      If next_out is not null, the library will use this buffer for the history
00528    buffer; the buffer must either be large enough to hold the entire output
00529    data, or have at least 1<<windowBits bytes.  If next_out is null, the
00530    library will allocate its own buffer (and leave next_out null). next_in
00531    need not be provided here but must be provided by the application for the
00532    next call of inflate().
00533
00534      If the history buffer is provided by the application, next_out must
00535    never be changed by the application since the decompressor maintains
00536    history information inside this buffer from call to call; the application
00537    can only reset next_out to the beginning of the history buffer when
00538    avail_out is zero and all output has been consumed.
00539
00540       inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
00541    not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as
00542    windowBits < 8). msg is set to null if there is no error message.
00543    inflateInit2 does not perform any decompression: this will be done by
00544    inflate().
00545 */
00546
00547 extern int EXPORT inflateSetDictionary OF((z_streamp strm,
00548                            const Bytef *dictionary,
00549                        uInt  dictLength));
00550 /*
00551      Initializes the decompression dictionary (history buffer) from the given
00552    uncompressed byte sequence. This function must be called immediately after
00553    a call of inflate if this call returned Z_NEED_DICT. The dictionary chosen
00554    by the compressor can be determined from the Adler32 value returned by this
00555    call of inflate. The compressor and decompressor must use exactly the same
00556    dictionary (see deflateSetDictionary).
00557
00558      inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
00559    parameter is invalid (such as NULL dictionary) or the stream state is
00560    inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
00561    expected one (incorrect Adler32 value). inflateSetDictionary does not
00562    perform any decompression: this will be done by subsequent calls of
00563    inflate().
00564 */
00565
00566 extern int EXPORT inflateSync OF((z_streamp strm));
00567 /*
00568     Skips invalid compressed data until the special marker (see deflate()
00569   above) can be found, or until all available input is skipped. No output
00570   is provided.
00571
00572     inflateSync returns Z_OK if the special marker has been found, Z_BUF_ERROR
00573   if no more input was provided, Z_DATA_ERROR if no marker has been found,
00574   or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
00575   case, the application may save the current current value of total_in which
00576   indicates where valid compressed data was found. In the error case, the
00577   application may repeatedly call inflateSync, providing more input each time,
00578   until success or end of the input data.
00579 */
00580
00581 extern int EXPORT inflateReset OF((z_streamp strm));
00582 /*
00583      This function is equivalent to inflateEnd followed by inflateInit,
00584    but does not free and reallocate all the internal decompression state.
00585    The stream will keep attributes that may have been set by inflateInit2.
00586
00587       inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
00588    stream state was inconsistent (such as zalloc or state being NULL).
00589 */
00590
00591
00592                         /* utility functions */
00593
00594 /*
00595      The following utility functions are implemented on top of the
00596    basic stream-oriented functions. To simplify the interface, some
00597    default options are assumed (compression level, window size,
00598    standard memory allocation functions). The source code of these
00599    utility functions can easily be modified if you need special options.
00600 */
00601
00602 extern int EXPORT compress OF((Bytef *dest,   uLongf *destLen,
00603                    const Bytef *source, uLong sourceLen));
00604 /*
00605      Compresses the source buffer into the destination buffer.  sourceLen is
00606    the byte length of the source buffer. Upon entry, destLen is the total
00607    size of the destination buffer, which must be at least 0.1% larger than
00608    sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
00609    compressed buffer.
00610      This function can be used to compress a whole file at once if the
00611    input file is mmap'ed.
00612      compress returns Z_OK if success, Z_MEM_ERROR if there was not
00613    enough memory, Z_BUF_ERROR if there was not enough room in the output
00614    buffer.
00615 */
00616
00617 extern int EXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
00618                  const Bytef *source, uLong sourceLen));
00619 /*
00620      Decompresses the source buffer into the destination buffer.  sourceLen is
00621    the byte length of the source buffer. Upon entry, destLen is the total
00622    size of the destination buffer, which must be large enough to hold the
00623    entire uncompressed data. (The size of the uncompressed data must have
00624    been saved previously by the compressor and transmitted to the decompressor
00625    by some mechanism outside the scope of this compression library.)
00626    Upon exit, destLen is the actual size of the compressed buffer.
00627      This function can be used to decompress a whole file at once if the
00628    input file is mmap'ed.
00629
00630      uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
00631    enough memory, Z_BUF_ERROR if there was not enough room in the output
00632    buffer, or Z_DATA_ERROR if the input data was corrupted.
00633 */
00634
00635
00636 typedef voidp gzFile;
00637
00638 extern gzFile EXPORT gzopen  OF((const char *path, const char *mode));
00639 /*
00640      Opens a gzip (.gz) file for reading or writing. The mode parameter
00641    is as in fopen ("rb" or "wb") but can also include a compression level
00642    ("wb9").  gzopen can be used to read a file which is not in gzip format;
00643    in this case gzread will directly read from the file without decompression.
00644      gzopen returns NULL if the file could not be opened or if there was
00645    insufficient memory to allocate the (de)compression state; errno
00646    can be checked to distinguish the two cases (if errno is zero, the
00647    zlib error is Z_MEM_ERROR).
00648 */
00649
00650 extern gzFile EXPORT gzdopen  OF((int fd, const char *mode));
00651 /*
00652      gzdopen() associates a gzFile with the file descriptor fd.  File
00653    descriptors are obtained from calls like open, dup, creat, pipe or
00654    fileno (in the file has been previously opened with fopen).
00655    The mode parameter is as in gzopen.
00656      The next call of gzclose on the returned gzFile will also close the
00657    file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
00658    descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
00659      gzdopen returns NULL if there was insufficient memory to allocate
00660    the (de)compression state.
00661 */
00662
00663 extern int EXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
00664 /*
00665      Reads the given number of uncompressed bytes from the compressed file.
00666    If the input file was not in gzip format, gzread copies the given number
00667    of bytes into the buffer.
00668      gzread returns the number of uncompressed bytes actually read (0 for
00669    end of file, -1 for error). */
00670
00671 extern int EXPORT    gzwrite OF((gzFile file, const voidp buf, unsigned len));
00672 /*
00673      Writes the given number of uncompressed bytes into the compressed file.
00674    gzwrite returns the number of uncompressed bytes actually written
00675    (0 in case of error).
00676 */
00677
00678 extern int EXPORT    gzflush OF((gzFile file, int flush));
00679 /*
00680      Flushes all pending output into the compressed file. The parameter
00681    flush is as in the deflate() function. The return value is the zlib
00682    error number (see function gzerror below). gzflush returns Z_OK if
00683    the flush parameter is Z_FINISH and all output could be flushed.
00684      gzflush should be called only when strictly necessary because it can
00685    degrade compression.
00686 */
00687
00688 extern int EXPORT    gzclose OF((gzFile file));
00689 /*
00690      Flushes all pending output if necessary, closes the compressed file
00691    and deallocates all the (de)compression state. The return value is the zlib
00692    error number (see function gzerror below).
00693 */
00694
00695 extern const char * EXPORT gzerror OF((gzFile file, int *errnum));
00696 /*
00697      Returns the error message for the last error which occurred on the
00698    given compressed file. errnum is set to zlib error number. If an
00699    error occurred in the file system and not in the compression library,
00700    errnum is set to Z_ERRNO and the application may consult errno
00701    to get the exact error code.
00702 */
00703
00704                         /* checksum functions */
00705
00706 /*
00707      These functions are not related to compression but are exported
00708    anyway because they might be useful in applications using the
00709    compression library.
00710 */
00711
00712 extern uLong EXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
00713
00714 /*
00715      Update a running Adler-32 checksum with the bytes buf[0..len-1] and
00716    return the updated checksum. If buf is NULL, this function returns
00717    the required initial value for the checksum.
00718    An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
00719    much faster. Usage example:
00720
00721      uLong adler = adler32(0L, Z_NULL, 0);
00722
00723      while (read_buffer(buffer, length) != EOF) {
00724        adler = adler32(adler, buffer, length);
00725      }
00726      if (adler != original_adler) error();
00727 */
00728
00729 extern uLong EXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
00730 /*
00731      Update a running crc with the bytes buf[0..len-1] and return the updated
00732    crc. If buf is NULL, this function returns the required initial value
00733    for the crc. Pre- and post-conditioning (one's complement) is performed
00734    within this function so it shouldn't be done by the application.
00735    Usage example:
00736
00737      uLong crc = crc32(0L, Z_NULL, 0);
00738
00739      while (read_buffer(buffer, length) != EOF) {
00740        crc = crc32(crc, buffer, length);
00741      }
00742      if (crc != original_crc) error();
00743 */
00744
00745
00746                         /* various hacks, don't look :) */
00747
00748 /* deflateInit and inflateInit are macros to allow checking the zlib version
00749  * and the compiler's view of z_stream:
00750  */
00751 extern int EXPORT deflateInit_ OF((z_streamp strm, int level,
00752                        const char *version, int stream_size));
00753 extern int EXPORT inflateInit_ OF((z_streamp strm,
00754                    const char *version, int stream_size));
00755 extern int EXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
00756                     int windowBits, int memLevel, int strategy,
00757                     const char *version, int stream_size));
00758 extern int EXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
00759                     const char *version, int stream_size));
00760 #define deflateInit(strm, level) \
00761         deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
00762 #define inflateInit(strm) \
00763         inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
00764 #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
00765         deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
00766               (strategy),           ZLIB_VERSION, sizeof(z_stream))
00767 #define inflateInit2(strm, windowBits) \
00768         inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
00769
00770 #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
00771     struct internal_state {int dummy;}; /* hack for buggy compilers */
00772 #endif
00773
00774 uLongf *get_crc_table OF((void)); /* can be used by asm versions of crc32() */
00775
00776 #ifdef __cplusplus
00777 }
00778 #endif
00779
00780 #endif /* _ZLIB_H */
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/zutil.c Source File

cvs-1.10/zlib/zutil.c

Go to the documentation of this file.
00001 /* zutil.c -- target dependent utility functions for the compression library
00002  * Copyright (C) 1995-1996 Jean-loup Gailly.
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* $Id: zutil.c,v 1.17 1996/07/24 13:41:12 me Exp $ */
00007
00008 #include <stdio.h>
00009
00010 #include "zutil.h"
00011
00012 struct internal_state      {int dummy;}; /* for buggy compilers */
00013
00014 #ifndef STDC
00015 extern void exit OF((int));
00016 #endif
00017
00018 const char *z_errmsg[10] = {
00019 "need dictionary",     /* Z_NEED_DICT       2  */
00020 "stream end",          /* Z_STREAM_END      1  */
00021 "",                    /* Z_OK              0  */
00022 "file error",          /* Z_ERRNO         (-1) */
00023 "stream error",        /* Z_STREAM_ERROR  (-2) */
00024 "data error",          /* Z_DATA_ERROR    (-3) */
00025 "insufficient memory", /* Z_MEM_ERROR     (-4) */
00026 "buffer error",        /* Z_BUF_ERROR     (-5) */
00027 "incompatible version",/* Z_VERSION_ERROR (-6) */
00028 ""};
00029
00030
00031 const char *zlibVersion()
00032 {
00033     return ZLIB_VERSION;
00034 }
00035
00036 #ifdef DEBUG
00037 void z_error (m)
00038     char *m;
00039 {
00040     fprintf(stderr, "%s\n", m);
00041     exit(1);
00042 }
00043 #endif
00044
00045 #ifndef HAVE_MEMCPY
00046
00047 void zmemcpy(dest, source, len)
00048     Bytef* dest;
00049     Bytef* source;
00050     uInt  len;
00051 {
00052     if (len == 0) return;
00053     do {
00054         *dest++ = *source++; /* ??? to be unrolled */
00055     } while (--len != 0);
00056 }
00057
00058 int zmemcmp(s1, s2, len)
00059     Bytef* s1;
00060     Bytef* s2;
00061     uInt  len;
00062 {
00063     uInt j;
00064
00065     for (j = 0; j < len; j++) {
00066         if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
00067     }
00068     return 0;
00069 }
00070
00071 void zmemzero(dest, len)
00072     Bytef* dest;
00073     uInt  len;
00074 {
00075     if (len == 0) return;
00076     do {
00077         *dest++ = 0;  /* ??? to be unrolled */
00078     } while (--len != 0);
00079 }
00080 #endif
00081
00082 #ifdef __TURBOC__
00083 #if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
00084 /* Small and medium model in Turbo C are for now limited to near allocation
00085  * with reduced MAX_WBITS and MAX_MEM_LEVEL
00086  */
00087 #  define MY_ZCALLOC
00088
00089 /* Turbo C malloc() does not allow dynamic allocation of 64K bytes
00090  * and farmalloc(64K) returns a pointer with an offset of 8, so we
00091  * must fix the pointer. Warning: the pointer must be put back to its
00092  * original form in order to free it, use zcfree().
00093  */
00094
00095 #define MAX_PTR 10
00096 /* 10*64K = 640K */
00097
00098 local int next_ptr = 0;
00099
00100 typedef struct ptr_table_s {
00101     voidpf org_ptr;
00102     voidpf new_ptr;
00103 } ptr_table;
00104
00105 local ptr_table table[MAX_PTR];
00106 /* This table is used to remember the original form of pointers
00107  * to large buffers (64K). Such pointers are normalized with a zero offset.
00108  * Since MSDOS is not a preemptive multitasking OS, this table is not
00109  * protected from concurrent access. This hack doesn't work anyway on
00110  * a protected system like OS/2. Use Microsoft C instead.
00111  */
00112
00113 voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
00114 {
00115     voidpf buf = opaque; /* just to make some compilers happy */
00116     ulg bsize = (ulg)items*size;
00117
00118     /* If we allocate less than 65520 bytes, we assume that farmalloc
00119      * will return a usable pointer which doesn't have to be normalized.
00120      */
00121     if (bsize < 65520L) {
00122         buf = farmalloc(bsize);
00123         if (*(ush*)&buf != 0) return buf;
00124     } else {
00125         buf = farmalloc(bsize + 16L);
00126     }
00127     if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
00128     table[next_ptr].org_ptr = buf;
00129
00130     /* Normalize the pointer to seg:0 */
00131     *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
00132     *(ush*)&buf = 0;
00133     table[next_ptr++].new_ptr = buf;
00134     return buf;
00135 }
00136
00137 void  zcfree (voidpf opaque, voidpf ptr)
00138 {
00139     int n;
00140     if (*(ush*)&ptr != 0) { /* object < 64K */
00141         farfree(ptr);
00142         return;
00143     }
00144     /* Find the original pointer */
00145     for (n = 0; n < next_ptr; n++) {
00146         if (ptr != table[n].new_ptr) continue;
00147
00148         farfree(table[n].org_ptr);
00149         while (++n < next_ptr) {
00150             table[n-1] = table[n];
00151         }
00152         next_ptr--;
00153         return;
00154     }
00155     ptr = opaque; /* just to make some compilers happy */
00156     Assert(0, "zcfree: ptr not found");
00157 }
00158 #endif
00159 #endif /* __TURBOC__ */
00160
00161
00162 #if defined(M_I86) && !defined(__32BIT__)
00163 /* Microsoft C in 16-bit mode */
00164
00165 #  define MY_ZCALLOC
00166
00167 #if (!defined(_MSC_VER) || (_MSC_VER < 600))
00168 #  define _halloc  halloc
00169 #  define _hfree   hfree
00170 #endif
00171
00172 voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
00173 {
00174     if (opaque) opaque = 0; /* to make compiler happy */
00175     return _halloc((long)items, size);
00176 }
00177
00178 void  zcfree (voidpf opaque, voidpf ptr)
00179 {
00180     if (opaque) opaque = 0; /* to make compiler happy */
00181     _hfree(ptr);
00182 }
00183
00184 #endif /* MSC */
00185
00186
00187 #ifndef MY_ZCALLOC /* Any system without a special alloc function */
00188
00189 #ifndef STDC
00190 extern voidp  calloc OF((uInt items, uInt size));
00191 extern void   free   OF((voidpf ptr));
00192 #endif
00193
00194 voidpf zcalloc (opaque, items, size)
00195     voidpf opaque;
00196     unsigned items;
00197     unsigned size;
00198 {
00199     if (opaque) items += size - size; /* make compiler happy */
00200     return (voidpf)calloc(items, size);
00201 }
00202
00203 void  zcfree (opaque, ptr)
00204     voidpf opaque;
00205     voidpf ptr;
00206 {
00207     free(ptr);
00208     if (opaque) return; /* make compiler happy */
00209 }
00210
00211 #endif /* MY_ZCALLOC */
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs-1.10/zlib/zutil.h Source File

cvs-1.10/zlib/zutil.h

Go to the documentation of this file.
00001 /* zutil.h -- internal interface and configuration of the compression library
00002  * Copyright (C) 1995-1996 Jean-loup Gailly.
00003  * For conditions of distribution and use, see copyright notice in zlib.h
00004  */
00005
00006 /* WARNING: this file should *not* be used by applications. It is
00007    part of the implementation of the compression library and is
00008    subject to change. Applications should only use zlib.h.
00009  */
00010
00011 /* $Id: zutil.h,v 1.16 1996/07/24 13:41:13 me Exp $ */
00012
00013 #ifndef _Z_UTIL_H
00014 #define _Z_UTIL_H
00015
00016 #include "zlib.h"
00017
00018 #if defined(MSDOS)||defined(VMS)||defined(CRAY)||defined(WIN32)||defined(RISCOS)
00019 #   include <stddef.h>
00020 #   include <errno.h>
00021 #else
00022     extern int errno;
00023 #endif
00024 #ifdef STDC
00025 #  include <string.h>
00026 #  include <stdlib.h>
00027 #endif
00028
00029 #ifndef local
00030 #  define local static
00031 #endif
00032 /* compile with -Dlocal if your debugger can't find static symbols */
00033
00034 typedef unsigned char  uch;
00035 typedef uch FAR uchf;
00036 typedef unsigned short ush;
00037 typedef ush FAR ushf;
00038 typedef unsigned long  ulg;
00039
00040 extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
00041 /* (size given to avoid silly warnings with Visual C++) */
00042
00043 #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
00044
00045 #define ERR_RETURN(strm,err) \
00046   return (strm->msg = (char*)ERR_MSG(err), (err))
00047 /* To be used only when the state is known to be valid */
00048
00049         /* common constants */
00050
00051 #ifndef DEF_WBITS
00052 #  define DEF_WBITS MAX_WBITS
00053 #endif
00054 /* default windowBits for decompression. MAX_WBITS is for compression only */
00055
00056 #if MAX_MEM_LEVEL >= 8
00057 #  define DEF_MEM_LEVEL 8
00058 #else
00059 #  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
00060 #endif
00061 /* default memLevel */
00062
00063 #define STORED_BLOCK 0
00064 #define STATIC_TREES 1
00065 #define DYN_TREES    2
00066 /* The three kinds of block type */
00067
00068 #define MIN_MATCH  3
00069 #define MAX_MATCH  258
00070 /* The minimum and maximum match lengths */
00071
00072 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
00073
00074         /* target dependencies */
00075
00076 #ifdef MSDOS
00077 #  define OS_CODE  0x00
00078 #  ifdef __TURBOC__
00079 #    include <alloc.h>
00080 #  else /* MSC or DJGPP */
00081 #    include <malloc.h>
00082 #  endif
00083 #endif
00084
00085 #ifdef OS2
00086 #  define OS_CODE  0x06
00087 #endif
00088
00089 #ifdef WIN32 /* Window 95 & Windows NT */
00090 #  define OS_CODE  0x0b
00091 #endif
00092
00093 #if defined(VAXC) || defined(VMS)
00094 #  define OS_CODE  0x02
00095 #  define FOPEN(name, mode) \
00096      fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
00097 #endif
00098
00099 #ifdef AMIGA
00100 #  define OS_CODE  0x01
00101 #endif
00102
00103 #if defined(ATARI) || defined(atarist)
00104 #  define OS_CODE  0x05
00105 #endif
00106
00107 #ifdef MACOS
00108 #  define OS_CODE  0x07
00109 #endif
00110
00111 #ifdef __50SERIES /* Prime/PRIMOS */
00112 #  define OS_CODE  0x0F
00113 #endif
00114
00115 #ifdef TOPS20
00116 #  define OS_CODE  0x0a
00117 #endif
00118
00119 #if defined(_BEOS_) || defined(RISCOS)
00120 #  define fdopen(fd,mode) NULL /* No fdopen() */
00121 #endif
00122
00123         /* Common defaults */
00124
00125 #ifndef OS_CODE
00126 #  define OS_CODE  0x03  /* assume Unix */
00127 #endif
00128
00129 #ifndef FOPEN
00130 #  define FOPEN(name, mode) fopen((name), (mode))
00131 #endif
00132
00133          /* functions */
00134
00135 #ifdef HAVE_STRERROR
00136    extern char *strerror OF((int));
00137 #  define zstrerror(errnum) strerror(errnum)
00138 #else
00139 #  define zstrerror(errnum) ""
00140 #endif
00141
00142 #if defined(pyr)
00143 #  define NO_MEMCPY
00144 #endif
00145 #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(_MSC_VER)
00146  /* Use our own functions for small and medium model with MSC <= 5.0.
00147   * You may have to use the same strategy for Borland C (untested).
00148   */
00149 #  define NO_MEMCPY
00150 #endif
00151 #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
00152 #  define HAVE_MEMCPY
00153 #endif
00154 #ifdef HAVE_MEMCPY
00155 #  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
00156 #    define zmemcpy _fmemcpy
00157 #    define zmemcmp _fmemcmp
00158 #    define zmemzero(dest, len) _fmemset(dest, 0, len)
00159 #  else
00160 #    define zmemcpy memcpy
00161 #    define zmemcmp memcmp
00162 #    define zmemzero(dest, len) memset(dest, 0, len)
00163 #  endif
00164 #else
00165    extern void zmemcpy  OF((Bytef* dest, Bytef* source, uInt len));
00166    extern int  zmemcmp  OF((Bytef* s1,   Bytef* s2, uInt len));
00167    extern void zmemzero OF((Bytef* dest, uInt len));
00168 #endif
00169
00170 /* Diagnostic functions */
00171 #ifdef DEBUG
00172 #  include <stdio.h>
00173 #  ifndef verbose
00174 #    define verbose 0
00175 #  endif
00176    extern void z_error    OF((char *m));
00177 #  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
00178 #  define Trace(x) fprintf x
00179 #  define Tracev(x) {if (verbose) fprintf x ;}
00180 #  define Tracevv(x) {if (verbose>1) fprintf x ;}
00181 #  define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
00182 #  define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
00183 #else
00184 #  define Assert(cond,msg)
00185 #  define Trace(x)
00186 #  define Tracev(x)
00187 #  define Tracevv(x)
00188 #  define Tracec(c,x)
00189 #  define Tracecv(c,x)
00190 #endif
00191
00192
00193 typedef uLong (*check_func) OF((uLong check, const Bytef *buf, uInt len));
00194
00195 voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
00196 void   zcfree  OF((voidpf opaque, voidpf ptr));
00197
00198 #define ZALLOC(strm, items, size) \
00199            (*((strm)->zalloc))((strm)->opaque, (items), (size))
00200 #define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
00201 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
00202
00203 #endif /* _Z_UTIL_H */
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvstree/common.h Source File

cvstree/common.h

Go to the documentation of this file.
00001 #ifndef COMMON_H
00002 #define COMMON_H
00003
00004 /*
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 1, or (at your option)
00008 ** any later version.
00009
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software
00017 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019
00020 #ifdef WIN32
00021 #   include <malloc.h> // for alloca
00022 #endif /* WIN32 */
00023
00024 #include "CvsLog.h"
00025
00026 // reset all static/glocal variables
00027 void yyreset(void);
00028
00029 // used to communicate values lexer->parser
00030 void yylval_set(const char *str);
00031 void yylval_set(int i);
00032 void yylval_set(const CRevNumber & rev);
00033
00034 // token expected by the parser
00035 typedef enum
00036 {
00037     kNone,
00038     kString,
00039     kInt,
00040     kDate,
00041     kRevnum,
00042     kRevnumOrNil,
00043     kAnyButSep
00044 } kTokens;
00045 extern kTokens expectToken;
00046
00047 // error while parsing
00048 void yyerror(const char *txt, ...);
00049 extern int currentLineNumber;
00050
00051 // missing prototypes
00052 int yylex(void);
00053 extern FILE *yyin;
00054 extern void yyrestart(FILE *);
00055 extern int yyparse(void);
00056
00057 // tells the lexer to take from the stream widely
00058 #define YY_NEVER_INTERACTIVE 1
00059
00060 #if qCvsDebug
00061     extern int yydebug;
00062 #endif
00063 extern int yy_flex_debug;
00064
00065 // the result is stored there
00066 extern std::vector<CRcsFile> gRcsFiles;
00067
00068 // the current RCS file and the current revision parsed
00069 extern CRcsFile *gRcsFile;
00070 extern CRevFile *gRevFile;
00071
00072 #ifdef macintosh
00073     extern void *cvstree_alloca(unsigned);
00074     extern char *cvstree_strdup(const char *);
00075 #   define strdup cvstree_strdup
00076 #   define alloca cvstree_alloca
00077 #endif /* macintosh */
00078
00079 #endif /* COMMON_H */
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvstree/CvsLog.cpp Source File

cvstree/CvsLog.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 #include <string.h>
00018 #include <stdio.h>
00019 #include <stdlib.h>
00020 #include <errno.h>
00021 #include <new>
00022
00023 #include "CvsLog.h"
00024 #include "common.h"
00025
00026 #ifndef NEW
00027 #define NEW new
00028 #endif
00029
00030 std::vector<CRcsFile> gRcsFiles;
00031 CRcsFile *gRcsFile = 0L;
00032 CRevFile *gRevFile = 0L;
00033 #ifdef macintosh
00034 std::vector<void *> gMacAlloca;
00035 #endif
00036
00037 //
00038 // CRevNumber
00039 //
00040
00041 void CRevNumber::reset(void)
00042 {
00043     allDigits.erase(allDigits.begin(), allDigits.end());
00044     tagName = "";
00045 }
00046
00047 CRevNumber & CRevNumber::operator+=(int adigit)
00048 {
00049     allDigits.push_back(adigit);
00050     return *this;
00051 }
00052
00053 CRevNumber & CRevNumber::operator=(const CRevNumber & arev)
00054 {
00055     reset();
00056     for(int i = 0; i < arev.size(); i++)
00057     {
00058         *this += arev[i];
00059     }
00060     tagName = arev.Tag();
00061     return *this;
00062 }
00063
00064 int CRevNumber::operator[](int index) const
00065 {
00066     if(index < 0 || index >= size())
00067         return -1;
00068     return allDigits[index];
00069 }
00070
00071 const char *CRevNumber::c_str(void) const
00072 {
00073     static CLogStr str;
00074     str = "";
00075     if(allDigits.empty())
00076         return str;
00077     std::vector<int>::const_iterator i = allDigits.begin();
00078     str << *i;
00079     ++i;
00080     for(; i != allDigits.end(); ++i)
00081     {
00082         str << '.' << *i;
00083     }
00084     return str;
00085 }
00086
00087 int CRevNumber::cmp(const CRevNumber & arev) const
00088 {
00089     const std::vector<int> & rev1 = IntList();
00090     const std::vector<int> & rev2 = arev.IntList();
00091
00092     std::vector<int>::const_iterator i = rev1.begin();
00093     std::vector<int>::const_iterator j = rev2.begin();
00094     while(i != rev1.end() && j != rev2.end())
00095     {
00096         if((*i) != (*j))
00097             return (*i) < (*j) ? -1 : 1;
00098         ++i;
00099         ++j;
00100     }
00101     if(i == rev1.end() && j != rev2.end())
00102         return -1;
00103     if(i != rev1.end() && j == rev2.end())
00104         return 1;
00105     return 0;
00106 }
00107
00108 bool CRevNumber::operator==(const CRevNumber & arev) const
00109 {
00110     if(size() != arev.size())
00111         return false;
00112
00113     const std::vector<int> & rev1 = IntList();
00114     const std::vector<int> & rev2 = arev.IntList();
00115     std::vector<int>::const_iterator i = rev1.begin();
00116     std::vector<int>::const_iterator j = rev2.begin();
00117     return memcmp(&*i, &*j, size() * sizeof(int)) == 0;
00118 }
00119
00120 bool CRevNumber::ischildof(const CRevNumber & arev) const
00121 {
00122     if((arev.size() + 2) != size())
00123         return false;
00124     const std::vector<int> & rev1 = IntList();
00125     const std::vector<int> & rev2 = arev.IntList();
00126     std::vector<int>::const_iterator i = rev1.begin();
00127     std::vector<int>::const_iterator j = rev2.begin();
00128     return memcmp(&*i, &*j, arev.size() * sizeof(int)) == 0;
00129 }
00130
00131 bool CRevNumber::issamebranch(const CRevNumber & arev) const
00132 {
00133     if(arev.size() != size())
00134         return false;
00135     const std::vector<int> & rev1 = IntList();
00136     const std::vector<int> & rev2 = arev.IntList();
00137     std::vector<int>::const_iterator i = rev1.begin();
00138     std::vector<int>::const_iterator j = rev2.begin();
00139     return memcmp(&*i, &*j, (size() - 1) * sizeof(int)) == 0;
00140 }
00141
00142 bool CRevNumber::ispartof(const CRevNumber & arev) const
00143 {
00144     const std::vector<int> & rev1 = IntList();
00145     const std::vector<int> & rev2 = arev.IntList();
00146     std::vector<int>::const_iterator i = rev1.begin();
00147     std::vector<int>::const_iterator j = rev2.begin();
00148
00149     if((arev.size() & 1) != 0)
00150     {
00151         // special case for "1.1.1"
00152         if((arev.size() + 1) != size())
00153             return false;
00154         return memcmp(&*i, &*j, arev.size() * sizeof(int)) == 0;
00155     }
00156
00157     // case for 1.1.1.1.2.4 is part of 1.1.1.1.0.2
00158     if(arev.size() != size() || size() < 2)
00159         return false;
00160
00161     if(memcmp(&*i, &*j, (size() - 2) * sizeof(int)) != 0)
00162         return false;
00163
00164     return arev.IntList()[size() - 2] == 0 &&
00165         IntList()[size() - 2] == arev.IntList()[size() - 1];
00166 }
00167
00168 bool CRevNumber::issubbranchof(const CRevNumber & arev) const
00169 {
00170     const std::vector<int> & rev1 = IntList();
00171     const std::vector<int> & rev2 = arev.IntList();
00172     std::vector<int>::const_iterator i = rev1.begin();
00173     std::vector<int>::const_iterator j = rev2.begin();
00174
00175     if((size() & 1) != 0)
00176     {
00177         // special case for "1.1.1"
00178         if((arev.size() + 1) != size())
00179             return false;
00180         return memcmp(&*i, &*j, arev.size() * sizeof(int)) == 0;
00181     }
00182
00183     // case for 1.4.0.2 is subbranch of 1.4
00184     if((arev.size() + 2) != size() || IntList()[arev.size()] != 0)
00185         return false;
00186
00187     return memcmp(&*i, &*j, arev.size() * sizeof(int)) == 0;
00188 }
00189
00190 //
00191 // CLogStr
00192 //
00193
00194 void CLogStr::flush(void)
00195 {
00196     if(str == 0L)
00197         return;
00198     free(str);
00199     str = 0L;
00200 }
00201
00202 const char *CLogStr::operator=(const char *newstr)
00203 {
00204     flush();
00205     if(newstr == 0L)
00206         return 0L;
00207
00208     int l = strlen(newstr);
00209     str = (char *)malloc((l + 1) * sizeof(char));
00210     if(str == 0L)
00211         throw std::bad_alloc();
00212
00213     strcpy(str, newstr);
00214
00215     return *this;
00216 }
00217
00218 const CLogStr & CLogStr::operator=(const CLogStr & newstr)
00219 {
00220     flush();
00221     *this = (const char *)newstr;
00222     return *this;
00223 }
00224
00225 const CLogStr & CLogStr::set(const char *buf, unsigned int len)
00226 {
00227     flush();
00228     if(len == 0)
00229         return *this;
00230
00231     str = (char *)malloc((len + 1) * sizeof(char));
00232     if(str == 0L)
00233         throw std::bad_alloc();
00234
00235     memcpy(str, buf, len * sizeof(char));
00236     str[len] = '\0';
00237
00238     return *this;
00239 }
00240
00241 const CLogStr & CLogStr::replace(char which, char bywhich)
00242 {
00243     if(str == 0L)
00244         return *this;
00245
00246     char *buf = str;
00247     while(*buf)
00248     {
00249         if(*buf == which)
00250             *buf++ = bywhich;
00251         else
00252             buf++;
00253     }
00254     return *this;
00255 }
00256
00257 CLogStr & CLogStr::operator<<(const char *addToStr)
00258 {
00259     if(addToStr == 0L)
00260         return *this;
00261
00262     if(str == 0L)
00263     {
00264         *this = addToStr;
00265         return *this;
00266     }
00267
00268     unsigned int len = strlen(addToStr);
00269     if(len == 0)
00270         return *this;
00271
00272     unsigned curlen = length();
00273     str = (char *)realloc(str, (len + curlen + 1) * sizeof(char));
00274     if(str == 0L)
00275         throw std::bad_alloc();
00276
00277     memcpy(str + curlen, addToStr, len * sizeof(char));
00278     str[len + curlen] = '\0';
00279
00280     return *this;
00281 }
00282
00283 CLogStr & CLogStr::operator<<(char addToStr)
00284 {
00285     char astr[2] = {'\0', '\0'};
00286     astr[0] = addToStr;
00287     return *this << astr;
00288 }
00289
00290 CLogStr & CLogStr::operator<<(int addToStr)
00291 {
00292     char astr[50];
00293     sprintf(astr, "%d", addToStr);
00294     return *this << astr;
00295 }
00296
00297 //
00298 // CRcsFile
00299 //
00300
00301 CRcsFile::CRcsFile()
00302 {
00303     selRevisions = 0;
00304     totRevisions = 0;
00305     lockStrict = false;
00306 }
00307
00308 CRcsFile::CRcsFile(const CRcsFile & afile)
00309 {
00310     *this = afile;
00311 }
00312
00313 CRcsFile::~CRcsFile()
00314 {
00315 }
00316
00317 CRcsFile & CRcsFile::operator=(const CRcsFile & afile)
00318 {
00319     rcsFile = afile.rcsFile;
00320     workingFile = afile.workingFile;
00321     headRev = afile.headRev;
00322     branchRev = afile.branchRev;
00323     keywordSubst = afile.keywordSubst;
00324     accessList = afile.accessList;
00325     symbolicList = afile.symbolicList;
00326     locksList = afile.locksList;
00327     selRevisions = afile.selRevisions;
00328     totRevisions = afile.totRevisions;
00329     lockStrict = afile.lockStrict;
00330     allRevs = afile.allRevs;
00331     descLog = afile.descLog;
00332     return *this;
00333 }
00334
00335 #ifdef qUnix
00336 void CRcsFile::print(OSTREAM & out) const
00337 {
00338     out << "Rcs file : '" << RcsFile() << "'\n";
00339     out << "Working file : '" << WorkingFile() << "'\n";
00340     out << "Head revision : " << HeadRev().str() << '\n';
00341     out << "Branch revision : " << BranchRev().str() << '\n';
00342
00343     out << "Locks :" << (LockStrict() ? " strict" : "") << '\n';
00344     std::vector<CRevNumber>::const_iterator s;
00345     for(s = LocksList().begin(); s != LocksList().end(); ++s)
00346     {
00347         const CRevNumber & lock = *s;
00348         out << '\t' << lock.str() << " : '" << lock.Tag() << "'\n";
00349     }
00350
00351     out << "Access :\n";
00352     std::vector<CLogStr>::const_iterator a;
00353     for(a = AccessList().begin(); a != AccessList().end(); ++a)
00354     {
00355         out << "\t'" << *a << "'\n";
00356     }
00357
00358     out << "Symbolic names :\n";
00359     std::vector<CRevNumber>::const_iterator n;
00360     for(n = SymbolicList().begin(); n != SymbolicList().end(); ++n)
00361     {
00362         const CRevNumber & symb = *n;
00363         out << '\t' << symb.str() << " : '" << symb.Tag() << "'\n";
00364     }
00365
00366     out << "Keyword substitution : '" << KeywordSubst() << "'\n";
00367     out << "Total revisions : " << TotRevisions() << "\n";
00368     out << "Selected revisions : " << SelRevisions() << "\n";
00369     out << "Description :\n" << DescLog() << '\n';
00370
00371     std::vector<CRevFile>::const_iterator i;
00372     for(i = AllRevs().begin(); i != AllRevs().end(); ++i)
00373     {
00374         i->print(out);
00375     }
00376 }
00377 #endif
00378
00379 extern "C" {
00380     static int sortRevs(const void *r1, const void *r2);
00381 }
00382
00383 #ifdef WIN32
00384 extern "C"
00385 #endif /* WIN32 */
00386 static int sortRevs(const void *r1, const void *r2)
00387 {
00388     CRevNumber & rev1 = ((CRevFile *)r1)->RevNum();
00389     CRevNumber & rev2 = ((CRevFile *)r2)->RevNum();
00390     return rev1.cmp(rev2);
00391 }
00392
00393 void CRcsFile::sort()
00394 {
00395 #ifndef __MWERKS__
00396     qsort(AllRevs().begin(), AllRevs().size(), sizeof(CRevFile), sortRevs);
00397 #else /* __MWERKS__ */
00398     qsort(&*AllRevs().begin(), AllRevs().size(), sizeof(CRevFile), sortRevs);
00399 #endif /* __MWERKS__ */
00400 }
00401
00402 //
00403 // CRevFile
00404 //
00405
00406 CRevFile::CRevFile()
00407 {
00408     chgPos = 0;
00409     chgNeg = 0;
00410     memset(&revTime, 0, sizeof(revTime));
00411 }
00412
00413 CRevFile::CRevFile(const CRevFile & afile)
00414 {
00415     *this = afile;
00416 }
00417
00418 CRevFile::~CRevFile()
00419 {
00420 }
00421
00422 CRevFile & CRevFile::operator=(const CRevFile & afile)
00423 {
00424     revNum = afile.revNum;
00425     revTime = afile.revTime;
00426     locker = afile.locker;
00427     branchesList = afile.branchesList;
00428     author = afile.author;
00429     state = afile.state;
00430     chgPos = afile.chgPos;
00431     chgNeg = afile.chgNeg;
00432     descLog = afile.descLog;
00433     return *this;
00434 }
00435
00436 #ifdef qUnix
00437 void CRevFile::print(OSTREAM & out) const
00438 {
00439     out << "----------------------------\n";
00440     out << "Revision : " << RevNum().str() << '\n';
00441     if(!Locker().empty())
00442         out << "Locked by : '" << Locker() << "'\n";
00443     out << "Date : " <<
00444         (RevTime().tm_year + 1900) << '/' <<
00445         RevTime().tm_mon << '/' <<
00446         RevTime().tm_mday << ' ' <<
00447         RevTime().tm_hour << ':' <<
00448         RevTime().tm_min << ':' <<
00449         RevTime().tm_sec << '\n';
00450     out << "Author : '" << Author() << "'\n";
00451     out << "State : '" << State() << "'\n";
00452     out << "Lines : +" << ChgPos() << ' ' << ChgNeg() << '\n';
00453
00454     if(!BranchesList().empty())
00455     {
00456         out << "Branches :\n";
00457         std::vector<CRevNumber>::const_iterator s;
00458         for(s = BranchesList().begin(); s != BranchesList().end(); ++s)
00459         {
00460             const CRevNumber & branch = *s;
00461             out << '\t' << branch.str() << '\n';
00462         }
00463     }
00464
00465     out << "Description :\n" << DescLog() << '\n';
00466 }
00467 #endif
00468
00469 int yy_flex_debug;
00470     // remove that as soon a possible
00471
00472 std::vector<CRcsFile> & CvsLogParse(FILE * file)
00473 {
00474 #if qCvsDebug
00475     yydebug = 0;
00476 #endif
00477     yy_flex_debug = 0;
00478     yyin = file;
00479     yyreset();
00480     yyrestart(yyin);
00481     yyparse();
00482
00483 #ifdef macintosh
00484     std::vector<void *>::iterator i;
00485     for(i = gMacAlloca.begin(); i != gMacAlloca.end(); i++)
00486     {
00487         if(*i != 0L)
00488             free(*i);
00489         *i = 0L;
00490     }
00491     gMacAlloca.erase(gMacAlloca.begin(), gMacAlloca.end());
00492 #endif /* macintosh */
00493
00494     return gRcsFiles;
00495 }
00496
00497 void CvsLogReset(void)
00498 {
00499     yyreset();
00500 }
00501
00502 //
00503 // tree nodes
00504 //
00505
00506 CLogNode::CLogNode(CLogNode * r)
00507 {
00508     root = r;
00509     next = 0L;
00510     user = 0L;
00511 }
00512
00513 CLogNode::~CLogNode()
00514 {
00515     if(Next() != 0L)
00516         delete Next();
00517     std::vector<CLogNode *>::iterator i;
00518     for(i = Childs().begin(); i != Childs().end(); ++i)
00519     {
00520         delete *i;
00521         *i = 0L;
00522     }
00523     if(user != 0L)
00524         delete user;
00525 }
00526
00527 static bool insertSymbName(CLogNode *node, const CRevNumber & symb)
00528 {
00529     if(node->GetType() == kNodeRev)
00530     {
00531         CLogNodeRev & rev = *(CLogNodeRev *)node;
00532         if((*rev).RevNum() == symb)
00533         {
00534             // insert the tag as achild of the node
00535             CLogNodeTag *tag = NEW CLogNodeTag(symb.Tag(), node);
00536             node->Childs().push_back(tag);
00537             return true;
00538         }
00539     }
00540
00541     std::vector<CLogNode *>::iterator i;
00542     for(i = node->Childs().begin(); i != node->Childs().end(); ++i)
00543     {
00544         if(insertSymbName(*i, symb))
00545             return true;
00546     }
00547     if(node->Next() != 0L && insertSymbName(node->Next(), symb))
00548         return true;
00549
00550     return false;
00551 }
00552
00553 static bool insertBranchName(CLogNode *node, const CRevNumber & symb)
00554 {
00555     std::vector<CLogNode *>::iterator i;
00556     for(i = node->Childs().begin(); i != node->Childs().end(); ++i)
00557     {
00558         CLogNode *subnode = *i;
00559         if(subnode->GetType() == kNodeRev)
00560         {
00561             CLogNodeRev & rev = *(CLogNodeRev *)subnode;
00562             if((*rev).RevNum().ispartof(symb))
00563             {
00564                 // insert the branch name as previous node of the
00565                 // first node of that branch
00566                 CLogNodeBranch *branch = NEW CLogNodeBranch(symb.Tag(), node);
00567                 branch->Next() = subnode;
00568                 *i = branch;
00569                 return true;
00570             }
00571         }
00572         if(insertBranchName(subnode, symb))
00573             return true;
00574     }
00575     if(node->Next() != 0L && insertBranchName(node->Next(), symb))
00576         return true;
00577
00578     // we didn't find to connect this branch because there is no
00579     // revision in this branch (empty branch) : so add it as a child of this node.
00580     if(node->GetType() == kNodeRev)
00581     {
00582         CLogNodeRev & rev = *(CLogNodeRev *)node;
00583         if(symb.issubbranchof((*rev).RevNum()))
00584         {
00585             CLogNodeBranch *branch = NEW CLogNodeBranch(symb.Tag(), node);
00586             node->Childs().push_back(branch);
00587         }
00588     }
00589
00590     return false;
00591 }
00592
00593 CLogNode *CvsLogGraph(CRcsFile & rcsfile)
00594 {
00595     // we sort the revisions in order to build the tree
00596     // using a stack-algorithm
00597     rcsfile.sort();
00598
00599     CLogNodeHeader * header = NEW CLogNodeHeader(rcsfile);
00600     CLogNodeRev * curNode = 0L;
00601
00602     // append the revisions to the tree
00603     std::vector<CRevFile>::const_iterator i;
00604     for(i = rcsfile.AllRevs().begin(); i != rcsfile.AllRevs().end(); ++i)
00605     {
00606         const CRevFile & rev = *i;
00607
00608         if(curNode == 0L)
00609         {
00610             CLogNodeRev *nrev = NEW CLogNodeRev(rev, header);
00611             header->Childs().push_back(nrev);
00612             curNode = nrev;
00613             continue;
00614         }
00615
00616         do
00617         {
00618             const CRevNumber & curRev = (**curNode).RevNum();
00619             const CRevNumber & thisRev = rev.RevNum();
00620
00621             if(thisRev.ischildof(curRev))
00622             {
00623                 CLogNodeRev *nrev = NEW CLogNodeRev(rev, curNode);
00624                 curNode->Childs().push_back(nrev);
00625                 curNode = nrev;
00626                 break;
00627             }
00628             else if(thisRev.issamebranch(curRev))
00629             {
00630                 CLogNodeRev *nrev = NEW CLogNodeRev(rev, curNode);
00631                 curNode->Next() = nrev;
00632                 curNode = nrev;
00633                 break;
00634             }
00635             if(curNode->Root() == header)
00636                 curNode = 0L;
00637             else
00638                 curNode = (CLogNodeRev *)curNode->Root();
00639         } while(curNode != 0L);
00640
00641         if(curNode == 0L)
00642         {
00643             CLogNodeRev *nrev = NEW CLogNodeRev(rev, header);
00644             header->Childs().push_back(nrev);
00645             curNode = nrev;
00646         }
00647     }
00648
00649     // append the tags
00650     std::vector<CRevNumber>::const_iterator s;
00651     for(s = rcsfile.SymbolicList().begin(); s != rcsfile.SymbolicList().end(); ++s)
00652     {
00653         insertSymbName(header, *s);
00654     }
00655
00656     // append the branch names
00657     for(s = rcsfile.SymbolicList().begin(); s != rcsfile.SymbolicList().end(); ++s)
00658     {
00659         insertBranchName(header, *s);
00660     }
00661
00662     return header;
00663 }
00664
00665 #ifdef macintosh
00666 void *cvstree_alloca(unsigned size)
00667 {
00668     void *res = malloc(size);
00669     if(res == 0L)
00670         return 0L;
00671
00672     gMacAlloca.push_back(res);
00673     return res;
00674 }
00675
00676 char *cvstree_strdup(const char *string)
00677 {
00678     int size = strlen(string);
00679     char *result = (char *)malloc((size + 1) * sizeof(char));
00680     if(result == 0L)
00681         return 0L;
00682     strcpy(result, string);
00683     return result;
00684 }
00685 #endif /* macintosh */
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvstree/CvsLog.h Source File

cvstree/CvsLog.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 #ifndef CVSLOG_H
00018 #define CVSLOG_H
00019
00020 #ifdef WIN32
00021 #   ifdef _DEBUG
00022 #       define qCvsDebug 1
00023 #   else
00024 #       define qCvsDebug 0
00025 #   endif
00026 #endif /* WIN32 */
00027
00028 #include <vector>
00029 #include <time.h>
00030 #include <iostream.h>
00031 #include <stdio.h>
00032
00033 #ifdef _MSC_VER
00034     using namespace std;
00035 #   define OSTREAM ::ostream
00036 #else
00037 #   define OSTREAM ostream
00038 #endif
00039
00040 // a C-string
00041 class CLogStr
00042 {
00043 public :
00044     inline CLogStr() : str(0L) {}
00045     inline CLogStr(const char *newstr)
00046     {
00047         str = 0L;
00048         *this = newstr;
00049     }
00050     inline CLogStr(const CLogStr & newstr)
00051     {
00052         str = 0L;
00053         *this = newstr;
00054     }
00055     virtual ~CLogStr() { flush(); }
00056
00057     inline bool empty(void) const {return str == 0L || str[0] == '\0';}
00058     inline unsigned int length(void) const {return str == 0L ? 0 : strlen(str);}
00059
00060     const char *operator=(const char *newstr);
00061         // set to a new C String (0L is OK)
00062     const CLogStr & operator=(const CLogStr & newstr);
00063         // set according to another CLogStr
00064     const CLogStr & set(const char *buf, unsigned int len);
00065         // set from a buffer
00066
00067     bool operator<(const char *newstr) const;
00068
00069     inline operator const char *() const {return str == 0L ? "" : str;}
00070     inline const char *c_str() const {return str == 0L ? "" : str;}
00071         // as a C string
00072
00073     CLogStr & operator<<(const char *addToStr);
00074     CLogStr & operator<<(char addToStr);
00075     CLogStr & operator<<(int addToStr);
00076         // concatenate
00077
00078     inline bool endsWith(char c) const {return !length() ? false : str[length()-1] == c;}
00079
00080     const CLogStr & replace(char which, char bywhich);
00081         // replace a character
00082
00083 protected :
00084     void flush(void);
00085     char *str; // the String
00086 };
00087
00088 // class to store a revision number
00089 class CRevNumber
00090 {
00091 public:
00092     CRevNumber() {}
00093     virtual ~CRevNumber() { reset(); }
00094
00095     void reset(void);
00096     inline int size() const {return allDigits.size();}
00097
00098     int cmp(const CRevNumber & arev) const;
00099         // return -1,0,1 "a la" qsort
00100
00101     CRevNumber & operator+=(int adigit);
00102     CRevNumber & operator=(const CRevNumber & arev);
00103     bool operator==(const CRevNumber & arev) const;
00104     int operator[](int index) const;
00105     bool operator<(const CRevNumber & arev) const;
00106
00107     bool ischildof(const CRevNumber & arev) const;
00108         // 1.4.2.2 is child of 1.4
00109     bool issamebranch(const CRevNumber & arev) const;
00110         // 1.1.1.2 is same branch than 1.1.1.3
00111     bool ispartof(const CRevNumber & arev) const;
00112         // 1.1.1.2 is part of 1.1.1
00113         // 1.4.2.3 is part of 1.4.0.2
00114     bool issubbranchof(const CRevNumber & arev) const;
00115         // 1.1.1 is subbranch of 1.1
00116         // 1.4.0.2 is subbranch of 1.4
00117
00118     inline const std::vector<int> & IntList(void) const { return allDigits; }
00119     inline std::vector<int> & IntList(void) { return allDigits; }
00120
00121     inline const CLogStr & Tag(void) const { return tagName; }
00122     inline CLogStr & Tag(void) { return tagName; }
00123
00124     const char *c_str(void) const;
00125 protected:
00126     std::vector<int> allDigits;
00127     CLogStr tagName; // or an author
00128 };
00129
00130 // a single revision for a file
00131 class CRevFile
00132 {
00133 public:
00134     CRevFile();
00135     CRevFile(const CRevFile & afile);
00136     virtual ~CRevFile();
00137
00138     CRevFile & operator=(const CRevFile & afile);
00139     bool operator<(const CRevFile & afile) const;
00140     bool operator==(const CRevFile & afile) const;
00141
00142     void print(OSTREAM & out) const;
00143
00144     inline const CRevNumber & RevNum(void) const { return revNum; }
00145     inline CRevNumber & RevNum(void) { return revNum; }
00146
00147     inline const struct tm & RevTime(void) const { return revTime; }
00148     inline struct tm & RevTime(void) { return revTime; }
00149
00150     inline const CLogStr & Locker(void) const { return locker; }
00151     inline CLogStr & Locker(void) { return locker; }
00152
00153     inline const std::vector<CRevNumber> & BranchesList(void) const { return branchesList; }
00154     inline std::vector<CRevNumber> & BranchesList(void) { return branchesList; }
00155     inline CRevNumber & LastBranche(void) { return branchesList[branchesList.size() - 1]; }
00156
00157     inline const CLogStr & Author(void) const { return author; }
00158     inline CLogStr & Author(void) { return author; }
00159
00160     inline const CLogStr & State(void) const { return state; }
00161     inline CLogStr & State(void) { return state; }
00162
00163     inline int ChgPos(void) const { return chgPos; }
00164     inline int & ChgPos(void) { return chgPos; }
00165
00166     inline int ChgNeg(void) const { return chgNeg; }
00167     inline int & ChgNeg(void) { return chgNeg; }
00168
00169     inline const CLogStr & DescLog(void) const { return descLog; }
00170     inline CLogStr & DescLog(void) { return descLog; }
00171
00172 protected:
00173     CRevNumber revNum;
00174     struct tm revTime;
00175     CLogStr locker;
00176     std::vector<CRevNumber> branchesList;
00177     CLogStr author;
00178     CLogStr state;
00179     int chgPos;
00180     int chgNeg;
00181     CLogStr descLog;
00182 };
00183
00184 // RCS infos for a file
00185 class CRcsFile
00186 {
00187 public:
00188     CRcsFile();
00189     CRcsFile(const CRcsFile & afile);
00190     virtual ~CRcsFile();
00191
00192     CRcsFile & operator=(const CRcsFile & afile);
00193     bool operator<(const CRcsFile & afile) const;
00194     bool operator==(const CRcsFile & afile) const;
00195
00196     void sort(void);
00197
00198     void print(OSTREAM & out) const;
00199
00200     inline const CLogStr & RcsFile(void) const { return rcsFile; }
00201     inline CLogStr & RcsFile(void) { return rcsFile; }
00202
00203     inline const CLogStr & WorkingFile(void) const { return workingFile; }
00204     inline CLogStr & WorkingFile(void) { return workingFile; }
00205
00206     inline const CRevNumber & HeadRev(void) const { return headRev; }
00207     inline CRevNumber & HeadRev(void) { return headRev; }
00208
00209     inline const CRevNumber & BranchRev(void) const { return branchRev; }
00210     inline CRevNumber & BranchRev(void) { return branchRev; }
00211
00212     inline const CLogStr & KeywordSubst(void) const { return keywordSubst; }
00213     inline CLogStr & KeywordSubst(void) { return keywordSubst; }
00214
00215     inline int SelRevisions(void) const { return selRevisions; }
00216     inline int & SelRevisions(void) { return selRevisions; }
00217
00218     inline int TotRevisions(void) const { return totRevisions; }
00219     inline int & TotRevisions(void) { return totRevisions; }
00220
00221     inline const std::vector<CLogStr> & AccessList(void) const { return accessList; }
00222     inline std::vector<CLogStr> & AccessList(void) { return accessList; }
00223     inline CLogStr & LastAccess(void) { return accessList[accessList.size() - 1]; }
00224
00225     inline const std::vector<CRevNumber> & SymbolicList(void) const { return symbolicList; }
00226     inline std::vector<CRevNumber> & SymbolicList(void) { return symbolicList; }
00227     inline CRevNumber & LastSymbName(void) { return symbolicList[symbolicList.size() - 1]; }
00228
00229     inline const std::vector<CRevNumber> & LocksList(void) const { return locksList; }
00230     inline std::vector<CRevNumber> & LocksList(void) { return locksList; }
00231     inline CRevNumber & LastLock(void) { return locksList[locksList.size() - 1]; }
00232
00233     inline bool LockStrict(void) const { return lockStrict; }
00234     inline bool & LockStrict(void) { return lockStrict; }
00235
00236     inline const std::vector<CRevFile> & AllRevs(void) const { return allRevs; }
00237     inline std::vector<CRevFile> & AllRevs(void) { return allRevs; }
00238     inline CRevFile & LastRev(void) { return allRevs[allRevs.size() - 1]; }
00239
00240     inline const CLogStr & DescLog(void) const { return descLog; }
00241     inline CLogStr & DescLog(void) { return descLog; }
00242
00243 protected:
00244     CLogStr rcsFile;
00245     CLogStr workingFile;
00246     CRevNumber headRev;
00247     CRevNumber branchRev;
00248     CLogStr keywordSubst;
00249     std::vector<CLogStr> accessList;
00250     std::vector<CRevNumber> symbolicList;
00251     std::vector<CRevNumber> locksList;
00252     int selRevisions;
00253     int totRevisions;
00254     bool lockStrict;
00255     std::vector<CRevFile> allRevs;
00256     CLogStr descLog;
00257 };
00258
00259 // classes used to build a tree off the cvs log output
00260
00261 typedef enum
00262 {
00263     kNodeHeader,
00264     kNodeBranch,
00265     kNodeRev,
00266     kNodeTag
00267 } kLogNode;
00268
00269 class CLogNode;
00270
00271 class CLogNodeData
00272 {
00273 public:
00274     CLogNodeData(CLogNode *node) { fNode = node; }
00275     virtual ~CLogNodeData() {}
00276
00277     inline CLogNode *Node(void) { return fNode; }
00278 protected:
00279     CLogNode *fNode;
00280 };
00281
00282 class CLogNode
00283 {
00284 public:
00285     CLogNode(CLogNode * root = 0L);
00286     virtual ~CLogNode();
00287
00288     virtual kLogNode GetType(void) const = 0;
00289
00290     inline const std::vector<CLogNode *> & Childs(void) const { return childs; }
00291     inline std::vector<CLogNode *> & Childs(void) { return childs; }
00292
00293     inline const CLogNode * Root(void) const { return root; }
00294     inline CLogNode * & Root(void) { return root; }
00295
00296     inline const CLogNode * Next(void) const { return next; }
00297     inline CLogNode * & Next(void) { return next; }
00298
00299     inline void SetUserData(CLogNodeData *data) { user = data; }
00300     inline CLogNodeData *GetUserData(void) { return user; }
00301 protected:
00302     std::vector<CLogNode *> childs;
00303     CLogNode * root;
00304     CLogNode * next;
00305     CLogNodeData *user;
00306 };
00307
00308 class CLogNodeHeader : public CLogNode
00309 {
00310 public:
00311     CLogNodeHeader(const CRcsFile & h, CLogNode * r = 0L) :
00312         CLogNode(r), header(h) {}
00313
00314     virtual kLogNode GetType(void) const { return kNodeHeader; }
00315
00316     inline const CRcsFile & operator *() const { return header; }
00317     inline CRcsFile & operator *() { return header; }
00318
00319 protected:
00320     CRcsFile header;
00321 };
00322
00323 class CLogNodeRev : public CLogNode
00324 {
00325 public:
00326     CLogNodeRev(const CRevFile & r, CLogNode * root = 0L) :
00327         CLogNode(root), rev(r) {}
00328
00329     virtual kLogNode GetType(void) const { return kNodeRev; }
00330
00331     inline const CRevFile & operator *() const { return rev; }
00332     inline CRevFile & operator *() { return rev; }
00333
00334 protected:
00335     CRevFile rev;
00336 };
00337
00338 class CLogNodeTag : public CLogNode
00339 {
00340 public:
00341     CLogNodeTag(const CLogStr & t, CLogNode * r = 0L) :
00342         CLogNode(r), tag(t) {}
00343
00344     virtual kLogNode GetType(void) const { return kNodeTag; }
00345
00346     inline const CLogStr & operator*() const { return tag; }
00347     inline CLogStr & operator*() { return tag; }
00348
00349 protected:
00350     CLogStr tag;
00351 };
00352
00353 class CLogNodeBranch : public CLogNode
00354 {
00355 public:
00356     CLogNodeBranch(const CLogStr & b, CLogNode * r = 0L) :
00357         CLogNode(r), branch(b) {}
00358
00359     virtual kLogNode GetType(void) const { return kNodeBranch; }
00360
00361     inline const CLogStr & operator*() const { return branch; }
00362     inline CLogStr & operator*() { return branch; }
00363
00364 protected:
00365     CLogStr branch;
00366 };
00367
00368 std::vector<CRcsFile> & CvsLogParse(FILE * file);
00369     // parse a file and return the set of RCS files
00370
00371 void CvsLogReset(void);
00372     // free the memory used
00373
00374 CLogNode *CvsLogGraph(CRcsFile & rcsfile);
00375     // build a tree (i.e. graph) of the history
00376
00377 #endif
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvstree/lexer.cc Source File

cvstree/lexer.cc

Go to the documentation of this file.
00001 /* A lexical scanner generated by flex */
00002
00003 /* Scanner skeleton version:
00004  * $Header: /cvsroot/cvsgui/cvsgui/cvstree/lexer.cc,v 1.4 1999/09/19 22:27:48 alexp Exp $
00005  */
00006
00007 #define FLEX_SCANNER
00008 #define YY_FLEX_MAJOR_VERSION 2
00009 #define YY_FLEX_MINOR_VERSION 5
00010
00011 #include <stdio.h>
00012
00013
00014 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
00015 #ifdef c_plusplus
00016 #ifndef __cplusplus
00017 #define __cplusplus
00018 #endif
00019 #endif
00020
00021
00022 #ifdef __cplusplus
00023
00024 #include <stdlib.h>
00025 #include <unistd.h>
00026
00027 /* Use prototypes in function declarations. */
00028 #define YY_USE_PROTOS
00029
00030 /* The "const" storage-class-modifier is valid. */
00031 #define YY_USE_CONST
00032
00033 #else   /* ! __cplusplus */
00034
00035 #if __STDC__
00036
00037 #define YY_USE_PROTOS
00038 #define YY_USE_CONST
00039
00040 #endif  /* __STDC__ */
00041 #endif  /* ! __cplusplus */
00042
00043 #ifdef __TURBOC__
00044  #pragma warn -rch
00045  #pragma warn -use
00046 #include <io.h>
00047 #include <stdlib.h>
00048 #define YY_USE_CONST
00049 #define YY_USE_PROTOS
00050 #endif
00051
00052 #ifdef YY_USE_CONST
00053 #define yyconst const
00054 #else
00055 #define yyconst
00056 #endif
00057
00058
00059 #ifdef YY_USE_PROTOS
00060 #define YY_PROTO(proto) proto
00061 #else
00062 #define YY_PROTO(proto) ()
00063 #endif
00064
00065 /* Returned upon end-of-file. */
00066 #define YY_NULL 0
00067
00068 /* Promotes a possibly negative, possibly signed char to an unsigned
00069  * integer for use as an array index.  If the signed char is negative,
00070  * we want to instead treat it as an 8-bit unsigned char, hence the
00071  * double cast.
00072  */
00073 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
00074
00075 /* Enter a start condition.  This macro really ought to take a parameter,
00076  * but we do it the disgusting crufty way forced on us by the ()-less
00077  * definition of BEGIN.
00078  */
00079 #define BEGIN yy_start = 1 + 2 *
00080
00081 /* Translate the current start state into a value that can be later handed
00082  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00083  * compatibility.
00084  */
00085 #define YY_START ((yy_start - 1) / 2)
00086 #define YYSTATE YY_START
00087
00088 /* Action number for EOF rule of a given start state. */
00089 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00090
00091 /* Special action meaning "start processing a new file". */
00092 #define YY_NEW_FILE yyrestart( yyin )
00093
00094 #define YY_END_OF_BUFFER_CHAR 0
00095
00096 /* Size of default input buffer. */
00097 #define YY_BUF_SIZE 16384
00098
00099 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00100
00101 extern int yyleng;
00102 extern FILE *yyin, *yyout;
00103
00104 #define EOB_ACT_CONTINUE_SCAN 0
00105 #define EOB_ACT_END_OF_FILE 1
00106 #define EOB_ACT_LAST_MATCH 2
00107
00108 /* The funky do-while in the following #define is used to turn the definition
00109  * int a single C statement (which needs a semi-colon terminator).  This
00110  * avoids problems with code like:
00111  *
00112  *  if ( condition_holds )
00113  *      yyless( 5 );
00114  *  else
00115  *      do_something_else();
00116  *
00117  * Prior to using the do-while the compiler would get upset at the
00118  * "else" because it interpreted the "if" statement as being all
00119  * done when it reached the ';' after the yyless() call.
00120  */
00121
00122 /* Return all but the first 'n' matched characters back to the input stream. */
00123
00124 #define yyless(n) \
00125     do \
00126         { \
00127         /* Undo effects of setting up yytext. */ \
00128         *yy_cp = yy_hold_char; \
00129         YY_RESTORE_YY_MORE_OFFSET \
00130         yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
00131         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
00132         } \
00133     while ( 0 )
00134
00135 #define unput(c) yyunput( c, yytext_ptr )
00136
00137 /* The following is because we cannot portably get our hands on size_t
00138  * (without autoconf's help, which isn't available because we want
00139  * flex-generated scanners to compile on their own).
00140  */
00141 typedef unsigned int yy_size_t;
00142
00143
00144 struct yy_buffer_state
00145     {
00146     FILE *yy_input_file;
00147
00148     char *yy_ch_buf;        /* input buffer */
00149     char *yy_buf_pos;       /* current position in input buffer */
00150
00151     /* Size of input buffer in bytes, not including room for EOB
00152      * characters.
00153      */
00154     yy_size_t yy_buf_size;
00155
00156     /* Number of characters read into yy_ch_buf, not including EOB
00157      * characters.
00158      */
00159     int yy_n_chars;
00160
00161     /* Whether we "own" the buffer - i.e., we know we created it,
00162      * and can realloc() it to grow it, and should free() it to
00163      * delete it.
00164      */
00165     int yy_is_our_buffer;
00166
00167     /* Whether this is an "interactive" input source; if so, and
00168      * if we're using stdio for input, then we want to use getc()
00169      * instead of fread(), to make sure we stop fetching input after
00170      * each newline.
00171      */
00172     int yy_is_interactive;
00173
00174     /* Whether we're considered to be at the beginning of a line.
00175      * If so, '^' rules will be active on the next match, otherwise
00176      * not.
00177      */
00178     int yy_at_bol;
00179
00180     /* Whether to try to fill the input buffer when we reach the
00181      * end of it.
00182      */
00183     int yy_fill_buffer;
00184
00185     int yy_buffer_status;
00186 #define YY_BUFFER_NEW 0
00187 #define YY_BUFFER_NORMAL 1
00188     /* When an EOF's been seen but there's still some text to process
00189      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00190      * shouldn't try reading from the input source any more.  We might
00191      * still have a bunch of tokens to match, though, because of
00192      * possible backing-up.
00193      *
00194      * When we actually see the EOF, we change the status to "new"
00195      * (via yyrestart()), so that the user can continue scanning by
00196      * just pointing yyin at a new input file.
00197      */
00198 #define YY_BUFFER_EOF_PENDING 2
00199     };
00200
00201 static YY_BUFFER_STATE yy_current_buffer = 0;
00202
00203 /* We provide macros for accessing buffer states in case in the
00204  * future we want to put the buffer states in a more general
00205  * "scanner state".
00206  */
00207 #define YY_CURRENT_BUFFER yy_current_buffer
00208
00209
00210 /* yy_hold_char holds the character lost when yytext is formed. */
00211 static char yy_hold_char;
00212
00213 static int yy_n_chars;      /* number of characters read into yy_ch_buf */
00214
00215
00216 int yyleng;
00217
00218 /* Points to current character in buffer. */
00219 static char *yy_c_buf_p = (char *) 0;
00220 static int yy_init = 1;     /* whether we need to initialize */
00221 static int yy_start = 0;    /* start state number */
00222
00223 /* Flag which is used to allow yywrap()'s to do buffer switches
00224  * instead of setting up a fresh yyin.  A bit of a hack ...
00225  */
00226 static int yy_did_buffer_switch_on_eof;
00227
00228 void yyrestart YY_PROTO(( FILE *input_file ));
00229
00230 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
00231 void yy_load_buffer_state YY_PROTO(( void ));
00232 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
00233 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
00234 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
00235 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
00236 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
00237
00238 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
00239 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
00240 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
00241
00242 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
00243 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
00244 static void yy_flex_free YY_PROTO(( void * ));
00245
00246 #define yy_new_buffer yy_create_buffer
00247
00248 #define yy_set_interactive(is_interactive) \
00249     { \
00250     if ( ! yy_current_buffer ) \
00251         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
00252     yy_current_buffer->yy_is_interactive = is_interactive; \
00253     }
00254
00255 #define yy_set_bol(at_bol) \
00256     { \
00257     if ( ! yy_current_buffer ) \
00258         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
00259     yy_current_buffer->yy_at_bol = at_bol; \
00260     }
00261
00262 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
00263
00264 typedef unsigned char YY_CHAR;
00265 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
00266 typedef int yy_state_type;
00267 extern char *yytext;
00268 #define yytext_ptr yytext
00269
00270 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
00271 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
00272 static int yy_get_next_buffer YY_PROTO(( void ));
00273 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
00274
00275 /* Done after the current pattern has been matched and before the
00276  * corresponding action - sets up yytext.
00277  */
00278 #define YY_DO_BEFORE_ACTION \
00279     yytext_ptr = yy_bp; \
00280     yyleng = (int) (yy_cp - yy_bp); \
00281     yy_hold_char = *yy_cp; \
00282     *yy_cp = '\0'; \
00283     yy_c_buf_p = yy_cp;
00284
00285 #define YY_NUM_RULES 40
00286 #define YY_END_OF_BUFFER 41
00287 static yyconst short int yy_accept[377] =
00288     {   0,
00289         1,    1,    0,    0,    0,    0,    0,    0,    0,    0,
00290         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00291        41,   39,    1,    1,   23,   37,   38,   23,   23,   23,
00292        23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
00293        28,   39,   29,   31,   31,   30,   33,   33,   33,   39,
00294        34,   27,   27,   26,   27,   27,   39,   36,   35,    1,
00295         1,    1,    1,   23,   37,   38,   38,   23,   23,   23,
00296        23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
00297        23,   23,   23,   23,   23,   28,   29,   30,    0,   32,
00298        34,    0,    0,   35,   23,   23,   23,   23,   23,   23,
00299
00300        23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
00301        23,   23,   23,    0,    0,   23,   23,    0,   23,   23,
00302        23,   23,   14,   23,    4,   23,   23,   23,   23,   23,
00303        23,   23,   23,   23,    0,    0,   23,   23,    0,   23,
00304        23,   23,   23,   23,   23,   19,   23,    6,   23,   23,
00305        16,   23,   23,   23,    0,    0,   23,   23,    0,   23,
00306        23,   15,    5,   23,   23,   23,   23,   23,   18,   23,
00307         0,    0,    0,   23,   23,    0,   23,    0,   23,   23,
00308        23,    0,   23,   23,   23,    0,    0,    0,   23,   23,
00309         2,    0,    0,   17,   23,    0,    0,   13,   23,   23,
00310
00311         0,    0,    0,   23,   23,    0,    0,   23,    0,   20,
00312         0,    0,    0,    0,    0,   23,   23,    0,    0,   23,
00313         0,    0,    0,    0,    0,    0,   23,   23,    0,    7,
00314        12,    0,    0,    0,    0,    0,    0,   23,   23,    3,
00315         0,    0,    0,    0,    0,    0,   23,   23,    0,    0,
00316         0,    0,    0,    0,   23,   23,    0,    0,    8,    0,
00317         0,    0,   23,   23,    0,    0,   10,    0,    0,   23,
00318        23,    0,    0,    0,    0,   23,   23,    0,    0,    0,
00319         0,   23,   23,    0,   11,    0,    0,   23,   23,    0,
00320         0,    0,   23,   23,    9,    0,    0,   23,   23,    0,
00321
00322         0,   23,   23,    0,    0,   23,   23,    0,    0,   23,
00323        23,    0,    0,   23,   23,    0,    0,   23,   23,    0,
00324         0,   23,   23,    0,    0,   21,   23,   24,    0,   23,
00325         0,   23,    0,   23,    0,   23,    0,   23,    0,   23,
00326         0,   23,    0,   23,    0,   23,    0,   23,    0,   23,
00327         0,   23,    0,   23,    0,   23,    0,   23,    0,   23,
00328         0,   23,    0,   23,    0,   23,    0,   23,    0,   23,
00329         0,   22,   25,   22,   25,    0
00330     } ;
00331
00332 static yyconst int yy_ec[256] =
00333     {   0,
00334         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
00335         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
00336         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00337         1,    4,    1,    1,    1,    1,    1,    1,    1,    1,
00338         1,    1,    5,    1,    6,    7,    8,    9,    9,    9,
00339         9,    9,    9,    9,    9,    9,    9,   10,   11,    1,
00340        12,    1,    1,    1,    1,    1,   13,    1,    1,    1,
00341         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00342         1,   14,   15,    1,    1,    1,   16,    1,    1,    1,
00343         1,    1,    1,    1,    1,    1,   17,   18,   19,   20,
00344
00345        21,   22,   23,   24,   25,    1,   26,   27,   28,   29,
00346        30,   31,    1,   32,   33,   34,   35,   36,   37,    1,
00347        38,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00348         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00349         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00350         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00351         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00352         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00353         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00354         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00355
00356         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00357         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00358         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00359         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00360         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00361         1,    1,    1,    1,    1
00362     } ;
00363
00364 static yyconst int yy_meta[39] =
00365     {   0,
00366         1,    2,    2,    3,    1,    1,    1,    1,    1,    3,
00367         3,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00368         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00369         1,    1,    1,    1,    1,    1,    1,    1
00370     } ;
00371
00372 static yyconst short int yy_base[384] =
00373     {   0,
00374         0,    3,    7,    0,   44,   47,   50,   53,   56,   64,
00375        72,   80,   88,   94,  100,  108,  116,  121,  132,    0,
00376       495,  496,  127,  141,    0,  144,  147,  488,  481,  479,
00377       461,   44,  458,  133,  468,  467,   63,  466,  118,  456,
00378         0,  476,  475,  496,  474,  473,  496,  155,  155,  472,
00379       471,  496,  163,  151,  473,  466,  468,  496,  467,  166,
00380       169,  172,  175,    0,  178,  181,  182,  469,  462,  458,
00381       440,  452,  436,  452,  434,  434,  449,  427,  435,  444,
00382       426,  434,   55,  432,  425,    0,  449,  448,  447,  446,
00383       445,  447,  440,  442,  444,  437,  444,  421,  425,  421,
00384
00385       415,  422,  423,  421,  403,  418,  412,  412,  415,  401,
00386       409,  415,  415,  425,  418,  423,  416,  405,  401,  392,
00387       394,  404,    0,  390,    0,  391,  387,  166,  386,  399,
00388       396,  397,  385,  387,  407,  400,  405,  398,  384,  379,
00389       374,  374,  381,  379,  371,    0,  382,    0,  376,  366,
00390         0,  365,  371,  393,  390,  383,  388,  381,  365,  368,
00391       386,    0,  368,  357,  367,  382,  355,  363,    0,  358,
00392       350,  375,  368,  373,  366,  356,  372,  348,  341,  339,
00393       368,  353,  341,  349,  349,  346,  360,  353,  358,  351,
00394       496,  340,  336,    0,  335,  326,  320,    0,  353,  352,
00395
00396       319,  348,  341,  346,  339,  325,  316,  318,  312,  496,
00397       314,  316,  319,  337,  330,  335,  328,  312,  304,  308,
00398       318,  314,  317,  300,  326,  319,  324,  317,  307,  496,
00399         0,  294,  290,  297,  299,  317,  310,  315,  308,  496,
00400       285,  293,  296,  286,  309,  302,  307,  300,  286,  277,
00401       276,  279,  301,  294,  299,  292,  269,  277,  496,  268,
00402       294,  287,  292,  285,  261,  265,  496,  288,  281,  286,
00403       279,  256,  260,  282,  275,  280,  273,  259,  250,  276,
00404       269,  274,  267,  248,  496,  271,  264,  269,  262,  244,
00405       266,  259,  264,  257,  496,  262,  255,  260,  253,  258,
00406
00407       251,  256,  249,  254,  247,  252,  245,  250,  243,  248,
00408       241,  246,  239,  244,  237,  242,  235,  240,  233,  238,
00409       231,  236,  229,  234,  227,    0,  226,  496,  225,  224,
00410       223,  222,  221,  220,  219,  218,  217,  216,  215,  214,
00411       213,  212,  211,  210,  209,  208,  207,  206,  204,  186,
00412       185,  184,  183,  182,  181,  180,  179,  178,  177,  176,
00413       151,  150,  120,  114,  109,  104,  103,   96,   95,   88,
00414        87,   82,   68,   59,   52,  496,  199,  202,  205,  208,
00415       211,    0,  214
00416     } ;
00417
00418 static yyconst short int yy_def[384] =
00419     {   0,
00420       377,  377,  376,    3,  378,  378,  377,  377,  377,  377,
00421       379,  379,  380,  380,  377,  377,  381,  381,  377,   19,
00422       376,  376,  376,  376,  382,  376,  376,  382,  382,  382,
00423       382,  382,  382,  382,  382,  382,  382,  382,  382,  382,
00424       383,  376,  376,  376,  376,  376,  376,  376,  376,  376,
00425       376,  376,  376,  376,  376,  376,  376,  376,  376,  376,
00426       376,  376,  376,  382,  376,  376,  376,  382,  382,  382,
00427       382,  382,  382,  382,  382,  382,  382,  382,  382,  382,
00428       382,  382,  382,  382,  382,  383,  376,  376,  376,  376,
00429       376,  376,  376,  376,  382,  382,  382,  382,  382,  382,
00430
00431       382,  382,  382,  382,  382,  382,  382,  382,  382,  382,
00432       382,  382,  382,  376,  376,  382,  382,  376,  382,  382,
00433       382,  382,  382,  382,  382,  382,  382,  382,  382,  382,
00434       382,  382,  382,  382,  376,  376,  382,  382,  376,  382,
00435       382,  382,  382,  382,  382,  382,  382,  382,  382,  382,
00436       382,  382,  382,  382,  376,  376,  382,  382,  376,  382,
00437       382,  382,  382,  382,  382,  382,  382,  382,  382,  382,
00438       376,  376,  376,  382,  382,  376,  382,  376,  382,  382,
00439       382,  376,  382,  382,  382,  376,  376,  376,  382,  382,
00440       376,  376,  376,  382,  382,  376,  376,  382,  382,  382,
00441
00442       376,  376,  376,  382,  382,  376,  376,  382,  376,  376,
00443       376,  376,  376,  376,  376,  382,  382,  376,  376,  382,
00444       376,  376,  376,  376,  376,  376,  382,  382,  376,  376,
00445       382,  376,  376,  376,  376,  376,  376,  382,  382,  376,
00446       376,  376,  376,  376,  376,  376,  382,  382,  376,  376,
00447       376,  376,  376,  376,  382,  382,  376,  376,  376,  376,
00448       376,  376,  382,  382,  376,  376,  376,  376,  376,  382,
00449       382,  376,  376,  376,  376,  382,  382,  376,  376,  376,
00450       376,  382,  382,  376,  376,  376,  376,  382,  382,  376,
00451       376,  376,  382,  382,  376,  376,  376,  382,  382,  376,
00452
00453       376,  382,  382,  376,  376,  382,  382,  376,  376,  382,
00454       382,  376,  376,  382,  382,  376,  376,  382,  382,  376,
00455       376,  382,  382,  376,  376,  382,  382,  376,  376,  382,
00456       376,  382,  376,  382,  376,  382,  376,  382,  376,  382,
00457       376,  382,  376,  382,  376,  382,  376,  382,  376,  382,
00458       376,  382,  376,  382,  376,  382,  376,  382,  376,  382,
00459       376,  382,  376,  382,  376,  382,  376,  382,  376,  382,
00460       376,  382,  376,  382,  376,    0,  376,  376,  376,  376,
00461       376,  376,  376
00462     } ;
00463
00464 static yyconst short int yy_nxt[535] =
00465     {   0,
00466        64,   23,   24,   23,   23,   24,   23,   25,   26,   27,
00467        26,   25,   28,   25,   25,   25,   22,   22,   29,   25,
00468        30,   25,   31,   32,   33,   25,   34,   25,   25,   25,
00469        35,   25,   36,   37,   25,   25,   25,   25,   38,   39,
00470        40,   25,   25,   25,   25,   26,   27,   26,   26,   27,
00471        26,   26,   27,   26,   26,   27,   26,   26,   27,   26,
00472        42,   42,   72,  375,   43,   26,   27,   26,   42,   42,
00473       374,  110,   43,   26,   27,   26,   45,   45,   73,  375,
00474        46,   26,   27,   26,   45,   45,  111,   79,   46,   48,
00475        27,   48,   80,  374,   49,   48,   27,   48,  373,  372,
00476
00477        49,   26,   27,   26,   50,   50,  371,  370,   51,   26,
00478        27,   26,   50,   50,  369,  368,   51,   53,   54,   53,
00479       367,   55,   53,   54,   53,  366,   55,   56,   60,   61,
00480        60,  365,   56,   26,   27,   26,   57,   57,   82,   58,
00481        59,   58,   62,   63,   62,   65,   66,   65,   67,   75,
00482        67,   83,   67,   76,   67,   84,   65,   66,   65,   89,
00483        89,  364,  363,   90,   65,   66,   65,   60,   61,   60,
00484        62,   63,   62,   62,   63,   62,   63,   63,   63,   65,
00485        66,   65,   67,   67,   67,   67,  147,  362,  361,  360,
00486       359,  358,  357,  356,  355,  354,  353,  352,  148,   22,
00487
00488        22,   22,   41,   41,   41,   44,   44,   44,   47,   47,
00489        47,   52,   52,   52,   86,  351,   86,  350,  349,  348,
00490       347,  346,  345,  344,  343,  342,  341,  340,  339,  338,
00491       337,  336,  335,  334,  333,  332,  331,  330,  329,  328,
00492       327,  326,  325,  324,  323,  322,  321,  320,  319,  318,
00493       317,  316,  315,  314,  313,  312,  311,  310,  309,  308,
00494       307,  306,  305,  304,  303,  302,  301,  300,  299,  298,
00495       297,  296,  295,  294,  293,  292,  291,  290,  289,  288,
00496       287,  286,  285,  284,  283,  282,  281,  280,  279,  278,
00497       277,  276,  275,  274,  273,  272,  271,  270,  269,  268,
00498
00499       267,  266,  265,  264,  263,  262,  261,  260,  259,  258,
00500       257,  256,  255,  254,  253,  252,  251,  250,  249,  248,
00501       247,  246,  245,  244,  243,  242,  241,  240,  239,  238,
00502       237,  236,  235,  234,  233,  232,  231,  230,  229,  228,
00503       227,  226,  225,  224,  223,  222,  221,  220,  219,  218,
00504       217,  216,  215,  214,  213,  212,  211,  210,  209,  208,
00505       207,  206,  205,  204,  203,  202,  201,  200,  199,  198,
00506       197,  196,  195,  194,  193,  192,  191,  190,  189,  188,
00507       187,  186,  185,  184,  183,  182,  181,  180,  179,  178,
00508       177,  176,  175,  174,  173,  172,  171,  170,  169,  168,
00509
00510       167,  166,  165,  164,  163,  162,  161,  160,  159,  158,
00511       157,  156,  155,  154,  153,  152,  151,  150,  149,  146,
00512       145,  144,  143,  142,  141,  140,  139,  138,  137,  136,
00513       135,  134,  133,  132,  131,  130,  129,  128,  127,  126,
00514       125,  124,  123,  122,  121,  120,  119,  118,  117,  116,
00515        94,  115,  114,   91,   90,   90,   88,   87,  113,  112,
00516       109,  108,  107,  106,  105,  104,  103,  102,  101,  100,
00517        99,   98,   97,   96,   95,   94,   94,   93,   92,   91,
00518        91,   88,   88,   87,   87,   85,   81,   78,   77,   74,
00519        71,   70,   69,   68,  376,   21,  376,  376,  376,  376,
00520
00521       376,  376,  376,  376,  376,  376,  376,  376,  376,  376,
00522       376,  376,  376,  376,  376,  376,  376,  376,  376,  376,
00523       376,  376,  376,  376,  376,  376,  376,  376,  376,  376,
00524       376,  376,  376,  376
00525     } ;
00526
00527 static yyconst short int yy_chk[535] =
00528     {   0,
00529       382,    1,    1,    1,    2,    2,    2,    3,    3,    3,
00530         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
00531         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
00532         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
00533         3,    3,    3,    3,    3,    5,    5,    5,    6,    6,
00534         6,    7,    7,    7,    8,    8,    8,    9,    9,    9,
00535         9,    9,   32,  375,    9,   10,   10,   10,   10,   10,
00536       374,   83,   10,   11,   11,   11,   11,   11,   32,  373,
00537        11,   12,   12,   12,   12,   12,   83,   37,   12,   13,
00538        13,   13,   37,  372,   13,   14,   14,   14,  371,  370,
00539
00540        14,   15,   15,   15,   15,   15,  369,  368,   15,   16,
00541        16,   16,   16,   16,  367,  366,   16,   17,   17,   17,
00542       365,   17,   18,   18,   18,  364,   18,   17,   23,   23,
00543        23,  363,   18,   19,   19,   19,   19,   19,   39,   19,
00544        19,   19,   24,   24,   24,   26,   26,   26,   27,   34,
00545        27,   39,   54,   34,   54,   39,   48,   48,   48,   49,
00546        49,  362,  361,   49,   53,   53,   53,   60,   60,   60,
00547        61,   61,   61,   62,   62,   62,   63,   63,   63,   65,
00548        65,   65,   66,   67,   66,   67,  128,  360,  359,  358,
00549       357,  356,  355,  354,  353,  352,  351,  350,  128,  377,
00550
00551       377,  377,  378,  378,  378,  379,  379,  379,  380,  380,
00552       380,  381,  381,  381,  383,  349,  383,  348,  347,  346,
00553       345,  344,  343,  342,  341,  340,  339,  338,  337,  336,
00554       335,  334,  333,  332,  331,  330,  329,  327,  325,  324,
00555       323,  322,  321,  320,  319,  318,  317,  316,  315,  314,
00556       313,  312,  311,  310,  309,  308,  307,  306,  305,  304,
00557       303,  302,  301,  300,  299,  298,  297,  296,  294,  293,
00558       292,  291,  290,  289,  288,  287,  286,  284,  283,  282,
00559       281,  280,  279,  278,  277,  276,  275,  274,  273,  272,
00560       271,  270,  269,  268,  266,  265,  264,  263,  262,  261,
00561
00562       260,  258,  257,  256,  255,  254,  253,  252,  251,  250,
00563       249,  248,  247,  246,  245,  244,  243,  242,  241,  239,
00564       238,  237,  236,  235,  234,  233,  232,  229,  228,  227,
00565       226,  225,  224,  223,  222,  221,  220,  219,  218,  217,
00566       216,  215,  214,  213,  212,  211,  209,  208,  207,  206,
00567       205,  204,  203,  202,  201,  200,  199,  197,  196,  195,
00568       193,  192,  190,  189,  188,  187,  186,  185,  184,  183,
00569       182,  181,  180,  179,  178,  177,  176,  175,  174,  173,
00570       172,  171,  170,  168,  167,  166,  165,  164,  163,  161,
00571       160,  159,  158,  157,  156,  155,  154,  153,  152,  150,
00572
00573       149,  147,  145,  144,  143,  142,  141,  140,  139,  138,
00574       137,  136,  135,  134,  133,  132,  131,  130,  129,  127,
00575       126,  124,  122,  121,  120,  119,  118,  117,  116,  115,
00576       114,  113,  112,  111,  110,  109,  108,  107,  106,  105,
00577       104,  103,  102,  101,  100,   99,   98,   97,   96,   95,
00578        94,   93,   92,   91,   90,   89,   88,   87,   85,   84,
00579        82,   81,   80,   79,   78,   77,   76,   75,   74,   73,
00580        72,   71,   70,   69,   68,   59,   57,   56,   55,   51,
00581        50,   46,   45,   43,   42,   40,   38,   36,   35,   33,
00582        31,   30,   29,   28,   21,  376,  376,  376,  376,  376,
00583
00584       376,  376,  376,  376,  376,  376,  376,  376,  376,  376,
00585       376,  376,  376,  376,  376,  376,  376,  376,  376,  376,
00586       376,  376,  376,  376,  376,  376,  376,  376,  376,  376,
00587       376,  376,  376,  376
00588     } ;
00589
00590 static yy_state_type yy_last_accepting_state;
00591 static char *yy_last_accepting_cpos;
00592
00593 /* The intent behind this definition is that it'll catch
00594  * any uses of REJECT which flex missed.
00595  */
00596 #define REJECT reject_used_but_not_detected
00597 #define yymore() yymore_used_but_not_detected
00598 #define YY_MORE_ADJ 0
00599 #define YY_RESTORE_YY_MORE_OFFSET
00600 char *yytext;
00601 #line 1 "lexer.ll"
00602 #define INITIAL 0
00603 #line 2 "lexer.ll"
00604 /*
00605 ** This program is free software; you can redistribute it and/or modify
00606 ** it under the terms of the GNU General Public License as published by
00607 ** the Free Software Foundation; either version 1, or (at your option)
00608 ** any later version.
00609
00610 ** This program is distributed in the hope that it will be useful,
00611 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00612 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00613 ** GNU General Public License for more details.
00614
00615 ** You should have received a copy of the GNU General Public License
00616 ** along with this program; if not, write to the Free Software
00617 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00618 */
00619
00620 #include <string.h>
00621 #include "common.h"
00622 #include "parser.h"
00623
00624 // Current line number
00625 int currentLineNumber = 1;
00626
00627 // token expected by the parser
00628 kTokens expectToken = kNone;
00629
00630 CRevNumber revnumber;
00631
00632 extern "C" int yywrap() { BEGIN INITIAL; return 1; }
00633 /* Normal state:  parsing nodes.  The initial start state is used */
00634 /* only to recognize the VRML header. */
00635 #define NODE 1
00636
00637 /* Start tokens for all of the field types, */
00638 /* except for MFNode and SFNode, which are almost completely handled */
00639 /* by the parser: */
00640 #define ST_STRING 2
00641 #define ST_TAG 3
00642 #define ST_REV 4
00643 #define ST_REVORNIL 5
00644 #define ST_INREV 6
00645 #define ST_INT 7
00646
00647 #define ST_ANYBUTSEP 8
00648 #define ST_DATE 9
00649
00650 /* positive integer */
00651 /* Whitespace. */
00652 /* And the same pattern without the newline */
00653 /* a string */
00654 /* a tag/author/state string */
00655 /*revfollow (----------------------------)*/
00656 /*endfollow (=============================================================================)*/
00657 #line 658 "lex.yy.c"
00658
00659 /* Macros after this point can all be overridden by user definitions in
00660  * section 1.
00661  */
00662
00663 #ifndef YY_SKIP_YYWRAP
00664 #ifdef __cplusplus
00665 extern "C" int yywrap YY_PROTO(( void ));
00666 #else
00667 extern int yywrap YY_PROTO(( void ));
00668 #endif
00669 #endif
00670
00671 #ifndef YY_NO_UNPUT
00672 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
00673 #endif
00674
00675 #ifndef yytext_ptr
00676 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
00677 #endif
00678
00679 #ifdef YY_NEED_STRLEN
00680 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
00681 #endif
00682
00683 #ifndef YY_NO_INPUT
00684 #ifdef __cplusplus
00685 static int yyinput YY_PROTO(( void ));
00686 #else
00687 static int input YY_PROTO(( void ));
00688 #endif
00689 #endif
00690
00691 #if YY_STACK_USED
00692 static int yy_start_stack_ptr = 0;
00693 static int yy_start_stack_depth = 0;
00694 static int *yy_start_stack = 0;
00695 #ifndef YY_NO_PUSH_STATE
00696 static void yy_push_state YY_PROTO(( int new_state ));
00697 #endif
00698 #ifndef YY_NO_POP_STATE
00699 static void yy_pop_state YY_PROTO(( void ));
00700 #endif
00701 #ifndef YY_NO_TOP_STATE
00702 static int yy_top_state YY_PROTO(( void ));
00703 #endif
00704
00705 #else
00706 #define YY_NO_PUSH_STATE 1
00707 #define YY_NO_POP_STATE 1
00708 #define YY_NO_TOP_STATE 1
00709 #endif
00710
00711 #ifdef YY_MALLOC_DECL
00712 YY_MALLOC_DECL
00713 #else
00714 #if __STDC__
00715 #ifndef __cplusplus
00716 #include <stdlib.h>
00717 #endif
00718 #else
00719 /* Just try to get by without declaring the routines.  This will fail
00720  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
00721  * or sizeof(void*) != sizeof(int).
00722  */
00723 #endif
00724 #endif
00725
00726 /* Amount of stuff to slurp up with each read. */
00727 #ifndef YY_READ_BUF_SIZE
00728 #define YY_READ_BUF_SIZE 8192
00729 #endif
00730
00731 /* Copy whatever the last rule matched to the standard output. */
00732
00733 #ifndef ECHO
00734 /* This used to be an fputs(), but since the string might contain NUL's,
00735  * we now use fwrite().
00736  */
00737 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
00738 #endif
00739
00740 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00741  * is returned in "result".
00742  */
00743 #ifndef YY_INPUT
00744 #define YY_INPUT(buf,result,max_size) \
00745     if ( yy_current_buffer->yy_is_interactive ) \
00746         { \
00747         int c = '*', n; \
00748         for ( n = 0; n < max_size && \
00749                  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
00750             buf[n] = (char) c; \
00751         if ( c == '\n' ) \
00752             buf[n++] = (char) c; \
00753         if ( c == EOF && ferror( yyin ) ) \
00754             YY_FATAL_ERROR( "input in flex scanner failed" ); \
00755         result = n; \
00756         } \
00757     else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
00758           && ferror( yyin ) ) \
00759         YY_FATAL_ERROR( "input in flex scanner failed" );
00760 #endif
00761
00762 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00763  * we don't want an extra ';' after the "return" because that will cause
00764  * some compilers to complain about unreachable statements.
00765  */
00766 #ifndef yyterminate
00767 #define yyterminate() return YY_NULL
00768 #endif
00769
00770 /* Number of entries by which start-condition stack grows. */
00771 #ifndef YY_START_STACK_INCR
00772 #define YY_START_STACK_INCR 25
00773 #endif
00774
00775 /* Report a fatal error. */
00776 #ifndef YY_FATAL_ERROR
00777 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
00778 #endif
00779
00780 /* Default declaration of generated scanner - a define so the user can
00781  * easily add parameters.
00782  */
00783 #ifndef YY_DECL
00784 #define YY_DECL int yylex YY_PROTO(( void ))
00785 #endif
00786
00787 /* Code executed at the beginning of each rule, after yytext and yyleng
00788  * have been set up.
00789  */
00790 #ifndef YY_USER_ACTION
00791 #define YY_USER_ACTION
00792 #endif
00793
00794 /* Code executed at the end of each rule. */
00795 #ifndef YY_BREAK
00796 #define YY_BREAK break;
00797 #endif
00798
00799 #define YY_RULE_SETUP \
00800     YY_USER_ACTION
00801
00802 YY_DECL
00803     {
00804     register yy_state_type yy_current_state;
00805     register char *yy_cp, *yy_bp;
00806     register int yy_act;
00807
00808 #line 58 "lexer.ll"
00809
00810
00811
00812     /* Switch into a new start state if the parser */
00813     /* just told us that we've read a field name */
00814     /* and should expect a field value (or IS) */
00815 #if qCvsDebug
00816     if (yy_flex_debug)
00817         fprintf(stderr,"LEX--> Start State %d\n", expectToken);
00818 #endif
00819
00820     switch(expectToken)
00821     {
00822     case kNone: BEGIN NODE; break;
00823     case kString: BEGIN ST_STRING; break;
00824     case kRevnum: BEGIN ST_REV; break;
00825     case kRevnumOrNil: BEGIN ST_REVORNIL; break;
00826     case kInt: BEGIN ST_INT; break;
00827     case kDate: BEGIN ST_DATE; break;
00828     case kAnyButSep: BEGIN ST_ANYBUTSEP; break;
00829     default: yyerror("ACK: Bad expectToken"); break;
00830     }
00831
00832
00833 #line 834 "lex.yy.c"
00834
00835     if ( yy_init )
00836         {
00837         yy_init = 0;
00838
00839 #ifdef YY_USER_INIT
00840         YY_USER_INIT;
00841 #endif
00842
00843         if ( ! yy_start )
00844             yy_start = 1;   /* first start state */
00845
00846         if ( ! yyin )
00847             yyin = stdin;
00848
00849         if ( ! yyout )
00850             yyout = stdout;
00851
00852         if ( ! yy_current_buffer )
00853             yy_current_buffer =
00854                 yy_create_buffer( yyin, YY_BUF_SIZE );
00855
00856         yy_load_buffer_state();
00857         }
00858
00859     while ( 1 )     /* loops until end-of-file is reached */
00860         {
00861         yy_cp = yy_c_buf_p;
00862
00863         /* Support of yytext. */
00864         *yy_cp = yy_hold_char;
00865
00866         /* yy_bp points to the position in yy_ch_buf of the start of
00867          * the current run.
00868          */
00869         yy_bp = yy_cp;
00870
00871         yy_current_state = yy_start;
00872 yy_match:
00873         do
00874             {
00875             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00876             if ( yy_accept[yy_current_state] )
00877                 {
00878                 yy_last_accepting_state = yy_current_state;
00879                 yy_last_accepting_cpos = yy_cp;
00880                 }
00881             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00882                 {
00883                 yy_current_state = (int) yy_def[yy_current_state];
00884                 if ( yy_current_state >= 377 )
00885                     yy_c = yy_meta[(unsigned int) yy_c];
00886                 }
00887             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00888             ++yy_cp;
00889             }
00890         while ( yy_base[yy_current_state] != 496 );
00891
00892 yy_find_action:
00893         yy_act = yy_accept[yy_current_state];
00894         if ( yy_act == 0 )
00895             { /* have to back up */
00896             yy_cp = yy_last_accepting_cpos;
00897             yy_current_state = yy_last_accepting_state;
00898             yy_act = yy_accept[yy_current_state];
00899             }
00900
00901         YY_DO_BEFORE_ACTION;
00902
00903
00904 do_action:  /* This label is used only to access EOF actions. */
00905
00906
00907         switch ( yy_act )
00908     { /* beginning of action switch */
00909             case 0: /* must back up */
00910             /* undo the effects of YY_DO_BEFORE_ACTION */
00911             *yy_cp = yy_hold_char;
00912             yy_cp = yy_last_accepting_cpos;
00913             yy_current_state = yy_last_accepting_state;
00914             goto yy_find_action;
00915
00916 case 1:
00917 YY_RULE_SETUP
00918 #line 82 "lexer.ll"
00919 { BEGIN NODE; }
00920     YY_BREAK
00921 case 2:
00922 YY_RULE_SETUP
00923 #line 84 "lexer.ll"
00924 { return ID_RCS; }
00925     YY_BREAK
00926 case 3:
00927 YY_RULE_SETUP
00928 #line 85 "lexer.ll"
00929 { return ID_WORKING; }
00930     YY_BREAK
00931 case 4:
00932 YY_RULE_SETUP
00933 #line 86 "lexer.ll"
00934 { return ID_HEAD; }
00935     YY_BREAK
00936 case 5:
00937 YY_RULE_SETUP
00938 #line 87 "lexer.ll"
00939 { return ID_BRANCH; }
00940     YY_BREAK
00941 case 6:
00942 YY_RULE_SETUP
00943 #line 88 "lexer.ll"
00944 { return ID_LOCKS; }
00945     YY_BREAK
00946 case 7:
00947 YY_RULE_SETUP
00948 #line 89 "lexer.ll"
00949 { return ID_ACCESS; }
00950     YY_BREAK
00951 case 8:
00952 YY_RULE_SETUP
00953 #line 90 "lexer.ll"
00954 { return ID_SYMBOLIC; }
00955     YY_BREAK
00956 case 9:
00957 YY_RULE_SETUP
00958 #line 91 "lexer.ll"
00959 { return ID_KEYWORD; }
00960     YY_BREAK
00961 case 10:
00962 YY_RULE_SETUP
00963 #line 92 "lexer.ll"
00964 { return ID_TOTREVISIONS; }
00965     YY_BREAK
00966 case 11:
00967 YY_RULE_SETUP
00968 #line 93 "lexer.ll"
00969 { return ID_SELREVISIONS; }
00970     YY_BREAK
00971 case 12:
00972 YY_RULE_SETUP
00973 #line 94 "lexer.ll"
00974 { return ID_DESCRIPTION; }
00975     YY_BREAK
00976 case 13:
00977 YY_RULE_SETUP
00978 #line 95 "lexer.ll"
00979 { return ID_REVISION; }
00980     YY_BREAK
00981 case 14:
00982 YY_RULE_SETUP
00983 #line 96 "lexer.ll"
00984 { return ID_DATE; }
00985     YY_BREAK
00986 case 15:
00987 YY_RULE_SETUP
00988 #line 97 "lexer.ll"
00989 { return ID_AUTHOR; }
00990     YY_BREAK
00991 case 16:
00992 YY_RULE_SETUP
00993 #line 98 "lexer.ll"
00994 { return ID_STATE; }
00995     YY_BREAK
00996 case 17:
00997 YY_RULE_SETUP
00998 #line 99 "lexer.ll"
00999 { return ID_BRANCHES; }
01000     YY_BREAK
01001 case 18:
01002 YY_RULE_SETUP
01003 #line 100 "lexer.ll"
01004 { return ID_STRICT; }
01005     YY_BREAK
01006 case 19:
01007 YY_RULE_SETUP
01008 #line 101 "lexer.ll"
01009 { return ID_LINES; }
01010     YY_BREAK
01011 case 20:
01012 YY_RULE_SETUP
01013 #line 102 "lexer.ll"
01014 { return ID_LOCKEDBY; }
01015     YY_BREAK
01016 case 21:
01017 YY_RULE_SETUP
01018 #line 104 "lexer.ll"
01019 { return ID_REVFOLLOW; }
01020     YY_BREAK
01021 case 22:
01022 YY_RULE_SETUP
01023 #line 105 "lexer.ll"
01024 { return ID_ENDFOLLOW; }
01025     YY_BREAK
01026 case 23:
01027 YY_RULE_SETUP
01028 #line 106 "lexer.ll"
01029 {
01030     yylval_set(yytext);
01031     return TAG;
01032 }
01033     YY_BREAK
01034 case 24:
01035 YY_RULE_SETUP
01036 #line 111 "lexer.ll"
01037 {
01038     BEGIN NODE;
01039     expectToken = kNone;
01040
01041     return ID_REVFOLLOW;
01042 }
01043     YY_BREAK
01044 case 25:
01045 YY_RULE_SETUP
01046 #line 118 "lexer.ll"
01047 {
01048     BEGIN NODE;
01049     expectToken = kNone;
01050     return ID_ENDFOLLOW;
01051 }
01052     YY_BREAK
01053 case 26:
01054 YY_RULE_SETUP
01055 #line 124 "lexer.ll"
01056 {
01057     ++currentLineNumber;
01058 #if qCvsDebug
01059     if (yy_flex_debug)
01060         fprintf(stderr,"LINESEP--> %d\n", currentLineNumber);
01061 #endif
01062
01063     yylval_set((int)(unsigned char)yytext[0]);
01064     return ID_CHAR;
01065 }
01066     YY_BREAK
01067 case 27:
01068 YY_RULE_SETUP
01069 #line 135 "lexer.ll"
01070 {
01071     yylval_set((int)(unsigned char)yytext[0]);
01072     return ID_CHAR;
01073 }
01074     YY_BREAK
01075 case 28:
01076 YY_RULE_SETUP
01077 #line 140 "lexer.ll"
01078 {
01079     yylval_set(yytext);
01080     BEGIN NODE;
01081     expectToken = kNone;
01082
01083     return STRING;
01084 }
01085     YY_BREAK
01086 case 29:
01087 YY_RULE_SETUP
01088 #line 148 "lexer.ll"
01089 {
01090     int v;
01091     revnumber.reset();
01092     if(sscanf(yytext, "%d", &v) == 1)
01093         revnumber += v;
01094     else
01095         yyerror("%s not an integer value", yytext);
01096     BEGIN ST_INREV;
01097     expectToken = kNone;
01098 }
01099     YY_BREAK
01100 case 30:
01101 YY_RULE_SETUP
01102 #line 159 "lexer.ll"
01103 {
01104     int v;
01105     revnumber.reset();
01106     if(sscanf(yytext, "%d", &v) == 1)
01107         revnumber += v;
01108     else
01109         yyerror("%s not an integer value", yytext);
01110     BEGIN ST_INREV;
01111     expectToken = kNone;
01112 }
01113     YY_BREAK
01114 case 31:
01115 YY_RULE_SETUP
01116 #line 170 "lexer.ll"
01117 {
01118     yyless(0); /* put back the spaces */
01119     BEGIN NODE;
01120     expectToken = kNone;
01121
01122     return REVNUM;
01123 }
01124     YY_BREAK
01125 case 32:
01126 YY_RULE_SETUP
01127 #line 178 "lexer.ll"
01128 {
01129     int v;
01130     if(sscanf(yytext + 1, "%d", &v) == 1)
01131         revnumber += v;
01132     else
01133         yyerror("%s not an integer value", yytext);
01134     BEGIN ST_INREV;
01135     expectToken = kNone;
01136 }
01137     YY_BREAK
01138 case 33:
01139 YY_RULE_SETUP
01140 #line 188 "lexer.ll"
01141 {
01142     yyless(0); /* put back the spaces */
01143     BEGIN NODE;
01144     expectToken = kNone;
01145     yylval_set(revnumber);
01146
01147     return REVNUM;
01148 }
01149     YY_BREAK
01150 case 34:
01151 YY_RULE_SETUP
01152 #line 197 "lexer.ll"
01153 {
01154     int v;
01155     if(sscanf(yytext, "%d", &v) == 1)
01156         revnumber += v;
01157     else
01158         yyerror("%s not an integer value", yytext);
01159     BEGIN NODE;
01160     expectToken = kNone;
01161     yylval_set(v);
01162
01163     return INTEGER;
01164 }
01165     YY_BREAK
01166 case 35:
01167 YY_RULE_SETUP
01168 #line 210 "lexer.ll"
01169 {
01170     int v;
01171     if(sscanf(yytext, "%d", &v) == 1)
01172         revnumber += v;
01173     else
01174         yyerror("%s not an integer value", yytext);
01175     yylval_set(v);
01176
01177     return INTEGER;
01178 }
01179     YY_BREAK
01180 case 36:
01181 YY_RULE_SETUP
01182 #line 221 "lexer.ll"
01183 {
01184     return yytext[0];
01185 }
01186     YY_BREAK
01187 /* Whitespace and catch-all rules apply to all start states: */
01188 case 37:
01189 YY_RULE_SETUP
01190 #line 226 "lexer.ll"
01191 ;
01192     YY_BREAK
01193 /* This is also whitespace, but we'll keep track of line number */
01194 /* to report in errors: */
01195 case 38:
01196 YY_RULE_SETUP
01197 #line 230 "lexer.ll"
01198 {
01199                                 ++currentLineNumber;
01200 #if qCvsDebug
01201                                 if (yy_flex_debug)
01202                                     fprintf(stderr,"LINE--> %d\n", currentLineNumber);
01203 #endif
01204                                 if(expectToken == kAnyButSep)
01205                                 {
01206                                     // strange bug, flex is sometimes getting here in
01207                                     // a kAnyButSep mode, while it should not
01208                                     yylval_set(yytext);
01209                                       return STRING;
01210                                 }
01211                             }
01212     YY_BREAK
01213 /* This catch-all rule catches anything not covered by any of */
01214 /* the above: */
01215 case 39:
01216 YY_RULE_SETUP
01217 #line 247 "lexer.ll"
01218 {
01219     yylval_set((int)(unsigned char)yytext[0]);
01220     return (int)(unsigned char)yytext[0];
01221 }
01222     YY_BREAK
01223 case 40:
01224 YY_RULE_SETUP
01225 #line 251 "lexer.ll"
01226 ECHO;
01227     YY_BREAK
01228 #line 1229 "lex.yy.c"
01229 case YY_STATE_EOF(INITIAL):
01230 case YY_STATE_EOF(NODE):
01231 case YY_STATE_EOF(ST_STRING):
01232 case YY_STATE_EOF(ST_TAG):
01233 case YY_STATE_EOF(ST_REV):
01234 case YY_STATE_EOF(ST_REVORNIL):
01235 case YY_STATE_EOF(ST_INREV):
01236 case YY_STATE_EOF(ST_INT):
01237 case YY_STATE_EOF(ST_ANYBUTSEP):
01238 case YY_STATE_EOF(ST_DATE):
01239     yyterminate();
01240
01241     case YY_END_OF_BUFFER:
01242         {
01243         /* Amount of text matched not including the EOB char. */
01244         int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
01245
01246         /* Undo the effects of YY_DO_BEFORE_ACTION. */
01247         *yy_cp = yy_hold_char;
01248         YY_RESTORE_YY_MORE_OFFSET
01249
01250         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
01251             {
01252             /* We're scanning a new file or input source.  It's
01253              * possible that this happened because the user
01254              * just pointed yyin at a new source and called
01255              * yylex().  If so, then we have to assure
01256              * consistency between yy_current_buffer and our
01257              * globals.  Here is the right place to do so, because
01258              * this is the first action (other than possibly a
01259              * back-up) that will match for the new input source.
01260              */
01261             yy_n_chars = yy_current_buffer->yy_n_chars;
01262             yy_current_buffer->yy_input_file = yyin;
01263             yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
01264             }
01265
01266         /* Note that here we test for yy_c_buf_p "<=" to the position
01267          * of the first EOB in the buffer, since yy_c_buf_p will
01268          * already have been incremented past the NUL character
01269          * (since all states make transitions on EOB to the
01270          * end-of-buffer state).  Contrast this with the test
01271          * in input().
01272          */
01273         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
01274             { /* This was really a NUL. */
01275             yy_state_type yy_next_state;
01276
01277             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
01278
01279             yy_current_state = yy_get_previous_state();
01280
01281             /* Okay, we're now positioned to make the NUL
01282              * transition.  We couldn't have
01283              * yy_get_previous_state() go ahead and do it
01284              * for us because it doesn't know how to deal
01285              * with the possibility of jamming (and we don't
01286              * want to build jamming into it because then it
01287              * will run more slowly).
01288              */
01289
01290             yy_next_state = yy_try_NUL_trans( yy_current_state );
01291
01292             yy_bp = yytext_ptr + YY_MORE_ADJ;
01293
01294             if ( yy_next_state )
01295                 {
01296                 /* Consume the NUL. */
01297                 yy_cp = ++yy_c_buf_p;
01298                 yy_current_state = yy_next_state;
01299                 goto yy_match;
01300                 }
01301
01302             else
01303                 {
01304                 yy_cp = yy_c_buf_p;
01305                 goto yy_find_action;
01306                 }
01307             }
01308
01309         else switch ( yy_get_next_buffer() )
01310             {
01311             case EOB_ACT_END_OF_FILE:
01312                 {
01313                 yy_did_buffer_switch_on_eof = 0;
01314
01315                 if ( yywrap() )
01316                     {
01317                     /* Note: because we've taken care in
01318                      * yy_get_next_buffer() to have set up
01319                      * yytext, we can now set up
01320                      * yy_c_buf_p so that if some total
01321                      * hoser (like flex itself) wants to
01322                      * call the scanner after we return the
01323                      * YY_NULL, it'll still work - another
01324                      * YY_NULL will get returned.
01325                      */
01326                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
01327
01328                     yy_act = YY_STATE_EOF(YY_START);
01329                     goto do_action;
01330                     }
01331
01332                 else
01333                     {
01334                     if ( ! yy_did_buffer_switch_on_eof )
01335                         YY_NEW_FILE;
01336                     }
01337                 break;
01338                 }
01339
01340             case EOB_ACT_CONTINUE_SCAN:
01341                 yy_c_buf_p =
01342                     yytext_ptr + yy_amount_of_matched_text;
01343
01344                 yy_current_state = yy_get_previous_state();
01345
01346                 yy_cp = yy_c_buf_p;
01347                 yy_bp = yytext_ptr + YY_MORE_ADJ;
01348                 goto yy_match;
01349
01350             case EOB_ACT_LAST_MATCH:
01351                 yy_c_buf_p =
01352                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
01353
01354                 yy_current_state = yy_get_previous_state();
01355
01356                 yy_cp = yy_c_buf_p;
01357                 yy_bp = yytext_ptr + YY_MORE_ADJ;
01358                 goto yy_find_action;
01359             }
01360         break;
01361         }
01362
01363     default:
01364         YY_FATAL_ERROR(
01365             "fatal flex scanner internal error--no action found" );
01366     } /* end of action switch */
01367         } /* end of scanning one token */
01368     } /* end of yylex */
01369
01370
01371 /* yy_get_next_buffer - try to read in a new buffer
01372  *
01373  * Returns a code representing an action:
01374  *  EOB_ACT_LAST_MATCH -
01375  *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
01376  *  EOB_ACT_END_OF_FILE - end of file
01377  */
01378
01379 static int yy_get_next_buffer()
01380     {
01381     register char *dest = yy_current_buffer->yy_ch_buf;
01382     register char *source = yytext_ptr;
01383     register int number_to_move, i;
01384     int ret_val;
01385
01386     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
01387         YY_FATAL_ERROR(
01388         "fatal flex scanner internal error--end of buffer missed" );
01389
01390     if ( yy_current_buffer->yy_fill_buffer == 0 )
01391         { /* Don't try to fill the buffer, so this is an EOF. */
01392         if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
01393             {
01394             /* We matched a single character, the EOB, so
01395              * treat this as a final EOF.
01396              */
01397             return EOB_ACT_END_OF_FILE;
01398             }
01399
01400         else
01401             {
01402             /* We matched some text prior to the EOB, first
01403              * process it.
01404              */
01405             return EOB_ACT_LAST_MATCH;
01406             }
01407         }
01408
01409     /* Try to read more data. */
01410
01411     /* First move last chars to start of buffer. */
01412     number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
01413
01414     for ( i = 0; i < number_to_move; ++i )
01415         *(dest++) = *(source++);
01416
01417     if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
01418         /* don't do the read, it's not guaranteed to return an EOF,
01419          * just force an EOF
01420          */
01421         yy_current_buffer->yy_n_chars = yy_n_chars = 0;
01422
01423     else
01424         {
01425         int num_to_read =
01426             yy_current_buffer->yy_buf_size - number_to_move - 1;
01427
01428         while ( num_to_read <= 0 )
01429             { /* Not enough room in the buffer - grow it. */
01430 #ifdef YY_USES_REJECT
01431             YY_FATAL_ERROR(
01432 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
01433 #else
01434
01435             /* just a shorter name for the current buffer */
01436             YY_BUFFER_STATE b = yy_current_buffer;
01437
01438             int yy_c_buf_p_offset =
01439                 (int) (yy_c_buf_p - b->yy_ch_buf);
01440
01441             if ( b->yy_is_our_buffer )
01442                 {
01443                 int new_size = b->yy_buf_size * 2;
01444
01445                 if ( new_size <= 0 )
01446                     b->yy_buf_size += b->yy_buf_size / 8;
01447                 else
01448                     b->yy_buf_size *= 2;
01449
01450                 b->yy_ch_buf = (char *)
01451                     /* Include room in for 2 EOB chars. */
01452                     yy_flex_realloc( (void *) b->yy_ch_buf,
01453                              b->yy_buf_size + 2 );
01454                 }
01455             else
01456                 /* Can't grow it, we don't own it. */
01457                 b->yy_ch_buf = 0;
01458
01459             if ( ! b->yy_ch_buf )
01460                 YY_FATAL_ERROR(
01461                 "fatal error - scanner input buffer overflow" );
01462
01463             yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
01464
01465             num_to_read = yy_current_buffer->yy_buf_size -
01466                         number_to_move - 1;
01467 #endif
01468             }
01469
01470         if ( num_to_read > YY_READ_BUF_SIZE )
01471             num_to_read = YY_READ_BUF_SIZE;
01472
01473         /* Read in more data. */
01474         YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
01475             yy_n_chars, num_to_read );
01476
01477         yy_current_buffer->yy_n_chars = yy_n_chars;
01478         }
01479
01480     if ( yy_n_chars == 0 )
01481         {
01482         if ( number_to_move == YY_MORE_ADJ )
01483             {
01484             ret_val = EOB_ACT_END_OF_FILE;
01485             yyrestart( yyin );
01486             }
01487
01488         else
01489             {
01490             ret_val = EOB_ACT_LAST_MATCH;
01491             yy_current_buffer->yy_buffer_status =
01492                 YY_BUFFER_EOF_PENDING;
01493             }
01494         }
01495
01496     else
01497         ret_val = EOB_ACT_CONTINUE_SCAN;
01498
01499     yy_n_chars += number_to_move;
01500     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
01501     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
01502
01503     yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
01504
01505     return ret_val;
01506     }
01507
01508
01509 /* yy_get_previous_state - get the state just before the EOB char was reached */
01510
01511 static yy_state_type yy_get_previous_state()
01512     {
01513     register yy_state_type yy_current_state;
01514     register char *yy_cp;
01515
01516     yy_current_state = yy_start;
01517
01518     for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
01519         {
01520         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01521         if ( yy_accept[yy_current_state] )
01522             {
01523             yy_last_accepting_state = yy_current_state;
01524             yy_last_accepting_cpos = yy_cp;
01525             }
01526         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01527             {
01528             yy_current_state = (int) yy_def[yy_current_state];
01529             if ( yy_current_state >= 377 )
01530                 yy_c = yy_meta[(unsigned int) yy_c];
01531             }
01532         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01533         }
01534
01535     return yy_current_state;
01536     }
01537
01538
01539 /* yy_try_NUL_trans - try to make a transition on the NUL character
01540  *
01541  * synopsis
01542  *  next_state = yy_try_NUL_trans( current_state );
01543  */
01544
01545 #ifdef YY_USE_PROTOS
01546 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
01547 #else
01548 static yy_state_type yy_try_NUL_trans( yy_current_state )
01549 yy_state_type yy_current_state;
01550 #endif
01551     {
01552     register int yy_is_jam;
01553     register char *yy_cp = yy_c_buf_p;
01554
01555     register YY_CHAR yy_c = 1;
01556     if ( yy_accept[yy_current_state] )
01557         {
01558         yy_last_accepting_state = yy_current_state;
01559         yy_last_accepting_cpos = yy_cp;
01560         }
01561     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01562         {
01563         yy_current_state = (int) yy_def[yy_current_state];
01564         if ( yy_current_state >= 377 )
01565             yy_c = yy_meta[(unsigned int) yy_c];
01566         }
01567     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01568     yy_is_jam = (yy_current_state == 376);
01569
01570     return yy_is_jam ? 0 : yy_current_state;
01571     }
01572
01573
01574 #ifndef YY_NO_UNPUT
01575 #ifdef YY_USE_PROTOS
01576 static void yyunput( int c, register char *yy_bp )
01577 #else
01578 static void yyunput( c, yy_bp )
01579 int c;
01580 register char *yy_bp;
01581 #endif
01582     {
01583     register char *yy_cp = yy_c_buf_p;
01584
01585     /* undo effects of setting up yytext */
01586     *yy_cp = yy_hold_char;
01587
01588     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
01589         { /* need to shift things up to make room */
01590         /* +2 for EOB chars. */
01591         register int number_to_move = yy_n_chars + 2;
01592         register char *dest = &yy_current_buffer->yy_ch_buf[
01593                     yy_current_buffer->yy_buf_size + 2];
01594         register char *source =
01595                 &yy_current_buffer->yy_ch_buf[number_to_move];
01596
01597         while ( source > yy_current_buffer->yy_ch_buf )
01598             *--dest = *--source;
01599
01600         yy_cp += (int) (dest - source);
01601         yy_bp += (int) (dest - source);
01602         yy_current_buffer->yy_n_chars =
01603             yy_n_chars = yy_current_buffer->yy_buf_size;
01604
01605         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
01606             YY_FATAL_ERROR( "flex scanner push-back overflow" );
01607         }
01608
01609     *--yy_cp = (char) c;
01610
01611
01612     yytext_ptr = yy_bp;
01613     yy_hold_char = *yy_cp;
01614     yy_c_buf_p = yy_cp;
01615     }
01616 #endif  /* ifndef YY_NO_UNPUT */
01617
01618
01619 #ifdef __cplusplus
01620 static int yyinput()
01621 #else
01622 static int input()
01623 #endif
01624     {
01625     int c;
01626
01627     *yy_c_buf_p = yy_hold_char;
01628
01629     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
01630         {
01631         /* yy_c_buf_p now points to the character we want to return.
01632          * If this occurs *before* the EOB characters, then it's a
01633          * valid NUL; if not, then we've hit the end of the buffer.
01634          */
01635         if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
01636             /* This was really a NUL. */
01637             *yy_c_buf_p = '\0';
01638
01639         else
01640             { /* need more input */
01641             int offset = yy_c_buf_p - yytext_ptr;
01642             ++yy_c_buf_p;
01643
01644             switch ( yy_get_next_buffer() )
01645                 {
01646                 case EOB_ACT_LAST_MATCH:
01647                     /* This happens because yy_g_n_b()
01648                      * sees that we've accumulated a
01649                      * token and flags that we need to
01650                      * try matching the token before
01651                      * proceeding.  But for input(),
01652                      * there's no matching to consider.
01653                      * So convert the EOB_ACT_LAST_MATCH
01654                      * to EOB_ACT_END_OF_FILE.
01655                      */
01656
01657                     /* Reset buffer status. */
01658                     yyrestart( yyin );
01659
01660                     /* fall through */
01661
01662                 case EOB_ACT_END_OF_FILE:
01663                     {
01664                     if ( yywrap() )
01665                         return EOF;
01666
01667                     if ( ! yy_did_buffer_switch_on_eof )
01668                         YY_NEW_FILE;
01669 #ifdef __cplusplus
01670                     return yyinput();
01671 #else
01672                     return input();
01673 #endif
01674                     }
01675
01676                 case EOB_ACT_CONTINUE_SCAN:
01677                     yy_c_buf_p = yytext_ptr + offset;
01678                     break;
01679                 }
01680             }
01681         }
01682
01683     c = *(unsigned char *) yy_c_buf_p;  /* cast for 8-bit char's */
01684     *yy_c_buf_p = '\0'; /* preserve yytext */
01685     yy_hold_char = *++yy_c_buf_p;
01686
01687
01688     return c;
01689     }
01690
01691
01692 #ifdef YY_USE_PROTOS
01693 void yyrestart( FILE *input_file )
01694 #else
01695 void yyrestart( input_file )
01696 FILE *input_file;
01697 #endif
01698     {
01699     if ( ! yy_current_buffer )
01700         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
01701
01702     yy_init_buffer( yy_current_buffer, input_file );
01703     yy_load_buffer_state();
01704     }
01705
01706
01707 #ifdef YY_USE_PROTOS
01708 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
01709 #else
01710 void yy_switch_to_buffer( new_buffer )
01711 YY_BUFFER_STATE new_buffer;
01712 #endif
01713     {
01714     if ( yy_current_buffer == new_buffer )
01715         return;
01716
01717     if ( yy_current_buffer )
01718         {
01719         /* Flush out information for old buffer. */
01720         *yy_c_buf_p = yy_hold_char;
01721         yy_current_buffer->yy_buf_pos = yy_c_buf_p;
01722         yy_current_buffer->yy_n_chars = yy_n_chars;
01723         }
01724
01725     yy_current_buffer = new_buffer;
01726     yy_load_buffer_state();
01727
01728     /* We don't actually know whether we did this switch during
01729      * EOF (yywrap()) processing, but the only time this flag
01730      * is looked at is after yywrap() is called, so it's safe
01731      * to go ahead and always set it.
01732      */
01733     yy_did_buffer_switch_on_eof = 1;
01734     }
01735
01736
01737 #ifdef YY_USE_PROTOS
01738 void yy_load_buffer_state( void )
01739 #else
01740 void yy_load_buffer_state()
01741 #endif
01742     {
01743     yy_n_chars = yy_current_buffer->yy_n_chars;
01744     yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
01745     yyin = yy_current_buffer->yy_input_file;
01746     yy_hold_char = *yy_c_buf_p;
01747     }
01748
01749
01750 #ifdef YY_USE_PROTOS
01751 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
01752 #else
01753 YY_BUFFER_STATE yy_create_buffer( file, size )
01754 FILE *file;
01755 int size;
01756 #endif
01757     {
01758     YY_BUFFER_STATE b;
01759
01760     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
01761     if ( ! b )
01762         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01763
01764     b->yy_buf_size = size;
01765
01766     /* yy_ch_buf has to be 2 characters longer than the size given because
01767      * we need to put in 2 end-of-buffer characters.
01768      */
01769     b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
01770     if ( ! b->yy_ch_buf )
01771         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01772
01773     b->yy_is_our_buffer = 1;
01774
01775     yy_init_buffer( b, file );
01776
01777     return b;
01778     }
01779
01780
01781 #ifdef YY_USE_PROTOS
01782 void yy_delete_buffer( YY_BUFFER_STATE b )
01783 #else
01784 void yy_delete_buffer( b )
01785 YY_BUFFER_STATE b;
01786 #endif
01787     {
01788     if ( ! b )
01789         return;
01790
01791     if ( b == yy_current_buffer )
01792         yy_current_buffer = (YY_BUFFER_STATE) 0;
01793
01794     if ( b->yy_is_our_buffer )
01795         yy_flex_free( (void *) b->yy_ch_buf );
01796
01797     yy_flex_free( (void *) b );
01798     }
01799
01800
01801 #ifndef YY_ALWAYS_INTERACTIVE
01802 #ifndef YY_NEVER_INTERACTIVE
01803 extern int isatty YY_PROTO(( int ));
01804 #endif
01805 #endif
01806
01807 #ifdef YY_USE_PROTOS
01808 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
01809 #else
01810 void yy_init_buffer( b, file )
01811 YY_BUFFER_STATE b;
01812 FILE *file;
01813 #endif
01814
01815
01816     {
01817     yy_flush_buffer( b );
01818
01819     b->yy_input_file = file;
01820     b->yy_fill_buffer = 1;
01821
01822 #if YY_ALWAYS_INTERACTIVE
01823     b->yy_is_interactive = 1;
01824 #else
01825 #if YY_NEVER_INTERACTIVE
01826     b->yy_is_interactive = 0;
01827 #else
01828     b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
01829 #endif
01830 #endif
01831     }
01832
01833
01834 #ifdef YY_USE_PROTOS
01835 void yy_flush_buffer( YY_BUFFER_STATE b )
01836 #else
01837 void yy_flush_buffer( b )
01838 YY_BUFFER_STATE b;
01839 #endif
01840
01841     {
01842     if ( ! b )
01843         return;
01844
01845     b->yy_n_chars = 0;
01846
01847     /* We always need two end-of-buffer characters.  The first causes
01848      * a transition to the end-of-buffer state.  The second causes
01849      * a jam in that state.
01850      */
01851     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01852     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01853
01854     b->yy_buf_pos = &b->yy_ch_buf[0];
01855
01856     b->yy_at_bol = 1;
01857     b->yy_buffer_status = YY_BUFFER_NEW;
01858
01859     if ( b == yy_current_buffer )
01860         yy_load_buffer_state();
01861     }
01862
01863
01864 #ifndef YY_NO_SCAN_BUFFER
01865 #ifdef YY_USE_PROTOS
01866 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
01867 #else
01868 YY_BUFFER_STATE yy_scan_buffer( base, size )
01869 char *base;
01870 yy_size_t size;
01871 #endif
01872     {
01873     YY_BUFFER_STATE b;
01874
01875     if ( size < 2 ||
01876          base[size-2] != YY_END_OF_BUFFER_CHAR ||
01877          base[size-1] != YY_END_OF_BUFFER_CHAR )
01878         /* They forgot to leave room for the EOB's. */
01879         return 0;
01880
01881     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
01882     if ( ! b )
01883         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
01884
01885     b->yy_buf_size = size - 2;  /* "- 2" to take care of EOB's */
01886     b->yy_buf_pos = b->yy_ch_buf = base;
01887     b->yy_is_our_buffer = 0;
01888     b->yy_input_file = 0;
01889     b->yy_n_chars = b->yy_buf_size;
01890     b->yy_is_interactive = 0;
01891     b->yy_at_bol = 1;
01892     b->yy_fill_buffer = 0;
01893     b->yy_buffer_status = YY_BUFFER_NEW;
01894
01895     yy_switch_to_buffer( b );
01896
01897     return b;
01898     }
01899 #endif
01900
01901
01902 #ifndef YY_NO_SCAN_STRING
01903 #ifdef YY_USE_PROTOS
01904 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
01905 #else
01906 YY_BUFFER_STATE yy_scan_string( yy_str )
01907 yyconst char *yy_str;
01908 #endif
01909     {
01910     int len;
01911     for ( len = 0; yy_str[len]; ++len )
01912         ;
01913
01914     return yy_scan_bytes( yy_str, len );
01915     }
01916 #endif
01917
01918
01919 #ifndef YY_NO_SCAN_BYTES
01920 #ifdef YY_USE_PROTOS
01921 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
01922 #else
01923 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
01924 yyconst char *bytes;
01925 int len;
01926 #endif
01927     {
01928     YY_BUFFER_STATE b;
01929     char *buf;
01930     yy_size_t n;
01931     int i;
01932
01933     /* Get memory for full buffer, including space for trailing EOB's. */
01934     n = len + 2;
01935     buf = (char *) yy_flex_alloc( n );
01936     if ( ! buf )
01937         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
01938
01939     for ( i = 0; i < len; ++i )
01940         buf[i] = bytes[i];
01941
01942     buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
01943
01944     b = yy_scan_buffer( buf, n );
01945     if ( ! b )
01946         YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
01947
01948     /* It's okay to grow etc. this buffer, and we should throw it
01949      * away when we're done.
01950      */
01951     b->yy_is_our_buffer = 1;
01952
01953     return b;
01954     }
01955 #endif
01956
01957
01958 #ifndef YY_NO_PUSH_STATE
01959 #ifdef YY_USE_PROTOS
01960 static void yy_push_state( int new_state )
01961 #else
01962 static void yy_push_state( new_state )
01963 int new_state;
01964 #endif
01965     {
01966     if ( yy_start_stack_ptr >= yy_start_stack_depth )
01967         {
01968         yy_size_t new_size;
01969
01970         yy_start_stack_depth += YY_START_STACK_INCR;
01971         new_size = yy_start_stack_depth * sizeof( int );
01972
01973         if ( ! yy_start_stack )
01974             yy_start_stack = (int *) yy_flex_alloc( new_size );
01975
01976         else
01977             yy_start_stack = (int *) yy_flex_realloc(
01978                     (void *) yy_start_stack, new_size );
01979
01980         if ( ! yy_start_stack )
01981             YY_FATAL_ERROR(
01982             "out of memory expanding start-condition stack" );
01983         }
01984
01985     yy_start_stack[yy_start_stack_ptr++] = YY_START;
01986
01987     BEGIN(new_state);
01988     }
01989 #endif
01990
01991
01992 #ifndef YY_NO_POP_STATE
01993 static void yy_pop_state()
01994     {
01995     if ( --yy_start_stack_ptr < 0 )
01996         YY_FATAL_ERROR( "start-condition stack underflow" );
01997
01998     BEGIN(yy_start_stack[yy_start_stack_ptr]);
01999     }
02000 #endif
02001
02002
02003 #ifndef YY_NO_TOP_STATE
02004 static int yy_top_state()
02005     {
02006     return yy_start_stack[yy_start_stack_ptr - 1];
02007     }
02008 #endif
02009
02010 #ifndef YY_EXIT_FAILURE
02011 #define YY_EXIT_FAILURE 2
02012 #endif
02013
02014 #ifdef YY_USE_PROTOS
02015 static void yy_fatal_error( yyconst char msg[] )
02016 #else
02017 static void yy_fatal_error( msg )
02018 char msg[];
02019 #endif
02020     {
02021     (void) fprintf( stderr, "%s\n", msg );
02022     exit( YY_EXIT_FAILURE );
02023     }
02024
02025
02026
02027 /* Redefine yyless() so it works in section 3 code. */
02028
02029 #undef yyless
02030 #define yyless(n) \
02031     do \
02032         { \
02033         /* Undo effects of setting up yytext. */ \
02034         yytext[yyleng] = yy_hold_char; \
02035         yy_c_buf_p = yytext + n; \
02036         yy_hold_char = *yy_c_buf_p; \
02037         *yy_c_buf_p = '\0'; \
02038         yyleng = n; \
02039         } \
02040     while ( 0 )
02041
02042
02043 /* Internal utility routines. */
02044
02045 #ifndef yytext_ptr
02046 #ifdef YY_USE_PROTOS
02047 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
02048 #else
02049 static void yy_flex_strncpy( s1, s2, n )
02050 char *s1;
02051 yyconst char *s2;
02052 int n;
02053 #endif
02054     {
02055     register int i;
02056     for ( i = 0; i < n; ++i )
02057         s1[i] = s2[i];
02058     }
02059 #endif
02060
02061 #ifdef YY_NEED_STRLEN
02062 #ifdef YY_USE_PROTOS
02063 static int yy_flex_strlen( yyconst char *s )
02064 #else
02065 static int yy_flex_strlen( s )
02066 yyconst char *s;
02067 #endif
02068     {
02069     register int n;
02070     for ( n = 0; s[n]; ++n )
02071         ;
02072
02073     return n;
02074     }
02075 #endif
02076
02077
02078 #ifdef YY_USE_PROTOS
02079 static void *yy_flex_alloc( yy_size_t size )
02080 #else
02081 static void *yy_flex_alloc( size )
02082 yy_size_t size;
02083 #endif
02084     {
02085     return (void *) malloc( size );
02086     }
02087
02088 #ifdef YY_USE_PROTOS
02089 static void *yy_flex_realloc( void *ptr, yy_size_t size )
02090 #else
02091 static void *yy_flex_realloc( ptr, size )
02092 void *ptr;
02093 yy_size_t size;
02094 #endif
02095     {
02096     /* The cast to (char *) in the following accommodates both
02097      * implementations that use char* generic pointers, and those
02098      * that use void* generic pointers.  It works with the latter
02099      * because both ANSI C and C++ allow castless assignment from
02100      * any pointer type to void*, and deal with argument conversions
02101      * as though doing an assignment.
02102      */
02103     return (void *) realloc( (char *) ptr, size );
02104     }
02105
02106 #ifdef YY_USE_PROTOS
02107 static void yy_flex_free( void *ptr )
02108 #else
02109 static void yy_flex_free( ptr )
02110 void *ptr;
02111 #endif
02112     {
02113     free( ptr );
02114     }
02115
02116 #if YY_MAIN
02117 int main()
02118     {
02119     yylex();
02120     return 0;
02121     }
02122 #endif
02123 #line 251 "lexer.ll"
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvstree/lexer.cpp Source File

cvstree/lexer.cpp

Go to the documentation of this file.
00001 #if 0
00002 #include <Windows.h>
00003 #include <stdio.h>
00004 #include <stdarg.h>
00005 #define fprintf myfprintf
00006
00007 static int myfprintf(FILE *f, const char *format, ...)
00008 {
00009     va_list args;
00010     char mess[1024] = {'\0'};
00011
00012     va_start (args, format);
00013     vsprintf (mess, format, args);
00014     va_end (args);
00015
00016     OutputDebugString(mess);
00017     return 0;
00018 }
00019 #endif
00020
00021 #include "lexer.cc"
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvstree/main.cpp Source File

cvstree/main.cpp

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <getopt.h>
00003 #include <errno.h>
00004 #include "common.h"
00005
00006 static void yyoutput(ostream & out)
00007 {
00008     vector<CRcsFile>::const_iterator i;
00009     for(i = gRcsFiles.begin(); i != gRcsFiles.end(); ++i)
00010     {
00011         const CRcsFile & rcs = *i;
00012         rcs.print(out);
00013     }
00014 }
00015
00016 extern "C" {
00017     static int sortRevFile(const void *r1, const void *r2);
00018 }
00019
00020 static int sortRevFile(const void *r1, const void *r2)
00021 {
00022     const CRevNumber & rev1 = ((CRevFile *)r1)->RevNum();
00023     const CRevNumber & rev2 = ((CRevFile *)r2)->RevNum();
00024
00025     return rev1.cmp(rev2);
00026 }
00027
00028 static void yygraph(const CRcsFile & rcs)
00029 {
00030     const vector<CRevFile> & allrevs = rcs.AllRevs();
00031     qsort((CRevFile *)allrevs.begin(), allrevs.size(), sizeof(CRevFile), sortRevFile);
00032     vector<CRevFile>::const_iterator i;
00033     for(i = allrevs.begin(); i != allrevs.end(); ++i)
00034     {
00035         const CRevNumber & rev = i->RevNum();
00036         cout << '\t' << rev.str() << '\n';
00037     }
00038
00039 }
00040
00041 static void yygraph(void)
00042 {
00043     vector<CRcsFile>::const_iterator i;
00044     for(i = gRcsFiles.begin(); i != gRcsFiles.end(); ++i)
00045     {
00046         const CRcsFile & rcs = *i;
00047         yygraph(rcs);
00048     }
00049 }
00050
00051 static const char *const cmd_usage[] =
00052 {
00053     "CVSTREE synopsis is: cvs [cvsoptions] log [logoptions] | cvstree [cvstree options]\n",
00054     "CVSTREE options are:\n",
00055     "        -v           Verbose the output similar to cvs log (default)\n",
00056     "        -o output    Output in a file\n",
00057     "        -g           Output a graph of the revisions\n",
00058     "        -1           Debug the lexer (flex output)\n",
00059     "        -2           Debug the parser (bison output)\n",
00060     "        -3           Debug both the parser and the lexer\n",
00061     "        --help,-h    Print this help\n",
00062     "        --version    Print the version number\n",
00063     NULL
00064 };
00065
00066 static struct option long_options[] =
00067 {
00068     {"help", 0, NULL, 'h'},
00069     {"version", 0, NULL, '*'},
00070     {0, 0, 0, 0}
00071 };
00072
00073 static void usage (const char *const *cpp)
00074 {
00075     for (; *cpp; cpp++)
00076         fprintf (stderr, *cpp);
00077     exit(1);
00078 }
00079
00080 int main(int argc, char **argv)
00081 {
00082     int c;
00083     int option_index = 0;
00084     bool outGraph = false;
00085     CLogStr output;
00086     CLogStr input;
00087
00088 #if qCvsDebug
00089     yydebug = 0;
00090     yy_flex_debug = 0;
00091 #endif
00092
00093     while ((c = getopt_long
00094             (argc, argv, "+o:f:g123vh", long_options, &option_index))
00095            != EOF)
00096     {
00097         switch (c)
00098         {
00099         case '1':
00100 #if qCvsDebug
00101             yy_flex_debug = 1;
00102 #endif
00103             break;
00104         case '2':
00105 #if qCvsDebug
00106             yydebug = 1;
00107 #endif
00108             break;
00109         case '3':
00110 #if qCvsDebug
00111             yydebug = 1;
00112             yy_flex_debug = 1;
00113 #endif
00114             break;
00115         case 'h':
00116             usage (cmd_usage);
00117             break;
00118         case 'g':
00119             outGraph = true;
00120             break;
00121         case 'v':
00122             outGraph = false;
00123             break;
00124         case 'o':
00125             output = optarg;
00126             break;
00127         case 'f':
00128             input = optarg;
00129             break;
00130         case '*':
00131             cerr << "Version of " << argv[0] << " is $Revision: 1.2 $\n";
00132             exit(1);
00133             break;
00134         case '?':
00135         default:
00136             usage (cmd_usage);
00137         }
00138     }
00139
00140     argc -= optind;
00141     argv += optind;
00142     if (argc != 0)
00143         usage (cmd_usage);
00144
00145     if(!input.empty())
00146     {
00147         yyin = fopen(input, "r");
00148         if(yyin == 0L)
00149         {
00150             cerr << "Error while opening '" << input << "'\n";
00151             exit(errno);
00152         }
00153     }
00154     else
00155         yyin = stdin;
00156     yyreset();
00157     yyrestart(yyin);
00158     yyparse();
00159
00160     if(outGraph)
00161     {
00162         yygraph();
00163     }
00164     else
00165     {
00166         filebuf fbuf;
00167         streambuf *buf = 0L;
00168
00169         if(!output.empty())
00170         {
00171             buf = fbuf.open(output, "w");
00172             if(buf == 0L)
00173             {
00174                 cerr << "Error while opening '" << output << "'\n";
00175                 exit(errno);
00176             }
00177             ostream out(buf);
00178             yyoutput(out);
00179             fbuf.close();
00180         }
00181         else
00182             yyoutput(cout);
00183     }
00184     if(!input.empty())
00185         fclose(yyin);
00186 }
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvstree/parser.cc Source File

cvstree/parser.cc

Go to the documentation of this file.
00001
00002 /*  A Bison parser, made from parser.yy
00003  by  GNU Bison version 1.26
00004   */
00005
00006 #define YYBISON 1  /* Identify Bison output.  */
00007
00008 #define INTEGER 257
00009 #define STRING  258
00010 #define TAG 259
00011 #define REVNUM  260
00012 #define ID_CHAR 261
00013 #define ID_DESCRIPTION  262
00014 #define ID_TOTREVISIONS 263
00015 #define ID_SELREVISIONS 264
00016 #define ID_KEYWORD  265
00017 #define ID_SYMBOLIC 266
00018 #define ID_ACCESS   267
00019 #define ID_LOCKS    268
00020 #define ID_STRICT   269
00021 #define ID_BRANCH   270
00022 #define ID_HEAD 271
00023 #define ID_WORKING  272
00024 #define ID_RCS  273
00025 #define ID_REVISION 274
00026 #define ID_DATE 275
00027 #define ID_BRANCHES 276
00028 #define ID_REVFOLLOW    277
00029 #define ID_ENDFOLLOW    278
00030 #define ID_LINES    279
00031 #define ID_ANYBUTSEP    280
00032 #define ID_LOCKEDBY 281
00033 #define ID_AUTHOR   282
00034 #define ID_STATE    283
00035
00036 #line 1 "parser.yy"
00037
00038 /*
00039 ** This program is free software; you can redistribute it and/or modify
00040 ** it under the terms of the GNU General Public License as published by
00041 ** the Free Software Foundation; either version 1, or (at your option)
00042 ** any later version.
00043
00044 ** This program is distributed in the hope that it will be useful,
00045 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00046 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00047 ** GNU General Public License for more details.
00048
00049 ** You should have received a copy of the GNU General Public License
00050 ** along with this program; if not, write to the Free Software
00051 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00052 */
00053
00054 #include <stdio.h>
00055 #include <string.h>
00056 #include <stdlib.h>
00057 #include <stdarg.h>
00058 #include "common.h"
00059
00060 #if qCvsDebug
00061 #   define YYDEBUG 1
00062 #else
00063 #   define YYDEBUG 0
00064 #endif
00065
00066 static void expect(kTokens type);
00067
00068 static int sInt;
00069 static CLogStr sStr;
00070 static CRevNumber sRev;
00071
00072 #line 37 "parser.yy"
00073 typedef union {
00074     char *string;
00075     int aint;
00076 } YYSTYPE;
00077 #include <stdio.h>
00078
00079 #ifndef __cplusplus
00080 #ifndef __STDC__
00081 #define const
00082 #endif
00083 #endif
00084
00085
00086
00087 #define YYFINAL     148
00088 #define YYFLAG      -32768
00089 #define YYNTBASE    33
00090
00091 #define YYTRANSLATE(x) ((unsigned)(x) <= 283 ? yytranslate[x] : 94)
00092
00093 static const char yytranslate[] = {     0,
00094      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00095      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00096      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00097      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00098      2,     2,     2,     2,     2,     2,    31,     2,     2,     2,
00099      2,     2,     2,     2,     2,     2,     2,    30,    32,     2,
00100      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00101      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00102      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00103      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00104      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00105      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00106      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00107      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00108      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00109      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00110      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00111      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00112      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00113      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00114      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00115      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00116      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00117      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00118      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00119      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
00120      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
00121     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
00122     27,    28,    29
00123 };
00124
00125 #if YYDEBUG != 0
00126 static const short yyprhs[] = {     0,
00127      0,     2,     3,     6,     8,     9,    13,    15,    16,    20,
00128     21,    25,    26,    29,    31,    33,    35,    37,    39,    41,
00129     43,    45,    47,    49,    50,    53,    54,    56,    58,    59,
00130     64,    65,    68,    69,    71,    73,    74,    77,    78,    82,
00131     83,    84,    85,    86,    87,    88,    89,   110,   111,   116,
00132    121,   126,   131,   132,   133,   140,   141,   144,   145,   148,
00133    150,   152,   154,   155,   156,   163,   164,   165,   171,   172,
00134    177,   181,   182,   185,   186,   191,   195,   196,   199,   200,
00135    205,   207,   208,   213,   214,   220,   221,   224,   225,   230,
00136    231,   236,   237,   242,   243,   248,   249
00137 };
00138
00139 static const short yyrhs[] = {    34,
00140      0,     0,    34,    35,     0,    39,     0,     0,    23,    36,
00141     47,     0,    24,     0,     0,     1,    37,    41,     0,     0,
00142     63,    38,    41,     0,     0,    39,    40,     0,    92,     0,
00143     90,     0,    88,     0,    86,     0,    80,     0,    76,     0,
00144     72,     0,    70,     0,    65,     0,    43,     0,     0,    41,
00145     42,     0,     0,     7,     0,     4,     0,     0,     8,    30,
00146     44,    45,     0,     0,    45,    46,     0,     0,     7,     0,
00147      4,     0,     0,    47,    48,     0,     0,    20,    49,     6,
00148      0,     0,     0,     0,     0,     0,     0,     0,    21,    30,
00149     50,    64,    31,    51,    64,    31,    52,    64,    53,    64,
00150     30,    54,    64,    30,    55,    64,    56,    32,     0,     0,
00151     22,    30,    57,    60,     0,    28,    30,    63,    32,     0,
00152     27,    30,    63,    32,     0,    29,    30,    63,    32,     0,
00153      0,     0,    25,    30,    58,    64,    59,    64,     0,     0,
00154     60,    61,     0,     0,     6,    32,     0,     4,     0,     5,
00155      0,     3,     0,     0,     0,     9,    30,    66,    64,    67,
00156     68,     0,     0,     0,    32,    10,    30,    69,    64,     0,
00157      0,    11,    30,    71,    62,     0,    12,    30,    73,     0,
00158      0,    73,    74,     0,     0,    63,    30,    75,     6,     0,
00159     13,    30,    77,     0,     0,    77,    78,     0,     0,    63,
00160     30,    79,    63,     0,    63,     0,     0,    14,    30,    81,
00161     83,     0,     0,    14,    30,    15,    82,    83,     0,     0,
00162     83,    84,     0,     0,    63,    30,    85,     6,     0,     0,
00163     16,    30,    87,     6,     0,     0,    17,    30,    89,     6,
00164      0,     0,    18,    30,    91,    62,     0,     0,    19,    30,
00165     93,    62,     0
00166 };
00167
00168 #endif
00169
00170 #if YYDEBUG != 0
00171 static const short yyrline[] = { 0,
00172     75,    78,    80,    83,    85,    93,    93,    94,   104,   104,
00173    112,   114,   115,   118,   120,   121,   122,   123,   124,   125,
00174    126,   127,   128,   131,   133,   136,   138,   145,   154,   157,
00175    159,   161,   164,   166,   171,   178,   179,   182,   184,   191,
00176    192,   198,   204,   210,   216,   222,   230,   230,   232,   232,
00177    239,   246,   253,   254,   261,   269,   271,   274,   276,   287,
00178    291,   295,   299,   301,   308,   310,   312,   313,   320,   322,
00179    330,   334,   336,   339,   349,   359,   363,   365,   368,   378,
00180    378,   388,   396,   396,   403,   405,   407,   410,   420,   430,
00181    432,   441,   443,   452,   454,   462,   464
00182 };
00183 #endif
00184
00185
00186 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
00187
00188 static const char * const yytname[] = {   "$","error","$undefined.","INTEGER",
00189 "STRING","TAG","REVNUM","ID_CHAR","ID_DESCRIPTION","ID_TOTREVISIONS","ID_SELREVISIONS",
00190 "ID_KEYWORD","ID_SYMBOLIC","ID_ACCESS","ID_LOCKS","ID_STRICT","ID_BRANCH","ID_HEAD",
00191 "ID_WORKING","ID_RCS","ID_REVISION","ID_DATE","ID_BRANCHES","ID_REVFOLLOW","ID_ENDFOLLOW",
00192 "ID_LINES","ID_ANYBUTSEP","ID_LOCKEDBY","ID_AUTHOR","ID_STATE","':'","'/'","';'",
00193 "cvslog","allDeclarations","allDeclaration","@1","@2","@3","rcsDeclarations",
00194 "rcsDeclaration","anyDeclarations","anyDeclaration","descDeclaration","@4","descListDeclarations",
00195 "descListDeclaration","allrevDeclarations","allrevDeclaration","@5","@6","@7",
00196 "@8","@9","@10","@11","@12","@13","@14","@15","revnumListDeclarations","revnumListDeclaration",
00197 "stringDeclaration","tagDeclaration","intDeclaration","totRevDeclaration","@16",
00198 "@17","selRevDeclaration","@18","keywordDeclaration","@19","symbolicNamesDeclaration",
00199 "symbolicListDeclarations","symbolicListDeclaration","@20","accessDeclaration",
00200 "accessListDeclarations","accessListDeclaration","@21","locksDeclaration","@22",
00201 "@23","locksListDeclarations","locksListDeclaration","@24","branchRevDeclaration",
00202 "@25","headRevDeclaration","@26","workingFileDeclaration","@27","rcsFileDeclaration",
00203 "@28", NULL
00204 };
00205 #endif
00206
00207 static const short yyr1[] = {     0,
00208     33,    34,    34,    35,    36,    35,    35,    37,    35,    38,
00209     35,    39,    39,    40,    40,    40,    40,    40,    40,    40,
00210     40,    40,    40,    41,    41,    42,    42,    42,    44,    43,
00211     45,    45,    46,    46,    46,    47,    47,    49,    48,    50,
00212     51,    52,    53,    54,    55,    56,    48,    57,    48,    48,
00213     48,    48,    58,    59,    48,    60,    60,    61,    61,    62,
00214     63,    64,    66,    67,    65,    68,    69,    68,    71,    70,
00215     72,    73,    73,    75,    74,    76,    77,    77,    79,    78,
00216     78,    81,    80,    82,    80,    83,    83,    85,    84,    87,
00217     86,    89,    88,    91,    90,    93,    92
00218 };
00219
00220 static const short yyr2[] = {     0,
00221      1,     0,     2,     1,     0,     3,     1,     0,     3,     0,
00222      3,     0,     2,     1,     1,     1,     1,     1,     1,     1,
00223      1,     1,     1,     0,     2,     0,     1,     1,     0,     4,
00224      0,     2,     0,     1,     1,     0,     2,     0,     3,     0,
00225      0,     0,     0,     0,     0,     0,    20,     0,     4,     4,
00226      4,     4,     0,     0,     6,     0,     2,     0,     2,     1,
00227      1,     1,     0,     0,     6,     0,     0,     5,     0,     4,
00228      3,     0,     2,     0,     4,     3,     0,     2,     0,     4,
00229      1,     0,     4,     0,     5,     0,     2,     0,     4,     0,
00230      4,     0,     4,     0,     4,     0,     4
00231 };
00232
00233 static const short yydefact[] = {     2,
00234      0,     8,    61,     5,     7,     3,     4,    10,    24,    36,
00235      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00236     13,    23,    22,    21,    20,    19,    18,    17,    16,    15,
00237     14,    24,     9,     6,    29,    63,    69,    72,    77,    82,
00238     90,    92,    94,    96,    11,    28,    27,    25,    38,     0,
00239      0,     0,     0,     0,     0,    37,    31,     0,     0,    71,
00240     76,    84,    86,     0,     0,     0,     0,     0,    40,    48,
00241     53,     0,     0,     0,    30,    62,    64,    60,    70,     0,
00242     73,    81,    78,    86,    83,    91,    93,    95,    97,    39,
00243      0,    56,     0,     0,     0,     0,    35,    34,    32,    66,
00244     74,    79,    85,     0,    87,     0,    49,    54,    51,    50,
00245     52,     0,    65,     0,     0,    88,    41,     0,    57,     0,
00246      0,    75,    80,     0,     0,    59,    55,    67,    89,     0,
00247      0,    42,    68,     0,    43,     0,     0,    44,     0,     0,
00248     45,     0,    46,     0,    47,     0,     0,     0
00249 };
00250
00251 static const short yydefgoto[] = {   146,
00252      1,     6,    10,     9,    32,     7,    21,    33,    48,    22,
00253     57,    75,    99,    34,    56,    68,    91,   125,   134,   136,
00254    139,   142,   144,    92,    93,   120,   107,   119,    79,   104,
00255     77,    23,    58,   100,   113,   131,    24,    59,    25,    60,
00256     81,   114,    26,    61,    83,   115,    27,    63,    84,    85,
00257    105,   124,    28,    64,    29,    65,    30,    66,    31,    67
00258 };
00259
00260 static const short yypact[] = {-32768,
00261      4,-32768,-32768,-32768,-32768,-32768,    66,-32768,-32768,-32768,
00262    -28,   -24,   -22,   -11,    -4,    12,    13,    15,    17,    18,
00263 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
00264 -32768,-32768,     3,    11,-32768,-32768,-32768,-32768,-32768,    14,
00265 -32768,-32768,-32768,-32768,     3,-32768,-32768,-32768,-32768,    20,
00266     21,    23,    24,    25,    26,-32768,-32768,    31,    33,    52,
00267     52,-32768,-32768,    55,    56,    33,    33,    57,-32768,-32768,
00268 -32768,    52,    52,    52,     7,-32768,-32768,-32768,-32768,    28,
00269 -32768,    34,-32768,-32768,    52,-32768,-32768,-32768,-32768,-32768,
00270     31,-32768,    31,    35,    36,    37,-32768,-32768,-32768,    38,
00271 -32768,-32768,    52,    46,-32768,    50,    59,-32768,-32768,-32768,
00272 -32768,    76,-32768,    60,    52,-32768,-32768,    58,-32768,    31,
00273     61,-32768,-32768,    81,    31,-32768,-32768,-32768,-32768,    62,
00274     31,-32768,-32768,    31,-32768,    31,    64,-32768,    31,    65,
00275 -32768,    31,-32768,    67,-32768,    88,    89,-32768
00276 };
00277
00278 static const short yypgoto[] = {-32768,
00279 -32768,-32768,-32768,-32768,-32768,-32768,-32768,    68,-32768,-32768,
00280 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
00281 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   -42,    -1,
00282    -90,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
00283 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,     8,
00284 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768
00285 };
00286
00287
00288 #define YYLAST      114
00289
00290
00291 static const short yytable[] = {     8,
00292    106,    35,   108,    -1,     2,    36,    46,    37,     3,    47,
00293     97,   -12,   -12,    98,   -12,   -12,   -12,   -12,    38,   -12,
00294    -12,   -12,   -12,    88,    89,    39,     4,     5,    62,   127,
00295     49,    50,    51,    76,   130,    52,    78,    53,    54,    55,
00296    133,    40,    41,   135,    42,   137,    43,    44,   140,    69,
00297     70,   143,    71,    72,    73,    74,     3,   101,    80,    82,
00298     86,    87,    90,   102,   118,   122,   109,   110,   111,   112,
00299     94,    95,    96,    11,    12,   116,    13,    14,    15,    16,
00300    117,    17,    18,    19,    20,   121,   129,   147,   148,   126,
00301    128,   103,   132,   138,   141,     0,     0,     0,   145,    45,
00302      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00303      0,     0,     0,   123
00304 };
00305
00306 static const short yycheck[] = {     1,
00307     91,    30,    93,     0,     1,    30,     4,    30,     5,     7,
00308      4,     8,     9,     7,    11,    12,    13,    14,    30,    16,
00309     17,    18,    19,    66,    67,    30,    23,    24,    15,   120,
00310     20,    21,    22,     3,   125,    25,     4,    27,    28,    29,
00311    131,    30,    30,   134,    30,   136,    30,    30,   139,    30,
00312     30,   142,    30,    30,    30,    30,     5,    30,    60,    61,
00313      6,     6,     6,    30,     6,     6,    32,    32,    32,    32,
00314     72,    73,    74,     8,     9,    30,    11,    12,    13,    14,
00315     31,    16,    17,    18,    19,    10,     6,     0,     0,    32,
00316     30,    84,    31,    30,    30,    -1,    -1,    -1,    32,    32,
00317     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
00318     -1,    -1,    -1,   115
00319 };
00320 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
00321 #line 3 "/usr/local/share/bison.simple"
00322 /* This file comes from bison-1.26.  */
00323
00324 /* Skeleton output parser for bison,
00325    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
00326
00327    This program is free software; you can redistribute it and/or modify
00328    it under the terms of the GNU General Public License as published by
00329    the Free Software Foundation; either version 2, or (at your option)
00330    any later version.
00331
00332    This program is distributed in the hope that it will be useful,
00333    but WITHOUT ANY WARRANTY; without even the implied warranty of
00334    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00335    GNU General Public License for more details.
00336
00337    You should have received a copy of the GNU General Public License
00338    along with this program; if not, write to the Free Software
00339    Foundation, Inc., 59 Temple Place - Suite 330,
00340    Boston, MA 02111-1307, USA.  */
00341
00342 /* As a special exception, when this file is copied by Bison into a
00343    Bison output file, you may use that output file without restriction.
00344    This special exception was added by the Free Software Foundation
00345    in version 1.24 of Bison.  */
00346
00347 /* This is the parser code that is written into each bison parser
00348   when the %semantic_parser declaration is not specified in the grammar.
00349   It was written by Richard Stallman by simplifying the hairy parser
00350   used when %semantic_parser is specified.  */
00351
00352 #ifndef YYSTACK_USE_ALLOCA
00353 #ifdef alloca
00354 #define YYSTACK_USE_ALLOCA
00355 #else /* alloca not defined */
00356 #ifdef __GNUC__
00357 #define YYSTACK_USE_ALLOCA
00358 #define alloca __builtin_alloca
00359 #else /* not GNU C.  */
00360 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
00361 #define YYSTACK_USE_ALLOCA
00362 #include <alloca.h>
00363 #else /* not sparc */
00364 /* We think this test detects Watcom and Microsoft C.  */
00365 /* This used to test MSDOS, but that is a bad idea
00366    since that symbol is in the user namespace.  */
00367 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
00368 #if 0 /* No need for malloc.h, which pollutes the namespace;
00369      instead, just don't use alloca.  */
00370 #include <malloc.h>
00371 #endif
00372 #else /* not MSDOS, or __TURBOC__ */
00373 #if defined(_AIX)
00374 /* I don't know what this was needed for, but it pollutes the namespace.
00375    So I turned it off.   rms, 2 May 1997.  */
00376 /* #include <malloc.h>  */
00377  #pragma alloca
00378 #define YYSTACK_USE_ALLOCA
00379 #else /* not MSDOS, or __TURBOC__, or _AIX */
00380 #if 0
00381 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
00382          and on HPUX 10.  Eventually we can turn this on.  */
00383 #define YYSTACK_USE_ALLOCA
00384 #define alloca __builtin_alloca
00385 #endif /* __hpux */
00386 #endif
00387 #endif /* not _AIX */
00388 #endif /* not MSDOS, or __TURBOC__ */
00389 #endif /* not sparc */
00390 #endif /* not GNU C */
00391 #endif /* alloca not defined */
00392 #endif /* YYSTACK_USE_ALLOCA not defined */
00393
00394 #ifdef YYSTACK_USE_ALLOCA
00395 #define YYSTACK_ALLOC alloca
00396 #else
00397 #define YYSTACK_ALLOC malloc
00398 #endif
00399
00400 /* Note: there must be only one dollar sign in this file.
00401    It is replaced by the list of actions, each action
00402    as one case of the switch.  */
00403
00404 #define yyerrok     (yyerrstatus = 0)
00405 #define yyclearin   (yychar = YYEMPTY)
00406 #define YYEMPTY     -2
00407 #define YYEOF       0
00408 #define YYACCEPT    goto yyacceptlab
00409 #define YYABORT     goto yyabortlab
00410 #define YYERROR     goto yyerrlab1
00411 /* Like YYERROR except do call yyerror.
00412    This remains here temporarily to ease the
00413    transition to the new meaning of YYERROR, for GCC.
00414    Once GCC version 2 has supplanted version 1, this can go.  */
00415 #define YYFAIL      goto yyerrlab
00416 #define YYRECOVERING()  (!!yyerrstatus)
00417 #define YYBACKUP(token, value) \
00418 do                              \
00419   if (yychar == YYEMPTY && yylen == 1)              \
00420     { yychar = (token), yylval = (value);           \
00421       yychar1 = YYTRANSLATE (yychar);               \
00422       YYPOPSTACK;                       \
00423       goto yybackup;                        \
00424     }                               \
00425   else                              \
00426     { yyerror ("syntax error: cannot back up"); YYERROR; }  \
00427 while (0)
00428
00429 #define YYTERROR    1
00430 #define YYERRCODE   256
00431
00432 #ifndef YYPURE
00433 #define YYLEX       yylex()
00434 #endif
00435
00436 #ifdef YYPURE
00437 #ifdef YYLSP_NEEDED
00438 #ifdef YYLEX_PARAM
00439 #define YYLEX       yylex(&yylval, &yylloc, YYLEX_PARAM)
00440 #else
00441 #define YYLEX       yylex(&yylval, &yylloc)
00442 #endif
00443 #else /* not YYLSP_NEEDED */
00444 #ifdef YYLEX_PARAM
00445 #define YYLEX       yylex(&yylval, YYLEX_PARAM)
00446 #else
00447 #define YYLEX       yylex(&yylval)
00448 #endif
00449 #endif /* not YYLSP_NEEDED */
00450 #endif
00451
00452 /* If nonreentrant, generate the variables here */
00453
00454 #ifndef YYPURE
00455
00456 int yychar;         /*  the lookahead symbol        */
00457 YYSTYPE yylval;         /*  the semantic value of the       */
00458                 /*  lookahead symbol            */
00459
00460 #ifdef YYLSP_NEEDED
00461 YYLTYPE yylloc;         /*  location data for the lookahead */
00462                 /*  symbol              */
00463 #endif
00464
00465 int yynerrs;            /*  number of parse errors so far       */
00466 #endif  /* not YYPURE */
00467
00468 #if YYDEBUG != 0
00469 int yydebug;            /*  nonzero means print parse trace */
00470 /* Since this is uninitialized, it does not stop multiple parsers
00471    from coexisting.  */
00472 #endif
00473
00474 /*  YYINITDEPTH indicates the initial size of the parser's stacks   */
00475
00476 #ifndef YYINITDEPTH
00477 #define YYINITDEPTH 200
00478 #endif
00479
00480 /*  YYMAXDEPTH is the maximum size the stacks can grow to
00481     (effective only if the built-in stack extension method is used).  */
00482
00483 #if YYMAXDEPTH == 0
00484 #undef YYMAXDEPTH
00485 #endif
00486
00487 #ifndef YYMAXDEPTH
00488 #define YYMAXDEPTH 10000
00489 #endif
00490
00491 /* Define __yy_memcpy.  Note that the size argument
00492    should be passed with type unsigned int, because that is what the non-GCC
00493    definitions require.  With GCC, __builtin_memcpy takes an arg
00494    of type size_t, but it can handle unsigned int.  */
00495
00496 #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
00497 #define __yy_memcpy(TO,FROM,COUNT)  __builtin_memcpy(TO,FROM,COUNT)
00498 #else               /* not GNU C or C++ */
00499 #ifndef __cplusplus
00500
00501 /* This is the most reliable way to avoid incompatibilities
00502    in available built-in functions on various systems.  */
00503 static void
00504 __yy_memcpy (to, from, count)
00505      char *to;
00506      char *from;
00507      unsigned int count;
00508 {
00509   register char *f = from;
00510   register char *t = to;
00511   register int i = count;
00512
00513   while (i-- > 0)
00514     *t++ = *f++;
00515 }
00516
00517 #else /* __cplusplus */
00518
00519 /* This is the most reliable way to avoid incompatibilities
00520    in available built-in functions on various systems.  */
00521 static void
00522 __yy_memcpy (char *to, char *from, unsigned int count)
00523 {
00524   register char *t = to;
00525   register char *f = from;
00526   register int i = count;
00527
00528   while (i-- > 0)
00529     *t++ = *f++;
00530 }
00531
00532 #endif
00533 #endif
00534
00535 #line 216 "/usr/local/share/bison.simple"
00536
00537 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
00538    into yyparse.  The argument should have type void *.
00539    It should actually point to an object.
00540    Grammar actions can access the variable by casting it
00541    to the proper pointer type.  */
00542
00543 #ifdef YYPARSE_PARAM
00544 #ifdef __cplusplus
00545 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
00546 #define YYPARSE_PARAM_DECL
00547 #else /* not __cplusplus */
00548 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
00549 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
00550 #endif /* not __cplusplus */
00551 #else /* not YYPARSE_PARAM */
00552 #define YYPARSE_PARAM_ARG
00553 #define YYPARSE_PARAM_DECL
00554 #endif /* not YYPARSE_PARAM */
00555
00556 /* Prevent warning if -Wstrict-prototypes.  */
00557 #ifdef __GNUC__
00558 #ifdef YYPARSE_PARAM
00559 int yyparse (void *);
00560 #else
00561 int yyparse (void);
00562 #endif
00563 #endif
00564
00565 int
00566 yyparse(YYPARSE_PARAM_ARG)
00567      YYPARSE_PARAM_DECL
00568 {
00569   register int yystate;
00570   register int yyn;
00571   register short *yyssp;
00572   register YYSTYPE *yyvsp;
00573   int yyerrstatus;  /*  number of tokens to shift before error messages enabled */
00574   int yychar1 = 0;      /*  lookahead token as an internal (translated) token number */
00575
00576   short yyssa[YYINITDEPTH]; /*  the state stack         */
00577   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack        */
00578
00579   short *yyss = yyssa;      /*  refer to the stacks thru separate pointers */
00580   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
00581
00582 #ifdef YYLSP_NEEDED
00583   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack          */
00584   YYLTYPE *yyls = yylsa;
00585   YYLTYPE *yylsp;
00586
00587 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
00588 #else
00589 #define YYPOPSTACK   (yyvsp--, yyssp--)
00590 #endif
00591
00592   int yystacksize = YYINITDEPTH;
00593   int yyfree_stacks = 0;
00594
00595 #ifdef YYPURE
00596   int yychar;
00597   YYSTYPE yylval;
00598   int yynerrs;
00599 #ifdef YYLSP_NEEDED
00600   YYLTYPE yylloc;
00601 #endif
00602 #endif
00603
00604   YYSTYPE yyval;        /*  the variable used to return     */
00605                 /*  semantic values from the action */
00606                 /*  routines                */
00607
00608   int yylen;
00609
00610 #if YYDEBUG != 0
00611   if (yydebug)
00612     fprintf(stderr, "Starting parse\n");
00613 #endif
00614
00615   yystate = 0;
00616   yyerrstatus = 0;
00617   yynerrs = 0;
00618   yychar = YYEMPTY;     /* Cause a token to be read.  */
00619
00620   /* Initialize stack pointers.
00621      Waste one element of value and location stack
00622      so that they stay on the same level as the state stack.
00623      The wasted elements are never initialized.  */
00624
00625   yyssp = yyss - 1;
00626   yyvsp = yyvs;
00627 #ifdef YYLSP_NEEDED
00628   yylsp = yyls;
00629 #endif
00630
00631 /* Push a new state, which is found in  yystate  .  */
00632 /* In all cases, when you get here, the value and location stacks
00633    have just been pushed. so pushing a state here evens the stacks.  */
00634 yynewstate:
00635
00636   *++yyssp = yystate;
00637
00638   if (yyssp >= yyss + yystacksize - 1)
00639     {
00640       /* Give user a chance to reallocate the stack */
00641       /* Use copies of these so that the &'s don't force the real ones into memory. */
00642       YYSTYPE *yyvs1 = yyvs;
00643       short *yyss1 = yyss;
00644 #ifdef YYLSP_NEEDED
00645       YYLTYPE *yyls1 = yyls;
00646 #endif
00647
00648       /* Get the current used size of the three stacks, in elements.  */
00649       int size = yyssp - yyss + 1;
00650
00651 #ifdef yyoverflow
00652       /* Each stack pointer address is followed by the size of
00653      the data in use in that stack, in bytes.  */
00654 #ifdef YYLSP_NEEDED
00655       /* This used to be a conditional around just the two extra args,
00656      but that might be undefined if yyoverflow is a macro.  */
00657       yyoverflow("parser stack overflow",
00658          &yyss1, size * sizeof (*yyssp),
00659          &yyvs1, size * sizeof (*yyvsp),
00660          &yyls1, size * sizeof (*yylsp),
00661          &yystacksize);
00662 #else
00663       yyoverflow("parser stack overflow",
00664          &yyss1, size * sizeof (*yyssp),
00665          &yyvs1, size * sizeof (*yyvsp),
00666          &yystacksize);
00667 #endif
00668
00669       yyss = yyss1; yyvs = yyvs1;
00670 #ifdef YYLSP_NEEDED
00671       yyls = yyls1;
00672 #endif
00673 #else /* no yyoverflow */
00674       /* Extend the stack our own way.  */
00675       if (yystacksize >= YYMAXDEPTH)
00676     {
00677       yyerror("parser stack overflow");
00678       if (yyfree_stacks)
00679         {
00680           free (yyss);
00681           free (yyvs);
00682 #ifdef YYLSP_NEEDED
00683           free (yyls);
00684 #endif
00685         }
00686       return 2;
00687     }
00688       yystacksize *= 2;
00689       if (yystacksize > YYMAXDEPTH)
00690     yystacksize = YYMAXDEPTH;
00691 #ifndef YYSTACK_USE_ALLOCA
00692       yyfree_stacks = 1;
00693 #endif
00694       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
00695       __yy_memcpy ((char *)yyss, (char *)yyss1,
00696            size * (unsigned int) sizeof (*yyssp));
00697       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
00698       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
00699            size * (unsigned int) sizeof (*yyvsp));
00700 #ifdef YYLSP_NEEDED
00701       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
00702       __yy_memcpy ((char *)yyls, (char *)yyls1,
00703            size * (unsigned int) sizeof (*yylsp));
00704 #endif
00705 #endif /* no yyoverflow */
00706
00707       yyssp = yyss + size - 1;
00708       yyvsp = yyvs + size - 1;
00709 #ifdef YYLSP_NEEDED
00710       yylsp = yyls + size - 1;
00711 #endif
00712
00713 #if YYDEBUG != 0
00714       if (yydebug)
00715     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
00716 #endif
00717
00718       if (yyssp >= yyss + yystacksize - 1)
00719     YYABORT;
00720     }
00721
00722 #if YYDEBUG != 0
00723   if (yydebug)
00724     fprintf(stderr, "Entering state %d\n", yystate);
00725 #endif
00726
00727   goto yybackup;
00728  yybackup:
00729
00730 /* Do appropriate processing given the current state.  */
00731 /* Read a lookahead token if we need one and don't already have one.  */
00732 /* yyresume: */
00733
00734   /* First try to decide what to do without reference to lookahead token.  */
00735
00736   yyn = yypact[yystate];
00737   if (yyn == YYFLAG)
00738     goto yydefault;
00739
00740   /* Not known => get a lookahead token if don't already have one.  */
00741
00742   /* yychar is either YYEMPTY or YYEOF
00743      or a valid token in external form.  */
00744
00745   if (yychar == YYEMPTY)
00746     {
00747 #if YYDEBUG != 0
00748       if (yydebug)
00749     fprintf(stderr, "Reading a token: ");
00750 #endif
00751       yychar = YYLEX;
00752     }
00753
00754   /* Convert token to internal form (in yychar1) for indexing tables with */
00755
00756   if (yychar <= 0)      /* This means end of input. */
00757     {
00758       yychar1 = 0;
00759       yychar = YYEOF;       /* Don't call YYLEX any more */
00760
00761 #if YYDEBUG != 0
00762       if (yydebug)
00763     fprintf(stderr, "Now at end of input.\n");
00764 #endif
00765     }
00766   else
00767     {
00768       yychar1 = YYTRANSLATE(yychar);
00769
00770 #if YYDEBUG != 0
00771       if (yydebug)
00772     {
00773       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
00774       /* Give the individual parser a way to print the precise meaning
00775          of a token, for further debugging info.  */
00776 #ifdef YYPRINT
00777       YYPRINT (stderr, yychar, yylval);
00778 #endif
00779       fprintf (stderr, ")\n");
00780     }
00781 #endif
00782     }
00783
00784   yyn += yychar1;
00785   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
00786     goto yydefault;
00787
00788   yyn = yytable[yyn];
00789
00790   /* yyn is what to do for this token type in this state.
00791      Negative => reduce, -yyn is rule number.
00792      Positive => shift, yyn is new state.
00793        New state is final state => don't bother to shift,
00794        just return success.
00795      0, or most negative number => error.  */
00796
00797   if (yyn < 0)
00798     {
00799       if (yyn == YYFLAG)
00800     goto yyerrlab;
00801       yyn = -yyn;
00802       goto yyreduce;
00803     }
00804   else if (yyn == 0)
00805     goto yyerrlab;
00806
00807   if (yyn == YYFINAL)
00808     YYACCEPT;
00809
00810   /* Shift the lookahead token.  */
00811
00812 #if YYDEBUG != 0
00813   if (yydebug)
00814     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
00815 #endif
00816
00817   /* Discard the token being shifted unless it is eof.  */
00818   if (yychar != YYEOF)
00819     yychar = YYEMPTY;
00820
00821   *++yyvsp = yylval;
00822 #ifdef YYLSP_NEEDED
00823   *++yylsp = yylloc;
00824 #endif
00825
00826   /* count tokens shifted since error; after three, turn off error status.  */
00827   if (yyerrstatus) yyerrstatus--;
00828
00829   yystate = yyn;
00830   goto yynewstate;
00831
00832 /* Do the default action for the current state.  */
00833 yydefault:
00834
00835   yyn = yydefact[yystate];
00836   if (yyn == 0)
00837     goto yyerrlab;
00838
00839 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
00840 yyreduce:
00841   yylen = yyr2[yyn];
00842   if (yylen > 0)
00843     yyval = yyvsp[1-yylen]; /* implement default value of the action */
00844
00845 #if YYDEBUG != 0
00846   if (yydebug)
00847     {
00848       int i;
00849
00850       fprintf (stderr, "Reducing via rule %d (line %d), ",
00851            yyn, yyrline[yyn]);
00852
00853       /* Print the symbols being reduced, and their result.  */
00854       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
00855     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
00856       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
00857     }
00858 #endif
00859
00860
00861   switch (yyn) {
00862
00863 case 5:
00864 #line 85 "parser.yy"
00865 {
00866                                         if(gRcsFile != 0L)
00867                                         {
00868                                             gRcsFile->AllRevs().push_back(CRevFile());
00869                                             gRevFile = &gRcsFile->LastRev();
00870                                         }
00871                                     ;
00872     break;}
00873 case 7:
00874 #line 93 "parser.yy"
00875 { gRcsFile = 0L; expect(kNone); ;
00876     break;}
00877 case 8:
00878 #line 94 "parser.yy"
00879 {
00880                                         int c = yyvsp[0].aint;
00881                                         yyclearin;
00882                                         expect(kAnyButSep);
00883                                         if(gRevFile != 0L)
00884                                             gRevFile->DescLog() << (char)c;
00885                                         else if(gRcsFile != 0L)
00886                                             gRcsFile->DescLog() << (char)c;
00887                                     ;
00888     break;}
00889 case 10:
00890 #line 104 "parser.yy"
00891 {
00892                                         expect(kAnyButSep);
00893                                         if(gRevFile != 0L)
00894                                             gRevFile->DescLog() << sStr;
00895                                         else if(gRcsFile != 0L)
00896                                             gRcsFile->DescLog() << sStr;
00897                                     ;
00898     break;}
00899 case 27:
00900 #line 138 "parser.yy"
00901 {
00902                             char c = yyvsp[0].aint;
00903                             if(gRevFile != 0L)
00904                                 gRevFile->DescLog() << c;
00905                             else if(gRcsFile != 0L)
00906                                 gRcsFile->DescLog() << c;
00907                         ;
00908     break;}
00909 case 28:
00910 #line 145 "parser.yy"
00911 {
00912                             if(gRevFile != 0L)
00913                                 gRevFile->DescLog() << yyvsp[0].string;
00914                             else if(gRcsFile != 0L)
00915                                 gRcsFile->DescLog() << yyvsp[0].string;
00916                             free(yyvsp[0].string);
00917                         ;
00918     break;}
00919 case 29:
00920 #line 155 "parser.yy"
00921 { expect(kAnyButSep); ;
00922     break;}
00923 case 34:
00924 #line 166 "parser.yy"
00925 {
00926                             char c = yyvsp[0].aint;
00927                             if(gRcsFile != 0L)
00928                                 gRcsFile->DescLog() << c;
00929                         ;
00930     break;}
00931 case 35:
00932 #line 171 "parser.yy"
00933 {
00934                             if(gRcsFile != 0L)
00935                                 gRcsFile->DescLog() << yyvsp[0].string;
00936                             free(yyvsp[0].string);
00937                         ;
00938     break;}
00939 case 38:
00940 #line 183 "parser.yy"
00941 { expect(kRevnum); ;
00942     break;}
00943 case 39:
00944 #line 184 "parser.yy"
00945 {
00946                                         if(gRevFile != 0L)
00947                                         {
00948                                             gRevFile->RevNum() = sRev;
00949                                         }
00950                                         sRev.reset();
00951                                     ;
00952     break;}
00953 case 40:
00954 #line 191 "parser.yy"
00955 { expect(kDate); ;
00956     break;}
00957 case 41:
00958 #line 192 "parser.yy"
00959 {
00960                                         if(gRevFile != 0L)
00961                                         {
00962                                             gRevFile->RevTime().tm_year = sInt - 1900;
00963                                         }
00964                                     ;
00965     break;}
00966 case 42:
00967 #line 198 "parser.yy"
00968 {
00969                                         if(gRevFile != 0L)
00970                                         {
00971                                             gRevFile->RevTime().tm_mon = sInt;
00972                                         }
00973                                     ;
00974     break;}
00975 case 43:
00976 #line 204 "parser.yy"
00977 {
00978                                         if(gRevFile != 0L)
00979                                         {
00980                                             gRevFile->RevTime().tm_mday = sInt;
00981                                         }
00982                                     ;
00983     break;}
00984 case 44:
00985 #line 210 "parser.yy"
00986 {
00987                                         if(gRevFile != 0L)
00988                                         {
00989                                             gRevFile->RevTime().tm_hour = sInt;
00990                                         }
00991                                     ;
00992     break;}
00993 case 45:
00994 #line 216 "parser.yy"
00995 {
00996                                         if(gRevFile != 0L)
00997                                         {
00998                                             gRevFile->RevTime().tm_min = sInt;
00999                                         }
01000                                     ;
01001     break;}
01002 case 46:
01003 #line 222 "parser.yy"
01004 {
01005                                         if(gRevFile != 0L)
01006                                         {
01007                                             gRevFile->RevTime().tm_sec = sInt;
01008                                         }
01009                                         expect(kNone);
01010                                     ;
01011     break;}
01012 case 48:
01013 #line 230 "parser.yy"
01014 { expect(kRevnum); ;
01015     break;}
01016 case 50:
01017 #line 233 "parser.yy"
01018 {
01019                                         if(gRevFile != 0L)
01020                                         {
01021                                             gRevFile->Author() = sStr;
01022                                         }
01023                                     ;
01024     break;}
01025 case 51:
01026 #line 240 "parser.yy"
01027 {
01028                                         if(gRevFile != 0L)
01029                                         {
01030                                             gRevFile->Locker() = sStr;
01031                                         }
01032                                     ;
01033     break;}
01034 case 52:
01035 #line 247 "parser.yy"
01036 {
01037                                         if(gRevFile != 0L)
01038                                         {
01039                                             gRevFile->State() = sStr;
01040                                         }
01041                                     ;
01042     break;}
01043 case 53:
01044 #line 253 "parser.yy"
01045 { expect(kInt); ;
01046     break;}
01047 case 54:
01048 #line 254 "parser.yy"
01049 {
01050                                         expect(kInt);
01051                                         if(gRevFile != 0L)
01052                                         {
01053                                             gRevFile->ChgPos() = sInt;
01054                                         }
01055                                     ;
01056     break;}
01057 case 55:
01058 #line 261 "parser.yy"
01059 {
01060                                         if(gRevFile != 0L)
01061                                         {
01062                                             gRevFile->ChgNeg() = sInt;
01063                                         }
01064                                     ;
01065     break;}
01066 case 59:
01067 #line 276 "parser.yy"
01068 {
01069                                     if(gRevFile != 0L)
01070                                     {
01071                                         gRevFile->BranchesList().push_back(sRev);
01072                                     }
01073
01074                                     sRev.reset();
01075                                     expect(kRevnum);
01076                                 ;
01077     break;}
01078 case 60:
01079 #line 288 "parser.yy"
01080 { sStr = yyvsp[0].string; free(yyvsp[0].string); ;
01081     break;}
01082 case 61:
01083 #line 292 "parser.yy"
01084 { sStr = yyvsp[0].string; free(yyvsp[0].string); ;
01085     break;}
01086 case 62:
01087 #line 296 "parser.yy"
01088 { sInt = yyvsp[0].aint; ;
01089     break;}
01090 case 63:
01091 #line 300 "parser.yy"
01092 { expect(kInt); ;
01093     break;}
01094 case 64:
01095 #line 301 "parser.yy"
01096 {
01097                                         if(gRcsFile != 0L)
01098                                         {
01099                                             gRcsFile->TotRevisions() = sInt;
01100                                         }
01101                                     ;
01102     break;}
01103 case 67:
01104 #line 312 "parser.yy"
01105 { expect(kInt); ;
01106     break;}
01107 case 68:
01108 #line 313 "parser.yy"
01109 {
01110                                         if(gRcsFile != 0L)
01111                                         {
01112                                             gRcsFile->SelRevisions() = sInt;
01113                                         }
01114                                     ;
01115     break;}
01116 case 69:
01117 #line 321 "parser.yy"
01118 { expect(kString); ;
01119     break;}
01120 case 70:
01121 #line 322 "parser.yy"
01122 {
01123                                     if(gRcsFile != 0L)
01124                                     {
01125                                         gRcsFile->KeywordSubst() = sStr;
01126                                     }
01127                                 ;
01128     break;}
01129 case 74:
01130 #line 340 "parser.yy"
01131 {
01132                                     expect(kRevnum);
01133                                     if(gRcsFile != 0L)
01134                                     {
01135                                         CRevNumber newRev;
01136                                         newRev.Tag() = sStr;
01137                                         gRcsFile->SymbolicList().push_back(newRev);
01138                                     }
01139                                 ;
01140     break;}
01141 case 75:
01142 #line 349 "parser.yy"
01143 {
01144                                     if(gRcsFile != 0L)
01145                                     {
01146                                         sRev.Tag() = gRcsFile->LastSymbName().Tag();
01147                                         gRcsFile->LastSymbName() = sRev;
01148                                     }
01149                                     sRev.reset();
01150                                 ;
01151     break;}
01152 case 79:
01153 #line 369 "parser.yy"
01154 {
01155                                     if(gRcsFile != 0L)
01156                                     {
01157                                         CLogStr newAccess;
01158                                         newAccess = sStr;
01159                                         gRcsFile->AccessList().push_back(newAccess);
01160                                     }
01161                                 ;
01162     break;}
01163 case 81:
01164 #line 378 "parser.yy"
01165 {
01166                                     if(gRcsFile != 0L)
01167                                     {
01168                                         CLogStr newAccess;
01169                                         newAccess = sStr;
01170                                         gRcsFile->AccessList().push_back(newAccess);
01171                                     }
01172                                 ;
01173     break;}
01174 case 82:
01175 #line 389 "parser.yy"
01176 {
01177                                             if(gRcsFile != 0L)
01178                                             {
01179                                                 gRcsFile->LockStrict() = false;
01180                                             }
01181                                         ;
01182     break;}
01183 case 84:
01184 #line 396 "parser.yy"
01185 {
01186                                             if(gRcsFile != 0L)
01187                                             {
01188                                                 gRcsFile->LockStrict() = true;
01189                                             }
01190                                         ;
01191     break;}
01192 case 88:
01193 #line 411 "parser.yy"
01194 {
01195                                     expect(kRevnum);
01196                                     if(gRcsFile != 0L)
01197                                     {
01198                                         CRevNumber newRev;
01199                                         newRev.Tag() = sStr;
01200                                         gRcsFile->LocksList().push_back(newRev);
01201                                     }
01202                                 ;
01203     break;}
01204 case 89:
01205 #line 420 "parser.yy"
01206 {
01207                                     if(gRcsFile != 0L)
01208                                     {
01209                                         sRev.Tag() = gRcsFile->LastLock().Tag();
01210                                         gRcsFile->LastLock() = sRev;
01211                                     }
01212                                     sRev.reset();
01213                                 ;
01214     break;}
01215 case 90:
01216 #line 431 "parser.yy"
01217 { expect(kRevnumOrNil); ;
01218     break;}
01219 case 91:
01220 #line 432 "parser.yy"
01221 {
01222                                 if(gRcsFile != 0L)
01223                                 {
01224                                     gRcsFile->BranchRev() = sRev;
01225                                 }
01226                                 sRev.reset();
01227                             ;
01228     break;}
01229 case 92:
01230 #line 442 "parser.yy"
01231 { expect(kRevnum); ;
01232     break;}
01233 case 93:
01234 #line 443 "parser.yy"
01235 {
01236                                 if(gRcsFile != 0L)
01237                                 {
01238                                     gRcsFile->HeadRev() = sRev;
01239                                 }
01240                                 sRev.reset();
01241                             ;
01242     break;}
01243 case 94:
01244 #line 453 "parser.yy"
01245 { expect(kString); ;
01246     break;}
01247 case 95:
01248 #line 454 "parser.yy"
01249 {
01250                                     if(gRcsFile != 0L)
01251                                     {
01252                                         gRcsFile->WorkingFile() = sStr;
01253                                     }
01254                                 ;
01255     break;}
01256 case 96:
01257 #line 463 "parser.yy"
01258 { expect(kString); ;
01259     break;}
01260 case 97:
01261 #line 464 "parser.yy"
01262 {
01263                                     // push a new rcs file
01264                                     gRcsFiles.push_back(CRcsFile());
01265                                     gRcsFile = &gRcsFiles[gRcsFiles.size() - 1];
01266                                     gRcsFile->RcsFile() = sStr;
01267                                 ;
01268     break;}
01269 }
01270    /* the action file gets copied in in place of this dollarsign */
01271 #line 542 "/usr/local/share/bison.simple"
01272
01273   yyvsp -= yylen;
01274   yyssp -= yylen;
01275 #ifdef YYLSP_NEEDED
01276   yylsp -= yylen;
01277 #endif
01278
01279 #if YYDEBUG != 0
01280   if (yydebug)
01281     {
01282       short *ssp1 = yyss - 1;
01283       fprintf (stderr, "state stack now");
01284       while (ssp1 != yyssp)
01285     fprintf (stderr, " %d", *++ssp1);
01286       fprintf (stderr, "\n");
01287     }
01288 #endif
01289
01290   *++yyvsp = yyval;
01291
01292 #ifdef YYLSP_NEEDED
01293   yylsp++;
01294   if (yylen == 0)
01295     {
01296       yylsp->first_line = yylloc.first_line;
01297       yylsp->first_column = yylloc.first_column;
01298       yylsp->last_line = (yylsp-1)->last_line;
01299       yylsp->last_column = (yylsp-1)->last_column;
01300       yylsp->text = 0;
01301     }
01302   else
01303     {
01304       yylsp->last_line = (yylsp+yylen-1)->last_line;
01305       yylsp->last_column = (yylsp+yylen-1)->last_column;
01306     }
01307 #endif
01308
01309   /* Now "shift" the result of the reduction.
01310      Determine what state that goes to,
01311      based on the state we popped back to
01312      and the rule number reduced by.  */
01313
01314   yyn = yyr1[yyn];
01315
01316   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
01317   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01318     yystate = yytable[yystate];
01319   else
01320     yystate = yydefgoto[yyn - YYNTBASE];
01321
01322   goto yynewstate;
01323
01324 yyerrlab:   /* here on detecting error */
01325
01326   if (! yyerrstatus)
01327     /* If not already recovering from an error, report this error.  */
01328     {
01329       ++yynerrs;
01330
01331 #ifdef YYERROR_VERBOSE
01332       yyn = yypact[yystate];
01333
01334       if (yyn > YYFLAG && yyn < YYLAST)
01335     {
01336       int size = 0;
01337       char *msg;
01338       int x, count;
01339
01340       count = 0;
01341       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
01342       for (x = (yyn < 0 ? -yyn : 0);
01343            x < (sizeof(yytname) / sizeof(char *)); x++)
01344         if (yycheck[x + yyn] == x)
01345           size += strlen(yytname[x]) + 15, count++;
01346       msg = (char *) malloc(size + 15);
01347       if (msg != 0)
01348         {
01349           strcpy(msg, "parse error");
01350
01351           if (count < 5)
01352         {
01353           count = 0;
01354           for (x = (yyn < 0 ? -yyn : 0);
01355                x < (sizeof(yytname) / sizeof(char *)); x++)
01356             if (yycheck[x + yyn] == x)
01357               {
01358             strcat(msg, count == 0 ? ", expecting `" : " or `");
01359             strcat(msg, yytname[x]);
01360             strcat(msg, "'");
01361             count++;
01362               }
01363         }
01364           yyerror(msg);
01365           free(msg);
01366         }
01367       else
01368         yyerror ("parse error; also virtual memory exceeded");
01369     }
01370       else
01371 #endif /* YYERROR_VERBOSE */
01372     yyerror("parse error");
01373     }
01374
01375   goto yyerrlab1;
01376 yyerrlab1:   /* here on error raised explicitly by an action */
01377
01378   if (yyerrstatus == 3)
01379     {
01380       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
01381
01382       /* return failure if at end of input */
01383       if (yychar == YYEOF)
01384     YYABORT;
01385
01386 #if YYDEBUG != 0
01387       if (yydebug)
01388     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
01389 #endif
01390
01391       yychar = YYEMPTY;
01392     }
01393
01394   /* Else will try to reuse lookahead token
01395      after shifting the error token.  */
01396
01397   yyerrstatus = 3;      /* Each real token shifted decrements this */
01398
01399   goto yyerrhandle;
01400
01401 yyerrdefault:  /* current state does not do anything special for the error token. */
01402
01403 #if 0
01404   /* This is wrong; only states that explicitly want error tokens
01405      should shift them.  */
01406   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
01407   if (yyn) goto yydefault;
01408 #endif
01409
01410 yyerrpop:   /* pop the current state because it cannot handle the error token */
01411
01412   if (yyssp == yyss) YYABORT;
01413   yyvsp--;
01414   yystate = *--yyssp;
01415 #ifdef YYLSP_NEEDED
01416   yylsp--;
01417 #endif
01418
01419 #if YYDEBUG != 0
01420   if (yydebug)
01421     {
01422       short *ssp1 = yyss - 1;
01423       fprintf (stderr, "Error: state stack now");
01424       while (ssp1 != yyssp)
01425     fprintf (stderr, " %d", *++ssp1);
01426       fprintf (stderr, "\n");
01427     }
01428 #endif
01429
01430 yyerrhandle:
01431
01432   yyn = yypact[yystate];
01433   if (yyn == YYFLAG)
01434     goto yyerrdefault;
01435
01436   yyn += YYTERROR;
01437   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
01438     goto yyerrdefault;
01439
01440   yyn = yytable[yyn];
01441   if (yyn < 0)
01442     {
01443       if (yyn == YYFLAG)
01444     goto yyerrpop;
01445       yyn = -yyn;
01446       goto yyreduce;
01447     }
01448   else if (yyn == 0)
01449     goto yyerrpop;
01450
01451   if (yyn == YYFINAL)
01452     YYACCEPT;
01453
01454 #if YYDEBUG != 0
01455   if (yydebug)
01456     fprintf(stderr, "Shifting error token, ");
01457 #endif
01458
01459   *++yyvsp = yylval;
01460 #ifdef YYLSP_NEEDED
01461   *++yylsp = yylloc;
01462 #endif
01463
01464   yystate = yyn;
01465   goto yynewstate;
01466
01467  yyacceptlab:
01468   /* YYACCEPT comes here.  */
01469   if (yyfree_stacks)
01470     {
01471       free (yyss);
01472       free (yyvs);
01473 #ifdef YYLSP_NEEDED
01474       free (yyls);
01475 #endif
01476     }
01477   return 0;
01478
01479  yyabortlab:
01480   /* YYABORT comes here.  */
01481   if (yyfree_stacks)
01482     {
01483       free (yyss);
01484       free (yyvs);
01485 #ifdef YYLSP_NEEDED
01486       free (yyls);
01487 #endif
01488     }
01489   return 1;
01490 }
01491 #line 471 "parser.yy"
01492
01493
01494 void yyerror(const char */*txt*/, ...)
01495 {
01496     expect(kAnyButSep);
01497 }
01498
01499 static void expect(kTokens type)
01500 {
01501     expectToken = type;
01502 }
01503
01504 void yylval_set(const char *txt)
01505 {
01506     yylval.string = strdup(txt);
01507 }
01508
01509 void yylval_set(int anint)
01510 {
01511     yylval.aint = anint;
01512 }
01513
01514 void yylval_set(const CRevNumber & rev)
01515 {
01516     sRev = rev;
01517 }
01518
01519 void yyreset(void)
01520 {
01521     currentLineNumber = 1;
01522     sStr = "";
01523     sInt = 0;
01524     sRev.reset();
01525     gRcsFiles.erase(gRcsFiles.begin(), gRcsFiles.end());
01526     gRcsFile = 0L;
01527     gRevFile = 0L;
01528     expect(kNone);
01529 }
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvstree/parser.cpp Source File

cvstree/parser.cpp

Go to the documentation of this file.
00001 #if 0
00002 #include <Windows.h>
00003 #include <stdio.h>
00004 #include <stdarg.h>
00005 #define fprintf myfprintf
00006
00007 static int myfprintf(FILE *f, const char *format, ...)
00008 {
00009     va_list args;
00010     char mess[1024] = {'\0'};
00011
00012     va_start (args, format);
00013     vsprintf (mess, format, args);
00014     va_end (args);
00015
00016     OutputDebugString(mess);
00017     return 0;
00018 }
00019 #endif
00020
00021 #include "parser.cc"
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvstree/parser.h Source File

cvstree/parser.h

Go to the documentation of this file.
00001 typedef union {
00002     char *string;
00003     int aint;
00004 } YYSTYPE;
00005 #define INTEGER 257
00006 #define STRING  258
00007 #define TAG 259
00008 #define REVNUM  260
00009 #define ID_CHAR 261
00010 #define ID_DESCRIPTION  262
00011 #define ID_TOTREVISIONS 263
00012 #define ID_SELREVISIONS 264
00013 #define ID_KEYWORD  265
00014 #define ID_SYMBOLIC 266
00015 #define ID_ACCESS   267
00016 #define ID_LOCKS    268
00017 #define ID_STRICT   269
00018 #define ID_BRANCH   270
00019 #define ID_HEAD 271
00020 #define ID_WORKING  272
00021 #define ID_RCS  273
00022 #define ID_REVISION 274
00023 #define ID_DATE 275
00024 #define ID_BRANCHES 276
00025 #define ID_REVFOLLOW    277
00026 #define ID_ENDFOLLOW    278
00027 #define ID_LINES    279
00028 #define ID_ANYBUTSEP    280
00029 #define ID_LOCKEDBY 281
00030 #define ID_AUTHOR   282
00031 #define ID_STATE    283
00032
00033
00034 extern YYSTYPE yylval;
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvstree/compat/unistd.h Source File

cvstree/compat/unistd.h

Go to the documentation of this file.
Generated on Sun Oct 21 12:41:43 2001 for WinCvs 1.3b6 Source Doc by

  doxygen 1.2.11 written by Dimitri van Heesch,
 © 1997-2001


rf/uconfig.h Source File

rf/uconfig.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #ifndef UCONFIG_H
00022 #define UCONFIG_H
00023
00024 #if defined(_MSC_VER) || defined(__MWERKS__)
00025 #   define UEXPORT __declspec(dllexport)
00026 #else
00027 #   define UEXPORT
00028 #endif
00029
00030 #endif /* UCONFIG_H */
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/uconsole.cpp Source File

rf/uconsole.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #include "stdafx.h"
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026
00027 #ifdef WIN32
00028 #   ifdef _DEBUG
00029 #       include <crtdbg.h>
00030 #   endif
00031 #endif
00032
00033 #if qMacAPP && qDebug
00034 #   include "Debug_AC.h"
00035 #endif
00036
00037 #include <stdio.h>
00038 #include <stdarg.h>
00039
00040 #include "uconsole.h"
00041
00042 void UAppConsole(const char *format, ...)
00043 {
00044     va_list args;
00045     char mess[1024] = {'\0'};
00046
00047     UASSERT(format != NULL);
00048
00049     va_start (args, format);
00050     vsprintf (mess, format, args);
00051     va_end (args);
00052
00053 #if qGTK
00054     g_warning(mess);
00055 #elif defined(qUnix)
00056 #elif qMacAPP
00057 #   if qDebug
00058     DebugWarning_AC(1, mess, __FILE__, __LINE__);
00059 #   endif
00060 #elif qMacPP
00061     SignalString_(mess);
00062 #elif defined(WIN32)
00063 #   ifdef _DEBUG
00064     _CrtDbgReport(_CRT_WARN, __FILE__, __LINE__, NULL, mess);
00065 #   endif
00066 #else
00067     (void)printf(mess);
00068     (void)fflush(stdout);
00069 #endif
00070 }
00071
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/uconsole.h Source File

rf/uconsole.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #ifndef UCONSOLE_H_
00022 #define UCONSOLE_H_
00023
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027
00028 extern void UAppConsole(const char *format, ...);
00029
00030 #ifndef UTHROW
00031 #   define UTHROW(a) throw a
00032 #endif
00033
00034 #ifdef __cplusplus
00035 }
00036 #endif
00037
00038 #endif /*UCONSOLE_H_*/
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/udraw.cpp Source File

rf/udraw.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 2000
00019  */
00020
00021 #include "stdafx.h"
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026
00027 #include "udraw.h"
00028 #include "uwidget.h"
00029
00030 #ifndef MIN
00031 #   define MIN(a, b) ((a) < (b) ? (a) : (b))
00032 #endif
00033
00034 #ifndef MAX
00035 #   define MAX(a, b) ((a) > (b) ? (a) : (b))
00036 #endif
00037
00038 bool PtInRect(const URECT *r, UPOINT pt)
00039 {
00040     return pt.x >= r->left && pt.x < r->right &&
00041         pt.y >= r->top && pt.y < r->bottom;
00042 }
00043
00044 void SetRect(URECT *r, int x1, int y1, int x2, int y2)
00045 {
00046     r->left = x1;
00047     r->top = y1;
00048     r->right = x2;
00049     r->bottom = y2;
00050     if(r->left > r->right)
00051         r->left = r->right;
00052     if(r->top > r->bottom)
00053         r->top = r->bottom;
00054 }
00055
00056 void SetRectEmpty(URECT *r)
00057 {
00058     r->left = 0;
00059     r->top = 0;
00060     r->right = 0;
00061     r->bottom = 0;
00062 }
00063
00064 bool EqualRect(const URECT *r1, const URECT *r2)
00065 {
00066     return r1->left == r2->left && r1->top == r2->top &&
00067         r1->right == r2->right && r1->bottom == r2->bottom;
00068 }
00069 void InflateRect(URECT *r, int x, int y)
00070 {
00071     r->left += x;
00072     r->top += y;
00073     r->right -= x;
00074     r->bottom -= y;
00075     if(r->left > r->right)
00076         r->left = r->right;
00077     if(r->top > r->bottom)
00078         r->top = r->bottom;
00079 }
00080
00081 void OffsetRect(URECT *r, int x, int y)
00082 {
00083     r->left += x;
00084     r->right += x;
00085     r->top += y;
00086     r->bottom += y;
00087 }
00088
00089 inline bool IsRectEmpty(const URECT *r)
00090 {
00091     return r->left == r->right || r->top == r->bottom;
00092 }
00093
00094 bool UnionRect(URECT *dest, const URECT *src1, const URECT *src2)
00095 {
00096     if(::IsRectEmpty(src1))
00097     {
00098         *dest = *src2;
00099         return true;
00100     }
00101     if(::IsRectEmpty(src2))
00102     {
00103         *dest = *src1;
00104         return true;
00105     }
00106     dest->left = MIN (src1->left, src2->left);
00107     dest->top = MIN (src1->top, src2->top);
00108     dest->right = MAX (src1->right, src2->right);
00109     dest->bottom = MAX (src1->bottom, src2->bottom);
00110     return true;
00111 }
00112
00113 bool IntersectRect(URECT *dest, const URECT *src1, const URECT *src2)
00114 {
00115     const URECT *temp;
00116     bool return_val = false;
00117
00118     if (src2->left < src1->left)
00119     {
00120         temp = src1;
00121         src1 = src2;
00122         src2 = temp;
00123     }
00124     dest->left = src2->left;
00125
00126     if (src2->left < src1->right)
00127     {
00128         if (src1->right < src2->right)
00129             dest->right = src1->right;
00130         else
00131             dest->right = src2->right;
00132
00133         if (src2->top < src1->top)
00134         {
00135             temp = src1;
00136             src1 = src2;
00137             src2 = temp;
00138         }
00139         dest->top = src2->top;
00140
00141         if (src2->top < src1->bottom)
00142         {
00143             return_val = true;
00144
00145             if (src1->bottom < src2->bottom)
00146                 dest->bottom = src1->bottom;
00147             else
00148                 dest->bottom = src2->bottom;
00149
00150             if (dest->left == dest->right)
00151                 return_val = false;
00152             if (dest->top == dest->bottom)
00153                 return_val = false;
00154         }
00155     }
00156
00157     return return_val;
00158 }
00159
00160 UDC::UDC(int widid, int cmdid) : m_wid(0L), m_pen(0L), m_brush(0L)
00161 #if qGTK
00162     , m_gc(0L), m_penloc(0, 0), m_drawable(0L), m_orig(0, 0)
00163 #endif
00164 {
00165     UCmdTarget *target = UEventQueryWidget(widid);
00166     if(target == 0L || !target->IsKindOf(URUNTIME_CLASS(UWidget)))
00167         return;
00168
00169     m_wid = ((UWidget *)target)->GetWidget(cmdid);
00170 #if qGTK
00171     if(m_wid != 0L)
00172     {
00173         GtkWidget *widget = GTK_WIDGET(m_wid);
00174         if(GTK_IS_LAYOUT(widget))
00175         {
00176             GtkLayout *layout = GTK_LAYOUT(widget);
00177             m_drawable = layout->bin_window;
00178             m_orig.x = -layout->xoffset;
00179             m_orig.y = -layout->yoffset;
00180         }
00181         else
00182             m_drawable = m_drawable;
00183         m_gc = gdk_gc_new(m_drawable);
00184         if(m_gc == 0L)
00185             m_wid = 0L;
00186         else
00187         {
00188             GdkGCValues values;
00189             gdk_gc_get_values(m_gc, &values);
00190             m_foreground = values.foreground;
00191             m_background = values.background;
00192             m_font = gdk_font_load ("-adobe-*-medium-r-normal--*-120-*-*-*-*-iso8859-*");
00193             if(m_font == 0L)
00194                 m_font = gdk_font_load ("-adobe-courier-medium-r-normal--*-120-*-*-*-*-*-*");
00195             if(m_font != 0L)
00196                 gdk_gc_set_font(m_gc, m_font);
00197         }
00198     }
00199 #endif
00200 }
00201
00202 UPen *UDC::SelectObject(UPen* pPen)
00203 {
00204     if(m_wid == 0L)
00205         return 0L;
00206
00207     UPen *oldpen = m_pen;
00208     m_pen = pPen;
00209
00210 #if qGTK
00211     if(m_pen != 0L && m_pen->m_set)
00212         gdk_gc_set_foreground(m_gc, &m_pen->m_col);
00213     else
00214         gdk_gc_set_foreground(m_gc, &m_foreground);
00215 #endif
00216
00217     return oldpen;
00218 }
00219
00220 UBrush *UDC::SelectObject(UBrush* pBrush)
00221 {
00222     if(m_wid == 0L)
00223         return 0L;
00224
00225     UBrush *oldbrush = m_brush;
00226     m_brush = pBrush;
00227
00228 #if qGTK
00229     if(m_brush != 0L && m_brush->m_set)
00230         gdk_gc_set_background(m_gc, &m_brush->m_col);
00231     else
00232         gdk_gc_set_background(m_gc, &m_background);
00233 #endif
00234
00235     return oldbrush;
00236 }
00237
00238 UDC::~UDC()
00239 {
00240 #if qGTK
00241     if(m_gc != 0L)
00242         gdk_gc_destroy(m_gc);
00243     if(m_font != 0L)
00244         gdk_font_unref (m_font);
00245 #endif
00246 }
00247
00248 bool UDC::Rectangle(const URECT *lpRect)
00249 {
00250     if(m_wid == 0L)
00251         return false;
00252
00253 #if qGTK
00254     URect r(*lpRect);
00255     if(m_brush != 0L && m_brush->m_set)
00256     {
00257         gdk_gc_set_foreground(m_gc, &m_brush->m_col);
00258         gdk_draw_rectangle (m_drawable, m_gc, TRUE,
00259                             r.left + m_orig.x, r.top + m_orig.y, r.Width(), r.Height());
00260         SelectObject(m_pen);
00261     }
00262     gdk_draw_rectangle (m_drawable, m_gc, FALSE,
00263                         r.left + m_orig.x, r.top + m_orig.y, r.Width(), r.Height());
00264 #endif
00265     return true;
00266 }
00267
00268 bool UDC::RoundRect(const URECT *lpRect, UPOINT point)
00269 {
00270     if(m_wid == 0L)
00271         return false;
00272
00273 #if qGTK
00274     URect r(*lpRect);
00275     if(m_brush != 0L && m_brush->m_set)
00276     {
00277         gdk_gc_set_foreground(m_gc, &m_brush->m_col);
00278         gdk_draw_rectangle (m_drawable, m_gc, TRUE,
00279                             r.left + m_orig.x, r.top + m_orig.y, r.Width(), r.Height());
00280         SelectObject(m_pen);
00281     }
00282     gdk_draw_rectangle (m_drawable, m_gc, FALSE,
00283                         r.left + m_orig.x, r.top + m_orig.y, r.Width(), r.Height());
00284 #endif
00285     return true;
00286 }
00287
00288 void UDC::MoveTo(int x, int y)
00289 {
00290     if(m_wid == 0L)
00291         return;
00292
00293 #if qGTK
00294     m_penloc.x = x + m_orig.x;
00295     m_penloc.y = y + m_orig.y;
00296 #endif
00297 }
00298
00299 void UDC::LineTo(int x, int y)
00300 {
00301     if(m_wid == 0L)
00302         return;
00303
00304 #if qGTK
00305     gdk_draw_line(m_drawable, m_gc,
00306                   m_penloc.x, m_penloc.y, x + m_orig.x, y + m_orig.y);
00307     m_penloc.x = x + m_orig.x;
00308     m_penloc.y = y + m_orig.y;
00309 #endif
00310 }
00311
00312 USize UDC::GetTextExtent(const char *lpszString, int nCount) const
00313 {
00314     USize res(0, 0);
00315     if(m_wid == 0L)
00316         return res;
00317
00318 #if qGTK
00319     if(m_font == 0L)
00320         return res;
00321
00322     res.cx = gdk_text_width(m_font, lpszString, nCount);
00323     res.cy = gdk_text_height(m_font, lpszString, nCount);
00324 #endif
00325
00326     return res;
00327 }
00328
00329 int UDC::GetTextHeight(void) const
00330 {
00331     int res = 0;
00332     if(m_wid == 0L)
00333         return res;
00334
00335 #if qGTK
00336     if(m_font == 0L)
00337         return res;
00338
00339     res = m_font->ascent + m_font->descent;
00340 #endif
00341
00342     return res;
00343 }
00344
00345 bool UDC::TextOutClipped(int x, int y, const URECT *lpRect,
00346                          const char *lpszString, int nCount)
00347 {
00348     if(m_wid == 0L)
00349         return false;
00350
00351 #if qGTK
00352     if(m_font == 0L)
00353         return false;
00354
00355     USize size = GetTextExtent(lpszString, nCount);
00356     URect r(*lpRect);
00357     UPoint out(r.left, r.bottom);
00358     out += UPoint((r.Width() - size.cx) / 2, -(r.Height() - size.cy) / 2);
00359     gdk_draw_text(m_drawable, m_font, m_gc, out.x + m_orig.x, out.y + m_orig.y,
00360                   lpszString, nCount);
00361 #endif
00362
00363     return true;
00364 }
00365
00366 bool UDC::DrawBitmap(void *bitmap, UPOINT where)
00367 {
00368     if(m_wid == 0L)
00369         return false;
00370
00371 #if qGTK
00372     if(m_font == 0L)
00373         return false;
00374
00375     gdk_draw_pixmap(m_drawable, m_gc, GTK_PIXMAP(bitmap)->pixmap,
00376                     0, 0, where.x + m_orig.x, where.y + m_orig.y, -1, -1);
00377 #endif
00378
00379     return true;
00380 }
00381
00382 UPen::UPen()
00383 #if qGTK
00384     : m_set(false)
00385 #endif
00386 {
00387 }
00388
00389 UPen::~UPen()
00390 {
00391     DeleteObject();
00392 }
00393
00394 bool UPen::DeleteObject(void)
00395 {
00396     bool res = false;
00397 #if qGTK
00398     if(m_set)
00399     {
00400         m_set = false;
00401         GdkColormap *cmap = gdk_colormap_get_system();
00402         if(cmap != 0L)
00403         {
00404             gdk_colormap_free_colors(cmap, &m_col, 1);
00405             res = true;
00406         }
00407     }
00408     else
00409         res = true;
00410 #endif
00411     return res;
00412 }
00413
00414 bool UPen::CreatePen(int nPenStyle, int nWidth, UCOLORREF crColor)
00415 {
00416     bool res = false;
00417
00418     m_width = nWidth;
00419     m_style = nPenStyle;
00420
00421 #if qGTK
00422     DeleteObject();
00423     GdkColormap *cmap = gdk_colormap_get_system();
00424     if(cmap != 0L)
00425     {
00426         m_col.red = UGetRValue(crColor) << 8;
00427         m_col.green = UGetGValue(crColor) << 8;
00428         m_col.blue = UGetBValue(crColor) << 8;
00429         if(gdk_color_alloc(cmap, &m_col))
00430             m_set = true;
00431     }
00432     res = m_set;
00433 #endif
00434     return res;
00435 }
00436
00437 UBrush::UBrush()
00438 #if qGTK
00439     : m_set(false)
00440 #endif
00441 {
00442 }
00443
00444 UBrush::~UBrush()
00445 {
00446     DeleteObject();
00447 }
00448
00449 bool UBrush::DeleteObject(void)
00450 {
00451     bool res = false;
00452 #if qGTK
00453     if(m_set)
00454     {
00455         m_set = false;
00456         GdkColormap *cmap = gdk_colormap_get_system();
00457         if(cmap != 0L)
00458         {
00459             gdk_colormap_free_colors(cmap, &m_col, 1);
00460             res = true;
00461         }
00462     }
00463     else
00464         res = true;
00465 #endif
00466     return res;
00467 }
00468
00469 bool UBrush::CreateSolidBrush(UCOLORREF crColor)
00470 {
00471     bool res = false;
00472
00473 #if qGTK
00474     DeleteObject();
00475     GdkColormap *cmap = gdk_colormap_get_system();
00476     if(cmap != 0L)
00477     {
00478         m_col.red = UGetRValue(crColor) << 8;
00479         m_col.green = UGetGValue(crColor) << 8;
00480         m_col.blue = UGetBValue(crColor) << 8;
00481         if(gdk_color_alloc(cmap, &m_col))
00482             m_set = true;
00483     }
00484     res = m_set;
00485 #endif
00486     return res;
00487 }
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/udraw.h Source File

rf/udraw.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 2000
00019  */
00020
00021 #ifndef UDRAW_H
00022 #define UDRAW_H
00023
00024 #include "uconfig.h"
00025 #include "umain.h"
00026
00027 #if qGTK
00028 #   include <gtk/gtk.h>
00029 #endif
00030
00031 #ifdef __cplusplus
00032
00033 extern UEXPORT bool PtInRect(const URECT *r, UPOINT pt);
00034 extern UEXPORT void SetRect(URECT *r, int x1, int y1, int x2, int y2);
00035 extern UEXPORT void SetRectEmpty(URECT *r);
00036 extern UEXPORT bool EqualRect(const URECT *r1, const URECT *r2);
00037 extern UEXPORT void InflateRect(URECT *r, int x, int y);
00038 extern UEXPORT void OffsetRect(URECT *r, int x, int y);
00039 extern UEXPORT bool UnionRect(URECT *dest, const URECT *src1, const URECT *src2);
00040 extern UEXPORT bool IntersectRect(URECT *dest, const URECT *src1, const URECT *src2);
00041
00042 inline void CopyRect(URECT *dst, const URECT *src) { *dst = *src; }
00043
00044 class UPoint;
00045 class URect;
00046
00047 class USize : public USIZE
00048 {
00049 public:
00050
00051 /* Constructors */
00052     /* construct an uninitialized size */
00053     USize();
00054     /* create from two integers */
00055     USize(int initCX, int initCY);
00056     /* create from another size */
00057     USize(USIZE initSize);
00058     /* create from a point */
00059     USize(UPOINT initPt);
00060
00061 /* Operations */
00062     bool operator==(USIZE size) const;
00063     bool operator!=(USIZE size) const;
00064     void operator+=(USIZE size);
00065     void operator-=(USIZE size);
00066
00067 /* Operators returning USize values */
00068     USize operator+(USIZE size) const;
00069     USize operator-(USIZE size) const;
00070     USize operator-() const;
00071
00072 /* Operators returning UPoint values */
00073     UPoint operator+(UPOINT point) const;
00074     UPoint operator-(UPOINT point) const;
00075
00076 /* Operators returning URect values */
00077     URect operator+(const URECT* lpRect) const;
00078     URect operator-(const URECT* lpRect) const;
00079 };
00080
00081 class UPoint : public UPOINT
00082 {
00083 public:
00084 /* Constructors */
00085
00086     /* create an uninitialized point */
00087     UPoint();
00088     /* create from two integers */
00089     UPoint(int initX, int initY);
00090     /* create from another point */
00091     UPoint(UPOINT initPt);
00092     /* create from a size */
00093     UPoint(USIZE initSize);
00094
00095 /* Operations */
00096
00097 /* translate the point */
00098     void Offset(int xOffset, int yOffset);
00099     void Offset(UPOINT point);
00100     void Offset(USIZE size);
00101
00102     bool operator==(UPOINT point) const;
00103     bool operator!=(UPOINT point) const;
00104     void operator+=(USIZE size);
00105     void operator-=(USIZE size);
00106     void operator+=(UPOINT point);
00107     void operator-=(UPOINT point);
00108
00109 /* Operators returning UPoint values */
00110     UPoint operator+(USIZE size) const;
00111     UPoint operator-(USIZE size) const;
00112     UPoint operator-() const;
00113     UPoint operator+(UPOINT point) const;
00114
00115 /* Operators returning USize values */
00116     USize operator-(UPOINT point) const;
00117
00118 /* Operators returning URect values */
00119     URect operator+(const URECT* lpRect) const;
00120     URect operator-(const URECT* lpRect) const;
00121 };
00122
00123 class URect : public URECT
00124 {
00125 public:
00126
00127 /* Constructors */
00128
00129     /* uninitialized rectangle */
00130     URect();
00131     /* from left, top, right, and bottom */
00132     URect(int l, int t, int r, int b);
00133     /* copy constructor */
00134     URect(const URECT& srURect);
00135     /* from a pointer to another rect */
00136     URect(const URECT* lpSrURect);
00137     /* from a point and size */
00138     URect(UPOINT point, USIZE size);
00139     /* from two points */
00140     URect(UPOINT topLeft, UPOINT bottomRight);
00141 #ifdef __QUICKDRAW__
00142     URect(const Rect & macRect);
00143 #endif
00144 #ifdef __AFX_H__
00145     URect(const CRect & winRect);
00146 #endif
00147
00148 /* Attributes (in addition to RECT members) */
00149
00150     /* retrieves the width */
00151     int Width() const;
00152     /* returns the height */
00153     int Height() const;
00154     /* returns the size */
00155     USize Size() const;
00156     /* reference to the top-left point */
00157     UPoint& TopLeft();
00158     /* reference to the bottom-right point */
00159     UPoint& BottomRight();
00160     /* const reference to the top-left point */
00161     const UPoint& TopLeft() const;
00162     /* const reference to the bottom-right point */
00163     const UPoint& BottomRight() const;
00164     /* the geometric center point of the rectangle */
00165     UPoint CenterPoint() const;
00166
00167     /* convert between URect and LPRECT/const RECT* (no need for &) */
00168     operator URECT*();
00169     operator const URECT*() const;
00170 #ifdef __QUICKDRAW__
00171     operator Rect() const;
00172 #endif
00173 #ifdef __AFX_H__
00174     operator CRect() const;
00175 #endif
00176
00177     /* returns TRUE if rectangle has no area */
00178     bool IsRectEmpty() const;
00179     /* returns TRUE if rectangle is at (0,0) and has no area */
00180     bool IsRectNull() const;
00181     /* returns TRUE if point is within rectangle */
00182     bool PtInRect(UPOINT point) const;
00183
00184 /* Operations */
00185
00186     /* set rectangle from left, top, right, and bottom */
00187     void SetRect(int x1, int y1, int x2, int y2);
00188     void SetRect(UPOINT topLeft, UPOINT bottomRight);
00189     /* empty the rectangle */
00190     void SetRectEmpty();
00191     /* copy from another rectangle */
00192     void CopyRect(const URECT* lpSrURect);
00193     /* TRUE if exactly the same as another rectangle */
00194     bool EqualRect(const URECT* lpRect) const;
00195
00196     /* inflate rectangle's width and height without */
00197     /* moving its top or left */
00198     void InflateRect(int x, int y);
00199     void InflateRect(USIZE size);
00200     void InflateRect(const URECT* lpRect);
00201     void InflateRect(int l, int t, int r, int b);
00202     /* deflate the rectangle's width and height without */
00203     /* moving its top or left */
00204     void DeflateRect(int x, int y);
00205     void DeflateRect(USIZE size);
00206     void DeflateRect(const URECT* lpRect);
00207     void DeflateRect(int l, int t, int r, int b);
00208
00209     /* translate the rectangle by moving its top and left */
00210     void OffsetRect(int x, int y);
00211     void OffsetRect(USIZE size);
00212     void OffsetRect(UPOINT point);
00213     void NormalizeRect();
00214
00215     /* set this rectangle to intersection of two others */
00216     bool IntersectRect(const URECT* lpRect1, const URECT* lpRect2);
00217
00218     /* set this rectangle to bounding union of two others */
00219     bool UnionRect(const URECT* lpRect1, const URECT* lpRect2);
00220
00221     /* set this rectangle to minimum of two others */
00222 /*      bool SubtractRect(const RECT* lpRectSrc1, const RECT* lpRectSrc2); */
00223
00224 /* Additional Operations */
00225     void operator=(const URECT& srURect);
00226     bool operator==(const URECT& rect) const;
00227     bool operator!=(const URECT& rect) const;
00228     void operator+=(UPOINT point);
00229     void operator+=(USIZE size);
00230     void operator+=(const URECT* lpRect);
00231     void operator-=(UPOINT point);
00232     void operator-=(USIZE size);
00233     void operator-=(const URECT* lpRect);
00234     void operator&=(const URECT& rect);
00235     void operator|=(const URECT& rect);
00236
00237 /* Operators returning URect values */
00238     URect operator+(UPOINT point) const;
00239     URect operator-(UPOINT point) const;
00240     URect operator+(const URECT* lpRect) const;
00241     URect operator+(USIZE size) const;
00242     URect operator-(USIZE size) const;
00243     URect operator-(const URECT* lpRect) const;
00244     URect operator&(const URECT& rect2) const;
00245     URect operator|(const URECT& rect2) const;
00246     URect MulDiv(int nMultiplier, int nDivisor) const;
00247 };
00248
00249 /* USize */
00250 inline USize::USize()
00251     { /* random filled */ }
00252 inline USize::USize(int initCX, int initCY)
00253     { cx = initCX; cy = initCY; }
00254 inline USize::USize(USIZE initSize)
00255     { *(USIZE*)this = initSize; }
00256 inline USize::USize(UPOINT initPt)
00257     { *(UPOINT*)this = initPt; }
00258 inline bool USize::operator==(USIZE size) const
00259     { return (cx == size.cx && cy == size.cy); }
00260 inline bool USize::operator!=(USIZE size) const
00261     { return (cx != size.cx || cy != size.cy); }
00262 inline void USize::operator+=(USIZE size)
00263     { cx += size.cx; cy += size.cy; }
00264 inline void USize::operator-=(USIZE size)
00265     { cx -= size.cx; cy -= size.cy; }
00266 inline USize USize::operator+(USIZE size) const
00267     { return USize(cx + size.cx, cy + size.cy); }
00268 inline USize USize::operator-(USIZE size) const
00269     { return USize(cx - size.cx, cy - size.cy); }
00270 inline USize USize::operator-() const
00271     { return USize(-cx, -cy); }
00272 inline UPoint USize::operator+(UPOINT point) const
00273     { return UPoint(cx + point.x, cy + point.y); }
00274 inline UPoint USize::operator-(UPOINT point) const
00275     { return UPoint(cx - point.x, cy - point.y); }
00276 inline URect USize::operator+(const URECT* lpRect) const
00277     { return URect(lpRect) + *this; }
00278 inline URect USize::operator-(const URECT* lpRect) const
00279     { return URect(lpRect) - *this; }
00280
00281 /* UPoint */
00282 inline UPoint::UPoint()
00283     { /* random filled */ }
00284 inline UPoint::UPoint(int initX, int initY)
00285     { x = initX; y = initY; }
00286 inline UPoint::UPoint(UPOINT initPt)
00287     { *(UPOINT*)this = initPt; }
00288 inline UPoint::UPoint(USIZE initSize)
00289     { *(USIZE*)this = initSize; }
00290 inline void UPoint::Offset(int xOffset, int yOffset)
00291     { x += xOffset; y += yOffset; }
00292 inline void UPoint::Offset(UPOINT point)
00293     { x += point.x; y += point.y; }
00294 inline void UPoint::Offset(USIZE size)
00295     { x += size.cx; y += size.cy; }
00296 inline bool UPoint::operator==(UPOINT point) const
00297     { return (x == point.x && y == point.y); }
00298 inline bool UPoint::operator!=(UPOINT point) const
00299     { return (x != point.x || y != point.y); }
00300 inline void UPoint::operator+=(USIZE size)
00301     { x += size.cx; y += size.cy; }
00302 inline void UPoint::operator-=(USIZE size)
00303     { x -= size.cx; y -= size.cy; }
00304 inline void UPoint::operator+=(UPOINT point)
00305     { x += point.x; y += point.y; }
00306 inline void UPoint::operator-=(UPOINT point)
00307     { x -= point.x; y -= point.y; }
00308 inline UPoint UPoint::operator+(USIZE size) const
00309     { return UPoint(x + size.cx, y + size.cy); }
00310 inline UPoint UPoint::operator-(USIZE size) const
00311     { return UPoint(x - size.cx, y - size.cy); }
00312 inline UPoint UPoint::operator-() const
00313     { return UPoint(-x, -y); }
00314 inline UPoint UPoint::operator+(UPOINT point) const
00315     { return UPoint(x + point.x, y + point.y); }
00316 inline USize UPoint::operator-(UPOINT point) const
00317     { return USize(x - point.x, y - point.y); }
00318 inline URect UPoint::operator+(const URECT* lpRect) const
00319     { return URect(lpRect) + *this; }
00320 inline URect UPoint::operator-(const URECT* lpRect) const
00321     { return URect(lpRect) - *this; }
00322
00323 /* URect */
00324 inline URect::URect()
00325     { /* random filled */ }
00326 inline URect::URect(int l, int t, int r, int b)
00327     { left = l; top = t; right = r; bottom = b; }
00328 inline URect::URect(const URECT& srURect)
00329     { ::CopyRect(this, &srURect); }
00330 inline URect::URect(const URECT* lpSrURect)
00331     { ::CopyRect(this, lpSrURect); }
00332 inline URect::URect(UPOINT point, USIZE size)
00333     { right = (left = point.x) + size.cx; bottom = (top = point.y) + size.cy; }
00334 inline URect::URect(UPOINT topLeft, UPOINT bottomRight)
00335     { left = topLeft.x; top = topLeft.y;
00336         right = bottomRight.x; bottom = bottomRight.y; }
00337 #ifdef __QUICKDRAW__
00338 inline URect::URect(const Rect & macRect)
00339     { left = macRect.left; right = macRect.right; top = macRect.top; bottom = macRect.bottom; }
00340 #endif
00341 #ifdef __AFX_H__
00342 inline URect::URect(const CRect & winRect)
00343     { left = winRect.left; right = winRect.right; top = winRect.top; bottom = winRect.bottom; }
00344 #endif
00345 inline int URect::Width() const
00346     { return right - left; }
00347 inline int URect::Height() const
00348     { return bottom - top; }
00349 inline USize URect::Size() const
00350     { return USize(right - left, bottom - top); }
00351 inline UPoint& URect::TopLeft()
00352     { return *((UPoint*)this); }
00353 inline UPoint& URect::BottomRight()
00354     { return *((UPoint*)this+1); }
00355 inline const UPoint& URect::TopLeft() const
00356     { return *((UPoint*)this); }
00357 inline const UPoint& URect::BottomRight() const
00358     { return *((UPoint*)this+1); }
00359 inline UPoint URect::CenterPoint() const
00360     { return UPoint((left+right)/2, (top+bottom)/2); }
00361 inline URect::operator URECT*()
00362     { return this; }
00363 inline URect::operator const URECT*() const
00364     { return this; }
00365 #ifdef __QUICKDRAW__
00366 inline URect::operator Rect() const
00367 {
00368     Rect r; ::MacSetRect(&r, left, top, right, bottom); return r;
00369 }
00370 #endif
00371 #ifdef __AFX_H__
00372 inline URect::operator CRect() const
00373 {
00374     return CRect(left, top, right, bottom);
00375 }
00376 #endif
00377 inline bool URect::IsRectEmpty() const
00378     { return left == right || top == bottom; }
00379 inline bool URect::IsRectNull() const
00380     { return (left == 0 && right == 0 && top == 0 && bottom == 0); }
00381 inline bool URect::PtInRect(UPOINT point) const
00382     { return ::PtInRect(this, point); }
00383 inline void URect::SetRect(int x1, int y1, int x2, int y2)
00384     { ::SetRect(this, x1, y1, x2, y2); }
00385 inline void URect::SetRect(UPOINT topLeft, UPOINT bottomRight)
00386     { ::SetRect(this, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); }
00387 inline void URect::SetRectEmpty()
00388     { ::SetRectEmpty(this); }
00389 inline void URect::CopyRect(const URECT* lpSrURect)
00390     { ::CopyRect(this, lpSrURect); }
00391 inline bool URect::EqualRect(const URECT* lpRect) const
00392     { return ::EqualRect(this, lpRect); }
00393 inline void URect::InflateRect(int x, int y)
00394     { ::InflateRect(this, x, y); }
00395 inline void URect::InflateRect(USIZE size)
00396     { ::InflateRect(this, size.cx, size.cy); }
00397 inline void URect::DeflateRect(int x, int y)
00398     { ::InflateRect(this, -x, -y); }
00399 inline void URect::DeflateRect(USIZE size)
00400     { ::InflateRect(this, -size.cx, -size.cy); }
00401 inline void URect::OffsetRect(int x, int y)
00402     { ::OffsetRect(this, x, y); }
00403 inline void URect::OffsetRect(UPOINT point)
00404     { ::OffsetRect(this, point.x, point.y); }
00405 inline void URect::OffsetRect(USIZE size)
00406     { ::OffsetRect(this, size.cx, size.cy); }
00407 inline bool URect::IntersectRect(const URECT* lpRect1, const URECT* lpRect2)
00408     { return ::IntersectRect(this, lpRect1, lpRect2);}
00409 inline bool URect::UnionRect(const URECT* lpRect1, const URECT* lpRect2)
00410     { return ::UnionRect(this, lpRect1, lpRect2); }
00411 inline void URect::operator=(const URECT& srURect)
00412     { ::CopyRect(this, &srURect); }
00413 inline bool URect::operator==(const URECT& rect) const
00414     { return ::EqualRect(this, &rect); }
00415 inline bool URect::operator!=(const URECT& rect) const
00416     { return !::EqualRect(this, &rect); }
00417 inline void URect::operator+=(UPOINT point)
00418     { ::OffsetRect(this, point.x, point.y); }
00419 inline void URect::operator+=(USIZE size)
00420     { ::OffsetRect(this, size.cx, size.cy); }
00421 inline void URect::operator+=(const URECT* lpRect)
00422     { InflateRect(lpRect); }
00423 inline void URect::operator-=(UPOINT point)
00424     { ::OffsetRect(this, -point.x, -point.y); }
00425 inline void URect::operator-=(USIZE size)
00426     { ::OffsetRect(this, -size.cx, -size.cy); }
00427 inline void URect::operator-=(const URECT* lpRect)
00428     { DeflateRect(lpRect); }
00429 inline void URect::operator&=(const URECT& rect)
00430     { ::IntersectRect(this, this, &rect); }
00431 inline void URect::operator|=(const URECT& rect)
00432     { ::UnionRect(this, this, &rect); }
00433 inline URect URect::operator+(UPOINT pt) const
00434     { URect rect(*this); ::OffsetRect(&rect, pt.x, pt.y); return rect; }
00435 inline URect URect::operator-(UPOINT pt) const
00436     { URect rect(*this); ::OffsetRect(&rect, -pt.x, -pt.y); return rect; }
00437 inline URect URect::operator+(USIZE size) const
00438     { URect rect(*this); ::OffsetRect(&rect, size.cx, size.cy); return rect; }
00439 inline URect URect::operator-(USIZE size) const
00440     { URect rect(*this); ::OffsetRect(&rect, -size.cx, -size.cy); return rect; }
00441 inline URect URect::operator+(const URECT* lpRect) const
00442     { URect rect(this); rect.InflateRect(lpRect); return rect; }
00443 inline URect URect::operator-(const URECT* lpRect) const
00444     { URect rect(this); rect.DeflateRect(lpRect); return rect; }
00445 inline URect URect::operator&(const URECT& rect2) const
00446     { URect rect; ::IntersectRect(&rect, this, &rect2);
00447         return rect; }
00448 inline URect URect::operator|(const URECT& rect2) const
00449     { URect rect; ::UnionRect(&rect, this, &rect2);
00450         return rect; }
00451 /*  inline bool URect::SubtractRect(const URECT* lpRectSrc1, const URECT* lpRectSrc2)
00452     { return ::SubtractRect(this, lpRectSrc1, lpRectSrc2); }*/
00453
00454 typedef long UCOLORREF;
00455 #define URGB(r,g,b) ((UCOLORREF)(((unsigned char)(r)|((unsigned short)((unsigned char)(g))<<8))|(((unsigned int)(unsigned char)(b))<<16)))
00456 #define UGetRValue(rgb)      ((unsigned char)(rgb))
00457 #define UGetGValue(rgb)      ((unsigned char)(((unsigned short)(rgb)) >> 8))
00458 #define UGetBValue(rgb)      ((unsigned char)((rgb)>>16))
00459
00460 #define UPS_SOLID 0
00461
00462 class UPen
00463 {
00464 public:
00465     UPen();
00466     ~UPen();
00467
00468     bool DeleteObject(void);
00469
00470     bool CreatePen(int nPenStyle, int nWidth, UCOLORREF crColor);
00471 protected:
00472     int m_width;
00473     int m_style;
00474 #if qGTK
00475     GdkColor m_col;
00476     bool m_set;
00477 #endif
00478
00479 friend class UDC;
00480 };
00481
00482 class UBrush
00483 {
00484 public:
00485     UBrush();
00486     ~UBrush();
00487
00488     bool DeleteObject(void);
00489
00490     bool CreateSolidBrush(UCOLORREF crColor);
00491 protected:
00492 #if qGTK
00493     GdkColor m_col;
00494     bool m_set;
00495 #endif
00496
00497 friend class UDC;
00498 };
00499
00500 class UWidget;
00501
00502 class UDC
00503 {
00504 public:
00505     UDC(int widid, int cmdid);
00506     ~UDC();
00507
00508     USize GetTextExtent(const char *lpszString, int nCount) const;
00509     int GetTextHeight(void) const;
00510     bool TextOutClipped(int x, int y, const URECT *lpRect,
00511                         const char *lpszString, int nCount);
00512
00513     void MoveTo(int x, int y);
00514     void LineTo(int x, int y);
00515     bool DrawBitmap(void *bitmap, UPOINT where);
00516
00517     UPen *SelectObject(UPen* pPen);
00518     UBrush *SelectObject(UBrush* pBrush);
00519
00520     bool Rectangle(const URECT *lpRect);
00521     bool RoundRect(const URECT *lpRect, UPOINT point);
00522 protected:
00523     void *m_wid;
00524     UPen *m_pen;
00525     UBrush *m_brush;
00526 #if qGTK
00527     GdkGC *m_gc;
00528     UPoint m_penloc;
00529     GdkColor m_foreground, m_background;
00530     GdkFont *m_font;
00531     GdkDrawable *m_drawable;
00532     UPoint m_orig;
00533 #endif
00534 };
00535 #endif /* __cplusplus */
00536
00537 #endif /* UDRAW_H */
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/uevent.cpp Source File

rf/uevent.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #include "stdafx.h"
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026
00027 #if TIME_WITH_SYS_TIME
00028 # include <sys/time.h>
00029 # include <time.h>
00030 #else
00031 # if HAVE_SYS_TIME_H
00032 #  include <sys/time.h>
00033 # else
00034 #  include <time.h>
00035 # endif
00036 #endif
00037
00038 #include "umain.h"
00039 #include "uconsole.h"
00040 #include "uwidget.h"
00041
00042 #include <map>
00043
00044 #if defined(_DEBUG) && defined(WIN32)
00045 #   define new DEBUG_NEW
00046 #   undef THIS_FILE
00047     static char THIS_FILE[] = __FILE__;
00048 #endif
00049
00050 #if qMacAPP
00051 #   include "UMenuMgr.h"
00052 #   include "UCheckBox.h"
00053 #   include "URadio.h"
00054 #endif
00055
00056 #ifdef qMacPP
00057 #   include "UPseudoSupport.h"
00058 #   include <LCheckBox.h>
00059 #   include <LRadioButton.h>
00060 #   include <LEditText.h>
00061 #   include <LStaticText.h>
00062 #   include <LCheckBoxGroupBox.h>
00063 #endif
00064
00065 #ifdef WIN32
00066 #   include "PseudoButton.h"
00067 #endif
00068
00074 #define MIN_IDLE 100
00075
00076 static long sLastIdle = 0;
00077
00078 // handler to forward the tooltip (usually the status bar)
00079 extern "C"
00080 {
00081     static void (*sTooltipHandler) (const char *) = 0L;
00082 }
00083
00084 // all the framework widgets are located there
00085 class CAllTargets
00086 {
00087 public:
00088     CAllTargets() {}
00089     ~CAllTargets()
00090     {
00091         // delete the remaining widgets at exit.
00092         // we don't make a loop because the widget gets
00093         // removed from the map when calling the destructor.
00094         STD map<int, UCmdTarget *>::iterator i;
00095         while(targets.size() != 0)
00096         {
00097             i = targets.begin();
00098             delete (*i).second;
00099         }
00100     }
00101
00102     inline STD map<int, UCmdTarget *> & Get(void) { return targets; }
00103     inline const STD map<int, UCmdTarget *> & Get(void) const { return targets; }
00104 protected:
00105     STD map<int, UCmdTarget *> targets;
00106 } sAllTargets;
00107
00108 const UMSGMAP* UCmdTarget::GetBaseMessageMap()
00109     { return 0L; }
00110 const UMSGMAP* UCmdTarget::GetThisMessageMap()
00111     { return &UCmdTarget::messageMap; }
00112 const UMSGMAP* UCmdTarget::GetMessageMap() const
00113     { return &UCmdTarget::messageMap; }
00114 const UMSGMAP UCmdTarget::messageMap =
00115 { 0L, &UCmdTarget::_messageEntries[0] };
00116 const UMSGMAP_ENTRY UCmdTarget::_messageEntries[] =
00117 {
00118     {EV_NONE, epNone, UMSG_NOEXT, 0, 0, (UPMSG)0 }
00119 };
00120
00121 static bool sTurnOffDispatching = false;
00122
00123 class CTurnOffDispatching
00124 {
00125 public:
00126     CTurnOffDispatching() : m_didSetIt(false)
00127     {
00128         if(!sTurnOffDispatching)
00129         {
00130             m_didSetIt = true;
00131             sTurnOffDispatching = true;
00132         }
00133     }
00134
00135     ~CTurnOffDispatching()
00136     {
00137         if(m_didSetIt)
00138             sTurnOffDispatching = false;
00139     }
00140 protected:
00141     bool m_didSetIt;
00142 };
00143
00144 UIMPLEMENT_DYNAMIC(UCmdTarget, UObject)
00145
00146 // the message class used to post retained messages
00147 class CMsg
00148 {
00149 public:
00150     CMsg(int wid, int ev, int arg1, void *arg2) : m_wid(wid), m_ev(ev), m_arg1(arg1), m_arg2(arg2)
00151     {
00152     }
00153
00154     CMsg() : m_wid(0), m_ev(0), m_arg1(0), m_arg2(0L)
00155     {
00156     }
00157
00158     CMsg(const CMsg & msg) : m_wid(0), m_ev(0), m_arg1(0), m_arg2(0L)
00159     {
00160         *this = msg;
00161     }
00162
00163     CMsg & operator=(const CMsg & msg)
00164     {
00165         m_wid = msg.m_wid;
00166         m_ev = msg.m_ev;
00167         m_arg1 = msg.m_arg1;
00168         m_arg2 = msg.m_arg2;
00169
00170         return *this;
00171     }
00172
00173     int m_wid, m_ev, m_arg1;
00174     void *m_arg2;
00175
00176 };
00177
00178 static std::vector<CMsg> sRetainedMsgs;
00179
00180 union UMessageMapFunctions
00181 {
00182     UPMSG pfn;   // generic member function pointer
00183
00184     // specific type safe variants
00185     void(UCmdTarget::*pfnV_V)(void);
00186     void(UCmdTarget::*pfnV_VP)(void *);
00187     void(UCmdTarget::*pfnV_iVP)(int,void *);
00188     void(UCmdTarget::*pfnV_i)(int);
00189     void(UCmdTarget::*pfnV_ii)(int, int);
00190     void(UCmdTarget::*pfnV_iii)(int, int, int);
00191     void(UCmdTarget::*pfnV_iiVP)(int, int, void *);
00192     int(UCmdTarget::*pfni_ii)(int, int);
00193     int(UCmdTarget::*pfni_i)(int);
00194     int(UCmdTarget::*pfni_V)();
00195     int(UCmdTarget::*pfni_iVP)(int,void *);
00196     int(UCmdTarget::*pfni_VP)(void *);
00197 };
00198
00199 int UEventSendMessage(int wid, int/*UEventType*/ evt, int arg1, void *arg2)
00200 {
00201     if(sTurnOffDispatching)
00202         return 0;
00203
00204     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00205     STD map< int, UCmdTarget * >::const_iterator iter = targets.find(wid);
00206     int res = 0;
00207
00208     if(iter != targets.end())
00209     {
00210         UCmdTarget *target = (*iter).second;
00211         UCmdTarget::UDispatchInfo dispatchInfo = UCmdTarget::kUNoDispatchInfo;
00212 #if qDebug
00213         try {
00214 #endif
00215         res = target->UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00216 #if qDebug
00217         } catch(...) {
00218             UASSERT(0);
00219             throw;
00220         }
00221 #endif
00222     }
00223     else
00224     {
00225         UAppConsole("Unknown widget id : %d\n", wid);
00226     }
00227
00228     return res;
00229 }
00230
00231 int UEventSendMessageExt(int wid, int/*UEventType*/ evt, int arg1, void *arg2, int * handledFlag)
00232 {
00233     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00234     STD map< int, UCmdTarget * >::const_iterator iter = targets.find(wid);
00235     int res = 0;
00236     UCmdTarget::UDispatchInfo dispatchInfo = UCmdTarget::kUNoDispatchInfo;
00237
00238     if(iter != targets.end())
00239     {
00240         UCmdTarget *target = (*iter).second;
00241 #if qDebug
00242         try {
00243 #endif
00244         res = target->UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00245 #if qDebug
00246         } catch(...) {
00247             UASSERT(0);
00248             throw;
00249         }
00250 #endif
00251     }
00252     else
00253     {
00254         UAppConsole("Unknown widget id : %d\n", wid);
00255     }
00256
00257     *handledFlag = (dispatchInfo & UCmdTarget::kUDispatchHandled) != 0;
00258     return res;
00259 }
00260
00261 // for the retained messages
00262 int UEventPostMessage(int wid, int/*UEventType*/ evt, int arg1, void *arg2)
00263 {
00264     sRetainedMsgs.push_back(CMsg(wid, evt, arg1, arg2));
00265     return 0;
00266 }
00267
00268 // a notify message get broadcasted to every in the map.
00269 int UEventNotifyMessage(int/*UEventType*/ evt, int arg1, void *arg2)
00270 {
00271     STD map< int, UCmdTarget * >::const_iterator iter;
00272     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00273     int res = 0;
00274
00275     for(iter = targets.begin(); iter != targets.end(); ++iter)
00276     {
00277         UCmdTarget *target = (*iter).second;
00278         UCmdTarget::UDispatchInfo dispatchInfo = UCmdTarget::kUNoDispatchInfo;
00279 #if qDebug
00280         try {
00281 #endif
00282         res = target->UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00283 #if qDebug
00284         } catch(...) {
00285             UASSERT(0);
00286             throw;
00287         }
00288 #endif
00289         if(res)
00290             break;
00291     }
00292
00293     return res;
00294 }
00295
00296 int UEventGetWidID(void)
00297 {
00298     static int newid = 100;
00299     return newid++;
00300 }
00301
00302 UCmdTarget *UEventQueryWidget(int widid)
00303 {
00304     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00305     STD map< int, UCmdTarget * >::const_iterator iter = targets.find(widid);
00306     if(iter != targets.end())
00307     {
00308         UCmdTarget *target = (*iter).second;
00309         return target;
00310     }
00311     return 0L;
00312 }
00313
00314 void UEventRemoveWidID(int widid)
00315 {
00316     STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00317     STD map<int, UCmdTarget *>::iterator i = targets.find(widid);
00318     if(i == targets.end())
00319         return;
00320     targets.erase(i);
00321 }
00322
00323 int UCmdTarget::UDispatchMessage(int/*UEventType*/ evt, int arg1, void *arg2, UDispatchInfo & dispatchInfo)
00324 {
00325     const UMSGMAP* themap;
00326     const UMSGMAP_ENTRY *entries;
00327     for(themap = GetMessageMap(); themap != 0L; themap = themap->pBaseMap)
00328     {
00329         entries = themap->lpEntries;
00330         while(entries->nMessage != EV_NONE)
00331         {
00332             if(entries->ext == UMSG_RANGE)
00333             {
00334                 int cmd = (unsigned short)ULOWORD(arg1);
00335                 if(evt == entries->nMessage &&
00336                     cmd >= entries->ext1 &&
00337                     cmd <= entries->ext2)
00338                         goto dispatch;
00339             }
00340             else if(entries->nMessage == evt)
00341                 goto dispatch;
00342             entries++;
00343         }
00344     }
00345     return 0;
00346
00347 dispatch:
00348     union UMessageMapFunctions mmf;
00349     mmf.pfn = entries->pfn;
00350     int res = 0;
00351
00352     dispatchInfo = UDispatchInfo((int)dispatchInfo | UCmdTarget::kUDispatchHandled);
00353
00354     switch(entries->nSig)
00355     {
00356     case epV_V:
00357         (this->*mmf.pfnV_V)();
00358         break;
00359     case epV_VP:
00360         (this->*mmf.pfnV_VP)(arg2);
00361         break;
00362     case epV_iVP:
00363         (this->*mmf.pfnV_iVP)(arg1, arg2);
00364         break;
00365     case epV_IVP:
00366         (this->*mmf.pfnV_iVP)(UHIWORD(arg1), arg2);
00367         break;
00368     case epV_i:
00369         (this->*mmf.pfnV_i)(arg1);
00370         break;
00371     case epV_I:
00372         (this->*mmf.pfnV_i)(UHIWORD(arg1));
00373         break;
00374     case epV_ii:
00375         (this->*mmf.pfnV_ii)(ULOWORD(arg1), UHIWORD(arg1));
00376         break;
00377     case epV_iii:
00378         (this->*mmf.pfnV_iii)(ULOWORD(arg1), UHIWORD(arg1), (int)arg2);
00379         break;
00380     case epV_iiVP:
00381         (this->*mmf.pfnV_iiVP)(ULOWORD(arg1), UHIWORD(arg1), arg2);
00382         break;
00383     case epi_ii:
00384         res = (this->*mmf.pfni_ii)(ULOWORD(arg1), UHIWORD(arg1));
00385         break;
00386     case epi_i:
00387         res = (this->*mmf.pfni_i)(arg1);
00388         break;
00389     case epi_V:
00390         res = (this->*mmf.pfni_V)();
00391         break;
00392     case epi_iVP:
00393         res = (this->*mmf.pfni_iVP)(arg1, arg2);
00394         break;
00395     case epi_VP:
00396         res = (this->*mmf.pfni_VP)(arg2);
00397         break;
00398     default:
00399         UAppConsole("Unknown event cast : %d\n", entries->nSig);
00400         break;
00401     }
00402
00403     return res;
00404 }
00405
00406 UCmdTarget::UCmdTarget(int widid) : m_widid(widid)
00407 {
00408     std::map<int, UCmdTarget *>::value_type val(widid, this);
00409     sAllTargets.Get().insert(val);
00410 }
00411
00412 UCmdTarget::~UCmdTarget()
00413 {
00414     UEventRemoveWidID(m_widid);
00415 }
00416
00417 void UCmdUI::Enable(bool bOn)
00418 {
00419     m_continue = false;
00420
00421 #ifdef qMacAPP
00422     if((long)m_widget <= 2L)
00423     {
00424         // this is a menu
00425         ::Enable(m_nID, bOn);
00426         m_widget = (void *)(bOn ? 1L : 2L);
00427             // see UCmdUI::Check
00428     }
00429     else
00430     {
00431         TView *view = (TView *)m_widget;
00432         if(MA_MEMBER(view, TView))
00433         {
00434             view->SetActiveState(bOn, kRedraw);
00435         }
00436     }
00437 #endif
00438 #ifdef qMacPP
00439     if(m_wrapper != 0L)
00440     {
00441         // this is a menu
00442         *m_wrapper->outEnabled = bOn;
00443     }
00444     else
00445     {
00446         LPane *view = (LPane *)m_widget;
00447         if(view != 0L)
00448         {
00449             if(bOn)
00450                 view->Enable();
00451             else
00452                 view->Disable();
00453         }
00454     }
00455 #endif
00456 #ifdef WIN32
00457     if(pCmdUI != 0L)
00458     {
00459         // this is a menu
00460         pCmdUI->Enable(bOn);
00461     }
00462     else if(m_widget)
00463     {
00464         // this something else
00465         CWnd *wid = (CWnd *)m_widget;
00466         BOOL state = bOn;
00467         if(state != wid->IsWindowEnabled())
00468             wid->EnableWindow(state);
00469     }
00470 #endif
00471 #ifdef qGTK
00472     if(m_widget != 0L)
00473     {
00474         if(GTK_IS_WIDGET(m_widget))
00475         {
00476             gtk_widget_set_sensitive(GTK_WIDGET(m_widget), bOn);
00477         }
00478     }
00479 #endif
00480 }
00481
00482 void UCmdUI::Check(bool bOn)
00483 {
00484     m_continue = false;
00485
00486 #ifdef qMacAPP
00487     if((long)m_widget <= 2L)
00488     {
00489         // this is a menu
00490         if(m_widget == 0L)
00491         {
00492             UASSERT("You need to call UCmdUI::Enable before UCmdUI::Check !\n");
00493         }
00494         else
00495         {
00496             ::EnableCheck(m_nID, m_widget == (void *)1L, bOn);
00497         }
00498     }
00499     else
00500     {
00501         TView *view = (TView *)m_widget;
00502         if(MA_MEMBER(view, TCheckBox))
00503         {
00504             ((TCheckBox *)view)->SetState(bOn, kRedraw);
00505         }
00506         else if(MA_MEMBER(view, TRadio))
00507         {
00508             ((TRadio *)view)->SetState(bOn, kRedraw);
00509         }
00510     }
00511 #endif
00512 #ifdef qMacPP
00513     if(m_wrapper != 0L)
00514     {
00515         // this is a menu
00516         *m_wrapper->outUsesMark = true;
00517         *m_wrapper->outMark = bOn ? checkMark : noMark;
00518     }
00519     else
00520     {
00521         LPane *view = (LPane *)m_widget;
00522         if(dynamic_cast<LCheckBox*>(view) != 0L ||
00523             dynamic_cast<LRadioButton*>(view) != 0L ||
00524             dynamic_cast<LCheckBoxGroupBox*>(view) != 0L ||
00525             dynamic_cast<LBevelButton*>(view) != 0L)
00526         {
00527             USemaphore policeman(gTurnOffBroadcast);
00528
00529             view->SetValue(bOn ? Button_On : Button_Off);
00530         }
00531     }
00532 #endif
00533 #ifdef WIN32
00534     if(pCmdUI != 0L)
00535     {
00536         // this is a menu
00537         pCmdUI->SetCheck(bOn ? 1 : 0);
00538     }
00539     else if(m_widget)
00540     {
00541         CWnd *wnd = (CWnd *)m_widget;
00542         if(wnd->IsKindOf(RUNTIME_CLASS(CPseudoToggle)))
00543         {
00544             CPseudoToggle *btn = (CPseudoToggle *)wnd;
00545             btn->SetState(bOn);
00546         }
00547         else if(wnd->IsKindOf(RUNTIME_CLASS(CButton)))
00548         {
00549             CButton *btn = (CButton *)wnd;
00550             btn->SetCheck(bOn ? BST_CHECKED : BST_UNCHECKED);
00551         }
00552     }
00553 #endif
00554 #ifdef qGTK
00555     if(m_widget != 0L)
00556     {
00557         if(GTK_IS_TOGGLE_BUTTON(m_widget))
00558         {
00559             CTurnOffDispatching turnOff;
00560             gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), bOn);
00561         }
00562     }
00563 #endif
00564 }
00565
00566 void UCmdUI::SetText(const char *title)
00567 {
00568     m_continue = false;
00569
00570 #ifdef qMacAPP
00571     if((long)m_widget <= 2L)
00572     {
00573         // this is a menu
00574         CStr255_AC pstr(title);
00575         SetCommandName(m_nID, pstr);
00576     }
00577     else
00578     {
00579         TCtlMgr *view = (TCtlMgr *)m_widget;
00580         if(MA_MEMBER(view, TCtlMgr))
00581         {
00582             view->SetText(CStr255_AC(title), kRedraw);
00583         }
00584     }
00585 #endif
00586 #ifdef qGTK
00587     if(m_widget != 0L)
00588     {
00589         if(GTK_IS_TOGGLE_BUTTON(m_widget))
00590         {
00591             GtkLabel *label = getLabelFromContainer(GTK_CONTAINER(m_widget));
00592             if(label != 0L)
00593                 gtk_label_set_text(label, title);
00594         }
00595     }
00596 #endif
00597 #ifdef qMacPP
00598     if(m_wrapper != 0L)
00599     {
00600         // this is a menu
00601         LStr255 pstr(title);
00602         LString::CopyPStr(pstr, m_wrapper->outName);
00603     }
00604     else
00605     {
00606         LPane *view = (LPane *)m_widget;
00607         LEditText *edit;
00608         LStaticText *stat;
00609         if((edit = dynamic_cast<LEditText*>(view)) != 0L)
00610         {
00611             edit->SetText((Ptr)title, strlen(title));
00612         }
00613         else if((stat = dynamic_cast<LStaticText*>(view)) != 0L)
00614         {
00615             stat->SetText((Ptr)title, strlen(title));
00616         }
00617     }
00618 #endif
00619 #ifdef WIN32
00620     if(pCmdUI != 0L)
00621     {
00622         // this is a menu
00623         if(title != 0L && *title != '\0')
00624             pCmdUI->SetText(title);
00625     }
00626 #endif
00627 }
00628
00629 void UCmdUI::SetTooltip(const char *tooltip)
00630 {
00631     if(tooltip == 0L)
00632         return;
00633
00634     char status[256] = {'\0'};
00635     char prompt[256] = {'\0'};
00636
00637     strcpy(status, tooltip);
00638     char *cr = strchr(status, '\n');
00639     if(cr != 0L)
00640     {
00641         strcpy(prompt, cr + 1);
00642         *cr = '\0';
00643     }
00644 #ifdef WIN32
00645 #   define _countof(array) (sizeof(array)/sizeof(array[0]))
00646     NMHDR *hdr = (NMHDR *)pNMHDR;
00647     ASSERT(hdr->code == TTN_NEEDTEXTA || hdr->code == TTN_NEEDTEXTW);
00648
00649     TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)hdr;
00650     TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)hdr;
00651 #   ifndef _UNICODE
00652     if (hdr->code == TTN_NEEDTEXTA)
00653         lstrcpyn(pTTTA->szText, prompt, _countof(pTTTA->szText));
00654     else
00655         _mbstowcsz(pTTTW->szText, prompt, _countof(pTTTW->szText));
00656 #   else
00657     if (hdr->code == TTN_NEEDTEXTA)
00658         _wcstombsz(pTTTA->szText, prompt, _countof(pTTTA->szText));
00659     else
00660         lstrcpyn(pTTTW->szText, prompt, _countof(pTTTW->szText));
00661 #   endif
00662 #endif
00663
00664     if(sTooltipHandler != 0L)
00665         sTooltipHandler(status);
00666 }
00667
00668 void UEventSetTooltipHandler(void (*handler) (const char *))
00669 {
00670     sTooltipHandler = handler;
00671 }
00672
00673 void UEventGiveTime(void)
00674 {
00675     STD map< int, UCmdTarget * >::const_iterator iter;
00676     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00677
00678     // post the retained events
00679     while(!sRetainedMsgs.empty())
00680     {
00681         CMsg msg = *sRetainedMsgs.begin();
00682         sRetainedMsgs.erase(sRetainedMsgs.begin());
00683         UEventSendMessage(msg.m_wid, msg.m_ev, msg.m_arg1, msg.m_arg2);
00684     }
00685
00686     // take care about the EV_UPDATEUI notification
00687     if(!UWidget::IsUIValid())
00688     {
00689         UWidget::DoValidUI(true);
00690
00691         // warn the widget it's going to happen so they can cache
00692         // some informations.
00693         for(iter = targets.begin(); iter != targets.end(); ++iter)
00694         {
00695             UCmdTarget *target = (*iter).second;
00696             if(!target->IsKindOf(URUNTIME_CLASS(UWidget)))
00697                 continue;
00698
00699             UWidget *wid = (UWidget *)target;
00700             wid->BeforeUpdateUI();
00701         }
00702
00703         for(iter = targets.begin(); iter != targets.end(); ++iter)
00704         {
00705             UCmdTarget *target = (*iter).second;
00706             if(!target->IsKindOf(URUNTIME_CLASS(UWidget)))
00707                 continue;
00708
00709             UWidget *wid = (UWidget *)target;
00710             UEventSendMessage(wid->GetWidID(), EV_UPDATEUI, 0, 0L);
00711         }
00712     }
00713
00714     long thisIdle = UTickCount();
00715     if((thisIdle - sLastIdle) < MIN_IDLE)
00716         return;
00717
00718     // search the timers
00719     for(iter = targets.begin(); iter != targets.end(); ++iter)
00720     {
00721         UCmdTarget *target = (*iter).second;
00722         if(!target->IsKindOf(URUNTIME_CLASS(UWidget)))
00723             continue;
00724
00725         UWidget *wid = (UWidget *)target;
00726         std::vector<UTimer> & timers = wid->GetTimers();
00727         std::vector<UTimer>::iterator t;
00728         for(t = timers.begin(); t != timers.end(); ++t)
00729         {
00730             UTimer & timer = *t;
00731             if((thisIdle - timer.m_lastlap) >= timer.m_lap)
00732             {
00733                 // trigger the timer
00734                 timer.m_lastlap = thisIdle;
00735                 UEventSendMessage(wid->GetWidID(), EV_TIMER, timer.m_cmd, (void *)thisIdle);
00736             }
00737         }
00738     }
00739
00740     sLastIdle = thisIdle;
00741 }
00742
00743 long UTickCount(void)
00744 {
00745 #ifdef WIN32
00746     return ::GetTickCount();
00747 #elif defined(macintosh)
00748     long res = ::TickCount();
00749     return res = (float)res * (1000.0 / 60.0);
00750 #else
00751     struct timeval tval;
00752     static long refcount;
00753
00754     gettimeofday(&tval, 0L);
00755
00756     if(refcount == 0)
00757         refcount = tval.tv_sec;
00758
00759     return (tval.tv_sec - refcount) * 1000 + tval.tv_usec / 1000;
00760 #endif
00761 }
00762
00763 const STD map<int, UCmdTarget *> & UEventGetTargets(void)
00764 {
00765     return sAllTargets.Get();
00766 }
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/umain.h Source File

rf/umain.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #ifndef UEVENT_H
00022 #define UEVENT_H
00023
00024 #include "uobject.h"
00025
00026 /*
00027  * The routing of the messages is copied from the MFC scheme :
00028  * A message has a sort of "prototype" associated with it and
00029  * is dispatched using a virtual message map : the message goes
00030  * to the child first, then get up to the parents if it was not handled.
00031  */
00032
00033 typedef enum
00034 {
00035     EV_NONE,
00036
00037     /* system events */
00038     EV_CREATE,      /* void OnCreate(void) */
00039     EV_DESTROY,     /* void OnDestroy(void) */
00040     EV_ENTER,       /* void OnEnter(void *data) */
00041     EV_LEAVE,       /* void OnLeave(void) */
00042     EV_EXPOSE,      /* void OnExpose(void) */
00043     EV_MMOVE,       /* void OnMouseMove(int x, int y, int mod) */
00044     EV_BTNDOWN,     /* void OnBtnDown(int x, int y, int mod) */
00045     EV_BTNUP,       /* void OnBtnUp(int x, int y, int mod) */
00046     EV_BTNDBLDOWN,  /* void OnBtnDblDown(int x, int y, int mod) */
00047     EV_KEYDOWN,     /* void OnKeyDown(int c) */
00048     EV_SETCURSOR,   /* void OnSetCursor(void) */
00049     EV_CHGCURSOR,   /* void OnChgCursor(int cmd, UCURSOR cursor) */
00050     EV_RESIZE,      /* void OnResize(const URECT * r) */
00051     EV_GETLOC,      /* void OnGetLoc<Cmd>(int cmd, URECT *) */
00052     EV_SETLOC,      /* void OnSetLoc<Cmd>(int cmd, const URECT *) */
00053
00054     /* generic */
00055     EV_CMD,         /* int On<Cmd>(void) */
00056     EV_UPDTCMD,     /* void OnUpdate<Cmd>(UCmdUI *pCmdUI) */
00057     EV_ENABLECMD,   /* void OnEnableCmd<Cmd>(int cmd, int enabled) */
00058     EV_FETCHCMD,    /* int OnFetchCmd(int cmd, void *widget) */
00059     EV_SETTOOLTIP,  /* void OnSetTooltip<Cmd>(int cmd, UCmdUI *pCmdUI) */
00060     EV_QUERYSTATE,  /* int OnQueryState<Cmd>(int cmd) */
00061     EV_GETINTEGER = EV_QUERYSTATE,
00062     EV_SETSTATE,    /* void OnSetState<Cmd>(int cmd, int state) */
00063     EV_SETINTEGER = EV_SETSTATE,
00064     EV_CHGFOCUS,    /* void OnChgFocus(int cmd) */
00065     EV_INVALIDATE,  /* void OnInvalidate(int cmd) */
00066     EV_REDRAW,      /* void OnRedraw(int cmd) */
00067     EV_GETTEXT,     /* void OnGetText(int cmd, UStr *text); */
00068     EV_SETTEXT,     /* void OnSetText(int cmd, const char *text); */
00069     EV_GETFLOAT,    /* void OnGetFloat(int cmd, float *f); */
00070     EV_SETFLOAT,    /* void OnSetFloat(int cmd, const float *f); */
00071     EV_INIT_WIDGET, /* void OnInitWidget(int cmd, void *widget); */
00072     EV_INIT_TAB_WIDGET, /* void OnInitTabWidget(int cmd, int page, void *widget); */
00073     EV_SHOW_WIDGET, /* void OnShowWidget<Cmd>(int cmd, int state) */
00074     EV_PAGE_CHANGED,    /* void OnPageChanged<Cmd>(int cmd, int pagenum) */
00075
00076     /* notifying */
00077     EV_NOTIFY,          /* void OnNotify<Cmd>(void) */
00078     EV_EDITCHANGE,      /* void OnEditChange<Cmd>(void) */
00079     EV_EDITACTIVATE,    /* void OnEditActivate<Cmd>(void) */
00080     EV_TIMER,           /* void OnTimer<Cmd>(long time) */
00081     EV_UPDATEUI,        /* void OnUpdateUI(void) */
00082     EV_UPDATEFOCUS,     /* int OnUpdateFocus(int leave, void *widget) */
00083
00084     /* drag'n drop */
00085     EV_DRAGQUERY,       /* void OnDragQuery<Cmd>(UDragable *) */
00086     EV_DROPQUERY,       /* void OnDropQuery<Cmd>(UDropable **) */
00087     EV_DROPIT,          /* void OnDropIt<Cmd>(const UDragable *) */
00088     EV_DROPQUERY_CMDID, /* void OnDropQueryCmdID<Cmd>(int x, int y, int *cmdid) */
00089     EV_DROPREF,     /* void OnDropRef<Cmd>(int cmd, int nbref, long *ref) */
00090
00091     /* toolbar manager */
00092     EV_TB_INIT,         /* void OnTbInit(UTB_INIT *info) */
00093     EV_TB_END,          /* void OnTbEnd(void) */
00094     EV_TB_BUTTON,       /* void OnTbButton(UTB_BUTTON *info) */
00095     EV_TB_DROPDOWN,     /* void OnTbDropDown(UTB_DROPDOWN *info) */
00096     EV_TB_CHECKBTN,     /* void OnTbCheckBtn(UTB_BUTTON *info) */
00097     EV_TB_SEPARATOR,    /* void OnTbSeparator(void) */
00098     EV_TB_GETCOLOR,     /* void OnTbGetColor(int cmd, float *color) */
00099
00100     /* slider */
00101     EV_SET_SLIDER,      /* void OnSetSlider(int cmd, int pos) */
00102     EV_GET_SLIDERPROP,  /* void OnGetSliderProperty(int cmd, USLIDER *prop) */
00103     EV_SET_SLIDERPROP,  /* void OnSetSliderProperty(int cmd, const USLIDER *prop) */
00104     EV_SCROLLCHANGE,    /* void OnScrollChange<Cmd>(int pos) */
00105
00106     /* custom drawing */
00107     EV_CUSTOM_DRAW,     /* void OnCustomDraw<Cmd>(void *drawInfo) */
00108
00109     /* tree */
00110     EV_TREE_RESETALL,   /* void OnTreeResetAll(int cmd) */
00111     EV_TREE_INSERT,     /* void OnTreeInsert(int cmd, UTREE_INSERT *data) */
00112     EV_TREE_GETINFO,    /* void OnTreeGetInfo(int cmd, UTREE_INFO *data) */
00113     EV_TREE_SETDATA,    /* void OnTreeSetData(int cmd, UTREE_INFO *data) */
00114     EV_TREE_SETICON,    /* void OnTreeSetIcon(int cmd, UTREE_INFO *data) */
00115     EV_TREE_DELETE,     /* void OnTreeDelete(int cmd, UTREEITEM item) */
00116     EV_TREE_EXPANDING,  /* void OnTreeExpanding<cmd>(int collapse, UTREEITEM item) */
00117     EV_TREE_SELECTING,  /* void OnTreeSelecting<cmd>(int deselecting, UTREEITEM item) */
00118     EV_TREE_EXPAND,     /* void OnTreeExpand(int cmd, int collapse, UTREEITEM item) */
00119     EV_TREE_SELECT,     /* void OnTreeSelect(int cmd, int deselect, UTREEITEM item) */
00120     EV_TREE_GETSEL,     /* void OnTreeGetSel(int cmd, UTREEITEM *item) */
00121
00122     /* list */
00123     EV_LIST_SELECTING,      /* void OnListChange<Cmd>(int entry, const char *txt) */
00124     EV_LIST_SELCOLUMN,      /* void OnListSelColumn<Cmd>(int entry) */
00125     EV_LIST_RESORT,         /* void OnListResort(int cmd, int column, UListSorter s) */
00126     EV_LIST_DBLCLICK,       /* void OnListDblClick<Cmd>(void) */
00127     EV_LIST_RESETALL,       /* void OnListResetAll(int cmd) */
00128     EV_LIST_SETFEEDBACK,    /* void OnListSetFeedback(int cmd, int turnOn) */
00129     EV_LIST_ADDCOLUMNS,     /* void OnListAddColumns(int cmd, int num) */
00130     EV_LIST_SETCOLTITLE,    /* void OnListSetColTitle(int cmd, int num, const char *title) */
00131     EV_LIST_SETCOLWIDTH,    /* void OnListSetColWidth(int cmd, int num, int width) */
00132     EV_LIST_NEWROW,         /* void OnListNewRow(int cmd, int *num) */
00133     EV_LIST_ROWSETDATA,     /* void OnListRowSetData(int cmd, int row, void *data) */
00134     EV_LIST_ROWGETDATA,     /* void OnListRowGetData(int cmd, int row, void **data) */
00135     EV_LIST_INSERT,         /* void OnListInsert(int cmd, ULIST_INSERT *data) */
00136     EV_LIST_ADDSEL,         /* void OnListAddSel(int cmd, int entry) */
00137     EV_LIST_DELROW,         /* void OnListDelRow(int cmd, int row) */
00138     EV_LIST_GETNEXTSEL,     /* int OnListGetNextSel(int cmd, int selectedCell) */
00139     EV_LIST_GETINFO,        /* void OnListGetInfo(int cmd, ULIST_INFO *data) */
00140     EV_LIST_GETNEXT,        /* int OnListGetNext(int cmd, int whichCell) */
00141
00142     /* combo */
00143     EV_COMBO_RESETALL,  /* void OnComboResetAll(int cmd) */
00144     EV_COMBO_APPEND,    /* void OnComboAppend(int cmd, const char *str) */
00145     EV_COMBO_SETSEL,    /* void OnComboSetPos(int cmd, int pos) */
00146     EV_COMBO_GETSEL,    /* int OnComboGetPos(int cmd, UStr *txt) */
00147     EV_COMBO_SEL,       /* void OnComboSel<Cmd>(int pos, const char *txt) */
00148     EV_COMBO_GETCOUNT,  /* int OnComboGetCount(int cmd) */
00149     EV_COMBO_DELSEL,    /* void OnComboDelSel(int cmd, int pos) */
00150     EV_COMBO_ENABLESEL, /* void OnComboEnableSel(int cmd, int pos, int state) */
00151     EV_COMBO_GETMENU,   /* void OnComboGetMenu(int cmd, UMENU *menu) */
00152
00153     /* user defined */
00154     EV_COMMAND_START = 1000
00155 } UEventType;
00156
00157 #ifdef __cplusplus
00158
00159 #ifndef STD
00160 #   define STD std::
00161 #endif
00162
00163 class UCmdTarget;
00164 class UWidget;
00165 class UDragable;
00166 class UDropable;
00167
00168 typedef void (UCmdTarget::*UPMSG)(void);
00169
00170 #define ON_UCREATE(baseClass) \
00171     { EV_CREATE, epV_V, UMSG_NOEXT, 0, 0, \
00172         (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnCreate },
00173
00174 #define ON_UDESTROY(baseClass) \
00175     { EV_DESTROY, epV_V, UMSG_NOEXT, 0, 0, \
00176         (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnDestroy },
00177
00178 #define ON_UENTER(baseClass) \
00179     { EV_ENTER, epV_VP, UMSG_NOEXT, 0, 0, \
00180         (UPMSG)(void (UCmdTarget::*)(void *))&baseClass::OnEnter },
00181
00182 #define ON_ULEAVE(baseClass) \
00183     { EV_LEAVE, epV_V, UMSG_NOEXT, 0, 0, \
00184         (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnLeave },
00185
00186 #define ON_UEXPOSE(baseClass) \
00187     { EV_EXPOSE, epV_V, UMSG_NOEXT, 0, 0, \
00188         (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnExpose },
00189
00190 #define ON_UMMOVE(baseClass) \
00191     { EV_MMOVE, epV_iii, UMSG_NOEXT, 0, 0, \
00192         (UPMSG)(void (UCmdTarget::*)(int x, int y, int mod))&baseClass::OnMouseMove },
00193
00194 #define ON_UBTNDOWN(baseClass) \
00195     { EV_BTNDOWN, epV_iii, UMSG_NOEXT, 0, 0, \
00196         (UPMSG)(void (UCmdTarget::*)(int x, int y, int mod))&baseClass::OnBtnDown },
00197
00198 #define ON_UBTNUP(baseClass) \
00199     { EV_BTNUP, epV_iii, UMSG_NOEXT, 0, 0, \
00200         (UPMSG)(void (UCmdTarget::*)(int x, int y, int mod))&baseClass::OnBtnUp },
00201
00202 #define ON_UBTNDBLDOWN(baseClass) \
00203     { EV_BTNDBLDOWN, epV_iii, UMSG_NOEXT, 0, 0, \
00204         (UPMSG)(void (UCmdTarget::*)(int x, int y, int mod))&baseClass::OnBtnDblDown },
00205
00206 #define ON_KEYDOWN(baseClass) \
00207     { EV_KEYDOWN, epV_i, UMSG_NOEXT, 0, 0, \
00208         (UPMSG)(void (UCmdTarget::*)(int c))&baseClass::OnKeyDown },
00209
00210 #define ON_RESIZE(cmd, hook) \
00211     { EV_RESIZE, epV_VP, UMSG_RANGE, cmd, cmd, \
00212         (UPMSG)(void (UCmdTarget::*)(const URECT * r))&hook },
00213
00214 #define ON_SETCURSOR(baseClass) \
00215     { EV_SETCURSOR, epV_V, UMSG_NOEXT, 0, 0, \
00216         (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnSetCursor },
00217
00218 #define ON_CHGCURSOR(baseClass, cmdmin, cmdmax) \
00219     { EV_CHGCURSOR, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
00220         (UPMSG)(void (UCmdTarget::*)(int cmd, UCURSOR cursor))&baseClass::OnChgCursor },
00221
00222 #define ON_TB_INIT(baseClass) \
00223     { EV_TB_INIT, epV_VP, UMSG_NOEXT, 0, 0, \
00224         (UPMSG)(void (UCmdTarget::*)(UTB_INIT *info))&baseClass::OnTbInit },
00225
00226 #define ON_TB_END(baseClass) \
00227     { EV_TB_END, epV_V, UMSG_NOEXT, 0, 0, \
00228         (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnTbEnd },
00229
00230 #define ON_TB_BUTTON(baseClass) \
00231     { EV_TB_BUTTON, epV_VP, UMSG_NOEXT, 0, 0, \
00232         (UPMSG)(void (UCmdTarget::*)(UTB_BUTTON *info))&baseClass::OnTbButton },
00233
00234 #define ON_TB_DROPDOWN(baseClass) \
00235     { EV_TB_DROPDOWN, epV_VP, UMSG_NOEXT, 0, 0, \
00236         (UPMSG)(void (UCmdTarget::*)(UTB_DROPDOWN *info))&baseClass::OnTbDropDown },
00237
00238 #define ON_TB_CHECKBTN(baseClass) \
00239     { EV_TB_CHECKBTN, epV_VP, UMSG_NOEXT, 0, 0, \
00240         (UPMSG)(void (UCmdTarget::*)(UTB_BUTTON *info))&baseClass::OnTbCheckBtn },
00241
00242 #define ON_TB_GETCOLOR(baseClass) \
00243     { EV_TB_GETCOLOR, epV_iVP, UMSG_NOEXT, 0, 0, \
00244         (UPMSG)(void (UCmdTarget::*)(int cmd, float *color))&baseClass::OnTbGetColor },
00245
00246 #define ON_TB_SEPARATOR(baseClass) \
00247     { EV_TB_SEPARATOR, epV_V, UMSG_NOEXT, 0, 0, \
00248         (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnTbSeparator },
00249
00250 #define ON_UCOMMAND(cmd, hook) \
00251     { EV_CMD, epi_V, UMSG_RANGE, cmd, cmd, \
00252         (UPMSG)(int (UCmdTarget::*)(void))&hook },
00253
00254 #define ON_UCOMMAND_RANGE(cmdmin, cmdmax, hook) \
00255     { EV_CMD, epi_i, UMSG_RANGE, cmdmin, cmdmax, \
00256         (UPMSG)(int (UCmdTarget::*)(int cmd))&hook },
00257
00258 #define ON_UCOMMAND_RANGEEX(cmdmin, cmdmax, hook) \
00259     { EV_CMD, epi_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00260         (UPMSG)(int (UCmdTarget::*)(int cmd, void *data))&hook },
00261
00262 #define ON_UUPDATECMD(cmd, hook) \
00263     { EV_UPDTCMD, epV_VP, UMSG_RANGE, cmd, cmd, \
00264         (UPMSG)(void (UCmdTarget::*)(UCmdUI *pCmdUI))&hook },
00265
00266 #define ON_FETCHCMD(baseClass, cmdmin, cmdmax) \
00267     { EV_FETCHCMD, epi_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00268         (UPMSG)(int (UCmdTarget::*)(int cmd, void *widget))&baseClass::OnFetchCmd },
00269
00270 #define ON_UUPDATECMD_RANGE(cmdmin, cmdmax, hook) \
00271     { EV_UPDTCMD, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00272         (UPMSG)(void (UCmdTarget::*)(int cmd, UCmdUI *pCmdUI))&hook },
00273
00274 #define ON_USETTOOLTIP(cmdmin, cmdmax, hook) \
00275     { EV_SETTOOLTIP, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00276         (UPMSG)(void (UCmdTarget::*)(int cmd, UCmdUI *pCmdUI))&hook },
00277
00278 #define ON_UGETLLOC(cmdmin, cmdmax, hook) \
00279     { EV_GETLOC, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00280         (UPMSG)(void (UCmdTarget::*)(int cmd, URECT *r))&hook },
00281
00282 #define ON_USETLLOC(cmdmin, cmdmax, hook) \
00283     { EV_SETLOC, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00284         (UPMSG)(void (UCmdTarget::*)(int cmd, const URECT *r))&hook },
00285
00286 #define ON_QUERYSTATE(cmdmin, cmdmax, hook) \
00287     { EV_QUERYSTATE, epi_i, UMSG_RANGE, cmdmin, cmdmax, \
00288         (UPMSG)(int (UCmdTarget::*)(int cmd))&hook },
00289
00290 #define ON_EDITCHANGE(cmd, hook) \
00291     { EV_EDITCHANGE, epV_V, UMSG_RANGE, cmd, cmd, \
00292         (UPMSG)(void (UCmdTarget::*)(void))&hook },
00293
00294 #define ON_EDITCHANGE_RANGE(cmdmin, cmdmax, hook) \
00295     { EV_EDITCHANGE, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
00296         (UPMSG)(void (UCmdTarget::*)(int cmd))&hook },
00297
00298 #define ON_EDITACTIVATE(cmd, hook) \
00299     { EV_EDITACTIVATE, epV_V, UMSG_RANGE, cmd, cmd, \
00300         (UPMSG)(void (UCmdTarget::*)(void))&hook },
00301
00302 #define ON_EDITACTIVATE_RANGE(cmdmin, cmdmax, hook) \
00303     { EV_EDITACTIVATE, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
00304         (UPMSG)(void (UCmdTarget::*)(int cmd))&hook },
00305
00306 #define ON_SCROLLCHANGE(cmd, hook) \
00307     { EV_SCROLLCHANGE, epV_VP, UMSG_RANGE, cmd, cmd, \
00308         (UPMSG)(void (UCmdTarget::*)(int pos))&hook },
00309
00310 #define ON_SCROLLCHANGE_RANGE(cmdmin, cmdmax, hook) \
00311     { EV_SCROLLCHANGE, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00312         (UPMSG)(void (UCmdTarget::*)(int cmd, int pos))&hook },
00313
00314 #define ON_TIMER(cmd, hook) \
00315     { EV_TIMER, epV_VP, UMSG_RANGE, cmd, cmd, \
00316         (UPMSG)(void (UCmdTarget::*)(long time))&hook },
00317
00318 #define ON_UPDATEUI(baseClass) \
00319     { EV_UPDATEUI, epV_V, UMSG_NOEXT, 0, 0, \
00320         (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnUpdateUI },
00321
00322 #define ON_UPDATEFOCUS(baseClass) \
00323     { EV_UPDATEFOCUS, epi_iVP, UMSG_NOEXT, 0, 0, \
00324         (UPMSG)(int (UCmdTarget::*)(int leave, void *widget))&baseClass::OnUpdateFocus },
00325
00326 #define ON_SETSTATE(cmdmin, cmdmax, hook) \
00327     { EV_SETSTATE, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
00328         (UPMSG)(void (UCmdTarget::*)(int cmd, int state))&hook },
00329
00330 #define ON_ENABLECMD(cmdmin, cmdmax, hook) \
00331     { EV_ENABLECMD, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
00332         (UPMSG)(void (UCmdTarget::*)(int cmd, int state))&hook },
00333
00334 #define ON_CHGFOCUS(baseClass, cmdmin, cmdmax) \
00335     { EV_CHGFOCUS, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
00336         (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnChgFocus },
00337
00338 #define ON_INVALIDATE(baseClass, cmdmin, cmdmax) \
00339     { EV_INVALIDATE, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
00340         (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnInvalidate },
00341
00342 #define ON_REDRAW(baseClass, cmdmin, cmdmax) \
00343     { EV_REDRAW, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
00344         (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnRedraw },
00345
00346 #define ON_SHOW_WIDGET(cmd, hook) \
00347     { EV_SHOW_WIDGET, epV_I, UMSG_RANGE, cmd, cmd, \
00348         (UPMSG)(void (UCmdTarget::*)(int state))&hook },
00349
00350 #define ON_PAGE_CHANGED(baseClass, cmdmin, cmdmax) \
00351     { EV_PAGE_CHANGED, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
00352         (UPMSG)(void (UCmdTarget::*)(int cmd, int pagenum))&baseClass::OnPageChanged },
00353
00354 #define ON_SHOW_WIDGET_RANGE(cmdmin, cmdmax, hook) \
00355     { EV_SHOW_WIDGET, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
00356         (UPMSG)(void (UCmdTarget::*)(int cmd, int state))&hook },
00357
00358 #define ON_DROPREF(cmdmin, cmdmax, hook) \
00359     { EV_DROPREF, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
00360         (UPMSG)(void (UCmdTarget::*)(int cmd, int numref, long *refs))&hook },
00361
00362 #define ON_UNOTIFY(cmd, hook) \
00363     { EV_NOTIFY, epV_V, UMSG_RANGE, cmd, cmd, \
00364         (UPMSG)(void (UCmdTarget::*)(void))&hook },
00365
00366 #define ON_INIT_WIDGET(baseClass, cmdmin, cmdmax) \
00367     { EV_INIT_WIDGET, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00368         (UPMSG)(void (UCmdTarget::*)(int, void *))&baseClass::OnInitWidget },
00369
00370 #define ON_INIT_TAB_WIDGET(baseClass, cmdmin, cmdmax) \
00371     { EV_INIT_TAB_WIDGET, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
00372         (UPMSG)(void (UCmdTarget::*)(int, int, void *))&baseClass::OnInitTabWidget },
00373
00374 #define ON_SETTEXT(cmdmin, cmdmax, hook) \
00375     { EV_SETTEXT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00376         (UPMSG)(void (UCmdTarget::*)(int, const char *))&hook },
00377
00378 #define ON_GETTEXT(cmdmin, cmdmax, hook) \
00379     { EV_GETTEXT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00380         (UPMSG)(void (UCmdTarget::*)(int, UStr *))&hook },
00381
00382 #define ON_SETFLOAT(baseClass, cmdmin, cmdmax) \
00383     { EV_SETFLOAT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00384         (UPMSG)(void (UCmdTarget::*)(int cmd, const float *f))&baseClass::OnSetFloat },
00385
00386 #define ON_GETFLOAT(baseClass, cmdmin, cmdmax) \
00387     { EV_GETFLOAT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00388         (UPMSG)(void (UCmdTarget::*)(int cmd, float *f))&baseClass::OnGetFloat },
00389
00390 #define ON_DRAGQUERY(cmd, hook) \
00391     { EV_DRAGQUERY, epV_VP, UMSG_RANGE, cmd, cmd, \
00392         (UPMSG)(void (UCmdTarget::*)(UDragable *))&hook },
00393
00394 #define ON_DROPQUERY(cmd, hook) \
00395     { EV_DROPQUERY, epV_VP, UMSG_RANGE, cmd, cmd, \
00396         (UPMSG)(void (UCmdTarget::*)(UDropable **))&hook },
00397
00398 #define ON_DROPIT(cmd, hook) \
00399     { EV_DROPIT, epV_VP, UMSG_RANGE, cmd, cmd, \
00400         (UPMSG)(void (UCmdTarget::*)(const UDragable *))&hook },
00401
00402 #define ON_DRAGQUERY_RANGE(cmdmin, cmdmax, hook) \
00403     { EV_DRAGQUERY, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00404         (UPMSG)(void (UCmdTarget::*)(int, UDragable *))&hook },
00405
00406 #define ON_DROPQUERY_RANGE(cmdmin, cmdmax, hook) \
00407     { EV_DROPQUERY, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00408         (UPMSG)(void (UCmdTarget::*)(int, UDropable **))&hook },
00409
00410 #define ON_DROPIT_RANGE(cmdmin, cmdmax, hook) \
00411     { EV_DROPIT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00412         (UPMSG)(void (UCmdTarget::*)(int, const UDragable *))&hook },
00413
00414 #define ON_DROPQUERY_CMDID(baseClass) \
00415     { EV_DROPQUERY_CMDID, epV_iiVP, UMSG_NOEXT, 0, 0, \
00416         (UPMSG)(void (UCmdTarget::*)(int, int, int *))&baseClass::OnDropQueryCmdID },
00417
00418 #define ON_SET_SLIDER(baseClass, cmdmin, cmdmax) \
00419     { EV_SET_SLIDER, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00420         (UPMSG)(void (UCmdTarget::*)(int cmd, int pos))&baseClass::OnSetSlider },
00421
00422 #define ON_GET_SLIDERPROP(baseClass, cmdmin, cmdmax) \
00423     { EV_GET_SLIDERPROP, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00424         (UPMSG)(void (UCmdTarget::*)(int cmd, USLIDER *prop))&baseClass::OnGetSliderProperty },
00425
00426 #define ON_SET_SLIDERPROP(baseClass, cmdmin, cmdmax) \
00427     { EV_SET_SLIDERPROP, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00428         (UPMSG)(void (UCmdTarget::*)(int cmd, const USLIDER *prop))&baseClass::OnSetSliderProperty },
00429
00430 #define ON_TREE_RESETALL(baseClass, cmdmin, cmdmax) \
00431     { EV_TREE_RESETALL, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
00432         (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnTreeResetAll },
00433
00434 #define ON_TREE_INSERT(baseClass, cmdmin, cmdmax) \
00435     { EV_TREE_INSERT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00436         (UPMSG)(void (UCmdTarget::*)(int cmd, UTREE_INSERT *data))&baseClass::OnTreeInsert },
00437
00438 #define ON_TREE_GETINFO(baseClass, cmdmin, cmdmax) \
00439     { EV_TREE_GETINFO, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00440         (UPMSG)(void (UCmdTarget::*)(int cmd, UTREE_INFO *data))&baseClass::OnTreeGetInfo },
00441
00442 #define ON_TREE_SETDATA(baseClass, cmdmin, cmdmax) \
00443     { EV_TREE_SETDATA, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00444         (UPMSG)(void (UCmdTarget::*)(int cmd, UTREE_INFO *data))&baseClass::OnTreeSetData },
00445
00446 #define ON_TREE_SETICON(baseClass, cmdmin, cmdmax) \
00447     { EV_TREE_SETICON, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00448         (UPMSG)(void (UCmdTarget::*)(int cmd, UTREE_INFO *data))&baseClass::OnTreeSetIcon },
00449
00450 #define ON_TREE_DELETE(baseClass, cmdmin, cmdmax) \
00451     { EV_TREE_DELETE, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00452         (UPMSG)(void (UCmdTarget::*)(int cmd, UTREEITEM item))&baseClass::OnTreeDelete },
00453
00454 #define ON_TREE_EXPAND(baseClass, cmdmin, cmdmax) \
00455     { EV_TREE_EXPAND, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
00456         (UPMSG)(void (UCmdTarget::*)(int cmd, int collapse, UTREEITEM item))&baseClass::OnTreeExpand },
00457
00458 #define ON_TREE_SELECT(baseClass, cmdmin, cmdmax) \
00459     { EV_TREE_SELECT, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
00460         (UPMSG)(void (UCmdTarget::*)(int cmd, int deselect, UTREEITEM item))&baseClass::OnTreeSelect },
00461
00462 #define ON_TREE_GETSEL(baseClass, cmdmin, cmdmax) \
00463     { EV_TREE_GETSEL, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00464         (UPMSG)(void (UCmdTarget::*)(int cmd, UTREEITEM *item))&baseClass::OnTreeGetSel },
00465
00466 #define ON_TREE_EXPANDING(cmd, hook) \
00467     { EV_TREE_EXPANDING, epV_IVP, UMSG_RANGE, cmd, cmd, \
00468         (UPMSG)(void (UCmdTarget::*)(int collapse, UTREEITEM item))&hook },
00469
00470 #define ON_TREE_SELECTING(cmd, hook) \
00471     { EV_TREE_SELECTING, epV_IVP, UMSG_RANGE, cmd, cmd, \
00472         (UPMSG)(void (UCmdTarget::*)(int deselect, UTREEITEM item))&hook },
00473
00474 #define ON_LIST_SELECTING(cmd, hook) \
00475     { EV_LIST_SELECTING, epV_IVP, UMSG_RANGE, cmd, cmd, \
00476         (UPMSG)(void (UCmdTarget::*)(int entry, const char *txt))&hook },
00477
00478 #define ON_LIST_SELCOLUMN(cmd, hook) \
00479     { EV_LIST_SELCOLUMN, epV_I, UMSG_RANGE, cmd, cmd, \
00480         (UPMSG)(void (UCmdTarget::*)(int entry))&hook },
00481
00482 #define ON_LIST_RESORT(baseClass, cmdmin, cmdmax) \
00483     { EV_LIST_RESORT, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
00484         (UPMSG)(void (UCmdTarget::*)(int cmd, int column, UListSorter s))&baseClass::OnListResort },
00485
00486 #define ON_LIST_DBLCLICK(cmd, hook) \
00487     { EV_LIST_DBLCLICK, epV_V, UMSG_RANGE, cmd, cmd, \
00488         (UPMSG)(void (UCmdTarget::*)(void))&hook },
00489
00490 #define ON_LIST_ADDSEL(baseClass, cmdmin, cmdmax) \
00491     { EV_LIST_ADDSEL, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
00492         (UPMSG)(void (UCmdTarget::*)(int cmd, int entry))&baseClass::OnListAddSel },
00493
00494 #define ON_LIST_DELROW(baseClass, cmdmin, cmdmax) \
00495     { EV_LIST_DELROW, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
00496         (UPMSG)(void (UCmdTarget::*)(int cmd, int row))&baseClass::OnListDelRow },
00497
00498 #define ON_LIST_RESETALL(baseClass, cmdmin, cmdmax) \
00499     { EV_LIST_RESETALL, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
00500         (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnListResetAll },
00501
00502 #define ON_LIST_ADDCOLUMNS(baseClass, cmdmin, cmdmax) \
00503     { EV_LIST_ADDCOLUMNS, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
00504         (UPMSG)(void (UCmdTarget::*)(int cmd, int num))&baseClass::OnListAddColumns },
00505
00506 #define ON_LIST_SETFEEDBACK(baseClass, cmdmin, cmdmax) \
00507     { EV_LIST_SETFEEDBACK, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
00508         (UPMSG)(void (UCmdTarget::*)(int cmd, int turnOn))&baseClass::OnListSetFeedback },
00509
00510 #define ON_LIST_SETCOLTITLE(baseClass, cmdmin, cmdmax) \
00511     { EV_LIST_SETCOLTITLE, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
00512         (UPMSG)(void (UCmdTarget::*)(int cmd, int num, const char *title))&baseClass::OnListSetColTitle },
00513
00514 #define ON_LIST_SETCOLWIDTH(baseClass, cmdmin, cmdmax) \
00515     { EV_LIST_SETCOLWIDTH, epV_iii, UMSG_RANGE, cmdmin, cmdmax, \
00516         (UPMSG)(void (UCmdTarget::*)(int cmd, int num, int width))&baseClass::OnListSetColWidth },
00517
00518 #define ON_LIST_NEWROW(baseClass, cmdmin, cmdmax) \
00519     { EV_LIST_NEWROW, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00520         (UPMSG)(void (UCmdTarget::*)(int cmd, int *num))&baseClass::OnListNewRow },
00521
00522 #define ON_LIST_ROWSETDATA(baseClass, cmdmin, cmdmax) \
00523     { EV_LIST_ROWSETDATA, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
00524         (UPMSG)(void (UCmdTarget::*)(int cmd, int row, void *data))&baseClass::OnListRowSetData },
00525
00526 #define ON_LIST_ROWGETDATA(baseClass, cmdmin, cmdmax) \
00527     { EV_LIST_ROWGETDATA, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
00528         (UPMSG)(void (UCmdTarget::*)(int cmd, int row, void **data))&baseClass::OnListRowGetData },
00529
00530 #define ON_LIST_INSERT(baseClass, cmdmin, cmdmax) \
00531     { EV_LIST_INSERT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00532         (UPMSG)(void (UCmdTarget::*)(int cmd, ULIST_INSERT *data))&baseClass::OnListInsert },
00533
00534 #define ON_LIST_GETNEXTSEL(baseClass, cmdmin, cmdmax) \
00535     { EV_LIST_GETNEXTSEL, epi_ii, UMSG_RANGE, cmdmin, cmdmax, \
00536         (UPMSG)(int (UCmdTarget::*)(int cmd, int selectedCell))&baseClass::OnListGetNextSel },
00537
00538 #define ON_LIST_GETNEXT(baseClass, cmdmin, cmdmax) \
00539     { EV_LIST_GETNEXT, epi_ii, UMSG_RANGE, cmdmin, cmdmax, \
00540         (UPMSG)(int (UCmdTarget::*)(int cmd, int whichCell))&baseClass::OnListGetNext },
00541
00542 #define ON_LIST_GETINFO(baseClass, cmdmin, cmdmax) \
00543     { EV_LIST_GETINFO, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00544         (UPMSG)(void (UCmdTarget::*)(int cmd, ULIST_INFO *data))&baseClass::OnListGetInfo },
00545
00546 #define ON_COMBO_RESETALL(baseClass, cmdmin, cmdmax) \
00547     { EV_COMBO_RESETALL, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
00548         (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnComboResetAll },
00549
00550 #define ON_COMBO_APPEND(baseClass, cmdmin, cmdmax) \
00551     { EV_COMBO_APPEND, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00552         (UPMSG)(void (UCmdTarget::*)(int cmd, const char *txt))&baseClass::OnComboAppend },
00553
00554 #define ON_COMBO_SETSEL(baseClass, cmdmin, cmdmax) \
00555     { EV_COMBO_SETSEL, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
00556         (UPMSG)(void (UCmdTarget::*)(int cmd, int sel))&baseClass::OnComboSetPos },
00557
00558 #define ON_COMBO_DELSEL(baseClass, cmdmin, cmdmax) \
00559     { EV_COMBO_DELSEL, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
00560         (UPMSG)(void (UCmdTarget::*)(int cmd, int sel))&baseClass::OnComboDelSel },
00561
00562 #define ON_COMBO_ENABLESEL(baseClass, cmdmin, cmdmax) \
00563     { EV_COMBO_ENABLESEL, epV_iii, UMSG_RANGE, cmdmin, cmdmax, \
00564         (UPMSG)(void (UCmdTarget::*)(int cmd, int sel, int state))&baseClass::OnComboEnableSel },
00565
00566 #define ON_COMBO_GETSEL(baseClass, cmdmin, cmdmax) \
00567     { EV_COMBO_GETSEL, epi_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00568         (UPMSG)(int (UCmdTarget::*)(int cmd, UStr *txt))&baseClass::OnComboGetPos },
00569
00570 #define ON_COMBO_GETMENU(baseClass, cmdmin, cmdmax) \
00571     { EV_COMBO_GETMENU, epi_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00572         (UPMSG)(void (UCmdTarget::*)(int cmd, UMENU *menu))&baseClass::OnComboGetMenu },
00573
00574 #define ON_COMBO_GETCOUNT(baseClass, cmdmin, cmdmax) \
00575     { EV_COMBO_GETCOUNT, epi_i, UMSG_RANGE, cmdmin, cmdmax, \
00576         (UPMSG)(int (UCmdTarget::*)(int cmd))&baseClass::OnComboGetCount },
00577
00578 #define ON_COMBO_SEL(cmd, hook) \
00579     { EV_COMBO_SEL, epV_IVP, UMSG_RANGE, cmd, cmd, \
00580         (UPMSG)(void (UCmdTarget::*)(int pos, const char *txt))&hook },
00581
00582 #define ON_COMBO_SEL_RANGE(cmdmin, cmdmax, hook) \
00583     { EV_COMBO_SEL, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
00584         (UPMSG)(void (UCmdTarget::*)(int cmd, int pos, const char *txt))&hook },
00585
00586 #define ON_CUSTOM_DRAW(cmd, hook) \
00587     { EV_CUSTOM_DRAW, epV_VP, UMSG_RANGE, cmd, cmd, \
00588         (UPMSG)(void (UCmdTarget::*)(void *drawInfo))&hook },
00589
00590 #define ON_CUSTOM_DRAW_RANGE(cmdmin, cmdmax, hook) \
00591     { EV_CUSTOM_DRAW, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
00592         (UPMSG)(void (UCmdTarget::*)(int cmd, void *drawInfo))&hook },
00593
00594 typedef enum
00595 {
00596     epNone,
00597     epV_V,      // void (void)
00598     epV_VP,     // void (arg2)
00599     epV_iVP,    // void (arg1, arg2)
00600     epV_IVP,    // void (HI(arg1), arg2)
00601     epV_i,      // void (arg1)
00602     epV_I,      // void (HI(arg1))
00603     epV_ii,     // void (LO(arg1), HI(arg1))
00604     epV_iii,    // void (LO(arg1), HI(arg1), (int)arg2)
00605     epV_iiVP,   // void (LO(arg1), HI(arg1), arg2)
00606     epi_i,      // int (arg1)
00607     epi_V,      // int (void)
00608     epi_ii,     // int (LO(arg1), HI(arg1))
00609     epi_iVP,    // int (arg1, arg2)
00610     epi_VP      // int (arg2)
00611 } UEventParam;
00612
00613 typedef enum
00614 {
00615     UMSG_NOEXT,
00616     UMSG_RANGE
00617 } UMSG_EXT;
00618
00619 struct UMSGMAP_ENTRY
00620 {
00621     int/*UEventType*/ nMessage;   // message
00622     UEventParam nSig;       // signature type (parameters)
00623     UMSG_EXT ext;
00624     int ext1;
00625     int ext2;
00626     UPMSG pfn;    // routine to call
00627 };
00628
00629 struct UMSGMAP
00630 {
00631     const UMSGMAP* pBaseMap;
00632     const UMSGMAP_ENTRY* lpEntries;
00633 };
00634
00635 #define UDECLARE_MESSAGE_MAP() \
00636 private: \
00637     static const UMSGMAP_ENTRY _messageEntries[]; \
00638 protected: \
00639     static const UMSGMAP messageMap; \
00640     static const UMSGMAP* GetBaseMessageMap(); \
00641     static const UMSGMAP* GetThisMessageMap(); \
00642     virtual const UMSGMAP* GetMessageMap() const; \
00643
00644 #define UBEGIN_MESSAGE_MAP(theClass, baseClass) \
00645     const UMSGMAP* theClass::GetBaseMessageMap() \
00646         { return baseClass::GetThisMessageMap(); } \
00647     const UMSGMAP* theClass::GetThisMessageMap() \
00648         { return &theClass::messageMap; } \
00649     const UMSGMAP* theClass::GetMessageMap() const \
00650         { return &theClass::messageMap; } \
00651     const UMSGMAP theClass::messageMap = \
00652     { baseClass::GetThisMessageMap(), &theClass::_messageEntries[0] }; \
00653     const UMSGMAP_ENTRY theClass::_messageEntries[] = \
00654     { \
00655
00656 #define UEND_MESSAGE_MAP() \
00657         {EV_NONE, epNone, UMSG_NOEXT, 0, 0, (UPMSG)0 } \
00658     }; \
00659
00660 #define ev_msg // intentional placeholder
00661
00662 class UEXPORT UCmdTarget : public UObject
00663 {
00664     UDECLARE_DYNAMIC(UCmdTarget)
00665 public:
00666     UCmdTarget(int widid);
00667     virtual ~UCmdTarget();
00668
00669     typedef enum
00670     {
00671         kUNoDispatchInfo,
00672         kUDispatchHandled = 0x01
00673     } UDispatchInfo;
00674
00676     virtual int UDispatchMessage(int/*UEventType*/ evt, int arg1, void *arg2, UDispatchInfo & dispatchInfo);
00677
00678     inline int GetWidID(void) const { return m_widid; }
00679 private:
00680     int m_widid;
00681
00682     UDECLARE_MESSAGE_MAP()
00683 };
00684
00685 // the interface will ask regularly the widget if they want to be
00686 // disabled, checked (EV_UPDTCMD)...
00687 class UCmdUI
00688 {
00689 public:
00690     UCmdUI(int id) : m_nID(id)
00691 #ifdef WIN32
00692     , pCmdUI(0L)
00693     , pNMHDR(0L)
00694 #endif
00695 #ifdef qMacPP
00696     , m_wrapper(0L)
00697 #endif
00698     , m_widget(0L)
00699     , m_continue(true)
00700         {}
00701     virtual ~UCmdUI() {}
00702
00703 // Attributes
00704     int m_nID;
00705
00706 // Operations to do in ON_UUPDATECMD
00707     virtual void Enable(bool bOn = true);
00708     virtual void Check(bool bOn = true);
00709     virtual void SetText(const char *title);
00710         // by default this sets the continue state to false.
00711
00712     inline void SetContinue(bool state) { m_continue = state; }
00713     inline bool CanContinue(void) { return m_continue; }
00714
00715 // Operations to do in ON_USETTOOLTIP
00716     virtual void SetTooltip(const char *tooltip);
00717 #ifdef WIN32
00718     class CCmdUI *pCmdUI;
00719     void *pNMHDR;
00720 #endif
00721 #ifdef qMacPP
00722     struct UPseudoCmdStatusWrapper *m_wrapper;
00723 #endif
00724     void *m_widget;
00725     bool m_continue;
00726 };
00727
00728 class USemaphore
00729 {
00730 public:
00731     USemaphore(bool & semaphore) : m_semaphore(semaphore), m_didSetSemaphore(false),
00732         m_enteredTwice(false)
00733     {
00734         if(m_semaphore)
00735         {
00736             m_enteredTwice = true;
00737             return;
00738         }
00739         m_semaphore = true;
00740         m_didSetSemaphore = true;
00741     }
00742
00743     ~USemaphore()
00744     {
00745         if(m_didSetSemaphore)
00746             m_semaphore = false;
00747     }
00748
00749     inline bool IsEnteredTwice() const { return m_enteredTwice; }
00750
00751 protected:
00752     bool & m_semaphore;
00753     bool m_didSetSemaphore;
00754     bool m_enteredTwice;
00755 };
00756 #endif /* __cplusplus */
00757
00758 #define UMAKEINT(a, b)       ((int)(((short)(a)) | ((int)((short)(b))) << 16))
00759 #define ULOWORD(l)           ((short)(l))
00760 #define UHIWORD(l)           ((short)(((int)(l) >> 16) & 0xFFFF))
00761
00762 /* Modifier codes */
00763 #define UK_LBUTTON        0x01
00764 #define UK_MBUTTON        0x02
00765 #define UK_RBUTTON        0x04
00766 #define UK_CONTROL        0x08
00767 #define UK_SHIFT          0x10
00768 #define UK_ALT            0x20
00769
00770 /* Keyboard codes (non listed are ASCII codes) */
00771 #define UK_CANCEL         0x03
00772 #define UK_BACK           0x08
00773 #define UK_TAB            0x09
00774 #define UK_CLEAR          0x0C
00775 #define UK_RETURN         0x0D
00776 #define UK_ESCAPE         0x1B
00777 #define UK_SPACE          0x20
00778 #define UK_PRIOR          0x21
00779 #define UK_NEXT           0x22
00780 #define UK_END            0x23
00781 #define UK_HOME           0x24
00782 #define UK_LEFT           0x25
00783 #define UK_UP             0x26
00784 #define UK_RIGHT          0x27
00785 #define UK_DOWN           0x28
00786 #define UK_INSERT         0x2D
00787 #define UK_DELETE         0x2E
00788 #define UK_HELP           0x2F
00789
00790 #define UK_PLUS           0x6B
00791 #define UK_MINUS          0x6D
00792
00793 #define UK_NUMPAD0        0x60
00794 #define UK_NUMPAD1        0x61
00795 #define UK_NUMPAD2        0x62
00796 #define UK_NUMPAD3        0x63
00797 #define UK_NUMPAD4        0x64
00798 #define UK_NUMPAD5        0x65
00799 #define UK_NUMPAD6        0x66
00800 #define UK_NUMPAD7        0x67
00801 #define UK_NUMPAD8        0x68
00802 #define UK_NUMPAD9        0x69
00803 #define UK_MULTIPLY       0x6A
00804 #define UK_ADD            0x6B
00805 #define UK_SEPARATOR      0x6C
00806 #define UK_SUBTRACT       0x6D
00807 #define UK_DECIMAL        0x6E
00808 #define UK_DIVIDE         0x6F
00809 #define UK_F1             0x70
00810 #define UK_F2             0x71
00811 #define UK_F3             0x72
00812 #define UK_F4             0x73
00813 #define UK_F5             0x74
00814 #define UK_F6             0x75
00815 #define UK_F7             0x76
00816 #define UK_F8             0x77
00817 #define UK_F9             0x78
00818 #define UK_F10            0x79
00819 #define UK_F11            0x7A
00820 #define UK_F12            0x7B
00821 #define UK_F13            0x7C
00822 #define UK_F14            0x7D
00823 #define UK_F15            0x7E
00824 #define UK_F16            0x7F
00825 #define UK_F17            0x80
00826 #define UK_F18            0x81
00827 #define UK_F19            0x82
00828 #define UK_F20            0x83
00829 #define UK_F21            0x84
00830 #define UK_F22            0x85
00831 #define UK_F23            0x86
00832 #define UK_F24            0x87
00833
00834 #ifdef WIN32
00835 #   define WINCMD_DLG_START 2000
00836 #   define WINCMD_DLG_END 3000
00837 #   define UCMD_to_WINCMD(cmd) (cmd)
00838 #   define WINCMD_to_UCMD(cmd) (cmd)
00839 #   define UCMD_to_WINCTL(cmd) ((cmd)-EV_COMMAND_START+WINCMD_DLG_START)
00840 #   define WINCTL_to_UCMD(cmd) ((cmd)-WINCMD_DLG_START+EV_COMMAND_START)
00841 #endif
00842
00843 /* see umenu.h */
00844 typedef long UMENU;
00845 #define UMENU_NULL ((UMENU)0L)
00846
00847 /* toolbar manager */
00848 #define UTB_SEPARATOR (-1)
00849 typedef struct
00850 {
00851     int widthbtn, heightbtn;    /* dimensions of each icon */
00852     const char *title;          /* title bar */
00853 #ifdef WIN32
00854     int winid;                  /* if for the toolbar (WIN32 only) */
00855 #endif
00856 } UTB_INIT;
00857
00858 typedef enum
00859 {
00860     DDV_NONE
00861 } UTB_VAR;
00862
00863 typedef enum
00864 {
00865     DDD_NONE = 0x00
00866 } UTB_DROP;
00867
00868 typedef struct
00869 {
00870     const void *icon;       /* icon data (XPM) */
00871     int cmd;                /* associated command */
00872     UTB_VAR varcode;        /* misc. option */
00873     UTB_DROP drop;          /* for drag'n drop */
00874     const char *tooltip;    /* status tooltip/nprompt tooltip */
00875 } UTB_BUTTON;
00876
00877 typedef struct
00878 {
00879     int initialcmd;     /* initial value */
00880     UTB_BUTTON *btns;   /* all the dropdown buttons */
00881 } UTB_DROPDOWN;
00882
00883 typedef struct
00884 {
00885     int max; /* maximum of the scroll range */
00886     int min; /* minimum of the scroll range */
00887     int inc; /* increment of the scroll */
00888     int pos; /* current position of the slider */
00889 } USLIDER;
00890
00891 typedef enum
00892 {
00893     uCursArrow,
00894     uCursWatch
00895 } UCURSOR;
00896
00897 typedef struct
00898 {
00899     int cx, cy;
00900 } USIZE;
00901
00902 typedef struct
00903 {
00904     int x, y;
00905 } UPOINT;
00906
00907 typedef struct
00908 {
00909     int left, top, right, bottom;
00910 } URECT;
00911
00912 typedef void *UTREEITEM;
00913
00914 typedef struct
00915 {
00916     const char *title;          /* tree item title */
00917     UTREEITEM parent;           /* 0L if root */
00918     UTREEITEM result;           /* pointer on the result item */
00919     void *icon;                 /* icon of the item, 0L if any */
00920     void *data;                 /* user data of the item, 0L if any */
00921 } UTREE_INSERT;
00922
00923 typedef struct
00924 {
00925     UTREEITEM item;         /* pointer on the item */
00926     UTREEITEM parent;       /* pointer on the parent (0L if any) */
00927     UTREEITEM next;         /* pointer on the next item (0L if any) */
00928     UTREEITEM child;        /* pointer on the first child item (0L if any) */
00929     void *data;             /* data of the item */
00930     char *title;            /* title of the item */
00931     void *icon;             /* icon of the item */
00932     int expanded;           /* item is expanded */
00933 } UTREE_INFO;
00934
00935 typedef struct
00936 {
00937     int row, col;               /* the coordinates of the entry */
00938     const char *title;          /* the title of the entry (0L if any) */
00939     void *icon;                 /* the icon of the entry (0L if any) */
00940 } ULIST_INSERT;
00941
00942 typedef int (*UListSorter)(UWidget *wid, void *data1, void *data2);
00943
00944 typedef struct
00945 {
00946     int row, col;               /* the coordinates of the entry */
00947     const char *title;          /* the title of the entry (0L if any) */
00948     void *data;                 /* the user data */
00949 } ULIST_INFO;
00950
00951 #ifdef __cplusplus
00952 extern "C" {
00953 #endif
00954
00955 UEXPORT int UEventSendMessage(int wid, int/*UEventType*/ evt, int arg1, void *arg2);
00956     /* send a message to a pseudo-widget */
00957
00958 UEXPORT int UEventSendMessageExt(int wid, int/*UEventType*/ evt, int arg1, void *arg2, int * handledFlag);
00959     /* send a message to a pseudo-widget and tells if the message was handled */
00960
00961 UEXPORT int UEventPostMessage(int wid, int/*UEventType*/ evt, int arg1, void *arg2);
00962     /* post a message to a pseudo-widget (get executed later) */
00963
00964 UEXPORT int UEventNotifyMessage(int/*UEventType*/ evt, int arg1, void *arg2);
00965     /* send a message to all the current pseudo-widget */
00966
00967 UEXPORT int UEventGetWidID(void);
00968     /* create a new widget id */
00969
00970 UEXPORT void UEventRemoveWidID(int widid);
00971     /* remove the widget from the broadcast list */
00972
00973 UEXPORT void UEventSetTooltipHandler(void (*handler) (const char *));
00974     /* set the handler (usually a status bar) called when happens a tooltip call */
00975
00976 UEXPORT void UEventGiveTime(void);
00977     /* give some time to the event manager for handling internal timers */
00978
00979 UEXPORT long UTickCount(void);
00980     /* in milliseconds */
00981
00982 #ifdef __cplusplus
00983 }
00984 #endif
00985
00986 #ifdef __cplusplus
00987 #   include <map>
00988
00989     UEXPORT UCmdTarget *UEventQueryWidget(int widid);
00990         /* search for a widget (0L if failed) */
00991
00992     UEXPORT const STD map<int, UCmdTarget *> & UEventGetTargets(void);
00993         /* return the list of the current pseudo targets */
00994
00995 #   ifdef WIN32
00996         // XPM wrappers
00997         UEXPORT HBITMAP UMakeBitmap(const char *icon);
00998         UEXPORT HBITMAP UMakeBitmap(char **icon);
00999         UEXPORT HBITMAP UMakeBitmap(char **icon, int & width, int & height, COLORREF back);
01000 #   else /* !WIN32 */
01001 #       define UMakeBitmap(b) 0L
01002 #   endif /* !WIN32 */
01003 #endif
01004
01005 #endif /* UEVENT_H */
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/umenu.cpp Source File

rf/umenu.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #include "stdafx.h"
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026
00027 #include <stdlib.h>
00028 #include <stdio.h>
00029 #include <math.h>
00030 #include <string.h>
00031 #include <float.h>
00032 #include <vector>
00033 #include <map>
00034
00035 #ifdef HAVE_MALLOC_H
00036 #include <malloc.h>
00037 #endif
00038
00039 #ifdef HAVE_UNISTD_H
00040 #include <unistd.h>
00041 #endif
00042
00043 #include "umenu.h"
00044 #include "uconsole.h"
00045
00046 #ifdef WIN32
00047 #include "dib.h"
00048 #endif
00049
00050 #ifdef qMacAPP
00051 #include "UMenuMgr.h"
00052 #include "UDispatcher.h"
00053 #endif
00054
00055 #if qMacPP
00056 #include <UConditionalMenus.h>
00057 #include <UAppearanceMenus.h>
00058 #endif
00059
00060 #ifdef qGTK
00061 extern "C"
00062 {
00063     // from glade's support.h
00064     GtkWidget *create_pixmap(GtkWidget *widget, const gchar *filename);
00065 }
00066 #endif
00067
00068 #if defined(_DEBUG) && defined(WIN32)
00069 #   define new DEBUG_NEW
00070 #   undef THIS_FILE
00071     static char THIS_FILE[] = __FILE__;
00072 #endif
00073
00074 UIMPLEMENT_DYNAMIC(UMenu, UWidget)
00075
00076 UBEGIN_MESSAGE_MAP(UMenu, UWidget)
00077     ON_UPDATEUI(UMenu)
00078     ON_UCOMMAND_RANGE(0, 0xFFFF, UMenu::OnCommands)
00079 UEND_MESSAGE_MAP()
00080
00081 UMenu::UMenu(int widid) : UWidget(widid)
00082 #if qGTK
00083     , fAccelGroup(0L)
00084 #endif
00085 {
00086 #if qGTK
00087     fAccelGroup = gtk_accel_group_new ();
00088 #endif
00089 }
00090
00091 UMenu::~UMenu()
00092 {
00093 }
00094
00095 #ifdef WIN32
00096 // create a HBITMAP from a pixmap
00097 HBITMAP UMakeBitmap(char **icon, int & width, int & height, COLORREF back)
00098 {
00099     BYTE **src = (BYTE **)icon;
00100
00101     // read the header
00102     int w, h, nc, cpp, i, x, y;
00103     if(sscanf((char *)*src++, "%d%d%d%d", &w, &h, &nc, &cpp) != 4)
00104         return 0L;
00105
00106     width = w;
00107     height = h;
00108
00109     HBITMAP hbitmap = CreateDIB(w, h, 8, 0L);
00110     LPBITMAPINFO header = (LPBITMAPINFO)GlobalLock(hbitmap);
00111     BYTE *image = (LPBYTE)header + header->bmiHeader.biSize + PaletteSize(header);
00112     RGBQUAD *pRgb = (RGBQUAD *)((LPBYTE)header + header->bmiHeader.biSize);
00113
00114     // read the colormap
00115     std::map<short, BYTE> colors;
00116     for(i = 0; i < nc; i++)
00117     {
00118         const BYTE *line = *src++;
00119         short aref;
00120         if(cpp == 1)
00121         {
00122             aref = line[0];
00123             line += 4;
00124         }
00125         else if(cpp == 2)
00126         {
00127             aref = ((short)line[1] << 8)  | line[0];
00128             line += 5;
00129         }
00130         else
00131             ASSERT(0);
00132
00133         COLORREF color;
00134
00135         if(strcmp((char *)line, "None") == 0)
00136         {
00137             color = back;
00138         }
00139         else
00140         {
00141             if(*line++ != '#')
00142                 return 0L;
00143
00144             if(strlen((char *)line) < 6)
00145                 return 0L;
00146
00147             int comp[6], c;
00148             int j;
00149             for(j = 0; j < 6; j++)
00150             {
00151                 c = *line++;
00152                 if(c >= '0' && c <= '9')
00153                     comp[j] = c - '0';
00154                 else if(c >= 'a' && c <= 'f')
00155                     comp[j] = c - 'a' + 10;
00156                 else if(c >= 'A' && c <= 'F')
00157                     comp[j] = c - 'A' + 10;
00158                 else
00159                     return 0L;
00160             }
00161
00162             color = RGB(comp[0]*16+comp[1],comp[2]*16+comp[3],comp[4]*16+comp[5]);
00163         }
00164
00165         colors.insert(std::make_pair(aref, i));
00166
00167         pRgb->rgbRed = GetRValue(color);
00168         pRgb->rgbGreen = GetGValue(color);
00169         pRgb->rgbBlue = GetBValue(color);
00170         pRgb->rgbReserved = 0;
00171         pRgb++;
00172     }
00173
00174     if(nc != colors.size() || nc > 256)
00175         return 0L;
00176
00177     // make the bitmap
00178     for(y = 0; y < h; y++)
00179     {
00180         const BYTE *line = *src++;
00181         BYTE *ptr = image + WIDTHBYTES(w * 8) * (h - y - 1);
00182         for(x = 0; x < w; x++)
00183         {
00184             short aref;
00185             if(cpp == 1)
00186             {
00187                 aref = line[0];
00188                 line++;
00189             }
00190             else if(cpp == 2)
00191             {
00192                 aref = ((short)line[1] << 8)  | line[0];
00193                 line += 2;
00194             }
00195             std::map<short, BYTE>::iterator pos = colors.find(aref);
00196             if(pos == colors.end())
00197                 return 0L;
00198             *ptr++ = (*pos).second;
00199         }
00200     }
00201
00202     GlobalUnlock(hbitmap);
00203
00204     HBITMAP ddbbmap = DIBToBitmap(hbitmap);
00205     GlobalFree((HGLOBAL)hbitmap);
00206
00207     return ddbbmap;
00208 }
00209
00210 HBITMAP UMakeBitmap(char **icon)
00211 {
00212     int w, h;
00213     return UMakeBitmap(icon, w, h, ::GetSysColor(COLOR_BTNFACE));
00214 }
00215
00216 UEXPORT HBITMAP UMakeBitmap(const char *icon)
00217 {
00218     std::vector<UStr> icstr;
00219     const char *tmp;
00220     while((tmp = strchr(icon, '\n')) != 0L)
00221     {
00222         UStr str;
00223         str.set(icon, tmp - icon);
00224         icon = tmp + 1;
00225         icstr.push_back(str);
00226     }
00227     if(icon[0] != '\0')
00228     {
00229         icstr.push_back(UStr(icon));
00230     }
00231
00232     std::vector<UStr>::const_iterator i;
00233     std::vector<const char *> ic;
00234     for(i = icstr.begin(); i != icstr.end(); ++i)
00235     {
00236         ic.push_back((*i).c_str());
00237     }
00238     return UMakeBitmap((char **)&ic[0]);
00239 }
00240 #endif
00241
00242 #define CTRLALT_STROKE "Ctrl+Alt+"
00243 #define CTRL_STROKE "Ctrl+"
00244 #define ALT_STROKE "Alt+"
00245
00246 static void GetMenuTitle(const char *name, UStr & title, int cmd,
00247                          char & mnemonic, int & mod, int & key)
00248 {
00249     title = "";
00250     mod = 0;
00251     key = 0;
00252     mnemonic = '\0';
00253
00254     // get the accelerator
00255     UStr copy(name);
00256     char *tmp;
00257     if((tmp = strchr(copy, '\t')) != 0L)
00258     {
00259         *tmp++ = '\0';
00260         if(strncmp(tmp, CTRLALT_STROKE, strlen(CTRLALT_STROKE)) == 0)
00261         {
00262             mod = UK_CONTROL | UK_ALT;
00263             key = tmp[strlen(CTRLALT_STROKE)];
00264         }
00265         else if(strncmp(tmp, CTRL_STROKE, strlen(CTRL_STROKE)) == 0)
00266         {
00267             mod = UK_CONTROL;
00268             key = tmp[strlen(CTRL_STROKE)];
00269         }
00270         else if(strncmp(tmp, ALT_STROKE, strlen(ALT_STROKE)) == 0)
00271         {
00272             mod = UK_ALT;
00273             key = tmp[strlen(ALT_STROKE)];
00274         }
00275         name = copy;
00276     }
00277
00278     title = name;
00279 #ifndef WIN32
00280     if((tmp = strchr(title, '&')) != 0L)
00281     {
00282         size_t l = tmp - (const char *)title;
00283         memmove(&title[l], &title[l + 1], title.length() - l);
00284     }
00285 #endif
00286 }
00287
00288 UMENU UMenuAddPulldown(int widid, const char *name, UMENU top)
00289 {
00290     UStr title;
00291     int  mod, key;
00292     char mnemonic;
00293     GetMenuTitle(name, title, 0, mnemonic, mod, key);
00294
00295 #ifdef qMacAPP
00296     return UMENU_NULL;
00297 #endif
00298 #ifdef qMacPP
00299     if(top == UMENU_NULL)
00300     {
00301         Assert_(0); // TODO
00302     }
00303     else
00304     {
00305         LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00306         LMenu *menu = menuBar->FetchMenu(top);
00307         if(menu == 0L)
00308             return UMENU_NULL;
00309
00310         LStr255 pstr(name);
00311         LMenu *newMenu = new LMenu(::UniqueID('MENU'), pstr);
00312         menuBar->InstallMenu(newMenu, hierMenu);
00313
00314         menu->InsertCommand(pstr, cmd_UseMenuItem, max_Int16 - 1);
00315 #if TARGET_API_MAC_CARBON
00316         UAppearanceMenus::SetItemHierID(menu->GetMacMenuH(), ::CountMenuItems(menu->GetMacMenuH()),
00317             newMenu->GetMenuID());
00318 #else
00319         UConditionalMenus::SetItemHierID(menu->GetMacMenuH(), ::CountMenuItems(menu->GetMacMenuH()),
00320             newMenu->GetMenuID());
00321 #endif
00322         return newMenu->GetMenuID();
00323     }
00324     return UMENU_NULL;
00325 #endif
00326 #ifdef qGTK
00327     GtkWidget *parent = 0L;
00328
00329     if(top == UMENU_NULL)
00330     {
00331         // try to find the menubar : the menu bar should be mapped
00332         // to a UMenu object as the main widget
00333         const UCmdTarget *target = UEventQueryWidget(widid);
00334         UMenu *menu = 0L;
00335         if(target == 0L || !target->IsKindOf(URUNTIME_CLASS(UMenu)))
00336             return UMENU_NULL;
00337
00338         menu = (UMenu *)target;
00339         if(menu == 0L)
00340             return UMENU_NULL;
00341
00342         GtkWidget *wid = (GtkWidget *)menu->GetWidget(kUMainWidget);
00343         if(wid == 0L || !GTK_IS_MENU_SHELL(wid))
00344             return UMENU_NULL;
00345
00346         parent = wid;
00347     }
00348     else
00349     {
00350         if(!GTK_IS_MENU_SHELL(top))
00351             return UMENU_NULL;
00352         parent = (GtkWidget *)top;
00353     }
00354
00355     GtkWidget *menuitem = gtk_menu_item_new_with_label(title);
00356     gtk_widget_show(menuitem);
00357     gtk_container_add(GTK_CONTAINER (parent), menuitem);
00358
00359     GtkWidget *menu = gtk_menu_new();
00360     gtk_menu_item_set_submenu(GTK_MENU_ITEM (menuitem), menu);
00361     /*GtkAccelGroup *accel_group = */gtk_menu_ensure_uline_accel_group (GTK_MENU (menu));
00362
00363     return (UMENU)menu;
00364 #endif
00365 #ifdef WIN32
00366     if(top == UMENU_NULL)
00367     {
00368         CMenu* pTopMenu = AfxGetMainWnd()->GetMenu();
00369         CMenu menu;
00370         menu.CreatePopupMenu();
00371         pTopMenu->AppendMenu(MF_POPUP, (UINT)menu.GetSafeHmenu(), name);
00372
00373         static bool firsttime = true;
00374         if(firsttime)
00375         {
00376             pTopMenu->DeleteMenu(0, MF_BYPOSITION);
00377             firsttime = false;
00378         }
00379         return (UMENU)menu.Detach();
00380     }
00381     else
00382     {
00383         HMENU menuhdl = (HMENU)top;
00384         CMenu parent;
00385         CMenu menu;
00386         menu.CreatePopupMenu();
00387         VERIFY(parent.Attach(menuhdl));
00388         parent.AppendMenu(MF_POPUP, (UINT)menu.GetSafeHmenu(), name);
00389         parent.Detach();
00390         return (UMENU)menu.Detach();
00391     }
00392 #endif
00393 }
00394
00395 #ifdef WIN32
00396 static void addAccel(int cmd, int mod, int key)
00397 {
00398     if(key == 0)
00399         return;
00400
00401     // Save the current accelerator table.
00402     CWnd *wnd = AfxGetMainWnd();
00403     CFrameWnd *frame = 0L;
00404     if(wnd->IsKindOf(RUNTIME_CLASS(CFrameWnd)))
00405         frame = (CFrameWnd *)wnd;
00406     else
00407         frame = wnd->GetParentFrame();
00408     if(frame == 0L)
00409         return;
00410
00411     HACCEL haccelOld = frame->m_hAccelTable;
00412
00413     // Count the number of entries in the current
00414     // table, allocate a buffer for the table, and
00415     // then copy the table into the buffer.
00416
00417     int cAccelerators = CopyAcceleratorTable(haccelOld, NULL, 0);
00418     LPACCEL lpaccelNew = (LPACCEL) LocalAlloc(LPTR, (cAccelerators + 1) * sizeof(ACCEL));
00419     if (lpaccelNew == NULL)
00420         return;
00421
00422     CopyAcceleratorTable(haccelOld, lpaccelNew, cAccelerators);
00423
00424     // Find the accelerator that the user modified
00425     // and change its flags and virtual-key code
00426     // as appropriate.
00427
00428     for (int i = 0; i < cAccelerators; i++)
00429     {
00430         if(lpaccelNew[i].cmd == cmd)
00431         {
00432             lpaccelNew[i].fVirt = FVIRTKEY;
00433             if(mod & UK_ALT)
00434                 lpaccelNew[i].fVirt |= FALT;
00435             if(mod & UK_CONTROL)
00436                 lpaccelNew[i].fVirt |= FCONTROL;
00437             lpaccelNew[i].key = key;
00438             break;
00439         }
00440     }
00441
00442     if(i == cAccelerators)
00443     {
00444         lpaccelNew[i].cmd = cmd;
00445         lpaccelNew[i].fVirt = FVIRTKEY;
00446         if(mod & UK_ALT)
00447             lpaccelNew[i].fVirt |= FALT;
00448         if(mod & UK_CONTROL)
00449             lpaccelNew[i].fVirt |= FCONTROL;
00450         lpaccelNew[i].key = key;
00451         cAccelerators++;
00452     }
00453
00454     // Create the new accelerator table, and
00455     // destroy the old one.
00456     DestroyAcceleratorTable(haccelOld);
00457     frame->m_hAccelTable = CreateAcceleratorTable(lpaccelNew, cAccelerators);
00458     LocalFree(lpaccelNew);
00459 }
00460 #endif
00461
00462 #ifdef qGTK
00463 static void addToAccelGroup(GtkAccelGroup *accelGroup, GtkWidget *menuitem, int mod, int key)
00464 {
00465     if(key == 0 || accelGroup == 0L)
00466         return;
00467
00468     int gdkmod = 0;
00469     if(mod & UK_CONTROL)
00470         gdkmod |= GDK_CONTROL_MASK;
00471     if(mod & UK_ALT)
00472         gdkmod |= GDK_MOD1_MASK;
00473
00474     gtk_widget_add_accelerator (menuitem, "activate",
00475                                 accelGroup, key, gdkmod, GTK_ACCEL_VISIBLE);
00476 }
00477
00478 static GtkWidget* gtk_menu_item_new_with_label_pixmap(const gchar *label, const void *pixmap)
00479 {
00480 // FIX ME !
00481 #if 1
00482     return gtk_menu_item_new_with_label(label);
00483 #else
00484     if(pixmap == 0L)
00485         return gtk_menu_item_new_with_label(label);
00486
00487     GtkWidget *menu_item = gtk_menu_item_new ();
00488
00489     GtkPixmap *gtkpix = GTK_PIXMAP(create_pixmap(menu_item, (const gchar *)pixmap));
00490     gtk_misc_set_alignment (GTK_MISC (gtkpix), 0.0, 0.5);
00491     gtk_container_add (GTK_CONTAINER (menu_item), GTK_WIDGET(gtkpix));
00492     gtk_widget_show (GTK_WIDGET(gtkpix));
00493
00494     GtkWidget *accel_label = gtk_accel_label_new (label);
00495     gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
00496
00497     gtk_container_add (GTK_CONTAINER (menu_item), accel_label);
00498     gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label), menu_item);
00499     gtk_widget_show (accel_label);
00500
00501     return menu_item;
00502 #endif
00503 }
00504 #endif // qGTK
00505
00506 void UMenuDelete(UMENU top, int afterIndex)
00507 {
00508     UASSERT(top != UMENU_NULL);
00509
00510 #ifdef qMacAPP
00511     MenuRef menu = MAGetMenu(top);
00512     if(menu)
00513     {
00514         short numItems = ::CountMenuItems(menu);
00515         afterIndex++;
00516         while (numItems >= afterIndex)
00517         {
00518             ::DeleteMenuItem(menu, numItems);
00519             --numItems;
00520         }
00521     }
00522 #endif
00523 #ifdef qMacPP
00524     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00525     LMenu *menu = menuBar->FetchMenu(top);
00526     if(menu)
00527     {
00528         short numItems = ::CountMenuItems(menu->GetMacMenuH());
00529         afterIndex++;
00530         while (numItems >= afterIndex)
00531         {
00532             menu->RemoveItem(numItems);
00533             --numItems;
00534         }
00535     }
00536     else
00537     {
00538         MenuHandle mhdl = ::GetMenu(top);
00539         if(mhdl != 0L)
00540         {
00541             short numItems = ::CountMenuItems(mhdl);
00542             afterIndex++;
00543             while (numItems >= afterIndex)
00544             {
00545                 ::DeleteMenuItem(mhdl, numItems);
00546                 --numItems;
00547             }
00548         }
00549     }
00550 #endif
00551 #ifdef WIN32
00552     CMenu parent;
00553     HMENU menuhdl = (HMENU)top;
00554     VERIFY(parent.Attach(menuhdl));
00555
00556     int numItems = (int)parent.GetMenuItemCount() - 1;
00557     while (numItems >= afterIndex)
00558     {
00559         VERIFY(parent.DeleteMenu(numItems, MF_BYPOSITION));
00560         --numItems;
00561     }
00562     parent.Detach();
00563 #endif
00564 }
00565
00566 int UMenuCount(UMENU top)
00567 {
00568     UASSERT(top != UMENU_NULL);
00569
00570 #ifdef qMacAPP
00571     MenuRef menu = MAGetMenu(top);
00572     if(menu)
00573     {
00574         return ::CountMenuItems(menu);
00575     }
00576 #endif
00577 #ifdef qMacPP
00578     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00579     LMenu *menu = menuBar->FetchMenu(top);
00580     if(menu)
00581     {
00582         return ::CountMenuItems(menu->GetMacMenuH());
00583     }
00584     else
00585     {
00586         MenuHandle mhdl = ::GetMenu(top);
00587         if(mhdl != 0L)
00588         {
00589             return ::CountMenuItems(mhdl);
00590         }
00591     }
00592 #endif
00593 #ifdef WIN32
00594     CMenu parent;
00595     HMENU menuhdl = (HMENU)top;
00596     VERIFY(parent.Attach(menuhdl));
00597
00598     UINT numItems = parent.GetMenuItemCount();
00599     parent.Detach();
00600
00601     return numItems;
00602 #endif
00603
00604     return 0;
00605 }
00606
00607 void UMenuDeleteByCmd(UMENU top, int cmd)
00608 {
00609     UASSERT(top != UMENU_NULL);
00610
00611 #ifdef qMacAPP
00612     MenuID menuNo;
00613     short itemNo;
00614     MenuRef menu = CommandToComponents(cmd, menuNo, itemNo);
00615     if(menu)
00616     {
00617         ::DeleteMenuItem(menu, itemNo);
00618     }
00619 #endif
00620 #ifdef qMacPP
00621     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00622     LMenu *menu = menuBar->FetchMenu(top);
00623     if(menu)
00624     {
00625         menu->RemoveCommand(cmd);
00626     }
00627 #endif
00628 #ifdef WIN32
00629     CMenu parent;
00630     HMENU menuhdl = (HMENU)top;
00631     VERIFY(parent.Attach(menuhdl));
00632
00633     VERIFY(parent.DeleteMenu(cmd, MF_BYCOMMAND));
00634
00635     parent.Detach();
00636 #endif
00637 }
00638
00639 UMENU UMenuAddButton(int widid, const char *name, UMENU top, const void *pixmap, int cmd)
00640 {
00641     UStr title;
00642     int  mod, key;
00643     char mnemonic;
00644     GetMenuTitle(name, title, cmd, mnemonic, mod, key);
00645
00646     UASSERT(top != UMENU_NULL);
00647
00648 #ifdef qMacPP
00649     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00650     LMenu *menu = menuBar->FetchMenu(top);
00651     if(menu)
00652     {
00653         LStr255 pstr(title);
00654         menu->InsertCommand(pstr, cmd, max_Int16 - 1);
00655     }
00656     else
00657     {
00658         MenuHandle mhdl = ::GetMenu(top);
00659         if(mhdl != 0L)
00660         {
00661             SInt16  menuLength = ::CountMenuItems(mhdl);
00662             LStr255 pstr(title);
00663             ::MacInsertMenuItem(mhdl, pstr, menuLength);
00664         }
00665     }
00666
00667     return UMENU_NULL;
00668 #endif
00669 #ifdef qMacAPP
00670     MenuRef menu = MAGetMenu(top);
00671     if(menu)
00672     {
00673         CStr255_AC pstr(title);
00674         gDispatcher->DoMakeMenuBarManager();
00675         TMenuBarManager::fgMenuBarManager->AddMenuItem(pstr, top, ::CountMenuItems(menu), cmd);
00676     }
00677
00678     return UMENU_NULL;
00679 #endif
00680 #ifdef qGTK
00681     UCmdTarget *target = UEventQueryWidget(widid);
00682     if(target == 0L || !target->IsKindOf(URUNTIME_CLASS(UMenu)))
00683         return UMENU_NULL;
00684     UMenu *pmenu = (UMenu *)target;
00685
00686     if(!GTK_IS_MENU_SHELL(top))
00687         return UMENU_NULL;
00688     GtkWidget *parent = (GtkWidget *)top;
00689
00690     GtkWidget *menuitem = gtk_menu_item_new_with_label_pixmap(title, pixmap);
00691     gtk_widget_show (menuitem);
00692     gtk_container_add (GTK_CONTAINER (parent), menuitem);
00693     addToAccelGroup((GtkAccelGroup *)pmenu->GetAccelGroup(), menuitem, mod, key);
00694 //      gtk_tooltips_set_tip (tooltips, quit1, "Quit the application", NULL);
00695     UEventSendMessage(widid, EV_INIT_WIDGET, cmd, menuitem);
00696
00697     return UMENU_NULL;
00698 #endif
00699 #ifdef WIN32
00700     HMENU menuhdl = (HMENU)top;
00701     CMenu parent;
00702     VERIFY(parent.Attach(menuhdl));
00703
00704     parent.AppendMenu(MF_STRING, UCMD_to_WINCMD(cmd), name);
00705     addAccel(UCMD_to_WINCMD(cmd), mod, key);
00706
00707     if(pixmap != 0L && strlen((const char *)pixmap))
00708     {
00709         HBITMAP bmap = UMakeBitmap((const char *)pixmap);
00710         CBitmap b;
00711         VERIFY(b.Attach(bmap));
00712         parent.SetMenuItemBitmaps(UCMD_to_WINCMD(cmd), MF_BYCOMMAND, &b, &b);
00713         b.Detach();
00714     }
00715
00716     parent.Detach();
00717     return UMENU_NULL;
00718 #endif
00719 }
00720
00721 UMENU UMenuAddToggle(int widid, const char *name, UMENU top, const void *pixmap, int cmd)
00722 {
00723     UStr title;
00724     int  mod, key;
00725     char mnemonic;
00726     GetMenuTitle(name, title, cmd, mnemonic, mod, key);
00727
00728 #ifdef qMacPP
00729     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00730     LMenu *menu = menuBar->FetchMenu(top);
00731     if(menu)
00732     {
00733         LStr255 pstr(title);
00734         menu->InsertCommand(pstr, cmd, max_Int16 - 1);
00735     }
00736     else
00737     {
00738         MenuHandle mhdl = ::GetMenu(top);
00739         if(mhdl != 0L)
00740         {
00741             SInt16  menuLength = ::CountMenuItems(mhdl);
00742             LStr255 pstr(title);
00743             ::MacInsertMenuItem(mhdl, pstr, menuLength);
00744         }
00745     }
00746
00747     return UMENU_NULL;
00748 #endif
00749 #ifdef qMacAPP
00750     MenuRef menu = MAGetMenu(top);
00751     if(menu)
00752     {
00753         CStr255_AC pstr(title);
00754         gDispatcher->DoMakeMenuBarManager();
00755         TMenuBarManager::fgMenuBarManager->AddMenuItem(pstr, top, ::CountMenuItems(menu), cmd);
00756     }
00757
00758     return UMENU_NULL;
00759 #endif
00760 #ifdef qGTK
00761     UCmdTarget *target = UEventQueryWidget(widid);
00762     if(target == 0L || !target->IsKindOf(URUNTIME_CLASS(UMenu)))
00763         return UMENU_NULL;
00764     UMenu *pmenu = (UMenu *)target;
00765
00766     if(!GTK_IS_MENU_SHELL(top))
00767         return UMENU_NULL;
00768     GtkWidget *parent = (GtkWidget *)top;
00769
00770     GtkWidget *menuitem = gtk_check_menu_item_new_with_label(title);
00771     gtk_widget_show(menuitem);
00772     gtk_container_add(GTK_CONTAINER (parent), menuitem);
00773     addToAccelGroup((GtkAccelGroup *)pmenu->GetAccelGroup(), menuitem, mod, key);
00774 //      gtk_tooltips_set_tip (tooltips, quit1, "Quit the application", NULL);
00775     UEventSendMessage(widid, EV_INIT_WIDGET, cmd, menuitem);
00776
00777     return UMENU_NULL;
00778 #endif
00779 #ifdef WIN32
00780     ASSERT(top != UMENU_NULL);
00781
00782     HMENU menuhdl = (HMENU)top;
00783     CMenu parent;
00784     VERIFY(parent.Attach(menuhdl));
00785
00786     parent.AppendMenu(MF_STRING, UCMD_to_WINCMD(cmd), name);
00787     addAccel(UCMD_to_WINCMD(cmd), mod, key);
00788
00789     if(pixmap != 0L && strlen((const char *)pixmap))
00790     {
00791         HBITMAP bmap = UMakeBitmap((const char *)pixmap);
00792         CBitmap b;
00793         VERIFY(b.Attach(bmap));
00794         parent.SetMenuItemBitmaps(UCMD_to_WINCMD(cmd), MF_BYCOMMAND, &b, &b);
00795         b.Detach();
00796     }
00797
00798     parent.Detach();
00799     return UMENU_NULL;
00800 #endif
00801 }
00802
00803 UMENU UMenuAddSeparator(int widid, UMENU top)
00804 {
00805     UASSERT(top != UMENU_NULL);
00806
00807 #ifdef qMacPP
00808     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00809     LMenu *menu = menuBar->FetchMenu(top);
00810     if(menu)
00811     {
00812         menu->InsertCommand("\p-", 0, max_Int16 - 1);
00813     }
00814     else
00815     {
00816         MenuHandle mhdl = ::GetMenu(top);
00817         if(mhdl != 0L)
00818         {
00819             SInt16  menuLength = ::CountMenuItems(mhdl);
00820             ::MacInsertMenuItem(mhdl, "\p-", menuLength);
00821         }
00822     }
00823
00824     return UMENU_NULL;
00825 #endif
00826 #ifdef qMacAPP
00827     MenuRef menu = MAGetMenu(top);
00828     if(menu)
00829     {
00830         CStr255_AC pstr("-");
00831         gDispatcher->DoMakeMenuBarManager();
00832         TMenuBarManager::fgMenuBarManager->AddMenuItem(pstr, top, ::CountMenuItems(menu), 0);
00833     }
00834
00835     return UMENU_NULL;
00836 #endif
00837 #ifdef qGTK
00838     if(!GTK_IS_MENU_SHELL(top))
00839         return UMENU_NULL;
00840     GtkWidget *parent = (GtkWidget *)top;
00841
00842     GtkWidget *menuitem = gtk_menu_item_new();
00843     gtk_widget_show(menuitem);
00844     gtk_container_add(GTK_CONTAINER (parent), menuitem);
00845     gtk_widget_set_sensitive(menuitem, FALSE);
00846     return UMENU_NULL;
00847 #endif
00848 #ifdef WIN32
00849     HMENU menuhdl = (HMENU)top;
00850     CMenu parent;
00851     VERIFY(parent.Attach(menuhdl));
00852     parent.AppendMenu(MF_SEPARATOR);
00853     parent.Detach();
00854     return UMENU_NULL;
00855 #endif
00856 }
00857
00858 void UMenu::OnUpdateUI()
00859 {
00860     // for WIN32, the UpdateUI on the menus is better handled by MFC
00861 #ifndef WIN32
00862     static bool sSemaphore = false;
00863     USemaphore policeman(sSemaphore);
00864     if(policeman.IsEnteredTwice())
00865         return;
00866
00867     // this is the interesting thing about the toolbar : it resends the
00868     // update UI to other widgets according to the focus information and
00869     // allows the update to be handled several times if the handler asks for it
00870     // (by using UCmdUI::SetContinue)
00871
00872     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00873     std::map<int, void *>::iterator w;
00874     int cmdid;
00875
00876     for(w = m_widgets.begin(); w != m_widgets.end(); ++w)
00877     {
00878         void *widget = (*w).second;
00879         cmdid = (*w).first;
00880
00881         if(cmdid == kUMainWidget)
00882             continue;
00883
00884 #if qGTK
00885         if(!GTK_IS_MENU_ITEM(widget))
00886             continue;
00887 #endif
00888
00889         // first forward the command to the focused widget : if it doesn't want it
00890         // we give it to the next pseudo widget.
00891         if(sFocusWidID != -1 && sFocusWidID != GetWidID())
00892         {
00893             UCmdUI pUI(cmdid);
00894             pUI.m_widget = widget;
00895             UEventSendMessage(sFocusWidID, EV_UPDTCMD, pUI.m_nID, &pUI);
00896             if(!pUI.CanContinue())
00897                 continue;
00898         }
00899
00900         STD map<int, UCmdTarget *>::const_iterator i;
00901         for(i = targets.begin(); i != targets.end(); ++i)
00902         {
00903             int widid = (*i).first;
00904             if(widid == sFocusWidID || widid == GetWidID())
00905                 continue;
00906
00907             UCmdUI pUI(cmdid);
00908             pUI.m_widget = widget;
00909             UEventSendMessage(widid, EV_UPDTCMD, pUI.m_nID, &pUI);
00910             if(!pUI.CanContinue())
00911                 break;
00912         }
00913         if(i == targets.end())
00914         {
00915             //UAppConsole("The cmd %d of the menubar has no update handler, it's gonna be disabled\n", cmdid);
00916             UCmdUI pUI(cmdid);
00917             pUI.m_widget = widget;
00918             pUI.Enable(false);
00919         }
00920     }
00921 #endif
00922 }
00923
00924 int UMenu::OnCommands(int cmd)
00925 {
00926     static bool sSemaphore = false;
00927     USemaphore policeman(sSemaphore);
00928     if(policeman.IsEnteredTwice())
00929         return 1;
00930
00931     // this is the interesting thing about the toolbar : it resends the
00932     // commands to other widgets according to the focus information and
00933     // allows the command to be handled several times if the handler return 1
00934
00935     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00936     int res = 0;
00937     int handledFlag;
00938
00939     // first forward the command to the focused widget : if it doesn't want it
00940     // we give it to the next pseudo widget.
00941     if(sFocusWidID != -1 && sFocusWidID != GetWidID())
00942     {
00943         res = UEventSendMessageExt(sFocusWidID, EV_CMD, cmd, 0L, &handledFlag);
00944         if(res == 0 && handledFlag)
00945             return 0;
00946     }
00947
00948     STD map<int, UCmdTarget *>::const_iterator i;
00949     for(i = targets.begin(); i != targets.end(); ++i)
00950     {
00951         int widid = (*i).first;
00952         if(widid == sFocusWidID || widid == GetWidID())
00953             continue;
00954         res = UEventSendMessageExt(widid, EV_CMD, cmd, 0L, &handledFlag);
00955         if(res == 0 && handledFlag)
00956             return 0;
00957     }
00958
00959     //UAppConsole("The cmd %d of the menubar has no command handler\n", cmd);
00960
00961     return 1;
00962 }
00963
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/umenu.h Source File

rf/umenu.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #ifndef UMENU_H
00022 #define UMENU_H
00023
00024 #include "uwidget.h"
00025
00026 #ifdef __cplusplus
00027
00028 class UMenu : public UWidget
00029 {
00030     UDECLARE_DYNAMIC(UMenu)
00031 public:
00032     UMenu(int widid);
00033     virtual ~UMenu();
00034
00035 #if qGTK
00036     inline void *GetAccelGroup(void) const { return fAccelGroup; }
00037         // maintain an accelerator group (GtkAccelGroup)
00038         // that you can add to your window.
00039 #endif
00040
00041 protected:
00042 #if qGTK
00043     void *fAccelGroup;
00044 #endif
00045
00046     ev_msg void OnUpdateUI(void);
00047     ev_msg int OnCommands(int cmd);
00048
00049     UDECLARE_MESSAGE_MAP()
00050 };
00051 #endif /* __cplusplus */
00052
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056
00057 UMENU UMenuAddPulldown(int widid, const char *name, UMENU top);
00058 UMENU UMenuAddToggle(int widid, const char *name, UMENU top, const void *pixmap, int cmd);
00059 UMENU UMenuAddButton(int widid, const char *name, UMENU top, const void *pixmap, int cmd);
00060 UMENU UMenuAddSeparator(int widid, UMENU top);
00061 void UMenuDelete(UMENU top, int afterIndex);
00062 void UMenuDeleteByCmd(UMENU top, int cmd);
00063 int UMenuCount(UMENU top);
00064
00065 #ifdef __cplusplus
00066 }
00067 #endif
00068
00069 #endif /* UMenu_H */
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/uobject.cpp Source File

rf/uobject.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #include "stdafx.h"
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026
00027 #include <string.h>
00028
00029 #include "uobject.h"
00030
00031 URuntimeClass *URuntimeClass::sAllURuntimeClass = 0L;
00032
00033 const URuntimeClass* UObject::_GetBaseClass()
00034     { return 0L; }
00035 const URuntimeClass UObject::classUObject(
00036     "UObject", sizeof(UObject), 0L, &UObject::_GetBaseClass);
00037 const URuntimeClass *UObject::rtUObject()
00038     { return &UObject::classUObject; }
00039
00040 UObject* UObject::CreateObject(const char *className)
00041 {
00042     URuntimeClass *next = URuntimeClass::sAllURuntimeClass;
00043     while(next != 0L)
00044     {
00045         if(strcmp(next->m_lpszClassName, className) == 0)
00046             return next->CreateObject();
00047
00048         next = next->m_pNextClass;
00049     }
00050     return 0L;
00051 }
00052
00053 const URuntimeClass* UObject::GetRuntimeClass() const
00054 {
00055     return URUNTIME_CLASS(UObject);
00056 }
00057
00058 bool UObject::IsKindOf(const URuntimeClass* pClass) const
00059 {
00060     // simple SI case
00061     const URuntimeClass* pClassThis = GetRuntimeClass();
00062     return pClassThis->IsDerivedFrom(pClass);
00063 }
00064
00065 URuntimeClass::URuntimeClass(const char *lpszClassName, int nObjectSize,
00066         UObject* (*pfnCreateObject)(), const URuntimeClass* (*pfnGetBaseClass)())
00067 {
00068     m_lpszClassName = lpszClassName;
00069     m_nObjectSize = nObjectSize;
00070     m_pfnCreateObject = pfnCreateObject;
00071     m_pfnGetBaseClass = pfnGetBaseClass;
00072     m_pNextClass = sAllURuntimeClass;
00073
00074     sAllURuntimeClass = this;
00075 }
00076
00077 URuntimeClass::~URuntimeClass()
00078 {
00079     URuntimeClass *next = sAllURuntimeClass;
00080     URuntimeClass *prev = 0L;
00081     while(next != 0L)
00082     {
00083         if(next == this)
00084         {
00085             if(prev == 0L)
00086                 sAllURuntimeClass = m_pNextClass;
00087             else
00088                 prev->m_pNextClass = m_pNextClass;
00089             break;
00090         }
00091
00092         prev = next;
00093         next = next->m_pNextClass;
00094     }
00095 }
00096
00097 UObject* URuntimeClass::CreateObject()
00098 {
00099     if (m_pfnCreateObject == 0L)
00100     {
00101         return 0L;
00102     }
00103
00104     UObject* pObject = 0L;
00105     try
00106     {
00107         pObject = (*m_pfnCreateObject)();
00108     }
00109     catch(...)
00110     {
00111     }
00112
00113     return pObject;
00114 }
00115
00116 bool URuntimeClass::IsDerivedFrom(const URuntimeClass* pBaseClass) const
00117 {
00118     // simple SI case
00119     const URuntimeClass* pClassThis = this;
00120     while (pClassThis != 0L)
00121     {
00122         if (pClassThis == pBaseClass)
00123             return true;
00124         pClassThis = (*pClassThis->m_pfnGetBaseClass)();
00125     }
00126     return false;       // walked to the top, no match
00127 }
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/uobject.h Source File

rf/uobject.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #ifndef UOBJECT_H
00022 #define UOBJECT_H
00023
00024 #include "uconfig.h"
00025
00026 #ifdef __cplusplus
00027
00028 class UObject;
00029
00030 class UEXPORT URuntimeClass
00031 {
00032 public:
00033     URuntimeClass(const char *lpszClassName, int nObjectSize,
00034         UObject* (*pfnCreateObject)(), const URuntimeClass* (*pfnGetBaseClass)());
00035     ~URuntimeClass();
00036
00037 // Attributes
00038     const char *m_lpszClassName;
00039     int m_nObjectSize;
00040     UObject* (* m_pfnCreateObject)(); // 0L => abstract class
00041     const URuntimeClass* (* m_pfnGetBaseClass)();
00042
00043 // Operations
00044     UObject* CreateObject();
00045     bool IsDerivedFrom(const URuntimeClass* pBaseClass) const;
00046
00047     // CRuntimeClass objects linked together in simple list
00048     URuntimeClass* m_pNextClass;       // linked list of registered classes
00049
00050     // linked list of all the registred runtime classes
00051     static URuntimeClass *sAllURuntimeClass;
00052 };
00053
00054 #define URUNTIME_CLASS(class_name) (class_name::rt##class_name())
00055
00056 #define UDECLARE_DYNAMIC(class_name) \
00057 protected: \
00058     static const URuntimeClass* _GetBaseClass(); \
00059     static const URuntimeClass class##class_name; \
00060 public: \
00061     static const URuntimeClass *rt##class_name(void); \
00062     virtual const URuntimeClass* GetRuntimeClass() const; \
00063
00064 // dynamically constructable
00065 #define UDECLARE_DYNCREATE(class_name) \
00066     UDECLARE_DYNAMIC(class_name) \
00067     static UObject* CreateObject(); \
00068
00069 #define UIMPLEMENT_RUNTIMECLASS(class_name, base_class_name, pfnNew) \
00070     const URuntimeClass *class_name::rt##class_name(void) \
00071         { return &class_name::class##class_name; } \
00072     const URuntimeClass* class_name::_GetBaseClass() \
00073         { return URUNTIME_CLASS(base_class_name); } \
00074     const URuntimeClass class_name::class##class_name( \
00075         #class_name, sizeof(class class_name), pfnNew, \
00076             &class_name::_GetBaseClass); \
00077     const URuntimeClass* class_name::GetRuntimeClass() const \
00078         { return URUNTIME_CLASS(class_name); } \
00079
00080 #define UIMPLEMENT_DYNAMIC(class_name, base_class_name) \
00081     UIMPLEMENT_RUNTIMECLASS(class_name, base_class_name, 0L)
00082
00083 #define UIMPLEMENT_DYNCREATE(class_name, base_class_name) \
00084     UObject* class_name::CreateObject() \
00085         { return new class_name; } \
00086     UIMPLEMENT_RUNTIMECLASS(class_name, base_class_name, \
00087         class_name::CreateObject)
00088
00089 class UEXPORT UObject
00090 {
00091 public:
00092     virtual const URuntimeClass* GetRuntimeClass() const;
00093     virtual ~UObject() {}
00094
00095     static const URuntimeClass *rtUObject();
00096     static const URuntimeClass* _GetBaseClass();
00097     static UObject* CreateObject(const char *className);
00098
00099     bool IsKindOf(const URuntimeClass* pClass) const;
00100 protected:
00101     static const URuntimeClass classUObject;
00102     UObject() {}
00103 };
00104
00105 #define UDYNAMIC_CAST(TYPE, EXPR) \
00106     ((TYPE *)((EXPR) == 0L ? 0L : ((EXPR)->IsKindOf(URUNTIME_CLASS(TYPE)) ? (TYPE *)EXPR : 0L)))
00107
00108 #endif /* __cplusplus */
00109
00110 #ifdef __cplusplus
00111 extern "C" {
00112 #endif
00113
00114 #ifdef __cplusplus
00115 }
00116 #endif
00117
00118 #endif /* UOBJECT_H */
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/ustr.cpp Source File

rf/ustr.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- January 1997
00019  */
00020
00021 #include "stdafx.h"
00022
00023 #include <stdlib.h>
00024 #include <errno.h>
00025 #include <string.h>
00026 #include <stdio.h>
00027 #include <new>
00028
00029 #include "ustr.h"
00030 #include "uconsole.h"
00031
00032 #if qMacAPP
00033 #   include <Errors.h>
00034 #endif
00035
00036 #ifdef WIN32
00037 #   ifdef _DEBUG
00038 #   define new DEBUG_NEW
00039 #   undef THIS_FILE
00040     static char THIS_FILE[] = __FILE__;
00041 #   endif
00042 #endif /* WIN32 */
00043
00044 static const unsigned int kMaxChar = 255;
00045
00046 void UPStr::flush(void)
00047 {
00048     if(str == 0L)
00049         return;
00050     free(str);
00051     str = 0L;
00052 }
00053
00054 const char *UPStr::operator=(const char *newstr)
00055 {
00056     if(newstr == 0L)
00057         newstr = "";
00058
00059     size_t l = strlen(newstr);
00060     if(l > kMaxChar)
00061         l = kMaxChar;
00062
00063     char *newvalue = (char *)malloc((l + 2) * sizeof(char));
00064     if(newvalue == 0L)
00065         UTHROW(std::bad_alloc());
00066
00067     strncpy(newvalue + 1, newstr, l);
00068     newvalue[0] = l;
00069     newvalue[l + 1] = '\0';
00070
00071     flush();
00072     str = newvalue;
00073
00074     return *this;
00075 }
00076
00077 const unsigned char *UPStr::operator=(const unsigned char *newstr)
00078 {
00079     if(newstr == 0L)
00080         newstr = (unsigned char *)"";
00081
00082     int l = newstr[0];
00083     char *newvalue = (char *)malloc((l + 2) * sizeof(char));
00084     if(newvalue == 0L)
00085         UTHROW(std::bad_alloc());
00086
00087     memcpy(newvalue + 1, (char *)newstr + 1, l * sizeof(char));
00088     newvalue[0] = l;
00089     newvalue[l + 1] = '\0';
00090
00091     flush();
00092     str = newvalue;
00093
00094     return *this;
00095 }
00096
00097 const UPStr & UPStr::operator=(const UPStr & newstr)
00098 {
00099     *this = (const char *)newstr;
00100     return *this;
00101 }
00102
00103 const UPStr & UPStr::set(const char *buf, unsigned int len)
00104 {
00105     flush();
00106     if(len == 0)
00107     {
00108         *this = "";
00109         return *this;
00110     }
00111     if(len > kMaxChar)
00112         len = kMaxChar;
00113
00114     str = (char *)malloc((len + 2) * sizeof(char));
00115     if(str == 0L)
00116     {
00117         UAppConsole("Impossible to allocate %d bytes !\n", (len + 2) * sizeof(char));
00118         return *this;
00119     }
00120
00121     memcpy(str + 1, buf, len * sizeof(char));
00122     str[0] = len;
00123     str[len + 1] = '\0';
00124
00125     return *this;
00126 }
00127
00128 const UPStr & UPStr::replace(char which, char bywhich)
00129 {
00130     if(str == 0L)
00131         return *this;
00132
00133     char *buf = str + 1;
00134     while(*buf)
00135     {
00136         if(*buf == which)
00137             *buf++ = bywhich;
00138         else
00139             buf++;
00140     }
00141     return *this;
00142 }
00143
00144 UPStr & UPStr::operator<<(const char *addToStr)
00145 {
00146     if(addToStr == 0L)
00147         return *this;
00148
00149     if(str == 0L)
00150     {
00151         *this = addToStr;
00152         return *this;
00153     }
00154
00155     size_t len = strlen(addToStr);
00156     unsigned curlen = length();
00157     if(len + length() > kMaxChar)
00158         len = kMaxChar - length();
00159     if(len == 0)
00160         return *this;
00161
00162     str = (char *)realloc(str, (len + curlen + 2) * sizeof(char));
00163     memcpy(str + curlen + 1, addToStr, len * sizeof(char));
00164     str[0] = len + curlen;
00165     str[len + curlen + 1] = '\0';
00166
00167     return *this;
00168 }
00169
00170 UPStr & UPStr::operator<<(char addToStr)
00171 {
00172     char astr[2] = {'\0', '\0'};
00173     astr[0] = addToStr;
00174     return *this << astr;
00175 }
00176
00177 UPStr & UPStr::operator<<(int addToStr)
00178 {
00179     char astr[50];
00180     sprintf(astr, "%d", addToStr);
00181     return *this << astr;
00182 }
00183
00184 void UStr::flush(void)
00185 {
00186     if(str == 0L)
00187         return;
00188     free(str);
00189     str = 0L;
00190 }
00191
00192 const char *UStr::operator=(const char *newstr)
00193 {
00194     if(newstr == 0L)
00195         newstr = "";
00196
00197     int l = strlen(newstr);
00198     char *newvalue = (char *)malloc((l + 1) * sizeof(char));
00199     if(newvalue == 0L)
00200         UTHROW(std::bad_alloc());
00201
00202     strcpy(newvalue, newstr);
00203
00204     flush();
00205     str = newvalue;
00206
00207     return *this;
00208 }
00209
00210 const char *UStr::operator=(const unsigned char *newstr)
00211 {
00212     if(newstr == 0L)
00213         newstr = (unsigned char *)"";
00214
00215     int l = newstr[0];
00216     char *newvalue = (char *)malloc((l + 1) * sizeof(char));
00217     if(newvalue == 0L)
00218         UTHROW(std::bad_alloc());
00219
00220     memcpy(newvalue, newstr + 1, l * sizeof(char));
00221     newvalue[l] = '\0';
00222
00223     flush();
00224     str = newvalue;
00225
00226     return *this;
00227 }
00228
00229 const UStr & UStr::operator=(const UStr & newstr)
00230 {
00231     *this = (const char *)newstr;
00232     return *this;
00233 }
00234
00235 const UStr & UStr::set(const char *buf, unsigned int len)
00236 {
00237     flush();
00238     if(len == 0)
00239         return *this;
00240
00241     str = (char *)malloc((len + 1) * sizeof(char));
00242     if(str == 0L)
00243     {
00244         UAppConsole("Impossible to allocate %d bytes !\n", (len + 1) * sizeof(char));
00245         return *this;
00246     }
00247
00248     memcpy(str, buf, len * sizeof(char));
00249     str[len] = '\0';
00250
00251     return *this;
00252 }
00253
00254 const UStr & UStr::replace(char which, char bywhich)
00255 {
00256     if(str == 0L)
00257         return *this;
00258
00259     char *buf = str;
00260     while(*buf)
00261     {
00262         if(*buf == which)
00263             *buf++ = bywhich;
00264         else
00265             buf++;
00266     }
00267     return *this;
00268 }
00269
00270 UStr & UStr::operator<<(const char *addToStr)
00271 {
00272     if(addToStr == 0L)
00273         return *this;
00274
00275     if(str == 0L)
00276     {
00277         *this = addToStr;
00278         return *this;
00279     }
00280
00281     unsigned int len = strlen(addToStr);
00282     if(len == 0)
00283         return *this;
00284
00285     unsigned int curlen = length();
00286     char *newstr = (char *)malloc((len + curlen + 1) * sizeof(char));
00287     if(newstr == 0L)
00288         UTHROW(std::bad_alloc());
00289     memcpy(newstr, str, curlen * sizeof(char));
00290     memcpy(newstr + curlen, addToStr, len * sizeof(char));
00291     newstr[len + curlen] = '\0';
00292
00293     if(str != 0L)
00294         free(str);
00295     str = newstr;
00296
00297     return *this;
00298 }
00299
00300 UStr & UStr::operator<<(char addToStr)
00301 {
00302     char astr[2] = {'\0', '\0'};
00303     astr[0] = addToStr;
00304     return *this << astr;
00305 }
00306
00307 UStr & UStr::operator<<(int addToStr)
00308 {
00309     char astr[50];
00310     sprintf(astr, "%d", addToStr);
00311     return *this << astr;
00312 }
00313
00314 bool UStr::operator<(const UStr & str) const
00315 {
00316     return strcmp(*this, str) < 0;
00317 }
00318
00319 bool UStr::operator>(const UStr & str) const
00320 {
00321     return strcmp(*this, str) > 0;
00322 }
00323
00324 bool UStr::operator==(const UStr & str) const
00325 {
00326     return strcmp(*this, str) == 0;
00327 }
00328
00329 bool UStr::operator==(const char *str) const
00330 {
00331     return strcmp(*this, str) == 0;
00332 }
00333
00334 bool UStr::operator!=(const UStr & str) const
00335 {
00336     return strcmp(*this, str) != 0;
00337 }
00338
00339 bool UStr::operator!=(const char *str) const
00340 {
00341     return strcmp(*this, str) != 0;
00342 }
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/ustr.h Source File

rf/ustr.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #ifndef USTR_H
00022 #define USTR_H
00023
00024 #include "uconfig.h"
00025
00026 #ifdef __GNUC__
00027 #   define EGCS_CONST const
00028 #else
00029 #   define EGCS_CONST
00030 #endif
00031
00032 #include <string.h>
00033
00039 class UEXPORT UPStr
00040 {
00041 public :
00042     inline UPStr() : str(0L) {}
00043     inline UPStr(const char *newstr)
00044     {
00045         str = 0L;
00046         *this = newstr;
00047     }
00048     inline UPStr(const unsigned char *newstr)
00049     {
00050         str = 0L;
00051         *this = newstr;
00052     }
00053     inline UPStr(const UPStr & newstr)
00054     {
00055         str = 0L;
00056         *this = newstr;
00057     }
00058     virtual ~UPStr() {flush();}
00059
00060     inline bool empty(void) const {return str == 0L || str[0] == '\0';}
00061     inline unsigned int length(void) const {return str == 0L ? 0 : (unsigned char)str[0];}
00062
00064     const char *operator=(const char *newstr);
00066     const unsigned char *operator=(const unsigned char *newstr);
00068     const UPStr & operator=(const UPStr & newstr);
00070     const UPStr & set(const char *buf, unsigned int len);
00071
00073     inline operator const char *() const {return str == 0L ? "" : str + 1;}
00075     inline operator char *() EGCS_CONST {return str == 0L ? 0L : str + 1;}
00077     inline const char *c_str() const {return str == 0L ? "" : str + 1;}
00078
00080     inline operator const unsigned char *() const
00081         {return str == 0L ? (unsigned char *)"" : (unsigned char *)str;}
00083     inline operator unsigned char *() EGCS_CONST
00084         {return str == 0L ? (unsigned char *)"" : (unsigned char *)str;}
00086     inline const unsigned char *p_str() const
00087         {return str == 0L ? (unsigned char *)"" : (unsigned char *)str;}
00088
00090     UPStr & operator<<(const char *addToStr);
00092     UPStr & operator<<(char addToStr);
00094     UPStr & operator<<(int addToStr);
00095
00096     inline bool endsWith(char c) const {return str == 0L ? false : str[str[0]] == c;}
00097
00099     const UPStr & replace(char which, char bywhich);
00100
00101 protected :
00102     void flush(void);
00103
00105     char *str;
00106 };
00107
00113 class UEXPORT UStr
00114 {
00115 public :
00116     inline UStr() : str(0L) {}
00117     inline UStr(const char *newstr)
00118     {
00119         str = 0L;
00120         *this = newstr;
00121     }
00122     inline UStr(const unsigned char *newstr)
00123     {
00124         str = 0L;
00125         set((const char *)newstr + 1, newstr[0]);
00126     }
00127     inline UStr(const UStr & newstr)
00128     {
00129         str = 0L;
00130         *this = newstr;
00131     }
00132     virtual ~UStr() {flush();}
00133
00134     inline bool empty(void) const {return str == 0L || str[0] == '\0';}
00135     inline unsigned int length(void) const {return str == 0L ? 0 : strlen(str);}
00136
00138     const char *operator=(const char *newstr);
00140     const char *operator=(const unsigned char *newstr);
00142     const UStr & operator=(const UStr & newstr);
00144     const UStr & set(const char *buf, unsigned int len);
00145
00147     bool operator<(const UStr & str) const;
00149     bool operator>(const UStr & str) const;
00151     bool operator==(const UStr & str) const;
00153     bool operator==(const char *str) const;
00155     bool operator!=(const UStr & str) const;
00157     bool operator!=(const char *str) const;
00158
00159 #if (defined(__MWERKS__) && __MWERKS__ < 0x2400) || defined(__GNUC__)
00160     inline char operator[](int index) const { return str[index]; }
00161     inline char & operator[](int index) { return str[index]; }
00162 #endif /* macintosh */
00163
00165     inline operator const char *() const { return str == 0L ? "" : str; }
00167     inline operator char *() EGCS_CONST { return str == 0L ? 0L : str; }
00169     inline const char *c_str() const { return str == 0L ? "" : str; }
00170
00172     UStr & operator<<(const char *addToStr);
00174     UStr & operator<<(char addToStr);
00176     UStr & operator<<(int addToStr);
00177
00179     inline int compare(const char *thestr) const { return strcmp(*this, thestr); }
00180
00181     inline bool endsWith(char c) const {return !length() ? false : str[length()-1] == c;}
00182
00184     const UStr & replace(char which, char bywhich);
00185
00186 protected :
00187     void flush(void);
00189     char *str;
00190 };
00191
00192 #endif /* USTR_H */
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/utoolbar.cpp Source File

rf/utoolbar.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #include "stdafx.h"
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026
00027 #include <stdlib.h>
00028 #include <stdio.h>
00029 #include <math.h>
00030 #include <string.h>
00031 #include <float.h>
00032
00033 #ifdef HAVE_MALLOC_H
00034 #include <malloc.h>
00035 #endif
00036
00037 #include "utoolbar.h"
00038 #include "uconsole.h"
00039
00040 #include <vector>
00041 #include <map>
00042
00043 #if qGTK
00044     extern "C" GtkWidget* create_pixmap(GtkWidget *widget, const gchar *filename);
00045 #endif
00046
00047 #if defined(_DEBUG) && defined(WIN32)
00048 #   define new DEBUG_NEW
00049 #   undef THIS_FILE
00050     static char THIS_FILE[] = __FILE__;
00051 #endif
00052
00053 #ifndef NEW
00054 #define NEW new
00055 #endif
00056
00057 UIMPLEMENT_DYNAMIC(UToolbar, UWidget)
00058
00059 UBEGIN_MESSAGE_MAP(UToolbar, UWidget)
00060     ON_UPDATEUI(UToolbar)
00061     ON_UCOMMAND_RANGE(0, 0xFFFF, UToolbar::OnCommands)
00062     ON_UDESTROY(UToolbar)
00063     ON_TB_INIT(UToolbar)
00064     ON_TB_END(UToolbar)
00065     ON_TB_BUTTON(UToolbar)
00066     ON_TB_DROPDOWN(UToolbar)
00067     ON_TB_CHECKBTN(UToolbar)
00068     ON_TB_SEPARATOR(UToolbar)
00069     ON_USETTOOLTIP(0, 0xFFFF, UToolbar::OnSetTooltip)
00070 UEND_MESSAGE_MAP()
00071
00072 typedef enum
00073 {
00074     tbeDropDown,
00075     tbeButton,
00076     tbeSeparator
00077 } tbeKind;
00078
00079 class TbEntry
00080 {
00081 public:
00082     TbEntry(tbeKind k) : kind(k) {}
00083     virtual ~TbEntry() {}
00084
00085     tbeKind kind;
00086 };
00087
00088 #ifndef WIN32
00089     typedef void *HBITMAP;
00090 #endif
00091
00092 typedef struct
00093 {
00094     int cnt;
00095     HBITMAP bitmap;
00096 } AREF;
00097
00098 class aref
00099 {
00100 public:
00101     aref() : ref(0L)
00102     {
00103     }
00104     aref(HBITMAP b)
00105     {
00106         ref = NEW AREF;
00107         ref->cnt = 1;
00108         ref->bitmap = b;
00109     }
00110     aref(const aref & src)
00111     {
00112         ref = src.Ref();
00113     }
00114     virtual ~aref()
00115     {
00116         UnRef();
00117     }
00118     AREF *Ref(void) const
00119     {
00120         if(ref != 0L)
00121             ref->cnt++;
00122         return ref;
00123     }
00124     AREF *UnRef(void) const
00125     {
00126         if(ref != 0L && --ref->cnt == 0)
00127         {
00128 #ifdef WIN32
00129             if(ref->bitmap != 0L)
00130                 ::DeleteObject(ref->bitmap);
00131 #endif
00132             delete ref;
00133             ((aref *)this)->ref = 0L;
00134         }
00135         return ref;
00136     }
00137     aref & operator=(const aref & src)
00138     {
00139         UnRef();
00140         ref = src.Ref();
00141         return *this;
00142     }
00143     operator HBITMAP()
00144     {
00145         return ref != 0L ? ref->bitmap : 0L;
00146     }
00147 protected:
00148     AREF *ref;
00149 };
00150
00151 class awidget
00152 {
00153 public:
00154     awidget(HBITMAP b, int c, const char *t, UTB_VAR v) :
00155         bitmap(b), cmd(c), tooltip(0L), var(v)
00156     {
00157         if(t != 0L)
00158             tooltip = strdup(t);
00159     }
00160     awidget() : bitmap(0L), cmd(0), tooltip(0L)
00161     {
00162     }
00163     awidget(const awidget & src)
00164     {
00165         *this = src;
00166     }
00167
00168     virtual ~awidget()
00169     {
00170         if(tooltip != 0L)
00171             free(tooltip);
00172     }
00173
00174     awidget & operator=(const awidget & src)
00175     {
00176         bitmap = src.bitmap;
00177         cmd = src.cmd;
00178         var = src.var;
00179         tooltip = src.tooltip != 0L ? strdup(src.tooltip) : 0L;
00180
00181         return *this;
00182     }
00183     aref bitmap;
00184     int cmd;
00185     char *tooltip;
00186     UTB_VAR var;
00187 };
00188
00189 class TbEntryButton : public TbEntry
00190 {
00191 public:
00192     TbEntryButton(HBITMAP b, int c, const char *t, UTB_VAR v) :
00193         TbEntry(tbeButton), wid(b, c, t, v), ischeck(false)
00194     {
00195     }
00196     virtual ~TbEntryButton()
00197     {
00198     }
00199
00200     awidget wid;
00201     bool ischeck;
00202 };
00203
00204 class TbEntryChkButton : public TbEntryButton
00205 {
00206 public:
00207     TbEntryChkButton(HBITMAP b, int c, const char *t, UTB_VAR v) :
00208         TbEntryButton(b, c, t, v)
00209     {
00210         ischeck = true;
00211     }
00212     virtual ~TbEntryChkButton()
00213     {
00214     }
00215 };
00216
00217 class TbEntryDropDown : public TbEntry
00218 {
00219 public:
00220     TbEntryDropDown() : TbEntry(tbeDropDown), current(0) {}
00221     virtual ~TbEntryDropDown()
00222     {
00223     }
00224
00225     std::vector<awidget> icons;
00226     int current;
00227 };
00228
00229 class TbEntrySeparator : public TbEntry
00230 {
00231 public:
00232     TbEntrySeparator() : TbEntry(tbeSeparator) {}
00233     virtual ~TbEntrySeparator()
00234     {
00235     }
00236 };
00237
00238 class WININFO
00239 {
00240 public:
00241     WININFO(int w, int h) : width(w), height(h) {}
00242     virtual ~WININFO()
00243     {
00244         std::vector<TbEntry *>::iterator i;
00245         for(i = entries.begin(); i != entries.end(); ++i)
00246         {
00247             delete (*i);
00248         }
00249     }
00250
00251     std::vector<TbEntry *>::iterator Search(int cmd, int *dropindex = 0L)
00252     {
00253         std::vector<TbEntry *>::iterator i;
00254         for(i = entries.begin(); i != entries.end(); ++i)
00255         {
00256             TbEntry * entry = (*i);
00257             if(entry->kind == tbeDropDown)
00258             {
00259                 TbEntryDropDown *drop = (TbEntryDropDown *)entry;
00260                 std::vector<awidget>::iterator j;
00261                 int index;
00262
00263                 for(j = drop->icons.begin(), index = 0; j != drop->icons.end(); ++j, index++)
00264                 {
00265                     if((*j).cmd == cmd)
00266                     {
00267                         if(dropindex != 0L)
00268                             *dropindex = index;
00269                         return i;
00270                     }
00271                 }
00272             }
00273             else if(entry->kind == tbeButton)
00274             {
00275                 TbEntryButton *btn = (TbEntryButton *)entry;
00276                 if(btn->wid.cmd == cmd)
00277                     return i;
00278             }
00279         }
00280         return i;
00281     }
00282
00283     std::vector<TbEntry *> entries;
00284     int width, height;
00285 };
00286
00287 #ifdef WIN32
00288 class CColorMenu : public CMenu
00289 {
00290 public:
00291 // Operations
00292     void AppendColorMenuItem(UINT nID, awidget *what);
00293
00294 // Implementation
00295     virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMIS);
00296     virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
00297     CColorMenu(int width, int height);
00298     virtual ~CColorMenu();
00299
00300     int m_width;
00301     int m_height;
00302 };
00303
00304 CColorMenu::CColorMenu(int width, int height) : m_width(width), m_height(height)
00305 {
00306     VERIFY(CreatePopupMenu());
00307 }
00308
00309 CColorMenu::~CColorMenu()
00310 {
00311 }
00312
00313 void CColorMenu::AppendColorMenuItem(UINT nID, awidget *what)
00314 {
00315     VERIFY(AppendMenu(MF_ENABLED | MF_OWNERDRAW, nID, (LPCTSTR)what));
00316 }
00317
00318 void CColorMenu::MeasureItem(LPMEASUREITEMSTRUCT lpMIS)
00319 {
00320     // all items are of fixed size
00321     lpMIS->itemWidth = m_width + 4;
00322     lpMIS->itemHeight = m_height + 4;
00323 }
00324
00325 void CColorMenu::DrawItem(LPDRAWITEMSTRUCT lpDIS)
00326 {
00327     CDC* pDC = CDC::FromHandle(lpDIS->hDC);
00328     awidget *what = (awidget *)lpDIS->itemData;
00329
00330     if (!(lpDIS->itemState & ODS_SELECTED) &&
00331         (lpDIS->itemAction & ODA_SELECT))
00332     {
00333         COLORREF crHilite = ::GetSysColor(COLOR_MENU);
00334         CBrush br(crHilite);
00335         CRect r(lpDIS->rcItem);
00336         r.DeflateRect(1, 1);
00337         pDC->FrameRect(&r, &br);
00338     }
00339
00340     if (lpDIS->itemAction & ODA_DRAWENTIRE)
00341     {
00342         // Paint the color item in the color requested
00343         CRect r(lpDIS->rcItem);
00344         r.OffsetRect((r.Width() - m_width) / 2, (r.Height() - m_height) / 2);
00345         CDC memdc;
00346         memdc.CreateCompatibleDC(pDC);
00347         CBitmap bmap;
00348         VERIFY(bmap.Attach(what->bitmap));
00349         CBitmap *old = memdc.SelectObject(&bmap);
00350         pDC->BitBlt(r.left, r.top, r.Width(), r.Height(), &memdc, 0, 0, SRCCOPY);
00351         memdc.SelectObject(old);
00352         bmap.Detach();
00353         VERIFY(memdc.DeleteDC());
00354     }
00355
00356     if ((lpDIS->itemState & ODS_SELECTED) &&
00357         (lpDIS->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
00358     {
00359         // item has been selected - hilite frame
00360         COLORREF crHilite = ::GetSysColor(COLOR_HIGHLIGHT);
00361         CBrush br(crHilite);
00362         CRect r(lpDIS->rcItem);
00363         r.DeflateRect(1, 1);
00364         pDC->FrameRect(&r, &br);
00365     }
00366 }
00367
00368 IMPLEMENT_DYNAMIC(CDynToolBar, CCJToolBar)
00369
00370 BEGIN_MESSAGE_MAP(CDynToolBar, CCJToolBar)
00371     //{{AFX_MSG_MAP(CDynToolBar)
00372     ON_WM_DESTROY()
00373     //}}AFX_MSG_MAP
00374 END_MESSAGE_MAP()
00375
00376 CDynToolBar::CDynToolBar() : m_info(0L), m_bitmap(0L),
00377     m_tracking(false), m_widid(0)
00378 {
00379 }
00380
00381 CDynToolBar::~CDynToolBar()
00382 {
00383     //if(m_bitmap != 0L)
00384         //::DeleteObject(m_bitmap);
00385 }
00386
00387 void CDynToolBar::OnDestroy(void)
00388 {
00389     UEventSendMessage(GetPseudoID(), EV_DESTROY, 0, NULL);
00390
00391     CCJToolBar::OnDestroy();
00392 }
00393
00394 void CDynToolBar::OnDropDownButton(const NMTOOLBAR& nmtb, UINT nID, CRect rc)
00395 {
00396     std::vector<TbEntry *>::iterator f = m_info->Search(WINCMD_to_UCMD(nID));
00397     if(f == m_info->entries.end())
00398     {
00399         TRACE("Unknown id");
00400         return;
00401     }
00402
00403     TbEntryDropDown *entry = (TbEntryDropDown *)(*f);
00404     if(entry->kind != tbeDropDown)
00405     {
00406         TRACE("Unknown kind");
00407         return;
00408     }
00409
00410     CColorMenu menu(m_info->width, m_info->height);
00411     std::vector<awidget>::iterator i;
00412     for(i = entry->icons.begin(); i != entry->icons.end(); ++i)
00413     {
00414         menu.AppendColorMenuItem(UCMD_to_WINCMD((*i).cmd), i);
00415     }
00416
00417     m_tracking = true;
00418     menu.TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL,
00419         rc.left, rc.bottom, GetOwner(), &rc);
00420     m_tracking = false;
00421 }
00422 #endif
00423
00424 UToolbar::UToolbar(int widid) : UWidget(widid), m_winInfo(0L)
00425 #ifdef WIN32
00426     , m_wndToolBar(0L)
00427 #endif
00428 {
00429 }
00430
00431 UToolbar::~UToolbar()
00432 {
00433 }
00434
00435 void UToolbar::OnTbInit(UTB_INIT *info)
00436 {
00437     m_winInfo = NEW WININFO(info->widthbtn, info->heightbtn);
00438
00439 #ifdef WIN32
00440     WININFO & tb = *m_winInfo;
00441     m_wndToolBar = new CDynToolBar;
00442     CFrameWnd *f = m_wndToolBar->GetMainFrame();
00443     VERIFY(m_wndToolBar->Create(f, WS_CHILD | WS_VISIBLE | CBRS_TOP, info->winid));
00444     m_wndToolBar->SetBarStyle(m_wndToolBar->GetBarStyle() |
00445         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00446     m_wndToolBar->EnableDocking(CBRS_ALIGN_ANY);
00447     m_wndToolBar->SetWinInfo(m_winInfo);
00448     m_wndToolBar->SetPseudoID(GetWidID());
00449     f->DockControlBar(m_wndToolBar);
00450
00451     // configure the Win32 toolbar
00452     if(info->title != 0L)
00453         m_wndToolBar->SetWindowText(info->title);
00454     m_wndToolBar->SetSizes(CSize(info->widthbtn+7,info->heightbtn+6),
00455         CSize(info->widthbtn,info->heightbtn));
00456 #endif
00457 #ifdef qGTK
00458     void *wid = GetWidget(kUMainWidget);
00459     g_assert(wid != 0L && GTK_IS_TOOLBAR(wid));
00460 #endif
00461 }
00462
00463 #ifdef WIN32
00464 void UToolbar::RebuildBar(bool onlyBitmap)
00465 {
00466     WININFO & tb = *m_winInfo;
00467
00468     ASSERT(m_wndToolBar != 0L);
00469     // create the bitmap associated with the toolbar
00470     CClientDC dc(m_wndToolBar);
00471     CBitmap* pbmOld = NULL;
00472
00473     CDC dcDest;
00474     VERIFY(dcDest.CreateCompatibleDC(&dc));
00475     CDC dcSrc;
00476     VERIFY(dcSrc.CreateCompatibleDC(&dc));
00477
00478     std::vector<UINT> styles;
00479     std::vector<TbEntry *>::iterator i;
00480     int numicons = 0;
00481     for(i = tb.entries.begin(); i != tb.entries.end(); ++i)
00482     {
00483         TbEntry * entry = *i;
00484
00485         if(entry->kind == tbeDropDown)
00486         {
00487             TbEntryDropDown *drop = (TbEntryDropDown *)entry;
00488             styles.push_back(UCMD_to_WINCMD(drop->icons[drop->current].cmd));
00489             numicons++;
00490         }
00491         else if(entry->kind == tbeButton)
00492         {
00493             TbEntryButton *btn = (TbEntryButton *)entry;
00494             if(btn->wid.var != DDV_NONE)
00495             {
00496                 styles.push_back(UTB_SEPARATOR);
00497             }
00498             else
00499             {
00500                 numicons++;
00501                 styles.push_back(btn->wid.cmd);
00502             }
00503         }
00504         else if(entry->kind == tbeSeparator)
00505         {
00506             styles.push_back(UTB_SEPARATOR);
00507         }
00508         else
00509         {
00510             ASSERT(0);
00511         }
00512     }
00513
00514     if(!onlyBitmap)
00515     {
00516         // create the Win32 toolbar
00517         m_wndToolBar->SetButtons(styles.begin(), styles.size());
00518     }
00519
00520     CBitmap bdest;
00521     bdest.CreateCompatibleBitmap(&dc, tb.width * numicons, tb.height);
00522     ASSERT(bdest.m_hObject != NULL);
00523     CBitmap *pbmOldDest = dcDest.SelectObject(&bdest);
00524
00525     int cnt = 0, index = 0;
00526     for(i = tb.entries.begin(); i != tb.entries.end(); ++i, index++)
00527     {
00528         TbEntry * entry = *i;
00529         HBITMAP bmap = 0L;
00530         int cmd;
00531         bool dropdown = false;
00532         bool ischeck = false;
00533
00534         if(entry->kind == tbeDropDown)
00535         {
00536             TbEntryDropDown *drop = (TbEntryDropDown *)entry;
00537             bmap = drop->icons[drop->current].bitmap;
00538             cmd = drop->icons[drop->current].cmd;
00539             dropdown = true;
00540         }
00541         else if(entry->kind == tbeButton)
00542         {
00543             TbEntryButton *btn = (TbEntryButton *)entry;
00544             if(btn->wid.var != DDV_NONE)
00545             {
00546                 if(!onlyBitmap)
00547                 {
00548                     m_wndToolBar->SetButtonInfo(index, ID_SEPARATOR,
00549                         TBBS_SEPARATOR, tb.width);
00550                     CRect rect;
00551                     m_wndToolBar->GetItemRect(index, &rect);
00552                     /*VERIFY(Create("",
00553                             WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_OWNERDRAW,
00554                             rect, m_wndToolBar, UCMD_to_WINCMD(btn->wid.cmd)));*/
00555                 }
00556                 continue;
00557             }
00558
00559             bmap = btn->wid.bitmap;
00560             cmd = btn->wid.cmd;
00561             ischeck = btn->ischeck;
00562         }
00563         else if(entry->kind == tbeSeparator)
00564         {
00565             m_wndToolBar->SetButtonInfo(index, ID_SEPARATOR,
00566                 TBBS_SEPARATOR, 0);
00567             continue;
00568         }
00569         else
00570         {
00571             continue;
00572             ASSERT(0);
00573         }
00574
00575         if(bmap != 0L)
00576         {
00577             CBitmap bsrc;
00578             VERIFY(bsrc.Attach(bmap));
00579             CBitmap *pbmOldSrc = dcSrc.SelectObject(&bsrc);
00580
00581             dcDest.BitBlt(tb.width * cnt, 0, tb.width, tb.height,
00582                     &dcSrc, 0, 0, SRCCOPY);
00583             bsrc.Detach();
00584
00585             dcSrc.SelectObject(pbmOldSrc);
00586         }
00587
00588         DWORD dwStyle = m_wndToolBar->GetButtonStyle(index);
00589         if(ischeck)
00590         {
00591             dwStyle &= ~TBBS_BUTTON;
00592             dwStyle |= TBBS_CHECKBOX;
00593         }
00594         m_wndToolBar->SetButtonInfo(index, UCMD_to_WINCMD(cmd),
00595             dwStyle, cnt);
00596
00597         if(dropdown)
00598             m_wndToolBar->AddDropDownButton(UCMD_to_WINCMD(cmd), -1, TRUE);
00599
00600         cnt++;
00601     }
00602
00603     dcDest.SelectObject(pbmOldDest);
00604     VERIFY(dcDest.DeleteDC());
00605     VERIFY(dcSrc.DeleteDC());
00606
00607     HBITMAP finalbmap = (HBITMAP)bdest.Detach();
00608     m_wndToolBar->SetBitmap(finalbmap);
00609
00610     if(m_wndToolBar->m_bitmap != 0L)
00611         ::DeleteObject(m_wndToolBar->m_bitmap);
00612     m_wndToolBar->m_bitmap = finalbmap;
00613
00614 }
00615 #endif
00616
00617 void UToolbar::OnTbEnd(void)
00618 {
00619 #ifdef WIN32
00620     RebuildBar(false);
00621 #endif
00622 }
00623
00624 void UToolbar::OnTbButton(UTB_BUTTON *info)
00625 {
00626 #ifdef WIN32
00627     ASSERT(m_wndToolBar != 0L);
00628 #endif
00629
00630     WININFO & tb = *m_winInfo;
00631     HBITMAP bitmap = UMakeBitmap((char **)info->icon);
00632     TbEntryButton *btn = NEW TbEntryButton(bitmap, info->cmd,
00633         info->tooltip, info->varcode);
00634     tb.entries.push_back(btn);
00635
00636 #ifdef qGTK
00637     char status[256] = {'\0'};
00638     char prompt[256] = {'\0'};
00639
00640     strcpy(status, info->tooltip);
00641     char *cr = strchr(status, '\n');
00642     if(cr != 0L)
00643     {
00644         strcpy(prompt, cr + 1);
00645         *cr = '\0';
00646     }
00647     GtkToolbar *toolbar = GTK_TOOLBAR(GetWidget(kUMainWidget));
00648     GtkWidget *tmp_toolbar_icon = info->icon != 0L ?
00649         create_pixmap(GTK_WIDGET(toolbar), (const char *)info->icon) : 0L;
00650     GtkWidget *wid = gtk_toolbar_append_element(toolbar, GTK_TOOLBAR_CHILD_BUTTON, 0L,
00651                                                 prompt, status, 0L,
00652                                                 tmp_toolbar_icon, 0L, 0L);
00653     UEventSendMessage(GetWidID(), EV_INIT_WIDGET, info->cmd, wid);
00654 #endif
00655 }
00656
00657 void UToolbar::OnTbSeparator(void)
00658 {
00659 #ifdef WIN32
00660     ASSERT(m_wndToolBar != 0L);
00661 #endif
00662
00663     WININFO & tb = *m_winInfo;
00664     TbEntrySeparator *btn = NEW TbEntrySeparator();
00665     tb.entries.push_back(btn);
00666
00667 #ifdef qGTK
00668     GtkToolbar *toolbar = GTK_TOOLBAR(GetWidget(kUMainWidget));
00669     /*GtkWidget *wid = */gtk_toolbar_append_element(toolbar, GTK_TOOLBAR_CHILD_SPACE, 0L,
00670                                                 0L, 0L, 0L,
00671                                                 0L, 0L, 0L);
00672 #endif
00673 }
00674
00675 void UToolbar::OnTbDropDown(UTB_DROPDOWN *info)
00676 {
00677 #ifdef WIN32
00678     ASSERT(m_wndToolBar != 0L);
00679 #endif
00680
00681     WININFO & tb = *m_winInfo;
00682     TbEntryDropDown *drop = NEW TbEntryDropDown();
00683     tb.entries.push_back(drop);
00684     int current = 0;
00685
00686     UTB_BUTTON *btns = info->btns;
00687     while(btns->icon != 0L)
00688     {
00689         HBITMAP bitmap = UMakeBitmap((char **)btns->icon);
00690         awidget ad(bitmap, btns->cmd, btns->tooltip, btns->varcode);
00691         drop->icons.push_back(ad);
00692         if(btns->cmd == info->initialcmd)
00693             drop->current = current;
00694         btns++;
00695         current++;
00696     }
00697 }
00698
00699 void UToolbar::OnTbCheckBtn(UTB_BUTTON *info)
00700 {
00701 #ifdef WIN32
00702     ASSERT(m_wndToolBar != 0L);
00703 #endif
00704
00705     WININFO & tb = *m_winInfo;
00706     HBITMAP bitmap = UMakeBitmap((char **)info->icon);
00707     TbEntryButton *btn = NEW TbEntryChkButton(bitmap, info->cmd,
00708         info->tooltip, info->varcode);
00709     tb.entries.push_back(btn);
00710
00711 #ifdef qGTK
00712     char status[256] = {'\0'};
00713     char prompt[256] = {'\0'};
00714
00715     strcpy(status, info->tooltip);
00716     char *cr = strchr(status, '\n');
00717     if(cr != 0L)
00718     {
00719         strcpy(prompt, cr + 1);
00720         *cr = '\0';
00721     }
00722     GtkToolbar *toolbar = GTK_TOOLBAR(GetWidget(kUMainWidget));
00723     GtkWidget *tmp_toolbar_icon = info->icon != 0L ?
00724         create_pixmap(GTK_WIDGET(toolbar), (const char *)info->icon) : 0L;
00725     GtkWidget *wid = gtk_toolbar_append_element(toolbar, GTK_TOOLBAR_CHILD_TOGGLEBUTTON, 0L,
00726                                                 prompt, status, 0L,
00727                                                 tmp_toolbar_icon, 0L, 0L);
00728     UEventSendMessage(GetWidID(), EV_INIT_WIDGET, info->cmd, wid);
00729 #endif
00730 }
00731
00732
00733 void UToolbar::OnDestroy(void)
00734 {
00735     if(m_winInfo != 0L)
00736         delete m_winInfo;
00737 }
00738
00739 int UToolbar::UDispatchMessage(int/*UEventType*/ evt, int arg1, void *arg2, UDispatchInfo & dispatchInfo)
00740 {
00741     if(evt == EV_CMD)
00742     {
00743         WININFO *info = m_winInfo;
00744         if(info != 0L)
00745         {
00746             int index;
00747             std::vector<TbEntry *>::iterator f = info->Search(arg1, &index);
00748             if(f != info->entries.end())
00749             {
00750                 TbEntryDropDown *entry = (TbEntryDropDown *)*f;
00751                 if(entry->kind == tbeDropDown)
00752                 {
00753                     // toggle the current bitmap
00754                     if(entry->current != index)
00755                     {
00756                         entry->current = index;
00757 #ifdef WIN32
00758                         RebuildBar();
00759 #endif
00760                     }
00761                 }
00762             }
00763         }
00764     }
00765
00766     return UWidget::UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00767 }
00768
00769 void UToolbar::OnSetTooltip(int cmd, UCmdUI *pCmdUI)
00770 {
00771     WININFO *info = m_winInfo;
00772     if(info == 0L)
00773         return;
00774
00775     int index;
00776     std::vector<TbEntry *>::iterator f = info->Search(cmd, &index);
00777     if(f == info->entries.end())
00778         return;
00779
00780     TbEntry * entry = *f;
00781     if(entry->kind == tbeDropDown)
00782     {
00783         TbEntryDropDown *drop = (TbEntryDropDown *)entry;
00784         awidget & wid = drop->icons[index];
00785         pCmdUI->SetTooltip(wid.tooltip);
00786     }
00787     else if(entry->kind == tbeButton)
00788     {
00789         TbEntryButton *btn = (TbEntryButton *)entry;
00790         pCmdUI->SetTooltip(btn->wid.tooltip);
00791     }
00792 }
00793
00794 int UToolbar::OnCommands(int cmd)
00795 {
00796     static bool sSemaphore = false;
00797     USemaphore policeman(sSemaphore);
00798     if(policeman.IsEnteredTwice())
00799         return 1;
00800
00801     // this is the interesting thing about the toolbar : it resends the
00802     // commands to other widgets according to the focus information and
00803     // allows the command to be handled several times if the handler return 1
00804
00805     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00806     int res = 0;
00807     int handledFlag;
00808
00809     // first forward the command to the focused widget : if it soesn't want it
00810     // we give it to the next pseudo widget.
00811     if(sFocusWidID != -1 && sFocusWidID != GetWidID())
00812     {
00813         res = UEventSendMessageExt(sFocusWidID, EV_CMD, cmd, 0L, &handledFlag);
00814         if(res == 0 && handledFlag)
00815             return 0;
00816     }
00817
00818     STD map<int, UCmdTarget *>::const_iterator i;
00819     for(i = targets.begin(); i != targets.end(); ++i)
00820     {
00821         int widid = (*i).first;
00822         if(widid == sFocusWidID || widid == GetWidID())
00823             continue;
00824         res = UEventSendMessageExt(widid, EV_CMD, cmd, 0L, &handledFlag);
00825         if(res == 0 && handledFlag)
00826             return 0;
00827     }
00828
00829     UAppConsole("The cmd %d of the toolbar has no command handler\n", cmd);
00830
00831     return 0;
00832 }
00833
00834 void UToolbar::OnUpdateUI()
00835 {
00836 // on Windows the update UI is sent by MFC
00837 #ifndef WIN32
00838     WININFO *info = m_winInfo;
00839     if(info == 0L)
00840         return;
00841
00842     static bool sSemaphore = false;
00843     USemaphore policeman(sSemaphore);
00844     if(policeman.IsEnteredTwice())
00845         return;
00846
00847     // this is the interesting thing about the toolbar : it resends the
00848     // update UI to other widgets according to the focus information and
00849     // allows the update to be handled several times if the handler asks for it
00850     // (by using UCmdUI::SetContinue)
00851
00852     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00853     std::vector<TbEntry *>::const_iterator f;
00854     int cmdid;
00855
00856     for(f = info->entries.begin(); f != info->entries.end(); ++f)
00857     {
00858         TbEntry * entry = *f;
00859         if(entry->kind == tbeButton)
00860         {
00861             TbEntryButton *btn = (TbEntryButton *)entry;
00862             cmdid = btn->wid.cmd;
00863         }
00864         else
00865             continue;
00866
00867         void *widget = GetWidget(cmdid);
00868         if(widget == 0L)
00869             continue;
00870
00871         // first forward the command to the focused widget : if it doesn't want it
00872         // we give it to the next pseudo widget.
00873         if(sFocusWidID != -1 && sFocusWidID != GetWidID())
00874         {
00875             UCmdUI pUI(cmdid);
00876             pUI.m_widget = widget;
00877             UEventSendMessage(sFocusWidID, EV_UPDTCMD, pUI.m_nID, &pUI);
00878             if(!pUI.CanContinue())
00879                 continue;
00880         }
00881
00882         STD map<int, UCmdTarget *>::const_iterator i;
00883         for(i = targets.begin(); i != targets.end(); ++i)
00884         {
00885             int widid = (*i).first;
00886             if(widid == sFocusWidID || widid == GetWidID())
00887                 continue;
00888
00889             UCmdUI pUI(cmdid);
00890             pUI.m_widget = widget;
00891             UEventSendMessage(widid, EV_UPDTCMD, pUI.m_nID, &pUI);
00892             if(!pUI.CanContinue())
00893                 break;
00894         }
00895         if(i == targets.end())
00896         {
00897             //UAppConsole("The cmd %d of the toolbar has no update handler, it's gonna be disabled\n", cmdid);
00898             UCmdUI pUI(cmdid);
00899             pUI.m_widget = widget;
00900             pUI.Enable(false);
00901         }
00902     }
00903 #endif // !WIN32
00904 }
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/utoolbar.h Source File

rf/utoolbar.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #ifndef UTOOLBAR_H
00022 #define UTOOLBAR_H
00023
00024 #include "uwidget.h"
00025
00026 #ifdef __cplusplus
00027
00028 class WININFO;
00029
00030 #ifdef __AFX_H__
00031 class CDynToolBar : public CCJToolBar
00032 {
00033     DECLARE_DYNAMIC(CDynToolBar)
00034
00035 // Construction
00036 public:
00037     CDynToolBar();
00038
00039 // Attributes
00040 public:
00041 protected:
00042
00043 // Operations
00044 public:
00045
00046 // Overrides
00047     // ClassWizard generated virtual function overrides
00048     //{{AFX_VIRTUAL(CDynToolBar)
00049     //}}AFX_VIRTUAL
00050
00051 // Implementation
00052 public:
00053     virtual ~CDynToolBar();
00054
00055     HBITMAP m_bitmap;
00056     bool m_tracking;
00057
00058     inline int GetPseudoID(void) const { return m_widid; }
00059     inline void SetPseudoID(int id) { m_widid = id; }
00060     inline WININFO *GetWinInfo(void) const { return m_info; }
00061     inline void SetWinInfo(WININFO *info) { m_info = info; }
00062     inline CFrameWnd *GetMainFrame() { return GetRoutingFrame(); }
00063
00064 // Generated message map functions
00065 protected:
00066     WININFO *m_info;
00067     int m_widid;
00068
00069     virtual void OnDropDownButton(const NMTOOLBAR& nmtb, UINT nID, CRect rc);
00070
00071     //{{AFX_MSG(CDynToolBar)
00072     afx_msg void OnDestroy(void);
00073     //}}AFX_MSG
00074     DECLARE_MESSAGE_MAP()
00075
00076 };
00077 #else /* ! __AFX_H__ */
00078 class CDynToolBar;
00079 #endif /* !__AFX_H__ */
00080
00081 class UToolbar : public UWidget
00082 {
00083     UDECLARE_DYNAMIC(UToolbar)
00084 public:
00085     UToolbar(int widid);
00086     virtual ~UToolbar();
00087
00088     virtual int UDispatchMessage(int/*UEventType*/ evt, int arg1, void *arg2, UDispatchInfo & dispatchInfo);
00089
00090 protected:
00091     ev_msg void OnDestroy();
00092     ev_msg void OnTbInit(UTB_INIT *info);
00093     ev_msg void OnTbEnd(void);
00094     ev_msg void OnTbButton(UTB_BUTTON *info);
00095     ev_msg void OnTbDropDown(UTB_DROPDOWN *info);
00096     ev_msg void OnTbCheckBtn(UTB_BUTTON *info);
00097     ev_msg void OnTbSeparator(void);
00098     ev_msg void OnSetTooltip(int cmd, UCmdUI *pCmdUI);
00099     ev_msg int OnCommands(int cmd);
00100     ev_msg void OnUpdateUI(void);
00101
00102     WININFO *m_winInfo;
00103
00104 #ifdef WIN32
00105     CDynToolBar *m_wndToolBar;
00106
00107     void RebuildBar(bool onlyBitmap = true);
00108 #endif
00109
00110     UDECLARE_MESSAGE_MAP()
00111 };
00112 #endif /* __cplusplus */
00113
00114 #ifdef __cplusplus
00115 extern "C" {
00116 #endif
00117
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121
00122 #endif /* UTOOLBAR_H */
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/uwidget.cpp Source File

rf/uwidget.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #include "stdafx.h"
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026
00027 #include <stdio.h>
00028
00029 #include "uwidget.h"
00030 #include "uconsole.h"
00031 #include "udraw.h"
00032 #include "umenu.h"
00033
00034 #if qMacAPP
00035 #   include "UPseudoSupport.h"
00036 #   include "UButton.h"
00037 #   include "UDialogBehavior.h"
00038 #   include "URadio.h"
00039 #   include "UCheckbox.h"
00040 #   include "UNumberText.h"
00041 #   include "UPopup.h"
00042 #   include "UWindow.h"
00043 #   include "UViewServer.h"
00044 #   include "USlider.h"
00045 #   include "UDispatcher.h"
00046 #   include "UTabbedView.h"
00047 #   include "UProgressIndicator.h"
00048 #endif
00049
00050 #ifdef qMacPP
00051 #   include "UPseudoSupport.h"
00052 #   include <LCheckBox.h>
00053 #   include <LRadioButton.h>
00054 #   include <LEditText.h>
00055 #   include <LStaticText.h>
00056 #   include <UModalDialogs.h>
00057 #   include <LPopupButton.h>
00058 #   include <LOutlineTable.h>
00059 #   include <LOutlineItem.h>
00060 #   include <UTableHelpers.h>
00061 #   include <LTextTableView.h>
00062 #   include <LCheckBoxGroupBox.h>
00063 #   include <LPageController.h>
00064 #   include <LTabsControl.h>
00065 #endif
00066
00067 #ifdef WIN32
00068 #   include "PseudoDlg.h"
00069 #   include "PseudoButton.h"
00070 #endif
00071
00072 #if defined(_DEBUG) && defined(WIN32)
00073 #   define new DEBUG_NEW
00074 #   undef THIS_FILE
00075     static char THIS_FILE[] = __FILE__;
00076 #endif
00077
00078 #ifndef NEW
00079 #   define NEW new
00080 #endif
00081
00082 UIMPLEMENT_DYNAMIC(UWidget, UCmdTarget)
00083
00084 UBEGIN_MESSAGE_MAP(UWidget, UCmdTarget)
00085     ON_UPDATEUI(UWidget)
00086     ON_UPDATEFOCUS(UWidget)
00087     ON_INIT_WIDGET(UWidget, 0, 0xFFFF)
00088     ON_INIT_TAB_WIDGET(UWidget, 0, 0xFFFF)
00089     ON_PAGE_CHANGED(UWidget, 0, 0xFFFF)
00090     ON_FETCHCMD(UWidget, 0, 0xFFFF)
00091     ON_QUERYSTATE(0, 0xFFFF, UWidget::OnGetState)
00092     ON_SETSTATE(0, 0xFFFF, UWidget::OnSetState)
00093     ON_ENABLECMD(0, 0xFFFF, UWidget::OnEnableCmd)
00094     ON_CHGFOCUS(UWidget, 0, 0xFFFF)
00095     ON_INVALIDATE(UWidget, 0, 0xFFFF)
00096     ON_REDRAW(UWidget, 0, 0xFFFF)
00097     ON_SHOW_WIDGET_RANGE(0, 0xFFFF, UWidget::OnShowWidget)
00098     ON_SETTEXT(0, 0xFFFF, UWidget::OnSetText)
00099     ON_GETTEXT(0, 0xFFFF, UWidget::OnGetText)
00100     ON_SETFLOAT(UWidget, 0, 0xFFFF)
00101     ON_GETFLOAT(UWidget, 0, 0xFFFF)
00102     ON_SET_SLIDER(UWidget, 0, 0xFFFF)
00103     ON_GET_SLIDERPROP(UWidget, 0, 0xFFFF)
00104     ON_SET_SLIDERPROP(UWidget, 0, 0xFFFF)
00105     ON_CHGCURSOR(UWidget, 0, 0xFFFF)
00106     ON_USETTOOLTIP(0, 0xFFFF, UWidget::OnSetTooltip)
00107     ON_USETLLOC(0, 0xFFFF, UWidget::OnSetLoc)
00108     ON_UGETLLOC(0, 0xFFFF, UWidget::OnGetLoc)
00109     ON_TREE_RESETALL(UWidget, 0, 0xFFFF)
00110     ON_TREE_INSERT(UWidget, 0, 0xFFFF)
00111     ON_TREE_GETINFO(UWidget, 0, 0xFFFF)
00112     ON_TREE_DELETE(UWidget, 0, 0xFFFF)
00113     ON_TREE_EXPAND(UWidget, 0, 0xFFFF)
00114     ON_TREE_SELECT(UWidget, 0, 0xFFFF)
00115     ON_TREE_SETDATA(UWidget, 0, 0xFFFF)
00116     ON_TREE_SETICON(UWidget, 0, 0xFFFF)
00117     ON_TREE_GETSEL(UWidget, 0, 0xFFFF)
00118     ON_LIST_SETCOLTITLE(UWidget, 0, 0xFFFF)
00119     ON_LIST_SETCOLTITLE(UWidget, 0, 0xFFFF)
00120     ON_LIST_SETCOLWIDTH(UWidget, 0, 0xFFFF)
00121     ON_LIST_RESETALL(UWidget, 0, 0xFFFF)
00122     ON_LIST_ADDSEL(UWidget, 0, 0xFFFF)
00123     ON_LIST_DELROW(UWidget, 0, 0xFFFF)
00124     ON_LIST_SETFEEDBACK(UWidget, 0, 0xFFFF)
00125     ON_LIST_NEWROW(UWidget, 0, 0xFFFF)
00126     ON_LIST_INSERT(UWidget, 0, 0xFFFF)
00127     ON_LIST_ROWSETDATA(UWidget, 0, 0xFFFF)
00128     ON_LIST_ROWGETDATA(UWidget, 0, 0xFFFF)
00129     ON_LIST_GETNEXTSEL(UWidget, 0, 0xFFFF)
00130     ON_LIST_GETNEXT(UWidget, 0, 0xFFFF)
00131     ON_LIST_GETINFO(UWidget, 0, 0xFFFF)
00132     ON_LIST_ADDCOLUMNS(UWidget, 0, 0xFFFF)
00133     ON_LIST_RESORT(UWidget, 0, 0xFFFF)
00134     ON_COMBO_RESETALL(UWidget, 0, 0xFFFF)
00135     ON_COMBO_APPEND(UWidget, 0, 0xFFFF)
00136     ON_COMBO_SETSEL(UWidget, 0, 0xFFFF)
00137     ON_COMBO_GETSEL(UWidget, 0, 0xFFFF)
00138     ON_COMBO_GETCOUNT(UWidget, 0, 0xFFFF)
00139     ON_COMBO_DELSEL(UWidget, 0, 0xFFFF)
00140     ON_COMBO_ENABLESEL(UWidget, 0, 0xFFFF)
00141     ON_COMBO_GETMENU(UWidget, 0, 0xFFFF)
00142 UEND_MESSAGE_MAP()
00143
00144 bool UWidget::sValidMenu = false;
00145 int UWidget::sFocusWidID = -1;
00146 int UWidget::sFocusCmdID;
00147
00148 bool UWidget::IsUIValid() { return sValidMenu; }
00149 void UWidget::DoValidUI(bool how) { sValidMenu = how; }
00150 int UWidget::GetFocus(void) { return sFocusWidID; }
00151 int UWidget::GetFocusCmd(void) { return sFocusCmdID; }
00152
00153 #if qGTK
00154 extern "C"
00155 {
00156     static void gtkdestroy(GtkWidget *widget, gpointer user_data)
00157     {
00158         UWidget *wid = (UWidget *)user_data;
00159         UEventSendMessage(wid->GetWidID(), EV_DESTROY, 0, 0L);
00160     }
00161
00162     static int gtkkeypress(GtkWidget *widget, GdkEventKey * event, gpointer user_data)
00163     {
00164         UWidget *wid = (UWidget *)user_data;
00165         UEventSendMessage(wid->GetWidID(), EV_KEYDOWN, event->keyval, 0L);
00166         return FALSE;
00167     }
00168
00169     static guint focus_in_signal_id;
00170     static guint focus_out_signal_id;
00171
00172     static gboolean gtkeventwatcher(GtkObject *object, guint signal_id, guint n_params, GtkArg *params, gpointer data)
00173     {
00174 #if 0
00175         g_print ("Watch: \"%s\" emitted for %s\n",
00176                  gtk_signal_name (signal_id),
00177                  gtk_type_name (GTK_OBJECT_TYPE (object)));
00178 #endif
00179
00180         // for a tree, we are interested to know about the tree, not just the item
00181         if(GTK_IS_TREE_ITEM(object))
00182         {
00183             GtkTree *parent = GTK_TREE(GTK_WIDGET(object)->parent);
00184             // now find the upper tree
00185             while(1)
00186             {
00187                 gpointer data = gtk_object_get_data(GTK_OBJECT(parent), "rf_treeparent");
00188                 if(data != 0L)
00189                     parent = GTK_TREE(GTK_WIDGET(data)->parent);
00190                 else
00191                     break;
00192             }
00193             object = GTK_OBJECT(parent);
00194         }
00195
00196         if(signal_id == focus_out_signal_id)
00197         {
00198             UEventNotifyMessage(EV_UPDATEFOCUS, 1, object);
00199         }
00200         else if(signal_id == focus_in_signal_id)
00201         {
00202             UEventNotifyMessage(EV_UPDATEFOCUS, 0, object);
00203         }
00204
00205         return TRUE;
00206     }
00207
00208     static void gtkmaindoevent(GdkEvent *event)
00209     {
00210         gtk_main_do_event(event);
00211
00212         switch(event->type)
00213         {
00214         case GDK_BUTTON_PRESS:
00215         case GDK_2BUTTON_PRESS:
00216         case GDK_3BUTTON_PRESS:
00217         case GDK_BUTTON_RELEASE:
00218         case GDK_KEY_PRESS:
00219         case GDK_KEY_RELEASE:
00220         case GDK_FOCUS_CHANGE:
00221             UWidget::DoValidUI(false);
00222             break;
00223         default:
00224             break;
00225         }
00226     }
00227
00228     static void gtkclicked(GtkButton *button, gpointer user_data)
00229     {
00230         int widid = ULOWORD((int)user_data);
00231         int cmdid = UHIWORD((int)user_data);
00232         UEventSendMessage(widid, EV_CMD, cmdid, 0L);
00233     }
00234
00235     static void gtkmenuitemactivate(GtkMenuItem *menuitem, gpointer user_data)
00236     {
00237         int widid = ULOWORD((int)user_data);
00238         int cmdid = UHIWORD((int)user_data);
00239         UEventSendMessage(widid, EV_CMD, cmdid, 0L);
00240     }
00241
00242     static void gtkselectclist(GtkWidget *clist, gint row, gint column,
00243                                GdkEventButton *event, gpointer user_data)
00244     {
00245         int widid = ULOWORD((int)user_data);
00246         int cmdid = UHIWORD((int)user_data);
00247         gchar *text;
00248         gtk_clist_get_text(GTK_CLIST(clist), row, column, &text);
00249         UEventSendMessage(widid, EV_LIST_SELECTING, UMAKEINT(cmdid, row), text);
00250     }
00251
00252     static void gtkselectclistcolumn(GtkCList *clist, gint column, gpointer user_data)
00253     {
00254         int widid = ULOWORD((int)user_data);
00255         int cmdid = UHIWORD((int)user_data);
00256         UEventSendMessage(widid, EV_LIST_SELCOLUMN, UMAKEINT(cmdid, column), 0L);
00257     }
00258
00259     static gint gtkclistdblclick(GtkWidget *widget, GdkEventButton *event, gpointer data)
00260     {
00261         int widid = ULOWORD((int)data);
00262         int cmdid = UHIWORD((int)data);
00263         if (event->type == GDK_2BUTTON_PRESS)
00264         {
00265             UEventSendMessage(widid, EV_LIST_DBLCLICK, cmdid, 0L);
00266             return FALSE;
00267         }
00268         return TRUE;
00269     }
00270
00271     static void gtkcomboclicked(GtkWidget *widget, gpointer user_data)
00272     {
00273         int widid = ULOWORD((int)user_data);
00274         int cmdid = UHIWORD((int)user_data);
00275
00276         GtkList *list = GTK_LIST(widget->parent);
00277         GList *selection = list->selection;
00278         int count = -1;
00279         UStr selTxt;
00280         if (selection)
00281         {
00282             GtkBin *bin = GTK_BIN( selection->data );
00283             gchar *txt;
00284             gtk_label_get(GTK_LABEL(bin->child), &txt);
00285             selTxt = txt;
00286             GList *child = list->children;
00287             count = 0;
00288             while (child)
00289             {
00290                 if (child->data == selection->data)
00291                     break;
00292                 count++;
00293                 child = child->next;
00294             }
00295             g_assert(child != 0L);
00296         }
00297         UEventSendMessage(widid, EV_COMBO_SEL, UMAKEINT(cmdid, count), (void *)(const char *)selTxt);
00298     }
00299
00300     GtkLabel *getLabelFromContainer(GtkContainer *w)
00301     {
00302         GList *list = gtk_container_children(w);
00303         GtkLabel *label = 0L;
00304         while(list != 0L)
00305         {
00306             GtkWidget *wid = GTK_WIDGET(list->data);
00307             if(GTK_IS_LABEL(wid))
00308             {
00309                 label = GTK_LABEL(wid);
00310                 break;
00311             }
00312             list = (GList *)g_list_next(list);
00313         }
00314         return label;
00315     }
00316
00317     static void gtkmenuactivated(GtkWidget *widget, gpointer user_data)
00318     {
00319         int widid = ULOWORD((int)user_data);
00320         int cmdid = UHIWORD((int)user_data);
00321
00322         UStr selTxt;
00323
00324         // fix me: where to find the label of the item ?
00325 #if 1
00326         selTxt = (char *)gtk_object_get_data(GTK_OBJECT(widget), "rf_menuitemtext");
00327 #else
00328         GtkLabel *label = getLabelFromContainer(GTK_CONTAINER(widget));
00329         gchar *txt;
00330         gtk_label_get(label, &txt);
00331         selTxt = txt;
00332 #endif
00333
00334         GtkMenu *menu = GTK_MENU(widget->parent);
00335         GList *list = GTK_MENU_SHELL(menu)->children;
00336         int count = 0;
00337         while(list != 0L)
00338         {
00339             GtkWidget *wid = GTK_WIDGET(list->data);
00340             if(wid == widget)
00341                 break;
00342             list = (GList *)g_list_next(list);
00343             count++;
00344         }
00345         g_assert(list != 0L);
00346         UEventSendMessage(widid, EV_COMBO_SEL, UMAKEINT(cmdid, count), (void *)(const char *)selTxt);
00347     }
00348
00349     static gint gtkcancel(GtkWidget *widget, gpointer user_data)
00350     {
00351         static bool sSemaphore = false;
00352         USemaphore policeman(sSemaphore);
00353         if(policeman.IsEnteredTwice())
00354             return TRUE;
00355
00356         UWidget *wid = (UWidget *)user_data;
00357         wid->EndModal(false);
00358         return FALSE;
00359     }
00360
00361     static bool matchToken(const char *str, int &cmd)
00362     {
00363         if(str == 0L)
00364             return false;
00365
00366         const char *origStr = str;
00367         size_t len = strlen(kUgtkPrefixToken);
00368         if(strncmp(str, kUgtkPrefixToken, len) != 0)
00369             return false;
00370
00371         str += len;
00372         if(*str && *str != '_')
00373             str++;
00374         if(*str && *str == '_')
00375             str++;
00376
00377         if(sscanf(str, "%d", &cmd) == 1 && cmd >=0 && cmd < (32767 - EV_COMMAND_START))
00378         {
00379             cmd += EV_COMMAND_START;
00380             return true;
00381         }
00382         else
00383             g_warning("The widget '%s' has a wrong pseudo command '%d'\n", origStr, cmd);
00384
00385         return false;
00386     }
00387
00388     static void dataForeach(GQuark key_id, gpointer data, gpointer user_data)
00389     {
00390         const char *str = g_quark_to_string(key_id);
00391         int id = (int)user_data;
00392         int cmd;
00393         if(matchToken(str, cmd))
00394         {
00395             UASSERT(GTK_IS_WIDGET(data));
00396
00397             GtkWidget *w = (GtkWidget *)data;
00398             w = w->parent;
00399             while(w != 0L)
00400             {
00401                 if(GTK_IS_NOTEBOOK(w))
00402                 {
00403                     // don't extract widgets children of a notebook at this point
00404                     return;
00405                 }
00406                 w = w->parent;
00407             }
00408
00409             UEventSendMessage(id, EV_INIT_WIDGET, cmd, data);
00410         }
00411     }
00412
00413     typedef struct
00414     {
00415         int widid;
00416         int pageid;
00417         int pagenum;
00418     } _dataTabForeach;
00419
00420     static void dataTabForeach(GQuark key_id, gpointer data, gpointer user_data)
00421     {
00422         const char *str = g_quark_to_string(key_id);
00423         _dataTabForeach *mydata = (_dataTabForeach *)user_data;
00424         int cmd;
00425         if(matchToken(str, cmd))
00426         {
00427             UASSERT(GTK_IS_WIDGET(data));
00428             GtkWidget *w = (GtkWidget *)data;
00429             w = w->parent;
00430             while(w != 0L)
00431             {
00432                 if(GTK_IS_NOTEBOOK(w))
00433                 {
00434                     break;
00435                 }
00436                 w = w->parent;
00437             }
00438             if(w == 0L)
00439             {
00440                 // this is not a child of a notebook
00441                 return;
00442             }
00443
00444             gchar *name = gtk_widget_get_name(w);
00445             int pagecmd;
00446             if(!matchToken(name, pagecmd) || pagecmd != mydata->pageid)
00447                 return;
00448
00449             GtkNotebook *n = GTK_NOTEBOOK(w);
00450             w = (GtkWidget *)data;
00451             int pagenum = -1;
00452             while(w != 0L && pagenum == -1)
00453             {
00454                 int i = 0;
00455                 GtkWidget *p;
00456                 while((p = gtk_notebook_get_nth_page(n, i)) != 0L)
00457                 {
00458                     if(w == p)
00459                     {
00460                         pagenum = i;
00461                         break;
00462                     }
00463                     i++;
00464                 }
00465                 w = w->parent;
00466             }
00467
00468             if(pagenum == -1)
00469             {
00470                 g_warning("Could not find the page of the widget '%s'\n", str);
00471                 return;
00472             }
00473
00474             if(pagenum != mydata->pagenum)
00475                 return;
00476
00477             UEventSendMessage(mydata->widid, EV_INIT_WIDGET, cmd, data);
00478         }
00479     }
00480
00481     static void gtkpacktreeitem(GtkBox *m_box, const char *title, GtkPixmap *icon)
00482     {
00483         if(icon != 0L)
00484         {
00485             gtk_misc_set_alignment (GTK_MISC (icon), 0.0, 0.5);
00486             gtk_box_pack_start(m_box, GTK_WIDGET(icon), FALSE, FALSE, 0);
00487             gtk_widget_show (GTK_WIDGET(icon));
00488         }
00489
00490         GtkLabel *m_label_widget = GTK_LABEL(gtk_label_new (title != 0L ? title : ""));
00491         gtk_misc_set_alignment (GTK_MISC (m_label_widget), 0.5, 0.5);
00492         gtk_box_pack_start(m_box, GTK_WIDGET(m_label_widget), FALSE, FALSE, 0);
00493         gtk_widget_show (GTK_WIDGET(m_label_widget));
00494
00495         gtk_widget_show(GTK_WIDGET(m_box));
00496     }
00497
00498     static GtkTreeItem *gtknewtreeitem(const char *title, GtkPixmap *icon)
00499     {
00500         GtkTreeItem *item;
00501         item = GTK_TREE_ITEM(gtk_tree_item_new());
00502
00503         GtkHBox *m_box = GTK_HBOX(gtk_hbox_new(FALSE, 2));
00504         gtk_container_add (GTK_CONTAINER (item), GTK_WIDGET(m_box));
00505
00506         gtkpacktreeitem(GTK_BOX(m_box), title, icon);
00507
00508         return item;
00509     }
00510
00511     static void gtktreeexpand(GtkWidget *item, gpointer user_data)
00512     {
00513         int widid = ULOWORD((int)user_data);
00514         int cmdid = UHIWORD((int)user_data);
00515         g_assert(GTK_IS_TREE_ITEM(item));
00516         UEventSendMessage(widid, EV_TREE_EXPANDING, UMAKEINT(cmdid, 0), item);
00517     }
00518
00519     static void gtktreecollapse(GtkWidget *item, gpointer user_data)
00520     {
00521         int widid = ULOWORD((int)user_data);
00522         int cmdid = UHIWORD((int)user_data);
00523         g_assert(GTK_IS_TREE_ITEM(item));
00524         UEventSendMessage(widid, EV_TREE_EXPANDING, UMAKEINT(cmdid, 1), item);
00525     }
00526
00527     static void gtktreeselect(GtkWidget *item, gpointer user_data)
00528     {
00529         int widid = ULOWORD((int)user_data);
00530         int cmdid = UHIWORD((int)user_data);
00531         g_assert(GTK_IS_TREE_ITEM(item));
00532         UEventSendMessage(widid, EV_TREE_SELECTING, UMAKEINT(cmdid, 0), item);
00533     }
00534
00535     static void gtktreedeselect(GtkWidget *item, gpointer user_data)
00536     {
00537         int widid = ULOWORD((int)user_data);
00538         int cmdid = UHIWORD((int)user_data);
00539         g_assert(GTK_IS_TREE_ITEM(item));
00540         UEventSendMessage(widid, EV_TREE_SELECTING, UMAKEINT(cmdid, 1), item);
00541     }
00542
00543     static GtkLabel *gtktreegetlabel(GtkWidget *item)
00544     {
00545         GtkBox *box = GTK_BOX (GTK_BIN (item)->child);
00546         GList *list = box->children;
00547         GtkLabel *label = 0L;
00548         while(list != 0L)
00549         {
00550             GtkWidget *wid = ((GtkBoxChild *)list->data)->widget;
00551             if(GTK_IS_LABEL(wid))
00552             {
00553                 label = (GtkLabel *)wid;
00554                 break;
00555             }
00556             list = (GList *)g_list_next(list);
00557         }
00558         return label;
00559     }
00560
00561     static void gtksettreeitemicon(GtkTreeItem *item, GtkPixmap *icon)
00562     {
00563         gchar *title = 0L;
00564         GtkLabel *label = gtktreegetlabel(GTK_WIDGET(item));
00565         if(label != 0L)
00566             gtk_label_get(label, &title);
00567         UStr str(title);
00568
00569         GtkBox *m_box = GTK_BOX(GTK_BIN (item)->child);
00570         GList *list = g_list_copy(m_box->children);
00571         while(list != 0L)
00572         {
00573             GtkWidget *wid = ((GtkBoxChild *)list->data)->widget;
00574             gtk_container_remove(GTK_CONTAINER(m_box), wid);
00575
00576             list = (GList *)g_list_next(list);
00577         }
00578         g_list_free(list);
00579
00580         gtkpacktreeitem(m_box, str, icon);
00581     }
00582
00583     // TODO: remove that when the GTK one is working
00584     static gint gtk_clist_get_text_is_buggy(GtkCList  *clist,
00585                                             gint       row,
00586                                             gint       column,
00587                                             gchar    **text)
00588     {
00589         GtkCListRow *clist_row;
00590
00591         g_return_val_if_fail (clist != NULL, 0);
00592         g_return_val_if_fail (GTK_IS_CLIST (clist), 0);
00593
00594         if (row < 0 || row >= clist->rows)
00595             return 0;
00596         if (column < 0 || column >= clist->columns)
00597             return 0;
00598
00599         clist_row = (GtkCListRow *)(g_list_nth (clist->row_list, row))->data;
00600
00601         if (clist_row->cell[column].type == GTK_CELL_TEXT)
00602         {
00603             if (text)
00604                 *text = GTK_CELL_TEXT (clist_row->cell[column])->text;
00605         }
00606         else if (clist_row->cell[column].type == GTK_CELL_PIXTEXT)
00607         {
00608             if (text)
00609                 *text = GTK_CELL_PIXTEXT(clist_row->cell[column])->text;
00610         }
00611         else
00612             return 0;
00613
00614         return 1;
00615     }
00616
00617     static void
00618     gtkswitchpage(GtkWidget       *w,
00619                   GtkNotebookPage *page,
00620                   gint             page_num,
00621                   gpointer         data)
00622     {
00623         int widid = ULOWORD((int)data);
00624         int cmdid = UHIWORD((int)data);
00625
00626         UEventSendMessage(widid, EV_PAGE_CHANGED, UMAKEINT(cmdid, page_num), 0L);
00627     }
00628
00629     static UListSorter sGtkClistDiff = 0L;
00630     static UWidget *sGtkClistWid = 0L;
00631
00632     static gint gtkclistdefcompare(GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
00633     {
00634         if(sGtkClistDiff == 0L)
00635             return 0;
00636
00637         GtkCListRow *row1 = (GtkCListRow *) ptr1;
00638         GtkCListRow *row2 = (GtkCListRow *) ptr2;
00639         return sGtkClistDiff(sGtkClistWid, row1->data, row2->data);
00640     }
00641
00642     static gint gtkexposeevent(GtkWidget *widget, GdkEvent *event, gpointer user_data)
00643     {
00644         int widid = ULOWORD((int)user_data);
00645         int cmdid = UHIWORD((int)user_data);
00646
00647         UEventSendMessage(widid, EV_CUSTOM_DRAW, cmdid, event);
00648         return TRUE;
00649     }
00650 } // extern "C"
00651
00652 #endif /* qGTK */
00653
00654 #if qMacAPP
00655     static bool macapp_getcmdid(TView *view, int & cmdid)
00656     {
00657         IDType atype = view->GetIdentifier();
00658         const char *atypestr = (char *)&atype;
00659         if(atypestr[0] != 'p' && atypestr[1] != 's')
00660             return false;
00661
00662         char cmd[3] = {atypestr[2], atypestr[3], 0};
00663         return sscanf(cmd, "%d", &cmdid) == 1;
00664     }
00665
00666     static void macapp_fecthview(int widid, TView *view)
00667     {
00668         if(view == 0L)
00669             return;
00670
00671         int cmdid;
00672         if(macapp_getcmdid(view, cmdid))
00673         {
00674             UEventSendMessage(widid, EV_INIT_WIDGET, cmdid + EV_COMMAND_START, view);
00675         }
00676
00677         if(MA_MEMBER(view, TTabbedView))
00678         {
00679             TTabbedView *tab = (TTabbedView *)view;
00680             TView *tabview;
00681             SInt32 tabIndex = 1;
00682             while((tabview = tab->GetPanelView(tabIndex++)) != 0L)
00683             {
00684                 macapp_fecthview(widid, tabview);
00685             }
00686         }
00687
00688         macapp_fecthview(widid, view->GetNextView());
00689         macapp_fecthview(widid, view->GetSubView());
00690     }
00691 #endif /* qMacAPP */
00692
00693 UWidget::UWidget(int widid) : UCmdTarget(widid), m_currentPage(-1)
00694 #if qGTK || qMacPP
00695     , m_modalLoop(false)
00696 #endif
00697 #ifdef WIN32
00698     , m_curModal(0L), m_noDispatch(false)
00699 #endif
00700 {
00701 #if qMacAPP
00702     static bool firstTime = true;
00703     if(firstTime)
00704     {
00705         firstTime = false;
00706         gDispatcher->AddBehavior(new TPseudoAppBehavior);
00707             // this behavior takes care about menu routing and giving time
00708             // to the pseudo-events.
00709         new UMacAppMenu();
00710             // for MacApp, we can create automatically the pseudo menu handling.
00711     }
00712 #endif
00713 #if qMacPP
00714     static bool firstTime = true;
00715     if(firstTime && LCommander::GetTopCommander() != 0L)
00716     {
00717         firstTime = false;
00718         LCommander::GetTopCommander()->AddAttachment(NEW LMainPseudoAttachment());
00719     }
00720 #endif
00721 }
00722
00723 UWidget::~UWidget()
00724 {
00725     std::vector<UCmdTarget *>::iterator i;
00726     for(i = m_listeners.begin(); i != m_listeners.end(); ++i)
00727     {
00728         delete *i;
00729     }
00730     std::map<int, UWidget *>::iterator j;
00731     for(j = m_tabs.begin(); j != m_tabs.end(); ++j)
00732     {
00733         delete (*j).second;
00734     }
00735     if(HasFocus())
00736         sFocusWidID = -1;
00737 }
00738
00739 void UWidget::AddListener(UCmdTarget * listener)
00740 {
00741     m_listeners.push_back(listener);
00742 }
00743
00744 int UWidget::UDispatchMessage(int/*UEventType*/ evt, int arg1, void *arg2, UDispatchInfo & dispatchInfo)
00745 {
00746     std::vector<UCmdTarget *>::iterator i;
00747     for(i = m_listeners.begin(); i != m_listeners.end(); ++i)
00748     {
00749         (*i)->UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00750     }
00751     return UCmdTarget::UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00752 }
00753
00754 void *UWidget::GetWidget(int cmd) const
00755 {
00756     std::map<int, void *>::const_iterator i = m_widgets.find(cmd);
00757     if(i == m_widgets.end())
00758     {
00759         UAppConsole("Unable to find widget id : %d (file %s:%d)\n", cmd, __FILE__, __LINE__);
00760         return 0L;
00761     }
00762     return (*i).second;
00763 }
00764
00765 const char *UWidget::GetTooltip(int cmd) const
00766 {
00767     std::map<int, UStr>::const_iterator i = m_tooltips.find(cmd);
00768     if(i == m_tooltips.end())
00769     {
00770         UAppConsole("Unable to find widget id : %d (file %s:%d)\n", cmd, __FILE__, __LINE__);
00771         return 0L;
00772     }
00773     return (*i).second;
00774 }
00775
00776 void UWidget::OnGetLoc(int cmd, URECT * r)
00777 {
00778     r->left = 0; // sanity
00779     r->right = 0;
00780     r->top = 0;
00781     r->bottom = 0;
00782
00783     void *w = GetWidget(cmd);
00784     if(w == 0L)
00785         return;
00786
00787 #if qMacAPP
00788     TView *view = (TView *)w;
00789     CViewRect mr = view->GetFrame();
00790     view->SuperViewToLocal(mr);
00791     view->LocalToRootView(mr);
00792     r->left = mr.left;
00793     r->right = mr.right;
00794     r->top = mr.top;
00795     r->bottom = mr.bottom;
00796 #endif
00797 #if qMacPP
00798     LPane *view = (LPane *)w;
00799     SPoint32 outLocation;
00800     SDimension16 outSize;
00801     view->GetFrameLocation(outLocation);
00802     view->GetFrameSize(outSize);
00803
00804     *r = URect(UPoint(outLocation.h, outLocation.v), USize(outSize.width, outSize.height));
00805 #endif
00806 #ifdef WIN32
00807     CRect mr;
00808     CWnd *wnd = (CWnd *)w;
00809     wnd->GetClientRect(mr);
00810     CWnd *parent = wnd->GetParent();
00811     if(parent != 0L)
00812     {
00813         wnd->ClientToScreen(mr);
00814         parent->ScreenToClient(mr);
00815     }
00816     r->left = mr.left;
00817     r->right = mr.right;
00818     r->top = mr.top;
00819     r->bottom = mr.bottom;
00820 #endif
00821 }
00822
00823 void UWidget::OnSetLoc(int cmd, const URECT * r)
00824 {
00825     void *w = GetWidget(cmd);
00826     if(w == 0L)
00827         return;
00828
00829 #if qMacAPP
00830     TView *view = (TView *)w;
00831     CViewRect mr(r->left, r->top, r->right, r->bottom);
00832     if(mr.right < mr.left)
00833         mr.right = mr.left;
00834     if(mr.bottom < mr.top)
00835         mr.bottom = mr.top;
00836     view->RootViewToLocal(mr);
00837     view->LocalToSuperView(mr);
00838     view->SetFrame(mr, true);
00839 #endif
00840 #if qMacPP
00841     LPane *view = (LPane *)w;
00842     SPoint32 oldLocation;
00843     view->GetFrameLocation(oldLocation);
00844     URect newDim(*r);
00845     UPoint offset = newDim.TopLeft() - UPoint(oldLocation.h, oldLocation.v);
00846     view->ResizeFrameTo(newDim.Width(), newDim.Height(), true);
00847     view->MoveBy(offset.x, offset.y, true);
00848 #endif
00849 #ifdef WIN32
00850     CRect wr(r->left, r->top, r->right, r->bottom);
00851     CWnd *wnd = (CWnd *)w;
00852     wnd->MoveWindow(wr, TRUE);
00853 #endif
00854 }
00855
00856 void UWidget::OnSetTooltip(int cmd, UCmdUI *pCmdUI)
00857 {
00858     const char *tooltip = GetTooltip(cmd);
00859     if(tooltip == 0L)
00860         return;
00861
00862     pCmdUI->SetTooltip(tooltip);
00863 }
00864
00865 bool UWidget::WidgetIsActive(int cmd) const
00866 {
00867     void *w = GetWidget(cmd);
00868     if(w == 0L)
00869         return false;
00870
00871 #ifdef WIN32
00872     CWnd *wnd = (CWnd *)w;
00873
00874     bool res = false;
00875
00876     CWnd* parent = wnd->GetOwner();
00877     if(parent && (HWND)*parent->GetFocus() == (HWND)*wnd)
00878         res = true;
00879
00880     return res;
00881 #endif
00882     return false;
00883 }
00884
00885 void UWidget::AddTooltip(int cmd, const char *tooltipID)
00886 {
00887     std::map<int, UStr>::value_type val(cmd, UStr(tooltipID));
00888     m_tooltips.insert(val);
00889 }
00890
00891 void UWidget::OnInitWidget(int cmd, void *widget)
00892 {
00893     std::map<int, void *>::value_type val(cmd, widget);
00894     m_widgets.insert(val);
00895
00896 #ifdef WIN32
00897
00898 #endif
00899 #if qMacPP
00900     LPane *view = (LPane *)widget;
00901     if(view != 0L)
00902     {
00903         // fetch the inside widgets and add them the the widget list
00904         static bool sSemaphore = false;
00905         USemaphore policeman(sSemaphore);
00906         if(!policeman.IsEnteredTwice())
00907         {
00908             macpp_fecthview(GetWidID(), view);
00909         }
00910
00911         LWindow *wind = dynamic_cast<LWindow*>(view);
00912         if(wind != 0L)
00913         {
00914             LPseudoWinAttachment *attach = NEW LPseudoWinAttachment(GetWidID());
00915             wind->AddAttachment(attach);
00916             macpp_linkbroadcasters(wind, attach);
00917
00918             SPaneInfo inPaneInfo;
00919             memset(&inPaneInfo, 0, sizeof(SPaneInfo));
00920             inPaneInfo.superView = wind;
00921             NEW UPseudoFakePane(inPaneInfo, attach);
00922
00923             // call the create callback
00924             UEventSendMessage(GetWidID(), EV_CREATE, 0, 0L);
00925         }
00926     }
00927 #endif
00928 #if qMacAPP
00929     TView *view = (TView *)widget;
00930     if(MA_MEMBER(view, TView))
00931     {
00932         // fetch the inside widgets and add them the the widget list
00933         static bool sSemaphore = false;
00934         USemaphore policeman(sSemaphore);
00935         if(!policeman.IsEnteredTwice())
00936         {
00937             macapp_fecthview(GetWidID(), view);
00938             //macapp_workaround_adlib_bug(view);
00939         }
00940
00941         if(MA_MEMBER(view, TWindow))
00942         {
00943             // add the pseudo behaviour which re-routes the events to the pseudo-widget
00944             TPseudoWinBehavior *psbehavior = dynamic_cast_AC(TPseudoWinBehavior*,
00945                 view->GetBehaviorWithIdentifier(TPseudoWinBehavior::kPseudoWinBehavior));
00946
00947             if(psbehavior == 0L)
00948             {
00949                 psbehavior = TH_new TPseudoWinBehavior;
00950                 view->AddBehavior(psbehavior);
00951             }
00952             psbehavior->SetPseudoWidget(GetWidID());
00953
00954             // add the pseudo adorner which intercepts the frame size changes
00955             TPseudoWinAdorner *psadorner = dynamic_cast_AC(TPseudoWinAdorner*,
00956                 view->AdornerWithID(TPseudoWinAdorner::kPseudoWinAdorner));
00957
00958             if(psadorner == 0L)
00959             {
00960                 psadorner = TH_new TPseudoWinAdorner;
00961                 view->AddAdorner(psadorner, kAdornLast, false);
00962             }
00963             psadorner->SetPseudoWidget(GetWidID());
00964
00965             // call the create callback
00966             UEventSendMessage(GetWidID(), EV_CREATE, 0, 0L);
00967         }
00968     }
00969 #endif
00970 #if qGTK
00971     static bool firstTime = true;
00972     if(firstTime)
00973     {
00974         // for the disable/enable handling notification (EV_UPDATEUI)
00975         gdk_event_handler_set((GdkEventFunc)gtkmaindoevent, NULL, NULL);
00976
00977         // listen focus events
00978         focus_in_signal_id = gtk_signal_lookup ("focus_in_event", GTK_TYPE_WIDGET);
00979         gtk_signal_add_emission_hook (focus_in_signal_id, gtkeventwatcher, NULL);
00980         focus_out_signal_id = gtk_signal_lookup ("focus_out_event", GTK_TYPE_WIDGET);
00981         gtk_signal_add_emission_hook (focus_out_signal_id, gtkeventwatcher, NULL);
00982
00983         firstTime = false;
00984     }
00985
00986     // so for every widget mapped, we'll be able to find the pseudo-widget associated with.
00987     gtk_object_set_data(GTK_OBJECT(widget), kUgtkDataToken, (gpointer)UMAKEINT(GetWidID(), cmd));
00988
00989     // we are only interesting about the main widgets here
00990     if(GTK_IS_WIDGET(widget))
00991     {
00992         if(cmd == kUMainWidget)
00993         {
00994             // extract and map to the pseudo widget the sub-widgets begining with 'kUgtkPrefixToken'
00995             g_datalist_foreach (&GTK_OBJECT(widget)->object_data, dataForeach, (gpointer)GetWidID());
00996
00997             // map the destroy callback
00998             gtk_signal_connect (GTK_OBJECT(widget), "destroy",
00999                                 GTK_SIGNAL_FUNC(gtkdestroy), (gpointer)this);
01000
01001             gtk_signal_connect (GTK_OBJECT (widget), "key_press_event",
01002                                 GTK_SIGNAL_FUNC(gtkkeypress), (gpointer)this);
01003
01004             // call the create callback
01005             UEventSendMessage(GetWidID(), EV_CREATE, 0, 0L);
01006         }
01007     }
01008
01009     if(GTK_IS_NOTEBOOK(widget))
01010     {
01011         gtk_signal_connect (GTK_OBJECT (widget), "switch_page",
01012                             GTK_SIGNAL_FUNC(gtkswitchpage),
01013                             (gpointer)UMAKEINT(GetWidID(), cmd));
01014     }
01015
01016     if(GTK_IS_BUTTON(widget))
01017     {
01018         gtk_signal_connect (GTK_OBJECT(widget), "clicked",
01019             GTK_SIGNAL_FUNC(gtkclicked), (gpointer)UMAKEINT(GetWidID(), cmd));
01020     }
01021
01022     if(GTK_IS_MENU_ITEM(widget))
01023     {
01024         gtk_signal_connect(GTK_OBJECT(widget), "activate",
01025             GTK_SIGNAL_FUNC(gtkmenuitemactivate), (gpointer)UMAKEINT(GetWidID(), cmd));
01026     }
01027
01028     if(GTK_IS_CLIST(widget))
01029     {
01030         gtk_signal_connect (GTK_OBJECT(widget), "select_row",
01031             GTK_SIGNAL_FUNC(gtkselectclist), (gpointer)UMAKEINT(GetWidID(), cmd));
01032
01033         gtk_signal_connect (GTK_OBJECT(widget), "click_column",
01034             GTK_SIGNAL_FUNC(gtkselectclistcolumn), (gpointer)UMAKEINT(GetWidID(), cmd));
01035
01036         gtk_signal_connect_after (GTK_OBJECT (widget), "button_press_event",
01037                                   GTK_SIGNAL_FUNC (gtkclistdblclick), (gpointer)UMAKEINT(GetWidID(), cmd));
01038     }
01039
01040     if(GTK_IS_DRAWING_AREA(widget))
01041     {
01042         gtk_signal_connect (GTK_OBJECT(widget), "expose_event",
01043                             GTK_SIGNAL_FUNC (gtkexposeevent), (gpointer)UMAKEINT(GetWidID(), cmd));
01044         gtk_widget_set_events (GTK_WIDGET(widget), GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
01045     }
01046
01047     if(GTK_IS_LAYOUT(widget))
01048     {
01049         gtk_signal_connect (GTK_OBJECT(widget), "expose_event",
01050                             GTK_SIGNAL_FUNC (gtkexposeevent), (gpointer)UMAKEINT(GetWidID(), cmd));
01051         gtk_widget_set_events (GTK_WIDGET(widget), GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
01052     }
01053 #endif /* qGTK */
01054 }
01055
01056 void UWidget::OnInitTabWidget(int cmd, int page, void *widget)
01057 {
01058 #if qGTK
01059     if(GTK_IS_WIDGET(widget))
01060     {
01061         // extract and map to the pseudo widget the sub-widgets begining with 'kUgtkPrefixToken'
01062         _dataTabForeach data = {GetWidID(), cmd, page};
01063         g_datalist_foreach (&GTK_OBJECT(widget)->object_data, dataTabForeach, (gpointer)&data);
01064     }
01065 #endif /* qGTK */
01066 }
01067
01068 int UWidget::OnGetState(int cmd)
01069 {
01070     void *w = GetWidget(cmd);
01071     if(w == 0L)
01072         return 0;
01073
01074     int state = 0; // sanity
01075
01076 #ifdef WIN32
01077     CWnd *wnd = (CWnd *)w;
01078
01079     if(wnd->IsKindOf(RUNTIME_CLASS(CPseudoRotButton)))
01080     {
01081         CPseudoRotButton *btn = (CPseudoRotButton *)wnd;
01082         state = btn->GetCurrent();
01083     }
01084     else if(wnd->IsKindOf(RUNTIME_CLASS(CPseudoToggle)))
01085     {
01086         CPseudoToggle *btn = (CPseudoToggle *)wnd;
01087         state = btn->GetState();
01088     }
01089     else if(wnd->IsKindOf(RUNTIME_CLASS(CButton)))
01090     {
01091         CButton *btn = (CButton *)wnd;
01092         state = btn->GetCheck() != 0;
01093     }
01094     else
01095     {
01096         CString s;
01097         wnd->GetWindowText(s);
01098         sscanf(s, "%d", &state);
01099     }
01100 #endif
01101 #if qGTK
01102     if(GTK_IS_TOGGLE_BUTTON(w))
01103     {
01104         state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)) != 0;
01105     }
01106     else if(GTK_IS_ENTRY(w))
01107     {
01108         gchar *text = gtk_entry_get_text(GTK_ENTRY(w));
01109         sscanf(text, "%d", &state);
01110     }
01111 #endif
01112 #if qMacPP
01113     LPane *view = (LPane *)w;
01114     LCheckBox *check;
01115     LRadioButton *rad;
01116     LEditText *edit;
01117     LStaticText *stat;
01118     LBevelButton *bevel;
01119     UPseudoRotButton *rot;
01120     LCheckBoxGroupBox *groupbox;
01121     LPageController *tabctrl;
01122     LTabsControl *tabctrl2;
01123     LControl *ctrl;
01124     if((check = dynamic_cast<LCheckBox *>(view)) != 0L)
01125     {
01126         state = check->GetValue() == Button_On ? 1 : 0;
01127     }
01128     else if((rad = dynamic_cast<LRadioButton *>(view)) != 0L)
01129     {
01130         state = rad->GetValue() == Button_On ? 1 : 0;
01131     }
01132     else if((edit = dynamic_cast<LEditText *>(view)) != 0L)
01133     {
01134         LStr255 pstr;
01135         edit->GetText(pstr);
01136         state = (SInt32)pstr;
01137     }
01138     else if((stat = dynamic_cast<LStaticText *>(view)) != 0L)
01139     {
01140         LStr255 pstr;
01141         stat->GetText(pstr);
01142         state = (SInt32)pstr;
01143     }
01144     else if((groupbox = dynamic_cast<LCheckBoxGroupBox *>(view)) != 0L)
01145     {
01146         state = groupbox->GetValue() == Button_On ? 1 : 0;
01147     }
01148     else if((rot = dynamic_cast<UPseudoRotButton *>(view)) != 0L)
01149     {
01150         state = rot->GetCurrentState();
01151     }
01152     else if((bevel = dynamic_cast<LBevelButton *>(view)) != 0L)
01153     {
01154         state = bevel->GetValue() == Button_On ? 1 : 0;
01155     }
01156     else if((tabctrl = dynamic_cast<LPageController *>(view)) != 0L)
01157     {
01158         state = tabctrl->GetCurrentPageIndex() - 1;
01159     }
01160     else if((tabctrl2 = dynamic_cast<LTabsControl *>(view)) != 0L)
01161     {
01162         state = tabctrl2->GetValue() - 1;
01163     }
01164     else if((ctrl = dynamic_cast<LControl *>(view)) != 0L)
01165     {
01166         state = ctrl->GetValue();
01167     }
01168 #endif
01169 #if qMacAPP
01170     TView *view = (TView *)w;
01171     if(MA_MEMBER(view, TCheckBox))
01172     {
01173         TCheckBox *check = (TCheckBox *)view;
01174         state = check->GetState();
01175     }
01176     else if(MA_MEMBER(view, TRadio))
01177     {
01178         TRadio *rad = (TRadio *)view;
01179         state = rad->GetState();
01180     }
01181     else if(MA_MEMBER(view, TNumberText))
01182     {
01183         TNumberText *num = (TNumberText *)view;
01184         state = num->GetValue();
01185     }
01186 #endif
01187
01188     return state;
01189 }
01190
01191 void UWidget::OnGetFloat(int cmd, float *f)
01192 {
01193     *f = 0.0; // sanity
01194
01195     void *w = GetWidget(cmd);
01196     if(w == 0L)
01197         return;
01198
01199 #if qMacPP
01200     LPane *view = (LPane *)w;
01201     LEditText *edit;
01202     LStaticText *stat;
01203     if((edit = dynamic_cast<LEditText *>(view)) != 0L)
01204     {
01205         LStr255 pstr;
01206         edit->GetText(pstr);
01207         *f = (double)pstr;
01208     }
01209     else if((stat = dynamic_cast<LStaticText *>(view)) != 0L)
01210     {
01211         LStr255 pstr;
01212         stat->GetText(pstr);
01213         *f = (double)pstr;
01214     }
01215 #endif
01216 #if qMacAPP
01217     TView *view = (TView *)w;
01218     if(MA_MEMBER(view, TPseudoDoubleNumberText))
01219     {
01220         TPseudoDoubleNumberText *num = (TPseudoDoubleNumberText *)view;
01221         *f = num->GetValue();
01222     }
01223 #endif
01224 #ifdef WIN32
01225     CWnd *wnd = (CWnd *)w;
01226
01227     CString s;
01228     wnd->GetWindowText(s);
01229     sscanf(s, "%f", f);
01230 #endif
01231 }
01232
01233 void UWidget::OnSetState(int cmd, int state)
01234 {
01235     void *w = GetWidget(cmd);
01236     if(w == 0L)
01237         return;
01238
01239 #ifdef WIN32
01240     CWnd *wnd = (CWnd *)w;
01241
01242     if(wnd->IsKindOf(RUNTIME_CLASS(CPseudoRotButton)))
01243     {
01244         CPseudoRotButton *btn = (CPseudoRotButton *)wnd;
01245         btn->DoRotate(state);
01246     }
01247     else if(wnd->IsKindOf(RUNTIME_CLASS(CPseudoToggle)))
01248     {
01249         CPseudoToggle *btn = (CPseudoToggle *)wnd;
01250         btn->SetState(state);
01251     }
01252     else if(wnd->IsKindOf(RUNTIME_CLASS(CButton)))
01253     {
01254         CButton *btn = (CButton *)wnd;
01255         btn->SetCheck(state != 0);
01256     }
01257     else
01258     {
01259         USemaphore policeman(m_noDispatch);
01260         char tmp[100];
01261         sprintf(tmp, "%d", state);
01262         wnd->SetWindowText(tmp);
01263     }
01264 #endif
01265 #if qGTK
01266     if(GTK_IS_TOGGLE_BUTTON(w))
01267     {
01268         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), state != 0);
01269     }
01270     else if(GTK_IS_ENTRY(w))
01271     {
01272         char tmp[20];
01273         sprintf(tmp, "%d", state);
01274         gtk_entry_set_text(GTK_ENTRY(w), tmp);
01275     }
01276 #endif
01277 #if qMacPP
01278     USemaphore policeman(gTurnOffBroadcast);
01279
01280     LPane *view = (LPane *)w;
01281     LCheckBox *check;
01282     LRadioButton *rad;
01283     LEditText *edit;
01284     LStaticText *stat;
01285     UPseudoRotButton *rot;
01286     LCheckBoxGroupBox *groupbox;
01287     LPageController *tabctrl;
01288     LTabsControl *tabctrl2;
01289     LControl *ctrl;
01290     if((check = dynamic_cast<LCheckBox *>(view)) != 0L)
01291     {
01292         check->SetValue(state ? Button_On : Button_Off);
01293     }
01294     else if((rad = dynamic_cast<LRadioButton *>(view)) != 0L)
01295     {
01296         rad->SetValue(state ? Button_On : Button_Off);
01297     }
01298     else if((groupbox = dynamic_cast<LCheckBoxGroupBox *>(view)) != 0L)
01299     {
01300         groupbox->SetValue(state ? Button_On : Button_Off);
01301     }
01302     else if((edit = dynamic_cast<LEditText *>(view)) != 0L)
01303     {
01304         LStr255 pstr((SInt32)state);
01305         edit->SetText(pstr);
01306     }
01307     else if((stat = dynamic_cast<LStaticText *>(view)) != 0L)
01308     {
01309         LStr255 pstr((SInt32)state);
01310         stat->SetText(pstr);
01311     }
01312     else if((rot = dynamic_cast<UPseudoRotButton *>(view)) != 0L)
01313     {
01314         rot->DoRotate(state);
01315     }
01316     else if((tabctrl = dynamic_cast<LPageController *>(view)) != 0L)
01317     {
01318         tabctrl->SetSelectedPageButtonByIndex(state + 1, false);
01319     }
01320     else if((tabctrl2 = dynamic_cast<LTabsControl *>(view)) != 0L)
01321     {
01322         tabctrl2->SetValue(state + 1);
01323     }
01324     else if((ctrl = dynamic_cast<LControl *>(view)) != 0L)
01325     {
01326         ctrl->SetValue(state);
01327     }
01328 #endif
01329 #if qMacAPP
01330     TView *view = (TView *)w;
01331     if(MA_MEMBER(view, TCheckBox))
01332     {
01333         TCheckBox *check = (TCheckBox *)view;
01334         check->SetState(state, true);
01335     }
01336     else if(MA_MEMBER(view, TRadio))
01337     {
01338         TRadio *rad = (TRadio *)view;
01339         rad->SetState(state, true);
01340     }
01341     else if(MA_MEMBER(view, TNumberText))
01342     {
01343         TNumberText *num = (TNumberText *)view;
01344         num->SetValue(state, true);
01345     }
01346     else if(MA_MEMBER(view, TPseudoRotateIconButton))
01347     {
01348         TPseudoRotateIconButton *rot = (TPseudoRotateIconButton *)view;
01349         rot->DoRotate(state);
01350     }
01351     else if(MA_MEMBER(view, TProgressIndicator))
01352     {
01353         TProgressIndicator *progress = (TProgressIndicator *)view;
01354         progress->SetValue(state, true);
01355     }
01356 #endif
01357 }
01358
01359 void UWidget::OnSetFloat(int cmd, const float *f)
01360 {
01361     void *w = GetWidget(cmd);
01362     if(w == 0L)
01363         return;
01364
01365 #if qMacAPP
01366     TView *view = (TView *)w;
01367     if(MA_MEMBER(view, TPseudoDoubleNumberText))
01368     {
01369         TPseudoDoubleNumberText *num = (TPseudoDoubleNumberText *)view;
01370         num->SetValue(*f, true);
01371     }
01372 #endif
01373 #if qMacPP
01374     USemaphore policeman(gTurnOffBroadcast);
01375
01376     LPane *view = (LPane *)w;
01377     LEditText *edit;
01378     LStaticText *stat;
01379     if((edit = dynamic_cast<LEditText *>(view)) != 0L)
01380     {
01381         LStr255 pstr((long double)*f, "\p#####.##");
01382         edit->SetText(pstr);
01383     }
01384     else if((stat = dynamic_cast<LStaticText *>(view)) != 0L)
01385     {
01386         LStr255 pstr((long double)*f, "\p#####.##");
01387         stat->SetText(pstr);
01388     }
01389 #endif
01390 #ifdef WIN32
01391     USemaphore policeman(m_noDispatch);
01392     CWnd *wnd = (CWnd *)w;
01393
01394     char tmp[100];
01395     sprintf(tmp, "%f", *f);
01396     wnd->SetWindowText(tmp);
01397 #endif
01398 }
01399
01400 void UWidget::OnEnableCmd(int cmd, int state)
01401 {
01402     void *w = GetWidget(cmd);
01403     if(w == 0L)
01404         return;
01405
01406 #if qMacPP
01407     LPane *view = (LPane *)w;
01408     if(state)
01409         view->Enable();
01410     else
01411         view->Disable();
01412 #endif
01413 #if qMacAPP
01414     TView *view = (TView *)w;
01415     if(MA_MEMBER(view, TView))
01416     {
01417         view->SetActiveState(state != 0, true);
01418     }
01419 #endif
01420 #if qGTK
01421     if(GTK_IS_WIDGET(w))
01422     {
01423         gtk_widget_set_sensitive(GTK_WIDGET(w), state != 0);
01424     }
01425 #endif
01426 #ifdef WIN32
01427     CWnd *wnd = (CWnd *)w;
01428
01429     wnd->EnableWindow(state != 0);
01430 #endif
01431 }
01432
01433 void UWidget::OnChgFocus(int cmd)
01434 {
01435     void *w = GetWidget(cmd);
01436     if(w == 0L)
01437         return;
01438
01439 #if qMacPP
01440     LPane *pane = (LPane *)w;
01441     LCommander *target = dynamic_cast<LCommander *>(pane);
01442     if(target != 0L)
01443     {
01444         LCommander::SwitchTarget(target);
01445     }
01446 #endif
01447 #if qMacAPP
01448     TView *view = (TView *)w;
01449     if(MA_MEMBER(view, TView))
01450     {
01451         if(view->GetWindow() != 0L)
01452             view->GetWindow()->SetWindowTarget(view);
01453     }
01454 #endif
01455 #if qGTK
01456     if(GTK_IS_WIDGET(w))
01457     {
01458         gtk_widget_grab_focus(GTK_WIDGET(w)); // TODO doesn't work
01459     }
01460 #endif
01461 #ifdef WIN32
01462     CWnd *wnd = (CWnd *)w;
01463
01464     wnd->SetFocus();
01465 #endif
01466 }
01467
01468 void UWidget::OnInvalidate(int cmd)
01469 {
01470     void *w = GetWidget(cmd);
01471     if(w == 0L)
01472         return;
01473
01474 #if qMacAPP
01475     TView *view = (TView *)w;
01476     if(MA_MEMBER(view, TView))
01477     {
01478         view->ForceRedraw();
01479     }
01480 #endif
01481 #if qMacPP
01482     LPane *pane = (LPane *)w;
01483     pane->Refresh();
01484 #endif
01485 #ifdef WIN32
01486     CWnd *wnd = (CWnd *)w;
01487
01488     wnd->Invalidate();
01489 #endif
01490 }
01491
01492 void UWidget::OnRedraw(int cmd)
01493 {
01494     void *w = GetWidget(cmd);
01495     if(w == 0L)
01496         return;
01497
01498 #if qMacAPP
01499     TView *view = (TView *)w;
01500     if(MA_MEMBER(view, TView))
01501     {
01502         view->ForceRedraw();
01503     }
01504 #endif
01505 #if qMacPP
01506     LPane *pane = (LPane *)w;
01507     pane->Draw(nil);
01508 #endif
01509 #ifdef WIN32
01510     CWnd *wnd = (CWnd *)w;
01511
01512     wnd->Invalidate();
01513 #endif
01514 }
01515
01516 void UWidget::OnSetText(int cmd, const char *text)
01517 {
01518     void *w = GetWidget(cmd);
01519     if(w == 0L)
01520         return;
01521
01522 #ifdef WIN32
01523     USemaphore policeman(m_noDispatch);
01524     CWnd *wnd = (CWnd *)w;
01525     wnd->SetWindowText(text);
01526 #endif
01527 #if qGTK
01528     if(GTK_IS_WINDOW(w))
01529     {
01530         gtk_window_set_title(GTK_WINDOW(w), text);
01531     }
01532     else if(GTK_IS_BUTTON(w))
01533     {
01534         GtkLabel *label = getLabelFromContainer(GTK_CONTAINER(w));
01535         if(label != 0L)
01536             gtk_label_set_text(label, text);
01537         else
01538             g_warning("Cannot find the label of '%s'\n", gtk_widget_get_name(GTK_WIDGET(w)));
01539     }
01540     else if(GTK_IS_TEXT(w))
01541     {
01542         GtkText *t = GTK_TEXT(w);
01543         gtk_text_set_point(t, 0);
01544         gtk_text_forward_delete(t, gtk_text_get_length(t));
01545         gtk_text_insert(t, 0L, 0L, 0L, text, -1);
01546     }
01547     else if(GTK_IS_ENTRY(w))
01548     {
01549         gtk_entry_set_text(GTK_ENTRY(w), text);
01550     }
01551     else if(GTK_IS_COMBO(w))
01552     {
01553         gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(w)->entry), text);
01554     }
01555     else if(GTK_IS_LABEL(w))
01556     {
01557         GtkLabel *t = GTK_LABEL(w);
01558         gtk_label_set_text(t, text);
01559     }
01560 #endif
01561 #if qMacPP
01562     USemaphore policeman(gTurnOffBroadcast);
01563
01564     LPane *view = (LPane *)w;
01565     LTextEditView *txt;
01566     if((txt = dynamic_cast<LTextEditView *>(view)) != 0L)
01567     {
01568         txt->SetTextPtr((Ptr)text, strlen(text));
01569     }
01570     else
01571     {
01572         LStr255 pstr(text);
01573         LStr255 oldstr;
01574         view->GetDescriptor(oldstr);
01575         if(oldstr != pstr)
01576             view->SetDescriptor(pstr);
01577     }
01578 #endif
01579 #if qMacAPP
01580     TView *view = (TView *)w;
01581     if(MA_MEMBER(view, TCtlMgr))
01582     {
01583         TCtlMgr *ctrl = (TCtlMgr *)view;
01584         CStr255_AC pstr(text);
01585         ctrl->SetText(pstr, true);
01586     }
01587     else if(MA_MEMBER(view, TStaticText))
01588     {
01589         TStaticText *ctrl = (TStaticText *)view;
01590         CStr255_AC pstr(text);
01591         ctrl->SetText(pstr, true);
01592     }
01593     else if(MA_MEMBER(view, TWindow))
01594     {
01595         TWindow *ctrl = (TWindow *)view;
01596         CStr255_AC pstr(text);
01597         ctrl->SetTitle(pstr);
01598     }
01599 #endif
01600 }
01601
01602 void UWidget::OnGetText(int cmd, UStr *text)
01603 {
01604     *text = ""; // sanity
01605
01606     void *w = GetWidget(cmd);
01607     if(w == 0L)
01608         return;
01609
01610 #ifdef WIN32
01611     CWnd *wnd = (CWnd *)w;
01612
01613     CString s;
01614     wnd->GetWindowText(s);
01615     *text = s;
01616 #endif
01617 #if qGTK
01618     if(GTK_IS_WINDOW(w))
01619     {
01620         *text = GTK_WINDOW(w)->title;
01621     }
01622     else if(GTK_IS_BUTTON(w))
01623     {
01624         GtkLabel *label = getLabelFromContainer(GTK_CONTAINER(w));
01625         if(label != 0L)
01626         {
01627             gchar *str;
01628             gtk_label_get(label, &str);
01629             if(str != 0L)
01630                 *text = str;
01631         }
01632         else
01633             g_warning("Cannot find the label of '%s'\n", gtk_widget_get_name(GTK_WIDGET(w)));
01634     }
01635     else if(GTK_IS_ENTRY(w))
01636     {
01637         *text = gtk_entry_get_text(GTK_ENTRY(w));
01638     }
01639     else if(GTK_IS_COMBO(w))
01640     {
01641         *text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w)->entry));
01642     }
01643     else if(GTK_IS_TEXT(w))
01644     {
01645         GtkText *t = GTK_TEXT(w);
01646         size_t size = gtk_text_get_length(t);
01647         if(size > 0)
01648             text->set((char *)t->text.ch, size);
01649     }
01650     else if(GTK_IS_LABEL(w))
01651     {
01652         GtkLabel *t = GTK_LABEL(w);
01653         gchar *str;
01654         gtk_label_get(t, &str);
01655         if(str != 0L)
01656             *text = str;
01657     }
01658 #endif
01659 #if qMacPP
01660     LPane *view = (LPane *)w;
01661     LTextEditView *txt;
01662     if((txt = dynamic_cast<LTextEditView *>(view)) != 0L)
01663     {
01664         LStr255 pstr;
01665         Handle hdl = txt->GetTextHandle();
01666         text->set((const char *)*hdl, ::GetHandleSize(hdl));
01667     }
01668     else
01669     {
01670         LStr255 pstr;
01671         view->GetDescriptor(pstr);
01672         *text = pstr;
01673     }
01674 #endif
01675 #if qMacAPP
01676     TView *view = (TView *)w;
01677     if(MA_MEMBER(view, TCtlMgr))
01678     {
01679         TCtlMgr *ctrl = (TCtlMgr *)view;
01680         CStr255_AC pstr = ctrl->GetText();
01681         *text = pstr;
01682     }
01683     else if(MA_MEMBER(view, TStaticText))
01684     {
01685         TStaticText *ctrl = (TStaticText *)view;
01686         CStr255_AC pstr = ctrl->GetText();
01687         *text = pstr;
01688     }
01689     else if(MA_MEMBER(view, TWindow))
01690     {
01691         TWindow *ctrl = (TWindow *)view;
01692         CStr255_AC pstr = ctrl->GetTitle();
01693         *text = pstr;
01694     }
01695 #endif
01696 }
01697
01698 void UWidget::OnShowWidget(int cmd, int state)
01699 {
01700     void *w = GetWidget(cmd);
01701     if(w == 0L)
01702         return;
01703
01704 #ifdef WIN32
01705     CWnd *wnd = (CWnd *)w;
01706
01707     wnd->ShowWindow(state ? SW_SHOWNORMAL : SW_HIDE);
01708 #endif
01709 #if qGTK
01710     GtkWidget *wid = (GtkWidget *)w;
01711     if(state)
01712         gtk_widget_show(wid);
01713     else
01714         gtk_widget_hide(wid);
01715 #endif
01716 #if qMacAPP
01717     TView *view = (TView *)w;
01718     view->Show(state != 0, true);
01719 #endif
01720 #if qMacPP
01721     LPane *view = (LPane *)w;
01722     if(state)
01723         view->Show();
01724     else
01725         view->Hide();
01726 #endif
01727 }
01728
01729
01730 void UWidget::OnSetSlider(int cmd, int pos)
01731 {
01732     void *w = GetWidget(cmd);
01733     if(w == 0L)
01734         return;
01735
01736 #ifdef WIN32
01737     CWnd *wnd = (CWnd *)w;
01738
01739     if(wnd->IsKindOf(RUNTIME_CLASS(CSliderCtrl)))
01740     {
01741         CSliderCtrl *slider = (CSliderCtrl *)wnd;
01742         slider->SetPos(pos);
01743     }
01744     else if(wnd->IsKindOf(RUNTIME_CLASS(CScrollBar)))
01745     {
01746         CScrollBar *scroll = (CScrollBar *)wnd;
01747         scroll->SetScrollPos(pos);
01748     }
01749 #endif
01750 #if qMacAPP
01751     TView *view = (TView *)w;
01752     if(MA_MEMBER(view, TSlider) || MA_MEMBER(view, TScrollBar))
01753     {
01754         TCtlMgr *ctrl = (TCtlMgr *)view;
01755         ctrl->SetValue(pos, true);
01756     }
01757 #endif
01758 #if qMacPP
01759     USemaphore policeman(gTurnOffBroadcast);
01760
01761     LPane *view = (LPane *)w;
01762     LControl *ctrl;
01763     if((ctrl = dynamic_cast<LControl *>(view)) != 0L)
01764     {
01765         ctrl->SetValue(pos);
01766     }
01767 #endif
01768 }
01769
01770
01771 void UWidget::OnGetSliderProperty(int cmd, USLIDER *prop)
01772 {
01773     void *w = GetWidget(cmd);
01774     if(w == 0L)
01775         return;
01776
01777 #ifdef WIN32
01778     CWnd *wnd = (CWnd *)w;
01779
01780     if(wnd->IsKindOf(RUNTIME_CLASS(CSliderCtrl)))
01781     {
01782         CSliderCtrl *slider = (CSliderCtrl *)wnd;
01783         prop->max = slider->GetRangeMax();
01784         prop->min = slider->GetRangeMin();
01785         prop->inc = slider->GetPageSize();
01786         prop->pos = slider->GetPos();
01787     }
01788     else if(wnd->IsKindOf(RUNTIME_CLASS(CScrollBar)))
01789     {
01790         SCROLLINFO info;
01791         CScrollBar *scroll = (CScrollBar *)wnd;
01792         VERIFY(scroll->GetScrollInfo(&info));
01793         prop->max = info.nMax;
01794         prop->min = info.nMin;
01795         prop->inc = info.nPage;
01796         prop->pos = info.nPos;
01797     }
01798 #endif
01799 #if qMacAPP
01800     TView *view = (TView *)w;
01801     if(MA_MEMBER(view, TSlider) || MA_MEMBER(view, TScrollBar))
01802     {
01803         TCtlMgr *ctrl = (TCtlMgr *)view;
01804         prop->max = ctrl->GetMaximum();
01805         prop->min = ctrl->GetMinimum();
01806         if(MA_MEMBER(ctrl, TPseudoScrollBar))
01807             prop->inc = ((TPseudoScrollBar *)ctrl)->fPageStep;
01808         else
01809             prop->inc = 1;
01810         prop->pos = ctrl->GetValue();
01811     }
01812 #endif
01813 #if qMacPP
01814     LPane *view = (LPane *)w;
01815     LControl *ctrl;
01816     if((ctrl = dynamic_cast<LControl *>(view)) != 0L)
01817     {
01818         prop->max = ctrl->GetMaxValue();
01819         prop->min = ctrl->GetMinValue();
01820         LPseudoWinAttachment *attach = macpp_getattachwindow(this);
01821         prop->inc = attach != 0L ? attach->GetPageValue(cmd) : 1;
01822         prop->pos = ctrl->GetValue();
01823     }
01824 #endif
01825 }
01826
01827 void UWidget::OnSetSliderProperty(int cmd, const USLIDER *prop)
01828 {
01829     void *w = GetWidget(cmd);
01830     if(w == 0L)
01831         return;
01832
01833 #ifdef WIN32
01834     CWnd *wnd = (CWnd *)w;
01835
01836     if(wnd->IsKindOf(RUNTIME_CLASS(CSliderCtrl)))
01837     {
01838         CSliderCtrl *slider = (CSliderCtrl *)wnd;
01839         slider->SetRange(prop->min, prop->max);
01840         slider->SetPos(prop->pos);
01841         slider->SetPageSize(prop->inc);
01842     }
01843     else if(wnd->IsKindOf(RUNTIME_CLASS(CScrollBar)))
01844     {
01845         SCROLLINFO info;
01846         memset(&info, 0, sizeof(info));
01847         info.cbSize = sizeof(info);
01848         info.fMask = SIF_DISABLENOSCROLL | SIF_PAGE | SIF_POS | SIF_RANGE;
01849         info.nMax = prop->max;
01850         info.nMin = prop->min;
01851         info.nPos = prop->pos;
01852         info.nPage = prop->inc;
01853         if(info.nPage > (info.nMax - info.nMin))
01854             info.nPage = (info.nMax - info.nMin) / 2;
01855         CScrollBar *scroll = (CScrollBar *)wnd;
01856         VERIFY(scroll->SetScrollInfo(&info));
01857         if(prop->max != prop->min)
01858             scroll->EnableWindow(TRUE);
01859     }
01860 #endif
01861 #if qMacAPP
01862     TView *view = (TView *)w;
01863     if(MA_MEMBER(view, TSlider) || MA_MEMBER(view, TScrollBar))
01864     {
01865         TCtlMgr *ctrl = (TCtlMgr *)view;
01866         ctrl->SetValues(prop->pos, prop->min, prop->max, true);
01867         if(MA_MEMBER(ctrl, TPseudoScrollBar))
01868             ((TPseudoScrollBar *)ctrl)->fPageStep = prop->inc;
01869     }
01870 #endif
01871 #if qMacPP
01872     USemaphore policeman(gTurnOffBroadcast);
01873
01874     LPane *view = (LPane *)w;
01875     LControl *ctrl;
01876     if((ctrl = dynamic_cast<LControl *>(view)) != 0L)
01877     {
01878         ctrl->SetMaxValue(prop->max);
01879         ctrl->SetMinValue(prop->min);
01880         ctrl->SetValue(prop->pos);
01881         LPseudoWinAttachment *attach = macpp_getattachwindow(this);
01882         if(attach != 0L)
01883             attach->SetPageValue(cmd, prop->inc);
01884     }
01885 #endif
01886 }
01887
01888 void UWidget::AddTimer(long lap, int cmd)
01889 {
01890     UTimer timer(lap, ::UTickCount(), cmd);
01891     m_timers.push_back(timer);
01892 }
01893
01894 void UWidget::RemoveTimer(int cmd)
01895 {
01896     std::vector<UTimer>::iterator i;
01897     for(i = m_timers.begin(); i != m_timers.end(); i++)
01898     {
01899         if((*i).m_cmd == cmd)
01900         {
01901             (*i).m_cmd = 0; // delay removing
01902             break;
01903         }
01904     }
01905 }
01906
01907 std::vector<UTimer> & UWidget::GetTimers(void)
01908 {
01909     // removed the delayed items
01910     std::vector<UTimer>::iterator i;
01911     for(i = m_timers.begin(); i != m_timers.end(); ++i)
01912     {
01913         if((*i).m_cmd == 0)
01914         {
01915             m_timers.erase(i);
01916             break;
01917         }
01918     }
01919
01920     return m_timers;
01921 }
01922
01923 void UWidget::OnUpdateUI()
01924 {
01925     std::map<int, void *>::const_iterator i;
01926     for(i = m_widgets.begin(); i != m_widgets.end(); ++i)
01927     {
01928         UCmdUI pUI((*i).first);
01929         pUI.m_widget = (*i).second;
01930         UEventSendMessage(GetWidID(), EV_UPDTCMD, pUI.m_nID, &pUI);
01931     }
01932 }
01933
01934 bool UWidget::DoModal(int id)
01935 {
01936     bool result = false;
01937
01938 #if !defined(qMacAPP) && !defined(qMacPP) && !defined(WIN32)
01939     void *w = GetWidget(kUMainWidget);
01940     if(w == 0L)
01941     {
01942         UAppConsole("Unable to find widget id : %d (file %s:%d)\n", kUMainWidget, __FILE__, __LINE__);
01943         return result;
01944     }
01945 #endif // !qMacAPP && !WIN32
01946
01947 #if qGTK || qMacPP
01948     if(m_modalLoop)
01949     {
01950         UAppConsole("Trying to break a modal state\n");
01951         return result;
01952     }
01953 #endif
01954
01955 #ifdef WIN32
01956     CPseudoDlg dlg(id, this);
01957     m_curModal = &dlg;
01958     result = dlg.DoModal() == IDOK;
01959     if(!result)
01960         Dismiss();
01961     m_curModal = 0L;
01962 #endif
01963 #if qMacAPP
01964     TWindow *view = gViewServer->NewTemplateWindow(id, nil);
01965     ThrowIfNULL_AC(view);
01966
01967     UEventSendMessage(GetWidID(), EV_INIT_WIDGET, kUMainWidget, view);
01968
01969     DoDataExchange(true);
01970     IDType resid = view->PoseModally();
01971
01972     TDialogBehavior* dlgb;
01973     if((dlgb = view->GetDialogBehavior()) != 0L)
01974     {
01975         result = resid == dlgb->fDefaultItem;
01976     }
01977
01978     if(result)
01979         DoDataExchange(false);
01980     else
01981         Dismiss();
01982
01983     view->Close();
01984 #endif
01985 #if qMacPP
01986     StDialogHandler theHandler(id, LCommander::GetTopCommander());
01987     LWindow *theDialog = theHandler.GetDialog();
01988
01989     if(theDialog != 0L)
01990     {
01991         UEventSendMessage(GetWidID(), EV_INIT_WIDGET, kUMainWidget, theDialog);
01992
01993         DoDataExchange(true);
01994         theDialog->Show();
01995         theHandler.SetSleepTime(0);
01996
01997         m_modalLoop = true;
01998         MessageT hitMessage;
01999         while (m_modalLoop)
02000         {       // Let DialogHandler process events
02001             hitMessage = theHandler.DoDialog();
02002
02003             if (hitMessage == msg_OK || hitMessage == msg_Cancel)
02004                 break;
02005         }
02006
02007         result = m_modalLoop ? hitMessage == msg_OK : m_modalRes;
02008
02009         if(result)
02010             DoDataExchange(false);
02011         else
02012             Dismiss();
02013
02014         //theDialog->Hide();
02015         //theDialog->DoClose();
02016     }
02017 #endif
02018 #if qGTK
02019     if(GTK_IS_WINDOW(w))
02020     {
02021         // emulate the click in tab 1
02022         std::map<int, UWidget *>::iterator i;
02023         for(i = m_tabs.begin(); i != m_tabs.end(); ++i)
02024         {
02025             int cmdid = ULOWORD((*i).first);
02026             int pagenum = UHIWORD((*i).first);
02027             if(pagenum == 0)
02028             {
02029                 UEventSendMessage(GetWidID(), EV_PAGE_CHANGED, UMAKEINT(cmdid, pagenum), 0L);
02030                 break;
02031             }
02032         }
02033         gtk_signal_connect(GTK_OBJECT(w),"delete_event", GTK_SIGNAL_FUNC(gtkcancel), this);
02034         DoDataExchange(true);
02035         gtk_widget_show(GTK_WIDGET(w));
02036         m_modalLoop = true;
02037         gtk_grab_add (GTK_WIDGET(w));
02038         while (m_modalLoop)
02039         {
02040             gtk_main_iteration_do(TRUE);
02041         }
02042         gtk_grab_remove (GTK_WIDGET(w));
02043         result = m_modalRes;
02044         if(result)
02045         {
02046             UEventSendMessage(GetWidID(), EV_PAGE_CHANGED, UMAKEINT(0, -1), 0L);
02047             DoDataExchange(false);
02048         }
02049         else
02050             Dismiss();
02051         gtk_widget_destroy(GTK_WIDGET(w));
02052     }
02053     else
02054         g_warning("Trying to modal on a non-window\n");
02055 #endif
02056
02057     return result;
02058 }
02059
02060 void UWidget::EndModal(bool result)
02061 {
02062     m_modalRes = result;
02063 #if qGTK || qMacPP
02064     if(!m_modalLoop)
02065         UAppConsole("EndModal called twice\n");
02066
02067     m_modalLoop = false;
02068 #endif
02069 #if qMacAPP
02070     void *w = GetWidget(kUMainWidget);
02071     if(w == 0L)
02072         return;
02073
02074     TWindow *wind = (TWindow *)w;
02075     TDialogBehavior* dlgb;
02076     if(MA_MEMBER(wind, TWindow) && (dlgb = wind->GetDialogBehavior()) != 0L)
02077     {
02078         wind->Dismiss(result ? dlgb->fDefaultItem : dlgb->fCancelItem, result);
02079     }
02080 #endif
02081 #ifdef WIN32
02082     if(m_curModal != 0L)
02083     {
02084         if (result && !m_curModal->UpdateData(TRUE))
02085         {
02086             TRACE0("UpdateData failed during dialog termination.\n");
02087             // the UpdateData routine will set focus to correct item
02088             return;
02089         }
02090         m_curModal->EndDialog(result ? IDOK : IDCANCEL);
02091     }
02092 #endif
02093 }
02094
02095 void UWidget::OnChgCursor(int cmd, UCURSOR cursor)
02096 {
02097     void *w = GetWidget(cmd);
02098     if(w == 0L)
02099         return;
02100
02101 #if qGTK
02102     if(GTK_IS_WIDGET(w) && GTK_WIDGET(w)->window != 0L)
02103     {
02104         static GdkCursor *cursor_arrow;
02105         static GdkCursor *cursor_watch;
02106         if(cursor_arrow == 0L)
02107         {
02108             cursor_arrow = gdk_cursor_new (GDK_ARROW);
02109             cursor_watch = gdk_cursor_new (GDK_WATCH);
02110         }
02111         if(cursor == uCursArrow)
02112             gdk_window_set_cursor (GTK_WIDGET(w)->window, cursor_arrow);
02113         else if(cursor == uCursWatch)
02114             gdk_window_set_cursor (GTK_WIDGET(w)->window, cursor_watch);
02115     }
02116 #endif
02117 }
02118
02119 void UWidget::OnTreeResetAll(int cmd)
02120 {
02121     void *w = GetWidget(cmd);
02122     if(w == 0L)
02123         return;
02124
02125 #if qGTK
02126     if(!GTK_IS_TREE(w))
02127         return;
02128
02129     GtkTree *tree = GTK_TREE(w);
02130     GList *list = g_list_copy(tree->children);
02131     GList *head = list;
02132     while(list != 0L)
02133     {
02134         GtkWidget *wid = GTK_WIDGET(list->data);
02135         gtk_container_remove(GTK_CONTAINER(tree), wid);
02136         list = (GList *)g_list_next(list);
02137     }
02138     g_list_free(head);
02139 #endif
02140 }
02141
02142 void UWidget::OnTreeInsert(int cmd, UTREE_INSERT *data)
02143 {
02144     data->result = 0L; // sanity
02145
02146     void *w = GetWidget(cmd);
02147     if(w == 0L)
02148         return;
02149
02150 #if qGTK
02151     if(!GTK_IS_TREE(w))
02152         return;
02153
02154     GtkTree *root;
02155     if(data->parent == 0L)
02156         root = GTK_TREE(w);
02157     else
02158     {
02159         GtkTreeItem *item = GTK_TREE_ITEM(data->parent);
02160
02161         if(item->subtree != 0L)
02162             root = GTK_TREE(item->subtree);
02163         else
02164         {
02165             root = GTK_TREE(gtk_tree_new());
02166             gtk_object_set_data(GTK_OBJECT(root), "rf_treeparent", item);
02167             gtk_tree_set_selection_mode (root, GTK_SELECTION_BROWSE); // TODO : find out it with the root
02168             gtk_tree_set_view_mode (root, GTK_TREE_VIEW_ITEM); // TODO : find out it with the root
02169             gtk_tree_item_set_subtree (item, GTK_WIDGET(root));
02170         }
02171     }
02172     GtkTreeItem *item = gtknewtreeitem(data->title, data->icon == 0L ? 0L : GTK_PIXMAP(data->icon));
02173     gtk_object_set_data(GTK_OBJECT(item), "rf_treeitemdata", data->data);
02174     gtk_signal_connect(GTK_OBJECT(item), "select",
02175                        GTK_SIGNAL_FUNC(gtktreeselect), (gpointer)UMAKEINT(GetWidID(), cmd));
02176     gtk_signal_connect(GTK_OBJECT(item), "deselect",
02177                        GTK_SIGNAL_FUNC(gtktreedeselect), (gpointer)UMAKEINT(GetWidID(), cmd));
02178     gtk_signal_connect (GTK_OBJECT(item), "expand",
02179                         GTK_SIGNAL_FUNC(gtktreeexpand), (gpointer)UMAKEINT(GetWidID(), cmd));
02180     gtk_signal_connect (GTK_OBJECT(item), "collapse",
02181                         GTK_SIGNAL_FUNC(gtktreecollapse), (gpointer)UMAKEINT(GetWidID(), cmd));
02182     gtk_tree_append (GTK_TREE(root), GTK_WIDGET(item));
02183     gtk_widget_show (GTK_WIDGET(item));
02184     data->result = (UTREEITEM)item;
02185 #endif
02186 }
02187
02188 void UWidget::OnTreeSetData(int cmd, UTREE_INFO *data)
02189 {
02190     void *w = GetWidget(cmd);
02191     if(w == 0L)
02192         return;
02193
02194 #if qGTK
02195     if(!GTK_IS_TREE(w))
02196         return;
02197
02198     gtk_object_set_data(GTK_OBJECT(data->item), "rf_treeitemdata", data->data);
02199 #endif
02200 }
02201
02202 void UWidget::OnTreeSetIcon(int cmd, UTREE_INFO *data)
02203 {
02204     void *w = GetWidget(cmd);
02205     if(w == 0L)
02206         return;
02207
02208 #if qGTK
02209     if(!GTK_IS_TREE(w))
02210         return;
02211
02212     gtksettreeitemicon(GTK_TREE_ITEM(data->item), GTK_PIXMAP(data->icon));
02213 #endif
02214 }
02215
02216 void UWidget::OnTreeGetSel(int cmd, UTREEITEM *item)
02217 {
02218     *item = 0L; // sanity
02219
02220     void *w = GetWidget(cmd);
02221     if(w == 0L)
02222         return;
02223
02224 #if qGTK
02225     if(!GTK_IS_TREE(w))
02226         return;
02227
02228     GList *sel = GTK_TREE(w)->selection;
02229     if(sel == 0L || !GTK_IS_TREE_ITEM(sel->data))
02230         return;
02231
02232     *item = sel->data;
02233 #endif
02234 }
02235
02236 void UWidget::OnTreeGetInfo(int cmd, UTREE_INFO *desc)
02237 {
02238     // sanity
02239     desc->parent = 0L;
02240     desc->next = 0L;
02241     desc->child = 0L;
02242     desc->data = 0L;
02243     desc->title = 0L;
02244     desc->icon = 0L;
02245     desc->expanded = 0;
02246
02247     void *w = GetWidget(cmd);
02248     if(w == 0L)
02249         return;
02250
02251 #if qGTK
02252     if(!GTK_IS_TREE(w))
02253         return;
02254
02255     GtkTreeItem *item;
02256     if(desc->item == 0L)
02257     {
02258         GList *list = g_list_first(GTK_TREE(w)->children);
02259         GList *next = g_list_next(list);
02260         item = list != 0L ? GTK_TREE_ITEM(list->data) : 0L;
02261         desc->item = item;
02262         desc->next = next != 0L ? GTK_TREE_ITEM(next->data) : 0L;
02263     }
02264     else
02265     {
02266         GtkTree *parent = GTK_TREE(GTK_WIDGET(desc->item)->parent);
02267         GList *list = g_list_find(GTK_TREE(parent)->children, desc->item);
02268         GList *next = g_list_next(list);
02269         item = list != 0L ? GTK_TREE_ITEM(list->data) : 0L;
02270         desc->item = item;
02271         // the only way I found to guess the TREE_ITEM parent
02272         desc->parent = parent == w ? 0L : GTK_TREE_ITEM(gtk_object_get_data(GTK_OBJECT(parent), "rf_treeparent"));
02273         g_assert(desc->parent == 0L || GTK_IS_TREE_ITEM(desc->parent));
02274         desc->next = next != 0L ? GTK_TREE_ITEM(next->data) : 0L;
02275     }
02276     if(item != 0L)
02277     {
02278         if(item->subtree != 0L)
02279         {
02280             GtkTree *subtree = GTK_TREE(item->subtree);
02281             GList *list = g_list_first(GTK_TREE(subtree)->children);
02282             desc->child = list != 0L ? GTK_TREE_ITEM(list->data) : 0L;
02283         }
02284         desc->data = gtk_object_get_data(GTK_OBJECT(item), "rf_treeitemdata");
02285         GtkLabel *label = gtktreegetlabel(GTK_WIDGET(item));
02286         if(label != 0L)
02287             gtk_label_get(label, &desc->title);
02288         desc->expanded = item->expanded;
02289     }
02290 #endif
02291 }
02292
02293 void UWidget::OnTreeDelete(int cmd, UTREEITEM item)
02294 {
02295     // sanity
02296     void *w = GetWidget(cmd);
02297     if(w == 0L)
02298         return;
02299
02300 #if qGTK
02301     if(!GTK_IS_TREE(w) || item == 0L)
02302         return;
02303
02304     GtkTreeItem *i = GTK_TREE_ITEM(item);
02305
02306     GtkTree *parent = GTK_TREE(GTK_WIDGET(i)->parent);
02307     if (parent == 0L)
02308         return;
02309
02310     gtk_container_remove(GTK_CONTAINER(parent), GTK_WIDGET(i));
02311 #endif
02312 }
02313
02314 void UWidget::OnTreeExpand(int cmd, int collapse, UTREEITEM item)
02315 {
02316     // sanity
02317     void *w = GetWidget(cmd);
02318     if(w == 0L)
02319         return;
02320
02321 #if qGTK
02322     if(!GTK_IS_TREE(w) || item == 0L)
02323         return;
02324
02325     GtkTreeItem *i = GTK_TREE_ITEM(item);
02326     int collapsed = !i->expanded;
02327     if((collapsed != 0) ^ (collapse != 0))
02328     {
02329         if(!collapse)
02330             gtk_tree_item_expand(i);
02331         else
02332             gtk_tree_item_collapse(i);
02333     }
02334 #endif
02335 }
02336
02337 void UWidget::OnTreeSelect(int cmd, int deselect, UTREEITEM item)
02338 {
02339     // sanity
02340     void *w = GetWidget(cmd);
02341     if(w == 0L)
02342         return;
02343
02344 #if qGTK
02345     if(!GTK_IS_TREE(w) || item == 0L)
02346         return;
02347
02348 #if 0 // FIXME ! GTK is behaving strangely
02349     GList *sel = GTK_TREE(w)->selection;
02350     while(sel)
02351     {
02352         gtk_tree_item_deselect(GTK_TREE_ITEM(sel->data));
02353         sel = g_list_next(sel);
02354     }
02355
02356     GtkTreeItem *i = GTK_TREE_ITEM(item);
02357     if(!deselect)
02358         gtk_tree_item_select(i);
02359     else
02360         gtk_tree_item_deselect(i);
02361 #endif
02362 #endif
02363 }
02364
02365 void UWidget::OnComboResetAll(int cmd)
02366 {
02367     void *w = GetWidget(cmd);
02368     if(w == 0L)
02369         return;
02370
02371 #ifdef WIN32
02372     CWnd *wnd = (CWnd *)w;
02373
02374     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02375     {
02376         CComboBox *combo = (CComboBox *)wnd;
02377         combo->ResetContent();
02378     }
02379 #endif
02380 #if qGTK
02381     if(GTK_IS_COMBO(w))
02382     {
02383         GtkList *listbox = GTK_LIST( GTK_COMBO(w)->list );
02384         if(listbox && listbox->children != 0L)
02385             gtk_list_remove_items( listbox, g_list_copy(listbox->children));
02386     }
02387     else if(GTK_IS_OPTION_MENU(w))
02388     {
02389         GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(w));
02390         GList *list = g_list_copy(GTK_MENU_SHELL(menu)->children);
02391         GList *head = list;
02392         while(list != 0L)
02393         {
02394             GtkWidget *wid = GTK_WIDGET(list->data);
02395             gtk_container_remove(GTK_CONTAINER(menu), wid);
02396             list = (GList *)g_list_next(list);
02397         }
02398         g_list_free(head);
02399     }
02400 #endif
02401 #if qMacPP
02402     LPane *view = (LPane *)w;
02403     LMenuController *popup;
02404     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02405     {
02406         USemaphore policeman(gTurnOffBroadcast);
02407
02408         popup->DeleteAllMenuItems();
02409     }
02410 #endif
02411 #if qMacAPP
02412     TView *view = (TView *)w;
02413     if(MA_MEMBER(view, TPopup))
02414     {
02415         TPopup *popup = (TPopup *)view;
02416         while(popup->GetNumberOfItems() > 0)
02417             popup->DeleteItem(1);
02418     }
02419 #endif
02420 }
02421
02422 void UWidget::OnComboAppend(int cmd, const char *txt)
02423 {
02424     void *w = GetWidget(cmd);
02425     if(w == 0L)
02426         return;
02427
02428 #ifdef WIN32
02429     CWnd *wnd = (CWnd *)w;
02430
02431     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02432     {
02433         CComboBox *combo = (CComboBox *)wnd;
02434         combo->InsertString(-1, txt);
02435     }
02436 #endif
02437 #if qGTK
02438     if(GTK_IS_COMBO(w))
02439     {
02440         GtkWidget *list = GTK_COMBO(w)->list;
02441         GtkWidget *list_item = gtk_list_item_new_with_label(txt);
02442         gtk_container_add( GTK_CONTAINER(list), list_item );
02443         gtk_widget_show( list_item );
02444
02445         gtk_signal_connect( GTK_OBJECT(list_item), "select",
02446                             GTK_SIGNAL_FUNC(gtkcomboclicked), (gpointer)UMAKEINT(GetWidID(), cmd) );
02447     }
02448     else if(GTK_IS_OPTION_MENU(w))
02449     {
02450         GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(w));
02451         GtkWidget *item = gtk_menu_item_new_with_label(txt);
02452         // fix me: where to find the label of the item ?
02453         gtk_object_set_data_full(GTK_OBJECT(item), "rf_menuitemtext", strdup(txt), (GtkDestroyNotify)free);
02454         gtk_signal_connect (GTK_OBJECT(item), "activate",
02455             GTK_SIGNAL_FUNC(gtkmenuactivated), (gpointer)UMAKEINT(GetWidID(), cmd));
02456         gtk_widget_show(item);
02457         gtk_menu_append(GTK_MENU(menu), item);
02458     }
02459 #endif
02460 #if qMacPP
02461     LPane *view = (LPane *)w;
02462     LMenuController *popup;
02463     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02464     {
02465         USemaphore policeman(gTurnOffBroadcast);
02466
02467         if(strcmp(txt, "-") == 0)
02468             popup->InsertMenuItem("\p(-", max_Int16, false);
02469         else
02470             popup->InsertMenuItem(LStr255(txt), max_Int16);
02471     }
02472 #endif
02473 #if qMacAPP
02474     TView *view = (TView *)w;
02475     if(MA_MEMBER(view, TPopup))
02476     {
02477         TPopup *popup = (TPopup *)view;
02478         if(strcmp(txt, "-") == 0)
02479             popup->AddSeparator();
02480         else
02481             popup->AddItem(CStr255_AC(txt));
02482     }
02483 #endif
02484 }
02485
02486 void UWidget::OnComboSetPos(int cmd, int sel)
02487 {
02488     void *w = GetWidget(cmd);
02489     if(w == 0L)
02490         return;
02491
02492 #ifdef WIN32
02493     CWnd *wnd = (CWnd *)w;
02494
02495     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02496     {
02497         CComboBox *combo = (CComboBox *)wnd;
02498         combo->SetCurSel(sel);
02499     }
02500 #endif
02501 #if qGTK
02502     if(GTK_IS_COMBO(w))
02503     {
02504         GtkWidget *list = GTK_COMBO(w)->list;
02505         gtk_list_select_item(GTK_LIST(list), sel);
02506     }
02507     else if(GTK_IS_OPTION_MENU(w))
02508     {
02509         gtk_option_menu_set_history (GTK_OPTION_MENU(w), sel);
02510     }
02511
02512 #endif
02513 #if qMacAPP
02514     TView *view = (TView *)w;
02515     if(MA_MEMBER(view, TPopup))
02516     {
02517         TPopup *popup = (TPopup *)view;
02518         popup->SetCurrentItem(sel + 1, true);
02519     }
02520 #endif
02521 #if qMacPP
02522     LPane *view = (LPane *)w;
02523     LMenuController *popup;
02524     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02525     {
02526         USemaphore policeman(gTurnOffBroadcast);
02527
02528         popup->SetCurrentMenuItem(sel + 1);
02529     }
02530 #endif
02531 }
02532
02533 void UWidget::OnComboDelSel(int cmd, int sel)
02534 {
02535     void *w = GetWidget(cmd);
02536     if(w == 0L)
02537         return;
02538
02539 #ifdef WIN32
02540     CWnd *wnd = (CWnd *)w;
02541
02542     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02543     {
02544         CComboBox *combo = (CComboBox *)wnd;
02545         combo->DeleteString(sel);
02546     }
02547 #endif
02548 #if qMacPP
02549     LPane *view = (LPane *)w;
02550     LMenuController *popup;
02551     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02552     {
02553         USemaphore policeman(gTurnOffBroadcast);
02554
02555         popup->DeleteMenuItem(sel + 1);
02556     }
02557 #endif
02558 }
02559
02560 void UWidget::OnComboEnableSel(int cmd, int sel, int state)
02561 {
02562     void *w = GetWidget(cmd);
02563     if(w == 0L)
02564         return;
02565
02566 #ifdef WIN32
02567     CWnd *wnd = (CWnd *)w;
02568
02569     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02570     {
02571     }
02572 #endif
02573 #if qMacPP
02574     LPane *view = (LPane *)w;
02575     LMenuController *popup;
02576     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02577     {
02578         if(state)
02579             ::EnableMenuItem(popup->GetMacMenuH(), sel + 1);
02580         else
02581             ::DisableMenuItem(popup->GetMacMenuH(), sel + 1);
02582     }
02583 #endif
02584 }
02585
02586 void UWidget::OnComboGetMenu(int cmd, UMENU *menu)
02587 {
02588     *menu = UMENU_NULL; // sanity
02589
02590     void *w = GetWidget(cmd);
02591     if(w == 0L)
02592         return;
02593
02594 #ifdef WIN32
02595     CWnd *wnd = (CWnd *)w;
02596
02597     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02598     {
02599     }
02600 #endif
02601 #if qMacPP
02602     LPane *view = (LPane *)w;
02603     LMenuController *popup;
02604     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02605     {
02606         MenuHandle hdl = popup->GetMacMenuH();
02607         if(hdl != 0L)
02608 #   if ACCESSOR_CALLS_ARE_FUNCTIONS
02609             *menu = GetMenuID(hdl);
02610 #   else
02611             *menu = (**hdl).menuID;
02612 #   endif
02613     }
02614 #endif
02615 }
02616
02617 int UWidget::OnComboGetPos(int cmd, UStr *txt)
02618 {
02619     int res = -1; // sanity
02620     if(txt != 0L)
02621         *txt = "";
02622
02623     void *w = GetWidget(cmd);
02624     if(w == 0L)
02625         return res;
02626
02627 #ifdef WIN32
02628     CWnd *wnd = (CWnd *)w;
02629
02630     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02631     {
02632         CComboBox *combo = (CComboBox *)wnd;
02633         res = combo->GetCurSel();
02634         if(res != -1 && txt != 0L)
02635         {
02636             CString s;
02637             combo->GetLBText(res, s);
02638             *txt = s;
02639         }
02640     }
02641 #endif
02642 #if qMacAPP
02643     TView *view = (TView *)w;
02644     if(MA_MEMBER(view, TPopup))
02645     {
02646         TPopup *popup = (TPopup *)view;
02647         res = popup->GetCurrentItem() - 1;
02648         if(txt != 0L)
02649         {
02650             CStr255_AC pstr = popup->GetItemText(res + 1);
02651             *txt = pstr;
02652         }
02653     }
02654 #endif
02655 #if qMacPP
02656     LPane *view = (LPane *)w;
02657     LMenuController *popup;
02658     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02659     {
02660         res = popup->GetCurrentMenuItem() - 1;
02661         if(txt != 0L)
02662         {
02663             LStr255 pstr;
02664             popup->GetMenuItemText(res + 1, pstr);
02665             *txt = pstr;
02666         }
02667     }
02668 #endif
02669
02670     return res;
02671 }
02672
02673 int UWidget::OnComboGetCount(int cmd)
02674 {
02675     int res = 0; // sanity
02676
02677     void *w = GetWidget(cmd);
02678     if(w == 0L)
02679         return res;
02680
02681 #ifdef WIN32
02682     CWnd *wnd = (CWnd *)w;
02683
02684     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02685     {
02686         CComboBox *combo = (CComboBox *)wnd;
02687         res = combo->GetCount();
02688     }
02689 #endif
02690 #if qMacAPP
02691     TView *view = (TView *)w;
02692     if(MA_MEMBER(view, TPopup))
02693     {
02694         TPopup *popup = (TPopup *)view;
02695         res = popup->GetNumberOfItems();
02696     }
02697 #endif
02698 #if qMacPP
02699     LPane *view = (LPane *)w;
02700     LMenuController *popup;
02701     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02702     {
02703         res = ::CountMenuItems(popup->GetMacMenuH());
02704     }
02705 #endif
02706
02707     return res;
02708 }
02709
02710 void UWidget::OnListAddColumns(int cmd, int num)
02711 {
02712     void *w = GetWidget(cmd);
02713     if(w == 0L)
02714         return;
02715
02716 #if qGTK
02717     if(!GTK_IS_CLIST(w))
02718         return;
02719
02720     //GtkCList *list = GTK_CLIST(w);
02721     // don't know how to do that, for now it relies on glade settings
02722 #endif
02723 #ifdef WIN32
02724     CWnd *wnd = (CWnd *)w;
02725
02726     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02727     {
02728         CListCtrl *list = (CListCtrl *)wnd;
02729         DWORD dwExStyle = ListView_GetExtendedListViewStyle(list->m_hWnd);
02730         dwExStyle |= LVS_EX_FULLROWSELECT;
02731         ListView_SetExtendedListViewStyle(list->m_hWnd, dwExStyle);
02732
02733         while(num--)
02734             list->InsertColumn(0, "", LVCFMT_LEFT, 80);
02735     }
02736 #endif
02737 #if qMacPP
02738     LPane *view = (LPane *)w;
02739     LOutlineTable *table;
02740     LTextTableView *tabtext;
02741     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
02742     {
02743         macpp_preparetable(table);
02744         table->InsertCols( num, 0, nil, nil, false );
02745     }
02746     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
02747     {
02748         macpp_preparetable(GetWidget(kUMainWidget), tabtext);
02749         tabtext->InsertCols( num, 0, nil, nil, false );
02750     }
02751 #endif
02752 }
02753
02754 void UWidget::OnListSetColTitle(int cmd, int num, const char *title)
02755 {
02756     void *w = GetWidget(cmd);
02757     if(w == 0L)
02758         return;
02759
02760 #if qGTK
02761     if(!GTK_IS_CLIST(w))
02762         return;
02763
02764     GtkCList *list = GTK_CLIST(w);
02765     gtk_clist_set_column_title (list, num, title);
02766 #endif
02767 #ifdef WIN32
02768     CWnd *wnd = (CWnd *)w;
02769
02770     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02771     {
02772         CListCtrl *list = (CListCtrl *)wnd;
02773         LVCOLUMN col;
02774         memset(&col, 0, sizeof(col));
02775         col.mask = LVCF_TEXT;
02776         col.pszText = (char *)title;
02777         VERIFY(list->SetColumn(num, &col));
02778     }
02779 #endif
02780 }
02781
02782 void UWidget::OnListSetColWidth(int cmd, int num, int width)
02783 {
02784     void *w = GetWidget(cmd);
02785     if(w == 0L)
02786         return;
02787
02788 #if qGTK
02789     if(!GTK_IS_CLIST(w))
02790         return;
02791
02792     GtkCList *list = GTK_CLIST(w);
02793     gtk_clist_set_column_width(list, num, width);
02794 #endif
02795 #ifdef WIN32
02796     CWnd *wnd = (CWnd *)w;
02797
02798     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02799     {
02800         CListCtrl *list = (CListCtrl *)wnd;
02801         LVCOLUMN col;
02802         memset(&col, 0, sizeof(col));
02803         col.mask = LVCF_WIDTH;
02804         col.cx = width;
02805         VERIFY(list->SetColumn(num, &col));
02806     }
02807 #endif
02808 #if qMacPP
02809     LPane *view = (LPane *)w;
02810     LOutlineTable *table;
02811     LTextTableView *tabtext;
02812     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
02813     {
02814         macpp_preparetable(table);
02815         LTableGeometry *geom = table->GetTableGeometry();
02816         if(geom != 0L)
02817             geom->SetColWidth(width, num + 1, num + 1);
02818     }
02819     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
02820     {
02821         macpp_preparetable(GetWidget(kUMainWidget), tabtext);
02822         LTableGeometry *geom = tabtext->GetTableGeometry();
02823         if(geom != 0L)
02824             geom->SetColWidth(width, num + 1, num + 1);
02825     }
02826 #endif
02827 }
02828
02829 void UWidget::OnListResetAll(int cmd)
02830 {
02831     void *w = GetWidget(cmd);
02832     if(w == 0L)
02833         return;
02834
02835 #if qGTK
02836     if(!GTK_IS_CLIST(w))
02837         return;
02838
02839     GtkCList *list = GTK_CLIST(w);
02840     gtk_clist_clear(list);
02841 #endif
02842 #if qMacAPP
02843     TView *view = (TView *)w;
02844     if(MA_MEMBER(view, TPseudoTextListView))
02845     {
02846         TPseudoTextListView *txt = (TPseudoTextListView *)view;
02847         txt->RemoveAll();
02848     }
02849 #endif
02850 #if qMacPP
02851     LPane *view = (LPane *)w;
02852     LOutlineTable *table;
02853     LTextTableView *tabtext;
02854     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
02855     {
02856         macpp_preparetable(table);
02857         LArrayIterator iter(table->GetFirstLevelItems());
02858         LOutlineItem* item;
02859         while (iter.Next(&item))
02860         {
02861             table->RemoveItem(item, false, false);
02862         }
02863         table->AdjustImageSize(false);
02864         table->Refresh();
02865     }
02866     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
02867     {
02868         macpp_preparetable(GetWidget(kUMainWidget), tabtext);
02869         tabtext->RemoveAllRows(false);
02870         tabtext->Refresh();
02871     }
02872 #endif
02873 #ifdef WIN32
02874     CWnd *wnd = (CWnd *)w;
02875
02876     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02877     {
02878         CListCtrl *list = (CListCtrl *)wnd;
02879         VERIFY(list->DeleteAllItems());
02880     }
02881 #endif
02882 }
02883
02884 void UWidget::OnListAddSel(int cmd, int entry)
02885 {
02886     void *w = GetWidget(cmd);
02887     if(w == 0L)
02888         return;
02889
02890 #if qMacAPP
02891     TView *view = (TView *)w;
02892     if(MA_MEMBER(view, TPseudoTextListView))
02893     {
02894         TPseudoTextListView *txt = (TPseudoTextListView *)view;
02895         txt->SelectItem(entry + 1, false, true, true);
02896     }
02897 #endif
02898 #if qGTK
02899     if(!GTK_IS_CLIST(w))
02900         return;
02901
02902     GtkCList *list = GTK_CLIST(w);
02903     gtk_clist_select_row(list, entry, 0);
02904 #endif
02905 #ifdef WIN32
02906     CWnd *wnd = (CWnd *)w;
02907
02908     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02909     {
02910         CListCtrl *list = (CListCtrl *)wnd;
02911         VERIFY(list->SetItemState(entry, LVIS_SELECTED, LVIS_SELECTED));
02912         VERIFY(list->EnsureVisible(entry, true));
02913     }
02914 #endif
02915 #if qMacPP
02916     LPane *view = (LPane *)w;
02917     LTableView *table;
02918     if((table = dynamic_cast<LTableView *>(view)) != 0L)
02919     {
02920         STableCell cell(entry + 1, 1);
02921         table->SelectCell(cell);
02922         table->ScrollCellIntoFrame(cell);
02923     }
02924 #endif
02925 }
02926
02927 void UWidget::OnListDelRow(int cmd, int entry)
02928 {
02929     void *w = GetWidget(cmd);
02930     if(w == 0L)
02931         return;
02932
02933 #if qMacAPP
02934     TView *view = (TView *)w;
02935     if(MA_MEMBER(view, TPseudoTextListView))
02936     {
02937         TPseudoTextListView *txt = (TPseudoTextListView *)view;
02938         txt->DelItemAt(entry + 1, 1);
02939     }
02940 #endif
02941 #if qGTK
02942     if(!GTK_IS_CLIST(w))
02943         return;
02944
02945     GtkCList *list = GTK_CLIST(w);
02946     gtk_clist_remove(list, entry);
02947 #endif
02948 #ifdef WIN32
02949     CWnd *wnd = (CWnd *)w;
02950
02951     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02952     {
02953         CListCtrl *list = (CListCtrl *)wnd;
02954         VERIFY(list->DeleteItem(entry));
02955     }
02956 #endif
02957 #if qMacPP
02958     LPane *view = (LPane *)w;
02959     LOutlineTable *table;
02960     LTextTableView *tabtext;
02961     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
02962     {
02963         LOutlineItem* item = table->FindItemForRow(entry + 1);
02964         if(item != 0L)
02965         {
02966             table->RemoveItem(item);
02967         }
02968     }
02969     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
02970     {
02971         tabtext->RemoveRows(1, entry + 1, true);
02972     }
02973 #endif
02974 }
02975
02976 void UWidget::OnListSetFeedback(int cmd, int turnOn)
02977 {
02978     void *w = GetWidget(cmd);
02979     if(w == 0L)
02980         return;
02981
02982 #if qGTK
02983     if(!GTK_IS_CLIST(w))
02984         return;
02985
02986     GtkCList *list = GTK_CLIST(w);
02987     if(turnOn)
02988         gtk_clist_thaw(list);
02989     else
02990         gtk_clist_freeze(list);
02991 #endif
02992 }
02993
02994 void UWidget::OnListNewRow(int cmd, int *num)
02995 {
02996     *num = 0; // sanity
02997
02998     void *w = GetWidget(cmd);
02999     if(w == 0L)
03000         return;
03001
03002 #if qGTK
03003     if(!GTK_IS_CLIST(w))
03004         return;
03005
03006     gchar *emptyTxts[] = {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
03007
03008     GtkCList *list = GTK_CLIST(w);
03009     *num = gtk_clist_append  (list, emptyTxts);
03010 #endif
03011 #if qMacAPP
03012     TView *view = (TView *)w;
03013     if(MA_MEMBER(view, TPseudoTextListView))
03014     {
03015         TPseudoTextListView *txt = (TPseudoTextListView *)view;
03016         *num = txt->GetNumOfRows();
03017     }
03018 #endif
03019 #ifdef WIN32
03020     CWnd *wnd = (CWnd *)w;
03021
03022     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
03023     {
03024         CListCtrl *list = (CListCtrl *)wnd;
03025         *num = list->GetItemCount();
03026     }
03027 #endif
03028 #if qMacPP
03029     LPane *view = (LPane *)w;
03030     LOutlineTable *table;
03031     LTextTableView *tabtext;
03032     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
03033     {
03034         // Store this information in the list view
03035         CPseudoItem *theItem = NEW CPseudoItem(GetWidID(), cmd);
03036         if(theItem != 0L)
03037         {
03038             TableIndexT outRows, outCols;
03039             table->GetTableSize(outRows, outCols);
03040             // and insert it at the end of the table
03041             LOutlineItem *lastItem = table->FindItemForRow(outRows);
03042             table->InsertItem( theItem, nil, lastItem );
03043             *num = outRows;
03044         }
03045     }
03046     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
03047     {
03048         TableIndexT outRows, outCols;
03049         tabtext->GetTableSize(outRows, outCols);
03050         tabtext->InsertRows(1, outRows);
03051         tabtext->AdjustImageSize(false);
03052         *num = outRows;
03053     }
03054 #endif
03055 }
03056
03057 void UWidget::OnListRowSetData(int cmd, int num, void *data)
03058 {
03059     void *w = GetWidget(cmd);
03060     if(w == 0L)
03061         return;
03062
03063 #if qGTK
03064     if(!GTK_IS_CLIST(w))
03065         return;
03066
03067     GtkCList *list = GTK_CLIST(w);
03068     gtk_clist_set_row_data(list, num, data);
03069 #endif
03070 #if qMacPP
03071     LPane *view = (LPane *)w;
03072     LOutlineTable *table;
03073     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
03074     {
03075         // Store this information in the list view
03076         LOutlineItem *item = table->FindItemForRow(num + 1);
03077         CPseudoItem *theItem;
03078         if((theItem = dynamic_cast<CPseudoItem *>(item)) != 0L)
03079         {
03080             theItem->m_data = data;
03081         }
03082     }
03083 #endif
03084 }
03085
03086 void UWidget::OnListRowGetData(int cmd, int row, void **data)
03087 {
03088     *data = 0L; // sanity
03089
03090     void *w = GetWidget(cmd);
03091     if(w == 0L)
03092         return;
03093
03094 #if qGTK
03095     if(!GTK_IS_CLIST(w))
03096         return;
03097
03098     GtkCList *list = GTK_CLIST(w);
03099     *data = gtk_clist_get_row_data(list, row);
03100 #endif
03101 #if qMacPP
03102     LPane *view = (LPane *)w;
03103     LOutlineTable *table;
03104     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
03105     {
03106         // Store this information in the list view
03107         LOutlineItem *item = table->FindItemForRow(row + 1);
03108         CPseudoItem *theItem;
03109         if((theItem = dynamic_cast<CPseudoItem *>(item)) != 0L)
03110         {
03111             *data = theItem->m_data;
03112         }
03113     }
03114 #endif
03115 }
03116
03117 int UWidget::OnListGetNextSel(int cmd, int selectedCell)
03118 {
03119     void *w = GetWidget(cmd);
03120     if(w == 0L)
03121         return -1;
03122
03123 #if qGTK
03124     if(!GTK_IS_CLIST(w))
03125         return -1;
03126
03127     GList *sel = GTK_CLIST(w)->selection;
03128     if(sel == 0L)
03129         return -1;
03130
03131     while(sel != 0L)
03132     {
03133         gint row = GPOINTER_TO_INT(sel->data);
03134         if(selectedCell == -1)
03135             return row;
03136
03137         sel = (GList *)g_list_next(sel);
03138
03139         if(selectedCell == row)
03140         {
03141             return sel == 0L ? -1 : GPOINTER_TO_INT(sel->data);
03142         }
03143     }
03144 #endif
03145 #if qMacAPP
03146     TView *view = (TView *)w;
03147     if(MA_MEMBER(view, TPseudoTextListView))
03148     {
03149         TPseudoTextListView *txt = (TPseudoTextListView *)view;
03150         if(txt->FirstSelectedItem() == 0)
03151             return -1;
03152
03153         for(GridCoordinate c = 0; c < txt->GetNumOfRows(); ++c)
03154         {
03155             if(!txt->IsItemSelected(c + 1))
03156                 continue;
03157
03158             if(selectedCell == -1)
03159                 return c;
03160
03161             if(selectedCell == c)
03162                 selectedCell = -1; // so the next pick is the one
03163         }
03164     }
03165 #endif
03166 #ifdef WIN32
03167     CWnd *wnd = (CWnd *)w;
03168
03169     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
03170     {
03171         CListCtrl *list = (CListCtrl *)wnd;
03172         return list->GetNextItem(selectedCell, LVNI_SELECTED);
03173     }
03174 #endif
03175 #if qMacPP
03176     LPane *view = (LPane *)w;
03177     LTableView *table;
03178     if((table = dynamic_cast<LTableView *>(view)) != 0L)
03179     {
03180         STableCell sel;
03181         if(selectedCell == -1)
03182         {
03183             sel = table->GetFirstSelectedCell();
03184             return sel.row - 1;
03185         }
03186
03187         sel.row = selectedCell + 1;
03188         sel.col = 1;
03189         while(table->GetNextSelectedCell(sel))
03190         {
03191             if(sel.row != selectedCell + 1)
03192                 return sel.row - 1;
03193         }
03194     }
03195 #endif
03196
03197     return -1;
03198 }
03199
03200 int UWidget::OnListGetNext(int cmd, int whichCell)
03201 {
03202     void *w = GetWidget(cmd);
03203     if(w == 0L)
03204         return -1;
03205
03206 #if qGTK
03207     if(!GTK_IS_CLIST(w))
03208         return -1;
03209
03210     if(whichCell == -1)
03211         whichCell = 0;
03212     else
03213         whichCell++;
03214
03215     if(whichCell >= GTK_CLIST(w)->rows)
03216         whichCell = -1;
03217
03218     return whichCell;
03219 #endif
03220 #ifdef WIN32
03221     CWnd *wnd = (CWnd *)w;
03222
03223     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
03224     {
03225         CListCtrl *list = (CListCtrl *)wnd;
03226         return list->GetNextItem(whichCell, LVNI_ALL);
03227     }
03228 #endif
03229 #if qMacPP
03230     LPane *view = (LPane *)w;
03231     LTableView *table;
03232     if((table = dynamic_cast<LTableView *>(view)) != 0L)
03233     {
03234         STableCell sel;
03235
03236         if(whichCell != -1)
03237         {
03238             sel.row = whichCell + 1;
03239             sel.col = 1;
03240         }
03241
03242         while(table->GetNextCell(sel))
03243         {
03244             if(sel.row != whichCell + 1)
03245                 return sel.row - 1;
03246         }
03247     }
03248 #endif
03249
03250     return -1;
03251 }
03252
03253 void UWidget::OnListInsert(int cmd, ULIST_INSERT *data)
03254 {
03255     void *w = GetWidget(cmd);
03256     if(w == 0L)
03257         return;
03258
03259 #if qGTK
03260     if(!GTK_IS_CLIST(w))
03261         return;
03262
03263     GtkCList *list = GTK_CLIST(w);
03264
03265     if(data->title == 0L && data->icon == 0L)
03266         g_warning("Got an empty cell !\n");
03267     else if(data->title == 0L)
03268     {
03269         GtkPixmap *pix = GTK_PIXMAP(data->icon);
03270         gtk_clist_set_pixmap(list, data->row, data->col, pix->pixmap, pix->mask);
03271     }
03272     else if(data->icon == 0L)
03273     {
03274         gtk_clist_set_text(list, data->row, data->col, data->title);
03275     }
03276     else
03277     {
03278         GtkPixmap *pix = GTK_PIXMAP(data->icon);
03279         gtk_clist_set_pixtext(list, data->row, data->col, data->title, 2, pix->pixmap, pix->mask);
03280     }
03281 #endif
03282 #if qMacAPP
03283     TView *view = (TView *)w;
03284     if(MA_MEMBER(view, TPseudoTextListView))
03285     {
03286         TPseudoTextListView *txt = (TPseudoTextListView *)view;
03287         //txt->InsStringBefore(data->row + 1, data->title);
03288         txt->InsStringLast(data->title);
03289     }
03290 #endif
03291 #ifdef WIN32
03292     CWnd *wnd = (CWnd *)w;
03293
03294     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
03295     {
03296         CListCtrl *list = (CListCtrl *)wnd;
03297         if(data->col == 0)
03298         {
03299             LV_ITEM lvi;
03300             memset(&lvi, 0, sizeof(lvi));
03301             lvi.mask = LVIF_TEXT;
03302             lvi.iItem = data->row;
03303             lvi.iSubItem = 0;
03304             lvi.pszText = (char *)data->title;
03305
03306             list->InsertItem(&lvi);
03307         }
03308         else
03309         {
03310             list->SetItemText(data->row, data->col, data->title);
03311         }
03312     }
03313 #endif
03314 #if qMacPP
03315     LPane *view = (LPane *)w;
03316     LOutlineTable *table;
03317     LTextTableView *tabtext;
03318     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
03319     {
03320         LOutlineItem *item = table->FindItemForRow(data->row + 1);
03321         CPseudoItem *theItem;
03322         if((theItem = dynamic_cast<CPseudoItem *>(item)) != 0L)
03323         {
03324             std::map<int, UStr>::value_type val(data->col + 1, UStr(data->title));
03325             theItem->m_texts.insert(val);
03326         }
03327     }
03328     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
03329     {
03330         STableCell cell(data->row + 1, data->col + 1);
03331         tabtext->SetCellData(cell, data->title, strlen(data->title));
03332     }
03333 #endif
03334 }
03335
03336 void UWidget::OnListGetInfo(int cmd, ULIST_INFO *desc)
03337 {
03338     // sanity
03339     desc->data = 0L;
03340     desc->title = 0L;
03341
03342     void *w = GetWidget(cmd);
03343     if(w == 0L)
03344         return;
03345
03346 #if qMacAPP
03347     TView *view = (TView *)w;
03348     if(MA_MEMBER(view, TPseudoTextListView))
03349     {
03350         static UStr cstr; // no good
03351
03352         TPseudoTextListView *txt = (TPseudoTextListView *)view;
03353         CStr255_AC name = txt->GetItemText(desc->row + 1);
03354         cstr = name;
03355         desc->title = cstr;
03356     }
03357 #endif
03358 #if qGTK
03359     if(!GTK_IS_CLIST(w))
03360         return;
03361
03362     GtkCList *list = GTK_CLIST(w);
03363     desc->data = gtk_clist_get_row_data(list, desc->row);
03364     gtk_clist_get_text_is_buggy(list, desc->row, desc->col, (gchar **)&desc->title);
03365 #endif
03366 #ifdef WIN32
03367     CWnd *wnd = (CWnd *)w;
03368
03369     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
03370     {
03371         CListCtrl *list = (CListCtrl *)wnd;
03372
03373         desc->data = (void *)list->GetItemData(desc->row);
03374         static CString s;
03375         s = list->GetItemText(desc->row, desc->col);
03376         desc->title = s;
03377     }
03378 #endif
03379 #if qMacPP
03380     LPane *view = (LPane *)w;
03381     LOutlineTable *table;
03382     LTextTableView *tabtext;
03383     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
03384     {
03385         LOutlineItem *item = table->FindItemForRow(desc->row + 1);
03386         CPseudoItem *theItem;
03387         if((theItem = dynamic_cast<CPseudoItem *>(item)) != 0L)
03388         {
03389             std::map<int, UStr>::iterator i = theItem->m_texts.find(desc->col + 1);
03390             if(i != theItem->m_texts.end())
03391             {
03392                 desc->title = (*i).second;
03393             }
03394             desc->data = theItem->m_data;
03395         }
03396     }
03397     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
03398     {
03399         STableCell cell(desc->row + 1, desc->col + 1);
03400         UInt32 ioDataSize = 255;
03401         char tmp[255];
03402         tabtext->GetCellData(cell, tmp, ioDataSize);
03403         static UStr res;
03404         res.set(tmp, ioDataSize);
03405         desc->title = res;
03406     }
03407 #endif
03408 }
03409
03410 void UWidget::OnListResort(int cmd, int column, UListSorter s)
03411 {
03412     void *w = GetWidget(cmd);
03413     if(w == 0L)
03414         return;
03415
03416 #if qGTK
03417     if(!GTK_IS_CLIST(w))
03418         return;
03419
03420     GtkCList *list = GTK_CLIST(w);
03421
03422     sGtkClistDiff = s;
03423     sGtkClistWid = this;
03424     gtk_clist_set_compare_func(list, gtkclistdefcompare);
03425     gtk_clist_set_sort_column(list, column);
03426     gtk_clist_sort(list);
03427     gtk_clist_set_compare_func(list, 0L);
03428 #endif
03429 }
03430
03431 int UWidget::OnUpdateFocus(int leave, void *widget)
03432 {
03433     std::map<int, void *>::const_iterator i;
03434
03435     for(i = m_widgets.begin(); i != m_widgets.end(); ++i)
03436     {
03437         if((*i).second == widget)
03438             break;
03439     }
03440     if(i == m_widgets.end())
03441         return 0; // continue notification
03442
03443     if(leave)
03444     {
03445         if(sFocusWidID == GetWidID())
03446             sFocusWidID = -1;
03447     }
03448     else
03449     {
03450         sFocusWidID = GetWidID();
03451         sFocusCmdID = (*i).first;
03452     }
03453
03454     return 1; // stop notification
03455 }
03456
03457 bool UWidget::HasModal(void)
03458 {
03459 #if qGTK
03460     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
03461     STD map<int, UCmdTarget *>::const_iterator i;
03462     for(i = targets.begin(); i != targets.end(); ++i)
03463     {
03464         UCmdTarget *target = (*i).second;
03465         if(!target->IsKindOf(URUNTIME_CLASS(UWidget)))
03466             continue;
03467
03468         UWidget *wid = (UWidget *)target;
03469         if(wid->m_modalLoop)
03470             return true;
03471     }
03472 #endif
03473     return false;
03474 }
03475
03476 int UWidget::OnFetchCmd(int cmd, void *widget)
03477 {
03478     std::map<int, void *>::const_iterator i;
03479     for(i = m_widgets.begin(); i != m_widgets.end(); ++i)
03480     {
03481         if(widget == (*i).second)
03482             return (*i).first;
03483     }
03484     return -1;
03485 }
03486
03487 void UWidget::AddPage(UWidget *page, int pagecmd, int num_page)
03488 {
03489     void *wid = GetWidget(kUMainWidget);
03490     if(wid == 0L)
03491         return;
03492
03493     UEventSendMessage(page->GetWidID(), EV_INIT_TAB_WIDGET, UMAKEINT(pagecmd, num_page), wid);
03494     std::map<int, UWidget *>::value_type val(UMAKEINT(pagecmd, num_page), page);
03495     m_tabs.insert(val);
03496
03497 #if qMacPP
03498     // emulate the click in tab 1
03499     if(num_page == 0)
03500     {
03501         // emulate the click in tab 1
03502         UEventSendMessage(GetWidID(), EV_PAGE_CHANGED, UMAKEINT(pagecmd, num_page), 0L);
03503     }
03504 #endif /* qMacPP */
03505 }
03506
03507 void UWidget::OnPageChanged(int cmdid, int num_page)
03508 {
03509     if(m_currentPage == UMAKEINT(cmdid, num_page))
03510         return;
03511
03512     std::map<int, UWidget *>::iterator i;
03513     if(m_currentPage != -1)
03514     {
03515         i = m_tabs.find(m_currentPage);
03516         if(i != m_tabs.end())
03517         {
03518             UWidget *tab = (*i).second;
03519             tab->DoDataExchange(false);
03520
03521 #if qMacPP
03522             LPseudoWinAttachment *attach = macpp_getattachwindow(this);
03523             if(attach != 0L)
03524             {
03525                 attach->InvalidCache(tab);
03526             }
03527
03528             tab->m_widgets.erase(tab->m_widgets.begin(), tab->m_widgets.end());
03529 #endif /* qMacPP */
03530         }
03531     }
03532
03533     if(num_page == -1)
03534     {
03535         m_currentPage = -1;
03536         return;
03537     }
03538
03539     i = m_tabs.find(UMAKEINT(cmdid, num_page));
03540     if(i != m_tabs.end())
03541     {
03542         UWidget *tab = (*i).second;
03543
03544 #if qMacPP
03545         UPseudoPlaceHolder *holder = dynamic_cast<UPseudoPlaceHolder *>((LPane *)GetWidget(cmdid));
03546         if(holder != 0L)
03547         {
03548             macpp_fecthview(tab->GetWidID(), holder->GetCurrentView());
03549
03550             LPseudoWinAttachment *attach = macpp_getattachwindow(this);
03551             if(attach != 0L)
03552             {
03553                 macpp_linkbroadcasters(holder->GetCurrentView(), attach);
03554             }
03555         }
03556 #endif /* qMacPP */
03557
03558         tab->DoDataExchange(true);
03559     }
03560     m_currentPage = UMAKEINT(cmdid, num_page);
03561 }
03562
03563 #ifdef WIN32
03564 void UWidget::OverideMapWidget(int cmdid, CRuntimeClass *widClass)
03565 {
03566     std::map<int, CRuntimeClass *>::value_type val(cmdid, widClass);
03567     m_overide.insert(val);
03568 }
03569 #endif
03570
03571 #if qMacPP || qMacAPP
03572 SInt32 UWidget::GetPaneID(int cmdid)
03573 {
03574     cmdid -= EV_COMMAND_START;
03575     unsigned char tmp[50];
03576     unsigned char res[5] = {'p', 's', '\0', '\0', '\0'};
03577     sprintf((char *)tmp, "%d", cmdid);
03578     if(strlen((char *)tmp) > 2 || cmdid < 0)
03579     {
03580         UAppConsole("cmdid too big (%d)\n", cmdid);
03581     }
03582     else if(strlen((char *)tmp) == 2)
03583     {
03584         res[2] = tmp[0];
03585         res[3] = tmp[1];
03586     }
03587     else
03588     {
03589         res[2] = '0';
03590         res[3] = tmp[0];
03591     }
03592
03593     SInt32 num = (res[0] << 24) | (res[1] << 16) | (res[2] << 8) | res[3];
03594     return num;
03595 }
03596 #endif
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/uwidget.h Source File

rf/uwidget.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- May 1999
00019  */
00020
00021 #ifndef UWIDGET_H
00022 #define UWIDGET_H
00023
00024 #include "umain.h"
00025 #include "ustr.h"
00026
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030
00031 #ifdef WIN32
00032     LRESULT UWinPseudoWindowProc(CWnd *wnd, UWidget *wid, UINT message, WPARAM wParam, LPARAM lParam);
00033         // - intercepts the messages and broadcast to the pseudo-widgets associated with.
00034         // - if it returns FALSE, you should return FALSE too.
00035         // - you need to overide the CWnd::WindowProc in order to use it.
00036 #endif
00037
00038 #ifdef __cplusplus
00039 }
00040 #endif
00041
00042 #ifdef __cplusplus
00043
00044 #ifdef _MSC_VER
00045 #   pragma warning (disable : 4786)
00046 #endif
00047
00048 #include <vector>
00049 #include <map>
00050
00055 class UTimer
00056 {
00057 public:
00058     UTimer(int lap, int lastlap, int cmd) : m_lap(lap), m_lastlap(lastlap), m_cmd(cmd) {}
00059     UTimer() : m_lap(0), m_lastlap(0), m_cmd(0) {}
00060     UTimer(const UTimer & src) : m_lap(src.m_lap), m_lastlap(src.m_lastlap), m_cmd(src.m_cmd) {}
00061
00062     UTimer & operator=(const UTimer & src)
00063     {
00064         m_lastlap = src.m_lastlap;
00065         m_lap = src.m_lap;
00066         m_cmd = src.m_cmd;
00067
00068         return *this;
00069     }
00070     long m_lap; // in millisecond
00071     long m_lastlap; // in millisecond
00072     int m_cmd; // command associated with
00073 };
00074
00080 struct UColor
00081 {
00082     unsigned char r, g, b;
00083 };
00084
00086 #define kUMainWidget 0
00087
00088 #if qGTK
00089 #   define kUgtkDataToken "_pseudoWidget"
00090 #   define kUgtkPrefixToken "pseudo" /* pseudo_0, pseudoA_0, pseudo<opt>_<cmdid> */
00091 #endif
00092 #ifdef WIN32
00093     class CDialog;
00094 #endif
00095
00106 class UEXPORT UWidget : public UCmdTarget
00107 {
00108     UDECLARE_DYNAMIC(UWidget)
00109 public:
00111     UWidget(int widid);
00112     virtual ~UWidget();
00113
00116     virtual void AddListener(UCmdTarget * listener);
00117
00119     virtual int UDispatchMessage(int/*UEventType*/ evt, int arg1, void *arg2, UDispatchInfo & dispatchInfo);
00120
00126     void *GetWidget(int cmd) const;
00127
00130     inline std::map<int, void *> & GetWidgets(void) { return m_widgets; }
00131
00135     bool WidgetIsActive(int cmd) const;
00136
00140     const char *GetTooltip(int cmd) const;
00141
00145     void AddTooltip(int cmd, const char *tooltipID);
00146
00150     // \note this timer is removed automatically when the object is removed.
00151     void AddTimer(long lap, int cmd);
00152
00155     void RemoveTimer(int cmd);
00156
00158     std::vector<UTimer> & GetTimers(void);
00159
00164     bool DoModal(int id = 0);
00165
00168     void EndModal(bool result);
00169
00172     virtual void DoDataExchange(bool /*fill*/) {}
00173
00175     virtual void Dismiss(void) {}
00176
00178     static bool HasModal(void);
00179
00183     static bool IsUIValid(); /*{ return sValidMenu; }*/
00184
00191     static void DoValidUI(bool how); /*{ sValidMenu = how; } */
00192
00196     virtual void BeforeUpdateUI(void) {}
00197
00201     static int GetFocus(void); /*{ return sFocusWidID; } */
00202     static int GetFocusCmd(void); /*{ return sFocusCmdID; }*/
00203
00205     inline bool HasFocus(void) { return GetFocus() == GetWidID(); }
00206
00208     inline bool HasFocus(int cmdid) { return GetFocus() == GetWidID() && GetFocusCmd() == cmdid; }
00209
00213     void AddPage(UWidget *page, int pagecmd, int num_page);
00214
00215 #ifdef WIN32
00216     void OverideMapWidget(int cmdid, CRuntimeClass *widClass);
00217     inline std::map<int, CRuntimeClass *> & GetOverideList(void) { return m_overide; }
00218         // use a class instead of the one by default for this item.
00219         // to call before DoModal, before the widgets get created.
00220
00221     inline CDialog *GetCurModal() const { return m_curModal; }
00222         // during DoModal, this value is set to the MFC dialog
00223 #endif
00224 #if qMacPP || qMacAPP
00225
00226     static SInt32 GetPaneID(int cmdid);
00227 #endif
00228 protected:
00229
00230     std::vector<UCmdTarget *> m_listeners;
00231     std::map<int, void *> m_widgets;
00232     std::map<int, UStr> m_tooltips;
00233     std::vector<UTimer> m_timers;
00234     std::map<int, UWidget *> m_tabs;
00235
00236     bool m_modalRes;
00237     int m_currentPage;
00238 #if qGTK || qMacPP
00239     bool m_modalLoop;
00240 #endif
00241 #ifdef WIN32
00242     CDialog *m_curModal;
00243     std::map<int, CRuntimeClass *> m_overide; // see WinInitWidgets
00244     bool m_noDispatch;
00245 #endif
00246     static bool sValidMenu;
00247
00248     static int sFocusWidID;
00249     static int sFocusCmdID;
00250
00254     ev_msg int OnGetState(int cmd);
00258     ev_msg void OnSetState(int cmd, int state);
00262     ev_msg void OnEnableCmd(int cmd, int state);
00265     ev_msg void OnChgFocus(int cmd);
00268     ev_msg void OnInvalidate(int cmd);
00271     ev_msg void OnRedraw(int cmd);
00275     ev_msg void OnSetText(int cmd, const char *text);
00279     ev_msg void OnGetText(int cmd, UStr *text);
00283     ev_msg void OnSetFloat(int cmd, const float *f);
00287     ev_msg void OnGetFloat(int cmd, float *f);
00291     ev_msg void OnInitWidget(int cmd, void *widget);
00297     ev_msg void OnInitTabWidget(int cmd, int page, void *widget);
00301     ev_msg void OnShowWidget(int cmd, int state);
00305     ev_msg void OnSetSlider(int cmd, int pos);
00309     ev_msg void OnGetSliderProperty(int cmd, USLIDER *prop);
00313     ev_msg void OnSetSliderProperty(int cmd, const USLIDER *prop);
00316     ev_msg void OnSetTooltip(int cmd, UCmdUI *pCmdUI);
00320     ev_msg void OnGetLoc(int cmd, URECT * r);
00324     ev_msg void OnSetLoc(int cmd, const URECT * r);
00329     ev_msg void OnChgCursor(int cmd, UCURSOR cursor);
00334     ev_msg void OnUpdateUI(void);
00336     ev_msg void OnTreeResetAll(int cmd);
00338     ev_msg void OnTreeInsert(int cmd, UTREE_INSERT *data);
00340     ev_msg void OnTreeGetInfo(int cmd, UTREE_INFO *data);
00342     ev_msg void OnTreeSetData(int cmd, UTREE_INFO *data);
00344     ev_msg void OnTreeSetIcon(int cmd, UTREE_INFO *data);
00346     ev_msg void OnTreeDelete(int cmd, UTREEITEM item);
00348     ev_msg void OnTreeExpand(int cmd, int collapse, UTREEITEM item);
00350     ev_msg void OnTreeSelect(int cmd, int deselect, UTREEITEM item);
00352     ev_msg void OnTreeGetSel(int cmd, UTREEITEM *item);
00354     ev_msg void OnListAddColumns(int cmd, int num);
00356     ev_msg void OnListSetColTitle(int cmd, int num, const char *title);
00358     ev_msg void OnListSetColWidth(int cmd, int num, int width);
00360     ev_msg void OnListResetAll(int cmd);
00362     ev_msg void OnListAddSel(int cmd, int entry);
00364     ev_msg void OnListDelRow(int cmd, int row);
00366     ev_msg void OnListSetFeedback(int cmd, int turnOn);
00368     ev_msg void OnListNewRow(int cmd, int *num);
00370     ev_msg void OnListRowSetData(int cmd, int row, void *data);
00372     ev_msg void OnListRowGetData(int cmd, int row, void **data);
00374     ev_msg void OnListInsert(int cmd, ULIST_INSERT *data);
00376     ev_msg void OnListGetInfo(int cmd, ULIST_INFO *desc);
00378     ev_msg int OnListGetNextSel(int cmd, int selectedCell);
00380     ev_msg int OnListGetNext(int cmd, int whichCell);
00382     ev_msg void OnListResort(int cmd, int column, UListSorter s);
00384     ev_msg void OnComboResetAll(int cmd);
00386     ev_msg void OnComboAppend(int cmd, const char *txt);
00388     ev_msg void OnComboSetPos(int cmd, int sel);
00390     ev_msg int OnComboGetPos(int cmd, UStr *txt);
00392     ev_msg int OnComboGetCount(int cmd);
00394     ev_msg void OnComboDelSel(int cmd, int sel);
00397     ev_msg void OnComboEnableSel(int cmd, int sel, int state);
00399     ev_msg void OnComboGetMenu(int cmd, UMENU *menu);
00401     ev_msg int OnUpdateFocus(int leave, void *widget);
00403     ev_msg int OnFetchCmd(int cmd, void *widget);
00405     ev_msg void OnPageChanged(int cmd, int pagenum);
00406
00407     UDECLARE_MESSAGE_MAP()
00408
00409 #if qMacPP
00410     friend class LPseudoWinAttachment;
00411 #endif
00412 #ifdef WIN32
00413     friend LRESULT UWinPseudoWindowProc(CWnd *wnd, UWidget *wid, UINT message, WPARAM wParam, LPARAM lParam);
00414 #endif
00415 };
00416
00417 #endif /* __cplusplus */
00418
00419 #endif /* UWIDGET_H */
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


win32.c File Reference

cvs-1.10/windows-NT/win32.c File Reference

#include <ctype.h>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <config.h>
#include <winsock.h>
#include <stdlib.h>
#include "cvs.h"

Include dependency graph for win32.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | WIN32_LEAN_AND_MEAN
#define | GMT_FS(_s) (!strstr(_s,"FAT"))
#define | PP_PASTE(x) #x
#define | PP_STRINGIZE(x) PP_PASTE(x)

Functions

void | init_winsock (int *argc, char ***argv)
void | wnt_cleanup (void)
unsigned | sleep (unsigned seconds)
char * | win32getlogin ()
pid_t | getpid ()
char * | getpass (const char *prompt)
void | _dosmaperr (DWORD dwErr)
BOOL | IsLeapYear (WORD year)
int | CompareTargetDate (const SYSTEMTIME *p_test_date, const SYSTEMTIME *p_target_date)
int | GetTimeZoneBias (const SYSTEMTIME *pst)
int | IsDST (const SYSTEMTIME *pst)
void | LocalSystemTimeToUtcSystemTime (const SYSTEMTIME *p_local, SYSTEMTIME *p_utc)
BOOL | FileTimeToUnixTime (const FILETIME *pft, time_t *put, BOOL local_time)
int | _statcore (HANDLE hFile, const char *filename, struct stat *buf)
int | wnt_stat (const char *name, struct stat *buf)
int | wnt_fstat (int fildes, struct stat *buf)
int | wnt_lstat (const char *name, struct stat *buf)
char * | wnt_asctime (const struct tm *tm)
char * | wnt_ctime (const time_t *t)

Variables

{ ... } errors []
const WORD | month_len [12]
const ULONGLONG | systemtime_second = 10000000L

Define Documentation

#define GMT_FS ( _s ) (!strstr(_s,"FAT"))

Definition at line 23 of file win32.c.

Referenced by _statcore().

#define PP_PASTE ( x ) #x

Definition at line 25 of file win32.c.

#define PP_STRINGIZE ( x ) PP_PASTE(x)

Definition at line 26 of file win32.c.

#define WIN32_LEAN_AND_MEAN

Definition at line 11 of file win32.c.

Function Documentation

int CompareTargetDate | ( | const SYSTEMTIME * | p_test_date,
 |  | const SYSTEMTIME * | p_target_date
 | ) | [static]

Definition at line 265 of file win32.c.

00269 {
00270     WORD first_day_of_month; /* day of week of the first. Sunday = 0 */
00271     WORD end_of_month;       /* last day of month */
00272     WORD temp_date;
00273     int test_milliseconds, target_milliseconds;
00274
00275     /* Check that p_target_date is in the correct foramt: */
00276     if (p_target_date->wYear)
00277     {
00278         error(0,0,"Internal error: p_target_date is not in TIME_ZONE_INFORMATION format.");
00279         return 0;
00280     }
00281     if (!p_test_date->wYear)
00282     {
00283         error(0,0,"Internal error: p_test_date must be an actual date, not TIME_ZONE_INFORMAATION format.");
00284         return 0;
00285     }
00286
00287     /* Don't waste time calculating if we can shortcut the comparison... */
00288     if (p_test_date->wMonth != p_target_date->wMonth)
00289     {
00290         return (p_test_date->wMonth > p_target_date->wMonth) ? 4 : -4;
00291     }
00292
00293     /* Months equal. Now we neet to do some calculation.
00294      * If we know that y is the day of the week for some arbitrary date x,
00295      * then the day of the week of the first of the month is given by
00296      * (1 + y - x) mod 7.
00297      *
00298      * For instance, if the 19th is a Wednesday (day of week = 3), then
00299      * the date of the first Wednesday of the month is (19 mod 7) = 5.
00300      * If the 5th is a Wednesday (3), then the first of the month is
00301      * four days earlier (it's the first, not the zeroth):
00302      * (3 - 4) = -1; -1 mod 7 = 6. The first is a Saturday.
00303      *
00304      * Check ourselves: The 19th falls on a (6 + 19 - 1) mod 7
00305      * = 24 mod 7 = 3: Wednesday, as it should be.
00306      */
00307     first_day_of_month = (WORD)( (1u + p_test_date->wDayOfWeek - p_test_date->wDay) % 7u);
00308
00309     /* If the first of the month comes on day y, then the first day of week z falls on
00310      * (z - y + 1) mod 7.
00311      *
00312      * For instance, if the first is a Saturday (6), then the first Tuesday (2) falls on a
00313      * (2 - 6 + 1) mod 7 = -3 mod 7 = 4: The fourth. This is correct (see above).
00314      *
00315      * temp_date gets the first <target day of week> in the month.
00316      */
00317     temp_date = (WORD)( (1u + p_target_date->wDayOfWeek - first_day_of_month) % 7u);
00318     /* If we're looking for the third Tuesday in the month, find the date of the first
00319      * Tuesday and add (3 - 1) * 7. In the example, it's the 4 + 14 = 18th.
00320      *
00321      * temp_date now should hold the date for the wDay'th wDayOfWeek of the month.
00322      * we only need to handle the special case of the last <DayOfWeek> of the month.
00323      */
00324     temp_date = (WORD)( temp_date + 7 * p_target_date->wDay );
00325
00326     /* what's the last day of the month? */
00327     end_of_month = month_len [p_target_date->wMonth - 1];
00328     /* Correct if it's February of a leap year? */
00329     if ( p_test_date->wMonth == 2 && IsLeapYear(p_test_date->wYear) )
00330     {
00331         ++ end_of_month;
00332     }
00333
00334     /* if we tried to calculate the fifth Tuesday of the month
00335      * we may well have overshot. Correct for that case.
00336      */
00337     while ( temp_date > end_of_month)
00338         temp_date -= 7;
00339
00340     /* At long last, we're ready to do the comparison. */
00341     if ( p_test_date->wDay != temp_date )
00342     {
00343         return (p_test_date->wDay > temp_date) ? 2 : -2;
00344     }
00345     else
00346     {
00347         test_milliseconds = ((p_test_date->wHour * 60 + p_test_date->wMinute) * 60
00348                                 + p_test_date->wSecond) * 1000 + p_test_date->wMilliseconds;
00349         target_milliseconds = ((p_target_date->wHour * 60 + p_target_date->wMinute) * 60
00350                                 + p_target_date->wSecond) * 1000 + p_target_date->wMilliseconds;
00351         test_milliseconds -= target_milliseconds;
00352         return (test_milliseconds > 0) ? 1 : (test_milliseconds < 0) ? -1 : 0;
00353     }
00354
00355 }

BOOL FileTimeToUnixTime | ( | const FILETIME * | pft,
 |  | time_t * | put,
 |  | BOOL | local_time
 | ) | [static]

Definition at line 476 of file win32.c.

00477 {
00478     BOOL success = FALSE;
00479
00480    /* FILETIME = number of 100-nanosecond ticks since midnight
00481     * 1 Jan 1601 UTC. time_t = number of 1-second ticks since
00482     * midnight 1 Jan 1970 UTC. To translate, we subtract a
00483     * FILETIME representation of midnight, 1 Jan 1970 from the
00484     * time in question and divide by the number of 100-ns ticks
00485     * in one second.
00486     */
00487
00488     SYSTEMTIME base_st =
00489     {
00490         1970,   /* wYear            */
00491         1,      /* wMonth           */
00492         0,      /* wDayOfWeek       */
00493         1,      /* wDay             */
00494         0,      /* wHour            */
00495         0,      /* wMinute          */
00496         0,      /* wSecond          */
00497         0       /* wMilliseconds    */
00498     };
00499
00500     ULARGE_INTEGER itime;
00501     FILETIME base_ft;
00502     int bias = 0;
00503
00504     if (local_time)
00505     {
00506         SYSTEMTIME temp_st;
00507         success = FileTimeToSystemTime(pft, & temp_st);
00508         bias =  GetTimeZoneBias(& temp_st);
00509     }
00510
00511     success = SystemTimeToFileTime ( &base_st, &base_ft );
00512     if (success)
00513     {
00514         itime.QuadPart = ((ULARGE_INTEGER *)pft)->QuadPart;
00515
00516         itime.QuadPart -= ((ULARGE_INTEGER *)&base_ft)->QuadPart;
00517         itime.QuadPart /= systemtime_second;    // itime is now in seconds.
00518         itime.QuadPart += bias * 60;    // bias is in minutes.
00519
00520         *put = itime.LowPart;
00521     }
00522
00523     if (!success)
00524     {
00525         *put = -1;   /* error value used by mktime() */
00526     }
00527     return success;
00528 }

int GetTimeZoneBias ( const SYSTEMTIME * pst ) [static]

Definition at line 362 of file win32.c.

00363 {
00364     TIME_ZONE_INFORMATION tz;
00365     int n, bias;
00366
00367     GetTimeZoneInformation ( &tz );
00368
00369     /*  I only deal with cases where we look at
00370      *  a "last sunday" kind of thing.
00371      */
00372     if (tz.DaylightDate.wYear || tz.StandardDate.wYear)
00373     {
00374         error(0,0, "Cannont handle year-specific DST clues in TIME_ZONE_INFORMATION");
00375         return 0;
00376     }
00377
00378     bias = tz.Bias;
00379
00380     n = CompareTargetDate ( pst, & tz.DaylightDate );
00381     if (n < 0)
00382         bias += tz.StandardBias;
00383     else
00384     {
00385         n = CompareTargetDate ( pst, & tz.StandardDate );
00386         if (n < 0)
00387             bias += tz.DaylightBias;
00388         else
00389             bias += tz.StandardBias;
00390     }
00391     return bias;
00392 }

int IsDST ( const SYSTEMTIME * pst ) [static]

Definition at line 397 of file win32.c.

00398 {
00399     TIME_ZONE_INFORMATION tz;
00400
00401     GetTimeZoneInformation ( &tz );
00402
00403     /*  I only deal with cases where we look at
00404      *  a "last sunday" kind of thing.
00405      */
00406     if (tz.DaylightDate.wYear || tz.StandardDate.wYear)
00407     {
00408         error(0,0, "Cannont handle year-specific DST clues in TIME_ZONE_INFORMATION");
00409         return 0;
00410     }
00411
00412     return (CompareTargetDate ( pst, & tz.DaylightDate ) >= 0)
00413             && (CompareTargetDate ( pst, & tz.StandardDate ) < 0);
00414 }

BOOL IsLeapYear ( WORD year )

Definition at line 222 of file win32.c.

00223 {
00224     return ( (year & 3u == 0)
00225             && ( (year % 100u == 0)
00226                 || (year % 400u == 0) ));
00227 }

void LocalSystemTimeToUtcSystemTime | ( | const SYSTEMTIME * | p_local,
 |  | SYSTEMTIME * | p_utc
 | ) |

Definition at line 432 of file win32.c.

00433 {
00434     TIME_ZONE_INFORMATION tz;
00435     FILETIME ft;
00436     ULARGE_INTEGER itime, delta;
00437     int bias;
00438
00439     * p_utc = * p_local;
00440
00441     GetTimeZoneInformation(&tz);
00442     bias = tz.Bias;
00443     if ( CompareTargetDate(p_local, & tz.DaylightDate) < 0
00444             || CompareTargetDate(p_local, & tz.StandardDate) >= 0)
00445         bias += tz.StandardBias;
00446     else
00447         bias += tz.DaylightBias;
00448
00449     SystemTimeToFileTime(p_local, & ft);
00450     itime.QuadPart = ((ULARGE_INTEGER *) &ft)->QuadPart;
00451     delta.QuadPart = systemtime_second;
00452     delta.QuadPart *= 60;   // minute
00453     delta.QuadPart *= bias;
00454     itime.QuadPart += delta.QuadPart;
00455     ((ULARGE_INTEGER *) & ft)->QuadPart = itime.QuadPart;
00456     FileTimeToSystemTime(& ft, p_utc);
00457 }

void _dosmaperr ( DWORD dwErr ) [static]

Definition at line 199 of file win32.c.

00200 {
00201     int n;
00202     for(n=0; n<sizeof(errors)/sizeof(errors[0]); n++)
00203     {
00204         if(errors[n].err==dwErr)
00205         {
00206             errno=errors[n].dos;
00207             return;
00208         }
00209     }
00210     errno=EFAULT;
00211 }

int _statcore | ( | HANDLE | hFile,
 |  | const char * | filename,
 |  | struct stat * | buf
 | ) | [static]

Definition at line 530 of file win32.c.

00531 {
00532     BY_HANDLE_FILE_INFORMATION bhfi;
00533     int isdev;
00534     char szFs[32];
00535     int is_gmt_fs = -1;
00536
00537     if(hFile)
00538     {
00539         /* Find out what kind of handle underlies filedes
00540         */
00541         isdev = GetFileType(hFile) & ~FILE_TYPE_REMOTE;
00542
00543         if ( isdev != FILE_TYPE_DISK )
00544         {
00545             /* not a disk file. probably a device or pipe
00546              */
00547             if ( (isdev == FILE_TYPE_CHAR) || (isdev == FILE_TYPE_PIPE) )
00548             {
00549                 /* treat pipes and devices similarly. no further info is
00550                  * available from any API, so set the fields as reasonably
00551                  * as possible and return.
00552                  */
00553                 if ( isdev == FILE_TYPE_CHAR )
00554                     buf->st_mode = _S_IFCHR;
00555                 else
00556                     buf->st_mode = _S_IFIFO;
00557
00558                 buf->st_rdev = buf->st_dev = (_dev_t)hFile;
00559                 buf->st_nlink = 1;
00560                 buf->st_uid = buf->st_gid = buf->st_ino = 0;
00561                 buf->st_atime = buf->st_mtime = buf->st_ctime = 0;
00562                 if ( isdev == FILE_TYPE_CHAR )
00563                     buf->st_size = 0;
00564                 else
00565                 {
00566                     unsigned long ulAvail;
00567                     int rc;
00568                     rc = PeekNamedPipe(hFile,NULL,0,NULL,&ulAvail,NULL);
00569                     if (rc)
00570                         buf->st_size = (_off_t)ulAvail;
00571                     else
00572                         buf->st_size = (_off_t)0;
00573                 }
00574
00575                 return 0;
00576             }
00577             else if ( isdev == FILE_TYPE_UNKNOWN )
00578             {
00579                 // Network device
00580                 errno = EBADF;
00581                 return -1;
00582             }
00583         }
00584     }
00585
00586     /* set the common fields
00587      */
00588     buf->st_ino = buf->st_uid = buf->st_gid = buf->st_mode = 0;
00589     buf->st_nlink = 1;
00590
00591     if(hFile)
00592     {
00593         /* use the file handle to get all the info about the file
00594          */
00595         if ( !GetFileInformationByHandle(hFile, &bhfi) )
00596         {
00597             _dosmaperr(GetLastError());
00598             return -1;
00599         }
00600     }
00601     else
00602     {
00603         WIN32_FIND_DATA fd;
00604         HANDLE hFind;
00605
00606         if(strlen(filename)==3 && !stricmp(filename+1,":\\"))
00607         {
00608             // Can't do anything about the root directory...
00609             // Win2k and Win98 can return info, but Win95 can't, so
00610             // it's best to do nothing.
00611             memset(&bhfi,0,sizeof(bhfi));
00612             bhfi.dwFileAttributes=GetFileAttributes(filename);
00613             if(bhfi.dwFileAttributes==0xFFFFFFFF)
00614             {
00615                 _dosmaperr(GetLastError());
00616                 return -1;
00617             }
00618             bhfi.nNumberOfLinks=1;
00619         }
00620         else
00621         {
00622             hFind=FindFirstFile(filename,&fd);
00623             if(hFind==INVALID_HANDLE_VALUE)
00624             {
00625                 _dosmaperr(GetLastError());
00626                 return -1;
00627             }
00628             FindClose(hFind);
00629             memset(&bhfi,0,sizeof(bhfi));
00630             bhfi.dwFileAttributes=fd.dwFileAttributes;
00631             bhfi.ftCreationTime=fd.ftCreationTime;
00632             bhfi.ftLastAccessTime=fd.ftLastAccessTime;
00633             bhfi.ftLastWriteTime=fd.ftLastWriteTime;
00634             bhfi.nFileSizeLow=fd.nFileSizeLow;
00635             bhfi.nFileSizeHigh=fd.nFileSizeHigh;
00636             bhfi.nNumberOfLinks=1;
00637         }
00638     }
00639
00640     if ( bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY )
00641         buf->st_mode |= (_S_IREAD + (_S_IREAD >> 3) + (_S_IREAD >> 6));
00642     else
00643         buf->st_mode |= ((_S_IREAD|_S_IWRITE) + ((_S_IREAD|_S_IWRITE) >> 3)
00644           + ((_S_IREAD|_S_IWRITE) >> 6));
00645     if (bhfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
00646         buf->st_mode |= (_S_IEXEC + (_S_IEXEC >> 3) + (_S_IEXEC >> 6));
00647
00648     // Potential, but unlikely problem... casting DWORD to short.
00649     // Reported by Jerzy Kaczorowski, addressed by Jonathan Gilligan
00650     // if the number of links is greater than 0x7FFF
00651     // there would be an overflow problem.
00652     // This is a problem inherent in the struct stat, and hence
00653     // in the design of the C library.
00654     if (bhfi.nNumberOfLinks > SHRT_MAX) {
00655 #pragma message(__FILE__ "(" PP_STRINGIZE(__LINE__) ") : TODO: should this be a fatal error?")
00656         error(0,0,"Internal error: too many links to a file.");
00657         buf->st_nlink = SHRT_MAX;
00658         }
00659     else {
00660         buf->st_nlink=(short)bhfi.nNumberOfLinks;
00661         }
00662
00663     if(!filename)
00664     {
00665         // We have to assume here that the repository doesn't span drives, so the
00666         // current directory is correct.
00667         *szFs='\0';
00668         GetVolumeInformation(NULL,NULL,0,NULL,NULL,NULL,szFs,32);
00669
00670         is_gmt_fs = GMT_FS(szFs);
00671     }
00672     else
00673     {
00674         if(filename[1]!=':')
00675         {
00676             if((filename[0]=='\\' || filename[0]=='/') && (filename[1]=='\\' || filename[1]=='/'))
00677             {
00678                 // UNC pathname, assumed to be on an NTFS server.  No way to
00679                 // check, actually (GVI doesn't return anything useful).
00680                 is_gmt_fs = 1;
00681             }
00682             else
00683             {
00684                 // Relative path, treat as local
00685                 GetVolumeInformation(NULL,NULL,0,NULL,NULL,NULL,szFs,sizeof(szFs));
00686                 is_gmt_fs = GMT_FS(szFs);
00687             }
00688         }
00689         else
00690         {
00691             // Drive specified...
00692             char szRootPath[4] = "?:\\";
00693             szRootPath[0]=filename[0];
00694             *szFs='\0';
00695             GetVolumeInformation(szRootPath,NULL,0,NULL,NULL,NULL,szFs,sizeof(szFs));
00696             is_gmt_fs = GMT_FS(szFs);
00697         }
00698     }
00699
00700     if(is_gmt_fs) // NTFS or similar - everything is in GMT already
00701     {
00702         FileTimeToUnixTime ( &bhfi.ftLastAccessTime, &buf->st_atime, FALSE );
00703         FileTimeToUnixTime ( &bhfi.ftLastWriteTime, &buf->st_mtime, FALSE );
00704         FileTimeToUnixTime ( &bhfi.ftCreationTime, &buf->st_ctime, FALSE );
00705     }
00706     else
00707     {
00708         // FAT - timestamps are in incorrectly translated local time.
00709         // translate them back and let FileTimeToUnixTime() do the
00710         // job properly.
00711
00712         FILETIME At,Wt,Ct;
00713
00714         FileTimeToLocalFileTime ( &bhfi.ftLastAccessTime, &At );
00715         FileTimeToLocalFileTime ( &bhfi.ftLastWriteTime, &Wt );
00716         FileTimeToLocalFileTime ( &bhfi.ftCreationTime, &Ct );
00717         FileTimeToUnixTime ( &At, &buf->st_atime, TRUE );
00718         FileTimeToUnixTime ( &Wt, &buf->st_mtime, TRUE );
00719         FileTimeToUnixTime ( &Ct, &buf->st_ctime, TRUE );
00720     }
00721
00722     buf->st_size = bhfi.nFileSizeLow;
00723     if(bhfi.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
00724         buf->st_mode |= _S_IFDIR;
00725     else
00726         buf->st_mode |= _S_IFREG;
00727
00728     /* On DOS, this field contains the drive number, but
00729      * the drive number is not available on this platform.
00730      * Also, for UNC network names, there is no drive number.
00731      */
00732     buf->st_rdev = buf->st_dev = 0;
00733     return 0;
00734 }

char* getpass ( const char * prompt )

Definition at line 176 of file win32.c.

00177 {
00178 #ifndef CVSGUI_SHL
00179     static char pwd_buf[128];
00180     size_t i;
00181
00182     fputs (prompt, stderr);
00183     fflush (stderr);
00184     for (i = 0; i < sizeof (pwd_buf) - 1; ++i)
00185     {
00186     pwd_buf[i] = _getch ();
00187     if (pwd_buf[i] == '\r')
00188         break;
00189     }
00190     pwd_buf[i] = '\0';
00191     fputs ("\n", stderr);
00192     return pwd_buf;
00193 #else /* CVSGUI_SHL */
00194     /* let WinCvs get the password */
00195     return getenv("CVS_GETPASS");
00196 #endif /* CVSGUI_SHL */
00197 }

pid_t getpid ( void )

Definition at line 166 of file win32.c.

00167 {
00168     return (pid_t) GetCurrentProcessId();
00169 }

void init_winsock | ( | int * | argc,
 |  | char *** | argv
 | ) |

Definition at line 98 of file win32.c.

00099 {
00100     WSADATA data;
00101
00102     if (WSAStartup (MAKEWORD (1, 1), &data))
00103     {
00104     fprintf (stderr, "cvs: unable to initialize winsock\n");
00105     exit (1);
00106     }
00107 }

unsigned sleep ( unsigned seconds )

Definition at line 128 of file win32.c.

00129 {
00130     Sleep(1000*seconds);
00131     return 0;
00132 }

char* win32getlogin ( )

Definition at line 153 of file win32.c.

00154 {
00155     static char name[256];
00156     DWORD dw = 256;
00157     GetUserName (name, &dw);
00158     if (name[0] == '\0')
00159     return NULL;
00160     else
00161     return name;
00162 }

char* wnt_asctime ( const struct tm * tm )

Definition at line 755 of file win32.c.

00756 {
00757     char *buf = asctime(tm);
00758     if(buf[8]=='0') buf[8]=' ';
00759     return buf;
00760 }

void wnt_cleanup ( void )

Definition at line 110 of file win32.c.

00111 {
00112     if (WSACleanup ())
00113     {
00114 #ifdef SERVER_ACTIVE
00115     if (server_active || error_use_protocol)
00116         /* FIXME: how are we supposed to report errors?  As of now
00117            (Sep 98), error() can in turn call us (if it is out of
00118            memory) and in general is built on top of lots of
00119            stuff.  */
00120         ;
00121     else
00122 #endif
00123         fprintf (stderr, "cvs: cannot WSACleanup: %s\n",
00124              sock_strerror (WSAGetLastError ()));
00125     }
00126 }

char* wnt_ctime ( const time_t * t )

Definition at line 762 of file win32.c.

00763 {
00764     char *buf = ctime(t);
00765     if(buf[8]=='0') buf[8]=' ';
00766     return buf;
00767 }

int wnt_fstat | ( | int | fildes,
 |  | struct stat * | buf
 | ) |

Definition at line 741 of file win32.c.

00742 {
00743     return _statcore((HANDLE)_get_osfhandle(fildes),NULL,buf);
00744 }

int wnt_lstat | ( | const char * | name,
 |  | struct stat * | buf
 | ) |

Definition at line 746 of file win32.c.

00747 {
00748     return _statcore(NULL,name,buf);
00749 }

int wnt_stat | ( | const char * | name,
 |  | struct stat * | buf
 | ) |

Definition at line 736 of file win32.c.

00737 {
00738     return _statcore(NULL,name,buf);
00739 }

Variable Documentation

int dos

Definition at line 28 of file win32.c.

DWORD err

Definition at line 28 of file win32.c.

struct { ... } errors[] [static]

const WORD month_len[12] [static]

Initial value:

{
    31,
    28,
    31,
    30,
    31,
    30,
    31,
    31,
    30,
    31,
    30,
    31
}

Definition at line 77 of file win32.c.

const ULONGLONG systemtime_second = 10000000L [static]

Definition at line 94 of file win32.c.

Generated on Sun Oct 21 12:43:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pubscc.h File Reference

cvs-1.10/windows-NT/SCC/pubscc.h File Reference

#include <stdlib.h>
#include <windows.h>

Include dependency graph for pubscc.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | SCC_return_success 0
#define | SCC_return_unknown_project -2
#define | SCC_return_non_scc_file -11
#define | SCC_return_not_supported -14
#define | SCC_return_non_specific_error -15
#define | SCC_outproc_info 1L
#define | SCC_outproc_warning 2L
#define | SCC_outproc_error 3L
#define | SCC_outproc_status 4L
#define | SCC_outproc_nostatus 5L
#define | SCC_outproc_cancel_on 6L
#define | SCC_outproc_cancel_off 7L
#define | SCC_outproc_return_success 0L
#define | SCC_outproc_return_cancelled -1L
#define | SCC_max_name 31
#define | SCC_max_init_path 31
#define | SCC_max_path _MAX_PATH
#define | SCC_status_error -1L
#define | SCC_status_out_me 0x1000L
#define | SCC_status_out_here 2L
#define | SCC_status_out_someoneelse 4L
#define | SCC_status_reserved 8L
#define | SCC_status_nonreserved 0x10L
#define | SCC_status_needs_update 0x20L
#define | SCC_status_not_pertinent 0x40L
#define | SCC_status_no_checkins 0x80L
#define | SCC_status_had_conflicts 0x100L
#define | SCC_status_munged 0x800L
#define | SCC_status_several_projects 0x200L
#define | SCC_status_stuck 0x400L
#define | SCC_cap_QueryInfo 0x80L
#define | SCC_cap_GetProjPath 0x200L
#define | SCC_cap_AddFromScc 0x400L
#define | SCC_cap_want_outproc 0x8000L
#define | SCC_cmdopt_recurse 2L
#define | SCC_cmdopt_dir 1L
#define | SCC_cmdopt_no_unedit 0x1000L
#define | SCC_cmdopt_text 1L
#define | SCC_cmdopt_binary 2L
#define | SCC_cmdopt_auto 0L
#define | SCC_cmdopt_only_one 4L
#define | SCC_cmdopt_retain_local 1L
#define | SCC_cmdopt_case_insensitive 2L
#define | SCC_cmdopt_ignore_all_space 4L
#define | SCC_cmdopt_compare_files 0x10L
#define | SCC_cmdopt_consult_checksum 0x20L
#define | SCC_cmdopt_consult_timestamp 0x40L
#define | SCC_open_autocreate 1L
#define | SCC_open_may_prompt 2L
#define | SCC_option_background 1L
#define | SCC_option_background_yes 1L
#define | SCC_option_background_no 0L
#define | SCC_option_cancel 3L
#define | SCC_option_cancel_on 1L
#define | SCC_option_cancel_off 0L

Typedefs

typedef long | SCC_return
typedef long(* | SCC_outproc )(char *, long)
typedef BOOL(* | SCC_popul_proc )(LPVOID callerdat, BOOL add_keep, LONG status, LPCSTR file)

Enumerations

enum SCC_command {
SCC_command_get, SCC_command_checkout, SCC_command_checkin, SCC_command_uncheckout,
SCC_command_add, SCC_command_remove, SCC_command_diff, SCC_command_history,
SCC_command_rename, SCC_command_properties, SCC_command_options
}

Functions

LONG | SccGetVersion (void)
SCC_return | SccInitialize (void **contextp, HWND window, LPSTR caller, LPSTR name, LPLONG caps, LPSTR path, LPDWORD co_comment_len, LPDWORD comment_len)
SCC_return | SccUninitialize (void *context_arg)
SCC_return | SccOpenProject (void *context_arg, HWND window, LPSTR user, LPSTR project, LPSTR local_proj, LPSTR aux_proj, LPSTR comment, SCC_outproc outproc, LONG flags)
SCC_return | SccCloseProject (void *context_arg)
SCC_return | SccGet (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LONG options, void *prov_options)
SCC_return | SccCheckout (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LPSTR comment, LONG options, void *prov_options)
SCC_return | SccCheckin (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LPSTR comment, LONG options, void *prov_options)
SCC_return | SccUncheckout (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LONG options, void *prov_options)
SCC_return | SccAdd (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LPSTR comment, LONG *options, void *prov_options)
SCC_return | SccRemove (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LPSTR comment, LONG options, void *prov_options)
SCC_return | SccRename (void *context_arg, HWND window, LPSTR old_name, LPSTR new_name)
SCC_return | SccDiff (void *context_arg, HWND window, LPSTR file_name, LONG options, void *prov_options)
SCC_return | SccHistory (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LONG options, void *prov_options)
SCC_return | SccProperties (void *context_arg, HWND window, LPSTR file_name)
SCC_return | SccRunScc (void *context_arg, HWND window, LONG num_files, LPSTR *file_names)
SCC_return | SccGetCommandOptions (void *context_arg, HWND window, enum SCC_command command, void **prov_optionsp)
SCC_return | SccPopulateList (void *context_arg, enum SCC_command command, LONG num_files, LPSTR *file_names, SCC_popul_proc populate, void *callerdat, LONG options)
SCC_return | SccQueryInfo (void *context_arg, LONG num_files, LPSTR *file_names, LPLONG status)
SCC_return | SccGetEvents (void *context_arg, LPSTR file_name, LPLONG status, LPLONG events_remaining)
SCC_return | SccGetProjPath (void *context_arg, HWND window, LPSTR user, LPSTR proj_name, LPSTR local_proj, LPSTR aux_proj, BOOL allow_change, BOOL *new)
SCC_return | SccAddFromScc (void *context_arg, HWND window, LONG *files, char ***file_names)
SCC_return | SccSetOption (void *context_arg, LONG option, LONG val)

Define Documentation

#define SCC_cap_AddFromScc 0x400L

Definition at line 146 of file pubscc.h.

#define SCC_cap_GetProjPath 0x200L

Definition at line 145 of file pubscc.h.

#define SCC_cap_QueryInfo 0x80L

Definition at line 144 of file pubscc.h.

#define SCC_cap_want_outproc 0x8000L

Definition at line 147 of file pubscc.h.

#define SCC_cmdopt_auto 0L

Definition at line 169 of file pubscc.h.

#define SCC_cmdopt_binary 2L

Definition at line 164 of file pubscc.h.

#define SCC_cmdopt_case_insensitive 2L

Definition at line 177 of file pubscc.h.

#define SCC_cmdopt_compare_files 0x10L

Definition at line 182 of file pubscc.h.

#define SCC_cmdopt_consult_checksum 0x20L

Definition at line 186 of file pubscc.h.

#define SCC_cmdopt_consult_timestamp 0x40L

Definition at line 190 of file pubscc.h.

#define SCC_cmdopt_dir 1L

Definition at line 156 of file pubscc.h.

#define SCC_cmdopt_ignore_all_space 4L

Definition at line 179 of file pubscc.h.

#define SCC_cmdopt_no_unedit 0x1000L

Definition at line 160 of file pubscc.h.

#define SCC_cmdopt_only_one 4L

Definition at line 171 of file pubscc.h.

#define SCC_cmdopt_recurse 2L

Definition at line 154 of file pubscc.h.

#define SCC_cmdopt_retain_local 1L

Definition at line 175 of file pubscc.h.

#define SCC_cmdopt_text 1L

Definition at line 162 of file pubscc.h.

#define SCC_max_init_path 31

Definition at line 73 of file pubscc.h.

#define SCC_max_name 31

Definition at line 71 of file pubscc.h.

#define SCC_max_path _MAX_PATH

Definition at line 76 of file pubscc.h.

#define SCC_open_autocreate 1L

Definition at line 195 of file pubscc.h.

#define SCC_open_may_prompt 2L

Definition at line 201 of file pubscc.h.

#define SCC_option_background 1L

Definition at line 204 of file pubscc.h.

#define SCC_option_background_no 0L

Definition at line 210 of file pubscc.h.

#define SCC_option_background_yes 1L

Definition at line 209 of file pubscc.h.

#define SCC_option_cancel 3L

Definition at line 211 of file pubscc.h.

#define SCC_option_cancel_off 0L

Definition at line 217 of file pubscc.h.

#define SCC_option_cancel_on 1L

Definition at line 216 of file pubscc.h.

#define SCC_outproc_cancel_off 7L

Definition at line 58 of file pubscc.h.

#define SCC_outproc_cancel_on 6L

Definition at line 56 of file pubscc.h.

#define SCC_outproc_error 3L

Definition at line 45 of file pubscc.h.

#define SCC_outproc_info 1L

Definition at line 43 of file pubscc.h.

#define SCC_outproc_nostatus 5L

Definition at line 54 of file pubscc.h.

#define SCC_outproc_return_cancelled -1L

Definition at line 62 of file pubscc.h.

#define SCC_outproc_return_success 0L

Definition at line 61 of file pubscc.h.

#define SCC_outproc_status 4L

Definition at line 52 of file pubscc.h.

#define SCC_outproc_warning 2L

Definition at line 44 of file pubscc.h.

#define SCC_return_non_scc_file -11

Definition at line 19 of file pubscc.h.

#define SCC_return_non_specific_error -15

Definition at line 25 of file pubscc.h.

#define SCC_return_not_supported -14

Definition at line 24 of file pubscc.h.

#define SCC_return_success 0

Definition at line 16 of file pubscc.h.

#define SCC_return_unknown_project -2

Definition at line 17 of file pubscc.h.

#define SCC_status_error -1L

Definition at line 82 of file pubscc.h.

#define SCC_status_had_conflicts 0x100L

Definition at line 120 of file pubscc.h.

#define SCC_status_munged 0x800L

Definition at line 129 of file pubscc.h.

#define SCC_status_needs_update 0x20L

Definition at line 109 of file pubscc.h.

#define SCC_status_no_checkins 0x80L

Definition at line 116 of file pubscc.h.

#define SCC_status_nonreserved 0x10L

Definition at line 102 of file pubscc.h.

#define SCC_status_not_pertinent 0x40L

Definition at line 113 of file pubscc.h.

#define SCC_status_out_here 2L

Definition at line 93 of file pubscc.h.

#define SCC_status_out_me 0x1000L

Definition at line 90 of file pubscc.h.

#define SCC_status_out_someoneelse 4L

Definition at line 95 of file pubscc.h.

#define SCC_status_reserved 8L

Definition at line 97 of file pubscc.h.

#define SCC_status_several_projects 0x200L

Definition at line 135 of file pubscc.h.

#define SCC_status_stuck 0x400L

Definition at line 137 of file pubscc.h.

Typedef Documentation

typedef long(* SCC_outproc)(char *, long)

Definition at line 63 of file pubscc.h.

typedef BOOL(* SCC_popul_proc)(LPVOID callerdat, BOOL add_keep, LONG status, LPCSTR file)

Definition at line 65 of file pubscc.h.

typedef long SCC_return

Definition at line 15 of file pubscc.h.

Enumeration Type Documentation

enum SCC_command

Enumeration values:
SCC_command_get
SCC_command_checkout
SCC_command_checkin
SCC_command_uncheckout
SCC_command_add
SCC_command_remove
SCC_command_diff
SCC_command_history
SCC_command_rename
SCC_command_properties
SCC_command_options

Definition at line 27 of file pubscc.h.

00028 {
00029     SCC_command_get,
00030     SCC_command_checkout,
00031     SCC_command_checkin,
00032     SCC_command_uncheckout,
00033     SCC_command_add,
00034     SCC_command_remove,
00035     SCC_command_diff,
00036     SCC_command_history,
00037     SCC_command_rename,
00038     SCC_command_properties,
00039     SCC_command_options
00040 };

Function Documentation

SCC_return SccAdd | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LPSTR | comment,
 |  | LONG * | options,
 |  | void * | prov_options
 | ) |

Definition at line 247 of file scc.c.

00251 {
00252     return SCC_return_not_supported;
00253 }

SCC_return SccAddFromScc | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG * | files,
 |  | char *** | file_names
 | ) |

Definition at line 417 of file scc.c.

00419 {
00420     struct context *context = (struct context *)context_arg;
00421
00422     /* For now we have hardcoded the notion that there are two files,
00423        foo.c and bar.c.  */
00424 #define NUM_FILES 2
00425     if (files == NULL)
00426     {
00427     char **p;
00428
00429     /* This means to free the memory that is allocated for
00430        file_names.  */
00431     for (p = *file_names; *p != NULL; ++p)
00432     {
00433         fprintf (context->debuglog, "Freeing %s\n", *p);
00434         free (*p);
00435     }
00436     }
00437     else
00438     {
00439     *file_names = malloc ((NUM_FILES + 1) * sizeof (char **));
00440     if (*file_names == NULL)
00441         return malloc_error (context);
00442     (*file_names)[0] = malloc (80);
00443     if ((*file_names)[0] == NULL)
00444         return malloc_error (context);
00445     strcpy ((*file_names)[0], "foo.c");
00446     (*file_names)[1] = malloc (80);
00447     if ((*file_names)[1] == NULL)
00448         return malloc_error (context);
00449     strcpy ((*file_names)[1], "bar.c");
00450     (*file_names)[2] = NULL;
00451     *files = 2;
00452
00453     /* Are we supposed to also Get the files?  Or is the IDE
00454        next going to call SccGet on each one?  The spec doesn't
00455        say explicitly.  */
00456     }
00457     fprintf (context->debuglog, "Success in SccAddFromScc\n");
00458     fflush (context->debuglog);
00459     return SCC_return_success;
00460 }

SCC_return SccCheckin | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LPSTR | comment,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 226 of file scc.c.

00230 {
00231     return SCC_return_not_supported;
00232 }

SCC_return SccCheckout | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LPSTR | comment,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 207 of file scc.c.

00211 {
00212     struct context *context = (struct context *)context_arg;
00213     fprintf (context->debuglog, "SccCheckout num_files=%ld\n", num_files);
00214     fflush (context->debuglog);
00215     /* For the moment we say that all files are not ours.  I'm not sure
00216        whether this is ever necessary; that is, whether the IDE will call
00217        us except where we have told the IDE that a file is under source
00218        control.  */
00219     /* I'm not sure what we would do if num_files > 1 and we wanted to
00220        return different statuses for different files.  */
00221     return SCC_return_non_scc_file;
00222 }

SCC_return SccCloseProject ( void * context_arg )

Definition at line 154 of file scc.c.

00155 {
00156     struct context *context = (struct context *)context_arg;
00157     fprintf (context->debuglog, "SccCloseProject\n");
00158     fflush (context->debuglog);
00159     if (context->root != NULL)
00160     free (context->root);
00161     context->root = NULL;
00162     return SCC_return_success;
00163 }

SCC_return SccDiff | ( | void * | context_arg,
 |  | HWND | window,
 |  | LPSTR | file_name,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 285 of file scc.c.

00288 {
00289     return SCC_return_not_supported;
00290 }

SCC_return SccGet | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 167 of file scc.c.

00171 {
00172     struct context *context = (struct context *)context_arg;
00173     int i;
00174     char *fname;
00175
00176     fprintf (context->debuglog, "SccGet: %d; files:", num_files);
00177 #if 1
00178     for (i = 0; i < num_files; ++i)
00179     {
00180     fprintf (context->debuglog, "%s ", file_names[i]);
00181     }
00182 #endif
00183     fprintf (context->debuglog, "\n");
00184     if (options & SCC_cmdopt_dir)
00185     fprintf (context->debuglog, "  Get all\n");
00186     /* Should be using this flag to set -R vs. -l.  */
00187     if (options & SCC_cmdopt_recurse)
00188     fprintf (context->debuglog, "  recurse\n");
00189
00190     for (i = 0; i < num_files; ++i)
00191     {
00192     /* As with all file names passed to us by the SCC, these
00193        file names are absolute pathnames.  I think they will
00194        tend to be paths within context->local, although I
00195        don't know whether there are any exceptions to that.  */
00196     fname = file_names[i];
00197     fprintf (context->debuglog, "%s ", fname);
00198     /* Here we would write to the file named fname.  */
00199     }
00200     fprintf (context->debuglog, "\nExiting SccGet\n");
00201     fflush (context->debuglog);
00202     return SCC_return_success;
00203 }

SCC_return SccGetCommandOptions | ( | void * | context_arg,
 |  | HWND | window,
 |  | enum SCC_command | command,
 |  | void ** | prov_optionsp
 | ) |

Definition at line 328 of file scc.c.

00331 {
00332     return SCC_return_not_supported;
00333 }

SCC_return SccGetEvents | ( | void * | context_arg,
 |  | LPSTR | file_name,
 |  | LPLONG | status,
 |  | LPLONG | events_remaining
 | ) |

Definition at line 360 of file scc.c.

00363 {
00364     /* They say this is supposed to only return cached status
00365        information, not go to disk or anything.  I assume that
00366        QueryInfo and probably the usual calls like Get would cause
00367        us to cache the status in the first place.  */
00368     return SCC_return_success;
00369 }

SCC_return SccGetProjPath | ( | void * | context_arg,
 |  | HWND | window,
 |  | LPSTR | user,
 |  | LPSTR | proj_name,
 |  | LPSTR | local_proj,
 |  | LPSTR | aux_proj,
 |  | BOOL | allow_change,
 |  | BOOL * | new
 | ) |

Definition at line 373 of file scc.c.

00376 {
00377     /* For now we just hardcode the CVSROOT.  In the future we will
00378        of course prompt the user for it (simple implementation would
00379        have them supply a string; potentially better implementation
00380        would have menus or something for access methods and so on,
00381        although it might also have a way of bypassing that in case
00382        CVS supports new features that the GUI code doesn't
00383        understand).  We probably will also at some point want a
00384        "project" to encompass both a CVSROOT and a directory or
00385        module name within that CVSROOT, but we don't try to handle
00386        that yet either.  We also will want to be able to use "user"
00387        instead of having the username encoded in the aux_proj or
00388        proj_name, probably.  */
00389
00390     struct context *context = (struct context *)context_arg;
00391     fprintf (context->debuglog, "SccGetProjPath called\n");
00392
00393     /* At least for now we leave the proj_name alone, and just use
00394        the aux_proj.  */
00395     strncpy (proj_name, "zwork", SCC_max_path);
00396     strncpy (aux_proj, ":server:harvey:/home/kingdon/zwork/cvsroot",
00397          SCC_max_path);
00398     if (local_proj[0] == '\0' && allow_change)
00399     strncpy (local_proj, "d:\\sccwork", SCC_max_path);
00400     /* I don't think I saw anything in the spec about this,
00401        but let's see if it helps.  */
00402     if (_chdir (local_proj) < 0)
00403     fprintf (context->debuglog, "Error in chdir: %s", strerror (errno));
00404
00405     if (*new)
00406     /* It is OK for us to prompt the user for creating a new
00407        project.  */
00408     /* We will say that the user said to create a new one.  */
00409     *new = 1;
00410
00411     fflush (context->debuglog);
00412     return SCC_return_success;
00413 }

LONG SccGetVersion ( void )

Definition at line 46 of file scc.c.

00047 {
00048     /* We implement version 1.1 of the spec.  */
00049     return 0x10001;
00050 }

SCC_return SccHistory | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 296 of file scc.c.

00300 {
00301     return SCC_return_not_supported;
00302 }

SCC_return SccInitialize | ( | void ** | contextp,
 |  | HWND | window,
 |  | LPSTR | caller,
 |  | LPSTR | name,
 |  | LPLONG | caps,
 |  | LPSTR | path,
 |  | LPDWORD | co_comment_len,
 |  | LPDWORD | comment_len
 | ) |

Definition at line 53 of file scc.c.

00056 {
00057     struct context *context;
00058     FILE *fp;
00059     fp = fopen ("d:\\debug.scc", "w");
00060     if (fp == NULL)
00061         /* Do what?  Return some error value?  */
00062         abort ();
00063     context = malloc (sizeof (struct context));
00064     if (context == NULL)
00065     {
00066         fprintf (fp, "Out of memory\n");
00067         fclose (fp);
00068         /* Do what?  Return some error?  */
00069         abort ();
00070     }
00071     context->debuglog = fp;
00072     context->root = NULL;
00073     *contextp = context;
00074     fprintf (fp, "Made it into SccInitialize!\n");
00075     *caps = (SCC_cap_GetProjPath
00076          | SCC_cap_AddFromScc
00077          | SCC_cap_want_outproc);
00078
00079     /* I think maybe this should have some more CVS-like
00080        name, like "CVS Root", if we decide that is what
00081        a SCC "project" is.  */
00082     strncpy (path, "CVS Project:", SCC_max_init_path);
00083     fprintf (fp, "Caller name is %s\n", caller);
00084     strncpy (name, "CVS", SCC_max_name);
00085     /* CVS has no limit on comment length.  But I suppose
00086        we need to return a value which is small enough for
00087        a caller to allocate a buffer this big.  Not that I
00088        would write a caller that way, but.....  */
00089     *co_comment_len = 8192;
00090     *comment_len = 8192;
00091     fflush (fp);
00092     return SCC_return_success;
00093 }

SCC_return SccOpenProject | ( | void * | context_arg,
 |  | HWND | window,
 |  | LPSTR | user,
 |  | LPSTR | project,
 |  | LPSTR | local_proj,
 |  | LPSTR | aux_proj,
 |  | LPSTR | comment,
 |  | SCC_outproc | outproc,
 |  | LONG | flags
 | ) |

Definition at line 109 of file scc.c.

00113 {
00114     struct context *context = (struct context *)context_arg;
00115
00116     /* This can happen if the IDE opens a project which is not under
00117        CVS control.  I'm not sure whether checking for aux_proj
00118        being "" is the right way to detect this case, but it seems
00119        it should work because I think that the source code control
00120        system is what has control over the contents of aux_proj.  */
00121     if (aux_proj[0] == '\0')
00122     return SCC_return_unknown_project;
00123
00124     context->root = malloc (strlen (aux_proj) + 5);
00125     if (context->root == NULL)
00126     return SCC_return_non_specific_error;
00127     strcpy (context->root, aux_proj);
00128     /* Since we don't yet support creating projects, we don't
00129        do anything with flags.  */
00130
00131     if (outproc == 0)
00132     {
00133     /* This supposedly can happen if the IDE chooses not to implement
00134        the outproc feature.  */
00135     fprintf (context->debuglog, "Uh oh.  outproc is a null pointer\n");
00136     context->root = NULL;
00137     fflush (context->debuglog);
00138     return SCC_return_non_specific_error;
00139     }
00140     context->outproc = outproc;
00141
00142     fprintf (context->debuglog, "SccOpenProject (aux_proj=%s)\n", aux_proj);
00143
00144     context->local = malloc (strlen (local_proj) + 5);
00145     if (context->local == NULL)
00146     return malloc_error (context);
00147     strcpy (context->local, local_proj);
00148
00149     fflush (context->debuglog);
00150     return SCC_return_success;
00151 }

SCC_return SccPopulateList | ( | void * | context_arg,
 |  | enum SCC_command | command,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | SCC_popul_proc | populate,
 |  | void * | callerdat,
 |  | LONG | options
 | ) |

Definition at line 339 of file scc.c.

00344 {
00345     return SCC_return_success;
00346 }

SCC_return SccProperties | ( | void * | context_arg,
 |  | HWND | window,
 |  | LPSTR | file_name
 | ) |

Definition at line 306 of file scc.c.

00307 {
00308     return SCC_return_not_supported;
00309 }

SCC_return SccQueryInfo | ( | void * | context_arg,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LPLONG | status
 | ) |

Definition at line 350 of file scc.c.

00352 {
00353     return SCC_return_not_supported;
00354 }

SCC_return SccRemove | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LPSTR | comment,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 259 of file scc.c.

00263 {
00264     return SCC_return_not_supported;
00265 }

SCC_return SccRename | ( | void * | context_arg,
 |  | HWND | window,
 |  | LPSTR | old_name,
 |  | LPSTR | new_name
 | ) |

Definition at line 269 of file scc.c.

00271 {
00272     return SCC_return_not_supported;
00273 }

SCC_return SccRunScc | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names
 | ) |

Definition at line 315 of file scc.c.

00317 {
00318     return SCC_return_not_supported;
00319 }

SCC_return SccSetOption | ( | void * | context_arg,
 |  | LONG | option,
 |  | LONG | val
 | ) |

Definition at line 464 of file scc.c.

00467 {
00468     return SCC_return_success;
00469 }

SCC_return SccUncheckout | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 236 of file scc.c.

00240 {
00241     return SCC_return_not_supported;
00242 }

SCC_return SccUninitialize ( void * context_arg )

Definition at line 96 of file scc.c.

00097 {
00098     struct context *context = (struct context *)context_arg;
00099     if (ferror (context->debuglog))
00100     /* FIXME: return error value...  */
00101     if (fclose (context->debuglog) == EOF)
00102         /* FIXME: return error value, I think.  */
00103         ;
00104     free (context);
00105     return SCC_return_success;
00106 }

Generated on Sun Oct 21 12:43:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


scc.c File Reference

cvs-1.10/windows-NT/SCC/scc.c File Reference

#include <Wtypes.h>
#include <stdio.h>
#include <direct.h>
#include "pubscc.h"
#include <windows.h>

Include dependency graph for scc.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | context

Defines

#define | NUM_FILES 2

Functions

SCC_return | malloc_error (struct context *context)
LONG | SccGetVersion (void)
SCC_return | SccInitialize (void **contextp, HWND window, LPSTR caller, LPSTR name, LPLONG caps, LPSTR path, LPDWORD co_comment_len, LPDWORD comment_len)
SCC_return | SccUninitialize (void *context_arg)
SCC_return | SccOpenProject (void *context_arg, HWND window, LPSTR user, LPSTR project, LPSTR local_proj, LPSTR aux_proj, LPSTR comment, SCC_outproc outproc, LONG flags)
SCC_return | SccCloseProject (void *context_arg)
SCC_return | SccGet (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LONG options, void *prov_options)
SCC_return | SccCheckout (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LPSTR comment, LONG options, void *prov_options)
SCC_return | SccCheckin (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LPSTR comment, LONG options, void *prov_options)
SCC_return | SccUncheckout (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LONG options, void *prov_options)
SCC_return | SccAdd (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LPSTR comment, LONG *options, void *prov_options)
SCC_return | SccRemove (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LPSTR comment, LONG options, void *prov_options)
SCC_return | SccRename (void *context_arg, HWND window, LPSTR old_name, LPSTR new_name)
SCC_return | SccDiff (void *context_arg, HWND window, LPSTR file_name, LONG options, void *prov_options)
SCC_return | SccHistory (void *context_arg, HWND window, LONG num_files, LPSTR *file_names, LONG options, void *prov_options)
SCC_return | SccProperties (void *context_arg, HWND window, LPSTR file_name)
SCC_return | SccRunScc (void *context_arg, HWND window, LONG num_files, LPSTR *file_names)
SCC_return | SccGetCommandOptions (void *context_arg, HWND window, enum SCC_command command, void **prov_optionsp)
SCC_return | SccPopulateList (void *context_arg, enum SCC_command command, LONG num_files, LPSTR *file_names, SCC_popul_proc populate, void *callerdat, LONG options)
SCC_return | SccQueryInfo (void *context_arg, LONG num_files, LPSTR *file_names, LPLONG status)
SCC_return | SccGetEvents (void *context_arg, LPSTR file_name, LPLONG status, LPLONG events_remaining)
SCC_return | SccGetProjPath (void *context_arg, HWND window, LPSTR user, LPSTR proj_name, LPSTR local_proj, LPSTR aux_proj, BOOL allow_change, BOOL *new)
SCC_return | SccAddFromScc (void *context_arg, HWND window, LONG *files, char ***file_names)
SCC_return | SccSetOption (void *context_arg, LONG option, LONG val)

Define Documentation

#define NUM_FILES 2

Function Documentation

SCC_return SccAdd | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LPSTR | comment,
 |  | LONG * | options,
 |  | void * | prov_options
 | ) |

Definition at line 247 of file scc.c.

00251 {
00252     return SCC_return_not_supported;
00253 }

SCC_return SccAddFromScc | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG * | files,
 |  | char *** | file_names
 | ) |

Definition at line 417 of file scc.c.

00419 {
00420     struct context *context = (struct context *)context_arg;
00421
00422     /* For now we have hardcoded the notion that there are two files,
00423        foo.c and bar.c.  */
00424 #define NUM_FILES 2
00425     if (files == NULL)
00426     {
00427     char **p;
00428
00429     /* This means to free the memory that is allocated for
00430        file_names.  */
00431     for (p = *file_names; *p != NULL; ++p)
00432     {
00433         fprintf (context->debuglog, "Freeing %s\n", *p);
00434         free (*p);
00435     }
00436     }
00437     else
00438     {
00439     *file_names = malloc ((NUM_FILES + 1) * sizeof (char **));
00440     if (*file_names == NULL)
00441         return malloc_error (context);
00442     (*file_names)[0] = malloc (80);
00443     if ((*file_names)[0] == NULL)
00444         return malloc_error (context);
00445     strcpy ((*file_names)[0], "foo.c");
00446     (*file_names)[1] = malloc (80);
00447     if ((*file_names)[1] == NULL)
00448         return malloc_error (context);
00449     strcpy ((*file_names)[1], "bar.c");
00450     (*file_names)[2] = NULL;
00451     *files = 2;
00452
00453     /* Are we supposed to also Get the files?  Or is the IDE
00454        next going to call SccGet on each one?  The spec doesn't
00455        say explicitly.  */
00456     }
00457     fprintf (context->debuglog, "Success in SccAddFromScc\n");
00458     fflush (context->debuglog);
00459     return SCC_return_success;
00460 }

SCC_return SccCheckin | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LPSTR | comment,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 226 of file scc.c.

00230 {
00231     return SCC_return_not_supported;
00232 }

SCC_return SccCheckout | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LPSTR | comment,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 207 of file scc.c.

00211 {
00212     struct context *context = (struct context *)context_arg;
00213     fprintf (context->debuglog, "SccCheckout num_files=%ld\n", num_files);
00214     fflush (context->debuglog);
00215     /* For the moment we say that all files are not ours.  I'm not sure
00216        whether this is ever necessary; that is, whether the IDE will call
00217        us except where we have told the IDE that a file is under source
00218        control.  */
00219     /* I'm not sure what we would do if num_files > 1 and we wanted to
00220        return different statuses for different files.  */
00221     return SCC_return_non_scc_file;
00222 }

SCC_return SccCloseProject ( void * context_arg )

Definition at line 154 of file scc.c.

00155 {
00156     struct context *context = (struct context *)context_arg;
00157     fprintf (context->debuglog, "SccCloseProject\n");
00158     fflush (context->debuglog);
00159     if (context->root != NULL)
00160     free (context->root);
00161     context->root = NULL;
00162     return SCC_return_success;
00163 }

SCC_return SccDiff | ( | void * | context_arg,
 |  | HWND | window,
 |  | LPSTR | file_name,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 285 of file scc.c.

00288 {
00289     return SCC_return_not_supported;
00290 }

SCC_return SccGet | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 167 of file scc.c.

00171 {
00172     struct context *context = (struct context *)context_arg;
00173     int i;
00174     char *fname;
00175
00176     fprintf (context->debuglog, "SccGet: %d; files:", num_files);
00177 #if 1
00178     for (i = 0; i < num_files; ++i)
00179     {
00180     fprintf (context->debuglog, "%s ", file_names[i]);
00181     }
00182 #endif
00183     fprintf (context->debuglog, "\n");
00184     if (options & SCC_cmdopt_dir)
00185     fprintf (context->debuglog, "  Get all\n");
00186     /* Should be using this flag to set -R vs. -l.  */
00187     if (options & SCC_cmdopt_recurse)
00188     fprintf (context->debuglog, "  recurse\n");
00189
00190     for (i = 0; i < num_files; ++i)
00191     {
00192     /* As with all file names passed to us by the SCC, these
00193        file names are absolute pathnames.  I think they will
00194        tend to be paths within context->local, although I
00195        don't know whether there are any exceptions to that.  */
00196     fname = file_names[i];
00197     fprintf (context->debuglog, "%s ", fname);
00198     /* Here we would write to the file named fname.  */
00199     }
00200     fprintf (context->debuglog, "\nExiting SccGet\n");
00201     fflush (context->debuglog);
00202     return SCC_return_success;
00203 }

SCC_return SccGetCommandOptions | ( | void * | context_arg,
 |  | HWND | window,
 |  | enum SCC_command | command,
 |  | void ** | prov_optionsp
 | ) |

Definition at line 328 of file scc.c.

00331 {
00332     return SCC_return_not_supported;
00333 }

SCC_return SccGetEvents | ( | void * | context_arg,
 |  | LPSTR | file_name,
 |  | LPLONG | status,
 |  | LPLONG | events_remaining
 | ) |

Definition at line 360 of file scc.c.

00363 {
00364     /* They say this is supposed to only return cached status
00365        information, not go to disk or anything.  I assume that
00366        QueryInfo and probably the usual calls like Get would cause
00367        us to cache the status in the first place.  */
00368     return SCC_return_success;
00369 }

SCC_return SccGetProjPath | ( | void * | context_arg,
 |  | HWND | window,
 |  | LPSTR | user,
 |  | LPSTR | proj_name,
 |  | LPSTR | local_proj,
 |  | LPSTR | aux_proj,
 |  | BOOL | allow_change,
 |  | BOOL * | new
 | ) |

Definition at line 373 of file scc.c.

00376 {
00377     /* For now we just hardcode the CVSROOT.  In the future we will
00378        of course prompt the user for it (simple implementation would
00379        have them supply a string; potentially better implementation
00380        would have menus or something for access methods and so on,
00381        although it might also have a way of bypassing that in case
00382        CVS supports new features that the GUI code doesn't
00383        understand).  We probably will also at some point want a
00384        "project" to encompass both a CVSROOT and a directory or
00385        module name within that CVSROOT, but we don't try to handle
00386        that yet either.  We also will want to be able to use "user"
00387        instead of having the username encoded in the aux_proj or
00388        proj_name, probably.  */
00389
00390     struct context *context = (struct context *)context_arg;
00391     fprintf (context->debuglog, "SccGetProjPath called\n");
00392
00393     /* At least for now we leave the proj_name alone, and just use
00394        the aux_proj.  */
00395     strncpy (proj_name, "zwork", SCC_max_path);
00396     strncpy (aux_proj, ":server:harvey:/home/kingdon/zwork/cvsroot",
00397          SCC_max_path);
00398     if (local_proj[0] == '\0' && allow_change)
00399     strncpy (local_proj, "d:\\sccwork", SCC_max_path);
00400     /* I don't think I saw anything in the spec about this,
00401        but let's see if it helps.  */
00402     if (_chdir (local_proj) < 0)
00403     fprintf (context->debuglog, "Error in chdir: %s", strerror (errno));
00404
00405     if (*new)
00406     /* It is OK for us to prompt the user for creating a new
00407        project.  */
00408     /* We will say that the user said to create a new one.  */
00409     *new = 1;
00410
00411     fflush (context->debuglog);
00412     return SCC_return_success;
00413 }

LONG SccGetVersion ( void )

Definition at line 46 of file scc.c.

00047 {
00048     /* We implement version 1.1 of the spec.  */
00049     return 0x10001;
00050 }

SCC_return SccHistory | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 296 of file scc.c.

00300 {
00301     return SCC_return_not_supported;
00302 }

SCC_return SccInitialize | ( | void ** | contextp,
 |  | HWND | window,
 |  | LPSTR | caller,
 |  | LPSTR | name,
 |  | LPLONG | caps,
 |  | LPSTR | path,
 |  | LPDWORD | co_comment_len,
 |  | LPDWORD | comment_len
 | ) |

Definition at line 53 of file scc.c.

00056 {
00057     struct context *context;
00058     FILE *fp;
00059     fp = fopen ("d:\\debug.scc", "w");
00060     if (fp == NULL)
00061         /* Do what?  Return some error value?  */
00062         abort ();
00063     context = malloc (sizeof (struct context));
00064     if (context == NULL)
00065     {
00066         fprintf (fp, "Out of memory\n");
00067         fclose (fp);
00068         /* Do what?  Return some error?  */
00069         abort ();
00070     }
00071     context->debuglog = fp;
00072     context->root = NULL;
00073     *contextp = context;
00074     fprintf (fp, "Made it into SccInitialize!\n");
00075     *caps = (SCC_cap_GetProjPath
00076          | SCC_cap_AddFromScc
00077          | SCC_cap_want_outproc);
00078
00079     /* I think maybe this should have some more CVS-like
00080        name, like "CVS Root", if we decide that is what
00081        a SCC "project" is.  */
00082     strncpy (path, "CVS Project:", SCC_max_init_path);
00083     fprintf (fp, "Caller name is %s\n", caller);
00084     strncpy (name, "CVS", SCC_max_name);
00085     /* CVS has no limit on comment length.  But I suppose
00086        we need to return a value which is small enough for
00087        a caller to allocate a buffer this big.  Not that I
00088        would write a caller that way, but.....  */
00089     *co_comment_len = 8192;
00090     *comment_len = 8192;
00091     fflush (fp);
00092     return SCC_return_success;
00093 }

SCC_return SccOpenProject | ( | void * | context_arg,
 |  | HWND | window,
 |  | LPSTR | user,
 |  | LPSTR | project,
 |  | LPSTR | local_proj,
 |  | LPSTR | aux_proj,
 |  | LPSTR | comment,
 |  | SCC_outproc | outproc,
 |  | LONG | flags
 | ) |

Definition at line 109 of file scc.c.

00113 {
00114     struct context *context = (struct context *)context_arg;
00115
00116     /* This can happen if the IDE opens a project which is not under
00117        CVS control.  I'm not sure whether checking for aux_proj
00118        being "" is the right way to detect this case, but it seems
00119        it should work because I think that the source code control
00120        system is what has control over the contents of aux_proj.  */
00121     if (aux_proj[0] == '\0')
00122     return SCC_return_unknown_project;
00123
00124     context->root = malloc (strlen (aux_proj) + 5);
00125     if (context->root == NULL)
00126     return SCC_return_non_specific_error;
00127     strcpy (context->root, aux_proj);
00128     /* Since we don't yet support creating projects, we don't
00129        do anything with flags.  */
00130
00131     if (outproc == 0)
00132     {
00133     /* This supposedly can happen if the IDE chooses not to implement
00134        the outproc feature.  */
00135     fprintf (context->debuglog, "Uh oh.  outproc is a null pointer\n");
00136     context->root = NULL;
00137     fflush (context->debuglog);
00138     return SCC_return_non_specific_error;
00139     }
00140     context->outproc = outproc;
00141
00142     fprintf (context->debuglog, "SccOpenProject (aux_proj=%s)\n", aux_proj);
00143
00144     context->local = malloc (strlen (local_proj) + 5);
00145     if (context->local == NULL)
00146     return malloc_error (context);
00147     strcpy (context->local, local_proj);
00148
00149     fflush (context->debuglog);
00150     return SCC_return_success;
00151 }

SCC_return SccPopulateList | ( | void * | context_arg,
 |  | enum SCC_command | command,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | SCC_popul_proc | populate,
 |  | void * | callerdat,
 |  | LONG | options
 | ) |

Definition at line 339 of file scc.c.

00344 {
00345     return SCC_return_success;
00346 }

SCC_return SccProperties | ( | void * | context_arg,
 |  | HWND | window,
 |  | LPSTR | file_name
 | ) |

Definition at line 306 of file scc.c.

00307 {
00308     return SCC_return_not_supported;
00309 }

SCC_return SccQueryInfo | ( | void * | context_arg,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LPLONG | status
 | ) |

Definition at line 350 of file scc.c.

00352 {
00353     return SCC_return_not_supported;
00354 }

SCC_return SccRemove | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LPSTR | comment,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 259 of file scc.c.

00263 {
00264     return SCC_return_not_supported;
00265 }

SCC_return SccRename | ( | void * | context_arg,
 |  | HWND | window,
 |  | LPSTR | old_name,
 |  | LPSTR | new_name
 | ) |

Definition at line 269 of file scc.c.

00271 {
00272     return SCC_return_not_supported;
00273 }

SCC_return SccRunScc | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names
 | ) |

Definition at line 315 of file scc.c.

00317 {
00318     return SCC_return_not_supported;
00319 }

SCC_return SccSetOption | ( | void * | context_arg,
 |  | LONG | option,
 |  | LONG | val
 | ) |

Definition at line 464 of file scc.c.

00467 {
00468     return SCC_return_success;
00469 }

SCC_return SccUncheckout | ( | void * | context_arg,
 |  | HWND | window,
 |  | LONG | num_files,
 |  | LPSTR * | file_names,
 |  | LONG | options,
 |  | void * | prov_options
 | ) |

Definition at line 236 of file scc.c.

00240 {
00241     return SCC_return_not_supported;
00242 }

SCC_return SccUninitialize ( void * context_arg )

Definition at line 96 of file scc.c.

00097 {
00098     struct context *context = (struct context *)context_arg;
00099     if (ferror (context->debuglog))
00100     /* FIXME: return error value...  */
00101     if (fclose (context->debuglog) == EOF)
00102         /* FIXME: return error value, I think.  */
00103         ;
00104     free (context);
00105     return SCC_return_success;
00106 }

SCC_return malloc_error ( struct context * context )

Definition at line 37 of file scc.c.

Referenced by SccAddFromScc(), and SccOpenProject().

00038 {
00039     (*context->outproc) ("Out of memory\n", SCC_outproc_error);
00040     return SCC_return_non_specific_error;
00041 }

Generated on Sun Oct 21 12:43:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


adler32.c File Reference

cvs-1.10/zlib/adler32.c File Reference

#include "zlib.h"

Include dependency graph for adler32.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | BASE 65521L
#define | NMAX 5552
#define | DO1(buf, i) {s1 += buf[i]; s2 += s1;}
#define | DO2(buf, i) DO1(buf,i); DO1(buf,i+1);
#define | DO4(buf, i) DO2(buf,i); DO2(buf,i+2);
#define | DO8(buf, i) DO4(buf,i); DO4(buf,i+4);
#define | DO16(buf) DO8(buf,0); DO8(buf,8);

Functions

uLong | adler32 (adler, buf, len) uLong adler

Variables

const Bytef * | buf
uInt len

Define Documentation

#define BASE 65521L

Definition at line 10 of file adler32.c.

#define DO1 | ( | buf,
 |  | i | ) | {s1 += buf[i]; s2 += s1;}

Definition at line 14 of file adler32.c.

#define DO16 ( buf ) DO8(buf,0); DO8(buf,8);

Definition at line 18 of file adler32.c.

Referenced by len().

#define DO2 | ( | buf,
 |  | i | ) | DO1(buf,i); DO1(buf,i+1);

Definition at line 15 of file adler32.c.

#define DO4 | ( | buf,
 |  | i | ) | DO2(buf,i); DO2(buf,i+2);

Definition at line 16 of file adler32.c.

#define DO8 | ( | buf,
 |  | i | ) | DO4(buf,i); DO4(buf,i+4);

Definition at line 17 of file adler32.c.

#define NMAX 5552

Definition at line 11 of file adler32.c.

Function Documentation

uLong adler32 | ( | adler | ,
 |  | buf | ,
 |  | len |
 | ) |

Variable Documentation

const Bytef* buf

Definition at line 23 of file adler32.c.

uInt len

Definition at line 24 of file adler32.c.

Generated on Sun Oct 21 12:43:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


compress.c File Reference

cvs-1.10/zlib/compress.c File Reference

#include "zlib.h"

Include dependency graph for compress.c:

Include dependency graph

Go to the source code of this file.

Functions

int | compress (dest, destLen, source, sourceLen) Bytef *dest

Variables

uLongf * destLen
const Bytef * | source
uLong sourceLen

Function Documentation

int compress | ( | dest | ,
 |  | destLen | ,
 |  | source | ,
 |  | sourceLen |
 | ) |

Variable Documentation

uLongf* destLen

Definition at line 24 of file compress.c.

const Bytef* source

Definition at line 25 of file compress.c.

uLong sourceLen

Definition at line 26 of file compress.c.

Generated on Sun Oct 21 12:43:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


crc32.c File Reference

cvs-1.10/zlib/crc32.c File Reference

#include "zlib.h"

Include dependency graph for crc32.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | local static
#define | DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
#define | DO2(buf) DO1(buf); DO1(buf);
#define | DO4(buf) DO2(buf); DO2(buf);
#define | DO8(buf) DO4(buf); DO4(buf);

Functions

uLongf * get_crc_table ()
uLong | crc32 (crc, buf, len) uLong crc

Variables

uLongf | crc_table [256]
const Bytef * | buf
uInt len

Define Documentation

#define DO1 ( buf ) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);

Definition at line 136 of file crc32.c.

#define DO2 ( buf ) DO1(buf); DO1(buf);

Definition at line 137 of file crc32.c.

#define DO4 ( buf ) DO2(buf); DO2(buf);

Definition at line 138 of file crc32.c.

#define DO8 ( buf ) DO4(buf); DO4(buf);

Definition at line 139 of file crc32.c.

int local static

Definition at line 10 of file crc32.c.

Function Documentation

uLong crc32 | ( | crc | ,
 |  | buf | ,
 |  | len |
 | ) |

uLongf* get_crc_table ( void )

Definition at line 127 of file crc32.c.

00128 {
00129 #ifdef DYNAMIC_CRC_TABLE
00130   if (crc_table_empty) make_crc_table();
00131 #endif
00132   return (uLongf *)crc_table;
00133 }

Variable Documentation

const Bytef* buf

Definition at line 144 of file crc32.c.

uLongf crc_table[256] [static]

Definition at line 68 of file crc32.c.

uInt len

Definition at line 145 of file crc32.c.

Generated on Sun Oct 21 12:43:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


deflate.c File Reference

cvs-1.10/zlib/deflate.c File Reference

#include "deflate.h"

Include dependency graph for deflate.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | config_s
struct | static_tree_desc_s

Defines

#define | NIL 0
#define | TOO_FAR 4096
#define | MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
#define | EQUAL 0
#define | UPDATE_HASH(s, h, c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
#define | INSERT_STRING(s, str, match_head)
#define | CLEAR_HASH(s)
#define | check_match(s, start, match, length)
#define | FLUSH_BLOCK_ONLY(s, eof)
#define | FLUSH_BLOCK(s, eof)

Typedefs

typedef block_state(* | compress_func )(deflate_state *s, int flush)
typedef config_s | config

Enumerations

enum | block_state { need_more, block_done, finish_started, finish_done }

Functions

void | fill_window (deflate_state *s)
block_state | deflate_stored (deflate_state *s, int flush)
block_state | deflate_fast (deflate_state *s, int flush)
block_state | deflate_slow (deflate_state *s, int flush)
void | lm_init (deflate_state *s)
uInt longest_match (deflate_state *s, IPos cur_match)
void | putShortMSB (deflate_state *s, uInt b)
void | flush_pending (z_streamp strm)
int | read_buf (z_streamp strm, charf *buf, unsigned size)
int | deflateInit_ (strm, level, version, stream_size) z_streamp strm

Variables

char | deflate_copyright [] = " deflate 1.0.4 Copyright 1995-1996 Jean-loup Gailly "
config | configuration_table [10]
int | level
const char * | version
int | stream_size
int | method
int | windowBits
int | memLevel
int | strategy
const Bytef * | dictionary
uInt dictLength
uInt b
int | flush
z_streamp source
charf * buf
unsigned | size
IPos cur_match

Define Documentation

#define CLEAR_HASH ( s )

Value:

s->head[s->hash_size-1] = NIL; \
    zmemzero((charf *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));

Definition at line 173 of file deflate.c.

#define EQUAL 0

Definition at line 142 of file deflate.c.

#define FLUSH_BLOCK | ( | s,
 |  | eof | )

Value:

{ \
   FLUSH_BLOCK_ONLY(s, eof); \
   if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
}

Referenced by flush().

#define FLUSH_BLOCK_ONLY | ( | s,
 |  | eof | )

Value:

{ \
   _tr_flush_block(s, (s->block_start >= 0L ? \
                   (charf *)&s->window[(unsigned)s->block_start] : \
                   (charf *)Z_NULL), \
        (ulg)((long)s->strstart - s->block_start), \
        (eof)); \
   s->block_start = s->strstart; \
   flush_pending(s->strm); \
   Tracev((stderr,"[FLUSH]")); \
}

Referenced by flush().

#define INSERT_STRING | ( | s,
 |  | str,
 |  | match_head | )

Value:

(UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
    s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \
    s->head[s->ins_h] = (Pos)(str))

Definition at line 164 of file deflate.c.

Referenced by flush().

#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)

Definition at line 105 of file deflate.c.

#define NIL 0

Definition at line 97 of file deflate.c.

#define TOO_FAR 4096

Definition at line 101 of file deflate.c.

#define UPDATE_HASH | ( | s,
 |  | h,
 |  | c | ) | (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)

Definition at line 153 of file deflate.c.

#define check_match | ( | s,
 |  | start,
 |  | match,
 |  | length | )

Referenced by flush().

Typedef Documentation

typedef block_state(* compress_func)(deflate_state *s, int flush)

Definition at line 72 of file deflate.c.

typedef struct config_s config

Enumeration Type Documentation

enum block_state

Enumeration values:
need_more
block_done
finish_started
finish_done

Definition at line 65 of file deflate.c.

00065              {
00066     need_more,      /* block not completed, need more input or more output */
00067     block_done,     /* block flush performed */
00068     finish_started, /* finish started, need only more output at next deflate */
00069     finish_done     /* finish done, accept no more input or output */
00070 } block_state;

Function Documentation

int deflateInit_ | ( | strm | ,
 |  | level | ,
 |  | version | ,
 |  | stream_size |
 | ) |

block_state deflate_fast | ( | deflate_state * | s,
 |  | int | flush
 | ) | [static]

block_state deflate_slow | ( | deflate_state * | s,
 |  | int | flush
 | ) | [static]

block_state deflate_stored | ( | deflate_state * | s,
 |  | int | flush
 | ) | [static]

void fill_window ( deflate_state * s ) [static]

Referenced by flush().

void flush_pending ( z_streamp strm ) [static]

void lm_init ( deflate_state * s ) [static]

uInt longest_match | ( | deflate_state * | s,
 |  | IPos | cur_match
 | ) | [static]

Referenced by flush().

void putShortMSB | ( | deflate_state * | s,
 |  | uInt | b
 | ) | [static]

int read_buf | ( | z_streamp | strm,
 |  | charf * | buf,
 |  | unsigned | size
 | ) | [static]

Variable Documentation

uInt b

Definition at line 385 of file deflate.c.

Referenced by CCvsStatusBar::DrawItem().

charf* buf

Definition at line 600 of file deflate.c.

config configuration_table[10] [static]

Initial value:

 {

 {0,    0,  0,    0, deflate_stored},
 {4,    4,  8,    4, deflate_fast},
 {4,    5, 16,    8, deflate_fast},
 {4,    6, 32,   32, deflate_fast},

 {4,    4, 16,   16, deflate_slow},
 {8,   16, 32,   32, deflate_slow},
 {8,   16, 128, 128, deflate_slow},
 {8,   32, 128, 256, deflate_slow},
 {32, 128, 258, 1024, deflate_slow},
 {32, 258, 258, 4096, deflate_slow}}

Definition at line 123 of file deflate.c.

IPos cur_match

Definition at line 663 of file deflate.c.

char deflate_copyright[] = " deflate 1.0.4 Copyright 1995-1996 Jean-loup Gailly "

Definition at line 54 of file deflate.c.

uInt dictLength

Definition at line 277 of file deflate.c.

const Bytef* dictionary

Definition at line 276 of file deflate.c.

int flush

Definition at line 1095 of file deflate.c.

int level

Definition at line 345 of file deflate.c.

int memLevel

Definition at line 196 of file deflate.c.

int method

Definition at line 194 of file deflate.c.

unsigned size

Definition at line 601 of file deflate.c.

z_streamp source

Definition at line 574 of file deflate.c.

int strategy

Definition at line 346 of file deflate.c.

int stream_size

Definition at line 143 of file inflate.c.

const char* version

Definition at line 198 of file deflate.c.

int windowBits

Definition at line 195 of file deflate.c.

Generated on Sun Oct 21 12:43:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


deflate.h File Reference

cvs-1.10/zlib/deflate.h File Reference

#include "zutil.h"

Include dependency graph for deflate.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | ct_data_s
struct | internal_state
struct | tree_desc_s

Defines

#define | LENGTH_CODES 29
#define | LITERALS 256
#define | L_CODES (LITERALS+1+LENGTH_CODES)
#define | D_CODES 30
#define | BL_CODES 19
#define | HEAP_SIZE (2*L_CODES+1)
#define | MAX_BITS 15
#define | INIT_STATE 42
#define | BUSY_STATE 113
#define | FINISH_STATE 666
#define | Freq fc.freq
#define | Code fc.code
#define | Dad dl.dad
#define | Len dl.len
#define | max_insert_length max_lazy_match
#define | put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
#define | MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
#define | MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)

Typedefs

typedef ct_data_s | ct_data
typedef static_tree_desc_s | static_tree_desc
typedef tree_desc_s | tree_desc
typedef ush | Pos
typedef Pos | Posf
typedef unsigned | IPos
typedef internal_state | deflate_state

Functions

void | _tr_init (deflate_state *s)
int | _tr_tally (deflate_state *s, unsigned dist, unsigned lc)
ulg | _tr_flush_block (deflate_state *s, charf *buf, ulg stored_len, int eof)
void | _tr_align (deflate_state *s)
void | _tr_stored_block (deflate_state *s, charf *buf, ulg stored_len, int eof)

Define Documentation

#define BL_CODES 19

Definition at line 34 of file deflate.h.

#define BUSY_STATE 113

Definition at line 44 of file deflate.h.

#define Code fc.code

Definition at line 62 of file deflate.h.

#define D_CODES 30

Definition at line 31 of file deflate.h.

#define Dad dl.dad

Definition at line 63 of file deflate.h.

#define FINISH_STATE 666

Definition at line 45 of file deflate.h.

#define Freq fc.freq

Definition at line 61 of file deflate.h.

#define HEAP_SIZE (2*L_CODES+1)

Definition at line 37 of file deflate.h.

#define INIT_STATE 42

Definition at line 43 of file deflate.h.

#define LENGTH_CODES 29

Definition at line 22 of file deflate.h.

#define LITERALS 256

Definition at line 25 of file deflate.h.

#define L_CODES (LITERALS+1+LENGTH_CODES)

Definition at line 28 of file deflate.h.

#define Len dl.len

Definition at line 64 of file deflate.h.

#define MAX_BITS 15

Definition at line 40 of file deflate.h.

#define MAX_DIST ( s ) ((s)->w_size-MIN_LOOKAHEAD)

Definition at line 262 of file deflate.h.

Referenced by flush().

#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)

Definition at line 257 of file deflate.h.

#define max_insert_length max_lazy_match

Definition at line 162 of file deflate.h.

#define put_byte | ( | s,
 |  | c | ) | {s->pending_buf[s->pending++] = (c);}

Definition at line 254 of file deflate.h.

Typedef Documentation

typedef unsigned IPos

Definition at line 76 of file deflate.h.

typedef ush Pos

Definition at line 74 of file deflate.h.

typedef Pos Posf

Definition at line 75 of file deflate.h.

typedef struct ct_data_s ct_data

typedef struct internal_state deflate_state

typedef struct static_tree_desc_s static_tree_desc

Definition at line 66 of file deflate.h.

typedef struct tree_desc_s tree_desc

Function Documentation

void _tr_align ( deflate_state * s )

ulg _tr_flush_block | ( | deflate_state * | s,
 |  | charf * | buf,
 |  | ulg | stored_len,
 |  | int | eof
 | ) |

void _tr_init ( deflate_state * s )

void _tr_stored_block | ( | deflate_state * | s,
 |  | charf * | buf,
 |  | ulg | stored_len,
 |  | int | eof
 | ) |

int _tr_tally | ( | deflate_state * | s,
 |  | unsigned | dist,
 |  | unsigned | lc
 | ) |

Referenced by flush().

Generated on Sun Oct 21 12:43:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


example.c File Reference

cvs-1.10/zlib/example.c File Reference

#include <stdio.h>
#include "zlib.h"
#include <string.h>
#include <stdlib.h>

Include dependency graph for example.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | CHECK_ERR(err, msg)

Functions

void | test_compress (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
void | test_gzio (const char *out, const char *in, Byte *uncompr, int uncomprLen)
void | test_deflate (Byte *compr, uLong comprLen)
void | test_inflate (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
void | test_large_deflate (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
void | test_large_inflate (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
void | test_flush (Byte *compr, uLong comprLen)
void | test_sync (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
void | test_dict_deflate (Byte *compr, uLong comprLen)
void | test_dict_inflate (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
int | main (int argc, char *argv[])
void | test_compress (compr, comprLen, uncompr, uncomprLen) Byte *compr,*uncompr

Variables

const char | hello [] = "hello, hello!"
const char | dictionary [] = "hello"
uLong dictId
uLong comprLen
uLong uncomprLen
const char * | in
Byte * uncompr
char * | argv []

Define Documentation

#define CHECK_ERR | ( | err,
 |  | msg | )

Value:

{ \
    if (err != Z_OK) { \
        fprintf(stderr, "%s error: %d\n", msg, err); \
        exit(1); \
    } \
}

Definition at line 18 of file example.c.

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |

void test_compress | ( | compr | ,
 |  | comprLen | ,
 |  | uncompr | ,
 |  | uncomprLen |
 | ) |

void test_compress | ( | Byte * | compr,
 |  | uLong | comprLen,
 |  | Byte * | uncompr,
 |  | uLong | uncomprLen
 | ) |

void test_deflate | ( | Byte * | compr,
 |  | uLong | comprLen
 | ) |

void test_dict_deflate | ( | Byte * | compr,
 |  | uLong | comprLen
 | ) |

void test_dict_inflate | ( | Byte * | compr,
 |  | uLong | comprLen,
 |  | Byte * | uncompr,
 |  | uLong | uncomprLen
 | ) |

void test_flush | ( | Byte * | compr,
 |  | uLong | comprLen
 | ) |

void test_gzio | ( | const char * | out,
 |  | const char * | in,
 |  | Byte * | uncompr,
 |  | int | uncomprLen
 | ) |

void test_inflate | ( | Byte * | compr,
 |  | uLong | comprLen,
 |  | Byte * | uncompr,
 |  | uLong | uncomprLen
 | ) |

void test_large_deflate | ( | Byte * | compr,
 |  | uLong | comprLen,
 |  | Byte * | uncompr,
 |  | uLong | uncomprLen
 | ) |

void test_large_inflate | ( | Byte * | compr,
 |  | uLong | comprLen,
 |  | Byte * | uncompr,
 |  | uLong | uncomprLen
 | ) |

void test_sync | ( | Byte * | compr,
 |  | uLong | comprLen,
 |  | Byte * | uncompr,
 |  | uLong | uncomprLen
 | ) |

Variable Documentation

char* argv[]

Definition at line 459 of file example.c.

uLong comprLen

Definition at line 409 of file example.c.

uLong dictId

Definition at line 31 of file example.c.

const char dictionary[] = "hello"

Definition at line 30 of file example.c.

const char hello[] = "hello, hello!"

Definition at line 25 of file example.c.

const char* in

Definition at line 82 of file example.c.

* uncompr

Definition at line 408 of file example.c.

uLong uncomprLen

Definition at line 409 of file example.c.

Generated on Sun Oct 21 12:43:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


gzio.c File Reference

cvs-1.10/zlib/gzio.c File Reference

#include <stdio.h>
#include "zutil.h"

Include dependency graph for gzio.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | gz_stream
struct | internal_state

Defines

#define | Z_BUFSIZE 4096
#define | ALLOC(size) malloc(size)
#define | TRYFREE(p) {if (p) free(p);}
#define | ASCII_FLAG 0x01
#define | HEAD_CRC 0x02
#define | EXTRA_FIELD 0x04
#define | ORIG_NAME 0x08
#define | COMMENT 0x10
#define | RESERVED 0xE0

Typedefs

typedef gz_stream | gz_stream

Functions

gzFile | gz_open (const char *path, const char *mode, int fd)
int | get_byte (gz_stream *s)
void | check_header (gz_stream *s)
int | destroy (gz_stream *s)
void | putLong (FILE *file, uLong x)
uLong getLong (gz_stream *s)
gzFile | gz_open (path, mode, fd) const char *path

Variables

int | gz_magic [2] = {0x1f, 0x8b}
const char * | mode
int | fd
voidp buf
unsigned | len
int | flush
uLong x
int * | errnum

Define Documentation

#define ALLOC ( size ) malloc(size)

Definition at line 16 of file gzio.c.

#define ASCII_FLAG 0x01

Definition at line 22 of file gzio.c.

#define COMMENT 0x10

Definition at line 26 of file gzio.c.

#define EXTRA_FIELD 0x04

Definition at line 24 of file gzio.c.

#define HEAD_CRC 0x02

Definition at line 23 of file gzio.c.

#define ORIG_NAME 0x08

Definition at line 25 of file gzio.c.

#define RESERVED 0xE0

Definition at line 27 of file gzio.c.

#define TRYFREE ( p ) {if (p) free(p);}

Definition at line 17 of file gzio.c.

#define Z_BUFSIZE 4096

Definition at line 14 of file gzio.c.

Typedef Documentation

typedef struct gz_stream gz_stream

Function Documentation

void check_header ( gz_stream * s ) [static]

int destroy ( gz_stream * s ) [static]

uLong getLong ( gz_stream * s ) [static]

int get_byte ( gz_stream * s ) [static]

gzFile gz_open | ( | path | ,
 |  | mode | ,
 |  | fd |
 | ) | const [static]

gzFile gz_open | ( | const char * | path,
 |  | const char * | mode,
 |  | int | fd
 | ) | [static]

void putLong | ( | FILE * | file,
 |  | uLong | x
 | ) | [static]

Variable Documentation

const voidp buf

Definition at line 366 of file gzio.c.

int* errnum

Definition at line 501 of file gzio.c.

int fd

Definition at line 63 of file gzio.c.

int flush

Definition at line 403 of file gzio.c.

Referenced by UStr::endsWith(), UPStr::~UPStr(), and UStr::~UStr().

int gz_magic[2] = {0x1f, 0x8b} [static]

Definition at line 19 of file gzio.c.

unsigned len

Definition at line 367 of file gzio.c.

const char* mode

Definition at line 161 of file gzio.c.

uLong x

Definition at line 443 of file gzio.c.

Generated on Sun Oct 21 12:43:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


infblock.c File Reference

cvs-1.10/zlib/infblock.c File Reference

#include "zutil.h"
#include "infblock.h"
#include "inftrees.h"
#include "infcodes.h"
#include "infutil.h"

Include dependency graph for infblock.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | inflate_codes_state

Functions

void | inflate_blocks_reset (s, z, c) inflate_blocks_statef *s

Variables

uInt border []
z_streamp z
uLongf * c
uInt w
int | r
const Bytef * | d
uInt n

Function Documentation

void inflate_blocks_reset | ( | s | ,
 |  | z | ,
 |  | c |
 | ) |

Referenced by f().

Variable Documentation

uInt border[] [static]

Initial value:

 {
        16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}

Definition at line 15 of file infblock.c.

uLongf * c

Definition at line 385 of file infblock.c.

const Bytef* d

Definition at line 397 of file infblock.c.

uInt n

Definition at line 398 of file infblock.c.

int r

Definition at line 119 of file infblock.c.

uInt w

Definition at line 92 of file infblock.c.

z_streamp z

Definition at line 445 of file inftrees.c.

Generated on Sun Oct 21 12:43:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


infblock.h File Reference

cvs-1.10/zlib/infblock.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Typedefs

typedef inflate_blocks_state | inflate_blocks_statef

Functions

inflate_blocks_statef *inflate_blocks_new | OF ((z_streamp z, check_func c, uInt w))
int inflate_blocks | OF ((inflate_blocks_statef *, z_streamp, int))
void inflate_blocks_reset | OF ((inflate_blocks_statef *, z_streamp, uLongf *))
void inflate_set_dictionary | OF ((inflate_blocks_statef *s, const Bytef *d, uInt n))

Typedef Documentation

typedef struct inflate_blocks_state inflate_blocks_statef

Definition at line 12 of file infblock.h.

Function Documentation

void inflate_set_dictionary OF ( (inflate_blocks_statef *s, const Bytef *d, uIntn) )

int inflate_blocks_free OF ( (inflate_blocks_statef *, z_streamp, uLongf *) )

int inflate_blocks OF ( (inflate_blocks_statef *, z_streamp, int) )

inflate_blocks_statef* inflate_blocks_new OF ( (z_streamp z, check_func c, uInt w) )

Generated on Sun Oct 21 12:43:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


infcodes.c File Reference

cvs-1.10/zlib/infcodes.c File Reference

#include "zutil.h"
#include "inftrees.h"
#include "infblock.h"
#include "infcodes.h"
#include "infutil.h"
#include "inffast.h"

Include dependency graph for infcodes.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | inflate_codes_state

Defines

#define | base more.Base
#define | next more.Next
#define | exop word.what.Exop
#define | bits word.what.Bits

Functions

inflate_codes_statef * inflate_codes_new (bl, bd, tl, td, z) uInt bl, bd

Variables

inflate_huft * tl
inflate_huft * td
z_streamp z
int | r

Define Documentation

#define base more.Base

Definition at line 14 of file infcodes.c.

#define bits word.what.Bits

Definition at line 17 of file infcodes.c.

#define exop word.what.Exop

Definition at line 16 of file infcodes.c.

#define next more.Next

Definition at line 15 of file infcodes.c.

Function Documentation

inflate_codes_statef* inflate_codes_new | ( | bl | ,
 |  | bd | ,
 |  | tl | ,
 |  | td | ,
 |  | z |
 | ) |

Referenced by r().

Variable Documentation

int r

Definition at line 84 of file infcodes.c.

inflate_huft ** td

Definition at line 398 of file inftrees.c.

inflate_huft ** tl

Definition at line 397 of file inftrees.c.

z_streamp z

Definition at line 243 of file infcodes.c.

Generated on Sun Oct 21 12:43:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


infcodes.h File Reference

cvs-1.10/zlib/infcodes.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Typedefs

typedef inflate_codes_state | inflate_codes_statef

Functions

inflate_codes_statef *inflate_codes_new | OF ((uInt, uInt, inflate_huft *, inflate_huft *, z_streamp))
int inflate_codes | OF ((inflate_blocks_statef *, z_streamp, int))
void inflate_codes_free | OF ((inflate_codes_statef *, z_streamp))

Typedef Documentation

typedef struct inflate_codes_state inflate_codes_statef

Definition at line 12 of file infcodes.h.

Function Documentation

void inflate_codes_free OF ( (inflate_codes_statef *, z_streamp) )

int inflate_codes OF ( (inflate_blocks_statef *, z_streamp, int) )

inflate_codes_statef* inflate_codes_new OF ( (uInt, uInt, inflate_huft *, inflate_huft *, z_streamp) )

Generated on Sun Oct 21 12:43:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


inffast.c File Reference

cvs-1.10/zlib/inffast.c File Reference

#include "zutil.h"
#include "inftrees.h"
#include "infblock.h"
#include "infcodes.h"
#include "infutil.h"
#include "inffast.h"

Include dependency graph for inffast.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | inflate_codes_state

Defines

#define | base more.Base
#define | next more.Next
#define | exop word.what.Exop
#define | bits word.what.Bits
#define | GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}}
#define | UNGRAB {n+=(c=k>>3);p-=c;k&=7;}

Functions

int | inflate_fast (bl, bd, tl, td, s, z) uInt bl, bd

Variables

inflate_huft * tl
inflate_huft * td
inflate_blocks_statef * s
z_streamp z

Define Documentation

#define GRABBITS ( j ) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}}

Definition at line 22 of file inffast.c.

#define UNGRAB {n+=(c=k>>3);p-=c;k&=7;}

Definition at line 23 of file inffast.c.

#define base more.Base

Definition at line 16 of file inffast.c.

#define bits word.what.Bits

Definition at line 19 of file inffast.c.

#define exop word.what.Exop

Definition at line 18 of file inffast.c.

#define next more.Next

Definition at line 17 of file inffast.c.

Function Documentation

int inflate_fast | ( | bl | ,
 |  | bd | ,
 |  | tl | ,
 |  | td | ,
 |  | s | ,
 |  | z |
 | ) |

Referenced by r().

Variable Documentation

inflate_blocks_statef* s

Definition at line 34 of file inffast.c.

inflate_huft* td

Definition at line 33 of file inffast.c.

inflate_huft* tl

Definition at line 32 of file inffast.c.

z_streamp z

Definition at line 35 of file inffast.c.

Generated on Sun Oct 21 12:43:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


inffast.h File Reference

cvs-1.10/zlib/inffast.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int inflate_fast OF ((uInt, uInt, inflate_huft *, inflate_huft *, inflate_blocks_statef *, z_streamp))

Function Documentation

int inflate_fast OF ( (uInt, uInt, inflate_huft *, inflate_huft *, inflate_blocks_statef *, z_streamp) )

Generated on Sun Oct 21 12:43:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


inflate.c File Reference

cvs-1.10/zlib/inflate.c File Reference

#include "zutil.h"
#include "infblock.h"

Include dependency graph for inflate.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | inflate_blocks_state
struct | internal_state

Defines

#define | NEEDBYTE {if(z->avail_in==0)return r;r=Z_OK;}
#define | NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)

Functions

int | inflateReset (z) z_streamp z

Variables

int | w
const char * | version
int | stream_size
int | f
const Bytef * | dictionary
uInt dictLength

Define Documentation

#define NEEDBYTE {if(z->avail_in==0)return r;r=Z_OK;}

#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)

Function Documentation

int inflateReset ( z )

Variable Documentation

uInt dictLength

Definition at line 277 of file inflate.c.

const Bytef* dictionary

Definition at line 276 of file inflate.c.

int f

Definition at line 154 of file inflate.c.

int stream_size

Definition at line 143 of file inflate.c.

const char* version

Definition at line 142 of file inflate.c.

int w

Definition at line 85 of file inflate.c.

Referenced by CWinLogRevData::UpdateSelf().

Generated on Sun Oct 21 12:43:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


inftrees.c File Reference

cvs-1.10/zlib/inftrees.c File Reference

#include "zutil.h"
#include "inftrees.h"

Include dependency graph for inftrees.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | internal_state

Defines

#define | base more.Base
#define | next more.Next
#define | exop word.what.Exop
#define | bits word.what.Bits
#define | BMAX 15
#define | N_MAX 288
#define | C0 *p++ = 0;
#define | C2 C0 C0 C0 C0
#define | C4 C2 C2 C2 C2
#define | FIXEDH 530

Functions

int | huft_build (uIntf *, uInt, uInt, uIntf *, uIntf *, inflate_huft **, uIntf *, z_streamp)
voidpf falloc (voidpf, uInt, uInt)
int | huft_build (b, n, s, d, e, t, m, zs) uIntf *b
voidpf falloc (q, n, s) voidpf q

Variables

char | inflate_copyright [] = " inflate 1.0.4 Copyright 1995-1996 Mark Adler "
uInt | cplens [31]
uInt | cplext [31]
uInt | cpdist [30]
uInt | cpdext [30]
uInt n
uInt s
uIntf * d
uIntf * e
inflate_huft ** t
uIntf * m
z_streamp zs
uIntf * bb
inflate_huft ** tb
z_streamp z
uInt nd
uIntf * c
uIntf * bl
uIntf * bd
inflate_huft ** tl
inflate_huft ** td
inflate_huft | fixed_mem [530]
uInt fixed_bl
uInt fixed_bd
inflate_huft * fixed_tl
inflate_huft * fixed_td

Define Documentation

#define BMAX 15

Definition at line 91 of file inftrees.c.

#define C0 *p++ = 0;

#define C2 C0 C0 C0 C0

#define C4 C2 C2 C2 C2

#define FIXEDH 530

Definition at line 374 of file inftrees.c.

#define N_MAX 288

Definition at line 92 of file inftrees.c.

#define base more.Base

Definition at line 19 of file inftrees.c.

#define bits word.what.Bits

Definition at line 22 of file inftrees.c.

#define exop word.what.Exop

Definition at line 21 of file inftrees.c.

#define next more.Next

Definition at line 20 of file inftrees.c.

Function Documentation

voidpf falloc | ( | q | ,
 |  | n | ,
 |  | s |
 | ) | [static]

voidpf falloc | ( | voidpf | ,
 |  | uInt | ,
 |  | uInt |
 | ) | [static]

int huft_build | ( | b | ,
 |  | n | ,
 |  | s | ,
 |  | d | ,
 |  | e | ,
 |  | t | ,
 |  | m | ,
 |  | zs |
 | ) | [static]

Referenced by td().

int huft_build | ( | uIntf * | ,
 |  | uInt | ,
 |  | uInt | ,
 |  | uIntf * | ,
 |  | uIntf * | ,
 |  | inflate_huft ** | ,
 |  | uIntf * | ,
 |  | z_streamp |
 | ) | [static]

Variable Documentation

uIntf* bb

Definition at line 303 of file inftrees.c.

uIntf * bd

Definition at line 396 of file inftrees.c.

uIntf* bl

Definition at line 326 of file inftrees.c.

uIntf* c

Definition at line 325 of file inftrees.c.

uInt cpdext[30] [static]

Initial value:

 {
        0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
        7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
        12, 12, 13, 13}

Definition at line 52 of file inftrees.c.

uInt cpdist[30] [static]

Initial value:

 {
        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
        8193, 12289, 16385, 24577}

Definition at line 48 of file inftrees.c.

uInt cplens[31] [static]

Initial value:

 {
        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}

Definition at line 41 of file inftrees.c.

uInt cplext[31] [static]

Initial value:

 {
        0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
        3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 192, 192}

Definition at line 45 of file inftrees.c.

uIntf* d

Definition at line 102 of file inftrees.c.

uIntf* e

Definition at line 103 of file inftrees.c.

uInt fixed_bd [static]

Definition at line 377 of file inftrees.c.

uInt fixed_bl [static]

Definition at line 376 of file inftrees.c.

inflate_huft fixed_mem[ 530 ] [static]

Definition at line 375 of file inftrees.c.

inflate_huft* fixed_td [static]

Definition at line 379 of file inftrees.c.

inflate_huft* fixed_tl [static]

Definition at line 378 of file inftrees.c.

char inflate_copyright[] = " inflate 1.0.4 Copyright 1995-1996 Mark Adler "

Definition at line 9 of file inftrees.c.

uIntf* m

Definition at line 105 of file inftrees.c.

uInt n

Definition at line 384 of file inftrees.c.

uInt nd

Definition at line 324 of file inftrees.c.

uInt s

Definition at line 385 of file inftrees.c.

Referenced by CWincvsView::FeedThisLine(), CBrowseFileView::OnPrint(), and findTcl().

inflate_huft* * t

Definition at line 104 of file inftrees.c.

inflate_huft* * tb

Definition at line 304 of file inftrees.c.

inflate_huft* * td

Definition at line 398 of file inftrees.c.

inflate_huft* * tl

Definition at line 397 of file inftrees.c.

z_streamp z

Definition at line 445 of file inftrees.c.

z_streamp zs

Definition at line 106 of file inftrees.c.

Generated on Sun Oct 21 12:43:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


inftrees.h File Reference

cvs-1.10/zlib/inftrees.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | inflate_huft_s

Typedefs

typedef inflate_huft_s | inflate_huft

Functions

int inflate_trees_bits | OF ((uIntf *, uIntf *, inflate_huft **, z_streamp))
int inflate_trees_dynamic | OF ((uInt, uInt, uIntf *, uIntf *, uIntf *, inflate_huft **, inflate_huft **, z_streamp))
int inflate_trees_fixed | OF ((uIntf *, uIntf *, inflate_huft **, inflate_huft **))
int inflate_trees_free | OF ((inflate_huft *, z_streamp))

Typedef Documentation

typedef struct inflate_huft_s inflate_huft

Definition at line 14 of file inftrees.h.

Function Documentation

int inflate_trees_free OF ( (inflate_huft *, z_streamp) )

int inflate_trees_fixed OF ( (uIntf *, uIntf *, inflate_huft **, inflate_huft **) )

int inflate_trees_dynamic OF ( (uInt, uInt, uIntf *, uIntf *, uIntf *, inflate_huft **, inflate_huft **, z_streamp) )

int inflate_trees_bits OF ( (uIntf *, uIntf *, inflate_huft **, z_streamp) )

Generated on Sun Oct 21 12:43:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


infutil.c File Reference

cvs-1.10/zlib/infutil.c File Reference

#include "zutil.h"
#include "infblock.h"
#include "inftrees.h"
#include "infcodes.h"
#include "infutil.h"

Include dependency graph for infutil.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | inflate_codes_state

Functions

int | inflate_flush (s, z, r) inflate_blocks_statef *s

Variables

uInt | inflate_mask [17]
z_streamp z
int | r

Function Documentation

int inflate_flush | ( | s | ,
 |  | z | ,
 |  | r |
 | ) |

Referenced by r().

Variable Documentation

uInt inflate_mask[17]

Initial value:

 {
    0x0000,
    0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
    0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
}

Definition at line 15 of file infutil.c.

int r

Definition at line 26 of file infutil.c.

Referenced by CCvsStatusBar::DrawItem(), CBrowseFileView::OnPrint(), UDC::Rectangle(), UDC::RoundRect(), and UDC::TextOutClipped().

z_streamp z

Definition at line 25 of file infutil.c.

Generated on Sun Oct 21 12:43:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


infutil.h File Reference

cvs-1.10/zlib/infutil.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | inflate_blocks_state
struct | internal_state

Defines

#define | UPDBITS {s->bitb=b;s->bitk=k;}
#define | UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
#define | UPDOUT {s->write=q;}
#define | UPDATE {UPDBITS UPDIN UPDOUT}
#define | LEAVE {UPDATE return inflate_flush(s,z,r);}
#define | LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}
#define | NEEDBYTE {if(n)r=Z_OK;else LEAVE}
#define | NEXTBYTE (n--,*p++)
#define | NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}
#define | DUMPBITS(j) {b>>=(j);k-=(j);}
#define | WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)
#define | LOADOUT {q=s->write;m=(uInt)WAVAIL;}
#define | WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
#define | FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}
#define | NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
#define | OUTBYTE(a) {*q++=(Byte)(a);m--;}
#define | LOAD {LOADIN LOADOUT}

Enumerations

enum inflate_block_mode {
TYPE, LENS, STORED, TABLE,
BTREE, DTREE, CODES, DRY,
DONE, BAD
}

Functions

int inflate_flush | OF ((inflate_blocks_statef *, z_streamp, int))

Variables

uInt | inflate_mask [17]

Define Documentation

#define DUMPBITS ( j ) {b>>=(j);k-=(j);}

Definition at line 77 of file infutil.h.

Referenced by r(), and z().

#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}

Definition at line 82 of file infutil.h.

#define LEAVE {UPDATE return inflate_flush(s,z,r);}

Definition at line 71 of file infutil.h.

#define LOAD {LOADIN LOADOUT}

Definition at line 86 of file infutil.h.

#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}

Definition at line 73 of file infutil.h.

#define LOADOUT {q=s->write;m=(uInt)WAVAIL;}

Definition at line 80 of file infutil.h.

#define NEEDBITS ( j ) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}

Definition at line 76 of file infutil.h.

Referenced by r().

#define NEEDBYTE {if(n)r=Z_OK;else LEAVE}

Definition at line 74 of file infutil.h.

#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}

Definition at line 83 of file infutil.h.

#define NEXTBYTE (n--,*p++)

Definition at line 75 of file infutil.h.

#define OUTBYTE ( a ) {*q++=(Byte)(a);m--;}

Definition at line 84 of file infutil.h.

Referenced by r().

#define UPDATE {UPDBITS UPDIN UPDOUT}

Definition at line 70 of file infutil.h.

#define UPDBITS {s->bitb=b;s->bitk=k;}

Definition at line 67 of file infutil.h.

#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}

Definition at line 68 of file infutil.h.

#define UPDOUT {s->write=q;}

Definition at line 69 of file infutil.h.

#define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)

Definition at line 79 of file infutil.h.

#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}

Definition at line 81 of file infutil.h.

Enumeration Type Documentation

enum inflate_block_mode

Enumeration values:
TYPE
LENS
STORED
TABLE
BTREE
DTREE
CODES
DRY
DONE
BAD

Definition at line 14 of file infutil.h.

00014              {
00015       TYPE,     /* get type bits (3, including end bit) */
00016       LENS,     /* get lengths for stored */
00017       STORED,   /* processing stored block */
00018       TABLE,    /* get table lengths */
00019       BTREE,    /* get bit lengths tree for a dynamic block */
00020       DTREE,    /* get length, distance trees for a dynamic block */
00021       CODES,    /* processing fixed or dynamic block */
00022       DRY,      /* output remaining window bytes */
00023       DONE,     /* finished last block, done */
00024       BAD}      /* got a data error--stuck here */

Function Documentation

int inflate_flush OF ( (inflate_blocks_statef *, z_streamp, int) )

Variable Documentation

uInt inflate_mask[17]

Definition at line 89 of file infutil.h.

Generated on Sun Oct 21 12:43:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


minigzip.c File Reference

cvs-1.10/zlib/minigzip.c File Reference

#include <stdio.h>
#include "zlib.h"
#include <string.h>
#include <stdlib.h>

Include dependency graph for minigzip.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | SET_BINARY_MODE(file)
#define | GZ_SUFFIX ".gz"
#define | SUFFIX_LEN sizeof(GZ_SUFFIX)
#define | BUFLEN 4096
#define | MAX_NAME_LEN 1024
#define | local static

Functions

int | unlink (const char *)
void | error (const char *msg)
void | gz_compress (FILE *in, gzFile out)
void | gz_uncompress (gzFile in, FILE *out)
void | file_compress (char *file)
void | file_uncompress (char *file)
int | main (int argc, char *argv[])
void | error (msg) const char *msg

Variables

char * | prog
gzFile out
char * | argv []

Define Documentation

#define BUFLEN 4096

Definition at line 54 of file minigzip.c.

#define GZ_SUFFIX ".gz"

Definition at line 48 of file minigzip.c.

#define MAX_NAME_LEN 1024

Definition at line 55 of file minigzip.c.

#define SET_BINARY_MODE ( file )

Definition at line 34 of file minigzip.c.

#define SUFFIX_LEN sizeof(GZ_SUFFIX)

Definition at line 50 of file minigzip.c.

#define local static

Definition at line 57 of file minigzip.c.

Function Documentation

void error ( msg ) const

void error ( const char * msg )

void file_compress ( char * file )

void file_uncompress ( char * file )

void gz_compress | ( | FILE * | in,
 |  | gzFile | out
 | ) |

void gz_uncompress | ( | gzFile | in,
 |  | FILE * | out
 | ) |

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |

int unlink ( const char * )

Variable Documentation

char* argv[]

Definition at line 209 of file minigzip.c.

FILE* out

Definition at line 112 of file minigzip.c.

Referenced by CGraphView::OnLButtonDown(), UDC::TextOutClipped(), and main().

char* prog

Definition at line 63 of file minigzip.c.

Generated on Sun Oct 21 12:43:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


trees.c File Reference

cvs-1.10/zlib/trees.c File Reference

#include "deflate.h"

Include dependency graph for trees.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | static_tree_desc_s

Defines

#define | MAX_BL_BITS 7
#define | END_BLOCK 256
#define | REP_3_6 16
#define | REPZ_3_10 17
#define | REPZ_11_138 18
#define | Buf_size (8 * 2*sizeof(char))
#define | send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
#define | d_code(dist) ((dist) < 256 ? dist_code[dist] : dist_code[256+((dist)>>7)])
#define | put_short(s, w)
#define | send_bits(s, value, length)
#define | MAX(a, b) (a >= b ? a : b)
#define | SMALLEST 1
#define | pqremove(s, tree, top)
#define | smaller(tree, n, m, depth)

Functions

void | tr_static_init (void)
void | init_block (deflate_state *s)
void | pqdownheap (deflate_state *s, ct_data *tree, int k)
void | gen_bitlen (deflate_state *s, tree_desc *desc)
void | gen_codes (ct_data *tree, int max_code, ushf *bl_count)
void | build_tree (deflate_state *s, tree_desc *desc)
void | scan_tree (deflate_state *s, ct_data *tree, int max_code)
void | send_tree (deflate_state *s, ct_data *tree, int max_code)
int | build_bl_tree (deflate_state *s)
void | send_all_trees (deflate_state *s, int lcodes, int dcodes, int blcodes)
void | compress_block (deflate_state *s, ct_data *ltree, ct_data *dtree)
void | set_data_type (deflate_state *s)
unsigned | bi_reverse (unsigned value, int length)
void | bi_windup (deflate_state *s)
void | bi_flush (deflate_state *s)
void | copy_block (deflate_state *s, charf *buf, unsigned len, int header)
void | _tr_init (s) deflate_state *s

Variables

int | extra_lbits [29] = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}
int | extra_dbits [30] = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}
int | extra_blbits [19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}
uch | bl_order [19] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}
ct_data | static_ltree [(256+1+29)+2]
ct_data | static_dtree [30]
uch | dist_code [512]
uch | length_code [258-3+1]
int | base_length [29]
int | base_dist [30]
static_tree_desc static_l_desc
static_tree_desc static_d_desc
static_tree_desc static_bl_desc
ct_data * tree
int | k
tree_desc * desc
int | max_code
ushf * bl_count
int | lcodes
int | dcodes
int | blcodes
charf * buf
ulg stored_len
int | eof
unsigned | dist
unsigned | lc
ct_data * ltree
ct_data * dtree
int | len
int | header

Define Documentation

#define Buf_size (8 * 2*sizeof(char))

Definition at line 74 of file trees.c.

#define END_BLOCK 256

Definition at line 47 of file trees.c.

#define MAX | ( | a,
 |  | b | ) | (a >= b ? a : b)

Definition at line 225 of file trees.c.

#define MAX_BL_BITS 7

Definition at line 44 of file trees.c.

#define REPZ_11_138 18

Definition at line 56 of file trees.c.

#define REPZ_3_10 17

Definition at line 53 of file trees.c.

#define REP_3_6 16

Definition at line 50 of file trees.c.

#define SMALLEST 1

#define d_code ( dist ) ((dist) < 256 ? dist_code[dist] : dist_code[256+((dist)>>7)])

Definition at line 161 of file trees.c.

#define pqremove | ( | s,
 |  | tree,
 |  | top | )

Value:

{\
    top = s->heap[SMALLEST]; \
    s->heap[SMALLEST] = s->heap[s->heap_len--]; \
    pqdownheap(s, tree, SMALLEST); \
}

#define put_short | ( | s,
 |  | w | )

Value:

{ \
    put_byte(s, (uch)((w) & 0xff)); \
    put_byte(s, (uch)((ush)(w) >> 8)); \
}

Definition at line 172 of file trees.c.

#define send_bits | ( | s,
 |  | value,
 |  | length | )

Value:

{ int len = length;\
  if (s->bi_valid > (int)Buf_size - len) {\
    int val = value;\
    s->bi_buf |= (val << s->bi_valid);\
    put_short(s, s->bi_buf);\
    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
    s->bi_valid += len - Buf_size;\
  } else {\
    s->bi_buf |= (value) << s->bi_valid;\
    s->bi_valid += len;\
  }\
}

Definition at line 209 of file trees.c.

Referenced by max_code().

#define send_code | ( | s,
 |  | c,
 |  | tree | ) | send_bits(s, tree[c].Code, tree[c].Len)

Definition at line 152 of file trees.c.

Referenced by dtree(), and max_code().

#define smaller | ( | tree,
 |  | n,
 |  | m,
 |  | depth | )

Value:

(tree[n].Freq < tree[m].Freq || \
   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))

Referenced by k().

Function Documentation

void _tr_init ( s )

void bi_flush ( deflate_state * s ) [static]

unsigned bi_reverse | ( | unsigned | value,
 |  | int | length
 | ) | [static]

Referenced by tr_static_init().

void bi_windup ( deflate_state * s ) [static]

int build_bl_tree ( deflate_state * s ) [static]

Referenced by eof().

void build_tree | ( | deflate_state * | s,
 |  | tree_desc * | desc
 | ) | [static]

Referenced by eof().

void compress_block | ( | deflate_state * | s,
 |  | ct_data * | ltree,
 |  | ct_data * | dtree
 | ) | [static]

void copy_block | ( | deflate_state * | s,
 |  | charf * | buf,
 |  | unsigned | len,
 |  | int | header
 | ) | [static]

void gen_bitlen | ( | deflate_state * | s,
 |  | tree_desc * | desc
 | ) | [static]

void gen_codes | ( | ct_data * | tree,
 |  | int | max_code,
 |  | ushf * | bl_count
 | ) | [static]

Referenced by tr_static_init().

void init_block ( deflate_state * s ) [static]

void pqdownheap | ( | deflate_state * | s,
 |  | ct_data * | tree,
 |  | int | k
 | ) | [static]

void scan_tree | ( | deflate_state * | s,
 |  | ct_data * | tree,
 |  | int | max_code
 | ) | [static]

void send_all_trees | ( | deflate_state * | s,
 |  | int | lcodes,
 |  | int | dcodes,
 |  | int | blcodes
 | ) | [static]

void send_tree | ( | deflate_state * | s,
 |  | ct_data * | tree,
 |  | int | max_code
 | ) | [static]

void set_data_type ( deflate_state * s ) [static]

Referenced by eof().

void tr_static_init ( void ) [static]

Definition at line 233 of file trees.c.

00234 {
00235     static int static_init_done = 0;
00236     int n;        /* iterates over tree elements */
00237     int bits;     /* bit counter */
00238     int length;   /* length value */
00239     int code;     /* code value */
00240     int dist;     /* distance index */
00241     ush bl_count[MAX_BITS+1];
00242     /* number of codes at each bit length for an optimal tree */
00243
00244     if (static_init_done) return;
00245
00246     /* Initialize the mapping length (0..255) -> length code (0..28) */
00247     length = 0;
00248     for (code = 0; code < LENGTH_CODES-1; code++) {
00249         base_length[code] = length;
00250         for (n = 0; n < (1<<extra_lbits[code]); n++) {
00251             length_code[length++] = (uch)code;
00252         }
00253     }
00254     Assert (length == 256, "tr_static_init: length != 256");
00255     /* Note that the length 255 (match length 258) can be represented
00256      * in two different ways: code 284 + 5 bits or code 285, so we
00257      * overwrite length_code[255] to use the best encoding:
00258      */
00259     length_code[length-1] = (uch)code;
00260
00261     /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
00262     dist = 0;
00263     for (code = 0 ; code < 16; code++) {
00264         base_dist[code] = dist;
00265         for (n = 0; n < (1<<extra_dbits[code]); n++) {
00266             dist_code[dist++] = (uch)code;
00267         }
00268     }
00269     Assert (dist == 256, "tr_static_init: dist != 256");
00270     dist >>= 7; /* from now on, all distances are divided by 128 */
00271     for ( ; code < D_CODES; code++) {
00272         base_dist[code] = dist << 7;
00273         for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
00274             dist_code[256 + dist++] = (uch)code;
00275         }
00276     }
00277     Assert (dist == 256, "tr_static_init: 256+dist != 512");
00278
00279     /* Construct the codes of the static literal tree */
00280     for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
00281     n = 0;
00282     while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
00283     while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
00284     while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
00285     while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
00286     /* Codes 286 and 287 do not exist, but we must include them in the
00287      * tree construction to get a canonical Huffman tree (longest code
00288      * all ones)
00289      */
00290     gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
00291
00292     /* The static distance tree is trivial: */
00293     for (n = 0; n < D_CODES; n++) {
00294         static_dtree[n].Len = 5;
00295         static_dtree[n].Code = bi_reverse((unsigned)n, 5);
00296     }
00297     static_init_done = 1;
00298 }

Variable Documentation

int base_dist[ 30 ] [static]

Definition at line 107 of file trees.c.

int base_length[ 29 ] [static]

Definition at line 104 of file trees.c.

ushf* bl_count

Definition at line 502 of file trees.c.

uch bl_order[ 19 ] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15} [static]

Definition at line 69 of file trees.c.

int blcodes

Definition at line 761 of file trees.c.

charf* buf

Definition at line 1121 of file trees.c.

int dcodes

Definition at line 761 of file trees.c.

tree_desc * desc

Definition at line 543 of file trees.c.

Referenced by depth().

unsigned dist

Definition at line 952 of file trees.c.

uch dist_code[512] [static]

Definition at line 95 of file trees.c.

ct_data* dtree

Definition at line 1001 of file trees.c.

int eof

Definition at line 842 of file trees.c.

int extra_blbits[ 19 ] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7} [static]

Definition at line 66 of file trees.c.

int extra_dbits[ 30 ] = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13} [static]

Definition at line 63 of file trees.c.

int extra_lbits[ 29 ] = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0} [static]

Definition at line 60 of file trees.c.

int header

Definition at line 1123 of file trees.c.

int k

Definition at line 380 of file trees.c.

unsigned lc

Definition at line 953 of file trees.c.

int lcodes

Definition at line 761 of file trees.c.

unsigned len

Definition at line 1122 of file trees.c.

uch length_code[ 258 - 3 +1] [static]

Definition at line 101 of file trees.c.

ct_data* ltree

Definition at line 1000 of file trees.c.

int max_code

Definition at line 676 of file trees.c.

static_tree_desc static_bl_desc [static]

Initial value:

{(ct_data *)0, extra_blbits, 0,       19 ,  7 }

Definition at line 124 of file trees.c.

static_tree_desc static_d_desc [static]

Initial value:

{static_dtree, extra_dbits, 0,           30 ,  15 }

Definition at line 121 of file trees.c.

ct_data static_dtree[ 30 ] [static]

Definition at line 90 of file trees.c.

static_tree_desc static_l_desc [static]

Initial value:

{static_ltree, extra_lbits,  256 +1,  ( 256 +1+ 29 ) ,  15 }

Definition at line 118 of file trees.c.

ct_data static_ltree[ ( 256 +1+ 29 ) +2] [static]

Definition at line 83 of file trees.c.

ulg stored_len

Definition at line 841 of file trees.c.

ct_data * tree

Definition at line 675 of file trees.c.

Generated on Sun Oct 21 12:43:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


uncompr.c File Reference

cvs-1.10/zlib/uncompr.c File Reference

#include "zlib.h"

Include dependency graph for uncompr.c:

Include dependency graph

Go to the source code of this file.

Functions

int | uncompress (dest, destLen, source, sourceLen) Bytef *dest

Variables

uLongf * destLen
const Bytef * | source
uLong sourceLen

Function Documentation

int uncompress | ( | dest | ,
 |  | destLen | ,
 |  | source | ,
 |  | sourceLen |
 | ) |

Variable Documentation

uLongf* destLen

Definition at line 27 of file uncompr.c.

const Bytef* source

Definition at line 28 of file uncompr.c.

uLong sourceLen

Definition at line 29 of file uncompr.c.

Generated on Sun Oct 21 12:43:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


zconf.h File Reference

cvs-1.10/zlib/zconf.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | STDC
#define | MAX_MEM_LEVEL 9
#define | MAX_WBITS 15
#define | OF(args) args
#define | EXPORT
#define | STDC
#define | MAX_MEM_LEVEL 9
#define | MAX_WBITS 15
#define | OF(args) args
#define | EXPORT

Typedefs

typedef unsigned char | Byte
typedef unsigned int | uInt
typedef unsigned long | uLong
typedef Byte | Bytef
typedef char | charf
typedef int | intf
typedef uInt | uIntf
typedef uLong | uLongf
typedef void * | voidpf
typedef void * | voidp

Define Documentation

#define EXPORT

Definition at line 181 of file zconf.h.

#define EXPORT

Definition at line 181 of file zconf.h.

#define MAX_MEM_LEVEL 9

Definition at line 95 of file zconf.h.

#define MAX_MEM_LEVEL 9

Definition at line 95 of file zconf.h.

#define MAX_WBITS 15

Definition at line 101 of file zconf.h.

#define MAX_WBITS 15

Definition at line 101 of file zconf.h.

#define OF ( args ) args

Definition at line 121 of file zconf.h.

#define OF ( args ) args

Definition at line 121 of file zconf.h.

#define STDC

Definition at line 76 of file zconf.h.

#define STDC

Definition at line 76 of file zconf.h.

Typedef Documentation

typedef unsigned char Byte

Definition at line 152 of file zconf.h.

typedef Byte Bytef

Definition at line 160 of file zconf.h.

typedef char charf

Definition at line 162 of file zconf.h.

typedef int intf

Definition at line 163 of file zconf.h.

typedef unsigned int uInt

Definition at line 153 of file zconf.h.

typedef uInt uIntf

Definition at line 164 of file zconf.h.

typedef unsigned long uLong

Definition at line 154 of file zconf.h.

typedef uLong uLongf

Definition at line 165 of file zconf.h.

typedef void* voidp

Definition at line 169 of file zconf.h.

typedef void* voidpf

Definition at line 168 of file zconf.h.

Generated on Sun Oct 21 12:44:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


zlib.h File Reference

cvs-1.10/zlib/zlib.h File Reference

#include "zconf.h"

Include dependency graph for zlib.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | internal_state
struct | z_stream_s

Defines

#define | ZLIB_VERSION "1.0.4"
#define | Z_NO_FLUSH 0
#define | Z_PARTIAL_FLUSH 1
#define | Z_SYNC_FLUSH 2
#define | Z_FULL_FLUSH 3
#define | Z_FINISH 4
#define | Z_OK 0
#define | Z_STREAM_END 1
#define | Z_NEED_DICT 2
#define | Z_ERRNO (-1)
#define | Z_STREAM_ERROR (-2)
#define | Z_DATA_ERROR (-3)
#define | Z_MEM_ERROR (-4)
#define | Z_BUF_ERROR (-5)
#define | Z_VERSION_ERROR (-6)
#define | Z_NO_COMPRESSION 0
#define | Z_BEST_SPEED 1
#define | Z_BEST_COMPRESSION 9
#define | Z_DEFAULT_COMPRESSION (-1)
#define | Z_FILTERED 1
#define | Z_HUFFMAN_ONLY 2
#define | Z_DEFAULT_STRATEGY 0
#define | Z_BINARY 0
#define | Z_ASCII 1
#define | Z_UNKNOWN 2
#define | Z_DEFLATED 8
#define | Z_NULL 0
#define | zlib_version zlibVersion()
#define | deflateInit(strm, level) deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
#define | inflateInit(strm) inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
#define | deflateInit2(strm, level, method, windowBits, memLevel, strategy)
#define | inflateInit2(strm, windowBits) inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))

Typedefs

typedef unsigned char | Byte
typedef unsigned int | uInt
typedef unsigned long | uLong
typedef Byte | Bytef
typedef char | charf
typedef int | intf
typedef uInt | uIntf
typedef uLong | uLongf
typedef void * | voidpf
typedef void * | voidp
typedef voidpf(* | alloc_func )(voidpf opaque, uInt items, uInt size)
typedef void(* | free_func )(voidpf opaque, voidpf address)
typedef z_stream_s | z_stream
typedef z_stream * | z_streamp
typedef voidp | gzFile

Functions

const char * | zlibVersion (void)
int | deflate (z_streamp strm, int flush)
int | deflateEnd (z_streamp strm)
int | inflate (z_streamp strm, int flush)
int | inflateEnd (z_streamp strm)
int | deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength)
int | deflateCopy (z_streamp dest, z_streamp source)
int | deflateReset (z_streamp strm)
int | deflateParams (z_streamp strm, int level, int strategy)
int | inflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength)
int | inflateSync (z_streamp strm)
int | inflateReset (z_streamp strm)
int | compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
int | uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
gzFile | gzopen (const char *path, const char *mode)
gzFile | gzdopen (int fd, const char *mode)
int | gzread (gzFile file, voidp buf, unsigned len)
int | gzwrite (gzFile file, const voidp buf, unsigned len)
int | gzflush (gzFile file, int flush)
int | gzclose (gzFile file)
const char * | gzerror (gzFile file, int *errnum)
uLong | adler32 (uLong adler, const Bytef *buf, uInt len)
uLong | crc32 (uLong crc, const Bytef *buf, uInt len)
int | deflateInit_ (z_streamp strm, int level, const char *version, int stream_size)
int | inflateInit_ (z_streamp strm, const char *version, int stream_size)
int | deflateInit2_ (z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)
int | inflateInit2_ (z_streamp strm, int windowBits, const char *version, int stream_size)
uLongf * | get_crc_table (void)

Define Documentation

#define ZLIB_VERSION "1.0.4"

Definition at line 224 of file zlib.h.

#define Z_ASCII 1

Definition at line 341 of file zlib.h.

#define Z_BEST_COMPRESSION 9

Definition at line 331 of file zlib.h.

#define Z_BEST_SPEED 1

Definition at line 330 of file zlib.h.

#define Z_BINARY 0

Definition at line 340 of file zlib.h.

#define Z_BUF_ERROR (-5)

Definition at line 323 of file zlib.h.

#define Z_DATA_ERROR (-3)

Definition at line 321 of file zlib.h.

#define Z_DEFAULT_COMPRESSION (-1)

Definition at line 332 of file zlib.h.

#define Z_DEFAULT_STRATEGY 0

Definition at line 337 of file zlib.h.

#define Z_DEFLATED 8

Definition at line 345 of file zlib.h.

#define Z_ERRNO (-1)

Definition at line 319 of file zlib.h.

#define Z_FILTERED 1

Definition at line 335 of file zlib.h.

#define Z_FINISH 4

Definition at line 313 of file zlib.h.

#define Z_FULL_FLUSH 3

Definition at line 312 of file zlib.h.

#define Z_HUFFMAN_ONLY 2

Definition at line 336 of file zlib.h.

#define Z_MEM_ERROR (-4)

Definition at line 322 of file zlib.h.

#define Z_NEED_DICT 2

Definition at line 318 of file zlib.h.

#define Z_NO_COMPRESSION 0

Definition at line 329 of file zlib.h.

#define Z_NO_FLUSH 0

Definition at line 309 of file zlib.h.

#define Z_NULL 0

Definition at line 348 of file zlib.h.

#define Z_OK 0

Definition at line 316 of file zlib.h.

#define Z_PARTIAL_FLUSH 1

Definition at line 310 of file zlib.h.

#define Z_STREAM_END 1

Definition at line 317 of file zlib.h.

#define Z_STREAM_ERROR (-2)

Definition at line 320 of file zlib.h.

#define Z_SYNC_FLUSH 2

Definition at line 311 of file zlib.h.

#define Z_UNKNOWN 2

Definition at line 342 of file zlib.h.

#define Z_VERSION_ERROR (-6)

Definition at line 324 of file zlib.h.

#define deflateInit | ( | strm,
 |  | level | ) | deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))

Definition at line 944 of file zlib.h.

#define deflateInit2 | ( | strm,
 |  | level,
 |  | method,
 |  | windowBits,
 |  | memLevel,
 |  | strategy | )

Value:

deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
              (strategy),           ZLIB_VERSION, sizeof(z_stream))

Definition at line 948 of file zlib.h.

#define inflateInit ( strm ) inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))

Definition at line 946 of file zlib.h.

#define inflateInit2 | ( | strm,
 |  | windowBits | ) | inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))

Definition at line 951 of file zlib.h.

#define zlib_version zlibVersion()

Definition at line 350 of file zlib.h.

Typedef Documentation

typedef unsigned char Byte

Definition at line 189 of file zlib.h.

typedef Byte Bytef

Definition at line 197 of file zlib.h.

typedef voidpf(* alloc_func)(voidpf opaque, uInt items, uInt size)

Definition at line 250 of file zlib.h.

typedef char charf

Definition at line 199 of file zlib.h.

typedef void(* free_func)(voidpf opaque, voidpf address)

Definition at line 251 of file zlib.h.

typedef voidp gzFile

Definition at line 820 of file zlib.h.

typedef int intf

Definition at line 200 of file zlib.h.

typedef unsigned int uInt

Definition at line 190 of file zlib.h.

typedef uInt uIntf

Definition at line 201 of file zlib.h.

typedef unsigned long uLong

Definition at line 191 of file zlib.h.

typedef uLong uLongf

Definition at line 202 of file zlib.h.

typedef void* voidp

Definition at line 206 of file zlib.h.

typedef void* voidpf

Definition at line 205 of file zlib.h.

typedef struct z_stream_s z_stream

typedef z_stream* z_streamp

Definition at line 276 of file zlib.h.

Function Documentation

uLong adler32 | ( | uLong | adler,
 |  | const Bytef * | buf,
 |  | uInt | len
 | ) |

Referenced by size().

int compress | ( | Bytef * | dest,
 |  | uLongf * | destLen,
 |  | const Bytef * | source,
 |  | uLong | sourceLen
 | ) |

uLong crc32 | ( | uLong | crc,
 |  | const Bytef * | buf,
 |  | uInt | len
 | ) |

int deflate | ( | z_streamp | strm,
 |  | int | flush
 | ) |

Referenced by flush(), and len().

int deflateCopy | ( | z_streamp | dest,
 |  | z_streamp | source
 | ) |

int deflateEnd ( z_streamp strm )

int deflateInit2_ | ( | z_streamp | strm,
 |  | int | level,
 |  | int | method,
 |  | int | windowBits,
 |  | int | memLevel,
 |  | int | strategy,
 |  | const char * | version,
 |  | int | stream_size
 | ) |

int deflateInit_ | ( | z_streamp | strm,
 |  | int | level,
 |  | const char * | version,
 |  | int | stream_size
 | ) |

int deflateParams | ( | z_streamp | strm,
 |  | int | level,
 |  | int | strategy
 | ) |

int deflateReset ( z_streamp strm )

int deflateSetDictionary | ( | z_streamp | strm,
 |  | const Bytef * | dictionary,
 |  | uInt | dictLength
 | ) |

uLongf* get_crc_table ( void )

Definition at line 127 of file crc32.c.

00128 {
00129 #ifdef DYNAMIC_CRC_TABLE
00130   if (crc_table_empty) make_crc_table();
00131 #endif
00132   return (uLongf *)crc_table;
00133 }

int gzclose ( gzFile file )

gzFile gzdopen | ( | int | fd,
 |  | const char * | mode
 | ) |

const char* gzerror | ( | gzFile | file,
 |  | int * | errnum
 | ) |

Referenced by out().

int gzflush | ( | gzFile | file,
 |  | int | flush
 | ) |

gzFile gzopen | ( | const char * | path,
 |  | const char * | mode
 | ) |

int gzread | ( | gzFile | file,
 |  | voidp | buf,
 |  | unsigned | len
 | ) |

Referenced by out().

int gzwrite | ( | gzFile | file,
 |  | const voidp | buf,
 |  | unsigned | len
 | ) |

int inflate | ( | z_streamp | strm,
 |  | int | flush
 | ) |

int inflateEnd ( z_streamp strm )

int inflateInit2_ | ( | z_streamp | strm,
 |  | int | windowBits,
 |  | const char * | version,
 |  | int | stream_size
 | ) |

int inflateInit_ | ( | z_streamp | strm,
 |  | const char * | version,
 |  | int | stream_size
 | ) |

int inflateReset ( z_streamp strm )

int inflateSetDictionary | ( | z_streamp | strm,
 |  | const Bytef * | dictionary,
 |  | uInt | dictLength
 | ) |

int inflateSync ( z_streamp strm )

int uncompress | ( | Bytef * | dest,
 |  | uLongf * | destLen,
 |  | const Bytef * | source,
 |  | uLong | sourceLen
 | ) |

const char* zlibVersion ( void )

Definition at line 31 of file zutil.c.

00032 {
00033     return ZLIB_VERSION;
00034 }

Generated on Sun Oct 21 12:44:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


zutil.c File Reference

cvs-1.10/zlib/zutil.c File Reference

#include <stdio.h>
#include "zutil.h"

Include dependency graph for zutil.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | internal_state

Functions

const char * | zlibVersion ()
voidpf | zcalloc (opaque, items, size) voidpf opaque

Variables

const char * | z_errmsg [10]
unsigned | items
unsigned | size
voidpf ptr

Function Documentation

voidpf zcalloc | ( | opaque | ,
 |  | items | ,
 |  | size |
 | ) |

const char* zlibVersion ( void )

Definition at line 31 of file zutil.c.

00032 {
00033     return ZLIB_VERSION;
00034 }

Variable Documentation

unsigned items

Definition at line 196 of file zutil.c.

voidpf ptr

Definition at line 205 of file zutil.c.

unsigned size

Definition at line 197 of file zutil.c.

Referenced by CompatEndMoveToTrash(), CCJFlatTabCtrl::DrawTab(), CCJFlatTabCtrl::GetTabWidth(), CCustInvertTable::Initialize(), CGraphView::OnViewDelrev(), cvsgui_GetSelection(), ign_add(), ansiAttrCvt::AnsiSeq::paramc(), and CRcsFile::sort().

const char* z_errmsg[10]

Initial value:

 {
"need dictionary",
"stream end",
"",
"file error",
"stream error",
"data error",
"insufficient memory",
"buffer error",
"incompatible version",
""}

Definition at line 18 of file zutil.c.

Generated on Sun Oct 21 12:44:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


zutil.h File Reference

cvs-1.10/zlib/zutil.h File Reference

#include "zlib.h"
#include <string.h>
#include <stdlib.h>

Include dependency graph for zutil.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | local static
#define | ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
#define | ERR_RETURN(strm, err) return (strm->msg = (char*)ERR_MSG(err), (err))
#define | DEF_WBITS MAX_WBITS
#define | DEF_MEM_LEVEL 8
#define | STORED_BLOCK 0
#define | STATIC_TREES 1
#define | DYN_TREES 2
#define | MIN_MATCH 3
#define | MAX_MATCH 258
#define | PRESET_DICT 0x20
#define | OS_CODE 0x03
#define | FOPEN(name, mode) fopen((name), (mode))
#define | zstrerror(errnum) ""
#define | HAVE_MEMCPY
#define | zmemcpy memcpy
#define | zmemcmp memcmp
#define | zmemzero(dest, len) memset(dest, 0, len)
#define | Assert(cond, msg)
#define | Trace(x)
#define | Tracev(x)
#define | Tracevv(x)
#define | Tracec(c, x)
#define | Tracecv(c, x)
#define | ZALLOC(strm, items, size) (*((strm)->zalloc))((strm)->opaque, (items), (size))
#define | ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
#define | TRY_FREE(s, p) {if (p) ZFREE(s, p);}

Typedefs

typedef unsigned char | uch
typedef uch | uchf
typedef unsigned short | ush
typedef ush | ushf
typedef unsigned long | ulg
typedef uLong(* | check_func )(uLong check, const Bytef *buf, uInt len)

Functions

voidpf | zcalloc (voidpf opaque, unsigned items, unsigned size)
void | zcfree (voidpf opaque, voidpf ptr)

Variables

int | errno
const char * | z_errmsg [10]

Define Documentation

#define Assert | ( | cond,
 |  | msg | )

Definition at line 184 of file zutil.h.

Referenced by max_code(), r(), td(), and tr_static_init().

#define DEF_MEM_LEVEL 8

Definition at line 57 of file zutil.h.

#define DEF_WBITS MAX_WBITS

Definition at line 52 of file zutil.h.

#define DYN_TREES 2

Definition at line 65 of file zutil.h.

#define ERR_MSG ( err ) z_errmsg[Z_NEED_DICT-(err)]

Definition at line 43 of file zutil.h.

Referenced by errnum().

#define ERR_RETURN | ( | strm,
 |  | err | ) | return (strm->msg = (char*)ERR_MSG(err), (err))

Definition at line 45 of file zutil.h.

#define FOPEN | ( | name,
 |  | mode | ) | fopen((name), (mode))

Definition at line 130 of file zutil.h.

#define HAVE_MEMCPY

Definition at line 152 of file zutil.h.

#define MAX_MATCH 258

Definition at line 69 of file zutil.h.

#define MIN_MATCH 3

Definition at line 68 of file zutil.h.

#define OS_CODE 0x03

Definition at line 126 of file zutil.h.

#define PRESET_DICT 0x20

Definition at line 72 of file zutil.h.

#define STATIC_TREES 1

Definition at line 64 of file zutil.h.

#define STORED_BLOCK 0

Definition at line 63 of file zutil.h.

#define TRY_FREE | ( | s,
 |  | p | ) | {if (p) ZFREE(s, p);}

Definition at line 201 of file zutil.h.

#define Trace ( x )

Definition at line 185 of file zutil.h.

Referenced by f(), and r().

#define Tracec | ( | c,
 |  | x | )

Definition at line 188 of file zutil.h.

#define Tracecv | ( | c,
 |  | x | )

Definition at line 189 of file zutil.h.

Referenced by dtree().

#define Tracev ( x )

Definition at line 186 of file zutil.h.

Referenced by inflate_codes_state::dtree(), eof(), and r().

#define Tracevv ( x )

Definition at line 187 of file zutil.h.

Referenced by flush(), and r().

#define ZALLOC | ( | strm,
 |  | items,
 |  | size | ) | (*((strm)->zalloc))((strm)->opaque, (items), (size))

Definition at line 198 of file zutil.h.

Referenced by r().

#define ZFREE | ( | strm,
 |  | addr | ) | (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))

Definition at line 200 of file zutil.h.

Referenced by r(), and w().

#define local static

Definition at line 30 of file zutil.h.

#define zmemcmp memcmp

Definition at line 161 of file zutil.h.

#define zmemcpy memcpy

Definition at line 160 of file zutil.h.

Referenced by r().

#define zmemzero | ( | dest,
 |  | len | ) | memset(dest, 0, len)

Definition at line 162 of file zutil.h.

#define zstrerror ( errnum ) ""

Definition at line 139 of file zutil.h.

Typedef Documentation

typedef uLong(* check_func)(uLong check, const Bytef *buf, uInt len)

Definition at line 193 of file zutil.h.

typedef unsigned char uch

Definition at line 34 of file zutil.h.

typedef uch uchf

Definition at line 35 of file zutil.h.

typedef unsigned long ulg

Definition at line 38 of file zutil.h.

typedef unsigned short ush

Definition at line 36 of file zutil.h.

typedef ush ushf

Definition at line 37 of file zutil.h.

Function Documentation

voidpf zcalloc | ( | voidpf | opaque,
 |  | unsigned | items,
 |  | unsigned | size
 | ) |

void zcfree | ( | voidpf | opaque,
 |  | voidpf | ptr
 | ) |

Variable Documentation

int errno

Definition at line 22 of file zutil.h.

const char* z_errmsg[10]

Definition at line 40 of file zutil.h.

Generated on Sun Oct 21 12:44:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common.h File Reference

cvstree/common.h File Reference

#include "CvsLog.h"

Include dependency graph for common.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | YY_NEVER_INTERACTIVE 1

Enumerations

enum kTokens {
kNone, kString, kInt, kDate,
kRevnum, kRevnumOrNil, kAnyButSep
}

Functions

void | yyreset (void)
void | yylval_set (const char *str)
void | yylval_set (int i)
void | yylval_set (const CRevNumber &rev)
void | yyerror (const char *txt,...)
int | yylex (void)
void | yyrestart (FILE *)
int | yyparse (void)

Variables

kTokens expectToken
int | currentLineNumber
FILE * | yyin = (FILE *) 0
int | yy_flex_debug
std::vector< CRcsFile > gRcsFiles
CRcsFile * gRcsFile
CRevFile * gRevFile

Define Documentation

#define YY_NEVER_INTERACTIVE 1

Definition at line 58 of file common.h.

Enumeration Type Documentation

enum kTokens

Enumeration values:
kNone
kString
kInt
kDate
kRevnum
kRevnumOrNil
kAnyButSep

Definition at line 35 of file common.h.

00036 {
00037     kNone,
00038     kString,
00039     kInt,
00040     kDate,
00041     kRevnum,
00042     kRevnumOrNil,
00043     kAnyButSep
00044 } kTokens;

Function Documentation

void yyerror | ( | const char * | txt,
 |  | ... |
 | ) |

Definition at line 1494 of file parser.cc.

01495 {
01496     expect(kAnyButSep);
01497 }

int yylex ( void )

Definition at line 802 of file lexer.cc.

00803     {
00804     register yy_state_type yy_current_state;
00805     register char *yy_cp, *yy_bp;
00806     register int yy_act;
00807
00808 #line 58 "lexer.ll"
00809
00810
00811
00812     /* Switch into a new start state if the parser */
00813     /* just told us that we've read a field name */
00814     /* and should expect a field value (or IS) */
00815 #if qCvsDebug
00816     if (yy_flex_debug)
00817         fprintf(stderr,"LEX--> Start State %d\n", expectToken);
00818 #endif
00819
00820     switch(expectToken)
00821     {
00822     case kNone: BEGIN NODE; break;
00823     case kString: BEGIN ST_STRING; break;
00824     case kRevnum: BEGIN ST_REV; break;
00825     case kRevnumOrNil: BEGIN ST_REVORNIL; break;
00826     case kInt: BEGIN ST_INT; break;
00827     case kDate: BEGIN ST_DATE; break;
00828     case kAnyButSep: BEGIN ST_ANYBUTSEP; break;
00829     default: yyerror("ACK: Bad expectToken"); break;
00830     }
00831
00832
00833 #line 834 "lex.yy.c"
00834
00835     if ( yy_init )
00836         {
00837         yy_init = 0;
00838
00839 #ifdef YY_USER_INIT
00840         YY_USER_INIT;
00841 #endif
00842
00843         if ( ! yy_start )
00844             yy_start = 1;   /* first start state */
00845
00846         if ( ! yyin )
00847             yyin = stdin;
00848
00849         if ( ! yyout )
00850             yyout = stdout;
00851
00852         if ( ! yy_current_buffer )
00853             yy_current_buffer =
00854                 yy_create_buffer( yyin, YY_BUF_SIZE );
00855
00856         yy_load_buffer_state();
00857         }
00858
00859     while ( 1 )     /* loops until end-of-file is reached */
00860         {
00861         yy_cp = yy_c_buf_p;
00862
00863         /* Support of yytext. */
00864         *yy_cp = yy_hold_char;
00865
00866         /* yy_bp points to the position in yy_ch_buf of the start of
00867          * the current run.
00868          */
00869         yy_bp = yy_cp;
00870
00871         yy_current_state = yy_start;
00872 yy_match:
00873         do
00874             {
00875             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00876             if ( yy_accept[yy_current_state] )
00877                 {
00878                 yy_last_accepting_state = yy_current_state;
00879                 yy_last_accepting_cpos = yy_cp;
00880                 }
00881             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00882                 {
00883                 yy_current_state = (int) yy_def[yy_current_state];
00884                 if ( yy_current_state >= 377 )
00885                     yy_c = yy_meta[(unsigned int) yy_c];
00886                 }
00887             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00888             ++yy_cp;
00889             }
00890         while ( yy_base[yy_current_state] != 496 );
00891
00892 yy_find_action:
00893         yy_act = yy_accept[yy_current_state];
00894         if ( yy_act == 0 )
00895             { /* have to back up */
00896             yy_cp = yy_last_accepting_cpos;
00897             yy_current_state = yy_last_accepting_state;
00898             yy_act = yy_accept[yy_current_state];
00899             }
00900
00901         YY_DO_BEFORE_ACTION;
00902
00903
00904 do_action:  /* This label is used only to access EOF actions. */
00905
00906
00907         switch ( yy_act )
00908     { /* beginning of action switch */
00909             case 0: /* must back up */
00910             /* undo the effects of YY_DO_BEFORE_ACTION */
00911             *yy_cp = yy_hold_char;
00912             yy_cp = yy_last_accepting_cpos;
00913             yy_current_state = yy_last_accepting_state;
00914             goto yy_find_action;
00915
00916 case 1:
00917 YY_RULE_SETUP
00918 #line 82 "lexer.ll"
00919 { BEGIN NODE; }
00920     YY_BREAK
00921 case 2:
00922 YY_RULE_SETUP
00923 #line 84 "lexer.ll"
00924 { return ID_RCS; }
00925     YY_BREAK
00926 case 3:
00927 YY_RULE_SETUP
00928 #line 85 "lexer.ll"
00929 { return ID_WORKING; }
00930     YY_BREAK
00931 case 4:
00932 YY_RULE_SETUP
00933 #line 86 "lexer.ll"
00934 { return ID_HEAD; }
00935     YY_BREAK
00936 case 5:
00937 YY_RULE_SETUP
00938 #line 87 "lexer.ll"
00939 { return ID_BRANCH; }
00940     YY_BREAK
00941 case 6:
00942 YY_RULE_SETUP
00943 #line 88 "lexer.ll"
00944 { return ID_LOCKS; }
00945     YY_BREAK
00946 case 7:
00947 YY_RULE_SETUP
00948 #line 89 "lexer.ll"
00949 { return ID_ACCESS; }
00950     YY_BREAK
00951 case 8:
00952 YY_RULE_SETUP
00953 #line 90 "lexer.ll"
00954 { return ID_SYMBOLIC; }
00955     YY_BREAK
00956 case 9:
00957 YY_RULE_SETUP
00958 #line 91 "lexer.ll"
00959 { return ID_KEYWORD; }
00960     YY_BREAK
00961 case 10:
00962 YY_RULE_SETUP
00963 #line 92 "lexer.ll"
00964 { return ID_TOTREVISIONS; }
00965     YY_BREAK
00966 case 11:
00967 YY_RULE_SETUP
00968 #line 93 "lexer.ll"
00969 { return ID_SELREVISIONS; }
00970     YY_BREAK
00971 case 12:
00972 YY_RULE_SETUP
00973 #line 94 "lexer.ll"
00974 { return ID_DESCRIPTION; }
00975     YY_BREAK
00976 case 13:
00977 YY_RULE_SETUP
00978 #line 95 "lexer.ll"
00979 { return ID_REVISION; }
00980     YY_BREAK
00981 case 14:
00982 YY_RULE_SETUP
00983 #line 96 "lexer.ll"
00984 { return ID_DATE; }
00985     YY_BREAK
00986 case 15:
00987 YY_RULE_SETUP
00988 #line 97 "lexer.ll"
00989 { return ID_AUTHOR; }
00990     YY_BREAK
00991 case 16:
00992 YY_RULE_SETUP
00993 #line 98 "lexer.ll"
00994 { return ID_STATE; }
00995     YY_BREAK
00996 case 17:
00997 YY_RULE_SETUP
00998 #line 99 "lexer.ll"
00999 { return ID_BRANCHES; }
01000     YY_BREAK
01001 case 18:
01002 YY_RULE_SETUP
01003 #line 100 "lexer.ll"
01004 { return ID_STRICT; }
01005     YY_BREAK
01006 case 19:
01007 YY_RULE_SETUP
01008 #line 101 "lexer.ll"
01009 { return ID_LINES; }
01010     YY_BREAK
01011 case 20:
01012 YY_RULE_SETUP
01013 #line 102 "lexer.ll"
01014 { return ID_LOCKEDBY; }
01015     YY_BREAK
01016 case 21:
01017 YY_RULE_SETUP
01018 #line 104 "lexer.ll"
01019 { return ID_REVFOLLOW; }
01020     YY_BREAK
01021 case 22:
01022 YY_RULE_SETUP
01023 #line 105 "lexer.ll"
01024 { return ID_ENDFOLLOW; }
01025     YY_BREAK
01026 case 23:
01027 YY_RULE_SETUP
01028 #line 106 "lexer.ll"
01029 {
01030     yylval_set(yytext);
01031     return TAG;
01032 }
01033     YY_BREAK
01034 case 24:
01035 YY_RULE_SETUP
01036 #line 111 "lexer.ll"
01037 {
01038     BEGIN NODE;
01039     expectToken = kNone;
01040
01041     return ID_REVFOLLOW;
01042 }
01043     YY_BREAK
01044 case 25:
01045 YY_RULE_SETUP
01046 #line 118 "lexer.ll"
01047 {
01048     BEGIN NODE;
01049     expectToken = kNone;
01050     return ID_ENDFOLLOW;
01051 }
01052     YY_BREAK
01053 case 26:
01054 YY_RULE_SETUP
01055 #line 124 "lexer.ll"
01056 {
01057     ++currentLineNumber;
01058 #if qCvsDebug
01059     if (yy_flex_debug)
01060         fprintf(stderr,"LINESEP--> %d\n", currentLineNumber);
01061 #endif
01062
01063     yylval_set((int)(unsigned char)yytext[0]);
01064     return ID_CHAR;
01065 }
01066     YY_BREAK
01067 case 27:
01068 YY_RULE_SETUP
01069 #line 135 "lexer.ll"
01070 {
01071     yylval_set((int)(unsigned char)yytext[0]);
01072     return ID_CHAR;
01073 }
01074     YY_BREAK
01075 case 28:
01076 YY_RULE_SETUP
01077 #line 140 "lexer.ll"
01078 {
01079     yylval_set(yytext);
01080     BEGIN NODE;
01081     expectToken = kNone;
01082
01083     return STRING;
01084 }
01085     YY_BREAK
01086 case 29:
01087 YY_RULE_SETUP
01088 #line 148 "lexer.ll"
01089 {
01090     int v;
01091     revnumber.reset();
01092     if(sscanf(yytext, "%d", &v) == 1)
01093         revnumber += v;
01094     else
01095         yyerror("%s not an integer value", yytext);
01096     BEGIN ST_INREV;
01097     expectToken = kNone;
01098 }
01099     YY_BREAK
01100 case 30:
01101 YY_RULE_SETUP
01102 #line 159 "lexer.ll"
01103 {
01104     int v;
01105     revnumber.reset();
01106     if(sscanf(yytext, "%d", &v) == 1)
01107         revnumber += v;
01108     else
01109         yyerror("%s not an integer value", yytext);
01110     BEGIN ST_INREV;
01111     expectToken = kNone;
01112 }
01113     YY_BREAK
01114 case 31:
01115 YY_RULE_SETUP
01116 #line 170 "lexer.ll"
01117 {
01118     yyless(0); /* put back the spaces */
01119     BEGIN NODE;
01120     expectToken = kNone;
01121
01122     return REVNUM;
01123 }
01124     YY_BREAK
01125 case 32:
01126 YY_RULE_SETUP
01127 #line 178 "lexer.ll"
01128 {
01129     int v;
01130     if(sscanf(yytext + 1, "%d", &v) == 1)
01131         revnumber += v;
01132     else
01133         yyerror("%s not an integer value", yytext);
01134     BEGIN ST_INREV;
01135     expectToken = kNone;
01136 }
01137     YY_BREAK
01138 case 33:
01139 YY_RULE_SETUP
01140 #line 188 "lexer.ll"
01141 {
01142     yyless(0); /* put back the spaces */
01143     BEGIN NODE;
01144     expectToken = kNone;
01145     yylval_set(revnumber);
01146
01147     return REVNUM;
01148 }
01149     YY_BREAK
01150 case 34:
01151 YY_RULE_SETUP
01152 #line 197 "lexer.ll"
01153 {
01154     int v;
01155     if(sscanf(yytext, "%d", &v) == 1)
01156         revnumber += v;
01157     else
01158         yyerror("%s not an integer value", yytext);
01159     BEGIN NODE;
01160     expectToken = kNone;
01161     yylval_set(v);
01162
01163     return INTEGER;
01164 }
01165     YY_BREAK
01166 case 35:
01167 YY_RULE_SETUP
01168 #line 210 "lexer.ll"
01169 {
01170     int v;
01171     if(sscanf(yytext, "%d", &v) == 1)
01172         revnumber += v;
01173     else
01174         yyerror("%s not an integer value", yytext);
01175     yylval_set(v);
01176
01177     return INTEGER;
01178 }
01179     YY_BREAK
01180 case 36:
01181 YY_RULE_SETUP
01182 #line 221 "lexer.ll"
01183 {
01184     return yytext[0];
01185 }
01186     YY_BREAK
01187 /* Whitespace and catch-all rules apply to all start states: */
01188 case 37:
01189 YY_RULE_SETUP
01190 #line 226 "lexer.ll"
01191 ;
01192     YY_BREAK
01193 /* This is also whitespace, but we'll keep track of line number */
01194 /* to report in errors: */
01195 case 38:
01196 YY_RULE_SETUP
01197 #line 230 "lexer.ll"
01198 {
01199                                 ++currentLineNumber;
01200 #if qCvsDebug
01201                                 if (yy_flex_debug)
01202                                     fprintf(stderr,"LINE--> %d\n", currentLineNumber);
01203 #endif
01204                                 if(expectToken == kAnyButSep)
01205                                 {
01206                                     // strange bug, flex is sometimes getting here in
01207                                     // a kAnyButSep mode, while it should not
01208                                     yylval_set(yytext);
01209                                       return STRING;
01210                                 }
01211                             }
01212     YY_BREAK
01213 /* This catch-all rule catches anything not covered by any of */
01214 /* the above: */
01215 case 39:
01216 YY_RULE_SETUP
01217 #line 247 "lexer.ll"
01218 {
01219     yylval_set((int)(unsigned char)yytext[0]);
01220     return (int)(unsigned char)yytext[0];
01221 }
01222     YY_BREAK
01223 case 40:
01224 YY_RULE_SETUP
01225 #line 251 "lexer.ll"
01226 ECHO;
01227     YY_BREAK
01228 #line 1229 "lex.yy.c"
01229 case YY_STATE_EOF(INITIAL):
01230 case YY_STATE_EOF(NODE):
01231 case YY_STATE_EOF(ST_STRING):
01232 case YY_STATE_EOF(ST_TAG):
01233 case YY_STATE_EOF(ST_REV):
01234 case YY_STATE_EOF(ST_REVORNIL):
01235 case YY_STATE_EOF(ST_INREV):
01236 case YY_STATE_EOF(ST_INT):
01237 case YY_STATE_EOF(ST_ANYBUTSEP):
01238 case YY_STATE_EOF(ST_DATE):
01239     yyterminate();
01240
01241     case YY_END_OF_BUFFER:
01242         {
01243         /* Amount of text matched not including the EOB char. */
01244         int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
01245
01246         /* Undo the effects of YY_DO_BEFORE_ACTION. */
01247         *yy_cp = yy_hold_char;
01248         YY_RESTORE_YY_MORE_OFFSET
01249
01250         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
01251             {
01252             /* We're scanning a new file or input source.  It's
01253              * possible that this happened because the user
01254              * just pointed yyin at a new source and called
01255              * yylex().  If so, then we have to assure
01256              * consistency between yy_current_buffer and our
01257              * globals.  Here is the right place to do so, because
01258              * this is the first action (other than possibly a
01259              * back-up) that will match for the new input source.
01260              */
01261             yy_n_chars = yy_current_buffer->yy_n_chars;
01262             yy_current_buffer->yy_input_file = yyin;
01263             yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
01264             }
01265
01266         /* Note that here we test for yy_c_buf_p "<=" to the position
01267          * of the first EOB in the buffer, since yy_c_buf_p will
01268          * already have been incremented past the NUL character
01269          * (since all states make transitions on EOB to the
01270          * end-of-buffer state).  Contrast this with the test
01271          * in input().
01272          */
01273         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
01274             { /* This was really a NUL. */
01275             yy_state_type yy_next_state;
01276
01277             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
01278
01279             yy_current_state = yy_get_previous_state();
01280
01281             /* Okay, we're now positioned to make the NUL
01282              * transition.  We couldn't have
01283              * yy_get_previous_state() go ahead and do it
01284              * for us because it doesn't know how to deal
01285              * with the possibility of jamming (and we don't
01286              * want to build jamming into it because then it
01287              * will run more slowly).
01288              */
01289
01290             yy_next_state = yy_try_NUL_trans( yy_current_state );
01291
01292             yy_bp = yytext_ptr + YY_MORE_ADJ;
01293
01294             if ( yy_next_state )
01295                 {
01296                 /* Consume the NUL. */
01297                 yy_cp = ++yy_c_buf_p;
01298                 yy_current_state = yy_next_state;
01299                 goto yy_match;
01300                 }
01301
01302             else
01303                 {
01304                 yy_cp = yy_c_buf_p;
01305                 goto yy_find_action;
01306                 }
01307             }
01308
01309         else switch ( yy_get_next_buffer() )
01310             {
01311             case EOB_ACT_END_OF_FILE:
01312                 {
01313                 yy_did_buffer_switch_on_eof = 0;
01314
01315                 if ( yywrap() )
01316                     {
01317                     /* Note: because we've taken care in
01318                      * yy_get_next_buffer() to have set up
01319                      * yytext, we can now set up
01320                      * yy_c_buf_p so that if some total
01321                      * hoser (like flex itself) wants to
01322                      * call the scanner after we return the
01323                      * YY_NULL, it'll still work - another
01324                      * YY_NULL will get returned.
01325                      */
01326                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
01327
01328                     yy_act = YY_STATE_EOF(YY_START);
01329                     goto do_action;
01330                     }
01331
01332                 else
01333                     {
01334                     if ( ! yy_did_buffer_switch_on_eof )
01335                         YY_NEW_FILE;
01336                     }
01337                 break;
01338                 }
01339
01340             case EOB_ACT_CONTINUE_SCAN:
01341                 yy_c_buf_p =
01342                     yytext_ptr + yy_amount_of_matched_text;
01343
01344                 yy_current_state = yy_get_previous_state();
01345
01346                 yy_cp = yy_c_buf_p;
01347                 yy_bp = yytext_ptr + YY_MORE_ADJ;
01348                 goto yy_match;
01349
01350             case EOB_ACT_LAST_MATCH:
01351                 yy_c_buf_p =
01352                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
01353
01354                 yy_current_state = yy_get_previous_state();
01355
01356                 yy_cp = yy_c_buf_p;
01357                 yy_bp = yytext_ptr + YY_MORE_ADJ;
01358                 goto yy_find_action;
01359             }
01360         break;
01361         }
01362
01363     default:
01364         YY_FATAL_ERROR(
01365             "fatal flex scanner internal error--no action found" );
01366     } /* end of action switch */
01367         } /* end of scanning one token */
01368     } /* end of yylex */

void yylval_set ( const CRevNumber & rev )

Definition at line 1514 of file parser.cc.

01515 {
01516     sRev = rev;
01517 }

void yylval_set ( int anint )

Definition at line 1509 of file parser.cc.

01510 {
01511     yylval.aint = anint;
01512 }

void yylval_set ( const char * txt )

Definition at line 1504 of file parser.cc.

01505 {
01506     yylval.string = strdup(txt);
01507 }

int yyparse ( void )

Definition at line 566 of file parser.cc.

00568 {
00569   register int yystate;
00570   register int yyn;
00571   register short *yyssp;
00572   register YYSTYPE *yyvsp;
00573   int yyerrstatus;  /*  number of tokens to shift before error messages enabled */
00574   int yychar1 = 0;      /*  lookahead token as an internal (translated) token number */
00575
00576   short yyssa[YYINITDEPTH]; /*  the state stack         */
00577   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack        */
00578
00579   short *yyss = yyssa;      /*  refer to the stacks thru separate pointers */
00580   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
00581
00582 #ifdef YYLSP_NEEDED
00583   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack          */
00584   YYLTYPE *yyls = yylsa;
00585   YYLTYPE *yylsp;
00586
00587 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
00588 #else
00589 #define YYPOPSTACK   (yyvsp--, yyssp--)
00590 #endif
00591
00592   int yystacksize = YYINITDEPTH;
00593   int yyfree_stacks = 0;
00594
00595 #ifdef YYPURE
00596   int yychar;
00597   YYSTYPE yylval;
00598   int yynerrs;
00599 #ifdef YYLSP_NEEDED
00600   YYLTYPE yylloc;
00601 #endif
00602 #endif
00603
00604   YYSTYPE yyval;        /*  the variable used to return     */
00605                 /*  semantic values from the action */
00606                 /*  routines                */
00607
00608   int yylen;
00609
00610 #if YYDEBUG != 0
00611   if (yydebug)
00612     fprintf(stderr, "Starting parse\n");
00613 #endif
00614
00615   yystate = 0;
00616   yyerrstatus = 0;
00617   yynerrs = 0;
00618   yychar = YYEMPTY;     /* Cause a token to be read.  */
00619
00620   /* Initialize stack pointers.
00621      Waste one element of value and location stack
00622      so that they stay on the same level as the state stack.
00623      The wasted elements are never initialized.  */
00624
00625   yyssp = yyss - 1;
00626   yyvsp = yyvs;
00627 #ifdef YYLSP_NEEDED
00628   yylsp = yyls;
00629 #endif
00630
00631 /* Push a new state, which is found in  yystate  .  */
00632 /* In all cases, when you get here, the value and location stacks
00633    have just been pushed. so pushing a state here evens the stacks.  */
00634 yynewstate:
00635
00636   *++yyssp = yystate;
00637
00638   if (yyssp >= yyss + yystacksize - 1)
00639     {
00640       /* Give user a chance to reallocate the stack */
00641       /* Use copies of these so that the &'s don't force the real ones into memory. */
00642       YYSTYPE *yyvs1 = yyvs;
00643       short *yyss1 = yyss;
00644 #ifdef YYLSP_NEEDED
00645       YYLTYPE *yyls1 = yyls;
00646 #endif
00647
00648       /* Get the current used size of the three stacks, in elements.  */
00649       int size = yyssp - yyss + 1;
00650
00651 #ifdef yyoverflow
00652       /* Each stack pointer address is followed by the size of
00653      the data in use in that stack, in bytes.  */
00654 #ifdef YYLSP_NEEDED
00655       /* This used to be a conditional around just the two extra args,
00656      but that might be undefined if yyoverflow is a macro.  */
00657       yyoverflow("parser stack overflow",
00658          &yyss1, size * sizeof (*yyssp),
00659          &yyvs1, size * sizeof (*yyvsp),
00660          &yyls1, size * sizeof (*yylsp),
00661          &yystacksize);
00662 #else
00663       yyoverflow("parser stack overflow",
00664          &yyss1, size * sizeof (*yyssp),
00665          &yyvs1, size * sizeof (*yyvsp),
00666          &yystacksize);
00667 #endif
00668
00669       yyss = yyss1; yyvs = yyvs1;
00670 #ifdef YYLSP_NEEDED
00671       yyls = yyls1;
00672 #endif
00673 #else /* no yyoverflow */
00674       /* Extend the stack our own way.  */
00675       if (yystacksize >= YYMAXDEPTH)
00676     {
00677       yyerror("parser stack overflow");
00678       if (yyfree_stacks)
00679         {
00680           free (yyss);
00681           free (yyvs);
00682 #ifdef YYLSP_NEEDED
00683           free (yyls);
00684 #endif
00685         }
00686       return 2;
00687     }
00688       yystacksize *= 2;
00689       if (yystacksize > YYMAXDEPTH)
00690     yystacksize = YYMAXDEPTH;
00691 #ifndef YYSTACK_USE_ALLOCA
00692       yyfree_stacks = 1;
00693 #endif
00694       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
00695       __yy_memcpy ((char *)yyss, (char *)yyss1,
00696            size * (unsigned int) sizeof (*yyssp));
00697       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
00698       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
00699            size * (unsigned int) sizeof (*yyvsp));
00700 #ifdef YYLSP_NEEDED
00701       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
00702       __yy_memcpy ((char *)yyls, (char *)yyls1,
00703            size * (unsigned int) sizeof (*yylsp));
00704 #endif
00705 #endif /* no yyoverflow */
00706
00707       yyssp = yyss + size - 1;
00708       yyvsp = yyvs + size - 1;
00709 #ifdef YYLSP_NEEDED
00710       yylsp = yyls + size - 1;
00711 #endif
00712
00713 #if YYDEBUG != 0
00714       if (yydebug)
00715     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
00716 #endif
00717
00718       if (yyssp >= yyss + yystacksize - 1)
00719     YYABORT;
00720     }
00721
00722 #if YYDEBUG != 0
00723   if (yydebug)
00724     fprintf(stderr, "Entering state %d\n", yystate);
00725 #endif
00726
00727   goto yybackup;
00728  yybackup:
00729
00730 /* Do appropriate processing given the current state.  */
00731 /* Read a lookahead token if we need one and don't already have one.  */
00732 /* yyresume: */
00733
00734   /* First try to decide what to do without reference to lookahead token.  */
00735
00736   yyn = yypact[yystate];
00737   if (yyn == YYFLAG)
00738     goto yydefault;
00739
00740   /* Not known => get a lookahead token if don't already have one.  */
00741
00742   /* yychar is either YYEMPTY or YYEOF
00743      or a valid token in external form.  */
00744
00745   if (yychar == YYEMPTY)
00746     {
00747 #if YYDEBUG != 0
00748       if (yydebug)
00749     fprintf(stderr, "Reading a token: ");
00750 #endif
00751       yychar = YYLEX;
00752     }
00753
00754   /* Convert token to internal form (in yychar1) for indexing tables with */
00755
00756   if (yychar <= 0)      /* This means end of input. */
00757     {
00758       yychar1 = 0;
00759       yychar = YYEOF;       /* Don't call YYLEX any more */
00760
00761 #if YYDEBUG != 0
00762       if (yydebug)
00763     fprintf(stderr, "Now at end of input.\n");
00764 #endif
00765     }
00766   else
00767     {
00768       yychar1 = YYTRANSLATE(yychar);
00769
00770 #if YYDEBUG != 0
00771       if (yydebug)
00772     {
00773       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
00774       /* Give the individual parser a way to print the precise meaning
00775          of a token, for further debugging info.  */
00776 #ifdef YYPRINT
00777       YYPRINT (stderr, yychar, yylval);
00778 #endif
00779       fprintf (stderr, ")\n");
00780     }
00781 #endif
00782     }
00783
00784   yyn += yychar1;
00785   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
00786     goto yydefault;
00787
00788   yyn = yytable[yyn];
00789
00790   /* yyn is what to do for this token type in this state.
00791      Negative => reduce, -yyn is rule number.
00792      Positive => shift, yyn is new state.
00793        New state is final state => don't bother to shift,
00794        just return success.
00795      0, or most negative number => error.  */
00796
00797   if (yyn < 0)
00798     {
00799       if (yyn == YYFLAG)
00800     goto yyerrlab;
00801       yyn = -yyn;
00802       goto yyreduce;
00803     }
00804   else if (yyn == 0)
00805     goto yyerrlab;
00806
00807   if (yyn == YYFINAL)
00808     YYACCEPT;
00809
00810   /* Shift the lookahead token.  */
00811
00812 #if YYDEBUG != 0
00813   if (yydebug)
00814     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
00815 #endif
00816
00817   /* Discard the token being shifted unless it is eof.  */
00818   if (yychar != YYEOF)
00819     yychar = YYEMPTY;
00820
00821   *++yyvsp = yylval;
00822 #ifdef YYLSP_NEEDED
00823   *++yylsp = yylloc;
00824 #endif
00825
00826   /* count tokens shifted since error; after three, turn off error status.  */
00827   if (yyerrstatus) yyerrstatus--;
00828
00829   yystate = yyn;
00830   goto yynewstate;
00831
00832 /* Do the default action for the current state.  */
00833 yydefault:
00834
00835   yyn = yydefact[yystate];
00836   if (yyn == 0)
00837     goto yyerrlab;
00838
00839 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
00840 yyreduce:
00841   yylen = yyr2[yyn];
00842   if (yylen > 0)
00843     yyval = yyvsp[1-yylen]; /* implement default value of the action */
00844
00845 #if YYDEBUG != 0
00846   if (yydebug)
00847     {
00848       int i;
00849
00850       fprintf (stderr, "Reducing via rule %d (line %d), ",
00851            yyn, yyrline[yyn]);
00852
00853       /* Print the symbols being reduced, and their result.  */
00854       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
00855     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
00856       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
00857     }
00858 #endif
00859
00860
00861   switch (yyn) {
00862
00863 case 5:
00864 #line 85 "parser.yy"
00865 {
00866                                         if(gRcsFile != 0L)
00867                                         {
00868                                             gRcsFile->AllRevs().push_back(CRevFile());
00869                                             gRevFile = &gRcsFile->LastRev();
00870                                         }
00871                                     ;
00872     break;}
00873 case 7:
00874 #line 93 "parser.yy"
00875 { gRcsFile = 0L; expect(kNone); ;
00876     break;}
00877 case 8:
00878 #line 94 "parser.yy"
00879 {
00880                                         int c = yyvsp[0].aint;
00881                                         yyclearin;
00882                                         expect(kAnyButSep);
00883                                         if(gRevFile != 0L)
00884                                             gRevFile->DescLog() << (char)c;
00885                                         else if(gRcsFile != 0L)
00886                                             gRcsFile->DescLog() << (char)c;
00887                                     ;
00888     break;}
00889 case 10:
00890 #line 104 "parser.yy"
00891 {
00892                                         expect(kAnyButSep);
00893                                         if(gRevFile != 0L)
00894                                             gRevFile->DescLog() << sStr;
00895                                         else if(gRcsFile != 0L)
00896                                             gRcsFile->DescLog() << sStr;
00897                                     ;
00898     break;}
00899 case 27:
00900 #line 138 "parser.yy"
00901 {
00902                             char c = yyvsp[0].aint;
00903                             if(gRevFile != 0L)
00904                                 gRevFile->DescLog() << c;
00905                             else if(gRcsFile != 0L)
00906                                 gRcsFile->DescLog() << c;
00907                         ;
00908     break;}
00909 case 28:
00910 #line 145 "parser.yy"
00911 {
00912                             if(gRevFile != 0L)
00913                                 gRevFile->DescLog() << yyvsp[0].string;
00914                             else if(gRcsFile != 0L)
00915                                 gRcsFile->DescLog() << yyvsp[0].string;
00916                             free(yyvsp[0].string);
00917                         ;
00918     break;}
00919 case 29:
00920 #line 155 "parser.yy"
00921 { expect(kAnyButSep); ;
00922     break;}
00923 case 34:
00924 #line 166 "parser.yy"
00925 {
00926                             char c = yyvsp[0].aint;
00927                             if(gRcsFile != 0L)
00928                                 gRcsFile->DescLog() << c;
00929                         ;
00930     break;}
00931 case 35:
00932 #line 171 "parser.yy"
00933 {
00934                             if(gRcsFile != 0L)
00935                                 gRcsFile->DescLog() << yyvsp[0].string;
00936                             free(yyvsp[0].string);
00937                         ;
00938     break;}
00939 case 38:
00940 #line 183 "parser.yy"
00941 { expect(kRevnum); ;
00942     break;}
00943 case 39:
00944 #line 184 "parser.yy"
00945 {
00946                                         if(gRevFile != 0L)
00947                                         {
00948                                             gRevFile->RevNum() = sRev;
00949                                         }
00950                                         sRev.reset();
00951                                     ;
00952     break;}
00953 case 40:
00954 #line 191 "parser.yy"
00955 { expect(kDate); ;
00956     break;}
00957 case 41:
00958 #line 192 "parser.yy"
00959 {
00960                                         if(gRevFile != 0L)
00961                                         {
00962                                             gRevFile->RevTime().tm_year = sInt - 1900;
00963                                         }
00964                                     ;
00965     break;}
00966 case 42:
00967 #line 198 "parser.yy"
00968 {
00969                                         if(gRevFile != 0L)
00970                                         {
00971                                             gRevFile->RevTime().tm_mon = sInt;
00972                                         }
00973                                     ;
00974     break;}
00975 case 43:
00976 #line 204 "parser.yy"
00977 {
00978                                         if(gRevFile != 0L)
00979                                         {
00980                                             gRevFile->RevTime().tm_mday = sInt;
00981                                         }
00982                                     ;
00983     break;}
00984 case 44:
00985 #line 210 "parser.yy"
00986 {
00987                                         if(gRevFile != 0L)
00988                                         {
00989                                             gRevFile->RevTime().tm_hour = sInt;
00990                                         }
00991                                     ;
00992     break;}
00993 case 45:
00994 #line 216 "parser.yy"
00995 {
00996                                         if(gRevFile != 0L)
00997                                         {
00998                                             gRevFile->RevTime().tm_min = sInt;
00999                                         }
01000                                     ;
01001     break;}
01002 case 46:
01003 #line 222 "parser.yy"
01004 {
01005                                         if(gRevFile != 0L)
01006                                         {
01007                                             gRevFile->RevTime().tm_sec = sInt;
01008                                         }
01009                                         expect(kNone);
01010                                     ;
01011     break;}
01012 case 48:
01013 #line 230 "parser.yy"
01014 { expect(kRevnum); ;
01015     break;}
01016 case 50:
01017 #line 233 "parser.yy"
01018 {
01019                                         if(gRevFile != 0L)
01020                                         {
01021                                             gRevFile->Author() = sStr;
01022                                         }
01023                                     ;
01024     break;}
01025 case 51:
01026 #line 240 "parser.yy"
01027 {
01028                                         if(gRevFile != 0L)
01029                                         {
01030                                             gRevFile->Locker() = sStr;
01031                                         }
01032                                     ;
01033     break;}
01034 case 52:
01035 #line 247 "parser.yy"
01036 {
01037                                         if(gRevFile != 0L)
01038                                         {
01039                                             gRevFile->State() = sStr;
01040                                         }
01041                                     ;
01042     break;}
01043 case 53:
01044 #line 253 "parser.yy"
01045 { expect(kInt); ;
01046     break;}
01047 case 54:
01048 #line 254 "parser.yy"
01049 {
01050                                         expect(kInt);
01051                                         if(gRevFile != 0L)
01052                                         {
01053                                             gRevFile->ChgPos() = sInt;
01054                                         }
01055                                     ;
01056     break;}
01057 case 55:
01058 #line 261 "parser.yy"
01059 {
01060                                         if(gRevFile != 0L)
01061                                         {
01062                                             gRevFile->ChgNeg() = sInt;
01063                                         }
01064                                     ;
01065     break;}
01066 case 59:
01067 #line 276 "parser.yy"
01068 {
01069                                     if(gRevFile != 0L)
01070                                     {
01071                                         gRevFile->BranchesList().push_back(sRev);
01072                                     }
01073
01074                                     sRev.reset();
01075                                     expect(kRevnum);
01076                                 ;
01077     break;}
01078 case 60:
01079 #line 288 "parser.yy"
01080 { sStr = yyvsp[0].string; free(yyvsp[0].string); ;
01081     break;}
01082 case 61:
01083 #line 292 "parser.yy"
01084 { sStr = yyvsp[0].string; free(yyvsp[0].string); ;
01085     break;}
01086 case 62:
01087 #line 296 "parser.yy"
01088 { sInt = yyvsp[0].aint; ;
01089     break;}
01090 case 63:
01091 #line 300 "parser.yy"
01092 { expect(kInt); ;
01093     break;}
01094 case 64:
01095 #line 301 "parser.yy"
01096 {
01097                                         if(gRcsFile != 0L)
01098                                         {
01099                                             gRcsFile->TotRevisions() = sInt;
01100                                         }
01101                                     ;
01102     break;}
01103 case 67:
01104 #line 312 "parser.yy"
01105 { expect(kInt); ;
01106     break;}
01107 case 68:
01108 #line 313 "parser.yy"
01109 {
01110                                         if(gRcsFile != 0L)
01111                                         {
01112                                             gRcsFile->SelRevisions() = sInt;
01113                                         }
01114                                     ;
01115     break;}
01116 case 69:
01117 #line 321 "parser.yy"
01118 { expect(kString); ;
01119     break;}
01120 case 70:
01121 #line 322 "parser.yy"
01122 {
01123                                     if(gRcsFile != 0L)
01124                                     {
01125                                         gRcsFile->KeywordSubst() = sStr;
01126                                     }
01127                                 ;
01128     break;}
01129 case 74:
01130 #line 340 "parser.yy"
01131 {
01132                                     expect(kRevnum);
01133                                     if(gRcsFile != 0L)
01134                                     {
01135                                         CRevNumber newRev;
01136                                         newRev.Tag() = sStr;
01137                                         gRcsFile->SymbolicList().push_back(newRev);
01138                                     }
01139                                 ;
01140     break;}
01141 case 75:
01142 #line 349 "parser.yy"
01143 {
01144                                     if(gRcsFile != 0L)
01145                                     {
01146                                         sRev.Tag() = gRcsFile->LastSymbName().Tag();
01147                                         gRcsFile->LastSymbName() = sRev;
01148                                     }
01149                                     sRev.reset();
01150                                 ;
01151     break;}
01152 case 79:
01153 #line 369 "parser.yy"
01154 {
01155                                     if(gRcsFile != 0L)
01156                                     {
01157                                         CLogStr newAccess;
01158                                         newAccess = sStr;
01159                                         gRcsFile->AccessList().push_back(newAccess);
01160                                     }
01161                                 ;
01162     break;}
01163 case 81:
01164 #line 378 "parser.yy"
01165 {
01166                                     if(gRcsFile != 0L)
01167                                     {
01168                                         CLogStr newAccess;
01169                                         newAccess = sStr;
01170                                         gRcsFile->AccessList().push_back(newAccess);
01171                                     }
01172                                 ;
01173     break;}
01174 case 82:
01175 #line 389 "parser.yy"
01176 {
01177                                             if(gRcsFile != 0L)
01178                                             {
01179                                                 gRcsFile->LockStrict() = false;
01180                                             }
01181                                         ;
01182     break;}
01183 case 84:
01184 #line 396 "parser.yy"
01185 {
01186                                             if(gRcsFile != 0L)
01187                                             {
01188                                                 gRcsFile->LockStrict() = true;
01189                                             }
01190                                         ;
01191     break;}
01192 case 88:
01193 #line 411 "parser.yy"
01194 {
01195                                     expect(kRevnum);
01196                                     if(gRcsFile != 0L)
01197                                     {
01198                                         CRevNumber newRev;
01199                                         newRev.Tag() = sStr;
01200                                         gRcsFile->LocksList().push_back(newRev);
01201                                     }
01202                                 ;
01203     break;}
01204 case 89:
01205 #line 420 "parser.yy"
01206 {
01207                                     if(gRcsFile != 0L)
01208                                     {
01209                                         sRev.Tag() = gRcsFile->LastLock().Tag();
01210                                         gRcsFile->LastLock() = sRev;
01211                                     }
01212                                     sRev.reset();
01213                                 ;
01214     break;}
01215 case 90:
01216 #line 431 "parser.yy"
01217 { expect(kRevnumOrNil); ;
01218     break;}
01219 case 91:
01220 #line 432 "parser.yy"
01221 {
01222                                 if(gRcsFile != 0L)
01223                                 {
01224                                     gRcsFile->BranchRev() = sRev;
01225                                 }
01226                                 sRev.reset();
01227                             ;
01228     break;}
01229 case 92:
01230 #line 442 "parser.yy"
01231 { expect(kRevnum); ;
01232     break;}
01233 case 93:
01234 #line 443 "parser.yy"
01235 {
01236                                 if(gRcsFile != 0L)
01237                                 {
01238                                     gRcsFile->HeadRev() = sRev;
01239                                 }
01240                                 sRev.reset();
01241                             ;
01242     break;}
01243 case 94:
01244 #line 453 "parser.yy"
01245 { expect(kString); ;
01246     break;}
01247 case 95:
01248 #line 454 "parser.yy"
01249 {
01250                                     if(gRcsFile != 0L)
01251                                     {
01252                                         gRcsFile->WorkingFile() = sStr;
01253                                     }
01254                                 ;
01255     break;}
01256 case 96:
01257 #line 463 "parser.yy"
01258 { expect(kString); ;
01259     break;}
01260 case 97:
01261 #line 464 "parser.yy"
01262 {
01263                                     // push a new rcs file
01264                                     gRcsFiles.push_back(CRcsFile());
01265                                     gRcsFile = &gRcsFiles[gRcsFiles.size() - 1];
01266                                     gRcsFile->RcsFile() = sStr;
01267                                 ;
01268     break;}
01269 }
01270    /* the action file gets copied in in place of this dollarsign */
01271 #line 542 "/usr/local/share/bison.simple"
01272
01273   yyvsp -= yylen;
01274   yyssp -= yylen;
01275 #ifdef YYLSP_NEEDED
01276   yylsp -= yylen;
01277 #endif
01278
01279 #if YYDEBUG != 0
01280   if (yydebug)
01281     {
01282       short *ssp1 = yyss - 1;
01283       fprintf (stderr, "state stack now");
01284       while (ssp1 != yyssp)
01285     fprintf (stderr, " %d", *++ssp1);
01286       fprintf (stderr, "\n");
01287     }
01288 #endif
01289
01290   *++yyvsp = yyval;
01291
01292 #ifdef YYLSP_NEEDED
01293   yylsp++;
01294   if (yylen == 0)
01295     {
01296       yylsp->first_line = yylloc.first_line;
01297       yylsp->first_column = yylloc.first_column;
01298       yylsp->last_line = (yylsp-1)->last_line;
01299       yylsp->last_column = (yylsp-1)->last_column;
01300       yylsp->text = 0;
01301     }
01302   else
01303     {
01304       yylsp->last_line = (yylsp+yylen-1)->last_line;
01305       yylsp->last_column = (yylsp+yylen-1)->last_column;
01306     }
01307 #endif
01308
01309   /* Now "shift" the result of the reduction.
01310      Determine what state that goes to,
01311      based on the state we popped back to
01312      and the rule number reduced by.  */
01313
01314   yyn = yyr1[yyn];
01315
01316   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
01317   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01318     yystate = yytable[yystate];
01319   else
01320     yystate = yydefgoto[yyn - YYNTBASE];
01321
01322   goto yynewstate;
01323
01324 yyerrlab:   /* here on detecting error */
01325
01326   if (! yyerrstatus)
01327     /* If not already recovering from an error, report this error.  */
01328     {
01329       ++yynerrs;
01330
01331 #ifdef YYERROR_VERBOSE
01332       yyn = yypact[yystate];
01333
01334       if (yyn > YYFLAG && yyn < YYLAST)
01335     {
01336       int size = 0;
01337       char *msg;
01338       int x, count;
01339
01340       count = 0;
01341       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
01342       for (x = (yyn < 0 ? -yyn : 0);
01343            x < (sizeof(yytname) / sizeof(char *)); x++)
01344         if (yycheck[x + yyn] == x)
01345           size += strlen(yytname[x]) + 15, count++;
01346       msg = (char *) malloc(size + 15);
01347       if (msg != 0)
01348         {
01349           strcpy(msg, "parse error");
01350
01351           if (count < 5)
01352         {
01353           count = 0;
01354           for (x = (yyn < 0 ? -yyn : 0);
01355                x < (sizeof(yytname) / sizeof(char *)); x++)
01356             if (yycheck[x + yyn] == x)
01357               {
01358             strcat(msg, count == 0 ? ", expecting `" : " or `");
01359             strcat(msg, yytname[x]);
01360             strcat(msg, "'");
01361             count++;
01362               }
01363         }
01364           yyerror(msg);
01365           free(msg);
01366         }
01367       else
01368         yyerror ("parse error; also virtual memory exceeded");
01369     }
01370       else
01371 #endif /* YYERROR_VERBOSE */
01372     yyerror("parse error");
01373     }
01374
01375   goto yyerrlab1;
01376 yyerrlab1:   /* here on error raised explicitly by an action */
01377
01378   if (yyerrstatus == 3)
01379     {
01380       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
01381
01382       /* return failure if at end of input */
01383       if (yychar == YYEOF)
01384     YYABORT;
01385
01386 #if YYDEBUG != 0
01387       if (yydebug)
01388     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
01389 #endif
01390
01391       yychar = YYEMPTY;
01392     }
01393
01394   /* Else will try to reuse lookahead token
01395      after shifting the error token.  */
01396
01397   yyerrstatus = 3;      /* Each real token shifted decrements this */
01398
01399   goto yyerrhandle;
01400
01401 yyerrdefault:  /* current state does not do anything special for the error token. */
01402
01403 #if 0
01404   /* This is wrong; only states that explicitly want error tokens
01405      should shift them.  */
01406   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
01407   if (yyn) goto yydefault;
01408 #endif
01409
01410 yyerrpop:   /* pop the current state because it cannot handle the error token */
01411
01412   if (yyssp == yyss) YYABORT;
01413   yyvsp--;
01414   yystate = *--yyssp;
01415 #ifdef YYLSP_NEEDED
01416   yylsp--;
01417 #endif
01418
01419 #if YYDEBUG != 0
01420   if (yydebug)
01421     {
01422       short *ssp1 = yyss - 1;
01423       fprintf (stderr, "Error: state stack now");
01424       while (ssp1 != yyssp)
01425     fprintf (stderr, " %d", *++ssp1);
01426       fprintf (stderr, "\n");
01427     }
01428 #endif
01429
01430 yyerrhandle:
01431
01432   yyn = yypact[yystate];
01433   if (yyn == YYFLAG)
01434     goto yyerrdefault;
01435
01436   yyn += YYTERROR;
01437   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
01438     goto yyerrdefault;
01439
01440   yyn = yytable[yyn];
01441   if (yyn < 0)
01442     {
01443       if (yyn == YYFLAG)
01444     goto yyerrpop;
01445       yyn = -yyn;
01446       goto yyreduce;
01447     }
01448   else if (yyn == 0)
01449     goto yyerrpop;
01450
01451   if (yyn == YYFINAL)
01452     YYACCEPT;
01453
01454 #if YYDEBUG != 0
01455   if (yydebug)
01456     fprintf(stderr, "Shifting error token, ");
01457 #endif
01458
01459   *++yyvsp = yylval;
01460 #ifdef YYLSP_NEEDED
01461   *++yylsp = yylloc;
01462 #endif
01463
01464   yystate = yyn;
01465   goto yynewstate;
01466
01467  yyacceptlab:
01468   /* YYACCEPT comes here.  */
01469   if (yyfree_stacks)
01470     {
01471       free (yyss);
01472       free (yyvs);
01473 #ifdef YYLSP_NEEDED
01474       free (yyls);
01475 #endif
01476     }
01477   return 0;
01478
01479  yyabortlab:
01480   /* YYABORT comes here.  */
01481   if (yyfree_stacks)
01482     {
01483       free (yyss);
01484       free (yyvs);
01485 #ifdef YYLSP_NEEDED
01486       free (yyls);
01487 #endif
01488     }
01489   return 1;
01490 }

void yyreset ( void )

Definition at line 1519 of file parser.cc.

Referenced by CvsLogParse(), CvsLogReset(), and main().

01520 {
01521     currentLineNumber = 1;
01522     sStr = "";
01523     sInt = 0;
01524     sRev.reset();
01525     gRcsFiles.erase(gRcsFiles.begin(), gRcsFiles.end());
01526     gRcsFile = 0L;
01527     gRevFile = 0L;
01528     expect(kNone);
01529 }

void yyrestart ( FILE * input_file )

Definition at line 1693 of file lexer.cc.

01698     {
01699     if ( ! yy_current_buffer )
01700         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
01701
01702     yy_init_buffer( yy_current_buffer, input_file );
01703     yy_load_buffer_state();
01704     }

Variable Documentation

int currentLineNumber

Definition at line 49 of file common.h.

kTokens expectToken

Definition at line 45 of file common.h.

CRcsFile* gRcsFile

Definition at line 69 of file common.h.

std::vector<CRcsFile> gRcsFiles

Definition at line 66 of file common.h.

CRevFile* gRevFile

Definition at line 70 of file common.h.

int yy_flex_debug

Definition at line 63 of file common.h.

FILE * yyin = (FILE *) 0

Definition at line 265 of file lexer.cc.

Generated on Sun Oct 21 12:44:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsLog.cpp File Reference

cvstree/CvsLog.cpp File Reference

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <new>
#include "CvsLog.h"
#include "common.h"

Include dependency graph for CvsLog.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | NEW new

Functions

int | sortRevs (const void *r1, const void *r2)
std::vector< CRcsFile > & | CvsLogParse (FILE *file)
void | CvsLogReset (void)
bool | insertSymbName (CLogNode *node, const CRevNumber &symb)
bool | insertBranchName (CLogNode *node, const CRevNumber &symb)
CLogNode * CvsLogGraph (CRcsFile &rcsfile)

Variables

std::vector< CRcsFile > gRcsFiles
CRcsFile * | gRcsFile = 0L
CRevFile * | gRevFile = 0L
int | yy_flex_debug

Define Documentation

#define NEW new

Definition at line 27 of file CvsLog.cpp.

Function Documentation

CLogNode* CvsLogGraph ( CRcsFile & rcsfile )

Definition at line 593 of file CvsLog.cpp.

00594 {
00595     // we sort the revisions in order to build the tree
00596     // using a stack-algorithm
00597     rcsfile.sort();
00598
00599     CLogNodeHeader * header = NEW CLogNodeHeader(rcsfile);
00600     CLogNodeRev * curNode = 0L;
00601
00602     // append the revisions to the tree
00603     std::vector<CRevFile>::const_iterator i;
00604     for(i = rcsfile.AllRevs().begin(); i != rcsfile.AllRevs().end(); ++i)
00605     {
00606         const CRevFile & rev = *i;
00607
00608         if(curNode == 0L)
00609         {
00610             CLogNodeRev *nrev = NEW CLogNodeRev(rev, header);
00611             header->Childs().push_back(nrev);
00612             curNode = nrev;
00613             continue;
00614         }
00615
00616         do
00617         {
00618             const CRevNumber & curRev = (**curNode).RevNum();
00619             const CRevNumber & thisRev = rev.RevNum();
00620
00621             if(thisRev.ischildof(curRev))
00622             {
00623                 CLogNodeRev *nrev = NEW CLogNodeRev(rev, curNode);
00624                 curNode->Childs().push_back(nrev);
00625                 curNode = nrev;
00626                 break;
00627             }
00628             else if(thisRev.issamebranch(curRev))
00629             {
00630                 CLogNodeRev *nrev = NEW CLogNodeRev(rev, curNode);
00631                 curNode->Next() = nrev;
00632                 curNode = nrev;
00633                 break;
00634             }
00635             if(curNode->Root() == header)
00636                 curNode = 0L;
00637             else
00638                 curNode = (CLogNodeRev *)curNode->Root();
00639         } while(curNode != 0L);
00640
00641         if(curNode == 0L)
00642         {
00643             CLogNodeRev *nrev = NEW CLogNodeRev(rev, header);
00644             header->Childs().push_back(nrev);
00645             curNode = nrev;
00646         }
00647     }
00648
00649     // append the tags
00650     std::vector<CRevNumber>::const_iterator s;
00651     for(s = rcsfile.SymbolicList().begin(); s != rcsfile.SymbolicList().end(); ++s)
00652     {
00653         insertSymbName(header, *s);
00654     }
00655
00656     // append the branch names
00657     for(s = rcsfile.SymbolicList().begin(); s != rcsfile.SymbolicList().end(); ++s)
00658     {
00659         insertBranchName(header, *s);
00660     }
00661
00662     return header;
00663 }

std::vector<CRcsFile>& CvsLogParse ( FILE * file )

Definition at line 472 of file CvsLog.cpp.

00473 {
00474 #if qCvsDebug
00475     yydebug = 0;
00476 #endif
00477     yy_flex_debug = 0;
00478     yyin = file;
00479     yyreset();
00480     yyrestart(yyin);
00481     yyparse();
00482
00483 #ifdef macintosh
00484     std::vector<void *>::iterator i;
00485     for(i = gMacAlloca.begin(); i != gMacAlloca.end(); i++)
00486     {
00487         if(*i != 0L)
00488             free(*i);
00489         *i = 0L;
00490     }
00491     gMacAlloca.erase(gMacAlloca.begin(), gMacAlloca.end());
00492 #endif /* macintosh */
00493
00494     return gRcsFiles;
00495 }

void CvsLogReset ( void )

Definition at line 497 of file CvsLog.cpp.

Referenced by CvsLogParse(), and cvsgui_GetHistoryAsXML().

00498 {
00499     yyreset();
00500 }

bool insertBranchName | ( | CLogNode * | node,
 |  | const CRevNumber & | symb
 | ) | [static]

Definition at line 553 of file CvsLog.cpp.

Referenced by CvsLogGraph().

00554 {
00555     std::vector<CLogNode *>::iterator i;
00556     for(i = node->Childs().begin(); i != node->Childs().end(); ++i)
00557     {
00558         CLogNode *subnode = *i;
00559         if(subnode->GetType() == kNodeRev)
00560         {
00561             CLogNodeRev & rev = *(CLogNodeRev *)subnode;
00562             if((*rev).RevNum().ispartof(symb))
00563             {
00564                 // insert the branch name as previous node of the
00565                 // first node of that branch
00566                 CLogNodeBranch *branch = NEW CLogNodeBranch(symb.Tag(), node);
00567                 branch->Next() = subnode;
00568                 *i = branch;
00569                 return true;
00570             }
00571         }
00572         if(insertBranchName(subnode, symb))
00573             return true;
00574     }
00575     if(node->Next() != 0L && insertBranchName(node->Next(), symb))
00576         return true;
00577
00578     // we didn't find to connect this branch because there is no
00579     // revision in this branch (empty branch) : so add it as a child of this node.
00580     if(node->GetType() == kNodeRev)
00581     {
00582         CLogNodeRev & rev = *(CLogNodeRev *)node;
00583         if(symb.issubbranchof((*rev).RevNum()))
00584         {
00585             CLogNodeBranch *branch = NEW CLogNodeBranch(symb.Tag(), node);
00586             node->Childs().push_back(branch);
00587         }
00588     }
00589
00590     return false;
00591 }

bool insertSymbName | ( | CLogNode * | node,
 |  | const CRevNumber & | symb
 | ) | [static]

Definition at line 527 of file CvsLog.cpp.

Referenced by CvsLogGraph().

00528 {
00529     if(node->GetType() == kNodeRev)
00530     {
00531         CLogNodeRev & rev = *(CLogNodeRev *)node;
00532         if((*rev).RevNum() == symb)
00533         {
00534             // insert the tag as achild of the node
00535             CLogNodeTag *tag = NEW CLogNodeTag(symb.Tag(), node);
00536             node->Childs().push_back(tag);
00537             return true;
00538         }
00539     }
00540
00541     std::vector<CLogNode *>::iterator i;
00542     for(i = node->Childs().begin(); i != node->Childs().end(); ++i)
00543     {
00544         if(insertSymbName(*i, symb))
00545             return true;
00546     }
00547     if(node->Next() != 0L && insertSymbName(node->Next(), symb))
00548         return true;
00549
00550     return false;
00551 }

int sortRevs | ( | const void * | r1,
 |  | const void * | r2
 | ) | [static]

Definition at line 386 of file CvsLog.cpp.

00387 {
00388     CRevNumber & rev1 = ((CRevFile *)r1)->RevNum();
00389     CRevNumber & rev2 = ((CRevFile *)r2)->RevNum();
00390     return rev1.cmp(rev2);
00391 }

Variable Documentation

CRcsFile* gRcsFile = 0L

Definition at line 31 of file CvsLog.cpp.

std::vector<CRcsFile> gRcsFiles

Definition at line 30 of file CvsLog.cpp.

CRevFile* gRevFile = 0L

Definition at line 32 of file CvsLog.cpp.

int yy_flex_debug

Definition at line 469 of file CvsLog.cpp.

Generated on Sun Oct 21 12:44:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsLog.h File Reference

cvstree/CvsLog.h File Reference

#include <vector>
#include <time.h>
#include <iostream.h>
#include <stdio.h>

Include dependency graph for CvsLog.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CLogNode
class | CLogNodeBranch
class | CLogNodeData
class | CLogNodeHeader
class | CLogNodeRev
class | CLogNodeTag
class | CLogStr
class | CRcsFile
class | CRevFile
class | CRevNumber

Defines

#define | OSTREAM ostream

Enumerations

enum | kLogNode { kNodeHeader, kNodeBranch, kNodeRev, kNodeTag }

Functions

std::vector< CRcsFile > & | CvsLogParse (FILE *file)
void | CvsLogReset (void)
CLogNode * CvsLogGraph (CRcsFile &rcsfile)

Define Documentation

#define OSTREAM ostream

Definition at line 37 of file CvsLog.h.

Enumeration Type Documentation

enum kLogNode

Enumeration values:
kNodeHeader
kNodeBranch
kNodeRev
kNodeTag

Definition at line 261 of file CvsLog.h.

00262 {
00263     kNodeHeader,
00264     kNodeBranch,
00265     kNodeRev,
00266     kNodeTag
00267 } kLogNode;

Function Documentation

CLogNode* CvsLogGraph ( CRcsFile & rcsfile )

Definition at line 593 of file CvsLog.cpp.

Referenced by CvsLogParse(), and cvsgui_GetHistoryAsXML().

00594 {
00595     // we sort the revisions in order to build the tree
00596     // using a stack-algorithm
00597     rcsfile.sort();
00598
00599     CLogNodeHeader * header = NEW CLogNodeHeader(rcsfile);
00600     CLogNodeRev * curNode = 0L;
00601
00602     // append the revisions to the tree
00603     std::vector<CRevFile>::const_iterator i;
00604     for(i = rcsfile.AllRevs().begin(); i != rcsfile.AllRevs().end(); ++i)
00605     {
00606         const CRevFile & rev = *i;
00607
00608         if(curNode == 0L)
00609         {
00610             CLogNodeRev *nrev = NEW CLogNodeRev(rev, header);
00611             header->Childs().push_back(nrev);
00612             curNode = nrev;
00613             continue;
00614         }
00615
00616         do
00617         {
00618             const CRevNumber & curRev = (**curNode).RevNum();
00619             const CRevNumber & thisRev = rev.RevNum();
00620
00621             if(thisRev.ischildof(curRev))
00622             {
00623                 CLogNodeRev *nrev = NEW CLogNodeRev(rev, curNode);
00624                 curNode->Childs().push_back(nrev);
00625                 curNode = nrev;
00626                 break;
00627             }
00628             else if(thisRev.issamebranch(curRev))
00629             {
00630                 CLogNodeRev *nrev = NEW CLogNodeRev(rev, curNode);
00631                 curNode->Next() = nrev;
00632                 curNode = nrev;
00633                 break;
00634             }
00635             if(curNode->Root() == header)
00636                 curNode = 0L;
00637             else
00638                 curNode = (CLogNodeRev *)curNode->Root();
00639         } while(curNode != 0L);
00640
00641         if(curNode == 0L)
00642         {
00643             CLogNodeRev *nrev = NEW CLogNodeRev(rev, header);
00644             header->Childs().push_back(nrev);
00645             curNode = nrev;
00646         }
00647     }
00648
00649     // append the tags
00650     std::vector<CRevNumber>::const_iterator s;
00651     for(s = rcsfile.SymbolicList().begin(); s != rcsfile.SymbolicList().end(); ++s)
00652     {
00653         insertSymbName(header, *s);
00654     }
00655
00656     // append the branch names
00657     for(s = rcsfile.SymbolicList().begin(); s != rcsfile.SymbolicList().end(); ++s)
00658     {
00659         insertBranchName(header, *s);
00660     }
00661
00662     return header;
00663 }

std::vector<CRcsFile>& CvsLogParse ( FILE * file )

Definition at line 472 of file CvsLog.cpp.

Referenced by CvsCmdLogFiles(), CvsCmdLogFolder(), CvsLogParse(), CGraphView::OnViewReload(), and cvsgui_GetHistoryAsXML().

00473 {
00474 #if qCvsDebug
00475     yydebug = 0;
00476 #endif
00477     yy_flex_debug = 0;
00478     yyin = file;
00479     yyreset();
00480     yyrestart(yyin);
00481     yyparse();
00482
00483 #ifdef macintosh
00484     std::vector<void *>::iterator i;
00485     for(i = gMacAlloca.begin(); i != gMacAlloca.end(); i++)
00486     {
00487         if(*i != 0L)
00488             free(*i);
00489         *i = 0L;
00490     }
00491     gMacAlloca.erase(gMacAlloca.begin(), gMacAlloca.end());
00492 #endif /* macintosh */
00493
00494     return gRcsFiles;
00495 }

void CvsLogReset ( void )

Definition at line 497 of file CvsLog.cpp.

00498 {
00499     yyreset();
00500 }

Generated on Sun Oct 21 12:44:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


lexer.cc File Reference

cvstree/lexer.cc File Reference

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "common.h"
#include "parser.h"

Include dependency graph for lexer.cc:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | yy_buffer_state

Defines

#define | FLEX_SCANNER
#define | YY_FLEX_MAJOR_VERSION 2
#define | YY_FLEX_MINOR_VERSION 5
#define | YY_USE_PROTOS
#define | YY_USE_CONST
#define | yyconst const
#define | YY_PROTO(proto) proto
#define | YY_NULL 0
#define | YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
#define | BEGIN yy_start = 1 + 2 *
#define | YY_START ((yy_start - 1) / 2)
#define | YYSTATE YY_START
#define | YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
#define | YY_NEW_FILE yyrestart( yyin )
#define | YY_END_OF_BUFFER_CHAR 0
#define | YY_BUF_SIZE 16384
#define | EOB_ACT_CONTINUE_SCAN 0
#define | EOB_ACT_END_OF_FILE 1
#define | EOB_ACT_LAST_MATCH 2
#define | yyless(n)
#define | unput(c) yyunput( c, yytext_ptr )
#define | YY_BUFFER_NEW 0
#define | YY_BUFFER_NORMAL 1
#define | YY_BUFFER_EOF_PENDING 2
#define | YY_CURRENT_BUFFER yy_current_buffer
#define | YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
#define | yy_new_buffer yy_create_buffer
#define | yy_set_interactive(is_interactive)
#define | yy_set_bol(at_bol)
#define | YY_AT_BOL() (yy_current_buffer->yy_at_bol)
#define | yytext_ptr yytext
#define | YY_DO_BEFORE_ACTION
#define | YY_NUM_RULES 40
#define | YY_END_OF_BUFFER 41
#define | REJECT reject_used_but_not_detected
#define | yymore() yymore_used_but_not_detected
#define | YY_MORE_ADJ 0
#define | YY_RESTORE_YY_MORE_OFFSET
#define | INITIAL 0
#define | NODE 1
#define | ST_STRING 2
#define | ST_TAG 3
#define | ST_REV 4
#define | ST_REVORNIL 5
#define | ST_INREV 6
#define | ST_INT 7
#define | ST_ANYBUTSEP 8
#define | ST_DATE 9
#define | YY_NO_PUSH_STATE 1
#define | YY_NO_POP_STATE 1
#define | YY_NO_TOP_STATE 1
#define | YY_READ_BUF_SIZE 8192
#define | ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#define | YY_INPUT(buf, result, max_size)
#define | yyterminate() return YY_NULL
#define | YY_START_STACK_INCR 25
#define | YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#define | YY_DECL int yylex YY_PROTO(( void ))
#define | YY_BREAK break;
#define | YY_RULE_SETUP YY_USER_ACTION
#define | YY_EXIT_FAILURE 2
#define | yyless(n)

Typedefs

typedef yy_buffer_state * | YY_BUFFER_STATE
typedef unsigned int | yy_size_t
typedef unsigned char | YY_CHAR
typedef int | yy_state_type

Functions

void | yyrestart (FILE *input_file)
void | yy_switch_to_buffer (YY_BUFFER_STATE new_buffer)
void | yy_load_buffer_state (void)
YY_BUFFER_STATE | yy_create_buffer (FILE *file, int size)
void | yy_delete_buffer (YY_BUFFER_STATE b)
void | yy_init_buffer (YY_BUFFER_STATE b, FILE *file)
void | yy_flush_buffer (YY_BUFFER_STATE b)
YY_BUFFER_STATE | yy_scan_buffer (char *base, yy_size_t size)
YY_BUFFER_STATE | yy_scan_string (const char *yy_str)
YY_BUFFER_STATE | yy_scan_bytes (const char *bytes, int len)
void * | yy_flex_alloc (yy_size_t)
void * | yy_flex_realloc (void *, yy_size_t)
void | yy_flex_free (void *)
yy_state_type | yy_get_previous_state (void)
yy_state_type | yy_try_NUL_trans (yy_state_type current_state)
int | yy_get_next_buffer (void)
void | yy_fatal_error (const char msg[])
int | yywrap ()
void | yyunput (int c, char *buf_ptr)
int | yyinput (void)
int | yylex (void)
void | yyunput (int c, register char *yy_bp)

Variables

int | yyleng
FILE * | yyin = (FILE *) 0
FILE * | yyout = (FILE *) 0
YY_BUFFER_STATE | yy_current_buffer = 0
char | yy_hold_char
int | yy_n_chars
char * | yy_c_buf_p = (char *) 0
int | yy_init = 1
int | yy_start = 0
int | yy_did_buffer_switch_on_eof
char * | yytext
const short int | yy_accept [377]
const int | yy_ec [256]
const int | yy_meta [39]
const short int | yy_base [384]
const short int | yy_def [384]
const short int | yy_nxt [535]
const short int | yy_chk [535]
yy_state_type yy_last_accepting_state
char * | yy_last_accepting_cpos
int | currentLineNumber = 1
kTokens | expectToken = kNone
CRevNumber revnumber

Define Documentation

#define BEGIN yy_start = 1 + 2 *

Definition at line 79 of file lexer.cc.

#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )

Definition at line 737 of file lexer.cc.

#define EOB_ACT_CONTINUE_SCAN 0

Definition at line 104 of file lexer.cc.

#define EOB_ACT_END_OF_FILE 1

Definition at line 105 of file lexer.cc.

#define EOB_ACT_LAST_MATCH 2

Definition at line 106 of file lexer.cc.

#define FLEX_SCANNER

Definition at line 7 of file lexer.cc.

#define INITIAL 0

Definition at line 602 of file lexer.cc.

#define NODE 1

Definition at line 635 of file lexer.cc.

#define REJECT reject_used_but_not_detected

Definition at line 596 of file lexer.cc.

#define ST_ANYBUTSEP 8

Definition at line 647 of file lexer.cc.

#define ST_DATE 9

Definition at line 648 of file lexer.cc.

#define ST_INREV 6

Definition at line 644 of file lexer.cc.

#define ST_INT 7

Definition at line 645 of file lexer.cc.

#define ST_REV 4

Definition at line 642 of file lexer.cc.

#define ST_REVORNIL 5

Definition at line 643 of file lexer.cc.

#define ST_STRING 2

Definition at line 640 of file lexer.cc.

#define ST_TAG 3

Definition at line 641 of file lexer.cc.

#define YYSTATE YY_START

Definition at line 86 of file lexer.cc.

#define YY_AT_BOL ( ) (yy_current_buffer->yy_at_bol)

Definition at line 262 of file lexer.cc.

#define YY_BREAK break;

Definition at line 796 of file lexer.cc.

#define YY_BUFFER_EOF_PENDING 2

Definition at line 198 of file lexer.cc.

#define YY_BUFFER_NEW 0

Definition at line 186 of file lexer.cc.

#define YY_BUFFER_NORMAL 1

Definition at line 187 of file lexer.cc.

#define YY_BUF_SIZE 16384

Definition at line 97 of file lexer.cc.

#define YY_CURRENT_BUFFER yy_current_buffer

Definition at line 207 of file lexer.cc.

#define YY_DECL int yylex YY_PROTO(( void ))

Definition at line 784 of file lexer.cc.

#define YY_DO_BEFORE_ACTION

Value:

yytext_ptr = yy_bp; \
    yyleng = (int) (yy_cp - yy_bp); \
    yy_hold_char = *yy_cp; \
    *yy_cp = '\0'; \
    yy_c_buf_p = yy_cp;

Definition at line 278 of file lexer.cc.

#define YY_END_OF_BUFFER 41

Definition at line 286 of file lexer.cc.

#define YY_END_OF_BUFFER_CHAR 0

Definition at line 94 of file lexer.cc.

#define YY_EXIT_FAILURE 2

Definition at line 2011 of file lexer.cc.

#define YY_FATAL_ERROR ( msg ) yy_fatal_error( msg )

Definition at line 777 of file lexer.cc.

Referenced by yy_get_next_buffer(), yylex(), and yyunput().

#define YY_FLEX_MAJOR_VERSION 2

Definition at line 8 of file lexer.cc.

#define YY_FLEX_MINOR_VERSION 5

Definition at line 9 of file lexer.cc.

#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )

Definition at line 236 of file lexer.cc.

#define YY_INPUT | ( | buf,
 |  | result,
 |  | max_size | )

Value:

if ( yy_current_buffer->yy_is_interactive ) \
        { \
        int c = '*', n; \
        for ( n = 0; n < max_size && \
                 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
            buf[n] = (char) c; \
        if ( c == '\n' ) \
            buf[n++] = (char) c; \
        if ( c == EOF && ferror( yyin ) ) \
            YY_FATAL_ERROR( "input in flex scanner failed" ); \
        result = n; \
        } \
    else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
          && ferror( yyin ) ) \
        YY_FATAL_ERROR( "input in flex scanner failed" );

Definition at line 744 of file lexer.cc.

Referenced by yy_get_next_buffer().

#define YY_MORE_ADJ 0

Definition at line 598 of file lexer.cc.

#define YY_NEW_FILE yyrestart( yyin )

Definition at line 92 of file lexer.cc.

#define YY_NO_POP_STATE 1

Definition at line 707 of file lexer.cc.

#define YY_NO_PUSH_STATE 1

Definition at line 706 of file lexer.cc.

#define YY_NO_TOP_STATE 1

Definition at line 708 of file lexer.cc.

#define YY_NULL 0

Definition at line 66 of file lexer.cc.

#define YY_NUM_RULES 40

Definition at line 285 of file lexer.cc.

#define YY_PROTO ( proto ) proto

Definition at line 60 of file lexer.cc.

#define YY_READ_BUF_SIZE 8192

Definition at line 728 of file lexer.cc.

#define YY_RESTORE_YY_MORE_OFFSET

Definition at line 599 of file lexer.cc.

#define YY_RULE_SETUP YY_USER_ACTION

Definition at line 799 of file lexer.cc.

#define YY_SC_TO_UI ( c ) ((unsigned int) (unsigned char) c)

Definition at line 73 of file lexer.cc.

Referenced by yy_get_previous_state(), and yylex().

#define YY_START ((yy_start - 1) / 2)

Definition at line 85 of file lexer.cc.

#define YY_START_STACK_INCR 25

Definition at line 772 of file lexer.cc.

#define YY_STATE_EOF ( state ) (YY_END_OF_BUFFER + state + 1)

Definition at line 89 of file lexer.cc.

Referenced by yylex().

#define YY_USE_CONST

Definition at line 31 of file lexer.cc.

#define YY_USE_PROTOS

Definition at line 28 of file lexer.cc.

#define unput ( c ) yyunput( c, yytext_ptr )

Definition at line 135 of file lexer.cc.

#define yy_new_buffer yy_create_buffer

Definition at line 246 of file lexer.cc.

#define yy_set_bol ( at_bol )

Value:

{ \
    if ( ! yy_current_buffer ) \
        yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
    yy_current_buffer->yy_at_bol = at_bol; \
    }

Definition at line 255 of file lexer.cc.

#define yy_set_interactive ( is_interactive )

Value:

{ \
    if ( ! yy_current_buffer ) \
        yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
    yy_current_buffer->yy_is_interactive = is_interactive; \
    }

Definition at line 248 of file lexer.cc.

#define yyconst const

Definition at line 53 of file lexer.cc.

#define yyless ( n )

Value:

do \
        { \
          \
        yytext[yyleng] = yy_hold_char; \
        yy_c_buf_p = yytext + n; \
        yy_hold_char = *yy_c_buf_p; \
        *yy_c_buf_p = '\0'; \
        yyleng = n; \
        } \
    while ( 0 )

Definition at line 2030 of file lexer.cc.

#define yyless ( n )

Value:

do \
        { \
          \
        *yy_cp = yy_hold_char; \
        YY_RESTORE_YY_MORE_OFFSET \
        yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
        YY_DO_BEFORE_ACTION;   \
        } \
    while ( 0 )

Definition at line 2030 of file lexer.cc.

Referenced by yylex().

#define yymore ( ) yymore_used_but_not_detected

Definition at line 597 of file lexer.cc.

#define yyterminate ( ) return YY_NULL

Definition at line 767 of file lexer.cc.

Referenced by yylex().

#define yytext_ptr yytext

Definition at line 268 of file lexer.cc.

Typedef Documentation

typedef struct yy_buffer_state* YY_BUFFER_STATE

Definition at line 99 of file lexer.cc.

typedef unsigned char YY_CHAR

Definition at line 264 of file lexer.cc.

typedef unsigned int yy_size_t

Definition at line 141 of file lexer.cc.

typedef int yy_state_type

Definition at line 266 of file lexer.cc.

Function Documentation

YY_BUFFER_STATE yy_create_buffer | ( | FILE * | file,
 |  | int | size
 | ) |

Definition at line 1751 of file lexer.cc.

Referenced by yylex().

01757     {
01758     YY_BUFFER_STATE b;
01759
01760     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
01761     if ( ! b )
01762         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01763
01764     b->yy_buf_size = size;
01765
01766     /* yy_ch_buf has to be 2 characters longer than the size given because
01767      * we need to put in 2 end-of-buffer characters.
01768      */
01769     b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
01770     if ( ! b->yy_ch_buf )
01771         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01772
01773     b->yy_is_our_buffer = 1;
01774
01775     yy_init_buffer( b, file );
01776
01777     return b;
01778     }

void yy_delete_buffer ( YY_BUFFER_STATE b )

Definition at line 1782 of file lexer.cc.

01787     {
01788     if ( ! b )
01789         return;
01790
01791     if ( b == yy_current_buffer )
01792         yy_current_buffer = (YY_BUFFER_STATE) 0;
01793
01794     if ( b->yy_is_our_buffer )
01795         yy_flex_free( (void *) b->yy_ch_buf );
01796
01797     yy_flex_free( (void *) b );
01798     }

void yy_fatal_error ( const char msg[] ) [static]

Definition at line 2015 of file lexer.cc.

02020     {
02021     (void) fprintf( stderr, "%s\n", msg );
02022     exit( YY_EXIT_FAILURE );
02023     }

void * yy_flex_alloc ( yy_size_t size ) [static]

Definition at line 2079 of file lexer.cc.

02084     {
02085     return (void *) malloc( size );
02086     }

void yy_flex_free ( void * ptr ) [static]

Definition at line 2107 of file lexer.cc.

02112     {
02113     free( ptr );
02114     }

void * yy_flex_realloc | ( | void * | ptr,
 |  | yy_size_t | size
 | ) | [static]

Definition at line 2089 of file lexer.cc.

Referenced by yy_get_next_buffer().

02095     {
02096     /* The cast to (char *) in the following accommodates both
02097      * implementations that use char* generic pointers, and those
02098      * that use void* generic pointers.  It works with the latter
02099      * because both ANSI C and C++ allow castless assignment from
02100      * any pointer type to void*, and deal with argument conversions
02101      * as though doing an assignment.
02102      */
02103     return (void *) realloc( (char *) ptr, size );
02104     }

void yy_flush_buffer ( YY_BUFFER_STATE b )

Definition at line 1835 of file lexer.cc.

01841     {
01842     if ( ! b )
01843         return;
01844
01845     b->yy_n_chars = 0;
01846
01847     /* We always need two end-of-buffer characters.  The first causes
01848      * a transition to the end-of-buffer state.  The second causes
01849      * a jam in that state.
01850      */
01851     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01852     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01853
01854     b->yy_buf_pos = &b->yy_ch_buf[0];
01855
01856     b->yy_at_bol = 1;
01857     b->yy_buffer_status = YY_BUFFER_NEW;
01858
01859     if ( b == yy_current_buffer )
01860         yy_load_buffer_state();
01861     }

int yy_get_next_buffer ( void ) [static]

Definition at line 1379 of file lexer.cc.

Referenced by yyinput(), and yylex().

01380     {
01381     register char *dest = yy_current_buffer->yy_ch_buf;
01382     register char *source = yytext_ptr;
01383     register int number_to_move, i;
01384     int ret_val;
01385
01386     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
01387         YY_FATAL_ERROR(
01388         "fatal flex scanner internal error--end of buffer missed" );
01389
01390     if ( yy_current_buffer->yy_fill_buffer == 0 )
01391         { /* Don't try to fill the buffer, so this is an EOF. */
01392         if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
01393             {
01394             /* We matched a single character, the EOB, so
01395              * treat this as a final EOF.
01396              */
01397             return EOB_ACT_END_OF_FILE;
01398             }
01399
01400         else
01401             {
01402             /* We matched some text prior to the EOB, first
01403              * process it.
01404              */
01405             return EOB_ACT_LAST_MATCH;
01406             }
01407         }
01408
01409     /* Try to read more data. */
01410
01411     /* First move last chars to start of buffer. */
01412     number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
01413
01414     for ( i = 0; i < number_to_move; ++i )
01415         *(dest++) = *(source++);
01416
01417     if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
01418         /* don't do the read, it's not guaranteed to return an EOF,
01419          * just force an EOF
01420          */
01421         yy_current_buffer->yy_n_chars = yy_n_chars = 0;
01422
01423     else
01424         {
01425         int num_to_read =
01426             yy_current_buffer->yy_buf_size - number_to_move - 1;
01427
01428         while ( num_to_read <= 0 )
01429             { /* Not enough room in the buffer - grow it. */
01430 #ifdef YY_USES_REJECT
01431             YY_FATAL_ERROR(
01432 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
01433 #else
01434
01435             /* just a shorter name for the current buffer */
01436             YY_BUFFER_STATE b = yy_current_buffer;
01437
01438             int yy_c_buf_p_offset =
01439                 (int) (yy_c_buf_p - b->yy_ch_buf);
01440
01441             if ( b->yy_is_our_buffer )
01442                 {
01443                 int new_size = b->yy_buf_size * 2;
01444
01445                 if ( new_size <= 0 )
01446                     b->yy_buf_size += b->yy_buf_size / 8;
01447                 else
01448                     b->yy_buf_size *= 2;
01449
01450                 b->yy_ch_buf = (char *)
01451                     /* Include room in for 2 EOB chars. */
01452                     yy_flex_realloc( (void *) b->yy_ch_buf,
01453                              b->yy_buf_size + 2 );
01454                 }
01455             else
01456                 /* Can't grow it, we don't own it. */
01457                 b->yy_ch_buf = 0;
01458
01459             if ( ! b->yy_ch_buf )
01460                 YY_FATAL_ERROR(
01461                 "fatal error - scanner input buffer overflow" );
01462
01463             yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
01464
01465             num_to_read = yy_current_buffer->yy_buf_size -
01466                         number_to_move - 1;
01467 #endif
01468             }
01469
01470         if ( num_to_read > YY_READ_BUF_SIZE )
01471             num_to_read = YY_READ_BUF_SIZE;
01472
01473         /* Read in more data. */
01474         YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
01475             yy_n_chars, num_to_read );
01476
01477         yy_current_buffer->yy_n_chars = yy_n_chars;
01478         }
01479
01480     if ( yy_n_chars == 0 )
01481         {
01482         if ( number_to_move == YY_MORE_ADJ )
01483             {
01484             ret_val = EOB_ACT_END_OF_FILE;
01485             yyrestart( yyin );
01486             }
01487
01488         else
01489             {
01490             ret_val = EOB_ACT_LAST_MATCH;
01491             yy_current_buffer->yy_buffer_status =
01492                 YY_BUFFER_EOF_PENDING;
01493             }
01494         }
01495
01496     else
01497         ret_val = EOB_ACT_CONTINUE_SCAN;
01498
01499     yy_n_chars += number_to_move;
01500     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
01501     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
01502
01503     yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
01504
01505     return ret_val;
01506     }

yy_state_type yy_get_previous_state ( void ) [static]

Definition at line 1511 of file lexer.cc.

Referenced by yylex().

01512     {
01513     register yy_state_type yy_current_state;
01514     register char *yy_cp;
01515
01516     yy_current_state = yy_start;
01517
01518     for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
01519         {
01520         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01521         if ( yy_accept[yy_current_state] )
01522             {
01523             yy_last_accepting_state = yy_current_state;
01524             yy_last_accepting_cpos = yy_cp;
01525             }
01526         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01527             {
01528             yy_current_state = (int) yy_def[yy_current_state];
01529             if ( yy_current_state >= 377 )
01530                 yy_c = yy_meta[(unsigned int) yy_c];
01531             }
01532         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01533         }
01534
01535     return yy_current_state;
01536     }

void yy_init_buffer | ( | YY_BUFFER_STATE | b,
 |  | FILE * | file
 | ) |

Definition at line 1808 of file lexer.cc.

01816     {
01817     yy_flush_buffer( b );
01818
01819     b->yy_input_file = file;
01820     b->yy_fill_buffer = 1;
01821
01822 #if YY_ALWAYS_INTERACTIVE
01823     b->yy_is_interactive = 1;
01824 #else
01825 #if YY_NEVER_INTERACTIVE
01826     b->yy_is_interactive = 0;
01827 #else
01828     b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
01829 #endif
01830 #endif
01831     }

void yy_load_buffer_state ( void )

Definition at line 1738 of file lexer.cc.

Referenced by yylex().

01742     {
01743     yy_n_chars = yy_current_buffer->yy_n_chars;
01744     yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
01745     yyin = yy_current_buffer->yy_input_file;
01746     yy_hold_char = *yy_c_buf_p;
01747     }

YY_BUFFER_STATE yy_scan_buffer | ( | char * | base,
 |  | yy_size_t | size
 | ) |

Definition at line 1866 of file lexer.cc.

01872     {
01873     YY_BUFFER_STATE b;
01874
01875     if ( size < 2 ||
01876          base[size-2] != YY_END_OF_BUFFER_CHAR ||
01877          base[size-1] != YY_END_OF_BUFFER_CHAR )
01878         /* They forgot to leave room for the EOB's. */
01879         return 0;
01880
01881     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
01882     if ( ! b )
01883         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
01884
01885     b->yy_buf_size = size - 2;  /* "- 2" to take care of EOB's */
01886     b->yy_buf_pos = b->yy_ch_buf = base;
01887     b->yy_is_our_buffer = 0;
01888     b->yy_input_file = 0;
01889     b->yy_n_chars = b->yy_buf_size;
01890     b->yy_is_interactive = 0;
01891     b->yy_at_bol = 1;
01892     b->yy_fill_buffer = 0;
01893     b->yy_buffer_status = YY_BUFFER_NEW;
01894
01895     yy_switch_to_buffer( b );
01896
01897     return b;
01898     }

YY_BUFFER_STATE yy_scan_bytes | ( | const char * | bytes,
 |  | int | len
 | ) |

Definition at line 1921 of file lexer.cc.

01927     {
01928     YY_BUFFER_STATE b;
01929     char *buf;
01930     yy_size_t n;
01931     int i;
01932
01933     /* Get memory for full buffer, including space for trailing EOB's. */
01934     n = len + 2;
01935     buf = (char *) yy_flex_alloc( n );
01936     if ( ! buf )
01937         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
01938
01939     for ( i = 0; i < len; ++i )
01940         buf[i] = bytes[i];
01941
01942     buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
01943
01944     b = yy_scan_buffer( buf, n );
01945     if ( ! b )
01946         YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
01947
01948     /* It's okay to grow etc. this buffer, and we should throw it
01949      * away when we're done.
01950      */
01951     b->yy_is_our_buffer = 1;
01952
01953     return b;
01954     }

YY_BUFFER_STATE yy_scan_string ( const char * yy_str )

Definition at line 1904 of file lexer.cc.

01909     {
01910     int len;
01911     for ( len = 0; yy_str[len]; ++len )
01912         ;
01913
01914     return yy_scan_bytes( yy_str, len );
01915     }

void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer )

Definition at line 1708 of file lexer.cc.

01713     {
01714     if ( yy_current_buffer == new_buffer )
01715         return;
01716
01717     if ( yy_current_buffer )
01718         {
01719         /* Flush out information for old buffer. */
01720         *yy_c_buf_p = yy_hold_char;
01721         yy_current_buffer->yy_buf_pos = yy_c_buf_p;
01722         yy_current_buffer->yy_n_chars = yy_n_chars;
01723         }
01724
01725     yy_current_buffer = new_buffer;
01726     yy_load_buffer_state();
01727
01728     /* We don't actually know whether we did this switch during
01729      * EOF (yywrap()) processing, but the only time this flag
01730      * is looked at is after yywrap() is called, so it's safe
01731      * to go ahead and always set it.
01732      */
01733     yy_did_buffer_switch_on_eof = 1;
01734     }

yy_state_type yy_try_NUL_trans ( yy_state_type yy_current_state ) [static]

Definition at line 1546 of file lexer.cc.

Referenced by yylex().

01551     {
01552     register int yy_is_jam;
01553     register char *yy_cp = yy_c_buf_p;
01554
01555     register YY_CHAR yy_c = 1;
01556     if ( yy_accept[yy_current_state] )
01557         {
01558         yy_last_accepting_state = yy_current_state;
01559         yy_last_accepting_cpos = yy_cp;
01560         }
01561     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01562         {
01563         yy_current_state = (int) yy_def[yy_current_state];
01564         if ( yy_current_state >= 377 )
01565             yy_c = yy_meta[(unsigned int) yy_c];
01566         }
01567     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01568     yy_is_jam = (yy_current_state == 376);
01569
01570     return yy_is_jam ? 0 : yy_current_state;
01571     }

int yyinput ( void ) [static]

Definition at line 1620 of file lexer.cc.

01624     {
01625     int c;
01626
01627     *yy_c_buf_p = yy_hold_char;
01628
01629     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
01630         {
01631         /* yy_c_buf_p now points to the character we want to return.
01632          * If this occurs *before* the EOB characters, then it's a
01633          * valid NUL; if not, then we've hit the end of the buffer.
01634          */
01635         if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
01636             /* This was really a NUL. */
01637             *yy_c_buf_p = '\0';
01638
01639         else
01640             { /* need more input */
01641             int offset = yy_c_buf_p - yytext_ptr;
01642             ++yy_c_buf_p;
01643
01644             switch ( yy_get_next_buffer() )
01645                 {
01646                 case EOB_ACT_LAST_MATCH:
01647                     /* This happens because yy_g_n_b()
01648                      * sees that we've accumulated a
01649                      * token and flags that we need to
01650                      * try matching the token before
01651                      * proceeding.  But for input(),
01652                      * there's no matching to consider.
01653                      * So convert the EOB_ACT_LAST_MATCH
01654                      * to EOB_ACT_END_OF_FILE.
01655                      */
01656
01657                     /* Reset buffer status. */
01658                     yyrestart( yyin );
01659
01660                     /* fall through */
01661
01662                 case EOB_ACT_END_OF_FILE:
01663                     {
01664                     if ( yywrap() )
01665                         return EOF;
01666
01667                     if ( ! yy_did_buffer_switch_on_eof )
01668                         YY_NEW_FILE;
01669 #ifdef __cplusplus
01670                     return yyinput();
01671 #else
01672                     return input();
01673 #endif
01674                     }
01675
01676                 case EOB_ACT_CONTINUE_SCAN:
01677                     yy_c_buf_p = yytext_ptr + offset;
01678                     break;
01679                 }
01680             }
01681         }
01682
01683     c = *(unsigned char *) yy_c_buf_p;  /* cast for 8-bit char's */
01684     *yy_c_buf_p = '\0'; /* preserve yytext */
01685     yy_hold_char = *++yy_c_buf_p;
01686
01687
01688     return c;
01689     }

int yylex ( void )

Definition at line 802 of file lexer.cc.

00803     {
00804     register yy_state_type yy_current_state;
00805     register char *yy_cp, *yy_bp;
00806     register int yy_act;
00807
00808 #line 58 "lexer.ll"
00809
00810
00811
00812     /* Switch into a new start state if the parser */
00813     /* just told us that we've read a field name */
00814     /* and should expect a field value (or IS) */
00815 #if qCvsDebug
00816     if (yy_flex_debug)
00817         fprintf(stderr,"LEX--> Start State %d\n", expectToken);
00818 #endif
00819
00820     switch(expectToken)
00821     {
00822     case kNone: BEGIN NODE; break;
00823     case kString: BEGIN ST_STRING; break;
00824     case kRevnum: BEGIN ST_REV; break;
00825     case kRevnumOrNil: BEGIN ST_REVORNIL; break;
00826     case kInt: BEGIN ST_INT; break;
00827     case kDate: BEGIN ST_DATE; break;
00828     case kAnyButSep: BEGIN ST_ANYBUTSEP; break;
00829     default: yyerror("ACK: Bad expectToken"); break;
00830     }
00831
00832
00833 #line 834 "lex.yy.c"
00834
00835     if ( yy_init )
00836         {
00837         yy_init = 0;
00838
00839 #ifdef YY_USER_INIT
00840         YY_USER_INIT;
00841 #endif
00842
00843         if ( ! yy_start )
00844             yy_start = 1;   /* first start state */
00845
00846         if ( ! yyin )
00847             yyin = stdin;
00848
00849         if ( ! yyout )
00850             yyout = stdout;
00851
00852         if ( ! yy_current_buffer )
00853             yy_current_buffer =
00854                 yy_create_buffer( yyin, YY_BUF_SIZE );
00855
00856         yy_load_buffer_state();
00857         }
00858
00859     while ( 1 )     /* loops until end-of-file is reached */
00860         {
00861         yy_cp = yy_c_buf_p;
00862
00863         /* Support of yytext. */
00864         *yy_cp = yy_hold_char;
00865
00866         /* yy_bp points to the position in yy_ch_buf of the start of
00867          * the current run.
00868          */
00869         yy_bp = yy_cp;
00870
00871         yy_current_state = yy_start;
00872 yy_match:
00873         do
00874             {
00875             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00876             if ( yy_accept[yy_current_state] )
00877                 {
00878                 yy_last_accepting_state = yy_current_state;
00879                 yy_last_accepting_cpos = yy_cp;
00880                 }
00881             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00882                 {
00883                 yy_current_state = (int) yy_def[yy_current_state];
00884                 if ( yy_current_state >= 377 )
00885                     yy_c = yy_meta[(unsigned int) yy_c];
00886                 }
00887             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00888             ++yy_cp;
00889             }
00890         while ( yy_base[yy_current_state] != 496 );
00891
00892 yy_find_action:
00893         yy_act = yy_accept[yy_current_state];
00894         if ( yy_act == 0 )
00895             { /* have to back up */
00896             yy_cp = yy_last_accepting_cpos;
00897             yy_current_state = yy_last_accepting_state;
00898             yy_act = yy_accept[yy_current_state];
00899             }
00900
00901         YY_DO_BEFORE_ACTION;
00902
00903
00904 do_action:  /* This label is used only to access EOF actions. */
00905
00906
00907         switch ( yy_act )
00908     { /* beginning of action switch */
00909             case 0: /* must back up */
00910             /* undo the effects of YY_DO_BEFORE_ACTION */
00911             *yy_cp = yy_hold_char;
00912             yy_cp = yy_last_accepting_cpos;
00913             yy_current_state = yy_last_accepting_state;
00914             goto yy_find_action;
00915
00916 case 1:
00917 YY_RULE_SETUP
00918 #line 82 "lexer.ll"
00919 { BEGIN NODE; }
00920     YY_BREAK
00921 case 2:
00922 YY_RULE_SETUP
00923 #line 84 "lexer.ll"
00924 { return ID_RCS; }
00925     YY_BREAK
00926 case 3:
00927 YY_RULE_SETUP
00928 #line 85 "lexer.ll"
00929 { return ID_WORKING; }
00930     YY_BREAK
00931 case 4:
00932 YY_RULE_SETUP
00933 #line 86 "lexer.ll"
00934 { return ID_HEAD; }
00935     YY_BREAK
00936 case 5:
00937 YY_RULE_SETUP
00938 #line 87 "lexer.ll"
00939 { return ID_BRANCH; }
00940     YY_BREAK
00941 case 6:
00942 YY_RULE_SETUP
00943 #line 88 "lexer.ll"
00944 { return ID_LOCKS; }
00945     YY_BREAK
00946 case 7:
00947 YY_RULE_SETUP
00948 #line 89 "lexer.ll"
00949 { return ID_ACCESS; }
00950     YY_BREAK
00951 case 8:
00952 YY_RULE_SETUP
00953 #line 90 "lexer.ll"
00954 { return ID_SYMBOLIC; }
00955     YY_BREAK
00956 case 9:
00957 YY_RULE_SETUP
00958 #line 91 "lexer.ll"
00959 { return ID_KEYWORD; }
00960     YY_BREAK
00961 case 10:
00962 YY_RULE_SETUP
00963 #line 92 "lexer.ll"
00964 { return ID_TOTREVISIONS; }
00965     YY_BREAK
00966 case 11:
00967 YY_RULE_SETUP
00968 #line 93 "lexer.ll"
00969 { return ID_SELREVISIONS; }
00970     YY_BREAK
00971 case 12:
00972 YY_RULE_SETUP
00973 #line 94 "lexer.ll"
00974 { return ID_DESCRIPTION; }
00975     YY_BREAK
00976 case 13:
00977 YY_RULE_SETUP
00978 #line 95 "lexer.ll"
00979 { return ID_REVISION; }
00980     YY_BREAK
00981 case 14:
00982 YY_RULE_SETUP
00983 #line 96 "lexer.ll"
00984 { return ID_DATE; }
00985     YY_BREAK
00986 case 15:
00987 YY_RULE_SETUP
00988 #line 97 "lexer.ll"
00989 { return ID_AUTHOR; }
00990     YY_BREAK
00991 case 16:
00992 YY_RULE_SETUP
00993 #line 98 "lexer.ll"
00994 { return ID_STATE; }
00995     YY_BREAK
00996 case 17:
00997 YY_RULE_SETUP
00998 #line 99 "lexer.ll"
00999 { return ID_BRANCHES; }
01000     YY_BREAK
01001 case 18:
01002 YY_RULE_SETUP
01003 #line 100 "lexer.ll"
01004 { return ID_STRICT; }
01005     YY_BREAK
01006 case 19:
01007 YY_RULE_SETUP
01008 #line 101 "lexer.ll"
01009 { return ID_LINES; }
01010     YY_BREAK
01011 case 20:
01012 YY_RULE_SETUP
01013 #line 102 "lexer.ll"
01014 { return ID_LOCKEDBY; }
01015     YY_BREAK
01016 case 21:
01017 YY_RULE_SETUP
01018 #line 104 "lexer.ll"
01019 { return ID_REVFOLLOW; }
01020     YY_BREAK
01021 case 22:
01022 YY_RULE_SETUP
01023 #line 105 "lexer.ll"
01024 { return ID_ENDFOLLOW; }
01025     YY_BREAK
01026 case 23:
01027 YY_RULE_SETUP
01028 #line 106 "lexer.ll"
01029 {
01030     yylval_set(yytext);
01031     return TAG;
01032 }
01033     YY_BREAK
01034 case 24:
01035 YY_RULE_SETUP
01036 #line 111 "lexer.ll"
01037 {
01038     BEGIN NODE;
01039     expectToken = kNone;
01040
01041     return ID_REVFOLLOW;
01042 }
01043     YY_BREAK
01044 case 25:
01045 YY_RULE_SETUP
01046 #line 118 "lexer.ll"
01047 {
01048     BEGIN NODE;
01049     expectToken = kNone;
01050     return ID_ENDFOLLOW;
01051 }
01052     YY_BREAK
01053 case 26:
01054 YY_RULE_SETUP
01055 #line 124 "lexer.ll"
01056 {
01057     ++currentLineNumber;
01058 #if qCvsDebug
01059     if (yy_flex_debug)
01060         fprintf(stderr,"LINESEP--> %d\n", currentLineNumber);
01061 #endif
01062
01063     yylval_set((int)(unsigned char)yytext[0]);
01064     return ID_CHAR;
01065 }
01066     YY_BREAK
01067 case 27:
01068 YY_RULE_SETUP
01069 #line 135 "lexer.ll"
01070 {
01071     yylval_set((int)(unsigned char)yytext[0]);
01072     return ID_CHAR;
01073 }
01074     YY_BREAK
01075 case 28:
01076 YY_RULE_SETUP
01077 #line 140 "lexer.ll"
01078 {
01079     yylval_set(yytext);
01080     BEGIN NODE;
01081     expectToken = kNone;
01082
01083     return STRING;
01084 }
01085     YY_BREAK
01086 case 29:
01087 YY_RULE_SETUP
01088 #line 148 "lexer.ll"
01089 {
01090     int v;
01091     revnumber.reset();
01092     if(sscanf(yytext, "%d", &v) == 1)
01093         revnumber += v;
01094     else
01095         yyerror("%s not an integer value", yytext);
01096     BEGIN ST_INREV;
01097     expectToken = kNone;
01098 }
01099     YY_BREAK
01100 case 30:
01101 YY_RULE_SETUP
01102 #line 159 "lexer.ll"
01103 {
01104     int v;
01105     revnumber.reset();
01106     if(sscanf(yytext, "%d", &v) == 1)
01107         revnumber += v;
01108     else
01109         yyerror("%s not an integer value", yytext);
01110     BEGIN ST_INREV;
01111     expectToken = kNone;
01112 }
01113     YY_BREAK
01114 case 31:
01115 YY_RULE_SETUP
01116 #line 170 "lexer.ll"
01117 {
01118     yyless(0); /* put back the spaces */
01119     BEGIN NODE;
01120     expectToken = kNone;
01121
01122     return REVNUM;
01123 }
01124     YY_BREAK
01125 case 32:
01126 YY_RULE_SETUP
01127 #line 178 "lexer.ll"
01128 {
01129     int v;
01130     if(sscanf(yytext + 1, "%d", &v) == 1)
01131         revnumber += v;
01132     else
01133         yyerror("%s not an integer value", yytext);
01134     BEGIN ST_INREV;
01135     expectToken = kNone;
01136 }
01137     YY_BREAK
01138 case 33:
01139 YY_RULE_SETUP
01140 #line 188 "lexer.ll"
01141 {
01142     yyless(0); /* put back the spaces */
01143     BEGIN NODE;
01144     expectToken = kNone;
01145     yylval_set(revnumber);
01146
01147     return REVNUM;
01148 }
01149     YY_BREAK
01150 case 34:
01151 YY_RULE_SETUP
01152 #line 197 "lexer.ll"
01153 {
01154     int v;
01155     if(sscanf(yytext, "%d", &v) == 1)
01156         revnumber += v;
01157     else
01158         yyerror("%s not an integer value", yytext);
01159     BEGIN NODE;
01160     expectToken = kNone;
01161     yylval_set(v);
01162
01163     return INTEGER;
01164 }
01165     YY_BREAK
01166 case 35:
01167 YY_RULE_SETUP
01168 #line 210 "lexer.ll"
01169 {
01170     int v;
01171     if(sscanf(yytext, "%d", &v) == 1)
01172         revnumber += v;
01173     else
01174         yyerror("%s not an integer value", yytext);
01175     yylval_set(v);
01176
01177     return INTEGER;
01178 }
01179     YY_BREAK
01180 case 36:
01181 YY_RULE_SETUP
01182 #line 221 "lexer.ll"
01183 {
01184     return yytext[0];
01185 }
01186     YY_BREAK
01187 /* Whitespace and catch-all rules apply to all start states: */
01188 case 37:
01189 YY_RULE_SETUP
01190 #line 226 "lexer.ll"
01191 ;
01192     YY_BREAK
01193 /* This is also whitespace, but we'll keep track of line number */
01194 /* to report in errors: */
01195 case 38:
01196 YY_RULE_SETUP
01197 #line 230 "lexer.ll"
01198 {
01199                                 ++currentLineNumber;
01200 #if qCvsDebug
01201                                 if (yy_flex_debug)
01202                                     fprintf(stderr,"LINE--> %d\n", currentLineNumber);
01203 #endif
01204                                 if(expectToken == kAnyButSep)
01205                                 {
01206                                     // strange bug, flex is sometimes getting here in
01207                                     // a kAnyButSep mode, while it should not
01208                                     yylval_set(yytext);
01209                                       return STRING;
01210                                 }
01211                             }
01212     YY_BREAK
01213 /* This catch-all rule catches anything not covered by any of */
01214 /* the above: */
01215 case 39:
01216 YY_RULE_SETUP
01217 #line 247 "lexer.ll"
01218 {
01219     yylval_set((int)(unsigned char)yytext[0]);
01220     return (int)(unsigned char)yytext[0];
01221 }
01222     YY_BREAK
01223 case 40:
01224 YY_RULE_SETUP
01225 #line 251 "lexer.ll"
01226 ECHO;
01227     YY_BREAK
01228 #line 1229 "lex.yy.c"
01229 case YY_STATE_EOF(INITIAL):
01230 case YY_STATE_EOF(NODE):
01231 case YY_STATE_EOF(ST_STRING):
01232 case YY_STATE_EOF(ST_TAG):
01233 case YY_STATE_EOF(ST_REV):
01234 case YY_STATE_EOF(ST_REVORNIL):
01235 case YY_STATE_EOF(ST_INREV):
01236 case YY_STATE_EOF(ST_INT):
01237 case YY_STATE_EOF(ST_ANYBUTSEP):
01238 case YY_STATE_EOF(ST_DATE):
01239     yyterminate();
01240
01241     case YY_END_OF_BUFFER:
01242         {
01243         /* Amount of text matched not including the EOB char. */
01244         int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
01245
01246         /* Undo the effects of YY_DO_BEFORE_ACTION. */
01247         *yy_cp = yy_hold_char;
01248         YY_RESTORE_YY_MORE_OFFSET
01249
01250         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
01251             {
01252             /* We're scanning a new file or input source.  It's
01253              * possible that this happened because the user
01254              * just pointed yyin at a new source and called
01255              * yylex().  If so, then we have to assure
01256              * consistency between yy_current_buffer and our
01257              * globals.  Here is the right place to do so, because
01258              * this is the first action (other than possibly a
01259              * back-up) that will match for the new input source.
01260              */
01261             yy_n_chars = yy_current_buffer->yy_n_chars;
01262             yy_current_buffer->yy_input_file = yyin;
01263             yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
01264             }
01265
01266         /* Note that here we test for yy_c_buf_p "<=" to the position
01267          * of the first EOB in the buffer, since yy_c_buf_p will
01268          * already have been incremented past the NUL character
01269          * (since all states make transitions on EOB to the
01270          * end-of-buffer state).  Contrast this with the test
01271          * in input().
01272          */
01273         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
01274             { /* This was really a NUL. */
01275             yy_state_type yy_next_state;
01276
01277             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
01278
01279             yy_current_state = yy_get_previous_state();
01280
01281             /* Okay, we're now positioned to make the NUL
01282              * transition.  We couldn't have
01283              * yy_get_previous_state() go ahead and do it
01284              * for us because it doesn't know how to deal
01285              * with the possibility of jamming (and we don't
01286              * want to build jamming into it because then it
01287              * will run more slowly).
01288              */
01289
01290             yy_next_state = yy_try_NUL_trans( yy_current_state );
01291
01292             yy_bp = yytext_ptr + YY_MORE_ADJ;
01293
01294             if ( yy_next_state )
01295                 {
01296                 /* Consume the NUL. */
01297                 yy_cp = ++yy_c_buf_p;
01298                 yy_current_state = yy_next_state;
01299                 goto yy_match;
01300                 }
01301
01302             else
01303                 {
01304                 yy_cp = yy_c_buf_p;
01305                 goto yy_find_action;
01306                 }
01307             }
01308
01309         else switch ( yy_get_next_buffer() )
01310             {
01311             case EOB_ACT_END_OF_FILE:
01312                 {
01313                 yy_did_buffer_switch_on_eof = 0;
01314
01315                 if ( yywrap() )
01316                     {
01317                     /* Note: because we've taken care in
01318                      * yy_get_next_buffer() to have set up
01319                      * yytext, we can now set up
01320                      * yy_c_buf_p so that if some total
01321                      * hoser (like flex itself) wants to
01322                      * call the scanner after we return the
01323                      * YY_NULL, it'll still work - another
01324                      * YY_NULL will get returned.
01325                      */
01326                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
01327
01328                     yy_act = YY_STATE_EOF(YY_START);
01329                     goto do_action;
01330                     }
01331
01332                 else
01333                     {
01334                     if ( ! yy_did_buffer_switch_on_eof )
01335                         YY_NEW_FILE;
01336                     }
01337                 break;
01338                 }
01339
01340             case EOB_ACT_CONTINUE_SCAN:
01341                 yy_c_buf_p =
01342                     yytext_ptr + yy_amount_of_matched_text;
01343
01344                 yy_current_state = yy_get_previous_state();
01345
01346                 yy_cp = yy_c_buf_p;
01347                 yy_bp = yytext_ptr + YY_MORE_ADJ;
01348                 goto yy_match;
01349
01350             case EOB_ACT_LAST_MATCH:
01351                 yy_c_buf_p =
01352                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
01353
01354                 yy_current_state = yy_get_previous_state();
01355
01356                 yy_cp = yy_c_buf_p;
01357                 yy_bp = yytext_ptr + YY_MORE_ADJ;
01358                 goto yy_find_action;
01359             }
01360         break;
01361         }
01362
01363     default:
01364         YY_FATAL_ERROR(
01365             "fatal flex scanner internal error--no action found" );
01366     } /* end of action switch */
01367         } /* end of scanning one token */
01368     } /* end of yylex */

void yyrestart ( FILE * input_file )

Definition at line 1693 of file lexer.cc.

Referenced by CvsLogParse(), main(), yy_get_next_buffer(), and yyinput().

01698     {
01699     if ( ! yy_current_buffer )
01700         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
01701
01702     yy_init_buffer( yy_current_buffer, input_file );
01703     yy_load_buffer_state();
01704     }

void yyunput | ( | int | c,
 |  | register char * | yy_bp
 | ) | [static]

Definition at line 1576 of file lexer.cc.

01582     {
01583     register char *yy_cp = yy_c_buf_p;
01584
01585     /* undo effects of setting up yytext */
01586     *yy_cp = yy_hold_char;
01587
01588     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
01589         { /* need to shift things up to make room */
01590         /* +2 for EOB chars. */
01591         register int number_to_move = yy_n_chars + 2;
01592         register char *dest = &yy_current_buffer->yy_ch_buf[
01593                     yy_current_buffer->yy_buf_size + 2];
01594         register char *source =
01595                 &yy_current_buffer->yy_ch_buf[number_to_move];
01596
01597         while ( source > yy_current_buffer->yy_ch_buf )
01598             *--dest = *--source;
01599
01600         yy_cp += (int) (dest - source);
01601         yy_bp += (int) (dest - source);
01602         yy_current_buffer->yy_n_chars =
01603             yy_n_chars = yy_current_buffer->yy_buf_size;
01604
01605         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
01606             YY_FATAL_ERROR( "flex scanner push-back overflow" );
01607         }
01608
01609     *--yy_cp = (char) c;
01610
01611
01612     yytext_ptr = yy_bp;
01613     yy_hold_char = *yy_cp;
01614     yy_c_buf_p = yy_cp;
01615     }

void yyunput | ( | int | c,
 |  | char * | buf_ptr
 | ) | [static]

int yywrap ( void )

Definition at line 632 of file lexer.cc.

Referenced by yyinput(), and yylex().

00632 { BEGIN INITIAL; return 1; }

Variable Documentation

int currentLineNumber = 1

Definition at line 625 of file lexer.cc.

kTokens expectToken = kNone

Definition at line 628 of file lexer.cc.

CRevNumber revnumber

Definition at line 630 of file lexer.cc.

const short int yy_accept[377] [static]

Definition at line 287 of file lexer.cc.

const short int yy_base[384] [static]

Definition at line 372 of file lexer.cc.

char* yy_c_buf_p = (char *) 0 [static]

Definition at line 219 of file lexer.cc.

const short int yy_chk[535] [static]

Definition at line 527 of file lexer.cc.

YY_BUFFER_STATE yy_current_buffer = 0 [static]

Definition at line 201 of file lexer.cc.

const short int yy_def[384] [static]

Definition at line 418 of file lexer.cc.

int yy_did_buffer_switch_on_eof [static]

Definition at line 226 of file lexer.cc.

const int yy_ec[256] [static]

Definition at line 332 of file lexer.cc.

char yy_hold_char [static]

Definition at line 211 of file lexer.cc.

int yy_init = 1 [static]

Definition at line 220 of file lexer.cc.

char* yy_last_accepting_cpos [static]

Definition at line 591 of file lexer.cc.

yy_state_type yy_last_accepting_state [static]

Definition at line 590 of file lexer.cc.

const int yy_meta[39] [static]

Initial value:

    {   0,
        1,    2,    2,    3,    1,    1,    1,    1,    1,    3,
        3,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1
    }

Definition at line 364 of file lexer.cc.

int yy_n_chars [static]

Definition at line 213 of file lexer.cc.

const short int yy_nxt[535] [static]

Definition at line 464 of file lexer.cc.

int yy_start = 0 [static]

Definition at line 221 of file lexer.cc.

FILE* yyin = (FILE *) 0

Definition at line 265 of file lexer.cc.

int yyleng

Definition at line 216 of file lexer.cc.

FILE * yyout = (FILE *) 0

Definition at line 265 of file lexer.cc.

char * yytext

Definition at line 600 of file lexer.cc.

Generated on Sun Oct 21 12:44:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


lexer.cpp File Reference

cvstree/lexer.cpp File Reference

#include "lexer.cc"

Include dependency graph for lexer.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


main.cpp File Reference

cvstree/main.cpp File Reference

#include <stdio.h>
#include <getopt.h>
#include <errno.h>
#include "common.h"

Include dependency graph for main.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void | yyoutput (ostream &out)
int | sortRevFile (const void *r1, const void *r2)
void | yygraph (const CRcsFile &rcs)
void | yygraph (void)
void | usage (const char *const *cpp)
int | main (int argc, char **argv)

Variables

const char *const | cmd_usage []
option long_options []

Function Documentation

int main | ( | int | argc,
 |  | char ** | argv
 | ) |

Definition at line 80 of file main.cpp.

00081 {
00082     int c;
00083     int option_index = 0;
00084     bool outGraph = false;
00085     CLogStr output;
00086     CLogStr input;
00087
00088 #if qCvsDebug
00089     yydebug = 0;
00090     yy_flex_debug = 0;
00091 #endif
00092
00093     while ((c = getopt_long
00094             (argc, argv, "+o:f:g123vh", long_options, &option_index))
00095            != EOF)
00096     {
00097         switch (c)
00098         {
00099         case '1':
00100 #if qCvsDebug
00101             yy_flex_debug = 1;
00102 #endif
00103             break;
00104         case '2':
00105 #if qCvsDebug
00106             yydebug = 1;
00107 #endif
00108             break;
00109         case '3':
00110 #if qCvsDebug
00111             yydebug = 1;
00112             yy_flex_debug = 1;
00113 #endif
00114             break;
00115         case 'h':
00116             usage (cmd_usage);
00117             break;
00118         case 'g':
00119             outGraph = true;
00120             break;
00121         case 'v':
00122             outGraph = false;
00123             break;
00124         case 'o':
00125             output = optarg;
00126             break;
00127         case 'f':
00128             input = optarg;
00129             break;
00130         case '*':
00131             cerr << "Version of " << argv[0] << " is $Revision: 1.2 $\n";
00132             exit(1);
00133             break;
00134         case '?':
00135         default:
00136             usage (cmd_usage);
00137         }
00138     }
00139
00140     argc -= optind;
00141     argv += optind;
00142     if (argc != 0)
00143         usage (cmd_usage);
00144
00145     if(!input.empty())
00146     {
00147         yyin = fopen(input, "r");
00148         if(yyin == 0L)
00149         {
00150             cerr << "Error while opening '" << input << "'\n";
00151             exit(errno);
00152         }
00153     }
00154     else
00155         yyin = stdin;
00156     yyreset();
00157     yyrestart(yyin);
00158     yyparse();
00159
00160     if(outGraph)
00161     {
00162         yygraph();
00163     }
00164     else
00165     {
00166         filebuf fbuf;
00167         streambuf *buf = 0L;
00168
00169         if(!output.empty())
00170         {
00171             buf = fbuf.open(output, "w");
00172             if(buf == 0L)
00173             {
00174                 cerr << "Error while opening '" << output << "'\n";
00175                 exit(errno);
00176             }
00177             ostream out(buf);
00178             yyoutput(out);
00179             fbuf.close();
00180         }
00181         else
00182             yyoutput(cout);
00183     }
00184     if(!input.empty())
00185         fclose(yyin);
00186 }

int sortRevFile | ( | const void * | r1,
 |  | const void * | r2
 | ) | [static]

Definition at line 20 of file main.cpp.

00021 {
00022     const CRevNumber & rev1 = ((CRevFile *)r1)->RevNum();
00023     const CRevNumber & rev2 = ((CRevFile *)r2)->RevNum();
00024
00025     return rev1.cmp(rev2);
00026 }

void usage ( const char *const * cpp ) [static]

Definition at line 73 of file main.cpp.

00074 {
00075     for (; *cpp; cpp++)
00076         fprintf (stderr, *cpp);
00077     exit(1);
00078 }

void yygraph ( void ) [static]

Definition at line 41 of file main.cpp.

Referenced by main().

00042 {
00043     vector<CRcsFile>::const_iterator i;
00044     for(i = gRcsFiles.begin(); i != gRcsFiles.end(); ++i)
00045     {
00046         const CRcsFile & rcs = *i;
00047         yygraph(rcs);
00048     }
00049 }

void yygraph ( const CRcsFile & rcs ) [static]

Definition at line 28 of file main.cpp.

00029 {
00030     const vector<CRevFile> & allrevs = rcs.AllRevs();
00031     qsort((CRevFile *)allrevs.begin(), allrevs.size(), sizeof(CRevFile), sortRevFile);
00032     vector<CRevFile>::const_iterator i;
00033     for(i = allrevs.begin(); i != allrevs.end(); ++i)
00034     {
00035         const CRevNumber & rev = i->RevNum();
00036         cout << '\t' << rev.str() << '\n';
00037     }
00038
00039 }

void yyoutput ( ostream & out ) [static]

Definition at line 6 of file main.cpp.

Referenced by main().

00007 {
00008     vector<CRcsFile>::const_iterator i;
00009     for(i = gRcsFiles.begin(); i != gRcsFiles.end(); ++i)
00010     {
00011         const CRcsFile & rcs = *i;
00012         rcs.print(out);
00013     }
00014 }

Variable Documentation

const char* const cmd_usage[] [static]

Initial value:

{
    "CVSTREE synopsis is: cvs [cvsoptions] log [logoptions] | cvstree [cvstree options]\n",
    "CVSTREE options are:\n",
    "        -v           Verbose the output similar to cvs log (default)\n",
    "        -o output    Output in a file\n",
    "        -g           Output a graph of the revisions\n",
    "        -1           Debug the lexer (flex output)\n",
    "        -2           Debug the parser (bison output)\n",
    "        -3           Debug both the parser and the lexer\n",
    "        --help,-h    Print this help\n",
    "        --version    Print the version number\n",
    NULL
}

Definition at line 51 of file main.cpp.

struct option long_options[] [static]

Initial value:

{
    {"help", 0, NULL, 'h'},
    {"version", 0, NULL, '*'},
    {0, 0, 0, 0}
}

Definition at line 66 of file main.cpp.

Generated on Sun Oct 21 12:44:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


parser.cc File Reference

cvstree/parser.cc File Reference

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include "common.h"

Include dependency graph for parser.cc:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

union | YYSTYPE

Defines

#define | YYBISON 1
#define | INTEGER 257
#define | STRING 258
#define | TAG 259
#define | REVNUM 260
#define | ID_CHAR 261
#define | ID_DESCRIPTION 262
#define | ID_TOTREVISIONS 263
#define | ID_SELREVISIONS 264
#define | ID_KEYWORD 265
#define | ID_SYMBOLIC 266
#define | ID_ACCESS 267
#define | ID_LOCKS 268
#define | ID_STRICT 269
#define | ID_BRANCH 270
#define | ID_HEAD 271
#define | ID_WORKING 272
#define | ID_RCS 273
#define | ID_REVISION 274
#define | ID_DATE 275
#define | ID_BRANCHES 276
#define | ID_REVFOLLOW 277
#define | ID_ENDFOLLOW 278
#define | ID_LINES 279
#define | ID_ANYBUTSEP 280
#define | ID_LOCKEDBY 281
#define | ID_AUTHOR 282
#define | ID_STATE 283
#define | YYDEBUG 0
#define | YYFINAL 148
#define | YYFLAG -32768
#define | YYNTBASE 33
#define | YYTRANSLATE(x) ((unsigned)(x) <= 283 ? yytranslate[x] : 94)
#define | YYLAST 114
#define | YYSTACK_ALLOC malloc
#define | yyerrok (yyerrstatus = 0)
#define | yyclearin (yychar = YYEMPTY)
#define | YYEMPTY -2
#define | YYEOF 0
#define | YYACCEPT goto yyacceptlab
#define | YYABORT goto yyabortlab
#define | YYERROR goto yyerrlab1
#define | YYFAIL goto yyerrlab
#define | YYRECOVERING() (!!yyerrstatus)
#define | YYBACKUP(token, value)
#define | YYTERROR 1
#define | YYERRCODE 256
#define | YYLEX yylex()
#define | YYINITDEPTH 200
#define | YYMAXDEPTH 10000
#define | YYPARSE_PARAM_ARG
#define | YYPARSE_PARAM_DECL
#define | YYPOPSTACK (yyvsp--, yyssp--)

Functions

void | expect (kTokens type)
void | __yy_memcpy (char *to, char *from, unsigned int count)
int | yyparse ()
void | yyerror (const char *,...)
void | yylval_set (const char *txt)
void | yylval_set (int anint)
void | yylval_set (const CRevNumber &rev)
void | yyreset (void)

Variables

int | sInt
CLogStr sStr
CRevNumber sRev
const char | yytranslate []
const short | yyr1 []
const short | yyr2 []
const short | yydefact []
const short | yydefgoto []
const short | yypact []
const short | yypgoto []
const short | yytable []
const short | yycheck []
int | yychar
YYSTYPE yylval
int | yynerrs

Define Documentation

#define ID_ACCESS 267

Definition at line 18 of file parser.cc.

#define ID_ANYBUTSEP 280

Definition at line 31 of file parser.cc.

#define ID_AUTHOR 282

Definition at line 33 of file parser.cc.

#define ID_BRANCH 270

Definition at line 21 of file parser.cc.

#define ID_BRANCHES 276

Definition at line 27 of file parser.cc.

#define ID_CHAR 261

Definition at line 12 of file parser.cc.

#define ID_DATE 275

Definition at line 26 of file parser.cc.

#define ID_DESCRIPTION 262

Definition at line 13 of file parser.cc.

#define ID_ENDFOLLOW 278

Definition at line 29 of file parser.cc.

#define ID_HEAD 271

Definition at line 22 of file parser.cc.

#define ID_KEYWORD 265

Definition at line 16 of file parser.cc.

#define ID_LINES 279

Definition at line 30 of file parser.cc.

#define ID_LOCKEDBY 281

Definition at line 32 of file parser.cc.

#define ID_LOCKS 268

Definition at line 19 of file parser.cc.

#define ID_RCS 273

Definition at line 24 of file parser.cc.

#define ID_REVFOLLOW 277

Definition at line 28 of file parser.cc.

#define ID_REVISION 274

Definition at line 25 of file parser.cc.

#define ID_SELREVISIONS 264

Definition at line 15 of file parser.cc.

#define ID_STATE 283

Definition at line 34 of file parser.cc.

#define ID_STRICT 269

Definition at line 20 of file parser.cc.

#define ID_SYMBOLIC 266

Definition at line 17 of file parser.cc.

#define ID_TOTREVISIONS 263

Definition at line 14 of file parser.cc.

#define ID_WORKING 272

Definition at line 23 of file parser.cc.

#define INTEGER 257

Definition at line 8 of file parser.cc.

#define REVNUM 260

Definition at line 11 of file parser.cc.

#define STRING 258

Definition at line 9 of file parser.cc.

#define TAG 259

Definition at line 10 of file parser.cc.

#define YYABORT goto yyabortlab

Definition at line 409 of file parser.cc.

#define YYACCEPT goto yyacceptlab

Definition at line 408 of file parser.cc.

#define YYBACKUP | ( | token,
 |  | value | )

Value:

do                              \
  if (yychar == YYEMPTY && yylen == 1)              \
    { yychar = (token), yylval = (value);           \
      yychar1 = YYTRANSLATE (yychar);               \
      YYPOPSTACK;                       \
      goto yybackup;                        \
    }                               \
  else                              \
    { yyerror ("syntax error: cannot back up"); YYERROR; }  \
while (0)

Definition at line 417 of file parser.cc.

#define YYBISON 1

Definition at line 6 of file parser.cc.

#define YYDEBUG 0

Definition at line 63 of file parser.cc.

#define YYEMPTY -2

Definition at line 406 of file parser.cc.

#define YYEOF 0

Definition at line 407 of file parser.cc.

#define YYERRCODE 256

Definition at line 430 of file parser.cc.

#define YYERROR goto yyerrlab1

Definition at line 410 of file parser.cc.

#define YYFAIL goto yyerrlab

Definition at line 415 of file parser.cc.

#define YYFINAL 148

Definition at line 87 of file parser.cc.

#define YYFLAG -32768

Definition at line 88 of file parser.cc.

#define YYINITDEPTH 200

Definition at line 477 of file parser.cc.

#define YYLAST 114

Definition at line 288 of file parser.cc.

#define YYLEX yylex()

Definition at line 433 of file parser.cc.

#define YYMAXDEPTH 10000

Definition at line 488 of file parser.cc.

#define YYNTBASE 33

Definition at line 89 of file parser.cc.

#define YYPARSE_PARAM_ARG

Definition at line 552 of file parser.cc.

#define YYPARSE_PARAM_DECL

Definition at line 553 of file parser.cc.

#define YYPOPSTACK (yyvsp--, yyssp--)

#define YYRECOVERING ( ) (!!yyerrstatus)

Definition at line 416 of file parser.cc.

#define YYSTACK_ALLOC malloc

Definition at line 397 of file parser.cc.

#define YYTERROR 1

Definition at line 429 of file parser.cc.

#define YYTRANSLATE ( x ) ((unsigned)(x) <= 283 ? yytranslate[x] : 94)

Definition at line 91 of file parser.cc.

#define yyclearin (yychar = YYEMPTY)

Definition at line 405 of file parser.cc.

#define yyerrok (yyerrstatus = 0)

Definition at line 404 of file parser.cc.

Function Documentation

void __yy_memcpy | ( | char * | to,
 |  | char * | from,
 |  | unsigned int | count
 | ) | [static]

Definition at line 522 of file parser.cc.

00523 {
00524   register char *t = to;
00525   register char *f = from;
00526   register int i = count;
00527
00528   while (i-- > 0)
00529     *t++ = *f++;
00530 }

void expect ( kTokens type ) [static]

Definition at line 1499 of file parser.cc.

Referenced by yyerror(), and yyreset().

01500 {
01501     expectToken = type;
01502 }

void yyerror | ( | const char * | txt,
 |  | ... |
 | ) |

Definition at line 1494 of file parser.cc.

01495 {
01496     expect(kAnyButSep);
01497 }

void yylval_set ( const CRevNumber & rev )

Definition at line 1514 of file parser.cc.

Referenced by yylex().

01515 {
01516     sRev = rev;
01517 }

void yylval_set ( int anint )

Definition at line 1509 of file parser.cc.

01510 {
01511     yylval.aint = anint;
01512 }

void yylval_set ( const char * txt )

Definition at line 1504 of file parser.cc.

01505 {
01506     yylval.string = strdup(txt);
01507 }

int yyparse ( void )

Definition at line 566 of file parser.cc.

00568 {
00569   register int yystate;
00570   register int yyn;
00571   register short *yyssp;
00572   register YYSTYPE *yyvsp;
00573   int yyerrstatus;  /*  number of tokens to shift before error messages enabled */
00574   int yychar1 = 0;      /*  lookahead token as an internal (translated) token number */
00575
00576   short yyssa[YYINITDEPTH]; /*  the state stack         */
00577   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack        */
00578
00579   short *yyss = yyssa;      /*  refer to the stacks thru separate pointers */
00580   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
00581
00582 #ifdef YYLSP_NEEDED
00583   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack          */
00584   YYLTYPE *yyls = yylsa;
00585   YYLTYPE *yylsp;
00586
00587 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
00588 #else
00589 #define YYPOPSTACK   (yyvsp--, yyssp--)
00590 #endif
00591
00592   int yystacksize = YYINITDEPTH;
00593   int yyfree_stacks = 0;
00594
00595 #ifdef YYPURE
00596   int yychar;
00597   YYSTYPE yylval;
00598   int yynerrs;
00599 #ifdef YYLSP_NEEDED
00600   YYLTYPE yylloc;
00601 #endif
00602 #endif
00603
00604   YYSTYPE yyval;        /*  the variable used to return     */
00605                 /*  semantic values from the action */
00606                 /*  routines                */
00607
00608   int yylen;
00609
00610 #if YYDEBUG != 0
00611   if (yydebug)
00612     fprintf(stderr, "Starting parse\n");
00613 #endif
00614
00615   yystate = 0;
00616   yyerrstatus = 0;
00617   yynerrs = 0;
00618   yychar = YYEMPTY;     /* Cause a token to be read.  */
00619
00620   /* Initialize stack pointers.
00621      Waste one element of value and location stack
00622      so that they stay on the same level as the state stack.
00623      The wasted elements are never initialized.  */
00624
00625   yyssp = yyss - 1;
00626   yyvsp = yyvs;
00627 #ifdef YYLSP_NEEDED
00628   yylsp = yyls;
00629 #endif
00630
00631 /* Push a new state, which is found in  yystate  .  */
00632 /* In all cases, when you get here, the value and location stacks
00633    have just been pushed. so pushing a state here evens the stacks.  */
00634 yynewstate:
00635
00636   *++yyssp = yystate;
00637
00638   if (yyssp >= yyss + yystacksize - 1)
00639     {
00640       /* Give user a chance to reallocate the stack */
00641       /* Use copies of these so that the &'s don't force the real ones into memory. */
00642       YYSTYPE *yyvs1 = yyvs;
00643       short *yyss1 = yyss;
00644 #ifdef YYLSP_NEEDED
00645       YYLTYPE *yyls1 = yyls;
00646 #endif
00647
00648       /* Get the current used size of the three stacks, in elements.  */
00649       int size = yyssp - yyss + 1;
00650
00651 #ifdef yyoverflow
00652       /* Each stack pointer address is followed by the size of
00653      the data in use in that stack, in bytes.  */
00654 #ifdef YYLSP_NEEDED
00655       /* This used to be a conditional around just the two extra args,
00656      but that might be undefined if yyoverflow is a macro.  */
00657       yyoverflow("parser stack overflow",
00658          &yyss1, size * sizeof (*yyssp),
00659          &yyvs1, size * sizeof (*yyvsp),
00660          &yyls1, size * sizeof (*yylsp),
00661          &yystacksize);
00662 #else
00663       yyoverflow("parser stack overflow",
00664          &yyss1, size * sizeof (*yyssp),
00665          &yyvs1, size * sizeof (*yyvsp),
00666          &yystacksize);
00667 #endif
00668
00669       yyss = yyss1; yyvs = yyvs1;
00670 #ifdef YYLSP_NEEDED
00671       yyls = yyls1;
00672 #endif
00673 #else /* no yyoverflow */
00674       /* Extend the stack our own way.  */
00675       if (yystacksize >= YYMAXDEPTH)
00676     {
00677       yyerror("parser stack overflow");
00678       if (yyfree_stacks)
00679         {
00680           free (yyss);
00681           free (yyvs);
00682 #ifdef YYLSP_NEEDED
00683           free (yyls);
00684 #endif
00685         }
00686       return 2;
00687     }
00688       yystacksize *= 2;
00689       if (yystacksize > YYMAXDEPTH)
00690     yystacksize = YYMAXDEPTH;
00691 #ifndef YYSTACK_USE_ALLOCA
00692       yyfree_stacks = 1;
00693 #endif
00694       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
00695       __yy_memcpy ((char *)yyss, (char *)yyss1,
00696            size * (unsigned int) sizeof (*yyssp));
00697       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
00698       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
00699            size * (unsigned int) sizeof (*yyvsp));
00700 #ifdef YYLSP_NEEDED
00701       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
00702       __yy_memcpy ((char *)yyls, (char *)yyls1,
00703            size * (unsigned int) sizeof (*yylsp));
00704 #endif
00705 #endif /* no yyoverflow */
00706
00707       yyssp = yyss + size - 1;
00708       yyvsp = yyvs + size - 1;
00709 #ifdef YYLSP_NEEDED
00710       yylsp = yyls + size - 1;
00711 #endif
00712
00713 #if YYDEBUG != 0
00714       if (yydebug)
00715     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
00716 #endif
00717
00718       if (yyssp >= yyss + yystacksize - 1)
00719     YYABORT;
00720     }
00721
00722 #if YYDEBUG != 0
00723   if (yydebug)
00724     fprintf(stderr, "Entering state %d\n", yystate);
00725 #endif
00726
00727   goto yybackup;
00728  yybackup:
00729
00730 /* Do appropriate processing given the current state.  */
00731 /* Read a lookahead token if we need one and don't already have one.  */
00732 /* yyresume: */
00733
00734   /* First try to decide what to do without reference to lookahead token.  */
00735
00736   yyn = yypact[yystate];
00737   if (yyn == YYFLAG)
00738     goto yydefault;
00739
00740   /* Not known => get a lookahead token if don't already have one.  */
00741
00742   /* yychar is either YYEMPTY or YYEOF
00743      or a valid token in external form.  */
00744
00745   if (yychar == YYEMPTY)
00746     {
00747 #if YYDEBUG != 0
00748       if (yydebug)
00749     fprintf(stderr, "Reading a token: ");
00750 #endif
00751       yychar = YYLEX;
00752     }
00753
00754   /* Convert token to internal form (in yychar1) for indexing tables with */
00755
00756   if (yychar <= 0)      /* This means end of input. */
00757     {
00758       yychar1 = 0;
00759       yychar = YYEOF;       /* Don't call YYLEX any more */
00760
00761 #if YYDEBUG != 0
00762       if (yydebug)
00763     fprintf(stderr, "Now at end of input.\n");
00764 #endif
00765     }
00766   else
00767     {
00768       yychar1 = YYTRANSLATE(yychar);
00769
00770 #if YYDEBUG != 0
00771       if (yydebug)
00772     {
00773       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
00774       /* Give the individual parser a way to print the precise meaning
00775          of a token, for further debugging info.  */
00776 #ifdef YYPRINT
00777       YYPRINT (stderr, yychar, yylval);
00778 #endif
00779       fprintf (stderr, ")\n");
00780     }
00781 #endif
00782     }
00783
00784   yyn += yychar1;
00785   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
00786     goto yydefault;
00787
00788   yyn = yytable[yyn];
00789
00790   /* yyn is what to do for this token type in this state.
00791      Negative => reduce, -yyn is rule number.
00792      Positive => shift, yyn is new state.
00793        New state is final state => don't bother to shift,
00794        just return success.
00795      0, or most negative number => error.  */
00796
00797   if (yyn < 0)
00798     {
00799       if (yyn == YYFLAG)
00800     goto yyerrlab;
00801       yyn = -yyn;
00802       goto yyreduce;
00803     }
00804   else if (yyn == 0)
00805     goto yyerrlab;
00806
00807   if (yyn == YYFINAL)
00808     YYACCEPT;
00809
00810   /* Shift the lookahead token.  */
00811
00812 #if YYDEBUG != 0
00813   if (yydebug)
00814     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
00815 #endif
00816
00817   /* Discard the token being shifted unless it is eof.  */
00818   if (yychar != YYEOF)
00819     yychar = YYEMPTY;
00820
00821   *++yyvsp = yylval;
00822 #ifdef YYLSP_NEEDED
00823   *++yylsp = yylloc;
00824 #endif
00825
00826   /* count tokens shifted since error; after three, turn off error status.  */
00827   if (yyerrstatus) yyerrstatus--;
00828
00829   yystate = yyn;
00830   goto yynewstate;
00831
00832 /* Do the default action for the current state.  */
00833 yydefault:
00834
00835   yyn = yydefact[yystate];
00836   if (yyn == 0)
00837     goto yyerrlab;
00838
00839 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
00840 yyreduce:
00841   yylen = yyr2[yyn];
00842   if (yylen > 0)
00843     yyval = yyvsp[1-yylen]; /* implement default value of the action */
00844
00845 #if YYDEBUG != 0
00846   if (yydebug)
00847     {
00848       int i;
00849
00850       fprintf (stderr, "Reducing via rule %d (line %d), ",
00851            yyn, yyrline[yyn]);
00852
00853       /* Print the symbols being reduced, and their result.  */
00854       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
00855     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
00856       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
00857     }
00858 #endif
00859
00860
00861   switch (yyn) {
00862
00863 case 5:
00864 #line 85 "parser.yy"
00865 {
00866                                         if(gRcsFile != 0L)
00867                                         {
00868                                             gRcsFile->AllRevs().push_back(CRevFile());
00869                                             gRevFile = &gRcsFile->LastRev();
00870                                         }
00871                                     ;
00872     break;}
00873 case 7:
00874 #line 93 "parser.yy"
00875 { gRcsFile = 0L; expect(kNone); ;
00876     break;}
00877 case 8:
00878 #line 94 "parser.yy"
00879 {
00880                                         int c = yyvsp[0].aint;
00881                                         yyclearin;
00882                                         expect(kAnyButSep);
00883                                         if(gRevFile != 0L)
00884                                             gRevFile->DescLog() << (char)c;
00885                                         else if(gRcsFile != 0L)
00886                                             gRcsFile->DescLog() << (char)c;
00887                                     ;
00888     break;}
00889 case 10:
00890 #line 104 "parser.yy"
00891 {
00892                                         expect(kAnyButSep);
00893                                         if(gRevFile != 0L)
00894                                             gRevFile->DescLog() << sStr;
00895                                         else if(gRcsFile != 0L)
00896                                             gRcsFile->DescLog() << sStr;
00897                                     ;
00898     break;}
00899 case 27:
00900 #line 138 "parser.yy"
00901 {
00902                             char c = yyvsp[0].aint;
00903                             if(gRevFile != 0L)
00904                                 gRevFile->DescLog() << c;
00905                             else if(gRcsFile != 0L)
00906                                 gRcsFile->DescLog() << c;
00907                         ;
00908     break;}
00909 case 28:
00910 #line 145 "parser.yy"
00911 {
00912                             if(gRevFile != 0L)
00913                                 gRevFile->DescLog() << yyvsp[0].string;
00914                             else if(gRcsFile != 0L)
00915                                 gRcsFile->DescLog() << yyvsp[0].string;
00916                             free(yyvsp[0].string);
00917                         ;
00918     break;}
00919 case 29:
00920 #line 155 "parser.yy"
00921 { expect(kAnyButSep); ;
00922     break;}
00923 case 34:
00924 #line 166 "parser.yy"
00925 {
00926                             char c = yyvsp[0].aint;
00927                             if(gRcsFile != 0L)
00928                                 gRcsFile->DescLog() << c;
00929                         ;
00930     break;}
00931 case 35:
00932 #line 171 "parser.yy"
00933 {
00934                             if(gRcsFile != 0L)
00935                                 gRcsFile->DescLog() << yyvsp[0].string;
00936                             free(yyvsp[0].string);
00937                         ;
00938     break;}
00939 case 38:
00940 #line 183 "parser.yy"
00941 { expect(kRevnum); ;
00942     break;}
00943 case 39:
00944 #line 184 "parser.yy"
00945 {
00946                                         if(gRevFile != 0L)
00947                                         {
00948                                             gRevFile->RevNum() = sRev;
00949                                         }
00950                                         sRev.reset();
00951                                     ;
00952     break;}
00953 case 40:
00954 #line 191 "parser.yy"
00955 { expect(kDate); ;
00956     break;}
00957 case 41:
00958 #line 192 "parser.yy"
00959 {
00960                                         if(gRevFile != 0L)
00961                                         {
00962                                             gRevFile->RevTime().tm_year = sInt - 1900;
00963                                         }
00964                                     ;
00965     break;}
00966 case 42:
00967 #line 198 "parser.yy"
00968 {
00969                                         if(gRevFile != 0L)
00970                                         {
00971                                             gRevFile->RevTime().tm_mon = sInt;
00972                                         }
00973                                     ;
00974     break;}
00975 case 43:
00976 #line 204 "parser.yy"
00977 {
00978                                         if(gRevFile != 0L)
00979                                         {
00980                                             gRevFile->RevTime().tm_mday = sInt;
00981                                         }
00982                                     ;
00983     break;}
00984 case 44:
00985 #line 210 "parser.yy"
00986 {
00987                                         if(gRevFile != 0L)
00988                                         {
00989                                             gRevFile->RevTime().tm_hour = sInt;
00990                                         }
00991                                     ;
00992     break;}
00993 case 45:
00994 #line 216 "parser.yy"
00995 {
00996                                         if(gRevFile != 0L)
00997                                         {
00998                                             gRevFile->RevTime().tm_min = sInt;
00999                                         }
01000                                     ;
01001     break;}
01002 case 46:
01003 #line 222 "parser.yy"
01004 {
01005                                         if(gRevFile != 0L)
01006                                         {
01007                                             gRevFile->RevTime().tm_sec = sInt;
01008                                         }
01009                                         expect(kNone);
01010                                     ;
01011     break;}
01012 case 48:
01013 #line 230 "parser.yy"
01014 { expect(kRevnum); ;
01015     break;}
01016 case 50:
01017 #line 233 "parser.yy"
01018 {
01019                                         if(gRevFile != 0L)
01020                                         {
01021                                             gRevFile->Author() = sStr;
01022                                         }
01023                                     ;
01024     break;}
01025 case 51:
01026 #line 240 "parser.yy"
01027 {
01028                                         if(gRevFile != 0L)
01029                                         {
01030                                             gRevFile->Locker() = sStr;
01031                                         }
01032                                     ;
01033     break;}
01034 case 52:
01035 #line 247 "parser.yy"
01036 {
01037                                         if(gRevFile != 0L)
01038                                         {
01039                                             gRevFile->State() = sStr;
01040                                         }
01041                                     ;
01042     break;}
01043 case 53:
01044 #line 253 "parser.yy"
01045 { expect(kInt); ;
01046     break;}
01047 case 54:
01048 #line 254 "parser.yy"
01049 {
01050                                         expect(kInt);
01051                                         if(gRevFile != 0L)
01052                                         {
01053                                             gRevFile->ChgPos() = sInt;
01054                                         }
01055                                     ;
01056     break;}
01057 case 55:
01058 #line 261 "parser.yy"
01059 {
01060                                         if(gRevFile != 0L)
01061                                         {
01062                                             gRevFile->ChgNeg() = sInt;
01063                                         }
01064                                     ;
01065     break;}
01066 case 59:
01067 #line 276 "parser.yy"
01068 {
01069                                     if(gRevFile != 0L)
01070                                     {
01071                                         gRevFile->BranchesList().push_back(sRev);
01072                                     }
01073
01074                                     sRev.reset();
01075                                     expect(kRevnum);
01076                                 ;
01077     break;}
01078 case 60:
01079 #line 288 "parser.yy"
01080 { sStr = yyvsp[0].string; free(yyvsp[0].string); ;
01081     break;}
01082 case 61:
01083 #line 292 "parser.yy"
01084 { sStr = yyvsp[0].string; free(yyvsp[0].string); ;
01085     break;}
01086 case 62:
01087 #line 296 "parser.yy"
01088 { sInt = yyvsp[0].aint; ;
01089     break;}
01090 case 63:
01091 #line 300 "parser.yy"
01092 { expect(kInt); ;
01093     break;}
01094 case 64:
01095 #line 301 "parser.yy"
01096 {
01097                                         if(gRcsFile != 0L)
01098                                         {
01099                                             gRcsFile->TotRevisions() = sInt;
01100                                         }
01101                                     ;
01102     break;}
01103 case 67:
01104 #line 312 "parser.yy"
01105 { expect(kInt); ;
01106     break;}
01107 case 68:
01108 #line 313 "parser.yy"
01109 {
01110                                         if(gRcsFile != 0L)
01111                                         {
01112                                             gRcsFile->SelRevisions() = sInt;
01113                                         }
01114                                     ;
01115     break;}
01116 case 69:
01117 #line 321 "parser.yy"
01118 { expect(kString); ;
01119     break;}
01120 case 70:
01121 #line 322 "parser.yy"
01122 {
01123                                     if(gRcsFile != 0L)
01124                                     {
01125                                         gRcsFile->KeywordSubst() = sStr;
01126                                     }
01127                                 ;
01128     break;}
01129 case 74:
01130 #line 340 "parser.yy"
01131 {
01132                                     expect(kRevnum);
01133                                     if(gRcsFile != 0L)
01134                                     {
01135                                         CRevNumber newRev;
01136                                         newRev.Tag() = sStr;
01137                                         gRcsFile->SymbolicList().push_back(newRev);
01138                                     }
01139                                 ;
01140     break;}
01141 case 75:
01142 #line 349 "parser.yy"
01143 {
01144                                     if(gRcsFile != 0L)
01145                                     {
01146                                         sRev.Tag() = gRcsFile->LastSymbName().Tag();
01147                                         gRcsFile->LastSymbName() = sRev;
01148                                     }
01149                                     sRev.reset();
01150                                 ;
01151     break;}
01152 case 79:
01153 #line 369 "parser.yy"
01154 {
01155                                     if(gRcsFile != 0L)
01156                                     {
01157                                         CLogStr newAccess;
01158                                         newAccess = sStr;
01159                                         gRcsFile->AccessList().push_back(newAccess);
01160                                     }
01161                                 ;
01162     break;}
01163 case 81:
01164 #line 378 "parser.yy"
01165 {
01166                                     if(gRcsFile != 0L)
01167                                     {
01168                                         CLogStr newAccess;
01169                                         newAccess = sStr;
01170                                         gRcsFile->AccessList().push_back(newAccess);
01171                                     }
01172                                 ;
01173     break;}
01174 case 82:
01175 #line 389 "parser.yy"
01176 {
01177                                             if(gRcsFile != 0L)
01178                                             {
01179                                                 gRcsFile->LockStrict() = false;
01180                                             }
01181                                         ;
01182     break;}
01183 case 84:
01184 #line 396 "parser.yy"
01185 {
01186                                             if(gRcsFile != 0L)
01187                                             {
01188                                                 gRcsFile->LockStrict() = true;
01189                                             }
01190                                         ;
01191     break;}
01192 case 88:
01193 #line 411 "parser.yy"
01194 {
01195                                     expect(kRevnum);
01196                                     if(gRcsFile != 0L)
01197                                     {
01198                                         CRevNumber newRev;
01199                                         newRev.Tag() = sStr;
01200                                         gRcsFile->LocksList().push_back(newRev);
01201                                     }
01202                                 ;
01203     break;}
01204 case 89:
01205 #line 420 "parser.yy"
01206 {
01207                                     if(gRcsFile != 0L)
01208                                     {
01209                                         sRev.Tag() = gRcsFile->LastLock().Tag();
01210                                         gRcsFile->LastLock() = sRev;
01211                                     }
01212                                     sRev.reset();
01213                                 ;
01214     break;}
01215 case 90:
01216 #line 431 "parser.yy"
01217 { expect(kRevnumOrNil); ;
01218     break;}
01219 case 91:
01220 #line 432 "parser.yy"
01221 {
01222                                 if(gRcsFile != 0L)
01223                                 {
01224                                     gRcsFile->BranchRev() = sRev;
01225                                 }
01226                                 sRev.reset();
01227                             ;
01228     break;}
01229 case 92:
01230 #line 442 "parser.yy"
01231 { expect(kRevnum); ;
01232     break;}
01233 case 93:
01234 #line 443 "parser.yy"
01235 {
01236                                 if(gRcsFile != 0L)
01237                                 {
01238                                     gRcsFile->HeadRev() = sRev;
01239                                 }
01240                                 sRev.reset();
01241                             ;
01242     break;}
01243 case 94:
01244 #line 453 "parser.yy"
01245 { expect(kString); ;
01246     break;}
01247 case 95:
01248 #line 454 "parser.yy"
01249 {
01250                                     if(gRcsFile != 0L)
01251                                     {
01252                                         gRcsFile->WorkingFile() = sStr;
01253                                     }
01254                                 ;
01255     break;}
01256 case 96:
01257 #line 463 "parser.yy"
01258 { expect(kString); ;
01259     break;}
01260 case 97:
01261 #line 464 "parser.yy"
01262 {
01263                                     // push a new rcs file
01264                                     gRcsFiles.push_back(CRcsFile());
01265                                     gRcsFile = &gRcsFiles[gRcsFiles.size() - 1];
01266                                     gRcsFile->RcsFile() = sStr;
01267                                 ;
01268     break;}
01269 }
01270    /* the action file gets copied in in place of this dollarsign */
01271 #line 542 "/usr/local/share/bison.simple"
01272
01273   yyvsp -= yylen;
01274   yyssp -= yylen;
01275 #ifdef YYLSP_NEEDED
01276   yylsp -= yylen;
01277 #endif
01278
01279 #if YYDEBUG != 0
01280   if (yydebug)
01281     {
01282       short *ssp1 = yyss - 1;
01283       fprintf (stderr, "state stack now");
01284       while (ssp1 != yyssp)
01285     fprintf (stderr, " %d", *++ssp1);
01286       fprintf (stderr, "\n");
01287     }
01288 #endif
01289
01290   *++yyvsp = yyval;
01291
01292 #ifdef YYLSP_NEEDED
01293   yylsp++;
01294   if (yylen == 0)
01295     {
01296       yylsp->first_line = yylloc.first_line;
01297       yylsp->first_column = yylloc.first_column;
01298       yylsp->last_line = (yylsp-1)->last_line;
01299       yylsp->last_column = (yylsp-1)->last_column;
01300       yylsp->text = 0;
01301     }
01302   else
01303     {
01304       yylsp->last_line = (yylsp+yylen-1)->last_line;
01305       yylsp->last_column = (yylsp+yylen-1)->last_column;
01306     }
01307 #endif
01308
01309   /* Now "shift" the result of the reduction.
01310      Determine what state that goes to,
01311      based on the state we popped back to
01312      and the rule number reduced by.  */
01313
01314   yyn = yyr1[yyn];
01315
01316   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
01317   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01318     yystate = yytable[yystate];
01319   else
01320     yystate = yydefgoto[yyn - YYNTBASE];
01321
01322   goto yynewstate;
01323
01324 yyerrlab:   /* here on detecting error */
01325
01326   if (! yyerrstatus)
01327     /* If not already recovering from an error, report this error.  */
01328     {
01329       ++yynerrs;
01330
01331 #ifdef YYERROR_VERBOSE
01332       yyn = yypact[yystate];
01333
01334       if (yyn > YYFLAG && yyn < YYLAST)
01335     {
01336       int size = 0;
01337       char *msg;
01338       int x, count;
01339
01340       count = 0;
01341       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
01342       for (x = (yyn < 0 ? -yyn : 0);
01343            x < (sizeof(yytname) / sizeof(char *)); x++)
01344         if (yycheck[x + yyn] == x)
01345           size += strlen(yytname[x]) + 15, count++;
01346       msg = (char *) malloc(size + 15);
01347       if (msg != 0)
01348         {
01349           strcpy(msg, "parse error");
01350
01351           if (count < 5)
01352         {
01353           count = 0;
01354           for (x = (yyn < 0 ? -yyn : 0);
01355                x < (sizeof(yytname) / sizeof(char *)); x++)
01356             if (yycheck[x + yyn] == x)
01357               {
01358             strcat(msg, count == 0 ? ", expecting `" : " or `");
01359             strcat(msg, yytname[x]);
01360             strcat(msg, "'");
01361             count++;
01362               }
01363         }
01364           yyerror(msg);
01365           free(msg);
01366         }
01367       else
01368         yyerror ("parse error; also virtual memory exceeded");
01369     }
01370       else
01371 #endif /* YYERROR_VERBOSE */
01372     yyerror("parse error");
01373     }
01374
01375   goto yyerrlab1;
01376 yyerrlab1:   /* here on error raised explicitly by an action */
01377
01378   if (yyerrstatus == 3)
01379     {
01380       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
01381
01382       /* return failure if at end of input */
01383       if (yychar == YYEOF)
01384     YYABORT;
01385
01386 #if YYDEBUG != 0
01387       if (yydebug)
01388     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
01389 #endif
01390
01391       yychar = YYEMPTY;
01392     }
01393
01394   /* Else will try to reuse lookahead token
01395      after shifting the error token.  */
01396
01397   yyerrstatus = 3;      /* Each real token shifted decrements this */
01398
01399   goto yyerrhandle;
01400
01401 yyerrdefault:  /* current state does not do anything special for the error token. */
01402
01403 #if 0
01404   /* This is wrong; only states that explicitly want error tokens
01405      should shift them.  */
01406   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
01407   if (yyn) goto yydefault;
01408 #endif
01409
01410 yyerrpop:   /* pop the current state because it cannot handle the error token */
01411
01412   if (yyssp == yyss) YYABORT;
01413   yyvsp--;
01414   yystate = *--yyssp;
01415 #ifdef YYLSP_NEEDED
01416   yylsp--;
01417 #endif
01418
01419 #if YYDEBUG != 0
01420   if (yydebug)
01421     {
01422       short *ssp1 = yyss - 1;
01423       fprintf (stderr, "Error: state stack now");
01424       while (ssp1 != yyssp)
01425     fprintf (stderr, " %d", *++ssp1);
01426       fprintf (stderr, "\n");
01427     }
01428 #endif
01429
01430 yyerrhandle:
01431
01432   yyn = yypact[yystate];
01433   if (yyn == YYFLAG)
01434     goto yyerrdefault;
01435
01436   yyn += YYTERROR;
01437   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
01438     goto yyerrdefault;
01439
01440   yyn = yytable[yyn];
01441   if (yyn < 0)
01442     {
01443       if (yyn == YYFLAG)
01444     goto yyerrpop;
01445       yyn = -yyn;
01446       goto yyreduce;
01447     }
01448   else if (yyn == 0)
01449     goto yyerrpop;
01450
01451   if (yyn == YYFINAL)
01452     YYACCEPT;
01453
01454 #if YYDEBUG != 0
01455   if (yydebug)
01456     fprintf(stderr, "Shifting error token, ");
01457 #endif
01458
01459   *++yyvsp = yylval;
01460 #ifdef YYLSP_NEEDED
01461   *++yylsp = yylloc;
01462 #endif
01463
01464   yystate = yyn;
01465   goto yynewstate;
01466
01467  yyacceptlab:
01468   /* YYACCEPT comes here.  */
01469   if (yyfree_stacks)
01470     {
01471       free (yyss);
01472       free (yyvs);
01473 #ifdef YYLSP_NEEDED
01474       free (yyls);
01475 #endif
01476     }
01477   return 0;
01478
01479  yyabortlab:
01480   /* YYABORT comes here.  */
01481   if (yyfree_stacks)
01482     {
01483       free (yyss);
01484       free (yyvs);
01485 #ifdef YYLSP_NEEDED
01486       free (yyls);
01487 #endif
01488     }
01489   return 1;
01490 }

void yyreset ( void )

Definition at line 1519 of file parser.cc.

01520 {
01521     currentLineNumber = 1;
01522     sStr = "";
01523     sInt = 0;
01524     sRev.reset();
01525     gRcsFiles.erase(gRcsFiles.begin(), gRcsFiles.end());
01526     gRcsFile = 0L;
01527     gRevFile = 0L;
01528     expect(kNone);
01529 }

Variable Documentation

int sInt [static]

Definition at line 68 of file parser.cc.

CRevNumber sRev [static]

Definition at line 70 of file parser.cc.

CLogStr sStr [static]

Definition at line 69 of file parser.cc.

int yychar

Definition at line 456 of file parser.cc.

const short yycheck[] [static]

Initial value:

 {     1,
    91,    30,    93,     0,     1,    30,     4,    30,     5,     7,
     4,     8,     9,     7,    11,    12,    13,    14,    30,    16,
    17,    18,    19,    66,    67,    30,    23,    24,    15,   120,
    20,    21,    22,     3,   125,    25,     4,    27,    28,    29,
   131,    30,    30,   134,    30,   136,    30,    30,   139,    30,
    30,   142,    30,    30,    30,    30,     5,    30,    60,    61,
     6,     6,     6,    30,     6,     6,    32,    32,    32,    32,
    72,    73,    74,     8,     9,    30,    11,    12,    13,    14,
    31,    16,    17,    18,    19,    10,     6,     0,     0,    32,
    30,    84,    31,    30,    30,    -1,    -1,    -1,    32,    32,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,   115
}

Definition at line 306 of file parser.cc.

const short yydefact[] [static]

Initial value:

 {     2,
     0,     8,    61,     5,     7,     3,     4,    10,    24,    36,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    13,    23,    22,    21,    20,    19,    18,    17,    16,    15,
    14,    24,     9,     6,    29,    63,    69,    72,    77,    82,
    90,    92,    94,    96,    11,    28,    27,    25,    38,     0,
     0,     0,     0,     0,     0,    37,    31,     0,     0,    71,
    76,    84,    86,     0,     0,     0,     0,     0,    40,    48,
    53,     0,     0,     0,    30,    62,    64,    60,    70,     0,
    73,    81,    78,    86,    83,    91,    93,    95,    97,    39,
     0,    56,     0,     0,     0,     0,    35,    34,    32,    66,
    74,    79,    85,     0,    87,     0,    49,    54,    51,    50,
    52,     0,    65,     0,     0,    88,    41,     0,    57,     0,
     0,    75,    80,     0,     0,    59,    55,    67,    89,     0,
     0,    42,    68,     0,    43,     0,     0,    44,     0,     0,
    45,     0,    46,     0,    47,     0,     0,     0
}

Definition at line 233 of file parser.cc.

const short yydefgoto[] [static]

Initial value:

 {   146,
     1,     6,    10,     9,    32,     7,    21,    33,    48,    22,
    57,    75,    99,    34,    56,    68,    91,   125,   134,   136,
   139,   142,   144,    92,    93,   120,   107,   119,    79,   104,
    77,    23,    58,   100,   113,   131,    24,    59,    25,    60,
    81,   114,    26,    61,    83,   115,    27,    63,    84,    85,
   105,   124,    28,    64,    29,    65,    30,    66,    31,    67
}

Definition at line 251 of file parser.cc.

YYSTYPE yylval

Definition at line 457 of file parser.cc.

int yynerrs

Definition at line 465 of file parser.cc.

const short yypact[] [static]

Initial value:

 {-32768,
     4,-32768,-32768,-32768,-32768,-32768,    66,-32768,-32768,-32768,
   -28,   -24,   -22,   -11,    -4,    12,    13,    15,    17,    18,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,     3,    11,-32768,-32768,-32768,-32768,-32768,    14,
-32768,-32768,-32768,-32768,     3,-32768,-32768,-32768,-32768,    20,
    21,    23,    24,    25,    26,-32768,-32768,    31,    33,    52,
    52,-32768,-32768,    55,    56,    33,    33,    57,-32768,-32768,
-32768,    52,    52,    52,     7,-32768,-32768,-32768,-32768,    28,
-32768,    34,-32768,-32768,    52,-32768,-32768,-32768,-32768,-32768,
    31,-32768,    31,    35,    36,    37,-32768,-32768,-32768,    38,
-32768,-32768,    52,    46,-32768,    50,    59,-32768,-32768,-32768,
-32768,    76,-32768,    60,    52,-32768,-32768,    58,-32768,    31,
    61,-32768,-32768,    81,    31,-32768,-32768,-32768,-32768,    62,
    31,-32768,-32768,    31,-32768,    31,    64,-32768,    31,    65,
-32768,    31,-32768,    67,-32768,    88,    89,-32768
}

Definition at line 260 of file parser.cc.

const short yypgoto[] [static]

Initial value:

 {-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,    68,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   -42,    -1,
   -90,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,     8,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768
}

Definition at line 278 of file parser.cc.

const short yyr1[] [static]

Initial value:

 {     0,
    33,    34,    34,    35,    36,    35,    35,    37,    35,    38,
    35,    39,    39,    40,    40,    40,    40,    40,    40,    40,
    40,    40,    40,    41,    41,    42,    42,    42,    44,    43,
    45,    45,    46,    46,    46,    47,    47,    49,    48,    50,
    51,    52,    53,    54,    55,    56,    48,    57,    48,    48,
    48,    48,    58,    59,    48,    60,    60,    61,    61,    62,
    63,    64,    66,    67,    65,    68,    69,    68,    71,    70,
    72,    73,    73,    75,    74,    76,    77,    77,    79,    78,
    78,    81,    80,    82,    80,    83,    83,    85,    84,    87,
    86,    89,    88,    91,    90,    93,    92
}

Definition at line 207 of file parser.cc.

const short yyr2[] [static]

Initial value:

 {     0,
     1,     0,     2,     1,     0,     3,     1,     0,     3,     0,
     3,     0,     2,     1,     1,     1,     1,     1,     1,     1,
     1,     1,     1,     0,     2,     0,     1,     1,     0,     4,
     0,     2,     0,     1,     1,     0,     2,     0,     3,     0,
     0,     0,     0,     0,     0,     0,    20,     0,     4,     4,
     4,     4,     0,     0,     6,     0,     2,     0,     2,     1,
     1,     1,     0,     0,     6,     0,     0,     5,     0,     4,
     3,     0,     2,     0,     4,     3,     0,     2,     0,     4,
     1,     0,     4,     0,     5,     0,     2,     0,     4,     0,
     4,     0,     4,     0,     4,     0,     4
}

Definition at line 220 of file parser.cc.

const short yytable[] [static]

Initial value:

 {     8,
   106,    35,   108,    -1,     2,    36,    46,    37,     3,    47,
    97,   -12,   -12,    98,   -12,   -12,   -12,   -12,    38,   -12,
   -12,   -12,   -12,    88,    89,    39,     4,     5,    62,   127,
    49,    50,    51,    76,   130,    52,    78,    53,    54,    55,
   133,    40,    41,   135,    42,   137,    43,    44,   140,    69,
    70,   143,    71,    72,    73,    74,     3,   101,    80,    82,
    86,    87,    90,   102,   118,   122,   109,   110,   111,   112,
    94,    95,    96,    11,    12,   116,    13,    14,    15,    16,
   117,    17,    18,    19,    20,   121,   129,   147,   148,   126,
   128,   103,   132,   138,   141,     0,     0,     0,   145,    45,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,   123
}

Definition at line 291 of file parser.cc.

const char yytranslate[] [static]

Definition at line 93 of file parser.cc.

Generated on Sun Oct 21 12:44:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


parser.cpp File Reference

cvstree/parser.cpp File Reference

#include "parser.cc"

Include dependency graph for parser.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


parser.h File Reference

cvstree/parser.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

union | YYSTYPE

Defines

#define | INTEGER 257
#define | STRING 258
#define | TAG 259
#define | REVNUM 260
#define | ID_CHAR 261
#define | ID_DESCRIPTION 262
#define | ID_TOTREVISIONS 263
#define | ID_SELREVISIONS 264
#define | ID_KEYWORD 265
#define | ID_SYMBOLIC 266
#define | ID_ACCESS 267
#define | ID_LOCKS 268
#define | ID_STRICT 269
#define | ID_BRANCH 270
#define | ID_HEAD 271
#define | ID_WORKING 272
#define | ID_RCS 273
#define | ID_REVISION 274
#define | ID_DATE 275
#define | ID_BRANCHES 276
#define | ID_REVFOLLOW 277
#define | ID_ENDFOLLOW 278
#define | ID_LINES 279
#define | ID_ANYBUTSEP 280
#define | ID_LOCKEDBY 281
#define | ID_AUTHOR 282
#define | ID_STATE 283

Variables

YYSTYPE yylval

Define Documentation

#define ID_ACCESS 267

Definition at line 15 of file parser.h.

#define ID_ANYBUTSEP 280

Definition at line 28 of file parser.h.

#define ID_AUTHOR 282

Definition at line 30 of file parser.h.

#define ID_BRANCH 270

Definition at line 18 of file parser.h.

#define ID_BRANCHES 276

Definition at line 24 of file parser.h.

#define ID_CHAR 261

Definition at line 9 of file parser.h.

#define ID_DATE 275

Definition at line 23 of file parser.h.

#define ID_DESCRIPTION 262

Definition at line 10 of file parser.h.

#define ID_ENDFOLLOW 278

Definition at line 26 of file parser.h.

#define ID_HEAD 271

Definition at line 19 of file parser.h.

#define ID_KEYWORD 265

Definition at line 13 of file parser.h.

#define ID_LINES 279

Definition at line 27 of file parser.h.

#define ID_LOCKEDBY 281

Definition at line 29 of file parser.h.

#define ID_LOCKS 268

Definition at line 16 of file parser.h.

#define ID_RCS 273

Definition at line 21 of file parser.h.

#define ID_REVFOLLOW 277

Definition at line 25 of file parser.h.

#define ID_REVISION 274

Definition at line 22 of file parser.h.

#define ID_SELREVISIONS 264

Definition at line 12 of file parser.h.

#define ID_STATE 283

Definition at line 31 of file parser.h.

#define ID_STRICT 269

Definition at line 17 of file parser.h.

#define ID_SYMBOLIC 266

Definition at line 14 of file parser.h.

#define ID_TOTREVISIONS 263

Definition at line 11 of file parser.h.

#define ID_WORKING 272

Definition at line 20 of file parser.h.

#define INTEGER 257

Definition at line 5 of file parser.h.

#define REVNUM 260

Definition at line 8 of file parser.h.

#define STRING 258

Definition at line 6 of file parser.h.

#define TAG 259

Definition at line 7 of file parser.h.

Variable Documentation

YYSTYPE yylval

Definition at line 34 of file parser.h.

Generated on Sun Oct 21 12:44:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


unistd.h File Reference

cvstree/compat/unistd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


uconfig.h File Reference

rf/uconfig.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define UEXPORT

Define Documentation

#define UEXPORT

Definition at line 27 of file uconfig.h.

Generated on Sun Oct 21 12:44:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


uconsole.cpp File Reference

rf/uconsole.cpp File Reference

#include "stdafx.h"
#include <stdio.h>
#include <stdarg.h>
#include "uconsole.h"

Include dependency graph for uconsole.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void UAppConsole (const char *format,...)

Function Documentation

void UAppConsole | ( | const char * | format,
 |  | ... |
 | ) |

Definition at line 42 of file uconsole.cpp.

00043 {
00044     va_list args;
00045     char mess[1024] = {'\0'};
00046
00047     UASSERT(format != NULL);
00048
00049     va_start (args, format);
00050     vsprintf (mess, format, args);
00051     va_end (args);
00052
00053 #if qGTK
00054     g_warning(mess);
00055 #elif defined(qUnix)
00056 #elif qMacAPP
00057 #   if qDebug
00058     DebugWarning_AC(1, mess, __FILE__, __LINE__);
00059 #   endif
00060 #elif qMacPP
00061     SignalString_(mess);
00062 #elif defined(WIN32)
00063 #   ifdef _DEBUG
00064     _CrtDbgReport(_CRT_WARN, __FILE__, __LINE__, NULL, mess);
00065 #   endif
00066 #else
00067     (void)printf(mess);
00068     (void)fflush(stdout);
00069 #endif
00070 }

Generated on Sun Oct 21 12:44:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


uconsole.h File Reference

rf/uconsole.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | UTHROW(a) throw a

Functions

void | UAppConsole (const char *format,...)

Define Documentation

#define UTHROW ( a ) throw a

Definition at line 31 of file uconsole.h.

Function Documentation

void UAppConsole | ( | const char * | format,
 |  | ... |
 | ) |

Definition at line 42 of file uconsole.cpp.

Referenced by UWidget::DoModal(), UWidget::EndModal(), UPseudoPageHider::ExecuteSelf(), UCvsConsole::FeedThisLine(), UWidget::GetTooltip(), UWidget::GetWidget(), UToolbar::OnCommands(), UCvsConsole::OnCreate(), UMacAppMenu::OnUpdateUI(), UCvsConsole::OutColor(), CPersistent::Register(), UCmdTarget::UDispatchMessage(), UEventSendMessage(), UEventSendMessageExt(), CPersistent::UnRegister(), cvs_err(), cvs_errstr(), cvs_out(), cvs_outstr(), UStr::set(), and UPStr::set().

00043 {
00044     va_list args;
00045     char mess[1024] = {'\0'};
00046
00047     UASSERT(format != NULL);
00048
00049     va_start (args, format);
00050     vsprintf (mess, format, args);
00051     va_end (args);
00052
00053 #if qGTK
00054     g_warning(mess);
00055 #elif defined(qUnix)
00056 #elif qMacAPP
00057 #   if qDebug
00058     DebugWarning_AC(1, mess, __FILE__, __LINE__);
00059 #   endif
00060 #elif qMacPP
00061     SignalString_(mess);
00062 #elif defined(WIN32)
00063 #   ifdef _DEBUG
00064     _CrtDbgReport(_CRT_WARN, __FILE__, __LINE__, NULL, mess);
00065 #   endif
00066 #else
00067     (void)printf(mess);
00068     (void)fflush(stdout);
00069 #endif
00070 }

Generated on Sun Oct 21 12:44:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


udraw.cpp File Reference

rf/udraw.cpp File Reference

#include "stdafx.h"
#include "udraw.h"
#include "uwidget.h"

Include dependency graph for udraw.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | MIN(a, b) ((a) < (b) ? (a) : (b))
#define | MAX(a, b) ((a) > (b) ? (a) : (b))

Functions

bool | PtInRect (const URECT *r, UPOINT pt)
void | SetRect (URECT *r, int x1, int y1, int x2, int y2)
void | SetRectEmpty (URECT *r)
bool | EqualRect (const URECT *r1, const URECT *r2)
void | InflateRect (URECT *r, int x, int y)
void | OffsetRect (URECT *r, int x, int y)
bool | IsRectEmpty (const URECT *r)
bool | UnionRect (URECT *dest, const URECT *src1, const URECT *src2)
bool | IntersectRect (URECT *dest, const URECT *src1, const URECT *src2)

Define Documentation

#define MAX | ( | a,
 |  | b | ) | ((a) > (b) ? (a) : (b))

Definition at line 35 of file udraw.cpp.

#define MIN | ( | a,
 |  | b | ) | ((a) < (b) ? (a) : (b))

Definition at line 31 of file udraw.cpp.

Function Documentation

bool EqualRect | ( | const URECT * | r1,
 |  | const URECT * | r2
 | ) |

Definition at line 64 of file udraw.cpp.

00065 {
00066     return r1->left == r2->left && r1->top == r2->top &&
00067         r1->right == r2->right && r1->bottom == r2->bottom;
00068 }

void InflateRect | ( | URECT * | r,
 |  | int | x,
 |  | int | y
 | ) |

Definition at line 69 of file udraw.cpp.

00070 {
00071     r->left += x;
00072     r->top += y;
00073     r->right -= x;
00074     r->bottom -= y;
00075     if(r->left > r->right)
00076         r->left = r->right;
00077     if(r->top > r->bottom)
00078         r->top = r->bottom;
00079 }

bool IntersectRect | ( | URECT * | dest,
 |  | const URECT * | src1,
 |  | const URECT * | src2
 | ) |

Definition at line 113 of file udraw.cpp.

00114 {
00115     const URECT *temp;
00116     bool return_val = false;
00117
00118     if (src2->left < src1->left)
00119     {
00120         temp = src1;
00121         src1 = src2;
00122         src2 = temp;
00123     }
00124     dest->left = src2->left;
00125
00126     if (src2->left < src1->right)
00127     {
00128         if (src1->right < src2->right)
00129             dest->right = src1->right;
00130         else
00131             dest->right = src2->right;
00132
00133         if (src2->top < src1->top)
00134         {
00135             temp = src1;
00136             src1 = src2;
00137             src2 = temp;
00138         }
00139         dest->top = src2->top;
00140
00141         if (src2->top < src1->bottom)
00142         {
00143             return_val = true;
00144
00145             if (src1->bottom < src2->bottom)
00146                 dest->bottom = src1->bottom;
00147             else
00148                 dest->bottom = src2->bottom;
00149
00150             if (dest->left == dest->right)
00151                 return_val = false;
00152             if (dest->top == dest->bottom)
00153                 return_val = false;
00154         }
00155     }
00156
00157     return return_val;
00158 }

bool IsRectEmpty ( const URECT * r ) [inline]

Definition at line 89 of file udraw.cpp.

00090 {
00091     return r->left == r->right || r->top == r->bottom;
00092 }

void OffsetRect | ( | URECT * | r,
 |  | int | x,
 |  | int | y
 | ) |

Definition at line 81 of file udraw.cpp.

00082 {
00083     r->left += x;
00084     r->right += x;
00085     r->top += y;
00086     r->bottom += y;
00087 }

bool PtInRect | ( | const URECT * | r,
 |  | UPOINT | pt
 | ) |

Definition at line 38 of file udraw.cpp.

00039 {
00040     return pt.x >= r->left && pt.x < r->right &&
00041         pt.y >= r->top && pt.y < r->bottom;
00042 }

void SetRect | ( | URECT * | r,
 |  | int | x1,
 |  | int | y1,
 |  | int | x2,
 |  | int | y2
 | ) |

Definition at line 44 of file udraw.cpp.

00045 {
00046     r->left = x1;
00047     r->top = y1;
00048     r->right = x2;
00049     r->bottom = y2;
00050     if(r->left > r->right)
00051         r->left = r->right;
00052     if(r->top > r->bottom)
00053         r->top = r->bottom;
00054 }

void SetRectEmpty ( URECT * r )

Definition at line 56 of file udraw.cpp.

00057 {
00058     r->left = 0;
00059     r->top = 0;
00060     r->right = 0;
00061     r->bottom = 0;
00062 }

bool UnionRect | ( | URECT * | dest,
 |  | const URECT * | src1,
 |  | const URECT * | src2
 | ) |

Definition at line 94 of file udraw.cpp.

00095 {
00096     if(::IsRectEmpty(src1))
00097     {
00098         *dest = *src2;
00099         return true;
00100     }
00101     if(::IsRectEmpty(src2))
00102     {
00103         *dest = *src1;
00104         return true;
00105     }
00106     dest->left = MIN (src1->left, src2->left);
00107     dest->top = MIN (src1->top, src2->top);
00108     dest->right = MAX (src1->right, src2->right);
00109     dest->bottom = MAX (src1->bottom, src2->bottom);
00110     return true;
00111 }

Generated on Sun Oct 21 12:44:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


udraw.h File Reference

rf/udraw.h File Reference

#include "uconfig.h"
#include "umain.h"

Include dependency graph for udraw.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | UBrush
class | UDC
class | UPen
class | UPoint
class | URect
class | USize

Defines

#define | URGB(r, g, b) ((UCOLORREF)(((unsigned char)(r)|((unsigned short)((unsigned char)(g))<<8))|(((unsigned int)(unsigned char)(b))<<16)))
#define | UGetRValue(rgb) ((unsigned char)(rgb))
#define | UGetGValue(rgb) ((unsigned char)(((unsigned short)(rgb)) >> 8))
#define | UGetBValue(rgb) ((unsigned char)((rgb)>>16))
#define | UPS_SOLID 0

Typedefs

typedef long | UCOLORREF

Functions

bool | PtInRect (const URECT *r, UPOINT pt)
void | SetRect (URECT *r, int x1, int y1, int x2, int y2)
void | SetRectEmpty (URECT *r)
bool | EqualRect (const URECT *r1, const URECT *r2)
void | InflateRect (URECT *r, int x, int y)
void | OffsetRect (URECT *r, int x, int y)
bool | UnionRect (URECT *dest, const URECT *src1, const URECT *src2)
bool | IntersectRect (URECT *dest, const URECT *src1, const URECT *src2)
void | CopyRect (URECT *dst, const URECT *src)

Define Documentation

#define UGetBValue ( rgb ) ((unsigned char)((rgb)>>16))

Definition at line 458 of file udraw.h.

#define UGetGValue ( rgb ) ((unsigned char)(((unsigned short)(rgb)) >> 8))

Definition at line 457 of file udraw.h.

#define UGetRValue ( rgb ) ((unsigned char)(rgb))

Definition at line 456 of file udraw.h.

Referenced by UPen::CreatePen(), and UBrush::CreateSolidBrush().

#define UPS_SOLID 0

Definition at line 460 of file udraw.h.

#define URGB | ( | r,
 |  | g,
 |  | b | ) | ((UCOLORREF)(((unsigned char)(r)|((unsigned short)((unsigned char)(g))<<8))|(((unsigned int)(unsigned char)(b))<<16)))

Definition at line 455 of file udraw.h.

Referenced by DrawNode(), CWinLogData::Update(), CWinLogBranchData::UpdateSelf(), CWinLogTagData::UpdateSelf(), CWinLogRevData::UpdateSelf(), and CWinLogHeaderData::UpdateSelf().

Typedef Documentation

typedef long UCOLORREF

Definition at line 454 of file udraw.h.

Function Documentation

void CopyRect | ( | URECT * | dst,
 |  | const URECT * | src
 | ) | [inline]

Definition at line 42 of file udraw.h.

00042 { *dst = *src; }

bool EqualRect | ( | const URECT * | r1,
 |  | const URECT * | r2
 | ) |

Definition at line 64 of file udraw.cpp.

Referenced by URect::EqualRect(), and URect::operator==().

00065 {
00066     return r1->left == r2->left && r1->top == r2->top &&
00067         r1->right == r2->right && r1->bottom == r2->bottom;
00068 }

void InflateRect | ( | URECT * | r,
 |  | int | x,
 |  | int | y
 | ) |

Definition at line 69 of file udraw.cpp.

Referenced by URect::operator+().

00070 {
00071     r->left += x;
00072     r->top += y;
00073     r->right -= x;
00074     r->bottom -= y;
00075     if(r->left > r->right)
00076         r->left = r->right;
00077     if(r->top > r->bottom)
00078         r->top = r->bottom;
00079 }

bool IntersectRect | ( | URECT * | dest,
 |  | const URECT * | src1,
 |  | const URECT * | src2
 | ) |

Definition at line 113 of file udraw.cpp.

Referenced by URect::IntersectRect().

00114 {
00115     const URECT *temp;
00116     bool return_val = false;
00117
00118     if (src2->left < src1->left)
00119     {
00120         temp = src1;
00121         src1 = src2;
00122         src2 = temp;
00123     }
00124     dest->left = src2->left;
00125
00126     if (src2->left < src1->right)
00127     {
00128         if (src1->right < src2->right)
00129             dest->right = src1->right;
00130         else
00131             dest->right = src2->right;
00132
00133         if (src2->top < src1->top)
00134         {
00135             temp = src1;
00136             src1 = src2;
00137             src2 = temp;
00138         }
00139         dest->top = src2->top;
00140
00141         if (src2->top < src1->bottom)
00142         {
00143             return_val = true;
00144
00145             if (src1->bottom < src2->bottom)
00146                 dest->bottom = src1->bottom;
00147             else
00148                 dest->bottom = src2->bottom;
00149
00150             if (dest->left == dest->right)
00151                 return_val = false;
00152             if (dest->top == dest->bottom)
00153                 return_val = false;
00154         }
00155     }
00156
00157     return return_val;
00158 }

void OffsetRect | ( | URECT * | r,
 |  | int | x,
 |  | int | y
 | ) |

Definition at line 81 of file udraw.cpp.

00082 {
00083     r->left += x;
00084     r->right += x;
00085     r->top += y;
00086     r->bottom += y;
00087 }

bool PtInRect | ( | const URECT * | r,
 |  | UPOINT | pt
 | ) |

Definition at line 38 of file udraw.cpp.

Referenced by CPseudoToggle::OnLButtonUp(), and URect::PtInRect().

00039 {
00040     return pt.x >= r->left && pt.x < r->right &&
00041         pt.y >= r->top && pt.y < r->bottom;
00042 }

void SetRect | ( | URECT * | r,
 |  | int | x1,
 |  | int | y1,
 |  | int | x2,
 |  | int | y2
 | ) |

Definition at line 44 of file udraw.cpp.

00045 {
00046     r->left = x1;
00047     r->top = y1;
00048     r->right = x2;
00049     r->bottom = y2;
00050     if(r->left > r->right)
00051         r->left = r->right;
00052     if(r->top > r->bottom)
00053         r->top = r->bottom;
00054 }

void SetRectEmpty ( URECT * r )

Definition at line 56 of file udraw.cpp.

Referenced by CCJToolBar::GetItemRect().

00057 {
00058     r->left = 0;
00059     r->top = 0;
00060     r->right = 0;
00061     r->bottom = 0;
00062 }

bool UnionRect | ( | URECT * | dest,
 |  | const URECT * | src1,
 |  | const URECT * | src2
 | ) |

Definition at line 94 of file udraw.cpp.

Referenced by URect::UnionRect().

00095 {
00096     if(::IsRectEmpty(src1))
00097     {
00098         *dest = *src2;
00099         return true;
00100     }
00101     if(::IsRectEmpty(src2))
00102     {
00103         *dest = *src1;
00104         return true;
00105     }
00106     dest->left = MIN (src1->left, src2->left);
00107     dest->top = MIN (src1->top, src2->top);
00108     dest->right = MAX (src1->right, src2->right);
00109     dest->bottom = MAX (src1->bottom, src2->bottom);
00110     return true;
00111 }

Generated on Sun Oct 21 12:44:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


uevent.cpp File Reference

rf/uevent.cpp File Reference

#include "stdafx.h"
#include <time.h>
#include "umain.h"
#include "uconsole.h"
#include "uwidget.h"
#include <map>

Include dependency graph for uevent.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CAllTargets
union | UMessageMapFunctions
class | CMsg
class | CTurnOffDispatching

Defines

#define | MIN_IDLE 100

Functions

int | UEventSendMessage (int wid, int evt, int arg1, void *arg2)
int | UEventSendMessageExt (int wid, int evt, int arg1, void *arg2, int *handledFlag)
int | UEventPostMessage (int wid, int evt, int arg1, void *arg2)
int | UEventNotifyMessage (int evt, int arg1, void *arg2)
int | UEventGetWidID (void)
UCmdTarget * | UEventQueryWidget (int widid)
void | UEventRemoveWidID (int widid)
void | UEventSetTooltipHandler (void(*handler)(const char *))
void | UEventGiveTime (void)
long | UTickCount (void)
const std::map< int, UCmdTarget *> & | UEventGetTargets (void)

Variables

long | sLastIdle = 0
void(* | sTooltipHandler )(const char *)=0L
CAllTargets sAllTargets
bool | sTurnOffDispatching = false
std::vector< CMsg > sRetainedMsgs

Define Documentation

#define MIN_IDLE 100

minimum idle used by the framework to handle the timers

Definition at line 74 of file uevent.cpp.

Function Documentation

const std:: map<int, UCmdTarget *>& UEventGetTargets ( void )

Definition at line 763 of file uevent.cpp.

Referenced by LMainPseudoAttachment::ExecuteSelf(), UWidget::HasModal(), UToolbar::OnCommands(), UMenu::OnCommands(), UToolbar::OnUpdateUI(), UMenu::OnUpdateUI(), and UMacAppMenu::OnUpdateUI().

00764 {
00765     return sAllTargets.Get();
00766 }

int UEventGetWidID ( void )

Definition at line 296 of file uevent.cpp.

Referenced by ULIST_INFO::data().

00297 {
00298     static int newid = 100;
00299     return newid++;
00300 }

void UEventGiveTime ( void )

Definition at line 673 of file uevent.cpp.

Referenced by ULIST_INFO::data().

00674 {
00675     STD map< int, UCmdTarget * >::const_iterator iter;
00676     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00677
00678     // post the retained events
00679     while(!sRetainedMsgs.empty())
00680     {
00681         CMsg msg = *sRetainedMsgs.begin();
00682         sRetainedMsgs.erase(sRetainedMsgs.begin());
00683         UEventSendMessage(msg.m_wid, msg.m_ev, msg.m_arg1, msg.m_arg2);
00684     }
00685
00686     // take care about the EV_UPDATEUI notification
00687     if(!UWidget::IsUIValid())
00688     {
00689         UWidget::DoValidUI(true);
00690
00691         // warn the widget it's going to happen so they can cache
00692         // some informations.
00693         for(iter = targets.begin(); iter != targets.end(); ++iter)
00694         {
00695             UCmdTarget *target = (*iter).second;
00696             if(!target->IsKindOf(URUNTIME_CLASS(UWidget)))
00697                 continue;
00698
00699             UWidget *wid = (UWidget *)target;
00700             wid->BeforeUpdateUI();
00701         }
00702
00703         for(iter = targets.begin(); iter != targets.end(); ++iter)
00704         {
00705             UCmdTarget *target = (*iter).second;
00706             if(!target->IsKindOf(URUNTIME_CLASS(UWidget)))
00707                 continue;
00708
00709             UWidget *wid = (UWidget *)target;
00710             UEventSendMessage(wid->GetWidID(), EV_UPDATEUI, 0, 0L);
00711         }
00712     }
00713
00714     long thisIdle = UTickCount();
00715     if((thisIdle - sLastIdle) < MIN_IDLE)
00716         return;
00717
00718     // search the timers
00719     for(iter = targets.begin(); iter != targets.end(); ++iter)
00720     {
00721         UCmdTarget *target = (*iter).second;
00722         if(!target->IsKindOf(URUNTIME_CLASS(UWidget)))
00723             continue;
00724
00725         UWidget *wid = (UWidget *)target;
00726         std::vector<UTimer> & timers = wid->GetTimers();
00727         std::vector<UTimer>::iterator t;
00728         for(t = timers.begin(); t != timers.end(); ++t)
00729         {
00730             UTimer & timer = *t;
00731             if((thisIdle - timer.m_lastlap) >= timer.m_lap)
00732             {
00733                 // trigger the timer
00734                 timer.m_lastlap = thisIdle;
00735                 UEventSendMessage(wid->GetWidID(), EV_TIMER, timer.m_cmd, (void *)thisIdle);
00736             }
00737         }
00738     }
00739
00740     sLastIdle = thisIdle;
00741 }

int UEventNotifyMessage | ( | int | evt,
 |  | int | arg1,
 |  | void * | arg2
 | ) |

Definition at line 269 of file uevent.cpp.

00270 {
00271     STD map< int, UCmdTarget * >::const_iterator iter;
00272     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00273     int res = 0;
00274
00275     for(iter = targets.begin(); iter != targets.end(); ++iter)
00276     {
00277         UCmdTarget *target = (*iter).second;
00278         UCmdTarget::UDispatchInfo dispatchInfo = UCmdTarget::kUNoDispatchInfo;
00279 #if qDebug
00280         try {
00281 #endif
00282         res = target->UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00283 #if qDebug
00284         } catch(...) {
00285             UASSERT(0);
00286             throw;
00287         }
00288 #endif
00289         if(res)
00290             break;
00291     }
00292
00293     return res;
00294 }

int UEventPostMessage | ( | int | wid,
 |  | int | evt,
 |  | int | arg1,
 |  | void * | arg2
 | ) |

Definition at line 262 of file uevent.cpp.

00263 {
00264     sRetainedMsgs.push_back(CMsg(wid, evt, arg1, arg2));
00265     return 0;
00266 }

UCmdTarget* UEventQueryWidget ( int widid )

Definition at line 302 of file uevent.cpp.

00303 {
00304     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00305     STD map< int, UCmdTarget * >::const_iterator iter = targets.find(widid);
00306     if(iter != targets.end())
00307     {
00308         UCmdTarget *target = (*iter).second;
00309         return target;
00310     }
00311     return 0L;
00312 }

void UEventRemoveWidID ( int widid )

Definition at line 314 of file uevent.cpp.

00315 {
00316     STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00317     STD map<int, UCmdTarget *>::iterator i = targets.find(widid);
00318     if(i == targets.end())
00319         return;
00320     targets.erase(i);
00321 }

int UEventSendMessage | ( | int | wid,
 |  | int | evt,
 |  | int | arg1,
 |  | void * | arg2
 | ) |

Definition at line 199 of file uevent.cpp.

00200 {
00201     if(sTurnOffDispatching)
00202         return 0;
00203
00204     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00205     STD map< int, UCmdTarget * >::const_iterator iter = targets.find(wid);
00206     int res = 0;
00207
00208     if(iter != targets.end())
00209     {
00210         UCmdTarget *target = (*iter).second;
00211         UCmdTarget::UDispatchInfo dispatchInfo = UCmdTarget::kUNoDispatchInfo;
00212 #if qDebug
00213         try {
00214 #endif
00215         res = target->UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00216 #if qDebug
00217         } catch(...) {
00218             UASSERT(0);
00219             throw;
00220         }
00221 #endif
00222     }
00223     else
00224     {
00225         UAppConsole("Unknown widget id : %d\n", wid);
00226     }
00227
00228     return res;
00229 }

int UEventSendMessageExt | ( | int | wid,
 |  | int | evt,
 |  | int | arg1,
 |  | void * | arg2,
 |  | int * | handledFlag
 | ) |

Definition at line 231 of file uevent.cpp.

00232 {
00233     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00234     STD map< int, UCmdTarget * >::const_iterator iter = targets.find(wid);
00235     int res = 0;
00236     UCmdTarget::UDispatchInfo dispatchInfo = UCmdTarget::kUNoDispatchInfo;
00237
00238     if(iter != targets.end())
00239     {
00240         UCmdTarget *target = (*iter).second;
00241 #if qDebug
00242         try {
00243 #endif
00244         res = target->UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00245 #if qDebug
00246         } catch(...) {
00247             UASSERT(0);
00248             throw;
00249         }
00250 #endif
00251     }
00252     else
00253     {
00254         UAppConsole("Unknown widget id : %d\n", wid);
00255     }
00256
00257     *handledFlag = (dispatchInfo & UCmdTarget::kUDispatchHandled) != 0;
00258     return res;
00259 }

void UEventSetTooltipHandler ( void(* handler)(const char *) )

Definition at line 668 of file uevent.cpp.

00669 {
00670     sTooltipHandler = handler;
00671 }

long UTickCount ( void )

Definition at line 743 of file uevent.cpp.

Referenced by UWidget::AddTimer(), UEventGiveTime(), and ULIST_INFO::data().

00744 {
00745 #ifdef WIN32
00746     return ::GetTickCount();
00747 #elif defined(macintosh)
00748     long res = ::TickCount();
00749     return res = (float)res * (1000.0 / 60.0);
00750 #else
00751     struct timeval tval;
00752     static long refcount;
00753
00754     gettimeofday(&tval, 0L);
00755
00756     if(refcount == 0)
00757         refcount = tval.tv_sec;
00758
00759     return (tval.tv_sec - refcount) * 1000 + tval.tv_usec / 1000;
00760 #endif
00761 }

Variable Documentation

class CAllTargets sAllTargets

long sLastIdle = 0 [static]

Definition at line 76 of file uevent.cpp.

std::vector<CMsg> sRetainedMsgs [static]

Definition at line 178 of file uevent.cpp.

void(* sTooltipHandler)(const char *) = 0L [static]

Definition at line 81 of file uevent.cpp.

Referenced by UCmdUI::SetTooltip().

bool sTurnOffDispatching = false [static]

Definition at line 121 of file uevent.cpp.

Generated on Sun Oct 21 12:44:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


umain.h File Reference

rf/umain.h File Reference

#include "uobject.h"
#include <map>

Include dependency graph for umain.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | UCmdTarget
class | UCmdUI
struct | ULIST_INFO
struct | ULIST_INSERT
struct | UMSGMAP
struct | UMSGMAP_ENTRY
struct | UPOINT
struct | URECT
class | USemaphore
struct | USIZE
struct | USLIDER
struct | UTB_BUTTON
struct | UTB_DROPDOWN
struct | UTB_INIT
struct | UTREE_INFO
struct | UTREE_INSERT

Defines

#define | STD std::
#define | ON_UCREATE(baseClass)
#define | ON_UDESTROY(baseClass)
#define | ON_UENTER(baseClass)
#define | ON_ULEAVE(baseClass)
#define | ON_UEXPOSE(baseClass)
#define | ON_UMMOVE(baseClass)
#define | ON_UBTNDOWN(baseClass)
#define | ON_UBTNUP(baseClass)
#define | ON_UBTNDBLDOWN(baseClass)
#define | ON_KEYDOWN(baseClass)
#define | ON_RESIZE(cmd, hook)
#define | ON_SETCURSOR(baseClass)
#define | ON_CHGCURSOR(baseClass, cmdmin, cmdmax)
#define | ON_TB_INIT(baseClass)
#define | ON_TB_END(baseClass)
#define | ON_TB_BUTTON(baseClass)
#define | ON_TB_DROPDOWN(baseClass)
#define | ON_TB_CHECKBTN(baseClass)
#define | ON_TB_GETCOLOR(baseClass)
#define | ON_TB_SEPARATOR(baseClass)
#define | ON_UCOMMAND(cmd, hook)
#define | ON_UCOMMAND_RANGE(cmdmin, cmdmax, hook)
#define | ON_UCOMMAND_RANGEEX(cmdmin, cmdmax, hook)
#define | ON_UUPDATECMD(cmd, hook)
#define | ON_FETCHCMD(baseClass, cmdmin, cmdmax)
#define | ON_UUPDATECMD_RANGE(cmdmin, cmdmax, hook)
#define | ON_USETTOOLTIP(cmdmin, cmdmax, hook)
#define | ON_UGETLLOC(cmdmin, cmdmax, hook)
#define | ON_USETLLOC(cmdmin, cmdmax, hook)
#define | ON_QUERYSTATE(cmdmin, cmdmax, hook)
#define | ON_EDITCHANGE(cmd, hook)
#define | ON_EDITCHANGE_RANGE(cmdmin, cmdmax, hook)
#define | ON_EDITACTIVATE(cmd, hook)
#define | ON_EDITACTIVATE_RANGE(cmdmin, cmdmax, hook)
#define | ON_SCROLLCHANGE(cmd, hook)
#define | ON_SCROLLCHANGE_RANGE(cmdmin, cmdmax, hook)
#define | ON_TIMER(cmd, hook)
#define | ON_UPDATEUI(baseClass)
#define | ON_UPDATEFOCUS(baseClass)
#define | ON_SETSTATE(cmdmin, cmdmax, hook)
#define | ON_ENABLECMD(cmdmin, cmdmax, hook)
#define | ON_CHGFOCUS(baseClass, cmdmin, cmdmax)
#define | ON_INVALIDATE(baseClass, cmdmin, cmdmax)
#define | ON_REDRAW(baseClass, cmdmin, cmdmax)
#define | ON_SHOW_WIDGET(cmd, hook)
#define | ON_PAGE_CHANGED(baseClass, cmdmin, cmdmax)
#define | ON_SHOW_WIDGET_RANGE(cmdmin, cmdmax, hook)
#define | ON_DROPREF(cmdmin, cmdmax, hook)
#define | ON_UNOTIFY(cmd, hook)
#define | ON_INIT_WIDGET(baseClass, cmdmin, cmdmax)
#define | ON_INIT_TAB_WIDGET(baseClass, cmdmin, cmdmax)
#define | ON_SETTEXT(cmdmin, cmdmax, hook)
#define | ON_GETTEXT(cmdmin, cmdmax, hook)
#define | ON_SETFLOAT(baseClass, cmdmin, cmdmax)
#define | ON_GETFLOAT(baseClass, cmdmin, cmdmax)
#define | ON_DRAGQUERY(cmd, hook)
#define | ON_DROPQUERY(cmd, hook)
#define | ON_DROPIT(cmd, hook)
#define | ON_DRAGQUERY_RANGE(cmdmin, cmdmax, hook)
#define | ON_DROPQUERY_RANGE(cmdmin, cmdmax, hook)
#define | ON_DROPIT_RANGE(cmdmin, cmdmax, hook)
#define | ON_DROPQUERY_CMDID(baseClass)
#define | ON_SET_SLIDER(baseClass, cmdmin, cmdmax)
#define | ON_GET_SLIDERPROP(baseClass, cmdmin, cmdmax)
#define | ON_SET_SLIDERPROP(baseClass, cmdmin, cmdmax)
#define | ON_TREE_RESETALL(baseClass, cmdmin, cmdmax)
#define | ON_TREE_INSERT(baseClass, cmdmin, cmdmax)
#define | ON_TREE_GETINFO(baseClass, cmdmin, cmdmax)
#define | ON_TREE_SETDATA(baseClass, cmdmin, cmdmax)
#define | ON_TREE_SETICON(baseClass, cmdmin, cmdmax)
#define | ON_TREE_DELETE(baseClass, cmdmin, cmdmax)
#define | ON_TREE_EXPAND(baseClass, cmdmin, cmdmax)
#define | ON_TREE_SELECT(baseClass, cmdmin, cmdmax)
#define | ON_TREE_GETSEL(baseClass, cmdmin, cmdmax)
#define | ON_TREE_EXPANDING(cmd, hook)
#define | ON_TREE_SELECTING(cmd, hook)
#define | ON_LIST_SELECTING(cmd, hook)
#define | ON_LIST_SELCOLUMN(cmd, hook)
#define | ON_LIST_RESORT(baseClass, cmdmin, cmdmax)
#define | ON_LIST_DBLCLICK(cmd, hook)
#define | ON_LIST_ADDSEL(baseClass, cmdmin, cmdmax)
#define | ON_LIST_DELROW(baseClass, cmdmin, cmdmax)
#define | ON_LIST_RESETALL(baseClass, cmdmin, cmdmax)
#define | ON_LIST_ADDCOLUMNS(baseClass, cmdmin, cmdmax)
#define | ON_LIST_SETFEEDBACK(baseClass, cmdmin, cmdmax)
#define | ON_LIST_SETCOLTITLE(baseClass, cmdmin, cmdmax)
#define | ON_LIST_SETCOLWIDTH(baseClass, cmdmin, cmdmax)
#define | ON_LIST_NEWROW(baseClass, cmdmin, cmdmax)
#define | ON_LIST_ROWSETDATA(baseClass, cmdmin, cmdmax)
#define | ON_LIST_ROWGETDATA(baseClass, cmdmin, cmdmax)
#define | ON_LIST_INSERT(baseClass, cmdmin, cmdmax)
#define | ON_LIST_GETNEXTSEL(baseClass, cmdmin, cmdmax)
#define | ON_LIST_GETNEXT(baseClass, cmdmin, cmdmax)
#define | ON_LIST_GETINFO(baseClass, cmdmin, cmdmax)
#define | ON_COMBO_RESETALL(baseClass, cmdmin, cmdmax)
#define | ON_COMBO_APPEND(baseClass, cmdmin, cmdmax)
#define | ON_COMBO_SETSEL(baseClass, cmdmin, cmdmax)
#define | ON_COMBO_DELSEL(baseClass, cmdmin, cmdmax)
#define | ON_COMBO_ENABLESEL(baseClass, cmdmin, cmdmax)
#define | ON_COMBO_GETSEL(baseClass, cmdmin, cmdmax)
#define | ON_COMBO_GETMENU(baseClass, cmdmin, cmdmax)
#define | ON_COMBO_GETCOUNT(baseClass, cmdmin, cmdmax)
#define | ON_COMBO_SEL(cmd, hook)
#define | ON_COMBO_SEL_RANGE(cmdmin, cmdmax, hook)
#define | ON_CUSTOM_DRAW(cmd, hook)
#define | ON_CUSTOM_DRAW_RANGE(cmdmin, cmdmax, hook)
#define | UDECLARE_MESSAGE_MAP()
#define | UBEGIN_MESSAGE_MAP(theClass, baseClass)
#define | UEND_MESSAGE_MAP()
#define | ev_msg
#define | UMAKEINT(a, b) ((int)(((short)(a)) | ((int)((short)(b))) << 16))
#define | ULOWORD(l) ((short)(l))
#define | UHIWORD(l) ((short)(((int)(l) >> 16) & 0xFFFF))
#define | UK_LBUTTON 0x01
#define | UK_MBUTTON 0x02
#define | UK_RBUTTON 0x04
#define | UK_CONTROL 0x08
#define | UK_SHIFT 0x10
#define | UK_ALT 0x20
#define | UK_CANCEL 0x03
#define | UK_BACK 0x08
#define | UK_TAB 0x09
#define | UK_CLEAR 0x0C
#define | UK_RETURN 0x0D
#define | UK_ESCAPE 0x1B
#define | UK_SPACE 0x20
#define | UK_PRIOR 0x21
#define | UK_NEXT 0x22
#define | UK_END 0x23
#define | UK_HOME 0x24
#define | UK_LEFT 0x25
#define | UK_UP 0x26
#define | UK_RIGHT 0x27
#define | UK_DOWN 0x28
#define | UK_INSERT 0x2D
#define | UK_DELETE 0x2E
#define | UK_HELP 0x2F
#define | UK_PLUS 0x6B
#define | UK_MINUS 0x6D
#define | UK_NUMPAD0 0x60
#define | UK_NUMPAD1 0x61
#define | UK_NUMPAD2 0x62
#define | UK_NUMPAD3 0x63
#define | UK_NUMPAD4 0x64
#define | UK_NUMPAD5 0x65
#define | UK_NUMPAD6 0x66
#define | UK_NUMPAD7 0x67
#define | UK_NUMPAD8 0x68
#define | UK_NUMPAD9 0x69
#define | UK_MULTIPLY 0x6A
#define | UK_ADD 0x6B
#define | UK_SEPARATOR 0x6C
#define | UK_SUBTRACT 0x6D
#define | UK_DECIMAL 0x6E
#define | UK_DIVIDE 0x6F
#define | UK_F1 0x70
#define | UK_F2 0x71
#define | UK_F3 0x72
#define | UK_F4 0x73
#define | UK_F5 0x74
#define | UK_F6 0x75
#define | UK_F7 0x76
#define | UK_F8 0x77
#define | UK_F9 0x78
#define | UK_F10 0x79
#define | UK_F11 0x7A
#define | UK_F12 0x7B
#define | UK_F13 0x7C
#define | UK_F14 0x7D
#define | UK_F15 0x7E
#define | UK_F16 0x7F
#define | UK_F17 0x80
#define | UK_F18 0x81
#define | UK_F19 0x82
#define | UK_F20 0x83
#define | UK_F21 0x84
#define | UK_F22 0x85
#define | UK_F23 0x86
#define | UK_F24 0x87
#define | UMENU_NULL ((UMENU)0L)
#define | UTB_SEPARATOR (-1)
#define | UMakeBitmap(b) 0L

Typedefs

typedef void(UCmdTarget::* | UPMSG )(void)
typedef long | UMENU
typedef void * | UTREEITEM
typedef int(* | UListSorter )(UWidget *wid, void *data1, void *data2)

Enumerations

enum UEventType {
EV_NONE, EV_CREATE, EV_DESTROY, EV_ENTER,
EV_LEAVE, EV_EXPOSE, EV_MMOVE, EV_BTNDOWN,
EV_BTNUP, EV_BTNDBLDOWN, EV_KEYDOWN, EV_SETCURSOR,
EV_CHGCURSOR, EV_RESIZE, EV_GETLOC, EV_SETLOC,
EV_CMD, EV_UPDTCMD, EV_ENABLECMD, EV_FETCHCMD,
EV_SETTOOLTIP, EV_QUERYSTATE, EV_GETINTEGER = EV_QUERYSTATE, EV_SETSTATE,
EV_SETINTEGER = EV_SETSTATE, EV_CHGFOCUS, EV_INVALIDATE, EV_REDRAW,
EV_GETTEXT, EV_SETTEXT, EV_GETFLOAT, EV_SETFLOAT,
EV_INIT_WIDGET, EV_INIT_TAB_WIDGET, EV_SHOW_WIDGET, EV_PAGE_CHANGED,
EV_NOTIFY, EV_EDITCHANGE, EV_EDITACTIVATE, EV_TIMER,
EV_UPDATEUI, EV_UPDATEFOCUS, EV_DRAGQUERY, EV_DROPQUERY,
EV_DROPIT, EV_DROPQUERY_CMDID, EV_DROPREF, EV_TB_INIT,
EV_TB_END, EV_TB_BUTTON, EV_TB_DROPDOWN, EV_TB_CHECKBTN,
EV_TB_SEPARATOR, EV_TB_GETCOLOR, EV_SET_SLIDER, EV_GET_SLIDERPROP,
EV_SET_SLIDERPROP, EV_SCROLLCHANGE, EV_CUSTOM_DRAW, EV_TREE_RESETALL,
EV_TREE_INSERT, EV_TREE_GETINFO, EV_TREE_SETDATA, EV_TREE_SETICON,
EV_TREE_DELETE, EV_TREE_EXPANDING, EV_TREE_SELECTING, EV_TREE_EXPAND,
EV_TREE_SELECT, EV_TREE_GETSEL, EV_LIST_SELECTING, EV_LIST_SELCOLUMN,
EV_LIST_RESORT, EV_LIST_DBLCLICK, EV_LIST_RESETALL, EV_LIST_SETFEEDBACK,
EV_LIST_ADDCOLUMNS, EV_LIST_SETCOLTITLE, EV_LIST_SETCOLWIDTH, EV_LIST_NEWROW,
EV_LIST_ROWSETDATA, EV_LIST_ROWGETDATA, EV_LIST_INSERT, EV_LIST_ADDSEL,
EV_LIST_DELROW, EV_LIST_GETNEXTSEL, EV_LIST_GETINFO, EV_LIST_GETNEXT,
EV_COMBO_RESETALL, EV_COMBO_APPEND, EV_COMBO_SETSEL, EV_COMBO_GETSEL,
EV_COMBO_SEL, EV_COMBO_GETCOUNT, EV_COMBO_DELSEL, EV_COMBO_ENABLESEL,
EV_COMBO_GETMENU, EV_COMMAND_START = 1000
}
enum UEventParam {
epNone, epV_V, epV_VP, epV_iVP,
epV_IVP, epV_i, epV_I, epV_ii,
epV_iii, epV_iiVP, epi_i, epi_V,
epi_ii, epi_iVP, epi_VP
}
enum | UMSG_EXT { UMSG_NOEXT, UMSG_RANGE }
enum | UTB_VAR { DDV_NONE }
enum | UTB_DROP { DDD_NONE = 0x00 }
enum | UCURSOR { uCursArrow, uCursWatch }

Functions

int | UEventSendMessage (int wid, int evt, int arg1, void *arg2)
int | UEventSendMessageExt (int wid, int evt, int arg1, void *arg2, int *handledFlag)
int | UEventPostMessage (int wid, int evt, int arg1, void *arg2)
int | UEventNotifyMessage (int evt, int arg1, void *arg2)
int | UEventGetWidID (void)
void | UEventRemoveWidID (int widid)
void | UEventSetTooltipHandler (void(*handler)(const char *))
void | UEventGiveTime (void)
long | UTickCount (void)
UCmdTarget * | UEventQueryWidget (int widid)
const std::map< int, UCmdTarget *> & | UEventGetTargets (void)

Define Documentation

#define ON_CHGCURSOR | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_CHGCURSOR, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, UCURSOR cursor))&baseClass::OnChgCursor },

Definition at line 218 of file umain.h.

#define ON_CHGFOCUS | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_CHGFOCUS, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnChgFocus },

Definition at line 334 of file umain.h.

#define ON_COMBO_APPEND | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_COMBO_APPEND, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, const char *txt))&baseClass::OnComboAppend },

Definition at line 550 of file umain.h.

#define ON_COMBO_DELSEL | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_COMBO_DELSEL, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int sel))&baseClass::OnComboDelSel },

Definition at line 558 of file umain.h.

#define ON_COMBO_ENABLESEL | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_COMBO_ENABLESEL, epV_iii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int sel, int state))&baseClass::OnComboEnableSel },

Definition at line 562 of file umain.h.

#define ON_COMBO_GETCOUNT | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_COMBO_GETCOUNT, epi_i, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(int (UCmdTarget::*)(int cmd))&baseClass::OnComboGetCount },

Definition at line 574 of file umain.h.

#define ON_COMBO_GETMENU | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_COMBO_GETMENU, epi_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, UMENU *menu))&baseClass::OnComboGetMenu },

Definition at line 570 of file umain.h.

#define ON_COMBO_GETSEL | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_COMBO_GETSEL, epi_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(int (UCmdTarget::*)(int cmd, UStr *txt))&baseClass::OnComboGetPos },

Definition at line 566 of file umain.h.

#define ON_COMBO_RESETALL | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_COMBO_RESETALL, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnComboResetAll },

Definition at line 546 of file umain.h.

#define ON_COMBO_SEL | ( | cmd,
 |  | hook | )

Value:

{ EV_COMBO_SEL, epV_IVP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(int pos, const char *txt))&hook },

Definition at line 578 of file umain.h.

#define ON_COMBO_SEL_RANGE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_COMBO_SEL, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int pos, const char *txt))&hook },

Definition at line 582 of file umain.h.

#define ON_COMBO_SETSEL | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_COMBO_SETSEL, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int sel))&baseClass::OnComboSetPos },

Definition at line 554 of file umain.h.

#define ON_CUSTOM_DRAW | ( | cmd,
 |  | hook | )

Value:

{ EV_CUSTOM_DRAW, epV_VP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(void *drawInfo))&hook },

Definition at line 586 of file umain.h.

#define ON_CUSTOM_DRAW_RANGE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_CUSTOM_DRAW, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, void *drawInfo))&hook },

Definition at line 590 of file umain.h.

#define ON_DRAGQUERY | ( | cmd,
 |  | hook | )

Value:

{ EV_DRAGQUERY, epV_VP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(UDragable *))&hook },

Definition at line 390 of file umain.h.

#define ON_DRAGQUERY_RANGE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_DRAGQUERY, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int, UDragable *))&hook },

Definition at line 402 of file umain.h.

#define ON_DROPIT | ( | cmd,
 |  | hook | )

Value:

{ EV_DROPIT, epV_VP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(const UDragable *))&hook },

Definition at line 398 of file umain.h.

#define ON_DROPIT_RANGE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_DROPIT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int, const UDragable *))&hook },

Definition at line 410 of file umain.h.

#define ON_DROPQUERY | ( | cmd,
 |  | hook | )

Value:

{ EV_DROPQUERY, epV_VP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(UDropable **))&hook },

Definition at line 394 of file umain.h.

#define ON_DROPQUERY_CMDID ( baseClass )

Value:

{ EV_DROPQUERY_CMDID, epV_iiVP, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(int, int, int *))&baseClass::OnDropQueryCmdID },

Definition at line 414 of file umain.h.

#define ON_DROPQUERY_RANGE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_DROPQUERY, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int, UDropable **))&hook },

Definition at line 406 of file umain.h.

#define ON_DROPREF | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_DROPREF, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int numref, long *refs))&hook },

Definition at line 358 of file umain.h.

#define ON_EDITACTIVATE | ( | cmd,
 |  | hook | )

Value:

{ EV_EDITACTIVATE, epV_V, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(void))&hook },

Definition at line 298 of file umain.h.

#define ON_EDITACTIVATE_RANGE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_EDITACTIVATE, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd))&hook },

Definition at line 302 of file umain.h.

#define ON_EDITCHANGE | ( | cmd,
 |  | hook | )

Value:

{ EV_EDITCHANGE, epV_V, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(void))&hook },

Definition at line 290 of file umain.h.

#define ON_EDITCHANGE_RANGE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_EDITCHANGE, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd))&hook },

Definition at line 294 of file umain.h.

#define ON_ENABLECMD | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_ENABLECMD, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int state))&hook },

Definition at line 330 of file umain.h.

#define ON_FETCHCMD | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_FETCHCMD, epi_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(int (UCmdTarget::*)(int cmd, void *widget))&baseClass::OnFetchCmd },

Definition at line 266 of file umain.h.

#define ON_GETFLOAT | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_GETFLOAT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, float *f))&baseClass::OnGetFloat },

Definition at line 386 of file umain.h.

#define ON_GETTEXT | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_GETTEXT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int, UStr *))&hook },

Definition at line 378 of file umain.h.

#define ON_GET_SLIDERPROP | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_GET_SLIDERPROP, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, USLIDER *prop))&baseClass::OnGetSliderProperty },

Definition at line 422 of file umain.h.

#define ON_INIT_TAB_WIDGET | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_INIT_TAB_WIDGET, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int, int, void *))&baseClass::OnInitTabWidget },

Definition at line 370 of file umain.h.

#define ON_INIT_WIDGET | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_INIT_WIDGET, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int, void *))&baseClass::OnInitWidget },

Definition at line 366 of file umain.h.

#define ON_INVALIDATE | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_INVALIDATE, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnInvalidate },

Definition at line 338 of file umain.h.

#define ON_KEYDOWN ( baseClass )

Value:

{ EV_KEYDOWN, epV_i, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(int c))&baseClass::OnKeyDown },

Definition at line 206 of file umain.h.

#define ON_LIST_ADDCOLUMNS | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_ADDCOLUMNS, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int num))&baseClass::OnListAddColumns },

Definition at line 502 of file umain.h.

#define ON_LIST_ADDSEL | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_ADDSEL, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int entry))&baseClass::OnListAddSel },

Definition at line 490 of file umain.h.

#define ON_LIST_DBLCLICK | ( | cmd,
 |  | hook | )

Value:

{ EV_LIST_DBLCLICK, epV_V, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(void))&hook },

Definition at line 486 of file umain.h.

#define ON_LIST_DELROW | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_DELROW, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int row))&baseClass::OnListDelRow },

Definition at line 494 of file umain.h.

#define ON_LIST_GETINFO | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_GETINFO, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, ULIST_INFO *data))&baseClass::OnListGetInfo },

Definition at line 542 of file umain.h.

#define ON_LIST_GETNEXT | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_GETNEXT, epi_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(int (UCmdTarget::*)(int cmd, int whichCell))&baseClass::OnListGetNext },

Definition at line 538 of file umain.h.

#define ON_LIST_GETNEXTSEL | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_GETNEXTSEL, epi_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(int (UCmdTarget::*)(int cmd, int selectedCell))&baseClass::OnListGetNextSel },

Definition at line 534 of file umain.h.

#define ON_LIST_INSERT | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_INSERT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, ULIST_INSERT *data))&baseClass::OnListInsert },

Definition at line 530 of file umain.h.

#define ON_LIST_NEWROW | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_NEWROW, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int *num))&baseClass::OnListNewRow },

Definition at line 518 of file umain.h.

#define ON_LIST_RESETALL | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_RESETALL, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnListResetAll },

Definition at line 498 of file umain.h.

#define ON_LIST_RESORT | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_RESORT, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int column, UListSorter s))&baseClass::OnListResort },

Definition at line 482 of file umain.h.

#define ON_LIST_ROWGETDATA | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_ROWGETDATA, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int row, void **data))&baseClass::OnListRowGetData },

Definition at line 526 of file umain.h.

#define ON_LIST_ROWSETDATA | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_ROWSETDATA, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int row, void *data))&baseClass::OnListRowSetData },

Definition at line 522 of file umain.h.

#define ON_LIST_SELCOLUMN | ( | cmd,
 |  | hook | )

Value:

{ EV_LIST_SELCOLUMN, epV_I, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(int entry))&hook },

Definition at line 478 of file umain.h.

#define ON_LIST_SELECTING | ( | cmd,
 |  | hook | )

Value:

{ EV_LIST_SELECTING, epV_IVP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(int entry, const char *txt))&hook },

Definition at line 474 of file umain.h.

#define ON_LIST_SETCOLTITLE | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_SETCOLTITLE, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int num, const char *title))&baseClass::OnListSetColTitle },

Definition at line 510 of file umain.h.

#define ON_LIST_SETCOLWIDTH | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_SETCOLWIDTH, epV_iii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int num, int width))&baseClass::OnListSetColWidth },

Definition at line 514 of file umain.h.

#define ON_LIST_SETFEEDBACK | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_LIST_SETFEEDBACK, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int turnOn))&baseClass::OnListSetFeedback },

Definition at line 506 of file umain.h.

#define ON_PAGE_CHANGED | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_PAGE_CHANGED, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int pagenum))&baseClass::OnPageChanged },

Definition at line 350 of file umain.h.

#define ON_QUERYSTATE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_QUERYSTATE, epi_i, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(int (UCmdTarget::*)(int cmd))&hook },

Definition at line 286 of file umain.h.

#define ON_REDRAW | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_REDRAW, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnRedraw },

Definition at line 342 of file umain.h.

#define ON_RESIZE | ( | cmd,
 |  | hook | )

Value:

{ EV_RESIZE, epV_VP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(const URECT * r))&hook },

Definition at line 210 of file umain.h.

#define ON_SCROLLCHANGE | ( | cmd,
 |  | hook | )

Value:

{ EV_SCROLLCHANGE, epV_VP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(int pos))&hook },

Definition at line 306 of file umain.h.

#define ON_SCROLLCHANGE_RANGE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_SCROLLCHANGE, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int pos))&hook },

Definition at line 310 of file umain.h.

#define ON_SETCURSOR ( baseClass )

Value:

{ EV_SETCURSOR, epV_V, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnSetCursor },

Definition at line 214 of file umain.h.

#define ON_SETFLOAT | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_SETFLOAT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, const float *f))&baseClass::OnSetFloat },

Definition at line 382 of file umain.h.

#define ON_SETSTATE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_SETSTATE, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int state))&hook },

Definition at line 326 of file umain.h.

#define ON_SETTEXT | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_SETTEXT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int, const char *))&hook },

Definition at line 374 of file umain.h.

#define ON_SET_SLIDER | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_SET_SLIDER, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int pos))&baseClass::OnSetSlider },

Definition at line 418 of file umain.h.

#define ON_SET_SLIDERPROP | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_SET_SLIDERPROP, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, const USLIDER *prop))&baseClass::OnSetSliderProperty },

Definition at line 426 of file umain.h.

#define ON_SHOW_WIDGET | ( | cmd,
 |  | hook | )

Value:

{ EV_SHOW_WIDGET, epV_I, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(int state))&hook },

Definition at line 346 of file umain.h.

#define ON_SHOW_WIDGET_RANGE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_SHOW_WIDGET, epV_ii, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int state))&hook },

Definition at line 354 of file umain.h.

#define ON_TB_BUTTON ( baseClass )

Value:

{ EV_TB_BUTTON, epV_VP, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(UTB_BUTTON *info))&baseClass::OnTbButton },

Definition at line 230 of file umain.h.

#define ON_TB_CHECKBTN ( baseClass )

Value:

{ EV_TB_CHECKBTN, epV_VP, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(UTB_BUTTON *info))&baseClass::OnTbCheckBtn },

Definition at line 238 of file umain.h.

#define ON_TB_DROPDOWN ( baseClass )

Value:

{ EV_TB_DROPDOWN, epV_VP, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(UTB_DROPDOWN *info))&baseClass::OnTbDropDown },

Definition at line 234 of file umain.h.

#define ON_TB_END ( baseClass )

Value:

{ EV_TB_END, epV_V, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnTbEnd },

Definition at line 226 of file umain.h.

#define ON_TB_GETCOLOR ( baseClass )

Value:

{ EV_TB_GETCOLOR, epV_iVP, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, float *color))&baseClass::OnTbGetColor },

Definition at line 242 of file umain.h.

#define ON_TB_INIT ( baseClass )

Value:

{ EV_TB_INIT, epV_VP, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(UTB_INIT *info))&baseClass::OnTbInit },

Definition at line 222 of file umain.h.

#define ON_TB_SEPARATOR ( baseClass )

Value:

{ EV_TB_SEPARATOR, epV_V, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnTbSeparator },

Definition at line 246 of file umain.h.

#define ON_TIMER | ( | cmd,
 |  | hook | )

Value:

{ EV_TIMER, epV_VP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(long time))&hook },

Definition at line 314 of file umain.h.

#define ON_TREE_DELETE | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_TREE_DELETE, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, UTREEITEM item))&baseClass::OnTreeDelete },

Definition at line 450 of file umain.h.

#define ON_TREE_EXPAND | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_TREE_EXPAND, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int collapse, UTREEITEM item))&baseClass::OnTreeExpand },

Definition at line 454 of file umain.h.

#define ON_TREE_EXPANDING | ( | cmd,
 |  | hook | )

Value:

{ EV_TREE_EXPANDING, epV_IVP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(int collapse, UTREEITEM item))&hook },

Definition at line 466 of file umain.h.

#define ON_TREE_GETINFO | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_TREE_GETINFO, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, UTREE_INFO *data))&baseClass::OnTreeGetInfo },

Definition at line 438 of file umain.h.

#define ON_TREE_GETSEL | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_TREE_GETSEL, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, UTREEITEM *item))&baseClass::OnTreeGetSel },

Definition at line 462 of file umain.h.

#define ON_TREE_INSERT | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_TREE_INSERT, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, UTREE_INSERT *data))&baseClass::OnTreeInsert },

Definition at line 434 of file umain.h.

#define ON_TREE_RESETALL | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_TREE_RESETALL, epV_i, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd))&baseClass::OnTreeResetAll },

Definition at line 430 of file umain.h.

#define ON_TREE_SELECT | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_TREE_SELECT, epV_iiVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, int deselect, UTREEITEM item))&baseClass::OnTreeSelect },

Definition at line 458 of file umain.h.

#define ON_TREE_SELECTING | ( | cmd,
 |  | hook | )

Value:

{ EV_TREE_SELECTING, epV_IVP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(int deselect, UTREEITEM item))&hook },

Definition at line 470 of file umain.h.

#define ON_TREE_SETDATA | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_TREE_SETDATA, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, UTREE_INFO *data))&baseClass::OnTreeSetData },

Definition at line 442 of file umain.h.

#define ON_TREE_SETICON | ( | baseClass,
 |  | cmdmin,
 |  | cmdmax | )

Value:

{ EV_TREE_SETICON, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, UTREE_INFO *data))&baseClass::OnTreeSetIcon },

Definition at line 446 of file umain.h.

#define ON_UBTNDBLDOWN ( baseClass )

Value:

{ EV_BTNDBLDOWN, epV_iii, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(int x, int y, int mod))&baseClass::OnBtnDblDown },

Definition at line 202 of file umain.h.

#define ON_UBTNDOWN ( baseClass )

Value:

{ EV_BTNDOWN, epV_iii, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(int x, int y, int mod))&baseClass::OnBtnDown },

Definition at line 194 of file umain.h.

#define ON_UBTNUP ( baseClass )

Value:

{ EV_BTNUP, epV_iii, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(int x, int y, int mod))&baseClass::OnBtnUp },

Definition at line 198 of file umain.h.

#define ON_UCOMMAND | ( | cmd,
 |  | hook | )

Value:

{ EV_CMD, epi_V, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(int (UCmdTarget::*)(void))&hook },

Definition at line 250 of file umain.h.

#define ON_UCOMMAND_RANGE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_CMD, epi_i, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(int (UCmdTarget::*)(int cmd))&hook },

Definition at line 254 of file umain.h.

#define ON_UCOMMAND_RANGEEX | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_CMD, epi_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(int (UCmdTarget::*)(int cmd, void *data))&hook },

Definition at line 258 of file umain.h.

#define ON_UCREATE ( baseClass )

Value:

{ EV_CREATE, epV_V, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnCreate },

Definition at line 170 of file umain.h.

#define ON_UDESTROY ( baseClass )

Value:

{ EV_DESTROY, epV_V, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnDestroy },

Definition at line 174 of file umain.h.

#define ON_UENTER ( baseClass )

Value:

{ EV_ENTER, epV_VP, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(void *))&baseClass::OnEnter },

Definition at line 178 of file umain.h.

#define ON_UEXPOSE ( baseClass )

Value:

{ EV_EXPOSE, epV_V, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnExpose },

Definition at line 186 of file umain.h.

#define ON_UGETLLOC | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_GETLOC, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, URECT *r))&hook },

Definition at line 278 of file umain.h.

#define ON_ULEAVE ( baseClass )

Value:

{ EV_LEAVE, epV_V, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnLeave },

Definition at line 182 of file umain.h.

#define ON_UMMOVE ( baseClass )

Value:

{ EV_MMOVE, epV_iii, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(int x, int y, int mod))&baseClass::OnMouseMove },

Definition at line 190 of file umain.h.

#define ON_UNOTIFY | ( | cmd,
 |  | hook | )

Value:

{ EV_NOTIFY, epV_V, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(void))&hook },

Definition at line 362 of file umain.h.

#define ON_UPDATEFOCUS ( baseClass )

Value:

{ EV_UPDATEFOCUS, epi_iVP, UMSG_NOEXT, 0, 0, \
        (UPMSG)(int (UCmdTarget::*)(int leave, void *widget))&baseClass::OnUpdateFocus },

Definition at line 322 of file umain.h.

#define ON_UPDATEUI ( baseClass )

Value:

{ EV_UPDATEUI, epV_V, UMSG_NOEXT, 0, 0, \
        (UPMSG)(void (UCmdTarget::*)(void))&baseClass::OnUpdateUI },

Definition at line 318 of file umain.h.

#define ON_USETLLOC | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_SETLOC, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, const URECT *r))&hook },

Definition at line 282 of file umain.h.

#define ON_USETTOOLTIP | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_SETTOOLTIP, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, UCmdUI *pCmdUI))&hook },

Definition at line 274 of file umain.h.

#define ON_UUPDATECMD | ( | cmd,
 |  | hook | )

Value:

{ EV_UPDTCMD, epV_VP, UMSG_RANGE, cmd, cmd, \
        (UPMSG)(void (UCmdTarget::*)(UCmdUI *pCmdUI))&hook },

Definition at line 262 of file umain.h.

#define ON_UUPDATECMD_RANGE | ( | cmdmin,
 |  | cmdmax,
 |  | hook | )

Value:

{ EV_UPDTCMD, epV_iVP, UMSG_RANGE, cmdmin, cmdmax, \
        (UPMSG)(void (UCmdTarget::*)(int cmd, UCmdUI *pCmdUI))&hook },

Definition at line 270 of file umain.h.

#define STD std::

Definition at line 160 of file umain.h.

#define UBEGIN_MESSAGE_MAP | ( | theClass,
 |  | baseClass | )

Value:

const UMSGMAP* theClass::GetBaseMessageMap() \
        { return baseClass::GetThisMessageMap(); } \
    const UMSGMAP* theClass::GetThisMessageMap() \
        { return &theClass::messageMap; } \
    const UMSGMAP* theClass::GetMessageMap() const \
        { return &theClass::messageMap; } \
    const UMSGMAP theClass::messageMap = \
    { baseClass::GetThisMessageMap(), &theClass::_messageEntries[0] }; \
    const UMSGMAP_ENTRY theClass::_messageEntries[] = \
    { \

Definition at line 644 of file umain.h.

#define UDECLARE_MESSAGE_MAP ( )

Value:

private: \
    static const UMSGMAP_ENTRY _messageEntries[]; \
protected: \
    static const UMSGMAP messageMap; \
    static const UMSGMAP* GetBaseMessageMap(); \
    static const UMSGMAP* GetThisMessageMap(); \
    virtual const UMSGMAP* GetMessageMap() const; \

Definition at line 635 of file umain.h.

#define UEND_MESSAGE_MAP ( )

Value:

{EV_NONE, epNone, UMSG_NOEXT, 0, 0, (UPMSG)0 } \
    }; \

Definition at line 656 of file umain.h.

#define UHIWORD ( l ) ((short)(((int)(l) >> 16) & 0xFFFF))

Definition at line 760 of file umain.h.

Referenced by UWidget::DoModal(), and UCmdTarget::UDispatchMessage().

#define UK_ADD 0x6B

Definition at line 804 of file umain.h.

#define UK_ALT 0x20

Definition at line 768 of file umain.h.

#define UK_BACK 0x08

Definition at line 772 of file umain.h.

#define UK_CANCEL 0x03

Definition at line 771 of file umain.h.

#define UK_CLEAR 0x0C

Definition at line 774 of file umain.h.

#define UK_CONTROL 0x08

Definition at line 766 of file umain.h.

#define UK_DECIMAL 0x6E

Definition at line 807 of file umain.h.

#define UK_DELETE 0x2E

Definition at line 787 of file umain.h.

#define UK_DIVIDE 0x6F

Definition at line 808 of file umain.h.

#define UK_DOWN 0x28

Definition at line 785 of file umain.h.

#define UK_END 0x23

Definition at line 780 of file umain.h.

#define UK_ESCAPE 0x1B

Definition at line 776 of file umain.h.

#define UK_F1 0x70

Definition at line 809 of file umain.h.

#define UK_F10 0x79

Definition at line 818 of file umain.h.

#define UK_F11 0x7A

Definition at line 819 of file umain.h.

#define UK_F12 0x7B

Definition at line 820 of file umain.h.

#define UK_F13 0x7C

Definition at line 821 of file umain.h.

#define UK_F14 0x7D

Definition at line 822 of file umain.h.

#define UK_F15 0x7E

Definition at line 823 of file umain.h.

#define UK_F16 0x7F

Definition at line 824 of file umain.h.

#define UK_F17 0x80

Definition at line 825 of file umain.h.

#define UK_F18 0x81

Definition at line 826 of file umain.h.

#define UK_F19 0x82

Definition at line 827 of file umain.h.

#define UK_F2 0x71

Definition at line 810 of file umain.h.

#define UK_F20 0x83

Definition at line 828 of file umain.h.

#define UK_F21 0x84

Definition at line 829 of file umain.h.

#define UK_F22 0x85

Definition at line 830 of file umain.h.

#define UK_F23 0x86

Definition at line 831 of file umain.h.

#define UK_F24 0x87

Definition at line 832 of file umain.h.

#define UK_F3 0x72

Definition at line 811 of file umain.h.

#define UK_F4 0x73

Definition at line 812 of file umain.h.

#define UK_F5 0x74

Definition at line 813 of file umain.h.

#define UK_F6 0x75

Definition at line 814 of file umain.h.

#define UK_F7 0x76

Definition at line 815 of file umain.h.

#define UK_F8 0x77

Definition at line 816 of file umain.h.

#define UK_F9 0x78

Definition at line 817 of file umain.h.

#define UK_HELP 0x2F

Definition at line 788 of file umain.h.

#define UK_HOME 0x24

Definition at line 781 of file umain.h.

#define UK_INSERT 0x2D

Definition at line 786 of file umain.h.

#define UK_LBUTTON 0x01

Definition at line 763 of file umain.h.

#define UK_LEFT 0x25

Definition at line 782 of file umain.h.

#define UK_MBUTTON 0x02

Definition at line 764 of file umain.h.

#define UK_MINUS 0x6D

Definition at line 791 of file umain.h.

#define UK_MULTIPLY 0x6A

Definition at line 803 of file umain.h.

#define UK_NEXT 0x22

Definition at line 779 of file umain.h.

#define UK_NUMPAD0 0x60

Definition at line 793 of file umain.h.

#define UK_NUMPAD1 0x61

Definition at line 794 of file umain.h.

#define UK_NUMPAD2 0x62

Definition at line 795 of file umain.h.

#define UK_NUMPAD3 0x63

Definition at line 796 of file umain.h.

#define UK_NUMPAD4 0x64

Definition at line 797 of file umain.h.

#define UK_NUMPAD5 0x65

Definition at line 798 of file umain.h.

#define UK_NUMPAD6 0x66

Definition at line 799 of file umain.h.

#define UK_NUMPAD7 0x67

Definition at line 800 of file umain.h.

#define UK_NUMPAD8 0x68

Definition at line 801 of file umain.h.

#define UK_NUMPAD9 0x69

Definition at line 802 of file umain.h.

#define UK_PLUS 0x6B

Definition at line 790 of file umain.h.

#define UK_PRIOR 0x21

Definition at line 778 of file umain.h.

#define UK_RBUTTON 0x04

Definition at line 765 of file umain.h.

#define UK_RETURN 0x0D

Definition at line 775 of file umain.h.

#define UK_RIGHT 0x27

Definition at line 784 of file umain.h.

#define UK_SEPARATOR 0x6C

Definition at line 805 of file umain.h.

#define UK_SHIFT 0x10

Definition at line 767 of file umain.h.

#define UK_SPACE 0x20

Definition at line 777 of file umain.h.

#define UK_SUBTRACT 0x6D

Definition at line 806 of file umain.h.

#define UK_TAB 0x09

Definition at line 773 of file umain.h.

#define UK_UP 0x26

Definition at line 783 of file umain.h.

#define ULOWORD ( l ) ((short)(l))

Definition at line 759 of file umain.h.

Referenced by UWidget::DoModal(), and UCmdTarget::UDispatchMessage().

#define UMAKEINT | ( | a,
 |  | b | ) | ((int)(((short)(a)) | ((int)((short)(b))) << 16))

Definition at line 758 of file umain.h.

Referenced by UWidget::AddPage(), CvsLogParse(), UCvsFiles::DisableGeneric(), USaveSettings::DoDataExchange(), UAuthen_Kserver::DoDataExchange(), UAuthen_Rhosts::DoDataExchange(), UAuthen_Pserver::DoDataExchange(), UAuthen_SSH::DoDataExchange(), TPseudoWinBehavior::DoEvent(), UWidget::DoModal(), UPseudoPlaceHolder::DoRotate(), CPseudoItem::DoubleClick(), LPseudoWinAttachment::ListenToMessage(), UAuthen_SSH::OnCheckName(), UAuthen_SSH::OnCheckOptions(), UAuthen_Kserver::OnCheckPort(), UAuthen_Rhosts::OnCheckPort(), UAuthen_Pserver::OnCheckPort(), UAuthen_Pserver::OnCheckProxy(), UAuthen_SSH::OnCheckRSA(), UAuthen_Rhosts::OnCheckRshName(), UAuthen_Rhosts::OnCheckServerName(), UCvsFiles::OnCmdAdd(), UCvsFiles::OnCmdAddb(), UCvsFiles::OnCmdCommit(), UCvsFiles::OnCmdDiff(), UCvsFiles::OnCmdEdit(), UCvsFiles::OnCmdEditors(), UCvsFiles::OnCmdEditsel(), UCvsFiles::OnCmdEditseldef(), UCvsFiles::OnCmdExplore(), UCvsFiles::OnCmdGraph(), UCvsFiles::OnCmdLock(), UCvsFiles::OnCmdLog(), UCvsFiles::OnCmdQueryUpdate(), UCvsFiles::OnCmdRelease(), UCvsFiles::OnCmdRmv(), UCvsFiles::OnCmdStatus(), UCvsFiles::OnCmdTagBranch(), UCvsFiles::OnCmdTagDelete(), UCvsFiles::OnCmdTagNew(), UCvsFiles::OnCmdTrash(), UCvsFiles::OnCmdUIAdd(), UCvsFiles::OnCmdUIAddB(), UCvsFiles::OnCmdUIEditseldef(), UCvsFiles::OnCmdUIExplore(), UCvsFiles::OnCmdUIGraph(), UCvsFiles::OnCmdUIMacroSel(), UCvsFiles::OnCmdUIRelease(), UCvsFiles::OnCmdUIRmv(), UCvsFiles::OnCmdUITrash(), UCvsFiles::OnCmdUIUpdate(), UCvsFiles::OnCmdUnedit(), UCvsFiles::OnCmdUnlock(), UCvsFiles::OnCmdUpdate(), UCvsFiles::OnCmdWatchOff(), UCvsFiles::OnCmdWatchOn(), UCvsFiles::OnCmdWatchers(), UWidget::OnComboAppend(), USaveSettings::OnCopyFrom(), UCvsFiles::OnCreate(), UCvsFiles::OnDblClick(), TViewFill::OnDirectory(), TViewFill::OnFile(), UWidget::OnInitWidget(), CPseudoList::OnLButtonDblClk(), UCvsFiles::OnMacroSel(), UWidget::OnPageChanged(), UCvsFolders::OnTreeExpanding(), UWidget::OnTreeInsert(), UCvsFolders::ResetBrowser(), UCvsFolders::ResetView(), UCvsFiles::ResetView(), UCvsFiles::Resort(), UCvsFiles::Search(), CPseudoItem::SingleClick(), UCvsFolders::StepToLocation(), UWaitCursor::UWaitCursor(), UWinPseudoWindowProc(), and UWaitCursor::~UWaitCursor().

#define UMENU_NULL ((UMENU)0L)

Definition at line 845 of file umain.h.

#define UMakeBitmap ( b ) 0L

Definition at line 1001 of file umain.h.

Referenced by CPseudoButton::LoadXPM(), CPseudoRotButton::LoadXPMs(), UToolbar::OnTbButton(), UToolbar::OnTbCheckBtn(), UToolbar::OnTbDropDown(), UMenuAddButton(), and UMenuAddToggle().

#define UTB_SEPARATOR (-1)

Definition at line 848 of file umain.h.

#define ev_msg

Definition at line 660 of file umain.h.

Typedef Documentation

typedef int(* UListSorter)(UWidget *wid, void *data1, void *data2)

Definition at line 942 of file umain.h.

typedef long UMENU

Definition at line 844 of file umain.h.

typedef void(UCmdTarget::* UPMSG)(void)

Definition at line 168 of file umain.h.

typedef void* UTREEITEM

Definition at line 912 of file umain.h.

Enumeration Type Documentation

enum UCURSOR

Enumeration values:
uCursArrow
uCursWatch

Definition at line 891 of file umain.h.

00892 {
00893     uCursArrow,
00894     uCursWatch
00895 } UCURSOR;

enum UEventParam

Enumeration values:
epNone
epV_V
epV_VP
epV_iVP
epV_IVP
epV_i
epV_I
epV_ii
epV_iii
epV_iiVP
epi_i
epi_V
epi_ii
epi_iVP
epi_VP

Definition at line 594 of file umain.h.

00595 {
00596     epNone,
00597     epV_V,      // void (void)
00598     epV_VP,     // void (arg2)
00599     epV_iVP,    // void (arg1, arg2)
00600     epV_IVP,    // void (HI(arg1), arg2)
00601     epV_i,      // void (arg1)
00602     epV_I,      // void (HI(arg1))
00603     epV_ii,     // void (LO(arg1), HI(arg1))
00604     epV_iii,    // void (LO(arg1), HI(arg1), (int)arg2)
00605     epV_iiVP,   // void (LO(arg1), HI(arg1), arg2)
00606     epi_i,      // int (arg1)
00607     epi_V,      // int (void)
00608     epi_ii,     // int (LO(arg1), HI(arg1))
00609     epi_iVP,    // int (arg1, arg2)
00610     epi_VP      // int (arg2)
00611 } UEventParam;

enum UEventType

Enumeration values:
EV_NONE
EV_CREATE
EV_DESTROY
EV_ENTER
EV_LEAVE
EV_EXPOSE
EV_MMOVE
EV_BTNDOWN
EV_BTNUP
EV_BTNDBLDOWN
EV_KEYDOWN
EV_SETCURSOR
EV_CHGCURSOR
EV_RESIZE
EV_GETLOC
EV_SETLOC
EV_CMD
EV_UPDTCMD
EV_ENABLECMD
EV_FETCHCMD
EV_SETTOOLTIP
EV_QUERYSTATE
EV_GETINTEGER
EV_SETSTATE
EV_SETINTEGER
EV_CHGFOCUS
EV_INVALIDATE
EV_REDRAW
EV_GETTEXT
EV_SETTEXT
EV_GETFLOAT
EV_SETFLOAT
EV_INIT_WIDGET
EV_INIT_TAB_WIDGET
EV_SHOW_WIDGET
EV_PAGE_CHANGED
EV_NOTIFY
EV_EDITCHANGE
EV_EDITACTIVATE
EV_TIMER
EV_UPDATEUI
EV_UPDATEFOCUS
EV_DRAGQUERY
EV_DROPQUERY
EV_DROPIT
EV_DROPQUERY_CMDID
EV_DROPREF
EV_TB_INIT
EV_TB_END
EV_TB_BUTTON
EV_TB_DROPDOWN
EV_TB_CHECKBTN
EV_TB_SEPARATOR
EV_TB_GETCOLOR
EV_SET_SLIDER
EV_GET_SLIDERPROP
EV_SET_SLIDERPROP
EV_SCROLLCHANGE
EV_CUSTOM_DRAW
EV_TREE_RESETALL
EV_TREE_INSERT
EV_TREE_GETINFO
EV_TREE_SETDATA
EV_TREE_SETICON
EV_TREE_DELETE
EV_TREE_EXPANDING
EV_TREE_SELECTING
EV_TREE_EXPAND
EV_TREE_SELECT
EV_TREE_GETSEL
EV_LIST_SELECTING
EV_LIST_SELCOLUMN
EV_LIST_RESORT
EV_LIST_DBLCLICK
EV_LIST_RESETALL
EV_LIST_SETFEEDBACK
EV_LIST_ADDCOLUMNS
EV_LIST_SETCOLTITLE
EV_LIST_SETCOLWIDTH
EV_LIST_NEWROW
EV_LIST_ROWSETDATA
EV_LIST_ROWGETDATA
EV_LIST_INSERT
EV_LIST_ADDSEL
EV_LIST_DELROW
EV_LIST_GETNEXTSEL
EV_LIST_GETINFO
EV_LIST_GETNEXT
EV_COMBO_RESETALL
EV_COMBO_APPEND
EV_COMBO_SETSEL
EV_COMBO_GETSEL
EV_COMBO_SEL
EV_COMBO_GETCOUNT
EV_COMBO_DELSEL
EV_COMBO_ENABLESEL
EV_COMBO_GETMENU
EV_COMMAND_START

Definition at line 33 of file umain.h.

00034 {
00035     EV_NONE,
00036
00037     /* system events */
00038     EV_CREATE,      /* void OnCreate(void) */
00039     EV_DESTROY,     /* void OnDestroy(void) */
00040     EV_ENTER,       /* void OnEnter(void *data) */
00041     EV_LEAVE,       /* void OnLeave(void) */
00042     EV_EXPOSE,      /* void OnExpose(void) */
00043     EV_MMOVE,       /* void OnMouseMove(int x, int y, int mod) */
00044     EV_BTNDOWN,     /* void OnBtnDown(int x, int y, int mod) */
00045     EV_BTNUP,       /* void OnBtnUp(int x, int y, int mod) */
00046     EV_BTNDBLDOWN,  /* void OnBtnDblDown(int x, int y, int mod) */
00047     EV_KEYDOWN,     /* void OnKeyDown(int c) */
00048     EV_SETCURSOR,   /* void OnSetCursor(void) */
00049     EV_CHGCURSOR,   /* void OnChgCursor(int cmd, UCURSOR cursor) */
00050     EV_RESIZE,      /* void OnResize(const URECT * r) */
00051     EV_GETLOC,      /* void OnGetLoc<Cmd>(int cmd, URECT *) */
00052     EV_SETLOC,      /* void OnSetLoc<Cmd>(int cmd, const URECT *) */
00053
00054     /* generic */
00055     EV_CMD,         /* int On<Cmd>(void) */
00056     EV_UPDTCMD,     /* void OnUpdate<Cmd>(UCmdUI *pCmdUI) */
00057     EV_ENABLECMD,   /* void OnEnableCmd<Cmd>(int cmd, int enabled) */
00058     EV_FETCHCMD,    /* int OnFetchCmd(int cmd, void *widget) */
00059     EV_SETTOOLTIP,  /* void OnSetTooltip<Cmd>(int cmd, UCmdUI *pCmdUI) */
00060     EV_QUERYSTATE,  /* int OnQueryState<Cmd>(int cmd) */
00061     EV_GETINTEGER = EV_QUERYSTATE,
00062     EV_SETSTATE,    /* void OnSetState<Cmd>(int cmd, int state) */
00063     EV_SETINTEGER = EV_SETSTATE,
00064     EV_CHGFOCUS,    /* void OnChgFocus(int cmd) */
00065     EV_INVALIDATE,  /* void OnInvalidate(int cmd) */
00066     EV_REDRAW,      /* void OnRedraw(int cmd) */
00067     EV_GETTEXT,     /* void OnGetText(int cmd, UStr *text); */
00068     EV_SETTEXT,     /* void OnSetText(int cmd, const char *text); */
00069     EV_GETFLOAT,    /* void OnGetFloat(int cmd, float *f); */
00070     EV_SETFLOAT,    /* void OnSetFloat(int cmd, const float *f); */
00071     EV_INIT_WIDGET, /* void OnInitWidget(int cmd, void *widget); */
00072     EV_INIT_TAB_WIDGET, /* void OnInitTabWidget(int cmd, int page, void *widget); */
00073     EV_SHOW_WIDGET, /* void OnShowWidget<Cmd>(int cmd, int state) */
00074     EV_PAGE_CHANGED,    /* void OnPageChanged<Cmd>(int cmd, int pagenum) */
00075
00076     /* notifying */
00077     EV_NOTIFY,          /* void OnNotify<Cmd>(void) */
00078     EV_EDITCHANGE,      /* void OnEditChange<Cmd>(void) */
00079     EV_EDITACTIVATE,    /* void OnEditActivate<Cmd>(void) */
00080     EV_TIMER,           /* void OnTimer<Cmd>(long time) */
00081     EV_UPDATEUI,        /* void OnUpdateUI(void) */
00082     EV_UPDATEFOCUS,     /* int OnUpdateFocus(int leave, void *widget) */
00083
00084     /* drag'n drop */
00085     EV_DRAGQUERY,       /* void OnDragQuery<Cmd>(UDragable *) */
00086     EV_DROPQUERY,       /* void OnDropQuery<Cmd>(UDropable **) */
00087     EV_DROPIT,          /* void OnDropIt<Cmd>(const UDragable *) */
00088     EV_DROPQUERY_CMDID, /* void OnDropQueryCmdID<Cmd>(int x, int y, int *cmdid) */
00089     EV_DROPREF,     /* void OnDropRef<Cmd>(int cmd, int nbref, long *ref) */
00090
00091     /* toolbar manager */
00092     EV_TB_INIT,         /* void OnTbInit(UTB_INIT *info) */
00093     EV_TB_END,          /* void OnTbEnd(void) */
00094     EV_TB_BUTTON,       /* void OnTbButton(UTB_BUTTON *info) */
00095     EV_TB_DROPDOWN,     /* void OnTbDropDown(UTB_DROPDOWN *info) */
00096     EV_TB_CHECKBTN,     /* void OnTbCheckBtn(UTB_BUTTON *info) */
00097     EV_TB_SEPARATOR,    /* void OnTbSeparator(void) */
00098     EV_TB_GETCOLOR,     /* void OnTbGetColor(int cmd, float *color) */
00099
00100     /* slider */
00101     EV_SET_SLIDER,      /* void OnSetSlider(int cmd, int pos) */
00102     EV_GET_SLIDERPROP,  /* void OnGetSliderProperty(int cmd, USLIDER *prop) */
00103     EV_SET_SLIDERPROP,  /* void OnSetSliderProperty(int cmd, const USLIDER *prop) */
00104     EV_SCROLLCHANGE,    /* void OnScrollChange<Cmd>(int pos) */
00105
00106     /* custom drawing */
00107     EV_CUSTOM_DRAW,     /* void OnCustomDraw<Cmd>(void *drawInfo) */
00108
00109     /* tree */
00110     EV_TREE_RESETALL,   /* void OnTreeResetAll(int cmd) */
00111     EV_TREE_INSERT,     /* void OnTreeInsert(int cmd, UTREE_INSERT *data) */
00112     EV_TREE_GETINFO,    /* void OnTreeGetInfo(int cmd, UTREE_INFO *data) */
00113     EV_TREE_SETDATA,    /* void OnTreeSetData(int cmd, UTREE_INFO *data) */
00114     EV_TREE_SETICON,    /* void OnTreeSetIcon(int cmd, UTREE_INFO *data) */
00115     EV_TREE_DELETE,     /* void OnTreeDelete(int cmd, UTREEITEM item) */
00116     EV_TREE_EXPANDING,  /* void OnTreeExpanding<cmd>(int collapse, UTREEITEM item) */
00117     EV_TREE_SELECTING,  /* void OnTreeSelecting<cmd>(int deselecting, UTREEITEM item) */
00118     EV_TREE_EXPAND,     /* void OnTreeExpand(int cmd, int collapse, UTREEITEM item) */
00119     EV_TREE_SELECT,     /* void OnTreeSelect(int cmd, int deselect, UTREEITEM item) */
00120     EV_TREE_GETSEL,     /* void OnTreeGetSel(int cmd, UTREEITEM *item) */
00121
00122     /* list */
00123     EV_LIST_SELECTING,      /* void OnListChange<Cmd>(int entry, const char *txt) */
00124     EV_LIST_SELCOLUMN,      /* void OnListSelColumn<Cmd>(int entry) */
00125     EV_LIST_RESORT,         /* void OnListResort(int cmd, int column, UListSorter s) */
00126     EV_LIST_DBLCLICK,       /* void OnListDblClick<Cmd>(void) */
00127     EV_LIST_RESETALL,       /* void OnListResetAll(int cmd) */
00128     EV_LIST_SETFEEDBACK,    /* void OnListSetFeedback(int cmd, int turnOn) */
00129     EV_LIST_ADDCOLUMNS,     /* void OnListAddColumns(int cmd, int num) */
00130     EV_LIST_SETCOLTITLE,    /* void OnListSetColTitle(int cmd, int num, const char *title) */
00131     EV_LIST_SETCOLWIDTH,    /* void OnListSetColWidth(int cmd, int num, int width) */
00132     EV_LIST_NEWROW,         /* void OnListNewRow(int cmd, int *num) */
00133     EV_LIST_ROWSETDATA,     /* void OnListRowSetData(int cmd, int row, void *data) */
00134     EV_LIST_ROWGETDATA,     /* void OnListRowGetData(int cmd, int row, void **data) */
00135     EV_LIST_INSERT,         /* void OnListInsert(int cmd, ULIST_INSERT *data) */
00136     EV_LIST_ADDSEL,         /* void OnListAddSel(int cmd, int entry) */
00137     EV_LIST_DELROW,         /* void OnListDelRow(int cmd, int row) */
00138     EV_LIST_GETNEXTSEL,     /* int OnListGetNextSel(int cmd, int selectedCell) */
00139     EV_LIST_GETINFO,        /* void OnListGetInfo(int cmd, ULIST_INFO *data) */
00140     EV_LIST_GETNEXT,        /* int OnListGetNext(int cmd, int whichCell) */
00141
00142     /* combo */
00143     EV_COMBO_RESETALL,  /* void OnComboResetAll(int cmd) */
00144     EV_COMBO_APPEND,    /* void OnComboAppend(int cmd, const char *str) */
00145     EV_COMBO_SETSEL,    /* void OnComboSetPos(int cmd, int pos) */
00146     EV_COMBO_GETSEL,    /* int OnComboGetPos(int cmd, UStr *txt) */
00147     EV_COMBO_SEL,       /* void OnComboSel<Cmd>(int pos, const char *txt) */
00148     EV_COMBO_GETCOUNT,  /* int OnComboGetCount(int cmd) */
00149     EV_COMBO_DELSEL,    /* void OnComboDelSel(int cmd, int pos) */
00150     EV_COMBO_ENABLESEL, /* void OnComboEnableSel(int cmd, int pos, int state) */
00151     EV_COMBO_GETMENU,   /* void OnComboGetMenu(int cmd, UMENU *menu) */
00152
00153     /* user defined */
00154     EV_COMMAND_START = 1000
00155 } UEventType;

enum UMSG_EXT

Enumeration values:
UMSG_NOEXT
UMSG_RANGE

Definition at line 613 of file umain.h.

00614 {
00615     UMSG_NOEXT,
00616     UMSG_RANGE
00617 } UMSG_EXT;

enum UTB_DROP

Enumeration values:
DDD_NONE

Definition at line 863 of file umain.h.

00864 {
00865     DDD_NONE = 0x00
00866 } UTB_DROP;

enum UTB_VAR

Enumeration values:
DDV_NONE

Definition at line 858 of file umain.h.

00859 {
00860     DDV_NONE
00861 } UTB_VAR;

Function Documentation

const std:: map<int, UCmdTarget *>& UEventGetTargets ( void )

Definition at line 763 of file uevent.cpp.

00764 {
00765     return sAllTargets.Get();
00766 }

int UEventGetWidID ( void )

Definition at line 296 of file uevent.cpp.

00297 {
00298     static int newid = 100;
00299     return newid++;
00300 }

void UEventGiveTime ( void )

Definition at line 673 of file uevent.cpp.

00674 {
00675     STD map< int, UCmdTarget * >::const_iterator iter;
00676     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00677
00678     // post the retained events
00679     while(!sRetainedMsgs.empty())
00680     {
00681         CMsg msg = *sRetainedMsgs.begin();
00682         sRetainedMsgs.erase(sRetainedMsgs.begin());
00683         UEventSendMessage(msg.m_wid, msg.m_ev, msg.m_arg1, msg.m_arg2);
00684     }
00685
00686     // take care about the EV_UPDATEUI notification
00687     if(!UWidget::IsUIValid())
00688     {
00689         UWidget::DoValidUI(true);
00690
00691         // warn the widget it's going to happen so they can cache
00692         // some informations.
00693         for(iter = targets.begin(); iter != targets.end(); ++iter)
00694         {
00695             UCmdTarget *target = (*iter).second;
00696             if(!target->IsKindOf(URUNTIME_CLASS(UWidget)))
00697                 continue;
00698
00699             UWidget *wid = (UWidget *)target;
00700             wid->BeforeUpdateUI();
00701         }
00702
00703         for(iter = targets.begin(); iter != targets.end(); ++iter)
00704         {
00705             UCmdTarget *target = (*iter).second;
00706             if(!target->IsKindOf(URUNTIME_CLASS(UWidget)))
00707                 continue;
00708
00709             UWidget *wid = (UWidget *)target;
00710             UEventSendMessage(wid->GetWidID(), EV_UPDATEUI, 0, 0L);
00711         }
00712     }
00713
00714     long thisIdle = UTickCount();
00715     if((thisIdle - sLastIdle) < MIN_IDLE)
00716         return;
00717
00718     // search the timers
00719     for(iter = targets.begin(); iter != targets.end(); ++iter)
00720     {
00721         UCmdTarget *target = (*iter).second;
00722         if(!target->IsKindOf(URUNTIME_CLASS(UWidget)))
00723             continue;
00724
00725         UWidget *wid = (UWidget *)target;
00726         std::vector<UTimer> & timers = wid->GetTimers();
00727         std::vector<UTimer>::iterator t;
00728         for(t = timers.begin(); t != timers.end(); ++t)
00729         {
00730             UTimer & timer = *t;
00731             if((thisIdle - timer.m_lastlap) >= timer.m_lap)
00732             {
00733                 // trigger the timer
00734                 timer.m_lastlap = thisIdle;
00735                 UEventSendMessage(wid->GetWidID(), EV_TIMER, timer.m_cmd, (void *)thisIdle);
00736             }
00737         }
00738     }
00739
00740     sLastIdle = thisIdle;
00741 }

int UEventNotifyMessage | ( | int | evt,
 |  | int | arg1,
 |  | void * | arg2
 | ) |

Definition at line 269 of file uevent.cpp.

Referenced by UPseudoFakePane::ActivateSelf(), UPseudoFakePane::DeactivateSelf(), TPseudoWinBehavior::DoEvent(), TPseudoAppBehavior::DoToolboxEvent(), LMainPseudoAttachment::ExecuteSelf(), and ULIST_INFO::data().

00270 {
00271     STD map< int, UCmdTarget * >::const_iterator iter;
00272     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00273     int res = 0;
00274
00275     for(iter = targets.begin(); iter != targets.end(); ++iter)
00276     {
00277         UCmdTarget *target = (*iter).second;
00278         UCmdTarget::UDispatchInfo dispatchInfo = UCmdTarget::kUNoDispatchInfo;
00279 #if qDebug
00280         try {
00281 #endif
00282         res = target->UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00283 #if qDebug
00284         } catch(...) {
00285             UASSERT(0);
00286             throw;
00287         }
00288 #endif
00289         if(res)
00290             break;
00291     }
00292
00293     return res;
00294 }

int UEventPostMessage | ( | int | wid,
 |  | int | evt,
 |  | int | arg1,
 |  | void * | arg2
 | ) |

Definition at line 262 of file uevent.cpp.

Referenced by ULIST_INFO::data().

00263 {
00264     sRetainedMsgs.push_back(CMsg(wid, evt, arg1, arg2));
00265     return 0;
00266 }

UCmdTarget* UEventQueryWidget ( int widid )

Definition at line 302 of file uevent.cpp.

Referenced by UCvsApp::GetBrowserView(), UCvsApp::GetFilesView(), UCvsFolders::OnTreeSelecting(), LPseudoWinAttachment::SearchWidID(), UDC::UDC(), UMenuAddButton(), UMenuAddPulldown(), and UMenuAddToggle().

00303 {
00304     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00305     STD map< int, UCmdTarget * >::const_iterator iter = targets.find(widid);
00306     if(iter != targets.end())
00307     {
00308         UCmdTarget *target = (*iter).second;
00309         return target;
00310     }
00311     return 0L;
00312 }

void UEventRemoveWidID ( int widid )

Definition at line 314 of file uevent.cpp.

Referenced by ULIST_INFO::data(), and UCmdTarget::~UCmdTarget().

00315 {
00316     STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00317     STD map<int, UCmdTarget *>::iterator i = targets.find(widid);
00318     if(i == targets.end())
00319         return;
00320     targets.erase(i);
00321 }

int UEventSendMessage | ( | int | wid,
 |  | int | evt,
 |  | int | arg1,
 |  | void * | arg2
 | ) |

Definition at line 199 of file uevent.cpp.

Referenced by UWidget::AddPage(), AskCreatePersistentSettings(), LPseudoWinAttachment::CheckWindowSize(), CompatGetCheckout(), CompatGetCommand(), CompatGetCommit(), CompatGetDiff(), CompatGetImport(), CompatGetLog(), CompatGetPassword(), CompatGetPrefs(), CompatGetUpdate(), CompatImportFilter(), CompatRtagBranch(), CompatRtagCreate(), CompatRtagDelete(), CompatTagBranch(), CompatTagCreate(), CompatTagDelete(), CreateMainToolbar(), CvsAlert(), CvsLogParse(), UCvsFolders::DeleteAllItems(), UCvsFiles::DisableGeneric(), USaveSettings::DoDataExchange(), UAuthen_Kserver::DoDataExchange(), UAuthen_Rhosts::DoDataExchange(), UAuthen_Pserver::DoDataExchange(), UAuthen_SSH::DoDataExchange(), UEditMessage::DoDataExchange(), UPromptMessage::DoDataExchange(), TPseudoWinBehavior::DoEvent(), UWidget::DoModal(), UPseudoPageHider::DoRotate(), UPseudoPlaceHolder::DoRotate(), CPseudoItem::DoubleClick(), TPseudoCustomView::Draw(), LMainPseudoAttachment::ExecuteSelf(), LPseudoDrawAttachment::ExecuteSelf(), TBrowserFill::ExitDirectory(), TBrowserFillDummy::ExitDirectory(), UCvsFolders::GetItemByLocation(), LPseudoWinAttachment::ListenToMessage(), UAuthen_SSH::OnBtnName(), UAuthen_SSH::OnBtnRSA(), UAuthen_SSH::OnCheckName(), UAuthen_SSH::OnCheckOptions(), UAuthen_Kserver::OnCheckPort(), UAuthen_Rhosts::OnCheckPort(), UAuthen_Pserver::OnCheckPort(), UAuthen_Pserver::OnCheckProxy(), UAuthen_SSH::OnCheckRSA(), UAuthen_Rhosts::OnCheckRshName(), UAuthen_Rhosts::OnCheckServerName(), UCvsFolders::OnCmdAdd(), UCvsFiles::OnCmdAdd(), UCvsFiles::OnCmdAddb(), UCvsFolders::OnCmdCommit(), UCvsFiles::OnCmdCommit(), UCvsFolders::OnCmdDiff(), UCvsFiles::OnCmdDiff(), UCvsFolders::OnCmdEdit(), UCvsFiles::OnCmdEdit(), UCvsFolders::OnCmdEditors(), UCvsFiles::OnCmdEditors(), UCvsFiles::OnCmdEditsel(), UCvsFiles::OnCmdEditseldef(), UCvsFolders::OnCmdExplore(), UCvsFiles::OnCmdExplore(), UCvsFiles::OnCmdGraph(), UCvsFolders::OnCmdLock(), UCvsFiles::OnCmdLock(), UCvsFolders::OnCmdLog(), UCvsFiles::OnCmdLog(), UCvsFolders::OnCmdMacrosSel(), UCvsFolders::OnCmdQueryUpdate(), UCvsFiles::OnCmdQueryUpdate(), UCvsFolders::OnCmdRelease(), UCvsFiles::OnCmdRelease(), UCvsFiles::OnCmdRmv(), UCvsFolders::OnCmdStatus(), UCvsFiles::OnCmdStatus(), UCvsFolders::OnCmdTagBranch(), UCvsFiles::OnCmdTagBranch(), UCvsFolders::OnCmdTagDelete(), UCvsFiles::OnCmdTagDelete(), UCvsFolders::OnCmdTagNew(), UCvsFiles::OnCmdTagNew(), UCvsFiles::OnCmdTrash(), UCvsFiles::OnCmdUIAdd(), UCvsFiles::OnCmdUIAddB(), UCvsFiles::OnCmdUIEditseldef(), UCvsFolders::OnCmdUIExplore(), UCvsFiles::OnCmdUIExplore(), UCvsFiles::OnCmdUIGraph(), UCvsFiles::OnCmdUIMacroSel(), UCvsFolders::OnCmdUIMacrosSel(), UCvsFiles::OnCmdUIRelease(), UCvsFiles::OnCmdUIRmv(), UCvsFiles::OnCmdUITrash(), UCvsFiles::OnCmdUIUpdate(), UCvsFolders::OnCmdUnedit(), UCvsFiles::OnCmdUnedit(), UCvsFolders::OnCmdUnlock(), UCvsFiles::OnCmdUnlock(), UCvsFolders::OnCmdUpdate(), UCvsFiles::OnCmdUpdate(), UCvsFolders::OnCmdWatchOff(), UCvsFiles::OnCmdWatchOff(), UCvsFolders::OnCmdWatchOn(), UCvsFiles::OnCmdWatchOn(), UCvsFolders::OnCmdWatchers(), UCvsFiles::OnCmdWatchers(), USaveSettings::OnCopyFrom(), UCvsGraph::OnCreate(), UCvsFiles::OnCreate(), UCvsFiles::OnDblClick(), TBrowserFill::OnDirectory(), TViewFill::OnDirectory(), TViewFill::OnFile(), CPseudoDlg::OnInitDialog(), UWidget::OnInitWidget(), CPseudoList::OnLButtonDblClk(), UCvsFiles::OnMacroSel(), CPseudoDraw::OnPaint(), UToolbar::OnTbButton(), UToolbar::OnTbCheckBtn(), UCvsFolders::OnTreeExpanding(), UCvsFolders::OnTreeSelecting(), UCvsFolders::OnUpdateGeneric(), UWidget::OnUpdateUI(), UToolbar::OnUpdateUI(), UMenu::OnUpdateUI(), UMacAppMenu::OnUpdateUI(), UCvsFolders::ResetBrowser(), UCvsFolders::ResetView(), UCvsFiles::ResetView(), UCvsFiles::Resort(), UCvsFolders::RetrievePath(), UCvsFiles::Search(), CPseudoItem::SingleClick(), UCvsFolders::StepToLocation(), UCvsFolders::StoreExpanded(), UEventGiveTime(), UMenuAddButton(), UMenuAddToggle(), UWaitCursor::UWaitCursor(), UWinPseudoWindowProc(), TPseudoWinAdorner::ViewChangedFrame(), WinInitWidgets(), ULIST_INFO::data(), macpp_fecthview(), CPseudoDlg::~CPseudoDlg(), LPseudoWinAttachment::~LPseudoWinAttachment(), TPseudoWinAdorner::~TPseudoWinAdorner(), and UWaitCursor::~UWaitCursor().

00200 {
00201     if(sTurnOffDispatching)
00202         return 0;
00203
00204     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00205     STD map< int, UCmdTarget * >::const_iterator iter = targets.find(wid);
00206     int res = 0;
00207
00208     if(iter != targets.end())
00209     {
00210         UCmdTarget *target = (*iter).second;
00211         UCmdTarget::UDispatchInfo dispatchInfo = UCmdTarget::kUNoDispatchInfo;
00212 #if qDebug
00213         try {
00214 #endif
00215         res = target->UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00216 #if qDebug
00217         } catch(...) {
00218             UASSERT(0);
00219             throw;
00220         }
00221 #endif
00222     }
00223     else
00224     {
00225         UAppConsole("Unknown widget id : %d\n", wid);
00226     }
00227
00228     return res;
00229 }

int UEventSendMessageExt | ( | int | wid,
 |  | int | evt,
 |  | int | arg1,
 |  | void * | arg2,
 |  | int * | handledFlag
 | ) |

Definition at line 231 of file uevent.cpp.

Referenced by TPseudoAppBehavior::DoMenuCommand(), LMainPseudoAttachment::ExecuteSelf(), UToolbar::OnCommands(), UMenu::OnCommands(), and ULIST_INFO::data().

00232 {
00233     const STD map<int, UCmdTarget *> & targets = sAllTargets.Get();
00234     STD map< int, UCmdTarget * >::const_iterator iter = targets.find(wid);
00235     int res = 0;
00236     UCmdTarget::UDispatchInfo dispatchInfo = UCmdTarget::kUNoDispatchInfo;
00237
00238     if(iter != targets.end())
00239     {
00240         UCmdTarget *target = (*iter).second;
00241 #if qDebug
00242         try {
00243 #endif
00244         res = target->UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00245 #if qDebug
00246         } catch(...) {
00247             UASSERT(0);
00248             throw;
00249         }
00250 #endif
00251     }
00252     else
00253     {
00254         UAppConsole("Unknown widget id : %d\n", wid);
00255     }
00256
00257     *handledFlag = (dispatchInfo & UCmdTarget::kUDispatchHandled) != 0;
00258     return res;
00259 }

void UEventSetTooltipHandler ( void(* handler)(const char *) )

Definition at line 668 of file uevent.cpp.

Referenced by ULIST_INFO::data().

00669 {
00670     sTooltipHandler = handler;
00671 }

long UTickCount ( void )

Definition at line 743 of file uevent.cpp.

00744 {
00745 #ifdef WIN32
00746     return ::GetTickCount();
00747 #elif defined(macintosh)
00748     long res = ::TickCount();
00749     return res = (float)res * (1000.0 / 60.0);
00750 #else
00751     struct timeval tval;
00752     static long refcount;
00753
00754     gettimeofday(&tval, 0L);
00755
00756     if(refcount == 0)
00757         refcount = tval.tv_sec;
00758
00759     return (tval.tv_sec - refcount) * 1000 + tval.tv_usec / 1000;
00760 #endif
00761 }

Generated on Sun Oct 21 12:44:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


umenu.cpp File Reference

rf/umenu.cpp File Reference

#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <float.h>
#include <vector>
#include <map>
#include "umenu.h"
#include "uconsole.h"

Include dependency graph for umenu.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | CTRLALT_STROKE "Ctrl+Alt+"
#define | CTRL_STROKE "Ctrl+"
#define | ALT_STROKE "Alt+"

Functions

void | GetMenuTitle (const char *name, UStr &title, int cmd, char &mnemonic, int &mod, int &key)
UMENU | UMenuAddPulldown (int widid, const char *name, UMENU top)
void | UMenuDelete (UMENU top, int afterIndex)
int | UMenuCount (UMENU top)
void | UMenuDeleteByCmd (UMENU top, int cmd)
UMENU | UMenuAddButton (int widid, const char *name, UMENU top, const void *pixmap, int cmd)
UMENU | UMenuAddToggle (int widid, const char *name, UMENU top, const void *pixmap, int cmd)
UMENU | UMenuAddSeparator (int widid, UMENU top)

Define Documentation

#define ALT_STROKE "Alt+"

Definition at line 244 of file umenu.cpp.

#define CTRLALT_STROKE "Ctrl+Alt+"

Definition at line 242 of file umenu.cpp.

#define CTRL_STROKE "Ctrl+"

Definition at line 243 of file umenu.cpp.

Function Documentation

void GetMenuTitle | ( | const char * | name,
 |  | UStr & | title,
 |  | int | cmd,
 |  | char & | mnemonic,
 |  | int & | mod,
 |  | int & | key
 | ) | [static]

Definition at line 246 of file umenu.cpp.

Referenced by UMenuAddButton(), UMenuAddPulldown(), and UMenuAddToggle().

00248 {
00249     title = "";
00250     mod = 0;
00251     key = 0;
00252     mnemonic = '\0';
00253
00254     // get the accelerator
00255     UStr copy(name);
00256     char *tmp;
00257     if((tmp = strchr(copy, '\t')) != 0L)
00258     {
00259         *tmp++ = '\0';
00260         if(strncmp(tmp, CTRLALT_STROKE, strlen(CTRLALT_STROKE)) == 0)
00261         {
00262             mod = UK_CONTROL | UK_ALT;
00263             key = tmp[strlen(CTRLALT_STROKE)];
00264         }
00265         else if(strncmp(tmp, CTRL_STROKE, strlen(CTRL_STROKE)) == 0)
00266         {
00267             mod = UK_CONTROL;
00268             key = tmp[strlen(CTRL_STROKE)];
00269         }
00270         else if(strncmp(tmp, ALT_STROKE, strlen(ALT_STROKE)) == 0)
00271         {
00272             mod = UK_ALT;
00273             key = tmp[strlen(ALT_STROKE)];
00274         }
00275         name = copy;
00276     }
00277
00278     title = name;
00279 #ifndef WIN32
00280     if((tmp = strchr(title, '&')) != 0L)
00281     {
00282         size_t l = tmp - (const char *)title;
00283         memmove(&title[l], &title[l + 1], title.length() - l);
00284     }
00285 #endif
00286 }

UMENU UMenuAddButton | ( | int | widid,
 |  | const char * | name,
 |  | UMENU | top,
 |  | const void * | pixmap,
 |  | int | cmd
 | ) |

Definition at line 639 of file umenu.cpp.

00640 {
00641     UStr title;
00642     int  mod, key;
00643     char mnemonic;
00644     GetMenuTitle(name, title, cmd, mnemonic, mod, key);
00645
00646     UASSERT(top != UMENU_NULL);
00647
00648 #ifdef qMacPP
00649     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00650     LMenu *menu = menuBar->FetchMenu(top);
00651     if(menu)
00652     {
00653         LStr255 pstr(title);
00654         menu->InsertCommand(pstr, cmd, max_Int16 - 1);
00655     }
00656     else
00657     {
00658         MenuHandle mhdl = ::GetMenu(top);
00659         if(mhdl != 0L)
00660         {
00661             SInt16  menuLength = ::CountMenuItems(mhdl);
00662             LStr255 pstr(title);
00663             ::MacInsertMenuItem(mhdl, pstr, menuLength);
00664         }
00665     }
00666
00667     return UMENU_NULL;
00668 #endif
00669 #ifdef qMacAPP
00670     MenuRef menu = MAGetMenu(top);
00671     if(menu)
00672     {
00673         CStr255_AC pstr(title);
00674         gDispatcher->DoMakeMenuBarManager();
00675         TMenuBarManager::fgMenuBarManager->AddMenuItem(pstr, top, ::CountMenuItems(menu), cmd);
00676     }
00677
00678     return UMENU_NULL;
00679 #endif
00680 #ifdef qGTK
00681     UCmdTarget *target = UEventQueryWidget(widid);
00682     if(target == 0L || !target->IsKindOf(URUNTIME_CLASS(UMenu)))
00683         return UMENU_NULL;
00684     UMenu *pmenu = (UMenu *)target;
00685
00686     if(!GTK_IS_MENU_SHELL(top))
00687         return UMENU_NULL;
00688     GtkWidget *parent = (GtkWidget *)top;
00689
00690     GtkWidget *menuitem = gtk_menu_item_new_with_label_pixmap(title, pixmap);
00691     gtk_widget_show (menuitem);
00692     gtk_container_add (GTK_CONTAINER (parent), menuitem);
00693     addToAccelGroup((GtkAccelGroup *)pmenu->GetAccelGroup(), menuitem, mod, key);
00694 //      gtk_tooltips_set_tip (tooltips, quit1, "Quit the application", NULL);
00695     UEventSendMessage(widid, EV_INIT_WIDGET, cmd, menuitem);
00696
00697     return UMENU_NULL;
00698 #endif
00699 #ifdef WIN32
00700     HMENU menuhdl = (HMENU)top;
00701     CMenu parent;
00702     VERIFY(parent.Attach(menuhdl));
00703
00704     parent.AppendMenu(MF_STRING, UCMD_to_WINCMD(cmd), name);
00705     addAccel(UCMD_to_WINCMD(cmd), mod, key);
00706
00707     if(pixmap != 0L && strlen((const char *)pixmap))
00708     {
00709         HBITMAP bmap = UMakeBitmap((const char *)pixmap);
00710         CBitmap b;
00711         VERIFY(b.Attach(bmap));
00712         parent.SetMenuItemBitmaps(UCMD_to_WINCMD(cmd), MF_BYCOMMAND, &b, &b);
00713         b.Detach();
00714     }
00715
00716     parent.Detach();
00717     return UMENU_NULL;
00718 #endif
00719 }

UMENU UMenuAddPulldown | ( | int | widid,
 |  | const char * | name,
 |  | UMENU | top
 | ) |

Definition at line 288 of file umenu.cpp.

00289 {
00290     UStr title;
00291     int  mod, key;
00292     char mnemonic;
00293     GetMenuTitle(name, title, 0, mnemonic, mod, key);
00294
00295 #ifdef qMacAPP
00296     return UMENU_NULL;
00297 #endif
00298 #ifdef qMacPP
00299     if(top == UMENU_NULL)
00300     {
00301         Assert_(0); // TODO
00302     }
00303     else
00304     {
00305         LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00306         LMenu *menu = menuBar->FetchMenu(top);
00307         if(menu == 0L)
00308             return UMENU_NULL;
00309
00310         LStr255 pstr(name);
00311         LMenu *newMenu = new LMenu(::UniqueID('MENU'), pstr);
00312         menuBar->InstallMenu(newMenu, hierMenu);
00313
00314         menu->InsertCommand(pstr, cmd_UseMenuItem, max_Int16 - 1);
00315 #if TARGET_API_MAC_CARBON
00316         UAppearanceMenus::SetItemHierID(menu->GetMacMenuH(), ::CountMenuItems(menu->GetMacMenuH()),
00317             newMenu->GetMenuID());
00318 #else
00319         UConditionalMenus::SetItemHierID(menu->GetMacMenuH(), ::CountMenuItems(menu->GetMacMenuH()),
00320             newMenu->GetMenuID());
00321 #endif
00322         return newMenu->GetMenuID();
00323     }
00324     return UMENU_NULL;
00325 #endif
00326 #ifdef qGTK
00327     GtkWidget *parent = 0L;
00328
00329     if(top == UMENU_NULL)
00330     {
00331         // try to find the menubar : the menu bar should be mapped
00332         // to a UMenu object as the main widget
00333         const UCmdTarget *target = UEventQueryWidget(widid);
00334         UMenu *menu = 0L;
00335         if(target == 0L || !target->IsKindOf(URUNTIME_CLASS(UMenu)))
00336             return UMENU_NULL;
00337
00338         menu = (UMenu *)target;
00339         if(menu == 0L)
00340             return UMENU_NULL;
00341
00342         GtkWidget *wid = (GtkWidget *)menu->GetWidget(kUMainWidget);
00343         if(wid == 0L || !GTK_IS_MENU_SHELL(wid))
00344             return UMENU_NULL;
00345
00346         parent = wid;
00347     }
00348     else
00349     {
00350         if(!GTK_IS_MENU_SHELL(top))
00351             return UMENU_NULL;
00352         parent = (GtkWidget *)top;
00353     }
00354
00355     GtkWidget *menuitem = gtk_menu_item_new_with_label(title);
00356     gtk_widget_show(menuitem);
00357     gtk_container_add(GTK_CONTAINER (parent), menuitem);
00358
00359     GtkWidget *menu = gtk_menu_new();
00360     gtk_menu_item_set_submenu(GTK_MENU_ITEM (menuitem), menu);
00361     /*GtkAccelGroup *accel_group = */gtk_menu_ensure_uline_accel_group (GTK_MENU (menu));
00362
00363     return (UMENU)menu;
00364 #endif
00365 #ifdef WIN32
00366     if(top == UMENU_NULL)
00367     {
00368         CMenu* pTopMenu = AfxGetMainWnd()->GetMenu();
00369         CMenu menu;
00370         menu.CreatePopupMenu();
00371         pTopMenu->AppendMenu(MF_POPUP, (UINT)menu.GetSafeHmenu(), name);
00372
00373         static bool firsttime = true;
00374         if(firsttime)
00375         {
00376             pTopMenu->DeleteMenu(0, MF_BYPOSITION);
00377             firsttime = false;
00378         }
00379         return (UMENU)menu.Detach();
00380     }
00381     else
00382     {
00383         HMENU menuhdl = (HMENU)top;
00384         CMenu parent;
00385         CMenu menu;
00386         menu.CreatePopupMenu();
00387         VERIFY(parent.Attach(menuhdl));
00388         parent.AppendMenu(MF_POPUP, (UINT)menu.GetSafeHmenu(), name);
00389         parent.Detach();
00390         return (UMENU)menu.Detach();
00391     }
00392 #endif
00393 }

UMENU UMenuAddSeparator | ( | int | widid,
 |  | UMENU | top
 | ) |

Definition at line 803 of file umenu.cpp.

00804 {
00805     UASSERT(top != UMENU_NULL);
00806
00807 #ifdef qMacPP
00808     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00809     LMenu *menu = menuBar->FetchMenu(top);
00810     if(menu)
00811     {
00812         menu->InsertCommand("\p-", 0, max_Int16 - 1);
00813     }
00814     else
00815     {
00816         MenuHandle mhdl = ::GetMenu(top);
00817         if(mhdl != 0L)
00818         {
00819             SInt16  menuLength = ::CountMenuItems(mhdl);
00820             ::MacInsertMenuItem(mhdl, "\p-", menuLength);
00821         }
00822     }
00823
00824     return UMENU_NULL;
00825 #endif
00826 #ifdef qMacAPP
00827     MenuRef menu = MAGetMenu(top);
00828     if(menu)
00829     {
00830         CStr255_AC pstr("-");
00831         gDispatcher->DoMakeMenuBarManager();
00832         TMenuBarManager::fgMenuBarManager->AddMenuItem(pstr, top, ::CountMenuItems(menu), 0);
00833     }
00834
00835     return UMENU_NULL;
00836 #endif
00837 #ifdef qGTK
00838     if(!GTK_IS_MENU_SHELL(top))
00839         return UMENU_NULL;
00840     GtkWidget *parent = (GtkWidget *)top;
00841
00842     GtkWidget *menuitem = gtk_menu_item_new();
00843     gtk_widget_show(menuitem);
00844     gtk_container_add(GTK_CONTAINER (parent), menuitem);
00845     gtk_widget_set_sensitive(menuitem, FALSE);
00846     return UMENU_NULL;
00847 #endif
00848 #ifdef WIN32
00849     HMENU menuhdl = (HMENU)top;
00850     CMenu parent;
00851     VERIFY(parent.Attach(menuhdl));
00852     parent.AppendMenu(MF_SEPARATOR);
00853     parent.Detach();
00854     return UMENU_NULL;
00855 #endif
00856 }

UMENU UMenuAddToggle | ( | int | widid,
 |  | const char * | name,
 |  | UMENU | top,
 |  | const void * | pixmap,
 |  | int | cmd
 | ) |

Definition at line 721 of file umenu.cpp.

00722 {
00723     UStr title;
00724     int  mod, key;
00725     char mnemonic;
00726     GetMenuTitle(name, title, cmd, mnemonic, mod, key);
00727
00728 #ifdef qMacPP
00729     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00730     LMenu *menu = menuBar->FetchMenu(top);
00731     if(menu)
00732     {
00733         LStr255 pstr(title);
00734         menu->InsertCommand(pstr, cmd, max_Int16 - 1);
00735     }
00736     else
00737     {
00738         MenuHandle mhdl = ::GetMenu(top);
00739         if(mhdl != 0L)
00740         {
00741             SInt16  menuLength = ::CountMenuItems(mhdl);
00742             LStr255 pstr(title);
00743             ::MacInsertMenuItem(mhdl, pstr, menuLength);
00744         }
00745     }
00746
00747     return UMENU_NULL;
00748 #endif
00749 #ifdef qMacAPP
00750     MenuRef menu = MAGetMenu(top);
00751     if(menu)
00752     {
00753         CStr255_AC pstr(title);
00754         gDispatcher->DoMakeMenuBarManager();
00755         TMenuBarManager::fgMenuBarManager->AddMenuItem(pstr, top, ::CountMenuItems(menu), cmd);
00756     }
00757
00758     return UMENU_NULL;
00759 #endif
00760 #ifdef qGTK
00761     UCmdTarget *target = UEventQueryWidget(widid);
00762     if(target == 0L || !target->IsKindOf(URUNTIME_CLASS(UMenu)))
00763         return UMENU_NULL;
00764     UMenu *pmenu = (UMenu *)target;
00765
00766     if(!GTK_IS_MENU_SHELL(top))
00767         return UMENU_NULL;
00768     GtkWidget *parent = (GtkWidget *)top;
00769
00770     GtkWidget *menuitem = gtk_check_menu_item_new_with_label(title);
00771     gtk_widget_show(menuitem);
00772     gtk_container_add(GTK_CONTAINER (parent), menuitem);
00773     addToAccelGroup((GtkAccelGroup *)pmenu->GetAccelGroup(), menuitem, mod, key);
00774 //      gtk_tooltips_set_tip (tooltips, quit1, "Quit the application", NULL);
00775     UEventSendMessage(widid, EV_INIT_WIDGET, cmd, menuitem);
00776
00777     return UMENU_NULL;
00778 #endif
00779 #ifdef WIN32
00780     ASSERT(top != UMENU_NULL);
00781
00782     HMENU menuhdl = (HMENU)top;
00783     CMenu parent;
00784     VERIFY(parent.Attach(menuhdl));
00785
00786     parent.AppendMenu(MF_STRING, UCMD_to_WINCMD(cmd), name);
00787     addAccel(UCMD_to_WINCMD(cmd), mod, key);
00788
00789     if(pixmap != 0L && strlen((const char *)pixmap))
00790     {
00791         HBITMAP bmap = UMakeBitmap((const char *)pixmap);
00792         CBitmap b;
00793         VERIFY(b.Attach(bmap));
00794         parent.SetMenuItemBitmaps(UCMD_to_WINCMD(cmd), MF_BYCOMMAND, &b, &b);
00795         b.Detach();
00796     }
00797
00798     parent.Detach();
00799     return UMENU_NULL;
00800 #endif
00801 }

int UMenuCount ( UMENU top )

Definition at line 566 of file umenu.cpp.

00567 {
00568     UASSERT(top != UMENU_NULL);
00569
00570 #ifdef qMacAPP
00571     MenuRef menu = MAGetMenu(top);
00572     if(menu)
00573     {
00574         return ::CountMenuItems(menu);
00575     }
00576 #endif
00577 #ifdef qMacPP
00578     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00579     LMenu *menu = menuBar->FetchMenu(top);
00580     if(menu)
00581     {
00582         return ::CountMenuItems(menu->GetMacMenuH());
00583     }
00584     else
00585     {
00586         MenuHandle mhdl = ::GetMenu(top);
00587         if(mhdl != 0L)
00588         {
00589             return ::CountMenuItems(mhdl);
00590         }
00591     }
00592 #endif
00593 #ifdef WIN32
00594     CMenu parent;
00595     HMENU menuhdl = (HMENU)top;
00596     VERIFY(parent.Attach(menuhdl));
00597
00598     UINT numItems = parent.GetMenuItemCount();
00599     parent.Detach();
00600
00601     return numItems;
00602 #endif
00603
00604     return 0;
00605 }

void UMenuDelete | ( | UMENU | top,
 |  | int | afterIndex
 | ) |

Definition at line 506 of file umenu.cpp.

00507 {
00508     UASSERT(top != UMENU_NULL);
00509
00510 #ifdef qMacAPP
00511     MenuRef menu = MAGetMenu(top);
00512     if(menu)
00513     {
00514         short numItems = ::CountMenuItems(menu);
00515         afterIndex++;
00516         while (numItems >= afterIndex)
00517         {
00518             ::DeleteMenuItem(menu, numItems);
00519             --numItems;
00520         }
00521     }
00522 #endif
00523 #ifdef qMacPP
00524     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00525     LMenu *menu = menuBar->FetchMenu(top);
00526     if(menu)
00527     {
00528         short numItems = ::CountMenuItems(menu->GetMacMenuH());
00529         afterIndex++;
00530         while (numItems >= afterIndex)
00531         {
00532             menu->RemoveItem(numItems);
00533             --numItems;
00534         }
00535     }
00536     else
00537     {
00538         MenuHandle mhdl = ::GetMenu(top);
00539         if(mhdl != 0L)
00540         {
00541             short numItems = ::CountMenuItems(mhdl);
00542             afterIndex++;
00543             while (numItems >= afterIndex)
00544             {
00545                 ::DeleteMenuItem(mhdl, numItems);
00546                 --numItems;
00547             }
00548         }
00549     }
00550 #endif
00551 #ifdef WIN32
00552     CMenu parent;
00553     HMENU menuhdl = (HMENU)top;
00554     VERIFY(parent.Attach(menuhdl));
00555
00556     int numItems = (int)parent.GetMenuItemCount() - 1;
00557     while (numItems >= afterIndex)
00558     {
00559         VERIFY(parent.DeleteMenu(numItems, MF_BYPOSITION));
00560         --numItems;
00561     }
00562     parent.Detach();
00563 #endif
00564 }

void UMenuDeleteByCmd | ( | UMENU | top,
 |  | int | cmd
 | ) |

Definition at line 607 of file umenu.cpp.

00608 {
00609     UASSERT(top != UMENU_NULL);
00610
00611 #ifdef qMacAPP
00612     MenuID menuNo;
00613     short itemNo;
00614     MenuRef menu = CommandToComponents(cmd, menuNo, itemNo);
00615     if(menu)
00616     {
00617         ::DeleteMenuItem(menu, itemNo);
00618     }
00619 #endif
00620 #ifdef qMacPP
00621     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00622     LMenu *menu = menuBar->FetchMenu(top);
00623     if(menu)
00624     {
00625         menu->RemoveCommand(cmd);
00626     }
00627 #endif
00628 #ifdef WIN32
00629     CMenu parent;
00630     HMENU menuhdl = (HMENU)top;
00631     VERIFY(parent.Attach(menuhdl));
00632
00633     VERIFY(parent.DeleteMenu(cmd, MF_BYCOMMAND));
00634
00635     parent.Detach();
00636 #endif
00637 }

Generated on Sun Oct 21 12:44:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


umenu.h File Reference

rf/umenu.h File Reference

#include "uwidget.h"

Include dependency graph for umenu.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | UMenu

Functions

UMENU | UMenuAddPulldown (int widid, const char *name, UMENU top)
UMENU | UMenuAddToggle (int widid, const char *name, UMENU top, const void *pixmap, int cmd)
UMENU | UMenuAddButton (int widid, const char *name, UMENU top, const void *pixmap, int cmd)
UMENU | UMenuAddSeparator (int widid, UMENU top)
void | UMenuDelete (UMENU top, int afterIndex)
void | UMenuDeleteByCmd (UMENU top, int cmd)
int | UMenuCount (UMENU top)

Function Documentation

UMENU UMenuAddButton | ( | int | widid,
 |  | const char * | name,
 |  | UMENU | top,
 |  | const void * | pixmap,
 |  | int | cmd
 | ) |

Definition at line 639 of file umenu.cpp.

Referenced by PyMenuMgr::AddButton(), and CreateMainMenubar().

00640 {
00641     UStr title;
00642     int  mod, key;
00643     char mnemonic;
00644     GetMenuTitle(name, title, cmd, mnemonic, mod, key);
00645
00646     UASSERT(top != UMENU_NULL);
00647
00648 #ifdef qMacPP
00649     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00650     LMenu *menu = menuBar->FetchMenu(top);
00651     if(menu)
00652     {
00653         LStr255 pstr(title);
00654         menu->InsertCommand(pstr, cmd, max_Int16 - 1);
00655     }
00656     else
00657     {
00658         MenuHandle mhdl = ::GetMenu(top);
00659         if(mhdl != 0L)
00660         {
00661             SInt16  menuLength = ::CountMenuItems(mhdl);
00662             LStr255 pstr(title);
00663             ::MacInsertMenuItem(mhdl, pstr, menuLength);
00664         }
00665     }
00666
00667     return UMENU_NULL;
00668 #endif
00669 #ifdef qMacAPP
00670     MenuRef menu = MAGetMenu(top);
00671     if(menu)
00672     {
00673         CStr255_AC pstr(title);
00674         gDispatcher->DoMakeMenuBarManager();
00675         TMenuBarManager::fgMenuBarManager->AddMenuItem(pstr, top, ::CountMenuItems(menu), cmd);
00676     }
00677
00678     return UMENU_NULL;
00679 #endif
00680 #ifdef qGTK
00681     UCmdTarget *target = UEventQueryWidget(widid);
00682     if(target == 0L || !target->IsKindOf(URUNTIME_CLASS(UMenu)))
00683         return UMENU_NULL;
00684     UMenu *pmenu = (UMenu *)target;
00685
00686     if(!GTK_IS_MENU_SHELL(top))
00687         return UMENU_NULL;
00688     GtkWidget *parent = (GtkWidget *)top;
00689
00690     GtkWidget *menuitem = gtk_menu_item_new_with_label_pixmap(title, pixmap);
00691     gtk_widget_show (menuitem);
00692     gtk_container_add (GTK_CONTAINER (parent), menuitem);
00693     addToAccelGroup((GtkAccelGroup *)pmenu->GetAccelGroup(), menuitem, mod, key);
00694 //      gtk_tooltips_set_tip (tooltips, quit1, "Quit the application", NULL);
00695     UEventSendMessage(widid, EV_INIT_WIDGET, cmd, menuitem);
00696
00697     return UMENU_NULL;
00698 #endif
00699 #ifdef WIN32
00700     HMENU menuhdl = (HMENU)top;
00701     CMenu parent;
00702     VERIFY(parent.Attach(menuhdl));
00703
00704     parent.AppendMenu(MF_STRING, UCMD_to_WINCMD(cmd), name);
00705     addAccel(UCMD_to_WINCMD(cmd), mod, key);
00706
00707     if(pixmap != 0L && strlen((const char *)pixmap))
00708     {
00709         HBITMAP bmap = UMakeBitmap((const char *)pixmap);
00710         CBitmap b;
00711         VERIFY(b.Attach(bmap));
00712         parent.SetMenuItemBitmaps(UCMD_to_WINCMD(cmd), MF_BYCOMMAND, &b, &b);
00713         b.Detach();
00714     }
00715
00716     parent.Detach();
00717     return UMENU_NULL;
00718 #endif
00719 }

UMENU UMenuAddPulldown | ( | int | widid,
 |  | const char * | name,
 |  | UMENU | top
 | ) |

Definition at line 288 of file umenu.cpp.

Referenced by PyMenuMgr::AddPulldown(), and CreateMainMenubar().

00289 {
00290     UStr title;
00291     int  mod, key;
00292     char mnemonic;
00293     GetMenuTitle(name, title, 0, mnemonic, mod, key);
00294
00295 #ifdef qMacAPP
00296     return UMENU_NULL;
00297 #endif
00298 #ifdef qMacPP
00299     if(top == UMENU_NULL)
00300     {
00301         Assert_(0); // TODO
00302     }
00303     else
00304     {
00305         LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00306         LMenu *menu = menuBar->FetchMenu(top);
00307         if(menu == 0L)
00308             return UMENU_NULL;
00309
00310         LStr255 pstr(name);
00311         LMenu *newMenu = new LMenu(::UniqueID('MENU'), pstr);
00312         menuBar->InstallMenu(newMenu, hierMenu);
00313
00314         menu->InsertCommand(pstr, cmd_UseMenuItem, max_Int16 - 1);
00315 #if TARGET_API_MAC_CARBON
00316         UAppearanceMenus::SetItemHierID(menu->GetMacMenuH(), ::CountMenuItems(menu->GetMacMenuH()),
00317             newMenu->GetMenuID());
00318 #else
00319         UConditionalMenus::SetItemHierID(menu->GetMacMenuH(), ::CountMenuItems(menu->GetMacMenuH()),
00320             newMenu->GetMenuID());
00321 #endif
00322         return newMenu->GetMenuID();
00323     }
00324     return UMENU_NULL;
00325 #endif
00326 #ifdef qGTK
00327     GtkWidget *parent = 0L;
00328
00329     if(top == UMENU_NULL)
00330     {
00331         // try to find the menubar : the menu bar should be mapped
00332         // to a UMenu object as the main widget
00333         const UCmdTarget *target = UEventQueryWidget(widid);
00334         UMenu *menu = 0L;
00335         if(target == 0L || !target->IsKindOf(URUNTIME_CLASS(UMenu)))
00336             return UMENU_NULL;
00337
00338         menu = (UMenu *)target;
00339         if(menu == 0L)
00340             return UMENU_NULL;
00341
00342         GtkWidget *wid = (GtkWidget *)menu->GetWidget(kUMainWidget);
00343         if(wid == 0L || !GTK_IS_MENU_SHELL(wid))
00344             return UMENU_NULL;
00345
00346         parent = wid;
00347     }
00348     else
00349     {
00350         if(!GTK_IS_MENU_SHELL(top))
00351             return UMENU_NULL;
00352         parent = (GtkWidget *)top;
00353     }
00354
00355     GtkWidget *menuitem = gtk_menu_item_new_with_label(title);
00356     gtk_widget_show(menuitem);
00357     gtk_container_add(GTK_CONTAINER (parent), menuitem);
00358
00359     GtkWidget *menu = gtk_menu_new();
00360     gtk_menu_item_set_submenu(GTK_MENU_ITEM (menuitem), menu);
00361     /*GtkAccelGroup *accel_group = */gtk_menu_ensure_uline_accel_group (GTK_MENU (menu));
00362
00363     return (UMENU)menu;
00364 #endif
00365 #ifdef WIN32
00366     if(top == UMENU_NULL)
00367     {
00368         CMenu* pTopMenu = AfxGetMainWnd()->GetMenu();
00369         CMenu menu;
00370         menu.CreatePopupMenu();
00371         pTopMenu->AppendMenu(MF_POPUP, (UINT)menu.GetSafeHmenu(), name);
00372
00373         static bool firsttime = true;
00374         if(firsttime)
00375         {
00376             pTopMenu->DeleteMenu(0, MF_BYPOSITION);
00377             firsttime = false;
00378         }
00379         return (UMENU)menu.Detach();
00380     }
00381     else
00382     {
00383         HMENU menuhdl = (HMENU)top;
00384         CMenu parent;
00385         CMenu menu;
00386         menu.CreatePopupMenu();
00387         VERIFY(parent.Attach(menuhdl));
00388         parent.AppendMenu(MF_POPUP, (UINT)menu.GetSafeHmenu(), name);
00389         parent.Detach();
00390         return (UMENU)menu.Detach();
00391     }
00392 #endif
00393 }

UMENU UMenuAddSeparator | ( | int | widid,
 |  | UMENU | top
 | ) |

Definition at line 803 of file umenu.cpp.

Referenced by PyMenuMgr::AddSeparator(), and CreateMainMenubar().

00804 {
00805     UASSERT(top != UMENU_NULL);
00806
00807 #ifdef qMacPP
00808     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00809     LMenu *menu = menuBar->FetchMenu(top);
00810     if(menu)
00811     {
00812         menu->InsertCommand("\p-", 0, max_Int16 - 1);
00813     }
00814     else
00815     {
00816         MenuHandle mhdl = ::GetMenu(top);
00817         if(mhdl != 0L)
00818         {
00819             SInt16  menuLength = ::CountMenuItems(mhdl);
00820             ::MacInsertMenuItem(mhdl, "\p-", menuLength);
00821         }
00822     }
00823
00824     return UMENU_NULL;
00825 #endif
00826 #ifdef qMacAPP
00827     MenuRef menu = MAGetMenu(top);
00828     if(menu)
00829     {
00830         CStr255_AC pstr("-");
00831         gDispatcher->DoMakeMenuBarManager();
00832         TMenuBarManager::fgMenuBarManager->AddMenuItem(pstr, top, ::CountMenuItems(menu), 0);
00833     }
00834
00835     return UMENU_NULL;
00836 #endif
00837 #ifdef qGTK
00838     if(!GTK_IS_MENU_SHELL(top))
00839         return UMENU_NULL;
00840     GtkWidget *parent = (GtkWidget *)top;
00841
00842     GtkWidget *menuitem = gtk_menu_item_new();
00843     gtk_widget_show(menuitem);
00844     gtk_container_add(GTK_CONTAINER (parent), menuitem);
00845     gtk_widget_set_sensitive(menuitem, FALSE);
00846     return UMENU_NULL;
00847 #endif
00848 #ifdef WIN32
00849     HMENU menuhdl = (HMENU)top;
00850     CMenu parent;
00851     VERIFY(parent.Attach(menuhdl));
00852     parent.AppendMenu(MF_SEPARATOR);
00853     parent.Detach();
00854     return UMENU_NULL;
00855 #endif
00856 }

UMENU UMenuAddToggle | ( | int | widid,
 |  | const char * | name,
 |  | UMENU | top,
 |  | const void * | pixmap,
 |  | int | cmd
 | ) |

Definition at line 721 of file umenu.cpp.

Referenced by PyMenuMgr::AddToggle().

00722 {
00723     UStr title;
00724     int  mod, key;
00725     char mnemonic;
00726     GetMenuTitle(name, title, cmd, mnemonic, mod, key);
00727
00728 #ifdef qMacPP
00729     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00730     LMenu *menu = menuBar->FetchMenu(top);
00731     if(menu)
00732     {
00733         LStr255 pstr(title);
00734         menu->InsertCommand(pstr, cmd, max_Int16 - 1);
00735     }
00736     else
00737     {
00738         MenuHandle mhdl = ::GetMenu(top);
00739         if(mhdl != 0L)
00740         {
00741             SInt16  menuLength = ::CountMenuItems(mhdl);
00742             LStr255 pstr(title);
00743             ::MacInsertMenuItem(mhdl, pstr, menuLength);
00744         }
00745     }
00746
00747     return UMENU_NULL;
00748 #endif
00749 #ifdef qMacAPP
00750     MenuRef menu = MAGetMenu(top);
00751     if(menu)
00752     {
00753         CStr255_AC pstr(title);
00754         gDispatcher->DoMakeMenuBarManager();
00755         TMenuBarManager::fgMenuBarManager->AddMenuItem(pstr, top, ::CountMenuItems(menu), cmd);
00756     }
00757
00758     return UMENU_NULL;
00759 #endif
00760 #ifdef qGTK
00761     UCmdTarget *target = UEventQueryWidget(widid);
00762     if(target == 0L || !target->IsKindOf(URUNTIME_CLASS(UMenu)))
00763         return UMENU_NULL;
00764     UMenu *pmenu = (UMenu *)target;
00765
00766     if(!GTK_IS_MENU_SHELL(top))
00767         return UMENU_NULL;
00768     GtkWidget *parent = (GtkWidget *)top;
00769
00770     GtkWidget *menuitem = gtk_check_menu_item_new_with_label(title);
00771     gtk_widget_show(menuitem);
00772     gtk_container_add(GTK_CONTAINER (parent), menuitem);
00773     addToAccelGroup((GtkAccelGroup *)pmenu->GetAccelGroup(), menuitem, mod, key);
00774 //      gtk_tooltips_set_tip (tooltips, quit1, "Quit the application", NULL);
00775     UEventSendMessage(widid, EV_INIT_WIDGET, cmd, menuitem);
00776
00777     return UMENU_NULL;
00778 #endif
00779 #ifdef WIN32
00780     ASSERT(top != UMENU_NULL);
00781
00782     HMENU menuhdl = (HMENU)top;
00783     CMenu parent;
00784     VERIFY(parent.Attach(menuhdl));
00785
00786     parent.AppendMenu(MF_STRING, UCMD_to_WINCMD(cmd), name);
00787     addAccel(UCMD_to_WINCMD(cmd), mod, key);
00788
00789     if(pixmap != 0L && strlen((const char *)pixmap))
00790     {
00791         HBITMAP bmap = UMakeBitmap((const char *)pixmap);
00792         CBitmap b;
00793         VERIFY(b.Attach(bmap));
00794         parent.SetMenuItemBitmaps(UCMD_to_WINCMD(cmd), MF_BYCOMMAND, &b, &b);
00795         b.Detach();
00796     }
00797
00798     parent.Detach();
00799     return UMENU_NULL;
00800 #endif
00801 }

int UMenuCount ( UMENU top )

Definition at line 566 of file umenu.cpp.

Referenced by PyMenuMgr::Count().

00567 {
00568     UASSERT(top != UMENU_NULL);
00569
00570 #ifdef qMacAPP
00571     MenuRef menu = MAGetMenu(top);
00572     if(menu)
00573     {
00574         return ::CountMenuItems(menu);
00575     }
00576 #endif
00577 #ifdef qMacPP
00578     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00579     LMenu *menu = menuBar->FetchMenu(top);
00580     if(menu)
00581     {
00582         return ::CountMenuItems(menu->GetMacMenuH());
00583     }
00584     else
00585     {
00586         MenuHandle mhdl = ::GetMenu(top);
00587         if(mhdl != 0L)
00588         {
00589             return ::CountMenuItems(mhdl);
00590         }
00591     }
00592 #endif
00593 #ifdef WIN32
00594     CMenu parent;
00595     HMENU menuhdl = (HMENU)top;
00596     VERIFY(parent.Attach(menuhdl));
00597
00598     UINT numItems = parent.GetMenuItemCount();
00599     parent.Detach();
00600
00601     return numItems;
00602 #endif
00603
00604     return 0;
00605 }

void UMenuDelete | ( | UMENU | top,
 |  | int | afterIndex
 | ) |

Definition at line 506 of file umenu.cpp.

Referenced by PyMenuMgr::Delete().

00507 {
00508     UASSERT(top != UMENU_NULL);
00509
00510 #ifdef qMacAPP
00511     MenuRef menu = MAGetMenu(top);
00512     if(menu)
00513     {
00514         short numItems = ::CountMenuItems(menu);
00515         afterIndex++;
00516         while (numItems >= afterIndex)
00517         {
00518             ::DeleteMenuItem(menu, numItems);
00519             --numItems;
00520         }
00521     }
00522 #endif
00523 #ifdef qMacPP
00524     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00525     LMenu *menu = menuBar->FetchMenu(top);
00526     if(menu)
00527     {
00528         short numItems = ::CountMenuItems(menu->GetMacMenuH());
00529         afterIndex++;
00530         while (numItems >= afterIndex)
00531         {
00532             menu->RemoveItem(numItems);
00533             --numItems;
00534         }
00535     }
00536     else
00537     {
00538         MenuHandle mhdl = ::GetMenu(top);
00539         if(mhdl != 0L)
00540         {
00541             short numItems = ::CountMenuItems(mhdl);
00542             afterIndex++;
00543             while (numItems >= afterIndex)
00544             {
00545                 ::DeleteMenuItem(mhdl, numItems);
00546                 --numItems;
00547             }
00548         }
00549     }
00550 #endif
00551 #ifdef WIN32
00552     CMenu parent;
00553     HMENU menuhdl = (HMENU)top;
00554     VERIFY(parent.Attach(menuhdl));
00555
00556     int numItems = (int)parent.GetMenuItemCount() - 1;
00557     while (numItems >= afterIndex)
00558     {
00559         VERIFY(parent.DeleteMenu(numItems, MF_BYPOSITION));
00560         --numItems;
00561     }
00562     parent.Detach();
00563 #endif
00564 }

void UMenuDeleteByCmd | ( | UMENU | top,
 |  | int | cmd
 | ) |

Definition at line 607 of file umenu.cpp.

Referenced by PyMenuMgr::DeleteByCmd().

00608 {
00609     UASSERT(top != UMENU_NULL);
00610
00611 #ifdef qMacAPP
00612     MenuID menuNo;
00613     short itemNo;
00614     MenuRef menu = CommandToComponents(cmd, menuNo, itemNo);
00615     if(menu)
00616     {
00617         ::DeleteMenuItem(menu, itemNo);
00618     }
00619 #endif
00620 #ifdef qMacPP
00621     LMenuBar *menuBar = LMenuBar::GetCurrentMenuBar();
00622     LMenu *menu = menuBar->FetchMenu(top);
00623     if(menu)
00624     {
00625         menu->RemoveCommand(cmd);
00626     }
00627 #endif
00628 #ifdef WIN32
00629     CMenu parent;
00630     HMENU menuhdl = (HMENU)top;
00631     VERIFY(parent.Attach(menuhdl));
00632
00633     VERIFY(parent.DeleteMenu(cmd, MF_BYCOMMAND));
00634
00635     parent.Detach();
00636 #endif
00637 }

Generated on Sun Oct 21 12:44:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


uobject.cpp File Reference

rf/uobject.cpp File Reference

#include "stdafx.h"
#include <string.h>
#include "uobject.h"

Include dependency graph for uobject.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


uobject.h File Reference

rf/uobject.h File Reference

#include "uconfig.h"

Include dependency graph for uobject.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | UObject
class | URuntimeClass

Defines

#define | URUNTIME_CLASS(class_name) (class_name::rt##class_name())
#define | UDECLARE_DYNAMIC(class_name)
#define | UDECLARE_DYNCREATE(class_name)
#define | UIMPLEMENT_RUNTIMECLASS(class_name, base_class_name, pfnNew)
#define | UIMPLEMENT_DYNAMIC(class_name, base_class_name) UIMPLEMENT_RUNTIMECLASS(class_name, base_class_name, 0L)
#define | UIMPLEMENT_DYNCREATE(class_name, base_class_name)
#define | UDYNAMIC_CAST(TYPE, EXPR) ((TYPE *)((EXPR) == 0L ? 0L : ((EXPR)->IsKindOf(URUNTIME_CLASS(TYPE)) ? (TYPE *)EXPR : 0L)))

Define Documentation

#define UDECLARE_DYNAMIC ( class_name )

Value:

protected: \
    static const URuntimeClass* _GetBaseClass(); \
    static const URuntimeClass class##class_name; \
public: \
    static const URuntimeClass *rt##class_name(void); \
    virtual const URuntimeClass* GetRuntimeClass() const; \

Definition at line 56 of file uobject.h.

#define UDECLARE_DYNCREATE ( class_name )

Value:

UDECLARE_DYNAMIC(class_name) \
    static UObject* CreateObject(); \

Definition at line 65 of file uobject.h.

#define UDYNAMIC_CAST | ( | TYPE,
 |  | EXPR | ) | ((TYPE *)((EXPR) == 0L ? 0L : ((EXPR)->IsKindOf(URUNTIME_CLASS(TYPE)) ? (TYPE *)EXPR : 0L)))

Definition at line 105 of file uobject.h.

Referenced by LPseudoWinAttachment::SearchWidID().

#define UIMPLEMENT_DYNAMIC | ( | class_name,
 |  | base_class_name | ) | UIMPLEMENT_RUNTIMECLASS(class_name, base_class_name, 0L)

Definition at line 80 of file uobject.h.

#define UIMPLEMENT_DYNCREATE | ( | class_name,
 |  | base_class_name | )

Value:

UObject* class_name::CreateObject() \
        { return new class_name; } \
    UIMPLEMENT_RUNTIMECLASS(class_name, base_class_name, \
        class_name::CreateObject)

Definition at line 83 of file uobject.h.

#define UIMPLEMENT_RUNTIMECLASS | ( | class_name,
 |  | base_class_name,
 |  | pfnNew | )

Value:

const URuntimeClass *class_name::rt##class_name(void) \
        { return &class_name::class##class_name; } \
    const URuntimeClass* class_name::_GetBaseClass() \
        { return URUNTIME_CLASS(base_class_name); } \
    const URuntimeClass class_name::class##class_name( \
        #class_name, sizeof(class class_name), pfnNew, \
            &class_name::_GetBaseClass); \
    const URuntimeClass* class_name::GetRuntimeClass() const \
        { return URUNTIME_CLASS(class_name); } \

Definition at line 69 of file uobject.h.

#define URUNTIME_CLASS ( class_name ) (class_name::rt##class_name())

Definition at line 54 of file uobject.h.

Referenced by UCvsApp::GetBrowserView(), UCvsApp::GetFilesView(), UObject::GetRuntimeClass(), UWidget::HasModal(), CPersistent::SaveAllSettings(), UDC::UDC(), UEventGiveTime(), UMenuAddButton(), UMenuAddPulldown(), UMenuAddToggle(), and _loadPersistentSettings().

Generated on Sun Oct 21 12:44:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ustr.cpp File Reference

rf/ustr.cpp File Reference

#include "stdafx.h"
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <new>
#include "ustr.h"
#include "uconsole.h"

Include dependency graph for ustr.cpp:

Include dependency graph

Go to the source code of this file.

Variables

const unsigned int kMaxChar = 255

Variable Documentation

const unsigned int kMaxChar = 255 [static]

Definition at line 44 of file ustr.cpp.

Generated on Sun Oct 21 12:44:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ustr.h File Reference

rf/ustr.h File Reference

#include "uconfig.h"
#include <string.h>

Include dependency graph for ustr.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | UPStr
up to 255 characters pascal and C string. More...

class | UStr
C string class. More...

Defines

#define | EGCS_CONST

Define Documentation

#define EGCS_CONST

Definition at line 29 of file ustr.h.

Generated on Sun Oct 21 12:44:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


utoolbar.cpp File Reference

rf/utoolbar.cpp File Reference

#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <float.h>
#include "utoolbar.h"
#include "uconsole.h"
#include <vector>
#include <map>

Include dependency graph for utoolbar.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | aref
struct | AREF
class | awidget
class | TbEntry
class | TbEntryButton
class | TbEntryChkButton
class | TbEntryDropDown
class | TbEntrySeparator
class | WININFO

Defines

#define | NEW new

Typedefs

typedef void * | HBITMAP

Enumerations

enum | tbeKind { tbeDropDown, tbeButton, tbeSeparator }

Define Documentation

#define NEW new

Definition at line 54 of file utoolbar.cpp.

Typedef Documentation

typedef void* HBITMAP

Definition at line 89 of file utoolbar.cpp.

Enumeration Type Documentation

enum tbeKind

Enumeration values:
tbeDropDown
tbeButton
tbeSeparator

Definition at line 72 of file utoolbar.cpp.

00073 {
00074     tbeDropDown,
00075     tbeButton,
00076     tbeSeparator
00077 } tbeKind;

Generated on Sun Oct 21 12:44:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


utoolbar.h File Reference

rf/utoolbar.h File Reference

#include "uwidget.h"

Include dependency graph for utoolbar.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class UToolbar

Generated on Sun Oct 21 12:44:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


uwidget.cpp File Reference

rf/uwidget.cpp File Reference

#include "stdafx.h"
#include <stdio.h>
#include "uwidget.h"
#include "uconsole.h"
#include "udraw.h"
#include "umenu.h"

Include dependency graph for uwidget.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define NEW new

Define Documentation

#define NEW new

Definition at line 79 of file uwidget.cpp.

Generated on Sun Oct 21 12:44:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


uwidget.h File Reference

rf/uwidget.h File Reference

#include "umain.h"
#include "ustr.h"
#include <vector>
#include <map>

Include dependency graph for uwidget.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | UColor
portable color definition. More...

class | UTimer
used by the UWidget class to implement timers/repeaters. More...

class | UWidget
This is the pseudo widget class. The pseudo widget class allows to access mapped widgets (using the event EV_INIT_WIDGET) and to manipulate them (i.e. set the caption, visible state...). By derivating this class, you can also take advantage of features like modaling dialogs, timers... More...

Defines

#define | kUMainWidget 0
\def kUMainWidget the command associated with the main widget. More...

Define Documentation

#define kUMainWidget 0

\def kUMainWidget the command associated with the main widget.

Definition at line 86 of file uwidget.h.

Generated on Sun Oct 21 12:44:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


stdafx.h File Reference

rf/support/gtk/stdafx.h File Reference

#include <gtk/gtk.h>

Include dependency graph for stdafx.h:

Include dependency graph

Go to the source code of this file.

Defines

#define | UASSERT g_assert

Functions

GtkLabel * | getLabelFromContainer (GtkContainer *w)

Define Documentation

#define UASSERT g_assert

Definition at line 7 of file stdafx.h.

Referenced by UCmdUI::Check(), UAppConsole(), UEventNotifyMessage(), UEventSendMessage(), UEventSendMessageExt(), UMenuAddButton(), UMenuAddSeparator(), UMenuCount(), UMenuDelete(), UMenuDeleteByCmd(), and TPseudoRotateIconButton::WriteFields().

Function Documentation

GtkLabel* getLabelFromContainer ( GtkContainer * w )

Referenced by UWidget::OnGetText(), UWidget::OnSetText(), UCmdUI::SetText(), and UASSERT().

Generated on Sun Oct 21 12:44:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/gtk/stdafx.h Source File

rf/support/gtk/stdafx.h

Go to the documentation of this file.
00001 /* compatibility */
00002 #ifdef HAVE_CONFIG_H
00003 #include "config.h"
00004 #endif /* HAVE_CONFIG_H */
00005
00006 /* the GTK assert */
00007 #define UASSERT g_assert
00008
00009 #include <gtk/gtk.h>
00010
00011 extern "C" {
00012     GtkLabel *getLabelFromContainer(GtkContainer *w);
00013 }
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


stdafx.h File Reference

rf/support/macapp/stdafx.h File Reference

#include "MacAppTypes.h"

Include dependency graph for stdafx.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | qMacAPP 1
#define | qRangeCheck 0
#define | qReleaseBuild 1
#define | qRelease qReleaseBuild
#define | wantDebugging qDebug
#define | UASSERT(cond)
#define | UTHROW(err) throw CException_AC(mFulErr)

Functions

char * | strdup (const char *str)

Define Documentation

#define UASSERT ( cond )

Definition at line 22 of file stdafx.h.

#define UTHROW ( err ) throw CException_AC(mFulErr)

Definition at line 24 of file stdafx.h.

Referenced by UStr::operator<<(), UStr::operator=(), and UPStr::operator=().

#define qMacAPP 1

Definition at line 1 of file stdafx.h.

#define qRangeCheck 0

Definition at line 7 of file stdafx.h.

#define qRelease qReleaseBuild

Definition at line 12 of file stdafx.h.

#define qReleaseBuild 1

Definition at line 8 of file stdafx.h.

#define wantDebugging qDebug

Definition at line 14 of file stdafx.h.

Function Documentation

char* strdup ( const char * str )

Definition at line 17 of file UPseudoSupport.cpp.

00018 {
00019     if(str == 0L)
00020         return 0L;
00021
00022     size_t len = strlen(str);
00023     char *res = (char *)malloc((len + 1) * sizeof(char));
00024     if(res == 0L)
00025         throw CException_AC(mFulErr);
00026     strcpy(res, str);
00027     return res;
00028 }

Generated on Sun Oct 21 12:44:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/macapp/stdafx.h Source File

rf/support/macapp/stdafx.h

Go to the documentation of this file.
00001 #define qMacAPP 1
00002
00003 #if qDebug
00004 #   define qRangeCheck 1
00005 #   define qReleaseBuild 0
00006 #else
00007 #   define qRangeCheck 0
00008 #   define qReleaseBuild 1
00009 #endif
00010
00011 #undef qRelease
00012 #define qRelease qReleaseBuild
00013
00014 #define wantDebugging qDebug
00015
00016 #include "MacAppTypes.h"
00017
00018 /* the MacAPP assert */
00019 #if qDebug
00020 #   define UASSERT(cond) DebugAssert_AC((cond), #cond, __FILE__, __LINE__)
00021 #else
00022 #   define UASSERT(cond)
00023 #endif
00024 #define UTHROW(err) throw CException_AC(mFulErr)
00025
00026 extern "C" char *strdup(const char *str);
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPseudoSupport.cpp File Reference

rf/support/macapp/UPseudoSupport.cpp File Reference

#include "stdafx.h"
#include <stdlib.h>
#include <Errors.h>
#include "UPseudoSupport.h"
#include "UPopup.h"
#include "UDialogTEView.h"
#include "UEditText.h"
#include "UWindow.h"
#include "USlider.h"
#include "uconsole.h"

Include dependency graph for UPseudoSupport.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CDummyClass
struct | CViewInfo

Defines

#define | MA_CHECK(cond) Assertion_AC(cond, #cond)
#define | Inherited TBehavior
#define | Inherited TTextListView
#define | Inherited TView
#define | Inherited TEditText
#define | Inherited TBehavior
#define | Inherited TIconButton
#define | Inherited TPopup
#define | Inherited TIconPopup
#define | Inherited TScrollBar
#define | Inherited TPseudoIconButton
#define | Inherited TIconCheckBox
#define | Inherited TAdorner
#define | OFFSET 40

Enumerations

enum | { kHierarchicalMin = 0, kHierarchicalMax = 235 }

Functions

char * | strdup (const char *str)
MA_DEFINE_CLASS_M1 (TPseudoWinBehavior, TBehavior)
MA_DEFINE_CLASS_M0 (TPseudoTextListView)
void | NumberToString_US (double n, UStr &s, int decimalPlaces)
void | extractInfos (std::vector< CViewInfo > &infos, std::vector< TPopup *> &popups, TView *view)
bool | InBetweenVSide (const CViewRect &popPos, const CViewRect &pos)
int | findmostright (TPopup *popup, const std::vector< CViewInfo > &infos)
void | macapp_workaround_adlib_bug (TView *view)

Variables

CDummyClass sDummyStarter

Define Documentation

#define Inherited TAdorner

Definition at line 728 of file UPseudoSupport.cpp.

#define Inherited TIconCheckBox

Definition at line 728 of file UPseudoSupport.cpp.

#define Inherited TPseudoIconButton

Definition at line 728 of file UPseudoSupport.cpp.

#define Inherited TScrollBar

Definition at line 728 of file UPseudoSupport.cpp.

#define Inherited TIconPopup

Definition at line 728 of file UPseudoSupport.cpp.

#define Inherited TPopup

Definition at line 728 of file UPseudoSupport.cpp.

#define Inherited TIconButton

Definition at line 728 of file UPseudoSupport.cpp.

#define Inherited TBehavior

Definition at line 728 of file UPseudoSupport.cpp.

#define Inherited TEditText

Definition at line 728 of file UPseudoSupport.cpp.

#define Inherited TView

Definition at line 728 of file UPseudoSupport.cpp.

#define Inherited TTextListView

Definition at line 728 of file UPseudoSupport.cpp.

#define Inherited TBehavior

Definition at line 728 of file UPseudoSupport.cpp.

#define MA_CHECK ( cond ) Assertion_AC(cond, #cond)

Definition at line 15 of file UPseudoSupport.cpp.

Referenced by TPseudoTextListView::DoMouseCommand_SelectCells(), TPseudoTextListView::GetItemText(), and TPseudoTextListView::InsStringBefore().

#define OFFSET 40

Enumeration Type Documentation

anonymous enum

Enumeration values:
kHierarchicalMin
kHierarchicalMax

Definition at line 783 of file UPseudoSupport.cpp.

00784 {
00785     kHierarchicalMin = 0,
00786     kHierarchicalMax = 235
00787 };

Function Documentation

bool InBetweenVSide | ( | const CViewRect & | popPos,
 |  | const CViewRect & | pos
 | ) | [static]

Definition at line 913 of file UPseudoSupport.cpp.

Referenced by findmostright().

00914 {
00915     return (popPos.top >= pos.top && popPos.top <= pos.bottom) ||
00916         (popPos.bottom >= pos.top && popPos.bottom <= pos.bottom) ||
00917          (pos.top >= popPos.top && pos.top <= popPos.bottom) ||
00918         (pos.bottom >= popPos.top && pos.bottom <= popPos.bottom);
00919 }

MA_DEFINE_CLASS_M0 ( TPseudoTextListView )

MA_DEFINE_CLASS_M1 | ( | TPseudoWinBehavior | ,
 |  | TBehavior |
 | ) |

Referenced by TPseudoDoubleNumberText::GetValidationError().

void NumberToString_US | ( | double | n,
 |  | UStr & | s,
 |  | int | decimalPlaces
 | ) | [static]

Definition at line 406 of file UPseudoSupport.cpp.

Referenced by TPseudoDoubleNumberText::SetValue().

00407 {
00408     char tmp[255];
00409     if(decimalPlaces > 0)
00410         sprintf(tmp, "%0.*f", decimalPlaces, n);
00411     else
00412         sprintf(tmp, "%ld", round(n));
00413     s = tmp;
00414 }

void extractInfos | ( | std::vector< CViewInfo > & | infos,
 |  | std::vector< TPopup *> & | popups,
 |  | TView * | view
 | ) | [static]

Definition at line 893 of file UPseudoSupport.cpp.

Referenced by macapp_workaround_adlib_bug().

00894 {
00895     if(view == 0L)
00896         return;
00897
00898     if(MA_MEMBER(view, TPopup) && !MA_MEMBER(view, TIconPopup))
00899     {
00900         popups.push_back((TPopup *)view);
00901     }
00902     else
00903     {
00904         CViewInfo info;
00905         info.view = view;
00906         infos.push_back(info);
00907     }
00908
00909     extractInfos(infos, popups, view->GetNextView());
00910     extractInfos(infos, popups, view->GetSubView());
00911 }

int findmostright | ( | TPopup * | popup,
 |  | const std::vector< CViewInfo > & | infos
 | ) | [static]

Definition at line 921 of file UPseudoSupport.cpp.

Referenced by macapp_workaround_adlib_bug().

00922 {
00923     int most_right = popup->GetWindow()->GetExtent().right;
00924     CViewRect popPos = popup->GetFrame();
00925     popPos = popup->GetSuperView()->LocalToRootView(popPos);
00926
00927     std::vector<CViewInfo>::const_iterator i;
00928     for(i = infos.begin(); i != infos.end(); ++i)
00929     {
00930         TView *view = (*i).view;
00931
00932         CViewRect pos = view->GetFrame();
00933         pos = view->GetSuperView()->LocalToRootView(pos);
00934         if(pos.left > popPos.right && InBetweenVSide(popPos, pos))
00935         {
00936             // the top/bottom popup is inside the top/bottom view
00937             if(pos.left < most_right)
00938                 most_right = pos.left;
00939         }
00940     }
00941
00942     return most_right;
00943 }

void macapp_workaround_adlib_bug ( TView * view )

Definition at line 945 of file UPseudoSupport.cpp.

00946 {
00947     std::vector<TPopup *> popups;
00948     std::vector<CViewInfo> infos;
00949     extractInfos(infos, popups, view->GetSubView());
00950 #   define OFFSET 40
00951
00952     std::vector<TPopup *>::iterator p;
00953     for(p = popups.begin(); p != popups.end(); ++p)
00954     {
00955         TPopup *popup = *p;
00956
00957         int most_right = findmostright(popup, infos);
00958         CViewRect oldPos = popup->GetFrame();
00959         oldPos = popup->GetSuperView()->LocalToRootView(oldPos);
00960         if(most_right > (oldPos.right + OFFSET))
00961         {
00962             oldPos.right = most_right - OFFSET;
00963             oldPos = popup->GetSuperView()->RootViewToLocal(oldPos);
00964             popup->SetFrame(oldPos, true);
00965         }
00966     }
00967 }

char* strdup ( const char * str )

Definition at line 17 of file UPseudoSupport.cpp.

00018 {
00019     if(str == 0L)
00020         return 0L;
00021
00022     size_t len = strlen(str);
00023     char *res = (char *)malloc((len + 1) * sizeof(char));
00024     if(res == 0L)
00025         throw CException_AC(mFulErr);
00026     strcpy(res, str);
00027     return res;
00028 }

Variable Documentation

class CDummyClass sDummyStarter

Generated on Sun Oct 21 12:44:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/macapp/UPseudoSupport.cpp Source File

rf/support/macapp/UPseudoSupport.cpp

Go to the documentation of this file.
00001 #include "stdafx.h"
00002
00003 #include <stdlib.h>
00004 #include <Errors.h>
00005
00006 #include "UPseudoSupport.h"
00007 #include "UPopup.h"
00008 #include "UDialogTEView.h"
00009 #include "UEditText.h"
00010 #include "UWindow.h"
00011 #include "USlider.h"
00012
00013 #include "uconsole.h"
00014
00015 #define MA_CHECK(cond) Assertion_AC(cond, #cond)
00016
00017 extern "C" char *strdup(const char *str)
00018 {
00019     if(str == 0L)
00020         return 0L;
00021
00022     size_t len = strlen(str);
00023     char *res = (char *)malloc((len + 1) * sizeof(char));
00024     if(res == 0L)
00025         throw CException_AC(mFulErr);
00026     strcpy(res, str);
00027     return res;
00028 }
00029
00030 #undef Inherited
00031 #define Inherited TBehavior
00032
00033 MA_DEFINE_CLASS_M1(TPseudoWinBehavior, Inherited);
00034
00035 TPseudoWinBehavior::TPseudoWinBehavior() : TBehavior(kPseudoWinBehavior), fWidID(-1)
00036 {
00037 }
00038
00039 TPseudoWinBehavior::~TPseudoWinBehavior()
00040 {
00041 }
00042
00043 void TPseudoWinBehavior::DoEvent(EventNumber eventNumber, TEventHandler* source, TEvent* event)
00044 {
00045     // find out the command who fired the event (if any)
00046     int cmdid = -1;
00047
00048     // the typing event is originated by a sub-view of an TEditText field
00049     TEventHandler* ourSource = source;
00050     if(eventNumber == cTyping && MA_MEMBER(ourSource, TDialogTEView))
00051     {
00052         ourSource = ((TDialogTEView *)ourSource)->fEditText;
00053     }
00054
00055     if(fWidID != -1)
00056         cmdid = UEventSendMessage(fWidID, EV_FETCHCMD, 0, ourSource);
00057
00058     if(cmdid != -1) switch(eventNumber)
00059     {
00060         case mBecameTarget:
00061         case mResignedTarget:
00062             UEventNotifyMessage(EV_UPDATEFOCUS, eventNumber == mResignedTarget, ourSource);
00063             break;
00064         case mButtonHit:
00065         case mRadioHit:
00066         case mCheckBoxHit:
00067             UEventSendMessage(fWidID, EV_CMD, cmdid, 0L);
00068             break;
00069         case mHScrollBarHit:
00070         case mVScrollBarHit:
00071             if(MA_MEMBER(ourSource, TSlider) || MA_MEMBER(ourSource, TScrollBar))
00072             {
00073                 TCtlMgr *slider = (TCtlMgr *)ourSource;
00074                 UEventSendMessage(fWidID, EV_SCROLLCHANGE, cmdid, (void *)slider->GetValue());
00075             }
00076             break;
00077         case mPopupHit:
00078             if(MA_MEMBER(ourSource, TPopup))
00079             {
00080                 TPopup *popup = (TPopup *)ourSource;
00081                 short cur = popup->GetCurrentItem();
00082                 CStr255_AC pstr = popup->GetItemText(cur);
00083                 UPStr content(pstr);
00084                 UEventSendMessage(fWidID, EV_COMBO_SEL, UMAKEINT(cmdid, cur - 1),
00085                     (void *)(const char *)content);
00086             }
00087             break;
00088         case mControlHit:
00089             if(MA_MEMBER(ourSource, TSlider))
00090             {
00091                 TSlider *slider = (TSlider *)ourSource;
00092                 UEventSendMessage(fWidID, EV_SCROLLCHANGE, cmdid, (void *)slider->GetValue());
00093             }
00094             break;
00095         case cTyping:
00096             if(MA_MEMBER(ourSource, TEditText))
00097             {
00098                 UEventSendMessage(fWidID, EV_EDITCHANGE, cmdid, 0L);
00099             }
00100             break;
00101         case TPseudoTextListView::kSelectionChanged:
00102         case TPseudoTextListView::kMultiClickSelection:
00103             if(MA_MEMBER(ourSource, TPseudoTextListView))
00104             {
00105                 TPseudoTextListView *txt = (TPseudoTextListView *)ourSource;
00106                 short entry = txt->FirstSelectedItem();
00107                 CChar255_AC name;
00108                 if(entry > 0)
00109                     name = txt->GetItemText(entry);
00110
00111                 UEventSendMessage(fWidID,
00112                     eventNumber == TPseudoTextListView::kSelectionChanged ?
00113                     EV_LIST_SELECTING : EV_LIST_DBLCLICK, UMAKEINT(cmdid, entry - 1),
00114                     (void *)(const char *)name);
00115             }
00116             break;
00117     }
00118
00119     Inherited::DoEvent(eventNumber, source, event);
00120 }
00121
00122
00123 #undef Inherited
00124 #define Inherited TTextListView
00125 MA_DEFINE_CLASS_M0(TPseudoTextListView);
00126
00127 TPseudoTextListView::TPseudoTextListView()
00128 {
00129 }
00130
00131
00132
00133 TPseudoTextListView::~TPseudoTextListView()
00134 {
00135 }
00136
00137
00138 IDType TPseudoTextListView::GetStandardSignature(void) const
00139 {
00140     return TPseudoTextListView::kTextStringListViewSignature;
00141 }
00142
00143 CStr255_AC TPseudoTextListView::GetItemText(GridCoordinate anItem) const
00144 {
00145     MA_CHECK(this->fNumOfRows == this->fStringContainer.size());
00146     MA_CHECK(1 <= anItem && this->fStringContainer.size() >= anItem);
00147
00148     CStr255_AC aString = this->fStringContainer[anItem - 1];
00149     return aString;
00150 }
00151
00152 void TPseudoTextListView::InsStringBefore(short anItem, const char * string)
00153 {
00154     MA_CHECK(1 <= anItem && this->fStringContainer.size() >= anItem - 1);
00155
00156     std::vector<CStr255_AC>::iterator iter = this->fStringContainer.end();
00157
00158     try
00159     {
00160         iter = this->fStringContainer.insert(
00161                     this->fStringContainer.begin() + (anItem - 1), string);
00162     }
00163     catch(CException_AC& theException)
00164     {
00165         if (iter != this->fStringContainer.end())
00166         {
00167             this->fStringContainer.erase(iter);
00168                 // Put it back like it was.  This will maintain internal consistency.
00169         }
00170         throw;
00171     }
00172
00173     this->InsItemBefore(anItem, 1);
00174 }
00175
00176 void TPseudoTextListView::InsStringFirst(const char * string)
00177 {
00178     this->InsStringBefore(1, string);
00179 }
00180
00181 void TPseudoTextListView::InsStringLast(const char * string)
00182 {
00183     this->InsStringBefore(this->fNumOfRows + 1, string);
00184 }
00185
00186 void TPseudoTextListView::DelItemAt(GridCoordinate anItem, GridCoordinate numOfItems)
00187 {
00188     this->fStringContainer.erase(
00189             this->fStringContainer.begin() + (anItem - 1),
00190             this->fStringContainer.begin() + (anItem - 1 + numOfItems));
00191
00192     this->Inherited::DelItemAt(anItem, numOfItems);
00193 }
00194
00195 void TPseudoTextListView::RemoveAll(void)
00196 {
00197     this->DelItemFirst(this->fNumOfRows);
00198 }
00199
00200 bool TPseudoTextListView::DoMouseCommand_SelectCells(GridCell whichCell, TToolboxEvent * event)
00201 {
00202     MA_CHECK(nil != event);
00203
00204     bool selectionChanged = false;
00205         // Will be true if the selection changed.
00206
00207     if (this->CanSelectCell(whichCell))
00208     {
00209         bool shifted = event->IsShiftKeyPressed();
00210         bool commandKey = event->IsCommandKeyPressed();
00211
00212         if (commandKey)
00213         {
00214             this->SelectCell(whichCell, !this->fSingleSelection,
00215                     kHighlight, !this->IsCellSelected(whichCell));
00216
00217             selectionChanged = true;
00218         }
00219         else if (shifted && !this->fSingleSelection)
00220         {
00221             GridCell runner = whichCell;
00222
00223             if (this->IsCellSelected(whichCell))
00224             {
00225                 for ( ; runner.v <= this->fNumOfRows; runner.v++)
00226                 {
00227                     if (!this->IsCellSelected(runner))
00228                     {
00229                         break;
00230                     }
00231
00232                     this->SelectCell(runner, kExtend, kHighlight, kDeSelect);
00233                 }
00234             }
00235             else
00236             {
00237                 for ( ; runner.v > 0; runner.v--)
00238                 {
00239                     if (this->IsCellSelected(runner))
00240                     {
00241                         break;
00242                     }
00243
00244                     this->SelectCell(runner, kExtend, kHighlight, kSelect);
00245                 }
00246             }
00247
00248             selectionChanged = true;
00249         }
00250         else if (!this->IsCellSelected(whichCell))
00251         {
00252             this->SelectCell(whichCell, kDontExtend, kHighlight, kSelect);
00253
00254             selectionChanged = true;
00255         }
00256     }
00257
00258     return selectionChanged;
00259 }
00260
00261 void TPseudoTextListView::DoMouseCommand(CViewPoint & theMouse, TToolboxEvent * event, CPoint_AC)
00262 {
00263     GridCell aCell;
00264
00265     if (badChoice != this->IdentifyPoint(theMouse, aCell))
00266     {
00267         this->DoMouseCommand_SelectCells(aCell, event);
00268             // First be sure to select/deselect the cell they clicked on.
00269
00270         if (event->GetClickCount() > 1)
00271         {
00272             this->HandleEvent(kMultiClickSelection, this, event);
00273         }
00274     }
00275 }
00276
00277 void TPseudoTextListView::DoKeyEvent(TToolboxEvent* event)// override
00278 {
00279     Boolean handledCharacter = false;
00280
00281     if (this->IsEnabled() && this->Focus())     // if view is not enabled then we don't take ANY keystrokes
00282     {
00283         GridCell selected;
00284         unsigned char ch = event->GetText()[1];
00285
00286         if (ch == chUp)
00287         {
00288             selected = this->FirstSelectedCell();
00289             selected.v -= 1;
00290
00291             this->DoMouseCommand_SelectCells(selected, event);
00292
00293             handledCharacter = true;
00294         }
00295         else if (ch == chDown)
00296         {
00297             selected = this->LastSelectedCell();
00298             selected.v += 1;
00299
00300             this->DoMouseCommand_SelectCells(selected, event);
00301
00302             handledCharacter = true;
00303         }
00304     }
00305
00306     if (!handledCharacter)
00307         Inherited::DoKeyEvent(event);
00308 }
00309
00310 void TPseudoTextListView::SetSelection(const TGridViewDesignator* cellsToSelect,
00311                         bool extendSelection, bool highlight, bool select)
00312 {
00313     this->Inherited::SetSelection(cellsToSelect, extendSelection, highlight, select);
00314
00315     this->Changed(kSelectionChanged, this);
00316     this->HandleEvent(kSelectionChanged, this, nil);
00317 }
00318
00319 #undef Inherited
00320 #define Inherited TView
00321
00322 MA_DEFINE_CLASS_M1(TPseudoCustomView, Inherited);
00323
00324 TPseudoCustomView::TPseudoCustomView()
00325 {
00326 }
00327
00328 TPseudoCustomView::~TPseudoCustomView()
00329 {
00330 }
00331
00332 void TPseudoCustomView::Draw(const CViewRect& area)
00333 {
00334     TWindow *wind = GetWindow();
00335     if(wind != 0L)
00336     {
00337         TPseudoWinBehavior *pseudo = dynamic_cast_AC(TPseudoWinBehavior*,
00338             wind->GetBehaviorWithIdentifier(TPseudoWinBehavior::kPseudoWinBehavior));
00339         if(pseudo != 0L)
00340         {
00341             int cmdid = UEventSendMessage(pseudo->GetWidID(), EV_FETCHCMD, 0, this);
00342             if(cmdid != -1)
00343                 UEventSendMessage(pseudo->GetWidID(), EV_CUSTOM_DRAW, cmdid, this);
00344         }
00345     }
00346 }
00347
00348
00349 #undef Inherited
00350 #define Inherited TEditText
00351
00352 MA_DEFINE_CLASS_M1(TPseudoDoubleNumberText, Inherited);
00353
00354 TPseudoDoubleNumberText::TPseudoDoubleNumberText() : fMaximum(DBL_MAX), fMinimum(DBL_MIN),
00355     fPrecision(kDefaultPrecision)
00356 {
00357 }
00358
00359 TPseudoDoubleNumberText::~TPseudoDoubleNumberText()
00360 {
00361 }
00362
00363 IDType TPseudoDoubleNumberText::GetStandardSignature() const
00364 {
00365     return kStdDoubleNumberText;
00366 }
00367
00368 void TPseudoDoubleNumberText::ReadFields(CStream_AC* aStream)
00369 {
00370     Inherited::ReadFields(aStream);
00371
00372     CStr255_AC theString;
00373     theString = aStream->ReadString(255);
00374     sscanf(CChar255_AC(theString), "%lf", &fMinimum);
00375     theString = aStream->ReadString(255);
00376     sscanf(CChar255_AC(theString), "%lf", &fMaximum);
00377     fPrecision = aStream->ReadInteger();
00378 }
00379
00380 void TPseudoDoubleNumberText::WriteFields(CStream_AC* aStream) const
00381 {
00382     Inherited::WriteFields(aStream);
00383
00384     char tmp[255];
00385     sprintf(tmp, "%lf", fMinimum);
00386     aStream->WriteString(CStr255_AC(tmp));
00387     sprintf(tmp, "%lf", fMaximum);
00388     aStream->WriteString(CStr255_AC(tmp));
00389     aStream->WriteLong(fPrecision);
00390 }
00391
00392
00393 double TPseudoDoubleNumberText::GetValue()
00394 {
00395     double theValue = 0.0;
00396     CStr255_AC theString = GetText();
00397
00398     if (!theString.IsEmpty())
00399     {
00400         sscanf(CChar255_AC(theString), "%lf", &theValue);
00401     }
00402
00403     return theValue;
00404 }
00405
00406 static void NumberToString_US(double n, UStr & s, int decimalPlaces)
00407 {
00408     char tmp[255];
00409     if(decimalPlaces > 0)
00410         sprintf(tmp, "%0.*f", decimalPlaces, n);
00411     else
00412         sprintf(tmp, "%ld", round(n));
00413     s = tmp;
00414 }
00415
00416 void TPseudoDoubleNumberText::SetValue(double newValue, bool redraw)
00417 {
00418     newValue = fMinimum >= newValue ? fMinimum : newValue;
00419     newValue = newValue <= fMaximum ? newValue : fMaximum;
00420
00421     UStr aString;
00422     NumberToString_US(newValue, aString, fPrecision);
00423
00424     CStr255_AC tempString = aString;
00425     SetText(tempString, redraw);
00426 }
00427
00428 long TPseudoDoubleNumberText::GetValidationError()
00429 {
00430     CStr255_AC theString = GetText();
00431
00432     if (!theString.IsEmpty())
00433     {
00434         double extValue;
00435         bool valid = sscanf(CChar255_AC(theString), "%lf", &extValue) == 1;
00436
00437         if (!valid)
00438             return kNonNumericCharacters;
00439         else if (extValue < fMinimum)
00440             return kValueTooSmall;
00441         else if (extValue > fMaximum)
00442             return kValueTooLarge;
00443     }
00444
00445     return kValidValue;
00446 }
00447
00448 #undef Inherited
00449 #define Inherited TBehavior
00450
00451 MA_DEFINE_CLASS_M1(TPseudoAppBehavior, Inherited);
00452
00453 TPseudoAppBehavior::TPseudoAppBehavior() : TBehavior()
00454 {
00455     SetIdleFreq(0); // ASAP
00456 }
00457
00458 TPseudoAppBehavior::~TPseudoAppBehavior()
00459 {
00460 }
00461
00462 bool TPseudoAppBehavior::DoIdle(IdlePhase phase)
00463 {
00464     ::UEventGiveTime();
00465     return false;
00466 }
00467
00468 void TPseudoAppBehavior::DoMenuCommand(CommandNumber aCommandNumber)
00469 {
00470     if(UMacAppMenu::sMAMenuWidID != -1)
00471     {
00472         int handledFlag;
00473         int res = UEventSendMessageExt(UMacAppMenu::sMAMenuWidID, EV_CMD,
00474             aCommandNumber, 0L, &handledFlag);
00475         if(res == 0 && handledFlag)
00476             return;
00477     }
00478
00479     // regular MacApp handling
00480     Inherited::DoMenuCommand(aCommandNumber);
00481 }
00482
00483 void TPseudoAppBehavior::DoSetupMenus()
00484 {
00485     UWidget::DoValidUI(false);
00486     ::UEventGiveTime();
00487
00488     Inherited::DoSetupMenus();
00489 }
00490
00491 bool TPseudoAppBehavior::DoToolboxEvent(TToolboxEvent* event)
00492 {
00493     if(event && event->GetIdentifier() == activateEvt)
00494     {
00495         bool activate = ((event->GetModifiers()) & activeFlag) != 0;
00496         TWindow * aWindow = TWindow::WMgrToWindow((WindowRef)(event->GetMessage()));
00497         if(aWindow)
00498         {
00499             UEventNotifyMessage(EV_UPDATEFOCUS, !activate, aWindow);
00500                 // so the pseudo widget update its current widget.
00501                 // it's important for the menu handling.
00502         }
00503     }
00504
00505     return Inherited::DoToolboxEvent(event);
00506 }
00507
00508 #undef Inherited
00509 #define Inherited TIconButton
00510
00511 MA_DEFINE_CLASS_M1(TPseudoIconButton, Inherited);
00512
00513 TPseudoIconButton::TPseudoIconButton()
00514 {
00515 }
00516
00517 TPseudoIconButton::~TPseudoIconButton()
00518 {
00519 }
00520
00521 void TPseudoIconButton::ReadFields(CStream_AC* aStream)
00522 {
00523     Inherited::ReadFields(aStream);
00524
00525     *aStream >> fContentType;
00526     SetContentRsrcID(fContentType, fRsrcID);
00527 }
00528
00529 void TPseudoIconButton::WriteFields(CStream_AC* aStream) const
00530 {
00531     Inherited::WriteFields(aStream);
00532
00533     *aStream << fContentType;
00534 }
00535
00536 #undef Inherited
00537 #define Inherited TPopup
00538
00539 MA_DEFINE_CLASS_M1(TBuggyPopup, Inherited);
00540
00541 TBuggyPopup::TBuggyPopup()
00542 {
00543 }
00544
00545 TBuggyPopup::~TBuggyPopup()
00546 {
00547 }
00548
00549 void TBuggyPopup::ReadFields(CStream_AC* aStream)
00550 {
00551     Inherited::ReadFields(aStream);
00552
00553     *aStream >> fRealWidth;
00554 }
00555
00556 void TBuggyPopup::WriteFields(CStream_AC* aStream) const
00557 {
00558     Inherited::WriteFields(aStream);
00559
00560     *aStream << fRealWidth;
00561 }
00562
00563 void TBuggyPopup::DoPostCreate(TDocument* itsDocument)
00564 {
00565     if(fRealWidth > 0)
00566     {
00567         CViewRect r = GetExtent();
00568         Resize(CViewPoint(fRealWidth, r.Height()), true);
00569     }
00570 }
00571
00572 #undef Inherited
00573 #define Inherited TIconPopup
00574
00575 MA_DEFINE_CLASS_M1(TPseudoIconPopup, Inherited);
00576
00577 TPseudoIconPopup::TPseudoIconPopup()
00578 {
00579 }
00580
00581 TPseudoIconPopup::~TPseudoIconPopup()
00582 {
00583 }
00584
00585 void TPseudoIconPopup::ReadFields(CStream_AC* aStream)
00586 {
00587     Inherited::ReadFields(aStream);
00588
00589     *aStream >> fContentType;
00590     SetContentRsrcID(fContentType, fRsrcID);
00591 }
00592
00593 void TPseudoIconPopup::WriteFields(CStream_AC* aStream) const
00594 {
00595     Inherited::WriteFields(aStream);
00596
00597     *aStream << fContentType;
00598 }
00599
00600 #undef Inherited
00601 #define Inherited TScrollBar
00602
00603 MA_DEFINE_CLASS_M1(TPseudoScrollBar, Inherited);
00604
00605 TPseudoScrollBar::TPseudoScrollBar() : fPageStep(1), fButtonStep(1)
00606 {
00607 }
00608
00609 TPseudoScrollBar::~TPseudoScrollBar()
00610 {
00611 }
00612
00613 void TPseudoScrollBar::TrackScrollBar(short partCode)
00614 {
00615     switch (partCode)
00616     {
00617         case kControlPageUpPart:
00618             if (GetValue() > GetMinimum())
00619                 DeltaValue(-fPageStep);
00620             break;
00621         case kControlUpButtonPart:
00622             if (GetValue() > GetMinimum())
00623                 DeltaValue(-fButtonStep);
00624             break;
00625         case kControlPageDownPart:
00626             if (GetValue() < GetMaximum())
00627                 DeltaValue(fPageStep);
00628             break;
00629         case kControlDownButtonPart:
00630             if (GetValue() < GetMaximum())
00631                 DeltaValue(fButtonStep);
00632             break;
00633     }
00634 }
00635
00636 #undef Inherited
00637 #define Inherited TPseudoIconButton
00638
00639 MA_DEFINE_CLASS_M1(TPseudoRotateIconButton, Inherited);
00640
00641 TPseudoRotateIconButton::TPseudoRotateIconButton() : fCurrentIcon(0)
00642 {
00643 }
00644
00645 TPseudoRotateIconButton::~TPseudoRotateIconButton()
00646 {
00647 }
00648
00649 void TPseudoRotateIconButton::ReadFields(CStream_AC* aStream)
00650 {
00651     Inherited::ReadFields(aStream);
00652
00653     CChar255_AC str(aStream->ReadString(255));
00654     const char *ptr = str;
00655     while(ptr != 0L)
00656     {
00657         int v;
00658         const char *tmp = strchr(ptr, ',');
00659         if(tmp != 0L)
00660         {
00661             CChar255_AC stmp;
00662             size_t offset = tmp - ptr;
00663             stmp.CopyFrom(ptr, offset);
00664             ptr += offset + 1;
00665             if(sscanf(stmp, "%d", &v) == 1)
00666                 fIconSuite.push_back(v);
00667         }
00668         else
00669         {
00670             if(sscanf(ptr, "%d", &v) == 1)
00671                 fIconSuite.push_back(v);
00672             ptr = 0;
00673         }
00674     }
00675
00676     if(fIconSuite.size() != 0)
00677         SetContentRsrcID(fContentType, fIconSuite[0]);
00678 }
00679
00680 void TPseudoRotateIconButton::WriteFields(CStream_AC* aStream) const
00681 {
00682     Inherited::WriteFields(aStream);
00683
00684     // do we really need to write ?
00685     *aStream << "";
00686     UASSERT(0);
00687 }
00688
00689 void TPseudoRotateIconButton::DoRotate(int icon)
00690 {
00691     if(fCurrentIcon != icon && icon >= 0 && icon < fIconSuite.size())
00692     {
00693         fCurrentIcon = icon;
00694         SetContentRsrcID(fContentType, fIconSuite[fCurrentIcon]);
00695         ForceRedraw();
00696     }
00697 }
00698
00699 #undef Inherited
00700 #define Inherited TIconCheckBox
00701
00702 MA_DEFINE_CLASS_M1(TPseudoIconCheckBox, Inherited);
00703
00704 TPseudoIconCheckBox::TPseudoIconCheckBox()
00705 {
00706 }
00707
00708 TPseudoIconCheckBox::~TPseudoIconCheckBox()
00709 {
00710 }
00711
00712 void TPseudoIconCheckBox::ReadFields(CStream_AC* aStream)
00713 {
00714     Inherited::ReadFields(aStream);
00715
00716     *aStream >> fContentType;
00717     SetContentRsrcID(fContentType, fRsrcID);
00718 }
00719
00720 void TPseudoIconCheckBox::WriteFields(CStream_AC* aStream) const
00721 {
00722     Inherited::WriteFields(aStream);
00723
00724     *aStream << fContentType;
00725 }
00726
00727 #undef Inherited
00728 #define Inherited TAdorner
00729
00730 MA_DEFINE_CLASS_M1(TPseudoWinAdorner, Inherited);
00731
00732 TPseudoWinAdorner::TPseudoWinAdorner() : TAdorner(kPseudoWinAdorner), fWidID(-1)
00733 {
00734 }
00735
00736 TPseudoWinAdorner::~TPseudoWinAdorner()
00737 {
00738     if(fWidID != -1)
00739         UEventSendMessage(fWidID, EV_DESTROY, 0, 0L);
00740 }
00741
00742 void TPseudoWinAdorner::ViewChangedFrame (TView* itsView,
00743                             const CViewRect& oldFrame,
00744                             const CViewRect& newFrame,
00745                             bool    invalidate)
00746 {
00747     TWindow *wind = itsView->GetWindow();
00748     if(wind != 0L && fWidID != -1)
00749     {
00750         int cmdid = UEventSendMessage(fWidID, EV_FETCHCMD, 0, itsView);
00751         if(cmdid != -1)
00752         {
00753             URECT r;
00754             r.left = newFrame.left;
00755             r.right = newFrame.right;
00756             r.top = newFrame.top;
00757             r.bottom = newFrame.bottom;
00758
00759             UEventSendMessage(fWidID, EV_RESIZE, cmdid, &r);
00760         }
00761     }
00762 }
00763
00764 UIMPLEMENT_DYNAMIC(UMacAppMenu, UMenu)
00765
00766 UBEGIN_MESSAGE_MAP(UMacAppMenu, UMenu)
00767     ON_UPDATEUI(UMacAppMenu)
00768 UEND_MESSAGE_MAP()
00769
00770 int UMacAppMenu::sMAMenuWidID = -1;
00771
00772 UMacAppMenu::UMacAppMenu() : UMenu(::UEventGetWidID())
00773 {
00774     sMAMenuWidID = GetWidID();
00775 }
00776
00777 UMacAppMenu::~UMacAppMenu()
00778 {
00779 }
00780
00781 // If hierarchical the range of IDs for applications is restricted.  See IM V-236.
00782 // If the menu isn't managed by MacApp and is in a TPopup, its ID must be outside this range.
00783 enum
00784 {
00785     kHierarchicalMin = 0,
00786     kHierarchicalMax = 235
00787 };
00788
00789 void UMacAppMenu::OnUpdateUI()
00790 {
00791     static bool sSemaphore = false;
00792     USemaphore policeman(sSemaphore);
00793     if(policeman.IsEnteredTwice())
00794         return;
00795
00796     // this is the interesting thing about the toolbar : it resends the
00797     // update UI to other widgets according to the focus information and
00798     // allows the update to be handled several times if the handler asks for it
00799     // (by using UCmdUI::SetContinue)
00800
00801     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00802     std::map<int, void *>::iterator w;
00803     int cmdid;
00804     int widFocus = UWidget::GetFocus();
00805
00806     for(CMenuIterator iter; iter.Current(); ++iter)
00807     {
00808         MenuRef menu = iter;
00809         short menuID = (**menu).menuID;
00810
00811         // see UMenuMgr.cpp from MacApp
00812         if (menuID < kHierarchicalMin || menuID > kHierarchicalMax)
00813             continue;
00814
00815         short numitems = ::CountMItems(menu);
00816         for(int j = 1; j <= numitems; j++)
00817         {
00818             cmdid = CommandFromMenuItem(menuID, j);
00819             if(cmdid < 0)
00820             {
00821                 UAppConsole("The item %d of the menu %d has not a MacApp cmd\n", j, menuID);
00822             }
00823             else
00824             {
00825                 if(cmdid == kUMainWidget)
00826                     continue;
00827
00828                 // first forward the command to the focused widget : if it doesn't want it
00829                 // we give it to the next pseudo widget.
00830                 if(widFocus != -1 && widFocus != GetWidID())
00831                 {
00832                     UCmdUI pUI(cmdid);
00833                     UEventSendMessage(widFocus, EV_UPDTCMD, pUI.m_nID, &pUI);
00834                     if(!pUI.CanContinue())
00835                         continue;
00836                 }
00837
00838                 STD map<int, UCmdTarget *>::const_iterator i;
00839                 for(i = targets.begin(); i != targets.end(); ++i)
00840                 {
00841                     int widid = (*i).first;
00842                     if(widid == widFocus || widid == GetWidID())
00843                         continue;
00844
00845                     UCmdUI pUI(cmdid);
00846                     UEventSendMessage(widid, EV_UPDTCMD, pUI.m_nID, &pUI);
00847                     if(!pUI.CanContinue())
00848                         break;
00849                 }
00850                 if(i == targets.end())
00851                 {
00852                     //UAppConsole("The cmd %d of the menubar has no update handler, it's gonna be disabled\n", cmdid);
00853                     UCmdUI pUI(cmdid);
00854                     pUI.Enable(false);
00855                 }
00856             }
00857         }
00858     }
00859 }
00860
00861 class CDummyClass
00862 {
00863 public:
00864     CDummyClass()
00865     {
00866         InitUSlider();
00867         if (!gUGridViewInitialized)
00868         {
00869             InitUGridView();
00870         }
00871         MA_REGISTER_CLASS(TPseudoAppBehavior);
00872         MA_REGISTER_CLASS(TPseudoIconButton);
00873         MA_REGISTER_CLASS(TPseudoIconPopup);
00874         MA_REGISTER_CLASS(TPseudoScrollBar);
00875         MA_REGISTER_CLASS(TPseudoRotateIconButton);
00876         MA_REGISTER_CLASS(TPseudoIconCheckBox);
00877         MA_REGISTER_CLASS(TBuggyPopup);
00878         MA_REGISTER_CLASS(TPseudoWinBehavior);
00879         MA_REGISTER_CLASS(TPseudoCustomView);
00880         MA_REGISTER_CLASS(TPseudoWinAdorner);
00881         MA_REGISTER_SIGNATURE(TPseudoTextListView,
00882                 TPseudoTextListView::kTextStringListViewSignature);
00883         MA_REGISTER_CLASS(TPseudoDoubleNumberText);
00884     }
00885
00886 } sDummyStarter;
00887
00888 typedef struct CViewInfo
00889 {
00890     TView *view;
00891 };
00892
00893 static void extractInfos(std::vector<CViewInfo> & infos, std::vector<TPopup *> & popups, TView *view)
00894 {
00895     if(view == 0L)
00896         return;
00897
00898     if(MA_MEMBER(view, TPopup) && !MA_MEMBER(view, TIconPopup))
00899     {
00900         popups.push_back((TPopup *)view);
00901     }
00902     else
00903     {
00904         CViewInfo info;
00905         info.view = view;
00906         infos.push_back(info);
00907     }
00908
00909     extractInfos(infos, popups, view->GetNextView());
00910     extractInfos(infos, popups, view->GetSubView());
00911 }
00912
00913 static bool InBetweenVSide(const CViewRect & popPos, const CViewRect & pos)
00914 {
00915     return (popPos.top >= pos.top && popPos.top <= pos.bottom) ||
00916         (popPos.bottom >= pos.top && popPos.bottom <= pos.bottom) ||
00917          (pos.top >= popPos.top && pos.top <= popPos.bottom) ||
00918         (pos.bottom >= popPos.top && pos.bottom <= popPos.bottom);
00919 }
00920
00921 static int findmostright(TPopup *popup, const std::vector<CViewInfo> & infos)
00922 {
00923     int most_right = popup->GetWindow()->GetExtent().right;
00924     CViewRect popPos = popup->GetFrame();
00925     popPos = popup->GetSuperView()->LocalToRootView(popPos);
00926
00927     std::vector<CViewInfo>::const_iterator i;
00928     for(i = infos.begin(); i != infos.end(); ++i)
00929     {
00930         TView *view = (*i).view;
00931
00932         CViewRect pos = view->GetFrame();
00933         pos = view->GetSuperView()->LocalToRootView(pos);
00934         if(pos.left > popPos.right && InBetweenVSide(popPos, pos))
00935         {
00936             // the top/bottom popup is inside the top/bottom view
00937             if(pos.left < most_right)
00938                 most_right = pos.left;
00939         }
00940     }
00941
00942     return most_right;
00943 }
00944
00945 void macapp_workaround_adlib_bug(TView *view)
00946 {
00947     std::vector<TPopup *> popups;
00948     std::vector<CViewInfo> infos;
00949     extractInfos(infos, popups, view->GetSubView());
00950 #   define OFFSET 40
00951
00952     std::vector<TPopup *>::iterator p;
00953     for(p = popups.begin(); p != popups.end(); ++p)
00954     {
00955         TPopup *popup = *p;
00956
00957         int most_right = findmostright(popup, infos);
00958         CViewRect oldPos = popup->GetFrame();
00959         oldPos = popup->GetSuperView()->LocalToRootView(oldPos);
00960         if(most_right > (oldPos.right + OFFSET))
00961         {
00962             oldPos.right = most_right - OFFSET;
00963             oldPos = popup->GetSuperView()->RootViewToLocal(oldPos);
00964             popup->SetFrame(oldPos, true);
00965         }
00966     }
00967 }
00968
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPseudoSupport.h File Reference

rf/support/macapp/UPseudoSupport.h File Reference

#include "uwidget.h"
#include "umenu.h"
#include "UBehavior.h"
#include "UGridView.h"
#include "UEditText.h"
#include "UIconButton.h"
#include <vector>

Include dependency graph for UPseudoSupport.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | UMacAppMenu
class | TBuggyPopup
class | TPseudoAppBehavior
class | TPseudoCustomView
class | TPseudoDoubleNumberText
class | TPseudoIconButton
class | TPseudoIconCheckBox
class | TPseudoIconPopup
class | TPseudoRotateIconButton
class | TPseudoScrollBar
class | TPseudoTextListView
class | TPseudoWinAdorner
class | TPseudoWinBehavior

Functions

void | macapp_workaround_adlib_bug (TView *view)

Function Documentation

void macapp_workaround_adlib_bug ( TView * view )

Definition at line 945 of file UPseudoSupport.cpp.

00946 {
00947     std::vector<TPopup *> popups;
00948     std::vector<CViewInfo> infos;
00949     extractInfos(infos, popups, view->GetSubView());
00950 #   define OFFSET 40
00951
00952     std::vector<TPopup *>::iterator p;
00953     for(p = popups.begin(); p != popups.end(); ++p)
00954     {
00955         TPopup *popup = *p;
00956
00957         int most_right = findmostright(popup, infos);
00958         CViewRect oldPos = popup->GetFrame();
00959         oldPos = popup->GetSuperView()->LocalToRootView(oldPos);
00960         if(most_right > (oldPos.right + OFFSET))
00961         {
00962             oldPos.right = most_right - OFFSET;
00963             oldPos = popup->GetSuperView()->RootViewToLocal(oldPos);
00964             popup->SetFrame(oldPos, true);
00965         }
00966     }
00967 }

Generated on Sun Oct 21 12:44:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/macapp/UPseudoSupport.h Source File

rf/support/macapp/UPseudoSupport.h

Go to the documentation of this file.
00001 #ifndef UPSEUDOSUPPORT_H
00002 #define UPSEUDOSUPPORT_H
00003
00004 #include "uwidget.h"
00005 #include "umenu.h"
00006
00007 #include "UBehavior.h"
00008 #include "UGridView.h"
00009 #include "UEditText.h"
00010 #include "UIconButton.h"
00011 #include <vector>
00012
00013 class TBuggyPopup : public TPopup
00014 {
00015     MA_DECLARE_CLASS;
00016
00017     TBuggyPopup();
00018     virtual ~TBuggyPopup();
00019
00020     virtual void ReadFields(CStream_AC* aStream);
00021     virtual void WriteFields(CStream_AC* aStream) const;
00022     virtual void DoPostCreate(TDocument* itsDocument);
00023 protected:
00024     int fRealWidth;
00025 };
00026
00027 class TPseudoScrollBar : public TScrollBar
00028 {
00029     MA_DECLARE_CLASS;
00030
00031     TPseudoScrollBar();
00032     virtual ~TPseudoScrollBar();
00033
00034     virtual void TrackScrollBar(short partCode);
00035
00036     int fPageStep;
00037     int fButtonStep;
00038 };
00039
00040 class TPseudoIconPopup : public TIconPopup
00041 {
00042     MA_DECLARE_CLASS;
00043
00044     TPseudoIconPopup();
00045     virtual ~TPseudoIconPopup();
00046
00047     virtual void ReadFields(CStream_AC* aStream);
00048     virtual void WriteFields(CStream_AC* aStream) const;
00049 };
00050
00051 class TPseudoIconButton : public TIconButton
00052 {
00053     MA_DECLARE_CLASS;
00054
00055     TPseudoIconButton();
00056     virtual ~TPseudoIconButton();
00057
00058     virtual void ReadFields(CStream_AC* aStream);
00059     virtual void WriteFields(CStream_AC* aStream) const;
00060 };
00061
00062 class TPseudoRotateIconButton : public TPseudoIconButton
00063 {
00064     MA_DECLARE_CLASS;
00065
00066     TPseudoRotateIconButton();
00067     virtual ~TPseudoRotateIconButton();
00068
00069     virtual void ReadFields(CStream_AC* aStream);
00070     virtual void WriteFields(CStream_AC* aStream) const;
00071
00072     void DoRotate(int icon);
00073
00074 protected:
00075     std::vector<short> fIconSuite;
00076     int fCurrentIcon;
00077 };
00078
00079 class TPseudoIconCheckBox : public TIconCheckBox
00080 {
00081     MA_DECLARE_CLASS;
00082
00083     TPseudoIconCheckBox();
00084     virtual ~TPseudoIconCheckBox();
00085
00086     virtual void ReadFields(CStream_AC* aStream);
00087     virtual void WriteFields(CStream_AC* aStream) const;
00088 };
00089
00090 class UMacAppMenu : public UMenu
00091 {
00092     UDECLARE_DYNAMIC(UMacAppMenu)
00093
00094 public:
00095     UMacAppMenu();
00096     virtual ~UMacAppMenu();
00097
00098     static int sMAMenuWidID;
00099
00100     ev_msg void OnUpdateUI(void);
00101
00102     UDECLARE_MESSAGE_MAP()
00103 };
00104
00105 class TPseudoAppBehavior : public TBehavior
00106 {
00107     MA_DECLARE_CLASS;
00108 public:
00109     TPseudoAppBehavior();
00110     virtual ~TPseudoAppBehavior();
00111
00112     virtual bool DoIdle(IdlePhase phase);
00113     virtual void DoMenuCommand(CommandNumber aCommandNumber);
00114     virtual void DoSetupMenus();
00115     virtual bool DoToolboxEvent(TToolboxEvent* event);
00116
00117 protected:
00118 };
00119
00120 class TPseudoWinBehavior : public TBehavior
00121 {
00122     MA_DECLARE_CLASS;
00123 public:
00124
00125     enum
00126     {
00127         kPseudoWinBehavior = 'pswb'
00128     };
00129
00130     TPseudoWinBehavior();
00131     virtual ~TPseudoWinBehavior();
00132
00133     virtual void DoEvent(EventNumber eventNumber, TEventHandler* source, TEvent* event);
00134
00135     inline int GetWidID() const { return fWidID; }
00136 protected:
00137     inline void SetPseudoWidget(int widid) { fWidID = widid; }
00138
00139     int fWidID;
00140
00141     friend class UWidget;
00142 };
00143
00144 class TPseudoWinAdorner : public TAdorner
00145 {
00146     MA_DECLARE_CLASS;
00147 public:
00148
00149     enum
00150     {
00151         kPseudoWinAdorner = 'pswa'
00152     };
00153
00154     TPseudoWinAdorner();
00155     virtual ~TPseudoWinAdorner();
00156
00157     virtual void ViewChangedFrame (TView* itsView,
00158                                             const CViewRect& oldFrame,
00159                                             const CViewRect& newFrame,
00160                                             bool    invalidate);
00161
00162 protected:
00163     inline void SetPseudoWidget(int widid) { fWidID = widid; }
00164
00165     int fWidID;
00166
00167     friend class UWidget;
00168 };
00169
00170 class TPseudoCustomView : public TView
00171 {
00172     MA_DECLARE_CLASS;
00173 public:
00174
00175     TPseudoCustomView();
00176     virtual ~TPseudoCustomView();
00177
00178     virtual void Draw(const CViewRect& area);
00179 };
00180
00181 class TPseudoTextListView : public TTextListView
00182 {
00183     MA_DECLARE_CLASS;
00184
00185 public:
00186     enum
00187     {
00188         kTextStringListViewSignature = 'TxLv',
00189
00190         kSelectionChanged = 'TxSC',
00191         kMultiClickSelection = 'TxMu'
00192     };
00193
00194     TPseudoTextListView();
00195     virtual ~TPseudoTextListView();
00196
00197     virtual IDType GetStandardSignature(void) const;
00198
00199     virtual CStr255_AC GetItemText(GridCoordinate) const;
00200
00201     virtual void InsStringBefore(short anItem, const char * string);
00202     virtual void InsStringFirst(const char * string);
00203     virtual void InsStringLast(const char * string);
00204
00205     virtual void DelItemAt(GridCoordinate anItem, GridCoordinate numOfItems);
00206     virtual void RemoveAll(void);
00207
00208     virtual void DoKeyEvent(TToolboxEvent * event);
00209     virtual void DoMouseCommand(CViewPoint & theMouse, TToolboxEvent * event, CPoint_AC);
00210     virtual void SetSelection(const TGridViewDesignator* cellsToSelect,
00211                         bool extendSelection, bool highlight, bool select);
00212
00213 protected:
00214     virtual bool DoMouseCommand_SelectCells(GridCell whichCell, class TToolboxEvent * event);
00215
00216     std::vector<CStr255_AC> fStringContainer;
00217 };
00218
00219 class TPseudoDoubleNumberText : public TEditText
00220 {
00221     MA_DECLARE_CLASS;
00222
00223 public:
00224     enum
00225     {
00226         kDefaultPrecision = 5,
00227         kStdDoubleNumberText = 'dNum'
00228     };
00229
00230     TPseudoDoubleNumberText();
00231     virtual ~TPseudoDoubleNumberText();
00232
00233     virtual IDType GetStandardSignature() const;
00234     virtual void ReadFields(CStream_AC* aStream);
00235     virtual void WriteFields(CStream_AC* aStream) const;
00236     virtual long GetValidationError();
00237         // Overrides
00238
00239     virtual double GetValue();
00240     virtual void SetValue(double newValue, bool redraw);
00241 protected:
00242     double fMinimum;
00243     double fMaximum;
00244     short fPrecision;
00245 };
00246
00247 void macapp_workaround_adlib_bug(TView *view);
00248
00249 #endif
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/dib.c Source File

rf/support/mfc/dib.c

Go to the documentation of this file.
00001 /*************************************************************************
00002 /* This is a 'best of' choice of DIB functions taken from Microsoft
00003 /* examples files (examples wincap32 : file.c, dibutil.c ...)
00004 /*************************************************************************/
00005
00006 #include <windows.h>
00007 #include <windowsx.h>
00008 #include "dib.h"
00009
00010
00011 /****************************************************************************
00012  *                                                                          *
00013  *  FUNCTION   : DibNumColors(VOID FAR * pv)                                *
00014  *                                                                          *
00015  *  PURPOSE    : Determines the number of colors in the DIB by looking at   *
00016  *               the BitCount filed in the info block.                      *
00017  *                                                                          *
00018  *  RETURNS    : The number of colors in the DIB.                           *
00019  *               if bitmap is in 8 bit mode but use only 4 colors           *
00020  *               function can return 4 (number of color really used)        *
00021  *               Use DibGetPaletteSize instead...                           *
00022  *                                                                          *
00023  ****************************************************************************/
00024 WORD DibNumColors (VOID FAR * pv)
00025 {
00026     INT                 bits;
00027     LPBITMAPINFOHEADER  lpbi;
00028     LPBITMAPCOREHEADER  lpbc;
00029
00030     lpbi = ((LPBITMAPINFOHEADER)pv);
00031     lpbc = ((LPBITMAPCOREHEADER)pv);
00032
00033     /*  With the BITMAPINFO format headers, the size of the palette
00034      *  is in biClrUsed, whereas in the BITMAPCORE - style headers, it
00035      *  is dependent on the bits per pixel ( = 2 raised to the power of
00036      *  bits/pixel).
00037      */
00038     if (lpbi->biSize != sizeof(BITMAPCOREHEADER)){
00039         if (lpbi->biClrUsed != 0)
00040             return (WORD)lpbi->biClrUsed;
00041         bits = lpbi->biBitCount;
00042     }
00043     else
00044         bits = lpbc->bcBitCount;
00045
00046     switch (bits){
00047         case 1:
00048                 return 2;
00049         case 4:
00050                 return 16;
00051         case 8:
00052                 return 256;
00053         default:
00054                 /* A 24 bitcount DIB has no color table */
00055                 return 0;
00056     }
00057 }
00058
00059 /****************************************************************************
00060  *                                                                          *
00061  *  FUNCTION   : DibGetPaletteSize(VOID FAR * pv)                           *
00062  *                                                                          *
00063  *  PURPOSE    : Return the bitmap encoding type (8 bit, 24 bit...          *
00064  *               the BitCount filed in the info block.                      *
00065  *                                                                          *
00066  *  RETURNS    : the encoding type of the bitmap.                           *
00067  *                                                                          *
00068  ****************************************************************************/
00069 WORD DibGetPaletteSize (VOID FAR * pv)
00070 {
00071     INT                 bits;
00072     LPBITMAPINFOHEADER  lpbi;
00073     LPBITMAPCOREHEADER  lpbc;
00074
00075     lpbi = ((LPBITMAPINFOHEADER)pv);
00076     lpbc = ((LPBITMAPCOREHEADER)pv);
00077
00078     /*  With the BITMAPINFO format headers, the size of the palette
00079      *  is in biClrUsed, whereas in the BITMAPCORE - style headers, it
00080      *  is dependent on the bits per pixel ( = 2 raised to the power of
00081      *  bits/pixel).
00082      */
00083     if (lpbi->biSize != sizeof(BITMAPCOREHEADER))
00084         bits = lpbi->biBitCount;
00085     else
00086         bits = lpbc->bcBitCount;
00087
00088     return bits;
00089 }
00090
00091 /****************************************************************************
00092  *                                                                          *
00093  *  FUNCTION   :  DibCopyPalette(HBITMAP src, HBITMAP dst)                  *
00094  *                                                                          *
00095  *  PURPOSE    :  Copy the palette from src to dst if possible              *                                                                          *
00096  *                                                                          *
00097  ****************************************************************************/
00098 VOID
00099 DibCopyPalette(HBITMAP dst, HBITMAP src)
00100 {
00101     LPBITMAPINFO src_header, dst_header;
00102     RGBQUAD *src_rgb, *dst_rgb;
00103     WORD colorMode;
00104
00105     src_header = (LPBITMAPINFO) GlobalLock((HGLOBAL)src);
00106     dst_header = (LPBITMAPINFO) GlobalLock((HGLOBAL)dst);
00107
00108     src_rgb = (RGBQUAD FAR *)((LPSTR)src_header + (WORD)src_header->bmiHeader.biSize);
00109     dst_rgb = (RGBQUAD FAR *)((LPSTR)dst_header + (WORD)dst_header->bmiHeader.biSize);
00110
00111     colorMode = DibGetPaletteSize(src_header);
00112     switch(colorMode)
00113     {
00114         case 4:
00115         case 8:
00116             memcpy(dst_rgb, src_rgb,PaletteSize(&src_header->bmiHeader));
00117             break;
00118     }
00119
00120     GlobalUnlock((HGLOBAL)src);
00121     GlobalUnlock((HGLOBAL)dst);
00122 }
00123
00124 /****************************************************************************
00125  *                                                                          *
00126  *  FUNCTION   :  PaletteSize(VOID FAR * pv)                                *
00127  *                                                                          *
00128  *  PURPOSE    :  Calculates the palette size in bytes. If the info. block  *
00129  *                is of the BITMAPCOREHEADER type, the number of colors is  *
00130  *                multiplied by 3 to give the palette size, otherwise the   *
00131  *                number of colors is multiplied by 4.                                                          *
00132  *                                                                          *
00133  *  RETURNS    :  Palette size in number of bytes.                          *
00134  *                                                                          *
00135  ****************************************************************************/
00136 WORD PaletteSize (VOID FAR * pv)
00137 {
00138     LPBITMAPINFOHEADER lpbi;
00139     WORD               NumColors;
00140
00141     lpbi      = (LPBITMAPINFOHEADER)pv;
00142     NumColors = DibNumColors(lpbi);
00143
00144     if (lpbi->biSize == sizeof(BITMAPCOREHEADER))
00145         return (WORD)(NumColors * sizeof(RGBTRIPLE));
00146     else
00147         return (WORD)(NumColors * sizeof(RGBQUAD));
00148 }
00149
00150 /****************************************************************************
00151  *                                                                          *
00152  *  FUNCTION   : WriteMapFileHeaderandConvertFromDwordAlignToPacked(HFILE fh, LPBITMAPFILEHEADER pbf)
00153  *                                                                          *
00154  *  PURPOSE    : write header structure (which NOT packed) and write it PACKED
00155  *                                                                          *
00156  *  RETURNS    : VOID
00157  *                                                                          *
00158  ****************************************************************************/
00159
00160 VOID WriteMapFileHeaderandConvertFromDwordAlignToPacked(HFILE fh, LPBITMAPFILEHEADER pbf)
00161 {
00162
00163         /* write bfType*/
00164     _lwrite(fh, (LPSTR)&pbf->bfType, (UINT)sizeof (WORD));
00165         /* now pass over extra word, and only write next 3 DWORDS!*/
00166         _lwrite(fh, (LPSTR)&pbf->bfSize, sizeof(DWORD) * 3);
00167 }
00168
00169 /*************************************************************************
00170  *
00171  * CreateDIB()
00172  *
00173  * Parameters:
00174  *
00175  * DWORD dwWidth    - Width for new bitmap, in pixels
00176  * DWORD dwHeight   - Height for new bitmap
00177  * WORD  wBitCount  - Bit Count for new DIB (1, 4, 8, or 24)
00178  *
00179  * Return Value:
00180  *
00181  * HDIB             - Handle to new DIB
00182  *
00183  * Description:
00184  *
00185  * This function allocates memory for and initializes a new DIB by
00186  * filling in the BITMAPINFOHEADER, allocating memory for the color
00187  * table, and allocating memory for the bitmap bits.  As with all
00188  * HDIBs, the header, colortable and bits are all in one contiguous
00189  * memory block.  This function is similar to the CreateBitmap()
00190  * Windows API.
00191  *
00192  * The colortable and bitmap bits are left uninitialized (zeroed) in the
00193  * returned HDIB.
00194  *
00195  *
00196  * History:   Date      Author              Reason
00197  *            3/20/92   Mark Bader          Created
00198  *
00199  ************************************************************************/
00200
00201 HBITMAP CreateDIB(DWORD dwWidth, DWORD dwHeight, WORD wBitCount, HPALETTE hPal)
00202 {
00203     BITMAPINFOHEADER    bi;             /*  bitmap header */
00204     LPBITMAPINFOHEADER  lpbi;           /*  pointer to BITMAPINFOHEADER */
00205     DWORD               dwLen;          /*  size of memory block */
00206     HBITMAP             hDIB;
00207     DWORD               dwBytesPerLine; /*  Number of bytes per scanline */
00208
00209
00210     /*  Make sure bits per pixel is valid */
00211
00212     if (wBitCount <= 1)
00213         wBitCount = 1;
00214     else if (wBitCount <= 4)
00215         wBitCount = 4;
00216     else if (wBitCount <= 8)
00217         wBitCount = 8;
00218     else if (wBitCount <= 24)
00219         wBitCount = 24;
00220     else
00221         wBitCount = 4;  /*  set default value to 4 if parameter is bogus */
00222
00223     /*  initialize BITMAPINFOHEADER */
00224
00225     bi.biSize = sizeof(BITMAPINFOHEADER);
00226     bi.biWidth = dwWidth;         /*  fill in width from parameter */
00227     bi.biHeight = dwHeight;       /*  fill in height from parameter */
00228     bi.biPlanes = 1;              /*  must be 1 */
00229     bi.biBitCount = wBitCount;    /*  from parameter */
00230     bi.biCompression = BI_RGB;
00231     bi.biSizeImage = 0;           /*  0's here mean "default" */
00232     bi.biXPelsPerMeter = 0;
00233     bi.biYPelsPerMeter = 0;
00234     bi.biClrUsed = 0;
00235     bi.biClrImportant = 0;
00236
00237     /*  calculate size of memory block required to store the DIB.  This */
00238     /*  block should be big enough to hold the BITMAPINFOHEADER, the color */
00239     /*  table, and the bits */
00240
00241     dwBytesPerLine = WIDTHBYTES(wBitCount * dwWidth);
00242     dwLen = bi.biSize + PaletteSize((LPSTR)&bi) + (dwBytesPerLine * dwHeight);
00243
00244     /*  alloc memory block to store our bitmap */
00245
00246     hDIB = GlobalAlloc(GHND, dwLen);
00247
00248     /*  major bummer if we couldn't get memory block */
00249
00250     if (!hDIB)
00251         return NULL;
00252
00253     /*  lock memory and get pointer to it */
00254
00255     lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
00256
00257     /*  use our bitmap info structure to fill in first part of */
00258     /*  our DIB with the BITMAPINFOHEADER */
00259
00260     *lpbi = bi;
00261
00262     /*
00263      * Copy the palette in the new created image
00264      */
00265     if (wBitCount == 8)
00266     {
00267         PALETTEENTRY pal[256];
00268         RGBQUAD *pRgb;
00269         int i;
00270
00271         GetPaletteEntries(hPal, 0, 256, pal);
00272
00273         pRgb = (RGBQUAD FAR *)((LPSTR)lpbi + (WORD)lpbi->biSize);
00274
00275         /* Fill in the palette entries from the DIB color table and
00276          * create a logical color palette.
00277          */
00278         for (i = 0; i < 256; i++)
00279         {
00280             pRgb[i].rgbRed = pal[i].peRed;
00281             pRgb[i].rgbGreen = pal[i].peGreen;
00282             pRgb[i].rgbBlue = pal[i].peBlue;
00283         }
00284     }
00285
00286     // Since we don't know what the colortable and bits should contain,
00287     // just leave these blank.  Unlock the DIB and return the HDIB.
00288
00289     GlobalUnlock(hDIB);
00290
00291     //return handle to the DIB
00292
00293     return hDIB;
00294 }
00295
00296 /*************************************************************************
00297  *
00298  * Function:  ReadDIBFile (int)
00299  *
00300  *  Purpose:  Reads in the specified DIB file into a global chunk of
00301  *            memory.
00302  *
00303  *  Returns:  A handle to a dib (hDIB) if successful.
00304  *            NULL if an error occurs.
00305  *
00306  * Comments:  BITMAPFILEHEADER is stripped off of the DIB.  Everything
00307  *            from the end of the BITMAPFILEHEADER structure on is
00308  *            returned in the global memory handle.
00309  *
00310  *
00311  * NOTE: The DIB API were not written to handle OS/2 DIBs, so this
00312  * function will reject any file that is not a Windows DIB.
00313  *
00314  * History:   Date      Author       Reason
00315  *            9/15/91   Mark Bader   Based on DIBVIEW
00316  *            6/25/92   Mark Bader   Added check for OS/2 DIB
00317  *            7/21/92   Mark Bader   Added code to deal with bfOffBits
00318  *                                     field in BITMAPFILEHEADER
00319  *            9/11/92   Mark Bader   Fixed Realloc Code to free original mem
00320  *            1/25/94   Hung Nguyen  Changed file APIs to Win32 APIs
00321  *
00322  *************************************************************************/
00323
00324 HANDLE ReadDIBFile(HANDLE hFile)
00325 {
00326     BITMAPFILEHEADER    bmfHeader;
00327     DWORD               dwBitsSize;
00328     UINT                nNumColors;   /*  Number of colors in table */
00329     HANDLE              hDIB;
00330     HANDLE              hDIBtmp;      /*  Used for GlobalRealloc() //MPB */
00331     LPBITMAPINFOHEADER  lpbi;
00332     DWORD               offBits;
00333     DWORD               dwRead;
00334
00335     /*  get length of DIB in bytes for use when reading */
00336
00337     dwBitsSize = GetFileSize(hFile, NULL);
00338
00339     /*  Allocate memory for header & color table. We'll enlarge this */
00340     /*  memory as needed. */
00341
00342     hDIB = GlobalAlloc(GMEM_MOVEABLE, (DWORD)(sizeof(BITMAPINFOHEADER) +
00343             256 * sizeof(RGBQUAD)));
00344
00345     if (!hDIB)
00346         return NULL;
00347
00348     lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
00349
00350     if (!lpbi)
00351     {
00352         GlobalFree(hDIB);
00353         return NULL;
00354     }
00355
00356     /*  read the BITMAPFILEHEADER from our file */
00357
00358     if (!ReadFile(hFile, (LPSTR)&bmfHeader, sizeof (BITMAPFILEHEADER),
00359             &dwRead, NULL))
00360         goto ErrExit;
00361
00362     if (sizeof (BITMAPFILEHEADER) != dwRead)
00363         goto ErrExit;
00364
00365     if (bmfHeader.bfType != 0x4d42)  /*  'BM' */
00366         goto ErrExit;
00367
00368     /*  read the BITMAPINFOHEADER */
00369
00370     if (!ReadFile(hFile, (LPSTR)lpbi, sizeof(BITMAPINFOHEADER), &dwRead,
00371             NULL))
00372         goto ErrExit;
00373
00374     if (sizeof(BITMAPINFOHEADER) != dwRead)
00375         goto ErrExit;
00376
00377     /*  Check to see that it's a Windows DIB -- an OS/2 DIB would cause */
00378     /*  strange problems with the rest of the DIB API since the fields */
00379     /*  in the header are different and the color table entries are */
00380     /*  smaller. */
00381     /*  */
00382     /*  If it's not a Windows DIB (e.g. if biSize is wrong), return NULL. */
00383
00384     if (lpbi->biSize == sizeof(BITMAPCOREHEADER))
00385         goto ErrExit;
00386
00387     /*  Now determine the size of the color table and read it.  Since the */
00388     /*  bitmap bits are offset in the file by bfOffBits, we need to do some */
00389     /*  special processing here to make sure the bits directly follow */
00390     /*  the color table (because that's the format we are susposed to pass */
00391     /*  back) */
00392
00393     if (!(nNumColors = (UINT)lpbi->biClrUsed))
00394     {
00395         /*  no color table for 24-bit, default size otherwise */
00396
00397         if (lpbi->biBitCount != 24)
00398             nNumColors = 1 << lpbi->biBitCount; /*  standard size table */
00399     }
00400
00401     /*  fill in some default values if they are zero */
00402
00403     if (lpbi->biClrUsed == 0)
00404         lpbi->biClrUsed = nNumColors;
00405
00406     if (lpbi->biSizeImage == 0)
00407     {
00408         lpbi->biSizeImage = ((((lpbi->biWidth * (DWORD)lpbi->biBitCount) +
00409                 31) & ~31) >> 3) * lpbi->biHeight;
00410     }
00411
00412     /*  get a proper-sized buffer for header, color table and bits */
00413
00414     GlobalUnlock(hDIB);
00415     hDIBtmp = GlobalReAlloc(hDIB, lpbi->biSize + nNumColors *
00416             sizeof(RGBQUAD) + lpbi->biSizeImage, 0);
00417
00418     if (!hDIBtmp) /*  can't resize buffer for loading */
00419         goto ErrExitNoUnlock; /* MPB */
00420     else
00421         hDIB = hDIBtmp;
00422
00423     lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
00424
00425     /*  read the color table */
00426
00427     ReadFile (hFile, (LPSTR)(lpbi) + lpbi->biSize,
00428             nNumColors * sizeof(RGBQUAD), &dwRead, NULL);
00429
00430     /*  offset to the bits from start of DIB header */
00431
00432     offBits = lpbi->biSize + nNumColors * sizeof(RGBQUAD);
00433
00434     /*  If the bfOffBits field is non-zero, then the bits might *not* be */
00435     /*  directly following the color table in the file.  Use the value in */
00436     /*  bfOffBits to seek the bits. */
00437
00438     if (bmfHeader.bfOffBits != 0L)
00439         SetFilePointer(hFile, bmfHeader.bfOffBits, NULL, FILE_BEGIN);
00440
00441     if (ReadFile(hFile, (LPSTR)lpbi + offBits, lpbi->biSizeImage, &dwRead,
00442             NULL))
00443         goto OKExit;
00444
00445
00446 ErrExit:
00447     GlobalUnlock(hDIB);
00448
00449 ErrExitNoUnlock:
00450     GlobalFree(hDIB);
00451     return NULL;
00452
00453 OKExit:
00454     GlobalUnlock(hDIB);
00455     return hDIB;
00456 }
00457
00458 /*************************************************************************
00459  *
00460  * LoadDIB()
00461  *
00462  * Loads the specified DIB from a file, allocates memory for it,
00463  * and reads the disk file into the memory.
00464  *
00465  *
00466  * Parameters:
00467  *
00468  * LPSTR lpFileName - specifies the file to load a DIB from
00469  *
00470  * Returns: A handle to a DIB, or NULL if unsuccessful.
00471  *
00472  * NOTE: The DIB API were not written to handle OS/2 DIBs; This
00473  * function will reject any file that is not a Windows DIB.
00474  *
00475  * History:   Date      Author       Reason
00476  *            9/15/91   Mark Bader   Based on DIBVIEW
00477  *
00478  *************************************************************************/
00479
00480 HBITMAP LoadDIB(LPSTR lpFileName)
00481 {
00482     HBITMAP     hDIB;
00483     HANDLE      hFile;
00484
00485     if ((hFile = CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
00486             OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
00487             NULL)) != INVALID_HANDLE_VALUE)
00488     {
00489         hDIB = ReadDIBFile(hFile);
00490         CloseHandle(hFile);
00491         return hDIB;
00492     }
00493     else
00494         return NULL;
00495 }
00496
00497 /*************************************************************************
00498  *
00499  * SaveBmpFromDDB()
00500  *
00501  * Saves the specified DDB into the specified file name on disk.
00502  *
00503  *************************************************************************/
00504
00505 BOOL
00506 SaveBmpFromDDB(HDC hDC, HBITMAP hBmp, PSTR pszFileName)
00507 {
00508     int         hFile;
00509     OFSTRUCT    ofReOpenBuff;
00510     HBITMAP     hTmpBmp, hBmpOld;
00511     BOOL        bSuccess;
00512     BITMAPFILEHEADER    bfh;
00513     PBITMAPINFO pbmi;
00514     PBYTE       pBits;
00515     BITMAPINFO  bmi;
00516     PBYTE pjTmp, pjTmpBmi;
00517     ULONG sizBMI;
00518
00519
00520     bSuccess = TRUE;
00521 #if 0
00522     if (ghPal) {
00523         SelectPalette(hDC, ghPal, FALSE);
00524         RealizePalette(hDC);
00525     }
00526 #endif
00527     if (!hBmp) {
00528         return FALSE;
00529     }
00530
00531     //
00532     // Let the graphics engine to retrieve the dimension of the bitmap for us
00533     // GetDIBits uses the size to determine if it's BITMAPCOREINFO or BITMAPINFO
00534     // if BitCount != 0, color table will be retrieved
00535     //
00536     bmi.bmiHeader.biSize = 0x28;              // GDI need this to work
00537     bmi.bmiHeader.biBitCount = 0;             // don't get the color table
00538     if ((GetDIBits(hDC, hBmp, 0, 0, (LPSTR)NULL, &bmi, DIB_RGB_COLORS)) == 0) {
00539         return FALSE;
00540     }
00541
00542     //
00543     // Now that we know the size of the image, alloc enough memory to retrieve
00544     // the actual bits
00545     //
00546     if ((pBits = (PBYTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
00547                 bmi.bmiHeader.biSizeImage)) == NULL) {
00548         return FALSE;
00549     }
00550
00551     //
00552     // Note: 24 bits per pixel has no color table.  So, we don't have to
00553     // allocate memory for retrieving that.  Otherwise, we do.
00554     //
00555     pbmi = &bmi;                                      // assume no color table
00556
00557     switch (bmi.bmiHeader.biBitCount) {
00558         case 24:                                      // has color table
00559             sizBMI = sizeof(BITMAPINFOHEADER);
00560             break;
00561         case 16:
00562         case 32:
00563             sizBMI = sizeof(BITMAPINFOHEADER)+sizeof(DWORD)*3;
00564             break;
00565         default:
00566             sizBMI = sizeof(BITMAPINFOHEADER)+sizeof(RGBQUAD)*(1<<bmi.bmiHeader.biBitCount);
00567             break;
00568
00569     }
00570
00571     //
00572     // Allocate memory for color table if it is not 24bpp...
00573     //
00574     if (sizBMI != sizeof(BITMAPINFOHEADER)) {
00575         ULONG       sizTmp;
00576         //
00577         // I need more memory for the color table
00578         //
00579         if ((pbmi = (PBITMAPINFO)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizBMI )) == NULL) {
00580             bSuccess = FALSE;
00581             goto ErrExit1;
00582         }
00583         //
00584         // Now that we've a bigger chunk of memory, let's copy the Bitmap
00585         // info header data over
00586         //
00587         pjTmp = (PBYTE)pbmi;
00588         pjTmpBmi = (PBYTE)&bmi;
00589         sizTmp = sizeof(BITMAPINFOHEADER);
00590
00591         while(sizTmp--)
00592         {
00593             *(((PBYTE)pjTmp)++) = *((pjTmpBmi)++);
00594         }
00595     }
00596
00597     //
00598     // Let's open the file and get ready for writing
00599     //
00600     if ((hFile = OpenFile(pszFileName, (LPOFSTRUCT)&ofReOpenBuff,
00601                  OF_CREATE | OF_WRITE)) == -1) {
00602         goto ErrExit2;
00603     }
00604
00605     //
00606     // But first, fill in the info for the BitmapFileHeader
00607     //
00608     bfh.bfType = 0x4D42;                            // 'BM'
00609     bfh.bfSize = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+sizBMI+
00610         pbmi->bmiHeader.biSizeImage;
00611     bfh.bfReserved1 =
00612     bfh.bfReserved2 = 0;
00613     bfh.bfOffBits = sizeof(BITMAPFILEHEADER)+sizBMI;
00614
00615     //
00616     // Write out the file header now
00617     //
00618     if (_lwrite(hFile, (LPSTR)&bfh, sizeof(BITMAPFILEHEADER)) == -1) {
00619         bSuccess = FALSE;
00620         goto ErrExit3;
00621     }
00622
00623     //
00624     // Bitmap can't be selected into a DC when calling GetDIBits
00625     // Assume that the hDC is the DC where the bitmap would have been selected
00626     // if indeed it has been selected
00627     //
00628     if (hTmpBmp = CreateCompatibleBitmap(hDC, pbmi->bmiHeader.biWidth, pbmi->bmiHeader.biHeight)) {
00629         hBmpOld = SelectObject(hDC, hTmpBmp);
00630         if ((GetDIBits(hDC, hBmp, 0, pbmi->bmiHeader.biHeight, (LPSTR)pBits, pbmi, DIB_RGB_COLORS))==0){
00631             bSuccess = FALSE;
00632             goto ErrExit4;
00633         }
00634     } else {
00635         bSuccess = FALSE;
00636         goto ErrExit3;
00637     }
00638
00639     //
00640     // Now write out the BitmapInfoHeader and color table, if any
00641     //
00642     if (_lwrite(hFile, (LPSTR)pbmi, sizBMI) == -1) {
00643         bSuccess = FALSE;
00644         goto ErrExit4;
00645     }
00646
00647     //
00648     // write the bits also
00649     //
00650     if (_lwrite(hFile, (LPSTR)pBits, pbmi->bmiHeader.biSizeImage) == -1) {
00651         bSuccess = FALSE;
00652         goto ErrExit4;
00653     }
00654
00655
00656 ErrExit4:
00657     SelectObject(hDC, hBmpOld);
00658     DeleteObject(hTmpBmp);
00659 ErrExit3:
00660     _lclose(hFile);
00661 ErrExit2:
00662     GlobalFree(pbmi);
00663 ErrExit1:
00664     GlobalFree(pBits);
00665     return bSuccess;
00666 }
00667
00668 /*************************************************************************
00669  *
00670  * SaveDIB()
00671  *
00672  * Saves the specified DIB into the specified file name on disk.  No
00673  * error checking is done, so if the file already exists, it will be
00674  * written over.
00675  *
00676  * Parameters:
00677  *
00678  * HDIB hDib - Handle to the dib to save
00679  *
00680  * LPSTR lpFileName - pointer to full pathname to save DIB under
00681  *
00682  * Return value: 0 if successful, or one of:
00683  *        ERR_INVALIDHANDLE
00684  *        ERR_OPEN
00685  *        ERR_LOCK
00686  *
00687  * History:
00688  *
00689  * NOTE: The DIB API were not written to handle OS/2 DIBs, so this
00690  * function will not save a file if it is not a Windows DIB.
00691  *
00692  * History:   Date      Author       Reason
00693  *            9/15/91   Mark Bader   Taken from DIBVIEW (which was taken
00694  *                                      from SHOWDIB)
00695  *            1/30/92   Mark Bader   Fixed problem of writing too many
00696  *                                      bytes to the file
00697  *            6/24/92   Mark Bader   Added check for OS/2 DIB
00698  *            2/1/94    Hung Nguyen  Changed file APIs to Win32 APIs
00699  *
00700  *************************************************************************/
00701
00702 BOOL SaveDIB(HBITMAP hDib, LPSTR lpFileName)
00703 {
00704     BITMAPFILEHEADER    bmfHdr;     /*  Header for Bitmap file */
00705     LPBITMAPINFOHEADER  lpBI;       /*  Pointer to DIB info structure */
00706     HANDLE              fh;         /*  file handle for opened file */
00707     DWORD               dwDIBSize;
00708     DWORD               dwWritten;
00709
00710     if (!hDib)
00711         return FALSE;
00712
00713     fh = CreateFile(lpFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
00714             FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
00715
00716     if (fh == INVALID_HANDLE_VALUE)
00717         return FALSE;
00718
00719     /*  Get a pointer to the DIB memory, the first of which contains */
00720     /*  a BITMAPINFO structure */
00721
00722     lpBI = (LPBITMAPINFOHEADER)GlobalLock(hDib);
00723     if (!lpBI)
00724     {
00725         CloseHandle(fh);
00726         return FALSE;
00727     }
00728
00729     /*  Check to see if we're dealing with an OS/2 DIB.  If so, don't */
00730     /*  save it because our functions aren't written to deal with these */
00731     /*  DIBs. */
00732
00733     if (lpBI->biSize != sizeof(BITMAPINFOHEADER))
00734     {
00735         GlobalUnlock(hDib);
00736         CloseHandle(fh);
00737         return FALSE;
00738     }
00739
00740     /*  Fill in the fields of the file header */
00741
00742     /*  Fill in file type (first 2 bytes must be "BM" for a bitmap) */
00743
00744     bmfHdr.bfType = DIB_HEADER_MARKER;  /*  "BM" */
00745
00746     /*  Calculating the size of the DIB is a bit tricky (if we want to */
00747     /*  do it right).  The easiest way to do this is to call GlobalSize() */
00748     /*  on our global handle, but since the size of our global memory may have */
00749     /*  been padded a few bytes, we may end up writing out a few too */
00750     /*  many bytes to the file (which may cause problems with some apps, */
00751     /*  like HC 3.0). */
00752     /*  */
00753     /*  So, instead let's calculate the size manually. */
00754     /*  */
00755     /*  To do this, find size of header plus size of color table.  Since the */
00756     /*  first DWORD in both BITMAPINFOHEADER and BITMAPCOREHEADER conains */
00757     /*  the size of the structure, let's use this. */
00758
00759     /*  Partial Calculation */
00760
00761     dwDIBSize = *(LPDWORD)lpBI + PaletteSize((LPSTR)lpBI);
00762
00763     /*  Now calculate the size of the image */
00764
00765     /*  It's an RLE bitmap, we can't calculate size, so trust the biSizeImage */
00766     /*  field */
00767
00768     if ((lpBI->biCompression == BI_RLE8) || (lpBI->biCompression == BI_RLE4))
00769         dwDIBSize += lpBI->biSizeImage;
00770     else
00771     {
00772         DWORD dwBmBitsSize;  /*  Size of Bitmap Bits only */
00773
00774         /*  It's not RLE, so size is Width (DWORD aligned) * Height */
00775
00776         dwBmBitsSize = WIDTHBYTES((lpBI->biWidth)*((DWORD)lpBI->biBitCount)) *
00777                 lpBI->biHeight;
00778
00779         dwDIBSize += dwBmBitsSize;
00780
00781         /*  Now, since we have calculated the correct size, why don't we */
00782         /*  fill in the biSizeImage field (this will fix any .BMP files which  */
00783         /*  have this field incorrect). */
00784
00785         lpBI->biSizeImage = dwBmBitsSize;
00786     }
00787
00788
00789     /*  Calculate the file size by adding the DIB size to sizeof(BITMAPFILEHEADER) */
00790
00791     bmfHdr.bfSize = dwDIBSize + sizeof(BITMAPFILEHEADER);
00792     bmfHdr.bfReserved1 = 0;
00793     bmfHdr.bfReserved2 = 0;
00794
00795     /*  Now, calculate the offset the actual bitmap bits will be in */
00796     /*  the file -- It's the Bitmap file header plus the DIB header, */
00797     /*  plus the size of the color table. */
00798
00799     bmfHdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + lpBI->biSize +
00800             PaletteSize((LPSTR)lpBI);
00801
00802     /*  Write the file header */
00803
00804     WriteFile(fh, (LPSTR)&bmfHdr, sizeof(BITMAPFILEHEADER), &dwWritten, NULL);
00805
00806     /*  Write the DIB header and the bits -- use local version of */
00807     /*  MyWrite, so we can write more than 32767 bytes of data */
00808
00809     WriteFile(fh, (LPSTR)lpBI, dwDIBSize, &dwWritten, NULL);
00810
00811     GlobalUnlock(hDib);
00812     CloseHandle(fh);
00813
00814     if (dwWritten == 0)
00815         return FALSE; /*  oops, something happened in the write */
00816     else
00817         return TRUE; /*  Success code */
00818 }
00819
00820
00821 /*************************************************************************
00822 /* The following functions were adapted from Microsoft examples sources
00823 /*************************************************************************/
00824
00825 /*************************************************************************
00826  *
00827  * CopyScreenToBitmap()
00828  *
00829  * Parameter:
00830  *
00831  * LPRECT lpRect    - specifies the window
00832  *
00833  * Return Value:
00834  *
00835  * HDIB             - identifies the device-dependent bitmap
00836  *
00837  * Description:
00838  *
00839  * This function copies the specified part of the screen to a device-
00840  * dependent bitmap.
00841  *
00842  * History:   Date      Author             Reason
00843  *            9/15/91   Patrick Schreiber  Created
00844  *            9/25/91   Patrick Schreiber  Added header and comments
00845  *
00846  ************************************************************************/
00847
00848 HBITMAP CopyScreenToBitmap(HWND win, LPRECT lpRect)
00849 {
00850     HDC         hScrDC, hMemDC;         /*  screen DC and memory DC */
00851     HBITMAP     hBitmap, hOldBitmap;    /*  handles to deice-dependent bitmaps */
00852     int         nX, nY, nX2, nY2;       /*  coordinates of rectangle to grab */
00853     int         nWidth, nHeight;        /*  DIB width and height */
00854     int         xScrn, yScrn;           /*  screen resolution */
00855     /*  check for an empty rectangle */
00856
00857     if (IsRectEmpty(lpRect))
00858       return NULL;
00859
00860     /*  create a DC for the screen and create */
00861     /*  a memory DC compatible to screen DC */
00862
00863     /* hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL); */
00864     /* hMemDC = CreateCompatibleDC(hScrDC); */
00865     hScrDC = GetDC(win);
00866     hMemDC = CreateCompatibleDC (hScrDC);
00867     /*  get points of rectangle to grab */
00868
00869     nX = lpRect->left;
00870     nY = lpRect->top;
00871     nX2 = lpRect->right;
00872     nY2 = lpRect->bottom;
00873
00874     /*  get screen resolution */
00875
00876     xScrn = GetDeviceCaps(hScrDC, HORZRES);
00877     yScrn = GetDeviceCaps(hScrDC, VERTRES);
00878
00879     /* make sure bitmap rectangle is visible */
00880
00881     if (nX < 0)
00882         nX = 0;
00883     if (nY < 0)
00884         nY = 0;
00885     if (nX2 > xScrn)
00886         nX2 = xScrn;
00887     if (nY2 > yScrn)
00888         nY2 = yScrn;
00889
00890     nWidth = nX2 - nX;
00891     nHeight = nY2 - nY;
00892
00893     // create a bitmap compatible with the screen DC
00894     hBitmap = CreateCompatibleBitmap(hScrDC, nWidth, nHeight);
00895
00896     // select new bitmap into memory DC
00897     hOldBitmap = SelectObject(hMemDC, hBitmap);
00898
00899     // bitblt screen DC to memory DC
00900     BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY);
00901
00902     // select old bitmap back into memory DC and get handle to
00903     // bitmap of the screen
00904
00905     hBitmap = SelectObject(hMemDC, hOldBitmap);
00906
00907     // clean up
00908
00909     ReleaseDC(win, hScrDC);
00910     DeleteDC(hMemDC);
00911
00912     // return handle to the bitmap
00913
00914     return hBitmap;
00915 }
00916
00917
00918 HBITMAP
00919 DIBToBitmap(hDIB)
00920     HBITMAP hDIB;
00921 {
00922     LPSTR       lpDIBHdr, lpDIBBits;  // pointer to DIB header, pointer to DIB bits
00923     HBITMAP     hBitmap;            // handle to device-dependent bitmap
00924     HDC         hDC;                    // handle to DC
00925
00926     if (!hDIB)
00927         return NULL;
00928
00929     /* lock memory block and get a pointer to it */
00930     lpDIBHdr = GlobalLock(hDIB);
00931     lpDIBBits = lpDIBHdr + *(LPDWORD)lpDIBHdr + PaletteSize(lpDIBHdr);
00932
00933     /* get a DC */
00934     hDC = GetDC(NULL);
00935     if (!hDC)
00936     {
00937         GlobalUnlock(hDIB);
00938         return NULL;
00939     }
00940
00941     /* create bitmap from DIB info. and bits */
00942     hBitmap = CreateDIBitmap(hDC, (LPBITMAPINFOHEADER)lpDIBHdr, CBM_INIT,
00943             lpDIBBits, (LPBITMAPINFO)lpDIBHdr, DIB_RGB_COLORS);
00944
00945
00946     ReleaseDC(NULL, hDC);
00947     GlobalUnlock(hDIB);
00948     return hBitmap;
00949 }
00950
00951 /****************************************************************************
00952  *                                                                          *
00953  *  FUNCTION   : DibFromBitmap()                                            *
00954  *                                                                          *
00955  *  PURPOSE    : Will create a global memory block in DIB format that       *
00956  *               represents the Device-dependent bitmap (DDB) passed in.    *
00957  *                                                                          *
00958  *  RETURNS    : A handle to the DIB                                        *
00959  *                                                                          *
00960  ****************************************************************************/
00961 HANDLE
00962 DDBtoDIB(hbm, biBits, hPal)
00963     HBITMAP hbm;
00964     WORD biBits;
00965     HPALETTE hPal;
00966 {
00967     BITMAP               bm;
00968     BITMAPINFOHEADER     bi;
00969     BITMAPINFOHEADER FAR *lpbi;
00970     DWORD                dwLen;
00971     HANDLE               hdib;
00972     HANDLE               h;
00973     HDC                  hdc;
00974     HPALETTE oldPal;
00975
00976     if (!hbm)
00977         return NULL;
00978
00979     GetObject(hbm,sizeof(bm),(LPSTR)&bm);
00980
00981     if (biBits == 0)
00982         biBits =  bm.bmPlanes * bm.bmBitsPixel;
00983
00984     bi.biSize               = sizeof(BITMAPINFOHEADER);
00985     bi.biWidth              = bm.bmWidth;
00986     bi.biHeight             = bm.bmHeight;
00987     bi.biPlanes             = 1;
00988     bi.biBitCount           = biBits;
00989     bi.biCompression        = BI_RGB;
00990     bi.biSizeImage          = 0;
00991     bi.biXPelsPerMeter      = 0;
00992     bi.biYPelsPerMeter      = 0;
00993     bi.biClrUsed            = 0;
00994     bi.biClrImportant       = 0;
00995
00996     dwLen  = bi.biSize + PaletteSize(&bi);
00997
00998     hdc = GetDC(NULL);
00999     oldPal = SelectPalette(hdc, hPal, FALSE);
01000     RealizePalette(hdc);
01001
01002     hdib = GlobalAlloc(GHND,dwLen);
01003
01004     if (!hdib)
01005     {
01006         SelectPalette(hdc, oldPal, FALSE);
01007         ReleaseDC(NULL, hdc);
01008         return NULL;
01009     }
01010
01011     lpbi = (VOID FAR *)GlobalLock(hdib);
01012
01013     *lpbi = bi;
01014
01015     /*  call GetDIBits with a NULL lpBits param, so it will calculate the
01016      *  biSizeImage field for us
01017      */
01018     GetDIBits(hdc, hbm, 0L, (DWORD)bi.biHeight,
01019         (LPBYTE)NULL, (LPBITMAPINFO)lpbi, (DWORD)DIB_RGB_COLORS);
01020
01021     bi = *lpbi;
01022     GlobalUnlock(hdib);
01023
01024     /* If the driver did not fill in the biSizeImage field, make one up */
01025     if (bi.biSizeImage == 0)
01026         bi.biSizeImage = WIDTHBYTES((DWORD)bm.bmWidth * biBits) * bm.bmHeight;
01027
01028     /*  realloc the buffer big enough to hold all the bits */
01029     dwLen = bi.biSize + PaletteSize(&bi) + bi.biSizeImage;
01030
01031     if (h = GlobalReAlloc(hdib,dwLen,0))
01032         hdib = h;
01033     else
01034     {
01035         GlobalFree(hdib);
01036         hdib = NULL;
01037
01038         SelectPalette(hdc, oldPal, FALSE);
01039         ReleaseDC(NULL,hdc);
01040         return hdib;
01041     }
01042
01043     /*  call GetDIBits with a NON-NULL lpBits param, and actualy get the
01044      *  bits this time
01045      */
01046     lpbi = (VOID FAR *)GlobalLock(hdib);
01047
01048     if (GetDIBits( hdc,
01049                    hbm,
01050                    0L,
01051                    (DWORD)bi.biHeight,
01052                    (LPBYTE)lpbi + (WORD)lpbi->biSize + PaletteSize(lpbi),
01053                    (LPBITMAPINFO)lpbi, (DWORD)DIB_RGB_COLORS) == 0)
01054     {
01055          GlobalUnlock(hdib);
01056          hdib = NULL;
01057          SelectPalette(hdc, oldPal, FALSE);
01058          ReleaseDC(NULL,hdc);
01059          return NULL;
01060     }
01061
01062     bi = *lpbi;
01063     GlobalUnlock(hdib);
01064
01065     SelectPalette(hdc, oldPal, FALSE);
01066     ReleaseDC(NULL,hdc);
01067     return hdib;
01068 }
01069
01070 /*************************************************************************
01071  *
01072  * Function:  ReadDIBRsrc (int)
01073  *
01074  *  Purpose:  Reads in the specified DIB file into a global chunk of
01075  *            memory.
01076  *
01077  *  Returns:  A handle to a dib (hDIB) if successful.
01078  *            NULL if an error occurs.
01079  *
01080  * Comments:  BITMAPFILEHEADER is stripped off of the DIB.  Everything
01081  *            from the end of the BITMAPFILEHEADER structure on is
01082  *            returned in the global memory handle.
01083  *
01084  *
01085  * NOTE: The DIB API were not written to handle OS/2 DIBs, so this
01086  * function will reject any file that is not a Windows DIB.
01087  *
01088  * History:   Date      Author       Reason
01089  *            9/15/91   Mark Bader   Based on DIBVIEW
01090  *            6/25/92   Mark Bader   Added check for OS/2 DIB
01091  *            7/21/92   Mark Bader   Added code to deal with bfOffBits
01092  *                                     field in BITMAPFILEHEADER
01093  *            9/11/92   Mark Bader   Fixed Realloc Code to free original mem
01094  *            1/25/94   Hung Nguyen  Changed file APIs to Win32 APIs
01095  *
01096  *************************************************************************/
01097
01098 HANDLE ReadDIBRsrc(HINSTANCE hInst, HRSRC hRsrc )
01099 {
01100     BITMAPFILEHEADER    bmfHeader;
01101     DWORD               dwBitsSize;
01102     UINT                nNumColors;   /*  Number of colors in table */
01103     HANDLE              hDIB;
01104     HANDLE              hDIBtmp;      /*  Used for GlobalRealloc() //MPB */
01105     LPBITMAPINFOHEADER  lpbi;
01106     DWORD               offBits;
01107     LPSTR               rsrcptr, beginrsrc;
01108     HGLOBAL             hg;
01109
01110     /*  get length of DIB in bytes for use when reading */
01111
01112     hg = LoadResource(hInst, hRsrc);
01113     if(hg == NULL)
01114         return NULL;
01115
01116     beginrsrc = rsrcptr = LockResource(hg);
01117     dwBitsSize = SizeofResource(hInst, hRsrc);
01118
01119     /*  Allocate memory for header & color table. We'll enlarge this */
01120     /*  memory as needed. */
01121
01122     hDIB = GlobalAlloc(GMEM_MOVEABLE, (DWORD)(sizeof(BITMAPINFOHEADER) +
01123             256 * sizeof(RGBQUAD)));
01124
01125     if (!hDIB)
01126         goto ErrExitRsrc;
01127
01128     lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
01129
01130     if (!lpbi)
01131     {
01132         GlobalFree(hDIB);
01133         goto ErrExitRsrc;
01134     }
01135
01136     /*  read the BITMAPFILEHEADER from our file */
01137
01138     memcpy(&bmfHeader, rsrcptr, sizeof (BITMAPFILEHEADER));
01139     rsrcptr += sizeof (BITMAPFILEHEADER);
01140
01141     if (bmfHeader.bfType != 0x4d42)  /*  'BM' */
01142         goto ErrExit;
01143
01144     /*  read the BITMAPINFOHEADER */
01145
01146     memcpy(lpbi, rsrcptr, sizeof(BITMAPINFOHEADER));
01147     rsrcptr += sizeof (BITMAPINFOHEADER);
01148
01149     /*  Check to see that it's a Windows DIB -- an OS/2 DIB would cause */
01150     /*  strange problems with the rest of the DIB API since the fields */
01151     /*  in the header are different and the color table entries are */
01152     /*  smaller. */
01153     /*  */
01154     /*  If it's not a Windows DIB (e.g. if biSize is wrong), return NULL. */
01155
01156     if (lpbi->biSize == sizeof(BITMAPCOREHEADER))
01157         goto ErrExit;
01158
01159     /*  Now determine the size of the color table and read it.  Since the */
01160     /*  bitmap bits are offset in the file by bfOffBits, we need to do some */
01161     /*  special processing here to make sure the bits directly follow */
01162     /*  the color table (because that's the format we are susposed to pass */
01163     /*  back) */
01164
01165     if (!(nNumColors = (UINT)lpbi->biClrUsed))
01166     {
01167         /*  no color table for 24-bit, default size otherwise */
01168
01169         if (lpbi->biBitCount != 24)
01170             nNumColors = 1 << lpbi->biBitCount; /*  standard size table */
01171     }
01172
01173     /*  fill in some default values if they are zero */
01174
01175     if (lpbi->biClrUsed == 0)
01176         lpbi->biClrUsed = nNumColors;
01177
01178     if (lpbi->biSizeImage == 0)
01179     {
01180         lpbi->biSizeImage = ((((lpbi->biWidth * (DWORD)lpbi->biBitCount) +
01181                 31) & ~31) >> 3) * lpbi->biHeight;
01182     }
01183
01184     /*  get a proper-sized buffer for header, color table and bits */
01185
01186     GlobalUnlock(hDIB);
01187     hDIBtmp = GlobalReAlloc(hDIB, lpbi->biSize + nNumColors *
01188             sizeof(RGBQUAD) + lpbi->biSizeImage, 0);
01189
01190     if (!hDIBtmp) /*  can't resize buffer for loading */
01191         goto ErrExitNoUnlock; /* MPB */
01192     else
01193         hDIB = hDIBtmp;
01194
01195     lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
01196
01197     /*  read the color table */
01198
01199     memcpy((LPSTR)(lpbi) + lpbi->biSize, rsrcptr, nNumColors * sizeof(RGBQUAD));
01200     rsrcptr += nNumColors * sizeof(RGBQUAD);
01201
01202     /*  offset to the bits from start of DIB header */
01203     offBits = lpbi->biSize + nNumColors * sizeof(RGBQUAD);
01204
01205     /*  If the bfOffBits field is non-zero, then the bits might *not* be */
01206     /*  directly following the color table in the file.  Use the value in */
01207     /*  bfOffBits to seek the bits. */
01208
01209     if (bmfHeader.bfOffBits != 0L)
01210         rsrcptr = beginrsrc + bmfHeader.bfOffBits;
01211
01212     memcpy((LPSTR)lpbi + offBits, rsrcptr, lpbi->biSizeImage);
01213     goto OKExit;
01214
01215 ErrExit:
01216     GlobalUnlock(hDIB);
01217
01218 ErrExitNoUnlock:
01219     GlobalFree(hDIB);
01220 ErrExitRsrc:
01221     FreeResource(hg);
01222     return NULL;
01223
01224 OKExit:
01225     FreeResource(hg);
01226     GlobalUnlock(hDIB);
01227     return hDIB;
01228 }
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/dib.h Source File

rf/support/mfc/dib.h

Go to the documentation of this file.
00001 #ifndef DIB_H
00002 #define DIB_H
00003
00004 #define DIB_HEADER_MARKER   ((WORD) ('M' << 8) | 'B')
00005 /* Macro to determine to round off the given value to the closest byte */
00006 #define WIDTHBYTES(i)   ((i+31)/32*4)
00007 #define WIDTHBYTES16(i)   ((i+15)/16*2)
00008 #define WIDTHBYTES8(i)   ((i+7)/8)
00009
00010 /* Pour les Bitmaps, surchage de Alloc() et utilisation
00011  * de l'allocateur Windows GlobalAlloc() pour afficher des
00012  * bitmaps > 64 Ko sous Windows 3.1.
00013  */
00014
00015 #define BM_ALLOC(nb, size) GlobalAllocPtr( GHND, (nb)*(size) )
00016 #define BM_FREE(ptr) GlobalFreePtr(ptr)
00017
00018 #define BFT_BITMAP 0x4d42   /* 'BM' */
00019
00020 /*****************************************************/
00021 /* make new sizeof structs to cover dword alignment  */
00022 /*****************************************************/
00023
00024 #define SIZEOF_BITMAPFILEHEADER_PACKED  (   \
00025     sizeof(WORD) +      /* bfType      */   \
00026     sizeof(DWORD) +     /* bfSize      */   \
00027     sizeof(WORD) +      /* bfReserved1 */   \
00028     sizeof(WORD) +      /* bfReserved2 */   \
00029     sizeof(DWORD))      /* bfOffBits   */
00030
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034
00035 /* Prototypes */
00036 VOID DibCopyPalette(HBITMAP , HBITMAP );
00037 WORD PaletteSize (VOID FAR *);
00038 WORD DibNumColors (VOID FAR *);
00039 WORD DibGetPaletteSize (VOID FAR *);
00040 VOID WriteMapFileHeaderandConvertFromDwordAlignToPacked(HFILE, LPBITMAPFILEHEADER);
00041 HANDLE ReadDIBFile(HANDLE);
00042 HANDLE ReadDIBRsrc(HINSTANCE, HRSRC);
00043 HBITMAP LoadDIB(LPSTR);
00044 BOOL SaveDIB(HBITMAP, LPSTR);
00045 HBITMAP CreateDIB(DWORD, DWORD, WORD, HPALETTE);
00046 HBITMAP CopyScreenToBitmap(HWND, LPRECT);
00047 HBITMAP DIBToBitmap(HBITMAP);
00048 HANDLE DDBtoDIB(HBITMAP, WORD, HPALETTE);
00049 BOOL SaveBmpFromDDB(HDC, HBITMAP, PSTR);
00050
00051 #ifdef __cplusplus
00052 }
00053 #endif
00054
00055 #endif /* DIB_H */
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/PseudoButton.cpp Source File

rf/support/mfc/PseudoButton.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00018
00019 /*
00020  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00021  */
00022
00023 #include "stdafx.h"
00024 #include "umain.h"
00025 #include "PseudoButton.h"
00026 #include "dib.h"
00027 #include <map>
00028 #include <string.h>
00029
00030 #ifdef _DEBUG
00031 #define new DEBUG_NEW
00032 #undef THIS_FILE
00033 static char THIS_FILE[] = __FILE__;
00034 #endif
00035
00037 // CPseudoButton
00038
00039 IMPLEMENT_DYNAMIC(CPseudoButton, CCJFlatButton)
00040
00041 CPseudoButton::CPseudoButton() : m_bitmap(0L), m_disbitmap(0L)
00042 {
00043 }
00044
00045 CPseudoButton::~CPseudoButton()
00046 {
00047     if(m_bitmap != 0L)
00048         AfxDeleteObject((HGDIOBJ*)&m_bitmap);
00049     if(m_disbitmap != 0L)
00050         AfxDeleteObject((HGDIOBJ*)&m_disbitmap);
00051 }
00052
00053 void CPseudoButton::DrawItem(LPDRAWITEMSTRUCT lpDIS)
00054 {
00055     BOOL oldFlag = m_bFlatLook;
00056     if(lpDIS->itemState & ODS_DISABLED)
00057         m_bFlatLook = true;
00058     CCJFlatButton::DrawItem(lpDIS);
00059     m_bFlatLook = oldFlag;
00060 }
00061
00062 bool CPseudoButton::loadIcon(CString & icon, int rsrcid)
00063 {
00064     icon = "";
00065     bool res = false;
00066
00067     HINSTANCE inst = ::AfxGetResourceHandle();
00068     HRSRC hRsrc = FindResource(inst, MAKEINTRESOURCE(rsrcid), "CICN");
00069     if (hRsrc != 0L)
00070     {
00071         HGLOBAL hg = LoadResource(inst, hRsrc);
00072         if (hg != 0L)
00073         {
00074             DWORD size = SizeofResource(inst, hRsrc);
00075             char *rsrcptr = (char *)LockResource(hg);
00076             icon = CString(rsrcptr, size);
00077             FreeResource(hg);
00078             res = true;
00079         }
00080     }
00081
00082     return res;
00083 }
00084
00085 bool CPseudoButton::LoadXPM(int rsrcid)
00086 {
00087     CString sicon;
00088
00089     if(!CPseudoButton::loadIcon(sicon, rsrcid))
00090         return false;
00091
00092     COLORREF back = ::GetSysColor(COLOR_BTNFACE);
00093     COLORREF fore = ::GetSysColor(COLOR_GRAYTEXT);
00094
00095     int w, h;
00096     HBITMAP bmap = UMakeBitmap((const char *)sicon, w, h, DD_PIXMAP, back, fore);
00097     if(bmap == 0L)
00098         return false;
00099
00100     SetBitmap(bmap);
00101     if(m_bitmap != 0L)
00102         AfxDeleteObject((HGDIOBJ*)&m_bitmap);
00103     m_bitmap = bmap;
00104
00105     bmap = UMakeBitmap((const char *)sicon, w, h, DD_PIXMAP, back, fore, false);
00106     if(bmap == 0L)
00107         return false;
00108     if(m_disbitmap != 0L)
00109         AfxDeleteObject((HGDIOBJ*)&m_disbitmap);
00110     m_disbitmap = bmap;
00111     return true;
00112 }
00113
00114 void CPseudoButton::DrawButtonBitmap(CDC* pDC, UINT nState, CRect& rcItem)
00115 {
00116     // get the handle to the bitmap (if any) associated
00117     // with this button.
00118     HBITMAP hBitmap = GetBitmap();
00119     if( hBitmap == NULL ) {
00120         return;
00121     }
00122
00123     CRect rc = rcItem;
00124
00125     // if the button is selected.
00126     if( nState & ODS_SELECTED ) {
00127         rcItem.OffsetRect(1,1);
00128     }
00129
00130     // draw the bitmap associated with this button.
00131     if((nState & ODS_DISABLED) != 0 && m_disbitmap != 0L)
00132         pDC->DrawState( rc.TopLeft(), rc.Size(), m_disbitmap,
00133             DSS_NORMAL, (HBRUSH)NULL );
00134     else if(m_bitmap != 0L)
00135         pDC->DrawState( rc.TopLeft(), rc.Size(), m_bitmap,
00136             DSS_NORMAL, (HBRUSH)NULL );
00137     else
00138         pDC->DrawState( rc.TopLeft(), rc.Size(), hBitmap,
00139             ( nState & ODS_DISABLED )?DSS_DISABLED:DSS_NORMAL, (HBRUSH)NULL );
00140 }
00141
00142 BEGIN_MESSAGE_MAP(CPseudoButton, CCJFlatButton)
00143     //{{AFX_MSG_MAP(CPseudoButton)
00144     //}}AFX_MSG_MAP
00145 END_MESSAGE_MAP()
00146
00148 // CPseudoRotButton
00149
00150 IMPLEMENT_DYNAMIC(CPseudoRotButton, CPseudoButton)
00151
00152 CPseudoRotButton::CPseudoRotButton() : m_curindex(-1)
00153 {
00154 }
00155
00156 CPseudoRotButton::~CPseudoRotButton()
00157 {
00158     m_bitmap = 0L;
00159     m_disbitmap = 0L;
00160     std::vector<HBITMAP>::iterator i;
00161     for(i = m_bitmaps.begin(); i != m_bitmaps.end(); ++i)
00162     {
00163         HBITMAP bmap = *i;
00164         AfxDeleteObject((HGDIOBJ*)&bmap);
00165     }
00166     for(i = m_disbitmaps.begin(); i != m_disbitmaps.end(); ++i)
00167     {
00168         HBITMAP bmap = *i;
00169         AfxDeleteObject((HGDIOBJ*)&bmap);
00170     }
00171 }
00172
00173 bool CPseudoRotButton::LoadXPMs(const int *rsrcid, int numrsrc)
00174 {
00175     CString sicon;
00176     COLORREF back = ::GetSysColor(COLOR_BTNFACE);
00177     COLORREF fore = ::GetSysColor(COLOR_GRAYTEXT);
00178
00179     for(int i = 0; i < numrsrc; i++)
00180     {
00181         if(!CPseudoButton::loadIcon(sicon, rsrcid[i]))
00182             return false;
00183
00184         int w, h;
00185         HBITMAP bmap = UMakeBitmap((const char *)sicon, w, h, DD_PIXMAP, back, fore);
00186         if(bmap == 0L)
00187             return false;
00188
00189         HBITMAP disbmap = UMakeBitmap((const char *)sicon, w, h, DD_PIXMAP, back, fore, false);
00190         if(disbmap == 0L)
00191             return false;
00192
00193         m_bitmaps.push_back(bmap);
00194         m_disbitmaps.push_back(disbmap);
00195     }
00196
00197     DoRotate(0);
00198     return true;
00199 }
00200
00201 void CPseudoRotButton::DoRotate(int index)
00202 {
00203     if(index < 0 || index > m_bitmaps.size() || index > m_disbitmaps.size() ||
00204         m_curindex == index)
00205         return;
00206
00207     SetBitmap(m_bitmaps[index]);
00208     Invalidate(TRUE);
00209     m_curindex = index;
00210     m_bitmap = m_bitmaps[index];
00211     m_disbitmap = m_disbitmaps[index];
00212 }
00213
00214 BEGIN_MESSAGE_MAP(CPseudoRotButton, CPseudoButton)
00215     //{{AFX_MSG_MAP(CPseudoRotButton)
00216     //}}AFX_MSG_MAP
00217 END_MESSAGE_MAP()
00218
00220
00221 IMPLEMENT_DYNAMIC(CPseudoToggle, CPseudoButton)
00222
00223 CPseudoToggle::CPseudoToggle()
00224 {
00225     m_flag = 0;
00226     m_radio = false;
00227 }
00228
00229 CPseudoToggle::~CPseudoToggle()
00230 {
00231 }
00232
00233 void CPseudoToggle::SetState(int state)
00234 {
00235     int newstate = state ? 1 : 0;
00236     if(m_flag == newstate)
00237         return;
00238
00239     m_flag = newstate;
00240     Invalidate(TRUE);
00241
00242     if(state && IsRadio() && !m_group.IsEmpty())
00243     {
00244         CWnd *hwndChild, *parent = GetParent();
00245         for (hwndChild = parent->GetTopWindow(); hwndChild != 0L; hwndChild = hwndChild->GetNextWindow())
00246         {
00247             if(hwndChild != this && hwndChild->IsWindowEnabled() && hwndChild->IsKindOf(RUNTIME_CLASS(CPseudoToggle)))
00248             {
00249                 CPseudoToggle *btn = (CPseudoToggle *)hwndChild;
00250                 if(btn->IsRadio() && m_group == btn->GetGroup())
00251                 {
00252                     btn->SetState(0);
00253                     break;
00254                 }
00255             }
00256         }
00257     }
00258 }
00259
00260 void CPseudoToggle::DrawItem(LPDRAWITEMSTRUCT lpDIS)
00261 {
00262     if(m_flag)
00263         lpDIS->itemState |= ODS_SELECTED;
00264     CPseudoButton::DrawItem(lpDIS);
00265 }
00266
00267 void CPseudoToggle::OnLButtonUp(UINT nFlags, CPoint point)
00268 {
00269     CRect rect;
00270     GetClientRect(&rect);
00271
00272     //check you are still on the button
00273     if(PtInRect(rect, point))
00274         ToggleBtn();
00275
00276     CPseudoButton::OnLButtonUp(nFlags, point);
00277 }
00278
00279 BEGIN_MESSAGE_MAP(CPseudoToggle, CPseudoButton)
00280     //{{AFX_MSG_MAP(CPseudoToggle)
00281     ON_WM_LBUTTONUP()
00282     //}}AFX_MSG_MAP
00283 END_MESSAGE_MAP()
00284
00285 static const BYTE *nextLine(const BYTE *src, CString & line)
00286 {
00287     const char *tmp = strchr((const char *)src, '\n');
00288     if(tmp == 0L)
00289         return 0L;
00290
00291     line = CString((const char *)src, tmp - (const char *)src - 1);
00292     src = (const BYTE *)tmp + 1;
00293     return src;
00294 }
00295
00296 HBITMAP UMakeBitmap(const void *icon, int & width, int & height, UTB_KIND kind,
00297                     COLORREF back, COLORREF fore, bool enabled)
00298 {
00299     if( kind == DD_BMAP)
00300     {
00301         HBITMAP hbitmap;
00302         LPBITMAPINFO header;
00303         BYTE *image, *src = (BYTE *)icon, c, k;
00304         RGBQUAD *pRgb;
00305
00306         hbitmap = CreateDIB(width, height, 1, 0L);
00307         header = (LPBITMAPINFO)GlobalLock(hbitmap);
00308         image = (LPBYTE)header + header->bmiHeader.biSize + PaletteSize(header);
00309         pRgb = (RGBQUAD *)((LPBYTE)header + header->bmiHeader.biSize);
00310
00311         pRgb->rgbRed = GetRValue(back);
00312         pRgb->rgbGreen = GetGValue(back);
00313         pRgb->rgbBlue = GetBValue(back);
00314         pRgb->rgbReserved = 0;
00315         pRgb++;
00316         pRgb->rgbRed = GetRValue(fore);
00317         pRgb->rgbGreen = GetGValue(fore);
00318         pRgb->rgbBlue = GetBValue(fore);
00319         pRgb->rgbReserved = 0;
00320
00321         int row = WIDTHBYTES(width * 1);
00322         int row2 = WIDTHBYTES8(width * 1);
00323         for(int y = 0; y < height; y++)
00324         {
00325             BYTE *ptr = image + row * (height - y - 1);
00326             for(int x = 0; x < row2; x++)
00327             {
00328                 c = *src++;
00329                 k = 0;
00330                 int n = 8;
00331                 while(n--)
00332                 {
00333                     if(c & 1)
00334                         k |= 1 << n;
00335                     c = c >> 1;
00336                 }
00337                 *ptr++ = k;
00338             }
00339         }
00340
00341         GlobalUnlock(hbitmap);
00342
00343         HBITMAP ddbbmap = DIBToBitmap(hbitmap);
00344         GlobalFree((HGLOBAL)hbitmap);
00345
00346         return ddbbmap;
00347     }
00348     else if(kind == DD_PIXMAP)
00349     {
00350         const BYTE *src = (BYTE *)icon;
00351         CString aline;
00352
00353         src = nextLine(src, aline);
00354         if(src == 0L)
00355             return 0L;
00356
00357         // read the header
00358         int w, h, nc, cpp, i, x, y;
00359         if(sscanf(aline, "%d%d%d%d", &w, &h, &nc, &cpp) != 4)
00360             return 0L;
00361
00362         width = w;
00363         height = h;
00364
00365         HBITMAP hbitmap = CreateDIB(w, h, 8, 0L);
00366         LPBITMAPINFO header = (LPBITMAPINFO)GlobalLock(hbitmap);
00367         BYTE *image = (LPBYTE)header + header->bmiHeader.biSize + PaletteSize(header);
00368         RGBQUAD *pRgb = (RGBQUAD *)((LPBYTE)header + header->bmiHeader.biSize);
00369
00370         // read the colormap
00371         std::map<short, BYTE> colors;
00372         for(i = 0; i < nc; i++)
00373         {
00374             src = nextLine(src, aline);
00375             if(src == 0L)
00376                 return 0L;
00377
00378             const BYTE *line = (const BYTE *)(const char *)aline;
00379             short aref;
00380             if(cpp == 1)
00381             {
00382                 aref = line[0];
00383                 line += 1;
00384             }
00385             else if(cpp == 2)
00386             {
00387                 aref = ((short)line[1] << 8)  | line[0];
00388                 line += 2;
00389             }
00390             else
00391             {
00392                 ASSERT(0);
00393                 return 0L;
00394             }
00395
00396             while(isspace(*line) && *line)
00397                 line++;
00398             if(*line++ != 'c')
00399                 return 0L;
00400
00401             while(isspace(*line) && *line)
00402                 line++;
00403             if(*line == '\0')
00404                 return 0L;
00405
00406             if(*line == '#')
00407             {
00408                 line++;
00409
00410                 if(strlen((char *)line) < 6)
00411                     return 0L;
00412
00413                 int comp[6], c;
00414                 int j;
00415                 for(j = 0; j < 6; j++)
00416                 {
00417                     c = *line++;
00418                     if(c >= '0' && c <= '9')
00419                         comp[j] = c - '0';
00420                     else if(c >= 'a' && c <= 'f')
00421                         comp[j] = c - 'a' + 10;
00422                     else if(c >= 'A' && c <= 'F')
00423                         comp[j] = c - 'A' + 10;
00424                     else
00425                         return 0L;
00426                 }
00427
00428                 colors.insert(std::make_pair(aref, i));
00429
00430                 if(i == 0)
00431                 {
00432                     COLORREF bk = back;
00433                     pRgb->rgbRed = GetRValue(bk);
00434                     pRgb->rgbGreen = GetGValue(bk);
00435                     pRgb->rgbBlue = GetBValue(bk);
00436                     pRgb->rgbReserved = 0;
00437                 }
00438                 else
00439                 {
00440                     COLORREF color = RGB(comp[0]*16+comp[1],comp[2]*16+comp[3],comp[4]*16+comp[5]);
00441                     if(!enabled)
00442                         color = fore;
00443                     pRgb->rgbRed = GetRValue(color);
00444                     pRgb->rgbGreen = GetGValue(color);
00445                     pRgb->rgbBlue = GetBValue(color);
00446                     pRgb->rgbReserved = 0;
00447                 }
00448             }
00449             else if(strcmp((char *)line, "None") == 0)
00450             {
00451                 colors.insert(std::make_pair(aref, i));
00452                 COLORREF bk = back;
00453                 pRgb->rgbRed = GetRValue(bk);
00454                 pRgb->rgbGreen = GetGValue(bk);
00455                 pRgb->rgbBlue = GetBValue(bk);
00456                 pRgb->rgbReserved = 0;
00457             }
00458             else
00459                 return 0L;
00460             pRgb++;
00461         }
00462
00463         if(nc != colors.size() || nc > 256)
00464             return 0L;
00465
00466         // make the bitmap
00467         for(y = 0; y < h; y++)
00468         {
00469             src = nextLine(src, aline);
00470             if(src == 0L)
00471                 return 0L;
00472
00473             const BYTE *line = (const BYTE *)(const char *)aline;
00474             BYTE *ptr = image + WIDTHBYTES(w * 8) * (h - y - 1);
00475             for(x = 0; x < w; x++)
00476             {
00477                 short aref;
00478                 if(cpp == 1)
00479                 {
00480                     aref = line[0];
00481                     line++;
00482                 }
00483                 else if(cpp == 2)
00484                 {
00485                     aref = ((short)line[1] << 8)  | line[0];
00486                     line += 2;
00487                 }
00488                 std::map<short, BYTE>::iterator pos = colors.find(aref);
00489                 if(pos == colors.end())
00490                     return 0L;
00491                 *ptr++ = (*pos).second;
00492             }
00493         }
00494
00495         GlobalUnlock(hbitmap);
00496
00497         HBITMAP ddbbmap = DIBToBitmap(hbitmap);
00498         GlobalFree((HGLOBAL)hbitmap);
00499
00500         return ddbbmap;
00501     }
00502     else if(kind == DD_RGB)
00503     {
00504         BYTE *src = (BYTE *)icon;
00505
00506         // read the header
00507         int w = width, h = height, x, y;
00508
00509         HBITMAP hbitmap = CreateDIB(w, h, 24, 0L);
00510         LPBITMAPINFO header = (LPBITMAPINFO)GlobalLock(hbitmap);
00511         BYTE *image = (LPBYTE)header + header->bmiHeader.biSize + PaletteSize(header);
00512
00513         // make the bitmap
00514         for(y = 0; y < h; y++)
00515         {
00516 #if 0
00517             BYTE *ptr = image + WIDTHBYTES(w * 24) * (h - y - 1);
00518 #else
00519             BYTE *ptr = image + WIDTHBYTES(w * 24) * y;
00520 #endif
00521             for(x = 0; x < w; x++)
00522             {
00523                 ptr[2] = *src++;
00524                 ptr[1] = *src++;
00525                 ptr[0] = *src++;
00526                 ptr += 3;
00527                 src++;
00528             }
00529         }
00530
00531         GlobalUnlock(hbitmap);
00532
00533         HBITMAP ddbbmap = DIBToBitmap(hbitmap);
00534         GlobalFree((HGLOBAL)hbitmap);
00535
00536         return ddbbmap;
00537     }
00538
00539     return 0L;
00540 }
00541
00542 HBITMAP UMakeBitmap(const void *icon, int width, int height, UTB_KIND kind, bool enabled)
00543 {
00544     return UMakeBitmap(icon, width, height, kind,
00545         ::GetSysColor(COLOR_BTNFACE), ::GetSysColor(COLOR_BTNTEXT), enabled);
00546 }
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/PseudoButton.h Source File

rf/support/mfc/PseudoButton.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 // CPseudoButton window
00022
00023 #ifndef PSEUDOBUTTON_H
00024 #define PSEUDOBUTTON_H
00025
00026 #include <vector>
00027
00028 typedef enum
00029 {
00030     DD_END,
00031     DD_PIXMAP,  /* X11 pixmap (color indexed) */
00032     DD_BMAP,    /* X11 bitmap (B&W) */
00033     DD_RGB      /* RGB / char */
00034 } UTB_KIND;
00035
00036 HBITMAP UMakeBitmap(const void *icon, int & width, int & height, UTB_KIND kind,
00037                     COLORREF back, COLORREF fore, bool enabled = true);
00038
00039 HBITMAP UMakeBitmap(const void *icon, int width, int height, UTB_KIND kind, bool enabled = true);
00040
00041 class CPseudoButton : public CCJFlatButton
00042 {
00043     DECLARE_DYNAMIC(CPseudoButton)
00044
00045 // Construction
00046 public:
00047     CPseudoButton();
00048
00049     virtual bool LoadXPM(int rsrcid);
00050         // return false if it fails
00051
00052     static bool loadIcon(CString & icon, int rsrcid);
00053
00054     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
00055
00056 // Attributes
00057 protected:
00058     HBITMAP m_bitmap;
00059     HBITMAP m_disbitmap;
00060
00061 // Operations
00062 public:
00063
00064 // Overrides
00065     // ClassWizard generated virtual function overrides
00066     //{{AFX_VIRTUAL(CPseudoButton)
00067     //}}AFX_VIRTUAL
00068
00069 // Implementation
00070 public:
00071     virtual ~CPseudoButton();
00072
00073     // Generated message map functions
00074 protected:
00075     virtual void DrawButtonBitmap(CDC* pDC, UINT nState, CRect& rcItem);
00076
00077     //{{AFX_MSG(CPseudoButton)
00078     //}}AFX_MSG
00079
00080     DECLARE_MESSAGE_MAP()
00081 };
00082
00084
00085 class CPseudoRotButton : public CPseudoButton
00086 {
00087     DECLARE_DYNAMIC(CPseudoRotButton)
00088
00089 // Construction
00090 public:
00091     CPseudoRotButton();
00092
00093 // Attributes
00094 protected:
00095     std::vector<HBITMAP> m_bitmaps;
00096     std::vector<HBITMAP> m_disbitmaps;
00097     int m_curindex;
00098
00099 // Operations
00100 public:
00101     virtual bool LoadXPMs(const int *rsrcid, int numrsrc);
00102
00103     virtual void DoRotate(int index);
00104     inline int GetCurrent(void) const { return m_curindex; }
00105
00106 // Overrides
00107     // ClassWizard generated virtual function overrides
00108     //{{AFX_VIRTUAL(CPseudoRotButton)
00109     //}}AFX_VIRTUAL
00110
00111 // Implementation
00112 public:
00113     virtual ~CPseudoRotButton();
00114
00115     // Generated message map functions
00116 protected:
00117     //{{AFX_MSG(CPseudoRotButton)
00118     //}}AFX_MSG
00119
00120     DECLARE_MESSAGE_MAP()
00121 };
00122
00124
00125 class CPseudoToggle : public CPseudoButton
00126 {
00127     DECLARE_DYNAMIC(CPseudoToggle)
00128
00129 // Construction
00130 public:
00131     CPseudoToggle();
00132
00133 // Attributes
00134 protected:
00135     int m_flag;
00136     bool m_radio;
00137     CString m_group;
00138
00139 // Operations
00140 public:
00141     ~CPseudoToggle();
00142     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
00143
00144     // visual state (pushed/unpushed)
00145     virtual void SetState(int state);
00146     inline int GetState(void) const { return m_flag;}
00147     inline void ToggleBtn() { SetState(GetState() == 0 ? 1:0);}
00148
00149     // radio button behaviour
00150     inline void SetRadio(bool state) { m_radio = state; }
00151     inline bool IsRadio(void) const  { return m_radio; }
00152     inline void SetGroup(const char *group) { m_group = group; }
00153     inline const char *GetGroup(void) const { return m_group; }
00154
00155     //{{AFX_MSG(COglView)
00156     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00157     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00158     afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
00159     //}}AFX_MSG
00160     DECLARE_MESSAGE_MAP()
00161 };
00162
00163 #endif
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/PseudoDlg.cpp Source File

rf/support/mfc/PseudoDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 // PseudoDlg.cpp : implementation file
00022 //
00023
00024 #include "stdafx.h"
00025 #include "uwidget.h"
00026 #include "PseudoDlg.h"
00027 #include "PseudoDraw.h"
00028 #include "PseudoList.h"
00029
00030 #ifdef _DEBUG
00031 #define new DEBUG_NEW
00032 #undef THIS_FILE
00033 static char THIS_FILE[] = __FILE__;
00034 #endif
00035
00036 #define IS_PSEUDO_CTL(id) ((id) >= WINCMD_DLG_START && (id) < WINCMD_DLG_END)
00037
00039 // CPseudoDlg dialog
00040
00041 CPseudoDlg::CPseudoDlg(int dlgid, UWidget *pseudo, CWnd* pParent /*=NULL*/)
00042     : CDialog(dlgid, pParent), m_pseudo(pseudo)
00043 {
00044     //{{AFX_DATA_INIT(CPseudoDlg)
00045         // NOTE: the ClassWizard will add member initialization here
00046     //}}AFX_DATA_INIT
00047 }
00048
00049 CPseudoDlg::~CPseudoDlg()
00050 {
00051     if(m_pseudo != 0L)
00052     {
00053         UEventSendMessage(m_pseudo->GetWidID(), EV_DESTROY, 0, 0L);
00054
00055         std::map<int, void *>::iterator k;
00056         for(k = m_pseudo->GetWidgets().begin(); k != m_pseudo->GetWidgets().end(); ++k)
00057         {
00058             CWnd *wnd = (CWnd *)(*k).second;
00059             if((*k).first != kUMainWidget)
00060                 delete wnd;
00061         }
00062     }
00063 }
00064
00065 void CPseudoDlg::DoDataExchange(CDataExchange* pDX)
00066 {
00067     CDialog::DoDataExchange(pDX);
00068
00069     if(m_pseudo != 0L)
00070     {
00071         std::map<int, void *>::iterator i;
00072         for(i = m_pseudo->GetWidgets().begin(); i != m_pseudo->GetWidgets().end(); ++i)
00073         {
00074             if((*i).first != kUMainWidget)
00075                 DDX_Control(pDX, UCMD_to_WINCTL((*i).first), *(CWnd *)(*i).second);
00076         }
00077
00078         m_pseudo->DoDataExchange(!pDX->m_bSaveAndValidate);
00079     }
00080
00081     //{{AFX_DATA_MAP(CPseudoDlg)
00082     //}}AFX_DATA_MAP
00083 }
00084
00085
00086 BEGIN_MESSAGE_MAP(CPseudoDlg, CDialog)
00087     //{{AFX_MSG_MAP(CPseudoDlg)
00088     //}}AFX_MSG_MAP
00089 END_MESSAGE_MAP()
00090
00091 void WinInitWidgets(CWnd *wnd, UWidget *pseudo)
00092 {
00093     CWnd* pWndStart = 0L;
00094     pWndStart = wnd->GetTopWindow();
00095     while(pWndStart != 0L)
00096     {
00097         HWND hwnd = *pWndStart;
00098         int id = ::GetDlgCtrlID(*pWndStart);
00099         CWnd *res = 0L;
00100         if(IS_PSEUDO_CTL(id))
00101         {
00102             TCHAR szCompare[100];
00103             ::GetClassName(hwnd, szCompare, _countof(szCompare));
00104             DWORD style = (DWORD)GetWindowLong(hwnd, GWL_STYLE);
00105
00106             // check overided widgets
00107             std::map<int, CRuntimeClass *> & list = pseudo->GetOverideList();
00108             std::map<int, CRuntimeClass *>::const_iterator i = list.find(WINCTL_to_UCMD(id));
00109             if(i != list.end())
00110             {
00111                 CRuntimeClass *clss = (*i).second;
00112                 if(clss->IsDerivedFrom(RUNTIME_CLASS(CWnd)))
00113                 {
00114                     res = (CWnd *)clss->CreateObject();
00115                 }
00116             }
00117
00118             if(res == 0L)
00119             {
00120                 if(stricmp(szCompare, "BUTTON") == 0)
00121                 {
00122                     CButton *btn = new CButton();
00123                     res = btn;
00124                 }
00125                 else if(stricmp(szCompare, "Static") == 0)
00126                 {
00127                     if(style & SS_ETCHEDFRAME)
00128                     {
00129                         CPseudoDraw *draw = new CPseudoDraw(pseudo, WINCTL_to_UCMD(id));
00130                         res = draw;
00131                     }
00132                     else
00133                     {
00134                         CStatic *stat = new CStatic();
00135                         res = stat;
00136                     }
00137                 }
00138                 else if(stricmp(szCompare, "ComboBox") == 0)
00139                 {
00140                     CComboBox *combo = new CComboBox();
00141                     res = combo;
00142                 }
00143                 else if(stricmp(szCompare, WC_LISTVIEW) == 0)
00144                 {
00145                     CPseudoList *list = new CPseudoList(pseudo->GetWidID(), WINCTL_to_UCMD(id));
00146                     res = list;
00147                 }
00148                 else
00149                 {
00150                     res = new CWnd();
00151                 }
00152             }
00153
00154             UEventSendMessage(pseudo->GetWidID(), EV_INIT_WIDGET, WINCTL_to_UCMD(id), res);
00155         }
00156         pWndStart = pWndStart->GetNextWindow();
00157     }
00158
00159     std::map<int, CRuntimeClass *> & list = pseudo->GetOverideList();
00160     list.erase(list.begin(), list.end());
00161 }
00162
00164 // CPseudoDlg message handlers
00165
00166 BOOL CPseudoDlg::OnInitDialog()
00167 {
00168     if(m_pseudo != 0L)
00169     {
00170         WinInitWidgets(this, m_pseudo);
00171         UEventSendMessage(m_pseudo->GetWidID(), EV_CREATE, 0, 0L);
00172     }
00173
00174     CDialog::OnInitDialog();
00175
00176     return TRUE;  // return TRUE unless you set the focus to a control
00177                   // EXCEPTION: OCX Property Pages should return FALSE
00178 }
00179
00180 static int findIdForWnd(CWnd *wnd, UWidget *wid)
00181 {
00182     const std::map<int, void *> & allWids = wid->GetWidgets();
00183     std::map<int, void *>::const_iterator i;
00184     for(i = allWids.begin(); i != allWids.end(); ++i)
00185     {
00186         if(wnd == (CWnd *)(*i).second)
00187             return (*i).first;
00188     }
00189     return -1;
00190 }
00191
00192 static int UWinToUMod(UINT nFlags)
00193 {
00194     int res = 0;
00195     if(nFlags & MK_LBUTTON)
00196         res |= VK_LBUTTON;
00197     if(nFlags & MK_RBUTTON)
00198         res |= UK_RBUTTON;
00199     if(nFlags & MK_SHIFT)
00200         res |= UK_SHIFT;
00201     if(nFlags & MK_CONTROL)
00202         res |= UK_CONTROL;
00203     if(nFlags & MK_MBUTTON)
00204         res |= UK_MBUTTON;
00205     if ((GetKeyState(VK_MENU) & 0x8000) != 0)
00206         res |= UK_ALT;
00207
00208     return res;
00209 }
00210
00211 LRESULT UWinPseudoWindowProc(CWnd *wnd, UWidget *wid, UINT message, WPARAM wParam, LPARAM lParam)
00212 {
00213     bool sentOne = false;
00214
00215     if(wid == 0L)
00216         return 1;
00217
00218     if (message == WM_COMMAND)
00219     {
00220         UINT nID = LOWORD(wParam);
00221         if(!IS_PSEUDO_CTL(nID))
00222             return 1;
00223
00224         int nCode = HIWORD(wParam);
00225         HWND hWndCtrl = (HWND)lParam;
00226         switch(nCode)
00227         {
00228         case BN_CLICKED:
00229             UEventSendMessage(wid->GetWidID(), EV_CMD, WINCTL_to_UCMD(nID), 0L);
00230             sentOne = true;
00231             break;
00232         case CBN_SELCHANGE:
00233         {
00234             ASSERT(::IsWindow(hWndCtrl));
00235             int sel = (int)::SendMessage(hWndCtrl, CB_GETCURSEL, 0, 0);
00236             const char *txt = 0L;
00237             char buf[1024] = {'\0'};
00238             if(sel != -1 && (int)::SendMessage(hWndCtrl, CB_GETLBTEXT, sel, (LPARAM)buf) != CB_ERR)
00239                 txt = buf;
00240             if(strcmp(buf, "-") != 0) // separator
00241                 UEventSendMessage(wid->GetWidID(), EV_COMBO_SEL,
00242                     UMAKEINT(WINCTL_to_UCMD(nID), sel), (void *)txt);
00243             sentOne = true;
00244             break;
00245         }
00246         case EN_CHANGE:
00247             if(wid->m_noDispatch)
00248                 break;
00249
00250             ASSERT(::IsWindow(hWndCtrl));
00251             UEventSendMessage(wid->GetWidID(), EV_EDITCHANGE,
00252                 WINCTL_to_UCMD(nID), 0L);
00253             break;
00254         }
00255     }
00256     else if (message == WM_NOTIFY)
00257     {
00258         NMHDR* pNMHDR = (NMHDR*)lParam;
00259         if (pNMHDR->hwndFrom != NULL)
00260         {
00261             UINT nID = _AfxGetDlgCtrlID(pNMHDR->hwndFrom);
00262             int nCode = pNMHDR->code;
00263             if(!IS_PSEUDO_CTL(nID))
00264                 return 1;
00265
00266             switch(nCode)
00267             {
00268             case LVN_ITEMCHANGED:
00269                 NMLISTVIEW *state = (NMLISTVIEW *)pNMHDR;
00270
00271                 HWND wnd = state->hdr.hwndFrom;
00272                 ASSERT(::IsWindow(wnd));
00273
00274                 int id = state->hdr.idFrom;
00275                 std::map<int, void *>::const_iterator i = wid->GetWidgets().find(WINCTL_to_UCMD(id));
00276                 if(i != wid->GetWidgets().end())
00277                 {
00278                     CWnd *w = (CWnd *)(*i).second;
00279                     if(w->IsKindOf(RUNTIME_CLASS(CListCtrl)))
00280                     {
00281                         CListCtrl *list = (CListCtrl*)w;
00282                         CString s = list->GetItemText(state->iItem, 0);
00283
00284                         UEventSendMessage(wid->GetWidID(), EV_LIST_SELECTING,
00285                             UMAKEINT(WINCTL_to_UCMD(state->hdr.idFrom), state->iItem), (void *)(const char *)s);
00286                         sentOne = true;
00287                     }
00288                 }
00289                 break;
00290             }
00291         }
00292     }
00293     else if (message == WM_SIZE)
00294     {
00295         int id = findIdForWnd(wnd, wid);
00296         if(id != -1)
00297         {
00298             URECT r = {0, 0, LOWORD(lParam), HIWORD(lParam)};
00299             UEventSendMessage(wid->GetWidID(), EV_RESIZE, id, &r);
00300             sentOne = true;
00301         }
00302     }
00303     else if (message == WM_MOUSEMOVE)
00304     {
00305         int id = findIdForWnd(wnd, wid);
00306         if(id != -1)
00307         {
00308             UEventSendMessage(wid->GetWidID(), EV_MMOVE, UMAKEINT(LOWORD(lParam), HIWORD(lParam)),
00309                 (void *)UWinToUMod(wParam));
00310             sentOne = true;
00311         }
00312     }
00313     else if (message == WM_LBUTTONDOWN)
00314     {
00315         int id = findIdForWnd(wnd, wid);
00316         if(id != -1)
00317         {
00318             UEventSendMessage(wid->GetWidID(), EV_BTNDOWN, UMAKEINT(LOWORD(lParam), HIWORD(lParam)),
00319                 (void *)UWinToUMod(wParam));
00320             sentOne = true;
00321         }
00322     }
00323     else if (message == WM_LBUTTONUP)
00324     {
00325         int id = findIdForWnd(wnd, wid);
00326         if(id != -1)
00327         {
00328             UEventSendMessage(wid->GetWidID(), EV_BTNUP, UMAKEINT(LOWORD(lParam), HIWORD(lParam)),
00329                 (void *)UWinToUMod(wParam));
00330             sentOne = true;
00331         }
00332     }
00333     else if (message == WM_LBUTTONDBLCLK)
00334     {
00335         int id = findIdForWnd(wnd, wid);
00336         if(id != -1)
00337         {
00338             UEventSendMessage(wid->GetWidID(), EV_BTNDBLDOWN, UMAKEINT(LOWORD(lParam), HIWORD(lParam)),
00339                 (void *)UWinToUMod(wParam));
00340             sentOne = true;
00341         }
00342     }
00343     else if (message == WM_KEYDOWN)
00344     {
00345         int id = findIdForWnd(wnd, wid);
00346         if(id != -1)
00347         {
00348             UEventSendMessage(wid->GetWidID(), EV_KEYDOWN, wParam, 0L);
00349             sentOne = true;
00350         }
00351     }
00352     else if (message == WM_HSCROLL)
00353     {
00354         HWND hwndScrollBar = (HWND) lParam;       // handle to scroll bar
00355         int nID = ::GetDlgCtrlID(hwndScrollBar);
00356         if(!IS_PSEUDO_CTL(nID))
00357             return 1;
00358
00359         int cmd = WINCTL_to_UCMD(nID);
00360         CWnd *wnds = (CWnd *)wid->GetWidget(cmd);
00361         if(wnds == 0L || !wnds->IsKindOf(RUNTIME_CLASS(CScrollBar)))
00362             return 1;
00363
00364         CScrollBar *scroll = (CScrollBar *)wnds;
00365
00366         int nScrollCode = (int) LOWORD(wParam);  // scroll bar value
00367         int nPos;
00368         if(nScrollCode == SB_THUMBPOSITION || nScrollCode == SB_THUMBTRACK)
00369         {
00370             nPos = (short int) HIWORD(wParam);   // scroll box position
00371
00372             if(nScrollCode == SB_THUMBPOSITION)
00373                 scroll->SetScrollPos(nPos);
00374         }
00375         else
00376         {
00377             SCROLLINFO info;
00378             VERIFY(scroll->GetScrollInfo(&info));
00379             nPos = info.nPos;
00380
00381             switch(nScrollCode)
00382             {
00383             case SB_ENDSCROLL:
00384                 return 1;
00385                 break;
00386             case SB_LINELEFT:
00387                 nPos -= 1;
00388                 break;
00389             case SB_LINERIGHT:
00390                 nPos += 1;
00391                 break;
00392             case SB_PAGELEFT:
00393                 nPos -= info.nPage;
00394                 break;
00395             case SB_PAGERIGHT:
00396                 nPos += info.nPage;
00397                 break;
00398             case SB_LEFT:
00399                 nPos = info.nMin;
00400                 break;
00401             case SB_RIGHT:
00402                 nPos = info.nMax;
00403                 break;
00404             }
00405
00406             scroll->SetScrollPos(nPos);
00407         }
00408
00409         UEventSendMessage(wid->GetWidID(), EV_SCROLLCHANGE, WINCTL_to_UCMD(nID),
00410             (void *)nPos);
00411         sentOne = true;
00412     }
00413     else if (message == WM_VSCROLL)
00414     {
00415         HWND hwndScrollBar = (HWND) lParam;       // handle to scroll bar
00416         int nID = ::GetDlgCtrlID(hwndScrollBar);
00417         if(!IS_PSEUDO_CTL(nID))
00418             return 1;
00419
00420         int cmd = WINCTL_to_UCMD(nID);
00421         CWnd *wnds = (CWnd *)wid->GetWidget(cmd);
00422         if(wnds == 0L || !wnds->IsKindOf(RUNTIME_CLASS(CScrollBar)))
00423             return 1;
00424
00425         CScrollBar *scroll = (CScrollBar *)wnds;
00426
00427         int nScrollCode = (int) LOWORD(wParam);  // scroll bar value
00428         int nPos;
00429         if(nScrollCode == SB_THUMBPOSITION || nScrollCode == SB_THUMBTRACK)
00430         {
00431             nPos = (short int) HIWORD(wParam);   // scroll box position
00432
00433             if(nScrollCode == SB_THUMBPOSITION)
00434                 scroll->SetScrollPos(nPos);
00435         }
00436         else
00437         {
00438             SCROLLINFO info;
00439             VERIFY(scroll->GetScrollInfo(&info));
00440             nPos = info.nPos;
00441
00442             switch(nScrollCode)
00443             {
00444             case SB_ENDSCROLL:
00445                 return 1;
00446                 break;
00447             case SB_LINEUP:
00448                 nPos -= 1;
00449                 break;
00450             case SB_LINEDOWN:
00451                 nPos += 1;
00452                 break;
00453             case SB_PAGEUP:
00454                 nPos -= info.nPage;
00455                 break;
00456             case SB_PAGEDOWN:
00457                 nPos += info.nPage;
00458                 break;
00459             case SB_TOP:
00460                 nPos = info.nMin;
00461                 break;
00462             case SB_BOTTOM:
00463                 nPos = info.nMax;
00464                 break;
00465             }
00466
00467             if(nPos > info.nMax)
00468                 nPos = info.nMax;
00469             else if(nPos < info.nMin)
00470                 nPos = info.nMin;
00471             scroll->SetScrollPos(nPos);
00472         }
00473
00474         UEventSendMessage(wid->GetWidID(), EV_SCROLLCHANGE, WINCTL_to_UCMD(nID),
00475             (void *)nPos);
00476         sentOne = true;
00477     }
00478
00479     if(sentOne)
00480         UWidget::DoValidUI(false);
00481
00482     return 1;
00483 }
00484
00485 LRESULT CPseudoDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
00486 {
00487     if(m_pseudo != 0L && !UWinPseudoWindowProc(this, m_pseudo, message, wParam, lParam))
00488         return 0;
00489
00490     return CDialog::WindowProc(message, wParam, lParam);
00491 }
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/PseudoDlg.h Source File

rf/support/mfc/PseudoDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 2000
00019  */
00020
00021 #if !defined(AFX_PSEUDODLG_H__9EDC5FE5_21FD_4ACE_9AEB_7A521350A2EE__INCLUDED_)
00022 #define AFX_PSEUDODLG_H__9EDC5FE5_21FD_4ACE_9AEB_7A521350A2EE__INCLUDED_
00023
00024 #if _MSC_VER > 1000
00025 #pragma once
00026 #endif // _MSC_VER > 1000
00027 // PseudoDlg.h : header file
00028 //
00029
00030 class UWidget;
00031
00033 // CPseudoDlg dialog
00034
00035 class CPseudoDlg : public CDialog
00036 {
00037 // Construction
00038 public:
00039     CPseudoDlg(int dlgid, UWidget *pseudo, CWnd* pParent = NULL);   // standard constructor
00040     virtual ~CPseudoDlg();
00041
00042 // Dialog Data
00043     //{{AFX_DATA(CPseudoDlg)
00044     //}}AFX_DATA
00045
00046
00047 // Overrides
00048     // ClassWizard generated virtual function overrides
00049     //{{AFX_VIRTUAL(CPseudoDlg)
00050     protected:
00051     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00052     //}}AFX_VIRTUAL
00053
00054 // Implementation
00055 protected:
00056     UWidget *m_pseudo;
00057     virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
00058
00059     // Generated message map functions
00060     //{{AFX_MSG(CPseudoDlg)
00061     virtual BOOL OnInitDialog();
00062     //}}AFX_MSG
00063     DECLARE_MESSAGE_MAP()
00064 };
00065
00066 //{{AFX_INSERT_LOCATION}}
00067 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00068
00069 #endif // !defined(AFX_PSEUDODLG_H__9EDC5FE5_21FD_4ACE_9AEB_7A521350A2EE__INCLUDED_)
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/PseudoDraw.cpp Source File

rf/support/mfc/PseudoDraw.cpp

Go to the documentation of this file.
00001 // PseudoDraw.cpp : implementation file
00002 //
00003
00004 #include "stdafx.h"
00005
00006 #include "PseudoDraw.h"
00007 #include "uwidget.h"
00008
00009 #ifdef _DEBUG
00010 #define new DEBUG_NEW
00011 #undef THIS_FILE
00012 static char THIS_FILE[] = __FILE__;
00013 #endif
00014
00016 // CPseudoDraw
00017
00018 CPseudoDraw::CPseudoDraw(UWidget *pseudo, int cmdid) : m_pseudo(pseudo), m_cmdid(cmdid)
00019 {
00020 }
00021
00022 CPseudoDraw::~CPseudoDraw()
00023 {
00024 }
00025
00026
00027 BEGIN_MESSAGE_MAP(CPseudoDraw, CStatic)
00028     //{{AFX_MSG_MAP(CPseudoDraw)
00029     ON_WM_PAINT()
00030     //}}AFX_MSG_MAP
00031 END_MESSAGE_MAP()
00032
00034 // CPseudoDraw message handlers
00035
00036 void CPseudoDraw::OnPaint()
00037 {
00038     CPaintDC dc(this); // device context for painting
00039
00040     if(m_pseudo != 0L)
00041         UEventSendMessage(m_pseudo->GetWidID(), EV_CUSTOM_DRAW, m_cmdid, &dc);
00042 }
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/PseudoDraw.h Source File

rf/support/mfc/PseudoDraw.h

Go to the documentation of this file.
00001 #if !defined(AFX_STATICDRAW_H__8DCC3165_D42E_4FAA_BCCF_F4328685535E__INCLUDED_)
00002 #define AFX_STATICDRAW_H__8DCC3165_D42E_4FAA_BCCF_F4328685535E__INCLUDED_
00003
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 // PseudoDraw.h : header file
00008 //
00009
00011 // CPseudoDraw window
00012
00013 class UWidget;
00014
00015 class CPseudoDraw : public CStatic
00016 {
00017 // Construction
00018 public:
00019     CPseudoDraw(UWidget *pseudo, int cmdid);
00020
00021 // Attributes
00022 public:
00023     UWidget *m_pseudo;
00024     int m_cmdid;
00025
00026 // Operations
00027 public:
00028
00029 // Overrides
00030     // ClassWizard generated virtual function overrides
00031     //{{AFX_VIRTUAL(CPseudoDraw)
00032     //}}AFX_VIRTUAL
00033
00034 // Implementation
00035 public:
00036     virtual ~CPseudoDraw();
00037
00038     // Generated message map functions
00039 protected:
00040     //{{AFX_MSG(CPseudoDraw)
00041     afx_msg void OnPaint();
00042     //}}AFX_MSG
00043
00044     DECLARE_MESSAGE_MAP()
00045 };
00046
00048
00049 //{{AFX_INSERT_LOCATION}}
00050 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00051
00052 #endif // !defined(AFX_STATICDRAW_H__8DCC3165_D42E_4FAA_BCCF_F4328685535E__INCLUDED_)
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/PseudoList.cpp Source File

rf/support/mfc/PseudoList.cpp

Go to the documentation of this file.
00001 // PseudoList.cpp : implementation file
00002 //
00003
00004 #include "stdafx.h"
00005 #include "PseudoList.h"
00006 #include "umain.h"
00007
00008 #ifdef _DEBUG
00009 #define new DEBUG_NEW
00010 #undef THIS_FILE
00011 static char THIS_FILE[] = __FILE__;
00012 #endif
00013
00015 // CPseudoList
00016
00017 CPseudoList::CPseudoList(int wid, int cmd) : m_wid(wid), m_cmd(cmd)
00018 {
00019 }
00020
00021 CPseudoList::~CPseudoList()
00022 {
00023 }
00024
00025
00026 BEGIN_MESSAGE_MAP(CPseudoList, CListCtrl)
00027     //{{AFX_MSG_MAP(CPseudoList)
00028     ON_WM_LBUTTONDBLCLK()
00029     //}}AFX_MSG_MAP
00030 END_MESSAGE_MAP()
00031
00033 // CPseudoList message handlers
00034
00035 void CPseudoList::OnLButtonDblClk(UINT nFlags, CPoint point)
00036 {
00037     UINT pFlags;
00038     int nItem = HitTest(point, &pFlags);
00039     if(nItem != -1)
00040     {
00041         CString s = GetItemText(nItem, 0);
00042
00043         UEventSendMessage(m_wid, EV_LIST_DBLCLICK, UMAKEINT(m_cmd, nItem),
00044             (void *)(const char *)s);
00045     }
00046
00047     CListCtrl::OnLButtonDblClk(nFlags, point);
00048 }
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/pseudolist.h Source File

rf/support/mfc/pseudolist.h

Go to the documentation of this file.
00001 #if !defined(AFX_PSEUDOLIST_H__49AF86B3_E6AB_4885_843C_1CE5AC8C4980__INCLUDED_)
00002 #define AFX_PSEUDOLIST_H__49AF86B3_E6AB_4885_843C_1CE5AC8C4980__INCLUDED_
00003
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 // PseudoList.h : header file
00008 //
00009
00011 // CPseudoList window
00012
00013 class CPseudoList : public CListCtrl
00014 {
00015 // Construction
00016 public:
00017     CPseudoList(int wid, int cmd);
00018
00019 // Attributes
00020 public:
00021
00022 // Operations
00023 public:
00024
00025 // Overrides
00026     // ClassWizard generated virtual function overrides
00027     //{{AFX_VIRTUAL(CPseudoList)
00028     //}}AFX_VIRTUAL
00029
00030 // Implementation
00031 public:
00032     virtual ~CPseudoList();
00033
00034     // Generated message map functions
00035 protected:
00036     int m_cmd, m_wid;
00037
00038     //{{AFX_MSG(CPseudoList)
00039     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00040     //}}AFX_MSG
00041
00042     DECLARE_MESSAGE_MAP()
00043 };
00044
00046
00047 //{{AFX_INSERT_LOCATION}}
00048 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00049
00050 #endif // !defined(AFX_PSEUDOLIST_H__49AF86B3_E6AB_4885_843C_1CE5AC8C4980__INCLUDED_)
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dib.c File Reference

rf/support/mfc/dib.c File Reference

#include <windows.h>
#include <windowsx.h>
#include "dib.h"

Include dependency graph for dib.c:

Include dependency graph

Go to the source code of this file.

Functions

WORD | DibNumColors (VOID *pv)
WORD | DibGetPaletteSize (VOID *pv)
VOID | DibCopyPalette (HBITMAP dst, HBITMAP src)
WORD | PaletteSize (VOID *pv)
VOID | WriteMapFileHeaderandConvertFromDwordAlignToPacked (HFILE fh, LPBITMAPFILEHEADER pbf)
HBITMAP | CreateDIB (DWORD dwWidth, DWORD dwHeight, WORD wBitCount, HPALETTE hPal)
HANDLE | ReadDIBFile (HANDLE hFile)
HBITMAP | LoadDIB (LPSTR lpFileName)
BOOL | SaveBmpFromDDB (HDC hDC, HBITMAP hBmp, PSTR pszFileName)
BOOL | SaveDIB (HBITMAP hDib, LPSTR lpFileName)
HBITMAP | CopyScreenToBitmap (HWND win, LPRECT lpRect)
HBITMAP | DIBToBitmap (hDIB) HBITMAP hDIB

Variables

WORD | biBits
HPALETTE | hPal

Function Documentation

HBITMAP CopyScreenToBitmap | ( | HWND | win,
 |  | LPRECT | lpRect
 | ) |

Definition at line 848 of file dib.c.

00849 {
00850     HDC         hScrDC, hMemDC;         /*  screen DC and memory DC */
00851     HBITMAP     hBitmap, hOldBitmap;    /*  handles to deice-dependent bitmaps */
00852     int         nX, nY, nX2, nY2;       /*  coordinates of rectangle to grab */
00853     int         nWidth, nHeight;        /*  DIB width and height */
00854     int         xScrn, yScrn;           /*  screen resolution */
00855     /*  check for an empty rectangle */
00856
00857     if (IsRectEmpty(lpRect))
00858       return NULL;
00859
00860     /*  create a DC for the screen and create */
00861     /*  a memory DC compatible to screen DC */
00862
00863     /* hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL); */
00864     /* hMemDC = CreateCompatibleDC(hScrDC); */
00865     hScrDC = GetDC(win);
00866     hMemDC = CreateCompatibleDC (hScrDC);
00867     /*  get points of rectangle to grab */
00868
00869     nX = lpRect->left;
00870     nY = lpRect->top;
00871     nX2 = lpRect->right;
00872     nY2 = lpRect->bottom;
00873
00874     /*  get screen resolution */
00875
00876     xScrn = GetDeviceCaps(hScrDC, HORZRES);
00877     yScrn = GetDeviceCaps(hScrDC, VERTRES);
00878
00879     /* make sure bitmap rectangle is visible */
00880
00881     if (nX < 0)
00882         nX = 0;
00883     if (nY < 0)
00884         nY = 0;
00885     if (nX2 > xScrn)
00886         nX2 = xScrn;
00887     if (nY2 > yScrn)
00888         nY2 = yScrn;
00889
00890     nWidth = nX2 - nX;
00891     nHeight = nY2 - nY;
00892
00893     // create a bitmap compatible with the screen DC
00894     hBitmap = CreateCompatibleBitmap(hScrDC, nWidth, nHeight);
00895
00896     // select new bitmap into memory DC
00897     hOldBitmap = SelectObject(hMemDC, hBitmap);
00898
00899     // bitblt screen DC to memory DC
00900     BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY);
00901
00902     // select old bitmap back into memory DC and get handle to
00903     // bitmap of the screen
00904
00905     hBitmap = SelectObject(hMemDC, hOldBitmap);
00906
00907     // clean up
00908
00909     ReleaseDC(win, hScrDC);
00910     DeleteDC(hMemDC);
00911
00912     // return handle to the bitmap
00913
00914     return hBitmap;
00915 }

HBITMAP CreateDIB | ( | DWORD | dwWidth,
 |  | DWORD | dwHeight,
 |  | WORD | wBitCount,
 |  | HPALETTE | hPal
 | ) |

Definition at line 201 of file dib.c.

00202 {
00203     BITMAPINFOHEADER    bi;             /*  bitmap header */
00204     LPBITMAPINFOHEADER  lpbi;           /*  pointer to BITMAPINFOHEADER */
00205     DWORD               dwLen;          /*  size of memory block */
00206     HBITMAP             hDIB;
00207     DWORD               dwBytesPerLine; /*  Number of bytes per scanline */
00208
00209
00210     /*  Make sure bits per pixel is valid */
00211
00212     if (wBitCount <= 1)
00213         wBitCount = 1;
00214     else if (wBitCount <= 4)
00215         wBitCount = 4;
00216     else if (wBitCount <= 8)
00217         wBitCount = 8;
00218     else if (wBitCount <= 24)
00219         wBitCount = 24;
00220     else
00221         wBitCount = 4;  /*  set default value to 4 if parameter is bogus */
00222
00223     /*  initialize BITMAPINFOHEADER */
00224
00225     bi.biSize = sizeof(BITMAPINFOHEADER);
00226     bi.biWidth = dwWidth;         /*  fill in width from parameter */
00227     bi.biHeight = dwHeight;       /*  fill in height from parameter */
00228     bi.biPlanes = 1;              /*  must be 1 */
00229     bi.biBitCount = wBitCount;    /*  from parameter */
00230     bi.biCompression = BI_RGB;
00231     bi.biSizeImage = 0;           /*  0's here mean "default" */
00232     bi.biXPelsPerMeter = 0;
00233     bi.biYPelsPerMeter = 0;
00234     bi.biClrUsed = 0;
00235     bi.biClrImportant = 0;
00236
00237     /*  calculate size of memory block required to store the DIB.  This */
00238     /*  block should be big enough to hold the BITMAPINFOHEADER, the color */
00239     /*  table, and the bits */
00240
00241     dwBytesPerLine = WIDTHBYTES(wBitCount * dwWidth);
00242     dwLen = bi.biSize + PaletteSize((LPSTR)&bi) + (dwBytesPerLine * dwHeight);
00243
00244     /*  alloc memory block to store our bitmap */
00245
00246     hDIB = GlobalAlloc(GHND, dwLen);
00247
00248     /*  major bummer if we couldn't get memory block */
00249
00250     if (!hDIB)
00251         return NULL;
00252
00253     /*  lock memory and get pointer to it */
00254
00255     lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
00256
00257     /*  use our bitmap info structure to fill in first part of */
00258     /*  our DIB with the BITMAPINFOHEADER */
00259
00260     *lpbi = bi;
00261
00262     /*
00263      * Copy the palette in the new created image
00264      */
00265     if (wBitCount == 8)
00266     {
00267         PALETTEENTRY pal[256];
00268         RGBQUAD *pRgb;
00269         int i;
00270
00271         GetPaletteEntries(hPal, 0, 256, pal);
00272
00273         pRgb = (RGBQUAD FAR *)((LPSTR)lpbi + (WORD)lpbi->biSize);
00274
00275         /* Fill in the palette entries from the DIB color table and
00276          * create a logical color palette.
00277          */
00278         for (i = 0; i < 256; i++)
00279         {
00280             pRgb[i].rgbRed = pal[i].peRed;
00281             pRgb[i].rgbGreen = pal[i].peGreen;
00282             pRgb[i].rgbBlue = pal[i].peBlue;
00283         }
00284     }
00285
00286     // Since we don't know what the colortable and bits should contain,
00287     // just leave these blank.  Unlock the DIB and return the HDIB.
00288
00289     GlobalUnlock(hDIB);
00290
00291     //return handle to the DIB
00292
00293     return hDIB;
00294 }

HBITMAP DIBToBitmap ( hDIB )

VOID DibCopyPalette | ( | HBITMAP | dst,
 |  | HBITMAP | src
 | ) |

Definition at line 99 of file dib.c.

00100 {
00101     LPBITMAPINFO src_header, dst_header;
00102     RGBQUAD *src_rgb, *dst_rgb;
00103     WORD colorMode;
00104
00105     src_header = (LPBITMAPINFO) GlobalLock((HGLOBAL)src);
00106     dst_header = (LPBITMAPINFO) GlobalLock((HGLOBAL)dst);
00107
00108     src_rgb = (RGBQUAD FAR *)((LPSTR)src_header + (WORD)src_header->bmiHeader.biSize);
00109     dst_rgb = (RGBQUAD FAR *)((LPSTR)dst_header + (WORD)dst_header->bmiHeader.biSize);
00110
00111     colorMode = DibGetPaletteSize(src_header);
00112     switch(colorMode)
00113     {
00114         case 4:
00115         case 8:
00116             memcpy(dst_rgb, src_rgb,PaletteSize(&src_header->bmiHeader));
00117             break;
00118     }
00119
00120     GlobalUnlock((HGLOBAL)src);
00121     GlobalUnlock((HGLOBAL)dst);
00122 }

WORD DibGetPaletteSize ( VOID * pv )

Definition at line 69 of file dib.c.

00070 {
00071     INT                 bits;
00072     LPBITMAPINFOHEADER  lpbi;
00073     LPBITMAPCOREHEADER  lpbc;
00074
00075     lpbi = ((LPBITMAPINFOHEADER)pv);
00076     lpbc = ((LPBITMAPCOREHEADER)pv);
00077
00078     /*  With the BITMAPINFO format headers, the size of the palette
00079      *  is in biClrUsed, whereas in the BITMAPCORE - style headers, it
00080      *  is dependent on the bits per pixel ( = 2 raised to the power of
00081      *  bits/pixel).
00082      */
00083     if (lpbi->biSize != sizeof(BITMAPCOREHEADER))
00084         bits = lpbi->biBitCount;
00085     else
00086         bits = lpbc->bcBitCount;
00087
00088     return bits;
00089 }

WORD DibNumColors ( VOID * pv )

Definition at line 24 of file dib.c.

00025 {
00026     INT                 bits;
00027     LPBITMAPINFOHEADER  lpbi;
00028     LPBITMAPCOREHEADER  lpbc;
00029
00030     lpbi = ((LPBITMAPINFOHEADER)pv);
00031     lpbc = ((LPBITMAPCOREHEADER)pv);
00032
00033     /*  With the BITMAPINFO format headers, the size of the palette
00034      *  is in biClrUsed, whereas in the BITMAPCORE - style headers, it
00035      *  is dependent on the bits per pixel ( = 2 raised to the power of
00036      *  bits/pixel).
00037      */
00038     if (lpbi->biSize != sizeof(BITMAPCOREHEADER)){
00039         if (lpbi->biClrUsed != 0)
00040             return (WORD)lpbi->biClrUsed;
00041         bits = lpbi->biBitCount;
00042     }
00043     else
00044         bits = lpbc->bcBitCount;
00045
00046     switch (bits){
00047         case 1:
00048                 return 2;
00049         case 4:
00050                 return 16;
00051         case 8:
00052                 return 256;
00053         default:
00054                 /* A 24 bitcount DIB has no color table */
00055                 return 0;
00056     }
00057 }

HBITMAP LoadDIB ( LPSTR lpFileName )

Definition at line 480 of file dib.c.

00481 {
00482     HBITMAP     hDIB;
00483     HANDLE      hFile;
00484
00485     if ((hFile = CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
00486             OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
00487             NULL)) != INVALID_HANDLE_VALUE)
00488     {
00489         hDIB = ReadDIBFile(hFile);
00490         CloseHandle(hFile);
00491         return hDIB;
00492     }
00493     else
00494         return NULL;
00495 }

WORD PaletteSize ( VOID * pv )

Definition at line 136 of file dib.c.

00137 {
00138     LPBITMAPINFOHEADER lpbi;
00139     WORD               NumColors;
00140
00141     lpbi      = (LPBITMAPINFOHEADER)pv;
00142     NumColors = DibNumColors(lpbi);
00143
00144     if (lpbi->biSize == sizeof(BITMAPCOREHEADER))
00145         return (WORD)(NumColors * sizeof(RGBTRIPLE));
00146     else
00147         return (WORD)(NumColors * sizeof(RGBQUAD));
00148 }

HANDLE ReadDIBFile ( HANDLE hFile )

Definition at line 324 of file dib.c.

00325 {
00326     BITMAPFILEHEADER    bmfHeader;
00327     DWORD               dwBitsSize;
00328     UINT                nNumColors;   /*  Number of colors in table */
00329     HANDLE              hDIB;
00330     HANDLE              hDIBtmp;      /*  Used for GlobalRealloc() //MPB */
00331     LPBITMAPINFOHEADER  lpbi;
00332     DWORD               offBits;
00333     DWORD               dwRead;
00334
00335     /*  get length of DIB in bytes for use when reading */
00336
00337     dwBitsSize = GetFileSize(hFile, NULL);
00338
00339     /*  Allocate memory for header & color table. We'll enlarge this */
00340     /*  memory as needed. */
00341
00342     hDIB = GlobalAlloc(GMEM_MOVEABLE, (DWORD)(sizeof(BITMAPINFOHEADER) +
00343             256 * sizeof(RGBQUAD)));
00344
00345     if (!hDIB)
00346         return NULL;
00347
00348     lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
00349
00350     if (!lpbi)
00351     {
00352         GlobalFree(hDIB);
00353         return NULL;
00354     }
00355
00356     /*  read the BITMAPFILEHEADER from our file */
00357
00358     if (!ReadFile(hFile, (LPSTR)&bmfHeader, sizeof (BITMAPFILEHEADER),
00359             &dwRead, NULL))
00360         goto ErrExit;
00361
00362     if (sizeof (BITMAPFILEHEADER) != dwRead)
00363         goto ErrExit;
00364
00365     if (bmfHeader.bfType != 0x4d42)  /*  'BM' */
00366         goto ErrExit;
00367
00368     /*  read the BITMAPINFOHEADER */
00369
00370     if (!ReadFile(hFile, (LPSTR)lpbi, sizeof(BITMAPINFOHEADER), &dwRead,
00371             NULL))
00372         goto ErrExit;
00373
00374     if (sizeof(BITMAPINFOHEADER) != dwRead)
00375         goto ErrExit;
00376
00377     /*  Check to see that it's a Windows DIB -- an OS/2 DIB would cause */
00378     /*  strange problems with the rest of the DIB API since the fields */
00379     /*  in the header are different and the color table entries are */
00380     /*  smaller. */
00381     /*  */
00382     /*  If it's not a Windows DIB (e.g. if biSize is wrong), return NULL. */
00383
00384     if (lpbi->biSize == sizeof(BITMAPCOREHEADER))
00385         goto ErrExit;
00386
00387     /*  Now determine the size of the color table and read it.  Since the */
00388     /*  bitmap bits are offset in the file by bfOffBits, we need to do some */
00389     /*  special processing here to make sure the bits directly follow */
00390     /*  the color table (because that's the format we are susposed to pass */
00391     /*  back) */
00392
00393     if (!(nNumColors = (UINT)lpbi->biClrUsed))
00394     {
00395         /*  no color table for 24-bit, default size otherwise */
00396
00397         if (lpbi->biBitCount != 24)
00398             nNumColors = 1 << lpbi->biBitCount; /*  standard size table */
00399     }
00400
00401     /*  fill in some default values if they are zero */
00402
00403     if (lpbi->biClrUsed == 0)
00404         lpbi->biClrUsed = nNumColors;
00405
00406     if (lpbi->biSizeImage == 0)
00407     {
00408         lpbi->biSizeImage = ((((lpbi->biWidth * (DWORD)lpbi->biBitCount) +
00409                 31) & ~31) >> 3) * lpbi->biHeight;
00410     }
00411
00412     /*  get a proper-sized buffer for header, color table and bits */
00413
00414     GlobalUnlock(hDIB);
00415     hDIBtmp = GlobalReAlloc(hDIB, lpbi->biSize + nNumColors *
00416             sizeof(RGBQUAD) + lpbi->biSizeImage, 0);
00417
00418     if (!hDIBtmp) /*  can't resize buffer for loading */
00419         goto ErrExitNoUnlock; /* MPB */
00420     else
00421         hDIB = hDIBtmp;
00422
00423     lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
00424
00425     /*  read the color table */
00426
00427     ReadFile (hFile, (LPSTR)(lpbi) + lpbi->biSize,
00428             nNumColors * sizeof(RGBQUAD), &dwRead, NULL);
00429
00430     /*  offset to the bits from start of DIB header */
00431
00432     offBits = lpbi->biSize + nNumColors * sizeof(RGBQUAD);
00433
00434     /*  If the bfOffBits field is non-zero, then the bits might *not* be */
00435     /*  directly following the color table in the file.  Use the value in */
00436     /*  bfOffBits to seek the bits. */
00437
00438     if (bmfHeader.bfOffBits != 0L)
00439         SetFilePointer(hFile, bmfHeader.bfOffBits, NULL, FILE_BEGIN);
00440
00441     if (ReadFile(hFile, (LPSTR)lpbi + offBits, lpbi->biSizeImage, &dwRead,
00442             NULL))
00443         goto OKExit;
00444
00445
00446 ErrExit:
00447     GlobalUnlock(hDIB);
00448
00449 ErrExitNoUnlock:
00450     GlobalFree(hDIB);
00451     return NULL;
00452
00453 OKExit:
00454     GlobalUnlock(hDIB);
00455     return hDIB;
00456 }

BOOL SaveBmpFromDDB | ( | HDC | hDC,
 |  | HBITMAP | hBmp,
 |  | PSTR | pszFileName
 | ) |

Definition at line 506 of file dib.c.

00507 {
00508     int         hFile;
00509     OFSTRUCT    ofReOpenBuff;
00510     HBITMAP     hTmpBmp, hBmpOld;
00511     BOOL        bSuccess;
00512     BITMAPFILEHEADER    bfh;
00513     PBITMAPINFO pbmi;
00514     PBYTE       pBits;
00515     BITMAPINFO  bmi;
00516     PBYTE pjTmp, pjTmpBmi;
00517     ULONG sizBMI;
00518
00519
00520     bSuccess = TRUE;
00521 #if 0
00522     if (ghPal) {
00523         SelectPalette(hDC, ghPal, FALSE);
00524         RealizePalette(hDC);
00525     }
00526 #endif
00527     if (!hBmp) {
00528         return FALSE;
00529     }
00530
00531     //
00532     // Let the graphics engine to retrieve the dimension of the bitmap for us
00533     // GetDIBits uses the size to determine if it's BITMAPCOREINFO or BITMAPINFO
00534     // if BitCount != 0, color table will be retrieved
00535     //
00536     bmi.bmiHeader.biSize = 0x28;              // GDI need this to work
00537     bmi.bmiHeader.biBitCount = 0;             // don't get the color table
00538     if ((GetDIBits(hDC, hBmp, 0, 0, (LPSTR)NULL, &bmi, DIB_RGB_COLORS)) == 0) {
00539         return FALSE;
00540     }
00541
00542     //
00543     // Now that we know the size of the image, alloc enough memory to retrieve
00544     // the actual bits
00545     //
00546     if ((pBits = (PBYTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
00547                 bmi.bmiHeader.biSizeImage)) == NULL) {
00548         return FALSE;
00549     }
00550
00551     //
00552     // Note: 24 bits per pixel has no color table.  So, we don't have to
00553     // allocate memory for retrieving that.  Otherwise, we do.
00554     //
00555     pbmi = &bmi;                                      // assume no color table
00556
00557     switch (bmi.bmiHeader.biBitCount) {
00558         case 24:                                      // has color table
00559             sizBMI = sizeof(BITMAPINFOHEADER);
00560             break;
00561         case 16:
00562         case 32:
00563             sizBMI = sizeof(BITMAPINFOHEADER)+sizeof(DWORD)*3;
00564             break;
00565         default:
00566             sizBMI = sizeof(BITMAPINFOHEADER)+sizeof(RGBQUAD)*(1<<bmi.bmiHeader.biBitCount);
00567             break;
00568
00569     }
00570
00571     //
00572     // Allocate memory for color table if it is not 24bpp...
00573     //
00574     if (sizBMI != sizeof(BITMAPINFOHEADER)) {
00575         ULONG       sizTmp;
00576         //
00577         // I need more memory for the color table
00578         //
00579         if ((pbmi = (PBITMAPINFO)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizBMI )) == NULL) {
00580             bSuccess = FALSE;
00581             goto ErrExit1;
00582         }
00583         //
00584         // Now that we've a bigger chunk of memory, let's copy the Bitmap
00585         // info header data over
00586         //
00587         pjTmp = (PBYTE)pbmi;
00588         pjTmpBmi = (PBYTE)&bmi;
00589         sizTmp = sizeof(BITMAPINFOHEADER);
00590
00591         while(sizTmp--)
00592         {
00593             *(((PBYTE)pjTmp)++) = *((pjTmpBmi)++);
00594         }
00595     }
00596
00597     //
00598     // Let's open the file and get ready for writing
00599     //
00600     if ((hFile = OpenFile(pszFileName, (LPOFSTRUCT)&ofReOpenBuff,
00601                  OF_CREATE | OF_WRITE)) == -1) {
00602         goto ErrExit2;
00603     }
00604
00605     //
00606     // But first, fill in the info for the BitmapFileHeader
00607     //
00608     bfh.bfType = 0x4D42;                            // 'BM'
00609     bfh.bfSize = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+sizBMI+
00610         pbmi->bmiHeader.biSizeImage;
00611     bfh.bfReserved1 =
00612     bfh.bfReserved2 = 0;
00613     bfh.bfOffBits = sizeof(BITMAPFILEHEADER)+sizBMI;
00614
00615     //
00616     // Write out the file header now
00617     //
00618     if (_lwrite(hFile, (LPSTR)&bfh, sizeof(BITMAPFILEHEADER)) == -1) {
00619         bSuccess = FALSE;
00620         goto ErrExit3;
00621     }
00622
00623     //
00624     // Bitmap can't be selected into a DC when calling GetDIBits
00625     // Assume that the hDC is the DC where the bitmap would have been selected
00626     // if indeed it has been selected
00627     //
00628     if (hTmpBmp = CreateCompatibleBitmap(hDC, pbmi->bmiHeader.biWidth, pbmi->bmiHeader.biHeight)) {
00629         hBmpOld = SelectObject(hDC, hTmpBmp);
00630         if ((GetDIBits(hDC, hBmp, 0, pbmi->bmiHeader.biHeight, (LPSTR)pBits, pbmi, DIB_RGB_COLORS))==0){
00631             bSuccess = FALSE;
00632             goto ErrExit4;
00633         }
00634     } else {
00635         bSuccess = FALSE;
00636         goto ErrExit3;
00637     }
00638
00639     //
00640     // Now write out the BitmapInfoHeader and color table, if any
00641     //
00642     if (_lwrite(hFile, (LPSTR)pbmi, sizBMI) == -1) {
00643         bSuccess = FALSE;
00644         goto ErrExit4;
00645     }
00646
00647     //
00648     // write the bits also
00649     //
00650     if (_lwrite(hFile, (LPSTR)pBits, pbmi->bmiHeader.biSizeImage) == -1) {
00651         bSuccess = FALSE;
00652         goto ErrExit4;
00653     }
00654
00655
00656 ErrExit4:
00657     SelectObject(hDC, hBmpOld);
00658     DeleteObject(hTmpBmp);
00659 ErrExit3:
00660     _lclose(hFile);
00661 ErrExit2:
00662     GlobalFree(pbmi);
00663 ErrExit1:
00664     GlobalFree(pBits);
00665     return bSuccess;
00666 }

BOOL SaveDIB | ( | HBITMAP | hDib,
 |  | LPSTR | lpFileName
 | ) |

Definition at line 702 of file dib.c.

00703 {
00704     BITMAPFILEHEADER    bmfHdr;     /*  Header for Bitmap file */
00705     LPBITMAPINFOHEADER  lpBI;       /*  Pointer to DIB info structure */
00706     HANDLE              fh;         /*  file handle for opened file */
00707     DWORD               dwDIBSize;
00708     DWORD               dwWritten;
00709
00710     if (!hDib)
00711         return FALSE;
00712
00713     fh = CreateFile(lpFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
00714             FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
00715
00716     if (fh == INVALID_HANDLE_VALUE)
00717         return FALSE;
00718
00719     /*  Get a pointer to the DIB memory, the first of which contains */
00720     /*  a BITMAPINFO structure */
00721
00722     lpBI = (LPBITMAPINFOHEADER)GlobalLock(hDib);
00723     if (!lpBI)
00724     {
00725         CloseHandle(fh);
00726         return FALSE;
00727     }
00728
00729     /*  Check to see if we're dealing with an OS/2 DIB.  If so, don't */
00730     /*  save it because our functions aren't written to deal with these */
00731     /*  DIBs. */
00732
00733     if (lpBI->biSize != sizeof(BITMAPINFOHEADER))
00734     {
00735         GlobalUnlock(hDib);
00736         CloseHandle(fh);
00737         return FALSE;
00738     }
00739
00740     /*  Fill in the fields of the file header */
00741
00742     /*  Fill in file type (first 2 bytes must be "BM" for a bitmap) */
00743
00744     bmfHdr.bfType = DIB_HEADER_MARKER;  /*  "BM" */
00745
00746     /*  Calculating the size of the DIB is a bit tricky (if we want to */
00747     /*  do it right).  The easiest way to do this is to call GlobalSize() */
00748     /*  on our global handle, but since the size of our global memory may have */
00749     /*  been padded a few bytes, we may end up writing out a few too */
00750     /*  many bytes to the file (which may cause problems with some apps, */
00751     /*  like HC 3.0). */
00752     /*  */
00753     /*  So, instead let's calculate the size manually. */
00754     /*  */
00755     /*  To do this, find size of header plus size of color table.  Since the */
00756     /*  first DWORD in both BITMAPINFOHEADER and BITMAPCOREHEADER conains */
00757     /*  the size of the structure, let's use this. */
00758
00759     /*  Partial Calculation */
00760
00761     dwDIBSize = *(LPDWORD)lpBI + PaletteSize((LPSTR)lpBI);
00762
00763     /*  Now calculate the size of the image */
00764
00765     /*  It's an RLE bitmap, we can't calculate size, so trust the biSizeImage */
00766     /*  field */
00767
00768     if ((lpBI->biCompression == BI_RLE8) || (lpBI->biCompression == BI_RLE4))
00769         dwDIBSize += lpBI->biSizeImage;
00770     else
00771     {
00772         DWORD dwBmBitsSize;  /*  Size of Bitmap Bits only */
00773
00774         /*  It's not RLE, so size is Width (DWORD aligned) * Height */
00775
00776         dwBmBitsSize = WIDTHBYTES((lpBI->biWidth)*((DWORD)lpBI->biBitCount)) *
00777                 lpBI->biHeight;
00778
00779         dwDIBSize += dwBmBitsSize;
00780
00781         /*  Now, since we have calculated the correct size, why don't we */
00782         /*  fill in the biSizeImage field (this will fix any .BMP files which  */
00783         /*  have this field incorrect). */
00784
00785         lpBI->biSizeImage = dwBmBitsSize;
00786     }
00787
00788
00789     /*  Calculate the file size by adding the DIB size to sizeof(BITMAPFILEHEADER) */
00790
00791     bmfHdr.bfSize = dwDIBSize + sizeof(BITMAPFILEHEADER);
00792     bmfHdr.bfReserved1 = 0;
00793     bmfHdr.bfReserved2 = 0;
00794
00795     /*  Now, calculate the offset the actual bitmap bits will be in */
00796     /*  the file -- It's the Bitmap file header plus the DIB header, */
00797     /*  plus the size of the color table. */
00798
00799     bmfHdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + lpBI->biSize +
00800             PaletteSize((LPSTR)lpBI);
00801
00802     /*  Write the file header */
00803
00804     WriteFile(fh, (LPSTR)&bmfHdr, sizeof(BITMAPFILEHEADER), &dwWritten, NULL);
00805
00806     /*  Write the DIB header and the bits -- use local version of */
00807     /*  MyWrite, so we can write more than 32767 bytes of data */
00808
00809     WriteFile(fh, (LPSTR)lpBI, dwDIBSize, &dwWritten, NULL);
00810
00811     GlobalUnlock(hDib);
00812     CloseHandle(fh);
00813
00814     if (dwWritten == 0)
00815         return FALSE; /*  oops, something happened in the write */
00816     else
00817         return TRUE; /*  Success code */
00818 }

VOID WriteMapFileHeaderandConvertFromDwordAlignToPacked | ( | HFILE | fh,
 |  | LPBITMAPFILEHEADER | pbf
 | ) |

Definition at line 160 of file dib.c.

00161 {
00162
00163         /* write bfType*/
00164     _lwrite(fh, (LPSTR)&pbf->bfType, (UINT)sizeof (WORD));
00165         /* now pass over extra word, and only write next 3 DWORDS!*/
00166         _lwrite(fh, (LPSTR)&pbf->bfSize, sizeof(DWORD) * 3);
00167 }

Variable Documentation

WORD biBits

Definition at line 964 of file dib.c.

HPALETTE hPal

Definition at line 965 of file dib.c.

Generated on Sun Oct 21 12:44:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dib.h File Reference

rf/support/mfc/dib.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | DIB_HEADER_MARKER ((WORD) ('M' << 8) | 'B')
#define | WIDTHBYTES(i) ((i+31)/32*4)
#define | WIDTHBYTES16(i) ((i+15)/16*2)
#define | WIDTHBYTES8(i) ((i+7)/8)
#define | BM_ALLOC(nb, size) GlobalAllocPtr( GHND, (nb)*(size) )
#define | BM_FREE(ptr) GlobalFreePtr(ptr)
#define | BFT_BITMAP 0x4d42
#define | SIZEOF_BITMAPFILEHEADER_PACKED

Functions

VOID | DibCopyPalette (HBITMAP, HBITMAP)
WORD | PaletteSize (VOID *)
WORD | DibNumColors (VOID *)
WORD | DibGetPaletteSize (VOID *)
VOID | WriteMapFileHeaderandConvertFromDwordAlignToPacked (HFILE, LPBITMAPFILEHEADER)
HANDLE | ReadDIBFile (HANDLE)
HANDLE | ReadDIBRsrc (HINSTANCE, HRSRC)
HBITMAP | LoadDIB (LPSTR)
BOOL | SaveDIB (HBITMAP, LPSTR)
HBITMAP | CreateDIB (DWORD, DWORD, WORD, HPALETTE)
HBITMAP | CopyScreenToBitmap (HWND, LPRECT)
HBITMAP DIBToBitmap (HBITMAP)
HANDLE | DDBtoDIB (HBITMAP, WORD, HPALETTE)
BOOL | SaveBmpFromDDB (HDC, HBITMAP, PSTR)

Define Documentation

#define BFT_BITMAP 0x4d42

Definition at line 18 of file dib.h.

#define BM_ALLOC | ( | nb,
 |  | size | ) | GlobalAllocPtr( GHND, (nb)*(size) )

Definition at line 15 of file dib.h.

#define BM_FREE ( ptr ) GlobalFreePtr(ptr)

Definition at line 16 of file dib.h.

#define DIB_HEADER_MARKER ((WORD) ('M' << 8) | 'B')

Definition at line 4 of file dib.h.

#define SIZEOF_BITMAPFILEHEADER_PACKED

Value:

(   \
    sizeof(WORD) +          \
    sizeof(DWORD) +         \
    sizeof(WORD) +          \
    sizeof(WORD) +          \
    sizeof(DWORD))

Definition at line 24 of file dib.h.

#define WIDTHBYTES ( i ) ((i+31)/32*4)

Definition at line 6 of file dib.h.

Referenced by width().

#define WIDTHBYTES16 ( i ) ((i+15)/16*2)

Definition at line 7 of file dib.h.

#define WIDTHBYTES8 ( i ) ((i+7)/8)

Definition at line 8 of file dib.h.

Referenced by width().

Function Documentation

HBITMAP CopyScreenToBitmap | ( | HWND | win,
 |  | LPRECT | lpRect
 | ) |

Definition at line 848 of file dib.c.

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED().

00849 {
00850     HDC         hScrDC, hMemDC;         /*  screen DC and memory DC */
00851     HBITMAP     hBitmap, hOldBitmap;    /*  handles to deice-dependent bitmaps */
00852     int         nX, nY, nX2, nY2;       /*  coordinates of rectangle to grab */
00853     int         nWidth, nHeight;        /*  DIB width and height */
00854     int         xScrn, yScrn;           /*  screen resolution */
00855     /*  check for an empty rectangle */
00856
00857     if (IsRectEmpty(lpRect))
00858       return NULL;
00859
00860     /*  create a DC for the screen and create */
00861     /*  a memory DC compatible to screen DC */
00862
00863     /* hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL); */
00864     /* hMemDC = CreateCompatibleDC(hScrDC); */
00865     hScrDC = GetDC(win);
00866     hMemDC = CreateCompatibleDC (hScrDC);
00867     /*  get points of rectangle to grab */
00868
00869     nX = lpRect->left;
00870     nY = lpRect->top;
00871     nX2 = lpRect->right;
00872     nY2 = lpRect->bottom;
00873
00874     /*  get screen resolution */
00875
00876     xScrn = GetDeviceCaps(hScrDC, HORZRES);
00877     yScrn = GetDeviceCaps(hScrDC, VERTRES);
00878
00879     /* make sure bitmap rectangle is visible */
00880
00881     if (nX < 0)
00882         nX = 0;
00883     if (nY < 0)
00884         nY = 0;
00885     if (nX2 > xScrn)
00886         nX2 = xScrn;
00887     if (nY2 > yScrn)
00888         nY2 = yScrn;
00889
00890     nWidth = nX2 - nX;
00891     nHeight = nY2 - nY;
00892
00893     // create a bitmap compatible with the screen DC
00894     hBitmap = CreateCompatibleBitmap(hScrDC, nWidth, nHeight);
00895
00896     // select new bitmap into memory DC
00897     hOldBitmap = SelectObject(hMemDC, hBitmap);
00898
00899     // bitblt screen DC to memory DC
00900     BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY);
00901
00902     // select old bitmap back into memory DC and get handle to
00903     // bitmap of the screen
00904
00905     hBitmap = SelectObject(hMemDC, hOldBitmap);
00906
00907     // clean up
00908
00909     ReleaseDC(win, hScrDC);
00910     DeleteDC(hMemDC);
00911
00912     // return handle to the bitmap
00913
00914     return hBitmap;
00915 }

HBITMAP CreateDIB | ( | DWORD | dwWidth,
 |  | DWORD | dwHeight,
 |  | WORD | wBitCount,
 |  | HPALETTE | hPal
 | ) |

Definition at line 201 of file dib.c.

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED(), and width().

00202 {
00203     BITMAPINFOHEADER    bi;             /*  bitmap header */
00204     LPBITMAPINFOHEADER  lpbi;           /*  pointer to BITMAPINFOHEADER */
00205     DWORD               dwLen;          /*  size of memory block */
00206     HBITMAP             hDIB;
00207     DWORD               dwBytesPerLine; /*  Number of bytes per scanline */
00208
00209
00210     /*  Make sure bits per pixel is valid */
00211
00212     if (wBitCount <= 1)
00213         wBitCount = 1;
00214     else if (wBitCount <= 4)
00215         wBitCount = 4;
00216     else if (wBitCount <= 8)
00217         wBitCount = 8;
00218     else if (wBitCount <= 24)
00219         wBitCount = 24;
00220     else
00221         wBitCount = 4;  /*  set default value to 4 if parameter is bogus */
00222
00223     /*  initialize BITMAPINFOHEADER */
00224
00225     bi.biSize = sizeof(BITMAPINFOHEADER);
00226     bi.biWidth = dwWidth;         /*  fill in width from parameter */
00227     bi.biHeight = dwHeight;       /*  fill in height from parameter */
00228     bi.biPlanes = 1;              /*  must be 1 */
00229     bi.biBitCount = wBitCount;    /*  from parameter */
00230     bi.biCompression = BI_RGB;
00231     bi.biSizeImage = 0;           /*  0's here mean "default" */
00232     bi.biXPelsPerMeter = 0;
00233     bi.biYPelsPerMeter = 0;
00234     bi.biClrUsed = 0;
00235     bi.biClrImportant = 0;
00236
00237     /*  calculate size of memory block required to store the DIB.  This */
00238     /*  block should be big enough to hold the BITMAPINFOHEADER, the color */
00239     /*  table, and the bits */
00240
00241     dwBytesPerLine = WIDTHBYTES(wBitCount * dwWidth);
00242     dwLen = bi.biSize + PaletteSize((LPSTR)&bi) + (dwBytesPerLine * dwHeight);
00243
00244     /*  alloc memory block to store our bitmap */
00245
00246     hDIB = GlobalAlloc(GHND, dwLen);
00247
00248     /*  major bummer if we couldn't get memory block */
00249
00250     if (!hDIB)
00251         return NULL;
00252
00253     /*  lock memory and get pointer to it */
00254
00255     lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
00256
00257     /*  use our bitmap info structure to fill in first part of */
00258     /*  our DIB with the BITMAPINFOHEADER */
00259
00260     *lpbi = bi;
00261
00262     /*
00263      * Copy the palette in the new created image
00264      */
00265     if (wBitCount == 8)
00266     {
00267         PALETTEENTRY pal[256];
00268         RGBQUAD *pRgb;
00269         int i;
00270
00271         GetPaletteEntries(hPal, 0, 256, pal);
00272
00273         pRgb = (RGBQUAD FAR *)((LPSTR)lpbi + (WORD)lpbi->biSize);
00274
00275         /* Fill in the palette entries from the DIB color table and
00276          * create a logical color palette.
00277          */
00278         for (i = 0; i < 256; i++)
00279         {
00280             pRgb[i].rgbRed = pal[i].peRed;
00281             pRgb[i].rgbGreen = pal[i].peGreen;
00282             pRgb[i].rgbBlue = pal[i].peBlue;
00283         }
00284     }
00285
00286     // Since we don't know what the colortable and bits should contain,
00287     // just leave these blank.  Unlock the DIB and return the HDIB.
00288
00289     GlobalUnlock(hDIB);
00290
00291     //return handle to the DIB
00292
00293     return hDIB;
00294 }

HANDLE DDBtoDIB | ( | HBITMAP | ,
 |  | WORD | ,
 |  | HPALETTE |
 | ) |

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED().

HBITMAP DIBToBitmap ( HBITMAP )

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED(), and width().

VOID DibCopyPalette | ( | HBITMAP | dst,
 |  | HBITMAP | src
 | ) |

Definition at line 99 of file dib.c.

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED().

00100 {
00101     LPBITMAPINFO src_header, dst_header;
00102     RGBQUAD *src_rgb, *dst_rgb;
00103     WORD colorMode;
00104
00105     src_header = (LPBITMAPINFO) GlobalLock((HGLOBAL)src);
00106     dst_header = (LPBITMAPINFO) GlobalLock((HGLOBAL)dst);
00107
00108     src_rgb = (RGBQUAD FAR *)((LPSTR)src_header + (WORD)src_header->bmiHeader.biSize);
00109     dst_rgb = (RGBQUAD FAR *)((LPSTR)dst_header + (WORD)dst_header->bmiHeader.biSize);
00110
00111     colorMode = DibGetPaletteSize(src_header);
00112     switch(colorMode)
00113     {
00114         case 4:
00115         case 8:
00116             memcpy(dst_rgb, src_rgb,PaletteSize(&src_header->bmiHeader));
00117             break;
00118     }
00119
00120     GlobalUnlock((HGLOBAL)src);
00121     GlobalUnlock((HGLOBAL)dst);
00122 }

WORD DibGetPaletteSize ( VOID * pv )

Definition at line 69 of file dib.c.

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED().

00070 {
00071     INT                 bits;
00072     LPBITMAPINFOHEADER  lpbi;
00073     LPBITMAPCOREHEADER  lpbc;
00074
00075     lpbi = ((LPBITMAPINFOHEADER)pv);
00076     lpbc = ((LPBITMAPCOREHEADER)pv);
00077
00078     /*  With the BITMAPINFO format headers, the size of the palette
00079      *  is in biClrUsed, whereas in the BITMAPCORE - style headers, it
00080      *  is dependent on the bits per pixel ( = 2 raised to the power of
00081      *  bits/pixel).
00082      */
00083     if (lpbi->biSize != sizeof(BITMAPCOREHEADER))
00084         bits = lpbi->biBitCount;
00085     else
00086         bits = lpbc->bcBitCount;
00087
00088     return bits;
00089 }

WORD DibNumColors ( VOID * pv )

Definition at line 24 of file dib.c.

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED().

00025 {
00026     INT                 bits;
00027     LPBITMAPINFOHEADER  lpbi;
00028     LPBITMAPCOREHEADER  lpbc;
00029
00030     lpbi = ((LPBITMAPINFOHEADER)pv);
00031     lpbc = ((LPBITMAPCOREHEADER)pv);
00032
00033     /*  With the BITMAPINFO format headers, the size of the palette
00034      *  is in biClrUsed, whereas in the BITMAPCORE - style headers, it
00035      *  is dependent on the bits per pixel ( = 2 raised to the power of
00036      *  bits/pixel).
00037      */
00038     if (lpbi->biSize != sizeof(BITMAPCOREHEADER)){
00039         if (lpbi->biClrUsed != 0)
00040             return (WORD)lpbi->biClrUsed;
00041         bits = lpbi->biBitCount;
00042     }
00043     else
00044         bits = lpbc->bcBitCount;
00045
00046     switch (bits){
00047         case 1:
00048                 return 2;
00049         case 4:
00050                 return 16;
00051         case 8:
00052                 return 256;
00053         default:
00054                 /* A 24 bitcount DIB has no color table */
00055                 return 0;
00056     }
00057 }

HBITMAP LoadDIB ( LPSTR lpFileName )

Definition at line 480 of file dib.c.

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED().

00481 {
00482     HBITMAP     hDIB;
00483     HANDLE      hFile;
00484
00485     if ((hFile = CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
00486             OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
00487             NULL)) != INVALID_HANDLE_VALUE)
00488     {
00489         hDIB = ReadDIBFile(hFile);
00490         CloseHandle(hFile);
00491         return hDIB;
00492     }
00493     else
00494         return NULL;
00495 }

WORD PaletteSize ( VOID * pv )

Definition at line 136 of file dib.c.

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED(), and width().

00137 {
00138     LPBITMAPINFOHEADER lpbi;
00139     WORD               NumColors;
00140
00141     lpbi      = (LPBITMAPINFOHEADER)pv;
00142     NumColors = DibNumColors(lpbi);
00143
00144     if (lpbi->biSize == sizeof(BITMAPCOREHEADER))
00145         return (WORD)(NumColors * sizeof(RGBTRIPLE));
00146     else
00147         return (WORD)(NumColors * sizeof(RGBQUAD));
00148 }

HANDLE ReadDIBFile ( HANDLE hFile )

Definition at line 324 of file dib.c.

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED().

00325 {
00326     BITMAPFILEHEADER    bmfHeader;
00327     DWORD               dwBitsSize;
00328     UINT                nNumColors;   /*  Number of colors in table */
00329     HANDLE              hDIB;
00330     HANDLE              hDIBtmp;      /*  Used for GlobalRealloc() //MPB */
00331     LPBITMAPINFOHEADER  lpbi;
00332     DWORD               offBits;
00333     DWORD               dwRead;
00334
00335     /*  get length of DIB in bytes for use when reading */
00336
00337     dwBitsSize = GetFileSize(hFile, NULL);
00338
00339     /*  Allocate memory for header & color table. We'll enlarge this */
00340     /*  memory as needed. */
00341
00342     hDIB = GlobalAlloc(GMEM_MOVEABLE, (DWORD)(sizeof(BITMAPINFOHEADER) +
00343             256 * sizeof(RGBQUAD)));
00344
00345     if (!hDIB)
00346         return NULL;
00347
00348     lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
00349
00350     if (!lpbi)
00351     {
00352         GlobalFree(hDIB);
00353         return NULL;
00354     }
00355
00356     /*  read the BITMAPFILEHEADER from our file */
00357
00358     if (!ReadFile(hFile, (LPSTR)&bmfHeader, sizeof (BITMAPFILEHEADER),
00359             &dwRead, NULL))
00360         goto ErrExit;
00361
00362     if (sizeof (BITMAPFILEHEADER) != dwRead)
00363         goto ErrExit;
00364
00365     if (bmfHeader.bfType != 0x4d42)  /*  'BM' */
00366         goto ErrExit;
00367
00368     /*  read the BITMAPINFOHEADER */
00369
00370     if (!ReadFile(hFile, (LPSTR)lpbi, sizeof(BITMAPINFOHEADER), &dwRead,
00371             NULL))
00372         goto ErrExit;
00373
00374     if (sizeof(BITMAPINFOHEADER) != dwRead)
00375         goto ErrExit;
00376
00377     /*  Check to see that it's a Windows DIB -- an OS/2 DIB would cause */
00378     /*  strange problems with the rest of the DIB API since the fields */
00379     /*  in the header are different and the color table entries are */
00380     /*  smaller. */
00381     /*  */
00382     /*  If it's not a Windows DIB (e.g. if biSize is wrong), return NULL. */
00383
00384     if (lpbi->biSize == sizeof(BITMAPCOREHEADER))
00385         goto ErrExit;
00386
00387     /*  Now determine the size of the color table and read it.  Since the */
00388     /*  bitmap bits are offset in the file by bfOffBits, we need to do some */
00389     /*  special processing here to make sure the bits directly follow */
00390     /*  the color table (because that's the format we are susposed to pass */
00391     /*  back) */
00392
00393     if (!(nNumColors = (UINT)lpbi->biClrUsed))
00394     {
00395         /*  no color table for 24-bit, default size otherwise */
00396
00397         if (lpbi->biBitCount != 24)
00398             nNumColors = 1 << lpbi->biBitCount; /*  standard size table */
00399     }
00400
00401     /*  fill in some default values if they are zero */
00402
00403     if (lpbi->biClrUsed == 0)
00404         lpbi->biClrUsed = nNumColors;
00405
00406     if (lpbi->biSizeImage == 0)
00407     {
00408         lpbi->biSizeImage = ((((lpbi->biWidth * (DWORD)lpbi->biBitCount) +
00409                 31) & ~31) >> 3) * lpbi->biHeight;
00410     }
00411
00412     /*  get a proper-sized buffer for header, color table and bits */
00413
00414     GlobalUnlock(hDIB);
00415     hDIBtmp = GlobalReAlloc(hDIB, lpbi->biSize + nNumColors *
00416             sizeof(RGBQUAD) + lpbi->biSizeImage, 0);
00417
00418     if (!hDIBtmp) /*  can't resize buffer for loading */
00419         goto ErrExitNoUnlock; /* MPB */
00420     else
00421         hDIB = hDIBtmp;
00422
00423     lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
00424
00425     /*  read the color table */
00426
00427     ReadFile (hFile, (LPSTR)(lpbi) + lpbi->biSize,
00428             nNumColors * sizeof(RGBQUAD), &dwRead, NULL);
00429
00430     /*  offset to the bits from start of DIB header */
00431
00432     offBits = lpbi->biSize + nNumColors * sizeof(RGBQUAD);
00433
00434     /*  If the bfOffBits field is non-zero, then the bits might *not* be */
00435     /*  directly following the color table in the file.  Use the value in */
00436     /*  bfOffBits to seek the bits. */
00437
00438     if (bmfHeader.bfOffBits != 0L)
00439         SetFilePointer(hFile, bmfHeader.bfOffBits, NULL, FILE_BEGIN);
00440
00441     if (ReadFile(hFile, (LPSTR)lpbi + offBits, lpbi->biSizeImage, &dwRead,
00442             NULL))
00443         goto OKExit;
00444
00445
00446 ErrExit:
00447     GlobalUnlock(hDIB);
00448
00449 ErrExitNoUnlock:
00450     GlobalFree(hDIB);
00451     return NULL;
00452
00453 OKExit:
00454     GlobalUnlock(hDIB);
00455     return hDIB;
00456 }

HANDLE ReadDIBRsrc | ( | HINSTANCE | ,
 |  | HRSRC |
 | ) |

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED().

BOOL SaveBmpFromDDB | ( | HDC | hDC,
 |  | HBITMAP | hBmp,
 |  | PSTR | pszFileName
 | ) |

Definition at line 506 of file dib.c.

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED().

00507 {
00508     int         hFile;
00509     OFSTRUCT    ofReOpenBuff;
00510     HBITMAP     hTmpBmp, hBmpOld;
00511     BOOL        bSuccess;
00512     BITMAPFILEHEADER    bfh;
00513     PBITMAPINFO pbmi;
00514     PBYTE       pBits;
00515     BITMAPINFO  bmi;
00516     PBYTE pjTmp, pjTmpBmi;
00517     ULONG sizBMI;
00518
00519
00520     bSuccess = TRUE;
00521 #if 0
00522     if (ghPal) {
00523         SelectPalette(hDC, ghPal, FALSE);
00524         RealizePalette(hDC);
00525     }
00526 #endif
00527     if (!hBmp) {
00528         return FALSE;
00529     }
00530
00531     //
00532     // Let the graphics engine to retrieve the dimension of the bitmap for us
00533     // GetDIBits uses the size to determine if it's BITMAPCOREINFO or BITMAPINFO
00534     // if BitCount != 0, color table will be retrieved
00535     //
00536     bmi.bmiHeader.biSize = 0x28;              // GDI need this to work
00537     bmi.bmiHeader.biBitCount = 0;             // don't get the color table
00538     if ((GetDIBits(hDC, hBmp, 0, 0, (LPSTR)NULL, &bmi, DIB_RGB_COLORS)) == 0) {
00539         return FALSE;
00540     }
00541
00542     //
00543     // Now that we know the size of the image, alloc enough memory to retrieve
00544     // the actual bits
00545     //
00546     if ((pBits = (PBYTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
00547                 bmi.bmiHeader.biSizeImage)) == NULL) {
00548         return FALSE;
00549     }
00550
00551     //
00552     // Note: 24 bits per pixel has no color table.  So, we don't have to
00553     // allocate memory for retrieving that.  Otherwise, we do.
00554     //
00555     pbmi = &bmi;                                      // assume no color table
00556
00557     switch (bmi.bmiHeader.biBitCount) {
00558         case 24:                                      // has color table
00559             sizBMI = sizeof(BITMAPINFOHEADER);
00560             break;
00561         case 16:
00562         case 32:
00563             sizBMI = sizeof(BITMAPINFOHEADER)+sizeof(DWORD)*3;
00564             break;
00565         default:
00566             sizBMI = sizeof(BITMAPINFOHEADER)+sizeof(RGBQUAD)*(1<<bmi.bmiHeader.biBitCount);
00567             break;
00568
00569     }
00570
00571     //
00572     // Allocate memory for color table if it is not 24bpp...
00573     //
00574     if (sizBMI != sizeof(BITMAPINFOHEADER)) {
00575         ULONG       sizTmp;
00576         //
00577         // I need more memory for the color table
00578         //
00579         if ((pbmi = (PBITMAPINFO)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, sizBMI )) == NULL) {
00580             bSuccess = FALSE;
00581             goto ErrExit1;
00582         }
00583         //
00584         // Now that we've a bigger chunk of memory, let's copy the Bitmap
00585         // info header data over
00586         //
00587         pjTmp = (PBYTE)pbmi;
00588         pjTmpBmi = (PBYTE)&bmi;
00589         sizTmp = sizeof(BITMAPINFOHEADER);
00590
00591         while(sizTmp--)
00592         {
00593             *(((PBYTE)pjTmp)++) = *((pjTmpBmi)++);
00594         }
00595     }
00596
00597     //
00598     // Let's open the file and get ready for writing
00599     //
00600     if ((hFile = OpenFile(pszFileName, (LPOFSTRUCT)&ofReOpenBuff,
00601                  OF_CREATE | OF_WRITE)) == -1) {
00602         goto ErrExit2;
00603     }
00604
00605     //
00606     // But first, fill in the info for the BitmapFileHeader
00607     //
00608     bfh.bfType = 0x4D42;                            // 'BM'
00609     bfh.bfSize = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+sizBMI+
00610         pbmi->bmiHeader.biSizeImage;
00611     bfh.bfReserved1 =
00612     bfh.bfReserved2 = 0;
00613     bfh.bfOffBits = sizeof(BITMAPFILEHEADER)+sizBMI;
00614
00615     //
00616     // Write out the file header now
00617     //
00618     if (_lwrite(hFile, (LPSTR)&bfh, sizeof(BITMAPFILEHEADER)) == -1) {
00619         bSuccess = FALSE;
00620         goto ErrExit3;
00621     }
00622
00623     //
00624     // Bitmap can't be selected into a DC when calling GetDIBits
00625     // Assume that the hDC is the DC where the bitmap would have been selected
00626     // if indeed it has been selected
00627     //
00628     if (hTmpBmp = CreateCompatibleBitmap(hDC, pbmi->bmiHeader.biWidth, pbmi->bmiHeader.biHeight)) {
00629         hBmpOld = SelectObject(hDC, hTmpBmp);
00630         if ((GetDIBits(hDC, hBmp, 0, pbmi->bmiHeader.biHeight, (LPSTR)pBits, pbmi, DIB_RGB_COLORS))==0){
00631             bSuccess = FALSE;
00632             goto ErrExit4;
00633         }
00634     } else {
00635         bSuccess = FALSE;
00636         goto ErrExit3;
00637     }
00638
00639     //
00640     // Now write out the BitmapInfoHeader and color table, if any
00641     //
00642     if (_lwrite(hFile, (LPSTR)pbmi, sizBMI) == -1) {
00643         bSuccess = FALSE;
00644         goto ErrExit4;
00645     }
00646
00647     //
00648     // write the bits also
00649     //
00650     if (_lwrite(hFile, (LPSTR)pBits, pbmi->bmiHeader.biSizeImage) == -1) {
00651         bSuccess = FALSE;
00652         goto ErrExit4;
00653     }
00654
00655
00656 ErrExit4:
00657     SelectObject(hDC, hBmpOld);
00658     DeleteObject(hTmpBmp);
00659 ErrExit3:
00660     _lclose(hFile);
00661 ErrExit2:
00662     GlobalFree(pbmi);
00663 ErrExit1:
00664     GlobalFree(pBits);
00665     return bSuccess;
00666 }

BOOL SaveDIB | ( | HBITMAP | hDib,
 |  | LPSTR | lpFileName
 | ) |

Definition at line 702 of file dib.c.

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED().

00703 {
00704     BITMAPFILEHEADER    bmfHdr;     /*  Header for Bitmap file */
00705     LPBITMAPINFOHEADER  lpBI;       /*  Pointer to DIB info structure */
00706     HANDLE              fh;         /*  file handle for opened file */
00707     DWORD               dwDIBSize;
00708     DWORD               dwWritten;
00709
00710     if (!hDib)
00711         return FALSE;
00712
00713     fh = CreateFile(lpFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
00714             FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
00715
00716     if (fh == INVALID_HANDLE_VALUE)
00717         return FALSE;
00718
00719     /*  Get a pointer to the DIB memory, the first of which contains */
00720     /*  a BITMAPINFO structure */
00721
00722     lpBI = (LPBITMAPINFOHEADER)GlobalLock(hDib);
00723     if (!lpBI)
00724     {
00725         CloseHandle(fh);
00726         return FALSE;
00727     }
00728
00729     /*  Check to see if we're dealing with an OS/2 DIB.  If so, don't */
00730     /*  save it because our functions aren't written to deal with these */
00731     /*  DIBs. */
00732
00733     if (lpBI->biSize != sizeof(BITMAPINFOHEADER))
00734     {
00735         GlobalUnlock(hDib);
00736         CloseHandle(fh);
00737         return FALSE;
00738     }
00739
00740     /*  Fill in the fields of the file header */
00741
00742     /*  Fill in file type (first 2 bytes must be "BM" for a bitmap) */
00743
00744     bmfHdr.bfType = DIB_HEADER_MARKER;  /*  "BM" */
00745
00746     /*  Calculating the size of the DIB is a bit tricky (if we want to */
00747     /*  do it right).  The easiest way to do this is to call GlobalSize() */
00748     /*  on our global handle, but since the size of our global memory may have */
00749     /*  been padded a few bytes, we may end up writing out a few too */
00750     /*  many bytes to the file (which may cause problems with some apps, */
00751     /*  like HC 3.0). */
00752     /*  */
00753     /*  So, instead let's calculate the size manually. */
00754     /*  */
00755     /*  To do this, find size of header plus size of color table.  Since the */
00756     /*  first DWORD in both BITMAPINFOHEADER and BITMAPCOREHEADER conains */
00757     /*  the size of the structure, let's use this. */
00758
00759     /*  Partial Calculation */
00760
00761     dwDIBSize = *(LPDWORD)lpBI + PaletteSize((LPSTR)lpBI);
00762
00763     /*  Now calculate the size of the image */
00764
00765     /*  It's an RLE bitmap, we can't calculate size, so trust the biSizeImage */
00766     /*  field */
00767
00768     if ((lpBI->biCompression == BI_RLE8) || (lpBI->biCompression == BI_RLE4))
00769         dwDIBSize += lpBI->biSizeImage;
00770     else
00771     {
00772         DWORD dwBmBitsSize;  /*  Size of Bitmap Bits only */
00773
00774         /*  It's not RLE, so size is Width (DWORD aligned) * Height */
00775
00776         dwBmBitsSize = WIDTHBYTES((lpBI->biWidth)*((DWORD)lpBI->biBitCount)) *
00777                 lpBI->biHeight;
00778
00779         dwDIBSize += dwBmBitsSize;
00780
00781         /*  Now, since we have calculated the correct size, why don't we */
00782         /*  fill in the biSizeImage field (this will fix any .BMP files which  */
00783         /*  have this field incorrect). */
00784
00785         lpBI->biSizeImage = dwBmBitsSize;
00786     }
00787
00788
00789     /*  Calculate the file size by adding the DIB size to sizeof(BITMAPFILEHEADER) */
00790
00791     bmfHdr.bfSize = dwDIBSize + sizeof(BITMAPFILEHEADER);
00792     bmfHdr.bfReserved1 = 0;
00793     bmfHdr.bfReserved2 = 0;
00794
00795     /*  Now, calculate the offset the actual bitmap bits will be in */
00796     /*  the file -- It's the Bitmap file header plus the DIB header, */
00797     /*  plus the size of the color table. */
00798
00799     bmfHdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + lpBI->biSize +
00800             PaletteSize((LPSTR)lpBI);
00801
00802     /*  Write the file header */
00803
00804     WriteFile(fh, (LPSTR)&bmfHdr, sizeof(BITMAPFILEHEADER), &dwWritten, NULL);
00805
00806     /*  Write the DIB header and the bits -- use local version of */
00807     /*  MyWrite, so we can write more than 32767 bytes of data */
00808
00809     WriteFile(fh, (LPSTR)lpBI, dwDIBSize, &dwWritten, NULL);
00810
00811     GlobalUnlock(hDib);
00812     CloseHandle(fh);
00813
00814     if (dwWritten == 0)
00815         return FALSE; /*  oops, something happened in the write */
00816     else
00817         return TRUE; /*  Success code */
00818 }

VOID WriteMapFileHeaderandConvertFromDwordAlignToPacked | ( | HFILE | fh,
 |  | LPBITMAPFILEHEADER | pbf
 | ) |

Definition at line 160 of file dib.c.

Referenced by SIZEOF_BITMAPFILEHEADER_PACKED().

00161 {
00162
00163         /* write bfType*/
00164     _lwrite(fh, (LPSTR)&pbf->bfType, (UINT)sizeof (WORD));
00165         /* now pass over extra word, and only write next 3 DWORDS!*/
00166         _lwrite(fh, (LPSTR)&pbf->bfSize, sizeof(DWORD) * 3);
00167 }

Generated on Sun Oct 21 12:44:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PseudoButton.cpp File Reference

rf/support/mfc/PseudoButton.cpp File Reference

#include "stdafx.h"
#include "umain.h"
#include "PseudoButton.h"
#include "dib.h"
#include <map>
#include <string.h>

Include dependency graph for PseudoButton.cpp:

Include dependency graph

Go to the source code of this file.

Functions

const BYTE * | nextLine (const BYTE *src, CString &line)

Variables

HBITMAP L int & | width
HBITMAP L int int & | height
HBITMAP L int int UTB_KIND | kind
HBITMAP L int int UTB_KIND
COLORREF 		back
HBITMAP L int int UTB_KIND
COLORREF COLORREF 		fore

Function Documentation

const BYTE* nextLine | ( | const BYTE * | src,
 |  | CString & | line
 | ) | [static]

Definition at line 285 of file PseudoButton.cpp.

Referenced by width().

00286 {
00287     const char *tmp = strchr((const char *)src, '\n');
00288     if(tmp == 0L)
00289         return 0L;
00290
00291     line = CString((const char *)src, tmp - (const char *)src - 1);
00292     src = (const BYTE *)tmp + 1;
00293     return src;
00294 }

Variable Documentation

HBITMAP L int int UTB_KIND COLORREF back

Definition at line 297 of file PseudoButton.cpp.

HBITMAP L int int UTB_KIND COLORREF COLORREF fore

Definition at line 297 of file PseudoButton.cpp.

int height

Definition at line 297 of file PseudoButton.cpp.

int UTB_KIND kind

Definition at line 297 of file PseudoButton.cpp.

HBITMAP L int& width

Definition at line 297 of file PseudoButton.cpp.

Generated on Sun Oct 21 12:44:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PseudoButton.h File Reference

rf/support/mfc/PseudoButton.h File Reference

#include <vector>

Include dependency graph for PseudoButton.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CPseudoButton
class | CPseudoRotButton
class | CPseudoToggle

Enumerations

enum | UTB_KIND { DD_END, DD_PIXMAP, DD_BMAP, DD_RGB }

Functions

HBITMAP | UMakeBitmap (const void *icon, int &width, int &height, UTB_KIND kind, COLORREF back, COLORREF fore, bool enabled=true)
HBITMAP | UMakeBitmap (const void *icon, int width, int height, UTB_KIND kind, bool enabled=true)

Enumeration Type Documentation

enum UTB_KIND

Enumeration values:
DD_END
DD_PIXMAP
DD_BMAP
DD_RGB

Definition at line 28 of file PseudoButton.h.

00029 {
00030     DD_END,
00031     DD_PIXMAP,  /* X11 pixmap (color indexed) */
00032     DD_BMAP,    /* X11 bitmap (B&W) */
00033     DD_RGB      /* RGB / char */
00034 } UTB_KIND;

Function Documentation

HBITMAP UMakeBitmap | ( | const void * | icon,
 |  | int | width,
 |  | int | height,
 |  | UTB_KIND | kind,
 |  | bool | enabled = true
 | ) |

HBITMAP UMakeBitmap | ( | const void * | icon,
 |  | int & | width,
 |  | int & | height,
 |  | UTB_KIND | kind,
 |  | COLORREF | back,
 |  | COLORREF | fore,
 |  | bool | enabled = true
 | ) |

Generated on Sun Oct 21 12:44:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PseudoDlg.cpp File Reference

rf/support/mfc/PseudoDlg.cpp File Reference

#include "stdafx.h"
#include "uwidget.h"
#include "PseudoDlg.h"
#include "PseudoDraw.h"
#include "PseudoList.h"

Include dependency graph for PseudoDlg.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | IS_PSEUDO_CTL(id) ((id) >= WINCMD_DLG_START && (id) < WINCMD_DLG_END)

Functions

void | WinInitWidgets (CWnd *wnd, UWidget *pseudo)
int | findIdForWnd (CWnd *wnd, UWidget *wid)
int | UWinToUMod (UINT nFlags)
LRESULT | UWinPseudoWindowProc (CWnd *wnd, UWidget *wid, UINT message, WPARAM wParam, LPARAM lParam)

Define Documentation

#define IS_PSEUDO_CTL ( id ) ((id) >= WINCMD_DLG_START && (id) < WINCMD_DLG_END)

Definition at line 36 of file PseudoDlg.cpp.

Referenced by UWinPseudoWindowProc(), and WinInitWidgets().

Function Documentation

LRESULT UWinPseudoWindowProc | ( | CWnd * | wnd,
 |  | UWidget * | wid,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |

Definition at line 211 of file PseudoDlg.cpp.

Referenced by CPseudoDlg::WindowProc().

00212 {
00213     bool sentOne = false;
00214
00215     if(wid == 0L)
00216         return 1;
00217
00218     if (message == WM_COMMAND)
00219     {
00220         UINT nID = LOWORD(wParam);
00221         if(!IS_PSEUDO_CTL(nID))
00222             return 1;
00223
00224         int nCode = HIWORD(wParam);
00225         HWND hWndCtrl = (HWND)lParam;
00226         switch(nCode)
00227         {
00228         case BN_CLICKED:
00229             UEventSendMessage(wid->GetWidID(), EV_CMD, WINCTL_to_UCMD(nID), 0L);
00230             sentOne = true;
00231             break;
00232         case CBN_SELCHANGE:
00233         {
00234             ASSERT(::IsWindow(hWndCtrl));
00235             int sel = (int)::SendMessage(hWndCtrl, CB_GETCURSEL, 0, 0);
00236             const char *txt = 0L;
00237             char buf[1024] = {'\0'};
00238             if(sel != -1 && (int)::SendMessage(hWndCtrl, CB_GETLBTEXT, sel, (LPARAM)buf) != CB_ERR)
00239                 txt = buf;
00240             if(strcmp(buf, "-") != 0) // separator
00241                 UEventSendMessage(wid->GetWidID(), EV_COMBO_SEL,
00242                     UMAKEINT(WINCTL_to_UCMD(nID), sel), (void *)txt);
00243             sentOne = true;
00244             break;
00245         }
00246         case EN_CHANGE:
00247             if(wid->m_noDispatch)
00248                 break;
00249
00250             ASSERT(::IsWindow(hWndCtrl));
00251             UEventSendMessage(wid->GetWidID(), EV_EDITCHANGE,
00252                 WINCTL_to_UCMD(nID), 0L);
00253             break;
00254         }
00255     }
00256     else if (message == WM_NOTIFY)
00257     {
00258         NMHDR* pNMHDR = (NMHDR*)lParam;
00259         if (pNMHDR->hwndFrom != NULL)
00260         {
00261             UINT nID = _AfxGetDlgCtrlID(pNMHDR->hwndFrom);
00262             int nCode = pNMHDR->code;
00263             if(!IS_PSEUDO_CTL(nID))
00264                 return 1;
00265
00266             switch(nCode)
00267             {
00268             case LVN_ITEMCHANGED:
00269                 NMLISTVIEW *state = (NMLISTVIEW *)pNMHDR;
00270
00271                 HWND wnd = state->hdr.hwndFrom;
00272                 ASSERT(::IsWindow(wnd));
00273
00274                 int id = state->hdr.idFrom;
00275                 std::map<int, void *>::const_iterator i = wid->GetWidgets().find(WINCTL_to_UCMD(id));
00276                 if(i != wid->GetWidgets().end())
00277                 {
00278                     CWnd *w = (CWnd *)(*i).second;
00279                     if(w->IsKindOf(RUNTIME_CLASS(CListCtrl)))
00280                     {
00281                         CListCtrl *list = (CListCtrl*)w;
00282                         CString s = list->GetItemText(state->iItem, 0);
00283
00284                         UEventSendMessage(wid->GetWidID(), EV_LIST_SELECTING,
00285                             UMAKEINT(WINCTL_to_UCMD(state->hdr.idFrom), state->iItem), (void *)(const char *)s);
00286                         sentOne = true;
00287                     }
00288                 }
00289                 break;
00290             }
00291         }
00292     }
00293     else if (message == WM_SIZE)
00294     {
00295         int id = findIdForWnd(wnd, wid);
00296         if(id != -1)
00297         {
00298             URECT r = {0, 0, LOWORD(lParam), HIWORD(lParam)};
00299             UEventSendMessage(wid->GetWidID(), EV_RESIZE, id, &r);
00300             sentOne = true;
00301         }
00302     }
00303     else if (message == WM_MOUSEMOVE)
00304     {
00305         int id = findIdForWnd(wnd, wid);
00306         if(id != -1)
00307         {
00308             UEventSendMessage(wid->GetWidID(), EV_MMOVE, UMAKEINT(LOWORD(lParam), HIWORD(lParam)),
00309                 (void *)UWinToUMod(wParam));
00310             sentOne = true;
00311         }
00312     }
00313     else if (message == WM_LBUTTONDOWN)
00314     {
00315         int id = findIdForWnd(wnd, wid);
00316         if(id != -1)
00317         {
00318             UEventSendMessage(wid->GetWidID(), EV_BTNDOWN, UMAKEINT(LOWORD(lParam), HIWORD(lParam)),
00319                 (void *)UWinToUMod(wParam));
00320             sentOne = true;
00321         }
00322     }
00323     else if (message == WM_LBUTTONUP)
00324     {
00325         int id = findIdForWnd(wnd, wid);
00326         if(id != -1)
00327         {
00328             UEventSendMessage(wid->GetWidID(), EV_BTNUP, UMAKEINT(LOWORD(lParam), HIWORD(lParam)),
00329                 (void *)UWinToUMod(wParam));
00330             sentOne = true;
00331         }
00332     }
00333     else if (message == WM_LBUTTONDBLCLK)
00334     {
00335         int id = findIdForWnd(wnd, wid);
00336         if(id != -1)
00337         {
00338             UEventSendMessage(wid->GetWidID(), EV_BTNDBLDOWN, UMAKEINT(LOWORD(lParam), HIWORD(lParam)),
00339                 (void *)UWinToUMod(wParam));
00340             sentOne = true;
00341         }
00342     }
00343     else if (message == WM_KEYDOWN)
00344     {
00345         int id = findIdForWnd(wnd, wid);
00346         if(id != -1)
00347         {
00348             UEventSendMessage(wid->GetWidID(), EV_KEYDOWN, wParam, 0L);
00349             sentOne = true;
00350         }
00351     }
00352     else if (message == WM_HSCROLL)
00353     {
00354         HWND hwndScrollBar = (HWND) lParam;       // handle to scroll bar
00355         int nID = ::GetDlgCtrlID(hwndScrollBar);
00356         if(!IS_PSEUDO_CTL(nID))
00357             return 1;
00358
00359         int cmd = WINCTL_to_UCMD(nID);
00360         CWnd *wnds = (CWnd *)wid->GetWidget(cmd);
00361         if(wnds == 0L || !wnds->IsKindOf(RUNTIME_CLASS(CScrollBar)))
00362             return 1;
00363
00364         CScrollBar *scroll = (CScrollBar *)wnds;
00365
00366         int nScrollCode = (int) LOWORD(wParam);  // scroll bar value
00367         int nPos;
00368         if(nScrollCode == SB_THUMBPOSITION || nScrollCode == SB_THUMBTRACK)
00369         {
00370             nPos = (short int) HIWORD(wParam);   // scroll box position
00371
00372             if(nScrollCode == SB_THUMBPOSITION)
00373                 scroll->SetScrollPos(nPos);
00374         }
00375         else
00376         {
00377             SCROLLINFO info;
00378             VERIFY(scroll->GetScrollInfo(&info));
00379             nPos = info.nPos;
00380
00381             switch(nScrollCode)
00382             {
00383             case SB_ENDSCROLL:
00384                 return 1;
00385                 break;
00386             case SB_LINELEFT:
00387                 nPos -= 1;
00388                 break;
00389             case SB_LINERIGHT:
00390                 nPos += 1;
00391                 break;
00392             case SB_PAGELEFT:
00393                 nPos -= info.nPage;
00394                 break;
00395             case SB_PAGERIGHT:
00396                 nPos += info.nPage;
00397                 break;
00398             case SB_LEFT:
00399                 nPos = info.nMin;
00400                 break;
00401             case SB_RIGHT:
00402                 nPos = info.nMax;
00403                 break;
00404             }
00405
00406             scroll->SetScrollPos(nPos);
00407         }
00408
00409         UEventSendMessage(wid->GetWidID(), EV_SCROLLCHANGE, WINCTL_to_UCMD(nID),
00410             (void *)nPos);
00411         sentOne = true;
00412     }
00413     else if (message == WM_VSCROLL)
00414     {
00415         HWND hwndScrollBar = (HWND) lParam;       // handle to scroll bar
00416         int nID = ::GetDlgCtrlID(hwndScrollBar);
00417         if(!IS_PSEUDO_CTL(nID))
00418             return 1;
00419
00420         int cmd = WINCTL_to_UCMD(nID);
00421         CWnd *wnds = (CWnd *)wid->GetWidget(cmd);
00422         if(wnds == 0L || !wnds->IsKindOf(RUNTIME_CLASS(CScrollBar)))
00423             return 1;
00424
00425         CScrollBar *scroll = (CScrollBar *)wnds;
00426
00427         int nScrollCode = (int) LOWORD(wParam);  // scroll bar value
00428         int nPos;
00429         if(nScrollCode == SB_THUMBPOSITION || nScrollCode == SB_THUMBTRACK)
00430         {
00431             nPos = (short int) HIWORD(wParam);   // scroll box position
00432
00433             if(nScrollCode == SB_THUMBPOSITION)
00434                 scroll->SetScrollPos(nPos);
00435         }
00436         else
00437         {
00438             SCROLLINFO info;
00439             VERIFY(scroll->GetScrollInfo(&info));
00440             nPos = info.nPos;
00441
00442             switch(nScrollCode)
00443             {
00444             case SB_ENDSCROLL:
00445                 return 1;
00446                 break;
00447             case SB_LINEUP:
00448                 nPos -= 1;
00449                 break;
00450             case SB_LINEDOWN:
00451                 nPos += 1;
00452                 break;
00453             case SB_PAGEUP:
00454                 nPos -= info.nPage;
00455                 break;
00456             case SB_PAGEDOWN:
00457                 nPos += info.nPage;
00458                 break;
00459             case SB_TOP:
00460                 nPos = info.nMin;
00461                 break;
00462             case SB_BOTTOM:
00463                 nPos = info.nMax;
00464                 break;
00465             }
00466
00467             if(nPos > info.nMax)
00468                 nPos = info.nMax;
00469             else if(nPos < info.nMin)
00470                 nPos = info.nMin;
00471             scroll->SetScrollPos(nPos);
00472         }
00473
00474         UEventSendMessage(wid->GetWidID(), EV_SCROLLCHANGE, WINCTL_to_UCMD(nID),
00475             (void *)nPos);
00476         sentOne = true;
00477     }
00478
00479     if(sentOne)
00480         UWidget::DoValidUI(false);
00481
00482     return 1;
00483 }

int UWinToUMod ( UINT nFlags ) [static]

Definition at line 192 of file PseudoDlg.cpp.

Referenced by UWinPseudoWindowProc().

00193 {
00194     int res = 0;
00195     if(nFlags & MK_LBUTTON)
00196         res |= VK_LBUTTON;
00197     if(nFlags & MK_RBUTTON)
00198         res |= UK_RBUTTON;
00199     if(nFlags & MK_SHIFT)
00200         res |= UK_SHIFT;
00201     if(nFlags & MK_CONTROL)
00202         res |= UK_CONTROL;
00203     if(nFlags & MK_MBUTTON)
00204         res |= UK_MBUTTON;
00205     if ((GetKeyState(VK_MENU) & 0x8000) != 0)
00206         res |= UK_ALT;
00207
00208     return res;
00209 }

void WinInitWidgets | ( | CWnd * | wnd,
 |  | UWidget * | pseudo
 | ) |

Definition at line 91 of file PseudoDlg.cpp.

Referenced by CPseudoDlg::OnInitDialog().

00092 {
00093     CWnd* pWndStart = 0L;
00094     pWndStart = wnd->GetTopWindow();
00095     while(pWndStart != 0L)
00096     {
00097         HWND hwnd = *pWndStart;
00098         int id = ::GetDlgCtrlID(*pWndStart);
00099         CWnd *res = 0L;
00100         if(IS_PSEUDO_CTL(id))
00101         {
00102             TCHAR szCompare[100];
00103             ::GetClassName(hwnd, szCompare, _countof(szCompare));
00104             DWORD style = (DWORD)GetWindowLong(hwnd, GWL_STYLE);
00105
00106             // check overided widgets
00107             std::map<int, CRuntimeClass *> & list = pseudo->GetOverideList();
00108             std::map<int, CRuntimeClass *>::const_iterator i = list.find(WINCTL_to_UCMD(id));
00109             if(i != list.end())
00110             {
00111                 CRuntimeClass *clss = (*i).second;
00112                 if(clss->IsDerivedFrom(RUNTIME_CLASS(CWnd)))
00113                 {
00114                     res = (CWnd *)clss->CreateObject();
00115                 }
00116             }
00117
00118             if(res == 0L)
00119             {
00120                 if(stricmp(szCompare, "BUTTON") == 0)
00121                 {
00122                     CButton *btn = new CButton();
00123                     res = btn;
00124                 }
00125                 else if(stricmp(szCompare, "Static") == 0)
00126                 {
00127                     if(style & SS_ETCHEDFRAME)
00128                     {
00129                         CPseudoDraw *draw = new CPseudoDraw(pseudo, WINCTL_to_UCMD(id));
00130                         res = draw;
00131                     }
00132                     else
00133                     {
00134                         CStatic *stat = new CStatic();
00135                         res = stat;
00136                     }
00137                 }
00138                 else if(stricmp(szCompare, "ComboBox") == 0)
00139                 {
00140                     CComboBox *combo = new CComboBox();
00141                     res = combo;
00142                 }
00143                 else if(stricmp(szCompare, WC_LISTVIEW) == 0)
00144                 {
00145                     CPseudoList *list = new CPseudoList(pseudo->GetWidID(), WINCTL_to_UCMD(id));
00146                     res = list;
00147                 }
00148                 else
00149                 {
00150                     res = new CWnd();
00151                 }
00152             }
00153
00154             UEventSendMessage(pseudo->GetWidID(), EV_INIT_WIDGET, WINCTL_to_UCMD(id), res);
00155         }
00156         pWndStart = pWndStart->GetNextWindow();
00157     }
00158
00159     std::map<int, CRuntimeClass *> & list = pseudo->GetOverideList();
00160     list.erase(list.begin(), list.end());
00161 }

int findIdForWnd | ( | CWnd * | wnd,
 |  | UWidget * | wid
 | ) | [static]

Definition at line 180 of file PseudoDlg.cpp.

Referenced by UWinPseudoWindowProc().

00181 {
00182     const std::map<int, void *> & allWids = wid->GetWidgets();
00183     std::map<int, void *>::const_iterator i;
00184     for(i = allWids.begin(); i != allWids.end(); ++i)
00185     {
00186         if(wnd == (CWnd *)(*i).second)
00187             return (*i).first;
00188     }
00189     return -1;
00190 }

Generated on Sun Oct 21 12:44:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PseudoDlg.h File Reference

rf/support/mfc/PseudoDlg.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CPseudoDlg

Defines

#define | AFX_PSEUDODLG_H__9EDC5FE5_21FD_4ACE_9AEB_7A521350A2EE__INCLUDED_

Define Documentation

#define AFX_PSEUDODLG_H__9EDC5FE5_21FD_4ACE_9AEB_7A521350A2EE__INCLUDED_

Definition at line 22 of file PseudoDlg.h.

Generated on Sun Oct 21 12:44:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PseudoDraw.cpp File Reference

rf/support/mfc/PseudoDraw.cpp File Reference

#include "stdafx.h"
#include "PseudoDraw.h"
#include "uwidget.h"

Include dependency graph for PseudoDraw.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PseudoDraw.h File Reference

rf/support/mfc/PseudoDraw.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CPseudoDraw

Defines

#define | AFX_STATICDRAW_H__8DCC3165_D42E_4FAA_BCCF_F4328685535E__INCLUDED_

Define Documentation

#define AFX_STATICDRAW_H__8DCC3165_D42E_4FAA_BCCF_F4328685535E__INCLUDED_

Definition at line 2 of file PseudoDraw.h.

Generated on Sun Oct 21 12:44:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PseudoList.cpp File Reference

rf/support/mfc/PseudoList.cpp File Reference

#include "stdafx.h"
#include "PseudoList.h"
#include "umain.h"

Include dependency graph for PseudoList.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pseudolist.h File Reference

rf/support/mfc/pseudolist.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CPseudoList

Defines

#define | AFX_PSEUDOLIST_H__49AF86B3_E6AB_4885_843C_1CE5AC8C4980__INCLUDED_

Define Documentation

#define AFX_PSEUDOLIST_H__49AF86B3_E6AB_4885_843C_1CE5AC8C4980__INCLUDED_

Definition at line 2 of file pseudolist.h.

Generated on Sun Oct 21 12:44:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


StdAfx.cpp File Reference

rf/support/mfc/StdAfx.cpp File Reference

#include "stdafx.h"

Include dependency graph for StdAfx.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/StdAfx.cpp Source File

rf/support/mfc/StdAfx.cpp

Go to the documentation of this file.
00001 // stdafx.cpp : source file that includes just the standard includes
00002 //  pseudo.pch will be the pre-compiled header
00003 //  stdafx.obj will contain the pre-compiled type information
00004
00005 #include "stdafx.h"
00006
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


StdAfx.h File Reference

rf/support/mfc/StdAfx.h File Reference

#include <afx.h>
#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#include <afxcmn.h>
#include "CJLibrary.h"

Include dependency graph for StdAfx.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_STDAFX_H__EDF5958A_92F6_11D3_9365_00C0F00AE104__INCLUDED_
#define | VC_EXTRALEAN
#define | qDebug 0
#define | UASSERT ASSERT

Define Documentation

#define AFX_STDAFX_H__EDF5958A_92F6_11D3_9365_00C0F00AE104__INCLUDED_

Definition at line 7 of file StdAfx.h.

#define UASSERT ASSERT

Definition at line 32 of file StdAfx.h.

#define VC_EXTRALEAN

Definition at line 15 of file StdAfx.h.

#define qDebug 0

Definition at line 29 of file StdAfx.h.

Generated on Sun Oct 21 12:44:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/mfc/StdAfx.h Source File

rf/support/mfc/StdAfx.h

Go to the documentation of this file.
00001 // stdafx.h : include file for standard system include files,
00002 //  or project specific include files that are used frequently, but
00003 //      are changed infrequently
00004 //
00005
00006 #if !defined(AFX_STDAFX_H__EDF5958A_92F6_11D3_9365_00C0F00AE104__INCLUDED_)
00007 #define AFX_STDAFX_H__EDF5958A_92F6_11D3_9365_00C0F00AE104__INCLUDED_
00008
00009 #pragma warning (disable : 4786)
00010
00011 #if _MSC_VER > 1000
00012 #pragma once
00013 #endif // _MSC_VER > 1000
00014
00015 #define VC_EXTRALEAN        // Exclude rarely-used stuff from Windows headers
00016
00017 #include <afx.h>
00018 #include <afxwin.h>
00019 #include <afxext.h>         // MFC extensions
00020 #include <afxdisp.h>        // MFC Automation classes
00021 #include <afxdtctl.h>       // MFC support for Internet Explorer 4 Common Controls
00022 #ifndef _AFX_NO_AFXCMN_SUPPORT
00023 #include <afxcmn.h>         // MFC support for Windows Common Controls
00024 #endif // _AFX_NO_AFXCMN_SUPPORT
00025
00026 #ifdef _DEBUG
00027 #   define qDebug 1
00028 #else
00029 #   define qDebug 0
00030 #endif
00031
00032 #define UASSERT ASSERT
00033     // the pseudo ASSERT
00034
00035 #include "CJLibrary.h"
00036         // the CJ library provides a bunch of usefull Windows classes.
00037
00038 //{{AFX_INSERT_LOCATION}}
00039 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00040
00041 #endif // !defined(AFX_STDAFX_H__EDF5958A_92F6_11D3_9365_00C0F00AE104__INCLUDED_)
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


stdafx.h File Reference

rf/support/powerplant/stdafx.h File Reference

#include <PP_ClassHeaders.cp>

Include dependency graph for stdafx.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | qMacPP 1
#define | UASSERT Assert_
#define | UTHROW(err) Throw_Err(mFulErr)

Functions

char * | strdup (const char *str)

Define Documentation

#define UASSERT Assert_

Definition at line 10 of file stdafx.h.

#define UTHROW ( err ) Throw_Err(mFulErr)

Definition at line 11 of file stdafx.h.

#define qMacPP 1

Definition at line 1 of file stdafx.h.

Function Documentation

char* strdup ( const char * str )

Definition at line 66 of file UPseudoSupport.cpp.

00067 {
00068     if(str == 0L)
00069         return 0L;
00070
00071     size_t len = strlen(str);
00072     char *res = (char *)malloc((len + 1) * sizeof(char));
00073     if(res == 0L)
00074         throw LException(mFulErr);
00075     strcpy(res, str);
00076     return res;
00077 }

Generated on Sun Oct 21 12:44:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/powerplant/stdafx.h Source File

rf/support/powerplant/stdafx.h

Go to the documentation of this file.
00001 #define qMacPP 1
00002
00003 #if qDebug
00004 #   include <PP_DebugHeaders.cp>
00005 #else
00006 #   include <PP_ClassHeaders.cp>
00007 #endif
00008
00009 /* the MacAPP assert */
00010 #define UASSERT Assert_
00011 #define UTHROW(err) Throw_Err(mFulErr)
00012
00013 extern "C" char *strdup(const char *str);
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPseudoSupport.cpp File Reference

rf/support/powerplant/UPseudoSupport.cpp File Reference

#include "stdafx.h"
#include "UPseudoSupport.h"
#include "uconsole.h"
#include "udraw.h"
#include "umenu.h"
#include <stdio.h>
#include <stdlib.h>
#include <UGAColorRamp.h>
#include <LTableMonoGeometry.h>
#include <LTableMultiGeometry.h>
#include <LTableSingleSelector.h>
#include <LOutlineKeySelector.h>
#include <LOutlineTable.h>
#include <LTextTableView.h>
#include <LCellSizeToFit.h>
#include <LTableArrayStorage.h>
#include <LTextArray.h>
#include <LTableSingleRowSelector.h>
#include <LEditText.h>
#include <LPopupButton.h>
#include <LScrollBar.h>
#include <LPageController.h>
#include <LTabsControl.h>
#include <LSlider.h>
#include <LLittleArrows.h>
#include <LCheckBoxGroupBox.h>

Include dependency graph for UPseudoSupport.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CDummyClass
class | LPseudoDrawAttachment
class | UPPMenu

Defines

#define | NEW new

Functions

char * | strdup (const char *str)
bool | macpp_getcmdid (LPane *view, int &cmdid)
bool | macpp_getcmdid (PaneIDT atype, int &cmdid)
LPseudoWinAttachment * | macpp_getattachwindow (UWidget *wid)
LPseudoWinAttachment * | macpp_getattachwindow (LWindow *wind)
void | macpp_fecthview (int widid, LPane *pane)
void | macpp_linkbroadcasters (LPane *pane, LListener *listener)
void | macpp_preparetable (LOutlineTable *table)
void | macpp_preparetable (void *win, LTextTableView *table)
LWindow * | macpp_findwindow (LPane *pane)

Variables

bool | gTurnOffBroadcast = false
CDummyClass sDummyStarter

Define Documentation

#define NEW new

Definition at line 32 of file UPseudoSupport.cpp.

Function Documentation

void macpp_fecthview | ( | int | widid,
 |  | LPane * | view
 | ) |

Definition at line 144 of file UPseudoSupport.cpp.

00145 {
00146     int cmdid;
00147     if(macpp_getcmdid(pane, cmdid))
00148     {
00149         UEventSendMessage(widid, EV_INIT_WIDGET, cmdid, pane);
00150
00151         // look for any attachement we know of
00152         const TArray<LAttachment*>* theAttachments = pane->GetAttachmentsList();
00153         if (theAttachments != nil)
00154         {
00155             TArrayIterator<LAttachment*> iterate(*theAttachments);
00156
00157             LAttachment*    theAttach;
00158             while (iterate.Next(theAttach))
00159             {
00160                 UPseudoPageHider *hider = dynamic_cast<UPseudoPageHider*>(theAttach);
00161                 if(hider != 0L)
00162                     hider->SetWidID(widid);
00163             }
00164         }
00165
00166         // for any control, set the broadcast message to be the Pane ID
00167         LControl *control = dynamic_cast<LControl*>(pane);
00168         if(control != 0L && control->GetValueMessage() == 0)
00169         {
00170             control->SetValueMessage(pane->GetPaneID());
00171         }
00172
00173         // idem
00174         LCheckBoxGroupBox *groupbox = dynamic_cast<LCheckBoxGroupBox*>(pane);
00175         if(groupbox != 0L && groupbox->GetValueMessage() == 0)
00176         {
00177             groupbox->SetValueMessage(pane->GetPaneID());
00178         }
00179
00180         // set the widget id for some custom controls
00181         UPseudoPlaceHolder *holder = dynamic_cast<UPseudoPlaceHolder*>(pane);
00182         if(holder != 0L)
00183         {
00184             holder->SetWidID(widid);
00185             return; // don't fetch inside, it'll be owned by another pseudo widget
00186         }
00187
00188         // this attachment let us fire a EV_CUSTOM_DRAW event when painting
00189         if(typeid(*pane) == typeid(LView))
00190         {
00191             LPseudoDrawAttachment *attach = NEW LPseudoDrawAttachment(widid, cmdid);
00192             pane->AddAttachment(attach);
00193         }
00194     }
00195
00196     // menus with an unspecified menu id need to be created if we want to use
00197     // later on the EV_COMBO_APPEND message on it.
00198     LPopupButton *controler = dynamic_cast<LPopupButton*>(pane);
00199     if(controler != 0L)
00200     {
00201         if(controler->GetMenuID() == MENU_Unspecified && controler->GetMacMenuH() == 0L)
00202             controler->SetMacMenuH(::NewMenu(::UniqueID('MENU'), "\p"), true);
00203     }
00204
00205     // recurse
00206     LView *view = dynamic_cast<LView*>(pane);
00207     if(view == 0L)
00208         return;
00209
00210     TArrayIterator<LPane*> iterator(view->GetSubPanes());
00211     LPane   *theSub;
00212     while (iterator.Next(theSub))
00213     {
00214         macpp_fecthview(widid, theSub);
00215     }
00216 }

LWindow* macpp_findwindow ( LPane * pane ) [static]

Definition at line 273 of file UPseudoSupport.cpp.

Referenced by UPseudoPageHider::DoRotate(), UPseudoPlaceHolder::DoRotate(), and UPseudoPlaceHolder::FinishCreateSelf().

00274 {
00275     LPane *topView = 0L;
00276     while(pane != 0L)
00277     {
00278         topView = pane;
00279         pane = pane->GetSuperView();
00280     }
00281     return dynamic_cast<LWindow *>(topView);
00282 }

LPseudoWinAttachment* macpp_getattachwindow ( LWindow * wind )

Definition at line 120 of file UPseudoSupport.cpp.

00121 {
00122     if(wind != 0L)
00123     {
00124         const TArray<LAttachment*>* theAttachments = wind->GetAttachmentsList();
00125
00126         if (theAttachments != nil)
00127         {
00128             TArrayIterator<LAttachment*> iterate(*theAttachments);
00129
00130             LAttachment*    theAttach;
00131             while (iterate.Next(theAttach))
00132             {
00133                 LPseudoWinAttachment*   theWinAttach = dynamic_cast<LPseudoWinAttachment*>(theAttach);
00134                 if (theWinAttach != nil)
00135                 {
00136                     return theWinAttach;
00137                 }
00138             }
00139         }
00140     }
00141     return 0L;
00142 }

LPseudoWinAttachment* macpp_getattachwindow ( UWidget * wid )

Definition at line 108 of file UPseudoSupport.cpp.

00109 {
00110     LPane *win = (LPane *)wid->GetWidget(kUMainWidget);
00111     LWindow *wind = dynamic_cast<LWindow *>((LPane *)win);
00112
00113     if(wind != 0L)
00114     {
00115         return macpp_getattachwindow(wind);
00116     }
00117     return 0L;
00118 }

bool macpp_getcmdid | ( | PaneIDT | atype,
 |  | int & | cmdid
 | ) | [static]

Definition at line 94 of file UPseudoSupport.cpp.

Referenced by UPseudoPageHider::DoRotate(), UPseudoPlaceHolder::DoRotate(), LPseudoWinAttachment::ListenToMessage(), and macpp_fecthview().

00095 {
00096     const char *atypestr = (char *)&atype;
00097     if(atypestr[0] != 'p' && atypestr[1] != 's')
00098         return false;
00099
00100     if(atypestr[2] < '0' || atypestr[2] > '9')
00101         return false;
00102     if(atypestr[3] < '0' || atypestr[3] > '9')
00103         return false;
00104     cmdid = (int)(atypestr[2] - '0') * 10 + (int)(atypestr[3] - '0') + EV_COMMAND_START;
00105     return true;
00106 }

bool macpp_getcmdid | ( | LPane * | view,
 |  | int & | cmdid
 | ) | [static]

Definition at line 79 of file UPseudoSupport.cpp.

00080 {
00081     PaneIDT atype = view->GetPaneID();
00082     const char *atypestr = (char *)&atype;
00083     if(atypestr[0] != 'p' && atypestr[1] != 's')
00084         return false;
00085
00086     if(atypestr[2] < '0' || atypestr[2] > '9')
00087         return false;
00088     if(atypestr[3] < '0' || atypestr[3] > '9')
00089         return false;
00090     cmdid = (int)(atypestr[2] - '0') * 10 + (int)(atypestr[3] - '0') + EV_COMMAND_START;
00091     return true;
00092 }

void macpp_linkbroadcasters | ( | LPane * | view,
 |  | LListener * | listener
 | ) |

Definition at line 218 of file UPseudoSupport.cpp.

00219 {
00220     LBroadcaster *broadcaster = dynamic_cast<LBroadcaster *>(pane);
00221     if(broadcaster != 0L && !broadcaster->HasListener(listener))
00222         broadcaster->AddListener(listener);
00223
00224     LView *view = dynamic_cast<LView*>(pane);
00225     if(view == 0L)
00226         return;
00227
00228     TArrayIterator<LPane*> iterator(view->GetSubPanes());
00229     LPane   *theSub;
00230     while (iterator.Next(theSub))
00231     {
00232         macpp_linkbroadcasters(theSub, listener);
00233     }
00234 }

void macpp_preparetable | ( | void * | win,
 |  | LTextTableView * | table
 | ) |

Definition at line 255 of file UPseudoSupport.cpp.

00256 {
00257     if(table->GetTableGeometry() != 0L)
00258         return;
00259
00260     SDimension16    tableSize;
00261     table->SetCellSizer(NEW LCellSizeToFit());
00262     table->GetFrameSize(tableSize);
00263     table->SetTableGeometry(NEW LTableMonoGeometry(table,
00264         tableSize.width/1 /* col width = width/num Cols */,
00265         12  /* row height */));
00266     table->SetTableSelector(NEW LTableSingleRowSelector( table ));
00267     table->SetTableStorage(NEW LTableArrayStorage(table, (UInt32)0));
00268     table->SetDoubleClickMessage(UTextTableView_DoubleClick);
00269     table->SetSingleClickMessage(UTextTableView_SingleClick);
00270     table->SetCustomHilite(true); // cause there is a hilite bug if we don't
00271 }

void macpp_preparetable ( LOutlineTable * table )

Definition at line 236 of file UPseudoSupport.cpp.

00237 {
00238     if(table->GetTableGeometry() != 0L)
00239         return;
00240
00241     // try to guess a good height for the geometry
00242     int height = 20;
00243     TextTraitsH traitsH = UTextTraits::LoadTextTraits(table->GetTextTraits());
00244     if(traitsH != 0L)
00245         height = ((**traitsH).size * 6) / 4;
00246
00247     LTableMultiGeometry *geom = NEW LTableMultiGeometry(table, 50, height);
00248     if(geom != 0L)
00249         table->SetTableGeometry(geom);
00250     table->SetTableSelector(NEW LTableSingleRowSelector( table ));
00251     table->AddAttachment(NEW LOutlineKeySelector(table, msg_AnyMessage));
00252     table->AddAttachment(NEW LKeyScrollAttachment(table));
00253 }

char* strdup ( const char * str )

Definition at line 66 of file UPseudoSupport.cpp.

Referenced by CCustInvertTable::Initialize(), LogSetFilter(), UWidget::OnComboAppend(), awidget::awidget(), cloneStr(), cvs_process_new(), gp_getenv_read(), gp_getenv_write(), awidget::operator=(), and yylval_set().

00067 {
00068     if(str == 0L)
00069         return 0L;
00070
00071     size_t len = strlen(str);
00072     char *res = (char *)malloc((len + 1) * sizeof(char));
00073     if(res == 0L)
00074         throw LException(mFulErr);
00075     strcpy(res, str);
00076     return res;
00077 }

Variable Documentation

bool gTurnOffBroadcast = false

Definition at line 41 of file UPseudoSupport.cpp.

class CDummyClass sDummyStarter

Generated on Sun Oct 21 12:44:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/powerplant/UPseudoSupport.cpp Source File

rf/support/powerplant/UPseudoSupport.cpp

Go to the documentation of this file.
00001 #include "stdafx.h"
00002
00003 #include "UPseudoSupport.h"
00004 #include "uconsole.h"
00005 #include "udraw.h"
00006 #include "umenu.h"
00007
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010
00011 #include <UGAColorRamp.h>
00012 #include <LTableMonoGeometry.h>
00013 #include <LTableMultiGeometry.h>
00014 #include <LTableSingleSelector.h>
00015 #include <LOutlineKeySelector.h>
00016 #include <LOutlineTable.h>
00017 #include <LTextTableView.h>
00018 #include <LCellSizeToFit.h>
00019 #include <LTableArrayStorage.h>
00020 #include <LTextArray.h>
00021 #include <LTableSingleRowSelector.h>
00022 #include <LEditText.h>
00023 #include <LPopupButton.h>
00024 #include <LScrollBar.h>
00025 #include <LPageController.h>
00026 #include <LTabsControl.h>
00027 #include <LSlider.h>
00028 #include <LLittleArrows.h>
00029 #include <LCheckBoxGroupBox.h>
00030
00031 #ifndef NEW
00032 #   define NEW new
00033 #endif
00034
00035 #if __option(RTTI)
00036 #   include <typeinfo>
00037 #else
00038 #   error "RTTI option disabled -- must be enabled for LPaneTree to function"
00039 #endif
00040
00041 bool gTurnOffBroadcast = false;
00042
00043 class UPPMenu : public UMenu
00044 {
00045 public:
00046     UPPMenu();
00047     virtual ~UPPMenu();
00048
00049     static int sPPMenuWidID;
00050 };
00051
00052 class LPseudoDrawAttachment : public LAttachment
00053 {
00054 public:
00055     LPseudoDrawAttachment(int widid, int cmdid);
00056     virtual ~LPseudoDrawAttachment();
00057
00058 protected:
00059     virtual void    ExecuteSelf(
00060                             MessageT        inMessage,
00061                             void*           ioParam);
00062
00063     int m_widid, m_cmdid;
00064 };
00065
00066 extern "C" char *strdup(const char *str)
00067 {
00068     if(str == 0L)
00069         return 0L;
00070
00071     size_t len = strlen(str);
00072     char *res = (char *)malloc((len + 1) * sizeof(char));
00073     if(res == 0L)
00074         throw LException(mFulErr);
00075     strcpy(res, str);
00076     return res;
00077 }
00078
00079 static bool macpp_getcmdid(LPane *view, int & cmdid)
00080 {
00081     PaneIDT atype = view->GetPaneID();
00082     const char *atypestr = (char *)&atype;
00083     if(atypestr[0] != 'p' && atypestr[1] != 's')
00084         return false;
00085
00086     if(atypestr[2] < '0' || atypestr[2] > '9')
00087         return false;
00088     if(atypestr[3] < '0' || atypestr[3] > '9')
00089         return false;
00090     cmdid = (int)(atypestr[2] - '0') * 10 + (int)(atypestr[3] - '0') + EV_COMMAND_START;
00091     return true;
00092 }
00093
00094 static bool macpp_getcmdid(PaneIDT atype, int & cmdid)
00095 {
00096     const char *atypestr = (char *)&atype;
00097     if(atypestr[0] != 'p' && atypestr[1] != 's')
00098         return false;
00099
00100     if(atypestr[2] < '0' || atypestr[2] > '9')
00101         return false;
00102     if(atypestr[3] < '0' || atypestr[3] > '9')
00103         return false;
00104     cmdid = (int)(atypestr[2] - '0') * 10 + (int)(atypestr[3] - '0') + EV_COMMAND_START;
00105     return true;
00106 }
00107
00108 LPseudoWinAttachment *macpp_getattachwindow(UWidget *wid)
00109 {
00110     LPane *win = (LPane *)wid->GetWidget(kUMainWidget);
00111     LWindow *wind = dynamic_cast<LWindow *>((LPane *)win);
00112
00113     if(wind != 0L)
00114     {
00115         return macpp_getattachwindow(wind);
00116     }
00117     return 0L;
00118 }
00119
00120 LPseudoWinAttachment *macpp_getattachwindow(LWindow *wind)
00121 {
00122     if(wind != 0L)
00123     {
00124         const TArray<LAttachment*>* theAttachments = wind->GetAttachmentsList();
00125
00126         if (theAttachments != nil)
00127         {
00128             TArrayIterator<LAttachment*> iterate(*theAttachments);
00129
00130             LAttachment*    theAttach;
00131             while (iterate.Next(theAttach))
00132             {
00133                 LPseudoWinAttachment*   theWinAttach = dynamic_cast<LPseudoWinAttachment*>(theAttach);
00134                 if (theWinAttach != nil)
00135                 {
00136                     return theWinAttach;
00137                 }
00138             }
00139         }
00140     }
00141     return 0L;
00142 }
00143
00144 void macpp_fecthview(int widid, LPane *pane)
00145 {
00146     int cmdid;
00147     if(macpp_getcmdid(pane, cmdid))
00148     {
00149         UEventSendMessage(widid, EV_INIT_WIDGET, cmdid, pane);
00150
00151         // look for any attachement we know of
00152         const TArray<LAttachment*>* theAttachments = pane->GetAttachmentsList();
00153         if (theAttachments != nil)
00154         {
00155             TArrayIterator<LAttachment*> iterate(*theAttachments);
00156
00157             LAttachment*    theAttach;
00158             while (iterate.Next(theAttach))
00159             {
00160                 UPseudoPageHider *hider = dynamic_cast<UPseudoPageHider*>(theAttach);
00161                 if(hider != 0L)
00162                     hider->SetWidID(widid);
00163             }
00164         }
00165
00166         // for any control, set the broadcast message to be the Pane ID
00167         LControl *control = dynamic_cast<LControl*>(pane);
00168         if(control != 0L && control->GetValueMessage() == 0)
00169         {
00170             control->SetValueMessage(pane->GetPaneID());
00171         }
00172
00173         // idem
00174         LCheckBoxGroupBox *groupbox = dynamic_cast<LCheckBoxGroupBox*>(pane);
00175         if(groupbox != 0L && groupbox->GetValueMessage() == 0)
00176         {
00177             groupbox->SetValueMessage(pane->GetPaneID());
00178         }
00179
00180         // set the widget id for some custom controls
00181         UPseudoPlaceHolder *holder = dynamic_cast<UPseudoPlaceHolder*>(pane);
00182         if(holder != 0L)
00183         {
00184             holder->SetWidID(widid);
00185             return; // don't fetch inside, it'll be owned by another pseudo widget
00186         }
00187
00188         // this attachment let us fire a EV_CUSTOM_DRAW event when painting
00189         if(typeid(*pane) == typeid(LView))
00190         {
00191             LPseudoDrawAttachment *attach = NEW LPseudoDrawAttachment(widid, cmdid);
00192             pane->AddAttachment(attach);
00193         }
00194     }
00195
00196     // menus with an unspecified menu id need to be created if we want to use
00197     // later on the EV_COMBO_APPEND message on it.
00198     LPopupButton *controler = dynamic_cast<LPopupButton*>(pane);
00199     if(controler != 0L)
00200     {
00201         if(controler->GetMenuID() == MENU_Unspecified && controler->GetMacMenuH() == 0L)
00202             controler->SetMacMenuH(::NewMenu(::UniqueID('MENU'), "\p"), true);
00203     }
00204
00205     // recurse
00206     LView *view = dynamic_cast<LView*>(pane);
00207     if(view == 0L)
00208         return;
00209
00210     TArrayIterator<LPane*> iterator(view->GetSubPanes());
00211     LPane   *theSub;
00212     while (iterator.Next(theSub))
00213     {
00214         macpp_fecthview(widid, theSub);
00215     }
00216 }
00217
00218 void macpp_linkbroadcasters(LPane *pane, LListener *listener)
00219 {
00220     LBroadcaster *broadcaster = dynamic_cast<LBroadcaster *>(pane);
00221     if(broadcaster != 0L && !broadcaster->HasListener(listener))
00222         broadcaster->AddListener(listener);
00223
00224     LView *view = dynamic_cast<LView*>(pane);
00225     if(view == 0L)
00226         return;
00227
00228     TArrayIterator<LPane*> iterator(view->GetSubPanes());
00229     LPane   *theSub;
00230     while (iterator.Next(theSub))
00231     {
00232         macpp_linkbroadcasters(theSub, listener);
00233     }
00234 }
00235
00236 void macpp_preparetable(LOutlineTable *table)
00237 {
00238     if(table->GetTableGeometry() != 0L)
00239         return;
00240
00241     // try to guess a good height for the geometry
00242     int height = 20;
00243     TextTraitsH traitsH = UTextTraits::LoadTextTraits(table->GetTextTraits());
00244     if(traitsH != 0L)
00245         height = ((**traitsH).size * 6) / 4;
00246
00247     LTableMultiGeometry *geom = NEW LTableMultiGeometry(table, 50, height);
00248     if(geom != 0L)
00249         table->SetTableGeometry(geom);
00250     table->SetTableSelector(NEW LTableSingleRowSelector( table ));
00251     table->AddAttachment(NEW LOutlineKeySelector(table, msg_AnyMessage));
00252     table->AddAttachment(NEW LKeyScrollAttachment(table));
00253 }
00254
00255 void macpp_preparetable(void *win, LTextTableView *table)
00256 {
00257     if(table->GetTableGeometry() != 0L)
00258         return;
00259
00260     SDimension16    tableSize;
00261     table->SetCellSizer(NEW LCellSizeToFit());
00262     table->GetFrameSize(tableSize);
00263     table->SetTableGeometry(NEW LTableMonoGeometry(table,
00264         tableSize.width/1 /* col width = width/num Cols */,
00265         12  /* row height */));
00266     table->SetTableSelector(NEW LTableSingleRowSelector( table ));
00267     table->SetTableStorage(NEW LTableArrayStorage(table, (UInt32)0));
00268     table->SetDoubleClickMessage(UTextTableView_DoubleClick);
00269     table->SetSingleClickMessage(UTextTableView_SingleClick);
00270     table->SetCustomHilite(true); // cause there is a hilite bug if we don't
00271 }
00272
00273 static LWindow *macpp_findwindow(LPane *pane)
00274 {
00275     LPane *topView = 0L;
00276     while(pane != 0L)
00277     {
00278         topView = pane;
00279         pane = pane->GetSuperView();
00280     }
00281     return dynamic_cast<LWindow *>(topView);
00282 }
00283
00284 LPseudoDrawAttachment::LPseudoDrawAttachment(int widid, int cmdid) : LAttachment(msg_DrawOrPrint),
00285     m_widid(widid), m_cmdid(cmdid)
00286 {
00287 }
00288
00289 LPseudoDrawAttachment::~LPseudoDrawAttachment()
00290 {
00291 }
00292
00293 void LPseudoDrawAttachment::ExecuteSelf(MessageT inMessage, void *ioParam)
00294 {
00295     SetExecuteHost(true);
00296     LView *view = dynamic_cast<LView*>(GetOwnerHost());
00297     UEventSendMessage(m_widid, EV_CUSTOM_DRAW, m_cmdid, view);
00298 }
00299
00300 LMainPseudoAttachment::LMainPseudoAttachment() : LAttachment(msg_AnyMessage)
00301 {
00302     StartIdling();
00303 }
00304
00305 LMainPseudoAttachment::~LMainPseudoAttachment()
00306 {
00307 }
00308
00309 void LMainPseudoAttachment::SpendTime(const EventRecord&    inMacEvent)
00310 {
00311     ::UEventGiveTime();
00312 }
00313
00314 void LMainPseudoAttachment::ExecuteSelf(MessageT inMessage, void *ioParam)
00315 {
00316     SetExecuteHost(true);
00317
00318     if(UPPMenu::sPPMenuWidID == -1)
00319     {
00320         NEW UPPMenu();
00321     }
00322
00323     if((inMessage > 0 && inMessage < 800) || inMessage >= EV_COMMAND_START)
00324     {
00325         int handledFlag;
00326         int res = UEventSendMessageExt(UPPMenu::sPPMenuWidID, EV_CMD,
00327             inMessage, 0L, &handledFlag);
00328         if(res == 0 && handledFlag)
00329         {
00330             SetExecuteHost(false);
00331             return;
00332         }
00333         else
00334             SetExecuteHost(true);
00335     }
00336
00337     switch (inMessage)
00338     {
00339         case msg_CommandStatus:
00340         {
00341             SCommandStatus *status = static_cast<SCommandStatus*> (ioParam);
00342             CommandT cmdid = status->command;
00343             UPseudoCmdStatusWrapper wrapper;
00344             wrapper.outEnabled = status->enabled;
00345             wrapper.outUsesMark = status->usesMark;
00346             wrapper.outMark = status->mark;
00347             wrapper.outName = status->name;
00348
00349             // first forward the command to the focused widget : if it doesn't want it
00350             // we give it to the next pseudo widget.
00351             int widFocus = UWidget::GetFocus();
00352             if(widFocus != -1)
00353             {
00354                 UCmdUI pUI(cmdid);
00355                 pUI.m_wrapper = &wrapper;
00356                 UEventSendMessage(widFocus, EV_UPDTCMD, pUI.m_nID, &pUI);
00357                 if(!pUI.CanContinue())
00358                 {
00359                     SetExecuteHost(false);
00360                     break;
00361                 }
00362             }
00363
00364             STD map<int, UCmdTarget *>::const_iterator i;
00365             const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00366             for(i = targets.begin(); i != targets.end(); ++i)
00367             {
00368                 int widid = (*i).first;
00369                 if(widid == widFocus)
00370                     continue;
00371
00372                 UCmdUI pUI(cmdid);
00373                 pUI.m_wrapper = &wrapper;
00374                 UEventSendMessage(widid, EV_UPDTCMD, pUI.m_nID, &pUI);
00375                 if(!pUI.CanContinue())
00376                     break;
00377             }
00378
00379             if(i != targets.end())
00380                 SetExecuteHost(false);
00381             break;
00382         }
00383
00384         case msg_Event:
00385         {
00386             EventRecord *ev = static_cast<EventRecord*> (ioParam);
00387
00388 #if 0
00389             if(ev->what == activateEvt)
00390             {
00391                 bool activate = (ev->modifiers & activeFlag) != 0;
00392                 LWindow *theWindow = LWindow::FetchWindowObject((WindowPtr)ev->message);
00393                 if(theWindow != 0L)
00394                 {
00395                     UEventNotifyMessage(EV_UPDATEFOCUS, !activate, theWindow);
00396                         // so the pseudo widget update its current widget.
00397                         // it's important for the menu handling.
00398                 }
00399             }
00400 #endif
00401             if(ev->what == activateEvt ||
00402                 ev->what == mouseDown ||
00403                 ev->what == mouseUp ||
00404                 ev->what == keyDown ||
00405                 ev->what == keyUp ||
00406                 ev->what == autoKey)
00407             {
00408                 UWidget::DoValidUI(false);
00409                 LCommander::SetUpdateCommandStatus(true);
00410             }
00411             break;
00412         }
00413     }
00414 }
00415
00416 LPseudoWinAttachment::LPseudoWinAttachment(int widid) : LAttachment(msg_GrowZone), m_widid(widid)
00417 {
00418     ::SetRect(&m_lastRect, 0, 0, 0, 0);
00419
00420     CheckWindowSize();
00421 }
00422
00423 LPseudoWinAttachment::~LPseudoWinAttachment()
00424 {
00425     UEventSendMessage(m_widid, EV_DESTROY, 0, 0L);
00426 }
00427
00428 int LPseudoWinAttachment::GetPageValue(int cmdid) const
00429 {
00430     std::map<int, int>::const_iterator i = m_PageValues.find(cmdid);
00431     if(i != m_PageValues.end())
00432         return (*i).second;
00433     return 1;
00434 }
00435
00436 void LPseudoWinAttachment::SetPageValue(int cmdid, int value)
00437 {
00438     std::map<int, int>::value_type val(cmdid, value);
00439     m_PageValues.erase(cmdid);
00440     m_PageValues.insert(val);
00441 }
00442
00443 void LPseudoWinAttachment::ExecuteSelf(MessageT inMessage, void *ioParam)
00444 {
00445     SetExecuteHost(true);
00446
00447     // not used yet
00448 }
00449
00450 void LPseudoWinAttachment::CheckWindowSize(void)
00451 {
00452     LWindow *wind = dynamic_cast<LWindow*>(GetOwnerHost());
00453     if(wind != 0L)
00454     {
00455         Rect r;
00456         wind->GetGlobalBounds(r);
00457         if(!::EqualRect(&r, &m_lastRect))
00458         {
00459             m_lastRect = r;
00460             URect ur(r);
00461             UEventSendMessage(m_widid, EV_RESIZE, kUMainWidget, &ur);
00462         }
00463     }
00464 }
00465
00466 int LPseudoWinAttachment::SearchWidID(LPane *pane)
00467 {
00468     int res = m_widid;
00469
00470     // first ask the cache
00471     std::map<LPane *, int>::iterator i = m_CacheWidgets.find(pane);
00472     if(i != m_CacheWidgets.end())
00473         return (*i).second;
00474
00475     // then look if it belongs to a tab
00476     UCmdTarget *target = UEventQueryWidget(m_widid);
00477     UWidget *wid = UDYNAMIC_CAST(UWidget, target);
00478     if(wid == 0L)
00479         return res;
00480
00481     std::map<int, UWidget *>::iterator t;
00482     for(t = wid->m_tabs.begin(); t != wid->m_tabs.end(); ++t)
00483     {
00484         UWidget *tab = (*t).second;
00485         std::map<int, void *>::iterator s;
00486         for(s = tab->m_widgets.begin(); s != tab->m_widgets.end(); ++s)
00487         {
00488             if((*s).second == (void *)pane)
00489             {
00490                 res = tab->GetWidID();
00491                 break; // it's a tab widget
00492             }
00493         }
00494     }
00495
00496     // so we guess it's in the main widget !
00497     std::map<LPane *, int>::value_type val(pane, res);
00498     m_CacheWidgets.insert(val);
00499
00500     return res;
00501 }
00502
00503 void LPseudoWinAttachment::InvalidCache(UWidget *tab_wid)
00504 {
00505     std::map<int, void *>::iterator s;
00506     for(s = tab_wid->m_widgets.begin(); s != tab_wid->m_widgets.end(); ++s)
00507     {
00508         std::map<LPane *, int>::iterator i = m_CacheWidgets.find((LPane *)(*s).second);
00509         if(i != m_CacheWidgets.end())
00510             m_CacheWidgets.erase(i);
00511     }
00512 }
00513
00514
00515 void LPseudoWinAttachment::ListenToMessage(
00516                             MessageT        inMessage,
00517                             void*           ioParam)
00518 {
00519     int cmdid;
00520     LPane *pane;
00521
00522     if(gTurnOffBroadcast)
00523         return;
00524
00525     if(macpp_getcmdid(inMessage, cmdid))
00526     {
00527         LWindow *wind = dynamic_cast<LWindow*>(GetOwnerHost());
00528         if(wind != 0L)
00529         {
00530             pane = wind->FindPaneByID(inMessage);
00531
00532             if(pane != 0L)
00533             {
00534                 int widid = SearchWidID(pane);
00535
00536                 LEditText *edit;
00537                 LControl *control;
00538                 LMenuController *popup;
00539                 LScrollBar *bar;
00540                 LSlider *slider;
00541                 LLittleArrows *arrows;
00542                 LCheckBoxGroupBox *groupbox;
00543
00544                 if((edit = dynamic_cast<LEditText*>(pane)) != 0L)
00545                     UEventSendMessage(widid, EV_EDITCHANGE, cmdid, 0L);
00546                 else if((popup = dynamic_cast<LMenuController*>(pane)) != 0L &&
00547                     popup->GetMacMenuH() != 0L)
00548                 {
00549                     SInt16 item = popup->GetCurrentMenuItem();
00550                     LStr255 pstr;
00551                     if(item > 0)
00552                         popup->GetMenuItemText(item, pstr);
00553                     UStr content(pstr);
00554                     UEventSendMessage(widid, EV_COMBO_SEL, UMAKEINT(cmdid, item - 1),
00555                         (void *)(const char *)content);
00556                 }
00557                 else if((bar = dynamic_cast<LScrollBar*>(pane)) != 0L)
00558                     UEventSendMessage(widid, EV_SCROLLCHANGE, cmdid, (void *)bar->GetValue());
00559                 else if((slider = dynamic_cast<LSlider*>(pane)) != 0L)
00560                     UEventSendMessage(widid, EV_SCROLLCHANGE, cmdid, (void *)slider->GetValue());
00561                 else if((arrows = dynamic_cast<LLittleArrows*>(pane)) != 0L)
00562                     UEventSendMessage(widid, EV_SCROLLCHANGE, cmdid, (void *)arrows->GetValue());
00563                 else if((control = dynamic_cast<LControl*>(pane)) != 0L)
00564                     UEventSendMessage(widid, EV_CMD, cmdid, 0L);
00565                 else if((groupbox = dynamic_cast<LCheckBoxGroupBox*>(pane)) != 0L)
00566                     UEventSendMessage(widid, EV_CMD, cmdid, 0L);
00567             }
00568         }
00569     }
00570     else switch (inMessage)
00571     {
00572         case msg_ScrollAction:
00573         {
00574             LScrollBar::SScrollMessage *message = static_cast<LScrollBar::SScrollMessage *>(ioParam);
00575             LScrollBar* scrollBar = message->scrollBar;
00576             int fPageStep = 1;
00577             if(macpp_getcmdid(scrollBar->GetPaneID(), cmdid))
00578                 fPageStep = GetPageValue(cmdid);
00579             int fButtonStep = 1;
00580             switch(message->hotSpot)
00581             {
00582             case kControlPageUpPart:
00583                 scrollBar->SetValue(scrollBar->GetValue() - fPageStep);
00584                 break;
00585             case kControlUpButtonPart:
00586                 scrollBar->SetValue(scrollBar->GetValue() - fButtonStep);
00587                 break;
00588             case kControlPageDownPart:
00589                 scrollBar->SetValue(scrollBar->GetValue() + fPageStep);
00590                 break;
00591             case kControlDownButtonPart:
00592                 scrollBar->SetValue(scrollBar->GetValue() + fButtonStep);
00593                 break;
00594             }
00595             break;
00596         }
00597         case UTextTableView_SingleClick:
00598         case UTextTableView_DoubleClick:
00599             pane = static_cast<LPane *>(ioParam);
00600
00601             if(pane != 0L && macpp_getcmdid(pane, cmdid))
00602             {
00603                 UStr name;
00604                 int entry = 0;
00605                 LTextTableView *table = dynamic_cast<LTextTableView *>(pane);
00606                 if(table != 0L)
00607                 {
00608                     STableCell cell = table->GetFirstSelectedCell();
00609                     if(!cell.IsNullCell())
00610                     {
00611                         char tmp[255];
00612                         UInt32 ioDataSize = 255;
00613                         table->GetCellData(cell, tmp, ioDataSize);
00614                         name.set(tmp, ioDataSize);
00615                         entry = cell.row;
00616                     }
00617                 }
00618
00619                 UEventSendMessage(SearchWidID(pane),
00620                     inMessage == UTextTableView_SingleClick ?
00621                     EV_LIST_SELECTING : EV_LIST_DBLCLICK, UMAKEINT(cmdid, entry - 1),
00622                     (void *)(const char *)name);
00623             }
00624             break;
00625     }
00626 }
00627
00628 CPseudoItem::CPseudoItem(int widid, int cmdid) : m_widid(widid), m_cmdid(cmdid), m_data(0L)
00629 {
00630 }
00631
00632 CPseudoItem::~CPseudoItem()
00633 {
00634 }
00635
00636 // this is the routine called to know what to draw within the
00637 // table cell. See the comments in LOutlineItem.cp for more info.
00638 void
00639 CPseudoItem::GetDrawContentsSelf(
00640     const STableCell&       inCell,
00641     SOutlineDrawContents&   ioDrawContents)
00642 {
00643     std::map<int, UStr>::iterator i = m_texts.find(inCell.col);
00644     if(i != m_texts.end())
00645     {
00646         ioDrawContents.outShowSelection = true;
00647         LStr255 pstr((*i).second);
00648         LString::CopyPStr(pstr, ioDrawContents.outTextString);
00649     }
00650 }
00651
00652 // just to be cute, we'll draw an adornment (again, see the LOutlineItem.cp
00653 // comments for more information). We'll draw a groovy gray background
00654 void
00655 CPseudoItem::DrawRowAdornments(
00656     const Rect&     inLocalRowRect )
00657 {
00658     ShadeRow(UGAColorRamp::GetColor(colorRamp_White), inLocalRowRect);
00659     RGBColor c = UGAColorRamp::GetColor(colorRamp_Gray2);
00660     RGBForeColor(&c);
00661     MoveTo(inLocalRowRect.right, inLocalRowRect.top);
00662     LineTo(inLocalRowRect.right, inLocalRowRect.bottom);
00663 }
00664
00665 void CPseudoItem::DrawCell(const STableCell & inCell, const Rect & inLocalCellRect)
00666 {
00667     LOutlineItem::DrawCell(inCell, inLocalCellRect);
00668
00669     RGBColor c = UGAColorRamp::GetColor(colorRamp_Gray2);
00670     RGBForeColor(&c);
00671     MoveTo(inLocalCellRect.right - 1, inLocalCellRect.top);
00672     LineTo(inLocalCellRect.right - 1, inLocalCellRect.bottom);
00673 }
00674
00675 void CPseudoItem::SingleClick(
00676                                 const STableCell&           inCell,
00677                                 const SMouseDownEvent&      inMouseDown,
00678                                 const SOutlineDrawContents& inDrawContents,
00679                                 Boolean                     inHitText)
00680 {
00681     UStr name;
00682     std::map<int, UStr>::iterator i = m_texts.find(inCell.col - 1);
00683     if(i != m_texts.end())
00684     {
00685         name = (*i).second;
00686     }
00687     UEventSendMessage(m_widid,
00688         EV_LIST_SELECTING, UMAKEINT(m_cmdid, inCell.row - 1),
00689         (void *)(const char *)name);
00690
00691     LOutlineItem::SingleClick(inCell, inMouseDown, inDrawContents, inHitText);
00692 }
00693
00694 void
00695 CPseudoItem::DoubleClick(
00696     const STableCell&           inCell,
00697     const SMouseDownEvent&      inMouseDown,
00698     const SOutlineDrawContents& inDrawContents,
00699     Boolean                     inHitText)
00700 {
00701     UStr name;
00702     std::map<int, UStr>::iterator i = m_texts.find(inCell.col - 1);
00703     if(i != m_texts.end())
00704     {
00705         name = (*i).second;
00706     }
00707     UEventSendMessage(m_widid,
00708         EV_LIST_DBLCLICK, UMAKEINT(m_cmdid, inCell.row - 1),
00709         (void *)(const char *)name);
00710
00711     LOutlineItem::DoubleClick(inCell, inMouseDown, inDrawContents, inHitText);
00712 }
00713
00714 int UPPMenu::sPPMenuWidID = -1;
00715
00716 UPPMenu::UPPMenu() : UMenu(::UEventGetWidID())
00717 {
00718     sPPMenuWidID = GetWidID();
00719 }
00720
00721 UPPMenu::~UPPMenu()
00722 {
00723 }
00724
00725 UPseudoRotButton::UPseudoRotButton(LStream *inStream, ClassIDT inImpID) : LBevelButton(inStream, inImpID), fCurrentIcon(0)
00726 {
00727     ReadIconsID(inStream, fIconSuite);
00728
00729     if(fIconSuite.size() != 0)
00730         DoRotate(0, false);
00731 }
00732
00733 UPseudoRotButton::~UPseudoRotButton()
00734 {
00735 }
00736
00737 void UPseudoRotButton::ReadIconsID(LStream *inStream, std::vector<short> & res)
00738 {
00739     LStr255 pstr;
00740
00741     inStream->ReadPString(pstr);
00742     UStr str(pstr);
00743     const char *ptr = str;
00744     while(ptr != 0L)
00745     {
00746         int v;
00747         const char *tmp = strchr(ptr, ',');
00748         if(tmp != 0L)
00749         {
00750             UStr stmp;
00751             size_t offset = tmp - ptr;
00752             stmp.set(ptr, offset);
00753             ptr += offset + 1;
00754             if(sscanf(stmp, "%d", &v) == 1)
00755                 res.push_back(v);
00756         }
00757         else
00758         {
00759             if(sscanf(ptr, "%d", &v) == 1)
00760                 res.push_back(v);
00761             ptr = 0L;
00762         }
00763     }
00764 }
00765
00766 void UPseudoRotButton::DoRotate(int icon, bool refresh)
00767 {
00768     if(fCurrentIcon != icon && icon >= 0 && icon < fIconSuite.size())
00769     {
00770         fCurrentIcon = icon;
00771         ControlButtonContentInfo info;
00772         GetContentInfo(info);
00773         if(info.contentType == kControlContentCIconRes ||
00774             info.contentType == kControlContentIconSuiteRes ||
00775             info.contentType == kControlContentICONRes ||
00776             info.contentType == kControlContentPictRes)
00777         {
00778             info.u.resID = fIconSuite[icon];
00779             SetContentInfo(info);
00780         }
00781         if(refresh)
00782             Refresh();
00783     }
00784 }
00785
00786 UPseudoPlaceHolder::UPseudoPlaceHolder(LStream *inStream) : LPlaceHolder(inStream),
00787     fCurrentView(0L), fWidid(-1)
00788 {
00789     LStr255 pstr;
00790     inStream->ReadPString(pstr);
00791     *inStream >> fController;
00792
00793     UStr str(pstr);
00794     const char *ptr = str;
00795     while(ptr != 0L)
00796     {
00797         int v;
00798         const char *tmp = strchr(ptr, ',');
00799         if(tmp != 0L)
00800         {
00801             UStr stmp;
00802             size_t offset = tmp - ptr;
00803             stmp.set(ptr, offset);
00804             ptr += offset + 1;
00805             if(sscanf(stmp, "%d", &v) == 1)
00806                 fViewSuite.push_back(v);
00807         }
00808         else
00809         {
00810             if(sscanf(ptr, "%d", &v) == 1)
00811                 fViewSuite.push_back(v);
00812             ptr = 0L;
00813         }
00814     }
00815 }
00816
00817 UPseudoPlaceHolder::~UPseudoPlaceHolder()
00818 {
00819 }
00820
00821 void UPseudoPlaceHolder::DoRotate(int entry)
00822 {
00823     int cmdid;
00824     if(macpp_getcmdid(GetPaneID(), cmdid) && entry >= 0 && entry < fViewSuite.size())
00825     {
00826         LWindow *win = macpp_findwindow(this);
00827         if(win == 0L)
00828             return;
00829
00830         LView* samplePanel = UReanimator::CreateView(fViewSuite[entry], this, win);
00831         if(samplePanel == 0L)
00832             return;
00833
00834         InstallOccupant (samplePanel);
00835
00836         LView *oldView = fCurrentView;
00837
00838         if (fCurrentView != 0L)
00839         {
00840             fCurrentView->Hide ();
00841             fCurrentView = nil;
00842         }
00843
00844         Refresh();
00845         fCurrentView = samplePanel;
00846
00847         if(fWidid != -1 && !gTurnOffBroadcast)
00848             UEventSendMessage(fWidid, EV_PAGE_CHANGED, UMAKEINT(cmdid, entry), 0L);
00849
00850         if (oldView != 0L)
00851         {
00852             delete oldView;
00853         }
00854
00855     }
00856 }
00857
00858 void UPseudoPlaceHolder::ListenToMessage(MessageT inMessage, void * ioParam)
00859 {
00860     if(inMessage == fController)
00861     {
00862         SInt32 currPageIndex = *static_cast<SInt32 *>(ioParam);
00863         DoRotate(currPageIndex - 1);
00864     }
00865 }
00866
00867 void UPseudoPlaceHolder::FinishCreateSelf(void)
00868 {
00869     DoRotate(0);
00870
00871     LWindow *win = macpp_findwindow(this);
00872     if(win == 0L)
00873         return;
00874
00875     LPageController *controller = dynamic_cast<LPageController*>(win->FindPaneByID(fController));
00876     if (controller != 0L)
00877     {
00878         controller->StartBroadcasting ();
00879         controller->AddListener (this);
00880     }
00881     LTabsControl *controller2 = dynamic_cast<LTabsControl*>(win->FindPaneByID(fController));
00882     if (controller2 != 0L)
00883     {
00884         controller2->StartBroadcasting ();
00885         controller2->AddListener (this);
00886     }
00887 }
00888
00889 UPseudoPageHider::UPseudoPageHider(LStream *inStream) : LAttachment(inStream),
00890     fWidid(-1), fCurSel(-1), fPageCtrl(0L)
00891 {
00892     SetMessage(msg_FinishCreate);
00893
00894     LStr255 pstr;
00895     inStream->ReadPString(pstr);
00896
00897     UStr str(pstr);
00898     const char *ptr = str;
00899     while(ptr != 0L)
00900     {
00901         PaneIDT paneID;
00902         const char *tmp = strchr(ptr, ',');
00903         if(tmp != 0L)
00904         {
00905             UStr stmp;
00906             size_t offset = tmp - ptr;
00907             stmp.set(ptr, offset);
00908             ptr += offset + 1;
00909             if(stmp.length() == 4)
00910             {
00911                 paneID = *(PaneIDT *)(char *)stmp;
00912                 fViewSuite.push_back(paneID);
00913             }
00914         }
00915         else
00916         {
00917             if(strlen(ptr) == 4)
00918             {
00919                 paneID = *(PaneIDT *)ptr;
00920                 fViewSuite.push_back(paneID);
00921             }
00922             ptr = 0L;
00923         }
00924     }
00925 }
00926
00927 void    UPseudoPageHider::ExecuteSelf(
00928                         MessageT        inMessage,
00929                         void*           ioParam)
00930 {
00931     if(inMessage == msg_FinishCreate)
00932     {
00933         LPane *pane = reinterpret_cast<LPane*>(ioParam);
00934         fPageCtrl = dynamic_cast<LPageController*>(pane);
00935         if(fPageCtrl == 0L)
00936         {
00937             UAppConsole("The UPseudoPageHider attachement does not have any LPageController to attach to.");
00938         }
00939         else
00940         {
00941             // add ourself to the broadcast so we receive the changes
00942             fPageCtrl->StartBroadcasting ();
00943             fPageCtrl->AddListener (this);
00944         }
00945     }
00946 }
00947
00948 UPseudoPageHider::~UPseudoPageHider()
00949 {
00950 }
00951
00952 void UPseudoPageHider::DoRotate(int entry)
00953 {
00954     if(fPageCtrl == 0L)
00955         return;
00956
00957     int cmdid;
00958     if(macpp_getcmdid(fPageCtrl->GetPaneID(), cmdid) && entry >= 0 && entry < fViewSuite.size() &&
00959         entry != fCurSel)
00960     {
00961         fCurSel = entry;
00962
00963         LWindow *win = macpp_findwindow(fPageCtrl);
00964         if(win == 0L)
00965             return;
00966
00967         LPane* samplePanel;
00968         std::vector<PaneIDT>::iterator i;
00969         for(i = fViewSuite.begin(); i != fViewSuite.end(); ++i)
00970         {
00971             samplePanel = win->FindPaneByID(*i);
00972             if(samplePanel != 0L)
00973                 samplePanel->Hide();
00974         }
00975
00976         samplePanel = win->FindPaneByID(fViewSuite[entry]);
00977         if(samplePanel == 0L)
00978             return;
00979
00980         samplePanel->Show();
00981
00982         if(fWidid != -1)
00983             UEventSendMessage(fWidid, EV_CMD, cmdid, (void *)entry);
00984     }
00985 }
00986
00987 void UPseudoPageHider::ListenToMessage(MessageT inMessage, void * ioParam)
00988 {
00989     if(fPageCtrl != 0L && inMessage == fPageCtrl->GetPaneID())
00990     {
00991         SInt32 currPageIndex = *static_cast<SInt32 *>(ioParam);
00992         DoRotate(currPageIndex - 1);
00993     }
00994 }
00995
00996 UPseudoFakePane::UPseudoFakePane(const SPaneInfo    &inPaneInfo, LPseudoWinAttachment *inAttach) :
00997     LPane(inPaneInfo), m_Attach(inAttach)
00998 {
00999 }
01000
01001 UPseudoFakePane::~UPseudoFakePane()
01002 {
01003 }
01004
01005 void UPseudoFakePane::ActivateSelf()
01006 {
01007     UEventNotifyMessage(EV_UPDATEFOCUS, 0, dynamic_cast<LWindow *>(GetSuperView()));
01008 }
01009
01010 void UPseudoFakePane::DeactivateSelf()
01011 {
01012     UEventNotifyMessage(EV_UPDATEFOCUS, 1, dynamic_cast<LWindow *>(GetSuperView()));
01013 }
01014
01015 void UPseudoFakePane::AdaptToSuperFrameSize(
01016                             SInt32      inSurrWidthDelta,
01017                             SInt32      inSurrHeightDelta,
01018                             Boolean     inRefresh)
01019 {
01020     LPane::AdaptToSuperFrameSize(inSurrWidthDelta, inSurrHeightDelta, inRefresh);
01021
01022     m_Attach->CheckWindowSize();
01023 }
01024
01025
01026 class CDummyClass
01027 {
01028 public:
01029     CDummyClass()
01030     {
01031         RegisterClass_(UPseudoRotButton);
01032         RegisterClass_(UPseudoPlaceHolder);
01033         RegisterClass_(UPseudoPageHider);
01034     }
01035
01036 } sDummyStarter;
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPseudoSupport.h File Reference

rf/support/powerplant/UPseudoSupport.h File Reference

#include "uwidget.h"
#include <LOutlineItem.h>
#include <LCmdBevelButton.h>
#include <LPlaceHolder.h>
#include <map>
#include <vector>

Include dependency graph for UPseudoSupport.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | LMainPseudoAttachment
class | LPseudoWinAttachment
struct | UPseudoCmdStatusWrapper
class | UPseudoFakePane
class | CPseudoItem
class | UPseudoPageHider
class | UPseudoPlaceHolder
class | UPseudoRotButton

Defines

#define | UTextTableView_SingleClick FOUR_CHAR_CODE('UTVS')
#define | UTextTableView_DoubleClick FOUR_CHAR_CODE('UTVD')

Functions

void | macpp_fecthview (int widid, LPane *view)
void | macpp_linkbroadcasters (LPane *view, LListener *listener)
void | macpp_preparetable (LOutlineTable *table)
void | macpp_preparetable (void *win, LTextTableView *table)
LPseudoWinAttachment * | macpp_getattachwindow (UWidget *wid)
LPseudoWinAttachment * | macpp_getattachwindow (LWindow *wind)

Variables

bool | gTurnOffBroadcast

Define Documentation

#define UTextTableView_DoubleClick FOUR_CHAR_CODE('UTVD')

Definition at line 201 of file UPseudoSupport.h.

#define UTextTableView_SingleClick FOUR_CHAR_CODE('UTVS')

Definition at line 200 of file UPseudoSupport.h.

Function Documentation

void macpp_fecthview | ( | int | widid,
 |  | LPane * | view
 | ) |

Definition at line 144 of file UPseudoSupport.cpp.

Referenced by UWidget::OnInitWidget(), and UWidget::OnPageChanged().

00145 {
00146     int cmdid;
00147     if(macpp_getcmdid(pane, cmdid))
00148     {
00149         UEventSendMessage(widid, EV_INIT_WIDGET, cmdid, pane);
00150
00151         // look for any attachement we know of
00152         const TArray<LAttachment*>* theAttachments = pane->GetAttachmentsList();
00153         if (theAttachments != nil)
00154         {
00155             TArrayIterator<LAttachment*> iterate(*theAttachments);
00156
00157             LAttachment*    theAttach;
00158             while (iterate.Next(theAttach))
00159             {
00160                 UPseudoPageHider *hider = dynamic_cast<UPseudoPageHider*>(theAttach);
00161                 if(hider != 0L)
00162                     hider->SetWidID(widid);
00163             }
00164         }
00165
00166         // for any control, set the broadcast message to be the Pane ID
00167         LControl *control = dynamic_cast<LControl*>(pane);
00168         if(control != 0L && control->GetValueMessage() == 0)
00169         {
00170             control->SetValueMessage(pane->GetPaneID());
00171         }
00172
00173         // idem
00174         LCheckBoxGroupBox *groupbox = dynamic_cast<LCheckBoxGroupBox*>(pane);
00175         if(groupbox != 0L && groupbox->GetValueMessage() == 0)
00176         {
00177             groupbox->SetValueMessage(pane->GetPaneID());
00178         }
00179
00180         // set the widget id for some custom controls
00181         UPseudoPlaceHolder *holder = dynamic_cast<UPseudoPlaceHolder*>(pane);
00182         if(holder != 0L)
00183         {
00184             holder->SetWidID(widid);
00185             return; // don't fetch inside, it'll be owned by another pseudo widget
00186         }
00187
00188         // this attachment let us fire a EV_CUSTOM_DRAW event when painting
00189         if(typeid(*pane) == typeid(LView))
00190         {
00191             LPseudoDrawAttachment *attach = NEW LPseudoDrawAttachment(widid, cmdid);
00192             pane->AddAttachment(attach);
00193         }
00194     }
00195
00196     // menus with an unspecified menu id need to be created if we want to use
00197     // later on the EV_COMBO_APPEND message on it.
00198     LPopupButton *controler = dynamic_cast<LPopupButton*>(pane);
00199     if(controler != 0L)
00200     {
00201         if(controler->GetMenuID() == MENU_Unspecified && controler->GetMacMenuH() == 0L)
00202             controler->SetMacMenuH(::NewMenu(::UniqueID('MENU'), "\p"), true);
00203     }
00204
00205     // recurse
00206     LView *view = dynamic_cast<LView*>(pane);
00207     if(view == 0L)
00208         return;
00209
00210     TArrayIterator<LPane*> iterator(view->GetSubPanes());
00211     LPane   *theSub;
00212     while (iterator.Next(theSub))
00213     {
00214         macpp_fecthview(widid, theSub);
00215     }
00216 }

LPseudoWinAttachment* macpp_getattachwindow ( LWindow * wind )

Definition at line 120 of file UPseudoSupport.cpp.

Referenced by UWidget::OnGetSliderProperty(), UWidget::OnPageChanged(), UWidget::OnSetSliderProperty(), and macpp_getattachwindow().

00121 {
00122     if(wind != 0L)
00123     {
00124         const TArray<LAttachment*>* theAttachments = wind->GetAttachmentsList();
00125
00126         if (theAttachments != nil)
00127         {
00128             TArrayIterator<LAttachment*> iterate(*theAttachments);
00129
00130             LAttachment*    theAttach;
00131             while (iterate.Next(theAttach))
00132             {
00133                 LPseudoWinAttachment*   theWinAttach = dynamic_cast<LPseudoWinAttachment*>(theAttach);
00134                 if (theWinAttach != nil)
00135                 {
00136                     return theWinAttach;
00137                 }
00138             }
00139         }
00140     }
00141     return 0L;
00142 }

LPseudoWinAttachment* macpp_getattachwindow ( UWidget * wid )

void macpp_linkbroadcasters | ( | LPane * | view,
 |  | LListener * | listener
 | ) |

Definition at line 218 of file UPseudoSupport.cpp.

Referenced by UWidget::OnInitWidget(), and UWidget::OnPageChanged().

00219 {
00220     LBroadcaster *broadcaster = dynamic_cast<LBroadcaster *>(pane);
00221     if(broadcaster != 0L && !broadcaster->HasListener(listener))
00222         broadcaster->AddListener(listener);
00223
00224     LView *view = dynamic_cast<LView*>(pane);
00225     if(view == 0L)
00226         return;
00227
00228     TArrayIterator<LPane*> iterator(view->GetSubPanes());
00229     LPane   *theSub;
00230     while (iterator.Next(theSub))
00231     {
00232         macpp_linkbroadcasters(theSub, listener);
00233     }
00234 }

void macpp_preparetable | ( | void * | win,
 |  | LTextTableView * | table
 | ) |

Definition at line 255 of file UPseudoSupport.cpp.

Referenced by UWidget::OnListAddColumns(), UWidget::OnListResetAll(), and UWidget::OnListSetColWidth().

00256 {
00257     if(table->GetTableGeometry() != 0L)
00258         return;
00259
00260     SDimension16    tableSize;
00261     table->SetCellSizer(NEW LCellSizeToFit());
00262     table->GetFrameSize(tableSize);
00263     table->SetTableGeometry(NEW LTableMonoGeometry(table,
00264         tableSize.width/1 /* col width = width/num Cols */,
00265         12  /* row height */));
00266     table->SetTableSelector(NEW LTableSingleRowSelector( table ));
00267     table->SetTableStorage(NEW LTableArrayStorage(table, (UInt32)0));
00268     table->SetDoubleClickMessage(UTextTableView_DoubleClick);
00269     table->SetSingleClickMessage(UTextTableView_SingleClick);
00270     table->SetCustomHilite(true); // cause there is a hilite bug if we don't
00271 }

void macpp_preparetable ( LOutlineTable * table )

Variable Documentation

bool gTurnOffBroadcast

Definition at line 12 of file UPseudoSupport.h.

Generated on Sun Oct 21 12:44:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rf/support/powerplant/UPseudoSupport.h Source File

rf/support/powerplant/UPseudoSupport.h

Go to the documentation of this file.
00001 #ifndef UPSEUDOSUPPORT_H
00002 #define UPSEUDOSUPPORT_H
00003
00004 #include "uwidget.h"
00005 #include <LOutlineItem.h>
00006 #include <LCmdBevelButton.h>
00007 #include <LPlaceHolder.h>
00008
00009 #include <map>
00010 #include <vector>
00011
00012 extern bool gTurnOffBroadcast;
00013
00014 struct UPseudoCmdStatusWrapper
00015 {
00016     Boolean *outEnabled;
00017     Boolean *outUsesMark;
00018     UInt16 *outMark;
00019     unsigned char *outName;
00020 };
00021
00022 class UPseudoRotButton : public LBevelButton
00023 {
00024 public:
00025     enum { class_ID = FOUR_CHAR_CODE('UPRB') };
00026
00027     UPseudoRotButton(LStream *inStream, ClassIDT inImpID = LBevelButton::imp_class_ID);
00028     virtual ~UPseudoRotButton();
00029
00030     virtual void DoRotate(int icon, bool refresh = true);
00031     inline int GetCurrentState(void) const { return fCurrentIcon; }
00032 protected:
00033     void ReadIconsID(LStream *inStream, std::vector<short> & res);
00034
00035     std::vector<short> fIconSuite;
00036     int fCurrentIcon;
00037 };
00038
00039 class UPseudoPlaceHolder : public LPlaceHolder, public LListener
00040 {
00041 public:
00042     enum { class_ID = FOUR_CHAR_CODE('UPLH') };
00043
00044     UPseudoPlaceHolder(LStream *inStream);
00045     virtual ~UPseudoPlaceHolder();
00046
00047     void DoRotate(int entry);
00048     inline void SetWidID(int widid) { fWidid = widid; }
00049     inline LView *GetCurrentView(void) { return fCurrentView; }
00050
00051     virtual void    ListenToMessage(
00052                             MessageT        inMessage,
00053                             void*           ioParam);
00054
00055 protected:
00056     virtual void    FinishCreateSelf();
00057
00058     std::vector<short> fViewSuite;
00059     LView *fCurrentView;
00060     PaneIDT fController;
00061     int fWidid;
00062 };
00063
00064 class UPseudoPageHider : public LAttachment, public LListener
00065 {
00066 public:
00067     enum { class_ID = FOUR_CHAR_CODE('UPPH') };
00068
00069     UPseudoPageHider(LStream *inStream);
00070     virtual ~UPseudoPageHider();
00071
00072     inline void SetWidID(int widid) { fWidid = widid; }
00073
00074     virtual void    ListenToMessage(
00075                             MessageT        inMessage,
00076                             void*           ioParam);
00077
00078 protected:
00079     void DoRotate(int entry);
00080
00081     virtual void    ExecuteSelf(
00082                             MessageT        inMessage,
00083                             void*           ioParam);
00084
00085     std::vector<PaneIDT> fViewSuite;
00086     int fWidid;
00087     int fCurSel;
00088     class LPageController *fPageCtrl;
00089 };
00090
00091 class LMainPseudoAttachment : public LAttachment, public LPeriodical
00092 {
00093 public:
00094     LMainPseudoAttachment();
00095     virtual ~LMainPseudoAttachment();
00096
00097     virtual void        SpendTime(
00098                                 const EventRecord&  inMacEvent);
00099
00100 protected:
00101     virtual void    ExecuteSelf(
00102                             MessageT        inMessage,
00103                             void*           ioParam);
00104 };
00105
00106 class LPseudoWinAttachment : public LAttachment, public LListener
00107 {
00108 public:
00109     LPseudoWinAttachment(int widid);
00110     virtual ~LPseudoWinAttachment();
00111
00112     int GetPageValue(int cmdid) const;
00113     void SetPageValue(int cmdid, int value);
00114
00115     void CheckWindowSize(void);
00116
00117     int SearchWidID(LPane *pane);
00118         // since several pseudo-widgets can be attached to
00119         // the window (ex: tab controller), we need to search
00120         // for the correct Widget to broadcast the event.
00121
00122     void InvalidCache(UWidget *tab_wid);
00123         // when a view is removed (from a tab window)
00124         // we need to invalidate the cache used by 'SearchWidID'.
00125
00126 protected:
00127     virtual void    ExecuteSelf(
00128                             MessageT        inMessage,
00129                             void*           ioParam);
00130     virtual void    ListenToMessage(
00131                             MessageT        inMessage,
00132                             void*           ioParam);
00133
00134     int m_widid;
00135     Rect m_lastRect;
00136     std::map<int, int> m_PageValues;
00137     std::map<LPane *, int> m_CacheWidgets;
00138 };
00139
00140 class UPseudoFakePane : public LPane
00141 {
00142 public:
00143     UPseudoFakePane(const SPaneInfo &inPaneInfo, LPseudoWinAttachment *inAttach);
00144     virtual ~UPseudoFakePane();
00145
00146     virtual void        AdaptToSuperFrameSize(
00147                                 SInt32      inSurrWidthDelta,
00148                                 SInt32      inSurrHeightDelta,
00149                                 Boolean     inRefresh);
00150
00151 protected:
00152     LPseudoWinAttachment *m_Attach;
00153
00154     virtual void        ActivateSelf();
00155     virtual void        DeactivateSelf();
00156 };
00157
00158 class CPseudoItem : public LOutlineItem
00159 {
00160 public:
00161     CPseudoItem(int widid, int cmdid);
00162     virtual ~CPseudoItem();
00163
00164     std::map<int, UStr> m_texts;
00165     void *m_data;
00166
00167 protected:
00168     virtual void GetDrawContentsSelf(const STableCell& inCell, SOutlineDrawContents& ioDrawContents);
00169
00170     virtual void DrawRowAdornments(const Rect& inLocalRowRect);
00171     virtual void            DrawCell(
00172                                     const STableCell&       inCell,
00173                                     const Rect&             inLocalCellRect);
00174
00175     virtual void DoubleClick(const STableCell& inCell, const SMouseDownEvent& inMouseDown,
00176         const SOutlineDrawContents& inDrawContents, Boolean inHitText);
00177     virtual void            SingleClick(
00178                                     const STableCell&           inCell,
00179                                     const SMouseDownEvent&      inMouseDown,
00180                                     const SOutlineDrawContents& inDrawContents,
00181                                     Boolean                     inHitText);
00182
00183     int m_widid, m_cmdid;
00184 private:
00185     // defensive programming
00186     CPseudoItem();
00187     CPseudoItem( const CPseudoItem &inOriginal );
00188     CPseudoItem&    operator=( const CPseudoItem &inOriginal );
00189 };
00190
00191 class LTextTableView;
00192
00193 extern void macpp_fecthview(int widid, LPane *view);
00194 extern void macpp_linkbroadcasters(LPane *view, LListener *listener);
00195 extern void macpp_preparetable(LOutlineTable *table);
00196 extern void macpp_preparetable(void *win, LTextTableView *table);
00197 extern LPseudoWinAttachment *macpp_getattachwindow(UWidget *wid);
00198 extern LPseudoWinAttachment *macpp_getattachwindow(LWindow *wind);
00199
00200 #define UTextTableView_SingleClick FOUR_CHAR_CODE('UTVS')
00201 #define UTextTableView_DoubleClick FOUR_CHAR_CODE('UTVD')
00202
00203 #endif
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/BrowseFileView.cpp Source File

WinCvs/BrowseFileView.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 /*
00022  * BrowseFileView.cpp -- Implements the view with all the files
00023  *
00024  */
00025
00026 #include "stdafx.h"
00027 #include <process.h>
00028 #include <vector>
00029 #include <IO.h>
00030 #include "wincvs.h"
00031
00032 #include "BrowseFileView.h"
00033 #include "FileTraversal.h"
00034 #include "CvsCommands.h"
00035 #include "MultiFiles.h"
00036 #include "CvsArgs.h"
00037 #include "AppConsole.h"
00038 #include "CvsPrefs.h"
00039 #include "CvsIgnore.h"
00040 #include "TclGlue.h"
00041 #include "MacrosSetup.h"
00042 #include "MoveToTrash.h"
00043 #include "WinCvsBrowser.h"
00044 #include "MainFrm.h"
00045 #include "wincvs_winutil.h"
00046 #include "BrowseViewModel.h"
00047 #include "BrowseViewHandlers.h"
00048 #include "FileViewWatcher.h"
00049 #include "BrowseViewColumn.h"
00050 #include "PythonGlue.h"
00051
00052 #include "umain.h"
00053
00054 #ifdef _DEBUG
00055 #define new DEBUG_NEW
00056 #undef THIS_FILE
00057 static char THIS_FILE[] = __FILE__;
00058 #endif
00059
00060 static const int FILECHANGE_TIMER = 999;
00061 static const int kSpc = 3;
00062 static const int WM_RESETVIEW = WM_APP + 12;
00063
00064 // persistent values
00065 CPersistentInt gFileViewSort("P_FileViewSort", EntnodeData::kName);
00066 CPersistentBool gFileViewSortAsc("P_FileViewSortAsc", false);
00067
00069 // CBrowseFileView
00070
00071 IMPLEMENT_DYNCREATE(CBrowseFileView, CListView)
00072
00073 BEGIN_MESSAGE_MAP(CBrowseFileView, CListView)
00074     //{{AFX_MSG_MAP(CBrowseFileView)
00075     ON_COMMAND(ID_VIEW_SMALLICONS, OnViewSmallIcons)
00076     ON_COMMAND(ID_VIEW_FULLLIST, OnViewList)
00077     ON_COMMAND(ID_VIEW_ROWDETAILS, OnViewFullRowDetails)
00078     ON_UPDATE_COMMAND_UI(ID_VIEW_SMALLICONS, OnUpdateViewSmallIcons)
00079     ON_UPDATE_COMMAND_UI(ID_VIEW_ADD, OnUpdateViewAdd)
00080     ON_UPDATE_COMMAND_UI(ID_VIEW_ADDB, OnUpdateViewAddB)
00081     ON_UPDATE_COMMAND_UI(ID_VIEW_COMMIT, OnUpdateViewUpdate)
00082     ON_UPDATE_COMMAND_UI(ID_VIEW_RELEASE, OnUpdateViewRelease)
00083     ON_UPDATE_COMMAND_UI(ID_VIEW_RMV, OnUpdateViewRmv)
00084     ON_UPDATE_COMMAND_UI(ID_VIEW_GRAPH, OnUpdateViewGraph)
00085     ON_UPDATE_COMMAND_UI(ID_VIEW_FULLLIST, OnUpdateViewList)
00086     ON_UPDATE_COMMAND_UI(ID_VIEW_EDITSELDEF, OnUpdateViewEditseldef)
00087     ON_UPDATE_COMMAND_UI(ID_VIEW_ROWDETAILS, OnUpdateViewFullRowDetails)
00088     ON_WM_LBUTTONDOWN()
00089     ON_WM_LBUTTONDBLCLK()
00090     ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
00091     ON_COMMAND(ID_VIEW_ADD, OnViewAdd)
00092     ON_COMMAND(ID_VIEW_ADDB, OnViewAddb)
00093     ON_COMMAND(ID_VIEW_COMMIT, OnViewCommit)
00094     ON_COMMAND(ID_VIEW_RMV, OnViewRmv)
00095     ON_COMMAND(ID_VIEW_UPDATE, OnViewUpdate)
00096     ON_COMMAND(ID_VIEW_QUERYUPDATE, OnViewQueryUpdate)
00097     ON_UPDATE_COMMAND_UI(ID_VIEW_RELOAD, OnUpdateViewReload)
00098     ON_COMMAND(ID_VIEW_RELOAD, OnViewReload)
00099     ON_NOTIFY_REFLECT(LVN_KEYDOWN, OnKeydown)
00100     ON_COMMAND(ID_VIEW_UPONE, OnViewUpone)
00101     ON_UPDATE_COMMAND_UI(ID_VIEW_UPONE, OnUpdateViewUpone)
00102     ON_COMMAND(ID_VIEW_TRASH, OnViewTrash)
00103     ON_UPDATE_COMMAND_UI(ID_VIEW_TRASH, OnUpdateViewTrash)
00104     ON_COMMAND(ID_VIEW_DIFF, OnViewDiff)
00105     ON_COMMAND(ID_VIEW_LOG, OnViewLog)
00106     ON_COMMAND(ID_VIEW_GRAPH, OnViewGraph)
00107     ON_COMMAND(ID_VIEW_STATUS, OnViewStatus)
00108     ON_COMMAND(ID_VIEW_LOCKF, OnViewLock)
00109     ON_COMMAND(ID_VIEW_UNLOCKF, OnViewUnlock)
00110     ON_COMMAND(ID_VIEW_WATCHON, OnViewWatchOn)
00111     ON_COMMAND(ID_VIEW_WATCHOFF, OnViewWatchOff)
00112     ON_COMMAND(ID_VIEW_EDIT, OnViewEdit)
00113     ON_COMMAND(ID_VIEW_UNEDIT, OnViewUnedit)
00114     ON_COMMAND(ID_VIEW_WATCHERS, OnViewWatchers)
00115     ON_COMMAND(ID_VIEW_EDITORS, OnViewEditors)
00116     ON_COMMAND(ID_VIEW_RELEASE, OnViewRelease)
00117     ON_COMMAND(ID_VIEW_TAGNEW, OnViewTagNew)
00118     ON_COMMAND(ID_VIEW_TAGDELETE, OnViewTagDelete)
00119     ON_COMMAND(ID_VIEW_TAGBRANCH, OnViewTagBranch)
00120     ON_WM_RBUTTONDOWN()
00121     ON_COMMAND(ID_VIEW_EXPLORE, OnViewExplore)
00122     ON_UPDATE_COMMAND_UI(ID_VIEW_EXPLORE, OnUpdateViewExplore)
00123     ON_WM_TIMER()
00124     ON_COMMAND(ID_VIEW_EDITSEL, OnViewEditsel)
00125     ON_COMMAND(ID_VIEW_EDITSELDEF, OnViewEditseldef)
00126     ON_COMMAND(ID_VIEW_CHECKOUT, OnViewCheckout)
00127     ON_UPDATE_COMMAND_UI(ID_VIEW_CHECKOUT, OnUpdateViewCheckout)
00128     ON_COMMAND(ID_VIEW_IMPORT, OnViewImport)
00129     ON_UPDATE_COMMAND_UI(ID_VIEW_IMPORT, OnUpdateViewImport)
00130     ON_NOTIFY_REFLECT(LVN_BEGINDRAG, OnBegindrag)
00131     ON_NOTIFY_REFLECT(LVN_BEGINRDRAG, OnBeginrdrag)
00132     ON_WM_SETCURSOR()
00133     ON_NOTIFY_REFLECT(LVN_DELETEITEM, OnDeleteitem)
00134     ON_WM_DESTROY()
00135     ON_UPDATE_COMMAND_UI(ID_QUERY_ANNOTATE, OnUpdateQueryAnnotate)
00136     ON_COMMAND(ID_QUERY_ANNOTATE, OnQueryAnnotate)
00137     ON_UPDATE_COMMAND_UI(ID_VIEW_DIFF, OnUpdateViewUpdate)
00138     ON_UPDATE_COMMAND_UI(ID_VIEW_EDIT, OnUpdateViewUpdate)
00139     ON_UPDATE_COMMAND_UI(ID_VIEW_EDITORS, OnUpdateViewUpdate)
00140     ON_UPDATE_COMMAND_UI(ID_VIEW_LOCKF, OnUpdateViewUpdate)
00141     ON_UPDATE_COMMAND_UI(ID_VIEW_LOG, OnUpdateViewUpdate)
00142     ON_UPDATE_COMMAND_UI(ID_VIEW_TAGNEW, OnUpdateViewUpdate)
00143     ON_UPDATE_COMMAND_UI(ID_VIEW_TAGDELETE, OnUpdateViewUpdate)
00144     ON_UPDATE_COMMAND_UI(ID_VIEW_TAGBRANCH, OnUpdateViewUpdate)
00145     ON_UPDATE_COMMAND_UI(ID_VIEW_STATUS, OnUpdateViewUpdate)
00146     ON_UPDATE_COMMAND_UI(ID_VIEW_UNEDIT, OnUpdateViewUpdate)
00147     ON_UPDATE_COMMAND_UI(ID_VIEW_UPDATE, OnUpdateViewUpdate)
00148     ON_UPDATE_COMMAND_UI(ID_VIEW_QUERYUPDATE, OnUpdateViewUpdate)
00149     ON_UPDATE_COMMAND_UI(ID_VIEW_UNLOCKF, OnUpdateViewUpdate)
00150     ON_UPDATE_COMMAND_UI(ID_VIEW_WATCHERS, OnUpdateViewUpdate)
00151     ON_UPDATE_COMMAND_UI(ID_VIEW_WATCHON, OnUpdateViewUpdate)
00152     ON_UPDATE_COMMAND_UI(ID_VIEW_WATCHOFF, OnUpdateViewUpdate)
00153     ON_UPDATE_COMMAND_UI(ID_VIEW_EDITSEL, OnUpdateViewTrash)
00154     ON_COMMAND(ID_EDIT_SELECT_ALL, OnEditSelectAll)
00155     //}}AFX_MSG_MAP
00156     ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
00157     ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
00158     ON_UPDATE_COMMAND_UI_RANGE(ID_MACRO_START, ID_MACRO_END, OnUpdateMacro)
00159     ON_COMMAND_EX_RANGE(ID_MACRO_START, ID_MACRO_END, OnMacro)
00160     ON_UPDATE_COMMAND_UI_RANGE(ID_CUST_FILES_MENU, ID_CUST_FOLDER_MENU, OnUpdateCustomize)
00161     ON_COMMAND_EX_RANGE(ID_CUST_FILES_MENU, ID_CUST_FOLDER_MENU, OnCustomize)
00162     ON_MESSAGE(KoWatcher::WM_FILECHANGE, OnFileChange)
00163     ON_MESSAGE(WM_RESETVIEW, OnResetView)
00164
00165 END_MESSAGE_MAP()
00166
00167 CImageList CBrowseFileView::m_SmallImageList;
00168 CImageList CBrowseFileView::m_StateImageList;
00169
00170 // context for traversing
00171 class KoTraversalContext
00172 {
00173     bool m_isRecursive;
00174     bool m_isShowIgnored;
00175     KiFilterModel* m_filter;
00176
00177 public:
00178     CBrowseFileView* m_view;
00179
00180
00181     KoTraversalContext(CBrowseFileView* view)
00182     : m_view(view), m_filter(NULL), m_isRecursive(false), m_isShowIgnored(false)
00183     {
00184         if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
00185         {
00186             m_filter = app->GetFilterModel();
00187             m_isRecursive = app->GetRecursionModel()->IsShowRecursive();
00188             m_isShowIgnored = app->GetIgnoreModel()->IsShowIgnored();
00189         }
00190     }
00191
00192     bool IsRecursive() const
00193     {
00194         return m_isRecursive;
00195     }
00196
00197     bool IsShowIgnored() const
00198     {
00199         return m_isShowIgnored;
00200     }
00201
00202     bool IsMatch(EntnodeData* data) const
00203     {
00204         return m_filter->IsMatch(data);
00205     }
00206 };
00207
00208 class TViewFill : public TraversalReport
00209 {
00210 public:
00211     CSortList<ENTNODE> m_entries;
00212     vector<CStr> m_ignlist;
00213     const KoTraversalContext* m_context;
00214
00215     TViewFill(const KoTraversalContext* context)
00216     : m_context(context)
00217     , m_entries(200, ENTNODE::Compare)
00218     { }
00219
00220     CBrowseFileView* GetView() const
00221     {
00222         return m_context->m_view;
00223     }
00224
00225     CListCtrl& GetListCtrl() const
00226     {
00227         return GetView()->GetListCtrl();
00228     }
00229
00230     bool IsRecursive() const
00231     {
00232         return m_context->IsRecursive();
00233     }
00234
00235     bool IsShowIgnored() const
00236     {
00237         return m_context->IsShowIgnored();
00238     }
00239
00240     virtual kTraversal EnterDirectory(const char *fullpath, const char *dirname, const FSSpec * macspec)
00241     {
00242         Entries_Open (m_entries, fullpath);
00243         BuildIgnoredList(m_ignlist, fullpath);
00244         return kContinueTraversal;
00245     }
00246
00247     virtual kTraversal ExitDirectory(const char *fullpath)
00248     {
00249         // add the missing files
00250         Entries_SetMissing(m_entries);
00251
00252         int numEntries = m_entries.NumOfElements();
00253         for(int i = 0; i < numEntries; i++)
00254         {
00255             const ENTNODE & theNode = m_entries.Get(i);
00256             EntnodeData *data = theNode.Data();
00257             if (data->IsMissing() && m_context->IsMatch(data))
00258             {
00259                 if (!IsRecursive() || data->GetType() == ENT_FILE)
00260                 {
00261                     int iImage = data->GetType() == ENT_FILE ?
00262                                 (data->IsRemoved() ? kFileIconRemoved : kFileIconMiss) : kFolderIconMiss;
00263                     InitItem(data, iImage);
00264                 }
00265             }
00266         }
00267
00268         m_ignlist.clear();
00269         return kContinueTraversal;
00270     }
00271
00272     // initializes and adds new item to list view
00273     int InitItem(EntnodeData *data, int iImage, const char *tag = 0L)
00274     {
00275         CListCtrl& listCtrl = GetListCtrl();
00276         KoColumnContext context(GetView()->GetPath());
00277         TCHAR buf[256];
00278         GetView()->GetColumnModel()->GetAt(0)->GetText(&context, data, buf, 256);
00279
00280         LV_ITEM lvi;
00281         lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
00282         lvi.iItem = listCtrl.GetItemCount();
00283         lvi.iSubItem = 0;
00284         lvi.pszText = buf;
00285         lvi.iImage = iImage;
00286         lvi.lParam = (LPARAM)(LPVOID)data;
00287         int pos = listCtrl.InsertItem(&lvi);
00288         if (pos >= 0)
00289         {
00290             // note ownership addition
00291             data->Ref();
00292
00293             // set item text for additional columns
00294             KiColumnModel* model = GetView()->GetColumnModel();
00295             int columnCount = model->GetCount();
00296             for(int j = 1; j < columnCount; j++)
00297             {
00298                 TCHAR buf[256];
00299                 model->GetAt(j)->GetText(&context, data, buf, 256);
00300                 listCtrl.SetItemText(pos, j, buf);
00301             }
00302
00303             if(tag != 0L && tag[0] != '\0' && !IsRecursive())
00304                 listCtrl.SetItemText(pos, EntnodeFile::kTag, tag);
00305         }
00306         return pos;
00307     }
00308
00309
00310     virtual kTraversal OnError(const char *err, int errcode)
00311     {
00312         return kTraversalError;
00313     }
00314
00315     virtual kTraversal OnIdle(const char *fullpath)
00316     {
00317         return kContinueTraversal;
00318     }
00319
00320     virtual kTraversal OnDirectory(const char *fullpath,
00321         const char *fullname,
00322         const char *name,
00323         const struct stat & dir, const FSSpec * macspec)
00324     {
00325         if(stricmp(name, "CVS") == 0)
00326             return kSkipFile;
00327
00328         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00329         if (!IsShowIgnored() && data->IsIgnored())
00330         {
00331             return kSkipFile;
00332         }
00333
00334         if (IsRecursive())
00335         {
00336             if (!data->IsIgnored() && !data->IsUnknown() && !data->IsMissing())
00337             {
00338                 TViewFill traverse(m_context);
00339                 FileTraverse(fullname, traverse);
00340             }
00341             return kSkipFile;
00342         }
00343
00344         // get the tag
00345         CStr subCVS;
00346         CStr tagName;
00347         subCVS = fullname;
00348         if(!subCVS.endsWith(kPathDelimiter))
00349             subCVS << kPathDelimiter;
00350         subCVS << "CVS";
00351         Tag_Open(tagName, subCVS);
00352
00353         InitItem(data, CBrowseFileView::GetImageForEntry(data), tagName);
00354         return kSkipFile;
00355     }
00356
00357     virtual kTraversal OnAlias(const char *fullpath,
00358         const char *fullname,
00359         const char *name,
00360         const struct stat & dir, const FSSpec * macspec)
00361     {
00362         return OnFile(fullpath, fullname, name, dir, macspec);
00363     }
00364
00365     virtual kTraversal OnFile(const char *fullpath,
00366         const char *fullname,
00367         const char *name,
00368         const struct stat & dir, const FSSpec * macspec)
00369     {
00370         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, false, &m_ignlist);
00371         if(!IsShowIgnored() && data->IsIgnored())
00372             return kContinueTraversal;
00373
00374         if (m_context->IsMatch(data))
00375         {
00376             int pos = InitItem(data, CBrowseFileView::GetImageForEntry(data));
00377             if (pos >=  0)
00378             {
00379                 UINT state = data->IsLocked() ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1);
00380                 CListCtrl& listCtrl = GetListCtrl();
00381                 listCtrl.SetItemState(pos, state, LVIS_STATEIMAGEMASK);
00382             }
00383         }
00384         return kContinueTraversal;
00385     }
00386 };
00387
00389 // CBrowseFileView construction/destruction
00390
00391 CBrowseFileView::CBrowseFileView()
00392 : m_checkChanges(false)
00393 , m_watch(NULL)
00394 , m_isResetViewLocked(false)
00395 , m_isFilesChange(false)
00396 , m_isResetViewPending(false)
00397 , m_uiFilechangeTimer(0)
00398 {
00399     m_sort = (int)gFileViewSort;
00400     SetRecursive(false);
00401     m_ascendant = (bool)gFileViewSortAsc;
00402     m_entriesMod = 0;
00403     m_entriesLogMod = 0;
00404 }
00405
00406 CBrowseFileView::~CBrowseFileView()
00407 {
00408     gFileViewSortAsc = m_ascendant;
00409     gFileViewSort = m_sort;
00410 }
00411
00412 void CBrowseFileView::InvalidateView(void)
00413 {
00414     m_entriesMod = 0;
00415 }
00416
00417 BOOL CBrowseFileView::PreCreateWindow(CREATESTRUCT& cs)
00418 {
00419     cs.style |= WS_TABSTOP | LVS_SHOWSELALWAYS | LVS_REPORT;
00420     cs.dwExStyle |= LVS_EX_FULLROWSELECT;
00421
00422     return CListView::PreCreateWindow(cs);
00423 }
00424
00425 int CBrowseFileView::GetImageForEntry(EntnodeData *data)
00426 {
00427     int result;
00428     if(data->GetType() == ENT_FILE)
00429     {
00430         const char *info = 0L;
00431         if(data->IsIgnored())
00432         {
00433             result = kFileIconIgnored;
00434         }
00435         else if(data->IsUnknown())
00436         {
00437             result = kFileIconUnknown;
00438         }
00439         else if(data->GetConflict() != 0L)
00440         {
00441             result = kFileIconConflict;
00442         }
00443         else if(data->IsRemoved())
00444         {
00445             result = kFileIconRemoved;
00446         }
00447         else if((info = (*data)[EntnodeFile::kOption]) != 0L && strcmp(info, "-kb") == 0)
00448         {
00449             const char* vn = (*data)[EntnodeFile::kVN];
00450             bool isAdded = vn && (strcmp(vn, "0") == 0);
00451
00452             result = data->IsUnmodified() ? kFileIconBinary :
00453                 isAdded ? kFileIconBinaryAdded : kFileIconBinaryMod;
00454         }
00455         else
00456         {
00457             const char* vn = (*data)[EntnodeFile::kVN];
00458             bool isAdded = vn && (strcmp(vn, "0") == 0);
00459
00460             result = data->IsUnmodified() ? kFileIconText :
00461                 isAdded ? kFileIconAdded : kFileIconTextMod;
00462         }
00463     }
00464     else
00465     {
00466         if(data->IsIgnored())
00467         {
00468             result = kFolderIconIgnored;
00469         }
00470         else if(data->IsUnknown())
00471         {
00472             result = kFolderIconUnknown;
00473         }
00474         else
00475         {
00476             result = kFolderIcon;
00477         }
00478     }
00479
00480     return result;
00481 }
00482
00483 void CBrowseFileView::SetRecursive(bool isRecursive)
00484 {
00485     m_isRecursive = isRecursive;
00486     m_modelColumns = (m_isRecursive) ? KiColumnModel::GetRecursiveModel() : KiColumnModel::GetRegularModel();
00487 }
00488
00489 static void onFilteringChanged(CObject *obj)
00490 {
00491     ((CBrowseFileView *)obj)->OnFilteringChanged();
00492 }
00493
00494 void CBrowseFileView::OnInitialUpdate()
00495 {
00496     CListView::OnInitialUpdate();
00497
00498     CListCtrl& ListCtrl = GetListCtrl();
00499
00500     // Replace standard header with sort header
00501     if (HWND hWnd = ListView_GetHeader(ListCtrl.m_hWnd))
00502     {
00503         m_ctrlHeader.SubclassWindow(hWnd);
00504     }
00505     ListCtrl.SetExtendedStyle(LVS_EX_HEADERDRAGDROP);
00506
00507 // set image lists
00508     if(m_SmallImageList.m_hImageList == 0L)
00509         m_SmallImageList.Create(IDB_SMALLICONS, 16, 1, RGB(255, 255, 255));
00510     if(m_StateImageList.m_hImageList == 0L)
00511         m_StateImageList.Create(IDR_STATEICONS, 16, 1, RGB(255, 0, 0));
00512
00513     ListCtrl.SetImageList(&m_SmallImageList, LVSIL_SMALL);
00514     ListCtrl.SetImageList(&m_StateImageList, LVSIL_STATE);
00515
00516     KoTraversalContext context(this);
00517     SetRecursive(context.IsRecursive());
00518     AddColumns();
00519     SetFullRowSel(TRUE);
00520
00521     LoadColumns();
00522
00523     // register for notifications on filter change
00524     if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
00525     {
00526         app->GetFilterModel()->GetNotificationManager()->CheckIn(this, onFilteringChanged);
00527         app->GetRecursionModel()->GetNotificationManager()->CheckIn(this, onFilteringChanged);
00528         app->GetIgnoreModel()->GetNotificationManager()->CheckIn(this, onFilteringChanged);
00529     }
00530
00531     m_uiFilechangeTimer = SetTimer(FILECHANGE_TIMER, 200, 0L);
00532     if( 0L == m_uiFilechangeTimer )
00533     {
00534         cvs_err("Can't start the file change notification timer.\n");
00535     }
00536 }
00537
00538 void CBrowseFileView::AddColumns()
00539 {
00540     KiColumnModel* model = GetColumnModel();
00541     int columnCount = model->GetCount();
00542     CListCtrl& listCtrl = GetListCtrl();
00543     for(int i = 0; i<columnCount; i++)
00544     {
00545         LV_COLUMN lvc;
00546         model->GetAt(i)->GetSetupData(&lvc);
00547         lvc.iSubItem = i;
00548         lvc.mask |= LVCF_SUBITEM;
00549         listCtrl.InsertColumn(i,&lvc);
00550     }
00551 }
00552
00553 void CBrowseFileView::DeleteColumns()
00554 {
00555     KiColumnModel* model = GetColumnModel();
00556     int columnCount = model->GetCount();
00557     CListCtrl& listCtrl = GetListCtrl();
00558     for(int i = 0; i<columnCount; i++)
00559     {
00560         listCtrl.DeleteColumn(0);
00561     }
00562 }
00563
00564 void CBrowseFileView::GetEntriesModTime(time_t & newEntriesMod,
00565                                         time_t & newEntriesLogMod)
00566 {
00567     newEntriesMod = 0;
00568     newEntriesLogMod = 0;
00569     if(chdir(m_path) != 0)
00570         return;
00571     if(chdir("CVS") != 0)
00572         return;
00573
00574     struct stat sb;
00575     if (stat("Entries", &sb) != -1)
00576         newEntriesMod = sb.st_mtime;
00577     if (stat("Entries.log", &sb) != -1)
00578         newEntriesLogMod = sb.st_mtime;
00579     chdir(m_path);
00580 }
00581
00582 class CRecursionLock
00583 {
00584     bool & m_semaphore;
00585 public:
00586     CRecursionLock(bool & semaphore)
00587     : m_semaphore(semaphore)
00588     {
00589         m_semaphore = true;
00590     }
00591
00592     ~CRecursionLock()
00593     {
00594         m_semaphore = false;
00595     }
00596 };
00597
00598 void CBrowseFileView::ResetView(bool notifyBrowser, const char *selectFile)
00599 {
00600     // no outstanding request to reset the view any more
00601     m_isResetViewPending = false;
00602
00603     if (m_isResetViewLocked)
00604     {
00605         // no recursion
00606         return;
00607     }
00608     CRecursionLock recursionLock(m_isResetViewLocked);
00609
00610     // reset dirty indicators
00611     m_isFilesChange = false;
00612     GetEntriesModTime(m_entriesMod, m_entriesLogMod);
00613
00614     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00615     app->GetMainFrame()->MDIActivate(GetParentFrame());
00616
00617     CWaitCursor doWait;
00618
00619     bool bPartialOK = true;
00620
00621     CListCtrl& ListCtrl = GetListCtrl();
00622     int i;
00623
00624     // get the selection to later try to restore it
00625     CvsArgs selection(false);
00626     if (!selectFile)
00627     {
00628         int nItem = -1;
00629         UStr buf;
00630         while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
00631         {
00632             EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00633             selection.add(data->GetFullPathName(buf));
00634         }
00635     }
00636
00637     // delete all items
00638     VERIFY( ListCtrl.DeleteAllItems() );
00639
00640     // make sure columns are ok
00641     KoTraversalContext context(this);
00642     if ((context.IsRecursive() && !m_isRecursive) || (!context.IsRecursive() && m_isRecursive))
00643     {
00644
00645         KiColumnModel* oldModel = GetColumnModel();
00646         int oldCount = oldModel->GetCount();
00647         const KiColumn* oldColumn = (0 <= m_sort && m_sort < oldCount) ? oldModel->GetAt(m_sort) : NULL;
00648         DeleteColumns();
00649         SetRecursive(context.IsRecursive());
00650         AddColumns();
00651         if (oldColumn == NULL)
00652         {
00653             m_sort = 0;
00654         }
00655         else
00656         {
00657             KiColumnModel* newModel = GetColumnModel();
00658             int newCount = newModel->GetCount();
00659             int sort = -1;
00660             for (int pos = 0; pos < newCount && sort == -1; pos++)
00661             {
00662                 if (newModel->GetAt(pos) == oldColumn)
00663                 {
00664                     sort = pos;
00665                 }
00666             }
00667             m_sort = (sort >= 0) ? sort : 0;
00668         }
00669     }
00670
00671     // refetch all items
00672     TViewFill traverse(&context);
00673     kTraversal res = FileTraverse(m_path, traverse);
00674
00675     //JK - find the file for selection
00676     if( selectFile != 0L )
00677     {
00678         int count = ListCtrl.GetItemCount();
00679         for (int i = 0; i < count; i++)
00680         {
00681             EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(i);
00682
00683             //files only
00684             if(data->GetType() == ENT_SUBDIR)
00685                 continue;
00686
00687             UStr buf;
00688             const char* currentFile = data->GetFullPathName(buf);
00689             if( stricmp( selectFile, currentFile) == 0 )
00690             {
00691                 selection.reset(false); //we don't want any other selection
00692                 selection.add(currentFile);
00693                 bPartialOK = FALSE;
00694                 break;
00695             }
00696         }
00697     }
00698
00699     Resort();
00700
00701     // now restore the selection
00702     int argc = selection.Argc();
00703     char * const *argv = selection.Argv();
00704     bool isFirst = true;
00705     bool focusSet = false;
00706     int count = ListCtrl.GetItemCount();
00707     //If there are no selections, then skip the looping
00708     if( argc )
00709     {
00710         for (int nItem = 0; nItem < count; nItem++)
00711         {
00712             EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00713             UStr buf;
00714             const char* currentFile = data->GetFullPathName(buf);
00715             for(i = 0; i < argc; i++)
00716             {
00717                 const char* fn = argv[i];
00718                 if (stricmp(fn, currentFile) == 0)
00719                 {
00720                     VERIFY( ListCtrl.SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED) );
00721                     if(isFirst)
00722                     {
00723                         isFirst = false;
00724                         if( !bPartialOK )
00725                         {
00726                             //move to the bottom first, so the selection will be on top
00727                             ListCtrl.EnsureVisible(ListCtrl.GetItemCount()-1 , bPartialOK);
00728                         }
00729                         //make sure the first selected file is visible
00730                         VERIFY( ListCtrl.EnsureVisible(nItem, bPartialOK/*TRUE*/) );
00731                         VERIFY( focusSet = (ListCtrl.SetItemState(nItem, LVIS_FOCUSED, LVIS_FOCUSED)!=0) );
00732                     }
00733                     break;
00734                 }
00735             }
00736         }
00737     }
00738
00739     if( !focusSet && ListCtrl.GetItemCount())
00740     {
00741         //VERIFY( ListCtrl.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED) );
00742         VERIFY( focusSet = (ListCtrl.SetItemState(0, LVIS_FOCUSED, LVIS_FOCUSED)!=0) );
00743     }
00744
00745     if(notifyBrowser)
00746     {
00747         // notify the tree
00748         app->GetBrowserView()->ResetView(true);
00749     }
00750
00751     // start monitoring file changes
00752     if (!m_watch)
00753     {
00754         m_watch = new KoWatcher(m_hWnd);
00755     }
00756     m_watch->SignalStartWatch(m_path, m_isRecursive);
00757 }
00758
00759 void CBrowseFileView::ResetView(const char *path, bool notifyBrowser, const char *selectFile)
00760 {
00761     m_path = path;
00762     ResetView(false, selectFile);
00763     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00764     app->GetDocument()->SetTitle(m_path);
00765
00766     if(notifyBrowser)
00767     {
00768         // notify the tree
00769         app->GetBrowserView()->StepToLocation(path);
00770     }
00771 }
00772
00774 // CBrowseFileView diagnostics
00775
00776 #ifdef _DEBUG
00777 void CBrowseFileView::AssertValid() const
00778 {
00779     CListView::AssertValid();
00780 }
00781
00782 void CBrowseFileView::Dump(CDumpContext& dc) const
00783 {
00784     CListView::Dump(dc);
00785 }
00786 #endif //_DEBUG
00787
00788 BOOL CBrowseFileView::SetViewType(DWORD dwViewType)
00789 {
00790     return(ModifyStyle(LVS_TYPEMASK,dwViewType & LVS_TYPEMASK));
00791 }
00792
00793 DWORD CBrowseFileView::GetViewType()
00794 {
00795     return(GetStyle() & LVS_TYPEMASK);
00796 }
00797
00798 void CBrowseFileView::OnViewSmallIcons()
00799 {
00800     if (GetViewType() != LVS_SMALLICON)
00801         SetViewType(LVS_SMALLICON);
00802 }
00803
00804 void CBrowseFileView::OnViewList()
00805 {
00806     if (GetViewType() != LVS_LIST)
00807         SetViewType(LVS_LIST);
00808 }
00809
00810 void CBrowseFileView::OnViewFullRowDetails()
00811 {
00812     if (GetViewType() != LVS_REPORT)
00813         SetViewType(LVS_REPORT);
00814 }
00815
00816 void CBrowseFileView::OnUpdateViewSmallIcons(CCmdUI* pCmdUI)
00817 {
00818     pCmdUI->SetCheck(GetViewType() == LVS_SMALLICON);
00819 }
00820
00821 void CBrowseFileView::OnUpdateViewList(CCmdUI* pCmdUI)
00822 {
00823     pCmdUI->SetCheck(GetViewType() == LVS_LIST);
00824 }
00825
00826 void CBrowseFileView::OnUpdateViewFullRowDetails(CCmdUI* pCmdUI)
00827 {
00828     pCmdUI->SetCheck(GetViewType() == LVS_REPORT);
00829 }
00830
00831 void CBrowseFileView::OnLButtonDown(UINT nFlags, CPoint point)
00832 {
00833     CListView::OnLButtonDown(nFlags, point);
00834 }
00835
00836 void CBrowseFileView::EditSel(EntnodeData *data, bool useDefault)
00837 {
00838     UStr buf;
00839     const char* fullpath = data->GetFullPathName(buf);
00840     if(data->GetType() == ENT_SUBDIR)
00841     {
00842         struct stat st;
00843         if (stat(fullpath, &st) != 0 && errno == ENOENT)
00844         {
00845             // Assume we're looking at directory previously in CVS,
00846             // but not currently in the filesystem.
00847             // If we ever run across another case (permissions perhaps)
00848             // then you might want to add code here.
00849             cvs_err("'%s' is not accessible\n", (char*)fullpath);
00850         }
00851         else
00852         {
00853             ResetView(fullpath, true);
00854             gCvsPrefs.SetLastWorkingDir(fullpath);
00855         }
00856     }
00857     else
00858     {
00859         LaunchViewer(fullpath, useDefault);
00860     }
00861 }
00862
00863 void CBrowseFileView::OnLButtonDblClk(UINT nFlags, CPoint point)
00864 {
00865     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00866     if(app->gCvsRunning)
00867         return;
00868
00869     CListCtrl& ListCtrl = GetListCtrl();
00870
00871     UINT pFlags;
00872     int nItem = ListCtrl.HitTest(point, &pFlags);
00873     if(nItem != -1)
00874     {
00875         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00876         EditSel(data);
00877     }
00878
00879     CListView::OnLButtonDblClk(nFlags, point);
00880 }
00881
00882 bool CBrowseFileView::DisableCommon(bool bCheckSelection /*= true*/)
00883 {
00884     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00885     CListCtrl& ListCtrl = GetListCtrl();
00886     bool bCommon = app->gCvsRunning || gCvsPrefs.empty();
00887     bool bSelection = ListCtrl.GetSelectedCount() == 0 || this != CWnd::GetFocus();
00888
00889     return bCheckSelection ? bCommon || bSelection : bCommon;
00890 }
00891
00892 void CBrowseFileView::OnUpdateViewRelease(CCmdUI* pCmdUI)
00893 {
00894     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00895     CListCtrl& ListCtrl = GetListCtrl();
00896
00897     if(DisableCommon())
00898     {
00899         pCmdUI->Enable(FALSE);
00900         return;
00901     }
00902
00903     int nItem = -1;
00904     BOOL res = TRUE;
00905     int numFiles = 0;
00906     int numFolders = 0;
00907
00908     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
00909     {
00910         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00911         if(data->IsUnknown() || data->GetType() != ENT_SUBDIR)
00912         {
00913             res = FALSE;
00914             break;
00915         }
00916         numFolders++;
00917
00918         if(numFolders > 1)
00919         {
00920             res = FALSE;
00921             break;
00922         }
00923     }
00924
00925     pCmdUI->Enable(res);
00926 }
00927
00928 void CBrowseFileView::OnUpdateViewAdd(CCmdUI* pCmdUI)
00929 {
00930     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00931     CListCtrl& ListCtrl = GetListCtrl();
00932
00933     if(DisableCommon())
00934     {
00935         pCmdUI->Enable(FALSE);
00936         return;
00937     }
00938
00939     int nItem = -1;
00940     BOOL res = TRUE;
00941     int numFiles = 0;
00942     int numFolders = 0;
00943
00944     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
00945     {
00946         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00947         if(!(data->IsUnknown() || (data->IsRemoved() && data->IsMissing())))
00948         {
00949             res = FALSE;
00950             break;
00951         }
00952         if(data->GetType() == ENT_FILE)
00953         {
00954             numFiles++;
00955         }
00956         else
00957             numFolders++;
00958
00959         if((numFiles != 0 && numFolders != 0) || numFolders > 1)
00960         {
00961             res = FALSE;
00962             break;
00963         }
00964     }
00965
00966     pCmdUI->Enable(res);
00967 }
00968
00969 void CBrowseFileView::OnUpdateViewAddB(CCmdUI* pCmdUI)
00970 {
00971     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00972     CListCtrl& ListCtrl = GetListCtrl();
00973
00974     if(DisableCommon())
00975     {
00976         pCmdUI->Enable(FALSE);
00977         return;
00978     }
00979
00980     int nItem = -1;
00981     BOOL res = TRUE;
00982
00983     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
00984     {
00985         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00986         if(data->GetType() != ENT_FILE)
00987         {
00988             res = FALSE;
00989             break;
00990         }
00991         if(!(data->IsUnknown() || (data->IsRemoved() && data->IsMissing())))
00992         {
00993             res = FALSE;
00994             break;
00995         }
00996     }
00997
00998     pCmdUI->Enable(res);
00999 }
01000
01001 void CBrowseFileView::OnUpdateViewUpdate(CCmdUI* pCmdUI)
01002 {
01003     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01004     CListCtrl& ListCtrl = GetListCtrl();
01005
01006     if(DisableCommon())
01007     {
01008         pCmdUI->Enable(FALSE);
01009         return;
01010     }
01011
01012     int nItem = -1;
01013     BOOL res = TRUE;
01014     int numFiles = 0;
01015     int numFolders = 0;
01016
01017     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01018     {
01019         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01020         if(data->IsUnknown())
01021         {
01022             res = FALSE;
01023             break;
01024         }
01025         if(data->GetType() == ENT_FILE)
01026             numFiles++;
01027         else
01028             numFolders++;
01029
01030         if((numFiles != 0 && numFolders != 0) || numFolders > 1)
01031         {
01032             res = FALSE;
01033             break;
01034         }
01035     }
01036
01037     pCmdUI->Enable(res);
01038 }
01039
01040 void CBrowseFileView::OnUpdateViewGraph(CCmdUI* pCmdUI)
01041 {
01042     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01043     CListCtrl& ListCtrl = GetListCtrl();
01044
01045     if(DisableCommon())
01046     {
01047         pCmdUI->Enable(FALSE);
01048         return;
01049     }
01050
01051     int nItem = -1;
01052     BOOL res = TRUE;
01053
01054     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01055     {
01056         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01057         if(data->IsUnknown() || data->GetType() == ENT_SUBDIR)
01058         {
01059             res = FALSE;
01060             break;
01061         }
01062     }
01063
01064     pCmdUI->Enable(res);
01065 }
01066
01067 void CBrowseFileView::OnUpdateViewRmv(CCmdUI* pCmdUI)
01068 {
01069     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01070     CListCtrl& ListCtrl = GetListCtrl();
01071
01072     if(DisableCommon())
01073     {
01074         pCmdUI->Enable(FALSE);
01075         return;
01076     }
01077
01078     int nItem = -1;
01079     BOOL res = TRUE;
01080
01081     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01082     {
01083         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01084         if(data->IsUnknown() || data->IsRemoved() || data->GetType() == ENT_SUBDIR)
01085         {
01086             res = FALSE;
01087             break;
01088         }
01089     }
01090
01091     pCmdUI->Enable(res);
01092 }
01093
01094 void CBrowseFileView::Resort(void)
01095 {
01096     CListCtrl& ListCtrl = GetListCtrl();
01097     KoColumnContext context(GetPath());
01098     KiColumnModel* model = GetColumnModel();
01099     CSortParam sortParam(m_ascendant, true, model->GetAt(m_sort), model->GetAt(0), &context);
01100     m_ctrlHeader.SetSortImage(m_sort, m_ascendant);
01101
01102     ListCtrl.SortItems( _Compare, (LPARAM)&sortParam);
01103 }
01104
01105 void CBrowseFileView::OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult)
01106 {
01107     NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
01108     CListCtrl& ListCtrl = GetListCtrl();
01109
01110     if(pNMListView->iSubItem == m_sort)
01111         m_ascendant = !m_ascendant;
01112     else
01113     {
01114         m_ascendant = true;
01115         m_sort = pNMListView->iSubItem;
01116         KiColumnModel* model = GetColumnModel();
01117         m_ascendant = model->GetAt(m_sort)->IsDefaultAscending();
01118     }
01119
01120     Resort();
01121     *pResult = 0;
01122 }
01123
01124 void CBrowseFileView::ProcessSelectionCommand(KiSelectionHandler* handler)
01125 {
01126     CListCtrl& ListCtrl = GetListCtrl();
01127     int nItem = -1;
01128     int pathLen = GetPath().length();
01129
01130     MultiFiles mf;
01131
01132     // first add the folders
01133     mf.newdir(GetPath());
01134
01135     //  process selection
01136     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01137     {
01138         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01139         UStr buf;
01140         const char* fullpath = data->GetFullPathName(buf);
01141         if(data->GetType() == ENT_SUBDIR)
01142         {
01143             handler->OnFolder(fullpath);
01144         }
01145         else
01146         {
01147             const char* fn = data->GetFullPathName(buf) + pathLen;
01148             if (*fn == '\\')
01149             {
01150                 fn++;
01151             }
01152             mf.newfile(fn);
01153         }
01154     }
01155     if(mf.NumFiles() != 0)
01156     {
01157         handler->OnFiles(&mf);
01158     }
01159 }
01160
01161 void CBrowseFileView::OnViewAdd()
01162 {
01163     KoAddHandler handler;
01164     ProcessSelectionCommand(&handler);
01165 }
01166
01167 void CBrowseFileView::OnViewAddb()
01168 {
01169     KoAddBinaryHandler handler;
01170     ProcessSelectionCommand(&handler);
01171 }
01172
01173 void CBrowseFileView::OnViewCommit()
01174 {
01175     KoCommitHandler handler;
01176     ProcessSelectionCommand(&handler);
01177 }
01178
01179 void CBrowseFileView::OnViewRmv()
01180 {
01181     KoFileRemoveHandler handler;
01182     ProcessSelectionCommand(&handler);
01183 }
01184
01185 void CBrowseFileView::OnViewUpdate()
01186 {
01187     KoUpdateHandler handler;
01188     ProcessSelectionCommand(&handler);
01189 }
01190
01191 void CBrowseFileView::OnViewQueryUpdate()
01192 {
01193     KoQueryUpdateHandler handler;
01194     ProcessSelectionCommand(&handler);
01195 }
01196
01197 void CBrowseFileView::OnUpdateViewReload(CCmdUI* pCmdUI)
01198 {
01199     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01200     pCmdUI->Enable(!app->gCvsRunning);
01201 }
01202
01203 void CBrowseFileView::OnViewReload()
01204 {
01205     ResetView(true);
01206 }
01207
01208 void CBrowseFileView::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult)
01209 {
01210     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01211     if(app->gCvsRunning)
01212         return;
01213
01214     CListCtrl& ListCtrl = GetListCtrl();
01215     LV_KEYDOWN* pLVKeyDow = (LV_KEYDOWN*)pNMHDR;
01216
01217     if(pLVKeyDow->wVKey == VK_BACK)
01218     {
01219         OnViewUpone();
01220     }
01221     else if(pLVKeyDow->wVKey == VK_RETURN && ListCtrl.GetSelectedCount() == 1)
01222     {
01223         int nItem = -1;
01224         if((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01225         {
01226             EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01227             if(data->GetType() == ENT_SUBDIR)
01228             {
01229                 UStr buf;
01230                 const char* fullpath = data->GetFullPathName(buf);
01231                 ResetView(fullpath, true);
01232             }
01233             else
01234             {
01235                 EditSel(data);
01236             }
01237         }
01238     }
01239
01240     *pResult = 0;
01241 }
01242
01243 static CString GetRoot()
01244 {
01245     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01246     return app->GetRoot();
01247 }
01248
01249 static int GetPathLength(LPCTSTR path)
01250 {
01251     int len = _tcslen(path);
01252     return (len > 0 && path[len - 1] == kPathDelimiter) ? (len - 1) : len;
01253 }
01254
01255 static bool IsSamePath(LPCTSTR path1, LPCTSTR path2)
01256 {
01257     int len1 = GetPathLength(path1);
01258     int len2 = GetPathLength(path2);
01259     return len1 == len2 && _tcsicmp(path1, path2) == 0;
01260 }
01261
01262 void CBrowseFileView::OnViewUpone()
01263 {
01264     if(!IsSamePath(m_path, GetRoot()) && chdir(m_path) == 0 && chdir("..") == 0)
01265     {
01266         char newpath[1024];
01267         getcwd(newpath, 1023);
01268         ResetView(newpath, true);
01269     }
01270     else
01271     {
01272         MessageBeep(MB_ICONHAND);
01273     }
01274 }
01275
01276 void CBrowseFileView::OnUpdateViewUpone(CCmdUI* pCmdUI)
01277 {
01278     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01279     pCmdUI->Enable(!app->gCvsRunning && !IsSamePath(m_path, GetRoot()));
01280 }
01281
01282 void CBrowseFileView::OnViewTrash()
01283 {
01284     KoMoveToTrashHandler handler;
01285     ProcessSelectionCommand(&handler);
01286 }
01287
01288 void CBrowseFileView::OnUpdateViewTrash(CCmdUI* pCmdUI)
01289 {
01290     bool enabled = !DisableCommon();
01291     if(enabled)
01292     {
01293         KoUpdateMoveToTrashHandler handler;
01294         ProcessSelectionCommand(&handler);
01295         enabled = handler.IsEnabled();
01296     }
01297     pCmdUI->Enable(enabled);
01298 }
01299
01300 void CBrowseFileView::OnViewDiff()
01301 {
01302     KoDiffHandler handler;
01303     ProcessSelectionCommand(&handler);
01304 }
01305
01306 void CBrowseFileView::OnViewLog()
01307 {
01308     KoLogHandler handler;
01309     ProcessSelectionCommand(&handler);
01310 }
01311
01312 void CBrowseFileView::OnViewGraph()
01313 {
01314     KoGraphHandler handler;
01315     ProcessSelectionCommand(&handler);
01316 }
01317
01318 void CBrowseFileView::OnViewStatus()
01319 {
01320     KoStatusHandler handler;
01321     ProcessSelectionCommand(&handler);
01322 }
01323
01324 void CBrowseFileView::OnViewLock()
01325 {
01326     KoLockHandler handler;
01327     ProcessSelectionCommand(&handler);
01328 }
01329
01330 void CBrowseFileView::OnViewUnlock()
01331 {
01332     KoUnlockHandler handler;
01333     ProcessSelectionCommand(&handler);
01334 }
01335
01336 void CBrowseFileView::OnViewWatchOn()
01337 {
01338     KoWatchOnHandler handler;
01339     ProcessSelectionCommand(&handler);
01340 }
01341
01342 void CBrowseFileView::OnViewWatchOff()
01343 {
01344     KoWatchOffHandler handler;
01345     ProcessSelectionCommand(&handler);
01346 }
01347
01348 void CBrowseFileView::OnViewEdit()
01349 {
01350     KoEditHandler handler;
01351     ProcessSelectionCommand(&handler);
01352 }
01353
01354 void CBrowseFileView::OnViewUnedit()
01355 {
01356     KoUneditHandler handler;
01357     ProcessSelectionCommand(&handler);
01358 }
01359
01360 void CBrowseFileView::OnViewRelease()
01361 {
01362     KoReleaseHandler handler;
01363     ProcessSelectionCommand(&handler);
01364 }
01365
01366 void CBrowseFileView::OnViewWatchers()
01367 {
01368     KoWatchersHandler handler;
01369     ProcessSelectionCommand(&handler);
01370 }
01371
01372 void CBrowseFileView::OnViewEditors()
01373 {
01374     KoEditorsHandler handler;
01375     ProcessSelectionCommand(&handler);
01376 }
01377
01378 void CBrowseFileView::OnRButtonDown(UINT nFlags, CPoint point)
01379 {
01380     CListView::OnRButtonDown(nFlags, point);
01381
01382     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01383     CListCtrl& ListCtrl = GetListCtrl();
01384
01385     if(DisableCommon())
01386         return;
01387
01388     UINT pFlags;
01389     int testItem = ListCtrl.HitTest(point, &pFlags);
01390     if(testItem == -1)
01391         return;
01392
01393     if(ListCtrl.GetItemState(testItem, LVIS_SELECTED) == 0)
01394         return;
01395
01396     if(pFlags & (LVHT_ONITEMICON|LVHT_ONITEMLABEL|LVHT_ONITEMSTATEICON) == 0)
01397         return;
01398
01399     CMenu* pMyMenu=::GetCustomMenu(kCustomFilesMenu,this);
01400     if (pMyMenu)
01401     {
01402         ClientToScreen(&point);
01403         pMyMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x, point.y, this);
01404         delete pMyMenu;
01405     }
01406 }
01407
01408 void CBrowseFileView::OnViewTagNew()
01409 {
01410     KoCreateTagHandler handler;
01411     ProcessSelectionCommand(&handler);
01412 }
01413
01414 void CBrowseFileView::OnViewTagDelete()
01415 {
01416     KoDeleteTagHandler handler;
01417     ProcessSelectionCommand(&handler);
01418 }
01419
01420 void CBrowseFileView::OnViewTagBranch()
01421 {
01422     KoBranchTagHandler handler;
01423     ProcessSelectionCommand(&handler);
01424 }
01425
01426 BOOL CBrowseFileView::OnCustomize(UINT nID)
01427 {
01428     CustomizeMenus(nID == ID_CUST_FILES_MENU ? kCustomFilesMenu : kCustomBrowserMenu);
01429     return TRUE;
01430 }
01431
01432 void CBrowseFileView::OnUpdateCustomize(CCmdUI* pCmdUI)
01433 {
01434     pCmdUI->Enable(TRUE);
01435 }
01436
01437 BOOL CBrowseFileView::OnMacro(UINT nID)
01438 {
01439     PyDoPython(WINCMD_to_UCMD(nID));
01440
01441     return 1;
01442 }
01443
01444 void CBrowseFileView::OnUpdateMacro(CCmdUI* pCmdUI)
01445 {
01446     if(DisableCommon(false))
01447     {
01448         pCmdUI->Enable(FALSE);
01449         return;
01450     }
01451
01452     // fill the cache with current selection
01453     if(!PyIsUICacheValid())
01454     {
01455         CListCtrl& ListCtrl = GetListCtrl();
01456         int nItem = -1;
01457         while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01458         {
01459             EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01460             PyAppendCache(data);
01461         }
01462     }
01463
01464     UCmdUI ucmdui(WINCMD_to_UCMD(pCmdUI->m_nID));
01465     ucmdui.pCmdUI = pCmdUI;
01466     PyDoCmdUI(&ucmdui);
01467 }
01468
01469 void CBrowseFileView::OnViewExplore()
01470 {
01471     const char* fullpath = m_path;
01472
01473     CListCtrl& ListCtrl = GetListCtrl();
01474     int nItem = -1;
01475
01476     // first add the folders
01477     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01478     {
01479         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01480         if(data->GetType() == ENT_SUBDIR)
01481         {
01482             UStr buf;
01483             fullpath = data->GetFullPathName(buf);
01484             break;
01485         }
01486     }
01487
01488     HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), "explore", fullpath,
01489             0L, 0L, SW_SHOWDEFAULT);
01490     if((long)hInst < 32)
01491     {
01492         cvs_err("Unable to explore '%s' (error %d)\n", (char *)m_path, GetLastError());
01493     }
01494 }
01495
01496 void CBrowseFileView::OnUpdateViewExplore(CCmdUI* pCmdUI)
01497 {
01498     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01499     CListCtrl& ListCtrl = GetListCtrl();
01500     if(DisableCommon())
01501     {
01502         pCmdUI->Enable(FALSE);
01503         return;
01504     }
01505
01506     int nItem = -1;
01507     int numItem = 0;
01508     BOOL res = TRUE;
01509
01510     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01511     {
01512         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01513         if(data->IsMissing() || ++numItem > 1)
01514         {
01515             res = FALSE;
01516             break;
01517         }
01518     }
01519
01520     pCmdUI->Enable(res);
01521 }
01522
01523 void CBrowseFileView::OnTimer(UINT nIDEvent)
01524 {
01525     if (nIDEvent == m_uiFilechangeTimer)
01526     {
01527         CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01528         if(!app->gCvsRunning)
01529         {
01530             // cvs command finished
01531             if( m_checkChanges )
01532             {
01533                 // Get the active MDI child window.
01534                 CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
01535                 CMDIChildWnd *pChild = NULL;
01536                 if( pFrame )
01537                 {
01538                     pChild = pFrame->MDIGetActive();
01539                 }
01540
01541                 // Refresh the directory tree and file view
01542                 m_checkChanges = false;
01543                 ResetView(true);
01544
01545                 // Restore the previously active view
01546                 if( pFrame && pChild )
01547                 {
01548                     pFrame->MDIActivate(pChild);
01549                 }
01550
01551                 return;
01552             }
01553
01554             // file change
01555             if (m_isFilesChange )
01556             {
01557                 ResetView();
01558             }
01559
01560             // check if we need to reload
01561             time_t newEntriesMod;
01562             time_t newEntriesLogMod;
01563             GetEntriesModTime(newEntriesMod, newEntriesLogMod);
01564             if (m_entriesMod != newEntriesMod || m_entriesLogMod != newEntriesLogMod)
01565             {
01566                 ResetView();
01567             }
01568         }
01569         return;
01570     }
01571     CListView::OnTimer(nIDEvent);
01572 }
01573
01574 LRESULT CBrowseFileView::OnFileChange(WPARAM, LPARAM)
01575 {
01576     m_isFilesChange = true;
01577     return 0;
01578 }
01579
01580 void CBrowseFileView::SetFullRowSel(BOOL bFullRowSel)
01581 {
01582     CListCtrl& ListCtrl = GetListCtrl();
01583     DWORD dwExStyle = ListView_GetExtendedListViewStyle(ListCtrl.m_hWnd);
01584     if (bFullRowSel)
01585         (dwExStyle |= LVS_EX_FULLROWSELECT);
01586     else
01587         (dwExStyle &= ~LVS_EX_FULLROWSELECT);
01588     ListView_SetExtendedListViewStyle(ListCtrl.m_hWnd, dwExStyle);
01589 }
01590
01591 void CBrowseFileView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
01592 {
01593     CListView::OnBeginPrinting(pDC, pInfo);
01594
01595     int nPageHeight = pDC->GetDeviceCaps(VERTRES);
01596     TEXTMETRIC tm;
01597     pDC->GetTextMetrics(&tm);
01598
01599     // compute the bounds
01600     CListCtrl& ListCtrl = GetListCtrl();
01601     m_numberOfLines = ListCtrl.GetItemCount();
01602     m_heightOfLines = 2 * tm.tmHeight;
01603     m_numberByPages = nPageHeight / m_heightOfLines;
01604     m_numberOfPages = m_numberOfLines / m_numberByPages + 1;
01605
01606     pInfo->SetMaxPage(m_numberOfPages);
01607 }
01608
01609 BOOL CBrowseFileView::OnPreparePrinting(CPrintInfo* pInfo)
01610 {
01611     BOOL res = DoPreparePrinting(pInfo);
01612     if(!res)
01613         return res;
01614
01615     return TRUE;
01616 }
01617
01618 void CBrowseFileView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
01619 {
01620     if (!pDC->IsPrinting())
01621         return;
01622
01623     // now compute the first item to draw
01624     CListCtrl& ListCtrl = GetListCtrl();
01625     int nFirstItem = -1;
01626     int numToIgnore = m_numberByPages * (pInfo->m_nCurPage - 1);
01627     while(numToIgnore-- && (nFirstItem = ListCtrl.GetNextItem(nFirstItem, LVNI_ALL)) != -1)
01628     {
01629     }
01630
01631     TEXTMETRIC tm;
01632     pDC->GetTextMetrics(&tm);
01633
01634     int nItem = nFirstItem, n = 0;
01635     int horz = pInfo->m_rectDraw.Width();
01636     int vert = pInfo->m_rectDraw.Height();
01637     // measure for each column
01638     KiColumnModel* model = GetColumnModel();
01639     int columnCount = model->GetCount();
01640     std::vector<int> widths(columnCount, 0);
01641     int totalwidth = 0;
01642     int j;
01643     KoColumnContext context(GetPath());
01644     while(n++ < m_numberByPages && (nItem = ListCtrl.GetNextItem(nItem, LVNI_ALL)) != -1)
01645     {
01646         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01647         for(j = 0; j < columnCount; j++)
01648         {
01649             TCHAR buffer[256];
01650             model->GetAt(j)->GetText(&context, data, buffer, 256);
01651             int width = pDC->GetTextExtent(buffer, _tcslen(buffer)).cx + kSpc;
01652             widths[j] = max(widths[j], width);
01653         }
01654     }
01655
01656     for(j = 0; j < columnCount; j++)
01657     {
01658         totalwidth += widths[j];
01659     }
01660
01661     for(j = 0; j < columnCount; j++)
01662     {
01663         widths[j] += (horz - totalwidth) / columnCount;
01664     }
01665
01666     // compute the margins
01667     for(j = columnCount - 1; j >= 0; j--)
01668     {
01669         int margin = 0;
01670         for(int i = j - 1; i >= 0; i--)
01671         {
01672             margin += widths[i];
01673         }
01674         widths[j] = margin;
01675     }
01676     // now print
01677     nItem = nFirstItem;
01678     n = 0;
01679     CPoint off = pInfo->m_rectDraw.TopLeft();
01680     while(n++ < m_numberByPages && (nItem = ListCtrl.GetNextItem(nItem, LVNI_ALL)) != -1)
01681     {
01682         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01683         for(j = 0; j < columnCount; j++)
01684         {
01685             const char *info = (*data)[j];
01686             if(info == 0L)
01687                 continue;
01688
01689             CPoint where = off;
01690             where.x += widths[j];
01691             CString s(info);
01692             CRect r(0,0,0,0);
01693             pDC->DrawText(s, -1, &r, DT_CALCRECT);
01694             r.OffsetRect(where);
01695             pDC->DrawText(s, -1, &r, DT_CENTER);
01696         }
01697         off += CPoint(0, m_heightOfLines);
01698     }
01699     //CListView::OnPrint(pDC, pInfo);
01700 }
01701
01702 void CBrowseFileView::OnViewEditsel()
01703 {
01704     CListCtrl& ListCtrl = GetListCtrl();
01705     int nItem = -1;
01706
01707     // first add the folders
01708     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01709     {
01710         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01711         EditSel(data);
01712     }
01713 }
01714
01715 void CBrowseFileView::OnViewEditseldef()
01716 {
01717     CListCtrl& ListCtrl = GetListCtrl();
01718     int nItem = -1;
01719
01720     // first add the folders
01721     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01722     {
01723         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01724         EditSel(data, true);
01725     }
01726 }
01727
01728 void CBrowseFileView::OnUpdateViewEditseldef(CCmdUI* pCmdUI)
01729 {
01730     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01731     CListCtrl& ListCtrl = GetListCtrl();
01732     if(DisableCommon())
01733     {
01734         pCmdUI->Enable(FALSE);
01735         return;
01736     }
01737
01738     int nItem = -1;
01739     BOOL res = TRUE;
01740
01741     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01742     {
01743         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01744         if(data->GetType() == ENT_SUBDIR || data->IsMissing())
01745         {
01746             res = FALSE;
01747             break;
01748         }
01749     }
01750
01751     CString str;
01752     if( FormatMenuString(pCmdUI->m_nID, str) && pCmdUI->m_pParentMenu )
01753     {
01754         pCmdUI->SetText(str);
01755     }
01756
01757     pCmdUI->Enable(res);
01758 }
01759
01760 void CBrowseFileView::OnViewCheckout()
01761 {
01762     CvsCmdCheckoutModule();
01763 }
01764
01765 void CBrowseFileView::OnUpdateViewCheckout(CCmdUI* pCmdUI)
01766 {
01767     if(DisableCommon(false))
01768     {
01769         pCmdUI->Enable(FALSE);
01770         return;
01771     }
01772     pCmdUI->Enable(TRUE);
01773     pCmdUI->SetText("Chec&kout module...");
01774 }
01775
01776 void CBrowseFileView::OnViewImport()
01777 {
01778     CvsCmdImportModule();
01779 }
01780
01781 void CBrowseFileView::OnUpdateViewImport(CCmdUI* pCmdUI)
01782 {
01783     if(DisableCommon())
01784     {
01785         pCmdUI->Enable(FALSE);
01786         return;
01787     }
01788     pCmdUI->Enable(TRUE);
01789     pCmdUI->SetText("&Import module...");
01790 }
01791
01792 // Drag and drop.
01793 // Implemented by Nikita Jorniak <nikita@tanner.com>
01794 // Comment: This works to drag files from WinCVS and drop them to any external viewer/editor,
01795 // which supports Windows Shell standard CF_HDROP Clipboard style.
01796 // Directories are intentionally left out.
01797 // Tested: MS DevStudio, Windows Explorer.
01798 // Tested on Windows NT 4.0 (Service Pack 6)
01799 void CBrowseFileView::DoDrag()
01800 {
01801     CListCtrl& ListCtrl = GetListCtrl();
01802     int nItem=-1;
01803     int nSize = 0;
01804     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01805     {
01806         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01807         if(data->GetType()!=ENT_SUBDIR)
01808         {
01809             UStr buf;
01810             const char* fullpath = data->GetFullPathName(buf);
01811             nSize += strlen(fullpath) + 1;
01812         }
01813     }
01814     if(nSize>0)
01815     {
01816         HGLOBAL hMem = GlobalAlloc(GMEM_FIXED, sizeof(DROPFILES)+nSize+1);
01817         if(hMem!=NULL)
01818         {
01819             DROPFILES& df = *reinterpret_cast<DROPFILES*>(hMem);
01820             df.pFiles = sizeof(DROPFILES);
01821             df.fNC = FALSE;
01822             df.pt.x = df.pt.y = 0;
01823             df.fWide = FALSE;
01824
01825             nItem=-1;
01826             int Offset = sizeof(DROPFILES);
01827             while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01828             {
01829                 EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01830                 if(data->GetType()!=ENT_SUBDIR)
01831                 {
01832                     UStr buf;
01833                     const char* fullpath = data->GetFullPathName(buf);
01834                     int len = strlen(fullpath) + 1;
01835                     memcpy(reinterpret_cast<BYTE*>(hMem)+Offset, fullpath, len);
01836                     Offset+=len;
01837                 }
01838             }
01839             reinterpret_cast<BYTE*>(hMem)[Offset]=0;
01840
01841             COleDataSource ds;
01842             ds.CacheGlobalData( CF_HDROP, hMem );
01843             ds.DoDragDrop( DROPEFFECT_COPY );
01844         }
01845     }
01846 }
01847
01848 void CBrowseFileView::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult)
01849 {
01850     DoDrag();
01851     *pResult = 0;
01852 }
01853
01854 void CBrowseFileView::OnBeginrdrag(NMHDR* pNMHDR, LRESULT* pResult)
01855 {
01856     DoDrag();
01857     *pResult = 0;
01858 }
01859
01860 void CBrowseFileView::OnDestroy()
01861 {
01862     SaveColumns();
01863     if(m_watch)
01864     {
01865         m_watch->SignalTerminate();
01866         m_watch = NULL;
01867     }
01868
01869     // unregister notifications
01870     if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
01871     {
01872         app->GetFilterModel()->GetNotificationManager()->CheckOut(this);
01873         app->GetRecursionModel()->GetNotificationManager()->CheckOut(this);
01874         app->GetIgnoreModel()->GetNotificationManager()->CheckOut(this);
01875     }
01876
01877     //kill the timer
01878     if( m_uiFilechangeTimer )
01879     {
01880         KillTimer(m_uiFilechangeTimer);
01881     }
01882
01883     CListView::OnDestroy();
01884 }
01885
01886 void CBrowseFileView::SaveColumns()
01887 {
01888     AfxGetApp()->WriteProfileString("FileDetailView", NULL, NULL);
01889
01890     char buffer[2048];
01891     char* cp = buffer;
01892     int count = m_ctrlHeader.GetItemCount();
01893     for (int i = 0; i < count; ++i)
01894     {
01895         int width = GetListCtrl().GetColumnWidth(i);
01896         cp += sprintf(cp, "%d ", width);
01897     }
01898     AfxGetApp()->WriteProfileString("FileDetailView", "Column Widths", buffer);
01899
01900     int order[128];
01901     if (m_ctrlHeader.GetOrderArray(order, count))
01902     {
01903         cp = buffer;
01904         for (int i = 0; i < count; ++i)
01905         {
01906             cp += sprintf(cp, "%d ", order[i]);
01907         }
01908         AfxGetApp()->WriteProfileString("FileDetailView", "Column Order", buffer);
01909     }
01910 }
01911
01912 bool CBrowseFileView::LoadColumns()
01913 {
01914     CString widths = AfxGetApp()->GetProfileString("FileDetailView", "Column Widths");
01915     CString orders  = AfxGetApp()->GetProfileString("FileDetailView", "Column Order");
01916     if (widths.IsEmpty() || orders.IsEmpty())
01917     {
01918         return false;
01919     }
01920
01921     int count = m_ctrlHeader.GetItemCount();
01922     int order[128];
01923     for (int i = 0; i < count; ++i)
01924     {
01925         CString strSubString;
01926         AfxExtractSubString( strSubString, widths, i, _T(' '));
01927         int width =  _ttoi( strSubString );
01928         GetListCtrl().SetColumnWidth(i, width);
01929
01930         AfxExtractSubString( strSubString, orders, i, _T(' '));
01931         order[i] =  _ttoi( strSubString );
01932     }
01933     m_ctrlHeader.SetOrderArray(count, order);
01934
01935     return true;
01936 }
01937
01938 BOOL CBrowseFileView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
01939 {
01940     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01941     if(app->gCvsRunning)
01942     {
01943         SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
01944         return TRUE;
01945     }
01946
01947     return CListView::OnSetCursor(pWnd, nHitTest, message);
01948 }
01949
01950
01951 void CBrowseFileView::OnFilteringChanged()
01952 {
01953     if (!m_isResetViewPending)
01954     {
01955         m_isResetViewPending = true;
01956         PostMessage(WM_RESETVIEW);
01957     }
01958 }
01959
01960 void CBrowseFileView::OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult)
01961 {
01962     NM_LISTVIEW* p = (NM_LISTVIEW*)pNMHDR;
01963     if (p->lParam)
01964     {
01965         EntnodeData* data = (EntnodeData*)(LPVOID)p->lParam;
01966         data->UnRef();
01967     }
01968     *pResult = 0;
01969 }
01970
01971 LRESULT CBrowseFileView::OnResetView(WPARAM, LPARAM)
01972 {
01973     ResetView(false, NULL);
01974     return 0;
01975 }
01976
01977 void CBrowseFileView::OnUpdateQueryAnnotate(CCmdUI* pCmdUI)
01978 {
01979     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01980     CListCtrl& ListCtrl = GetListCtrl();
01981
01982     if(DisableCommon())
01983     {
01984         pCmdUI->Enable(FALSE);
01985         return;
01986     }
01987
01988     int nItem = -1;
01989     BOOL res = TRUE;
01990
01991     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01992     {
01993         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01994         if(data->IsUnknown() || data->GetType() == ENT_SUBDIR)
01995         {
01996             res = FALSE;
01997             break;
01998         }
01999     }
02000
02001     pCmdUI->Enable(res);
02002 }
02003
02004 void CBrowseFileView::OnQueryAnnotate()
02005 {
02006     KoAnnotateHandler handler;
02007     ProcessSelectionCommand(&handler);
02008 }
02009
02010 void CBrowseFileView::OnEditSelectAll()
02011 {
02012     CListCtrl& ListCtrl = GetListCtrl();
02013
02014     for( int nIndex = 0; nIndex < ListCtrl.GetItemCount(); nIndex++ )
02015     {
02016         EntnodeData *data = (EntnodeData*)ListCtrl.GetItemData(nIndex);
02017         if( data->GetType() == ENT_FILE )
02018         {
02019             ListCtrl.SetItemState(nIndex, LVIS_SELECTED, LVIS_SELECTED);
02020         }
02021     }
02022
02023     if( ListCtrl.GetSelectedCount() )
02024     {
02025         ListCtrl.SetFocus();
02026     }
02027 }
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/BrowseFileView.h Source File

WinCvs/BrowseFileView.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 /*
00022  * BrowseFileView.h -- Implements the view with all the files
00023  *
00024  * FILTER-VIEW-DEV branch, last merged up to 1.22
00025  */
00026
00027 #if !defined(AFX_BROWSEFILEVIEW_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00028 #define AFX_BROWSEFILEVIEW_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00029
00030 #if _MSC_VER >= 1000
00031 #pragma once
00032 #endif // _MSC_VER >= 1000
00033
00034 #include "CvsEntries.h"
00035 #include "CPStr.h"
00036 #include "SortHeaderCtrl.h"
00037
00038 class MultiFiles;
00039 class KoWatcher; // implementation helper
00040 class KiSelectionHandler;
00041 class KiColumnModel;
00042
00043 enum
00044 {
00045     kFileIconText = 0,
00046     kFileIconBinary,
00047     kFileIconUnknown,
00048     kFileIconAdded,
00049     kFileIconConflict,
00050     kFileIconMiss,
00051     kFolderIcon,
00052     kFolderIconUnknown,
00053     kFolderIconMiss,
00054     kFileIconTextMod,
00055     kFileIconBinaryMod,
00056     kFileIconIgnored,
00057     kFolderIconIgnored,
00058     kFileIconRemoved,
00059     kFileIconBinaryAdded
00060 };
00061
00062 class CBrowseFileView : public CListView
00063 {
00064 protected: // create from serialization only
00065     CBrowseFileView();
00066     DECLARE_DYNCREATE(CBrowseFileView)
00067
00068     bool DisableCommon(bool bCheckSelection = true);
00069         // for CCmdUI
00070
00071 // Operations
00072 public:
00073
00074     void OnFilteringChanged();
00075         // called to notify the view that app's filtering has changed
00076
00077     void ResetView(const char *path, bool notifyBrowser = false, const char *selectFile = 0L);
00078         // reset to this path and notify optionally the directories tree
00079         // optionally place the selection on specified file
00080
00081     void ResetView(bool notifyBrowser = false, const char *selectFile = 0L);
00082         // - reload and try to guess if something changed
00083         // according to the mod. time of CVS
00084         // - notify optionally the directories tree
00085         // - this should *not* be called from another thread. Use
00086         // the next one if you call from a thread.
00087         // optionally place the selection on specified file
00088
00089     inline void CheckChanges(void) { m_checkChanges = true; }
00090         // this will call ResetView(forceReload = false)
00091         // the next time the timer is called. To be used for foreign
00092         // threads in order to reload the view after cvs ends.
00093
00094     void Resort(void);
00095         // resort according to the current key
00096
00097     void InvalidateView(void);
00098         // will cause to rebuild the view after cvs returned
00099
00100     static int GetImageForEntry(EntnodeData *data);
00101         // return the ID of the image which symbolizes the
00102         // state of the file/directory
00103
00104     inline CFrameWnd *GetMainFrame() { return GetRoutingFrame(); }
00105         // used for changing the routing of CmdMsg
00106
00107     void ProcessSelectionCommand(KiSelectionHandler* handler);
00108         // processes a handler for selection command
00109
00110     void SaveColumns();
00111         // saves column state
00112
00113     bool LoadColumns();
00114         // loads column state
00115
00116     // retrieves columnar model of the data
00117     KiColumnModel* GetColumnModel() const
00118     {
00119         return m_modelColumns;
00120     }
00121
00122     void AddColumns();
00123         // adds columns to view
00124
00125     void DeleteColumns();
00126         // deletes all columns
00127
00128 // Overrides
00129     // ClassWizard generated virtual function overrides
00130     //{{AFX_VIRTUAL(CBrowseFileView)
00131     public:
00132     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00133     protected:
00134     virtual void OnInitialUpdate(); // called first time after construct
00135     virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
00136     virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
00137     virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
00138     //}}AFX_VIRTUAL
00139
00140 // Implementation
00141 public:
00142     virtual ~CBrowseFileView();
00143 #ifdef _DEBUG
00144     virtual void AssertValid() const;
00145     virtual void Dump(CDumpContext& dc) const;
00146 #endif
00147
00148 protected:
00149     void GetEntriesModTime(time_t & newEntriesMod, time_t & newEntriesLogMod);
00150     void EditSel(EntnodeData *data, bool useDefault = false);
00151     void DoDrag();
00152     void SetRecursive(bool isRecursive);
00153
00154     CSortHeaderCtrl m_ctrlHeader;
00155         // Sort header control
00156
00157     CStr m_path;
00158         // current path
00159     time_t m_entriesMod;
00160     time_t m_entriesLogMod;
00161         // time stamp of CVS/*
00162     int m_sort;
00163         // sort key
00164     bool m_ascendant;
00165         // sort flag
00166
00167     KiColumnModel* m_modelColumns;
00168     // columnar model in use
00169
00170     bool m_checkChanges;
00171         // used by the timer and CheckChanges
00172     int m_numberOfLines;
00173     int m_numberByPages;
00174     int m_numberOfPages;
00175     int m_heightOfLines;
00176         // for printing
00177
00178     bool m_isRecursive;
00179         // true if displaying recursively
00180
00181     KoWatcher* m_watch;
00182     // a thread to monitor file change notifications
00183
00184     bool m_isResetViewLocked;
00185     // flag to lock out recursion into ResetView()
00186
00187     bool m_isFilesChange;
00188     // tells if file change notification is pending
00189
00190     UINT m_uiFilechangeTimer;
00191     //stores the timer event for file's change notification, default to FILECHANGE_TIMER
00192
00193     bool m_isResetViewPending;
00194     // tells if there is an outstanding request to refresh the view contents
00195
00196 // Generated message map functions
00197 protected:
00198     //{{AFX_MSG(CBrowseFileView)
00199     afx_msg void OnViewSmallIcons();
00200     afx_msg void OnViewList();
00201     afx_msg void OnViewFullRowDetails();
00202     afx_msg void OnUpdateViewSmallIcons(CCmdUI* pCmdUI);
00203     afx_msg void OnUpdateViewAdd(CCmdUI* pCmdUI);
00204     afx_msg void OnUpdateViewAddB(CCmdUI* pCmdUI);
00205     afx_msg void OnUpdateViewUpdate(CCmdUI* pCmdUI);
00206     afx_msg void OnUpdateViewRelease(CCmdUI* pCmdUI);
00207     afx_msg void OnUpdateViewRmv(CCmdUI* pCmdUI);
00208     afx_msg void OnUpdateViewGraph(CCmdUI* pCmdUI);
00209     afx_msg void OnUpdateViewList(CCmdUI* pCmdUI);
00210     afx_msg void OnUpdateViewEditseldef(CCmdUI* pCmdUI);
00211     afx_msg void OnUpdateViewFullRowDetails(CCmdUI* pCmdUI);
00212     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00213     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00214     afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
00215     afx_msg void OnViewAdd();
00216     afx_msg void OnViewAddb();
00217     afx_msg void OnViewCommit();
00218     afx_msg void OnViewRmv();
00219     afx_msg void OnViewUpdate();
00220     afx_msg void OnViewQueryUpdate();
00221     afx_msg void OnUpdateViewReload(CCmdUI* pCmdUI);
00222     afx_msg void OnViewReload();
00223     afx_msg void OnKeydown(NMHDR* pNMHDR, LRESULT* pResult);
00224     afx_msg void OnViewUpone();
00225     afx_msg void OnUpdateViewUpone(CCmdUI* pCmdUI);
00226     afx_msg void OnViewTrash();
00227     afx_msg void OnUpdateViewTrash(CCmdUI* pCmdUI);
00228     afx_msg void OnViewDiff();
00229     afx_msg void OnViewLog();
00230     afx_msg void OnViewGraph();
00231     afx_msg void OnViewStatus();
00232     afx_msg void OnViewLock();
00233     afx_msg void OnViewUnlock();
00234     afx_msg void OnViewWatchOn();
00235     afx_msg void OnViewWatchOff();
00236     afx_msg void OnViewEdit();
00237     afx_msg void OnViewUnedit();
00238     afx_msg void OnViewWatchers();
00239     afx_msg void OnViewEditors();
00240     afx_msg void OnViewRelease();
00241     afx_msg void OnViewTagNew();
00242     afx_msg void OnViewTagDelete();
00243     afx_msg void OnViewTagBranch();
00244     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00245     afx_msg void OnViewExplore();
00246     afx_msg void OnUpdateViewExplore(CCmdUI* pCmdUI);
00247     afx_msg void OnTimer(UINT nIDEvent);
00248     afx_msg void OnViewEditsel();
00249     afx_msg void OnViewEditseldef();
00250     afx_msg void OnViewCheckout();
00251     afx_msg void OnUpdateViewCheckout(CCmdUI* pCmdUI);
00252     afx_msg void OnViewImport();
00253     afx_msg void OnUpdateViewImport(CCmdUI* pCmdUI);
00254     afx_msg void OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult);
00255     afx_msg void OnBeginrdrag(NMHDR* pNMHDR, LRESULT* pResult);
00256     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00257     afx_msg void OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
00258     afx_msg void OnDestroy();
00259     afx_msg void OnUpdateQueryAnnotate(CCmdUI* pCmdUI);
00260     afx_msg void OnQueryAnnotate();
00261     afx_msg void OnEditSelectAll();
00262     //}}AFX_MSG
00263     afx_msg void OnUpdateMacro(CCmdUI* pCmdUI);
00264     afx_msg BOOL OnMacro(UINT nID);
00265     afx_msg void OnUpdateCustomize(CCmdUI* pCmdUI);
00266     afx_msg BOOL OnCustomize(UINT nID);
00267     afx_msg LRESULT OnFileChange(WPARAM, LPARAM);
00268     afx_msg LRESULT OnResetView(WPARAM, LPARAM);
00269
00270     DECLARE_MESSAGE_MAP()
00271
00272 // list view image lists
00273 protected:
00274     void SetFullRowSel(BOOL bFullRowSel);
00275     static CImageList m_SmallImageList;
00276     static CImageList m_StateImageList;
00277
00278 // view type helpers
00279 public:
00280     BOOL SetViewType(DWORD dwViewType);
00281     DWORD GetViewType();
00282 // member access
00283     const CStr& GetPath() const { return m_path; };
00284 };
00285
00286 #endif // !defined(AFX_BROWSEFILEVIEW_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/BrowserBar.cpp Source File

WinCvs/BrowserBar.cpp

Go to the documentation of this file.
00001 // BrowserBar.cpp : implementation file
00002 //
00003
00004 #include "stdafx.h"
00005 #include "wincvs.h"
00006 #include "BrowserBar.h"
00007
00008 #ifdef _DEBUG
00009 #define new DEBUG_NEW
00010 #undef THIS_FILE
00011 static char THIS_FILE[] = __FILE__;
00012 #endif
00013
00015 // CBrowserBar
00016
00017 IMPLEMENT_DYNCREATE(CBrowserBar, CView)
00018
00019 CBrowserBar::CBrowserBar() : m_browser(0L)
00020 {
00021 }
00022
00023 CBrowserBar::~CBrowserBar()
00024 {
00025 }
00026
00027
00028 BEGIN_MESSAGE_MAP(CBrowserBar, CView)
00029     //{{AFX_MSG_MAP(CBrowserBar)
00030     ON_WM_WINDOWPOSCHANGED()
00031     ON_WM_DESTROY()
00032     ON_WM_PAINT()
00033     //}}AFX_MSG_MAP
00034 END_MESSAGE_MAP()
00035
00037 // CBrowserBar drawing
00038
00040 // CBrowserBar diagnostics
00041
00042 #ifdef _DEBUG
00043 void CBrowserBar::AssertValid() const
00044 {
00045     CView::AssertValid();
00046 }
00047
00048 void CBrowserBar::Dump(CDumpContext& dc) const
00049 {
00050     CView::Dump(dc);
00051 }
00052 #endif //_DEBUG
00053
00055 // CBrowserBar message handlers
00056
00057 void CBrowserBar::OnDraw(CDC* pDC)
00058 {
00059     CDocument* pDoc = GetDocument();
00060 }
00061
00062 BOOL CBrowserBar::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
00063 {
00064     BOOL res = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
00065     if(!res)
00066         return FALSE;
00067
00068     m_browser = (CWinCvsBrowser *)RUNTIME_CLASS(CWinCvsBrowser)->CreateObject();
00069     VERIFY(m_browser->Create(0L, "", WS_CHILD | WS_VISIBLE | WS_TABSTOP, CRect(0,0,0,0), this, 0));
00070
00071     return TRUE;
00072 }
00073
00074 void CBrowserBar::OnWindowPosChanged(WINDOWPOS FAR* wp)
00075 {
00076     CView::OnWindowPosChanged(wp);
00077
00078     //m_browser->SetWindowPos(NULL, wp->x, wp->y, wp->cx, wp->cy, SWP_NOZORDER);
00079     CRect r;
00080     GetClientRect(&r);
00081     if(m_browser != 0L)
00082         m_browser->SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER);
00083 }
00084
00085 void CBrowserBar::OnDestroy()
00086 {
00087     if(m_browser)
00088         m_browser->DestroyWindow();
00089
00090     CView::OnDestroy();
00091 }
00092
00093 void CBrowserBar::OnPaint()
00094 {
00095     CPaintDC dc(this); // device context for painting
00096
00097     CRect r;
00098     GetClientRect(&r);
00099     CBrush brush(GetSysColor(COLOR_WINDOW));
00100     dc.FillRect(r, &brush);
00101 }
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/BrowserBar.h Source File

WinCvs/BrowserBar.h

Go to the documentation of this file.
00001 #if !defined(AFX_BROWSERBAR_H__64721953_F9A8_11D2_BDEC_000000000000__INCLUDED_)
00002 #define AFX_BROWSERBAR_H__64721953_F9A8_11D2_BDEC_000000000000__INCLUDED_
00003
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 // BrowserBar.h : header file
00008 //
00009
00010 #include "WinCvsBrowser.h"
00011
00013 // CBrowserBar view
00014
00015 class CBrowserBar : public CView
00016 {
00017 public:
00018     virtual ~CBrowserBar();
00019
00020 protected:
00021     CBrowserBar();           // protected constructor used by dynamic creation
00022     DECLARE_DYNCREATE(CBrowserBar)
00023
00024 // Attributes
00025 public:
00026
00027 // Operations
00028 public:
00029     inline CWinCvsBrowser *GetBrowserView() { return m_browser; }
00030
00031 // Overrides
00032     // ClassWizard generated virtual function overrides
00033     //{{AFX_VIRTUAL(CBrowserBar)
00034     public:
00035     virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
00036     protected:
00037     virtual void OnDraw(CDC* pDC);      // overridden to draw this view
00038     //}}AFX_VIRTUAL
00039
00040 // Implementation
00041 protected:
00042 #ifdef _DEBUG
00043     virtual void AssertValid() const;
00044     virtual void Dump(CDumpContext& dc) const;
00045 #endif
00046
00047     CWinCvsBrowser *m_browser;
00048
00049     // Generated message map functions
00050 protected:
00051     //{{AFX_MSG(CBrowserBar)
00052     afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
00053     afx_msg void OnDestroy();
00054     afx_msg void OnPaint();
00055     //}}AFX_MSG
00056     DECLARE_MESSAGE_MAP()
00057 };
00058
00060
00061 //{{AFX_INSERT_LOCATION}}
00062 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00063
00064 #endif // !defined(AFX_BROWSERBAR_H__64721953_F9A8_11D2_BDEC_000000000000__INCLUDED_)
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ColorStatic.cpp Source File

WinCvs/ColorStatic.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- September 2001
00019  */
00020
00021 /*
00022  * ColorStatic.cpp --- color sample static control
00023  */
00024
00025 #include "stdafx.h"
00026 #include "wincvs.h"
00027 #include "ColorStatic.h"
00028
00029 #ifdef _DEBUG
00030 #define new DEBUG_NEW
00031 #undef THIS_FILE
00032 static char THIS_FILE[] = __FILE__;
00033 #endif
00034
00036 // CColorStatic
00037
00038 CColorStatic::CColorStatic()
00039 {
00040     m_color = RGB(255, 255, 255);
00041 }
00042
00043 CColorStatic::~CColorStatic()
00044 {
00045 }
00046
00047
00048 BEGIN_MESSAGE_MAP(CColorStatic, CStatic)
00049     //{{AFX_MSG_MAP(CColorStatic)
00050     ON_WM_PAINT()
00051     //}}AFX_MSG_MAP
00052 END_MESSAGE_MAP()
00053
00055 // CColorStatic message handlers
00056
00057 void CColorStatic::SetColor(COLORREF color)
00058 {
00059     m_color = color;
00060     if( IsWindow(m_hWnd) )
00061     {
00062         RedrawWindow();
00063     }
00064 }
00065
00066 COLORREF CColorStatic::GetColor()
00067 {
00068     return m_color;
00069 }
00070
00071 void CColorStatic::OnPaint()
00072 {
00073     CPaintDC dc(this); // device context for painting
00074
00075     CRect rect;
00076     GetClientRect(rect);
00077     dc.FillSolidRect(rect, m_color);
00078
00079     // Do not call CStatic::OnPaint() for painting messages
00080 }
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ColorStatic.h Source File

WinCvs/ColorStatic.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- September 2001
00019  */
00020
00021 /*
00022  * ColorStatic.h --- color sample static control
00023  */
00024
00025 #if !defined(AFX_COLORSTATIC_H__4D2B055E_F042_428F_A662_09ABEA902DCE__INCLUDED_)
00026 #define AFX_COLORSTATIC_H__4D2B055E_F042_428F_A662_09ABEA902DCE__INCLUDED_
00027
00028 #if _MSC_VER > 1000
00029 #pragma once
00030 #endif // _MSC_VER > 1000
00031 // ColorStatic.h : header file
00032 //
00033
00035 // CColorStatic window
00036
00037 class CColorStatic : public CStatic
00038 {
00039 // Construction
00040 public:
00041     CColorStatic();
00042
00043 // Attributes
00044 public:
00045
00046 // Operations
00047 public:
00048
00049 // Overrides
00050     // ClassWizard generated virtual function overrides
00051     //{{AFX_VIRTUAL(CColorStatic)
00052     //}}AFX_VIRTUAL
00053
00054 // Implementation
00055 public:
00056     COLORREF GetColor();
00057     void SetColor(COLORREF color);
00058     virtual ~CColorStatic();
00059
00060     // Generated message map functions
00061 protected:
00062     //{{AFX_MSG(CColorStatic)
00063     afx_msg void OnPaint();
00064     //}}AFX_MSG
00065
00066     DECLARE_MESSAGE_MAP()
00067 private:
00068     COLORREF m_color;
00069 };
00070
00072
00073 //{{AFX_INSERT_LOCATION}}
00074 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00075
00076 #endif // !defined(AFX_COLORSTATIC_H__4D2B055E_F042_428F_A662_09ABEA902DCE__INCLUDED_)
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ConsoleBar.cpp Source File

WinCvs/ConsoleBar.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1999
00019  */
00020
00021 /*
00022  * ConsoleBar.cpp -- Bar which owns the console
00023  */
00024
00025 #include "stdafx.h"
00026 #include "ConsoleBar.h"
00027 #include "wincvsView.h"
00028 #include "resource.h"
00029
00030 #ifdef _DEBUG
00031 #define new DEBUG_NEW
00032 #undef THIS_FILE
00033 static char THIS_FILE[] = __FILE__;
00034 #endif
00035
00037 // CBarConsole
00038
00039 CBarConsole::CBarConsole() : m_view(0L)
00040 {
00041     // TODO: add construction code here.
00042 }
00043
00044 CBarConsole::~CBarConsole()
00045 {
00046     // TODO: add destruction code here.
00047 }
00048
00049 BEGIN_MESSAGE_MAP(CBarConsole, CCJControlBar)
00050     //{{AFX_MSG_MAP(CBarConsole)
00051     ON_WM_CREATE()
00052     //}}AFX_MSG_MAP
00053 END_MESSAGE_MAP()
00054
00056 // CBarConsole message handlers
00057
00058 int CBarConsole::OnCreate(LPCREATESTRUCT lpCreateStruct)
00059 {
00060     if (CCJControlBar::OnCreate(lpCreateStruct) == -1)
00061         return -1;
00062
00063     m_view = (CWincvsView *)RUNTIME_CLASS(CWincvsView)->CreateObject();
00064     if(m_view == 0L)
00065     {
00066         TRACE0("Failed to create view for CBarConsole\n");
00067         return -1;
00068     }
00069
00070     // TODO: Add your specialized creation code here
00071     if (!m_view->Create(NULL, "",WS_CHILD | WS_VISIBLE | WS_BORDER,
00072         CRect(0,0,0,0), this, 0/*IDC_LIST_CTRL_2*/))
00073     {
00074         TRACE0("Failed to create view for CMyBarLeft\n");
00075         return -1;
00076     }
00077
00078     SetChild(m_view);
00079
00080     return 0;
00081 }
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ConsoleBar.h Source File

WinCvs/ConsoleBar.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1999
00019  */
00020
00021 /*
00022  * ConsoleBar.cpp -- Bar which owns the console
00023  */
00024
00025 #ifndef CONSOLE_BAR_H
00026 #define CONSOLE_BAR_H
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00033 // CBarConsole class
00034
00035 class CWincvsView;
00036
00037 class CBarConsole : public CCJControlBar
00038 {
00039 // Construction
00040 public:
00041     CBarConsole();
00042
00043 // Attributes
00044 public:
00045     CWincvsView *m_view;
00046
00047 // Operations
00048 public:
00049
00050 // Overrides
00051     // ClassWizard generated virtual function overrides
00052     //{{AFX_VIRTUAL(CBarConsole)
00053     //}}AFX_VIRTUAL
00054
00055 // Implementation
00056 public:
00057     virtual ~CBarConsole();
00058
00059 // Generated message map functions
00060 protected:
00061     //{{AFX_MSG(CBarConsole)
00062     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00063     //}}AFX_MSG
00064     DECLARE_MESSAGE_MAP()
00065 };
00066
00068
00069 //{{AFX_INSERT_LOCATION}}
00070 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00071
00072 #endif // !defined(CONSOLE_BAR_H)
00073
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CustomizeMenus.cpp Source File

WinCvs/CustomizeMenus.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 2000
00019  */
00020
00021 // CustomizeMenus.cpp : implementation file
00022 //
00023
00024 #include "stdafx.h"
00025 #include "wincvs.h"
00026 #include "CustomizeMenus.h"
00027 #include "MacrosSetup.h"
00028
00029 #ifdef _DEBUG
00030 #define new DEBUG_NEW
00031 #undef THIS_FILE
00032 static char THIS_FILE[] = __FILE__;
00033 #endif
00034
00035 #define INVTAB(msg, e) {msg, #e, e}
00036 static CustInvertTable sInitInvTable[] =
00037 {
00038     INVTAB("Separator", ID_SEPARATOR),
00039     INVTAB("Pr&eferences...\tCtrl+F1", ID_APP_PREFERENCES),
00040     INVTAB("&Command Line...", ID_APP_CMDLINE),
00041     INVTAB("&Login...", ID_APP_LOGIN),
00042     INVTAB("Lo&gout", ID_APP_LOGOUT),
00043     INVTAB("&Stop cvs", ID_STOPCVS),
00044     INVTAB("&Create a new repository...", ID_VIEW_INIT),
00045     INVTAB("&Import module from selection...", ID_VIEW_IMPORT),
00046     INVTAB("Chec&kout module to selection...", ID_VIEW_CHECKOUT),
00047     INVTAB("Create a &tag by module...", ID_APP_RTAGCREATE),
00048     INVTAB("&Delete a tag by module...", ID_APP_RTAGDELETE),
00049     INVTAB("Create a &branch by module...", ID_APP_RTAGBRANCH),
00050     INVTAB("&Update selection...\tCtrl+U", ID_VIEW_UPDATE),
00051     INVTAB("Co&mmit selection...\tCtrl+M", ID_VIEW_COMMIT),
00052     INVTAB("&Add selection", ID_VIEW_ADD),
00053     INVTAB("Add selection &binary", ID_VIEW_ADDB),
00054     INVTAB("&Remove selection", ID_VIEW_RMV),
00055     INVTAB("Erase &selection\tCtrl+Backspace", ID_VIEW_TRASH),
00056     INVTAB("Create a &tag on selection...", ID_VIEW_TAGNEW),
00057     INVTAB("&Delete a tag on selection...", ID_VIEW_TAGDELETE),
00058     INVTAB("Create a &branch on selection...", ID_VIEW_TAGBRANCH),
00059     INVTAB("E&xplore selection\tF2", ID_VIEW_EXPLORE),
00060     INVTAB("&Query Update\tF4", ID_VIEW_QUERYUPDATE),
00061     INVTAB("R&eload view\tF5", ID_VIEW_RELOAD),
00062     INVTAB("View &selection\tF7", ID_VIEW_EDITSEL),
00063     INVTAB("View &default", ID_VIEW_EDITSELDEF),
00064     INVTAB("&Diff selection\tAlt+=", ID_VIEW_DIFF),
00065     INVTAB("&Log selection...", ID_VIEW_LOG),
00066     INVTAB("&Status selection", ID_VIEW_STATUS),
00067     INVTAB("&Graph selection...\tCtrl+G", ID_VIEW_GRAPH),
00068     INVTAB("&Annotate selection...", ID_QUERY_ANNOTATE),
00069     INVTAB("&Lock selection", ID_VIEW_LOCKF),
00070     INVTAB("&Unlock selection", ID_VIEW_UNLOCKF),
00071     INVTAB("&Edit selection", ID_VIEW_EDIT),
00072     INVTAB("&Unedit selection", ID_VIEW_UNEDIT),
00073     INVTAB("&Add a Watch on selection", ID_VIEW_WATCHON),
00074     INVTAB("&Remove a watch from selection", ID_VIEW_WATCHOFF),
00075     INVTAB("Release &selection", ID_VIEW_RELEASE),
00076     INVTAB("&Watchers of selection", ID_VIEW_WATCHERS),
00077     INVTAB("E&ditors of selection", ID_VIEW_EDITORS),
00078     {0L, 0L, 0}
00079 };
00080
00081 class CCustInvertTable : public std::vector<CustInvertTable>
00082 {
00083 public:
00084     CCustInvertTable();
00085     virtual ~CCustInvertTable();
00086
00087     // get the macro inside the persistent cmd table
00088     void Initialize();
00089
00090 protected:
00091     std::vector<char *> m_garbage;
00092 } sInvTable;
00093
00094 CCustInvertTable::CCustInvertTable()
00095 {
00096     // init the cmd table with the static MFC commands
00097     const CustInvertTable *tmp = sInitInvTable;
00098     CustInvertTable newEntry;
00099     while(tmp->key != 0L)
00100     {
00101         newEntry = *tmp;
00102         push_back(newEntry);
00103         tmp++;
00104     }
00105 }
00106
00107 CCustInvertTable::~CCustInvertTable()
00108 {
00109     std::vector<char *>::iterator i;
00110     for(i = m_garbage.begin(); i != m_garbage.end(); ++i)
00111     {
00112         free(*i);
00113     }
00114 }
00115
00116 void CCustInvertTable::Initialize()
00117 {
00118     if(m_garbage.size() != 0)
00119         return;
00120
00121 #if 0 // fix me, Python
00122     vector<CMacroEntry>::const_iterator i;
00123     int cnt;
00124     CustInvertTable newEntry;
00125     for(cnt = 0, i = gMacrosAdmin.entries.begin(); i != gMacrosAdmin.entries.end(); ++i, cnt++)
00126     {
00127         newEntry.cmd = ID_MACRO_ADMIN + cnt;
00128         char *name = strdup((*i).name);
00129         m_garbage.push_back(name);
00130         newEntry.key = name;
00131         newEntry.title = name;
00132         push_back(newEntry);
00133     }
00134     for(cnt = 0, i = gMacrosSel.entries.begin(); i != gMacrosSel.entries.end(); ++i, cnt++)
00135     {
00136         newEntry.cmd = ID_MACRO_SEL + cnt;
00137         char *name = strdup((*i).name);
00138         m_garbage.push_back(name);
00139         newEntry.key = name;
00140         newEntry.title = name;
00141         push_back(newEntry);
00142     }
00143 #endif
00144 }
00145
00146 const CustInvertTable *CustGetByKey(const char *entry)
00147 {
00148     std::vector<CustInvertTable>::const_iterator tmp;
00149     sInvTable.Initialize();
00150     for(tmp = sInvTable.begin(); tmp != sInvTable.end(); ++tmp)
00151     {
00152         if(strcmp(entry, (*tmp).key) == 0)
00153             return &*tmp;
00154     }
00155     return 0L;
00156 }
00157
00158 static char *GetInvString(const CustInvertTable *entry)
00159 {
00160     static CString res;
00161     res = entry->title;
00162     int ind;
00163     if((ind = res.Find('&')) != -1)
00164         res.Delete(ind);
00165     if((ind = res.Find('\t')) != -1)
00166         res = res.Left(ind);
00167     return (char *)(const char *)res;
00168 }
00169
00170 static bool IsInInvertList(const CustInvertTable *entry, const std::vector<UStr> & list)
00171 {
00172     std::vector<UStr>::const_iterator i;
00173     for(i = list.begin(); i != list.end(); ++i)
00174     {
00175         const CustInvertTable *tab = CustGetByKey(*i);
00176         if(tab == 0L)
00177             continue;
00178
00179         if(strcmp(entry->key, tab->key) == 0)
00180             return true;
00181     }
00182     return false;
00183 }
00184
00186 // CCustomizeMenus dialog
00187
00188
00189 CCustomizeMenus::CCustomizeMenus(CMMenuString *fromMenu, CWnd* pParent /*=NULL*/)
00190     : CDialog(CCustomizeMenus::IDD, pParent), m_Menu(fromMenu)
00191 {
00192     //{{AFX_DATA_INIT(CCustomizeMenus)
00193     //}}AFX_DATA_INIT
00194 }
00195
00196
00197 void CCustomizeMenus::DoDataExchange(CDataExchange* pDX)
00198 {
00199     CDialog::DoDataExchange(pDX);
00200     //{{AFX_DATA_MAP(CCustomizeMenus)
00201     DDX_Control(pDX, IDC_MENULIST, m_menuList);
00202     DDX_Control(pDX, IDC_ALLCMDS, m_cmdsList);
00203     DDX_Control(pDX, IDC_UP, m_upbtn);
00204     DDX_Control(pDX, IDC_REMOVE, m_removebtn);
00205     DDX_Control(pDX, IDC_DOWN, m_downbtn);
00206     DDX_Control(pDX, IDC_ADD, m_addbtn);
00207     //}}AFX_DATA_MAP
00208
00209     if(!pDX->m_bSaveAndValidate)
00210     {
00211         // initialize the buttons
00212         m_upbtn.EnableWindow(FALSE);
00213         m_downbtn.EnableWindow(FALSE);
00214         m_addbtn.EnableWindow(FALSE);
00215         m_removebtn.EnableWindow(FALSE);
00216         m_cmdsList.SetExtendedStyle(
00217             m_cmdsList.GetExtendedStyle() |
00218             LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
00219         m_menuList.SetExtendedStyle(
00220             m_menuList.GetExtendedStyle() |
00221             LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
00222     }
00223 }
00224
00225
00226 BEGIN_MESSAGE_MAP(CCustomizeMenus, CDialog)
00227     //{{AFX_MSG_MAP(CCustomizeMenus)
00228     ON_BN_CLICKED(IDC_REMOVE, OnRemove)
00229     ON_BN_CLICKED(IDC_ADD, OnAdd)
00230     ON_NOTIFY(LVN_ITEMCHANGED, IDC_ALLCMDS, OnItemchangedAllcmds)
00231     ON_NOTIFY(NM_DBLCLK, IDC_MENULIST, OnDblclkMenulist)
00232     ON_NOTIFY(NM_DBLCLK, IDC_ALLCMDS, OnDblclkAllcmds)
00233     ON_NOTIFY(LVN_ITEMCHANGED, IDC_MENULIST, OnItemchangedMenulist)
00234     ON_BN_CLICKED(IDC_DOWN, OnDown)
00235     ON_BN_CLICKED(IDC_UP, OnUp)
00236     ON_NOTIFY(LVN_BEGINDRAG, IDC_MENULIST, OnBegindragMenulist)
00237     //}}AFX_MSG_MAP
00238 END_MESSAGE_MAP()
00239
00241 // CCustomizeMenus message handlers
00242
00243 void CCustomizeMenus::OnRemove()
00244 {
00245     int nItem = m_menuList.GetNextItem(-1, LVNI_SELECTED);
00246     if(nItem == -1)
00247         return;
00248
00249     const CustInvertTable *data = (const CustInvertTable *)
00250         m_menuList.GetItemData(nItem);
00251
00252     if(data->cmd != ID_SEPARATOR)
00253     {
00254         LV_ITEM lvi;
00255         lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
00256         lvi.iItem = m_cmdsList.GetItemCount();
00257         lvi.iSubItem = 0;
00258         lvi.lParam = (DWORD)data;
00259         lvi.pszText = GetInvString(data);
00260         lvi.iImage = GetIcon(data);
00261
00262         int newItem = m_cmdsList.InsertItem(&lvi);
00263         VERIFY(m_cmdsList.EnsureVisible(newItem, TRUE));
00264         VERIFY(m_cmdsList.SetItemState(newItem, LVIS_SELECTED, LVIS_SELECTED));
00265     }
00266
00267     VERIFY(m_menuList.DeleteItem(nItem));
00268 }
00269
00270 void CCustomizeMenus::OnAdd()
00271 {
00272     int nItem = m_cmdsList.GetNextItem(-1, LVNI_SELECTED);
00273     if(nItem == -1)
00274         return;
00275
00276     const CustInvertTable *data = (const CustInvertTable *)
00277         m_cmdsList.GetItemData(nItem);
00278
00279     LV_ITEM lvi;
00280     lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
00281     lvi.iItem = m_menuList.GetItemCount();
00282     lvi.iSubItem = 0;
00283     lvi.lParam = (DWORD)data;
00284     lvi.pszText = GetInvString(data);
00285     lvi.iImage = GetIcon(data);
00286
00287     int newItem = m_menuList.InsertItem(&lvi);
00288     VERIFY(m_menuList.EnsureVisible(newItem, TRUE));
00289     VERIFY(m_menuList.SetItemState(newItem, LVIS_SELECTED, LVIS_SELECTED));
00290
00291     if(data->cmd != ID_SEPARATOR)
00292     {
00293         VERIFY(m_cmdsList.DeleteItem(nItem));
00294     }
00295 }
00296
00297 static int CALLBACK _Compare(LPARAM data1, LPARAM data2, LPARAM data)
00298 {
00299     CustInvertTable *d1 = (CustInvertTable *)data1;
00300     CustInvertTable *d2 = (CustInvertTable *)data2;
00301
00302     CString s1(GetInvString(d1));
00303     CString s2(GetInvString(d2));
00304     int cmp = strcmp(s1, s2);
00305     if(cmp == 0)
00306         return 0;
00307     if(d1->cmd == ID_SEPARATOR)
00308         return -1;
00309     if(d2->cmd == ID_SEPARATOR)
00310         return 1;
00311     return cmp;
00312 }
00313
00314 void CCustomizeMenus::OnOK()
00315 {
00316     std::vector<UStr> & list = m_Menu->GetList();
00317     list.erase(list.begin(), list.end());
00318
00319     int nItem = -1;
00320     while((nItem = m_menuList.GetNextItem(nItem, LVNI_ALL)) != -1)
00321     {
00322         const CustInvertTable *data = (const CustInvertTable *)
00323             m_menuList.GetItemData(nItem);
00324
00325         list.push_back(data->key);
00326     }
00327
00328     CDialog::OnOK();
00329 }
00330
00331 BOOL CCustomizeMenus::OnInitDialog()
00332 {
00333     m_SmallImageList.Create(IDR_CUSTMENUS, 16, 1, RGB(255, 255, 255));
00334     sInvTable.Initialize();
00335
00336     CDialog::OnInitDialog();
00337
00338     LV_COLUMN lvc;
00339     int cnt;
00340     const std::vector<UStr> & list = m_Menu->GetList();
00341
00342     // Get the client rect of the list view control
00343     CRect rect;
00344     m_cmdsList.GetClientRect(&rect);
00345
00346     // Make the width of the column to the width of the client area minus
00347     // the width of a scroll bar
00348     int nWidth = rect.right - ::GetSystemMetrics(SM_CXVSCROLL);
00349
00350     // first the left list
00351     lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
00352     lvc.iSubItem = 0;
00353     lvc.cx = nWidth;
00354     lvc.fmt = LVCFMT_LEFT;
00355     m_cmdsList.InsertColumn(0, &lvc);
00356     m_cmdsList.SetImageList(&m_SmallImageList, LVSIL_SMALL);
00357
00358     std::vector<CustInvertTable>::const_iterator table;
00359     for(cnt = 0, table = sInvTable.begin(); table != sInvTable.end(); ++table, cnt++)
00360     {
00361         const CustInvertTable & tablEntry = *table;
00362         if(table->cmd != ID_SEPARATOR && IsInInvertList(&tablEntry, list))
00363             continue;
00364
00365         LV_ITEM lvi;
00366         lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
00367         lvi.iItem = cnt;
00368         lvi.iSubItem = 0;
00369         lvi.lParam = (DWORD)&tablEntry;
00370         lvi.pszText = GetInvString(&tablEntry);
00371         lvi.iImage = GetIcon(table);
00372
00373         m_cmdsList.InsertItem(&lvi);
00374     }
00375
00376     m_cmdsList.SortItems(_Compare, 0L);
00377
00378     // then the right one
00379     lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
00380     lvc.iSubItem = 0;
00381     lvc.cx = nWidth;
00382     lvc.fmt = LVCFMT_LEFT;
00383     m_menuList.InsertColumn(0, &lvc);
00384     m_menuList.SetImageList(&m_SmallImageList, LVSIL_SMALL);
00385
00386     std::vector<UStr>::const_iterator i;
00387
00388     for(cnt = 0, i = list.begin(); i != list.end(); ++i, cnt++)
00389     {
00390         const CustInvertTable *tab = CustGetByKey(*i);
00391         if(tab == 0L)
00392             continue;
00393
00394         LV_ITEM lvi;
00395         lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
00396         lvi.iItem = cnt;
00397         lvi.iSubItem = 0;
00398         lvi.lParam = (DWORD)tab;
00399         lvi.pszText = GetInvString(tab);
00400         lvi.iImage = GetIcon(tab);
00401
00402         m_menuList.InsertItem(&lvi);
00403     }
00404
00405     return TRUE;  // return TRUE unless you set the focus to a control
00406                   // EXCEPTION: OCX Property Pages should return FALSE
00407 }
00408
00409 void CCustomizeMenus::OnItemchangedAllcmds(NMHDR* pNMHDR, LRESULT* pResult)
00410 {
00411     NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
00412     // TODO: Add your control notification handler code here
00413
00414     *pResult = 0;
00415     int nItem = m_cmdsList.GetNextItem(-1, LVNI_SELECTED);
00416     m_addbtn.EnableWindow(nItem != -1);
00417 }
00418
00419 void CCustomizeMenus::OnDblclkMenulist(NMHDR* pNMHDR, LRESULT* pResult)
00420 {
00421     OnRemove();
00422
00423     *pResult = 0;
00424 }
00425
00426 void CCustomizeMenus::OnDblclkAllcmds(NMHDR* pNMHDR, LRESULT* pResult)
00427 {
00428     OnAdd();
00429
00430     *pResult = 0;
00431 }
00432
00433 void CCustomizeMenus::OnItemchangedMenulist(NMHDR* pNMHDR, LRESULT* pResult)
00434 {
00435     NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
00436     // TODO: Add your control notification handler code here
00437
00438     *pResult = 0;
00439     int nItem = m_menuList.GetNextItem(-1, LVNI_SELECTED);
00440     m_removebtn.EnableWindow(nItem != -1);
00441
00442     if(nItem == -1)
00443     {
00444         m_upbtn.EnableWindow(FALSE);
00445         m_downbtn.EnableWindow(FALSE);
00446     }
00447     else if(nItem == 0)
00448     {
00449         m_upbtn.EnableWindow(FALSE);
00450         m_downbtn.EnableWindow(m_menuList.GetItemCount() > 1 ? TRUE : FALSE);
00451     }
00452     else if(nItem == m_menuList.GetItemCount() - 1)
00453     {
00454         m_upbtn.EnableWindow(TRUE);
00455         m_downbtn.EnableWindow(FALSE);
00456     }
00457     else
00458     {
00459         m_upbtn.EnableWindow(TRUE);
00460         m_downbtn.EnableWindow(TRUE);
00461     }
00462 }
00463
00464 void CCustomizeMenus::OnMove(int offset)
00465 {
00466     int nItem = m_menuList.GetNextItem(-1, LVNI_SELECTED);
00467     if(nItem == -1)
00468         return;
00469
00470     const CustInvertTable *data = (const CustInvertTable *)
00471         m_menuList.GetItemData(nItem);
00472
00473     int newPos = nItem + offset;
00474     if(newPos < 0 || newPos > m_menuList.GetItemCount())
00475         return;
00476
00477     VERIFY(m_menuList.DeleteItem(nItem));
00478
00479     LV_ITEM lvi;
00480     lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
00481     lvi.iItem = newPos;
00482     lvi.iSubItem = 0;
00483     lvi.lParam = (DWORD)data;
00484     lvi.pszText = GetInvString(data);
00485     lvi.iImage = GetIcon(data);
00486
00487     int newItem = m_menuList.InsertItem(&lvi);
00488     VERIFY(m_menuList.EnsureVisible(newItem, TRUE));
00489     VERIFY(m_menuList.SetItemState(newItem, LVIS_SELECTED, LVIS_SELECTED));
00490 }
00491
00492 void CCustomizeMenus::OnDown()
00493 {
00494     OnMove(1);
00495 }
00496
00497 void CCustomizeMenus::OnUp()
00498 {
00499     OnMove(-1);
00500 }
00501
00502 void CCustomizeMenus::OnBegindragMenulist(NMHDR* pNMHDR, LRESULT* pResult)
00503 {
00504     NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
00505     // TODO: Add your control notification handler code here
00506
00507     *pResult = 0;
00508 }
00509
00510 int CCustomizeMenus::GetIcon(const CustInvertTable *entry)
00511 {
00512     if(entry->cmd == ID_SEPARATOR)
00513         return 0;
00514
00515     if(entry->cmd >= ID_MACRO_SEL && entry->cmd < (ID_MACRO_SEL + 100))
00516         return 2;
00517
00518     if(entry->cmd >= ID_MACRO_ADMIN && entry->cmd < (ID_MACRO_ADMIN + 100))
00519         return 2;
00520
00521     return 1;
00522 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CustomizeMenus.h Source File

WinCvs/CustomizeMenus.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 2000
00019  */
00020
00021 #if !defined(AFX_CUSTOMIZEMENUS_H__28A6AE7E_C54B_47A5_A8F5_A127E2E9F3BF__INCLUDED_)
00022 #define AFX_CUSTOMIZEMENUS_H__28A6AE7E_C54B_47A5_A8F5_A127E2E9F3BF__INCLUDED_
00023
00024 #if _MSC_VER > 1000
00025 #pragma once
00026 #endif // _MSC_VER > 1000
00027 // CustomizeMenus.h : header file
00028 //
00029
00030 #include "Persistent.h"
00031 #include "CPStr.h"
00032
00033 typedef struct
00034 {
00035     const char *title;
00036     const char *key;
00037     int cmd;
00038 } CustInvertTable;
00039
00040 const CustInvertTable *CustGetByKey(const char *entry);
00041
00042 class CMMenuString : public CPersistent
00043 {
00044 public:
00045     CMMenuString(unsigned int maxstr, const char *uniqueName, char * const *defaultStr = 0L);
00046         // defaultStr is a null terminated set of strings
00047
00048     virtual ~CMMenuString();
00049
00050     virtual unsigned int SizeOf(void) const;
00051     virtual const void *GetData(void) const;
00052     virtual void SetData(const void *ptr, unsigned int size);
00053         // persistent interface
00054
00055     void Insert(const char *newstr);
00056         // add a new string
00057
00058     inline const std::vector<UStr> & GetList(void) const { return fAllStrs; }
00059     inline std::vector<UStr> & GetList(void) { TouchTimeStamp(); return fAllStrs; }
00060
00061 protected:
00062     std::vector<UStr> fAllStrs;
00063     CStaticAllocT<char> fBuf;
00064     unsigned int fMaxStr;
00065 };
00066
00068 // CCustomizeMenus dialog
00069
00070 class CCustomizeMenus : public CDialog
00071 {
00072 // Construction
00073 public:
00074     CCustomizeMenus(CMMenuString *fromMenu, CWnd* pParent = NULL);   // standard constructor
00075
00076 // Dialog Data
00077     //{{AFX_DATA(CCustomizeMenus)
00078     enum { IDD = IDD_CUSTOMIZE };
00079     CListCtrl   m_menuList;
00080     CListCtrl   m_cmdsList;
00081     CButton m_upbtn;
00082     CButton m_removebtn;
00083     CButton m_downbtn;
00084     CButton m_addbtn;
00085     //}}AFX_DATA
00086
00087
00088 // Overrides
00089     // ClassWizard generated virtual function overrides
00090     //{{AFX_VIRTUAL(CCustomizeMenus)
00091     protected:
00092     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00093     //}}AFX_VIRTUAL
00094
00095 // Implementation
00096 protected:
00097     CMMenuString *m_Menu;
00098     CImageList m_SmallImageList;
00099
00100     void OnMove(int offset);
00101     virtual void OnOK();
00102
00103     int GetIcon(const CustInvertTable *entry);
00104
00105     // Generated message map functions
00106     //{{AFX_MSG(CCustomizeMenus)
00107     afx_msg void OnRemove();
00108     afx_msg void OnAdd();
00109     virtual BOOL OnInitDialog();
00110     afx_msg void OnItemchangedAllcmds(NMHDR* pNMHDR, LRESULT* pResult);
00111     afx_msg void OnDblclkMenulist(NMHDR* pNMHDR, LRESULT* pResult);
00112     afx_msg void OnDblclkAllcmds(NMHDR* pNMHDR, LRESULT* pResult);
00113     afx_msg void OnItemchangedMenulist(NMHDR* pNMHDR, LRESULT* pResult);
00114     afx_msg void OnDown();
00115     afx_msg void OnUp();
00116     afx_msg void OnBegindragMenulist(NMHDR* pNMHDR, LRESULT* pResult);
00117     //}}AFX_MSG
00118     DECLARE_MESSAGE_MAP()
00119 };
00120
00121 //{{AFX_INSERT_LOCATION}}
00122 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00123
00124 #endif // !defined(AFX_CUSTOMIZEMENUS_H__28A6AE7E_C54B_47A5_A8F5_A127E2E9F3BF__INCLUDED_)
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CvsStatusBar.cpp Source File

WinCvs/CvsStatusBar.cpp

Go to the documentation of this file.
00001 // CvsStatusBar.cpp : implementation file
00002 //
00003
00004 #include "stdafx.h"
00005 #include "wincvs.h"
00006 #include "CvsStatusBar.h"
00007 #include "CvsPrefs.h"
00008
00009 #ifdef _DEBUG
00010 #define new DEBUG_NEW
00011 #undef THIS_FILE
00012 static char THIS_FILE[] = __FILE__;
00013 #endif
00014
00016 // CCvsStatusBar
00017
00018 CCvsStatusBar::CCvsStatusBar() : m_step(-1), m_settimer(false)
00019 {
00020     m_indic.LoadBitmap(IDB_IDLE);
00021 }
00022
00023 CCvsStatusBar::~CCvsStatusBar()
00024 {
00025 }
00026
00027 void CCvsStatusBar::DrawItem(LPDRAWITEMSTRUCT p)
00028 {
00029     if(!m_settimer)
00030     {
00031         SetTimer(999, 100, 0L);
00032         m_settimer = true;
00033     }
00034
00035     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00036     if(!app->gCvsRunning && !gCvsPrefs.IsTclFileRunning())
00037         return;
00038
00039     static int tab[12] = {
00040         -2, -1, 1, 4, 8, 11, 13, 11,
00041         8, 4, 1, -1};
00042     CDC hdc;
00043     CBrush b(RGB(0, 0, 0xFF));
00044
00045     hdc.Attach(p->hDC);
00046     CRect r(p->rcItem);
00047     hdc.FillRect(r, &b);
00048     CPoint off(r.TopLeft());
00049     off.x -= m_step;
00050     int cnt = 0;
00051     while(off.x < r.right)
00052     {
00053         CPoint offy(off);
00054         offy.y += tab[(m_step + cnt) % 12];
00055         hdc.DrawState(offy, CSize(16,16), m_indic, DSS_NORMAL);
00056         off.x += 24;
00057         cnt++;
00058     }
00059     hdc.Detach();
00060 }
00061
00062 void CCvsStatusBar::OnTimer(UINT nIDEvent)
00063 {
00064     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00065     if(app->gCvsRunning || gCvsPrefs.IsTclFileRunning())
00066     {
00067         if(++m_step == 24)
00068             m_step = 0;
00069
00070         CRect r;
00071         GetItemRect(1, r);
00072         InvalidateRect(r, FALSE);
00073     }
00074     else if(m_step != -1)
00075     {
00076         m_step = -1;
00077         CRect r;
00078         GetItemRect(1, r);
00079         InvalidateRect(r, FALSE);
00080     }
00081 }
00082
00083 BEGIN_MESSAGE_MAP(CCvsStatusBar, CStatusBar)
00084     //{{AFX_MSG_MAP(CCvsStatusBar)
00085     ON_WM_TIMER()
00086     //}}AFX_MSG_MAP
00087 END_MESSAGE_MAP()
00088
00090 // CCvsStatusBar message handlers
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CvsStatusBar.h Source File

WinCvs/CvsStatusBar.h

Go to the documentation of this file.
00001 #if !defined(AFX_CVSSTATUSBAR_H__F549ACF2_ECFE_4933_A05D_5FC8248C3CD4__INCLUDED_)
00002 #define AFX_CVSSTATUSBAR_H__F549ACF2_ECFE_4933_A05D_5FC8248C3CD4__INCLUDED_
00003
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 // CvsStatusBar.h : header file
00008 //
00009
00011 // CCvsStatusBar window
00012
00013 class CCvsStatusBar : public CStatusBar
00014 {
00015 // Construction
00016 public:
00017     CCvsStatusBar();
00018
00019 // Attributes
00020 public:
00021
00022 // Operations
00023 public:
00024     virtual void DrawItem(LPDRAWITEMSTRUCT);
00025
00026 // Overrides
00027     // ClassWizard generated virtual function overrides
00028     //{{AFX_VIRTUAL(CCvsStatusBar)
00029     //}}AFX_VIRTUAL
00030
00031 // Implementation
00032 public:
00033     virtual ~CCvsStatusBar();
00034
00035     // Generated message map functions
00036 protected:
00037     CBitmap m_indic;
00038     int m_step;
00039     bool m_settimer;
00040     //{{AFX_MSG(CCvsStatusBar)
00041     afx_msg void OnTimer(UINT nIDEvent);
00042     //}}AFX_MSG
00043
00044     DECLARE_MESSAGE_MAP()
00045 };
00046
00048
00049 //{{AFX_INSERT_LOCATION}}
00050 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00051
00052 #endif // !defined(AFX_CVSSTATUSBAR_H__F549ACF2_ECFE_4933_A05D_5FC8248C3CD4__INCLUDED_)
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ExploreBar.cpp Source File

WinCvs/ExploreBar.cpp

Go to the documentation of this file.
00001 // ExploreBar.cpp : implementation file
00002 //
00003
00004 #include "stdafx.h"
00005 #include "wincvs.h"
00006 #include "MainFrm.h"
00007 #include "ExploreBar.h"
00008 #include "BrowseFileView.h"
00009 #include "FileTraversal.h"
00010 #include "CvsCommands.h"
00011 #include "CvsPrefs.h"
00012
00013 #ifdef _DEBUG
00014 #define new DEBUG_NEW
00015 #undef THIS_FILE
00016 static char THIS_FILE[] = __FILE__;
00017 #endif
00018
00019 IMPLEMENT_DYNAMIC(CMyShellTree, CCJShellTree)
00020
00021 BEGIN_MESSAGE_MAP(CMyShellTree, CCJShellTree)
00022     //{{AFX_MSG_MAP(CMyShellTree)
00023     ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
00024     ON_NOTIFY_REFLECT(TVN_DELETEITEM, OnDeleteitem)
00025     ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
00026     ON_NOTIFY_REFLECT(TVN_ITEMEXPANDING, OnItemexpanding)
00027     //}}AFX_MSG_MAP
00028 END_MESSAGE_MAP()
00029
00030 bool CMyShellTree::DisableCommon()
00031 {
00032     CWincvsApp *app = (CWincvsApp *)AfxGetApp();
00033     return app->gCvsRunning || gCvsPrefs.empty();
00034 }
00035
00036 void CMyShellTree::OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult)
00037 {
00038     if(DisableCommon())
00039     {
00040         *pResult = 1;
00041         return;
00042     }
00043
00044     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00045     CCJShellTree::OnItemexpanding(pNMHDR,pResult);
00046     CCJShellTree::Invalidate();
00047     *pResult = 0;
00048 }
00049
00050 void CMyShellTree::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
00051 {
00052     if(DisableCommon())
00053     {
00054         *pResult = 1;
00055         return;
00056     }
00057
00058     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00059
00060     CString szPath;
00061     CCJShellTree::OnSelchanged(pNMHDR,pResult);
00062
00063     if(CCJShellTree::GetSelectedFolderPath(szPath))
00064     {
00065         CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00066         CBrowseFileView *view = app->GetFileView();
00067         if(view != 0L)
00068             view->ResetView(szPath);
00069     }
00070
00071     *pResult = 0;
00072 }
00073
00074 void CMyShellTree::OnRclick(NMHDR* pNMHDR, LRESULT* pResult)
00075 {
00076     if(DisableCommon())
00077     {
00078         *pResult = 1;
00079         return;
00080     }
00081
00082     // TODO: Add your control notification handler code here
00083     CCJShellTree::OnRclick(pNMHDR,pResult);
00084     *pResult = 0;
00085 }
00086
00087 void CMyShellTree::OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult)
00088 {
00089     if(DisableCommon())
00090     {
00091         *pResult = 1;
00092         return;
00093     }
00094
00095     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00096     // TODO: Add your control notification handler code here
00097     CCJShellTree::OnDeleteitem(pNMHDR,pResult);
00098     *pResult = 0;
00099 }
00100
00102 // CExploreBar
00103
00104 IMPLEMENT_DYNCREATE(CExploreBar, CView)
00105
00106 CExploreBar::CExploreBar()
00107 {
00108 }
00109
00110 CExploreBar::~CExploreBar()
00111 {
00112 }
00113
00114
00115 BEGIN_MESSAGE_MAP(CExploreBar, CView)
00116     //{{AFX_MSG_MAP(CExploreBar)
00117     ON_WM_WINDOWPOSCHANGED()
00118     ON_COMMAND(ID_VIEW_CHECKOUT, OnViewCheckout)
00119     ON_UPDATE_COMMAND_UI(ID_VIEW_CHECKOUT, OnUpdateViewCheckout)
00120     ON_COMMAND(ID_VIEW_IMPORT, OnViewImport)
00121     ON_UPDATE_COMMAND_UI(ID_VIEW_IMPORT, OnUpdateViewImport)
00122     //}}AFX_MSG_MAP
00123 END_MESSAGE_MAP()
00124
00126 // CExploreBar drawing
00127
00128 void CExploreBar::OnDraw(CDC* pDC)
00129 {
00130     CDocument* pDoc = GetDocument();
00131 }
00132
00134 // CExploreBar diagnostics
00135
00136 #ifdef _DEBUG
00137 void CExploreBar::AssertValid() const
00138 {
00139     CView::AssertValid();
00140 }
00141
00142 void CExploreBar::Dump(CDumpContext& dc) const
00143 {
00144     CView::Dump(dc);
00145 }
00146 #endif //_DEBUG
00147
00149 // CExploreBar message handlers
00150
00151 BOOL CExploreBar::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
00152 {
00153     BOOL res = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
00154
00155     if(res)
00156     {
00157         if (!m_TreeCtrl.Create(
00158             WS_VISIBLE|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS,
00159             CRect(0,0,0,0), this, IDC_BAR_TREE))
00160         {
00161             TRACE0("Unable to create caption button.\n");
00162             return FALSE;
00163         }
00164     }
00165
00166     //m_TreeCtrl.EnableImages();
00167     //m_TreeCtrl.PopulateTree();
00168
00169     //SetChild(&m_TreeCtrl);
00170
00171     return res;
00172 }
00173
00174 void CExploreBar::OnWindowPosChanged(WINDOWPOS FAR* wp)
00175 {
00176     CView::OnWindowPosChanged(wp);
00177
00178     CRect r;
00179     GetClientRect(&r);
00180     m_TreeCtrl.SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER);
00181 }
00182
00183 void CExploreBar::OnUpdateCmd(CCmdUI* pCmdUI)
00184 {
00185     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00186     if(DisableCommon())
00187     {
00188         pCmdUI->Enable(FALSE);
00189         return;
00190     }
00191     CString folderPath;
00192     if(!m_TreeCtrl.GetSelectedFolderPath(folderPath) || folderPath.IsEmpty())
00193     {
00194         pCmdUI->Enable(FALSE);
00195         return;
00196     }
00197
00198     pCmdUI->Enable(TRUE);
00199 }
00200
00201 bool CExploreBar::DisableCommon()
00202 {
00203     CWincvsApp *app = (CWincvsApp *)AfxGetApp();
00204     return app->gCvsRunning || gCvsPrefs.empty();
00205 }
00206
00207 void CExploreBar::OnViewCheckout()
00208 {
00209     CString folderPath;
00210     if(m_TreeCtrl.GetSelectedFolderPath(folderPath) && !folderPath.IsEmpty())
00211         CvsCmdCheckoutModule(folderPath);
00212 }
00213
00214 void CExploreBar::OnUpdateViewCheckout(CCmdUI* pCmdUI)
00215 {
00216     OnUpdateCmd(pCmdUI);
00217     pCmdUI->SetText("Chec&kout module to selection...");
00218 }
00219
00220 void CExploreBar::OnViewImport()
00221 {
00222     CString folderPath;
00223     if(m_TreeCtrl.GetSelectedFolderPath(folderPath) && !folderPath.IsEmpty())
00224         CvsCmdImportModule(folderPath);
00225 }
00226
00227 void CExploreBar::OnUpdateViewImport(CCmdUI* pCmdUI)
00228 {
00229     OnUpdateCmd(pCmdUI);
00230     pCmdUI->SetText("&Import module from selection...");
00231 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ExploreBar.h Source File

WinCvs/ExploreBar.h

Go to the documentation of this file.
00001 #if !defined(AFX_EXPLOREBAR_H__A132A164_1A90_11D3_B1A1_004095463819__INCLUDED_)
00002 #define AFX_EXPLOREBAR_H__A132A164_1A90_11D3_B1A1_004095463819__INCLUDED_
00003
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 // ExploreBar.h : header file
00008 //
00009
00010 #include "CJShellTree.h"
00011
00013 // CExploreBar view
00014
00015 class CMyShellTree : public CCJShellTree
00016 {
00017     DECLARE_DYNAMIC(CMyShellTree)
00018
00019 protected:
00020     bool DisableCommon();
00021
00022     //{{AFX_MSG(CCJShellTree)
00023     afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
00024     afx_msg void OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
00025     afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
00026     afx_msg void OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult);
00027     //}}AFX_MSG
00028
00029     DECLARE_MESSAGE_MAP()
00030 };
00031
00032 class CExploreBar : public CView
00033 {
00034 protected:
00035     CExploreBar();           // protected constructor used by dynamic creation
00036     DECLARE_DYNCREATE(CExploreBar)
00037
00038 // Attributes
00039 public:
00040     CMyShellTree  m_TreeCtrl;
00041
00042 // Operations
00043 public:
00044
00045 // Overrides
00046     // ClassWizard generated virtual function overrides
00047     //{{AFX_VIRTUAL(CExploreBar)
00048     public:
00049     virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
00050     protected:
00051     virtual void OnDraw(CDC* pDC);      // overridden to draw this view
00052     //}}AFX_VIRTUAL
00053
00054 // Implementation
00055 protected:
00056     virtual ~CExploreBar();
00057     void OnUpdateCmd(CCmdUI* pCmdUI);
00058     bool DisableCommon();
00059
00060 #ifdef _DEBUG
00061     virtual void AssertValid() const;
00062     virtual void Dump(CDumpContext& dc) const;
00063 #endif
00064
00065     // Generated message map functions
00066 protected:
00067     //{{AFX_MSG(CExploreBar)
00068     afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
00069     afx_msg void OnViewCheckout();
00070     afx_msg void OnUpdateViewCheckout(CCmdUI* pCmdUI);
00071     afx_msg void OnViewImport();
00072     afx_msg void OnUpdateViewImport(CCmdUI* pCmdUI);
00073     //}}AFX_MSG
00074     DECLARE_MESSAGE_MAP()
00075 };
00076
00078
00079 //{{AFX_INSERT_LOCATION}}
00080 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00081
00082 #endif // !defined(AFX_EXPLOREBAR_H__A132A164_1A90_11D3_B1A1_004095463819__INCLUDED_)
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/FileViewWatcher.cpp Source File

WinCvs/FileViewWatcher.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018 * Author : V.Antonevich <v_antonevich@hotmail.com> --- November 2000
00019 */
00020
00021 /*
00022 * FileViewWatcher.cpp --- file modification watcher thread
00023 */
00024
00025 #include "stdafx.h"
00026 #include "wincvs.h"
00027 #include "FileViewWatcher.h"
00028
00029 #ifdef _DEBUG
00030 #define new DEBUG_NEW
00031 #undef THIS_FILE
00032 static char THIS_FILE[] = __FILE__;
00033 #endif
00034
00035 UINT KoWatcher::Run()
00036 {
00037     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00038
00039     for(;;)
00040     {
00041         // if a lot of changes happen suddenly in the folder, we
00042         // don't want WinCvs to die under the WM_FILECHANGE message,
00043         // so we need to slow down a bit.
00044         Sleep(app->m_isBackgroundProcess ? 2000 : 200);
00045
00046         DWORD dw = WaitForMultipleObjects(m_count, m_handles, FALSE, INFINITE);
00047         switch (dw)
00048         {
00049             case WAIT_OBJECT_0 :
00050             {
00051                 // process signal to start watching
00052                 StopWatch();
00053                 StartWatch();
00054                 m_eventStartWatching.Unlock();
00055                 break;
00056             }
00057             case WAIT_OBJECT_0 + 1 :
00058             {
00059                 // process signal to terminate
00060                 StopWatch();
00061                 delete this;
00062                 return 0;
00063             }
00064             case WAIT_OBJECT_0 + 2 :
00065             {
00066                 // process file change signal
00067                 StopWatch();
00068                 PostMessage(m_hWnd, WM_FILECHANGE, 0, 0);
00069                 break;
00070             }
00071
00072         }
00073     }
00074     return 0;
00075 }
00076
00077 bool KoWatcher::StartWatch()
00078 {
00079     // retrieve parameters first
00080     TCHAR path[_MAX_PATH];
00081     bool isRecursive;
00082     m_section.Lock();
00083     lstrcpyn(path, m_path, _MAX_PATH);
00084     isRecursive = m_isRecursive;
00085     m_section.Unlock();
00086
00087     // start watching
00088     HANDLE h =  FindFirstChangeNotification(
00089                     path,
00090                     isRecursive,
00091                     FILE_NOTIFY_CHANGE_FILE_NAME |
00092                     FILE_NOTIFY_CHANGE_DIR_NAME |
00093                     //FILE_NOTIFY_CHANGE_SIZE |
00094                     FILE_NOTIFY_CHANGE_LAST_WRITE |
00095                     //FILE_NOTIFY_CHANGE_LAST_ACCESS |
00096 #if _MSC_VER >= 1200
00097                     //FILE_NOTIFY_CHANGE_CREATION | (makes Win98 fails)
00098 #endif
00099                     //FILE_NOTIFY_CHANGE_SECURITY |
00100                     FILE_NOTIFY_CHANGE_ATTRIBUTES
00101                 );
00102     if (h != INVALID_HANDLE_VALUE)
00103     {
00104         m_handles[2] = h;
00105         m_count = 3;
00106     }
00107     return m_count == 3;
00108 }
00109
00110 // stops monitoring
00111 void KoWatcher::StopWatch()
00112 {
00113     if (m_count == 3 && m_handles[2] != INVALID_HANDLE_VALUE)
00114     {
00115         // reset and close the handle
00116         FindNextChangeNotification(m_handles[2]);
00117         FindCloseChangeNotification(m_handles[2]);
00118         m_handles[2] = INVALID_HANDLE_VALUE;
00119         m_count = 2;
00120     }
00121 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/FileViewWatcher.h Source File

WinCvs/FileViewWatcher.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018 * Author : V.Antonevich <v_antonevich@hotmail.com> --- November 2000
00019 */
00020
00021 /*
00022 * FileViewWatcher.h --- file modification watcher thread
00023 */
00024
00025 #ifndef __FILEVIEWWATCHWER_H__
00026 #define __FILEVIEWWATCHWER_H__
00027
00028 #include <afxmt.h>
00029
00030 // file modification watcher thread
00031 class KoWatcher
00032 {
00033 // Attributes
00034 private:
00035     CEvent m_eventStartWatching;
00036     // signals that watcher thread shall start watching
00037
00038     CEvent m_eventTerminate;
00039     // signals that watcher thread should terminate
00040
00041     CCriticalSection m_section;
00042     // to synchronize access to data fileds
00043
00044     TCHAR m_path[_MAX_PATH];
00045     // path to watch for changes
00046
00047     bool m_isRecursive;
00048     // flag to tell if watching for recursive changes
00049
00050     HWND m_hWnd;
00051     // window to post notification to
00052
00053     HANDLE m_handles[3];
00054     // objects being watched
00055
00056     DWORD m_count;
00057     // count of handles
00058
00059 public:
00060     // messages posted out
00061     enum
00062     {
00063         WM_FILECHANGE = WM_APP + 51,
00064         // private message for delivering file change notification
00065     };
00066
00067
00068 // Construction
00069 public:
00070     KoWatcher(HWND hWnd)
00071     : m_isRecursive(false)
00072     , m_hWnd(hWnd)
00073     {
00074         m_handles[0] = m_eventStartWatching;
00075         m_handles[1] = m_eventTerminate;
00076         m_count = 2;
00077         *m_path = 0;
00078
00079         // start the thread immediately
00080         AfxBeginThread(DelegateRun, this);
00081     }
00082
00083 private:
00084     // must call SignalTerminate() to destroy this object
00085     ~KoWatcher()
00086     {}
00087
00088 // Operations
00089 public:
00090     // signal to start watching for file changes in particular destination
00091     void SignalStartWatch(LPCTSTR path, bool isRecursive)
00092     {
00093         // store parameters
00094         m_section.Lock();
00095         _tcscpy(m_path, path);
00096         m_isRecursive = isRecursive;
00097         m_section.Unlock();
00098         m_eventStartWatching.SetEvent();
00099     }
00100
00101     // signals to terminate
00102     void SignalTerminate()
00103     {
00104         m_eventTerminate.SetEvent();
00105     }
00106
00107 // Implementations
00108 private:
00109     // delegates control to non-static member
00110     static UINT DelegateRun(LPVOID p)
00111     {
00112         KoWatcher* watcher = (KoWatcher*)p;
00113         return watcher->Run();
00114     }
00115
00116     // responds to events until requested to terminate
00117     UINT Run();
00118
00119     // starts monitoring
00120     bool StartWatch();
00121
00122     // stops monitoring
00123     void StopWatch();
00124 };
00125
00126
00127
00128 #endif
00129 // __FILEVIEWWATCHWER_H__
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/findtcl.cpp Source File

WinCvs/findtcl.cpp

Go to the documentation of this file.
00001 #include "stdafx.h"
00002 #include <string>
00003 #include <deque>
00004 #include <algorithm>
00005 #include <windows.h>
00006
00007 // I don't care to know about name truncation in the debug data
00008 #pragma warning(disable:4786)
00009
00010
00011 // local protos
00012 static void buildTail (char *, const char *, int);
00013 static void buildWildTail (char *, char *, int);
00014 static bool verRemove (std::string &);
00015 static bool verLess (std::string &, std::string &);
00016 static bool fileRemove (std::string &);
00017 static bool fileLess (std::string &, std::string &);
00018
00019 // locally shared variables restricted to this module
00020 static char *minVer;
00021 static int exact;
00022 static int dbgOnly;
00023
00024 char *
00025 findTcl (char *_minVer, int _exact, int _dbgOnly)
00026 {
00027     //char *tclRootPath = NULL;
00028     static char tclLibFullPath[MAX_PATH];
00029     char *savedPos;
00030     char *pos1, *pos2;
00031     char *prefix = "\\bin\\tcl";
00032     WIN32_FIND_DATA hFFData;
00033     HANDLE hFind;
00034     int i = 0;
00035     std::deque<std::string> vers;
00036     std::deque<std::string>::iterator versNewLast;
00037
00038
00039     minVer = _minVer;
00040     exact = _exact;
00041     dbgOnly = _dbgOnly;
00042
00043
00044     // Look in the current path on the assumption if it's there, you want to use
00045     // it instead of any others if it passes the version test.
00046
00047     // Append the beginning
00048     pos1 = tclLibFullPath;
00049     pos2 = ".\\tcl";
00050     while (*pos2 != '\0') { *pos1++ = *pos2++; };
00051     savedPos = pos1;
00052
00053     if (exact != 0)
00054     {
00055         // build the end of the filename from the parameter given
00056         buildTail(savedPos, minVer, dbgOnly);
00057
00058         // See if it *really* exists
00059         hFind = ::FindFirstFile(tclLibFullPath, &hFFData);
00060
00061         if (hFind != INVALID_HANDLE_VALUE)
00062         {
00063             // gotcha.
00064             ::FindClose(hFind);
00065             return tclLibFullPath;
00066         }
00067         // no success..  fall through for registry search
00068
00069     }
00070     else
00071     {
00072
00073         // Try a range of filenames
00074         buildWildTail(savedPos, minVer, dbgOnly);
00075
00076         // See if we got some
00077         hFind = ::FindFirstFile(tclLibFullPath, &hFFData);
00078
00079         if (hFind != INVALID_HANDLE_VALUE)
00080         {
00081             BOOL rtn;
00082
00083             do
00084             {
00085                 vers.push_back(std::string(hFFData.cFileName));
00086                 rtn = ::FindNextFile(hFind, &hFFData);
00087             } while (rtn != 0);   // got more?
00088
00089             ::FindClose(hFind);
00090
00091             // sort filename strings
00092             std::sort(vers.begin(), vers.end(), fileLess);
00093
00094             // remove all invalid entries based on flags.
00095             versNewLast = std::remove_if(vers.begin(), vers.end(), fileRemove);
00096
00097             if (vers.begin() != versNewLast) {
00098                 // using copy itself doesn't terminate the string...  how odd..
00099                 tclLibFullPath [(versNewLast - 1)->copy(tclLibFullPath, MAX_PATH)] = '\0';
00100                 return tclLibFullPath;
00101             }
00102         }
00103
00104         // no success..  fall through for registry search
00105     }
00106
00107
00108     // Do a registry search.
00109     HKEY topTclKey = NULL, subTclVer = NULL;
00110     DWORD max_path = MAX_PATH;
00111     LONG result;
00112     char sSubKey[MAX_PATH];
00113     const char *verTarget;
00114
00115     result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
00116         "SOFTWARE\\Scriptics\\Tcl",
00117         0,
00118         KEY_ENUMERATE_SUB_KEYS,
00119         &topTclKey);
00120
00121     if (result != ERROR_SUCCESS)
00122     {
00123         // active TCL
00124         //HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TclScript\DefaultIcon
00125         result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
00126             "SOFTWARE\\Classes\\TclScript\\DefaultIcon",
00127             0,
00128             KEY_QUERY_VALUE,
00129             &topTclKey);
00130
00131         if (result == ERROR_SUCCESS)
00132         {
00133             result = RegQueryValueEx(topTclKey,
00134                 "",
00135                 NULL,
00136                 NULL,
00137                 reinterpret_cast<PUCHAR>(tclLibFullPath),
00138                 &max_path);
00139
00140             RegCloseKey(topTclKey);
00141
00142             if (result == ERROR_SUCCESS)
00143             {
00144                 CString s(tclLibFullPath);
00145                 s.Replace("tk", "tcl");
00146                 strcpy(tclLibFullPath, s);
00147                 char *tmp = strrchr(tclLibFullPath, ',');
00148                 if(tmp != 0L)
00149                     *tmp = '\0';
00150                 return tclLibFullPath;
00151             }
00152         }
00153
00154         if (result != ERROR_SUCCESS)
00155         {
00156             std::string err("The registry path (HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl) does not exist.");
00157             err.append("  Redo your Tcl install or, assuming you compiled your own core, read /win/README from the source distribution.");
00158             throw err;
00159         }
00160     }
00161
00162     // Read all SubKey names
00163  enumAgain:
00164     result = RegEnumKey(topTclKey, i, sSubKey, MAX_PATH);
00165     if (result != ERROR_NO_MORE_ITEMS) {
00166         vers.push_back(std::string(sSubKey));
00167         i++; goto enumAgain;
00168     }
00169     else if (i == 0)
00170     {
00171         std::string err("The registry path (HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl) has no SubKeys.");
00172         err.append("  Reinstall Tcl to fix this or hand edit your registry.");
00173         RegCloseKey(topTclKey);
00174         throw err;
00175     }
00176
00177     // sort version strings
00178     std::sort(vers.begin(), vers.end(), verLess);
00179
00180     // remove all invalid entries based on flags.
00181     versNewLast = std::remove_if(vers.begin(), vers.end(), verRemove);
00182
00183     if (vers.begin() != versNewLast)
00184         verTarget = (versNewLast - 1)->c_str();
00185     else
00186     {
00187         std::string err("Unable to locate a proper Tcl core in the registry for version ");
00188         err.append(minVer);
00189         if (exact != 0)
00190             err.append(".");
00191         else
00192             err.append(" or greater.");
00193         RegCloseKey(topTclKey);
00194         throw err;
00195     }
00196
00197     result = RegOpenKeyEx(topTclKey,
00198         verTarget,
00199         0,
00200         KEY_READ,
00201         &subTclVer);
00202
00203     if (result != ERROR_SUCCESS)
00204     {
00205         std::string err("The registry path (HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl<target>) does not exist.");
00206         err.append("  Redo your Tcl install or, assuming you compiled your own core, read /win/README from the source distribution.");
00207         RegCloseKey(topTclKey);
00208         throw err;
00209     }
00210
00211     result = RegQueryValueEx(subTclVer,
00212         "Root",
00213         NULL,
00214         NULL,
00215         reinterpret_cast<PUCHAR>(tclLibFullPath),
00216         &max_path);
00217
00218     if (result != ERROR_SUCCESS)
00219     {
00220         std::string err("The registry path (HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\");
00221         err.append(verTarget);
00222         err.append(") did not have a \"Root\" SubKey.");
00223         RegCloseKey(topTclKey);
00224         RegCloseKey(subTclVer);
00225         throw err;
00226     };
00227
00228     pos1 = tclLibFullPath;
00229     while (*pos1 != '\0') { pos1++; }
00230
00231     // Append the bin directory and prefix
00232     pos2 = prefix;
00233     while (*pos2 != '\0') { *pos1++ = *pos2++; };
00234     savedPos = pos1;
00235
00236     // Build the end of the filename
00237     buildTail(savedPos, verTarget, dbgOnly);
00238
00239     // See if it *really* exists
00240     hFind = ::FindFirstFile(tclLibFullPath, &hFFData);
00241
00242     if (hFind != INVALID_HANDLE_VALUE) {
00243         // gotcha.
00244         ::FindClose(hFind);
00245         RegCloseKey(topTclKey);
00246         RegCloseKey(subTclVer);
00247         return tclLibFullPath;
00248     }
00249     else
00250     {
00251         ::FindClose(hFind);
00252         std::string err("The registry key (HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\");
00253         err.append(minVer);
00254         err.append("\\Root) said a core was located at (");
00255         err.append(tclLibFullPath);
00256         err.append(").  This was found to be false.");
00257         RegCloseKey(topTclKey);
00258         RegCloseKey(subTclVer);
00259         throw err;
00260     }
00261
00262     RegCloseKey(topTclKey);
00263     RegCloseKey(subTclVer);
00264     throw std::string("A proper Tcl core could not be found anywhere.");
00265     return NULL;
00266 }
00267
00268 static void
00269 buildTail(char *pos, const char *ver, int dbgOnly)
00270 {
00271     const char *pos2;
00272     char *shLibExt = ".dll";
00273
00274     /* append version w/o decimal */
00275     pos2 = ver;
00276     while (*pos2 != '\0') {
00277         if (*pos2 != '.') *pos++ = *pos2++;
00278         else pos2++;
00279     };
00280
00281     /* if asked, add the debug suffix */
00282     if (dbgOnly != 0) *pos++ = 'd';
00283
00284     /* append the extension */
00285     pos2 = shLibExt;
00286     while (*pos2 != '\0') {
00287         *pos++ = *pos2++;
00288     };
00289
00290     /* terminate it */
00291     *pos = '\0';
00292 };
00293
00294
00295 static void
00296 buildWildTail(char *pos, char *ver, int dbgOnly)
00297 {
00298     char *pos2;
00299     char *shLibExt = ".dll";
00300
00301     /* just append the major version */
00302     *pos++ = *ver;
00303     *pos++ = '?';
00304
00305     /* if asked, add the debug suffix */
00306     if (dbgOnly != 0) *pos++ = 'd';
00307
00308     /* append the extension */
00309     pos2 = shLibExt;
00310     while (*pos2 != '\0') {
00311         *pos++ = *pos2++;
00312     };
00313
00314     /* terminate it */
00315     *pos = '\0';
00316 };
00317
00318 static bool verRemove (std::string &s)
00319 {
00320     double fa, fb;
00321     fa = atof(s.c_str());
00322     fb = atof(minVer);
00323
00324     if (exact == 0)
00325     {
00326         // remove when major version is different.
00327         if ((int)fa != (int)fb)
00328             return true;
00329         // remove when less than minor version
00330         return (fa - (int)fa < fb - (int)fb);
00331     }
00332     else
00333         // remove when not identical for an exact match
00334         return (fa != fb);
00335 };
00336
00337 static bool verLess(std::string &a, std::string &b) {
00338     double fa, fb;
00339     fa = atof(a.c_str());
00340     fb = atof(b.c_str());
00341     return (fa < fb);
00342 };
00343
00344 static bool
00345 fileRemove (std::string &f)
00346 {
00347     // strip off 'tcl' and '.dll'
00348     return verRemove(f.substr(3,1) + "." + f.substr(4,1));
00349 }
00350
00351 static bool
00352 fileLess (std::string &a, std::string &b)
00353 {
00354   return verLess(
00355       a.substr(3,1) + "." + a.substr(4,1),
00356       b.substr(3,1) + "." + b.substr(4,1)
00357       );
00358 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/GraphDoc.cpp Source File

WinCvs/GraphDoc.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // GraphDoc.cpp : implementation of the CGraphDoc class
00022 //
00023
00024 #include "stdafx.h"
00025
00026 #include <direct.h>
00027 #include <sys/stat.h>
00028
00029 #include "Wincvs.h"
00030
00031 #include "GraphDoc.h"
00032 #include "CvsLog.h"
00033 #include "WinCvsView.h"
00034 #include "GraphView.h"
00035 #include "CvsEntries.h"
00036
00037 #ifdef _DEBUG
00038 #define new DEBUG_NEW
00039 #undef THIS_FILE
00040 static char THIS_FILE[] = __FILE__;
00041 #endif
00042
00044 // CGraphDoc
00045
00046 IMPLEMENT_DYNCREATE(CGraphDoc, CDocument)
00047
00048 BEGIN_MESSAGE_MAP(CGraphDoc, CDocument)
00049     //{{AFX_MSG_MAP(CGraphDoc)
00050         // NOTE - the ClassWizard will add and remove mapping macros here.
00051         //    DO NOT EDIT what you see in these blocks of generated code!
00052     //}}AFX_MSG_MAP
00053     ON_COMMAND(ID_FILE_SEND_MAIL, OnFileSendMail)
00054     ON_UPDATE_COMMAND_UI(ID_FILE_SEND_MAIL, OnUpdateFileSendMail)
00055 END_MESSAGE_MAP()
00056
00057 BEGIN_DISPATCH_MAP(CGraphDoc, CDocument)
00058     //{{AFX_DISPATCH_MAP(CGraphDoc)
00059     DISP_FUNCTION(CGraphDoc, "NumNodes", NumNodes, VT_I4, VTS_NONE)
00060     //}}AFX_DISPATCH_MAP
00061 END_DISPATCH_MAP()
00062
00063 // Note: we add support for IID_ITest to support typesafe binding
00064 //  from VBA.  This IID must match the GUID that is attached to the
00065 //  dispinterface in the .ODL file.
00066
00067 // {09F456B5-0018-11D2-BCAA-000000000000}
00068 static const IID IID_ITest =
00069 { 0x9f456b5, 0x18, 0x11d2, { 0xbc, 0xaa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } };
00070
00071 BEGIN_INTERFACE_MAP(CGraphDoc, CDocument)
00072     INTERFACE_PART(CGraphDoc, IID_ITest, Dispatch)
00073 END_INTERFACE_MAP()
00074
00076 // CGraphDoc construction/destruction
00077
00078 CGraphDoc::CGraphDoc()
00079 {
00080     EnableAutomation();
00081
00082     AfxOleLockApp();
00083
00084     fNode = 0L;
00085     fData = 0L;
00086 }
00087
00088 CGraphDoc::~CGraphDoc()
00089 {
00090     AfxOleUnlockApp();
00091
00092     PrepareNew();
00093 }
00094
00095 void CGraphDoc::PrepareNew(void)
00096 {
00097     if(fNode != 0L)
00098     {
00099         delete fNode;
00100         fNode = 0L;
00101     }
00102     if(fData != 0L)
00103     {
00104         fData->UnRef();
00105         fData = 0L;
00106     }
00107     fDir.Empty();
00108     fName.Empty();
00109 }
00110
00111 BOOL CGraphDoc::OnNewDocument()
00112 {
00113     PrepareNew();
00114
00115     if (!CDocument::OnNewDocument())
00116         return FALSE;
00117
00118     return TRUE;
00119 }
00120
00121 static void NormalizeFn(const char* folder, const char* fn, char* dir, char* name)
00122 {
00123     char buffer[_MAX_PATH];
00124     char dirBuffer[_MAX_PATH];
00125     char nameBuffer[_MAX_PATH];
00126     char drive[_MAX_PATH];
00127     char ext[_MAX_EXT];
00128     _makepath(buffer, NULL, folder, fn, NULL);
00129     _splitpath(buffer, drive, dirBuffer, nameBuffer, ext);
00130     _makepath(dir, drive, dirBuffer, NULL, NULL);
00131     _makepath(name, NULL, NULL, nameBuffer, ext);
00132 }
00133
00134 void CGraphDoc::SetNode(CLogNode *node, const char *folder)
00135 {
00136     PrepareNew();
00137
00138     // normalize folder/fname since the latter can be a path relative to folder
00139     const char *fn = (**(CLogNodeHeader *)node).WorkingFile();
00140     char dir[_MAX_PATH];
00141     char name[_MAX_PATH];
00142     NormalizeFn(folder, fn, dir, name);
00143
00144     fNode = node;
00145     fDir = dir;
00146
00147     // get the CVS/Entries infos for this file
00148     CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00149     if(!Entries_Open (entries, dir))
00150     {
00151         cvs_err("Warning : Error while accessing the CVS folder in '%s'\n", dir);
00152     }
00153     else
00154     {
00155         if(node->GetType() != kNodeHeader)
00156         {
00157             cvs_err("Warning : Top node is not a RCS file description !\n");
00158         }
00159         else
00160         {
00161             struct stat sb;
00162             if (stat(fn, &sb) == -1)    //JK - used to be "name", fix for the flat mode
00163             {
00164                 cvs_err("Warning : Unknown file '%s'\n", name);
00165             }
00166             else
00167             {
00168                 fData = Entries_SetVisited(dir, entries, name, sb, false);
00169                 fData->Ref();
00170                 fName = name;
00171             }
00172         }
00173     }
00174
00175     // create the graph and redraw
00176     CGraphView *view = GetTreeView();
00177     if(view != 0L)
00178     {
00179         view->CalcImageSize();
00180         view->Invalidate();
00181         SetTitle(fName);
00182     }
00183 }
00184
00185
00187 // CGraphDoc serialization
00188
00189 void CGraphDoc::Serialize(CArchive& ar)
00190 {
00191     if (ar.IsStoring())
00192     {
00193         // TODO: add storing code here
00194     }
00195     else
00196     {
00197         // TODO: add loading code here
00198     }
00199 }
00200
00201 CGraphView *CGraphDoc::GetTreeView(void)
00202 {
00203     POSITION posv = GetFirstViewPosition();
00204     CView* view;
00205     while(posv != NULL)
00206     {
00207         view = GetNextView(posv);
00208         if(view->IsKindOf(RUNTIME_CLASS(CGraphView)))
00209             return (CGraphView *)view;
00210     }
00211     return NULL;
00212 }
00213
00215 // CGraphDoc diagnostics
00216
00217 #ifdef _DEBUG
00218 void CGraphDoc::AssertValid() const
00219 {
00220     CDocument::AssertValid();
00221 }
00222
00223 void CGraphDoc::Dump(CDumpContext& dc) const
00224 {
00225     CDocument::Dump(dc);
00226 }
00227 #endif //_DEBUG
00228
00230 // CGraphDoc commands
00231
00232 long CGraphDoc::NumNodes()
00233 {
00234     return 0;
00235 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/GraphDoc.h Source File

WinCvs/GraphDoc.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // GraphDoc.h : interface of the CGraphDoc class
00022 //
00024
00025 #if !defined(AFX_GRAPHDOC_H__09F456C1_0018_11D2_BCAA_000000000000__INCLUDED_)
00026 #define AFX_GRAPHDOC_H__09F456C1_0018_11D2_BCAA_000000000000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 class CLogNode;
00033 class CWincvsView;
00034 class CGraphView;
00035 class EntnodeData;
00036
00037 class CGraphDoc : public CDocument
00038 {
00039 protected: // create from serialization only
00040     CGraphDoc();
00041     DECLARE_DYNCREATE(CGraphDoc)
00042
00043 // Attributes
00044 public:
00045
00046     void SetNode(CLogNode *node, const char *dir);
00047     inline CLogNode *GetNode(void) { return fNode; }
00048     inline EntnodeData *GetEntryInfo(void) { return fData; }
00049     inline const char *GetDir(void) const { return fDir; }
00050     inline const char *GetName(void) const { return fName; }
00051         // the RCS log description as a tree
00052
00053     CGraphView *GetTreeView(void);
00054         // get the graph (tree) view
00055
00056     // Operations
00057 public:
00058
00059 // Overrides
00060     // ClassWizard generated virtual function overrides
00061     //{{AFX_VIRTUAL(CGraphDoc)
00062     public:
00063     virtual BOOL OnNewDocument();
00064     virtual void Serialize(CArchive& ar);
00065     //}}AFX_VIRTUAL
00066
00067 // Implementation
00068 public:
00069     virtual ~CGraphDoc();
00070 #ifdef _DEBUG
00071     virtual void AssertValid() const;
00072     virtual void Dump(CDumpContext& dc) const;
00073 #endif
00074
00075 protected:
00076     CLogNode *fNode;
00077     CString fDir;
00078     CString fName;
00079     EntnodeData *fData;
00080
00081     void PrepareNew(void);
00082
00083 // Generated message map functions
00084 protected:
00085     //{{AFX_MSG(CGraphDoc)
00086         // NOTE - the ClassWizard will add and remove member functions here.
00087         //    DO NOT EDIT what you see in these blocks of generated code !
00088     //}}AFX_MSG
00089     DECLARE_MESSAGE_MAP()
00090
00091     // Generated OLE dispatch map functions
00092     //{{AFX_DISPATCH(CGraphDoc)
00093     afx_msg long NumNodes();
00094     //}}AFX_DISPATCH
00095     DECLARE_DISPATCH_MAP()
00096     DECLARE_INTERFACE_MAP()
00097 };
00098
00100
00101 //{{AFX_INSERT_LOCATION}}
00102 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00103
00104 #endif // !defined(AFX_GRAPHDOC_H__09F456C1_0018_11D2_BCAA_000000000000__INCLUDED_)
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/GraphFrm.cpp Source File

WinCvs/GraphFrm.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // GraphFrm.cpp : implementation of the CGraphFrame class
00022 //
00023
00024 #include "stdafx.h"
00025 #include "wincvs.h"
00026
00027 #include "GraphFrm.h"
00028 #include "GraphView.h"
00029 #include "WinCvsView.h"
00030 #include "MainFrm.h"
00031
00032 #ifdef _DEBUG
00033 #define new DEBUG_NEW
00034 #undef THIS_FILE
00035 static char THIS_FILE[] = __FILE__;
00036 #endif
00037
00039 // CGraphFrame
00040
00041 IMPLEMENT_DYNCREATE(CGraphFrame, CCJMDIChildWnd)
00042
00043 BEGIN_MESSAGE_MAP(CGraphFrame, CCJMDIChildWnd)
00044     //{{AFX_MSG_MAP(CGraphFrame)
00045         // NOTE - the ClassWizard will add and remove mapping macros here.
00046         //    DO NOT EDIT what you see in these blocks of generated code !
00047     //}}AFX_MSG_MAP
00048 END_MESSAGE_MAP()
00049
00051 // CGraphFrame construction/destruction
00052
00053 CGraphFrame::CGraphFrame()
00054 {
00055     // TODO: add member initialization code here
00056
00057 }
00058
00059 CGraphFrame::~CGraphFrame()
00060 {
00061 }
00062
00064 // CGraphFrame diagnostics
00065
00066 #ifdef _DEBUG
00067 void CGraphFrame::AssertValid() const
00068 {
00069     CCJMDIChildWnd::AssertValid();
00070 }
00071
00072 void CGraphFrame::Dump(CDumpContext& dc) const
00073 {
00074     CCJMDIChildWnd::Dump(dc);
00075 }
00076
00077 #endif //_DEBUG
00078
00080 // CGraphFrame message handlers
00081
00082 BOOL CGraphFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
00083 {
00084     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00085     if(app->GetMainFrame()->OnBroadcastCmdMsg(nID, nCode, pExtra, pHandlerInfo))
00086         return TRUE;
00087
00088     return CCJMDIChildWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
00089 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/GraphFrm.h Source File

WinCvs/GraphFrm.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // GraphFrm.h : interface of the CGraphFrame class
00022 //
00024
00025 #if !defined(AFX_GRAPHFRM_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_)
00026 #define AFX_GRAPHFRM_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 class CGraphFrame : public CCJMDIChildWnd
00033 {
00034     DECLARE_DYNCREATE(CGraphFrame)
00035 public:
00036     CGraphFrame();
00037
00038 // Attributes
00039 public:
00040
00041 // Operations
00042 public:
00043
00044 // Overrides
00045     // ClassWizard generated virtual function overrides
00046     //{{AFX_VIRTUAL(CGraphFrame)
00047     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
00048     //}}AFX_VIRTUAL
00049
00050 // Implementation
00051 public:
00052     virtual ~CGraphFrame();
00053
00054 #ifdef _DEBUG
00055     virtual void AssertValid() const;
00056     virtual void Dump(CDumpContext& dc) const;
00057 #endif
00058
00059 // Generated message map functions
00060 protected:
00061
00062     //{{AFX_MSG(CGraphFrame)
00063         // NOTE - the ClassWizard will add and remove member functions here.
00064         //    DO NOT EDIT what you see in these blocks of generated code!
00065     //}}AFX_MSG
00066     DECLARE_MESSAGE_MAP()
00067 };
00068
00070
00071 //{{AFX_INSERT_LOCATION}}
00072 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00073
00074 #endif // !defined(AFX_GRAPH_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_)
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/GraphView.cpp Source File

WinCvs/GraphView.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 // GraphView.cpp : implementation file
00018 //
00019
00020 #include "stdafx.h"
00021 #include "wincvs.h"
00022 #include "GraphView.h"
00023 #include "GraphDoc.h"
00024 #include "AppConsole.h"
00025 #include "LogParse.h"
00026 #include "CvsEntries.h"
00027 #include "BrowseFileView.h"
00028 #include "WinCvsBrowser.h"
00029 #include "CvsArgs.h"
00030 #include "AppGlue.h"
00031 #include "WincvsView.h"
00032 #include "CvsPrefs.h"
00033 #include "FileTraversal.h"
00034 #include "ProgressDialog.h"
00035 #include "GraphOptDlg.h"
00036 #include "AdminOptionDlg.h"
00037 #include "CvsAlert.h"
00038 #include "CvsCommands.h"
00039
00040 #ifdef _DEBUG
00041 #define new DEBUG_NEW
00042 #undef THIS_FILE
00043 static char THIS_FILE[] = __FILE__;
00044 #endif
00045
00046 // persitent settings
00047 CPersistentInt gGraphSelColor("P_GraphSelColor", RGB_DEF_SEL);
00048 CPersistentInt gGraphShadowColor("P_GraphShadowColor", RGB_DEF_SHADOW);
00049 CPersistentInt gGraphHeaderColor("P_GraphHeaderColor", RGB_DEF_HEADER);
00050 CPersistentInt gGraphTagColor("P_GraphTagColor", RGB_DEF_TAG);
00051 CPersistentInt gGraphBranchColor("P_GraphBranchColor", RGB_DEF_BRANCH);
00052 CPersistentInt gGraphNodeColor("P_GraphNodeColor", RGB_DEF_NODE);
00053 CPersistentInt gGraphDeadNodeColor("P_GraphDeadNodeColor", RGB_DEF_DEADNODE);
00054 CPersistentInt gGraphUserStateNodeColor("P_GraphUserStateNodeColor", RGB_DEF_USERSTATENODE);
00055
00057 // CGraphView
00058
00059 IMPLEMENT_DYNCREATE(CGraphView, CScrollView)
00060
00061 CGraphView::CGraphView()
00062 {
00063     fFirstTime = true;
00064     if(m_ImageList.m_hImageList == 0L)
00065         m_ImageList.Create(IDB_SMALLICONS, 16, 1, RGB(255, 255, 255));
00066 }
00067
00068 CGraphView::~CGraphView()
00069 {
00070 }
00071
00072
00073 BEGIN_MESSAGE_MAP(CGraphView, CScrollView)
00074     //{{AFX_MSG_MAP(CGraphView)
00075     ON_WM_LBUTTONDOWN()
00076     ON_COMMAND(ID_VIEW_RELOAD, OnViewReload)
00077     ON_UPDATE_COMMAND_UI(ID_VIEW_RELOAD, OnUpdateViewReload)
00078     ON_COMMAND(ID_VIEW_DIFF, OnViewDiff)
00079     ON_UPDATE_COMMAND_UI(ID_VIEW_DIFF, OnUpdateViewDiff)
00080     ON_COMMAND(ID_VIEW_UPDATE, OnViewUpdate)
00081     ON_UPDATE_COMMAND_UI(ID_VIEW_UPDATE, OnUpdateViewUpdate)
00082     ON_COMMAND(ID_VIEW_TAG, OnViewTag)
00083     ON_UPDATE_COMMAND_UI(ID_VIEW_TAG, OnUpdateViewTag)
00084     ON_COMMAND(ID_VIEW_DELREV, OnViewDelrev)
00085     ON_UPDATE_COMMAND_UI(ID_VIEW_DELREV, OnUpdateViewDelrev)
00086     ON_COMMAND(ID_VIEW_SELNONSIG, OnViewSelnonsig)
00087     ON_UPDATE_COMMAND_UI(ID_VIEW_SELNONSIG, OnUpdateViewSelnonsig)
00088     ON_COMMAND(ID_VIEW_RETRIEVE, OnViewRetrieve)
00089     ON_UPDATE_COMMAND_UI(ID_VIEW_RETRIEVE, OnUpdateViewRetrieve)
00090     ON_UPDATE_COMMAND_UI(ID_VIEW_RECURSIVE, DisableUpdate)
00091     ON_WM_CONTEXTMENU()
00092     ON_COMMAND(ID_QUERY_ANNOTATE, OnQueryAnnotate)
00093     ON_UPDATE_COMMAND_UI(ID_QUERY_ANNOTATE, OnUpdateQueryAnnotate)
00094     ON_COMMAND(ID_GRAPH_GRAPHOPTIONS, OnGraphGraphoptions)
00095     ON_UPDATE_COMMAND_UI(ID_GRAPH_CHANGELOGMESSAGE, OnUpdateGraphChangelogmessage)
00096     ON_COMMAND(ID_GRAPH_CHANGELOGMESSAGE, OnGraphChangelogmessage)
00097     ON_UPDATE_COMMAND_UI(ID_VIEW_MISSING, DisableUpdate)
00098     ON_UPDATE_COMMAND_UI(ID_VIEW_MODIFIED, DisableUpdate)
00099     ON_UPDATE_COMMAND_UI(ID_VIEW_CONFLICT, DisableUpdate)
00100     ON_UPDATE_COMMAND_UI(ID_VIEW_UNKNOWN, DisableUpdate)
00101     ON_UPDATE_COMMAND_UI(ID_VIEW_HIDEUNKNOWN, DisableUpdate)
00102     ON_UPDATE_COMMAND_UI(ID_VIEW_IGNORE, DisableUpdate)
00103     ON_UPDATE_COMMAND_UI(ID_VIEW_ADDED, DisableUpdate)
00104     ON_UPDATE_COMMAND_UI(ID_VIEW_REMOVED, DisableUpdate)
00105     ON_UPDATE_COMMAND_UI(ID_VIEW_CHANGED, DisableUpdate)
00106     ON_UPDATE_COMMAND_UI(ID_FILTERMASK, DisableUpdate)
00107     ON_UPDATE_COMMAND_UI(ID_GRAPH_SETDESCRIPTION, OnUpdateGraphSetdescription)
00108     ON_COMMAND(ID_GRAPH_SETDESCRIPTION, OnGraphSetdescription)
00109     ON_COMMAND(ID_GRAPH_SETSTATE, OnGraphSetstate)
00110     ON_UPDATE_COMMAND_UI(ID_GRAPH_SETSTATE, OnUpdateGraphSetstate)
00111     ON_UPDATE_COMMAND_UI(ID_VIEW_LOCKF, OnUpdateViewLockf)
00112     ON_COMMAND(ID_VIEW_LOCKF, OnViewLockf)
00113     ON_UPDATE_COMMAND_UI(ID_VIEW_UNLOCKF, OnUpdateViewUnlockf)
00114     ON_COMMAND(ID_VIEW_UNLOCKF, OnViewUnlockf)
00115     //}}AFX_MSG_MAP
00116     ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
00117     ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
00118     ON_WM_INITMENUPOPUP()
00119 END_MESSAGE_MAP()
00120
00121 class CWinLogData : public CLogNodeData
00122 {
00123 public:
00124     CWinLogData(CLogNode *node);
00125     virtual ~CWinLogData();
00126
00127     inline kLogNode GetType(void) const { return fNode->GetType(); }
00128     const char *GetStr(void);
00129
00130     void ComputeBounds(const CPoint & topLeft, CDC & hdc,
00131         EntnodeData *entryInfo = 0L);
00132     void Offset(CPoint o);
00133     void Update(CDC & hdc, EntnodeData *entryInfo = 0L);
00134
00135     inline CRect & Bounds(void) { return totB; }
00136     inline CRect & SelfBounds(void) { return selfB; }
00137
00138     inline bool Selected(void) const { return sel; }
00139     void SetSelected(CScrollView *view, bool state);
00140     void UnselectAll(CScrollView *view);
00141     CWinLogData *HitTest(CPoint point);
00142
00143     static CWinLogData *CreateNewData(CLogNode *node);
00144
00145     bool IsDiskNode(EntnodeData *entryInfo);
00146     bool IsDeadNode();
00147     bool IsUserState();
00148
00149 protected:
00150     virtual void UpdateSelf(CDC & hdc, EntnodeData *entryInfo) = 0;
00151     virtual CSize GetBoundsSelf(CDC & hdc, EntnodeData *entryInfo) = 0;
00152
00153     inline CWinLogData *GetData(CLogNode *node)
00154         { return (CWinLogData *)node->GetUserData(); }
00155
00156     CRect selfB;
00157     CRect totB;
00158     bool sel;
00159 };
00160
00161 class CWinLogHeaderData : public CWinLogData
00162 {
00163 public:
00164     CWinLogHeaderData(CLogNode *node) : CWinLogData(node) {}
00165     virtual ~CWinLogHeaderData() {}
00166
00167 protected:
00168     virtual void UpdateSelf(CDC & hdc, EntnodeData *entryInfo);
00169     virtual CSize GetBoundsSelf(CDC & hdc, EntnodeData *entryInfo);
00170 };
00171
00172 class CWinLogRevData : public CWinLogData
00173 {
00174 public:
00175     CWinLogRevData(CLogNode *node) : CWinLogData(node) {}
00176     virtual ~CWinLogRevData() {}
00177
00178 protected:
00179     virtual void UpdateSelf(CDC & hdc, EntnodeData *entryInfo);
00180     virtual CSize GetBoundsSelf(CDC & hdc, EntnodeData *entryInfo);
00181 };
00182
00183 class CWinLogTagData : public CWinLogData
00184 {
00185 public:
00186     CWinLogTagData(CLogNode *node) : CWinLogData(node) {}
00187     virtual ~CWinLogTagData() {}
00188
00189 protected:
00190     virtual void UpdateSelf(CDC & hdc, EntnodeData *entryInfo);
00191     virtual CSize GetBoundsSelf(CDC & hdc, EntnodeData *entryInfo);
00192 };
00193
00194 class CWinLogBranchData : public CWinLogData
00195 {
00196 public:
00197     CWinLogBranchData(CLogNode *node) : CWinLogData(node) {}
00198     virtual ~CWinLogBranchData() {}
00199
00200 protected:
00201     virtual void UpdateSelf(CDC & hdc, EntnodeData *entryInfo);
00202     virtual CSize GetBoundsSelf(CDC & hdc, EntnodeData *entryInfo);
00203 };
00204
00205 CSize CWinLogHeaderData::GetBoundsSelf(CDC & hdc, EntnodeData *entryInfo)
00206 {
00207     CLogNodeHeader & header = *(CLogNodeHeader *)fNode;
00208     return hdc.GetTextExtent((*header).WorkingFile(),
00209         (*header).WorkingFile().length());
00210 }
00211
00213 static void DrawOctangle(CDC& hdc, const CRect& selfB)
00214 {
00215     int cutLen = selfB.Height() / 4;
00216     CPoint point1(selfB.left, selfB.top + cutLen);
00217     CPoint point2(selfB.left + cutLen, selfB.top);
00218     CPoint point3(selfB.right - cutLen, selfB.top);
00219     CPoint point4(selfB.right, selfB.top + cutLen);
00220     CPoint point5(selfB.right, selfB.bottom - cutLen);
00221     CPoint point6(selfB.right - cutLen, selfB.bottom);
00222     CPoint point7(selfB.left + cutLen, selfB.bottom);
00223     CPoint point8(selfB.left, selfB.bottom - cutLen);
00224     CPoint arrPoints[OCTANGLE_COUNT] = {
00225         point1,
00226         point2,
00227         point3,
00228         point4,
00229         point5,
00230         point6,
00231         point7,
00232         point8};
00233
00234     hdc.Polygon(arrPoints, OCTANGLE_COUNT);
00235 }
00236
00237 static void DrawNode(CDC & hdc, const CRect & selfB,
00238                      COLORREF contour,
00239                      kNodeShape shape, bool issel, int penStyle = PS_SOLID)
00240 {
00241     CPen *pOldPen = 0L;
00242     CBrush *pOldBrush = 0L;
00243     CPen pen, pen2;
00244     CBrush brush;
00245     COLORREF selcolor = gGraphSelColor;
00246     COLORREF shadowc = gGraphShadowColor;
00247
00248     TRY
00249     {
00250         //prepare the shadow
00251         CRect shadow = selfB;
00252         shadow.OffsetRect(SHADOW_OFFSET_PT);
00253
00254         brush.CreateSolidBrush(shadowc);
00255         pOldBrush = hdc.SelectObject(&brush);
00256         pen.CreatePen(penStyle, 1, shadowc);
00257         pOldPen = hdc.SelectObject(&pen);
00258
00259         //draw the shadow
00260         switch( shape )
00261         {
00262         case kRectangle:
00263             hdc.Rectangle(shadow);
00264             break;
00265         case kRoundRect:
00266             hdc.RoundRect(shadow, ROUND_RECT_PT);
00267             break;
00268         case kOctangle:
00269             DrawOctangle(hdc, shadow);
00270             break;
00271         default:
00272             ASSERT(FALSE);  //unknown type
00273             return;
00274         }
00275
00276         //prepare selection
00277         if( issel )
00278         {
00279             brush.DeleteObject();
00280             brush.CreateSolidBrush(selcolor);
00281             hdc.SelectObject(&brush);
00282         }
00283         else
00284         {
00285             hdc.SelectObject(pOldBrush);
00286             pOldBrush = 0L;
00287         }
00288
00289         pen2.CreatePen(penStyle, 1, contour);
00290         hdc.SelectObject(&pen2);
00291
00292         //draw the main shape
00293         switch( shape )
00294         {
00295         case kRectangle:
00296             hdc.Rectangle(selfB);
00297             break;
00298         case kRoundRect:
00299             hdc.RoundRect(selfB, ROUND_RECT_PT);
00300             break;
00301         case kOctangle:
00302             DrawOctangle(hdc, selfB);
00303             break;
00304         default:
00305             ASSERT(FALSE);  //unknown type
00306             return;
00307         }
00308
00309         //cleanup
00310         if (pOldPen != 0L)
00311         {
00312             hdc.SelectObject(pOldPen);
00313             pOldPen = 0L;
00314         }
00315         if (pOldBrush != 0L)
00316         {
00317             hdc.SelectObject(pOldBrush);
00318             pOldBrush = 0L;
00319         }
00320
00321         pen.DeleteObject();
00322         pen2.DeleteObject();
00323         brush.DeleteObject();
00324     }
00325     CATCH_ALL(e)
00326     {
00327         if (pOldPen != 0L)
00328             hdc.SelectObject(pOldPen);
00329         if (pOldBrush != 0L)
00330             hdc.SelectObject(pOldBrush);
00331     }
00332     END_CATCH_ALL
00333 }
00334
00335 void CWinLogHeaderData::UpdateSelf(CDC & hdc, EntnodeData *entryInfo)
00336 {
00337     // draw the node
00338     ::DrawNode(hdc, selfB, gGraphHeaderColor, kRoundRect, sel);
00339
00340     // draw the content of the node
00341     TEXTMETRIC tm;
00342     hdc.GetTextMetrics(&tm);
00343     CPoint center = selfB.CenterPoint();
00344     int nCenterX = center.x;
00345     int nCenterY = center.y - tm.tmHeight/2;
00346     CLogNodeHeader & header = *(CLogNodeHeader *)fNode;
00347     hdc.ExtTextOut(nCenterX, nCenterY, ETO_CLIPPED, selfB,
00348         (*header).WorkingFile(), (*header).WorkingFile().length(), NULL);
00349 }
00350
00351 CSize CWinLogRevData::GetBoundsSelf(CDC & hdc, EntnodeData *entryInfo)
00352 {
00353     CLogNodeRev & rev = *(CLogNodeRev *)fNode;
00354     CSize size = hdc.GetTextExtent((*rev).RevNum().c_str(),
00355         strlen((*rev).RevNum().c_str()));
00356     if(IsDiskNode(entryInfo))
00357     {
00358         size.cx += 2 + 16 + 2;
00359         size.cy = max(16, size.cy);
00360     }
00361     return size;
00362 }
00363
00364 void CWinLogRevData::UpdateSelf(CDC & hdc, EntnodeData *entryInfo)
00365 {
00366     CRect txtRect = selfB;
00367
00368     if(IsDiskNode(entryInfo))
00369     {
00370         txtRect.left += 2 + 16 + 2;
00371     }
00372
00373     // draw the node
00374     COLORREF contour = gGraphNodeColor;
00375     int penStyle = PS_SOLID;
00376
00377     if(IsDeadNode())
00378     {
00379         contour = (COLORREF)gGraphDeadNodeColor;
00380         penStyle = STYLE_DEADNODE;
00381     }
00382     else if(IsUserState())
00383     {
00384         contour = (COLORREF)gGraphUserStateNodeColor;
00385         penStyle = STYLE_USERSTATENODE;
00386     }
00387
00388     ::DrawNode(hdc, selfB, contour, kRectangle, sel, penStyle);
00389
00390     // draw the state icon if it is the rev. of the disk
00391     if(IsDiskNode(entryInfo))
00392     {
00393         CImageList & list = CGraphView::GetImgList();
00394         CPoint w(selfB.TopLeft());
00395         w.x += 2;
00396         w.y += (selfB.Height() - 16) / 2;
00397         list.Draw(&hdc, CBrowseFileView::GetImageForEntry(entryInfo),
00398             w, ILD_TRANSPARENT);
00399     }
00400
00401     // draw the content of the node
00402     TEXTMETRIC tm;
00403     hdc.GetTextMetrics(&tm);
00404     CPoint center = txtRect.CenterPoint();
00405     int nCenterX = center.x;
00406     int nCenterY = center.y - tm.tmHeight/2;
00407     CLogNodeRev & rev = *(CLogNodeRev *)fNode;
00408     hdc.ExtTextOut(nCenterX, nCenterY, ETO_CLIPPED, txtRect,
00409             (*rev).RevNum().c_str(), strlen((*rev).RevNum().c_str()), NULL);
00410 }
00411
00412 CSize CWinLogTagData::GetBoundsSelf(CDC & hdc, EntnodeData *entryInfo)
00413 {
00414     CLogNodeTag & tag = *(CLogNodeTag *)fNode;
00415     return hdc.GetTextExtent(*tag, (*tag).length());
00416 }
00417
00418 void CWinLogTagData::UpdateSelf(CDC & hdc, EntnodeData *entryInfo)
00419 {
00420     // draw the node
00421     ::DrawNode(hdc, selfB, gGraphTagColor, kRoundRect, sel);
00422
00423     // draw the content of the node
00424     TEXTMETRIC tm;
00425     hdc.GetTextMetrics(&tm);
00426     CPoint center = selfB.CenterPoint();
00427     int nCenterX = center.x;
00428     int nCenterY = center.y - tm.tmHeight/2;
00429     CLogNodeTag & tag = *(CLogNodeTag *)fNode;
00430     hdc.ExtTextOut(nCenterX, nCenterY, ETO_CLIPPED, selfB,
00431         *tag, (*tag).length(), NULL);
00432 }
00433
00434 CSize CWinLogBranchData::GetBoundsSelf(CDC & hdc, EntnodeData *entryInfo)
00435 {
00436     CLogNodeBranch & branch = *(CLogNodeBranch *)fNode;
00437     return hdc.GetTextExtent(*branch, (*branch).length());
00438 }
00439
00440 void CWinLogBranchData::UpdateSelf(CDC & hdc, EntnodeData *entryInfo)
00441 {
00442     // draw the node
00443     ::DrawNode(hdc, selfB, gGraphBranchColor, kOctangle, sel);
00444
00445     // draw the content of the node
00446     TEXTMETRIC tm;
00447     hdc.GetTextMetrics(&tm);
00448     CPoint center = selfB.CenterPoint();
00449     int nCenterX = center.x;
00450     int nCenterY = center.y - tm.tmHeight/2;
00451     CLogNodeBranch & branch = *(CLogNodeBranch *)fNode;
00452     hdc.ExtTextOut(nCenterX, nCenterY, ETO_CLIPPED, selfB,
00453         *branch, (*branch).length(), NULL);
00454 }
00455
00456 CWinLogData::CWinLogData(CLogNode *node) : CLogNodeData(node)
00457 {
00458     selfB.SetRectEmpty();
00459     totB.SetRectEmpty();
00460     sel = false;
00461 }
00462
00463 CWinLogData::~CWinLogData()
00464 {
00465 }
00466
00467 const char *CWinLogData::GetStr(void)
00468 {
00469     switch(GetType())
00470     {
00471         case kNodeHeader :
00472         {
00473             CLogNodeHeader & header = *(CLogNodeHeader *)fNode;
00474             return (*header).WorkingFile();
00475             break;
00476         }
00477         case kNodeBranch :
00478         {
00479             CLogNodeBranch & branch = *(CLogNodeBranch *)fNode;
00480             return *branch;
00481             break;
00482         }
00483         case kNodeRev :
00484         {
00485             CLogNodeRev & rev = *(CLogNodeRev *)fNode;
00486             return (*rev).RevNum().c_str();
00487             break;
00488         }
00489         case kNodeTag :
00490         {
00491             CLogNodeTag & tag = *(CLogNodeTag *)fNode;
00492             return *tag;
00493             break;
00494         }
00495     }
00496     return 0L;
00497 }
00498
00499 CWinLogData * CWinLogData::CreateNewData(CLogNode *node)
00500 {
00501     if(node->GetUserData() != 0L)
00502         return (CWinLogData *)node->GetUserData();
00503
00504     CWinLogData *res = 0L;
00505     switch(node->GetType())
00506     {
00507     case kNodeHeader :
00508         res = new CWinLogHeaderData(node);
00509         break;
00510     case kNodeBranch :
00511         res = new CWinLogBranchData(node);
00512         break;
00513     case kNodeRev :
00514         res = new CWinLogRevData(node);
00515         break;
00516     case kNodeTag :
00517         res = new CWinLogTagData(node);
00518         break;
00519     }
00520     node->SetUserData(res);
00521     return res;
00522 }
00523
00524 bool CWinLogData::IsDiskNode(EntnodeData *entryInfo)
00525 {
00526     if(entryInfo == 0L || GetType() != kNodeRev)
00527         return false;
00528     const char *vn = (*entryInfo)[EntnodeFile::kVN];
00529     if(vn == 0L)
00530         return false;
00531
00532     return strcmp(vn, (**(CLogNodeRev *)fNode).RevNum().c_str()) == 0;
00533 }
00534
00535 bool CWinLogData::IsDeadNode()
00536 {
00537     if(GetType() != kNodeRev)
00538         return false;
00539
00540     return strcmp("dead", (**(CLogNodeRev *)fNode).State()) == 0;
00541 }
00542
00543 bool CWinLogData::IsUserState()
00544 {
00545     if(GetType() != kNodeRev)
00546         return false;
00547
00548     return !(strcmp("dead", (**(CLogNodeRev *)fNode).State()) == 0 ||
00549         strcmp("Exp", (**(CLogNodeRev *)fNode).State()) == 0);
00550 }
00551
00552 const int kVChildSpace = 8;
00553 const int kHChildSpace = 40;
00554 const int kInflateNodeSpace = 8;
00555
00556 void CWinLogData::Offset(CPoint o)
00557 {
00558     selfB.OffsetRect(o);
00559     totB.OffsetRect(o);
00560     vector<CLogNode *>::iterator i;
00561     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00562     {
00563         CLogNode *subNode = *i;
00564         GetData(subNode)->Offset(o);
00565     }
00566     if(fNode->Next() != 0L)
00567         GetData(fNode->Next())->Offset(o);
00568 }
00569
00570 void CWinLogData::SetSelected(CScrollView *view, bool state)
00571 {
00572     sel = state;
00573
00574     CRect invalR = selfB;
00575     invalR.OffsetRect(-view->GetDeviceScrollPosition());
00576     view->InvalidateRect(invalR);
00577 }
00578
00579 void CWinLogData::UnselectAll(CScrollView *view)
00580 {
00581     if(sel)
00582     {
00583         SetSelected(view, false);
00584     }
00585
00586     vector<CLogNode *>::iterator i;
00587     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00588     {
00589         CLogNode *subNode = *i;
00590         GetData(subNode)->UnselectAll(view);
00591     }
00592     if(fNode->Next() != 0L)
00593         GetData(fNode->Next())->UnselectAll(view);
00594 }
00595
00596 CWinLogData *CWinLogData::HitTest(CPoint point)
00597 {
00598     if(!totB.PtInRect(point))
00599         return 0L;
00600     if(selfB.PtInRect(point))
00601         return this;
00602
00603     CWinLogData *result;
00604     vector<CLogNode *>::iterator i;
00605     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00606     {
00607         CLogNode *subNode = *i;
00608         result = GetData(subNode)->HitTest(point);
00609         if(result != 0L)
00610             return result;
00611     }
00612     if(fNode->Next() != 0L)
00613     {
00614         result = GetData(fNode->Next())->HitTest(point);
00615         if(result != 0L)
00616             return result;
00617     }
00618     return 0L;
00619 }
00620
00621 void CWinLogData::Update(CDC & hdc, EntnodeData *entryInfo)
00622 {
00623     CLogNode *subNode;
00624     CLogNode *nextNode = fNode->Next();
00625     CPen *pOldPen = 0L;
00626     CBrush *pOldBrush = 0L;
00627     CPen pen, pen2;
00628     CBrush brush;
00629
00630     UpdateSelf(hdc, entryInfo);
00631
00632     TRY
00633     {
00634         pen.CreatePen(PS_SOLID, 2, RGB(0, 0, 255));
00635         pen2.CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
00636         pOldPen = hdc.SelectObject(&pen);
00637
00638         int topY = selfB.TopLeft().y + 2;
00639         int botY = selfB.BottomRight().y - 2;
00640         int lefX = selfB.BottomRight().x + 4;
00641
00642         int count = 1;
00643         int tot = fNode->Childs().size() + 1;
00644
00645         // draw the children
00646         vector<CLogNode *>::iterator i;
00647         for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i, ++count)
00648         {
00649             subNode = *i;
00650
00651             // draw the link
00652             CRect & cb = GetData(subNode)->SelfBounds();
00653             if(subNode->GetType() == kNodeRev || subNode->GetType() == kNodeBranch)
00654                 hdc.SelectObject(&pen);
00655             else
00656                 hdc.SelectObject(&pen2);
00657             float y = (float)topY + (float)(botY - topY) *
00658                 (float)count / (float)tot;
00659             int rigX = cb.TopLeft().x - 4;
00660             float x = (float)rigX - (float)(rigX - lefX) *
00661                 (float)count / (float)tot;
00662
00663             //special drawing for the header node
00664             if( count == 1 && fNode->GetType() == kNodeHeader )
00665             {
00666                 hdc.MoveTo(selfB.TopLeft().x + kHChildSpace/2, selfB.BottomRight().y);
00667                 hdc.LineTo(selfB.TopLeft().x + kHChildSpace/2, cb.CenterPoint().y);
00668                 hdc.LineTo(cb.TopLeft().x, cb.CenterPoint().y);
00669             }
00670             else
00671             {
00672                 //int halfX = (cb.TopLeft().x - selfB.BottomRight().x) / 2;
00673                 hdc.MoveTo(selfB.BottomRight().x, (int)y);
00674                 hdc.LineTo(x, (int)y);
00675                 hdc.LineTo(x, cb.CenterPoint().y);
00676                 hdc.LineTo(cb.TopLeft().x, cb.CenterPoint().y);
00677             }
00678
00679             // draw the sub-node
00680             GetData(subNode)->Update(hdc, entryInfo);
00681         }
00682
00683         // draw the next node
00684         if(nextNode != 0L)
00685         {
00686             // draw the link
00687             CRect & nb = GetData(nextNode)->SelfBounds();
00688             if(nextNode->GetType() == kNodeRev || nextNode->GetType() == kNodeBranch)
00689                 hdc.SelectObject(&pen);
00690             else
00691                 hdc.SelectObject(&pen2);
00692             int centerX = selfB.Width() < nb.Width() ?
00693                 selfB.CenterPoint().x : nb.CenterPoint().x;
00694             hdc.MoveTo(centerX, selfB.BottomRight().y);
00695             hdc.LineTo(centerX, nb.TopLeft().y);
00696
00697             // draw the next node
00698             GetData(nextNode)->Update(hdc, entryInfo);
00699         }
00700
00701         if (pOldPen != 0L)
00702         {
00703             hdc.SelectObject(pOldPen);
00704             pOldPen = 0L;
00705         }
00706         if (pOldBrush != 0L)
00707         {
00708             hdc.SelectObject(pOldBrush);
00709             pOldBrush = 0L;
00710         }
00711
00712         pen.DeleteObject();
00713         pen2.DeleteObject();
00714     }
00715     CATCH_ALL(e)
00716     {
00717         if (pOldPen != 0L)
00718             hdc.SelectObject(pOldPen);
00719         if (pOldBrush != 0L)
00720             hdc.SelectObject(pOldBrush);
00721     }
00722     END_CATCH_ALL
00723 }
00724
00725 void CWinLogData::ComputeBounds(const CPoint & topLeft, CDC & hdc,
00726                                 EntnodeData *entryInfo)
00727 {
00728     CLogNode *subNode;
00729     CLogNode *nextNode = fNode->Next();
00730
00731     // first compute childrens bounds
00732     vector<CLogNode *>::iterator i;
00733     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00734     {
00735         subNode = *i;
00736         CWinLogData::CreateNewData(subNode);
00737         GetData(subNode)->ComputeBounds(topLeft, hdc, entryInfo);
00738     }
00739     if(nextNode != 0L)
00740         CWinLogData::CreateNewData(nextNode);
00741
00742     // compute self place
00743     selfB.SetRectEmpty();
00744     CSize size = GetBoundsSelf(hdc, entryInfo);
00745     size.cx += kInflateNodeSpace;
00746     size.cy += kInflateNodeSpace;
00747     selfB.SetRect(0, 0, size.cx, size.cy);
00748
00749     // offset to the place assigned to this node
00750     selfB.OffsetRect(topLeft - selfB.TopLeft());
00751
00752     // calculate the total height of the childrens
00753     int vSize = 0;
00754     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00755     {
00756         subNode = *i;
00757         CRect & b = GetData(subNode)->Bounds();
00758         vSize += b.Height();
00759     }
00760     if(!fNode->Childs().empty())
00761         vSize += (fNode->Childs().size() - 1) * kVChildSpace;
00762
00763     // offset the children relative to self
00764     CPoint startChilds(topLeft.x + selfB.Width() + kHChildSpace,
00765         /*selfB.CenterPoint().y - vSize / 2*/topLeft.y);
00766
00767     //place the first child at the bottom of the header node so it won't take so much space for long filenames
00768     if( fNode->GetType() == kNodeHeader )
00769     {
00770         startChilds = CPoint(topLeft.x + kHChildSpace, topLeft.y + selfB.Height() + kVChildSpace);
00771     }
00772
00773     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00774     {
00775         subNode = *i;
00776         CRect curPos = GetData(subNode)->Bounds();
00777         GetData(subNode)->Offset(startChilds - curPos.TopLeft());
00778         startChilds.y += curPos.Height() + kVChildSpace;
00779     }
00780
00781     // calculate the total bounds of the childrens
00782     CRect bc;
00783     bc.SetRectEmpty();
00784     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00785     {
00786         subNode = *i;
00787         CRect & b = GetData(subNode)->Bounds();
00788         bc.UnionRect(bc, b);
00789     }
00790
00791     // now we got the complete size
00792     totB.UnionRect(selfB, bc);
00793
00794     if(nextNode != 0L)
00795     {
00796         CPoint nextTopLeft;
00797         nextTopLeft.x = totB.TopLeft().x;
00798         nextTopLeft.y = totB.BottomRight().y + kVChildSpace;
00799         GetData(nextNode)->ComputeBounds(nextTopLeft, hdc, entryInfo);
00800
00801         totB.UnionRect(totB, GetData(nextNode)->Bounds());
00802     }
00803 }
00804
00806 // CGraphView drawing
00807
00808 CImageList CGraphView::m_ImageList;
00809
00810 void CGraphView::CalcImageSize(void)
00811 {
00812     const CPoint startPoint(STARTPOINT_PT);
00813     CWindowDC dc(this);
00814     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
00815     CLogNode *root = pDoc->GetNode();
00816     if(root == 0L)
00817         return;
00818
00819     // set all the bounds locations
00820     CWinLogData *data = CWinLogData::CreateNewData(root);
00821     root->SetUserData(data);
00822     data->ComputeBounds(startPoint, dc, pDoc->GetEntryInfo());
00823
00824     // reoffset from (0, 0)
00825     CRect bounds = data->Bounds();
00826     data->Offset(startPoint - bounds.TopLeft());
00827     bounds = data->Bounds();
00828
00829     // set the scroll size, we add the margin of the start point offset on each side
00830     SetScrollSizes(MM_TEXT, bounds.Size() + CSize(startPoint)+CSize(startPoint)+CSize(SHADOW_OFFSET_PT));
00831 }
00832
00833 void CGraphView::OnInitialUpdate()
00834 {
00835     CScrollView::OnInitialUpdate();
00836
00837     SetScrollSizes(MM_TEXT, CSize(200, 100));
00838     //CalcImageSize();
00839 }
00840
00841 void CGraphView::OnDraw(CDC* pDC)
00842 {
00843     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
00844     CLogNode *root = pDoc->GetNode();
00845     if(root == 0L || root->GetUserData() == 0L)
00846         return;
00847
00848     CWinLogData *data = (CWinLogData *)root->GetUserData();
00849
00850     pDC->SetTextAlign(TA_CENTER);
00851     pDC->SetBkMode(TRANSPARENT);
00852     data->Update(*pDC, pDoc->GetEntryInfo());
00853 }
00854
00856 // CGraphView diagnostics
00857
00858 #ifdef _DEBUG
00859 void CGraphView::AssertValid() const
00860 {
00861     CScrollView::AssertValid();
00862 }
00863
00864 void CGraphView::Dump(CDumpContext& dc) const
00865 {
00866     CScrollView::Dump(dc);
00867 }
00868 #endif //_DEBUG
00869
00870 class CGraphRectTracker : public CRectTracker
00871 {
00872 public:
00873     CGraphRectTracker(CGraphView *view) : mView(view) {}
00874
00875     virtual void OnChangedRect(const CRect& rectOld);
00876 protected:
00877     CGraphView *mView;
00878 };
00879
00880 void CGraphRectTracker::OnChangedRect(const CRect& rectOld)
00881 {
00882 #if 0 // :-< doesn't work...
00883     CRect r;
00884     mView->GetClientRect(&r);
00885     CPoint rb = m_rect.BottomRight();
00886
00887     if(!r.PtInRect(rb))
00888     {
00889         CPoint orig = mView->GetDeviceScrollPosition();
00890         CPoint offset;
00891         if(rb.x >= r.right)
00892             offset.x += 10;
00893         if(rb.y >= r.bottom)
00894             offset.y += 10;
00895         orig += offset;
00896         m_rect -= offset;
00897         mView->ScrollToPosition(orig);
00898     }
00899 #endif
00900 }
00901
00902 // traversal class
00903 typedef enum
00904 {
00905     kTContinue,
00906     kTGetDown,
00907     kTStop
00908 } kTGraph;
00909
00910 class TGraph
00911 {
00912 public:
00913
00914     kTGraph TraverseGraph(CLogNode * node);
00915
00916     virtual kTGraph TraverseNode(CLogNode *node) = 0;
00917 protected:
00918 };
00919
00920 kTGraph TGraph::TraverseGraph(CLogNode * node)
00921 {
00922     kTGraph res;
00923
00924     res = TraverseNode(node);
00925     if(res == kTStop)
00926         return kTStop;
00927
00928     if(res == kTGetDown)
00929     {
00930         vector<CLogNode *>::iterator i;
00931         for(i = node->Childs().begin(); i != node->Childs().end(); ++i)
00932         {
00933             res = TraverseGraph(*i);
00934             if(res == kTStop)
00935                 return kTStop;
00936         }
00937     }
00938
00939     if(node->Next() != 0L)
00940     {
00941         res = TraverseGraph(node->Next());
00942         if(res == kTStop)
00943             return kTStop;
00944     }
00945
00946     return kTContinue;
00947 };
00948
00949 class TGraphRectSelect : public TGraph
00950 {
00951 public:
00952     TGraphRectSelect(bool shiftOn, CGraphView *view, CRect & r) :
00953         mShiftOn(shiftOn), mView(view), mR(r) {}
00954
00955     virtual kTGraph TraverseNode(CLogNode *node)
00956     {
00957         CWinLogData *data = (CWinLogData *)node->GetUserData();
00958
00959         // no need to go further
00960         CRect inter;
00961         if(!inter.IntersectRect(mR, data->Bounds()))
00962         {
00963             return kTContinue;
00964         }
00965         // self enclosed in the tracker ?
00966         CRect & b = data->SelfBounds();
00967         if(mR.PtInRect(b.TopLeft()) && mR.PtInRect(b.BottomRight()))
00968         {
00969             if(!mShiftOn)
00970             {
00971                 if(!data->Selected())
00972                     data->SetSelected(mView, true);
00973             }
00974             else
00975                 data->SetSelected(mView, !data->Selected());
00976         }
00977         // traverse childrens
00978         return kTGetDown;
00979     }
00980
00981 protected:
00982     bool mShiftOn;
00983     CGraphView *mView;
00984     CRect & mR;
00985 };
00986
00988 // CGraphView message handlers
00989
00990 void CGraphView::OnLButtonDown(UINT nFlags, CPoint point)
00991 {
00992     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
00993     CLogNode *root = pDoc->GetNode();
00994     if(root == 0L || root->GetUserData() == 0L)
00995         return;
00996
00997     CWinLogData *data = (CWinLogData *)root->GetUserData();
00998
00999     if(nFlags & MK_LBUTTON)
01000     {
01001         if((nFlags & MK_SHIFT) == 0 && (nFlags & MK_CONTROL) == 0)
01002             data->UnselectAll(this);
01003         point += GetDeviceScrollPosition();
01004         CWinLogData *hit = data->HitTest(point);
01005
01006         if(hit != 0L)
01007         {
01008             if((nFlags & MK_SHIFT) == 0 && (nFlags & MK_CONTROL) == 0)
01009             {
01010                 if(!hit->Selected())
01011                 {
01012                     hit->SetSelected(this, true);
01013                     CWincvsApp *app = (CWincvsApp *)AfxGetApp();
01014                     CWincvsView *view = app->GetConsoleView();
01015                     if(view != 0L)
01016                     {
01017                         CColorConsole out(view);
01018                         CvsLogOutput(out, hit->Node());
01019                     }
01020                 }
01021             }
01022             else
01023             {
01024                 hit->SetSelected(this, !hit->Selected());
01025             }
01026         }
01027         else
01028         {
01029             CGraphRectTracker track(this);
01030             point -= GetDeviceScrollPosition();
01031             if(track.TrackRubberBand(this, point, true))
01032             {
01033                 // traverse and mark
01034                 track.m_rect.OffsetRect(GetDeviceScrollPosition());
01035                 track.m_rect.NormalizeRect();
01036                 TGraphRectSelect traversal((nFlags & MK_CONTROL) != 0, this,
01037                     track.m_rect);
01038                 traversal.TraverseGraph(root);
01039             }
01040         }
01041     }
01042     else if(nFlags & MK_RBUTTON)
01043     {
01044     }
01045
01046     CScrollView::OnLButtonDown(nFlags, point);
01047 }
01048
01049 class TGraphCmdStatus : public TGraph
01050 {
01051 public:
01052     TGraphCmdStatus() :
01053         fSel1(0L), fSel2(0L), fCountSel(0) {}
01054
01055     virtual kTGraph TraverseNode(CLogNode *node)
01056     {
01057         CWinLogData *data = (CWinLogData *)node->GetUserData();
01058
01059         if(data->Selected())
01060         {
01061             if(fSel1 == 0L)
01062                 fSel1 = data;
01063             else if(fSel2 == 0L)
01064                 fSel2 = data;
01065             fCountSel++;
01066         }
01067
01068         return kTGetDown;
01069     }
01070
01071     CWinLogData *fSel1;
01072     CWinLogData *fSel2;
01073     int fCountSel;
01074 };
01075
01076 class CGraphConsole : public CCvsConsole
01077 {
01078 public:
01079     CGraphConsole()
01080     {
01081         CWincvsApp *app = (CWincvsApp *)AfxGetApp();
01082         view = app->GetConsoleView();
01083     }
01084
01085     virtual long cvs_out(char *txt, long len)
01086     {
01087         if(view != 0L)
01088             view->OutConsole(txt, len);
01089         return  len;
01090     }
01091
01092     virtual long cvs_err(char *txt, long len)
01093     {
01094         if(view != 0L)
01095             view->OutConsole(txt, len, true);
01096         return  len;
01097     }
01098
01099     CWincvsView *view;
01100 };
01101
01102 void CGraphView::OnViewReload()
01103 {
01104     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01105     CLogNode *root = pDoc->GetNode();
01106     if(root == 0L || root->GetUserData() == 0L)
01107         return;
01108
01109     CvsArgs args;
01110     args.add("log");
01111     args.add(pDoc->GetName());
01112     args.print(pDoc->GetDir());
01113     CStr dir(pDoc->GetDir());
01114     CvsLogParse(dir, args, true, pDoc);
01115 }
01116
01117 void CGraphView::OnUpdateViewReload(CCmdUI* pCmdUI)
01118 {
01119     if(DisableCommon())
01120         pCmdUI->Enable(FALSE);
01121     else
01122         pCmdUI->Enable(TRUE);
01123 }
01124
01125 void CGraphView::OnViewDiff()
01126 {
01127     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01128     CLogNode *root = pDoc->GetNode();
01129     if(root == 0L || root->GetUserData() == 0L)
01130         return;
01131
01132     TGraphCmdStatus trav;
01133     trav.TraverseGraph(root);
01134
01135     bool done = false;
01136     if(gCvsPrefs.ExtDiff() != 0L)
01137     {
01138         CStr f1, f2, prf1, prf2, ext, base;
01139         CvsArgs args1, args2;
01140
01141         GetExtension(pDoc->GetName(), base, ext);
01142
01143         prf1 = base;
01144         prf1 << '_';
01145         prf1 << trav.fSel1->GetStr();
01146         prf1 << '_';
01147         args1.add("update");
01148         args1.add("-p");
01149         args1.add("-r");
01150         args1.add(trav.fSel1->GetStr());
01151         args1.add(pDoc->GetName());
01152         args1.print(pDoc->GetDir());
01153         f1 = launchCVS(pDoc->GetDir(), args1, (const char *)prf1, ext);
01154
01155         if(trav.fCountSel == 2)
01156         {
01157             prf2 = base;
01158             prf2 << '_';
01159             prf2 << trav.fSel2->GetStr();
01160             prf2 << '_';
01161             args2.add("update");
01162             args2.add("-p");
01163             args2.add("-r");
01164             args2.add(trav.fSel2->GetStr());
01165             args2.add(pDoc->GetName());
01166             args2.print(pDoc->GetDir());
01167             f2 = launchCVS(pDoc->GetDir(), args2, (const char *)prf2, ext);
01168         }
01169         else
01170         {
01171             f2 = pDoc->GetDir();
01172             if(!f2.endsWith(kPathDelimiter))
01173                 f2 << kPathDelimiter;
01174             f2 << pDoc->GetName();
01175         }
01176
01177         if(f1.empty() || f2.empty())
01178             return;
01179
01180         done = LaunchDiff(f1, f2);
01181     }
01182
01183     if(!done)
01184     {
01185         CvsArgs args;
01186         CGraphConsole cons;
01187         args.add("diff");
01188         args.add("-r");
01189         args.add(trav.fSel1->GetStr());
01190         if(trav.fCountSel == 2)
01191         {
01192             args.add("-r");
01193             args.add(trav.fSel2->GetStr());
01194         }
01195         args.add(pDoc->GetName());
01196         args.print(pDoc->GetDir());
01197         launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01198     }
01199 }
01200
01201 void CGraphView::OnUpdateViewDiff(CCmdUI* pCmdUI)
01202 {
01203     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01204     CLogNode *root = pDoc->GetNode();
01205     if(DisableCommon())
01206     {
01207         pCmdUI->Enable(FALSE);
01208         return;
01209     }
01210
01211     TGraphCmdStatus trav;
01212     trav.TraverseGraph(root);
01213     BOOL outEnabled = (trav.fCountSel == 2 && trav.fSel1->GetType() != kNodeHeader &&
01214         trav.fSel2->GetType() != kNodeHeader) ||
01215         (trav.fCountSel == 1 && trav.fSel1->GetType() != kNodeHeader);
01216     pCmdUI->Enable(outEnabled);
01217 }
01218
01219 void CGraphView::OnViewUpdate()
01220 {
01221     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01222     CLogNode *root = pDoc->GetNode();
01223     if(root == 0L || root->GetUserData() == 0L)
01224         return;
01225
01226     CvsArgs args;
01227     args.add("update");
01228     args.add("-A");
01229     args.add(pDoc->GetName());
01230     args.print(pDoc->GetDir());
01231     CGraphConsole cons;
01232     launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01233
01234     OnViewReload();
01235 }
01236
01237 void CGraphView::OnUpdateViewUpdate(CCmdUI* pCmdUI)
01238 {
01239     if(DisableCommon())
01240         pCmdUI->Enable(FALSE);
01241     else
01242         pCmdUI->Enable(TRUE);
01243 }
01244
01245 void CGraphView::OnViewTag()
01246 {
01247     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01248     CLogNode *root = pDoc->GetNode();
01249     if(root == 0L || root->GetUserData() == 0L)
01250         return;
01251
01252     TGraphCmdStatus trav;
01253     trav.TraverseGraph(root);
01254     CvsArgs args;
01255     args.add("update");
01256     CLogNode *node = trav.fSel1->Node();
01257     switch(node->GetType())
01258     {
01259         case kNodeHeader :
01260         {
01261             args.add("-A");
01262             break;
01263         }
01264         case kNodeRev :
01265         case kNodeBranch :
01266         case kNodeTag :
01267         {
01268             args.add("-r");
01269             args.add(trav.fSel1->GetStr());
01270             break;
01271         }
01272     }
01273     args.add(pDoc->GetName());
01274     args.print(pDoc->GetDir());
01275     CGraphConsole cons;
01276     launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01277
01278     OnViewReload();
01279 }
01280
01281 void CGraphView::OnUpdateViewTag(CCmdUI* pCmdUI)
01282 {
01283     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01284     CLogNode *root = pDoc->GetNode();
01285     if(DisableCommon())
01286     {
01287         pCmdUI->Enable(FALSE);
01288         return;
01289     }
01290
01291     TGraphCmdStatus trav;
01292     trav.TraverseGraph(root);
01293     BOOL outEnabled = trav.fCountSel == 1;
01294     pCmdUI->Enable(outEnabled);
01295 }
01296
01297 void CGraphView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
01298 {
01299     // TODO: Add your specialized code here and/or call the base class
01300
01301     CScrollView::OnBeginPrinting(pDC, pInfo);
01302
01303     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01304     CLogNode *root = pDoc->GetNode();
01305     if(root == 0L)
01306         return;
01307
01308     // set all the bounds locations
01309     CWinLogData *data = CWinLogData::CreateNewData(root);
01310     root->SetUserData(data);
01311     CPoint start(0, 0);
01312     data->ComputeBounds(start, *pDC, pDoc->GetEntryInfo());
01313
01314     // compute the number of pages
01315     CRect bounds = data->Bounds();
01316     m_pageHeight = pDC->GetDeviceCaps(VERTRES);
01317     m_numberOfPages = bounds.Height() / m_pageHeight + 1;
01318
01319     pInfo->SetMaxPage(m_numberOfPages);
01320 }
01321
01322 void CGraphView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
01323 {
01324     // TODO: Add your specialized code here and/or call the base class
01325
01326     CScrollView::OnEndPrinting(pDC, pInfo);
01327
01328     CalcImageSize();
01329     Invalidate();
01330 }
01331
01332 BOOL CGraphView::OnPreparePrinting(CPrintInfo* pInfo)
01333 {
01334     BOOL res = DoPreparePrinting(pInfo);
01335     if(!res)
01336         return res;
01337
01338     return TRUE;
01339 }
01340
01341 void CGraphView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
01342 {
01343     if (!pDC->IsPrinting())
01344         return;
01345
01346     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01347     CLogNode *root = pDoc->GetNode();
01348     if(root == 0L || root->GetUserData() == 0L)
01349         return;
01350
01351     CWinLogData *data = (CWinLogData *)root->GetUserData();
01352
01353     // Orient the viewport so that the first row to be printed
01354     // has a viewport coordinate of (0,0).
01355     int yTopOfPage = (pInfo->m_nCurPage -1) * m_pageHeight;
01356     pDC->SetViewportOrg(0, -yTopOfPage);
01357     pDC->SetTextAlign(TA_CENTER);
01358     pDC->SetBkMode(TRANSPARENT);
01359     data->Update(*pDC, pDoc->GetEntryInfo());
01360
01361     //  CScrollView::OnPrint(pDC, pInfo);
01362 }
01363
01364 bool CGraphView::DisableCommon()
01365 {
01366     CWincvsApp *app = (CWincvsApp *)AfxGetApp();
01367     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01368     CLogNode *root = pDoc->GetNode();
01369     return root == 0L || root->GetUserData() == 0L || app->gCvsRunning || this != CWnd::GetFocus() || gCvsPrefs.empty();
01370 }
01371
01372 bool CGraphView::IsSelSingleNode(kLogNode type, bool equal /*= true*/)
01373 {
01374     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01375     CLogNode *root = pDoc->GetNode();
01376
01377     TGraphCmdStatus trav;
01378     trav.TraverseGraph(root);
01379     return (trav.fCountSel == 1 &&
01380         (equal ? trav.fSel1->GetType() == type : trav.fSel1->GetType() != type));
01381 }
01382
01383 class TGraphDelCmd : public TGraph
01384 {
01385 public:
01386     TGraphDelCmd() :
01387         fCountSel(0), fOnlyRev(true) {}
01388
01389     virtual kTGraph TraverseNode(CLogNode *node)
01390     {
01391         CWinLogData *data = (CWinLogData *)node->GetUserData();
01392
01393         if(data->Selected())
01394         {
01395             if(data->GetType() != kNodeRev)
01396                 fOnlyRev = false;
01397             else
01398                 fAllRevs.push_back(CStr(data->GetStr()));
01399             fCountSel++;
01400         }
01401
01402         return kTGetDown;
01403     }
01404
01405     int fCountSel;
01406     bool fOnlyRev;
01407     std::vector<CStr> fAllRevs;
01408 };
01409
01410 void CGraphView::OnViewDelrev()
01411 {
01412     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01413     CLogNode *root = pDoc->GetNode();
01414     if(root == 0L || root->GetUserData() == 0L)
01415         return;
01416
01417     if(AfxMessageBox("Are you really sure you want to do that ? This will permanently remove the revisions on the server.",
01418         MB_OKCANCEL|MB_DEFBUTTON2|MB_ICONSTOP) != IDOK)
01419             return;
01420
01421     TGraphDelCmd trav;
01422     trav.TraverseGraph(root);
01423
01424     CProgress progress(true, "Deleting revisions...");
01425
01426     std::vector<CStr>::const_iterator i;
01427     int count = 0;
01428     for(i = trav.fAllRevs.begin(); i != trav.fAllRevs.end(); ++i, ++count)
01429     {
01430         progress.SetProgress(((float)count / (float)trav.fAllRevs.size()) * 100.0 + .5);
01431         if(progress.HasAborted())
01432             break;
01433
01434         CvsArgs args;
01435         args.add("admin");
01436         args.add("-o");
01437         args.add(*i);
01438         args.add(pDoc->GetName());
01439         args.print(pDoc->GetDir());
01440         CGraphConsole cons;
01441         launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01442     }
01443
01444     if(!progress.HasAborted())
01445         progress.SetProgress(100);
01446
01447     OnViewReload();
01448 }
01449
01450 void CGraphView::OnUpdateViewDelrev(CCmdUI* pCmdUI)
01451 {
01452     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01453     CLogNode *root = pDoc->GetNode();
01454     if(DisableCommon())
01455     {
01456         pCmdUI->Enable(FALSE);
01457         return;
01458     }
01459
01460     TGraphDelCmd trav;
01461     trav.TraverseGraph(root);
01462     BOOL outEnabled = trav.fCountSel >= 1 && trav.fOnlyRev;
01463     pCmdUI->Enable(outEnabled);
01464 }
01465
01466 class TGraphSelNonSig : public TGraph
01467 {
01468 public:
01469     TGraphSelNonSig(CGraphView *view) : fView(view)
01470     {
01471     }
01472
01473     virtual kTGraph TraverseNode(CLogNode *node)
01474     {
01475         CWinLogData *data = (CWinLogData *)node->GetUserData();
01476
01477         if(data->GetType() == kNodeRev)
01478         {
01479             if(node->Next() != 0L && node->Childs().size() == 0)
01480                 data->SetSelected(fView, true);
01481         }
01482
01483         return kTGetDown;
01484     }
01485
01486     CGraphView *fView;
01487 };
01488
01489 void CGraphView::OnViewSelnonsig()
01490 {
01491     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01492     CLogNode *root = pDoc->GetNode();
01493     if(root == 0L || root->GetUserData() == 0L)
01494         return;
01495
01496     CWinLogData *data = (CWinLogData *)root->GetUserData();
01497     data->UnselectAll(this);
01498
01499     TGraphSelNonSig trav(this);
01500     trav.TraverseGraph(root);
01501 }
01502
01503 void CGraphView::OnUpdateViewSelnonsig(CCmdUI* pCmdUI)
01504 {
01505     if(DisableCommon())
01506         pCmdUI->Enable(FALSE);
01507     else
01508         pCmdUI->Enable(TRUE);
01509 }
01510
01511 // CVS console used to retrieve a specific revision
01512 class CRevisionConsole : public CCvsConsole
01513 {
01514 public:
01515     CRevisionConsole()
01516     : fOut(NULL)
01517     {}
01518
01519     ~CRevisionConsole()
01520     {
01521         if (fOut)
01522         {
01523             fclose(fOut);
01524         }
01525     }
01526
01527     BOOL init(LPCTSTR path, LPCTSTR fname)
01528     {
01529         TCHAR buf[_MAX_PATH];
01530         _tmakepath(buf, NULL, path, fname, NULL);
01531         fOut = fopen(buf, "w+");
01532         return fOut != NULL;
01533     }
01534
01535     virtual long cvs_out(char *txt, long len)
01536     {
01537         fwrite(txt, sizeof(char), len, fOut);
01538         return len;
01539     }
01540
01541     virtual long cvs_err(char *txt, long len)
01542     {
01543         cvs_errstr(txt, len);
01544         return len;
01545     }
01546
01547 protected:
01548     FILE *fOut;
01549 };
01550
01551
01552 void CGraphView::OnViewRetrieve()
01553 {
01554     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01555     CLogNode *root = pDoc->GetNode();
01556     if(root == 0L || root->GetUserData() == 0L)
01557         return;
01558
01559     TGraphCmdStatus trav;
01560     trav.TraverseGraph(root);
01561
01562     CStr f1, prf1;
01563     CvsArgs args;
01564
01565     prf1 = pDoc->GetName();
01566     prf1 << ".#.";
01567     prf1 << trav.fSel1->GetStr();
01568     args.add("update");
01569     args.add("-p");
01570     args.add("-r");
01571     args.add(trav.fSel1->GetStr());
01572     args.add(pDoc->GetName());
01573     args.print(pDoc->GetDir());
01574
01575     CRevisionConsole console;
01576     console.init(pDoc->GetDir(), prf1);
01577
01578     int code = launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &console);
01579 }
01580
01581 void CGraphView::OnUpdateViewRetrieve(CCmdUI* pCmdUI)
01582 {
01583     BOOL enabled = FALSE;
01584     if(!DisableCommon())
01585     {
01586         enabled = IsSelSingleNode(kNodeHeader, false);
01587     }
01588     pCmdUI->Enable(enabled);
01589 }
01590
01591 void CGraphView::DisableUpdate(CCmdUI* pCmdUI)
01592 {
01593     pCmdUI->Enable(false);
01594 }
01595
01596 void CGraphView::OnContextMenu(CWnd* pWnd, CPoint point)
01597 {
01598     //Comply with windows UI standard (Windows Explorer file view used as a reference),
01599     //change selections according to the state of Control and Shift keys
01600     BYTE abKeyboardState[256];
01601     BOOL bControlState = FALSE;
01602     BOOL bShiftState = FALSE;
01603     memset( abKeyboardState, 0, 256 );
01604
01605     if( GetKeyboardState(abKeyboardState) )
01606     {
01607         bControlState = abKeyboardState[VK_CONTROL] & 0x80;
01608         bShiftState = abKeyboardState[VK_SHIFT] & 0x80;
01609     }
01610
01611     if( (!bControlState || (bControlState && bShiftState)) && !DisableCommon() )
01612     {
01613         CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01614         CLogNode *root = pDoc->GetNode();
01615
01616         TGraphCmdStatus trav;
01617         trav.TraverseGraph(root);
01618
01619         CWinLogData *data = (CWinLogData *)root->GetUserData();
01620         CPoint hitPoint(point);
01621         ScreenToClient(&hitPoint);
01622         hitPoint += GetDeviceScrollPosition();
01623         CWinLogData *hit = data->HitTest(hitPoint);
01624
01625         if( hit != 0L )
01626         {
01627             if( trav.fCountSel == 0 )
01628             {
01629                 hit->SetSelected(this, true);
01630             }
01631             else if( trav.fCountSel >= 1 && trav.fSel1->GetType() != kNodeHeader )
01632             {
01633                 if( !(hit->Selected() && bShiftState) && !(bControlState && bShiftState && hit->Selected()) )
01634                 {
01635                     data->UnselectAll(this);
01636                 }
01637                 hit->SetSelected(this, true);
01638             }
01639         }
01640     }
01641
01642
01643
01644     // Get the menu to display from the main app window, which for graph view
01645     // will be IDR_GRAPH,  The submenu to display is the menu under "Graph".
01646     // Note that if the position of this menu changes, the index under
01647     // GetSubMenu must also change.
01648     CMenu* pMenu    = ::AfxGetMainWnd()->GetMenu();
01649     CMenu* pSubMenu = pMenu->GetSubMenu(5);
01650
01651     pSubMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,
01652         point.x, point.y, this);
01653 }
01654
01655 void CGraphView::OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu)
01656 {
01657     ASSERT(pPopupMenu != NULL);
01658     // Check the enabled state of various menu items.
01659
01660     CCmdUI state;
01661     state.m_pMenu = pPopupMenu;
01662     ASSERT(state.m_pOther == NULL);
01663     ASSERT(state.m_pParentMenu == NULL);
01664
01665     // Determine if menu is popup in top-level menu and set m_pOther to
01666     // it if so (m_pParentMenu == NULL indicates that it is secondary popup).
01667     HMENU hParentMenu;
01668     if (AfxGetThreadState()->m_hTrackingMenu == pPopupMenu->m_hMenu)
01669         state.m_pParentMenu = pPopupMenu;    // Parent == child for tracking popup.
01670     else if ((hParentMenu = ::GetMenu(m_hWnd)) != NULL)
01671     {
01672         CWnd* pParent = this;
01673            // Child windows don't have menus--need to go to the top!
01674         if (pParent != NULL &&
01675            (hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL)
01676         {
01677            int nIndexMax = ::GetMenuItemCount(hParentMenu);
01678            for (int nIndex = 0; nIndex < nIndexMax; nIndex++)
01679            {
01680             if (::GetSubMenu(hParentMenu, nIndex) == pPopupMenu->m_hMenu)
01681             {
01682                 // When popup is found, m_pParentMenu is containing menu.
01683                 state.m_pParentMenu = CMenu::FromHandle(hParentMenu);
01684                 break;
01685             }
01686            }
01687         }
01688     }
01689
01690     state.m_nIndexMax = pPopupMenu->GetMenuItemCount();
01691     for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
01692       state.m_nIndex++)
01693     {
01694         state.m_nID = pPopupMenu->GetMenuItemID(state.m_nIndex);
01695         if (state.m_nID == 0)
01696            continue; // Menu separator or invalid cmd - ignore it.
01697
01698         ASSERT(state.m_pOther == NULL);
01699         ASSERT(state.m_pMenu != NULL);
01700         if (state.m_nID == (UINT)-1)
01701         {
01702            // Possibly a popup menu, route to first item of that popup.
01703            state.m_pSubMenu = pPopupMenu->GetSubMenu(state.m_nIndex);
01704            if (state.m_pSubMenu == NULL ||
01705             (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
01706             state.m_nID == (UINT)-1)
01707            {
01708             continue;       // First item of popup can't be routed to.
01709            }
01710            state.DoUpdate(this, TRUE);   // Popups are never auto disabled.
01711         }
01712         else
01713         {
01714            // Normal menu item.
01715            // Auto enable/disable if frame window has m_bAutoMenuEnable
01716            // set and command is _not_ a system command.
01717            state.m_pSubMenu = NULL;
01718            state.DoUpdate(this, FALSE);
01719         }
01720
01721         // Adjust for menu deletions and additions.
01722         UINT nCount = pPopupMenu->GetMenuItemCount();
01723         if (nCount < state.m_nIndexMax)
01724         {
01725             state.m_nIndex -= (state.m_nIndexMax - nCount);
01726             while (state.m_nIndex < nCount &&
01727                 pPopupMenu->GetMenuItemID(state.m_nIndex) == state.m_nID)
01728             {
01729                 state.m_nIndex++;
01730             }
01731         }
01732         state.m_nIndexMax = nCount;
01733       }
01734
01735 }
01736
01737 void CGraphView::OnUpdateQueryAnnotate(CCmdUI* pCmdUI)
01738 {
01739     BOOL enabled = FALSE;
01740     if(!DisableCommon())
01741     {
01742         enabled = IsSelSingleNode(kNodeHeader, false);
01743     }
01744     pCmdUI->Enable(enabled);
01745 }
01746
01747 void CGraphView::OnQueryAnnotate()
01748 {
01749     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01750     CLogNode *root = pDoc->GetNode();
01751     if(root == 0L || root->GetUserData() == 0L)
01752         return;
01753
01754     TGraphCmdStatus trav;
01755     trav.TraverseGraph(root);
01756
01757     if(gCvsPrefs.ExtDiff() != 0L)
01758     {
01759         CStr file, prf, ext, base;
01760         CvsArgs args;
01761
01762         GetExtension(pDoc->GetName(), base, ext);
01763
01764         prf = base;
01765         prf << "_ann_";
01766         prf << trav.fSel1->GetStr();
01767         prf << '_';
01768         args.add("annotate");
01769         args.add("-r");
01770         args.add(trav.fSel1->GetStr());
01771         args.add(pDoc->GetName());
01772         args.print(pDoc->GetDir());
01773         file = launchCVS(pDoc->GetDir(), args, (const char *)prf, ext);
01774
01775         if(file.empty())
01776             return;
01777
01778         LaunchViewer(file);
01779     }
01780 }
01781
01782 void CGraphView::OnGraphGraphoptions()
01783 {
01784     if( CompatGetGraphOptions(gGraphSelColor, gGraphShadowColor,
01785         gGraphHeaderColor, gGraphTagColor, gGraphBranchColor,
01786         gGraphNodeColor, gGraphDeadNodeColor, gGraphUserStateNodeColor) )
01787     {
01788         // add any additional processing here
01789     }
01790
01791     CWincvsApp* pApp = (CWincvsApp*)AfxGetApp();
01792     if( pApp )
01793     {
01794         pApp->UpdateAllDocsView();
01795     }
01796 }
01797
01798 void CGraphView::OnUpdateGraphChangelogmessage(CCmdUI* pCmdUI)
01799 {
01800     BOOL enabled = FALSE;
01801     if(!DisableCommon())
01802     {
01803         enabled = IsSelSingleNode(kNodeRev);
01804     }
01805     pCmdUI->Enable(enabled);
01806 }
01807
01808 void CGraphView::OnGraphChangelogmessage()
01809 {
01810     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01811     CLogNode *root = pDoc->GetNode();
01812     if(root == 0L || root->GetUserData() == 0L)
01813         return;
01814
01815     TGraphCmdStatus trav;
01816     trav.TraverseGraph(root);
01817
01818     CLogNode *node = trav.fSel1->Node();
01819     ASSERT(node->GetType() == kNodeRev);
01820     CRevFile& rev = **(CLogNodeRev *)node;
01821
01822     CPStr msg = (const char*)rev.DescLog();
01823
01824     if( CompatGetAdminOptions(kChangeLog, msg) )
01825     {
01826         CvsArgs args;
01827         args.add("admin");
01828         args.add(CStr("-m") + trav.fSel1->GetStr() + CStr(":") + cleanUpLogMsg(msg));
01829
01830         args.add(pDoc->GetName());
01831         args.print(pDoc->GetDir());
01832
01833         CGraphConsole cons;
01834         launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01835         OnViewReload();
01836     }
01837 }
01838
01839 void CGraphView::OnUpdateGraphSetdescription(CCmdUI* pCmdUI)
01840 {
01841     BOOL enabled = FALSE;
01842     if(!DisableCommon())
01843     {
01844         enabled = IsSelSingleNode(kNodeHeader);
01845     }
01846     pCmdUI->Enable(enabled);
01847 }
01848
01849 void CGraphView::OnGraphSetdescription()
01850 {
01851     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01852     CLogNode *root = pDoc->GetNode();
01853     if(root == 0L || root->GetUserData() == 0L)
01854         return;
01855
01856     TGraphCmdStatus trav;
01857     trav.TraverseGraph(root);
01858
01859     CLogNode *node = trav.fSel1->Node();
01860     ASSERT(node->GetType() == kNodeHeader);
01861     CRcsFile& rev = **(CLogNodeHeader *)node;
01862
01863     CPStr msg = (const char*)rev.DescLog();
01864
01865     if( CompatGetAdminOptions(kSetDescription, msg) )
01866     {
01867         CvsArgs args;
01868         args.add("admin");
01869         args.add(CStr("-t-") + cleanUpLogMsg(msg));
01870
01871         args.add(pDoc->GetName());
01872         args.print(pDoc->GetDir());
01873
01874         CGraphConsole cons;
01875         launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01876         OnViewReload();
01877     }
01878 }
01879
01880 void CGraphView::OnUpdateGraphSetstate(CCmdUI* pCmdUI)
01881 {
01882     BOOL enabled = FALSE;
01883     if(!DisableCommon())
01884     {
01885         enabled = IsSelSingleNode(kNodeRev);
01886     }
01887     pCmdUI->Enable(enabled);
01888 }
01889
01890 void CGraphView::OnGraphSetstate()
01891 {
01892     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01893     CLogNode *root = pDoc->GetNode();
01894     if(root == 0L || root->GetUserData() == 0L)
01895         return;
01896
01897     TGraphCmdStatus trav;
01898     trav.TraverseGraph(root);
01899
01900     CLogNode *node = trav.fSel1->Node();
01901     ASSERT(node->GetType() == kNodeRev);
01902     CRevFile& rev = **(CLogNodeRev *)node;
01903
01904     CPStr state = (const char*)rev.State();
01905
01906     if( strcmp("dead", (const char*)state ) == 0 &&
01907         CvsAlert("The revision state is: \"dead\". You should not alter it manually.\nAre you sure you want to continue?", "Cancel", "Continue") )
01908     {
01909         return;
01910     }
01911
01912     if( CompatGetAdminOptions(kSetState, state) )
01913     {
01914         CvsArgs args;
01915         args.add("admin");
01916         args.add("-s");
01917         args.add(cleanUpLogMsg(state) + CStr(":") + trav.fSel1->GetStr());
01918
01919         args.add(pDoc->GetName());
01920         args.print(pDoc->GetDir());
01921
01922         CGraphConsole cons;
01923         launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01924         OnViewReload();
01925     }
01926 }
01927
01928 void CGraphView::OnUpdateViewLockf(CCmdUI* pCmdUI)
01929 {
01930     BOOL enabled = FALSE;
01931     if(!DisableCommon())
01932     {
01933         enabled = IsSelSingleNode(kNodeRev);
01934     }
01935     pCmdUI->Enable(enabled);
01936 }
01937
01938 void CGraphView::OnViewLockf()
01939 {
01940     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01941     CLogNode *root = pDoc->GetNode();
01942     if(root == 0L || root->GetUserData() == 0L)
01943         return;
01944
01945     TGraphCmdStatus trav;
01946     trav.TraverseGraph(root);
01947
01948     CvsArgs args;
01949     args.add("admin");
01950     args.add(CStr("-l") + trav.fSel1->GetStr());
01951
01952     args.add(pDoc->GetName());
01953     args.print(pDoc->GetDir());
01954
01955     CGraphConsole cons;
01956     launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01957     OnViewReload();
01958 }
01959
01960 void CGraphView::OnUpdateViewUnlockf(CCmdUI* pCmdUI)
01961 {
01962     BOOL enabled = FALSE;
01963     if(!DisableCommon())
01964     {
01965         enabled = IsSelSingleNode(kNodeRev);
01966     }
01967     pCmdUI->Enable(enabled);
01968 }
01969
01970 void CGraphView::OnViewUnlockf()
01971 {
01972     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01973     CLogNode *root = pDoc->GetNode();
01974     if(root == 0L || root->GetUserData() == 0L)
01975         return;
01976
01977     TGraphCmdStatus trav;
01978     trav.TraverseGraph(root);
01979
01980     CvsArgs args;
01981     args.add("admin");
01982     args.add(CStr("-u") + trav.fSel1->GetStr());
01983
01984     args.add(pDoc->GetName());
01985     args.print(pDoc->GetDir());
01986
01987     CGraphConsole cons;
01988     launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01989     OnViewReload();
01990 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/GraphView.h Source File

WinCvs/GraphView.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 #if !defined(AFX_GRAPHVIEW_H__7A07C311_03F9_11D2_BCB2_000000000000__INCLUDED_)
00018 #define AFX_GRAPHVIEW_H__7A07C311_03F9_11D2_BCB2_000000000000__INCLUDED_
00019
00020 #if _MSC_VER >= 1000
00021 #pragma once
00022 #endif // _MSC_VER >= 1000
00023 // GraphView.h : header file
00024 //
00025
00026 #include "CvsLog.h"
00027
00028 #define STARTPOINT_PT       (CPoint(5, 5))
00029
00030 #define OCTANGLE_COUNT      8
00031 #define SHADOW_OFFSET_PT    (CPoint(4, 4))
00032 #define ROUND_RECT_PT       (CPoint(6, 6))
00033
00034 #define RGB_DEF_SEL             RGB(160, 160, 160)
00035 #define RGB_DEF_SHADOW          RGB(128, 128, 128)
00036 #define RGB_DEF_HEADER          RGB(255, 0, 0)
00037 #define RGB_DEF_TAG             RGB(0, 0, 0)
00038 #define RGB_DEF_BRANCH          RGB(0, 0, 255)
00039 #define RGB_DEF_NODE            RGB(0, 0, 255)
00040 #define RGB_DEF_DEADNODE        RGB(255, 0, 0)
00041 #define RGB_DEF_USERSTATENODE   RGB(0, 128, 64)
00042 #define STYLE_DEADNODE          PS_DOT
00043 #define STYLE_USERSTATENODE     PS_DASH
00044
00045 typedef enum
00046 {
00047     kRectangle,
00048     kRoundRect,
00049     kOctangle
00050 } kNodeShape;
00051
00053 // CGraphView view
00054
00055 class CGraphView : public CScrollView
00056 {
00057 protected:
00058     CGraphView();           // protected constructor used by dynamic creation
00059     DECLARE_DYNCREATE(CGraphView)
00060
00061 // Attributes
00062 public:
00063     void CalcImageSize(void);
00064         // calculate the size of the graph and set the scroll bars
00065
00066     static inline CImageList & GetImgList(void) { return m_ImageList; }
00067
00068     // Operations
00069 public:
00070
00071 // Overrides
00072     // ClassWizard generated virtual function overrides
00073     //{{AFX_VIRTUAL(CGraphView)
00074     protected:
00075     virtual void OnDraw(CDC* pDC);      // overridden to draw this view
00076     virtual void OnInitialUpdate();     // first time after construct
00077     virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
00078     virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
00079     virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
00080     virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
00081     //}}AFX_VIRTUAL
00082
00083 // Implementation
00084 protected:
00085
00086     bool fFirstTime;
00087     static CImageList m_ImageList;
00088
00089     int m_numberOfPages;
00090     int m_pageHeight;
00091         // for printing
00092
00093     bool DisableCommon();
00094     bool IsSelSingleNode(kLogNode type, bool equal = true);
00095
00096     virtual ~CGraphView();
00097 #ifdef _DEBUG
00098     virtual void AssertValid() const;
00099     virtual void Dump(CDumpContext& dc) const;
00100 #endif
00101     void OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu);
00102
00103     // Generated message map functions
00104     //{{AFX_MSG(CGraphView)
00105     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00106     afx_msg void OnViewReload();
00107     afx_msg void OnUpdateViewReload(CCmdUI* pCmdUI);
00108     afx_msg void OnViewDiff();
00109     afx_msg void OnUpdateViewDiff(CCmdUI* pCmdUI);
00110     afx_msg void OnViewUpdate();
00111     afx_msg void OnUpdateViewUpdate(CCmdUI* pCmdUI);
00112     afx_msg void OnViewTag();
00113     afx_msg void OnUpdateViewTag(CCmdUI* pCmdUI);
00114     afx_msg void OnViewDelrev();
00115     afx_msg void OnUpdateViewDelrev(CCmdUI* pCmdUI);
00116     afx_msg void OnViewSelnonsig();
00117     afx_msg void OnUpdateViewSelnonsig(CCmdUI* pCmdUI);
00118     afx_msg void OnViewRetrieve();
00119     afx_msg void OnUpdateViewRetrieve(CCmdUI* pCmdUI);
00120     afx_msg void DisableUpdate(CCmdUI* pCmdUI);
00121     afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
00122     afx_msg void OnQueryAnnotate();
00123     afx_msg void OnUpdateQueryAnnotate(CCmdUI* pCmdUI);
00124     afx_msg void OnGraphGraphoptions();
00125     afx_msg void OnUpdateGraphChangelogmessage(CCmdUI* pCmdUI);
00126     afx_msg void OnGraphChangelogmessage();
00127     afx_msg void OnUpdateGraphSetdescription(CCmdUI* pCmdUI);
00128     afx_msg void OnGraphSetdescription();
00129     afx_msg void OnGraphSetstate();
00130     afx_msg void OnUpdateGraphSetstate(CCmdUI* pCmdUI);
00131     afx_msg void OnUpdateViewLockf(CCmdUI* pCmdUI);
00132     afx_msg void OnViewLockf();
00133     afx_msg void OnUpdateViewUnlockf(CCmdUI* pCmdUI);
00134     afx_msg void OnViewUnlockf();
00135     //}}AFX_MSG
00136     DECLARE_MESSAGE_MAP()
00137 };
00138
00140
00141 //{{AFX_INSERT_LOCATION}}
00142 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00143
00144 #endif // !defined(AFX_GRAPHVIEW_H__7A07C311_03F9_11D2_BCB2_000000000000__INCLUDED_)
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/HistComboBoxEx.cpp Source File

WinCvs/HistComboBoxEx.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- July 2001
00019  */
00020
00021 // HistComboBoxEx.cpp : implementation file
00022 //
00023
00024 #include "stdafx.h"
00025 #include "wincvs.h"
00026 #include "HistComboBoxEx.h"
00027 #include "FileTraversal.h"
00028 #include "CvsEntries.h"
00029
00030 #include "MainFrm.h"
00031 #include "CvsAlert.h"
00032
00033 #ifdef _DEBUG
00034 #define new DEBUG_NEW
00035 #undef THIS_FILE
00036 static char THIS_FILE[] = __FILE__;
00037 #endif
00038
00039 static PCPStr gOldLoc("P_BrowserLoc", "C:\\");
00040 static CMString gHistoryLocs(100, "P_BrowserLocs");
00041
00042 int TraverseHistory(CHistComboBoxEx& browseHist)
00043 {
00044     char szPath[MAX_PATH] = "";
00045     for( int nIndex = 0; nIndex < browseHist.GetCount(); nIndex++ )
00046     {
00047         COMBOBOXEXITEM cbi;
00048         cbi.mask = CBEIF_TEXT;
00049         cbi.iItem = nIndex;
00050         cbi.pszText = szPath;
00051         cbi.cchTextMax = MAX_PATH;
00052
00053         browseHist.GetItem(&cbi);
00054         browseHist.SetIcon(cbi);
00055     }
00056
00057     return nIndex;
00058 }
00059
00061 // CHistComboBoxEx
00062
00063 CHistComboBoxEx::CHistComboBoxEx()
00064 {
00065 }
00066
00067 CHistComboBoxEx::~CHistComboBoxEx()
00068 {
00069 }
00070
00071
00072 BEGIN_MESSAGE_MAP(CHistComboBoxEx, CComboBoxEx)
00073     //{{AFX_MSG_MAP(CHistComboBoxEx)
00074     ON_CONTROL_REFLECT(CBN_DROPDOWN, OnDropdown)
00075     //}}AFX_MSG_MAP
00076 END_MESSAGE_MAP()
00077
00079 // CHistComboBoxEx message handlers
00080
00081 const char* CHistComboBoxEx::GetOldLoc()
00082 {
00083     return gOldLoc;
00084 }
00085
00086 int CHistComboBoxEx::NewRoot(const char* root)
00087 {
00088     if(stricmp(gOldLoc, root) != 0)
00089         gOldLoc = root;
00090
00091     // update the history combo
00092     gHistoryLocs.Insert(root);
00093     ResetContent();
00094     const std::vector<CStr> & list = gHistoryLocs.GetList();
00095     std::vector<CStr>::const_iterator i;
00096     for(i = list.begin(); i != list.end(); ++i)
00097     {
00098         InsertString(-1, *i);
00099     }
00100     SetCurSel(0);
00101     TRACE("Browse History has %d items\n", GetCount());
00102
00103     return GetCount();
00104 }
00105
00106 int CHistComboBoxEx::InsertString(int nIndex, LPCTSTR lpszString)
00107 {
00108     int nRes = -1;
00109
00110     COMBOBOXEXITEM cbi;
00111     cbi.mask = CBEIF_TEXT;
00112     cbi.iItem = 0 > nIndex ? GetCount() : nIndex;
00113     cbi.pszText = (LPTSTR)lpszString;       //this cast is safe because we are Inserting item
00114     cbi.cchTextMax = 0;
00115
00116     nRes = InsertItem(&cbi);
00117     SetIcon(cbi);
00118
00119     return nRes;
00120 }
00121
00122 int CHistComboBoxEx::AddString(LPCTSTR lpszString)
00123 {
00124     return InsertString(-1, lpszString);
00125 }
00126
00127 BOOL CHistComboBoxEx::SetIcon(COMBOBOXEXITEM cbi)
00128 {
00129     //initialize the image list if neccessary
00130     if( m_ImageList.m_hImageList == 0L )
00131     {
00132         m_ImageList.Create(IDB_HISTLOC, HISTLOC_IMAGE_CX, 1, RGB(255, 255, 255));
00133         SetImageList(&m_ImageList);
00134     }
00135
00136     cbi.mask = CBEIF_IMAGE | /*CBEIF_OVERLAY |*/ CBEIF_SELECTEDIMAGE;
00137     cbi.iImage = cbi.iSelectedImage = kLocationIconUnknown;
00138     //cbi.iOverlay = ;
00139
00140     CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00141     vector<CStr> ignlist;
00142     struct stat sb;
00143     const char *fullpath = cbi.pszText;
00144
00145     int statres = stat(fullpath, &sb);
00146     if( statres != -1 )
00147     {
00148         if( S_ISDIR(sb.st_mode) )
00149         {
00150             CStr uppath, folder;
00151             if( !SplitPath(fullpath, uppath, folder) || uppath.empty() )
00152             {
00153                 uppath = fullpath;
00154                 folder = ".";
00155             }
00156
00157             BuildIgnoredList(ignlist, uppath);
00158
00159             EntnodeData *data = Entries_SetVisited(uppath, entries, folder, sb, true, &ignlist);
00160             if( !data->IsUnknown() )
00161             {
00162                 cbi.iImage = cbi.iSelectedImage = kLocationIcon;
00163             }
00164             if( data->IsIgnored() )
00165             {
00166                 cbi.iImage = cbi.iSelectedImage = kLocationIconIgnored;
00167             }
00168             if( data->IsMissing() )
00169             {
00170                 cbi.iImage = cbi.iSelectedImage = kLocationIconMissing;
00171             }
00172         }
00173     }
00174     else
00175     {
00176         cbi.iImage = cbi.iSelectedImage = kLocationIconErased;
00177     }
00178
00179     return SetItem(&cbi);
00180 }
00181
00182 BOOL CHistComboBoxEx::PreTranslateMessage(MSG* pMsg)
00183 {
00184     if( pMsg->message == WM_KEYDOWN )
00185     {
00186         int nVirtKey = (int)pMsg->wParam;
00187         if( VK_DELETE == nVirtKey )
00188         {
00189             if( GetDroppedState() )
00190             {
00191                 int sel = GetCurSel();
00192                 if( CB_ERR < sel && GetCount() > 1 )
00193                 {
00194                     CString strItem;
00195                     GetLBText(sel, strItem);
00196                     CString strMessage = "Do you want to remove that item from the list?\nLocation";
00197                     strMessage += (0 == sel ? "(Current)" : "");
00198                     strMessage += ": " + strItem;
00199                     if( AfxMessageBox(strMessage, MB_YESNO | MB_ICONQUESTION) == IDYES )
00200                     {
00201                         if( gHistoryLocs.Remove(strItem) )
00202                         {
00203                             DeleteItem(sel);
00204                             if( GetCount() )
00205                             {
00206                                 int nNewSel = (0 == sel ? sel : (GetCount() ? 0 : -1));
00207                                 if( 0 != nNewSel || 0 == sel )
00208                                 {
00209                                     SetCurSel(nNewSel);
00210
00211                                     //trigger the location change for all views
00212                                     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00213                                     CMainFrame* mainFrm = app->GetMainFrame();
00214                                     mainFrm->ChangeLocation();
00215                                 }
00216                             }
00217                         }
00218                     }
00219                 }
00220                 else if( GetCount() == 1 )
00221                 {
00222                     AfxMessageBox("Can't remove the last item from the history.\n"
00223                         "Add a new location first to remove the current one.", MB_OK | MB_ICONSTOP);
00224                 }
00225
00226                 //we have to stop it going to another window
00227                 return TRUE;
00228             }
00229         }
00230     }
00231
00232     return CComboBoxEx::PreTranslateMessage(pMsg);
00233 }
00234
00235 void CHistComboBoxEx::OnDropdown()
00236 {
00237     TraverseHistory(*this);
00238
00239     CClientDC ClientDC(this);
00240     int savedDc = ClientDC.SaveDC();
00241     ClientDC.SelectObject(GetFont());
00242
00243     CString strLBText;
00244     int maxSize = 0;
00245     for( int nIndex = 0; nIndex < GetCount(); nIndex++ )
00246     {
00247         GetLBText( nIndex, strLBText );
00248         CSize size = ClientDC.GetTextExtent(strLBText);
00249
00250         if( size.cx > maxSize )
00251         {
00252             maxSize = size.cx;
00253         }
00254     }
00255     ClientDC.RestoreDC(savedDc);
00256
00257     maxSize += ::GetSystemMetrics(SM_CXVSCROLL)     //vertical scroll bar
00258         + 4*::GetSystemMetrics(SM_CXEDGE)           //the border aroung the text and icon: Edge-Icon-Edge - Edge-Text-Edge
00259         + HISTLOC_IMAGE_CX                          //the icon width
00260         + 2;                                        //the focus frame width
00261
00262     CRect rect;
00263     GetWindowRect(rect);
00264     maxSize = min(ClientDC.GetDeviceCaps(HORZRES) - rect.TopLeft().x, maxSize);
00265
00266     SetDroppedWidth(maxSize);
00267 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/HistComboBoxEx.h Source File

WinCvs/HistComboBoxEx.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- July 2001
00019  */
00020
00021 #if !defined(AFX_HISTCOMBOBOXEX_H__E330E7B9_8C79_44CB_8F07_01D395975365__INCLUDED_)
00022 #define AFX_HISTCOMBOBOXEX_H__E330E7B9_8C79_44CB_8F07_01D395975365__INCLUDED_
00023
00024 #if _MSC_VER > 1000
00025 #pragma once
00026 #endif // _MSC_VER > 1000
00027 // HistComboBoxEx.h : header file
00028 //
00029
00030 #define HISTLOC_IMAGE_CX        16
00031 #define HISTLOC_VISIBLEITEMS    8
00032
00033 enum
00034 {
00035     kLocationIconUnknown = 0,
00036     kLocationIcon,
00037     kLocationIconIgnored,
00038     kLocationIconMissing,
00039     kLocationIconErased
00040 };
00041
00043 // CHistComboBoxEx window
00044
00045 class CHistComboBoxEx : public CComboBoxEx
00046 {
00047 // Construction
00048 public:
00049     CHistComboBoxEx();
00050
00051 // Attributes
00052 public:
00053
00054 // Operations
00055 public:
00056
00057 // Overrides
00058     // ClassWizard generated virtual function overrides
00059     //{{AFX_VIRTUAL(CHistComboBoxEx)
00060     public:
00061     virtual BOOL PreTranslateMessage(MSG* pMsg);
00062     //}}AFX_VIRTUAL
00063
00064 // Implementation
00065 public:
00066     virtual ~CHistComboBoxEx();
00067
00068     // Generated message map functions
00069 protected:
00070     //{{AFX_MSG(CHistComboBoxEx)
00071     afx_msg void OnDropdown();
00072     //}}AFX_MSG
00073
00074     DECLARE_MESSAGE_MAP()
00075 private:
00076     CImageList m_ImageList;
00077
00078 public:
00079     int AddString(LPCTSTR lpszString);
00080     int InsertString(int nIndex, LPCTSTR lpszString);
00081     BOOL SetIcon(COMBOBOXEXITEM cbi);
00082
00083     const char* GetOldLoc();
00084     int NewRoot(const char* root);
00085 };
00086
00088
00089 //{{AFX_INSERT_LOCATION}}
00090 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00091
00092 #endif // !defined(AFX_HISTCOMBOBOXEX_H__E330E7B9_8C79_44CB_8F07_01D395975365__INCLUDED_)
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/LogFrm.cpp Source File

WinCvs/LogFrm.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // ChildFrm.cpp : implementation of the CLogFrame class
00022 //
00023
00024 #include "stdafx.h"
00025 #include "wincvs.h"
00026
00027 #include "LogFrm.h"
00028 #include "WinCvsBrowser.h"
00029 #include "BrowseFileView.h"
00030 #include "WincvsView.h"
00031 #include "MainFrm.h"
00032
00033 #include "wincvs_winutil.h"
00034
00035 #ifdef _DEBUG
00036 #define new DEBUG_NEW
00037 #undef THIS_FILE
00038 static char THIS_FILE[] = __FILE__;
00039 #endif
00040
00042 // inline function(s)
00043
00044 inline BOOL IsKeyMovingFocus(MSG* pMsg)
00045 {
00046      return ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_TAB) &&
00047          (!(0x8000 & GetKeyState(VK_CONTROL)))
00048          );
00049 }
00050
00052 // CLogFrame
00053
00054 IMPLEMENT_DYNCREATE(CLogFrame, CCJMDIChildWnd)
00055
00056 BEGIN_MESSAGE_MAP(CLogFrame, CCJMDIChildWnd)
00057     //{{AFX_MSG_MAP(CLogFrame)
00058     ON_WM_CLOSE()
00059     ON_WM_DESTROY()
00060     //}}AFX_MSG_MAP
00061 END_MESSAGE_MAP()
00062
00064 // CLogFrame construction/destruction
00065
00066 CLogFrame::CLogFrame()
00067 {
00068     // TODO: add member initialization code here
00069
00070 }
00071
00072 CLogFrame::~CLogFrame()
00073 {
00074 }
00075
00076 BOOL CLogFrame::OnCreateClient(LPCREATESTRUCT lpcs,
00077      CCreateContext* pContext)
00078 {
00079     BOOL res = CCJMDIChildWnd::OnCreateClient(lpcs, pContext);
00080     MDIMaximize();
00081
00082     return res;
00083 }
00084
00086 // CLogFrame diagnostics
00087
00088 #ifdef _DEBUG
00089 void CLogFrame::AssertValid() const
00090 {
00091     CCJMDIChildWnd::AssertValid();
00092 }
00093
00094 void CLogFrame::Dump(CDumpContext& dc) const
00095 {
00096     CCJMDIChildWnd::Dump(dc);
00097 }
00098
00099 #endif //_DEBUG
00100
00102 // CLogFrame message handlers
00103
00104 void CLogFrame::OnClose()
00105 {
00106     // prevent from closing the main frame
00107     //CCJMDIChildWnd::OnClose();
00108 }
00109
00110 BOOL CLogFrame::PreTranslateMessage(MSG* pMsg)
00111 {
00112 /*  if (IsKeyMovingFocus(pMsg))
00113     {
00114         CWnd* pWnd;
00115         if (0x8000 & GetKeyState(VK_SHIFT))
00116             pWnd = FindPrevWindow(GetFocus());
00117         else
00118             pWnd = FindNextWindow(GetFocus());
00119         if(pWnd)
00120         {
00121             LRESULT DlgCode = ::SendMessage(pMsg->hwnd, WM_GETDLGCODE, 0, 0);
00122             if (!(DlgCode & (DLGC_WANTTAB | DLGC_WANTALLKEYS)))
00123             {
00124                 if (pWnd->IsKindOf(RUNTIME_CLASS(CView)))
00125                     SetActiveView((CView*)pWnd, TRUE);
00126                 else
00127                     pWnd->SetFocus();
00128             }
00129         }
00130         return TRUE;
00131     }*/
00132
00133     return CCJMDIChildWnd::PreTranslateMessage(pMsg);
00134 }
00135
00136 BOOL CLogFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
00137 {
00138     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00139     if(app->GetMainFrame()->OnBroadcastCmdMsg(nID, nCode, pExtra, pHandlerInfo))
00140         return TRUE;
00141
00142     return CCJMDIChildWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
00143 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/LogFrm.h Source File

WinCvs/LogFrm.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // ChildFrm.h : interface of the CLogFrame class
00022 //
00024
00025 #if !defined(AFX_CHILDFRM_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_)
00026 #define AFX_CHILDFRM_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 class CLogFrame : public CCJMDIChildWnd
00033 {
00034     DECLARE_DYNCREATE(CLogFrame)
00035 public:
00036     CLogFrame();
00037
00038 // Attributes
00039 public:
00040
00041 // Operations
00042 public:
00043
00044 // Overrides
00045     // ClassWizard generated virtual function overrides
00046     //{{AFX_VIRTUAL(CLogFrame)
00047     public:
00048     virtual BOOL PreTranslateMessage(MSG* pMsg);
00049     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
00050     //}}AFX_VIRTUAL
00051
00052 // Implementation
00053 public:
00054     virtual ~CLogFrame();
00055     virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
00056
00057 #ifdef _DEBUG
00058     virtual void AssertValid() const;
00059     virtual void Dump(CDumpContext& dc) const;
00060 #endif
00061
00062 // Generated message map functions
00063 protected:
00064
00065     //{{AFX_MSG(CLogFrame)
00066     afx_msg void OnClose();
00067     //}}AFX_MSG
00068     DECLARE_MESSAGE_MAP()
00069 };
00070
00072
00073 //{{AFX_INSERT_LOCATION}}
00074 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00075
00076 #endif // !defined(AFX_CHILDFRM_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_)
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/MainFrm.cpp Source File

WinCvs/MainFrm.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  *
00020  * Sep. 21, 00 - added option to compile this file without 'explore' view,
00021  *               define NOEXPLOREVIEW
00022  */
00023
00024 // MainFrm.cpp : implementation of the CMainFrame class
00025 //
00026
00027 #include "stdafx.h"
00028 #include <afxmt.h>
00029 //#include <../src/afximpl.h>
00030 #include "wincvs.h"
00031
00032 #include "MainFrm.h"
00033 #include "WinCvsBrowser.h"
00034 #include "BrowseFileView.h"
00035 #include "WincvsView.h"
00036 #include "Persistent.h"
00037 #include "AppConsole.h"
00038 #include "Splash.h"
00039 #include "BrowserBar.h"
00040 #include "ExploreBar.h"
00041 #include "CvsPrefs.h"
00042 #include "AppGlue.h"
00043
00044 #ifdef _DEBUG
00045 #define new DEBUG_NEW
00046 #undef THIS_FILE
00047 static char THIS_FILE[] = __FILE__;
00048 #endif
00049
00050 static bool IsAppEnabled()
00051 {
00052     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00053     return !app->gCvsRunning && !gCvsPrefs.empty();
00054 }
00055
00056 class CWinPlacement : public CPersistent
00057 {
00058 public:
00059     WINDOWPLACEMENT placement;
00060     bool hasOne;
00061
00062     CWinPlacement(const char *uniqueName) : CPersistent(uniqueName, kNoClass)
00063     {
00064         hasOne = false;
00065     }
00066     virtual ~CWinPlacement()
00067     {
00068     }
00069
00070     virtual unsigned int SizeOf(void) const
00071     {
00072         return hasOne ? sizeof(WINDOWPLACEMENT) : 0;
00073     }
00074
00075     virtual const void *GetData(void) const
00076     {
00077         return hasOne ? &placement : 0L;
00078     }
00079
00080     virtual void SetData(const void *ptr, unsigned int size)
00081     {
00082         if(size == sizeof(WINDOWPLACEMENT))
00083         {
00084             memcpy(&placement, ptr, sizeof(WINDOWPLACEMENT));
00085             hasOne = true;
00086         }
00087     }
00088
00089     CWinPlacement & operator=(const WINDOWPLACEMENT & newplace)
00090     {
00091         TouchTimeStamp();
00092         memcpy(&placement, &newplace, sizeof(WINDOWPLACEMENT));
00093         hasOne = true;
00094         return *this;
00095     }
00096 };
00097
00098 static CWinPlacement gMainPlacement("P_MainPlacement");
00099
00101 // CMainFrame
00102
00103 IMPLEMENT_DYNAMIC(CMainFrame, CCJMDIFrameWnd)
00104
00105 BEGIN_MESSAGE_MAP(CMainFrame, CCJMDIFrameWnd)
00106     ON_WM_INITMENU()
00107     //{{AFX_MSG_MAP(CMainFrame)
00108     ON_WM_CREATE()
00109     ON_WM_CLOSE()
00110     ON_WM_DROPFILES()
00111     ON_CBN_SELCHANGE(ID_HISTORYBROWSE, OnHistorySelect)
00112     ON_WM_ACTIVATE()
00113     ON_WM_SYSCOMMAND()
00114     ON_COMMAND(ID_VIEW_RECURSIVE, OnViewRecursive)
00115     ON_COMMAND(ID_VIEW_MODIFIED, OnViewModified)
00116     ON_UPDATE_COMMAND_UI(ID_VIEW_MODIFIED, OnUpdateViewModified)
00117     ON_UPDATE_COMMAND_UI(ID_VIEW_RECURSIVE, OnUpdateViewRecursive)
00118     ON_COMMAND(ID_VIEW_CONFLICT, OnViewConflict)
00119     ON_UPDATE_COMMAND_UI(ID_VIEW_CONFLICT, OnUpdateViewConflict)
00120     ON_COMMAND(ID_VIEW_UNKNOWN, OnViewUnknown)
00121     ON_UPDATE_COMMAND_UI(ID_VIEW_UNKNOWN, OnUpdateViewUnknown)
00122     ON_COMMAND(ID_VIEW_MISSING, OnViewMissing)
00123     ON_UPDATE_COMMAND_UI(ID_VIEW_MISSING, OnUpdateViewMissing)
00124     ON_COMMAND(ID_VIEW_IGNORE, OnViewIgnore)
00125     ON_UPDATE_COMMAND_UI(ID_VIEW_IGNORE, OnUpdateViewIgnore)
00126     ON_UPDATE_COMMAND_UI(ID_FILTERMASK, OnUpdateFilterMask)
00127     ON_UPDATE_COMMAND_UI(ID_HISTORYBROWSE, OnUpdateHistory)
00128     ON_COMMAND(ID_VIEW_ADDED, OnViewAdded)
00129     ON_UPDATE_COMMAND_UI(ID_VIEW_ADDED, OnUpdateViewAdded)
00130     ON_UPDATE_COMMAND_UI(ID_VIEW_REMOVED, OnUpdateViewRemoved)
00131     ON_COMMAND(ID_VIEW_REMOVED, OnViewRemoved)
00132     ON_COMMAND(ID_VIEW_CHANGED, OnViewChanged)
00133     ON_UPDATE_COMMAND_UI(ID_VIEW_CHANGED, OnUpdateViewChanged)
00134     ON_COMMAND(ID_VIEW_HIDEUNKNOWN, OnViewHideunknown)
00135     ON_UPDATE_COMMAND_UI(ID_VIEW_HIDEUNKNOWN, OnUpdateViewHideunknown)
00136     ON_WM_TIMER()
00137     //}}AFX_MSG_MAP
00138     ON_COMMAND_EX(ID_VIEW_BROWSER_BAR, CCJMDIFrameWnd::OnBarCheck)
00139     ON_COMMAND_EX(ID_VIEW_FILES_BAR, CCJMDIFrameWnd::OnBarCheck)
00140     ON_COMMAND_EX(ID_VIEW_FILTER_BAR, CCJMDIFrameWnd::OnBarCheck)
00141     ON_COMMAND_EX(ID_VIEW_MULTI_BAR, CCJMDIFrameWnd::OnBarCheck)
00142     ON_COMMAND_EX(ID_VIEW_TAGS_BAR, CCJMDIFrameWnd::OnBarCheck)
00143     ON_COMMAND_EX(ID_VIEW_CONSOLE_BAR, CCJMDIFrameWnd::OnBarCheck)
00144     ON_COMMAND_EX(ID_VIEW_WORKSPACE, CCJMDIFrameWnd::OnBarCheck)
00145     ON_UPDATE_COMMAND_UI(ID_VIEW_BROWSER_BAR, CCJMDIFrameWnd::OnUpdateControlBarMenu)
00146     ON_UPDATE_COMMAND_UI(ID_VIEW_FILES_BAR, CCJMDIFrameWnd::OnUpdateControlBarMenu)
00147     ON_UPDATE_COMMAND_UI(ID_VIEW_FILTER_BAR, CCJMDIFrameWnd::OnUpdateControlBarMenu)
00148     ON_UPDATE_COMMAND_UI(ID_VIEW_MULTI_BAR, CCJMDIFrameWnd::OnUpdateControlBarMenu)
00149     ON_UPDATE_COMMAND_UI(ID_VIEW_TAGS_BAR, CCJMDIFrameWnd::OnUpdateControlBarMenu)
00150     ON_UPDATE_COMMAND_UI(ID_VIEW_CONSOLE_BAR, CCJMDIFrameWnd::OnUpdateControlBarMenu)
00151     ON_UPDATE_COMMAND_UI(ID_VIEW_WORKSPACE, CCJMDIFrameWnd::OnUpdateControlBarMenu)
00152     // Global help commands
00153     ON_COMMAND(ID_HELP_FINDER, CCJMDIFrameWnd::OnHelpFinder)
00154     ON_COMMAND(ID_HELP, CCJMDIFrameWnd::OnHelp)
00155     ON_COMMAND(ID_CONTEXT_HELP, CCJMDIFrameWnd::OnContextHelp)
00156     ON_COMMAND(ID_DEFAULT_HELP, CCJMDIFrameWnd::OnHelpFinder)
00157 END_MESSAGE_MAP()
00158
00159 static UINT indicators[] =
00160 {
00161     ID_SEPARATOR,           // status line indicator
00162     ID_SEPARATOR,           // rotating icon
00163     ID_INDICATOR_CAPS,
00164     ID_INDICATOR_NUM,
00165     ID_INDICATOR_SCRL,
00166 };
00167
00169 // CMainFrame construction/destruction
00170
00171 CMainFrame::CMainFrame()
00172 {
00173     m_bRestoreFocus = FALSE;
00174 }
00175
00176 CMainFrame::~CMainFrame()
00177 {
00178 }
00179
00180 BOOL CMainFrame::InitializeDockingWindows()
00181 {
00182     // Initial size when docked: top, bottom, left, right.
00183     // ??? SetInitialSize(125,225,225,225);
00184
00185     if (!m_wndWorkspace.Create(this, ID_VIEW_WORKSPACE,
00186         _T("Workspace"), CSize(200,100), CBRS_LEFT))
00187     {
00188         TRACE0("Failed to create dialog bar (Workspace)\n");
00189         return -1;      // fail to create
00190     }
00191
00192     m_wndWorkspace.AddView(_T("Modules"), RUNTIME_CLASS(CBrowserBar));
00193 #ifndef NOEXPLOREVIEW
00194     m_wndWorkspace.AddView(_T("Explore"), RUNTIME_CLASS(CExploreBar));
00195 #endif
00196     m_wndWorkspace.SetActiveView(0);
00197     // Define the image list to use with the tab control
00198     m_TabImages.Create (IDR_WORKSPACE, 16, 1, RGB(255,255,255));
00199     m_wndWorkspace.SetTabImageList(&m_TabImages);
00200     //m_wndWorkspace.SetMenuID(IDR_POPUP);
00201     m_wndWorkspace.EnableDockingOnSizeBar(CBRS_ALIGN_ANY);
00202
00203     if (!m_consolebar.Create(this, ID_VIEW_CONSOLE_BAR,
00204         _T("Output"), CSize(300,100), CBRS_BOTTOM))
00205     {
00206         TRACE0("Failed to create dialog bar (Output)\n");
00207         return FALSE;       // fail to create
00208     }
00209
00210     //m_consolebar.SetMenuID(IDR_POPUP);
00211     m_consolebar.EnableDockingOnSizeBar(CBRS_ALIGN_ANY);
00212
00213     EnableDockingSizeBar(CBRS_ALIGN_ANY);
00214     DockSizeBar(&m_wndWorkspace);
00215     DockSizeBar(&m_consolebar);
00216
00217     return TRUE;
00218 }
00219
00220 static void onFilterMaskEntered(CObject *obj)
00221 {
00222     ((CMainFrame *)obj)->OnFilterMaskEntered();
00223 }
00224
00225 int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
00226 {
00227     if (CCJMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
00228         return -1;
00229
00230     if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00231         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
00232         !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
00233     {
00234         TRACE0("Failed to create toolbar (Standard)\n");
00235         return -1;      // fail to create
00236     }
00237
00238     if (!m_wndBrowser.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00239         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0), ID_VIEW_BROWSER_BAR) ||
00240         !m_wndBrowser.LoadToolBar(IDR_BROWSER))
00241     {
00242         TRACE0("Failed to create toolbar (Browse)\n");
00243         return -1;      // fail to create
00244     }
00245
00246     m_wndBrowser.SetButtonInfo(3, ID_SEPARATOR, TBBS_SEPARATOR, 200);
00247     CRect rect;
00248     m_wndBrowser.GetItemRect(3, &rect);
00249     rect.bottom += HISTLOC_VISIBLEITEMS * HISTLOC_IMAGE_CX + rect.bottom % HISTLOC_IMAGE_CX;
00250
00251     if (!m_browseHist.Create(CBS_DROPDOWNLIST|WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|WS_HSCROLL,
00252             rect, &m_wndBrowser, ID_HISTORYBROWSE))
00253     {
00254         TRACE0("Failed to create combobox (Browse History)\n");
00255         return -1;      // fail to create
00256     }
00257
00258     // Older versions of Windows* (NT 3.51 for instance) fail with DEFAULT_GUI_FONT
00259     if (!m_fontNormal.CreateStockObject(DEFAULT_GUI_FONT))
00260     {
00261         if (!m_fontNormal.CreatePointFont(80, "MS Sans Serif"))
00262         {
00263             TRACE0("Failed to create default GUI font\n");
00264             return -1;
00265         }
00266     }
00267
00268     // Make browse history use default GUI font
00269     m_browseHist.SetFont(&m_fontNormal);
00270
00271     if (!m_wndList.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00272         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0), ID_VIEW_FILES_BAR) ||
00273         !m_wndList.LoadToolBar(IDR_FILELIST))
00274     {
00275         TRACE0("Failed to create toolbar (Files)\n");
00276         return -1;      // fail to create
00277     }
00278
00279     if (!m_wndFilter.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00280         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0), ID_VIEW_FILTER_BAR) ||
00281         !m_wndFilter.LoadToolBar(IDR_FILTER))
00282     {
00283         TRACE0("Failed to create toolbar (Filter)\n");
00284         return -1;      // fail to create
00285     }
00286
00287     if (!m_wndMultiUser.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00288         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0), ID_VIEW_MULTI_BAR) ||
00289         !m_wndMultiUser.LoadToolBar(IDR_MULTIUSER))
00290     {
00291         TRACE0("Failed to create toolbar (Multi-User)\n");
00292         return -1;      // fail to create
00293     }
00294
00295     if (!m_wndTags.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00296         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0), ID_VIEW_TAGS_BAR) ||
00297         !m_wndTags.LoadToolBar(IDR_TAGS))
00298     {
00299         TRACE0("Failed to create toolbar (Tags)\n");
00300         return -1;      // fail to create
00301     }
00302
00303     if (!m_wndStatusBar.Create(this) ||
00304         !m_wndStatusBar.SetIndicators(indicators,
00305           sizeof(indicators)/sizeof(UINT)))
00306     {
00307         TRACE0("Failed to create status bar\n");
00308         return -1;      // fail to create
00309     }
00310
00311     // rotating icon
00312     UINT nID, nStyle;
00313     int cxWidth;
00314     m_wndStatusBar.GetPaneInfo( 1, nID, nStyle, cxWidth);
00315     m_wndStatusBar.SetPaneInfo( 1, nID, nStyle|SBPS_OWNERDRAW, 100);
00316
00317     EnableDocking(CBRS_ALIGN_ANY);
00318
00319     // Set toolbar title (visible when toolbar is floating)
00320     // Adjust toolbar height (default of 26 pixels is a little bit too small)
00321     // Enable docking
00322     m_wndToolBar.SetWindowText("Standard");
00323     m_wndToolBar.SetHeight(28);
00324     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
00325         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00326     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
00327     DockControlBar(&m_wndToolBar,AFX_IDW_DOCKBAR_TOP);
00328
00329     m_wndBrowser.SetWindowText("Browse");
00330     m_wndBrowser.SetHeight(28);
00331     m_wndBrowser.SetBarStyle(m_wndBrowser.GetBarStyle() |
00332         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00333     m_wndBrowser.EnableDocking(CBRS_ALIGN_ANY);
00334     DockControlBarLeftOf(&m_wndBrowser,&m_wndToolBar);
00335
00336     m_wndList.SetWindowText("Files");
00337     m_wndList.SetHeight(28);
00338     m_wndList.SetBarStyle(m_wndList.GetBarStyle() |
00339         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00340     m_wndList.EnableDocking(CBRS_ALIGN_ANY);
00341     DockControlBarLeftOf(&m_wndList,&m_wndBrowser);
00342
00343     m_wndMultiUser.SetWindowText("Multi-Users");
00344     m_wndMultiUser.SetHeight(28);
00345     m_wndMultiUser.SetBarStyle(m_wndMultiUser.GetBarStyle() |
00346         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00347     m_wndMultiUser.EnableDocking(CBRS_ALIGN_ANY);
00348     DockControlBarLeftOf(&m_wndMultiUser,&m_wndList);
00349
00350     m_wndTags.SetWindowText("Tags");
00351     m_wndTags.SetHeight(28);
00352     m_wndTags.SetBarStyle(m_wndTags.GetBarStyle() |
00353         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00354     m_wndTags.EnableDocking(CBRS_ALIGN_ANY);
00355     DockControlBarLeftOf(&m_wndTags,&m_wndMultiUser);
00356
00357     m_wndFilter.SetWindowText("Filter");
00358     m_wndFilter.SetHeight(28);
00359     m_wndFilter.SetBarStyle(m_wndFilter.GetBarStyle() |
00360         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00361     m_wndFilter.EnableDocking(CBRS_ALIGN_ANY);
00362     DockControlBarLeftOf(&m_wndFilter,&m_wndTags);
00363
00364     m_wndFilter.SetButtonInfo(2, ID_SEPARATOR, TBBS_SEPARATOR, 200);
00365     m_wndFilter.GetItemRect(2, &rect);
00366     rect.bottom += 80;
00367
00368     if (!m_comboFilterMask.Create(CBS_DROPDOWN|WS_CHILD|WS_VISIBLE|WS_TABSTOP,
00369             rect, &m_wndFilter, ID_FILTERMASK))
00370     {
00371         TRACE0("Failed to create combobox (filter mask)\n");
00372         return -1;          // fail to create
00373     }
00374
00375     // Make browse history use default GUI font
00376     m_comboFilterMask.SetFont(&m_fontNormal);
00377     m_comboFilterMask.GetManager()->CheckIn(this, onFilterMaskEntered);
00378
00379
00380     if(!InitializeDockingWindows())
00381     {
00382         TRACE0("Failed to initialize docking windows\n");
00383         return -1;      // fail to create
00384     }
00385
00386 #if 1
00387     // load the dock state, but check the toolbar exists (MFC bug)
00388     CDockState state;
00389     state.LoadState(_T("Bar State"));
00390     for (int i = 0; i < state.m_arrBarInfo.GetSize(); i++)
00391     {
00392         CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
00393         ASSERT(pInfo != NULL);
00394         if (!pInfo->m_bFloating)
00395         {
00396             pInfo->m_pBar = GetControlBar(pInfo->m_nBarID);
00397             if(pInfo->m_pBar == NULL)
00398             {
00399                 delete (CControlBarInfo*)state.m_arrBarInfo[i];
00400                 state.m_arrBarInfo.RemoveAt(i);
00401                 i--;
00402             }
00403         }
00404     }
00405     SetDockState(state);
00406 #else
00407     LoadBarState(_T("Bar State"));
00408 #endif
00409     m_state.LoadWindowPos(this);
00410
00411     // CG: The following line was added by the Splash Screen component.
00412     CSplashWnd::ShowSplashScreen(this);
00413
00414     SetTimer(99, 200, 0L);
00415
00416     return 0;
00417 }
00418
00419 void CMainFrame::DockControlBarLeftOf(CToolBar* Bar,CToolBar* LeftOf)
00420 {
00421     CRect rect;
00422     DWORD dw;
00423     UINT n;
00424
00425     // get MFC to adjust the dimensions of all docked ToolBars
00426     // so that GetWindowRect will be accurate
00427     RecalcLayout();
00428     LeftOf->GetWindowRect(&rect);
00429     rect.OffsetRect(1,0);
00430     dw=LeftOf->GetBarStyle();
00431     n = 0;
00432     n = (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n;
00433     n = (dw&CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n;
00434     n = (dw&CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n;
00435     n = (dw&CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n;
00436
00437     // When we take the default parameters on rect, DockControlBar will dock
00438     // each Toolbar on a seperate line.  By calculating a rectangle, we in effect
00439     // are simulating a Toolbar being dragged to that location and docked.
00440     DockControlBar(Bar,n,&rect);
00441 }
00442
00443 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
00444 {
00445     // TODO: Modify the Window class or styles here by modifying
00446     //  the CREATESTRUCT cs
00447
00448     return CCJMDIFrameWnd::PreCreateWindow(cs);
00449 }
00450
00452 // CMainFrame diagnostics
00453
00454 #ifdef _DEBUG
00455 void CMainFrame::AssertValid() const
00456 {
00457     CCJMDIFrameWnd::AssertValid();
00458 }
00459
00460 void CMainFrame::Dump(CDumpContext& dc) const
00461 {
00462     CCJMDIFrameWnd::Dump(dc);
00463 }
00464
00465 #endif //_DEBUG
00466
00468 // CMainFrame message handlers
00469
00470 void CMainFrame::OnClose()
00471 {
00472     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00473     if(app->gCvsRunning)
00474     {
00475         AfxMessageBox("Cvs is currently running : stop cvs first before quitting", MB_OK | MB_ICONSTOP);
00476         return;
00477     }
00478
00479     // only way I found to notify the browser
00480     // and to prevent the memory leak support.
00481     app->GetBrowserView()->ResetBrowser(0L);
00482
00483     // Charybids Ltd's suggested fix:
00484     // Saving the window positions whilst iconic trashes the registry.
00485     if (!IsIconic())
00486     {
00487         m_state.SaveWindowPos(this);
00488         SaveBarState(_T("Bar State"));
00489
00490         WINDOWPLACEMENT wp;
00491         wp.length = sizeof wp;
00492         if (GetWindowPlacement(&wp)) {
00493             wp.flags &= WPF_RESTORETOMAXIMIZED;
00494             gMainPlacement = wp;
00495         }
00496     }
00497
00498     // write all the persistents to the .INI file
00499     gCvsPrefs.save();
00500
00501     CCJMDIFrameWnd::OnClose();
00502 }
00503
00504 void CMainFrame::OnDropFiles(HDROP hDropInfo)
00505 {
00506     SetActiveWindow();  // activate us first !
00507     UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
00508
00509     CWinApp* pApp = AfxGetApp();
00510     for (UINT iFile = 0; iFile < nFiles; iFile++)
00511     {
00512         TCHAR szFileName[_MAX_PATH];
00513         ::DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH);
00514
00515         if( iFile == 0 )
00516         {
00517             CColorConsole out;
00518             out << kBold << "Locating: " << kNormal << kUnderline << szFileName << kNormal <<  kNormal << kNL;
00519
00520             CWincvsApp* pApp = (CWincvsApp *)AfxGetApp();
00521             if( pApp )
00522             {
00523                 const TCHAR *p1, *p2 = szFileName;
00524
00525                 while( p2 )
00526                 {
00527                     p1 = ++p2;
00528                     p2 = strchr(p2, _T('\\'));
00529                 }
00530
00531                 CWinCvsBrowser* pBrowser = pApp->GetBrowserView();
00532                 if( pBrowser )
00533                 {
00534                     if( pBrowser->StepToLocation(szFileName, true) )
00535                     {
00536                         pApp->GetFileView()->ResetView(false, p1);
00537                     }
00538                 }
00539             }
00540         }
00541
00542         // replace \ by /
00543         TCHAR *tmp = szFileName;
00544         while( (tmp = strchr(tmp, '\\')) != 0L )
00545         {
00546             *tmp++ = '/';
00547         }
00548
00549         cvs_out("%s\n", szFileName);
00550
00551         //pApp->OpenDocumentFile(szFileName);
00552     }//end for
00553
00554     ::DragFinish(hDropInfo);
00555 }
00556
00557 void CMainFrame::OnInitMenu(CMenu* pMenu)
00558 {
00559     CCJMDIFrameWnd::OnInitMenu(pMenu);
00560
00561 #if 0 // now it's in the resources
00562     // CG: This block added by 'Tip of the Day' component.
00563     {
00564         // TODO: This code adds the "Tip of the Day" menu item
00565         // on the fly.  It may be removed after adding the menu
00566         // item to all applicable menu items using the resource
00567         // editor.
00568
00569         // Add Tip of the Day menu item on the fly!
00570         static CMenu* pSubMenu = NULL;
00571
00572         CString strHelp; strHelp.LoadString(CG_IDS_TIPOFTHEDAYHELP);
00573         CString strMenu;
00574         int nMenuCount = pMenu->GetMenuItemCount();
00575         BOOL bFound = FALSE;
00576         for (int i=0; i < nMenuCount; i++)
00577         {
00578             pMenu->GetMenuString(i, strMenu, MF_BYPOSITION);
00579             if (strMenu == strHelp)
00580             {
00581                 pSubMenu = pMenu->GetSubMenu(i);
00582                 bFound = TRUE;
00583                 ASSERT(pSubMenu != NULL);
00584             }
00585         }
00586
00587         CString strTipMenu;
00588         strTipMenu.LoadString(CG_IDS_TIPOFTHEDAYMENU);
00589         if (!bFound)
00590         {
00591             // Help menu is not available. Please add it!
00592             if (pSubMenu == NULL)
00593             {
00594                 // The same pop-up menu is shared between mainfrm and frame
00595                 // with the doc.
00596                 static CMenu popUpMenu;
00597                 pSubMenu = &popUpMenu;
00598                 pSubMenu->CreatePopupMenu();
00599                 pSubMenu->InsertMenu(0, MF_STRING|MF_BYPOSITION,
00600                     CG_IDS_TIPOFTHEDAY, strTipMenu);
00601             }
00602             pMenu->AppendMenu(MF_STRING|MF_BYPOSITION|MF_ENABLED|MF_POPUP,
00603                 (UINT)pSubMenu->m_hMenu, strHelp);
00604             DrawMenuBar();
00605         }
00606         else
00607         {
00608             // Check to see if the Tip of the Day menu has already been added.
00609             pSubMenu->GetMenuString(0, strMenu, MF_BYPOSITION);
00610
00611             if (strMenu != strTipMenu)
00612             {
00613                 // Tip of the Day submenu has not been added to the
00614                 // first position, so add it.
00615                 pSubMenu->InsertMenu(0, MF_BYPOSITION);  // Separator
00616                 pSubMenu->InsertMenu(0, MF_STRING|MF_BYPOSITION,
00617                     CG_IDS_TIPOFTHEDAY, strTipMenu);
00618             }
00619         }
00620     }
00621 #endif
00622 }
00623
00624 void CMainFrame::InitialShowWindow(int nCmdShow)
00625 {
00626     if (gMainPlacement.hasOne)
00627     {
00628         WINDOWPLACEMENT wp = gMainPlacement.placement;
00629         if (nCmdShow != SW_SHOWNORMAL)
00630             wp.showCmd = nCmdShow;
00631         else if (wp.showCmd & SW_SHOWMINIMIZED)
00632             wp.showCmd = (wp.flags & WPF_RESTORETOMAXIMIZED) ? SW_MAXIMIZE : SW_SHOWNORMAL;
00633         SetWindowPlacement(&wp);
00634     }
00635     else
00636     {
00637         ShowWindow(nCmdShow);
00638     }
00639 }
00640
00641 void CMainFrame::OnHistorySelect()
00642 {
00643     ChangeLocation();
00644 }
00645
00646 void CMainFrame::ChangeLocation()
00647 {
00648     int nCurSel = m_browseHist.GetCurSel();
00649     CString s;
00650     m_browseHist.GetLBText(nCurSel, s);
00651     if(!s.IsEmpty())
00652     {
00653         CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00654         app->GetBrowserView()->ResetBrowser(s, true);
00655         app->ActivateBrowserView();
00656     }
00657 }
00658
00659 CWinCvsBrowser *CMainFrame::GetBrowserView()
00660 {
00661     CBrowserBar *bar = (CBrowserBar *)m_wndWorkspace.GetView(0);
00662     return bar->GetBrowserView();
00663 }
00664
00665 CCJShellTree *CMainFrame::GetExplorerView()
00666 {
00667     CExploreBar *bar = (CExploreBar *)m_wndWorkspace.GetView(1);
00668     return &bar->m_TreeCtrl;
00669 }
00670
00671 BOOL CMainFrame::OnBroadcastCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
00672 {
00673     CPushRoutingFrame push(this);
00674
00675     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00676
00677     // pump through dock bars FIRST
00678     CWinCvsBrowser *bView = app->GetBrowserView();
00679     if (bView != NULL && bView == CWnd::GetFocus() && bView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
00680         return TRUE;
00681 #ifndef NOEXPLOREVIEW
00682     // pump through dock bars FIRST
00683     CCJShellTree *eView = app->GetExplorerView();
00684     if (eView != NULL && eView == CWnd::GetFocus())
00685     {
00686         if(eView->GetParent()->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
00687             return TRUE;
00688     }
00689 #endif
00690
00691     CWincvsView *cView = app->GetConsoleView();
00692     if (cView != NULL && cView == CWnd::GetFocus() && cView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
00693         return TRUE;
00694
00695     return FALSE;
00696 }
00697
00698 void CMainFrame::DropFiles(HDROP hDropInfo)
00699 {
00700     OnDropFiles(hDropInfo);
00701 }
00702
00703 void CMainFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
00704 {
00705     CCJMDIFrameWnd::OnActivate(nState, pWndOther, bMinimized);
00706
00707     // TODO: Add your message handler code here
00708
00709     //JK - prevent the focus to be gone from FileView to the Workspace - for the Dialogs etc.
00710     CWincvsApp* pApp = (CWincvsApp*)AfxGetApp();
00711     ASSERT(pApp);
00712
00713     if( WA_INACTIVE == nState && !m_bRestoreFocus )
00714     {
00715         m_bRestoreFocus = BOOL( GetFocus() == pApp->GetFileView() );
00716         pApp->m_isBackgroundProcess = true;
00717     }
00718     else
00719     {
00720         pApp->m_isBackgroundProcess = false;
00721         if( !bMinimized && m_bRestoreFocus )
00722         {
00723             m_bRestoreFocus = FALSE;
00724             CBrowseFileView* pBrowseFileView = pApp->GetFileView();
00725             if(pBrowseFileView)
00726             {
00727                 pBrowseFileView->SetFocus();
00728             }
00729         }
00730     }
00731 }
00732
00733 void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
00734 {
00735     // TODO: Add your message handler code here and/or call default
00736
00737     //JK - prevent the focus to be gone from FileView to the Workspace - for the Minimize
00738     if( SC_MINIMIZE == nID )
00739     {
00740         CWincvsApp* pApp = (CWincvsApp*)AfxGetApp();
00741         ASSERT(pApp);
00742
00743         m_bRestoreFocus = BOOL( GetFocus() == pApp->GetFileView() );
00744     }
00745
00746     CCJMDIFrameWnd::OnSysCommand(nID, lParam);
00747 }
00748
00749 void CMainFrame::OnViewRecursive()
00750 {
00751     m_recursion.ToggleRecursion();
00752     m_recursion.GetNotificationManager()->NotifyAll();
00753     OnFilterMaskEntered();
00754 }
00755
00756 void CMainFrame::OnUpdateViewRecursive(CCmdUI* pCmdUI)
00757 {
00758     pCmdUI->Enable(IsAppEnabled());
00759     pCmdUI->SetCheck(m_recursion.IsShowRecursive());
00760 }
00761
00762 bool CMainFrame::FreshenFileMask()
00763 {
00764     CString strFileMask;
00765     m_comboFilterMask.GetWindowText(strFileMask);
00766     return m_filter.SetMask(strFileMask);
00767 }
00768
00769 void CMainFrame::OnViewModified()
00770 {
00771     m_filter.ToggleModified();
00772     FreshenFileMask();
00773     m_filter.GetNotificationManager()->NotifyAll();
00774 }
00775
00776 void CMainFrame::OnUpdateViewModified(CCmdUI* pCmdUI)
00777 {
00778     pCmdUI->Enable(IsAppEnabled());
00779     pCmdUI->SetCheck(m_filter.IsModified());
00780 }
00781
00782 void CMainFrame::OnFilterMaskEntered()
00783 {
00784     if (FreshenFileMask())
00785     {
00786         m_filter.GetNotificationManager()->NotifyAll();
00787     }
00788 }
00789
00790 void CMainFrame::OnViewConflict()
00791 {
00792     m_filter.ToggleConflict();
00793     FreshenFileMask();
00794     m_filter.GetNotificationManager()->NotifyAll();
00795 }
00796
00797 void CMainFrame::OnUpdateViewConflict(CCmdUI* pCmdUI)
00798 {
00799     pCmdUI->Enable(IsAppEnabled());
00800     pCmdUI->SetCheck(m_filter.IsConflict());
00801 }
00802
00803 void CMainFrame::OnViewUnknown()
00804 {
00805     m_filter.ToggleUnknown();
00806     FreshenFileMask();
00807     m_filter.GetNotificationManager()->NotifyAll();
00808 }
00809
00810 void CMainFrame::OnUpdateViewUnknown(CCmdUI* pCmdUI)
00811 {
00812     pCmdUI->Enable(IsAppEnabled());
00813     pCmdUI->SetCheck(m_filter.IsUnknown());
00814 }
00815
00816 void CMainFrame::OnViewMissing()
00817 {
00818     m_filter.ToggleMissing();
00819     FreshenFileMask();
00820     m_filter.GetNotificationManager()->NotifyAll();
00821 }
00822
00823 void CMainFrame::OnUpdateViewMissing(CCmdUI* pCmdUI)
00824 {
00825     pCmdUI->Enable(IsAppEnabled());
00826     pCmdUI->SetCheck(m_filter.IsMissing());
00827 }
00828
00829 void CMainFrame::OnViewIgnore()
00830 {
00831     m_ignore.ToggleIgnore();
00832     m_ignore.GetNotificationManager()->NotifyAll();
00833     OnFilterMaskEntered();
00834 }
00835
00836 void CMainFrame::OnUpdateViewIgnore(CCmdUI* pCmdUI)
00837 {
00838     pCmdUI->Enable(IsAppEnabled());
00839     pCmdUI->SetCheck(m_ignore.IsShowIgnored());
00840 }
00841
00842 void CMainFrame::OnUpdateFilterMask(CCmdUI* pCmdUI)
00843 {
00844     pCmdUI->Enable(IsAppEnabled());
00845 }
00846
00847 void CMainFrame::OnUpdateHistory(CCmdUI* pCmdUI)
00848 {
00849     pCmdUI->Enable(IsAppEnabled());
00850 }
00851
00852 void CMainFrame::OnViewAdded()
00853 {
00854     m_filter.ToggleAdded();
00855     FreshenFileMask();
00856     m_filter.GetNotificationManager()->NotifyAll();
00857 }
00858
00859 void CMainFrame::OnUpdateViewAdded(CCmdUI* pCmdUI)
00860 {
00861     pCmdUI->Enable(IsAppEnabled());
00862     pCmdUI->SetCheck(m_filter.IsAdded());
00863 }
00864
00865 void CMainFrame::OnUpdateViewRemoved(CCmdUI* pCmdUI)
00866 {
00867     pCmdUI->Enable(IsAppEnabled());
00868     pCmdUI->SetCheck(m_filter.IsRemoved());
00869 }
00870
00871 void CMainFrame::OnViewRemoved()
00872 {
00873     m_filter.ToggleRemoved();
00874     FreshenFileMask();
00875     m_filter.GetNotificationManager()->NotifyAll();
00876 }
00877
00878 void CMainFrame::OnViewChanged()
00879 {
00880     m_filter.ToggleChanged();
00881     FreshenFileMask();
00882     m_filter.GetNotificationManager()->NotifyAll();
00883 }
00884
00885 void CMainFrame::OnUpdateViewChanged(CCmdUI* pCmdUI)
00886 {
00887     pCmdUI->Enable(IsAppEnabled());
00888     pCmdUI->SetCheck(m_filter.IsChanged());
00889 }
00890
00891 void CMainFrame::OnViewHideunknown()
00892 {
00893     m_filter.ToggleHideUnknown();
00894     FreshenFileMask();
00895     m_filter.GetNotificationManager()->NotifyAll();
00896 }
00897
00898 void CMainFrame::OnUpdateViewHideunknown(CCmdUI* pCmdUI)
00899 {
00900     pCmdUI->Enable(IsAppEnabled() && m_filter.IsDefaultMode());
00901     pCmdUI->SetCheck(m_filter.IsHideUnknown());
00902 }
00903
00904 static bool sAskingMainThread;
00905 static UStr sGetEnvResult;
00906
00907 static CSemaphore sGetEnv(0);
00908
00909 char *CMainFrame::GetEnvMainThread(const char *name)
00910 {
00911     ASSERT(::GetCurrentThreadId() != AfxGetApp()->m_nThreadID);
00912
00913     sGetEnvResult = name;
00914     sAskingMainThread = true;
00915
00916     sGetEnv.Lock();
00917
00918     return sGetEnvResult;
00919 }
00920
00921 void CMainFrame::OnTimer(UINT nIDEvent)
00922 {
00923     if(sAskingMainThread)
00924     {
00925         sAskingMainThread = false;
00926
00927         sGetEnvResult = glue_getenv(sGetEnvResult);
00928         sGetEnv.Unlock();
00929     }
00930 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/MainFrm.h Source File

WinCvs/MainFrm.h

Go to the documentation of this file.
00001 // MainFrm.h : interface of the CMainFrame class
00002 //
00004
00005 #if !defined(AFX_MAINFRM_H__D2D77DCC_8299_11D1_8949_444553540000__INCLUDED_)
00006 #define AFX_MAINFRM_H__D2D77DCC_8299_11D1_8949_444553540000__INCLUDED_
00007
00008 #if _MSC_VER >= 1000
00009 #pragma once
00010 #endif // _MSC_VER >= 1000
00011
00012 #include "ConsoleBar.h"
00013 #include "CvsStatusBar.h"
00014 #include "BrowseViewModel.h"
00015 #include "ToolbarCombo.h"
00016 #include "HistComboBoxEx.h"
00017
00018 class CMainFrame : public CCJMDIFrameWnd
00019 {
00020     DECLARE_DYNAMIC(CMainFrame)
00021 public:
00022     CMainFrame();
00023 #if 0
00024 protected: // create from serialization only
00025     CMainFrame();
00026     DECLARE_DYNCREATE(CMainFrame)
00027 #endif
00028
00029 // Attributes
00030 protected:
00031      KoFilterModel m_filter;
00032      KoRecursionModel m_recursion;
00033      KoIgnoreModel m_ignore;
00034
00035 // Operations
00036 public:
00037
00038 // Overrides
00039     // ClassWizard generated virtual function overrides
00040     //{{AFX_VIRTUAL(CMainFrame)
00041     public:
00042     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00043     //}}AFX_VIRTUAL
00044
00045 // Implementation
00046 public:
00047     void DropFiles(HDROP hDropInfo);
00048     void InitialShowWindow(int nCmdShow);
00049     virtual ~CMainFrame();
00050
00051     CWinCvsBrowser *GetBrowserView();
00052     CCJShellTree *GetExplorerView();
00053     inline CCJTabCtrlBar *GetWorkspace() { return &m_wndWorkspace; }
00054     inline CMDIMenuList & GetMenuList(void) { return m_menuList; }
00055
00056     inline CWincvsView *GetConsoleView() { return m_consolebar.m_view; }
00057     inline CHistComboBoxEx & GetBrowseHistory(void) { return m_browseHist; }
00058     inline CStatusBar *GetStatusBar() { return &m_wndStatusBar; }
00059
00060     BOOL OnBroadcastCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
00061         // take care about the cmd msg routing on the dock bars
00062
00063     char *GetEnvMainThread(const char *name);
00064
00065     // KiFilterModel implementation
00066     KiFilterModel* GetFilterModel()
00067     {
00068         return &m_filter;
00069     }
00070
00071     // KiRecursionModel implementation
00072     KiRecursionModel* GetRecursionModel()
00073     {
00074         return &m_recursion;
00075     }
00076
00077     // KiRecursionModel implementation
00078     KiIgnoreModel* GetIgnoreModel()
00079     {
00080         return &m_ignore;
00081     }
00082
00083     void OnFilterMaskEntered();
00084
00085     void ChangeLocation();
00086
00087 #ifdef _DEBUG
00088     virtual void AssertValid() const;
00089     virtual void Dump(CDumpContext& dc) const;
00090 #endif
00091
00092 protected:  // control bar embedded members
00093     CCvsStatusBar  m_wndStatusBar;
00094     CToolBar    m_wndToolBar;
00095     CToolBar    m_wndBrowser;
00096     CToolBar    m_wndMultiUser;
00097     CToolBar    m_wndTags;
00098     CToolBar    m_wndList;
00099     CToolBar    m_wndFilter;
00100     CHistComboBoxEx m_browseHist;
00101     CToolbarCombo m_comboFilterMask;
00102     CFont       m_fontNormal;
00103     CBarConsole m_consolebar;
00104     CCJTabCtrlBar   m_wndWorkspace;
00105     CImageList  m_TabImages;
00106     CCJWindowPlacement  m_state;
00107
00108     BOOL InitializeDockingWindows();
00109
00110 // Generated message map functions
00111 protected:
00112     afx_msg void OnInitMenu(CMenu* pMenu);
00113     void DockControlBarLeftOf(CToolBar* Bar,CToolBar* LeftOf);
00114     bool FreshenFileMask();
00115
00116     //{{AFX_MSG(CMainFrame)
00117     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00118     afx_msg void OnClose();
00119     afx_msg void OnDropFiles(HDROP hDropInfo);
00120     afx_msg void OnHistorySelect();
00121     afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
00122     afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
00123     afx_msg void OnViewRecursive();
00124     afx_msg void OnViewModified();
00125     afx_msg void OnUpdateViewModified(CCmdUI* pCmdUI);
00126     afx_msg void OnUpdateViewRecursive(CCmdUI* pCmdUI);
00127     afx_msg void OnViewConflict();
00128     afx_msg void OnUpdateViewConflict(CCmdUI* pCmdUI);
00129     afx_msg void OnViewUnknown();
00130     afx_msg void OnUpdateViewUnknown(CCmdUI* pCmdUI);
00131     afx_msg void OnViewMissing();
00132     afx_msg void OnUpdateViewMissing(CCmdUI* pCmdUI);
00133     afx_msg void OnViewIgnore();
00134     afx_msg void OnUpdateViewIgnore(CCmdUI* pCmdUI);
00135     afx_msg void OnUpdateFilterMask(CCmdUI* pCmdUI);
00136     afx_msg void OnUpdateHistory(CCmdUI* pCmdUI);
00137     afx_msg void OnViewAdded();
00138     afx_msg void OnUpdateViewAdded(CCmdUI* pCmdUI);
00139     afx_msg void OnUpdateViewRemoved(CCmdUI* pCmdUI);
00140     afx_msg void OnViewRemoved();
00141     afx_msg void OnViewChanged();
00142     afx_msg void OnUpdateViewChanged(CCmdUI* pCmdUI);
00143     afx_msg void OnViewHideunknown();
00144     afx_msg void OnUpdateViewHideunknown(CCmdUI* pCmdUI);
00145     afx_msg void OnTimer(UINT nIDEvent);
00146     //}}AFX_MSG
00147     DECLARE_MESSAGE_MAP()
00148 private:
00149     BOOL m_bRestoreFocus;
00150 };
00151
00153
00154 //{{AFX_INSERT_LOCATION}}
00155 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00156
00157 #endif // !defined(AFX_MAINFRM_H__D2D77DCC_8299_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


BrowseFileView.cpp File Reference

WinCvs/BrowseFileView.cpp File Reference

#include "stdafx.h"
#include <process.h>
#include <vector>
#include <IO.h>
#include "wincvs.h"
#include "BrowseFileView.h"
#include "FileTraversal.h"
#include "CvsCommands.h"
#include "MultiFiles.h"
#include "CvsArgs.h"
#include "AppConsole.h"
#include "CvsPrefs.h"
#include "CvsIgnore.h"
#include "TclGlue.h"
#include "MacrosSetup.h"
#include "MoveToTrash.h"
#include "WinCvsBrowser.h"
#include "MainFrm.h"
#include "wincvs_winutil.h"
#include "BrowseViewModel.h"
#include "BrowseViewHandlers.h"
#include "FileViewWatcher.h"
#include "BrowseViewColumn.h"
#include "PythonGlue.h"
#include "umain.h"

Include dependency graph for BrowseFileView.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | KoTraversalContext
class | CRecursionLock
class | TViewFill

Functions

CPersistentInt | gFileViewSort ("P_FileViewSort", EntnodeData::kName)
CPersistentBool | gFileViewSortAsc ("P_FileViewSortAsc", false)
void | onFilteringChanged (CObject *obj)
CString | GetRoot ()
int | GetPathLength (LPCTSTR path)
bool | IsSamePath (LPCTSTR path1, LPCTSTR path2)

Variables

const int | FILECHANGE_TIMER = 999
const int | kSpc = 3
const int | WM_RESETVIEW = WM_APP + 12

Function Documentation

int GetPathLength ( LPCTSTR path ) [static]

Definition at line 1249 of file BrowseFileView.cpp.

Referenced by IsSamePath().

01250 {
01251     int len = _tcslen(path);
01252     return (len > 0 && path[len - 1] == kPathDelimiter) ? (len - 1) : len;
01253 }

CString GetRoot ( ) [static]

Definition at line 1243 of file BrowseFileView.cpp.

Referenced by CBrowseFileView::OnUpdateViewUpone(), and CBrowseFileView::OnViewUpone().

01244 {
01245     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01246     return app->GetRoot();
01247 }

bool IsSamePath | ( | LPCTSTR | path1,
 |  | LPCTSTR | path2
 | ) | [static]

Definition at line 1255 of file BrowseFileView.cpp.

Referenced by CBrowseFileView::OnViewUpone().

01256 {
01257     int len1 = GetPathLength(path1);
01258     int len2 = GetPathLength(path2);
01259     return len1 == len2 && _tcsicmp(path1, path2) == 0;
01260 }

CPersistentInt gFileViewSort | ( | "P_FileViewSort" | ,
 |  | EntnodeData::kName |
 | ) |

CPersistentBool gFileViewSortAsc | ( | "P_FileViewSortAsc" | ,
 |  | false |
 | ) |

void onFilteringChanged ( CObject * obj ) [static]

Definition at line 489 of file BrowseFileView.cpp.

00490 {
00491     ((CBrowseFileView *)obj)->OnFilteringChanged();
00492 }

Variable Documentation

const int FILECHANGE_TIMER = 999 [static]

Definition at line 60 of file BrowseFileView.cpp.

const int WM_RESETVIEW = WM_APP + 12 [static]

Definition at line 62 of file BrowseFileView.cpp.

const int kSpc = 3 [static]

Definition at line 61 of file BrowseFileView.cpp.

Generated on Sun Oct 21 12:44:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


BrowseFileView.h File Reference

WinCvs/BrowseFileView.h File Reference

#include "CvsEntries.h"
#include "CPStr.h"
#include "SortHeaderCtrl.h"

Include dependency graph for BrowseFileView.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CBrowseFileView

Defines

#define | AFX_BROWSEFILEVIEW_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Enumerations

enum {
kFileIconText = 0, kFileIconBinary, kFileIconUnknown, kFileIconAdded,
kFileIconConflict, kFileIconMiss, kFolderIcon, kFolderIconUnknown,
kFolderIconMiss, kFileIconTextMod, kFileIconBinaryMod, kFileIconIgnored,
kFolderIconIgnored, kFileIconRemoved, kFileIconBinaryAdded
}

Define Documentation

#define AFX_BROWSEFILEVIEW_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_

Definition at line 28 of file BrowseFileView.h.

Enumeration Type Documentation

anonymous enum

Enumeration values:
kFileIconText
kFileIconBinary
kFileIconUnknown
kFileIconAdded
kFileIconConflict
kFileIconMiss
kFolderIcon
kFolderIconUnknown
kFolderIconMiss
kFileIconTextMod
kFileIconBinaryMod
kFileIconIgnored
kFolderIconIgnored
kFileIconRemoved
kFileIconBinaryAdded

Definition at line 43 of file BrowseFileView.h.

00044 {
00045     kFileIconText = 0,
00046     kFileIconBinary,
00047     kFileIconUnknown,
00048     kFileIconAdded,
00049     kFileIconConflict,
00050     kFileIconMiss,
00051     kFolderIcon,
00052     kFolderIconUnknown,
00053     kFolderIconMiss,
00054     kFileIconTextMod,
00055     kFileIconBinaryMod,
00056     kFileIconIgnored,
00057     kFolderIconIgnored,
00058     kFileIconRemoved,
00059     kFileIconBinaryAdded
00060 };

Generated on Sun Oct 21 12:44:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


BrowserBar.cpp File Reference

WinCvs/BrowserBar.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "BrowserBar.h"

Include dependency graph for BrowserBar.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


BrowserBar.h File Reference

WinCvs/BrowserBar.h File Reference

#include "WinCvsBrowser.h"

Include dependency graph for BrowserBar.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CBrowserBar

Defines

#define | AFX_BROWSERBAR_H__64721953_F9A8_11D2_BDEC_000000000000__INCLUDED_

Define Documentation

#define AFX_BROWSERBAR_H__64721953_F9A8_11D2_BDEC_000000000000__INCLUDED_

Definition at line 2 of file BrowserBar.h.

Generated on Sun Oct 21 12:44:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ColorStatic.cpp File Reference

WinCvs/ColorStatic.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "ColorStatic.h"

Include dependency graph for ColorStatic.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ColorStatic.h File Reference

WinCvs/ColorStatic.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CColorStatic

Defines

#define | AFX_COLORSTATIC_H__4D2B055E_F042_428F_A662_09ABEA902DCE__INCLUDED_

Define Documentation

#define AFX_COLORSTATIC_H__4D2B055E_F042_428F_A662_09ABEA902DCE__INCLUDED_

Definition at line 26 of file ColorStatic.h.

Generated on Sun Oct 21 12:45:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ConsoleBar.cpp File Reference

WinCvs/ConsoleBar.cpp File Reference

#include "stdafx.h"
#include "ConsoleBar.h"
#include "wincvsView.h"
#include "resource.h"

Include dependency graph for ConsoleBar.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ConsoleBar.h File Reference

WinCvs/ConsoleBar.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CBarConsole

Generated on Sun Oct 21 12:45:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CustomizeMenus.cpp File Reference

WinCvs/CustomizeMenus.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "CustomizeMenus.h"
#include "MacrosSetup.h"

Include dependency graph for CustomizeMenus.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CCustInvertTable

Defines

#define | INVTAB(msg, e) {msg, #e, e}

Functions

const CustInvertTable * | CustGetByKey (const char *entry)
char * | GetInvString (const CustInvertTable *entry)
bool | IsInInvertList (const CustInvertTable *entry, const std::vector< UStr > &list)
int CALLBACK | _Compare (LPARAM data1, LPARAM data2, LPARAM data)

Variables

CustInvertTable sInitInvTable []
CCustInvertTable sInvTable

Define Documentation

#define INVTAB | ( | msg,
 |  | e | ) | {msg, #e, e}

Definition at line 35 of file CustomizeMenus.cpp.

Referenced by sInitInvTable().

Function Documentation

const CustInvertTable* CustGetByKey ( const char * entry )

Definition at line 146 of file CustomizeMenus.cpp.

00147 {
00148     std::vector<CustInvertTable>::const_iterator tmp;
00149     sInvTable.Initialize();
00150     for(tmp = sInvTable.begin(); tmp != sInvTable.end(); ++tmp)
00151     {
00152         if(strcmp(entry, (*tmp).key) == 0)
00153             return &*tmp;
00154     }
00155     return 0L;
00156 }

char* GetInvString ( const CustInvertTable * entry ) [static]

Definition at line 158 of file CustomizeMenus.cpp.

Referenced by CCustomizeMenus::OnAdd(), CCustomizeMenus::OnInitDialog(), CCustomizeMenus::OnMove(), CCustomizeMenus::OnRemove(), and _Compare().

00159 {
00160     static CString res;
00161     res = entry->title;
00162     int ind;
00163     if((ind = res.Find('&')) != -1)
00164         res.Delete(ind);
00165     if((ind = res.Find('\t')) != -1)
00166         res = res.Left(ind);
00167     return (char *)(const char *)res;
00168 }

bool IsInInvertList | ( | const CustInvertTable * | entry,
 |  | const std::vector< UStr > & | list
 | ) | [static]

Definition at line 170 of file CustomizeMenus.cpp.

Referenced by CCustomizeMenus::OnInitDialog().

00171 {
00172     std::vector<UStr>::const_iterator i;
00173     for(i = list.begin(); i != list.end(); ++i)
00174     {
00175         const CustInvertTable *tab = CustGetByKey(*i);
00176         if(tab == 0L)
00177             continue;
00178
00179         if(strcmp(entry->key, tab->key) == 0)
00180             return true;
00181     }
00182     return false;
00183 }

int CALLBACK _Compare | ( | LPARAM | data1,
 |  | LPARAM | data2,
 |  | LPARAM | data
 | ) | [static]

Definition at line 297 of file CustomizeMenus.cpp.

00298 {
00299     CustInvertTable *d1 = (CustInvertTable *)data1;
00300     CustInvertTable *d2 = (CustInvertTable *)data2;
00301
00302     CString s1(GetInvString(d1));
00303     CString s2(GetInvString(d2));
00304     int cmp = strcmp(s1, s2);
00305     if(cmp == 0)
00306         return 0;
00307     if(d1->cmd == ID_SEPARATOR)
00308         return -1;
00309     if(d2->cmd == ID_SEPARATOR)
00310         return 1;
00311     return cmp;
00312 }

Variable Documentation

CustInvertTable sInitInvTable[] [static]

Definition at line 36 of file CustomizeMenus.cpp.

CCustInvertTable sInvTable

Generated on Sun Oct 21 12:45:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CustomizeMenus.h File Reference

WinCvs/CustomizeMenus.h File Reference

#include "Persistent.h"
#include "CPStr.h"

Include dependency graph for CustomizeMenus.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCustomizeMenus
class | CMMenuString
struct | CustInvertTable

Defines

#define | AFX_CUSTOMIZEMENUS_H__28A6AE7E_C54B_47A5_A8F5_A127E2E9F3BF__INCLUDED_

Functions

const CustInvertTable * | CustGetByKey (const char *entry)

Define Documentation

#define AFX_CUSTOMIZEMENUS_H__28A6AE7E_C54B_47A5_A8F5_A127E2E9F3BF__INCLUDED_

Definition at line 22 of file CustomizeMenus.h.

Function Documentation

const CustInvertTable* CustGetByKey ( const char * entry )

Definition at line 146 of file CustomizeMenus.cpp.

Referenced by GetCustomMenu(), IsInInvertList(), and CCustomizeMenus::OnInitDialog().

00147 {
00148     std::vector<CustInvertTable>::const_iterator tmp;
00149     sInvTable.Initialize();
00150     for(tmp = sInvTable.begin(); tmp != sInvTable.end(); ++tmp)
00151     {
00152         if(strcmp(entry, (*tmp).key) == 0)
00153             return &*tmp;
00154     }
00155     return 0L;
00156 }

Generated on Sun Oct 21 12:45:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsStatusBar.cpp File Reference

WinCvs/CvsStatusBar.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "CvsStatusBar.h"
#include "CvsPrefs.h"

Include dependency graph for CvsStatusBar.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsStatusBar.h File Reference

WinCvs/CvsStatusBar.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCvsStatusBar

Defines

#define | AFX_CVSSTATUSBAR_H__F549ACF2_ECFE_4933_A05D_5FC8248C3CD4__INCLUDED_

Define Documentation

#define AFX_CVSSTATUSBAR_H__F549ACF2_ECFE_4933_A05D_5FC8248C3CD4__INCLUDED_

Definition at line 2 of file CvsStatusBar.h.

Generated on Sun Oct 21 12:45:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ExploreBar.cpp File Reference

WinCvs/ExploreBar.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "MainFrm.h"
#include "ExploreBar.h"
#include "BrowseFileView.h"
#include "FileTraversal.h"
#include "CvsCommands.h"
#include "CvsPrefs.h"

Include dependency graph for ExploreBar.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ExploreBar.h File Reference

WinCvs/ExploreBar.h File Reference

#include "CJShellTree.h"

Include dependency graph for ExploreBar.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CExploreBar
class | CMyShellTree

Defines

#define | AFX_EXPLOREBAR_H__A132A164_1A90_11D3_B1A1_004095463819__INCLUDED_

Define Documentation

#define AFX_EXPLOREBAR_H__A132A164_1A90_11D3_B1A1_004095463819__INCLUDED_

Definition at line 2 of file ExploreBar.h.

Generated on Sun Oct 21 12:45:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


FileViewWatcher.cpp File Reference

WinCvs/FileViewWatcher.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "FileViewWatcher.h"

Include dependency graph for FileViewWatcher.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


FileViewWatcher.h File Reference

WinCvs/FileViewWatcher.h File Reference

#include <afxmt.h>

Include dependency graph for FileViewWatcher.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class KoWatcher

Generated on Sun Oct 21 12:45:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


findtcl.cpp File Reference

WinCvs/findtcl.cpp File Reference

#include "stdafx.h"
#include <string>
#include <deque>
#include <algorithm>
#include <windows.h>

Include dependency graph for findtcl.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void | buildTail (char *, const char *, int)
void | buildWildTail (char *, char *, int)
bool | verRemove (std::string &)
bool | verLess (std::string &, std::string &)
bool | fileRemove (std::string &)
bool | fileLess (std::string &, std::string &)
char * | findTcl (char *_minVer, int _exact, int _dbgOnly)

Variables

char * | minVer
int | exact
int | dbgOnly

Function Documentation

void buildTail | ( | char * | pos,
 |  | const char * | ver,
 |  | int | dbgOnly
 | ) | [static]

Definition at line 269 of file findtcl.cpp.

Referenced by findTcl().

00270 {
00271     const char *pos2;
00272     char *shLibExt = ".dll";
00273
00274     /* append version w/o decimal */
00275     pos2 = ver;
00276     while (*pos2 != '\0') {
00277         if (*pos2 != '.') *pos++ = *pos2++;
00278         else pos2++;
00279     };
00280
00281     /* if asked, add the debug suffix */
00282     if (dbgOnly != 0) *pos++ = 'd';
00283
00284     /* append the extension */
00285     pos2 = shLibExt;
00286     while (*pos2 != '\0') {
00287         *pos++ = *pos2++;
00288     };
00289
00290     /* terminate it */
00291     *pos = '\0';
00292 };

void buildWildTail | ( | char * | pos,
 |  | char * | ver,
 |  | int | dbgOnly
 | ) | [static]

Definition at line 296 of file findtcl.cpp.

Referenced by findTcl().

00297 {
00298     char *pos2;
00299     char *shLibExt = ".dll";
00300
00301     /* just append the major version */
00302     *pos++ = *ver;
00303     *pos++ = '?';
00304
00305     /* if asked, add the debug suffix */
00306     if (dbgOnly != 0) *pos++ = 'd';
00307
00308     /* append the extension */
00309     pos2 = shLibExt;
00310     while (*pos2 != '\0') {
00311         *pos++ = *pos2++;
00312     };
00313
00314     /* terminate it */
00315     *pos = '\0';
00316 };

bool fileLess | ( | std::string & | a,
 |  | std::string & | b
 | ) | [static]

Definition at line 352 of file findtcl.cpp.

00353 {
00354   return verLess(
00355       a.substr(3,1) + "." + a.substr(4,1),
00356       b.substr(3,1) + "." + b.substr(4,1)
00357       );
00358 }

bool fileRemove ( std::string & f ) [static]

Definition at line 345 of file findtcl.cpp.

00346 {
00347     // strip off 'tcl' and '.dll'
00348     return verRemove(f.substr(3,1) + "." + f.substr(4,1));
00349 }

char* findTcl | ( | char * | _minVer,
 |  | int | _exact,
 |  | int | _dbgOnly
 | ) |

Definition at line 25 of file findtcl.cpp.

Referenced by CTcl_Interp::IsAvail().

00026 {
00027     //char *tclRootPath = NULL;
00028     static char tclLibFullPath[MAX_PATH];
00029     char *savedPos;
00030     char *pos1, *pos2;
00031     char *prefix = "\\bin\\tcl";
00032     WIN32_FIND_DATA hFFData;
00033     HANDLE hFind;
00034     int i = 0;
00035     std::deque<std::string> vers;
00036     std::deque<std::string>::iterator versNewLast;
00037
00038
00039     minVer = _minVer;
00040     exact = _exact;
00041     dbgOnly = _dbgOnly;
00042
00043
00044     // Look in the current path on the assumption if it's there, you want to use
00045     // it instead of any others if it passes the version test.
00046
00047     // Append the beginning
00048     pos1 = tclLibFullPath;
00049     pos2 = ".\\tcl";
00050     while (*pos2 != '\0') { *pos1++ = *pos2++; };
00051     savedPos = pos1;
00052
00053     if (exact != 0)
00054     {
00055         // build the end of the filename from the parameter given
00056         buildTail(savedPos, minVer, dbgOnly);
00057
00058         // See if it *really* exists
00059         hFind = ::FindFirstFile(tclLibFullPath, &hFFData);
00060
00061         if (hFind != INVALID_HANDLE_VALUE)
00062         {
00063             // gotcha.
00064             ::FindClose(hFind);
00065             return tclLibFullPath;
00066         }
00067         // no success..  fall through for registry search
00068
00069     }
00070     else
00071     {
00072
00073         // Try a range of filenames
00074         buildWildTail(savedPos, minVer, dbgOnly);
00075
00076         // See if we got some
00077         hFind = ::FindFirstFile(tclLibFullPath, &hFFData);
00078
00079         if (hFind != INVALID_HANDLE_VALUE)
00080         {
00081             BOOL rtn;
00082
00083             do
00084             {
00085                 vers.push_back(std::string(hFFData.cFileName));
00086                 rtn = ::FindNextFile(hFind, &hFFData);
00087             } while (rtn != 0);   // got more?
00088
00089             ::FindClose(hFind);
00090
00091             // sort filename strings
00092             std::sort(vers.begin(), vers.end(), fileLess);
00093
00094             // remove all invalid entries based on flags.
00095             versNewLast = std::remove_if(vers.begin(), vers.end(), fileRemove);
00096
00097             if (vers.begin() != versNewLast) {
00098                 // using copy itself doesn't terminate the string...  how odd..
00099                 tclLibFullPath [(versNewLast - 1)->copy(tclLibFullPath, MAX_PATH)] = '\0';
00100                 return tclLibFullPath;
00101             }
00102         }
00103
00104         // no success..  fall through for registry search
00105     }
00106
00107
00108     // Do a registry search.
00109     HKEY topTclKey = NULL, subTclVer = NULL;
00110     DWORD max_path = MAX_PATH;
00111     LONG result;
00112     char sSubKey[MAX_PATH];
00113     const char *verTarget;
00114
00115     result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
00116         "SOFTWARE\\Scriptics\\Tcl",
00117         0,
00118         KEY_ENUMERATE_SUB_KEYS,
00119         &topTclKey);
00120
00121     if (result != ERROR_SUCCESS)
00122     {
00123         // active TCL
00124         //HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TclScript\DefaultIcon
00125         result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
00126             "SOFTWARE\\Classes\\TclScript\\DefaultIcon",
00127             0,
00128             KEY_QUERY_VALUE,
00129             &topTclKey);
00130
00131         if (result == ERROR_SUCCESS)
00132         {
00133             result = RegQueryValueEx(topTclKey,
00134                 "",
00135                 NULL,
00136                 NULL,
00137                 reinterpret_cast<PUCHAR>(tclLibFullPath),
00138                 &max_path);
00139
00140             RegCloseKey(topTclKey);
00141
00142             if (result == ERROR_SUCCESS)
00143             {
00144                 CString s(tclLibFullPath);
00145                 s.Replace("tk", "tcl");
00146                 strcpy(tclLibFullPath, s);
00147                 char *tmp = strrchr(tclLibFullPath, ',');
00148                 if(tmp != 0L)
00149                     *tmp = '\0';
00150                 return tclLibFullPath;
00151             }
00152         }
00153
00154         if (result != ERROR_SUCCESS)
00155         {
00156             std::string err("The registry path (HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl) does not exist.");
00157             err.append("  Redo your Tcl install or, assuming you compiled your own core, read /win/README from the source distribution.");
00158             throw err;
00159         }
00160     }
00161
00162     // Read all SubKey names
00163  enumAgain:
00164     result = RegEnumKey(topTclKey, i, sSubKey, MAX_PATH);
00165     if (result != ERROR_NO_MORE_ITEMS) {
00166         vers.push_back(std::string(sSubKey));
00167         i++; goto enumAgain;
00168     }
00169     else if (i == 0)
00170     {
00171         std::string err("The registry path (HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl) has no SubKeys.");
00172         err.append("  Reinstall Tcl to fix this or hand edit your registry.");
00173         RegCloseKey(topTclKey);
00174         throw err;
00175     }
00176
00177     // sort version strings
00178     std::sort(vers.begin(), vers.end(), verLess);
00179
00180     // remove all invalid entries based on flags.
00181     versNewLast = std::remove_if(vers.begin(), vers.end(), verRemove);
00182
00183     if (vers.begin() != versNewLast)
00184         verTarget = (versNewLast - 1)->c_str();
00185     else
00186     {
00187         std::string err("Unable to locate a proper Tcl core in the registry for version ");
00188         err.append(minVer);
00189         if (exact != 0)
00190             err.append(".");
00191         else
00192             err.append(" or greater.");
00193         RegCloseKey(topTclKey);
00194         throw err;
00195     }
00196
00197     result = RegOpenKeyEx(topTclKey,
00198         verTarget,
00199         0,
00200         KEY_READ,
00201         &subTclVer);
00202
00203     if (result != ERROR_SUCCESS)
00204     {
00205         std::string err("The registry path (HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl<target>) does not exist.");
00206         err.append("  Redo your Tcl install or, assuming you compiled your own core, read /win/README from the source distribution.");
00207         RegCloseKey(topTclKey);
00208         throw err;
00209     }
00210
00211     result = RegQueryValueEx(subTclVer,
00212         "Root",
00213         NULL,
00214         NULL,
00215         reinterpret_cast<PUCHAR>(tclLibFullPath),
00216         &max_path);
00217
00218     if (result != ERROR_SUCCESS)
00219     {
00220         std::string err("The registry path (HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\");
00221         err.append(verTarget);
00222         err.append(") did not have a \"Root\" SubKey.");
00223         RegCloseKey(topTclKey);
00224         RegCloseKey(subTclVer);
00225         throw err;
00226     };
00227
00228     pos1 = tclLibFullPath;
00229     while (*pos1 != '\0') { pos1++; }
00230
00231     // Append the bin directory and prefix
00232     pos2 = prefix;
00233     while (*pos2 != '\0') { *pos1++ = *pos2++; };
00234     savedPos = pos1;
00235
00236     // Build the end of the filename
00237     buildTail(savedPos, verTarget, dbgOnly);
00238
00239     // See if it *really* exists
00240     hFind = ::FindFirstFile(tclLibFullPath, &hFFData);
00241
00242     if (hFind != INVALID_HANDLE_VALUE) {
00243         // gotcha.
00244         ::FindClose(hFind);
00245         RegCloseKey(topTclKey);
00246         RegCloseKey(subTclVer);
00247         return tclLibFullPath;
00248     }
00249     else
00250     {
00251         ::FindClose(hFind);
00252         std::string err("The registry key (HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\");
00253         err.append(minVer);
00254         err.append("\\Root) said a core was located at (");
00255         err.append(tclLibFullPath);
00256         err.append(").  This was found to be false.");
00257         RegCloseKey(topTclKey);
00258         RegCloseKey(subTclVer);
00259         throw err;
00260     }
00261
00262     RegCloseKey(topTclKey);
00263     RegCloseKey(subTclVer);
00264     throw std::string("A proper Tcl core could not be found anywhere.");
00265     return NULL;
00266 }

bool verLess | ( | std::string & | a,
 |  | std::string & | b
 | ) | [static]

Definition at line 337 of file findtcl.cpp.

Referenced by fileLess().

00337                                                 {
00338     double fa, fb;
00339     fa = atof(a.c_str());
00340     fb = atof(b.c_str());
00341     return (fa < fb);
00342 };

bool verRemove ( std::string & s ) [static]

Definition at line 318 of file findtcl.cpp.

Referenced by fileRemove().

00319 {
00320     double fa, fb;
00321     fa = atof(s.c_str());
00322     fb = atof(minVer);
00323
00324     if (exact == 0)
00325     {
00326         // remove when major version is different.
00327         if ((int)fa != (int)fb)
00328             return true;
00329         // remove when less than minor version
00330         return (fa - (int)fa < fb - (int)fb);
00331     }
00332     else
00333         // remove when not identical for an exact match
00334         return (fa != fb);
00335 };

Variable Documentation

int dbgOnly [static]

Definition at line 22 of file findtcl.cpp.

int exact [static]

Definition at line 21 of file findtcl.cpp.

char* minVer [static]

Definition at line 20 of file findtcl.cpp.

Generated on Sun Oct 21 12:45:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GraphDoc.cpp File Reference

WinCvs/GraphDoc.cpp File Reference

#include "stdafx.h"
#include <direct.h>
#include <sys/stat.h>
#include "Wincvs.h"
#include "GraphDoc.h"
#include "CvsLog.h"
#include "WinCvsView.h"
#include "GraphView.h"
#include "CvsEntries.h"

Include dependency graph for GraphDoc.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void | NormalizeFn (const char *folder, const char *fn, char *dir, char *name)

Variables

const IID | IID_ITest

Function Documentation

void NormalizeFn | ( | const char * | folder,
 |  | const char * | fn,
 |  | char * | dir,
 |  | char * | name
 | ) | [static]

Definition at line 121 of file GraphDoc.cpp.

Referenced by CGraphDoc::SetNode().

00122 {
00123     char buffer[_MAX_PATH];
00124     char dirBuffer[_MAX_PATH];
00125     char nameBuffer[_MAX_PATH];
00126     char drive[_MAX_PATH];
00127     char ext[_MAX_EXT];
00128     _makepath(buffer, NULL, folder, fn, NULL);
00129     _splitpath(buffer, drive, dirBuffer, nameBuffer, ext);
00130     _makepath(dir, drive, dirBuffer, NULL, NULL);
00131     _makepath(name, NULL, NULL, nameBuffer, ext);
00132 }

Variable Documentation

const IID IID_ITest [static]

Initial value:

{ 0x9f456b5, 0x18, 0x11d2, { 0xbc, 0xaa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }

Definition at line 68 of file GraphDoc.cpp.

Generated on Sun Oct 21 12:45:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GraphDoc.h File Reference

WinCvs/GraphDoc.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CGraphDoc

Defines

#define | AFX_GRAPHDOC_H__09F456C1_0018_11D2_BCAA_000000000000__INCLUDED_

Define Documentation

#define AFX_GRAPHDOC_H__09F456C1_0018_11D2_BCAA_000000000000__INCLUDED_

Definition at line 26 of file GraphDoc.h.

Generated on Sun Oct 21 12:45:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GraphFrm.cpp File Reference

WinCvs/GraphFrm.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "GraphFrm.h"
#include "GraphView.h"
#include "WinCvsView.h"
#include "MainFrm.h"

Include dependency graph for GraphFrm.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GraphFrm.h File Reference

WinCvs/GraphFrm.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CGraphFrame

Defines

#define | AFX_GRAPHFRM_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_

Define Documentation

#define AFX_GRAPHFRM_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_

Definition at line 26 of file GraphFrm.h.

Generated on Sun Oct 21 12:45:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GraphView.cpp File Reference

WinCvs/GraphView.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "GraphView.h"
#include "GraphDoc.h"
#include "AppConsole.h"
#include "LogParse.h"
#include "CvsEntries.h"
#include "BrowseFileView.h"
#include "WinCvsBrowser.h"
#include "CvsArgs.h"
#include "AppGlue.h"
#include "WincvsView.h"
#include "CvsPrefs.h"
#include "FileTraversal.h"
#include "ProgressDialog.h"
#include "GraphOptDlg.h"
#include "AdminOptionDlg.h"
#include "CvsAlert.h"
#include "CvsCommands.h"

Include dependency graph for GraphView.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CGraphConsole
class | CGraphRectTracker
class | CRevisionConsole
class | TGraph
class | TGraphCmdStatus
class | TGraphDelCmd
class | TGraphRectSelect
class | TGraphSelNonSig
class | CWinLogBranchData
class | CWinLogData
class | CWinLogHeaderData
class | CWinLogRevData
class | CWinLogTagData

Enumerations

enum | kTGraph { kTContinue, kTGetDown, kTStop }

Functions

CPersistentInt | gGraphSelColor ("P_GraphSelColor", RGB(160, 160, 160))
CPersistentInt | gGraphShadowColor ("P_GraphShadowColor", RGB(128, 128, 128))
CPersistentInt | gGraphHeaderColor ("P_GraphHeaderColor", RGB(255, 0, 0))
CPersistentInt | gGraphTagColor ("P_GraphTagColor", RGB(0, 0, 0))
CPersistentInt | gGraphBranchColor ("P_GraphBranchColor", RGB(0, 0, 255))
CPersistentInt | gGraphNodeColor ("P_GraphNodeColor", RGB(0, 0, 255))
CPersistentInt | gGraphDeadNodeColor ("P_GraphDeadNodeColor", RGB(255, 0, 0))
CPersistentInt | gGraphUserStateNodeColor ("P_GraphUserStateNodeColor", RGB(0, 128, 64))
void | DrawOctangle (CDC &hdc, const CRect &selfB)
helper function to draw the figure used for branch tag representation. More...

void | DrawNode (CDC &hdc, const CRect &selfB, COLORREF contour, kNodeShape shape, bool issel, int penStyle=PS_SOLID)

Variables

const int | kVChildSpace = 8
const int | kHChildSpace = 40
const int | kInflateNodeSpace = 8

Enumeration Type Documentation

enum kTGraph

Enumeration values:
kTContinue
kTGetDown
kTStop

Definition at line 903 of file GraphView.cpp.

00904 {
00905     kTContinue,
00906     kTGetDown,
00907     kTStop
00908 } kTGraph;

Function Documentation

void DrawNode | ( | CDC & | hdc,
 |  | const CRect & | selfB,
 |  | COLORREF | contour,
 |  | kNodeShape | shape,
 |  | bool | issel,
 |  | int | penStyle = PS_SOLID
 | ) | [static]

Definition at line 237 of file GraphView.cpp.

00240 {
00241     CPen *pOldPen = 0L;
00242     CBrush *pOldBrush = 0L;
00243     CPen pen, pen2;
00244     CBrush brush;
00245     COLORREF selcolor = gGraphSelColor;
00246     COLORREF shadowc = gGraphShadowColor;
00247
00248     TRY
00249     {
00250         //prepare the shadow
00251         CRect shadow = selfB;
00252         shadow.OffsetRect(SHADOW_OFFSET_PT);
00253
00254         brush.CreateSolidBrush(shadowc);
00255         pOldBrush = hdc.SelectObject(&brush);
00256         pen.CreatePen(penStyle, 1, shadowc);
00257         pOldPen = hdc.SelectObject(&pen);
00258
00259         //draw the shadow
00260         switch( shape )
00261         {
00262         case kRectangle:
00263             hdc.Rectangle(shadow);
00264             break;
00265         case kRoundRect:
00266             hdc.RoundRect(shadow, ROUND_RECT_PT);
00267             break;
00268         case kOctangle:
00269             DrawOctangle(hdc, shadow);
00270             break;
00271         default:
00272             ASSERT(FALSE);  //unknown type
00273             return;
00274         }
00275
00276         //prepare selection
00277         if( issel )
00278         {
00279             brush.DeleteObject();
00280             brush.CreateSolidBrush(selcolor);
00281             hdc.SelectObject(&brush);
00282         }
00283         else
00284         {
00285             hdc.SelectObject(pOldBrush);
00286             pOldBrush = 0L;
00287         }
00288
00289         pen2.CreatePen(penStyle, 1, contour);
00290         hdc.SelectObject(&pen2);
00291
00292         //draw the main shape
00293         switch( shape )
00294         {
00295         case kRectangle:
00296             hdc.Rectangle(selfB);
00297             break;
00298         case kRoundRect:
00299             hdc.RoundRect(selfB, ROUND_RECT_PT);
00300             break;
00301         case kOctangle:
00302             DrawOctangle(hdc, selfB);
00303             break;
00304         default:
00305             ASSERT(FALSE);  //unknown type
00306             return;
00307         }
00308
00309         //cleanup
00310         if (pOldPen != 0L)
00311         {
00312             hdc.SelectObject(pOldPen);
00313             pOldPen = 0L;
00314         }
00315         if (pOldBrush != 0L)
00316         {
00317             hdc.SelectObject(pOldBrush);
00318             pOldBrush = 0L;
00319         }
00320
00321         pen.DeleteObject();
00322         pen2.DeleteObject();
00323         brush.DeleteObject();
00324     }
00325     CATCH_ALL(e)
00326     {
00327         if (pOldPen != 0L)
00328             hdc.SelectObject(pOldPen);
00329         if (pOldBrush != 0L)
00330             hdc.SelectObject(pOldBrush);
00331     }
00332     END_CATCH_ALL
00333 }

void DrawOctangle | ( | CDC & | hdc,
 |  | const CRect & | selfB
 | ) | [static]

helper function to draw the figure used for branch tag representation.

Definition at line 213 of file GraphView.cpp.

Referenced by DrawNode().

00214 {
00215     int cutLen = selfB.Height() / 4;
00216     CPoint point1(selfB.left, selfB.top + cutLen);
00217     CPoint point2(selfB.left + cutLen, selfB.top);
00218     CPoint point3(selfB.right - cutLen, selfB.top);
00219     CPoint point4(selfB.right, selfB.top + cutLen);
00220     CPoint point5(selfB.right, selfB.bottom - cutLen);
00221     CPoint point6(selfB.right - cutLen, selfB.bottom);
00222     CPoint point7(selfB.left + cutLen, selfB.bottom);
00223     CPoint point8(selfB.left, selfB.bottom - cutLen);
00224     CPoint arrPoints[OCTANGLE_COUNT] = {
00225         point1,
00226         point2,
00227         point3,
00228         point4,
00229         point5,
00230         point6,
00231         point7,
00232         point8};
00233
00234     hdc.Polygon(arrPoints, OCTANGLE_COUNT);
00235 }

CPersistentInt gGraphBranchColor | ( | "P_GraphBranchColor" | ,
 |  | RGB(0, 0, 255) |
 | ) |

CPersistentInt gGraphDeadNodeColor | ( | "P_GraphDeadNodeColor" | ,
 |  | RGB(255, 0, 0) |
 | ) |

CPersistentInt gGraphHeaderColor | ( | "P_GraphHeaderColor" | ,
 |  | RGB(255, 0, 0) |
 | ) |

CPersistentInt gGraphNodeColor | ( | "P_GraphNodeColor" | ,
 |  | RGB(0, 0, 255) |
 | ) |

CPersistentInt gGraphSelColor | ( | "P_GraphSelColor" | ,
 |  | RGB(160, 160, 160) |
 | ) |

CPersistentInt gGraphShadowColor | ( | "P_GraphShadowColor" | ,
 |  | RGB(128, 128, 128) |
 | ) |

CPersistentInt gGraphTagColor | ( | "P_GraphTagColor" | ,
 |  | RGB(0, 0, 0) |
 | ) |

CPersistentInt gGraphUserStateNodeColor | ( | "P_GraphUserStateNodeColor" | ,
 |  | RGB(0, 128, 64) |
 | ) |

Variable Documentation

const int kHChildSpace = 40

Definition at line 553 of file GraphView.cpp.

const int kInflateNodeSpace = 8

Definition at line 554 of file GraphView.cpp.

const int kVChildSpace = 8

Definition at line 552 of file GraphView.cpp.

Generated on Sun Oct 21 12:45:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GraphView.h File Reference

WinCvs/GraphView.h File Reference

#include "CvsLog.h"

Include dependency graph for GraphView.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CGraphView

Defines

#define | AFX_GRAPHVIEW_H__7A07C311_03F9_11D2_BCB2_000000000000__INCLUDED_
#define | STARTPOINT_PT (CPoint(5, 5))
#define | OCTANGLE_COUNT 8
#define | SHADOW_OFFSET_PT (CPoint(4, 4))
#define | ROUND_RECT_PT (CPoint(6, 6))
#define | RGB_DEF_SEL RGB(160, 160, 160)
#define | RGB_DEF_SHADOW RGB(128, 128, 128)
#define | RGB_DEF_HEADER RGB(255, 0, 0)
#define | RGB_DEF_TAG RGB(0, 0, 0)
#define | RGB_DEF_BRANCH RGB(0, 0, 255)
#define | RGB_DEF_NODE RGB(0, 0, 255)
#define | RGB_DEF_DEADNODE RGB(255, 0, 0)
#define | RGB_DEF_USERSTATENODE RGB(0, 128, 64)
#define | STYLE_DEADNODE PS_DOT
#define | STYLE_USERSTATENODE PS_DASH

Enumerations

enum | kNodeShape { kRectangle, kRoundRect, kOctangle }

Define Documentation

#define AFX_GRAPHVIEW_H__7A07C311_03F9_11D2_BCB2_000000000000__INCLUDED_

Definition at line 18 of file GraphView.h.

#define OCTANGLE_COUNT 8

Definition at line 30 of file GraphView.h.

#define RGB_DEF_BRANCH RGB(0, 0, 255)

Definition at line 38 of file GraphView.h.

#define RGB_DEF_DEADNODE RGB(255, 0, 0)

Definition at line 40 of file GraphView.h.

#define RGB_DEF_HEADER RGB(255, 0, 0)

Definition at line 36 of file GraphView.h.

#define RGB_DEF_NODE RGB(0, 0, 255)

Definition at line 39 of file GraphView.h.

#define RGB_DEF_SEL RGB(160, 160, 160)

Definition at line 34 of file GraphView.h.

#define RGB_DEF_SHADOW RGB(128, 128, 128)

Definition at line 35 of file GraphView.h.

#define RGB_DEF_TAG RGB(0, 0, 0)

Definition at line 37 of file GraphView.h.

#define RGB_DEF_USERSTATENODE RGB(0, 128, 64)

Definition at line 41 of file GraphView.h.

#define ROUND_RECT_PT (CPoint(6, 6))

Definition at line 32 of file GraphView.h.

#define SHADOW_OFFSET_PT (CPoint(4, 4))

Definition at line 31 of file GraphView.h.

#define STARTPOINT_PT (CPoint(5, 5))

Definition at line 28 of file GraphView.h.

#define STYLE_DEADNODE PS_DOT

Definition at line 42 of file GraphView.h.

#define STYLE_USERSTATENODE PS_DASH

Definition at line 43 of file GraphView.h.

Enumeration Type Documentation

enum kNodeShape

Enumeration values:
kRectangle
kRoundRect
kOctangle

Definition at line 45 of file GraphView.h.

00046 {
00047     kRectangle,
00048     kRoundRect,
00049     kOctangle
00050 } kNodeShape;

Generated on Sun Oct 21 12:45:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


HistComboBoxEx.cpp File Reference

WinCvs/HistComboBoxEx.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "HistComboBoxEx.h"
#include "FileTraversal.h"
#include "CvsEntries.h"
#include "MainFrm.h"
#include "CvsAlert.h"

Include dependency graph for HistComboBoxEx.cpp:

Include dependency graph

Go to the source code of this file.

Functions

PCPStr | gOldLoc ("P_BrowserLoc","C:\\")
CMString | gHistoryLocs (100,"P_BrowserLocs")
int | TraverseHistory (CHistComboBoxEx &browseHist)

Function Documentation

int TraverseHistory ( CHistComboBoxEx & browseHist )

Definition at line 42 of file HistComboBoxEx.cpp.

Referenced by CHistComboBoxEx::OnDropdown().

00043 {
00044     char szPath[MAX_PATH] = "";
00045     for( int nIndex = 0; nIndex < browseHist.GetCount(); nIndex++ )
00046     {
00047         COMBOBOXEXITEM cbi;
00048         cbi.mask = CBEIF_TEXT;
00049         cbi.iItem = nIndex;
00050         cbi.pszText = szPath;
00051         cbi.cchTextMax = MAX_PATH;
00052
00053         browseHist.GetItem(&cbi);
00054         browseHist.SetIcon(cbi);
00055     }
00056
00057     return nIndex;
00058 }

CMString gHistoryLocs | ( | 100 | ,
 |  | "P_BrowserLocs" |
 | ) | [static]

PCPStr gOldLoc | ( | "P_BrowserLoc" | ,
 |  | "C:\\" |
 | ) | [static]

Generated on Sun Oct 21 12:45:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


HistComboBoxEx.h File Reference

WinCvs/HistComboBoxEx.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CHistComboBoxEx

Defines

#define | AFX_HISTCOMBOBOXEX_H__E330E7B9_8C79_44CB_8F07_01D395975365__INCLUDED_
#define | HISTLOC_IMAGE_CX 16
#define | HISTLOC_VISIBLEITEMS 8

Enumerations

enum {
kLocationIconUnknown = 0, kLocationIcon, kLocationIconIgnored, kLocationIconMissing,
kLocationIconErased
}

Define Documentation

#define AFX_HISTCOMBOBOXEX_H__E330E7B9_8C79_44CB_8F07_01D395975365__INCLUDED_

Definition at line 22 of file HistComboBoxEx.h.

#define HISTLOC_IMAGE_CX 16

Definition at line 30 of file HistComboBoxEx.h.

#define HISTLOC_VISIBLEITEMS 8

Definition at line 31 of file HistComboBoxEx.h.

Enumeration Type Documentation

anonymous enum

Enumeration values:
kLocationIconUnknown
kLocationIcon
kLocationIconIgnored
kLocationIconMissing
kLocationIconErased

Definition at line 33 of file HistComboBoxEx.h.

00034 {
00035     kLocationIconUnknown = 0,
00036     kLocationIcon,
00037     kLocationIconIgnored,
00038     kLocationIconMissing,
00039     kLocationIconErased
00040 };

Generated on Sun Oct 21 12:45:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LogFrm.cpp File Reference

WinCvs/LogFrm.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "LogFrm.h"
#include "WinCvsBrowser.h"
#include "BrowseFileView.h"
#include "WincvsView.h"
#include "MainFrm.h"
#include "wincvs_winutil.h"

Include dependency graph for LogFrm.cpp:

Include dependency graph

Go to the source code of this file.

Functions

BOOL IsKeyMovingFocus (MSG *pMsg)

Function Documentation

BOOL IsKeyMovingFocus ( MSG * pMsg ) [inline]

Definition at line 44 of file LogFrm.cpp.

00045 {
00046      return ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_TAB) &&
00047          (!(0x8000 & GetKeyState(VK_CONTROL)))
00048          );
00049 }

Generated on Sun Oct 21 12:45:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LogFrm.h File Reference

WinCvs/LogFrm.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CLogFrame

Defines

#define | AFX_CHILDFRM_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_

Define Documentation

#define AFX_CHILDFRM_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_

Definition at line 26 of file LogFrm.h.

Generated on Sun Oct 21 12:45:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MainFrm.cpp File Reference

WinCvs/MainFrm.cpp File Reference

#include "stdafx.h"
#include <afxmt.h>
#include "wincvs.h"
#include "MainFrm.h"
#include "WinCvsBrowser.h"
#include "BrowseFileView.h"
#include "WincvsView.h"
#include "Persistent.h"
#include "AppConsole.h"
#include "Splash.h"
#include "BrowserBar.h"
#include "ExploreBar.h"
#include "CvsPrefs.h"
#include "AppGlue.h"

Include dependency graph for MainFrm.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CWinPlacement

Functions

bool | IsAppEnabled ()
CWinPlacement | gMainPlacement ("P_MainPlacement")
void | onFilterMaskEntered (CObject *obj)
CSemaphore | sGetEnv (0)

Variables

UINT | indicators []
bool | sAskingMainThread
UStr sGetEnvResult

Function Documentation

bool IsAppEnabled ( ) [static]

Definition at line 50 of file MainFrm.cpp.

Referenced by CMainFrame::OnUpdateFilterMask(), CMainFrame::OnUpdateHistory(), CMainFrame::OnUpdateViewAdded(), CMainFrame::OnUpdateViewChanged(), CMainFrame::OnUpdateViewConflict(), CMainFrame::OnUpdateViewHideunknown(), CMainFrame::OnUpdateViewIgnore(), CMainFrame::OnUpdateViewMissing(), CMainFrame::OnUpdateViewModified(), CMainFrame::OnUpdateViewRecursive(), CMainFrame::OnUpdateViewRemoved(), and CMainFrame::OnUpdateViewUnknown().

00051 {
00052     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00053     return !app->gCvsRunning && !gCvsPrefs.empty();
00054 }

CWinPlacement gMainPlacement ( "P_MainPlacement" ) [static]

void onFilterMaskEntered ( CObject * obj ) [static]

Definition at line 220 of file MainFrm.cpp.

00221 {
00222     ((CMainFrame *)obj)->OnFilterMaskEntered();
00223 }

CSemaphore sGetEnv ( 0 ) [static]

Variable Documentation

UINT indicators[] [static]

Initial value:

{
    ID_SEPARATOR,
    ID_SEPARATOR,
    ID_INDICATOR_CAPS,
    ID_INDICATOR_NUM,
    ID_INDICATOR_SCRL,
}

Definition at line 159 of file MainFrm.cpp.

bool sAskingMainThread [static]

Definition at line 904 of file MainFrm.cpp.

UStr sGetEnvResult [static]

Definition at line 905 of file MainFrm.cpp.

Generated on Sun Oct 21 12:45:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MainFrm.h File Reference

WinCvs/MainFrm.h File Reference

#include "ConsoleBar.h"
#include "CvsStatusBar.h"
#include "BrowseViewModel.h"
#include "ToolbarCombo.h"
#include "HistComboBoxEx.h"

Include dependency graph for MainFrm.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CMainFrame

Defines

#define | AFX_MAINFRM_H__D2D77DCC_8299_11D1_8949_444553540000__INCLUDED_

Define Documentation

#define AFX_MAINFRM_H__D2D77DCC_8299_11D1_8949_444553540000__INCLUDED_

Definition at line 6 of file MainFrm.h.

Generated on Sun Oct 21 12:45:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ndir.c File Reference

WinCvs/ndir.c File Reference

#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dos.h>
#include <ndir.h>

Include dependency graph for ndir.c:

Include dependency graph

Go to the source code of this file.

Defines

#define | ATTRIBUTES (_A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_SUBDIR)

Functions

void | free_dircontents (struct _dircontents *)
DIR * | opendir (const char *name)
void | closedir (DIR *dirp)
direct * | readdir (DIR *dirp)
void | seekdir (DIR *dirp, long off)
long | telldir (DIR *dirp)

Define Documentation

#define ATTRIBUTES (_A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_SUBDIR)

Definition at line 38 of file ndir.c.

Function Documentation

void closedir ( DIR * dirp )

Definition at line 116 of file ndir.c.

00117 {
00118   free_dircontents (dirp->dd_contents);
00119   free ((char *) dirp);
00120 }

void free_dircontents ( struct _dircontents * dp ) [static]

Definition at line 168 of file ndir.c.

Referenced by closedir(), and opendir().

00169 {
00170   struct _dircontents *odp;
00171
00172   while (dp)
00173     {
00174       if (dp->_d_entry)
00175     free (dp->_d_entry);
00176       dp = (odp = dp)->_d_next;
00177       free (odp);
00178     }
00179 }

DIR* opendir ( const char * name )

Definition at line 43 of file ndir.c.

00044 {
00045   struct _finddata_t find_buf;
00046   DIR *dirp;
00047   struct _dircontents *dp;
00048   char name_buf[_MAX_PATH + 1];
00049   char *slash = "";
00050   long hFile;
00051
00052   if (!name)
00053     name = "";
00054   else if (*name)
00055     {
00056       const char *s;
00057       int l = strlen (name);
00058
00059       s = name + l - 1;
00060       if ( !(l == 2 && *s == ':') && *s != '\\' && *s != '/')
00061     slash = "/";    /* save to insert slash between path and "*.*" */
00062     }
00063
00064   strcat (strcat (strcpy (name_buf, name), slash), "*.*");
00065
00066   dirp = (DIR *) malloc (sizeof (DIR));
00067   if (dirp == (DIR *)0)
00068     return (DIR *)0;
00069
00070   dirp->dd_loc = 0;
00071   dirp->dd_contents = dirp->dd_cp = (struct _dircontents *) 0;
00072
00073   if ((hFile = _findfirst (name_buf, &find_buf)) < 0)
00074     {
00075       free (dirp);
00076       return (DIR *)0;
00077     }
00078
00079   do
00080     {
00081       dp = (struct _dircontents *) malloc (sizeof (struct _dircontents));
00082       if (dp == (struct _dircontents *)0)
00083     {
00084       free_dircontents (dirp->dd_contents);
00085       return (DIR *)0;
00086     }
00087
00088       dp->_d_entry = malloc (strlen (find_buf.name) + 1);
00089       if (dp->_d_entry == (char *)0)
00090     {
00091       free (dp);
00092       free_dircontents (dirp->dd_contents);
00093       return (DIR *)0;
00094     }
00095
00096       if (dirp->dd_contents)
00097     dirp->dd_cp = dirp->dd_cp->_d_next = dp;
00098       else
00099     dirp->dd_contents = dirp->dd_cp = dp;
00100
00101       strcpy (dp->_d_entry, find_buf.name);
00102
00103       dp->_d_next = (struct _dircontents *)0;
00104
00105     } while (!_findnext (hFile, &find_buf));
00106
00107   dirp->dd_cp = dirp->dd_contents;
00108
00109   _findclose(hFile);
00110
00111   return dirp;
00112 }

struct direct* readdir ( DIR * dirp )

Definition at line 124 of file ndir.c.

00125 {
00126   static struct direct dp;
00127
00128   if (dirp->dd_cp == (struct _dircontents *)0)
00129     return (struct direct *)0;
00130   dp.d_namlen = dp.d_reclen =
00131     strlen (strcpy (dp.d_name, dirp->dd_cp->_d_entry));
00132 #if 0 /* JB */
00133   strlwr (dp.d_name);       /* JF */
00134 #endif
00135   dp.d_ino = 0;
00136   dirp->dd_cp = dirp->dd_cp->_d_next;
00137   dirp->dd_loc++;
00138
00139   return &dp;
00140 }

void seekdir | ( | DIR * | dirp,
 |  | long | off
 | ) |

Definition at line 144 of file ndir.c.

00145 {
00146   long i = off;
00147   struct _dircontents *dp;
00148
00149   if (off < 0)
00150     return;
00151   for (dp = dirp->dd_contents; --i >= 0 && dp; dp = dp->_d_next)
00152     ;
00153   dirp->dd_loc = off - (i + 1);
00154   dirp->dd_cp = dp;
00155 }

long telldir ( DIR * dirp )

Definition at line 159 of file ndir.c.

00160 {
00161   return dirp->dd_loc;
00162 }

Generated on Sun Oct 21 12:43:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ndir.c Source File

WinCvs/ndir.c

Go to the documentation of this file.
00001 /*  msd_dir.c - portable directory routines
00002     Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
00003
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 1, or (at your option)
00007     any later version.
00008
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.  */
00013
00014 /* Everything non trivial in this code is from: @(#)msd_dir.c 1.4
00015    87/11/06.  A public domain implementation of BSD directory routines
00016    for MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
00017    August 1897 */
00018
00019 /*
00020  * Modified for WinCvs : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00021  */
00022
00023
00024 #include <io.h>
00025 #include <stdio.h>
00026 #include <stdlib.h>
00027 #include <string.h>
00028 #include <sys/types.h>
00029 #include <sys/stat.h>
00030
00031 #include <dos.h>
00032
00033 #include <ndir.h>
00034
00035 static void free_dircontents (struct _dircontents *);
00036
00037 /* find ALL files! */
00038 #define ATTRIBUTES  (_A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_SUBDIR)
00039
00040
00041
00042 DIR *
00043 opendir (const char *name)
00044 {
00045   struct _finddata_t find_buf;
00046   DIR *dirp;
00047   struct _dircontents *dp;
00048   char name_buf[_MAX_PATH + 1];
00049   char *slash = "";
00050   long hFile;
00051
00052   if (!name)
00053     name = "";
00054   else if (*name)
00055     {
00056       const char *s;
00057       int l = strlen (name);
00058
00059       s = name + l - 1;
00060       if ( !(l == 2 && *s == ':') && *s != '\\' && *s != '/')
00061     slash = "/";    /* save to insert slash between path and "*.*" */
00062     }
00063
00064   strcat (strcat (strcpy (name_buf, name), slash), "*.*");
00065
00066   dirp = (DIR *) malloc (sizeof (DIR));
00067   if (dirp == (DIR *)0)
00068     return (DIR *)0;
00069
00070   dirp->dd_loc = 0;
00071   dirp->dd_contents = dirp->dd_cp = (struct _dircontents *) 0;
00072
00073   if ((hFile = _findfirst (name_buf, &find_buf)) < 0)
00074     {
00075       free (dirp);
00076       return (DIR *)0;
00077     }
00078
00079   do
00080     {
00081       dp = (struct _dircontents *) malloc (sizeof (struct _dircontents));
00082       if (dp == (struct _dircontents *)0)
00083     {
00084       free_dircontents (dirp->dd_contents);
00085       return (DIR *)0;
00086     }
00087
00088       dp->_d_entry = malloc (strlen (find_buf.name) + 1);
00089       if (dp->_d_entry == (char *)0)
00090     {
00091       free (dp);
00092       free_dircontents (dirp->dd_contents);
00093       return (DIR *)0;
00094     }
00095
00096       if (dirp->dd_contents)
00097     dirp->dd_cp = dirp->dd_cp->_d_next = dp;
00098       else
00099     dirp->dd_contents = dirp->dd_cp = dp;
00100
00101       strcpy (dp->_d_entry, find_buf.name);
00102
00103       dp->_d_next = (struct _dircontents *)0;
00104
00105     } while (!_findnext (hFile, &find_buf));
00106
00107   dirp->dd_cp = dirp->dd_contents;
00108
00109   _findclose(hFile);
00110
00111   return dirp;
00112 }
00113
00114
00115 void
00116 closedir (DIR *dirp)
00117 {
00118   free_dircontents (dirp->dd_contents);
00119   free ((char *) dirp);
00120 }
00121
00122
00123 struct direct *
00124 readdir (DIR *dirp)
00125 {
00126   static struct direct dp;
00127
00128   if (dirp->dd_cp == (struct _dircontents *)0)
00129     return (struct direct *)0;
00130   dp.d_namlen = dp.d_reclen =
00131     strlen (strcpy (dp.d_name, dirp->dd_cp->_d_entry));
00132 #if 0 /* JB */
00133   strlwr (dp.d_name);       /* JF */
00134 #endif
00135   dp.d_ino = 0;
00136   dirp->dd_cp = dirp->dd_cp->_d_next;
00137   dirp->dd_loc++;
00138
00139   return &dp;
00140 }
00141
00142
00143 void
00144 seekdir (DIR *dirp, long off)
00145 {
00146   long i = off;
00147   struct _dircontents *dp;
00148
00149   if (off < 0)
00150     return;
00151   for (dp = dirp->dd_contents; --i >= 0 && dp; dp = dp->_d_next)
00152     ;
00153   dirp->dd_loc = off - (i + 1);
00154   dirp->dd_cp = dp;
00155 }
00156
00157
00158 long
00159 telldir (DIR *dirp)
00160 {
00161   return dirp->dd_loc;
00162 }
00163
00164
00165 /* Garbage collection */
00166
00167 static void
00168 free_dircontents (struct _dircontents *dp)
00169 {
00170   struct _dircontents *odp;
00171
00172   while (dp)
00173     {
00174       if (dp->_d_entry)
00175     free (dp->_d_entry);
00176       dp = (odp = dp)->_d_next;
00177       free (odp);
00178     }
00179 }
00180
00181
00182 #ifdef TEST
00183
00184 void main (int argc, char *argv[]);
00185
00186 void
00187 main (int argc, char *argv[])
00188 {
00189   static DIR *directory;
00190   struct direct *entry = (struct direct *)0;
00191
00192   char *name = "";
00193
00194   if (argc > 1)
00195     name = argv[1];
00196
00197   directory = opendir (name);
00198
00199   if (!directory)
00200     {
00201       fprintf (stderr, "can't open directory `%s'.\n", name);
00202       exit (2);
00203     }
00204
00205   while (entry = readdir (directory))
00206     printf ("> %s\n", entry->d_name);
00207
00208   printf ("done.\n");
00209 }
00210
00211 #endif /* TEST */
00212
00213 /*
00214  * Local Variables:
00215  * mode:C
00216  * ChangeLog:ChangeLog
00217  * compile-command:make
00218  * End:
00219  */
Generated on Sun Oct 21 12:41:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ndir.h File Reference

WinCvs/ndir.h File Reference

#include <sys/types.h>

Include dependency graph for ndir.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | _dircontents
struct | _dirdesc
struct | direct

Defines

#define | rewinddir(dirp) seekdir(dirp, 0L)
#define | MAXNAMLEN 255

Typedefs

typedef _dirdesc | DIR

Functions

void | seekdir (DIR *, long)
long | telldir (DIR *)
DIR * | opendir (const char *)
void | closedir (DIR *)
direct * readdir (DIR *)

Define Documentation

#define MAXNAMLEN 255

Definition at line 37 of file ndir.h.

#define rewinddir ( dirp ) seekdir(dirp, 0L)

Definition at line 32 of file ndir.h.

Typedef Documentation

typedef struct _dirdesc DIR

Function Documentation

void closedir ( DIR * dirp )

Definition at line 116 of file ndir.c.

00117 {
00118   free_dircontents (dirp->dd_contents);
00119   free ((char *) dirp);
00120 }

DIR* opendir ( const char * name )

Definition at line 43 of file ndir.c.

00044 {
00045   struct _finddata_t find_buf;
00046   DIR *dirp;
00047   struct _dircontents *dp;
00048   char name_buf[_MAX_PATH + 1];
00049   char *slash = "";
00050   long hFile;
00051
00052   if (!name)
00053     name = "";
00054   else if (*name)
00055     {
00056       const char *s;
00057       int l = strlen (name);
00058
00059       s = name + l - 1;
00060       if ( !(l == 2 && *s == ':') && *s != '\\' && *s != '/')
00061     slash = "/";    /* save to insert slash between path and "*.*" */
00062     }
00063
00064   strcat (strcat (strcpy (name_buf, name), slash), "*.*");
00065
00066   dirp = (DIR *) malloc (sizeof (DIR));
00067   if (dirp == (DIR *)0)
00068     return (DIR *)0;
00069
00070   dirp->dd_loc = 0;
00071   dirp->dd_contents = dirp->dd_cp = (struct _dircontents *) 0;
00072
00073   if ((hFile = _findfirst (name_buf, &find_buf)) < 0)
00074     {
00075       free (dirp);
00076       return (DIR *)0;
00077     }
00078
00079   do
00080     {
00081       dp = (struct _dircontents *) malloc (sizeof (struct _dircontents));
00082       if (dp == (struct _dircontents *)0)
00083     {
00084       free_dircontents (dirp->dd_contents);
00085       return (DIR *)0;
00086     }
00087
00088       dp->_d_entry = malloc (strlen (find_buf.name) + 1);
00089       if (dp->_d_entry == (char *)0)
00090     {
00091       free (dp);
00092       free_dircontents (dirp->dd_contents);
00093       return (DIR *)0;
00094     }
00095
00096       if (dirp->dd_contents)
00097     dirp->dd_cp = dirp->dd_cp->_d_next = dp;
00098       else
00099     dirp->dd_contents = dirp->dd_cp = dp;
00100
00101       strcpy (dp->_d_entry, find_buf.name);
00102
00103       dp->_d_next = (struct _dircontents *)0;
00104
00105     } while (!_findnext (hFile, &find_buf));
00106
00107   dirp->dd_cp = dirp->dd_contents;
00108
00109   _findclose(hFile);
00110
00111   return dirp;
00112 }

struct direct* readdir ( DIR * dirp )

Definition at line 124 of file ndir.c.

00125 {
00126   static struct direct dp;
00127
00128   if (dirp->dd_cp == (struct _dircontents *)0)
00129     return (struct direct *)0;
00130   dp.d_namlen = dp.d_reclen =
00131     strlen (strcpy (dp.d_name, dirp->dd_cp->_d_entry));
00132 #if 0 /* JB */
00133   strlwr (dp.d_name);       /* JF */
00134 #endif
00135   dp.d_ino = 0;
00136   dirp->dd_cp = dirp->dd_cp->_d_next;
00137   dirp->dd_loc++;
00138
00139   return &dp;
00140 }

void seekdir | ( | DIR * | dirp,
 |  | long | off
 | ) |

Definition at line 144 of file ndir.c.

00145 {
00146   long i = off;
00147   struct _dircontents *dp;
00148
00149   if (off < 0)
00150     return;
00151   for (dp = dirp->dd_contents; --i >= 0 && dp; dp = dp->_d_next)
00152     ;
00153   dirp->dd_loc = off - (i + 1);
00154   dirp->dd_cp = dp;
00155 }

long telldir ( DIR * dirp )

Definition at line 159 of file ndir.c.

00160 {
00161   return dirp->dd_loc;
00162 }

Generated on Sun Oct 21 12:43:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ndir.h Source File

WinCvs/ndir.h

Go to the documentation of this file.
00001 /*  ndir.c - portable directory routines
00002     Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
00003
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 1, or (at your option)
00007     any later version.
00008
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.  */
00013
00014 /* Everything non trivial in this code is taken from: @(#)msd_dir.c 1.4
00015    87/11/06.  A public domain implementation of BSD directory routines
00016    for MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
00017    August 1897 */
00018
00019 /*
00020  * Modified for WinCvs : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00021  */
00022
00023 #if _MSC_VER > 1000
00024 #pragma once
00025 #endif
00026
00027 #ifndef _NDIR_H
00028 #define _NDIR_H
00029
00030 #include <sys/types.h>  /* ino_t definition */
00031
00032 #define rewinddir(dirp) seekdir(dirp, 0L)
00033
00034 /* 255 is said to be big enough for Windows NT.  The more elegant
00035    solution would be declaring d_name as one byte long and allocating
00036    it to the actual size needed.  */
00037 #define MAXNAMLEN   255
00038
00039 struct direct
00040 {
00041   ino_t d_ino;          /* a bit of a farce */
00042   int d_reclen;         /* more farce */
00043   int d_namlen;         /* length of d_name */
00044   char d_name[MAXNAMLEN + 1];   /* garentee null termination */
00045 };
00046
00047 struct _dircontents
00048 {
00049   char *_d_entry;
00050   struct _dircontents *_d_next;
00051 };
00052
00053 typedef struct _dirdesc
00054 {
00055   int dd_id;            /* uniquely identify each open directory */
00056   long dd_loc;          /* where we are in directory entry is this */
00057   struct _dircontents *dd_contents; /* pointer to contents of dir */
00058   struct _dircontents *dd_cp;   /* pointer to current position */
00059 } DIR;
00060
00061 #ifdef __cplusplus
00062 extern "C" {
00063 #endif /* __cplusplus */
00064
00065 extern void seekdir (DIR *, long);
00066 extern long telldir (DIR *);
00067 extern DIR *opendir (const char *);
00068 extern void closedir (DIR *);
00069 extern struct direct *readdir (DIR *);
00070
00071 #ifdef __cplusplus
00072 }
00073 #endif /* __cplusplus */
00074
00075
00076 /*
00077  * Local Variables:
00078  * mode:C
00079  * ChangeLog:ChangeLog
00080  * compile-command:make
00081  * End:
00082  */
00083 #endif /* _NDIR_H */
Generated on Sun Oct 21 12:41:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/NoPython.cpp Source File

WinCvs/NoPython.cpp

Go to the documentation of this file.
00001 // NoPython.cpp : implementation file
00002 //
00003
00004 #include "stdafx.h"
00005 #include "wincvs.h"
00006 #include "NoPython.h"
00007 #include "Persistent.h"
00008 #include "Splash.h"
00009
00010 #ifdef _DEBUG
00011 #define new DEBUG_NEW
00012 #undef THIS_FILE
00013 static char THIS_FILE[] = __FILE__;
00014 #endif
00015
00016 static CPersistentBool gWarnPython("P_WarnPython", true);
00017
00019 // CNoPython dialog
00020
00021
00022 CNoPython::CNoPython(CWnd* pParent /*=NULL*/)
00023     : CDialog(CNoPython::IDD, pParent)
00024 {
00025     //{{AFX_DATA_INIT(CNoPython)
00026     m_remind = TRUE;
00027     //}}AFX_DATA_INIT
00028 }
00029
00030
00031 void CNoPython::DoDataExchange(CDataExchange* pDX)
00032 {
00033     CDialog::DoDataExchange(pDX);
00034     //{{AFX_DATA_MAP(CNoPython)
00035     DDX_Control(pDX, IDC_PYTHONURL, m_url);
00036     DDX_Check(pDX, IDC_REMIND, m_remind);
00037     //}}AFX_DATA_MAP
00038 }
00039
00040
00041 BEGIN_MESSAGE_MAP(CNoPython, CDialog)
00042     //{{AFX_MSG_MAP(CNoPython)
00043     //}}AFX_MSG_MAP
00044 END_MESSAGE_MAP()
00045
00047 // CNoPython message handlers
00048
00049 BOOL CNoPython::OnInitDialog()
00050 {
00051     CDialog::OnInitDialog();
00052
00053     m_url.SetURL(_T("http://www.python.org"));
00054
00055     return TRUE;  // return TRUE unless you set the focus to a control
00056                   // EXCEPTION: OCX Property Pages should return FALSE
00057 }
00058
00059 void WarnNoPython(void)
00060 {
00061     if((bool)gWarnPython)
00062     {
00063         // because it conflicts
00064         CSplashWnd::CloseSplashScreen();
00065
00066         CNoPython dlg;
00067         dlg.DoModal();
00068         if(!dlg.m_remind)
00069             gWarnPython = false;
00070     }
00071 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/NoPython.h Source File

WinCvs/NoPython.h

Go to the documentation of this file.
00001 #if !defined(AFX_NOPYTHON_H__F675DE42_0FA7_4785_8946_E8FC861BBA57__INCLUDED_)
00002 #define AFX_NOPYTHON_H__F675DE42_0FA7_4785_8946_E8FC861BBA57__INCLUDED_
00003
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 // NoPython.h : header file
00008 //
00009
00010 void WarnNoPython(void);
00011
00013 // CNoPython dialog
00014
00015 class CNoPython : public CDialog
00016 {
00017 // Construction
00018 public:
00019     CNoPython(CWnd* pParent = NULL);   // standard constructor
00020
00021 // Dialog Data
00022     //{{AFX_DATA(CNoPython)
00023     enum { IDD = IDD_NOPYTHON };
00024     CCJHyperLink m_url;
00025     BOOL    m_remind;
00026     //}}AFX_DATA
00027
00028
00029 // Overrides
00030     // ClassWizard generated virtual function overrides
00031     //{{AFX_VIRTUAL(CNoPython)
00032     protected:
00033     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00034     //}}AFX_VIRTUAL
00035
00036 // Implementation
00037 protected:
00038
00039     // Generated message map functions
00040     //{{AFX_MSG(CNoPython)
00041     virtual BOOL OnInitDialog();
00042     //}}AFX_MSG
00043     DECLARE_MESSAGE_MAP()
00044 };
00045
00046 //{{AFX_INSERT_LOCATION}}
00047 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00048
00049 #endif // !defined(AFX_NOPYTHON_H__F675DE42_0FA7_4785_8946_E8FC861BBA57__INCLUDED_)
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ProgressDialog.cpp Source File

WinCvs/ProgressDialog.cpp

Go to the documentation of this file.
00001 // ProgressDialog.cpp : implementation file
00002 //
00003
00004 #include "stdafx.h"
00005 #include "wincvs.h"
00006 #include "ProgressDialog.h"
00007
00008 #ifdef _DEBUG
00009 #define new DEBUG_NEW
00010 #undef THIS_FILE
00011 static char THIS_FILE[] = __FILE__;
00012 #endif
00013
00015 // CProgressDialog dialog
00016
00017
00018 CProgressDialog::CProgressDialog(bool & abort, bool interruptable, CWnd* pParent /*=NULL*/)
00019     : m_abort(abort), m_stopable(interruptable), m_pParent(pParent), hWndParent(0L),
00020     CDialog(CProgressDialog::IDD, pParent)
00021 {
00022     //{{AFX_DATA_INIT(CProgressDialog)
00023         // NOTE: the ClassWizard will add member initialization here
00024     //}}AFX_DATA_INIT
00025 }
00026
00027
00028 void CProgressDialog::DoDataExchange(CDataExchange* pDX)
00029 {
00030     CDialog::DoDataExchange(pDX);
00031     //{{AFX_DATA_MAP(CProgressDialog)
00032     DDX_Control(pDX, IDC_PROGRESS, m_progress);
00033     //}}AFX_DATA_MAP
00034 }
00035
00036
00037 BEGIN_MESSAGE_MAP(CProgressDialog, CDialog)
00038     //{{AFX_MSG_MAP(CProgressDialog)
00039     //}}AFX_MSG_MAP
00040 END_MESSAGE_MAP()
00041
00043 // CProgressDialog message handlers
00044
00045 void CProgressDialog::PostNcDestroy()
00046 {
00047     MSG msg;
00048     if (hWndParent != NULL && ::GetActiveWindow() == m_hWnd)
00049         ::SetActiveWindow(hWndParent);
00050     PostModal();
00051     while (PeekMessage(&msg, m_hWnd, 0, 0, PM_NOREMOVE) == TRUE)
00052         AfxGetApp()->PumpMessage();
00053     delete this;
00054 }
00055
00056 void CProgressDialog::OnOK()
00057 {
00058     m_abort = true;
00059     DestroyWindow();
00060 }
00061
00062 BOOL CProgressDialog::OnInitDialog()
00063 {
00064     CenterWindow();
00065
00066     CDialog::OnInitDialog();
00067
00068     CWnd *wnd = GetDlgItem(IDOK);
00069     if(wnd != 0L && !m_stopable)
00070     {
00071         wnd->EnableWindow(FALSE);
00072     }
00073     ShowWindow(SW_SHOW);
00074
00075     return TRUE;  // return TRUE unless you set the focus to a control
00076 }
00077
00078 BOOL CProgressDialog::Create()
00079 {
00080     hWndParent = PreModal();
00081     return CDialog::Create(CProgressDialog::IDD, m_pParent);
00082 }
00083
00084 static void flushDisplay(CDialog *dlg, bool & abort)
00085 {
00086     MSG msg;
00087     while (PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_NOREMOVE) == TRUE)
00088         AfxGetApp()->PumpMessage();
00089     while (PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE) == TRUE)
00090     {
00091         CPoint pt(LOWORD(msg.lParam), HIWORD(msg.lParam));
00092         ClientToScreen(msg.hwnd, &pt);
00093         CWnd *hwnd = CWnd::WindowFromPoint(pt);
00094         if(!abort && (*hwnd == *dlg || dlg->IsChild(hwnd)))
00095             AfxGetApp()->PumpMessage();
00096         else
00097             PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE);
00098     }
00099 }
00100
00101 CProgress::CProgress(bool interruptable, const char *title) : m_dlg(0L), m_abort(false)
00102 {
00103     m_dlg = new CProgressDialog(m_abort, interruptable);
00104     if (!m_dlg->Create())
00105     {
00106         TRACE0("Failed to create DlgBar\n");
00107         delete m_dlg;
00108         m_dlg = 0L;
00109         return;      // fail to create
00110     }
00111     if(title != 0L)
00112         m_dlg->SetWindowText(title);
00113     ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
00114 }
00115
00116 CProgress::~CProgress()
00117 {
00118     if(m_dlg != 0L)
00119         m_dlg->DestroyWindow();
00120 }
00121
00122 void CProgress::SetProgress(int percent)
00123 {
00124     if(m_dlg == 0L)
00125         return;
00126
00127     m_dlg->m_progress.SetPos(percent);
00128     flushDisplay(m_dlg, m_abort);
00129     ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
00130     if(m_abort)
00131         m_dlg = 0L;
00132 }
00133
00134 void CProgress::DoAbort(void)
00135 {
00136     if(m_dlg != 0L)
00137         m_dlg->DestroyWindow();
00138     m_dlg = 0L;
00139 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ProgressDialog.h Source File

WinCvs/ProgressDialog.h

Go to the documentation of this file.
00001 #if !defined(AFX_PROGRESSDIALOG_H__09D80542_6467_11D3_85F5_00609419FCC1__INCLUDED_)
00002 #define AFX_PROGRESSDIALOG_H__09D80542_6467_11D3_85F5_00609419FCC1__INCLUDED_
00003
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 // ProgressDialog.h : header file
00008 //
00009
00010 class CProgressDialog;
00011
00012 // the real thing to use
00013 class CProgress
00014 {
00015 public:
00016     CProgress(bool interruptable, const char *title = 0L);
00017     ~CProgress();
00018
00019     inline bool HasAborted(void) const { return m_abort; }
00020     void SetProgress(int percent);
00021     void DoAbort(void);
00022
00023 protected:
00024     CProgressDialog *m_dlg;
00025     bool m_abort;
00026 };
00027
00029 // CProgressDialog dialog
00030
00031 class CProgressDialog : public CDialog
00032 {
00033 // Construction
00034 public:
00035     CProgressDialog(bool & abort, bool interruptable, CWnd* pParent = NULL);   // standard constructor
00036     BOOL Create();
00037
00038 // Dialog Data
00039     //{{AFX_DATA(CProgressDialog)
00040     enum { IDD = IDD_PROGRESS };
00041     CProgressCtrl   m_progress;
00042     //}}AFX_DATA
00043
00044 // Overrides
00045     // ClassWizard generated virtual function overrides
00046     //{{AFX_VIRTUAL(CProgressDialog)
00047     protected:
00048     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00049     virtual void PostNcDestroy();
00050     //}}AFX_VIRTUAL
00051
00052 // Implementation
00053 protected:
00054     virtual void OnOK();
00055
00056     CWnd* m_pParent;
00057     bool & m_abort;
00058     bool m_stopable;
00059     HWND hWndParent;
00060
00061     // Generated message map functions
00062     //{{AFX_MSG(CProgressDialog)
00063     virtual BOOL OnInitDialog();
00064     //}}AFX_MSG
00065     DECLARE_MESSAGE_MAP()
00066 };
00067
00068 //{{AFX_INSERT_LOCATION}}
00069 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00070
00071 #endif // !defined(AFX_PROGRESSDIALOG_H__09D80542_6467_11D3_85F5_00609419FCC1__INCLUDED_)
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/resource.h Source File

WinCvs/resource.h

Go to the documentation of this file.
00001 //{{NO_DEPENDENCIES}}
00002 // Microsoft Developer Studio generated include file.
00003 // Used by wincvs.rc
00004 //
00005 #define IDR_CNTR_INPLACE                6
00006 #define IDD_ABOUTBOX                    100
00007 #define IDP_OLE_INIT_FAILED             100
00008 #define IDP_FAILED_TO_CREATE            102
00009 #define IDB_LIGHTBULB                   103
00010 #define IDP_SOCKETS_INIT_FAILED         104
00011 #define IDD_TIP                         105
00012 #define CG_IDS_TIPOFTHEDAY              106
00013 #define CG_IDS_TIPOFTHEDAYMENU          107
00014 #define CG_IDS_DIDYOUKNOW               108
00015 #define CG_IDS_FILE_ABSENT              109
00016 #define CG_IDP_FILE_CORRUPT             110
00017 #define CG_IDS_TIPOFTHEDAYHELP          111
00018 #define IDB_SPLASH                      112
00019 #define IDR_CVS_COWORKER                113
00020 #define IDR_CVSCOWORKER                 114
00021 #define IDR_CVSGETOPTION                115
00022 #define IDR_MAINFRAME                   128
00023 #define IDR_WINCVSTYPE                  129
00024 #define IDS_DEFFONT                     129
00025 #define IDR_BROWSER                     129
00026 #define IDD_PREFERENCES                 130
00027 #define IDD_PASSWRD                     132
00028 #define IDD_CMDLINE                     133
00029 #define IDD_ALERT                       134
00030 #define IDD_PREFS_CVSROOT               135
00031 #define IDD_PREFS_GLOBALS               136
00032 #define IDD_CHECKOUT_MAIN               137
00033 #define IDD_COMMIT_MAIN                 138
00034 #define IDD_IMPORT_MAIN                 139
00035 #define IDD_IMPORT_TAGS                 140
00036 #define IDD_CMDLINE_MAIN                142
00037 #define IDD_IMPORTFILTER                143
00038 #define IDI_CVSWARNING                  144
00039 #define IDI_CVSERROR                    145
00040 #define IDD_WARNINGDESC                 145
00041 #define IDD_ENTRYDESC                   146
00042 #define IDD_UPDATE_MAIN                 147
00043 #define IDD_UPDATE_STICKY               148
00044 #define IDD_UPDATE_MERGE                149
00045 #define IDI_FOLDER                      149
00046 #define IDD_LOG_MAIN                    150
00047 #define IDI_FOLDERO                     150
00048 #define IDI_FOLDERCVS                   151
00049 #define IDD_LOG_FILTERS                 152
00050 #define IDI_FOLDEROCVS                  152
00051 #define IDB_SMALLICONS                  152
00052 #define IDD_DIFF_OPTIONS                153
00053 #define IDD_DIFF_MAIN                   154
00054 #define IDD_CHECKOUT_OPTIONS            155
00055 #define IDD_PREFS_WINCVS                156
00056 #define IDR_FILELIST                    157
00057 #define IDD_YESNO                       157
00058 #define IDR_MULTIUSER                   158
00059 #define IDD_RTAG_CREATE                 158
00060 #define IDD_RTAG_DELETE                 159
00061 #define IDD_RTAG_BRANCH                 160
00062 #define IDR_GRAPH                       161
00063 #define IDD_TAG_BRANCH                  161
00064 #define IDD_TAG_CREATE                  162
00065 #define IDI_FOLDERIGN                   162
00066 #define IDD_TAG_DELETE                  163
00067 #define IDI_FOLDEROIGN                  163
00068 #define IDR_STATEICONS                  164
00069 #define IDI_FOLDERLOST                  164
00070 #define IDR_TAGS                        165
00071 #define IDD_INIT_MAIN                   165
00072 #define IDR_WORKSPACE                   173
00073 #define IDB_LOCATE                      176
00074 #define IDD_PROGRESS                    177
00075 #define IDR_MENUICONS                   178
00076 #define IDB_ABOUT                       180
00077 #define IDD_CUSTOMIZE                   181
00078 #define IDR_CUSTMENUS                   182
00079 #define IDB_PYTHON                      183
00080 #define IDD_SAVESETTINGS                184
00081 #define IDB_IDLE                        185
00082 #define IDD_RELEASE                     185
00083 #define IDR_FILTER                      186
00084 #define IDD_COMMIT_OPTIONS              186
00085 #define IDB_HISTLOC                     187
00086 #define IDD_RSH                         188
00087 #define IDD_PSERVER                     189
00088 #define IDD_SSH                         190
00089 #define IDD_PREFS_CVSCMD_DIALOGS        191
00090 #define IDD_ANNOTATE_MAIN               192
00091 #define IDD_GRAPH_OPTIONS               193
00092 #define IDD_PROMPTMESSAGE               194
00093 #define IDD_EDITMESSAGE                 195
00094 #define IDD_ADMINOPTION                 196
00095 #define IDD_EDITORMON                   197
00096 #define IDD_NOPYTHON                    198
00097 #define IDC_CVSROOT                     1000
00098 #define IDC_BULB                        1000
00099 #define IDC_CHECKOUTRO                  1001
00100 #define IDC_STARTUP                     1001
00101 #define IDC_TCPIP                       1002
00102 #define IDC_NEXTTIP                     1002
00103 #define IDC_PRUNE                       1003
00104 #define IDC_RHOSTS                      1004
00105 #define IDC_DIRTYSUPPORT                1004
00106 #define IDC_TIPSTRING                   1004
00107 #define IDC_PSERVER                     1005
00108 #define IDC_CHECKUNIXLF                 1005
00109 #define IDC_KSERVER                     1006
00110 #define IDC_QUIET                       1007
00111 #define IDC_CTNLADD                     1008
00112 #define IDC_PROMPTEDIT                  1009
00113 #define IDC_ALWAYSROOT                  1009
00114 #define IDC_PASSWD                      1010
00115 #define IDC_LOGOUT                      1010
00116 #define IDC_CMDLINE                     1011
00117 #define IDC_SELFOLDER                   1012
00118 #define IDC_FOLDERLOC                   1013
00119 #define IDC_BTNPATH2                    1014
00120 #define IDC_ALERTCAPTION                1015
00121 #define IDC_ALRTMSG                     1016
00122 #define IDC_CVSVERS                     1017
00123 #define IDC_AUTHEN                      1018
00124 #define IDC_STDOUT                      1019
00125 #define IDC_MODNAME                     1020
00126 #define IDC_BTNPATH                     1021
00127 #define IDC_TAGNAME                     1021
00128 #define IDC_NORECURS                    1022
00129 #define IDC_PATH                        1023
00130 #define IDC_FORCE                       1023
00131 #define IDC_LOGMSG                      1024
00132 #define IDC_OVERWRITE                   1024
00133 #define IDC_SPECIFY_REV                 1024
00134 #define IDC_DELSTICKY                   1025
00135 #define IDC_LOGMSG_WRAP                 1025
00136 #define IDC_VTAG                        1026
00137 #define IDC_CREATEMISSDIR               1026
00138 #define IDC_RHOSTPORT                   1027
00139 #define IDC_CLEANCOPY                   1027
00140 #define IDC_CHECKRHOSTPORT              1028
00141 #define IDC_CHECKPSERVERPORT            1029
00142 #define IDC_PSERVERPORT                 1030
00143 #define IDC_CHECKKSERVERPORT            1031
00144 #define IDC_KSERVERPORT                 1032
00145 #define IDC_CHECKSERVERNAME             1033
00146 #define IDC_SERVERNAME                  1034
00147 #define IDC_COMBOROOT                   1035
00148 #define IDC_CHECKRSHNAME                1035
00149 #define IDC_LISTENTRIES                 1036
00150 #define IDC_SERVERNAME2                 1036
00151 #define IDC_RSHNAME                     1036
00152 #define IDC_COMBORSAIDENTITY            1036
00153 #define IDC_EDITENTRY                   1037
00154 #define IDC_WARNINGDESC                 1038
00155 #define IDC_ENTRYSTATE                  1039
00156 #define IDC_DATE                        1040
00157 #define IDC_ENTRYSTATE3                 1041
00158 #define IDC_ENTRYSTATE4                 1042
00159 #define IDC_COMBOREV                    1043
00160 #define IDC_ENTRYSTATE5                 1043
00161 #define IDC_REV                         1044
00162 #define IDC_MERGE2                      1045
00163 #define IDC_COMBOSTATE                  1046
00164 #define IDC_COMBOREV2                   1047
00165 #define IDC_MERGE                       1048
00166 #define IDC_USER                        1049
00167 #define IDC_COMBO2                      1049
00168 #define IDC_NOTAGS                      1050
00169 #define IDC_NOUSERS                     1051
00170 #define IDC_RTAG                        1052
00171 #define IDC_CHECKPATH                   1053
00172 #define IDC_BTNHOME                     1054
00173 #define IDC_HOME                        1055
00174 #define IDC_ENTRYSTATE2                 1056
00175 #define IDC_COMBODATE                   1057
00176 #define IDC_MATCH                       1058
00177 #define IDC_MERGE1                      1059
00178 #define IDC_COMBOUSER                   1060
00179 #define IDC_DEFBRANCH                   1061
00180 #define IDC_STATE                       1062
00181 #define IDC_ONLYRCS                     1063
00182 #define IDC_CHECK1                      1064
00183 #define IDC_CHECK2                      1065
00184 #define IDC_DIFF1                       1066
00185 #define IDC_DIFF2                       1067
00186 #define IDC_DIFF3                       1068
00187 #define IDC_COMBO1                      1069
00188 #define IDC_BTNPROGRAM                  1070
00189 #define IDC_COMBORTAG                   1070
00190 #define IDC_PROGRAM                     1071
00191 #define IDC_BAR_TREE                    1072
00192 #define IDC_ATTIC                       1075
00193 #define IDC_EXTDIFF                     1076
00194 #define IDC_EXTDIFFSEL                  1077
00195 #define IDC_DIFFPROG                    1078
00196 #define IDC_CHECKUNMOD                  1079
00197 #define IDC_EDIT_POSITION               1079
00198 #define IDC_ALTCVSCHK                   1079
00199 #define IDC_ALTCVSPROG                  1080
00200 #define IDC_COMBO                       1081
00201 #define IDC_ALTCVSSEL                   1081
00202 #define IDC_WINCVSVER                   1082
00203 #define IDC_SPINLOGOUT                  1083
00204 #define IDC_EDITLOGOUT                  1084
00205 #define IDC_CHECKPROXY                  1085
00206 #define IDC_EDITHOST                    1086
00207 #define IDC_EDITPORT                    1087
00208 #define IDC_FORCEROOT                   1088
00209 #define IDC_EXPORT                      1089
00210 #define IDC_HELPINIT                    1090
00211 #define IDC_LOCATE                      1091
00212 #define IDC_PROGRESS                    1093
00213 #define IDC_ZLEVEL                      1095
00214 #define IDC_ZSPIN                       1096
00215 #define IDC_RSAIDENTITYSEL              1097
00216 #define IDC_WINCVSURL                   1097
00217 #define IDC_RSAIDENTITY                 1098
00218 #define IDC_ALLCMDS                     1098
00219 #define IDC_CMDMENU                     1099
00220 #define IDC_ADD                         1101
00221 #define IDC_REMOVE                      1102
00222 #define IDC_UP                          1103
00223 #define IDC_DOWN                        1104
00224 #define IDC_MENULIST                    1106
00225 #define IDC_LAUNCHEDITOR                1109
00226 #define IDC_WORDWRAP                    1110
00227 #define IDC_DELETED                     1113
00228 #define IDC_IGNOREWHITESPACE            1118
00229 #define IDC_IGNORECASE                  1119
00230 #define IDC_DIRECTORY                   1120
00231 #define IDC_EDIT_CHECKOUTDIR            1121
00232 #define IDC_CHECK_OVERRIDECHECKOUTDIR   1122
00233 #define IDC_USE_VIEWER_ALWAYS           1125
00234 #define IDC_USEDEFIGNORE                1127
00235 #define IDC_FORCECOMMIT                 1128
00236 #define IDC_FORCERECURSE                1129
00237 #define IDC_FORCEREVISION               1130
00238 #define IDC_NOMODULEPROGRAM             1131
00239 #define IDC_COMBOVTAG                   1132
00240 #define IDC_COMBOMODNAME                1133
00241 #define IDC_HOST                        1135
00242 #define IDC_LOGIN                       1136
00243 #define IDC_SETTINGS                    1137
00244 #define IDC_AUTHENDESC                  1138
00245 #define IDC_CHECKUPDATE                 1139
00246 #define IDC_CHECKDIFF                   1140
00247 #define IDC_CHECKGRAPH                  1141
00248 #define IDC_CHECKLOG                    1142
00249 #define IDC_RADIOSHIFT                  1143
00250 #define IDC_RADIOCONTROL                1144
00251 #define IDC_CONSOLE                     1144
00252 #define IDC_ISDATE                      1145
00253 #define IDC_CHECKANNOTATE               1145
00254 #define IDC_COMBO_REV                   1146
00255 #define IDC_DIFF                        1147
00256 #define IDC_FILETODIFF                  1148
00257 #define IDC_APPLY                       1149
00258 #define IDC_RESET                       1150
00259 #define IDC_HEADER                      1152
00260 #define IDC_TAG                         1153
00261 #define IDC_RGBHEADER                   1154
00262 #define IDC_RGBTAG                      1155
00263 #define IDC_RGBBRANCH                   1156
00264 #define IDC_RGBNODE                     1157
00265 #define IDC_RGBDEAD                     1158
00266 #define IDC_RGBSTATE                    1159
00267 #define IDC_BRANCH                      1160
00268 #define IDC_NODE                        1161
00269 #define IDC_SELECTION                   1162
00270 #define IDC_SHADOW                      1163
00271 #define IDC_DEAD                        1164
00272 #define IDC_RGBSELECTION                1165
00273 #define IDC_RGBSHADOW                   1166
00274 #define IDC_OPTIONSTRING                1167
00275 #define IDC_OPTIONDESC                  1168
00276 #define IDC_OPTIONSTRING_SL             1169
00277 #define IDC_TEMPFILE                    1170
00278 #define IDC_REMIND                      1171
00279 #define IDC_PYTHONURL                   1172
00280 #define ID_CANCEL_EDIT_CNTR             32768
00281 #define ID_APP_PREFERENCES              32775
00282 #define ID_APP_CMDLINE                  32776
00283 #define ID_APP_LOGIN                    32779
00284 #define ID_STOPCVS                      32795
00285 #define ID_BROWSER_OPEN                 32797
00286 #define ID_VIEW_BROWSER_BAR             32798
00287 #define ID_UPDATEBF                     32799
00288 #define ID_COMMITBF                     32800
00289 #define ID_ADDBF                        32801
00290 #define ID_VIEW_SMALLICONS              32802
00291 #define ID_VIEW_FULLLIST                32803
00292 #define ID_VIEW_ROWDETAILS              32804
00293 #define ID_VIEW_FILES_BAR               32805
00294 #define ID_VIEW_UPDATE                  32806
00295 #define ID_VIEW_COMMIT                  32807
00296 #define ID_VIEW_ADD                     32808
00297 #define ID_VIEW_WORKSPACE               32809
00298 #define ID_MENUBAR                      32810
00299 #define ID_VIEW_ADDB                    32811
00300 #define ID_VIEW_RMV                     32812
00301 #define IDS_COMBOBROWSER                32813
00302 #define ID_VIEW_RELOAD                  32814
00303 #define ID_VIEW_UPONE                   32826
00304 #define ID_VIEW_TRASH                   32830
00305 #define ID_VIEW_DIFF                    32833
00306 #define ID_VIEW_LOG                     32834
00307 #define ID_VIEW_STATUS                  32835
00308 #define ID_VIEW_LOCKF                   32836
00309 #define ID_VIEW_UNLOCKF                 32837
00310 #define ID_VIEW_MULTI_BAR               32838
00311 #define ID_MENUITEM32840                32840
00312 #define ID_VIEW_WATCHON                 32843
00313 #define ID_VIEW_WATCHOFF                32844
00314 #define ID_VIEW_EDIT                    32845
00315 #define ID_VIEW_UNEDIT                  32846
00316 #define ID_VIEW_RELEASE                 32847
00317 #define ID_VIEW_WATCHERS                32857
00318 #define ID_VIEW_EDITORS                 32858
00319 #define ID_CUST_FILES_MENU              32859
00320 #define ID_CUST_FOLDER_MENU             32860
00321 #define ID_APP_CREDITS                  32872
00322 #define ID_APP_COPYRIGHTS               32873
00323 #define ID_GRAPH_CLOSE                  32874
00324 #define ID_VIEW_GRAPH                   32875
00325 #define ID_APP_RTAGCREATE               32881
00326 #define ID_APP_RTAGDELETE               32882
00327 #define ID_APP_RTAGBRANCH               32883
00328 #define ID_VIEW_TAG                     32884
00329 #define ID_VIEW_TAGNEW                  32886
00330 #define ID_VIEW_TAGDELETE               32887
00331 #define ID_VIEW_TAGBRANCH               32888
00332 #define ID_VIEW_TAGS_BAR                32889
00333 #define ID_VIEW_CONSOLE_BAR             32898
00334 #define ID_VIEW_EXPLORE                 32899
00335 #define ID_HISTORYBROWSE                32900
00336 #define ID_VIEW_QUERYUPDATE             32901
00337 #define ID_VIEW_IGNORE                  32902
00338 #define ID_HELP_CVS                     32903
00339 #define ID_HELP_CVSCLIENT               32904
00340 #define ID_APP_LOGOUT                   32906
00341 #define ID_VIEW_EDITSEL                 32908
00342 #define ID_VIEW_EDITSELDEF              32909
00343 #define ID_ACCEL32911                   32911
00344 #define ID_VIEWW_INIT                   32912
00345 #define ID_VIEW_IMPORT                  32913
00346 #define ID_VIEW_INIT                    32914
00347 #define ID_VIEW_CHECKOUT                32915
00348 #define ID_VIEW_DELREV                  32916
00349 #define ID_VIEW_SELNONSIG               32917
00350 #define ID_BUTTON32918                  32918
00351 #define ID_BUTTON32919                  32919
00352 #define ID_BUTTON32920                  32920
00353 #define ID_BUTTON32921                  32921
00354 #define ID_SAVESETTINGS                 32922
00355 #define ID_VIEW_RETRIEVE                32923
00356 #define ID_VIEW_RECURSIVE               32924
00357 #define ID_VIEW_FILTER_BAR              32925
00358 #define ID_VIEW_MODIFIED                32927
00359 #define ID_FILTERMASK                   32928
00360 #define ID_VIEW_CONFLICT                32929
00361 #define ID_VIEW_UNKNOWN                 32931
00362 #define ID_VIEW_MISSING                 32932
00363 #define ID_VIEW_ADDED                   32935
00364 #define ID_VIEW_REMOVED                 32936
00365 #define ID_VIEW_CHANGED                 32937
00366 #define ID_VIEW_HIDEUNKNOWN             32938
00367 #define ID_BUTTON32940                  32940
00368 #define ID_QUERY_ANNOTATE               32941
00369 #define ID_VIEW_BROWSELOCATION_REMOVEUNWANTED 32943
00370 #define ID_USE_TCLSHELL                 32944
00371 #define ID_USE_PYSHELL                  32945
00372 #define ID_GRAPH_GRAPHOPTIONS           32946
00373 #define ID_GRAPH_ADMINOPTIONS_CHANGELOGMESSAGE 32950
00374 #define ID_GRAPH_ADMINOPTIONS_SETSTATE  32951
00375 #define ID_GRAPH_ADMINOPTIONS_SETDESCRIPTION 32952
00376 #define ID_GRAPH_CHANGELOGMESSAGE       32954
00377 #define ID_GRAPH_SETSTATE               32955
00378 #define ID_GRAPH_SETDESCRIPTION         32956
00379 #define ID_MACRO_START                  34000
00380 #define ID_MACRO_SEL                    34100
00381 #define ID_MACRO_ADMIN                  34200
00382 #define ID_MACRO_END                    34200
00383
00384 // Next default values for new objects
00385 //
00386 #ifdef APSTUDIO_INVOKED
00387 #ifndef APSTUDIO_READONLY_SYMBOLS
00388 #define _APS_3D_CONTROLS                     1
00389 #define _APS_NEXT_RESOURCE_VALUE        199
00390 #define _APS_NEXT_COMMAND_VALUE         32957
00391 #define _APS_NEXT_CONTROL_VALUE         1173
00392 #define _APS_NEXT_SYMED_VALUE           113
00393 #endif
00394 #endif
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/SortHeaderCtrl.cpp Source File

WinCvs/SortHeaderCtrl.cpp

Go to the documentation of this file.
00001 #include "stdafx.h"
00002 #include "SortHeaderCtrl.h"
00003
00005 // CSortHeaderCtrl
00006
00007 IMPLEMENT_DYNAMIC(CSortHeaderCtrl, CHeaderCtrl)
00008
00009 BEGIN_MESSAGE_MAP(CSortHeaderCtrl, CHeaderCtrl)
00010     //{{AFX_MSG_MAP(CSortHeaderCtrl)
00011     //}}AFX_MSG_MAP
00012 END_MESSAGE_MAP()
00013
00014 CSortHeaderCtrl::CSortHeaderCtrl()
00015 {
00016     m_bSortAsc  = TRUE;
00017     m_nSortCol  = -1;
00018 }
00019
00020 CSortHeaderCtrl::~CSortHeaderCtrl()
00021 {
00022 }
00023
00024 int CSortHeaderCtrl::SetSortImage(int nCol, BOOL bAsc)
00025 {
00026     int nPrevCol = m_nSortCol;
00027
00028     m_nSortCol = nCol;
00029     m_bSortAsc = bAsc;
00030
00031     // Change the item to ownder drawn
00032     HD_ITEM hditem;
00033
00034     hditem.mask = HDI_FORMAT;
00035     GetItem( nCol, &hditem );
00036     hditem.fmt |= HDF_OWNERDRAW;
00037     SetItem( nCol, &hditem );
00038
00039     // Invalidate header control so that it gets redrawn
00040     Invalidate();
00041
00042     return nPrevCol;
00043 }
00044
00045 void CSortHeaderCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
00046 {
00047     CDC dc;
00048
00049     dc.Attach( lpDrawItemStruct->hDC );
00050
00051     // Get the column rect
00052     CRect rcLabel( lpDrawItemStruct->rcItem );
00053
00054     // Save DC
00055     int nSavedDC = dc.SaveDC();
00056
00057     // Set clipping region to limit drawing within column
00058     CRgn rgn;
00059     rgn.CreateRectRgnIndirect( &rcLabel );
00060     dc.SelectObject( &rgn );
00061     rgn.DeleteObject();
00062
00063     // Draw the background
00064     dc.FillRect(rcLabel, &CBrush(::GetSysColor(COLOR_3DFACE)));
00065
00066     // Labels are offset by a certain amount
00067     // This offset is related to the width of a space character
00068     int offset = dc.GetTextExtent(_T(" "), 1 ).cx*2;
00069
00070     // Get the column text and format
00071     TCHAR buf[256];
00072     HD_ITEM hditem;
00073
00074     hditem.mask = HDI_TEXT | HDI_FORMAT;
00075     hditem.pszText = buf;
00076     hditem.cchTextMax = 255;
00077
00078     GetItem( lpDrawItemStruct->itemID, &hditem );
00079
00080     // Determine format for drawing column label
00081     UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP
00082                         | DT_VCENTER | DT_END_ELLIPSIS ;
00083
00084     if( hditem.fmt & HDF_CENTER)
00085         uFormat |= DT_CENTER;
00086     else if( hditem.fmt & HDF_RIGHT)
00087         uFormat |= DT_RIGHT;
00088     else
00089         uFormat |= DT_LEFT;
00090
00091     // Adjust the rect if the mouse button is pressed on it
00092     if( lpDrawItemStruct->itemState == ODS_SELECTED )
00093     {
00094         rcLabel.left++;
00095         rcLabel.top += 2;
00096         rcLabel.right++;
00097     }
00098
00099     // Adjust the rect further if Sort arrow is to be displayed
00100     if( lpDrawItemStruct->itemID == (UINT)m_nSortCol )
00101     {
00102         rcLabel.right -= 3 * offset;
00103     }
00104
00105     rcLabel.left += offset;
00106     rcLabel.right -= offset;
00107
00108     // Draw column label
00109     if( rcLabel.left < rcLabel.right )
00110         dc.DrawText(buf,-1,rcLabel, uFormat);
00111
00112     // Draw the Sort arrow
00113     if( lpDrawItemStruct->itemID == (UINT)m_nSortCol )
00114     {
00115         CRect rcIcon( lpDrawItemStruct->rcItem );
00116
00117         // Set up pens to use for drawing the triangle
00118         CPen penLight(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
00119         CPen penShadow(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
00120         CPen *pOldPen = dc.SelectObject( &penLight );
00121
00122         offset = (rcIcon.bottom - rcIcon.top) / 4;
00123         if (m_bSortAsc)
00124         {
00125             // Draw triangle pointing upwards
00126             dc.MoveTo( rcIcon.right - 2* offset, offset);
00127             dc.LineTo( rcIcon.right - offset, rcIcon.bottom - offset-1 );
00128             dc.LineTo( rcIcon.right - 3*offset-2, rcIcon.bottom - offset-1 );
00129             dc.MoveTo( rcIcon.right - 3*offset-1, rcIcon.bottom - offset-1 );
00130             dc.SelectObject( &penShadow );
00131             dc.LineTo( rcIcon.right - 2*offset, offset-1);
00132         }
00133         else
00134         {
00135             // Draw triangle pointing downwards
00136             dc.MoveTo( rcIcon.right - offset-1, offset);
00137             dc.LineTo( rcIcon.right - 2*offset-1, rcIcon.bottom - offset );
00138             dc.MoveTo( rcIcon.right - 2*offset-2, rcIcon.bottom - offset );
00139             dc.SelectObject( &penShadow );
00140             dc.LineTo( rcIcon.right - 3*offset-1, offset );
00141             dc.LineTo( rcIcon.right - offset-1, offset);
00142         }
00143
00144         // Restore the pen
00145         dc.SelectObject( pOldPen );
00146     }
00147
00148     // Restore dc
00149     dc.RestoreDC( nSavedDC );
00150
00151     // Detach the dc before returning
00152     dc.Detach();
00153 }
00154
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/SortHeaderCtrl.h Source File

WinCvs/SortHeaderCtrl.h

Go to the documentation of this file.
00001 #ifndef __SORTHEADERCTRL_H__
00002 #define __SORTHEADERCTRL_H__
00003
00004
00006 // CSortHeaderCtrl
00007
00008 class CSortHeaderCtrl : public CHeaderCtrl
00009 {
00010     DECLARE_DYNAMIC(CSortHeaderCtrl)
00011
00012 // Construction
00013 public:
00014     CSortHeaderCtrl();
00015
00016 // Attributes
00017 protected:
00018     int     m_nSortCol;
00019     BOOL    m_bSortAsc;
00020
00021 // Operations
00022 public:
00023
00024 // Overrides
00025     // ClassWizard generated virtual function overrides
00026     //{{AFX_VIRTUAL(CSortHeaderCtrl)
00027     //}}AFX_VIRTUAL
00028
00029     virtual void    DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
00030     virtual int     SetSortImage(int nCol, BOOL bAsc);
00031
00032 // Implementation
00033 public:
00034     virtual ~CSortHeaderCtrl();
00035
00036 // Generated message map functions
00037 protected:
00038     //{{AFX_MSG(CSortHeaderCtrl)
00039     //}}AFX_MSG
00040
00041     DECLARE_MESSAGE_MAP()
00042 };
00043
00044 #endif
00045 // __SORTHEADERCTRL_H__
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/Splash.cpp Source File

WinCvs/Splash.cpp

Go to the documentation of this file.
00001 // CG: This file was added by the Splash Screen component.
00002 // Splash.cpp : implementation file
00003 //
00004
00005 #include "stdafx.h"  // e. g. stdafx.h
00006 #include "resource.h"  // e.g. resource.h
00007
00008 #include "Splash.h"  // e.g. splash.h
00009 #include "wincvs.h"  // e.g. splash.h
00010 #include "CPStr.h"  // e.g. splash.h
00011
00012 #ifdef _DEBUG
00013 #define new DEBUG_NEW
00014 #undef THIS_FILE
00015 static char BASED_CODE THIS_FILE[] = __FILE__;
00016 #endif
00017
00018 // right margin of the bitmap
00019 namespace
00020 {
00021 const int gc_nBitmapRightMargin(519 - 491);
00022 }
00023
00025 //   Splash Screen class
00026
00027 BOOL CSplashWnd::c_bShowSplashWnd;
00028 CSplashWnd* CSplashWnd::c_pSplashWnd;
00029 CSplashWnd::CSplashWnd()
00030 {
00031 }
00032
00033 CSplashWnd::~CSplashWnd()
00034 {
00035     // Clear the static window pointer.
00036     ASSERT(c_pSplashWnd == this);
00037     c_pSplashWnd = NULL;
00038 }
00039
00040 BEGIN_MESSAGE_MAP(CSplashWnd, CWnd)
00041     //{{AFX_MSG_MAP(CSplashWnd)
00042     ON_WM_CREATE()
00043     ON_WM_PAINT()
00044     ON_WM_TIMER()
00045     //}}AFX_MSG_MAP
00046 END_MESSAGE_MAP()
00047
00048 void CSplashWnd::EnableSplashScreen(BOOL bEnable /*= TRUE*/)
00049 {
00050     c_bShowSplashWnd = bEnable;
00051 }
00052
00053 void CSplashWnd::ShowSplashScreen(CWnd* pParentWnd /*= NULL*/)
00054 {
00055     if (!c_bShowSplashWnd || c_pSplashWnd != NULL)
00056         return;
00057
00058     // Allocate a new splash screen, and create the window.
00059     c_pSplashWnd = new CSplashWnd;
00060     if (!c_pSplashWnd->Create(pParentWnd))
00061         delete c_pSplashWnd;
00062     else
00063         c_pSplashWnd->UpdateWindow();
00064 }
00065
00066 BOOL CSplashWnd::PreTranslateAppMessage(MSG* pMsg)
00067 {
00068     if (c_pSplashWnd == NULL)
00069         return FALSE;
00070
00071     // If we get a keyboard or mouse message, hide the splash screen.
00072     if (pMsg->message == WM_KEYDOWN ||
00073         pMsg->message == WM_SYSKEYDOWN ||
00074         pMsg->message == WM_LBUTTONDOWN ||
00075         pMsg->message == WM_RBUTTONDOWN ||
00076         pMsg->message == WM_MBUTTONDOWN ||
00077         pMsg->message == WM_NCLBUTTONDOWN ||
00078         pMsg->message == WM_NCRBUTTONDOWN ||
00079         pMsg->message == WM_NCMBUTTONDOWN)
00080     {
00081         c_pSplashWnd->HideSplashScreen();
00082         return TRUE;    // message handled here
00083     }
00084
00085     return FALSE;   // message not handled
00086 }
00087
00088 BOOL CSplashWnd::Create(CWnd* pParentWnd /*= NULL*/)
00089 {
00090     if (!m_bitmap.LoadBitmap(IDB_SPLASH))
00091         return FALSE;
00092
00093     BITMAP bm;
00094     m_bitmap.GetBitmap(&bm);
00095
00096     return CreateEx(0,
00097         AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)),
00098         NULL, WS_POPUP | WS_VISIBLE, 0, 0, bm.bmWidth, bm.bmHeight, pParentWnd->GetSafeHwnd(), NULL);
00099 }
00100
00101 void CSplashWnd::HideSplashScreen()
00102 {
00103     // Destroy the window, and update the mainframe.
00104     DestroyWindow();
00105     AfxGetMainWnd()->UpdateWindow();
00106 }
00107
00108 void CSplashWnd::CloseSplashScreen()
00109 {
00110     if(c_pSplashWnd)
00111     {
00112         c_pSplashWnd->HideSplashScreen();
00113     }
00114 }
00115
00116 void CSplashWnd::PostNcDestroy()
00117 {
00118     // Free the C++ class.
00119     delete this;
00120 }
00121
00122 int CSplashWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
00123 {
00124     if (CWnd::OnCreate(lpCreateStruct) == -1)
00125         return -1;
00126
00127     // Center the window.
00128     CenterWindow();
00129
00130     // Set a timer to destroy the splash screen.
00131     SetTimer(1, 750, NULL);
00132
00133     return 0;
00134 }
00135
00136 void CSplashWnd::OnPaint()
00137 {
00138     CPaintDC dc(this);
00139
00140     CDC dcImage;
00141     if (!dcImage.CreateCompatibleDC(&dc))
00142         return;
00143
00144     BITMAP bm;
00145     m_bitmap.GetBitmap(&bm);
00146
00147     // Paint the image.
00148     CBitmap* pOldBitmap = dcImage.SelectObject(&m_bitmap);
00149     dc.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &dcImage, 0, 0, SRCCOPY);
00150     dcImage.SelectObject(pOldBitmap);
00151
00152     // Get version information from the application
00153     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00154     CStr vers;
00155
00156     if(app->GetAppVersion(vers))
00157     {
00158         dc.SetBkMode(TRANSPARENT);
00159         dc.SetTextAlign(TA_RIGHT | TA_TOP);
00160         dc.TextOut(bm.bmWidth - gc_nBitmapRightMargin - 10, 219, vers, vers.length());
00161     }
00162 }
00163
00164 void CSplashWnd::OnTimer(UINT nIDEvent)
00165 {
00166     // Destroy the splash screen window.
00167     HideSplashScreen();
00168 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/Splash.h Source File

WinCvs/Splash.h

Go to the documentation of this file.
00001 // CG: This file was added by the Splash Screen component.
00002
00003 #ifndef _SPLASH_SCRN_
00004 #define _SPLASH_SCRN_
00005
00006 // Splash.h : header file
00007 //
00008
00010 //   Splash Screen class
00011
00012 class CSplashWnd : public CWnd
00013 {
00014 // Construction
00015 protected:
00016     CSplashWnd();
00017
00018 // Attributes:
00019 public:
00020     CBitmap m_bitmap;
00021
00022 // Operations
00023 public:
00024     static void EnableSplashScreen(BOOL bEnable = TRUE);
00025     static void ShowSplashScreen(CWnd* pParentWnd = NULL);
00026     static BOOL PreTranslateAppMessage(MSG* pMsg);
00027     static void CloseSplashScreen();
00028
00029 // Overrides
00030     // ClassWizard generated virtual function overrides
00031     //{{AFX_VIRTUAL(CSplashWnd)
00032     //}}AFX_VIRTUAL
00033
00034 // Implementation
00035 public:
00036     ~CSplashWnd();
00037     virtual void PostNcDestroy();
00038
00039 protected:
00040     BOOL Create(CWnd* pParentWnd = NULL);
00041     void HideSplashScreen();
00042     static BOOL c_bShowSplashWnd;
00043     static CSplashWnd* c_pSplashWnd;
00044
00045 // Generated message map functions
00046 protected:
00047     //{{AFX_MSG(CSplashWnd)
00048     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00049     afx_msg void OnPaint();
00050     afx_msg void OnTimer(UINT nIDEvent);
00051     //}}AFX_MSG
00052     DECLARE_MESSAGE_MAP()
00053 };
00054
00055
00056 #endif
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/Stat.cpp Source File

WinCvs/Stat.cpp

Go to the documentation of this file.
00001 #include <stdafx.h>
00002 #include <errno.h>
00003 #include <io.h>
00004 #include "AppConsole.h"
00005 #include "wincvsdebug.h"
00006
00007 static struct { DWORD err; int dos;} errors[] =
00008 {
00009         {  ERROR_INVALID_FUNCTION,       EINVAL    },  /* 1 */
00010         {  ERROR_FILE_NOT_FOUND,         ENOENT    },  /* 2 */
00011         {  ERROR_PATH_NOT_FOUND,         ENOENT    },  /* 3 */
00012         {  ERROR_TOO_MANY_OPEN_FILES,    EMFILE    },  /* 4 */
00013         {  ERROR_ACCESS_DENIED,          EACCES    },  /* 5 */
00014         {  ERROR_INVALID_HANDLE,         EBADF     },  /* 6 */
00015         {  ERROR_ARENA_TRASHED,          ENOMEM    },  /* 7 */
00016         {  ERROR_NOT_ENOUGH_MEMORY,      ENOMEM    },  /* 8 */
00017         {  ERROR_INVALID_BLOCK,          ENOMEM    },  /* 9 */
00018         {  ERROR_BAD_ENVIRONMENT,        E2BIG     },  /* 10 */
00019         {  ERROR_BAD_FORMAT,             ENOEXEC   },  /* 11 */
00020         {  ERROR_INVALID_ACCESS,         EINVAL    },  /* 12 */
00021         {  ERROR_INVALID_DATA,           EINVAL    },  /* 13 */
00022         {  ERROR_INVALID_DRIVE,          ENOENT    },  /* 15 */
00023         {  ERROR_CURRENT_DIRECTORY,      EACCES    },  /* 16 */
00024         {  ERROR_NOT_SAME_DEVICE,        EXDEV     },  /* 17 */
00025         {  ERROR_NO_MORE_FILES,          ENOENT    },  /* 18 */
00026         {  ERROR_LOCK_VIOLATION,         EACCES    },  /* 33 */
00027         {  ERROR_BAD_NETPATH,            ENOENT    },  /* 53 */
00028         {  ERROR_NETWORK_ACCESS_DENIED,  EACCES    },  /* 65 */
00029         {  ERROR_BAD_NET_NAME,           ENOENT    },  /* 67 */
00030         {  ERROR_FILE_EXISTS,            EEXIST    },  /* 80 */
00031         {  ERROR_CANNOT_MAKE,            EACCES    },  /* 82 */
00032         {  ERROR_FAIL_I24,               EACCES    },  /* 83 */
00033         {  ERROR_INVALID_PARAMETER,      EINVAL    },  /* 87 */
00034         {  ERROR_NO_PROC_SLOTS,          EAGAIN    },  /* 89 */
00035         {  ERROR_DRIVE_LOCKED,           EACCES    },  /* 108 */
00036         {  ERROR_BROKEN_PIPE,            EPIPE     },  /* 109 */
00037         {  ERROR_DISK_FULL,              ENOSPC    },  /* 112 */
00038         {  ERROR_INVALID_TARGET_HANDLE,  EBADF     },  /* 114 */
00039         {  ERROR_INVALID_HANDLE,         EINVAL    },  /* 124 */
00040         {  ERROR_WAIT_NO_CHILDREN,       ECHILD    },  /* 128 */
00041         {  ERROR_CHILD_NOT_COMPLETE,     ECHILD    },  /* 129 */
00042         {  ERROR_DIRECT_ACCESS_HANDLE,   EBADF     },  /* 130 */
00043         {  ERROR_NEGATIVE_SEEK,          EINVAL    },  /* 131 */
00044         {  ERROR_SEEK_ON_DEVICE,         EACCES    },  /* 132 */
00045         {  ERROR_DIR_NOT_EMPTY,          ENOTEMPTY },  /* 145 */
00046         {  ERROR_NOT_LOCKED,             EACCES    },  /* 158 */
00047         {  ERROR_BAD_PATHNAME,           ENOENT    },  /* 161 */
00048         {  ERROR_MAX_THRDS_REACHED,      EAGAIN    },  /* 164 */
00049         {  ERROR_LOCK_FAILED,            EACCES    },  /* 167 */
00050         {  ERROR_ALREADY_EXISTS,         EEXIST    },  /* 183 */
00051         {  ERROR_FILENAME_EXCED_RANGE,   ENOENT    },  /* 206 */
00052         {  ERROR_NESTING_NOT_ALLOWED,    EAGAIN    },  /* 215 */
00053         {  ERROR_NOT_ENOUGH_QUOTA,       ENOMEM    }    /* 1816 */
00054 };
00055
00056 static const WORD month_len [12] =
00057 {
00058     31, /* Jan */
00059     28, /* Feb */
00060     31, /* Mar */
00061     30, /* Apr */
00062     31, /* May */
00063     30, /* Jun */
00064     31, /* Jul */
00065     31, /* Aug */
00066     30, /* Sep */
00067     31, /* Oct */
00068     30, /* Nov */
00069     31  /* Dec */
00070 };
00071
00072 static const char * month_names[12] =
00073 {
00074     "Jan", "Feb", "Mar", "Apr",
00075     "May", "Jun", "Jul", "Aug",
00076     "Sep", "Oct", "Nov", "Dec"
00077 };
00078
00079 /* One second = 10,000,000 * 100 nsec */
00080     static const ULONGLONG systemtime_second = 10000000L;
00081
00082
00083 static void _dosmaperr(DWORD dwErr)
00084 {
00085     int n;
00086     for(n=0; n<sizeof(errors)/sizeof(errors[0]); n++)
00087     {
00088         if(errors[n].err==dwErr)
00089         {
00090             errno=errors[n].dos;
00091             return;
00092         }
00093     }
00094     errno=EFAULT;
00095 }
00096
00097 /* Is the year a leap year?
00098  *
00099  * Use standard Gregorian: every year divisible by 4
00100  * except centuries indivisible by 400.
00101  *
00102  * INPUTS: WORD year the year (AD)
00103  *
00104  * OUTPUTS: TRUE if it's a leap year.
00105  */
00106 BOOL IsLeapYear ( WORD year )
00107 {
00108     return ( (year & 3u == 0)
00109             && ( (year % 100u == 0)
00110                 || (year % 400u == 0) ));
00111 }
00112
00113 /* A fairly complicated comparison:
00114  *
00115  * Compares a test date against a target date.
00116  * If the test date is earlier, return a negative number
00117  * If the test date is later, return a positive number
00118  * If the two dates are equal, return zero.
00119  *
00120  * The comparison is complicated by the way we specify
00121  * TargetDate.
00122  *
00123  * TargetDate is assumed to be the kind of date used in
00124  * TIME_ZONE_INFORMATION.DaylightDate: If wYear is 0,
00125  * then it's a kind of code for things like 1st Sunday
00126  * of the month. As described in the Windows API docs,
00127  * wDay is an index of week:
00128  *      1 = first of month
00129  *      2 = second of month
00130  *      3 = third of month
00131  *      4 = fourth of month
00132  *      5 = last of month (even if there are only four such days).
00133  *
00134  * Thus, if wYear = 0, wMonth = 4, wDay = 2, wDayOfWeek = 4
00135  * it specifies the second Thursday of April.
00136  *
00137  * INPUTS: SYSTEMTIME * p_test_date     The date to be tested
00138  *
00139  *         SYSTEMTIME * p_target_date   The target date. This should be in
00140  *                                      the format for a TIME_ZONE_INFORMATION
00141  *                                      DaylightDate or StandardDate.
00142  *
00143  * OUTPUT:  -4/+4 if test month is less/greater than target month
00144  *          -2/+2 if test day is less/greater than target day
00145  *          -1/+2 if test hour:minute:seconds.milliseconds less/greater than target
00146  *          0     if both dates/times are equal.
00147  *
00148  */
00149 static int CompareTargetDate (
00150     const SYSTEMTIME * p_test_date,
00151     const SYSTEMTIME * p_target_date
00152     )
00153 {
00154     WORD first_day_of_month; /* day of week of the first. Sunday = 0 */
00155     WORD end_of_month;       /* last day of month */
00156     WORD temp_date;
00157     int test_milliseconds, target_milliseconds;
00158
00159     /* Check that p_target_date is in the correct foramt: */
00160     ASSERT(p_target_date->wYear==0 && p_test_date->wYear != 0);
00161     if (p_target_date->wYear != 0 || p_test_date->wYear == 0)
00162         return 0;
00163
00164     /* Don't waste time calculating if we can shortcut the comparison... */
00165     if (p_test_date->wMonth != p_target_date->wMonth)
00166     {
00167         return (p_test_date->wMonth > p_target_date->wMonth) ? 4 : -4;
00168     }
00169
00170     /* Months equal. Now we neet to do some calculation.
00171      * If we know that y is the day of the week for some arbitrary date x,
00172      * then the day of the week of the first of the month is given by
00173      * (1 + y - x) mod 7.
00174      *
00175      * For instance, if the 19th is a Wednesday (day of week = 3), then
00176      * the date of the first Wednesday of the month is (19 mod 7) = 5.
00177      * If the 5th is a Wednesday (3), then the first of the month is
00178      * four days earlier (it's the first, not the zeroth):
00179      * (3 - 4) = -1; -1 mod 7 = 6. The first is a Saturday.
00180      *
00181      * Check ourselves: The 19th falls on a (6 + 19 - 1) mod 7
00182      * = 24 mod 7 = 3: Wednesday, as it should be.
00183      */
00184     first_day_of_month = (WORD)( (1u + p_test_date->wDayOfWeek - p_test_date->wDay) % 7u);
00185
00186     /* If the first of the month comes on day y, then the first day of week z falls on
00187      * (z - y + 1) mod 7.
00188      *
00189      * For instance, if the first is a Saturday (6), then the first Tuesday (2) falls on a
00190      * (2 - 6 + 1) mod 7 = -3 mod 7 = 4: The fourth. This is correct (see above).
00191      *
00192      * temp_date gets the first <target day of week> in the month.
00193      */
00194     temp_date = (WORD)( (1u + p_target_date->wDayOfWeek - first_day_of_month) % 7u);
00195     /* If we're looking for the third Tuesday in the month, find the date of the first
00196      * Tuesday and add (3 - 1) * 7. In the example, it's the 4 + 14 = 18th.
00197      *
00198      * temp_date now should hold the date for the wDay'th wDayOfWeek of the month.
00199      * we only need to handle the special case of the last <DayOfWeek> of the month.
00200      */
00201     temp_date = (WORD)( temp_date + 7 * p_target_date->wDay );
00202
00203     /* what's the last day of the month? */
00204     end_of_month = month_len [p_target_date->wMonth - 1];
00205     /* Correct if it's February of a leap year? */
00206     if ( p_test_date->wMonth == 2 && IsLeapYear(p_test_date->wYear) )
00207     {
00208         ++ end_of_month;
00209     }
00210
00211     /* if we tried to calculate the fifth Tuesday of the month
00212      * we may well have overshot. Correct for that case.
00213      */
00214     while ( temp_date > end_of_month)
00215         temp_date -= 7;
00216
00217     /* At long last, we're ready to do the comparison. */
00218     if ( p_test_date->wDay != temp_date )
00219     {
00220         return (p_test_date->wDay > temp_date) ? 2 : -2;
00221     }
00222     else
00223     {
00224         test_milliseconds = ((p_test_date->wHour * 60 + p_test_date->wMinute) * 60
00225                                 + p_test_date->wSecond) * 1000 + p_test_date->wMilliseconds;
00226         target_milliseconds = ((p_target_date->wHour * 60 + p_target_date->wMinute) * 60
00227                                 + p_target_date->wSecond) * 1000 + p_target_date->wMilliseconds;
00228         test_milliseconds -= target_milliseconds;
00229         return (test_milliseconds > 0) ? 1 : (test_milliseconds < 0) ? -1 : 0;
00230     }
00231
00232 }
00233
00234 //
00235 //  Get time zone bias for local time *pst.
00236 //
00237 //  UTC time = *pst + bias.
00238 //
00239 static int GetTimeZoneBias( const SYSTEMTIME * pst )
00240 {
00241     TIME_ZONE_INFORMATION tz;
00242     int n, bias;
00243
00244     GetTimeZoneInformation ( &tz );
00245
00246     /*  I only deal with cases where we look at
00247      *  a "last sunday" kind of thing.
00248      */
00249     ASSERT(tz.DaylightDate.wYear == 0 && tz.StandardDate.wYear == 0);
00250
00251     bias = tz.Bias;
00252
00253     n = CompareTargetDate ( pst, & tz.DaylightDate );
00254     if (n < 0)
00255         bias += tz.StandardBias;
00256     else
00257     {
00258         n = CompareTargetDate ( pst, & tz.StandardDate );
00259         if (n < 0)
00260             bias += tz.DaylightBias;
00261         else
00262             bias += tz.StandardBias;
00263     }
00264     return bias;
00265 }
00266
00267 //
00268 //  Is the (local) time in DST?
00269 //
00270 static bool IsDST( const SYSTEMTIME * pst )
00271 {
00272     TIME_ZONE_INFORMATION tz;
00273
00274     GetTimeZoneInformation ( &tz );
00275
00276     /*  I only deal with cases where we look at
00277      *  a "last sunday" kind of thing.
00278      */
00279     ASSERT(tz.DaylightDate.wYear == 0 && tz.StandardDate.wYear == 0);
00280
00281     return (CompareTargetDate ( pst, & tz.DaylightDate ) >= 0)
00282             && (CompareTargetDate ( pst, & tz.StandardDate ) < 0);
00283 }
00284
00285 /* Convert a system time from local time to UTC time, correctly
00286  * taking DST into account (sort of).
00287  *
00288  * INPUTS:
00289  *      const SYSTEMTIME * p_local:
00290  *              A file time. It may be in UTC or in local
00291  *              time (see local_time, below, for details).
00292  *
00293  *      SYSTEMTIME * p_utc:
00294  *              The destination for the converted time.
00295  *
00296  * OUTPUTS:
00297  *      SYSTEMTIME * p_utc:
00298  *              The destination for the converted time.
00299  */
00300
00301 void LocalSystemTimeToUtcSystemTime( const SYSTEMTIME * p_local, SYSTEMTIME * p_utc)
00302 {
00303     FILETIME ft;
00304     ULARGE_INTEGER itime, delta;
00305     int bias = GetTimeZoneBias(p_local);
00306
00307     // delta = bias correction: bias minutes.
00308     SystemTimeToFileTime(p_local, & ft);
00309     itime.QuadPart = ((ULARGE_INTEGER *) &ft)->QuadPart;
00310     delta.QuadPart = systemtime_second * 60 * bias;   // bias in minutes...
00311     itime.QuadPart += delta.QuadPart;
00312
00313     ((ULARGE_INTEGER *) & ft)->QuadPart = itime.QuadPart;
00314     FileTimeToSystemTime(& ft, p_utc);
00315 }
00316
00317
00318 /* Convert a file time to a Unix time_t structure. This function is as
00319  * complicated as it is because it needs to ask what time system the
00320  * filetime describes.
00321  *
00322  * INPUTS:
00323  *      const FILETIME * ft: A file time. It may be in UTC or in local
00324  *                           time (see local_time, below, for details).
00325  *
00326  *      time_t * ut:         The destination for the converted time.
00327  *
00328  *      BOOL local_time:     TRUE if the time in *ft is in local time
00329  *                           and I need to convert to a real UTC time.
00330  *
00331  * OUTPUTS:
00332  *      time_t * ut:         Store the result in *ut.
00333  */
00334 static BOOL FileTimeToUnixTime ( const FILETIME* pft, time_t* put, BOOL local_time )
00335 {
00336     BOOL success = FALSE;
00337
00338    /* FILETIME = number of 100-nanosecond ticks since midnight
00339     * 1 Jan 1601 UTC. time_t = number of 1-second ticks since
00340     * midnight 1 Jan 1970 UTC. To translate, we subtract a
00341     * FILETIME representation of midnight, 1 Jan 1970 from the
00342     * time in question and divide by the number of 100-ns ticks
00343     * in one second.
00344     */
00345
00346
00347     SYSTEMTIME base_st =
00348     {
00349         1970,   /* wYear            */
00350         1,      /* wMonth           */
00351         0,      /* wDayOfWeek       */
00352         1,      /* wDay             */
00353         0,      /* wHour            */
00354         0,      /* wMinute          */
00355         0,      /* wSecond          */
00356         0       /* wMilliseconds    */
00357     };
00358
00359     ULARGE_INTEGER itime;
00360     FILETIME base_ft;
00361     int bias = 0;
00362
00363     if (local_time)
00364     {
00365         SYSTEMTIME temp_st;
00366         success = FileTimeToSystemTime(pft, & temp_st);
00367         bias =  GetTimeZoneBias(& temp_st);
00368     }
00369
00370     success = SystemTimeToFileTime ( &base_st, &base_ft );
00371     if (success)
00372     {
00373         itime.QuadPart = ((ULARGE_INTEGER *)pft)->QuadPart;
00374
00375         itime.QuadPart -= ((ULARGE_INTEGER *)&base_ft)->QuadPart;
00376         itime.QuadPart /= systemtime_second;    // itime is now in seconds.
00377         itime.QuadPart += bias * 60;    // bias is in minutes.
00378
00379         *put = itime.LowPart;
00380     }
00381
00382     if (!success)
00383     {
00384         *put = -1;   /* error value used by mktime() */
00385     }
00386
00387     if (GetWinCvsDebugMaskBit(wcvsdbg_trace_stat_bit))
00388     {
00389             char scratch[128];
00390             SYSTEMTIME temp_st;
00391             struct tm gmt;
00392             bool bDst;
00393             FileTimeToSystemTime(pft, &temp_st);
00394             bDst = IsDST(& temp_st);
00395             gmt = *gmtime(put);
00396             _snprintf(scratch, 128,
00397                 "Converting file time (%s, bias = %d): %s %02d %02d:%02d:%02d.%03d %4d --> %s\n",
00398                 local_time ? (bDst ? "Daylight" : "Standard") : "UTC", bias,
00399                 month_names[temp_st.wMonth - 1], temp_st.wDay,
00400                 temp_st.wHour, temp_st.wMinute, temp_st.wSecond, temp_st.wMilliseconds,
00401                 temp_st.wYear,
00402                 asctime(& gmt) );
00403
00404             cvs_err(scratch);
00405             OutputDebugString(scratch);
00406     }
00407
00408     return success;
00409 }
00410
00411 static int _statcore(HANDLE hFile, const char *filename, struct stat *buf)
00412 {
00413     BY_HANDLE_FILE_INFORMATION bhfi;
00414     int isdev;
00415     char szFs[32];
00416     int is_gmt_fs = -1;
00417
00418     if(hFile)
00419     {
00420         /* Find out what kind of handle underlies filedes
00421         */
00422         isdev = GetFileType(hFile) & ~FILE_TYPE_REMOTE;
00423
00424         if ( isdev != FILE_TYPE_DISK )
00425         {
00426             /* not a disk file. probably a device or pipe
00427              */
00428             if ( (isdev == FILE_TYPE_CHAR) || (isdev == FILE_TYPE_PIPE) )
00429             {
00430                 /* treat pipes and devices similarly. no further info is
00431                  * available from any API, so set the fields as reasonably
00432                  * as possible and return.
00433                  */
00434                 if ( isdev == FILE_TYPE_CHAR )
00435                     buf->st_mode = _S_IFCHR;
00436                 else
00437                     buf->st_mode = _S_IFIFO;
00438
00439                 buf->st_rdev = buf->st_dev = (_dev_t)hFile;
00440                 buf->st_nlink = 1;
00441                 buf->st_uid = buf->st_gid = buf->st_ino = 0;
00442                 buf->st_atime = buf->st_mtime = buf->st_ctime = 0;
00443                 if ( isdev == FILE_TYPE_CHAR )
00444                     buf->st_size = 0;
00445                 else
00446                 {
00447                     unsigned long ulAvail;
00448                     int rc;
00449                     rc = PeekNamedPipe(hFile,NULL,0,NULL,&ulAvail,NULL);
00450                     if (rc)
00451                         buf->st_size = (_off_t)ulAvail;
00452                     else
00453                         buf->st_size = (_off_t)0;
00454                 }
00455
00456                 return 0;
00457             }
00458             else if ( isdev == FILE_TYPE_UNKNOWN )
00459             {
00460                 // Network device
00461                 errno = EBADF;
00462                 return -1;
00463             }
00464         }
00465     }
00466
00467     /* set the common fields
00468      */
00469     buf->st_ino = buf->st_uid = buf->st_gid = buf->st_mode = 0;
00470     buf->st_nlink = 1;
00471
00472     if(hFile)
00473     {
00474         /* use the file handle to get all the info about the file
00475          */
00476         if ( !GetFileInformationByHandle(hFile, &bhfi) )
00477         {
00478             _dosmaperr(GetLastError());
00479             return -1;
00480         }
00481     }
00482     else
00483     {
00484         WIN32_FIND_DATA fd;
00485         HANDLE hFind;
00486
00487         if(strlen(filename)==3 && !stricmp(filename+1,":\\"))
00488         {
00489             // Can't do anything about the root directory...
00490             // Win2k and Win98 can return info, but Win95 can't, so
00491             // it's best to do nothing.
00492             memset(&bhfi,0,sizeof(bhfi));
00493             bhfi.dwFileAttributes=GetFileAttributes(filename);
00494             if(bhfi.dwFileAttributes==0xFFFFFFFF)
00495             {
00496                 _dosmaperr(GetLastError());
00497                 return -1;
00498             }
00499             bhfi.nNumberOfLinks=1;
00500         }
00501         else
00502         {
00503             hFind=FindFirstFile(filename,&fd);
00504             if(hFind==INVALID_HANDLE_VALUE)
00505             {
00506                 _dosmaperr(GetLastError());
00507                 return -1;
00508             }
00509             FindClose(hFind);
00510             memset(&bhfi,0,sizeof(bhfi));
00511             bhfi.dwFileAttributes=fd.dwFileAttributes;
00512             bhfi.ftCreationTime=fd.ftCreationTime;
00513             bhfi.ftLastAccessTime=fd.ftLastAccessTime;
00514             bhfi.ftLastWriteTime=fd.ftLastWriteTime;
00515             bhfi.nFileSizeLow=fd.nFileSizeLow;
00516             bhfi.nFileSizeHigh=fd.nFileSizeHigh;
00517             bhfi.nNumberOfLinks=1;
00518         }
00519     }
00520
00521     if ( bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY )
00522         buf->st_mode |= (_S_IREAD + (_S_IREAD >> 3) + (_S_IREAD >> 6));
00523     else
00524         buf->st_mode |= ((_S_IREAD|_S_IWRITE) + ((_S_IREAD|_S_IWRITE) >> 3)
00525           + ((_S_IREAD|_S_IWRITE) >> 6));
00526     if (bhfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
00527         buf->st_mode |= (_S_IEXEC + (_S_IEXEC >> 3) + (_S_IEXEC >> 6));
00528
00529     // Potential, but unlikely problem... casting DWORD to short.
00530     // Reported by Jerzy Kaczorowski, addressed by Jonathan Gilligan
00531     // if the number of links is greater than 0x7FFF
00532     // there would be an overflow problem.
00533     // This is a problem inherent in the struct stat, and hence
00534     // in the design of the C library.
00535     ASSERT(bhfi.nNumberOfLinks <= SHRT_MAX);
00536     if (bhfi.nNumberOfLinks > SHRT_MAX) {
00537         buf->st_nlink = SHRT_MAX;
00538         }
00539     else {
00540         buf->st_nlink= static_cast<short>(bhfi.nNumberOfLinks);
00541         }
00542
00543     if(!filename)
00544     {
00545         // We have to assume here that the repository doesn't span drives, so the
00546         // current directory is correct.
00547         *szFs='\0';
00548         GetVolumeInformation(NULL,NULL,0,NULL,NULL,NULL,szFs,32);
00549         if(!stricmp(szFs,"NTFS"))
00550             is_gmt_fs = 1;
00551         else
00552             is_gmt_fs = 0;
00553     }
00554     else
00555     {
00556         if(filename[1]!=':')
00557         {
00558             if((filename[0]=='\\' || filename[0]=='/') && (filename[1]=='\\' || filename[1]=='/'))
00559             {
00560                 // UNC pathname, assumed to be on an NTFS server.  No way to
00561                 // check, actually (GVI doesn't return anything useful).
00562                 is_gmt_fs = 1;
00563             }
00564             else
00565             {
00566                 // Relative path, treat as local
00567                 GetVolumeInformation(NULL,NULL,0,NULL,NULL,NULL,szFs,sizeof(szFs));
00568                 if(!stricmp(szFs,"NTFS"))
00569                     is_gmt_fs = 1;
00570                 else
00571                     is_gmt_fs = 0;
00572             }
00573         }
00574         else
00575         {
00576             // Drive specified...
00577             char szRootPath[4] = "?:\\";
00578             szRootPath[0]=filename[0];
00579             *szFs='\0';
00580             GetVolumeInformation(szRootPath,NULL,0,NULL,NULL,NULL,szFs,sizeof(szFs));
00581             if(!stricmp(szFs,"NTFS") || !stricmp(szFs,"HPFS"))
00582                 is_gmt_fs = 1;
00583             else
00584                 is_gmt_fs = 0;
00585         }
00586     }
00587
00588     if(is_gmt_fs) // NTFS - everything is in GMT already
00589     {
00590         FileTimeToUnixTime ( &bhfi.ftLastAccessTime, &buf->st_atime, FALSE );
00591         FileTimeToUnixTime ( &bhfi.ftLastWriteTime, &buf->st_mtime, FALSE );
00592         FileTimeToUnixTime ( &bhfi.ftCreationTime, &buf->st_ctime, FALSE );
00593     }
00594     else
00595     {
00596         // FAT - timestamps are in incorrectly translated local time.
00597         // translate them back and let FileTimeToUnixTime() do the
00598         // job properly.
00599
00600         FILETIME At,Wt,Ct;
00601
00602         FileTimeToLocalFileTime ( &bhfi.ftLastAccessTime, &At );
00603         FileTimeToLocalFileTime ( &bhfi.ftLastWriteTime, &Wt );
00604         FileTimeToLocalFileTime ( &bhfi.ftCreationTime, &Ct );
00605         FileTimeToUnixTime ( &At, &buf->st_atime, TRUE );
00606         FileTimeToUnixTime ( &Wt, &buf->st_mtime, TRUE );
00607         FileTimeToUnixTime ( &Ct, &buf->st_ctime, TRUE );
00608     }
00609
00610     buf->st_size = bhfi.nFileSizeLow;
00611     if(bhfi.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
00612         buf->st_mode |= _S_IFDIR;
00613     else
00614         buf->st_mode |= _S_IFREG;
00615
00616     /* On DOS, this field contains the drive number, but
00617      * the drive number is not available on this platform.
00618      * Also, for UNC network names, there is no drive number.
00619      */
00620     buf->st_rdev = buf->st_dev = 0;
00621     return 0;
00622 }
00623
00624 int wnt_stat(const char *name, struct stat *buf)
00625 {
00626     if(stricmp(name,"Entries") && stricmp(name,"Entries.log"))
00627         name=name;
00628     return _statcore(NULL,name,buf);
00629 }
00630
00631 int wnt_fstat (int fildes, struct stat *buf)
00632 {
00633     return _statcore((HANDLE)_get_osfhandle(fildes),NULL,buf);
00634 }
00635
00636 int wnt_lstat (const char *name, struct stat *buf)
00637 {
00638     return _statcore(NULL,name,buf);
00639 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


NoPython.cpp File Reference

WinCvs/NoPython.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "NoPython.h"
#include "Persistent.h"
#include "Splash.h"

Include dependency graph for NoPython.cpp:

Include dependency graph

Go to the source code of this file.

Functions

CPersistentBool | gWarnPython ("P_WarnPython", true)
void | WarnNoPython (void)

Function Documentation

void WarnNoPython ( void )

Definition at line 59 of file NoPython.cpp.

Referenced by CPython_Interp::IsAvail().

00060 {
00061     if((bool)gWarnPython)
00062     {
00063         // because it conflicts
00064         CSplashWnd::CloseSplashScreen();
00065
00066         CNoPython dlg;
00067         dlg.DoModal();
00068         if(!dlg.m_remind)
00069             gWarnPython = false;
00070     }
00071 }

CPersistentBool gWarnPython | ( | "P_WarnPython" | ,
 |  | true |
 | ) | [static]

Generated on Sun Oct 21 12:45:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


NoPython.h File Reference

WinCvs/NoPython.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CNoPython

Defines

#define | AFX_NOPYTHON_H__F675DE42_0FA7_4785_8946_E8FC861BBA57__INCLUDED_

Functions

void | WarnNoPython (void)

Define Documentation

#define AFX_NOPYTHON_H__F675DE42_0FA7_4785_8946_E8FC861BBA57__INCLUDED_

Definition at line 2 of file NoPython.h.

Function Documentation

void WarnNoPython ( void )

Definition at line 59 of file NoPython.cpp.

00060 {
00061     if((bool)gWarnPython)
00062     {
00063         // because it conflicts
00064         CSplashWnd::CloseSplashScreen();
00065
00066         CNoPython dlg;
00067         dlg.DoModal();
00068         if(!dlg.m_remind)
00069             gWarnPython = false;
00070     }
00071 }

Generated on Sun Oct 21 12:45:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ProgressDialog.cpp File Reference

WinCvs/ProgressDialog.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "ProgressDialog.h"

Include dependency graph for ProgressDialog.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void flushDisplay (CDialog *dlg, bool &abort)

Function Documentation

void flushDisplay | ( | CDialog * | dlg,
 |  | bool & | abort
 | ) | [static]

Definition at line 84 of file ProgressDialog.cpp.

Referenced by CProgress::SetProgress().

00085 {
00086     MSG msg;
00087     while (PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_NOREMOVE) == TRUE)
00088         AfxGetApp()->PumpMessage();
00089     while (PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE) == TRUE)
00090     {
00091         CPoint pt(LOWORD(msg.lParam), HIWORD(msg.lParam));
00092         ClientToScreen(msg.hwnd, &pt);
00093         CWnd *hwnd = CWnd::WindowFromPoint(pt);
00094         if(!abort && (*hwnd == *dlg || dlg->IsChild(hwnd)))
00095             AfxGetApp()->PumpMessage();
00096         else
00097             PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE);
00098     }
00099 }

Generated on Sun Oct 21 12:45:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ProgressDialog.h File Reference

WinCvs/ProgressDialog.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CProgress
class | CProgressDialog

Defines

#define | AFX_PROGRESSDIALOG_H__09D80542_6467_11D3_85F5_00609419FCC1__INCLUDED_

Define Documentation

#define AFX_PROGRESSDIALOG_H__09D80542_6467_11D3_85F5_00609419FCC1__INCLUDED_

Definition at line 2 of file ProgressDialog.h.

Generated on Sun Oct 21 12:45:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


resource.h File Reference

WinCvs/resource.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | IDR_CNTR_INPLACE 6
#define | IDD_ABOUTBOX 100
#define | IDP_OLE_INIT_FAILED 100
#define | IDP_FAILED_TO_CREATE 102
#define | IDB_LIGHTBULB 103
#define | IDP_SOCKETS_INIT_FAILED 104
#define | IDD_TIP 105
#define | CG_IDS_TIPOFTHEDAY 106
#define | CG_IDS_TIPOFTHEDAYMENU 107
#define | CG_IDS_DIDYOUKNOW 108
#define | CG_IDS_FILE_ABSENT 109
#define | CG_IDP_FILE_CORRUPT 110
#define | CG_IDS_TIPOFTHEDAYHELP 111
#define | IDB_SPLASH 112
#define | IDR_CVS_COWORKER 113
#define | IDR_CVSCOWORKER 114
#define | IDR_CVSGETOPTION 115
#define | IDR_MAINFRAME 128
#define | IDR_WINCVSTYPE 129
#define | IDS_DEFFONT 129
#define | IDR_BROWSER 129
#define | IDD_PREFERENCES 130
#define | IDD_PASSWRD 132
#define | IDD_CMDLINE 133
#define | IDD_ALERT 134
#define | IDD_PREFS_CVSROOT 135
#define | IDD_PREFS_GLOBALS 136
#define | IDD_CHECKOUT_MAIN 137
#define | IDD_COMMIT_MAIN 138
#define | IDD_IMPORT_MAIN 139
#define | IDD_IMPORT_TAGS 140
#define | IDD_CMDLINE_MAIN 142
#define | IDD_IMPORTFILTER 143
#define | IDI_CVSWARNING 144
#define | IDI_CVSERROR 145
#define | IDD_WARNINGDESC 145
#define | IDD_ENTRYDESC 146
#define | IDD_UPDATE_MAIN 147
#define | IDD_UPDATE_STICKY 148
#define | IDD_UPDATE_MERGE 149
#define | IDI_FOLDER 149
#define | IDD_LOG_MAIN 150
#define | IDI_FOLDERO 150
#define | IDI_FOLDERCVS 151
#define | IDD_LOG_FILTERS 152
#define | IDI_FOLDEROCVS 152
#define | IDB_SMALLICONS 152
#define | IDD_DIFF_OPTIONS 153
#define | IDD_DIFF_MAIN 154
#define | IDD_CHECKOUT_OPTIONS 155
#define | IDD_PREFS_WINCVS 156
#define | IDR_FILELIST 157
#define | IDD_YESNO 157
#define | IDR_MULTIUSER 158
#define | IDD_RTAG_CREATE 158
#define | IDD_RTAG_DELETE 159
#define | IDD_RTAG_BRANCH 160
#define | IDR_GRAPH 161
#define | IDD_TAG_BRANCH 161
#define | IDD_TAG_CREATE 162
#define | IDI_FOLDERIGN 162
#define | IDD_TAG_DELETE 163
#define | IDI_FOLDEROIGN 163
#define | IDR_STATEICONS 164
#define | IDI_FOLDERLOST 164
#define | IDR_TAGS 165
#define | IDD_INIT_MAIN 165
#define | IDR_WORKSPACE 173
#define | IDB_LOCATE 176
#define | IDD_PROGRESS 177
#define | IDR_MENUICONS 178
#define | IDB_ABOUT 180
#define | IDD_CUSTOMIZE 181
#define | IDR_CUSTMENUS 182
#define | IDB_PYTHON 183
#define | IDD_SAVESETTINGS 184
#define | IDB_IDLE 185
#define | IDD_RELEASE 185
#define | IDR_FILTER 186
#define | IDD_COMMIT_OPTIONS 186
#define | IDB_HISTLOC 187
#define | IDD_RSH 188
#define | IDD_PSERVER 189
#define | IDD_SSH 190
#define | IDD_PREFS_CVSCMD_DIALOGS 191
#define | IDD_ANNOTATE_MAIN 192
#define | IDD_GRAPH_OPTIONS 193
#define | IDD_PROMPTMESSAGE 194
#define | IDD_EDITMESSAGE 195
#define | IDD_ADMINOPTION 196
#define | IDD_EDITORMON 197
#define | IDD_NOPYTHON 198
#define | IDC_CVSROOT 1000
#define | IDC_BULB 1000
#define | IDC_CHECKOUTRO 1001
#define | IDC_STARTUP 1001
#define | IDC_TCPIP 1002
#define | IDC_NEXTTIP 1002
#define | IDC_PRUNE 1003
#define | IDC_RHOSTS 1004
#define | IDC_DIRTYSUPPORT 1004
#define | IDC_TIPSTRING 1004
#define | IDC_PSERVER 1005
#define | IDC_CHECKUNIXLF 1005
#define | IDC_KSERVER 1006
#define | IDC_QUIET 1007
#define | IDC_CTNLADD 1008
#define | IDC_PROMPTEDIT 1009
#define | IDC_ALWAYSROOT 1009
#define | IDC_PASSWD 1010
#define | IDC_LOGOUT 1010
#define | IDC_CMDLINE 1011
#define | IDC_SELFOLDER 1012
#define | IDC_FOLDERLOC 1013
#define | IDC_BTNPATH2 1014
#define | IDC_ALERTCAPTION 1015
#define | IDC_ALRTMSG 1016
#define | IDC_CVSVERS 1017
#define | IDC_AUTHEN 1018
#define | IDC_STDOUT 1019
#define | IDC_MODNAME 1020
#define | IDC_BTNPATH 1021
#define | IDC_TAGNAME 1021
#define | IDC_NORECURS 1022
#define | IDC_PATH 1023
#define | IDC_FORCE 1023
#define | IDC_LOGMSG 1024
#define | IDC_OVERWRITE 1024
#define | IDC_SPECIFY_REV 1024
#define | IDC_DELSTICKY 1025
#define | IDC_LOGMSG_WRAP 1025
#define | IDC_VTAG 1026
#define | IDC_CREATEMISSDIR 1026
#define | IDC_RHOSTPORT 1027
#define | IDC_CLEANCOPY 1027
#define | IDC_CHECKRHOSTPORT 1028
#define | IDC_CHECKPSERVERPORT 1029
#define | IDC_PSERVERPORT 1030
#define | IDC_CHECKKSERVERPORT 1031
#define | IDC_KSERVERPORT 1032
#define | IDC_CHECKSERVERNAME 1033
#define | IDC_SERVERNAME 1034
#define | IDC_COMBOROOT 1035
#define | IDC_CHECKRSHNAME 1035
#define | IDC_LISTENTRIES 1036
#define | IDC_SERVERNAME2 1036
#define | IDC_RSHNAME 1036
#define | IDC_COMBORSAIDENTITY 1036
#define | IDC_EDITENTRY 1037
#define | IDC_WARNINGDESC 1038
#define | IDC_ENTRYSTATE 1039
#define | IDC_DATE 1040
#define | IDC_ENTRYSTATE3 1041
#define | IDC_ENTRYSTATE4 1042
#define | IDC_COMBOREV 1043
#define | IDC_ENTRYSTATE5 1043
#define | IDC_REV 1044
#define | IDC_MERGE2 1045
#define | IDC_COMBOSTATE 1046
#define | IDC_COMBOREV2 1047
#define | IDC_MERGE 1048
#define | IDC_USER 1049
#define | IDC_COMBO2 1049
#define | IDC_NOTAGS 1050
#define | IDC_NOUSERS 1051
#define | IDC_RTAG 1052
#define | IDC_CHECKPATH 1053
#define | IDC_BTNHOME 1054
#define | IDC_HOME 1055
#define | IDC_ENTRYSTATE2 1056
#define | IDC_COMBODATE 1057
#define | IDC_MATCH 1058
#define | IDC_MERGE1 1059
#define | IDC_COMBOUSER 1060
#define | IDC_DEFBRANCH 1061
#define | IDC_STATE 1062
#define | IDC_ONLYRCS 1063
#define | IDC_CHECK1 1064
#define | IDC_CHECK2 1065
#define | IDC_DIFF1 1066
#define | IDC_DIFF2 1067
#define | IDC_DIFF3 1068
#define | IDC_COMBO1 1069
#define | IDC_BTNPROGRAM 1070
#define | IDC_COMBORTAG 1070
#define | IDC_PROGRAM 1071
#define | IDC_BAR_TREE 1072
#define | IDC_ATTIC 1075
#define | IDC_EXTDIFF 1076
#define | IDC_EXTDIFFSEL 1077
#define | IDC_DIFFPROG 1078
#define | IDC_CHECKUNMOD 1079
#define | IDC_EDIT_POSITION 1079
#define | IDC_ALTCVSCHK 1079
#define | IDC_ALTCVSPROG 1080
#define | IDC_COMBO 1081
#define | IDC_ALTCVSSEL 1081
#define | IDC_WINCVSVER 1082
#define | IDC_SPINLOGOUT 1083
#define | IDC_EDITLOGOUT 1084
#define | IDC_CHECKPROXY 1085
#define | IDC_EDITHOST 1086
#define | IDC_EDITPORT 1087
#define | IDC_FORCEROOT 1088
#define | IDC_EXPORT 1089
#define | IDC_HELPINIT 1090
#define | IDC_LOCATE 1091
#define | IDC_PROGRESS 1093
#define | IDC_ZLEVEL 1095
#define | IDC_ZSPIN 1096
#define | IDC_RSAIDENTITYSEL 1097
#define | IDC_WINCVSURL 1097
#define | IDC_RSAIDENTITY 1098
#define | IDC_ALLCMDS 1098
#define | IDC_CMDMENU 1099
#define | IDC_ADD 1101
#define | IDC_REMOVE 1102
#define | IDC_UP 1103
#define | IDC_DOWN 1104
#define | IDC_MENULIST 1106
#define | IDC_LAUNCHEDITOR 1109
#define | IDC_WORDWRAP 1110
#define | IDC_DELETED 1113
#define | IDC_IGNOREWHITESPACE 1118
#define | IDC_IGNORECASE 1119
#define | IDC_DIRECTORY 1120
#define | IDC_EDIT_CHECKOUTDIR 1121
#define | IDC_CHECK_OVERRIDECHECKOUTDIR 1122
#define | IDC_USE_VIEWER_ALWAYS 1125
#define | IDC_USEDEFIGNORE 1127
#define | IDC_FORCECOMMIT 1128
#define | IDC_FORCERECURSE 1129
#define | IDC_FORCEREVISION 1130
#define | IDC_NOMODULEPROGRAM 1131
#define | IDC_COMBOVTAG 1132
#define | IDC_COMBOMODNAME 1133
#define | IDC_HOST 1135
#define | IDC_LOGIN 1136
#define | IDC_SETTINGS 1137
#define | IDC_AUTHENDESC 1138
#define | IDC_CHECKUPDATE 1139
#define | IDC_CHECKDIFF 1140
#define | IDC_CHECKGRAPH 1141
#define | IDC_CHECKLOG 1142
#define | IDC_RADIOSHIFT 1143
#define | IDC_RADIOCONTROL 1144
#define | IDC_CONSOLE 1144
#define | IDC_ISDATE 1145
#define | IDC_CHECKANNOTATE 1145
#define | IDC_COMBO_REV 1146
#define | IDC_DIFF 1147
#define | IDC_FILETODIFF 1148
#define | IDC_APPLY 1149
#define | IDC_RESET 1150
#define | IDC_HEADER 1152
#define | IDC_TAG 1153
#define | IDC_RGBHEADER 1154
#define | IDC_RGBTAG 1155
#define | IDC_RGBBRANCH 1156
#define | IDC_RGBNODE 1157
#define | IDC_RGBDEAD 1158
#define | IDC_RGBSTATE 1159
#define | IDC_BRANCH 1160
#define | IDC_NODE 1161
#define | IDC_SELECTION 1162
#define | IDC_SHADOW 1163
#define | IDC_DEAD 1164
#define | IDC_RGBSELECTION 1165
#define | IDC_RGBSHADOW 1166
#define | IDC_OPTIONSTRING 1167
#define | IDC_OPTIONDESC 1168
#define | IDC_OPTIONSTRING_SL 1169
#define | IDC_TEMPFILE 1170
#define | IDC_REMIND 1171
#define | IDC_PYTHONURL 1172
#define | ID_CANCEL_EDIT_CNTR 32768
#define | ID_APP_PREFERENCES 32775
#define | ID_APP_CMDLINE 32776
#define | ID_APP_LOGIN 32779
#define | ID_STOPCVS 32795
#define | ID_BROWSER_OPEN 32797
#define | ID_VIEW_BROWSER_BAR 32798
#define | ID_UPDATEBF 32799
#define | ID_COMMITBF 32800
#define | ID_ADDBF 32801
#define | ID_VIEW_SMALLICONS 32802
#define | ID_VIEW_FULLLIST 32803
#define | ID_VIEW_ROWDETAILS 32804
#define | ID_VIEW_FILES_BAR 32805
#define | ID_VIEW_UPDATE 32806
#define | ID_VIEW_COMMIT 32807
#define | ID_VIEW_ADD 32808
#define | ID_VIEW_WORKSPACE 32809
#define | ID_MENUBAR 32810
#define | ID_VIEW_ADDB 32811
#define | ID_VIEW_RMV 32812
#define | IDS_COMBOBROWSER 32813
#define | ID_VIEW_RELOAD 32814
#define | ID_VIEW_UPONE 32826
#define | ID_VIEW_TRASH 32830
#define | ID_VIEW_DIFF 32833
#define | ID_VIEW_LOG 32834
#define | ID_VIEW_STATUS 32835
#define | ID_VIEW_LOCKF 32836
#define | ID_VIEW_UNLOCKF 32837
#define | ID_VIEW_MULTI_BAR 32838
#define | ID_MENUITEM32840 32840
#define | ID_VIEW_WATCHON 32843
#define | ID_VIEW_WATCHOFF 32844
#define | ID_VIEW_EDIT 32845
#define | ID_VIEW_UNEDIT 32846
#define | ID_VIEW_RELEASE 32847
#define | ID_VIEW_WATCHERS 32857
#define | ID_VIEW_EDITORS 32858
#define | ID_CUST_FILES_MENU 32859
#define | ID_CUST_FOLDER_MENU 32860
#define | ID_APP_CREDITS 32872
#define | ID_APP_COPYRIGHTS 32873
#define | ID_GRAPH_CLOSE 32874
#define | ID_VIEW_GRAPH 32875
#define | ID_APP_RTAGCREATE 32881
#define | ID_APP_RTAGDELETE 32882
#define | ID_APP_RTAGBRANCH 32883
#define | ID_VIEW_TAG 32884
#define | ID_VIEW_TAGNEW 32886
#define | ID_VIEW_TAGDELETE 32887
#define | ID_VIEW_TAGBRANCH 32888
#define | ID_VIEW_TAGS_BAR 32889
#define | ID_VIEW_CONSOLE_BAR 32898
#define | ID_VIEW_EXPLORE 32899
#define | ID_HISTORYBROWSE 32900
#define | ID_VIEW_QUERYUPDATE 32901
#define | ID_VIEW_IGNORE 32902
#define | ID_HELP_CVS 32903
#define | ID_HELP_CVSCLIENT 32904
#define | ID_APP_LOGOUT 32906
#define | ID_VIEW_EDITSEL 32908
#define | ID_VIEW_EDITSELDEF 32909
#define | ID_ACCEL32911 32911
#define | ID_VIEWW_INIT 32912
#define | ID_VIEW_IMPORT 32913
#define | ID_VIEW_INIT 32914
#define | ID_VIEW_CHECKOUT 32915
#define | ID_VIEW_DELREV 32916
#define | ID_VIEW_SELNONSIG 32917
#define | ID_BUTTON32918 32918
#define | ID_BUTTON32919 32919
#define | ID_BUTTON32920 32920
#define | ID_BUTTON32921 32921
#define | ID_SAVESETTINGS 32922
#define | ID_VIEW_RETRIEVE 32923
#define | ID_VIEW_RECURSIVE 32924
#define | ID_VIEW_FILTER_BAR 32925
#define | ID_VIEW_MODIFIED 32927
#define | ID_FILTERMASK 32928
#define | ID_VIEW_CONFLICT 32929
#define | ID_VIEW_UNKNOWN 32931
#define | ID_VIEW_MISSING 32932
#define | ID_VIEW_ADDED 32935
#define | ID_VIEW_REMOVED 32936
#define | ID_VIEW_CHANGED 32937
#define | ID_VIEW_HIDEUNKNOWN 32938
#define | ID_BUTTON32940 32940
#define | ID_QUERY_ANNOTATE 32941
#define | ID_VIEW_BROWSELOCATION_REMOVEUNWANTED 32943
#define | ID_USE_TCLSHELL 32944
#define | ID_USE_PYSHELL 32945
#define | ID_GRAPH_GRAPHOPTIONS 32946
#define | ID_GRAPH_ADMINOPTIONS_CHANGELOGMESSAGE 32950
#define | ID_GRAPH_ADMINOPTIONS_SETSTATE 32951
#define | ID_GRAPH_ADMINOPTIONS_SETDESCRIPTION 32952
#define | ID_GRAPH_CHANGELOGMESSAGE 32954
#define | ID_GRAPH_SETSTATE 32955
#define | ID_GRAPH_SETDESCRIPTION 32956
#define | ID_MACRO_START 34000
#define | ID_MACRO_SEL 34100
#define | ID_MACRO_ADMIN 34200
#define | ID_MACRO_END 34200

Define Documentation

#define CG_IDP_FILE_CORRUPT 110

Definition at line 16 of file resource.h.

#define CG_IDS_DIDYOUKNOW 108

Definition at line 14 of file resource.h.

#define CG_IDS_FILE_ABSENT 109

Definition at line 15 of file resource.h.

#define CG_IDS_TIPOFTHEDAY 106

Definition at line 12 of file resource.h.

#define CG_IDS_TIPOFTHEDAYHELP 111

Definition at line 17 of file resource.h.

#define CG_IDS_TIPOFTHEDAYMENU 107

Definition at line 13 of file resource.h.

#define IDB_ABOUT 180

Definition at line 76 of file resource.h.

#define IDB_HISTLOC 187

Definition at line 85 of file resource.h.

#define IDB_IDLE 185

Definition at line 81 of file resource.h.

#define IDB_LIGHTBULB 103

Definition at line 9 of file resource.h.

#define IDB_LOCATE 176

Definition at line 73 of file resource.h.

#define IDB_PYTHON 183

Definition at line 79 of file resource.h.

#define IDB_SMALLICONS 152

Definition at line 51 of file resource.h.

#define IDB_SPLASH 112

Definition at line 18 of file resource.h.

#define IDC_ADD 1101

Definition at line 220 of file resource.h.

#define IDC_ALERTCAPTION 1015

Definition at line 120 of file resource.h.

#define IDC_ALLCMDS 1098

Definition at line 218 of file resource.h.

#define IDC_ALRTMSG 1016

Definition at line 121 of file resource.h.

#define IDC_ALTCVSCHK 1079

Definition at line 198 of file resource.h.

#define IDC_ALTCVSPROG 1080

Definition at line 199 of file resource.h.

#define IDC_ALTCVSSEL 1081

Definition at line 201 of file resource.h.

#define IDC_ALWAYSROOT 1009

Definition at line 113 of file resource.h.

#define IDC_APPLY 1149

Definition at line 257 of file resource.h.

#define IDC_ATTIC 1075

Definition at line 192 of file resource.h.

#define IDC_AUTHEN 1018

Definition at line 123 of file resource.h.

#define IDC_AUTHENDESC 1138

Definition at line 244 of file resource.h.

#define IDC_BAR_TREE 1072

Definition at line 191 of file resource.h.

#define IDC_BRANCH 1160

Definition at line 267 of file resource.h.

#define IDC_BTNHOME 1054

Definition at line 172 of file resource.h.

#define IDC_BTNPATH 1021

Definition at line 126 of file resource.h.

#define IDC_BTNPATH2 1014

Definition at line 119 of file resource.h.

#define IDC_BTNPROGRAM 1070

Definition at line 188 of file resource.h.

#define IDC_BULB 1000

Definition at line 98 of file resource.h.

#define IDC_CHECK1 1064

Definition at line 182 of file resource.h.

#define IDC_CHECK2 1065

Definition at line 183 of file resource.h.

#define IDC_CHECKANNOTATE 1145

Definition at line 253 of file resource.h.

#define IDC_CHECKDIFF 1140

Definition at line 246 of file resource.h.

#define IDC_CHECKGRAPH 1141

Definition at line 247 of file resource.h.

#define IDC_CHECKKSERVERPORT 1031

Definition at line 143 of file resource.h.

#define IDC_CHECKLOG 1142

Definition at line 248 of file resource.h.

#define IDC_CHECKOUTRO 1001

Definition at line 99 of file resource.h.

#define IDC_CHECKPATH 1053

Definition at line 171 of file resource.h.

#define IDC_CHECKPROXY 1085

Definition at line 205 of file resource.h.

#define IDC_CHECKPSERVERPORT 1029

Definition at line 141 of file resource.h.

#define IDC_CHECKRHOSTPORT 1028

Definition at line 140 of file resource.h.

#define IDC_CHECKRSHNAME 1035

Definition at line 148 of file resource.h.

#define IDC_CHECKSERVERNAME 1033

Definition at line 145 of file resource.h.

#define IDC_CHECKUNIXLF 1005

Definition at line 108 of file resource.h.

#define IDC_CHECKUNMOD 1079

Definition at line 196 of file resource.h.

#define IDC_CHECKUPDATE 1139

Definition at line 245 of file resource.h.

#define IDC_CHECK_OVERRIDECHECKOUTDIR 1122

Definition at line 232 of file resource.h.

#define IDC_CLEANCOPY 1027

Definition at line 139 of file resource.h.

#define IDC_CMDLINE 1011

Definition at line 116 of file resource.h.

#define IDC_CMDMENU 1099

Definition at line 219 of file resource.h.

#define IDC_COMBO 1081

Definition at line 200 of file resource.h.

#define IDC_COMBO1 1069

Definition at line 187 of file resource.h.

#define IDC_COMBO2 1049

Definition at line 167 of file resource.h.

#define IDC_COMBODATE 1057

Definition at line 175 of file resource.h.

#define IDC_COMBOMODNAME 1133

Definition at line 240 of file resource.h.

#define IDC_COMBOREV 1043

Definition at line 159 of file resource.h.

#define IDC_COMBOREV2 1047

Definition at line 164 of file resource.h.

#define IDC_COMBOROOT 1035

Definition at line 147 of file resource.h.

#define IDC_COMBORSAIDENTITY 1036

Definition at line 152 of file resource.h.

#define IDC_COMBORTAG 1070

Definition at line 189 of file resource.h.

#define IDC_COMBOSTATE 1046

Definition at line 163 of file resource.h.

#define IDC_COMBOUSER 1060

Definition at line 178 of file resource.h.

#define IDC_COMBOVTAG 1132

Definition at line 239 of file resource.h.

#define IDC_COMBO_REV 1146

Definition at line 254 of file resource.h.

#define IDC_CONSOLE 1144

Definition at line 251 of file resource.h.

#define IDC_CREATEMISSDIR 1026

Definition at line 137 of file resource.h.

#define IDC_CTNLADD 1008

Definition at line 111 of file resource.h.

#define IDC_CVSROOT 1000

Definition at line 97 of file resource.h.

#define IDC_CVSVERS 1017

Definition at line 122 of file resource.h.

#define IDC_DATE 1040

Definition at line 156 of file resource.h.

#define IDC_DEAD 1164

Definition at line 271 of file resource.h.

#define IDC_DEFBRANCH 1061

Definition at line 179 of file resource.h.

#define IDC_DELETED 1113

Definition at line 227 of file resource.h.

#define IDC_DELSTICKY 1025

Definition at line 134 of file resource.h.

#define IDC_DIFF 1147

Definition at line 255 of file resource.h.

#define IDC_DIFF1 1066

Definition at line 184 of file resource.h.

#define IDC_DIFF2 1067

Definition at line 185 of file resource.h.

#define IDC_DIFF3 1068

Definition at line 186 of file resource.h.

#define IDC_DIFFPROG 1078

Definition at line 195 of file resource.h.

#define IDC_DIRECTORY 1120

Definition at line 230 of file resource.h.

#define IDC_DIRTYSUPPORT 1004

Definition at line 105 of file resource.h.

#define IDC_DOWN 1104

Definition at line 223 of file resource.h.

#define IDC_EDITENTRY 1037

Definition at line 153 of file resource.h.

#define IDC_EDITHOST 1086

Definition at line 206 of file resource.h.

#define IDC_EDITLOGOUT 1084

Definition at line 204 of file resource.h.

#define IDC_EDITPORT 1087

Definition at line 207 of file resource.h.

#define IDC_EDIT_CHECKOUTDIR 1121

Definition at line 231 of file resource.h.

#define IDC_EDIT_POSITION 1079

Definition at line 197 of file resource.h.

#define IDC_ENTRYSTATE 1039

Definition at line 155 of file resource.h.

#define IDC_ENTRYSTATE2 1056

Definition at line 174 of file resource.h.

#define IDC_ENTRYSTATE3 1041

Definition at line 157 of file resource.h.

#define IDC_ENTRYSTATE4 1042

Definition at line 158 of file resource.h.

#define IDC_ENTRYSTATE5 1043

Definition at line 160 of file resource.h.

#define IDC_EXPORT 1089

Definition at line 209 of file resource.h.

#define IDC_EXTDIFF 1076

Definition at line 193 of file resource.h.

#define IDC_EXTDIFFSEL 1077

Definition at line 194 of file resource.h.

#define IDC_FILETODIFF 1148

Definition at line 256 of file resource.h.

#define IDC_FOLDERLOC 1013

Definition at line 118 of file resource.h.

#define IDC_FORCE 1023

Definition at line 130 of file resource.h.

#define IDC_FORCECOMMIT 1128

Definition at line 235 of file resource.h.

#define IDC_FORCERECURSE 1129

Definition at line 236 of file resource.h.

#define IDC_FORCEREVISION 1130

Definition at line 237 of file resource.h.

#define IDC_FORCEROOT 1088

Definition at line 208 of file resource.h.

#define IDC_HEADER 1152

Definition at line 259 of file resource.h.

#define IDC_HELPINIT 1090

Definition at line 210 of file resource.h.

#define IDC_HOME 1055

Definition at line 173 of file resource.h.

#define IDC_HOST 1135

Definition at line 241 of file resource.h.

#define IDC_IGNORECASE 1119

Definition at line 229 of file resource.h.

#define IDC_IGNOREWHITESPACE 1118

Definition at line 228 of file resource.h.

#define IDC_ISDATE 1145

Definition at line 252 of file resource.h.

#define IDC_KSERVER 1006

Definition at line 109 of file resource.h.

#define IDC_KSERVERPORT 1032

Definition at line 144 of file resource.h.

#define IDC_LAUNCHEDITOR 1109

Definition at line 225 of file resource.h.

#define IDC_LISTENTRIES 1036

Definition at line 149 of file resource.h.

#define IDC_LOCATE 1091

Definition at line 211 of file resource.h.

#define IDC_LOGIN 1136

Definition at line 242 of file resource.h.

#define IDC_LOGMSG 1024

Definition at line 131 of file resource.h.

#define IDC_LOGMSG_WRAP 1025

Definition at line 135 of file resource.h.

#define IDC_LOGOUT 1010

Definition at line 115 of file resource.h.

#define IDC_MATCH 1058

Definition at line 176 of file resource.h.

#define IDC_MENULIST 1106

Definition at line 224 of file resource.h.

#define IDC_MERGE 1048

Definition at line 165 of file resource.h.

#define IDC_MERGE1 1059

Definition at line 177 of file resource.h.

#define IDC_MERGE2 1045

Definition at line 162 of file resource.h.

#define IDC_MODNAME 1020

Definition at line 125 of file resource.h.

#define IDC_NEXTTIP 1002

Definition at line 102 of file resource.h.

#define IDC_NODE 1161

Definition at line 268 of file resource.h.

#define IDC_NOMODULEPROGRAM 1131

Definition at line 238 of file resource.h.

#define IDC_NORECURS 1022

Definition at line 128 of file resource.h.

#define IDC_NOTAGS 1050

Definition at line 168 of file resource.h.

#define IDC_NOUSERS 1051

Definition at line 169 of file resource.h.

#define IDC_ONLYRCS 1063

Definition at line 181 of file resource.h.

#define IDC_OPTIONDESC 1168

Definition at line 275 of file resource.h.

#define IDC_OPTIONSTRING 1167

Definition at line 274 of file resource.h.

#define IDC_OPTIONSTRING_SL 1169

Definition at line 276 of file resource.h.

#define IDC_OVERWRITE 1024

Definition at line 132 of file resource.h.

#define IDC_PASSWD 1010

Definition at line 114 of file resource.h.

#define IDC_PATH 1023

Definition at line 129 of file resource.h.

#define IDC_PROGRAM 1071

Definition at line 190 of file resource.h.

#define IDC_PROGRESS 1093

Definition at line 212 of file resource.h.

#define IDC_PROMPTEDIT 1009

Definition at line 112 of file resource.h.

#define IDC_PRUNE 1003

Definition at line 103 of file resource.h.

#define IDC_PSERVER 1005

Definition at line 107 of file resource.h.

#define IDC_PSERVERPORT 1030

Definition at line 142 of file resource.h.

#define IDC_PYTHONURL 1172

Definition at line 279 of file resource.h.

#define IDC_QUIET 1007

Definition at line 110 of file resource.h.

#define IDC_RADIOCONTROL 1144

Definition at line 250 of file resource.h.

#define IDC_RADIOSHIFT 1143

Definition at line 249 of file resource.h.

#define IDC_REMIND 1171

Definition at line 278 of file resource.h.

#define IDC_REMOVE 1102

Definition at line 221 of file resource.h.

#define IDC_RESET 1150

Definition at line 258 of file resource.h.

#define IDC_REV 1044

Definition at line 161 of file resource.h.

#define IDC_RGBBRANCH 1156

Definition at line 263 of file resource.h.

#define IDC_RGBDEAD 1158

Definition at line 265 of file resource.h.

#define IDC_RGBHEADER 1154

Definition at line 261 of file resource.h.

#define IDC_RGBNODE 1157

Definition at line 264 of file resource.h.

#define IDC_RGBSELECTION 1165

Definition at line 272 of file resource.h.

#define IDC_RGBSHADOW 1166

Definition at line 273 of file resource.h.

#define IDC_RGBSTATE 1159

Definition at line 266 of file resource.h.

#define IDC_RGBTAG 1155

Definition at line 262 of file resource.h.

#define IDC_RHOSTPORT 1027

Definition at line 138 of file resource.h.

#define IDC_RHOSTS 1004

Definition at line 104 of file resource.h.

#define IDC_RSAIDENTITY 1098

Definition at line 217 of file resource.h.

#define IDC_RSAIDENTITYSEL 1097

Definition at line 215 of file resource.h.

#define IDC_RSHNAME 1036

Definition at line 151 of file resource.h.

#define IDC_RTAG 1052

Definition at line 170 of file resource.h.

#define IDC_SELECTION 1162

Definition at line 269 of file resource.h.

#define IDC_SELFOLDER 1012

Definition at line 117 of file resource.h.

#define IDC_SERVERNAME 1034

Definition at line 146 of file resource.h.

#define IDC_SERVERNAME2 1036

Definition at line 150 of file resource.h.

#define IDC_SETTINGS 1137

Definition at line 243 of file resource.h.

#define IDC_SHADOW 1163

Definition at line 270 of file resource.h.

#define IDC_SPECIFY_REV 1024

Definition at line 133 of file resource.h.

#define IDC_SPINLOGOUT 1083

Definition at line 203 of file resource.h.

#define IDC_STARTUP 1001

Definition at line 100 of file resource.h.

#define IDC_STATE 1062

Definition at line 180 of file resource.h.

#define IDC_STDOUT 1019

Definition at line 124 of file resource.h.

#define IDC_TAG 1153

Definition at line 260 of file resource.h.

#define IDC_TAGNAME 1021

Definition at line 127 of file resource.h.

#define IDC_TCPIP 1002

Definition at line 101 of file resource.h.

#define IDC_TEMPFILE 1170

Definition at line 277 of file resource.h.

#define IDC_TIPSTRING 1004

Definition at line 106 of file resource.h.

#define IDC_UP 1103

Definition at line 222 of file resource.h.

#define IDC_USEDEFIGNORE 1127

Definition at line 234 of file resource.h.

#define IDC_USER 1049

Definition at line 166 of file resource.h.

#define IDC_USE_VIEWER_ALWAYS 1125

Definition at line 233 of file resource.h.

#define IDC_VTAG 1026

Definition at line 136 of file resource.h.

#define IDC_WARNINGDESC 1038

Definition at line 154 of file resource.h.

#define IDC_WINCVSURL 1097

Definition at line 216 of file resource.h.

#define IDC_WINCVSVER 1082

Definition at line 202 of file resource.h.

#define IDC_WORDWRAP 1110

Definition at line 226 of file resource.h.

#define IDC_ZLEVEL 1095

Definition at line 213 of file resource.h.

#define IDC_ZSPIN 1096

Definition at line 214 of file resource.h.

#define IDD_ABOUTBOX 100

Definition at line 6 of file resource.h.

#define IDD_ADMINOPTION 196

Definition at line 94 of file resource.h.

#define IDD_ALERT 134

Definition at line 29 of file resource.h.

#define IDD_ANNOTATE_MAIN 192

Definition at line 90 of file resource.h.

#define IDD_CHECKOUT_MAIN 137

Definition at line 32 of file resource.h.

#define IDD_CHECKOUT_OPTIONS 155

Definition at line 54 of file resource.h.

#define IDD_CMDLINE 133

Definition at line 28 of file resource.h.

#define IDD_CMDLINE_MAIN 142

Definition at line 36 of file resource.h.

#define IDD_COMMIT_MAIN 138

Definition at line 33 of file resource.h.

#define IDD_COMMIT_OPTIONS 186

Definition at line 84 of file resource.h.

#define IDD_CUSTOMIZE 181

Definition at line 77 of file resource.h.

#define IDD_DIFF_MAIN 154

Definition at line 53 of file resource.h.

#define IDD_DIFF_OPTIONS 153

Definition at line 52 of file resource.h.

#define IDD_EDITMESSAGE 195

Definition at line 93 of file resource.h.

#define IDD_EDITORMON 197

Definition at line 95 of file resource.h.

#define IDD_ENTRYDESC 146

Definition at line 41 of file resource.h.

#define IDD_GRAPH_OPTIONS 193

Definition at line 91 of file resource.h.

#define IDD_IMPORTFILTER 143

Definition at line 37 of file resource.h.

#define IDD_IMPORT_MAIN 139

Definition at line 34 of file resource.h.

#define IDD_IMPORT_TAGS 140

Definition at line 35 of file resource.h.

#define IDD_INIT_MAIN 165

Definition at line 71 of file resource.h.

#define IDD_LOG_FILTERS 152

Definition at line 49 of file resource.h.

#define IDD_LOG_MAIN 150

Definition at line 46 of file resource.h.

#define IDD_NOPYTHON 198

Definition at line 96 of file resource.h.

#define IDD_PASSWRD 132

Definition at line 27 of file resource.h.

#define IDD_PREFERENCES 130

Definition at line 26 of file resource.h.

#define IDD_PREFS_CVSCMD_DIALOGS 191

Definition at line 89 of file resource.h.

#define IDD_PREFS_CVSROOT 135

Definition at line 30 of file resource.h.

#define IDD_PREFS_GLOBALS 136

Definition at line 31 of file resource.h.

#define IDD_PREFS_WINCVS 156

Definition at line 55 of file resource.h.

#define IDD_PROGRESS 177

Definition at line 74 of file resource.h.

#define IDD_PROMPTMESSAGE 194

Definition at line 92 of file resource.h.

#define IDD_PSERVER 189

Definition at line 87 of file resource.h.

#define IDD_RELEASE 185

Definition at line 82 of file resource.h.

#define IDD_RSH 188

Definition at line 86 of file resource.h.

#define IDD_RTAG_BRANCH 160

Definition at line 61 of file resource.h.

#define IDD_RTAG_CREATE 158

Definition at line 59 of file resource.h.

#define IDD_RTAG_DELETE 159

Definition at line 60 of file resource.h.

#define IDD_SAVESETTINGS 184

Definition at line 80 of file resource.h.

#define IDD_SSH 190

Definition at line 88 of file resource.h.

#define IDD_TAG_BRANCH 161

Definition at line 63 of file resource.h.

#define IDD_TAG_CREATE 162

Definition at line 64 of file resource.h.

#define IDD_TAG_DELETE 163

Definition at line 66 of file resource.h.

#define IDD_TIP 105

Definition at line 11 of file resource.h.

#define IDD_UPDATE_MAIN 147

Definition at line 42 of file resource.h.

#define IDD_UPDATE_MERGE 149

Definition at line 44 of file resource.h.

#define IDD_UPDATE_STICKY 148

Definition at line 43 of file resource.h.

#define IDD_WARNINGDESC 145

Definition at line 40 of file resource.h.

#define IDD_YESNO 157

Definition at line 57 of file resource.h.

#define IDI_CVSERROR 145

Definition at line 39 of file resource.h.

#define IDI_CVSWARNING 144

Definition at line 38 of file resource.h.

#define IDI_FOLDER 149

Definition at line 45 of file resource.h.

#define IDI_FOLDERCVS 151

Definition at line 48 of file resource.h.

#define IDI_FOLDERIGN 162

Definition at line 65 of file resource.h.

#define IDI_FOLDERLOST 164

Definition at line 69 of file resource.h.

#define IDI_FOLDERO 150

Definition at line 47 of file resource.h.

#define IDI_FOLDEROCVS 152

Definition at line 50 of file resource.h.

#define IDI_FOLDEROIGN 163

Definition at line 67 of file resource.h.

#define IDP_FAILED_TO_CREATE 102

Definition at line 8 of file resource.h.

#define IDP_OLE_INIT_FAILED 100

Definition at line 7 of file resource.h.

#define IDP_SOCKETS_INIT_FAILED 104

Definition at line 10 of file resource.h.

#define IDR_BROWSER 129

Definition at line 25 of file resource.h.

#define IDR_CNTR_INPLACE 6

Definition at line 5 of file resource.h.

#define IDR_CUSTMENUS 182

Definition at line 78 of file resource.h.

#define IDR_CVSCOWORKER 114

Definition at line 20 of file resource.h.

#define IDR_CVSGETOPTION 115

Definition at line 21 of file resource.h.

#define IDR_CVS_COWORKER 113

Definition at line 19 of file resource.h.

#define IDR_FILELIST 157

Definition at line 56 of file resource.h.

#define IDR_FILTER 186

Definition at line 83 of file resource.h.

#define IDR_GRAPH 161

Definition at line 62 of file resource.h.

#define IDR_MAINFRAME 128

Definition at line 22 of file resource.h.

#define IDR_MENUICONS 178

Definition at line 75 of file resource.h.

#define IDR_MULTIUSER 158

Definition at line 58 of file resource.h.

#define IDR_STATEICONS 164

Definition at line 68 of file resource.h.

#define IDR_TAGS 165

Definition at line 70 of file resource.h.

#define IDR_WINCVSTYPE 129

Definition at line 23 of file resource.h.

#define IDR_WORKSPACE 173

Definition at line 72 of file resource.h.

#define IDS_COMBOBROWSER 32813

Definition at line 301 of file resource.h.

#define IDS_DEFFONT 129

Definition at line 24 of file resource.h.

#define ID_ACCEL32911 32911

Definition at line 343 of file resource.h.

#define ID_ADDBF 32801

Definition at line 289 of file resource.h.

#define ID_APP_CMDLINE 32776

Definition at line 282 of file resource.h.

#define ID_APP_COPYRIGHTS 32873

Definition at line 322 of file resource.h.

#define ID_APP_CREDITS 32872

Definition at line 321 of file resource.h.

#define ID_APP_LOGIN 32779

Definition at line 283 of file resource.h.

#define ID_APP_LOGOUT 32906

Definition at line 340 of file resource.h.

#define ID_APP_PREFERENCES 32775

Definition at line 281 of file resource.h.

#define ID_APP_RTAGBRANCH 32883

Definition at line 327 of file resource.h.

#define ID_APP_RTAGCREATE 32881

Definition at line 325 of file resource.h.

#define ID_APP_RTAGDELETE 32882

Definition at line 326 of file resource.h.

#define ID_BROWSER_OPEN 32797

Definition at line 285 of file resource.h.

#define ID_BUTTON32918 32918

Definition at line 350 of file resource.h.

#define ID_BUTTON32919 32919

Definition at line 351 of file resource.h.

#define ID_BUTTON32920 32920

Definition at line 352 of file resource.h.

#define ID_BUTTON32921 32921

Definition at line 353 of file resource.h.

#define ID_BUTTON32940 32940

Definition at line 367 of file resource.h.

#define ID_CANCEL_EDIT_CNTR 32768

Definition at line 280 of file resource.h.

#define ID_COMMITBF 32800

Definition at line 288 of file resource.h.

#define ID_CUST_FILES_MENU 32859

Definition at line 319 of file resource.h.

#define ID_CUST_FOLDER_MENU 32860

Definition at line 320 of file resource.h.

#define ID_FILTERMASK 32928

Definition at line 359 of file resource.h.

#define ID_GRAPH_ADMINOPTIONS_CHANGELOGMESSAGE 32950

Definition at line 373 of file resource.h.

#define ID_GRAPH_ADMINOPTIONS_SETDESCRIPTION 32952

Definition at line 375 of file resource.h.

#define ID_GRAPH_ADMINOPTIONS_SETSTATE 32951

Definition at line 374 of file resource.h.

#define ID_GRAPH_CHANGELOGMESSAGE 32954

Definition at line 376 of file resource.h.

#define ID_GRAPH_CLOSE 32874

Definition at line 323 of file resource.h.

#define ID_GRAPH_GRAPHOPTIONS 32946

Definition at line 372 of file resource.h.

#define ID_GRAPH_SETDESCRIPTION 32956

Definition at line 378 of file resource.h.

#define ID_GRAPH_SETSTATE 32955

Definition at line 377 of file resource.h.

#define ID_HELP_CVS 32903

Definition at line 338 of file resource.h.

#define ID_HELP_CVSCLIENT 32904

Definition at line 339 of file resource.h.

#define ID_HISTORYBROWSE 32900

Definition at line 335 of file resource.h.

#define ID_MACRO_ADMIN 34200

Definition at line 381 of file resource.h.

#define ID_MACRO_END 34200

Definition at line 382 of file resource.h.

#define ID_MACRO_SEL 34100

Definition at line 380 of file resource.h.

#define ID_MACRO_START 34000

Definition at line 379 of file resource.h.

#define ID_MENUBAR 32810

Definition at line 298 of file resource.h.

#define ID_MENUITEM32840 32840

Definition at line 311 of file resource.h.

#define ID_QUERY_ANNOTATE 32941

Definition at line 368 of file resource.h.

#define ID_SAVESETTINGS 32922

Definition at line 354 of file resource.h.

#define ID_STOPCVS 32795

Definition at line 284 of file resource.h.

#define ID_UPDATEBF 32799

Definition at line 287 of file resource.h.

#define ID_USE_PYSHELL 32945

Definition at line 371 of file resource.h.

#define ID_USE_TCLSHELL 32944

Definition at line 370 of file resource.h.

#define ID_VIEWW_INIT 32912

Definition at line 344 of file resource.h.

#define ID_VIEW_ADD 32808

Definition at line 296 of file resource.h.

#define ID_VIEW_ADDB 32811

Definition at line 299 of file resource.h.

#define ID_VIEW_ADDED 32935

Definition at line 363 of file resource.h.

#define ID_VIEW_BROWSELOCATION_REMOVEUNWANTED 32943

Definition at line 369 of file resource.h.

#define ID_VIEW_BROWSER_BAR 32798

Definition at line 286 of file resource.h.

#define ID_VIEW_CHANGED 32937

Definition at line 365 of file resource.h.

#define ID_VIEW_CHECKOUT 32915

Definition at line 347 of file resource.h.

#define ID_VIEW_COMMIT 32807

Definition at line 295 of file resource.h.

#define ID_VIEW_CONFLICT 32929

Definition at line 360 of file resource.h.

#define ID_VIEW_CONSOLE_BAR 32898

Definition at line 333 of file resource.h.

#define ID_VIEW_DELREV 32916

Definition at line 348 of file resource.h.

#define ID_VIEW_DIFF 32833

Definition at line 305 of file resource.h.

#define ID_VIEW_EDIT 32845

Definition at line 314 of file resource.h.

#define ID_VIEW_EDITORS 32858

Definition at line 318 of file resource.h.

#define ID_VIEW_EDITSEL 32908

Definition at line 341 of file resource.h.

#define ID_VIEW_EDITSELDEF 32909

Definition at line 342 of file resource.h.

#define ID_VIEW_EXPLORE 32899

Definition at line 334 of file resource.h.

#define ID_VIEW_FILES_BAR 32805

Definition at line 293 of file resource.h.

#define ID_VIEW_FILTER_BAR 32925

Definition at line 357 of file resource.h.

#define ID_VIEW_FULLLIST 32803

Definition at line 291 of file resource.h.

#define ID_VIEW_GRAPH 32875

Definition at line 324 of file resource.h.

#define ID_VIEW_HIDEUNKNOWN 32938

Definition at line 366 of file resource.h.

#define ID_VIEW_IGNORE 32902

Definition at line 337 of file resource.h.

#define ID_VIEW_IMPORT 32913

Definition at line 345 of file resource.h.

#define ID_VIEW_INIT 32914

Definition at line 346 of file resource.h.

#define ID_VIEW_LOCKF 32836

Definition at line 308 of file resource.h.

#define ID_VIEW_LOG 32834

Definition at line 306 of file resource.h.

#define ID_VIEW_MISSING 32932

Definition at line 362 of file resource.h.

#define ID_VIEW_MODIFIED 32927

Definition at line 358 of file resource.h.

#define ID_VIEW_MULTI_BAR 32838

Definition at line 310 of file resource.h.

#define ID_VIEW_QUERYUPDATE 32901

Definition at line 336 of file resource.h.

#define ID_VIEW_RECURSIVE 32924

Definition at line 356 of file resource.h.

#define ID_VIEW_RELEASE 32847

Definition at line 316 of file resource.h.

#define ID_VIEW_RELOAD 32814

Definition at line 302 of file resource.h.

#define ID_VIEW_REMOVED 32936

Definition at line 364 of file resource.h.

#define ID_VIEW_RETRIEVE 32923

Definition at line 355 of file resource.h.

#define ID_VIEW_RMV 32812

Definition at line 300 of file resource.h.

#define ID_VIEW_ROWDETAILS 32804

Definition at line 292 of file resource.h.

#define ID_VIEW_SELNONSIG 32917

Definition at line 349 of file resource.h.

#define ID_VIEW_SMALLICONS 32802

Definition at line 290 of file resource.h.

#define ID_VIEW_STATUS 32835

Definition at line 307 of file resource.h.

#define ID_VIEW_TAG 32884

Definition at line 328 of file resource.h.

#define ID_VIEW_TAGBRANCH 32888

Definition at line 331 of file resource.h.

#define ID_VIEW_TAGDELETE 32887

Definition at line 330 of file resource.h.

#define ID_VIEW_TAGNEW 32886

Definition at line 329 of file resource.h.

#define ID_VIEW_TAGS_BAR 32889

Definition at line 332 of file resource.h.

#define ID_VIEW_TRASH 32830

Definition at line 304 of file resource.h.

#define ID_VIEW_UNEDIT 32846

Definition at line 315 of file resource.h.

#define ID_VIEW_UNKNOWN 32931

Definition at line 361 of file resource.h.

#define ID_VIEW_UNLOCKF 32837

Definition at line 309 of file resource.h.

#define ID_VIEW_UPDATE 32806

Definition at line 294 of file resource.h.

#define ID_VIEW_UPONE 32826

Definition at line 303 of file resource.h.

#define ID_VIEW_WATCHERS 32857

Definition at line 317 of file resource.h.

#define ID_VIEW_WATCHOFF 32844

Definition at line 313 of file resource.h.

#define ID_VIEW_WATCHON 32843

Definition at line 312 of file resource.h.

#define ID_VIEW_WORKSPACE 32809

Definition at line 297 of file resource.h.

Generated on Sun Oct 21 12:44:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


SortHeaderCtrl.cpp File Reference

WinCvs/SortHeaderCtrl.cpp File Reference

#include "stdafx.h"
#include "SortHeaderCtrl.h"

Include dependency graph for SortHeaderCtrl.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


SortHeaderCtrl.h File Reference

WinCvs/SortHeaderCtrl.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CSortHeaderCtrl

Generated on Sun Oct 21 12:45:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Splash.cpp File Reference

WinCvs/Splash.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "Splash.h"
#include "wincvs.h"
#include "CPStr.h"

Include dependency graph for Splash.cpp:

Include dependency graph

Go to the source code of this file.

Functions

const int gc_nBitmapRightMargin (519-491)

Function Documentation

const int gc_nBitmapRightMargin ( 519- 491 ) [static]

Generated on Sun Oct 21 12:45:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Splash.h File Reference

WinCvs/Splash.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CSplashWnd

Generated on Sun Oct 21 12:45:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Stat.cpp File Reference

WinCvs/Stat.cpp File Reference

#include <stdafx.h>
#include <errno.h>
#include <io.h>
#include "AppConsole.h"
#include "wincvsdebug.h"

Include dependency graph for Stat.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void | _dosmaperr (DWORD dwErr)
BOOL | IsLeapYear (WORD year)
int | CompareTargetDate (const SYSTEMTIME *p_test_date, const SYSTEMTIME *p_target_date)
int | GetTimeZoneBias (const SYSTEMTIME *pst)
bool | IsDST (const SYSTEMTIME *pst)
void | LocalSystemTimeToUtcSystemTime (const SYSTEMTIME *p_local, SYSTEMTIME *p_utc)
BOOL | FileTimeToUnixTime (const FILETIME *pft, time_t *put, BOOL local_time)
int | _statcore (HANDLE hFile, const char *filename, struct stat *buf)
int | wnt_stat (const char *name, struct stat *buf)
int | wnt_fstat (int fildes, struct stat *buf)
int | wnt_lstat (const char *name, struct stat *buf)

Variables

{ ... } errors []
const WORD | month_len [12]
const char * | month_names [12]
const ULONGLONG | systemtime_second = 10000000L

Function Documentation

int CompareTargetDate | ( | const SYSTEMTIME * | p_test_date,
 |  | const SYSTEMTIME * | p_target_date
 | ) | [static]

Definition at line 149 of file Stat.cpp.

Referenced by GetTimeZoneBias(), IsDST(), and LocalSystemTimeToUtcSystemTime().

00153 {
00154     WORD first_day_of_month; /* day of week of the first. Sunday = 0 */
00155     WORD end_of_month;       /* last day of month */
00156     WORD temp_date;
00157     int test_milliseconds, target_milliseconds;
00158
00159     /* Check that p_target_date is in the correct foramt: */
00160     ASSERT(p_target_date->wYear==0 && p_test_date->wYear != 0);
00161     if (p_target_date->wYear != 0 || p_test_date->wYear == 0)
00162         return 0;
00163
00164     /* Don't waste time calculating if we can shortcut the comparison... */
00165     if (p_test_date->wMonth != p_target_date->wMonth)
00166     {
00167         return (p_test_date->wMonth > p_target_date->wMonth) ? 4 : -4;
00168     }
00169
00170     /* Months equal. Now we neet to do some calculation.
00171      * If we know that y is the day of the week for some arbitrary date x,
00172      * then the day of the week of the first of the month is given by
00173      * (1 + y - x) mod 7.
00174      *
00175      * For instance, if the 19th is a Wednesday (day of week = 3), then
00176      * the date of the first Wednesday of the month is (19 mod 7) = 5.
00177      * If the 5th is a Wednesday (3), then the first of the month is
00178      * four days earlier (it's the first, not the zeroth):
00179      * (3 - 4) = -1; -1 mod 7 = 6. The first is a Saturday.
00180      *
00181      * Check ourselves: The 19th falls on a (6 + 19 - 1) mod 7
00182      * = 24 mod 7 = 3: Wednesday, as it should be.
00183      */
00184     first_day_of_month = (WORD)( (1u + p_test_date->wDayOfWeek - p_test_date->wDay) % 7u);
00185
00186     /* If the first of the month comes on day y, then the first day of week z falls on
00187      * (z - y + 1) mod 7.
00188      *
00189      * For instance, if the first is a Saturday (6), then the first Tuesday (2) falls on a
00190      * (2 - 6 + 1) mod 7 = -3 mod 7 = 4: The fourth. This is correct (see above).
00191      *
00192      * temp_date gets the first <target day of week> in the month.
00193      */
00194     temp_date = (WORD)( (1u + p_target_date->wDayOfWeek - first_day_of_month) % 7u);
00195     /* If we're looking for the third Tuesday in the month, find the date of the first
00196      * Tuesday and add (3 - 1) * 7. In the example, it's the 4 + 14 = 18th.
00197      *
00198      * temp_date now should hold the date for the wDay'th wDayOfWeek of the month.
00199      * we only need to handle the special case of the last <DayOfWeek> of the month.
00200      */
00201     temp_date = (WORD)( temp_date + 7 * p_target_date->wDay );
00202
00203     /* what's the last day of the month? */
00204     end_of_month = month_len [p_target_date->wMonth - 1];
00205     /* Correct if it's February of a leap year? */
00206     if ( p_test_date->wMonth == 2 && IsLeapYear(p_test_date->wYear) )
00207     {
00208         ++ end_of_month;
00209     }
00210
00211     /* if we tried to calculate the fifth Tuesday of the month
00212      * we may well have overshot. Correct for that case.
00213      */
00214     while ( temp_date > end_of_month)
00215         temp_date -= 7;
00216
00217     /* At long last, we're ready to do the comparison. */
00218     if ( p_test_date->wDay != temp_date )
00219     {
00220         return (p_test_date->wDay > temp_date) ? 2 : -2;
00221     }
00222     else
00223     {
00224         test_milliseconds = ((p_test_date->wHour * 60 + p_test_date->wMinute) * 60
00225                                 + p_test_date->wSecond) * 1000 + p_test_date->wMilliseconds;
00226         target_milliseconds = ((p_target_date->wHour * 60 + p_target_date->wMinute) * 60
00227                                 + p_target_date->wSecond) * 1000 + p_target_date->wMilliseconds;
00228         test_milliseconds -= target_milliseconds;
00229         return (test_milliseconds > 0) ? 1 : (test_milliseconds < 0) ? -1 : 0;
00230     }
00231
00232 }

BOOL FileTimeToUnixTime | ( | const FILETIME * | pft,
 |  | time_t * | put,
 |  | BOOL | local_time
 | ) | [static]

Definition at line 334 of file Stat.cpp.

Referenced by _statcore().

00335 {
00336     BOOL success = FALSE;
00337
00338    /* FILETIME = number of 100-nanosecond ticks since midnight
00339     * 1 Jan 1601 UTC. time_t = number of 1-second ticks since
00340     * midnight 1 Jan 1970 UTC. To translate, we subtract a
00341     * FILETIME representation of midnight, 1 Jan 1970 from the
00342     * time in question and divide by the number of 100-ns ticks
00343     * in one second.
00344     */
00345
00346
00347     SYSTEMTIME base_st =
00348     {
00349         1970,   /* wYear            */
00350         1,      /* wMonth           */
00351         0,      /* wDayOfWeek       */
00352         1,      /* wDay             */
00353         0,      /* wHour            */
00354         0,      /* wMinute          */
00355         0,      /* wSecond          */
00356         0       /* wMilliseconds    */
00357     };
00358
00359     ULARGE_INTEGER itime;
00360     FILETIME base_ft;
00361     int bias = 0;
00362
00363     if (local_time)
00364     {
00365         SYSTEMTIME temp_st;
00366         success = FileTimeToSystemTime(pft, & temp_st);
00367         bias =  GetTimeZoneBias(& temp_st);
00368     }
00369
00370     success = SystemTimeToFileTime ( &base_st, &base_ft );
00371     if (success)
00372     {
00373         itime.QuadPart = ((ULARGE_INTEGER *)pft)->QuadPart;
00374
00375         itime.QuadPart -= ((ULARGE_INTEGER *)&base_ft)->QuadPart;
00376         itime.QuadPart /= systemtime_second;    // itime is now in seconds.
00377         itime.QuadPart += bias * 60;    // bias is in minutes.
00378
00379         *put = itime.LowPart;
00380     }
00381
00382     if (!success)
00383     {
00384         *put = -1;   /* error value used by mktime() */
00385     }
00386
00387     if (GetWinCvsDebugMaskBit(wcvsdbg_trace_stat_bit))
00388     {
00389             char scratch[128];
00390             SYSTEMTIME temp_st;
00391             struct tm gmt;
00392             bool bDst;
00393             FileTimeToSystemTime(pft, &temp_st);
00394             bDst = IsDST(& temp_st);
00395             gmt = *gmtime(put);
00396             _snprintf(scratch, 128,
00397                 "Converting file time (%s, bias = %d): %s %02d %02d:%02d:%02d.%03d %4d --> %s\n",
00398                 local_time ? (bDst ? "Daylight" : "Standard") : "UTC", bias,
00399                 month_names[temp_st.wMonth - 1], temp_st.wDay,
00400                 temp_st.wHour, temp_st.wMinute, temp_st.wSecond, temp_st.wMilliseconds,
00401                 temp_st.wYear,
00402                 asctime(& gmt) );
00403
00404             cvs_err(scratch);
00405             OutputDebugString(scratch);
00406     }
00407
00408     return success;
00409 }

int GetTimeZoneBias ( const SYSTEMTIME * pst ) [static]

Definition at line 239 of file Stat.cpp.

Referenced by FileTimeToUnixTime(), and LocalSystemTimeToUtcSystemTime().

00240 {
00241     TIME_ZONE_INFORMATION tz;
00242     int n, bias;
00243
00244     GetTimeZoneInformation ( &tz );
00245
00246     /*  I only deal with cases where we look at
00247      *  a "last sunday" kind of thing.
00248      */
00249     ASSERT(tz.DaylightDate.wYear == 0 && tz.StandardDate.wYear == 0);
00250
00251     bias = tz.Bias;
00252
00253     n = CompareTargetDate ( pst, & tz.DaylightDate );
00254     if (n < 0)
00255         bias += tz.StandardBias;
00256     else
00257     {
00258         n = CompareTargetDate ( pst, & tz.StandardDate );
00259         if (n < 0)
00260             bias += tz.DaylightBias;
00261         else
00262             bias += tz.StandardBias;
00263     }
00264     return bias;
00265 }

bool IsDST ( const SYSTEMTIME * pst ) [static]

Definition at line 270 of file Stat.cpp.

Referenced by FileTimeToUnixTime().

00271 {
00272     TIME_ZONE_INFORMATION tz;
00273
00274     GetTimeZoneInformation ( &tz );
00275
00276     /*  I only deal with cases where we look at
00277      *  a "last sunday" kind of thing.
00278      */
00279     ASSERT(tz.DaylightDate.wYear == 0 && tz.StandardDate.wYear == 0);
00280
00281     return (CompareTargetDate ( pst, & tz.DaylightDate ) >= 0)
00282             && (CompareTargetDate ( pst, & tz.StandardDate ) < 0);
00283 }

BOOL IsLeapYear ( WORD year )

Definition at line 106 of file Stat.cpp.

Referenced by CompareTargetDate().

00107 {
00108     return ( (year & 3u == 0)
00109             && ( (year % 100u == 0)
00110                 || (year % 400u == 0) ));
00111 }

void LocalSystemTimeToUtcSystemTime | ( | const SYSTEMTIME * | p_local,
 |  | SYSTEMTIME * | p_utc
 | ) |

Definition at line 301 of file Stat.cpp.

00302 {
00303     FILETIME ft;
00304     ULARGE_INTEGER itime, delta;
00305     int bias = GetTimeZoneBias(p_local);
00306
00307     // delta = bias correction: bias minutes.
00308     SystemTimeToFileTime(p_local, & ft);
00309     itime.QuadPart = ((ULARGE_INTEGER *) &ft)->QuadPart;
00310     delta.QuadPart = systemtime_second * 60 * bias;   // bias in minutes...
00311     itime.QuadPart += delta.QuadPart;
00312
00313     ((ULARGE_INTEGER *) & ft)->QuadPart = itime.QuadPart;
00314     FileTimeToSystemTime(& ft, p_utc);
00315 }

void _dosmaperr ( DWORD dwErr ) [static]

Definition at line 83 of file Stat.cpp.

Referenced by _statcore().

00084 {
00085     int n;
00086     for(n=0; n<sizeof(errors)/sizeof(errors[0]); n++)
00087     {
00088         if(errors[n].err==dwErr)
00089         {
00090             errno=errors[n].dos;
00091             return;
00092         }
00093     }
00094     errno=EFAULT;
00095 }

int _statcore | ( | HANDLE | hFile,
 |  | const char * | filename,
 |  | struct stat * | buf
 | ) | [static]

Definition at line 411 of file Stat.cpp.

Referenced by wnt_fstat(), wnt_lstat(), and wnt_stat().

00412 {
00413     BY_HANDLE_FILE_INFORMATION bhfi;
00414     int isdev;
00415     char szFs[32];
00416     int is_gmt_fs = -1;
00417
00418     if(hFile)
00419     {
00420         /* Find out what kind of handle underlies filedes
00421         */
00422         isdev = GetFileType(hFile) & ~FILE_TYPE_REMOTE;
00423
00424         if ( isdev != FILE_TYPE_DISK )
00425         {
00426             /* not a disk file. probably a device or pipe
00427              */
00428             if ( (isdev == FILE_TYPE_CHAR) || (isdev == FILE_TYPE_PIPE) )
00429             {
00430                 /* treat pipes and devices similarly. no further info is
00431                  * available from any API, so set the fields as reasonably
00432                  * as possible and return.
00433                  */
00434                 if ( isdev == FILE_TYPE_CHAR )
00435                     buf->st_mode = _S_IFCHR;
00436                 else
00437                     buf->st_mode = _S_IFIFO;
00438
00439                 buf->st_rdev = buf->st_dev = (_dev_t)hFile;
00440                 buf->st_nlink = 1;
00441                 buf->st_uid = buf->st_gid = buf->st_ino = 0;
00442                 buf->st_atime = buf->st_mtime = buf->st_ctime = 0;
00443                 if ( isdev == FILE_TYPE_CHAR )
00444                     buf->st_size = 0;
00445                 else
00446                 {
00447                     unsigned long ulAvail;
00448                     int rc;
00449                     rc = PeekNamedPipe(hFile,NULL,0,NULL,&ulAvail,NULL);
00450                     if (rc)
00451                         buf->st_size = (_off_t)ulAvail;
00452                     else
00453                         buf->st_size = (_off_t)0;
00454                 }
00455
00456                 return 0;
00457             }
00458             else if ( isdev == FILE_TYPE_UNKNOWN )
00459             {
00460                 // Network device
00461                 errno = EBADF;
00462                 return -1;
00463             }
00464         }
00465     }
00466
00467     /* set the common fields
00468      */
00469     buf->st_ino = buf->st_uid = buf->st_gid = buf->st_mode = 0;
00470     buf->st_nlink = 1;
00471
00472     if(hFile)
00473     {
00474         /* use the file handle to get all the info about the file
00475          */
00476         if ( !GetFileInformationByHandle(hFile, &bhfi) )
00477         {
00478             _dosmaperr(GetLastError());
00479             return -1;
00480         }
00481     }
00482     else
00483     {
00484         WIN32_FIND_DATA fd;
00485         HANDLE hFind;
00486
00487         if(strlen(filename)==3 && !stricmp(filename+1,":\\"))
00488         {
00489             // Can't do anything about the root directory...
00490             // Win2k and Win98 can return info, but Win95 can't, so
00491             // it's best to do nothing.
00492             memset(&bhfi,0,sizeof(bhfi));
00493             bhfi.dwFileAttributes=GetFileAttributes(filename);
00494             if(bhfi.dwFileAttributes==0xFFFFFFFF)
00495             {
00496                 _dosmaperr(GetLastError());
00497                 return -1;
00498             }
00499             bhfi.nNumberOfLinks=1;
00500         }
00501         else
00502         {
00503             hFind=FindFirstFile(filename,&fd);
00504             if(hFind==INVALID_HANDLE_VALUE)
00505             {
00506                 _dosmaperr(GetLastError());
00507                 return -1;
00508             }
00509             FindClose(hFind);
00510             memset(&bhfi,0,sizeof(bhfi));
00511             bhfi.dwFileAttributes=fd.dwFileAttributes;
00512             bhfi.ftCreationTime=fd.ftCreationTime;
00513             bhfi.ftLastAccessTime=fd.ftLastAccessTime;
00514             bhfi.ftLastWriteTime=fd.ftLastWriteTime;
00515             bhfi.nFileSizeLow=fd.nFileSizeLow;
00516             bhfi.nFileSizeHigh=fd.nFileSizeHigh;
00517             bhfi.nNumberOfLinks=1;
00518         }
00519     }
00520
00521     if ( bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY )
00522         buf->st_mode |= (_S_IREAD + (_S_IREAD >> 3) + (_S_IREAD >> 6));
00523     else
00524         buf->st_mode |= ((_S_IREAD|_S_IWRITE) + ((_S_IREAD|_S_IWRITE) >> 3)
00525           + ((_S_IREAD|_S_IWRITE) >> 6));
00526     if (bhfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
00527         buf->st_mode |= (_S_IEXEC + (_S_IEXEC >> 3) + (_S_IEXEC >> 6));
00528
00529     // Potential, but unlikely problem... casting DWORD to short.
00530     // Reported by Jerzy Kaczorowski, addressed by Jonathan Gilligan
00531     // if the number of links is greater than 0x7FFF
00532     // there would be an overflow problem.
00533     // This is a problem inherent in the struct stat, and hence
00534     // in the design of the C library.
00535     ASSERT(bhfi.nNumberOfLinks <= SHRT_MAX);
00536     if (bhfi.nNumberOfLinks > SHRT_MAX) {
00537         buf->st_nlink = SHRT_MAX;
00538         }
00539     else {
00540         buf->st_nlink= static_cast<short>(bhfi.nNumberOfLinks);
00541         }
00542
00543     if(!filename)
00544     {
00545         // We have to assume here that the repository doesn't span drives, so the
00546         // current directory is correct.
00547         *szFs='\0';
00548         GetVolumeInformation(NULL,NULL,0,NULL,NULL,NULL,szFs,32);
00549         if(!stricmp(szFs,"NTFS"))
00550             is_gmt_fs = 1;
00551         else
00552             is_gmt_fs = 0;
00553     }
00554     else
00555     {
00556         if(filename[1]!=':')
00557         {
00558             if((filename[0]=='\\' || filename[0]=='/') && (filename[1]=='\\' || filename[1]=='/'))
00559             {
00560                 // UNC pathname, assumed to be on an NTFS server.  No way to
00561                 // check, actually (GVI doesn't return anything useful).
00562                 is_gmt_fs = 1;
00563             }
00564             else
00565             {
00566                 // Relative path, treat as local
00567                 GetVolumeInformation(NULL,NULL,0,NULL,NULL,NULL,szFs,sizeof(szFs));
00568                 if(!stricmp(szFs,"NTFS"))
00569                     is_gmt_fs = 1;
00570                 else
00571                     is_gmt_fs = 0;
00572             }
00573         }
00574         else
00575         {
00576             // Drive specified...
00577             char szRootPath[4] = "?:\\";
00578             szRootPath[0]=filename[0];
00579             *szFs='\0';
00580             GetVolumeInformation(szRootPath,NULL,0,NULL,NULL,NULL,szFs,sizeof(szFs));
00581             if(!stricmp(szFs,"NTFS") || !stricmp(szFs,"HPFS"))
00582                 is_gmt_fs = 1;
00583             else
00584                 is_gmt_fs = 0;
00585         }
00586     }
00587
00588     if(is_gmt_fs) // NTFS - everything is in GMT already
00589     {
00590         FileTimeToUnixTime ( &bhfi.ftLastAccessTime, &buf->st_atime, FALSE );
00591         FileTimeToUnixTime ( &bhfi.ftLastWriteTime, &buf->st_mtime, FALSE );
00592         FileTimeToUnixTime ( &bhfi.ftCreationTime, &buf->st_ctime, FALSE );
00593     }
00594     else
00595     {
00596         // FAT - timestamps are in incorrectly translated local time.
00597         // translate them back and let FileTimeToUnixTime() do the
00598         // job properly.
00599
00600         FILETIME At,Wt,Ct;
00601
00602         FileTimeToLocalFileTime ( &bhfi.ftLastAccessTime, &At );
00603         FileTimeToLocalFileTime ( &bhfi.ftLastWriteTime, &Wt );
00604         FileTimeToLocalFileTime ( &bhfi.ftCreationTime, &Ct );
00605         FileTimeToUnixTime ( &At, &buf->st_atime, TRUE );
00606         FileTimeToUnixTime ( &Wt, &buf->st_mtime, TRUE );
00607         FileTimeToUnixTime ( &Ct, &buf->st_ctime, TRUE );
00608     }
00609
00610     buf->st_size = bhfi.nFileSizeLow;
00611     if(bhfi.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
00612         buf->st_mode |= _S_IFDIR;
00613     else
00614         buf->st_mode |= _S_IFREG;
00615
00616     /* On DOS, this field contains the drive number, but
00617      * the drive number is not available on this platform.
00618      * Also, for UNC network names, there is no drive number.
00619      */
00620     buf->st_rdev = buf->st_dev = 0;
00621     return 0;
00622 }

int wnt_fstat | ( | int | fildes,
 |  | struct stat * | buf
 | ) |

Definition at line 631 of file Stat.cpp.

00632 {
00633     return _statcore((HANDLE)_get_osfhandle(fildes),NULL,buf);
00634 }

int wnt_lstat | ( | const char * | name,
 |  | struct stat * | buf
 | ) |

Definition at line 636 of file Stat.cpp.

00637 {
00638     return _statcore(NULL,name,buf);
00639 }

int wnt_stat | ( | const char * | name,
 |  | struct stat * | buf
 | ) |

Definition at line 624 of file Stat.cpp.

00625 {
00626     if(stricmp(name,"Entries") && stricmp(name,"Entries.log"))
00627         name=name;
00628     return _statcore(NULL,name,buf);
00629 }

Variable Documentation

int dos

Definition at line 7 of file Stat.cpp.

DWORD err

Definition at line 7 of file Stat.cpp.

Referenced by findTcl().

struct { ... } errors[] [static]

const WORD month_len[12] [static]

Initial value:

{
    31,
    28,
    31,
    30,
    31,
    30,
    31,
    31,
    30,
    31,
    30,
    31
}

Definition at line 56 of file Stat.cpp.

const char* month_names[12] [static]

Initial value:

{
    "Jan", "Feb", "Mar", "Apr",
    "May", "Jun", "Jul", "Aug",
    "Sep", "Oct", "Nov", "Dec"
}

Definition at line 72 of file Stat.cpp.

const ULONGLONG systemtime_second = 10000000L [static]

Definition at line 80 of file Stat.cpp.

Generated on Sun Oct 21 12:45:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


StdAfx.cpp File Reference

WinCvs/StdAfx.cpp File Reference

#include "stdafx.h"

Include dependency graph for StdAfx.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/StdAfx.cpp Source File

WinCvs/StdAfx.cpp

Go to the documentation of this file.
00001 // stdafx.cpp : source file that includes just the standard includes
00002 //  wincvs.pch will be the pre-compiled header
00003 //  stdafx.obj will contain the pre-compiled type information
00004
00005 #include "stdafx.h"
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


StdAfx.h File Reference

WinCvs/StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxole.h>
#include <afxodlgs.h>
#include <afxdisp.h>
#include <afxcmn.h>
#include <afxsock.h>
#include "CJLibrary.h"
#include <atlbase.h>
#include <atlcom.h>
#include "TipDlg.h"
#include <vector>
#include <map>
#include <afxrich.h>
#include <afxcview.h>
#include <sys/stat.h>

Include dependency graph for StdAfx.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCVS_CoworkerModule
struct | wnt_stat

Defines

#define | AFX_STDAFX_H__D2D77DCA_8299_11D1_8949_444553540000__INCLUDED_
#define | VC_EXTRALEAN
#define | qCvsDebug 0
#define | UASSERT ASSERT
#define | _ATL_APARTMENT_THREADED
#define | fstat wnt_fstat
#define | lstat wnt_lstat
#define | stat wnt_stat

Functions

int | wnt_stat (const char *name, struct wnt_stat *buf)
int | wnt_fstat (int fildes, struct wnt_stat *buf)
int | wnt_lstat (const char *name, struct wnt_stat *buf)

Variables

CCVS_CoworkerModule _Module

Define Documentation

#define AFX_STDAFX_H__D2D77DCA_8299_11D1_8949_444553540000__INCLUDED_

Definition at line 7 of file StdAfx.h.

#define UASSERT ASSERT

Definition at line 37 of file StdAfx.h.

#define VC_EXTRALEAN

Definition at line 13 of file StdAfx.h.

#define _ATL_APARTMENT_THREADED

Definition at line 40 of file StdAfx.h.

#define fstat wnt_fstat

Definition at line 92 of file StdAfx.h.

#define lstat wnt_lstat

Definition at line 93 of file StdAfx.h.

#define qCvsDebug 0

Definition at line 34 of file StdAfx.h.

#define stat wnt_stat

Definition at line 94 of file StdAfx.h.

Function Documentation

int wnt_fstat | ( | int | fildes,
 |  | struct wnt_stat * | buf
 | ) |

int wnt_lstat | ( | const char * | name,
 |  | struct wnt_stat * | buf
 | ) |

int wnt_stat | ( | const char * | name,
 |  | struct wnt_stat * | buf
 | ) |

Variable Documentation

CCVS_CoworkerModule _Module

Definition at line 52 of file StdAfx.h.

Generated on Sun Oct 21 12:44:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/StdAfx.h Source File

WinCvs/StdAfx.h

Go to the documentation of this file.
00001 // stdafx.h : include file for standard system include files,
00002 //  or project specific include files that are used frequently, but
00003 //      are changed infrequently
00004 //
00005
00006 #if !defined(AFX_STDAFX_H__D2D77DCA_8299_11D1_8949_444553540000__INCLUDED_)
00007 #define AFX_STDAFX_H__D2D77DCA_8299_11D1_8949_444553540000__INCLUDED_
00008
00009 #if _MSC_VER >= 1000
00010 #pragma once
00011 #endif // _MSC_VER >= 1000
00012
00013 #define VC_EXTRALEAN        // Exclude rarely-used stuff from Windows headers
00014
00015 #include <afxwin.h>         // MFC core and standard components
00016 #include <afxext.h>         // MFC extensions
00017 #include <afxole.h>         // MFC OLE classes
00018 #include <afxodlgs.h>       // MFC OLE dialog classes
00019 #include <afxdisp.h>        // MFC OLE automation classes
00020 #ifndef _AFX_NO_AFXCMN_SUPPORT
00021 #include <afxcmn.h>         // MFC support for Windows Common Controls
00022 #endif // _AFX_NO_AFXCMN_SUPPORT
00023
00024 #include <afxsock.h>        // MFC socket extensions
00025
00026 //{{AFX_INSERT_LOCATION}}
00027 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00028
00029 #include "CJLibrary.h"      // MFC socket extensions
00030
00031 #ifdef _DEBUG
00032 #   define qCvsDebug 1
00033 #else
00034 #   define qCvsDebug 0
00035 #endif
00036
00037 #define UASSERT ASSERT
00038 // for the pseudo-interface
00039
00040 #define _ATL_APARTMENT_THREADED
00041 #include <atlbase.h>
00042 //You may derive a class from CComModule and use it if you want to override
00043 //something, but do not change the name of _Module
00044 class CCVS_CoworkerModule : public CComModule
00045 {
00046 public:
00047     LONG Unlock();
00048     LONG Lock();
00049     LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2);
00050     DWORD dwThreadID;
00051 };
00052 extern CCVS_CoworkerModule _Module;
00053 #include <atlcom.h>
00054
00055 #pragma warning (disable : 4786)
00056
00057 #include "TipDlg.h"
00058 #include <vector>
00059 #include <map>
00060 #include <afxrich.h>
00061 #include <afxcview.h>
00062
00063 #ifdef _DEBUG
00064 #   include <malloc.h>
00065 #   include <stdlib.h>
00066 #   include <crtdbg.h>
00067 #   define   malloc(s)         _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
00068 #   define   calloc(c, s)      _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
00069 #   define   realloc(p, s)     _realloc_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
00070 #   define   free(p)           _free_dbg(p, _NORMAL_BLOCK)
00071 #endif
00072
00073 #include <sys/stat.h>
00074 // Replacement stat() routine
00075 struct wnt_stat {
00076         _dev_t st_dev;
00077         _ino_t st_ino;
00078         unsigned short st_mode;
00079         short st_nlink;
00080         short st_uid;
00081         short st_gid;
00082         _dev_t st_rdev;
00083         _off_t st_size;
00084         time_t st_atime;
00085         time_t st_mtime;
00086         time_t st_ctime;
00087         };
00088 int wnt_stat(const char *name, struct wnt_stat *buf);
00089 int wnt_fstat (int fildes, struct wnt_stat *buf);
00090 int wnt_lstat (const char *name, struct wnt_stat *buf);
00091
00092 #define fstat wnt_fstat
00093 #define lstat wnt_lstat
00094 #define stat wnt_stat
00095
00096 #endif // !defined(AFX_STDAFX_H__D2D77DCA_8299_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/TbEdit.cpp Source File

WinCvs/TbEdit.cpp

Go to the documentation of this file.
00001 // TbEdit.cpp : implementation file
00002 //
00003
00004 #include "stdafx.h"
00005 #include "wincvs.h"
00006 #include "TbEdit.h"
00007
00008 #ifdef _DEBUG
00009 #define new DEBUG_NEW
00010 #undef THIS_FILE
00011 static char THIS_FILE[] = __FILE__;
00012 #endif
00013
00015 // CTbEdit
00016
00017 CTbEdit::CTbEdit()
00018 {
00019 }
00020
00021 CTbEdit::~CTbEdit()
00022 {
00023 }
00024
00025
00026 BEGIN_MESSAGE_MAP(CTbEdit, CEdit)
00027     //{{AFX_MSG_MAP(CTbEdit)
00028     //}}AFX_MSG_MAP
00029 END_MESSAGE_MAP()
00030
00032 // CTbEdit message handlers
00033
00034
00035 BOOL CTbEdit::PreTranslateMessage(MSG* pMsg)
00036 {
00037     if (pMsg->message == WM_KEYDOWN)
00038     {
00039         int nVirtKey = (int) pMsg->wParam;
00040         switch (nVirtKey)
00041         {
00042             case VK_ESCAPE:
00043                 GetOwner()->PostMessage(WM_CONTENTCHANGE, FALSE);
00044                 break;
00045             case VK_RETURN:
00046                 GetOwner()->PostMessage(WM_CONTENTCHANGE, TRUE);
00047                 break;
00048         }
00049     }
00050     return CEdit::PreTranslateMessage(pMsg);
00051 }
00052
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/TbEdit.h Source File

WinCvs/TbEdit.h

Go to the documentation of this file.
00001 #if !defined(AFX_TBEDIT_H__AEA5EC19_1292_4A30_93EA_E209A6BAE000__INCLUDED_)
00002 #define AFX_TBEDIT_H__AEA5EC19_1292_4A30_93EA_E209A6BAE000__INCLUDED_
00003
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 // TbEdit.h : header file
00008 //
00009
00011 // CTbEdit window
00012
00013 class CTbEdit : public CEdit
00014 {
00015 // Construction
00016 public:
00017     CTbEdit();
00018
00019 // Attributes
00020 public:
00021     enum { WM_CONTENTCHANGE = WM_APP + 56};
00022 // Operations
00023 public:
00024
00025 // Overrides
00026     // ClassWizard generated virtual function overrides
00027     //{{AFX_VIRTUAL(CTbEdit)
00028     public:
00029     virtual BOOL PreTranslateMessage(MSG* pMsg);
00030     //}}AFX_VIRTUAL
00031
00032 // Implementation
00033 public:
00034     virtual ~CTbEdit();
00035
00036     // Generated message map functions
00037 protected:
00038     //{{AFX_MSG(CTbEdit)
00039     //}}AFX_MSG
00040
00041     DECLARE_MESSAGE_MAP()
00042 };
00043
00045
00046 //{{AFX_INSERT_LOCATION}}
00047 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00048
00049 #endif // !defined(AFX_TBEDIT_H__AEA5EC19_1292_4A30_93EA_E209A6BAE000__INCLUDED_)
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/TipDlg.cpp Source File

WinCvs/TipDlg.cpp

Go to the documentation of this file.
00001 #include "stdafx.h"
00002 #include "resource.h"
00003 // CG: This file added by 'Tip of the Day' component.
00004
00005 #include <winreg.h>
00006 #include <sys\stat.h>
00007 #include <sys\types.h>
00008
00009 #include "wincvs.h"
00010 #include "CPStr.h"
00011 #include "TextBinary.h"
00012
00013 #ifdef _DEBUG
00014 #define new DEBUG_NEW
00015 #undef THIS_FILE
00016 static char THIS_FILE[] = __FILE__;
00017 #endif
00018
00020 // CTipDlg dialog
00021
00022 #define MAX_BUFLEN 1000
00023
00024 static const TCHAR szSection[] = _T("Tip");
00025 static const TCHAR szIntFilePos[] = _T("FilePos");
00026 static const TCHAR szTimeStamp[] = _T("TimeStamp");
00027 static const TCHAR szIntStartup[] = _T("StartUp");
00028
00029 CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/)
00030     : CDialog(IDD_TIP, pParent)
00031 {
00032     //{{AFX_DATA_INIT(CTipDlg)
00033     m_bStartup = TRUE;
00034     //}}AFX_DATA_INIT
00035
00036     // We need to find out what the startup and file position parameters are
00037     // If startup does not exist, we assume that the Tips on startup is checked TRUE.
00038     CWincvsApp* pApp = (CWincvsApp *)AfxGetApp();
00039     m_bStartup = !pApp->GetProfileInt(szSection, szIntStartup, 0);
00040     UINT iFilePos = pApp->GetProfileInt(szSection, szIntFilePos, 0);
00041     CStr tips;
00042     pApp->GetAppPath(tips);
00043     if(!tips.empty() && !tips.endsWith(kPathDelimiter))
00044     {
00045         tips << kPathDelimiter;
00046     }
00047     tips << "tips.txt";
00048
00049     // Now try to open the tips file
00050     m_pStream = fopen(tips, "r");
00051 #if qCvsDebug
00052     if(m_pStream == 0L)
00053         m_pStream = fopen("c:\\cvsgui\\wincvs\\hlp\\tips.txt", "r");
00054     if(m_pStream == 0L)
00055         m_pStream = fopen("d:\\cvsgui\\wincvs\\hlp\\tips.txt", "r");
00056     if(m_pStream == 0L)
00057         m_pStream = fopen("e:\\cvsgui\\wincvs\\hlp\\tips.txt", "r");
00058     if(m_pStream == 0L)
00059         m_pStream = fopen("f:\\cvsgui\\wincvs\\hlp\\tips.txt", "r");
00060 #endif
00061     if (m_pStream == NULL)
00062     {
00063         m_strTip.LoadString(CG_IDS_FILE_ABSENT);
00064         return;
00065     }
00066
00067     // If the timestamp in the INI file is different from the timestamp of
00068     // the tips file, then we know that the tips file has been modified
00069     // Reset the file position to 0 and write the latest timestamp to the
00070     // ini file
00071     struct _stat buf;
00072     _fstat(_fileno(m_pStream), &buf);
00073     CString strCurrentTime = ctime(&buf.st_ctime);
00074     strCurrentTime.TrimRight();
00075     CString strStoredTime =
00076         pApp->GetProfileString(szSection, szTimeStamp, NULL);
00077     if (strCurrentTime != strStoredTime)
00078     {
00079         iFilePos = 0;
00080         pApp->WriteProfileString(szSection, szTimeStamp, strCurrentTime);
00081     }
00082
00083     if (fseek(m_pStream, iFilePos, SEEK_SET) != 0)
00084     {
00085         AfxMessageBox(CG_IDP_FILE_CORRUPT);
00086     }
00087     else
00088     {
00089         GetNextTipString(m_strTip);
00090     }
00091 }
00092
00093 CTipDlg::~CTipDlg()
00094 {
00095     // This destructor is executed whether the user had pressed the escape key
00096     // or clicked on the close button. If the user had pressed the escape key,
00097     // it is still required to update the filepos in the ini file with the
00098     // latest position so that we don't repeat the tips!
00099
00100     // But make sure the tips file existed in the first place....
00101     if (m_pStream != NULL)
00102     {
00103         CWinApp* pApp = AfxGetApp();
00104         pApp->WriteProfileInt(szSection, szIntFilePos, ftell(m_pStream));
00105         fclose(m_pStream);
00106     }
00107 }
00108
00109 void CTipDlg::DoDataExchange(CDataExchange* pDX)
00110 {
00111     CDialog::DoDataExchange(pDX);
00112     //{{AFX_DATA_MAP(CTipDlg)
00113     DDX_Check(pDX, IDC_STARTUP, m_bStartup);
00114     DDX_Text(pDX, IDC_TIPSTRING, m_strTip);
00115     //}}AFX_DATA_MAP
00116 }
00117
00118 BEGIN_MESSAGE_MAP(CTipDlg, CDialog)
00119     //{{AFX_MSG_MAP(CTipDlg)
00120     ON_BN_CLICKED(IDC_NEXTTIP, OnNextTip)
00121     ON_WM_CTLCOLOR()
00122     ON_WM_PAINT()
00123     //}}AFX_MSG_MAP
00124 END_MESSAGE_MAP()
00125
00127 // CTipDlg message handlers
00128
00129 void CTipDlg::OnNextTip()
00130 {
00131     GetNextTipString(m_strTip);
00132     UpdateData(FALSE);
00133 }
00134
00135 void CTipDlg::GetNextTipString(CString& strNext)
00136 {
00137     LPTSTR lpsz = strNext.GetBuffer(MAX_BUFLEN);
00138
00139     // This routine identifies the next string that needs to be
00140     // read from the tips file
00141     BOOL bStop = FALSE;
00142     while (!bStop)
00143     {
00144         if (_fgetts(lpsz, MAX_BUFLEN, m_pStream) == NULL)
00145         {
00146             // We have either reached EOF or enocuntered some problem
00147             // In both cases reset the pointer to the beginning of the file
00148             // This behavior is same as VC++ Tips file
00149             if (fseek(m_pStream, 0, SEEK_SET) != 0)
00150                 AfxMessageBox(CG_IDP_FILE_CORRUPT);
00151         }
00152         else
00153         {
00154             if (*lpsz != ' ' && *lpsz != '\t' &&
00155                 *lpsz != '\n' && *lpsz != ';')
00156             {
00157                 // There should be no space at the beginning of the tip
00158                 // This behavior is same as VC++ Tips file
00159                 // Comment lines are ignored and they start with a semicolon
00160                 bStop = TRUE;
00161             }
00162         }
00163     }
00164     strNext.ReleaseBuffer();
00165 }
00166
00167 HBRUSH CTipDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
00168 {
00169     if (pWnd->GetDlgCtrlID() == IDC_TIPSTRING)
00170         return (HBRUSH)GetStockObject(WHITE_BRUSH);
00171
00172     return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
00173 }
00174
00175 void CTipDlg::OnOK()
00176 {
00177     CDialog::OnOK();
00178
00179     // Update the startup information stored in the INI file
00180     CWinApp* pApp = AfxGetApp();
00181     pApp->WriteProfileInt(szSection, szIntStartup, !m_bStartup);
00182 }
00183
00184 BOOL CTipDlg::OnInitDialog()
00185 {
00186     CDialog::OnInitDialog();
00187
00188     // If Tips file does not exist then disable NextTip
00189     if (m_pStream == NULL)
00190         GetDlgItem(IDC_NEXTTIP)->EnableWindow(FALSE);
00191
00192     return TRUE;  // return TRUE unless you set the focus to a control
00193 }
00194
00195 void CTipDlg::OnPaint()
00196 {
00197     CPaintDC dc(this); // device context for painting
00198
00199     // Get paint area for the big static control
00200     CWnd* pStatic = GetDlgItem(IDC_BULB);
00201     CRect rect;
00202     pStatic->GetWindowRect(&rect);
00203     ScreenToClient(&rect);
00204
00205     // Paint the background white.
00206     CBrush brush;
00207     brush.CreateStockObject(WHITE_BRUSH);
00208     dc.FillRect(rect, &brush);
00209
00210     // Load bitmap and get dimensions of the bitmap
00211     CBitmap bmp;
00212     bmp.LoadBitmap(IDB_LIGHTBULB);
00213     BITMAP bmpInfo;
00214     bmp.GetBitmap(&bmpInfo);
00215
00216     // Draw bitmap in top corner and validate only top portion of window
00217     CDC dcTmp;
00218     dcTmp.CreateCompatibleDC(&dc);
00219     dcTmp.SelectObject(&bmp);
00220     rect.bottom = bmpInfo.bmHeight + rect.top;
00221     dc.BitBlt(rect.left, rect.top, rect.Width(), rect.Height(),
00222         &dcTmp, 0, 0, SRCCOPY);
00223
00224     // Draw out "Did you know..." message next to the bitmap
00225     CString strMessage;
00226     strMessage.LoadString(CG_IDS_DIDYOUKNOW);
00227     rect.left += bmpInfo.bmWidth;
00228     dc.DrawText(strMessage, rect, DT_VCENTER | DT_SINGLELINE);
00229
00230     // Do not call CDialog::OnPaint() for painting messages
00231 }
00232
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/TipDlg.h Source File

WinCvs/TipDlg.h

Go to the documentation of this file.
00001 #if !defined(TIPDLG_H_INCLUDED_)
00002 #define TIPDLG_H_INCLUDED_
00003
00004 // CG: This file added by 'Tip of the Day' component.
00005
00007 // CTipDlg dialog
00008
00009 class CTipDlg : public CDialog
00010 {
00011 // Construction
00012 public:
00013     CTipDlg(CWnd* pParent = NULL);   // standard constructor
00014
00015 // Dialog Data
00016     //{{AFX_DATA(CTipDlg)
00017     // enum { IDD = IDD_TIP };
00018     BOOL    m_bStartup;
00019     CString m_strTip;
00020     //}}AFX_DATA
00021
00022     FILE* m_pStream;
00023
00024 // Overrides
00025     // ClassWizard generated virtual function overrides
00026     //{{AFX_VIRTUAL(CTipDlg)
00027     protected:
00028     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00029     //}}AFX_VIRTUAL
00030
00031 // Implementation
00032 public:
00033     virtual ~CTipDlg();
00034
00035 protected:
00036     // Generated message map functions
00037     //{{AFX_MSG(CTipDlg)
00038     afx_msg void OnNextTip();
00039     afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
00040     virtual void OnOK();
00041     virtual BOOL OnInitDialog();
00042     afx_msg void OnPaint();
00043     //}}AFX_MSG
00044     DECLARE_MESSAGE_MAP()
00045
00046     void GetNextTipString(CString& strNext);
00047 };
00048
00049 #endif // !defined(TIPDLG_H_INCLUDED_)
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ToolbarCombo.cpp Source File

WinCvs/ToolbarCombo.cpp

Go to the documentation of this file.
00001 // ToolbarCombo.cpp : implementation file
00002 //
00003
00004 #include "stdafx.h"
00005 #include "wincvs.h"
00006 #include "ToolbarCombo.h"
00007
00008 #ifdef _DEBUG
00009 #define new DEBUG_NEW
00010 #undef THIS_FILE
00011 static char THIS_FILE[] = __FILE__;
00012 #endif
00013
00014 BEGIN_MESSAGE_MAP(CToolbarCombo, CComboBoxEx)
00015     //{{AFX_MSG_MAP(CToolbarCombo)
00016     ON_CONTROL_REFLECT(CBN_SELENDOK, OnSelendok)
00017     ON_CONTROL_REFLECT(CBN_SELENDCANCEL, OnSelendcancel)
00018     //}}AFX_MSG_MAP
00019     ON_MESSAGE(CTbEdit::WM_CONTENTCHANGE, OnContentChange)
00020 END_MESSAGE_MAP()
00021
00022
00024 // CToolbarCombo
00025
00026 CToolbarCombo::CToolbarCombo()
00027 {
00028 }
00029
00030 CToolbarCombo::~CToolbarCombo()
00031 {
00032 }
00033
00034 BOOL CToolbarCombo::Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID )
00035 {
00036     if (!CComboBoxEx::Create(dwStyle, rect, pParentWnd, nID))
00037     {
00038         return FALSE;
00039     }
00040     SetExtendedStyle(CBES_EX_CASESENSITIVE, CBES_EX_CASESENSITIVE);
00041     m_edit.SubclassWindow(GetEditCtrl()->m_hWnd);
00042     m_edit.SetOwner(this);
00043     return TRUE;
00044 }
00045
00046 LRESULT CToolbarCombo::OnContentChange(WPARAM wp, LPARAM lp)
00047 {
00048     bool complete = wp != 0;
00049     if (complete)
00050     {
00051         CString text;
00052         m_edit.GetWindowText(text);
00053         SetText(text);
00054     }
00055     else
00056     {
00057         // restore previous text
00058         ResetText();
00059     }
00060     return 0;
00061 }
00062
00063 void CToolbarCombo::ResetText()
00064 {
00065     m_edit.SetWindowText(m_text);
00066 }
00067
00068 void CToolbarCombo::SetText(const CString& text)
00069 {
00070     if (m_text.Compare(text) != 0)
00071     {
00072         m_text = text;
00073
00074         // append selection to combo box
00075         int count = GetCount();
00076         for (int i = count - 1; i >= 0 ; i--)
00077         {
00078             TCHAR buffer[256];
00079             GetItemText(i, buffer, 256);
00080             if (text.Compare(buffer) == 0)
00081             {
00082                 DeleteItem(i);
00083             }
00084         }
00085         COMBOBOXEXITEM item;
00086         item.mask = CBEIF_TEXT;
00087         item.iItem = 0;
00088         item.pszText = (LPTSTR)(LPCTSTR)text;
00089         InsertItem(&item);
00090         count = GetCount();
00091         while (count > 8)
00092         {
00093             count--;
00094             DeleteItem(count);
00095         }
00096
00097         m_manager.NotifyAll();
00098     }
00099 }
00100
00101 void CToolbarCombo::GetItemText(int pos, LPTSTR buffer, int count)
00102 {
00103     COMBOBOXEXITEM item;
00104     item.mask = CBEIF_TEXT;
00105     item.pszText = buffer;
00106     item.cchTextMax = count;
00107     item.iItem = pos;
00108     VERIFY(GetItem(&item));
00109 }
00110
00111 void CToolbarCombo::OnSelendok()
00112 {
00113     CComboBox* combo = GetComboBoxCtrl();
00114     int pos = combo->GetCurSel();
00115     if (pos >= 0)
00116     {
00117         TCHAR buffer[256];
00118         GetItemText(pos, buffer, 256);
00119         SetText(buffer);
00120         ResetText();
00121     }
00122 }
00123
00124 void CToolbarCombo::OnSelendcancel()
00125 {
00126     ResetText();
00127 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/ToolbarCombo.h Source File

WinCvs/ToolbarCombo.h

Go to the documentation of this file.
00001 #if !defined(AFX_TOOLBARCOMBO_H__3AE857F3_B4BD_11D4_8200_005004D6EF6C__INCLUDED_)
00002 #define AFX_TOOLBARCOMBO_H__3AE857F3_B4BD_11D4_8200_005004D6EF6C__INCLUDED_
00003
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 // ToolbarCombo.h : header file
00008 //
00009
00010 #include "BrowseViewModel.h"
00011 #include "tbedit.h"
00012
00014 // CToolbarCombo window
00015
00016 class CToolbarCombo : public CComboBoxEx
00017 {
00018 // Construction
00019 public:
00020     CToolbarCombo();
00021
00022 // Attributes
00023 private:
00024     CTbEdit m_edit;
00025     NotificationManager m_manager;
00026     CString m_text;
00027
00028 // Operations
00029 public:
00030     BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
00031
00032     NotificationManager* GetManager()
00033     {
00034         return &m_manager;
00035     }
00036
00037     const CString& GetText()
00038     {
00039         return m_text;
00040     }
00041
00042
00043     // retrieves text of an item
00044     // parameters
00045     //   pos - item index
00046     //   buffer - buffer to receive the text
00047     //   count - count of characters in the buffer
00048     void GetItemText(int pos, LPTSTR buffer, int count);
00049
00050
00051 // Overrides
00052     // ClassWizard generated virtual function overrides
00053     //{{AFX_VIRTUAL(CToolbarCombo)
00054     //}}AFX_VIRTUAL
00055
00056 // Implementation
00057 public:
00058     virtual ~CToolbarCombo();
00059
00060     // Generated message map functions
00061 protected:
00062     void SetText(const CString& text);
00063     void ResetText();
00064
00065     //{{AFX_MSG(CToolbarCombo)
00066     afx_msg void OnSelendok();
00067     afx_msg void OnSelendcancel();
00068     //}}AFX_MSG
00069     afx_msg LRESULT OnContentChange(WPARAM wp, LPARAM lp);
00070     DECLARE_MESSAGE_MAP()
00071 };
00072
00074
00075 //{{AFX_INSERT_LOCATION}}
00076 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00077
00078 #endif // !defined(AFX_TOOLBARCOMBO_H__3AE857F3_B4BD_11D4_8200_005004D6EF6C__INCLUDED_)
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/version_fu.h Source File

WinCvs/version_fu.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jonathan M. Gilligan <jonathan.gilligan@vanderbilt.edu> --- 23 June 2001
00019  */
00020
00021 /*
00022  * version_fu.h -- Macros used for version numbering
00023  */
00024
00025 #pragma once
00026
00028 // Documentation
00029 //
00030 // The macros below generate a number of strings that describe aspects of
00031 // the current build.
00032 //
00033 // Principal aspects include a number of MS-specified flags:
00034 //
00035 // Debug build:         Self-explanatory.
00036 //
00037 // Prerelease build:    An experimental or alpha or beta build. If either
00038 //                      of the symbols WINCVS_ALPHA_RELEASE or
00039 //                      WINCVS_BETA_RELEASE is defined, then the build is
00040 //                      automatically tagged as prerelease.
00041 //
00042 //                      The build is automatically flagged as a prerelease
00043 //                      build if the flag WINCVS_RELEASE is NOT defined.
00044 //                      Moreover, if either WINCVS_ALPHA_RELEASE or
00045 //                      WINCVS_BETA_RELEASE is defined, it overrides
00046 //                      WINCVS_RELEASE.
00047 //
00048 // Private Build:       A non-standard build. We use the private build
00049 //                      flag to indicate that the build was not an
00050 //                  `   official release. As checked out with CVS, the
00051 //                      sources are set up to build as a private build.
00052 //
00053 //                      To build an official release, the flag
00054 //                      WINCVS_OFFICIAL_DISTRIBUTION should be
00055 //                      defined at build time.
00056 //
00057 // Special Build:       Some other kind of non-standard build. We do not
00058 //                      currently define special builds, but the plumbing
00059 //                      is in place in version_fu to handle special builds
00060 //                      if the flag WINCVS_SPECIAL_BUILD is defined.
00061 //
00062 //
00063 // Strings and other macros generated by version_fu:
00064 //
00065 // WINCVS_FILEVERSION,
00066 // CVSNTDOS_FILEVERSION,
00067 // WINCVS_PRODUCTVERSION:   Version tokens to be used in the VERSION_INFO
00068 //                      resource. These tokens have the form x,x,x,x where
00069 //                      x is a decimal number indicating
00070 //                      major,minor,patch,build.
00071 //
00072 //                      File version refers to the specific executable file
00073 //                      (WinCVS.exe or cvs.exe). Product version refers to
00074 //                      the WinCVS package as a whole.
00075 //
00076 // WINCVS_FILEVERSION_STRING,
00077 // CVSNTDOS_FILEVERSION_STRING,
00078 // WINCVS_PRODUCTVERSION_STRING:    Double-quoted string equivalents of the
00079 //                      above. The format is:
00080 //                      "N x.x.x.x r (s p u d Build x)",
00081 //                      Where
00082 //                      N = name (of file or product)
00083 //                      x.x.x.x = major.minor.patchlevel.build,
00084 //                      r = prerelease build string,
00085 //                      s = special build string,
00086 //                      p = private build string,
00087 //                      u = unicode build string,
00088 //                      d = debug build string.
00089 //
00090 //                      Example:
00091 //                      "WinCvs 1.3.2.7 Beta 2 (Special Private Unicode Debug Build 7)"
00092 //
00093 // WCVS_PATCHED_FLAG,
00094 // WCVS_SPECIAL_BUILD_FLAG,
00095 // WCVS_PRIVATE_BUILD_FLAG,
00096 // WCVS_PRERELEASE_FLAG,
00097 // WVVS_DEBUG_BUILD_FLAG:   These are flags (numbers, which can be OR'ed together
00098 //                          for the FILEFLAGS member of VERSION_INFO.
00099 //
00100 // WCVS_UNICODE_BUILD_STRING_PREFIX,
00101 // WCVS_DEBUG_BUILD_STRING_PREFIX,
00102 // WCVS_SPECIAL_BUILD_STRING_PREFIX,
00103 // WCVS_PRIVATE_BUILD_STRING_PREFIX,
00104 // WCVS_PRERELEASE_BUILD_STRING_PREFIX:    These are strings (ending with
00105 //                          a space) that can be concatenated together
00106 //                          to produce a description of the various
00107 //                          build conditions. The _PREFIX part of the name
00108 //                          indicates that these are in a form to be
00109 //                          concatenated together.
00110 //
00111 //                          The order these fields appear in the File
00112 //                          Description and Product Description fields of
00113 //                          VERSION_INFO are: PRERELEASE, PRIVATE, SPECIAL,
00114 //                          UNICODE, and DEBUG.
00115 //
00116 // WCVS_SPECIAL_BUILD_STRING,
00117 // WCVS_PRIVATE_BUILD_STRING:    the _PREFIX versions with "build"
00118 //                          concatenated to the end.
00119 //
00120 //
00121
00123
00125 // Preprocessor definitions (for version_no.h)
00126 //
00127 // Preprocessor flags (empty #defines):
00128 // These should be #defined in version_no.h
00129 //
00130 // WINCVS_OFFICIAL_DISTRIBUTION:    #define this only when making
00131 //                      an official distribution package. This flag should
00132 //                      never be defined in anything checked into the cvs
00133 //                      repository.
00134 //
00135 // WINCVS_RELEASE:      define this if this is a release (as opposed to a
00136 //                      prerelease) build.
00137 //
00138 // WINCVS_ALPHA_RELEASE:    define this if this is a alpha release. The
00139 //                      alpha number (e.g., alpha 2) will be taken from
00140 //                      the product patch level (see below).
00141 //
00142 // WINCVS_BETA_RELEASE: define this if this is a beta release. The beta
00143 //                      number (e.g., beta 2) will be taken from the
00144 //                      product patch level (see below).
00145 //
00146 // Preprocessor values (#defines with contents):
00147 // These should be #defined in version_no.h
00148 //
00149 // WINCVS_FILE_MAJOR,
00150 // WINCVS_FILE_MINOR,
00151 // WINCVS_FILE_PATCHLEVEL,
00152 //
00153 // CVSNTDOS_FILE_MAJOR,
00154 // CVSNTDOS_FILE_MINOR,
00155 // CVSNTDOS_FILE_PATCHLEVEL,
00156 //
00157 // WINCVS_PRODUCT_MAJOR,
00158 // WINCVS_PRODUCT_MINOR,
00159 // WINCVS_PRODUCT_PATCHLEVEL,
00160 //
00161 // WINCVS_BUILD,
00162 // CVSNTDOS_BUILD:      These macros all indicate parts of the version
00163 //                      number. *FILE* indicates specific numbers for the
00164 //                      .exe files (WinCVS.exe, CVS.exe). The *PRODUCT*
00165 //                      numbers indicate the version of the package as a
00166 //                      whole.
00167 //
00168 //                      At this time, WinCVS.exe is at version 1.3.2.x
00169 //                      (WinCVS 1.3 beta 2, build x), cvs.exe is at
00170 //                      1.11.1.x (cvs 1.11 patch level 1, build x). Both
00171 //                      files are part of the WinCVS 1.3 beta 2
00172 //                      distribution.
00173 //
00174 //                      The build numbers for both files should be
00175 //                      incremented (by hand editing version_no.h) at
00176 //                      least once for every build posted publicly at
00177 //                      cvsgui.org.
00178 //
00179 //                      EXAMPLE:
00180 //
00181 //                      #define WINCVS_FILE_MAJOR           1
00182 //                      #define WINCVS_FILE_MINOR           3
00183 //                      #define WINCVS_FILE_PATCHLEVEL      2
00184 //
00185 //                      #define CVSNTDOS_FILE_MAJOR         1
00186 //                      #define CVSNTDOS_FILE_MINOR        11
00187 //                      #define CVSNTDOS_FILE_PATCHLEVEL    1
00188 //
00189 //                      #define WINCVS_PRODUCT_MAJOR        1
00190 //                      #define WINCVS_PRODUCT_MINOR        3
00191 //                      #define WINCVS_PRODUCT_PATCHLEVEL   2
00192 //
00193 //                      #define WINCVS_BUILD                1
00194 //                      #define CVSNTDOS_BUILD              1
00195 //
00196 //
00197 // WINCVS_SPECIAL_BUILD,
00198 // WINCVS_PRIVATE_BUILD:    These should be #defined to a double-quoted
00199 //                      string that will be used to create a prefix for
00200 //                      the build description string. E.g., the following:
00201 //
00202 //                      #define WINCVS_SPECIAL_BUILD "anomalous"
00203 //                      #define WINCVS_PRIVATE_BUILD "in house"
00204 //
00205 //                      Will produce the text "in house anomalous build"
00206 //                      in the file and product description strings,
00207 //                      "anomalous build" in the Special Build Description
00208 //                      string, and "in house build" in the Private Build
00209 //                      string in the VERSION_INFO resource.
00210 //
00211 // All other necessary preprocessor definitions are synthesized by
00212 // version_fu.h
00213 //
00215
00217 // We need two macros because token expansion occurs when PP_STRINGIZE
00218 // expands x when passing it to PP_PASTE.
00219 #define PP_PASTE(x) #x
00220 #define PP_STRINGIZE(x) PP_PASTE(x)
00221
00222 #define WINCVS_FILEVERSION WINCVS_FILE_MAJOR,WINCVS_FILE_MINOR,WINCVS_FILE_PATCHLEVEL,WINCVS_BUILD
00223 #define CVSNTDOS_FILEVERSION CVSNTDOS_FILE_MAJOR,CVSNTDOS_FILE_MINOR,CVSNTDOS_FILE_PATCHLEVEL,CVSNTDOS_BUILD
00224 #define WINCVS_PRODUCTVERSION WINCVS_PRODUCT_MAJOR,WINCVS_PRODUCT_MINOR,WINCVS_PRODUCT_PATCHLEVEL,WINCVS_BUILD
00225
00226 #if defined(_UNICODE)
00227 #define WCVS_UNICODE_BUILD_STRING_PREFIX "Unicode "
00228 #else
00229 #define WCVS_UNICODE_BUILD_STRING_PREFIX
00230 #endif
00231
00232 #if defined(WCVS_PATCH)
00233 #define WCVS_PATCHED_FLAG VS_FF_PATCHED
00234 #else   // defined(WCVS_PATCH)
00235 #define WCVS_PATCHED_FLAG 0
00236 #endif  // defined(WCVS_PATCH)
00237
00238 #if defined(WINCVS_SPECIAL_BUILD)
00239 #define WCVS_SPECIAL_BUILD_STRING_PREFIX WINCVS_SPECIAL_BUILD " "
00240 #define WCVS_SPECIAL_BUILD_STRING WCVS_SPECIAL_BUILD_STRING_PREFIX "build"
00241 #define WCVS_SPECIAL_BUILD_FLAG VS_FF_SPECIALBUILD
00242 #else   // defined(WINCVS_SPECIAL_BUILD)
00243 #define WCVS_SPECIAL_BUILD_STRING_PREFIX
00244 #define WCVS_SPECIAL_BUILD_STRING
00245 #define WCVS_SPECIAL_BUILD_FLAG 0
00246 #endif  // defined(WINCVS_SPECIAL_BUILD)
00247
00248 #if defined(WINCVS_OFFICIAL_DISTRIBUTION)
00249 #define WCVS_PRIVATE_BUILD_STRING_PREFIX
00250 #define WCVS_PRIVATE_BUILD_STRING
00251 #define WCVS_PRIVATE_BUILD_FLAG 0
00252 #else   // defined(WINCVS_OFFICIAL_DISTRIBUTION)
00253 #   if defined(WINCVS_PRIVATE_BUILD)
00254 #       define WCVS_PRIVATE_BUILD_STRING_PREFIX WINCVS_PRIVATE_BUILD " "
00255 #   else    // defined(WINCVS_PRIVATE_BUILD)
00256 #       define WCVS_PRIVATE_BUILD_STRING_PREFIX "Local "
00257 #   endif   // defined(WINCVS_PRIVATE_BUILD)
00258 #define WCVS_PRIVATE_BUILD_STRING WCVS_PRIVATE_BUILD_STRING_PREFIX "build"
00259 #define WCVS_PRIVATE_BUILD_FLAG VS_FF_PRIVATEBUILD
00260 #endif  // defined(WINCVS_OFFICIAL_DISTRIBUTION)
00261
00262 #if defined(WINCVS_ALPHA_RELEASE)
00263 #   if defined(WINCVS_RELEASE)
00264 #       undef WINCVS_RELEASE
00265 #   endif   // defined(WINCVS_RELEASE)
00266 #   if defined(WINCVS_BETA_RELEASE)
00267 #       undef WINCVS_BETA_RELEASE
00268 #   endif   // defined(WINCVS_BETA_RELEASE)
00269 #elif defined(WINCVS_BETA_RELEASE)      // defined(WINCVS_ALPHA_RELEASE)
00270 #   if defined(WINCVS_RELEASE)
00271 #       undef WINCVS_RELEASE
00272 #   endif   // defined(WINCVS_RELEASE)
00273 #endif  // defined(WINCVS_ALPHA_RELEASE)
00274
00275 #if defined(WINCVS_RELEASE)
00276 #define WCVS_PRERELEASE_BUILD_STRING_PREFIX
00277 #define WCVS_PRERELEASE_FLAG 0
00278 #else   // defined(WINCVS_RELEASE)
00279 #   if defined(WINCVS_ALPHA_RELEASE)
00280 #       define WCVS_PRERELEASE_BUILD_STRING_PREFIX PP_STRINGIZE(Alpha WINCVS_PRODUCT_PATCHLEVEL) " "
00281 #   elif defined(WINCVS_BETA_RELEASE)   // defined(WINCVS_ALPHA_RELEASE)
00282 #       define WCVS_PRERELEASE_BUILD_STRING_PREFIX PP_STRINGIZE(Beta WINCVS_PRODUCT_PATCHLEVEL) " "
00283 #   else    // defined(WINCVS_ALPHA_RELEASE)
00284 #       define WCVS_PRERELEASE_BUILD_STRING_PREFIX "Prerelease "
00285 #   endif   // defined(WINCVS_ALPHA_VERSION) ...
00286 #define WCVS_PRERELEASE_FLAG VS_FF_PRERELEASE
00287 #endif  // defined(WINCVS_RELEASE)
00288
00289 #if defined(_DEBUG)
00290 #define WCVS_DEBUG_FLAG VS_FF_DEBUG
00291 #define WCVS_DEBUG_BUILD_STRING_PREFIX "Debug "
00292 #else   // defined(_DEBUG)
00293 #define WCVS_DEBUG_BUILD_STRING_PREFIX
00294 #define WCVS_DEBUG_FLAG 0
00295 #endif  // defined(_DEBUG)
00296
00297 //
00298 //  Resource Compiler chokes if we break these long lines with line continuation characters '\'
00299 //
00300 #define WINCVS_FILEVERSION_STRING PP_STRINGIZE(WINCVS_FILE_MAJOR.WINCVS_FILE_MINOR.WINCVS_FILE_PATCHLEVEL.WINCVS_BUILD) " " WCVS_PRERELEASE_BUILD_STRING_PREFIX "(" WCVS_PRIVATE_BUILD_STRING_PREFIX WCVS_SPECIAL_BUILD_STRING_PREFIX WCVS_UNICODE_BUILD_STRING_PREFIX WCVS_DEBUG_BUILD_STRING_PREFIX PP_STRINGIZE(Build WINCVS_BUILD) ")"
00301 #define CVSNTDOS_FILEVERSION_STRING PP_STRINGIZE(CVSNTDOS_FILE_MAJOR.CVSNTDOS_FILE_MINOR.CVSNTDOS_FILE_PATCHLEVEL.CVSNTDOS_BUILD) " " WCVS_PRERELEASE_BUILD_STRING_PREFIX "(" WCVS_PRIVATE_BUILD_STRING_PREFIX WCVS_SPECIAL_BUILD_STRING_PREFIX WCVS_UNICODE_BUILD_STRING_PREFIX WCVS_DEBUG_BUILD_STRING_PREFIX PP_STRINGIZE(Build CVSNTDOS_BUILD) ")"
00302
00303 #define WINCVS_PRODUCTVERSION_STRING PP_STRINGIZE(WINCVS_FILE_MAJOR.WINCVS_FILE_MINOR.WINCVS_FILE_PATCHLEVEL.WINCVS_BUILD) " " WCVS_PRERELEASE_BUILD_STRING_PREFIX "(" WCVS_PRIVATE_BUILD_STRING_PREFIX WCVS_SPECIAL_BUILD_STRING_PREFIX WCVS_UNICODE_BUILD_STRING_PREFIX WCVS_DEBUG_BUILD_STRING_PREFIX PP_STRINGIZE(Build WINCVS_BUILD) ")"
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/version_no.h Source File

WinCvs/version_no.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jonathan M. Gilligan <jonathan.gilligan@vanderbilt.edu> --- 23 June 2001
00019  */
00020
00021 /*
00022  * version_no.h -- Definitions for version numbering in WinCVS,
00023  *                 detailed documentation is below, see also, version_fu.h
00024  */
00025
00026 #pragma once
00027
00028 // For WinCVS version 1.3 beta 6
00029 #define WINCVS_FILE_MAJOR 1
00030 #define WINCVS_FILE_MINOR 3
00031 #define WINCVS_FILE_PATCHLEVEL 6
00032
00033 #define WINCVS_PRODUCT_MAJOR 1
00034 #define WINCVS_PRODUCT_MINOR 3
00035 #define WINCVS_PRODUCT_PATCHLEVEL 6
00036
00037 #define CVSNTDOS_FILE_MAJOR 1
00038 #define CVSNTDOS_FILE_MINOR 11
00039 #define CVSNTDOS_FILE_PATCHLEVEL 1
00040
00041 // manually increment these when declaring a build.
00042 // Ideally, tag the repository with the build number
00043 // so a build can be reproduced.
00044 #define WINCVS_BUILD 1
00045 #define CVSNTDOS_BUILD 1
00046
00047 //
00048 // Example preprocessor definitions.
00049 //
00050 // #define WINCVS_SPECIAL_BUILD "My special"
00051 // note: no "build" at the end. This is added by
00052 // version-fu.
00053 //
00054 //#define WINCVS_ALPHA_RELEASE
00055 //#define WINCVS_BETA_RELEASE
00056 //
00057
00058 #define WINCVS_BETA_RELEASE
00059 #define WINCVS_PRIVATE_BUILD "Local"
00060
00062 // Preprocessor definitions (for version_no.h)
00063 //
00064 // Preprocessor flags (empty #defines):
00065 // These should be #defined in version_no.h
00066 //
00067 // WINCVS_OFFICIAL_DISTRIBUTION_PACKAGE:    #define this only when making
00068 //                      an official distribution package. This flag should
00069 //                      never be defined in anything checked into the cvs
00070 //                      repository.
00071 //
00072 // WINCVS_RELEASE:      define this if this is a release (as opposed to a
00073 //                      prerelease) build.
00074 //
00075 // WINCVS_ALPHA_RELEASE:    define this if this is a alpha release. The
00076 //                      alpha number (e.g., alpha 2) will be taken from
00077 //                      the product patch level (see below).
00078 //
00079 // WINCVS_BETA_RELEASE: define this if this is a beta release. The beta
00080 //                      number (e.g., beta 2) will be taken from the
00081 //                      product patch level (see below).
00082 //
00083 // Preprocessor values (#defines with contents):
00084 // These should be #defined in version_no.h
00085 //
00086 // WINCVS_FILE_MAJOR,
00087 // WINCVS_FILE_MINOR,
00088 // WINCVS_FILE_PATCHLEVEL,
00089 //
00090 // CVSNTDOS_FILE_MAJOR,
00091 // CVSNTDOS_FILE_MINOR,
00092 // CVSNTDOS_FILE_PATCHLEVEL,
00093 //
00094 // WINCVS_PRODUCT_MAJOR,
00095 // WINCVS_PRODUCT_MINOR,
00096 // WINCVS_PRODUCT_PATCHLEVEL,
00097 //
00098 // WINCVS_BUILD,
00099 // CVSNTDOS_BUILD:      These macros all indicate parts of the version
00100 //                      number. *FILE* indicates specific numbers for the
00101 //                      .exe files (WinCVS.exe, CVS.exe). The *PRODUCT*
00102 //                      numbers indicate the version of the package as a
00103 //                      whole.
00104 //
00105 //                      At this time, WinCVS.exe is at version 1.3.2.x
00106 //                      (WinCVS 1.3 beta 2, build x), cvs.exe is at
00107 //                      1.11.1.x (cvs 1.11 patch level 1, build x). Both
00108 //                      files are part of the WinCVS 1.3 beta 2
00109 //                      distribution.
00110 //
00111 //                      The build numbers for both files should be
00112 //                      incremented (by hand editing version_no.h) at
00113 //                      least once for every build posted publicly at
00114 //                      cvsgui.org.
00115 //
00116 //                      EXAMPLE:
00117 //
00118 //                      #define WINCVS_FILE_MAJOR           1
00119 //                      #define WINCVS_FILE_MINOR           3
00120 //                      #define WINCVS_FILE_PATCHLEVEL      2
00121 //
00122 //                      #define CVSNTDOS_FILE_MAJOR         1
00123 //                      #define CVSNTDOS_FILE_MINOR        11
00124 //                      #define CVSNTDOS_FILE_PATCHLEVEL    1
00125 //
00126 //                      #define WINCVS_PRODUCT_MAJOR        1
00127 //                      #define WINCVS_PRODUCT_MINOR        3
00128 //                      #define WINCVS_PRODUCT_PATCHLEVEL   2
00129 //
00130 //                      #define WINCVS_BUILD                1
00131 //                      #define CVSNTDOS_BUILD              1
00132 //
00133 //
00134 // WINCVS_SPECIAL_BUILD,
00135 // WINCVS_PRIVATE_BUILD:    These should be #defined to a double-quoted
00136 //                      string that will be used to create a prefix for
00137 //                      the build description string. E.g., the following:
00138 //
00139 //                      #define WINCVS_SPECIAL_BUILD "anomalous"
00140 //                      #define WINCVS_PRIVATE_BUILD "in house"
00141 //
00142 //                      Will produce the text "in house anomalous build"
00143 //                      in the file and product description strings,
00144 //                      "anomalous build" in the Special Build Description
00145 //                      string, and "in house build" in the Private Build
00146 //                      string in the VERSION_INFO resource.
00147 //
00148 // All other necessary preprocessor definitions are synthesized by
00149 // version_fu.h
00150 //
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/Win32wstring.hpp Source File

WinCvs/Win32wstring.hpp

Go to the documentation of this file.
00001 // RCS: @(#) $Id: Win32wstring.hpp,v 1.1 2001/01/13 14:42:51 davygrvy Exp $
00002
00003 #include <string>
00004 #include <windows.h>
00005
00006
00007 // Wide (unicode) strings, windows style.
00008 class Win32wstring : public std::wstring
00009 {
00010 public:
00011     Win32wstring(unsigned int codepage, std::string *s)
00012     {
00013         convert(codepage, s->c_str(), s->length());
00014     }
00015
00016     Win32wstring(unsigned int codepage, std::string &s)
00017     {
00018         convert(codepage, s.c_str(), s.length());
00019     }
00020
00021 private:
00022     void convert(unsigned int codepage, const char *s, int inLen)
00023     {
00024         register int outLen;
00025         register wchar_t *buff = NULL;
00026
00027         // I read this in the msdn docs:
00028         // "Windows NT 4.0 and Windows 2000: Translate using UTF-8.
00029         //  When this is set, dwFlags must be zero."
00030         //
00031         // Does this mean UTF-8 conversions don't work on win 95/98 ???
00032         //
00033         DWORD flags = (codepage == CP_UTF8 ? 0 : MB_USEGLYPHCHARS);
00034
00035         // calc size needed
00036         outLen = ::MultiByteToWideChar(codepage, flags, s, inLen, buff, 0);
00037
00038         buff = new wchar_t [outLen];
00039
00040         // do it
00041         ::MultiByteToWideChar(codepage, flags, s, inLen, buff, outLen);
00042
00043         // set the string into our base class.
00044         assign(buff, outLen);
00045
00046         // discard the scratch space.
00047         delete [] buff;
00048     }
00049 };
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/wincvs.cpp Source File

WinCvs/wincvs.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // wincvs.cpp : Defines the class behaviors for the application.
00022 //
00023
00024 #include "stdafx.h"
00025 #include "wincvs.h"
00026
00027 #include "MainFrm.h"
00028 #include "wincvsDoc.h"
00029 #include "GraphDoc.h"
00030 #include "LogFrm.h"
00031 #include "GraphFrm.h"
00032 #include "wincvsView.h"
00033 #include "GraphView.h"
00034 #include "WinCvsBrowser.h"
00035 #include "BrowseFileView.h"
00036 #include "AppGlue.h"
00037 #include "CvsPrefs.h"
00038 #include "AppConsole.h"
00039 #include "Splash.h"
00040 #include "TextBinary.h"
00041 #include "MacrosSetup.h"
00042 #include "MultiString.h"
00043 #include "CvsCommands.h"
00044 #include "Authen.h"
00045 #include "TclGlue.h"
00046 #include "PythonGlue.h"
00047 #include "BrowserBar.h"
00048 #include "FileTraversal.h"
00049 #include "cvsgui_process.h"
00050
00051 #include "CVSTrace.h"
00052 #include "CVS_Coworker_i.h"
00053 #include "CVS_Coworker_i.c"
00054 #include "CVSCoworker.h"
00055
00056 #ifdef _DEBUG
00057 #define new DEBUG_NEW
00058 #undef THIS_FILE
00059 static char THIS_FILE[] = __FILE__;
00060 #endif
00061
00062 CCVS_CoworkerModule _Module;
00063
00064 BEGIN_OBJECT_MAP(ObjectMap)
00065 OBJECT_ENTRY(CLSID_CvsCoworker, CvsCoworker)
00066 END_OBJECT_MAP()
00067
00068 LONG CCVS_CoworkerModule::Unlock()
00069 {
00070     AfxOleUnlockApp();
00071     return 0;
00072 }
00073
00074 LONG CCVS_CoworkerModule::Lock()
00075 {
00076     AfxOleLockApp();
00077     return 1;
00078 }
00079 LPCTSTR CCVS_CoworkerModule::FindOneOf(LPCTSTR p1, LPCTSTR p2)
00080 {
00081     while (*p1 != NULL)
00082     {
00083         LPCTSTR p = p2;
00084         while (*p != NULL)
00085         {
00086             if (*p1 == *p)
00087                 return CharNext(p1);
00088             p = CharNext(p);
00089         }
00090         p1++;
00091     }
00092     return NULL;
00093 }
00094
00095 // to handle auto-logout
00096 class CLogoutThread : public CWinThread
00097 {
00098 public:
00099     DECLARE_DYNAMIC(CLogoutThread)
00100
00101     CLogoutThread();
00102     virtual ~CLogoutThread();
00103     virtual void Delete();
00104
00105     void KillThread(void) { m_term = true; }
00106         // terminate
00107
00108 // Overrides
00109     // ClassWizard generated virtual function overrides
00110     //{{AFX_VIRTUAL(CLogoutThread)
00111     //}}AFX_VIRTUAL
00112
00113 protected:
00114     bool m_term;
00115
00116     virtual BOOL InitInstance();
00117
00118     // Generated message map functions
00119     //{{AFX_MSG(CLogoutThread)
00120         // NOTE - the ClassWizard will add and remove member functions here.
00121     //}}AFX_MSG
00122
00123     DECLARE_MESSAGE_MAP()
00124 };
00125
00126 CLogoutThread::CLogoutThread() : m_term(false)
00127 {
00128 }
00129
00130 CLogoutThread::~CLogoutThread()
00131 {
00132 }
00133
00134 void CLogoutThread::Delete()
00135 {
00136     CWinThread::Delete();
00137 }
00138
00139 BOOL CLogoutThread::InitInstance()
00140 {
00141     for(;;)
00142     {
00143         Sleep(1000);
00144
00145         if(m_term)
00146             return FALSE;
00147
00148         CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00149         if(gAuthen.kind() != pserver || !gCvsPrefs.HasLoogedIn() ||
00150             gCvsPrefs.LogoutTimeOut() <= 0 || app->gCvsRunning)
00151                 continue;
00152
00153         DWORD time = ::GetTickCount();
00154         if(app->GetIdleTime() != 0 &&
00155             (time - app->GetIdleTime()) >= (gCvsPrefs.LogoutTimeOut() * 60 * 1000))
00156         {
00157             app->ResetIdleTime();
00158             cvs_err("Making automatic logout after %d minute(s):\n", gCvsPrefs.LogoutTimeOut());
00159             CvsCmdLogout();
00160         }
00161     }
00162
00163     return FALSE;
00164 }
00165
00166 IMPLEMENT_DYNAMIC(CLogoutThread, CWinThread);
00167
00168 BEGIN_MESSAGE_MAP(CLogoutThread, CWinThread)
00169     //{{AFX_MSG_MAP(CLogoutThread)
00170         // NOTE - the ClassWizard will add and remove mapping macros here.
00171     //}}AFX_MSG_MAP
00172 END_MESSAGE_MAP()
00173
00174 static CLogoutThread *sLogout = 0L;
00175
00177 // CWincvsApp
00178
00179 BEGIN_MESSAGE_MAP(CWincvsApp, CWinApp)
00180     ON_COMMAND(CG_IDS_TIPOFTHEDAY, ShowTipOfTheDay)
00181     //{{AFX_MSG_MAP(CWincvsApp)
00182     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
00183     ON_COMMAND(ID_APP_COPYRIGHTS, OnAppCopyrights)
00184     ON_COMMAND(ID_APP_CREDITS, OnAppCredits)
00185     ON_UPDATE_COMMAND_UI(ID_APP_COPYRIGHTS, OnLogWindowIsPresent)
00186     ON_UPDATE_COMMAND_UI(ID_APP_CREDITS, OnLogWindowIsPresent)
00187     ON_COMMAND(ID_HELP_CVS, OnHelpCvs)
00188     ON_COMMAND(ID_HELP_CVSCLIENT, OnHelpCvsclient)
00189     //}}AFX_MSG_MAP
00190     // Standard file based document commands
00191     ON_COMMAND(ID_FILE_NEW, OnFileNew)
00192     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
00193     // Standard print setup command
00194     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
00195 END_MESSAGE_MAP()
00196
00198 // CWincvsApp construction
00199
00200 CWincvsApp::CWincvsApp() : m_isBackgroundProcess(false)
00201 {
00202     gCvsRunning = false;
00203     gCvsStopping = false;
00204     gLastCvsResult = 0;
00205     m_idletime = 0;
00206     m_bATLInited = FALSE;
00207     gCvsProcess = 0L;
00208 }
00209
00210 void CWincvsApp::OnLogWindowIsPresent(CCmdUI* pCmdUI)
00211 {
00212     pCmdUI->Enable(GetConsoleView() != 0L);
00213 }
00214
00215 void CWincvsApp::OnFileNew()
00216 {
00217     gLogTempl->OpenDocumentFile(NULL);
00218 }
00219
00221 // The one and only CWincvsApp object
00222
00223 CWincvsApp theApp;
00224
00225 // This identifier was generated to be statistically unique for your app.
00226 // You may change it if you prefer to choose a specific identifier.
00227
00228 // {D2D77DC2-8299-11D1-8949-444553540000}
00229 static const CLSID clsid =
00230 { 0xd2d77dc2, 0x8299, 0x11d1, { 0x89, 0x49, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } };
00231
00233 // CWincvsApp initialization
00234
00235 /*
00236  * The handle is of an unknown type.  Test the validity of this OS
00237  * handle by duplicating it, then closing the dupe.  The Win32 API
00238  * doesn't provide an IsValidHandle() function, so we have to emulate
00239  * it here.  This test will not work on a console handle reliably,
00240  * which is why we can't test every handle that comes into this
00241  * function in this way.
00242  */
00243 bool IsValidHandle( HANDLE handle )
00244 {
00245     HANDLE dupedHandle = NULL;
00246
00247     /*
00248      * GetFileType() returns FILE_TYPE_UNKNOWN for invalid handles.
00249      */
00250
00251     if( GetFileType(handle) == FILE_TYPE_UNKNOWN )
00252     {
00253         if( !DuplicateHandle(GetCurrentProcess(),
00254             handle,
00255             GetCurrentProcess(),
00256             &dupedHandle,
00257             0,
00258             FALSE,
00259             DUPLICATE_SAME_ACCESS) )
00260         {
00261             /*
00262             * Unable to make a duplicate. It's definately invalid at this point
00263             */
00264
00265             return false;
00266         }
00267
00268         /*
00269         * Use structured exception handling (Win32 SEH) to protect the close
00270         * of this duped handle which might throw EXCEPTION_INVALID_HANDLE.
00271         */
00272         __try
00273         {
00274             CloseHandle(dupedHandle);
00275         }
00276         __except (EXCEPTION_EXECUTE_HANDLER)
00277         {
00278             /*
00279             * Definately an invalid handle.  So, therefore, the original
00280             * is invalid also.
00281             */
00282
00283             return false;
00284         }
00285     }
00286
00287     return true;
00288 }
00289
00290 BOOL CWincvsApp::InitInstance()
00291 {
00292 #if qCvsDebug
00293     int tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
00294     tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF;
00295     _CrtSetDbgFlag(tmpDbgFlag);
00296 #endif
00297     CStr lastWorkingDir;
00298
00299     // David Gravereaux <davygrvy@interwoven.com> suggests this might
00300     // be a work around to the bug #42 (I love the bug number,
00301     // really fits the bug description ;-))
00302 #if 0
00303     if (!IsValidHandle(GetStdHandle(STD_OUTPUT_HANDLE)))
00304     {
00305         SetStdHandle(STD_OUTPUT_HANDLE, 0L);
00306     }
00307 #endif
00308
00309     // CG: The following block was added by the Splash Screen component.
00310     {
00311         CCommandLineInfo cmdInfo;
00312         ParseCommandLine(cmdInfo);
00313
00314         CSplashWnd::EnableSplashScreen(
00315             (!(m_nCmdShow & SW_SHOWMINIMIZED)) && cmdInfo.m_bShowSplash);
00316     }
00317
00318     if (!AfxSocketInit())
00319     {
00320         AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
00321         return FALSE;
00322     }
00323
00324     if (!InitATL())
00325         return FALSE;
00326
00327     // Initialize OLE libraries
00328     if (!AfxOleInit())
00329     {
00330         AfxMessageBox(IDP_OLE_INIT_FAILED);
00331         return FALSE;
00332     }
00333
00334     AfxEnableControlContainer();
00335
00336     // Standard initialization
00337     // If you are not using these features and wish to reduce the size
00338     //  of your final executable, you should remove from the following
00339     //  the specific initialization routines you do not need.
00340
00341 #ifdef _AFXDLL
00342     Enable3dControls();         // Call this when using MFC in a shared DLL
00343 #else
00344     Enable3dControlsStatic();   // Call this when linking to MFC statically
00345 #endif
00346
00347     InitializeCriticalSection(&CCvsThreadLock::m_lock);
00348
00349     // Change the registry key under which our settings are stored.
00350     // You should modify this string to be something appropriate
00351     // such as the name of your company or organization.
00352     SetRegistryKey(_T("WinCvs"));
00353
00354     LoadStdProfileSettings(5);  // Load standard INI file options (including MRU)
00355     gCvsPrefs.load();
00356
00357     CStr strVersion;
00358     GetAppVersion(strVersion);
00359     WriteProfileString(_T(""), _T("Current Version"), strVersion);
00360
00361     //
00362     // We need to make a temp local copy of LastWorkingDir property here,
00363     // because CWinCvsBrowser::OnSelchanging event would override
00364     // LastWorkingDir preference when browser window is created.
00365     //
00366     lastWorkingDir = gCvsPrefs.LastWorkingDir();
00367
00368     // Register the application's document templates.  Document templates
00369     //  serve as the connection between documents, frame windows and views.
00370
00371     gLogTempl = new CMultiDocTemplate(
00372         IDR_MAINFRAME,
00373         RUNTIME_CLASS(CWincvsDoc),
00374         RUNTIME_CLASS(CLogFrame),
00375         RUNTIME_CLASS(CBrowseFileView));
00376     AddDocTemplate(gLogTempl);
00377
00378     gLogGraph = new CMultiDocTemplate(
00379         IDR_GRAPH,
00380         RUNTIME_CLASS(CGraphDoc),
00381         RUNTIME_CLASS(CGraphFrame),
00382         RUNTIME_CLASS(CGraphView));
00383     AddDocTemplate(gLogGraph);
00384
00385     /*gLogHtml = new CMultiDocTemplate(
00386         IDR_GRAPH,
00387         RUNTIME_CLASS(CDocument),
00388         RUNTIME_CLASS(CMDIChildWnd),
00389         RUNTIME_CLASS(CGraphView));
00390     AddDocTemplate(gLogGraph);*/
00391
00392     // Connect the COleTemplateServer to the document template.
00393     //  The COleTemplateServer creates new documents on behalf
00394     //  of requesting OLE containers by using information
00395     //  specified in the document template.
00396     m_server.ConnectTemplate(clsid, gLogTempl, TRUE);
00397         // Note: SDI applications register server objects only if /Embedding
00398         //   or /Automation is present on the command line.
00399
00400     // Register all OLE server factories as running.  This enables the
00401     //  OLE libraries to create objects from other applications.
00402     COleTemplateServer::RegisterAll();
00403         // Note: MDI applications register all server objects without regard
00404         //  to the /Embedding or /Automation on the command line.
00405
00406     // create main MDI Frame window
00407     m_mainFrame = new CMainFrame;
00408     if (!m_mainFrame->LoadFrame(IDR_CNTR_INPLACE))
00409         return FALSE;
00410     m_pMainWnd = m_mainFrame;
00411
00412     // Initialize the cool menus...
00413 #if 0
00414     UINT barIds[] = {IDR_BROWSER, IDR_MAINFRAME, IDR_MULTIUSER, IDR_TAGS, IDR_FILELIST, IDR_FILTER};
00415     m_mainFrame->InitializeMenu(gLogTempl,
00416         IDR_MAINFRAME, barIds, _countof(barIds), IDR_MAINFRAME);
00417     m_mainFrame->InitializeMenu(gLogGraph,
00418         IDR_GRAPH, barIds, _countof(barIds), IDR_GRAPH);
00419 #endif
00420
00421     // Parse command line for standard shell commands, DDE, file open
00422     CCommandLineInfo cmdInfo;
00423     ParseCommandLine(cmdInfo);
00424
00425     // Check to see if launched as OLE server
00426     if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
00427     {
00428 #if 0
00429         // Register all OLE server (factories) as running.  This enables the
00430         //  OLE libraries to create objects from other applications.
00431         COleTemplateServer::RegisterAll();
00432 #endif
00433
00434         // Application was run with /Embedding or /Automation.  Don't show the
00435         //  main window in this case.
00436         return TRUE;
00437     }
00438
00439     // When a server application is launched stand-alone, it is a good idea
00440     //  to update the system registry in case it has been damaged.
00441     m_server.UpdateRegistry(OAT_DISPATCH_OBJECT);
00442     COleObjectFactory::UpdateRegistryAll();
00443
00444     //JK - try to resolve the long filename if the argument passed is the short filename (like when it's a call thru SendTo shell menu)
00445     if( -1 != cmdInfo.m_strFileName.Find('~') )
00446     {
00447         CString strLongFileName;
00448         CString strTempTileName = cmdInfo.m_strFileName;
00449
00450         SHFILEINFO sFileInfo;
00451         int nSlashPos = -1;
00452
00453         BOOL bError = FALSE;
00454
00455         while( -1 != (nSlashPos = strTempTileName.ReverseFind(kPathDelimiter)) )
00456         {
00457             if( SHGetFileInfo((LPCTSTR)strTempTileName, 0, &sFileInfo, sizeof(sFileInfo), SHGFI_DISPLAYNAME) )
00458             {
00459                 CString strFileNameBit = strTempTileName.Mid(nSlashPos + 1);
00460
00461                 strLongFileName = sFileInfo.szDisplayName + strLongFileName;
00462                 strLongFileName = kPathDelimiter + strLongFileName;
00463                 strTempTileName = strTempTileName.Left(nSlashPos);
00464             }
00465             else
00466             {
00467                 bError = TRUE;
00468                 break;  //we need it or we get the dead loop
00469             }
00470         }//end while
00471
00472         if( !bError )
00473         {
00474             cmdInfo.m_strFileName = strTempTileName + strLongFileName;
00475         }
00476     }
00477
00478     //JK - open in the directory, so remove the file
00479     CString strOpenDirectory;
00480     CString strSelectFile;
00481     if( !cmdInfo.m_strFileName.IsEmpty() )
00482     {
00483         TCHAR fullpath[_MAX_PATH];
00484         _tfullpath(fullpath, cmdInfo.m_strFileName, _MAX_PATH);
00485         struct stat sb;
00486         if(stat(fullpath, &sb) == -1 || !S_ISDIR(sb.st_mode))
00487         {
00488             TCHAR drive[_MAX_DRIVE];
00489             TCHAR dir[_MAX_DIR];
00490             _tsplitpath(fullpath, drive, dir, NULL, NULL);
00491             strSelectFile = fullpath;
00492             _tmakepath(fullpath, drive, dir, NULL, NULL);
00493             strOpenDirectory = fullpath;
00494         }
00495     }
00496
00497     // Dispatch commands specified on the command line
00498     //JK - we need to trick the ProcessShellCommand a bit
00499     //because we might get a directory as a parameter we don't want it to check after the file...
00500     cmdInfo.m_nShellCommand = CCommandLineInfo::FileNew;
00501     if (!ProcessShellCommand(cmdInfo))
00502         return FALSE;
00503
00504     // The one and only window has been initialized, so show and update it.
00505     m_mainFrame/*m_pMainWnd*/->InitialShowWindow(m_nCmdShow);
00506     m_mainFrame/*m_pMainWnd*/->UpdateWindow();
00507
00508     m_mainFrame/*m_pMainWnd*/->DragAcceptFiles();
00509     //CWincvsView *cons = GetConsoleView();
00510     //if(cons != 0L)
00511     //  cons->DragAcceptFiles();
00512
00513
00514     CWinCvsBrowser *browser = GetBrowserView();
00515     CWincvsDoc *doc = (CWincvsDoc *)GetDocument();
00516     if(doc != 0L && browser != 0L)
00517         doc->SetTitle(browser->GetRoot());
00518     CBrowseFileView *fileView = GetFileView();
00519     if(fileView != 0L)
00520     {
00521         if( strOpenDirectory.IsEmpty() )
00522         {
00523             // Goto the last working directory, which was selected
00524             // when WinCVS was closed
00525             if( !lastWorkingDir.empty() && browser->StepToLocation(lastWorkingDir) )
00526             {
00527                 fileView->ResetView(lastWorkingDir, false, (LPCTSTR) 0L);
00528                 gCvsPrefs.SetLastWorkingDir(lastWorkingDir);
00529             }
00530             else
00531                 fileView->ResetView(browser->GetRoot());
00532         }
00533         else
00534         {
00535             CColorConsole out;
00536             out << kBold << "Locating: " << kNormal << kUnderline << cmdInfo.m_strFileName << kNormal <<  kNormal << kNL;
00537
00538             if( browser->StepToLocation((LPCTSTR)strOpenDirectory) )
00539             {
00540                 fileView->ResetView( (LPCTSTR)strOpenDirectory, false, (LPCTSTR)strSelectFile );
00541             }
00542             else
00543             {
00544                 fileView->ResetView( browser->GetRoot() );
00545             }
00546         }
00547     }
00548
00549     //MacrosReloadAll();
00550     PyMacrosReloadAll();
00551
00552     //JK - if you launch WinCvs with the file or directory as a parameter you obviously don't need a "tip of the day" because you're in a hurry
00553     if( strOpenDirectory.IsEmpty() )
00554     {
00555         // CG: This line inserted by 'Tip of the Day' component.
00556         ShowTipAtStartup();
00557     }
00558
00559     // auto-logout thread
00560     sLogout = new CLogoutThread();
00561     if (sLogout == 0L)
00562     {
00563         cvs_err("Impossible to create the auto-logout thread !\n");
00564     }
00565     else
00566     {
00567         ASSERT_VALID(sLogout);
00568
00569         // Create Thread in a suspended state so we can set the Priority
00570         // before it starts getting away from us
00571         if (!sLogout->CreateThread(CREATE_SUSPENDED))
00572         {
00573             cvs_err("Impossible to start the auto-logout thread (error %d)!\n", GetLastError());
00574             delete sLogout;
00575             sLogout = 0L;
00576         }
00577
00578         if(sLogout != 0L)
00579         {
00580             // If you want to make the sample more sprightly, set the thread priority here
00581             // a little higher. It has been set at idle priority to keep from bogging down
00582             // other apps that may also be running.
00583             VERIFY(sLogout->SetThreadPriority(THREAD_PRIORITY_NORMAL));
00584             // Now the thread can run wild
00585             sLogout->ResumeThread();
00586         }
00587     }
00588
00589     // load preferences. If CVSROOT is not defined
00590     // then prompt first preferences dialog.
00591     if(gCvsPrefs.empty())
00592         SendMessage(*m_mainFrame, WM_COMMAND, ID_APP_PREFERENCES, 0L);
00593         //doc->OnAppPreferences();
00594     else
00595         cvs_out("CVSROOT: %s (%s)\n", (const char *)gCvsPrefs, gAuthen.kindstr());
00596
00597     bool hasTCL = CTcl_Interp::IsAvail();
00598     bool hasPY = CPython_Interp::IsAvail();
00599
00600     if(gCvsPrefs.GetUseShell() == SHELL_PYTHON && !hasPY && hasTCL)
00601     {
00602         gCvsPrefs.SetUseShell(SHELL_TCL);
00603     }
00604     else if(gCvsPrefs.GetUseShell() == SHELL_TCL && hasPY && !hasTCL)
00605     {
00606         gCvsPrefs.SetUseShell(SHELL_PYTHON);
00607     }
00608
00609     if(gCvsPrefs.GetUseShell() == SHELL_TCL)
00610     {
00611         cvs_out("TCL is available, shell is enabled : help (select and press enter)\n");
00612     }
00613
00614     if(!hasTCL && !hasPY)
00615     {
00616         cvs_err("TCL or Python are *not* available, shell is disabled\n");
00617     }
00618
00619     //make sure the current directory is properly setup
00620     if( 0L != fileView )
00621     {
00622         chdir( fileView->GetPath() );
00623     }
00624
00625     return TRUE;
00626 }
00627
00629 // CAboutDlg dialog used for App About
00630
00631 class CAboutDlg : public CDialog
00632 {
00633 public:
00634     CAboutDlg();
00635
00636 // Dialog Data
00637     //{{AFX_DATA(CAboutDlg)
00638     enum { IDD = IDD_ABOUTBOX };
00639     CString m_vers;
00640     CCJHyperLink m_url;
00641     //}}AFX_DATA
00642
00643     // ClassWizard generated virtual function overrides
00644     //{{AFX_VIRTUAL(CAboutDlg)
00645     protected:
00646     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00647     //}}AFX_VIRTUAL
00648
00649 // Implementation
00650 protected:
00651     //{{AFX_MSG(CAboutDlg)
00652     virtual BOOL OnInitDialog();
00653     //}}AFX_MSG
00654     DECLARE_MESSAGE_MAP()
00655 };
00656
00657 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
00658 {
00659     //{{AFX_DATA_INIT(CAboutDlg)
00660     m_vers = _T("WinCvs ");
00661     //}}AFX_DATA_INIT
00662
00663     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00664     CStr vers;
00665
00666     if(app->GetAppVersion(vers))
00667     {
00668         m_vers = vers;
00669     }
00670 }
00671
00672 BOOL CAboutDlg::OnInitDialog()
00673 {
00674     CDialog::OnInitDialog();
00675
00676     m_url.SetURL(_T("http://www.cvsgui.org"));
00677
00678     return TRUE;  // return TRUE unless you set the focus to a control
00679                   // EXCEPTION: OCX Property Pages should return FALSE
00680 }
00681
00682 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
00683 {
00684     CDialog::DoDataExchange(pDX);
00685     //{{AFX_DATA_MAP(CAboutDlg)
00686     DDX_Control(pDX, IDC_WINCVSURL, m_url);
00687     DDX_Text(pDX, IDC_WINCVSVER, m_vers);
00688     //}}AFX_DATA_MAP
00689 }
00690
00691 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
00692     //{{AFX_MSG_MAP(CAboutDlg)
00693     //}}AFX_MSG_MAP
00694 END_MESSAGE_MAP()
00695
00696 // App command to run the dialog
00697 void CWincvsApp::OnAppAbout()
00698 {
00699     CAboutDlg aboutDlg;
00700     aboutDlg.DoModal();
00701 }
00702
00703 CWincvsView *CWincvsApp::GetConsoleView(void)
00704 {
00705     if(m_mainFrame == 0L)
00706         return 0L;
00707
00708     return m_mainFrame->GetConsoleView();
00709 }
00710
00711 CStatusBar *CWincvsApp::GetStatusBar()
00712 {
00713     if(m_mainFrame == 0L)
00714         return 0L;
00715
00716     return m_mainFrame->GetStatusBar();
00717 }
00718
00719 CWinCvsBrowser *CWincvsApp::GetBrowserView(void)
00720 {
00721     if(m_mainFrame == 0L)
00722         return 0L;
00723
00724     return m_mainFrame->GetBrowserView();
00725 }
00726
00727 CString CWincvsApp::GetRoot()
00728 {
00729     CString root;
00730     CWinCvsBrowser* view = GetBrowserView();
00731     if (view)
00732     {
00733         root = view->GetRoot();
00734     }
00735     return root;
00736 }
00737
00738 void CWincvsApp::ActivateBrowserView(void)
00739 {
00740     if(m_mainFrame == 0L)
00741         return;
00742
00743     m_mainFrame->GetWorkspace()->SetActiveView(RUNTIME_CLASS(CBrowserBar));
00744 }
00745
00746 CCJShellTree *CWincvsApp::GetExplorerView(void)
00747 {
00748     if(m_mainFrame == 0L)
00749         return 0L;
00750
00751     return m_mainFrame->GetExplorerView();
00752 }
00753
00754 CBrowseFileView *CWincvsApp::GetFileView(void)
00755 {
00756     POSITION post = GetFirstDocTemplatePosition();
00757     CDocTemplate* tmpl;
00758     while(post != NULL)
00759     {
00760         tmpl = GetNextDocTemplate(post);
00761         if(!tmpl->IsKindOf(RUNTIME_CLASS(CMultiDocTemplate)))
00762             continue;
00763         POSITION posd = tmpl->GetFirstDocPosition();
00764         CDocument* doc;
00765         while(posd != NULL)
00766         {
00767             doc = tmpl->GetNextDoc(posd);
00768             if(!doc->IsKindOf(RUNTIME_CLASS(CWincvsDoc)))
00769                 continue;
00770             POSITION posv = doc->GetFirstViewPosition();
00771             CView* view;
00772             while(posv != NULL)
00773             {
00774                 view = doc->GetNextView(posv);
00775                 if(view->IsKindOf(RUNTIME_CLASS(CBrowseFileView)))
00776                     return (CBrowseFileView *)view;
00777             }
00778         }
00779     }
00780     return NULL;
00781 }
00782
00783 CDocument *CWincvsApp::GetDocument(void)
00784 {
00785     CWinApp *app = AfxGetApp();
00786     POSITION post = app->GetFirstDocTemplatePosition();
00787     CDocTemplate* tmpl;
00788     while(post != NULL)
00789     {
00790         tmpl = app->GetNextDocTemplate(post);
00791         POSITION posd = tmpl->GetFirstDocPosition();
00792         CDocument* doc;
00793         while(posd != NULL)
00794         {
00795             doc = tmpl->GetNextDoc(posd);
00796             if(!doc->IsKindOf(RUNTIME_CLASS(CWincvsDoc)))
00797                 continue;
00798             return doc;
00799         }
00800     }
00801     ASSERT(0);
00802     return 0L;
00803 }
00804
00806 // CWincvsApp commands
00807
00808 // this one should be in MFC
00809 void AFXAPI DDV_MinChars(CDataExchange* pDX, CString const& value, int nChars)
00810 {
00811     ASSERT(nChars > 0);        // allow them something
00812     if (pDX->m_bSaveAndValidate && value.GetLength() < nChars)
00813     {
00814         TCHAR szT[255];
00815         wsprintf(szT, _T("Please enter more than %d character"), nChars);
00816         CString prompt;
00817         AfxMessageBox(szT, MB_ICONEXCLAMATION, AFX_IDP_PARSE_STRING_SIZE);
00818         prompt.Empty(); // exception prep
00819         pDX->Fail();
00820     }
00821 }
00822
00823 //it will trim the trailing spaces
00824 //if the bTest is true false then return: true if it was trimmed, false if not trimmed
00825 //if bTest is true then the return: true is there are trailing spaces, false if not
00826 bool TrimRight( char* szValue, bool bTest = false )
00827 {
00828     bool bRes = false;
00829
00830     char* pszPos = szValue;
00831     char* pszLastSpacePos = NULL;
00832
00833     //locate last white space
00834     while( *pszPos != '\0' )
00835     {
00836         if( isspace(*pszPos) )
00837         {
00838             if( pszLastSpacePos == NULL )
00839             {
00840                 pszLastSpacePos = pszPos;
00841             }
00842         }
00843         else
00844         {
00845             pszLastSpacePos = NULL;
00846         }
00847
00848         pszPos++;
00849     }
00850
00851     //and cut it off
00852     if( pszLastSpacePos )
00853     {
00854         if( !bTest )
00855         {
00856             *pszLastSpacePos = '\0';
00857         }
00858         bRes = true;
00859     }
00860
00861     return bRes;
00862 }
00863
00864 //to check whether the CVSROOT entered is valid, correct if not...
00865 void AFXAPI DDV_CheckCVSROOT(CDataExchange* pDX, CString& strValue)
00866 {
00867     //test 1
00868     //check after the trailing white spaces - often an unwanted result of copy-paste
00869     if( pDX->m_bSaveAndValidate &&
00870         TrimRight(strValue.GetBuffer(strValue.GetLength()+1), true) )
00871     {
00872         strValue.ReleaseBuffer();
00873
00874         if( AfxMessageBox("The CVSROOT value contains the trailing spaces. Do you want to trim them?", MB_ICONQUESTION | MB_YESNO) == IDYES )
00875         {
00876             TrimRight( strValue.GetBuffer(strValue.GetLength()+1) );
00877             strValue.ReleaseBuffer();
00878         }
00879     }
00880 }
00881
00882 //NOTE: if pDX passed as NULL then the combo is populated
00883 void AFXAPI DDX_ComboMString(CDataExchange* pDX, int nIDC,
00884                              CMString & mstr, CComboBox & combo)
00885 {
00886     if(!pDX || !pDX->m_bSaveAndValidate)
00887     {
00888         CString strOldText;
00889         combo.GetWindowText(strOldText);
00890
00891         combo.ResetContent();
00892         const vector<CStr> & list = mstr.GetList();
00893         vector<CStr>::const_iterator i;
00894         for(i = list.begin(); i != list.end(); ++i)
00895         {
00896             combo.AddString(*i);
00897         }
00898
00899         combo.SetWindowText(strOldText);
00900     }
00901     else
00902     {
00903         CString value;
00904         DDX_CBString(pDX, nIDC, value);
00905         if(!value.IsEmpty())
00906         {
00907             mstr.Insert(value);
00908         }
00909     }
00910 }
00911
00912 int CWincvsApp::ExitInstance()
00913 {
00914     // Save existing preferences. This will save, for example,
00915     // the current working directory as "LastWorkingDir" property.
00916     gCvsPrefs.save();
00917
00918     DeleteCriticalSection(&CCvsThreadLock::m_lock);
00919
00920     if (m_bATLInited)
00921     {
00922         LogCleanup();
00923         _Module.RevokeClassObjects();
00924         _Module.Term();
00925         CoUninitialize();
00926     }
00927
00928     return CWinApp::ExitInstance();
00929 }
00930
00931 void CWincvsApp::OnAppCopyrights()
00932 {
00933     cvs_out("\nBoth WinCVS and CVS are distributed under the terms of\n");
00934     cvs_out("the GNU General Public Licence (GPL).\n\n");
00935     cvs_out("* MacCVS/WinCvs : maintained by Alexandre Parenteau (aubonbeurre@hotmail.com)\n");
00936     cvs_out("* WinCvs documentation : Copyright © 1999 Don Harper <don@lamrc.com>.\n");
00937     cvs_out("* CVS : Copyright © 1989-1998 Brian Berliner, david d `zoo' zuhn,\n");
00938     cvs_out("        Jeff Polk, and other authors\n");
00939     cvs_out("* CJLIB : Copyright © 1998-99 Kirk Stowell <kstowell@codejockeys.com>\n");
00940     cvs_out("* Kerberos : Copyright © 1997 the Massachusetts Institute of Technology\n");
00941     cvs_out("* TCL : Copyright © Sun Microsystems Inc.\n");
00942     cvs_out("* Python : Copyright © Guido van Rossum\n");
00943     cvs_out("* MFC : Copyright © 1992-1997 Microsoft Corporation\n");
00944     cvs_out("\nSome others copyrights may apply, check the source code for details.\n");
00945 }
00946
00947 void CWincvsApp::OnAppCredits()
00948 {
00949     CStr vers;
00950
00951     if(GetAppVersion(vers))
00952         cvs_out("\n%s - Client/Local\n", (const char *)vers);
00953     else
00954         cvs_out("\nWinCvs 1.2 - Client/Local/\n");
00955     cvs_out("- WinCvs is developed by (alphabetically):\n");
00956     cvs_out("\t* V.Antonevich <v_antonevich@hotmail.com>\n");
00957     cvs_out("\t* Jerzy Kaczorowski  <kaczoroj@hotmail.com>\n");
00958     cvs_out("\t* Alexandre Parenteau <aubonbeurre@hotmail.com>\n");
00959     cvs_out("\t* Others contributors (see the ChangeLog)\n");
00960     cvs_out("- WinCvs page : http://www.cvsgui.org\n");
00961     cvs_out("- cvs page : http://www.cvshome.org\n");
00962     cvs_out("- WinCvs documentation : Don Harper <don@lamrc.com>.\n");
00963     cvs_out("- WinHelp cvs documentation : Norbert Klamann.\n");
00964     cvs_out("- Special thanks to :\n");
00965     cvs_out("\t* The Strata Inc. developpers who are so patients with WinCvs\n");
00966     cvs_out("\t  and help to identify a lot of problems.\n");
00967     cvs_out("\t* All the people who are submitting bugs, patches and\n");
00968     cvs_out("\t  answer the cvsgui mailing list.\n");
00969     cvs_out("- Bug reports, suggestions :\n");
00970     cvs_out("\t* Richard Wesley, Alain Aslag Roy, Eric Aubourg and many others\n");
00971     cvs_out("- Cvs contributors :\n");
00972     cvs_out("\t* Too many to be listed here, see the 'ChangeLog' instead !\n");
00973 }
00974
00975 void CWincvsApp::ShowTipAtStartup(void)
00976 {
00977     // CG: This function added by 'Tip of the Day' component.
00978
00979     CCommandLineInfo cmdInfo;
00980     ParseCommandLine(cmdInfo);
00981     if (cmdInfo.m_bShowSplash)
00982     {
00983         CTipDlg dlg( IsWindow(m_pMainWnd->GetSafeHwnd()) ? m_pMainWnd : NULL );
00984         if (dlg.m_bStartup)
00985             dlg.DoModal();
00986     }
00987
00988 }
00989
00990 void CWincvsApp::ShowTipOfTheDay(void)
00991 {
00992     // CG: This function added by 'Tip of the Day' component.
00993
00994     CTipDlg dlg;
00995     dlg.DoModal();
00996
00997 }
00998
00999 BOOL CWincvsApp::PreTranslateMessage(MSG* pMsg)
01000 {
01001     // CG: The following lines were added by the Splash Screen component.
01002     if (CSplashWnd::PreTranslateAppMessage(pMsg))
01003         return TRUE;
01004
01005     DWORD time = ::GetTickCount();
01006     if (m_idletime == 0 ||
01007         pMsg->message == WM_KEYDOWN ||
01008         pMsg->message == WM_SYSKEYDOWN ||
01009         pMsg->message == WM_LBUTTONDOWN ||
01010         pMsg->message == WM_RBUTTONDOWN ||
01011         pMsg->message == WM_MBUTTONDOWN ||
01012         pMsg->message == WM_NCLBUTTONDOWN ||
01013         pMsg->message == WM_NCRBUTTONDOWN ||
01014         pMsg->message == WM_NCMBUTTONDOWN)
01015     {
01016         m_idletime = time;
01017         PyInvalUICache();
01018     }
01019
01020     IdleCvsProgress();
01021
01022     return CWinApp::PreTranslateMessage(pMsg);
01023 }
01024
01025 void CWincvsApp::GetAppPath(CStr & path) const
01026 {
01027     path = "";
01028     HINSTANCE hInst = ::AfxGetInstanceHandle();
01029     if(hInst != 0L)
01030     {
01031         char apath[512];
01032         DWORD len = ::GetModuleFileName(hInst, apath, 512);
01033         CStr uppath;
01034         CStr exefile;
01035         if(len > 0 && ::SplitPath(apath, uppath, exefile))
01036         {
01037             path = uppath;
01038         }
01039     }
01040 }
01041
01042 void CWincvsApp::GetAppModule(CStr & module) const
01043 {
01044     module = "";
01045     HINSTANCE hInst = ::AfxGetInstanceHandle();
01046     if(hInst != 0L)
01047     {
01048         char apath[512];
01049         DWORD len = ::GetModuleFileName(hInst, apath, 512);
01050         if(len > 0)
01051         {
01052             module = apath;
01053         }
01054     }
01055 }
01056
01057 void CWincvsApp::LookForResourceFile(const char *what, CStr & path)
01058 {
01059     path = "";
01060     GetAppPath(path);
01061
01062     CString appPath = path;
01063     // first the macro folder may be ./macro
01064     CString test = appPath;
01065     test.TrimRight('\\');
01066     test += "\\";
01067     test += what;
01068
01069     struct stat sb;
01070     if(stat(test, &sb) != -1 && S_ISREG(sb.st_mode))
01071     {
01072         path = test;
01073         return;
01074     }
01075
01076     CStr uppath, file;
01077     while(SplitPath(appPath, uppath, file) && !uppath.empty())
01078     {
01079         test = uppath;
01080         test.TrimRight('\\');
01081         test += "\\";
01082         test += what;
01083
01084         if(stat(test, &sb) != -1 && S_ISREG(sb.st_mode))
01085         {
01086             path = test;
01087             return;
01088         }
01089         appPath = uppath;
01090     }
01091     path = test;
01092 }
01093
01094
01095 void CWincvsApp::OnHelpCvs()
01096 {
01097     CStr hlp;
01098     LookForResourceFile("cvs.hlp", hlp);
01099     ::WinHelp(*AfxGetMainWnd(), hlp, HELP_CONTENTS, 0L);
01100 }
01101
01102 void CWincvsApp::OnHelpCvsclient()
01103 {
01104     CStr hlp;
01105     LookForResourceFile("cvscli.hlp", hlp);
01106     ::WinHelp(*AfxGetMainWnd(), hlp, HELP_CONTENTS, 0L);
01107 }
01108
01109 bool CWincvsApp::GetAppVersion(CStr & vers) const
01110 {
01111     bool bRet=false;
01112     char  szFullPath[_MAX_PATH];
01113     DWORD len = ::GetModuleFileName(AfxGetInstanceHandle(), szFullPath, sizeof(szFullPath));
01114     DWORD dwVerHnd;
01115     DWORD dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
01116     if (dwVerInfoSize && len)
01117     {
01118         // If we were able to get the information, process it:
01119         HANDLE  hMem;
01120         LPVOID  lpvMem;
01121         char    szGetName[256];
01122         int     cchRoot;
01123
01124         hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
01125         lpvMem = GlobalLock(hMem);
01126         GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpvMem);
01127         lstrcpy(szGetName, "\\StringFileInfo\\040904b0\\");
01128         cchRoot = lstrlen(szGetName);
01129
01130         BOOL  fRet;
01131         UINT  cchVer = 0;
01132         LPVOID lszVer = NULL;
01133
01134         lstrcpy(&szGetName[cchRoot], "ProductVersion");
01135         fRet = VerQueryValue(lpvMem, szGetName, &lszVer, &cchVer);
01136
01137         if (fRet && cchVer && lszVer)
01138         {
01139             vers = (char *)lszVer;
01140             bRet = true;
01141         }
01142         GlobalUnlock(hMem);
01143         GlobalFree(hMem);
01144     }
01145     return bRet;
01146 }
01147
01148 BOOL CWincvsApp::SaveAllModified()
01149 {
01150     // prevent from exiting when cvs is running
01151     if(gCvsRunning)
01152     {
01153         gCvsStopping = true;
01154         return TRUE;
01155     }
01156
01157     if(sLogout != 0L)
01158     {
01159         HANDLE hdl = sLogout->m_hThread;
01160         sLogout->KillThread();
01161         WaitForSingleObject(hdl, INFINITE);
01162         //delete sLogout;
01163         sLogout = 0L;
01164     }
01165
01166     // auto-logout
01167     if(gAuthen.kind() == pserver && gCvsPrefs.HasLoogedIn() &&
01168         gCvsPrefs.LogoutTimeOut() > 0)
01169     {
01170         cvs_err("Making automatic logout before quitting:\n");
01171         CvsCmdLogout();
01172         WaitForCvs();
01173     }
01174
01175     return CWinApp::SaveAllModified();
01176 }
01177
01178 char *CWincvsApp::GetEnvMainThread(const char *name)
01179 {
01180     return m_mainFrame->GetEnvMainThread(name);
01181 }
01182
01183 void CWincvsApp::IdleCvsProgress(void)
01184 {
01185     static bool bWasCvsRunning = false; //to restore the idle message once CVS has stoped
01186
01187     if(!gCvsRunning)
01188     {
01189         if( bWasCvsRunning )
01190         {
01191             bWasCvsRunning = false;
01192
01193             CString strIdleString;
01194             strIdleString.LoadString(AFX_IDS_IDLEMESSAGE);
01195
01196             CStatusBar *bar = GetStatusBar();
01197             if(bar != 0L)
01198                 bar->SetWindowText(strIdleString);
01199         }
01200         return;
01201     }
01202
01203     if(gCvsProcess != 0L)
01204     {
01205         if(!cvs_process_is_active(gCvsProcess))
01206         {
01207             gCvsRunning = false;
01208             gCvsStopping = false;
01209             gCvsProcess = 0L;
01210             GetFileView()->CheckChanges();
01211         }
01212     }
01213
01214     bWasCvsRunning = true;
01215
01216     DWORD whatTimeIsIt = ::GetTickCount();
01217     static DWORD lastTime = 0;
01218     // let's make some stuff every second while cvs is idling
01219     if((whatTimeIsIt - lastTime) < 1000)
01220         return;
01221
01222     lastTime = whatTimeIsIt;
01223     char path[_MAX_PATH];
01224     getcwd(path, _MAX_PATH);
01225     CStatusBar *bar = GetStatusBar();
01226     if(bar != 0L)
01227         bar->SetWindowText(path);
01228 }
01229
01230 static inline bool MatchToken(LPCTSTR sLine,LPCTSTR sToken)
01231 {
01232     int n = _tcslen(sToken);
01233     if (0 != _tcsnicmp(sLine,sToken,n)) {
01234         return false;
01235     }
01236     LPCTSTR p = sLine + n;
01237     return ((!*p) || (0 != _tcschr(_T(" \t"),*p)));
01238 }
01239
01240 #ifdef _DEBUG
01241 static inline void DEBUG_MESSAGE(LPCTSTR sMessage)
01242 {
01243     if (::getenv("NOCVSDEBUG")) return;
01244     TCHAR s[256];
01245     ::wsprintf(s,_T("\n[PID %u THREAD %u] CVS_Coworker %s\n"),
01246         (unsigned) GetCurrentProcessId(),
01247         (unsigned) GetCurrentThreadId(),
01248         sMessage
01249         );
01250     ::MessageBox(0,s,_T("DEBUG"),MB_OK);
01251 }
01252 #else
01253 #define DEBUG_MESSAGE(S) 0
01254 #endif
01255
01256 BOOL CWincvsApp::InitATL()
01257 {
01258     m_bATLInited = TRUE;
01259
01260 #if _WIN32_WINNT >= 0x0400
01261     HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
01262 #else
01263     HRESULT hRes = CoInitialize(NULL);
01264 #endif
01265
01266     if (FAILED(hRes))
01267     {
01268         m_bATLInited = FALSE;
01269         return FALSE;
01270     }
01271
01272     _Module.Init(ObjectMap, AfxGetInstanceHandle());
01273     _Module.dwThreadID = GetCurrentThreadId();
01274
01275     LPTSTR lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
01276     TCHAR szTokens[] = _T("-/");
01277
01278     BOOL bRun = TRUE;
01279     LPCTSTR lpszToken = _Module.FindOneOf(lpCmdLine, szTokens);
01280     while (lpszToken != NULL)
01281     {
01282         if (MatchToken(lpszToken,_T("UnregServer"))) {
01283             _Module.UpdateRegistryFromResource(IDR_CVS_COWORKER, FALSE);
01284             _Module.UnregisterServer(TRUE); //TRUE means typelib is unreg'd
01285             bRun = FALSE;
01286             DEBUG_MESSAGE(_T("Now UNREGISTERED"));
01287             break;
01288         }
01289         if (MatchToken(lpszToken,_T("RegServer"))) {
01290             //RegisterLogging();  // specific to CVS_Coworker
01291             _Module.UpdateRegistryFromResource(IDR_CVS_COWORKER, TRUE);
01292             _Module.RegisterServer(TRUE);
01293             bRun = FALSE;
01294             DEBUG_MESSAGE(_T("REGISTERED"));
01295             break;
01296         }
01297         lpszToken = _Module.FindOneOf(lpszToken, szTokens);
01298     }
01299
01300     if (!bRun)
01301     {
01302         m_bATLInited = FALSE;
01303         _Module.Term();
01304         CoUninitialize();
01305         return FALSE;
01306     }
01307
01308     //StartLogging();         // specific to CVS_Coworker
01309     hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,REGCLS_MULTIPLEUSE);
01310     if (FAILED(hRes))
01311     {
01312         m_bATLInited = FALSE;
01313         CoUninitialize();
01314         return FALSE;
01315     }
01316
01317     return TRUE;
01318 }
01319
01320 // retrieve filtering model to use
01321 KiFilterModel* CWincvsApp::GetFilterModel() const
01322 {
01323     return m_mainFrame->GetFilterModel();
01324 }
01325
01326 // retrieve recursion model to use
01327 KiRecursionModel* CWincvsApp::GetRecursionModel() const
01328 {
01329     return m_mainFrame->GetRecursionModel();
01330 }
01331
01332 KiIgnoreModel* CWincvsApp::GetIgnoreModel() const
01333 {
01334     return m_mainFrame->GetIgnoreModel();
01335 }
01336
01337 void CWincvsApp::UpdateAllDocsView()
01338 {
01339     POSITION pos = GetFirstDocTemplatePosition();
01340     while( pos )
01341     {
01342         CDocTemplate* pTemplate = GetNextDocTemplate(pos);
01343         POSITION pos2 = pTemplate->GetFirstDocPosition();
01344         while(pos2)
01345         {
01346             CDocument* pDocument;
01347             if(pDocument = pTemplate->GetNextDoc(pos2))
01348             {
01349                 pDocument->UpdateAllViews(NULL);
01350             }
01351         }
01352     }
01353 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/wincvs.h Source File

WinCvs/wincvs.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // wincvs.h : main header file for the WINCVS application
00022 //
00023
00024 #if !defined(AFX_WINCVS_H__D2D77DC7_8299_11D1_8949_444553540000__INCLUDED_)
00025 #define AFX_WINCVS_H__D2D77DC7_8299_11D1_8949_444553540000__INCLUDED_
00026
00027 #if _MSC_VER >= 1000
00028 #pragma once
00029 #endif // _MSC_VER >= 1000
00030
00031 #ifndef __AFXWIN_H__
00032     #error include 'stdafx.h' before including this file for PCH
00033 #endif
00034
00035 #include "resource.h"       // main symbols
00036 #include "MultiString.h"
00037
00039 // CWincvsApp:
00040 // See wincvs.cpp for the implementation of this class
00041 //
00042
00043 class CWincvsView;
00044 class CWinCvsBrowser;
00045 class CBrowseFileView;
00046 class CStr;
00047 class CMainFrame;
00048 class CStatusBar;
00049 class KiFilterModel;
00050 class KiRecursionModel;
00051 class KiIgnoreModel;
00052
00053 class CWincvsApp : public CWinApp
00054 {
00055 public:
00056     virtual BOOL PreTranslateMessage(MSG* pMsg);
00057     CWincvsApp();
00058
00059     CWincvsView *GetConsoleView(void);
00060         // get the top console
00061
00062     CWinCvsBrowser *GetBrowserView(void);
00063     void ActivateBrowserView(void);
00064         // get the left directory browser
00065
00066     CCJShellTree *GetExplorerView(void);
00067         // get the left directory explorer
00068
00069     CBrowseFileView *GetFileView(void);
00070         // get the right files browser
00071
00072     CDocument *GetDocument(void);
00073         // get the document
00074
00075     CStatusBar *GetStatusBar();
00076         // get the mainframe status bar
00077
00078     CString GetRoot();
00079         // returns currently selected root
00080
00081     inline CMainFrame *GetMainFrame(void) { return m_mainFrame; }
00082         // get the document
00083
00084     bool gCvsRunning;
00085         // the dll is running
00086
00087     bool gCvsStopping;
00088         // the dll is about to stop
00089
00090     int gLastCvsResult;
00091         // last know exit() return value of cvs
00092
00093     CMultiDocTemplate* gLogTempl;
00094     CMultiDocTemplate* gLogGraph;
00095     CMultiDocTemplate* gLogHtml;
00096
00097     void UpdateAllDocsView();
00098         // call UpdateAllViews for all documents
00099
00100     struct _CvsProcess *gCvsProcess;
00101         // the current cvs process
00102
00103     void GetAppPath(CStr & path) const;
00104         // return the application path
00105
00106     void GetAppModule(CStr & module) const;
00107         // return the application module
00108
00109     bool GetAppVersion(CStr & vers) const;
00110         // return false if an error occured
00111
00112     inline DWORD GetIdleTime(void) const { return m_idletime; }
00113     inline void ResetIdleTime(void) { m_idletime = 0; }
00114
00115     // in order to get an idea of where is cvs
00116     void IdleCvsProgress(void);
00117
00118     // retrieve filtering model to use
00119     KiFilterModel* GetFilterModel() const;
00120
00121     // retrieve recursion model to use
00122     KiRecursionModel* GetRecursionModel() const;
00123
00124     // ignore model in use
00125     KiIgnoreModel* GetIgnoreModel() const;
00126
00127     // ask a GetEnv value from the main thread for those
00128     // which require interaction (ex: CVS_GETPASS)
00129     char *GetEnvMainThread(const char *name);
00130
00131 // Overrides
00132     // ClassWizard generated virtual function overrides
00133     //{{AFX_VIRTUAL(CWincvsApp)
00134     public:
00135     virtual BOOL InitInstance();
00136     virtual int ExitInstance();
00137     virtual BOOL SaveAllModified();
00138     //}}AFX_VIRTUAL
00139
00140     bool m_isBackgroundProcess;
00141         // tells if the app is in background
00142
00143 protected:
00144     BOOL InitATL();
00145     void LookForResourceFile(const char *what, CStr & path);
00146
00147     afx_msg void OnFileNew();
00148
00149     DWORD m_idletime;
00150     CMainFrame *m_mainFrame;
00151     BOOL m_bATLInited;
00152
00153 // Implementation
00154     COleTemplateServer m_server;
00155         // Server object for document creation
00156
00157     //{{AFX_MSG(CWincvsApp)
00158     afx_msg void OnAppAbout();
00159     afx_msg void OnAppCopyrights();
00160     afx_msg void OnAppCredits();
00161     afx_msg void OnLogWindowIsPresent(CCmdUI* pCmdUI);
00162     afx_msg void OnHelpCvs();
00163     afx_msg void OnHelpCvsclient();
00164     //}}AFX_MSG
00165     DECLARE_MESSAGE_MAP()
00166 private:
00167     void ShowTipAtStartup(void);
00168 private:
00169     void ShowTipOfTheDay(void);
00170 };
00171
00172
00174
00175 //{{AFX_INSERT_LOCATION}}
00176 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00177
00178 void AFXAPI DDV_MinChars(CDataExchange* pDX, CString const& value, int nChars);
00179 void AFXAPI DDV_CheckCVSROOT(CDataExchange* pDX, CString& strValue);
00180 void AFXAPI DDX_ComboMString(CDataExchange* pDX, int nIDC,
00181                              CMString & mstr, CComboBox & combo);
00182
00183 #endif // !defined(AFX_WINCVS_H__D2D77DC7_8299_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/wincvs_winutil.cpp Source File

WinCvs/wincvs_winutil.cpp

Go to the documentation of this file.
00001
00002 #include "stdafx.h"
00003
00004 #include "wincvs_winutil.h"
00005 #include "MultiString.h"
00006 #include "wincvs.h"
00007 #include "MainFrm.h"
00008 #include "CustomizeMenus.h"
00009 #include "CvsPrefs.h"
00010 #include "TextBinary.h"
00011
00012
00014 // helper functions declaration
00015
00016 CWnd* FindNextSiblingWindow(CWnd* pWnd, BOOL CheckTabStop);
00017 CWnd* FindNextChildWindow(CWnd* pWnd, BOOL CheckTabStop);
00018 CWnd* GetNextParentWindow(CWnd* pWnd);
00019
00020 CWnd* FindPrevSiblingWindow(CWnd* pWnd, BOOL CheckTabStop);
00021 CWnd* GetPrevParentWindow(CWnd* pWnd);
00022 CWnd* GetEndOfDecendantWindow(CWnd* pWnd);
00023
00025 // inline function(s)
00026
00027 inline BOOL IsTargetWindow(CWnd* pWnd, BOOL CheckTabStop)
00028 {
00029     return ((!CheckTabStop) || (WS_TABSTOP & pWnd->GetStyle()));
00030 }
00031
00033 // implementation
00034
00035 CWnd* FindNextWindow(CWnd* pWnd, BOOL CheckTabStop)
00036 {
00037     ASSERT_VALID(pWnd);
00038     if (pWnd)
00039     {
00040         CWnd* pNextWnd;
00041         pNextWnd = FindNextChildWindow(pWnd, CheckTabStop);
00042         if (pNextWnd)
00043             return pNextWnd;
00044
00045         pNextWnd = FindNextSiblingWindow(pWnd, CheckTabStop);
00046         if (pNextWnd)
00047             return pNextWnd;
00048
00049         CWnd* pParentWnd = GetNextParentWindow(pWnd);
00050         while ((pParentWnd) && (pNextWnd != pWnd))
00051         {
00052             pNextWnd = FindNextChildWindow(pParentWnd, CheckTabStop);
00053             if (pNextWnd)
00054                 return pNextWnd;
00055             pParentWnd = GetNextParentWindow(pParentWnd);
00056         }
00057     }
00058     return pWnd;
00059 }
00060
00061 CWnd* GetNextParentWindow(CWnd* pWnd)
00062 {
00063     if (pWnd)
00064     {
00065         if (pWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd)))
00066             return pWnd->GetTopWindow();
00067
00068         CFrameWnd* pFrameWnd = pWnd->GetParentFrame();
00069         ASSERT_VALID(pFrameWnd);
00070         CWnd* pParentWnd = pWnd->GetParent();
00071         ASSERT_VALID(pParentWnd);
00072
00073         CWnd* pCrntWnd;
00074         BOOL bFound = FALSE;
00075         while ((!bFound) && (pParentWnd != pFrameWnd))
00076         {
00077             pCrntWnd = pParentWnd->GetNextWindow();
00078             if (pCrntWnd)
00079                 bFound = TRUE;
00080             else
00081                 pParentWnd = pParentWnd->GetParent();
00082         }
00083         return (bFound) ? pCrntWnd : pParentWnd->GetTopWindow();
00084     }
00085     return NULL;
00086 }
00087
00088 CWnd* FindNextSiblingWindow(CWnd* pWnd, BOOL CheckTabStop)
00089 {
00090     if (pWnd)
00091     {
00092         CWnd* pSiblingWnd = pWnd->GetNextWindow();
00093         while (pSiblingWnd)
00094         {
00095             if (IsTargetWindow(pSiblingWnd, CheckTabStop))
00096                 return pSiblingWnd;
00097             CWnd* pChildWnd = FindNextChildWindow(pSiblingWnd, CheckTabStop);
00098             if (pChildWnd)
00099                 return pChildWnd;
00100             pSiblingWnd = pSiblingWnd->GetNextWindow();
00101         }
00102     }
00103     return NULL;
00104 }
00105
00106 CWnd* FindNextChildWindow(CWnd* pWnd, BOOL CheckTabStop)
00107 {
00108     if (pWnd)
00109     {
00110         CWnd* pChildWnd = pWnd->GetTopWindow();
00111         while (pChildWnd)
00112         {
00113             if (IsTargetWindow(pChildWnd, CheckTabStop))
00114                 return pChildWnd;
00115             CWnd* pSiblingWnd = FindNextSiblingWindow(pChildWnd, CheckTabStop);
00116             if (pSiblingWnd)
00117                 return pSiblingWnd;
00118             pChildWnd = pChildWnd->GetTopWindow();
00119         }
00120     }
00121     return NULL;
00122 }
00123
00124 CWnd* FindPrevWindow(CWnd* pWnd, BOOL CheckTabStop)
00125 {
00126     ASSERT_VALID(pWnd);
00127     if (pWnd)
00128     {
00129         CWnd* pWndCrntLevel = pWnd;
00130         while (TRUE)
00131         {
00132             CWnd* pFoundWnd;
00133             pFoundWnd = FindPrevSiblingWindow(pWndCrntLevel, CheckTabStop);
00134             if (pFoundWnd)
00135                 return pFoundWnd;
00136             pWndCrntLevel = GetPrevParentWindow(pWndCrntLevel);
00137             if (!pWndCrntLevel)
00138             {
00139                 pFoundWnd = GetEndOfDecendantWindow(pWnd->GetParentFrame());
00140                 if (IsTargetWindow(pFoundWnd, CheckTabStop))
00141                     return pFoundWnd;
00142                 pWndCrntLevel = pFoundWnd;
00143             }
00144         }
00145     }
00146     return NULL;
00147 }
00148
00149 CWnd* GetPrevParentWindow(CWnd* pWnd)
00150 {
00151     if (pWnd)
00152     {
00153         if (!pWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd)))
00154         {
00155             CWnd* pParentWnd = pWnd->GetParent();
00156             ASSERT_VALID(pParentWnd);
00157             return pParentWnd;
00158         }
00159     }
00160     return NULL;
00161 }
00162
00163 CWnd* FindPrevSiblingWindow(CWnd* pWnd, BOOL CheckTabStop)
00164 {
00165     if (pWnd)
00166     {
00167         CWnd* pSiblingWnd = pWnd->GetWindow(GW_HWNDPREV);
00168         while (pSiblingWnd)
00169         {
00170             if (IsTargetWindow(pSiblingWnd, CheckTabStop))
00171                 return pSiblingWnd;
00172             pSiblingWnd = pSiblingWnd->GetWindow(GW_HWNDPREV);
00173         }
00174     }
00175     return NULL;
00176 }
00177
00178 CWnd* GetEndOfDecendantWindow(CWnd* pWnd)
00179 {
00180     CWnd* pTmpWnd = pWnd;
00181     CWnd* pPreTmpWnd;
00182     while (pTmpWnd)
00183     {
00184         pPreTmpWnd = pTmpWnd;
00185         pTmpWnd = pTmpWnd->GetWindow(GW_CHILD);
00186         if (pTmpWnd)
00187         {
00188             pPreTmpWnd = pTmpWnd;
00189             pTmpWnd = pTmpWnd->GetWindow(GW_HWNDLAST);
00190         }
00191     }
00192     return pPreTmpWnd;
00193 }
00194
00195 static void updateUIMenu(CMenu *pMyMenu, CView* pThis)
00196 {
00197     CCmdUI state;
00198     state.m_pMenu = pMyMenu;
00199
00200     state.m_nIndexMax = pMyMenu->GetMenuItemCount();
00201     for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
00202       state.m_nIndex++)
00203     {
00204         state.m_nID = pMyMenu->GetMenuItemID(state.m_nIndex);
00205         if (state.m_nID == 0)
00206             continue; // menu separator or invalid cmd - ignore it
00207
00208         ASSERT(state.m_pOther == NULL);
00209         ASSERT(state.m_pMenu != NULL);
00210         if (state.m_nID == (UINT)-1)
00211         {
00212             // possibly a popup menu, route to first item of that popup
00213             state.m_pSubMenu = pMyMenu->GetSubMenu(state.m_nIndex);
00214             if (state.m_pSubMenu == NULL ||
00215                 (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
00216                 state.m_nID == (UINT)-1)
00217             {
00218                 continue;       // first item of popup can't be routed to
00219             }
00220             state.DoUpdate(pThis, FALSE);    // popups are never auto disabled
00221         }
00222         else
00223         {
00224             // normal menu item
00225             // Auto enable/disable if frame window has 'm_bAutoMenuEnable'
00226             //    set and command is _not_ a system command.
00227             state.m_pSubMenu = NULL;
00228             state.DoUpdate(pThis, TRUE);
00229         }
00230
00231 #   if 0 /* ??? */
00232         // adjust for menu deletions and additions
00233         UINT nCount = pMyMenu->GetMenuItemCount();
00234         if (nCount < state.m_nIndexMax)
00235         {
00236             state.m_nIndex -= (state.m_nIndexMax - nCount);
00237             while (state.m_nIndex < nCount &&
00238                 pMyMenu->GetMenuItemID(state.m_nIndex) == state.m_nID)
00239             {
00240                 state.m_nIndex++;
00241             }
00242         }
00243         state.m_nIndexMax = nCount;
00244 #   endif
00245     }
00246 }
00247
00248 CMenu* GetSubCMenu(int nStartId, CView* pThis)
00249 {
00250     CMenu* pTopMenu = AfxGetMainWnd()->GetMenu();
00251     ASSERT(pTopMenu != 0L);
00252     if(pTopMenu == 0L)
00253         return NULL;
00254
00255     CMenu* pMyMenu=NULL;
00256     int iPos;
00257     for (iPos = pTopMenu->GetMenuItemCount()-1; iPos >= 0; iPos--)
00258     {
00259         CMenu* pMenu = pTopMenu->GetSubMenu(iPos);
00260         if (pMenu && pMenu->GetMenuItemID(0) == nStartId)
00261         {
00262             pMyMenu = pMenu;
00263             break;
00264         }
00265     }
00266     ASSERT(pMyMenu != 0L);
00267     if(pMyMenu == 0L)
00268         return NULL;
00269
00270     updateUIMenu(pMyMenu, pThis);
00271
00272     return pMyMenu;
00273 }
00274
00275 CMenu* _GetMenuEntryRecurs(CMenu *menu, int nStartId, int & pos)
00276 {
00277     if(menu == 0L)
00278         return 0l;
00279
00280     int iPos;
00281     for (iPos = 0; iPos < menu->GetMenuItemCount(); iPos++)
00282     {
00283         UINT id = menu->GetMenuItemID(iPos);
00284         if(id == nStartId)
00285         {
00286             pos = iPos;
00287             return menu;
00288         }
00289
00290         if(id == (UINT)-1)
00291         {
00292             CMenu *res = _GetMenuEntryRecurs(menu->GetSubMenu(iPos), nStartId, pos);
00293             if(res != 0L)
00294                 return res;
00295         }
00296     }
00297
00298     return 0L;
00299 }
00300
00301 CMenu* GetMenuEntry(int nStartId, int & pos)
00302 {
00303     CMenu* pTopMenu = AfxGetMainWnd()->GetMenu();
00304     ASSERT(pTopMenu != 0L);
00305
00306     return _GetMenuEntryRecurs(pTopMenu, nStartId, pos);
00307 }
00308
00309 CMMenuString::CMMenuString(unsigned int maxstr, const char *uniqueName, char * const *defaultStr) :
00310     CPersistent(uniqueName, kNoClass), fMaxStr(maxstr)
00311 {
00312     if(defaultStr != 0L)
00313     {
00314         int i = 0;
00315         while(defaultStr[i] != 0L)
00316         {
00317             Insert(defaultStr[i++]);
00318         }
00319     }
00320 }
00321
00322 CMMenuString::~CMMenuString()
00323 {
00324 }
00325
00326 unsigned int CMMenuString::SizeOf(void) const
00327 {
00328     NAMESPACE(std) vector<UStr>::const_iterator i;
00329     unsigned int thesize = sizeof(int);
00330
00331     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00332     {
00333         thesize += (*i).length() + 1;
00334     }
00335     return thesize;
00336 }
00337
00338 const void *CMMenuString::GetData(void) const
00339 {
00340     unsigned int thesize = SizeOf(), tmpsize;
00341     ((CMMenuString *)this)->fBuf.AdjustSize(thesize);
00342     char *tmp = ((CMMenuString *)this)->fBuf;
00343     *(int *)tmp = fAllStrs.size();
00344     tmp += sizeof(int) / sizeof(char);
00345
00346     NAMESPACE(std) vector<UStr>::const_iterator i;
00347     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00348     {
00349         tmpsize = (*i).length() + 1;
00350         memcpy(tmp, (const char *)(*i), tmpsize * sizeof(char));
00351         tmp += tmpsize;
00352     }
00353
00354     return (char *)fBuf;
00355 }
00356
00357 void CMMenuString::SetData(const void *ptr, unsigned int size)
00358 {
00359     const char *tmp = (char *)ptr;
00360     unsigned int thesize;
00361     fAllStrs.erase(fAllStrs.begin(), fAllStrs.end());
00362     thesize = *(int *)tmp;
00363     tmp += sizeof(int) / sizeof(char);
00364     for(unsigned int i = 0; i < thesize && i < fMaxStr; i++)
00365     {
00366         fAllStrs.push_back(UStr(tmp));
00367         tmp += strlen(tmp) + 1;
00368     }
00369 }
00370
00371 void CMMenuString::Insert(const char *newstr)
00372 {
00373     TouchTimeStamp();
00374     fAllStrs.push_back(UStr(newstr));
00375 }
00376
00377 char *sDefBrowserMenu[] =
00378 {
00379     "ID_VIEW_UPDATE",
00380     "ID_VIEW_COMMIT",
00381     "ID_SEPARATOR",
00382     "ID_VIEW_EXPLORE",
00383     "ID_VIEW_QUERYUPDATE",
00384     "ID_VIEW_RELOAD",
00385     "ID_SEPARATOR",
00386     "ID_VIEW_IMPORT",
00387     "ID_VIEW_CHECKOUT",
00388     0L
00389 };
00390
00391 char *sDefFilesMenu[] =
00392 {
00393     "ID_VIEW_UPDATE",
00394     "ID_VIEW_COMMIT",
00395     "ID_SEPARATOR",
00396     "ID_VIEW_EXPLORE",
00397     "ID_VIEW_QUERYUPDATE",
00398     "ID_VIEW_RELOAD",
00399     "ID_SEPARATOR",
00400     "ID_VIEW_EDITSEL",
00401     "ID_VIEW_EDITSELDEF",
00402     "ID_SEPARATOR",
00403     "ID_VIEW_DIFF",
00404     "ID_VIEW_LOG",
00405     "ID_VIEW_STATUS",
00406     "ID_VIEW_GRAPH",
00407     "ID_QUERY_ANNOTATE",
00408     0L
00409 };
00410
00411 static CMMenuString gFilesMenu(99, "P_FilesMenu", sDefFilesMenu);
00412 static CMMenuString gBrowserMenu(99, "P_BrowserMenu", sDefBrowserMenu);
00413
00414 CMenu* GetCustomMenu(int whichmenu, CView* pThis)
00415 {
00416     CMMenuString *multiMenu;
00417
00418     switch(whichmenu)
00419     {
00420     case kCustomBrowserMenu:
00421         multiMenu = &gBrowserMenu;
00422         break;
00423     case kCustomFilesMenu:
00424         multiMenu = &gFilesMenu;
00425         break;
00426     default:
00427         ASSERT(0);
00428         return 0L;
00429     }
00430
00431     CMenu *res = new CMenu;
00432     VERIFY(res->CreatePopupMenu());
00433
00434     std::vector<UStr> & list = multiMenu->GetList();
00435     std::vector<UStr>::iterator i;
00436
00437     for(i = list.begin(); i != list.end(); ++i)
00438     {
00439         const CustInvertTable *tab = CustGetByKey(*i);
00440         if(tab == 0L)
00441         {
00442             TRACE1("Hum... was '%s' an old command ? Removing it...",
00443                 (const char *)*i);
00444             list.erase(i);
00445             i = list.begin();
00446         }
00447     }
00448
00449     for(i = list.begin(); i != list.end(); ++i)
00450     {
00451         const CustInvertTable *tab = CustGetByKey(*i);
00452
00453         if(tab->cmd == ID_SEPARATOR)
00454         {
00455             res->AppendMenu(MF_SEPARATOR);
00456         }
00457         else
00458         {
00459             CString str = tab->title;
00460             FormatMenuString(tab->cmd, str);
00461             res->AppendMenu(MF_STRING, tab->cmd, str);
00462         }
00463     }
00464
00465     res->AppendMenu(MF_SEPARATOR);
00466     res->AppendMenu(MF_STRING, whichmenu == kCustomFilesMenu ?
00467         ID_CUST_FILES_MENU : ID_CUST_FOLDER_MENU,
00468         CString("Customize this menu..."));
00469
00470     updateUIMenu(res, pThis);
00471
00472     return res;
00473 }
00474
00475 void CustomizeMenus(int whichmenu)
00476 {
00477     CMMenuString *multiMenu;
00478
00479     switch(whichmenu)
00480     {
00481     case kCustomBrowserMenu:
00482         multiMenu = &gBrowserMenu;
00483         break;
00484     case kCustomFilesMenu:
00485         multiMenu = &gFilesMenu;
00486         break;
00487     default:
00488         ASSERT(0);
00489         return;
00490     }
00491
00492     CCustomizeMenus custom(multiMenu);
00493     if(custom.DoModal() == IDOK)
00494     {
00495         gCvsPrefs.save();
00496     }
00497 }
00498
00499 bool FormatMenuString(int cmd, CString& str)
00500 {
00501     bool res = false;
00502
00503     switch(cmd)
00504     {
00505     case ID_VIEW_EDITSELDEF:
00506         {
00507             CString viever("default viewer");
00508             if( gCvsPrefs.Viewer() != 0L )
00509             {
00510                 CStr uppath, folder;
00511                 SplitPath(gCvsPrefs.Viewer(), uppath, folder);
00512
00513                 viever = folder.empty() ? (uppath.empty() ? gCvsPrefs.Viewer() : uppath) : folder;
00514                 if( viever.Find(" ") > -1 )
00515                 {
00516                     viever = "\"" + viever + "\"";
00517                 }
00518             }
00519             str = "View &with " + viever;
00520
00521         }
00522         res = TRUE;
00523         break;
00524
00525     default:
00526         break;
00527     }
00528
00529     return res;
00530 }
00531
00533 // CWndRedrawManager class
00534
00536 CWndRedrawMngr::CWndRedrawMngr(CWnd* pWnd, BOOL bRedraw /*= FALSE*/)
00537 {
00538     ASSERT(pWnd != NULL);
00539     m_pWnd = pWnd;
00540
00541     if( m_pWnd )
00542     {
00543         m_pWnd->SetRedraw(bRedraw);
00544     }
00545 }
00546
00548 CWndRedrawMngr::~CWndRedrawMngr()
00549 {
00550     if( m_pWnd )
00551     {
00552         m_pWnd->SetRedraw(TRUE);
00553     }
00554 }
00555
00557 void CWndRedrawMngr::SetRedraw(BOOL bRedraw)
00558 {
00559     if( m_pWnd )
00560     {
00561         m_pWnd->SetRedraw(bRedraw);
00562     }
00563 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/wincvs_winutil.h Source File

WinCvs/wincvs_winutil.h

Go to the documentation of this file.
00001 #ifndef WINCVS_WINUTIL_H
00002 #define WINCVS_WINUTIL_H
00003
00004 CWnd* FindNextWindow(CWnd* pWnd, BOOL CheckTabStop = TRUE);
00005 CWnd* FindPrevWindow(CWnd* pWnd, BOOL CheckTabStop = TRUE);
00006
00007 CMenu* GetSubCMenu(int nStartId, CView* pThis);
00008     // return the menu which has the cmd nStartId
00009
00010 CMenu* GetMenuEntry(int nStartId, int & pos);
00011     // return the menu and position of a cmd
00012
00013 enum
00014 {
00015     kCustomBrowserMenu,
00016     kCustomFilesMenu
00017 };
00018
00019 CMenu* GetCustomMenu(int whichmenu, CView* pThis);
00020     // return the custom menu
00021
00022 void CustomizeMenus(int whichmenu);
00023     // ask to customize the menus
00024
00025 bool FormatMenuString(int cmd, CString& str);
00026     // get the string for the command
00027     // return TRUE if string found for the command (str contains the resulting string)
00028
00030 class CWndRedrawMngr
00031 {
00032 private:
00033     CWnd* m_pWnd;
00034 public:
00035     CWndRedrawMngr(CWnd* pWnd, BOOL bRedraw = FALSE);
00036     virtual ~CWndRedrawMngr();
00037
00038     void SetRedraw(BOOL bRedraw);
00039 };
00040
00041 #endif  /*WINCVS_WINUTIL_H*/
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/WinCvsBrowser.cpp Source File

WinCvs/WinCvsBrowser.cpp

Go to the documentation of this file.
00001 // WinCvsBrowser.cpp : implementation file
00002 //
00003
00004 #include "stdafx.h"
00005 #include "wincvs.h"
00006 #include "MainFrm.h"
00007 #include "WinCvsBrowser.h"
00008 #include "FileTraversal.h"
00009 #include "AppConsole.h"
00010 #include "CvsPrefs.h"
00011 #include "CvsCommands.h"
00012 #include "BrowseFileView.h"
00013 #include "TclGlue.h"
00014 #include "MacrosSetup.h"
00015 #include "wincvs_winutil.h"
00016 #include "PythonGlue.h"
00017
00018 #include "umain.h"
00019
00020 #ifdef WIN32
00021 #   include "resource.h"
00022 #endif /* WIN32 */
00023
00024 #ifdef _DEBUG
00025 #define new DEBUG_NEW
00026 #undef THIS_FILE
00027 static char THIS_FILE[] = __FILE__;
00028 #endif
00029
00030 static const int WM_RESETVIEW = WM_APP + 12;
00031
00032 enum
00033 {
00034     kIconFolderClosed,
00035     kIconFolderOpened,
00036     kIconFolderCVSClosed,
00037     kIconFolderCVSOpened,
00038     kIconFolderIgnoreClosed,
00039     kIconFolderIgnoreOpened,
00040     kIconFolderIgnoreLost
00041 };
00042
00044 // CWinCvsBrowser
00045
00046 IMPLEMENT_DYNCREATE(CWinCvsBrowser, CTreeView)
00047
00048 BEGIN_MESSAGE_MAP(CWinCvsBrowser, CTreeView)
00049     //{{AFX_MSG_MAP(CWinCvsBrowser)
00050     ON_NOTIFY_REFLECT(TVN_ITEMEXPANDING, OnItemexpanding)
00051     ON_WM_RBUTTONDOWN()
00052     ON_NOTIFY_REFLECT(TVN_SELCHANGING, OnSelchanging)
00053     ON_UPDATE_COMMAND_UI(ID_VIEW_ADD, OnUpdateViewAdd)
00054     ON_UPDATE_COMMAND_UI(ID_VIEW_COMMIT, OnUpdateViewUpdate)
00055     ON_COMMAND(ID_VIEW_ADD, OnViewAdd)
00056     ON_COMMAND(ID_VIEW_COMMIT, OnViewCommit)
00057     ON_COMMAND(ID_VIEW_UPDATE, OnViewUpdate)
00058     ON_COMMAND(ID_VIEW_QUERYUPDATE, OnViewQueryUpdate)
00059     ON_COMMAND(ID_VIEW_DIFF, OnViewDiff)
00060     ON_COMMAND(ID_VIEW_LOG, OnViewLog)
00061     ON_COMMAND(ID_VIEW_STATUS, OnViewStatus)
00062     ON_COMMAND(ID_VIEW_LOCKF, OnViewLock)
00063     ON_COMMAND(ID_VIEW_UNLOCKF, OnViewUnlock)
00064     ON_COMMAND(ID_VIEW_WATCHON, OnViewWatchOn)
00065     ON_COMMAND(ID_VIEW_WATCHOFF, OnViewWatchOff)
00066     ON_COMMAND(ID_VIEW_EDIT, OnViewEdit)
00067     ON_COMMAND(ID_VIEW_UNEDIT, OnViewUnedit)
00068     ON_COMMAND(ID_VIEW_WATCHERS, OnViewWatchers)
00069     ON_COMMAND(ID_VIEW_EDITORS, OnViewEditors)
00070     ON_COMMAND(ID_VIEW_RELEASE, OnViewRelease)
00071     ON_COMMAND(ID_VIEW_TAGNEW, OnViewTagNew)
00072     ON_COMMAND(ID_VIEW_TAGDELETE, OnViewTagDelete)
00073     ON_COMMAND(ID_VIEW_TAGBRANCH, OnViewTagBranch)
00074     ON_COMMAND(ID_VIEW_EXPLORE, OnViewExplore)
00075     ON_UPDATE_COMMAND_UI(ID_VIEW_EXPLORE, OnUpdateViewExplore)
00076     ON_UPDATE_COMMAND_UI(ID_VIEW_RELOAD, OnUpdateViewReload)
00077     ON_COMMAND(ID_VIEW_RELOAD, OnViewReload)
00078     ON_COMMAND(ID_VIEW_CHECKOUT, OnViewCheckout)
00079     ON_UPDATE_COMMAND_UI(ID_VIEW_CHECKOUT, OnUpdateViewCheckout)
00080     ON_COMMAND(ID_VIEW_IMPORT, OnViewImport)
00081     ON_UPDATE_COMMAND_UI(ID_VIEW_IMPORT, OnUpdateViewImport)
00082     ON_WM_SETCURSOR()
00083     ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
00084     ON_WM_DESTROY()
00085     ON_UPDATE_COMMAND_UI(ID_VIEW_DIFF, OnUpdateViewUpdate)
00086     ON_UPDATE_COMMAND_UI(ID_VIEW_EDIT, OnUpdateViewUpdate)
00087     ON_UPDATE_COMMAND_UI(ID_VIEW_EDITORS, OnUpdateViewUpdate)
00088     ON_UPDATE_COMMAND_UI(ID_VIEW_LOCKF, OnUpdateViewUpdate)
00089     ON_UPDATE_COMMAND_UI(ID_VIEW_LOG, OnUpdateViewUpdate)
00090     ON_UPDATE_COMMAND_UI(ID_VIEW_RELEASE, OnUpdateViewUpdate)
00091     ON_UPDATE_COMMAND_UI(ID_VIEW_STATUS, OnUpdateViewUpdate)
00092     ON_UPDATE_COMMAND_UI(ID_VIEW_UNEDIT, OnUpdateViewUpdate)
00093     ON_UPDATE_COMMAND_UI(ID_VIEW_UPDATE, OnUpdateViewUpdate)
00094     ON_UPDATE_COMMAND_UI(ID_VIEW_QUERYUPDATE, OnUpdateViewUpdate)
00095     ON_UPDATE_COMMAND_UI(ID_VIEW_UNLOCKF, OnUpdateViewUpdate)
00096     ON_UPDATE_COMMAND_UI(ID_VIEW_WATCHERS, OnUpdateViewUpdate)
00097     ON_UPDATE_COMMAND_UI(ID_VIEW_WATCHON, OnUpdateViewUpdate)
00098     ON_UPDATE_COMMAND_UI(ID_VIEW_WATCHOFF, OnUpdateViewUpdate)
00099     ON_UPDATE_COMMAND_UI(ID_VIEW_TAGNEW, OnUpdateViewUpdate)
00100     ON_UPDATE_COMMAND_UI(ID_VIEW_TAGDELETE, OnUpdateViewUpdate)
00101     ON_UPDATE_COMMAND_UI(ID_VIEW_TAGBRANCH, OnUpdateViewUpdate)
00102     //}}AFX_MSG_MAP
00103     ON_UPDATE_COMMAND_UI_RANGE(ID_MACRO_START, ID_MACRO_END, OnUpdateMacro)
00104     ON_COMMAND_EX_RANGE(ID_MACRO_START, ID_MACRO_END, OnMacro)
00105     ON_UPDATE_COMMAND_UI_RANGE(ID_CUST_FILES_MENU, ID_CUST_FOLDER_MENU, OnUpdateCustomize)
00106     ON_COMMAND_EX_RANGE(ID_CUST_FILES_MENU, ID_CUST_FOLDER_MENU, OnCustomize)
00107     ON_MESSAGE(WM_RESETVIEW, OnResetView)
00108 END_MESSAGE_MAP()
00109
00110 CImageList CWinCvsBrowser::m_Imagelist;
00111
00112 static const char *gDummyFile = "@@@dummy file@@@";
00113
00114 CWinCvsBrowser::CWinCvsBrowser()
00115 : m_isSelectionNotificationLocked(false)
00116 , m_isSelectionChanged(false)
00117 , m_isResetViewPending(false)
00118 {
00119 }
00120
00121 CWinCvsBrowser::~CWinCvsBrowser()
00122 { }
00123
00125 // CWinCvsBrowser drawing
00126
00127 void CWinCvsBrowser::OnDraw(CDC* pDC)
00128 {
00129     // TODO: add draw code here
00130 }
00131
00133 // CWinCvsBrowser diagnostics
00134
00135 #ifdef _DEBUG
00136 void CWinCvsBrowser::AssertValid() const
00137 {
00138     CTreeView::AssertValid();
00139 }
00140
00141 void CWinCvsBrowser::Dump(CDumpContext& dc) const
00142 {
00143     CTreeView::Dump(dc);
00144 }
00145 #endif //_DEBUG
00146
00148 // CWinCvsBrowser message handlers
00149
00150 BOOL CWinCvsBrowser::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
00151 {
00152     if (!CTreeView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext))
00153     {
00154         return FALSE;
00155     }
00156
00157     if(m_Imagelist.m_hImageList == 0L)
00158         m_Imagelist.Create(16, 16, ILC_MASK, 1, 1);
00159     m_Imagelist.SetBkColor(GetSysColor(COLOR_WINDOW));
00160
00161     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00162     HICON hIcon = app->LoadIcon(IDI_FOLDER);
00163     m_Imagelist.Add(hIcon);
00164     hIcon = app->LoadIcon(IDI_FOLDERO);
00165     m_Imagelist.Add(hIcon);
00166     hIcon = app->LoadIcon(IDI_FOLDERCVS);
00167     m_Imagelist.Add(hIcon);
00168     hIcon = app->LoadIcon(IDI_FOLDEROCVS);
00169     m_Imagelist.Add(hIcon);
00170     hIcon = app->LoadIcon(IDI_FOLDERIGN);
00171     m_Imagelist.Add(hIcon);
00172     hIcon = app->LoadIcon(IDI_FOLDEROIGN);
00173     m_Imagelist.Add(hIcon);
00174     hIcon = app->LoadIcon(IDI_FOLDERLOST);
00175     m_Imagelist.Add(hIcon);
00176
00177     CTreeCtrl& treeCtrl = GetTreeCtrl();
00178     treeCtrl.SetImageList(&m_Imagelist, TVSIL_NORMAL);
00179
00180     // set the initial root
00181     CMainFrame* mainFrm = app->GetMainFrame();
00182     CHistComboBoxEx& hist = mainFrm->GetBrowseHistory();
00183     CStr newpath((const char *)hist.GetOldLoc());
00184     ResetBrowser(newpath, true);
00185
00186     SetNewStyle(TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT, TRUE);
00187
00188     return TRUE;
00189 }
00190
00191 void CWinCvsBrowser::DeleteAllItems(HTREEITEM root)
00192 {
00193     // we don't want the file view to be notified when things get deleted
00194     // process selection after we are done with all that jazz below
00195     CSelectionChangeNotifier notifier(this, true);
00196
00197     CTreeCtrl& treeCtrl = GetTreeCtrl();
00198     bool eraseRoot = false;
00199     if(root == 0L)
00200     {
00201         root = treeCtrl.GetRootItem( );
00202         eraseRoot = true;
00203     }
00204     if(root == 0L)
00205         return;
00206
00207     HTREEITEM childItem = treeCtrl.GetNextItem(root, TVGN_CHILD);
00208
00209     // erase all the childs
00210     while(childItem != 0L)
00211     {
00212         EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(childItem);
00213         if(data != 0L) {
00214             treeCtrl.SetItemData(childItem,0L); //So that subsequent references after UnRef() won't SEGV
00215             data->UnRef();  //Or move this one after DeleteAllItems? so we don't loose one system call. For now, safe way
00216         }
00217
00218         DeleteAllItems(childItem);
00219
00220         HTREEITEM nextItem = treeCtrl.GetNextItem(childItem, TVGN_NEXT);
00221         VERIFY(treeCtrl.DeleteItem(childItem));
00222         childItem = nextItem;
00223     }
00224
00225     // erase the root only if initially root was 0L
00226     if(eraseRoot)
00227     {
00228         EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(root);
00229         ASSERT(data == 0L);
00230
00231         VERIFY(treeCtrl.DeleteItem(root));
00232     }
00233 }
00234
00235 static void SetIcon(CTreeCtrl& treeCtrl, HTREEITEM item,
00236                     bool hasCvsInfos, bool expand, EntnodeData *data = 0L)
00237 {
00238     TV_ITEM pItem;
00239     pItem.hItem = item;
00240     pItem.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
00241     VERIFY(treeCtrl.GetItem(&pItem));
00242
00243     int newImage;
00244     if(data == 0L)
00245     {
00246         if(expand)
00247             newImage = hasCvsInfos ? kIconFolderCVSOpened : kIconFolderOpened;
00248         else
00249             newImage = hasCvsInfos ? kIconFolderCVSClosed : kIconFolderClosed;
00250     }
00251     else
00252     {
00253         if(expand)
00254         {
00255             if(data->IsIgnored())
00256                 newImage = kIconFolderIgnoreOpened;
00257             else if(data->IsUnknown())
00258                 newImage = kIconFolderOpened;
00259             else
00260                 newImage = kIconFolderCVSOpened;
00261         }
00262         else
00263         {
00264             if(data->IsIgnored())
00265                 newImage = kIconFolderIgnoreClosed;
00266             else if(data->IsUnknown())
00267                 newImage = kIconFolderClosed;
00268             else
00269                 newImage = kIconFolderCVSClosed;
00270         }
00271     }
00272
00273     if(pItem.iImage != newImage)
00274     {
00275         pItem.iImage = newImage;
00276         pItem.iSelectedImage = newImage;
00277         pItem.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
00278         treeCtrl.SetItem(&pItem);
00279     }
00280 }
00281
00282 // regarding a path and a root item, create an
00283 // item with a dummy item inside if and only if
00284 // the folder is not empty.
00285 class TBrowserFillDummy : public TraversalReport
00286 {
00287 public:
00288     HTREEITEM   m_root;
00289     HTREEITEM   m_item;
00290     CTreeCtrl & m_treeCtrl;
00291     bool        m_empty;
00292     bool        m_hascvs;
00293     EntnodeData *m_data;
00294
00295     TBrowserFillDummy(CTreeCtrl & treeCtrl, HTREEITEM root, HTREEITEM item, EntnodeData *data) :
00296         m_root(root), m_item(item), m_treeCtrl(treeCtrl), m_empty(true),
00297         m_data(data), m_hascvs(false) {}
00298
00299     virtual kTraversal EnterDirectory(const char *fullpath, const char *dirname, const FSSpec * macspec)
00300     {
00301         if(m_item == 0L)
00302         {
00303             TV_INSERTSTRUCT tvstruct;
00304             tvstruct.hParent = m_root;
00305             tvstruct.hInsertAfter = TVI_SORT;
00306             tvstruct.item.iImage = kIconFolderClosed;
00307             tvstruct.item.iSelectedImage = kIconFolderClosed;
00308             tvstruct.item.pszText = (char *)dirname;
00309             tvstruct.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT;
00310             m_item = m_treeCtrl.InsertItem(&tvstruct);
00311         }
00312
00313         // assign the entries to this item
00314         if(m_data != 0L)
00315         {
00316             EntnodeData *data = (EntnodeData *)m_treeCtrl.GetItemData(m_item);
00317
00318             if(m_data != 0L)
00319                 m_data->Ref();
00320             m_treeCtrl.SetItemData(m_item, (long)m_data);
00321
00322             if(data != 0L)
00323                 data->UnRef();
00324         }
00325         else
00326             m_data = (EntnodeData *)m_treeCtrl.GetItemData(m_item);
00327
00328         return kContinueTraversal;
00329     }
00330
00331     virtual kTraversal ExitDirectory(const char *fullpath)
00332     {
00333         SetIcon(m_treeCtrl, m_item, m_hascvs, false, m_data);
00334
00335         if(m_empty)
00336             return kContinueTraversal;
00337
00338         // add a dummy item to simulate the folder
00339         // is not empty. This dummy item will be
00340         // replaced by a complete listing when the
00341         // node is expanding...
00342         TV_INSERTSTRUCT tvstruct;
00343         tvstruct.hParent = m_item;
00344         tvstruct.hInsertAfter = TVI_SORT;
00345         tvstruct.item.pszText = (char *)gDummyFile;
00346         tvstruct.item.mask = TVIF_TEXT;
00347         m_treeCtrl.InsertItem(&tvstruct);
00348
00349         return kContinueTraversal;
00350     }
00351
00352     virtual kTraversal OnError(const char *err, int errcode)
00353     {
00354         return kTraversalError;
00355     }
00356
00357     virtual kTraversal OnIdle(const char *fullpath)
00358     {
00359         return kContinueTraversal;
00360     }
00361
00362     virtual kTraversal OnDirectory(const char *fullpath,
00363         const char *fullname,
00364         const char *name,
00365         const struct stat & dir, const FSSpec * macspec)
00366     {
00367         if(stricmp(name, "cvs") == 0)
00368             m_hascvs = true;
00369         else
00370             m_empty = false;
00371         return kSkipFile;
00372     }
00373 };
00374
00375 // regarding a path and a root item, create an
00376 // item with all the subdirectories inside.
00377 class TBrowserFill : public TraversalReport
00378 {
00379 public:
00380     HTREEITEM m_root;
00381     HTREEITEM m_item;
00382     CTreeCtrl & m_treeCtrl;
00383     CSortList<ENTNODE> & m_entries;
00384     vector<CStr> m_ignlist;
00385     bool m_isShowIgnored;
00386
00387     TBrowserFill(CTreeCtrl & treeCtrl, HTREEITEM root, HTREEITEM item, CSortList<ENTNODE> & entries) :
00388             m_root(root), m_item(item), m_treeCtrl(treeCtrl),
00389             m_entries(entries), m_isShowIgnored(false)
00390     {
00391         if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
00392         {
00393             m_isShowIgnored = app->GetIgnoreModel()->IsShowIgnored();
00394         }
00395     }
00396
00397     virtual kTraversal EnterDirectory(const char *fullpath, const char *dirname, const FSSpec * macspec)
00398     {
00399         ASSERT(m_item != 0L);
00400
00401         Entries_Open (m_entries, fullpath);
00402         BuildIgnoredList(m_ignlist, fullpath);
00403
00404         return kContinueTraversal;
00405     }
00406
00407     virtual kTraversal ExitDirectory(const char *fullpath)
00408     {
00409         m_ignlist.erase(m_ignlist.begin(), m_ignlist.end());
00410         SetIcon(m_treeCtrl, m_item, true /*ignored*/, true,
00411             (EntnodeData *)m_treeCtrl.GetItemData(m_item));
00412         return kContinueTraversal;
00413     }
00414
00415     virtual kTraversal OnError(const char *err, int errcode)
00416     {
00417         return kTraversalError;
00418     }
00419
00420     virtual kTraversal OnIdle(const char *fullpath)
00421     {
00422         return kContinueTraversal;
00423     }
00424
00425     virtual kTraversal OnDirectory(const char *fullpath,
00426         const char *fullname,
00427         const char *name,
00428         const struct stat & dir, const FSSpec * macspec)
00429     {
00430         if(stricmp(name, "cvs") == 0)
00431             return kSkipFile;
00432
00433         // is the sub-directory ignored ?
00434         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00435         if(!m_isShowIgnored && data->IsIgnored())
00436             return kSkipFile;
00437
00438         // create the item for the sub-directory
00439         TBrowserFillDummy traverse(m_treeCtrl, m_item, 0L, data);
00440         kTraversal res = FileTraverse(fullname, traverse);
00441
00442         // assign the icon regarding our Entries info
00443         if(traverse.m_item != 0L)
00444         {
00445             SetIcon(m_treeCtrl, traverse.m_item, true /*ignored*/, false, data);
00446         }
00447
00448         return kSkipFile;
00449     }
00450
00451 };
00452
00453 void CWinCvsBrowser::ResetBrowser(const char *path, bool notifyView)
00454 {
00455     CWaitCursor doWait;
00456
00457     // Must make a copy of 'path' before calling DeleteAllItems(), since
00458     // this function may have been called with 'm_root' passed as the first
00459     // parameter (in fact it is in several places in the code) whose value
00460     // gets deleted by the call to DeleteAllItems() below, making 'path'
00461     // point to an invalid memory location
00462     CStr pathCopy(path);
00463     DeleteAllItems();
00464     bool isReload = !pathCopy.empty() && !m_root.empty() && stricmp(m_root, pathCopy) == 0;
00465
00466     m_root = pathCopy;
00467
00468     if(pathCopy.empty())
00469         return;
00470
00471     if(!isReload)
00472     {
00473         if(HasPersistentSettings(m_root))
00474             LoadPersistentSettings(m_root);
00475         else
00476         {
00477             // check if the path has a CVS folder. If not,
00478             // we don't want the user to be prompted (like when
00479             // WinCvs is starting for the first time).
00480             UStr cvsFolder(m_root);
00481             if(!cvsFolder.endsWith(kPathDelimiter))
00482                 cvsFolder << kPathDelimiter;
00483             cvsFolder << "CVS";
00484             struct stat sb;
00485             if (stat(cvsFolder, &sb) != -1 && S_ISDIR(sb.st_mode))
00486                 AskCreatePersistentSettings(m_root);
00487         }
00488     }
00489
00490     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00491     CMainFrame* mainFrm = app->GetMainFrame();
00492     CHistComboBoxEx& hist = mainFrm->GetBrowseHistory();
00493     hist.NewRoot(m_root);
00494
00495     CTreeCtrl& treeCtrl = GetTreeCtrl();
00496     TBrowserFillDummy traverse(treeCtrl, 0L, 0L, 0L);
00497     kTraversal res = FileTraverse(m_root, traverse);
00498
00499     CBrowseFileView *fileView = app->GetFileView();
00500     if(fileView != 0L)
00501     {
00502         HTREEITEM root = treeCtrl.GetRootItem( );
00503         if(root != 0L)
00504         {
00505             treeCtrl.Expand(root, TVE_EXPAND);
00506             if(notifyView)
00507             {
00508                 VERIFY(treeCtrl.Select(root, TVGN_CARET));
00509             }
00510         }
00511     }
00512 }
00513
00514 void CWinCvsBrowser::SetNewStyle(long lStyleMask, BOOL bSetBits)
00515 {
00516     long        lStyleOld;
00517
00518     lStyleOld = GetWindowLong(m_hWnd, GWL_STYLE);
00519     lStyleOld &= ~lStyleMask;
00520     if (bSetBits)
00521         lStyleOld |= lStyleMask;
00522
00523     SetWindowLong(m_hWnd, GWL_STYLE, lStyleOld);
00524     SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
00525 }
00526
00527 void CWinCvsBrowser::RetrievePath(HTREEITEM item, CStr & path)
00528 {
00529     CTreeCtrl& treeCtrl = GetTreeCtrl();
00530     CStr tmp, newPath;
00531     path = "";
00532     TV_ITEM pItem;
00533     char name[512];
00534     do
00535     {
00536         pItem.hItem = item;
00537         pItem.pszText = name;
00538         pItem.cchTextMax = 512;
00539         pItem.mask = TVIF_HANDLE | TVIF_TEXT;
00540
00541         VERIFY(treeCtrl.GetItem(&pItem));
00542         item = treeCtrl.GetParentItem(item);
00543
00544         tmp = path;
00545         newPath = item == 0L ? (const char *)m_root : pItem.pszText;
00546         if(!newPath.endsWith(kPathDelimiter))
00547             newPath << kPathDelimiter;
00548         newPath << path;
00549         path = newPath;
00550     } while(item != 0L);
00551 }
00552
00553 void CWinCvsBrowser::OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult)
00554 {
00555     // prevent from changing directory if cvs is running
00556     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00557     if(app->gCvsRunning)
00558     {
00559         *pResult = TRUE;
00560         return;
00561     }
00562
00563     CTreeCtrl& treeCtrl = GetTreeCtrl();
00564     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00565
00566     HTREEITEM item = pNMTreeView->itemNew.hItem;
00567
00568     EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(item);
00569     if(data != 0L && data->IsMissing())
00570     {
00571         *pResult = TRUE;
00572         return;
00573     }
00574
00575     // erase all the childs
00576     DeleteAllItems(item);
00577
00578     CStr path;
00579     RetrievePath(item, path);
00580
00581     if(pNMTreeView->action & TVE_COLLAPSE)
00582     {
00583         TBrowserFillDummy traverse(treeCtrl, 0L, item, 0L);
00584         kTraversal res = FileTraverse(path, traverse);
00585     }
00586     else if(pNMTreeView->action & TVE_EXPAND)
00587     {
00588         CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00589         TBrowserFill traverse(treeCtrl, 0L, item, entries);
00590         kTraversal res = FileTraverse(path, traverse);
00591
00592         // add the missing folders
00593         Entries_SetMissing(entries);
00594         int numEntries = entries.NumOfElements();
00595         for(int i = 0; i < numEntries; i++)
00596         {
00597             const ENTNODE & theNode = entries.Get(i);
00598             EntnodeData *data = theNode.Data();
00599             if(!data->IsMissing() || data->GetType() != ENT_SUBDIR)
00600                 continue;
00601
00602             TV_INSERTSTRUCT tvstruct;
00603             tvstruct.hParent = item;
00604             tvstruct.hInsertAfter = TVI_SORT;
00605             tvstruct.item.iImage = kIconFolderIgnoreLost;
00606             tvstruct.item.iSelectedImage = kIconFolderIgnoreLost;
00607             tvstruct.item.pszText = (char *)(*data)[EntnodeData::kName];
00608             tvstruct.item.lParam = (long)data->Ref();
00609             tvstruct.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT | TVIF_PARAM;
00610             treeCtrl.InsertItem(&tvstruct);
00611
00612         }
00613     }
00614
00615     *pResult = 0;
00616 }
00617
00618 void CWinCvsBrowser::OnUpdateCmd(CCmdUI* pCmdUI, BOOL needCvsInfos)
00619 {
00620     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00621     if(DisableCommon())
00622     {
00623         pCmdUI->Enable(FALSE);
00624         return;
00625     }
00626     CTreeCtrl& treeCtrl = GetTreeCtrl();
00627     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00628     if(selItem == 0L)
00629     {
00630         pCmdUI->Enable(FALSE);
00631         return;
00632     }
00633
00634     CStr path;
00635     RetrievePath(selItem, path);
00636     if(!path.endsWith(kPathDelimiter))
00637         path << kPathDelimiter;
00638     path << "CVS";
00639
00640     struct stat sb;
00641     if (stat(path, &sb) == -1 || !S_ISDIR(sb.st_mode))
00642         pCmdUI->Enable(!needCvsInfos);
00643     else
00644         pCmdUI->Enable(needCvsInfos);
00645 }
00646
00647 void CWinCvsBrowser::OnRButtonDown(UINT nFlags, CPoint point)
00648 {
00649     // prevent from changing directory if cvs is running
00650     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00651     if(app->gCvsRunning)
00652         return;
00653
00654     // prompt a menu when hitting a selection
00655     // with the right button...
00656     CTreeCtrl& treeCtrl = GetTreeCtrl();
00657     UINT pFlags;
00658     HTREEITEM testItem = treeCtrl.HitTest(point, &pFlags);
00659     if(testItem != 0L && (pFlags & (TVHT_ONITEM|TVHT_ONITEMBUTTON)) != 0)
00660     {
00661         treeCtrl.SelectItem(testItem);
00662         // Locate the submenu AFTER item selection
00663         CMenu* pMyMenu=::GetCustomMenu(kCustomBrowserMenu,this);
00664         if (pMyMenu)
00665         {
00666             ClientToScreen(&point);
00667             pMyMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x, point.y, this);
00668             delete pMyMenu;
00669             return;
00670         }
00671     }
00672     CTreeView::OnRButtonDown(nFlags, point);    //L->R
00673 }
00674
00675 void CWinCvsBrowser::OnSelchanging(NMHDR* pNMHDR, LRESULT* pResult)
00676 {
00677     // prevent from changing directory if cvs is running
00678     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00679     if(app->gCvsRunning)
00680     {
00681         *pResult = TRUE;
00682         return;
00683     }
00684
00685     CTreeCtrl& treeCtrl = GetTreeCtrl();
00686     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00687     HTREEITEM item = pNMTreeView->itemNew.hItem;
00688
00689     EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(item);
00690     if(data != 0L && data->IsMissing())
00691     {
00692         *pResult = TRUE;
00693         return;
00694     }
00695
00696     *pResult = 0;
00697 }
00698
00699 void CWinCvsBrowser::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
00700 {
00701     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00702     m_isSelectionChanged = true;
00703     NotifySelectionChange();
00704
00705     *pResult = 0;
00706 }
00707
00708 void CWinCvsBrowser::NotifySelectionChange()
00709 {
00710     if(!m_isSelectionNotificationLocked)
00711     {
00712         if (m_isSelectionChanged)
00713         {
00714             CStr path;
00715             HTREEITEM item = GetTreeCtrl().GetSelectedItem();
00716             if (item)
00717             {
00718                 RetrievePath(item, path);
00719                 CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00720                 CBrowseFileView *fileView = app->GetFileView();
00721                 if (fileView)
00722                 {
00723                     fileView->ResetView(path);
00724                 }
00725                 gCvsPrefs.SetLastWorkingDir(path);
00726             }
00727         }
00728     }
00729 }
00730
00731 void CWinCvsBrowser::OnUpdateViewAdd(CCmdUI* pCmdUI)
00732 {
00733     OnUpdateCmd(pCmdUI, FALSE);
00734 }
00735
00736 void CWinCvsBrowser::OnUpdateViewUpdate(CCmdUI* pCmdUI)
00737 {
00738     OnUpdateCmd(pCmdUI, TRUE);
00739 }
00740
00741 void CWinCvsBrowser::OnViewAdd()
00742 {
00743     CTreeCtrl& treeCtrl = GetTreeCtrl();
00744     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00745
00746     CStr path;
00747     RetrievePath(selItem, path);
00748     CvsCmdAddFolder(path);
00749 }
00750
00751 void CWinCvsBrowser::OnViewCommit()
00752 {
00753     CTreeCtrl& treeCtrl = GetTreeCtrl();
00754     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00755
00756     CStr path;
00757     RetrievePath(selItem, path);
00758     CvsCmdCommitFolder(path);
00759 }
00760
00761 void CWinCvsBrowser::OnViewUpdate()
00762 {
00763     CTreeCtrl& treeCtrl = GetTreeCtrl();
00764     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00765
00766     CStr path;
00767     RetrievePath(selItem, path);
00768     CvsCmdUpdateFolder(path);
00769 }
00770
00771 void CWinCvsBrowser::OnViewQueryUpdate()
00772 {
00773     CTreeCtrl& treeCtrl = GetTreeCtrl();
00774     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00775
00776     CStr path;
00777     RetrievePath(selItem, path);
00778     CvsCmdUpdateFolder(path, true);
00779 }
00780
00781 void CWinCvsBrowser::OnViewDiff()
00782 {
00783     CTreeCtrl& treeCtrl = GetTreeCtrl();
00784     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00785
00786     CStr path;
00787     RetrievePath(selItem, path);
00788     CvsCmdDiffFolder(path);
00789 }
00790
00791 void CWinCvsBrowser::OnViewLog()
00792 {
00793     CTreeCtrl& treeCtrl = GetTreeCtrl();
00794     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00795
00796     CStr path;
00797     RetrievePath(selItem, path);
00798     CvsCmdLogFolder(path);
00799 }
00800
00801 void CWinCvsBrowser::OnViewStatus()
00802 {
00803     CTreeCtrl& treeCtrl = GetTreeCtrl();
00804     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00805
00806     CStr path;
00807     RetrievePath(selItem, path);
00808     CvsCmdStatusFolder(path);
00809 }
00810
00811 void CWinCvsBrowser::OnViewLock()
00812 {
00813     CTreeCtrl& treeCtrl = GetTreeCtrl();
00814     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00815
00816     CStr path;
00817     RetrievePath(selItem, path);
00818     CvsCmdLockFolder(path);
00819 }
00820
00821 void CWinCvsBrowser::OnViewUnlock()
00822 {
00823     CTreeCtrl& treeCtrl = GetTreeCtrl();
00824     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00825
00826     CStr path;
00827     RetrievePath(selItem, path);
00828     CvsCmdUnlockFolder(path);
00829 }
00830
00831 void CWinCvsBrowser::OnViewWatchOn()
00832 {
00833     CTreeCtrl& treeCtrl = GetTreeCtrl();
00834     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00835
00836     CStr path;
00837     RetrievePath(selItem, path);
00838     CvsCmdWatchOnFolder(path);
00839 }
00840
00841 void CWinCvsBrowser::OnViewWatchOff()
00842 {
00843     CTreeCtrl& treeCtrl = GetTreeCtrl();
00844     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00845
00846     CStr path;
00847     RetrievePath(selItem, path);
00848     CvsCmdWatchOffFolder(path);
00849 }
00850
00851 void CWinCvsBrowser::OnViewEdit()
00852 {
00853     CTreeCtrl& treeCtrl = GetTreeCtrl();
00854     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00855
00856     CStr path;
00857     RetrievePath(selItem, path);
00858     CvsCmdEditFolder(path);
00859 }
00860
00861 void CWinCvsBrowser::OnViewUnedit()
00862 {
00863     CTreeCtrl& treeCtrl = GetTreeCtrl();
00864     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00865
00866     CStr path;
00867     RetrievePath(selItem, path);
00868     CvsCmdUneditFolder(path);
00869 }
00870
00871 void CWinCvsBrowser::OnViewWatchers()
00872 {
00873     CTreeCtrl& treeCtrl = GetTreeCtrl();
00874     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00875
00876     CStr path;
00877     RetrievePath(selItem, path);
00878     CvsCmdWatchersFolder(path);
00879 }
00880
00881 void CWinCvsBrowser::OnViewEditors()
00882 {
00883     CTreeCtrl& treeCtrl = GetTreeCtrl();
00884     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00885
00886     CStr path;
00887     RetrievePath(selItem, path);
00888     CvsCmdEditorsFolder(path);
00889 }
00890
00891 void CWinCvsBrowser::OnViewRelease()
00892 {
00893     CTreeCtrl& treeCtrl = GetTreeCtrl();
00894     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00895
00896     CStr path;
00897     RetrievePath(selItem, path);
00898     CvsCmdReleaseFolder(path);
00899 }
00900
00901 void CWinCvsBrowser::OnViewTagNew()
00902 {
00903     CTreeCtrl& treeCtrl = GetTreeCtrl();
00904     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00905
00906     CStr path;
00907     RetrievePath(selItem, path);
00908     CvsCmdTagCreateFolder(path);
00909 }
00910
00911 void CWinCvsBrowser::OnViewTagDelete()
00912 {
00913     CTreeCtrl& treeCtrl = GetTreeCtrl();
00914     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00915
00916     CStr path;
00917     RetrievePath(selItem, path);
00918     CvsCmdTagDeleteFolder(path);
00919 }
00920
00921 void CWinCvsBrowser::OnViewTagBranch()
00922 {
00923     CTreeCtrl& treeCtrl = GetTreeCtrl();
00924     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00925
00926     CStr path;
00927     RetrievePath(selItem, path);
00928     CvsCmdTagBranchFolder(path);
00929 }
00930
00931 static void onIgnoreChanged(CObject *obj)
00932 {
00933     ((CWinCvsBrowser *)obj)->OnIgnoreChanged();
00934 }
00935
00936 void CWinCvsBrowser::OnInitialUpdate()
00937 {
00938     CTreeView::OnInitialUpdate();
00939
00940     CTreeCtrl& treeCtrl = GetTreeCtrl();
00941     HTREEITEM root = treeCtrl.GetRootItem( );
00942     if(root != 0L)
00943     {
00944         treeCtrl.Expand(root, TVE_EXPAND);
00945         VERIFY(treeCtrl.Select(root, TVGN_CARET));
00946     }
00947
00948     if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
00949     {
00950         app->GetIgnoreModel()->GetNotificationManager()->CheckIn(this, onIgnoreChanged);
00951     }
00952 }
00953
00954 void CWinCvsBrowser::OnViewExplore()
00955 {
00956     CTreeCtrl& treeCtrl = GetTreeCtrl();
00957     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00958
00959     CStr path;
00960     RetrievePath(selItem, path);
00961     HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), "explore", path,
00962             0L, 0L, SW_SHOWDEFAULT);
00963     if((long)hInst < 32)
00964     {
00965         cvs_err("Unable to explore '%s' (error %d)\n", (char *)path, GetLastError());
00966     }
00967 }
00968
00969 void CWinCvsBrowser::OnUpdateViewExplore(CCmdUI* pCmdUI)
00970 {
00971     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00972     if(DisableCommon())
00973     {
00974         pCmdUI->Enable(FALSE);
00975         return;
00976     }
00977     CTreeCtrl& treeCtrl = GetTreeCtrl();
00978     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00979     if(selItem == 0L)
00980     {
00981         pCmdUI->Enable(FALSE);
00982         return;
00983     }
00984     pCmdUI->Enable(TRUE);
00985 }
00986
00987 bool CWinCvsBrowser::StepToLocation(const char *path, bool notifyView)
00988 {
00989     bool bRes = false;  //return
00990
00991     CStr root(m_root);
00992     if(!root.endsWith(kPathDelimiter))
00993         root << kPathDelimiter;
00994     CStr subpath(path);
00995     if(!subpath.endsWith(kPathDelimiter))
00996         subpath << kPathDelimiter;
00997
00998     // check if it is a sub-path
00999
01000     //JK - for windows case insensitive seems better
01001     if(strnicmp(root, subpath, root.length()) != 0)
01002         return false;
01003
01004     CTreeCtrl& treeCtrl = GetTreeCtrl();
01005     HTREEITEM item = treeCtrl.GetRootItem();
01006     HTREEITEM lastitem = 0L;
01007     if(item == 0L)
01008         return false;
01009
01010     if (stricmp(root, subpath) == 0)
01011     {
01012         // must select root node
01013         lastitem = item;
01014         treeCtrl.Expand(item, TVE_EXPAND);
01015     }
01016     else
01017     {
01018         // step inside synchronized
01019         const char *tmp = (const char *)subpath + root.length() - 1;
01020         while((tmp = strchr(tmp, kPathDelimiter)) != 0L)
01021         {
01022             const char *name = ++tmp;
01023             if(name[0] == '\0')
01024                 break;
01025
01026             CStr subname;
01027             const char *tmp2 = strchr(name, kPathDelimiter);
01028             if(tmp2 == 0L)
01029                 subname = name;
01030             else
01031                 subname.set(name, tmp2 - name);
01032
01033             HTREEITEM childItem = treeCtrl.GetNextItem(item, TVGN_CHILD);
01034
01035             // find the subitem which matches this name
01036             while(childItem != 0L)
01037             {
01038                 EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(childItem);
01039                 if(data != 0L)
01040                 {
01041                     if(_stricmp((*data)[EntnodeData::kName], subname) == 0)
01042                     {
01043                         // found it !
01044                         lastitem = item = childItem;
01045                         treeCtrl.Expand(item, TVE_EXPAND);
01046                         break;
01047                     }
01048                 }
01049
01050                 childItem = treeCtrl.GetNextItem(childItem, TVGN_NEXT);
01051             }
01052         }
01053     }
01054
01055     // in case this is called by the view, turn off notifying
01056     // when the item gets selected
01057     // JK - {!= 0} is for: Compiler Warning (level 3) C4800
01058     if(lastitem != 0L)
01059     {
01060         CSelectionChangeNotifier notifier(this, notifyView);
01061         VERIFY( bRes = (treeCtrl.Select(lastitem, TVGN_CARET) != 0) );
01062     }
01063
01064     return bRes;
01065 }
01066
01067 HTREEITEM CWinCvsBrowser::GetItemByLocation(const char *path)
01068 {
01069     CStr root(m_root);
01070     if(!root.endsWith(kPathDelimiter))
01071         root << kPathDelimiter;
01072     CStr subpath(path);
01073     if(!subpath.endsWith(kPathDelimiter))
01074         subpath << kPathDelimiter;
01075
01076     // check if it is a sub-path
01077     if(strncmp(root, subpath, root.length()) != 0)
01078         return 0L;
01079
01080     CTreeCtrl& treeCtrl = GetTreeCtrl();
01081     HTREEITEM item = treeCtrl.GetRootItem();
01082     if(item == 0L)
01083         return 0L;
01084
01085     // step inside synchronized
01086     const char *tmp = (const char *)subpath + root.length() - 1;
01087     while((tmp = strchr(tmp, kPathDelimiter)) != 0L)
01088     {
01089         const char *name = ++tmp;
01090         if(name[0] == '\0')
01091             break;
01092
01093         CStr subname;
01094         const char *tmp2 = strchr(name, kPathDelimiter);
01095         if(tmp2 == 0L)
01096             subname = name;
01097         else
01098             subname.set(name, tmp2 - name);
01099
01100         HTREEITEM childItem = treeCtrl.GetNextItem(item, TVGN_CHILD);
01101
01102         // find the subitem which matches this name
01103         while(childItem != 0L)
01104         {
01105             EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(childItem);
01106             if(data != 0L)
01107             {
01108                 if(_stricmp((*data)[EntnodeData::kName], subname) == 0)
01109                 {
01110                     item = childItem;
01111                     break;
01112                 }
01113             }
01114
01115             childItem = treeCtrl.GetNextItem(childItem, TVGN_NEXT);
01116         }
01117         if(childItem == 0L)
01118             return 0L;
01119     }
01120
01121     return item;
01122 }
01123
01124 void CWinCvsBrowser::StoreExpanded(std::vector<CStr> & allExpanded, HTREEITEM root)
01125 {
01126     HTREEITEM item = root;
01127     CTreeCtrl& treeCtrl = GetTreeCtrl();
01128     if(item == 0L)
01129         item = treeCtrl.GetRootItem();
01130     if(item == 0L)
01131         return;
01132
01133     TV_ITEM pItem;
01134     pItem.hItem = item;
01135     pItem.mask = TVIF_STATE;
01136     VERIFY(treeCtrl.GetItem(&pItem));
01137
01138     if(pItem.state & TVIS_EXPANDED)
01139     {
01140         CStr path;
01141         RetrievePath(item, path);
01142         allExpanded.push_back(path);
01143     }
01144
01145     HTREEITEM childItem = treeCtrl.GetNextItem(item, TVGN_CHILD);
01146
01147     while(childItem != 0L)
01148     {
01149         StoreExpanded(allExpanded, childItem);
01150         childItem = treeCtrl.GetNextItem(childItem, TVGN_NEXT);
01151     }
01152 }
01153
01154 void CWinCvsBrowser::ResetView(bool forceReload, bool notifyView)
01155 {
01156     // no outstanding request to reset the view any more
01157     m_isResetViewPending = false;
01158
01159     CWaitCursor doWait;
01160     CWndRedrawMngr redrawMngr(this);
01161
01162     bool contentChanged = false;
01163     vector<CStr> allExpanded;
01164     StoreExpanded(allExpanded);
01165     CTreeCtrl& treeCtrl = GetTreeCtrl();
01166     CStr selPath;
01167     HTREEITEM selItem = treeCtrl.GetSelectedItem();
01168     if(selItem != 0L)
01169         RetrievePath(selItem, selPath);
01170
01171     if(forceReload)
01172     {
01173         ResetBrowser(m_root);
01174         contentChanged = true;
01175     }
01176
01177     if(contentChanged)
01178     {
01179         // restore the expanded paths and the selected item
01180         vector<CStr>::const_iterator i;
01181         for(i = allExpanded.begin(); i != allExpanded.end(); ++i)
01182         {
01183             StepToLocation(*i);
01184         }
01185         if(!selPath.empty())
01186         {
01187             selItem = GetItemByLocation(selPath);
01188             if(selItem != 0L)
01189             {
01190                 VERIFY(treeCtrl.Select(selItem, TVGN_CARET));
01191                 treeCtrl.EnsureVisible(selItem);
01192             }
01193         }
01194     }
01195
01196     // we don't need to notify the file view if we force the reload
01197     // because that's already done
01198     if(notifyView)
01199     {
01200         CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01201         app->GetFileView()->ResetView();
01202     }
01203 }
01204
01205 void CWinCvsBrowser::OnUpdateViewReload(CCmdUI* pCmdUI)
01206 {
01207     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01208     pCmdUI->Enable(!app->gCvsRunning);
01209 }
01210
01211 void CWinCvsBrowser::OnViewReload()
01212 {
01213     ResetView(true, true);
01214 }
01215
01216 BOOL CWinCvsBrowser::OnMacro(UINT nID)
01217 {
01218     PyDoPython(WINCMD_to_UCMD(nID));
01219
01220     return 1;
01221 }
01222
01223 void CWinCvsBrowser::OnUpdateMacro(CCmdUI* pCmdUI)
01224 {
01225     if(DisableCommon())
01226     {
01227         pCmdUI->Enable(FALSE);
01228         return;
01229     }
01230
01231     // fill the cache with current selection
01232     if(!PyIsUICacheValid())
01233     {
01234         CTreeCtrl& treeCtrl = GetTreeCtrl();
01235         HTREEITEM selItem = treeCtrl.GetSelectedItem();
01236         if(selItem != 0L)
01237         {
01238             CStr selPath;
01239             RetrievePath(selItem, selPath);
01240             CStr uppath, folder;
01241             SplitPath(selPath, uppath, folder);
01242
01243             bool deleteData = false;
01244             EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(selItem);
01245             if(data == 0L)
01246             {
01247                 deleteData = true;
01248                 EntnodePath *thePath = new EntnodePath(uppath);
01249                 data = new EntnodeFolder(folder, thePath);
01250                 thePath->UnRef();
01251             }
01252
01253             PyAppendCache(data);
01254
01255             if(deleteData)
01256                 data->UnRef();
01257         }
01258     }
01259
01260     UCmdUI ucmdui(WINCMD_to_UCMD(pCmdUI->m_nID));
01261     ucmdui.pCmdUI = pCmdUI;
01262     PyDoCmdUI(&ucmdui);
01263 }
01264
01265 BOOL CWinCvsBrowser::PreCreateWindow(CREATESTRUCT& cs)
01266 {
01267     cs.style |= WS_TABSTOP | TVS_SHOWSELALWAYS;
01268
01269     return CTreeView::PreCreateWindow(cs);
01270 }
01271
01272 bool CWinCvsBrowser::DisableCommon()
01273 {
01274     CWincvsApp *app = (CWincvsApp *)AfxGetApp();
01275     return app->gCvsRunning || gCvsPrefs.empty();
01276 }
01277
01278
01279 void CWinCvsBrowser::OnViewCheckout()
01280 {
01281     CvsCmdCheckoutModule();
01282 }
01283
01284 void CWinCvsBrowser::OnUpdateViewCheckout(CCmdUI* pCmdUI)
01285 {
01286     if(DisableCommon())
01287     {
01288         pCmdUI->Enable(FALSE);
01289         return;
01290     }
01291     pCmdUI->Enable(TRUE);
01292     pCmdUI->SetText("Chec&kout module...");
01293 }
01294
01295 void CWinCvsBrowser::OnViewImport()
01296 {
01297     CvsCmdImportModule();
01298 }
01299
01300 void CWinCvsBrowser::OnUpdateViewImport(CCmdUI* pCmdUI)
01301 {
01302     if(DisableCommon())
01303     {
01304         pCmdUI->Enable(FALSE);
01305         return;
01306     }
01307     pCmdUI->Enable(TRUE);
01308     pCmdUI->SetText("&Import module...");
01309 }
01310
01311 BOOL CWinCvsBrowser::OnCustomize(UINT nID)
01312 {
01313     CustomizeMenus(nID == ID_CUST_FILES_MENU ? kCustomFilesMenu : kCustomBrowserMenu);
01314     return TRUE;
01315 }
01316
01317 void CWinCvsBrowser::OnUpdateCustomize(CCmdUI* pCmdUI)
01318 {
01319     pCmdUI->Enable(TRUE);
01320 }
01321
01322 BOOL CWinCvsBrowser::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
01323 {
01324     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01325     if(app->gCvsRunning)
01326     {
01327         SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
01328         return TRUE;
01329     }
01330
01331     return CTreeView::OnSetCursor(pWnd, nHitTest, message);
01332 }
01333
01334 void CWinCvsBrowser::OnDestroy()
01335 {
01336     if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
01337     {
01338         app->GetIgnoreModel()->GetNotificationManager()->CheckOut(this);
01339     }
01340
01341     CTreeView::OnDestroy();
01342 }
01343
01344 void CWinCvsBrowser::OnIgnoreChanged()
01345 {
01346     if (!m_isResetViewPending)
01347     {
01348         m_isResetViewPending = true;
01349         PostMessage(WM_RESETVIEW);
01350     }
01351 }
01352
01353 LRESULT CWinCvsBrowser::OnResetView(WPARAM, LPARAM)
01354 {
01355     ResetView(true, false);
01356     return 0;
01357 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/WinCvsBrowser.h Source File

WinCvs/WinCvsBrowser.h

Go to the documentation of this file.
00001 #if !defined(AFX_WINCVSBROWSER_H__144A4971_CAB4_11D1_BC80_000000000000__INCLUDED_)
00002 #define AFX_WINCVSBROWSER_H__144A4971_CAB4_11D1_BC80_000000000000__INCLUDED_
00003
00004 #if _MSC_VER >= 1000
00005 #pragma once
00006 #endif // _MSC_VER >= 1000
00007 // WinCvsBrowser.h : header file
00008 //
00009
00010 #include <afxcview.h>
00011 #include "CPStr.h"
00012
00014 // CWinCvsBrowser view
00015
00016 class CWinCvsBrowser : public CTreeView
00017 {
00018 // associated classes
00019 public:
00020     // ensures selection notification is properly issued
00021     class CSelectionChangeNotifier
00022     {
00023     // Attributes
00024     protected:
00025         bool m_notify;
00026         // if true, the object will issue proper selection notification when going out of scope
00027
00028         bool m_wasLocked;
00029         // tells if the view was already locked at the time of initialization
00030
00031         CWinCvsBrowser* m_view;
00032         // the view to change the state
00033
00034     // Construction
00035     public:
00036         // constructor can be configured either to issue notification or discard it
00037         CSelectionChangeNotifier(CWinCvsBrowser* view, bool notify)
00038         : m_notify(notify)
00039         , m_view(view)
00040         , m_wasLocked(view->m_isSelectionNotificationLocked)
00041         {
00042             if (!m_wasLocked)
00043             {
00044                 m_view->m_isSelectionChanged = false;
00045                 m_view->m_isSelectionNotificationLocked = true;
00046             }
00047         }
00048
00049         ~CSelectionChangeNotifier()
00050         {
00051             m_view->m_isSelectionNotificationLocked = m_wasLocked;
00052             if (!m_wasLocked)
00053             {
00054                 if (m_notify)
00055                 {
00056                     m_view->NotifySelectionChange();
00057                 }
00058                 m_view->m_isSelectionChanged = false;
00059             }
00060         }
00061     };
00062     friend CSelectionChangeNotifier;
00063
00064 protected:
00065     CWinCvsBrowser();           // protected constructor used by dynamic creation
00066     DECLARE_DYNCREATE(CWinCvsBrowser)
00067
00068 // Attributes
00069 protected:
00070
00071     bool m_isSelectionNotificationLocked;
00072     // tells if propagating selection changes is currently locked out
00073
00074     bool m_isSelectionChanged;
00075     // flag to tell if selection indeed changed since was set to true
00076     // valid if m_isSelectionNotificationLocked is true
00077
00078     bool m_isResetViewPending;
00079     // tells if request to rebuild the view is pending
00080
00081 // Operations
00082 public:
00083
00084     void NotifySelectionChange();
00085     // isues notification on selected item change
00086
00087
00088     void SetNewStyle(long lStyleMask, BOOL bSetBits);
00089
00090     void DeleteAllItems(HTREEITEM root = 0L);
00091         // used when resetting and take care about our item data
00092         // if root != 0L : delete all childs of root (except root)
00093         // if root == 0L : delete all
00094
00095     void ResetBrowser(const char *path, bool notifyView = false);
00096         // set the browser root path.
00097
00098     void RetrievePath(HTREEITEM item, CStr & path);
00099         // given an item of the tree, guess the full path.
00100
00101     bool StepToLocation(const char *path, bool notifyView = false);
00102         // expand and select the path and optionally synchronize the
00103         // file view.
00104         // return true if success, false if error
00105
00106     void ResetView(bool forceReload = false, bool notifyView = false);
00107         // force reload or check modifications before redrawing
00108         // and optionally synchronize the file view.
00109
00110     inline const char *GetRoot(void) const { return m_root; }
00111
00112     void OnIgnoreChanged();
00113
00114 // Overrides
00115     // ClassWizard generated virtual function overrides
00116     //{{AFX_VIRTUAL(CWinCvsBrowser)
00117     public:
00118     virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
00119     virtual void OnInitialUpdate();
00120     protected:
00121     virtual void OnDraw(CDC* pDC);      // overridden to draw this view
00122     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00123     //}}AFX_VIRTUAL
00124
00125 // Implementation
00126 protected:
00127     CStr m_root;
00128         // current path of the browser
00129     static CImageList m_Imagelist;
00130         // several folders aspects
00131
00132     void StoreExpanded(std::vector<CStr> & allExpanded, HTREEITEM root = 0L);
00133     bool DisableCommon();
00134
00135     HTREEITEM GetItemByLocation(const char *path);
00136
00137     virtual ~CWinCvsBrowser();
00138     void OnUpdateCmd(CCmdUI* pCmdUI, BOOL needCvsInfos);
00139 #ifdef _DEBUG
00140     virtual void AssertValid() const;
00141     virtual void Dump(CDumpContext& dc) const;
00142 #endif
00143
00144     // Generated message map functions
00145 protected:
00146     //{{AFX_MSG(CWinCvsBrowser)
00147     afx_msg void OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult);
00148     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00149     afx_msg void OnSelchanging(NMHDR* pNMHDR, LRESULT* pResult);
00150     afx_msg void OnUpdateViewAdd(CCmdUI* pCmdUI);
00151     afx_msg void OnUpdateViewUpdate(CCmdUI* pCmdUI);
00152     afx_msg void OnViewAdd();
00153     afx_msg void OnViewCommit();
00154     afx_msg void OnViewUpdate();
00155     afx_msg void OnViewQueryUpdate();
00156     afx_msg void OnViewDiff();
00157     afx_msg void OnViewLog();
00158     afx_msg void OnViewStatus();
00159     afx_msg void OnViewLock();
00160     afx_msg void OnViewUnlock();
00161     afx_msg void OnViewWatchOn();
00162     afx_msg void OnViewWatchOff();
00163     afx_msg void OnViewEdit();
00164     afx_msg void OnViewUnedit();
00165     afx_msg void OnViewWatchers();
00166     afx_msg void OnViewEditors();
00167     afx_msg void OnViewRelease();
00168     afx_msg void OnViewTagNew();
00169     afx_msg void OnViewTagDelete();
00170     afx_msg void OnViewTagBranch();
00171     afx_msg void OnViewExplore();
00172     afx_msg void OnUpdateViewExplore(CCmdUI* pCmdUI);
00173     afx_msg void OnUpdateViewReload(CCmdUI* pCmdUI);
00174     afx_msg void OnViewReload();
00175     afx_msg void OnViewCheckout();
00176     afx_msg void OnUpdateViewCheckout(CCmdUI* pCmdUI);
00177     afx_msg void OnViewImport();
00178     afx_msg void OnUpdateViewImport(CCmdUI* pCmdUI);
00179     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00180     afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
00181     afx_msg void OnDestroy();
00182     //}}AFX_MSG
00183     afx_msg void OnUpdateMacro(CCmdUI* pCmdUI);
00184     afx_msg BOOL OnMacro(UINT nID);
00185     afx_msg void OnUpdateCustomize(CCmdUI* pCmdUI);
00186     afx_msg BOOL OnCustomize(UINT nID);
00187     afx_msg LRESULT OnResetView(WPARAM, LPARAM);
00188
00189     DECLARE_MESSAGE_MAP()
00190 };
00191
00193
00194 //{{AFX_INSERT_LOCATION}}
00195 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00196
00197 #endif // !defined(AFX_WINCVSBROWSER_H__144A4971_CAB4_11D1_BC80_000000000000__INCLUDED_)
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/WinCvsDebug.cpp Source File

WinCvs/WinCvsDebug.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jonathan M. Gilligan <jonathan.gilligan@vanderbilt.edu> --- July 2001
00019  */
00020
00021 /*
00022  * WinCvsDebug.cpp --- Miscellaneous debugging stuff.
00023  */
00024
00025 #include "stdafx.h"
00026 #include "WinCvsDebug.h"
00027
00028 namespace
00029 {
00030     unsigned long wincvs_debug_mask = 0L;
00031 }
00032
00033 unsigned long GetWinCvsDebugMask(bool clear_mask)
00034 {
00035     unsigned long retval = wincvs_debug_mask;
00036     if ( clear_mask && (wincvs_debug_mask & wcvsdbg_one_shot) )
00037         wincvs_debug_mask = wcvsdbg_one_shot;
00038     return retval;
00039 }
00040
00041 void SetWinCvsDebugMask(unsigned long umask)
00042 {
00043     wincvs_debug_mask = umask;
00044 }
00045
00046 void AppendWinCvsDebugMask(unsigned long umask)
00047 {
00048     wincvs_debug_mask = wincvs_debug_mask | umask;
00049 }
00050
00051 void SetWinCvsDebugMaskBit(unsigned char bit, bool val)
00052 {
00053     if (bit > sizeof(wincvs_debug_mask) * 8)
00054     {
00055         return;
00056     }
00057     if (val)
00058     {
00059         wincvs_debug_mask = wincvs_debug_mask | 1 << bit;
00060     }
00061     else
00062     {
00063         wincvs_debug_mask = wincvs_debug_mask & ~(1 << bit);
00064     }
00065 }
00066
00067 bool GetWinCvsDebugMaskBit(unsigned char bit, bool clear_mask)
00068 {
00069     bool retval = (wincvs_debug_mask & (1 << bit)) != 0;
00070     if ( clear_mask && (wincvs_debug_mask & wcvsdbg_one_shot) && (bit != wcvsdbg_one_shot_bit) )
00071     {
00072         wincvs_debug_mask = wincvs_debug_mask & ~(1 << bit);
00073     }
00074     return retval;
00075 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/WinCvsDebug.h Source File

WinCvs/WinCvsDebug.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jonathan M. Gilligan <jonathan.gilligan@vanderbilt.edu> --- July 2001
00019  */
00020
00021 /*
00022  * WinCvsDebug.h --- Miscellaneous debugging stuff.
00023  */
00024
00025 #pragma once
00026 #if !defined(WINCVSDEBUG_H_INCLUDED)
00027 #define WINCVSDEBUG_H_INCLUDED
00028
00029 enum wcvs_debug_mask_bits
00030 {
00031     wcvsdbg_one_shot_bit = 0,
00032     wcvsdbg_verbose_bit,
00033     wcvsdbg_trace_dst_checks_bit,
00034     wcvsdbg_trace_modified_checks_bit,
00035     wcvsdbg_trace_stat_bit
00036 };
00037
00038 enum wcvs_debug_mask_flags
00039 {
00040     wcvsdbg_one_shot = 1L << wcvsdbg_one_shot_bit,
00041     wcvsdbg_verbose = 1L << wcvsdbg_verbose_bit,
00042     wcvsdbg_trace_dst_checks = 1L << wcvsdbg_trace_dst_checks_bit,
00043     wcvsdbg_trace_modified_checks = 1L << wcvsdbg_trace_modified_checks_bit,
00044     wcvsdbg_trace_stat = 1L << wcvsdbg_trace_stat_bit
00045 };
00046
00047 unsigned long GetWinCvsDebugMask(bool clear_mask = true);
00048 bool GetWinCvsDebugMaskBit(unsigned char bit, bool clear_mask = true);
00049
00050 void SetWinCvsDebugMask(unsigned long umask);
00051 void AppendWinCvsDebugMask(unsigned long umask);
00052 void SetWinCvsDebugMaskBit(unsigned char bit, bool val);
00053
00054 #endif  // !defined(WINCVSDEBUG_H_INCLUDED)
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/wincvsDoc.cpp Source File

WinCvs/wincvsDoc.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // wincvsDoc.cpp : implementation of the CWincvsDoc class
00022 //
00023
00024 #include "stdafx.h"
00025 #include "wincvs.h"
00026 #include <afxrich.h>
00027
00028 #include "wincvsDoc.h"
00029 #include "CvsCommands.h"
00030 #include "GetPrefs.h"
00031 #include "Authen.h"
00032 #include "CvsPrefs.h"
00033 #include "AppConsole.h"
00034 #include "PromptFiles.h"
00035 #include "WinCvsBrowser.h"
00036 #include "TclGlue.h"
00037 #include "PythonGlue.h"
00038 #include "MacrosSetup.h"
00039 #include "cvsgui_process.h"
00040
00041 #ifdef _DEBUG
00042 #define new DEBUG_NEW
00043 #undef THIS_FILE
00044 static char THIS_FILE[] = __FILE__;
00045 #endif
00046
00048 // CWincvsDoc
00049
00050 IMPLEMENT_DYNCREATE(CWincvsDoc, CDocument)
00051
00052 BEGIN_MESSAGE_MAP(CWincvsDoc, CDocument)
00053     //{{AFX_MSG_MAP(CWincvsDoc)
00054     ON_COMMAND(ID_APP_PREFERENCES, OnAppPreferences)
00055     ON_COMMAND(ID_APP_RTAGCREATE, OnAppRtagNew)
00056     ON_COMMAND(ID_APP_RTAGDELETE, OnAppRtagDelete)
00057     ON_COMMAND(ID_APP_RTAGBRANCH, OnAppRtagBranch)
00058     ON_COMMAND(ID_APP_CMDLINE, OnAppCmdline)
00059     ON_UPDATE_COMMAND_UI(ID_APP_RTAGCREATE, OnUpdateCvsCmd)
00060     ON_UPDATE_COMMAND_UI(ID_APP_PREFERENCES, OnUpdatePrefs)
00061     ON_COMMAND(ID_STOPCVS, OnStopcvs)
00062     ON_UPDATE_COMMAND_UI(ID_STOPCVS, OnUpdateStopcvs)
00063     ON_COMMAND(ID_BROWSER_OPEN, OnBrowserOpen)
00064     ON_COMMAND(ID_APP_LOGIN, OnAppLogin)
00065 //  ON_UPDATE_COMMAND_UI(ID_MACRO_ADMIN, OnUpdateMacroAdmin)
00066     ON_COMMAND(ID_APP_LOGOUT, OnAppLogout)
00067     ON_COMMAND(ID_VIEW_INIT, OnViewInit)
00068     ON_COMMAND(ID_SAVESETTINGS, OnSavesettings)
00069     ON_UPDATE_COMMAND_UI(ID_SAVESETTINGS, OnUpdateSavesettings)
00070     ON_COMMAND(ID_VIEW_BROWSELOCATION_REMOVEUNWANTED, OnViewBrowselocationRemoveunwanted)
00071     ON_UPDATE_COMMAND_UI(ID_VIEW_INIT, OnUpdateCvsCmd)
00072     ON_UPDATE_COMMAND_UI(ID_APP_RTAGDELETE, OnUpdateCvsCmd)
00073     ON_UPDATE_COMMAND_UI(ID_APP_RTAGBRANCH, OnUpdateCvsCmd)
00074     ON_UPDATE_COMMAND_UI(ID_APP_CMDLINE, OnUpdateCvsCmd)
00075     ON_UPDATE_COMMAND_UI(ID_APP_LOGIN, OnUpdateCvsCmd)
00076     ON_UPDATE_COMMAND_UI(ID_BROWSER_OPEN, OnUpdateCvsCmd)
00077     ON_UPDATE_COMMAND_UI(ID_APP_LOGOUT, OnUpdateCvsCmd)
00078     ON_UPDATE_COMMAND_UI(ID_VIEW_BROWSELOCATION_REMOVEUNWANTED, OnUpdateCvsCmd)
00079     ON_COMMAND(ID_USE_PYSHELL, OnUsePyshell)
00080     ON_UPDATE_COMMAND_UI(ID_USE_PYSHELL, OnUpdateUsePyshell)
00081     ON_COMMAND(ID_USE_TCLSHELL, OnUseTclshell)
00082     ON_UPDATE_COMMAND_UI(ID_USE_TCLSHELL, OnUpdateUseTclshell)
00083     //}}AFX_MSG_MAP
00084     // Enable default OLE container implementation
00085     //ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, CDocument::OnUpdatePasteMenu)
00086 //  ON_COMMAND_EX_RANGE(ID_MACRO_ADMIN, ID_MACRO_ADMIN + 99, OnMacroAdmin)
00087     ON_COMMAND(ID_FILE_SEND_MAIL, OnFileSendMail)
00088     ON_UPDATE_COMMAND_UI(ID_FILE_SEND_MAIL, OnUpdateFileSendMail)
00089 END_MESSAGE_MAP()
00090
00091 BEGIN_DISPATCH_MAP(CWincvsDoc, CDocument)
00092     //{{AFX_DISPATCH_MAP(CWincvsDoc)
00093     DISP_PROPERTY_NOTIFY(CWincvsDoc, "ViewPath", m_viewPath, OnViewPathChanged, VT_BSTR)
00094     //}}AFX_DISPATCH_MAP
00095 END_DISPATCH_MAP()
00096
00097 // Note: we add support for IID_IWincvs to support typesafe binding
00098 //  from VBA.  This IID must match the GUID that is attached to the
00099 //  dispinterface in the .ODL file.
00100
00101 // {D2D77DC4-8299-11D1-8949-444553540000}
00102 static const IID IID_IWincvs =
00103 { 0xd2d77dc4, 0x8299, 0x11d1, { 0x89, 0x49, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } };
00104
00105 BEGIN_INTERFACE_MAP(CWincvsDoc, CDocument)
00106     INTERFACE_PART(CWincvsDoc, IID_IWincvs, Dispatch)
00107 END_INTERFACE_MAP()
00108
00110 // CWincvsDoc construction/destruction
00111
00112 CWincvsDoc::CWincvsDoc()
00113 {
00114     // Use OLE compound files
00115     //EnableCompoundFile();
00116
00117     // TODO: add one-time construction code here
00118
00119     //EnableAutomation();
00120
00121     //AfxOleLockApp();
00122 }
00123
00124 CWincvsDoc::~CWincvsDoc()
00125 {
00126     //AfxOleUnlockApp();
00127 }
00128
00129 //CRichEditCntrItem* CWincvsDoc::CreateClientItem(REOBJECT* preo) const
00130 //{
00131 //  return new CRichEditCntrItem(preo, (CRichEditDoc *)this);
00132 //}
00133
00134 BOOL CWincvsDoc::OnNewDocument()
00135 {
00136     if (!CDocument::OnNewDocument())
00137         return FALSE;
00138
00139     return TRUE;
00140 }
00141
00142
00143
00145 // CWincvsDoc serialization
00146
00147 class _afxRichEditCookie
00148 {
00149 public:
00150     CArchive& m_ar;
00151     DWORD m_dwError;
00152     _afxRichEditCookie(CArchive& ar) : m_ar(ar) {m_dwError=0;}
00153 };
00154
00155 // return 0 for no error, otherwise return error code
00156 extern "C" DWORD CALLBACK EditStreamCallBack(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
00157 {
00158     _afxRichEditCookie* pCookie = (_afxRichEditCookie*)dwCookie;
00159     CArchive& ar = pCookie->m_ar;
00160     ar.Flush();
00161     DWORD dw = 0;
00162     *pcb = cb;
00163     TRY
00164     {
00165         if (ar.IsStoring())
00166             ar.GetFile()->WriteHuge(pbBuff, cb);
00167         else
00168             *pcb = ar.GetFile()->ReadHuge(pbBuff, cb);
00169     }
00170     CATCH(CFileException, e)
00171     {
00172         *pcb = 0;
00173         pCookie->m_dwError = (DWORD)e->m_cause;
00174         dw = 1;
00175     }
00176     AND_CATCH_ALL(e)
00177     {
00178         *pcb = 0;
00179         pCookie->m_dwError = (DWORD)CFileException::generic;
00180         dw = 1;
00181     }
00182     END_CATCH_ALL
00183     return dw;
00184 }
00185
00186 void CWincvsDoc::Serialize(CArchive& ar)
00187 {
00188     if (ar.IsStoring())
00189     {
00190         POSITION pos = GetFirstViewPosition();
00191         CView* view;
00192         while((view = GetNextView(pos)) != NULL)
00193         {
00194             if(view->IsKindOf(RUNTIME_CLASS(CRichEditView)))
00195             {
00196                 int nFormat = SF_TEXT;
00197                 EDITSTREAM es = {0, 0, (EDITSTREAMCALLBACK)EditStreamCallBack};
00198                 _afxRichEditCookie cookie(ar);
00199                 es.dwCookie = (DWORD)&cookie;
00200                 ((CRichEditView *)view)->GetRichEditCtrl().StreamOut(nFormat, es);
00201                 break;
00202             }
00203         }
00204     }
00205     else
00206     {
00207         // We don't load right now
00208     }
00209
00210     // Calling the base class CDocument enables serialization
00211     //  of the container document's COleClientItem objects.
00212     // (but we don't have COleClientItem)
00213     CDocument::Serialize(ar);
00214 }
00215
00217 // CWincvsDoc diagnostics
00218
00219 #ifdef _DEBUG
00220 void CWincvsDoc::AssertValid() const
00221 {
00222     CDocument::AssertValid();
00223 }
00224
00225 void CWincvsDoc::Dump(CDumpContext& dc) const
00226 {
00227     CDocument::Dump(dc);
00228 }
00229 #endif //_DEBUG
00230
00232 // CWincvsDoc commands
00233
00234
00235 void CWincvsDoc::OnAppPreferences()
00236 {
00237     CompatGetPrefs();
00238 }
00239
00240 void CWincvsDoc::OnAppCmdline()
00241 {
00242     CvsCmdLine();
00243 }
00244
00245 void CWincvsDoc::OnAppLogin()
00246 {
00247     CvsCmdLogin();
00248 }
00249
00250 void CWincvsDoc::OnUpdateCvsCmd(CCmdUI* pCmdUI)
00251 {
00252     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00253     pCmdUI->Enable(app->gCvsRunning || gCvsPrefs.empty() ? FALSE : TRUE);
00254 }
00255
00256 void CWincvsDoc::OnUpdatePrefs(CCmdUI* pCmdUI)
00257 {
00258     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00259     pCmdUI->Enable(app->gCvsRunning ? FALSE : TRUE);
00260 }
00261
00262 void CWincvsDoc::OnStopcvs()
00263 {
00264     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00265     app->gCvsStopping = true;
00266     cvs_process_kill(app->gCvsProcess);
00267     cvs_out("*****CVS stopped on user request !!! *****\n\n");
00268 }
00269
00270 void CWincvsDoc::OnUpdateStopcvs(CCmdUI* pCmdUI)
00271 {
00272     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00273     pCmdUI->Enable(app->gCvsRunning && !app->gCvsStopping ? TRUE : FALSE);
00274 }
00275
00276 void CWincvsDoc::OnBrowserOpen()
00277 {
00278     const char *newPath =
00279         BrowserGetDirectory("Select a folder to open with the browser");
00280     if(newPath == 0L)
00281         return;
00282
00283     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00284     app->GetBrowserView()->ResetBrowser(newPath, true);
00285 }
00286
00287 void CWincvsDoc::OnViewPathChanged()
00288 {
00289     // TODO: Add notification handler code
00290
00291 }
00292
00293 void CWincvsDoc::OnAppRtagNew()
00294 {
00295     CvsCmdRtagCreate();
00296 }
00297
00298 void CWincvsDoc::OnAppRtagDelete()
00299 {
00300     CvsCmdRtagDelete();
00301 }
00302
00303 void CWincvsDoc::OnAppRtagBranch()
00304 {
00305     CvsCmdRtagBranch();
00306 }
00307
00308 BOOL CWincvsDoc::OnMacroAdmin(UINT nID)
00309 {
00310     CMacroEntry & entry = gMacrosAdmin.entries[nID - ID_MACRO_ADMIN];
00311     CvsCmdMacrosAdmin(entry.path);
00312
00313     return 1;
00314 }
00315
00316 void CWincvsDoc::OnUpdateMacroAdmin(CCmdUI* pCmdUI)
00317 {
00318     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00319     if(app->gCvsRunning || gCvsPrefs.empty() || !CTcl_Interp::IsAvail())
00320     {
00321         pCmdUI->Enable(FALSE);
00322         return;
00323     }
00324
00325     if(pCmdUI->m_pSubMenu != 0L || pCmdUI->m_pMenu == 0L)
00326         return;
00327
00328     int iMRUMax = pCmdUI->m_pMenu->GetMenuItemCount();
00329     for (int iMRU = 0; iMRU < iMRUMax; iMRU++)
00330         pCmdUI->m_pMenu->DeleteMenu(pCmdUI->m_nID + iMRU, MF_BYCOMMAND);
00331
00332     vector<CMacroEntry>::const_iterator i;
00333     for(i = gMacrosAdmin.entries.begin(); i != gMacrosAdmin.entries.end(); ++i)
00334     {
00335         pCmdUI->m_pMenu->InsertMenu(pCmdUI->m_nIndex++,
00336             MF_STRING | MF_BYPOSITION, pCmdUI->m_nID++,
00337             (*i).name);
00338     }
00339
00340     pCmdUI->m_nIndexMax = pCmdUI->m_pMenu->GetMenuItemCount();
00341     pCmdUI->m_nIndex--; // point to last menu added
00342     pCmdUI->m_bEnableChanged = TRUE;    // all the added items are enabled
00343 }
00344
00345 void CWincvsDoc::OnAppLogout()
00346 {
00347     CvsCmdLogout();
00348 }
00349
00350 void CWincvsDoc::OnViewInit()
00351 {
00352     CvsCmdInit();
00353 }
00354
00355 void CWincvsDoc::OnSavesettings()
00356 {
00357     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00358     AskCreatePersistentSettings(app->GetBrowserView()->GetRoot());
00359 }
00360
00361 void CWincvsDoc::OnUpdateSavesettings(CCmdUI* pCmdUI)
00362 {
00363     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00364     pCmdUI->Enable(!app->gCvsRunning && !gCvsPrefs.empty());
00365 }
00366
00367 void CWincvsDoc::OnViewBrowselocationRemoveunwanted()
00368 {
00369     AfxMessageBox("To remove the unwanted location history items click DEL key when selecting from the combo box list.", MB_OK | MB_ICONINFORMATION);
00370 }
00371
00372 void CWincvsDoc::OnUsePyshell()
00373 {
00374     gCvsPrefs.SetUseShell(SHELL_PYTHON);
00375     cvs_out("Switching the shell to Python...\n");
00376 }
00377
00378 void CWincvsDoc::OnUpdateUsePyshell(CCmdUI* pCmdUI)
00379 {
00380     pCmdUI->Enable(CPython_Interp::IsAvail());
00381     pCmdUI->SetRadio(gCvsPrefs.GetUseShell() == SHELL_PYTHON);
00382 }
00383
00384 void CWincvsDoc::OnUseTclshell()
00385 {
00386     gCvsPrefs.SetUseShell(SHELL_TCL);
00387     cvs_out("Switching the shell to TCL...\n");
00388 }
00389
00390 void CWincvsDoc::OnUpdateUseTclshell(CCmdUI* pCmdUI)
00391 {
00392     pCmdUI->Enable(CTcl_Interp::IsAvail());
00393     pCmdUI->SetRadio(gCvsPrefs.GetUseShell() == SHELL_TCL);
00394 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/wincvsDoc.h Source File

WinCvs/wincvsDoc.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // wincvsDoc.h : interface of the CWincvsDoc class
00022 //
00024
00025 #if !defined(AFX_WINCVSDOC_H__D2D77DCE_8299_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_WINCVSDOC_H__D2D77DCE_8299_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 class CWincvsDoc : public CDocument
00033 {
00034 public:
00035     DECLARE_DYNCREATE(CWincvsDoc)
00036
00037 // Attributes
00038     CWincvsDoc();
00039
00040     //virtual CRichEditCntrItem* CreateClientItem(REOBJECT* preo = NULL) const;
00041
00042     // Operations
00043 public:
00044
00045 // Overrides
00046     // ClassWizard generated virtual function overrides
00047     //{{AFX_VIRTUAL(CWincvsDoc)
00048     public:
00049     virtual BOOL OnNewDocument();
00050     virtual void Serialize(CArchive& ar);
00051     //}}AFX_VIRTUAL
00052
00053 // Implementation
00054 public:
00055     virtual ~CWincvsDoc();
00056 #ifdef _DEBUG
00057     virtual void AssertValid() const;
00058     virtual void Dump(CDumpContext& dc) const;
00059 #endif
00060
00061 protected:
00062
00063 // Generated message map functions
00064 protected:
00065     //{{AFX_MSG(CWincvsDoc)
00066     afx_msg void OnAppPreferences();
00067     afx_msg void OnAppRtagNew();
00068     afx_msg void OnAppRtagDelete();
00069     afx_msg void OnAppRtagBranch();
00070     afx_msg void OnAppCmdline();
00071     afx_msg void OnUpdateCvsCmd(CCmdUI* pCmdUI);
00072     afx_msg void OnUpdatePrefs(CCmdUI* pCmdUI);
00073     afx_msg void OnStopcvs();
00074     afx_msg void OnUpdateStopcvs(CCmdUI* pCmdUI);
00075     afx_msg void OnBrowserOpen();
00076     afx_msg void OnAppLogin();
00077     afx_msg BOOL OnMacroAdmin(UINT nID);
00078     afx_msg void OnUpdateMacroAdmin(CCmdUI* pCmdUI);
00079     afx_msg void OnAppLogout();
00080     afx_msg void OnViewInit();
00081     afx_msg void OnSavesettings();
00082     afx_msg void OnUpdateSavesettings(CCmdUI* pCmdUI);
00083     afx_msg void OnViewBrowselocationRemoveunwanted();
00084     afx_msg void OnUsePyshell();
00085     afx_msg void OnUpdateUsePyshell(CCmdUI* pCmdUI);
00086     afx_msg void OnUseTclshell();
00087     afx_msg void OnUpdateUseTclshell(CCmdUI* pCmdUI);
00088     //}}AFX_MSG
00089     DECLARE_MESSAGE_MAP()
00090
00091     // Generated OLE dispatch map functions
00092     //{{AFX_DISPATCH(CWincvsDoc)
00093     CString m_viewPath;
00094     afx_msg void OnViewPathChanged();
00095     //}}AFX_DISPATCH
00096     DECLARE_DISPATCH_MAP()
00097     DECLARE_INTERFACE_MAP()
00098 };
00099
00101
00102 //{{AFX_INSERT_LOCATION}}
00103 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00104
00105 #endif // !defined(AFX_WINCVSDOC_H__D2D77DCE_8299_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/wincvsView.cpp Source File

WinCvs/wincvsView.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // wincvsView.cpp : implementation of the CWincvsView class
00022 //
00023
00024 #include "stdafx.h"
00025 #include <atlconv.h>
00026 #include "wincvs.h"
00027 #include "wincvsDoc.h"
00028 #include "wincvsView.h"
00029 #include "wincvs_winutil.h"
00030 #include "MainFrm.h"
00031
00032 #include "Persistent.h"
00033 #include "CvsPrefs.h"
00034 #include "AppGlue.h"
00035 #include "TclGlue.h"
00036 #include "PythonGlue.h"
00037
00038 #ifdef _DEBUG
00039 #define new DEBUG_NEW
00040 #undef THIS_FILE
00041 static char THIS_FILE[] = __FILE__;
00042 #endif
00043
00044 // critical section to protect while accessing MFC from cvs
00045 CRITICAL_SECTION CCvsThreadLock::m_lock;
00046
00047 class CCharFormat : public CHARFORMAT
00048 {
00049 public:
00050     CCharFormat()
00051     {
00052         USES_CONVERSION;
00053         CString strDefFont = _T("Courier New");
00054         //VERIFY(strDefFont.LoadString(IDS_DEFFONT));
00055         cbSize = sizeof(CHARFORMAT);
00056         dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_STRIKEOUT|CFM_SIZE|
00057             CFM_COLOR|CFM_OFFSET|CFM_PROTECTED;
00058         dwEffects = CFE_AUTOCOLOR;
00059         yHeight = 200; //10pt
00060         yOffset = 0;
00061         crTextColor = RGB(0, 0, 0);
00062         bCharSet = 0;
00063         bPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
00064         ASSERT(strDefFont.GetLength() < LF_FACESIZE);
00065         lstrcpynA(szFaceName, T2A((LPTSTR) (LPCTSTR) strDefFont), LF_FACESIZE);
00066         dwMask |= CFM_FACE;
00067     }
00068     CCharFormat(const CHARFORMAT &newf)
00069     {
00070         *(CHARFORMAT *)this = newf;
00071     }
00072     inline operator CHARFORMAT &()
00073     {
00074         return *(CHARFORMAT *)this;
00075     }
00076 };
00077
00078 static CPersistentT<CCharFormat> gViewFont("P_ViewFont", CCharFormat(), kNoClass);
00079
00081 // CWincvsView
00082
00083 IMPLEMENT_DYNCREATE(CWincvsView, CRichEditView)
00084
00085 BEGIN_MESSAGE_MAP(CWincvsView, CRichEditView)
00086     //{{AFX_MSG_MAP(CWincvsView)
00087     ON_WM_DESTROY()
00088     ON_WM_SETFOCUS()
00089     ON_WM_SIZE()
00090     ON_COMMAND(ID_FORMAT_FONT, OnMyFormatFont)
00091     ON_WM_KEYDOWN()
00092     ON_WM_DROPFILES()
00093     ON_COMMAND(ID_EDIT_CLEAR_ALL, OnEditClearAll)
00094     ON_WM_RBUTTONDOWN()
00095     ON_WM_GETDLGCODE()
00096     //}}AFX_MSG_MAP
00097     // Standard printing commands
00098     ON_COMMAND(ID_FILE_PRINT, CRichEditView::OnFilePrint)
00099     ON_COMMAND(ID_FILE_PRINT_DIRECT, CRichEditView::OnFilePrint)
00100     ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRichEditView::OnFilePrintPreview)
00101 END_MESSAGE_MAP()
00102
00104 // CWincvsView construction/destruction
00105
00106 char *CWincvsView::sbuf = 0L;
00107 int CWincvsView::snumbuf = 0;
00108
00109 CWincvsView::CWincvsView()
00110 {
00111     fRtfFormat = ::RegisterClipboardFormat(_T("Rich Text Format"));
00112 }
00113
00114 CWincvsView::~CWincvsView()
00115 {
00116     snumbuf = 0;
00117     if(sbuf != 0L)
00118     {
00119         free(sbuf);
00120         sbuf = 0L;
00121     }
00122     PyInvalUICache();
00123     CPython_Interp::ClosePythonSupport();
00124 }
00125
00126 BOOL CWincvsView::PreCreateWindow(CREATESTRUCT& cs)
00127 {
00128     // TODO: Modify the Window class or styles here by modifying
00129     //  the CREATESTRUCT cs
00130
00131     BOOL bRet = CRichEditView::PreCreateWindow(cs);
00132     cs.style |= WS_TABSTOP | ES_MULTILINE;
00133     return  bRet;
00134 }
00135
00137 // CWincvsView drawing
00138
00139 void CWincvsView::OnDraw(CDC* pDC)
00140 {
00141     //CWincvsDoc* pDoc = GetDocument();
00142     //ASSERT_VALID(pDoc);
00143
00144     // TODO: add draw code for native data here
00145     // TODO: also draw all OLE items in the document
00146
00147     // Draw the selection at an arbitrary position.  This code should be
00148     //  removed once your real drawing code is implemented.  This position
00149     //  corresponds exactly to the rectangle returned by CWincvsCntrItem,
00150     //  to give the effect of in-place editing.
00151
00152     // TODO: remove this code when final draw code is complete.
00153
00154     //if (m_pSelection == NULL)
00155     //{
00156     //  POSITION pos = pDoc->GetStartPosition();
00157     //  m_pSelection = (CWincvsCntrItem*)pDoc->GetNextClientItem(pos);
00158     //}
00159     //if (m_pSelection != NULL)
00160     //  m_pSelection->Draw(pDC, CRect(10, 10, 210, 210));
00161 }
00162
00163 void CWincvsView::OnInitialUpdate()
00164 {
00165     CRichEditView::OnInitialUpdate();
00166
00167     CRichEditCtrl& edit = GetRichEditCtrl();
00168     edit.SetSel(0, -1);
00169     SetCharFormat((CCharFormat)gViewFont);
00170     edit.SetSel(-1, -1);
00171
00172     CPython_Interp::InitPythonSupport();
00173 }
00174
00176 // CWincvsView printing
00177
00178 BOOL CWincvsView::OnPreparePrinting(CPrintInfo* pInfo)
00179 {
00180     return DoPreparePrinting(pInfo);
00181     //return CRichEditView::OnPreparePrinting(pInfo);
00182 }
00183
00184 void CWincvsView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
00185 {
00186     // TODO: add extra initialization before printing
00187     CRichEditView::OnBeginPrinting(pDC, pInfo);
00188 }
00189
00190 void CWincvsView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
00191 {
00192     // TODO: add cleanup after printing
00193     CRichEditView::OnEndPrinting(pDC, pInfo);
00194 }
00195
00196 void CWincvsView::OnDestroy()
00197 {
00198     // Deactivate the item on destruction; this is important
00199     // when a splitter view is being used.
00200     CRichEditView::OnDestroy();
00201     //COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
00202     //if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
00203     //{
00204     //  pActiveItem->Deactivate();
00205     //  ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
00206     //}
00207 }
00208
00209
00211 // OLE Client support and commands
00212
00213 BOOL CWincvsView::IsSelected(const CObject* pDocItem) const
00214 {
00215     // The implementation below is adequate if your selection consists of
00216     //  only CWincvsCntrItem objects.  To handle different selection
00217     //  mechanisms, the implementation here should be replaced.
00218
00219     // TODO: implement this function that tests for a selected OLE client item
00220
00221     //return pDocItem == m_pSelection;
00222     return CRichEditView::IsSelected(pDocItem);
00223 }
00224
00225 #if 0
00226 // The following command handler provides the standard keyboard
00227 //  user interface to cancel an in-place editing session.  Here,
00228 //  the container (not the server) causes the deactivation.
00229 void CWincvsView::OnCancelEditCntr()
00230 {
00231     // Close any in-place active item on this view.
00232     COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
00233     if (pActiveItem != NULL)
00234     {
00235         pActiveItem->Close();
00236     }
00237     ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
00238 }
00239 #endif
00240
00241 // Special handling of OnSetFocus and OnSize are required for a container
00242 //  when an object is being edited in-place.
00243 void CWincvsView::OnSetFocus(CWnd* pOldWnd)
00244 {
00245 //  COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
00246 //  if (pActiveItem != NULL &&
00247 //      pActiveItem->GetItemState() == COleClientItem::activeUIState)
00248 //  {
00249         // need to set focus to this item if it is in the same view
00250 //      CWnd* pWnd = pActiveItem->GetInPlaceWindow();
00251 //      if (pWnd != NULL)
00252 //      {
00253 //          pWnd->SetFocus();   // don't call the base class
00254 //          return;
00255 //      }
00256 //  }
00257
00258     CRichEditView::OnSetFocus(pOldWnd);
00259 }
00260
00261 void CWincvsView::OnSize(UINT nType, int cx, int cy)
00262 {
00263     CRichEditView::OnSize(nType, cx, cy);
00264 //  COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
00265 //  if (pActiveItem != NULL)
00266 //      pActiveItem->SetItemRects();
00267 }
00268
00269 void CWincvsView::FeedThisLine(const char *buf, int numbuf, bool isStderr)
00270 {
00271     CRichEditCtrl& edit = GetRichEditCtrl();
00272     edit.SetSel(-1, -1);
00273
00274     CHARFORMAT cf;
00275     cf.cbSize = sizeof(CHARFORMAT);
00276     cf = GetCharFormatSelection();
00277
00278     bool colorChanged = false;
00279     COLORREF oldColor = cf.crTextColor;
00280     DWORD oldEffect = cf.dwEffects;
00281     CString s(buf, numbuf);
00282
00283     if(s.GetLength() >= 5 && s[1] == ' ' &&
00284         (s[0] == 'M' || s[0] == 'C' || s[0] == 'U' ||
00285         s[0] == 'P' || s[0] == 'N' || s[0] == 'A' ||
00286         s[0] == 'R' || s[0] == 'I' || s[0] == '?' ||
00287         s[0] == '<' || s[0] == '>'))
00288     {
00289         colorChanged = true;
00290         switch(s[0])
00291         {
00292         default:
00293         case '?' :
00294         case 'I' :
00295             cf.crTextColor = RGB(0x80, 0x80, 0x00);
00296             break;
00297         case 'U' :
00298         case 'N' :
00299             cf.crTextColor = RGB(0x00, 0xA0, 0x00);
00300             break;
00301         case 'M' :
00302         case 'A' :
00303         case 'R' :
00304             cf.crTextColor = RGB(0xFF, 0x00, 0xFF);
00305             break;
00306         case 'C' :
00307         case '<' :
00308             cf.crTextColor = RGB(0xFF, 0x00, 0x00);
00309             break;
00310         case '>' :
00311         case 'P' :
00312             cf.crTextColor = RGB(0x00, 0x00, 0xFF);
00313             break;
00314         }
00315         cf.dwMask = CFM_COLOR;
00316         cf.dwEffects = 0;
00317         SetCharFormat(cf);
00318     }
00319     else if(isStderr)
00320     {
00321         colorChanged = true;
00322         cf.crTextColor = RGB(0xFF, 0x80, 0x00);
00323         cf.dwMask = CFM_COLOR;
00324         cf.dwEffects = 0;
00325         SetCharFormat(cf);
00326     }
00327
00328     edit.ReplaceSel(s);
00329
00330     if(colorChanged)
00331     {
00332         cf.dwMask = CFM_COLOR;
00333         cf.crTextColor = oldColor;
00334         cf.dwEffects = oldEffect;
00335         SetCharFormat(cf);
00336     }
00337 }
00338
00339 CHARFORMAT CWincvsView::GetCurFormat(bool jumpEnd)
00340 {
00341     CRichEditCtrl& edit = GetRichEditCtrl();
00342     if(jumpEnd)
00343         edit.SetSel(-1, -1);
00344
00345     CHARFORMAT cf;
00346     cf.cbSize = sizeof(CHARFORMAT);
00347     return GetCharFormatSelection();
00348 }
00349
00350 void CWincvsView::OutColor(const char *txt, long len)
00351 {
00352     // synchonize it since the thread calls it
00353     CCvsThreadLock threadLock;
00354
00355     CString s;
00356     for(int i = 0; i < len; i++)
00357     {
00358         char c = *txt++;
00359         if(c == 0x0d || c == 0x0a)
00360         {
00361             s += (char)0x0d;
00362             s += (char)0x0a;
00363             // special case if we got already \r\n
00364             if((i+1) < len && c == 0x0d && txt[0] == 0x0a)
00365                 i++;
00366         }
00367         else
00368             s += c;
00369     }
00370
00371     CRichEditCtrl& edit = GetRichEditCtrl();
00372     edit.ReplaceSel(s);
00373 }
00374
00375 void CWincvsView::OutColor(kConsoleColor color)
00376 {
00377     CCvsThreadLock threadLock;
00378
00379     CRichEditCtrl& edit = GetRichEditCtrl();
00380
00381     CHARFORMAT cf = GetCurFormat(false);
00382     cf.dwEffects = 0;
00383
00384     switch(color)
00385     {
00386         default:
00387             return;
00388             break;
00389         case kBrown :
00390             cf.dwMask = CFM_COLOR;
00391             cf.crTextColor = RGB(0x80, 0x80, 0x00);
00392             break;
00393         case kGreen :
00394             cf.dwMask = CFM_COLOR;
00395             cf.crTextColor = RGB(0x00, 0xA0, 0x00);
00396             break;
00397         case kMagenta :
00398             cf.dwMask = CFM_COLOR;
00399             cf.crTextColor = RGB(0xFF, 0x00, 0xFF);
00400             break;
00401         case kRed :
00402             cf.dwMask = CFM_COLOR;
00403             cf.crTextColor = RGB(0xFF, 0x00, 0x00);
00404             break;
00405         case kBlue :
00406             cf.dwMask = CFM_COLOR;
00407             cf.crTextColor = RGB(0x00, 0x00, 0xFF);
00408             break;
00409         case kBold :
00410             cf.dwMask = CFM_BOLD;
00411             cf.dwEffects = CFE_BOLD;
00412             break;
00413         case kItalic :
00414             cf.dwMask = CFM_ITALIC;
00415             cf.dwEffects = CFE_ITALIC;
00416             break;
00417         case kUnderline :
00418             cf.dwMask = CFM_UNDERLINE;
00419             cf.dwEffects = CFE_UNDERLINE;
00420             break;
00421     }
00422
00423     SetCharFormat(cf);
00424 }
00425
00426 void CWincvsView::OutColor(CHARFORMAT & format)
00427 {
00428     CCvsThreadLock threadLock;
00429
00430     CRichEditCtrl& edit = GetRichEditCtrl();
00431     SetCharFormat(format);
00432 }
00433
00434 void CWincvsView::OutConsole(const char *txt, long len, bool isStderr)
00435 {
00436     // synchonize it since the thread calls it
00437     CCvsThreadLock threadLock;
00438
00439     if(len == 0)
00440         return;
00441
00442     if(sbuf == 0L)
00443     {
00444         sbuf = (char *)malloc((MAX_CHAR_BY_LINE + 3) * sizeof(char));
00445         if(sbuf == 0L)
00446             return;
00447     }
00448
00449     int i = 0;
00450     char c;
00451 once_again:
00452     for(; i < len && snumbuf < MAX_CHAR_BY_LINE; snumbuf++)
00453     {
00454         c = txt[i++];
00455         if(c == 0x0d || c == 0x0a)
00456             break;
00457         sbuf[snumbuf] = c;
00458     }
00459
00460     // special case if we got already \r\n
00461     if(i < len && c == 0x0d && txt[i] == 0x0a)
00462         i++;
00463
00464     if(c == 0x0d || c == 0x0a || snumbuf == MAX_CHAR_BY_LINE)
00465     {
00466         sbuf[snumbuf++] = 0x0d;
00467         sbuf[snumbuf++] = 0x0a;
00468         sbuf[snumbuf++] = 0x00;
00469
00470         FeedThisLine(sbuf, snumbuf, isStderr);
00471         snumbuf = 0;
00472     }
00473
00474     if(i != len)
00475         goto once_again;
00476 }
00477
00479 // CWincvsView diagnostics
00480
00481 #ifdef _DEBUG
00482 void CWincvsView::AssertValid() const
00483 {
00484     CRichEditView::AssertValid();
00485 }
00486
00487 void CWincvsView::Dump(CDumpContext& dc) const
00488 {
00489     CRichEditView::Dump(dc);
00490 }
00491
00492 CWincvsDoc* CWincvsView::GetDocument() // non-debug version is inline
00493 {
00494     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CWincvsDoc)));
00495     return (CWincvsDoc*)m_pDocument;
00496 }
00497
00498 #endif //_DEBUG
00499
00501 // CWincvsView message handlers
00502
00503 void CWincvsView::OnMyFormatFont()
00504 {
00505     CRichEditCtrl& edit = GetRichEditCtrl();
00506     edit.SetSel(0, -1);
00507     CRichEditView::OnFormatFont();
00508     edit.SetSel(-1, -1);
00509     gViewFont = CCharFormat(GetCharFormatSelection());
00510     gCvsPrefs.save();
00511 }
00512
00513 void CWincvsView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
00514 {
00515     CRichEditView::OnKeyDown(nChar, nRepCnt, nFlags);
00516
00517     if(nChar != VK_RETURN)
00518     {
00519         return;
00520     }
00521
00522     long len = GetTextLength();
00523     if(len == 0)
00524         return;
00525
00526     TCHAR *buf = (char *)malloc((len + 1) * sizeof(TCHAR));
00527     if(buf == 0L)
00528         return;
00529
00530     TEXTRANGE textRange;
00531     textRange.chrg.cpMin = 0;
00532     textRange.chrg.cpMax = len;
00533     textRange.lpstrText = buf;
00534     GetRichEditCtrl().SendMessage(EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
00535
00536     long nStartChar, nEndChar;
00537     GetRichEditCtrl().GetSel(nStartChar, nEndChar);
00538
00539     if (nStartChar == nEndChar) // i.e. there is no selection
00540     {
00541         // get the end and the beginning of the line
00542         if(nStartChar > 0 && buf[nStartChar] == '\r')
00543             nStartChar--;
00544         while(nStartChar > 0 && buf[nStartChar] != '\n' && buf[nStartChar] != '\r')
00545             nStartChar--;
00546         if(buf[nStartChar] == '\n' || buf[nStartChar] == '\r')
00547             nStartChar++;
00548         while(nEndChar < len && buf[nEndChar] != '\n' && buf[nEndChar] != '\r')
00549             nEndChar++;
00550     }
00551
00552     long length = nEndChar - nStartChar;
00553     if(length > 0 && nStartChar < len)
00554     {
00555         OutConsole("\n", 1);
00556         buf[nEndChar] = '\0';
00557         if(gCvsPrefs.GetUseShell() == SHELL_PYTHON && CPython_Interp::IsAvail())
00558         {
00559             CPython_Interp interp;
00560             interp.DoScript(buf + nStartChar);
00561         }
00562         else if(gCvsPrefs.GetUseShell() == SHELL_TCL && CTcl_Interp::IsAvail())
00563         {
00564             CTcl_Interp interp;
00565             interp.DoScript(buf + nStartChar);
00566         }
00567     }
00568
00569     free(buf);
00570 }
00571
00572 HRESULT CWincvsView::QueryAcceptData(LPDATAOBJECT lpdataobj,
00573     CLIPFORMAT* lpcfFormat, DWORD dwReco, BOOL bReally, HGLOBAL hMetaPict)
00574 {
00575     ASSERT(lpcfFormat != NULL);
00576     if (!bReally) // not actually pasting
00577         return S_OK;
00578     // if direct pasting a particular native format allow it
00579     if (IsRichEditFormat(*lpcfFormat))
00580         return S_OK;
00581
00582     COleDataObject dataobj;
00583     dataobj.Attach(lpdataobj, FALSE);
00584     // if format is 0, then force particular formats if available
00585     if (*lpcfFormat == 0 && (m_nPasteType == 0))
00586     {
00587         if (fRtfFormat != 0 && dataobj.IsDataAvailable(fRtfFormat)) // native avail, let richedit do as it wants
00588         {
00589             *lpcfFormat = fRtfFormat;
00590             return S_OK;
00591         }
00592         else if (dataobj.IsDataAvailable(CF_TEXT))
00593         {
00594             *lpcfFormat = CF_TEXT;
00595             return S_OK;
00596         }
00597     }
00598     // *DO NOT* paste OLE formats
00599     // crash reported by Gerhard Möller
00600     //DoPaste(dataobj, *lpcfFormat, hMetaPict);
00601     return S_FALSE;
00602 }
00603
00604 BOOL CWincvsView::CanPaste() const
00605 {
00606     return (CountClipboardFormats() != 0) &&
00607         (IsClipboardFormatAvailable(CF_TEXT) ||
00608         IsClipboardFormatAvailable(fRtfFormat) ||
00609         //IsClipboardFormatAvailable(_oleData.cfEmbedSource) ||
00610         //IsClipboardFormatAvailable(_oleData.cfEmbeddedObject) ||
00611         //IsClipboardFormatAvailable(_oleData.cfFileName) ||
00612         //IsClipboardFormatAvailable(_oleData.cfFileNameW) ||
00613         //IsClipboardFormatAvailable(CF_METAFILEPICT) ||
00614         //IsClipboardFormatAvailable(CF_DIB) ||
00615         //IsClipboardFormatAvailable(CF_BITMAP) ||
00616         GetRichEditCtrl().CanPaste());
00617 }
00618
00619 void CWincvsView::OnDropFiles(HDROP hDropInfo)
00620 {
00621     CWnd* pWnd = AfxGetMainWnd();   //look in InitInstance m_pMainWnd = m_mainFrame;
00622
00623     if( pWnd )
00624     {
00625         CMainFrame* pMainFrame = (CMainFrame*)pWnd;
00626
00627         if( pMainFrame->GetSafeHwnd() != NULL )
00628         {
00629             pMainFrame->DropFiles( hDropInfo );
00630         }
00631     }
00632
00633     //this cause the crash, remove
00634     //CRichEditView::OnDropFiles(hDropInfo);
00635 }
00636
00637 void CWincvsView::OnEditClearAll()
00638 {
00639     CRichEditCtrl& edit = GetRichEditCtrl();
00640     edit.SetSel(0, -1);
00641     edit.ReplaceSel("", TRUE);
00642 }
00643
00644 void CWincvsView::OnRButtonDown(UINT nFlags, CPoint point)
00645 {
00646     CWincvsApp* pApp=static_cast<CWincvsApp*>(AfxGetApp());
00647     CMenu* pSubMenu=::GetSubCMenu(ID_EDIT_UNDO,this);
00648     if (pSubMenu) {
00649         ClientToScreen(&point);
00650         pSubMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x, point.y, this);
00651     }
00652 //  CRichEditView::OnRButtonDown(nFlags, point);
00653 }
00654
00655 UINT CWincvsView::OnGetDlgCode()
00656 {
00657     LRESULT DlgCode;
00658     DlgCode = CRichEditView::OnGetDlgCode();
00659     if (0x8000 & GetKeyState(VK_TAB))
00660         return  DlgCode & ~(DLGC_WANTTAB | DLGC_WANTALLKEYS | DLGC_WANTCHARS);
00661     else
00662         return DlgCode;
00663 }
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/wincvsView.h Source File

WinCvs/wincvsView.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // wincvsView.h : interface of the CWincvsView class
00022 //
00024
00025 #if !defined(AFX_WINCVSVIEW_H__D2D77DD0_8299_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_WINCVSVIEW_H__D2D77DD0_8299_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 #include <afxrich.h>
00033 #include "AppConsole.h"
00034
00035 class CWincvsDoc;
00036
00037 class CCvsThreadLock
00038 {
00039 public:
00040     static CRITICAL_SECTION m_lock;
00041
00042     CCvsThreadLock()
00043     {
00044         EnterCriticalSection(&m_lock);
00045     }
00046     ~CCvsThreadLock()
00047     {
00048         LeaveCriticalSection(&m_lock);
00049     }
00050 };
00051
00052 class CWincvsView : public CRichEditView
00053 {
00054 protected: // create from serialization only
00055     CWincvsView();
00056     DECLARE_DYNCREATE(CWincvsView)
00057
00058 // Attributes
00059 public:
00060     CWincvsDoc* GetDocument();
00061     void OutConsole(const char *txt, long len, bool isStderr = false);
00062         // insert "len" character
00063
00064     void OutColor(const char *txt, long len);
00065     void OutColor(kConsoleColor color);
00066     void OutColor(CHARFORMAT & format);
00067         // colorized output
00068
00069     CHARFORMAT GetCurFormat(bool jumpEnd = true);
00070         // get current format of the text (this call put the cursor
00071         // at the end of the text by default)
00072
00073 // Operations
00074 public:
00075
00076     BOOL CanPaste() const;
00077
00078 // Overrides
00079     // ClassWizard generated virtual function overrides
00080     //{{AFX_VIRTUAL(CWincvsView)
00081     public:
00082     virtual void OnDraw(CDC* pDC);  // overridden to draw this view
00083     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00084     protected:
00085     virtual void OnInitialUpdate(); // called first time after construct
00086     virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
00087     virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
00088     virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
00089     virtual BOOL IsSelected(const CObject* pDocItem) const;// Container support
00090     //}}AFX_VIRTUAL
00091
00092 // Implementation
00093 public:
00094     virtual ~CWincvsView();
00095 #ifdef _DEBUG
00096     virtual void AssertValid() const;
00097     virtual void Dump(CDumpContext& dc) const;
00098 #endif
00099
00100 protected:
00101 #   define MAX_CHAR_BY_LINE 1024
00102     static char *sbuf;
00103     static int snumbuf;
00104     UINT fRtfFormat;
00105
00106     void FeedThisLine(const char *buf, int numbuf, bool isStderr);
00107
00108     virtual HRESULT QueryAcceptData(LPDATAOBJECT, CLIPFORMAT*, DWORD,
00109         BOOL, HGLOBAL);
00110
00111 // Generated message map functions
00112 protected:
00113     //{{AFX_MSG(CWincvsView)
00114     afx_msg void OnDestroy();
00115     afx_msg void OnSetFocus(CWnd* pOldWnd);
00116     afx_msg void OnSize(UINT nType, int cx, int cy);
00117     afx_msg void OnMyFormatFont();
00118     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00119     afx_msg void OnDropFiles(HDROP hDropInfo);
00120     afx_msg void OnEditClearAll();
00121     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00122     afx_msg UINT OnGetDlgCode();
00123     //}}AFX_MSG
00124     DECLARE_MESSAGE_MAP()
00125 };
00126
00127 #ifndef _DEBUG  // debug version in wincvsView.cpp
00128 inline CWincvsDoc* CWincvsView::GetDocument()
00129    { return (CWincvsDoc*)m_pDocument; }
00130 #endif
00131
00133
00134 //{{AFX_INSERT_LOCATION}}
00135 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00136
00137 #endif // !defined(AFX_WINCVSVIEW_H__D2D77DD0_8299_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJBrowseEdit.cpp Source File

WinCvs/CJLib/CJLibrary/CJBrowseEdit.cpp

Go to the documentation of this file.
00001 // CJBrowseEdit.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:48 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJBrowseEdit.cpp $
00011  *
00012  * $History: CJBrowseEdit.cpp $
00013  *
00014  * *****************  Version 14  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:35p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Modified resource include for static builds.
00018  *
00019  * Fixed potential resource and memory leak problems.
00020  *
00021  * Made class methods virtual for inheritance purposes.
00022  *
00023  * *****************  Version 13  *****************
00024  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00025  * Updated in $/CodeJockey/CJLibrary
00026  * Updated copyright and contact information.
00027  *
00028  * *****************  Version 12  *****************
00029  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00030  * Updated in $/CodeJockey/CJLibrary
00031  * Added Unicode compliance, thanks to Barry Burton for his help with
00032  * this.
00033  *
00034  * *****************  Version 11  *****************
00035  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00036  * Updated in $/CodeJockey/CJLibrary
00037  *
00038  * *****************  Version 10  *****************
00039  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00040  * Updated in $/CodeJockey/CJLibrary
00041  *
00042  * *****************  Version 9  *****************
00043  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00044  * Updated in $/CodeJockey/CJLibrary
00045  *
00046  * *****************  Version 8  *****************
00047  * User: Kirk Stowell Date: 7/25/99    Time: 12:15a
00048  * Updated in $/CodeJockey/CJLibrary
00049  *
00050  * *****************  Version 7  *****************
00051  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00052  * Updated in $/CodeJockey/CJLibrary
00053  *
00054  * *****************  Version 6  *****************
00055  * User: Kirk Stowell Date: 6/25/99    Time: 11:03a
00056  * Updated in $/CodeJockey/CJLibrary
00057  * Chaned image list color mask and export macros.
00058  *
00059  * *****************  Version 5  *****************
00060  * User: Kirk Stowell Date: 6/14/99    Time: 10:41p
00061  * Updated in $/CodeJockey/CJ60Lib
00062  * Cleaned up control and pointer initialization, creation and activation.
00063  * Added support for CCJMenu popup.
00064  *
00065  * *****************  Version 4  *****************
00066  * User: Kirk Stowell Date: 6/01/99    Time: 11:57p
00067  * Updated in $/CodeJockey/CJ60Lib
00068  * Minor fix with build using error level 4 warning.
00069  *
00070  * *****************  Version 3  *****************
00071  * User: Kirk Stowell Date: 5/29/99    Time: 12:53a
00072  * Updated in $/CodeJockey/CJ60Lib
00073  * Changed reference to CCJShellFile to CCJShell, to reflect class
00074  * renaming.
00075  *
00076  * *****************  Version 2  *****************
00077  * User: Kirk Stowell Date: 4/03/99    Time: 10:54p
00078  * Updated in $/CodeJockey/CJ60Lib
00079  * Added comments and cleaned up code.
00080  *
00081  * *****************  Version 1  *****************
00082  * User: Kirk Stowell Date: 1/16/99    Time: 10:53p
00083  * Created in $/CodeJockey/CJ60Lib
00084  * Initial release.
00085  *
00086  ***************************************************************************/
00088
00089 #include "stdafx.h"
00090 #include "CJBrowseEdit.h"
00091 #include "CJShell.h"
00092 #include "CJMenu.h"        // CCJMenu class declaration
00093 #include "CJResource.h"
00094
00095 #ifdef _DEBUG
00096 #define new DEBUG_NEW
00097 #undef THIS_FILE
00098 static char THIS_FILE[] = __FILE__;
00099 #endif
00100
00102 // CCJBrowseButton class
00104
00105 CCJBrowseButton::CCJBrowseButton()
00106 {
00107     m_pParentWnd = NULL;
00108     m_pEditWnd   = NULL;
00109     m_hIcon      = NULL;
00110 }
00111
00112 CCJBrowseButton::~CCJBrowseButton()
00113 {
00114     // fix potential resource leak - KStowell - 10-22-99.
00115     m_Font.DeleteObject();
00116     _destroyIcon(m_hIcon);
00117 }
00118
00119 BEGIN_MESSAGE_MAP(CCJBrowseButton, CButton)
00120     //{{AFX_MSG_MAP(CCJBrowseButton)
00121     ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
00122     //}}AFX_MSG_MAP
00123 END_MESSAGE_MAP()
00124
00125 BOOL CCJBrowseButton::Create(CWnd* pWnd, BROWSE_TYPE eType, UINT nMenu, UINT nSubMenuIndx)
00126 {
00127     ASSERT( eType );
00128     ASSERT_VALID( pWnd );
00129     ASSERT_VALID( pWnd->GetParent() );
00130
00131     m_pEditWnd      = pWnd;
00132     m_pParentWnd    = m_pEditWnd->GetParent();
00133     m_eType         = eType;
00134     m_nMenu         = nMenu;
00135     m_nSubMenuIndx  = nSubMenuIndx;
00136
00137     CRect rc;
00138     m_pEditWnd->GetWindowRect( &rc );
00139     m_pEditWnd->SetWindowPos( NULL, 0, 0, rc.Width()-23, rc.Height(), SWP_NOZORDER|SWP_NOMOVE );
00140     m_pParentWnd->ScreenToClient( &rc );
00141     rc.left = rc.right-18;
00142
00143     DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_CENTER|BS_VCENTER;
00144
00145     // if this is a browse for directory or file edit control.
00146     if(( m_eType == BT_DIRECTORY ) || ( m_eType == BT_FILE ))
00147     {
00148         if( !CButton::Create(_T("..."), dwStyle, rc, m_pParentWnd, GetNextID( m_pParentWnd )))
00149         {
00150             TRACE0( "Failed to create browse edit browse button.\n" );
00151             return FALSE;
00152         }
00153
00154         // set the tab order and font, enable the window based on parent's state.
00155         SetWindowPos( m_pEditWnd, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE );
00156         EnableWindow( m_pEditWnd->IsWindowEnabled( ));
00157         UpdateFont();
00158
00159         return TRUE;
00160     }
00161
00162     // if this is a popup menu edit control.
00163     else if( m_eType == BT_POPUPMENU )
00164     {
00165         if( !CButton::Create( NULL, dwStyle|BS_ICON, rc, m_pParentWnd, GetNextID( m_pParentWnd )))
00166         {
00167             TRACE0( "Failed to create browse edit browse button.\n" );
00168             return FALSE;
00169         }
00170
00171         // set the tab order and font, enable the window based on parent's state.
00172         SetWindowPos( m_pEditWnd, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE );
00173         EnableWindow( m_pEditWnd->IsWindowEnabled( ));
00174         UpdateFont();
00175
00176         // create the icon arrow that is displayed on the button.
00177         CImageList imageList;
00178         CBitmap    bitmap;
00179
00180         bitmap.LoadBitmap( IDB_BTN_ARROW );
00181         imageList.Create( 15, 17, ILC_COLORDDB|ILC_MASK, 1, 1 );
00182         imageList.Add( &bitmap, RGB( 255,0,255 ));
00183
00184         // set the icon and free resources.
00185         // fix potential resource leak - KStowell - 10-22-99.
00186         m_hIcon = imageList.ExtractIcon( 0 );
00187         SetIcon(m_hIcon);
00188         imageList.Detach();
00189         bitmap.DeleteObject();
00190
00191         return TRUE;
00192     }
00193
00194     return FALSE;
00195 }
00196
00197 void CCJBrowseButton::OnClicked()
00198 {
00199     if( m_eType == BT_DIRECTORY )
00200     {
00201         CCJShell sfi;
00202         sfi.m_strTitle = m_strTitle;
00203
00204         if( sfi.BrowseForFolder( m_pParentWnd ) == IDOK ) {
00205             m_pEditWnd->SetWindowText( sfi.m_strPath );
00206         }
00207     }
00208
00209     else if( m_eType == BT_FILE )
00210     {
00211         CFileDialog dlg( m_bOpenFileDialog, m_strDefExt, m_strFileName,
00212             m_dwFlags, m_strFilter, m_pParentWnd );
00213
00214         if( dlg.DoModal() == IDOK ) {
00215             m_pEditWnd->SetWindowText( dlg.GetPathName( ));
00216         }
00217     }
00218
00219     else if( m_eType == BT_POPUPMENU )
00220     {
00221         ASSERT( m_nMenu != 0 );
00222         SetState( true );
00223
00224         CRect rc;
00225         GetWindowRect( &rc );
00226
00227         CMenu menu;
00228         VERIFY( menu.LoadMenu( m_nMenu ));
00229
00230         CCJMenu* pPopup = (CCJMenu*)menu.GetSubMenu( m_nSubMenuIndx );
00231         ASSERT( pPopup != NULL );
00232
00233         pPopup->TrackPopupMenu( TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL,
00234             rc.right, rc.top, m_pParentWnd, &rc );
00235
00236         // Return the button state to normal.
00237         SetState( false );
00238     }
00239 }
00240
00241 void CCJBrowseButton::UpdateFont()
00242 {
00243     m_Font.DeleteObject();
00244     NONCLIENTMETRICS ncm;
00245     ncm.cbSize = sizeof(ncm);
00246     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00247     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00248     SetFont(&m_Font);
00249 }
00250
00252 // CCJBrowseEdit
00253
00254 CCJBrowseEdit::CCJBrowseEdit() : m_eType( BT_DIRECTORY ), m_nMenu( (UINT)-1 )
00255 {
00256
00257 }
00258
00259 CCJBrowseEdit::~CCJBrowseEdit()
00260 {
00261 }
00262
00263 BEGIN_MESSAGE_MAP(CCJBrowseEdit, CEdit)
00264     //{{AFX_MSG_MAP(CCJBrowseEdit)
00265     ON_WM_ENABLE()
00266     ON_WM_SHOWWINDOW()
00267     ON_WM_CREATE()
00268     //}}AFX_MSG_MAP
00269 END_MESSAGE_MAP()
00270
00272 // CCJBrowseEdit message handlers
00273
00274 void CCJBrowseEdit::OnEnable(BOOL bEnable)
00275 {
00276     CEdit::OnEnable(bEnable);
00277     m_btnBrowse.EnableWindow(bEnable);
00278 }
00279
00280 void CCJBrowseEdit::OnShowWindow(BOOL bShow, UINT nStatus)
00281 {
00282     CEdit::OnShowWindow( bShow, nStatus );
00283     m_btnBrowse.ShowWindow( bShow?SW_SHOW:SW_HIDE );
00284 }
00285
00286 void CCJBrowseEdit::PreSubclassWindow()
00287 {
00288     CEdit::PreSubclassWindow();
00289
00290     // initialize control to defaults.
00291     InitializeControl();
00292 }
00293
00294 int CCJBrowseEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
00295 {
00296     if (CEdit::OnCreate(lpCreateStruct) == -1)
00297         return -1;
00298
00299     // initialize control to defaults.
00300     InitializeControl();
00301
00302     return 0;
00303 }
00304
00305 void CCJBrowseEdit::InitializeControl()
00306 {
00307     // create the browse button associated with this control.
00308     if( m_btnBrowse.Create( this, m_eType, m_nMenu, m_nSubMenuIndx ))
00309     {
00310         // initialize some defaults
00311         SetDlgOpenFile();
00312         SetDlgDefExt( _T( "*.*" ));
00313         SetDlgFileName();
00314         SetDlgStyle( OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_EXPLORER );
00315         SetDlgFilter( _T( "All Files (*.*)|*.*||" ));
00316         SetDlgOwner( GetParent( ));
00317         SetDlgTitle( _T( "Select Folder" ));
00318     }
00319 }
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJCaption.cpp Source File

WinCvs/CJLib/CJLibrary/CJCaption.cpp

Go to the documentation of this file.
00001 // CJCaption.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:48 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJCaption.cpp $
00011  *
00012  * $History: CJCaption.cpp $
00013  *
00014  * *****************  Version 17  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:41p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Updated OnEraseBkgnd(...) and OnPaint() for flicker free drawing.
00018  *
00019  * Fixed bug when popup window is closed, the mainframe resizes and then
00020  * the popup is reopened and pushpin is pressed, the child will not be
00021  * correctly sized and positioned. Added changes to handle flicker free
00022  * drawing of the control window.
00023  *
00024  * Modified resource include for static builds.
00025  *
00026  * Fixed the bug where the icon on the right hand side of the bar doesn't
00027  * clip when you resize the bar to almost nothing. Added method
00028  * SetTextStyle(...) to set the CDC:: DrawText(...) text styles to be user
00029  * defined. Thanks to Adrian for help with this.
00030  *
00031  * Fixed potential resource and memory leak problems.
00032  *
00033  * Fixed small bug with UNICODE display placing unwanted character at the
00034  * end of the string.
00035  *
00036  * Made class methods virtual for inheritance purposes.
00037  *
00038  * *****************  Version 16  *****************
00039  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00040  * Updated in $/CodeJockey/CJLibrary
00041  * Updated copyright and contact information.
00042  *
00043  * *****************  Version 15  *****************
00044  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00045  * Updated in $/CodeJockey/CJLibrary
00046  * Added Unicode compliance, thanks to Barry Burton for his help with
00047  * this.
00048  *
00049  * *****************  Version 14  *****************
00050  * User: Kirk Stowell Date: 6/23/99    Time: 12:36a
00051  * Updated in $/CodeJockey/CJLibrary
00052  *
00053  * *****************  Version 13  *****************
00054  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00055  * Updated in $/CodeJockey/CJLibrary
00056  *
00057  * *****************  Version 12  *****************
00058  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00059  * Updated in $/CodeJockey/CJLibrary
00060  *
00061  * *****************  Version 11  *****************
00062  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00063  * Updated in $/CodeJockey/CJLibrary
00064  *
00065  * *****************  Version 10  *****************
00066  * User: Kirk Stowell Date: 7/25/99    Time: 12:15a
00067  * Updated in $/CodeJockey/CJLibrary
00068  *
00069  * *****************  Version 9  *****************
00070  * User: Kirk Stowell Date: 7/24/99    Time: 9:32p
00071  * Updated in $/CodeJockey/CJLibrary
00072  *
00073  * *****************  Version 6  *****************
00074  * User: Kirk Stowell Date: 7/08/99    Time: 2:43a
00075  * Updated in $/CodeJockey/CJLibrary
00076  * Amundsen - Eirik [eirik.amundsen@siemens.no] - Fixed problem with
00077  * caption repainting when banner is smaller than displayed text.
00078  *
00079  * *****************  Version 5  *****************
00080  * User: Kirk Stowell Date: 5/17/99    Time: 8:13p
00081  * Updated in $/CodeJockey/CJ60Lib
00082  * Fixed painting bug with border, cleaned up inline methods.
00083  *
00084  * *****************  Version 4  *****************
00085  * User: Kirk Stowell Date: 4/03/99    Time: 12:35p
00086  * Updated in $/Code Jockey/CJ60Lib
00087  * Added comments and cleaned up code.
00088  *
00089  * *****************  Version 3  *****************
00090  * User: Kirk Stowell Date: 3/03/99    Time: 12:27p
00091  * Updated in $/CodeJockey/CJ60Lib
00092  * Added further functionality to class so that you can define text size,
00093  * text color, border size, border and background color. Basically to
00094  * create a look similar to Outlook's Captions.
00095  *
00096  * *****************  Version 2  *****************
00097  * User: Kirk Stowell Date: 2/01/99    Time: 12:28p
00098  * Updated in $/CodeJockey/CJ60Lib
00099  * Made some cosmetic fixes.
00100  *
00101  * *****************  Version 1  *****************
00102  * User: Kirk Stowell Date: 1/16/99    Time: 12:27p
00103  * Created in $/CodeJockey/CJ60Lib
00104  * Initial first release.
00105  *
00106  ***************************************************************************/
00108
00109 #include "StdAfx.h"
00110 #include "CJResource.h"
00111 #include "CJCaption.h"
00112 #include "CJCaptionPopupWnd.h"
00113
00114 #ifdef _DEBUG
00115 #define new DEBUG_NEW
00116 #undef THIS_FILE
00117 static char THIS_FILE[] = __FILE__;
00118 #endif
00119
00121 // CCJCaptionButton
00122
00123 BEGIN_MESSAGE_MAP(CCJCaptionButton, CCJFlatButton)
00124     //{{AFX_MSG_MAP(CCJCaptionButton)
00125     //}}AFX_MSG_MAP
00126 END_MESSAGE_MAP()
00127
00128 BOOL CCJCaptionButton::SetButtonStyle(CFont* pFont, COLORREF clrBackground, COLORREF clrFont)
00129 {
00130     m_pFont = pFont;
00131     SetAlternateColors(clrBackground, m_clrHilite, m_clrDkShad, clrFont);
00132     return TRUE;
00133 }
00134
00135 void CCJCaptionButton::DrawButtonText(CDC* pDC, UINT nState, CRect& rcItem)
00136 {
00137     // Get the window text, return if empty.
00138     CString strWindowText; GetWindowText(strWindowText);
00139     if( strWindowText.IsEmpty( ))
00140         return;
00141
00142     if( m_pFont == NULL ) {
00143         m_pFont = &m_Font;
00144     }
00145
00146     CRect rc = rcItem;
00147     rc.DeflateRect( 5,0 );
00148
00149     // Set the text color and select the button font.
00150     pDC->SetTextColor(( nState & ODS_DISABLED )?m_clrTextGy:m_clrTextNm);
00151     CFont *oldFont = pDC->SelectObject( m_pFont );
00152
00153     // get the height of the text to be displayed.
00154     int cy = pDC->DrawText( strWindowText, -1, rc, DT_SINGLELINE|DT_CALCRECT );
00155     rc.top = (rcItem.Height()-cy)/2;
00156
00157     // draw the text, and select the original font.
00158     pDC->DrawState( rc.TopLeft(), strWindowText.GetLength(), strWindowText,
00159         ( nState & ODS_DISABLED )?DSS_DISABLED:DSS_NORMAL, TRUE, 0, (HBRUSH)NULL );
00160
00161     // Set up pen to use for drawing the triangle
00162     CPen pen(PS_SOLID, 1, m_clrTextNm);
00163     CPen *pOldPen = pDC->SelectObject( &pen );
00164
00165     // get the client rect.
00166     CRect rcWnd;
00167     GetClientRect(&rcWnd);
00168
00169     // initialize coordinates for triangle.
00170     int x1 = rcWnd.right-11;
00171     int x2 = rcWnd.right-6;
00172     int y1 = rcWnd.bottom-7;
00173     int y2 = rcWnd.bottom-5;
00174
00175     // draw the triangle.
00176     pDC->MoveTo( x1, y1 );
00177     pDC->LineTo( x2, y1 );
00178     pDC->MoveTo( x1+1, y1+1 );
00179     pDC->LineTo( x2-1, y1+1 );
00180     pDC->SetPixel( x1+2, y2, m_clrTextNm );
00181
00182     // restore old pen and font.
00183     pDC->SelectObject( oldFont );
00184     pDC->SelectObject( pOldPen );
00185
00186     // fix potential resource leak - KStowell - 10-21-99
00187     pen.DeleteObject();
00188 }
00189
00191 // CCJCaption
00192
00193 CCJCaption::CCJCaption()
00194 {
00195     m_strWindText   = _T("");
00196     m_pNotifyWnd    = NULL;
00197     m_pWndPopDown   = NULL;
00198     m_pChildWnd     = NULL;
00199     m_cx            = ::GetSystemMetrics(SM_CXSMICON);
00200     m_cy            = ::GetSystemMetrics(SM_CYSMICON);
00201     m_clrBtnHilite  = ::GetSysColor(COLOR_BTNHILIGHT);
00202     m_clrBtnShadow  = ::GetSysColor(COLOR_BTNSHADOW);
00203     m_clrBtnFace    = ::GetSysColor(COLOR_BTNFACE);
00204     m_clrFont       = ::GetSysColor(COLOR_WINDOWTEXT);
00205     m_clrBorder     = ::GetSysColor(COLOR_BTNFACE);
00206     m_clrBackgnd    = ::GetSysColor(COLOR_BTNFACE);
00207     m_nBorder       = 0;
00208     m_pFont         = NULL;
00209     m_hIcon         = NULL;
00210
00211     SetTextStyle( DT_SINGLELINE|DT_END_ELLIPSIS );
00212 }
00213
00214 CCJCaption::~CCJCaption()
00215 {
00216     // fix potential resource leak - KStowell - 10-22-99.
00217     m_Font.DeleteObject();
00218 }
00219
00220 BEGIN_MESSAGE_MAP(CCJCaption, CStatic)
00221     //{{AFX_MSG_MAP(CCJCaption)
00222     ON_WM_PAINT()
00223     ON_WM_SYSCOLORCHANGE()
00224     ON_WM_SIZE()
00225     ON_WM_ERASEBKGND()
00226     //}}AFX_MSG_MAP
00227     ON_BN_CLICKED(IDC_CAPT_BUTTON, OnCaptButton)
00228     ON_MESSAGE(CM_ONPUSHPINBUTTON, OnPushPinButton)
00229     ON_MESSAGE(CM_ONPUSHPINCANCEL, OnPushPinCancel)
00230 END_MESSAGE_MAP()
00231
00233 // CCJCaption message handlers
00234
00235 void CCJCaption::OnPaint()
00236 {
00237     CPaintDC dc(this); // device context for painting
00238
00239     // KStowell - Get the client rect.
00240     CRect rcClient;
00241     GetClientRect( &rcClient );
00242
00243     // KStowell - Create a memory device-context. This is done to help reduce
00244     // screen flicker, since we will paint the entire control to the
00245     // off screen device context first.
00246     CDC memDC;
00247     CBitmap bitmap;
00248     memDC.CreateCompatibleDC(&dc);
00249     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00250     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00251     memDC.FillSolidRect( rcClient, m_clrBtnFace );
00252
00253     // First let the control do its default drawing.
00254     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00255
00256     // draw the backgound, text and icon.
00257     DrawCaptionBack( &memDC, rcClient );
00258     DrawCaptionText( &memDC, rcClient );
00259     DrawCaptionIcon( &memDC, rcClient );
00260
00261     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00262     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00263
00264     // KStowell - Cleanup resources.
00265     memDC.SelectObject(pOldBitmap);
00266     memDC.DeleteDC();
00267     bitmap.DeleteObject();
00268 }
00269
00270 void CCJCaption::DrawCaptionBack(CDC* pDC, CRect& rcItem)
00271 {
00272     CRect rc = rcItem;
00273
00274     // Set the background mode to transparent.
00275     pDC->SetBkMode( TRANSPARENT );
00276
00277     // repaint the background.
00278     pDC->FillSolidRect( rc, m_clrBtnFace );
00279
00280     // draw the caption border.
00281     if( m_dwExStyle & WS_EX_FLATEDGE ) {
00282         pDC->Draw3dRect(rc, m_clrBtnHilite, m_clrBtnShadow);
00283     }
00284
00285     // draw the caption banner border.
00286     if( m_nBorder != 0 ) {
00287         rc.DeflateRect( m_nBorder, m_nBorder );
00288         pDC->FillSolidRect(rc, m_clrBackgnd);
00289     }
00290 }
00291
00292 void CCJCaption::DrawCaptionText(CDC* pDC, CRect& rcItem)
00293 {
00294     // if the caption text is empty, return.
00295     if( m_strWindText.IsEmpty( ))
00296         return;
00297
00298     if( m_pFont == NULL ) {
00299         m_pFont = &m_Font;
00300     }
00301
00302     CRect rc = rcItem;
00303     rc.OffsetRect( 10,0 );
00304
00305     // Set the text color and select the caption font.
00306     pDC->SetTextColor( m_clrFont );
00307     CFont* oldFont = pDC->SelectObject( m_pFont );
00308
00309     // get the height of the text to be displayed.
00310     int cy = pDC->DrawText( m_strWindText, -1, rc, DT_SINGLELINE|DT_CALCRECT );
00311     rc.top = (rcItem.Height()-cy)/2;
00312     rc.bottom = rc.top+cy;
00313     rc.right  = rcItem.right-(m_cx + m_nBorder);
00314
00315     // draw the text, and select the original font.
00316     pDC->DrawText( m_strWindText, rc, m_dwTextStyle );
00317     pDC->SelectObject( oldFont );
00318 }
00319
00320 void CCJCaption::DrawCaptionIcon(CDC* pDC, CRect& rcItem)
00321 {
00322     // If no icon was defined, just return.
00323     if( m_hIcon == NULL )
00324         return;
00325
00326     CRect rc = rcItem;
00327     rc.left = ( rc.right - m_cx )-( m_nBorder + 2 );
00328
00329     // stop the icon at the left hand border
00330     if (rc.left < m_nBorder) {
00331         rc.left = m_nBorder;
00332     }
00333
00334     rc.top = ( rcItem.Height() - m_cy )/2;
00335     rc.right = rc.left + m_cx;
00336     rc.bottom = rc.top + m_cy;
00337
00338     // Only draw the icon if it will fit into the space between the borders
00339     if (rc.right < rcItem.right - m_nBorder) {
00340         // draw the icon associated with the caption.
00341         ::DrawIconEx( pDC->GetSafeHdc(), rc.left, rc.top, m_hIcon,
00342             rc.Width(), rc.Height(), NULL, (HBRUSH)NULL, DI_NORMAL);
00343     }
00344 }
00345
00346 void CCJCaption::OnSysColorChange()
00347 {
00348     CStatic::OnSysColorChange();
00349
00350     m_clrBtnHilite = ::GetSysColor(COLOR_BTNHILIGHT);
00351     m_clrBtnShadow = ::GetSysColor(COLOR_BTNSHADOW);
00352     m_clrBtnFace   = ::GetSysColor(COLOR_BTNFACE);
00353 }
00354
00355 BOOL CCJCaption::Create(CWnd* pParentWnd, LPCTSTR lpszWindowName, DWORD dwExStyle, DWORD dwStyle, const CRect& rect, UINT nID)
00356 {
00357     // Let the base class create the control.
00358     if( !CStatic::Create( NULL, dwStyle, rect, pParentWnd, nID ))
00359     {
00360         TRACE(_T("Unable to create caption.\n"));
00361         return FALSE;
00362     }
00363
00364     UpdateFont();
00365
00366     // save the style.
00367     if( dwExStyle & WS_EX_FLATEDGE ) {
00368         m_dwExStyle = dwExStyle;
00369     }
00370
00371     else {
00372         ModifyStyleEx( 0, dwExStyle );
00373     }
00374
00375     // Save the window text.
00376     m_strWindText = lpszWindowName;
00377
00378     // Create the button to be used with child window.
00379     if( !m_CaptionButton.Create( m_strWindText, BS_ICON|BS_OWNERDRAW|BS_VCENTER,
00380         CRect(0,0,0,0), this, IDC_CAPT_BUTTON ))
00381     {
00382         TRACE0( "Unable to create caption button.\n" );
00383         return FALSE;
00384     }
00385
00386     // set the button font and colors.
00387     m_CaptionButton.SetButtonStyle( m_pFont, m_clrBackgnd, m_clrFont );
00388
00389     return TRUE;
00390 }
00391
00392 void CCJCaption::ModifyCaptionStyle(int nBorderSize, CFont* pFont, LPCTSTR lpszWindText, HICON hIcon)
00393 {
00394     ASSERT(::IsWindow(m_hWnd));
00395
00396     if( nBorderSize ) {
00397         m_nBorder = nBorderSize;
00398     }
00399
00400     if( pFont ) {
00401         m_pFont = pFont;
00402         m_CaptionButton.SetButtonStyle( m_pFont, m_clrBackgnd, m_clrFont );
00403     }
00404
00405     if( lpszWindText ) {
00406         m_strWindText = lpszWindText;
00407     }
00408
00409     if( hIcon ) {
00410         m_hIcon = hIcon;
00411     }
00412
00413     Invalidate();
00414 }
00415
00416 void CCJCaption::SetChildWindow(CWnd* pChild, CWnd* pNotifyWnd)
00417 {
00418     ASSERT( pChild != NULL );       // must be valid.
00419     ASSERT( pNotifyWnd != NULL );   // must be valid.
00420
00421     // save window pointers, and show caption button.
00422     m_pChildWnd  = pChild;
00423     m_pNotifyWnd = pNotifyWnd;
00424
00425     // set the size of the child window.
00426     m_pChildWnd->GetWindowRect(&m_rcChild);
00427
00428     CRect rcClient;
00429     m_pChildWnd->GetParent()->GetClientRect(&rcClient);
00430     m_nOffset = rcClient.Height()-m_rcChild.Height();
00431
00432     m_CaptionButton.ModifyStyle( 0, WS_VISIBLE );
00433     Invalidate();
00434 }
00435
00436 void CCJCaption::KillChildWindow()
00437 {
00438     m_CaptionButton.SetState(FALSE);
00439     m_CaptionButton.ModifyStyle( WS_VISIBLE, 0 );
00440     m_pWndPopDown->DestroyWindow();
00441     _delete( m_pWndPopDown );
00442 }
00443
00444 void CCJCaption::OnSize(UINT nType, int cx, int cy)
00445 {
00446     CStatic::OnSize(nType, cx, cy);
00447
00448     if( m_CaptionButton.GetSafeHwnd())
00449     {
00450         CDC* pDC = GetDC();
00451         CFont* pOldFont = pDC->SelectObject(m_pFont);
00452
00453         TEXTMETRIC tm;
00454         pDC->GetTextMetrics(&tm);
00455
00456         CSize size = pDC->GetTextExtent(m_strWindText, m_strWindText.GetLength());
00457         size.cx += tm.tmAveCharWidth+21;
00458         pDC->SelectObject(pOldFont);
00459         ReleaseDC(pDC);
00460
00461         CRect rc( 0, 0, size.cx, cy );
00462         rc.DeflateRect(m_nBorder+1, m_nBorder+1);
00463         m_CaptionButton.MoveWindow(rc);
00464     }
00465 }
00466
00467 void CCJCaption::OnCaptButton()
00468 {
00469     CRect rc;
00470     m_CaptionButton.GetWindowRect(&rc);
00471     rc.right  = rc.left + m_rcChild.Width();
00472     rc.top    = rc.bottom;
00473     rc.bottom = rc.top + m_rcChild.Height();
00474
00475     //if window is already present delete it
00476     _delete( m_pWndPopDown );
00477
00478     // Get the class name and create the window
00479     m_pWndPopDown = new CCJCaptionPopupWnd;
00480     m_pWndPopDown->Create( rc, this, m_pChildWnd );
00481     m_pChildWnd->ShowWindow(SW_SHOW);
00482     m_CaptionButton.SetState(TRUE);
00483 }
00484
00485 void CCJCaption::OnPushPinButton(UINT lParam, LONG wParam)
00486 {
00487     UNUSED_ALWAYS( lParam );
00488     UNUSED_ALWAYS( wParam );
00489
00490     KillChildWindow();
00491     m_pNotifyWnd->SendMessage(CM_ONPUSHPINBUTTON, 0, 0);
00492     m_pChildWnd->GetParent()->GetClientRect(&m_rcChild);
00493     if(m_nOffset>0) {
00494         m_rcChild.top += m_nOffset;
00495     }
00496     m_pChildWnd->MoveWindow(m_rcChild);
00497     Invalidate();
00498 }
00499
00500 void CCJCaption::OnPushPinCancel(UINT lParam, LONG wParam)
00501 {
00502     UNUSED_ALWAYS( lParam );
00503     UNUSED_ALWAYS( wParam );
00504
00505     m_CaptionButton.SetState(FALSE);
00506     m_pWndPopDown->DestroyWindow();
00507
00508     _delete( m_pWndPopDown );
00509
00510     m_pNotifyWnd->SendMessage(CM_ONPUSHPINCANCEL, 0, 0);
00511 }
00512
00513 void CCJCaption::UpdateCaption(LPCTSTR lpszWindowText, HICON hIcon)
00514 {
00515     ASSERT(::IsWindow(m_hWnd));
00516
00517     CRect rcClient;
00518     GetClientRect(&rcClient);
00519     CDC* pDC = GetDC();
00520
00521     UpdateCaptionBack(pDC, rcClient);
00522
00523     if( lpszWindowText )
00524     {
00525         m_strWindText = lpszWindowText;
00526         UpdateCaptionText(pDC, rcClient);
00527     }
00528
00529     if( hIcon ) {
00530         m_hIcon = hIcon;
00531         DrawCaptionIcon( pDC, rcClient );
00532     }
00533
00534     ReleaseDC(pDC);
00535 }
00536
00537 void CCJCaption::UpdateCaptionBack(CDC* pDC, CRect& rcItem)
00538 {
00539     CRect rc = rcItem;
00540
00541     // Set the background mode to transparent.
00542     pDC->SetBkMode( TRANSPARENT );
00543
00544     rc.DeflateRect(1,1);
00545     // repaint the background.
00546     pDC->FillSolidRect( rc, m_clrBtnFace );
00547
00548     // draw the caption banner border.
00549     if( m_nBorder != 0 ) {
00550         rc.DeflateRect( m_nBorder-1, m_nBorder-1 );
00551         pDC->FillSolidRect(rc, m_clrBackgnd);
00552     }
00553 }
00554
00555 void CCJCaption::UpdateCaptionText(CDC* pDC, CRect& rcItem)
00556 {
00557     CFont* pOldFont = pDC->SelectObject(m_pFont);
00558
00559     TEXTMETRIC tm;
00560     pDC->GetTextMetrics(&tm);
00561
00562     CSize size = pDC->GetTextExtent(m_strWindText, m_strWindText.GetLength());
00563     size.cx += tm.tmAveCharWidth+21;
00564     pDC->SelectObject(pOldFont);
00565
00566     CRect rc( 0, 0, size.cx, rcItem.Height() );
00567     rc.DeflateRect(m_nBorder+1, m_nBorder+1);
00568     m_CaptionButton.MoveWindow(rc);
00569     m_CaptionButton.SetWindowText(m_strWindText);
00570
00571     DrawCaptionText( pDC, rcItem );
00572 }
00573
00574 void CCJCaption::UpdateFont()
00575 {
00576     m_Font.DeleteObject();
00577     NONCLIENTMETRICS ncm;
00578     ncm.cbSize = sizeof(ncm);
00579     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00580     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00581     m_pFont = &m_Font;
00582 }
00583
00584 BOOL CCJCaption::OnEraseBkgnd(CDC* pDC)
00585 {
00586     // KStowell - overridden for flicker-free drawing.
00587     UNUSED_ALWAYS(pDC);
00588     return TRUE;
00589 }
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJCaptionPopupWnd.cpp Source File

WinCvs/CJLib/CJLibrary/CJCaptionPopupWnd.cpp

Go to the documentation of this file.
00001 // CJCaptionPopupWnd.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:48 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJCaptionPopupWnd.cpp $
00011  *
00012  * $History: CJCaptionPopupWnd.cpp $
00013  *
00014  * *****************  Version 5  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:43p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Modified resource include for static builds.
00018  *
00019  * Fixed potential resource and memory leak problems.
00020  *
00021  * *****************  Version 4  *****************
00022  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00023  * Updated in $/CodeJockey/CJLibrary
00024  * Updated copyright and contact information.
00025  *
00026  * *****************  Version 3  *****************
00027  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00028  * Updated in $/CodeJockey/CJLibrary
00029  * Added Unicode compliance, thanks to Barry Burton for his help with
00030  * this.
00031  *
00032  * *****************  Version 2  *****************
00033  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00034  * Updated in $/CodeJockey/CJLibrary
00035  *
00036  * *****************  Version 1  *****************
00037  * User: Kirk Stowell Date: 7/14/99    Time: 9:46p
00038  * Created in $/CodeJockey/CJLibrary
00039  * Initial creation. Added popup class as a helper class for the
00040  * CCJCaption class. This class is used to display a popup window which
00041  * contains a child CWnd derived object.
00042  *
00043  ***************************************************************************/
00045
00046
00047 #include "stdafx.h"
00048 #include "CJResource.h"
00049 #include "CJCaptionPopupWnd.h"
00050
00051 #ifdef _DEBUG
00052 #define new DEBUG_NEW
00053 #undef THIS_FILE
00054 static char THIS_FILE[] = __FILE__;
00055 #endif
00056
00058 // CCJCaptionPopupWnd
00059
00060 CCJCaptionPopupWnd::CCJCaptionPopupWnd()
00061 {
00062     m_pChildWnd     = NULL;
00063     m_pChildParent  = NULL;
00064     m_pParentWnd    = NULL;
00065     m_hIconOn       = NULL;
00066     m_hIconOff      = NULL;
00067 }
00068
00069 CCJCaptionPopupWnd::~CCJCaptionPopupWnd()
00070 {
00071     // fix potential resource leak - KStowell - 10-22-99.
00072     _destroyIcon(m_hIconOn);
00073     _destroyIcon(m_hIconOff);
00074     DestroyWindow();
00075 }
00076
00077 BEGIN_MESSAGE_MAP(CCJCaptionPopupWnd, CWnd)
00078     //{{AFX_MSG_MAP(CCJCaptionPopupWnd)
00079     ON_WM_DESTROY()
00080     ON_BN_CLICKED(IDC_CAPT_BUTTON, OnCaptButton)
00081     ON_WM_PAINT()
00082     ON_WM_TIMER()
00083     //}}AFX_MSG_MAP
00084 END_MESSAGE_MAP()
00085
00087 // CCJCaptionPopupWnd message handlers
00088
00089 BOOL CCJCaptionPopupWnd::Create(const CRect& rect, CWnd* pParentWnd, CWnd* pChildWnd)
00090 {
00091     ASSERT(pParentWnd != NULL); // must be valid.
00092     m_pParentWnd = pParentWnd;
00093
00094     ASSERT(pChildWnd  != NULL); // must be valid.
00095     m_pChildWnd = pChildWnd;
00096
00097     // register the wnd class.
00098     CString wndClass = ::AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW,
00099         0, ::GetSysColorBrush(COLOR_BTNFACE));
00100
00101     // define the styles for this window.
00102     DWORD dwStyleEx = WS_EX_TOOLWINDOW;
00103     DWORD dwStyle   = WS_VISIBLE|WS_POPUP|WS_DLGFRAME;
00104
00105     // call the base class for creation.
00106     if( !CWnd::CreateEx( dwStyleEx, wndClass, _T(""), dwStyle, rect.left, rect.top,
00107         rect.Width(), rect.Height(), pParentWnd->GetSafeHwnd(), 0, NULL ))
00108     {
00109         TRACE0( "Failed to create caption popdown window.\n" );
00110         return FALSE;
00111     }
00112
00113     // set the child windows parent to this popup window, save
00114     // the previous parent, since we need to reset this when the
00115     // window is destroyed.
00116     m_pChildParent = m_pChildWnd->SetParent(this);
00117     ASSERT(m_pChildParent != NULL);
00118
00119     // define the caption and client rect.
00120     CRect rcClient;
00121     GetClientRect(&rcClient);
00122     rcClient.DeflateRect(2,2);
00123     CRect rcCapt( rcClient );
00124
00125     // move the window to fit the client area of this window.
00126     rcClient.top += 19;
00127     m_pChildWnd->MoveWindow(rcClient);
00128
00129     // define the size for the push pin caption.
00130     rcCapt.bottom = rcCapt.top + 19;
00131
00132     // Create the caption.
00133     if( !m_Caption.Create( this, _T( "Click push pin to keep open" ), WS_EX_FLATEDGE,
00134         WS_VISIBLE|SS_CENTER|SS_CENTERIMAGE, rcCapt ))
00135     {
00136         TRACE0( "Unable to create caption.\n" );
00137         return FALSE;
00138     }
00139
00140     // define the size for the caption button.
00141     CRect rcButton( rcCapt );
00142     rcButton.DeflateRect(2,2);
00143     rcButton.left = rcButton.right - 16;
00144
00145     // Create the caption button.
00146     if( !m_CaptionButton.Create( NULL, WS_VISIBLE|BS_ICON|BS_OWNERDRAW|BS_CENTER|BS_VCENTER,
00147         rcButton, this, IDC_CAPT_BUTTON ))
00148     {
00149         TRACE0( "Unable to create caption button.\n" );
00150         return FALSE;
00151     }
00152
00153     CImageList imageList;
00154     imageList.Create(IDB_PUSHPIN, 16, 1, RGB(255,0,255));
00155
00156     // Associate the button icon
00157     m_hIconOff = imageList.ExtractIcon(0);
00158     m_hIconOn  = imageList.ExtractIcon(1);
00159     m_CaptionButton.SetIcon(m_hIconOff, m_hIconOn, CSize(16,15));
00160     imageList.DeleteImageList();
00161
00162     // start the timer after everything has been initialized.
00163     SetTimer(1, 10, NULL);
00164
00165     return TRUE;
00166 }
00167
00168 void CCJCaptionPopupWnd::OnDestroy()
00169 {
00170     // set the child window's parent back it's original parent.
00171     m_pChildWnd->SetParent(m_pChildParent);
00172     CWnd::OnDestroy();
00173 }
00174
00175 void CCJCaptionPopupWnd::OnCaptButton()
00176 {
00177     // send message to parent control that push pin button was pressed.
00178     m_pParentWnd->SendMessage(CM_ONPUSHPINBUTTON, 0, 0);
00179 }
00180
00181 void CCJCaptionPopupWnd::OnPaint()
00182 {
00183     CPaintDC dc(this); // device context for painting
00184
00185     CRect rc;
00186     GetClientRect(&rc);
00187     rc.DeflateRect(1,1);
00188
00189     // draw a border for the client area.
00190     dc.Draw3dRect( rc, ::GetSysColor(COLOR_BTNSHADOW),
00191         ::GetSysColor(COLOR_BTNHILIGHT));
00192 }
00193
00194 void CCJCaptionPopupWnd::OnTimer(UINT nIDEvent)
00195 {
00196     UNUSED_ALWAYS( nIDEvent );
00197
00198     // get a handle to the window which currently
00199     // has the input focus...
00200     HWND hWnd_HasFocus      = GetFocus()->GetSafeHwnd();
00201
00202     // get a handle to the caption, caption button, child window
00203     // and popup window...
00204     HWND hWnd_Caption       = m_Caption.GetSafeHwnd();
00205     HWND hWnd_CaptionButton = m_CaptionButton.GetSafeHwnd();
00206     HWND hWnd_Popup         = GetSafeHwnd();
00207     HWND hWnd_PopupChild    = m_pChildWnd->GetSafeHwnd();
00208
00209     // check to see if the window that has input focus is part
00210     // of the caption popup window, if not, send a message
00211     // to the parent control.
00212     if(( hWnd_HasFocus != hWnd_Caption ) &&
00213        ( hWnd_HasFocus != hWnd_CaptionButton ) &&
00214        ( hWnd_HasFocus != hWnd_Popup ) &&
00215        ( hWnd_HasFocus != hWnd_PopupChild ))
00216     {
00217         // send message to parent control that our popup window
00218         // has lost input focus.
00219         m_pParentWnd->SendMessage(CM_ONPUSHPINCANCEL, 0, 0);
00220     }
00221 }
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJColorPicker.cpp Source File

WinCvs/CJLib/CJLibrary/CJColorPicker.cpp

Go to the documentation of this file.
00001 // CJColorPicker.cpp : implementation file
00002 //
00003 // CJColorPicker is a drop-in Color picker control. Check out the
00004 // header file or the accompanying HTML doc file for details.
00005 //
00006 // Written by Chris Maunder (chrismaunder@codeguru.com)
00007 // Extended by Alexander Bischofberger (bischofb@informatik.tu-muenchen.de)
00008 // Copyright (c) 1998.
00009 //
00010 // This code may be used in compiled form in any way you desire. This
00011 // file may be redistributed unmodified by any means PROVIDING it is
00012 // not sold for profit without the authors written consent, and
00013 // providing that this notice and the authors name is included. If
00014 // the source code in  this file is used in any commercial application
00015 // then a simple email would be nice.
00016 //
00017 // This file is provided "as is" with no expressed or implied warranty.
00018 // The author accepts no liability if it causes any damage to your
00019 // computer, causes your pet cat to fall ill, increases baldness or
00020 // makes you car start emitting strange noises when you start it up.
00021 //
00022 // Expect bugs.
00023 //
00024 // Please use and enjoy. Please let me know of any bugs/mods/improvements
00025 // that you have found/implemented and I will fix/incorporate them into this
00026 // file.
00027 //
00028 // Updated 16 May 1998
00029 //         31 May 1998 - added Default text (CJM)
00030 //          9 Jan 1999 - minor vis update
00031 //
00033 /****************************************************************************
00034  *
00035  * $Date: 1999/11/30 21:45:48 $
00036  * $Revision: 1.1.1.3 $
00037  * $Archive: /CodeJock/CJLibrary/CJColorPicker.cpp $
00038  *
00039  * $History: CJColorPicker.cpp $
00040  *
00041  * *****************  Version 5  *****************
00042  * User: Kirk Stowell Date: 10/31/99   Time: 11:49p
00043  * Updated in $/CodeJock/CJLibrary
00044  * Overrode OnEraseBkgnd(...), OnPaint() and made modifications to
00045  * DrawItem(...) for flicker free drawing.
00046  *
00047  * Modified resource include for static builds.
00048  *
00049  * Added method CheckTextColor(...) which tests if the intensity of the
00050  * color is greater as 128. If the intensity < 128 => color is dark, so
00051  * the text must be light. Stephane Routelous
00052  * [routelous@cad-cam-concept.de]
00053  *
00054  * Fixed potential resource and memory leak problems.
00055  *
00056  * Removed un-necessary calls to GetParent(), a call is made only once at
00057  * initialization, to ensure we are working with a valid handle.
00058  *
00059  * Made class methods virtual for inheritance purposes.
00060  *
00061  * *****************  Version 4  *****************
00062  * User: Kirk Stowell Date: 10/14/99   Time: 12:22p
00063  * Updated in $/CodeJock/CJLibrary
00064  * Added source control history to file header.
00065  *
00066  ***************************************************************************/
00068
00069 #include "stdafx.h"
00070 #include "CJColorPopup.h"
00071 #include "CJColorPicker.h"
00072 #include "CJResource.h"
00073
00074 #ifdef _DEBUG
00075 #define new DEBUG_NEW
00076 #undef THIS_FILE
00077 static char THIS_FILE[] = __FILE__;
00078 #endif
00079
00080 void AFXAPI DDX_CJColorPicker(CDataExchange *pDX, int nIDC, COLORREF& crColor)
00081 {
00082     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
00083     ASSERT (hWndCtrl != NULL);
00084
00085     CCJColorPicker* pColorPicker = (CCJColorPicker*) CWnd::FromHandle(hWndCtrl);
00086     if (pDX->m_bSaveAndValidate)
00087     {
00088         crColor = pColorPicker->GetColor();
00089     }
00090     else // initializing
00091     {
00092         pColorPicker->SetColor(crColor);
00093     }
00094 }
00095
00097 // CCJColorPicker
00098
00099 CCJColorPicker::CCJColorPicker()
00100 {
00101     SetBkColor(GetSysColor(COLOR_3DFACE));
00102     SetTextColor(GetSysColor(COLOR_BTNTEXT));
00103
00104     m_bTrackSelection = FALSE;
00105     m_nSelectionMode = CP_MODE_BK;
00106     m_bActive = FALSE;
00107
00108 // 1999-06-11 begin mods KStowell
00109     m_strDefaultText.LoadString( IDS_COLOR_AUTO );
00110     m_strCustomText.LoadString( IDS_COLOR_CUST );
00111 // 1999-06-11 end mods KStowell
00112
00113 // 10-14-1999 - Kirk Stowell
00114     m_pParentWnd = NULL;
00115 }
00116
00117 CCJColorPicker::~CCJColorPicker()
00118 {
00119 }
00120
00121 IMPLEMENT_DYNCREATE(CCJColorPicker, CButton)
00122
00123 BEGIN_MESSAGE_MAP(CCJColorPicker, CButton)
00124     //{{AFX_MSG_MAP(CCJColorPicker)
00125     ON_CONTROL_REFLECT_EX(BN_CLICKED, OnClicked)
00126     ON_WM_CREATE()
00127     ON_WM_ERASEBKGND()
00128     ON_WM_PAINT()
00129     //}}AFX_MSG_MAP
00130     ON_MESSAGE(CPN_SELENDOK,     OnSelEndOK)
00131     ON_MESSAGE(CPN_SELENDCANCEL, OnSelEndCancel)
00132     ON_MESSAGE(CPN_SELCHANGE,    OnSelChange)
00133 END_MESSAGE_MAP()
00134
00136 // CCJColorPicker message handlers
00137
00138 LONG CCJColorPicker::OnSelEndOK(UINT lParam, LONG /*wParam*/)
00139 {
00140     COLORREF crNewColor = (COLORREF) lParam;
00141     m_bActive = FALSE;
00142     SetColor(crNewColor);
00143     //BEGIN SRO
00144     CheckTextColor(crNewColor);
00145     //END SRO
00146
00147     // 10-14-1999 - Kirk Stowell - Removed redundant calls to GetParent().
00148     if (m_pParentWnd) {
00149         m_pParentWnd->SendMessage(CPN_CLOSEUP, lParam, (WPARAM) GetDlgCtrlID());
00150         m_pParentWnd->SendMessage(CPN_SELENDOK, lParam, (WPARAM) GetDlgCtrlID());
00151     }
00152
00153     if (crNewColor != GetColor()) {
00154         if (m_pParentWnd) {
00155             m_pParentWnd->SendMessage(CPN_SELCHANGE, lParam, (WPARAM) GetDlgCtrlID());
00156         }
00157     }
00158
00159     return TRUE;
00160 }
00161
00162 LONG CCJColorPicker::OnSelEndCancel(UINT lParam, LONG /*wParam*/)
00163 {
00164     m_bActive = FALSE;
00165     SetColor((COLORREF) lParam);
00166     //BEGIN SRO
00167     CheckTextColor((COLORREF) lParam);
00168     //END SRO
00169
00170     // 10-14-1999 - Kirk Stowell - Removed redundant calls to GetParent().
00171     if (m_pParentWnd) {
00172         m_pParentWnd->SendMessage(CPN_CLOSEUP, lParam, (WPARAM) GetDlgCtrlID());
00173         m_pParentWnd->SendMessage(CPN_SELENDCANCEL, lParam, (WPARAM) GetDlgCtrlID());
00174     }
00175
00176     return TRUE;
00177 }
00178
00179 LONG CCJColorPicker::OnSelChange(UINT lParam, LONG /*wParam*/)
00180 {
00181     if (m_bTrackSelection) {
00182         SetColor((COLORREF) lParam);
00183         //BEGIN SRO
00184         CheckTextColor((COLORREF) lParam);
00185         //END SRO
00186     }
00187
00188     // 10-14-1999 - Kirk Stowell - Removed redundant calls to GetParent().
00189     if (m_pParentWnd) {
00190         m_pParentWnd->SendMessage(CPN_SELCHANGE, lParam, (WPARAM) GetDlgCtrlID());
00191     }
00192
00193     return TRUE;
00194 }
00195
00196 int CCJColorPicker::OnCreate(LPCREATESTRUCT lpCreateStruct)
00197 {
00198     if (CButton::OnCreate(lpCreateStruct) == -1)
00199         return -1;
00200
00201     SetWindowSize();    // resize appropriately
00202     return 0;
00203 }
00204
00205 // On mouse click, create and show a CJColorPopup window for Color selection
00206 BOOL CCJColorPicker::OnClicked()
00207 {
00208     m_bActive = TRUE;
00209
00210     CRect rect;
00211     GetWindowRect(rect);
00212     new CCJColorPopup(CPoint(rect.left, rect.bottom),    // Point to display popup
00213                      GetColor(),                       // Selected Color
00214                      this,                              // parent
00215                      m_strDefaultText,                  // "Default" text area
00216                      m_strCustomText);                  // Custom Text
00217
00218     // 10-14-1999 - Kirk Stowell - Removed redundant calls to GetParent().
00219     if (m_pParentWnd) {
00220         m_pParentWnd->SendMessage(CPN_DROPDOWN, (LPARAM)GetColor(), (WPARAM) GetDlgCtrlID());
00221     }
00222
00223     // Docs say I should return FALSE to stop the parent also getting the message.
00224     // HA! What a joke.
00225
00226     return TRUE;
00227 }
00228
00229 // 1999-06-11 begin mods KStowell
00230 void CCJColorPicker::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
00231 {
00232     ASSERT(lpDrawItemStruct != NULL);
00233
00234     // define some temporary variables.
00235     CDC*    pDC         = CDC::FromHandle( lpDrawItemStruct->hDC );
00236     CRect   rcItem      = lpDrawItemStruct->rcItem;
00237     int     nState      = lpDrawItemStruct->itemState;
00238     DWORD   dwState     = EDGE_RAISED;
00239     DWORD   dwArrow     = DFCS_SCROLLDOWN;
00240
00241     // Paint the background.
00242     pDC->FillSolidRect(rcItem, ::GetSysColor(COLOR_3DFACE));
00243
00244     // set display flags based on state.
00245     if((nState & ODS_SELECTED) || (m_bActive == TRUE)) {
00246         dwState = EDGE_SUNKEN;
00247         dwArrow = DFCS_SCROLLDOWN|DFCS_PUSHED;
00248     }
00249     if(nState & ODS_DISABLED) {
00250         dwArrow = DFCS_SCROLLDOWN|DFCS_INACTIVE;
00251     }
00252
00253     // Draw the drop arrow.
00254     CRect rcArrow( rcItem );
00255     rcArrow.left = rcArrow.Width()-::GetSystemMetrics( SM_CXHTHUMB );
00256     pDC->DrawFrameControl( &rcArrow, DFC_SCROLL, dwArrow );
00257     pDC->Draw3dRect( rcArrow, ::GetSysColor( COLOR_3DFACE ), ::GetSysColor( COLOR_3DFACE ));
00258     rcArrow.DeflateRect( 1,1 );
00259     pDC->Draw3dRect( rcArrow, ::GetSysColor( COLOR_3DFACE ), ::GetSysColor( COLOR_3DFACE ));
00260
00261     if((nState & ODS_SELECTED) || (m_bActive == TRUE))
00262         rcArrow.OffsetRect( 1,1 );
00263
00264     // draw the seperator line.
00265     CPen penShadow( PS_SOLID, 1, ::GetSysColor( COLOR_3DSHADOW  ));
00266     CPen* pOldPen = pDC->SelectObject( &penShadow );
00267     pDC->MoveTo( rcArrow.left-1, rcArrow.top+2 );
00268     pDC->LineTo( rcArrow.left-1, rcArrow.bottom-2 );
00269
00270     CPen penHilite( PS_SOLID, 1, ::GetSysColor( COLOR_3DHILIGHT ));
00271     pDC->SelectObject( &penHilite );
00272     pDC->MoveTo( rcArrow.left, rcArrow.top+2 );
00273     pDC->LineTo( rcArrow.left, rcArrow.bottom-2 );
00274
00275     // draw the control border.
00276     pDC->DrawEdge( rcItem, dwState, BF_RECT );
00277
00278     // draw the focus rect.
00279     rcItem.DeflateRect( 2, 2 );
00280     pDC->Draw3dRect( rcItem, ::GetSysColor( COLOR_3DFACE ), ::GetSysColor( COLOR_3DFACE ) );
00281     if( nState & ODS_FOCUS ) {
00282         pDC->DrawFocusRect( rcItem );
00283     }
00284
00285     // draw the color box.
00286     if((nState & ODS_SELECTED) || (m_bActive == TRUE))
00287         rcItem.OffsetRect( 1,1 );
00288
00289     rcItem.DeflateRect( 2, 2 );
00290     rcItem.right = rcArrow.left-4;
00291
00292     CBrush brush( ((nState & ODS_DISABLED) || m_crColorBk == CLR_DEFAULT)?
00293         ::GetSysColor(COLOR_3DFACE) : m_crColorBk);
00294     CBrush* pOldBrush = (CBrush*)pDC->SelectObject( &brush );
00295     pDC->SelectStockObject(( nState & ODS_DISABLED )?WHITE_PEN:BLACK_PEN );
00296     pDC->Rectangle( rcItem );
00297
00298     // Draw the window text (if any)
00299     CString strText;
00300     GetWindowText(strText);
00301     if (strText.GetLength())
00302     {
00303         pDC->SetBkMode(TRANSPARENT);
00304         if (nState & ODS_DISABLED)
00305         {
00306             rcItem.OffsetRect(1,1);
00307             pDC->SetTextColor(::GetSysColor(COLOR_3DHILIGHT));
00308             pDC->DrawText(strText, rcItem, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
00309             rcItem.OffsetRect(-1,-1);
00310             pDC->SetTextColor(::GetSysColor(COLOR_3DSHADOW));
00311             pDC->DrawText(strText, rcItem, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
00312         }
00313         else
00314         {
00315             pDC->SetTextColor((m_crColorText == CLR_DEFAULT)? 0 : m_crColorText);
00316             pDC->DrawText(strText, rcItem, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
00317         }
00318     }
00319
00320     // fix potential resource leak - KStowell - 10-21-99
00321     pDC->SelectObject( pOldPen );
00322     pDC->SelectObject( pOldBrush );
00323     brush.DeleteObject();
00324     penHilite.DeleteObject();
00325     penHilite.DeleteObject();
00326 }
00327 // 1999-06-11 end mods KStowell
00328
00330 // CCJColorPicker overrides
00331
00332 void CCJColorPicker::PreSubclassWindow()
00333 {
00334     ModifyStyle(0, BS_OWNERDRAW);        // Make it owner drawn
00335     CButton::PreSubclassWindow();
00336     SetWindowSize();                     // resize appropriately
00337 }
00338
00340 // CCJColorPicker attributes
00341
00342 COLORREF CCJColorPicker::GetColor()
00343 {
00344     return (m_nSelectionMode == CP_MODE_TEXT)?
00345         GetTextColor(): GetBkColor();
00346 }
00347
00348 void CCJColorPicker::SetColor(COLORREF crColor)
00349 {
00350     (m_nSelectionMode == CP_MODE_TEXT)?
00351         SetTextColor(crColor): SetBkColor(crColor);
00352 }
00353
00354 void CCJColorPicker::SetBkColor(COLORREF crColorBk)
00355 {
00356     m_crColorBk = crColorBk;
00357
00358     //BEGIN SRO
00359     CheckTextColor(crColorBk);
00360     //END SRO
00361
00362     if (IsWindow(m_hWnd)) RedrawWindow();
00363 }
00364
00365 void CCJColorPicker::SetTextColor(COLORREF crColorText)
00366 {
00367     m_crColorText = crColorText;
00368     if (IsWindow(m_hWnd)) RedrawWindow();
00369 }
00370
00371 void CCJColorPicker::SetDefaultText(LPCTSTR szDefaultText)
00372 {
00373     m_strDefaultText = (szDefaultText)? szDefaultText : _T("");
00374 }
00375
00376 void CCJColorPicker::SetCustomText(LPCTSTR szCustomText)
00377 {
00378     m_strCustomText = (szCustomText)? szCustomText : _T("");
00379 }
00380
00382 // CCJColorPicker implementation
00383
00384 void CCJColorPicker::SetWindowSize()
00385 {
00386     // 10-14-1999 - Kirk Stowell - Added to help reduce flicker, we only need to make
00387     // a call to GetParent() once at initialization.
00388     m_pParentWnd = GetParent();
00389
00390     // Get size dimensions of edges
00391     CSize MarginSize(::GetSystemMetrics(SM_CXEDGE), ::GetSystemMetrics(SM_CYEDGE));
00392
00393     // Get size of dropdown arrow
00394     int nArrowWidth = max(::GetSystemMetrics(SM_CXHTHUMB), 5*MarginSize.cx);
00395     int nArrowHeight = max(::GetSystemMetrics(SM_CYVTHUMB), 5*MarginSize.cy);
00396     CSize ArrowSize(max(nArrowWidth, nArrowHeight), max(nArrowWidth, nArrowHeight));
00397
00398     // Get window size
00399     CRect rect;
00400     GetWindowRect(rect);
00401
00402     if (m_pParentWnd) {
00403         m_pParentWnd->ScreenToClient(rect);
00404     }
00405
00406     // Set window size at least as wide as 2 arrows, and as high as arrow + margins
00407     int nWidth = max(rect.Width(), 2*ArrowSize.cx + 2*MarginSize.cx);
00408     MoveWindow(rect.left, rect.top, nWidth, ArrowSize.cy+2*MarginSize.cy, TRUE);
00409
00410     // Get the new coords of this window
00411     GetWindowRect(rect);
00412     ScreenToClient(rect);
00413
00414     // Get the rect where the arrow goes, and convert to client coords.
00415     m_ArrowRect.SetRect(rect.right - ArrowSize.cx - MarginSize.cx,
00416                         rect.top + MarginSize.cy, rect.right - MarginSize.cx,
00417                         rect.bottom - MarginSize.cy);
00418 }
00419
00420 void CCJColorPicker::CheckTextColor(COLORREF crColor)
00421 {
00422     int R = GetRValue(crColor);
00423     int G = GetGValue(crColor);
00424     int B = GetBValue(crColor);
00425
00426     double Intensity = .299 * R + .587 * G + .114 * B ;
00427
00428     if ( Intensity >= 127 ) {
00429         SetTextColor(RGB(0,0,0));
00430     } else {
00431         SetTextColor(RGB(255,255,255));
00432     }
00433 }
00434
00435 BOOL CCJColorPicker::OnEraseBkgnd(CDC* pDC)
00436 {
00437     // overridden for flicker-free drawing.
00438     UNUSED_ALWAYS(pDC);
00439     return TRUE;
00440 }
00441
00442 void CCJColorPicker::OnPaint()
00443 {
00444     CPaintDC dc(this); // device context for painting
00445
00446     // KStowell - Get the client rect.
00447     CRect rcClient, rcClip;
00448     dc.GetClipBox( &rcClip );
00449     GetClientRect( &rcClient );
00450
00451     // KStowell - Create a memory device-context. This is done to help reduce
00452     // screen flicker, since we will paint the entire control to the
00453     // off screen device context first.
00454     CDC memDC;
00455     CBitmap bitmap;
00456     memDC.CreateCompatibleDC(&dc);
00457     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00458     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00459
00460     // KStowell - Repaint the background.
00461     memDC.FillSolidRect( rcClient, ::GetSysColor(COLOR_WINDOW) );
00462
00463     // let the control do its default drawing.
00464     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00465
00466     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00467     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00468         rcClip.left, rcClip.top, SRCCOPY );
00469
00470     // KStowell - Cleanup resources.
00471     memDC.SelectObject(pOldBitmap);
00472     memDC.DeleteDC();
00473     bitmap.DeleteObject();
00474 }
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJColorPopup.cpp Source File

WinCvs/CJLib/CJLibrary/CJColorPopup.cpp

Go to the documentation of this file.
00001 // CJColorPopup.cpp : implementation file
00002 //
00003 // Written by Chris Maunder (chrismaunder@codeguru.com)
00004 // Extended by Alexander Bischofberger (bischofb@informatik.tu-muenchen.de)
00005 // Copyright (c) 1998.
00006 //
00007 // Updated 30 May 1998 to allow any number of Colors, and to
00008 //                     make the appearance closer to Office 97.
00009 //                     Also added "Default" text area.         (CJM)
00010 //
00011 //         13 June 1998 Fixed change of focus bug (CJM)
00012 //         30 June 1998 Fixed bug caused by focus bug fix (D'oh!!)
00013 //                      Solution suggested by Paul Wilkerson.
00014 //
00015 // CJColorPopup is a helper class for the Color picker control
00016 // CJColorPicker. Check out the header file or the accompanying
00017 // HTML doc file for details.
00018 //
00019 // This code may be used in compiled form in any way you desire. This
00020 // file may be redistributed unmodified by any means PROVIDING it is
00021 // not sold for profit without the authors written consent, and
00022 // providing that this notice and the authors name is included.
00023 //
00024 // This file is provided "as is" with no expressed or implied warranty.
00025 // The author accepts no liability if it causes any damage to you or your
00026 // computer whatsoever. It's free, so don't hassle me about it.
00027 //
00028 // Expect bugs.
00029 //
00030 // Please use and enjoy. Please let me know of any bugs/mods/improvements
00031 // that you have found/implemented and I will fix/incorporate them into this
00032 // file.
00033 //
00035 /****************************************************************************
00036  *
00037  * $Date: 1999/11/30 21:45:48 $
00038  * $Revision: 1.1.1.2 $
00039  * $Archive: /CodeJock/CJLibrary/CJColorPopup.cpp $
00040  *
00041  * $History: CJColorPopup.cpp $
00042  *
00043  * *****************  Version 9  *****************
00044  * User: Kirk Stowell Date: 10/31/99   Time: 11:54p
00045  * Updated in $/CodeJock/CJLibrary
00046  * Overrode OnEraseBkgnd(...) and made modifications to OnPaint(...) to
00047  * handle flicker free drawing.
00048  *
00049  * Modified resource include for static builds.
00050  *
00051  * Fixed potential resource and memory leak problems.
00052  *
00053  * Made class methods virtual for inheritance purposes.
00054  *
00055  * *****************  Version 8  *****************
00056  * User: Kirk Stowell Date: 10/14/99   Time: 12:23p
00057  * Updated in $/CodeJock/CJLibrary
00058  * Added source control history to file header.
00059  *
00060  ***************************************************************************/
00062
00063 #include "stdafx.h"
00064 #include <math.h>
00065 #include "CJColorPicker.h"
00066 #include "CJColorPopup.h"
00067 #include "CJResource.h"
00068
00069 #ifdef _DEBUG
00070 #define new DEBUG_NEW
00071 #undef THIS_FILE
00072 static char THIS_FILE[] = __FILE__;
00073 #endif
00074
00075 #define DEFAULT_BOX_VALUE -3
00076 #define CUSTOM_BOX_VALUE  -2
00077 #define INVALID_Color    -1
00078
00079 #define MAX_ColorS          100
00080 #define NUM_COLUMNS         10
00081
00082 ColorTableEntry CCJColorPopup::m_crColors[] =
00083 {
00084     { RGB(0x00, 0x00, 0x00),    _T("Black")             },
00085     { RGB(0xA5, 0x2A, 0x00),    _T("Brown")             },
00086     { RGB(0x00, 0x40, 0x40),    _T("Dark Olive Green")  },
00087     { RGB(0x00, 0x55, 0x00),    _T("Dark Green")        },
00088     { RGB(0x00, 0x00, 0x5E),    _T("Dark Teal")         },
00089     { RGB(0x00, 0x00, 0x8B),    _T("Dark blue")         },
00090     { RGB(0x4B, 0x00, 0x82),    _T("Indigo")            },
00091     { RGB(0x28, 0x28, 0x28),    _T("Dark grey")         },
00092
00093     { RGB(0x8B, 0x00, 0x00),    _T("Dark red")          },
00094     { RGB(0xFF, 0x68, 0x20),    _T("Orange")            },
00095     { RGB(0x8B, 0x8B, 0x00),    _T("Dark yellow")       },
00096     { RGB(0x00, 0x93, 0x00),    _T("Green")             },
00097     { RGB(0x38, 0x8E, 0x8E),    _T("Teal")              },
00098     { RGB(0x00, 0x00, 0xFF),    _T("Blue")              },
00099     { RGB(0x7B, 0x7B, 0xC0),    _T("Blue-grey")         },
00100     { RGB(0x66, 0x66, 0x66),    _T("Grey - 40")         },
00101
00102     { RGB(0xFF, 0x00, 0x00),    _T("Red")               },
00103     { RGB(0xFF, 0xAD, 0x5B),    _T("Light orange")      },
00104     { RGB(0x32, 0xCD, 0x32),    _T("Lime")              },
00105     { RGB(0x3C, 0xB3, 0x71),    _T("Sea green")         },
00106     { RGB(0x7F, 0xFF, 0xD4),    _T("Aqua")              },
00107     { RGB(0x7D, 0x9E, 0xC0),    _T("Light blue")        },
00108     { RGB(0x80, 0x00, 0x80),    _T("Violet")            },
00109     { RGB(0x7F, 0x7F, 0x7F),    _T("Grey - 50")         },
00110
00111     { RGB(0xFF, 0xC0, 0xCB),    _T("Pink")              },
00112     { RGB(0xFF, 0xD7, 0x00),    _T("Gold")              },
00113     { RGB(0xFF, 0xFF, 0x00),    _T("Yellow")            },
00114     { RGB(0x00, 0xFF, 0x00),    _T("Bright green")      },
00115     { RGB(0x40, 0xE0, 0xD0),    _T("Turquoise")         },
00116     { RGB(0xC0, 0xFF, 0xFF),    _T("Skyblue")           },
00117     { RGB(0x48, 0x00, 0x48),    _T("Plum")              },
00118     { RGB(0xC0, 0xC0, 0xC0),    _T("Light grey")        },
00119
00120     { RGB(0xFF, 0xE4, 0xE1),    _T("Rose")              },
00121     { RGB(0xD2, 0xB4, 0x8C),    _T("Tan")               },
00122     { RGB(0xFF, 0xFF, 0xE0),    _T("Light yellow")      },
00123     { RGB(0x98, 0xFB, 0x98),    _T("Pale green ")       },
00124     { RGB(0xAF, 0xEE, 0xEE),    _T("Pale turquoise")    },
00125     { RGB(0x68, 0x83, 0x8B),    _T("Pale blue")         },
00126     { RGB(0xE6, 0xE6, 0xFA),    _T("Lavender")          },
00127     { RGB(0xFF, 0xFF, 0xFF),    _T("White")             }
00128 };
00129
00131 // CCJColorPopup
00132
00133 CCJColorPopup::CCJColorPopup()
00134 {
00135     Initialise();
00136 }
00137
00138 CCJColorPopup::CCJColorPopup(CPoint p, COLORREF crColor, CWnd* pParentWnd,
00139                            LPCTSTR szDefaultText /* = NULL */,
00140                            LPCTSTR szCustomText  /* = NULL */)
00141 {
00142     Initialise();
00143
00144     m_crColor       = m_crInitialColor = crColor;
00145     m_pParent        = pParentWnd;
00146
00147 // 1999-06-11 begin mods KStowell
00148     if( szDefaultText == NULL )
00149         m_strDefaultText.LoadString( IDS_COLOR_AUTO );
00150     else
00151         m_strDefaultText = szDefaultText;
00152
00153     if( szCustomText == NULL )
00154         m_strCustomText.LoadString( IDS_COLOR_CUST );
00155     else
00156         m_strCustomText = szCustomText;
00157 // 1999-06-11 end mods KStowell
00158
00159     CCJColorPopup::Create(p, crColor, pParentWnd, szDefaultText, szCustomText);
00160 }
00161
00162 void CCJColorPopup::Initialise()
00163 {
00164     m_nNumColors       = sizeof(m_crColors)/sizeof(ColorTableEntry);
00165     ASSERT(m_nNumColors <= MAX_ColorS);
00166     if (m_nNumColors > MAX_ColorS)
00167         m_nNumColors = MAX_ColorS;
00168
00169     m_nNumColumns       = 0;
00170     m_nNumRows          = 0;
00171     m_nBoxSize          = 18;
00172     m_nMargin           = ::GetSystemMetrics(SM_CXEDGE);
00173     m_nCurrentSel       = INVALID_Color;
00174     m_nChosenColorSel  = INVALID_Color;
00175     m_pParent           = NULL;
00176     m_crColor          = m_crInitialColor = RGB(0,0,0);
00177
00178     // Idiot check: Make sure the Color square is at least 5 x 5;
00179     if (m_nBoxSize - 2*m_nMargin - 2 < 5) m_nBoxSize = 5 + 2*m_nMargin + 2;
00180
00181     // Create the palette
00182     struct {
00183         LOGPALETTE    LogPalette;
00184         PALETTEENTRY  PalEntry[MAX_ColorS];
00185     } pal;
00186
00187     LOGPALETTE* pLogPalette = (LOGPALETTE*) &pal;
00188     pLogPalette->palVersion    = 0x300;
00189     pLogPalette->palNumEntries = (WORD) m_nNumColors;
00190
00191     for (int i = 0; i < m_nNumColors; i++)
00192     {
00193         pLogPalette->palPalEntry[i].peRed   = GetRValue(m_crColors[i].crColor);
00194         pLogPalette->palPalEntry[i].peGreen = GetGValue(m_crColors[i].crColor);
00195         pLogPalette->palPalEntry[i].peBlue  = GetBValue(m_crColors[i].crColor);
00196         pLogPalette->palPalEntry[i].peFlags = 0;
00197     }
00198
00199     m_Palette.CreatePalette(pLogPalette);
00200 }
00201
00202 CCJColorPopup::~CCJColorPopup()
00203 {
00204     m_Font.DeleteObject();
00205     m_Palette.DeleteObject();
00206 }
00207
00208 BOOL CCJColorPopup::Create(CPoint p, COLORREF crColor, CWnd* pParentWnd,
00209                           LPCTSTR szDefaultText /* = NULL */,
00210                           LPCTSTR szCustomText  /* = NULL */)
00211 {
00212     ASSERT(pParentWnd && ::IsWindow(pParentWnd->GetSafeHwnd()));
00213     ASSERT(pParentWnd->IsKindOf(RUNTIME_CLASS(CCJColorPicker)));
00214
00215     m_pParent  = pParentWnd;
00216     m_crColor = m_crInitialColor = crColor;
00217
00218     // Get the class name and create the window
00219     CString szClassName = AfxRegisterWndClass(CS_CLASSDC|CS_SAVEBITS|CS_HREDRAW|CS_VREDRAW,
00220                                               0,
00221                                               (HBRUSH) (COLOR_BTNFACE+1),
00222                                               0);
00223
00224     if (!CWnd::CreateEx(0, szClassName, _T(""), WS_VISIBLE|WS_POPUP,
00225                         p.x, p.y, 100, 100, // size updated soon
00226                         pParentWnd->GetSafeHwnd(), 0, NULL))
00227         return FALSE;
00228
00229     UpdateFont();
00230
00231     // Store the Custom text
00232     if (szCustomText != NULL)
00233         m_strCustomText = szCustomText;
00234
00235     // Store the Default Area text
00236     if (szDefaultText != NULL)
00237         m_strDefaultText = szDefaultText;
00238
00239     // Set the window size
00240     SetWindowSize();
00241
00242     // Create the tooltips
00243     CreateToolTips();
00244
00245     // Find which cell (if any) corresponds to the initial Color
00246     FindCellFromColor(crColor);
00247
00248     // Capture all mouse events for the life of this window
00249     SetCapture();
00250
00251     return TRUE;
00252 }
00253
00254 BEGIN_MESSAGE_MAP(CCJColorPopup, CWnd)
00255     //{{AFX_MSG_MAP(CCJColorPopup)
00256     ON_WM_NCDESTROY()
00257     ON_WM_LBUTTONUP()
00258     ON_WM_PAINT()
00259     ON_WM_MOUSEMOVE()
00260     ON_WM_KEYDOWN()
00261     ON_WM_QUERYNEWPALETTE()
00262     ON_WM_PALETTECHANGED()
00263     ON_WM_KILLFOCUS()
00264     ON_WM_ACTIVATEAPP()
00265     ON_WM_ERASEBKGND()
00266     //}}AFX_MSG_MAP
00267 END_MESSAGE_MAP()
00268
00270 // CCJColorPopup message handlers
00271
00272 // For tooltips
00273 BOOL CCJColorPopup::PreTranslateMessage(MSG* pMsg)
00274 {
00275     m_ToolTip.RelayEvent(pMsg);
00276     return CWnd::PreTranslateMessage(pMsg);
00277 }
00278
00279 // If an arrow key is pressed, then move the selection
00280 void CCJColorPopup::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
00281 {
00282     int row = GetRow(m_nCurrentSel),
00283         col = GetColumn(m_nCurrentSel);
00284
00285     if (nChar == VK_DOWN)
00286     {
00287         if (row == DEFAULT_BOX_VALUE)
00288             row = col = 0;
00289         else if (row == CUSTOM_BOX_VALUE)
00290         {
00291             if (m_strDefaultText.GetLength())
00292                 row = col = DEFAULT_BOX_VALUE;
00293             else
00294                 row = col = 0;
00295         }
00296         else
00297         {
00298             row++;
00299             if (GetIndex(row,col) < 0)
00300             {
00301                 if (m_strCustomText.GetLength())
00302                     row = col = CUSTOM_BOX_VALUE;
00303                 else if (m_strDefaultText.GetLength())
00304                     row = col = DEFAULT_BOX_VALUE;
00305                 else
00306                     row = col = 0;
00307             }
00308         }
00309         ChangeSelection(GetIndex(row, col));
00310     }
00311
00312     if (nChar == VK_UP)
00313     {
00314         if (row == DEFAULT_BOX_VALUE)
00315         {
00316             if (m_strCustomText.GetLength())
00317                 row = col = CUSTOM_BOX_VALUE;
00318             else
00319            {
00320                 row = GetRow(m_nNumColors-1);
00321                 col = GetColumn(m_nNumColors-1);
00322             }
00323         }
00324         else if (row == CUSTOM_BOX_VALUE)
00325         {
00326             row = GetRow(m_nNumColors-1);
00327             col = GetColumn(m_nNumColors-1);
00328         }
00329         else if (row > 0) row--;
00330         else /* row == 0 */
00331         {
00332             if (m_strDefaultText.GetLength())
00333                 row = col = DEFAULT_BOX_VALUE;
00334             else if (m_strCustomText.GetLength())
00335                 row = col = CUSTOM_BOX_VALUE;
00336             else
00337             {
00338                 row = GetRow(m_nNumColors-1);
00339                 col = GetColumn(m_nNumColors-1);
00340             }
00341         }
00342         ChangeSelection(GetIndex(row, col));
00343     }
00344
00345     if (nChar == VK_RIGHT)
00346     {
00347         if (row == DEFAULT_BOX_VALUE)
00348             row = col = 0;
00349         else if (row == CUSTOM_BOX_VALUE)
00350         {
00351             if (m_strDefaultText.GetLength())
00352                 row = col = DEFAULT_BOX_VALUE;
00353             else
00354                 row = col = 0;
00355         }
00356         else if (col < m_nNumColumns-1)
00357             col++;
00358         else
00359         {
00360             col = 0; row++;
00361         }
00362
00363         if (GetIndex(row,col) == INVALID_Color)
00364         {
00365             if (m_strCustomText.GetLength())
00366                 row = col = CUSTOM_BOX_VALUE;
00367             else if (m_strDefaultText.GetLength())
00368                 row = col = DEFAULT_BOX_VALUE;
00369             else
00370                 row = col = 0;
00371         }
00372
00373         ChangeSelection(GetIndex(row, col));
00374     }
00375
00376     if (nChar == VK_LEFT)
00377     {
00378         if (row == DEFAULT_BOX_VALUE)
00379         {
00380             if (m_strCustomText.GetLength())
00381                 row = col = CUSTOM_BOX_VALUE;
00382             else
00383            {
00384                 row = GetRow(m_nNumColors-1);
00385                 col = GetColumn(m_nNumColors-1);
00386             }
00387         }
00388         else if (row == CUSTOM_BOX_VALUE)
00389         {
00390             row = GetRow(m_nNumColors-1);
00391             col = GetColumn(m_nNumColors-1);
00392         }
00393         else if (col > 0) col--;
00394         else /* col == 0 */
00395         {
00396             if (row > 0) { row--; col = m_nNumColumns-1; }
00397             else
00398             {
00399                 if (m_strDefaultText.GetLength())
00400                     row = col = DEFAULT_BOX_VALUE;
00401                 else if (m_strCustomText.GetLength())
00402                     row = col = CUSTOM_BOX_VALUE;
00403                 else
00404                 {
00405                     row = GetRow(m_nNumColors-1);
00406                     col = GetColumn(m_nNumColors-1);
00407                 }
00408             }
00409         }
00410         ChangeSelection(GetIndex(row, col));
00411     }
00412
00413     if (nChar == VK_ESCAPE)
00414     {
00415         m_crColor = m_crInitialColor;
00416         EndSelection(CPN_SELENDCANCEL);
00417         return;
00418     }
00419
00420     if (nChar == VK_RETURN || nChar == VK_SPACE)
00421     {
00422         EndSelection(CPN_SELENDOK);
00423         return;
00424     }
00425
00426     CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
00427 }
00428
00429 // auto-deletion
00430 void CCJColorPopup::OnNcDestroy()
00431 {
00432     CWnd::OnNcDestroy();
00433     delete this;
00434 }
00435
00436 void CCJColorPopup::OnPaint()
00437 {
00438     CPaintDC dc(this); // device context for painting
00439
00440     // KStowell - Get the client rect for this control.
00441     CRect rcClient;
00442     GetClientRect(&rcClient);
00443
00444     // KStowell - Create a memory device-context. This is done to help reduce
00445     // screen flicker, since we will paint the entire control to the
00446     // off screen device context first.
00447     CDC memDC;
00448     memDC.CreateCompatibleDC(&dc);
00449     CBitmap bitmap;
00450     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00451     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00452     memDC.FillSolidRect(rcClient, ::GetSysColor(COLOR_BTNFACE));
00453
00454     // Draw the Default Area text
00455     if (m_strDefaultText.GetLength())
00456         DrawCell(&memDC, DEFAULT_BOX_VALUE);
00457
00458     // Draw Color cells
00459     for (int i = 0; i < m_nNumColors; i++)
00460         DrawCell(&memDC, i);
00461
00462     // Draw custom text
00463     if (m_strCustomText.GetLength())
00464         DrawCell(&memDC, CUSTOM_BOX_VALUE);
00465
00466     // Draw raised window edge (ex-window style WS_EX_WINDOWEDGE is sposed to do this,
00467     // but for some reason isn't
00468     CRect rect;
00469     GetClientRect(rect);
00470     memDC.DrawEdge(rect, EDGE_RAISED, BF_RECT);
00471
00472     // KStowell - copy the memory device context back into the original DC via BitBlt().
00473     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00474
00475     // KStowell - cleanup.
00476     memDC.SelectObject(pOldBitmap);
00477     memDC.DeleteDC();
00478     bitmap.DeleteObject();
00479 }
00480
00481 void CCJColorPopup::OnMouseMove(UINT nFlags, CPoint point)
00482 {
00483     int nNewSelection = INVALID_Color;
00484
00485     // Translate points to be relative raised window edge
00486     point.x -= m_nMargin;
00487     point.y -= m_nMargin;
00488
00489     // First check we aren't in text box
00490     if (m_strCustomText.GetLength() && m_CustomTextRect.PtInRect(point))
00491         nNewSelection = CUSTOM_BOX_VALUE;
00492     else if (m_strDefaultText.GetLength() && m_DefaultTextRect.PtInRect(point))
00493         nNewSelection = DEFAULT_BOX_VALUE;
00494     else
00495     {
00496         // Take into account text box
00497         if (m_strDefaultText.GetLength())
00498             point.y -= m_DefaultTextRect.Height();
00499
00500         // Get the row and column
00501         nNewSelection = GetIndex(point.y / m_nBoxSize, point.x / m_nBoxSize);
00502
00503         // In range? If not, default and exit
00504         if (nNewSelection < 0 || nNewSelection >= m_nNumColors)
00505         {
00506             CWnd::OnMouseMove(nFlags, point);
00507             return;
00508         }
00509     }
00510
00511     // OK - we have the row and column of the current selection (may be CUSTOM_BOX_VALUE)
00512     // Has the row/col selection changed? If yes, then redraw old and new cells.
00513     if (nNewSelection != m_nCurrentSel)
00514         ChangeSelection(nNewSelection);
00515
00516     CWnd::OnMouseMove(nFlags, point);
00517 }
00518
00519 // End selection on LButtonUp
00520 void CCJColorPopup::OnLButtonUp(UINT nFlags, CPoint point)
00521 {
00522     CWnd::OnLButtonUp(nFlags, point);
00523
00524     DWORD pos = GetMessagePos();
00525     point = CPoint(LOWORD(pos), HIWORD(pos));
00526
00527     if (m_WindowRect.PtInRect(point))
00528         EndSelection(CPN_SELENDOK);
00529     else
00530         EndSelection(CPN_SELENDCANCEL);
00531 }
00532
00534 // CCJColorPopup implementation
00535
00536 int CCJColorPopup::GetIndex(int row, int col) const
00537 {
00538     if ((row == CUSTOM_BOX_VALUE || col == CUSTOM_BOX_VALUE) && m_strCustomText.GetLength())
00539         return CUSTOM_BOX_VALUE;
00540     else if ((row == DEFAULT_BOX_VALUE || col == DEFAULT_BOX_VALUE) && m_strDefaultText.GetLength())
00541         return DEFAULT_BOX_VALUE;
00542     else if (row < 0 || col < 0 || row >= m_nNumRows || col >= m_nNumColumns)
00543         return INVALID_Color;
00544     else
00545     {
00546         if (row*m_nNumColumns + col >= m_nNumColors)
00547             return INVALID_Color;
00548         else
00549             return row*m_nNumColumns + col;
00550     }
00551 }
00552
00553 int CCJColorPopup::GetRow(int nIndex) const
00554 {
00555     if (nIndex == CUSTOM_BOX_VALUE && m_strCustomText.GetLength())
00556         return CUSTOM_BOX_VALUE;
00557     else if (nIndex == DEFAULT_BOX_VALUE && m_strDefaultText.GetLength())
00558         return DEFAULT_BOX_VALUE;
00559     else if (nIndex < 0 || nIndex >= m_nNumColors)
00560         return INVALID_Color;
00561     else
00562         return nIndex / m_nNumColumns;
00563 }
00564
00565 int CCJColorPopup::GetColumn(int nIndex) const
00566 {
00567     if (nIndex == CUSTOM_BOX_VALUE && m_strCustomText.GetLength())
00568         return CUSTOM_BOX_VALUE;
00569     else if (nIndex == DEFAULT_BOX_VALUE && m_strDefaultText.GetLength())
00570         return DEFAULT_BOX_VALUE;
00571     else if (nIndex < 0 || nIndex >= m_nNumColors)
00572         return INVALID_Color;
00573     else
00574         return nIndex % m_nNumColumns;
00575 }
00576
00577 void CCJColorPopup::FindCellFromColor(COLORREF crColor)
00578 {
00579     if (crColor == CLR_DEFAULT && m_strDefaultText.GetLength())
00580     {
00581         m_nChosenColorSel = DEFAULT_BOX_VALUE;
00582         return;
00583     }
00584
00585     for (int i = 0; i < m_nNumColors; i++)
00586     {
00587         if (GetColor(i) == crColor)
00588         {
00589             m_nChosenColorSel = i;
00590             return;
00591         }
00592     }
00593
00594     if (m_strCustomText.GetLength())
00595         m_nChosenColorSel = CUSTOM_BOX_VALUE;
00596     else
00597         m_nChosenColorSel = INVALID_Color;
00598 }
00599
00600 // Gets the dimensions of the Color cell given by (row,col)
00601 BOOL CCJColorPopup::GetCellRect(int nIndex, const LPRECT& rect)
00602 {
00603     if (nIndex == CUSTOM_BOX_VALUE)
00604     {
00605         ::SetRect(rect,
00606                   m_CustomTextRect.left,  m_CustomTextRect.top,
00607                   m_CustomTextRect.right, m_CustomTextRect.bottom);
00608         return TRUE;
00609     }
00610     else if (nIndex == DEFAULT_BOX_VALUE)
00611     {
00612         ::SetRect(rect,
00613                   m_DefaultTextRect.left,  m_DefaultTextRect.top,
00614                   m_DefaultTextRect.right, m_DefaultTextRect.bottom);
00615         return TRUE;
00616     }
00617
00618     if (nIndex < 0 || nIndex >= m_nNumColors)
00619         return FALSE;
00620
00621     rect->left = GetColumn(nIndex) * m_nBoxSize + m_nMargin;
00622     rect->top  = GetRow(nIndex) * m_nBoxSize + m_nMargin;
00623
00624     // Move everything down if we are displaying a default text area
00625     if (m_strDefaultText.GetLength())
00626         rect->top += (m_nMargin + m_DefaultTextRect.Height());
00627
00628     rect->right = rect->left + m_nBoxSize;
00629     rect->bottom = rect->top + m_nBoxSize;
00630
00631     return TRUE;
00632 }
00633
00634 // Works out an appropriate size and position of this window
00635 void CCJColorPopup::SetWindowSize()
00636 {
00637     CSize TextSize;
00638
00639     // If we are showing a custom or default text area, get the font and text size.
00640     if (m_strCustomText.GetLength() || m_strDefaultText.GetLength())
00641     {
00642         CClientDC dc(this);
00643         CFont* pOldFont = (CFont*) dc.SelectObject(&m_Font);
00644
00645         // Get the size of the custom text (if there IS custom text)
00646         TextSize = CSize(0,0);
00647         if (m_strCustomText.GetLength())
00648             TextSize = dc.GetTextExtent(m_strCustomText);
00649
00650         // Get the size of the default text (if there IS default text)
00651         if (m_strDefaultText.GetLength())
00652         {
00653             CSize DefaultSize = dc.GetTextExtent(m_strDefaultText);
00654             if (DefaultSize.cx > TextSize.cx) TextSize.cx = DefaultSize.cx;
00655             if (DefaultSize.cy > TextSize.cy) TextSize.cy = DefaultSize.cy;
00656         }
00657
00658         dc.SelectObject(pOldFont);
00659         TextSize += CSize(2*m_nMargin,2*m_nMargin);
00660
00661         // Add even more space to draw the horizontal line
00662         TextSize.cy += 2*m_nMargin + 2;
00663     }
00664
00665     // Get the number of columns and rows
00666     //m_nNumColumns = (int) sqrt((double)m_nNumColors);    // for a square window (yuk)
00667     m_nNumColumns = NUM_COLUMNS;
00668     m_nNumRows = m_nNumColors / m_nNumColumns;
00669     if (m_nNumColors % m_nNumColumns) m_nNumRows++;
00670
00671     // Get the current window position, and set the new size
00672     CRect rect;
00673     GetWindowRect(rect);
00674
00675     m_WindowRect.SetRect(rect.left, rect.top,
00676                          rect.left + m_nNumColumns*m_nBoxSize + 2*m_nMargin,
00677                          rect.top  + m_nNumRows*m_nBoxSize + 2*m_nMargin);
00678
00679     // if custom text, then expand window if necessary, and set text width as
00680     // window width
00681     if (m_strDefaultText.GetLength())
00682     {
00683         if (TextSize.cx > m_WindowRect.Width())
00684             m_WindowRect.right = m_WindowRect.left + TextSize.cx;
00685         TextSize.cx = m_WindowRect.Width()-2*m_nMargin;
00686
00687         // Work out the text area
00688         m_DefaultTextRect.SetRect(m_nMargin, m_nMargin,
00689                                   m_nMargin+TextSize.cx, 2*m_nMargin+TextSize.cy);
00690         m_WindowRect.bottom += m_DefaultTextRect.Height() + 2*m_nMargin;
00691     }
00692
00693     // if custom text, then expand window if necessary, and set text width as
00694     // window width
00695     if (m_strCustomText.GetLength())
00696     {
00697         if (TextSize.cx > m_WindowRect.Width())
00698             m_WindowRect.right = m_WindowRect.left + TextSize.cx;
00699         TextSize.cx = m_WindowRect.Width()-2*m_nMargin;
00700
00701         // Work out the text area
00702         m_CustomTextRect.SetRect(m_nMargin, m_WindowRect.Height(),
00703                                  m_nMargin+TextSize.cx,
00704                                  m_WindowRect.Height()+m_nMargin+TextSize.cy);
00705         m_WindowRect.bottom += m_CustomTextRect.Height() + 2*m_nMargin;
00706    }
00707
00708     // Need to check it'll fit on screen: Too far right?
00709     CSize ScreenSize(::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN));
00710     if (m_WindowRect.right > ScreenSize.cx)
00711         m_WindowRect.OffsetRect(-(m_WindowRect.right - ScreenSize.cx), 0);
00712
00713     // Too far left?
00714     if (m_WindowRect.left < 0)
00715         m_WindowRect.OffsetRect( -m_WindowRect.left, 0);
00716
00717     // Bottom falling out of screen?
00718     if (m_WindowRect.bottom > ScreenSize.cy)
00719     {
00720         CRect ParentRect;
00721         m_pParent->GetWindowRect(ParentRect);
00722         m_WindowRect.OffsetRect(0, -(ParentRect.Height() + m_WindowRect.Height()));
00723     }
00724
00725     // Set the window size and position
00726     MoveWindow(m_WindowRect, TRUE);
00727 }
00728
00729 void CCJColorPopup::CreateToolTips()
00730 {
00731     // Create the tool tip
00732     if (!m_ToolTip.Create(this)) return;
00733
00734     // Add a tool for each cell
00735     for (int i = 0; i < m_nNumColors; i++)
00736     {
00737         CRect rect;
00738         if (!GetCellRect(i, rect)) continue;
00739             m_ToolTip.AddTool(this, GetColorName(i), rect, 1);
00740     }
00741 }
00742
00743 void CCJColorPopup::ChangeSelection(int nIndex)
00744 {
00745     CClientDC dc(this);        // device context for drawing
00746
00747     if (nIndex > m_nNumColors)
00748         nIndex = CUSTOM_BOX_VALUE;
00749
00750     if ((m_nCurrentSel >= 0 && m_nCurrentSel < m_nNumColors) ||
00751         m_nCurrentSel == CUSTOM_BOX_VALUE || m_nCurrentSel == DEFAULT_BOX_VALUE)
00752     {
00753         // Set Current selection as invalid and redraw old selection (this way
00754         // the old selection will be drawn unselected)
00755         int OldSel = m_nCurrentSel;
00756         m_nCurrentSel = INVALID_Color;
00757         DrawCell(&dc, OldSel);
00758     }
00759
00760     // Set the current selection as row/col and draw (it will be drawn selected)
00761     m_nCurrentSel = nIndex;
00762     DrawCell(&dc, m_nCurrentSel);
00763
00764     // Store the current Color
00765     if (m_nCurrentSel == CUSTOM_BOX_VALUE)
00766         m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crInitialColor, 0);
00767     else if (m_nCurrentSel == DEFAULT_BOX_VALUE)
00768     {
00769         m_crColor = CLR_DEFAULT;
00770         m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) CLR_DEFAULT, 0);
00771     }
00772     else
00773     {
00774         m_crColor = GetColor(m_nCurrentSel);
00775         m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crColor, 0);
00776     }
00777 }
00778
00779 void CCJColorPopup::EndSelection(int nMessage)
00780 {
00781     ReleaseCapture();
00782
00783     // If custom text selected, perform a custom Color selection
00784     if (nMessage != CPN_SELENDCANCEL && m_nCurrentSel == CUSTOM_BOX_VALUE)
00785     {
00786         CColorDialog dlg(m_crInitialColor, CC_FULLOPEN | CC_ANYCOLOR, this);
00787
00788         if (dlg.DoModal() == IDOK)
00789             m_crColor = dlg.GetColor();
00790         else
00791             nMessage = CPN_SELENDCANCEL;
00792     }
00793
00794     if (nMessage == CPN_SELENDCANCEL)
00795         m_crColor = m_crInitialColor;
00796
00797     m_pParent->SendMessage(nMessage, (WPARAM) m_crColor, 0);
00798
00799     DestroyWindow();
00800 }
00801
00802 void CCJColorPopup::DrawCell(CDC* pDC, int nIndex)
00803 {
00804     // For the Custom Text area
00805     if (m_strCustomText.GetLength() && nIndex == CUSTOM_BOX_VALUE)
00806     {
00807         // The extent of the actual text button
00808         CRect TextButtonRect = m_CustomTextRect;
00809         TextButtonRect.top += 2*m_nMargin;
00810
00811         // Fill background
00812         pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));
00813
00814         // Draw horizontal line
00815         pDC->FillSolidRect(m_CustomTextRect.left+2*m_nMargin, m_CustomTextRect.top,
00816                            m_CustomTextRect.Width()-4*m_nMargin, 1, ::GetSysColor(COLOR_3DSHADOW));
00817         pDC->FillSolidRect(m_CustomTextRect.left+2*m_nMargin, m_CustomTextRect.top+1,
00818                            m_CustomTextRect.Width()-4*m_nMargin, 1, ::GetSysColor(COLOR_3DHILIGHT));
00819
00820         TextButtonRect.DeflateRect(1,1);
00821
00822         // fill background
00823         if (m_nChosenColorSel == nIndex && m_nCurrentSel != nIndex)
00824             pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DLIGHT));
00825         else
00826             pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));
00827
00828         // Draw button
00829         if (m_nCurrentSel == nIndex)
00830             pDC->DrawEdge(TextButtonRect, BDR_RAISEDINNER, BF_RECT);
00831         else if (m_nChosenColorSel == nIndex)
00832             pDC->DrawEdge(TextButtonRect, BDR_SUNKENOUTER, BF_RECT);
00833
00834         // Draw custom text
00835         CFont *pOldFont = (CFont*) pDC->SelectObject(&m_Font);
00836         pDC->SetBkMode(TRANSPARENT);
00837         pDC->DrawText(m_strCustomText, TextButtonRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
00838         pDC->SelectObject(pOldFont);
00839
00840         return;
00841     }
00842
00843     // For the Default Text area
00844     if (m_strDefaultText.GetLength() && nIndex == DEFAULT_BOX_VALUE)
00845     {
00846         // Fill background
00847         pDC->FillSolidRect(m_DefaultTextRect, ::GetSysColor(COLOR_3DFACE));
00848
00849         // The extent of the actual text button
00850         CRect TextButtonRect = m_DefaultTextRect;
00851         TextButtonRect.DeflateRect(1,1);
00852
00853         // fill background
00854         if (m_nChosenColorSel == nIndex && m_nCurrentSel != nIndex)
00855             pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DLIGHT));
00856         else
00857             pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));
00858
00859         // Draw thin line around text
00860         CRect LineRect = TextButtonRect;
00861         LineRect.DeflateRect(2*m_nMargin,2*m_nMargin);
00862         CPen pen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
00863         CPen* pOldPen = pDC->SelectObject(&pen);
00864         pDC->SelectStockObject(NULL_BRUSH);
00865         pDC->Rectangle(LineRect);
00866         pDC->SelectObject(pOldPen);
00867
00868         // Draw button
00869         if (m_nCurrentSel == nIndex)
00870             pDC->DrawEdge(TextButtonRect, BDR_RAISEDINNER, BF_RECT);
00871         else if (m_nChosenColorSel == nIndex)
00872             pDC->DrawEdge(TextButtonRect, BDR_SUNKENOUTER, BF_RECT);
00873
00874         // Draw custom text
00875         CFont *pOldFont = (CFont*) pDC->SelectObject(&m_Font);
00876         pDC->SetBkMode(TRANSPARENT);
00877         pDC->DrawText(m_strDefaultText, TextButtonRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
00878         pDC->SelectObject(pOldFont);
00879
00880         // fix potential resource leak - KStowell - 10-21-99
00881         pen.DeleteObject();
00882         return;
00883     }
00884
00885     CRect rect;
00886     if (!GetCellRect(nIndex, rect)) return;
00887
00888     // Select and realize the palette
00889     CPalette* pOldPalette = NULL;
00890     if (pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)
00891     {
00892         pOldPalette = pDC->SelectPalette(&m_Palette, FALSE);
00893         pDC->RealizePalette();
00894     }
00895
00896     // fill background
00897     if (m_nChosenColorSel == nIndex && m_nCurrentSel != nIndex)
00898         pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DHILIGHT));
00899     else
00900         pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE));
00901
00902     // Draw button
00903     if (m_nCurrentSel == nIndex)
00904         pDC->DrawEdge(rect, BDR_RAISEDINNER, BF_RECT);
00905     else if (m_nChosenColorSel == nIndex)
00906         pDC->DrawEdge(rect, BDR_SUNKENOUTER, BF_RECT);
00907
00908     CBrush brush(PALETTERGB(GetRValue(GetColor(nIndex)),
00909                             GetGValue(GetColor(nIndex)),
00910                             GetBValue(GetColor(nIndex)) ));
00911     CPen   pen;
00912     pen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
00913
00914     CBrush* pOldBrush = (CBrush*) pDC->SelectObject(&brush);
00915     CPen*   pOldPen   = (CPen*)   pDC->SelectObject(&pen);
00916
00917     // Draw the cell Color
00918     rect.DeflateRect(m_nMargin+1, m_nMargin+1);
00919     pDC->Rectangle(rect);
00920
00921     // restore DC and cleanup
00922     pDC->SelectObject(pOldBrush);
00923     pDC->SelectObject(pOldPen);
00924     brush.DeleteObject();
00925     pen.DeleteObject();
00926
00927     if (pOldPalette && pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)
00928         pDC->SelectPalette(pOldPalette, FALSE);
00929 }
00930
00931 BOOL CCJColorPopup::OnQueryNewPalette()
00932 {
00933     Invalidate();
00934     return CWnd::OnQueryNewPalette();
00935 }
00936
00937 void CCJColorPopup::OnPaletteChanged(CWnd* pFocusWnd)
00938 {
00939     CWnd::OnPaletteChanged(pFocusWnd);
00940
00941     if (pFocusWnd->GetSafeHwnd() != GetSafeHwnd())
00942         Invalidate();
00943 }
00944
00945 void CCJColorPopup::OnKillFocus(CWnd* pNewWnd)
00946 {
00947     CWnd::OnKillFocus(pNewWnd);
00948
00949     ReleaseCapture();
00950     //DestroyWindow(); - causes crash when Custom Color dialog appears.
00951 }
00952
00953 // KillFocus problem fix suggested by Paul Wilkerson.
00954 void CCJColorPopup::OnActivateApp(BOOL bActive, HTASK hTask)
00955 {
00956     CWnd::OnActivateApp(bActive, hTask);
00957
00958     // If Deactivating App, cancel this selection
00959     if (!bActive)
00960          EndSelection(CPN_SELENDCANCEL);
00961 }
00962
00963 void CCJColorPopup::UpdateFont()
00964 {
00965     m_Font.DeleteObject();
00966     NONCLIENTMETRICS ncm;
00967     ncm.cbSize = sizeof(ncm);
00968     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00969     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00970     SetFont(&m_Font);
00971 }
00972
00973 BOOL CCJColorPopup::OnEraseBkgnd(CDC* pDC)
00974 {
00975     // KStowell - overridden for flicker-free drawing.
00976     UNUSED_ALWAYS(pDC);
00977     return TRUE;
00978 }
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJComboBoxEx.cpp Source File

WinCvs/CJLib/CJLibrary/CJComboBoxEx.cpp

Go to the documentation of this file.
00001 // CJComboBoxEx.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new
00007 // IE4 controls' http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:48 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/CJLibrary/CJComboBoxEx.cpp $
00015  *
00016  * $History: CJComboBoxEx.cpp $
00017  *
00018  * *****************  Version 5  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/CJLibrary
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 4  *****************
00024  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00025  * Updated in $/CodeJockey/CJLibrary
00026  * Added Unicode compliance, thanks to Barry Burton for his help with
00027  * this.
00028  *
00029  *
00030  * *****************  Version 2  *****************
00031  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00032  * Updated in $/CodeJockey/CJLibrary
00033  *
00034  * *****************  Version 1  *****************
00035  * User: Kirk Stowell Date: 6/25/99    Time: 12:05p
00036  * Created in $/CodeJockey/CJLibrary
00037  * Copied from MFC, Visual C++ 6. Added to extend functionality to Visual
00038  * C++ 5 users.
00039  *
00040  ***************************************************************************/
00042
00043 #include "stdafx.h"
00044 #include "CJComboBoxEx.h"
00045
00046 #ifdef _DEBUG
00047 #define new DEBUG_NEW
00048 #undef THIS_FILE
00049 static char THIS_FILE[] = __FILE__;
00050 #endif
00051
00053 // CCJComboBoxEx
00054
00055 BOOL CCJComboBoxEx::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
00056     UINT nID)
00057 {
00058   // initialize common controls
00059 #ifdef _VC_VERSION_5
00060     INITCOMMONCONTROLSEX icex;
00061     icex.dwSize = sizeof(icex);
00062     icex.dwICC = ICC_USEREX_CLASSES;
00063     VERIFY(InitCommonControlsEx(&icex));
00064 #else
00065     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_USEREX_REG));
00066 #endif
00067
00068     CWnd* pWnd = this;
00069     return pWnd->Create(WC_COMBOBOXEX, NULL, dwStyle, rect, pParentWnd, nID);
00070 }
00071
00072 int CCJComboBoxEx::DeleteItem(int iIndex)
00073 {
00074     ASSERT(::IsWindow(m_hWnd));
00075     return (int) ::SendMessage(m_hWnd, CBEM_DELETEITEM, (WPARAM) iIndex, 0);
00076 }
00077
00078 BOOL CCJComboBoxEx::GetItem(COMBOBOXEXITEM* pCBItem)
00079 {
00080     ASSERT(::IsWindow(m_hWnd));
00081     ASSERT(pCBItem != NULL);
00082     ASSERT(AfxIsValidAddress(pCBItem, sizeof(COMBOBOXEXITEM)));
00083
00084     return (int) ::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM) pCBItem);
00085 }
00086
00087 int CCJComboBoxEx::InsertItem(const COMBOBOXEXITEM* pCBItem)
00088 {
00089     ASSERT(::IsWindow(m_hWnd));
00090     ASSERT(pCBItem != NULL);
00091     ASSERT(AfxIsValidAddress(pCBItem, sizeof(COMBOBOXEXITEM), FALSE));
00092
00093     return (int) ::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM) pCBItem);
00094 }
00095
00096 int CCJComboBoxEx::InsertItem(int iItem, UINT nStringID, int iIndent, int iImage, int iSelectedImage, UINT mask)
00097 {
00098     CString strItem;
00099     strItem.LoadString(nStringID);
00100     return InsertItem(iItem, strItem, iIndent, iImage, iSelectedImage, mask);
00101 }
00102
00103 int CCJComboBoxEx::InsertItem(int iItem, LPCTSTR lpszItem, int iIndent, int iImage, int iSelectedImage, UINT mask)
00104 {
00105     COMBOBOXEXITEM cbItem;
00106
00107     cbItem.mask             = mask;
00108     cbItem.iItem            = iItem;
00109     cbItem.pszText          = const_cast<LPTSTR>(lpszItem);
00110     cbItem.iImage           = iImage;
00111     cbItem.iSelectedImage   = iSelectedImage;
00112     cbItem.iIndent          = iIndent;
00113
00114     return InsertItem(&cbItem);
00115 }
00116
00117 BOOL CCJComboBoxEx::SetItem(const COMBOBOXEXITEM* pCBItem)
00118 {
00119     ASSERT(::IsWindow(m_hWnd));
00120     ASSERT(pCBItem != NULL);
00121     ASSERT(AfxIsValidAddress(pCBItem, sizeof(COMBOBOXEXITEM), FALSE));
00122
00123     return (int) ::SendMessage(m_hWnd, CBEM_SETITEM, 0, (LPARAM) pCBItem);
00124 }
00125
00126 CCJComboBoxEx::~CCJComboBoxEx()
00127 {
00128     DestroyWindow();
00129 }
00130
00132
00133 IMPLEMENT_DYNAMIC(CCJComboBoxEx, CComboBox)
00134
00136
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJControlBar.cpp Source File

WinCvs/CJLib/CJLibrary/CJControlBar.cpp

Go to the documentation of this file.
00001 // CJControlBar.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 2000/06/26 17:17:16 $
00009  * $Revision: 1.2 $
00010  * $Archive: /CodeJock/CJLibrary/CJControlBar.cpp $
00011  *
00012  * $History: CJControlBar.cpp $
00013  *
00014  * *****************  Version 22  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:18p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Overrode OnEraseBkgnd(...) and OnPaint() to handle flicker free
00018  * drawing. Made additional modifications to load and save bar state
00019  * methods.
00020  *
00021  * Modified resource include for static builds.
00022  *
00023  * Enabled OnInitialUpdate() to be called for view classes added to a
00024  * CCJTabCtrlBar while the control bar is floating.
00025  *
00026  * Fixed potential resource and memory leak problems.
00027  *
00028  * Overloaded EnableFlatLook() method so that the gripper, frame buttons
00029  * and borders can be set flat individually.  Added inline function
00030  * EnableSaveState() which can be used to enable or disable the restore
00031  * bar state.
00032  *
00033  * Fixed bug with save / restore bar state, and with saved bar size
00034  * changing whenever the application starts.
00035  *
00036  * Fixed small initialization bug.
00037  *
00038  * *****************  Version 21  *****************
00039  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00040  * Updated in $/CodeJockey/CJLibrary
00041  * Updated copyright and contact information.
00042  *
00043  * *****************  Version 20  *****************
00044  * User: Kirk Stowell Date: 8/30/99    Time: 12:40a
00045  * Updated in $/CodeJockey/CJLibrary
00046  * Gero Kuehn <gero.kuehn@isc-soft.de> - Added check to see if tooltips
00047  * are valid before setting text.
00048  *
00049  * *****************  Version 19  *****************
00050  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00051  * Updated in $/CodeJockey/CJLibrary
00052  * Added Unicode compliance, thanks to Barry Burton for his help with
00053  * this.
00054  *
00055  *
00056  * *****************  Version 18  *****************
00057  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00058  * Updated in $/CodeJockey/CJLibrary
00059  *
00060  * *****************  Version 17  *****************
00061  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00062  * Updated in $/CodeJockey/CJLibrary
00063  *
00064  * *****************  Version 16  *****************
00065  * User: Kirk Stowell Date: 7/18/99    Time: 10:23p
00066  * Updated in $/CodeJockey/CJLibrary
00067  * Added derived button class to handle control bar caption button
00068  * updates. Cleaned up inline functions, and import/export macro so that
00069  * class will be imported when linked to, and exported at compile time.
00070  * Added save and restore control bar size and state functionality.
00071  *
00072  * *****************  Version 15  *****************
00073  * User: Kirk Stowell Date: 6/11/99    Time: 8:24p
00074  * Updated in $/CodeJockey/CJ60Lib
00075  * Slight modification made to popup menu code.
00076  *
00077  * *****************  Version 14  *****************
00078  * User: Kirk Stowell Date: 6/09/99    Time: 8:33p
00079  * Updated in $/CodeJockey/CJ60Lib
00080  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00081  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00082  * message handler, this is now automatically handled by the base class.
00083  * Added redraw flags to the create method and modified paint and layout
00084  * handlers to reduce flicker and un-necessary command handling. Dragging
00085  * rect now reflects actual control bar docked size. Added "flat" look to
00086  * the control bars, the control bars can now use the classic DevStudio
00087  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00088  * docking windows now handle dragging, docking and floating much better,
00089  * and behave more like DevStudio.
00090  *
00091  * *****************  Version 13  *****************
00092  * User: Kirk Stowell Date: 5/17/99    Time: 8:33p
00093  * Updated in $/CodeJockey/CJ60Lib
00094  * Removed Invalidate() from OnWindowPosChanged(..) and OnEraseBkgnd(..)
00095  * which seemed to cause painting problems.
00096  *
00097  * *****************  Version 12  *****************
00098  * User: Kirk Stowell Date: 5/03/99    Time: 9:52p
00099  * Updated in $/CodeJockey/CJ60Lib
00100  * Changed gripper and button macros to enums. Renamed popup member
00101  * variables to begin with popup, this will be consistent throughout all
00102  * classes. Added m_nPos member variable which can be set to the index of
00103  * the popup menu in the menu resource. Removed windows message handler
00104  * ON_WM_CONTEXTMENU(), and added handlers ON_WM_RBUTTONDOWN(),
00105  * ON_WM_MEASUREITEM(), ON_WM_MENUCHAR() and ON_WM_INITMENUPOPUP() to
00106  * support the CCJMenu popup. Added WS_CLIPSIBLINGS to control bar style.
00107  * Changed OnEraseBkgnd(CDC* pDC) to only draw client area when a child is
00108  * not present.
00109  *
00110  * *****************  Version 11  *****************
00111  * User: Kirk Stowell Date: 4/14/99    Time: 12:54p
00112  * Updated in $/CodeJockey/CJ60Lib
00113  * Modified context menu to use Brent Corkum's BCMenu (CCJMenu).
00114  *
00115  * *****************  Version 10  *****************
00116  * User: Kirk Stowell Date: 4/03/99    Time: 12:52p
00117  * Updated in $/CodeJockey/CJ60Lib
00118  * Added comments and cleaned up code.
00119  *
00120  * *****************  Version 9  *****************
00121  * User: Kirk Stowell Date: 3/13/99    Time: 12:54p
00122  * Updated in $/CodeJockey/CJ60Lib
00123  * Patrick Bergeron [patb@softimage.com] fixed the following bugs:
00124  *
00125  * I had a dialog nested in a CJControlBar. Unfortunately when I tried to
00126  * dock it to the left or right, the bottom part of my dialog would be
00127  * clipped off.
00128  *
00129  * Fix: When in docked mode, ::CalcDynamicLayout needed to return the
00130  * desired size, while taking into account the size of the gripper bar (if
00131  * any). Simply added a simple "+GetMinExt()" Now my dialog's bottom
00132  * doesn't get clipped. Woo-ha.
00133  *
00134  * When nesting a CDialog based window inside a CJControlBar, the 3D rect
00135  * drawn by ::OnEraseBkgnd would be overwritten by the top and left dialog
00136  * borders. The problem was caused by the fact that in the
00137  * ::OnWindowPosChanged() method, the rectangle which is used to move the
00138  * window contains the border. A simple call to rc.DeflateRect(1,1) solved
00139  * this problem.
00140  *
00141  * Added a call to UpdateWindow() in ::OnEraseBkgnd(). This helps with the
00142  * flickering a bit, but I Am not sure this is the correct way to go.
00143  * Incorporate at your own risks.
00144  *
00145  * Added 2 ASSERT()s in ::OnMouseMove(). This was not to fix a bug, but at
00146  * one point I was seeing strange things that lead me to add these
00147  * asserts. They don't do anything bad, so why remove them?
00148  *
00149  * *****************  Version 8  *****************
00150  * User: Kirk Stowell Date: 3/10/99    Time: 12:50p
00151  * Updated in $/CodeJockey/CJ60Lib
00152  * Fixed memory leak with button tooltips.
00153  *
00154  * *****************  Version 7  *****************
00155  * User: Kirk Stowell Date: 3/10/99    Time: 12:48p
00156  * Updated in $/CodeJockey/CJ60Lib
00157  * Added AfxRegisterWndClass() to create method to handle double clicks.
00158  * Thanks to Takehiko Mizoguti [mizoguti@m2.sys.to.casio.co.jp] for some
00159  * thoughts on this.
00160  *
00161  * *****************  Version 6  *****************
00162  * User: Kirk Stowell Date: 2/28/99    Time: 12:47p
00163  * Updated in $/CodeJockey/CJ60Lib
00164  * Calls default wnd proc if no context menu is defined Gonzalo Pereyra
00165  * [persys@adinet.com.uy]
00166  *
00167  * *****************  Version 5  *****************
00168  * User: Kirk Stowell Date: 1/31/99    Time: 12:48p
00169  * Updated in $/CodeJockey/CJ60Lib
00170  * Removed extra line (typo) from OnLButtonUp(). Thanks to Ioannis
00171  * Stamatopoulos (ystamat@mail.datamedia.gr) for pointing this out.
00172  *
00173  * *****************  Version 4  *****************
00174  * User: Kirk Stowell Date: 1/12/99    Time: 12:46p
00175  * Updated in $/CodeJockey/CJ60Lib
00176  * Total class re-write, added multiple/side-by-side controlbar docking.
00177  * No longer uses CSizingControlBar base class.
00178  *
00179  * *****************  Version 3  *****************
00180  * User: Kirk Stowell Date: 11/22/98   Time: 12:47p
00181  * Updated in $/CodeJockey/CJ60Lib
00182  * Modified set cursor to display normal size cursor when static linked.
00183  *
00184  * *****************  Version 2  *****************
00185  * User: Kirk Stowell Date: 10/20/98   Time: 12:45p
00186  * Updated in $/CodeJockey/CJ60Lib
00187  * Fixed problem with gripper and buttons disappearing when docking
00188  * toggled. Overloaded IsFloating() method from base class.
00189  *
00190  * *****************  Version 1  *****************
00191  * User: Kirk Stowell Date: 10/17/98   Time: 12:44p
00192  * Created in $/CodeJockey/CJ60Lib
00193  * Initial re-write and release.
00194  *
00195  ***************************************************************************/
00197
00198 #include "stdafx.h"
00199 #include "CJControlBar.h"
00200 #include "CJDockContext.h"
00201 #include "CJSizeDockBar.h"
00202 #include "CJResource.h"
00203
00204 #ifdef _DEBUG
00205 #define new DEBUG_NEW
00206 #undef THIS_FILE
00207 static char THIS_FILE[] = __FILE__;
00208 #endif
00209
00210 #define GRIP_INTRASPACING       1
00211 #define GRIP_SIZE               3
00212 #define GRIP_START              8
00213 #define TRACK_BORDER_SIZE       4
00214
00215 void CCJCBarButton::DrawButtonIcon(CDC* pDC, UINT nState, CRect& rcItem)
00216 {
00217     UNUSED_ALWAYS( rcItem );
00218
00219     // get the handle to the icon (if any) associated
00220     // with this button.
00221     HICON hIcon = GetIcon();
00222     if( hIcon == NULL ) {
00223         return;
00224     }
00225
00226     CRect rcWnd;
00227     GetWindowRect(&rcWnd);
00228
00229     int left   = (rcWnd.Width()-m_sizeIcon.cx)/2;
00230     int right  = left+m_sizeIcon.cx;
00231     int top    = (rcWnd.Height()-m_sizeIcon.cy)/2;
00232     int bottom = top+m_sizeIcon.cy;
00233
00234     // determine the size of the icon to be drawn.
00235     CRect rc(left,top,right,bottom);
00236
00237     // if the button is selected.
00238     if( nState & ODS_SELECTED )
00239     {
00240         if( m_hPushed ) {
00241             hIcon = m_hPushed;
00242         }
00243         else {
00244             rc.OffsetRect(1,1);
00245         }
00246     }
00247
00248     // draw the icon associated with this button.
00249     pDC->DrawState( rc.TopLeft(), rc.Size(), hIcon, DSS_NORMAL, (HBRUSH)NULL );
00250 }
00251
00253 // CCJControlBar
00254
00255 CCJControlBar::CCJControlBar()
00256 {
00257     m_popupMenuID       = 0;
00258     m_popToolbarID      = 0;
00259     m_nPos              = 0;
00260     m_bToFit            = FALSE;
00261     m_bOkToDrag         = FALSE;
00262     m_bDragging         = FALSE;
00263     m_bMaximized        = FALSE;
00264     m_bUnique           = FALSE;
00265     m_bGripper          = TRUE;
00266     m_bButtons          = TRUE;
00267     m_bFlatGripper      = FALSE;            // Yiannhs Ver 6.06 Start Up With Flat Gripper
00268     m_bFlatBorder       = FALSE;            // Yiannhs Start Up With Flat Border
00269     m_bAutoSave         = TRUE;
00270     m_sizeVert          = CSize(200,100);   // Yiannhs to test different rectangles
00271     m_sizeHorz          = CSize(200,100);
00272     m_sizeFloat         = CSize(200,100);
00273     m_sizeDesired       = CSize(200,100);
00274     m_sizeNormal        = CSize(200,100);
00275     m_cxOffset          = 5;
00276     m_cyOffset          = 3;
00277     m_pChildWnd         = NULL;
00278     m_strSection        = _T("");
00279     m_eAuxIndex         = HIDE_CONTRLBAR;
00280     m_hIcon             = NULL;
00281     m_hAuxIcon          = NULL;
00282     m_eChildBorder      = NONE;
00283     m_nID               = 0;
00284     m_bFloating         = FALSE;
00285
00286     // Create the image list used by frame buttons.
00287     m_ImageList.Create(IDB_BUTTON_IMAGES,
00288         10, 1, RGB(255,255,255));
00289 }
00290
00291 CCJControlBar::~CCJControlBar()
00292 {
00293     // fix potential resource leak - KStowell - 10-22-99.
00294     m_ImageList.DeleteImageList();
00295     _destroyIcon(m_hIcon);
00296     _destroyIcon(m_hAuxIcon);
00297 }
00298
00299 IMPLEMENT_DYNAMIC(CCJControlBar, CControlBar)
00300
00301 BEGIN_MESSAGE_MAP(CCJControlBar, CControlBar)
00302     //{{AFX_MSG_MAP(CCJControlBar)
00303     ON_WM_NCPAINT()
00304     ON_WM_PAINT()
00305     ON_WM_MOUSEMOVE()
00306     ON_WM_SETCURSOR()
00307     ON_WM_LBUTTONUP()
00308     ON_WM_NCHITTEST()
00309     ON_WM_CREATE()
00310     ON_WM_WINDOWPOSCHANGED()
00311     ON_WM_LBUTTONDOWN()
00312     ON_COMMAND(IDC_BUTTON_HIDE, OnButtonClose)
00313     ON_UPDATE_COMMAND_UI(IDC_BUTTON_HIDE, OnUpdateButtonClose)
00314     ON_COMMAND(IDC_BUTTON_MINI, OnButtonMinimize)
00315     ON_UPDATE_COMMAND_UI(IDC_BUTTON_MINI, OnUpdateButtonMinimize)
00316     ON_WM_RBUTTONDOWN()
00317     ON_WM_MEASUREITEM()
00318     ON_WM_MENUCHAR()
00319     ON_WM_INITMENUPOPUP()
00320     ON_WM_ERASEBKGND()
00321     //}}AFX_MSG_MAP
00322 END_MESSAGE_MAP()
00323
00325 // CCJControlBar overrides
00326
00327 void CCJControlBar::EnableFlatLook(BOOL bFlat)
00328 {
00329     EnableFlatLook(bFlat, bFlat, bFlat);
00330 }
00331
00332 void CCJControlBar::EnableFlatLook(BOOL bGripper, BOOL bBorder, BOOL bButtons)
00333 {
00334     ASSERT(::IsWindow(m_hWnd));
00335     m_bFlatGripper = bGripper;
00336     m_bFlatBorder  = bBorder;
00337     m_btnClose.DisableFlatLook( bButtons );
00338     m_btnMinim.DisableFlatLook( bButtons );
00339     Invalidate();
00340 }
00341
00342 BOOL CCJControlBar::Create(CWnd *pParentWnd, UINT nID, LPCTSTR lpszWindowName, CSize sizeDefault, DWORD dwStyle, BOOL bFlatBorders)
00343 {
00344     ASSERT_VALID(pParentWnd);   // must have a parent
00345
00346     // If autosave is enabled, get the previous settings from the registry.
00347     if( m_bAutoSave ) {
00348         LoadBarState(sizeDefault, nID);
00349     }
00350
00351     // Set initial control bar style.
00352     SetBarStyle(dwStyle & CBRS_ALL|CBRS_HIDE_INPLACE|CBRS_SIZE_DYNAMIC|CBRS_FLOAT_MULTI);
00353
00354     dwStyle &= ~CBRS_ALL;
00355     dwStyle |= WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN;
00356
00357     m_sizeDesired = m_sizeNormal = sizeDefault;
00358     m_sizeHorz = m_sizeVert = m_sizeFloat = sizeDefault; // Yiannhs : Setup the new sizes as well
00359
00360     // Set flat control bar style.
00361     m_bFlatGripper = m_bFlatBorder = bFlatBorders;
00362
00363     // Yiannhs this seems a better way than mine, to register the double clicks class.
00364     // I have just added the redraw flags i was using in ver 6.06
00365     CString wndClass = ::AfxRegisterWndClass(
00366         CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW, 0, ::GetSysColorBrush(COLOR_BTNFACE));
00367
00368     CRect rect( 0, 0, sizeDefault.cx, sizeDefault.cy );
00369     return CWnd::Create( wndClass, lpszWindowName, dwStyle, rect, pParentWnd, nID );
00370 }
00371
00372 BOOL CCJControlBar::PreTranslateMessage(MSG* pMsg)
00373 {
00374     // *** GK/ISC
00375     if (m_bButtons && m_ToolTip.GetSafeHwnd()) {
00376         m_ToolTip.RelayEvent(pMsg);
00377     }
00378     return CControlBar::PreTranslateMessage(pMsg);
00379 }
00380
00381 void CCJControlBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
00382 {
00383     UNUSED_ALWAYS(pTarget);
00384     UNUSED_ALWAYS(bDisableIfNoHndler);
00385
00386     if((m_bButtons == FALSE) || IsFloating()) {
00387         return;
00388     }
00389
00390     BOOL            bEnable     = FALSE;
00391     UINT            uIDText     = NULL;
00392     BTN_IMG_INDEX   eAuxIndex   = m_eAuxIndex;
00393
00394     if (IsHorzDocked()) {
00395         if (m_bUnique) {
00396             uIDText   = IDS_EXPAND;
00397             eAuxIndex = MAXI_H_DISABLE;
00398             bEnable   = FALSE;
00399         } else if (!m_bMaximized) {
00400             uIDText   = IDS_EXPAND;
00401             eAuxIndex = MAXI_H_ENABLED;
00402             bEnable   = TRUE;
00403         } else {
00404             uIDText   = IDS_CONTRACT;
00405             eAuxIndex = NORM_H_ENABLED;
00406             bEnable   = TRUE;
00407         }
00408     } else {
00409         if (m_bUnique) {
00410             uIDText   = IDS_EXPAND;
00411             eAuxIndex = MAXI_V_DISABLE;
00412             bEnable   = FALSE;
00413         } else if (!m_bMaximized) {
00414             uIDText   = IDS_EXPAND;
00415             eAuxIndex = MAXI_V_ENABLED;
00416             bEnable   = TRUE;
00417         } else {
00418             uIDText   = IDS_CONTRACT;
00419             eAuxIndex = NORM_V_ENABLED;
00420             bEnable   = TRUE;
00421         }
00422     }
00423
00424     // we are only concerned if the image index has changed.
00425     if(eAuxIndex != m_eAuxIndex) {
00426         m_eAuxIndex = eAuxIndex;
00427
00428         // if the button is a valid window, set the new icon.
00429         if(m_btnMinim.GetSafeHwnd()) {
00430             // fix potential resource leak - KStowell - 10-22-99.
00431             _destroyIcon(m_hAuxIcon);
00432             m_hAuxIcon = m_ImageList.ExtractIcon((int)eAuxIndex);
00433             m_btnMinim.SetIcon(m_hAuxIcon, CSize(10,10));
00434             m_btnMinim.EnableWindow(bEnable);
00435
00436             // if the tooltip control is valid, update the tip text.
00437             if(m_ToolTip.GetSafeHwnd()) {
00438                 m_ToolTip.UpdateTipText(uIDText, &m_btnMinim);
00439             }
00440         }
00441     }
00442 }
00443
00444 CSize CCJControlBar::CalcDynamicLayout(int nLength, DWORD nMode)
00445 {
00446     CSize sizeResult = m_sizeDesired;
00447
00448     //1999-05-19 Yiannhs. Since We Get Here from different Places do some more calculations.
00449     //                    Give Visual Feedback to user.
00450
00451     if( !nLength )
00452     {
00453         CRect rect;
00454         GetWindowRect( rect );
00455         sizeResult = rect.Size();
00456
00457         if( nMode & LM_HORZDOCK )
00458         {
00459             if( !IsHorzDocked() ) {
00460                 sizeResult = m_sizeHorz;
00461             }
00462             else if( nMode & LM_VERTDOCK )
00463             {
00464                 if( !IsVertDocked() ) {
00465                     sizeResult = m_sizeVert;
00466                 }
00467                 else {
00468                     sizeResult = m_sizeFloat;           //Do not check if it is floating. Do it
00469                 }
00470                 return( sizeResult );                   //do not go on
00471             }
00472         }
00473     }
00474     //1999-05-19    Yiannhs
00475
00476     if( IsFloating( ))
00477     {
00478         if (nMode == LM_HORZ) {
00479             if (nLength < 50)
00480                 nLength = 50;
00481             m_sizeDesired.cx = nLength;
00482         }
00483
00484         if (nMode == (LM_LENGTHY | LM_HORZ)) {
00485             if (nLength < 50)
00486                 nLength = 50;
00487             m_sizeDesired.cy = nLength;
00488         }
00489
00490         sizeResult = m_sizeDesired;
00491
00492     }
00493
00494     return sizeResult;
00495 }
00496
00498 // CCJControlBar message handlers
00499
00500 void CCJControlBar::OnNcPaint()
00501 {
00502     EraseNonClient();
00503 }
00504
00505 void CCJControlBar::OnPaint()
00506 {
00507     CPaintDC dc(this); // device context for painting
00508
00509     // Get the client rect.
00510     CRect rcClient;
00511     GetClientRect( &rcClient );
00512
00513     // Create a memory device-context. This is done to help reduce
00514     // screen flicker, since we will paint the entire control to the
00515     // off screen device context first.
00516     CDC memDC;
00517     CBitmap bitmap;
00518     memDC.CreateCompatibleDC(&dc);
00519     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00520     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00521
00522     // repaint the background.
00523     memDC.FillSolidRect( rcClient, afxData.clrBtnFace );
00524     DrawBorders(&memDC, rcClient);
00525
00526     // draw a border around the child area.
00527     if( m_eChildBorder != NONE )
00528     {
00529         CRect rect;
00530         GetChildRect(rect);
00531
00532         if( m_eChildBorder == OUTLINE ) {
00533             memDC.Draw3dRect(rect, afxData.clrWindowFrame, afxData.clrWindowFrame);
00534         } else if( m_eChildBorder == SUNKEN ) {
00535             rect.InflateRect(1,1);
00536             memDC.Draw3dRect(rect, afxData.clrBtnShadow, afxData.clrBtnHilite);
00537             rect.DeflateRect(1,1);
00538             memDC.Draw3dRect(rect, afxData.clrWindowFrame, afxData.clrBtnFace);
00539         } else if( m_eChildBorder == RAISED ) {
00540             rect.InflateRect(1,1);
00541             memDC.Draw3dRect(rect, afxData.clrBtnHilite, afxData.clrWindowFrame);
00542             rect.DeflateRect(1,1);
00543             memDC.Draw3dRect(rect, afxData.clrBtnFace, afxData.clrBtnShadow);
00544         }
00545     }
00546
00547     // copy the memory device context back into the original DC via BitBlt().
00548     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00549
00550     // cleanup resources.
00551     memDC.SelectObject(pOldBitmap);
00552     memDC.DeleteDC();
00553     bitmap.DeleteObject();
00554 }
00555
00556 void CCJControlBar::OnMouseMove(UINT nFlags, CPoint point)
00557 {
00558     HitTest(point);
00559     CRect rectDock;
00560     if( m_bDragging )
00561     {
00562         ASSERT(GetParent() != NULL);
00563
00564         GetParent()->GetClientRect(&rectDock);
00565         ClientToScreen(&rectDock);
00566         ClientToScreen(&point);
00567
00568         CFrameWnd *pFrame=GetDockingFrame();
00569         ASSERT(pFrame != NULL);
00570
00571         pFrame -> ScreenToClient(&point);
00572         pFrame->ScreenToClient(&rectDock);
00573
00574         point.x = point.x>rectDock.right ? rectDock.right:point.x;
00575         point.x = point.x<rectDock.left ? rectDock.left:point.x;
00576         point.y = point.y>rectDock.bottom ? rectDock.bottom:point.y;
00577         point.y = point.y<rectDock.top ? rectDock.top:point.y;
00578
00579         OnInvertTracker(m_rcTrack);
00580         int deltaX = point.x-m_ptCurDrag.x;
00581         int deltaY = point.y-m_ptCurDrag.y;
00582
00583         if(IsVertDocked()) {
00584             m_rcTrack.top += deltaY;
00585             m_rcTrack.bottom += deltaY;
00586         }
00587
00588         else if (IsHorzDocked()) {
00589             m_rcTrack.left += deltaX;
00590             m_rcTrack.right += deltaX;
00591         }
00592
00593         OnInvertTracker(m_rcTrack);
00594         m_ptCurDrag = point;
00595     }
00596
00597     else {
00598         // Yiannhs: Do not let default handler go on, if we have worked with the message
00599         CControlBar::OnMouseMove(nFlags, point);
00600     }
00601 }
00602
00603 BOOL CCJControlBar::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
00604 {
00605     return (!m_bOkToDrag && !m_bDragging)?
00606         CControlBar::OnSetCursor(pWnd, nHitTest, message):FALSE;
00607 }
00608
00609
00610 //1999-05-19    Yiannhs
00611 void CCJControlBar::OnLButtonUp(UINT nFlags, CPoint point)
00612 {
00613     if( m_bDragging )
00614     {
00615         ReleaseCapture();
00616         OnInvertTracker(m_rcTrack);
00617 //1999-05-19 Yiannhs. Moved the statement below
00618         //m_bDragging = FALSE;
00619
00620         // Yiannhs: reduce unnessesary actions. Ok It works
00621  //1999-05-19 Yiannhs. Changed according to the statement above
00622         if( m_ptCurDrag == m_ptStartDrag ) {
00623             m_bDragging = FALSE;
00624             return;
00625         }
00626
00627         if(IsVertDocked()) {
00628             int newHeight = m_rcTrack.top-m_ptStartDrag.y;
00629             m_sizeDesired.cy += newHeight;
00630             m_sizeDesired.cy = m_sizeDesired.cy > GetMinExt() ? m_sizeDesired.cy : GetMinExt();
00631             // Yiannhs: there is a comment in the previous version for change. This is the Line
00632             // This is probably for sizing with many control bars in dock bar
00633             // m_sizeDesired.cy = m_sizeDesired.cy > rectAvail.Height() ? rectAvail.Height() : m_sizeDesired.cy;
00634
00635 //1999-05-19 Yiannhs. Assign unused sizes
00636             m_sizeVert = m_sizeDesired;
00637         }
00638
00639         else { //if (IsHorzDocked()) {  //1999-05-19. Floating control bars do not receive this message
00640
00641             int newWidth = m_rcTrack.left-m_ptStartDrag.x;
00642             m_sizeDesired.cx += newWidth;
00643             m_sizeDesired.cx = m_sizeDesired.cx > GetMinExt() ? m_sizeDesired.cx : GetMinExt();
00644             // Yiannhs: there is a comment in the previous version for change. This is the Line
00645             // This is probably for sizing with many control bars in dock bar
00646             // m_sizeDesired.cx = m_sizeDesired.cx > rectAvail.Width() ? rectAvail.Width() : m_sizeDesired.cx;
00647
00648 //1999-05-19 Yiannhs. Assign unused sizes
00649             m_sizeHorz = m_sizeDesired;
00650         }
00651
00652 //1999-05-19    Yiannhs
00653         //((CCJSizeDockBar *)GetParent())->CalcSizeBarLayout();
00654         //resizing a control bar, means, that the DockBar should be normalized.
00655         //and normalize does the layout
00656         m_sizeNormal = m_sizeDesired;       //set the new normal size here
00657         ((CCJSizeDockBar *)GetParent())->Normalize( this );
00658         m_bDragging = FALSE;        //flag off the drag action now. The movement has been complited
00659                                     //so as I can check it on change position
00660         CRect rc;                   // Now Use The Size of the control bar to fill the right sizes.
00661         GetWindowRect( rc );
00662         if( IsHorzDocked() )
00663             m_sizeNormal.cy = m_sizeHorz.cy = m_sizeDesired.cy = rc.Height();
00664         else
00665             m_sizeNormal.cx = m_sizeVert.cx = m_sizeDesired.cx = rc.Width();
00666 //1999-05-19    Yiannhs
00667
00668     }
00669
00670     else {
00671         // Yiannhs: again don't go to default handler if we have already handled the message
00672         CControlBar::OnLButtonUp(nFlags, point);
00673     }
00674 }
00675
00676 UINT CCJControlBar::OnNcHitTest(CPoint /*point*/)
00677 {
00678     return HTCLIENT;
00679 }
00680
00681 BOOL CCJControlBar::OnEraseBkgnd(CDC* pDC)
00682 {
00683     // KStowell - overridden for flicker-free drawing.
00684     UNUSED_ALWAYS(pDC);
00685     return TRUE;
00686 }
00687
00688 int CCJControlBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
00689 {
00690     if (CControlBar::OnCreate(lpCreateStruct) == -1)
00691         return -1;
00692
00693     if (m_bButtons)
00694     {
00695         if(!m_btnClose.Create(NULL, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
00696             BS_NOTIFY | BS_OWNERDRAW | BS_ICON,
00697             CRect(0,0,0,0), this, IDC_BUTTON_HIDE ))
00698         {
00699             TRACE0( "Unable to create close button\n" );
00700             return -1;
00701         }
00702
00703
00704         if(!m_btnMinim.Create(NULL, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
00705             BS_NOTIFY | BS_OWNERDRAW | BS_ICON,
00706             CRect(0,0,0,0), this, IDC_BUTTON_MINI ))
00707         {
00708             TRACE0( "Unable to create minimize button\n" );
00709             return -1;
00710         }
00711
00712         // Yiannhs Selective flat style interface. The difference is in adding the if statement
00713         if( !m_bFlatBorder && !m_bFlatGripper ) {
00714             m_btnClose.DisableFlatLook();
00715             m_btnMinim.DisableFlatLook();
00716         }
00717
00718         m_hIcon = m_ImageList.ExtractIcon(0);
00719         m_btnClose.SetIcon(m_hIcon, CSize(10,10));
00720
00721         // Create the ToolTip control.
00722         m_ToolTip.Create(this);
00723         m_ToolTip.Activate(TRUE);
00724         m_ToolTip.AddTool (&m_btnClose, IDS_HIDE);
00725         m_ToolTip.AddTool (&m_btnMinim, IDS_EXPAND);
00726     }
00727
00728     return 0;
00729 }
00730
00731 void CCJControlBar::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
00732 {
00733     CControlBar::OnWindowPosChanged(lpwndpos);
00734
00735     if (m_bButtons)
00736     {
00737         if (IsFloating())
00738         {
00739             m_btnClose.ShowWindow(SW_HIDE);
00740             m_btnMinim.ShowWindow(SW_HIDE);
00741         }
00742
00743         else
00744         {
00745             m_btnClose.ShowWindow(SW_SHOW);
00746             m_btnMinim.ShowWindow(SW_SHOW);
00747
00748             CRect rcClose(GetButtonRect());
00749             CRect rcMinim(GetButtonRect());
00750
00751             if (IsHorzDocked()) {
00752                 rcMinim.OffsetRect(0,14);
00753             }
00754
00755             else {
00756                 rcClose.OffsetRect(14,0);
00757             }
00758
00759             m_btnClose.MoveWindow(rcClose);
00760             m_btnMinim.MoveWindow(rcMinim);
00761         }
00762     }
00763
00764     //1999-05-19 Yiannhs
00765     //Calculate Extra Size variables
00766     CSize sizeTemp( lpwndpos->cx, lpwndpos->cy );
00767
00768     // save the current size to the registry.
00769     if( m_bAutoSave ) {
00770         SaveBarState(sizeTemp);
00771     }
00772
00773     if( IsFloating() ) {
00774         m_sizeFloat = sizeTemp;
00775     }
00776
00777     else if( !m_bDragging )
00778     {
00779         if( IsHorzDocked() ) {
00780             m_sizeHorz = sizeTemp;
00781         } else {
00782             m_sizeVert = sizeTemp;
00783         }
00784     }
00785
00786     if( m_pChildWnd->GetSafeHwnd( )) {
00787         CRect rc;
00788         GetChildRect(rc);
00789         rc.DeflateRect(1,1);
00790         m_pChildWnd->MoveWindow(rc);
00791     }
00792 }
00793
00794 //1999-05-19 Yiannhs
00795 void CCJControlBar::OnLButtonDown(UINT nFlags, CPoint point)
00796 {
00797     // Yiannhs. When the bar is inside a mdiframe window, and click on area
00798     // the inner child does not cover, the whole area is grayed!!!
00799
00800     if( IsFloating( )) //see Tab ControlBar
00801     {
00802         // If the window is floating, we want to
00803         // bring it up to the top.
00804         SetFocus();
00805         SetWindowPos( NULL, 0,0,0,0,
00806             SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW );
00807         return;
00808     }
00809
00810     if (m_bOkToDrag)
00811     {
00812         CFrameWnd *pFrame=GetDockingFrame();
00813         GetClientRect(m_rcTrack);
00814
00815         if (IsVertDocked()) {
00816             // Yiannhs
00817             m_rcTrack.top = m_rcTrack.bottom - TRACK_BORDER_SIZE -2;
00818             m_rcTrack.bottom-=2;
00819         }
00820 //1999-05-19 Yiannhs. do not call one more function
00821         else { //if (IsHorzDocked()) {
00822             // Yiannhs
00823             m_rcTrack.left = m_rcTrack.right - TRACK_BORDER_SIZE -2;
00824             m_rcTrack.right-=2;
00825         }
00826
00827         ClientToScreen(&m_rcTrack);
00828         pFrame->ScreenToClient(&m_rcTrack);
00829         ClientToScreen(&point);
00830         pFrame->ScreenToClient(&point);
00831
00832         m_ptStartDrag = point;
00833         m_ptCurDrag = point;
00834
00835         SetCapture();
00836         m_bDragging = TRUE;
00837         OnInvertTracker(m_rcTrack);
00838     }
00839
00840     else if (m_pDockBar) {
00841         if (OnToolHitTest(point, NULL) == -1) {
00842             ClientToScreen(&point);
00843 //1999-05-26 Yiannhs
00844 //          Handle the message loop before CDockContext
00845             MSG msg;
00846             ValidateRect( NULL );   //Make sure this control bar will not ask for Paint messages later
00847             HWND    hwnd = NULL;
00848             while (::PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_REMOVE))
00849             {   //ask for messages in any window of the application, and remove those
00850                 DispatchMessage( &msg );
00851                 if( msg.hwnd != this->m_hWnd ) {
00852                     hwnd = msg.hwnd;    //keep the window which receives paint messages
00853                     break;              //exit the loop
00854                 }
00855             }
00856
00857             if( hwnd ) {    //if a window is getting Paint messages work on it
00858                 ::ValidateRect( hwnd, NULL );   //the window does not need painting
00859                 ::ValidateRect( ::GetParent( hwnd ), NULL );    //Its parent window as well
00860                 while (::PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_REMOVE)) {
00861                     //work on the Paint messages once more
00862                     ::TranslateMessage( &msg );
00863                     ::DispatchMessage( &msg );
00864                 }
00865             }
00866
00867 //1999-05-26 Yiannhs
00868
00869             ((CCJDockContext*)m_pDockContext)->StartDragDockBar(point);
00870         }
00871     }
00872
00873     // Yiannhs
00874     else {
00875         CControlBar::OnLButtonDown(nFlags, point);
00876     }
00877 }
00878
00879 void CCJControlBar::OnButtonClose()
00880 {
00881     GetDockingFrame()->ShowControlBar(this,FALSE,FALSE);
00882 }
00883
00884 void CCJControlBar::OnUpdateButtonClose(CCmdUI* pCmdUI)
00885 {
00886     pCmdUI->Enable();
00887 }
00888
00889 void CCJControlBar::OnButtonMinimize()
00890 {
00891     if (!m_bMaximized) {
00892         ((CCJSizeDockBar *)GetParent())->Maximize(this);
00893         m_bMaximized = TRUE;
00894     }
00895
00896     else {
00897         ((CCJSizeDockBar *)GetParent())->Normalize(this);
00898         m_bMaximized = FALSE;
00899     }
00900 }
00901
00902 void CCJControlBar::OnUpdateButtonMinimize(CCmdUI* pCmdUI)
00903 {
00904     pCmdUI->Enable();
00905 }
00906
00908 // CCJControlBar operations
00909
00910 void CCJControlBar::EnableDockingOnSizeBar(DWORD dwDockStyle)
00911 {
00912     ASSERT(m_pDockContext == NULL);
00913     m_dwDockStyle = dwDockStyle;
00914
00915     if (m_pDockContext == NULL)
00916         m_pDockContext = new CCJDockContext(this);
00917
00918     if (m_hWndOwner == NULL)
00919         m_hWndOwner = ::GetParent(m_hWnd);
00920 }
00921
00922 void CCJControlBar::Maximize(int size)
00923 {
00924     m_sizeNormal = m_sizeDesired;
00925     if (IsHorzDocked()) {
00926         m_sizeDesired.cx = size;
00927     }
00928
00929     else if (IsVertDocked()) {
00930         m_sizeDesired.cy = size;
00931     }
00932
00933     m_bMaximized = TRUE;
00934 }
00935
00936 void CCJControlBar::Minimize()
00937 {
00938     m_sizeNormal = m_sizeDesired;
00939
00940     if (IsHorzDocked()) {
00941         m_sizeDesired.cx = GetMinExt();
00942     }
00943
00944     else if (IsVertDocked()) {
00945         m_sizeDesired.cy = GetMinExt();
00946     }
00947
00948     m_bMaximized = FALSE;
00949 }
00950
00951 void CCJControlBar::Normalize()
00952 {
00953     if (IsHorzDocked()) {
00954         m_sizeDesired.cx = m_sizeNormal.cx;
00955     }
00956
00957     else if (IsVertDocked()) {
00958         m_sizeDesired.cy = m_sizeNormal.cy;
00959     }
00960
00961     m_bMaximized = FALSE;
00962 }
00963
00964 int CCJControlBar::GetMinExt()
00965 {
00966     int nRet = TRACK_BORDER_SIZE;
00967
00968     if (m_bGripper || m_bButtons) {
00969         nRet += GRIP_START;
00970         nRet += GRIP_SIZE*2;
00971         nRet += GRIP_INTRASPACING*3+2;
00972     }
00973
00974     else
00975         nRet += 2;
00976
00977     return nRet;
00978 }
00979
00980 void CCJControlBar::GetChildRect(CRect &rect)
00981 {
00982     GetClientRect(&rect);
00983
00984     if (IsFloating()) {
00985         rect.DeflateRect(3,3);
00986     } else {
00987         if (IsVertDocked()) {
00988             rect.DeflateRect(m_cxOffset, 0);
00989             rect.top += (GetMinExt()-5);
00990             //Yiannhs: if it is the last bar inside a dockbar, cover the whole space
00991             if( !m_bToFit ) {
00992                 rect.bottom -= (TRACK_BORDER_SIZE + 4);
00993             } else {
00994                 rect.bottom -= 4;
00995             }
00996         } else {
00997             rect.left   += (GetMinExt()-5);
00998             //Yiannhs: if it is the last bar inside a dockbar, cover the whole space
00999             if( !m_bToFit ) {
01000                 rect.right  -= (TRACK_BORDER_SIZE + 4);
01001             } else {
01002                 rect.right  -= 4;
01003             }
01004             rect.DeflateRect(0, m_cxOffset);
01005         }
01006
01007         if( rect.left > rect.right || rect.top > rect.bottom )
01008             rect = CRect(0,0,0,0);
01009     }
01010 }
01011
01012 void CCJControlBar::EraseNonClient()
01013 {
01014     CWindowDC dc(this);
01015
01016     CRect rectClient;
01017     GetClientRect(rectClient);
01018     CRect rectWindow;
01019     GetWindowRect(rectWindow);
01020     ScreenToClient(rectWindow);
01021     rectClient.OffsetRect(-rectWindow.left, -rectWindow.top);
01022
01023     dc.ExcludeClipRect(rectClient);
01024     rectWindow.OffsetRect(-rectWindow.left, -rectWindow.top);
01025 }
01026
01027 void CCJControlBar::DrawBorders(CDC *pDC, CRect &rect)
01028 {
01029     CRect rc;
01030     rc.CopyRect(&rect);
01031
01032     CRect rcTrack;
01033     rcTrack.CopyRect(&rc);
01034
01035     if(IsVertDocked())
01036     {
01037         if (!m_bToFit) {
01038             rcTrack.top = rc.bottom - TRACK_BORDER_SIZE;
01039             rcTrack.top-=2;
01040             rcTrack.bottom-=1;
01041
01042             //Yiannhs flat interface style
01043             if( !m_bFlatBorder )
01044                 pDC->Draw3dRect(rcTrack, afxData.clrBtnHilite, afxData.clrBtnShadow);
01045             else
01046                 pDC->FillSolidRect(rcTrack, afxData.clrBtnFace);
01047         }
01048     }
01049
01050     else if (IsHorzDocked())
01051     {
01052         if (!m_bToFit) {
01053             rcTrack.left = rc.right - TRACK_BORDER_SIZE;
01054             rcTrack.left-=2;
01055             rcTrack.right-=1;
01056
01057             //Yiannhs flat interface style
01058             if( !m_bFlatBorder )
01059                 pDC->Draw3dRect(rcTrack, afxData.clrBtnHilite, afxData.clrBtnShadow);
01060             else
01061                 pDC->FillSolidRect(rcTrack, afxData.clrBtnFace);
01062         }
01063     }
01064
01065     DrawGripper(pDC);
01066 }
01067
01068 void CCJControlBar::HitTest(CPoint &point)
01069 {
01070     CRect rcWin;
01071     GetClientRect(&rcWin);
01072     HCURSOR hCur = ::LoadCursor(NULL,IDC_ARROW);
01073
01074     if( !m_bDragging )
01075     {
01076         if (IsVertDocked()) {
01077             rcWin.top = rcWin.bottom - TRACK_BORDER_SIZE;
01078             m_bOkToDrag = (rcWin.PtInRect(point) && !m_bToFit);
01079             if(m_bOkToDrag) {
01080                 hCur = AfxGetApp()->LoadCursor(IDC_VSPLITBAR);
01081             }
01082         }
01083
01084         else if (IsHorzDocked()) {
01085             rcWin.left = rcWin.right - TRACK_BORDER_SIZE;
01086             m_bOkToDrag = (rcWin.PtInRect(point) && !m_bToFit);
01087             if(m_bOkToDrag) {
01088                 hCur = AfxGetApp()->LoadCursor(IDC_HSPLITBAR);
01089             }
01090         }
01091
01092         SetCursor(hCur);
01093     }
01094 }
01095
01096 void CCJControlBar::OnInvertTracker(const CRect &rect)
01097 {
01098     ASSERT_VALID(this);
01099     ASSERT(!rect.IsRectEmpty());
01100
01101     CDC* pDC = GetDockingFrame()->GetDC();
01102     CBrush* pBrush = CDC::GetHalftoneBrush();
01103     CBrush* pOldBrush = NULL;
01104
01105     if (pBrush != NULL) {
01106         pOldBrush = pDC->SelectObject(pBrush);
01107     }
01108
01109     pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATINVERT);
01110
01111     if (pOldBrush != NULL) {
01112         pDC->SelectObject(pOldBrush);
01113     }
01114     GetDockingFrame()->ReleaseDC(pDC);
01115 }
01116
01117 // Yiannhs this was taken from code in CodeGuru site. Draw gradient flat caption
01118 // still needs some refinement
01119
01120 #define COLOR_WHITE     RGB(255,255,255)
01121 #define COLOR_BLACK     RGB(0,0,0)
01122 #define NCOLORSHADES    64      // this many shades in gradient
01123
01124 void CCJControlBar::DrawGriperCaption( CDC * pDC, LPRECT pRect )        //yiannhs
01125 {
01126     ASSERT( pDC );
01127     ASSERT( pRect );
01128     if (!IsFloating() && m_bGripper)
01129     {
01130         BOOL m_bIsHorz = IsHorzDocked();
01131         CRect TheRect( pRect );
01132         COLORREF clrBG = GetSysColor(COLOR_ACTIVECAPTION); // background color
01133         int cxCap = 0;
01134         int cyCap = 0;
01135         int rx = TheRect.left;
01136         int ry = TheRect.top;
01137         if( !m_bIsHorz ) {
01138             cxCap = TheRect.Width();
01139             cyCap = TheRect.Height();
01140         } else {
01141             cxCap = TheRect.Height();
01142             cyCap = TheRect.Width();
01143             //            rx = TheRect.top;
01144             //            ry = TheRect.left;
01145         }
01146
01147         int r = GetRValue(clrBG);               // red..
01148         int g = GetGValue(clrBG);               // ..green
01149         int b = GetBValue(clrBG);               // ..blue color vals
01150         int w = cxCap;                          // width of area to shade
01151         int xDelta= max(w/NCOLORSHADES,1);      // width of one shade band
01152         int x = xDelta;
01153         CBrush* pOldBrush = NULL;
01154         {
01155             CBrush brush(RGB(0,0,0));
01156             pOldBrush = pDC->SelectObject(&brush);
01157             if( !m_bIsHorz ) {
01158                 pDC->PatBlt(rx, ry, x, cyCap, PATCOPY);
01159             } else {
01160                 pDC->PatBlt(rx, ry, cyCap, x, PATCOPY);
01161             }
01162             pDC->SelectObject(pOldBrush);
01163
01164             // fix potential resource leak - KStowell - 10-21-99
01165             brush.DeleteObject();
01166         }
01167         int w2  = w*w;                                              // w squared
01168         while( x < cxCap ) {                                       // paint bands right to left
01169             //x += xDelta;                                            // next band
01170             int wmx2 = (w-x)*(w-x);                                 // w minus x squared
01171             COLORREF clr = RGB( r-(r*wmx2)/w2, g-(g*wmx2)/w2, b-(b*wmx2)/w2 );
01172             {
01173                 CBrush brush(clr);
01174                 pDC->SelectObject(&brush);
01175                 if( !m_bIsHorz ) {
01176                     pDC->PatBlt(rx+x, ry, xDelta, cyCap, PATCOPY);
01177                 } else {
01178                     pDC->PatBlt(rx, ry+x, cyCap, xDelta, PATCOPY);
01179                 }
01180                 pDC->SelectObject(pOldBrush);
01181
01182                 // fix potential resource leak - KStowell - 10-21-99
01183                 brush.DeleteObject();
01184             }
01185             x += xDelta;
01186         }
01187         {
01188             CBrush brush(clrBG);
01189             pDC->SelectObject(&brush);
01190             if( !m_bIsHorz ) {
01191                 pDC->PatBlt(rx+x, ry, cxCap-x, cyCap, PATCOPY);
01192             }
01193             else {
01194                 pDC->PatBlt(rx, ry+x, cyCap, cxCap-x, PATCOPY);
01195             }
01196
01197             // fix potential resource leak - KStowell - 10-21-99
01198             brush.DeleteObject();
01199         }
01200         pDC->SelectObject(pOldBrush);
01201     }
01202 }//yiannhs new method ends
01203
01204 void CCJControlBar::DrawGripper(CDC *pDC)
01205 {
01206     //Yiannhs. changed to make evaluations on top. Replaced with flat gradient caption
01207     if (!IsFloating() && m_bGripper)
01208     {
01209         // draw the gripper.
01210         CRect pRect(GetGripperRect());
01211
01212         //Yiannhs New Lines
01213         CRect SecondGrip;
01214         SecondGrip.CopyRect( pRect );
01215         //Yiannhs: use the original beveled style gripper
01216         if (IsHorzDocked()) {
01217             SecondGrip.OffsetRect(4,0);
01218         } else {
01219             SecondGrip.OffsetRect(0,4);
01220         }
01221
01222         //Yiannhs Selective Gripper look
01223         if( !m_bFlatGripper ) {
01224
01225             //Yiannhs: also updated to use AfxData
01226             pDC->FillSolidRect( pRect, afxData.clrBtnShadow  );
01227             pDC->Draw3dRect( pRect, afxData.clrBtnHilite, afxData.clrBtnShadow );
01228
01229             pDC->FillSolidRect( SecondGrip, afxData.clrBtnShadow );
01230             pDC->Draw3dRect( SecondGrip, afxData.clrBtnHilite, afxData.clrBtnShadow );
01231
01232         } else {    //Yiannhs: Use Flat Gripper
01233
01234             CRect FlatRect( pRect.left, pRect.top, SecondGrip.right, SecondGrip.bottom);
01235             if (IsHorzDocked()) {
01236                 FlatRect.DeflateRect(-2,0);
01237             } else {
01238                 FlatRect.DeflateRect(0,-2);
01239             }
01240             DrawGriperCaption( pDC, FlatRect );
01241         }
01242     }
01243 }
01244
01245 CRect CCJControlBar::GetButtonRect()
01246 {
01247     CRect rect;
01248     GetClientRect(&rect);
01249     rect.OffsetRect(-rect.left,-rect.top);
01250
01251     if (IsHorzDocked()) {
01252         rect.top     += 3;
01253         rect.bottom = rect.top+12;
01254         rect.left  += 2;
01255         rect.right  = rect.left+12;
01256     }
01257
01258     else {
01259         rect.right -= 19;
01260         rect.left   = rect.right-12;
01261         rect.top   += 3;
01262         rect.bottom = rect.top+12;
01263     }
01264
01265     return rect;
01266 }
01267
01268 CRect CCJControlBar::GetGripperRect()
01269 {
01270     CRect rect;
01271     GetClientRect(&rect);
01272     rect.OffsetRect(-rect.left,-rect.top);
01273
01274     if (IsHorzDocked()) {
01275         rect.DeflateRect(3,3);
01276         rect.left   += 1;
01277         rect.right  = rect.left+3;
01278         rect.bottom -= 1;
01279         rect.top    += m_bButtons?30:1;
01280     }
01281
01282     else {
01283         rect.DeflateRect(4,4);
01284         rect.top     += 2;
01285         rect.bottom  = rect.top+3;
01286         rect.right   -= m_bButtons?30:2;
01287     }
01288
01289     return rect;
01290 }
01291
01292 void CCJControlBar::OnRButtonDown(UINT /*nFlags*/, CPoint point)
01293 {
01294     // No menu was defined...
01295     if (!m_popupMenuID) {
01296         TRACE0( "Warning: No menu resource was associated with CCJControlBar.\n" );
01297     }
01298
01299     else
01300     {
01301         SetCapture();
01302
01303         // Since we are using the main window as the
01304         // parent, we need to convert the point to screen
01305         // coordinates...
01306         CPoint pt = point;
01307         ClientToScreen(&pt);
01308
01309         // Load the popup menu.
01310         VERIFY(m_popupMenu.LoadMenu(m_popupMenuID));
01311         CCJMenu* pPopup = (CCJMenu*)m_popupMenu.GetSubMenu(m_nPos);
01312         ASSERT(pPopup != NULL);
01313
01314         // Load toolbar resource if any for menu icons.
01315         if (m_popToolbarID) {
01316             pPopup->LoadToolbar(m_popToolbarID);
01317         }
01318
01319         //Yiannhs: When right clicking on a floating controlbar, the menu is inactive,
01320         //         this is due to the MiniFrame  apart from being a child is also
01321         //          a Frame Window. and only the main window handles the Bitmap menus
01322         //pWndPopupOwner = GetParentFrame();
01323         CWnd* pWndPopupOwner = GetParentFrame();    //this;
01324         if( IsFloating() )
01325             pWndPopupOwner = pWndPopupOwner->GetParentFrame();
01326
01327         // Display the popup menu, use the main window as its parent.
01328         pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
01329             pt.x, pt.y, pWndPopupOwner);
01330
01331         m_popupMenu.DestroyMenu();
01332
01333         ReleaseCapture();
01334     }
01335 }
01336
01337 void CCJControlBar::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
01338 {
01339     if (lpMeasureItemStruct->CtlType == ODT_MENU)
01340     {
01341         if (IsMenu((HMENU)lpMeasureItemStruct->itemID)) {
01342             CMenu* pMenu = CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
01343
01344             if (m_popupMenu.IsMenu(pMenu)) {
01345                 m_popupMenu.MeasureItem(lpMeasureItemStruct);
01346                 return;
01347             }
01348         }
01349     }
01350
01351     CControlBar::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
01352 }
01353
01354 LRESULT CCJControlBar::OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu)
01355 {
01356     if (m_popupMenu.IsMenu(pMenu)) {
01357         return CCJMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
01358     }
01359
01360     return CControlBar::OnMenuChar(nChar, nFlags, pMenu);
01361 }
01362
01363 void CCJControlBar::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
01364 {
01365     CControlBar::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
01366
01367     if(!bSysMenu) {
01368         if (m_popupMenu.IsMenu(pPopupMenu)) {
01369             CCJMenu::UpdateMenu(pPopupMenu);
01370         }
01371     }
01372 }
01373
01374 void CCJControlBar::SaveBarState(CSize& size)
01375 {
01376     int nIndex = 0;
01377     CWinApp* pApp = AfxGetApp();
01378
01379     // attempt to loop through all of the defaults stored in the
01380     // system until we find our control id.
01381     while( TRUE )
01382     {
01383         // start at 0 and search for a match to our control bars
01384         // resource id. If one was not found, return.
01385         m_strSection.Format(_T("Bar State-Bar%d"), nIndex);
01386         int nBarID = pApp->GetProfileInt( m_strSection, _T("BarID"), -1 );
01387
01388         // couldn't find a match, just bail...
01389         if( nBarID == -1 ) {
01390             TRACE1( "Warning: Could not find registry information for control bar ID %d\n", m_nID );
01391             return;
01392         }
01393
01394         // we have a match, read the information that was stored, and
01395         // update the cx and cy variables passed in.
01396         if( nBarID == m_nID )
01397         {
01398             if(IsHorzDocked()) {
01399                 size.cy += TRACK_BORDER_SIZE+2;
01400             } else {
01401                 size.cx += TRACK_BORDER_SIZE;
01402             }
01403             //m_strSection += _T("\\CodeJock"); //JK - removed to fix the Bar savings, replaced by the code below... The fix taken from CodeJock Website Discussion board
01404             m_strSection.Format ( _T("CodeJock Bar State-Bar%d"), nIndex ); //JK
01405
01406             // Write the BarID here in case it needs to be matched up in later revisions    //JK
01407             pApp->WriteProfileInt( m_strSection, _T("BarID"), m_nID );  //JK
01408
01409             pApp->WriteProfileInt( m_strSection, _T("MRUDesiredCX"), size.cx );
01410             pApp->WriteProfileInt( m_strSection, _T("MRUDesiredCY"), size.cy );
01411             pApp->WriteProfileInt( m_strSection, _T("MRUFloating" ), IsFloating() );
01412             return;
01413         }
01414
01415         // increment count.
01416         ++nIndex;
01417     }
01418 }
01419
01420 void CCJControlBar::LoadBarState(CSize& size, int nID)
01421 {
01422     m_nID = nID;
01423     int nIndex = 0;
01424     CWinApp* pApp = AfxGetApp();
01425
01426     // attempt to loop through all of the defaults stored in the
01427     // system until we find our control id.
01428     while( TRUE )
01429     {
01430         // start at 0 and search for a match to our control bars
01431         // resource id. If one was not found, return.
01432         m_strSection.Format(_T("Bar State-Bar%d"), nIndex);
01433         int nBarID = pApp->GetProfileInt( m_strSection, _T("BarID"), -1 );
01434
01435         // couldn't find a match, just bail...
01436         if( nBarID == -1 ) {
01437             TRACE1( "Warning: Could not find registry information for control bar ID %d\n", m_nID );
01438             return;
01439         }
01440
01441         // we have a match, read the information that was stored, and
01442         // update the CRect object that was passed in.
01443         if( nBarID == m_nID ) {
01444             //m_strSection += _T("\\CodeJock"); //JK - removed to fix the Bar savings, replaced by the code below... The fix taken from CodeJock Website Discussion board
01445             m_strSection.Format ( _T("CodeJock Bar State-Bar%d"), nIndex ) ;    //JK
01446
01447             size.cx     = pApp->GetProfileInt( m_strSection, _T("MRUDesiredCX"), size.cx );
01448             size.cy     = pApp->GetProfileInt( m_strSection, _T("MRUDesiredCY"), size.cy );
01449             m_bFloating = pApp->GetProfileInt( m_strSection, _T("MRUFloating" ), m_bFloating );
01450             return;
01451         }
01452
01453         // increment count.
01454         ++nIndex;
01455     }
01456 }
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJDateTimeCtrl.cpp Source File

WinCvs/CJLib/CJLibrary/CJDateTimeCtrl.cpp

Go to the documentation of this file.
00001 // CJDateTimeCtrl.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new
00007 // IE4 controls' http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/CJLibrary/CJDateTimeCtrl.cpp $
00015  *
00016  * $History: CJDateTimeCtrl.cpp $
00017  *
00018  * *****************  Version 4  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/CJLibrary
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 3  *****************
00024  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00025  * Updated in $/CodeJockey/CJLibrary
00026  * Added Unicode compliance, thanks to Barry Burton for his help with
00027  * this.
00028  *
00029  *
00030  * *****************  Version 2  *****************
00031  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00032  * Updated in $/CodeJockey/CJLibrary
00033  *
00034  * *****************  Version 1  *****************
00035  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00036  * Created in $/CodeJockey/CJLibrary
00037  * Copied from MFC, Visual C++ 6 and vc5 Tech. Preview. Added to extend
00038  * functionality to Visual C++ 5 users.
00039  *
00040  ***************************************************************************/
00042
00043 #include "stdafx.h"
00044 #include "CJDateTimeCtrl.h"
00045 #include <math.h>
00046
00047 #ifdef _DEBUG
00048 #define new DEBUG_NEW
00049 #undef THIS_FILE
00050 static char THIS_FILE[] = __FILE__;
00051 #endif
00052
00054 // Helper functions
00055
00056 static BOOL GetAsSystemTime(const CTime& tm, SYSTEMTIME& timeDest)
00057 {
00058     struct tm* ptm = tm.GetLocalTm(NULL);
00059     if (ptm == NULL)
00060         return FALSE;
00061
00062     timeDest.wYear = (WORD) (1900 + ptm->tm_year);
00063     timeDest.wMonth = (WORD) (1 + ptm->tm_mon);
00064     timeDest.wDay = (WORD) ptm->tm_mday;
00065     timeDest.wHour = (WORD) ptm->tm_hour;
00066     timeDest.wMinute = (WORD) ptm->tm_min;
00067     timeDest.wSecond = (WORD) ptm->tm_sec;
00068     timeDest.wMilliseconds = 0;
00069
00070     return TRUE;
00071 }
00072
00073 static BOOL GetAsSystemTime(const CTime* ptm, SYSTEMTIME& timeDest)
00074 {
00075     return GetAsSystemTime(*ptm, timeDest);
00076 }
00077
00078 // Verifies will fail if the needed buffer size is too large
00079 #define MAX_TIME_BUFFER_SIZE    128         // matches that in timecore.cpp
00080 #define MIN_DATE                (-657434L)  // about year 100
00081 #define MAX_DATE                2958465L    // about year 9999
00082
00083 // Half a second, expressed in days
00084 #define HALF_SECOND  (1.0/172800.0)
00085
00086 // One-based array of days in year at month start
00087 static int nMonthDays[13] =
00088 {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
00089
00090 static BOOL TmFromOleDate(DATE dtSrc, struct tm& tmDest)
00091 {
00092     // The legal range does not actually span year 0 to 9999.
00093     if (dtSrc > MAX_DATE || dtSrc < MIN_DATE) // about year 100 to about 9999
00094         return FALSE;
00095
00096     long nDays;             // Number of days since Dec. 30, 1899
00097     long nDaysAbsolute;     // Number of days since 1/1/0
00098     long nSecsInDay;        // Time in seconds since midnight
00099     long nMinutesInDay;     // Minutes in day
00100
00101     long n400Years;         // Number of 400 year increments since 1/1/0
00102     long n400Century;       // Century within 400 year block (0,1,2 or 3)
00103     long n4Years;           // Number of 4 year increments since 1/1/0
00104     long n4Day;             // Day within 4 year block
00105     //  (0 is 1/1/yr1, 1460 is 12/31/yr4)
00106     long n4Yr;              // Year within 4 year block (0,1,2 or 3)
00107     BOOL bLeap4 = TRUE;     // TRUE if 4 year block includes leap year
00108
00109     double dblDate = dtSrc; // tempory serial date
00110
00111     // If a valid date, then this conversion should not overflow
00112     nDays = (long)dblDate;
00113
00114     // Round to the second
00115     dblDate += ((dtSrc > 0.0) ? HALF_SECOND : -HALF_SECOND);
00116
00117     nDaysAbsolute = (long)dblDate + 693959L; // Add days from 1/1/0 to 12/30/1899
00118
00119     dblDate = fabs(dblDate);
00120     nSecsInDay = (long)((dblDate - floor(dblDate)) * 86400.);
00121
00122     // Calculate the day of week (sun=1, mon=2...)
00123     //   -1 because 1/1/0 is Sat.  +1 because we want 1-based
00124     tmDest.tm_wday = (int)((nDaysAbsolute - 1) % 7L) + 1;
00125
00126     // Leap years every 4 yrs except centuries not multiples of 400.
00127     n400Years = (long)(nDaysAbsolute / 146097L);
00128
00129     // Set nDaysAbsolute to day within 400-year block
00130     nDaysAbsolute %= 146097L;
00131
00132     // -1 because first century has extra day
00133     n400Century = (long)((nDaysAbsolute - 1) / 36524L);
00134
00135     // Non-leap century
00136     if (n400Century != 0)
00137     {
00138         // Set nDaysAbsolute to day within century
00139         nDaysAbsolute = (nDaysAbsolute - 1) % 36524L;
00140
00141         // +1 because 1st 4 year increment has 1460 days
00142         n4Years = (long)((nDaysAbsolute + 1) / 1461L);
00143
00144         if (n4Years != 0)
00145             n4Day = (long)((nDaysAbsolute + 1) % 1461L);
00146         else
00147         {
00148             bLeap4 = FALSE;
00149             n4Day = (long)nDaysAbsolute;
00150         }
00151     }
00152     else
00153     {
00154         // Leap century - not special case!
00155         n4Years = (long)(nDaysAbsolute / 1461L);
00156         n4Day = (long)(nDaysAbsolute % 1461L);
00157     }
00158
00159     if (bLeap4)
00160     {
00161         // -1 because first year has 366 days
00162         n4Yr = (n4Day - 1) / 365;
00163
00164         if (n4Yr != 0)
00165             n4Day = (n4Day - 1) % 365;
00166     }
00167     else
00168     {
00169         n4Yr = n4Day / 365;
00170         n4Day %= 365;
00171     }
00172
00173     // n4Day is now 0-based day of year. Save 1-based day of year, year number
00174     tmDest.tm_yday = (int)n4Day + 1;
00175     tmDest.tm_year = n400Years * 400 + n400Century * 100 + n4Years * 4 + n4Yr;
00176
00177     // Handle leap year: before, on, and after Feb. 29.
00178     if (n4Yr == 0 && bLeap4)
00179     {
00180         // Leap Year
00181         if (n4Day == 59)
00182         {
00183             /* Feb. 29 */
00184             tmDest.tm_mon = 2;
00185             tmDest.tm_mday = 29;
00186             goto DoTime;
00187         }
00188
00189         // Pretend it's not a leap year for month/day comp.
00190         if (n4Day >= 60)
00191             --n4Day;
00192     }
00193
00194     // Make n4DaY a 1-based day of non-leap year and compute
00195     //  month/day for everything but Feb. 29.
00196     ++n4Day;
00197
00198     // Month number always >= n/32, so save some loop time */
00199     for (tmDest.tm_mon = (n4Day >> 5) + 1;
00200     n4Day > nMonthDays[tmDest.tm_mon]; tmDest.tm_mon++);
00201
00202     tmDest.tm_mday = (int)(n4Day - nMonthDays[tmDest.tm_mon-1]);
00203
00204 DoTime:
00205     if (nSecsInDay == 0)
00206         tmDest.tm_hour = tmDest.tm_min = tmDest.tm_sec = 0;
00207     else
00208     {
00209         tmDest.tm_sec = (int)nSecsInDay % 60L;
00210         nMinutesInDay = nSecsInDay / 60L;
00211         tmDest.tm_min = (int)nMinutesInDay % 60;
00212         tmDest.tm_hour = (int)nMinutesInDay / 60;
00213     }
00214
00215     return TRUE;
00216 }
00217
00218 static BOOL GetAsSystemTime(const COleDateTime& dtm, SYSTEMTIME& sysTime)
00219 {
00220     BOOL bRetVal = FALSE;
00221     if (dtm.GetStatus() == COleDateTime::valid)
00222     {
00223         struct tm tmTemp;
00224         if (TmFromOleDate(dtm, tmTemp))
00225         {
00226             sysTime.wYear = (WORD) tmTemp.tm_year;
00227             sysTime.wMonth = (WORD) tmTemp.tm_mon;
00228             sysTime.wDayOfWeek = (WORD) tmTemp.tm_wday;
00229             sysTime.wDay = (WORD) tmTemp.tm_mday;
00230             sysTime.wHour = (WORD) tmTemp.tm_hour;
00231             sysTime.wMinute = (WORD) tmTemp.tm_min;
00232             sysTime.wSecond = (WORD) tmTemp.tm_sec;
00233             sysTime.wMilliseconds = 0;
00234
00235             bRetVal = TRUE;
00236         }
00237     }
00238
00239     return bRetVal;
00240 }
00241
00242 static BOOL GetAsSystemTime(const COleDateTime* pdtm, SYSTEMTIME& sysTime)
00243 {
00244     return GetAsSystemTime(*pdtm, sysTime);
00245 }
00246
00248 // CCJDateTimeCtrl
00249
00250 BOOL CCJDateTimeCtrl::Create(DWORD dwStyle, const RECT& rect,
00251                            CWnd* pParentWnd, UINT nID)
00252 {
00253    // initialize common controls
00254 #ifdef _VC_VERSION_5
00255     INITCOMMONCONTROLSEX icex;
00256     icex.dwSize = sizeof(icex);
00257     icex.dwICC = ICC_DATE_CLASSES;
00258     VERIFY(InitCommonControlsEx(&icex));
00259 #else
00260     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_DATE_REG));
00261 #endif
00262
00263     CWnd* pWnd = this;
00264     return pWnd->Create(DATETIMEPICK_CLASS, NULL, dwStyle, rect, pParentWnd, nID);
00265 }
00266
00267 DWORD CCJDateTimeCtrl::GetRange(CTime* pMinTime, CTime* pMaxTime) const
00268 {
00269     ASSERT(::IsWindow(m_hWnd));
00270     SYSTEMTIME sysTimes[2];
00271     memset(sysTimes, 0, sizeof(sysTimes));
00272
00273     DWORD dwResult = ::SendMessage(m_hWnd, DTM_GETRANGE, 0, (LPARAM) &sysTimes);
00274
00275     if (pMinTime != NULL)
00276     {
00277         if (dwResult & GDTR_MIN)
00278             *pMinTime = CTime(sysTimes[0]);
00279     }
00280
00281     if (pMaxTime != NULL)
00282     {
00283         if (dwResult & GDTR_MAX)
00284             *pMaxTime = CTime(sysTimes[1]);
00285     }
00286
00287     return dwResult;
00288
00289 }
00290
00291 DWORD CCJDateTimeCtrl::GetRange(COleDateTime* pMinTime,
00292     COleDateTime* pMaxTime) const
00293 {
00294     ASSERT(::IsWindow(m_hWnd));
00295
00296     SYSTEMTIME sysTimes[2];
00297     memset(sysTimes, 0, sizeof(sysTimes));
00298
00299     DWORD dwResult = ::SendMessage(m_hWnd, DTM_GETRANGE, 0, (LPARAM) &sysTimes);
00300     if (pMinTime != NULL)
00301     {
00302         if (dwResult & GDTR_MIN)
00303             *pMinTime = COleDateTime(sysTimes[0]);
00304         else
00305             pMinTime->SetStatus(COleDateTime::null);
00306     }
00307
00308     if (pMaxTime != NULL)
00309     {
00310         if (dwResult & GDTR_MAX)
00311             *pMaxTime = COleDateTime(sysTimes[1]);
00312         else
00313             pMaxTime->SetStatus(COleDateTime::null);
00314     }
00315
00316     return dwResult;
00317 }
00318
00319 BOOL CCJDateTimeCtrl::SetRange(const CTime* pMinTime, const CTime* pMaxTime)
00320 {
00321     ASSERT(::IsWindow(m_hWnd));
00322
00323     SYSTEMTIME sysTimes[2];
00324
00325     WPARAM wFlags = 0;
00326     if (pMinTime != NULL && GetAsSystemTime(pMinTime, sysTimes[0]))
00327         wFlags |= GDTR_MIN;
00328
00329     if (pMaxTime != NULL && GetAsSystemTime(pMaxTime, sysTimes[1]))
00330         wFlags |= GDTR_MAX;
00331
00332     return (BOOL) ::SendMessage(m_hWnd, DTM_SETRANGE, wFlags, (LPARAM) &sysTimes);
00333 }
00334
00335 BOOL CCJDateTimeCtrl::SetRange(const COleDateTime* pMinTime, const COleDateTime* pMaxTime)
00336 {
00337     ASSERT(::IsWindow(m_hWnd));
00338     ASSERT(pMinTime == NULL || pMinTime->GetStatus() != COleDateTime::invalid);
00339     ASSERT(pMaxTime == NULL || pMaxTime->GetStatus() != COleDateTime::invalid);
00340
00341     SYSTEMTIME sysTime[2];
00342
00343     WPARAM wFlags = 0;
00344     if (pMinTime != NULL && pMinTime->GetStatus() != COleDateTime::null)
00345     {
00346         if (GetAsSystemTime(pMinTime, sysTime[0]))
00347             wFlags |= GDTR_MIN;
00348     }
00349
00350     if (pMaxTime != NULL && pMaxTime->GetStatus() != COleDateTime::null)
00351     {
00352         if (GetAsSystemTime(pMaxTime, sysTime[1]))
00353             wFlags |= GDTR_MAX;
00354     }
00355
00356     return (BOOL) ::SendMessage(m_hWnd, DTM_SETRANGE, wFlags, (LPARAM) &sysTime);
00357 }
00358
00359 BOOL CCJDateTimeCtrl::SetTime(LPSYSTEMTIME pTimeNew /* = NULL */)
00360 {
00361     ASSERT(::IsWindow(m_hWnd));
00362     WPARAM wParam = (pTimeNew == NULL) ? GDT_NONE : GDT_VALID;
00363     return (BOOL) ::SendMessage(m_hWnd, DTM_SETSYSTEMTIME,
00364         wParam, (LPARAM) pTimeNew);
00365 }
00366
00367 BOOL CCJDateTimeCtrl::SetTime(const COleDateTime& timeNew)
00368 {
00369     BOOL bRetVal = FALSE;
00370
00371     // make sure the time isn't invalid
00372     ASSERT(timeNew.GetStatus() != COleDateTime::invalid);
00373     ASSERT(::IsWindow(m_hWnd));
00374
00375     SYSTEMTIME sysTime;
00376     WPARAM wParam = GDT_NONE;
00377     if (timeNew.GetStatus() == COleDateTime::valid &&
00378         GetAsSystemTime(timeNew, sysTime))
00379     {
00380         wParam = GDT_VALID;
00381     }
00382
00383     bRetVal = (BOOL) ::SendMessage(m_hWnd,
00384             DTM_SETSYSTEMTIME, wParam, (LPARAM) &sysTime);
00385
00386     return bRetVal;
00387 }
00388
00389 BOOL CCJDateTimeCtrl::SetTime(const CTime* pTimeNew)
00390 {
00391     BOOL bRetVal = FALSE;
00392
00393     // make sure the time isn't invalid
00394     ASSERT(::IsWindow(m_hWnd));
00395
00396     SYSTEMTIME sysTime;
00397     WPARAM wParam = GDT_NONE;
00398     if (pTimeNew != NULL && GetAsSystemTime(pTimeNew, sysTime))
00399     {
00400         wParam = GDT_VALID;
00401     }
00402
00403     bRetVal = (BOOL) ::SendMessage(m_hWnd,
00404             DTM_SETSYSTEMTIME, wParam, (LPARAM) &sysTime);
00405
00406     return bRetVal;
00407 }
00408
00409 BOOL CCJDateTimeCtrl::GetTime(COleDateTime& timeDest) const
00410 {
00411     SYSTEMTIME sysTime;
00412     BOOL bRetVal = TRUE;
00413
00414     LRESULT result = ::SendMessage(m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM) &sysTime);
00415     if (result == GDT_VALID)
00416     {
00417         timeDest = COleDateTime(sysTime);
00418         bRetVal = TRUE;
00419         ASSERT(timeDest.GetStatus() == COleDateTime::valid);
00420     }
00421     else if (result == GDT_NONE)
00422     {
00423         timeDest.SetStatus(COleDateTime::null);
00424         bRetVal = TRUE;
00425     }
00426     else
00427         timeDest.SetStatus(COleDateTime::invalid);
00428     return bRetVal;
00429 }
00430
00431 DWORD CCJDateTimeCtrl::GetTime(CTime& timeDest) const
00432 {
00433     SYSTEMTIME sysTime;
00434     DWORD dwResult = (DWORD)
00435         ::SendMessage(m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM) &sysTime);
00436
00437     if (dwResult == GDT_VALID)
00438         timeDest = CTime(sysTime);
00439
00440     return dwResult;
00441 }
00442
00443 CCJDateTimeCtrl::~CCJDateTimeCtrl()
00444 {
00445     DestroyWindow();
00446 }
00447
00449 // CCJMonthCalCtrl
00450
00451 BOOL CCJMonthCalCtrl::Create(DWORD dwStyle, const RECT& rect,
00452     CWnd* pParentWnd, UINT nID)
00453 {
00454     // initialize common controls
00455 #ifdef _VC_VERSION_5
00456     INITCOMMONCONTROLSEX icex;
00457     icex.dwSize = sizeof(icex);
00458     icex.dwICC = ICC_DATE_CLASSES;
00459     VERIFY(InitCommonControlsEx(&icex));
00460 #else
00461     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_DATE_REG));
00462 #endif
00463
00464     CWnd* pWnd = this;
00465     return pWnd->Create(MONTHCAL_CLASS, NULL, dwStyle, rect, pParentWnd, nID);
00466 }
00467
00468 BOOL CCJMonthCalCtrl::Create(DWORD dwStyle, const POINT& pt,
00469     CWnd* pParentWnd, UINT nID)
00470 {
00471     BOOL bWasVisible = (dwStyle & WS_VISIBLE);
00472     dwStyle &= ~WS_VISIBLE;
00473
00474     CRect rect(pt.x, pt.y, 0, 0);
00475
00476     BOOL bRetVal = FALSE;
00477    if (Create(dwStyle, rect, pParentWnd, nID))
00478     {
00479         if (SizeMinReq())
00480         {
00481             if (bWasVisible)
00482                 ShowWindow(SW_SHOWNA);
00483             bRetVal = TRUE;
00484         }
00485         else
00486             DestroyWindow();
00487     }
00488
00489     return bRetVal;
00490 }
00491
00492 BOOL CCJMonthCalCtrl::SizeMinReq(BOOL bRepaint /* = TRUE */)
00493 {
00494     CRect rect;
00495     BOOL bRetVal = FALSE;
00496     if (GetMinReqRect(rect))
00497     {
00498         DWORD dwFlags = SWP_NOZORDER | SWP_NOREPOSITION | SWP_NOMOVE | SWP_NOACTIVATE;
00499         if (!bRepaint)
00500             dwFlags |= SWP_NOREDRAW;
00501         SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), dwFlags);
00502         bRetVal = TRUE;
00503     }
00504
00505     return bRetVal;
00506 }
00507
00508 void CCJMonthCalCtrl::SetToday(const COleDateTime& refTime)
00509 {
00510     ASSERT_VALID(this);
00511
00512     // make sure the time isn't invalid
00513     ASSERT(refTime.GetStatus() != COleDateTime::invalid);
00514     ASSERT(::IsWindow(m_hWnd));
00515
00516     SYSTEMTIME sysTime;
00517     LPSYSTEMTIME pSysTime = NULL;
00518     WPARAM wParam = GDT_NONE;
00519
00520     // if the passed time is null or out of range,
00521     // we'll set the control to NULL
00522
00523     if (GetAsSystemTime(refTime, sysTime))
00524     {
00525         pSysTime = &sysTime;
00526         wParam = GDT_VALID;
00527     }
00528
00529     if (::IsWindow(m_hWnd))
00530         ::SendMessage(m_hWnd, MCM_SETTODAY, wParam, (LPARAM) pSysTime);
00531 }
00532
00533 void CCJMonthCalCtrl::SetToday(const CTime* pDateTime)
00534 {
00535     ASSERT(::IsWindow(m_hWnd));
00536     ASSERT_VALID(this);
00537
00538     // if the passed time is NULL, we'll set the
00539     // control to NULL
00540
00541     WPARAM wParam = GDT_NONE;
00542     LPSYSTEMTIME pSysTime = NULL;
00543     SYSTEMTIME sysTime;
00544
00545     if (pDateTime != NULL && GetAsSystemTime(pDateTime, sysTime))
00546     {
00547         wParam = GDT_VALID;
00548         pSysTime = &sysTime;
00549     }
00550
00551     if (::IsWindow(m_hWnd))
00552         ::SendMessage(m_hWnd, MCM_SETTODAY, wParam, (LPARAM) pSysTime);
00553 }
00554
00555 BOOL CCJMonthCalCtrl::SetCurSel(const COleDateTime& refTime)
00556 {
00557     ASSERT(::IsWindow(m_hWnd));
00558
00559     SYSTEMTIME sysTime;
00560     BOOL bRetVal = FALSE;
00561
00562     // if the passed time is null or out of range,
00563     // we'll set the control to NULL
00564
00565     if (GetAsSystemTime(refTime, sysTime) &&
00566         refTime.GetStatus() == COleDateTime::valid)
00567     {
00568         bRetVal = (BOOL)
00569             ::SendMessage(m_hWnd, MCM_SETCURSEL, 0, (LPARAM) &sysTime);
00570     }
00571
00572     return bRetVal;
00573 }
00574
00575 BOOL CCJMonthCalCtrl::SetCurSel(const CTime& refTime)
00576 {
00577     ASSERT(::IsWindow(m_hWnd));
00578
00579     SYSTEMTIME sysTime;
00580     BOOL bRetVal = FALSE;
00581
00582     if (GetAsSystemTime(refTime, sysTime))
00583     {
00584         bRetVal = (BOOL)
00585             ::SendMessage(m_hWnd, MCM_SETCURSEL, 0, (LPARAM) &sysTime);
00586     }
00587
00588     return bRetVal;
00589 }
00590
00591 BOOL CCJMonthCalCtrl::GetCurSel(COleDateTime& refTime) const
00592 {
00593     ASSERT(::IsWindow(m_hWnd));
00594
00595     // can't use this method on multiple selection controls
00596     ASSERT(!(GetStyle() & MCS_MULTISELECT));
00597
00598     SYSTEMTIME sysTime;
00599     BOOL bResult = (BOOL)
00600         ::SendMessage(m_hWnd, MCM_GETCURSEL, 0, (LPARAM) &sysTime);
00601
00602     if (bResult)
00603         refTime = COleDateTime(sysTime);
00604
00605     return bResult;
00606 }
00607
00608 BOOL CCJMonthCalCtrl::GetToday(COleDateTime& refTime) const
00609 {
00610     ASSERT(::IsWindow(m_hWnd));
00611
00612     // can't use this method on multiple selection controls
00613     ASSERT(!(GetStyle() & MCS_MULTISELECT));
00614
00615     SYSTEMTIME sysTime;
00616     BOOL bResult = (BOOL)
00617         ::SendMessage(m_hWnd, MCM_GETTODAY, 0, (LPARAM) &sysTime);
00618
00619     if (bResult)
00620         refTime = COleDateTime(sysTime);
00621
00622     return bResult;
00623 }
00624
00625 BOOL CCJMonthCalCtrl::GetCurSel(CTime& refTime) const
00626 {
00627     ASSERT(::IsWindow(m_hWnd));
00628
00629     // can't use this method on multiple selection controls
00630     ASSERT(!(GetStyle() & MCS_MULTISELECT));
00631
00632     SYSTEMTIME sysTime;
00633     BOOL bResult = (BOOL)
00634         ::SendMessage(m_hWnd, MCM_GETCURSEL, 0, (LPARAM) &sysTime);
00635
00636     if (bResult)
00637         refTime = CTime(sysTime);
00638
00639     return bResult;
00640 }
00641
00642 BOOL CCJMonthCalCtrl::GetToday(CTime& refTime) const
00643 {
00644     ASSERT(::IsWindow(m_hWnd));
00645
00646     // can't use this method on multiple selection controls
00647     ASSERT(!(GetStyle() & MCS_MULTISELECT));
00648
00649     SYSTEMTIME sysTime;
00650     BOOL bResult = (BOOL)
00651         ::SendMessage(m_hWnd, MCM_GETTODAY, 0, (LPARAM) &sysTime);
00652
00653     if (bResult)
00654         refTime = CTime(sysTime);
00655
00656     return bResult;
00657 }
00658
00659 CCJMonthCalCtrl::~CCJMonthCalCtrl()
00660 {
00661     DestroyWindow();
00662 }
00663
00664 int CCJMonthCalCtrl::GetFirstDayOfWeek(BOOL* pbLocal /* = NULL */) const
00665 {
00666     ASSERT(::IsWindow(m_hWnd));
00667     DWORD dwResult;
00668     dwResult = (DWORD) ::SendMessage(m_hWnd, MCM_GETFIRSTDAYOFWEEK, 0, 0);
00669
00670     // set *pbLocal to reflect if the first day of week
00671     // matches current locale setting
00672
00673     if (pbLocal)
00674         *pbLocal = HIWORD(dwResult);
00675     return LOWORD(dwResult);
00676 }
00677
00678 BOOL CCJMonthCalCtrl::SetFirstDayOfWeek(int iDay, int* lpnOld /* = NULL */)
00679 {
00680     ASSERT(::IsWindow(m_hWnd));
00681     DWORD dwResult;
00682     dwResult = (DWORD) ::SendMessage(m_hWnd, MCM_SETFIRSTDAYOFWEEK, 0, (WPARAM) iDay);
00683
00684     if (lpnOld != NULL)
00685         *lpnOld = LOWORD(dwResult);
00686
00687     return (BOOL) HIWORD(dwResult);
00688 }
00689
00690 BOOL CCJMonthCalCtrl::SetDayState(int nMonths, LPMONTHDAYSTATE pStates)
00691 {
00692     ASSERT(::IsWindow(m_hWnd));
00693     ASSERT(AfxIsValidAddress(pStates, nMonths * sizeof(MONTHDAYSTATE), FALSE));
00694     return (BOOL) ::SendMessage(m_hWnd, MCM_SETDAYSTATE, (WPARAM) nMonths, (LPARAM) pStates);
00695 }
00696
00697 BOOL CCJMonthCalCtrl::SetRange(const COleDateTime* pMinRange,
00698     const COleDateTime* pMaxRange)
00699 {
00700     ASSERT(::IsWindow(m_hWnd));
00701     ASSERT(pMinRange == NULL || pMinRange->GetStatus() != COleDateTime::invalid);
00702     ASSERT(pMaxRange == NULL || pMaxRange->GetStatus() != COleDateTime::invalid);
00703
00704     SYSTEMTIME sysTimes[2];
00705     WPARAM wFlags = 0;
00706
00707     if (pMinRange != NULL && pMinRange->GetStatus() != COleDateTime::null)
00708     {
00709         if (GetAsSystemTime(pMinRange, sysTimes[0]))
00710             wFlags |= GDTR_MIN;
00711     }
00712
00713     if (pMaxRange != NULL && pMaxRange->GetStatus() != COleDateTime::null)
00714     {
00715         if (GetAsSystemTime(pMaxRange, sysTimes[1]))
00716             wFlags |= GDTR_MAX;
00717     }
00718
00719     return (BOOL)
00720         ::SendMessage(m_hWnd, MCM_SETRANGE, wFlags, (LPARAM) &sysTimes);
00721 }
00722
00723 BOOL CCJMonthCalCtrl::SetRange(const LPSYSTEMTIME pMinRange,
00724     const LPSYSTEMTIME pMaxRange)
00725 {
00726     ASSERT(::IsWindow(m_hWnd));
00727
00728     SYSTEMTIME sysTimes[2];
00729     WPARAM wFlags = 0;
00730
00731     if (pMinRange != NULL)
00732     {
00733         memcpy(&sysTimes[0], pMinRange, sizeof(SYSTEMTIME));
00734         wFlags |= GDTR_MIN;
00735     }
00736
00737     if (pMaxRange != NULL)
00738     {
00739         memcpy(&sysTimes[1], pMaxRange, sizeof(SYSTEMTIME));
00740         wFlags |= GDTR_MAX;
00741     }
00742
00743     return (BOOL)
00744         ::SendMessage(m_hWnd, MCM_SETRANGE, wFlags, (LPARAM) &sysTimes);
00745 }
00746
00747 DWORD CCJMonthCalCtrl::GetRange(COleDateTime* pMinRange,
00748     COleDateTime* pMaxRange) const
00749 {
00750     ASSERT(::IsWindow(m_hWnd));
00751
00752     SYSTEMTIME sysTimes[2];
00753     memset(sysTimes, 0, sizeof(sysTimes));
00754
00755     DWORD dwRanges = (DWORD)
00756         ::SendMessage(m_hWnd, MCM_GETRANGE, 0, (LPARAM) &sysTimes);
00757
00758     if (dwRanges & GDTR_MIN && pMinRange)
00759         *pMinRange = COleDateTime(sysTimes[0]);
00760
00761     if (dwRanges & GDTR_MAX && pMaxRange)
00762         *pMaxRange = COleDateTime(sysTimes[1]);
00763
00764     return dwRanges;
00765 }
00766
00767 DWORD CCJMonthCalCtrl::GetRange(LPSYSTEMTIME pMinRange,
00768     LPSYSTEMTIME pMaxRange) const
00769 {
00770     ASSERT(::IsWindow(m_hWnd));
00771
00772     SYSTEMTIME sysTimes[2];
00773     memset(sysTimes, 0, sizeof(sysTimes));
00774
00775     DWORD dwRanges = (DWORD)
00776         ::SendMessage(m_hWnd, MCM_GETRANGE, 0, (LPARAM) &sysTimes);
00777
00778     if (dwRanges & GDTR_MIN && pMinRange)
00779         memcpy(pMinRange, &sysTimes[0], sizeof(SYSTEMTIME));
00780
00781     if (dwRanges & GDTR_MAX && pMaxRange)
00782         memcpy(pMaxRange, &sysTimes[1], sizeof(SYSTEMTIME));
00783
00784     return dwRanges;
00785 }
00786
00787 BOOL CCJMonthCalCtrl::SetRange(const CTime* pMinRange, const CTime* pMaxRange)
00788 {
00789     ASSERT(::IsWindow(m_hWnd));
00790
00791     SYSTEMTIME sysTimes[2];
00792     WPARAM wFlags = 0;
00793     if (pMinRange != NULL && GetAsSystemTime(pMinRange, sysTimes[0]))
00794         wFlags |= GDTR_MIN;
00795
00796     if (pMaxRange != NULL && GetAsSystemTime(pMaxRange, sysTimes[1]))
00797         wFlags |= GDTR_MAX;
00798
00799     return (BOOL)
00800         ::SendMessage(m_hWnd, MCM_SETRANGE, wFlags, (LPARAM) &sysTimes);
00801 }
00802
00803 DWORD CCJMonthCalCtrl::GetRange(CTime* pMinRange, CTime* pMaxRange) const
00804 {
00805     ASSERT(::IsWindow(m_hWnd));
00806
00807     SYSTEMTIME sysTimes[2];
00808     memset(sysTimes, 0, sizeof(sysTimes));
00809
00810     DWORD dwRanges = (DWORD)
00811         ::SendMessage(m_hWnd, MCM_GETRANGE, 0, (LPARAM) &sysTimes);
00812
00813     if (dwRanges & GDTR_MIN && pMinRange)
00814         *pMinRange = CTime(sysTimes[0]);
00815
00816     if (dwRanges & GDTR_MAX && pMaxRange)
00817         *pMaxRange = CTime(sysTimes[1]);
00818
00819     return dwRanges;
00820 }
00821
00822 int CCJMonthCalCtrl::GetMonthRange(COleDateTime& refMinRange,
00823     COleDateTime& refMaxRange, DWORD dwFlags) const
00824 {
00825     ASSERT(::IsWindow(m_hWnd));
00826     ASSERT(dwFlags == GMR_DAYSTATE || dwFlags == GMR_VISIBLE);
00827
00828     SYSTEMTIME sysTimes[2];
00829     memset(sysTimes, 0, sizeof(sysTimes));
00830     int nCount = (int) ::SendMessage(m_hWnd, MCM_GETMONTHRANGE,
00831         (WPARAM) dwFlags, (LPARAM) &sysTimes);
00832
00833     refMinRange = COleDateTime(sysTimes[0]);
00834     refMaxRange = COleDateTime(sysTimes[1]);
00835
00836     return nCount;
00837 }
00838
00839 int CCJMonthCalCtrl::GetMonthRange(LPSYSTEMTIME pMinRange,
00840     LPSYSTEMTIME pMaxRange, DWORD dwFlags) const
00841 {
00842     ASSERT(::IsWindow(m_hWnd));
00843     ASSERT_POINTER(pMinRange, SYSTEMTIME);
00844     ASSERT_POINTER(pMaxRange, SYSTEMTIME);
00845
00846     SYSTEMTIME sysTimes[2];
00847
00848     int nCount = (int) ::SendMessage(m_hWnd, MCM_GETMONTHRANGE,
00849         (WPARAM) dwFlags, (LPARAM) &sysTimes);
00850
00851     memcpy(pMinRange, &sysTimes[0], sizeof(SYSTEMTIME));
00852     memcpy(pMaxRange, &sysTimes[1], sizeof(SYSTEMTIME));
00853
00854     return nCount;
00855 }
00856
00857 int CCJMonthCalCtrl::GetMonthRange(CTime& refMinRange, CTime& refMaxRange,
00858     DWORD dwFlags) const
00859 {
00860     ASSERT(::IsWindow(m_hWnd));
00861     ASSERT(dwFlags == GMR_DAYSTATE || dwFlags == GMR_VISIBLE);
00862
00863     SYSTEMTIME sysTimes[2];
00864     memset(sysTimes, 0, sizeof(sysTimes));
00865     int nCount = (int) ::SendMessage(m_hWnd, MCM_GETMONTHRANGE,
00866         (WPARAM) dwFlags,   (LPARAM) &sysTimes);
00867
00868     refMinRange = CTime(sysTimes[0]);
00869     refMaxRange = CTime(sysTimes[1]);
00870
00871     return nCount;
00872 }
00873
00874 BOOL CCJMonthCalCtrl::GetSelRange(LPSYSTEMTIME pMinRange,
00875     LPSYSTEMTIME pMaxRange) const
00876 {
00877     ASSERT(m_hWnd != NULL);
00878     ASSERT((GetStyle() & MCS_MULTISELECT));
00879
00880     ASSERT_POINTER(pMinRange, SYSTEMTIME);
00881     ASSERT_POINTER(pMaxRange, SYSTEMTIME);
00882
00883     SYSTEMTIME sysTimes[2];
00884     BOOL bReturn = (BOOL) ::SendMessage(m_hWnd, MCM_GETSELRANGE,
00885                                         0, (LPARAM) &sysTimes);
00886
00887     if (bReturn)
00888     {
00889         memcpy(pMinRange, &sysTimes[0], sizeof(SYSTEMTIME));
00890         memcpy(pMaxRange, &sysTimes[1], sizeof(SYSTEMTIME));
00891     }
00892
00893     return bReturn;
00894 }
00895
00896 BOOL CCJMonthCalCtrl::SetSelRange(const LPSYSTEMTIME pMinRange,
00897     const LPSYSTEMTIME pMaxRange)
00898 {
00899     ASSERT(m_hWnd != NULL);
00900     ASSERT((GetStyle() & MCS_MULTISELECT));
00901
00902     ASSERT_POINTER(pMinRange, SYSTEMTIME);
00903     ASSERT_POINTER(pMaxRange, SYSTEMTIME);
00904
00905     SYSTEMTIME sysTimes[2];
00906     memcpy(&sysTimes[0], pMinRange, sizeof(SYSTEMTIME));
00907     memcpy(&sysTimes[1], pMaxRange, sizeof(SYSTEMTIME));
00908
00909     return (BOOL) ::SendMessage(m_hWnd, MCM_SETSELRANGE,
00910         0, (LPARAM) &sysTimes);
00911 }
00912
00913 BOOL CCJMonthCalCtrl::SetSelRange(const COleDateTime& refMinRange,
00914     const COleDateTime& refMaxRange)
00915 {
00916     // control must have multiple select
00917     ASSERT((GetStyle() & MCS_MULTISELECT));
00918     ASSERT(::IsWindow(m_hWnd));
00919
00920     SYSTEMTIME sysTimes[2];
00921     BOOL bResult = FALSE;
00922
00923     if (refMinRange.GetStatus() == COleDateTime::valid &&
00924         refMinRange.GetStatus() == COleDateTime::valid)
00925     {
00926         if (GetAsSystemTime(refMinRange, sysTimes[0]) &&
00927             GetAsSystemTime(refMaxRange, sysTimes[1]))
00928         {
00929             bResult = (BOOL)
00930                 ::SendMessage(m_hWnd, MCM_SETSELRANGE, 0, (LPARAM)sysTimes);
00931         }
00932     }
00933
00934     return bResult;
00935 }
00936
00937 BOOL CCJMonthCalCtrl::GetSelRange(COleDateTime& refMinRange,
00938     COleDateTime& refMaxRange) const
00939 {
00940     // control must have multiple select
00941     ASSERT((GetStyle() & MCS_MULTISELECT));
00942     ASSERT(::IsWindow(m_hWnd));
00943
00944     SYSTEMTIME sysTimes[2];
00945     memset(sysTimes, 0, sizeof(sysTimes));
00946     BOOL bResult = (BOOL)
00947         ::SendMessage(m_hWnd, MCM_GETSELRANGE, 0, (LPARAM) &sysTimes);
00948
00949     if (bResult)
00950     {
00951         refMinRange = COleDateTime(sysTimes[0]);
00952         refMaxRange = COleDateTime(sysTimes[1]);
00953     }
00954     return bResult;
00955 }
00956
00957 BOOL CCJMonthCalCtrl::SetSelRange(const CTime& refMinRange,
00958     const CTime& refMaxRange)
00959 {
00960     // control must have multiple select
00961     ASSERT((GetStyle() & MCS_MULTISELECT));
00962     ASSERT(::IsWindow(m_hWnd));
00963
00964     SYSTEMTIME sysTimes[2];
00965     BOOL bResult = FALSE;
00966
00967     if (GetAsSystemTime(refMinRange, sysTimes[0]) &&
00968         GetAsSystemTime(refMaxRange, sysTimes[1]))
00969     {
00970         bResult = (BOOL)
00971             ::SendMessage(m_hWnd, MCM_SETSELRANGE, 0, (LPARAM)sysTimes);
00972     }
00973
00974     return bResult;
00975 }
00976
00977 BOOL CCJMonthCalCtrl::GetSelRange(CTime& refMinRange, CTime& refMaxRange) const
00978 {
00979     // control must have multiple select
00980     ASSERT((GetStyle() & MCS_MULTISELECT));
00981     ASSERT(::IsWindow(m_hWnd));
00982
00983     SYSTEMTIME sysTimes[2];
00984     memset(sysTimes, 0, sizeof(sysTimes));
00985     BOOL bResult = (BOOL)
00986         ::SendMessage(m_hWnd, MCM_GETSELRANGE, 0, (LPARAM) &sysTimes);
00987
00988     if (bResult)
00989     {
00990         refMinRange = CTime(sysTimes[0]);
00991         refMaxRange = CTime(sysTimes[1]);
00992     }
00993     return bResult;
00994 }
00995
00997 // DDX_ routines
00998
00999 void AFXAPI DDX_CJDateTimeCtrl(CDataExchange* pDX, int nIDC, COleDateTime& value)
01000 {
01001     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
01002     CCJDateTimeCtrl* pWnd = (CCJDateTimeCtrl*) CWnd::FromHandle(hWndCtrl);
01003
01004     if (pDX->m_bSaveAndValidate)
01005         pWnd->GetTime(value);
01006     else
01007         pWnd->SetTime(value);
01008 }
01009
01010 void AFXAPI DDX_CJDateTimeCtrl(CDataExchange* pDX, int nIDC, CTime& value)
01011 {
01012     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
01013     CCJDateTimeCtrl* pWnd = (CCJDateTimeCtrl*) CWnd::FromHandle(hWndCtrl);
01014
01015     if (pDX->m_bSaveAndValidate)
01016         pWnd->GetTime(value);
01017     else
01018         pWnd->SetTime(&value);
01019 }
01020
01021 void AFXAPI DDX_CJMonthCalCtrl(CDataExchange* pDX, int nIDC,
01022     COleDateTime& value)
01023 {
01024     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
01025     CCJMonthCalCtrl* pWnd = (CCJMonthCalCtrl*) CWnd::FromHandle(hWndCtrl);
01026
01027     if (pDX->m_bSaveAndValidate)
01028         pWnd->GetCurSel(value);
01029     else
01030         pWnd->SetCurSel(value);
01031 }
01032
01033 void AFXAPI DDX_CJMonthCalCtrl(CDataExchange* pDX, int nIDC, CTime& value)
01034 {
01035     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
01036     CCJMonthCalCtrl* pWnd = (CCJMonthCalCtrl*) CWnd::FromHandle(hWndCtrl);
01037
01038     if (pDX->m_bSaveAndValidate)
01039         pWnd->GetCurSel(value);
01040     else
01041         pWnd->SetCurSel(value);
01042 }
01043
01044 void AFXAPI DDV_CJMinMaxDateTime(CDataExchange* pDX, CTime& refValue,
01045     const CTime* pMinRange, const CTime* pMaxRange)
01046 {
01047     ASSERT(pMinRange == NULL || pMaxRange == NULL || *pMinRange <= *pMaxRange);
01048
01049     CCJDateTimeCtrl* pWnd =
01050         (CCJDateTimeCtrl*) CWnd::FromHandle(pDX->m_hWndLastControl);
01051
01052     if (!pDX->m_bSaveAndValidate)
01053     {
01054         if ( (pMinRange != NULL && *pMinRange > refValue) ||
01055               (pMaxRange != NULL && *pMaxRange < refValue))
01056         {
01057 #ifdef _DEBUG
01058             int nIDC = GetWindowLong(pDX->m_hWndLastControl, GWL_ID);
01059             TRACE1("Warning: initial dialog data is out of range in control ID %d.\n", nIDC);
01060 #endif
01061             return;     // don't stop now
01062         }
01063     }
01064
01065     pWnd->SetRange(pMinRange, pMaxRange);
01066 }
01067
01068 void AFXAPI DDV_CJMinMaxDateTime(CDataExchange* pDX,  COleDateTime& refValue,
01069     const COleDateTime* pMinRange, const COleDateTime* pMaxRange)
01070 {
01071     ASSERT(pMinRange == NULL || pMaxRange == NULL || *pMinRange <= *pMaxRange);
01072     CCJDateTimeCtrl* pWnd =
01073         (CCJDateTimeCtrl*) CWnd::FromHandle(pDX->m_hWndLastControl);
01074
01075     if (!pDX->m_bSaveAndValidate)
01076     {
01077         if ( (pMinRange != NULL && *pMinRange > refValue) ||
01078               (pMaxRange != NULL && *pMaxRange < refValue))
01079         {
01080             int nIDC = GetWindowLong(pDX->m_hWndLastControl, GWL_ID);
01081             TRACE1("Warning: initial dialog data is out of range in control ID %d.\n", nIDC);
01082             return;     // don't stop now
01083         }
01084     }
01085
01086     pWnd->SetRange(pMinRange, pMaxRange);
01087 }
01088
01089 void AFXAPI DDV_CJMinMaxMonth(CDataExchange* pDX, CTime& refValue,
01090     const CTime* pMinRange, const CTime* pMaxRange)
01091 {
01092     ASSERT(pMinRange == NULL || pMaxRange == NULL || *pMinRange <= *pMaxRange);
01093     CCJMonthCalCtrl* pWnd =
01094         (CCJMonthCalCtrl*) CWnd::FromHandle(pDX->m_hWndLastControl);
01095
01096     if (!pDX->m_bSaveAndValidate)
01097     {
01098         if ( (pMinRange != NULL && *pMinRange > refValue) ||
01099               (pMaxRange != NULL && *pMaxRange < refValue))
01100         {
01101 #ifdef _DEBUG
01102             int nIDC = GetWindowLong(pDX->m_hWndLastControl, GWL_ID);
01103             TRACE1("Warning: initial dialog data is out of range in control ID %d.\n", nIDC);
01104 #endif
01105             return;     // don't stop now
01106         }
01107     }
01108
01109     pWnd->SetRange(pMinRange, pMaxRange);
01110 }
01111
01112 void AFXAPI DDV_CJMinMaxMonth(CDataExchange* pDX, COleDateTime& refValue,
01113     const COleDateTime* pMinRange, const COleDateTime* pMaxRange)
01114 {
01115     ASSERT(pMinRange == NULL || pMaxRange == NULL || *pMinRange <= *pMaxRange);
01116     CCJMonthCalCtrl* pWnd =
01117         (CCJMonthCalCtrl*) CWnd::FromHandle(pDX->m_hWndLastControl);
01118
01119     if (!pDX->m_bSaveAndValidate)
01120     {
01121         if ( (pMinRange != NULL && *pMinRange > refValue) ||
01122               (pMaxRange != NULL && *pMaxRange < refValue))
01123         {
01124 #ifdef _DEBUG
01125             int nIDC = GetWindowLong(pDX->m_hWndLastControl, GWL_ID);
01126             TRACE1("Warning: initial dialog data is out of range in control ID %d.\n", nIDC);
01127 #endif
01128             return;     // don't stop now
01129         }
01130     }
01131
01132     pWnd->SetRange(pMinRange, pMaxRange);
01133 }
01134
01136
01137 IMPLEMENT_DYNAMIC(CCJDateTimeCtrl, CWnd)
01138 IMPLEMENT_DYNAMIC(CCJMonthCalCtrl, CWnd)
01139
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJDockBar.cpp Source File

WinCvs/CJLib/CJLibrary/CJDockBar.cpp

Go to the documentation of this file.
00001 // CJDockBar.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJockey/CJLibrary/CJDockBar.cpp $
00011  *
00012  * $History: CJDockBar.cpp $
00013  *
00014  * *****************  Version 5  *****************
00015  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00016  * Updated in $/CodeJockey/CJLibrary
00017  * Updated copyright and contact information.
00018  *
00019  * *****************  Version 4  *****************
00020  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00021  * Updated in $/CodeJockey/CJLibrary
00022  *
00023  * *****************  Version 3  *****************
00024  * User: Kirk Stowell Date: 7/18/99    Time: 10:25p
00025  * Updated in $/CodeJockey/CJLibrary
00026  * Added derived button class to handle control bar caption button
00027  * updates. Cleaned up inline functions, and import/export macro so that
00028  * class will be imported when linked to, and exported at compile time.
00029  * Added save and restore control bar size and state functionality.
00030  *
00031  * *****************  Version 2  *****************
00032  * User: Kirk Stowell Date: 4/03/99    Time: 12:53p
00033  * Updated in $/CodeJockey/CJ60Lib
00034  * Added comments and cleaned up code.
00035  *
00036  * *****************  Version 1  *****************
00037  * User: Kirk Stowell Date: 10/17/98   Time: 12:53p
00038  * Created in $/CodeJockey/CJ60Lib
00039  * Initial re-write and release.
00040  *
00041  ***************************************************************************/
00043
00044 #include "stdafx.h"
00045 #include "CJDockBar.h"
00046 #include "CJToolBar.h"
00047
00048 #ifdef _DEBUG
00049 #define new DEBUG_NEW
00050 #undef THIS_FILE
00051 static char THIS_FILE[] = __FILE__;
00052 #endif
00053
00055 // CCJDockBar
00056
00057 CCJDockBar::CCJDockBar()
00058 {
00059     // TODO: add construction code here.
00060 }
00061
00062 CCJDockBar::~CCJDockBar()
00063 {
00064     // TODO: add destruction code here.
00065 }
00066
00067 IMPLEMENT_DYNAMIC(CCJDockBar, CDockBar)
00068
00069 BEGIN_MESSAGE_MAP(CCJDockBar, CDockBar)
00070     //{{AFX_MSG_MAP(CCJDockBar)
00071         // NOTE - the ClassWizard will add and remove mapping macros here.
00072         //    DO NOT EDIT what you see in these blocks of generated code!
00073     //}}AFX_MSG_MAP
00074 END_MESSAGE_MAP()
00075
00077 // CCJDockBar message handlers
00078
00079 CSize CCJDockBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
00080 {
00081     ASSERT_VALID(this);
00082
00083     CSize sizeFixed = CControlBar::CalcFixedLayout(bStretch, bHorz);
00084
00085     // get max size
00086     CSize sizeMax;
00087     if (!m_rectLayout.IsRectEmpty())
00088         sizeMax = m_rectLayout.Size();
00089     else
00090     {
00091         CRect rectFrame;
00092         CFrameWnd* pFrame = GetParentFrame();
00093         pFrame->GetClientRect(&rectFrame);
00094         sizeMax = rectFrame.Size();
00095     }
00096
00097     const int NormalcxBorder2=GetSystemMetrics(SM_CYBORDER)*2;
00098     const int NormalcyBorder2=2;
00099     const int AltcxBorder2=0;
00100     const int AltcyBorder2=0;
00101     int cxBorder2=0;
00102     int cyBorder2=0;
00103
00104     // prepare for layout
00105     AFX_SIZEPARENTPARAMS layout;
00106     layout.hDWP = m_bLayoutQuery ?
00107         NULL : ::BeginDeferWindowPos(m_arrBars.GetSize());
00108     CPoint pt(-cxBorder2, -NormalcyBorder2);
00109     int nWidth = 0;
00110
00111     BOOL bWrapped = FALSE;
00112
00113     // layout all the control bars
00114     for (int nPos = 0; nPos < m_arrBars.GetSize(); nPos++)
00115     {
00116         CControlBar* pBar = GetDockedControlBar(nPos);
00117         void* pVoid = m_arrBars[nPos];
00118
00119         if (pBar != NULL)
00120         {
00121             if (pBar->IsVisible())
00122             {
00123                 if(pBar->IsKindOf(RUNTIME_CLASS(CCJToolBar)))
00124                 {
00125                     cxBorder2=AltcxBorder2;
00126                     cyBorder2=AltcyBorder2;
00127                 }
00128                 else
00129                 {
00130                     cxBorder2=NormalcxBorder2;
00131                     cyBorder2=NormalcyBorder2;
00132                 }
00133                 // get ideal rect for bar
00134                 DWORD dwMode = 0;
00135                 if ((pBar->m_dwStyle & CBRS_SIZE_DYNAMIC) &&
00136                     (pBar->m_dwStyle & CBRS_FLOATING))
00137                     dwMode |= LM_HORZ | LM_MRUWIDTH;
00138                 else if (pBar->m_dwStyle & CBRS_ORIENT_HORZ)
00139                     dwMode |= LM_HORZ | LM_HORZDOCK;
00140                 else
00141                     dwMode |=  LM_VERTDOCK;
00142
00143                 CSize sizeBar = pBar->CalcDynamicLayout(-1, dwMode);
00144
00145                 CRect rect(pt, sizeBar);
00146
00147                 // get current rect for bar
00148                 CRect rectBar;
00149                 pBar->GetWindowRect(&rectBar);
00150                 ScreenToClient(&rectBar);
00151
00152                 if (bHorz)
00153                 {
00154                     // Offset Calculated Rect out to Actual
00155                     if (rectBar.left > rect.left && !m_bFloating)
00156                         rect.OffsetRect(rectBar.left - rect.left, 0);
00157
00158                     // If ControlBar goes off the right, then right justify
00159                     if (rect.right > sizeMax.cx && !m_bFloating)
00160                     {
00161                         int x = rect.Width() - cxBorder2;
00162                         x = max(sizeMax.cx - x, pt.x);
00163                         rect.OffsetRect(x - rect.left, 0);
00164                     }
00165
00166                     // If ControlBar has been wrapped, then left justify
00167                     if (bWrapped)
00168                     {
00169                         bWrapped = FALSE;
00170                         rect.OffsetRect(-(rect.left + cxBorder2), 0);
00171                     }
00172                     // If ControlBar is completely invisible, then wrap it
00173                     else if ((rect.left >= (sizeMax.cx - cxBorder2)) &&
00174                         (nPos > 0) && (m_arrBars[nPos - 1] != NULL))
00175                     {
00176                         m_arrBars.InsertAt(nPos, (CObject*)NULL);
00177                         pBar = NULL; pVoid = NULL;
00178                         bWrapped = TRUE;
00179                     }
00180                     if (!bWrapped)
00181                     {
00182                         if (rect != rectBar)
00183                         {
00184                             if (!m_bLayoutQuery &&
00185                                 !(pBar->m_dwStyle & CBRS_FLOATING))
00186                             {
00187                                 pBar->m_pDockContext->m_rectMRUDockPos = rect;
00188                             }
00189                             AfxRepositionWindow(&layout, pBar->m_hWnd, &rect);
00190                         }
00191                         pt.x = rect.left + sizeBar.cx - cxBorder2;
00192                         nWidth = max(nWidth, sizeBar.cy);
00193                     }
00194                 }
00195                 else
00196                 {
00197                     // Offset Calculated Rect out to Actual
00198                     if (rectBar.top > rect.top && !m_bFloating)
00199                         rect.OffsetRect(0, rectBar.top - rect.top);
00200
00201                     // If ControlBar goes off the bottom, then bottom justify
00202                     if (rect.bottom > sizeMax.cy && !m_bFloating)
00203                     {
00204                         int y = rect.Height() - cyBorder2;
00205                         y = max(sizeMax.cy - y, pt.y);
00206                         rect.OffsetRect(0, y - rect.top);
00207                     }
00208
00209                     // If ControlBar has been wrapped, then top justify
00210                     if (bWrapped)
00211                     {
00212                         bWrapped = FALSE;
00213                         rect.OffsetRect(0, -(rect.top + cyBorder2));
00214                     }
00215                     // If ControlBar is completely invisible, then wrap it
00216                     else if ((rect.top >= (sizeMax.cy - cyBorder2)) &&
00217                         (nPos > 0) && (m_arrBars[nPos - 1] != NULL))
00218                     {
00219                         m_arrBars.InsertAt(nPos, (CObject*)NULL);
00220                         pBar = NULL; pVoid = NULL;
00221                         bWrapped = TRUE;
00222                     }
00223                     if (!bWrapped)
00224                     {
00225                         if (rect != rectBar)
00226                         {
00227                             if (!m_bLayoutQuery &&
00228                                 !(pBar->m_dwStyle & CBRS_FLOATING))
00229                             {
00230                                 pBar->m_pDockContext->m_rectMRUDockPos = rect;
00231                             }
00232                             AfxRepositionWindow(&layout, pBar->m_hWnd, &rect);
00233                         }
00234                         pt.y = rect.top + sizeBar.cy - cyBorder2;
00235                         nWidth = max(nWidth, sizeBar.cx);
00236                     }
00237                 }
00238             }
00239             if (!bWrapped)
00240             {
00241                 // handle any delay/show hide for the bar
00242                 pBar->RecalcDelayShow(&layout);
00243             }
00244         }
00245         if (pBar == NULL && pVoid == NULL && nWidth != 0)
00246         {
00247             // end of row because pBar == NULL
00248             if (bHorz)
00249             {
00250                 pt.y += nWidth - cyBorder2;
00251                 sizeFixed.cx = max(sizeFixed.cx, pt.x);
00252                 sizeFixed.cy = max(sizeFixed.cy, pt.y);
00253                 pt.x = -cxBorder2;
00254             }
00255             else
00256             {
00257                 pt.x += nWidth - cxBorder2;
00258                 sizeFixed.cx = max(sizeFixed.cx, pt.x);
00259                 sizeFixed.cy = max(sizeFixed.cy, pt.y);
00260                 pt.y = -cyBorder2;
00261             }
00262             nWidth = 0;
00263         }
00264     }
00265     if (!m_bLayoutQuery)
00266     {
00267         // move and resize all the windows at once!
00268         if (layout.hDWP == NULL || !::EndDeferWindowPos(layout.hDWP))
00269             TRACE0("Warning: DeferWindowPos failed - low system resources.\n");
00270     }
00271
00272     // adjust size for borders on the dock bar itself
00273     CRect rect;
00274     rect.SetRectEmpty();
00275     CalcInsideRect(rect, bHorz);
00276
00277     if ((!bStretch || !bHorz) && sizeFixed.cx != 0)
00278         sizeFixed.cx += -rect.right + rect.left;
00279     if ((!bStretch || bHorz) && sizeFixed.cy != 0)
00280         sizeFixed.cy += -rect.bottom + rect.top;
00281
00282     return sizeFixed;
00283 }
Generated on Sun Oct 21 12:41:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJDockContext.cpp Source File

WinCvs/CJLib/CJLibrary/CJDockContext.cpp

Go to the documentation of this file.
00001 // CJDockContext.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJockey/CJLibrary/CJDockContext.cpp $
00011  *
00012  * $History: CJDockContext.cpp $
00013  *
00014  * *****************  Version 10  *****************
00015  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00016  * Updated in $/CodeJockey/CJLibrary
00017  * Updated copyright and contact information.
00018  *
00019  * *****************  Version 9  *****************
00020  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00021  * Updated in $/CodeJockey/CJLibrary
00022  *
00023  * *****************  Version 8  *****************
00024  * User: Kirk Stowell Date: 7/18/99    Time: 10:25p
00025  * Updated in $/CodeJockey/CJLibrary
00026  * Added vc5 compatiblity
00027  *
00028  * *****************  Version 7  *****************
00029  * User: Kirk Stowell Date: 6/09/99    Time: 8:33p
00030  * Updated in $/CodeJockey/CJ60Lib
00031  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00032  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00033  * message handler, this is now automatically handled by the base class.
00034  * Added redraw flags to the create method and modified paint and layout
00035  * handlers to reduce flicker and un-necessary command handling. Dragging
00036  * rect now reflects actual control bar docked size. Added "flat" look to
00037  * the control bars, the control bars can now use the classic DevStudio
00038  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00039  * docking windows now handle dragging, docking and floating much better,
00040  * and behave more like DevStudio.
00041  *
00042  * *****************  Version 6  *****************
00043  * User: Kirk Stowell Date: 5/12/99    Time: 5:32a
00044  * Updated in $/CodeJockey/CJ60Lib
00045  * Added support for vc5 compatibility
00046  *
00047  * *****************  Version 5  *****************
00048  * User: Kirk Stowell Date: 4/14/99    Time: 12:57p
00049  * Updated in $/CodeJockey/CJ60Lib
00050  * Daniel Harth [danielh@mail.matco.ro] - Added support for diagonal
00051  * sizing.
00052  *
00053  * *****************  Version 4  *****************
00054  * User: Kirk Stowell Date: 4/03/99    Time: 12:56p
00055  * Updated in $/CodeJockey/CJ60Lib
00056  * Added comments and cleaned up code.
00057  *
00058  * *****************  Version 3  *****************
00059  * User: Kirk Stowell Date: 3/10/99    Time: 12:56p
00060  * Updated in $/CodeJockey/CJ60Lib
00061  * Added support for toggle docking.
00062  *
00063  * *****************  Version 2  *****************
00064  * User: Kirk Stowell Date: 3/03/99    Time: 12:54p
00065  * Updated in $/CodeJockey/CJ60Lib
00066  * Scott Killen [s_killen@yahoo.com] - If your frame is not your main
00067  * window in your app, you cannot dock a floating CCJControlBar. Changed
00068  * (CFrameWnd*)AfxGetApp()->m_pMainWnd to (CFrameWnd*)m_pDockSite in
00069  * CanDockDockBar() and DockSizeBar()
00070  *
00071  * *****************  Version 1  *****************
00072  * User: Kirk Stowell Date: 1/12/99    Time: 12:53p
00073  * Created in $/CodeJockey/CJ60Lib
00074  * Initial creation to add side-by-side docking support for CCJControlBar
00075  * class.
00076  *
00077  ***************************************************************************/
00079
00080 #include "stdafx.h"
00081 #include "CJDockContext.h"
00082 #include "CJControlBar.h"
00083 #include "CJSizeDockBar.h"
00084
00085 #ifdef _DEBUG
00086 #define new DEBUG_NEW
00087 #undef THIS_FILE
00088 static char THIS_FILE[] = __FILE__;
00089 #endif
00090
00091 #define HORZF(dw) (dw & CBRS_ORIENT_HORZ)
00092 #define VERTF(dw) (dw & CBRS_ORIENT_VERT)
00093
00094 static void AdjustRectangle(CRect& rect, CPoint pt)
00095 {
00096     int nXOffset = (pt.x < rect.left) ? (pt.x - rect.left) :
00097                     (pt.x > rect.right) ? (pt.x - rect.right) : 0;
00098     int nYOffset = (pt.y < rect.top) ? (pt.y - rect.top) :
00099                     (pt.y > rect.bottom) ? (pt.y - rect.bottom) : 0;
00100     rect.OffsetRect(nXOffset, nYOffset);
00101 }
00102
00104 // CCJDockContext
00105
00106 CCJDockContext::CCJDockContext(CControlBar* pBar) : CDockContext(pBar)
00107 {
00108     // TODO: add construction code here.
00109 }
00110
00111 CCJDockContext::~CCJDockContext()
00112 {
00113     // TODO: add destruction code here.
00114 }
00115
00117
00118 //1999-05-19 Yiannhs
00119 void CCJDockContext::StartDragDockBar(CPoint pt)
00120 {
00121     ASSERT_VALID(m_pBar);
00122     m_bDragging = TRUE;
00123
00124     InitLoop();
00125
00126     if (m_pBar->m_dwStyle & CBRS_SIZE_DYNAMIC)
00127     {
00128         CRect rect;
00129         m_pBar->GetWindowRect(rect);
00130         // Yiannhs setup and the new member
00131         m_ptOrig = m_ptLast = pt;
00132         CSize sizeHorz = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_HORZDOCK);
00133         CSize sizeVert = m_pBar->CalcDynamicLayout(0, LM_VERTDOCK);
00134         CSize sizeFloat = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH);
00135
00136         m_rectDragHorz = CRect(rect.TopLeft(), sizeHorz);
00137         m_rectDragVert = CRect(rect.TopLeft(), sizeVert);
00138
00139         // calculate frame dragging rectangle
00140         m_rectFrameDragHorz = CRect(rect.TopLeft(), sizeFloat);
00141         m_rectFrameDragVert = CRect(rect.TopLeft(), sizeFloat);
00142
00143         CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz);
00144         CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert);
00145
00146         m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00147         m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00148     }
00149
00150     else if (m_pBar->m_dwStyle & CBRS_SIZE_FIXED)
00151     {
00152         CRect rect;
00153         m_pBar->GetWindowRect(rect);
00154         //Yiannhs setup and the new member
00155         m_ptOrig = m_ptLast = pt;
00156         CSize sizeHorz = m_pBar->CalcDynamicLayout(-1, LM_HORZ | LM_HORZDOCK);
00157         CSize sizeVert = m_pBar->CalcDynamicLayout(-1, LM_VERTDOCK);
00158
00159         m_rectFrameDragHorz = m_rectDragHorz = CRect(rect.TopLeft(), sizeHorz);
00160         m_rectFrameDragVert = m_rectDragVert = CRect(rect.TopLeft(), sizeVert);
00161
00162         CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz);
00163         CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert);
00164         m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00165         m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00166     }
00167
00168     else
00169     {
00170         CRect rect;
00171         m_pBar->GetWindowRect(rect);
00172         //Yiannhs setup and the new member
00173         m_ptOrig = m_ptLast = pt;
00174         BOOL bHorz = HORZF(m_dwStyle);
00175         DWORD dwMode = !bHorz ? (LM_HORZ | LM_HORZDOCK) : LM_VERTDOCK;
00176         CSize size = m_pBar->CalcDynamicLayout(-1, dwMode);
00177
00178         if (bHorz)
00179         {
00180             m_rectDragHorz = rect;
00181             m_rectDragVert = CRect(CPoint(pt.x - rect.Height()/2, rect.top), size);
00182         }
00183
00184         else
00185         {
00186             m_rectDragVert = rect;
00187             m_rectDragHorz = CRect(CPoint(rect.left, pt.y - rect.Width()/2), size);
00188         }
00189
00190         m_rectFrameDragHorz = m_rectDragHorz;
00191         m_rectFrameDragVert = m_rectDragVert;
00192
00193         CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz);
00194         CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert);
00195         m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00196         m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00197     }
00198
00199     AdjustRectangle(m_rectDragHorz, pt);
00200     AdjustRectangle(m_rectDragVert, pt);
00201     AdjustRectangle(m_rectFrameDragHorz, pt);
00202     AdjustRectangle(m_rectFrameDragVert, pt);
00203
00204     m_dwOverDockStyle = CanDockDockBar();
00205     MoveDockBar(pt);
00206     TrackDockBar();
00207 }
00208
00209 DWORD CCJDockContext::CanDockDockBar()
00210 {
00211     BOOL bStyleHorz;
00212     DWORD dwDock = 0;
00213     DWORD dwCurr = 0;
00214
00215     ASSERT(m_dwStyle != 0);
00216     ASSERT_KINDOF(CFrameWnd, m_pDockSite);
00217
00218     bStyleHorz = HORZF(m_dwStyle);
00219     bStyleHorz = m_bFlip ? !bStyleHorz : bStyleHorz;
00220
00221     if (bStyleHorz && HORZF(m_dwDockStyle))
00222     {
00223         dwDock = CanDockDockBar(m_rectDragHorz,
00224             m_dwDockStyle & ~CBRS_ORIENT_VERT);
00225     }
00226
00227     else if (VERTF(m_dwDockStyle))
00228     {
00229         dwDock = CanDockDockBar(m_rectDragVert,
00230             m_dwDockStyle & ~CBRS_ORIENT_HORZ);
00231     }
00232
00233     if (!m_bFlip)
00234     {
00235         if (dwDock == 0 && HORZF(m_dwDockStyle))
00236         {
00237             dwCurr = CanDockDockBar(m_rectDragVert,
00238                 m_dwDockStyle & ~CBRS_ORIENT_VERT);
00239             dwDock = CanDockDockBar(m_rectDragHorz,
00240                 m_dwDockStyle & ~CBRS_ORIENT_VERT);
00241             dwDock = (dwDock == dwCurr) ? dwDock : 0;
00242         }
00243
00244         if (dwDock == 0 && VERTF(m_dwDockStyle))
00245         {
00246             dwCurr = CanDockDockBar(m_rectDragHorz,
00247                 m_dwDockStyle & ~CBRS_ORIENT_HORZ);
00248             dwDock = CanDockDockBar(m_rectDragVert,
00249                 m_dwDockStyle & ~CBRS_ORIENT_HORZ);
00250             dwDock = (dwDock == dwCurr) ? dwDock : 0;
00251         }
00252     }
00253
00254     return dwDock;
00255 }
00256
00257 DWORD CCJDockContext::CanDockDockBar(CRect rect, DWORD dwDockStyle, CDockBar** ppDockBar)
00258 {
00259     CFrameWnd *pFrame = (CFrameWnd*)m_pDockSite;
00260     ASSERT_VALID(pFrame);
00261
00262     dwDockStyle &= CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI;
00263
00264     if (ppDockBar != NULL)
00265         *ppDockBar = NULL;
00266     POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
00267     while (pos != NULL)
00268     {
00269         CCJSizeDockBar* pDockBar = (CCJSizeDockBar*)pFrame->m_listControlBars.GetNext(pos);
00270         if( !pDockBar->IsKindOf(RUNTIME_CLASS(CCJSizeDockBar)) )
00271             continue;
00272         if (pDockBar->IsDockSizeBar() && pDockBar->IsWindowVisible() &&
00273             (pDockBar->m_dwStyle & dwDockStyle & CBRS_ALIGN_ANY) &&
00274             (!pDockBar->m_bFloating ||
00275                 (dwDockStyle & pDockBar->m_dwStyle & CBRS_FLOAT_MULTI)))
00276         {
00277             CRect rectBar;
00278             pDockBar->GetWindowRect(&rectBar);
00279             if (rectBar.Width() == 0)
00280                 rectBar.right++;
00281             if (rectBar.Height() == 0)
00282                 rectBar.bottom++;
00283             if (rectBar.IntersectRect(rectBar, rect))
00284             {
00285                 if (ppDockBar != NULL)
00286                     *ppDockBar = pDockBar;
00287                 return pDockBar->m_dwStyle & dwDockStyle;
00288             }
00289         }
00290     }
00291     return 0;
00292 }
00293
00294 BOOL CCJDockContext::TrackDockBar()
00295 {
00296     if (::GetCapture() != NULL)
00297         return FALSE;
00298     m_pBar->SetCapture();
00299     ASSERT(m_pBar == CWnd::GetCapture());
00300
00301     while (CWnd::GetCapture() == m_pBar)
00302     {
00303         MSG msg;
00304         if (!::GetMessage(&msg, NULL, 0, 0))
00305         {
00306             AfxPostQuitMessage(msg.wParam);
00307             break;
00308         }
00309
00310         switch (msg.message)
00311         {
00312         case WM_LBUTTONUP:
00313             if (m_bDragging)
00314                 EndDragDockBar();
00315             else
00316                 EndResize();
00317             return TRUE;
00318         case WM_MOUSEMOVE:
00319             if (m_bDragging)
00320                 MoveDockBar(msg.pt);
00321             else
00322                 Stretch(msg.pt);
00323             break;
00324         case WM_KEYUP:
00325             if (m_bDragging)
00326                 OnKey((int)msg.wParam, FALSE);
00327             break;
00328         case WM_KEYDOWN:
00329             if (m_bDragging)
00330                 OnKey((int)msg.wParam, TRUE);
00331             if (msg.wParam == VK_ESCAPE)
00332             {
00333                 CancelLoop();
00334                 return FALSE;
00335             }
00336             break;
00337         case WM_RBUTTONDOWN:
00338             CancelLoop();
00339             return FALSE;
00340
00341             // just dispatch rest of the messages
00342         default:
00343             DispatchMessage(&msg);
00344             break;
00345         }
00346     }
00347
00348     CancelLoop();
00349     return FALSE;
00350 }
00351
00352 void CCJDockContext::EndDragDockBar()
00353 {
00354     CancelLoop();
00355     //Yiannhs: reduce some more flickering, and unexpected behaviour in floating bars
00356     //         ok did the expected.
00357     if( m_ptLast == m_ptOrig )
00358         return;
00359
00360     if (m_dwOverDockStyle != 0)
00361     {
00362         CCJSizeDockBar* pDockBar = GetDockBar(m_dwOverDockStyle);
00363         if( pDockBar == NULL ) // John Armstrong
00364             return;
00365
00366         CRect rect = (m_dwOverDockStyle & CBRS_ORIENT_VERT) ?
00367             m_rectDragVert : m_rectDragHorz;
00368
00369         UINT uID = _AfxGetDlgCtrlID(pDockBar->m_hWnd);
00370         m_uMRUDockID = uID;
00371         m_rectMRUDockPos = rect;
00372         pDockBar->ScreenToClient(&m_rectMRUDockPos);
00373         DockSizeBar(m_pBar, pDockBar, &rect);
00374
00375         //yiannhs. after testing the posibilities I think this is the best way
00376         m_pDockSite->RecalcLayout( FALSE );
00377     }
00378
00379     else if ((m_dwStyle & CBRS_SIZE_DYNAMIC) || (HORZF(m_dwStyle) && !m_bFlip) ||
00380         (VERTF(m_dwStyle) && m_bFlip))
00381     {
00382         m_dwMRUFloatStyle = CBRS_ALIGN_TOP | (m_dwDockStyle & CBRS_FLOAT_MULTI);
00383         m_ptMRUFloatPos = m_rectFrameDragHorz.TopLeft();
00384         m_pDockSite->FloatControlBar(m_pBar, m_ptMRUFloatPos, m_dwMRUFloatStyle);
00385
00386         //yiannhs. after testing the posibilities I think this is the best way
00387         m_pDockSite->RecalcLayout( FALSE );
00388     }
00389
00390     else
00391     {
00392         m_dwMRUFloatStyle = CBRS_ALIGN_LEFT | (m_dwDockStyle & CBRS_FLOAT_MULTI);
00393         m_ptMRUFloatPos = m_rectFrameDragVert.TopLeft();
00394         m_pDockSite->FloatControlBar(m_pBar, m_ptMRUFloatPos, m_dwMRUFloatStyle);
00395
00396         //yiannhs. after testing the posibilities I think this is the best way
00397         m_pDockSite->RecalcLayout( FALSE );
00398     }
00399 }
00400
00401 CCJSizeDockBar* CCJDockContext::GetDockBar(DWORD dwOverDockStyle)
00402 {
00403     DWORD dw = 0;
00404     CDockBar* pBar;
00405     if (HORZF(dwOverDockStyle))
00406     {
00407         ASSERT_KINDOF(CFrameWnd, m_pDockSite);
00408         dw = CanDockDockBar(m_rectDragHorz,
00409             dwOverDockStyle & ~CBRS_ORIENT_VERT, &pBar);
00410         ASSERT(dw != 0);
00411         ASSERT(pBar != NULL);
00412         return (CCJSizeDockBar*)pBar;
00413     }
00414
00415     if (VERTF(dwOverDockStyle))
00416     {
00417         dw = CanDockDockBar(m_rectDragVert,
00418             dwOverDockStyle & ~CBRS_ORIENT_HORZ, &pBar);
00419         ASSERT(dw != 0);
00420         ASSERT(pBar != NULL);
00421         return (CCJSizeDockBar*)pBar;
00422     }
00423
00424     return NULL;
00425 }
00426
00427 void CCJDockContext::MoveDockBar(CPoint pt)
00428 {
00429     CPoint ptOffset = pt - m_ptLast;
00430
00431     m_rectDragHorz.OffsetRect(ptOffset);
00432     m_rectFrameDragHorz.OffsetRect(ptOffset);
00433     m_rectDragVert.OffsetRect(ptOffset);
00434     m_rectFrameDragVert.OffsetRect(ptOffset);
00435     m_ptLast = pt;
00436     m_dwOverDockStyle = m_bForceFrame ? 0 : CanDockDockBar();
00437     DrawFocusRect();
00438 }
00439
00440 void CCJDockContext::DockSizeBar(CControlBar * pBar,CCJSizeDockBar *pDockBar, LPRECT lpRect)
00441 {
00442     CFrameWnd *pFrame = (CFrameWnd*)m_pDockSite;
00443     ASSERT_VALID(pFrame);
00444
00445     ASSERT(pBar != NULL);
00446     ASSERT(pBar->m_pDockContext != NULL);
00447
00448     if( pDockBar == NULL )
00449     {
00450         for (int i = 0; i < 4; i++)
00451         {
00452             if ((dwSizeBarMap[i][1] & CBRS_ALIGN_ANY) ==
00453                 (pBar->m_dwStyle & CBRS_ALIGN_ANY))
00454             {
00455                 pDockBar = (CCJSizeDockBar*)pFrame->GetControlBar(dwSizeBarMap[i][0]);
00456                 ASSERT(pDockBar != NULL);
00457                 break;
00458             }
00459         }
00460     }
00461
00462     ASSERT(pDockBar != NULL);
00463     ASSERT(pFrame->m_listControlBars.Find(pBar) != NULL);
00464     ASSERT(pBar->m_pDockSite == pFrame);
00465     ((CCJControlBar*)pBar)->Normalize();
00466     pDockBar->DockControlBar(pBar, lpRect);
00467 }
00468
00469 void CCJDockContext::ToggleDocking()
00470 {
00471     if (m_pBar->IsKindOf(RUNTIME_CLASS(CCJControlBar)))
00472     {
00473         if (m_pBar->IsFloating())
00474         {
00475             // Dock it only if is allowed to be docked
00476             if (m_pBar->m_dwDockStyle & CBRS_ALIGN_ANY)
00477             {
00478                 ASSERT((m_uMRUDockID >= AFX_IDW_DOCKBAR_TOP && m_uMRUDockID <= AFX_IDW_SIZEBAR_BOTTOM) ||
00479                     m_uMRUDockID == 0);
00480
00481                 CRect rect = m_rectMRUDockPos;
00482                 CCJSizeDockBar* pDockBar = NULL;
00483                 if (m_uMRUDockID != 0)
00484                 {
00485                     pDockBar = (CCJSizeDockBar*)m_pDockSite->GetControlBar(m_uMRUDockID);
00486                     pDockBar->ClientToScreen(&rect);
00487                 }
00488
00489                 // dock it at the specified position, RecalcLayout will snap
00490                 DockSizeBar(m_pBar, pDockBar, &rect);
00491                 m_pDockSite->RecalcLayout();
00492             }
00493         }
00494         else
00495         {
00496             CPoint ptFloat = m_ptMRUFloatPos;
00497             if (ptFloat.x < 0 || ptFloat.y < 0)
00498             {
00499                 ptFloat = m_rectMRUDockPos.TopLeft();
00500                 m_pBar->GetParent()->ClientToScreen(&ptFloat);
00501             }
00502             m_pDockSite->FloatControlBar(m_pBar, ptFloat, m_dwMRUFloatStyle);
00503         }
00504     }
00505 }
00506
00508 // CDockContext Resize Operations
00509
00510 #define m_rectRequestedSize     m_rectDragHorz
00511 #define m_rectActualSize        m_rectDragVert
00512 #define m_rectActualFrameSize   m_rectFrameDragHorz
00513 #define m_rectFrameBorders      m_rectFrameDragVert
00514
00515 void CCJDockContext::StartResize(int nHitTest, CPoint pt)
00516 {
00517     ASSERT_VALID(m_pBar);
00518     ASSERT(m_pBar->m_dwStyle & CBRS_SIZE_DYNAMIC);
00519     m_bDragging = FALSE;
00520
00521     InitLoop();
00522
00523     // GetWindowRect returns screen coordinates(not mirrored)
00524     // So if the desktop is mirrored then turn off mirroring
00525     // for the desktop dc so that we draw correct focus rect
00526 #ifndef _VC_VERSION_5
00527     if (m_pDC->GetLayout() & LAYOUT_RTL)
00528         m_pDC->SetLayout(LAYOUT_LTR);
00529 #endif // _VC_VERSION_5
00530
00531     // get true bar size (including borders)
00532     CRect rect;
00533     m_pBar->GetWindowRect(rect);
00534     m_ptLast = pt;
00535     m_nHitTest = nHitTest;
00536
00537     CSize size = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH);
00538     m_rectRequestedSize = CRect(rect.TopLeft(), size);
00539     m_rectActualSize = CRect(rect.TopLeft(), size);
00540     m_rectActualFrameSize = CRect(rect.TopLeft(), size);
00541
00542     // calculate frame rectangle
00543     CMiniFrameWnd::CalcBorders(&m_rectActualFrameSize);
00544     m_rectActualFrameSize.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00545
00546     m_rectFrameBorders = CRect(CPoint(0,0),
00547         m_rectActualFrameSize.Size() - m_rectActualSize.Size());
00548
00549     // initialize tracking state and enter tracking loop
00550     m_dwOverDockStyle = 0;
00551     Stretch(pt);   // call it here to handle special keys
00552     TrackDockBar();
00553 }
00554
00555 void CCJDockContext::Stretch(CPoint pt)
00556 {
00557     CPoint ptOffset = pt - m_ptLast;
00558     CSize size;
00559
00560     // offset all drag rects to new position
00561     if (m_nHitTest != HTTOP && m_nHitTest != HTBOTTOM)
00562     {
00563         if (m_nHitTest == HTLEFT || m_nHitTest == HTTOPLEFT || m_nHitTest == HTBOTTOMLEFT)
00564             m_rectRequestedSize.left += ptOffset.x;
00565         else
00566             m_rectRequestedSize.right += ptOffset.x;
00567         size = m_pBar->CalcDynamicLayout(m_rectRequestedSize.Width(), LM_HORZ);
00568     }
00569
00570     if (m_nHitTest != HTLEFT && m_nHitTest != HTRIGHT)
00571     {
00572         if (m_nHitTest == HTTOP || m_nHitTest == HTTOPLEFT || m_nHitTest == HTTOPRIGHT)
00573             m_rectRequestedSize.top += ptOffset.y;
00574         else
00575             m_rectRequestedSize.bottom += ptOffset.y;
00576         size = m_pBar->CalcDynamicLayout(m_rectRequestedSize.Height(), LM_HORZ|LM_LENGTHY);
00577     }
00578
00579     CRect rectDesk;
00580     HWND hWndDesk = ::GetDesktopWindow();
00581     ::GetWindowRect(hWndDesk, &rectDesk);
00582     CRect rectTemp = m_rectActualFrameSize;
00583
00584     // left, top, top left
00585     if (m_nHitTest == HTLEFT || m_nHitTest == HTTOP || m_nHitTest == HTTOPLEFT)
00586     {
00587         rectTemp.left = rectTemp.right -
00588             (size.cx + m_rectFrameBorders.Width());
00589         rectTemp.top = rectTemp.bottom -
00590             (size.cy + m_rectFrameBorders.Height());
00591         CRect rect;
00592         if (rect.IntersectRect(rectDesk, rectTemp))
00593         {
00594             m_rectActualSize.left = m_rectActualSize.right - size.cx;
00595             m_rectActualSize.top = m_rectActualSize.bottom - size.cy;
00596             m_rectActualFrameSize.left = rectTemp.left;
00597             m_rectActualFrameSize.top = rectTemp.top;
00598         }
00599     } else if (m_nHitTest == HTTOPRIGHT) // top right
00600     {
00601         rectTemp.top = rectTemp.bottom -
00602             (size.cy + m_rectFrameBorders.Height());
00603         rectTemp.right = rectTemp.left +
00604             (size.cx + m_rectFrameBorders.Width());
00605         CRect rect;
00606         if (rect.IntersectRect(rectDesk, rectTemp))
00607         {
00608             m_rectActualSize.left = m_rectActualSize.right - size.cx;
00609             m_rectActualSize.bottom = m_rectActualSize.top + size.cy;
00610             m_rectActualFrameSize.right = rectTemp.right;
00611             m_rectActualFrameSize.top = rectTemp.top;
00612         }
00613     } else if (m_nHitTest == HTBOTTOMLEFT) // bottom left
00614     {
00615         rectTemp.bottom = rectTemp.top +
00616             (size.cy + m_rectFrameBorders.Height());
00617         rectTemp.left = rectTemp.right -
00618             (size.cx + m_rectFrameBorders.Width());
00619         CRect rect;
00620         if (rect.IntersectRect(rectDesk, rectTemp))
00621         {
00622             m_rectActualSize.right = m_rectActualSize.left + size.cx;
00623             m_rectActualSize.top = m_rectActualSize.bottom - size.cy;
00624             m_rectActualFrameSize.left = rectTemp.left;
00625             m_rectActualFrameSize.bottom = rectTemp.bottom;
00626         }
00627     } else// bottom, right, bottom right
00628     {
00629         rectTemp.right = rectTemp.left +
00630             (size.cx + m_rectFrameBorders.Width());
00631         rectTemp.bottom = rectTemp.top +
00632             (size.cy + m_rectFrameBorders.Height());
00633         CRect rect;
00634         if (rect.IntersectRect(rectDesk, rectTemp))
00635         {
00636             m_rectActualSize.right = m_rectActualSize.left + size.cx;
00637             m_rectActualSize.bottom = m_rectActualSize.top + size.cy;
00638             m_rectActualFrameSize.right = rectTemp.right;
00639             m_rectActualFrameSize.bottom = rectTemp.bottom;
00640         }
00641     }
00642     m_ptLast = pt;
00643
00644     // update feedback
00645     DrawFocusRect();
00646 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJExplorerBar.cpp Source File

WinCvs/CJLib/CJLibrary/CJExplorerBar.cpp

Go to the documentation of this file.
00001 // CJExplorerBar.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJExplorerBar.cpp $
00011  *
00012  * $History: CJExplorerBar.cpp $
00013  *
00014  * *****************  Version 12  *****************
00015  * User: Kirk Stowell Date: 10/25/99   Time: 10:52p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Modified resource include for static builds.
00018  *
00019  * *****************  Version 11  *****************
00020  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00021  * Updated in $/CodeJock/CJLibrary
00022  * Fixed potential resource and memory leak problems.
00023  *
00024  * *****************  Version 10  *****************
00025  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00026  * Updated in $/CodeJockey/CJLibrary
00027  * Updated copyright and contact information.
00028  *
00029  * *****************  Version 9  *****************
00030  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00031  * Updated in $/CodeJockey/CJLibrary
00032  * Added Unicode compliance, thanks to Barry Burton for his help with
00033  * this.
00034  *
00035  *
00036  * *****************  Version 8  *****************
00037  * User: Kirk Stowell Date: 6/23/99    Time: 7:24a
00038  * Updated in $/CodeJockey/CJLibrary
00039  *
00040  * *****************  Version 7  *****************
00041  * User: Kirk Stowell Date: 6/23/99    Time: 2:07a
00042  * Updated in $/CodeJockey/CJLibrary
00043  *
00044  * *****************  Version 6  *****************
00045  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00046  * Updated in $/CodeJockey/CJLibrary
00047  *
00048  * *****************  Version 5  *****************
00049  * User: Kirk Stowell Date: 7/18/99    Time: 10:26p
00050  * Updated in $/CodeJockey/CJLibrary
00051  * Cleaned up caption creation.
00052  *
00053  * *****************  Version 4  *****************
00054  * User: Kirk Stowell Date: 6/09/99    Time: 8:33p
00055  * Updated in $/CodeJockey/CJ60Lib
00056  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00057  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00058  * message handler, this is now automatically handled by the base class.
00059  * Added redraw flags to the create method and modified paint and layout
00060  * handlers to reduce flicker and un-necessary command handling. Dragging
00061  * rect now reflects actual control bar docked size. Added "flat" look to
00062  * the control bars, the control bars can now use the classic DevStudio
00063  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00064  * docking windows now handle dragging, docking and floating much better,
00065  * and behave more like DevStudio.
00066  *
00067  * *****************  Version 3  *****************
00068  * User: Kirk Stowell Date: 4/03/99    Time: 4:23p
00069  * Updated in $/CodeJockey/CJ60Lib
00070  * Added comments and cleaned up code.
00071  *
00072  * *****************  Version 2  *****************
00073  * User: Kirk Stowell Date: 1/31/99    Time: 4:23p
00074  * Updated in $/CodeJockey/CJ60Lib
00075  * Made some cosmetic enhancements to more closely match the windows
00076  * explorer bar.
00077  *
00078  * *****************  Version 1  *****************
00079  * User: Kirk Stowell Date: 1/16/99    Time: 4:22p
00080  * Created in $/CodeJockey/CJ60Lib
00081  * Initial release
00082  *
00083  ***************************************************************************/
00085
00086 #include "stdafx.h"
00087 #include "CJResource.h"
00088 #include "CJExplorerBar.h"
00089
00090 #ifdef _DEBUG
00091 #define new DEBUG_NEW
00092 #undef THIS_FILE
00093 static char THIS_FILE[] = __FILE__;
00094 #endif
00095
00097 // CCJExplorerBar
00098
00099 CCJExplorerBar::CCJExplorerBar()
00100 {
00101     m_hIcon = NULL;
00102     m_strCaption = _T("");
00103 }
00104
00105 CCJExplorerBar::~CCJExplorerBar()
00106 {
00107     // fix potential resource leak - KStowell - 10-22-99.
00108     _destroyIcon(m_hIcon);
00109 }
00110
00111 IMPLEMENT_DYNAMIC(CCJExplorerBar, CCJControlBar)
00112
00113 BEGIN_MESSAGE_MAP(CCJExplorerBar, CCJControlBar)
00114     //{{AFX_MSG_MAP(CCJExplorerBar)
00115     ON_WM_CREATE()
00116     ON_COMMAND(IDC_BAR_BUTTON, OnButtonClose)
00117     ON_UPDATE_COMMAND_UI(IDC_BAR_BUTTON, OnUpdateButtonClose)
00118     ON_WM_WINDOWPOSCHANGED()
00119     ON_WM_ERASEBKGND()
00120     ON_WM_LBUTTONDOWN()
00121     ON_WM_LBUTTONUP()
00122     //}}AFX_MSG_MAP
00123 END_MESSAGE_MAP()
00124
00126 // CCJExplorerBar message handlers
00127
00128 BOOL CCJExplorerBar::Create(CWnd *pParentWnd, UINT nID, LPCTSTR lpszWindowName, CSize sizeDefault, DWORD dwStyle)
00129 {
00130     m_strCaption = lpszWindowName;
00131
00132     if(!CCJControlBar::Create(pParentWnd, nID, lpszWindowName, sizeDefault, dwStyle)) {
00133         return FALSE;
00134     }
00135
00136     ShowFrameControls(FALSE, FALSE);
00137     return TRUE;
00138 }
00139
00140 int CCJExplorerBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
00141 {
00142     if (CCJControlBar::OnCreate(lpCreateStruct) == -1)
00143         return -1;
00144
00145     // Create the caption.
00146     if (!m_Caption.Create(this, m_strCaption))
00147     {
00148         TRACE0( "Unable to create caption.\n" );
00149         return -1;
00150     }
00151
00152     // Create the caption button.
00153     if (!m_CaptionButton.Create(NULL, WS_VISIBLE|BS_ICON|BS_OWNERDRAW|BS_CENTER|BS_VCENTER,
00154         CRect(0,0,0,0), this, IDC_BAR_BUTTON))
00155     {
00156         TRACE0( "Unable to create caption button.\n" );
00157         return -1;
00158     }
00159
00160     // Create the image list used by frame buttons.
00161     CImageList imageList;
00162     imageList.Create(IDB_PUSHPIN, 16, 1, RGB(255,0,255));
00163     m_hIcon = imageList.ExtractIcon(2);
00164
00165     // Associate the button icon
00166     m_CaptionButton.SetIcon(m_hIcon, CSize(16,15));
00167     imageList.DeleteImageList();
00168
00169     return 0;
00170 }
00171
00172 void CCJExplorerBar::OnButtonClose()
00173 {
00174     GetDockingFrame()->ShowControlBar(this, FALSE, FALSE);
00175 }
00176
00177 void CCJExplorerBar::OnUpdateButtonClose(CCmdUI* pCmdUI)
00178 {
00179     pCmdUI->Enable(TRUE);
00180 }
00181
00182 void CCJExplorerBar::GetChildRect(CRect &rect)
00183 {
00184     GetClientRect(&rect);
00185
00186     if (!IsFloating())
00187     {
00188         rect.left   += 1;
00189         rect.right  -= 1;
00190         rect.top    += (IsVertDocked()?26:22);
00191     }
00192
00193     else
00194         rect.DeflateRect(2,2);
00195 }
00196
00197 void CCJExplorerBar::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
00198 {
00199     CControlBar::OnWindowPosChanged(lpwndpos);
00200
00201     int nCmdShow = IsFloating() ? SW_HIDE:SW_SHOW;
00202     m_Caption.ShowWindow(nCmdShow);
00203     m_CaptionButton.ShowWindow(nCmdShow);
00204
00205     if (!IsFloating())
00206     {
00207         if (IsVertDocked())
00208         {
00209             m_Caption.MoveWindow(1,4,lpwndpos->cx-1,22);
00210             m_CaptionButton.MoveWindow(CRect(lpwndpos->cx-25,
00211                 7, lpwndpos->cx-5, 24));
00212         }
00213         else
00214         {
00215             m_Caption.MoveWindow(1,0,lpwndpos->cx-1,22);
00216             m_CaptionButton.MoveWindow(CRect(lpwndpos->cx-25,
00217                 3, lpwndpos->cx-5, 20));
00218         }
00219     }
00220
00221     if (m_pChildWnd->GetSafeHwnd())
00222     {
00223         CRect rc;
00224         GetChildRect(rc);
00225         m_pChildWnd->MoveWindow(rc);
00226     }
00227 }
00228
00229 BOOL CCJExplorerBar::OnEraseBkgnd(CDC* pDC)
00230 {
00231     int result = CControlBar::OnEraseBkgnd(pDC);
00232
00233     CRect rect;
00234     GetClientRect(rect);
00235     rect.top+=(IsVertDocked()?3:-1);
00236     rect.bottom += 1;
00237     //Yiannhs This was a side effect of removing the variables
00238     pDC->Draw3dRect(rect, afxData.clrBtnShadow, afxData.clrBtnShadow);
00239     //pDC->Draw3dRect(rect, m_clrBtnShadow, m_clrBtnShadow);
00240     return result;
00241 }
00242
00243 void CCJExplorerBar::OnLButtonDown(UINT /*nFlags*/, CPoint /*point*/)
00244 {
00245     // bypass CCJControlBar.
00246 }
00247
00248 void CCJExplorerBar::OnLButtonUp(UINT /*nFlags*/, CPoint /*point*/)
00249 {
00250     // bypass CCJControlBar.
00251 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJFlatButton.cpp Source File

WinCvs/CJLib/CJLibrary/CJFlatButton.cpp

Go to the documentation of this file.
00001 // CJFlatButton.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 2000/02/29 22:28:40 $
00009  * $Revision: 1.2 $
00010  * $Archive: /CodeJock/CJLibrary/CJFlatButton.cpp $
00011  *
00012  * $History: CJFlatButton.cpp $
00013  *
00014  * *****************  Version 19  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:00p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Further Updates to OnEraseBkgnd(...) and OnPaint() for flicker free
00018  * drawing.
00019  *
00020  * *****************  Version 18  *****************
00021  * User: Kirk Stowell Date: 10/30/99   Time: 1:47p
00022  * Updated in $/CodeJock/CJLibrary
00023  * Overrode OnEraseBkgnd(...) and made modifications to DrawItem(...) to
00024  * handle flicker free drawing.
00025  *
00026  * *****************  Version 17  *****************
00027  * User: Kirk Stowell Date: 10/25/99   Time: 10:52p
00028  * Updated in $/CodeJock/CJLibrary
00029  * Modified resource include for static builds.
00030  *
00031  * *****************  Version 16  *****************
00032  * User: Kirk Stowell Date: 10/24/99   Time: 4:28p
00033  * Updated in $/CodeJock/CJLibrary
00034  * Added method SetAlternateColors(...) which will allow the user to
00035  * define the "face", "hilight" and "shadow" colors used by the control
00036  * rather than used the system defaults. Thanks to Ronen Magid
00037  * [ronenm@simplement.co.il] for his suggestions.
00038  *
00039  * *****************  Version 15  *****************
00040  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00041  * Updated in $/CodeJock/CJLibrary
00042  * Fixed potential resource and memory leak problems.
00043  *
00044  * *****************  Version 14  *****************
00045  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00046  * Updated in $/CodeJockey/CJLibrary
00047  * Updated copyright and contact information.
00048  *
00049  * *****************  Version 13  *****************
00050  * User: Kirk Stowell Date: 8/29/99    Time: 9:46p
00051  * Updated in $/CodeJockey/CJLibrary
00052  * Fixed bug when the button is pressed 2 times very quickly, the button
00053  * is only pressed once - Stephan Neumann <neumann@dialogs.de>
00054  *
00055  * *****************  Version 12  *****************
00056  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00057  * Updated in $/CodeJockey/CJLibrary
00058  * Added Unicode compliance, thanks to Barry Burton for his help with
00059  * this.
00060  *
00061  *
00062  * *****************  Version 11  *****************
00063  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00064  * Updated in $/CodeJockey/CJLibrary
00065  *
00066  * *****************  Version 10  *****************
00067  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00068  * Updated in $/CodeJockey/CJLibrary
00069  *
00070  * *****************  Version 9  *****************
00071  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00072  * Updated in $/CodeJockey/CJLibrary
00073  *
00074  * *****************  Version 8  *****************
00075  * User: Kirk Stowell Date: 7/25/99    Time: 12:15a
00076  * Updated in $/CodeJockey/CJLibrary
00077  *
00078  * *****************  Version 7  *****************
00079  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00080  * Updated in $/CodeJockey/CJLibrary
00081  *
00082  * *****************  Version 6  *****************
00083  * User: Kirk Stowell Date: 7/18/99    Time: 10:27p
00084  * Updated in $/CodeJockey/CJLibrary
00085  * Cleaned up icon drawing function.
00086  *
00087  * *****************  Version 5  *****************
00088  * User: Kirk Stowell Date: 7/14/99    Time: 9:58p
00089  * Updated in $/CodeJockey/CJLibrary
00090  * Re-wrote class to handle icons, text and bitmaps and added additional
00091  * functionality which was needed by the CCJCaption class.
00092  *
00093  * *****************  Version 4  *****************
00094  * User: Kirk Stowell Date: 4/03/99    Time: 4:23p
00095  * Updated in $/CodeJockey/CJ60Lib
00096  * Added comments and cleaned up code.
00097  *
00098  * *****************  Version 3  *****************
00099  * User: Kirk Stowell Date: 3/13/99    Time: 4:24p
00100  * Updated in $/CodeJockey/CJ60Lib
00101  * Patrick Bergeron [patb@softimage.com] fixed the following bugs:
00102  *
00103  * Moving the cursor over the flat button doesn't raise the button right
00104  * away. We have to wait for the first timer message to arrive, which is a
00105  * bit annoying. It gives the impression that the system isn't very
00106  * responsive. So in the OnMouseMove method, we call OnTimer(1) to force
00107  * the initial update of the button.
00108  *
00109  * Sometimes, a CJFlatButton would stay in a raised state when moving the
00110  * mouse quickly over the client area of a few CJFlatButtons. The reason
00111  * turned out to be the use of a static (ahem, global) variable
00112  * "bPainted". The simple fix for this was to put bPainted as a member
00113  * variable ("m_bPainted") and use this member variable instead.
00114  *
00115  * Flat buttons are now much more responsive and behave correctly in all
00116  * cases.
00117  *
00118  * *****************  Version 2  *****************
00119  * User: Kirk Stowell Date: 10/17/98   Time: 4:24p
00120  * Updated in $/CodeJockey/CJ60Lib
00121  * Code clean up and re-organization, renamed CCJButton to CCJFlatButton.
00122  *
00123  * *****************  Version 1  *****************
00124  * User: Kirk Stowell Date: 10/17/98   Time: 4:23p
00125  * Created in $/CodeJockey/CJ60Lib
00126  * Initial re-write and release.
00127  *
00128  ***************************************************************************/
00130
00131 #include "stdafx.h"
00132 #include "CJFlatButton.h"
00133 #include "CJResource.h"
00134
00135 #ifdef _DEBUG
00136 #define new DEBUG_NEW
00137 #undef THIS_FILE
00138 static char THIS_FILE[] = __FILE__;
00139 #endif
00140
00142 // CCJFlatButton
00143
00144 IMPLEMENT_DYNAMIC(CCJFlatButton, CButton)
00145
00146 CCJFlatButton::CCJFlatButton()
00147 {
00148     m_pFont     = NULL;
00149     m_hPushed   = NULL;
00150     m_bLBtnDown = FALSE;
00151     m_bFlatLook = TRUE;
00152     m_bPainted  = FALSE;
00153     m_bAltColor = FALSE;
00154
00155     m_clrHilite = ::GetSysColor(COLOR_BTNHIGHLIGHT);
00156     m_clrShadow = ::GetSysColor(COLOR_BTNSHADOW);
00157     m_clrDkShad = ::GetSysColor(COLOR_3DDKSHADOW);
00158     m_clrNormal = ::GetSysColor(COLOR_BTNFACE);
00159     m_clrTextGy = ::GetSysColor(COLOR_GRAYTEXT);
00160     m_clrTextNm = ::GetSysColor(COLOR_BTNTEXT);
00161
00162     m_hCursor   = AfxGetApp()->LoadCursor( IDC_HANDCUR );
00163     UpdateFont();
00164 }
00165
00166 CCJFlatButton::~CCJFlatButton()
00167 {
00168     // fix potential resource leak - KStowell - 10-21-99
00169     m_Font.DeleteObject();
00170 }
00171
00172
00173 BEGIN_MESSAGE_MAP(CCJFlatButton, CButton)
00174     //{{AFX_MSG_MAP(CCJFlatButton)
00175     ON_WM_MOUSEMOVE()
00176     ON_WM_LBUTTONDOWN()
00177     ON_WM_LBUTTONUP()
00178     ON_WM_TIMER()
00179     ON_WM_SYSCOLORCHANGE()
00180     ON_WM_SETCURSOR()
00181     ON_WM_LBUTTONDBLCLK()
00182     ON_WM_ERASEBKGND()
00183     ON_WM_PAINT()
00184     //}}AFX_MSG_MAP
00185 END_MESSAGE_MAP()
00186
00188 // CCJFlatButton message handlers
00189
00190 void CCJFlatButton::OnMouseMove(UINT nFlags, CPoint point)
00191 {
00192     if (m_bFlatLook)
00193     {
00194         SetTimer(1, 10, NULL);
00195         OnTimer(1);
00196     }
00197
00198     CButton::OnMouseMove(nFlags, point);
00199 }
00200
00201 void CCJFlatButton::OnLButtonDown(UINT nFlags, CPoint point)
00202 {
00203     m_bLBtnDown = TRUE;
00204     CButton::OnLButtonDown(nFlags, point);
00205 }
00206
00207 void CCJFlatButton::OnLButtonUp(UINT nFlags, CPoint point)
00208 {
00209     m_bLBtnDown = FALSE;
00210     CButton::OnLButtonUp(nFlags, point);
00211 }
00212
00213 void CCJFlatButton::OnTimer(UINT nIDEvent)
00214 {
00215     CRect rcItem;
00216     GetWindowRect(rcItem);
00217
00218     CPoint ptCursor;
00219     GetCursorPos(&ptCursor);
00220
00221     if(( m_bLBtnDown == TRUE ) || ( !rcItem.PtInRect( ptCursor )))
00222     {
00223         KillTimer(1);
00224
00225         if (m_bPainted == TRUE) {
00226             InvalidateRect (NULL);
00227         }
00228
00229         m_bPainted = FALSE;
00230         return;
00231     }
00232
00233     // On mouse over, show raised button.
00234     else if(( m_bFlatLook ) && ( !m_bPainted )) {
00235         CDC* pDC = GetDC();
00236         GetClientRect(rcItem);
00237         pDC->Draw3dRect( rcItem, m_clrHilite, m_clrShadow );
00238         m_bPainted = TRUE;
00239         ReleaseDC(pDC);
00240     }
00241
00242     CButton::OnTimer(nIDEvent);
00243 }
00244
00245 void CCJFlatButton::OnSysColorChange()
00246 {
00247     CButton::OnSysColorChange();
00248
00249     m_clrDkShad = ::GetSysColor(COLOR_3DDKSHADOW);
00250     m_clrTextGy = ::GetSysColor(COLOR_GRAYTEXT);
00251     m_clrTextNm = (m_bAltColor ? m_clrAltTextNm : ::GetSysColor(COLOR_BTNTEXT));
00252     m_clrNormal = (m_bAltColor ? m_clrAltNormal : ::GetSysColor(COLOR_BTNFACE));
00253     m_clrHilite = (m_bAltColor ? m_clrAltHilite : ::GetSysColor(COLOR_BTNHIGHLIGHT));
00254     m_clrShadow = (m_bAltColor ? m_clrAltShadow : ::GetSysColor(COLOR_BTNSHADOW));
00255 }
00256
00257 void CCJFlatButton::SetAlternateColors(COLORREF clrAltNormal, COLORREF clrAltHilite, COLORREF clrAltShadow, COLORREF clrAltTextNm)
00258 {
00259     m_clrNormal = m_clrAltNormal = clrAltNormal;
00260     m_clrHilite = m_clrAltHilite = clrAltHilite;
00261     m_clrShadow = m_clrAltShadow = clrAltShadow;
00262     m_clrTextNm = m_clrAltTextNm = clrAltTextNm;
00263     m_bAltColor = TRUE;
00264 }
00265
00266 void CCJFlatButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
00267 {
00268     ASSERT(lpDrawItemStruct != NULL);
00269
00270     // define some temporary variables.
00271     CDC*  pDC    = CDC::FromHandle( lpDrawItemStruct->hDC );
00272     CRect rcItem = lpDrawItemStruct->rcItem;
00273     int   nState = lpDrawItemStruct->itemState;
00274
00275     // Paint the background.
00276     pDC->FillSolidRect( rcItem, m_clrNormal );
00277
00278     // Draw flat button border.
00279     if( m_bFlatLook ) {
00280         pDC->Draw3dRect( rcItem, (nState & ODS_SELECTED)?m_clrShadow:m_clrNormal,
00281             (nState & ODS_SELECTED)?m_clrHilite:m_clrNormal );
00282     }
00283
00284     // Draw normal border.
00285     else {
00286         pDC->Draw3dRect( rcItem, (nState & ODS_SELECTED)?m_clrDkShad:m_clrHilite,
00287             (nState & ODS_SELECTED)?m_clrHilite:m_clrDkShad);
00288         rcItem.DeflateRect(1,1);
00289         pDC->Draw3dRect( rcItem, (nState & ODS_SELECTED)?m_clrShadow:m_clrNormal,
00290             (nState & ODS_SELECTED)?m_clrNormal:m_clrShadow);
00291     }
00292
00293     // Set the background mode to transparent.
00294     pDC->SetBkMode( TRANSPARENT );
00295
00296     // draw the button text, icon or bitmap.
00297     DrawButtonText(pDC, nState, rcItem);
00298     DrawButtonIcon(pDC, nState, rcItem);
00299     DrawButtonBitmap(pDC, nState, rcItem);
00300 }
00301
00302 void CCJFlatButton::DrawButtonText(CDC* pDC, UINT nState, CRect& rcItem)
00303 {
00304     // Get the window text, return if empty.
00305     CString strWindowText; GetWindowText(strWindowText);
00306     if( strWindowText.IsEmpty( ))
00307         return;
00308
00309     if( m_pFont == NULL ) {
00310         m_pFont = &m_Font;
00311     }
00312
00313     CRect rc = rcItem;
00314     rc.DeflateRect( 2,0 );
00315
00316     // Set the text color and select the button font.
00317     pDC->SetTextColor(( nState & ODS_DISABLED )?m_clrTextGy:m_clrTextNm);
00318     CFont *oldFont = pDC->SelectObject( m_pFont );
00319
00320     // if the button is selected.
00321     if( nState & ODS_SELECTED ) {
00322         rc.OffsetRect(1,1);
00323     }
00324
00325     // draw the text, and select the original font.
00326     pDC->DrawText( strWindowText, -1, rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
00327     pDC->SelectObject( oldFont );
00328 }
00329
00330 void CCJFlatButton::DrawButtonIcon(CDC* pDC, UINT nState, CRect& rcItem)
00331 {
00332     UNUSED_ALWAYS( rcItem );
00333
00334     // get the handle to the icon (if any) associated
00335     // with this button.
00336     HICON hIcon = GetIcon();
00337     if( hIcon == NULL ) {
00338         return;
00339     }
00340
00341     CRect rcWnd;
00342     GetWindowRect(&rcWnd);
00343
00344     int left   = (rcWnd.Width()-m_sizeIcon.cx)/2;
00345     int right  = left+m_sizeIcon.cx;
00346     int top    = (rcWnd.Height()-m_sizeIcon.cy)/2;
00347     int bottom = top+m_sizeIcon.cy;
00348
00349     // determine the size of the icon to be drawn.
00350     CRect rc(left,top,right,bottom);
00351
00352     // if the button is selected.
00353     if( nState & ODS_SELECTED )
00354     {
00355         if( m_hPushed ) {
00356             hIcon = m_hPushed;
00357         }
00358         else {
00359             rc.OffsetRect(1,1);
00360         }
00361     }
00362
00363     // draw the icon associated with this button.
00364     pDC->DrawState( rc.TopLeft(), rc.Size(), hIcon,
00365         ( nState & ODS_DISABLED )?DSS_DISABLED:DSS_NORMAL, (HBRUSH)NULL );
00366 }
00367
00368 void CCJFlatButton::DrawButtonBitmap(CDC* pDC, UINT nState, CRect& rcItem)
00369 {
00370     // get the handle to the bitmap (if any) associated
00371     // with this button.
00372     HBITMAP hBitmap = GetBitmap();
00373     if( hBitmap == NULL ) {
00374         return;
00375     }
00376
00377     CRect rc = rcItem;
00378
00379     // if the button is selected.
00380     if( nState & ODS_SELECTED ) {
00381         rcItem.OffsetRect(1,1);
00382     }
00383
00384     // draw the bitmap associated with this button.
00385     pDC->DrawState( rc.TopLeft(), rc.Size(), hBitmap,
00386         ( nState & ODS_DISABLED )?DSS_DISABLED:DSS_NORMAL, (HBRUSH)NULL );
00387 }
00388
00389
00390 BOOL CCJFlatButton::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
00391 {
00392     UNUSED_ALWAYS( pWnd );
00393     UNUSED_ALWAYS( nHitTest );
00394     UNUSED_ALWAYS( message );
00395
00396     ::SetCursor( m_hCursor );
00397
00398     return TRUE;
00399 }
00400
00401 void CCJFlatButton::UpdateFont()
00402 {
00403     m_Font.DeleteObject();
00404     NONCLIENTMETRICS ncm;
00405     ncm.cbSize = sizeof(ncm);
00406     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00407     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00408 }
00409
00410 void CCJFlatButton::OnLButtonDblClk(UINT nFlags, CPoint point)
00411 {
00412     POINT pt;
00413
00414     ::GetCursorPos(&pt);
00415     ::MapWindowPoints(NULL,(HWND)(m_hWnd),&pt,1);
00416     ::SendMessage((HWND)(m_hWnd),WM_LBUTTONDOWN,0,MAKELPARAM(pt.x,pt.y));
00417
00418     CButton::OnLButtonDblClk(nFlags, point);
00419 }
00420
00421 BOOL CCJFlatButton::OnEraseBkgnd(CDC* pDC)
00422 {
00423     // KStowell - overridden for flicker-free drawing.
00424     UNUSED_ALWAYS(pDC);
00425     return TRUE;
00426 }
00427
00428 void CCJFlatButton::OnPaint()
00429 {
00430     CPaintDC dc(this); // device context for painting
00431
00432     // KStowell - Get the client rect.
00433     CRect rcClient, rcClip;
00434     dc.GetClipBox( &rcClip );
00435     GetClientRect( &rcClient );
00436
00437     // KStowell - Create a memory device-context. This is done to help reduce
00438     // screen flicker, since we will paint the entire control to the
00439     // off screen device context first.
00440     CDC memDC;
00441     CBitmap bitmap;
00442     memDC.CreateCompatibleDC(&dc);
00443     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00444     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00445
00446     // KStowell - Repaint the background.
00447     memDC.FillSolidRect(rcClient, m_clrNormal);
00448
00449     // let the control do its default drawing.
00450     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00451
00452     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00453     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00454         rcClip.left, rcClip.top, SRCCOPY );
00455
00456     // KStowell - Cleanup resources.
00457     memDC.SelectObject(pOldBitmap);
00458     memDC.DeleteDC();
00459     bitmap.DeleteObject();
00460 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJFlatComboBox.cpp Source File

WinCvs/CJLib/CJLibrary/CJFlatComboBox.cpp

Go to the documentation of this file.
00001 // CJFlatComboBox.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJFlatComboBox.cpp $
00011  *
00012  * $History: CJFlatComboBox.cpp $
00013  *
00014  * *****************  Version 15  *****************
00015  * User: Kirk Stowell Date: 10/30/99   Time: 6:01p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Overrode OnEraseBkgnd(...) and re-wrote OnPaint() to handle flicker
00018  * free drawing.
00019  *
00020  * *****************  Version 14  *****************
00021  * User: Kirk Stowell Date: 10/30/99   Time: 2:14p
00022  * Updated in $/CodeJock/CJLibrary
00023  * Added COLORREF members to class to eliminate continuous calls to
00024  * GetSysColor(...). Overrode OnSysColorChange() to re-initialize COLORREF
00025  * variables.
00026  *
00027  * *****************  Version 13  *****************
00028  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00029  * Updated in $/CodeJockey/CJLibrary
00030  * Updated copyright and contact information.
00031  *
00032  * *****************  Version 12  *****************
00033  * User: Kirk Stowell Date: 8/30/99    Time: 12:50a
00034  * Updated in $/CodeJockey/CJLibrary
00035  * Hiren Patel <hpatel@spss.com> - Added ReleaseDC(pDC) when window is
00036  * disabled.
00037  *
00038  * *****************  Version 11  *****************
00039  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00040  * Updated in $/CodeJockey/CJLibrary
00041  *
00042  * *****************  Version 10  *****************
00043  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00044  * Updated in $/CodeJockey/CJLibrary
00045  *
00046  * *****************  Version 9  *****************
00047  * User: Kirk Stowell Date: 5/17/99    Time: 9:24p
00048  * Updated in $/CodeJockey/CJ60Lib
00049  * Gilberto Botaro [seafox@techno.com.br] - Added code for auto
00050  * completion.
00051  *
00052  * *****************  Version 8  *****************
00053  * User: Kirk Stowell Date: 5/03/99    Time: 10:44p
00054  * Updated in $/CodeJockey/CJ60Lib
00055  * Fixed code ommisions.
00056  *
00057  * *****************  Version 7  *****************
00058  * User: Kirk Stowell Date: 5/03/99    Time: 8:42p
00059  * Updated in $/CodeJockey/CJ60Lib
00060  * Danilo Lax [Danilo_Lax@www2.alpeng.com] - The control is painted flat
00061  * when the mouse leaves the box, even if the control has the focus, now
00062  * checking for the focus in OnTimer(.
00063  *
00064  * Removed, unhandled msgs are processed by
00065  * CComboBox::PreTranslateMessage(pMsg). Used reflected msgs
00066  * BN_GETFOCUS/CBN_KILLFOCUS instead of WM_GETFOCUS/WM_KILLFOCUS.
00067  *
00068  * ::GetFocus() doesn't return CFlatComboBox::m_hWnd, even if the control
00069  * has the focus (don't know why, maybe ::GetFocus() only returns the
00070  * handle to the EditField part of the ComboBox), used flag m_bHasFocus
00071  * instead.
00072  *
00073  * *****************  Version 6  *****************
00074  * User: Kirk Stowell Date: 4/03/99    Time: 4:26p
00075  * Updated in $/CodeJockey/CJ60Lib
00076  * Added comments and cleaned up code.
00077  *
00078  * *****************  Version 5  *****************
00079  * User: Kirk Stowell Date: 1/22/99    Time: 4:26p
00080  * Updated in $/CodeJockey/CJ60Lib
00081  * Fixed accelerator problem reported by YOSH YAMASHITA
00082  * (yosh@muj.biglobe.ne.jp) with Matt Weagle's solution of overloading
00083  * PreTranslateMessage().
00084  *
00085  * *****************  Version 4  *****************
00086  * User: Kirk Stowell Date: 1/02/99    Time: 4:25p
00087  * Updated in $/CodeJockey/CJ60Lib
00088  * Renamed class from CJComboBox to CCJFlatComboBox, changed DRAWSTATE to
00089  * enum, removed method Offset(), and replaced with a direct call to
00090  * ::GetSystemMetrics().
00091  *
00092  * *****************  Version 3  *****************
00093  * User: Kirk Stowell Date: 11/02/98   Time: 4:24p
00094  * Updated in $/CodeJockey/CJ60Lib
00095  * Added OnSetFocus(), OnKillFocus() and modified OnPaint() so the control
00096  * remains beveled until it actually looses focus - (Vachik
00097  * Hovhannissian).
00098  *
00099  * *****************  Version 2  *****************
00100  * User: Kirk Stowell Date: 10/05/98   Time: 4:24p
00101  * Updated in $/CodeJockey/CJ60Lib
00102  * Fixed offset bug to use GetSystemMetrics(), instead of hard coded
00103  * values -
00104  * Todd Brannam (tbrannam@msn.com).
00105  *
00106  * *****************  Version 1  *****************
00107  * User: Kirk Stowell Date: 10/02/98   Time: 4:23p
00108  * Created in $/CodeJockey/CJ60Lib
00109  * First release version.
00110  *
00111  ***************************************************************************/
00113
00114 #include "stdafx.h"
00115 #include "CJFlatComboBox.h"
00116
00117 #ifdef _DEBUG
00118 #define new DEBUG_NEW
00119 #undef THIS_FILE
00120 static char THIS_FILE[] = __FILE__;
00121 #endif
00122
00124 // CCJFlatComboBox
00125
00126 CCJFlatComboBox::CCJFlatComboBox()
00127 {
00128     m_bLBtnDown     = FALSE;
00129     m_bPainted      = FALSE;
00130     m_bHasFocus     = FALSE;
00131     m_bAutoComp     = FALSE;
00132     m_clrHilite     = ::GetSysColor(COLOR_BTNHIGHLIGHT);
00133     m_clrShadow     = ::GetSysColor(COLOR_BTNSHADOW);
00134     m_clrNormal     = ::GetSysColor(COLOR_BTNFACE);
00135 }
00136
00137 CCJFlatComboBox::~CCJFlatComboBox()
00138 {
00139 }
00140
00141 IMPLEMENT_DYNAMIC(CCJFlatComboBox, CComboBox)
00142
00143 BEGIN_MESSAGE_MAP(CCJFlatComboBox, CComboBox)
00144     //{{AFX_MSG_MAP(CCJFlatComboBox)
00145     ON_WM_MOUSEMOVE()
00146     ON_WM_LBUTTONDOWN()
00147     ON_WM_LBUTTONUP()
00148     ON_WM_TIMER()
00149     ON_WM_PAINT()
00150     ON_CONTROL_REFLECT(CBN_SETFOCUS,   OnSetFocus)
00151     ON_CONTROL_REFLECT(CBN_KILLFOCUS,  OnKillFocus)
00152     ON_CONTROL_REFLECT(CBN_EDITUPDATE, OnEditUpdate)
00153     ON_WM_SYSCOLORCHANGE()
00154     ON_WM_ERASEBKGND()
00155     //}}AFX_MSG_MAP
00156 END_MESSAGE_MAP()
00157
00159 // CCJFlatComboBox message handlers
00160
00161 void CCJFlatComboBox::OnMouseMove(UINT nFlags, CPoint point)
00162 {
00163     SetTimer(1,10,NULL);
00164     OnTimer(1);
00165     CComboBox::OnMouseMove(nFlags, point);
00166 }
00167
00168 void CCJFlatComboBox::OnLButtonDown(UINT nFlags, CPoint point)
00169 {
00170     m_bLBtnDown = TRUE;
00171     CComboBox::OnLButtonDown(nFlags, point);
00172 }
00173
00174 void CCJFlatComboBox::OnLButtonUp(UINT nFlags, CPoint point)
00175 {
00176     m_bLBtnDown = FALSE;
00177     Invalidate();
00178     CComboBox::OnLButtonUp(nFlags, point);
00179 }
00180
00181 void CCJFlatComboBox::OnTimer(UINT nIDEvent)
00182 {
00183     UNUSED_ALWAYS(nIDEvent);
00184
00185     if (m_bLBtnDown==TRUE) { // OnLButtonDown, show PRESSED.
00186         KillTimer (1);
00187         if (m_bPainted == TRUE) {
00188             DrawCombo(PRESSED, m_clrShadow, m_clrHilite);
00189             m_bPainted = FALSE;
00190         }
00191     } else if (!PointInRect() && !m_bHasFocus) { // If mouse leaves, show flat.
00192         KillTimer (1);
00193         if (m_bPainted == TRUE) {
00194             DrawCombo(NORMAL, m_clrNormal, m_clrNormal);
00195             m_bPainted = FALSE;
00196         }
00197     } else { // On mouse over, show RAISED.
00198         if (m_bPainted == TRUE) {
00199             return;
00200         } else {
00201             m_bPainted = TRUE;
00202             DrawCombo(RAISED, m_clrShadow, m_clrHilite);
00203         }
00204     }
00205 }
00206
00207 void CCJFlatComboBox::OnPaint()
00208 {
00209     ModifyStyleEx (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE,
00210         0, SWP_FRAMECHANGED);
00211
00212     CPaintDC dc(this);
00213
00214     // KStowell - Get the client rect.
00215     CRect rcClient;
00216     GetClientRect( &rcClient );
00217
00218     // KStowell - Create a memory device-context. This is done to help reduce
00219     // screen flicker, since we will paint the entire control to the
00220     // off screen device context first.
00221     CDC memDC;
00222     CBitmap bitmap;
00223     memDC.CreateCompatibleDC(&dc);
00224     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00225     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00226
00227     // let the control do its default drawing.
00228     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00229
00230     if (PointInRect() || m_bHasFocus) {
00231         DrawCombo(RAISED, m_clrShadow, m_clrHilite, &memDC);
00232     } else {
00233         DrawCombo(NORMAL, m_clrNormal, m_clrNormal, &memDC);
00234     }
00235
00236     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00237     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00238
00239     // KStowell - Cleanup resources.
00240     memDC.SelectObject(pOldBitmap);
00241     memDC.DeleteDC();
00242     bitmap.DeleteObject();
00243 }
00244
00245 void CCJFlatComboBox::DrawCombo(STATE eState, COLORREF clrTopLeft, COLORREF clrBottomRight, CDC* pDC)
00246 {
00247     CRect rcItem;
00248     GetClientRect(&rcItem);
00249     bool bRelease = false;
00250
00251     // if no device context was passed in, get the device context
00252     // for the CWnd client area ...
00253     if(pDC == NULL) {
00254         pDC = GetDC();
00255         bRelease = true;
00256     }
00257
00258     // Cover up dark 3D shadow.
00259     pDC->Draw3dRect(rcItem, clrTopLeft, clrBottomRight);
00260     rcItem.DeflateRect(1,1);
00261
00262     if (!IsWindowEnabled()) {
00263         pDC->Draw3dRect(rcItem, m_clrHilite, m_clrHilite);
00264     } else {
00265         pDC->Draw3dRect(rcItem, m_clrNormal, m_clrNormal);
00266     }
00267
00268     // Cover up dark 3D shadow on drop arrow.
00269     rcItem.DeflateRect(1,1);
00270     rcItem.left = rcItem.right-::GetSystemMetrics(SM_CXHTHUMB);;
00271     pDC->Draw3dRect(rcItem, m_clrNormal, m_clrNormal);
00272
00273     // Cover up NORMAL 3D shadow on drop arrow.
00274     rcItem.DeflateRect(1,1);
00275     pDC->Draw3dRect(rcItem, m_clrNormal, m_clrNormal);
00276
00277     if (!IsWindowEnabled()) {
00278         if(bRelease == true) {
00279             ReleaseDC(pDC);
00280         }
00281         return;
00282     }
00283
00284     rcItem.InflateRect(0,1);
00285     switch (eState)
00286     {
00287     case NORMAL:
00288         pDC->Draw3dRect(rcItem, m_clrHilite, m_clrHilite);
00289         rcItem.left -= 1;
00290         pDC->Draw3dRect(rcItem, m_clrHilite, m_clrHilite);
00291         break;
00292
00293     case RAISED:
00294         pDC->Draw3dRect(rcItem, m_clrHilite, m_clrShadow);
00295         break;
00296
00297     case PRESSED:
00298         rcItem.OffsetRect(1,1);
00299         pDC->Draw3dRect(rcItem, m_clrShadow, m_clrHilite);
00300         break;
00301     }
00302
00303     // KStowell - cleanup.
00304     if(bRelease == true) {
00305         ReleaseDC(pDC);
00306     }
00307 }
00308
00309 void CCJFlatComboBox::OnSetFocus()
00310 {
00311     m_bHasFocus = TRUE;
00312     DrawCombo(RAISED, m_clrShadow, m_clrHilite);
00313 }
00314
00315 void CCJFlatComboBox::OnKillFocus()
00316 {
00317     m_bHasFocus = FALSE;
00318     DrawCombo(NORMAL, m_clrNormal, m_clrNormal);
00319 }
00320
00321 BOOL CCJFlatComboBox::PreTranslateMessage(MSG* pMsg)
00322 {
00323     if(IsWin95()) // alexander Golde [alex@viona.de]
00324     {
00325         // Make sure that the keystrokes continue to the appropriate handlers
00326         if (pMsg->message == WM_KEYDOWN || pMsg->message==WM_KEYUP)
00327         {
00328             ::TranslateMessage(pMsg);
00329             ::DispatchMessage(pMsg);
00330             return TRUE;
00331         }
00332
00333         // Catch the Alt key so we don't choke if focus
00334         // is going to an owner drawn button
00335         if (pMsg->message == WM_SYSCHAR)
00336             return TRUE;
00337     }
00338
00339     return CComboBox::PreTranslateMessage(pMsg);
00340 }
00341
00342 void CCJFlatComboBox::OnEditUpdate()
00343 {
00344     // if we are not to auto update the text, get outta here
00345     if (!m_bAutoComp)
00346         return;
00347
00348     // Get the text in the edit box
00349     CString str;
00350     GetWindowText(str);
00351     int nLength = str.GetLength();
00352
00353     // Currently selected range
00354     DWORD dwCurSel = GetEditSel();
00355     WORD dStart = LOWORD(dwCurSel);
00356     WORD dEnd   = HIWORD(dwCurSel);
00357
00358     // Search for, and select in, and string in the combo box that is prefixed
00359     // by the text in the edit box
00360     if (SelectString(-1, str) == CB_ERR)
00361     {
00362         SetWindowText(str);     // No text selected, so restore what was there before
00363         if (dwCurSel != CB_ERR)
00364             SetEditSel(dStart, dEnd);   //restore cursor postion
00365     }
00366
00367     // Set the text selection as the additional text that we have added
00368     if (dEnd < nLength && dwCurSel != CB_ERR)
00369         SetEditSel(dStart, dEnd);
00370     else
00371         SetEditSel(nLength, -1);
00372 }
00373
00374 BOOL CCJFlatComboBox::IsWin95()
00375 {
00376     OSVERSIONINFO info;
00377     info.dwOSVersionInfoSize = sizeof(info);
00378     GetVersionEx( &info );
00379     return ((VER_PLATFORM_WIN32_WINDOWS == info.dwPlatformId) && (info.dwMinorVersion == 0));
00380 }
00381
00382 void CCJFlatComboBox::OnSysColorChange()
00383 {
00384     CComboBox::OnSysColorChange();
00385
00386     m_clrHilite = ::GetSysColor(COLOR_BTNHIGHLIGHT);
00387     m_clrShadow = ::GetSysColor(COLOR_BTNSHADOW);
00388     m_clrNormal = ::GetSysColor(COLOR_BTNFACE);
00389 }
00390
00391 BOOL CCJFlatComboBox::OnEraseBkgnd(CDC* pDC)
00392 {
00393     // KStowell - overridden for flicker-free drawing.
00394     UNUSED_ALWAYS(pDC);
00395     return TRUE;
00396 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJFlatHeaderCtrl.cpp Source File

WinCvs/CJLib/CJLibrary/CJFlatHeaderCtrl.cpp

Go to the documentation of this file.
00001 // CJFlatHeaderCtrl.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJFlatHeaderCtrl.cpp $
00011  *
00012  * $History: CJFlatHeaderCtrl.cpp $
00013  *
00014  * *****************  Version 21  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:01p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Further Updates to OnEraseBkgnd(...) and OnPaint() for flicker free
00018  * drawing.
00019  *
00020  * *****************  Version 20  *****************
00021  * User: Kirk Stowell Date: 10/30/99   Time: 2:11p
00022  * Updated in $/CodeJock/CJLibrary
00023  * Overrode OnPaint(...) for flicker free drawing and fixed bug where
00024  * column is resized and border leaves a trail.
00025  *
00026  * *****************  Version 19  *****************
00027  * User: Kirk Stowell Date: 10/24/99   Time: 7:34p
00028  * Updated in $/CodeJock/CJLibrary
00029  * 1. Fixed bug with flat header control where header items were not drawn
00030  * correctly whenever header items were dragged to a new location. Ioannhs
00031  * Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr]
00032  *
00033  * *****************  Version 18  *****************
00034  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00035  * Updated in $/CodeJock/CJLibrary
00036  * Fixed potential resource and memory leak problems.
00037  *
00038  * *****************  Version 17  *****************
00039  * User: Kirk Stowell Date: 10/14/99   Time: 8:23p
00040  * Updated in $/CodeJock/CJLibrary
00041  * Fixed size bug with header control where the end does not display
00042  * correctly.
00043  *
00044  * *****************  Version 16  *****************
00045  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00046  * Updated in $/CodeJockey/CJLibrary
00047  * Updated copyright and contact information.
00048  *
00049  * *****************  Version 15  *****************
00050  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00051  * Updated in $/CodeJockey/CJLibrary
00052  * Added Unicode compliance, thanks to Barry Burton for his help with
00053  * this.
00054  *
00055  *
00056  * *****************  Version 14  *****************
00057  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00058  * Updated in $/CodeJockey/CJLibrary
00059  *
00060  * *****************  Version 13  *****************
00061  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00062  * Updated in $/CodeJockey/CJLibrary
00063  *
00064  * *****************  Version 12  *****************
00065  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00066  * Updated in $/CodeJockey/CJLibrary
00067  *
00068  * *****************  Version 11  *****************
00069  * User: Kirk Stowell Date: 7/25/99    Time: 12:15a
00070  * Updated in $/CodeJockey/CJLibrary
00071  *
00072  * *****************  Version 10  *****************
00073  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00074  * Updated in $/CodeJockey/CJLibrary
00075  *
00076  * *****************  Version 9  *****************
00077  * User: Kirk Stowell Date: 7/18/99    Time: 10:27p
00078  * Updated in $/CodeJockey/CJLibrary
00079  * Added vc5 compatibility.
00080  *
00081  * *****************  Version 8  *****************
00082  * User: Kirk Stowell Date: 6/14/99    Time: 10:43p
00083  * Updated in $/CodeJockey/CJ60Lib
00084  * Cleaned up code to eliminate level 4 compilier warnings.
00085  *
00086  * *****************  Version 7  *****************
00087  * User: Kirk Stowell Date: 5/17/99    Time: 8:00p
00088  * Updated in $/CodeJockey/CJ60Lib
00089  * Added popup menu support and vc5 compatibility.
00090  *
00091  * *****************  Version 6  *****************
00092  * User: Kirk Stowell Date: 5/12/99    Time: 5:32a
00093  * Updated in $/CodeJockey/CJ60Lib
00094  * Added support for vc5 compatibility
00095  *
00096  * *****************  Version 5  *****************
00097  * User: Kirk Stowell Date: 4/15/99    Time: 4:27p
00098  * Updated in $/CodeJockey/CJ60Lib
00099  * Igor Ostriz [iostriz@usa.net] - fixed bug with drag/drop and changing
00100  * column order.
00101  *
00102  * *****************  Version 4  *****************
00103  * User: Kirk Stowell Date: 4/03/99    Time: 4:26p
00104  * Updated in $/CodeJockey/CJ60Lib
00105  * Added comments and cleaned up code.
00106  *
00107  * *****************  Version 3  *****************
00108  * User: Kirk Stowell Date: 2/24/99    Time: 4:26p
00109  * Updated in $/CodeJockey/CJ60Lib
00110  * Fixed repainting problem when header is moved or window is resized. The
00111  * class now uses log font instead of hard coded Tahoma font.
00112  *
00113  * *****************  Version 2  *****************
00114  * User: Kirk Stowell Date: 1/31/99    Time: 4:27p
00115  * Updated in $/CodeJockey/CJ60Lib
00116  * Fixed problem with sort arrow drawn. If hditem has an associated
00117  * bitmap, the arrow is not drawn.
00118  *
00119  * *****************  Version 1  *****************
00120  * User: Kirk Stowell Date: 1/16/99    Time: 4:26p
00121  * Created in $/CodeJockey/CJ60Lib
00122  * Initial release.
00123  *
00124  ***************************************************************************/
00126
00127 #include "stdafx.h"
00128 #include "CJFlatHeaderCtrl.h"
00129
00130 #ifdef _DEBUG
00131 #define new DEBUG_NEW
00132 #undef THIS_FILE
00133 static char THIS_FILE[] = __FILE__;
00134 #endif
00135
00137 // CCJFlatHeaderCtrl
00138
00139 CCJFlatHeaderCtrl::CCJFlatHeaderCtrl()
00140 {
00141     m_nSortCol      = -1;
00142     m_bBoldFont     = FALSE;
00143     m_nOffset       = 6;
00144     m_bLBtnDown     = FALSE;
00145     m_popupMenuID   = 0;
00146     m_popToolbarID  = 0;
00147     m_nPos          = 0;
00148     m_pParentWnd    = NULL;
00149 }
00150
00151 CCJFlatHeaderCtrl::~CCJFlatHeaderCtrl()
00152 {
00153     // fix potential resource leak - KStowell - 10-22-99.
00154     m_Font.DeleteObject();
00155 }
00156
00157 BEGIN_MESSAGE_MAP(CCJFlatHeaderCtrl, CHeaderCtrl)
00158     //{{AFX_MSG_MAP(CCJFlatHeaderCtrl)
00159     ON_WM_PAINT()
00160     ON_WM_RBUTTONDOWN()
00161     ON_WM_MEASUREITEM()
00162     ON_WM_MENUCHAR()
00163     ON_WM_INITMENUPOPUP()
00164     ON_WM_CREATE()
00165     ON_WM_WINDOWPOSCHANGED()
00166     ON_WM_ERASEBKGND()
00167     //}}AFX_MSG_MAP
00168 END_MESSAGE_MAP()
00169
00171 // CCJFlatHeaderCtrl message handlers
00172
00173 void CCJFlatHeaderCtrl::InitializeHeader(bool bBoldFont)
00174 {
00175     m_Font.DeleteObject();
00176     NONCLIENTMETRICS ncm;
00177     ncm.cbSize = sizeof(ncm);
00178     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00179     if(bBoldFont)
00180         ncm.lfMessageFont.lfWeight = 700;
00181     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00182     SetFont(&m_Font);
00183
00184     m_bBoldFont = bBoldFont;
00185 }
00186
00187 int CCJFlatHeaderCtrl::SetSortImage(int nCol, BOOL bAsc)
00188 {
00189     int nPrevCol = m_nSortCol;
00190
00191     m_nSortCol = nCol;
00192     m_bSortAsc = bAsc;
00193
00194     // Change the item to ownder drawn
00195     HD_ITEM hditem;
00196
00197     hditem.mask = HDI_BITMAP | HDI_FORMAT;
00198     GetItem( nCol, &hditem );
00199     if (hditem.hbm == NULL)
00200     {
00201         hditem.fmt |= HDF_OWNERDRAW;
00202         SetItem( nCol, &hditem );
00203
00204         // Invalidate header control so that it gets redrawn
00205         Invalidate();
00206     }
00207
00208     return nPrevCol;
00209 }
00210
00211 void CCJFlatHeaderCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
00212 {
00213     ASSERT(lpDrawItemStruct != NULL);
00214
00215     // define some temporary variables.
00216     CDC*    pDC         = CDC::FromHandle( lpDrawItemStruct->hDC );
00217     CRect   rcItem      = lpDrawItemStruct->rcItem;
00218     CRect   rcIcon      = lpDrawItemStruct->rcItem;
00219     int     nState      = lpDrawItemStruct->itemState;
00220     int     nItemID     = lpDrawItemStruct->itemID;
00221     int     nSavedDC    = pDC->SaveDC();
00222
00223     // Paint the background.
00224     pDC->FillSolidRect(rcItem, afxData.clrBtnFace);
00225     pDC->SetBkMode(TRANSPARENT);
00226
00227     // Set clipping region to limit drawing within column
00228     CRgn rgn;
00229     rgn.CreateRectRgnIndirect( &rcItem );
00230     pDC->SelectObject( &rgn );
00231     rgn.DeleteObject();
00232
00233     // Get the column text and format
00234     TCHAR buf[256];
00235     HD_ITEM hditem;
00236
00237     hditem.mask = HDI_TEXT | HDI_FORMAT;
00238     hditem.pszText = buf;
00239     hditem.cchTextMax = 255;
00240
00241     GetItem( nItemID, &hditem );
00242
00243     // Determine format for drawing column label
00244     UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP
00245         | DT_VCENTER | DT_END_ELLIPSIS ;
00246
00247     if( hditem.fmt & HDF_CENTER) {
00248         uFormat |= DT_CENTER;
00249     } else if( hditem.fmt & HDF_RIGHT) {
00250         uFormat |= DT_RIGHT;
00251     } else {
00252         uFormat |= DT_LEFT;
00253     }
00254
00255     // Adjust the rect if the mouse button is pressed on it
00256     if( nState == ODS_SELECTED ) {
00257         rcItem.left++;
00258         rcItem.top += 2;
00259         rcItem.right++;
00260     }
00261
00262     // Adjust the rect further if Sort arrow is to be displayed
00263     if( nItemID == m_nSortCol ) {
00264         rcItem.right -= 3 * m_nOffset;
00265     }
00266
00267     rcItem.left += m_nOffset;
00268     rcItem.right -= m_nOffset;
00269
00270     // Draw column label
00271     if( rcItem.left < rcItem.right ) {
00272         if (m_bBoldFont) {
00273             CFont* pOldFont = pDC->SelectObject(&m_Font);
00274             pDC->DrawText(buf,-1,rcItem, uFormat);
00275             pDC->SelectObject(pOldFont);
00276         } else {
00277             pDC->DrawText(buf,-1,rcItem, uFormat);
00278         }
00279     }
00280
00281     // Draw the Sort arrow
00282     if( nItemID == m_nSortCol )
00283     {
00284         // Set up pens to use for drawing the triangle
00285         CPen penLite(PS_SOLID, 1, afxData.clrBtnHilite);
00286         CPen penShad(PS_SOLID, 1, afxData.clrBtnShadow);
00287         CPen *pOldPen = pDC->SelectObject( &penLite );
00288
00289         if( m_bSortAsc )
00290         {
00291             // Draw triangle pointing upwards
00292             pDC->MoveTo( rcIcon.right - 2*m_nOffset, m_nOffset-1);
00293             pDC->LineTo( rcIcon.right - 3*m_nOffset/2, rcIcon.bottom - m_nOffset );
00294             pDC->LineTo( rcIcon.right - 5*m_nOffset/2-2, rcIcon.bottom - m_nOffset );
00295             pDC->MoveTo( rcIcon.right - 5*m_nOffset/2-1, rcIcon.bottom - m_nOffset-1 );
00296
00297             pDC->SelectObject( &penShad );
00298             pDC->LineTo( rcIcon.right - 2*m_nOffset, m_nOffset-2);
00299         }
00300         else
00301         {
00302             // Draw triangle pointing downwords
00303             pDC->MoveTo( rcIcon.right - 3*m_nOffset/2, m_nOffset-1);
00304             pDC->LineTo( rcIcon.right - 2*m_nOffset-1, rcIcon.bottom - m_nOffset + 1 );
00305             pDC->MoveTo( rcIcon.right - 2*m_nOffset-1, rcIcon.bottom - m_nOffset );
00306
00307             pDC->SelectObject( &penShad );
00308             pDC->LineTo( rcIcon.right - 5*m_nOffset/2-1, m_nOffset -1 );
00309             pDC->LineTo( rcIcon.right - 3*m_nOffset/2, m_nOffset -1);
00310         }
00311
00312         // Restore the pen
00313         pDC->SelectObject( pOldPen );
00314
00315         // fix potential resource leak - KStowell - 10-21-99
00316         penLite.DeleteObject();
00317         penShad.DeleteObject();
00318     }
00319
00320     // restore the device context
00321     pDC->RestoreDC(nSavedDC);
00322 }
00323
00324 void CCJFlatHeaderCtrl::OnPaint()
00325 {
00326     CPaintDC dc(this); // device context for painting
00327
00328     // KStowell - Get the client rect.
00329     CRect rcClient;
00330     GetClientRect( &rcClient );
00331
00332     // KStowell - Create a memory device-context. This is done to help reduce
00333     // screen flicker, since we will paint the entire control to the
00334     // off screen device context first.
00335     CDC memDC;
00336     CBitmap bitmap;
00337     memDC.CreateCompatibleDC(&dc);
00338     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00339     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00340     memDC.FillSolidRect(rcClient, afxData.clrBtnFace);
00341
00342     // First let the control do its default drawing.
00343     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00344
00345     // KStowell - Repaint the background.
00346     DrawFlatBorder(&memDC);
00347
00348     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00349     dc.BitBlt( rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC,
00350         rcClient.left, rcClient.top, SRCCOPY );
00351
00352     // KStowell - Cleanup resources.
00353     memDC.SelectObject(pOldBitmap);
00354     memDC.DeleteDC();
00355     bitmap.DeleteObject();
00356 }
00357
00358 void CCJFlatHeaderCtrl::DrawFlatBorder(CDC* pDC)
00359 {
00360     CRect rci;
00361     GetWindowRect(&rci);
00362     ScreenToClient(&rci);
00363
00364     // Cover up thick 3D border.
00365     pDC->Draw3dRect(rci, afxData.clrBtnFace, afxData.clrBtnFace);
00366     rci.DeflateRect(1,1);
00367     pDC->Draw3dRect(rci, afxData.clrBtnFace, afxData.clrBtnFace);
00368
00369     // Draw flat style border around entire header.
00370     rci.InflateRect(1,1);
00371     pDC->Draw3dRect(rci, afxData.clrBtnHilite, afxData.clrBtnShadow);
00372
00373     // Create the pens for further cover-up.
00374     CPen penLite(PS_SOLID, 1, afxData.clrBtnHilite);
00375     CPen penShad(PS_SOLID, 1, afxData.clrBtnShadow);
00376     CPen penFace(PS_SOLID, 1, afxData.clrBtnFace);
00377     CPen *pOldPen = pDC->SelectObject( &penLite );
00378
00379     // Set up the header item struct.
00380     HD_ITEM hdi;
00381     memset (&hdi, 0, sizeof(HD_ITEM));
00382     hdi.fmt  = HDF_STRING | HDF_LEFT | HDF_OWNERDRAW;
00383     hdi.mask = HDI_WIDTH | HDI_TEXT | HDI_FORMAT | HDI_ORDER; // Yiannhs :1999-10-19
00384     int cx = 0;
00385
00386     long j = GetItemCount();    //Yiannhs
00387     long i = 0;                 //Yiannhs
00388
00389     long * ItemOrders = new long[j];    //Yiannhs :1999-10-19
00390     for( i=0; i<j; i++ ) {              //Yiannhs :1999-10-19
00391         GetItem(i, &hdi);               //Yiannhs :1999-10-19
00392         ItemOrders[hdi.iOrder] = i;     //Yiannhs :1999-10-19
00393     }
00394
00395     hdi.fmt  = HDF_STRING | HDF_LEFT | HDF_OWNERDRAW;   //Yiannhs :1999-10-19
00396     hdi.mask = HDI_WIDTH | HDI_TEXT | HDI_FORMAT;       //Yiannhs :1999-10-19
00397
00398     // For each header item found, do further cover up.
00399     for (i = 0; i < j; ++i)
00400     {
00401         GetItem( ItemOrders[i], &hdi);
00402         cx += hdi.cxy;
00403
00404         pDC->SelectObject(&penShad);
00405         pDC->MoveTo(cx, 2);
00406         pDC->LineTo(cx, rci.bottom-2);
00407
00408         pDC->SelectObject(&penLite);
00409         pDC->MoveTo(cx+1, 2);
00410         pDC->LineTo(cx+1, rci.bottom-2);
00411
00412         pDC->SelectObject(&penFace);
00413         pDC->MoveTo(cx-1, 2);
00414         pDC->LineTo(cx-1, rci.bottom-2);
00415
00416         pDC->SelectObject(&penFace);
00417         pDC->MoveTo(cx-2, 2);
00418         pDC->LineTo(cx-2, rci.bottom-2);
00419     }
00420
00421     delete [] ItemOrders; //Yiannhs :1999-10-19
00422
00423     // Restore the pen and release device context.
00424     pDC->SelectObject( pOldPen );
00425
00426     // fix potential resource leak - KStowell - 10-21-99
00427     penLite.DeleteObject();
00428     penShad.DeleteObject();
00429     penFace.DeleteObject();
00430 }
00431
00432 void CCJFlatHeaderCtrl::OnRButtonDown(UINT /*nFlags*/, CPoint point)
00433 {
00434     // No menu was defined...
00435     if (!m_popupMenuID) {
00436         TRACE0( "Warning: No menu resource was associated with CCJTabCtrl.\n" );
00437         return;
00438     }
00439
00440     // Since we are using the main window as the
00441     // parent, we need to convert the point to screen
00442     // coordinates...
00443     CPoint pt = point;
00444     ClientToScreen(&pt);
00445
00446     // Load the popup menu.
00447     VERIFY(m_popupMenu.LoadMenu(m_popupMenuID));
00448     CCJMenu* pPopup = (CCJMenu*)m_popupMenu.GetSubMenu(m_nPos);
00449     ASSERT(pPopup != NULL);
00450
00451     // Load toolbar resource if any for menu icons.
00452     if (m_popToolbarID) {
00453         pPopup->LoadToolbar(m_popToolbarID);
00454     }
00455
00456     // Display the popup menu, use the main window as its parent.
00457     pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
00458         pt.x, pt.y, AfxGetMainWnd());
00459
00460     m_popupMenu.DestroyMenu();
00461 }
00462
00463 void CCJFlatHeaderCtrl::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
00464 {
00465     if (lpMeasureItemStruct->CtlType == ODT_MENU)
00466     {
00467         if (IsMenu((HMENU)lpMeasureItemStruct->itemID)) {
00468             CMenu* pMenu = CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
00469
00470             if (m_popupMenu.IsMenu(pMenu)) {
00471                 m_popupMenu.MeasureItem(lpMeasureItemStruct);
00472                 return;
00473             }
00474         }
00475     }
00476
00477     CHeaderCtrl::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
00478 }
00479
00480 LRESULT CCJFlatHeaderCtrl::OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu)
00481 {
00482     if (m_popupMenu.IsMenu(pMenu)) {
00483         return CCJMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
00484     }
00485
00486     return CHeaderCtrl::OnMenuChar(nChar, nFlags, pMenu);
00487 }
00488
00489 void CCJFlatHeaderCtrl::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
00490 {
00491     CHeaderCtrl::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
00492
00493     if(!bSysMenu) {
00494         if (m_popupMenu.IsMenu(pPopupMenu)) {
00495             CCJMenu::UpdateMenu(pPopupMenu);
00496         }
00497     }
00498 }
00499
00500 #ifdef _VC_VERSION_5
00501 BOOL CCJFlatHeaderCtrl::GetOrderArray(LPINT piArray, int iCount /* = -1 */)
00502 {
00503     ASSERT(::IsWindow(m_hWnd));
00504
00505     // if -1 was passed, find the count ourselves
00506
00507     int nCount = iCount;
00508     if (nCount == -1)
00509     {
00510         nCount = GetItemCount();
00511
00512         if (nCount == -1)
00513             return FALSE;
00514     }
00515
00516     ASSERT(AfxIsValidAddress(piArray, iCount * sizeof(int)));
00517
00518     return (BOOL) ::SendMessage(m_hWnd, HDM_GETORDERARRAY,
00519         (WPARAM) iCount, (LPARAM) piArray);
00520 }
00521 #endif // _VC_VERSION_5
00522
00523 void CCJFlatHeaderCtrl::PreSubclassWindow()
00524 {
00525     CHeaderCtrl::PreSubclassWindow();
00526
00527     m_pParentWnd = GetParent();
00528     ASSERT(m_pParentWnd);
00529
00530     ResizeWindow();
00531 }
00532
00533 int CCJFlatHeaderCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
00534 {
00535     if (CHeaderCtrl::OnCreate(lpCreateStruct) == -1)
00536         return -1;
00537
00538     m_pParentWnd = CWnd::FromHandle(lpCreateStruct->hwndParent);
00539     ASSERT(m_pParentWnd);
00540
00541     ResizeWindow();
00542     return 0;
00543 }
00544
00545 void CCJFlatHeaderCtrl::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
00546 {
00547     CHeaderCtrl::OnWindowPosChanged(lpwndpos);
00548     ResizeWindow();
00549 }
00550
00551 void CCJFlatHeaderCtrl::ResizeWindow()
00552 {
00553     ASSERT_VALID(this);
00554     ASSERT_VALID(m_pParentWnd);
00555
00556     // Get the client size of the parent window, this will give us the
00557     // actual width of the header we are looking for.
00558     CRect rcParent;
00559     m_pParentWnd->GetClientRect(&rcParent);
00560
00561     // Get the size of the header control, we will need this for the
00562     // height of the header.
00563     CRect rcWnd;
00564     GetWindowRect(&rcWnd);
00565
00566     // Now, resize the window.
00567     SetWindowPos(NULL, 0, 0, rcParent.Width(), rcWnd.Height(),
00568         SWP_NOMOVE|SWP_FRAMECHANGED);
00569 }
00570
00571 BOOL CCJFlatHeaderCtrl::OnEraseBkgnd(CDC* pDC)
00572 {
00573     // KStowell - overridden for flicker-free drawing.
00574     UNUSED_ALWAYS(pDC);
00575     return TRUE;
00576 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJFlatSplitterWnd.cpp Source File

WinCvs/CJLib/CJLibrary/CJFlatSplitterWnd.cpp

Go to the documentation of this file.
00001 // CJFlatSplitterWnd.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the CSplitterWndEx class written by Oleg G. Galkin.
00006 // mailto:OlegGa@vest.msk.ru
00007 // http://www.codeguru.com/splitter/show_hide_static_panes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJock/CJLibrary/CJFlatSplitterWnd.cpp $
00015  *
00016  * $History: CJFlatSplitterWnd.cpp $
00017  *
00018  * *****************  Version 6  *****************
00019  * User: Kirk Stowell Date: 10/14/99   Time: 9:25p
00020  * Updated in $/CodeJock/CJLibrary
00021  * Fixed bug with hiding or showing panes where the incorrect splitter
00022  * control id was used.
00023  *
00024  * *****************  Version 5  *****************
00025  * User: Kirk Stowell Date: 9/13/99    Time: 5:44a
00026  * Updated in $/CodeJockey/CJLibrary
00027  * Fixed assertion when using ReplaceView to display a CFormView derived
00028  * class in a debug build - Tom
00029  *
00030  * *****************  Version 4  *****************
00031  * User: Kirk Stowell Date: 9/13/99    Time: 5:40a
00032  * Updated in $/CodeJockey/CJLibrary
00033  * Fixed bug with GetPane() call in ShowRow() where row and col arguments
00034  * were switched. - Francis
00035  *
00036  * *****************  Version 3  *****************
00037  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00038  * Updated in $/CodeJockey/CJLibrary
00039  * Updated copyright and contact information.
00040  *
00041  * *****************  Version 2  *****************
00042  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00043  * Updated in $/CodeJockey/CJLibrary
00044  *
00045  * *****************  Version 1  *****************
00046  * User: Kirk Stowell Date: 7/14/99    Time: 10:00p
00047  * Created in $/CodeJockey/CJLibrary
00048  * Class added to support flat splitters, removable splitter views and
00049  * view manipulation.
00050  *
00051  ***************************************************************************/
00053
00054 #include "StdAfx.h"
00055 #include "CJFlatSplitterWnd.h"
00056
00057 #ifdef _DEBUG
00058 #define new DEBUG_NEW
00059 #undef THIS_FILE
00060 static char THIS_FILE[] = __FILE__;
00061 #endif
00062
00064 // CCJFlatSplitterWnd
00065
00066 CCJFlatSplitterWnd::CCJFlatSplitterWnd()
00067 {
00068     m_bFlatSplitter = TRUE;
00069     m_nHiddenCol    = -1;
00070     m_nHiddenRow    = -1;
00071 }
00072
00073 CCJFlatSplitterWnd::~CCJFlatSplitterWnd()
00074 {
00075
00076 }
00077
00078 BEGIN_MESSAGE_MAP(CCJFlatSplitterWnd, CSplitterWnd)
00079     //{{AFX_MSG_MAP(CCJFlatSplitterWnd)
00080     ON_WM_PAINT()
00081     //}}AFX_MSG_MAP
00082 END_MESSAGE_MAP()
00083
00085 // CCJFlatSplitterWnd message handlers
00086
00087 void CCJFlatSplitterWnd::OnDrawSplitter(CDC* pDC, ESplitType nType,
00088     const CRect& rectArg)
00089 {
00090     if( m_bFlatSplitter )
00091     {
00092         // if pDC == NULL, then just invalidate
00093         if (pDC == NULL)
00094         {
00095             RedrawWindow(rectArg, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
00096             return;
00097         }
00098         ASSERT_VALID(pDC);
00099
00100         // otherwise, actually draw
00101         CRect rect = rectArg;
00102         switch (nType)
00103         {
00104         case splitBorder:
00105             ASSERT(afxData.bWin4);
00106             pDC->Draw3dRect(rect, afxData.clrBtnFace, afxData.clrBtnFace);
00107             rect.InflateRect(-CX_BORDER, -CY_BORDER);
00108             pDC->Draw3dRect(rect, afxData.clrBtnShadow, afxData.clrBtnHilite);
00109             return;
00110
00111         case splitIntersection:
00112             ASSERT(!afxData.bWin4);
00113             break;
00114
00115         case splitBox:
00116             if (afxData.bWin4)
00117             {
00118                 pDC->Draw3dRect(rect, afxData.clrBtnFace, afxData.clrWindowFrame);
00119                 rect.InflateRect(-CX_BORDER, -CY_BORDER);
00120                 pDC->Draw3dRect(rect, afxData.clrBtnHilite, afxData.clrBtnShadow);
00121                 rect.InflateRect(-CX_BORDER, -CY_BORDER);
00122                 break;
00123             }
00124             // fall through...
00125         case splitBar:
00126             if (!afxData.bWin4)
00127             {
00128                 pDC->Draw3dRect(rect, afxData.clrBtnHilite, afxData.clrBtnShadow);
00129                 rect.InflateRect(-CX_BORDER, -CY_BORDER);
00130             }
00131             break;
00132
00133         default:
00134             ASSERT(FALSE);  // unknown splitter type
00135         }
00136
00137         // fill the middle
00138         pDC->FillSolidRect(rect, afxData.clrBtnFace);
00139     }
00140
00141     else {
00142         CSplitterWnd::OnDrawSplitter(pDC, nType, rectArg);
00143     }
00144 }
00145
00146 void CCJFlatSplitterWnd::OnPaint()
00147 {
00148     if( m_bFlatSplitter )
00149     {
00150         ASSERT_VALID(this);
00151         CPaintDC dc(this);
00152
00153         CRect rectClient;
00154         GetClientRect(&rectClient);
00155
00156         CRect rectInside;
00157         GetInsideRect(rectInside);
00158         rectInside.InflateRect(4,4);
00159
00160         // draw the splitter boxes
00161         if (m_bHasVScroll && m_nRows < m_nMaxRows)
00162         {
00163             OnDrawSplitter(&dc, splitBox,
00164                 CRect(rectInside.right, rectClient.top,
00165                 rectClient.right, rectClient.top + m_cySplitter));
00166         }
00167
00168         if (m_bHasHScroll && m_nCols < m_nMaxCols)
00169         {
00170             OnDrawSplitter(&dc, splitBox,
00171                 CRect(rectClient.left, rectInside.bottom,
00172                 rectClient.left + m_cxSplitter, rectClient.bottom));
00173         }
00174
00175         // extend split bars to window border (past margins)
00176         DrawAllSplitBars(&dc, rectInside.right, rectInside.bottom);
00177
00178         // draw splitter intersections (inside only)
00179         GetInsideRect(rectInside);
00180         dc.IntersectClipRect(rectInside);
00181         CRect rect;
00182         rect.top = rectInside.top;
00183         for (int row = 0; row < m_nRows - 1; row++)
00184         {
00185             rect.top += m_pRowInfo[row].nCurSize + m_cyBorderShare;
00186             rect.bottom = rect.top + m_cySplitter;
00187             rect.left = rectInside.left;
00188             for (int col = 0; col < m_nCols - 1; col++)
00189             {
00190                 rect.left += m_pColInfo[col].nCurSize + m_cxBorderShare;
00191                 rect.right = rect.left + m_cxSplitter;
00192                 OnDrawSplitter(&dc, splitIntersection, rect);
00193                 rect.left = rect.right + m_cxBorderShare;
00194             }
00195             rect.top = rect.bottom + m_cxBorderShare;
00196         }
00197     }
00198     else {
00199         CSplitterWnd::OnPaint();
00200     }
00201 }
00202
00203 void CCJFlatSplitterWnd::HideRow(int nRowHide)
00204 {
00205     ASSERT_VALID( this );
00206     ASSERT( m_nRows > 1 );
00207     ASSERT( nRowHide < m_nRows );
00208     ASSERT( m_nHiddenRow == -1 );
00209     m_nHiddenRow = nRowHide;
00210
00211     int nActiveRow, nActiveCol;
00212
00213     // if the nRow has an active window -- change it
00214     if( GetActivePane( &nActiveRow, &nActiveCol ) != NULL )
00215     {
00216         if( nActiveRow == nRowHide )
00217         {
00218             if( ++nActiveRow >= m_nRows )
00219                 nActiveRow = 0;
00220             SetActivePane( nActiveRow, nActiveCol );
00221         }
00222     }
00223
00224     // hide all nRow panes.
00225     for( int nCol = 0; nCol < m_nCols; ++nCol )
00226     {
00227         CWnd* pPaneHide = GetPane( nRowHide, nCol );
00228         ASSERT( pPaneHide != NULL );
00229
00230         pPaneHide->ShowWindow( SW_HIDE );
00231         pPaneHide->SetDlgCtrlID( AFX_IDW_PANE_FIRST+nCol + 16*m_nRows );
00232
00233         for( int nRow = nRowHide+1; nRow < m_nRows; ++nRow )
00234         {
00235             CWnd* pPane = GetPane( nRow, nCol );
00236             ASSERT( pPane != NULL );
00237
00238             pPane->SetDlgCtrlID( IdFromRowCol( nRow-1, nCol ));
00239         }
00240     }
00241
00242     m_nRows--;
00243     m_pRowInfo[m_nRows].nCurSize = m_pRowInfo[nRowHide].nCurSize;
00244     RecalcLayout();
00245 }
00246
00247 void CCJFlatSplitterWnd::ShowRow()
00248 {
00249     ASSERT_VALID( this );
00250     ASSERT( m_nRows < m_nMaxRows );
00251     ASSERT( m_nHiddenRow != -1 );
00252
00253     int nShowRow = m_nHiddenRow;
00254     m_nHiddenRow = -1;
00255
00256     int cyNew = m_pRowInfo[m_nRows].nCurSize;
00257     m_nRows++;  // add a nRow
00258
00259     ASSERT( m_nRows == m_nMaxRows );
00260
00261     int nRow;
00262
00263     // Show the hidden nRow
00264     for( int nCol = 0; nCol < m_nCols; ++nCol )
00265     {
00266         CWnd* pPaneShow = GetDlgItem( AFX_IDW_PANE_FIRST+nCol + 16*m_nRows );
00267         ASSERT( pPaneShow != NULL );
00268         pPaneShow->ShowWindow( SW_SHOWNA );
00269
00270         for( nRow = m_nRows - 2; nRow >= nShowRow; --nRow )
00271         {
00272             CWnd* pPane = GetPane( nRow, nCol );
00273             ASSERT( pPane != NULL );
00274             pPane->SetDlgCtrlID( IdFromRowCol( nRow + 1, nCol ));
00275         }
00276
00277         pPaneShow->SetDlgCtrlID( IdFromRowCol( nShowRow, nCol ));
00278     }
00279
00280     // new panes have been created -- recalculate layout
00281     for( nRow = nShowRow+1; nRow < m_nRows; nRow++ )
00282         m_pRowInfo[nRow].nIdealSize = m_pRowInfo[nRow - 1].nCurSize;
00283
00284     m_pRowInfo[nShowRow].nIdealSize = cyNew;
00285     RecalcLayout();
00286 }
00287
00288 void CCJFlatSplitterWnd::HideColumn(int nColHide)
00289 {
00290     ASSERT_VALID( this );
00291     ASSERT( m_nCols > 1 );
00292     ASSERT( nColHide < m_nCols );
00293     ASSERT( m_nHiddenCol == -1 );
00294     m_nHiddenCol = nColHide;
00295
00296     // if the column has an active window -- change it
00297     int nActiveRow, nActiveCol;
00298     if( GetActivePane( &nActiveRow, &nActiveCol ) != NULL )
00299     {
00300         if( nActiveCol == nColHide )
00301         {
00302             if( ++nActiveCol >= m_nCols )
00303                 nActiveCol = 0;
00304             SetActivePane( nActiveRow, nActiveCol );
00305         }
00306     }
00307
00308     // hide all column panes
00309     for( int nRow = 0; nRow < m_nRows; nRow++)
00310     {
00311         CWnd* pPaneHide = GetPane(nRow, nColHide);
00312         ASSERT( pPaneHide != NULL );
00313
00314         pPaneHide->ShowWindow(SW_HIDE);
00315         pPaneHide->SetDlgCtrlID( AFX_IDW_PANE_FIRST+m_nCols + 16*nRow );
00316
00317         for( int nCol = nColHide + 1; nCol < m_nCols; nCol++ )
00318         {
00319             CWnd* pPane = GetPane( nRow, nCol );
00320             ASSERT( pPane != NULL );
00321
00322             pPane->SetDlgCtrlID( IdFromRowCol( nRow, nCol - 1 ));
00323         }
00324     }
00325
00326     m_nCols--;
00327     m_pColInfo[m_nCols].nCurSize = m_pColInfo[nColHide].nCurSize;
00328     RecalcLayout();
00329 }
00330
00331 void CCJFlatSplitterWnd::ShowColumn()
00332 {
00333     ASSERT_VALID( this );
00334     ASSERT( m_nCols < m_nMaxCols );
00335     ASSERT( m_nHiddenCol != -1 );
00336
00337     int nShowCol = m_nHiddenCol;
00338     m_nHiddenCol = -1;
00339
00340     int cxNew = m_pColInfo[m_nCols].nCurSize;
00341     m_nCols++;  // add a column
00342
00343     ASSERT( m_nCols == m_nMaxCols );
00344
00345     int nCol;
00346
00347     // Show the hidden column
00348     for( int nRow = 0; nRow < m_nRows; ++nRow )
00349     {
00350         CWnd* pPaneShow = GetDlgItem( AFX_IDW_PANE_FIRST+m_nCols + 16*nRow );
00351         ASSERT( pPaneShow != NULL );
00352         pPaneShow->ShowWindow( SW_SHOWNA );
00353
00354         for( nCol = m_nCols - 2; nCol >= nShowCol; --nCol )
00355         {
00356             CWnd* pPane = GetPane( nRow, nCol );
00357             ASSERT( pPane != NULL );
00358             pPane->SetDlgCtrlID( IdFromRowCol( nRow, nCol + 1 ));
00359         }
00360
00361         pPaneShow->SetDlgCtrlID( IdFromRowCol( nRow, nShowCol ));
00362     }
00363
00364     // new panes have been created -- recalculate layout
00365     for( nCol = nShowCol+1; nCol < m_nCols; nCol++ )
00366         m_pColInfo[nCol].nIdealSize = m_pColInfo[nCol - 1].nCurSize;
00367
00368     m_pColInfo[nShowCol].nIdealSize = cxNew;
00369     RecalcLayout();
00370 }
00371
00372 BOOL CCJFlatSplitterWnd::ReplaceView(int nRow, int nCol, CRuntimeClass *pViewClass)
00373 {
00374     CView *pView = DYNAMIC_DOWNCAST( CView, GetPane( nRow, nCol ));
00375     ASSERT_KINDOF( CView, pView );
00376
00377     if( pView->IsKindOf( pViewClass ))
00378         return FALSE;
00379
00380     // Get pointer to CDocument object so that it can be used in the creation
00381     // process of the new view
00382     CDocument *pDoc = pView->GetDocument();
00383
00384     int nID = pView->GetDlgCtrlID();
00385     int nWidth, nHeight, nMinWidth, nMinHeight;
00386
00387     GetRowInfo( nRow, nWidth, nMinWidth );
00388     GetColumnInfo( nCol, nHeight, nMinHeight );
00389
00390     // Delete existing view
00391     DeleteView(nRow, nCol);
00392
00393     // Create new view
00394     CCreateContext context;
00395     context.m_pCurrentDoc = pDoc;
00396     CreateView( nRow, nCol, pViewClass, CSize( nWidth, nHeight ), &context );
00397     pView = DYNAMIC_DOWNCAST( CView, GetPane( nRow, nCol ));
00398     ASSERT_KINDOF( CView, pView );
00399
00400     pView->SetDlgCtrlID( nID );
00401
00402     SetRowInfo( nRow, nWidth, nMinWidth );
00403     SetColumnInfo( nCol, nHeight, nMinHeight );
00404     RecalcLayout();
00405
00406     return TRUE;
00407 }
00408
00409 BOOL CCJFlatSplitterWnd::SwitchView(int nRow, int nCol, CView *pNewView)
00410 {
00411     CView *pOldView = DYNAMIC_DOWNCAST( CView, GetPane( nRow, nCol ));
00412     ASSERT_KINDOF( CView, pOldView );
00413
00414     if( pOldView == pNewView )
00415         return FALSE;
00416
00417     int nOldID, nNewID;
00418
00419     nOldID = pOldView->GetDlgCtrlID();
00420     nNewID = pNewView->GetDlgCtrlID();
00421
00422     pOldView->ShowWindow(SW_HIDE);
00423     pNewView->ShowWindow(SW_SHOW);
00424
00425     pOldView->SetDlgCtrlID(nNewID);
00426     pNewView->SetDlgCtrlID(nOldID);
00427
00428     RecalcLayout();
00429
00430     return TRUE;
00431 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJFlatTabCtrl.cpp Source File

WinCvs/CJLib/CJLibrary/CJFlatTabCtrl.cpp

Go to the documentation of this file.
00001 // FlatTab.cpp : implementation file
00002 //
00003 // Copyright © 1999 Ian Brumby
00004 //
00005 // This source code may be used in compiled form in any way you desire.
00006 // Source file(s) may be redistributed unmodified by any means PROVIDING
00007 // they are not sold for profit without the authors expressed written consent,
00008 // and providing that this notice and the authors name and all copyright
00009 // notices remain intact.
00010 //
00011 // ==========================================================================
00012 // HISTORY:
00013 // ==========================================================================
00014 //          1.4     21 Jul 1999 - Initial release.
00015 //          1.5     30 Aug 1999 - Several enhancements by Phil Baxter
00016 //                  <Phil.Baxter@mrjinx.demon.co.uk>
00017 // ==========================================================================
00018
00019 // Excel uses FF_ROMAN and Font Height = ~(control's height - 4)
00020 // Excel draws its tabs right to left
00021 // Excel has 3DLIGHT highlighting on the left diagonal
00022 // Excel has home/end buttons
00023 // Excel's buttons change width as the control's height changes
00024 //
00026 /****************************************************************************
00027  *
00028  * $Date: 1999/11/30 21:45:49 $
00029  * $Revision: 1.1.1.3 $
00030  * $Archive: /CodeJock/CJLibrary/CJFlatTabCtrl.cpp $
00031  *
00032  * $History: CJFlatTabCtrl.cpp $
00033  *
00034  * *****************  Version 11  *****************
00035  * User: Kirk Stowell Date: 10/26/99   Time: 10:52p
00036  * Updated in $/CodeJock/CJLibrary
00037  * Fixed bug with flat tab where in some cases tabs were not completely
00038  * painted.
00039  *
00040  * *****************  Version 10  *****************
00041  * User: Kirk Stowell Date: 10/25/99   Time: 10:52p
00042  * Updated in $/CodeJock/CJLibrary
00043  * Modified resource include for static builds.
00044  *
00045  * *****************  Version 9  *****************
00046  * User: Kirk Stowell Date: 10/24/99   Time: 12:15a
00047  * Updated in $/CodeJock/CJLibrary
00048  * Fixed minor bug with tab font creation.
00049  *
00050  * *****************  Version 8  *****************
00051  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00052  * Updated in $/CodeJock/CJLibrary
00053  * Fixed potential resource and memory leak problems.
00054  *
00055  * *****************  Version 7  *****************
00056  * User: Kirk Stowell Date: 10/14/99   Time: 11:37p
00057  * Updated in $/CodeJock/CJLibrary
00058  * Fixed bug with flat tab control that would have kept one from disabling
00059  * the l/r arrow buttons, which caused an exception to be thrown. Thanks
00060  * to Ted Crow [crowtc@surge.net] for help with this.
00061  *
00062  * *****************  Version 6  *****************
00063  * User: Kirk Stowell Date: 10/14/99   Time: 12:25p
00064  * Updated in $/CodeJock/CJLibrary
00065  * Added source control history to file header.
00066  *
00067  ***************************************************************************/
00069
00070 #include "stdafx.h"
00071 #include "CJResource.h"
00072 #include "CJFlatTabCtrl.h"
00073
00074 #ifdef _DEBUG
00075 #define new DEBUG_NEW
00076 #undef THIS_FILE
00077 static char THIS_FILE[] = __FILE__;
00078 #endif
00079
00081 // CCJFlatTabCtrl
00082
00083 CCJFlatTabCtrl::CCJFlatTabCtrl()
00084 {
00085     m_bHasArrows          = false;
00086     m_bHasHomeEnd         = false;
00087     m_bTabsOnBottom       = false;
00088     m_iCurSel             = -1;
00089     m_pLeftButton         = NULL;
00090     m_pRightButton        = NULL;
00091     m_pHomeButton         = NULL;
00092     m_pEndButton          = NULL;
00093     m_hLeftArrow          = NULL;
00094     m_hLeftArrowDisabled  = NULL;
00095     m_hRightArrow         = NULL;
00096     m_hRightArrowDisabled = NULL;
00097     m_hHomeArrow          = NULL;
00098     m_hHomeArrowDisabled  = NULL;
00099     m_hEndArrow           = NULL;
00100     m_hEndArrowDisabled   = NULL;
00101     m_iXOffset            = 0;
00102 }
00103
00104 CCJFlatTabCtrl::~CCJFlatTabCtrl()
00105 {
00106     _delete(m_pLeftButton);
00107     _delete(m_pRightButton);
00108     _delete(m_pHomeButton);
00109     _delete(m_pEndButton);
00110
00111     // free HENHMETAFILE handles.
00112     if(m_hLeftArrow) {
00113         ::DeleteEnhMetaFile(m_hLeftArrow);
00114     }
00115     if(m_hLeftArrowDisabled) {
00116         ::DeleteEnhMetaFile(m_hLeftArrowDisabled);
00117     }
00118     if(m_hRightArrow) {
00119         ::DeleteEnhMetaFile(m_hRightArrow);
00120     }
00121     if(m_hRightArrowDisabled) {
00122         ::DeleteEnhMetaFile(m_hRightArrowDisabled);
00123     }
00124     if(m_hHomeArrow) {
00125         ::DeleteEnhMetaFile(m_hHomeArrow);
00126     }
00127     if(m_hHomeArrowDisabled) {
00128         ::DeleteEnhMetaFile(m_hHomeArrowDisabled);
00129     }
00130     if(m_hEndArrow) {
00131         ::DeleteEnhMetaFile(m_hEndArrow);
00132     }
00133     if(m_hEndArrowDisabled) {
00134         ::DeleteEnhMetaFile(m_hEndArrowDisabled);
00135     }
00136     while(!m_TabList.IsEmpty()) {
00137         CString* pItem = m_TabList.RemoveTail();
00138         _delete(pItem);
00139     }
00140     while(!m_TabTipList.IsEmpty()) {
00141         CString* pItem = m_TabTipList.RemoveTail();
00142         _delete(pItem);
00143     }
00144
00145     // fix potential resource leak - KStowell - 10-21-99
00146     m_Font.DeleteObject();
00147     m_BoldFont.DeleteObject();
00148 }
00149
00150 void CCJFlatTabCtrl::CreateTabFont(const int iTabHeight)
00151 {
00152     int iHeight = -(iTabHeight - 6);
00153
00154     m_Font.DeleteObject();
00155     m_Font.CreateFont(iHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
00156         OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, PROOF_QUALITY, FF_SWISS, NULL);
00157
00158     m_BoldFont.DeleteObject();
00159     m_BoldFont.CreateFont(iHeight, 0, 0, 0, FW_EXTRABOLD, FALSE, FALSE, FALSE, ANSI_CHARSET,
00160         OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, PROOF_QUALITY, FF_SWISS, NULL);
00161 }
00162
00163 int CCJFlatTabCtrl::GetTabWidth(const int nItem) const
00164 {
00165     CDC dc;
00166     dc.CreateCompatibleDC(NULL);
00167     CFont* pOldFont = dc.SelectObject((CFont*)&m_BoldFont);
00168     CSize size(dc.GetTextExtent(*m_TabList.GetAt(m_TabList.FindIndex(nItem))));
00169
00170     // fix potential resource leak - KStowell - 10-20-99.
00171     dc.SelectObject(pOldFont);
00172     dc.DeleteDC();
00173
00174     return size.cx + m_iClientHeight + (m_iClientHeight / 2);
00175 }
00176
00177 int CCJFlatTabCtrl::GetTotalTabWidth(void) const
00178 {
00179     int iWidth = 0;
00180     for (int i = 0; i < m_TabList.GetCount(); i++)
00181     {
00182         iWidth += GetTabWidth(i);
00183         if (i != m_TabList.GetCount()-1) {
00184             iWidth -= (m_iClientHeight / 2);
00185         }
00186     }
00187     return iWidth + 2;
00188 }
00189
00190 int CCJFlatTabCtrl::GetTotalArrowWidth(void) const
00191 {
00192     int iWidth = 1;
00193     if (m_bHasArrows)
00194         iWidth += 32;
00195     if (m_bHasHomeEnd)
00196         iWidth += 32;
00197     return iWidth;
00198 }
00199
00200 void CCJFlatTabCtrl::InvalidateTabs(void)
00201 {
00202     if (GetSafeHwnd())
00203     {
00204         // invalidate the visible tab area
00205         // to minimise flicker - don't erase the background
00206         CRect rcTabs;
00207
00208         rcTabs.left = GetTotalArrowWidth();
00209         rcTabs.top = 0;
00210         rcTabs.right = rcTabs.left + (m_iTotalTabWidth - m_iXOffset);
00211         rcTabs.bottom = m_iClientHeight;
00212         InvalidateRect(&rcTabs, false);
00213         // invalidate the blank area to the right of the tabs
00214         if (rcTabs.right < m_iClientWidth)
00215         {
00216             rcTabs.left = rcTabs.right;
00217             rcTabs.right = m_iClientWidth;
00218             InvalidateRect(&rcTabs, true);
00219         }
00220     }
00221 }
00222
00223 void CCJFlatTabCtrl::EnableButtons(void)
00224 {
00225     if (m_bHasArrows)  //TCC: ADDED to handle situations where ther are no arrows
00226     {
00227         m_pLeftButton->EnableWindow(m_iXOffset);
00228         if (m_iClientWidth + m_iXOffset < m_iTotalTabWidth + GetTotalArrowWidth() + 1)
00229             m_pRightButton->EnableWindow(true);
00230         else
00231             m_pRightButton->EnableWindow(false);
00232         if (m_bHasHomeEnd)
00233         {
00234             m_pHomeButton->EnableWindow(m_iXOffset);
00235             m_pEndButton->EnableWindow(m_pRightButton->IsWindowEnabled());
00236         }
00237     }
00238 }
00239
00240 int CCJFlatTabCtrl::DrawTab(CDC &dc, const int x, const int y, const int iHeight, bool bSelected, bool bBottom, LPCTSTR lpszTab) const
00241 {
00242     CFont* pOldFont = dc.SelectObject((CFont*)&m_BoldFont);
00243     CSize size(dc.GetTextExtent(lpszTab));
00244     CRect rcText;
00245     rcText.left = iHeight + x - 4;
00246     rcText.top = 2 + y;
00247     rcText.right = size.cx + iHeight + x - 4;
00248     rcText.bottom = size.cy + 2 + y;
00249
00250     int iHalf = iHeight / 2;
00251     int iWidth = iHeight + iHalf;
00252
00253     COLORREF crBack;
00254     COLORREF crFore;
00255     if (bSelected) {
00256         crBack = GetSysColor(COLOR_WINDOW);
00257         crFore = GetSysColor(COLOR_WINDOWTEXT);
00258     } else {
00259         crBack = GetSysColor(COLOR_3DFACE);
00260         crFore = GetSysColor(COLOR_BTNTEXT);
00261     }
00262
00263     CPen penOutline(PS_SOLID, 1, GetSysColor(COLOR_BTNTEXT));
00264     CPen penShadow(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
00265     CBrush brush;
00266     brush.CreateSolidBrush(crBack);
00267
00268     POINT points[4];
00269     points[0].x = x;                     points[0].y = iHeight + y - 1;
00270     points[1].x = iHalf + x;             points[1].y = y;
00271     points[2].x = size.cx + iHeight + x; points[2].y = y;
00272     points[3].x = size.cx + iWidth + x;  points[3].y = iHeight + y - 1;
00273
00274     if (bBottom) {
00275         // swap vertical coordinates
00276         points[0].y = points[1].y;
00277         points[2].y = points[3].y;
00278         points[1].y = points[2].y;
00279         points[3].y = points[0].y;
00280     }
00281
00282     CPen* pOldPen = dc.SelectObject(&penOutline);
00283     dc.SetBkColor(crBack);
00284     CBrush* pOldBrush = dc.SelectObject(&brush);
00285     dc.Polygon(points, 4);
00286     dc.SelectObject(bSelected ? (CFont*)&m_BoldFont : (CFont*)&m_Font);
00287     dc.SetTextColor(crFore);
00288     dc.DrawText(lpszTab, rcText, DT_CENTER);
00289     dc.SelectObject(&penShadow);
00290
00291     if (bSelected) {
00292         dc.MoveTo(iHalf + x + 1, points[1].y);
00293         dc.LineTo(size.cx + iHeight + x, points[1].y);
00294         CPen penBack(PS_SOLID, 1, crBack);
00295         dc.SelectObject(&penBack);
00296         dc.MoveTo(x + 1, points[0].y);
00297         dc.LineTo(size.cx + iWidth + x, points[0].y);
00298     } else {
00299         dc.MoveTo(iHalf + x + 1, points[1].y);
00300         dc.LineTo(size.cx + iHeight + x - 1, points[1].y);
00301         dc.LineTo(size.cx + iWidth + x - 1, points[0].y);
00302     }
00303
00304     // fix potential resource leak - KStowell - 10-21-99
00305     dc.SelectObject(pOldFont);
00306     dc.SelectObject(pOldPen);
00307     dc.SelectObject(pOldBrush);
00308     penOutline.DeleteObject();
00309     penShadow.DeleteObject();
00310     brush.DeleteObject();
00311
00312     return size.cx + iWidth;
00313 }
00314
00315 BOOL CCJFlatTabCtrl::InsertItem(const int nItem, LPCTSTR lpszItem)
00316 {
00317     if (nItem < 0 || nItem > m_TabList.GetCount())
00318         return -1;
00319
00320     // add tab to our list
00321     CString* pItem = new CString;
00322     ASSERT(pItem);
00323
00324     *pItem = lpszItem;
00325     m_TabList.AddTail(pItem);
00326
00327     // PGB - Add the tabs tip text to the list
00328
00329     CString* pTipItem = new CString;
00330     ASSERT(pTipItem);
00331
00332     *pTipItem = lpszItem;
00333     m_TabTipList.AddTail(pTipItem);
00334
00335     //
00336
00337     if (m_TabList.GetCount() == 1)
00338         m_iCurSel = 0;
00339
00340     m_iTotalTabWidth = GetTotalTabWidth();      // PGB - Recalculate the total tab width now we have added a new item
00341
00342     EnableButtons();
00343     InvalidateTabs();
00344
00345     return nItem;
00346 }
00347
00348 BOOL CCJFlatTabCtrl::DeleteItem(int nItem)
00349 {
00350     if (nItem < 0 || nItem >= m_TabList.GetCount())
00351         return FALSE;
00352
00353     POSITION pos = m_TabList.FindIndex(nItem);
00354     ASSERT(pos);
00355
00356     CString* pItem = m_TabList.GetAt(pos);
00357     m_TabList.RemoveAt(pos);
00358     _delete(pItem);
00359
00360     // PGB - Stole the following code from the OnLButtonDown() function
00361     // in order to cause the tab control to show the newly selected item
00362     // after deleting an item from the list
00363
00364     // warn parent that the selection is about to change
00365     int id = GetDlgCtrlID();
00366     NMHDR hdr;
00367     hdr.hwndFrom = m_hWnd;
00368     hdr.idFrom = id;
00369     hdr.code = TCN_SELCHANGING;
00370     if (GetParent()->SendMessage(WM_NOTIFY, id, (LPARAM)&hdr) == 0)
00371     {
00372         if (m_iCurSel >= m_TabList.GetCount())
00373         {
00374             SetCurSel(m_TabList.GetCount() - 1); // PGB - Reset the currently selected tab to the last one in the list
00375             InvalidateTabs();
00376         }
00377
00378         // notify parent that the selection has changed
00379         hdr.hwndFrom = m_hWnd;
00380         hdr.idFrom = id;
00381         hdr.code = TCN_SELCHANGE;
00382         GetParent()->SendMessage(WM_NOTIFY, id, (LPARAM)&hdr);
00383     }
00384
00385     m_iTotalTabWidth = GetTotalTabWidth();      // PGB - Recalculate the total tab width now we have deleted an item
00386
00387     EnableButtons();
00388     InvalidateTabs();
00389
00390     return TRUE;
00391 }
00392
00393 BOOL CCJFlatTabCtrl::DeleteAllItems()
00394 {
00395     while(!m_TabList.IsEmpty()) {
00396         CString* pItem = m_TabList.RemoveTail();
00397         _delete(pItem);
00398     }
00399
00400     while(!m_TabTipList.IsEmpty()) {
00401         CString* pItem = m_TabTipList.RemoveTail();
00402         _delete(pItem);
00403     }
00404
00405     m_iCurSel = -1;                             // PGB - Reset the currently selected tab to -1 as we have no tabs in our list now.
00406
00407     m_iTotalTabWidth = GetTotalTabWidth();      // PGB - Recalculate the total tab width now we have deleted all items
00408
00409     EnableButtons();
00410     InvalidateTabs();
00411
00412     return TRUE;
00413 }
00414
00415 BOOL CCJFlatTabCtrl::GetItemRect(int nItem, LPRECT lpRect)
00416 {
00417     if (nItem < 0 || nItem >= m_TabList.GetCount())
00418         return FALSE;
00419
00420     int x = GetTotalArrowWidth();
00421     for (int i = 0; i < nItem; i++)
00422     {
00423         x += GetTabWidth(i);
00424         if (i != m_TabList.GetCount())
00425             x -= (m_iClientHeight / 2) + 2;
00426     }
00427     lpRect->left = x - m_iXOffset;
00428     lpRect->top = 0;
00429     lpRect->right = lpRect->left + GetTabWidth(nItem);
00430     lpRect->bottom = m_iClientHeight;
00431     return TRUE;
00432 }
00433
00434 int CCJFlatTabCtrl::HitTest(TCHITTESTINFO *pHitTestInfo) const
00435 {
00436     // ignore hits on the buttons
00437     int iHitX = pHitTestInfo->pt.x;
00438     if (iHitX < GetTotalArrowWidth())
00439         return -1;
00440
00441     // check if any tabs were hit
00442     int x = GetTotalArrowWidth() - m_iXOffset;
00443     for (int i = 0; i < m_TabList.GetCount(); i++)
00444     {
00445         int iTabWidth = GetTabWidth(i);
00446         if (i != m_TabList.GetCount())
00447             iTabWidth -= (m_iClientHeight / 2) + 2;
00448         if ((x <= iHitX) && (iHitX <= x + iTabWidth))
00449             return i;
00450         x += iTabWidth;
00451     }
00452
00453     // hit point is right of rightmost tab
00454     return -1;
00455 }
00456
00457 int CCJFlatTabCtrl::SetCurSel(int nItem)
00458 {
00459     if (nItem < 0 || nItem >= m_TabList.GetCount())
00460         return -1;
00461
00462     int iPrevSel = m_iCurSel;
00463     m_iCurSel = nItem;
00464
00465     // test if we need to center on the selected tab
00466     CRect rcItem;
00467     if (GetItemRect(nItem, &rcItem))
00468     {
00469         // test if the tab is off on the left
00470         int iTotalArrowWidth = GetTotalArrowWidth();
00471         rcItem.left -= iTotalArrowWidth;
00472         if (rcItem.left < 0)
00473             m_iXOffset += rcItem.left;
00474         else
00475         {
00476             // test if the tab is off on the right
00477             rcItem.right -= iTotalArrowWidth;
00478             int iTabAreaWidth = m_iClientWidth - iTotalArrowWidth;
00479             if (rcItem.right > iTabAreaWidth)
00480                 m_iXOffset += (rcItem.right - iTabAreaWidth);
00481         }
00482     }
00483
00484     EnableButtons();
00485     InvalidateTabs();
00486
00487     return iPrevSel;
00488 }
00489
00490 BEGIN_MESSAGE_MAP(CCJFlatTabCtrl, CWnd)
00491     //{{AFX_MSG_MAP(CCJFlatTabCtrl)
00492     ON_WM_PAINT()
00493     ON_WM_LBUTTONDOWN()
00494     ON_WM_SIZE()
00495     ON_WM_CREATE()
00496     ON_BN_CLICKED(IDC_LEFTBUTTON, OnLeftArrow)
00497     ON_BN_CLICKED(IDC_RIGHTBUTTON, OnRightArrow)
00498     ON_BN_CLICKED(IDC_HOMEBUTTON, OnHomeArrow)
00499     ON_BN_CLICKED(IDC_ENDBUTTON, OnEndArrow)
00500     //}}AFX_MSG_MAP
00501 END_MESSAGE_MAP()
00502
00504 // CCJFlatTabCtrl message handlers
00505
00506 BOOL CCJFlatTabCtrl::PreCreateWindow(CREATESTRUCT& cs)
00507 {
00508     if (!CWnd::PreCreateWindow(cs))
00509         return FALSE;
00510
00511     cs.lpszClass = AfxRegisterWndClass(CS_DBLCLKS,
00512             ::LoadCursor(NULL, IDC_ARROW), NULL, NULL);
00513
00514     return TRUE;
00515 }
00516
00517 BOOL CCJFlatTabCtrl::PreTranslateMessage(MSG* pMsg)
00518 {
00519     ASSERT_VALID(this);
00520
00521     if (::IsWindow(m_ToolTip.m_hWnd))
00522                                                                                                                                                                                                                                                                                                                                                                                                                            {
00523         if(pMsg->message == WM_MOUSEMOVE && pMsg->hwnd == m_hWnd)
00524         {
00525             CPoint Point(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam));
00526
00527             TCHITTESTINFO test;
00528             test.pt = Point;
00529             int iTab = HitTest(&test);
00530
00531             if (iTab >= 0)
00532             {
00533                 CString strText;
00534
00535                 strText = (LPCTSTR) *m_TabTipList.GetAt(m_TabTipList.FindIndex(iTab));
00536
00537                 TRACE2("Mouse over tab %d : %s\n", iTab, strText);
00538
00539                 m_ToolTip.UpdateTipText(strText, this);
00540                 m_ToolTip.RelayEvent(pMsg);
00541             } else  {
00542                 // VC5 compatibility - Kirk Stowell - 10-21-99
00543                 ::SendMessage(m_ToolTip.m_hWnd, TTM_POP, 0, 0L);
00544             }
00545         }
00546         else {
00547             // VC5 compatibility - Kirk Stowell - 10-21-99
00548             ::SendMessage(m_ToolTip.m_hWnd, TTM_POP, 0, 0L);
00549         }
00550     }
00551
00552     return CWnd::PreTranslateMessage(pMsg);
00553 }
00554
00555 void CCJFlatTabCtrl::OnPaint()
00556 {
00557     CPaintDC dc(this); // device context for painting
00558
00559     CBrush brush;
00560     brush.CreateSysColorBrush(COLOR_3DFACE);
00561     CPen penBlack(PS_SOLID, 1, RGB(0,0,0));
00562
00563     // draw the black line along the left of the control
00564     CPen* pOldPen = dc.SelectObject(&penBlack);
00565     dc.MoveTo(0, 0);
00566     dc.LineTo(0, m_iClientHeight);
00567
00568     // draw the black line along the top/bottom of the control
00569     int iTotalArrowWidth = GetTotalArrowWidth();
00570     int iEndOfTab = iTotalArrowWidth + m_iTotalTabWidth - m_iXOffset;
00571     dc.MoveTo(iEndOfTab, m_bTabsOnBottom ? 0 : m_iClientHeight - 1);
00572     dc.LineTo(m_iClientWidth, m_bTabsOnBottom ? 0 : m_iClientHeight - 1);
00573
00574     // fill the empty background area
00575     int iFillHeight = m_iClientHeight - (m_bTabsOnBottom ? 0 : 1);
00576     CRect rcBack(iEndOfTab, m_bTabsOnBottom ? 1 : 0, m_iClientWidth, iFillHeight);
00577     dc.FillRect(rcBack, &brush);
00578
00579     // create a bitmap of all the tabs
00580     CDC dcMem;
00581     dcMem.CreateCompatibleDC(NULL);
00582     CBitmap bitmap;
00583     bitmap.CreateCompatibleBitmap(&dc, m_iTotalTabWidth, m_iClientHeight);
00584     CBitmap* pOldBitmap = dcMem.SelectObject(&bitmap);
00585     CBrush* pOldBrush = dcMem.SelectObject(&brush);
00586     CRect rc(0, m_bTabsOnBottom ? 1 : 0, m_iTotalTabWidth, iFillHeight);
00587     dcMem.FillRect(rc, &brush);
00588
00589     int iOverlap = (m_iClientHeight / 2) + 2;
00590     int x = 0;
00591     int iSelX = 0;
00592     for (int i = 0; i < m_TabList.GetCount(); i++)
00593     {
00594         if (i != m_iCurSel)
00595             x += DrawTab(dcMem, x, 0, m_iClientHeight, false, m_bTabsOnBottom, *m_TabList.GetAt(m_TabList.FindIndex(i))) - iOverlap;
00596         else
00597         {
00598             iSelX = x;
00599             x += GetTabWidth(i) - iOverlap;
00600         }
00601     }
00602     if (m_iCurSel >= 0)
00603         DrawTab(dcMem, iSelX, 0, m_iClientHeight, true, m_bTabsOnBottom, *m_TabList.GetAt(m_TabList.FindIndex(m_iCurSel)));
00604
00605     // blit the bitmap onto the control
00606     dc.BitBlt(iTotalArrowWidth, 0, m_iClientWidth - iTotalArrowWidth, m_iClientHeight, &dcMem, m_iXOffset, 0, SRCCOPY);
00607
00608     // fix potential resource leak - KStowell - 10-21-99.
00609     dcMem.SelectObject(pOldPen);
00610     dcMem.SelectObject(pOldBitmap);
00611     dcMem.SelectObject(pOldBrush);
00612     dcMem.DeleteDC();
00613     brush.DeleteObject();
00614     penBlack.DeleteObject();
00615     bitmap.DeleteObject();
00616 }
00617
00618 void CCJFlatTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)
00619 {
00620     // TODO: Add your message handler code here and/or call default
00621     TCHITTESTINFO test;
00622     test.pt = point;
00623     int iTab = HitTest(&test);
00624     if ((iTab != -1) && (iTab != m_iCurSel))
00625     {
00626         // warn parent that the selection is about to change
00627         int id = GetDlgCtrlID();
00628         NMHDR hdr;
00629         hdr.hwndFrom = m_hWnd;
00630         hdr.idFrom = id;
00631         hdr.code = TCN_SELCHANGING;
00632         if (GetParent()->SendMessage(WM_NOTIFY, id, (LPARAM)&hdr) == 0)
00633         {
00634             // parent has given permission for the selection to change
00635             SetCurSel(iTab);
00636             InvalidateTabs();
00637
00638             // notify parent that the selection has changed
00639             hdr.hwndFrom = m_hWnd;
00640             hdr.idFrom = id;
00641             hdr.code = TCN_SELCHANGE;
00642             GetParent()->SendMessage(WM_NOTIFY, id, (LPARAM)&hdr);
00643         }
00644     }
00645
00646     CWnd::OnLButtonDown(nFlags, point);
00647 }
00648
00649 void CCJFlatTabCtrl::OnSize(UINT nType, int cx, int cy)
00650 {
00651     CWnd::OnSize(nType, cx, cy);
00652
00653     // TODO: Add your message handler code here
00654     if (m_bHasHomeEnd) {
00655         m_pHomeButton->MoveWindow(1, 0, 16, cy);
00656         m_pLeftButton->MoveWindow(17, 0, 16, cy);
00657         m_pRightButton->MoveWindow(33, 0, 16, cy);
00658         m_pEndButton->MoveWindow(49, 0, 16, cy);
00659     } else {
00660         if (m_bHasArrows) { //TCC: ADDED to handle situations where ther are no arrows
00661             m_pLeftButton->MoveWindow(1, 0, 16, cy);
00662             m_pRightButton->MoveWindow(17, 0, 16, cy);
00663         }
00664     }
00665
00666     m_iClientWidth  = cx;
00667     m_iClientHeight = cy;
00668
00669     CreateTabFont(cy);
00670
00671     m_iTotalTabWidth = GetTotalTabWidth();
00672     EnableButtons();
00673 }
00674
00675 int CCJFlatTabCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
00676 {
00677     if (CWnd::OnCreate(lpCreateStruct) == -1)
00678         return -1;
00679
00680     // TODO: Add your specialized creation code here
00681     if (lpCreateStruct->style & FTS_BOTTOM) {
00682         m_bTabsOnBottom = true;
00683     }
00684
00685     if (lpCreateStruct->style & TCS_TOOLTIPS) {
00686         m_ToolTip.Create(this);
00687         m_ToolTip.Activate(TRUE);
00688         m_ToolTip.AddTool(this, _T("Flat Tab Tool Tip"));
00689         m_ToolTip.SendMessage(TTM_SETMAXTIPWIDTH, 0, SHRT_MAX); // Allow multiline tooltips
00690     }
00691
00692     if (lpCreateStruct->style & FTS_HASARROWS)
00693     {
00694         m_bHasArrows = true;
00695         POINT points[4];
00696         points[0].x = 100; points[0].y = 0;
00697         points[1].x = 0;   points[1].y = 50;
00698         points[2].x = 100; points[2].y = 100;
00699         points[3].x = 100; points[3].y = 0;
00700
00702         // This portion of the code was re-written to help eliminate a nasty resource
00703         // leak. It would seem that the CMetaFileDC was not freeing the GDI resources
00704         // completely whenever CMetaFileDC::CloseEnhanced() was called. This may be due
00705         // to a BUG in MFC or perhaps this class, in any event, this seems to resolve
00706         // the issue. - KStowell - 10-23-99.
00708         HPEN   hPen           = ::CreatePen( PS_SOLID, 1, RGB( 0,0,0 ));
00709         HPEN   hPenDisabled   = ::CreatePen( PS_SOLID, 1, RGB( 128,128,128 ));
00710         HBRUSH hBrush         = ::CreateSolidBrush( RGB( 0,0,0 ));
00711         HBRUSH hBrushDisabled = ::CreateSolidBrush( RGB( 128,128,128 ));;
00712
00713         // create left arrow metafile
00714         HDC hMetaDC      = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00715         HPEN hOldPen     = (HPEN)::SelectObject( hMetaDC, hPen );
00716         HBRUSH hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrush );
00717         ::Polygon( hMetaDC, points, 4 );
00718         ::SelectObject( hMetaDC, hOldPen );
00719         ::SelectObject( hMetaDC, hOldBrush );
00720         m_hLeftArrow = ::CloseEnhMetaFile( hMetaDC );
00721
00722         // create disabled left arrow metafile
00723         hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00724         hOldPen   = (HPEN)::SelectObject( hMetaDC, hPenDisabled );
00725         hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrushDisabled );
00726         ::Polygon( hMetaDC, points, 4 );
00727         ::SelectObject( hMetaDC, hOldPen );
00728         ::SelectObject( hMetaDC, hOldBrush );
00729         m_hLeftArrowDisabled = ::CloseEnhMetaFile( hMetaDC );
00730
00731         points[0].x = 0;   points[0].y = 0;
00732         points[1].x = 100; points[1].y = 50;
00733         points[2].x = 0;   points[2].y = 100;
00734         points[3].x = 0;   points[3].y = 0;
00735
00736         // create right arrow metafile
00737         hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00738         hOldPen   = (HPEN)::SelectObject( hMetaDC, hPen );
00739         hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrush );
00740         ::Polygon( hMetaDC, points, 4 );
00741         ::SelectObject( hMetaDC, hOldPen );
00742         ::SelectObject( hMetaDC, hOldBrush );
00743         m_hRightArrow = ::CloseEnhMetaFile( hMetaDC );
00744
00745         // create disabled right arrow metafile
00746         hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00747         hOldPen   = (HPEN)::SelectObject( hMetaDC, hPenDisabled );
00748         hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrushDisabled );
00749         ::Polygon( hMetaDC, points, 4 );
00750         ::SelectObject( hMetaDC, hOldPen );
00751         ::SelectObject( hMetaDC, hOldBrush );
00752         m_hRightArrowDisabled = ::CloseEnhMetaFile( hMetaDC );
00753
00754         CRect rcButton(0, 0, 16, 16);
00755         m_pLeftButton = new CCJMetaFileButton;
00756         m_pLeftButton->Create(NULL, WS_CHILD | WS_VISIBLE | WS_DISABLED | BS_OWNERDRAW, rcButton, this, IDC_LEFTBUTTON);
00757         m_pLeftButton->SetMetaFiles(m_hLeftArrow, 0, 0, m_hLeftArrowDisabled);
00758
00759         m_pRightButton = new CCJMetaFileButton;
00760         m_pRightButton->Create(NULL, WS_CHILD | WS_VISIBLE | WS_DISABLED | BS_OWNERDRAW, rcButton, this, IDC_RIGHTBUTTON);
00761         m_pRightButton->SetMetaFiles(m_hRightArrow, 0, 0, m_hRightArrowDisabled);
00762
00763         if (lpCreateStruct->style & FTS_HASHOMEEND)
00764         {
00765             m_bHasHomeEnd = true;
00766
00767             // Setup the Home arrow button
00768             points[0].x = 100;   points[0].y = 0;
00769             points[1].x = 0;     points[1].y = 50;
00770             points[2].x = 100;   points[2].y = 100;
00771             points[3].x = 100;   points[3].y = 0;
00772
00773             // create right arrow metafile
00774             HDC hMetaDC      = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00775             HPEN hOldPen     = (HPEN)::SelectObject( hMetaDC, hPen );
00776             HBRUSH hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrush );
00777             ::Polygon( hMetaDC, points, 4 );
00778             ::MoveToEx( hMetaDC, 0, 0, NULL );
00779             ::LineTo( hMetaDC, 0, 100 );
00780             ::SelectObject( hMetaDC, hOldPen );
00781             ::SelectObject( hMetaDC, hOldBrush );
00782             m_hHomeArrow = ::CloseEnhMetaFile( hMetaDC );
00783
00784             // create disabled right arrow metafile
00785             hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00786             hOldPen   = (HPEN)::SelectObject( hMetaDC, hPenDisabled );
00787             hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrushDisabled );
00788             ::Polygon( hMetaDC, points, 4 );
00789             ::MoveToEx( hMetaDC, 0, 0, NULL );
00790             ::LineTo( hMetaDC, 0, 100 );
00791             ::SelectObject( hMetaDC, hOldPen );
00792             ::SelectObject( hMetaDC, hOldBrush );
00793             m_hHomeArrowDisabled = ::CloseEnhMetaFile( hMetaDC );
00794
00795             m_pHomeButton = new CCJMetaFileButton;
00796             m_pHomeButton->Create(NULL, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, rcButton, this, IDC_HOMEBUTTON);
00797             m_pHomeButton->SetMetaFiles(m_hHomeArrow, 0, 0, m_hHomeArrowDisabled);
00798
00799             // Setup the End arrow button
00800             points[0].x = 0;   points[0].y = 0;
00801             points[1].x = 100; points[1].y = 50;
00802             points[2].x = 0;   points[2].y = 100;
00803             points[3].x = 0;   points[3].y = 0;
00804
00805             // create right arrow metafile
00806             hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00807             hOldPen   = (HPEN)::SelectObject( hMetaDC, hPen );
00808             hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrush );
00809             ::Polygon( hMetaDC, points, 4 );
00810             ::MoveToEx( hMetaDC, 100, 0, NULL );
00811             ::LineTo( hMetaDC, 100, 100 );
00812             ::SelectObject( hMetaDC, hOldPen );
00813             ::SelectObject( hMetaDC, hOldBrush );
00814             m_hEndArrow = ::CloseEnhMetaFile( hMetaDC );
00815
00816             // create disabled right arrow metafile
00817             hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00818             hOldPen   = (HPEN)::SelectObject( hMetaDC, hPenDisabled );
00819             hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrushDisabled );
00820             ::Polygon( hMetaDC, points, 4 );
00821             ::MoveToEx( hMetaDC, 100, 0, NULL );
00822             ::LineTo( hMetaDC, 100, 100 );
00823             ::SelectObject( hMetaDC, hOldPen );
00824             ::SelectObject( hMetaDC, hOldBrush );
00825             m_hEndArrowDisabled = ::CloseEnhMetaFile( hMetaDC );
00826
00827             m_pEndButton = new CCJMetaFileButton;
00828             m_pEndButton->Create(NULL, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, rcButton, this, IDC_ENDBUTTON);
00829             m_pEndButton->SetMetaFiles(m_hEndArrow, 0, 0, m_hEndArrowDisabled);
00830
00831             m_pHomeButton->MoveWindow(1, 0, 16, 16);
00832             m_pLeftButton->MoveWindow(17, 0, 16, 16);
00833             m_pRightButton->MoveWindow(33, 0, 16, 16);
00834             m_pEndButton->MoveWindow(49, 0, 16, 16);
00835
00836         } else {
00837             m_pLeftButton->MoveWindow(1, 0, 16, 16);
00838             m_pRightButton->MoveWindow(17, 0, 16, 16);
00839         }
00840
00841         // fix potential resource leak - KStowell - 10-23-99
00842         ::DeleteObject(hPen);
00843         ::DeleteObject(hPenDisabled);
00844         ::DeleteObject(hBrush);
00845         ::DeleteObject(hBrushDisabled);
00846     }
00847
00848     return 0;
00849 }
00850
00851 void CCJFlatTabCtrl::OnLeftArrow()
00852 {
00853     // Move the tabs right, ensuring that we move right by one
00854     // whole tab each time ala Microsoft Access
00855
00856     CPoint Point(GetTotalArrowWidth()+1, 1);
00857
00858     TCHITTESTINFO test;
00859     test.pt = Point;
00860     int iTab = HitTest(&test);
00861
00862     if (iTab != -1)
00863     {
00864         m_iXOffset = 0;
00865         for (int iLoop = 0; iLoop <= iTab - 1; iLoop++)
00866         {
00867             RECT rect;
00868             if (GetItemRect(iLoop, &rect))
00869             {
00870                 m_iXOffset += rect.left;
00871             }
00872         }
00873         m_iXOffset -= GetTotalArrowWidth();
00874
00875         EnableButtons();
00876         InvalidateTabs();
00877     }
00878 }
00879
00880 void CCJFlatTabCtrl::OnRightArrow()
00881 {
00882     // Move the tabs left, ensuring that we move left by one
00883     // whole tab each time ala Microsoft Access
00884
00885     CPoint Point(GetTotalArrowWidth()+1, 1);
00886
00887     TCHITTESTINFO test;
00888     test.pt = Point;
00889     int iTab = HitTest(&test);
00890
00891     if (iTab != -1)
00892     {
00893         m_iXOffset = 0;
00894         for (int iLoop = 0; iLoop <= iTab + 1; iLoop++)
00895         {
00896             RECT rect;
00897             if (GetItemRect(iLoop, &rect))
00898             {
00899                 m_iXOffset += rect.left;
00900             }
00901         }
00902         m_iXOffset -= GetTotalArrowWidth();
00903
00904         EnableButtons();
00905         InvalidateTabs();
00906     }
00907 }
00908
00909 void CCJFlatTabCtrl::OnHomeArrow()
00910 {
00911     // TODO: Add your control notification handler code here
00912     m_iXOffset = 0;
00913     EnableButtons();
00914     InvalidateTabs();
00915 }
00916
00917 void CCJFlatTabCtrl::OnEndArrow()
00918 {
00919     // TODO: Add your control notification handler code here
00920     m_iXOffset = m_iTotalTabWidth + GetTotalArrowWidth() - m_iClientWidth + 1;
00921     EnableButtons();
00922     InvalidateTabs();
00923 }
00924
00925 void CCJFlatTabCtrl::SetTipText(int nItem, LPCTSTR lpszTabTip)
00926 {
00927     if (nItem < m_TabList.GetCount())
00928     {
00929         for (int i = 0; i < m_TabList.GetCount(); i++)
00930         {
00931             if (i == nItem)
00932             {
00933                 CString *pTipItem = m_TabTipList.GetAt(m_TabTipList.FindIndex(nItem));
00934
00935                 *pTipItem = lpszTabTip;
00936
00937                 break;
00938             }
00939         }
00940     }
00941
00942     return;
00943 }
00944
00945 CString CCJFlatTabCtrl::GetTipText(int nItem)
00946 {
00947     CString strText;
00948
00949     if (nItem < m_TabList.GetCount())
00950     {
00951         for (int i = 0; i < m_TabList.GetCount(); i++)
00952         {
00953             if (i == nItem)
00954             {
00955                 strText = *m_TabTipList.GetAt(m_TabTipList.FindIndex(nItem));
00956                 break;
00957             }
00958         }
00959     }
00960
00961     return strText;
00962 }
00963
00964 void CCJFlatTabCtrl::Home()
00965 {
00966     OnHomeArrow();
00967 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJFontCombo.cpp Source File

WinCvs/CJLib/CJLibrary/CJFontCombo.cpp

Go to the documentation of this file.
00001
00002 // CJFontCombo.cpp : implementation file
00003 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00004 // See ReadMe.txt for TERMS OF USE.
00005 //
00006 // Based on the article 'Owner Drawn Font Selection ComboBox' by Girish Bharadwaj
00007 // http://www.codeguru.com/misc/font_selection_combo.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJock/CJLibrary/CJFontCombo.cpp $
00015  *
00016  * $History: CJFontCombo.cpp $
00017  *
00018  * *****************  Version 6  *****************
00019  * User: Kirk Stowell Date: 10/31/99   Time: 11:01p
00020  * Updated in $/CodeJock/CJLibrary
00021  * Overrode OnEraseBkgnd(...) and OnPaint() for flicker free drawing.
00022  *
00023  * *****************  Version 5  *****************
00024  * User: Kirk Stowell Date: 10/26/99   Time: 10:53p
00025  * Updated in $/CodeJock/CJLibrary
00026  * Added the DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC macros to CCJFontCombo
00027  * for access to run-time information.
00028  *
00029  * *****************  Version 4  *****************
00030  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00031  * Updated in $/CodeJockey/CJLibrary
00032  * Updated copyright and contact information.
00033  *
00034  * *****************  Version 3  *****************
00035  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00036  * Updated in $/CodeJockey/CJLibrary
00037  * Added Unicode compliance, thanks to Barry Burton for his help with
00038  * this.
00039  *
00040  *
00041  * *****************  Version 2  *****************
00042  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00043  * Updated in $/CodeJockey/CJLibrary
00044  *
00045  * *****************  Version 1  *****************
00046  * User: Kirk Stowell Date: 7/26/99    Time: 2:11p
00047  * Created in $/CodeJockey/CJLibrary
00048  *
00049  ***************************************************************************/
00051
00052 #include "stdafx.h"
00053 #include "CJFontCombo.h"
00054
00055 #ifdef _DEBUG
00056 #define new DEBUG_NEW
00057 #undef THIS_FILE
00058 static char THIS_FILE[] = __FILE__;
00059 #endif
00060
00062 // CCJFontCombo
00063
00064 CCJFontCombo::CCJFontCombo()
00065 {
00066      m_clrHilight       = ::GetSysColor(COLOR_HIGHLIGHT);
00067      m_clrNormalText    = ::GetSysColor(COLOR_WINDOWTEXT);
00068      m_clrHilightText   = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
00069      m_clrBkgnd         = ::GetSysColor(COLOR_WINDOW);
00070 }
00071
00072 CCJFontCombo::~CCJFontCombo()
00073 {
00074 }
00075
00076 IMPLEMENT_DYNAMIC(CCJFontCombo, CComboBox)
00077
00078 BEGIN_MESSAGE_MAP(CCJFontCombo, CComboBox)
00079     //{{AFX_MSG_MAP(CCJFontCombo)
00080     ON_WM_DESTROY()
00081     ON_WM_CREATE()
00082     ON_WM_ERASEBKGND()
00083     ON_WM_PAINT()
00084     //}}AFX_MSG_MAP
00085 END_MESSAGE_MAP()
00086
00088 // CCJFontCombo message handlers
00089
00090 void CCJFontCombo::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
00091 {
00092     CDC*      pDC      = CDC::FromHandle(lpDrawItemStruct->hDC);
00093     CRect     rect     = lpDrawItemStruct->rcItem;
00094     int       nState   = lpDrawItemStruct->itemState;
00095     int       nItem    = lpDrawItemStruct->itemID;
00096     LPLOGFONT pLogFont = (LPLOGFONT)lpDrawItemStruct->itemData;
00097
00098     pDC->SetBkMode( TRANSPARENT );
00099
00100     if( nState & ODS_SELECTED ) {
00101         pDC->FillSolidRect( rect, m_clrHilight );
00102         pDC->SetTextColor( m_clrHilightText );
00103     }
00104     else {
00105         pDC->FillSolidRect( rect, m_clrBkgnd );
00106         pDC->SetTextColor( m_clrNormalText );
00107     }
00108
00109     if( nItem >= 0 )
00110     {
00111         CString strText;
00112         GetLBText( nItem, strText );
00113
00114         CFont newFont;
00115         pLogFont->lfHeight = 90; //9 point size
00116         pLogFont->lfWidth  = 0;
00117         newFont.CreatePointFontIndirect( pLogFont );
00118
00119         CFont *pOldFont = pDC->SelectObject( &newFont );
00120         pDC->DrawText(strText, rect, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
00121         pDC->SelectObject( pOldFont );
00122         newFont.DeleteObject();
00123     }
00124 }
00125
00126 void CCJFontCombo::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
00127 {
00128     UNUSED_ALWAYS( lpMeasureItemStruct );
00129 }
00130
00131 void CCJFontCombo::InitializeFonts()
00132 {
00133     // Clear the combobox.
00134      ResetContent();
00135
00136      HDC hDC  = ::GetDC(m_hWnd);
00137      ::EnumFonts( hDC, NULL, (FONTENUMPROC)EnumFontProc, (LPARAM)this );//Enumerate
00138      ::ReleaseDC(m_hWnd, hDC);
00139 }
00140
00141 BOOL CALLBACK CCJFontCombo::EnumFontProc(LPLOGFONT lpLogFont, LPTEXTMETRIC lpTextMetric, short nFontType, LPHANDLE lpData)
00142 {
00143     UNUSED_ALWAYS( lpTextMetric );
00144
00145     if((nFontType == TRUETYPE_FONTTYPE) && (lpLogFont->lfCharSet != SYMBOL_CHARSET))
00146      {
00147          CCJFontCombo* pCombo = (CCJFontCombo*)lpData;
00148          ASSERT(pCombo);
00149
00150          int nIndex = pCombo->AddString(lpLogFont->lfFaceName);
00151          LPLOGFONT pLogFont = new LOGFONT;
00152
00153          ::CopyMemory((PVOID)pLogFont, (CONST VOID*)lpLogFont, (DWORD)sizeof( LOGFONT ));
00154          pCombo->SetItemData( nIndex, (DWORD)pLogFont );
00155      }
00156
00157      return TRUE;
00158 }
00159
00160 void CCJFontCombo::OnDestroy()
00161 {
00162     for( int nIndex = 0; nIndex <  GetCount(); ++nIndex ) {
00163         LPLOGFONT pLogFont = (LPLOGFONT)GetItemData(nIndex);
00164         _delete( pLogFont );
00165     }
00166
00167      CComboBox::OnDestroy();
00168 }
00169
00170 int CCJFontCombo::GetSelFont(LOGFONT& logFont)
00171 {
00172      int nIndex = GetCurSel ();
00173      if(nIndex != LB_ERR)
00174      {
00175         LPLOGFONT pLogFont = (LPLOGFONT)GetItemData(nIndex);
00176         ::CopyMemory((PVOID)&logFont, (CONST VOID*)pLogFont, sizeof(LOGFONT));
00177         return nIndex;
00178      }
00179
00180      return LB_ERR;
00181 }
00182
00183 int CCJFontCombo::OnCreate(LPCREATESTRUCT lpCreateStruct)
00184 {
00185     if (CComboBox::OnCreate(lpCreateStruct) == -1)
00186         return -1;
00187
00188     InitializeFonts();
00189     return 0;
00190 }
00191
00192 void CCJFontCombo::PreSubclassWindow()
00193 {
00194     CComboBox::PreSubclassWindow();
00195     InitializeFonts();
00196 }
00197
00198 BOOL CCJFontCombo::OnEraseBkgnd(CDC* pDC)
00199 {
00200     // KStowell - overridden for flicker-free drawing.
00201     UNUSED_ALWAYS(pDC);
00202     return TRUE;
00203 }
00204
00205 void CCJFontCombo::OnPaint()
00206 {
00207     CPaintDC dc(this); // device context for painting
00208
00209     // KStowell - Get the client rect.
00210     CRect rcClient, rcClip;
00211     dc.GetClipBox( &rcClip );
00212     GetClientRect( &rcClient );
00213
00214     // KStowell - Create a memory device-context. This is done to help reduce
00215     // screen flicker, since we will paint the entire control to the
00216     // off screen device context first.
00217     CDC memDC;
00218     CBitmap bitmap;
00219     memDC.CreateCompatibleDC(&dc);
00220     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00221     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00222
00223     // KStowell - Repaint the background.
00224     memDC.FillSolidRect(rcClient, ::GetSysColor(COLOR_WINDOW));
00225
00226     // let the control do its default drawing.
00227     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00228
00229     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00230     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00231         rcClip.left, rcClip.top, SRCCOPY );
00232
00233     // KStowell - Cleanup resources.
00234     memDC.SelectObject(pOldBitmap);
00235     memDC.DeleteDC();
00236     bitmap.DeleteObject();
00237 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJFrameWnd.cpp Source File

WinCvs/CJLib/CJLibrary/CJFrameWnd.cpp

Go to the documentation of this file.
00001 // CJFrameWnd.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJFrameWnd.cpp $
00011  *
00012  * $History: CJFrameWnd.cpp $
00013  *
00014  * *****************  Version 16  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:04p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Minor update to PreCreateWindow(...) for flicker free drawing.
00018  *
00019  * *****************  Version 15  *****************
00020  * User: Kirk Stowell Date: 10/29/99   Time: 12:43a
00021  * Updated in $/CodeJock/CJLibrary
00022  * Overloaded PreCreateWindow(...) for flicker free drawing.
00023  *
00024  * *****************  Version 14  *****************
00025  * User: Kirk Stowell Date: 10/14/99   Time: 6:15p
00026  * Updated in $/CodeJock/CJLibrary
00027  * Fixed bug with a document becomes the active document when the user
00028  * clicks inside a tab in the CCJTabControlBar to perform some operation.
00029  * When closing the application, MFC decides in CFrameWnd::OnClose() to
00030  * check if the 'active' document is modified before checking all other
00031  * documuents. If the active document is not modified and can close its
00032  * frame, it does not check other documents individually and shuts down
00033  * without asking the important 'modified save' questions. To fix this,
00034  * OnClose() was overriden to add a call to "SetActiveView(NULL)" just
00035  * before the base class OnClose is called. This will check all documents
00036  * asking the save question before closing the application. Thanks to
00037  * Simon Clark [spc@otleda.com] for help with this.
00038  *
00039  * *****************  Version 13  *****************
00040  * User: Kirk Stowell Date: 10/14/99   Time: 10:05a
00041  * Updated in $/CodeJock/CJLibrary
00042  * Overrode OnEraseBkgnd(...) to help to eliminate screen flicker.
00043  *
00044  * *****************  Version 12  *****************
00045  * User: Kirk Stowell Date: 9/16/99    Time: 2:35p
00046  * Updated in $/CodeJockey/CJLibrary
00047  * Fixed bug with save / restore bar state, and with saved bar size
00048  * changing whenever the application starts.
00049  *
00050  * *****************  Version 11  *****************
00051  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00052  * Updated in $/CodeJockey/CJLibrary
00053  * Updated copyright and contact information.
00054  *
00055  * *****************  Version 10  *****************
00056  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00057  * Updated in $/CodeJockey/CJLibrary
00058  *
00059  * *****************  Version 9  *****************
00060  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00061  * Updated in $/CodeJockey/CJLibrary
00062  *
00063  * *****************  Version 8  *****************
00064  * User: Kirk Stowell Date: 6/11/99    Time: 8:25p
00065  * Updated in $/CodeJockey/CJ60Lib
00066  * Slight modification made to popup menu code.
00067  *
00068  * *****************  Version 7  *****************
00069  * User: Kirk Stowell Date: 6/09/99    Time: 8:33p
00070  * Updated in $/CodeJockey/CJ60Lib
00071  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00072  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00073  * message handler, this is now automatically handled by the base class.
00074  * Added redraw flags to the create method and modified paint and layout
00075  * handlers to reduce flicker and un-necessary command handling. Dragging
00076  * rect now reflects actual control bar docked size. Added "flat" look to
00077  * the control bars, the control bars can now use the classic DevStudio
00078  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00079  * docking windows now handle dragging, docking and floating much better,
00080  * and behave more like DevStudio.
00081  *
00082  * *****************  Version 6  *****************
00083  * User: Kirk Stowell Date: 5/02/99    Time: 5:23p
00084  * Updated in $/CodeJockey/CJ60Lib
00085  * Further modifications for CCJMenu support.
00086  *
00087  * *****************  Version 5  *****************
00088  * User: Kirk Stowell Date: 5/02/99    Time: 2:18a
00089  * Updated in $/CodeJockey/CJ60Lib
00090  *
00091  * *****************  Version 4  *****************
00092  * User: Kirk Stowell Date: 5/02/99    Time: 2:13a
00093  * Updated in $/CodeJockey/CJ60Lib
00094  * Re-wrote CCJMenu initialization routines with a more cleaner approach.
00095  *
00096  * *****************  Version 3  *****************
00097  * User: Kirk Stowell Date: 4/03/99    Time: 4:47p
00098  * Updated in $/CodeJockey/CJ60Lib
00099  * Added comments and cleaned up code.  Added support for Brent Corkum's
00100  * BCMenu (CCJMenu), which is a replacement for the CCoolMenu class.
00101  *
00102  * *****************  Version 2  *****************
00103  * User: Kirk Stowell Date: 1/12/99    Time: 4:46p
00104  * Updated in $/CodeJockey/CJ60Lib
00105  * Total re-write to add side-by-side docking support for CCJControlBar
00106  * class.
00107  *
00108  * *****************  Version 1  *****************
00109  * User: Kirk Stowell Date: 10/17/98   Time: 4:46p
00110  * Created in $/CodeJockey/CJ60Lib
00111  * Initial re-write and release.
00112  *
00113  ***************************************************************************/
00115
00116 #include "stdafx.h"
00117 #include "CJFrameWnd.h"
00118 #include "CJDockBar.h"
00119 #include "CJSizeDockBar.h"
00120 #include "CJControlBar.h"
00121 #include "CJMiniDockFrameWnd.h"
00122 #include "CJToolBar.h"
00123
00124 #ifdef _DEBUG
00125 #define new DEBUG_NEW
00126 #undef THIS_FILE
00127 static char THIS_FILE[] = __FILE__;
00128 #endif
00129
00131 // CCJFrameWnd
00132
00133 CCJFrameWnd::CCJFrameWnd()
00134 {
00135
00136 }
00137
00138 CCJFrameWnd::~CCJFrameWnd()
00139 {
00140 }
00141
00142 IMPLEMENT_DYNCREATE(CCJFrameWnd, CFrameWnd)
00143
00144 BEGIN_MESSAGE_MAP(CCJFrameWnd, CFrameWnd)
00145     //{{AFX_MSG_MAP(CCJFrameWnd)
00146     ON_WM_MEASUREITEM()
00147     ON_WM_MENUCHAR()
00148     ON_WM_INITMENUPOPUP()
00149     ON_WM_CLOSE()
00150     //}}AFX_MSG_MAP
00151 END_MESSAGE_MAP()
00152
00154 // CCJFrameWnd message handlers
00155
00156 // dwDockBarMap
00157 DWORD CCJFrameWnd::dwDockBarMap[4][2] =
00158 {
00159     { AFX_IDW_DOCKBAR_TOP,      CBRS_TOP    },
00160     { AFX_IDW_DOCKBAR_BOTTOM,   CBRS_BOTTOM },
00161     { AFX_IDW_DOCKBAR_LEFT,     CBRS_LEFT   },
00162     { AFX_IDW_DOCKBAR_RIGHT,    CBRS_RIGHT  },
00163 };
00164
00165 void CCJFrameWnd::DockControlBarLeftOf(CControlBar* Bar, CControlBar* LeftOf)
00166 {
00167     CRect rect;
00168     DWORD dw;
00169     UINT n;
00170
00171     // get MFC to adjust the dimensions of all docked ToolBars
00172     // so that GetWindowRect will be accurate
00173     RecalcLayout(TRUE);
00174
00175     LeftOf->GetWindowRect(&rect);
00176     rect.OffsetRect(1,0);
00177     dw=LeftOf->GetBarStyle();
00178     n = 0;
00179     n = (dw&CBRS_ALIGN_TOP)              ? AFX_IDW_DOCKBAR_TOP      : n;
00180     n = (dw&CBRS_ALIGN_BOTTOM   && n==0) ? AFX_IDW_DOCKBAR_BOTTOM   : n;
00181     n = (dw&CBRS_ALIGN_LEFT     && n==0) ? AFX_IDW_DOCKBAR_LEFT     : n;
00182     n = (dw&CBRS_ALIGN_RIGHT    && n==0) ? AFX_IDW_DOCKBAR_RIGHT    : n;
00183
00184     // When we take the default parameters on rect, DockControlBar will dock
00185     // each Toolbar on a seperate line. By calculating a rectangle, we in effect
00186     // are simulating a Toolbar being dragged to that location and docked.
00187     DockControlBar(Bar,n,&rect);
00188 }
00189
00190 void CCJFrameWnd::EnableDocking(DWORD dwDockStyle)
00191 {
00192     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00193     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00194     CFrameWnd::EnableDocking(dwDockStyle);
00195
00196     for (int i = 0; i < 4; i++) {
00197         if (dwDockBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY) {
00198             CDockBar* pDock = (CDockBar*)GetControlBar(dwDockBarMap[i][0]);
00199
00200             // make sure the dock bar is of correct type
00201             if( pDock || !pDock->IsKindOf(RUNTIME_CLASS(CCJDockBar)) ) {
00202                 BOOL bNeedDelete = ! pDock->m_bAutoDelete;
00203                 pDock->m_pDockSite->RemoveControlBar(pDock);
00204                 pDock->m_pDockSite = 0; // avoid problems in destroying the dockbar
00205                 pDock->DestroyWindow();
00206                 if( bNeedDelete )
00207                     delete pDock;
00208                 pDock = 0;
00209             }
00210
00211             if( pDock == 0 ) {
00212                 pDock = new CCJDockBar;
00213                 if (!pDock->Create(this,
00214                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00215                     dwDockBarMap[i][1], dwDockBarMap[i][0])) {
00216                     AfxThrowResourceException();
00217                 }
00218             }
00219         }
00220     }
00221 }
00222
00223 void CCJFrameWnd::RecalcLayout(BOOL bNotify)
00224 {
00225     CFrameWnd::RecalcLayout(bNotify);
00226     RecalcAllExcept(NULL);
00227 }
00228
00229 // Yiannhs changed this
00230 void CCJFrameWnd::EnableDockingSizeBar(DWORD dwDockStyle, DockFlatBorders FlatFlags )
00231 {
00232     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00233     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00234
00235     m_pFloatingFrameClass = RUNTIME_CLASS(CCJMiniDockFrameWnd);
00236     for (int i = 0; i < 4; i++)
00237     {
00238         if (dwSizeBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY)
00239         {
00240             CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00241             if (pDock == NULL)
00242             {
00243                 pDock = new CCJSizeDockBar;
00244
00245                 if (!pDock->Create(this,
00246                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00247                         dwSizeBarMap[i][1], dwSizeBarMap[i][0]))
00248                 {
00249                     AfxThrowResourceException();
00250                 }
00251                 //Yiannhs enable Flat Borders For dock Bars
00252                 pDock->FlatBorder( (FlatFlags >> i) & 0x0001 );
00253             }
00254         }
00255     }
00256 }
00257
00258 void CCJFrameWnd::RecalcAllExcept(CCJSizeDockBar *pBar)
00259 {
00260     for (int i = 0; i < 4; i++)
00261     {
00262         CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00263         if (pDock != NULL && pDock != pBar)
00264         {
00265             pDock->CalcSizeBarLayout();
00266         }
00267     }
00268 }
00269
00270 void CCJFrameWnd::DockSizeBar(CControlBar * pBar,CCJSizeDockBar *pDockBar, LPRECT lpRect)
00271 {
00272     ASSERT(pBar != NULL);
00273     ASSERT(pBar->m_pDockContext != NULL);
00274
00275     if( pDockBar == NULL )
00276     {
00277         for (int i = 0; i < 4; i++)
00278         {
00279             if ((dwSizeBarMap[i][1] & CBRS_ALIGN_ANY) == (pBar->m_dwStyle & CBRS_ALIGN_ANY))
00280             {
00281                 pDockBar = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00282                 ASSERT(pDockBar != NULL);
00283
00284                 int nSize = 0;
00285
00286                 switch(i)
00287                 {
00288                 case 0: // horizontal dock
00289                 case 1:
00290                     nSize = ((CCJControlBar*)pBar)->GetHorzSize();
00291                     break;
00292                 case 2: // vertical dock
00293                 case 3:
00294                     nSize = ((CCJControlBar*)pBar)->GetVertSize();
00295                     break;
00296                 }
00297
00298                 pDockBar->SetActualSize( nSize );
00299                 break;
00300             }
00301         }
00302     }
00303
00304     ASSERT(pDockBar != NULL);
00305     ASSERT(m_listControlBars.Find(pBar) != NULL);
00306     ASSERT(pBar->m_pDockSite == this);
00307     ((CCJControlBar*)pBar)->Normalize();
00308     pDockBar->DockControlBar(pBar, lpRect);
00309 }
00310
00311 HMENU CCJFrameWnd::NewMenu(UINT nMenuID, UINT nToolbarID)
00312 {
00313     // Load the menu and toolbar resource.
00314     m_menu.LoadMenu(nMenuID);
00315     if (nToolbarID) {
00316         m_menu.LoadToolbar(nToolbarID);
00317     }
00318
00319     // Detach the menu.
00320     return(m_menu.Detach());
00321 }
00322
00323 HMENU CCJFrameWnd::NewMenu(UINT nMenuID, UINT* nToolbarIDs, int nSize)
00324 {
00325     // Load the menu and toolbar resources.
00326     m_menu.LoadMenu(nMenuID);
00327     if (nToolbarIDs) {
00328         m_menu.LoadToolbars(nToolbarIDs, nSize);
00329     }
00330
00331     // Detach the menu.
00332     return(m_menu.Detach());
00333 }
00334
00335 BOOL CCJFrameWnd::InitializeMenu(UINT nMenuID, UINT nToolBarID/*=NULL*/)
00336 {
00337     ASSERT(nMenuID);     // must be valid.
00338
00339     // Get a pointer to the existing menu, and destroy it.
00340     CMenu* pMenu = GetMenu();
00341     ASSERT_VALID(pMenu);
00342     pMenu->DestroyMenu();
00343
00344     // Set the default menu with the newly created Menu.
00345     m_hMenuDefault = NewMenu(nMenuID, nToolBarID);
00346     SetMenu(CMenu::FromHandle(m_hMenuDefault));
00347
00348     return TRUE;
00349 }
00350
00351 BOOL CCJFrameWnd::InitializeMenu(UINT nMenuID, UINT* nToolbarIDs/*=NULL*/, int nSize/*=NULL*/)
00352 {
00353     ASSERT(nMenuID);     // must be valid.
00354
00355     // Get a pointer to the existing menu, and destroy it.
00356     CMenu* pMenu = GetMenu();
00357     ASSERT_VALID(pMenu);
00358     pMenu->DestroyMenu();
00359
00360     // Set the default menu with the newly created Menu.
00361     m_hMenuDefault = NewMenu(nMenuID, nToolbarIDs, nSize);
00362     SetMenu(CMenu::FromHandle(m_hMenuDefault));
00363
00364     return TRUE;
00365 }
00366
00367 void CCJFrameWnd::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
00368 {
00369     if (lpMeasureItemStruct->CtlType == ODT_MENU)
00370     {
00371         if (IsMenu((HMENU)lpMeasureItemStruct->itemID)) {
00372             CMenu* pMenu = CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
00373
00374             if(m_menu.IsMenu(pMenu)) {
00375                 m_menu.MeasureItem(lpMeasureItemStruct);
00376                 return;
00377             }
00378         }
00379     }
00380
00381     CFrameWnd::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
00382 }
00383
00384 LRESULT CCJFrameWnd::OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu)
00385 {
00386     if(m_menu.IsMenu(pMenu)) {
00387         return CCJMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
00388     }
00389
00390     return CFrameWnd::OnMenuChar(nChar, nFlags, pMenu);
00391 }
00392
00393 void CCJFrameWnd::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
00394 {
00395     CFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
00396
00397     if(!bSysMenu)
00398     {
00399         if(m_menu.IsMenu(pPopupMenu)) {
00400             CCJMenu::UpdateMenu(pPopupMenu);
00401         }
00402     }
00403 }
00404
00405 BOOL CCJFrameWnd::PreTranslateMessage(MSG* pMsg)
00406 {
00407     if( m_wndMenuBar.GetSafeHwnd()) {
00408         if( m_wndMenuBar.TranslateFrameMessage(pMsg)) {
00409             return TRUE;
00410         }
00411     }
00412
00413     return CFrameWnd::PreTranslateMessage(pMsg);
00414 }
00415
00416 void CCJFrameWnd::LoadBarState(LPCTSTR lpszProfileName)
00417 {
00418     CCJSizeDockBar::m_bIsDockBar = true;
00419     CFrameWnd::LoadBarState(lpszProfileName);
00420     CCJSizeDockBar::m_bIsDockBar = false;
00421 }
00422
00423 void CCJFrameWnd::SaveBarState(LPCTSTR lpszProfileName) const
00424 {
00425     CCJSizeDockBar::m_bIsDockBar = true;
00426     CFrameWnd::SaveBarState(lpszProfileName);
00427     CCJSizeDockBar::m_bIsDockBar = false;
00428 }
00429
00430 void CCJFrameWnd::OnClose()
00431 {
00432     // Clear active view before close
00433     SetActiveView (NULL);
00434     CFrameWnd::OnClose();
00435 }
00436
00437 // Default implementation.
00438 BOOL CCJFrameWnd::PreCreateWindow(CREATESTRUCT& cs)
00439 {
00440     return CFrameWnd::PreCreateWindow(cs);
00441 }
00442
00444 // Overloaded for flicker-free drawing with no CS_VREDRAW and CS_HREDRAW.
00445 // Override in CMainFrame and call this method, rather than the default. Pass
00446 // in your apps icon resource usually IDR_MAINFRAME.
00447 //
00448 BOOL CCJFrameWnd::PreCreateWindow(CREATESTRUCT& cs, UINT nIconID)
00449 {
00450     // Register wnd class with no redraw, cursor (use default), background
00451     // brush and load your apps icon resource.
00452     cs.lpszClass = AfxRegisterWndClass( 0, NULL, NULL,
00453         AfxGetApp()->LoadIcon(nIconID));
00454     ASSERT(cs.lpszClass);
00455
00456     return CFrameWnd::PreCreateWindow(cs);
00457 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJHexEdit.cpp Source File

WinCvs/CJLib/CJLibrary/CJHexEdit.cpp

Go to the documentation of this file.
00001 // CJHexEdit.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the article "HexEdit Control" by Andreas Saurwein [saurwein@uniwares.com]
00006 // http://www.codeguru.com/editctrl/hexeditctrl.shtml
00007 //
00009 /****************************************************************************
00010  *
00011  * $Date: 1999/11/30 21:45:49 $
00012  * $Revision: 1.1.1.1 $
00013  * $Archive: /CodeJock/CJLibrary/CJHexEdit.cpp $
00014  *
00015  * $History: CJHexEdit.cpp $
00016  *
00017  * *****************  Version 2  *****************
00018  * User: Kirk Stowell Date: 10/30/99   Time: 9:50p
00019  * Updated in $/CodeJock/CJLibrary
00020  *
00021  * *****************  Version 1  *****************
00022  * User: Kirk Stowell Date: 10/30/99   Time: 9:20p
00023  * Created in $/CodeJock/CJLibrary
00024  *
00025  ***************************************************************************/
00027
00028 #include "StdAfx.h"
00029 #include "CJResource.h"
00030 #include "CJHexEdit.h"
00031 #include <ctype.h>
00032 #include <afxole.h>
00033 #include <afxdisp.h>
00034
00035 #ifdef _DEBUG
00036 #define new DEBUG_NEW
00037 #undef THIS_FILE
00038 static char THIS_FILE[] = __FILE__;
00039 #endif
00040
00041 char hextable[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
00042 #define TOHEX(a, b) {*b++ = hextable[a >> 4];*b++ = hextable[a&0xf];}
00043
00045 // CCJHexEdit
00046
00047 CCJHexEdit::CCJHexEdit()
00048 {
00049     m_pData         = NULL;     // pointer to data
00050     m_length        = 0;        // length of data
00051     m_length        = 0x40;
00052     m_topindex      = 0;
00053     m_bpr           = 8;        // byte per row
00054     m_lpp           = 1;
00055
00056     m_bShowHex      = TRUE;
00057     m_bShowAscii    = TRUE;
00058     m_bShowAddress  = TRUE;
00059     m_bAddressIsWide= TRUE;     // 4/8 byte address
00060
00061     m_offAddress    = 0;
00062     m_offHex        = 0;
00063     m_offAscii      = 0;
00064
00065     m_bUpdate = TRUE;           // update font info
00066     m_bNoAddressChange = FALSE;
00067     m_currentMode = EDIT_NONE;
00068
00069     m_editPos.x = m_editPos.y = 0;
00070     m_currentAddress = 0;
00071     m_bHalfPage = TRUE;
00072
00073     m_selStart  = 0xffffffff;
00074     m_selEnd    = 0xffffffff;
00075
00076     m_Font.CreateFont(-12, 0,0,0,0,0,0,0,0,0,0,0,0, _T("Courier New"));
00077
00078     AfxOleInit();
00079 }
00080
00081 CCJHexEdit::~CCJHexEdit()
00082 {
00083     m_Font.DeleteObject();
00084 }
00085
00086 IMPLEMENT_DYNAMIC(CCJHexEdit, CEdit)
00087
00088 BEGIN_MESSAGE_MAP(CCJHexEdit, CEdit)
00089     //{{AFX_MSG_MAP(CCJHexEdit)
00090     ON_WM_CHAR()
00091     ON_WM_KILLFOCUS()
00092     ON_WM_PAINT()
00093     ON_WM_SETFOCUS()
00094     ON_WM_VSCROLL()
00095     ON_WM_GETDLGCODE()
00096     ON_WM_ERASEBKGND()
00097     ON_WM_LBUTTONDOWN()
00098     ON_WM_MOUSEMOVE()
00099     ON_WM_LBUTTONUP()
00100     ON_WM_KEYDOWN()
00101     ON_COMMAND(ID_EDIT_CLEAR, OnEditClear)
00102     ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
00103     ON_COMMAND(ID_EDIT_CUT, OnEditCut)
00104     ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
00105     ON_COMMAND(ID_EDIT_SELECT_ALL, OnEditSelectAll)
00106     ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
00107     ON_WM_CONTEXTMENU()
00108     ON_WM_HSCROLL()
00109     ON_WM_LBUTTONDBLCLK()
00110     //}}AFX_MSG_MAP
00111 END_MESSAGE_MAP()
00112
00114 // CCJHexEdit message handlers
00115
00116 void CCJHexEdit::OnPaint()
00117 {
00118     CPaintDC dc(this); // device context for painting
00119
00120     // KStowell - Get the client rect.
00121     CRect rcClient;
00122     GetClientRect( &rcClient );
00123
00124     // KStowell - Create a memory device-context. This is done to help reduce
00125     // screen flicker, since we will paint the entire control to the
00126     // off screen device context first.
00127     CDC memDC;
00128     CBitmap bitmap;
00129     memDC.CreateCompatibleDC(&dc);
00130     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00131     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00132
00133     // KStowell - Repaint the background.
00134     memDC.FillSolidRect( rcClient, ::GetSysColor(COLOR_WINDOW) );
00135
00136     ASSERT(m_currentAddress >= 0);
00137     ASSERT(m_topindex >= 0);
00138
00139     CFont* pOldFont = memDC.SelectObject(&m_Font);
00140     int     height      = 0;
00141     int     x,y;
00142     TCHAR   buf[256];
00143
00144     x = rcClient.TopLeft().x;
00145     y = rcClient.TopLeft().y;
00146
00147     memDC.SetBoundsRect(&rcClient, DCB_DISABLE);
00148
00149     if(m_pData)
00150     {
00151         //
00152         // get char dimensions
00153         //
00154         if(m_bUpdate)
00155         {
00156             memDC.GetCharWidth('0', '0', &m_nullWidth);
00157             CSize sz = memDC.GetTextExtent(_T("0"), 1);
00158             m_lineHeight = sz.cy;
00159
00160             m_offHex    = m_bShowAddress ? (m_bAddressIsWide ? m_nullWidth * 9 : m_nullWidth * 5) : 0;
00161             m_offAscii  = m_bShowAddress ? (m_bAddressIsWide ? m_nullWidth * 9 : m_nullWidth * 5) : 0;
00162             m_offAscii += m_bShowHex     ? (m_bpr * 3 * m_nullWidth) : 0;
00163
00164             m_lpp = rcClient.Height() / m_lineHeight;
00165             m_bHalfPage = FALSE;
00166             if(m_lpp * m_bpr > m_length)
00167             {
00168                 m_lpp = (m_length + (m_bpr/2)) / m_bpr ;
00169                 if(m_length % m_bpr != 0)
00170                 {
00171                     m_bHalfPage = TRUE;
00172                     m_lpp++;
00173                 }
00174             }
00175             m_bUpdate = FALSE;
00176             UpdateScrollbars();
00177         }
00178
00179         height = rcClient.Height() / m_lineHeight;
00180         height *= m_lineHeight;
00181
00182         if(m_bShowAddress)
00183         {
00184             TCHAR fmt[8] = {'%','0','8','l','X'};
00185             fmt[2] = m_bAddressIsWide ? '8' : '4';
00186             int w = m_bAddressIsWide ? 8 : 4;
00187             y = 0;
00188             CRect rcd = rcClient;
00189             rcd.TopLeft().x = m_offAddress;
00190             for(int  i = m_topindex; (i < m_length) && (rcd.TopLeft().y < height); i+= m_bpr)
00191             {
00192                 _stprintf(buf, fmt, i);
00193                 memDC.DrawText(buf, w, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
00194                 rcd.TopLeft().y += m_lineHeight;
00195             }
00196         }
00197         if(m_bShowHex)
00198         {
00199             y = 0;
00200             CRect rcd = rcClient;
00201             rcd.TopLeft().x = x = m_offHex;
00202
00203             if(m_selStart != 0xffffffff && (m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW))
00204             {
00205                 int  i;
00206                 int  n = 0;
00207                 int  selStart = m_selStart, selEnd = m_selEnd;
00208                 if(selStart > selEnd)
00209                     selStart ^= selEnd ^= selStart ^= selEnd;
00210
00211                 for(i = m_topindex; (i < selStart) && (y < height); i++)
00212                 {
00213                     LPTSTR p = &buf[0];
00214
00215                     TOHEX(m_pData[i], p);
00216
00217                     *p++ = ' ';
00218                     memDC.TextOut(x, y, buf, 3);
00219                     x += m_nullWidth * 3;
00220                     n++;
00221                     if(n == m_bpr)
00222                     {
00223                         n = 0;
00224                         x = m_offHex;
00225                         y += m_lineHeight;
00226                     }
00227                 }
00228
00229                 memDC.SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
00230                 memDC.SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
00231                 for(; (i < selEnd) && (i < m_length) && (y < height); i++)
00232                 {
00233                     LPTSTR p = &buf[0];
00234
00235                     TOHEX(m_pData[i], p);
00236
00237                     *p++ = ' ';
00238                     memDC.TextOut(x, y, buf, 3);
00239                     x += m_nullWidth * 3;
00240                     n++;
00241                     if(n == m_bpr)
00242                     {
00243                         n = 0;
00244                         x = m_offHex;
00245                         y += m_lineHeight;
00246                     }
00247                 }
00248                 memDC.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
00249                 memDC.SetBkColor(GetSysColor(COLOR_WINDOW));
00250                 for(; (i < m_length) && (y < height); i++)
00251                 {
00252                     LPTSTR p = &buf[0];
00253
00254                     TOHEX(m_pData[i], p);
00255
00256                     *p++ = ' ';
00257                     memDC.TextOut(x, y, buf, 3);
00258                     x += m_nullWidth * 3;
00259                     n++;
00260                     if(n == m_bpr)
00261                     {
00262                         n = 0;
00263                         x = m_offHex;
00264                         y += m_lineHeight;
00265                     }
00266                 }
00267             }
00268             else
00269             {
00270                 for(int  i = m_topindex; (i < m_length) && (rcd.TopLeft().y < height);)
00271                 {
00272                     LPTSTR p = &buf[0];
00273
00274                     for(int  n = 0; (n < m_bpr) && (i < m_length); n++)
00275                     {
00276                         TOHEX(m_pData[i], p);
00277                         *p++ = ' ';
00278                         i++;
00279                     }
00280
00281                     while(n < m_bpr)
00282                     {
00283                         *p++ = ' '; *p++ = ' '; *p++ = ' ';
00284                         n++;
00285                     }
00286
00287                     memDC.DrawText(buf, m_bpr*3, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
00288                     rcd.TopLeft().y += m_lineHeight;
00289                 }
00290             }
00291         }
00292         if(m_bShowAscii)
00293         {
00294             y = 0;
00295             CRect rcd = rcClient;
00296             rcd.TopLeft().x = x = m_offAscii;
00297             if(m_selStart != 0xffffffff && m_currentMode == EDIT_ASCII)
00298             {
00299                 int  i;
00300                 int  n = 0;
00301                 int  selStart = m_selStart, selEnd = m_selEnd;
00302                 if(selStart > selEnd)
00303                     selStart ^= selEnd ^= selStart ^= selEnd;
00304
00305                 for(i = m_topindex; (i < selStart) && (y < height); i++)
00306                 {
00307                     buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
00308                     memDC.TextOut(x, y, buf, 1);
00309                     x += m_nullWidth;
00310                     n++;
00311                     if(n == m_bpr)
00312                     {
00313                         n = 0;
00314                         x = m_offAscii;
00315                         y += m_lineHeight;
00316                     }
00317                 }
00318                 memDC.SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
00319                 memDC.SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
00320                 for(; (i < selEnd) && (y < height); i++)
00321                 {
00322                     buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
00323                     memDC.TextOut(x, y, buf, 1);
00324                     x += m_nullWidth;
00325                     n++;
00326                     if(n == m_bpr)
00327                     {
00328                         n = 0;
00329                         x = m_offAscii;
00330                         y += m_lineHeight;
00331                     }
00332                 }
00333                 memDC.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
00334                 memDC.SetBkColor(GetSysColor(COLOR_WINDOW));
00335                 for(; (i < m_length) && y < height; i++)
00336                 {
00337                     buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
00338                     memDC.TextOut(x, y, buf, 1);
00339                     x += m_nullWidth;
00340                     n++;
00341                     if(n == m_bpr)
00342                     {
00343                         n = 0;
00344                         x = m_offAscii;
00345                         y += m_lineHeight;
00346                     }
00347                 }
00348             }
00349             else
00350             {
00351                 for(int  i = m_topindex; (i < m_length) && (rcd.TopLeft().y < height);)
00352                 {
00353                     LPTSTR p = &buf[0];
00354
00355                     for(int  n = 0; (n < m_bpr) && (i < m_length); n++)
00356                     {
00357                         *p++ = isprint(m_pData[i]) ? m_pData[i] : '.';
00358                         i++;
00359                     }
00360
00361                     memDC.DrawText(buf, n, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
00362                     rcd.TopLeft().y += m_lineHeight;
00363                 }
00364             }
00365         }
00366     }
00367
00368     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00369     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00370
00371     // KStowell - Cleanup resources.
00372     memDC.SelectObject(pOldBitmap);
00373     memDC.SelectObject(pOldFont);
00374     memDC.DeleteDC();
00375     bitmap.DeleteObject();
00376 }
00377
00378 void CCJHexEdit::OnSetFocus(CWnd* pOldWnd)
00379 {
00380     if(m_pData && !IsSelected())
00381     {
00382         if(m_editPos.x == 0 && m_bShowAddress)
00383             CreateAddressCaret();
00384         else
00385             CreateEditCaret();
00386         SetCaretPos(m_editPos);
00387         ShowCaret();
00388     }
00389     CWnd::OnSetFocus(pOldWnd);
00390 }
00391
00392 void CCJHexEdit::OnKillFocus(CWnd* pNewWnd)
00393 {
00394     DestroyCaret();
00395     CWnd::OnKillFocus(pNewWnd);
00396 }
00397
00398 void CCJHexEdit::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
00399 {
00400     UNUSED_ALWAYS(pScrollBar);
00401
00402     if(!m_pData) {
00403         return;
00404     }
00405
00406     int oa = m_topindex;
00407     switch(nSBCode)
00408     {
00409         case SB_LINEDOWN:
00410             if(m_topindex < m_length - m_lpp*m_bpr)
00411             {
00412                 m_topindex += m_bpr;
00413                 RedrawWindow();
00414             }
00415             break;
00416
00417         case SB_LINEUP:
00418             if(m_topindex > 0)
00419             {
00420                 m_topindex -= m_bpr;
00421                 RedrawWindow();
00422             }
00423             break;
00424
00425         case SB_PAGEDOWN:
00426             if(m_topindex < m_length - m_lpp*m_bpr)
00427             {
00428                 m_topindex += m_bpr * m_lpp;
00429                 if(m_topindex > m_length - m_lpp*m_bpr)
00430                     m_topindex = m_length - m_lpp*m_bpr;
00431                 RedrawWindow();
00432             }
00433             break;
00434
00435         case SB_PAGEUP:
00436             if(m_topindex > 0)
00437             {
00438                 m_topindex -= m_bpr * m_lpp;
00439                 if(m_topindex < 0)
00440                     m_topindex = 0;
00441                 RedrawWindow();
00442             }
00443             break;
00444
00445         case SB_THUMBTRACK:
00446             m_topindex = nPos * m_bpr;
00447             RedrawWindow();
00448             break;
00449     }
00450     ::SetScrollPos(this->m_hWnd, SB_VERT, m_topindex / m_bpr, TRUE);
00451     if(!m_bNoAddressChange)
00452         m_currentAddress += (m_topindex - oa);
00453     RepositionCaret(m_currentAddress);
00454 }
00455
00456 BOOL CCJHexEdit::PreCreateWindow(CREATESTRUCT& cs)
00457 {
00458     if(!CEdit::PreCreateWindow(cs)) {
00459         return FALSE;
00460     }
00461
00462     cs.style |= WS_HSCROLL|WS_VSCROLL;
00463     return TRUE;
00464 }
00465
00466 BOOL CCJHexEdit::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
00467 {
00468     if(!CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext)) {
00469         return FALSE;
00470     }
00471
00472     SetFont(&m_Font);
00473     return TRUE;
00474 }
00475
00476 BOOL CCJHexEdit::OnEraseBkgnd(CDC* pDC)
00477 {
00478     // KStowell - overridden for flicker-free drawing.
00479     UNUSED_ALWAYS(pDC);
00480     return TRUE;
00481 }
00482
00483 void CCJHexEdit::OnLButtonDown(UINT nFlags, CPoint point)
00484 {
00485     SetFocus();
00486     if(!m_pData)
00487         return;
00488
00489     if(nFlags & MK_SHIFT)
00490     {
00491         m_selStart = m_currentAddress;
00492     }
00493     CPoint pt = CalcPos(point.x, point.y);
00494     if(pt.x > -1)
00495     {
00496         m_editPos = pt;
00497         pt.x *= m_nullWidth;
00498         pt.y *= m_lineHeight;
00499
00500         if(pt.x == 0 && m_bShowAddress)
00501             CreateAddressCaret();
00502         else
00503             CreateEditCaret();
00504
00505         SetCaretPos(pt);
00506         if(nFlags & MK_SHIFT)
00507         {
00508             m_selEnd = m_currentAddress;
00509             if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
00510                 m_selEnd++;
00511             RedrawWindow();
00512         }
00513     }
00514     if(!(nFlags & MK_SHIFT))
00515     {
00516         if(DragDetect(this->m_hWnd, point))
00517         {
00518             m_selStart = m_currentAddress;
00519             m_selEnd   = m_selStart;
00520             SetCapture();
00521         }
00522         else
00523         {
00524             BOOL bsel = m_selStart != 0xffffffff;
00525
00526             m_selStart = 0xffffffff;
00527             m_selEnd   = 0xffffffff;
00528             if(bsel)
00529                 RedrawWindow();
00530         }
00531     }
00532     if(!IsSelected())
00533     {
00534         ShowCaret();
00535     }
00536 }
00537
00538 CPoint CCJHexEdit::CalcPos(int x, int y)
00539 {
00540     y /= m_lineHeight;
00541     if(y < 0 || y > m_lpp)
00542         return CPoint(-1, -1);
00543
00544     if(y * m_bpr > m_length)
00545         return CPoint(-1, -1);
00546
00547     x += m_nullWidth;
00548     x /= m_nullWidth;
00549
00550     int xp;
00551
00552     if(m_bShowAddress && x <= (m_bAddressIsWide ? 8 : 4))
00553     {
00554         m_currentAddress = m_topindex + (m_bpr * y);
00555         m_currentMode = EDIT_NONE;
00556         return CPoint(0, y);
00557     }
00558
00559     xp = (m_offHex  / m_nullWidth) + m_bpr * 3;
00560     if(m_bShowHex && x < xp)
00561     {
00562         if(x%3)
00563             x--;
00564         m_currentAddress = m_topindex + (m_bpr * y) + (x - (m_offHex  / m_nullWidth)) / 3;
00565         m_currentMode =  ((x%3) & 0x01) ? EDIT_LOW : EDIT_HIGH;
00566         return CPoint(x, y);
00567     }
00568
00569     xp = (m_offAscii  / m_nullWidth) + m_bpr;
00570     if(m_bShowAscii && x < xp)
00571     {
00572         m_currentAddress = m_topindex + (m_bpr * y) + (x - (m_offAscii  / m_nullWidth));
00573         m_currentMode = EDIT_ASCII;
00574         return CPoint(x, y);
00575     }
00576
00577     return CPoint(-1,-1);
00578 }
00579
00580 void CCJHexEdit::CreateAddressCaret()
00581 {
00582     DestroyCaret();
00583     CreateSolidCaret(m_nullWidth * (m_bAddressIsWide ? 8 : 4), m_lineHeight);
00584 }
00585
00586 void CCJHexEdit::CreateEditCaret()
00587 {
00588     DestroyCaret();
00589     CreateSolidCaret(m_nullWidth, m_lineHeight);
00590 }
00591
00592 void CCJHexEdit::OnMouseMove(UINT nFlags, CPoint point)
00593 {
00594     if(!m_pData) {
00595         return;
00596     }
00597
00598     if(nFlags & MK_LBUTTON && m_selStart != 0xffffffff)
00599     {
00600         CRect rc;
00601         GetClientRect(&rc);
00602         if(!rc.PtInRect(point))
00603         {
00604             if(point.y < 0)
00605             {
00606                 OnVScroll(SB_LINEUP, 0, NULL);
00607                 point.y = 0;
00608             }
00609             else if(point.y > rc.Height())
00610             {
00611                 OnVScroll(SB_LINEDOWN, 0, NULL);
00612                 point.y = rc.Height() -1;
00613             }
00614         }
00615
00616         //
00617         // we are selecting
00618         //
00619         int  seo = m_selEnd;
00620         CPoint pt = CalcPos(point.x, point.y);
00621         if(pt.x > -1)
00622         {
00623             m_selEnd = m_currentAddress;
00624             if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
00625                 m_selEnd++;
00626         }
00627         if(IsSelected())
00628             DestroyCaret();
00629
00630         if(seo != m_selEnd)
00631             RedrawWindow();
00632     }
00633 }
00634
00635 void CCJHexEdit::UpdateScrollbars()
00636 {
00637     SCROLLINFO si;
00638
00639     si.cbSize = sizeof(SCROLLINFO);
00640     si.fMask = SIF_ALL;
00641     si.nMin = 0;
00642     si.nMax = (m_length / m_bpr) - 1;
00643     si.nPage = m_lpp;
00644     si.nPos = m_topindex / m_bpr;
00645
00646     ::SetScrollInfo(this->m_hWnd, SB_VERT, &si, TRUE);
00647     if(si.nMax > (int)si.nPage)
00648         ::EnableScrollBar(this->m_hWnd, SB_VERT, ESB_ENABLE_BOTH);
00649
00650     CRect rc;
00651     GetClientRect(&rc);
00652
00653     si.nMin = 0;
00654     si.nMax =((m_bShowAddress ? (m_bAddressIsWide ? 8 : 4) : 0) +
00655               (m_bShowHex ? m_bpr * 3 : 0) +
00656               (m_bShowAscii ? m_bpr : 0) ) * m_nullWidth;
00657     si.nPage = 1;
00658     si.nPos = 0;
00659     ::SetScrollInfo(this->m_hWnd, SB_HORZ, &si, TRUE);
00660 }
00661
00662 void CCJHexEdit::OnLButtonUp(UINT nFlags, CPoint point)
00663 {
00664     if(IsSelected()) {
00665         ReleaseCapture();
00666     }
00667
00668     CWnd::OnLButtonUp(nFlags, point);
00669 }
00670
00671 void CCJHexEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
00672 {
00673     nFlags;nRepCnt;
00674     if(!m_pData)
00675         return;
00676     if(nChar == '\t')
00677         return;
00678     if(GetKeyState(VK_CONTROL) & 0x80000000)
00679     {
00680         switch(nChar)
00681         {
00682             case 0x03:
00683                 if(IsSelected())
00684                     OnEditCopy();
00685                 return;
00686             case 0x16:
00687                 OnEditPaste();
00688                 return;
00689             case 0x18:
00690                 if(IsSelected())
00691                     OnEditCut();
00692                 return;
00693             case 0x1a:
00694                 OnEditUndo();
00695                 return;
00696         }
00697     }
00698
00699     if(nChar == 0x08)
00700     {
00701         if(m_currentAddress > 0)
00702         {
00703             m_currentAddress--;
00704             SelDelete(m_currentAddress, m_currentAddress+1);
00705             RepositionCaret(m_currentAddress);
00706             RedrawWindow();
00707         }
00708         return;
00709     }
00710
00711     SetSel(-1, -1);
00712     switch(m_currentMode)
00713     {
00714         case EDIT_NONE:
00715             return;
00716         case EDIT_HIGH:
00717         case EDIT_LOW:
00718             if((nChar >= '0' && nChar <= '9') || (nChar >= 'a' && nChar <= 'f'))
00719             {
00720                 UINT b = nChar - '0';
00721                 if(b > 9)
00722                     b = 10 + nChar - 'a';
00723
00724                 if(m_currentMode == EDIT_HIGH)
00725                 {
00726                     m_pData[m_currentAddress] = (unsigned char)((m_pData[m_currentAddress] & 0x0f) | (b << 4));
00727                 }
00728                 else
00729                 {
00730                     m_pData[m_currentAddress] = (unsigned char)((m_pData[m_currentAddress] & 0xf0) | b);
00731                 }
00732                 Move(1,0);
00733             }
00734             break;
00735         case EDIT_ASCII:
00736             m_pData[m_currentAddress] = (unsigned char)nChar;
00737             Move(1,0);
00738             break;
00739     }
00740     RedrawWindow();
00741 }
00742
00743 void CCJHexEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
00744 {
00745     nFlags; nRepCnt;
00746
00747     BOOL bShift = GetKeyState(VK_SHIFT) & 0x80000000;
00748     BOOL bac = m_bNoAddressChange;
00749     m_bNoAddressChange = TRUE;
00750     switch(nChar)
00751     {
00752         case VK_DOWN:
00753             if(bShift)
00754             {
00755                 if(!IsSelected())
00756                 {
00757                     m_selStart = m_currentAddress;
00758                 }
00759                 Move(0,1);
00760                 m_selEnd   = m_currentAddress;
00761                 if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
00762                     m_selEnd++;
00763                 RedrawWindow();
00764                 break;
00765             }
00766             else
00767                 SetSel(-1, -1);
00768             Move(0,1);
00769             break;
00770         case VK_UP:
00771             if(bShift)
00772             {
00773                 if(!IsSelected())
00774                 {
00775                     m_selStart = m_currentAddress;
00776                 }
00777                 Move(0,-1);
00778                 m_selEnd   = m_currentAddress;
00779                 RedrawWindow();
00780                 break;
00781             }
00782             else
00783                 SetSel(-1, -1);
00784             Move(0,-1);
00785             break;
00786         case VK_LEFT:
00787             if(bShift)
00788             {
00789                 if(!IsSelected())
00790                 {
00791                     m_selStart = m_currentAddress;
00792                 }
00793                 Move(-1,0);
00794                 m_selEnd   = m_currentAddress;
00795                 RedrawWindow();
00796                 break;
00797             }
00798             else
00799                 SetSel(-1, -1);
00800             Move(-1,0);
00801             break;
00802         case VK_RIGHT:
00803             if(bShift)
00804             {
00805                 if(!IsSelected())
00806                 {
00807                     m_selStart = m_currentAddress;
00808                 }
00809                 Move(1,0);
00810                 m_selEnd   = m_currentAddress;
00811                 if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
00812                     m_selEnd++;
00813                 RedrawWindow();
00814                 break;
00815             }
00816             else
00817                 SetSel(-1, -1);
00818             Move(1,0);
00819             break;
00820         case VK_PRIOR:
00821             if(bShift)
00822             {
00823                 if(!IsSelected())
00824                 {
00825                     m_selStart = m_currentAddress;
00826                 }
00827                 OnVScroll(SB_PAGEUP, 0, NULL);
00828                 Move(0,0);
00829                 m_selEnd   = m_currentAddress;
00830                 RedrawWindow();
00831                 break;
00832             }
00833             else
00834                 SetSel(-1, -1);
00835             OnVScroll(SB_PAGEUP, 0, NULL);
00836             Move(0,0);
00837             break;
00838         case VK_NEXT:
00839             if(bShift)
00840             {
00841                 if(!IsSelected())
00842                 {
00843                     m_selStart = m_currentAddress;
00844                 }
00845                 OnVScroll(SB_PAGEDOWN, 0, NULL);
00846                 Move(0,0);
00847                 m_selEnd   = m_currentAddress;
00848                 RedrawWindow();
00849                 break;
00850             }
00851             else
00852                 SetSel(-1, -1);
00853             OnVScroll(SB_PAGEDOWN, 0, NULL);
00854             Move(0,0);
00855             break;
00856         case VK_HOME:
00857             if(bShift)
00858             {
00859                 if(!IsSelected())
00860                 {
00861                     m_selStart = m_currentAddress;
00862                 }
00863                 if(GetKeyState(VK_CONTROL) & 0x80000000)
00864                 {
00865                     OnVScroll(SB_THUMBTRACK, 0, NULL);
00866                     Move(0,0);
00867                 }
00868                 else
00869                 {
00870                     m_currentAddress /= m_bpr;
00871                     m_currentAddress *= m_bpr;
00872                     Move(0,0);
00873                 }
00874                 m_selEnd   = m_currentAddress;
00875                 RedrawWindow();
00876                 break;
00877             }
00878             else
00879                 SetSel(-1, -1);
00880             if(GetKeyState(VK_CONTROL) & 0x80000000)
00881             {
00882                 OnVScroll(SB_THUMBTRACK, 0, NULL);
00883                 m_currentAddress = 0;
00884                 Move(0,0);
00885             }
00886             else
00887             {
00888                 m_currentAddress /= m_bpr;
00889                 m_currentAddress *= m_bpr;
00890                 Move(0,0);
00891             }
00892             break;
00893         case VK_END:
00894             if(bShift)
00895             {
00896                 if(!IsSelected())
00897                 {
00898                     m_selStart = m_currentAddress;
00899                 }
00900                 if(GetKeyState(VK_CONTROL) & 0x80000000)
00901                 {
00902                     m_currentAddress = m_length-1;
00903                     OnVScroll(SB_THUMBTRACK, ((m_length+(m_bpr/2)) / m_bpr) - m_lpp, NULL);
00904                     Move(0,0);
00905                 }
00906                 else
00907                 {
00908                     m_currentAddress /= m_bpr;
00909                     m_currentAddress *= m_bpr;
00910                     m_currentAddress += m_bpr - 1;
00911                     if(m_currentAddress > m_length)
00912                         m_currentAddress = m_length-1;
00913                     Move(0,0);
00914                 }
00915                 m_selEnd   = m_currentAddress;
00916                 RedrawWindow();
00917                 break;
00918             }
00919             else
00920                 SetSel(-1, -1);
00921             if(GetKeyState(VK_CONTROL) & 0x80000000)
00922             {
00923                 m_currentAddress = m_length-1;
00924                 if(m_bHalfPage)
00925                     OnVScroll(SB_THUMBTRACK, 0, NULL);
00926                 else
00927                     OnVScroll(SB_THUMBTRACK, ((m_length+(m_bpr/2)) / m_bpr) - m_lpp, NULL);
00928                 Move(0,0);
00929             }
00930             else
00931             {
00932                 m_currentAddress /= m_bpr;
00933                 m_currentAddress *= m_bpr;
00934                 m_currentAddress += m_bpr - 1;
00935                 if(m_currentAddress > m_length)
00936                     m_currentAddress = m_length-1;
00937                 Move(0,0);
00938             }
00939             break;
00940         case VK_INSERT:
00941             SelInsert(m_currentAddress, max(1, m_selEnd-m_selStart));
00942             RedrawWindow();
00943             break;
00944         case VK_DELETE:
00945             if(IsSelected())
00946             {
00947                 OnEditClear();
00948             }
00949             else
00950             {
00951                 SelDelete(m_currentAddress, m_currentAddress+1);
00952                 RedrawWindow();
00953             }
00954             break;
00955         case '\t':
00956             switch(m_currentMode)
00957             {
00958                 case EDIT_NONE:
00959                     m_currentMode = EDIT_HIGH;
00960                     break;
00961                 case EDIT_HIGH:
00962                 case EDIT_LOW:
00963                     m_currentMode = EDIT_ASCII;
00964                     break;
00965                 case EDIT_ASCII:
00966                     m_currentMode = EDIT_HIGH;
00967                     break;
00968             }
00969             Move(0,0);
00970             break;
00971
00972     }
00973     m_bNoAddressChange = bac;
00974 }
00975
00976 void CCJHexEdit::Move(int x, int y)
00977 {
00978     switch(m_currentMode)
00979     {
00980         case EDIT_NONE:
00981             return;
00982         case EDIT_HIGH:
00983             if(x != 0)
00984                 m_currentMode = EDIT_LOW;
00985             if(x == -1)
00986                 m_currentAddress --;
00987             m_currentAddress += y* m_bpr;
00988             break;
00989         case EDIT_LOW:
00990             if(x != 0)
00991                 m_currentMode = EDIT_HIGH;
00992             if(x == 1)
00993                 m_currentAddress++;
00994             m_currentAddress += y* m_bpr;
00995             break;
00996         case EDIT_ASCII:
00997             {
00998                 m_currentAddress += x;
00999                 m_currentAddress += y*m_bpr;
01000             }
01001             break;
01002     }
01003     if(m_currentAddress < 0)
01004         m_currentAddress = 0;
01005
01006     if(m_currentAddress >= m_length)
01007     {
01008         m_currentAddress -= x;
01009         m_currentAddress -= y*m_bpr;
01010     }
01011     m_bNoAddressChange = TRUE;
01012     if(m_currentAddress < m_topindex)
01013     {
01014         OnVScroll(SB_LINEUP, 0, NULL);
01015     }
01016     if(m_currentAddress >= m_topindex + m_lpp*m_bpr)
01017     {
01018         OnVScroll(SB_LINEDOWN, 0, NULL);
01019     }
01020     m_bNoAddressChange = FALSE;
01021     //ScrollIntoView(m_currentAddress);
01022     RepositionCaret(m_currentAddress);
01023 }
01024
01025 void CCJHexEdit::SetSel(int s, int e)
01026 {
01027     DestroyCaret();
01028     m_selStart = s;
01029     m_selEnd = e;
01030     RedrawWindow();
01031     if(m_editPos.x == 0 && m_bShowAddress)
01032         CreateAddressCaret();
01033     else
01034         CreateEditCaret();
01035     SetCaretPos(m_editPos);
01036     ShowCaret();
01037 }
01038
01039 void CCJHexEdit::RepositionCaret(int     p)
01040 {
01041     int x, y;
01042
01043     y = (p - m_topindex) / m_bpr;
01044     x = (p - m_topindex) % m_bpr;
01045
01046     switch(m_currentMode)
01047     {
01048         case EDIT_NONE:
01049             CreateAddressCaret();
01050             x = 0;
01051             break;
01052         case EDIT_HIGH:
01053             CreateEditCaret();
01054             x *= m_nullWidth*3;
01055             x += m_offHex;
01056             break;
01057         case EDIT_LOW:
01058             CreateEditCaret();
01059             x *= m_nullWidth*3;
01060             x += m_nullWidth;
01061             x += m_offHex;
01062             break;
01063         case EDIT_ASCII:
01064             CreateEditCaret();
01065             x *= m_nullWidth;
01066             x += m_offAscii;
01067             break;
01068     }
01069     m_editPos.x = x;
01070     m_editPos.y = y*m_lineHeight;
01071     CRect rc;
01072     GetClientRect(&rc);
01073     if(rc.PtInRect(m_editPos))
01074     {
01075         SetCaretPos(m_editPos);
01076         ShowCaret();
01077     }
01078 }
01079
01080 void CCJHexEdit::ScrollIntoView(int p)
01081 {
01082     if(p < m_topindex || p > m_topindex + m_lpp*m_bpr)
01083     {
01084         m_topindex = (p/m_bpr) * m_bpr;
01085         m_topindex -= (m_lpp / 3) * m_bpr;
01086         if(m_topindex < 0)
01087             m_topindex = 0;
01088
01089         UpdateScrollbars();
01090         RedrawWindow();
01091     }
01092 }
01093
01094 void CCJHexEdit::OnContextMenu(CWnd*, CPoint point)
01095 {
01096     if (point.x == -1 && point.y == -1)
01097     {
01098         //keystroke invocation
01099         CRect rect;
01100         GetClientRect(rect);
01101         ClientToScreen(rect);
01102
01103         point = rect.TopLeft();
01104         point.Offset(5, 5);
01105     }
01106
01107     CMenu menu;
01108     VERIFY(menu.LoadMenu(IDR_POPUP_HEX_EDIT));
01109
01110     CMenu* pPopup = menu.GetSubMenu(0);
01111     ASSERT(pPopup != NULL);
01112
01113     pPopup->EnableMenuItem(ID_EDIT_UNDO, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
01114     if(!IsSelected())
01115     {
01116         pPopup->EnableMenuItem(ID_EDIT_CLEAR, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
01117         pPopup->EnableMenuItem(ID_EDIT_CUT, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
01118         pPopup->EnableMenuItem(ID_EDIT_COPY, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
01119     }
01120     {
01121         COleDataObject  obj;
01122         if (obj.AttachClipboard())
01123         {
01124             if(
01125                 !obj.IsDataAvailable(CF_TEXT) && !obj.IsDataAvailable((CLIPFORMAT)RegisterClipboardFormat( _T("BinaryData"))))
01126                 pPopup->EnableMenuItem(ID_EDIT_PASTE, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
01127         }
01128     }
01129
01130     pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
01131         this);
01132 }
01133
01134 void CCJHexEdit::OnEditClear()
01135 {
01136     m_currentAddress = m_selStart;
01137     SelDelete(m_selStart, m_selEnd);
01138     RepositionCaret(m_currentAddress);
01139     RedrawWindow();
01140 }
01141
01142 void CCJHexEdit::OnEditCopy()
01143 {
01144     COleDataSource*     pSource = new COleDataSource();
01145     EmptyClipboard();
01146     if(m_currentMode != EDIT_ASCII)
01147     {
01148         int         dwLen = (m_selEnd-m_selStart);
01149         HGLOBAL     hMemb = ::GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT, m_selEnd-m_selStart);
01150         HGLOBAL     hMema = ::GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT, (dwLen) * 3);
01151
01152         if (!hMema)
01153             return;
01154
01155         // copy binary
01156         LPBYTE  p = (BYTE*)::GlobalLock(hMemb);
01157         memcpy(p, m_pData+m_selStart, dwLen);
01158         ::GlobalUnlock(hMemb);
01159
01160         // copy ascii
01161         p = (BYTE*)::GlobalLock(hMema);
01162         for(int  i = 0; i < dwLen;)
01163         {
01164             TOHEX(m_pData[m_selStart+i], p);
01165             *p++ = ' ';
01166             i++;
01167         }
01168
01169         ::GlobalUnlock(hMema);
01170
01171         pSource->CacheGlobalData((CLIPFORMAT)RegisterClipboardFormat( _T("BinaryData")), hMemb);
01172         pSource->CacheGlobalData(CF_TEXT, hMema);
01173     }
01174     else
01175     {
01176         HGLOBAL             hMemb = ::GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT, m_selEnd-m_selStart);
01177         HGLOBAL             hMema = ::GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT, m_selEnd-m_selStart);
01178         if (!hMemb || !hMema)
01179             return;
01180
01181         // copy binary
01182         LPBYTE  p = (BYTE*)::GlobalLock(hMemb);
01183         int     dwLen = m_selEnd-m_selStart;
01184
01185         memcpy(p, m_pData+m_selStart, dwLen);
01186         ::GlobalUnlock(hMemb);
01187
01188         // copy ascii
01189         p = (BYTE*)::GlobalLock(hMema);
01190         memcpy(p, m_pData+m_selStart, dwLen);
01191         for(int i = 0; i < dwLen; p++, i++)
01192             if(!isprint(*p))
01193                 *p = '.';
01194         ::GlobalUnlock(hMema);
01195
01196         pSource->CacheGlobalData((CLIPFORMAT)RegisterClipboardFormat( _T("BinaryData")), hMemb);
01197         pSource->CacheGlobalData(CF_TEXT, hMema);
01198     }
01199     pSource->SetClipboard();
01200 }
01201
01202 void CCJHexEdit::OnEditCut()
01203 {
01204     OnEditCopy();
01205     SelDelete(m_selStart, m_selEnd);
01206     RedrawWindow();
01207 }
01208
01209 void CCJHexEdit::OnEditPaste()
01210 {
01211     COleDataObject  obj;
01212     if (obj.AttachClipboard())
01213     {
01214         HGLOBAL hmem = NULL;
01215         if (obj.IsDataAvailable((CLIPFORMAT)RegisterClipboardFormat( _T("BinaryData"))))
01216         {
01217             hmem = obj.GetGlobalData((CLIPFORMAT)RegisterClipboardFormat( _T("BinaryData")));
01218         }
01219         else if (obj.IsDataAvailable(CF_TEXT))
01220         {
01221             hmem = obj.GetGlobalData(CF_TEXT);
01222         }
01223         if(hmem)
01224         {
01225             LPBYTE  p = (BYTE*)::GlobalLock(hmem);
01226             DWORD   dwLen = ::GlobalSize(hmem);
01227             int     insert;
01228             int     oa = m_currentAddress;
01229
01230             NormalizeSel();
01231             if(m_selStart == 0xffffffff)
01232             {
01233                 if(m_currentMode == EDIT_LOW)
01234                     m_currentAddress++;
01235                 insert = m_currentAddress;
01236                 SelInsert(m_currentAddress, dwLen);
01237             }
01238             else
01239             {
01240                 insert = m_selStart;
01241                 SelDelete(m_selStart, m_selEnd);
01242                 SelInsert(insert, dwLen);
01243                 SetSel(-1, -1);
01244             }
01245
01246             memcpy(m_pData+insert, p, dwLen);
01247
01248             m_currentAddress = oa;
01249             RedrawWindow();
01250             ::GlobalUnlock(hmem);
01251         }
01252     }
01253 }
01254
01255 void CCJHexEdit::OnEditSelectAll()
01256 {
01257     m_selStart = 0;
01258     m_selEnd = m_length;
01259     DestroyCaret();
01260     RedrawWindow();
01261 }
01262
01263 void CCJHexEdit::OnEditUndo()
01264 {
01265     // TODO: Add your command handler code here
01266
01267 }
01268
01269 void CCJHexEdit::NormalizeSel()
01270 {
01271     if(m_selStart > m_selEnd)
01272         m_selStart ^= m_selEnd ^= m_selStart ^= m_selEnd;
01273 }
01274
01275 void CCJHexEdit::SelDelete(int s, int e)
01276 {
01277     LPBYTE p = (LPBYTE) malloc(m_length - (e-s)+1);
01278     memcpy(p, m_pData, s);
01279     if(s < m_length-(e-s))
01280         memcpy(p+s, m_pData+e, (m_length -e));
01281
01282     free(m_pData);
01283     SetSel(-1, -1);
01284     m_pData = p;
01285     m_length = m_length-(e-s);
01286     if(m_currentAddress > m_length)
01287     {
01288         m_currentAddress = m_length;
01289         RepositionCaret(m_currentAddress);
01290     }
01291     m_bUpdate = TRUE;
01292 }
01293
01294 void CCJHexEdit::SelInsert(int s, int l)
01295 {
01296     LPBYTE p = (LPBYTE) calloc(m_length + l, 1);
01297     memcpy(p, m_pData, s);
01298     memcpy(p+s+l, m_pData+s, (m_length-s));
01299     free(m_pData);
01300     SetSel(-1, -1);
01301     m_pData = p;
01302     m_length = m_length+l;
01303     m_bUpdate = TRUE;
01304 }
01305
01306 void CCJHexEdit::SetData(LPBYTE p, int len)
01307 {
01308     free(m_pData);
01309
01310     m_pData = (LPBYTE) malloc(len);
01311     memcpy(m_pData, p, len);
01312
01313     SetSel(-1, -1);
01314     m_length = len;
01315     m_currentAddress = 0;
01316     m_editPos.x = m_editPos.y = 0;
01317     m_currentMode = EDIT_HIGH;
01318     m_topindex = 0;
01319     m_bUpdate = TRUE;
01320 }
01321
01322 void CCJHexEdit::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
01323 {
01324     UNUSED_ALWAYS(nSBCode);
01325     UNUSED_ALWAYS(nPos);
01326     UNUSED_ALWAYS(pScrollBar);
01327 }
01328
01329 void CCJHexEdit::OnLButtonDblClk(UINT nFlags, CPoint point)
01330 {
01331     UNUSED_ALWAYS(nFlags);
01332     UNUSED_ALWAYS(point);
01333 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJHtmlView.cpp Source File

WinCvs/CJLib/CJLibrary/CJHtmlView.cpp

Go to the documentation of this file.
00001 // CJHtmlView.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Iuri Apollonio's article 'Doc / View -
00007 // Using HtmlView apart from Tecno Preview' http://www.codeguru.com/doc_view/htmlview.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJock/CJLibrary/CJHtmlView.cpp $
00015  *
00016  * $History: CJHtmlView.cpp $
00017  *
00018  * *****************  Version 8  *****************
00019  * User: Kirk Stowell Date: 10/14/99   Time: 10:05a
00020  * Updated in $/CodeJock/CJLibrary
00021  * Overrode OnEraseBkgnd(...) to help to eliminate screen flicker.
00022  *
00023  * *****************  Version 7  *****************
00024  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00025  * Updated in $/CodeJockey/CJLibrary
00026  * Updated copyright and contact information.
00027  *
00028  * *****************  Version 6  *****************
00029  * User: Kirk Stowell Date: 7/31/99    Time: 4:26p
00030  * Updated in $/CodeJockey/CJLibrary
00031  *
00032  * *****************  Version 4  *****************
00033  * User: Kirk Stowell Date: 7/25/99    Time: 1:29a
00034  * Updated in $/CodeJockey/CJLibrary
00035  *
00036  * *****************  Version 3  *****************
00037  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00038  * Updated in $/CodeJockey/CJLibrary
00039  *
00040  * *****************  Version 2  *****************
00041  * User: Kirk Stowell Date: 7/18/99    Time: 10:27p
00042  * Updated in $/CodeJockey/CJLibrary
00043  * Added vc5 compatibility.
00044  *
00045  * *****************  Version 1  *****************
00046  * User: Kirk Stowell Date: 7/14/99    Time: 10:29p
00047  * Created in $/CodeJockey/CJLibrary
00048  * Copied from MFC v6 and techno preview for v5. Added to extend
00049  * functionality to Visual C++ 5.0 users.
00050  *
00051  ***************************************************************************/
00053
00054 #include "StdAfx.h"
00055 #include "CJHtmlView.h"
00056
00057 #ifdef _DEBUG
00058 #define new DEBUG_NEW
00059 #undef THIS_FILE
00060 static char THIS_FILE[] = __FILE__;
00061 #endif
00062
00063 DWORD AFXAPI _AfxRelease(LPUNKNOWN* lplpUnknown)
00064 {
00065     ASSERT(lplpUnknown != NULL);
00066     if (*lplpUnknown != NULL)
00067     {
00068         DWORD dwRef = (*lplpUnknown)->Release();
00069         *lplpUnknown = NULL;
00070         return dwRef;
00071     }
00072     return 0;
00073 }
00074
00075 // helper for reliable and small Release calls
00076 DWORD AFXAPI _AfxRelease(LPUNKNOWN* plpUnknown);
00077 #ifndef _DEBUG
00078 // generate smaller code in release build
00079 #define RELEASE(lpUnk) _AfxRelease((LPUNKNOWN*)&lpUnk)
00080 #else
00081 // generate larger but typesafe code in debug build
00082 #define RELEASE(lpUnk) do \
00083     { if ((lpUnk) != NULL) { (lpUnk)->Release(); (lpUnk) = NULL; } } while (0)
00084 #endif
00085
00087 // CCJHtmlView
00088
00089 BEGIN_MESSAGE_MAP(CCJHtmlView, CFormView)
00090     //{{AFX_MSG_MAP(CCJHtmlView)
00091     ON_WM_SIZE()
00092     ON_WM_PAINT()
00093     ON_WM_DESTROY()
00094     ON_WM_ERASEBKGND()
00095     ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
00096     //}}AFX_MSG_MAP
00097 END_MESSAGE_MAP()
00098
00099 BEGIN_EVENTSINK_MAP(CCJHtmlView, CFormView)
00100     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 102 /* StatusTextChange */, OnStatusTextChange, VTS_BSTR)
00101     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 108 /* ProgressChange */, OnProgressChange, VTS_I4 VTS_I4)
00102     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 105 /* CommandStateChange */, OnCommandStateChange, VTS_I4 VTS_BOOL)
00103     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 106 /* DownloadBegin */, OnDownloadBegin, VTS_NONE)
00104     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 104 /* DownloadComplete */, OnDownloadComplete, VTS_NONE)
00105     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 113 /* TitleChange */, OnTitleChange, VTS_BSTR)
00106     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 252 /* NavigateComplete2 */, NavigateComplete2, VTS_DISPATCH VTS_PVARIANT)
00107     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 250 /* BeforeNavigate2 */, BeforeNavigate2, VTS_DISPATCH VTS_PVARIANT VTS_PVARIANT VTS_PVARIANT VTS_PVARIANT VTS_PVARIANT VTS_PBOOL)
00108     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 112 /* PropertyChange */, OnPropertyChange, VTS_BSTR)
00109     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 251 /* NewWindow2 */, OnNewWindow2, VTS_PDISPATCH VTS_PBOOL)
00110     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 259 /* DocumentComplete */, DocumentComplete, VTS_DISPATCH VTS_PVARIANT)
00111     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 253 /* OnQuit */, OnQuit, VTS_NONE)
00112     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 254 /* OnVisible */, OnVisible, VTS_BOOL)
00113     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 255 /* OnToolBar */, OnToolBar, VTS_BOOL)
00114     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 256 /* OnMenuBar */, OnMenuBar, VTS_BOOL)
00115     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 257 /* OnStatusBar */, OnStatusBar, VTS_BOOL)
00116     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 258 /* OnFullScreen */, OnFullScreen, VTS_BOOL)
00117     ON_EVENT(CCJHtmlView, AFX_IDW_PANE_FIRST, 260 /* OnTheaterMode */, OnTheaterMode, VTS_BOOL)
00118 END_EVENTSINK_MAP()
00119
00121 // CCJHtmlView construction/destruction
00122
00123 CCJHtmlView::CCJHtmlView()
00124     : CFormView((LPCTSTR) NULL)
00125 {
00126     m_pBrowserApp = NULL;
00127 }
00128
00129 CCJHtmlView::~CCJHtmlView()
00130 {
00131     if (m_pBrowserApp != NULL)
00132         m_pBrowserApp->Release();
00133 }
00134
00136 // CCJHtmlView drawing
00137
00138 void CCJHtmlView::OnDraw(CDC* /* pDC */)
00139 {
00140     // this class should never do its own drawing;
00141     // the browser control should handle everything
00142
00143     ASSERT(FALSE);
00144 }
00145
00147 // CCJHtmlView printing
00148
00149 void CCJHtmlView::OnFilePrint()
00150 {
00151     // get the HTMLDocument
00152
00153     if (m_pBrowserApp != NULL)
00154     {
00155         LPOLECOMMANDTARGET lpTarget = NULL;
00156         LPDISPATCH lpDisp = GetHtmlDocument();
00157
00158         if (lpDisp != NULL)
00159         {
00160             // the control will handle all printing UI
00161
00162             if (SUCCEEDED(lpDisp->QueryInterface(IID_IOleCommandTarget,
00163                     (LPVOID*) &lpTarget)))
00164             {
00165                 lpTarget->Exec(NULL, OLECMDID_PRINT, 0, NULL, NULL);
00166                 lpTarget->Release();
00167             }
00168             lpDisp->Release();
00169         }
00170     }
00171 }
00172
00174 // CCJHtmlView diagnostics
00175
00176 #ifdef _DEBUG
00177 void CCJHtmlView::AssertValid() const
00178 {
00179     CFormView::AssertValid();
00180 }
00181
00182 void CCJHtmlView::Dump(CDumpContext& dc) const
00183 {
00184     CFormView::Dump(dc);
00185 }
00186 #endif //_DEBUG
00187
00189 // CCJHtmlView message handlers
00190
00191 void CCJHtmlView::OnDestroy()
00192 {
00193     RELEASE(m_pBrowserApp);
00194 }
00195
00196 void CCJHtmlView::OnSize(UINT nType, int cx, int cy)
00197 {
00198     CFormView::OnSize(nType, cx, cy);
00199
00200     if (::IsWindow(m_wndBrowser.m_hWnd))
00201     {
00202         // need to push non-client borders out of the client area
00203         CRect rect;
00204         GetClientRect(rect);
00205         ::AdjustWindowRectEx(rect,
00206             m_wndBrowser.GetStyle(), FALSE, WS_EX_CLIENTEDGE);
00207         m_wndBrowser.SetWindowPos(NULL, rect.left, rect.top,
00208             rect.Width(), rect.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
00209     }
00210 }
00211
00212 void CCJHtmlView::OnPaint()
00213 {
00214     Default();
00215 }
00216
00218 // CCJHtmlView operations
00219
00220 BOOL CCJHtmlView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
00221                         DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
00222                         UINT nID, CCreateContext* pContext)
00223 {
00224     // create the view window itself
00225     m_pCreateContext = pContext;
00226     if (!CView::Create(lpszClassName, lpszWindowName,
00227                 dwStyle, rect, pParentWnd,  nID, pContext))
00228     {
00229         return FALSE;
00230     }
00231
00232     AfxEnableControlContainer();
00233
00234     RECT rectClient;
00235     GetClientRect(&rectClient);
00236
00237     // create the control window
00238     // AFX_IDW_PANE_FIRST is a safe but arbitrary ID
00239     if (!m_wndBrowser.CreateControl(CLSID_WebBrowser, lpszWindowName,
00240                 WS_VISIBLE | WS_CHILD, rectClient, this, AFX_IDW_PANE_FIRST))
00241     {
00242         DestroyWindow();
00243         return FALSE;
00244     }
00245
00246     LPUNKNOWN lpUnk = m_wndBrowser.GetControlUnknown();
00247     HRESULT hr = lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pBrowserApp);
00248     if (!SUCCEEDED(hr))
00249     {
00250         m_pBrowserApp = NULL;
00251         m_wndBrowser.DestroyWindow();
00252         DestroyWindow();
00253         return FALSE;
00254     }
00255
00256     return TRUE;
00257 }
00258
00260 // CCJHtmlView properties
00261
00262 CString CCJHtmlView::GetType() const
00263 {
00264     ASSERT(m_pBrowserApp != NULL);
00265
00266     BSTR bstr;
00267     m_pBrowserApp->get_Type(&bstr);
00268     CString retVal(bstr);
00269     return retVal;
00270 }
00271
00272 long CCJHtmlView::GetLeft() const
00273 {
00274     ASSERT(m_pBrowserApp != NULL);
00275
00276     long result;
00277     m_pBrowserApp->get_Left(&result);
00278     return result;
00279 }
00280
00281
00282 long CCJHtmlView::GetTop() const
00283 {
00284     ASSERT(m_pBrowserApp != NULL);
00285     long result;
00286     m_pBrowserApp->get_Top(&result);
00287     return result;
00288 }
00289
00290 int CCJHtmlView::GetToolBar() const
00291 {
00292     ASSERT(m_pBrowserApp != NULL);
00293     int result;
00294     m_pBrowserApp->get_ToolBar(&result);
00295     return result;
00296 }
00297
00298 long CCJHtmlView::GetHeight() const
00299 {
00300     ASSERT(m_pBrowserApp != NULL);
00301     long result;
00302     m_pBrowserApp->get_Height(&result);
00303     return result;
00304 }
00305
00306 BOOL CCJHtmlView::GetVisible() const
00307 {
00308     ASSERT(m_pBrowserApp != NULL);
00309
00310     VARIANT_BOOL result;
00311     m_pBrowserApp->get_Visible(&result);
00312     return result;
00313 }
00314
00315 CString CCJHtmlView::GetLocationName() const
00316 {
00317     ASSERT(m_pBrowserApp != NULL);
00318
00319     BSTR bstr;
00320     m_pBrowserApp->get_LocationName(&bstr);
00321     CString retVal(bstr);
00322     return retVal;
00323 }
00324
00325 CString CCJHtmlView::GetLocationURL() const
00326 {
00327     ASSERT(m_pBrowserApp != NULL);
00328
00329     BSTR bstr;
00330     m_pBrowserApp->get_LocationURL(&bstr);
00331     CString retVal(bstr);
00332     return retVal;
00333 }
00334
00335 BOOL CCJHtmlView::GetBusy() const
00336 {
00337     ASSERT(m_pBrowserApp != NULL);
00338
00339     VARIANT_BOOL result;
00340     m_pBrowserApp->get_Busy(&result);
00341     return result;
00342 }
00343
00344 READYSTATE CCJHtmlView::GetReadyState() const
00345 {
00346     ASSERT(m_pBrowserApp != NULL);
00347
00348     READYSTATE result;
00349     m_pBrowserApp->get_ReadyState(&result);
00350     return result;
00351 }
00352
00353 BOOL CCJHtmlView::GetOffline() const
00354 {
00355     ASSERT(m_pBrowserApp != NULL);
00356
00357     VARIANT_BOOL result;
00358     m_pBrowserApp->get_Offline(&result);
00359     return result;
00360 }
00361
00362 BOOL CCJHtmlView::GetSilent() const
00363 {
00364     ASSERT(m_pBrowserApp != NULL);
00365
00366     VARIANT_BOOL result;
00367     m_pBrowserApp->get_Silent(&result);
00368     return result;
00369 }
00370
00371 LPDISPATCH CCJHtmlView::GetApplication() const
00372 {
00373     ASSERT(m_pBrowserApp != NULL);
00374
00375     LPDISPATCH result;
00376     m_pBrowserApp->get_Application(&result);
00377     return result;
00378 }
00379
00380
00381 LPDISPATCH CCJHtmlView::GetParentBrowser() const
00382 {
00383     ASSERT(m_pBrowserApp != NULL);
00384
00385     LPDISPATCH result;
00386     m_pBrowserApp->get_Parent(&result);
00387     return result;
00388 }
00389
00390 LPDISPATCH CCJHtmlView::GetContainer() const
00391 {
00392     ASSERT(m_pBrowserApp != NULL);
00393
00394     LPDISPATCH result;
00395     m_pBrowserApp->get_Container(&result);
00396     return result;
00397 }
00398
00399 LPDISPATCH CCJHtmlView::GetHtmlDocument() const
00400 {
00401     ASSERT(m_pBrowserApp != NULL);
00402
00403     LPDISPATCH result;
00404     m_pBrowserApp->get_Document(&result);
00405     return result;
00406 }
00407
00408 BOOL CCJHtmlView::GetTopLevelContainer() const
00409 {
00410     ASSERT(m_pBrowserApp != NULL);
00411
00412     VARIANT_BOOL result;
00413     m_pBrowserApp->get_TopLevelContainer(&result);
00414     return result;
00415 }
00416
00417 BOOL CCJHtmlView::GetMenuBar() const
00418 {
00419     ASSERT(m_pBrowserApp != NULL);
00420
00421     VARIANT_BOOL result;
00422     m_pBrowserApp->get_MenuBar(&result);
00423     return result;
00424 }
00425
00426 BOOL CCJHtmlView::GetFullScreen() const
00427 {
00428     ASSERT(m_pBrowserApp != NULL);
00429
00430     VARIANT_BOOL result;
00431     m_pBrowserApp->get_FullScreen(&result);
00432     return result;
00433 }
00434
00435 BOOL CCJHtmlView::GetStatusBar() const
00436 {
00437     ASSERT(m_pBrowserApp != NULL);
00438
00439     VARIANT_BOOL result;
00440     m_pBrowserApp->get_StatusBar(&result);
00441     return result;
00442 }
00443
00444 OLECMDF CCJHtmlView::QueryStatusWB(OLECMDID cmdID) const
00445 {
00446     ASSERT(m_pBrowserApp != NULL);
00447
00448     OLECMDF result;
00449     m_pBrowserApp->QueryStatusWB(cmdID, &result);
00450     return result;
00451 }
00452
00453 void CCJHtmlView::ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt,
00454     VARIANT* pvaIn, VARIANT* pvaOut)
00455 {
00456     ASSERT(m_pBrowserApp != NULL);
00457
00458     m_pBrowserApp->ExecWB(cmdID, cmdexecopt, pvaIn, pvaOut);
00459 }
00460
00461 BOOL CCJHtmlView::GetRegisterAsBrowser() const
00462 {
00463     ASSERT(m_pBrowserApp != NULL);
00464
00465     VARIANT_BOOL result;
00466     m_pBrowserApp->get_RegisterAsBrowser(&result);
00467     return result;
00468 }
00469
00470 BOOL CCJHtmlView::GetRegisterAsDropTarget() const
00471 {
00472     ASSERT(m_pBrowserApp != NULL);
00473
00474     VARIANT_BOOL result;
00475     m_pBrowserApp->get_RegisterAsDropTarget(&result);
00476     return result;
00477 }
00478
00479 BOOL CCJHtmlView::GetTheaterMode() const
00480 {
00481     ASSERT(m_pBrowserApp != NULL);
00482
00483     VARIANT_BOOL result;
00484     m_pBrowserApp->get_TheaterMode(&result);
00485     return result;
00486 }
00487
00488 BOOL CCJHtmlView::GetAddressBar() const
00489 {
00490     ASSERT(m_pBrowserApp != NULL);
00491
00492     VARIANT_BOOL result;
00493     m_pBrowserApp->get_AddressBar(&result);
00494     return result;
00495 }
00496
00498 // CCJHtmlView operations
00499
00500 BOOL CCJHtmlView::LoadFromResource(LPCTSTR lpszResource)
00501 {
00502     HINSTANCE hInstance = AfxGetResourceHandle();
00503     ASSERT(hInstance != NULL);
00504
00505     CString strResourceURL;
00506     BOOL bRetVal = TRUE;
00507     LPTSTR lpszModule = new TCHAR[_MAX_PATH];
00508
00509     if (GetModuleFileName(hInstance, lpszModule, _MAX_PATH))
00510     {
00511         strResourceURL.Format(_T("res://%s/%s"), lpszModule, lpszResource);
00512         Navigate(strResourceURL, 0, 0, 0);
00513     }
00514     else
00515         bRetVal = FALSE;
00516
00517     delete [] lpszModule;
00518     return bRetVal;
00519 }
00520
00521 BOOL CCJHtmlView::LoadFromResource(UINT nRes)
00522 {
00523     HINSTANCE hInstance = AfxGetResourceHandle();
00524     ASSERT(hInstance != NULL);
00525
00526     CString strResourceURL;
00527     BOOL bRetVal = TRUE;
00528     LPTSTR lpszModule = new TCHAR[_MAX_PATH];
00529
00530     if (GetModuleFileName(hInstance, lpszModule, _MAX_PATH))
00531     {
00532         strResourceURL.Format(_T("res://%s/%d"), lpszModule, nRes);
00533         Navigate(strResourceURL, 0, 0, 0);
00534     }
00535     else
00536         bRetVal = FALSE;
00537
00538     delete [] lpszModule;
00539     return bRetVal;
00540 }
00541
00542 void CCJHtmlView::Navigate(LPCTSTR lpszURL, DWORD dwFlags /* = 0 */,
00543     LPCTSTR lpszTargetFrameName /* = NULL */ ,
00544     LPCTSTR lpszHeaders /* = NULL */, LPVOID lpvPostData /* = NULL */,
00545     DWORD dwPostDataLen /* = 0 */)
00546 {
00547     CString strURL(lpszURL);
00548     BSTR bstrURL = strURL.AllocSysString();
00549
00550     COleSafeArray vPostData;
00551     if (lpvPostData != NULL)
00552     {
00553         if (dwPostDataLen == 0)
00554             dwPostDataLen = lstrlen((LPCTSTR) lpvPostData);
00555
00556         vPostData.CreateOneDim(VT_UI1, dwPostDataLen, lpvPostData);
00557     }
00558
00559     m_pBrowserApp->Navigate(bstrURL,
00560         COleVariant((long) dwFlags, VT_I4),
00561         COleVariant(lpszTargetFrameName, VT_BSTR),
00562         vPostData,
00563         COleVariant(lpszHeaders, VT_BSTR));
00564 }
00565
00566 #ifdef _VC_VERSION_5
00567 void MakeOleVariant(COleVariant &ov, LPCITEMIDLIST pidl)
00568 {
00569     AfxVariantInit(&ov);
00570
00571     if (pidl != NULL)
00572     {
00573         // walk through entries in the list and accumulate their size
00574
00575         UINT cbTotal = 0;
00576         SAFEARRAY *psa = NULL;
00577         LPCITEMIDLIST pidlWalker = pidl;
00578
00579         while (pidlWalker->mkid.cb)
00580         {
00581             cbTotal += pidlWalker->mkid.cb;
00582             pidlWalker = (LPCITEMIDLIST)
00583                 (((LPBYTE)pidlWalker) + pidlWalker->mkid.cb);
00584         }
00585
00586         // add the base structure size
00587         cbTotal += sizeof(ITEMIDLIST);
00588
00589         // get a safe array for them
00590         psa = SafeArrayCreateVector(VT_UI1, 0, cbTotal);
00591
00592         // copy it and set members
00593         if (psa != NULL)
00594         {
00595             memcpy(psa->pvData, (LPBYTE) pidl, cbTotal);
00596             ov.vt = VT_ARRAY | VT_UI1;
00597             ov.parray = psa;
00598         }
00599     }
00600 }
00601 #endif
00602
00603 void CCJHtmlView::Navigate2(LPITEMIDLIST pIDL, DWORD dwFlags /* = 0 */,
00604     LPCTSTR lpszTargetFrameName /* = NULL */)
00605 {
00606     ASSERT(m_pBrowserApp != NULL);
00607
00608 #ifdef _VC_VERSION_5
00609     COleVariant vPIDL;
00610     MakeOleVariant(vPIDL, pIDL);
00611 #else
00612     COleVariant vPIDL(pIDL);
00613 #endif
00614     COleVariant empty;
00615
00616     m_pBrowserApp->Navigate2(vPIDL,
00617         COleVariant((long) dwFlags, VT_I4),
00618         COleVariant(lpszTargetFrameName, VT_BSTR),
00619         empty, empty);
00620 }
00621
00622 void CCJHtmlView::Navigate2(LPCTSTR lpszURL, DWORD dwFlags /* = 0 */,
00623     LPCTSTR lpszTargetFrameName /* = NULL */,
00624     LPCTSTR lpszHeaders /* = NULL */,
00625     LPVOID lpvPostData /* = NULL */, DWORD dwPostDataLen /* = 0 */)
00626 {
00627     ASSERT(m_pBrowserApp != NULL);
00628
00629     COleSafeArray vPostData;
00630     if (lpvPostData != NULL)
00631     {
00632         if (dwPostDataLen == 0)
00633             dwPostDataLen = lstrlen((LPCTSTR) lpvPostData);
00634
00635         vPostData.CreateOneDim(VT_UI1, dwPostDataLen, lpvPostData);
00636     }
00637
00638     COleVariant vURL(lpszURL, VT_BSTR);
00639     COleVariant vHeaders(lpszHeaders, VT_BSTR);
00640     COleVariant vTargetFrameName(lpszTargetFrameName, VT_BSTR);
00641     COleVariant vFlags((long) dwFlags, VT_I4);
00642
00643     m_pBrowserApp->Navigate2(vURL,
00644         vFlags, vTargetFrameName, vPostData, vHeaders);
00645 }
00646
00647 void CCJHtmlView::Navigate2(LPCTSTR lpszURL, DWORD dwFlags,
00648     CByteArray& baPostData, LPCTSTR lpszTargetFrameName /* = NULL */,
00649     LPCTSTR lpszHeaders /* = NULL */)
00650 {
00651     ASSERT(m_pBrowserApp != NULL);
00652
00653     COleVariant vPostData = baPostData;
00654     COleVariant vURL(lpszURL, VT_BSTR);
00655     COleVariant vHeaders(lpszHeaders, VT_BSTR);
00656     COleVariant vTargetFrameName(lpszTargetFrameName, VT_BSTR);
00657     COleVariant vFlags((long) dwFlags, VT_I4);
00658
00659     ASSERT(m_pBrowserApp != NULL);
00660
00661     m_pBrowserApp->Navigate2(vURL, vFlags, vTargetFrameName,
00662         vPostData, vHeaders);
00663 }
00664
00665 void CCJHtmlView::PutProperty(LPCTSTR lpszProperty, const VARIANT& vtValue)
00666 {
00667     ASSERT(m_pBrowserApp != NULL);
00668
00669     CString strProp(lpszProperty);
00670     BSTR bstrProp = strProp.AllocSysString();
00671     m_pBrowserApp->PutProperty(bstrProp, vtValue);
00672     ::SysFreeString(bstrProp);
00673 }
00674
00675 BOOL CCJHtmlView::GetProperty(LPCTSTR lpszProperty, CString& strValue)
00676 {
00677     ASSERT(m_pBrowserApp != NULL);
00678
00679     CString strProperty(lpszProperty);
00680     BSTR bstrProperty = strProperty.AllocSysString();
00681
00682     BOOL bResult = FALSE;
00683     VARIANT vReturn;
00684     vReturn.vt = VT_BSTR;
00685     vReturn.bstrVal = NULL;
00686     HRESULT hr = m_pBrowserApp->GetProperty(bstrProperty, &vReturn);
00687
00688     if (SUCCEEDED(hr))
00689     {
00690         strValue = CString(vReturn.bstrVal);
00691         bResult = TRUE;
00692     }
00693
00694     ::SysFreeString(bstrProperty);
00695     return bResult;
00696 }
00697
00698 COleVariant CCJHtmlView::GetProperty(LPCTSTR lpszProperty)
00699 {
00700     COleVariant result;
00701
00702     static BYTE parms[] =
00703         VTS_BSTR;
00704     m_wndBrowser.InvokeHelper(0x12f, DISPATCH_METHOD,
00705         VT_VARIANT, (void*)&result, parms, lpszProperty);
00706
00707     return result;
00708 }
00709
00710 CString CCJHtmlView::GetFullName() const
00711 {
00712     ASSERT(m_pBrowserApp != NULL);
00713
00714     BSTR bstr;
00715     m_pBrowserApp->get_FullName(&bstr);
00716     CString retVal(bstr);
00717     return retVal;
00718 }
00719
00721 // CCJHtmlView event reflectors
00722
00723 void CCJHtmlView::NavigateComplete2(LPDISPATCH /* pDisp */, VARIANT* URL)
00724 {
00725     ASSERT(V_VT(URL) == VT_BSTR);
00726
00727     USES_CONVERSION;
00728
00729     CString str = OLE2T(V_BSTR(URL));
00730     OnNavigateComplete2(str);
00731 }
00732
00733 void CCJHtmlView::BeforeNavigate2(LPDISPATCH /* pDisp */, VARIANT* URL,
00734         VARIANT* Flags, VARIANT* TargetFrameName,
00735         VARIANT* PostData, VARIANT* Headers, BOOL* Cancel)
00736 {
00737     ASSERT(V_VT(URL) == VT_BSTR);
00738     ASSERT(V_VT(TargetFrameName) == VT_BSTR);
00739     ASSERT(V_VT(PostData) == (VT_VARIANT | VT_BYREF));
00740     ASSERT(V_VT(Headers) == VT_BSTR);
00741     ASSERT(Cancel != NULL);
00742
00743     USES_CONVERSION;
00744
00745     VARIANT* vtPostedData = V_VARIANTREF(PostData);
00746     CByteArray array;
00747     if (V_VT(vtPostedData) & VT_ARRAY)
00748     {
00749         // must be a vector of bytes
00750         ASSERT(vtPostedData->parray->cDims == 1 && vtPostedData->parray->cbElements == 1);
00751
00752         vtPostedData->vt |= VT_UI1;
00753         COleSafeArray safe(vtPostedData);
00754
00755         DWORD dwSize = safe.GetOneDimSize();
00756         LPVOID pVoid;
00757         safe.AccessData(&pVoid);
00758
00759         array.SetSize(dwSize);
00760         LPBYTE lpByte = array.GetData();
00761
00762         memcpy(lpByte, pVoid, dwSize);
00763         safe.UnaccessData();
00764     }
00765     // make real parameters out of the notification
00766
00767     CString strTargetFrameName(V_BSTR(TargetFrameName));
00768     CString strURL = V_BSTR(URL);
00769     CString strHeaders = V_BSTR(Headers);
00770     DWORD nFlags = V_I4(Flags);
00771
00772     // notify the user's class
00773     OnBeforeNavigate2(strURL, nFlags, strTargetFrameName,
00774         array, strHeaders, Cancel);
00775 }
00776
00777 void CCJHtmlView::DocumentComplete(LPDISPATCH pDisp, VARIANT* URL)
00778 {
00779     UNUSED_ALWAYS(pDisp);
00780     ASSERT(V_VT(URL) == VT_BSTR);
00781
00782     CString str(V_BSTR(URL));
00783     OnDocumentComplete(str);
00784 }
00785
00787 // CCJHtmlView Events
00788
00789 void CCJHtmlView::OnProgressChange(long lProgress, long lProgressMax)
00790 {
00791     // user will override to handle this notification
00792     UNUSED_ALWAYS(lProgress);
00793     UNUSED_ALWAYS(lProgressMax);
00794 }
00795
00796 void CCJHtmlView::OnCommandStateChange(long lCommand, BOOL bEnable)
00797 {
00798     // user will override to handle this notification
00799     UNUSED_ALWAYS(lCommand);
00800     UNUSED_ALWAYS(bEnable);
00801 }
00802
00803 void CCJHtmlView::OnDownloadBegin()
00804 {
00805     // user will override to handle this notification
00806 }
00807
00808 void CCJHtmlView::OnDownloadComplete()
00809 {
00810     // user will override to handle this notification
00811 }
00812
00813 void CCJHtmlView::OnTitleChange(LPCTSTR lpszText)
00814 {
00815     // user will override to handle this notification
00816     UNUSED_ALWAYS(lpszText);
00817 }
00818
00819 void CCJHtmlView::OnPropertyChange(LPCTSTR lpszProperty)
00820 {
00821     // user will override to handle this notification
00822     UNUSED_ALWAYS(lpszProperty);
00823 }
00824
00825 void CCJHtmlView::OnNewWindow2(LPDISPATCH* ppDisp, BOOL* bCancel)
00826 {
00827     // default to continuing
00828     bCancel = FALSE;
00829
00830     // user will override to handle this notification
00831     UNUSED_ALWAYS(ppDisp);
00832 }
00833
00834 void CCJHtmlView::OnDocumentComplete(LPCTSTR lpszURL)
00835 {
00836     // user will override to handle this notification
00837     UNUSED_ALWAYS(lpszURL);
00838 }
00839
00840 void CCJHtmlView::OnQuit()
00841 {
00842     // user will override to handle this notification
00843 }
00844
00845 void CCJHtmlView::OnVisible(BOOL bVisible)
00846 {
00847     // user will override to handle this notification
00848     UNUSED_ALWAYS(bVisible);
00849 }
00850
00851 void CCJHtmlView::OnToolBar(BOOL bToolBar)
00852 {
00853     // user will override to handle this notification
00854     UNUSED_ALWAYS(bToolBar);
00855 }
00856
00857 void CCJHtmlView::OnMenuBar(BOOL bMenuBar)
00858 {
00859     // user will override to handle this notification
00860     UNUSED_ALWAYS(bMenuBar);
00861 }
00862
00863 void CCJHtmlView::OnStatusBar(BOOL bStatusBar)
00864 {
00865     // user will override to handle this notification
00866     UNUSED_ALWAYS(bStatusBar);
00867 }
00868
00869 void CCJHtmlView::OnFullScreen(BOOL bFullScreen)
00870 {
00871     // user will override to handle this notification
00872     UNUSED_ALWAYS(bFullScreen);
00873 }
00874
00875 void CCJHtmlView::OnTheaterMode(BOOL bTheaterMode)
00876 {
00877     // user will override to handle this notification
00878     UNUSED_ALWAYS(bTheaterMode);
00879 }
00880
00881 void CCJHtmlView::OnNavigateComplete2(LPCTSTR lpszURL)
00882 {
00883     // user will override to handle this notification
00884     UNUSED_ALWAYS(lpszURL);
00885 }
00886
00887 void CCJHtmlView::OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags,
00888     LPCTSTR lpszTargetFrameName, CByteArray& baPostData,
00889     LPCTSTR lpszHeaders, BOOL* bCancel)
00890 {
00891     // default to continuing
00892     bCancel = FALSE;
00893
00894     // user will override to handle this notification
00895     UNUSED_ALWAYS(lpszURL);
00896     UNUSED_ALWAYS(nFlags);
00897     UNUSED_ALWAYS(lpszTargetFrameName);
00898     UNUSED_ALWAYS(baPostData);
00899     UNUSED_ALWAYS(lpszHeaders);
00900 }
00901
00902 void CCJHtmlView::OnStatusTextChange(LPCTSTR pszText)
00903 {
00904     // try to set the status bar text via the frame
00905
00906     CFrameWnd* pFrame = GetParentFrame();
00907     if (pFrame != NULL)
00908         pFrame->SetMessageText(pszText);
00909 }
00910
00912 // Helps to eliminate screen flicker.
00913
00914 BOOL CCJHtmlView::OnEraseBkgnd(CDC* pDC)
00915 {
00916     CRect rectClient;
00917     GetClientRect( &rectClient );
00918     pDC->ExcludeClipRect( &rectClient );
00919     return CFormView::OnEraseBkgnd(pDC);
00920 }
00921
00923 // Pre-startup code
00924
00925 #ifdef AFX_INIT_SEG
00926 #pragma code_seg(AFX_INIT_SEG)
00927 #endif
00928
00929 IMPLEMENT_DYNCREATE(CCJHtmlView, CFormView)
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJHyperLink.cpp Source File

WinCvs/CJLib/CJLibrary/CJHyperLink.cpp

Go to the documentation of this file.
00001 // CJHyperLink.cpp : implementation file
00002 //
00003 // CCJHyperLink static control. Will open the default browser with the given URL
00004 // when the user clicks on the link.
00005 //
00006 // Copyright (C) 1997, 1998 Chris Maunder
00007 // All rights reserved. May not be sold for profit.
00008 //
00009 // Thanks to Pål K. Tønder for auto-size and window caption changes.
00010 //
00011 // "GotoURL" function by Stuart Patterson
00012 // As seen in the August, 1997 Windows Developer's Journal.
00013 // Copyright 1997 by Miller Freeman, Inc. All rights reserved.
00014 // Modified by Chris Maunder to use TCHARs instead of chars.
00015 //
00016 // "Default hand cursor" from Paul DiLascia's Jan 1998 MSJ article.
00017 //
00019 /****************************************************************************
00020  *
00021  * $Date: 1999/11/30 21:45:49 $
00022  * $Revision: 1.1.1.3 $
00023  * $Archive: /CodeJock/CJLibrary/CJHyperLink.cpp $
00024  *
00025  * $History: CJHyperLink.cpp $
00026  *
00027  * *****************  Version 5  *****************
00028  * User: Kirk Stowell Date: 10/14/99   Time: 11:46p
00029  * Updated in $/CodeJock/CJLibrary
00030  * Fixed memory leak caused by not freeing link cursor. Thanks to Matt
00031  * Davies [matt.davies@codehammer.com] for help with this.
00032  *
00033  * *****************  Version 4  *****************
00034  * User: Kirk Stowell Date: 10/14/99   Time: 12:26p
00035  * Updated in $/CodeJock/CJLibrary
00036  * Added source control history to file header.
00037  *
00038  ***************************************************************************/
00040
00041 #include "stdafx.h"
00042 #include "CJHyperLink.h"
00043
00044 #ifdef _DEBUG
00045 #define new DEBUG_NEW
00046 #undef THIS_FILE
00047 static char THIS_FILE[] = __FILE__;
00048 #endif
00049
00050 #define TOOLTIP_ID 1
00051
00053 // CCJHyperLink
00054
00055 CCJHyperLink::CCJHyperLink()
00056 {
00057     m_hLinkCursor       = NULL;                 // No cursor as yet
00058     m_crLinkColor      = RGB(  0,   0, 238);   // Blue
00059     m_crVisitedColor   = RGB( 85,  26, 139);   // Purple
00060     m_crHoverColor     = ::GetSysColor(COLOR_HIGHLIGHT);
00061     m_bOverControl      = FALSE;                // Cursor not yet over control
00062     m_bVisited          = FALSE;                // Hasn't been visited yet.
00063     m_bUnderline        = TRUE;                 // Underline the link?
00064     m_bAdjustToFit      = TRUE;                 // Resize the window to fit the text?
00065     m_strURL.Empty();
00066 }
00067
00068 CCJHyperLink::~CCJHyperLink()
00069 {
00070     m_Font.DeleteObject();
00071     if (m_hLinkCursor) {
00072         DestroyCursor(m_hLinkCursor);
00073     }
00074 }
00075
00076 BEGIN_MESSAGE_MAP(CCJHyperLink, CStatic)
00077     //{{AFX_MSG_MAP(CCJHyperLink)
00078     ON_CONTROL_REFLECT(STN_CLICKED, OnClicked)
00079     ON_WM_CTLCOLOR_REFLECT()
00080     ON_WM_SETCURSOR()
00081     ON_WM_MOUSEMOVE()
00082     //}}AFX_MSG_MAP
00083 END_MESSAGE_MAP()
00084
00086 // CCJHyperLink message handlers
00087
00088 BOOL CCJHyperLink::PreTranslateMessage(MSG* pMsg)
00089 {
00090     m_ToolTip.RelayEvent(pMsg);
00091     return CStatic::PreTranslateMessage(pMsg);
00092 }
00093
00094 void CCJHyperLink::OnClicked()
00095 {
00096     int result = (int)GotoURL(m_strURL, SW_SHOW);
00097     m_bVisited = (result > HINSTANCE_ERROR);
00098     if (!m_bVisited) {
00099         MessageBeep(MB_ICONEXCLAMATION);     // Unable to follow link
00100         ReportError(result);
00101     } else
00102         SetVisited();                        // Repaint to show visited Color
00103 }
00104
00105 HBRUSH CCJHyperLink::CtlColor(CDC* pDC, UINT nCtlColor)
00106 {
00107 #ifdef _DEBUG
00108     ASSERT(nCtlColor == CTLCOLOR_STATIC);
00109 #else
00110     UNUSED_ALWAYS( nCtlColor );
00111 #endif
00112
00113     if (m_bOverControl)
00114         pDC->SetTextColor(m_crHoverColor);
00115     else if (m_bVisited)
00116         pDC->SetTextColor(m_crVisitedColor);
00117     else
00118         pDC->SetTextColor(m_crLinkColor);
00119
00120     // transparent text.
00121     pDC->SetBkMode(TRANSPARENT);
00122     return (HBRUSH)GetStockObject(NULL_BRUSH);
00123 }
00124
00125 void CCJHyperLink::OnMouseMove(UINT nFlags, CPoint point)
00126 {
00127     CStatic::OnMouseMove(nFlags, point);
00128
00129     if (m_bOverControl)        // Cursor is currently over control
00130     {
00131         CRect rect;
00132         GetClientRect(rect);
00133
00134         if (!rect.PtInRect(point))
00135         {
00136             m_bOverControl = FALSE;
00137             ReleaseCapture();
00138             RedrawWindow();
00139             return;
00140         }
00141     }
00142     else                      // Cursor has just moved over control
00143     {
00144         m_bOverControl = TRUE;
00145         RedrawWindow();
00146         SetCapture();
00147     }
00148 }
00149
00150 BOOL CCJHyperLink::OnSetCursor(CWnd* /*pWnd*/, UINT /*nHitTest*/, UINT /*message*/)
00151 {
00152     if (m_hLinkCursor)
00153     {
00154         ::SetCursor(m_hLinkCursor);
00155         return TRUE;
00156     }
00157     return FALSE;
00158 }
00159
00160 void CCJHyperLink::PreSubclassWindow()
00161 {
00162     // We want to get mouse clicks via STN_CLICKED
00163     DWORD dwStyle = GetStyle();
00164     ::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY);
00165
00166     // Set the URL as the window text
00167     if (m_strURL.IsEmpty())
00168         GetWindowText(m_strURL);
00169
00170     // Check that the window text isn't empty. If it is, set it as the URL.
00171     CString strWndText;
00172     GetWindowText(strWndText);
00173     if (strWndText.IsEmpty()) {
00174         ASSERT(!m_strURL.IsEmpty());    // Window and URL both NULL. DUH!
00175         SetWindowText(m_strURL);
00176     }
00177
00178     // Create the font
00179     LOGFONT lf;
00180     GetFont()->GetLogFont(&lf);
00181     lf.lfUnderline = (char)m_bUnderline;
00182     m_Font.CreateFontIndirect(&lf);
00183     SetFont(&m_Font);
00184
00185     PositionWindow();        // Adjust size of window to fit URL if necessary
00186     SetDefaultCursor();      // Try and load up a "hand" cursor
00187
00188     // Create the tooltip
00189     CRect rect;
00190     GetClientRect(rect);
00191     m_ToolTip.Create(this);
00192     m_ToolTip.AddTool(this, m_strURL, rect, TOOLTIP_ID);
00193
00194     CStatic::PreSubclassWindow();
00195 }
00196
00198 // CCJHyperLink operations
00199
00200 void CCJHyperLink::SetURL(CString strURL)
00201 {
00202     m_strURL = strURL;
00203
00204     if (::IsWindow(GetSafeHwnd())) {
00205         PositionWindow();
00206         m_ToolTip.UpdateTipText(strURL, this, TOOLTIP_ID);
00207     }
00208 }
00209
00210 CString CCJHyperLink::GetURL() const
00211 {
00212     return m_strURL;
00213 }
00214
00215 void CCJHyperLink::SetColors(COLORREF crLinkColor, COLORREF crVisitedColor,
00216                             COLORREF crHoverColor /* = -1 */)
00217 {
00218     m_crLinkColor    = crLinkColor;
00219     m_crVisitedColor = crVisitedColor;
00220
00221     if (crHoverColor == -1)
00222         m_crHoverColor = ::GetSysColor(COLOR_HIGHLIGHT);
00223     else
00224         m_crHoverColor = crHoverColor;
00225
00226     if (::IsWindow(m_hWnd))
00227         Invalidate();
00228 }
00229
00230 COLORREF CCJHyperLink::GetLinkColor() const
00231 {
00232     return m_crLinkColor;
00233 }
00234
00235 COLORREF CCJHyperLink::GetVisitedColor() const
00236 {
00237     return m_crVisitedColor;
00238 }
00239
00240 COLORREF CCJHyperLink::GetHoverColor() const
00241 {
00242     return m_crHoverColor;
00243 }
00244
00245 void CCJHyperLink::SetVisited(BOOL bVisited /* = TRUE */)
00246 {
00247     m_bVisited = bVisited;
00248
00249     if (::IsWindow(GetSafeHwnd()))
00250         Invalidate();
00251 }
00252
00253 BOOL CCJHyperLink::GetVisited() const
00254 {
00255     return m_bVisited;
00256 }
00257
00258 void CCJHyperLink::SetLinkCursor(HCURSOR hCursor)
00259 {
00260     m_hLinkCursor = hCursor;
00261     if (m_hLinkCursor == NULL)
00262         SetDefaultCursor();
00263 }
00264
00265 HCURSOR CCJHyperLink::GetLinkCursor() const
00266 {
00267     return m_hLinkCursor;
00268 }
00269
00270 void CCJHyperLink::SetUnderline(BOOL bUnderline /* = TRUE */)
00271 {
00272     m_bUnderline = bUnderline;
00273
00274     if (::IsWindow(GetSafeHwnd()))
00275     {
00276         LOGFONT lf;
00277         GetFont()->GetLogFont(&lf);
00278         lf.lfUnderline = (char)m_bUnderline;
00279
00280         m_Font.DeleteObject();
00281         m_Font.CreateFontIndirect(&lf);
00282         SetFont(&m_Font);
00283
00284         Invalidate();
00285     }
00286 }
00287
00288 BOOL CCJHyperLink::GetUnderline() const
00289 {
00290     return m_bUnderline;
00291 }
00292
00293 void CCJHyperLink::SetAutoSize(BOOL bAutoSize /* = TRUE */)
00294 {
00295     m_bAdjustToFit = bAutoSize;
00296
00297     if (::IsWindow(GetSafeHwnd()))
00298         PositionWindow();
00299 }
00300
00301 BOOL CCJHyperLink::GetAutoSize() const
00302 {
00303     return m_bAdjustToFit;
00304 }
00305
00306
00307 // Move and resize the window so that the window is the same size
00308 // as the hyperlink text. This stops the hyperlink cursor being active
00309 // when it is not directly over the text. If the text is left justified
00310 // then the window is merely shrunk, but if it is centred or right
00311 // justified then the window will have to be moved as well.
00312 //
00313 // Suggested by Pål K. Tønder
00314
00315 void CCJHyperLink::PositionWindow()
00316 {
00317     if (!::IsWindow(GetSafeHwnd()) || !m_bAdjustToFit)
00318         return;
00319
00320     // Get the current window position
00321     CRect rect;
00322     GetWindowRect(rect);
00323
00324     CWnd* pParent = GetParent();
00325     if (pParent)
00326         pParent->ScreenToClient(rect);
00327
00328     // Get the size of the window text
00329     CString strWndText;
00330     GetWindowText(strWndText);
00331
00332     CDC* pDC = GetDC();
00333     CFont* pOldFont = pDC->SelectObject(&m_Font);
00334     CSize Extent = pDC->GetTextExtent(strWndText);
00335     pDC->SelectObject(pOldFont);
00336     ReleaseDC(pDC);
00337
00338     // Get the text justification via the window style
00339     DWORD dwStyle = GetStyle();
00340
00341     // Recalc the window size and position based on the text justification
00342     if (dwStyle & SS_CENTERIMAGE)
00343         rect.DeflateRect(0, (rect.Height() - Extent.cy)/2);
00344     else
00345         rect.bottom = rect.top + Extent.cy;
00346
00347     if (dwStyle & SS_CENTER)
00348         rect.DeflateRect((rect.Width() - Extent.cx)/2, 0);
00349     else if (dwStyle & SS_RIGHT)
00350         rect.left  = rect.right - Extent.cx;
00351     else // SS_LEFT = 0, so we can't test for it explicitly
00352         rect.right = rect.left + Extent.cx;
00353
00354     // Move the window
00355     SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
00356 }
00357
00359 // CCJHyperLink implementation
00360
00361 // The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
00362 // It loads a "hand" cursor from the winhlp32.exe module
00363 void CCJHyperLink::SetDefaultCursor()
00364 {
00365     if (m_hLinkCursor == NULL)                // No cursor handle - load our own
00366     {
00367         // Get the windows directory
00368         CString strWndDir;
00369         GetWindowsDirectory(strWndDir.GetBuffer(MAX_PATH), MAX_PATH);
00370         strWndDir.ReleaseBuffer();
00371
00372         strWndDir += _T("\\winhlp32.exe");
00373         // This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
00374         HMODULE hModule = LoadLibrary(strWndDir);
00375         if (hModule) {
00376             HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
00377             if (hHandCursor)
00378                 m_hLinkCursor = CopyCursor(hHandCursor);
00379         }
00380         FreeLibrary(hModule);
00381     }
00382 }
00383
00384 LONG CCJHyperLink::GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata)
00385 {
00386     HKEY hkey;
00387     LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
00388
00389     if (retval == ERROR_SUCCESS) {
00390         long datasize = MAX_PATH;
00391         TCHAR data[MAX_PATH];
00392         RegQueryValue(hkey, NULL, data, &datasize);
00393         _tcscpy(retdata,data);
00394         RegCloseKey(hkey);
00395     }
00396
00397     return retval;
00398 }
00399
00400 void CCJHyperLink::ReportError(int nError)
00401 {
00402     CString str;
00403     switch (nError) {
00404         case 0:                       str = _T("The operating system is out\nof memory or resources."); break;
00405         case SE_ERR_PNF:              str = _T("The specified path was not found."); break;
00406         case SE_ERR_FNF:              str = _T("The specified file was not found."); break;
00407         case ERROR_BAD_FORMAT:        str = _T("The .EXE file is invalid\n(non-Win32 .EXE or error in .EXE image)."); break;
00408         case SE_ERR_ACCESSDENIED:     str = _T("The operating system denied\naccess to the specified file."); break;
00409         case SE_ERR_ASSOCINCOMPLETE:  str = _T("The filename association is\nincomplete or invalid."); break;
00410         case SE_ERR_DDEBUSY:          str = _T("The DDE transaction could not\nbe completed because other DDE transactions\nwere being processed."); break;
00411         case SE_ERR_DDEFAIL:          str = _T("The DDE transaction failed."); break;
00412         case SE_ERR_DDETIMEOUT:       str = _T("The DDE transaction could not\nbe completed because the request timed out."); break;
00413         case SE_ERR_DLLNOTFOUND:      str = _T("The specified dynamic-link library was not found."); break;
00414         case SE_ERR_NOASSOC:          str = _T("There is no application associated\nwith the given filename extension."); break;
00415         case SE_ERR_OOM:              str = _T("There was not enough memory to complete the operation."); break;
00416         case SE_ERR_SHARE:            str = _T("A sharing violation occurred. ");
00417         default:                      str.Format(_T("Unknown Error (%d) occurred."), nError); break;
00418     }
00419     str = _T("Unable to open hyperlink:\n\n") + str;
00420     AfxMessageBox(str, MB_ICONEXCLAMATION | MB_OK);
00421 }
00422
00423 HINSTANCE CCJHyperLink::GotoURL( LPCTSTR url, int showcmd )
00424 {
00425     TCHAR key[MAX_PATH + MAX_PATH];
00426
00427     // First try ShellExecute()
00428     HINSTANCE result = ShellExecute( NULL, _T("open"), url, NULL, NULL, showcmd );
00429
00430     // If it failed, get the .htm regkey and lookup the program
00431     if((UINT)result <= HINSTANCE_ERROR)
00432     {
00433         if( GetRegKey( HKEY_CLASSES_ROOT, _T(".htm"), key ) == ERROR_SUCCESS )
00434         {
00435             lstrcat( key, _T("\\shell\\open\\command"));
00436
00437             if( GetRegKey( HKEY_CLASSES_ROOT, key, key ) == ERROR_SUCCESS )
00438             {
00439                 LPTSTR pos;
00440
00441                 pos = _tcsstr(key, _T("\"%1\""));
00442
00443                 if( pos == NULL )                       // No quotes found
00444                 {
00445                     pos = _tcsstr( key, _T("%1"));      // Check for %1, without quotes
00446
00447                     if( pos == NULL )                   // No parameter at all...
00448                     {
00449                         pos = key + _tcslen( key ) - 1;
00450                     }
00451                     else
00452                     {
00453                         *pos = _T('\0');                // Remove the parameter
00454                     }
00455                 }
00456                 else
00457                 {
00458                     *pos = _T('\0');                    // Remove the parameter
00459                 }
00460
00461                 lstrcat( pos, _T(" "));
00462                 lstrcat( pos, url );
00463
00464                 PROCESS_INFORMATION pi;
00465
00466                 STARTUPINFO         si;
00467
00468                 ::ZeroMemory( &si, sizeof( si ));
00469
00470                 si.cb = sizeof( si );
00471
00472                 if( ::CreateProcess( NULL,
00473                                      pos,
00474                                      NULL,
00475                                      NULL,
00476                                      FALSE,
00477                                      0,
00478                                      NULL,
00479                                      NULL,
00480                                      &si,
00481                                     &pi ) == FALSE )
00482                 {
00483                     return NULL;
00484                 }
00485
00486                 result = (HINSTANCE) pi.hProcess;
00487             }
00488         }
00489     }
00490
00491     return result;
00492 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJLibrary.cpp Source File

WinCvs/CJLib/CJLibrary/CJLibrary.cpp

Go to the documentation of this file.
00001 // CJLibrary.cpp : Defines the initialization routines for the DLL.
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJLibrary.cpp $
00011  *
00012  * $History: CJLibrary.cpp $
00013  *
00014  * *****************  Version 8  *****************
00015  * User: Kirk Stowell Date: 10/25/99   Time: 11:02p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Moved check for common control dll to DLL_PROCESS_ATTACH portion of
00018  * DllMain.
00019  *
00020  * *****************  Version 7  *****************
00021  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00022  * Updated in $/CodeJock/CJLibrary
00023  * Added source control history to file header.
00024  *
00025  ***************************************************************************/
00027
00028 #include "stdafx.h"
00029 #include <afxdllx.h>
00030 #include "CJToolBar.h"
00031
00032 #ifdef _DEBUG
00033 #define new DEBUG_NEW
00034 #undef THIS_FILE
00035 static char THIS_FILE[] = __FILE__;
00036 #endif
00037
00038
00039 static AFX_EXTENSION_MODULE CJLibraryDLL = { NULL, NULL };
00040
00041 extern "C" int APIENTRY
00042 DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
00043 {
00044     // Remove this if you use lpReserved
00045     UNREFERENCED_PARAMETER(lpReserved);
00046
00047     if (dwReason == DLL_PROCESS_ATTACH)
00048     {
00049         TRACE0("CJLIBRARY.DLL Initializing!\n");
00050
00051         // Extension DLL one-time initialization
00052         if (!AfxInitExtensionModule(CJLibraryDLL, hInstance))
00053             return 0;
00054
00055         // see what version of the common control we are using.
00056         _GetComCtlVersion();
00057         if (_ComCtlVersion < VERSION_IE4) {
00058             ::MessageBox(NULL, _T("Invalid Common Control DLL!\nYou need version 4.70 or higher to use CJLibrary...\nAborting!\n\nCopyright © 1999 CodeJock.com and Copyright © 1998-1999 Kirk W. Stowell, All Rights Reserved\nmailto:kstowell@codejock.com\nhttp://www.codejock.com"), _T("Invalid COMCTL32.DLL"), MB_ICONSTOP);
00059             return 0;
00060         }
00061
00062         // Insert this DLL into the resource chain
00063         // NOTE: If this Extension DLL is being implicitly linked to by
00064         //  an MFC Regular DLL (such as an ActiveX Control)
00065         //  instead of an MFC application, then you will want to
00066         //  remove this line from DllMain and put it in a separate
00067         //  function exported from this Extension DLL.  The Regular DLL
00068         //  that uses this Extension DLL should then explicitly call that
00069         //  function to initialize this Extension DLL.  Otherwise,
00070         //  the CDynLinkLibrary object will not be attached to the
00071         //  Regular DLL's resource chain, and serious problems will
00072         //  result.
00073
00074         new CDynLinkLibrary(CJLibraryDLL);
00075     }
00076     else if (dwReason == DLL_PROCESS_DETACH)
00077     {
00078         TRACE0("CJLIBRARY.DLL Terminating!\n");
00079         // Terminate the library before destructors are called
00080         AfxTermExtensionModule(CJLibraryDLL);
00081     }
00082     return 1;   // ok
00083 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJListBox.cpp Source File

WinCvs/CJLib/CJLibrary/CJListBox.cpp

Go to the documentation of this file.
00001 // CJListBox.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.1 $
00010  * $Archive: /CodeJock/CJLibrary/CJListBox.cpp $
00011  *
00012  * $History: CJListBox.cpp $
00013  *
00014  * *****************  Version 1  *****************
00015  * User: Kirk Stowell Date: 10/30/99   Time: 9:36p
00016  * Created in $/CodeJock/CJLibrary
00017  *
00018  ***************************************************************************/
00020
00021 #include "StdAfx.h"
00022 #include "CJListBox.h"
00023
00024 #ifdef _DEBUG
00025 #define new DEBUG_NEW
00026 #undef THIS_FILE
00027 static char THIS_FILE[] = __FILE__;
00028 #endif
00029
00031 // CCJListBox
00032
00033 CCJListBox::CCJListBox()
00034 {
00035     // TODO: add construction code here.
00036 }
00037
00038 CCJListBox::~CCJListBox()
00039 {
00040     // TODO: add destruction code here.
00041 }
00042
00043 IMPLEMENT_DYNAMIC(CCJListBox, CListBox)
00044
00045 BEGIN_MESSAGE_MAP(CCJListBox, CListBox)
00046     //{{AFX_MSG_MAP(CCJListBox)
00047     ON_WM_ERASEBKGND()
00048     ON_WM_PAINT()
00049     //}}AFX_MSG_MAP
00050 END_MESSAGE_MAP()
00051
00053 // CCJListBox message handlers
00054
00055 BOOL CCJListBox::OnEraseBkgnd(CDC* pDC)
00056 {
00057     // KStowell - overridden for flicker-free drawing.
00058     UNUSED_ALWAYS(pDC);
00059     return TRUE;
00060 }
00061
00062 void CCJListBox::OnPaint()
00063 {
00064     CPaintDC dc(this); // device context for painting
00065
00066     // KStowell - Get the client rect.
00067     CRect rcClient, rcClip;
00068     dc.GetClipBox( &rcClip );
00069     GetClientRect( &rcClient );
00070
00071     // KStowell - Create a memory device-context. This is done to help reduce
00072     // screen flicker, since we will paint the entire control to the
00073     // off screen device context first.
00074     CDC memDC;
00075     CBitmap bitmap;
00076     memDC.CreateCompatibleDC(&dc);
00077     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00078     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00079
00080     // KStowell - Repaint the background.
00081     memDC.FillSolidRect( rcClient, ::GetSysColor(COLOR_WINDOW) );
00082
00083     // let the control do its default drawing.
00084     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00085
00086     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00087     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00088         rcClip.left, rcClip.top, SRCCOPY );
00089
00090     // KStowell - Cleanup resources.
00091     memDC.SelectObject(pOldBitmap);
00092     memDC.DeleteDC();
00093     bitmap.DeleteObject();
00094 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJListCtrl.cpp Source File

WinCvs/CJLib/CJLibrary/CJListCtrl.cpp

Go to the documentation of this file.
00001 // CJListCtrl.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the CListView articles from http://www.codeguru.com/listview
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:49 $
00011  * $Revision: 1.1.1.3 $
00012  * $Archive: /CodeJock/CJLibrary/CJListCtrl.cpp $
00013  *
00014  * $History: CJListCtrl.cpp $
00015  *
00016  * *****************  Version 10  *****************
00017  * User: Kirk Stowell Date: 10/30/99   Time: 1:52p
00018  * Updated in $/CodeJock/CJLibrary
00019  * Overrode OnEraseBkgnd(...) and OnPaint(...) to handle flicker free
00020  * drawing.
00021  *
00022  * *****************  Version 9  *****************
00023  * User: Kirk Stowell Date: 10/25/99   Time: 10:52p
00024  * Updated in $/CodeJock/CJLibrary
00025  * Modified resource include for static builds.
00026  *
00027  * *****************  Version 8  *****************
00028  * User: Kirk Stowell Date: 8/29/99    Time: 11:45p
00029  * Updated in $/CodeJockey/CJLibrary
00030  * Fixed memory lead with header  control allocation.
00031  *
00032  * *****************  Version 7  *****************
00033  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00034  * Updated in $/CodeJockey/CJLibrary
00035  * Added Unicode compliance, thanks to Barry Burton for his help with
00036  * this.
00037  *
00038  *
00039  * *****************  Version 6  *****************
00040  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00041  * Updated in $/CodeJockey/CJLibrary
00042  *
00043  * *****************  Version 5  *****************
00044  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00045  * Updated in $/CodeJockey/CJLibrary
00046  *
00047  * *****************  Version 4  *****************
00048  * User: Kirk Stowell Date: 6/12/99    Time: 2:29a
00049  * Updated in $/CodeJockey/CJ60Lib
00050  * Cleaned up initialization, sorting and column info saving. Removed sort
00051  * functions, which were replaced with the virtual function SortList(...).
00052  * Override this function in your derived class to perform custom sorting.
00053  * See CCJShellList for an implementation of this virtual function.
00054  *
00055  * *****************  Version 3  *****************
00056  * User: Kirk Stowell Date: 4/03/99    Time: 8:38p
00057  * Updated in $/CodeJockey/CJ60Lib
00058  * Added comments and cleaned up code.
00059  *
00060  * *****************  Version 2  *****************
00061  * User: Kirk Stowell Date: 3/03/99    Time: 8:37p
00062  * Updated in $/CodeJockey/CJ60Lib
00063  * Added InitializeFlatHeader() in order to initialize the list control
00064  * manually.
00065  *
00066  * *****************  Version 1  *****************
00067  * User: Kirk Stowell Date: 1/16/99    Time: 8:37p
00068  * Created in $/CodeJockey/CJ60Lib
00069  * Initial release.
00070  *
00071  ***************************************************************************/
00073
00074 #include "stdafx.h"
00075 #include "CJListCtrl.h"
00076 #include "CJFlatHeaderCtrl.h"
00077 #include "CJResource.h"
00078
00079 #ifdef _DEBUG
00080 #define new DEBUG_NEW
00081 #undef THIS_FILE
00082 static char THIS_FILE[] = __FILE__;
00083 #endif
00084
00086 // CCJListCtrl
00087
00088 CCJListCtrl::CCJListCtrl()
00089 {
00090     m_nMinSize      = 0;
00091     m_nMinColWidth  = 50;
00092     m_nMaxColWidth  = 500;
00093     m_nSortedCol    = -1;
00094     m_bAscending    = true;
00095     m_bAutoSave     = false;
00096     m_bNoColSizing  = false;
00097     m_pHeaderCtrl   = NULL;
00098     m_clrText       = ::GetSysColor(COLOR_WINDOWTEXT);
00099     m_clrTextBk     = ::GetSysColor(COLOR_WINDOW);
00100 }
00101
00102 CCJListCtrl::~CCJListCtrl()
00103 {
00104     _delete( m_pHeaderCtrl );
00105 }
00106
00107 IMPLEMENT_DYNAMIC(CCJListCtrl, CListCtrl)
00108
00109 BEGIN_MESSAGE_MAP(CCJListCtrl, CListCtrl)
00110     //{{AFX_MSG_MAP(CCJListCtrl)
00111     ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
00112     ON_WM_DESTROY()
00113     ON_WM_ERASEBKGND()
00114     ON_WM_PAINT()
00115     //}}AFX_MSG_MAP
00116 END_MESSAGE_MAP()
00117
00119 // CCJListCtrl message handlers
00120
00121 // Taken from: Copying/Moving Rows in CListCtrl by James Spibey [spib@bigfoot.com].
00122 // http://www.codeguru.com/listview/moving_rows.html
00123 bool CCJListCtrl::MoveRow(int nFrom, int nTo)
00124 {
00125     //Can't move to the same place, or from or to a negative index
00126     if(nFrom == nTo || nFrom < 0 || nTo < 0)
00127         return false;
00128
00129     //First Copy the row to the new location
00130     if(CopyRow(nFrom, nTo))
00131     {
00132         //If we have just inserted a row before
00133         //this one in the list, we need to increment
00134         //our index.
00135         if(nFrom > nTo)
00136             DeleteItem(nFrom + 1);
00137         else
00138             DeleteItem(nFrom);
00139
00140         return true;
00141     }
00142     else
00143         return false;
00144 }
00145
00146 // Taken from: Copying/Moving Rows in CListCtrl by James Spibey [spib@bigfoot.com].
00147 // http://www.codeguru.com/listview/moving_rows.html
00148 bool CCJListCtrl::CopyRow(int nFrom, int nTo)
00149 {
00150     //Can't move to the same place, or from or to a negative index
00151     if(nFrom == nTo || nFrom < 0 || nTo < 0)
00152         return false;
00153
00154     //Copy the row to the new index
00155     InsertItem(nTo, GetItemText(nFrom, 0));
00156
00157     //If row has been inserted before original
00158     //increment the original
00159     if(nFrom > nTo)
00160         nFrom++;
00161
00162     //Loop through subitems
00163     for(int i = 1; i < GetColumnCount(); i++)
00164     {
00165         SetItemText(nTo, i, GetItemText(nFrom, i));
00166     }
00167
00168     return true;
00169 }
00170
00171 // Taken from: Getting the number of columns in report view by Zafir Anjum.
00172 // http://www.codeguru.com/listview/num_cols.shtml
00173 int CCJListCtrl::GetColumnCount() const
00174 {
00175     CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
00176     return pHeader->GetItemCount();
00177 }
00178
00179 // Taken from: Simpler way to do this (using new version of Comctl32.dll) by Vidas [vibal@lrtc.lt].
00180 // http://www.codeguru.com/mfc/comments/6432.shtml
00181 void CCJListCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
00182 {
00183     LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
00184
00185     switch(lplvcd->nmcd.dwDrawStage)
00186     {
00187     case CDDS_PREPAINT:
00188         // Request prepaint notifications for each item.
00189         *pResult = CDRF_NOTIFYITEMDRAW;
00190         break;
00191
00192     case CDDS_ITEMPREPAINT: // Requested notification
00193         if(lplvcd->nmcd.dwItemSpec % 2)
00194         {
00195             lplvcd->clrText   = m_clrText;
00196             lplvcd->clrTextBk = m_clrTextBk;
00197         }
00198         *pResult = CDRF_DODEFAULT;
00199         break;
00200     }
00201 }
00202
00203 BOOL CCJListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
00204 {
00205     HD_NOTIFY *pHDNotify = (HD_NOTIFY*)lParam;
00206
00207     switch( pHDNotify->hdr.code )
00208     {
00209     // Sorting the list when user clicks on column header by Zafir Anjum.
00210     // http://www.codeguru.com/listview/sort_on_col_click.shtml
00211     case HDN_ITEMCLICKA:
00212     case HDN_ITEMCLICKW:
00213         {
00214             if( pHDNotify->iButton == 0 )
00215             {
00216                 // set the sort order.
00217                 if( pHDNotify->iItem == m_nSortedCol )
00218                     m_bAscending = !m_bAscending;
00219                 else
00220                     m_bAscending = true;
00221
00222                 // save the column index.
00223                 m_nSortedCol = pHDNotify->iItem;
00224
00225                 // virtual call to sort list.
00226                 SortList( m_nSortedCol, m_bAscending );
00227
00228                 // set the sort image in the header control.
00229                 if( m_pHeaderCtrl && m_pHeaderCtrl->GetSafeHwnd( ))
00230                     m_pHeaderCtrl->SetSortImage( m_nSortedCol, m_bAscending );
00231             }
00232         }
00233         break;
00234
00235     // How to force a minimum column width Cees Mechielsen.
00236     // http://www.codeguru.com/mfc/comments/866.shtml
00237     case HDN_ITEMCHANGINGA:
00238     case HDN_ITEMCHANGINGW:
00239     case HDN_ENDTRACK:
00240         {
00241             if( pHDNotify->pitem->mask & HDI_WIDTH &&
00242                 pHDNotify->pitem->cxy < m_nMinSize &&
00243                 pHDNotify->pitem->cxy >= 0 )
00244             {
00245                 pHDNotify->pitem->cxy = m_nMinSize; // Set the column width
00246             }
00247         }
00248         break;
00249
00250     // Prevent CListCtrl column resizing by Zafir Anjum.
00251     // http://www.codeguru.com/listview/no_col_resize.shtml
00252     case HDN_DIVIDERDBLCLICKA:
00253     case HDN_DIVIDERDBLCLICKW:
00254     case HDN_BEGINTRACKW:
00255     case HDN_BEGINTRACKA:
00256         {
00257             if(m_bNoColSizing)
00258             {
00259                 *pResult = TRUE;                // disable tracking
00260                 return TRUE;                    // Processed message
00261             }
00262             break;
00263         }
00264     }
00265
00266     return CListCtrl::OnNotify(wParam, lParam, pResult);
00267 }
00268
00269 bool CCJListCtrl::SortList(int nCol, bool bAscending)
00270 {
00271 #ifdef _DEBUG
00272     TRACE2("Column sort on column index %d, ascending=%d", nCol, bAscending);
00273 #else
00274     UNUSED_ALWAYS( nCol );
00275     UNUSED_ALWAYS( bAscending );
00276 #endif
00277
00278     return true;
00279 }
00280
00281 // Taken from: Adding a column by Zafir Anjum.
00282 // http://www.codeguru.com/listview/add_column.shtml
00283
00284 // AddColumn      - adds column after the right most column
00285 // Returns        - the index of the new column if successful or -1 otherwise.
00286 // lpszColHeading - the column's heading
00287 // nWidth         - Width of the column, in pixels. If this parameter is -1,
00288 //                  the column width is the same as previous column
00289 // nFormat        - the alignment of the column. Can be LVCFMT_LEFT,
00290 //                  LVCFMT_RIGHT, or LVCFMT_CENTER.
00291 int CCJListCtrl::AddColumn(LPCTSTR lpszColHeading, int nWidth/*=-1*/, int nFormat/*=LVCFMT_LEFT*/)
00292 {
00293     CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
00294     int nColumnCount = pHeader->GetItemCount();
00295
00296     if( nWidth == -1 )
00297     {
00298         // The line below return zero for ICON views
00299         //nWidth = GetColumnWidth( nColumnCount - 1 );
00300
00301         // Get the column width of the previous column from header control
00302         HD_ITEM hd_item;
00303         hd_item.mask = HDI_WIDTH;               //indicate that we want the width
00304         pHeader->GetItem( nColumnCount - 1, &hd_item );
00305         nWidth = hd_item.cxy;
00306     }
00307     return InsertColumn( nColumnCount, lpszColHeading, nFormat, nWidth, nColumnCount );
00308 }
00309
00310 bool CCJListCtrl::BuildColumns(int nCols, int* nWidth, int* nColString)
00311 {
00312     for( int i = 0; i < nCols; ++i ) {
00313         CString strTemp; strTemp.LoadString( nColString[i] );
00314         if(AddColumn(strTemp, nWidth[i])==-1)
00315             return false;
00316     }
00317
00318     return true;
00319 }
00320
00321 bool CCJListCtrl::BuildColumns(int nCols, int* nWidth, CString* strColString)
00322 {
00323     for( int i = 0; i < nCols; ++i ) {
00324         if(AddColumn(strColString[i], nWidth[i])==-1)
00325             return false;
00326     }
00327
00328     return true;
00329 }
00330
00331 // Taken from: Detecting column index of the item clicked by Zafir Anjum.
00332 // http://www.codeguru.com/listview/col_index.shtml
00333
00334 // HitTestEx    - Determine the row index and column index for a point
00335 // Returns      - the row index or -1 if point is not over a row
00336 // point        - point to be tested.
00337 // nCol         - to hold the column index
00338 int CCJListCtrl::HitTestEx(CPoint& point, int* nCol) const
00339 {
00340     int colnum = 0;
00341     int row = HitTest( point, NULL );
00342
00343     if( nCol ) *nCol = 0;
00344
00345     // Make sure that the ListView is in LVS_REPORT
00346     if( (GetWindowLong(m_hWnd, GWL_STYLE) & LVS_TYPEMASK) != LVS_REPORT )
00347         return row;
00348
00349     // Get the top and bottom row visible
00350     row = GetTopIndex();
00351     int bottom = row + GetCountPerPage();
00352     if( bottom > GetItemCount() )
00353         bottom = GetItemCount();
00354
00355     // Get the number of columns
00356     CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
00357     int nColumnCount = pHeader->GetItemCount();
00358
00359     // Loop through the visible rows
00360     for( ;row <= bottom;row++)
00361     {
00362         // Get bounding rect of item and check whether point falls in it.
00363         CRect rect;
00364         GetItemRect( row, &rect, LVIR_BOUNDS );
00365         if( rect.PtInRect(point) )
00366         {
00367             // Now find the column
00368             for( colnum = 0; colnum < nColumnCount; colnum++ )
00369             {
00370                 int colwidth = GetColumnWidth(colnum);
00371                 if( point.x >= rect.left
00372                     && point.x <= (rect.left + colwidth ) )
00373                 {
00374                     if( nCol ) *nCol = colnum;
00375                     return row;
00376                 }
00377                 rect.left += colwidth;
00378             }
00379         }
00380     }
00381     return -1;
00382 }
00383
00384 bool CCJListCtrl::SubclassHeader(bool bBoldFont/*=false*/)
00385 {
00386     // allocate memory for the flat header.
00387     m_pHeaderCtrl = new CCJFlatHeaderCtrl;
00388     ASSERT( m_pHeaderCtrl );
00389
00390     // get the window handle to the existing header
00391     // control.
00392     HWND hWnd = GetDlgItem(0)->GetSafeHwnd();
00393     ASSERT( hWnd );
00394
00395     // subclass the flat header control.
00396     if( !m_pHeaderCtrl->SubclassWindow( hWnd ))
00397         return false;
00398
00399     // finish header initialization.
00400     m_pHeaderCtrl->InitializeHeader( bBoldFont );
00401
00402     return true;
00403 }
00404
00405 void CCJListCtrl::AutoSaveColumns(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault)
00406 {
00407     m_bAutoSave = true;
00408
00409     // initialize registry strings.
00410     if( lpszSection == NULL ) m_strSection = _T("Settings");
00411     else m_strSection = lpszSection;
00412
00413     if( lpszEntry == NULL ) m_strEntry = _T("Column Info");
00414     else m_strEntry = lpszEntry;
00415
00416     if( lpszDefault == NULL ) m_strDefault = _T("");
00417     else m_strDefault = lpszDefault;
00418
00419     LoadColumnWidths();
00420 }
00421
00422 void CCJListCtrl::SaveColumnWidths()
00423 {
00424     // get a pointer to the header control.
00425     CHeaderCtrl* pHeader = DYNAMIC_DOWNCAST(CHeaderCtrl, GetDlgItem(0));
00426     ASSERT_KINDOF( CHeaderCtrl, pHeader );
00427
00428     CString strValue;
00429     for( int i = 0; i < pHeader->GetItemCount(); ++i )
00430     {
00431         CString strTemp;
00432         strTemp.Format(_T("%d,"), GetColumnWidth( i ));
00433         strValue += strTemp;
00434     }
00435
00436     AfxGetApp()->WriteProfileString( m_strSection, m_strEntry, strValue );
00437 }
00438
00439 void CCJListCtrl::LoadColumnWidths()
00440 {
00441     // get a pointer to the header control.
00442     CHeaderCtrl* pHeader = DYNAMIC_DOWNCAST(CHeaderCtrl, GetDlgItem(0));
00443     ASSERT_KINDOF( CHeaderCtrl, pHeader );
00444
00445     for( int i = 0; i < pHeader->GetItemCount(); ++i )
00446         SetColumnWidth(i);
00447 }
00448
00449 void CCJListCtrl::SetColumnWidth(int nCol)
00450 {
00451     int nWidth = GetStoredWidth( nCol );
00452     if( nWidth > m_nMinColWidth )
00453         CListCtrl::SetColumnWidth( nCol, nWidth );
00454     else
00455         AutoSizeColumn( nCol );
00456 }
00457
00458 int CCJListCtrl::GetStoredWidth(int nCol)
00459 {
00460     // get the value from the registry.
00461     CString strValue = AfxGetApp()->GetProfileString(
00462         m_strSection, m_strEntry, m_strDefault );
00463
00464     // extract the sub string to get the column width.
00465     CString strSubString;
00466     AfxExtractSubString( strSubString, strValue, nCol, _T(','));
00467
00468     // return the width from the registry.
00469     return _ttoi( strSubString );
00470 }
00471
00472 void CCJListCtrl::OnDestroy()
00473 {
00474     if( m_bAutoSave ) SaveColumnWidths();
00475     CListCtrl::OnDestroy();
00476 }
00477
00478 // Taken from: Autosize a column to fit its content by Roger Onslow.
00479 // http://www.codeguru.com/listview/autosize_col.shtml
00480 // If you don't supply a column number, it will resize all columns.
00481 void CCJListCtrl::AutoSizeColumn(int nCol/*=-1*/)
00482 {
00483     // Call this after your list control is filled
00484     SetRedraw( false );
00485
00486     int nMinCol = nCol < 0 ? 0 : nCol;
00487     int nMaxCol = nCol < 0 ? GetColumnCount()-1 : nCol;
00488
00489     for (nCol = nMinCol; nCol <= nMaxCol; nCol++)
00490     {
00491         CListCtrl::SetColumnWidth( nCol, LVSCW_AUTOSIZE );
00492         int wc1 = GetColumnWidth( nCol );
00493
00494         CListCtrl::SetColumnWidth( nCol, LVSCW_AUTOSIZE_USEHEADER );
00495         int wc2 = GetColumnWidth( nCol );
00496         int wc = max( m_nMinColWidth, max( wc1, wc2 ));
00497
00498         if( wc > m_nMaxColWidth )
00499             wc = m_nMaxColWidth;
00500
00501         // set the column width.
00502         CListCtrl::SetColumnWidth( nCol,wc );
00503     }
00504
00505     SetRedraw();
00506 }
00507
00508 BOOL CCJListCtrl::OnEraseBkgnd(CDC* pDC)
00509 {
00510     // KStowell - overridden for flicker-free drawing.
00511     UNUSED_ALWAYS(pDC);
00512     return TRUE;
00513 }
00514
00515 void CCJListCtrl::OnPaint()
00516 {
00517     CPaintDC dc(this); // device context for painting
00518
00519     // KStowell - Get the client rect.
00520     CRect rcClient, rcClip;
00521     dc.GetClipBox( &rcClip );
00522     GetClientRect( &rcClient );
00523
00524     // Exclude the header control from being painted over.
00525     CWnd* pWnd = GetDlgItem(0);
00526     if(pWnd && pWnd->IsWindowVisible()) {
00527         CRect rcItem;
00528         pWnd->GetClientRect(&rcItem);
00529         dc.ExcludeClipRect(&rcItem);
00530     }
00531
00532     // KStowell - Create a memory device-context. This is done to help reduce
00533     // screen flicker, since we will paint the entire control to the
00534     // off screen device context first.
00535     CDC memDC;
00536     CBitmap bitmap;
00537     memDC.CreateCompatibleDC(&dc);
00538     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00539     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00540
00541     // KStowell - Repaint the background.
00542     memDC.FillSolidRect( rcClient, ::GetSysColor(COLOR_WINDOW) );
00543
00544     // let the control do its default drawing.
00545     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00546
00547     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00548     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00549         rcClip.left, rcClip.top, SRCCOPY );
00550
00551     // KStowell - Cleanup resources.
00552     memDC.SelectObject(pOldBitmap);
00553     memDC.DeleteDC();
00554     bitmap.DeleteObject();
00555 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJListView.cpp Source File

WinCvs/CJLib/CJLibrary/CJListView.cpp

Go to the documentation of this file.
00001 // CJListView.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the CListView articles from http://www.codeguru.com/listview
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:49 $
00011  * $Revision: 1.1.1.3 $
00012  * $Archive: /CodeJock/CJLibrary/CJListView.cpp $
00013  *
00014  * $History: CJListView.cpp $
00015  *
00016  * *****************  Version 9  *****************
00017  * User: Kirk Stowell Date: 10/30/99   Time: 2:04p
00018  * Updated in $/CodeJock/CJLibrary
00019  * Overrode OnEraseBkgnd(...) for flicker free drawing.
00020  *
00021  * *****************  Version 8  *****************
00022  * User: Kirk Stowell Date: 10/25/99   Time: 10:52p
00023  * Updated in $/CodeJock/CJLibrary
00024  * Modified resource include for static builds.
00025  *
00026  * *****************  Version 7  *****************
00027  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00028  * Updated in $/CodeJockey/CJLibrary
00029  * Added Unicode compliance, thanks to Barry Burton for his help with
00030  * this.
00031  *
00032  *
00033  * *****************  Version 6  *****************
00034  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00035  * Updated in $/CodeJockey/CJLibrary
00036  *
00037  * *****************  Version 5  *****************
00038  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00039  * Updated in $/CodeJockey/CJLibrary
00040  *
00041  * *****************  Version 4  *****************
00042  * User: Kirk Stowell Date: 6/12/99    Time: 2:21a
00043  * Updated in $/CodeJockey/CJ60Lib
00044  * Cleaned up initialization, sorting and column info saving. Removed sort
00045  * functions, which were replaced with the virtual function SortList(...).
00046  * Override this function in your derived class to perform custom sorting.
00047  * See CCJShellList for an implementation of this virtual function.
00048  *
00049  * *****************  Version 3  *****************
00050  * User: Kirk Stowell Date: 4/03/99    Time: 12:06a
00051  * Updated in $/CodeJockey/CJ60Lib
00052  * Added comments and cleaned up code.
00053  *
00054  * *****************  Version 2  *****************
00055  * User: Kirk Stowell Date: 3/03/99    Time: 12:06a
00056  * Updated in $/CodeJockey/CJ60Lib
00057  * Added InitializeFlatHeader() in order to initialize the list control
00058  * manually.
00059  *
00060  * *****************  Version 1  *****************
00061  * User: Kirk Stowell Date: 1/16/99    Time: 12:06a
00062  * Created in $/CodeJockey/CJ60Lib
00063  * Initial release.
00064  *
00065  ***************************************************************************/
00067
00068 #include "stdafx.h"
00069 #include "CJListView.h"
00070 #include "CJFlatHeaderCtrl.h"
00071 #include "CJResource.h"
00072
00073 #ifdef _DEBUG
00074 #define new DEBUG_NEW
00075 #undef THIS_FILE
00076 static char THIS_FILE[] = __FILE__;
00077 #endif
00078
00080 // CCJListView
00081
00082 IMPLEMENT_DYNCREATE(CCJListView, CListView)
00083
00084 CCJListView::CCJListView()
00085 {
00086     m_nMinSize      = 0;
00087     m_nMinColWidth  = 50;
00088     m_nMaxColWidth  = 500;
00089     m_nSortedCol    = -1;
00090     m_bAscending    = true;
00091     m_bAutoSave     = false;
00092     m_bNoColSizing  = false;
00093     m_pHeaderCtrl   = NULL;
00094     m_pListCtrl     = NULL;
00095     m_clrText       = ::GetSysColor(COLOR_WINDOWTEXT);
00096     m_clrTextBk     = ::GetSysColor(COLOR_WINDOW);
00097 }
00098
00099 CCJListView::~CCJListView()
00100 {
00101     _delete( m_pHeaderCtrl );
00102 }
00103
00104
00105 BEGIN_MESSAGE_MAP(CCJListView, CListView)
00106     //{{AFX_MSG_MAP(CCJListView)
00107     ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
00108     ON_WM_DESTROY()
00109     ON_WM_ERASEBKGND()
00110     //}}AFX_MSG_MAP
00111 END_MESSAGE_MAP()
00112
00114 // CCJListView drawing
00115
00116 void CCJListView::OnDraw( CDC* pDC )
00117 {
00118     UNUSED_ALWAYS( pDC );
00119 }
00120
00122 // CCJListView diagnostics
00123
00124 #ifdef _DEBUG
00125 void CCJListView::AssertValid() const
00126 {
00127     CListView::AssertValid();
00128 }
00129
00130 void CCJListView::Dump(CDumpContext& dc) const
00131 {
00132     CListView::Dump(dc);
00133 }
00134 #endif //_DEBUG
00135
00137 // CCJListView message handlers
00138
00139 void CCJListView::OnInitialUpdate()
00140 {
00141     CListView::OnInitialUpdate();
00142
00143     // Set a pointer to the list control.
00144     m_pListCtrl = &GetListCtrl();
00145 }
00146
00147 // Taken from: Copying/Moving Rows in CListCtrl by James Spibey [spib@bigfoot.com].
00148 // http://www.codeguru.com/listview/moving_rows.html
00149 bool CCJListView::MoveRow(int nFrom, int nTo)
00150 {
00151     //Can't move to the same place, or from or to a negative index
00152     if(nFrom == nTo || nFrom < 0 || nTo < 0)
00153         return false;
00154
00155     //First Copy the row to the new location
00156     if(CopyRow(nFrom, nTo))
00157     {
00158         //If we have just inserted a row before
00159         //this one in the list, we need to increment
00160         //our index.
00161         if(nFrom > nTo)
00162             m_pListCtrl->DeleteItem(nFrom + 1);
00163         else
00164             m_pListCtrl->DeleteItem(nFrom);
00165
00166         return true;
00167     }
00168     else
00169         return false;
00170 }
00171
00172 // Taken from: Copying/Moving Rows in CListCtrl by James Spibey [spib@bigfoot.com].
00173 // http://www.codeguru.com/listview/moving_rows.html
00174 bool CCJListView::CopyRow(int nFrom, int nTo)
00175 {
00176     //Can't move to the same place, or from or to a negative index
00177     if(nFrom == nTo || nFrom < 0 || nTo < 0)
00178         return false;
00179
00180     //Copy the row to the new index
00181     m_pListCtrl->InsertItem(nTo, m_pListCtrl->GetItemText(nFrom, 0));
00182
00183     //If row has been inserted before original
00184     //increment the original
00185     if(nFrom > nTo)
00186         nFrom++;
00187
00188     //Loop through subitems
00189     for(int i = 1; i < GetColumnCount(); i++)
00190     {
00191         m_pListCtrl->SetItemText(nTo, i, m_pListCtrl->GetItemText(nFrom, i));
00192     }
00193
00194     return true;
00195 }
00196
00197 // Taken from: Getting the number of columns in report view by Zafir Anjum.
00198 // http://www.codeguru.com/listview/num_cols.shtml
00199 int CCJListView::GetColumnCount() const
00200 {
00201     CHeaderCtrl* pHeader = (CHeaderCtrl*)m_pListCtrl->GetDlgItem(0);
00202     return pHeader->GetItemCount();
00203 }
00204
00205 // Taken from: Simpler way to do this (using new version of Comctl32.dll) by Vidas [vibal@lrtc.lt].
00206 // http://www.codeguru.com/mfc/comments/6432.shtml
00207 void CCJListView::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
00208 {
00209     LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
00210
00211     switch(lplvcd->nmcd.dwDrawStage)
00212     {
00213     case CDDS_PREPAINT:
00214         // Request prepaint notifications for each item.
00215         *pResult = CDRF_NOTIFYITEMDRAW;
00216         break;
00217
00218     case CDDS_ITEMPREPAINT: // Requested notification
00219         if(lplvcd->nmcd.dwItemSpec % 2)
00220         {
00221             lplvcd->clrText   = m_clrText;
00222             lplvcd->clrTextBk = m_clrTextBk;
00223         }
00224         *pResult = CDRF_DODEFAULT;
00225         break;
00226     }
00227 }
00228
00229 BOOL CCJListView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
00230 {
00231     HD_NOTIFY *pHDNotify = (HD_NOTIFY*)lParam;
00232
00233     switch( pHDNotify->hdr.code )
00234     {
00235     // Sorting the list when user clicks on column header by Zafir Anjum.
00236     // http://www.codeguru.com/listview/sort_on_col_click.shtml
00237     case HDN_ITEMCLICKA:
00238     case HDN_ITEMCLICKW:
00239         {
00240             if( pHDNotify->iButton == 0 )
00241             {
00242                 // set the sort order.
00243                 if( pHDNotify->iItem == m_nSortedCol )
00244                     m_bAscending = !m_bAscending;
00245                 else
00246                     m_bAscending = true;
00247
00248                 // save the column index.
00249                 m_nSortedCol = pHDNotify->iItem;
00250
00251                 // virtual call to sort list.
00252                 SortList( m_nSortedCol, m_bAscending );
00253
00254                 // set the sort image in the header control.
00255                 if( m_pHeaderCtrl && m_pHeaderCtrl->GetSafeHwnd( ))
00256                     m_pHeaderCtrl->SetSortImage( m_nSortedCol, m_bAscending );
00257             }
00258         }
00259         break;
00260
00261     // How to force a minimum column width Cees Mechielsen.
00262     // http://www.codeguru.com/mfc/comments/866.shtml
00263     case HDN_ITEMCHANGINGA:
00264     case HDN_ITEMCHANGINGW:
00265     case HDN_ENDTRACK:
00266         {
00267             if( pHDNotify->pitem->mask & HDI_WIDTH &&
00268                 pHDNotify->pitem->cxy < m_nMinSize &&
00269                 pHDNotify->pitem->cxy >= 0 )
00270             {
00271                 pHDNotify->pitem->cxy = m_nMinSize; // Set the column width
00272             }
00273         }
00274         break;
00275
00276     // Prevent CListCtrl column resizing by Zafir Anjum.
00277     // http://www.codeguru.com/listview/no_col_resize.shtml
00278     case HDN_DIVIDERDBLCLICKA:
00279     case HDN_DIVIDERDBLCLICKW:
00280     case HDN_BEGINTRACKW:
00281     case HDN_BEGINTRACKA:
00282         {
00283             if(m_bNoColSizing)
00284             {
00285                 *pResult = TRUE;                // disable tracking
00286                 return TRUE;                    // Processed message
00287             }
00288             break;
00289         }
00290     }
00291
00292     return CListView::OnNotify(wParam, lParam, pResult);
00293 }
00294
00295 bool CCJListView::SortList(int nCol, bool bAscending)
00296 {
00297 #ifdef _DEBUG
00298     TRACE2("Column sort on column index %d, ascending=%d", nCol, bAscending);
00299 #else
00300     UNUSED_ALWAYS( nCol );
00301     UNUSED_ALWAYS( bAscending );
00302 #endif
00303
00304     return true;
00305 }
00306
00307 // Taken from: Adding a column by Zafir Anjum.
00308 // http://www.codeguru.com/listview/add_column.shtml
00309
00310 // AddColumn      - adds column after the right most column
00311 // Returns        - the index of the new column if successful or -1 otherwise.
00312 // lpszColHeading - the column's heading
00313 // nWidth         - Width of the column, in pixels. If this parameter is -1,
00314 //                  the column width is the same as previous column
00315 // nFormat        - the alignment of the column. Can be LVCFMT_LEFT,
00316 //                  LVCFMT_RIGHT, or LVCFMT_CENTER.
00317 int CCJListView::AddColumn(LPCTSTR lpszColHeading, int nWidth/*=-1*/, int nFormat/*=LVCFMT_LEFT*/)
00318 {
00319     CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
00320     int nColumnCount = pHeader->GetItemCount();
00321
00322     if( nWidth == -1 )
00323     {
00324         // The line below return zero for ICON views
00325         //nWidth = GetColumnWidth( nColumnCount - 1 );
00326
00327         // Get the column width of the previous column from header control
00328         HD_ITEM hd_item;
00329         hd_item.mask = HDI_WIDTH;               //indicate that we want the width
00330         pHeader->GetItem( nColumnCount - 1, &hd_item );
00331         nWidth = hd_item.cxy;
00332     }
00333     return m_pListCtrl->InsertColumn( nColumnCount, lpszColHeading, nFormat, nWidth, nColumnCount );
00334 }
00335
00336 bool CCJListView::BuildColumns(int nCols, int* nWidth, int* nColString)
00337 {
00338     for( int i = 0; i < nCols; ++i ) {
00339         CString strTemp; strTemp.LoadString( nColString[i] );
00340         if(AddColumn(strTemp, nWidth[i])==-1)
00341             return false;
00342     }
00343
00344     return true;
00345 }
00346
00347 bool CCJListView::BuildColumns(int nCols, int* nWidth, CString* strColString)
00348 {
00349     for( int i = 0; i < nCols; ++i ) {
00350         if(AddColumn(strColString[i], nWidth[i])==-1)
00351             return false;
00352     }
00353
00354     return true;
00355 }
00356
00357 // Taken from: Detecting column index of the item clicked by Zafir Anjum.
00358 // http://www.codeguru.com/listview/col_index.shtml
00359
00360 // HitTestEx    - Determine the row index and column index for a point
00361 // Returns      - the row index or -1 if point is not over a row
00362 // point        - point to be tested.
00363 // nCol         - to hold the column index
00364 int CCJListView::HitTestEx(CPoint& point, int* nCol) const
00365 {
00366     int colnum = 0;
00367     int row = m_pListCtrl->HitTest( point, NULL );
00368
00369     if( nCol ) *nCol = 0;
00370
00371     // Make sure that the ListView is in LVS_REPORT
00372     if( (GetWindowLong(m_hWnd, GWL_STYLE) & LVS_TYPEMASK) != LVS_REPORT )
00373         return row;
00374
00375     // Get the top and bottom row visible
00376     row = m_pListCtrl->GetTopIndex();
00377     int bottom = row + m_pListCtrl->GetCountPerPage();
00378     if( bottom > m_pListCtrl->GetItemCount() )
00379         bottom = m_pListCtrl->GetItemCount();
00380
00381     // Get the number of columns
00382     CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
00383     int nColumnCount = pHeader->GetItemCount();
00384
00385     // Loop through the visible rows
00386     for( ;row <= bottom;row++)
00387     {
00388         // Get bounding rect of item and check whether point falls in it.
00389         CRect rect;
00390         m_pListCtrl->GetItemRect( row, &rect, LVIR_BOUNDS );
00391         if( rect.PtInRect(point) )
00392         {
00393             // Now find the column
00394             for( colnum = 0; colnum < nColumnCount; colnum++ )
00395             {
00396                 int colwidth = m_pListCtrl->GetColumnWidth(colnum);
00397                 if( point.x >= rect.left
00398                     && point.x <= (rect.left + colwidth ) )
00399                 {
00400                     if( nCol ) *nCol = colnum;
00401                     return row;
00402                 }
00403                 rect.left += colwidth;
00404             }
00405         }
00406     }
00407     return -1;
00408 }
00409
00410 bool CCJListView::SubclassHeader(bool bBoldFont/*=false*/)
00411 {
00412     // allocate memory for the flat header.
00413     m_pHeaderCtrl = new CCJFlatHeaderCtrl;
00414     ASSERT( m_pHeaderCtrl );
00415
00416     // get the window handle to the existing header
00417     // control.
00418     HWND hWnd = GetDlgItem(0)->GetSafeHwnd();
00419     ASSERT( hWnd );
00420
00421     // subclass the flat header control.
00422     if( !m_pHeaderCtrl->SubclassWindow( hWnd ))
00423         return false;
00424
00425     // finish header initialization.
00426     m_pHeaderCtrl->InitializeHeader( bBoldFont );
00427
00428     return true;
00429 }
00430
00431 void CCJListView::AutoSaveColumns(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszDefault)
00432 {
00433     m_bAutoSave = true;
00434
00435     // initialize registry strings.
00436     if( lpszSection == NULL ) m_strSection = _T("Settings");
00437     else m_strSection = lpszSection;
00438
00439     if( lpszEntry == NULL ) m_strEntry = _T("Column Info");
00440     else m_strEntry = lpszEntry;
00441
00442     if( lpszDefault == NULL ) m_strDefault = _T("");
00443     else m_strDefault = lpszDefault;
00444
00445     LoadColumnWidths();
00446 }
00447
00448 void CCJListView::SaveColumnWidths()
00449 {
00450     // get a pointer to the header control.
00451     CHeaderCtrl* pHeader = DYNAMIC_DOWNCAST(CHeaderCtrl, GetDlgItem(0));
00452     ASSERT_KINDOF( CHeaderCtrl, pHeader );
00453
00454     CString strValue;
00455     for( int i = 0; i < pHeader->GetItemCount(); ++i )
00456     {
00457         CString strTemp;
00458         strTemp.Format(_T("%d,"), m_pListCtrl->GetColumnWidth( i ));
00459         strValue += strTemp;
00460     }
00461
00462     AfxGetApp()->WriteProfileString( m_strSection, m_strEntry, strValue );
00463 }
00464
00465 void CCJListView::LoadColumnWidths()
00466 {
00467     // get a pointer to the header control.
00468     CHeaderCtrl* pHeader = DYNAMIC_DOWNCAST(CHeaderCtrl, GetDlgItem(0));
00469     ASSERT_KINDOF( CHeaderCtrl, pHeader );
00470
00471     for( int i = 0; i < pHeader->GetItemCount(); ++i )
00472         SetColumnWidth(i);
00473 }
00474
00475 void CCJListView::SetColumnWidth(int nCol)
00476 {
00477     int nWidth = GetStoredWidth( nCol );
00478     if( nWidth > m_nMinColWidth )
00479         m_pListCtrl->SetColumnWidth( nCol, nWidth );
00480     else
00481         AutoSizeColumn( nCol );
00482 }
00483
00484 int CCJListView::GetStoredWidth(int nCol)
00485 {
00486     // get the value from the registry.
00487     CString strValue = AfxGetApp()->GetProfileString(
00488         m_strSection, m_strEntry, m_strDefault );
00489
00490     // extract the sub string to get the column width.
00491     CString strSubString;
00492     AfxExtractSubString( strSubString, strValue, nCol, _T(','));
00493
00494     // return the width from the registry.
00495     return _ttoi( strSubString );
00496 }
00497
00498 void CCJListView::OnDestroy()
00499 {
00500     if( m_bAutoSave ) SaveColumnWidths();
00501     CListView::OnDestroy();
00502 }
00503
00504 // Taken from: Autosize a column to fit its content by Roger Onslow.
00505 // http://www.codeguru.com/listview/autosize_col.shtml
00506 // If you don't supply a column number, it will resize all columns.
00507 void CCJListView::AutoSizeColumn(int nCol/*=-1*/)
00508 {
00509     // Call this after your list control is filled
00510     SetRedraw( false );
00511
00512     int nMinCol = nCol < 0 ? 0 : nCol;
00513     int nMaxCol = nCol < 0 ? GetColumnCount()-1 : nCol;
00514
00515     for (nCol = nMinCol; nCol <= nMaxCol; nCol++)
00516     {
00517         m_pListCtrl->SetColumnWidth( nCol, LVSCW_AUTOSIZE );
00518         int wc1 = m_pListCtrl->GetColumnWidth( nCol );
00519
00520         m_pListCtrl->SetColumnWidth( nCol, LVSCW_AUTOSIZE_USEHEADER );
00521         int wc2 = m_pListCtrl->GetColumnWidth( nCol );
00522         int wc = max( m_nMinColWidth, max( wc1, wc2 ));
00523
00524         if( wc > m_nMaxColWidth )
00525             wc = m_nMaxColWidth;
00526
00527         // set the column width.
00528         m_pListCtrl->SetColumnWidth( nCol,wc );
00529     }
00530
00531     SetRedraw();
00532 }
00533
00534 BOOL CCJListView::OnEraseBkgnd(CDC* pDC)
00535 {
00536     CRect rectClient;
00537     GetClientRect( &rectClient );
00538     pDC->ExcludeClipRect( &rectClient );
00539     return CListView::OnEraseBkgnd(pDC);
00540 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJLogoPane.cpp Source File

WinCvs/CJLib/CJLibrary/CJLogoPane.cpp

Go to the documentation of this file.
00001 // CJLogoPane.cpp : implementation file
00002 //
00003 // Copyright © 1999 Pierre MELLINAND
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.1 $
00010  * $Archive: /CodeJock/CJLibrary/CJLogoPane.cpp $
00011  *
00012  * $History: CJLogoPane.cpp $
00013  *
00014  * *****************  Version 1  *****************
00015  * User: Kirk Stowell Date: 10/26/99   Time: 11:08p
00016  * Created in $/CodeJock/CJLibrary
00017  *
00018  ***************************************************************************/
00020
00021 #include "StdAfx.h"
00022 #include "CJLogoPane.h"
00023
00024 #ifdef _DEBUG
00025 #define new DEBUG_NEW
00026 #undef THIS_FILE
00027 static char THIS_FILE[] = __FILE__;
00028 #endif
00029
00031 // CCJLogoPane
00032
00033 CCJLogoPane::CCJLogoPane()
00034 {
00035     SetLogoFont(_T("Arial"));
00036 }
00037
00038 CCJLogoPane::~CCJLogoPane()
00039 {
00040     m_Font.DeleteObject();
00041 }
00042
00043 IMPLEMENT_DYNCREATE(CCJLogoPane, CWnd)
00044
00045 BEGIN_MESSAGE_MAP(CCJLogoPane, CWnd)
00046     //{{AFX_MSG_MAP(CCJLogoPane)
00047     ON_WM_PAINT()
00048     //}}AFX_MSG_MAP
00049 END_MESSAGE_MAP()
00050
00052 // CCJLogoPane message handlers
00053
00054 void CCJLogoPane::SetLogoFont(LPCTSTR lpszFontName, int nHeight/*=24*/,
00055     int nWeight/*=FW_BOLD*/, BOOL bItalic/*=TRUE*/, BOOL bUnderline/*=FALSE*/)
00056 {
00057     if(m_Font.m_hObject) {
00058         m_Font.DeleteObject();
00059     }
00060
00061     m_Font.CreateFont(nHeight, 0, 0, 0, nWeight, (BYTE)bItalic, (BYTE)bUnderline, 0,0,0,0,0,0, lpszFontName);
00062 }
00063
00064 void CCJLogoPane::OnPaint()
00065 {
00066     CPaintDC dc(this); // device context for painting
00067
00068     CRect rect;
00069     GetWindowRect(rect);
00070
00071     dc.SetBkMode(TRANSPARENT);
00072
00073     CFont * OldFont = dc.SelectObject(&m_Font);
00074
00075     // draw text in DC
00076     COLORREF OldColor = dc.SetTextColor(::GetSysColor( COLOR_3DHILIGHT));
00077
00078     rect.right  = rect.Width();
00079     rect.bottom = rect.Height();
00080     rect.left   = rect.top = 0;
00081     dc.FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE));
00082
00083     dc.DrawText( m_strLogoText, rect + CPoint(1,1), DT_SINGLELINE | DT_LEFT | DT_VCENTER);
00084     dc.SetTextColor( ::GetSysColor( COLOR_3DSHADOW));
00085     dc.DrawText( m_strLogoText, rect, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
00086
00087     // restore old text color
00088     dc.SetTextColor( OldColor);
00089     // restore old font
00090     dc.SelectObject(OldFont);
00091 }
00092
00093 BOOL CCJLogoPane::Create(LPCTSTR lpszWindowName, DWORD dwStyle, CWnd* pParentWnd, UINT nID)
00094 {
00095     CString wndClass = ::AfxRegisterWndClass(CS_BYTEALIGNCLIENT);
00096
00097     if(!CWnd::Create(wndClass, lpszWindowName, dwStyle, CRect(0,0,0,0), pParentWnd, nID)) {
00098         return FALSE;
00099     }
00100
00101     m_strLogoText = lpszWindowName;
00102     return TRUE;
00103 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJMaskEdit.cpp Source File

WinCvs/CJLib/CJLibrary/CJMaskEdit.cpp

Go to the documentation of this file.
00001 // CJMaskEdit.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the article "A masked edit control (2)" by Jeremy Davis [jmd@jvf.co.uk]
00006 // http://www.codeguru.com/editctrl/masked_edit2.shtml
00007 //
00009 /****************************************************************************
00010  *
00011  * $Date: 1999/11/30 21:45:49 $
00012  * $Revision: 1.1.1.3 $
00013  * $Archive: /CodeJock/CJLibrary/CJMaskEdit.cpp $
00014  *
00015  * $History: CJMaskEdit.cpp $
00016  *
00017  * *****************  Version 11  *****************
00018  * User: Kirk Stowell Date: 10/30/99   Time: 1:53p
00019  * Updated in $/CodeJock/CJLibrary
00020  * Overrode OnEraseBkgnd(...) and OnPaint(...) to handle flicker free
00021  * drawing.
00022  *
00023  * *****************  Version 10  *****************
00024  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00025  * Updated in $/CodeJock/CJLibrary
00026  * Fixed potential resource and memory leak problems.
00027  *
00028  * *****************  Version 9  *****************
00029  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00030  * Updated in $/CodeJockey/CJLibrary
00031  * Updated copyright and contact information.
00032  *
00033  * *****************  Version 8  *****************
00034  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00035  * Updated in $/CodeJockey/CJLibrary
00036  * Added Unicode compliance, thanks to Barry Burton for his help with
00037  * this.
00038  *
00039  *
00040  * *****************  Version 7  *****************
00041  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00042  * Updated in $/CodeJockey/CJLibrary
00043  *
00044  * *****************  Version 6  *****************
00045  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00046  * Updated in $/CodeJockey/CJLibrary
00047  *
00048  * *****************  Version 5  *****************
00049  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00050  * Updated in $/CodeJockey/CJLibrary
00051  *
00052  * *****************  Version 4  *****************
00053  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00054  * Updated in $/CodeJockey/CJLibrary
00055  *
00056  * *****************  Version 3  *****************
00057  * User: Kirk Stowell Date: 7/25/99    Time: 12:15a
00058  * Updated in $/CodeJockey/CJLibrary
00059  *
00060  * *****************  Version 2  *****************
00061  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00062  * Updated in $/CodeJockey/CJLibrary
00063  *
00064  * *****************  Version 1  *****************
00065  * User: Kirk Stowell Date: 7/19/99    Time: 12:35a
00066  * Created in $/CodeJockey/CJLibrary
00067  * Initial creation and addition to library.
00068  *
00069  ***************************************************************************/
00071
00072 #include "StdAfx.h"
00073 #include "CJMaskEdit.h"
00074
00075 #ifdef _DEBUG
00076 #define new DEBUG_NEW
00077 #undef THIS_FILE
00078 static char THIS_FILE[] = __FILE__;
00079 #endif
00080
00082 // CCJMaskEdit
00083
00084 CCJMaskEdit::CCJMaskEdit()
00085 {
00086     m_bUseMask              = true;
00087     m_bMaskKeyInProgress    = false;
00088     m_strWindowText         = _T("");
00089     m_strMask               = _T("");
00090     m_strLiteral            = _T("");
00091     m_strValid              = _T("");
00092     m_strMaskLiteral        = _T("");
00093 }
00094
00095 CCJMaskEdit::~CCJMaskEdit()
00096 {
00097     // fix potential resource leak - KStowell - 10-22-99.
00098     m_Font.DeleteObject();
00099 }
00100
00101 IMPLEMENT_DYNAMIC(CCJMaskEdit, CEdit)
00102
00103 BEGIN_MESSAGE_MAP(CCJMaskEdit, CEdit)
00104     //{{AFX_MSG_MAP(CCJMaskEdit)
00105     ON_WM_KEYDOWN()
00106     ON_WM_CHAR()
00107     ON_WM_ERASEBKGND()
00108     ON_WM_PAINT()
00109     //}}AFX_MSG_MAP
00110 END_MESSAGE_MAP()
00111
00113 // CCJMaskEdit message handlers
00114
00115 void CCJMaskEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
00116 {
00117     if( m_bUseMask )
00118     {
00119         switch( nChar )
00120         {
00121         case VK_DELETE:
00122         case VK_INSERT: return;
00123         }
00124     }
00125
00126     CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
00127 }
00128
00129 void CCJMaskEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
00130 {
00131     if( !m_bMaskKeyInProgress ) {
00132         if( !CheckChar( nChar )) {
00133             return;
00134         }
00135     }
00136
00137     if( m_bUseMask )
00138     {
00139         int nStartPos;
00140         int nEndPos;
00141         GetSel( nStartPos, nEndPos );
00142
00143         if( isprint( nChar ))
00144         {
00145             SetSel( nStartPos, nEndPos+1 );
00146
00147             Clear();
00148
00149             m_strWindowText.SetAt( nEndPos, static_cast<TCHAR>(nChar));
00150         }
00151         else if( nChar == VK_BACK )
00152         {
00153             if(( nStartPos == nEndPos ) &&
00154                ( nStartPos >= 1 ) &&
00155                ( nStartPos <= m_strWindowText.GetLength( )))
00156             {
00157                 UINT c = 0x20;
00158
00159                 // get the masked literal representation.
00160                 if( m_strMaskLiteral.IsEmpty() == FALSE )
00161                 {
00162                     c = m_strMaskLiteral[ nStartPos - 1 ];
00163                 }
00164
00165                 // backspace the cursor.
00166                 SendMessage( WM_KEYDOWN, VK_LEFT, 0 );
00167
00168                 if( m_strMaskLiteral.IsEmpty() == FALSE )
00169                 {
00170                     // update the char backspacing over.
00171                     SendChar( c );
00172
00173                     // backspace the cursor again.
00174                     SendMessage( WM_KEYDOWN, VK_LEFT, 0 );
00175                 }
00176             }
00177             else
00178             {
00179                 MessageBeep((UINT)-1);
00180             }
00181
00182             return;
00183         }
00184     }
00185
00186     CEdit::OnChar(nChar, nRepCnt, nFlags);
00187
00188     if( !m_bMaskKeyInProgress && m_bUseMask && !m_strLiteral.IsEmpty( ))
00189     {
00190         int nStartPos;
00191         int nEndPos;
00192         GetSel( nStartPos, nEndPos );
00193
00194         // make sure the string is not longer than the mask
00195         if( nEndPos < m_strLiteral.GetLength( ))
00196         {
00197             UINT c = m_strLiteral.GetAt( nEndPos );
00198             if (c != '_') {
00199                 SetSel( nEndPos+1, nEndPos+1 );
00200             }
00201         }
00202     }
00203 }
00204
00205 bool CCJMaskEdit::CheckChar(UINT nChar)
00206 {
00207     // do not use mask
00208     if( !m_bUseMask ) {
00209         return true;
00210     }
00211
00212     // control character, OK
00213     if( !isprint( nChar )) {
00214         return true;
00215     }
00216
00217     // unselect all selections, if any
00218     int nStartPos, nEndPos;
00219     GetSel( nStartPos, nEndPos );
00220     SetSel( -1, 0 );
00221
00222     // advance to the first character input position.
00223     for( nStartPos; nStartPos < m_strLiteral.GetLength(); ++nStartPos )
00224     {
00225         if( m_strLiteral.GetAt( nStartPos ) == '_' ) {
00226             SetSel( nStartPos, nStartPos );
00227             break;
00228         }
00229     }
00230
00231     // check the key against the mask
00232     GetSel( nStartPos, nEndPos );
00233
00234     // make sure the string is not longer than the mask
00235     if( nEndPos >= m_strMask.GetLength( )) {
00236         MessageBeep((UINT)-1);
00237         return false;
00238     }
00239
00240     // check to see if a literal is in this position
00241     UINT c = '_';
00242     if( !m_strLiteral.IsEmpty( )) {
00243         c = m_strLiteral.GetAt( nEndPos );
00244     }
00245
00246     if( c != '_' ) {
00247         SendChar( c );
00248         GetSel( nStartPos, nEndPos );
00249     }
00250
00251     // check the valid string character
00252     if( m_strValid.Find( static_cast<TCHAR>(nChar)) != -1 ) {
00253         return true;
00254     }
00255
00256     if( ProcessMask( nChar, nEndPos ))
00257         return true;
00258
00259     MessageBeep((UINT)-1);
00260     return false;
00261 }
00262
00263 void CCJMaskEdit::SendChar(UINT nChar)
00264 {
00265     m_bMaskKeyInProgress = true;
00266 #ifdef WIN32
00267     AfxCallWndProc(this, m_hWnd, WM_CHAR, nChar, 1);
00268 #else
00269     SendMessage(WM_CHAR, nChar, 1);
00270 #endif
00271     m_bMaskKeyInProgress = false;
00272 }
00273
00274 bool CCJMaskEdit::ProcessMask(UINT nChar, int nEndPos)
00275 {
00276     // check the key against the mask
00277     switch( m_strMask.GetAt( nEndPos ))
00278     {
00279     case '0':       // digit only //completely changed this
00280         {
00281             if( isdigit( nChar )) {
00282                 return true;
00283             }
00284             break;
00285         }
00286     case '9':       // digit or space
00287         {
00288             if( isdigit( nChar )) {
00289                 return true;
00290             }
00291             if( nChar == VK_SPACE ) {
00292                 return true;
00293             }
00294             break;
00295         }
00296     case '#':       // digit or space or '+' or '-'
00297         {
00298             if( isdigit( nChar )) {
00299                 return true;
00300             }
00301             if( nChar == VK_SPACE || nChar == VK_ADD || nChar == VK_SUBTRACT ) {
00302                 return true;
00303             }
00304             break;
00305         }
00306     case 'L':       // alpha only
00307         {
00308             if( isalpha( nChar )) {
00309                 return true;
00310             }
00311             break;
00312         }
00313     case '?':       // alpha or space
00314         {
00315             if( isalpha( nChar )) {
00316                 return true;
00317             }
00318             if( nChar == VK_SPACE ) {
00319                 return true;
00320             }
00321             break;
00322         }
00323     case 'A':       // alpha numeric only
00324         {
00325             if( isalnum( nChar )) {
00326                 return true;
00327             }
00328             break;
00329         }
00330     case 'a':       // alpha numeric or space
00331         {
00332             if( isalnum( nChar )) {
00333                 return true;
00334             }
00335             if( nChar == VK_SPACE ) {
00336                 return true;
00337             }
00338             break;
00339         }
00340     case '&':       // all print character only
00341         {
00342             if( isprint( nChar )) {
00343                 return true;
00344             }
00345             break;
00346         }
00347     case 'H':       // hex digit
00348         {
00349             if( isxdigit( nChar )) {
00350                 return true;
00351             }
00352             break;
00353         }
00354     case 'X':       // hex digit or space
00355         {
00356             if( isxdigit( nChar )) {
00357                 return true;
00358             }
00359             if( nChar == VK_SPACE ) {
00360                 return true;
00361             }
00362             break;
00363         }
00364     }
00365
00366     return false;
00367 }
00368
00369 void CCJMaskEdit::SetEditMask(LPCTSTR lpszMask, LPCTSTR lpszLiteral, LPCTSTR lpszWindowText)
00370 {
00371     ASSERT(lpszMask);
00372     ASSERT(lpszLiteral);
00373     ASSERT(lpszWindowText);
00374
00375     // initialize the mask for the control.
00376     m_strMask        = lpszMask;
00377     m_strLiteral     = lpszLiteral;
00378     m_strWindowText  = lpszWindowText;
00379     m_strMaskLiteral = m_strWindowText;
00380
00381     // set the window text for the control.
00382     SetWindowText( lpszWindowText );
00383
00384     // initialize the font used by the control.
00385     UpdateFont();
00386 }
00387
00389 // DDX for date mask control
00390
00391 void AFXAPI DDX_OleDateTime(CDataExchange* pDX, int nIDC, CCJDateEdit& rControl, COleDateTime& rDateTime)
00392 {
00393     DDX_Control( pDX, nIDC, rControl );
00394
00395     if( pDX->m_bSaveAndValidate ) {
00396         rDateTime = rControl.GetDateTime();
00397     }
00398     else {
00399         rControl.SetDateTime( rDateTime );
00400     }
00401 }
00402
00404 // CCJDateEdit class
00405
00406 IMPLEMENT_DYNAMIC(CCJDateEdit, CCJMaskEdit)
00407
00408 CCJDateEdit::CCJDateEdit()
00409 {
00410     m_bUseMask      = true;
00411     m_strMask       = _T("00/00/0000");
00412     m_strLiteral    = _T("__/__/____");
00413 }
00414
00415 COleDateTime CCJDateEdit::ReadOleDateTime(LPCTSTR lpszData)
00416 {
00417     COleDateTime dt;
00418     dt.ParseDateTime(lpszData);
00419     return dt;
00420 }
00421
00422 void CCJDateEdit::FormatOleDateTime(CString &strData, COleDateTime dt)
00423 {
00424     strData = dt.Format( _T("%d/%m/%Y"));
00425 }
00426
00427 void CCJDateEdit::SetDateTime(COleDateTime& dt)
00428 {
00429     CString strText;
00430     FormatOleDateTime(strText, dt);
00431     m_strWindowText = m_strMaskLiteral = strText;
00432     SetWindowText(strText);
00433 }
00434
00435 void CCJDateEdit::SetDateTime(CString strDate)
00436 {
00437     m_strWindowText = m_strMaskLiteral = strDate;
00438     SetWindowText(strDate);
00439 }
00440
00441 COleDateTime CCJDateEdit::GetDateTime()
00442 {
00443     CString strText;
00444     GetWindowText(strText);
00445     return ReadOleDateTime(strText);
00446 }
00447
00448 CString CCJDateEdit::GetWindowDateTime()
00449 {
00450     CString strText;
00451     GetWindowText(strText);
00452     return strText;
00453 }
00454
00455 bool CCJDateEdit::ProcessMask(UINT nChar, int nEndPos)
00456 {
00457     // check the key against the mask
00458     switch( m_strMask.GetAt( nEndPos ))
00459     {
00460     case '0':       // digit only //completely changed this
00461         {
00462             bool bReturn = true;
00463
00464             if( isdigit( nChar ))
00465             {
00466                 if( nEndPos == 0 )
00467                 {
00468                     if( nChar > '3' ) {
00469                         bReturn = false;
00470                     }
00471                 }
00472                 else if( nEndPos == 1 )
00473                 {
00474                     if( m_strWindowText.GetAt(0) == '3' )
00475                     {
00476                         if( nChar > '1' ) {
00477                             bReturn = false;
00478                         }
00479                     }
00480                 }
00481                 else if( nEndPos == 3 )
00482                 {
00483                     if( nChar > '1' ) {
00484                         bReturn = false;
00485                     }
00486                 }
00487                 else if( nEndPos == 4 )
00488                 {
00489                     if( m_strWindowText.GetAt(3) == '1' )
00490                     {
00491                         if( nChar > '2') {
00492                             bReturn = false;
00493                         }
00494                     }
00495                 }
00496                 return bReturn;
00497             }
00498             break;
00499         }
00500     }
00501
00502     MessageBeep((UINT)-1);
00503     return false;
00504 }
00505
00507 // CCJTimeEdit class
00508
00509 IMPLEMENT_DYNAMIC(CCJTimeEdit, CCJDateEdit)
00510
00511 CCJTimeEdit::CCJTimeEdit()
00512 {
00513     m_bUseMask      = true;
00514     m_strMask       = _T("00:00");
00515     m_strLiteral    = _T("__:__");
00516     m_strHours      = _T("47");
00517     m_strMins       = _T("59");
00518 }
00519
00520 void CCJTimeEdit::FormatOleDateTime(CString &strData, COleDateTime dt)
00521 {
00522     if( dt.m_dt == 0 ) {
00523         strData = "00:00";
00524     }
00525     else {
00526         strData = dt.Format( _T("%H:%M"));
00527     }
00528 }
00529
00530 bool CCJTimeEdit::ProcessMask(UINT nChar, int nEndPos)
00531 {
00532     // check the key against the mask
00533     switch( m_strMask.GetAt( nEndPos ))
00534     {
00535     case '0':       // digit only //completely changed this
00536         {
00537             bool bReturn = true;
00538
00539             if( isdigit( nChar ))
00540             {
00541                 if( nEndPos == 0 )
00542                 {
00543                     if(nChar > (UINT)m_strHours[0]) {
00544                         bReturn = false;
00545                     }
00546                 }
00547                 else if( nEndPos == 1 )
00548                 {
00549                     if(m_strWindowText.GetAt(0) == m_strHours[0])
00550                     {
00551                         if( nChar > (UINT)m_strHours[1] ) {
00552                             bReturn = false;
00553                         }
00554                     }
00555                 }
00556                 else if( nEndPos == 3 )
00557                 {
00558                     if( nChar > (UINT)m_strMins[0] ) {
00559                         bReturn = false;
00560                     }
00561                 }
00562                 else if( nEndPos == 4 )
00563                 {
00564                     if( m_strWindowText.GetAt(3) == m_strMins[0] )
00565                     {
00566                         if( nChar > (UINT)m_strMins[1] ) {
00567                             bReturn = false;
00568                         }
00569                     }
00570                 }
00571                 return bReturn;
00572             }
00573             break;
00574         }
00575     }
00576
00577     MessageBeep((UINT)-1);
00578     return false;
00579 }
00580
00581 void CCJTimeEdit::SetHours(int nHours)
00582 {
00583     m_strHours.Format( _T("%d"), nHours);
00584 }
00585
00586 void CCJTimeEdit::SetMins(int nMins)
00587 {
00588     m_strMins.Format( _T("%d"), nMins);
00589 }
00590
00591 void CCJMaskEdit::UpdateFont()
00592 {
00593     m_Font.DeleteObject();
00594     NONCLIENTMETRICS ncm;
00595     ncm.cbSize = sizeof(ncm);
00596     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00597     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00598     SetFont(&m_Font);
00599 }
00600
00601 BOOL CCJMaskEdit::OnEraseBkgnd(CDC* pDC)
00602 {
00603     // KStowell - overridden for flicker-free drawing.
00604     UNUSED_ALWAYS(pDC);
00605     return TRUE;
00606 }
00607
00608 void CCJMaskEdit::OnPaint()
00609 {
00610     // Use a "Offscreen" DC to fill rect and send to DefWindowProc...
00611     CClientDC memDC(this);
00612
00613     CRect rcClip;
00614     GetClientRect(&rcClip);
00615     memDC.FillSolidRect(rcClip, ::GetSysColor(COLOR_WINDOW));
00616     DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, (LPARAM)0 );
00617
00618     // Default is called for cleanup.
00619     Default();
00620 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJMDIChildWnd.cpp Source File

WinCvs/CJLib/CJLibrary/CJMDIChildWnd.cpp

Go to the documentation of this file.
00001 // CJMDIChildWnd.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJMDIChildWnd.cpp $
00011  *
00012  * $History: CJMDIChildWnd.cpp $
00013  *
00014  * *****************  Version 6  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:02p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Overrode OnEraseBkgnd(...) for flicker free drawing.
00018  *
00019  * *****************  Version 5  *****************
00020  * User: Kirk Stowell Date: 10/26/99   Time: 10:56p
00021  * Updated in $/CodeJock/CJLibrary
00022  * Added variables to hold menu and toolbar resource ids for use with menu
00023  * bar initialization.
00024  *
00025  * *****************  Version 4  *****************
00026  * User: Kirk Stowell Date: 10/06/99   Time: 6:21a
00027  * Updated in $/CodeJockey/CJLibrary
00028  * Added cool menu support for MDI applications that do not have a
00029  * document/view architecture. Added GetInitializedMenu() to
00030  * CCJMDIChildWnd which will initialize the menu for a given view,  and
00031  * overloaded InitializeMenu() in CCJMDIFrameWnd. Thanks to Golovanov
00032  * Michael [Golovanov@SoftLab.RU] for help with this.
00033  *
00034  * *****************  Version 3  *****************
00035  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00036  * Updated in $/CodeJockey/CJLibrary
00037  * Updated copyright and contact information.
00038  *
00039  * *****************  Version 2  *****************
00040  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00041  * Updated in $/CodeJockey/CJLibrary
00042  *
00043  * *****************  Version 1  *****************
00044  * User: Kirk Stowell Date: 6/26/99    Time: 8:30p
00045  * Created in $/CodeJockey/CJLibrary
00046  * Initial creation. Added to library to allow CCJControlBar and
00047  * CCJToolBar docking.
00048  *
00049  ***************************************************************************/
00051
00052 #include "stdafx.h"
00053 #include "CJMDIChildWnd.h"
00054 #include "CJDockBar.h"
00055 #include "CJSizeDockBar.h"
00056 #include "CJControlBar.h"
00057 #include "CJMiniDockFrameWnd.h"
00058 #include "CJToolBar.h"
00059 #include "CJMDIFrameWnd.h"
00060
00061 #ifdef _DEBUG
00062 #define new DEBUG_NEW
00063 #undef THIS_FILE
00064 static char THIS_FILE[] = __FILE__;
00065 #endif
00066
00068 // CCJMDIChildWnd
00069
00070 IMPLEMENT_DYNCREATE(CCJMDIChildWnd, CMDIChildWnd)
00071
00072 CCJMDIChildWnd::CCJMDIChildWnd()
00073 {
00074     m_hMenu       = NULL;
00075     m_nToolBarIDs = NULL;
00076     m_nMenuID     = 0;
00077     m_nToolBarID  = 0;
00078     m_nCount      = 0;
00079 }
00080
00081 CCJMDIChildWnd::~CCJMDIChildWnd()
00082 {
00083 }
00084
00085
00086 BEGIN_MESSAGE_MAP(CCJMDIChildWnd, CMDIChildWnd)
00087     //{{AFX_MSG_MAP(CCJMDIChildWnd)
00088     ON_WM_ERASEBKGND()
00089     //}}AFX_MSG_MAP
00090 END_MESSAGE_MAP()
00091
00093 // CCJMDIChildWnd message handlers
00094
00095 // dwDockBarMap
00096 DWORD CCJMDIChildWnd::dwDockBarMap[4][2] =
00097 {
00098     { AFX_IDW_DOCKBAR_TOP,      CBRS_TOP    },
00099     { AFX_IDW_DOCKBAR_BOTTOM,   CBRS_BOTTOM },
00100     { AFX_IDW_DOCKBAR_LEFT,     CBRS_LEFT   },
00101     { AFX_IDW_DOCKBAR_RIGHT,    CBRS_RIGHT  },
00102 };
00103
00104 void CCJMDIChildWnd::DockControlBarLeftOf(CControlBar* Bar, CControlBar* LeftOf)
00105 {
00106     CRect rect;
00107     DWORD dw;
00108     UINT n;
00109
00110     // get MFC to adjust the dimensions of all docked ToolBars
00111     // so that GetWindowRect will be accurate
00112     RecalcLayout(TRUE);
00113
00114     LeftOf->GetWindowRect(&rect);
00115     rect.OffsetRect(1,0);
00116     dw=LeftOf->GetBarStyle();
00117     n = 0;
00118     n = (dw&CBRS_ALIGN_TOP)              ? AFX_IDW_DOCKBAR_TOP      : n;
00119     n = (dw&CBRS_ALIGN_BOTTOM   && n==0) ? AFX_IDW_DOCKBAR_BOTTOM   : n;
00120     n = (dw&CBRS_ALIGN_LEFT     && n==0) ? AFX_IDW_DOCKBAR_LEFT     : n;
00121     n = (dw&CBRS_ALIGN_RIGHT    && n==0) ? AFX_IDW_DOCKBAR_RIGHT    : n;
00122
00123     // When we take the default parameters on rect, DockControlBar will dock
00124     // each Toolbar on a seperate line. By calculating a rectangle, we in effect
00125     // are simulating a Toolbar being dragged to that location and docked.
00126     DockControlBar(Bar,n,&rect);
00127 }
00128
00129 void CCJMDIChildWnd::EnableDocking(DWORD dwDockStyle)
00130 {
00131     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00132     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00133     CMDIChildWnd::EnableDocking(dwDockStyle);
00134
00135     for (int i = 0; i < 4; i++) {
00136         if (dwDockBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY) {
00137             CDockBar* pDock = (CDockBar*)GetControlBar(dwDockBarMap[i][0]);
00138
00139             // make sure the dock bar is of correct type
00140             if( pDock || !pDock->IsKindOf(RUNTIME_CLASS(CCJDockBar)) ) {
00141                 BOOL bNeedDelete = ! pDock->m_bAutoDelete;
00142                 pDock->m_pDockSite->RemoveControlBar(pDock);
00143                 pDock->m_pDockSite = 0; // avoid problems in destroying the dockbar
00144                 pDock->DestroyWindow();
00145                 if( bNeedDelete )
00146                     delete pDock;
00147                 pDock = 0;
00148             }
00149
00150             if( pDock == 0 ) {
00151                 pDock = new CCJDockBar;
00152                 if (!pDock->Create(this,
00153                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00154                     dwDockBarMap[i][1], dwDockBarMap[i][0])) {
00155                     AfxThrowResourceException();
00156                 }
00157             }
00158         }
00159     }
00160 }
00161
00162 void CCJMDIChildWnd::RecalcLayout(BOOL bNotify)
00163 {
00164     CMDIChildWnd::RecalcLayout(bNotify);
00165     RecalcAllExcept(NULL);
00166 }
00167
00168 // Yiannhs changed this
00169 void CCJMDIChildWnd::EnableDockingSizeBar(DWORD dwDockStyle, DockFlatBorders FlatFlags )
00170 {
00171     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00172     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00173
00174     m_pFloatingFrameClass = RUNTIME_CLASS(CCJMiniDockFrameWnd);
00175     for (int i = 0; i < 4; i++)
00176     {
00177         if (dwSizeBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY)
00178         {
00179             CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00180             if (pDock == NULL)
00181             {
00182                 pDock = new CCJSizeDockBar;
00183
00184                 if (!pDock->Create(this,
00185                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00186                         dwSizeBarMap[i][1], dwSizeBarMap[i][0]))
00187                 {
00188                     AfxThrowResourceException();
00189                 }
00190                 //Yiannhs enable Flat Borders For dock Bars
00191                 pDock->FlatBorder( (FlatFlags >> i) & 0x0001 );
00192             }
00193         }
00194     }
00195 }
00196
00197 void CCJMDIChildWnd::RecalcAllExcept(CCJSizeDockBar *pBar)
00198 {
00199     for (int i = 0; i < 4; i++)
00200     {
00201         CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00202         if (pDock != NULL && pDock != pBar)
00203         {
00204             pDock->CalcSizeBarLayout();
00205         }
00206     }
00207 }
00208
00209 void CCJMDIChildWnd::DockSizeBar(CControlBar * pBar,CCJSizeDockBar *pDockBar, LPRECT lpRect)
00210 {
00211     ASSERT(pBar != NULL);
00212     ASSERT(pBar->m_pDockContext != NULL);
00213
00214     if( pDockBar == NULL )
00215     {
00216         for (int i = 0; i < 4; i++)
00217         {
00218             if ((dwSizeBarMap[i][1] & CBRS_ALIGN_ANY) == (pBar->m_dwStyle & CBRS_ALIGN_ANY))
00219             {
00220                 pDockBar = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00221                 ASSERT(pDockBar != NULL);
00222
00223                 int nSize = 0;
00224
00225                 switch(i)
00226                 {
00227                 case 0: // horizontal dock
00228                 case 1:
00229                     nSize = ((CCJControlBar*)pBar)->GetHorzSize();
00230                     break;
00231                 case 2: // vertical dock
00232                 case 3:
00233                     nSize = ((CCJControlBar*)pBar)->GetVertSize();
00234                     break;
00235                 }
00236
00237                 pDockBar->SetActualSize( nSize );
00238                 break;
00239             }
00240         }
00241     }
00242
00243     ASSERT(pDockBar != NULL);
00244     ASSERT(m_listControlBars.Find(pBar) != NULL);
00245     ASSERT(pBar->m_pDockSite == this);
00246     ((CCJControlBar*)pBar)->Normalize();
00247     pDockBar->DockControlBar(pBar, lpRect);
00248 }
00249
00250 HMENU CCJMDIChildWnd::GetInitializedMenu(UINT nMenuID, UINT nToolBarID)
00251 {
00252     if( m_hMenu ) {
00253         return m_hMenu;
00254     }
00255
00256     CCJMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CCJMDIFrameWnd, GetParentFrame());
00257     if( pMainFrame ) {
00258         pMainFrame->InitializeMenu( &m_hMenu, nMenuID, nToolBarID );
00259         m_nMenuID     = nMenuID;
00260         m_nToolBarID  = nToolBarID;
00261     }
00262
00263     return m_hMenu;
00264 }
00265
00266 HMENU CCJMDIChildWnd::GetInitializedMenu(UINT nMenuID, UINT* nToolbarIDs, int nSize)
00267 {
00268     if( m_hMenu ) {
00269         return m_hMenu;
00270     }
00271
00272     CCJMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CCJMDIFrameWnd, GetParentFrame());
00273     if( pMainFrame ) {
00274         pMainFrame->InitializeMenu( &m_hMenu, nMenuID, nToolbarIDs, nSize);
00275         m_nMenuID     = nMenuID;
00276         m_nToolBarIDs = nToolbarIDs;
00277         m_nCount      = nSize;
00278     }
00279
00280     return m_hMenu;
00281 }
00282
00283 BOOL CCJMDIChildWnd::OnEraseBkgnd(CDC* pDC)
00284 {
00285     CRect rect;
00286     GetClientRect(&rect);
00287     pDC->ExcludeClipRect(rect);
00288
00289     return CMDIChildWnd::OnEraseBkgnd(pDC);
00290 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJMDIFrameWnd.cpp Source File

WinCvs/CJLib/CJLibrary/CJMDIFrameWnd.cpp

Go to the documentation of this file.
00001 // CJMDIFrameWnd.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJMDIFrameWnd.cpp $
00011  *
00012  * $History: CJMDIFrameWnd.cpp $
00013  *
00014  * *****************  Version 17  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:04p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Minor update to PreCreateWindow(...) for flicker free drawing.
00018  *
00019  * *****************  Version 16  *****************
00020  * User: Kirk Stowell Date: 10/29/99   Time: 12:43a
00021  * Updated in $/CodeJock/CJLibrary
00022  * Overloaded PreCreateWindow(...) for flicker free drawing.
00023  *
00024  * *****************  Version 15  *****************
00025  * User: Kirk Stowell Date: 10/14/99   Time: 11:55p
00026  * Updated in $/CodeJock/CJLibrary
00027  * Fixed possible access violations in NewMenu methods. Thanks to Gero
00028  * Kuehn [gero.kuehn@isc-soft.de] for help with this.
00029  *
00030  * *****************  Version 14  *****************
00031  * User: Kirk Stowell Date: 10/14/99   Time: 6:15p
00032  * Updated in $/CodeJock/CJLibrary
00033  * Fixed bug with a document becomes the active document when the user
00034  * clicks inside a tab in the CCJTabControlBar to perform some operation.
00035  * When closing the application, MFC decides in CFrameWnd::OnClose() to
00036  * check if the 'active' document is modified before checking all other
00037  * documuents. If the active document is not modified and can close its
00038  * frame, it does not check other documents individually and shuts down
00039  * without asking the important 'modified save' questions. To fix this,
00040  * OnClose() was overriden to add a call to "SetActiveView(NULL)" just
00041  * before the base class OnClose is called. This will check all documents
00042  * asking the save question before closing the application. Thanks to
00043  * Simon Clark [spc@otleda.com] for help with this.
00044  *
00045  * *****************  Version 13  *****************
00046  * User: Kirk Stowell Date: 10/14/99   Time: 10:05a
00047  * Updated in $/CodeJock/CJLibrary
00048  * Overrode OnEraseBkgnd(...) to help to eliminate screen flicker.
00049  *
00050  * *****************  Version 12  *****************
00051  * User: Kirk Stowell Date: 10/06/99   Time: 6:21a
00052  * Updated in $/CodeJockey/CJLibrary
00053  * Added cool menu support for MDI applications that do not have a
00054  * document/view architecture. Added GetInitializedMenu() to
00055  * CCJMDIChildWnd which will initialize the menu for a given view,  and
00056  * overloaded InitializeMenu() in CCJMDIFrameWnd. Thanks to Golovanov
00057  * Michael [Golovanov@SoftLab.RU] for help with this.
00058  *
00059  * *****************  Version 11  *****************
00060  * User: Kirk Stowell Date: 9/16/99    Time: 2:35p
00061  * Updated in $/CodeJockey/CJLibrary
00062  * Fixed bug with save / restore bar state, and with saved bar size
00063  * changing whenever the application starts.
00064  *
00065  * *****************  Version 10  *****************
00066  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00067  * Updated in $/CodeJockey/CJLibrary
00068  * Updated copyright and contact information.
00069  *
00070  * *****************  Version 9  *****************
00071  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00072  * Updated in $/CodeJockey/CJLibrary
00073  *
00074  * *****************  Version 8  *****************
00075  * User: Kirk Stowell Date: 6/11/99    Time: 8:25p
00076  * Updated in $/CodeJockey/CJ60Lib
00077  * Slight modification made to popup menu code.
00078  *
00079  * *****************  Version 7  *****************
00080  * User: Kirk Stowell Date: 6/09/99    Time: 8:33p
00081  * Updated in $/CodeJockey/CJ60Lib
00082  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00083  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00084  * message handler, this is now automatically handled by the base class.
00085  * Added redraw flags to the create method and modified paint and layout
00086  * handlers to reduce flicker and un-necessary command handling. Dragging
00087  * rect now reflects actual control bar docked size. Added "flat" look to
00088  * the control bars, the control bars can now use the classic DevStudio
00089  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00090  * docking windows now handle dragging, docking and floating much better,
00091  * and behave more like DevStudio.
00092  *
00093  * *****************  Version 6  *****************
00094  * User: Kirk Stowell Date: 5/02/99    Time: 5:23p
00095  * Updated in $/CodeJockey/CJ60Lib
00096  * Further modifications for CCJMenu support.
00097  *
00098  * *****************  Version 5  *****************
00099  * User: Kirk Stowell Date: 5/02/99    Time: 2:13a
00100  * Updated in $/CodeJockey/CJ60Lib
00101  * Re-wrote CCJMenu releated methods so that multiple documents can be
00102  * added with associated menu support. Added typedef CList <CCJMenu*,
00103  * CCJMenu*> CMDIMenuList; so that menus pointers are stored in a list and
00104  * not member variables.
00105  *
00106  * *****************  Version 4  *****************
00107  * User: Kirk Stowell Date: 4/25/99    Time: 10:37p
00108  * Updated in $/CodeJockey/CJ60Lib
00109  * Added support for Brent Corkum's BCMenu (CCJMenu), which is a replacement for the
00110  * CCoolMenu class.
00111  *
00112  * *****************  Version 3  *****************
00113  * User: Kirk Stowell Date: 4/03/99    Time: 8:41p
00114  * Updated in $/CodeJockey/CJ60Lib
00115  * Added comments and cleaned up code.
00116  *
00117  * *****************  Version 2  *****************
00118  * User: Kirk Stowell Date: 1/12/99    Time: 8:41p
00119  * Updated in $/CodeJockey/CJ60Lib
00120  * Total re-write to add side-by-side docking support for CCJControlBar
00121  * class.
00122  *
00123  * *****************  Version 1  *****************
00124  * User: Kirk Stowell Date: 10/17/98   Time: 8:41p
00125  * Created in $/CodeJockey/CJ60Lib
00126  * Initial re-write and release.
00127  *
00128  ***************************************************************************/
00130
00131 #include "stdafx.h"
00132 #include "CJMDIFrameWnd.h"
00133 #include "CJDockBar.h"
00134 #include "CJSizeDockBar.h"
00135 #include "CJControlBar.h"
00136 #include "CJMiniDockFrameWnd.h"
00137 #include "CJToolBar.h"
00138
00139 #ifdef _DEBUG
00140 #define new DEBUG_NEW
00141 #undef THIS_FILE
00142 static char THIS_FILE[] = __FILE__;
00143 #endif
00144
00146 // CCJMDIFrameWnd
00147
00148 CCJMDIFrameWnd::CCJMDIFrameWnd()
00149 {
00150
00151 }
00152
00153 CCJMDIFrameWnd::~CCJMDIFrameWnd()
00154 {
00155     // Free up any allocated memory.
00156     while (!m_menuList.IsEmpty()) {
00157         CCJMenu* pMenu = m_menuList.RemoveTail();
00158         _delete(pMenu);
00159     }
00160 }
00161
00162 IMPLEMENT_DYNCREATE(CCJMDIFrameWnd, CMDIFrameWnd)
00163
00164 BEGIN_MESSAGE_MAP(CCJMDIFrameWnd, CMDIFrameWnd)
00165     //{{AFX_MSG_MAP(CCJMDIFrameWnd)
00166     ON_WM_MEASUREITEM()
00167     ON_WM_MENUCHAR()
00168     ON_WM_INITMENUPOPUP()
00169     ON_WM_CLOSE()
00170     //}}AFX_MSG_MAP
00171 END_MESSAGE_MAP()
00172
00174 // CCJMDIFrameWnd message handlers
00175
00176 // dwDockBarMap
00177 DWORD CCJMDIFrameWnd::dwDockBarMap[4][2] =
00178 {
00179     { AFX_IDW_DOCKBAR_TOP,      CBRS_TOP    },
00180     { AFX_IDW_DOCKBAR_BOTTOM,   CBRS_BOTTOM },
00181     { AFX_IDW_DOCKBAR_LEFT,     CBRS_LEFT   },
00182     { AFX_IDW_DOCKBAR_RIGHT,    CBRS_RIGHT  },
00183 };
00184
00185 void CCJMDIFrameWnd::DockControlBarLeftOf(CControlBar* Bar, CControlBar* LeftOf)
00186 {
00187     CRect rect;
00188     DWORD dw;
00189     UINT n;
00190
00191     // get MFC to adjust the dimensions of all docked ToolBars
00192     // so that GetWindowRect will be accurate
00193     RecalcLayout(TRUE);
00194
00195     LeftOf->GetWindowRect(&rect);
00196     rect.OffsetRect(1,0);
00197     dw=LeftOf->GetBarStyle();
00198     n = 0;
00199     n = (dw&CBRS_ALIGN_TOP)              ? AFX_IDW_DOCKBAR_TOP      : n;
00200     n = (dw&CBRS_ALIGN_BOTTOM   && n==0) ? AFX_IDW_DOCKBAR_BOTTOM   : n;
00201     n = (dw&CBRS_ALIGN_LEFT     && n==0) ? AFX_IDW_DOCKBAR_LEFT     : n;
00202     n = (dw&CBRS_ALIGN_RIGHT    && n==0) ? AFX_IDW_DOCKBAR_RIGHT    : n;
00203
00204     // When we take the default parameters on rect, DockControlBar will dock
00205     // each Toolbar on a seperate line. By calculating a rectangle, we in effect
00206     // are simulating a Toolbar being dragged to that location and docked.
00207     DockControlBar(Bar,n,&rect);
00208 }
00209
00210 void CCJMDIFrameWnd::EnableDocking(DWORD dwDockStyle)
00211 {
00212     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00213     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00214     CMDIFrameWnd::EnableDocking(dwDockStyle);
00215
00216     for (int i = 0; i < 4; i++) {
00217         if (dwDockBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY) {
00218             CDockBar* pDock = (CDockBar*)GetControlBar(dwDockBarMap[i][0]);
00219
00220             // make sure the dock bar is of correct type
00221             if( pDock || !pDock->IsKindOf(RUNTIME_CLASS(CCJDockBar)) ) {
00222                 BOOL bNeedDelete = ! pDock->m_bAutoDelete;
00223                 pDock->m_pDockSite->RemoveControlBar(pDock);
00224                 pDock->m_pDockSite = 0; // avoid problems in destroying the dockbar
00225                 pDock->DestroyWindow();
00226                 if( bNeedDelete )
00227                     delete pDock;
00228                 pDock = 0;
00229             }
00230
00231             if( pDock == 0 ) {
00232                 pDock = new CCJDockBar;
00233                 if (!pDock->Create(this,
00234                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00235                     dwDockBarMap[i][1], dwDockBarMap[i][0])) {
00236                     AfxThrowResourceException();
00237                 }
00238             }
00239         }
00240     }
00241 }
00242
00243 void CCJMDIFrameWnd::RecalcLayout(BOOL bNotify)
00244 {
00245     CMDIFrameWnd::RecalcLayout(bNotify);
00246     RecalcAllExcept(NULL);
00247 }
00248
00249 // Yiannhs changed this
00250 void CCJMDIFrameWnd::EnableDockingSizeBar(DWORD dwDockStyle, DockFlatBorders FlatFlags )
00251 {
00252     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00253     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00254
00255     m_pFloatingFrameClass = RUNTIME_CLASS(CCJMiniDockFrameWnd);
00256     for (int i = 0; i < 4; i++)
00257     {
00258         if (dwSizeBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY)
00259         {
00260             CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00261             if (pDock == NULL)
00262             {
00263                 pDock = new CCJSizeDockBar;
00264
00265                 if (!pDock->Create(this,
00266                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00267                         dwSizeBarMap[i][1], dwSizeBarMap[i][0]))
00268                 {
00269                     AfxThrowResourceException();
00270                 }
00271                 //Yiannhs enable Flat Borders For dock Bars
00272                 pDock->FlatBorder( (FlatFlags >> i) & 0x0001 );
00273             }
00274         }
00275     }
00276 }
00277
00278 void CCJMDIFrameWnd::RecalcAllExcept(CCJSizeDockBar *pBar)
00279 {
00280     for (int i = 0; i < 4; i++)
00281     {
00282         CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00283         if (pDock != NULL && pDock != pBar)
00284         {
00285             pDock->CalcSizeBarLayout();
00286         }
00287     }
00288 }
00289
00290 void CCJMDIFrameWnd::DockSizeBar(CControlBar * pBar,CCJSizeDockBar *pDockBar, LPRECT lpRect)
00291 {
00292     ASSERT(pBar != NULL);
00293     ASSERT(pBar->m_pDockContext != NULL);
00294
00295     if( pDockBar == NULL )
00296     {
00297         for (int i = 0; i < 4; i++)
00298         {
00299             if ((dwSizeBarMap[i][1] & CBRS_ALIGN_ANY) == (pBar->m_dwStyle & CBRS_ALIGN_ANY))
00300             {
00301                 pDockBar = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00302                 ASSERT(pDockBar != NULL);
00303
00304                 int nSize = 0;
00305
00306                 switch(i)
00307                 {
00308                 case 0: // horizontal dock
00309                 case 1:
00310                     nSize = ((CCJControlBar*)pBar)->GetHorzSize();
00311                     break;
00312                 case 2: // vertical dock
00313                 case 3:
00314                     nSize = ((CCJControlBar*)pBar)->GetVertSize();
00315                     break;
00316                 }
00317
00318                 pDockBar->SetActualSize( nSize );
00319                 break;
00320             }
00321         }
00322     }
00323
00324     ASSERT(pDockBar != NULL);
00325     ASSERT(m_listControlBars.Find(pBar) != NULL);
00326     ASSERT(pBar->m_pDockSite == this);
00327     ((CCJControlBar*)pBar)->Normalize();
00328     pDockBar->DockControlBar(pBar, lpRect);
00329 }
00330
00331 HMENU CCJMDIFrameWnd::NewMenu(UINT nMenuID, UINT nToolbarID)
00332 {
00333     // Allocate a new CCJMenu object.
00334     CCJMenu* pMenu = new CCJMenu;
00335     if( pMenu == NULL ) {
00336         return NULL;
00337     }
00338
00339     // Load the menu and toolbar resource.
00340     pMenu->LoadMenu(nMenuID);
00341     if (nToolbarID) {
00342         pMenu->LoadToolbar(nToolbarID);
00343     }
00344
00345     // Add the menu to the CList object.
00346     m_menuList.AddTail(pMenu);
00347
00348     // Detach the menu.
00349     return(pMenu->Detach());
00350 }
00351
00352 HMENU CCJMDIFrameWnd::NewMenu(UINT nMenuID, UINT* nToolbarIDs, int nSize)
00353 {
00354     // Allocate a new CCJMenu object.
00355     CCJMenu* pMenu = new CCJMenu;
00356     if( pMenu == NULL ) {
00357         return NULL;
00358     }
00359
00360     // Load the menu and toolbar resources.
00361     pMenu->LoadMenu(nMenuID);
00362     if (nToolbarIDs) {
00363         pMenu->LoadToolbars(nToolbarIDs, nSize);
00364     }
00365
00366     // Add the menu to the CList object.
00367     m_menuList.AddTail(pMenu);
00368
00369     // Detach the menu.
00370     return(pMenu->Detach());
00371 }
00372
00373 BOOL CCJMDIFrameWnd::InitializeMenu(CMultiDocTemplate* pDocTemplate, UINT nMenuID, UINT nToolBarID/*=NULL*/, UINT nDefaultMenuID/*=NULL*/)
00374 {
00375     ASSERT(nMenuID);            // must be valid.
00376
00377     // If no menus have been created yet, set the frame default,
00378     // this is the menu that is displayed when no views are active.
00379     if (m_menuList.IsEmpty()) {
00380         ASSERT(nDefaultMenuID != 0);
00381         m_hMenuDefault = NewMenu(nDefaultMenuID, nToolBarID);
00382         OnUpdateFrameMenu(m_hMenuDefault);
00383     }
00384     // Create the Doc/View menu. ONLY if there is a template passed.
00385     if( pDocTemplate )
00386     {
00387         ASSERT_VALID(pDocTemplate); // must be valid.
00388         pDocTemplate->m_hMenuShared = NewMenu(nMenuID, nToolBarID);
00389     }
00390     return TRUE;
00391 }
00392
00393 BOOL CCJMDIFrameWnd::InitializeMenu(CMultiDocTemplate* pDocTemplate, UINT nMenuID, UINT* nToolbarIDs/*=NULL*/, int nSize/*=NULL*/, UINT nDefaultMenuID/*=NULL*/)
00394 {
00395     ASSERT(nMenuID);            // must be valid.
00396
00397     // If no menus have been created yet, set the frame default,
00398     // this is the menu that is displayed when no views are active.
00399     if (m_menuList.IsEmpty()) {
00400         ASSERT(nDefaultMenuID != 0);
00401         m_hMenuDefault = NewMenu(nDefaultMenuID, nToolbarIDs, nSize);
00402         OnUpdateFrameMenu(m_hMenuDefault);
00403     }
00404     // Create the Doc/View menu. ONLY if there is a template passed.
00405     if( pDocTemplate )
00406     {
00407         ASSERT_VALID(pDocTemplate); // must be valid.
00408         pDocTemplate->m_hMenuShared = NewMenu(nMenuID, nToolbarIDs, nSize);
00409     }
00410
00411     return TRUE;
00412 }
00413
00414 BOOL CCJMDIFrameWnd::InitializeMenu( HMENU* phMenu, UINT nMenuID, UINT nToolbarID/*=NULL*/)
00415 {
00416     if( !phMenu ) {
00417         return FALSE;
00418     }
00419
00420     ASSERT(nMenuID);            // must be valid.
00421     *phMenu = NewMenu( nMenuID, nToolbarID );
00422
00423     return (BOOL)(*phMenu != NULL);
00424 }
00425
00426 BOOL CCJMDIFrameWnd::InitializeMenu( HMENU* phMenu, UINT nMenuID, UINT* nToolbarIDs/*=NULL*/, int nSize/*=NULL*/)
00427 {
00428     if( !phMenu ) {
00429         return FALSE;
00430     }
00431
00432     ASSERT(nMenuID);            // must be valid.
00433     *phMenu = NewMenu(nMenuID, nToolbarIDs, nSize);
00434
00435     return (BOOL)(*phMenu != NULL);
00436 }
00437
00438 void CCJMDIFrameWnd::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
00439 {
00440     if (lpMeasureItemStruct->CtlType == ODT_MENU)
00441     {
00442         if (IsMenu((HMENU)lpMeasureItemStruct->itemID)) {
00443             CMenu* pMenu = CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
00444
00445             // Loop through all menus in list.
00446             for (POSITION pos = m_menuList.GetHeadPosition(); pos; m_menuList.GetNext(pos))
00447             {
00448                 CCJMenu* pListMenu = m_menuList.GetAt(pos);
00449
00450                 if(pListMenu->IsMenu(pMenu)) {
00451                     pListMenu->MeasureItem(lpMeasureItemStruct);
00452                     return;
00453                 }
00454             }
00455         }
00456     }
00457
00458     CMDIFrameWnd::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
00459 }
00460
00461 LRESULT CCJMDIFrameWnd::OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu)
00462 {
00463     // Loop through all menus in list.
00464     for (POSITION pos = m_menuList.GetHeadPosition(); pos; m_menuList.GetNext(pos))
00465     {
00466         CCJMenu* pListMenu = m_menuList.GetAt(pos);
00467
00468         if(pListMenu->IsMenu(pMenu)) {
00469             return CCJMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
00470         }
00471     }
00472
00473     return CMDIFrameWnd::OnMenuChar(nChar, nFlags, pMenu);
00474 }
00475
00476 void CCJMDIFrameWnd::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
00477 {
00478     CMDIFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
00479
00480     if(!bSysMenu)
00481     {
00482         // Loop through all menus in list.
00483         for (POSITION pos = m_menuList.GetHeadPosition(); pos; m_menuList.GetNext(pos))
00484         {
00485             CCJMenu* pListMenu = m_menuList.GetAt(pos);
00486
00487             if(pListMenu->IsMenu(pPopupMenu)) {
00488                 CCJMenu::UpdateMenu(pPopupMenu);
00489                 break;
00490             }
00491         }
00492     }
00493 }
00494
00495 void CCJMDIFrameWnd::LoadBarState(LPCTSTR lpszProfileName)
00496 {
00497     CCJSizeDockBar::m_bIsDockBar = true;
00498     CFrameWnd::LoadBarState(lpszProfileName);
00499     CCJSizeDockBar::m_bIsDockBar = false;
00500 }
00501
00502 void CCJMDIFrameWnd::SaveBarState(LPCTSTR lpszProfileName) const
00503 {
00504     CCJSizeDockBar::m_bIsDockBar = true;
00505     CFrameWnd::SaveBarState(lpszProfileName);
00506     CCJSizeDockBar::m_bIsDockBar = false;
00507 }
00508
00509 void CCJMDIFrameWnd::OnClose()
00510 {
00511     // Clear active view before close
00512     SetActiveView (NULL);
00513     CMDIFrameWnd::OnClose();
00514 }
00515
00516 // Default implementation.
00517 BOOL CCJMDIFrameWnd::PreCreateWindow(CREATESTRUCT& cs)
00518 {
00519     return CMDIFrameWnd::PreCreateWindow(cs);
00520 }
00521
00523 // Overloaded for flicker-free drawing with no CS_VREDRAW and CS_HREDRAW.
00524 // Override in CMainFrame and call this method, rather than the default. Pass
00525 // in your apps icon resource usually IDR_MAINFRAME.
00526 //
00527 BOOL CCJMDIFrameWnd::PreCreateWindow(CREATESTRUCT& cs, UINT nIconID)
00528 {
00529     // Register wnd class with no redraw, cursor (use default), background
00530     // brush and load your apps icon resource.
00531     cs.lpszClass = AfxRegisterWndClass( 0, NULL, NULL,
00532         AfxGetApp()->LoadIcon(nIconID));
00533     ASSERT(cs.lpszClass);
00534
00535     return CMDIFrameWnd::PreCreateWindow(cs);
00536 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJMemFile.cpp Source File

WinCvs/CJLib/CJLibrary/CJMemFile.cpp

Go to the documentation of this file.
00001 // CJMemFile.cpp: implementation of Maxallion's CCJMemFile class.
00002 //
00003 // Copyright © 1999 Maxallion
00004 // mailto:XFile@maxallion.8m.com
00005 // ICQ# 32304418
00006 //
00007 // CXFile - Extended Memory File - Beta - w/o a lot of error checking
00008 // - Is used like a normal CFile or CStdioFile or CMemFile object
00009 // - String Functions : ReadString, WriteString
00010 // - Loads physical files into memory on creation and saves them back to disk on destruction
00011 // - Can duplicate itself to other CFile derived objects
00012 // - Has a Search function
00013 // - can be read-accessed like an array
00014 //
00015 // OVERLOADED OPERATORS:
00016 // = Imports from another file or sets file Position
00017 // += Appends another file
00018 // [] reads a byte like an array
00019 //
00021 /****************************************************************************
00022  *
00023  * $Date: 1999/11/30 21:45:49 $
00024  * $Revision: 1.1.1.1 $
00025  * $Archive: /CodeJock/CJLibrary/CJMemFile.cpp $
00026  *
00027  * $History: CJMemFile.cpp $
00028  *
00029  * *****************  Version 2  *****************
00030  * User: Kirk Stowell Date: 10/24/99   Time: 3:06a
00031  * Updated in $/CodeJock/CJLibrary
00032  * Added UNICODE modifications.
00033  *
00034  * *****************  Version 1  *****************
00035  * User: Kirk Stowell Date: 10/24/99   Time: 3:01a
00036  * Created in $/CodeJock/CJLibrary
00037  * Initial creation.
00038  *
00039  ***************************************************************************/
00041
00042 #include "stdafx.h"
00043 #include "CJMemFile.h"
00044
00045 #ifdef _DEBUG
00046 #undef THIS_FILE
00047 static char THIS_FILE[]=__FILE__;
00048 #define new DEBUG_NEW
00049 #endif
00050
00052 // Construction/Destruction
00054
00055 CCJMemFile::CCJMemFile( UINT nGrowBytes)
00056 {
00057     // Modified default constructor
00058
00059     m_File.m_hFile = NULL;
00060     m_bOpen = false;
00061     m_uiOpenFlags = 0;
00062     CMemFile::CMemFile(nGrowBytes);
00063 }
00064
00065 CCJMemFile::CCJMemFile( BYTE* lpBuffer, UINT nBufferSize, UINT nGrowBytes )
00066 {
00067     // Modified default constructor
00068
00069     m_File.m_hFile = NULL;
00070     m_bOpen = false;
00071     m_uiOpenFlags = 0;
00072     CMemFile::CMemFile(lpBuffer,nBufferSize, nGrowBytes );
00073 }
00074
00075 CCJMemFile::CCJMemFile(LPCTSTR lpszFilename, UINT uiOpenFlags)
00076 {
00077     // CFile compatible constructor
00078
00079     m_File.m_hFile = NULL;
00080     m_bOpen = false;
00081     m_uiOpenFlags = uiOpenFlags;
00082     Open(lpszFilename,uiOpenFlags);
00083 }
00084
00085 CCJMemFile::~CCJMemFile()
00086 {
00087     if (m_bOpen)
00088         Close();
00089     m_File.m_hFile = NULL;
00090     m_uiOpenFlags = 0;
00091     CMemFile::~CMemFile();
00092 }
00093
00094 // Implementation
00095
00096 BOOL CCJMemFile::ReadString(CString& rString)
00097 {
00098     // Readstring Beta Version
00099
00100     rString.Empty();
00101     char ch;
00102
00103     bool bFound = false;
00104     while (GetPosition() < GetLength())
00105     {
00106         Read(&ch,1);
00107
00108         bFound = (ch == '\x0D');
00109         if (bFound || (ch == '\x0'))
00110             break;
00111         else
00112             rString = rString + ch;
00113     }
00114     if (bFound)
00115     {
00116         Read(&ch,1);
00117         if (ch != '\x0A')
00118             Seek(-1,current);
00119     }
00120
00121     if (rString.GetLength() > 0)
00122         return true;
00123     return false;
00124 }
00125
00126 void CCJMemFile::WriteString( LPCTSTR lpsz )
00127 {
00128     // WriteString Beta Version
00129
00130     if (_tcslen(lpsz) > 0)
00131     {
00132         for (UINT iCount = 0; iCount < _tcslen(lpsz); iCount++)
00133             if ((lpsz[iCount] != '\x0D') && (lpsz[iCount] != '\x00'))
00134                 Write(&lpsz[iCount],1);
00135     }
00136     char ch = '\x0D';
00137     Write(&ch,1);
00138     ch = '\x0A';
00139     Write(&ch,1);
00140
00141 }
00142
00143 bool CCJMemFile::Duplicate(CFile *fDuplicate)
00144 {
00145     // Standard Copy Routine
00146
00147     BYTE *pbData = new BYTE[1024];
00148     DWORD dwPos = GetPosition();
00149     SeekToBegin();
00150     fDuplicate->SetLength(0);
00151     while (GetPosition() < GetLength())
00152     {
00153         DWORD dwRead = Read(pbData,1024);
00154         fDuplicate->Write(pbData,dwRead);
00155     }
00156     Seek(dwPos,fDuplicate->begin);
00157     delete pbData;
00158     return true;
00159 }
00160
00161 bool CCJMemFile::Duplicate(CString strDup)
00162 {
00163     // Duplicate With CString compatibility
00164
00165     CFile file(strDup,CFile::modeCreate | CFile::modeWrite);
00166     bool bResult = Duplicate(&file);
00167     file.Close();
00168     return bResult;
00169 }
00170
00171 bool CCJMemFile::Open(CString strFilename, UINT uiOpenFlags,CFileException *pError)
00172 {
00173     // CFile compatible Open
00174
00175     if (m_File.m_hFile != NULL)
00176         return false;
00177     if (m_File.Open(strFilename,uiOpenFlags,pError))
00178     {
00179         m_uiOpenFlags = uiOpenFlags;
00180         Load();
00181         m_bOpen = true;
00182         return true;
00183     }
00184     else
00185         return false;
00186 }
00187
00188 bool CCJMemFile::Save()
00189 {
00190     if (m_File.m_hFile == NULL)
00191         return false;
00192     CString str;
00193
00194     // Check if the physical file has write access
00195     if (!(m_uiOpenFlags & modeWrite) && !(m_uiOpenFlags & modeReadWrite))
00196     {
00197         return false;
00198     }
00199
00200     DWORD dwPos = GetPosition();
00201     DWORD dwLength = 1024;
00202     BYTE *pData = new BYTE[dwLength];
00203     if (pData == NULL)
00204         return false;
00205     SeekToBegin();
00206     m_File.SetLength(0);
00207     while (GetPosition() < GetLength())
00208     {
00209         DWORD dwRead = Read(pData,dwLength);
00210         m_File.Write(pData,dwRead);
00211     }
00212     Seek(dwPos,begin);
00213     delete pData;
00214     m_File.Flush();
00215     return true;
00216 }
00217
00218 bool CCJMemFile::Load()
00219 {
00220     if (m_File.m_hFile == NULL)
00221         return false;
00222
00223     DWORD dwLength = 1024;
00224     BYTE *pData = new BYTE[dwLength];
00225     if (pData == NULL)
00226         return false;
00227     SeekToBegin();
00228     SetLength(0);
00229     m_File.SeekToBegin();
00230     while (m_File.GetPosition() < m_File.GetLength())
00231     {
00232         DWORD dwRead = m_File.Read(pData,dwLength);
00233         Write(pData,dwRead);
00234     }
00235
00236     delete pData;
00237     return true;
00238 }
00239
00240
00241 void CCJMemFile::Close()
00242 {
00243     if ((m_File.m_hFile != NULL) && m_bOpen)
00244     {
00245         m_bOpen = false;
00246         Save();
00247         m_File.Close();
00248         m_File.m_hFile = NULL;
00249     }
00250 }
00251
00252 void CCJMemFile::Flush()
00253 {
00254     CMemFile::Flush();
00255     Save();
00256 }
00257
00258 bool CCJMemFile::Discard()
00259 {
00260     return Load();
00261 }
00262
00263 bool CCJMemFile::Import(CFile *fImp)
00264 {
00265     if ((fImp == NULL) || (fImp->m_hFile == NULL))
00266         return false;
00267
00268     DWORD dwLength = 1024;
00269     BYTE *pData = new BYTE[dwLength];
00270     if (pData == NULL)
00271         return false;
00272     SeekToBegin();
00273     SetLength(0);
00274     fImp->SeekToBegin();
00275     while (fImp->GetPosition() < fImp->GetLength())
00276     {
00277         DWORD dwRead = fImp->Read(pData,dwLength);
00278         Write(pData,dwRead);
00279     }
00280
00281     delete pData;
00282     return true;
00283 }
00284
00285 bool CCJMemFile::Append(CFile *fApp)
00286 {
00287     if ((fApp == NULL) || (fApp->m_hFile == NULL))
00288         return false;
00289
00290     DWORD dwLength = 1024;
00291     BYTE *pData = new BYTE[dwLength];
00292     if (pData == NULL)
00293         return false;
00294     SeekToEnd();
00295     fApp->SeekToBegin();
00296     while (fApp->GetPosition() < fApp->GetLength())
00297     {
00298         DWORD dwRead = fApp->Read(pData,dwLength);
00299         Write(pData,dwRead);
00300     }
00301
00302     delete pData;
00303     return true;
00304 }
00305
00306 DWORD CCJMemFile::Insert(CFile *fSrc, DWORD dwSourcePos, DWORD dwDestPos, DWORD dwBytes)
00307 {
00308     if (dwBytes == 0)
00309         return 0;
00310
00311     CCJMemFile fPreIns;
00312     CCJMemFile fIns;
00313     CCJMemFile fPostIns;
00314     CCJMemFile fComplete;
00315
00316     Extract(&fPreIns,0,dwDestPos); // Extract Data BEFORE insertion point
00317     Extract(&fPostIns,dwDestPos,GetLength() - dwDestPos); // Extract Data AFTER intertion point
00318
00319     // Extract the "to be inserted" Data from the (fSrc) Source file
00320     {
00321         DWORD dwLength = 1024;
00322         DWORD dwCounter = 0;
00323         BYTE *pData = new BYTE[dwLength];
00324         if (pData == NULL)
00325             return 0;
00326         fSrc->Seek(dwSourcePos,begin);
00327
00328         while (((fSrc->GetPosition() - dwSourcePos) < dwBytes) && (fSrc->GetPosition() < fSrc->GetLength()) )
00329         {
00330             DWORD dwRead = fSrc->Read(pData,dwLength);
00331             if (dwCounter + dwRead > dwSourcePos + dwBytes)
00332                 dwRead = dwBytes - dwCounter;
00333             fIns.Write(pData,dwRead);
00334             dwCounter += dwRead;
00335         }
00336         delete pData;
00337     } // Finished Extraction
00338
00339
00340     fComplete += &fPreIns; // Append BEFORE Data
00341     fComplete += &fIns; // Append the "to be inserted" Data
00342     fComplete += &fPostIns;  // Append the AFTER Data
00343
00344     *this = &fComplete; // Copy completed File
00345
00346     return fIns.GetLength();
00347 }
00348
00349 DWORD CCJMemFile::Insert(CString strSrc, DWORD dwSourcePos, DWORD dwDestPos, DWORD dwBytes)
00350 {
00351     CFile file(strSrc,CFile::modeRead);
00352     DWORD dwResult = Insert(&file, dwSourcePos, dwDestPos, dwBytes);
00353     file.Close();
00354     return dwResult;
00355 }
00356
00357 DWORD CCJMemFile::Extract(CFile *fDest, DWORD dwStartPos, DWORD dwBytes)
00358 {
00359     if (dwBytes == 0)
00360         return 0;
00361     DWORD dwPos = GetPosition();
00362     DWORD dwLength = 1024;
00363     DWORD dwCounter = 0;
00364     BYTE *pData = new BYTE[dwLength];
00365     if (pData == NULL)
00366         return 0;
00367     Seek(dwStartPos,begin);
00368
00369     while (((GetPosition() - dwStartPos) < dwBytes) && (GetPosition() < GetLength()) )
00370     {
00371         DWORD dwRead = Read(pData,dwLength);
00372         if (dwCounter + dwRead > dwStartPos + dwBytes)
00373             dwRead = dwBytes - dwCounter;
00374         fDest->Write(pData,dwRead);
00375         dwCounter += dwRead;
00376     }
00377     Seek(dwPos,begin);
00378     delete pData;
00379     fDest->Flush();
00380     return dwCounter;
00381
00382 }
00383
00384 DWORD CCJMemFile::Extract(CString strDest, DWORD dwStartPos, DWORD dwBytes)
00385 {
00386     CFile file(strDest,CFile::modeCreate | CFile::modeWrite);
00387     DWORD dwResult = Extract(&file,dwStartPos,dwBytes);
00388     file.Close();
00389     return dwResult;
00390 }
00391
00392 // Overloaded Operators
00393
00394 void CCJMemFile::operator =(CFile *fDup)
00395 {
00396     Import(fDup);
00397 }
00398
00399 void CCJMemFile::operator =(CString strDup)
00400 {
00401     CFile file;
00402     if (file.Open(strDup,CFile::modeRead))
00403     {
00404         Import(&file);
00405         file.Close();
00406     }
00407 }
00408
00409 void CCJMemFile::operator =(DWORD dwFilePos)
00410 {
00411     Seek(dwFilePos,begin);
00412 }
00413
00414
00415 void CCJMemFile::operator +=(CFile *fApp)
00416 {
00417     Append(fApp);
00418 }
00419
00420 void CCJMemFile::operator +=(CString strApp)
00421 {
00422     CFile file;
00423     if (file.Open(strApp,CFile::modeRead))
00424     {
00425         Append(&file);
00426         file.Close();
00427     }
00428 }
00429
00430 // Indexing Operators
00431
00432 BYTE CCJMemFile::operator [](DWORD dwFilePos)
00433 {
00434     if (dwFilePos > GetLength() -1)
00435         return 0;
00436
00437     BYTE bTemp;
00438     Seek(dwFilePos,begin);
00439     Read(&bTemp,sizeof(BYTE));
00440     return bTemp;
00441 }
00442
00443 LONG CCJMemFile::FindData(void* pData, DWORD dwDataLen, LONG lStartPos)
00444 {
00445     BYTE* pBytes = (BYTE*)pData;
00446
00447
00448     Seek(lStartPos,begin);
00449
00450     bool bFoundAll = false;
00451     LONG lPos = -1;
00452
00453     while ((!bFoundAll) && (GetPosition() < GetLength()))
00454     {
00455         bool bFoundFirst = false;
00456
00457         while ((!bFoundFirst) && (GetPosition() < GetLength()))
00458         {
00459             lPos = GetPosition();
00460             BYTE read;
00461             Read(&read,1);
00462             if (read != pBytes[0])
00463                 continue;
00464
00465             bFoundFirst = true;
00466             break;
00467         }
00468
00469         //Hier Die Restlichen Bytes (dwDataLen -1) vergleichen
00470
00471         DWORD i = 1;
00472         bool bFound = true;
00473
00474         while ((i < dwDataLen) && (GetPosition() < GetLength()) && bFoundFirst)
00475         {
00476             BYTE read;
00477             Read(&read,1);
00478             if (read == pBytes[i++])
00479                 continue;
00480
00481             bFound = false;
00482             Seek(lPos+1,begin);
00483             break;
00484         }
00485
00486         bFoundAll = bFound && bFoundFirst;
00487     }
00488
00489     lPos = bFoundAll ? lPos : -1;
00490 //  while (bFound && (iPos < strSeek.GetLength())
00491 //  {
00492 //  }
00493     return lPos;
00494 }
Generated on Sun Oct 21 12:41:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJMenu.cpp Source File

WinCvs/CJLib/CJLibrary/CJMenu.cpp

Go to the documentation of this file.
00001 //*************************************************************************
00002 // CCJMenu.cpp : implementation file
00003 // Version : 2.5
00004 // Date : October 18, 1999
00005 // Author : Brent Corkum
00006 //
00007 // Portions of code supplied by:
00008 // Ben Ashley,Girish Bharadwaj,Jean-Edouard Lachand-Robert,
00009 // Robert Edward Caldecott,Kenny Goers,Leonardo Zide,
00010 // Stefan Kuhr, Reiner Jung
00011 //
00012 // Bug Fixes:
00013 // Stefan Kuhr,Martin Vladic,Kim Yoo Chul
00014 //
00015 // You are free to use/modify this code but leave this header intact.
00016 //
00018 /****************************************************************************
00019  *
00020  * $Date: 1999/11/30 21:45:49 $
00021  * $Revision: 1.1.1.3 $
00022  * $Archive: /CodeJock/CJLibrary/CJMenu.cpp $
00023  *
00024  * $History: CJMenu.cpp $
00025  *
00026  * *****************  Version 6  *****************
00027  * User: Kirk Stowell Date: 10/24/99   Time: 2:09a
00028  * Updated in $/CodeJock/CJLibrary
00029  * Upgraded to version 2.5 of BCMenu
00030  *
00031  * *****************  Version 5  *****************
00032  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00033  * Updated in $/CodeJock/CJLibrary
00034  * Added source control history to file header.
00035  *
00036  ***************************************************************************/
00038
00039 #include "stdafx.h"        // Standard windows header file
00040 #include "CJMenu.h"        // CCJMenu class declaration
00041 #include <afxpriv.h>       //SK: makes A2W and other spiffy AFX macros work
00042
00043 #ifdef _DEBUG
00044 #define new DEBUG_NEW
00045 #undef THIS_FILE
00046 static char THIS_FILE[] = __FILE__;
00047 #endif
00048
00049 #define GAP 1
00050 #ifndef OBM_CHECK
00051 #define OBM_CHECK 32760 // from winuser.h
00052 #endif
00053
00054 #if _MFC_VER <0x400
00055 #error This code does not work on Versions of MFC prior to 4.0
00056 #endif
00057
00058 static CPINFO CPInfo;
00059
00060 enum Win32Type{
00061     Win32s,
00062     Windoze95,
00063     WinNT3,
00064     WinNT4orHigher
00065 };
00066
00067
00068 Win32Type IsShellType()
00069 {
00070     Win32Type  ShellType;
00071     DWORD winVer;
00072     OSVERSIONINFO *osvi;
00073
00074     winVer=GetVersion();
00075     if(winVer<0x80000000){/*NT */
00076         ShellType=WinNT3;
00077         osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO));
00078         if (osvi!=NULL){
00079             memset(osvi,0,sizeof(OSVERSIONINFO));
00080             osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
00081             GetVersionEx(osvi);
00082             if (osvi->dwMajorVersion>=4L)
00083                 ShellType=WinNT4orHigher;//yup, it is NT 4 or higher!
00084             free(osvi);
00085         }
00086     }
00087     else if  (LOBYTE(LOWORD(winVer))<4)
00088         ShellType=Win32s;/*Win32s*/
00089     else
00090         ShellType=Windoze95;/*Windoze95*/
00091     return ShellType;
00092 }
00093
00094 static Win32Type g_Shell=IsShellType();
00095
00096 void CCJMenuData::SetAnsiString(LPCSTR szAnsiString)
00097 {
00098     USES_CONVERSION;
00099     SetWideString(A2W(szAnsiString));  //SK:  see MFC Tech Note 059
00100 }
00101
00102 CString CCJMenuData::GetString(void)//returns the menu text in ANSI or UNICODE
00103 //depending on the MFC-Version we are using
00104 {
00105     CString strText;
00106     if (m_szMenuText)
00107     {
00108 #ifdef UNICODE
00109         strText = m_szMenuText;
00110 #else
00111         USES_CONVERSION;
00112         strText=W2A(m_szMenuText);     //SK:  see MFC Tech Note 059
00113 #endif
00114     }
00115     return strText;
00116 }
00117
00118 CTypedPtrArray<CPtrArray, HMENU> CCJMenu::m_AllSubMenus;  // Stores list of all sub-menus
00119
00120 /*===============================================================================
00121  CCJMenu::CCJMenu()
00122  TCMeny::~CCJMenu()
00123  -----------------
00124
00125  Constructor and Destructor.
00126 ===============================================================================*/
00127
00128 CCJMenu::CCJMenu()
00129 {
00130     disable_old_style=FALSE;
00131     m_iconX = 16;            // Icon sizes default to 16 x 16
00132     m_iconY = 15;            // ...
00133     m_selectcheck = -1;
00134     m_unselectcheck = -1;
00135     checkmaps=NULL;
00136     checkmapsshare=FALSE;
00137     // set the color used for the transparent background in all bitmaps
00138     m_bitmapBackground=RGB(192,192,192); //gray
00139     m_bitmapBackgroundFlag=FALSE;
00140     GetCPInfo(CP_ACP,&CPInfo);
00141 }
00142
00143
00144 CCJMenu::~CCJMenu()
00145 {
00146     DestroyMenu();
00147 }
00148
00149 BOOL CCJMenu::IsNewShell ()
00150 {
00151     return (Windoze95==g_Shell || WinNT4orHigher==g_Shell);
00152 }
00153
00154
00155 CCJMenuData::~CCJMenuData()
00156 {
00157     if(bitmap)
00158         delete(bitmap);
00159
00160     delete[] m_szMenuText; //Need not check for NULL because ANSI X3J16 allows "delete NULL"
00161 }
00162
00163
00164 void CCJMenuData::SetWideString(const wchar_t *szWideString)
00165 {
00166     delete[] m_szMenuText;//Need not check for NULL because ANSI X3J16 allows "delete NULL"
00167
00168     if (szWideString)
00169     {
00170         m_szMenuText = new wchar_t[sizeof(wchar_t)*(wcslen(szWideString)+1)];
00171         if (m_szMenuText)
00172             wcscpy(m_szMenuText,szWideString);
00173     }
00174     else
00175         m_szMenuText=NULL;//set to NULL so we need not bother about dangling non-NULL Ptrs
00176 }
00177
00178 BOOL CCJMenu::IsMenu(CMenu *submenu)
00179 {
00180     int m;
00181     int numSubMenus = m_AllSubMenus.GetUpperBound();
00182     for(m=0;m<=numSubMenus;++m){
00183         if(submenu->m_hMenu==m_AllSubMenus[m])return(TRUE);
00184     }
00185     return(FALSE);
00186 }
00187
00188 BOOL CCJMenu::IsMenu(HMENU submenu)
00189 {
00190     int m;
00191     int numSubMenus = m_AllSubMenus.GetUpperBound();
00192     for(m=0;m<=numSubMenus;++m){
00193         if(submenu==m_AllSubMenus[m])return(TRUE);
00194     }
00195     return(FALSE);
00196 }
00197
00198 BOOL CCJMenu::DestroyMenu()
00199 {
00200     // Destroy Sub menus:
00201     int m,n;
00202     int numAllSubMenus = m_AllSubMenus.GetUpperBound();
00203     for(n = numAllSubMenus; n>= 0; n--){
00204         if(m_AllSubMenus[n]==this->m_hMenu)m_AllSubMenus.RemoveAt(n);
00205     }
00206     int numSubMenus = m_SubMenus.GetUpperBound();
00207     for(m = numSubMenus; m >= 0; m--){
00208         numAllSubMenus = m_AllSubMenus.GetUpperBound();
00209         for(n = numAllSubMenus; n>= 0; n--){
00210             if(m_AllSubMenus[n]==m_SubMenus[m])m_AllSubMenus.RemoveAt(n);
00211         }
00212         delete((CCJMenu *)FromHandle(m_SubMenus[m]));
00213     }
00214     m_SubMenus.RemoveAll();
00215     // Destroy menu data
00216     int numItems = m_MenuList.GetUpperBound();
00217     for(m = 0; m <= numItems; m++)delete(m_MenuList[m]);
00218     m_MenuList.RemoveAll();
00219     if(checkmaps&&!checkmapsshare){
00220         delete checkmaps;
00221         checkmaps=NULL;
00222     }
00223     // Call base-class implementation last:
00224     return(CMenu::DestroyMenu());
00225 };
00226
00227
00229 //
00230 // CCJMenu message handlers
00231
00232
00233 /*
00234 ==========================================================================
00235 void CCJMenu::DrawItem(LPDRAWITEMSTRUCT)
00236 ---------------------------------------
00237
00238   Called by the framework when a particular item needs to be drawn.  We
00239   overide this to draw the menu item in a custom-fashion, including icons
00240   and the 3D rectangle bar.
00241   ==========================================================================
00242 */
00243
00244
00245 void CCJMenu::DrawItem (LPDRAWITEMSTRUCT lpDIS)
00246 {
00247     ASSERT(lpDIS != NULL);
00248     CDC* pDC = CDC::FromHandle(lpDIS->hDC);
00249     CRect rect;
00250     UINT state = (((CCJMenuData*)(lpDIS->itemData))->nFlags);
00251     if(state & MF_SEPARATOR){
00252         rect.CopyRect(&lpDIS->rcItem);
00253         rect.top+=rect.Height()>>1;
00254         pDC->DrawEdge(&rect,EDGE_ETCHED,BF_TOP);
00255     }
00256     else{
00257         CRect rect2;
00258         BOOL standardflag=FALSE,selectedflag=FALSE,disableflag=FALSE;
00259         BOOL checkflag=FALSE;
00260         COLORREF crText = GetSysColor(COLOR_MENUTEXT);
00261         COLORREF m_clrBack=GetSysColor(COLOR_MENU);
00262         CBrush m_brBackground,m_brSelect;
00263         CPen m_penBack;
00264         int x0,y0,dy;
00265         int nIconNormal=-1,xoffset=-1;
00266         CImageList *bitmap=NULL;
00267         CFont m_fontMenu;
00268         LOGFONT m_lf;
00269
00270         // set some colors and the font
00271         m_penBack.CreatePen (PS_SOLID,0,GetSysColor(COLOR_MENU));
00272         m_brBackground.CreateSolidBrush(GetSysColor(COLOR_MENU));
00273         m_brSelect.CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
00274         ZeroMemory ((PVOID) &m_lf,sizeof (LOGFONT));
00275         NONCLIENTMETRICS nm;
00276         nm.cbSize = sizeof (NONCLIENTMETRICS);
00277         VERIFY (SystemParametersInfo(SPI_GETNONCLIENTMETRICS,nm.cbSize,&nm,0));
00278         m_lf =  nm.lfMenuFont;
00279         m_fontMenu.CreateFontIndirect (&m_lf);
00280
00281         // draw the colored rectangle portion
00282
00283         rect.CopyRect(&lpDIS->rcItem);
00284         rect2=rect;
00285
00286         // draw the up/down/focused/disabled state
00287
00288         UINT action = lpDIS->itemAction;
00289         UINT state = lpDIS->itemState;
00290         CString strText;
00291         LOGFONT lf;
00292         lf = m_lf;
00293
00294         CFont dispFont;
00295         CFont *pFont=NULL;
00296
00297         if(lpDIS->itemData != NULL){
00298             nIconNormal = (((CCJMenuData*)(lpDIS->itemData))->menuIconNormal);
00299             xoffset = (((CCJMenuData*)(lpDIS->itemData))->xoffset);
00300             bitmap = (((CCJMenuData*)(lpDIS->itemData))->bitmap);
00301             strText = ((CCJMenuData*) (lpDIS->itemData))->GetString();
00302
00303             if(state&ODS_CHECKED && nIconNormal<0){
00304                 if(state&ODS_SELECTED && m_selectcheck>0)checkflag=TRUE;
00305                 else if(m_unselectcheck>0) checkflag=TRUE;
00306             }
00307             else if(nIconNormal != -1){
00308                 standardflag=TRUE;
00309                 if(state&ODS_SELECTED && !(state&ODS_GRAYED))selectedflag=TRUE;
00310                 else if(state&ODS_GRAYED) disableflag=TRUE;
00311             }
00312         }
00313         else{
00314             strText.Empty();
00315         }
00316
00317         if(state&ODS_SELECTED){ // draw the down edges
00318
00319             CPen *pOldPen = pDC->SelectObject (&m_penBack);
00320
00321             // You need only Text highlight and thats what you get
00322
00323             if(checkflag||standardflag||selectedflag||disableflag||state&ODS_CHECKED)
00324                 rect2.SetRect(rect.left+m_iconX+4+GAP,rect.top,rect.right,rect.bottom);
00325             pDC->FillRect (rect2,&m_brSelect);
00326
00327             pDC->SelectObject (pOldPen);
00328             if((HFONT)dispFont != NULL)dispFont.DeleteObject ();
00329             dispFont.CreateFontIndirect (&lf);
00330             crText = GetSysColor(COLOR_HIGHLIGHTTEXT);
00331         }
00332         else {
00333             CPen *pOldPen = pDC->SelectObject (&m_penBack);
00334             pDC->FillRect (rect,&m_brBackground);
00335             pDC->SelectObject (pOldPen);
00336
00337             // draw the up edges
00338
00339             pDC->Draw3dRect (rect,m_clrBack,m_clrBack);
00340             if ((HFONT)dispFont != NULL) dispFont.DeleteObject ();
00341             dispFont.CreateFontIndirect (&lf); //Normal
00342         }
00343
00344         // draw the text if there is any
00345         //We have to paint the text only if the image is nonexistant
00346
00347         dy = (rect.Height()-4-m_iconY)/2;
00348         dy = dy<0 ? 0 : dy;
00349
00350         if(checkflag||standardflag||selectedflag||disableflag){
00351             rect2.SetRect(rect.left+1,rect.top+1+dy,rect.left+m_iconX+3,
00352                 rect.top+m_iconY+3+dy);
00353             pDC->Draw3dRect (rect2,m_clrBack,m_clrBack);
00354             if(checkflag && checkmaps){
00355                 pDC->FillRect (rect2,&m_brBackground);
00356                 rect2.SetRect(rect.left,rect.top+dy,rect.left+m_iconX+4,
00357                     rect.top+m_iconY+4+dy);
00358
00359                 pDC->Draw3dRect (rect2,m_clrBack,m_clrBack);
00360                 CPoint ptImage(rect.left+2,rect.top+2+dy);
00361
00362                 if(state&ODS_SELECTED)checkmaps->Draw(pDC,1,ptImage,ILD_TRANSPARENT);
00363                 else checkmaps->Draw(pDC,0,ptImage,ILD_TRANSPARENT);
00364             }
00365             else if(disableflag){
00366                 if(!selectedflag){
00367                     CBitmap bitmapstandard;
00368                     GetBitmapFromImageList(pDC,bitmap,xoffset,bitmapstandard);
00369                     rect2.SetRect(rect.left,rect.top+dy,rect.left+m_iconX+4,
00370                         rect.top+m_iconY+4+dy);
00371                     pDC->Draw3dRect (rect2,m_clrBack,m_clrBack);
00372                     if(disable_old_style)
00373                         DitherBlt(lpDIS->hDC,rect.left+2,rect.top+2+dy,m_iconX,m_iconY,
00374                         (HBITMAP)(bitmapstandard),0,0);
00375                     else
00376                         DitherBlt2(pDC,rect.left+2,rect.top+2+dy,m_iconX,m_iconY,
00377                         bitmapstandard,0,0);
00378                     bitmapstandard.DeleteObject();
00379                 }
00380             }
00381             else if(selectedflag){
00382                 pDC->FillRect (rect2,&m_brBackground);
00383                 rect2.SetRect(rect.left,rect.top+dy,rect.left+m_iconX+4,
00384                     rect.top+m_iconY+4+dy);
00385                 if (IsNewShell()){
00386                     if(state&ODS_CHECKED)
00387                         pDC->Draw3dRect(rect2,GetSysColor(COLOR_3DSHADOW),
00388                         GetSysColor(COLOR_3DHILIGHT));
00389                     else
00390                         pDC->Draw3dRect(rect2,GetSysColor(COLOR_3DHILIGHT),
00391                         GetSysColor(COLOR_3DSHADOW));
00392                 }
00393                 CPoint ptImage(rect.left+2,rect.top+2+dy);
00394                 if(bitmap)bitmap->Draw(pDC,xoffset,ptImage,ILD_TRANSPARENT);
00395             }
00396             else{
00397                 if(state&ODS_CHECKED){
00398                     CBrush brush;
00399                     COLORREF col =GetSysColor(COLOR_3DLIGHT);
00400                     brush.CreateSolidBrush(col);
00401                     pDC->FillRect(rect2,&brush);
00402                     brush.DeleteObject();
00403                     rect2.SetRect(rect.left,rect.top+dy,rect.left+m_iconX+4,
00404                         rect.top+m_iconY+4+dy);
00405                     if (IsNewShell())
00406                         pDC->Draw3dRect(rect2,GetSysColor(COLOR_3DSHADOW),
00407                         GetSysColor(COLOR_3DHILIGHT));
00408                 }
00409                 else{
00410                     pDC->FillRect (rect2,&m_brBackground);
00411                     rect2.SetRect(rect.left,rect.top+dy,rect.left+m_iconX+4,
00412                         rect.top+m_iconY+4+dy);
00413                     pDC->Draw3dRect (rect2,m_clrBack,m_clrBack);
00414                 }
00415                 CPoint ptImage(rect.left+2,rect.top+2+dy);
00416                 if(bitmap)bitmap->Draw(pDC,xoffset,ptImage,ILD_TRANSPARENT);
00417             }
00418         }
00419         if(nIconNormal<0 && state&ODS_CHECKED && !checkflag){
00420             rect2.SetRect(rect.left+1,rect.top+2+dy,rect.left+m_iconX+1,
00421                 rect.top+m_iconY+2+dy);
00422             CMenuItemInfo info;
00423             info.fMask = MIIM_CHECKMARKS;
00424             ::GetMenuItemInfo((HMENU)lpDIS->hwndItem,lpDIS->itemID,
00425                 MF_BYCOMMAND, &info);
00426             if(state&ODS_CHECKED || info.hbmpUnchecked) {
00427                 Draw3DCheckmark(pDC, rect2, state&ODS_SELECTED,
00428                     state&ODS_CHECKED ? info.hbmpChecked :
00429                 info.hbmpUnchecked);
00430             }
00431         }
00432
00433         //This is needed always so that we can have the space for check marks
00434
00435         x0=rect.left;y0=rect.top;
00436         rect.left = rect.left + m_iconX + 8 + GAP;
00437
00438         if(!strText.IsEmpty()){
00439
00440             CRect rectt(rect.left,rect.top-1,rect.right,rect.bottom-1);
00441
00442             //   Find tabs
00443
00444             CString leftStr,rightStr;
00445             leftStr.Empty();rightStr.Empty();
00446             int tablocr=strText.ReverseFind(_T('\t'));
00447             if(tablocr!=-1){
00448                 rightStr=strText.Mid(tablocr+1);
00449                 leftStr=strText.Left(strText.Find(_T('\t')));
00450                 rectt.right-=m_iconX;
00451             }
00452             else leftStr=strText;
00453
00454             int iOldMode = pDC->GetBkMode();
00455             pDC->SetBkMode( TRANSPARENT);
00456
00457             // Draw the text in the correct colour:
00458
00459             UINT nFormat  = DT_LEFT|DT_SINGLELINE|DT_VCENTER;
00460             UINT nFormatr = DT_RIGHT|DT_SINGLELINE|DT_VCENTER;
00461             if(!(lpDIS->itemState & ODS_GRAYED)){
00462                 pDC->SetTextColor(crText);
00463                 pDC->DrawText (leftStr,rectt,nFormat);
00464                 if(tablocr!=-1) pDC->DrawText (rightStr,rectt,nFormatr);
00465             }
00466             else{
00467
00468                 // Draw the disabled text
00469                 if(!(state & ODS_SELECTED)){
00470                     RECT offset = *rectt;
00471                     offset.left+=1;
00472                     offset.right+=1;
00473                     offset.top+=1;
00474                     offset.bottom+=1;
00475                     pDC->SetTextColor(GetSysColor(COLOR_BTNHILIGHT));
00476                     pDC->DrawText(leftStr,&offset, nFormat);
00477                     if(tablocr!=-1) pDC->DrawText (rightStr,&offset,nFormatr);
00478                     pDC->SetTextColor(GetSysColor(COLOR_GRAYTEXT));
00479                     pDC->DrawText(leftStr,rectt, nFormat);
00480                     if(tablocr!=-1) pDC->DrawText (rightStr,rectt,nFormatr);
00481                 }
00482                 else{
00483                     // And the standard Grey text:
00484                     pDC->SetTextColor(m_clrBack);
00485                     pDC->DrawText(leftStr,rectt, nFormat);
00486                     if(tablocr!=-1) pDC->DrawText (rightStr,rectt,nFormatr);
00487                 }
00488             }
00489             pFont = pDC->SelectObject (&dispFont);
00490             pDC->SetBkMode( iOldMode );
00491             pDC->SelectObject (pFont); //set it to the old font
00492         }
00493
00494         m_penBack.DeleteObject();
00495         m_brBackground.DeleteObject();
00496         m_fontMenu.DeleteObject();
00497         m_brSelect.DeleteObject();
00498         dispFont.DeleteObject ();
00499   }
00500 }
00501
00502 BOOL CCJMenu::GetBitmapFromImageList(CDC* pDC,CImageList *imglist,int nIndex,CBitmap &bmp)
00503 {
00504     HICON hIcon = imglist->ExtractIcon(nIndex);
00505     CDC dc;
00506     dc.CreateCompatibleDC(pDC);
00507     bmp.CreateCompatibleBitmap(pDC,m_iconX,m_iconY);
00508     CBitmap* pOldBmp = dc.SelectObject(&bmp);
00509     CBrush brush ;
00510     brush.CreateSolidBrush(GetSysColor(COLOR_MENU));
00511     ::DrawIconEx(
00512         dc.GetSafeHdc(),
00513         0,
00514         0,
00515         hIcon,
00516         m_iconX,
00517         m_iconY,
00518         0,
00519         (HBRUSH)brush,
00520         DI_NORMAL
00521         );
00522     dc.SelectObject( pOldBmp );
00523     dc.DeleteDC();
00524     // the icon is not longer needed
00525     DestroyIcon(hIcon);
00526     return(TRUE);
00527 }
00528
00529 /*
00530 ==========================================================================
00531 void CCJMenu::MeasureItem(LPMEASUREITEMSTRUCT)
00532 ---------------------------------------------
00533
00534   Called by the framework when it wants to know what the width and height
00535   of our item will be.  To accomplish this we provide the width of the
00536   icon plus the width of the menu text, and then the height of the icon.
00537
00538 ==========================================================================
00539 */
00540
00541 void CCJMenu::MeasureItem( LPMEASUREITEMSTRUCT lpMIS )
00542 {
00543     UINT state = (((CCJMenuData*)(lpMIS->itemData))->nFlags);
00544     if(state & MF_SEPARATOR){
00545         lpMIS->itemWidth = 0;
00546         lpMIS->itemHeight = GetSystemMetrics(SM_CYMENU)>>1;
00547     }
00548     else{
00549         CFont m_fontMenu;
00550         LOGFONT m_lf;
00551         ZeroMemory ((PVOID) &m_lf,sizeof (LOGFONT));
00552         NONCLIENTMETRICS nm;
00553         nm.cbSize = sizeof (NONCLIENTMETRICS);
00554         VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
00555             nm.cbSize,&nm,0));
00556         m_lf =  nm.lfMenuFont;
00557         m_fontMenu.CreateFontIndirect (&m_lf);
00558
00559         // Obtain the width of the text:
00560         CWnd *pWnd = AfxGetMainWnd();            // Get main window
00561         CDC *pDC = pWnd->GetDC();              // Get device context
00562         CFont* pFont=NULL;    // Select menu font in...
00563
00564         if (IsNewShell())
00565             pFont = pDC->SelectObject (&m_fontMenu);// Select menu font in...
00566
00567         //Get pointer to text SK
00568         const wchar_t *lpstrText = ((CCJMenuData*)(lpMIS->itemData))->GetWideString();//SK: we use const to prevent misuse
00569
00570
00571         SIZE size;
00572
00573         if (Win32s!=g_Shell)
00574             VERIFY(::GetTextExtentPoint32W(pDC->m_hDC,lpstrText,
00575             wcslen(lpstrText),&size)); //SK should also work on 95
00576 #ifndef UNICODE //can't be UNICODE for Win32s
00577         else{//it's Win32suckx
00578             RECT rect;
00579             rect.left=rect.top=0;
00580             size.cy=DrawText(pDC->m_hDC,(LPCTSTR)lpstrText,
00581                 wcslen(lpstrText),&rect,
00582                 DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_CALCRECT);
00583             //+3 makes at least three pixels space to the menu border
00584             size.cx=rect.right-rect.left+3;
00585             size.cx += 3*(size.cx/wcslen(lpstrText));
00586         }
00587 #endif
00588
00589         CSize t = CSize(size);
00590         if(IsNewShell())
00591             pDC->SelectObject (pFont);  // Select old font in
00592         AfxGetMainWnd()->ReleaseDC(pDC);  // Release the DC
00593
00594         // Set width and height:
00595
00596         lpMIS->itemWidth = m_iconX + t.cx + m_iconX + GAP;
00597         int temp = GetSystemMetrics(SM_CYMENU);
00598         lpMIS->itemHeight = temp>m_iconY+4 ? temp : m_iconY+4;
00599         m_fontMenu.DeleteObject();
00600     }
00601 }
00602
00603 void CCJMenu::SetIconSize (int width, int height)
00604 {
00605     m_iconX = width;
00606     m_iconY = height;
00607 }
00608
00609 BOOL CCJMenu::AppendODMenuA(LPCSTR lpstrText,UINT nFlags,UINT nID,
00610                             int nIconNormal)
00611 {
00612     USES_CONVERSION;
00613     return AppendODMenuW(A2W(lpstrText),nFlags,nID,nIconNormal);//SK: See MFC Tech Note 059
00614 }
00615
00616
00617 BOOL CCJMenu::AppendODMenuW(wchar_t *lpstrText,UINT nFlags,UINT nID,
00618                             int nIconNormal)
00619 {
00620     // Add the MF_OWNERDRAW flag if not specified:
00621     if(!nID)nFlags=MF_SEPARATOR|MF_OWNERDRAW;
00622     else if(!(nFlags & MF_OWNERDRAW))nFlags |= MF_OWNERDRAW;
00623
00624     if(nFlags & MF_POPUP){
00625         m_AllSubMenus.Add((HMENU)nID);
00626         m_SubMenus.Add((HMENU)nID);
00627     }
00628
00629     CCJMenuData *mdata = new CCJMenuData;
00630     m_MenuList.Add(mdata);
00631     mdata->SetWideString(lpstrText);    //SK: modified for dynamic allocation
00632
00633     mdata->menuIconNormal = nIconNormal;
00634     mdata->xoffset=-1;
00635     if(nIconNormal>=0){
00636         mdata->xoffset=0;
00637         LoadFromToolBar(nID,nIconNormal,mdata->xoffset);
00638         if(mdata->bitmap)mdata->bitmap->DeleteImageList();
00639         else mdata->bitmap=new(CImageList);
00640         mdata->bitmap->Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
00641         if(!AddBitmapToImageList(mdata->bitmap,nIconNormal)){
00642             mdata->bitmap->DeleteImageList();
00643             delete mdata->bitmap;
00644             mdata->bitmap=NULL;
00645             mdata->menuIconNormal = nIconNormal = -1;
00646             mdata->xoffset = -1;
00647         }
00648     }
00649     mdata->nFlags = nFlags;
00650     mdata->nID = nID;
00651     return(CMenu::AppendMenu(nFlags, nID, (LPCTSTR)mdata));
00652 }
00653
00654 BOOL CCJMenu::AppendODMenuA(LPCSTR lpstrText,UINT nFlags,UINT nID,
00655                             CImageList *il,int xoffset)
00656 {
00657     USES_CONVERSION;
00658     return AppendODMenuW(A2W(lpstrText),nFlags,nID,il,xoffset);
00659 }
00660
00661 BOOL CCJMenu::AppendODMenuW(wchar_t *lpstrText,UINT nFlags,UINT nID,
00662                             CImageList *il,int xoffset)
00663 {
00664     // Add the MF_OWNERDRAW flag if not specified:
00665     if(!nID)nFlags=MF_SEPARATOR|MF_OWNERDRAW;
00666     else if(!(nFlags & MF_OWNERDRAW))nFlags |= MF_OWNERDRAW;
00667
00668     if(nFlags & MF_POPUP){
00669         m_AllSubMenus.Add((HMENU)nID);
00670         m_SubMenus.Add((HMENU)nID);
00671     }
00672
00673     CCJMenuData *mdata = new CCJMenuData;
00674     m_MenuList.Add(mdata);
00675     mdata->SetWideString(lpstrText);    //SK: modified for dynamic allocation
00676
00677     if(il){
00678         mdata->menuIconNormal = 0;
00679         mdata->xoffset=xoffset;
00680         if(mdata->bitmap)mdata->bitmap->Detach();
00681         else mdata->bitmap=new(CImageList);
00682         mdata->bitmap->Attach(ImageList_Duplicate(il->m_hImageList));
00683     }
00684     else{
00685         mdata->menuIconNormal = -1;
00686         mdata->xoffset = -1;
00687     }
00688     mdata->nFlags = nFlags;
00689     mdata->nID = nID;
00690     return(CMenu::AppendMenu(nFlags, nID, (LPCTSTR)mdata));
00691 }
00692
00693 BOOL CCJMenu::InsertODMenuA(UINT nPosition,LPCSTR lpstrText,UINT nFlags,UINT nID,
00694                             int nIconNormal)
00695 {
00696     USES_CONVERSION;
00697     return InsertODMenuW(nPosition,A2W(lpstrText),nFlags,nID,nIconNormal);
00698 }
00699
00700
00701 BOOL CCJMenu::InsertODMenuW(UINT nPosition,wchar_t *lpstrText,UINT nFlags,UINT nID,
00702                             int nIconNormal)
00703 {
00704     // Add the MF_OWNERDRAW flag if not specified:
00705     if(!nID)nFlags=MF_SEPARATOR|MF_OWNERDRAW;
00706     else if(!(nFlags & MF_OWNERDRAW))nFlags |= MF_OWNERDRAW;
00707
00708     if(nFlags & MF_POPUP){
00709         m_AllSubMenus.Add((HMENU)nID);
00710         m_SubMenus.InsertAt(nPosition,(HMENU)nID);
00711     }
00712
00713     CCJMenuData *mdata = new CCJMenuData;
00714     m_MenuList.InsertAt(nPosition,mdata);
00715     mdata->SetWideString(lpstrText);    //SK: modified for dynamic allocation
00716
00717     mdata->menuIconNormal = nIconNormal;
00718     mdata->xoffset=-1;
00719     if(nIconNormal>=0){
00720         mdata->xoffset=0;
00721         LoadFromToolBar(nID,nIconNormal,mdata->xoffset);
00722         if(mdata->bitmap)mdata->bitmap->DeleteImageList();
00723         else mdata->bitmap=new(CImageList);
00724         mdata->bitmap->Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
00725         if(!AddBitmapToImageList(mdata->bitmap,nIconNormal)){
00726             mdata->bitmap->DeleteImageList();
00727             delete mdata->bitmap;
00728             mdata->bitmap=NULL;
00729             mdata->menuIconNormal = nIconNormal = -1;
00730             mdata->xoffset = -1;
00731         }
00732     }
00733     mdata->nFlags = nFlags;
00734     mdata->nID = nID;
00735     return(CMenu::InsertMenu(nPosition,nFlags,nID,(LPCTSTR)mdata));
00736 }
00737
00738 BOOL CCJMenu::InsertODMenuA(UINT nPosition,LPCSTR lpstrText,UINT nFlags,UINT nID,
00739                             CImageList *il,int xoffset)
00740 {
00741     USES_CONVERSION;
00742     return InsertODMenuW(nPosition,A2W(lpstrText),nFlags,nID,il,xoffset);
00743 }
00744
00745 BOOL CCJMenu::InsertODMenuW(UINT nPosition,wchar_t *lpstrText,UINT nFlags,UINT nID,
00746                             CImageList *il,int xoffset)
00747 {
00748     // Add the MF_OWNERDRAW flag if not specified:
00749     if(!nID)nFlags=MF_SEPARATOR|MF_OWNERDRAW;
00750     else if(!(nFlags & MF_OWNERDRAW))nFlags |= MF_OWNERDRAW;
00751
00752     if(nFlags & MF_POPUP){
00753         m_AllSubMenus.Add((HMENU)nID);
00754         m_SubMenus.InsertAt(nPosition,(HMENU)nID);
00755     }
00756
00757     CCJMenuData *mdata = new CCJMenuData;
00758     m_MenuList.InsertAt(nPosition,mdata);
00759     mdata->SetWideString(lpstrText);    //SK: modified for dynamic allocation
00760
00761     if(il){
00762         mdata->menuIconNormal = 0;
00763         mdata->xoffset=xoffset;
00764         if(mdata->bitmap)mdata->bitmap->Detach();
00765         else mdata->bitmap=new(CImageList);
00766         mdata->bitmap->Attach(ImageList_Duplicate(il->m_hImageList));
00767     }
00768     else{
00769         mdata->menuIconNormal = -1;
00770         mdata->xoffset = -1;
00771     }
00772     mdata->nFlags = nFlags;
00773     mdata->nID = nID;
00774     return(CMenu::InsertMenu(nPosition,nFlags,nID,(LPCTSTR)mdata));
00775 }
00776
00777 BOOL CCJMenu::ModifyODMenuA(const char * lpstrText,UINT nID,int nIconNormal)
00778 {
00779     USES_CONVERSION;
00780     return ModifyODMenuW(A2W(lpstrText),nID,nIconNormal);//SK: see MFC Tech Note 059
00781 }
00782
00783 BOOL CCJMenu::ModifyODMenuW(wchar_t *lpstrText,UINT nID,int nIconNormal)
00784 {
00785     int nLoc;
00786     CCJMenuData *mdata;
00787
00788     // Find the old CCJMenuData structure:
00789     CCJMenu *psubmenu = FindMenuOption(nID,nLoc);
00790     if(psubmenu && nLoc>=0)mdata = psubmenu->m_MenuList[nLoc];
00791     else{
00792         // Create a new CCJMenuData structure:
00793         mdata = new CCJMenuData;
00794         m_MenuList.Add(mdata);
00795     }
00796
00797     ASSERT(mdata);
00798     if(lpstrText)
00799         mdata->SetWideString(lpstrText);  //SK: modified for dynamic allocation
00800     mdata->menuIconNormal = nIconNormal;
00801     mdata->xoffset=-1;
00802     if(nIconNormal>=0){
00803         mdata->xoffset=0;
00804         LoadFromToolBar(nID,nIconNormal,mdata->xoffset);
00805         if(mdata->bitmap)mdata->bitmap->DeleteImageList();
00806         else mdata->bitmap=new CImageList;
00807         mdata->bitmap->Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
00808         if(!AddBitmapToImageList(mdata->bitmap,nIconNormal)){
00809             mdata->bitmap->DeleteImageList();
00810             delete mdata->bitmap;
00811             mdata->bitmap=NULL;
00812             mdata->menuIconNormal = nIconNormal = -1;
00813             mdata->xoffset = -1;
00814         }
00815     }
00816     mdata->nFlags = MF_BYCOMMAND | MF_OWNERDRAW;
00817     mdata->nID = nID;
00818     return (CMenu::ModifyMenu(nID,mdata->nFlags,nID,(LPCTSTR)mdata));
00819 }
00820
00821 BOOL CCJMenu::ModifyODMenuA(const char * lpstrText,UINT nID,CImageList *il,int xoffset)
00822 {
00823     USES_CONVERSION;
00824     return ModifyODMenuW(A2W(lpstrText),nID,il,xoffset);
00825 }
00826
00827 BOOL CCJMenu::ModifyODMenuW(wchar_t *lpstrText,UINT nID,CImageList *il,int xoffset)
00828 {
00829     int nLoc;
00830     CCJMenuData *mdata;
00831
00832     // Find the old CCJMenuData structure:
00833     CCJMenu *psubmenu = FindMenuOption(nID,nLoc);
00834     if(psubmenu && nLoc>=0)mdata = psubmenu->m_MenuList[nLoc];
00835     else{
00836         // Create a new CCJMenuData structure:
00837         mdata = new CCJMenuData;
00838         m_MenuList.Add(mdata);
00839     }
00840
00841     ASSERT(mdata);
00842     if(lpstrText)
00843         mdata->SetWideString(lpstrText);  //SK: modified for dynamic allocation
00844     if(il){
00845         mdata->menuIconNormal = 0;
00846         mdata->xoffset=xoffset;
00847         if(mdata->bitmap)mdata->bitmap->Detach();
00848         else mdata->bitmap=new(CImageList);
00849         mdata->bitmap->Attach(ImageList_Duplicate(il->m_hImageList));
00850     }
00851     else{
00852         mdata->menuIconNormal = -1;
00853         mdata->xoffset = -1;
00854     }
00855     mdata->nFlags = MF_BYCOMMAND | MF_OWNERDRAW;
00856     mdata->nID = nID;
00857     return (CMenu::ModifyMenu(nID,mdata->nFlags,nID,(LPCTSTR)mdata));
00858 }
00859
00860 BOOL CCJMenu::ModifyODMenuA(const char * lpstrText,UINT nID,CBitmap *bmp)
00861 {
00862     USES_CONVERSION;
00863     return ModifyODMenuW(A2W(lpstrText),nID,bmp);
00864 }
00865
00866 BOOL CCJMenu::ModifyODMenuW(wchar_t *lpstrText,UINT nID,CBitmap *bmp)
00867 {
00868     if(bmp){
00869         CImageList temp;
00870         temp.Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
00871         if(m_bitmapBackgroundFlag)temp.Add(bmp,m_bitmapBackground);
00872         else temp.Add(bmp,GetSysColor(COLOR_3DFACE));
00873         return ModifyODMenuW(lpstrText,nID,&temp,0);
00874     }
00875     return ModifyODMenuW(lpstrText,nID,NULL,0);
00876 }
00877
00878
00879 BOOL CCJMenu::ModifyODMenuA(const char *lpstrText,const char *OptionText,
00880                             int nIconNormal)
00881 {
00882     USES_CONVERSION;
00883     return ModifyODMenuW(A2W(lpstrText),A2W(OptionText),nIconNormal);//SK: see MFC  Tech Note 059
00884 }
00885
00886 BOOL CCJMenu::ModifyODMenuW(wchar_t *lpstrText,wchar_t *OptionText,
00887                             int nIconNormal)
00888 {
00889     CCJMenuData *mdata;
00890
00891     // Find the old CCJMenuData structure:
00892     CString junk=OptionText;
00893     mdata=FindMenuOption(OptionText);
00894     if(mdata){
00895         if(lpstrText)
00896             mdata->SetWideString(lpstrText);//SK: modified for dynamic allocation
00897         mdata->menuIconNormal = nIconNormal;
00898         mdata->xoffset=-1;
00899         if(nIconNormal>=0){
00900             mdata->xoffset=0;
00901             if(mdata->bitmap)mdata->bitmap->DeleteImageList();
00902             else mdata->bitmap=new(CImageList);
00903             mdata->bitmap->Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
00904             if(!AddBitmapToImageList(mdata->bitmap,nIconNormal)){
00905                 mdata->bitmap->DeleteImageList();
00906                 delete mdata->bitmap;
00907                 mdata->bitmap=NULL;
00908                 mdata->menuIconNormal = nIconNormal = -1;
00909                 mdata->xoffset = -1;
00910             }
00911         }
00912         return(TRUE);
00913     }
00914     return(FALSE);
00915 }
00916
00917 CCJMenuData *CCJMenu::NewODMenu(UINT pos,UINT nFlags,UINT nID,CString string)
00918 {
00919     CCJMenuData *mdata;
00920
00921     mdata = new CCJMenuData;
00922     mdata->menuIconNormal = -1;
00923     mdata->xoffset=-1;
00924 #ifdef UNICODE
00925     mdata->SetWideString((LPCTSTR)string);//SK: modified for dynamic allocation
00926 #else
00927     mdata->SetAnsiString(string);
00928 #endif
00929     mdata->nFlags = nFlags;
00930     mdata->nID = nID;
00931
00932     if(nFlags & MF_POPUP)m_AllSubMenus.Add((HMENU)nID);
00933
00934     if (nFlags&MF_OWNERDRAW){
00935         ASSERT(!(nFlags&MF_STRING));
00936         ModifyMenu(pos,nFlags,nID,(LPCTSTR)mdata);
00937     }
00938     else if (nFlags&MF_STRING){
00939         ASSERT(!(nFlags&MF_OWNERDRAW));
00940         ModifyMenu(pos,nFlags,nID,mdata->GetString());
00941     }
00942     else{
00943         ASSERT(nFlags&MF_SEPARATOR);
00944         ModifyMenu(pos,nFlags,nID);
00945     }
00946
00947     return(mdata);
00948 };
00949
00950 BOOL CCJMenu::LoadToolbars(const UINT *arID,int n)
00951 {
00952     ASSERT(arID);
00953     BOOL returnflag=TRUE;
00954     for(int i=0;i<n;++i){
00955         if(!LoadToolbar(arID[i]))returnflag=FALSE;
00956     }
00957     return(returnflag);
00958 }
00959
00960 BOOL CCJMenu::LoadToolbar(UINT nToolBar)
00961 {
00962     UINT nID;
00963     BOOL returnflag=FALSE;
00964     CToolBar bar;
00965
00966     bar.Create(AfxGetMainWnd());
00967     if(bar.LoadToolBar(nToolBar)){
00968         for(int i=0;i<bar.GetCount();++i){
00969             nID = bar.GetItemID(i);
00970             if(nID && GetMenuState(nID, MF_BYCOMMAND)
00971                 !=0xFFFFFFFF){
00972                 ModifyODMenu(NULL,nID,nToolBar);
00973             }
00974         }
00975         returnflag=TRUE;
00976     }
00977     return(returnflag);
00978 }
00979
00980 BOOL CCJMenu::LoadFromToolBar(UINT nID,UINT nToolBar,int& xoffset)
00981 {
00982     int xset,offset;
00983     UINT nStyle;
00984     BOOL returnflag=FALSE;
00985     CToolBar bar;
00986
00987     bar.Create(AfxGetMainWnd());
00988     if(bar.LoadToolBar(nToolBar)){
00989         offset=bar.CommandToIndex(nID);
00990         if(offset>=0){
00991             bar.GetButtonInfo(offset,nID,nStyle,xset);
00992             if(xset>0)xoffset=xset;
00993             returnflag=TRUE;
00994         }
00995     }
00996     return(returnflag);
00997 }
00998
00999 CCJMenu *CCJMenu::FindMenuOption(int nId,int& nLoc)
01000 {
01001     int i;
01002     CCJMenu *psubmenu,*pgoodmenu;
01003
01004     for(i=0;i<(int)(GetMenuItemCount());++i){
01005 #ifdef _CPPRTTI
01006         psubmenu=dynamic_cast<CCJMenu *>(GetSubMenu(i));
01007 #else
01008         psubmenu=(CCJMenu *)GetSubMenu(i);
01009 #endif
01010         if(psubmenu){
01011             pgoodmenu=psubmenu->FindMenuOption(nId,nLoc);
01012             if(pgoodmenu)return(pgoodmenu);
01013         }
01014         else if(nId==(int)GetMenuItemID(i)){
01015             nLoc=i;
01016             return(this);
01017         }
01018     }
01019     nLoc = -1;
01020     return(NULL);
01021 }
01022
01023 CCJMenuData *CCJMenu::FindMenuOption(wchar_t *lpstrText)
01024 {
01025     int i,j;
01026     CCJMenu *psubmenu;
01027     CCJMenuData *pmenulist;
01028
01029     for(i=0;i<(int)(GetMenuItemCount());++i){
01030 #ifdef _CPPRTTI
01031         psubmenu=dynamic_cast<CCJMenu *>(GetSubMenu(i));
01032 #else
01033         psubmenu=(CCJMenu *)GetSubMenu(i);
01034 #endif
01035         if(psubmenu){
01036             pmenulist=psubmenu->FindMenuOption(lpstrText);
01037             if(pmenulist)return(pmenulist);
01038         }
01039         else{
01040             const wchar_t *szWide;//SK: we use const to prevent misuse of this Ptr
01041             for(j=0;j<=m_MenuList.GetUpperBound();++j){
01042                 szWide = m_MenuList[j]->GetWideString ();
01043                 if(szWide && !wcscmp(lpstrText,szWide))//SK: modified for dynamic allocation
01044                     return(m_MenuList[j]);
01045             }
01046         }
01047     }
01048     return(NULL);
01049 }
01050
01051
01052 BOOL CCJMenu::LoadMenu(int nResource)
01053 {
01054     return(CCJMenu::LoadMenu(MAKEINTRESOURCE(nResource)));
01055 };
01056
01057 BOOL CCJMenu::LoadMenu(LPCTSTR lpszResourceName)
01058 {
01059     TRACE(_T(
01060         "IMPORTANT:Use CCJMenu::DestroyMenu to destroy Loaded Menu's\n"));
01061     ASSERT_VALID(this);
01062     ASSERT(lpszResourceName != NULL);
01063
01064     // Find the Menu Resource:
01065     HINSTANCE m_hInst = AfxFindResourceHandle(lpszResourceName,RT_MENU);
01066     HRSRC hRsrc = ::FindResource(m_hInst,lpszResourceName,RT_MENU);
01067     if(hRsrc == NULL)return FALSE;
01068
01069     // Get size of resource:
01070
01071     DWORD dwSize = SizeofResource(NULL, hRsrc);
01072
01073     // Load the Menu Resource:
01074
01075     HGLOBAL hGlobal = LoadResource(m_hInst, hRsrc);
01076     if(hGlobal == NULL)return FALSE;
01077
01078     // Attempt to create us as a menu...
01079
01080     if(!CMenu::CreateMenu())return FALSE;
01081
01082     // Get Item template Header, and calculate offset of MENUITEMTEMPLATES
01083
01084     MENUITEMTEMPLATEHEADER *pTpHdr=
01085         (MENUITEMTEMPLATEHEADER*)LockResource(hGlobal);
01086     BYTE* pTp=(BYTE*)pTpHdr +
01087         (sizeof(MENUITEMTEMPLATEHEADER) + pTpHdr->offset);
01088
01089
01090     // Variables needed during processing of Menu Item Templates:
01091
01092     int j=0;
01093     CCJMenuData*  pData = NULL;              // New OD Menu Item Data
01094     WORD    dwFlags = 0;              // Flags of the Menu Item
01095     WORD    dwID  = 0;              // ID of the Menu Item
01096     UINT    uFlags;                  // Actual Flags.
01097     wchar_t *szCaption=NULL;
01098     int      nLen   = 0;                // Length of caption
01099     CTypedPtrArray<CPtrArray, CCJMenu*>  m_Stack;    // Popup menu stack
01100     CArray<BOOL,BOOL>  m_StackEnd;    // Popup menu stack
01101     m_Stack.Add(this);                  // Add it to this...
01102     m_StackEnd.Add(FALSE);
01103
01104     do{
01105         // Obtain Flags and (if necessary), the ID...
01106         memcpy(&dwFlags, pTp, sizeof(WORD));pTp+=sizeof(WORD);// Obtain Flags
01107         if(!(dwFlags & MF_POPUP)){
01108             memcpy(&dwID, pTp, sizeof(WORD)); // Obtain ID
01109             pTp+=sizeof(WORD);
01110         }
01111         else dwID = 0;
01112
01113         uFlags = (UINT)dwFlags; // Remove MF_END from the flags that will
01114         if(uFlags & MF_END) // be passed to the Append(OD)Menu functions.
01115             uFlags -= MF_END;
01116
01117         // Obtain Caption (and length)
01118
01119         nLen = 0;
01120         char *ch = (char*)pTp;
01121         szCaption=new wchar_t[wcslen((wchar_t *)pTp)+1];
01122         wcscpy(szCaption,(wchar_t *)pTp);
01123         pTp=&pTp[(wcslen((wchar_t *)pTp)+1)*sizeof(wchar_t)];//modified SK
01124
01125         // Handle popup menus first....
01126
01127         //WideCharToMultiByte
01128         if(dwFlags & MF_POPUP){
01129             if(dwFlags & MF_END)m_StackEnd.SetAt(m_Stack.GetUpperBound(),TRUE);
01130             CCJMenu* pSubMenu = new CCJMenu;
01131             pSubMenu->m_unselectcheck=m_unselectcheck;
01132             pSubMenu->m_selectcheck=m_selectcheck;
01133             pSubMenu->checkmaps=checkmaps;
01134             pSubMenu->checkmapsshare=TRUE;
01135             pSubMenu->CreatePopupMenu();
01136
01137             // Append it to the top of the stack:
01138
01139             m_Stack[m_Stack.GetUpperBound()]->AppendODMenuW(szCaption,uFlags,
01140                 (UINT)pSubMenu->m_hMenu, -1);
01141             m_Stack.Add(pSubMenu);
01142             m_StackEnd.Add(FALSE);
01143         }
01144         else {
01145             m_Stack[m_Stack.GetUpperBound()]->AppendODMenuW(szCaption, uFlags,
01146                 dwID, -1);
01147             if(dwFlags & MF_END)m_StackEnd.SetAt(m_Stack.GetUpperBound(),TRUE);
01148             j = m_Stack.GetUpperBound();
01149             while(j>=0 && m_StackEnd.GetAt(j)){
01150                 m_Stack[m_Stack.GetUpperBound()]->InsertSpaces();
01151                 m_Stack.RemoveAt(j);
01152                 m_StackEnd.RemoveAt(j);
01153                 --j;
01154             }
01155         }
01156
01157         delete[] szCaption;
01158     }while(m_Stack.GetUpperBound() != -1);
01159
01160     for(int i=0;i<(int)GetMenuItemCount();++i){
01161         CString str=m_MenuList[i]->GetString();
01162
01163         if(GetSubMenu(i)){
01164             m_MenuList[i]->nFlags=MF_POPUP|MF_BYPOSITION;
01165             ModifyMenu(i,MF_POPUP|MF_BYPOSITION,
01166                 (UINT)GetSubMenu(i)->m_hMenu,str);
01167         }
01168         else{
01169             m_MenuList[i]->nFlags=MF_STRING|MF_BYPOSITION;
01170             ModifyMenu(i,MF_STRING|MF_BYPOSITION,m_MenuList[i]->nID,str);
01171         }
01172     }
01173
01174     return(TRUE);
01175 }
01176
01177 void CCJMenu::InsertSpaces(void)
01178 {
01179     int i,j,numitems,maxlength;
01180     CString string,newstring;
01181     CSize t;
01182     CFont m_fontMenu;
01183     LOGFONT m_lf;
01184
01185     ZeroMemory ((PVOID) &m_lf,sizeof (LOGFONT));
01186     NONCLIENTMETRICS nm;
01187     nm.cbSize = sizeof (NONCLIENTMETRICS);
01188     VERIFY (SystemParametersInfo (SPI_GETNONCLIENTMETRICS,nm.cbSize,&nm,0));
01189     m_lf =  nm.lfMenuFont;
01190     m_fontMenu.CreateFontIndirect (&m_lf);
01191
01192     CWnd *pWnd = AfxGetMainWnd();
01193     CDC *pDC = pWnd->GetDC();
01194     CFont* pFont = pDC->SelectObject (&m_fontMenu);
01195
01196     numitems=GetMenuItemCount();
01197     maxlength = -1;
01198     for(i=0;i<numitems;++i){
01199         string=m_MenuList[i]->GetString();
01200         j=string.Find((char)9);
01201         newstring.Empty();
01202         if(j!=-1)newstring=string.Left(j);
01203         else newstring=string;
01204         newstring+=_T(" ");//SK: modified for Unicode correctness.
01205         LPCTSTR lpstrText = (LPCTSTR)newstring;
01206         t=pDC->GetTextExtent(lpstrText,_tcslen(lpstrText));
01207         if(t.cx>maxlength)maxlength = t.cx;
01208     }
01209     for(i=0;i<numitems;++i){
01210         string=m_MenuList[i]->GetString();
01211         j=string.Find((char)9);
01212         if(j!=-1){
01213             newstring.Empty();
01214             newstring=string.Left(j);
01215             LPCTSTR lpstrText = (LPCTSTR)(newstring);
01216             t=pDC->GetTextExtent(lpstrText,_tcslen(lpstrText));
01217             while(t.cx<maxlength){
01218                 newstring+=_T(' ');//SK: modified for Unicode correctness
01219                 LPCTSTR lpstrText = (LPCTSTR)(newstring);
01220                 t=pDC->GetTextExtent(lpstrText,_tcslen(lpstrText));
01221             }
01222             newstring+=string.Mid(j);
01223 #ifdef UNICODE
01224             m_MenuList[i]->SetWideString(newstring);//SK: modified for dynamic allocation
01225 #else
01226             m_MenuList[i]->SetAnsiString(newstring);
01227 #endif
01228         }
01229     }
01230     pDC->SelectObject (pFont);              // Select old font in
01231     AfxGetMainWnd()->ReleaseDC(pDC);       // Release the DC
01232     m_fontMenu.DeleteObject();
01233 }
01234
01235 void CCJMenu::LoadCheckmarkBitmap(int unselect, int select)
01236 {
01237     if(unselect>0 && select>0){
01238         m_selectcheck=select;
01239         m_unselectcheck=unselect;
01240         if(checkmaps)checkmaps->DeleteImageList();
01241         else checkmaps=new(CImageList);
01242         checkmaps->Create(m_iconX,m_iconY,ILC_MASK,2,1);
01243         BOOL flag1=AddBitmapToImageList(checkmaps,unselect);
01244         BOOL flag2=AddBitmapToImageList(checkmaps,select);
01245         if(!flag1||!flag2){
01246             checkmaps->DeleteImageList();
01247             delete checkmaps;
01248             checkmaps=NULL;
01249         }
01250     }
01251 }
01252
01253 //--------------------------------------------------------------------------
01254 //[18.06.99 rj]
01255 BOOL CCJMenu::GetMenuText(UINT id, CString& string, UINT nFlags/*= MF_BYPOSITION*/)
01256 {
01257     BOOL returnflag=FALSE;
01258
01259     if(MF_BYPOSITION&nFlags){
01260         UINT numMenuItems = m_MenuList.GetUpperBound();
01261         if(id<=numMenuItems){
01262             string=m_MenuList[id]->GetString();
01263             returnflag=TRUE;
01264         }
01265     }
01266     else{
01267         int uiLoc;
01268         CCJMenu* pMenu = FindMenuOption(id,uiLoc);
01269         if(NULL!=pMenu) returnflag = pMenu->GetMenuText(uiLoc,string);
01270     }
01271     return(returnflag);
01272 }
01273
01274
01275 void CCJMenu::DrawRadioDot(CDC *pDC,int x,int y,COLORREF color)
01276 {
01277     CRect rcDot(x,y,x+6,y+6);
01278     CBrush brush;
01279     CPen pen;
01280     brush.CreateSolidBrush(color);
01281     pen.CreatePen(PS_SOLID,0,color);
01282     CBrush *pOldBrush=pDC->SelectObject(&brush);
01283     CPen *pOldPen=pDC->SelectObject(&pen);
01284     pDC->Ellipse(&rcDot);
01285     pDC->SelectObject(pOldBrush);
01286     pDC->SelectObject(pOldPen);
01287     pen.DeleteObject();
01288     brush.DeleteObject();
01289 }
01290
01291 void CCJMenu::DrawCheckMark(CDC* pDC,int x,int y,COLORREF color)
01292 {
01293     pDC->SetPixel(x,y+2,color);
01294     pDC->SetPixel(x,y+3,color);
01295     pDC->SetPixel(x,y+4,color);
01296
01297     pDC->SetPixel(x+1,y+3,color);
01298     pDC->SetPixel(x+1,y+4,color);
01299     pDC->SetPixel(x+1,y+5,color);
01300
01301     pDC->SetPixel(x+2,y+4,color);
01302     pDC->SetPixel(x+2,y+5,color);
01303     pDC->SetPixel(x+2,y+6,color);
01304
01305     pDC->SetPixel(x+3,y+3,color);
01306     pDC->SetPixel(x+3,y+4,color);
01307     pDC->SetPixel(x+3,y+5,color);
01308
01309     pDC->SetPixel(x+4,y+2,color);
01310     pDC->SetPixel(x+4,y+3,color);
01311     pDC->SetPixel(x+4,y+4,color);
01312
01313     pDC->SetPixel(x+5,y+1,color);
01314     pDC->SetPixel(x+5,y+2,color);
01315     pDC->SetPixel(x+5,y+3,color);
01316
01317     pDC->SetPixel(x+6,y,color);
01318     pDC->SetPixel(x+6,y+1,color);
01319     pDC->SetPixel(x+6,y+2,color);
01320 }
01321
01322 CCJMenuData *CCJMenu::FindMenuList(UINT nID)
01323 {
01324     for(int i=0;i<=m_MenuList.GetUpperBound();++i){
01325         if(m_MenuList[i]->nID==nID && !m_MenuList[i]->syncflag){
01326             m_MenuList[i]->syncflag=1;
01327             return(m_MenuList[i]);
01328         }
01329     }
01330     return(NULL);
01331 }
01332
01333 void CCJMenu::InitializeMenuList(int value)
01334 {
01335     for(int i=0;i<=m_MenuList.GetUpperBound();++i)
01336         m_MenuList[i]->syncflag=value;
01337 }
01338
01339 void CCJMenu::DeleteMenuList(void)
01340 {
01341     for(int i=0;i<=m_MenuList.GetUpperBound();++i){
01342         if(!m_MenuList[i]->syncflag){
01343             delete m_MenuList[i];
01344         }
01345     }
01346 }
01347
01348 void CCJMenu::SynchronizeMenu(void)
01349 {
01350     CTypedPtrArray<CPtrArray, CCJMenuData*> temp;
01351     CCJMenuData *mdata;
01352     CString string;
01353     UINT submenu,nID=0,state,j;
01354
01355     InitializeMenuList(0);
01356     for(j=0;j<GetMenuItemCount();++j){
01357         mdata=NULL;
01358         state=GetMenuState(j,MF_BYPOSITION);
01359         if(state&MF_POPUP){
01360             submenu=(UINT)GetSubMenu(j)->m_hMenu;
01361             mdata=FindMenuList(submenu);
01362             GetMenuString(j,string,MF_BYPOSITION);
01363             if(!mdata)mdata=NewODMenu(j,
01364                 (state&0xFF)|MF_BYPOSITION|MF_POPUP|MF_OWNERDRAW,submenu,string);
01365             else if(string.GetLength()>0)
01366 #ifdef UNICODE
01367                 mdata->SetWideString(string);  //SK: modified for dynamic allocation
01368 #else
01369             mdata->SetAnsiString(string);
01370 #endif
01371         }
01372         else if(state&MF_SEPARATOR){
01373             mdata=FindMenuList(0);
01374             if(!mdata)mdata=NewODMenu(j,
01375                 state|MF_BYPOSITION|MF_SEPARATOR|MF_OWNERDRAW,0,_T(""));//SK: modified for Unicode correctness
01376             else ModifyMenu(j,mdata->nFlags,nID,(LPCTSTR)mdata);
01377         }
01378         else{
01379             nID=GetMenuItemID(j);
01380             mdata=FindMenuList(nID);
01381             GetMenuString(j,string,MF_BYPOSITION);
01382             if(!mdata)mdata=NewODMenu(j,state|MF_BYPOSITION|MF_OWNERDRAW,
01383                 nID,string);
01384             else{
01385                 mdata->nFlags=state|MF_BYPOSITION|MF_OWNERDRAW;
01386                 if(string.GetLength()>0)
01387 #ifdef UNICODE
01388                     mdata->SetWideString(string);//SK: modified for dynamic allocation
01389 #else
01390                 mdata->SetAnsiString(string);
01391 #endif
01392
01393                 ModifyMenu(j,mdata->nFlags,nID,(LPCTSTR)mdata);
01394             }
01395         }
01396         if(mdata)temp.Add(mdata);
01397     }
01398     DeleteMenuList();
01399     m_MenuList.RemoveAll();
01400     m_MenuList.Append(temp);
01401     temp.RemoveAll();
01402 }
01403
01404 void CCJMenu::UpdateMenu(CMenu *pmenu)
01405 {
01406 #ifdef _CPPRTTI
01407     CCJMenu *psubmenu = dynamic_cast<CCJMenu *>(pmenu);
01408 #else
01409     CCJMenu *psubmenu = (CCJMenu *)pmenu;
01410 #endif
01411     if(psubmenu)psubmenu->SynchronizeMenu();
01412 }
01413
01414 LRESULT CCJMenu::FindKeyboardShortcut(UINT nChar, UINT nFlags,
01415                                       CMenu *pMenu)
01416 {
01417 #ifdef _CPPRTTI
01418     CCJMenu *pCCJMenu = dynamic_cast<CCJMenu *>(pMenu);
01419 #else
01420     CCJMenu *pCCJMenu = (CCJMenu *)pMenu;
01421 #endif
01422     if(pCCJMenu && nFlags&MF_POPUP){
01423         CString key(_T('&'),2);//SK: modified for Unicode correctness
01424         key.SetAt(1,(TCHAR)nChar);
01425         key.MakeLower();
01426         CString menutext;
01427         int menusize = (int)pCCJMenu->GetMenuItemCount();
01428         if(menusize!=(pCCJMenu->m_MenuList.GetUpperBound()+1))
01429             pCCJMenu->SynchronizeMenu();
01430         for(int i=0;i<menusize;++i){
01431             if(pCCJMenu->GetMenuText(i,menutext)){
01432                 menutext.MakeLower();
01433                 if(menutext.Find(key)>=0)return(MAKELRESULT(i,2));
01434             }
01435         }
01436     }
01437     return(0);
01438 }
01439
01440 void CCJMenu::DitherBlt (HDC hdcDest, int nXDest, int nYDest, int nWidth,
01441                          int nHeight, HBITMAP hbm, int nXSrc, int nYSrc)
01442 {
01443     ASSERT(hdcDest && hbm);
01444     ASSERT(nWidth > 0 && nHeight > 0);
01445
01446     // Create a generic DC for all BitBlts
01447     HDC hDC = CreateCompatibleDC(hdcDest);
01448     ASSERT(hDC);
01449
01450     if (hDC)
01451     {
01452         // Create a DC for the monochrome DIB section
01453         HDC bwDC = CreateCompatibleDC(hDC);
01454         ASSERT(bwDC);
01455
01456         if (bwDC)
01457         {
01458             // Create the monochrome DIB section with a black and white palette
01459             struct {
01460                 BITMAPINFOHEADER bmiHeader;
01461                 RGBQUAD      bmiColors[2];
01462             } RGBBWBITMAPINFO = {
01463
01464                 {    // a BITMAPINFOHEADER
01465                     sizeof(BITMAPINFOHEADER),  // biSize
01466                         nWidth,         // biWidth;
01467                         nHeight,        // biHeight;
01468                         1,            // biPlanes;
01469                         1,            // biBitCount
01470                         BI_RGB,         // biCompression;
01471                         0,            // biSizeImage;
01472                         0,            // biXPelsPerMeter;
01473                         0,            // biYPelsPerMeter;
01474                         0,            // biClrUsed;
01475                         0            // biClrImportant;
01476                 },
01477                 {
01478                     { 0x00, 0x00, 0x00, 0x00 }, { 0xFF, 0xFF, 0xFF, 0x00 }
01479                     }
01480             };
01481             VOID *pbitsBW;
01482             HBITMAP hbmBW = CreateDIBSection(bwDC,
01483                 (LPBITMAPINFO)&RGBBWBITMAPINFO, DIB_RGB_COLORS, &pbitsBW, NULL, 0);
01484             ASSERT(hbmBW);
01485
01486             if (hbmBW)
01487             {
01488                 // Attach the monochrome DIB section and the bitmap to the DCs
01489                 HBITMAP olddib = (HBITMAP)SelectObject(bwDC, hbmBW);
01490                 HBITMAP hdcolddib = (HBITMAP)SelectObject(hDC, hbm);
01491
01492                 // BitBlt the bitmap into the monochrome DIB section
01493                 BitBlt(bwDC, 0, 0, nWidth, nHeight, hDC, nXSrc, nYSrc, SRCCOPY);
01494
01495                 // Paint the destination rectangle in gray
01496                 FillRect(hdcDest, CRect(nXDest, nYDest, nXDest + nWidth, nYDest +
01497                     nHeight), GetSysColorBrush((IsNewShell())?COLOR_3DFACE:COLOR_MENU));
01498                 //SK: looks better on the old shell
01499                 // BitBlt the black bits in the monochrome bitmap into COLOR_3DHILIGHT
01500                 // bits in the destination DC
01501                 // The magic ROP comes from the Charles Petzold's book
01502                 HBRUSH hb = CreateSolidBrush(GetSysColor(COLOR_3DHILIGHT));
01503                 HBRUSH oldBrush = (HBRUSH)SelectObject(hdcDest, hb);
01504                 BitBlt(hdcDest,nXDest+1,nYDest+1,nWidth,nHeight,bwDC,0,0,0xB8074A);
01505
01506                 // BitBlt the black bits in the monochrome bitmap into COLOR_3DSHADOW
01507                 // bits in the destination DC
01508                 hb = CreateSolidBrush(GetSysColor(COLOR_3DSHADOW));
01509                 DeleteObject(SelectObject(hdcDest, hb));
01510                 BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight,bwDC,0,0,0xB8074A);
01511                 DeleteObject(SelectObject(hdcDest, oldBrush));
01512                 VERIFY(DeleteObject(SelectObject(bwDC, olddib)));
01513                 SelectObject(hDC, hdcolddib);
01514             }
01515
01516             VERIFY(DeleteDC(bwDC));
01517         }
01518
01519         VERIFY(DeleteDC(hDC));
01520     }
01521 }
01522
01523 BOOL CCJMenu::AddBitmapToImageList(CImageList *bmplist,UINT nResourceID)
01524 {
01525     BOOL bReturn=TRUE;
01526
01527     HBITMAP hbmp=LoadSysColorBitmap(nResourceID);
01528     if(hbmp){
01529         CBitmap bmp;
01530         bmp.Attach(hbmp);
01531         if(m_bitmapBackgroundFlag) bmplist->Add(&bmp,m_bitmapBackground);
01532         else bmplist->Add(&bmp,GetSysColor(COLOR_3DFACE));
01533         bmp.Detach();
01534         DeleteObject(hbmp);
01535         bReturn=TRUE;
01536     }
01537     else bReturn = FALSE;
01538     return(bReturn);
01539 }
01540
01541 void CCJMenu::SetBitmapBackground(COLORREF color)
01542 {
01543     m_bitmapBackground=color;
01544     m_bitmapBackgroundFlag=TRUE;
01545 }
01546
01547 void CCJMenu::UnSetBitmapBackground(void)
01548 {
01549     m_bitmapBackgroundFlag=FALSE;
01550 }
01551
01552 // Given a toolbar, append all the options from it to this menu
01553 // Passed a ptr to the toolbar object and the toolbar ID
01554 // Author : Robert Edward Caldecott
01555 void CCJMenu::AddFromToolBar(CToolBar* pToolBar, int nResourceID)
01556 {
01557     for (int i = 0; i < pToolBar->GetCount(); i++) {
01558         UINT nID = pToolBar->GetItemID(i);
01559         // See if this toolbar option
01560         // appears as a command on this
01561         // menu or is a separator
01562         if (nID == 0 || GetMenuState(nID, MF_BYCOMMAND) == 0xFFFFFFFF)
01563             continue; // Item doesn't exist
01564         UINT nStyle;
01565         int nImage;
01566         // Get the toolbar button info
01567         pToolBar->GetButtonInfo(i, nID, nStyle, nImage);
01568         // OK, we have the command ID of the toolbar
01569         // option, and the tollbar bitmap offset
01570         int nLoc;
01571         CCJMenuData* pData;
01572         CCJMenu *pSubMenu = FindMenuOption(nID, nLoc);
01573         if (pSubMenu && nLoc >= 0)pData = pSubMenu->m_MenuList[nLoc];
01574         else {
01575             // Create a new CCJMenuData structure
01576             pData = new CCJMenuData;
01577             m_MenuList.Add(pData);
01578         }
01579         // Set some default structure members
01580         pData->menuIconNormal = nResourceID;
01581         pData->nID = nID;
01582         pData->nFlags =  MF_BYCOMMAND | MF_OWNERDRAW;
01583         pData->xoffset = nImage;
01584         if (pData->bitmap)pData->bitmap->DeleteImageList();
01585         else pData->bitmap = new CImageList;
01586         pData->bitmap->Create(m_iconX, m_iconY,ILC_COLORDDB|ILC_MASK, 1, 1);
01587
01588         if(!AddBitmapToImageList(pData->bitmap, nResourceID)){
01589             pData->bitmap->DeleteImageList();
01590             delete pData->bitmap;
01591             pData->bitmap=NULL;
01592             pData->menuIconNormal = -1;
01593             pData->xoffset = -1;
01594         }
01595
01596         // Modify our menu
01597         ModifyMenu(nID,pData->nFlags,nID,(LPCTSTR)pData);
01598     }
01599 }
01600
01601 BOOL CCJMenu::Draw3DCheckmark(CDC *dc, const CRect& rc,
01602                               BOOL bSelected, HBITMAP hbmCheck)
01603 {
01604     CRect rcDest = rc;
01605     CBrush brush;
01606     COLORREF col=GetSysColor((bSelected||!IsNewShell())?COLOR_MENU:COLOR_3DLIGHT);//SK: Looks better on the old shell
01607     brush.CreateSolidBrush(col);
01608     dc->FillRect(rcDest,&brush);
01609     brush.DeleteObject();
01610     if (IsNewShell()) //SK: looks better on the old shell
01611         dc->DrawEdge(&rcDest, BDR_SUNKENOUTER, BF_RECT);
01612     if (!hbmCheck)DrawCheckMark(dc,rc.left+4,rc.top+4,GetSysColor(COLOR_MENUTEXT));
01613     else DrawRadioDot(dc,rc.left+5,rc.top+4,GetSysColor(COLOR_MENUTEXT));
01614     return TRUE;
01615 }
01616
01617 void CCJMenu::DitherBlt2(CDC *drawdc, int nXDest, int nYDest, int nWidth,
01618                          int nHeight, CBitmap &bmp, int nXSrc, int nYSrc)
01619 {
01620     // create a monochrome memory DC
01621     CDC ddc;
01622     ddc.CreateCompatibleDC(0);
01623     CBitmap bwbmp;
01624     bwbmp.CreateCompatibleBitmap(&ddc, nWidth, nHeight);
01625     CBitmap * pddcOldBmp = ddc.SelectObject(&bwbmp);
01626
01627     CDC dc;
01628     dc.CreateCompatibleDC(0);
01629     CBitmap * pdcOldBmp = dc.SelectObject(&bmp);
01630
01631     // build a mask
01632     ddc.PatBlt(0, 0, nWidth, nHeight, WHITENESS);
01633     dc.SetBkColor(GetSysColor(COLOR_BTNFACE));
01634     ddc.BitBlt(0, 0, nWidth, nHeight, &dc, nXSrc,nYSrc, SRCCOPY);
01635     dc.SetBkColor(GetSysColor(COLOR_BTNHILIGHT));
01636     ddc.BitBlt(0, 0, nWidth, nHeight, &dc, nXSrc,nYSrc, SRCPAINT);
01637
01638     // Copy the image from the toolbar into the memory DC
01639     // and draw it (grayed) back into the toolbar.
01640     dc.FillSolidRect(0,0, nWidth, nHeight, GetSysColor((IsNewShell())?COLOR_3DFACE:COLOR_MENU));
01641     //SK: Looks better on the old shell
01642     dc.SetBkColor(RGB(0, 0, 0));
01643     dc.SetTextColor(RGB(255, 255, 255));
01644     CBrush brShadow, brHilight;
01645     brHilight.CreateSolidBrush(GetSysColor(COLOR_BTNHILIGHT));
01646     brShadow.CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
01647     CBrush * pOldBrush = dc.SelectObject(&brHilight);
01648     dc.BitBlt(0,0, nWidth, nHeight, &ddc, 0, 0, 0x00E20746L);
01649     drawdc->BitBlt(nXDest+1,nYDest+1,nWidth, nHeight, &dc,0,0,SRCCOPY);
01650     dc.BitBlt(1,1, nWidth, nHeight, &ddc, 0, 0, 0x00E20746L);
01651     dc.SelectObject(&brShadow);
01652     dc.BitBlt(0,0, nWidth, nHeight, &ddc, 0, 0, 0x00E20746L);
01653     drawdc->BitBlt(nXDest,nYDest,nWidth, nHeight, &dc,0,0,SRCCOPY);
01654     // reset DCs
01655     ddc.SelectObject(pddcOldBmp);
01656     ddc.DeleteDC();
01657     dc.SelectObject(pOldBrush);
01658     dc.SelectObject(pdcOldBmp);
01659     dc.DeleteDC();
01660
01661     brShadow.DeleteObject();
01662     brHilight.DeleteObject();
01663     bwbmp.DeleteObject();
01664 }
01665
01666 void CCJMenu::SetDisableOldStyle(void)
01667 {
01668     disable_old_style=TRUE;
01669 }
01670
01671 void CCJMenu::UnSetDisableOldStyle(void)
01672 {
01673     disable_old_style=FALSE;
01674 }
01675
01676 BOOL CCJMenu::GetDisableOldStyle(void)
01677 {
01678     return(disable_old_style);
01679 }
01680
01681
01682 HBITMAP CCJMenu::LoadSysColorBitmap(int nResourceId)
01683 {
01684     HINSTANCE hInst =
01685         AfxFindResourceHandle(MAKEINTRESOURCE(nResourceId),RT_BITMAP);
01686     HRSRC hRsrc =
01687         ::FindResource(hInst,MAKEINTRESOURCE(nResourceId),RT_BITMAP);
01688     if (hRsrc == NULL)
01689         return NULL;
01690     return AfxLoadSysColorBitmap(hInst, hRsrc, FALSE);
01691 }
01692
01693 BOOL CCJMenu::RemoveMenu(UINT uiId,UINT nFlags)
01694 {
01695     if(MF_BYPOSITION&nFlags){
01696         CCJMenu* pSubMenu = (CCJMenu*) GetSubMenu(uiId);
01697         if(NULL==pSubMenu){
01698             UINT uiCommandId = GetMenuItemID(uiId);
01699             for(int i=0;i<m_MenuList.GetSize(); i++){
01700                 if(m_MenuList[i]->nID==uiCommandId){
01701                     delete m_MenuList.GetAt(i);
01702                     m_MenuList.RemoveAt(i);
01703                     break;
01704                 }
01705             }
01706         }
01707         else{
01708             int numSubMenus = m_SubMenus.GetUpperBound();
01709             for(int m = numSubMenus; m >= 0; m--){
01710                 if(m_SubMenus[m]==pSubMenu->m_hMenu){
01711                     int numAllSubMenus = m_AllSubMenus.GetUpperBound();
01712                     for(int n = numAllSubMenus; n>= 0; n--){
01713                         if(m_AllSubMenus[n]==m_SubMenus[m])m_AllSubMenus.RemoveAt(n);
01714                     }
01715                     m_SubMenus.RemoveAt(m);
01716                 }
01717             }
01718             int num = pSubMenu->GetMenuItemCount();
01719             for(int i=num-1;i>=0;--i)pSubMenu->RemoveMenu(i,MF_BYPOSITION);
01720             for(i=m_MenuList.GetUpperBound();i>=0;i--){
01721                 if(m_MenuList[i]->nID==(UINT)pSubMenu->m_hMenu){
01722                     delete m_MenuList.GetAt(i);
01723                     m_MenuList.RemoveAt(i);
01724                     break;
01725                 }
01726             }
01727             delete pSubMenu;
01728         }
01729     }
01730     else{
01731         int iPosition =0;
01732         CCJMenu* pMenu = FindMenuOption(uiId,iPosition);
01733         if(pMenu)pMenu->RemoveMenu(iPosition,MF_BYPOSITION);
01734     }
01735     return CMenu::RemoveMenu(uiId,nFlags);
01736 }
01737
01738 BOOL CCJMenu::DeleteMenu(UINT uiId,UINT nFlags)
01739 {
01740     if(MF_BYPOSITION&nFlags){
01741         CCJMenu* pSubMenu = (CCJMenu*) GetSubMenu(uiId);
01742         if(NULL==pSubMenu){
01743             UINT uiCommandId = GetMenuItemID(uiId);
01744             for(int i=0;i<m_MenuList.GetSize(); i++){
01745                 if(m_MenuList[i]->nID==uiCommandId){
01746                     delete m_MenuList.GetAt(i);
01747                     m_MenuList.RemoveAt(i);
01748                     break;
01749                 }
01750             }
01751         }
01752         else{
01753             int numSubMenus = m_SubMenus.GetUpperBound();
01754             for(int m = numSubMenus; m >= 0; m--){
01755                 if(m_SubMenus[m]==pSubMenu->m_hMenu){
01756                     int numAllSubMenus = m_AllSubMenus.GetUpperBound();
01757                     for(int n = numAllSubMenus; n>= 0; n--){
01758                         if(m_AllSubMenus[n]==m_SubMenus[m])m_AllSubMenus.RemoveAt(n);
01759                     }
01760                     m_SubMenus.RemoveAt(m);
01761                 }
01762             }
01763             int num = pSubMenu->GetMenuItemCount();
01764             for(int i=num-1;i>=0;--i)pSubMenu->DeleteMenu(i,MF_BYPOSITION);
01765             for(i=m_MenuList.GetUpperBound();i>=0;i--){
01766                 if(m_MenuList[i]->nID==(UINT)pSubMenu->m_hMenu){
01767                     delete m_MenuList.GetAt(i);
01768                     m_MenuList.RemoveAt(i);
01769                     break;
01770                 }
01771             }
01772             delete pSubMenu;
01773         }
01774     }
01775     else{
01776         int iPosition =0;
01777         CCJMenu* pMenu = FindMenuOption(uiId,iPosition);
01778         if(pMenu)pMenu->DeleteMenu(iPosition,MF_BYPOSITION);
01779     }
01780     return CMenu::DeleteMenu(uiId,nFlags);
01781 }
01782
01783
01784 BOOL CCJMenu::AppendMenuA(UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,int nIconNormal)
01785 {
01786     USES_CONVERSION;
01787     return AppendMenuW(nFlags,nIDNewItem,A2W(lpszNewItem),nIconNormal);
01788 }
01789
01790 BOOL CCJMenu::AppendMenuW(UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,int nIconNormal)
01791 {
01792     return AppendODMenuW(lpszNewItem,nFlags,nIDNewItem,nIconNormal);
01793 }
01794
01795 BOOL CCJMenu::AppendMenuA(UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CImageList *il,int xoffset)
01796 {
01797     USES_CONVERSION;
01798     return AppendMenuW(nFlags,nIDNewItem,A2W(lpszNewItem),il,xoffset);
01799 }
01800
01801 BOOL CCJMenu::AppendMenuW(UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CImageList *il,int xoffset)
01802 {
01803     return AppendODMenuW(lpszNewItem,nFlags,nIDNewItem,il,xoffset);
01804 }
01805
01806 BOOL CCJMenu::AppendMenuA(UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CBitmap *bmp)
01807 {
01808     USES_CONVERSION;
01809     return AppendMenuW(nFlags,nIDNewItem,A2W(lpszNewItem),bmp);
01810 }
01811
01812 BOOL CCJMenu::AppendMenuW(UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CBitmap *bmp)
01813 {
01814     if(bmp){
01815         CImageList temp;
01816         temp.Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
01817         if(m_bitmapBackgroundFlag)temp.Add(bmp,m_bitmapBackground);
01818         else temp.Add(bmp,GetSysColor(COLOR_3DFACE));
01819         return AppendODMenuW(lpszNewItem,nFlags,nIDNewItem,&temp,0);
01820     }
01821     return AppendODMenuW(lpszNewItem,nFlags,nIDNewItem,NULL,0);
01822 }
01823
01824 BOOL CCJMenu::InsertMenuA(UINT nPosition,UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,int nIconNormal)
01825 {
01826     USES_CONVERSION;
01827     return InsertMenuW(nPosition,nFlags,nIDNewItem,A2W(lpszNewItem),nIconNormal);
01828 }
01829
01830 BOOL CCJMenu::InsertMenuW(UINT nPosition,UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,int nIconNormal)
01831 {
01832     return InsertODMenuW(nPosition,lpszNewItem,nFlags,nIDNewItem,nIconNormal);
01833 }
01834
01835 BOOL CCJMenu::InsertMenuA(UINT nPosition,UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CImageList *il,int xoffset)
01836 {
01837     USES_CONVERSION;
01838     return InsertMenuW(nPosition,nFlags,nIDNewItem,A2W(lpszNewItem),il,xoffset);
01839 }
01840
01841 BOOL CCJMenu::InsertMenuW(UINT nPosition,UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CImageList *il,int xoffset)
01842 {
01843     return InsertODMenuW(nPosition,lpszNewItem,nFlags,nIDNewItem,il,xoffset);
01844 }
01845
01846 BOOL CCJMenu::InsertMenuA(UINT nPosition,UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CBitmap *bmp)
01847 {
01848     USES_CONVERSION;
01849     return InsertMenuW(nPosition,nFlags,nIDNewItem,A2W(lpszNewItem),bmp);
01850 }
01851
01852 BOOL CCJMenu::InsertMenuW(UINT nPosition,UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CBitmap *bmp)
01853 {
01854     if(bmp){
01855         CImageList temp;
01856         temp.Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
01857         if(m_bitmapBackgroundFlag)temp.Add(bmp,m_bitmapBackground);
01858         else temp.Add(bmp,GetSysColor(COLOR_3DFACE));
01859         return InsertODMenuW(nPosition,lpszNewItem,nFlags,nIDNewItem,&temp,0);
01860     }
01861     return InsertODMenuW(nPosition,lpszNewItem,nFlags,nIDNewItem,NULL,0);
01862 }
01863
01864 //--------------------------------------------------------------------------
01865 //[21.06.99 rj]
01866 CCJMenu* CCJMenu::AppendODPopupMenuW(wchar_t *lpstrText)
01867 {
01868     CCJMenu* pSubMenu = new CCJMenu;
01869     pSubMenu->m_unselectcheck=m_unselectcheck;
01870     pSubMenu->m_selectcheck=m_selectcheck;
01871     pSubMenu->checkmaps=checkmaps;
01872     pSubMenu->checkmapsshare=TRUE;
01873     pSubMenu->CreatePopupMenu();
01874     AppendODMenuW(lpstrText,MF_POPUP,(UINT)pSubMenu->m_hMenu, -1);
01875     return pSubMenu;
01876 }
01877
01878 //--------------------------------------------------------------------------
01879 //[21.06.99 rj]
01880 CCJMenu* CCJMenu::AppendODPopupMenuA(LPCSTR lpstrText)
01881 {
01882     USES_CONVERSION;
01883     return AppendODPopupMenuW(A2W(lpstrText));
01884 }
01885
01886
01887
01888 //*************************************************************************
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJMenuBar.cpp Source File

WinCvs/CJLib/CJLibrary/CJMenuBar.cpp

Go to the documentation of this file.
00001 // CJMenuBar.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the code written by Paul DiLascia for MSJ.
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:49 $
00011  * $Revision: 1.1.1.3 $
00012  * $Archive: /CodeJock/CJLibrary/CJMenuBar.cpp $
00013  *
00014  * $History: CJMenuBar.cpp $
00015  *
00016  * *****************  Version 11  *****************
00017  * User: Kirk Stowell Date: 10/24/99   Time: 9:12p
00018  * Updated in $/CodeJock/CJLibrary
00019  * Fixed potential resource and memory leak problems.
00020  *
00021  * *****************  Version 10  *****************
00022  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00023  * Updated in $/CodeJockey/CJLibrary
00024  * Updated copyright and contact information.
00025  *
00026  * *****************  Version 9  *****************
00027  * User: Kirk Stowell Date: 8/29/99    Time: 9:36p
00028  * Updated in $/CodeJockey/CJLibrary
00029  * Fixed bug with left arrow tracking - Tim Lewis <timlewis@home.com>
00030  *
00031  * *****************  Version 8  *****************
00032  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00033  * Updated in $/CodeJockey/CJLibrary
00034  * Added Unicode compliance, thanks to Barry Burton for his help with
00035  * this.
00036  *
00037  *
00038  * *****************  Version 7  *****************
00039  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00040  * Updated in $/CodeJockey/CJLibrary
00041  *
00042  * *****************  Version 6  *****************
00043  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00044  * Updated in $/CodeJockey/CJLibrary
00045  *
00046  * *****************  Version 5  *****************
00047  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00048  * Updated in $/CodeJockey/CJLibrary
00049  *
00050  * *****************  Version 4  *****************
00051  * User: Kirk Stowell Date: 7/25/99    Time: 12:15a
00052  * Updated in $/CodeJockey/CJLibrary
00053  *
00054  * *****************  Version 3  *****************
00055  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00056  * Updated in $/CodeJockey/CJLibrary
00057  *
00058  * *****************  Version 2  *****************
00059  * User: Kirk Stowell Date: 7/18/99    Time: 10:28p
00060  * Updated in $/CodeJockey/CJLibrary
00061  * Further cleanup to handle CCJMenu class.
00062  *
00063  * *****************  Version 1  *****************
00064  * User: Kirk Stowell Date: 7/15/99    Time: 12:34a
00065  * Created in $/CodeJockey/CJLibrary
00066  * Initial creation. Extended the original class written by Paul DiLascia
00067  * for MSJ. Class uses CCJMenu and fixes some bugs with the original
00068  * class.
00069  *
00070  ***************************************************************************/
00072
00073 #include "stdafx.h"
00074 #include "CJMenuBar.h"
00075 #include "CJMenu.h"        // CCJMenu class declaration
00076
00077 #ifdef _DEBUG
00078 #define new DEBUG_NEW
00079 #undef THIS_FILE
00080 static char THIS_FILE[] = __FILE__;
00081 #endif
00082
00084 // CCJMenuBar
00085
00086 CCJMenuBar::CCJMenuBar()
00087 {
00088     m_iTrackingState        = TRACK_NONE;   // initial state: not tracking
00089     m_iPopupTracking        = -1;
00090     m_iNewPopup             = -1;           // invalid
00091     m_bAutoRemoveFrameMenu  = TRUE;         // set frame's menu to NULL
00092 }
00093
00094 CCJMenuBar::~CCJMenuBar()
00095 {
00096     // fix potential resource leak - KStowell - 10-15-99
00097     m_Font.DeleteObject();
00098 }
00099
00100 IMPLEMENT_DYNAMIC(CCJMenuBar, CCJToolBar)
00101
00102 BEGIN_MESSAGE_MAP(CCJMenuBar, CCJToolBar)
00103     //{{AFX_MSG_MAP(CCJMenuBar)
00104     ON_WM_LBUTTONDOWN()
00105     ON_WM_MOUSEMOVE()
00106     ON_WM_SIZE()
00107     ON_UPDATE_COMMAND_UI_RANGE(0, 256, OnUpdateMenuButton)
00108     //}}AFX_MSG_MAP
00109 END_MESSAGE_MAP()
00110
00111 BOOL CCJMenuBar::Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID)
00112 {
00113     return CreateEx(pParentWnd, NULL, dwStyle,
00114         CRect(m_cxLeftBorder, m_cyTopBorder, m_cxRightBorder, m_cyBottomBorder), nID);
00115 }
00116
00117 BOOL CCJMenuBar::CreateEx(CWnd* pParentWnd, DWORD dwCtrlStyle, DWORD dwStyle, CRect rcBorders, UINT nID)
00118 {
00119     if( !CCJToolBar::CreateEx( pParentWnd, dwCtrlStyle, dwStyle, rcBorders, nID))
00120         return FALSE;
00121
00122     UpdateFont();
00123     m_frameHook.Install(this, *pParentWnd);
00124
00125     SetWindowText(_T("Menu Bar"));
00126     return TRUE;
00127 }
00128
00130 // CCJMenuBar message handlers
00131 CSize CCJMenuBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
00132 {
00133     if( m_bInReBar ) {
00134         return CCJToolBar::CalcFixedLayout(bStretch, bHorz);
00135     }
00136
00137     else
00138     {
00139         CSize size = CCJToolBar::CalcFixedLayout(bStretch, bHorz);
00140         CRect rcClient;
00141         GetParentFrame()->GetClientRect(&rcClient);
00142
00143         if( bHorz ) {
00144             size.cx = rcClient.Width();
00145         }
00146         else {
00147             size.cy = rcClient.Height();
00148         }
00149
00150         return size;
00151     }
00152 }
00153
00155 // Set menu bar font from current system menu font
00156 //
00157 void CCJMenuBar::UpdateFont()
00158 {
00159     m_Font.DeleteObject();
00160     NONCLIENTMETRICS ncm;
00161     ncm.cbSize = sizeof(ncm);
00162     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00163     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMenuFont));
00164     SetFont(&m_Font);
00165 }
00166
00168 // The reason for having this is so MFC won't automatically disable
00169 // the menu buttons. Assumes < 256 top-level menu items. The ID of
00170 // the ith menu button is i. IOW, the index and ID are the same.
00171 //
00172 void CCJMenuBar::OnUpdateMenuButton(CCmdUI* pCmdUI)
00173 {
00174     ASSERT_VALID(this);
00175     if (IsValidButton(pCmdUI->m_nID))
00176         pCmdUI->Enable(TRUE);
00177 }
00178
00180 // Recompute layout of menu bar
00181 //
00182 void CCJMenuBar::RecomputeMenuLayout()
00183 {
00184     SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE |
00185         SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
00186 }
00187
00189 // Make frame recalculate control bar sizes after menu change
00190 //
00191 void CCJMenuBar::RecomputeToolbarSize()
00192 {
00193     // Force toolbar to recompute size
00194     CFrameWnd* pFrame = (CFrameWnd*)GetParentFrame();
00195     ASSERT_VALID(pFrame);
00196     ASSERT(pFrame->IsFrameWnd());
00197     pFrame->RecalcLayout();
00198
00199     // floating frame
00200     pFrame = GetParentFrame();
00201     if (pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)))
00202         pFrame->RecalcLayout();
00203 }
00204
00206 // Set tracking state: none, button, or popup
00207 //
00208 void CCJMenuBar::SetTrackingState(TRACKINGSTATE iState, int iButton)
00209 {
00210     ASSERT_VALID(this);
00211     if (iState != m_iTrackingState) {
00212         if (iState == TRACK_NONE)
00213             iButton = -1;
00214
00215         SetHotItem(iButton);                     // could be none (-1)
00216
00217         if (iState==TRACK_POPUP) {
00218             // set related state stuff
00219             m_bEscapeWasPressed = FALSE;     // assume Esc key not pressed
00220             m_bProcessRightArrow =           // assume left/right arrow..
00221                 m_bProcessLeftArrow = TRUE; // ..will move to prev/next popup
00222             m_iPopupTracking = iButton;  // which popup I'm tracking
00223         }
00224         m_iTrackingState = iState;
00225     }
00226 }
00227
00229 // Toggle state from home state to button-tracking and back
00230 //
00231 void CCJMenuBar::ToggleTrackButtonMode()
00232 {
00233     ASSERT_VALID(this);
00234     if (m_iTrackingState == TRACK_NONE || m_iTrackingState == TRACK_BUTTON) {
00235         SetTrackingState(m_iTrackingState == TRACK_NONE ?
00236             TRACK_BUTTON : TRACK_NONE, 0);
00237     }
00238 }
00239
00241 // Get button index before/after a given button
00242 //
00243 int CCJMenuBar::GetNextOrPrevButton(int iButton, BOOL bPrev)
00244 {
00245     ASSERT_VALID(this);
00246     if (bPrev) {
00247         iButton--;
00248         if (iButton <0)
00249             iButton = GetButtonCount() - 1;
00250     } else {
00251         iButton++;
00252         if (iButton >= GetButtonCount())
00253             iButton = 0;
00254     }
00255     return iButton;
00256 }
00257
00259 // This is to correct a bug in the system toolbar control: TB_HITTEST only
00260 // looks at the buttons, not the size of the window. So it returns a button
00261 // hit even if that button is totally outside the size of the window!
00262 //
00263 int CCJMenuBar::HitTest(CPoint p) const
00264 {
00265     int iHit = CCJToolBar::HitTest(p);
00266     if (iHit>0) {
00267         CRect rc;
00268         GetClientRect(&rc);
00269         if (!rc.PtInRect(p)) // if point is outside window
00270             iHit = -1;          // can't be a hit!
00271     }
00272     return iHit;
00273 }
00274
00276 // Load menu from resource
00277 //
00278
00279 BOOL CCJMenuBar::LoadMenu(UINT nID)
00280 {
00281     CFrameWnd* pFrame = GetParentFrame();
00282     ASSERT_VALID(pFrame);
00283
00284     pFrame->GetMenu()->DestroyMenu();
00285     pFrame->SetMenu(NULL);
00286
00287     CMenu menu;
00288     menu.LoadMenu(nID);
00289     m_nMenuID = nID;
00290
00291     // delete existing buttons
00292     int nCount = GetButtonCount();
00293     while (nCount--) {
00294         VERIFY(DeleteButton(0));
00295     }
00296
00297     DWORD dwStyle = GetStyle();
00298     BOOL bModifyStyle = ModifyStyle(0, TBSTYLE_FLAT|TBSTYLE_TRANSPARENT);
00299
00300     SetImageList(NULL);
00301     UINT nMenuItems = menu.GetMenuItemCount();
00302
00303     for( UINT i = 0; i < nMenuItems; i++ )
00304     {
00305         CString strName;
00306         if( menu.GetMenuString(i, strName, MF_BYPOSITION ))
00307         {
00308             TBBUTTON tbb;
00309             memset( &tbb, 0, sizeof( TBBUTTON ));
00310             tbb.idCommand = menu.GetMenuItemID(i);
00311
00312             // Because the toolbar is too brain-damaged to know if it already has
00313             // a string, and is also too brain-dead to even let you delete strings,
00314             // I have to determine if each string has been added already. Otherwise
00315             // in a MDI app, as the menus are repeatedly switched between doc and
00316             // no-doc menus, I will keep adding strings until somebody runs out of
00317             // memory. Sheesh!
00318             //
00319             int iString = -1;
00320             for (int j=0; j<m_arStrings.GetSize(); j++) {
00321                 if (m_arStrings[j] == strName) {
00322                     iString = j; // found it
00323                     break;
00324                 }
00325             }
00326             if (iString <0) {
00327                 // string not found: add it
00328                 iString = AddStrings(strName);
00329                 m_arStrings.SetAtGrow(iString, strName);
00330             }
00331
00332             tbb.iString = iString;
00333             tbb.fsState = TBSTATE_ENABLED;
00334             tbb.fsStyle = TBSTYLE_AUTOSIZE;
00335             tbb.iBitmap = -1;
00336             tbb.idCommand = i;
00337             VERIFY(AddButtons(1, &tbb));
00338         }
00339     }
00340
00341     if( bModifyStyle ) {
00342         SetWindowLong(m_hWnd, GWL_STYLE, dwStyle);
00343     }
00344
00345     if( ::IsMenu( menu )) {
00346         AutoSize();                              // size buttons
00347         RecomputeToolbarSize();              // and menubar itself
00348     }
00349
00350     menu.DestroyMenu();
00351     return TRUE;
00352 }
00353
00355 // Handle mouse click: if clicked on button, press it
00356 // and go into main menu loop.
00357 //
00358 void CCJMenuBar::OnLButtonDown(UINT nFlags, CPoint pt)
00359 {
00360     ASSERT_VALID(this);
00361     int iButton = HitTest(pt);
00362     if (iButton >= 0 && iButton<GetButtonCount()) // if mouse is over a button:
00363         TrackPopup(iButton);                                 //   track it
00364     else                                                         // otherwise:
00365         CCJToolBar::OnLButtonDown(nFlags, pt);   //   pass it on...
00366 }
00367
00369 // Handle mouse movement
00370 //
00371 void CCJMenuBar::OnMouseMove(UINT nFlags, CPoint pt)
00372 {
00373     ASSERT_VALID(this);
00374
00375     if (m_iTrackingState==TRACK_BUTTON) {
00376
00377         // In button-tracking state, ignore mouse-over to non-button area.
00378         // Normally, the toolbar would de-select the hot item in this case.
00379         //
00380         // Only change the hot item if the mouse has actually moved.
00381         // This is necessary to avoid a bug where the user moves to a different
00382         // button from the one the mouse is over, and presses arrow-down to get
00383         // the menu, then Esc to cancel it. Without this code, the button will
00384         // jump to wherever the mouse is--not right.
00385
00386         int iHot = HitTest(pt);
00387         if (IsValidButton(iHot) && pt != m_ptMouse)
00388             SetHotItem(iHot);
00389         return;          // don't let toolbar get it
00390     }
00391     m_ptMouse = pt; // remember point
00392     CCJToolBar::OnMouseMove(nFlags, pt);
00393 }
00394
00396 // Window was resized: need to recompute layout
00397 //
00398 void CCJMenuBar::OnSize(UINT nType, int cx, int cy)
00399 {
00400     CCJToolBar::OnSize(nType, cx, cy);
00401     RecomputeMenuLayout();
00402 }
00403
00405 // Bar style changed: eg, moved from left to right dock or floating
00406 //
00407 void CCJMenuBar::OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle)
00408 {
00409     CCJToolBar::OnBarStyleChange(dwOldStyle, dwNewStyle);
00410     RecomputeMenuLayout();
00411 }
00412
00414 // When user selects a new menu item, note whether it has a submenu
00415 // and/or parent menu, so I know whether right/left arrow should
00416 // move to the next popup.
00417 //
00418 void CCJMenuBar::OnMenuSelect(HMENU hmenu, UINT iItem)
00419 {
00420     if (m_iTrackingState > 0) {
00421         // process right-arrow if item is NOT a submenu
00422         m_bProcessRightArrow = (::GetSubMenu(hmenu, iItem) == NULL);
00423         // process left-arrow if curent menu is one I'm tracking
00424         m_bProcessLeftArrow = TRUE;
00425     }
00426 }
00427
00428 // globals--yuk! But no other way using windows hooks.
00429 //
00430 static CCJMenuBar*  g_pMenuBar = NULL;
00431 static HHOOK        g_hMsgHook = NULL;
00432
00434 // Menu filter hook just passes to virtual CCJMenuBar function
00435 //
00436 LRESULT CALLBACK
00437 CCJMenuBar::MenuInputFilter(int code, WPARAM wp, LPARAM lp)
00438 {
00439     return (code==MSGF_MENU && g_pMenuBar &&
00440         g_pMenuBar->OnMenuInput(*((MSG*)lp))) ? TRUE
00441         : CallNextHookEx(g_hMsgHook, code, wp, lp);
00442 }
00443
00445 // Handle menu input event: Look for left/right to change popup menu,
00446 // mouse movement over over a different menu button for "hot" popup effect.
00447 // Returns TRUE if message handled (to eat it).
00448 //
00449 BOOL CCJMenuBar::OnMenuInput(MSG& m)
00450 {
00451     ASSERT_VALID(this);
00452     ASSERT(m_iTrackingState == TRACK_POPUP); // sanity check
00453     int msg = m.message;
00454
00455     if (msg==WM_KEYDOWN) {
00456         // handle left/right-arow.
00457         TCHAR vkey = static_cast<TCHAR>(m.wParam);
00458
00459         if ((vkey == VK_LEFT  && m_bProcessLeftArrow) ||
00460             (vkey == VK_RIGHT && m_bProcessRightArrow)) {
00461
00462             CancelMenuAndTrackNewOne(
00463                 GetNextOrPrevButton(m_iPopupTracking, vkey==VK_LEFT));
00464             return TRUE; // eat it
00465
00466         } else if (vkey == VK_ESCAPE) {
00467             m_bEscapeWasPressed = TRUE;  // (menu will abort itself)
00468         }
00469
00470     } else if (msg==WM_MOUSEMOVE || msg==WM_LBUTTONDOWN) {
00471         // handle mouse move or click
00472         CPoint pt = m.lParam;
00473         ScreenToClient(&pt);
00474
00475         if (msg == WM_MOUSEMOVE) {
00476             if (pt != m_ptMouse) {
00477                 int iButton = HitTest(pt);
00478                 if (IsValidButton(iButton) && iButton != m_iPopupTracking) {
00479                     // user moved mouse over a different button: track its popup
00480                     CancelMenuAndTrackNewOne(iButton);
00481                 }
00482                 m_ptMouse = pt;
00483             }
00484
00485         } else if (msg == WM_LBUTTONDOWN) {
00486             if (HitTest(pt) == m_iPopupTracking) {
00487                 // user clicked on same button I am tracking: cancel menu
00488                 CancelMenuAndTrackNewOne(-1);
00489                 return TRUE; // eat it
00490             }
00491         }
00492     }
00493     return FALSE; // not handled
00494 }
00495
00497 // Cancel the current popup menu by posting WM_CANCELMODE, and track a new
00498 // menu. iNewPopup is which new popup to track (-1 to quit).
00499 //
00500 void CCJMenuBar::CancelMenuAndTrackNewOne(int iNewPopup)
00501 {
00502     ASSERT_VALID(this);
00503     if (iNewPopup != m_iPopupTracking) {
00504         GetParentFrame()->PostMessage(WM_CANCELMODE); // quit menu loop
00505         m_iNewPopup = iNewPopup;                     // go to this popup (-1 = quit)
00506     }
00507 }
00508
00510 // Track the popup submenu associated with the i'th button in the menu bar.
00511 // This fn actually goes into a loop, tracking different menus until the user
00512 // selects a command or exits the menu.
00513 //
00514 void CCJMenuBar::TrackPopup(int iButton)
00515 {
00516     ASSERT_VALID(this);
00517
00518     m_popupMenu.LoadMenu(m_nMenuID);
00519     m_popupMenu.LoadToolbar(m_nMenuID);
00520     ASSERT(::IsMenu(m_popupMenu));
00521
00522     while (iButton >= 0) {                   // while user selects another menu
00523
00524         m_iNewPopup = -1;                        // assume quit after this
00525         PressButton(iButton, TRUE);      // press the button
00526         UpdateWindow();                      // and force repaint now
00527
00528         // post a simulated arrow-down into the message stream
00529         // so TrackPopupMenu will read it and move to the first item
00530         GetParentFrame()->PostMessage(WM_KEYDOWN, VK_DOWN, 1);
00531         GetParentFrame()->PostMessage(WM_KEYUP, VK_DOWN, 1);
00532
00533         SetTrackingState(TRACK_POPUP, iButton); // enter tracking state
00534
00535         // Need to install a hook to trap menu input in order to make
00536         // left/right-arrow keys and "hot" mouse tracking work.
00537         //
00538         ASSERT(g_pMenuBar == NULL);
00539         g_pMenuBar = this;
00540         ASSERT(g_hMsgHook == NULL);
00541         g_hMsgHook = SetWindowsHookEx(WH_MSGFILTER,
00542             MenuInputFilter, NULL, ::GetCurrentThreadId());
00543
00544         // get submenu and display it beneath button
00545         TPMPARAMS tpm;
00546         CRect rcButton;
00547         GetRect(iButton, rcButton);
00548         ClientToScreen(&rcButton);
00549         CPoint pt = ComputeMenuTrackPoint(rcButton, tpm);
00550
00551         CCJMenu* pPopupMenu = (CCJMenu*)m_popupMenu.GetSubMenu(iButton);
00552         pPopupMenu->TrackPopupMenu( TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL,
00553             pt.x, pt.y, GetParentFrame());
00554
00555         // uninstall hook.
00556         ::UnhookWindowsHookEx(g_hMsgHook);
00557         g_hMsgHook = NULL;
00558         g_pMenuBar = NULL;
00559
00560         PressButton(iButton, FALSE);     // un-press button
00561         UpdateWindow();                  // and force repaint now
00562
00563         // If the user exited the menu loop by pressing Escape,
00564         // return to track-button state; otherwise normal non-tracking state.
00565         SetTrackingState(m_bEscapeWasPressed ?
00566             TRACK_BUTTON : TRACK_NONE, iButton);
00567
00568         // If the user moved mouse to a new top-level popup (eg from File to
00569         // Edit button), I will have posted a WM_CANCELMODE to quit
00570         // the first popup, and set m_iNewPopup to the new menu to show.
00571         // Otherwise, m_iNewPopup will be -1 as set above.
00572         // So just set iButton to the next popup menu and keep looping...
00573         iButton = m_iNewPopup;
00574     }
00575
00576     // fix potential resource leak - KStowell - 10-15-99
00577     m_popupMenu.DestroyMenu();
00578 }
00579
00581 // Given button rectangle, compute point and "exclude rect" for
00582 // TrackPopupMenu, based on current docking style, so that the menu will
00583 // appear always inside the window.
00584 //
00585 CPoint CCJMenuBar::ComputeMenuTrackPoint(const CRect& rcButn, TPMPARAMS& tpm)
00586 {
00587     tpm.cbSize = sizeof(tpm);
00588     DWORD dwStyle = m_dwStyle;
00589     CPoint pt;
00590     CRect& rcExclude = (CRect&)tpm.rcExclude;
00591     rcExclude = rcButn;
00592     ::GetWindowRect(::GetDesktopWindow(), &rcExclude);
00593
00594     switch (dwStyle & CBRS_ALIGN_ANY) {
00595     case CBRS_ALIGN_BOTTOM:
00596         pt = CPoint(rcButn.left, rcButn.top);
00597         rcExclude.top = rcButn.top;
00598         break;
00599
00600     case CBRS_ALIGN_LEFT:
00601         pt = CPoint(rcButn.right, rcButn.top);
00602         rcExclude.right = rcButn.right;
00603         break;
00604
00605     case CBRS_ALIGN_RIGHT:
00606         pt = CPoint(rcButn.left, rcButn.top);
00607         rcExclude.left = rcButn.left;
00608         break;
00609
00610     default: // case CBRS_ALIGN_TOP:
00611         pt = CPoint(rcButn.left, rcButn.bottom);
00612         break;
00613     }
00614     return pt;
00615 }
00616
00618 // This function translates special menu keys and mouse actions.
00619 // You must call it from your frame's PreTranslateMessage.
00620 //
00621 BOOL CCJMenuBar::TranslateFrameMessage(MSG* pMsg)
00622 {
00623     ASSERT_VALID(this);
00624     ASSERT(pMsg);
00625     UINT msg = pMsg->message;
00626     if (WM_LBUTTONDOWN <= msg && msg <= WM_MOUSELAST) {
00627         if (pMsg->hwnd != m_hWnd && m_iTrackingState > 0) {
00628             // user clicked outside menu bar: exit tracking mode
00629             SetTrackingState(TRACK_NONE);
00630         }
00631
00632     } else if (msg==WM_SYSKEYDOWN || msg==WM_SYSKEYUP || msg==WM_KEYDOWN) {
00633
00634         TCHAR vkey = static_cast<TCHAR>(pMsg->wParam);  // get virt key
00635
00636         BOOL  bAlt = HIWORD(pMsg->lParam) & KF_ALTDOWN;     // Alt key down
00637
00638         if (vkey==VK_MENU ||
00639             (vkey==VK_F10 && !((GetKeyState(VK_SHIFT) & 0x80000000) ||
00640                                (GetKeyState(VK_CONTROL) & 0x80000000) || bAlt))) {
00641
00642             // key is VK_MENU or F10 with no alt/ctrl/shift: toggle menu mode
00643             if (msg==WM_SYSKEYUP) {
00644                 ToggleTrackButtonMode();
00645             }
00646             return TRUE;
00647
00648         } else if ((msg==WM_SYSKEYDOWN || msg==WM_KEYDOWN)) {
00649             if (m_iTrackingState == TRACK_BUTTON) {
00650                 // I am tracking: handle left/right/up/down/space/Esc
00651                 switch (vkey) {
00652                 case VK_LEFT:
00653                 case VK_RIGHT:
00654                     // left or right-arrow: change hot button if tracking buttons
00655                     SetHotItem(GetNextOrPrevButton(GetHotItem(), vkey==VK_LEFT));
00656                     return TRUE;
00657
00658                 case VK_SPACE:  // (personally, I like SPACE to enter menu too)
00659                 case VK_UP:
00660                 case VK_DOWN:
00661                     // up or down-arrow: move into current menu, if any
00662                     TrackPopup(GetHotItem());
00663                     return TRUE;
00664
00665                 case VK_ESCAPE:
00666                     // escape key: exit tracking mode
00667                     SetTrackingState(TRACK_NONE);
00668                     return TRUE;
00669                 }
00670             }
00671
00672             // Handle alphanumeric key: invoke menu. Note that Alt-X
00673             // chars come through as WM_SYSKEYDOWN, plain X as WM_KEYDOWN.
00674             if ((bAlt || m_iTrackingState == TRACK_BUTTON) && isalnum(vkey)) {
00675                 // Alt-X, or else X while in tracking mode
00676                 UINT nID;
00677                 if (MapAccelerator(vkey, nID)) {
00678                     TrackPopup(nID);     // found menu mnemonic: track it
00679                     return TRUE;         // handled
00680                 } else if (m_iTrackingState==TRACK_BUTTON && !bAlt) {
00681                     MessageBeep(0);
00682                     return TRUE;
00683                 }
00684             }
00685
00686             // Default for any key not handled so far: return to no-menu state
00687             if (m_iTrackingState > 0) {
00688                 SetTrackingState(TRACK_NONE);
00689             }
00690         }
00691     }
00692     return FALSE; // not handled, pass along
00693 }
00694
00695 #ifdef _DEBUG
00696 void CCJMenuBar::AssertValid() const
00697 {
00698     CCJToolBar::AssertValid();
00699     ASSERT(TRACK_NONE<=m_iTrackingState && m_iTrackingState<=TRACK_POPUP);
00700     m_frameHook.AssertValid();
00701 }
00702
00703 void CCJMenuBar::Dump(CDumpContext& dc) const
00704 {
00705     CCJToolBar::Dump(dc);
00706 }
00707 #endif
00708
00710 // CCJMenuBarFrameHook is used to trap menu-related messages sent to the owning
00711 // frame. The same class is also used to trap messages sent to the MDI client
00712 // window in an MDI app. I should really use two classes for this,
00713 // but it uses less code to chare the same class. Note however: there
00714 // are two different INSTANCES of CCJMenuBarFrameHook in CCJMenuBar: one for
00715 // the frame and one for the MDI client window.
00716 //
00717 CCJMenuBarFrameHook::CCJMenuBarFrameHook()
00718 {
00719 }
00720
00721 CCJMenuBarFrameHook::~CCJMenuBarFrameHook()
00722 {
00723     HookWindow((HWND)NULL); // (unhook)
00724 }
00725
00727 // Install hook to trap window messages sent to frame or MDI client.
00728 //
00729 BOOL CCJMenuBarFrameHook::Install(CCJMenuBar* pMenuBar, HWND hWndToHook)
00730 {
00731     ASSERT_VALID(pMenuBar);
00732     m_pMenuBar = pMenuBar;
00733     return HookWindow(hWndToHook);
00734 }
00735
00737 // Trap frame/MDI client messages specific to menubar.
00738 //
00739 LRESULT CCJMenuBarFrameHook::WindowProc(UINT msg, WPARAM wp, LPARAM lp)
00740 {
00741     CCJMenuBar& mb = *m_pMenuBar;
00742
00743     switch (msg) {
00744     // The following messages are trapped for the frame window
00745     case WM_SYSCOLORCHANGE:
00746         mb.UpdateFont();
00747         break;
00748
00749     case WM_MENUSELECT:
00750         mb.OnMenuSelect((HMENU)lp, (UINT)LOWORD(wp));
00751         break;
00752     }
00753     return CSubclassWnd::WindowProc(msg, wp, lp);
00754 }
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJMetaFileButton.cpp Source File

WinCvs/CJLib/CJLibrary/CJMetaFileButton.cpp

Go to the documentation of this file.
00001 // CJMetaFileButton.cpp : implementation file
00002 //
00003 // Copyright © 1999 Ian Brumby
00004 //
00005 // This source code may be used in compiled form in any way you desire.
00006 // Source file(s) may be redistributed unmodified by any means PROVIDING
00007 // they are not sold for profit without the authors expressed written consent,
00008 // and providing that this notice and the authors name and all copyright
00009 // notices remain intact.
00010 //
00011 // ==========================================================================
00012 // HISTORY:
00013 // ==========================================================================
00014 //          1.20    21 Apr 1999 - Initial release.
00015 // ==========================================================================
00017 /****************************************************************************
00018  *
00019  * $Date: 1999/11/30 21:45:49 $
00020  * $Revision: 1.1.1.2 $
00021  * $Archive: /CodeJock/CJLibrary/CJMetaFileButton.cpp $
00022  *
00023  * $History: CJMetaFileButton.cpp $
00024  *
00025  * *****************  Version 6  *****************
00026  * User: Kirk Stowell Date: 10/31/99   Time: 11:04p
00027  * Updated in $/CodeJock/CJLibrary
00028  * Overrode OnEraseBkgnd(...) and OnPaint() for flicker free drawing.
00029  *
00030  * *****************  Version 5  *****************
00031  * User: Kirk Stowell Date: 10/25/99   Time: 10:52p
00032  * Updated in $/CodeJock/CJLibrary
00033  * Modified resource include for static builds.
00034  *
00035  * *****************  Version 4  *****************
00036  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00037  * Updated in $/CodeJock/CJLibrary
00038  * Fixed potential resource and memory leak problems.
00039  *
00040  * *****************  Version 3  *****************
00041  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00042  * Updated in $/CodeJock/CJLibrary
00043  * Added source control history to file header.
00044  *
00045  ***************************************************************************/
00047
00048 #include "stdafx.h"
00049 #include "CJResource.h"
00050 #include "CJMetaFileButton.h"
00051
00052 #ifdef _DEBUG
00053 #define new DEBUG_NEW
00054 #undef THIS_FILE
00055 static char THIS_FILE[] = __FILE__;
00056 #endif
00057
00059 // CCJMetaFileButton
00060
00061 CCJMetaFileButton::CCJMetaFileButton()
00062 {
00063 }
00064
00065 CCJMetaFileButton::~CCJMetaFileButton()
00066 {
00067 }
00068
00069 void CCJMetaFileButton::SetMetaFiles(HENHMETAFILE hMetaFile,
00070     HENHMETAFILE hMetaFileSel, HENHMETAFILE hMetaFileFocus, HENHMETAFILE hMetaFileDisabled)
00071 {
00072     m_hEnhMetaFile         = hMetaFile;
00073     m_hEnhMetaFileSel      = hMetaFileSel;
00074     m_hEnhMetaFileFocus    = hMetaFileFocus;
00075     m_hEnhMetaFileDisabled = hMetaFileDisabled;
00076 }
00077
00078
00079 BEGIN_MESSAGE_MAP(CCJMetaFileButton, CButton)
00080     //{{AFX_MSG_MAP(CCJMetaFileButton)
00081     ON_WM_LBUTTONDBLCLK()
00082     ON_WM_ERASEBKGND()
00083     ON_WM_PAINT()
00084     //}}AFX_MSG_MAP
00085 END_MESSAGE_MAP()
00086
00088 // CCJMetaFileButton message handlers
00089
00090 void CCJMetaFileButton::OnLButtonDblClk(UINT nFlags, CPoint point)
00091 {
00092     // Fix for the double click problem with owner drawn buttons
00093     POINT pt;
00094     ::GetCursorPos(&pt);
00095     ::MapWindowPoints(NULL, (HWND)(m_hWnd), &pt, 1);
00096     ::SendMessage((HWND)(m_hWnd), WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x, pt.y));
00097     CButton::OnLButtonDblClk(nFlags, point);
00098 }
00099
00100 void CCJMetaFileButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
00101 {
00102     ASSERT(lpDrawItemStruct != NULL);
00103
00104     // define some temporary variables.
00105     CDC*  pDC    = CDC::FromHandle( lpDrawItemStruct->hDC );
00106     CRect rcItem = lpDrawItemStruct->rcItem;
00107     int   nState = lpDrawItemStruct->itemState;
00108
00109     // Paint the background.
00110     pDC->FillSolidRect(rcItem, ::GetSysColor(COLOR_3DFACE));
00111
00112     // draw 3D button outline
00113     CPen penOutline(PS_SOLID, 1, GetSysColor(COLOR_BTNTEXT));
00114     CPen penLight(PS_SOLID, 1, GetSysColor(COLOR_BTNHIGHLIGHT));
00115     CPen penDark(PS_SOLID, 1, GetSysColor(COLOR_BTNSHADOW));
00116     CPen* pOldPen = NULL;
00117
00118     if (nState & ODS_SELECTED)
00119     {
00120         pOldPen = pDC->SelectObject(&penDark);
00121         pDC->MoveTo(0, rcItem.bottom - 1);
00122         pDC->LineTo(0, 1);
00123         pDC->LineTo(rcItem.right - 1, 1);
00124     }
00125     else
00126     {
00127         pOldPen = pDC->SelectObject(&penLight);
00128         pDC->MoveTo(0, rcItem.bottom - 2);
00129         pDC->LineTo(0, 1);
00130         pDC->LineTo(rcItem.right - 2, 1);
00131         pDC->SelectObject(&penDark);
00132         pDC->MoveTo(0, rcItem.bottom - 1);
00133         pDC->LineTo(rcItem.right - 2, rcItem.bottom - 1);
00134         pDC->LineTo(rcItem.right - 2, 0);
00135         pDC->MoveTo(1, rcItem.bottom - 2);
00136         pDC->LineTo(rcItem.right - 3, rcItem.bottom - 2);
00137         pDC->LineTo(rcItem.right - 3, 1);
00138     }
00139     pDC->SelectObject(&penOutline);
00140     pDC->MoveTo(0, 0);
00141     pDC->LineTo(rcItem.right - 1, 0);
00142     pDC->LineTo(rcItem.right - 1, rcItem.bottom);
00143
00144     HENHMETAFILE hMetaFile = m_hEnhMetaFile;
00145     if ((nState & ODS_SELECTED) && m_hEnhMetaFileSel != NULL)
00146         hMetaFile = m_hEnhMetaFileSel;
00147     else if ((nState & ODS_FOCUS) && m_hEnhMetaFileFocus != NULL)
00148         hMetaFile = m_hEnhMetaFileFocus;   // third image for focused
00149     else if ((nState & ODS_DISABLED) && m_hEnhMetaFileDisabled != NULL)
00150         hMetaFile = m_hEnhMetaFileDisabled;   // last image for disabled
00151
00152     ASSERT(hMetaFile != NULL);
00153
00154     CRect rcBounds(5,4,0,0);
00155     int iButtonHeight = rcItem.Height();
00156     if (iButtonHeight > 15)
00157         iButtonHeight = 15;
00158     else if (iButtonHeight < 11)
00159         iButtonHeight = 11;
00160     int iArrowWidth = (iButtonHeight / 2) - 3;
00161     rcBounds.right = rcBounds.left + iArrowWidth - 1;
00162     rcBounds.bottom = rcBounds.top + (iArrowWidth * 2) - 2;
00163
00164     if (nState & ODS_SELECTED)
00165         rcBounds += CPoint(1, 1);
00166     pDC->PlayMetaFile(hMetaFile, rcBounds);
00167
00168     // fix potential resource leak - KStowell - 10-21-99
00169     pDC->SelectObject(pOldPen);
00170     penOutline.DeleteObject();
00171     penLight.DeleteObject();
00172     penDark.DeleteObject();
00173 }
00174
00175 BOOL CCJMetaFileButton::OnEraseBkgnd(CDC* pDC)
00176 {
00177     // KStowell - overridden for flicker-free drawing.
00178     UNUSED_ALWAYS(pDC);
00179     return TRUE;
00180 }
00181
00182 void CCJMetaFileButton::OnPaint()
00183 {
00184     CPaintDC dc(this); // device context for painting
00185
00186     // KStowell - Get the client rect.
00187     CRect rcClient, rcClip;
00188     dc.GetClipBox( &rcClip );
00189     GetClientRect( &rcClient );
00190
00191     // KStowell - Create a memory device-context. This is done to help reduce
00192     // screen flicker, since we will paint the entire control to the
00193     // off screen device context first.
00194     CDC memDC;
00195     CBitmap bitmap;
00196     memDC.CreateCompatibleDC(&dc);
00197     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00198     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00199
00200     // KStowell - Repaint the background.
00201     memDC.FillSolidRect( rcClient, ::GetSysColor(COLOR_WINDOW) );
00202
00203     // let the control do its default drawing.
00204     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00205
00206     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00207     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00208         rcClip.left, rcClip.top, SRCCOPY );
00209
00210     // KStowell - Cleanup resources.
00211     memDC.SelectObject(pOldBitmap);
00212     memDC.DeleteDC();
00213     bitmap.DeleteObject();
00214 }
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJMiniDockFrameWnd.cpp Source File

WinCvs/CJLib/CJLibrary/CJMiniDockFrameWnd.cpp

Go to the documentation of this file.
00001 // CJMiniDockFrameWnd.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJockey/CJLibrary/CJMiniDockFrameWnd.cpp $
00011  *
00012  * $History: CJMiniDockFrameWnd.cpp $
00013  *
00014  * *****************  Version 7  *****************
00015  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00016  * Updated in $/CodeJockey/CJLibrary
00017  * Updated copyright and contact information.
00018  *
00019  * *****************  Version 6  *****************
00020  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00021  * Updated in $/CodeJockey/CJLibrary
00022  *
00023  * *****************  Version 5  *****************
00024  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00025  * Updated in $/CodeJockey/CJLibrary
00026  *
00027  * *****************  Version 4  *****************
00028  * User: Kirk Stowell Date: 6/09/99    Time: 8:33p
00029  * Updated in $/CodeJockey/CJ60Lib
00030  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00031  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00032  * message handler, this is now automatically handled by the base class.
00033  * Added redraw flags to the create method and modified paint and layout
00034  * handlers to reduce flicker and un-necessary command handling. Dragging
00035  * rect now reflects actual control bar docked size. Added "flat" look to
00036  * the control bars, the control bars can now use the classic DevStudio
00037  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00038  * docking windows now handle dragging, docking and floating much better,
00039  * and behave more like DevStudio.
00040  *
00041  * *****************  Version 3  *****************
00042  * User: Kirk Stowell Date: 4/14/99    Time: 10:40p
00043  * Updated in $/CodeJockey/CJ60Lib
00044  * Daniel Harth [danielh@mail.matco.ro] - Added support for diagonal
00045  * sizing.
00046  *
00047  * *****************  Version 2  *****************
00048  * User: Kirk Stowell Date: 4/03/99    Time: 10:39p
00049  * Updated in $/CodeJockey/CJ60Lib
00050  * Added comments and cleaned up code.
00051  *
00052  * *****************  Version 1  *****************
00053  * User: Kirk Stowell Date: 1/16/99    Time: 10:39p
00054  * Created in $/CodeJockey/CJ60Lib
00055  * Initial release.
00056  *
00057  ***************************************************************************/
00059
00060 #include "stdafx.h"
00061 #include "CJMiniDockFrameWnd.h"
00062 #include "CJDockContext.h"
00063 #include "CJSizeDockBar.h"
00064 #include "CJControlBar.h"
00065
00066 #ifdef _DEBUG
00067 #define new DEBUG_NEW
00068 #undef THIS_FILE
00069 static char THIS_FILE[] = __FILE__;
00070 #endif
00071
00073 // CCJMiniDockFrameWnd
00074
00075 CCJMiniDockFrameWnd::CCJMiniDockFrameWnd()
00076 {
00077     // TODO: add construction code here.
00078 }
00079
00080 CCJMiniDockFrameWnd::~CCJMiniDockFrameWnd()
00081 {
00082     // TODO: add destruction code here.
00083 }
00084
00085 IMPLEMENT_DYNCREATE(CCJMiniDockFrameWnd, CMiniDockFrameWnd)
00086
00087 BEGIN_MESSAGE_MAP(CCJMiniDockFrameWnd, CMiniDockFrameWnd)
00088     //{{AFX_MSG_MAP(CCJMiniDockFrameWnd)
00089     ON_WM_NCLBUTTONDOWN()
00090     ON_WM_NCLBUTTONDBLCLK()
00091     ON_WM_ERASEBKGND()
00092     ON_WM_MBUTTONDBLCLK()
00093     //}}AFX_MSG_MAP
00094 END_MESSAGE_MAP()
00095
00097 // CCJMiniDockFrameWnd message handlers
00098
00099 void CCJMiniDockFrameWnd::OnNcLButtonDown(UINT nHitTest, CPoint point)
00100 {
00101     CCJSizeDockBar *pSizeBar = (CCJSizeDockBar*)&m_wndDockBar;
00102
00103     if (nHitTest == HTCAPTION)
00104     {
00105         ActivateTopParent();
00106         if ((m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0)
00107         {
00108             int nPos = 1;
00109             CControlBar* pBar = NULL;
00110             while(pBar == NULL && nPos < m_wndDockBar.m_arrBars.GetSize())
00111                 pBar = pSizeBar->GetDockedSizeBar(nPos++);
00112             ASSERT(pBar != NULL);
00113             ASSERT_KINDOF(CControlBar, pBar);
00114             ASSERT(pBar->m_pDockContext != NULL);
00115
00116             if (!pBar->IsKindOf(RUNTIME_CLASS(CCJControlBar))) {
00117                 CMiniDockFrameWnd::OnNcLButtonDown(nHitTest,point);
00118                 return;
00119             }
00120
00121             //Yiannhs: This has to be fixed!! when the bar is floating
00122             //         and is over a visible dockbar, it arranges it inside
00123             //         the dock bar and does not drag, by just clicking on the caption
00124             ((CCJDockContext *)pBar->m_pDockContext)->StartDragDockBar(point);
00125             pBar->SetFocus();
00126             return;
00127         }
00128     }
00129
00130     else if (nHitTest >= HTSIZEFIRST && nHitTest <= HTSIZELAST)
00131     {
00132         ActivateTopParent();
00133         int nPos = 1;
00134         CControlBar* pBar = NULL;
00135         while(pBar == NULL && nPos < m_wndDockBar.m_arrBars.GetSize())
00136             pBar = pSizeBar->GetDockedSizeBar(nPos++);
00137
00138         ASSERT(pBar != NULL);
00139         ASSERT_KINDOF(CControlBar, pBar);
00140         ASSERT(pBar->m_pDockContext != NULL);
00141         ASSERT((m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0);
00142
00143         if (!pBar->IsKindOf(RUNTIME_CLASS(CCJControlBar))) {
00144             CMiniDockFrameWnd::OnNcLButtonDown(nHitTest,point);
00145             return;
00146         }
00147
00148         pBar->m_pDockContext->StartResize(nHitTest, point);
00149         return;
00150     }
00151
00152     else {  //Yiannhs
00153         CMiniFrameWnd::OnNcLButtonDown(nHitTest, point);
00154     }
00155 }
00156
00157 void CCJMiniDockFrameWnd::OnNcLButtonDblClk(UINT nHitTest, CPoint /*point*/)
00158 {
00159     if (nHitTest == HTCAPTION)
00160     {
00161         ActivateTopParent();
00162         CCJSizeDockBar * m_pSizeBar = (CCJSizeDockBar *)&m_wndDockBar;
00163
00164         if ((m_pSizeBar->m_dwStyle & CBRS_FLOAT_MULTI) == 0)
00165         {
00166             int nPos = 1;
00167             CControlBar* pBar = NULL;
00168             while(pBar == NULL && nPos < m_pSizeBar->m_arrBars.GetSize())
00169                 pBar = m_pSizeBar->GetDockedSizeBar(nPos++);
00170
00171             ASSERT(pBar != NULL);
00172             ASSERT_KINDOF(CControlBar, pBar);
00173             ASSERT(pBar->m_pDockContext != NULL);
00174
00175             if (pBar->IsKindOf(RUNTIME_CLASS(CCJControlBar)))
00176                 pBar->m_pDockContext->ToggleDocking();
00177
00178             return;
00179         }
00180     }
00181 }
00182
00183 BOOL CCJMiniDockFrameWnd::Create(CWnd* pParent, DWORD dwBarStyle)
00184 {
00185     // Let the base class do all the work.
00186     if (!CMiniDockFrameWnd::Create(pParent, dwBarStyle))
00187         return FALSE;
00188
00189     // remove the MFS_4THICKFRAME style to allow diagonal
00190     // resizing.
00191     ModifyStyle(MFS_4THICKFRAME, 0);
00192
00193     return TRUE;
00194 }
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJOutlookBar.cpp Source File

WinCvs/CJLib/CJLibrary/CJOutlookBar.cpp

Go to the documentation of this file.
00001 // CJOutlookBar.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJOutlookBar.cpp $
00011  *
00012  * $History: CJOutlookBar.cpp $
00013  *
00014  * *****************  Version 11  *****************
00015  * User: Kirk Stowell Date: 10/30/99   Time: 2:03p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Added COLORREF members to class to eliminate continuous calls to
00018  * GetSysColor(...). Overrode OnSysColorChange() to re-initialize COLORREF
00019  * variables.
00020  *
00021  * *****************  Version 10  *****************
00022  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00023  * Updated in $/CodeJock/CJLibrary
00024  * Fixed potential resource and memory leak problems.
00025  *
00026  * *****************  Version 9  *****************
00027  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00028  * Updated in $/CodeJockey/CJLibrary
00029  * Updated copyright and contact information.
00030  *
00031  * *****************  Version 8  *****************
00032  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00033  * Updated in $/CodeJockey/CJLibrary
00034  *
00035  * *****************  Version 7  *****************
00036  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00037  * Updated in $/CodeJockey/CJLibrary
00038  *
00039  * *****************  Version 6  *****************
00040  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00041  * Updated in $/CodeJockey/CJLibrary
00042  *
00043  * *****************  Version 5  *****************
00044  * User: Kirk Stowell Date: 6/14/99    Time: 10:44p
00045  * Updated in $/CodeJockey/CJ60Lib
00046  * Cleaned up code to eliminate level 4 compilier warnings.
00047  *
00048  * *****************  Version 4  *****************
00049  * User: Kirk Stowell Date: 4/03/99    Time: 10:43p
00050  * Updated in $/CodeJockey/CJ60Lib
00051  * Added comments and cleaned up code.
00052  *
00053  * *****************  Version 3  *****************
00054  * User: Kirk Stowell Date: 3/03/99    Time: 10:43p
00055  * Updated in $/CodeJockey/CJ60Lib
00056  * Changed images list's to pointer vars passed into class.
00057  *
00058  * *****************  Version 2  *****************
00059  * User: Kirk Stowell Date: 2/24/99    Time: 10:42p
00060  * Updated in $/CodeJockey/CJ60Lib
00061  * Christopher Brown (Allknowing@earthlink.net) some modifications to
00062  * correct icon resource leak, and eliminate screen flicker.
00063  *
00064  * *****************  Version 1  *****************
00065  * User: Kirk Stowell Date: 10/17/98   Time: 10:42p
00066  * Created in $/CodeJockey/CJ60Lib
00067  * Initial re-write and release.
00068  *
00069  ***************************************************************************/
00071
00072 #include "stdafx.h"
00073 #include "CJOutlookBar.h"
00074
00075 #ifdef _DEBUG
00076 #define new DEBUG_NEW
00077 #undef THIS_FILE
00078 static char THIS_FILE[] = __FILE__;
00079 #endif
00080
00082 // CCJOutlookBar
00083
00084 CCJOutlookBar::CCJOutlookBar()
00085 {
00086     m_bLBDown           = false;
00087     m_bHilight          = true;
00088     m_pImageListLarge   = NULL;
00089     m_pImageListSmall   = NULL;
00090     m_pOwner            = NULL;
00091     m_clrHilite         = ::GetSysColor(COLOR_BTNHIGHLIGHT);
00092     m_clrShadow         = ::GetSysColor(COLOR_BTNSHADOW);
00093     m_clrDkShad         = ::GetSysColor(COLOR_3DDKSHADOW);
00094     m_clrNormal         = ::GetSysColor(COLOR_BTNFACE);
00095     m_clrTextNm         = ::GetSysColor(COLOR_WINDOW);
00096
00097     UpdateFont();
00098 }
00099
00100 CCJOutlookBar::~CCJOutlookBar()
00101 {
00102     // fix potential resource leak - KStowell - 10-22-99.
00103     m_Font.DeleteObject();
00104 }
00105
00106 IMPLEMENT_DYNAMIC(CCJOutlookBar, CListBox)
00107
00108 BEGIN_MESSAGE_MAP(CCJOutlookBar, CListBox)
00109     //{{AFX_MSG_MAP(CCJOutlookBar)
00110     ON_WM_ERASEBKGND()
00111     ON_WM_LBUTTONDOWN()
00112     ON_WM_LBUTTONUP()
00113     ON_WM_MOUSEMOVE()
00114     ON_WM_TIMER()
00115     ON_WM_PAINT()
00116     ON_WM_SYSCOLORCHANGE()
00117     //}}AFX_MSG_MAP
00118 END_MESSAGE_MAP()
00119
00121 // CCJOutlookBar message handlers
00122
00123 // Checks mouse movement, sets point member, sets timer.
00124 void CCJOutlookBar::OnMouseMove(UINT nFlags, CPoint point)
00125 {
00126     m_point = point;
00127     SetTimer (1, 10, NULL);
00128     CListBox::OnMouseMove(nFlags, point);
00129 }
00130
00131 // Sets bLBDown member to true, and sets current selection
00132 void CCJOutlookBar::OnLButtonDown(UINT nFlags, CPoint point)
00133 {
00134     m_bLBDown = true;
00135     SetCurSel(GetCurSel());
00136     CListBox::OnLButtonDown(nFlags, point);
00137 }
00138
00139 // Sets bLBDown member to false, and sets current selection
00140 void CCJOutlookBar::OnLButtonUp(UINT nFlags, CPoint point)
00141 {
00142     m_bLBDown = false;
00143     int nIndex = GetCurSel();
00144     SetCurSel(nIndex);
00145
00146     ASSERT(m_pOwner);
00147     m_pOwner->SendMessage(OBN_SELENDOK, (LPARAM)nIndex, (WPARAM)GetDlgCtrlID());
00148
00149     CListBox::OnLButtonUp(nFlags, point);
00150 }
00151
00152 // Sets the hilite flag based on cursor position.
00153 void CCJOutlookBar::OnTimer(UINT /*nIDEvent*/)
00154 {
00155     BOOL   bOutSide;
00156     CRect  rItem;
00157     CRect  rWindow;
00158     CPoint pt;
00159     int    nIndex;
00160
00161     // Get the rect of the current window,
00162     // get the current cursor position.
00163     GetWindowRect (rWindow);
00164     GetCursorPos (&pt);
00165
00166     // If the mouse is in the rect of this window,
00167     // set hilite flag to true, get the item that
00168     // the mouse is over.
00169     if (rWindow.PtInRect (pt)) {
00170         m_bHilight = true;
00171         nIndex = ItemFromPoint (m_point, bOutSide);
00172
00173         if (nIndex != GetCurSel() && !bOutSide) {
00174             SetCurSel( nIndex );
00175         }
00176     }
00177
00178     // If the mouse is not in the rect of
00179     // this window, kill the timer, set hilite flag
00180     // to false, and return.
00181     else {
00182         m_bHilight = false;
00183         if( !m_bLBDown ) {
00184           SetCurSel (-1);
00185         }
00186         KillTimer(1);
00187     }
00188 }
00189
00191 // Initial draw routine, draws button on mouse over,
00192 // on mouse press, and on mouse out.
00193
00194 void CCJOutlookBar::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
00195 {
00196     CDC*            pDC = CDC::FromHandle( lpDrawItemStruct->hDC );
00197     CRect           rcItem(lpDrawItemStruct->rcItem);
00198     CRect           rClient(rcItem);
00199     CRect           rText;
00200     CPoint          Pt(((rcItem.Width() - 32) /2 ), rcItem.top + 15);
00201     CContentItems   pContents = m_pContents[ lpDrawItemStruct->itemID ];
00202     HICON           hIcon = m_pImageListLarge->ExtractIcon( pContents.GetImageID());
00203
00204     pDC->SetBkColor(m_clrShadow);
00205
00206     // deflate the client rect, and set up item and
00207     // text rect's.
00208     rClient.DeflateRect( 8, 5 );
00209     rcItem.CopyRect( rClient );
00210     rText.CopyRect( rClient );
00211     rText.top += 45;
00212     rText.bottom += 10;
00213
00214     // set the text color to white, and background mode
00215     // to transparent.
00216     pDC->SetTextColor( m_clrTextNm );
00217     pDC->SetBkMode( TRANSPARENT );
00218     CFont* pOldFont = pDC->SelectObject(&m_Font);
00219
00220     // draw the button icon and text.
00221     if( lpDrawItemStruct->itemAction& ODA_DRAWENTIRE ) {
00222         pDC->DrawIcon( Pt, hIcon );
00223         pDC->DrawText( pContents.GetText(), rText, DT_CENTER | DT_WORDBREAK );
00224     }
00225
00226     // if the left mouse button is pressed, offset
00227     // the button icon.
00228     if( m_bLBDown ) {
00229         Pt.x += 2;
00230         Pt.y += 2;
00231         rcItem.OffsetRect( 2, 2 );
00232     }
00233
00234     // deflate the button rect, and move up.
00235     rcItem.DeflateRect( 4, 16 );
00236     rcItem.top -= 8;
00237
00238     // Draw the button icon and text, if the mouse is over the
00239     // button, draw the 3d rect, either pressed,
00240     // or not pressed depending on left mouse button.
00241     if(( lpDrawItemStruct->itemState& ODS_SELECTED ) &&
00242         ( lpDrawItemStruct->itemAction& ( ODA_SELECT | ODA_DRAWENTIRE ))) {
00243
00244         rcItem.left = ( rcItem.Width()/2 )-5;
00245         rcItem.right = rcItem.left+37;
00246
00247         if( m_bHilight ) {
00248             if( m_bLBDown ) {
00249               pDC->Draw3dRect( rcItem, m_clrDkShad, m_clrNormal );
00250             } else {
00251               pDC->Draw3dRect( rcItem, m_clrNormal, m_clrDkShad );
00252             }
00253         }
00254
00255         pDC->DrawIcon( Pt, hIcon );
00256         pDC->DrawText( pContents.GetText(), rText, DT_CENTER | DT_WORDBREAK );
00257     }
00258
00259     if( !( lpDrawItemStruct->itemState& ODS_SELECTED ) &&
00260         ( lpDrawItemStruct->itemAction& ODA_SELECT )) {
00261         pDC->FillSolidRect( rClient, m_clrShadow );
00262         pDC->DrawIcon(Pt, hIcon);
00263         pDC->DrawText(pContents.GetText(), rText, DT_CENTER|DT_WORDBREAK);
00264     }
00265
00266     // To avoid ugly resource leaks that will
00267     // eventually TRASH the system, call DestroyIcon().
00268     // To reproduce bug, try resizing the window for a
00269     // good minute. Christopher Brown
00270
00271     ::DestroyIcon( hIcon );
00272     pDC->SelectObject(pOldFont);
00273 }
00274
00276 // Sets item height
00277
00278 void CCJOutlookBar::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
00279 {
00280     lpMeasureItemStruct->itemHeight = 70;
00281 }
00282
00284 // Sets the background color.
00285
00286 BOOL CCJOutlookBar::OnEraseBkgnd(CDC* pDC)
00287 {
00288     // KStowell - overridden for flicker-free drawing.
00289     UNUSED_ALWAYS(pDC);
00290     return TRUE;
00291 }
00292
00293 void CCJOutlookBar::OnPaint()
00294 {
00295     // Christopher Brown
00296     // Use a "Offscreen" DC to fill rect and
00297     // send to DefWindowProc...
00298     CClientDC memDC(this); // Henrik E. Rasmussen
00299
00300     CRect rcClip;
00301     memDC.GetClipBox(&rcClip);
00302     memDC.FillSolidRect(rcClip, m_clrShadow);
00303     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, (LPARAM)0 );
00304
00305     // Default is called for cleanup.
00306     Default();
00307 }
00308
00309 void CCJOutlookBar::UpdateFont()
00310 {
00311     m_Font.DeleteObject();
00312     NONCLIENTMETRICS ncm;
00313     ncm.cbSize = sizeof(ncm);
00314     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00315     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00316 }
00317
00318 void CCJOutlookBar::OnSysColorChange()
00319 {
00320     CListBox::OnSysColorChange();
00321
00322     m_clrHilite = ::GetSysColor(COLOR_BTNHIGHLIGHT);
00323     m_clrShadow = ::GetSysColor(COLOR_BTNSHADOW);
00324     m_clrDkShad = ::GetSysColor(COLOR_3DDKSHADOW);
00325     m_clrNormal = ::GetSysColor(COLOR_BTNFACE);
00326     m_clrTextNm = ::GetSysColor(COLOR_WINDOW);
00327 }
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJPagerCtrl.cpp Source File

WinCvs/CJLib/CJLibrary/CJPagerCtrl.cpp

Go to the documentation of this file.
00001 // CJPagerCtrl.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJockey/CJLibrary/CJPagerCtrl.cpp $
00011  *
00012  * $History: CJPagerCtrl.cpp $
00013  *
00014  * *****************  Version 7  *****************
00015  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00016  * Updated in $/CodeJockey/CJLibrary
00017  * Updated copyright and contact information.
00018  *
00019  * *****************  Version 6  *****************
00020  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00021  * Updated in $/CodeJockey/CJLibrary
00022  *
00023  * *****************  Version 5  *****************
00024  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00025  * Updated in $/CodeJockey/CJLibrary
00026  *
00027  * *****************  Version 4  *****************
00028  * User: Kirk Stowell Date: 6/14/99    Time: 10:44p
00029  * Updated in $/CodeJockey/CJ60Lib
00030  * Cleaned up code to eliminate level 4 compilier warnings.
00031  *
00032  * *****************  Version 3  *****************
00033  * User: Kirk Stowell Date: 4/03/99    Time: 10:45p
00034  * Updated in $/CodeJockey/CJ60Lib
00035  * Added comments and cleaned up code.
00036  *
00037  * *****************  Version 2  *****************
00038  * User: Kirk Stowell Date: 1/02/99    Time: 10:44p
00039  * Updated in $/CodeJockey/CJ60Lib
00040  * Cleaned up class source, wrapped all pager messages.
00041  *
00042  * *****************  Version 1  *****************
00043  * User: Kirk Stowell Date: 10/02/98   Time: 10:44p
00044  * Created in $/CodeJockey/CJ60Lib
00045  * First release version.
00046  *
00047  ***************************************************************************/
00049
00050 #include "stdafx.h"
00051 #include "CJPagerCtrl.h"
00052
00053 #ifdef _DEBUG
00054 #define new DEBUG_NEW
00055 #undef THIS_FILE
00056 static char THIS_FILE[] = __FILE__;
00057 #endif
00058
00060 // CCJPagerCtrl
00061
00062 CCJPagerCtrl::CCJPagerCtrl()
00063 {
00064    // initialize common controls
00065     INITCOMMONCONTROLSEX icex;
00066     icex.dwSize = sizeof(icex);
00067     icex.dwICC = ICC_PAGESCROLLER_CLASS;
00068     VERIFY(InitCommonControlsEx(&icex));
00069 }
00070
00071 CCJPagerCtrl::~CCJPagerCtrl()
00072 {
00073 }
00074
00075 IMPLEMENT_DYNAMIC(CCJPagerCtrl, CWnd)
00076
00077 BEGIN_MESSAGE_MAP(CCJPagerCtrl, CWnd)
00078     //{{AFX_MSG_MAP(CCJPagerCtrl)
00079     ON_NOTIFY_REFLECT_EX(PGN_SCROLL, OnPagerScroll)
00080     ON_NOTIFY_REFLECT_EX(PGN_CALCSIZE, OnPagerCalcSize)
00081     //}}AFX_MSG_MAP
00082 END_MESSAGE_MAP()
00083
00084 BOOL CCJPagerCtrl::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
00085 {
00086     CWnd* pWnd = this;
00087     return pWnd->Create(WC_PAGESCROLLER, NULL, dwStyle, rect, pParentWnd, nID);
00088 }
00089
00091 // CCJPagerCtrl message handlers
00092
00093 BOOL CCJPagerCtrl::OnPagerCalcSize(NMPGCALCSIZE* pNMPGCalcSize, LRESULT* pResult)
00094 {
00095     switch(pNMPGCalcSize->dwFlag)
00096     {
00097     case PGF_CALCWIDTH:
00098         pNMPGCalcSize->iWidth = m_nWidth;
00099         break;
00100
00101     case PGF_CALCHEIGHT:
00102         pNMPGCalcSize->iHeight = m_nHeight;
00103         break;
00104     }
00105
00106     *pResult = 0;
00107     return FALSE;   // Let parent handle message
00108 }
00109
00110 BOOL CCJPagerCtrl::OnPagerScroll(NMPGSCROLL* /*pNMPGScroll*/, LRESULT* pResult)
00111 {
00112     *pResult = 0;
00113     return FALSE;   // Let parent handle message
00114 }
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJReBar.cpp Source File

WinCvs/CJLib/CJLibrary/CJReBar.cpp

Go to the documentation of this file.
00001 // CJReBar.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new IE4 controls'
00007 // http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/CJLibrary/CJReBar.cpp $
00015  *
00016  * $History: CJReBar.cpp $
00017  *
00018  * *****************  Version 8  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/CJLibrary
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 7  *****************
00024  * User: Kirk Stowell Date: 7/31/99    Time: 4:26p
00025  * Updated in $/CodeJockey/CJLibrary
00026  *
00027  * *****************  Version 5  *****************
00028  * User: Kirk Stowell Date: 6/23/99    Time: 12:13a
00029  * Updated in $/CodeJockey/CJLibrary
00030  *
00031  * *****************  Version 4  *****************
00032  * User: Kirk Stowell Date: 7/25/99    Time: 12:51a
00033  * Updated in $/CodeJockey/CJLibrary
00034  *
00035  * *****************  Version 3  *****************
00036  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00037  * Updated in $/CodeJockey/CJLibrary
00038  *
00039  * *****************  Version 2  *****************
00040  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00041  * Updated in $/CodeJockey/CJLibrary
00042  *
00043  * *****************  Version 1  *****************
00044  * User: Kirk Stowell Date: 7/14/99    Time: 10:29p
00045  * Created in $/CodeJockey/CJLibrary
00046  * Copied from MFC v6 and techno preview for v5. Added to extend
00047  * functionality to Visual C++ 5.0 users.
00048  *
00049  ***************************************************************************/
00051
00052 #include "stdafx.h"
00053 #include "CJReBar.h"
00054 #include "CJToolBar.h"
00055
00056 #ifdef _DEBUG
00057 #define new DEBUG_NEW
00058 #undef THIS_FILE
00059 static char THIS_FILE[] = __FILE__;
00060 #endif
00061
00062 #define _CjxGetDlgCtrlID(hWnd)          ((UINT)(WORD)::GetDlgCtrlID(hWnd))
00063
00064 static HWND _CjxChildWindowFromPoint(HWND hWnd, POINT pt)
00065 {
00066   ASSERT(hWnd != NULL);
00067
00068   // check child windows
00069   ::ClientToScreen(hWnd, &pt);
00070   HWND hWndChild = ::GetWindow(hWnd, GW_CHILD);
00071   for (; hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT))
00072   {
00073     if (_CjxGetDlgCtrlID(hWndChild) != (WORD)-1 &&
00074       (::GetWindowLong(hWndChild, GWL_STYLE) & WS_VISIBLE))
00075     {
00076       // see if point hits the child window
00077       CRect rect;
00078       ::GetWindowRect(hWndChild, rect);
00079       if (rect.PtInRect(pt))
00080         return hWndChild;
00081     }
00082   }
00083
00084   return NULL;    // not found
00085 }
00086
00088 // CCJReBar
00089
00090 BEGIN_MESSAGE_MAP(CCJReBar, CCJToolBarBase)
00091     //{{AFX_MSG_MAP(CCJReBar)
00092     ON_WM_NCCREATE()
00093     ON_WM_PAINT()
00094     ON_WM_NCCALCSIZE()
00095     ON_WM_ERASEBKGND()
00096     ON_WM_NCPAINT()
00097     ON_NOTIFY_REFLECT(RBN_HEIGHTCHANGE, OnHeightChange)
00098     ON_NOTIFY_REFLECT(RBN_ENDDRAG, OnHeightChange)
00099     ON_MESSAGE(RB_SHOWBAND, OnShowBand)
00100     ON_MESSAGE_VOID(WM_RECALCPARENT, OnRecalcParent)
00101     //}}AFX_MSG_MAP
00102 END_MESSAGE_MAP()
00103
00104 CCJReBar::CCJReBar()
00105 {
00106     SetBorders();
00107 }
00108
00109 void CCJReBar::OnRecalcParent()
00110 {
00111     CFrameWnd* pFrameWnd = GetParentFrame();
00112     ASSERT(pFrameWnd != NULL);
00113     pFrameWnd->RecalcLayout();
00114 }
00115
00116 void CCJReBar::OnHeightChange(NMHDR* /*pNMHDR*/, LRESULT* pResult)
00117 {
00118     CFrameWnd* pFrameWnd = GetParentFrame();
00119     if (pFrameWnd != NULL)
00120         pFrameWnd->RecalcLayout();
00121     *pResult = 0;
00122 }
00123
00124 LRESULT CCJReBar::OnShowBand(WPARAM wParam, LPARAM)
00125 {
00126     LRESULT lResult = Default();
00127     if (lResult)
00128     {
00129         // keep window visible state in sync with band visible state
00130         REBARBANDINFO rbBand;
00131         rbBand.cbSize = sizeof(rbBand);
00132         rbBand.fMask = RBBIM_CHILD|RBBIM_STYLE;
00133         VERIFY(DefWindowProc(RB_GETBANDINFO, wParam, (LPARAM)&rbBand));
00134         CCJToolBarBase* pBar = DYNAMIC_DOWNCAST(CCJToolBarBase, CWnd::FromHandlePermanent(rbBand.hwndChild));
00135         BOOL bWindowVisible;
00136         if (pBar != NULL)
00137             bWindowVisible = pBar->IsVisible();
00138         else
00139             bWindowVisible =  (::GetWindowLong(rbBand.hwndChild, GWL_STYLE) & WS_VISIBLE) != 0;
00140         BOOL bBandVisible = (rbBand.fStyle & RBBS_HIDDEN) == 0;
00141         if (bWindowVisible != bBandVisible)
00142             VERIFY(::ShowWindow(rbBand.hwndChild, bBandVisible ? SW_SHOW : SW_HIDE));
00143     }
00144     return lResult;
00145 }
00146
00147 BOOL CCJReBar::_AddBar(CWnd* pBar, REBARBANDINFO* pRBBI)
00148 {
00149     ASSERT_VALID(this);
00150     ASSERT(::IsWindow(m_hWnd));
00151     ASSERT(pBar != NULL);
00152     ASSERT(::IsWindow(pBar->m_hWnd));
00153
00154     pRBBI->cbSize = sizeof(REBARBANDINFO);
00155     pRBBI->fMask |= RBBIM_CHILD | RBBIM_CHILDSIZE;
00156     pRBBI->hwndChild = pBar->m_hWnd;
00157
00158     CSize size;
00159     CCJToolBarBase* pTemp = DYNAMIC_DOWNCAST(CCJToolBarBase, pBar);
00160     if (pTemp != NULL)
00161     {
00162         pTemp->m_bInReBar = true;
00163         size = pTemp->CalcFixedLayout(FALSE, m_dwStyle & CBRS_ORIENT_HORZ);
00164     }
00165     else
00166     {
00167         CRect rect;
00168         pBar->GetWindowRect(&rect);
00169         size = rect.Size();
00170     }
00171     //WINBUG: COMCTL32.DLL is off by 4 pixels in its sizing logic.  Whatever
00172     //  is specified as the minimum size, the system rebar will allow that band
00173     //  to be 4 actual pixels smaller!  That's why we add 4 to the size here.
00174     pRBBI->cxMinChild = size.cx + 4;
00175     pRBBI->cyMinChild = size.cy;
00176     BOOL bResult = (BOOL)DefWindowProc(RB_INSERTBAND, (WPARAM)-1, (LPARAM)pRBBI);
00177
00178     CFrameWnd* pFrameWnd = GetParentFrame();
00179     if (pFrameWnd != NULL)
00180         pFrameWnd->RecalcLayout();
00181
00182     return bResult;
00183 }
00184
00185 BOOL CCJReBar::AddBar(CWnd* pBar, LPCTSTR pszText, CBitmap* pbmp, DWORD dwStyle)
00186 {
00187     REBARBANDINFO rbBand;
00188     rbBand.fMask = RBBIM_STYLE;
00189     rbBand.fStyle = dwStyle;
00190     if (pszText != NULL)
00191     {
00192         rbBand.fMask |= RBBIM_TEXT;
00193         rbBand.lpText = const_cast<LPTSTR>(pszText);
00194     }
00195     if (pbmp != NULL)
00196     {
00197         rbBand.fMask |= RBBIM_BACKGROUND;
00198         rbBand.hbmBack = (HBITMAP)*pbmp;
00199     }
00200     return _AddBar(pBar, &rbBand);
00201 }
00202
00203 BOOL CCJReBar::AddBar(CWnd* pBar, COLORREF clrFore, COLORREF clrBack, LPCTSTR pszText, DWORD dwStyle)
00204 {
00205     REBARBANDINFO rbBand;
00206     rbBand.fMask = RBBIM_STYLE | RBBIM_COLORS;
00207     rbBand.fStyle = dwStyle;
00208     rbBand.clrFore = clrFore;
00209     rbBand.clrBack = clrBack;
00210     if (pszText != NULL)
00211     {
00212         rbBand.fMask |= RBBIM_TEXT;
00213         rbBand.lpText = const_cast<LPTSTR>(pszText);
00214     }
00215     return _AddBar(pBar, &rbBand);
00216 }
00217
00218 CSize CCJReBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
00219 {
00220     ASSERT_VALID(this);
00221     ASSERT(::IsWindow(m_hWnd));
00222
00223     // the union of the band rectangles is the total bounding rect
00224     int nCount = DefWindowProc(RB_GETBANDCOUNT, 0, 0);
00225     REBARBANDINFO rbBand;
00226     rbBand.cbSize = sizeof(rbBand);
00227     int nTemp;
00228
00229     // sync up hidden state of the bands
00230     for (nTemp = nCount; nTemp--; )
00231     {
00232         rbBand.fMask = RBBIM_CHILD|RBBIM_STYLE;
00233         VERIFY(DefWindowProc(RB_GETBANDINFO, nTemp, (LPARAM)&rbBand));
00234         CCJToolBarBase* pBar = DYNAMIC_DOWNCAST(CCJToolBarBase, CWnd::FromHandlePermanent(rbBand.hwndChild));
00235         BOOL bWindowVisible;
00236         if (pBar != NULL)
00237             bWindowVisible = pBar->IsVisible();
00238         else
00239             bWindowVisible =  (::GetWindowLong(rbBand.hwndChild, GWL_STYLE) & WS_VISIBLE) != 0;
00240         BOOL bBandVisible = (rbBand.fStyle & RBBS_HIDDEN) == 0;
00241         if (bWindowVisible != bBandVisible)
00242             VERIFY(DefWindowProc(RB_SHOWBAND, nTemp, bWindowVisible));
00243     }
00244
00245     // determine bounding rect of all visible bands
00246     CRect rectBound; rectBound.SetRectEmpty();
00247     for (nTemp = nCount; nTemp--; )
00248     {
00249         rbBand.fMask = RBBIM_STYLE;
00250         VERIFY(DefWindowProc(RB_GETBANDINFO, nTemp, (LPARAM)&rbBand));
00251         if ((rbBand.fStyle & RBBS_HIDDEN) == 0)
00252         {
00253             CRect rect;
00254             VERIFY(DefWindowProc(RB_GETRECT, nTemp, (LPARAM)&rect));
00255             rectBound |= rect;
00256         }
00257     }
00258
00259     // add borders as part of bounding rect
00260     if (!rectBound.IsRectEmpty())
00261     {
00262         CRect rect; rect.SetRectEmpty();
00263         CalcInsideRect(rect, bHorz);
00264         rectBound.right -= rect.Width();
00265         rectBound.bottom -= rect.Height();
00266     }
00267
00268     return CSize((bHorz && bStretch) ? 32767 : rectBound.Width(),
00269         (!bHorz && bStretch) ? 32767 : rectBound.Height());
00270 }
00271
00272 CSize CCJReBar::CalcDynamicLayout(int /*nLength*/, DWORD dwMode)
00273 {
00274     if (dwMode & LM_HORZDOCK)
00275         ASSERT(dwMode & LM_HORZ);
00276     return CalcFixedLayout(dwMode & LM_STRETCH, dwMode & LM_HORZ);
00277 }
00278
00279 BOOL CCJReBar::Create(CWnd* pParentWnd, DWORD dwCtrlStyle, DWORD dwStyle, UINT nID)
00280 {
00281     ASSERT_VALID(pParentWnd);   // must have a parent
00282     ASSERT (!((dwStyle & CBRS_SIZE_FIXED) && (dwStyle & CBRS_SIZE_DYNAMIC)));
00283
00284     // save the style
00285     m_dwStyle = (dwStyle & CBRS_ALL);
00286     if (nID == AFX_IDW_REBAR)
00287         m_dwStyle |= CBRS_HIDE_INPLACE;
00288
00289     dwStyle &= ~CBRS_ALL;
00290     dwStyle |= CCS_NOPARENTALIGN|CCS_NOMOVEY|CCS_NODIVIDER|CCS_NORESIZE|RBS_VARHEIGHT;
00291     dwStyle |= dwCtrlStyle;
00292
00293     // initialize common controls
00294 #if _MSC_VER >= 1200
00295     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_COOL_REG));
00296 #else
00297     INITCOMMONCONTROLSEX icex;
00298     icex.dwSize = sizeof(icex);
00299     icex.dwICC = ICC_COOL_CLASSES;
00300     VERIFY(InitCommonControlsEx(&icex));
00301 #endif
00302
00303     _GetComCtlVersion();
00304     ASSERT(_ComCtlVersion != -1);
00305
00306     // create the HWND
00307     CRect rect; rect.SetRectEmpty();
00308     if (!CWnd::Create(REBARCLASSNAME, NULL, dwStyle, rect, pParentWnd, nID))
00309         return FALSE;
00310
00311     // Note: Parent must resize itself for control bar to be resized
00312     m_bInReBar = true;
00313
00314     return TRUE;
00315 }
00316
00317 void CCJReBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHandler)
00318 {
00319     UpdateDialogControls(pTarget, bDisableIfNoHandler);
00320 }
00321
00322 BOOL CCJReBar::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
00323 {
00324     if (!CCJToolBarBase::OnNcCreate(lpCreateStruct))
00325         return FALSE;
00326
00327     // if the owner was set before the rebar was created, set it now
00328     if (m_hWndOwner != NULL)
00329         DefWindowProc(RB_SETPARENT, (WPARAM)m_hWndOwner, 0);
00330
00331     return TRUE;
00332 }
00333
00334 BOOL CCJReBar::OnEraseBkgnd(CDC*)
00335 {
00336     return (BOOL)Default();
00337 }
00338
00339 void CCJReBar::OnNcCalcSize(BOOL /*bCalcValidRects*/, NCCALCSIZE_PARAMS* lpncsp)
00340 {
00341     // calculate border space (will add to top/bottom, subtract from right/bottom)
00342     CRect rect; rect.SetRectEmpty();
00343     BOOL bHorz = (m_dwStyle & CBRS_ORIENT_HORZ) != 0;
00344     CCJToolBarBase::CalcInsideRect(rect, bHorz);
00345
00346     // adjust non-client area for border space
00347     lpncsp->rgrc[0].left += rect.left;
00348     lpncsp->rgrc[0].top += rect.top;
00349     lpncsp->rgrc[0].right += rect.right;
00350     lpncsp->rgrc[0].bottom += rect.bottom;
00351 }
00352
00353 void CCJReBar::OnNcPaint()
00354 {
00355     EraseNonClient();
00356 }
00357
00358 void CCJReBar::OnPaint()
00359 {
00360     Default();
00361 }
00362
00363 int CCJReBar::OnToolHitTest(CPoint point, TOOLINFO* pTI) const
00364 {
00365     ASSERT_VALID(this);
00366     ASSERT(::IsWindow(m_hWnd));
00367
00368     HWND hWndChild = _CjxChildWindowFromPoint(m_hWnd, point);
00369     CWnd* pWnd = CWnd::FromHandlePermanent(hWndChild);
00370     if (pWnd == NULL)
00371         return CCJToolBarBase::OnToolHitTest(point, pTI);
00372
00373     ASSERT(pWnd->m_hWnd == hWndChild);
00374     return pWnd->OnToolHitTest(point, pTI);
00375 }
00376
00377 LRESULT CCJReBar::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
00378 {
00379     // special handling for certain messages (forwarding to owner/parent)
00380     switch (message)
00381     {
00382     case WM_POPMESSAGESTRING:
00383     case WM_SETMESSAGESTRING:
00384         return GetOwner()->SendMessage(message, wParam, lParam);
00385     }
00386     return CCJToolBarBase::WindowProc(message, wParam, lParam);
00387 }
00388
00389 #ifdef AFX_INIT_SEG
00390 #pragma code_seg(AFX_INIT_SEG)
00391 #endif
00392
00393 IMPLEMENT_DYNAMIC(CCJReBar, CCJToolBarBase)
00394
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJReBarCtrl.cpp Source File

WinCvs/CJLib/CJLibrary/CJReBarCtrl.cpp

Go to the documentation of this file.
00001 // CJReBarCtrl.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new IE4 controls'
00007 // http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/CJLibrary/CJReBarCtrl.cpp $
00015  *
00016  * $History: CJReBarCtrl.cpp $
00017  *
00018  * *****************  Version 6  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/CJLibrary
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 5  *****************
00024  * User: Kirk Stowell Date: 7/31/99    Time: 4:26p
00025  * Updated in $/CodeJockey/CJLibrary
00026  *
00027  * *****************  Version 3  *****************
00028  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00029  * Updated in $/CodeJockey/CJLibrary
00030  *
00031  * *****************  Version 2  *****************
00032  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00033  * Updated in $/CodeJockey/CJLibrary
00034  *
00035  * *****************  Version 1  *****************
00036  * User: Kirk Stowell Date: 7/14/99    Time: 10:29p
00037  * Created in $/CodeJockey/CJLibrary
00038  * Copied from MFC v6 and techno preview for v5. Added to extend
00039  * functionality to Visual C++ 5.0 users.
00040  *
00041  ***************************************************************************/
00043
00044 #include "stdafx.h"
00045 #include "CJReBarCtrl.h"
00046
00047 #ifdef _DEBUG
00048 #define new DEBUG_NEW
00049 #undef THIS_FILE
00050 static char THIS_FILE[] = __FILE__;
00051 #endif
00052
00054 // CCJReBarCtrl
00055
00056 CCJReBarCtrl::CCJReBarCtrl()
00057 {
00058 }
00059
00060 BOOL CCJReBarCtrl::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
00061                         UINT nID)
00062 {
00063     // initialize common controls
00064 #if _MSC_VER >= 1200
00065     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_COOL_REG));
00066 #else
00067     INITCOMMONCONTROLSEX icex;
00068     icex.dwSize = sizeof(icex);
00069     icex.dwICC = ICC_COOL_CLASSES;
00070     VERIFY(InitCommonControlsEx(&icex));
00071 #endif
00072
00073     CWnd* pWnd = this;
00074     return pWnd->Create(REBARCLASSNAME, NULL, dwStyle, rect, pParentWnd, nID);
00075 }
00076
00077 CImageList* CCJReBarCtrl::GetImageList() const
00078 {
00079   REBARINFO rbi;
00080   rbi.cbSize = sizeof(rbi);
00081   rbi.fMask = RBIM_IMAGELIST;
00082   return GetBarInfo(&rbi) ? CImageList::FromHandle(rbi.himl) : NULL;
00083 }
00084
00085 BOOL CCJReBarCtrl::SetImageList(CImageList* pImageList)
00086 {
00087   REBARINFO rbi;
00088   rbi.cbSize = sizeof(rbi);
00089   rbi.fMask = RBIM_IMAGELIST;
00090   rbi.himl = (HIMAGELIST)pImageList->GetSafeHandle();
00091   return SetBarInfo(&rbi);
00092 }
00093
00094 BOOL CCJReBarCtrl::GetColorScheme(COLORSCHEME* lpcs)
00095 {
00096   lpcs->dwSize = sizeof(COLORSCHEME);
00097   return SendMessage(RB_GETCOLORSCHEME, 0, (LPARAM)lpcs);
00098 }
00099
00100 void CCJReBarCtrl::SetColorScheme(const COLORSCHEME* lpcs)
00101 {
00102   ((COLORSCHEME*)lpcs)->dwSize = sizeof(COLORSCHEME);
00103   SendMessage(RB_SETCOLORSCHEME, 0, (LPARAM)lpcs);
00104 }
00105
00107
00108 IMPLEMENT_DYNAMIC(CCJReBarCtrl, CWnd)
00109
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJShell.cpp Source File

WinCvs/CJLib/CJLibrary/CJShell.cpp

Go to the documentation of this file.
00001 // CJShell.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based upon the MFCENUM example. MFCENUM is a companion sample application
00006 // for Chapter 14 in "Programming the Windows 95 User Interface" by Nancy Cluts,
00007 // available in the Microsoft(R) Development Library.
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJock/CJLibrary/CJShell.cpp $
00015  *
00016  * $History: CJShell.cpp $
00017  *
00018  * *****************  Version 10  *****************
00019  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00020  * Updated in $/CodeJock/CJLibrary
00021  * Fixed potential resource and memory leak problems.
00022  *
00023  * *****************  Version 9  *****************
00024  * User: Kirk Stowell Date: 10/14/99   Time: 10:25a
00025  * Updated in $/CodeJock/CJLibrary
00026  * Added four new shell methods which deal with PIDL's including a new
00027  * version of an Explorer context menu called DoExplorerMenu(...) which
00028  * can be used in place of the existing DoTheMenuThing(...) method.
00029  *
00030  * *****************  Version 8  *****************
00031  * User: Kirk Stowell Date: 9/13/99    Time: 5:52a
00032  * Updated in $/CodeJockey/CJLibrary
00033  * Fixed build errors which occured with UNICODE builds.
00034  *
00035  * *****************  Version 7  *****************
00036  * User: Kirk Stowell Date: 8/31/99    Time: 4:39a
00037  * Updated in $/CodeJockey/CJLibrary
00038  * Updated copyright and contact information.
00039  *
00040  * *****************  Version 6  *****************
00041  * User: Kirk Stowell Date: 7/31/99    Time: 4:26p
00042  * Updated in $/CodeJockey/CJLibrary
00043  *
00044  * *****************  Version 4  *****************
00045  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00046  * Updated in $/CodeJockey/CJLibrary
00047  *
00048  * *****************  Version 3  *****************
00049  * User: Kirk Stowell Date: 6/11/99    Time: 10:06p
00050  * Updated in $/CodeJockey/CJ60Lib
00051  * Renamed class from CCJShellFile to CCJShell.
00052  *
00053  * *****************  Version 2  *****************
00054  * User: Kirk Stowell Date: 5/02/99    Time: 3:38p
00055  * Updated in $/CodeJockey/CJ60Lib
00056  * Added version macro  _WIN32_IE, you will need to have at IE4 or greater
00057  * installed to use this class. This will ensure that the version of
00058  * SHELL32.DLL is compatible.
00059  *
00060  * *****************  Version 1  *****************
00061  * User: Kirk Stowell Date: 3/19/99    Time: 11:01p
00062  * Created in $/CodeJockey/CJ60Lib
00063  * Initial re-write and release.
00064  *
00065  ***************************************************************************/
00067
00068 #include "StdAfx.h"
00069 #include "CJShell.h"
00070
00071 #if _WIN32_IE >= 0x0400 // Need to have at IE4 or greater installed.
00072
00074 // CCJShell
00075
00076 CCJShell::CCJShell(LPCTSTR lpszFileName)
00077 {
00078     m_strFileName = lpszFileName;
00079     SplitPath(m_strFileName, m_szDrive, m_szDir, m_szFname, m_szExt);
00080 }
00081
00082 CCJShell::~CCJShell()
00083 {
00084 }
00085
00086 int CALLBACK CCJShell::BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM /*lParam*/, LPARAM lpData)
00087 {
00088     CCJShell* pCJShellInfo = (CCJShell*)lpData;
00089
00090     if (pCJShellInfo->m_strSelDir.IsEmpty())
00091         return FALSE;
00092
00093     switch (uMsg)
00094     {
00095     case BFFM_INITIALIZED:
00096         ::SendMessage(hwnd, BFFM_SETSELECTION, TRUE,
00097             (LPARAM)(LPCTSTR)pCJShellInfo->m_strSelDir);
00098         break;
00099
00100     case BFFM_SELCHANGED:
00101         break;
00102     }
00103
00104     return FALSE;
00105 }
00106
00107 BOOL CCJShell::BrowseForFolder(CWnd *pParentWnd)
00108 {
00109     ASSERT(pParentWnd);
00110
00111     LPMALLOC pMalloc;
00112     if (::SHGetMalloc(&pMalloc)!= NOERROR)
00113         return FALSE;
00114
00115     BROWSEINFO bInfo;
00116     LPITEMIDLIST pidl;
00117     ZeroMemory ( (PVOID) &bInfo,sizeof (BROWSEINFO));
00118
00119     if (!m_strInitDir.IsEmpty ())
00120     {
00121         OLECHAR       olePath[MAX_PATH];
00122         ULONG         chEaten;
00123         ULONG         dwAttributes;
00124         HRESULT       hr;
00125         LPSHELLFOLDER pDesktopFolder;
00126         //
00127         // Get a pointer to the Desktop's IShellFolder interface.
00128         //
00129         if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder)))
00130         {
00131             //
00132             // IShellFolder::ParseDisplayName requires the file name be in Unicode.
00133             //
00134 #if defined( _UNICODE )
00135             _tcsncpy( olePath, m_strInitDir, MAX_PATH );
00136 #else
00137             MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, m_strInitDir,
00138                                  -1, olePath, MAX_PATH);
00139 #endif
00140             //
00141             // Convert the path to an ITEMIDLIST.
00142             //
00143             hr = pDesktopFolder->ParseDisplayName(NULL,
00144                 NULL,
00145                 olePath,
00146                 &chEaten,
00147                 &pidl,
00148                 &dwAttributes);
00149             if (FAILED(hr))
00150             {
00151                 pMalloc ->Free (pidl);
00152                 pMalloc ->Release ();
00153                 // fix potential memory leak - KStowell 10-22-99
00154                 pDesktopFolder ->Release ();
00155                 return FALSE;
00156             }
00157             bInfo.pidlRoot = pidl;
00158             // fix potential memory leak - KStowell 10-22-99
00159             pDesktopFolder ->Release ();
00160         }
00161     }
00162
00163     bInfo.hwndOwner      = pParentWnd->GetSafeHwnd();
00164     bInfo.pszDisplayName = m_strPath.GetBuffer (MAX_PATH);
00165     bInfo.lpszTitle      = (m_strTitle.IsEmpty()) ? _T("Open"):m_strTitle;
00166     bInfo.ulFlags        = BIF_RETURNFSANCESTORS|BIF_RETURNONLYFSDIRS;
00167     bInfo.lpfn           = BrowseCtrlCallback;  // address of callback function
00168     bInfo.lParam         = (LPARAM)this;        // pass address of object to callback function
00169
00170     if ((pidl = ::SHBrowseForFolder(&bInfo)) == NULL)
00171     {
00172         return FALSE;
00173     }
00174     m_strPath.ReleaseBuffer();
00175     m_iImageIndex = bInfo.iImage;
00176
00177     if (::SHGetPathFromIDList(pidl,m_strPath.GetBuffer(MAX_PATH)) == FALSE)
00178     {
00179         pMalloc ->Free(pidl);
00180         pMalloc ->Release();
00181         return FALSE;
00182     }
00183
00184     m_strPath.ReleaseBuffer();
00185
00186     pMalloc ->Free(pidl);
00187     pMalloc ->Release();
00188
00189     return TRUE;
00190 }
00191
00192 void CCJShell::GetSystemImageList(CImageList *pSmallList, CImageList *pLargeList)
00193 {
00194     ASSERT(pSmallList);
00195     ASSERT(pLargeList);
00196
00197     //image list setup
00198     SHFILEINFO  ssfi, lsfi;
00199
00200     // Get a handle to the system small icon list
00201     HIMAGELIST hSystemSmallImageList = (HIMAGELIST)
00202         ::SHGetFileInfo((LPCTSTR)_T("C:\\"), 0, &ssfi,
00203         sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
00204
00205     // Attach it to the small image list
00206     // DON'T FORGET TO PUT pSmallList->Detach(); in your destructor
00207     pSmallList->Attach(hSystemSmallImageList);
00208
00209     // Get a handle to the system large icon list
00210     HIMAGELIST hSystemLargeImageList =  (HIMAGELIST)
00211         ::SHGetFileInfo((LPCTSTR)_T("C:\\"), 0, &lsfi,
00212         sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_ICON);
00213
00214     // Attach it to the large image list
00215     // DON'T FORGET TO PUT pLargeList->Detach(); in your destructor
00216     pLargeList->Attach(hSystemLargeImageList);
00217 }
00218
00219 CString CCJShell::GetFileName(LPCTSTR lpszFileName/*=NULL*/)
00220 {
00221     // Parse the file path.
00222     if (lpszFileName != NULL) {
00223         SplitPath(lpszFileName, m_szDrive, m_szDir, m_szFname, m_szExt);
00224     }
00225
00226     // Just return the file name + extension.
00227     CString str; str.Format(_T("%s%s"), m_szFname, m_szExt);
00228     return str;
00229 }
00230
00231 CString CCJShell::GetFileDrive(LPCTSTR lpszFileName/*=NULL*/)
00232 {
00233     // Parse the file path.
00234     if (lpszFileName != NULL) {
00235         SplitPath(lpszFileName, m_szDrive, m_szDir, m_szFname, m_szExt);
00236     }
00237
00238     return m_szDrive;
00239 }
00240
00241 CString CCJShell::GetRoot(LPCTSTR lpszFileName/*=NULL*/)
00242 {
00243     // Parse the file path.
00244     if (lpszFileName != NULL) {
00245         SplitPath(lpszFileName, m_szDrive, m_szDir, m_szFname, m_szExt);
00246     }
00247
00248     // Just return the file name + extension.
00249     CString str; str.Format(_T("%s%s"), m_szDrive, m_szDir);
00250     return str;
00251 }
00252
00253 CString CCJShell::GetFileTitle(LPCTSTR lpszFileName/*=NULL*/)
00254 {
00255     // Parse the file path.
00256     if (lpszFileName != NULL) {
00257         SplitPath(lpszFileName, m_szDrive, m_szDir, m_szFname, m_szExt);
00258     }
00259
00260     return m_szFname;
00261 }
00262
00263 CString CCJShell::GetFileExt(LPCTSTR lpszFileName/*=NULL*/)
00264 {
00265     // Parse the file path.
00266     if (lpszFileName != NULL) {
00267         SplitPath(lpszFileName, m_szDrive, m_szDir, m_szFname, m_szExt);
00268     }
00269
00270     return m_szExt;
00271 }
00272
00273 CString CCJShell::GetFileType(LPCTSTR lpszFileName/*=NULL*/)
00274 {
00275     SHFILEINFO  sfi;
00276
00277     ::SHGetFileInfo((lpszFileName==NULL)?m_strFileName:lpszFileName,
00278         0, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME);
00279
00280    return sfi.szTypeName;
00281 }
00282
00283 CString CCJShell::GetDisplayName(LPCTSTR lpszFileName/*=NULL*/)
00284 {
00285     SHFILEINFO sfi;
00286
00287     ::SHGetFileInfo((lpszFileName==NULL)?m_strFileName:lpszFileName,
00288         0, &sfi, sizeof(SHFILEINFO), SHGFI_DISPLAYNAME);
00289
00290     return sfi.szDisplayName;
00291 }
00292
00293 int CCJShell::GetIconIndex(LPCTSTR lpszFileName/*=NULL*/, UINT uFlags/*=SHGFI_SMALLICON*/)
00294 {
00295     SHFILEINFO sfi;
00296
00297     ::SHGetFileInfo((lpszFileName==NULL)?m_strFileName:lpszFileName,
00298         0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | uFlags);
00299
00300     return sfi.iIcon;
00301 }
00302
00303 BOOL CCJShell::Exist(LPCTSTR lpszFileName/*=NULL*/)
00304 {
00305     WIN32_FIND_DATA fd;
00306     HANDLE hFind = FindFirstFile( (lpszFileName==NULL)?m_strFileName:lpszFileName, &fd );
00307
00308     if ( hFind != INVALID_HANDLE_VALUE )
00309         FindClose( hFind );
00310
00311     return (hFind != INVALID_HANDLE_VALUE);
00312 }
00313
00314 CString CCJShell::GetLastWriteTime(CTime *pTime)
00315 {
00316     if (!pTime)
00317         return _T("");
00318
00319     CString strTime;
00320
00321     // Format the date time string.
00322     strTime.Format( _T("%.2d/%.2d/%d %.2d:%.2d"), pTime->GetMonth(), pTime->GetDay(),
00323         pTime->GetYear(), pTime->GetHour(), pTime->GetSecond());
00324
00325     return strTime;
00326 }
00327
00328 CString CCJShell::GetFileSizeString(LPCTSTR lpszFileSize)
00329 {
00330     CString strFileSize(lpszFileSize);
00331
00332     UINT nSize = _ttoi(strFileSize);
00333     if (nSize == 0) return _T("0KB");
00334
00335     nSize /= 1000;
00336     if (nSize == 0) return _T("1KB");
00337
00338     strFileSize.Format(_T("%dKB"), nSize);
00339     return strFileSize;
00340 }
00341
00342 //
00343 // FUNCTIONS THAT DEAL WITH PIDLs
00344 //
00345
00346 LPITEMIDLIST CCJShell::Next(LPCITEMIDLIST pidl)
00347 {
00348    LPSTR lpMem=(LPSTR)pidl;
00349
00350    lpMem+=pidl->mkid.cb;
00351
00352    return (LPITEMIDLIST)lpMem;
00353 }
00354
00355 UINT CCJShell::GetSize(LPCITEMIDLIST pidl)
00356 {
00357     UINT cbTotal = 0;
00358     if (pidl)
00359     {
00360         cbTotal += sizeof(pidl->mkid.cb);       // Null terminator
00361         while (pidl->mkid.cb)
00362         {
00363             cbTotal += pidl->mkid.cb;
00364             pidl = Next(pidl);
00365         }
00366     }
00367
00368     return cbTotal;
00369 }
00370
00371 LPITEMIDLIST CCJShell::Create(UINT cbSize)
00372 {
00373     LPMALLOC lpMalloc;
00374     HRESULT  hr;
00375     LPITEMIDLIST pidl=NULL;
00376
00377     hr=SHGetMalloc(&lpMalloc);
00378
00379     if (FAILED(hr))
00380        return 0;
00381
00382     pidl=(LPITEMIDLIST)lpMalloc->Alloc(cbSize);
00383
00384     if (pidl)
00385         memset(pidl, 0, cbSize);      // zero-init for external task   alloc
00386
00387     if (lpMalloc) lpMalloc->Release();
00388
00389     return pidl;
00390 }
00391
00392 LPITEMIDLIST CCJShell::ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
00393 {
00394     LPITEMIDLIST pidlNew;
00395     UINT cb1;
00396     UINT cb2;
00397
00398     if (pidl1)  //May be NULL
00399        cb1 = GetSize(pidl1) - sizeof(pidl1->mkid.cb);
00400     else
00401        cb1 = 0;
00402
00403     cb2 = GetSize(pidl2);
00404
00405     pidlNew = Create(cb1 + cb2);
00406     if (pidlNew)
00407     {
00408         if (pidl1)
00409            memcpy(pidlNew, pidl1, cb1);
00410         memcpy(((LPSTR)pidlNew) + cb1, pidl2, cb2);
00411     }
00412     return pidlNew;
00413 }
00414
00415 LPITEMIDLIST CCJShell::CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi)
00416 {
00417    LPITEMIDLIST lpiTemp;
00418
00419    lpiTemp=(LPITEMIDLIST)lpMalloc->Alloc(lpi->mkid.cb+sizeof(lpi->mkid.cb));
00420    CopyMemory((PVOID)lpiTemp, (CONST VOID *)lpi, lpi->mkid.cb+sizeof(lpi->mkid.cb));
00421
00422    return lpiTemp;
00423 }
00424
00425 BOOL CCJShell::GetName( LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPTSTR lpFriendlyName )
00426 {
00427    BOOL   bSuccess=TRUE;
00428    STRRET str;
00429
00430    if (NOERROR==lpsf->GetDisplayNameOf(lpi,dwFlags, &str))
00431    {
00432       switch (str.uType)
00433       {
00434          case STRRET_WSTR:
00435 #if defined( _UNICODE )
00436             _tcscpy( lpFriendlyName, str.pOleStr );
00437 #else
00438             WideCharToMultiByte(CP_ACP,                 // CodePage
00439                                 0,                     // dwFlags
00440                                 str.pOleStr,            // lpWideCharStr
00441                                 -1,                     // cchWideChar
00442                                 lpFriendlyName,         // lpMultiByteStr
00443                                 MAX_PATH,
00444                                 //sizeof(lpFriendlyName), // cchMultiByte, wrong. sizeof on a pointer, psk, psk
00445                                 NULL,                   // lpDefaultChar,
00446                                 NULL);                  // lpUsedDefaultChar
00447 #endif
00448              break;
00449
00450          case STRRET_OFFSET:
00451 #if defined( _UNICODE )
00452             MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, (LPSTR)lpi+str.uOffset,
00453                 -1, lpFriendlyName, MAX_PATH);
00454 #else
00455              _tcscpy(lpFriendlyName, (LPSTR)lpi+str.uOffset);
00456 #endif
00457             break;
00458
00459          case STRRET_CSTR:
00460 #if defined( _UNICODE )
00461             MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, str.cStr,
00462                 -1, lpFriendlyName, MAX_PATH);
00463 #else
00464              _tcscpy(lpFriendlyName, (LPSTR)str.cStr);
00465 #endif
00466              break;
00467
00468          default:
00469              bSuccess = FALSE;
00470              break;
00471       }
00472    }
00473    else
00474       bSuccess = FALSE;
00475
00476    return bSuccess;
00477 }
00478
00479 LPITEMIDLIST CCJShell::GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi)
00480 {
00481    TCHAR szBuff[MAX_PATH];
00482    OLECHAR szOleChar[MAX_PATH];
00483    LPSHELLFOLDER lpsfDeskTop;
00484    LPITEMIDLIST  lpifq;
00485    ULONG ulEaten, ulAttribs;
00486    HRESULT hr;
00487
00488     if( GetName(lpsf, lpi, SHGDN_FORPARSING, szBuff) == FALSE ) {
00489         return NULL;
00490     }
00491
00492    hr=SHGetDesktopFolder(&lpsfDeskTop);
00493
00494    if (FAILED(hr))
00495       return NULL;
00496
00497 #if defined( _UNICODE )
00498    hr=lpsfDeskTop->ParseDisplayName(NULL, NULL, szOleChar, &ulEaten,
00499         &lpifq, &ulAttribs );
00500 #else
00501    MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szBuff,
00502         -1, (USHORT*)szOleChar, sizeof(szOleChar));
00503
00504    hr=lpsfDeskTop->ParseDisplayName(NULL, NULL, szOleChar, &ulEaten,
00505         &lpifq, &ulAttribs );
00506 #endif
00507
00508    lpsfDeskTop->Release();
00509
00510    if (FAILED(hr))
00511       return NULL;
00512
00513    return lpifq;
00514 }
00515
00516 BOOL CCJShell::DoTheMenuThing(HWND hwnd, LPSHELLFOLDER lpsfParent,
00517      LPITEMIDLIST  lpi, LPPOINT lppt)
00518 {
00519     LPCONTEXTMENU lpcm;
00520     HRESULT       hr;
00521     TCHAR          szTemp[64];
00522     CMINVOKECOMMANDINFO cmi;
00523     int                 idCmd;
00524     HMENU               hMenu;
00525     BOOL                bSuccess=TRUE;
00526
00527     hr=lpsfParent->GetUIObjectOf(hwnd,
00528         1,  //Number of objects to get attributes of
00529         (const struct _ITEMIDLIST **)&lpi,
00530         IID_IContextMenu,
00531         0,
00532         (LPVOID *)&lpcm);
00533     if (SUCCEEDED(hr))
00534     {
00535        hMenu = CreatePopupMenu();
00536
00537        if (hMenu)
00538        {
00539           hr=lpcm->QueryContextMenu(hMenu, 0, 1, 0x7fff, CMF_EXPLORE);
00540           if (SUCCEEDED(hr))
00541           {
00542              idCmd=TrackPopupMenu(hMenu,
00543                 TPM_LEFTALIGN | TPM_RETURNCMD | TPM_RIGHTBUTTON,
00544                 lppt->x, lppt->y, 0, hwnd, NULL);
00545
00546              if (idCmd)
00547              {
00548                 cmi.cbSize       = sizeof(CMINVOKECOMMANDINFO);
00549                 cmi.fMask        = 0;
00550                 cmi.hwnd         = hwnd;
00551                 cmi.lpVerb       = (LPCSTR)MAKEINTRESOURCE(idCmd-1);
00552                 cmi.lpParameters = NULL;
00553                 cmi.lpDirectory  = NULL;
00554                 cmi.nShow        = SW_SHOWNORMAL;
00555                 cmi.dwHotKey     = 0;
00556                 cmi.hIcon        = NULL;
00557
00558                 hr=lpcm->InvokeCommand(&cmi);
00559
00560                 if (!SUCCEEDED(hr))
00561                 {
00562                    wsprintf(szTemp, _T("InvokeCommand failed. hr=%lx"), hr);
00563                    AfxMessageBox(szTemp);
00564                 }
00565                 else
00566                 {
00567                     ::SendMessage(hwnd, WM_SHELL_NOTIFY,
00568                         NM_SH_SHELLMENU, (LPARAM)0);
00569                 }
00570              }
00571
00572           }
00573           else
00574              bSuccess = FALSE;
00575
00576           DestroyMenu(hMenu);
00577        }
00578        else
00579           bSuccess = FALSE;
00580
00581        lpcm->Release();
00582     }
00583     else
00584     {
00585        wsprintf(szTemp, _T("GetUIObjectOf failed! hr=%lx"), hr);
00586        AfxMessageBox(szTemp );
00587        bSuccess = FALSE;
00588     }
00589     return bSuccess;
00590 }
00591
00592 int CCJShell::GetIcon(LPITEMIDLIST lpi, UINT uFlags)
00593 {
00594     SHFILEINFO    sfi;
00595
00596     SHGetFileInfo((LPCTSTR)lpi, 0, &sfi,
00597         sizeof(SHFILEINFO), uFlags);
00598
00599     return sfi.iIcon;
00600 }
00601
00602 void CCJShell::GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTV_ITEM lptvitem)
00603 {
00604    //Note that we don't check the return value here because if GetIcon()
00605    //fails, then we're in big trouble...
00606
00607    lptvitem->iImage = GetIcon(lpifq, SHGFI_PIDL |
00608                               SHGFI_SYSICONINDEX |
00609                               SHGFI_SMALLICON);
00610
00611    lptvitem->iSelectedImage = GetIcon(lpifq, SHGFI_PIDL |
00612                                       SHGFI_SYSICONINDEX |
00613                                       SHGFI_SMALLICON |
00614                                       SHGFI_OPENICON);
00615
00616    return;
00617 }
00618
00619 LONG CCJShell::GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata)
00620 {
00621     HKEY hkey;
00622     LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
00623
00624     if (retval == ERROR_SUCCESS) {
00625         long datasize = MAX_PATH;
00626         TCHAR data[MAX_PATH];
00627         RegQueryValue(hkey, NULL, data, &datasize);
00628         _tcscpy(retdata,data);
00629         RegCloseKey(hkey);
00630     }
00631
00632     return retval;
00633 }
00634
00635 HINSTANCE CCJShell::ShellExec(LPCTSTR lpszExec, int nShow)
00636 {
00637     TCHAR key[MAX_PATH + MAX_PATH];
00638
00639     // First try ShellExecute()
00640     HINSTANCE result = ShellExecute(NULL, _T("open"), lpszExec, NULL,NULL, nShow);
00641
00642     // If it failed, get the .htm regkey and lookup the program
00643     if ((UINT)result <= HINSTANCE_ERROR) {
00644
00645         if (GetRegKey(HKEY_CLASSES_ROOT, _T(".htm"), key) == ERROR_SUCCESS) {
00646             lstrcat(key, _T("\\shell\\open\\command"));
00647
00648             if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) {
00649                 TCHAR *pos;
00650                 pos = _tcsstr(key, _T("\"%1\""));
00651                 if (pos == NULL) {                     // No quotes found
00652                     pos = _tcsstr(key, _T("%1"));       // Check for %1, without quotes
00653                     if (pos == NULL)                   // No parameter at all...
00654                         pos = key+_tcslen(key)-1;
00655                     else
00656                         *pos = _T('\0');                   // Remove the parameter
00657                 }
00658                 else
00659                     *pos = _T('\0');                       // Remove the parameter
00660
00661                 lstrcat(pos, _T(" "));
00662                 lstrcat(pos, lpszExec);
00663                 PROCESS_INFORMATION pi;
00664
00665                 STARTUPINFO         si;
00666
00667                 ::ZeroMemory( &si, sizeof( si ));
00668
00669                 si.cb = sizeof( si );
00670
00671                 if( ::CreateProcess( NULL,
00672                                      pos,
00673                                      NULL,
00674                                      NULL,
00675                                      FALSE,
00676                                      0,
00677                                      NULL,
00678                                      NULL,
00679                                      &si,
00680                                     &pi ) == FALSE )
00681                 {
00682                     return NULL;
00683                 }
00684
00685                 result = (HINSTANCE) pi.hProcess;
00686             }
00687         }
00688     }
00689
00690     return result;
00691 }
00692
00693 void CCJShell::SplitPath(CString strFileName, char* szDrive, char* szDir, char* szFile, char* szExt)
00694 {
00695 #if defined( _UNICODE )
00696     char szFileName[ MAX_PATH ];
00697     ::WideCharToMultiByte( CP_ACP, 0, strFileName, -1,
00698         szFileName, MAX_PATH, NULL, NULL );
00699     _splitpath( szFileName, szDrive, szDir, szFile, szExt );
00700 #else
00701     _splitpath( strFileName, szDrive, szDir, szFile, szExt );
00702 #endif
00703 }
00704
00706 // New Context menu functions
00708
00709 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00710 //
00711 //  FUNCTION:       DuplicateItem
00712 //
00713 //  DESCRIPTION:    Makes a copy of the next item in an item ID list.
00714 //
00715 //  INPUT:          pMalloc = Pointer to an IMalloc interface.
00716 //                  pidl    = Pointer to an item ID list.
00717 //
00718 //  RETURNS:        Pointer to an ITEMIDLIST containing the copied item ID.
00719 //
00720 //  NOTES:          It is the caller's responsibility to free the memory
00721 //                  allocated by this function when the item ID is no longer
00722 //                  needed. Example:
00723 //
00724 //                    pidlItem = DuplicateItem (pMalloc, pidl);
00725 //                      .
00726 //                      .
00727 //                      .
00728 //                    pMalloc->Free (pMalloc, pidlItem);
00729 //
00730 //                  Failure to free the ITEMIDLIST will result in memory
00731 //                  leaks.
00732 //
00733 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00734
00735 LPITEMIDLIST CCJShell::DuplicateItem (LPMALLOC pMalloc, LPITEMIDLIST pidl)
00736 {
00737     USHORT nLen;
00738     LPITEMIDLIST pidlNew;
00739
00740     nLen = pidl->mkid.cb;
00741     if (nLen == 0)
00742         return NULL;
00743
00744     pidlNew = (LPITEMIDLIST) pMalloc->Alloc (nLen + sizeof (USHORT));
00745     if (pidlNew == NULL)
00746         return NULL;
00747
00748     CopyMemory (pidlNew, pidl, nLen);
00749     *((USHORT*) (((LPBYTE) pidlNew) + nLen)) = 0;
00750
00751     return pidlNew;
00752 }
00753
00754 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00755 //
00756 //  FUNCTION:       GetNextItem
00757 //
00758 //  DESCRIPTION:    Finds the next item in an item ID list.
00759 //
00760 //  INPUT:          pidl = Pointer to an item ID list.
00761 //
00762 //  RETURNS:        Pointer to the next item.
00763 //
00764 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00765
00766 LPITEMIDLIST CCJShell::GetNextItem (LPITEMIDLIST pidl)
00767 {
00768     USHORT nLen;
00769
00770     if ((nLen = pidl->mkid.cb) == 0)
00771         return NULL;
00772
00773     return (LPITEMIDLIST) (((LPBYTE) pidl) + nLen);
00774 }
00775
00776 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00777 //
00778 //  FUNCTION:       GetItemCount
00779 //
00780 //  DESCRIPTION:    Computes the number of item IDs in an item ID list.
00781 //
00782 //  INPUT:          pidl = Pointer to an item ID list.
00783 //
00784 //  RETURNS:        Number of item IDs in the list.
00785 //
00786 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00787
00788 UINT CCJShell::GetItemCount (LPITEMIDLIST pidl)
00789 {
00790     USHORT nLen;
00791     UINT nCount;
00792
00793     nCount = 0;
00794     while ((nLen = pidl->mkid.cb) != 0) {
00795         pidl = GetNextItem (pidl);
00796         nCount++;
00797     }
00798     return nCount;
00799 }
00800
00801 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00802 //
00803 //  FUNCTION:       DoExplorerMenu
00804 //
00805 //  DESCRIPTION:    Given a path name to a file or folder object, displays
00806 //                  the shell's context menu for that object and executes
00807 //                  the menu command (if any) selected by the user.
00808 //
00809 //  INPUT:          hwnd    = Handle of the window in which the menu will be
00810 //                            displayed.
00811 //
00812 //                  pszPath = Pointer to an ANSI or Unicode string
00813 //                            specifying the path to the object.
00814 //
00815 //                  point   = x and y coordinates of the point where the
00816 //                            menu's upper left corner should be located, in
00817 //                            client coordinates relative to hwnd.
00818 //
00819 //  RETURNS:        TRUE if successful, FALSE if not.
00820 //
00821 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00822
00823 BOOL CCJShell::DoExplorerMenu (HWND hwnd, LPCTSTR pszPath, POINT point)
00824 {
00825     LPMALLOC pMalloc;
00826     LPSHELLFOLDER psfFolder, psfNextFolder;
00827     LPITEMIDLIST pidlMain, pidlItem, pidlNextItem, *ppidl;
00828     LPCONTEXTMENU pContextMenu;
00829     CMINVOKECOMMANDINFO ici;
00830     ULONG ulCount, ulAttr;
00831     TCHAR tchPath[MAX_PATH];
00832     WCHAR wchPath[MAX_PATH];
00833     UINT nCount, nCmd;
00834     BOOL bResult;
00835     HMENU hMenu;
00836
00837     //
00838     // Make sure the file name is fully qualified and in Unicode format.
00839     //
00840     GetFullPathName (pszPath, sizeof (tchPath) / sizeof (TCHAR), tchPath, NULL);
00841
00842 #if defined( _UNICODE )
00843     _tcscpy( wchPath, tchPath );
00844 #else
00845     MultiByteToWideChar (CP_ACP, 0, pszPath, -1, wchPath,
00846         sizeof (wchPath) / sizeof (WCHAR));
00847 #endif
00848
00849     //
00850     // Get pointers to the shell's IMalloc interface and the desktop's
00851     // IShellFolder interface.
00852     //
00853     bResult = FALSE;
00854
00855     if (!SUCCEEDED (SHGetMalloc (&pMalloc)))
00856         return bResult;
00857
00858     if (!SUCCEEDED (SHGetDesktopFolder (&psfFolder))) {
00859         pMalloc->Release();
00860         return bResult;
00861     }
00862
00863     //
00864     // Convert the path name into a pointer to an item ID list (pidl).
00865     //
00866     if (SUCCEEDED (psfFolder->ParseDisplayName (hwnd,
00867         NULL, wchPath, &ulCount, &pidlMain, &ulAttr)) && (pidlMain != NULL))
00868     {
00869         nCount = GetItemCount (pidlMain);
00870
00871         if (nCount) // nCount must be > 0
00872         {
00873             //
00874             // Initialize psfFolder with a pointer to the IShellFolder
00875             // interface of the folder that contains the item whose context
00876             // menu we're after, and initialize pidlItem with a pointer to
00877             // the item's item ID. If nCount > 1, this requires us to walk
00878             // the list of item IDs stored in pidlMain and bind to each
00879             // subfolder referenced in the list.
00880             //
00881             pidlItem = pidlMain;
00882
00883             while (nCount)
00884             {
00885                 --nCount;
00886
00887                 //
00888                 // Create a 1-item item ID list for the next item in pidlMain.
00889                 //
00890                 pidlNextItem = DuplicateItem (pMalloc, pidlItem);
00891                 if (pidlNextItem == NULL) {
00892                     pMalloc->Free (pidlMain);
00893                     psfFolder->Release();
00894                     pMalloc->Release();
00895                     return bResult;
00896                 }
00897
00898                 //
00899                 // Bind to the folder specified in the new item ID list.
00900                 //
00901                 if (!SUCCEEDED (psfFolder->BindToObject (
00902                     pidlNextItem, NULL, IID_IShellFolder, (LPVOID*)&psfNextFolder))) {
00903                     pMalloc->Free (pidlNextItem);
00904                     pMalloc->Free (pidlMain);
00905                     psfFolder->Release ();
00906                     pMalloc->Release ();
00907                     return bResult;
00908                 }
00909
00910                 //
00911                 // Release the IShellFolder pointer to the parent folder
00912                 // and set psfFolder equal to the IShellFolder pointer for
00913                 // the current folder.
00914                 //
00915                 psfFolder->Release ();
00916                 psfFolder = psfNextFolder;
00917
00918                 //
00919                 // Release the storage for the 1-item item ID list we created
00920                 // just a moment ago and initialize pidlItem so that it points
00921                 // to the next item in pidlMain.
00922                 //
00923                 pMalloc->Free (pidlNextItem);
00924                 pidlItem = GetNextItem (pidlItem);
00925             }
00926
00927             //
00928             // Get a pointer to the item's IContextMenu interface and call
00929             // IContextMenu::QueryContextMenu to initialize a context menu.
00930             //
00931             ppidl = &pidlItem;
00932             if (SUCCEEDED (psfFolder->GetUIObjectOf (
00933                 hwnd, 1, (const struct _ITEMIDLIST **)ppidl, IID_IContextMenu, NULL, (LPVOID*)&pContextMenu))) {
00934
00935                 hMenu = CreatePopupMenu ();
00936                 if (SUCCEEDED (pContextMenu->QueryContextMenu (
00937                     hMenu, 0, 1, 0x7FFF, CMF_EXPLORE))) {
00938
00939                     //
00940                     // Display the context menu.
00941                     //
00942                     nCmd = TrackPopupMenu (hMenu, TPM_LEFTALIGN |
00943                         TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD,
00944                         point.x, point.y, 0, hwnd, NULL);
00945
00946                     //
00947                     // If a command was selected from the menu, execute it.
00948                     //
00949                     if (nCmd) {
00950                         ici.cbSize          = sizeof (CMINVOKECOMMANDINFO);
00951                         ici.fMask           = 0;
00952                         ici.hwnd            = hwnd;
00953                         ici.lpVerb          = (LPCSTR)MAKEINTRESOURCE (nCmd - 1);
00954                         ici.lpParameters    = NULL;
00955                         ici.lpDirectory     = NULL;
00956                         ici.nShow           = SW_SHOWNORMAL;
00957                         ici.dwHotKey        = 0;
00958                         ici.hIcon           = NULL;
00959
00960                         if (SUCCEEDED (
00961                             pContextMenu->InvokeCommand (&ici)))
00962                             bResult = TRUE;
00963                     }
00964                 }
00965                 DestroyMenu (hMenu);
00966                 pContextMenu->Release ();
00967             }
00968         }
00969         pMalloc->Free (pidlMain);
00970     }
00971
00972     //
00973     // Clean up and return.
00974     //
00975     psfFolder->Release ();
00976     pMalloc->Release ();
00977
00978     return bResult;
00979 }
00980
00981 #endif // (_WIN32_IE >= 0x0400)
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJShellList.cpp Source File

WinCvs/CJLib/CJLibrary/CJShellList.cpp

Go to the documentation of this file.
00001 // CJShellList.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based upon the MFCENUM example. MFCENUM is a companion sample application
00006 // for Chapter 14 in "Programming the Windows 95 User Interface" by Nancy Cluts,
00007 // available in the Microsoft(R) Development Library.
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJock/CJLibrary/CJShellList.cpp $
00015  *
00016  * $History: CJShellList.cpp $
00017  *
00018  * *****************  Version 14  *****************
00019  * User: Kirk Stowell Date: 10/30/99   Time: 7:13p
00020  * Updated in $/CodeJock/CJLibrary
00021  * Fixed bug where the list has been sorted, then the directory changes
00022  * and the sorting is lost.
00023  *
00024  * *****************  Version 13  *****************
00025  * User: Kirk Stowell Date: 10/25/99   Time: 10:52p
00026  * Updated in $/CodeJock/CJLibrary
00027  * Modified resource include for static builds.
00028  *
00029  * *****************  Version 12  *****************
00030  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00031  * Updated in $/CodeJock/CJLibrary
00032  * Fixed potential resource and memory leak problems.
00033  *
00034  * *****************  Version 11  *****************
00035  * User: Kirk Stowell Date: 10/14/99   Time: 10:38a
00036  * Updated in $/CodeJock/CJLibrary
00037  * Fixed memory leaks that were associated with PIDL and
00038  * FindFirstFile(...) operations. Removed hideous "goto" statements in
00039  * code. Fixed validation logic and replaced the calls to
00040  * DoTheMenuThing(...) with DoExplorerMenu(...).
00041  *
00042  * *****************  Version 10  *****************
00043  * User: Kirk Stowell Date: 9/13/99    Time: 5:52a
00044  * Updated in $/CodeJockey/CJLibrary
00045  * Fixed build errors which occured with UNICODE builds.
00046  *
00047  * *****************  Version 9  *****************
00048  * User: Kirk Stowell Date: 8/31/99    Time: 4:39a
00049  * Updated in $/CodeJockey/CJLibrary
00050  * Updated copyright and contact information.
00051  *
00052  * *****************  Version 8  *****************
00053  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00054  * Updated in $/CodeJockey/CJLibrary
00055  *
00056  * *****************  Version 7  *****************
00057  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00058  * Updated in $/CodeJockey/CJLibrary
00059  *
00060  * *****************  Version 6  *****************
00061  * User: Kirk Stowell Date: 6/12/99    Time: 3:00a
00062  * Updated in $/CodeJockey/CJ60Lib
00063  * Cleaned up image list, view initialization and sorting to use base
00064  * class virtual function SortList(...).
00065  *
00066  * *****************  Version 5  *****************
00067  * User: Kirk Stowell Date: 5/12/99    Time: 5:32a
00068  * Updated in $/CodeJockey/CJ60Lib
00069  * Added support for vc5 compatibility
00070  *
00071  * *****************  Version 4  *****************
00072  * User: Kirk Stowell Date: 5/12/99    Time: 1:41a
00073  * Updated in $/CodeJockey/CJ60Lib
00074  * Added wait cursor for lengthly processing.
00075  *
00076  * *****************  Version 3  *****************
00077  * User: Kirk Stowell Date: 5/02/99    Time: 3:38p
00078  * Updated in $/CodeJockey/CJ60Lib
00079  * Added version macro  _WIN32_IE, you will need to have at IE4 or greater
00080  * installed to use this class. This will ensure that the version of
00081  * SHELL32.DLL is compatible.
00082  *
00083  * *****************  Version 2  *****************
00084  * User: Kirk Stowell Date: 5/02/99    Time: 2:05a
00085  * Updated in $/CodeJockey/CJ60Lib
00086  * Added flag m_bBuildingList, set to true whenever the list is refreshed
00087  * or initialized.
00088  *
00089  * *****************  Version 1  *****************
00090  * User: Kirk Stowell Date: 3/19/99    Time: 11:03p
00091  * Created in $/CodeJockey/CJ60Lib
00092  * Initial release.
00093  *
00094  ***************************************************************************/
00096
00097 #include "stdafx.h"
00098 #include "CJResource.h"
00099 #include "CJShellTree.h"
00100 #include "CJShellList.h"
00101 #include "CJSortClass.h"
00102
00103 #ifdef _DEBUG
00104 #define new DEBUG_NEW
00105 #undef THIS_FILE
00106 static char THIS_FILE[] = __FILE__;
00107 #endif
00108
00109 #if _WIN32_IE >= 0x0400 // Need to have at IE4 or greater installed.
00110
00112 // CCJShellList
00113
00114 CCJShellList::CCJShellList()
00115 {
00116     m_pTreeCtrl         = NULL;
00117     m_bBuildingList     = FALSE;
00118     m_bShowHidden       = FALSE;
00119 }
00120
00121 CCJShellList::~CCJShellList()
00122 {
00123
00124 }
00125
00126 IMPLEMENT_DYNAMIC(CCJShellList, CCJListCtrl)
00127
00128 BEGIN_MESSAGE_MAP(CCJShellList, CCJListCtrl)
00129     //{{AFX_MSG_MAP(CCJShellList)
00130     ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
00131     ON_NOTIFY_REFLECT(LVN_DELETEITEM, OnDeleteitem)
00132     ON_NOTIFY_REFLECT(LVN_GETDISPINFO, OnGetdispinfo)
00133     ON_NOTIFY_REFLECT(NM_DBLCLK, OnRclick)
00134     //}}AFX_MSG_MAP
00135     ON_MESSAGE(WM_SHELL_NOTIFY, OnShellNotify)
00136 END_MESSAGE_MAP()
00137
00139 // CCJShellList message handlers
00140
00141 static DATA_TYPE m_arrColType[] =
00142 {
00143     DT_STRING,      // col 0 sort type string
00144     DT_INT,         // col 1 sort type int
00145     DT_STRING,      // col 2 sort type string
00146     DT_DATETIME     // col 3 sort type date / time
00147 };
00148
00149 bool CCJShellList::SortList( int nCol, bool bAscending )
00150 {
00151     CCJSortClass csc( this, nCol );
00152     csc.Sort( bAscending, m_arrColType[nCol] );
00153     return true;
00154 }
00155
00156 void CCJShellList::OnRclick(NMHDR* pNMHDR, LRESULT* pResult)
00157 {
00158     NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
00159     POINT pt;
00160     LV_HITTESTINFO lvhti;
00161     LV_ITEM        lvi;
00162     LPLVITEMDATA   lplvid;  //Long pointer to ListView item data
00163
00164     ::GetCursorPos((LPPOINT)&pt);
00165     ::ScreenToClient(GetSafeHwnd(), &pt);
00166     lvhti.pt=pt;
00167     HitTest(&lvhti);
00168     if (lvhti.flags & LVHT_ONITEM)
00169     {
00170         ::ClientToScreen(GetSafeHwnd(), &pt);
00171         lvi.mask = LVIF_PARAM;
00172         lvi.iItem = lvhti.iItem;
00173         lvi.iSubItem = 0;
00174
00175         if (!GetItem(&lvi))
00176             return;
00177
00178         lplvid=(LPLVITEMDATA)lvi.lParam;
00179
00180         switch (pNMListView->hdr.code)
00181         {
00182         case NM_RCLICK:
00183             {
00184                 CString strFolderPath;
00185                 m_pTreeCtrl->GetSelectedFolderPath(strFolderPath);
00186                 m_shell.DoExplorerMenu(GetSafeHwnd(), strFolderPath, pt);
00187                 break;
00188             }
00189         case NM_DBLCLK:
00190             {
00191                 CString strFolderPath;
00192                 m_pTreeCtrl->GetSelectedFolderPath(strFolderPath);
00193
00194                 if (strFolderPath.GetAt(strFolderPath.GetLength()-1) != '\\')
00195                     strFolderPath += "\\";
00196
00197                 strFolderPath += GetItemText(pNMListView->iItem, 0);
00198
00199                 if ((lplvid->ulAttribs & SFGAO_FOLDER) == SFGAO_FOLDER) {
00200                     m_pTreeCtrl->TunnelTree(strFolderPath);
00201                 }
00202                 else {
00203                     m_shell.ShellExec(strFolderPath, SW_SHOW);
00204                 }
00205             }
00206             break;
00207         }
00208     }
00209
00210     *pResult = 0;
00211 }
00212
00213 void CCJShellList::OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult)
00214 {
00215     NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
00216     HRESULT        hr;
00217     LPMALLOC       lpMalloc;
00218     LPLVITEMDATA   lplvid = (LPLVITEMDATA)pNMListView->lParam;
00219
00220     if (lplvid)
00221     {
00222         //Let's free the memory for the ListView item data...
00223         hr=SHGetMalloc(&lpMalloc);
00224         if (FAILED(hr)) {
00225             return;
00226         }
00227
00228         lplvid->lpsfParent->Release();
00229         lpMalloc->Free(lplvid->lpi);
00230         lpMalloc->Free(lplvid);
00231         lpMalloc->Release();
00232     }
00233
00234     *pResult = 0;
00235 }
00236
00237 void CCJShellList::OnGetdispinfo(NMHDR* pNMHDR, LRESULT* pResult)
00238 {
00239     LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
00240     LPLVITEMDATA   lplvid;  //Long pointer to ListView item data
00241     LPTVITEMDATA   lptvid;  //Long pointer to TreeView item data
00242
00243     lplvid = (LPLVITEMDATA)pDispInfo->item.lParam;
00244
00245     if ((pDispInfo) &&(pDispInfo->item.mask & LVIF_IMAGE))
00246     {
00247         ASSERT(m_pTreeCtrl); // Must have a buddy window.
00248
00249         TV_ITEM tvi;
00250         HTREEITEM hti;
00251
00252         hti = m_pTreeCtrl->GetSelectedItem();
00253         tvi.mask = TVIF_PARAM;
00254         tvi.hItem = hti;
00255
00256         m_pTreeCtrl->GetItem(&tvi);
00257
00258         lptvid=(LPTVITEMDATA)tvi.lParam;
00259
00260         pDispInfo->item.iImage = m_shell.GetIcon(m_shell.ConcatPidls(lptvid->lpifq, lplvid->lpi),
00261             SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
00262
00263         if (lplvid->ulAttribs & SFGAO_LINK)
00264         {
00265             pDispInfo->item.mask |= LVIF_STATE;
00266             pDispInfo->item.stateMask = LVIS_OVERLAYMASK;
00267             pDispInfo->item.state = INDEXTOOVERLAYMASK(2);
00268         }
00269         if (pDispInfo->item.mask & LVIF_TEXT)
00270             m_shell.GetName(lplvid->lpsfParent, lplvid->lpi, SHGDN_NORMAL, pDispInfo->item.pszText);
00271     }
00272
00273     *pResult = 0;
00274 }
00275
00276 BOOL CCJShellList::InitSystemImageLists()
00277 {
00278     SHFILEINFO sfi;
00279
00280     HIMAGELIST himlSmall = (HIMAGELIST)::SHGetFileInfo( _T("C:\\"), 0, &sfi,
00281         sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON );
00282
00283     HIMAGELIST himlLarge = (HIMAGELIST)::SHGetFileInfo( _T("C:\\"), 0, &sfi,
00284         sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_LARGEICON );
00285
00286     if( himlSmall && himlLarge ) {
00287         SetImageList( CImageList::FromHandle( himlSmall ), LVSIL_SMALL  );
00288         SetImageList( CImageList::FromHandle( himlLarge ), LVSIL_NORMAL );
00289         return TRUE;
00290     }
00291
00292     return FALSE;
00293 }
00294
00295 BOOL CCJShellList::PopulateListView(LPTVITEMDATA lptvid, LPSHELLFOLDER lpsf)
00296 {
00297     m_bBuildingList = TRUE;
00298     CWaitCursor wait;   // display wait cursor
00299     SetRedraw(FALSE);
00300
00301     // If no image list is defined yet...
00302     if( GetImageList( LVSIL_NORMAL ) == NULL ) {
00303         if( !InitSystemImageLists( )) {
00304             return FALSE;
00305         }
00306     }
00307
00308     // Clear the list control.
00309     DeleteAllItems();
00310
00311     // Initialize the list control.
00312     if ( !InitListViewItems( lptvid, lpsf )) {
00313         m_bBuildingList = FALSE;
00314         return FALSE;
00315     }
00316
00317     // if the list has been previously sorted, sort the
00318     // new contents based upon last sort.
00319     if( m_nSortedCol != -1 ) {
00320         SortList( m_nSortedCol, m_bAscending );
00321     }
00322
00323     m_bBuildingList = FALSE;
00324     SetRedraw();
00325     return TRUE;
00326 }
00327
00328 BOOL CCJShellList::InitListViewItems(LPTVITEMDATA lptvid, LPSHELLFOLDER lpsf)
00329 {
00330     int          iCtr;
00331     HRESULT      hr;
00332     LPMALLOC     lpMalloc;
00333     LPITEMIDLIST lpifqThisItem=NULL;
00334     LPITEMIDLIST lpi=NULL;
00335     LPENUMIDLIST lpe=NULL;
00336     LPLVITEMDATA lplvid;
00337     ULONG        ulFetched, ulAttrs;
00338     HWND         hwnd=::GetParent(GetSafeHwnd());
00339
00340     hr=SHGetMalloc(&lpMalloc);
00341     if (FAILED(hr))
00342        return FALSE;
00343
00344     if (SUCCEEDED(hr))
00345     {
00346         DWORD dwFlags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS;
00347         if( m_bShowHidden )
00348             dwFlags |= SHCONTF_INCLUDEHIDDEN;
00349         hr=lpsf->EnumObjects( hwnd, dwFlags, &lpe );
00350
00351         if (SUCCEEDED(hr))
00352         {
00353             iCtr = 0;
00354
00355             while (S_OK==lpe->Next(1, &lpi, &ulFetched))
00356             {
00357                 //OK, let's get some memory for our ITEMDATA struct
00358                 lplvid = (LPLVITEMDATA)lpMalloc->Alloc(sizeof(LVITEMDATA));
00359                 if (!lplvid)
00360                 {
00361                     if (lpe) {
00362                         lpe->Release();
00363                     }
00364                     if (lpi && lpMalloc) {
00365                         lpMalloc->Free(lpi);
00366                     }
00367                     if (lpifqThisItem && lpMalloc) {
00368                         lpMalloc->Free(lpifqThisItem);
00369                     }
00370                     if (lpMalloc) {
00371                         lpMalloc->Release();
00372                     }
00373                     return FALSE;
00374                 }
00375
00376                 //Note that since we are interested in the display attributes as well as
00377                 //the other attributes, we need to set ulAttrs to SFGAO_DISPLAYATTRMASK
00378                 //before calling GetAttributesOf();
00379
00380                 ulAttrs=SFGAO_DISPLAYATTRMASK;
00381
00382                 lpsf->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lpi, &ulAttrs);
00383                 lplvid->ulAttribs=ulAttrs;
00384
00385                 lpifqThisItem=m_shell.ConcatPidls(lptvid->lpifq, lpi);
00386
00387                 lplvid->lpsfParent=lpsf;
00388                 lpsf->AddRef();
00389
00390                 //Now, make a copy of the ITEMIDLIST
00391                 lplvid->lpi=m_shell.CopyITEMID(lpMalloc, lpi);
00392
00393                 TCHAR szBuff[256];
00394                 if( m_shell.GetName(lpsf, lpi, SHGDN_NORMAL, szBuff) == FALSE )
00395                 {
00396                     if (lpe) {
00397                         lpe->Release();
00398                     }
00399                     if (lpi && lpMalloc) {
00400                         lpMalloc->Free(lpi);
00401                     }
00402                     if (lpifqThisItem && lpMalloc) {
00403                         lpMalloc->Free(lpifqThisItem);
00404                     }
00405                     if(lplvid && lpMalloc) {
00406                         lplvid->lpsfParent->Release();
00407                         lpMalloc->Free(lplvid->lpi);
00408                         lpMalloc->Free(lplvid);
00409                     }
00410                     if (lpMalloc) {
00411                         lpMalloc->Release();
00412                     }
00413                     return FALSE;
00414                 }
00415
00416                 // Add the item to the listview
00417                 int nIndex = InsertListItem(szBuff);
00418                 if (nIndex != -1)
00419                     SetItemData(nIndex, (LPARAM)lplvid);
00420
00421                 lpMalloc->Free(lpifqThisItem);
00422                 lpMalloc->Free(lpi);  //Finally, free the pidl that the shell gave us...
00423
00424                 lpifqThisItem=0;
00425                 lpi=0;
00426             }
00427         }
00428     }
00429
00430     if (lpe) {
00431         lpe->Release();
00432     }
00433     if (lpMalloc) {
00434         lpMalloc->Release();
00435     }
00436
00437     return TRUE;
00438 }
00439
00440 int CALLBACK CCJShellList::ListViewCompareProc(LPARAM lparam1, LPARAM lparam2, LPARAM /*lparamSort*/)
00441 {
00442     LPLVITEMDATA lplvid1=(LPLVITEMDATA)lparam1;
00443     LPLVITEMDATA lplvid2=(LPLVITEMDATA)lparam2;
00444     HRESULT   hr;
00445
00446     hr = lplvid1->lpsfParent->CompareIDs(0,lplvid1->lpi,lplvid2->lpi);
00447
00448     if (FAILED(hr))
00449         return 0;
00450
00451     return (hr);
00452 }
00453
00454 void CCJShellList::RefreshList()
00455 {
00456     LPTVITEMDATA    lptvid;  //Long pointer to TreeView item data
00457     LPSHELLFOLDER   lpsf2=NULL;
00458     HTREEITEM       hItem = m_pTreeCtrl->GetSelectedItem();
00459     HRESULT         hr;
00460
00461     if( hItem != NULL )
00462     {
00463         lptvid=(LPTVITEMDATA)m_pTreeCtrl->GetItemData(hItem);
00464
00465         if (lptvid && lptvid->lpsfParent && lptvid->lpi)
00466         {
00467             hr=lptvid->lpsfParent->BindToObject(lptvid->lpi,
00468                 0,IID_IShellFolder,(LPVOID *)&lpsf2);
00469
00470             if (SUCCEEDED(hr))
00471             {
00472                 PopulateListView(lptvid,lpsf2);
00473             }
00474         }
00475     }
00476 }
00477
00478 long CCJShellList::OnShellNotify(WPARAM wParam, LPARAM /*lParam*/)
00479 {
00480     switch (wParam)
00481     {
00482     case NM_SH_SHELLMENU:
00483         RefreshList();
00484         break;
00485     }
00486
00487     return 0;
00488 }
00489
00490 int CCJShellList::InsertListItem(CString strFileName, BOOL bParse/*=TRUE*/)
00491 {
00492     WIN32_FIND_DATA FindData;
00493     memset (&FindData, 0, sizeof(WIN32_FIND_DATA));
00494
00495     CString strFolderPath;
00496
00497     if (bParse)
00498     {
00499         m_pTreeCtrl->GetSelectedFolderPath(strFolderPath);
00500
00501         if (strFolderPath.IsEmpty())
00502             return -1;
00503
00504         if (strFolderPath.GetAt(strFolderPath.GetLength()-1) != '\\')
00505             strFolderPath += "\\";
00506
00507         strFolderPath += strFileName;
00508     }
00509
00510     else
00511     {
00512         strFolderPath = strFileName;
00513     }
00514
00515     // First see if the original file exists.
00516     HANDLE hFind = FindFirstFile(strFolderPath, &FindData);
00517
00518     if ( hFind == INVALID_HANDLE_VALUE ) {
00519         strFolderPath += _T(".pif");
00520         hFind = FindFirstFile(strFolderPath, &FindData);
00521     }
00522
00523     if ( hFind != INVALID_HANDLE_VALUE )
00524     {
00525         // close the specified search handle, fixes memory leak.
00526         FindClose(hFind);
00527
00528         CString strBuff;
00529         strBuff.Format(_T("%d"), FindData.nFileSizeLow);
00530
00531         // Add the item to the listview
00532         int nIndex = InsertItem(GetItemCount(),
00533             m_shell.GetDisplayName(strFolderPath), m_shell.GetIconIndex(strFolderPath));
00534
00535         if (nIndex == -1)
00536             return -1;
00537
00538         if (strBuff.Compare(_T("0")))
00539         {
00540             SetItem(nIndex, 1, LVIF_TEXT | LVIF_STATE, m_shell.GetFileSizeString(strBuff),
00541                 0, INDEXTOSTATEIMAGEMASK(1), LVIS_STATEIMAGEMASK, NULL);
00542         }
00543
00544         strBuff = m_shell.GetFileType(strFolderPath);
00545
00546         SetItem(nIndex, 2, LVIF_TEXT | LVIF_STATE, strBuff,
00547             0, INDEXTOSTATEIMAGEMASK(1), LVIS_STATEIMAGEMASK, NULL);
00548         CTime time( FindData.ftLastWriteTime );
00549         strBuff = m_shell.GetLastWriteTime( &time );
00550
00551         SetItem(nIndex, 3, LVIF_TEXT | LVIF_STATE, strBuff,
00552             0, INDEXTOSTATEIMAGEMASK(1), LVIS_STATEIMAGEMASK, NULL);
00553
00554         return nIndex;
00555     }
00556
00557     return -1;
00558 }
00559
00560 void CCJShellList::BuildDefaultColumns()
00561 {
00562     // build the columns used with this control.
00563     int nCols = 4;
00564     int nWidth[] = { 150, 80, 80, 80 };
00565     int nColString[] = { IDS_NAME, IDS_SIZE, IDS_TYPE, IDS_MODIFIED };
00566
00567     BuildColumns(nCols, nWidth, nColString);
00568 }
00569
00570 #endif // (_WIN32_IE >= 0x0400)
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJShellTree.cpp Source File

WinCvs/CJLib/CJLibrary/CJShellTree.cpp

Go to the documentation of this file.
00001 // CJShellTree.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based upon the MFCENUM example. MFCENUM is a companion sample application
00006 // for Chapter 14 in "Programming the Windows 95 User Interface" by Nancy Cluts,
00007 // available in the Microsoft(R) Development Library.
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 2000/03/01 21:24:34 $
00013  * $Revision: 1.2 $
00014  * $Archive: /CodeJock/CJLibrary/CJShellTree.cpp $
00015  *
00016  * $History: CJShellTree.cpp $
00017  *
00018  * *****************  Version 11  *****************
00019  * User: Kirk Stowell Date: 10/30/99   Time: 1:59p
00020  * Updated in $/CodeJock/CJLibrary
00021  * Changed base class from CTreeCtrl to CCJTreeCtrl for flicker free
00022  * drawing.
00023  *
00024  * *****************  Version 10  *****************
00025  * User: Kirk Stowell Date: 9/13/99    Time: 5:52a
00026  * Updated in $/CodeJockey/CJLibrary
00027  * Fixed build errors which occured with UNICODE builds.
00028  *
00029  * *****************  Version 9  *****************
00030  * User: Kirk Stowell Date: 8/31/99    Time: 4:39a
00031  * Updated in $/CodeJockey/CJLibrary
00032  * Updated copyright and contact information.
00033  *
00034  * *****************  Version 8  *****************
00035  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00036  * Updated in $/CodeJockey/CJLibrary
00037  *
00038  * *****************  Version 7  *****************
00039  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00040  * Updated in $/CodeJockey/CJLibrary
00041  *
00042  * *****************  Version 6  *****************
00043  * User: Kirk Stowell Date: 6/11/99    Time: 10:14p
00044  * Updated in $/CodeJockey/CJ60Lib
00045  * Cleaned up system image list initialization.
00046  *
00047  * *****************  Version 5  *****************
00048  * User: Kirk Stowell Date: 5/12/99    Time: 5:32a
00049  * Updated in $/CodeJockey/CJ60Lib
00050  * Added support for vc5 compatibility
00051  *
00052  * *****************  Version 4  *****************
00053  * User: Kirk Stowell Date: 5/12/99    Time: 1:41a
00054  * Updated in $/CodeJockey/CJ60Lib
00055  * Added wait cursor for lengthly processing.
00056  *
00057  * *****************  Version 3  *****************
00058  * User: Kirk Stowell Date: 5/02/99    Time: 3:38p
00059  * Updated in $/CodeJockey/CJ60Lib
00060  * Added version macro  _WIN32_IE, you will need to have at IE4 or greater
00061  * installed to use this class. This will ensure that the version of
00062  * SHELL32.DLL is compatible.
00063  *
00064  * *****************  Version 2  *****************
00065  * User: Kirk Stowell Date: 3/19/99    Time: 11:05p
00066  * Updated in $/CodeJockey/CJ60Lib
00067  * Initial re-write and release.
00068  *
00069  * *****************  Version 1  *****************
00070  * User: Kirk Stowell Date: 2/24/99    Time: 11:05p
00071  * Created in $/CodeJockey/CJ60Lib
00072  * Overloaded PopulateTree(LPCTSTR lpszPath) in the class CCJShellTree to
00073  * fill the tree based upon path. Takehiko Mizoguti
00074  * [mizoguti@m2.sys.to.casio.co.jp]
00075  *
00076  ***************************************************************************/
00078
00079 #include "stdafx.h"
00080 #include "CJShellTree.h"
00081 #include "CJShellList.h"
00082 #include "CJShell.h"
00083 #include "CJFlatComboBox.h"
00084 #include <direct.h>
00085
00086 #ifdef _DEBUG
00087 #define new DEBUG_NEW
00088 #undef THIS_FILE
00089 static char THIS_FILE[] = __FILE__;
00090 #endif
00091
00092 #if _WIN32_IE >= 0x0400 // Need to have at IE4 or greater installed.
00093 #include <Shlwapi.h>
00094
00096 // CCJShellTree
00097
00098 CCJShellTree::CCJShellTree()
00099 {
00100     m_pListCtrl     = NULL;
00101     m_pComboBox     = NULL;
00102     m_bRefresh      = false;
00103     m_bOutaHere     = false;
00104     m_htiCurrent    = NULL;
00105 }
00106
00107 CCJShellTree::~CCJShellTree()
00108 {
00109 }
00110
00111 IMPLEMENT_DYNAMIC(CCJShellTree, CCJTreeCtrl)
00112
00113 BEGIN_MESSAGE_MAP(CCJShellTree, CCJTreeCtrl)
00114     //{{AFX_MSG_MAP(CCJShellTree)
00115     ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
00116     ON_NOTIFY_REFLECT(TVN_DELETEITEM, OnDeleteitem)
00117     ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
00118     ON_NOTIFY_REFLECT(TVN_ITEMEXPANDING, OnItemexpanding)
00119     ON_WM_DESTROY()
00120     ON_WM_CREATE()
00121     //}}AFX_MSG_MAP
00122 END_MESSAGE_MAP()
00123
00125 // CCJShellTree message handlers
00126
00127 void CCJShellTree::OnFill(bool bRefresh/*=false*/)
00128 {
00129     LPSHELLFOLDER lpsf=NULL;
00130     HRESULT hr;
00131     TV_SORTCB      tvscb;
00132
00133     m_bRefresh = bRefresh;
00134
00135     // Get a pointer to the desktop folder.
00136     hr=SHGetDesktopFolder(&lpsf);
00137
00138     if (SUCCEEDED(hr))
00139     {
00140         // Initialize the tree view to be empty.
00141         DeleteAllItems();
00142
00143         // Fill in the tree view from the root.
00144         FillTreeView(lpsf,
00145             NULL,
00146             TVI_ROOT);
00147         // Release the folder pointer.
00148         lpsf->Release();
00149     }
00150     tvscb.hParent     = TVI_ROOT;
00151     tvscb.lParam      = 0;
00152     tvscb.lpfnCompare = TreeViewCompareProc;
00153
00154     // Sort the items in the tree view
00155     SortChildrenCB(&tvscb/*, FALSE*/);
00156
00157     Expand(GetRootItem(), TVE_EXPAND);
00158 }
00159
00160 void CCJShellTree::FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST  lpifq, HTREEITEM hParent)
00161 {
00162     TV_ITEM         tvi;                          // TreeView Item.
00163     TV_INSERTSTRUCT tvins;                        // TreeView Insert Struct.
00164     HTREEITEM       hPrev = NULL;                 // Previous Item Added.
00165     LPENUMIDLIST    lpe=0;
00166     LPITEMIDLIST    lpi=0, lpifqThisItem=0;
00167     LPTVITEMDATA    lptvid=0;
00168     LPMALLOC        lpMalloc=0;
00169     ULONG           ulFetched;
00170     HRESULT         hr;
00171     TCHAR           szBuff[MAX_PATH];
00172     HWND            hwnd=GetParent()->GetSafeHwnd();
00173
00174     hr=SHGetMalloc(&lpMalloc);
00175     if (FAILED(hr))
00176        return;
00177
00178     // Hourglass on!
00179
00180     SetCapture();
00181     CWaitCursor wait;   // display wait cursor
00182
00183     if (SUCCEEDED(hr))
00184     {
00185         SetRedraw(FALSE);
00186
00187         hr=lpsf->EnumObjects(hwnd,
00188             SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &lpe);
00189
00190         if (SUCCEEDED(hr))
00191         {
00192             while (S_OK==lpe->Next(1, &lpi, &ulFetched))
00193             {
00194                 //Create a fully qualified path to the current item
00195                 //The SH* shell api's take a fully qualified path pidl,
00196                 //(see GetIcon above where I call SHGetFileInfo) whereas the
00197                 //interface methods take a relative path pidl.
00198
00199                 ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER;
00200
00201                 lpsf->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lpi, &ulAttrs);
00202
00203                 if (ulAttrs & (SFGAO_HASSUBFOLDER | SFGAO_FOLDER))
00204                 {
00205                    //We need this next if statement so that we don't add things like
00206                    //the MSN to our tree.  MSN is not a folder, but according to the
00207                    //shell is has subfolders....
00208
00209                    if (ulAttrs & SFGAO_FOLDER)
00210                    {
00211                       tvi.mask            = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE |
00212                                             TVIF_PARAM;
00213
00214                       if (ulAttrs & SFGAO_HASSUBFOLDER)
00215                       {
00216                          //This item has sub-folders, so let's put the + in the TreeView.
00217                          //The first time the user clicks on the item, we'll populate the
00218                          //sub-folders then.
00219
00220                          tvi.cChildren=1;
00221                          tvi.mask |= TVIF_CHILDREN;
00222                       }
00223
00224                       //OK, let's get some memory for our ITEMDATA struct
00225
00226                       lptvid = (LPTVITEMDATA)lpMalloc->Alloc(sizeof(TVITEMDATA));
00227                       if (!lptvid)
00228                          goto Done;
00229
00230                       //Now get the friendly name that we'll put in the treeview...
00231
00232                       if( m_shell.GetName(lpsf, lpi, SHGDN_NORMAL, szBuff) == FALSE ) {
00233                          goto Done;
00234                       }
00235
00236                       tvi.pszText    = szBuff;
00237                       tvi.cchTextMax = MAX_PATH;
00238
00239                       lpifqThisItem=m_shell.ConcatPidls(lpifq, lpi);
00240
00241                       //Now, make a copy of the ITEMIDLIST
00242
00243                       lptvid->lpi=m_shell.CopyITEMID(lpMalloc, lpi);
00244
00245                       m_shell.GetNormalAndSelectedIcons(lpifqThisItem, &tvi);
00246
00247                       lptvid->lpsfParent=lpsf;    //Store the parent folders SF
00248                       lpsf->AddRef();
00249
00250                       //So, you ask, what's the story here?  Why do we have 2
00251                       //functions that apparently do the same thing?  Well,
00252                       //ParseDisplayName() (used in GetFullyQualPidl) does not
00253                       //work well for non-file system objects such as the My
00254                       //Computer and Net Hood.  So, since we know that these
00255                       //guys will only show up when we are enumerating the root
00256                       //of the namespace (as identified by an hParent of TVI_ROOT),
00257                       //we special case this here.  You *could* use ConcatPidls()
00258                       //in ALL cases, but the GetFullyQualPidl() is shown for
00259                       //demonstration purposes, since it's the more intuative way.
00260
00261 //Commented out for now, since we need ConcatPidls for *any* non-file system object.
00262 //This includes things like Control Panel, et al.
00263
00264 //                      if (hParent==TVI_ROOT)
00265                          lptvid->lpifq=m_shell.ConcatPidls(lpifq, lpi);
00266 //                      else
00267 //                         lptvid->lpifq=GetFullyQualPidl(lpsf, lpi);
00268
00269                       tvi.lParam = (LPARAM)lptvid;
00270
00271                       // Populate the TreeVeiw Insert Struct
00272                       // The item is the one filled above.
00273                       // Insert it after the last item inserted at this level.
00274                       // And indicate this is a root entry.
00275
00276                       tvins.item         = tvi;
00277                       tvins.hInsertAfter = hPrev;
00278                       tvins.hParent      = hParent;
00279
00280                       // Add the item to the tree
00281
00282                       hPrev = InsertItem(&tvins);
00283                    }
00284
00285                    lpMalloc->Free(lpifqThisItem);
00286                    lpifqThisItem=0;
00287                 }
00288
00289                 lpMalloc->Free(lpi);  //Finally, free the pidl that the shell gave us...
00290                 lpi=0;
00291             }
00292         }
00293
00294     }
00295     else {
00296         SetRedraw();
00297         return;
00298     }
00299
00300 Done:
00301
00302     // Hourglass off!
00303
00304     ReleaseCapture();
00305
00306     if (lpe)  lpe->Release();
00307
00308     //The following 2 if statements will only be TRUE if we got here on an
00309     //error condition from the "goto" statement.  Otherwise, we free this memory
00310     //at the end of the while loop above.
00311     if (lpi && lpMalloc)           lpMalloc->Free(lpi);
00312     if (lpifqThisItem && lpMalloc) lpMalloc->Free(lpifqThisItem);
00313
00314     if (lpMalloc) lpMalloc->Release();
00315     SetRedraw();
00316 }
00317
00318 void CCJShellTree::OnRclick(NMHDR* /*pNMHDR*/, LRESULT* pResult)
00319 {
00320     *pResult = 0;
00321
00322     POINT           pt;
00323     LPTVITEMDATA    lptvid;  //Long pointer to TreeView item data
00324     static char     szBuff[MAX_PATH];
00325     TV_HITTESTINFO  tvhti;
00326     TV_ITEM         tvi;
00327
00328     ::GetCursorPos((LPPOINT)&pt);
00329     ::ScreenToClient(m_hWnd, &pt);
00330     tvhti.pt=pt;
00331     HitTest(&tvhti);
00332     SelectItem(tvhti.hItem);
00333     if (tvhti.flags & TVHT_ONITEMLABEL)
00334     {
00335         ::ClientToScreen(m_hWnd, &pt);
00336         tvi.mask=TVIF_PARAM;
00337         tvi.hItem=tvhti.hItem;
00338
00339         if (!GetItem(&tvi))
00340             return;
00341
00342         lptvid=(LPTVITEMDATA)tvi.lParam;
00343
00344         m_shell.DoTheMenuThing(::GetParent(m_hWnd),
00345             lptvid->lpsfParent, lptvid->lpi, &pt);
00346     }
00347 }
00348
00349 void CCJShellTree::OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult)
00350 {
00351     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00352     *pResult = 0;
00353
00354     HRESULT        hr;
00355     LPMALLOC       lpMalloc;
00356     LPTVITEMDATA   lptvid;  //Long pointer to TreeView item data
00357
00358     //Let's free the memory for the TreeView item data...
00359     hr=SHGetMalloc(&lpMalloc);
00360     if (FAILED(hr))
00361         return;
00362
00363     lptvid=(LPTVITEMDATA)pNMTreeView->itemOld.lParam;
00364     lptvid->lpsfParent->Release();
00365     lpMalloc->Free(lptvid->lpi);
00366     lpMalloc->Free(lptvid->lpifq);
00367     lpMalloc->Free(lptvid);
00368     lpMalloc->Release();
00369 }
00370
00371 void CCJShellTree::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
00372 {
00373     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00374     LPTVITEMDATA    lptvid;  //Long pointer to TreeView item data
00375     LPSHELLFOLDER   lpsf2=NULL;
00376     HRESULT         hr;
00377
00378     SetRedraw(FALSE);
00379     //Do this only if we are not exiting the application...
00380     if (!m_bOutaHere)
00381     {
00382         lptvid=(LPTVITEMDATA)pNMTreeView->itemNew.lParam;
00383         if (lptvid)
00384         {
00385             hr=lptvid->lpsfParent->BindToObject(lptvid->lpi,
00386                 0,IID_IShellFolder,(LPVOID *)&lpsf2);
00387
00388             if (SUCCEEDED(hr) && (m_bRefresh == false))
00389             {
00390                 // get the current directory.
00391                 CString strFolderPath;
00392                 GetSelectedFolderPath(strFolderPath);
00393
00394                 // get a handle to the currently selected item and set the
00395                 // working directory.
00396                 m_htiCurrent = pNMTreeView->itemNew.hItem;
00397                 SetCurrentDirectory( strFolderPath );
00398
00399                 if (m_pListCtrl->GetSafeHwnd())
00400                 {
00401                     m_pListCtrl->PopulateListView(lptvid,lpsf2);
00402                     lpsf2->Release();
00403                 }
00404                 if( m_pComboBox->GetSafeHwnd( ))
00405                 {
00406                     int nFound = m_pComboBox->FindString(-1, strFolderPath);
00407                     if (nFound == CB_ERR) {
00408                         m_pComboBox->SetCurSel( m_pComboBox->AddString( strFolderPath ));
00409                     }
00410                     else {
00411                         m_pComboBox->SetCurSel(nFound);
00412                     }
00413                 }
00414             }
00415         }
00416     }
00417
00418     SetRedraw();
00419     *pResult = 0;
00420 }
00421
00422 void CCJShellTree::OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult)
00423 {
00424     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00425     *pResult = 0;
00426
00427     LPTVITEMDATA   lptvid;  //Long pointer to TreeView item data
00428     HRESULT        hr;
00429     LPSHELLFOLDER  lpsf2=NULL;
00430     static char    szBuff[MAX_PATH];
00431     TV_SORTCB      tvscb;
00432
00433     if ((pNMTreeView->itemNew.state & TVIS_EXPANDEDONCE))
00434         return;
00435
00436     SetRedraw(FALSE);
00437     lptvid=(LPTVITEMDATA)pNMTreeView->itemNew.lParam;
00438     if (lptvid)
00439     {
00440         hr=lptvid->lpsfParent->BindToObject(lptvid->lpi,
00441             0, IID_IShellFolder,(LPVOID *)&lpsf2);
00442
00443         if (SUCCEEDED(hr))
00444         {
00445             FillTreeView(lpsf2,
00446                 lptvid->lpifq,
00447                 pNMTreeView->itemNew.hItem);
00448         }
00449
00450         tvscb.hParent     = pNMTreeView->itemNew.hItem;
00451         tvscb.lParam      = 0;
00452         tvscb.lpfnCompare = TreeViewCompareProc;
00453
00454         SortChildrenCB(&tvscb/*, FALSE*/);
00455     }
00456     SetRedraw();
00457 }
00458
00459 int CALLBACK CCJShellTree::TreeViewCompareProc(LPARAM lparam1, LPARAM lparam2, LPARAM /*lparamSort*/)
00460 {
00461     LPTVITEMDATA lptvid1=(LPTVITEMDATA)lparam1;
00462     LPTVITEMDATA lptvid2=(LPTVITEMDATA)lparam2;
00463     HRESULT   hr;
00464
00465     hr = lptvid1->lpsfParent->CompareIDs(0, lptvid1->lpi, lptvid2->lpi);
00466
00467     if (FAILED(hr))
00468        return 0;
00469
00470     return (short)SCODE_CODE(GetScode(hr));
00471 }
00472
00473 BOOL CCJShellTree::InitSystemImageLists()
00474 {
00475     SHFILEINFO sfi;
00476
00477     HIMAGELIST hImageList = (HIMAGELIST)::SHGetFileInfo( _T("C:\\"), 0, &sfi,
00478         sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON );
00479
00480     if( hImageList ) {
00481         SetImageList( CImageList::FromHandle( hImageList ), TVSIL_NORMAL  );
00482         return TRUE;
00483     }
00484
00485     return FALSE;
00486 }
00487
00488 void CCJShellTree::OnDestroy()
00489 {
00490     m_bOutaHere = false;
00491     CCJTreeCtrl::OnDestroy();
00492 }
00493
00494 void CCJShellTree::TunnelTree(CString strFindPath)
00495 {
00496     HTREEITEM subNode = GetRootItem();
00497     CString szPathHop;
00498     char drive[_MAX_DRIVE];
00499     char dir[_MAX_DIR];
00500     char fname[_MAX_FNAME];
00501     char ext[_MAX_EXT];
00502     char delimiter[]="\\";
00503
00504     m_bRefresh = false;
00505
00506     if(!m_shell.Exist(strFindPath))
00507     {
00508         if (strFindPath.GetLength() == 3)
00509         {
00510         }
00511
00512         else
00513         {
00514             MessageBox(strFindPath,_T("Folder not found"),MB_ICONERROR);
00515             return;
00516         }
00517     }
00518
00519     if(strFindPath.ReverseFind(_T('\\')) != strFindPath.GetLength()-1)
00520     {
00521         strFindPath += _T("\\");
00522     }
00523
00524     m_shell.SplitPath(strFindPath,drive,dir,fname,ext);
00525
00526     //search the drive first
00527     szPathHop=drive;
00528     subNode=GetChildItem(subNode);
00529
00530     if(subNode)
00531     {
00532         if(SearchTree(subNode,szPathHop, CCJShellTree::type_drive))
00533         {
00534             SetRedraw(FALSE);
00535             //break down subfolders and search
00536             char *p=strtok(dir,delimiter);
00537             while(p)
00538             {
00539                 subNode = GetSelectedItem();
00540                 Expand(subNode, TVE_EXPAND);
00541                 subNode = GetChildItem(subNode);
00542
00543                 if(SearchTree(subNode,p,CCJShellTree::type_folder))
00544                     p=strtok(NULL,delimiter);
00545                 else
00546                     p=NULL;
00547             }
00548             SetRedraw();
00549         }
00550     }
00551 }
00552
00553 BOOL CCJShellTree::SearchTree(HTREEITEM treeNode, CString szSearchName, FindAttribs attr)
00554 {
00555     LPTVITEMDATA    lptvid;  //Long pointer to TreeView item data
00556     LPSHELLFOLDER   lpsf2=NULL;
00557     char    drive[_MAX_DRIVE];
00558     char    dir[_MAX_DIR];
00559     char    fname[_MAX_FNAME];
00560     char    ext[_MAX_EXT];
00561     BOOL    bRet=FALSE;
00562     HRESULT hr;
00563     CString strCompare;
00564
00565     szSearchName.MakeUpper();
00566     while(treeNode && bRet==FALSE)
00567     {
00568         lptvid=(LPTVITEMDATA)GetItemData(treeNode);
00569         if (lptvid && lptvid->lpsfParent && lptvid->lpi)
00570         {
00571             hr=lptvid->lpsfParent->BindToObject(lptvid->lpi,
00572                 0,IID_IShellFolder,(LPVOID *)&lpsf2);
00573             if (SUCCEEDED(hr))
00574             {
00575                 ULONG ulAttrs = SFGAO_FILESYSTEM;
00576                 lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs);
00577                 if (ulAttrs & (SFGAO_FILESYSTEM))
00578                 {
00579                     if(SHGetPathFromIDList(lptvid->lpifq,strCompare.GetBuffer(MAX_PATH)))
00580                     {
00581                         switch(attr)
00582                         {
00583                         case type_drive:
00584                             m_shell.SplitPath(strCompare,drive,dir,fname,ext);
00585                             strCompare=drive;
00586                             break;
00587                         case type_folder:
00588                             strCompare = GetItemText(treeNode);
00589                             break;
00590                         }
00591                         strCompare.MakeUpper();
00592                         if(strCompare == szSearchName)
00593                         {
00594                             EnsureVisible(treeNode);
00595                             SelectItem(treeNode);
00596                             bRet=TRUE;
00597                         }
00598                     }
00599                 }
00600                 lpsf2->Release();
00601             }
00602         }
00603         treeNode = GetNextSiblingItem(treeNode);
00604     }
00605     return bRet;
00606 }
00607
00608 BOOL CCJShellTree::GetSelectedFolderPath(CString &strFolderPath)
00609 {
00610     LPTVITEMDATA    lptvid;  //Long pointer to TreeView item data
00611     LPSHELLFOLDER   lpsf2=NULL;
00612     static TCHAR    szBuff[MAX_PATH];
00613     HTREEITEM       hItem = GetSelectedItem();
00614     HRESULT         hr;
00615     BOOL            bRet=FALSE;
00616
00617     if( hItem != NULL )
00618     {
00619         lptvid=(LPTVITEMDATA)GetItemData(hItem);
00620
00621         if (lptvid && lptvid->lpsfParent && lptvid->lpi)
00622         {
00623             hr=lptvid->lpsfParent->BindToObject(lptvid->lpi,
00624                 0,IID_IShellFolder,(LPVOID *)&lpsf2);
00625
00626             if (SUCCEEDED(hr))
00627             {
00628                 ULONG ulAttrs = SFGAO_FOLDER;
00629
00630                 // Determine what type of object we have.
00631                 lptvid->lpsfParent->GetAttributesOf(1,
00632                     (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs);
00633
00634                 if (ulAttrs & (SFGAO_FOLDER))
00635                 {
00636                     if(SHGetPathFromIDList(lptvid->lpifq,szBuff)){
00637                         strFolderPath = szBuff;
00638                         bRet = TRUE;
00639                     }
00640                 }
00641             }
00642
00643         }
00644         if(lpsf2)
00645             lpsf2->Release();
00646     }
00647
00648     return bRet;
00649 }
00650
00651 BOOL CCJShellTree::GetFolderItemPath(HTREEITEM hItem, CString &strFolderPath)
00652 {
00653     LPTVITEMDATA    lptvid;  //Long pointer to TreeView item data
00654     LPSHELLFOLDER   lpsf2=NULL;
00655     static TCHAR    szBuff[MAX_PATH];
00656     HRESULT         hr;
00657     BOOL            bRet=FALSE;
00658
00659     lptvid=(LPTVITEMDATA)GetItemData(hItem);
00660
00661     if (lptvid && lptvid->lpsfParent && lptvid->lpi)
00662     {
00663         hr=lptvid->lpsfParent->BindToObject(lptvid->lpi,
00664             0,IID_IShellFolder,(LPVOID *)&lpsf2);
00665
00666         if (SUCCEEDED(hr))
00667         {
00668             ULONG ulAttrs = SFGAO_FILESYSTEM;
00669
00670             // Determine what type of object we have.
00671             lptvid->lpsfParent->GetAttributesOf(1, (const struct _ITEMIDLIST **)&lptvid->lpi, &ulAttrs);
00672
00673             if (ulAttrs & (SFGAO_FILESYSTEM))
00674             {
00675                 if(SHGetPathFromIDList(lptvid->lpifq,szBuff)){
00676                     strFolderPath = szBuff;
00677                     bRet = TRUE;
00678                 }
00679             }
00680         }
00681
00682         if(lpsf2)
00683             lpsf2->Release();
00684     }
00685
00686     return bRet;
00687 }
00688
00689 void CCJShellTree::PopulateTree(LPCTSTR lpszPath)
00690 {
00691     LPSHELLFOLDER lpsf=NULL,lpsf2=NULL;
00692     LPITEMIDLIST  lpi=NULL;
00693     HRESULT hr;
00694     TV_SORTCB      tvscb;
00695     LPTSTR          lpFolder = (LPTSTR)lpszPath;
00696     LPTSTR          lpNextFolder;
00697     TCHAR           strPath[_MAX_PATH];
00698
00699     LPMALLOC pMalloc;
00700     if (::SHGetMalloc(&pMalloc) == NOERROR)
00701     {
00702
00703         // Get a pointer to the desktop folder.
00704         hr=SHGetDesktopFolder(&lpsf);
00705
00706         if (SUCCEEDED(hr))
00707         {
00708             USES_CONVERSION;
00709
00710             // Initialize the tree view to be empty.
00711             DeleteAllItems();
00712
00713             do{
00714
00715                 // Get the Next Component
00716                 lpNextFolder = PathFindNextComponent( lpFolder );
00717                 if( lpNextFolder && *lpNextFolder ){
00718                     memcpy( strPath, lpFolder, ( lpNextFolder - lpFolder ) );
00719                     strPath[lpNextFolder - lpFolder] = _T('\0');
00720                 }
00721                 else{
00722                     _tcscpy( strPath, lpFolder );
00723                     lpNextFolder = NULL;
00724                 }
00725
00726                 // Get ShellFolder Pidl
00727                 ULONG eaten;
00728                 hr = lpsf->ParseDisplayName( NULL, NULL, T2OLE(strPath), &eaten, &lpi, NULL );
00729                 if( FAILED( hr ) ){
00730                     break;
00731                 }
00732                 hr=lpsf->BindToObject(lpi, 0, IID_IShellFolder,(LPVOID *)&lpsf2);
00733                 if( FAILED( hr ) ){
00734                     break;
00735                 }
00736
00737                 pMalloc->Free( lpi );
00738
00739                 // Release the Parent Folder pointer.
00740                 lpsf->Release();
00741
00742                 // Chenge Folder Info
00743                 lpsf = lpsf2;
00744                 lpFolder = lpNextFolder;
00745             }
00746             while( lpNextFolder );
00747
00748             FillTreeView(lpsf,NULL,TVI_ROOT);
00749
00750         }
00751     }
00752     tvscb.hParent     = TVI_ROOT;
00753     tvscb.lParam      = 0;
00754     tvscb.lpfnCompare = TreeViewCompareProc;
00755
00756     // Sort the items in the tree view
00757     SortChildrenCB(&tvscb/*, FALSE*/);
00758
00759     HTREEITEM hItem;
00760     hItem = GetRootItem();
00761     Expand(hItem,TVE_EXPAND);
00762     Select(GetRootItem(),TVGN_CARET);
00763 }
00764
00765 int CCJShellTree::OnCreate(LPCREATESTRUCT lpCreateStruct)
00766 {
00767     if (CCJTreeCtrl::OnCreate(lpCreateStruct) == -1)
00768         return -1;
00769
00770     // Attach the system image list, and build the tree.
00771     InitSystemImageLists();
00772     OnFill();
00773
00774     return 0;
00775 }
00776
00777 BOOL CCJShellTree::PreCreateWindow(CREATESTRUCT& cs)
00778 {
00779     if( !CCJTreeCtrl::PreCreateWindow(cs))
00780         return FALSE;
00781
00782     cs.style |= TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS;
00783
00784     return TRUE;
00785 }
00786
00787 #endif // (_WIN32_IE >= 0x0400)
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJSizeDockBar.cpp Source File

WinCvs/CJLib/CJLibrary/CJSizeDockBar.cpp

Go to the documentation of this file.
00001 // CJSizeDockBar.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJSizeDockBar.cpp $
00011  *
00012  * $History: CJSizeDockBar.cpp $
00013  *
00014  * *****************  Version 12  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:14p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Minor update to tracker.
00018  *
00019  * *****************  Version 11  *****************
00020  * User: Kirk Stowell Date: 10/29/99   Time: 12:44a
00021  * Updated in $/CodeJock/CJLibrary
00022  * Added static member variable CCJSizeDockBar::m_bIsDockBar used for save
00023  * and restore bar state.
00024  *
00025  * *****************  Version 10  *****************
00026  * User: Kirk Stowell Date: 10/15/99   Time: 1:28a
00027  * Updated in $/CodeJock/CJLibrary
00028  * Fixed bug with just clicking on the sizing tracker and the control bar
00029  * resizing one pixel to the left or right. The bar will only be sized if
00030  * the cursor has changed its location.
00031  *
00032  * *****************  Version 9  *****************
00033  * User: Kirk Stowell Date: 9/16/99    Time: 2:35p
00034  * Updated in $/CodeJockey/CJLibrary
00035  * Fixed bug with save / restore bar state, and with saved bar size
00036  * changing whenever the application starts.
00037  *
00038  * *****************  Version 8  *****************
00039  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00040  * Updated in $/CodeJockey/CJLibrary
00041  * Updated copyright and contact information.
00042  *
00043  * *****************  Version 7  *****************
00044  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00045  * Updated in $/CodeJockey/CJLibrary
00046  *
00047  * *****************  Version 6  *****************
00048  * User: Kirk Stowell Date: 7/18/99    Time: 10:29p
00049  * Updated in $/CodeJockey/CJLibrary
00050  * Added vc5 compatibility.
00051  *
00052  * *****************  Version 5  *****************
00053  * User: Kirk Stowell Date: 6/09/99    Time: 8:33p
00054  * Updated in $/CodeJockey/CJ60Lib
00055  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00056  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00057  * message handler, this is now automatically handled by the base class.
00058  * Added redraw flags to the create method and modified paint and layout
00059  * handlers to reduce flicker and un-necessary command handling. Dragging
00060  * rect now reflects actual control bar docked size. Added "flat" look to
00061  * the control bars, the control bars can now use the classic DevStudio
00062  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00063  * docking windows now handle dragging, docking and floating much better,
00064  * and behave more like DevStudio.
00065  *
00066  * *****************  Version 4  *****************
00067  * User: Kirk Stowell Date: 4/14/99    Time: 11:07p
00068  * Updated in $/CodeJockey/CJ60Lib
00069  * Changed CFrameWnd *pFrame = (CFrameWnd*)AfxGetApp()->m_pMainWnd; to
00070  * CFrameWnd *pFrame = GetParentFrame(); see line 432.
00071  *
00072  * *****************  Version 3  *****************
00073  * User: Kirk Stowell Date: 4/03/99    Time: 11:06p
00074  * Updated in $/CodeJockey/CJ60Lib
00075  * Added comments and cleaned up code.
00076  *
00077  * *****************  Version 2  *****************
00078  * User: Kirk Stowell Date: 1/29/99    Time: 11:06p
00079  * Updated in $/CodeJockey/CJ60Lib
00080  * Made some cosmetic enhancements to more closely match DevStudio docking
00081  * windows.
00082  *
00083  * *****************  Version 1  *****************
00084  * User: Kirk Stowell Date: 1/12/99    Time: 11:06p
00085  * Created in $/CodeJockey/CJ60Lib
00086  * Initial release to add side-by-side docking support for CCJControlBar
00087  * class.
00088  *
00089  ***************************************************************************/
00091
00092 #include "stdafx.h"
00093 #include "CJSizeDockBar.h"
00094 #include "CJControlBar.h"
00095 #include "CJToolBar.h"
00096 #include "CJResource.h"
00097
00098 #ifdef _DEBUG
00099 #define new DEBUG_NEW
00100 #undef THIS_FILE
00101 static char THIS_FILE[] = __FILE__;
00102 #endif
00103
00104 #define TRACK_BORDER_SIZE       4
00105
00106 bool CCJSizeDockBar::m_bIsDockBar = false;
00107
00109 // CCJSizeDockBar
00110
00111 CCJSizeDockBar::CCJSizeDockBar()
00112 {
00113     m_cxLeftBorder      = 0;
00114     m_cyTopBorder       = 0;
00115     m_cxRightBorder     = 0;
00116     m_cyBottomBorder    = 0;
00117     m_iActualSize       = 100;
00118     m_iSafeSpace        = 25;
00119     m_bOkToDrag         = FALSE;
00120     m_bDragging         = FALSE;
00121     m_bAutoDelete       = TRUE;
00122     m_bFlatBorder       = TRUE;     //Yiannhs v6.06 for Docking bar flat border
00123     m_ptCurrent         = CPoint(0,0);
00124 }
00125
00126 CCJSizeDockBar::~CCJSizeDockBar()
00127 {
00128     // TODO: add destruction code here.
00129 }
00130
00131 IMPLEMENT_DYNAMIC(CCJSizeDockBar, CDockBar)
00132
00133 BEGIN_MESSAGE_MAP(CCJSizeDockBar, CDockBar)
00134     //{{AFX_MSG_MAP(CCJSizeDockBar)
00135     ON_WM_NCPAINT()
00136     ON_WM_NCCALCSIZE()
00137     ON_WM_SETCURSOR()
00138     ON_WM_NCHITTEST()
00139     ON_WM_NCLBUTTONDOWN()
00140     ON_WM_LBUTTONUP()
00141     ON_WM_MOUSEMOVE()
00142     //}}AFX_MSG_MAP
00143 END_MESSAGE_MAP()
00144
00146 // CCJSizeDockBar overrides
00147
00148 CSize CCJSizeDockBar::CalcDynamicLayout(int /*nLength*/, DWORD nMode)
00149 {
00150     int ActualSize = 0;
00151     for(int i=0;i<= m_arrBars.GetUpperBound();++i)
00152     {
00153         CCJControlBar *pBar = (CCJControlBar *)GetDockedControlBar(i);
00154         if (pBar != NULL && pBar->IsVisible())
00155         {
00156             ActualSize = m_iActualSize;
00157             break;
00158         }
00159     }
00160
00161     int cx=0,cy=0;
00162     if (nMode & LM_VERTDOCK) {
00163         cx = ActualSize ;
00164         cy = 32767;
00165     }
00166
00167     if (nMode & LM_HORZDOCK) {
00168         cx= 32767;
00169         cy = ActualSize;
00170     }
00171
00172     //Yiannhs. Use selective layout. Since the dock bar does not calculate the bar sizes yet
00173     if( !m_bLayoutQuery )
00174         CalcSizeBarLayout();
00175
00176     return CSize(cx,cy);
00177 }
00178
00179 void CCJSizeDockBar::DoPaint(CDC *pDC)
00180 {
00181     CDockBar::DoPaint(pDC);
00182 }
00183
00184 void CCJSizeDockBar::OnInvertTracker(const CRect& rect)
00185 {
00186     ASSERT_VALID(this);
00187     ASSERT(!rect.IsRectEmpty());
00188
00189     CDC* pDC = GetDockingFrame()->GetDC();
00190     CBrush* pBrush = CDC::GetHalftoneBrush();
00191     CBrush* pOldBrush = NULL;
00192
00193     if (pBrush != NULL) {
00194         pOldBrush = pDC->SelectObject(pBrush);
00195     }
00196
00197     pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATINVERT);
00198
00199     if (pOldBrush != NULL) {
00200         pDC->SelectObject(pOldBrush);
00201     }
00202     GetDockingFrame()->ReleaseDC(pDC);
00203 }
00204
00205 void CCJSizeDockBar::HitTest(const CPoint & point)
00206 {
00207     UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00208     CRect rcWin;
00209     GetWindowRect(&rcWin);
00210     HCURSOR hCur = NULL;
00211
00212     //Yiannhs: Check the if statements, and change of variable TRackBorder size
00213     if (nID == AFX_IDW_SIZEBAR_LEFT || nID == AFX_IDW_SIZEBAR_RIGHT ) {
00214         //we are sure the DOCK bar is vertical
00215         if( nID == AFX_IDW_SIZEBAR_LEFT )
00216             rcWin.left = rcWin.right - TRACK_BORDER_SIZE;
00217         else
00218             rcWin.right = rcWin.left + TRACK_BORDER_SIZE;
00219
00220         if( rcWin.PtInRect(point) )
00221             hCur = AfxGetApp()->LoadCursor(IDC_HSPLITBAR);
00222
00223     } else {
00224         //The DOCK bar is horizontal
00225         if (nID == AFX_IDW_SIZEBAR_TOP)
00226             rcWin.top = rcWin.bottom - TRACK_BORDER_SIZE;
00227         else
00228             rcWin.bottom = rcWin.top + TRACK_BORDER_SIZE;
00229
00230         if( rcWin.PtInRect(point) )
00231             hCur = AfxGetApp()->LoadCursor(IDC_VSPLITBAR);
00232     }
00233
00234     if( hCur )
00235         SetCursor(hCur);
00236
00237     m_bOkToDrag = BOOL((long)hCur);
00238 }
00239
00241 // CCJSizeDockBar message handlers
00242
00243 void CCJSizeDockBar::OnNcPaint()
00244 {
00245     EraseNonClient();
00246 }
00247
00248 void CCJSizeDockBar::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp)
00249 {
00250     UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00251     //Yiannhs changed the tracksize variable
00252     if (nID == AFX_IDW_SIZEBAR_LEFT) {
00253         m_cyBottomBorder += TRACK_BORDER_SIZE;
00254         CDockBar::OnNcCalcSize(bCalcValidRects, lpncsp);
00255         m_cyBottomBorder -= TRACK_BORDER_SIZE;
00256     }
00257
00258     else if (nID == AFX_IDW_SIZEBAR_TOP) {
00259         m_cyBottomBorder += TRACK_BORDER_SIZE;
00260         CDockBar::OnNcCalcSize(bCalcValidRects, lpncsp);
00261         m_cyBottomBorder -= TRACK_BORDER_SIZE;
00262     }
00263
00264     else if (nID == AFX_IDW_SIZEBAR_RIGHT) {
00265         m_cyTopBorder += TRACK_BORDER_SIZE;
00266         CDockBar::OnNcCalcSize(bCalcValidRects, lpncsp);
00267         m_cyTopBorder -= TRACK_BORDER_SIZE;
00268     }
00269
00270     else if (nID == AFX_IDW_SIZEBAR_BOTTOM) {
00271         m_cyTopBorder += TRACK_BORDER_SIZE;
00272         CDockBar::OnNcCalcSize(bCalcValidRects, lpncsp);
00273         m_cyTopBorder -= TRACK_BORDER_SIZE;
00274     }
00275 }
00276
00277 BOOL CCJSizeDockBar::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
00278 {
00279     return (nHitTest == HTCLIENT)?
00280         CDockBar::OnSetCursor(pWnd, nHitTest, message):FALSE;
00281 }
00282
00283 UINT CCJSizeDockBar::OnNcHitTest(CPoint point)
00284 {
00285     HitTest(point);
00286     return (m_bOkToDrag)?HTBORDER:CDockBar::OnNcHitTest(point);
00287 }
00288
00289 void CCJSizeDockBar::OnNcLButtonDown(UINT nHitTest, CPoint point)
00290 {
00291     // save the current cursor postion.
00292     m_ptCurrent = point;
00293     ScreenToClient(&m_ptCurrent);
00294
00295     if( m_bOkToDrag )
00296     {
00297         UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00298         CFrameWnd *pFrame=GetDockingFrame();
00299         GetWindowRect(m_rcTrack);
00300
00301         //Yiannhs changed tracsize variable
00302         if (nID == AFX_IDW_SIZEBAR_LEFT)
00303             m_rcTrack.left = m_rcTrack.right - TRACK_BORDER_SIZE;
00304
00305         else if (nID == AFX_IDW_SIZEBAR_TOP)
00306             m_rcTrack.top = m_rcTrack.bottom - TRACK_BORDER_SIZE;
00307
00308         else if (nID == AFX_IDW_SIZEBAR_RIGHT)
00309             m_rcTrack.right = m_rcTrack.left + TRACK_BORDER_SIZE;
00310
00311         else if (nID == AFX_IDW_SIZEBAR_BOTTOM)
00312             m_rcTrack.bottom = m_rcTrack.top + TRACK_BORDER_SIZE;
00313
00314         pFrame->ScreenToClient(&m_rcTrack);
00315         pFrame->ScreenToClient(&point);
00316
00317         m_ptStartDrag = point;
00318         m_ptCurDrag = point;
00319
00320         SetCapture();
00321         m_bDragging = TRUE;
00322         OnInvertTracker(m_rcTrack);
00323
00324     } else {
00325         //Yiannhs
00326         CDockBar::OnNcLButtonDown(nHitTest, point);
00327     }
00328 }
00329
00330 void CCJSizeDockBar::OnLButtonUp(UINT nFlags, CPoint point)
00331 {
00332     if( m_ptCurrent == point ) {
00333         ReleaseCapture();
00334         m_bDragging = FALSE;
00335         OnInvertTracker(m_rcTrack);
00336         CDockBar::OnLButtonUp(nFlags, point);
00337     }
00338
00339     else if( m_bDragging )
00340     {
00341         CRect rectWin;
00342         CRect rectAvail;
00343         GetWindowRect(&rectWin);
00344         ReleaseCapture();
00345         m_bDragging = FALSE;
00346         OnInvertTracker(m_rcTrack);
00347         GetAvailableRect(rectAvail);
00348         UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00349
00350         if (nID == AFX_IDW_SIZEBAR_LEFT ) {
00351             int maxWidth = rectAvail.Width()-m_iSafeSpace;
00352             int newWidth = m_rcTrack.left-m_ptStartDrag.x;
00353             m_iActualSize = newWidth>maxWidth ? maxWidth: newWidth;
00354             m_iActualSize += rectWin.Width();
00355         }
00356
00357         else if (nID == AFX_IDW_SIZEBAR_TOP) {
00358             int maxHeight = rectAvail.Height()-m_iSafeSpace;
00359             int newHeight = m_rcTrack.top-m_ptStartDrag.y;
00360             m_iActualSize = newHeight>maxHeight ? maxHeight : newHeight;
00361             m_iActualSize += rectWin.Height();
00362         }
00363
00364         else if (nID == AFX_IDW_SIZEBAR_RIGHT) {
00365             int maxWidth = rectAvail.Width()-m_iSafeSpace;
00366             int newWidth = m_ptStartDrag.x-m_rcTrack.left;
00367             m_iActualSize = newWidth>maxWidth ? maxWidth: newWidth;
00368             m_iActualSize += rectWin.Width();
00369         }
00370
00371         else if (nID == AFX_IDW_SIZEBAR_BOTTOM) {
00372             int maxHeight = rectAvail.Height()-m_iSafeSpace;
00373             int newHeight = m_ptStartDrag.y-m_rcTrack.top;
00374             m_iActualSize = newHeight>maxHeight ? maxHeight : newHeight;
00375             m_iActualSize += rectWin.Height();
00376         }
00377
00378         if(m_iActualSize< TRACK_BORDER_SIZE )
00379             m_iActualSize = TRACK_BORDER_SIZE;
00380
00381         GetDockingFrame()->RecalcLayout();
00382         RecalcAllExcept(NULL);
00383
00384     } else {
00385         //Yiannhs
00386         CDockBar::OnLButtonUp(nFlags, point);
00387     }
00388 }
00389
00390 void CCJSizeDockBar::OnMouseMove(UINT nFlags, CPoint point)
00391 {
00392     if( m_bDragging )
00393     {
00394         CRect rectWin;
00395         GetWindowRect(&rectWin);
00396         CRect rectAvail;
00397         GetAvailableRect(rectAvail);
00398         CFrameWnd *pFrame=GetDockingFrame();
00399         ClientToScreen(&point);
00400         pFrame->ScreenToClient(&point);
00401         UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00402
00403         if (nID == AFX_IDW_SIZEBAR_LEFT) {
00404             point.x = point.x > rectAvail.right ? rectAvail.right : point.x;
00405             point.x = point.x < TRACK_BORDER_SIZE ? TRACK_BORDER_SIZE : point.x;
00406         }
00407
00408         else if (nID == AFX_IDW_SIZEBAR_TOP) {
00409             point.y = point.y > rectAvail.bottom ? rectAvail.bottom : point.y;
00410             point.y = point.y < TRACK_BORDER_SIZE ? TRACK_BORDER_SIZE : point.y;
00411         }
00412
00413         else if (nID == AFX_IDW_SIZEBAR_RIGHT) {
00414             point.x = point.x < rectAvail.left ? rectAvail.left:point.x;
00415             point.x = point.x > rectAvail.right + m_iActualSize - TRACK_BORDER_SIZE ?
00416                                 rectAvail.right - TRACK_BORDER_SIZE + m_iActualSize : point.x;
00417         }
00418
00419         else if (nID == AFX_IDW_SIZEBAR_BOTTOM) {
00420             point.y = point.y < rectAvail.top ? rectAvail.top : point.y;
00421             point.y = point.y > rectAvail.bottom + m_iActualSize - TRACK_BORDER_SIZE ?
00422                                 rectAvail.bottom - TRACK_BORDER_SIZE + m_iActualSize : point.y;
00423         }
00424
00425         int deltaX = point.x - m_ptCurDrag.x;
00426         int deltaY = point.y - m_ptCurDrag.y;
00427
00428         m_ptCurDrag = point;
00429
00430         if (nID == AFX_IDW_SIZEBAR_LEFT || nID == AFX_IDW_SIZEBAR_RIGHT && deltaX)
00431         {
00432             OnInvertTracker(m_rcTrack);
00433             m_rcTrack.left+=deltaX;
00434             m_rcTrack.right+=deltaX;
00435             OnInvertTracker(m_rcTrack);
00436         }
00437
00438         else if( nID == AFX_IDW_SIZEBAR_TOP || nID == AFX_IDW_SIZEBAR_BOTTOM && deltaY)
00439         {
00440             OnInvertTracker(m_rcTrack);
00441             m_rcTrack.top+=deltaY;
00442             m_rcTrack.bottom+=deltaY;
00443             OnInvertTracker(m_rcTrack);
00444         }
00445
00446     } else {
00447         //Yiannhs
00448         CDockBar::OnMouseMove(nFlags, point);
00449     }
00450 }
00451
00453 // CCJControlBar operations
00454
00455 void CCJSizeDockBar::GetAvailableRect(CRect &rect)
00456 {
00457     GetDockingFrame()->GetClientRect(&rect);
00458     GetDockingFrame()->RepositionBars(0xffff, 0xffff, AFX_IDW_PANE_FIRST,reposQuery,
00459         &rect, &rect, TRUE);
00460 }
00461
00462 BOOL CCJSizeDockBar::IsLastControlBar(int index)
00463 {
00464     for( int i=index; i<m_arrBars.GetSize(); ++i)
00465     {
00466         CCJControlBar *pOther = (CCJControlBar *)GetDockedControlBar(i);
00467         if (pOther != NULL && pOther->IsVisible())
00468         {
00469             return FALSE;
00470         }
00471     }
00472
00473     return TRUE;
00474 }
00475
00476 CCJControlBar* CCJSizeDockBar::GetDockedSizeBar(int nPos)
00477 {
00478     return (CCJControlBar*)GetDockedControlBar(nPos);
00479 }
00480
00481 void CCJSizeDockBar::RecalcAllExcept(CCJSizeDockBar *pBar)
00482 {
00483     CFrameWnd *pFrame = GetParentFrame();
00484     ASSERT_VALID(pFrame);
00485
00486     for (int i = 0; i < 4; i++)
00487     {
00488         CCJSizeDockBar* pDock = (CCJSizeDockBar*)pFrame->GetControlBar(dwSizeBarMap[i][0]);
00489         if (pDock != NULL && pDock != pBar) {
00490             pDock->CalcSizeBarLayout();
00491         }
00492     }
00493 }
00494
00495 void CCJSizeDockBar::DrawBorders(CDC *pDC, CRect &rect)
00496 {
00497     int cxBorderLeft    = 0;
00498     int cxBorderRight   = 0;
00499     int cyBorderTop     = 0;
00500     int cyBorderBottom  = 0;
00501
00502     CRect rc;
00503     rc.CopyRect(&rect);
00504
00505     //Yiannhs: i've replaced color variables with the afxdata ones.
00506     if (m_dwStyle & CBRS_BORDER_TOP) {
00507         pDC->FillSolidRect(rc.left, rc.top, rc.Width(), 1, afxData.clrBtnShadow);
00508         pDC->FillSolidRect(rc.left, rc.top+1, rc.Width(), 1, afxData.clrBtnHilite);
00509         cyBorderTop+=2;
00510     }
00511
00512     if (m_dwStyle & CBRS_BORDER_BOTTOM) {
00513         pDC->FillSolidRect(rc.left, rc.bottom-1, rc.Width(), 1, afxData.clrBtnHilite);
00514         pDC->FillSolidRect(rc.left, rc.bottom-2, rc.Width(), 1, afxData.clrBtnShadow);
00515         cyBorderBottom+=2;
00516     }
00517
00518     if (m_dwStyle & CBRS_BORDER_LEFT) {
00519         pDC->FillSolidRect(rc.left, rc.top, 1, rc.Height(), afxData.clrBtnShadow);
00520         pDC->FillSolidRect(rc.left+1, rc.top, 1, rc.Height(), afxData.clrBtnHilite);
00521         cxBorderLeft+=2;
00522     }
00523
00524     if (m_dwStyle & CBRS_BORDER_RIGHT) {
00525         pDC->FillSolidRect(rc.right-2, rc.top, 1, rc.Height(), afxData.clrBtnShadow);
00526         pDC->FillSolidRect(rc.right-1, rc.top, 1, rc.Height(), afxData.clrBtnHilite);
00527         cxBorderRight+=2;
00528     }
00529
00530     UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00531
00532     CRect rcTrack;
00533     rcTrack.CopyRect(&rc);
00534
00535     if (nID == AFX_IDW_SIZEBAR_LEFT) {
00536         rcTrack.left    = rc.right - TRACK_BORDER_SIZE;
00537         rcTrack.right  += 1;
00538         rcTrack.top    += 1;
00539         rcTrack.bottom -= 1;
00540         //Yiannhs moved below
00541         cxBorderRight = TRACK_BORDER_SIZE;
00542     }
00543
00544     else if (nID == AFX_IDW_SIZEBAR_TOP) {
00545         rcTrack.top = rc.bottom - TRACK_BORDER_SIZE;
00546         rcTrack.bottom+=1;
00547         //Yiannhs moved below
00548         cyBorderBottom = TRACK_BORDER_SIZE;
00549     }
00550
00551     else if (nID == AFX_IDW_SIZEBAR_RIGHT) {
00552         rcTrack.right   = rc.left + TRACK_BORDER_SIZE;
00553         rcTrack.left   -= 1;
00554         rcTrack.top    += 1;
00555         rcTrack.bottom -= 1;
00556         //Yiannhs moved below
00557         cxBorderLeft = TRACK_BORDER_SIZE;
00558     }
00559
00560     else if (nID == AFX_IDW_SIZEBAR_BOTTOM) {
00561         rcTrack.bottom = rc.top + TRACK_BORDER_SIZE;
00562         rcTrack.top-=1;
00563         //Yiannhs moved below
00564         cyBorderTop = TRACK_BORDER_SIZE;
00565     }
00566
00567     //Yiannhs Moved these here. in one place. The optimizer may do this, but lets help it.
00568     pDC->FillSolidRect(rcTrack, afxData.clrBtnFace);
00569     if( !m_bFlatBorder )    //Yiannhs handle flat borders
00570         pDC->Draw3dRect(rcTrack, afxData.clrBtnHilite, afxData.clrBtnShadow);
00571
00572     rect.left   += cxBorderLeft;
00573     rect.right  -= cxBorderRight;
00574     rect.top    += cyBorderTop;
00575     rect.bottom -= cyBorderBottom;
00576 }
00577
00578 void CCJSizeDockBar::EraseNonClient()
00579 {
00580     CWindowDC dc(this);
00581     CRect rectClient;
00582     GetClientRect(rectClient);
00583     CRect rectWindow;
00584     GetWindowRect(rectWindow);
00585     ScreenToClient(rectWindow);
00586     rectClient.OffsetRect(-rectWindow.left, -rectWindow.top);
00587     dc.ExcludeClipRect(rectClient);
00588     rectWindow.OffsetRect(-rectWindow.left, -rectWindow.top);
00589     DrawBorders(&dc, rectWindow);
00590 }
00591
00592
00593 //1999-05-18    Yiannhs
00594 void CCJSizeDockBar::CalcSizeBarLayout()
00595 {
00596     //Yiannhs: It is necessary to set all Control bars in one row.
00597     //         till now multiple rows are not handled
00598     int VisCount = GetDockedVisibleCount();
00599     if( !VisCount )
00600         return;      //Yiannhs v6.07 moved this on top
00601
00602     AFX_SIZEPARENTPARAMS layout;
00603     layout.hDWP = ::BeginDeferWindowPos( m_arrBars.GetSize( ));
00604     CRect rectAvail;
00605     GetClientRect(&rectAvail);
00606
00607     int nCount = 0;
00608     int lastLeft = 0;
00609     int lastTop = 0;
00610
00611     for (int i = 0; i < m_arrBars.GetSize(); i++)
00612     {
00613         CCJControlBar* pBar = STATIC_DOWNCAST(CCJControlBar, (CObject*)GetDockedControlBar(i));
00614         if (pBar != NULL && pBar->IsVisible())
00615         {
00616             if(!pBar->IsKindOf(RUNTIME_CLASS(CCJControlBar)))
00617                 continue;
00618
00619             CRect rectBar;
00620             ++nCount;
00621             pBar->GetWindowRect(&rectBar);
00622             pBar->m_bUnique = FALSE;        //Yiannhs ok in Ver 6.07
00623             ScreenToClient(&rectBar);
00624             CSize sizeIdeal = pBar->CalcDynamicLayout(-1, 0);
00625
00626             //Yiannhs  moved [if] code at the begining. It helps make these calculations near the top
00627             //         for checking the size of the last control bars
00628             int bIsLast = IsLastControlBar(i+1);
00629             pBar->m_bToFit = bIsLast;           //check fitting is setup here
00630             if( bIsLast && nCount == 1 ) {
00631                 pBar->m_bUnique = TRUE;
00632             }
00633
00635             //  so it is not completely hidden
00636             if( rectBar.right >= rectAvail.right && !bIsLast )
00637                 sizeIdeal.cx -= (sizeIdeal.cx / 4);
00638             if( rectBar.bottom >= rectAvail.bottom && !bIsLast )
00639                 sizeIdeal.cy -= (sizeIdeal.cy / 4);
00640
00641             //Yiannhs: The Dock bar is either horizontally or vertically docked itself.
00642             //         So are the ControlBars enclosed inside it. Since the control bars
00643             //         are docked, and Sizing dockbar does not derive from CCJControlBar
00644             //         we may be a bit more clever.
00645             if( m_dwStyle & CBRS_ORIENT_HORZ ) {//use some default data members
00646                 //horizontal;
00647                 rectBar.left = lastLeft;
00648                 rectBar.top = 0;
00649                 rectBar.bottom = rectAvail.Height();
00650                 rectBar.right = rectBar.left + sizeIdeal.cx;
00651
00652                 if( rectBar.left > lastLeft )
00653                     rectBar.left = lastLeft;
00654
00655                 lastLeft = rectBar.right;
00656                 if ( bIsLast ) {    //Yiannhs
00657                     rectBar.right = rectAvail.right;
00658                 }
00659
00660             } else if( m_dwStyle & CBRS_ORIENT_VERT ) {
00661                 //Vertical
00662                 rectBar.top = lastTop;
00663                 rectBar.left = 0;
00664                 rectBar.right = rectAvail.Width();
00665                 rectBar.bottom = rectBar.top + sizeIdeal.cy;
00666
00667                 if (rectBar.top > lastTop)
00668                     rectBar.top = lastTop;
00669
00670                 lastTop = rectBar.bottom;
00671                 if ( bIsLast ) {    //Yiannhs
00672                     rectBar.bottom = rectAvail.bottom;
00673                 }
00674             }
00675
00676             AfxRepositionWindow( &layout, pBar->m_hWnd, &rectBar );
00677         }
00678     }
00679
00680     // move and resize all the windows at once!
00681     if( layout.hDWP == NULL || !::EndDeferWindowPos( layout.hDWP ))
00682         TRACE0("Warning: DeferWindowPos failed - low system resources.\n");
00683 }
00684
00685 void CCJSizeDockBar::Maximize(CCJControlBar* pBar)
00686 {
00687     int iExt=0;
00688     CRect rectAvail;
00689     GetClientRect(rectAvail);
00690
00691     for (int i=0; i<m_arrBars.GetSize(); ++i)
00692     {
00693         CCJControlBar *pBarDock = (CCJControlBar *)GetDockedControlBar(i);
00694         if (pBarDock && pBarDock->IsVisible() && pBarDock != pBar) {
00695             pBarDock->Minimize();
00696             iExt += pBarDock->GetMinExt();
00697         }
00698     }
00699
00700     if (pBar->IsLeftDocked() || pBar->IsRightDocked()) {
00701         iExt = rectAvail.Height()-iExt;
00702     }
00703
00704     if (pBar->IsTopDocked() || pBar->IsBottomDocked()) {
00705         iExt = rectAvail.Width()-iExt;
00706     }
00707
00708     pBar->Maximize(iExt);
00709
00710     //1999-05-26 Yiannhs
00711     //do not care too much about flickering when maximizing controlbars
00712     CalcSizeBarLayout();
00713
00714     for (i=0; i<m_arrBars.GetSize(); ++i)
00715     {
00716         CCJControlBar *pBarDock = (CCJControlBar *)GetDockedControlBar(i);
00717         if (pBarDock && pBarDock->IsVisible() ) {
00718             pBarDock->InvalidateRect(NULL, TRUE);
00719             pBarDock->UpdateWindow();
00720         }
00721     }
00722     //1999-05-26 Yiannhs
00723 }
00724
00725 void CCJSizeDockBar::Normalize(CCJControlBar *)
00726 {
00727     for( int i=0; i<m_arrBars.GetSize(); ++i) {
00728         CCJControlBar *pBarDock = (CCJControlBar*)GetDockedControlBar(i);
00729         if (pBarDock && pBarDock->IsVisible())
00730             pBarDock->Normalize();
00731     }
00732
00733
00734     //1999-05-26 Yiannhs
00735     //do not care too much about flickering when maximizing controlbars
00736
00737     CalcSizeBarLayout();
00738
00739     for (i=0; i<m_arrBars.GetSize(); ++i)
00740     {
00741         CCJControlBar *pBarDock = (CCJControlBar *)GetDockedControlBar(i);
00742         if (pBarDock && pBarDock->IsVisible() ) {
00743             pBarDock->InvalidateRect(NULL, TRUE);
00744             pBarDock->UpdateWindow();
00745         }
00746     }
00747     //1999-05-26 Yiannhs
00748 }
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJSortClass.cpp Source File

WinCvs/CJLib/CJLibrary/CJSortClass.cpp

Go to the documentation of this file.
00001 // Copyright (c) Iuri Apollonio 1998
00002 // Use & modify as you want & need, and leave those 3 lines.
00003 // http://www.codeguru.com
00004 // class extended by Max Poliashenko.
00005 //
00006 // CJSortClass.cpp: implementation of the CCJSortClass class.
00007 //
00009 /****************************************************************************
00010  *
00011  * $Date: 1999/11/30 21:45:49 $
00012  * $Revision: 1.1.1.3 $
00013  * $Archive: /CodeJock/CJLibrary/CJSortClass.cpp $
00014  *
00015  * $History: CJSortClass.cpp $
00016  *
00017  * *****************  Version 4  *****************
00018  * User: Kirk Stowell Date: 10/14/99   Time: 12:19p
00019  * Updated in $/CodeJock/CJLibrary
00020  * Fixed assertion bug with constructior.
00021  *
00022  ***************************************************************************/
00024
00025 #include "stdafx.h"
00026 #include "CJSortClass.h"
00027
00028 #ifdef _DEBUG
00029 #undef THIS_FILE
00030 static char THIS_FILE[]=__FILE__;
00031 #define new DEBUG_NEW
00032 #endif
00033
00035 // Construction/Destruction
00037
00038 CCJSortClass::CCJSortClass(CListCtrl* pWnd, const int nCol)
00039 {
00040     ASSERT(pWnd);
00041     m_pWnd = pWnd;
00042
00043     int nCount = m_pWnd->GetItemCount();
00044     DWORD dwData;
00045     CString strItemText;
00046
00047     // replace Item data with pointer to CSortItem structure
00048     for (int i = 0; i < nCount; i++)
00049     {
00050         dwData = m_pWnd->GetItemData(i); // save current data to restore it later
00051         strItemText = m_pWnd->GetItemText(i, nCol);
00052         m_pWnd->SetItemData(i, (DWORD) new CSortItem(dwData, strItemText));
00053     }
00054 }
00055
00056 CCJSortClass::~CCJSortClass()
00057 {
00058     ASSERT(m_pWnd);
00059     int nCount = m_pWnd->GetItemCount();
00060     CSortItem * pItem;
00061     for (int i = 0; i < nCount; i++)
00062     {
00063         pItem = (CSortItem *) m_pWnd->GetItemData(i);
00064         ASSERT(pItem);
00065         m_pWnd->SetItemData(i, pItem->m_dwData);
00066         delete pItem;
00067     }
00068 }
00069
00070 void CCJSortClass::Sort(bool bAsc, DATA_TYPE eType)
00071 {
00072     long lParamSort = eType;
00073
00074     // if lParamSort positive - ascending sort order, negative - descending
00075     if (!bAsc)
00076         lParamSort *= -1;
00077
00078     m_pWnd->SortItems(Compare, lParamSort);
00079 }
00080
00081 int CALLBACK CCJSortClass::Compare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
00082 {
00083     CSortItem* item1 = (CSortItem *) lParam1;
00084     CSortItem* item2 = (CSortItem *) lParam2;
00085
00086     ASSERT(item1 && item2);
00087
00088     // restore data type and sort order from lParamSort
00089     // if lParamSort positive - ascending sort order, negative - descending
00090     short     sOrder = lParamSort < 0 ? (short) -1 : (short) 1;
00091
00092     DATA_TYPE eType  = (DATA_TYPE) (lParamSort * sOrder); // get rid of sign
00093
00094     // declare typed buffers
00095     COleDateTime t1, t2;
00096
00097     switch (eType)
00098     {
00099     case DT_INT:
00100         return ( _ttol( item1->m_strItemText ) - _ttol( item2->m_strItemText )) * sOrder;
00101
00102     case DT_DEC:
00103 #ifdef _UNICODE
00104         {
00105             char szText1[ 256 ];
00106             char szText2[ 256 ];
00107
00108             WideCharToMultiByte( CP_ACP,
00109                                  0,
00110                                  item1->m_strItemText,
00111                                  -1,
00112                                  szText1,
00113                                  255,
00114                                  NULL,
00115                                  NULL );
00116
00117             WideCharToMultiByte( CP_ACP,
00118                                  0,
00119                                  item2->m_strItemText,
00120                                  -1,
00121                                  szText2,
00122                                  255,
00123                                  NULL,
00124                                  NULL );
00125
00126
00127             return ( atof( szText1 ) < atof( szText2 ) ? -1 : 1) * sOrder;
00128         }
00129 #else
00130         return ( atof ( item1->m_strItemText ) < atof( item2->m_strItemText ) ? -1 : 1) * sOrder;
00131 #endif
00132
00133     case DT_DATETIME:
00134         if( t1.ParseDateTime( item1->m_strItemText ) && t2.ParseDateTime( item2->m_strItemText ))
00135         {
00136             return (t1 < t2 ? -1 : 1 ) * sOrder;
00137         }
00138         return 0;
00139
00140     case DT_STRING:
00141         return item1->m_strItemText.CompareNoCase( item2->m_strItemText ) * sOrder;
00142
00143     default:
00144         ASSERT("Error: attempt to sort a column without type.");
00145         return 0;
00146     }
00147 }
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJStatusBar.cpp Source File

WinCvs/CJLib/CJLibrary/CJStatusBar.cpp

Go to the documentation of this file.
00001 // CJStatusBar.cpp : implementation file
00002 //
00003 // Copyright © 1999 Pierre MELLINAND
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.1 $
00010  * $Archive: /CodeJock/CJLibrary/CJStatusBar.cpp $
00011  *
00012  * $History: CJStatusBar.cpp $
00013  *
00014  * *****************  Version 2  *****************
00015  * User: Kirk Stowell Date: 10/30/99   Time: 1:58p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Minor fix for UNICODE builds.
00018  *
00019  * *****************  Version 1  *****************
00020  * User: Kirk Stowell Date: 10/26/99   Time: 11:08p
00021  * Created in $/CodeJock/CJLibrary
00022  *
00023  ***************************************************************************/
00025
00026 #include "StdAfx.h"
00027 #include "CJStatusBar.h"
00028
00029 #ifdef _DEBUG
00030 #define new DEBUG_NEW
00031 #undef THIS_FILE
00032 static char THIS_FILE[] = __FILE__;
00033 #endif
00034
00036 // CCJStatusBarPaneControlInfo
00037
00038 CCJStatusBarPaneControlInfo::CCJStatusBarPaneControlInfo()
00039 {
00040     m_pWnd        = NULL;
00041     m_bAutodelete = TRUE;
00042     m_nPaneID     = 0;
00043 }
00044
00045 CCJStatusBarPaneControlInfo::~CCJStatusBarPaneControlInfo()
00046 {
00047     // TODO: add destruction code here.
00048 }
00049
00050 IMPLEMENT_DYNCREATE(CCJStatusBarPaneControlInfo, CObject)
00051
00053 // CCJStatusBarPane
00054
00055 CCJStatusBarPane::CCJStatusBarPane()
00056 {
00057     // TODO: add construction code here.
00058 }
00059
00060 CCJStatusBarPane::CCJStatusBarPane(CCJStatusBarPane& rPane)
00061 {
00062     m_nID     = rPane.m_nID;
00063     m_cxText  = rPane.m_cxText;
00064     m_nStyle  = rPane.m_nStyle;
00065     m_nFlags  = rPane.m_nFlags;
00066     m_strText = rPane.m_strText;
00067 }
00068
00069 CCJStatusBarPane::~CCJStatusBarPane()
00070 {
00071     // TODO: add destruction code here.
00072 }
00073
00074 CCJStatusBarPane& CCJStatusBarPane::operator=(CCJStatusBarPane& rPane)
00075 {
00076     m_nID     = rPane.m_nID;
00077     m_cxText  = rPane.m_cxText;
00078     m_nStyle  = rPane.m_nStyle;
00079     m_nFlags  = rPane.m_nFlags;
00080     m_strText = rPane.m_strText;
00081     return *this;
00082 }
00083
00085 // CCJStatusBar
00086
00087 CCJStatusBar::CCJStatusBar()
00088 {
00089     // TODO: add construction code here.
00090 }
00091
00092 CCJStatusBar::~CCJStatusBar()
00093 {
00094     for( int i = 0; i < m_aPans.GetSize(); i++ )
00095     {
00096         if( m_aPans[i]->m_pWnd && ::IsWindow(m_aPans[i]->m_pWnd->m_hWnd) )
00097             m_aPans[i]->m_pWnd->CloseWindow();
00098         if( m_aPans[i]->m_bAutodelete )
00099         {
00100             delete m_aPans[i]->m_pWnd;
00101         }
00102         delete m_aPans[i];
00103     }
00104 }
00105
00106 IMPLEMENT_DYNCREATE(CCJStatusBar, CStatusBar)
00107
00108 BEGIN_MESSAGE_MAP(CCJStatusBar, CStatusBar)
00109     //{{AFX_MSG_MAP(CCJStatusBar)
00110     ON_WM_SIZE()
00111     //}}AFX_MSG_MAP
00112 END_MESSAGE_MAP()
00113
00115 // CCJStatusBar message handlers
00116
00117 void CCJStatusBar::OnSize(UINT nType, int cx, int cy)
00118 {
00119     CStatusBar::OnSize(nType, cx, cy);
00120     PositionControls();
00121 }
00122
00123 void CCJStatusBar::PositionControls()
00124 {
00125     int h,v,s;
00126     GetStatusBarCtrl( ).GetBorders( h, v, s ) ;
00127
00128
00129     for(int i = 0; i < m_aPans.GetSize(); i++ )
00130     {
00131         CRect rect;
00132
00133         int index = CommandToIndex( m_aPans[i]->m_nPaneID );
00134         GetItemRect(index,rect);
00135         if( GetPaneStyle(index) & SBPS_NOBORDERS == SBPS_NOBORDERS)
00136             m_aPans[i]->m_pWnd->MoveWindow(rect);
00137         else
00138         {
00139             rect.top+=v;
00140             rect.bottom-=v;
00141             rect.left+=h+s;
00142             rect.right-=(h+s);
00143             m_aPans[i]->m_pWnd->MoveWindow(rect);
00144         }
00145
00146     }
00147 }
00148
00149 CCJStatusBarPaneControlInfo * CCJStatusBar::GetPanControl(int nPaneID)
00150 {
00151     for(int i = 0; i < m_aPans.GetSize(); i++ )
00152     {
00153         if( m_aPans[i]->m_nPaneID == nPaneID )
00154             return m_aPans[i];
00155     }
00156     return NULL;
00157 }
00158
00159 BOOL CCJStatusBar::AddControl(CWnd * pWnd, int paneID, BOOL bAutodeleteControl)
00160 {
00161
00162     CCJStatusBarPaneControlInfo * pPanInfo = GetPanControl(paneID);
00163     if( pPanInfo )
00164         return FALSE;
00165
00166     int idx = CommandToIndex( paneID ) ;
00167     if( idx == -1 )
00168         return FALSE;
00169
00170     CCJStatusBarPaneControlInfo * pPan = new CCJStatusBarPaneControlInfo;
00171     pPan->m_nPaneID =  paneID;
00172     pPan->m_pWnd    =  pWnd;
00173     pPan->m_bAutodelete = bAutodeleteControl;
00174
00175     m_aPans.Add(pPan);
00176     PositionControls();
00177     Invalidate(TRUE);
00178     return TRUE;
00179 }
00180
00181 void CCJStatusBar::SetPaneWidth(int index, int cxWidth)
00182 {
00183     UINT nID,nStyle;
00184     int width;
00185     GetPaneInfo(index,nID,nStyle,width);
00186     SetPaneInfo(index,nID,nStyle,cxWidth);
00187 }
00188
00189 BOOL CCJStatusBar::GetStatusPane(int nIndex, CCJStatusBarPane & rPane)
00190 {
00191     if( nIndex < m_nCount  && nIndex >= 0 )
00192     {
00193         GetPaneInfo( nIndex,  rPane.m_nID, rPane.m_nStyle, rPane.m_cxText ) ;
00194         GetPaneText( nIndex , rPane.m_strText );
00195         return TRUE;
00196     }
00197     return FALSE;
00198 }
00199
00200 BOOL CCJStatusBar::AddIndicator( int position, UINT paneID )
00201 {
00202     CArray<CCJStatusBarPane,CCJStatusBarPane> arPanes;
00203
00204     CCJStatusBarPane statusPane;
00205     int i;
00206
00207     i = 0;
00208     while( GetStatusPane(i,statusPane) )
00209     {
00210         arPanes.Add( statusPane );
00211         i++;
00212     }
00213     if( position < 0 )
00214         position = 0;
00215     if( position > arPanes.GetSize() )
00216         position = arPanes.GetSize()-1;
00217
00218     for(i = 0; i < arPanes.GetSize(); i ++ )
00219     {
00220         if( paneID == arPanes[i].m_nID )
00221         {
00222             TRACE0( "CCJStatusBar::AddIndicator(): Pane ID already exists \n" );
00223             return FALSE;
00224         }
00225     }
00226
00227     CCJStatusBarPane new_statusPane;
00228     new_statusPane.m_nID = paneID;
00229     if( arPanes.GetSize() )
00230         arPanes.InsertAt(position,new_statusPane);
00231     else
00232         arPanes.Add(new_statusPane);
00233
00234     UINT * pIndicators = new UINT[arPanes.GetSize()];
00235     for(i=0;i<arPanes.GetSize();i++)
00236         pIndicators[i]=arPanes[i].m_nID;
00237
00238     SetRedraw(FALSE);
00239     SetIndicators(pIndicators,arPanes.GetSize());
00240
00241     // Replace infos of indicators ..
00242     for(i = 0; i < arPanes.GetSize(); i++ )
00243     {
00244         if( arPanes[i].m_nID != paneID )
00245         {
00246             SetPaneInfo(i,arPanes[i].m_nID,arPanes[i].m_nStyle,arPanes[i].m_cxText);
00247             SetPaneText(i,arPanes[i].m_strText);
00248         }
00249         else
00250         {
00251             SetPaneWidth(i,50);
00252             SetPaneText(i,arPanes[i].m_strText);
00253         }
00254
00255     }
00256
00257     delete [] pIndicators;
00258     SetRedraw(TRUE);
00259     PositionControls();
00260     Invalidate(TRUE);
00261     return TRUE;
00262 }
00263
00264 void CCJStatusBar::RemovePane(int nPaneID)
00265 {
00266     SetRedraw(FALSE);
00267     CWnd * pwnd = NULL;
00268     for( int i = 0; i < m_aPans.GetSize(); i++ )
00269     {
00270         if( m_aPans[i]->m_nPaneID == nPaneID )
00271         {
00272             if( m_aPans[i]->m_bAutodelete )
00273                 pwnd = m_aPans[i]->m_pWnd;
00274             delete m_aPans[i];
00275             m_aPans.RemoveAt(i);
00276             break;
00277         }
00278     }
00279     if( pwnd )
00280     {
00281         pwnd->DestroyWindow();
00282         delete pwnd;
00283     }
00284
00285     CArray<CCJStatusBarPane,CCJStatusBarPane> arPanes;
00286     CCJStatusBarPane statusPane;
00287     i = 0;
00288     while( GetStatusPane(i,statusPane) )
00289     {
00290         if( statusPane.m_nID != (UINT)nPaneID )
00291             arPanes.Add( statusPane );
00292         i++;
00293     }
00294     // Now remove the indicator
00295     UINT * pIndicators = new UINT[arPanes.GetSize()];
00296     for(i=0;i<arPanes.GetSize();i++)
00297         pIndicators[i]=arPanes[i].m_nID;
00298     SetIndicators(pIndicators,arPanes.GetSize());
00299
00300     // Replace infos of indicators ..
00301     for(i = 0; i < arPanes.GetSize(); i++ )
00302     {
00303         SetPaneInfo(i,arPanes[i].m_nID,arPanes[i].m_nStyle,arPanes[i].m_cxText);
00304         SetPaneText(i,arPanes[i].m_strText);
00305     }
00306
00307     delete [] pIndicators;
00308     SetRedraw(TRUE);
00309     PositionControls();
00310     Invalidate(TRUE);
00311 }
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJTabCtrl.cpp Source File

WinCvs/CJLib/CJLibrary/CJTabCtrl.cpp

Go to the documentation of this file.
00001 // CJTabCtrl.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJTabCtrl.cpp $
00011  *
00012  * $History: CJTabCtrl.cpp $
00013  *
00014  * *****************  Version 15  *****************
00015  * User: Kirk Stowell Date: 10/30/99   Time: 1:58p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Overrode OnEraseBkgnd(...) and OnPaint() for flicker free drawing.
00018  *
00019  * *****************  Version 14  *****************
00020  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00021  * Updated in $/CodeJock/CJLibrary
00022  * Fixed potential resource and memory leak problems.
00023  *
00024  * *****************  Version 13  *****************
00025  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00026  * Updated in $/CodeJockey/CJLibrary
00027  * Updated copyright and contact information.
00028  *
00029  * *****************  Version 12  *****************
00030  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00031  * Updated in $/CodeJockey/CJLibrary
00032  * Added Unicode compliance, thanks to Barry Burton for his help with
00033  * this.
00034  *
00035  *
00036  * *****************  Version 11  *****************
00037  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00038  * Updated in $/CodeJockey/CJLibrary
00039  *
00040  * *****************  Version 10  *****************
00041  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00042  * Updated in $/CodeJockey/CJLibrary
00043  *
00044  * *****************  Version 9  *****************
00045  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00046  * Updated in $/CodeJockey/CJLibrary
00047  *
00048  * *****************  Version 8  *****************
00049  * User: Kirk Stowell Date: 7/25/99    Time: 12:15a
00050  * Updated in $/CodeJockey/CJLibrary
00051  *
00052  * *****************  Version 7  *****************
00053  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00054  * Updated in $/CodeJockey/CJLibrary
00055  *
00056  * *****************  Version 6  *****************
00057  * User: Kirk Stowell Date: 7/14/99    Time: 9:44p
00058  * Updated in $/CodeJockey/CJLibrary
00059  * Added _DYNAMIC macros for access to the CObject::IsKindOf to determine
00060  * the class object at runtime. Thanks to Sid Price
00061  * [sidprice@softtools.com] for suggesting this.
00062  *
00063  * *****************  Version 5  *****************
00064  * User: Kirk Stowell Date: 6/14/99    Time: 10:45p
00065  * Updated in $/CodeJockey/CJ60Lib
00066  * Cleaned up code to eliminate level 4 compilier warnings.
00067  *
00068  * *****************  Version 4  *****************
00069  * User: Kirk Stowell Date: 5/17/99    Time: 8:01p
00070  * Updated in $/CodeJockey/CJ60Lib
00071  * Changed popup menu parent from GetParentFrame() to  AfxGetMainWnd()
00072  *
00073  * *****************  Version 3  *****************
00074  * User: Kirk Stowell Date: 5/11/99    Time: 9:33p
00075  * Updated in $/CodeJockey/CJ60Lib
00076  * Renamed popup menu resource id to m_popupMenuID to be consistent with
00077  * other classes.  Added member variable m_popToolbarID to contain the
00078  * toolbar resource to be used for popup menus  and m_nPos to contain the
00079  * index of the submenu in the menu resource. Added
00080  * CCJTabCtrl::Create(...) to simplify the creation process, and to set
00081  * the tab font.  Cleaned up OnRButtonDown(..) message handler which
00082  * activates the popup menu. Modified SetMenuID(...) to accept the index
00083  * of the popup menu in the menu resource.
00084  *
00085  * *****************  Version 2  *****************
00086  * User: Kirk Stowell Date: 5/02/99    Time: 5:25p
00087  * Updated in $/CodeJockey/CJ60Lib
00088  * Removed class from CCJTabCtrlBar files into its own files. Added popup
00089  * menu support for CCJMenu.
00090  *
00091  * *****************  Version 1  *****************
00092  * User: Kirk Stowell Date: 5/02/99    Time: 4:33p
00093  * Created in $/CodeJockey/CJ60Lib
00094  *
00095  ***************************************************************************/
00097
00098 #include "StdAfx.h"
00099 #include "CJTabCtrl.h"
00100
00101 #ifdef _DEBUG
00102 #define new DEBUG_NEW
00103 #undef THIS_FILE
00104 static char THIS_FILE[] = __FILE__;
00105 #endif
00106
00108 // CCJTabCtrl
00109
00110 CCJTabCtrl::CCJTabCtrl()
00111 {
00112     m_popupMenuID   = 0;
00113     m_popToolbarID  = 0;
00114     m_nPos          = 0;
00115 }
00116
00117 CCJTabCtrl::~CCJTabCtrl()
00118 {
00119     // fix potential resource leak - KStowell - 10-22-99.
00120     m_Font.DeleteObject();
00121 }
00122
00123 IMPLEMENT_DYNAMIC(CCJTabCtrl, CTabCtrl)
00124
00125 BEGIN_MESSAGE_MAP(CCJTabCtrl, CTabCtrl)
00126     //{{AFX_MSG_MAP(CCJTabCtrl)
00127     ON_WM_RBUTTONDOWN()
00128     ON_WM_MEASUREITEM()
00129     ON_WM_MENUCHAR()
00130     ON_WM_INITMENUPOPUP()
00131     ON_WM_ERASEBKGND()
00132     ON_WM_PAINT()
00133     //}}AFX_MSG_MAP
00134 END_MESSAGE_MAP()
00135
00137 // CCJTabCtrl message handlers
00138
00139 void CCJTabCtrl::OnRButtonDown(UINT /*nFlags*/, CPoint point)
00140 {
00141     // No menu was defined...
00142     if (!m_popupMenuID) {
00143         TRACE0( "Warning: No menu resource was associated with CCJTabCtrl.\n" );
00144     }
00145
00146     else
00147     {
00148         // Since we are using the main window as the
00149         // parent, we need to convert the point to screen
00150         // coordinates...
00151         CPoint pt = point;
00152         ClientToScreen(&pt);
00153
00154         // Load the popup menu.
00155         VERIFY(m_popupMenu.LoadMenu(m_popupMenuID));
00156         CCJMenu* pPopup = (CCJMenu*)m_popupMenu.GetSubMenu(m_nPos);
00157         ASSERT(pPopup != NULL);
00158
00159         // Load toolbar resource if any for menu icons.
00160         if (m_popToolbarID) {
00161             pPopup->LoadToolbar(m_popToolbarID);
00162         }
00163
00164         // Display the popup menu, use the main window as its parent.
00165         pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
00166             pt.x, pt.y, AfxGetMainWnd());
00167
00168         m_popupMenu.DestroyMenu();
00169     }
00170 }
00171
00172 void CCJTabCtrl::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
00173 {
00174     if (lpMeasureItemStruct->CtlType == ODT_MENU)
00175     {
00176         if (IsMenu((HMENU)lpMeasureItemStruct->itemID)) {
00177             CMenu* pMenu = CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
00178
00179             if (m_popupMenu.IsMenu(pMenu)) {
00180                 m_popupMenu.MeasureItem(lpMeasureItemStruct);
00181                 return;
00182             }
00183         }
00184     }
00185
00186     CTabCtrl::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
00187 }
00188
00189 LRESULT CCJTabCtrl::OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu)
00190 {
00191     if (m_popupMenu.IsMenu(pMenu)) {
00192         return CCJMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
00193     }
00194
00195     return CTabCtrl::OnMenuChar(nChar, nFlags, pMenu);
00196 }
00197
00198 void CCJTabCtrl::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
00199 {
00200     CTabCtrl::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
00201
00202     if(!bSysMenu) {
00203         if (m_popupMenu.IsMenu(pPopupMenu)) {
00204             CCJMenu::UpdateMenu(pPopupMenu);
00205         }
00206     }
00207 }
00208
00209 BOOL CCJTabCtrl::Create(CWnd* pParentWnd, UINT nID, DWORD dwStyle, const CRect& rect)
00210 {
00211     if (!CTabCtrl::Create(dwStyle, rect, pParentWnd, nID))
00212         return FALSE;
00213
00214     UpdateFont();
00215     return TRUE;
00216 }
00217
00218 BOOL CCJTabCtrl::OnEraseBkgnd(CDC* pDC)
00219 {
00220     // KStowell - overridden for flicker-free drawing.
00221     UNUSED_ALWAYS(pDC);
00222     return TRUE;
00223 }
00224
00225 void CCJTabCtrl::UpdateFont()
00226 {
00227     m_Font.DeleteObject();
00228     NONCLIENTMETRICS ncm;
00229     ncm.cbSize = sizeof(ncm);
00230     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00231     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00232     SetFont(&m_Font);
00233 }
00234
00235 void CCJTabCtrl::OnPaint()
00236 {
00237     CPaintDC dc(this); // device context for painting
00238
00239
00240     // KStowell - Get the client rect.
00241     CRect rcClient;
00242     GetClientRect( &rcClient );
00243
00244     // KStowell - Create a memory device-context. This is done to help reduce
00245     // screen flicker, since we will paint the entire control to the
00246     // off screen device context first.
00247     CDC memDC;
00248     CBitmap bitmap;
00249     memDC.CreateCompatibleDC(&dc);
00250     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00251     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00252
00253     // KStowell - Repaint the background.
00254     memDC.FillSolidRect( rcClient, afxData.clrBtnFace );
00255
00256     // let the control do its default drawing.
00257     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00258
00259     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00260     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00261
00262     // KStowell - Cleanup resources.
00263     memDC.SelectObject(pOldBitmap);
00264     memDC.DeleteDC();
00265     bitmap.DeleteObject();
00266 }
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJTabCtrlBar.cpp Source File

WinCvs/CJLib/CJLibrary/CJTabCtrlBar.cpp

Go to the documentation of this file.
00001 // CJTabCtrlBar.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJTabCtrlBar.cpp $
00011  *
00012  * $History: CJTabCtrlBar.cpp $
00013  *
00014  * *****************  Version 22  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:29p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Enabled OnInitialUpdate() to be called for tab views added to
00018  * CCJTabCtrlBar whenever the control bar is floating.
00019  *
00020  * Fixed potential resource and memory leak problems.
00021  *
00022  * Fixed problems with AddView(...) setting the wrong view index to
00023  * active.
00024  *
00025  * Added  EnableToolTips method which enables and disables the tooltips.
00026  * Thanks to Phil Baxter for help with this.
00027  *
00028  * Fixed problem with dangling pointer in DeleteView. Thanks to Gero Kuehn
00029  * [gero.kuehn@isc-soft.de] for help with this.
00030  *
00031  * Fixed potential bug with CCJTabControlBar returning image index, fixed
00032  * bug with GetTabFromPoint(...) returning invalid index.
00033  *
00034  * Made class methods virtual for inhertance purposes.
00035  *
00036  * *****************  Version 20  *****************
00037  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00038  * Updated in $/CodeJockey/CJLibrary
00039  * Updated copyright and contact information.
00040  *
00041  * *****************  Version 19  *****************
00042  * User: Kirk Stowell Date: 8/30/99    Time: 12:46a
00043  * Updated in $/CodeJockey/CJLibrary
00044  * Gero Kuehn <gero.kuehn@isc-soft.de> - Added fixes for tab view
00045  * activation and removal.
00046  *
00047  * *****************  Version 18  *****************
00048  * User: Kirk Stowell Date: 8/29/99    Time: 9:54p
00049  * Updated in $/CodeJockey/CJLibrary
00050  * Fixed debug assert when adding a view with no associated document.
00051  *
00052  * *****************  Version 17  *****************
00053  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00054  * Updated in $/CodeJockey/CJLibrary
00055  * Added Unicode compliance, thanks to Barry Burton for his help with
00056  * this.
00057  *
00058  *
00059  * *****************  Version 16  *****************
00060  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00061  * Updated in $/CodeJockey/CJLibrary
00062  *
00063  * *****************  Version 15  *****************
00064  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00065  * Updated in $/CodeJockey/CJLibrary
00066  *
00067  * *****************  Version 14  *****************
00068  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00069  * Updated in $/CodeJockey/CJLibrary
00070  *
00071  * *****************  Version 13  *****************
00072  * User: Kirk Stowell Date: 7/14/99    Time: 9:43p
00073  * Updated in $/CodeJockey/CJLibrary
00074  * Added _DYNAMIC macros for access to the CObject::IsKindOf to determine
00075  * the class object at runtime. Added method GetTabFromPoint which returns
00076  * the tab index based upon cursor position. Thanks to Sid Price
00077  * [sidprice@softtools.com] for suggesting this.
00078  *
00079  * *****************  Version 12  *****************
00080  * User: Kirk Stowell Date: 6/11/99    Time: 10:17p
00081  * Updated in $/CodeJockey/CJ60Lib
00082  * Minor modifications to fix level 4 compilier warnings.
00083  *
00084  * *****************  Version 11  *****************
00085  * User: Kirk Stowell Date: 5/17/99    Time: 9:07p
00086  * Updated in $/CodeJockey/CJ60Lib
00087  * Paul [RowingWolf@aol.com] - Added the following support methods:
00088  * void SetActiveView(CView* pUserView)
00089  * void AssociateImageIndexWithRuntimeClass(int nIndex, CRuntimeClass*
00090  * pRuntimeClass)
00091  * void AssociateImageIndexWithRuntimeClass(int nIndex, LPCTSTR
00092  * lpszRuntimeClassName)
00093  * short GetImageIndexFromRuntimeClass(CRuntimeClass* pRuntimeClass)
00094  * BOOL RemoveAllTabs().
00095  *
00096  * *****************  Version 10  *****************
00097  * User: Kirk Stowell Date: 5/12/99    Time: 5:32a
00098  * Updated in $/CodeJockey/CJ60Lib
00099  * Added support for vc5 compatibility
00100  *
00101  * *****************  Version 9  *****************
00102  * User: Kirk Stowell Date: 5/11/99    Time: 10:02p
00103  * Updated in $/CodeJockey/CJ60Lib
00104  * After much frustration, a class re-write. Fixed many of the issues with
00105  * painting, invalid pointers and memory leaks. Added document support for
00106  * views associated with the tab control.
00107  *
00108  * *****************  Version 8  *****************
00109  * User: Kirk Stowell Date: 4/14/99    Time: 11:53p
00110  * Updated in $/CodeJockey/CJ60Lib
00111  * Added context popupMenu for CJTabCtrl to use Brent Corkum's BCMenu (CCJMenu).
00112  *
00113  * *****************  Version 7  *****************
00114  * User: Kirk Stowell Date: 4/03/99    Time: 11:52p
00115  * Updated in $/CodeJockey/CJ60Lib
00116  * Added comments and cleaned up code, modified AddView(...) to allow a
00117  * CDocument to be associated with the view added to the tab control.
00118  *
00119  * *****************  Version 6  *****************
00120  * User: Kirk Stowell Date: 3/14/99    Time: 11:51p
00121  * Updated in $/CodeJockey/CJ60Lib
00122  * Gonzalo Pereyra [ persys@adinet.com.uy ] - I wanted to trap NM_RETURN
00123  * notifications in my CTreeView Class. I couldn't... It turns out that
00124  * CControlbar::PreTranslateMessage() will eat all dialog messages...It
00125  * will never get dispatched to my window. So I Overrided it in :
00126  * CCJTabCtrlBar::PreTranslateMessage(). this will allow for message
00127  * reflection and we will get NM_RETURN. I don't know if this a good
00128  * solution but for now , it works.
00129  *
00130  * *****************  Version 5  *****************
00131  * User: Kirk Stowell Date: 2/24/99    Time: 11:49p
00132  * Updated in $/CodeJockey/CJ60Lib
00133  * Phil Baxter [pgb@mrjinx.demon.co.uk] - Fixed the following problems
00134  * when tabs are added after creation:
00135  * 1. The tab was created, but the view that was showing on the tab was
00136  * not visible.
00137  * 2. Get an assertion when the AddView function attempts to perform the
00138  * AddTool function.
00139  * 3. When a new view is added, although you set it to be the active view,
00140  * it isn't raised to the top of the stack in the display.
00141  * 4. The Tab name as stored in the TCB_ITEM structure is now a CString,
00142  * this removes the 32 byte limit that it previously had.
00143  * 5. New methods for obtaining the name as stored in the TCB_ITEM
00144  * structure.
00145  * 6. New Methods for deleting a view from the control, this removes the
00146  * view entirely including its  associated tab.
00147  * 7. Some minor fixes around assertions when trying to manipulate the
00148  * control when it has not had any tabs created.
00149  * 8. Added two new member functions:
00150  * void SetViewToolTip(int nView, LPCTSTR lpszLabel);
00151  * void SetViewToolTip(CRuntimeClass *pViewClass, LPCTSTR lpszLabel);
00152  *
00153  * *****************  Version 4  *****************
00154  * User: Kirk Stowell Date: 1/31/99    Time: 11:48p
00155  * Updated in $/CodeJockey/CJ60Lib
00156  * Commented out 2 calls to SetActiveView(). This somewhat fixes the
00157  * problem with CTRL+TAB in activatation of MDI child windows, however if
00158  * you click inside the view, this breaks CTRL+TAB again, will look at
00159  * this when I get some free time. Thanks to Pierre Guimont
00160  * (Pierre_Guimont@mitel.com) for pointing this out.
00161  *
00162  * Added m_TabCtrl.GetRowCount() as per Rashid Thadha
00163  * rashidt@consort.co.uk) request.
00164  *
00165  * *****************  Version 3  *****************
00166  * User: Kirk Stowell Date: 1/17/99    Time: 11:46p
00167  * Updated in $/CodeJockey/CJ60Lib
00168  * Added helper class CCJTabCtrl to eliminate re-painting problems such as
00169  * when the app is minimized then restored.
00170  *
00171  * *****************  Version 2  *****************
00172  * User: Kirk Stowell Date: 1/03/99    Time: 11:46p
00173  * Updated in $/CodeJockey/CJ60Lib
00174  * Application freezing bug fixed by
00175  * LiangYiBin.Donald(mailto:lybd@yahoo.com)
00176  *
00177  * *****************  Version 1  *****************
00178  * User: Kirk Stowell Date: 10/17/98   Time: 11:45p
00179  * Created in $/CodeJockey/CJ60Lib
00180  * Initial re-write and release.
00181  *
00182  ***************************************************************************/
00184
00185 #include "stdafx.h"
00186 #include "CJTabCtrlBar.h"
00187 #include "CJResource.h"
00188
00189 #ifdef _DEBUG
00190 #define new DEBUG_NEW
00191 #undef THIS_FILE
00192 static char THIS_FILE[] = __FILE__;
00193 #endif
00194
00196 // CCJTabCtrlBar
00197
00198 CCJTabCtrlBar::CCJTabCtrlBar()
00199 {
00200     m_nActiveTab        = 0;
00201     m_nNextToolTipId    = 0;
00202     m_bToolTipsEnabled  = TRUE;
00203 }
00204
00205 CCJTabCtrlBar::~CCJTabCtrlBar()
00206 {
00207     while(!m_viewList.IsEmpty())
00208     {
00209         TCB_ITEM *pMember = m_viewList.RemoveHead();
00210         _delete(pMember);
00211     }
00212 }
00213
00214 IMPLEMENT_DYNAMIC(CCJTabCtrlBar, CCJControlBar)
00215
00216 BEGIN_MESSAGE_MAP(CCJTabCtrlBar, CCJControlBar)
00217     //{{AFX_MSG_MAP(CCJTabCtrlBar)
00218     ON_WM_CREATE()
00219     ON_WM_WINDOWPOSCHANGED()
00220     ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_CONTROL, OnTabSelChange)
00221     //}}AFX_MSG_MAP
00222 END_MESSAGE_MAP()
00223
00225 // CCJTabCtrlBar message handlers
00226
00227 void CCJTabCtrlBar::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
00228 {
00229     // Get a pointer to the parent frame.
00230     CFrameWnd* pFrame = GetParentFrame();
00231     ASSERT(pFrame != NULL);
00232
00233     POSITION pos = m_viewList.GetHeadPosition();
00234     while( pos != NULL )
00235     {
00236         // Get the item for this position.
00237         TCB_ITEM *pItem = (TCB_ITEM*)m_viewList.GetNext(pos);
00238         ASSERT(pItem != NULL);
00239
00240         // To avoid mainwindow freezing, we must
00241         // deativate the view, it's not visible now.
00242         if (pFrame->GetActiveView() == pItem->pWnd) {
00243             pFrame->SetActiveView(NULL);
00244         }
00245
00246         // Resize the tab view.
00247         SizeTabView(pItem->pWnd);
00248     }
00249
00250     CCJControlBar::OnWindowPosChanged(lpwndpos);
00251 }
00252
00253 int CCJTabCtrlBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
00254 {
00255     if (CCJControlBar::OnCreate(lpCreateStruct) == -1)
00256         return -1;
00257
00258     // Create the Tab Control
00259     if (!m_TabCtrl.Create(this, IDC_TAB_CONTROL))
00260     {
00261         TRACE0( "Unable to create tab control bar\n" );
00262         return -1;
00263     }
00264
00265     // Associate the child window.
00266     SetChild(&m_TabCtrl);
00267
00268     return 0;
00269 }
00270
00271 BOOL CCJTabCtrlBar::PreTranslateMessage(MSG* pMsg)
00272 {
00273     if (pMsg->message == WM_KEYDOWN)
00274     {
00275         switch (pMsg->wParam)
00276         {
00277         case VK_RETURN:
00278             m_pActiveView->SendMessage(pMsg->message,
00279                 pMsg->wParam, pMsg->lParam);
00280             return TRUE;
00281         }
00282     }
00283
00284     return CCJControlBar::PreTranslateMessage(pMsg);
00285 }
00286
00287 void CCJTabCtrlBar::OnTabSelChange(NMHDR* /*pNMHDR*/, LRESULT* /*pResult*/)
00288 {
00289     SetActiveView(m_TabCtrl.GetCurSel());
00290 }
00291
00292 void CCJTabCtrlBar::GetChildRect(CRect &rect)
00293 {
00294     CCJControlBar::GetChildRect(rect);
00295
00296     if (IsFloating()) {
00297         rect.DeflateRect(2,2);
00298     }
00299 }
00300
00301 BOOL CCJTabCtrlBar::CreateTabView(CRuntimeClass *pViewClass, CDocument *pDocument, CCreateContext *pContext)
00302 {
00303     CWnd* pWnd = NULL;
00304
00305     // if no context specified, generate one
00306     // from the currently selected client if possible...
00307     if (pContext == NULL)
00308     {
00309         CCreateContext context;
00310
00311         context.m_pNewViewClass     = pViewClass;
00312         context.m_pCurrentDoc       = pDocument;
00313         context.m_pNewDocTemplate   = pDocument?pDocument->GetDocTemplate() : NULL;
00314         context.m_pLastView         = GetParentFrame()->GetActiveView();
00315         context.m_pCurrentFrame     = GetParentFrame();
00316
00317         pContext = &context;
00318     }
00319
00320     TRY
00321     {
00322         // Create the object.
00323         pWnd = DYNAMIC_DOWNCAST(CWnd, pViewClass->CreateObject());
00324         if (!pWnd) AfxThrowMemoryException();
00325     }
00326     CATCH_ALL(e)
00327     {
00328         TRACE0( "Out of memory creating a view.\n" );
00329         // Note: DELETE_EXCEPTION(e) not required
00330         return FALSE;
00331     }
00332     END_CATCH_ALL
00333
00334     ASSERT_KINDOF(CWnd, pWnd);
00335     ASSERT(pWnd->m_hWnd == NULL); // not yet created.
00336
00337     // Create with the right size and position
00338     if (!pWnd->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
00339         CRect(0,0,0,0), this, 0, pContext))
00340     {
00341         TRACE0( "Warning: couldn't create client pane for view.\n" );
00342         // pWnd will be cleaned up by PostNcDestroy
00343         return FALSE;
00344     }
00345
00346     // Set the newly create view as the active view.
00347     m_pActiveView = DYNAMIC_DOWNCAST(CView, pWnd);
00348     ASSERT_KINDOF(CView, m_pActiveView);
00349
00350     // If we were floating last, call OnInitialUpdate for the view
00351     // since CMiniDockFrameWnd does not do this for us.
00352     if( m_bFloating && m_pActiveView ) {
00353         m_pActiveView->OnInitialUpdate();
00354     }
00355
00356     return TRUE;
00357 }
00358
00359 TCB_ITEM* CCJTabCtrlBar::CreateTabListItem(LPCTSTR lpszLabel)
00360 {
00361     // Allocate a new TCB_ITEM object.
00362     TCB_ITEM* pMember = new TCB_ITEM;
00363
00364     pMember->pWnd           = m_pActiveView;
00365     pMember->szTabLabel     = lpszLabel;
00366     pMember->szToolTipLabel = lpszLabel;
00367     pMember->uiToolTipId    = m_nNextToolTipId++;
00368
00369     // Add the new TCB_ITEM to the tab item list.
00370     m_viewList.AddTail(pMember);
00371
00372     // Create the ToolTip for the tab.
00373     AddToolTip(pMember, lpszLabel);
00374
00375     return pMember;
00376 }
00377
00378 CToolTipCtrl* CCJTabCtrlBar::GetToolTip()
00379 {
00380     // Get a pointer to the tab control's CToolTipCtrl.
00381 #ifdef _VC_VERSION_5
00382     CToolTipCtrl* pToolTip = m_TabCtrl.GetTooltips();
00383     ASSERT(pToolTip != NULL);
00384 #else
00385     CToolTipCtrl* pToolTip = m_TabCtrl.GetToolTips();
00386     ASSERT(pToolTip != NULL);
00387 #endif // _VC_VERSION_5
00388
00389     return pToolTip;
00390 }
00391
00392 void CCJTabCtrlBar::AddToolTip(TCB_ITEM *pMember, LPCTSTR lpszLabel)
00393 {
00394     // Get the tool tips for the tab control.
00395     CToolTipCtrl* pToolTip = GetToolTip();
00396
00397     // Add the tool tip.
00398     if( pMember->uiToolTipId == 0 ) {
00399         pToolTip->AddTool( &m_TabCtrl, lpszLabel,
00400             NULL, pMember->uiToolTipId );
00401     }
00402     else {
00403         pToolTip->AddTool( &m_TabCtrl, lpszLabel,
00404             CRect(0,0,0,0), pMember->uiToolTipId );
00405     }
00406 }
00407
00408 void CCJTabCtrlBar::ResetToolTips(CToolTipCtrl* pToolTip)
00409 {
00410     if (pToolTip)
00411     {
00412         int nIndex = 0;
00413         POSITION pos;
00414         for( pos = m_viewList.GetHeadPosition(); pos; m_viewList.GetNext(pos) )
00415         {
00416             // Get the next item in the list.
00417             TCB_ITEM* pMember = m_viewList.GetAt( pos );
00418
00419             // Update the tooltip for the view
00420             pMember->uiToolTipId = nIndex;
00421             pToolTip->UpdateTipText( pMember->szToolTipLabel, &m_TabCtrl,
00422                 pMember->uiToolTipId );
00423
00424             nIndex++;
00425         }
00426
00427         m_nNextToolTipId = ( nIndex == 0 )?1:nIndex;
00428     }
00429 }
00430
00431 BOOL CCJTabCtrlBar::AddView(LPCTSTR lpszLabel, CRuntimeClass *pViewClass,
00432     CDocument* pDoc/*=NULL*/, UINT nIndex/*=-1*/, CCreateContext *pContext/*=NULL*/)
00433 {
00434     OverkillAssert(pViewClass);
00435
00436     // Create the view to be associate with tab.
00437     if (!CreateTabView(pViewClass, pDoc, pContext))
00438         return FALSE;
00439
00440     // Create the tab list item.
00441     if (CreateTabListItem(lpszLabel) == NULL)
00442         return FALSE;
00443
00444     // Since the tool tip count has changed,
00445     // re-initialize the tooltips.
00446     ResetToolTips(GetToolTip());
00447
00448     int nViews = ( nIndex == -1 )?m_viewList.GetCount():nIndex;
00449     if( nViews != 1 ) {
00450         m_pActiveView->EnableWindow(FALSE);
00451         m_pActiveView->ShowWindow(SW_HIDE);
00452     }
00453
00454     // Insert the new tab item.
00455     TC_ITEM tci;
00456     tci.mask    = TCIF_TEXT | TCIF_IMAGE;
00457     tci.pszText = (LPTSTR)(LPCTSTR)lpszLabel;
00458     tci.iImage  = nViews-1;
00459     m_TabCtrl.InsertItem(m_viewList.GetCount()-1, &tci);
00460
00461     // Resize the tab view.
00462     SizeTabView(m_pActiveView);
00463
00464     return TRUE;
00465 }
00466
00467 void CCJTabCtrlBar::SizeTabView(CWnd *pWnd)
00468 {
00469     // Get the new window size.
00470     CRect rcChild;
00471     GetChildRect(rcChild);
00472     rcChild.DeflateRect(3,3);
00473     rcChild.bottom -= (21 * m_TabCtrl.GetRowCount());
00474
00475     // Resize the window.
00476     pWnd->MoveWindow(rcChild);
00477     pWnd->SetWindowPos(NULL, 0,0,0,0,
00478         SWP_NOSIZE|SWP_NOMOVE);
00479 }
00480
00481 void CCJTabCtrlBar::OverkillAssert(CRuntimeClass *pViewClass)
00482 {
00483 #ifdef _DEBUG
00484     ASSERT_VALID(this);
00485     ASSERT(pViewClass != NULL);
00486     ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
00487     ASSERT(AfxIsValidAddress(pViewClass, sizeof(CRuntimeClass), FALSE));
00488 #else
00489     UNUSED_ALWAYS( pViewClass );
00490 #endif
00491 }
00492
00493 void CCJTabCtrlBar::RemoveListItem(POSITION pos)
00494 {
00495     if( pos != NULL )
00496     {
00497         // remove the page from internal list
00498         TCB_ITEM *pMember = m_viewList.GetAt(pos);
00499         ASSERT(pMember);
00500
00501         // And delete the member window, freeing our stored
00502         // values relating to it
00503         if (pMember->pWnd != NULL) {
00504             pMember->pWnd->DestroyWindow();
00505             pMember->pWnd = NULL;
00506         }
00507
00508         // Remove from list and free memory.
00509         m_viewList.RemoveAt(pos);
00510         _delete(pMember);
00511     }
00512 }
00513
00514 void CCJTabCtrlBar::DeleteView(int nView)
00515 {
00516     ASSERT_VALID( this );
00517     ASSERT(( nView >= 0 ) && (m_TabCtrl.GetItemCount() > nView));
00518
00519     TRACE2("***DeleteView: %d ( /%d )\n", nView,m_viewList.GetCount());
00520
00521     // Now find the view we want to delete and remove it
00522     POSITION pos = m_viewList.FindIndex(nView);
00523     if( pos != NULL )
00524     {
00525         CView *pOldActiveView;
00526         pOldActiveView = m_pActiveView;
00527
00528         // Ensure that we get no dangling pointers
00529         // DO NOT (RE-)MOVE THIS CODE ! Gero Kuehn [gero.kuehn@isc-soft.de]
00530         if(GetParentFrame()->GetActiveView() == DYNAMIC_DOWNCAST( CView, m_viewList.GetAt(pos)->pWnd))
00531             GetParentFrame()->SetActiveView( NULL , FALSE);
00532
00533         // Remove item from list, and free memory.
00534         RemoveListItem( pos );
00535
00536         // Remove it from the tab control
00537         m_TabCtrl.DeleteItem(nView);
00538
00539         // Finally, if we have just deleted the active view, reset the
00540         // active tab to be the first view in the list
00541         if (nView == m_nActiveTab)
00542         {
00543             m_nActiveTab = -1;
00544             m_pActiveView = NULL; // Gero Kuehn [gero.kuehn@isc-soft.de]
00545         }
00546         else
00547         {
00548             // ** GK/ISC
00549             if((m_nActiveTab - 1)>=0) {
00550                 SetActiveView(m_nActiveTab - 1);
00551             }
00552         }
00553
00554         // Reset the tooltips for the views we have left...
00555         ResetToolTips(GetToolTip());
00556     }
00557 }
00558
00559 void CCJTabCtrlBar::DeleteView(CRuntimeClass *pViewClass)
00560 {
00561     OverkillAssert(pViewClass);
00562
00563     int nIndex = 0;
00564     for( POSITION pos = m_viewList.GetHeadPosition(); pos; m_viewList.GetNext( pos ))
00565     {
00566         TCB_ITEM *pMember = m_viewList.GetAt(pos);
00567         ASSERT(pMember);
00568
00569         if (pMember->pWnd->IsKindOf(pViewClass)) {
00570             DeleteView(nIndex);
00571             return;
00572         }
00573         nIndex++;
00574     }
00575 }
00576
00577 void CCJTabCtrlBar::RemoveView(int nView)
00578 {
00579     ASSERT_VALID( this );
00580     ASSERT(( nView >= 0 ) && (m_TabCtrl.GetItemCount() > nView));
00581     RemoveListItem( m_viewList.FindIndex( nView ));
00582 }
00583
00584 void CCJTabCtrlBar::SetViewToolTip(int nView, LPCTSTR lpszLabel)
00585 {
00586     ASSERT_VALID(this);
00587     ASSERT(( nView >= 0 ) && (m_TabCtrl.GetItemCount() > nView));
00588
00589     // Find the view we want to change the tooltip for and
00590     // reset its tooltip text
00591     POSITION pos = m_viewList.FindIndex( nView );
00592     if( pos != NULL )
00593     {
00594         // Get the private data for the view
00595         TCB_ITEM *pMember = m_viewList.GetAt(pos);
00596
00597         // Reset the tooltip text to the new value
00598         pMember->szToolTipLabel = lpszLabel;
00599
00600         // Update the tooltip for the view
00601         GetToolTip()->UpdateTipText( pMember->szToolTipLabel,
00602             &m_TabCtrl, pMember->uiToolTipId );
00603     }
00604 }
00605
00606 void CCJTabCtrlBar::SetViewToolTip(CRuntimeClass *pViewClass, LPCTSTR lpszLabel)
00607 {
00608     OverkillAssert(pViewClass);
00609
00610     int nIndex=0;
00611     for (POSITION pos=m_viewList.GetHeadPosition(); pos; m_viewList.GetNext(pos))
00612     {
00613         TCB_ITEM *pMember=m_viewList.GetAt(pos);
00614         if (pMember->pWnd->IsKindOf(pViewClass))
00615         {
00616             SetViewToolTip(nIndex, lpszLabel);
00617             break;
00618         }
00619         nIndex++;
00620     }
00621     return;
00622 }
00623
00624 CView* CCJTabCtrlBar::GetView(int nView)
00625 {
00626     ASSERT_VALID(this);
00627     ASSERT(( nView >= 0 ) && ( m_TabCtrl.GetItemCount() > nView ));
00628
00629     if( nView != -1 )
00630     {
00631         POSITION pos = m_viewList.FindIndex( nView );
00632         if( pos != NULL )
00633         {
00634             TCB_ITEM* pMember = m_viewList.GetAt( pos );
00635             return ( pMember )?(CView*)pMember->pWnd:NULL;
00636         }
00637
00638         return NULL;
00639     }
00640
00641     return NULL;
00642 }
00643
00644 CView* CCJTabCtrlBar::GetView(CRuntimeClass *pViewClass)
00645 {
00646     OverkillAssert(pViewClass);
00647
00648     for( POSITION pos = m_viewList.GetHeadPosition(); pos; m_viewList.GetNext( pos ))
00649     {
00650         TCB_ITEM *pMember = m_viewList.GetAt( pos );
00651         if( pMember->pWnd->IsKindOf( pViewClass )) {
00652             return (CView*)pMember->pWnd;
00653         }
00654     }
00655     return NULL;
00656 }
00657
00658 LPCTSTR CCJTabCtrlBar::GetViewName(int nView)
00659 {
00660     ASSERT_VALID(this);
00661     ASSERT(( nView >= 0 ) && ( m_TabCtrl.GetItemCount() > nView ));
00662
00663     if( nView != -1 )
00664     {
00665         POSITION pos = m_viewList.FindIndex( nView );
00666         if( pos != NULL )
00667         {
00668             TCB_ITEM* pMember = m_viewList.GetAt( pos );
00669             return ( pMember )?(LPCTSTR)pMember->szTabLabel:NULL;
00670         }
00671
00672         return NULL;
00673     }
00674
00675     return NULL;
00676 }
00677
00678 LPCTSTR CCJTabCtrlBar::GetViewName(CRuntimeClass *pViewClass)
00679 {
00680     OverkillAssert(pViewClass);
00681
00682     for( POSITION pos = m_viewList.GetHeadPosition(); pos; m_viewList.GetNext( pos ))
00683     {
00684         TCB_ITEM *pMember = m_viewList.GetAt( pos );
00685         if( pMember->pWnd->IsKindOf( pViewClass )) {
00686             return (LPCTSTR)pMember->szTabLabel;
00687         }
00688     }
00689     return NULL;
00690 }
00691
00692 void CCJTabCtrlBar::SetActiveView(int nView)
00693 {
00694     ASSERT_VALID(this);
00695     ASSERT(( nView >= 0 ) && ( m_TabCtrl.GetItemCount() > nView ));
00696
00697     if(( nView != -1 ) && ( nView != m_nActiveTab ))
00698     {
00699         POSITION pos = m_viewList.FindIndex( nView );
00700         if( pos != NULL )
00701         {
00702             // Hide the old view we are changing.
00703             // GK/ISC
00704             POSITION oldPos = NULL;
00705             if( m_nActiveTab >= 0) {
00706                 oldPos = m_viewList.FindIndex( m_nActiveTab );
00707             }
00708
00709             if( oldPos )
00710             {
00711                 TCB_ITEM* pOldItem = m_viewList.GetAt( oldPos );
00712                 pOldItem->pWnd->EnableWindow(FALSE);
00713                 pOldItem->pWnd->ShowWindow(SW_HIDE);
00714             }
00715
00716             // Show the newly selected view.
00717             TCB_ITEM* pMember = m_viewList.GetAt( pos );
00718             pMember->pWnd->EnableWindow(TRUE);
00719             pMember->pWnd->ShowWindow(SW_SHOW);
00720             pMember->pWnd->SetFocus();
00721
00722             // select the tab (if tab programmatically changed)
00723             m_nActiveTab = nView;
00724             m_TabCtrl.SetCurSel( m_nActiveTab );
00725
00726             // Set the active view.
00727             m_pActiveView = DYNAMIC_DOWNCAST( CView, pMember->pWnd );
00728             ASSERT_KINDOF( CView, m_pActiveView );
00729             GetParentFrame()->SetActiveView( m_pActiveView );
00730         }
00731     }
00732 }
00733
00734 void CCJTabCtrlBar::SetActiveView(CRuntimeClass *pViewClass)
00735 {
00736     OverkillAssert(pViewClass);
00737
00738     int nView = 0;
00739     for (POSITION pos=m_viewList.GetHeadPosition(); pos; m_viewList.GetNext(pos))
00740     {
00741         TCB_ITEM *pMember=m_viewList.GetAt(pos);
00742         if (pMember->pWnd->IsKindOf(pViewClass))
00743         {
00744             //first hide old first view
00745             m_pActiveView->EnableWindow(FALSE);
00746             m_pActiveView->ShowWindow(SW_HIDE);
00747
00748             // set new active view
00749             m_pActiveView = (CView*)pMember->pWnd;
00750
00751             // enable, show, set focus to new view
00752             m_pActiveView->EnableWindow(TRUE);
00753             m_pActiveView->ShowWindow(SW_SHOW);
00754             m_pActiveView->SetFocus();
00755
00756             m_nActiveTab = nView;
00757
00758             // select the tab
00759             m_TabCtrl.SetCurSel(m_nActiveTab);
00760
00761             break;
00762         }
00763         nView++;
00764     }
00765 }
00766
00767 void CCJTabCtrlBar::SetActiveView(CView* pUserView)
00768 {
00769     // Walk through the tabs
00770     for (POSITION pos=m_viewList.GetHeadPosition(); pos; m_viewList.GetNext(pos))
00771     {
00772         // Get the tab's view
00773         CView* pTabView = (CView *)(m_viewList.GetAt(pos)->pWnd);
00774
00775         // Does the tab view match the requested view?
00776         if (pTabView == pUserView)
00777         {
00778             // Change the active view
00779             m_pActiveView = pTabView;
00780             ((CFrameWnd *)GetParent())->SetActiveView((CView *)m_pActiveView);
00781         }
00782     }
00783 }
00784
00785 void CCJTabCtrlBar::AssociateImageIndexWithRuntimeClass(int nIndex, CRuntimeClass* pRuntimeClass)
00786 {
00787     CString szClassName(pRuntimeClass->m_lpszClassName);
00788     m_ClassNameToImageIndexMap[szClassName] = (short*)nIndex;
00789 }
00790
00791 void CCJTabCtrlBar::AssociateImageIndexWithRuntimeClass(int nIndex, LPCTSTR lpszRuntimeClassName)
00792 {
00793     CString szClassName(lpszRuntimeClassName);
00794     m_ClassNameToImageIndexMap[szClassName] = (short*)nIndex;
00795 }
00796
00797 short CCJTabCtrlBar::GetImageIndexFromRuntimeClass(CRuntimeClass* pRuntimeClass)
00798 {
00799     ASSERT(m_ClassNameToImageIndexMap.GetCount() > 0);
00800     CString szClassName(pRuntimeClass->m_lpszClassName);
00801
00802     // Look for class name
00803     short* psValue;
00804     if (FALSE == m_ClassNameToImageIndexMap.Lookup(szClassName, (void*&)psValue))
00805         return -1;
00806
00807     // return the de-referenced pointer.
00808     return *psValue;
00809
00810 }
00811
00812 BOOL CCJTabCtrlBar::RemoveAllTabs()
00813 {
00814     // Itterate the tab views
00815     while(!m_viewList.IsEmpty())
00816     {
00817         RemoveView(0);  // Remove the view from the bar
00818         m_TabCtrl.DeleteItem(0);
00819     }
00820     m_pActiveView = NULL;
00821     ((CFrameWnd *)GetParent())->SetActiveView(NULL);
00822     Invalidate();
00823     return TRUE;
00824 }
00825
00826 int CCJTabCtrlBar::GetTabFromPoint(CPoint point)
00827 {
00828     TCHITTESTINFO tch;
00829     memset(&tch, 0, sizeof(TCHITTESTINFO));
00830
00831     if( point == CPoint(0,0) ) {
00832         CPoint pt;
00833         GetCursorPos(&pt);
00834         ScreenToClient(&pt);
00835         tch.pt = pt;
00836     } else {
00837         tch.pt = point;
00838     }
00839
00840     int iTab = m_TabCtrl.HitTest(&tch);
00841
00842     if( iTab != -1 ) {
00843         m_nPointTab = iTab ;
00844     }
00845
00846     return iTab;
00847 }
00848
00849 BOOL CCJTabCtrlBar::EnableToolTips(BOOL bEnable)
00850 {
00851     BOOL bPrev = m_bToolTipsEnabled;
00852
00853     m_bToolTipsEnabled = bEnable;
00854
00855     // Get the tool tips for the tab control.
00856     CToolTipCtrl* pToolTip = GetToolTip();
00857
00858     if (pToolTip)
00859         pToolTip->Activate(m_bToolTipsEnabled);
00860     else
00861         m_bToolTipsEnabled = bPrev;
00862
00863     return bPrev;
00864 }
00865
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJTabView.cpp Source File

WinCvs/CJLib/CJLibrary/CJTabView.cpp

Go to the documentation of this file.
00001 // CJTabView.cpp: implementation file
00002 //
00003 // Copyright © 1999 Mike Manzo
00004 // mailto:mmanzo@ieee.org
00005 //
00007 /****************************************************************************
00008  *
00009  * $Date: 1999/11/30 21:45:49 $
00010  * $Revision: 1.1.1.3 $
00011  * $Archive: /CodeJock/CJLibrary/CJTabView.cpp $
00012  *
00013  * $History: CJTabView.cpp $
00014  *
00015  * *****************  Version 13  *****************
00016  * User: Kirk Stowell Date: 10/30/99   Time: 1:57p
00017  * Updated in $/CodeJock/CJLibrary
00018  * Overrode OnEraseBkgnd(...) for flicker free drawing.
00019  *
00020  * *****************  Version 12  *****************
00021  * User: Kirk Stowell Date: 10/24/99   Time: 3:15a
00022  * Updated in $/CodeJock/CJLibrary
00023  *
00024  * *****************  Version 11  *****************
00025  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00026  * Updated in $/CodeJock/CJLibrary
00027  * Fixed potential resource and memory leak problems.
00028  *
00029  * *****************  Version 10  *****************
00030  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00031  * Updated in $/CodeJock/CJLibrary
00032  * Added source control history to file header.
00033  *
00034  ***************************************************************************/
00036
00037 #include "stdafx.h"
00038 #include "CJTabView.h"
00039
00040 #ifdef _DEBUG
00041 #define new DEBUG_NEW
00042 #undef THIS_FILE
00043 static char THIS_FILE[] = __FILE__;
00044 #endif
00045
00047 // CCJTabView
00048 IMPLEMENT_DYNCREATE(CCJTabView, CCtrlView)
00049
00050 CCJTabView::CCJTabView() : CCtrlView(_T("SysTabControl32"),
00051     TCS_TOOLTIPS | WS_VISIBLE | WS_CHILD | WS_BORDER)
00052 {
00053     m_pTabCtrl = (CTabCtrl*) this;
00054     m_nActiveTab = 0;
00055 }
00056
00057 CCJTabView::~CCJTabView()
00058 {
00059     while(!m_views.IsEmpty()) {
00060         CTV_ITEM *pMember=m_views.RemoveTail();
00061         _delete(pMember);
00062     }
00063
00064     // fix potential resource leak - KStowell - 10-22-99.
00065     m_TabFont.DeleteObject();
00066 }
00067
00068 BEGIN_MESSAGE_MAP(CCJTabView, CCtrlView)
00069     //{{AFX_MSG_MAP(CCJTabView)
00070     ON_WM_WINDOWPOSCHANGED()
00071     ON_NOTIFY_REFLECT(TCN_SELCHANGE, OnSelchange)
00072     ON_WM_CREATE()
00073     ON_WM_ERASEBKGND()
00074     //}}AFX_MSG_MAP
00075 END_MESSAGE_MAP()
00076
00077
00079 // CCJTabView message handlers
00080 void CCJTabView::GetChildRect(CRect &rect)
00081 {
00082     m_pTabCtrl->GetClientRect(&rect);
00083 }
00084
00085 CView* CCJTabView::GetView(int nView)
00086 {
00087     ASSERT_VALID(this);
00088     ASSERT(nView >= 0);
00089
00090     if (nView!=-1) {
00091         CTV_ITEM *pMember=m_views.GetAt(m_views.FindIndex(nView));
00092         return (CView*)pMember->pWnd;
00093     }
00094     else
00095         return NULL;
00096 }
00097
00098 CView* CCJTabView::GetView(CRuntimeClass *pViewClass)
00099 {
00100     ASSERT_VALID(this);
00101     ASSERT(pViewClass != NULL);
00102     ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
00103     ASSERT(AfxIsValidAddress(pViewClass, sizeof(CRuntimeClass), FALSE));
00104
00105     for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos)) {
00106         CTV_ITEM *pMember=m_views.GetAt(pos);
00107         if (pMember->pWnd->IsKindOf(pViewClass)) {
00108             return (CView*)pMember->pWnd;
00109         }
00110     }
00111     return NULL;
00112 }
00113
00114 BOOL CCJTabView::ModifyTabStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags)
00115 {
00116     DWORD dwCurrentStyle = GetStyle();
00117
00118     // We are in horizontal mode...go vertical
00119     if ((dwAdd & TCS_VERTICAL) && !(dwCurrentStyle & TCS_VERTICAL)) {
00120         // Get the log font.
00121         NONCLIENTMETRICS ncm;
00122         ncm.cbSize = sizeof(NONCLIENTMETRICS);
00123         VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
00124             sizeof(NONCLIENTMETRICS), &ncm, 0));
00125         // fix potential resource leak - KStowell - 10-22-99.
00126         m_TabFont.DeleteObject();
00127         ncm.lfMessageFont.lfOrientation = (dwAdd & TCS_RIGHT) ? 2700 : 900;
00128         ncm.lfMessageFont.lfEscapement  = (dwAdd & TCS_RIGHT) ? 2700 : 900;
00129         m_TabFont.CreateFontIndirect(&ncm.lfMessageFont);
00130         m_pTabCtrl->SetFont(&m_TabFont);
00131     }
00132     // We are in vertical mode....go horizontal
00133     else if ((dwCurrentStyle & TCS_VERTICAL) && !(dwAdd & TCS_VERTICAL)) {
00134         // Get the log font.
00135         NONCLIENTMETRICS ncm;
00136         ncm.cbSize = sizeof(NONCLIENTMETRICS);
00137         VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
00138             sizeof(NONCLIENTMETRICS), &ncm, 0));
00139         // fix potential resource leak - KStowell - 10-22-99.
00140         m_TabFont.DeleteObject();
00141         ncm.lfMessageFont.lfOrientation = 0;
00142         ncm.lfMessageFont.lfEscapement  = 0;
00143         m_TabFont.CreateFontIndirect(&ncm.lfMessageFont);
00144         m_pTabCtrl->SetFont(&m_TabFont);
00145     }
00146
00147     return m_pTabCtrl->ModifyStyle(dwRemove, dwAdd, nFlags);
00148 }
00149
00150 // Determine where the views should be placed in the tab...
00151 void CCJTabView::CalcViewRect(CRect* pRect)
00152 {
00153     GetChildRect((*pRect));
00154     DWORD dwStyle = GetStyle();
00155
00156     if ((dwStyle & TCS_BOTTOM) && !(dwStyle & TCS_VERTICAL)) {      // Bottom
00157         (*pRect).top    += TABVIEW_BORDER;
00158         (*pRect).left   += TABVIEW_BORDER;
00159         (*pRect).right  -= TABVIEW_BORDER;
00160         (*pRect).bottom -= 26;
00161     }
00162     else if ((dwStyle & TCS_RIGHT) && (dwStyle & TCS_VERTICAL)) {   // Right
00163         (*pRect).top    += TABVIEW_BORDER;
00164         (*pRect).left   += TABVIEW_BORDER;
00165         (*pRect).right  -= 26;
00166         (*pRect).bottom -= TABVIEW_BORDER;
00167     }
00168     else if (dwStyle & TCS_VERTICAL) {                              // Left
00169         (*pRect).top    += TABVIEW_BORDER;
00170         (*pRect).left   += 26;
00171         (*pRect).right  -= TABVIEW_BORDER;
00172         (*pRect).bottom -= TABVIEW_BORDER;
00173     }
00174     else {                                                          // Top
00175         (*pRect).top    += 26;
00176         (*pRect).left   += TABVIEW_BORDER;
00177         (*pRect).right  -= TABVIEW_BORDER;
00178         (*pRect).bottom -= TABVIEW_BORDER;
00179     }
00180 }
00181
00182 void CCJTabView::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
00183 {
00184     CRect rcChild;
00185     CWnd *pWnd;
00186
00187     CalcViewRect(&rcChild);
00188     for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos)) {
00189         pWnd = m_views.GetAt(pos)->pWnd;
00190         pWnd->MoveWindow(rcChild);
00191     }
00192
00193     // *** LiangYiBin.Donald
00194     if( lpwndpos->flags & SWP_HIDEWINDOW ) {
00195         CFrameWnd* pFrame = GetParentFrame();
00196         POSITION pos = m_views.GetHeadPosition();
00197         while ( pos != NULL ) {
00198             // check whether the views in the controlbar are focused
00199             CTV_ITEM *pItem = (CTV_ITEM *) m_views.GetNext(pos);
00200             if ( pFrame != NULL && pFrame->GetActiveView() == pItem->pWnd ) {
00201                 // To avoid mainwindow freezing, we must deativate the view,
00202                 // because it's not visible now.
00203                 pFrame->SetActiveView(NULL);
00204             }
00205         }
00206     }
00207
00208     CCtrlView::OnWindowPosChanged(lpwndpos);
00209 }
00210
00211 void CCJTabView::RemoveView(int nView)
00212 {
00213     ASSERT_VALID(this);
00214     ASSERT(nView >= 0);
00215
00216     // remove the page from internal list
00217     m_views.RemoveAt(m_views.FindIndex(nView));
00218 }
00219
00220 void CCJTabView::SetActiveView(CRuntimeClass *pViewClass)
00221 {
00222     ASSERT_VALID(this);
00223     ASSERT(pViewClass != NULL);
00224     ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
00225     ASSERT(AfxIsValidAddress(pViewClass, sizeof(CRuntimeClass), FALSE));
00226
00227     int nNewTab = 0;
00228     for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos)) {
00229         CTV_ITEM *pMember=m_views.GetAt(pos);
00230         if (pMember->pWnd->IsKindOf(pViewClass)) {
00231             //first hide old first view
00232             m_pActiveView->EnableWindow(FALSE);
00233             m_pActiveView->ShowWindow(SW_HIDE);
00234
00235             // set new active view
00236             m_pActiveView = (CView*)pMember->pWnd;
00237             // enable, show, set focus to new view
00238             m_pActiveView->EnableWindow(TRUE);
00239             m_pActiveView->ShowWindow(SW_SHOW);
00240             m_pActiveView->SetFocus();
00241
00242             // *** LiangYiBin.Donald
00243             //((CFrameWnd *)GetParent())->SetActiveView(m_pActiveView);
00244             //GetParentFrame()->SetActiveView(m_pActiveView);
00245
00246             m_nActiveTab = nNewTab;
00247             // select the tab
00248             m_pTabCtrl->SetCurSel(m_nActiveTab);
00249
00250             break;
00251         }
00252         nNewTab++;
00253     }
00254 }
00255
00256 void CCJTabView::SetActiveView(int nNewTab)
00257 {
00258     ASSERT_VALID(this);
00259     ASSERT(nNewTab >= 0);
00260
00261     if (nNewTab!=-1 && nNewTab!=m_nActiveTab) {
00262         CTV_ITEM *newMember=m_views.GetAt(m_views.FindIndex(nNewTab));
00263         CTV_ITEM *oldMember=NULL;
00264
00265         if (m_nActiveTab!=-1) {
00266             oldMember=m_views.GetAt(m_views.FindIndex(m_nActiveTab));
00267             oldMember->pWnd->EnableWindow(FALSE);
00268             oldMember->pWnd->ShowWindow(SW_HIDE);
00269         }
00270         newMember->pWnd->EnableWindow(TRUE);
00271         newMember->pWnd->ShowWindow(SW_SHOW);
00272         newMember->pWnd->SetFocus();
00273
00274         m_pActiveView = (CView *)newMember->pWnd;
00275
00276         m_nActiveTab = nNewTab;
00277         // select the tab (if tab programmatically changed)
00278         m_pTabCtrl->SetCurSel(m_nActiveTab);
00279     }
00280 }
00281
00282 CImageList* CCJTabView::SetTabImageList(CImageList *pImageList)
00283 {
00284     return m_pTabCtrl->SetImageList (pImageList);
00285 }
00286
00287 BOOL CCJTabView::AddView(LPCTSTR lpszLabel, CRuntimeClass *pViewClass, CDocument* pDoc/*=NULL*/, CCreateContext *pContext/*=NULL*/)
00288 {
00289
00290 #ifdef _DEBUG
00291     ASSERT_VALID(this);
00292     ASSERT(pViewClass != NULL);
00293     ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
00294     ASSERT(AfxIsValidAddress(pViewClass, sizeof(CRuntimeClass), FALSE));
00295 #endif
00296
00297     CCreateContext context;
00298     if (pContext == NULL)
00299     {
00300         context.m_pCurrentDoc       = pDoc;
00301         context.m_pCurrentFrame     = GetParentFrame();
00302         context.m_pLastView         = NULL;
00303         context.m_pNewDocTemplate   = NULL;
00304         context.m_pNewViewClass     = pViewClass;
00305         pContext = &context;
00306     }
00307
00308     CWnd* pWnd;
00309     TRY {
00310         pWnd = (CWnd*)pViewClass->CreateObject();
00311         if (pWnd == NULL)
00312             AfxThrowMemoryException();
00313     }
00314     CATCH_ALL(e) {
00315         TRACE0( "Out of memory creating a view.\n" );
00316         // Note: DELETE_EXCEPTION(e) not required
00317         return FALSE;
00318     }
00319     END_CATCH_ALL
00320
00321     ASSERT_KINDOF(CWnd, pWnd);
00322     ASSERT(pWnd->m_hWnd == NULL);       // not yet created
00323
00324     DWORD dwStyle = AFX_WS_DEFAULT_VIEW;
00325     CRect rect;
00326
00327     // Create with the right size and position
00328     if (!pWnd->Create(NULL, NULL, dwStyle, rect, this, 0, pContext))
00329     {
00330         TRACE0( "Warning: couldn't create client pane for view.\n" );
00331         // pWnd will be cleaned up by PostNcDestroy
00332         return FALSE;
00333     }
00334     m_pActiveView = (CView*) pWnd;
00335
00336     CTV_ITEM* pMember = new CTV_ITEM;
00337
00338     pMember->pWnd = pWnd;
00339
00340     _tcscpy( pMember->szLabel, lpszLabel );
00341
00342     m_views.AddTail(pMember);
00343
00344     // ToolTip support for tabs.
00345     if((m_views.GetCount()-1)==0) {
00346         m_pToolTip->AddTool( m_pTabCtrl, lpszLabel,
00347             NULL, m_views.GetCount()-1 );
00348     }
00349     else {
00350         m_pToolTip->AddTool( m_pTabCtrl, lpszLabel,
00351             CRect(0,0,0,0), m_views.GetCount()-1 );
00352     }
00353
00354     int nViews = m_views.GetCount();
00355     if (nViews != 1) {
00356         pWnd->EnableWindow(FALSE);
00357         pWnd->ShowWindow(SW_HIDE);
00358     }
00359
00360     TC_ITEM tci;
00361     tci.mask = TCIF_TEXT | TCIF_IMAGE;
00362     tci.pszText = (LPTSTR)(LPCTSTR)lpszLabel;
00363     tci.iImage = nViews-1;
00364     m_pTabCtrl->InsertItem(nViews, &tci);
00365
00366     CRect rcChild;
00367     CalcViewRect(&rcChild);
00368     m_pActiveView->MoveWindow(rcChild);
00369
00370     return TRUE;
00371 }
00372
00373 // Used for tab change notifications
00374 void CCJTabView::OnSelchange(NMHDR* /*pNMHDR*/, LRESULT* pResult)
00375 {
00376     SetActiveView(m_pTabCtrl->GetCurSel());
00377
00378     *pResult = 0;
00379 }
00380
00381 int CCJTabView::OnCreate(LPCREATESTRUCT lpCreateStruct)
00382 {
00383     if (CCtrlView::OnCreate(lpCreateStruct) == -1)
00384         return -1;
00385
00386     ASSERT(m_pTabCtrl);         // Should already be constructed
00387
00389     // Fixed bug with set parent and modifystyle which would cause the
00390     // application to lock up. - Kevin [klussier@redcreek.com].
00392     m_pTabCtrl->SetParent(CWnd::FromHandle(lpCreateStruct->hwndParent));
00393     m_pTabCtrl->ModifyStyleEx(WS_EX_NOPARENTNOTIFY, 0);
00394
00395     // Get the log font.
00396     NONCLIENTMETRICS ncm;
00397     ncm.cbSize = sizeof(NONCLIENTMETRICS);
00398     VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
00399         sizeof(NONCLIENTMETRICS), &ncm, 0));
00400     m_TabFont.CreateFontIndirect(&ncm.lfMessageFont);
00401     m_pTabCtrl->SetFont(&m_TabFont);
00402
00403 #ifdef _VC_VERSION_5
00404     m_pToolTip = m_pTabCtrl->GetTooltips();
00405     m_pTabCtrl->SetTooltips(m_pToolTip);
00406 #else
00407     m_pToolTip = m_pTabCtrl->GetToolTips();
00408     m_pTabCtrl->SetToolTips(m_pToolTip);
00409 #endif // _VC_VERSION_5
00410
00411     return 0;
00412 }
00413
00414 BOOL CCJTabView::OnEraseBkgnd(CDC* pDC)
00415 {
00416     CView *pView = GetActiveView();
00417     if ( pView )
00418     {
00419         // Exclude the embedded views
00420         // area from the erase - Andy
00421         CRect rectClient;
00422         pView->GetWindowRect( &rectClient );
00423         ScreenToClient( &rectClient );
00424         pDC->ExcludeClipRect( &rectClient );
00425     }
00426     return CCtrlView::OnEraseBkgnd(pDC);
00427 }
Generated on Sun Oct 21 12:41:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJToolBar.cpp Source File

WinCvs/CJLib/CJLibrary/CJToolBar.cpp

Go to the documentation of this file.
00001 // CJToolBar.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJToolBar.cpp $
00011  *
00012  * $History: CJToolBar.cpp $
00013  *
00014  * *****************  Version 18  *****************
00015  * User: Kirk Stowell Date: 10/30/99   Time: 1:56p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Removed Invalidate() calls from OnWindowPosChanging(...) to eliminate
00018  * screen flicker.
00019  *
00020  * *****************  Version 17  *****************
00021  * User: Kirk Stowell Date: 10/26/99   Time: 10:51p
00022  * Updated in $/CodeJock/CJLibrary
00023  * Added CCJFontCombo to the list of controls that can be inserted into a
00024  * CCJToolBar.
00025  *
00026  * *****************  Version 16  *****************
00027  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00028  * Updated in $/CodeJock/CJLibrary
00029  * Fixed potential resource and memory leak problems.
00030  *
00031  * *****************  Version 15  *****************
00032  * User: Kirk Stowell Date: 9/13/99    Time: 5:45a
00033  * Updated in $/CodeJockey/CJLibrary
00034  * Fixed initialization bug (small).
00035  *
00036  * *****************  Version 14  *****************
00037  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00038  * Updated in $/CodeJockey/CJLibrary
00039  * Updated copyright and contact information.
00040  *
00041  * *****************  Version 13  *****************
00042  * User: Kirk Stowell Date: 8/30/99    Time: 12:06a
00043  * Updated in $/CodeJockey/CJLibrary
00044  * Added support for CCJComboBoxEx control.
00045  *
00046  * *****************  Version 12  *****************
00047  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00048  * Updated in $/CodeJockey/CJLibrary
00049  * Added Unicode compliance, thanks to Barry Burton for his help with
00050  * this.
00051  *
00052  *
00053  * *****************  Version 10  *****************
00054  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00055  * Updated in $/CodeJockey/CJLibrary
00056  *
00057  * *****************  Version 6  *****************
00058  * User: Kirk Stowell Date: 7/18/99    Time: 10:20p
00059  * Updated in $/CodeJockey/CJLibrary
00060  * Re-wrote toolbar class for vc5 compatibility. Added customization based
00061  * on the "Customizable toolbar" article by Doug Keith -
00062  * http://www.codeguru.com/toolbar/customizable_tb.shtml.
00063  *
00064  * Cleaned up inline functions, and import/export macro so that class will
00065  * be imported when linked to, and exported at compile time.
00066  *
00067  * *****************  Version 5  *****************
00068  * User: Kirk Stowell Date: 4/03/99    Time: 11:44p
00069  * Updated in $/CodeJockey/CJ60Lib
00070  * Added comments and cleaned up code.
00071  *
00072  * *****************  Version 4  *****************
00073  * User: Kirk Stowell Date: 3/13/99    Time: 11:43p
00074  * Updated in $/CodeJockey/CJ60Lib
00075  * Changed class to handle both Office and DevStudio style to toolbars. To
00076  * use Office toolbars, use the CreateEx() method, otherwise your toolbars
00077  * will look like DevStudio.
00078  *
00079  * *****************  Version 3  *****************
00080  * User: Kirk Stowell Date: 12/14/98   Time: 11:42p
00081  * Updated in $/CodeJockey/CJ60Lib
00082  * Changed class to derive from Paul DiLascia's CToolBar, this class
00083  * adds gripper and control insertion.
00084  *
00085  * *****************  Version 2  *****************
00086  * User: Kirk Stowell Date: 11/02/98   Time: 11:41p
00087  * Updated in $/CodeJockey/CJ60Lib
00088  * Fixed bug with DrawNoGripper() method - (Christian Skovdal Andersen).
00089  *
00090  * *****************  Version 1  *****************
00091  * User: Kirk Stowell Date: 10/17/98   Time: 11:41p
00092  * Created in $/CodeJockey/CJ60Lib
00093  * Initial re-write and release.
00094  *
00095  ***************************************************************************/
00097
00098 #include "stdafx.h"
00099 #include "CJToolBar.h"
00100 #include "CJFlatComboBox.h"
00101 #include "CJComboBoxEx.h"
00102 #include "CJFontCombo.h"
00103 #include "CJMenu.h"        // CCJMenu class declaration
00104
00105 #ifdef _DEBUG
00106 #define new DEBUG_NEW
00107 #undef THIS_FILE
00108 static char THIS_FILE[] = __FILE__;
00109 #endif
00110
00111 #define IDC_CUSTOMIZE_BAR   0xFF
00112
00113 /*
00114 DIBs use RGBQUAD format:
00115 0xbb 0xgg 0xrr 0x00
00116
00117   Reasonably efficient code to convert a COLORREF into an
00118   RGBQUAD is byte-order-dependent, so we need different
00119   code depending on the byte order we're targeting.
00120 */
00121 #define _RGB_TO_RGBQUAD(r,g,b)   (RGB(b,g,r))
00122 #define _CLR_TO_RGBQUAD(clr)     (RGB(GetBValue(clr), GetGValue(clr), GetRValue(clr)))
00123
00124 struct CJX_COLORMAP
00125 {
00126     // use DWORD instead of RGBQUAD so we can compare two RGBQUADs easily
00127     DWORD rgbqFrom;
00128     int iSysColorTo;
00129 };
00130
00131 const CJX_COLORMAP _sysColorMap[] =
00132 {
00133     // mapping from color in DIB to system color
00134     { _RGB_TO_RGBQUAD(0x00, 0x00, 0x00),  COLOR_BTNTEXT },       // black
00135     { _RGB_TO_RGBQUAD(0x80, 0x80, 0x80),  COLOR_BTNSHADOW },     // dark gray
00136     { _RGB_TO_RGBQUAD(0xC0, 0xC0, 0xC0),  COLOR_BTNFACE },       // bright gray
00137     { _RGB_TO_RGBQUAD(0xFF, 0xFF, 0xFF),  COLOR_BTNHIGHLIGHT }   // white
00138 };
00139
00140 HBITMAP AFXAPI
00141 _LoadSysColorBitmap(HINSTANCE hInst, HRSRC hRsrc, BOOL bMono)
00142 {
00143     HGLOBAL hglb;
00144     if ((hglb = LoadResource(hInst, hRsrc)) == NULL)
00145         return NULL;
00146
00147     LPBITMAPINFOHEADER lpBitmap = (LPBITMAPINFOHEADER)LockResource(hglb);
00148     if (lpBitmap == NULL)
00149         return NULL;
00150
00151     // make copy of BITMAPINFOHEADER so we can modify the color table
00152     const int nColorTableSize = 16;
00153     UINT nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
00154     LPBITMAPINFOHEADER lpBitmapInfo = (LPBITMAPINFOHEADER)::malloc(nSize);
00155     if (lpBitmapInfo == NULL)
00156         return NULL;
00157     memcpy(lpBitmapInfo, lpBitmap, nSize);
00158
00159     // color table is in RGBQUAD DIB format
00160     DWORD* pColorTable =
00161         (DWORD*)(((LPBYTE)lpBitmapInfo) + (UINT)lpBitmapInfo->biSize);
00162
00163     for (int iColor = 0; iColor < nColorTableSize; iColor++)
00164     {
00165         // look for matching RGBQUAD color in original
00166         for (int i = 0; i < _countof(_sysColorMap); i++)
00167         {
00168             if (pColorTable[iColor] == _sysColorMap[i].rgbqFrom)
00169             {
00170                 if (bMono)
00171                 {
00172                     // all colors except text become white
00173                     if (_sysColorMap[i].iSysColorTo != COLOR_BTNTEXT)
00174                         pColorTable[iColor] = _RGB_TO_RGBQUAD(255, 255, 255);
00175                 }
00176                 else
00177                     pColorTable[iColor] =
00178                     _CLR_TO_RGBQUAD(::GetSysColor(_sysColorMap[i].iSysColorTo));
00179                 break;
00180             }
00181         }
00182     }
00183
00184     int nWidth = (int)lpBitmapInfo->biWidth;
00185     int nHeight = (int)lpBitmapInfo->biHeight;
00186     HDC hDCScreen = ::GetDC(NULL);
00187     HBITMAP hbm = ::CreateCompatibleBitmap(hDCScreen, nWidth, nHeight);
00188
00189     if (hbm != NULL)
00190     {
00191         HDC hDCGlyphs = ::CreateCompatibleDC(hDCScreen);
00192         HBITMAP hbmOld = (HBITMAP)::SelectObject(hDCGlyphs, hbm);
00193
00194         LPBYTE lpBits;
00195         lpBits = (LPBYTE)(lpBitmap + 1);
00196         lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
00197
00198         StretchDIBits(hDCGlyphs, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
00199             lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS, SRCCOPY);
00200         SelectObject(hDCGlyphs, hbmOld);
00201         ::DeleteDC(hDCGlyphs);
00202     }
00203     ::ReleaseDC(NULL, hDCScreen);
00204
00205     // free copy of bitmap info struct and resource itself
00206     ::free(lpBitmapInfo);
00207     ::FreeResource(hglb);
00208
00209     return hbm;
00210 }
00211
00212 #ifdef AFX_INIT_SEG
00213 #pragma code_seg(AFX_INIT_SEG)
00214 #endif
00215
00216 struct AFX_DLLVERSIONINFO
00217 {
00218     DWORD cbSize;
00219     DWORD dwMajorVersion;                   // Major version
00220     DWORD dwMinorVersion;                   // Minor version
00221     DWORD dwBuildNumber;                    // Build number
00222     DWORD dwPlatformID;                     // DLLVER_PLATFORM_*
00223 };
00224
00225 typedef HRESULT (CALLBACK* AFX_DLLGETVERSIONPROC)(AFX_DLLVERSIONINFO *);
00226
00227 int _ComCtlVersion = -1;
00228
00229 DWORD AFXAPI _GetComCtlVersion()
00230 {
00231     // return cached version if already determined...
00232     if (_ComCtlVersion != -1)
00233         return _ComCtlVersion;
00234
00235     // otherwise determine comctl32.dll version via DllGetVersion
00236     HINSTANCE hInst = ::GetModuleHandleA("COMCTL32.DLL");
00237     ASSERT(hInst != NULL);
00238     AFX_DLLGETVERSIONPROC pfn;
00239     pfn = (AFX_DLLGETVERSIONPROC)GetProcAddress(hInst, "DllGetVersion");
00240     DWORD dwVersion = VERSION_WIN4;
00241     if (pfn != NULL)
00242     {
00243         AFX_DLLVERSIONINFO dvi;
00244         memset(&dvi, 0, sizeof(dvi));
00245         dvi.cbSize = sizeof(dvi);
00246         HRESULT hr = (*pfn)(&dvi);
00247         if (SUCCEEDED(hr))
00248         {
00249             ASSERT(dvi.dwMajorVersion <= 0xFFFF);
00250             ASSERT(dvi.dwMinorVersion <= 0xFFFF);
00251             dwVersion = MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion);
00252         }
00253     }
00254     _ComCtlVersion = dwVersion;
00255     return dwVersion;
00256 }
00257
00258 struct CJX_CONTROLPOS {
00259     int             nIndex;
00260     int             nID;
00261     CRect           rectOldPos;
00262 } ;
00263
00264 int _dropDownWidth = -1;
00265
00266 int AFXAPI _GetDropDownWidth()
00267 {
00268     // return cached version if already determined...
00269     if (_dropDownWidth != -1)
00270         return _dropDownWidth;
00271
00272     // otherwise calculate it...
00273     HDC hDC = GetDC(NULL);
00274     ASSERT(hDC != NULL);
00275     HFONT hFont;
00276     if ((hFont = ::CreateFont(GetSystemMetrics(SM_CYMENUCHECK), 0, 0, 0,
00277         FW_NORMAL, 0, 0, 0, SYMBOL_CHARSET, 0, 0, 0, 0, _T("Marlett"))) != NULL)
00278     {
00279         HFONT hOldFont = (HFONT)::SelectObject(hDC, hFont);
00280
00281         VERIFY(GetCharWidth(hDC, '6', '6', &_dropDownWidth));
00282
00283         // fix potential resource leak - KStowell - 10-21-99
00284         if (hFont != NULL) {
00285             ::SelectObject(hDC, hOldFont);
00286             ::DeleteObject(hFont);
00287         }
00288     }
00289
00290     ::ReleaseDC(NULL, hDC);
00291     ASSERT(_dropDownWidth != -1);
00292     return _dropDownWidth;
00293 }
00294
00296 // CCJToolBar
00297
00298 int CCJToolBar::m_nBarNumber = 0;
00299
00300 CCJToolBar::CCJToolBar()
00301 {
00302     m_bShowDropArrow = false;
00303     m_pControls      = NULL;
00304     m_pDropButtons   = NULL;        // list of drop-down buttons
00305     m_nButtons       = 0;
00306     m_pBarInfo       = NULL;
00307     m_hKeyRoot       = HKEY_CURRENT_USER;
00308
00309     // get a pointer to the application.
00310     CWinApp* pApp = AfxGetApp();
00311     ASSERT( pApp );
00312
00313     ++m_nBarNumber;
00314     m_strValueName.Format( _T("CJToolBar %d"), m_nBarNumber );
00315     m_strSubKey.Format( _T("Software\\%s\\%s\\Settings"),
00316         pApp->m_pszRegistryKey, pApp->m_pszProfileName );
00317
00318     // initialize state
00319     m_pStringMap = NULL;
00320     m_hRsrcImageWell = NULL;
00321     m_hInstImageWell = NULL;
00322     m_hbmImageWell = NULL;
00323     m_bDelayedButtonLayout = TRUE;
00324
00325     // default image sizes
00326     m_sizeImage.cx = 16;
00327     m_sizeImage.cy = 15;
00328
00329     // default button sizes
00330     m_sizeButton.cx = 23;
00331     m_sizeButton.cy = 22;
00332
00333     // top and bottom borders are 1 larger than default for ease of grabbing
00334     m_cyTopBorder = 3;
00335     m_cyBottomBorder = 3;
00336     m_bExStyle = false;
00337 }
00338
00339 CCJToolBar::~CCJToolBar()
00340 {
00341     AfxDeleteObject((HGDIOBJ*)&m_hbmImageWell);
00342     delete m_pStringMap;
00343
00344     m_nCount = 0;
00345
00346     while (m_pDropButtons)
00347     {
00348         DROPDOWNBUTTON* pnext = m_pDropButtons->next;
00349         delete m_pDropButtons;
00350         m_pDropButtons = pnext;
00351     }
00352
00353     if( m_pControls ) {
00354         for( POSITION pos = m_pControls->GetHeadPosition() ; pos ; ) {
00355             delete m_pControls->GetNext(pos);
00356         }
00357         delete m_pControls;
00358     }
00359 }
00360
00361 BOOL CCJToolBar::Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID)
00362 {
00363     return CreateEx(pParentWnd, NULL, dwStyle,
00364         CRect(m_cxLeftBorder, m_cyTopBorder, m_cxRightBorder, m_cyBottomBorder), nID);
00365 }
00366
00367 BOOL CCJToolBar::CreateEx(CWnd* pParentWnd, DWORD dwCtrlStyle, DWORD dwStyle, CRect rcBorders, UINT nID)
00368 {
00369     ASSERT_VALID(pParentWnd);   // must have a parent
00370     ASSERT (!((dwStyle & CBRS_SIZE_FIXED) && (dwStyle & CBRS_SIZE_DYNAMIC)));
00371
00372     // KStowell - bool for drawing office style gripper.
00373     if( dwCtrlStyle != NULL )
00374         m_bExStyle = true;
00375
00376     SetBorders(rcBorders);
00377
00378     // save the style
00379     m_dwStyle = (dwStyle & CBRS_ALL)|( dwStyle & CBRS_GRIPPER );
00380     if (nID == AFX_IDW_TOOLBAR)
00381         m_dwStyle |= CBRS_HIDE_INPLACE;
00382
00383     dwStyle &= ~CBRS_ALL;
00384     dwStyle |= CCS_NOPARENTALIGN|CCS_NOMOVEY|CCS_NODIVIDER|CCS_NORESIZE;
00385     dwStyle |= dwCtrlStyle;
00386
00387     // initialize common controls
00388
00389 #ifdef _VC_VERSION_5
00390
00391     INITCOMMONCONTROLSEX icex;
00392     icex.dwSize = sizeof(icex);
00393     icex.dwICC = ICC_BAR_CLASSES;
00394     VERIFY(InitCommonControlsEx(&icex));
00395
00396 #else
00397
00398     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_BAR_REG));
00399
00400 #endif
00401
00402     _GetComCtlVersion();
00403     ASSERT(_ComCtlVersion != -1);
00404     _GetDropDownWidth();
00405     ASSERT(_dropDownWidth != -1);
00406
00407     // create the HWND
00408     CRect rect; rect.SetRectEmpty();
00409     if (!CWnd::Create(TOOLBARCLASSNAME, NULL, dwStyle, rect, pParentWnd, nID))
00410         return FALSE;
00411
00412     // sync up the sizes
00413     SetSizes(m_sizeButton, m_sizeImage);
00414
00415     // Note: Parent must resize itself for control bar to be resized
00416
00417     return TRUE;
00418 }
00419
00420 BOOL CCJToolBar::PreCreateWindow(CREATESTRUCT& cs)
00421 {
00422     if( !CCJToolBarBase::PreCreateWindow(cs))
00423         return FALSE;
00424
00425     cs.style |= TBSTYLE_TRANSPARENT|TBSTYLE_FLAT;
00426
00427     return TRUE;
00428 }
00429
00431 // 1999 Kirk Stowell - Inserts a control into the toolbar at the given button id.
00432 //
00433 CWnd* CCJToolBar::InsertControl( CRuntimeClass* pClass, LPCTSTR lpszWindowName, CRect& rect, UINT nID, DWORD dwStyle )
00434 {
00435     CWnd *pCtrl = NULL;
00436
00437     if( pClass->IsDerivedFrom( RUNTIME_CLASS( CCJComboBoxEx ))) // CCJComboBoxEx control.
00438     {
00439         pCtrl = new CCJComboBoxEx;
00440
00441         ASSERT_VALID( pCtrl );
00442
00443         if(((CCJComboBoxEx*)pCtrl)->Create( WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00444         {
00445             delete pCtrl;
00446             return NULL;
00447         }
00448     }
00449     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CCJFlatComboBox )))  // CCJFlatComboBox control.
00450     {
00451         pCtrl = new CCJFlatComboBox;
00452
00453         ASSERT_VALID( pCtrl );
00454
00455         if(((CCJFlatComboBox*)pCtrl)->Create( WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00456         {
00457             delete pCtrl;
00458             return NULL;
00459         }
00460     }
00461     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CCJFontCombo ))) // CCJFontCombo control.
00462     {
00463         pCtrl = new CCJFontCombo;
00464
00465         ASSERT_VALID( pCtrl );
00466
00467         if(((CCJFontCombo*)pCtrl)->Create( WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00468         {
00469             delete pCtrl;
00470             return NULL;
00471         }
00472     }
00473     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CComboBox )))    // CComboBox control.
00474     {
00475         pCtrl = new CComboBox;
00476
00477         ASSERT_VALID( pCtrl );
00478
00479         if(((CComboBox*)pCtrl)->Create( WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00480         {
00481             delete pCtrl;
00482             return NULL;
00483         }
00484     }
00485     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CEdit )))        // CEdit control.
00486     {
00487         pCtrl = new CEdit;
00488
00489         ASSERT_VALID( pCtrl );
00490
00491         if(((CEdit*)pCtrl)->Create( WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00492         {
00493             delete pCtrl;
00494             return NULL;
00495         }
00496     }
00497     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CButton )))      // CButton control.
00498     {
00499         pCtrl = new CButton;
00500
00501         ASSERT_VALID( pCtrl );
00502
00503         if(((CButton*)pCtrl)->Create( lpszWindowName, WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00504         {
00505             delete pCtrl;
00506             return NULL;
00507         }
00508     }
00509     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CWnd )))         // CWnd object.
00510     {
00511         pCtrl = new CWnd;
00512
00513         ASSERT_VALID( pCtrl );
00514
00515 #ifdef _UNICODE
00516         TCHAR szClassName[ 256 ];
00517
00518         MultiByteToWideChar( CP_ACP,
00519                              MB_PRECOMPOSED,
00520                              pClass->m_lpszClassName,
00521                              -1,
00522                              szClassName,
00523                              255 );
00524
00525         if(((CWnd*)pCtrl)->Create( szClassName, lpszWindowName, WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00526         {
00527             delete pCtrl;
00528             return NULL;
00529         }
00530 #else
00531         if(((CWnd*)pCtrl)->Create( pClass->m_lpszClassName, lpszWindowName, WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00532         {
00533             delete pCtrl;
00534             return NULL;
00535         }
00536 #endif
00537     }
00538     else                                                            // An invalid object was passed in
00539     {
00540         ASSERT( FALSE );
00541         return NULL;
00542     }
00543
00544     // if our object list has not been allocated, do it now...
00545     if( m_pControls == NULL )
00546     {
00547         m_pControls = new CObList();
00548         ASSERT( m_pControls );
00549     }
00550
00551     // we have to remember this control, so we can delete it later
00552     m_pControls->AddTail( pCtrl );
00553
00554     return InsertControl( pCtrl, rect, nID );
00555 }
00556
00557 CWnd* CCJToolBar::InsertControl(CWnd* pCtrl, CRect & rect, UINT nID)
00558 {
00559     ASSERT_VALID( pCtrl );
00560
00561     // make sure the id is valid, and set the button
00562     // style for a seperator.
00563     ASSERT( CommandToIndex( nID ) >= 0 );
00564     SetButtonInfo( CommandToIndex( nID ), nID, TBBS_SEPARATOR, rect.Width());
00565
00566     // insert the control into the toolbar.
00567     GetItemRect( CommandToIndex(nID), &rect );
00568     pCtrl->SetWindowPos(0, rect.left, rect.top, 0, 0,
00569         SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS );
00570     pCtrl->SetFont( GetFont( ));
00571     pCtrl->ShowWindow( SW_SHOW );
00572
00573     return pCtrl;
00574 }
00575
00577 // 1997 Microsoft Systems Journal - Written by Paul DiLascia.
00578 // call to add drop-down menus to toolbar buttons.
00579 //
00580 BOOL CCJToolBar::AddDropDownButton(UINT nIDButton, UINT nIDMenu, BOOL bArrow)
00581 {
00582     ASSERT_VALID(this);
00583
00584     DROPDOWNBUTTON* pb = FindDropDownButton(nIDButton);
00585     if (!pb) {
00586         pb = new DROPDOWNBUTTON;
00587         ASSERT(pb);
00588         pb->next = m_pDropButtons;
00589         m_pDropButtons = pb;
00590     }
00591     pb->idButton = nIDButton;
00592     pb->idMenu   = nIDMenu;
00593
00594     int iButton = CommandToIndex(nIDButton);
00595
00596     DWORD dwStyle = GetButtonStyle(iButton);
00597     dwStyle |= TBSTYLE_DROPDOWN;
00598     SetButtonStyle(iButton, dwStyle);
00599
00600     if (bArrow)
00601         SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
00602
00603     return TRUE;
00604 }
00605
00607 // 1997 Microsoft Systems Journal - Written by Paul DiLascia.
00608 // Find buttons structure for given ID
00609 //
00610 DROPDOWNBUTTON* CCJToolBar::FindDropDownButton(UINT nID)
00611 {
00612     for (DROPDOWNBUTTON* pb = m_pDropButtons; pb; pb = pb->next) {
00613         if (pb->idButton == nID)
00614             return pb;
00615     }
00616     return NULL;
00617 }
00618
00620 // 1997 Microsoft Systems Journal - Written by Paul DiLascia.
00621 // Message handler for TBN_DROPDOWN. Default is to display the
00622 // specified menu at the right place. You can override to generate dynamic menus
00623 //
00624 // Args:
00625 //      - NMTOOLBAR struct from TBN_DROPDOWN
00626 //      - command id of button
00627 //      - point to display menu at
00628 //
00629 void CCJToolBar::OnToolBarBtnDropDown(NMHDR* pNMHDR, LRESULT* pRes)
00630 {
00631     UNUSED_ALWAYS( pRes );
00632
00633     const NMTOOLBAR& nmtb = *(NMTOOLBAR*)pNMHDR;
00634
00635     // get location of button
00636     CRect rc;
00637     GetRect(nmtb.iItem, rc);
00638     ClientToScreen(&rc);
00639
00640     // call virtual function to display dropdown menu
00641     OnDropDownButton(nmtb, nmtb.iItem, rc);
00642 }
00643
00645 // 1997 Microsoft Systems Journal - Written by Paul DiLascia.
00646 // Virtual fn you can override to hand drop-down button
00647 // events with more friendly args
00648 //
00649 void CCJToolBar::OnDropDownButton(const NMTOOLBAR& nmtb, UINT nID, CRect rc)
00650 {
00651     UNUSED_ALWAYS( nID );
00652
00653     DROPDOWNBUTTON* pb = FindDropDownButton(nmtb.iItem);
00654     if (pb && pb->idMenu) {
00655
00656         // load and display popup menu
00657         CCJMenu menu;
00658         VERIFY(menu.LoadMenu(pb->idMenu));
00659         CCJMenu* pPopup = (CCJMenu*)menu.GetSubMenu(0);
00660         ASSERT(pPopup);
00661         pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL,
00662             rc.left, rc.bottom, GetParentFrame(), &rc);
00663     }
00664 }
00665
00667 // 1997 Microsoft Systems Journal - Written by Paul DiLascia.
00668 // Now toolbar has really moved: repaint area beneath old position
00669 //
00670 void CCJToolBar::OnWindowPosChanged(WINDOWPOS* lpwndpos)
00671 {
00672     CCJToolBarBase::OnWindowPosChanged(lpwndpos);
00673     if (!(lpwndpos->flags & SWP_NOMOVE)) {   // if moved:
00674         InvalidateOldPos(m_rcOldPos);        // invalidate area of old position
00675
00676         // Now paint my non-client area at the new location.
00677         // Without this, you will still have a partial display bug (try it!)
00678         SendMessage(WM_NCPAINT);
00679     }
00680 }
00681
00683 // 1997 Microsoft Systems Journal - Written by Paul DiLascia.
00684 // Invalidate toolbar rectangle. Because flat toolbars are transparent,
00685 // this requires invalidating parent and all siblings that intersect the
00686 // rectangle.
00687 //
00688 void CCJToolBar::InvalidateOldPos(const CRect& rcInvalid)
00689 {
00690     // make parent paint the area beneath rectangle
00691     CWnd* pParent = GetParent();        // parent (dock bar/frame) window
00692     ASSERT_VALID(pParent);              // check
00693     CRect rc( rcInvalid );              // copy rectangle
00694     pParent->ScreenToClient(&rc);       // convert to parent client coords
00695     pParent->InvalidateRect(&rc);       // invalidate
00696
00697     // now do same for each sibling too
00698     for (CWnd* pSib = pParent->GetWindow(GW_CHILD);
00699           pSib;
00700           pSib=pSib->GetNextWindow(GW_HWNDNEXT)) {
00701
00702         CRect rc;                                       // window rect of sibling
00703         pSib->GetWindowRect(&rc);                   // ...
00704         if (rc.IntersectRect(rc, rcInvalid)) {  // if intersects invalid rect
00705             pSib->ScreenToClient(&rc);              // convert to sibling coords
00706             pSib->InvalidateRect(&rc);              // invalidate
00707             pSib->SendMessage(WM_NCPAINT);      // nonclient area too!
00708         }
00709     }
00710 }
00711
00713 // 1997 Microsoft Systems Journal - Written by Paul DiLascia.
00714 // This is the all-important function that gets the true size of a button,
00715 // instead of using m_sizeButton. And it's virtual, so you can override if
00716 // my algorithm doesn't work, as will surely be the case in some circumstances.
00717 //
00718 CSize CCJToolBar::GetButtonSize(TBBUTTON* pData, int iButton)
00719 {
00720     ASSERT(_ComCtlVersion > 0);
00721
00722     // Get the actual size of the button, not what's in m_sizeButton.
00723     // Make sure to do SendMessage instead of calling MFC's GetItemRect,
00724     // which has all sorts of bad side-effects! (Go ahead, take a look at it.)
00725     //
00726     CRect rc;
00727     SendMessage(TB_GETITEMRECT, iButton, (LPARAM)&rc);
00728     CSize sz = rc.Size();
00729
00731     // Now must do special case for various versions of comctl32.dll,
00732     //
00733     DWORD dwStyle = pData[iButton].fsStyle;
00734     if ((pData[iButton].fsState & TBSTATE_WRAP)) {
00735         if (dwStyle & TBSTYLE_SEP) {
00736             // this is the last separator in the row (eg vertically docked)
00737             // fudge the height, and ignore the width. TB_GETITEMRECT will return
00738             // size = (8 x 22) even for a separator in vertical toolbar
00739             //
00740             if (_ComCtlVersion <= VERSION_IE3)
00741                 sz.cy -= 3;     // empircally good fudge factor
00742             else if (_ComCtlVersion != VERSION_IE4)
00743                 sz.cy = sz.cx;
00744             sz.cx = 0;          // separator takes no width if it's the last one
00745
00746         } else if (dwStyle & TBSTYLE_DROPDOWN && ( m_bShowDropArrow == false )) {
00747             // ignore width of dropdown
00748             sz.cx = 0;
00749         }
00750     }
00751     return sz;
00752 }
00753
00754 // This function saves the state (visible buttons, toolbar position, etc.)
00755 // of the toolbar, using the registry key provided to the Create(...) function.
00756 void CCJToolBar::SaveState()
00757 {
00758     // if there is an associated registry subkey
00759     if (m_strSubKey.GetLength())
00760     {
00761         // save the toolbar state to the registry
00762         GetToolBarCtrl().SaveState( m_hKeyRoot, m_strSubKey, m_strValueName );
00763     }
00764 }
00765
00766 // This function restores the state (visible buttons, toolbar position, etc.)
00767 // of the toolbar, using the registry key provided to the Create(...) function.
00768 void CCJToolBar::RestoreState()
00769 {
00770     // if there is an associated registry subkey
00771     if (m_strSubKey.GetLength())
00772     {
00773         // restore the toolbar state from the registry
00774         GetToolBarCtrl().RestoreState( m_hKeyRoot, m_strSubKey, m_strValueName );
00775     }
00776 }
00777
00778 // This function is called when the user begins dragging a toolbar
00779 // button or when the customization dialog is being populated with
00780 // toolbar information.  Basically, *pResult should be populated with
00781 // your answer to the question, "is the user allowed to delete this
00782 // button?".
00783 void CCJToolBar::OnToolBarQueryDelete(NMHDR *pNMHDR, LRESULT *pResult)
00784 {
00785     UNUSED_ALWAYS( pNMHDR );
00786
00787     // if we're not floating - user can delete anything
00788     *pResult = !IsFloating();
00789 }
00790
00791 // This function is called when the user begins dragging a toolbar
00792 // button or when the customization dialog is being populated with
00793 // toolbar information.  Basically, *pResult should be populated with
00794 // your answer to the question, "is the user allowed to insert a
00795 // button to the left of this one?".
00796 void CCJToolBar::OnToolBarQueryInsert(NMHDR *pNMHDR, LRESULT *pResult)
00797 {
00798     UNUSED_ALWAYS( pNMHDR );
00799
00800     // if we're not floating - user can insert anywhere
00801     *pResult = !IsFloating();
00802 }
00803
00804 // This function is called whenever the user makes a change to the
00805 // layout of the toolbar.  Calling the mainframe's RecalcLayout forces
00806 // the toolbar to repaint itself.
00807 void CCJToolBar::OnToolBarChange(NMHDR *pNMHDR, LRESULT *pResult)
00808 {
00809     UNUSED_ALWAYS( pNMHDR );
00810     UNUSED_ALWAYS( pResult );
00811
00812     // force the frame window to recalculate the size
00813     GetParentFrame()->RecalcLayout();
00814 }
00815
00816 // This function is called when the user begins dragging a toolbar button.
00817 void CCJToolBar::OnToolBarBeginDrag(NMHDR *pNMHDR, LRESULT *pResult)
00818 {
00819     UNUSED_ALWAYS( pNMHDR );
00820     UNUSED_ALWAYS( pResult );
00821 }
00822
00823 // This function is called when the user has completed a dragging operation.
00824 void CCJToolBar::OnToolBarEndDrag(NMHDR *pNMHDR, LRESULT *pResult)
00825 {
00826     UNUSED_ALWAYS( pNMHDR );
00827     UNUSED_ALWAYS( pResult );
00828 }
00829
00830 // This function is called when the user initially calls up the toolbar
00831 // customization dialog box.
00832 void CCJToolBar::OnToolBarBeginAdjust(NMHDR *pNMHDR, LRESULT *pResult)
00833 {
00834     UNUSED_ALWAYS( pNMHDR );
00835     UNUSED_ALWAYS( pResult );
00836 }
00837
00838 // This function is called when the user clicks on the help button on the
00839 // toolbar customization dialog box.
00840 void CCJToolBar::OnToolBarCustomHelp(NMHDR *pNMHDR, LRESULT *pResult)
00841 {
00842     UNUSED_ALWAYS( pNMHDR );
00843     UNUSED_ALWAYS( pResult );
00844 }
00845
00846 // This function is called when the user dismisses the toolbar customization
00847 // dialog box.
00848 void CCJToolBar::OnToolBarEndAdjust(NMHDR *pNMHDR, LRESULT *pResult)
00849 {
00850     UNUSED_ALWAYS( pNMHDR );
00851     UNUSED_ALWAYS( pResult );
00852
00853     // save the state of the toolbar for reinitialization
00854     SaveState();
00855 }
00856
00857 // This function is called to populate the toolbar customization dialog box
00858 // with information regarding all of the possible toolbar buttons.
00859 void CCJToolBar::OnToolBarGetButtonInfo(NMHDR *pNMHDR, LRESULT *pResult)
00860 {
00861     UNUSED_ALWAYS( pResult );
00862
00863     TBNOTIFY* tbStruct;     // data needed by customize dialog box
00864
00865     // init the pointer
00866     tbStruct = (TBNOTIFY *)pNMHDR;
00867
00868     // if the index is valid
00869     if (0 <= tbStruct->iItem && tbStruct->iItem < m_nButtons)
00870     {
00871         // copy the stored button structure
00872         tbStruct->tbButton = m_pBarInfo[tbStruct->iItem].tbButton;
00873
00874         // copy the text for the button label in the dialog
00875         _tcscpy( tbStruct->pszText, m_pBarInfo[tbStruct->iItem].btnText );
00876
00877         // indicate valid data was sent
00878         *pResult = TRUE;
00879     }
00880
00881     // else there is no button for this index
00882     else
00883     {
00884         *pResult = FALSE;
00885     }
00886 }
00887
00888 // This function is called when the user clicks on the reset button on the
00889 // toolbar customization dialog box.
00890 void CCJToolBar::OnToolBarReset(NMHDR *pNMHDR, LRESULT *pResult)
00891 {
00892     UNUSED_ALWAYS( pNMHDR );
00893     UNUSED_ALWAYS( pResult );
00894
00895     // restore the toolbar to the way it was before entering customization
00896     RestoreState();
00897 }
00898
00899 void CCJToolBar::OnDestroy()
00900 {
00901     // save the current state of the toolbar
00902     SaveState();
00903
00904     CCJToolBarBase::OnDestroy();
00905 }
00906
00907 void CCJToolBar::OnRButtonDown(UINT nFlags, CPoint point)
00908 {
00909     if( m_pBarInfo )
00910     {
00911         CPoint pt( point );
00912         ClientToScreen( &pt );
00913
00914         // load and display popup menu
00915         CCJMenu popupMenu;
00916         VERIFY(popupMenu.CreatePopupMenu( ));
00917         popupMenu.InsertMenu(0, MF_BYPOSITION, IDC_CUSTOMIZE_BAR, _T("&Customize..."));
00918         int nResult = popupMenu.TrackPopupMenu(
00919             TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL|TPM_RETURNCMD,
00920             pt.x, pt.y, this );
00921
00922         if( nResult == IDC_CUSTOMIZE_BAR )
00923         {
00924             // open the customization dialog.
00925             GetToolBarCtrl().Customize();
00926         }
00927     }
00928
00929     else {
00930         CCJToolBarBase::OnRButtonDown(nFlags, point);
00931     }
00932 }
00933
00935 // The remainder of this class is mostly copied straight from MFC ( vc6 ),
00936 // except for the modifications which are commented...
00938
00940 // CCJToolBar
00941
00942 BOOL CCJToolBar::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
00943 {
00944     // If the toolbar is inside a ReBar, we need to make the parent frame
00945     // the owner so it will get notifications.
00946     CWnd* pParent = GetParent();
00947     ASSERT(pParent);
00948     TCHAR classname[64];
00949     GetClassName(pParent->m_hWnd, classname, _countof(classname));
00950     if (_tcscmp(classname, REBARCLASSNAME)==0)
00951     {
00952         CFrameWnd* pFrame = GetParentFrame();
00953         ASSERT_VALID(pFrame);
00954         SetOwner(pFrame);
00955         m_bInReBar = true;
00956         m_bExStyle = false;
00957     }
00958
00959     if (!CCJToolBarBase::OnNcCreate(lpCreateStruct))
00960         return FALSE;
00961
00962     // if the owner was set before the toolbar was created, set it now
00963     if (m_hWndOwner != NULL)
00964         DefWindowProc(TB_SETPARENT, (WPARAM)m_hWndOwner, 0);
00965
00966     DefWindowProc(TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
00967     return TRUE;
00968 }
00969
00970 void CCJToolBar::SetOwner(CWnd* pOwnerWnd)
00971 {
00972     ASSERT_VALID(this);
00973     if (m_hWnd != NULL)
00974     {
00975         ASSERT(::IsWindow(m_hWnd));
00976         DefWindowProc(TB_SETPARENT, (WPARAM)pOwnerWnd->GetSafeHwnd(), 0);
00977     }
00978     CCJToolBarBase::SetOwner(pOwnerWnd);
00979 }
00980
00981 void CCJToolBar::SetSizes(SIZE sizeButton, SIZE sizeImage)
00982 {
00983     ASSERT_VALID(this);
00984
00985     // sizes must be non-zero and positive
00986     ASSERT(sizeButton.cx > 0 && sizeButton.cy > 0);
00987     ASSERT(sizeImage.cx > 0 && sizeImage.cy > 0);
00988
00989     // button must be big enough to hold image
00990     //   + 7 pixels on x
00991     //   + 6 pixels on y
00992     ASSERT(sizeButton.cx >= sizeImage.cx + 7);
00993     ASSERT(sizeButton.cy >= sizeImage.cy + 6);
00994
00995     if (::IsWindow(m_hWnd))
00996     {
00997         // set the sizes via TB_SETBITMAPSIZE and TB_SETBUTTONSIZE
00998         VERIFY(SendMessage(TB_SETBITMAPSIZE, 0, MAKELONG(sizeImage.cx, sizeImage.cy)));
00999         VERIFY(SendMessage(TB_SETBUTTONSIZE, 0, MAKELONG(sizeButton.cx, sizeButton.cy)));
01000
01001         Invalidate();   // just to be nice if called when toolbar is visible
01002     }
01003     else
01004     {
01005         // just set our internal values for later
01006         m_sizeButton = sizeButton;
01007         m_sizeImage = sizeImage;
01008     }
01009 }
01010
01011 void CCJToolBar::SetHeight(int cyHeight)
01012 {
01013     ASSERT_VALID(this);
01014
01015     int nHeight = cyHeight;
01016     if (m_dwStyle & CBRS_BORDER_TOP)
01017         cyHeight -= afxData.cyBorder2;
01018     if (m_dwStyle & CBRS_BORDER_BOTTOM)
01019         cyHeight -= afxData.cyBorder2;
01020     m_cyBottomBorder = (cyHeight - m_sizeButton.cy) / 2;
01021     // if there is an extra pixel, m_cyTopBorder will get it
01022     m_cyTopBorder = cyHeight - m_sizeButton.cy - m_cyBottomBorder;
01023     if (m_cyTopBorder < 0)
01024     {
01025         TRACE1("Warning: CCJToolBar::SetHeight(%d) is smaller than button.\n",
01026             nHeight);
01027         m_cyBottomBorder += m_cyTopBorder;
01028         m_cyTopBorder = 0;  // will clip at bottom
01029     }
01030
01031     // recalculate the non-client region
01032     SetWindowPos(NULL, 0, 0, 0, 0,
01033         SWP_DRAWFRAME|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOZORDER);
01034     Invalidate();   // just to be nice if called when toolbar is visible
01035 }
01036
01037 struct CToolBarData
01038 {
01039     WORD wVersion;
01040     WORD wWidth;
01041     WORD wHeight;
01042     WORD wItemCount;
01043     //WORD aItems[wItemCount]
01044
01045     WORD* items()
01046         { return (WORD*)(this+1); }
01047 };
01048
01049 BOOL CCJToolBar::LoadToolBar(LPCTSTR lpszResourceName, TOOLBARINFO* pBarInfo)
01050 {
01051     ASSERT_VALID(this);
01052     ASSERT(lpszResourceName != NULL);
01053
01054     // determine location of the bitmap in resource fork
01055     HINSTANCE hInst = AfxFindResourceHandle(lpszResourceName, RT_TOOLBAR);
01056     HRSRC hRsrc = ::FindResource(hInst, lpszResourceName, RT_TOOLBAR);
01057     if (hRsrc == NULL)
01058         return FALSE;
01059
01060     HGLOBAL hGlobal = LoadResource(hInst, hRsrc);
01061     if (hGlobal == NULL)
01062         return FALSE;
01063
01064     CToolBarData* pData = (CToolBarData*)LockResource(hGlobal);
01065     if (pData == NULL)
01066         return FALSE;
01067     ASSERT(pData->wVersion == 1);
01068
01069     UINT* pItems = new UINT[pData->wItemCount];
01070     for (int i = 0; i < pData->wItemCount; i++)
01071         pItems[i] = pData->items()[i];
01072     BOOL bResult = SetButtons(pItems, pData->wItemCount);
01073     delete[] pItems;
01074
01075     if (bResult)
01076     {
01077         // set new sizes of the buttons
01078         CSize sizeImage(pData->wWidth, pData->wHeight);
01079         CSize sizeButton(pData->wWidth + 7, pData->wHeight + 7);
01080         SetSizes(sizeButton, sizeImage);
01081
01082         // load bitmap now that sizes are known by the toolbar control
01083         bResult = LoadBitmap(lpszResourceName);
01084     }
01085
01086     UnlockResource(hGlobal);
01087     FreeResource(hGlobal);
01088
01089     // is the toolbar is customizable?
01090     if(( pBarInfo ) && ( bResult )) {
01091         m_pBarInfo = pBarInfo;
01092         m_nButtons = GetToolBarCtrl().GetButtonCount();
01093
01094         // modify the style to include adjustable
01095         ModifyStyle(0, CCS_ADJUSTABLE);
01096         RestoreState();
01097     }
01098
01099
01100     return bResult;
01101 }
01102
01103 BOOL CCJToolBar::LoadBitmap(LPCTSTR lpszResourceName)
01104 {
01105     ASSERT_VALID(this);
01106     ASSERT(lpszResourceName != NULL);
01107
01108     // determine location of the bitmap in resource fork
01109     HINSTANCE hInstImageWell = AfxFindResourceHandle(lpszResourceName, RT_BITMAP);
01110     HRSRC hRsrcImageWell = ::FindResource(hInstImageWell, lpszResourceName, RT_BITMAP);
01111     if (hRsrcImageWell == NULL)
01112         return FALSE;
01113
01114     // load the bitmap
01115     HBITMAP hbmImageWell;
01116     hbmImageWell = _LoadSysColorBitmap(hInstImageWell, hRsrcImageWell);
01117
01118     // tell common control toolbar about the new bitmap
01119     if (!AddReplaceBitmap(hbmImageWell))
01120         return FALSE;
01121
01122     // remember the resource handles so the bitmap can be recolored if necessary
01123     m_hInstImageWell = hInstImageWell;
01124     m_hRsrcImageWell = hRsrcImageWell;
01125     return TRUE;
01126 }
01127
01128 BOOL CCJToolBar::SetBitmap(HBITMAP hbmImageWell)
01129 {
01130     ASSERT_VALID(this);
01131     ASSERT(hbmImageWell != NULL);
01132
01133     // the caller must manage changing system colors
01134     m_hInstImageWell = NULL;
01135     m_hRsrcImageWell = NULL;
01136
01137     // tell common control toolbar about the new bitmap
01138     return AddReplaceBitmap(hbmImageWell);
01139 }
01140
01141 BOOL CCJToolBar::AddReplaceBitmap(HBITMAP hbmImageWell)
01142 {
01143     // need complete bitmap size to determine number of images
01144     BITMAP bitmap;
01145     VERIFY(::GetObject(hbmImageWell, sizeof(BITMAP), &bitmap));
01146
01147     // add the bitmap to the common control toolbar
01148     BOOL bResult;
01149     if (m_hbmImageWell == NULL)
01150     {
01151         TBADDBITMAP addBitmap;
01152         addBitmap.hInst = NULL; // makes TBADDBITMAP::nID behave a HBITMAP
01153         addBitmap.nID = (UINT)hbmImageWell;
01154         bResult =  DefWindowProc(TB_ADDBITMAP,
01155             bitmap.bmWidth / m_sizeImage.cx, (LPARAM)&addBitmap) == 0;
01156     }
01157     else
01158     {
01159         TBREPLACEBITMAP replaceBitmap;
01160         replaceBitmap.hInstOld = NULL;
01161         replaceBitmap.nIDOld = (UINT)m_hbmImageWell;
01162         replaceBitmap.hInstNew = NULL;
01163         replaceBitmap.nIDNew = (UINT)hbmImageWell;
01164         replaceBitmap.nButtons = bitmap.bmWidth / m_sizeImage.cx;
01165         bResult = (BOOL)DefWindowProc(TB_REPLACEBITMAP, 0,
01166             (LPARAM)&replaceBitmap);
01167     }
01168     // remove old bitmap, if present
01169     if (bResult)
01170     {
01171         AfxDeleteObject((HGDIOBJ*)&m_hbmImageWell);
01172         m_hbmImageWell = hbmImageWell;
01173     }
01174
01175     return bResult;
01176 }
01177
01178 BOOL CCJToolBar::SetButtons(const UINT* lpIDArray, int nIDCount)
01179 {
01180     ASSERT_VALID(this);
01181     ASSERT(nIDCount >= 1);  // must be at least one of them
01182     ASSERT(lpIDArray == NULL ||
01183         AfxIsValidAddress(lpIDArray, sizeof(UINT) * nIDCount, FALSE));
01184
01185     // delete all existing buttons
01186     int nCount = (int)DefWindowProc(TB_BUTTONCOUNT, 0, 0);
01187     while (nCount--)
01188         VERIFY(DefWindowProc(TB_DELETEBUTTON, 0, 0));
01189
01190     TBBUTTON button; memset(&button, 0, sizeof(TBBUTTON));
01191     button.iString = -1;
01192     if (lpIDArray != NULL)
01193     {
01194         // add new buttons to the common control
01195         int iImage = 0;
01196         for (int i = 0; i < nIDCount; i++)
01197         {
01198             button.fsState = TBSTATE_ENABLED;
01199             if ((button.idCommand = *lpIDArray++) == 0)
01200             {
01201                 // separator
01202                 button.fsStyle = TBSTYLE_SEP;
01203                 // width of separator includes 8 pixel overlap
01204                 ASSERT(_ComCtlVersion != -1);
01205                 if ((GetStyle() & TBSTYLE_FLAT) || _ComCtlVersion == VERSION_IE4)
01206                     button.iBitmap = 6;
01207                 else
01208                     button.iBitmap = 8;
01209             }
01210             else
01211             {
01212                 // a command button with image
01213                 button.fsStyle = TBSTYLE_BUTTON;
01214                 button.iBitmap = iImage++;
01215             }
01216             if (!DefWindowProc(TB_ADDBUTTONS, 1, (LPARAM)&button))
01217                 return FALSE;
01218         }
01219     }
01220     else
01221     {
01222         // add 'blank' buttons
01223         button.fsState = TBSTATE_ENABLED;
01224         for (int i = 0; i < nIDCount; i++)
01225         {
01226             ASSERT(button.fsStyle == TBSTYLE_BUTTON);
01227             if (!DefWindowProc(TB_ADDBUTTONS, 1, (LPARAM)&button))
01228                 return FALSE;
01229         }
01230     }
01231     m_nCount = (int)DefWindowProc(TB_BUTTONCOUNT, 0, 0);
01232     m_bDelayedButtonLayout = TRUE;
01233
01234     return TRUE;
01235 }
01236
01237 #ifdef AFX_CORE3_SEG
01238 #pragma code_seg(AFX_CORE3_SEG)
01239 #endif
01240
01242 // CCJToolBar attribute access
01243
01244 void CCJToolBar::GetButton(int nIndex, TBBUTTON* pButton) const
01245 {
01246     CCJToolBar* pBar = (CCJToolBar*)this;
01247     VERIFY(pBar->DefWindowProc(TB_GETBUTTON, nIndex, (LPARAM)pButton));
01248     // TBSTATE_ENABLED == TBBS_DISABLED so invert it
01249     pButton->fsState ^= TBSTATE_ENABLED;
01250 }
01251
01252 void CCJToolBar::SetButton(int nIndex, TBBUTTON* pButton)
01253 {
01254     // get original button state
01255     TBBUTTON button;
01256     VERIFY(DefWindowProc(TB_GETBUTTON, nIndex, (LPARAM)&button));
01257
01258     // prepare for old/new button comparsion
01259     button.bReserved[0] = 0;
01260     button.bReserved[1] = 0;
01261     // TBSTATE_ENABLED == TBBS_DISABLED so invert it
01262     pButton->fsState ^= TBSTATE_ENABLED;
01263     pButton->bReserved[0] = 0;
01264     pButton->bReserved[1] = 0;
01265
01266     // nothing to do if they are the same
01267     if (memcmp(pButton, &button, sizeof(TBBUTTON)) != 0)
01268     {
01269         // don't redraw everything while setting the button
01270         DWORD dwStyle = GetStyle();
01271         ModifyStyle(WS_VISIBLE, 0);
01272         VERIFY(DefWindowProc(TB_DELETEBUTTON, nIndex, 0));
01273         VERIFY(DefWindowProc(TB_INSERTBUTTON, nIndex, (LPARAM)pButton));
01274         ModifyStyle(0, dwStyle & WS_VISIBLE);
01275
01276         // invalidate appropriate parts
01277         if (((pButton->fsStyle ^ button.fsStyle) & TBSTYLE_SEP) ||
01278             ((pButton->fsStyle & TBSTYLE_SEP) && pButton->iBitmap != button.iBitmap))
01279         {
01280             // changing a separator
01281             Invalidate();
01282         }
01283         else
01284         {
01285             // invalidate just the button
01286             CRect rect;
01287             if (DefWindowProc(TB_GETITEMRECT, nIndex, (LPARAM)&rect))
01288                 InvalidateRect(rect);
01289         }
01290     }
01291 }
01292
01293 int CCJToolBar::CommandToIndex(UINT nIDFind) const
01294 {
01295     ASSERT_VALID(this);
01296     ASSERT(::IsWindow(m_hWnd));
01297
01298     CCJToolBar* pBar = (CCJToolBar*)this;
01299     return (int)pBar->DefWindowProc(TB_COMMANDTOINDEX, nIDFind, 0);
01300 }
01301
01302 UINT CCJToolBar::GetItemID(int nIndex) const
01303 {
01304     ASSERT_VALID(this);
01305     ASSERT(::IsWindow(m_hWnd));
01306
01307     TBBUTTON button;
01308     GetButton(nIndex, &button);
01309     return button.idCommand;
01310 }
01311
01312 void CCJToolBar::GetItemRect(int nIndex, LPRECT lpRect) const
01313 {
01314     ASSERT_VALID(this);
01315     ASSERT(::IsWindow(m_hWnd));
01316
01317     // handle any delayed layout
01318     if (m_bDelayedButtonLayout)
01319         ((CCJToolBar*)this)->Layout();
01320
01321     // now it is safe to get the item rectangle
01322     CCJToolBar* pBar = (CCJToolBar*)this;
01323     if (!pBar->DefWindowProc(TB_GETITEMRECT, nIndex, (LPARAM)lpRect))
01324         SetRectEmpty(lpRect);
01325 }
01326
01327 void CCJToolBar::Layout()
01328 {
01329     ASSERT(m_bDelayedButtonLayout);
01330
01331     m_bDelayedButtonLayout = FALSE;
01332
01333     BOOL bHorz = (m_dwStyle & CBRS_ORIENT_HORZ) != 0;
01334     if ((m_dwStyle & CBRS_FLOATING) && (m_dwStyle & CBRS_SIZE_DYNAMIC))
01335         ((CCJToolBar*)this)->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH | LM_COMMIT);
01336     else if (bHorz)
01337         ((CCJToolBar*)this)->CalcDynamicLayout(0, LM_HORZ | LM_HORZDOCK | LM_COMMIT);
01338     else
01339         ((CCJToolBar*)this)->CalcDynamicLayout(0, LM_VERTDOCK | LM_COMMIT);
01340 }
01341
01342 UINT CCJToolBar::GetButtonStyle(int nIndex) const
01343 {
01344     ASSERT_VALID(this);
01345     ASSERT(::IsWindow(m_hWnd));
01346
01347     TBBUTTON button;
01348     GetButton(nIndex, &button);
01349     return MAKELONG(button.fsStyle, button.fsState);
01350 }
01351
01352 void CCJToolBar::SetButtonStyle(int nIndex, UINT nStyle)
01353 {
01354     ASSERT_VALID(this);
01355     ASSERT(::IsWindow(m_hWnd));
01356
01357     TBBUTTON button;
01358     GetButton(nIndex, &button);
01359     if (button.fsStyle != (BYTE)LOWORD(nStyle) || button.fsState != (BYTE)HIWORD(nStyle))
01360     {
01361         button.fsStyle = (BYTE)LOWORD(nStyle);
01362         button.fsState = (BYTE)HIWORD(nStyle);
01363         SetButton(nIndex, &button);
01364         m_bDelayedButtonLayout = TRUE;
01365     }
01366 }
01367
01368 #define CX_OVERLAP  0
01369
01370 CSize CCJToolBar::CalcSize(TBBUTTON* pData, int nCount)
01371 {
01372     ASSERT(pData != NULL && nCount > 0);
01373
01374     CPoint cur(0,0);
01375     CSize sizeResult(0,0);
01376     int cyTallestOnRow = 0;
01377
01378     for (int i = 0; i < nCount; i++)
01379     {
01380         if (pData[i].fsState & TBSTATE_HIDDEN)
01381             continue;
01382
01383         // **PD**
01384         // Load actual size of button into a local variable
01385         // called m_sizeButton. C++ will use this instead of
01386         // CToolBar::m_sizeButton.
01387         //
01388         CSize m_sizeButton = GetButtonSize(pData, i);
01389
01390         // **PD**
01391         // I also changed the logic below to be more correct.
01392         cyTallestOnRow = max(cyTallestOnRow, m_sizeButton.cy);
01393         sizeResult.cx = max(cur.x + m_sizeButton.cx, sizeResult.cx);
01394         sizeResult.cy = max(cur.y + m_sizeButton.cy, sizeResult.cy);
01395
01396         cur.x += m_sizeButton.cx - CX_OVERLAP;
01397
01398         if (pData[i].fsState & TBSTATE_WRAP)
01399         {
01400             cur.x = 0;
01401             cur.y += cyTallestOnRow;
01402             cyTallestOnRow = 0;
01403             if (pData[i].fsStyle & TBSTYLE_SEP)
01404                 cur.y += m_sizeButton.cy;
01405         }
01406     }
01407     return sizeResult;
01408 }
01409
01410 int CCJToolBar::WrapToolBar(TBBUTTON* pData, int nCount, int nWidth)
01411 {
01412     ASSERT(pData != NULL && nCount > 0);
01413
01414     int nResult = 0;
01415     int x = 0;
01416     for (int i = 0; i < nCount; i++)
01417     {
01418         pData[i].fsState &= ~TBSTATE_WRAP;
01419
01420         if (pData[i].fsState & TBSTATE_HIDDEN)
01421             continue;
01422
01423         int dx, dxNext;
01424
01425         // **PD**
01426         // Load actual size of button into a local variable
01427         // called m_sizeButton. C++ will use this instead of
01428         // CToolBar::m_sizeButton.
01429         //
01430         CSize m_sizeButton = GetButtonSize(pData, i);
01431
01432         dx = m_sizeButton.cx;
01433         dxNext = dx - CX_OVERLAP;
01434
01435         if (x + dx > nWidth)
01436         {
01437             BOOL bFound = FALSE;
01438             for (int j = i; j >= 0  &&  !(pData[j].fsState & TBSTATE_WRAP); j--)
01439             {
01440                 // Find last separator that isn't hidden
01441                 // a separator that has a command ID is not
01442                 // a separator, but a custom control.
01443                 if ((pData[j].fsStyle & TBSTYLE_SEP) &&
01444                     (pData[j].idCommand == 0) &&
01445                     !(pData[j].fsState & TBSTATE_HIDDEN))
01446                 {
01447                     bFound = TRUE; i = j; x = 0;
01448                     pData[j].fsState |= TBSTATE_WRAP;
01449                     nResult++;
01450                     break;
01451                 }
01452             }
01453             if (!bFound)
01454             {
01455                 for (int j = i - 1; j >= 0 && !(pData[j].fsState & TBSTATE_WRAP); j--)
01456                 {
01457                     // Never wrap anything that is hidden,
01458                     // or any custom controls
01459                     if ((pData[j].fsState & TBSTATE_HIDDEN) ||
01460                         ((pData[j].fsStyle & TBSTYLE_SEP) &&
01461                         (pData[j].idCommand != 0)))
01462                         continue;
01463
01464                     bFound = TRUE; i = j; x = 0;
01465                     pData[j].fsState |= TBSTATE_WRAP;
01466                     nResult++;
01467                     break;
01468                 }
01469                 if (!bFound)
01470                     x += dxNext;
01471             }
01472         }
01473         else
01474             x += dxNext;
01475     }
01476     return nResult + 1;
01477 }
01478
01479 void CCJToolBar::SizeToolBar(TBBUTTON* pData, int nCount, int nLength, BOOL bVert)
01480 {
01481     ASSERT(pData != NULL && nCount > 0);
01482
01483     if (!bVert)
01484     {
01485         int nMin, nMax, nTarget, nCurrent, nMid;
01486
01487         // Wrap ToolBar as specified
01488         nMax = nLength;
01489         nTarget = WrapToolBar(pData, nCount, nMax);
01490
01491         // Wrap ToolBar vertically
01492         nMin = 0;
01493         nCurrent = WrapToolBar(pData, nCount, nMin);
01494
01495         if (nCurrent != nTarget)
01496         {
01497             while (nMin < nMax)
01498             {
01499                 nMid = (nMin + nMax) / 2;
01500                 nCurrent = WrapToolBar(pData, nCount, nMid);
01501
01502                 if (nCurrent == nTarget)
01503                     nMax = nMid;
01504                 else
01505                 {
01506                     if (nMin == nMid)
01507                     {
01508                         WrapToolBar(pData, nCount, nMax);
01509                         break;
01510                     }
01511                     nMin = nMid;
01512                 }
01513             }
01514         }
01515         CSize size = CalcSize(pData, nCount);
01516         WrapToolBar(pData, nCount, size.cx);
01517     }
01518     else
01519     {
01520         CSize sizeMax, sizeMin, sizeMid;
01521
01522         // Wrap ToolBar vertically
01523         WrapToolBar(pData, nCount, 0);
01524         sizeMin = CalcSize(pData, nCount);
01525
01526         // Wrap ToolBar horizontally
01527         WrapToolBar(pData, nCount, 32767);
01528         sizeMax = CalcSize(pData, nCount);
01529
01530         while (sizeMin.cx < sizeMax.cx)
01531         {
01532             sizeMid.cx = (sizeMin.cx + sizeMax.cx) / 2;
01533             WrapToolBar(pData, nCount, sizeMid.cx);
01534             sizeMid = CalcSize(pData, nCount);
01535
01536             if (nLength < sizeMid.cy)
01537             {
01538                 if (sizeMin == sizeMid)
01539                 {
01540                     WrapToolBar(pData, nCount, sizeMax.cx);
01541                     return;
01542                 }
01543                 sizeMin = sizeMid;
01544             }
01545             else if (nLength > sizeMid.cy)
01546                 sizeMax = sizeMid;
01547             else
01548                 return;
01549         }
01550     }
01551 }
01552
01553 CSize CCJToolBar::CalcLayout(DWORD dwMode, int nLength)
01554 {
01555     ASSERT_VALID(this);
01556     ASSERT(::IsWindow(m_hWnd));
01557     if (dwMode & LM_HORZDOCK)
01558         ASSERT(dwMode & LM_HORZ);
01559
01560     int nCount;
01561     TBBUTTON* pData = NULL;
01562     CSize sizeResult(0,0);
01563
01564     //BLOCK: Load Buttons
01565     {
01566         nCount = DefWindowProc(TB_BUTTONCOUNT, 0, 0);
01567         if (nCount != 0)
01568         {
01569             int i;
01570             pData = new TBBUTTON[nCount];
01571             for (i = 0; i < nCount; i++)
01572                 GetButton(i, &pData[i]);
01573         }
01574     }
01575
01576     if (nCount > 0)
01577     {
01578         if (!(m_dwStyle & CBRS_SIZE_FIXED))
01579         {
01580             BOOL bDynamic = m_dwStyle & CBRS_SIZE_DYNAMIC;
01581
01582             if (bDynamic && (dwMode & LM_MRUWIDTH))
01583                 SizeToolBar(pData, nCount, m_nMRUWidth);
01584             else if (bDynamic && (dwMode & LM_HORZDOCK))
01585                 SizeToolBar(pData, nCount, 32767);
01586             else if (bDynamic && (dwMode & LM_VERTDOCK))
01587                 SizeToolBar(pData, nCount, 0);
01588             else if (bDynamic && (nLength != -1))
01589             {
01590                 CRect rect; rect.SetRectEmpty();
01591                 CalcInsideRect(rect, (dwMode & LM_HORZ));
01592                 BOOL bVert = (dwMode & LM_LENGTHY);
01593                 int nLen = nLength + (bVert ? rect.Height() : rect.Width());
01594
01595                 SizeToolBar(pData, nCount, nLen, bVert);
01596             }
01597             else if (bDynamic && (m_dwStyle & CBRS_FLOATING))
01598                 SizeToolBar(pData, nCount, m_nMRUWidth);
01599             else
01600                 SizeToolBar(pData, nCount, (dwMode & LM_HORZ) ? 32767 : 0);
01601         }
01602
01603         sizeResult = CalcSize(pData, nCount);
01604
01605         if (dwMode & LM_COMMIT)
01606         {
01607             CJX_CONTROLPOS* pControl = NULL;
01608             int nControlCount = 0;
01609             BOOL bIsDelayed = m_bDelayedButtonLayout;
01610             m_bDelayedButtonLayout = FALSE;
01611
01612             for (int i = 0; i < nCount; i++)
01613                 if ((pData[i].fsStyle & TBSTYLE_SEP) && (pData[i].idCommand != 0))
01614                     nControlCount++;
01615
01616             if (nControlCount > 0)
01617             {
01618                 pControl = new CJX_CONTROLPOS[nControlCount];
01619                 nControlCount = 0;
01620
01621                 for(int i = 0; i < nCount; i++)
01622                 {
01623                     if ((pData[i].fsStyle & TBSTYLE_SEP) && (pData[i].idCommand != 0))
01624                     {
01625                         pControl[nControlCount].nIndex = i;
01626                         pControl[nControlCount].nID = pData[i].idCommand;
01627
01628                         CRect rect;
01629                         GetItemRect(i, &rect);
01630                         ClientToScreen(&rect);
01631                         pControl[nControlCount].rectOldPos = rect;
01632
01633                         nControlCount++;
01634                     }
01635                 }
01636             }
01637
01638             if ((m_dwStyle & CBRS_FLOATING) && (m_dwStyle & CBRS_SIZE_DYNAMIC))
01639                 m_nMRUWidth = sizeResult.cx;
01640             for (i = 0; i < nCount; i++)
01641                 SetButton(i, &pData[i]);
01642
01643             if (nControlCount > 0)
01644             {
01645                 for (int i = 0; i < nControlCount; i++)
01646                 {
01647                     CWnd* pWnd = GetDlgItem(pControl[i].nID);
01648                     if (pWnd != NULL)
01649                     {
01650                         CRect rect;
01651                         pWnd->GetWindowRect(&rect);
01652                         CPoint pt = rect.TopLeft() - pControl[i].rectOldPos.TopLeft();
01653                         GetItemRect(pControl[i].nIndex, &rect);
01654                         pt = rect.TopLeft() + pt;
01655                         pWnd->SetWindowPos(NULL, pt.x, pt.y, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
01656                     }
01657                 }
01658                 delete[] pControl;
01659             }
01660             m_bDelayedButtonLayout = bIsDelayed;
01661         }
01662         delete[] pData;
01663     }
01664
01665     //BLOCK: Adjust Margins
01666     {
01667         CRect rect; rect.SetRectEmpty();
01668         CalcInsideRect(rect, (dwMode & LM_HORZ));
01669         sizeResult.cy -= rect.Height();
01670         sizeResult.cx -= rect.Width();
01671
01672         CSize size = CCJToolBarBase::CalcFixedLayout((dwMode & LM_STRETCH), (dwMode & LM_HORZ));
01673         sizeResult.cx = max(sizeResult.cx, size.cx);
01674         sizeResult.cy = max(sizeResult.cy, size.cy);
01675     }
01676     return sizeResult;
01677 }
01678
01679 CSize CCJToolBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
01680 {
01681     DWORD dwMode = bStretch ? LM_STRETCH : 0;
01682     dwMode |= bHorz ? LM_HORZ : 0;
01683
01684     return CalcLayout(dwMode);
01685 }
01686
01687 CSize CCJToolBar::CalcDynamicLayout(int nLength, DWORD dwMode)
01688 {
01689     if ((nLength == -1) && !(dwMode & LM_MRUWIDTH) && !(dwMode & LM_COMMIT) &&
01690         ((dwMode & LM_HORZDOCK) || (dwMode & LM_VERTDOCK)))
01691     {
01692         return CalcFixedLayout(dwMode & LM_STRETCH, dwMode & LM_HORZDOCK);
01693     }
01694     return CalcLayout(dwMode, nLength);
01695 }
01696
01697 void CCJToolBar::GetButtonInfo(int nIndex, UINT& nID, UINT& nStyle, int& iImage) const
01698 {
01699     ASSERT_VALID(this);
01700     ASSERT(::IsWindow(m_hWnd));
01701
01702     TBBUTTON button;
01703     GetButton(nIndex, &button);
01704     nID = button.idCommand;
01705     nStyle = MAKELONG(button.fsStyle, button.fsState);
01706     iImage = button.iBitmap;
01707 }
01708
01709 void CCJToolBar::SetButtonInfo(int nIndex, UINT nID, UINT nStyle, int iImage)
01710 {
01711     ASSERT_VALID(this);
01712
01713     TBBUTTON button;
01714     GetButton(nIndex, &button);
01715     TBBUTTON save;
01716     memcpy(&save, &button, sizeof(save));
01717     button.idCommand = nID;
01718     button.iBitmap = iImage;
01719     button.fsStyle = (BYTE)LOWORD(nStyle);
01720     button.fsState = (BYTE)HIWORD(nStyle);
01721     if (memcmp(&save, &button, sizeof(save)) != 0)
01722     {
01723         SetButton(nIndex, &button);
01724         m_bDelayedButtonLayout = TRUE;
01725     }
01726 }
01727
01728 int CCJToolBar::OnToolHitTest(CPoint point, TOOLINFO* pTI) const
01729 {
01730     ASSERT_VALID(this);
01731     ASSERT(::IsWindow(m_hWnd));
01732
01733     // check child windows first by calling CCJToolBarBase
01734     int nHit = CCJToolBarBase::OnToolHitTest(point, pTI);
01735     if (nHit != -1)
01736         return nHit;
01737
01738     // now hit test against CCJToolBar buttons
01739     CCJToolBar* pBar = (CCJToolBar*)this;
01740     int nButtons = (int)pBar->DefWindowProc(TB_BUTTONCOUNT, 0, 0);
01741     for (int i = 0; i < nButtons; i++)
01742     {
01743         CRect rect;
01744         TBBUTTON button;
01745         if (pBar->DefWindowProc(TB_GETITEMRECT, i, (LPARAM)&rect))
01746         {
01747             ++rect.bottom;
01748             ++rect.right;
01749             if (rect.PtInRect(point) &&
01750                 pBar->DefWindowProc(TB_GETBUTTON, i, (LPARAM)&button) &&
01751                 !(button.fsStyle & TBSTYLE_SEP))
01752             {
01753                 int nHit = GetItemID(i);
01754                 if (pTI != NULL && pTI->cbSize >= sizeof(AFX_OLDTOOLINFO))
01755                 {
01756                     pTI->hwnd = m_hWnd;
01757                     pTI->rect = rect;
01758                     pTI->uId = nHit;
01759                     pTI->lpszText = LPSTR_TEXTCALLBACK;
01760                 }
01761                 // found matching rect, return the ID of the button
01762                 return nHit != 0 ? nHit : -1;
01763             }
01764         }
01765     }
01766     return -1;
01767 }
01768
01769 BOOL CCJToolBar::SetButtonText(int nIndex, LPCTSTR lpszText)
01770 {
01771     // attempt to lookup string index in map
01772     int nString = -1;
01773     void* p;
01774     if (m_pStringMap != NULL && m_pStringMap->Lookup(lpszText, p))
01775         nString = (int)p;
01776
01777     // add new string if not already in map
01778     if (nString == -1)
01779     {
01780         // initialize map if necessary
01781         if (m_pStringMap == NULL)
01782             m_pStringMap = new CMapStringToPtr;
01783
01784         // add new string to toolbar list
01785         CString strTemp(lpszText, lstrlen(lpszText)+1);
01786         nString = (int)DefWindowProc(TB_ADDSTRING, 0, (LPARAM)(LPCTSTR)strTemp);
01787         if (nString == -1)
01788             return FALSE;
01789
01790         // cache string away in string map
01791         m_pStringMap->SetAt(lpszText, (void*)nString);
01792         ASSERT(m_pStringMap->Lookup(lpszText, p));
01793     }
01794
01795     // change the toolbar button description
01796     TBBUTTON button;
01797     GetButton(nIndex, &button);
01798     button.iString = nString;
01799     SetButton(nIndex, &button);
01800
01801     return TRUE;
01802 }
01803
01804 CString CCJToolBar::GetButtonText(int nIndex) const
01805 {
01806     CString strResult;
01807     GetButtonText(nIndex, strResult);
01808     return strResult;
01809 }
01810
01811 void CCJToolBar::GetButtonText(int nIndex, CString& rString) const
01812 {
01813     if (m_pStringMap != NULL)
01814     {
01815         // get button information (need button.iString)
01816         TBBUTTON button;
01817         GetButton(nIndex, &button);
01818
01819         // look in map for matching iString
01820         POSITION pos = m_pStringMap->GetStartPosition();
01821         CString str; void* p;
01822         while (pos)
01823         {
01824             m_pStringMap->GetNextAssoc(pos, str, p);
01825             if ((int)p == button.iString)
01826             {
01827                 rString = str;
01828                 return;
01829             }
01830         }
01831     }
01832     rString.Empty();
01833 }
01834
01836 // CCJToolBar message handlers
01837
01838 BEGIN_MESSAGE_MAP(CCJToolBar, CCJToolBarBase)
01839     //{{AFX_MSG_MAP(CCJToolBar)
01840     ON_WM_NCHITTEST()
01841     ON_WM_NCPAINT()
01842     ON_WM_PAINT()
01843     ON_WM_NCCALCSIZE()
01844     ON_WM_WINDOWPOSCHANGING()
01845     ON_WM_WINDOWPOSCHANGED()
01846     ON_WM_SYSCOLORCHANGE()
01847     ON_MESSAGE(TB_SETBUTTONSIZE, OnSetButtonSize)
01848     ON_MESSAGE(TB_SETBITMAPSIZE, OnSetBitmapSize)
01849     ON_WM_NCCREATE()
01850     ON_WM_ERASEBKGND()
01851     ON_WM_DESTROY()
01852     ON_WM_RBUTTONDOWN()
01853     ON_MESSAGE(WM_SETTINGCHANGE, OnPreserveZeroBorderHelper)
01854     //}}AFX_MSG_MAP
01855     ON_MESSAGE(WM_SETFONT, OnPreserveZeroBorderHelper)
01856     ON_NOTIFY_REFLECT(TBN_DROPDOWN,      OnToolBarBtnDropDown)
01857     ON_NOTIFY_REFLECT(TBN_BEGINADJUST,   OnToolBarBeginAdjust)
01858     ON_NOTIFY_REFLECT(TBN_BEGINDRAG,     OnToolBarBeginDrag)
01859     ON_NOTIFY_REFLECT(TBN_CUSTHELP,      OnToolBarCustomHelp)
01860     ON_NOTIFY_REFLECT(TBN_ENDADJUST,     OnToolBarEndAdjust)
01861     ON_NOTIFY_REFLECT(TBN_ENDDRAG,       OnToolBarEndDrag)
01862     ON_NOTIFY_REFLECT(TBN_GETBUTTONINFO, OnToolBarGetButtonInfo)
01863     ON_NOTIFY_REFLECT(TBN_QUERYDELETE,   OnToolBarQueryDelete)
01864     ON_NOTIFY_REFLECT(TBN_QUERYINSERT,   OnToolBarQueryInsert)
01865     ON_NOTIFY_REFLECT(TBN_RESET,         OnToolBarReset)
01866     ON_NOTIFY_REFLECT(TBN_TOOLBARCHANGE, OnToolBarChange)
01867 END_MESSAGE_MAP()
01868
01870 // Override to avoid MFC in case I'm inside a ReBar
01871 //
01872 BOOL CCJToolBar::OnEraseBkgnd(CDC*)
01873 {
01874     return (BOOL)Default();
01875 }
01876
01877 UINT CCJToolBar::OnNcHitTest(CPoint)
01878 {
01879     return HTCLIENT;
01880 }
01881
01883 // Calcluate size of client area. Adds room for grippers
01884 //
01885 void CCJToolBar::OnNcCalcSize(BOOL /*bCalcValidRects*/, NCCALCSIZE_PARAMS* lpncsp)
01886 {
01887     // calculate border space (will add to top/bottom, subtract from right/bottom)
01888     CRect rect; rect.SetRectEmpty();
01889     BOOL bHorz = (m_dwStyle & CBRS_ORIENT_HORZ) != 0;
01890     CCJToolBarBase::CalcInsideRect(rect, bHorz);
01891     ASSERT(_ComCtlVersion != -1);
01892     ASSERT(_ComCtlVersion >= VERSION_IE4 || rect.top >= 2);
01893
01894     // adjust non-client area for border space
01895     lpncsp->rgrc[0].left += rect.left;
01896     lpncsp->rgrc[0].top += rect.top;
01897     // previous versions of COMCTL32.DLL had a built-in 2 pixel border
01898     if (_ComCtlVersion < VERSION_IE4)
01899         lpncsp->rgrc[0].top -= 2;
01900     lpncsp->rgrc[0].right += rect.right;
01901     lpncsp->rgrc[0].bottom += rect.bottom;
01902 }
01903
01905 // **PD**
01906 // Part 2 of correction for MFC is to recalculate everything when the bar
01907 // goes from docked to undocked because the AdjustSize calculation happens
01908 // when the bar is in the old state, and thus wrong. After the bar is
01909 // docked/undocked, I'll recalculate with the new style and commit the change.
01910 //
01911 void CCJToolBar::OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle)
01912 {
01913     // a dynamically resizeable toolbar can not have the CBRS_FLOAT_MULTI
01914     ASSERT(!((dwNewStyle & CBRS_SIZE_DYNAMIC) &&
01915         (m_dwDockStyle & CBRS_FLOAT_MULTI)));
01916
01917     // a toolbar can not be both dynamic and fixed in size
01918     ASSERT (!((dwNewStyle & CBRS_SIZE_FIXED) &&
01919         (dwNewStyle & CBRS_SIZE_DYNAMIC)));
01920
01921     // CBRS_SIZE_DYNAMIC can not be disabled once it has been enabled
01922     ASSERT (((dwOldStyle & CBRS_SIZE_DYNAMIC) == 0) ||
01923         ((dwNewStyle & CBRS_SIZE_DYNAMIC) != 0));
01924
01925     if (m_hWnd != NULL &&
01926         ((dwOldStyle & CBRS_BORDER_ANY) != (dwNewStyle & CBRS_BORDER_ANY)))
01927     {
01928         // recalc non-client area when border styles change
01929         SetWindowPos(NULL, 0, 0, 0, 0,
01930             SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DRAWFRAME);
01931     }
01932     m_bDelayedButtonLayout = TRUE;
01933
01934     if (dwOldStyle != dwNewStyle) {
01935         DWORD dwMode = 0;
01936         if ((dwNewStyle & CBRS_SIZE_DYNAMIC) && (dwNewStyle & CBRS_FLOATING))
01937             dwMode = LM_HORZ | LM_MRUWIDTH;
01938         else if (dwNewStyle & CBRS_ORIENT_HORZ)
01939             dwMode = LM_HORZ | LM_HORZDOCK;
01940         else
01941             dwMode =  LM_VERTDOCK;
01942
01943         CalcDynamicLayout(-1, dwMode | LM_COMMIT);
01944     }
01945 }
01946
01947 void CCJToolBar::OnNcPaint()
01948 {
01949     EraseNonClient();
01950 }
01951
01952 void CCJToolBar::OnWindowPosChanging(LPWINDOWPOS lpwndpos)
01953 {
01954     // not necessary to invalidate the borders
01955     DWORD dwStyle = m_dwStyle;
01956     m_dwStyle &= ~(CBRS_BORDER_ANY);
01957     CCJToolBarBase::OnWindowPosChanging(lpwndpos);
01958     m_dwStyle = dwStyle;
01959 }
01960
01961 void CCJToolBar::OnPaint()
01962 {
01963     if (m_bDelayedButtonLayout)
01964         Layout();
01965
01966     Default();
01967 }
01968
01969 LRESULT CCJToolBar::OnSetButtonSize(WPARAM, LPARAM lParam)
01970 {
01971     return OnSetSizeHelper(m_sizeButton, lParam);
01972 }
01973
01974 LRESULT CCJToolBar::OnSetBitmapSize(WPARAM, LPARAM lParam)
01975 {
01976     return OnSetSizeHelper(m_sizeImage, lParam);
01977 }
01978
01979 LRESULT CCJToolBar::OnSetSizeHelper(CSize& size, LPARAM lParam)
01980 {
01981     //WINBUG: The IE4 version of COMCTL32.DLL supports a zero border, but
01982     //  only if TBSTYLE_TRANSPARENT is on during the the TB_SETBITMAPSIZE
01983     //  and/or TB_SETBUTTONSIZE messages.  In order to enable this feature
01984     //  all the time (so we get consistent border behavior, dependent only
01985     //  on the version of COMCTL32.DLL) we turn on TBSTYLE_TRANSPARENT
01986     //  whenever these messages go through.  It would be nice that in a
01987     //  future version, the system toolbar would just allow you to set
01988     //  the top and left borders to anything you please.
01989
01990     BOOL bModify = FALSE;
01991     ASSERT(_ComCtlVersion != -1);
01992     DWORD dwStyle = 0;
01993     if (_ComCtlVersion >= VERSION_IE4)
01994     {
01995         dwStyle = GetStyle();
01996         bModify = ModifyStyle(0, TBSTYLE_TRANSPARENT|TBSTYLE_FLAT);
01997     }
01998
01999     LRESULT lResult = Default();
02000     if (lResult)
02001         size = lParam;
02002
02003     if (bModify)
02004         SetWindowLong(m_hWnd, GWL_STYLE, dwStyle);
02005
02006     return lResult;
02007 }
02008
02009 LRESULT CCJToolBar::OnPreserveZeroBorderHelper(WPARAM, LPARAM lParam)
02010 {
02011     UNUSED_ALWAYS( lParam );
02012
02013     BOOL bModify = FALSE;
02014     ASSERT(_ComCtlVersion != -1);
02015     DWORD dwStyle = 0;
02016     if (_ComCtlVersion >= VERSION_IE4)
02017     {
02018         dwStyle = GetStyle();
02019         bModify = ModifyStyle(0, TBSTYLE_TRANSPARENT|TBSTYLE_FLAT);
02020     }
02021
02022     LRESULT lResult = Default();
02023
02024     if (bModify)
02025         SetWindowLong(m_hWnd, GWL_STYLE, dwStyle);
02026
02027     return lResult;
02028 }
02029
02030 void CCJToolBar::OnSysColorChange()
02031 {
02032     // re-color bitmap for toolbar
02033     if (m_hInstImageWell != NULL && m_hbmImageWell != NULL)
02034     {
02035         HBITMAP hbmNew;
02036         hbmNew = _LoadSysColorBitmap(m_hInstImageWell, m_hRsrcImageWell);
02037         if (hbmNew != NULL)
02038             AddReplaceBitmap(hbmNew);
02039     }
02040 }
02041
02043 // CCJToolBar idle update through CCJToolCmdUI class
02044
02045 class CCJToolCmdUI : public CCmdUI        // class private to this file !
02046 {
02047 public: // re-implementations only
02048     virtual void Enable(BOOL bOn);
02049     virtual void SetCheck(int nCheck);
02050     virtual void SetText(LPCTSTR lpszText);
02051 };
02052
02053 void CCJToolCmdUI::Enable(BOOL bOn)
02054 {
02055     m_bEnableChanged = TRUE;
02056     CCJToolBar* pToolBar = (CCJToolBar*)m_pOther;
02057     ASSERT(pToolBar != NULL);
02058     ASSERT_KINDOF(CCJToolBar, pToolBar);
02059     ASSERT(m_nIndex < m_nIndexMax);
02060
02061     UINT nNewStyle = pToolBar->GetButtonStyle(m_nIndex) & ~TBBS_DISABLED;
02062     if (!bOn)
02063     {
02064         nNewStyle |= TBBS_DISABLED;
02065         // WINBUG: If a button is currently pressed and then is disabled
02066         // COMCTL32.DLL does not unpress the button, even after the mouse
02067         // button goes up!  We work around this bug by forcing TBBS_PRESSED
02068         // off when a button is disabled.
02069         nNewStyle &= ~TBBS_PRESSED;
02070     }
02071     ASSERT(!(nNewStyle & TBBS_SEPARATOR));
02072     pToolBar->SetButtonStyle(m_nIndex, nNewStyle);
02073 }
02074
02075 void CCJToolCmdUI::SetCheck(int nCheck)
02076 {
02077     ASSERT(nCheck >= 0 && nCheck <= 2); // 0=>off, 1=>on, 2=>indeterminate
02078     CCJToolBar* pToolBar = (CCJToolBar*)m_pOther;
02079     ASSERT(pToolBar != NULL);
02080     ASSERT_KINDOF(CCJToolBar, pToolBar);
02081     ASSERT(m_nIndex < m_nIndexMax);
02082
02083     UINT nNewStyle = pToolBar->GetButtonStyle(m_nIndex) &
02084                 ~(TBBS_CHECKED | TBBS_INDETERMINATE);
02085     if (nCheck == 1)
02086         nNewStyle |= TBBS_CHECKED;
02087     else if (nCheck == 2)
02088         nNewStyle |= TBBS_INDETERMINATE;
02089     ASSERT(!(nNewStyle & TBBS_SEPARATOR));
02090     pToolBar->SetButtonStyle(m_nIndex, nNewStyle | TBBS_CHECKBOX);
02091 }
02092
02093 void CCJToolCmdUI::SetText(LPCTSTR)
02094 {
02095     // ignore it
02096 }
02097
02098 void CCJToolBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
02099 {
02100     CCJToolCmdUI state;
02101     state.m_pOther = this;
02102
02103     state.m_nIndexMax = (UINT)DefWindowProc(TB_BUTTONCOUNT, 0, 0);
02104     for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax; state.m_nIndex++)
02105     {
02106         // get buttons state
02107         TBBUTTON button;
02108         GetButton(state.m_nIndex, &button);
02109         state.m_nID = button.idCommand;
02110
02111         // ignore separators
02112         if (!(button.fsStyle & TBSTYLE_SEP))
02113         {
02114             // allow reflections
02115             if (CWnd::OnCmdMsg(0,
02116                 MAKELONG((int)CN_UPDATE_COMMAND_UI, WM_COMMAND+WM_REFLECT_BASE),
02117                 &state, NULL))
02118                 continue;
02119
02120             // allow the toolbar itself to have update handlers
02121             if (CWnd::OnCmdMsg(state.m_nID, CN_UPDATE_COMMAND_UI, &state, NULL))
02122                 continue;
02123
02124             // allow the owner to process the update
02125             state.DoUpdate(pTarget, bDisableIfNoHndler);
02126         }
02127     }
02128
02129     // update the dialog controls added to the toolbar
02130     UpdateDialogControls(pTarget, bDisableIfNoHndler);
02131 }
02132
02134 // CCJToolBar diagnostics
02135
02136 #ifdef _DEBUG
02137 void CCJToolBar::AssertValid() const
02138 {
02139     // Note: CCJToolBarBase::AssertValid is not called because it checks for
02140     //  m_nCount and m_pData to be in sync, which they are not in CCJToolBar.
02141
02142 #ifndef _VC_VERSION_5
02143     ASSERT(m_hbmImageWell == NULL ||
02144         ( afxData.bWin95 || ::GetObjectType(m_hbmImageWell) == OBJ_BITMAP));
02145 #else
02146     ASSERT(m_hbmImageWell == NULL ||
02147         ( ::GetObjectType(m_hbmImageWell) == OBJ_BITMAP));
02148 #endif
02149
02150     if (m_hInstImageWell != NULL && m_hbmImageWell != NULL)
02151         ASSERT(m_hRsrcImageWell != NULL);
02152 }
02153
02154 void CCJToolBar::Dump(CDumpContext& dc) const
02155 {
02156     CCJToolBarBase::Dump(dc);
02157
02158     dc << "m_hbmImageWell = " << (UINT)m_hbmImageWell;
02159     dc << "\nm_hInstImageWell = " << (UINT)m_hInstImageWell;
02160     dc << "\nm_hRsrcImageWell = " << (UINT)m_hRsrcImageWell;
02161     dc << "\nm_sizeButton = " << m_sizeButton;
02162     dc << "\nm_sizeImage = " << m_sizeImage;
02163
02164     if (dc.GetDepth() > 0)
02165     {
02166         CCJToolBar* pBar = (CCJToolBar*)this;
02167         int nCount = pBar->DefWindowProc(TB_BUTTONCOUNT, 0, 0);
02168         for (int i = 0; i < nCount; i++)
02169         {
02170             TBBUTTON button;
02171             GetButton(i, &button);
02172             dc << "\ntoolbar button[" << i << "] = {";
02173             dc << "\n\tnID = " << button.idCommand;
02174             dc << "\n\tnStyle = " << MAKELONG(button.fsStyle, button.fsState);
02175             if (button.fsStyle & TBSTYLE_SEP)
02176                 dc << "\n\tiImage (separator width) = " << button.iBitmap;
02177             else
02178                 dc <<"\n\tiImage (bitmap image index) = " << button.iBitmap;
02179             dc << "\n}";
02180         }
02181     }
02182
02183     dc << "\n";
02184 }
02185 #endif
02186
02187 #ifdef AFX_INIT_SEG
02188 #pragma code_seg(AFX_INIT_SEG)
02189 #endif
02190
02191 IMPLEMENT_DYNAMIC(CCJToolBar, CCJToolBarBase)
02192
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJToolBarBase.cpp Source File

WinCvs/CJLib/CJLibrary/CJToolBarBase.cpp

Go to the documentation of this file.
00001 // CJToolBarBase.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new IE4 controls'
00007 // http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/CJLibrary/CJToolBarBase.cpp $
00015  *
00016  * $History: CJToolBarBase.cpp $
00017  *
00018  * *****************  Version 5  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/CJLibrary
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 4  *****************
00024  * User: Kirk Stowell Date: 7/28/99    Time: 12:38a
00025  * Updated in $/CodeJockey/CJLibrary
00026  * Final pass for release 6.08.
00027  *
00028  * *****************  Version 3  *****************
00029  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00030  * Updated in $/CodeJockey/CJLibrary
00031  *
00032  * *****************  Version 2  *****************
00033  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00034  * Updated in $/CodeJockey/CJLibrary
00035  *
00036  * *****************  Version 1  *****************
00037  * User: Kirk Stowell Date: 7/14/99    Time: 10:29p
00038  * Created in $/CodeJockey/CJLibrary
00039  * Copied from MFC v6 and techno preview for v5. Added to extend
00040  * functionality to Visual C++ 5.0 users.
00041  *
00042  ***************************************************************************/
00043
00044 #include "stdafx.h"
00045 #include "CJToolBarBase.h"
00046
00047 #ifdef _DEBUG
00048 #define new DEBUG_NEW
00049 #undef THIS_FILE
00050 static char THIS_FILE[] = __FILE__;
00051 #endif
00052
00054 // CCJToolBarBase
00055
00056 CCJToolBarBase::CCJToolBarBase()
00057 {
00058     m_bInReBar = false;
00059     m_bExStyle = false;
00060 }
00061
00062 CCJToolBarBase::~CCJToolBarBase()
00063 {
00064
00065 }
00066
00067 BEGIN_MESSAGE_MAP(CCJToolBarBase, CControlBar)
00068     //{{AFX_MSG_MAP(CCJToolBarBase)
00069     ON_WM_PAINT()
00070     ON_WM_WINDOWPOSCHANGING()
00071     //}}AFX_MSG_MAP
00072 END_MESSAGE_MAP()
00073
00074 void CCJToolBarBase::SetBorders(int cxLeft, int cyTop, int cxRight, int cyBottom)
00075 {
00076     ASSERT(cxLeft >= 0);
00077     ASSERT(cyTop >= 0);
00078     ASSERT(cxRight >= 0);
00079     ASSERT(cyBottom >= 0);
00080
00081     m_cxLeftBorder = cxLeft;
00082     m_cyTopBorder = cyTop;
00083     m_cxRightBorder = cxRight;
00084     m_cyBottomBorder = cyBottom;
00085 }
00086
00087 LRESULT CCJToolBarBase::WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)
00088 {
00089     ASSERT_VALID(this);
00090
00091     LRESULT lResult;
00092     switch (nMsg)
00093     {
00094     case WM_NOTIFY:
00095     case WM_COMMAND:
00096     case WM_DRAWITEM:
00097     case WM_MEASUREITEM:
00098     case WM_DELETEITEM:
00099     case WM_COMPAREITEM:
00100     case WM_VKEYTOITEM:
00101     case WM_CHARTOITEM:
00102         // send these messages to the owner if not handled
00103         if (OnWndMsg(nMsg, wParam, lParam, &lResult))
00104             return lResult;
00105         else
00106         {
00107             // try owner next
00108             lResult = GetOwner()->SendMessage(nMsg, wParam, lParam);
00109
00110             // special case for TTN_NEEDTEXTA and TTN_NEEDTEXTW
00111             if(nMsg == WM_NOTIFY)
00112             {
00113                 NMHDR* pNMHDR = (NMHDR*)lParam;
00114                 if (pNMHDR->code == TTN_NEEDTEXTA || pNMHDR->code == TTN_NEEDTEXTW)
00115                 {
00116                     TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
00117                     TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
00118                     if ((pNMHDR->code == TTN_NEEDTEXTA && (!pTTTA->lpszText || !*pTTTA->lpszText)) ||
00119                         (pNMHDR->code == TTN_NEEDTEXTW && (!pTTTW->lpszText || !*pTTTW->lpszText)))
00120                     {
00121                         // not handled by owner, so let bar itself handle it
00122                         lResult = CWnd::WindowProc(nMsg, wParam, lParam);
00123                     }
00124                 }
00125             }
00126             return lResult;
00127         }
00128     }
00129
00130     // otherwise, just handle in default way
00131     lResult = CWnd::WindowProc(nMsg, wParam, lParam);
00132     return lResult;
00133 }
00134
00135 void CCJToolBarBase::OnWindowPosChanging(LPWINDOWPOS lpWndPos)
00136 {
00137     // WINBUG: We call DefWindowProc here instead of CWnd::OnWindowPosChanging
00138     //  (which calls CWnd::Default, which calls through the super wndproc)
00139     //  because certain control bars that are system implemented (such as
00140     //  CToolBar with TBSTYLE_FLAT) do not implement WM_WINDOWPOSCHANGING
00141     //  correctly, causing repaint problems.  This code bypasses that whole
00142     //  mess.
00143     ::DefWindowProc(m_hWnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)lpWndPos);
00144
00145     if (lpWndPos->flags & SWP_NOSIZE)
00146         return;
00147
00148     // invalidate borders on the right
00149     CRect rect;
00150     GetWindowRect(&rect);
00151     CSize sizePrev = rect.Size();
00152     int cx = lpWndPos->cx;
00153     int cy = lpWndPos->cy;
00154     if (cx != sizePrev.cx && (m_dwStyle & CBRS_BORDER_RIGHT))
00155     {
00156         rect.SetRect(cx-afxData.cxBorder2, 0, cx, cy);
00157         InvalidateRect(&rect);
00158         rect.SetRect(sizePrev.cx-afxData.cxBorder2, 0, sizePrev.cx, cy);
00159         InvalidateRect(&rect);
00160     }
00161
00162     // invalidate borders on the bottom
00163     if (cy != sizePrev.cy && (m_dwStyle & CBRS_BORDER_BOTTOM))
00164     {
00165         rect.SetRect(0, cy-afxData.cyBorder2, cx, cy);
00166         InvalidateRect(&rect);
00167         rect.SetRect(0, sizePrev.cy-afxData.cyBorder2, cx, sizePrev.cy);
00168         InvalidateRect(&rect);
00169     }
00170 }
00171
00172 void CCJToolBarBase::OnPaint()
00173 {
00174     // background is already filled in gray
00175     CPaintDC dc(this);
00176
00177     // erase background now
00178     if (IsVisible())
00179         DoPaint(&dc);       // delegate to paint helper
00180 }
00181
00182 void CCJToolBarBase::EraseNonClient()
00183 {
00184     // get window DC that is clipped to the non-client area
00185     CWindowDC dc(this);
00186     CRect rectClient;
00187     GetClientRect(rectClient);
00188     CRect rectWindow;
00189     GetWindowRect(rectWindow);
00190     ScreenToClient(rectWindow);
00191     rectClient.OffsetRect(-rectWindow.left, -rectWindow.top);
00192     dc.ExcludeClipRect(rectClient);
00193
00194     // draw borders in non-client area
00195     rectWindow.OffsetRect(-rectWindow.left, -rectWindow.top);
00196     DrawBorders(&dc, rectWindow);
00197
00198     // erase parts not drawn
00199     dc.IntersectClipRect(rectWindow);
00200     SendMessage(WM_ERASEBKGND, (WPARAM)dc.m_hDC);
00201
00202     // draw gripper in non-client area
00203     DrawGripper(&dc, rectWindow);
00204 }
00205
00206 void CCJToolBarBase::DoPaint(CDC* pDC)
00207 {
00208     ASSERT_VALID(this);
00209     ASSERT_VALID(pDC);
00210
00211     // paint inside client area
00212     CRect rect;
00213     GetClientRect(rect);
00214     DrawBorders(pDC, rect);
00215     DrawGripper(pDC, rect);
00216 }
00217
00218 void CCJToolBarBase::DrawBorders(CDC* pDC, CRect& rect)
00219 {
00220     ASSERT_VALID(this);
00221     ASSERT_VALID(pDC);
00222
00223     DWORD dwStyle = m_dwStyle;
00224     if (!(dwStyle & CBRS_BORDER_ANY))
00225         return;
00226
00227     // prepare for dark lines
00228     ASSERT(rect.top == 0 && rect.left == 0);
00229     if(m_bInReBar)
00230     {
00231         CRect rect1, rect2;
00232         rect1 = rect;
00233         rect2 = rect;
00234         COLORREF clr = afxData.bWin4 ? afxData.clrBtnShadow : afxData.clrWindowFrame;
00235
00236         // draw dark line one pixel back/up
00237         if (dwStyle & CBRS_BORDER_3D)
00238         {
00239             rect1.right -= CX_BORDER;
00240             rect1.bottom -= CY_BORDER;
00241         }
00242         if (dwStyle & CBRS_BORDER_TOP)
00243             rect2.top += afxData.cyBorder2;
00244         if (dwStyle & CBRS_BORDER_BOTTOM)
00245             rect2.bottom -= afxData.cyBorder2;
00246
00247         // draw left and top
00248         if (dwStyle & CBRS_BORDER_LEFT)
00249             pDC->FillSolidRect(0, rect2.top, CX_BORDER, rect2.Height(), clr);
00250         if (dwStyle & CBRS_BORDER_TOP)
00251             pDC->FillSolidRect(0, 0, rect.right, CY_BORDER, clr);
00252
00253         // draw right and bottom
00254         if (dwStyle & CBRS_BORDER_RIGHT)
00255             pDC->FillSolidRect(rect1.right, rect2.top, -CX_BORDER, rect2.Height(), clr);
00256         if (dwStyle & CBRS_BORDER_BOTTOM)
00257             pDC->FillSolidRect(0, rect1.bottom, rect.right, -CY_BORDER, clr);
00258
00259         if (dwStyle & CBRS_BORDER_3D)
00260         {
00261             // prepare for hilite lines
00262             clr = afxData.clrBtnHilite;
00263
00264             // draw left and top
00265             if (dwStyle & CBRS_BORDER_LEFT)
00266                 pDC->FillSolidRect(1, rect2.top, CX_BORDER, rect2.Height(), clr);
00267             if (dwStyle & CBRS_BORDER_TOP)
00268                 pDC->FillSolidRect(0, 1, rect.right, CY_BORDER, clr);
00269
00270             // draw right and bottom
00271             if (dwStyle & CBRS_BORDER_RIGHT)
00272                 pDC->FillSolidRect(rect.right, rect2.top, -CX_BORDER, rect2.Height(), clr);
00273             if (dwStyle & CBRS_BORDER_BOTTOM)
00274                 pDC->FillSolidRect(0, rect.bottom, rect.right, -CY_BORDER, clr);
00275         }
00276
00277         if (dwStyle & CBRS_BORDER_LEFT)
00278             rect.left += afxData.cxBorder2;
00279         if (dwStyle & CBRS_BORDER_TOP)
00280             rect.top += afxData.cyBorder2;
00281         if (dwStyle & CBRS_BORDER_RIGHT)
00282             rect.right -= afxData.cxBorder2;
00283         if (dwStyle & CBRS_BORDER_BOTTOM)
00284             rect.bottom -= afxData.cyBorder2;
00285     }
00286     else
00287     {
00288         if(dwStyle & CBRS_BORDER_RIGHT) {
00289             pDC->FillSolidRect(rect.right-1, 0, rect.right, rect.bottom, afxData.clrBtnShadow);
00290             rect.right--;
00291         }
00292         if(dwStyle & CBRS_BORDER_BOTTOM) {
00293             pDC->FillSolidRect(0, rect.bottom-1, rect.right, rect.bottom, afxData.clrBtnShadow);
00294             rect.bottom--;
00295         }
00296         if(dwStyle & CBRS_BORDER_TOP) {
00297             pDC->FillSolidRect(0, 0, rect.right, 1, afxData.clrBtnHilite);
00298             rect.top++;
00299         }
00300         if(dwStyle & CBRS_BORDER_LEFT) {
00301             pDC->FillSolidRect(0, 0, 1, rect.bottom, afxData.clrBtnHilite);
00302             rect.left++;
00303         }
00304     }
00305 }
00306
00307 #define CX_GRIPPER          3
00308 #define CY_GRIPPER          3
00309 #define CX_BORDER_GRIPPER   2
00310 #define CY_BORDER_GRIPPER   2
00311
00312 void CCJToolBarBase::DrawGripper(CDC* pDC, const CRect& rect)
00313 {
00314     // if we are floating return.
00315     if( m_dwStyle & CBRS_FLOATING ) {
00316         return;
00317     }
00318
00319     // if we are to draw the extended "office" style gripper.
00320     if(( m_dwStyle & CBRS_GRIPPER ) && ( m_bExStyle == true ))
00321     {
00322         // draw the gripper in the border
00323         if (m_dwStyle & CBRS_ORIENT_HORZ)
00324         {
00325             // Draw the first gripper.
00326             pDC->Draw3dRect( rect.left+3, rect.top+2, 3, rect.Height()-4,
00327                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00328
00329             pDC->SetPixel( rect.left+3, rect.top+2+rect.Height()-5,
00330                 afxData.clrBtnHilite);
00331
00332             // Draw the second gripper.
00333             pDC->Draw3dRect( rect.left+6, rect.top+2, 3, rect.Height()-4,
00334                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00335
00336             pDC->SetPixel( rect.left+6, rect.top+2+rect.Height()-5,
00337                 afxData.clrBtnHilite);
00338         }
00339         else
00340         {
00341             // Draw the first gripper.
00342             pDC->Draw3dRect( rect.left+2, rect.top+3, rect.Width()-4, 3,
00343                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00344
00345             pDC->SetPixel( rect.left+2+rect.Width()-5, rect.top+3,
00346                 afxData.clrBtnHilite);
00347
00348             // Draw the second gripper.
00349             pDC->Draw3dRect( rect.left+2, rect.top+6, rect.Width()-4, 3,
00350                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00351
00352             pDC->SetPixel( rect.left+2+rect.Width()-5, rect.top+6,
00353                 afxData.clrBtnHilite);
00354         }
00355
00356         GdiFlush();
00357     }
00358
00359     // if we are to draw the "ReBar" style gripper.
00360     else
00361     if(( m_dwStyle & CBRS_GRIPPER ) && ( m_bInReBar == true ))
00362     {
00363         // draw the gripper in the border
00364         if (m_dwStyle & CBRS_ORIENT_HORZ)
00365         {
00366             // Draw the first gripper.
00367             pDC->Draw3dRect( rect.left+CX_BORDER_GRIPPER, rect.top+m_cyTopBorder,
00368                 CX_GRIPPER, rect.Height()-m_cyTopBorder-m_cyBottomBorder,
00369                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00370         }
00371         else
00372         {
00373             // Draw the first gripper.
00374             pDC->Draw3dRect( rect.left+m_cyTopBorder, rect.top+CY_BORDER_GRIPPER,
00375                 rect.Width()-m_cyTopBorder-m_cyBottomBorder, CY_GRIPPER,
00376                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00377         }
00378
00379         GdiFlush();
00380     }
00381
00382     // by default, we will draw the "visual studio" style gripper.
00383     else
00384     if( m_dwStyle & CBRS_GRIPPER )
00385     {
00386         // draw the gripper in the border
00387         if (m_dwStyle & CBRS_ORIENT_HORZ)
00388         {
00389             // Draw the first gripper.
00390             pDC->Draw3dRect( rect.left+1, rect.top+2, 3, rect.Height()-4,
00391                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00392
00393             // Draw the second gripper.
00394             pDC->Draw3dRect( rect.left+5, rect.top+2, 3, rect.Height()-4,
00395                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00396         }
00397         else
00398         {
00399             // Draw the first gripper.
00400             pDC->Draw3dRect( rect.left+2, rect.top+1, rect.Width()-4, 3,
00401                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00402
00403             // Draw the second gripper.
00404             pDC->Draw3dRect( rect.left+2, rect.top+5, rect.Width()-4, 3,
00405                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00406         }
00407
00408         GdiFlush();
00409     }
00410 }
00411
00412 // input CRect should be client rectangle size
00413 void CCJToolBarBase::CalcInsideRect(CRect& rect, BOOL bHorz) const
00414 {
00415     ASSERT_VALID(this);
00416     DWORD dwStyle = m_dwStyle;
00417
00418     if (dwStyle & CBRS_BORDER_LEFT)
00419         rect.left += afxData.cxBorder2;
00420     if (dwStyle & CBRS_BORDER_TOP)
00421         rect.top += afxData.cyBorder2;
00422     if (dwStyle & CBRS_BORDER_RIGHT)
00423         rect.right -= afxData.cxBorder2;
00424     if (dwStyle & CBRS_BORDER_BOTTOM)
00425         rect.bottom -= afxData.cyBorder2;
00426
00427     // inset the top and bottom.
00428     if (bHorz)
00429     {
00430         rect.left += m_cxLeftBorder;
00431         rect.top += m_cyTopBorder;
00432         rect.right -= m_cxRightBorder;
00433         rect.bottom -= m_cyBottomBorder;
00434         if ((m_dwStyle & (CBRS_GRIPPER|CBRS_FLOATING)) == CBRS_GRIPPER)
00435         {
00436             rect.left += CX_BORDER_GRIPPER+CX_GRIPPER+CX_BORDER_GRIPPER;
00437
00438             if( m_bExStyle == true ) {
00439                 rect.left += CX_GRIPPER;
00440             }
00441
00442             if(( m_bExStyle == false ) && ( m_bInReBar == false )) {
00443                 rect.left -= CX_BORDER_GRIPPER+CX_GRIPPER;
00444             }
00445         }
00446     }
00447     else
00448     {
00449         rect.left += m_cyTopBorder;
00450         rect.top += m_cxLeftBorder;
00451         rect.right -= m_cyBottomBorder;
00452         rect.bottom -= m_cxRightBorder;
00453         if ((m_dwStyle & (CBRS_GRIPPER|CBRS_FLOATING)) == CBRS_GRIPPER)
00454         {
00455             rect.top += CY_BORDER_GRIPPER+CY_GRIPPER+CY_BORDER_GRIPPER;
00456
00457             if( m_bExStyle == true ) {
00458                 rect.top += CY_GRIPPER;
00459             }
00460
00461             if(( m_bExStyle == false ) && ( m_bInReBar == false )) {
00462                 rect.top -= CY_BORDER_GRIPPER+CY_GRIPPER;
00463             }
00464         }
00465     }
00466 }
00467
00469
00470 IMPLEMENT_DYNAMIC(CCJToolBarBase, CControlBar)
00471
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJToolBarCtrl.cpp Source File

WinCvs/CJLib/CJLibrary/CJToolBarCtrl.cpp

Go to the documentation of this file.
00001 // CJToolBarCtrl.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new IE4 controls'
00007 // http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/CJLibrary/CJToolBarCtrl.cpp $
00015  *
00016  * $History: CJToolBarCtrl.cpp $
00017  *
00018  * *****************  Version 5  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/CJLibrary
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 4  *****************
00024  * User: Kirk Stowell Date: 7/28/99    Time: 12:38a
00025  * Updated in $/CodeJockey/CJLibrary
00026  * Final pass for release 6.08.
00027  *
00028  * *****************  Version 3  *****************
00029  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00030  * Updated in $/CodeJockey/CJLibrary
00031  *
00032  * *****************  Version 2  *****************
00033  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00034  * Updated in $/CodeJockey/CJLibrary
00035  *
00036  * *****************  Version 1  *****************
00037  * User: Kirk Stowell Date: 7/14/99    Time: 10:29p
00038  * Created in $/CodeJockey/CJLibrary
00039  * Copied from MFC v6 and techno preview for v5. Added to extend
00040  * functionality to Visual C++ 5.0 users.
00041  *
00042  ***************************************************************************/
00043
00044 #include "stdafx.h"
00045 #include "CJToolBarCtrl.h"
00046
00047 #ifdef _DEBUG
00048 #define new DEBUG_NEW
00049 #undef THIS_FILE
00050 static char THIS_FILE[] = __FILE__;
00051 #endif
00052
00054 // CCJToolBarCtrl
00055
00056 CCJToolBarCtrl::~CCJToolBarCtrl()
00057 {
00058   DestroyWindow();
00059 }
00060
00061
00062 BEGIN_MESSAGE_MAP(CCJToolBarCtrl, CToolBarCtrl)
00063   //{{AFX_MSG_MAP(CCJToolBarCtrl)
00064   ON_WM_CREATE()
00065   //}}AFX_MSG_MAP
00066 END_MESSAGE_MAP()
00067
00069 // CCJToolBarCtrl message handlers
00070
00071 CCJToolBarCtrl::CCJToolBarCtrl()
00072 {
00073   // initialize common controls
00074   INITCOMMONCONTROLSEX icex;
00075   icex.dwSize = sizeof(icex);
00076   icex.dwICC = ICC_BAR_CLASSES;
00077   VERIFY(InitCommonControlsEx(&icex));
00078 }
00079
00080 BOOL CCJToolBarCtrl::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
00081                             UINT nID)
00082 {
00083   CWnd* pWnd = this;
00084   BOOL bCreated = pWnd->Create(TOOLBARCLASSNAME, NULL, dwStyle, rect, pParentWnd, nID);
00085
00086   return bCreated;
00087 }
00088
00089 int CCJToolBarCtrl::OnCreate(LPCREATESTRUCT lpcs)
00090 {
00091   if (CWnd::OnCreate(lpcs) == -1)
00092     return -1;
00093   SetButtonStructSize(sizeof(TBBUTTON));
00094   return 0;
00095 }
00096
00097 HRESULT CCJToolBarCtrl::GetDropTarget(IDropTarget** ppDropTarget) const
00098 {
00099   ASSERT(::IsWindow(m_hWnd));
00100   ASSERT(ppDropTarget);
00101   return (HRESULT) ::SendMessage(m_hWnd, TB_GETOBJECT, (WPARAM)&IID_IDropTarget, (LPARAM)ppDropTarget);
00102 }
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJTreeCtrl.cpp Source File

WinCvs/CJLib/CJLibrary/CJTreeCtrl.cpp

Go to the documentation of this file.
00001 // CJTreeCtrl.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the CTreeView articles from http://www.codeguru.com/treeview
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:49 $
00011  * $Revision: 1.1.1.3 $
00012  * $Archive: /CodeJock/CJLibrary/CJTreeCtrl.cpp $
00013  *
00014  * $History: CJTreeCtrl.cpp $
00015  *
00016  * *****************  Version 6  *****************
00017  * User: Kirk Stowell Date: 10/30/99   Time: 1:54p
00018  * Updated in $/CodeJock/CJLibrary
00019  * Overrode OnEraseBkgnd(...) to handle flicker free drawing.
00020  *
00021  * *****************  Version 5  *****************
00022  * User: Kirk Stowell Date: 10/25/99   Time: 10:52p
00023  * Updated in $/CodeJock/CJLibrary
00024  * 21. Fixed bug with CCJTreeCtrl where searching for a string in the tree
00025  * and this string is currently selected, the method will return NULL.
00026  * Fixed bug where tree control item font was changed to a smaller font
00027  * than the previous font, part of the old font would still show.
00028  *
00029  * *****************  Version 4  *****************
00030  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00031  * Updated in $/CodeJock/CJLibrary
00032  * Fixed potential resource and memory leak problems.
00033  *
00034  * *****************  Version 3  *****************
00035  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00036  * Updated in $/CodeJockey/CJLibrary
00037  *
00038  * *****************  Version 2  *****************
00039  * User: Kirk Stowell Date: 6/23/99    Time: 12:06a
00040  * Updated in $/CodeJockey/CJLibrary
00041  *
00042  * *****************  Version 1  *****************
00043  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00044  * Created in $/CodeJockey/CJLibrary
00045  * Initial creation.
00046  *
00047  ***************************************************************************/
00049
00050 #include "stdafx.h"
00051 #include "CJResource.h"
00052 #include "CJTreeCtrl.h"
00053
00054 #ifdef _DEBUG
00055 #define new DEBUG_NEW
00056 #undef THIS_FILE
00057 static char THIS_FILE[] = __FILE__;
00058 #endif
00059
00061 // CCJTreeCtrl
00062
00063 CCJTreeCtrl::CCJTreeCtrl()
00064 {
00065     m_hItemFirstSel = NULL;
00066     m_dwDragStart   = NULL;
00067     m_bMultiSelect = FALSE;
00068 }
00069
00070 CCJTreeCtrl::~CCJTreeCtrl()
00071 {
00072 }
00073
00074 IMPLEMENT_DYNAMIC(CCJTreeCtrl, CTreeCtrl)
00075
00076 BEGIN_MESSAGE_MAP(CCJTreeCtrl, CTreeCtrl)
00077     //{{AFX_MSG_MAP(CCJTreeCtrl)
00078     ON_WM_PAINT()
00079     ON_WM_LBUTTONDOWN()
00080     ON_WM_ERASEBKGND()
00081     //}}AFX_MSG_MAP
00082 END_MESSAGE_MAP()
00083
00085 // CCJTreeCtrl message handlers
00086
00087 // Taken from: Get next item in outline by Zafir Anjum.
00088 // http://www.codeguru.com/treeview/get_next.shtml
00089
00090 // GetNextItem  - Get next item as if outline was completely expanded
00091 // Returns      - The item immediately below the reference item
00092 // hItem        - The reference item
00093 HTREEITEM CCJTreeCtrl::GetNextItem( HTREEITEM hItem )
00094 {
00095     HTREEITEM hti = NULL;
00096
00097     if (ItemHasChildren(hItem))
00098         hti = GetChildItem(hItem);
00099
00100     if (hti == NULL) {
00101         while ((hti = GetNextSiblingItem(hItem)) == NULL) {
00102             if ((hItem = GetParentItem(hItem)) == NULL)
00103                 return NULL;
00104         }
00105     }
00106     return hti;
00107 }
00108
00109 // Taken from: Get previous item in outline by Zafir Anjum.
00110 // http://www.codeguru.com/treeview/get_prev.shtml
00111
00112 // GetPrevItem  - Get previous item as if outline was completely expanded
00113 // Returns      - The item immediately above the reference item
00114 // hItem        - The reference item
00115 HTREEITEM CCJTreeCtrl::GetPrevItem( HTREEITEM hItem )
00116 {
00117     HTREEITEM       hti;
00118
00119     hti = GetPrevSiblingItem(hItem);
00120     if( hti == NULL )
00121         hti = GetParentItem(hItem);
00122     else
00123         hti = GetLastItem(hti);
00124     return hti;
00125 }
00126
00127 // Taken from: Get last item in branch by Zafir Anjum.
00128 // http://www.codeguru.com/treeview/get_last.shtml
00129
00130 // GetLastItem  - Gets last item in the branch
00131 // Returns      - Last item
00132 // hItem        - Node identifying the branch. NULL will
00133 //                return the last item in outine
00134 HTREEITEM CCJTreeCtrl::GetLastItem( HTREEITEM hItem )
00135 {
00136     //  Temporary used variable
00137     HTREEITEM   htiNext;
00138
00139     if( hItem == NULL ) {
00140         // Get the last item at the top level
00141         hItem = GetRootItem();
00142     }
00143
00144     while( ItemHasChildren( hItem ) != NULL ) {
00145         //  Find the last child of hItem
00146         htiNext = GetChildItem( hItem );
00147         while( htiNext != NULL ) {
00148             hItem = htiNext;
00149             htiNext = GetNextSiblingItem( htiNext );
00150         }
00151     }
00152
00153     return hItem;
00154
00155 }
00156
00157 // Taken from: Finding an item by Zafir Anjum.
00158 // http://www.codeguru.com/treeview/find_item.shtml
00159
00160 // FindItem     - Finds an item that contains the search string
00161 // Returns      - Handle to the item or NULL
00162 // str          - String to search for
00163 // bCaseSensitive   - Should the search be case sensitive
00164 // bDownDir     - Search direction - TRUE for down
00165 // bWholeWord       - True if search should match whole words
00166 // hItem        - Item to start searching from. NULL for
00167 //          - currently selected item
00168 HTREEITEM CCJTreeCtrl::FindItem(LPCTSTR lpszSearch,
00169                 BOOL bCaseSensitive /*= FALSE*/,
00170                 BOOL bDownDir /*= TRUE*/,
00171                 BOOL bWholeWord /*= FALSE*/,
00172                 HTREEITEM hItem /*= NULL*/)
00173 {
00174     CString str = lpszSearch;
00175
00176     int lenSearchStr = str.GetLength();
00177     if( lenSearchStr == 0 ) return NULL;
00178
00179     // For the first pass, set the current item equal to the selection
00180     HTREEITEM htiSel = hItem ? hItem : GetSelectedItem();
00181     HTREEITEM htiCur = htiSel;
00182     CString sSearch = str;
00183
00184     // make sure it ends if we started with no selection
00185     if(( htiCur == NULL ) && ( htiSel != NULL ))
00186     {
00187         if( bDownDir )
00188             htiCur = GetRootItem();
00189         else
00190             htiCur = GetLastItem( NULL );
00191     }
00192
00193     if( !bCaseSensitive )
00194         sSearch.MakeLower();
00195
00196     // For the first pass only, we check to see if it
00197     // is the item we're looking for.
00198     BOOL bFirstPass = TRUE;
00199
00200     while( htiCur && (htiCur != htiSel || bFirstPass) )
00201     {
00202         bFirstPass = FALSE;
00203
00204         CString sItemText = GetItemText( htiCur );
00205         if( !bCaseSensitive )
00206             sItemText.MakeLower();
00207
00208         int n;
00209         while( (n = sItemText.Find( sSearch )) != -1 )
00210         {
00211             // Search string found
00212             if( bWholeWord )
00213             {
00214                 // Check preceding char
00215                 if( n != 0 )
00216                 {
00217                     if( isalpha(sItemText[n-1]) ||
00218                             sItemText[n-1] == '_' ){
00219                         // Not whole word
00220                         sItemText = sItemText.Right(
00221                             sItemText.GetLength() - n -
00222                             lenSearchStr );
00223                         continue;
00224                     }
00225                 }
00226
00227                 // Check succeeding char
00228                 if( sItemText.GetLength() > n + lenSearchStr
00229                     && ( isalpha(sItemText[n+lenSearchStr]) ||
00230                     sItemText[n+lenSearchStr] == '_' ) )
00231                 {
00232                     // Not whole word
00233                     sItemText = sItemText.Right( sItemText.GetLength()
00234                             - n - sSearch.GetLength() );
00235                     continue;
00236                 }
00237             }
00238
00239             if( IsFindValid( htiCur ) )
00240                 return htiCur;
00241             else break;
00242         }
00243
00244
00245         htiCur = bDownDir ? GetNextItem( htiCur ) : GetPrevItem( htiCur );
00246         if( htiCur == NULL )
00247         {
00248             if( bDownDir )  htiCur = GetRootItem();
00249             else htiCur = GetLastItem( NULL );
00250         }
00251     }
00252     return NULL;
00253 }
00254
00255 // Taken from: Finding an item by Zafir Anjum.
00256 // http://www.codeguru.com/treeview/find_item.shtml
00257
00258 // IsFindValid  - Virtual function used by FindItem to allow this
00259 //        function to filter the result of FindItem
00260 // Returns  - True if item matches the criteria
00261 // Arg      - Handle of the item
00262 BOOL CCJTreeCtrl::IsFindValid( HTREEITEM )
00263 {
00264     return TRUE;
00265 }
00266
00267 BOOL CCJTreeCtrl::PreCreateWindow(CREATESTRUCT& cs)
00268 {
00269     if( !CTreeCtrl::PreCreateWindow(cs))
00270         return FALSE;
00271
00272     cs.style |= TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS;
00273
00274     return TRUE;
00275 }
00276
00277 // Taken from: Setting color and font attribute for individual items by Zafir Anjum.
00278 // http://www.codeguru.com/treeview/item_color_font.shtml
00279
00280 void CCJTreeCtrl::SetItemFont(HTREEITEM hItem, LOGFONT& logfont)
00281 {
00282     Color_Font cf;
00283     if( !m_mapColorFont.Lookup( hItem, cf ) )
00284         cf.color = (COLORREF)-1;
00285     cf.logfont = logfont;
00286     m_mapColorFont[hItem] = cf;
00287 }
00288
00289 void CCJTreeCtrl::SetItemBold(HTREEITEM hItem, BOOL bBold)
00290 {
00291     SetItemState( hItem, bBold ? TVIS_BOLD: 0, TVIS_BOLD );
00292 }
00293
00294 void CCJTreeCtrl::SetItemColor(HTREEITEM hItem, COLORREF color)
00295 {
00296     Color_Font cf;
00297     if( !m_mapColorFont.Lookup( hItem, cf ) )
00298         cf.logfont.lfFaceName[0] = '\0';
00299     cf.color = color;
00300     m_mapColorFont[hItem] = cf;
00301 }
00302
00303 BOOL CCJTreeCtrl::GetItemFont(HTREEITEM hItem, LOGFONT * plogfont)
00304 {
00305     Color_Font cf;
00306     if( !m_mapColorFont.Lookup( hItem, cf ) )
00307         return FALSE;
00308     if( cf.logfont.lfFaceName[0] == '\0' )
00309         return FALSE;
00310     *plogfont = cf.logfont;
00311     return TRUE;
00312
00313 }
00314
00315 BOOL CCJTreeCtrl::GetItemBold(HTREEITEM hItem)
00316 {
00317     return GetItemState( hItem, TVIS_BOLD ) & TVIS_BOLD;
00318 }
00319
00320 COLORREF CCJTreeCtrl::GetItemColor(HTREEITEM hItem)
00321 {
00322     // Returns (COLORREF)-1 if color was not set
00323     Color_Font cf;
00324     if( !m_mapColorFont.Lookup( hItem, cf ) )
00325         return (COLORREF)-1;
00326     return cf.color;
00327
00328 }
00329
00330 void CCJTreeCtrl::OnPaint()
00331 {
00332     CPaintDC dc(this);
00333
00334     // Create a memory DC compatible with the paint DC
00335     CDC memDC;
00336     memDC.CreateCompatibleDC( &dc );
00337
00338     CRect rcClip, rcClient;
00339     dc.GetClipBox( &rcClip );
00340     GetClientRect(&rcClient);
00341
00342     // Select a compatible bitmap into the memory DC
00343     CBitmap bitmap;
00344     bitmap.CreateCompatibleBitmap( &dc, rcClient.Width(), rcClient.Height() );
00345     CBitmap* pOldBitmap = memDC.SelectObject( &bitmap );
00346
00347     // Set clip region to be same as that in paint DC
00348     CRgn rgn;
00349     rgn.CreateRectRgnIndirect( &rcClip );
00350     memDC.SelectClipRgn(&rgn);
00351     rgn.DeleteObject();
00352
00353     // First let the control do its default drawing.
00354     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00355
00356     HTREEITEM hItem = GetFirstVisibleItem();
00357
00358     int n = GetVisibleCount()+1;
00359     while( hItem && n--)
00360     {
00361         CRect rect;
00362
00363         // Do not meddle with selected items or drop highlighted items
00364         UINT selflag = TVIS_DROPHILITED | TVIS_SELECTED;
00365         Color_Font cf;
00366
00367         if ( !(GetItemState( hItem, selflag ) & selflag )
00368             && m_mapColorFont.Lookup( hItem, cf ))
00369         {
00370             CFont *pFontDC;
00371             CFont fontDC;
00372             LOGFONT logfont;
00373
00374             if( cf.logfont.lfFaceName[0] != '\0' )
00375             {
00376                 logfont = cf.logfont;
00377             }
00378             else
00379             {
00380                 // No font specified, so use window font
00381                 CFont *pFont = GetFont();
00382                 pFont->GetLogFont( &logfont );
00383             }
00384
00385             CString sItem = GetItemText( hItem );
00386             GetItemRect( hItem, &rect, TRUE );
00387
00388             // cover up over old font.
00389             CFont* pOldFont = memDC.SelectObject(GetFont());
00390             memDC.SetTextColor(::GetSysColor( COLOR_WINDOW ));
00391             memDC.SetBkColor( GetSysColor( COLOR_WINDOW ) );
00392             memDC.TextOut( rect.left+2, rect.top+1, sItem );
00393             memDC.SelectObject(pOldFont);
00394
00395             if( GetItemBold( hItem ) )
00396                 logfont.lfWeight = 700;
00397             fontDC.CreateFontIndirect( &logfont );
00398             pFontDC = memDC.SelectObject( &fontDC );
00399
00400             if( cf.color != (COLORREF)-1 )
00401                 memDC.SetTextColor( cf.color );
00402
00403             memDC.SetBkColor( GetSysColor( COLOR_WINDOW ) );
00404             memDC.TextOut( rect.left+2, rect.top+1, sItem );
00405
00406             memDC.SelectObject( pFontDC );
00407
00408             // fix potential resource leak - KStowell - 10-22-99.
00409             fontDC.DeleteObject();
00410         }
00411         hItem = GetNextVisibleItem( hItem );
00412     }
00413
00414
00415     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00416         rcClip.left, rcClip.top, SRCCOPY );
00417
00418     // fix potential resource leak - KStowell - 10-21-99
00419     memDC.SelectObject( pOldBitmap );
00420     memDC.DeleteDC();
00421     bitmap.DeleteObject();
00422 }
00423
00424 // Taken from: Allowing multiple selection by Zafir Anjum.
00425 // http://www.codeguru.com/treeview/multiple_sel.shtml
00426
00427 void CCJTreeCtrl::OnLButtonDown(UINT nFlags, CPoint point)
00428 {
00429     if(m_bMultiSelect)
00430     {
00431         // Set focus to control if key strokes are needed.
00432         // Focus is not automatically given to control on lbuttondown
00433
00434         m_dwDragStart = GetTickCount();
00435
00436         if(nFlags & MK_CONTROL )
00437         {
00438             // Control key is down
00439             UINT flag;
00440             HTREEITEM hItem = HitTest( point, &flag );
00441             if( hItem )
00442             {
00443                 // Toggle selection state
00444                 UINT uNewSelState =
00445                     GetItemState(hItem, TVIS_SELECTED) & TVIS_SELECTED ?
00446                     0 : TVIS_SELECTED;
00447
00448                 // Get old selected (focus) item and state
00449                 HTREEITEM hItemOld = GetSelectedItem();
00450                 UINT uOldSelState  = hItemOld ?
00451                     GetItemState(hItemOld, TVIS_SELECTED) : 0;
00452
00453                 // Select new item
00454                 if( GetSelectedItem() == hItem )
00455                     SelectItem( NULL );     // to prevent edit
00456                 CTreeCtrl::OnLButtonDown(nFlags, point);
00457
00458                 // Set proper selection (highlight) state for new item
00459                 SetItemState(hItem, uNewSelState,  TVIS_SELECTED);
00460
00461                 // Restore state of old selected item
00462                 if (hItemOld && hItemOld != hItem)
00463                     SetItemState(hItemOld, uOldSelState, TVIS_SELECTED);
00464
00465                 m_hItemFirstSel = NULL;
00466
00467                 return;
00468             }
00469         }
00470         else if(nFlags & MK_SHIFT)
00471         {
00472             // Shift key is down
00473             UINT flag;
00474             HTREEITEM hItem = HitTest( point, &flag );
00475
00476             // Initialize the reference item if this is the first shift selection
00477             if( !m_hItemFirstSel )
00478                 m_hItemFirstSel = GetSelectedItem();
00479
00480             // Select new item
00481             if( GetSelectedItem() == hItem )
00482                 SelectItem( NULL );         // to prevent edit
00483             CTreeCtrl::OnLButtonDown(nFlags, point);
00484
00485             if( m_hItemFirstSel )
00486             {
00487                 SelectItems( m_hItemFirstSel, hItem );
00488                 return;
00489             }
00490         }
00491         else
00492         {
00493             // Normal - remove all selection and let default
00494             // handler do the rest
00495             ClearSelection();
00496             m_hItemFirstSel = NULL;
00497         }
00498     }
00499
00500     CTreeCtrl::OnLButtonDown(nFlags, point);
00501 }
00502
00503 void CCJTreeCtrl::ClearSelection()
00504 {
00505     if(m_bMultiSelect)
00506     {
00507         // This can be time consuming for very large trees
00508         // and is called every time the user does a normal selection
00509         // If performance is an issue, it may be better to maintain
00510         // a list of selected items
00511         for ( HTREEITEM hItem=GetRootItem(); hItem!=NULL; hItem=GetNextItem( hItem ) )
00512             if ( GetItemState( hItem, TVIS_SELECTED ) & TVIS_SELECTED )
00513                 SetItemState( hItem, 0, TVIS_SELECTED );
00514     }
00515 }
00516
00517 // SelectItems  - Selects items from hItemFrom to hItemTo. Does not
00518 //      - select child item if parent is collapsed. Removes
00519 //      - selection from all other items
00520 // hItemFrom    - item to start selecting from
00521 // hItemTo  - item to end selection at.
00522 BOOL CCJTreeCtrl::SelectItems(HTREEITEM hItemFrom, HTREEITEM hItemTo)
00523 {
00524     if(m_bMultiSelect)
00525     {
00526         HTREEITEM hItem = GetRootItem();
00527
00528         // Clear selection upto the first item
00529         while ( hItem && hItem!=hItemFrom && hItem!=hItemTo )
00530         {
00531             hItem = GetNextVisibleItem( hItem );
00532             SetItemState( hItem, 0, TVIS_SELECTED );
00533         }
00534
00535         if ( !hItem )
00536             return FALSE;   // Item is not visible
00537
00538         SelectItem( hItemTo );
00539
00540         // Rearrange hItemFrom and hItemTo so that hItemFirst is at top
00541         if( hItem == hItemTo )
00542         {
00543             hItemTo = hItemFrom;
00544             hItemFrom = hItem;
00545         }
00546
00547
00548         // Go through remaining visible items
00549         BOOL bSelect = TRUE;
00550         while ( hItem )
00551         {
00552             // Select or remove selection depending on whether item
00553             // is still within the range.
00554             SetItemState( hItem, bSelect ? TVIS_SELECTED : 0, TVIS_SELECTED );
00555
00556             // Do we need to start removing items from selection
00557             if( hItem == hItemTo )
00558                 bSelect = FALSE;
00559
00560             hItem = GetNextVisibleItem( hItem );
00561         }
00562
00563         return TRUE;
00564     }
00565
00566     return FALSE;
00567 }
00568
00569 HTREEITEM CCJTreeCtrl::GetFirstSelectedItem()
00570 {
00571     if(m_bMultiSelect)
00572     {
00573         for ( HTREEITEM hItem = GetRootItem(); hItem!=NULL; hItem = GetNextItem( hItem ) )
00574             if ( GetItemState( hItem, TVIS_SELECTED ) & TVIS_SELECTED )
00575                 return hItem;
00576     }
00577
00578     return NULL;
00579 }
00580
00581 HTREEITEM CCJTreeCtrl::GetNextSelectedItem(HTREEITEM hItem)
00582 {
00583     if(m_bMultiSelect)
00584     {
00585         for ( hItem = GetNextItem( hItem ); hItem!=NULL; hItem = GetNextItem( hItem ) )
00586             if ( GetItemState( hItem, TVIS_SELECTED ) & TVIS_SELECTED )
00587                 return hItem;
00588     }
00589
00590     return NULL;
00591 }
00592
00593 HTREEITEM CCJTreeCtrl::GetPrevSelectedItem(HTREEITEM hItem)
00594 {
00595     if(m_bMultiSelect)
00596     {
00597         for ( hItem = GetPrevItem( hItem ); hItem!=NULL; hItem = GetPrevItem( hItem ) )
00598             if ( GetItemState( hItem, TVIS_SELECTED ) & TVIS_SELECTED )
00599                 return hItem;
00600     }
00601
00602     return NULL;
00603 }
00604
00605 BOOL CCJTreeCtrl::OnEraseBkgnd(CDC* pDC)
00606 {
00607     // KStowell - overridden for flicker-free drawing.
00608     UNUSED_ALWAYS(pDC);
00609     return TRUE;
00610 }
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/CJWindowPlacement.cpp Source File

WinCvs/CJLib/CJLibrary/CJWindowPlacement.cpp

Go to the documentation of this file.
00001 // CJWindowPlacement.cpp : implementation file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/CJLibrary/CJWindowPlacement.cpp $
00011  *
00012  * $History: CJWindowPlacement.cpp $
00013  *
00014  * *****************  Version 7  *****************
00015  * User: Kirk Stowell Date: 10/25/99   Time: 10:52p
00016  * Updated in $/CodeJock/CJLibrary
00017  * Modified resource include for static builds.
00018  *
00019  * *****************  Version 6  *****************
00020  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00021  * Updated in $/CodeJockey/CJLibrary
00022  * Updated copyright and contact information.
00023  *
00024  * *****************  Version 5  *****************
00025  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00026  * Updated in $/CodeJockey/CJLibrary
00027  * Added Unicode compliance, thanks to Barry Burton for his help with
00028  * this.
00029  *
00030  *
00031  * *****************  Version 4  *****************
00032  * User: Kirk Stowell Date: 7/25/99    Time: 12:30a
00033  * Updated in $/CodeJockey/CJLibrary
00034  *
00035  * *****************  Version 3  *****************
00036  * User: Kirk Stowell Date: 6/11/99    Time: 10:15p
00037  * Updated in $/CodeJockey/CJ60Lib
00038  * Modified LoadWindowPos(...) to allow registry names to be directly
00039  * passed in.
00040  *
00041  * *****************  Version 2  *****************
00042  * User: Kirk Stowell Date: 6/11/99    Time: 9:41p
00043  * Updated in $/CodeJockey/CJ60Lib
00044  * Initial creation.
00045  *
00046  * *****************  Version 1  *****************
00047  * User: Kirk Stowell Date: 6/01/99    Time: 9:29p
00048  * Created in $/CodeJockey/CJ60Lib
00049  *
00050  ***************************************************************************/
00052
00053 #include "StdAfx.h"
00054 #include "CJResource.h"
00055 #include "CJWindowPlacement.h"
00056
00058 // CCJWindowPlacement
00059
00060 CCJWindowPlacement::CCJWindowPlacement()
00061 {
00062     length                  = sizeof( WINDOWPLACEMENT );
00063     flags                   = NULL;
00064     showCmd                 = SW_SHOWMAXIMIZED;
00065     ptMinPosition.x         = 0;
00066     ptMinPosition.y         = 0;
00067     ptMaxPosition.x         = 0;
00068     ptMaxPosition.y         = 0;
00069     rcNormalPosition.left   = 0;
00070     rcNormalPosition.top    = 0;
00071     rcNormalPosition.right  = 0;
00072     rcNormalPosition.bottom = 0;
00073 }
00074
00075 CCJWindowPlacement::~CCJWindowPlacement()
00076 {
00077 }
00078
00080
00081 void CCJWindowPlacement::SaveWindowPos(CFrameWnd *pFrameWnd)
00082 {
00083     ASSERT_VALID( pFrameWnd ); // must be valid.
00084
00085     // Get the current window position.
00086     pFrameWnd->GetWindowPlacement( this );
00087
00088     // Save position to registry.
00089     CString strBuffer;
00090     strBuffer.Format( m_strFormat,
00091         flags,
00092         showCmd,
00093         ptMinPosition.x,
00094         ptMinPosition.y,
00095         ptMaxPosition.x,
00096         ptMaxPosition.y,
00097         rcNormalPosition.left,
00098         rcNormalPosition.top,
00099         rcNormalPosition.right,
00100         rcNormalPosition.bottom);
00101
00102     AfxGetApp()->WriteProfileString( m_strSection, m_strWndPos, strBuffer );
00103 }
00104
00105 BOOL CCJWindowPlacement::LoadWindowPos( CFrameWnd* pFrameWnd, LPCTSTR lpszFormat/*=NULL*/, LPCTSTR lpszSection/*=NULL*/, LPCTSTR lpszWndPos/*=NULL*/ )
00106 {
00107     ASSERT_VALID( pFrameWnd ); // must be valid.
00108
00109     // load the strings for the registry.
00110     if( lpszFormat == NULL )
00111         m_strFormat.LoadString( IDS_WIN_PLACEMENT );
00112     else
00113         m_strFormat = lpszFormat;
00114
00115     if( lpszSection == NULL )
00116         m_strSection.LoadString( IDS_SETTINGS );
00117     else
00118         m_strSection = lpszSection;
00119
00120     if( lpszWndPos == NULL )
00121         m_strWndPos.LoadString( IDS_WNDPOS  );
00122     else
00123         m_strWndPos = lpszWndPos;
00124
00125     // Load the previous window placement settings.
00126     CString strBuffer = AfxGetApp()->GetProfileString( m_strSection, m_strWndPos, NULL );
00127
00128     int nRead = _stscanf( strBuffer, m_strFormat,
00129         &flags,
00130         &showCmd,
00131         &ptMinPosition.x,
00132         &ptMinPosition.y,
00133         &ptMaxPosition.x,
00134         &ptMaxPosition.y,
00135         &rcNormalPosition.left,
00136         &rcNormalPosition.top,
00137         &rcNormalPosition.right,
00138         &rcNormalPosition.bottom);
00139
00140     // Set the window position.
00141     if( nRead == 10 )
00142     {
00143         pFrameWnd->SetWindowPlacement( this );
00144         pFrameWnd->ShowWindow( showCmd );
00145         pFrameWnd->UpdateWindow();
00146         return TRUE;
00147     }
00148
00149     return FALSE;
00150 }
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/GfxGroupEdit.cpp Source File

WinCvs/CJLib/CJLibrary/GfxGroupEdit.cpp

Go to the documentation of this file.
00001 // Copyright (c) Iuri Apollonio 1998
00002 // Use & modify as you want & need, and leave those 4 lines.
00003 // Strongly based on article "Inplace edit control" of Mario Contestabile and "Editable subitems" of Zafir
00004 // http://www.codeguru.com
00005 //
00006 // GfxGroupEdit.cpp : implementation file
00007 //
00009 /****************************************************************************
00010  *
00011  * $Date: 1999/11/30 21:45:49 $
00012  * $Revision: 1.1.1.2 $
00013  * $Archive: /CodeJock/CJLibrary/GfxGroupEdit.cpp $
00014  *
00015  * $History: GfxGroupEdit.cpp $
00016  *
00017  * *****************  Version 4  *****************
00018  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00019  * Updated in $/CodeJock/CJLibrary
00020  * Added source control history to file header.
00021  *
00022  ***************************************************************************/
00024
00025 #include "stdafx.h"
00026 #include "GfxGroupEdit.h"
00027 #include "GfxOutBarCtrl.h"
00028
00029 #ifdef _DEBUG
00030 #define new DEBUG_NEW
00031 #undef THIS_FILE
00032 static char THIS_FILE[] = __FILE__;
00033 #endif
00034
00036 // CGfxGroupEdit
00037
00038 CGfxGroupEdit::CGfxGroupEdit()
00039 {
00040     bEscapeKey = FALSE;
00041     iIndex = -1;
00042     msgSend = NM_OB_ONGROUPENDEDIT;
00043     bNoDown = false;
00044 }
00045
00046 CGfxGroupEdit::~CGfxGroupEdit()
00047 {
00048 }
00049
00050
00051 BEGIN_MESSAGE_MAP(CGfxGroupEdit, CEdit)
00052     //{{AFX_MSG_MAP(CGfxGroupEdit)
00053     ON_WM_KILLFOCUS()
00054     ON_WM_CREATE()
00055     ON_WM_CHAR()
00056     //}}AFX_MSG_MAP
00057 END_MESSAGE_MAP()
00058
00060 // CGfxGroupEdit message handlers
00061
00062 void CGfxGroupEdit::OnKillFocus(CWnd* /*pNewWnd*/)
00063 {
00064     PostMessage(WM_CLOSE, 0, 0);
00065     if (!bEscapeKey)
00066     {
00067         GetWindowText(text);
00068         if (text != "") GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, msgSend, (LPARAM) this);
00069     }
00070 }
00071
00072 BOOL CGfxGroupEdit::PreTranslateMessage(MSG* pMsg)
00073 {
00074     if (pMsg->wParam == VK_RETURN)
00075     {
00076         PostMessage(WM_CLOSE, 0, 0);
00077         return TRUE;
00078     }
00079     else if (pMsg->wParam == VK_ESCAPE)
00080     {
00081         PostMessage(WM_CLOSE, 0, 0);
00082         return bEscapeKey = TRUE;
00083     }
00084
00085     return CEdit::PreTranslateMessage(pMsg);
00086 }
00087
00088 void CGfxGroupEdit::PostNcDestroy()
00089 {
00090     CEdit::PostNcDestroy();
00091     delete this;
00092 }
00093
00094 int CGfxGroupEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
00095 {
00096     if (CEdit::OnCreate(lpCreateStruct) == -1)
00097         return -1;
00098
00099     SendMessage(WM_SETFONT,(WPARAM) GetStockObject(DEFAULT_GUI_FONT),MAKELPARAM(TRUE,0));
00100     return 0;
00101 }
00102
00103 void CGfxGroupEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
00104 {
00105     if (msgSend == NM_OB_ONGROUPENDEDIT)
00106     {
00107         CEdit::OnChar(nChar, nRepCnt, nFlags);
00108         return;
00109     }
00110
00111     if (nChar == VK_ESCAPE || nChar == VK_RETURN)
00112     {
00113         if (nChar == VK_ESCAPE) bEscapeKey = TRUE;
00114         GetParent()->SetFocus();
00115         return;
00116     }
00117     CEdit::OnChar(nChar, nRepCnt, nFlags);
00118     CString str;
00119     CRect rect, parentrect;
00120     GetClientRect(&rect);
00121     GetParent()->GetClientRect(&parentrect);
00122     ClientToScreen(&rect);
00123     GetParent()->ScreenToClient(&rect);
00124     GetWindowText(str);
00125     CWindowDC dc(this);
00126     CFont *pFont = GetParent()->GetFont();
00127     CFont *pFontDC = dc.SelectObject(pFont);
00128     CRect szrc(rect);
00129     szrc.bottom = szrc.top;
00130
00131     if (bNoDown == true)
00132     {
00133         dc.DrawText(str, szrc, DT_CALCRECT);
00134         if (szrc.right >= parentrect.right - 1) rect.right = parentrect.right - 1;
00135         else rect.right = szrc.right;
00136         MoveWindow(&rect);
00137         return;
00138     }
00139
00140     dc.DrawText(str, szrc, DT_WORDBREAK|DT_CENTER|DT_CALCRECT);
00141     dc.SelectObject(pFontDC);
00142     CSize size = szrc.Size();
00143
00144     if (size.cx > rect.Width())
00145     {
00146         if (size.cx + rect.left < parentrect.right) rect.right = rect.left + size.cx;
00147         else rect.right = parentrect.right;
00148         MoveWindow(&rect);
00149     }
00150     else if (size.cy > rect.Height())
00151     {
00152         if (size.cy + rect.bottom < parentrect.bottom) rect.bottom = rect.top + size.cy;
00153         else rect.bottom = parentrect.bottom;
00154         MoveWindow(&rect);
00155     }
00156 }
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/GfxOutBarCtrl.cpp Source File

WinCvs/CJLib/CJLibrary/GfxOutBarCtrl.cpp

Go to the documentation of this file.
00001 // Copyright (c) Iuri Apollonio 1998
00002 // Use & modify as you want & need, and leave those 3 lines.
00003 // http://www.codeguru.com
00004 //
00005 // GfxOutBarCtrl.cpp : implementation file
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:49 $
00011  * $Revision: 1.1.1.3 $
00012  * $Archive: /CodeJock/CJLibrary/GfxOutBarCtrl.cpp $
00013  *
00014  * $History: GfxOutBarCtrl.cpp $
00015  *
00016  * *****************  Version 9  *****************
00017  * User: Kirk Stowell Date: 10/25/99   Time: 10:54p
00018  * Updated in $/CodeJock/CJLibrary
00019  * Added resource includes for static builds, type cast popup menu calls
00020  * to call CMenu base class.
00021  *
00022  * *****************  Version 8  *****************
00023  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00024  * Updated in $/CodeJock/CJLibrary
00025  * Fixed potential resource and memory leak problems.
00026  *
00027  * *****************  Version 7  *****************
00028  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00029  * Updated in $/CodeJock/CJLibrary
00030  * Added source control history to file header.
00031  *
00032  ***************************************************************************/
00034
00035 #include "stdafx.h"
00036 #include "CJResource.h"
00037 #include "GfxOutBarCtrl.h"
00038 #include "GfxGroupEdit.h"
00039
00040 #include "CJMenu.h"        // CCJMenu class declaration
00041
00042 #ifdef _DEBUG
00043 #define new DEBUG_NEW
00044 #undef THIS_FILE
00045 static char THIS_FILE[] = __FILE__;
00046 #endif
00047
00049 // CGfxOutBarCtrl
00050
00051 IMPLEMENT_DYNCREATE(CGfxOutBarCtrl, CWnd)
00052
00053 CGfxOutBarCtrl::CGfxOutBarCtrl()
00054 {
00055     crBackGroundColor   = ::GetSysColor(COLOR_3DSHADOW);//RGB(0,128,128);//
00056     crBackGroundColor1  = ::GetSysColor(COLOR_3DSHADOW);
00057     crTextColor         = ::GetSysColor(COLOR_WINDOW);
00058     cr3dFace            = ::GetSysColor(COLOR_3DFACE);
00059     crLightBorder       = ::GetSysColor(COLOR_3DLIGHT);
00060     crHilightBorder     = ::GetSysColor(COLOR_3DHILIGHT);
00061     crShadowBorder      = ::GetSysColor(COLOR_3DSHADOW);
00062     crDkShadowBorder    = ::GetSysColor(COLOR_3DDKSHADOW);
00063
00064     pBlackPen = new CPen(PS_SOLID, 1, RGB(0,0,0));
00065
00066     iFolderHeight = 22;
00067
00068     dwFlags = fDragItems|fEditGroups|fEditItems|fRemoveGroups|fRemoveItems|fAddGroups|fAnimation|fSelHighlight;
00069
00070     iSelFolder = 0;
00071
00072     iLastFolderHighlighted = -1;
00073     iLastSelectedFolder = -1;
00074
00075     pLargeImageList = NULL;
00076     pSmallImageList = NULL;
00077
00078     iFirstItem = 0;
00079
00080     xSmallIconLabelOffset = 4;
00081     yLargeIconLabelOffset = 3;
00082
00083     ySmallIconSpacing = 10;
00084     yLargeIconSpacing = 8;
00085
00086     xLeftMargin = 5;
00087     yTopMargin = 5;
00088
00089     bUpArrow = bDownArrow = false;
00090
00091     hHandCursor = AfxGetApp()->LoadCursor(IDC_HANDCUR);
00092     rcUpArrow = rcDownArrow = CRect(0,0,0,0);
00093
00094     bUpPressed = bDownPressed = false;
00095
00096     bLooping = false;
00097
00098     iLastItemHighlighted = -1;
00099     bPressedHighlight = false;
00100
00101     iLastDragItemDraw = -1;
00102
00103     lAnimationTickCount = 10;
00104
00105     hDragCursor = AfxGetApp()->LoadCursor(IDC_DRAGGING);
00106     hNoDragCursor = AfxGetApp()->LoadCursor(IDC_NODRAGGING);
00107
00108     iLastSel = -1;
00109     iSelAnimCount = 0;
00110
00111     iSelAnimTiming = 0;
00112
00113     m_strRemoveItem.LoadString(IDS_REMOVEITEM);
00114     m_strRenameItem.LoadString(IDS_RENAMEITEM);
00115 }
00116
00117 CGfxOutBarCtrl::~CGfxOutBarCtrl()
00118 {
00119     for (int t = 0; t < arFolder.GetSize(); t++)
00120     {
00121         if (arFolder.GetAt(t)) delete (CBarFolder*) arFolder.GetAt(t);
00122     }
00123
00124     arFolder.RemoveAll();
00125
00126     delete pBlackPen;
00127 }
00128
00129
00130 BEGIN_MESSAGE_MAP(CGfxOutBarCtrl, CWnd)
00131     //{{AFX_MSG_MAP(CGfxOutBarCtrl)
00132     ON_WM_CREATE()
00133     ON_WM_TIMER()
00134     ON_WM_PAINT()
00135     ON_WM_ERASEBKGND()
00136     ON_WM_MOUSEMOVE()
00137     ON_WM_LBUTTONDOWN()
00138     ON_WM_SETCURSOR()
00139     ON_WM_SIZE()
00140     ON_WM_RBUTTONDOWN()
00141     ON_COMMAND(ID_GFX_LARGEICON, OnGfxLargeicon)
00142     ON_UPDATE_COMMAND_UI(ID_GFX_LARGEICON, OnUpdateGfxLargeicon)
00143     ON_COMMAND(ID_GFX_SMALLICON, OnGfxSmallicon)
00144     ON_UPDATE_COMMAND_UI(ID_GFX_SMALLICON, OnUpdateGfxSmallicon)
00145     ON_COMMAND(ID_GFX_REMOVEITEM, OnGfxRemoveitem)
00146     ON_UPDATE_COMMAND_UI(ID_GFX_REMOVEITEM, OnUpdateGfxRemoveitem)
00147     ON_COMMAND(ID_GFX_RENAMEITEM, OnGfxRenameitem)
00148     ON_UPDATE_COMMAND_UI(ID_GFX_RENAMEITEM, OnUpdateGfxRenameitem)
00149     ON_WM_SYSCOLORCHANGE()
00150     //}}AFX_MSG_MAP
00151     ON_MESSAGE(WM_OUTBAR_NOTIFY, OnEndLabelEdit)
00152 END_MESSAGE_MAP()
00153
00154
00156 // CGfxOutBarCtrl message handlers
00157
00158 long CGfxOutBarCtrl::OnEndLabelEdit(WPARAM wParam, LPARAM lParam)
00159 {
00160     if (wParam == NM_OB_ONGROUPENDEDIT)
00161     {
00162         CGfxGroupEdit* pEdit = (CGfxGroupEdit*) lParam;
00163
00164         OUTBAR_INFO ob;
00165
00166         ob.index = pEdit->iIndex;
00167         ob.cText = (LPCTSTR) pEdit->text;
00168
00169         if (GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_ONGROUPENDEDIT, (LPARAM) &ob))
00170         {
00171             SetFolderText(pEdit->iIndex, pEdit->text);
00172             CRect rc;
00173             GetFolderRect(pEdit->iIndex, rc);
00174             InvalidateRect(rc, false);
00175         }
00176     }
00177
00178     if (wParam == NM_OB_ONLABELENDEDIT)
00179     {
00180         CGfxGroupEdit * pEdit = (CGfxGroupEdit *) lParam;
00181         OUTBAR_INFO ob;
00182         ob.index = pEdit->iIndex;
00183         ob.cText = pEdit->text;
00184
00185         if (GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_ONLABELENDEDIT, (LPARAM) &ob))
00186         {
00187             SetItemText(pEdit->iIndex, pEdit->text);
00188             CRect rc;
00189             GetInsideRect(rc);
00190             InvalidateRect(rc, true);
00191         }
00192     }
00193
00194     return 0;
00195 }
00196
00197 void CGfxOutBarCtrl::SetFolderText( const int index, LPCTSTR text )
00198 {
00199     ASSERT(index >= 0 && index < GetFolderCount());
00200
00201     CBarFolder* pbf = (CBarFolder *) arFolder.GetAt(index);
00202
00203     if( pbf->cName )
00204     {
00205         delete [] pbf->cName;
00206         pbf->cName = NULL;
00207     }
00208
00209     pbf->cName = new TCHAR[ _tcslen( text ) + 1 ];
00210
00211     _tcscpy( pbf->cName, text );
00212 }
00213
00214 void CGfxOutBarCtrl::SetItemText( const int index, LPCTSTR text )
00215 {
00216     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
00217
00218     CBarFolder* pbf = (CBarFolder*) arFolder.GetAt(iSelFolder);
00219
00220     CBarItem*   pi  = (CBarItem*) pbf->arItems.GetAt(index);
00221
00222     if (pi->cItem)
00223     {
00224         delete [] pi->cItem;
00225         pi->cItem = NULL;
00226     }
00227
00228     pi->cItem = new TCHAR[ _tcslen( text ) + 1 ];
00229
00230     _tcscpy( pi->cItem, text );
00231 }
00232
00233 BOOL CGfxOutBarCtrl::Create(DWORD dwStyle, const RECT & rect, CWnd * pParentWnd, UINT nID, const DWORD dwFlag)
00234 {
00235     dwFlags = dwFlag;
00236     return CWnd::CreateEx(WS_EX_STATICEDGE, NULL, NULL, dwStyle|WS_CHILD, rect, pParentWnd, nID);
00237     //GFXOUTBARCTRL_CLASSNAME
00238 }
00239
00240 bool CGfxOutBarCtrl::IsSmallIconView() const
00241 {
00242     return dwFlags&fSmallIcon;
00243 }
00244
00245 void CGfxOutBarCtrl::SetSmallIconView(const bool bSet)
00246 {
00247     iFirstItem = 0;
00248
00249     if (bSet)
00250     {
00251         if (!IsSmallIconView())
00252         {
00253             dwFlags |= fSmallIcon;
00254             CRect rc;
00255             GetInsideRect(rc);
00256             InvalidateRect(rc, false);
00257         }
00258     }
00259     else
00260     {
00261         if (IsSmallIconView())
00262         {
00263             dwFlags &= ~fSmallIcon;
00264             CRect rc;
00265             GetInsideRect(rc);
00266             InvalidateRect(rc, false);
00267         }
00268     }
00269 }
00270
00271 DWORD CGfxOutBarCtrl::GetFlag() const
00272 {
00273     return dwFlags;
00274 }
00275
00276 void CGfxOutBarCtrl::ModifyFlag(const DWORD & dwRemove, const DWORD & dwAdd, const UINT redraw)
00277 {
00278     if (dwRemove)   dwFlags &= ~(dwRemove);
00279     if (dwAdd)      dwFlags |= dwAdd;
00280
00281     if (GetSafeHwnd())
00282     {
00283         if (redraw != 0) SetWindowPos(0,0,0,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOMOVE|redraw);
00284         else Invalidate();
00285     }
00286 }
00287
00288 int CGfxOutBarCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
00289 {
00290     if (CWnd::OnCreate(lpCreateStruct) == -1)
00291         return -1;
00292
00293     // TODO: Add your specialized creation code here
00294
00295     return 0;
00296 }
00297
00298 void CGfxOutBarCtrl::OnTimer(UINT nIDEvent)
00299 {
00300     if (nIDEvent == 1)
00301     {
00302         CPoint pt(GetMessagePos());
00303
00304         ScreenToClient(&pt);
00305
00306         CRect rc;
00307         GetClientRect(&rc);
00308         if (!(rc.PtInRect(pt)))
00309         {
00310             HighlightFolder(-1);
00311             HighlightItem(-1);
00312             KillTimer(1);
00313         }
00314     }
00315     else if (nIDEvent == 3 && iLastSel >= 0)
00316     {
00317         iSelAnimCount ++;
00318         if (iSelAnimCount > 10) iSelAnimCount = -1;
00319         if (iSelAnimCount == 0)
00320             DrawAnimItem(-1, 1, iLastSel);
00321         if (iSelAnimCount == 1)
00322             DrawAnimItem(0, 0, iLastSel);
00323         if (iSelAnimCount == 2)
00324             DrawAnimItem(1, 1, iLastSel);
00325         if (iSelAnimCount == 3)
00326             DrawAnimItem(0, 0, iLastSel);
00327     }
00328     CWnd::OnTimer(nIDEvent);
00329 }
00330
00331 void CGfxOutBarCtrl::DrawAnimItem(const int xoffset, const int yoffset, const int index)
00332 {
00333     CImageList * ima = GetFolderImageList(iSelFolder, IsSmallIconView());
00334
00335     CRect rc, irc;
00336     GetInsideRect(irc);
00337     GetItemRect(iSelFolder, iLastSel, rc);
00338
00339     if (iLastSel >= iFirstItem && irc.bottom > rc.bottom && irc.top < rc.top)
00340     {
00341         ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
00342         CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
00343
00344         ASSERT(index >= 0 && index < pbf->GetItemCount());
00345         CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
00346
00347         ASSERT(pi && ima);
00348
00349         CClientDC dc(this);
00350
00351         if (IsSmallIconView())
00352         {
00353             if (ima)
00354             {
00355                 IMAGEINFO ii;
00356                 ima->GetImageInfo(pi->iImageIndex, &ii);
00357                 CSize szImage = CRect(ii.rcImage).Size();
00358                 CPoint pt;
00359                 pt.x = rc.left + 2;
00360                 pt.y = rc.top + (rc.Height() - szImage.cy) / 2;
00361
00362                 CRect rcBck(pt.x-1, pt.y-1, pt.x + szImage.cx+2, pt.y + szImage.cy+2);
00363                 dc.FillSolidRect(rcBck, crBackGroundColor);
00364
00365                 pt.x += xoffset;
00366                 pt.y += yoffset;
00367
00368                 ima->Draw(&dc, pi->iImageIndex, pt, ILD_NORMAL);
00369
00370             }
00371         }
00372         else
00373         {
00374             if (ima)
00375             {
00376                 IMAGEINFO ii;
00377                 ima->GetImageInfo(pi->iImageIndex, &ii);
00378                 CSize szImage = CRect(ii.rcImage).Size();
00379                 CPoint pt;
00380                 pt.x = rc.left + (rc.Width() - szImage.cx) / 2;
00381                 pt.y = rc.top;
00382
00383                 CRect rcBck(pt.x-1, pt.y-1, pt.x + szImage.cx+2, pt.y + szImage.cy+2);
00384                 dc.FillSolidRect(rcBck, crBackGroundColor);
00385
00386                 pt.x += xoffset;
00387                 pt.y += yoffset;
00388
00389                 ima->Draw(&dc, pi->iImageIndex, pt, ILD_NORMAL);
00390             }
00391         }
00392     }
00393 }
00394
00395 void CGfxOutBarCtrl::OnPaint()
00396 {
00397     CRect clientRc;
00398     GetClientRect(&clientRc);
00399     CPaintDC dc(this);
00400     CDC memDC;
00401     memDC.CreateCompatibleDC(&dc);
00402     CBitmap bmp;
00403     bmp.CreateCompatibleBitmap(&dc, clientRc.Width(), clientRc.Height());
00404     CBitmap * obmp = memDC.SelectObject(&bmp);
00405
00406     CDC * pDC = &memDC;
00407
00408     CRect rc;
00409     GetInsideRect(rc);
00410     if (!GetFolderChild()) pDC->FillSolidRect(rc, crBackGroundColor);
00411
00412
00413     int max = arFolder.GetSize();
00414     CRect frc;
00415     for (int t = 0; t < max; t++)
00416     {
00417         GetFolderRect(t, frc);
00418         DrawFolder(pDC, t, frc, false);
00419     }
00420     if (!GetFolderChild())
00421     {
00422         int f,l;
00423         GetVisibleRange(iSelFolder, f,l);
00424         rcUpArrow.SetRect(0,0,GetSystemMetrics(SM_CXVSCROLL), GetSystemMetrics(SM_CXVSCROLL));
00425         rcDownArrow = rcUpArrow;
00426         rcUpArrow.OffsetRect(rc.right - 5 - GetSystemMetrics(SM_CXVSCROLL), rc.top +5);
00427         rcDownArrow.OffsetRect(rc.right - 5 - GetSystemMetrics(SM_CXVSCROLL), rc.bottom - 5 - GetSystemMetrics(SM_CXVSCROLL));
00428
00429         if (f > 0)
00430         {
00431             if (bUpPressed) pDC->DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP|DFCS_PUSHED);
00432             else pDC->DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP);
00433             bUpArrow = true;
00434             pDC->ExcludeClipRect(rcUpArrow);
00435         }
00436         else bUpArrow = false;
00437
00438         if (l < GetItemCount() - 1)
00439         {
00440             if (bDownPressed) pDC->DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN|DFCS_PUSHED);
00441             else pDC->DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN);
00442             bDownArrow = true;
00443             pDC->ExcludeClipRect(rcDownArrow);
00444         }
00445         else bDownArrow = false;
00446
00447         PaintItems(pDC, iSelFolder, rc);
00448     }
00449
00450     dc.BitBlt(clientRc.left, clientRc.top, clientRc.Width(), clientRc.Height(), &memDC, 0,0, SRCCOPY);
00451
00452     memDC.SelectObject(obmp);
00453
00454     if (iLastFolderHighlighted >= 0)
00455     {
00456         int i = iLastFolderHighlighted;
00457         iLastFolderHighlighted = -1;
00458         HighlightFolder(i);
00459     }
00460     if (iLastItemHighlighted >= 0)
00461     {
00462         int i = iLastItemHighlighted;
00463         iLastItemHighlighted = -1;
00464         HighlightItem(i, bPressedHighlight);
00465     }
00466
00467     // fix potential resource leak - KStowell - 10-21-99
00468     memDC.DeleteDC();
00469     bmp.DeleteObject();
00470 }
00471
00472 BOOL CGfxOutBarCtrl::OnEraseBkgnd(CDC* /*pDC*/)
00473 {
00474     return true;
00475 }
00476
00477 bool CGfxOutBarCtrl::GetFolderRect(const int iIndex, CRect & rect) const
00478 {
00479     int max = arFolder.GetSize();
00480     ASSERT(iIndex >= 0 && iIndex < max);
00481
00482     if (iIndex >= 0 && iIndex < max)
00483     {
00484         CRect rc;
00485         GetClientRect(rc);
00486         if (iIndex > iSelFolder)
00487             rect.SetRect(rc.left, rc.bottom - ((max - iIndex)) * iFolderHeight, rc.right,
00488             rc.bottom - (max - iIndex - 1) * iFolderHeight);
00489         else
00490             rect.SetRect(rc.left, rc.top + iIndex * iFolderHeight - 1, rc.right,
00491             rc.top + (1 + iIndex) * iFolderHeight - 1);
00492         return true;
00493     }
00494     return false;
00495 }
00496
00497 void CGfxOutBarCtrl::GetItemRect(const int iFolder, const int iIndex, CRect & rect)
00498 {
00499     CRect rc;
00500     GetInsideRect(rc);
00501     int top = rc.top;
00502     CSize sz(0,0);
00503     int y = 0;
00504     for (int t = 0; t < iIndex; t++)
00505     {
00506         sz = GetItemSize(iFolder, t, ircAll);
00507         top += sz.cy;
00508
00509         if (IsSmallIconView())
00510         {
00511             top += ySmallIconSpacing;
00512         }
00513         else
00514         {
00515             top += yLargeIconSpacing;
00516         }
00517         if (t == iFirstItem - 1) y = top - rc.top;
00518     }
00519     sz = GetItemSize(iFolder, iIndex, ircAll);
00520     rect.SetRect(rc.left, top, rc.left + sz.cx, top + sz.cy);
00521
00522     rect.top -= y;
00523     rect.bottom -= y;
00524
00525     rect.left += xLeftMargin;
00526     rect.top  += yTopMargin;
00527     rect.bottom += yTopMargin;
00528
00529     if (!IsSmallIconView())
00530     {
00531         rect.left = rc.left;
00532         rect.right = rc.right;
00533     }
00534 }
00535
00536 void CGfxOutBarCtrl::DrawFolder(CDC * pDC, const int iIdx, CRect rect, const bool bSelected)
00537 {
00538     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iIdx);
00539
00540     if (!bSelected)
00541     {
00542         CPen pn1(PS_SOLID, 1, crBackGroundColor1);
00543         CPen * op = pDC->SelectObject(&pn1);
00544         pDC->MoveTo(rect.left, rect.top);
00545         pDC->LineTo(rect.right, rect.top);
00546         pDC->SelectObject(op);
00547
00548         // fix potential resource leak - KStowell - 10-21-99
00549         pn1.DeleteObject();
00550
00551         rect.top ++;
00552
00553         pDC->Draw3dRect(rect, crHilightBorder, crBackGroundColor1);
00554         rect.InflateRect(-1,-1);
00555         pDC->FillSolidRect(rect, cr3dFace);
00556         int obk = pDC->SetBkMode(TRANSPARENT);
00557         CFont * of = pDC->SelectObject(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
00558         pDC->DrawText(CString(pbf->cName), rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
00559         pDC->SetBkMode(obk);
00560         pDC->SelectObject(of);
00561     }
00562     else
00563     {
00564         CPen pn1(PS_SOLID, 1, crBackGroundColor1);
00565         CPen * op = pDC->SelectObject(&pn1);
00566         pDC->MoveTo(rect.left+1, rect.top);
00567         pDC->LineTo(rect.right, rect.top);
00568         pDC->SelectObject(op);
00569
00570         // fix potential resource leak - KStowell - 10-21-99
00571         pn1.DeleteObject();
00572
00573         rect.top ++;
00574
00575         pDC->Draw3dRect(rect, crDkShadowBorder, crHilightBorder);
00576         rect.InflateRect(-1,-1);
00577         pDC->Draw3dRect(rect, crBackGroundColor1, cr3dFace);
00578         rect.InflateRect(-1,-1);
00579
00580         pDC->FillSolidRect(rect, cr3dFace);
00581
00582         int obk = pDC->SetBkMode(TRANSPARENT);
00583         CFont * of = pDC->SelectObject(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
00584         pDC->DrawText(CString(pbf->cName), rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
00585         pDC->SetBkMode(obk);
00586         pDC->SelectObject(of);
00587     }
00588 }
00589
00590 int CGfxOutBarCtrl::AddFolder( LPCTSTR cFolderName, const DWORD exData )
00591 {
00592     CBarFolder* pbf = new CBarFolder(cFolderName, exData);
00593
00594     ASSERT(pbf);
00595
00596     arFolder.Add((void *)pbf);
00597
00598     return arFolder.GetSize() - 1;
00599 }
00600
00601 CGfxOutBarCtrl::CBarFolder::CBarFolder( LPCTSTR name, DWORD exData)
00602 {
00603     cName  = NULL;
00604     dwData = exData;
00605
00606     if( name )
00607     {
00608         cName = new TCHAR[ _tcslen( name ) + 1 ];
00609
00610         ASSERT(cName);
00611
00612         _tcscpy( cName, name );
00613     }
00614
00615     pLargeImageList = NULL;
00616     pSmallImageList = NULL;
00617     pChild          = NULL;
00618 }
00619
00620 CGfxOutBarCtrl::CBarFolder::~CBarFolder()
00621 {
00622     if (cName) delete [] cName;
00623     for (int t = 0; t < arItems.GetSize(); t++)
00624         if (arItems.GetAt(t)) delete (CBarFolder*) arItems.GetAt(t);
00625
00626     arItems.RemoveAll();
00627 }
00628
00629 void CGfxOutBarCtrl::GetInsideRect(CRect & rect) const
00630 {
00631     GetClientRect(rect);
00632     if (arFolder.GetSize() > 0)
00633     {
00634         int max = arFolder.GetSize();
00635         rect.top += iFolderHeight * (iSelFolder + 1) - 1;//+ 2;
00636         rect.bottom -= (max - iSelFolder - 1)*iFolderHeight;
00637         return;
00638     }
00639 }
00640
00641 void CGfxOutBarCtrl::OnMouseMove(UINT nFlags, CPoint point)
00642 {
00643     int index, ht = HitTestEx(point, index);
00644
00645     if (ht != htFolder && iLastFolderHighlighted >= 0) HighlightFolder(-1);
00646     if (ht != htItem   && iLastItemHighlighted   >= 0) HighlightItem(-1);
00647
00648     if (ht == htFolder)
00649     {
00650         HighlightFolder(index);
00651         SetTimer(1,100,NULL);
00652     }
00653     else if (ht == htItem)
00654     {
00655         HighlightItem(index);
00656         SetTimer(1,100,NULL);
00657     }
00658
00659     CWnd::OnMouseMove(nFlags, point);
00660 }
00661
00662 int CGfxOutBarCtrl::HitTestEx(const CPoint & point, int &index)
00663 {
00664     if (bUpArrow && rcUpArrow.PtInRect(point)) return htUpScroll;
00665     if (bDownArrow && rcDownArrow.PtInRect(point)) return htDownScroll;
00666
00667     int max = arFolder.GetSize(), t;
00668
00669     CRect rc;
00670     for (t = 0; t < max; t++)
00671     {
00672         GetFolderRect(t, rc);
00673         if (rc.PtInRect(point))
00674         {
00675             index = t;
00676             return htFolder;
00677         }
00678     }
00679     GetInsideRect(rc);
00680     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
00681     max = pbf->GetItemCount();
00682     for (t = iFirstItem; t < max; t++)
00683     {
00684         CRect itemRc;
00685         if (!IsSmallIconView())
00686         {
00687             GetIconRect(iSelFolder, t, itemRc);
00688             if (itemRc.PtInRect(point))
00689             {
00690                 index = t;
00691                 return htItem;
00692             }
00693             else if (itemRc.top > rc.bottom) break;
00694             GetLabelRect(iSelFolder, t, itemRc);
00695             itemRc.top -= yLargeIconLabelOffset;
00696
00697             if (itemRc.PtInRect(point))
00698             {
00699                 index = t;
00700                 return htItem;
00701             }
00702             else if (itemRc.top > rc.bottom) break;
00703         }
00704         else
00705         {
00706             GetItemRect(iSelFolder, t, itemRc);
00707             if (itemRc.PtInRect(point))
00708             {
00709                 index = t;
00710                 return htItem;
00711             }
00712             else if (itemRc.top > rc.bottom) break;
00713         }
00714     }
00715     return htNothing;
00716 }
00717
00718 void CGfxOutBarCtrl::HighlightFolder(const int index)
00719 {
00720     CWnd * pf = GetFocus();
00721     if (pf != NULL && pf != this && IsChild(pf)) return;
00722
00723     if (iLastFolderHighlighted == index) return;
00724
00725     if (iLastFolderHighlighted >= 0)
00726     {
00727         CRect rc;
00728         if (GetFolderRect(iLastFolderHighlighted, rc))
00729         {
00730             CClientDC dc(this);
00731             CPen pn(PS_SOLID, 1, crBackGroundColor1);//crShadowBorder);
00732             CPen * op = dc.SelectObject(&pn);
00733             dc.MoveTo(rc.left, rc.bottom-1);
00734             dc.LineTo(rc.right-1, rc.bottom-1);
00735             dc.LineTo(rc.right-1, rc.top);
00736             CPen pn1(PS_SOLID, 1, cr3dFace);
00737             dc.SelectObject(&pn1);
00738             dc.MoveTo(rc.left+1, rc.bottom-2);
00739             dc.LineTo(rc.right-2, rc.bottom-2);
00740             dc.LineTo(rc.right-2, rc.top+1);
00741             dc.SelectObject(op);
00742
00743             // fix potential resource leak - KStowell - 10-21-99
00744             pn.DeleteObject();
00745         }
00746     }
00747     iLastFolderHighlighted = index;
00748     if (iLastFolderHighlighted >= 0)
00749     {
00750         CRect rc;
00751         if (GetFolderRect(iLastFolderHighlighted, rc))
00752         {
00753             CClientDC dc(this);
00754             CPen pn(PS_SOLID, 1, crDkShadowBorder);
00755             CPen * op = dc.SelectObject(&pn);
00756             dc.MoveTo(rc.left, rc.bottom-1);
00757             dc.LineTo(rc.right-1, rc.bottom-1);
00758             dc.LineTo(rc.right-1, rc.top);
00759             CPen pn1(PS_SOLID, 1, crBackGroundColor1);
00760             dc.SelectObject(&pn1);
00761             dc.MoveTo(rc.left+1, rc.bottom-2);
00762             dc.LineTo(rc.right-2, rc.bottom-2);
00763             dc.LineTo(rc.right-2, rc.top+1);
00764             dc.SelectObject(op);
00765
00766             // fix potential resource leak - KStowell - 10-21-99
00767             pn.DeleteObject();
00768         }
00769     }
00770 }
00771
00772 void CGfxOutBarCtrl::OnLButtonDown(UINT nFlags, CPoint point)
00773 {
00774     if (GetFocus() != this) SetFocus();
00775
00776     int index, ht = HitTestEx(point, index);
00777     iLastDragItemDrawType = -1;
00778
00779     CRect inRc;
00780     GetInsideRect(inRc);
00781
00782     if (ht == htFolder)
00783     {
00784         bool bHigh = true;
00785         CRect rc;
00786         GetFolderRect(index, rc);
00787
00788         if (::GetCapture() == NULL)
00789         {
00790             SetCapture();
00791             ASSERT(this == GetCapture());
00792             CClientDC dc(this);
00793             DrawFolder(&dc, index, rc, true);
00794             AfxLockTempMaps();
00795             for (;;)
00796             {
00797                 MSG msg;
00798                 VERIFY(::GetMessage(&msg, NULL, 0, 0));
00799
00800                 if (CWnd::GetCapture() != this) break;
00801
00802                 switch (msg.message)
00803                 {
00804                 case WM_MOUSEMOVE:
00805                     {
00806                         CPoint pt(msg.lParam);
00807                         int idx, ht1 = HitTestEx(pt, idx);
00808                         if (ht1 == htFolder && idx == index)
00809                         {
00810                             if (!bHigh)
00811                             {
00812                                 DrawFolder(&dc, index, rc, true);
00813                                 bHigh = true;
00814                             }
00815                         }
00816                         else
00817                         {
00818                             if (bHigh)
00819                             {
00820                                 DrawFolder(&dc, index, rc, false);
00821                                 bHigh = false;
00822                             }
00823                         }
00824                     }
00825                     break;
00826
00827                 case WM_LBUTTONUP:
00828                     {
00829                         if (bHigh)
00830                         {
00831                             DrawFolder(&dc, index, rc, false);
00832                             bHigh = false;
00833                         }
00834                         CPoint pt(msg.lParam);
00835                         int idx, ht1 = HitTestEx(pt, idx);
00836                         if (ht1 == htFolder && idx != iSelFolder)
00837                             SetSelFolder(idx);
00838                     }
00839
00840                     goto ExitLoop2;
00841
00842                 case WM_KEYDOWN:
00843                     if (msg.wParam != VK_ESCAPE)
00844                         break;
00845
00846                 default:
00847                     DispatchMessage(&msg);
00848                     break;
00849                 }
00850             }
00851
00852         ExitLoop2:
00853             ReleaseCapture();
00854             AfxUnlockTempMaps(FALSE);
00855         }
00856         if (bHigh) InvalidateRect(rc, false);
00857     }
00858     else iLastSelectedFolder = -1;
00859
00860     if (ht == htItem)
00861     {
00862         iLastDragItemDraw = -1;
00863         bool bHigh = true, bDragging = false;
00864         CRect rc;
00865         GetItemRect(iSelFolder, index, rc);
00866
00867         HCURSOR hCur = GetCursor();
00868
00869         if (::GetCapture() == NULL)
00870         {
00871             SetCapture();
00872             ASSERT(this == GetCapture());
00873             CClientDC dc(this);
00874             HighlightItem(index, true);
00875             AfxLockTempMaps();
00876             for (;;)
00877             {
00878                 MSG msg;
00879                 VERIFY(::GetMessage(&msg, NULL, 0, 0));
00880
00881                 if (CWnd::GetCapture() != this) break;
00882
00883                 switch (msg.message)
00884                 {
00885                 case WM_MOUSEMOVE:
00886                     {
00887                         CPoint pt(msg.lParam);
00888                         int idx, ht1 = HitTestEx(pt, idx);
00889                         if (bDragging)
00890                         {
00891                             if (ht1 == htItem)
00892                             {
00893                                 DrawDragArrow(&dc, index, idx);
00894                                 SetCursor(hDragCursor);
00895                                 hCur = hDragCursor;
00896                             }
00897                             else
00898                             {
00899                                 CRect rcItem;
00900                                 GetItemRect(iSelFolder, GetItemCount() - 1, rcItem);
00901                                 if (pt.y > rcItem.bottom && pt.y < inRc.bottom)
00902                                 {
00903                                     DrawDragArrow(&dc, index, GetItemCount());
00904                                     SetCursor(hDragCursor);
00905                                     hCur = hDragCursor;
00906                                 }
00907                                 else
00908                                 {
00909                                     DrawDragArrow(&dc, index, -1);
00910                                     SetCursor(hNoDragCursor);
00911                                     hCur = hNoDragCursor;
00912                                 }
00913                             }
00914                         }
00915                         else
00916                         {
00917                             if (ht1 == htItem && idx == index)
00918                             {
00919                                 if (!bHigh)
00920                                 {
00921                                     HighlightItem(index, true);
00922                                     bHigh = true;
00923                                     bPressedHighlight = true;
00924                                 }
00925                             }
00926                             else
00927                             {
00928                                 if (ht1 == htItem)
00929                                 {
00930                                     if (bHigh)
00931                                     {
00932                                         HighlightItem(index, false);
00933                                         bHigh = false;
00934                                         bPressedHighlight = false;
00935                                     }
00936                                 }
00937                                 else
00938                                 {
00939                                     if (dwFlags&fDragItems)
00940                                     {
00941                                         HighlightItem(index, true);
00942                                         bHigh = true;
00943                                         bDragging = true;
00944
00945                                         SetCursor(hDragCursor);
00946                                         hCur = hDragCursor;
00947
00948                                         bPressedHighlight = true;
00949                                     }
00950                                 }
00951                             }
00952                         }
00953                     }
00954                     break;
00955
00956                 case WM_SETCURSOR:
00957                     SetCursor(hCur);
00958                     break;
00959
00960                 case WM_LBUTTONUP:
00961                     {
00962                         if (bHigh)
00963                         {
00964                             HighlightItem(-1);
00965                             bHigh = false;
00966                         }
00967                         CPoint pt(msg.lParam);
00968                         int idx, ht1 = HitTestEx(pt, idx);
00969                         if (!bDragging)
00970                         {
00971                             if (ht1 == htItem && idx == index)
00972                             {
00973                                 if (iSelAnimTiming > 0 && index != iLastSel && iLastSel >= 0)
00974                                 {
00975                                     DrawAnimItem(0, 0, iLastSel);
00976                                 }
00977
00978                                 if (dwFlags&fSelHighlight && iLastSel >= 0)
00979                                 {
00980                                     CRect rc;
00981                                     GetIconRect(iSelFolder, iLastSel, rc);
00982                                     rc.InflateRect(1,1);
00983                                     InvalidateRect(rc);
00984                                 }
00985
00986                                 iLastSel = index;
00987
00988                                 if (dwFlags&fSelHighlight && iLastSel >= 0)
00989                                 {
00990                                     CRect rc;
00991                                     GetIconRect(iSelFolder, iLastSel, rc);
00992                                     rc.InflateRect(1,1);
00993                                     InvalidateRect(rc);
00994                                 }
00995
00996                                 GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_ITEMCLICK, idx);
00997                             }
00998                         }
00999                         else
01000                         {
01001                             if (ht1 == htItem)
01002                             {
01003                                 if (idx != index)
01004                                 {
01005                                     OUTBAR_INFO ob;
01006                                     ob.iDragFrom = iSelFolder;
01007                                     ob.iDragTo = index;
01008                                     if (GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_DRAGITEM, (LPARAM) &ob))
01009                                     {
01010                                         CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
01011                                         CBarItem * piFrom = (CBarItem *) pbf->arItems.GetAt(index);
01012                                         pbf->arItems.RemoveAt(index);
01013                                         if (idx > index) idx --;
01014                                         pbf->arItems.InsertAt(idx, piFrom);
01015                                     }
01016                                 }
01017                             }
01018                             else
01019                             {
01020                                 CRect rcItem;
01021                                 GetItemRect(iSelFolder, GetItemCount() - 1, rcItem);
01022                                 if (pt.y > rcItem.bottom && pt.y < inRc.bottom)
01023                                 {
01024                                     OUTBAR_INFO ob;
01025                                     ob.iDragFrom = iSelFolder;
01026                                     ob.iDragTo = index;
01027                                     if (GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_DRAGITEM, (LPARAM) &ob))
01028                                     {
01029                                         CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
01030                                         CBarItem * piFrom = (CBarItem *) pbf->arItems.GetAt(index);
01031                                         pbf->arItems.RemoveAt(index);
01032                                         pbf->arItems.Add((void *) piFrom);
01033                                     }
01034                                 }
01035                             }
01036                         }
01037                     }
01038
01039                     goto ExitLoop4;
01040
01041                 default:
01042                     DispatchMessage(&msg);
01043                     break;
01044                 }
01045             }
01046
01047         ExitLoop4:
01048             ReleaseCapture();
01049             AfxUnlockTempMaps(FALSE);
01050             if (bDragging)
01051             {
01052                 Invalidate();
01053             }
01054         }
01055         bPressedHighlight = false;
01056         if (bHigh) InvalidateRect(rc, false);
01057     }
01058     else iLastItemHighlighted = -1;
01059
01060     if (ht == htDownScroll)
01061     {
01062         bLooping = true;
01063         bool bHigh = true;
01064
01065         if (::GetCapture() == NULL)
01066         {
01067             SetCapture();
01068             ASSERT(this == GetCapture());
01069             CClientDC dc(this);
01070             dc.DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN|DFCS_PUSHED);
01071             SetTimer(2,300,NULL);
01072             AfxLockTempMaps();
01073             for (;;)
01074             {
01075                 MSG msg;
01076                 VERIFY(::GetMessage(&msg, NULL, 0, 0));
01077
01078                 if (CWnd::GetCapture() != this) break;
01079
01080                 switch (msg.message)
01081                 {
01082                 case WM_MOUSEMOVE:
01083                     {
01084                         CPoint pt(msg.lParam);
01085                         if (rcDownArrow.PtInRect(pt))
01086                         {
01087                             if (bHigh == false)
01088                             {
01089                                 dc.DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN|DFCS_PUSHED);
01090                                 bHigh = true;
01091                                 bDownArrow = true;
01092                                 bDownPressed = true;
01093                             }
01094                         }
01095                         else
01096                         {
01097                             if (bHigh == true)
01098                             {
01099                                 dc.DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN);
01100                                 bHigh = false;
01101                                 bDownArrow = false;
01102                                 bDownPressed = false;
01103                             }
01104                         }
01105                     }
01106                     break;
01107
01108                 case WM_LBUTTONUP:
01109                     {
01110                         if (bHigh)
01111                         {
01112                             dc.DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN);
01113                             bHigh = false;
01114                         }
01115                         bDownArrow = false;
01116                         CPoint pt(msg.lParam);
01117                         if (rcDownArrow.PtInRect(pt))
01118                         {
01119                             CRect itrc;
01120                             GetItemRect(iSelFolder, GetItemCount() - 1, itrc);
01121                             CRect crc;
01122                             GetInsideRect(crc);
01123                             if (itrc.bottom > crc.bottom)
01124                             {
01125                                 iFirstItem ++;
01126                                 InvalidateRect(crc, true);
01127                             }
01128                         }
01129                     }
01130                     goto ExitLoop3;
01131
01132
01133                 case WM_TIMER:
01134                     {
01135                         if (msg.wParam == 2)
01136                         {
01137                             if (bHigh)
01138                             {
01139                                 CPoint pt(msg.pt);
01140                                 ScreenToClient(&pt);
01141                                 if (rcDownArrow.PtInRect(pt))
01142                                 {
01143                                     bDownPressed = true;
01144                                     CRect itrc;
01145                                     GetItemRect(iSelFolder, GetItemCount() - 1, itrc);
01146                                     CRect crc;
01147                                     GetInsideRect(crc);
01148                                     if (itrc.bottom > crc.bottom)
01149                                     {
01150                                         iFirstItem ++;
01151                                         InvalidateRect(crc, true);
01152                                     }
01153                                     else goto ExitLoop3;
01154                                 }
01155                                 else bDownPressed = false;
01156                             }
01157                         }
01158                         break;
01159                     }
01160
01161                 case WM_KEYDOWN:
01162                     if (msg.wParam != VK_ESCAPE)
01163                         break;
01164
01165                 default:
01166                     DispatchMessage(&msg);
01167                     break;
01168                 }
01169             }
01170
01171         ExitLoop3:
01172             KillTimer(2);
01173             ReleaseCapture();
01174             AfxUnlockTempMaps(FALSE);
01175             bLooping = false;
01176             bDownPressed = false;
01177             bDownArrow = false;
01178             CRect crc;
01179             GetInsideRect(crc);
01180             InvalidateRect(crc, true);
01181         }
01182     }
01183
01184     if (ht == htUpScroll)
01185     {
01186         bLooping = true;
01187         bool bHigh = true;
01188
01189         if (::GetCapture() == NULL)
01190         {
01191             SetCapture();
01192             ASSERT(this == GetCapture());
01193             CClientDC dc(this);
01194             dc.DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP|DFCS_PUSHED);
01195             SetTimer(2,300,NULL);
01196             AfxLockTempMaps();
01197             for (;;)
01198             {
01199                 MSG msg;
01200                 VERIFY(::GetMessage(&msg, NULL, 0, 0));
01201
01202                 if (CWnd::GetCapture() != this) break;
01203
01204                 switch (msg.message)
01205                 {
01206                 case WM_MOUSEMOVE:
01207                     {
01208                         CPoint pt(msg.lParam);
01209                         if (rcUpArrow.PtInRect(pt))
01210                         {
01211                             if (bHigh == false)
01212                             {
01213                                 dc.DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP|DFCS_PUSHED);
01214                                 bHigh = true;
01215                                 bUpArrow = true;
01216                                 bUpPressed = true;
01217                             }
01218                         }
01219                         else
01220                         {
01221                             if (bHigh == true)
01222                             {
01223                                 dc.DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP);
01224                                 bHigh = false;
01225                                 bUpArrow = false;
01226                                 bUpPressed = false;
01227                             }
01228                         }
01229                     }
01230                     break;
01231
01232                 case WM_LBUTTONUP:
01233                     {
01234                         if (bHigh)
01235                         {
01236                             dc.DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP);
01237                             bHigh = false;
01238                         }
01239                         bUpArrow = false;
01240                         CPoint pt(msg.lParam);
01241                         if (rcUpArrow.PtInRect(pt))
01242                         {
01243                             if (iFirstItem > 0 )
01244                             {
01245                                 iFirstItem --;
01246                                 CRect crc;
01247                                 GetInsideRect(crc);
01248                                 InvalidateRect(crc, true);
01249                             }
01250                         }
01251                     }
01252
01253                     goto ExitLoop;
01254
01255                 case WM_TIMER:
01256                     {
01257                         if (msg.wParam == 2)
01258                         {
01259                             if (bHigh)
01260                             {
01261                                 CPoint pt(msg.pt);
01262                                 ScreenToClient(&pt);
01263                                 if (rcUpArrow.PtInRect(pt))
01264                                 {
01265                                     bUpPressed = true;
01266                                     if (iFirstItem > 0)
01267                                     {
01268                                         iFirstItem --;
01269                                         CRect crc;
01270                                         GetInsideRect(crc);
01271                                         InvalidateRect(crc, true);
01272                                     }
01273                                     else goto ExitLoop;
01274                                 }
01275                                 else bUpPressed = false;
01276                             }
01277                         }
01278                         break;
01279                     }
01280                 case WM_KEYDOWN:
01281                     if (msg.wParam != VK_ESCAPE) break;
01282
01283                 default:
01284                     DispatchMessage(&msg);
01285                     break;
01286                 }
01287             }
01288
01289         ExitLoop:
01290             KillTimer(2);
01291             ReleaseCapture();
01292             AfxUnlockTempMaps(FALSE);
01293             bLooping = false;
01294             bUpPressed = false;
01295             bUpArrow = false;
01296             CRect crc;
01297             GetInsideRect(crc);
01298             InvalidateRect(crc, true);
01299         }
01300     }
01301
01302     CWnd::OnLButtonDown(nFlags, point);
01303 }
01304
01305
01306 int CGfxOutBarCtrl::InsertItem(const int folder, const int index, LPCTSTR text, const int image, const DWORD exData)
01307 {
01308     ASSERT(folder >= 0 && folder < GetFolderCount());
01309
01310     CBarFolder* pbf = (CBarFolder*) arFolder.GetAt(folder);
01311
01312     return pbf->InsertItem(index, text, image, exData);
01313 }
01314
01315 int CGfxOutBarCtrl::GetItemCount() const
01316 {
01317     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
01318     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
01319     return  pbf->GetItemCount();
01320 }
01321
01322 void CGfxOutBarCtrl::SetSelFolder(const int index)
01323 {
01324     ASSERT(index >= 0 && index < GetFolderCount());
01325 //  if (index == iSelFolder) return;
01326
01327     CWnd * pc = GetFolderChild();
01328     if (pc) pc->ShowWindow(SW_HIDE);
01329
01330     if (index != iSelFolder)
01331     {
01332         if (dwFlags&fAnimation && lAnimationTickCount >= 0) AnimateFolderScroll(iSelFolder, index);
01333     }
01334
01335     iSelFolder = index;
01336     iFirstItem = 0;
01337     iLastSel = -1;
01338
01339     pc = GetFolderChild();
01340     if (pc)
01341     {
01342         CRect rc;
01343         GetInsideRect(rc);
01344         pc->MoveWindow(rc);
01345         pc->ShowWindow(SW_SHOW);
01346     }
01347
01348     GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_FOLDERCHANGE, (LPARAM) iSelFolder);
01349
01350     Invalidate();
01351 }
01352
01353 int CGfxOutBarCtrl::GetFolderCount() const
01354 {
01355     return arFolder.GetSize();
01356 }
01357
01358 int CGfxOutBarCtrl::GetSelFolder() const
01359 {
01360     return iSelFolder;
01361 }
01362
01363 void CGfxOutBarCtrl::RemoveFolder(const int index)
01364 {
01365     ASSERT(index >= 0 && index < GetFolderCount());
01366     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(index);
01367     delete pbf;
01368     arFolder.RemoveAt(index);
01369     if (iSelFolder >= index) iSelFolder = index - 1;
01370     if (iSelFolder < 0 && GetFolderCount() > 0) iSelFolder = 0;
01371     Invalidate();
01372 }
01373
01374 int CGfxOutBarCtrl::CBarFolder::InsertItem(int index, LPCTSTR text, const int image, const DWORD exData)
01375 {
01376     if (index < 0 || index > GetItemCount()) index = GetItemCount();
01377
01378     int c = GetItemCount();
01379
01380     CBarItem* pbf = new CBarItem(text, image, exData);
01381
01382     ASSERT(pbf);
01383
01384     if( index < GetItemCount())
01385     {
01386         arItems.InsertAt(index, (void *) pbf);
01387     }
01388     else
01389     {
01390         arItems.Add((void *) pbf);
01391     }
01392
01393     c = GetItemCount();
01394
01395     return index;
01396 }
01397
01398 int CGfxOutBarCtrl::GetCountPerPage() const
01399 {
01400     return 0;
01401 }
01402
01403 CImageList * CGfxOutBarCtrl::SetImageList(CImageList * pImageList, int nImageList)
01404 {
01405     CImageList * o = NULL;
01406     if (nImageList == fSmallIcon)
01407     {
01408         o = pSmallImageList;
01409         pSmallImageList = pImageList;
01410     }
01411     else if (nImageList == fLargeIcon)
01412     {
01413         o = pLargeImageList;
01414         pLargeImageList = pImageList;
01415     }
01416     return o;
01417 }
01418
01419 CImageList * CGfxOutBarCtrl::GetImageList(CImageList* /*pImageList*/, int nImageList)
01420 {
01421     if (nImageList == fSmallIcon) return pSmallImageList;
01422     else if (nImageList == fLargeIcon) return pLargeImageList;
01423     return NULL;
01424 }
01425
01426 CImageList * CGfxOutBarCtrl::SetFolderImageList(const int folder, CImageList * pImageList, int nImageList)
01427 {
01428     ASSERT(folder >= 0 && folder < GetFolderCount());
01429     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(folder);
01430     CImageList * o = NULL;
01431     if (nImageList == fSmallIcon)
01432     {
01433         o = pbf->pSmallImageList;
01434         pbf->pSmallImageList = pImageList;
01435     }
01436     else if (nImageList == fLargeIcon)
01437     {
01438         o = pbf->pLargeImageList;
01439         pbf->pLargeImageList = pImageList;
01440     }
01441     return o;
01442 }
01443
01444 CGfxOutBarCtrl::CBarItem::CBarItem( LPCTSTR name, const int image, DWORD exData )
01445 {
01446     cItem       = NULL;
01447     iImageIndex = image;
01448     dwData      = exData;
01449
01450     if( name )
01451     {
01452         cItem = new TCHAR[ _tcslen( name ) + 1 ];
01453
01454         ASSERT(cItem);
01455
01456         _tcscpy( cItem, name );
01457     }
01458 }
01459
01460 CGfxOutBarCtrl::CBarItem::~CBarItem()
01461 {
01462     if (cItem) delete [] cItem;
01463 }
01464
01465 int CGfxOutBarCtrl::CBarFolder::GetItemCount()
01466 {
01467     return arItems.GetSize();
01468 }
01469
01470 void CGfxOutBarCtrl::PaintItems(CDC * pDC, const int iFolder, CRect rc)
01471 {
01472     ASSERT(iFolder >= 0 && iFolder < GetFolderCount());
01473     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
01474     int max = pbf->GetItemCount(), t;
01475     CRect irc;
01476     GetInsideRect(irc);
01477     int isdc = pDC->SaveDC();
01478     CRgn itemRegion;
01479     itemRegion.CreateRectRgnIndirect(&irc);
01480     pDC->SelectClipRgn(&itemRegion);
01481     itemRegion.DeleteObject();
01482     for (t = iFirstItem; t < max; t++)
01483     {
01484         CRect itemRc;
01485         GetItemRect(iFolder, t, itemRc);
01486         if (itemRc.top > rc.bottom) break;
01487         else DrawItem(pDC, iFolder, itemRc, t);
01488     }
01489     pDC->RestoreDC(isdc);
01490 }
01491
01492
01493 CSize CGfxOutBarCtrl::GetItemSize(const int iFolder, const int index, const int type)
01494 {
01495     ASSERT(iFolder >= 0 && iFolder < GetFolderCount());
01496     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
01497
01498     ASSERT(index >= 0 && index < pbf->GetItemCount());
01499     CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
01500
01501     CSize szImage(0,0);
01502     CSize szLabel(0,0);
01503     CSize szAll(0,0);
01504
01505     if (pi->iImageIndex >= 0)
01506     {
01507         if (type != ircLabel)
01508         {
01509             CImageList * il = GetFolderImageList(iFolder, IsSmallIconView());
01510             ASSERT(il);
01511             if (il)
01512             {
01513                 IMAGEINFO ii;
01514                 il->GetImageInfo(pi->iImageIndex, &ii);
01515                 szImage = CRect(ii.rcImage).Size();
01516             }
01517         }
01518     }
01519     if (pi->cItem)
01520     {
01521         if (type != ircIcon)
01522         {
01523             CClientDC dc(this);
01524             CFont * oft = (CFont *) dc.SelectObject(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
01525             if (IsSmallIconView())
01526             {
01527                 szLabel = dc.GetTextExtent(pi->cItem, lstrlen(pi->cItem));
01528             }
01529             else
01530             {
01531                 CRect rc;
01532                 GetInsideRect(rc);
01533                 rc.bottom = rc.top;
01534                 dc.DrawText(pi->cItem, lstrlen(pi->cItem), rc, DT_CALCRECT|DT_CENTER|DT_WORDBREAK);
01535                 szLabel = rc.Size();
01536             }
01537             dc.SelectObject(oft);
01538         }
01539     }
01540     if (IsSmallIconView())
01541     {
01542         if (type == ircIcon) szAll = szImage;
01543         else if (type == ircLabel) szAll = szLabel;
01544         else if (type == ircAll) szAll = CSize(szImage.cx + szLabel.cx + xSmallIconLabelOffset, szImage.cy > szLabel.cy ? szImage.cy : szLabel.cy);
01545     }
01546     else
01547     {
01548         if (type == ircIcon) szAll = szImage;
01549         else if (type == ircLabel) szAll = szLabel;
01550         else if (type == ircAll)
01551         {
01552             szAll = CSize(szImage.cx > szLabel.cx ? szImage.cx : szLabel.cx, szLabel.cy + szImage.cy + yLargeIconLabelOffset + yLargeIconSpacing);
01553         }
01554     }
01555     return szAll;
01556 }
01557
01558 CImageList * CGfxOutBarCtrl::GetFolderImageList(const int index, const bool bSmall) const
01559 {
01560     ASSERT(index >= 0 && index < GetFolderCount());
01561     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(index);
01562     if (bSmall)
01563     {
01564         if (pbf->pSmallImageList) return pbf->pSmallImageList; else return pSmallImageList;
01565     }
01566     if (pbf->pLargeImageList) return pbf->pLargeImageList; else return pLargeImageList;
01567 }
01568
01569 void CGfxOutBarCtrl::DrawItem(CDC * pDC, const int iFolder, CRect rc, const int index, const bool bOnlyImage)
01570 {
01571     CImageList * ima = GetFolderImageList(iFolder, IsSmallIconView());
01572
01573     ASSERT(iFolder >= 0 && iFolder < GetFolderCount());
01574     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
01575
01576     ASSERT(index >= 0 && index < pbf->GetItemCount());
01577     CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
01578
01579     ASSERT(pi && ima);
01580
01581     CFont * oft = (CFont *) pDC->SelectObject(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
01582     COLORREF ocr = pDC->SetTextColor(crTextColor);
01583     int obk = pDC->SetBkMode(TRANSPARENT);
01584
01585     if (IsSmallIconView())
01586     {
01587         if (ima)
01588         {
01589             IMAGEINFO ii;
01590             ima->GetImageInfo(pi->iImageIndex, &ii);
01591             CSize szImage = CRect(ii.rcImage).Size();
01592             CPoint pt;
01593             pt.x = rc.left + 2;
01594             pt.y = rc.top + (rc.Height() - szImage.cy) / 2;
01595             ima->Draw(pDC, pi->iImageIndex, pt, ILD_NORMAL);
01596
01597             if (!bOnlyImage)
01598             {
01599                 rc.left += szImage.cx + xSmallIconLabelOffset;
01600                 pDC->TextOut(rc.left, rc.top, CString(pi->cItem));
01601             }
01602
01603         }
01604     }
01605     else
01606     {
01607         if (ima)
01608         {
01609             IMAGEINFO ii;
01610             ima->GetImageInfo(pi->iImageIndex, &ii);
01611             CSize szImage = CRect(ii.rcImage).Size();
01612             CPoint pt;
01613             pt.x = rc.left + (rc.Width() - szImage.cx) / 2;
01614             pt.y = rc.top;// + (rc.Height() - szImage.cy) / 2;
01615             ima->Draw(pDC, pi->iImageIndex, pt, ILD_NORMAL);
01616             if (!bOnlyImage)
01617             {
01618                 rc.top += szImage.cy + yLargeIconLabelOffset;
01619                 pDC->DrawText(pi->cItem, lstrlen(pi->cItem), rc, DT_CENTER|DT_WORDBREAK);
01620             }
01621         }
01622     }
01623
01624     if (dwFlags&fSelHighlight && iLastSel == index && iLastSel >= 0)
01625     {
01626         CRect rc;
01627         GetIconRect(iSelFolder, iLastSel, rc);
01628         rc.InflateRect(1,1);
01629         pDC->Draw3dRect(rc, crDkShadowBorder, cr3dFace);
01630     }
01631
01632     pDC->SetTextColor(ocr);
01633     pDC->SelectObject(oft);
01634     pDC->SetBkMode(obk);
01635
01636 }
01637
01638
01639 BOOL CGfxOutBarCtrl::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
01640 {
01641     CPoint pt(GetMessagePos());
01642     ScreenToClient(&pt);
01643     int index, ht = HitTestEx(pt, index);
01644     if (ht == htFolder)
01645     {
01646         SetCursor(hHandCursor);
01647         return true;
01648     }
01649
01650     return CWnd::OnSetCursor(pWnd, nHitTest, message);
01651 }
01652
01653 void CGfxOutBarCtrl::GetVisibleRange(const int iFolder, int & first, int & last)
01654 {
01655     first = iFirstItem;
01656     CRect rc;
01657     GetInsideRect(rc);
01658
01659     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
01660     int max = pbf->GetItemCount(), t;
01661     for (t = iFirstItem; t < max; t++)
01662     {
01663         CRect itemRc;
01664         GetItemRect(iFolder, t, itemRc);
01665         if (itemRc.bottom > rc.bottom)
01666         {
01667             last = t - 1;
01668             break;
01669         }
01670         else last = t;
01671     }
01672 }
01673
01674 void CGfxOutBarCtrl::OnSize(UINT nType, int cx, int cy)
01675 {
01676     bUpArrow = bDownArrow = false;
01677
01678     CWnd::OnSize(nType, cx, cy);
01679
01680     int t, max = GetFolderCount();
01681     CRect rc;
01682     GetInsideRect(rc);
01683
01684     for (t = 0; t < max; t++)
01685     {
01686         CWnd * pc = GetFolderChild(t);
01687         if (pc) pc->SetWindowPos(0, rc.left, rc.top, rc.Width(), rc.Height(), SWP_NOZORDER);
01688     }
01689 }
01690
01691 void CGfxOutBarCtrl::HighlightItem(const int index, const bool bPressed)
01692 {
01693     CWnd * pf = GetFocus();
01694     if (pf != NULL && pf != this && IsChild(pf)) return;
01695
01696     static bool bOldPressed = false;
01697     if (iLastItemHighlighted == index && bOldPressed == bPressed) return;
01698
01699     bOldPressed = bPressed;
01700
01701     CClientDC dc(this);
01702
01703     CRect irc;
01704     GetInsideRect(irc);
01705     int isdc = dc.SaveDC();
01706     CRgn itemRegion;
01707     itemRegion.CreateRectRgnIndirect(&irc);
01708     dc.SelectClipRgn(&itemRegion);
01709     itemRegion.DeleteObject();
01710
01711
01712     if (iLastItemHighlighted >= 0 && IsValidItem(iLastItemHighlighted))
01713     {
01714         CRect rc;
01715         GetIconRect(iSelFolder, iLastItemHighlighted, rc);
01716         rc.InflateRect(1,1);
01717         dc.Draw3dRect(rc, crBackGroundColor, crBackGroundColor);
01718     }
01719     if (iSelAnimTiming > 0 && index == iLastSel)
01720     {
01721         iLastItemHighlighted = -1;
01722         return;
01723     }
01724     if (dwFlags&fSelHighlight && iLastSel == index)
01725     {
01726         iLastItemHighlighted = -1;
01727         return;
01728     }
01729
01730     iLastItemHighlighted = index;
01731     if (iLastItemHighlighted >= 0 && IsValidItem(iLastItemHighlighted))
01732     {
01733         CRect rc;
01734         GetIconRect(iSelFolder, iLastItemHighlighted, rc);
01735         rc.InflateRect(1,1);
01736         if (bPressed)
01737             dc.Draw3dRect(rc, crDkShadowBorder, cr3dFace);
01738         else
01739             dc.Draw3dRect(rc, cr3dFace, crDkShadowBorder);
01740     }
01741     dc.RestoreDC(isdc);
01742     GetOwner()->SendMessage(WM_OUTBAR_NOTIFY,NM_OB_ITEMHOVER,index);
01743 }
01744
01745 void CGfxOutBarCtrl::GetIconRect(const int iFolder, const int iIndex, CRect & rect)
01746 {
01747     CRect rc;
01748     GetInsideRect(rc);
01749     int top = rc.top;
01750     CSize sz(0,0);
01751     int y = 0;
01752     int spacing = IsSmallIconView() ? ySmallIconSpacing : yLargeIconSpacing;
01753
01754     for (int t = 0; t < iIndex; t++)
01755     {
01756         sz = GetItemSize(iFolder, t, ircAll);
01757         top += sz.cy;
01758         top += spacing;
01759         if (t == iFirstItem - 1) y = top - rc.top;
01760     }
01761     top += spacing;
01762
01763     sz = GetItemSize(iFolder, iIndex, ircIcon);
01764     if (IsSmallIconView())
01765     {
01766         rect.SetRect(rc.left, top, rc.left + sz.cx, top + sz.cy);
01767         rect.left += xLeftMargin + 2;
01768         rect.right += xLeftMargin + 2;
01769         rect.top -= yTopMargin;
01770         rect.bottom -= yTopMargin;
01771
01772         rect.top -= y;
01773         rect.bottom -= y;
01774     }
01775     else
01776     {
01777         rect.SetRect(rc.left + (rc.Width() - sz.cx)/2, top, rc.left + (rc.Width() - sz.cx)/2 + sz.cx, top + sz.cy);
01778         rect.top -= y + 3;
01779         rect.bottom -= y + 2;
01780     }
01781 }
01782
01783 void CGfxOutBarCtrl::GetLabelRect(const int iFolder, const int iIndex, CRect & rect)
01784 {
01785     CRect rc;
01786     GetInsideRect(rc);
01787     int top = rc.top;
01788     CSize sz(0,0);
01789     int y = 0;
01790     int spacing = IsSmallIconView() ? ySmallIconSpacing : yLargeIconSpacing;
01791
01792     for (int t = 0; t < iIndex; t++)
01793     {
01794         sz = GetItemSize(iFolder, t, ircAll);
01795         top += sz.cy;
01796         top += spacing;
01797         if (t == iFirstItem - 1) y = top - rc.top;
01798     }
01799     top += spacing;
01800
01801     sz = GetItemSize(iFolder, iIndex, ircAll);
01802
01803     CSize szLabel = GetItemSize(iFolder, iIndex, ircLabel);
01804
01805     if (IsSmallIconView())
01806     {
01807         rect.SetRect(rc.left, top, rc.left + sz.cx, top + sz.cy);
01808         rect.left += xLeftMargin + 2;
01809         rect.right += xLeftMargin + 2;
01810         rect.top  += yTopMargin - 5;
01811         rect.bottom += yTopMargin - 5;
01812     }
01813     else
01814     {
01815         rect.SetRect(rc.left + (rc.Width() - sz.cx)/2, top, rc.left + (rc.Width() - sz.cx)/2 + sz.cx, top + sz.cy);
01816         rect.top -= y + 3;
01817         rect.bottom -= y + 2;
01818
01819         rect.bottom -=  yLargeIconSpacing;
01820         rect.top    = rect.bottom - szLabel.cy;
01821     }
01822 }
01823
01824
01825 void CGfxOutBarCtrl::StartGroupEdit(const int index)
01826 {
01827     CGfxGroupEdit * pEdit = new CGfxGroupEdit;
01828     pEdit->iIndex = index;
01829     CRect rc;
01830     GetFolderRect(index, rc);
01831     rc.InflateRect(-2,-2);
01832     pEdit->Create(WS_CHILD|WS_VISIBLE|ES_CENTER|ES_MULTILINE,rc,this,1);
01833     pEdit->msgSend = NM_OB_ONGROUPENDEDIT;
01834     pEdit->ModifyStyleEx(0, WS_EX_CLIENTEDGE, SWP_FRAMECHANGED);
01835     ASSERT(index >= 0 && index < GetFolderCount());
01836     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(index);
01837     pEdit->SetWindowText(pbf->cName);
01838     pEdit->SetFocus();
01839 }
01840
01841 void CGfxOutBarCtrl::StartItemEdit(const int index)
01842 {
01843     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
01844     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
01845     ASSERT(index >= 0 && index < pbf->GetItemCount());
01846     CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
01847
01848     CGfxGroupEdit * pEdit = new CGfxGroupEdit;
01849     pEdit->iIndex = index;
01850     CRect rc, crc;
01851     GetLabelRect(iSelFolder, index, rc);
01852     GetInsideRect(crc);
01853
01854     DWORD dwFlag = WS_CHILD|WS_VISIBLE|WS_BORDER;
01855
01856     if (!IsSmallIconView())
01857     {
01858         rc.left = crc.left + 5;
01859         rc.right = crc.right - 5;
01860         rc.bottom += 5;
01861         dwFlag |= ES_CENTER|ES_MULTILINE;
01862     }
01863     else
01864     {
01865         CRect irc;
01866         GetIconRect(iSelFolder, index, irc);
01867         dwFlag |= ES_AUTOHSCROLL;
01868         rc.OffsetRect(irc.Width()+1, -6);
01869         pEdit->bNoDown = true;
01870     }
01871
01872     pEdit->Create(dwFlag, rc, this, 1);
01873     pEdit->msgSend = NM_OB_ONLABELENDEDIT;
01874
01875     pEdit->SetWindowText(pi->cItem);
01876     pEdit->SetFocus();
01877
01878 }
01879
01880 void CGfxOutBarCtrl::OnRButtonDown(UINT nFlags, CPoint point)
01881 {
01882     iHitInternal1 = HitTestEx(point, iHitInternal2);
01883
01884     SetCapture();
01885
01886     CPoint pt = point;
01887     ClientToScreen(&pt);
01888
01889     // Load the popup menu.
01890     VERIFY(m_popupMenu.LoadMenu(IDR_GFXOUTBAR));
01891     CCJMenu* pPopup = (CCJMenu*)m_popupMenu.GetSubMenu(0);
01892     ASSERT(pPopup != NULL);
01893
01894     // Load toolbar resource if any for menu icons.
01895     pPopup->LoadToolbar(IDR_GFXOUTBAR);
01896
01897     if (iHitInternal1 == htItem)
01898     {
01899         if (dwFlags&fRemoveItems || dwFlags&fEditItems)
01900         {
01901             pPopup->AppendMenu(MF_SEPARATOR);
01902             if (dwFlags&fRemoveItems)
01903                 ((CMenu*)pPopup)->AppendMenu(MF_STRING, ID_GFX_REMOVEITEM, m_strRemoveItem);
01904
01905             if (dwFlags&fEditItems)
01906                 ((CMenu*)pPopup)->AppendMenu(MF_STRING, ID_GFX_RENAMEITEM, m_strRenameItem);
01907         }
01908     }
01909     else if (iHitInternal1 == htFolder)
01910     {
01911         if (dwFlags&fRemoveGroups || dwFlags&fEditGroups)
01912         {
01913             ((CMenu*)pPopup)->AppendMenu(MF_SEPARATOR);
01914
01915             if (dwFlags&fRemoveGroups)
01916                 ((CMenu*)pPopup)->AppendMenu(MF_STRING, ID_GFX_REMOVEITEM, m_strRemoveItem);
01917
01918             if (dwFlags&fEditGroups)
01919                 ((CMenu*)pPopup)->AppendMenu(MF_STRING, ID_GFX_RENAMEITEM, m_strRenameItem);
01920         }
01921     }
01922
01923     // Display the popup menu, use the main window as its parent.
01924     pPopup->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON,
01925         pt.x, pt.y, this );
01926
01927     m_popupMenu.DestroyMenu();
01928     ReleaseCapture();
01929
01930     CWnd::OnRButtonDown(nFlags, point);
01931 }
01932
01933 void CGfxOutBarCtrl::OnGfxLargeicon()
01934 {
01935     SetSmallIconView(false);
01936     Invalidate();
01937 }
01938
01939 void CGfxOutBarCtrl::OnUpdateGfxLargeicon(CCmdUI* pCmdUI)
01940 {
01941     pCmdUI->Enable(IsSmallIconView());
01942 }
01943
01944 void CGfxOutBarCtrl::OnGfxSmallicon()
01945 {
01946     SetSmallIconView(true);
01947     Invalidate();
01948 }
01949
01950 void CGfxOutBarCtrl::OnUpdateGfxSmallicon(CCmdUI* pCmdUI)
01951 {
01952     pCmdUI->Enable(!IsSmallIconView());
01953 }
01954
01955 void CGfxOutBarCtrl::OnGfxRemoveitem()
01956 {
01957     if (iHitInternal1 == htFolder)
01958     {
01959         RemoveFolder(iHitInternal2);
01960     }
01961     else if (iHitInternal1 == htItem)
01962     {
01963         RemoveItem(iHitInternal2);
01964     }
01965 }
01966
01967 void CGfxOutBarCtrl::OnUpdateGfxRemoveitem(CCmdUI* /*pCmdUI*/)
01968 {
01969
01970 }
01971
01972 void CGfxOutBarCtrl::OnGfxRenameitem()
01973 {
01974     if (iHitInternal1 == htFolder)
01975     {
01976         StartGroupEdit(iHitInternal2);
01977     }
01978     else if (iHitInternal1 == htItem)
01979     {
01980         StartItemEdit(iHitInternal2);
01981     }
01982 }
01983
01984 void CGfxOutBarCtrl::OnUpdateGfxRenameitem(CCmdUI* /*pCmdUI*/)
01985 {
01986 }
01987
01988 void CGfxOutBarCtrl::RemoveItem(const int index)
01989 {
01990     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
01991     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
01992     ASSERT(index >= 0 && index < pbf->GetItemCount());
01993     if (IsValidItem(index))
01994     {
01995         CBarItem * i = (CBarItem *) pbf->arItems.GetAt(index);
01996         delete i;
01997
01998         pbf->arItems.RemoveAt(index);
01999         CRect rc;
02000         GetInsideRect(rc);
02001         InvalidateRect(rc);
02002     }
02003 }
02004
02005 bool CGfxOutBarCtrl::IsValidItem(const int index) const
02006 {
02007     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02008     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02009     return (index >= 0 && index < pbf->GetItemCount());
02010 }
02011
02012 DWORD CGfxOutBarCtrl::GetItemData(const int index) const
02013 {
02014     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02015     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02016     if (IsValidItem(index))
02017     {
02018         CBarItem * i = (CBarItem *) pbf->arItems.GetAt(index);
02019         return i->dwData;
02020     }
02021     return 0;
02022 }
02023
02024 int CGfxOutBarCtrl::GetItemImage(const int index) const
02025 {
02026     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02027     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02028     if (IsValidItem(index))
02029     {
02030         CBarItem * i = (CBarItem *) pbf->arItems.GetAt(index);
02031         return i->iImageIndex;
02032     }
02033     return 0;
02034 }
02035
02036 void CGfxOutBarCtrl::SetItemData(const int index, const DWORD dwData)
02037 {
02038     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02039     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02040     if (IsValidItem(index))
02041     {
02042         CBarItem * i = (CBarItem *) pbf->arItems.GetAt(index);
02043         i->dwData = dwData;
02044     }
02045 }
02046
02047 void CGfxOutBarCtrl::SetItemImage(const int index, const int iImage)
02048 {
02049     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02050     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02051     if (IsValidItem(index))
02052     {
02053         CBarItem * i = (CBarItem *) pbf->arItems.GetAt(index);
02054         i->iImageIndex = iImage;
02055     }
02056 }
02057
02058 void CGfxOutBarCtrl::DrawDragArrow(CDC * pDC, const int /*iFrom*/, const int iTo)
02059 {
02060     if (iTo == iLastDragItemDraw) return;
02061     CRect rc1;
02062     if (iLastDragItemDraw >= 0)
02063     {
02064         GetDragItemRect(iLastDragItemDraw, rc1);
02065         if (iLastDragItemDrawType == 0) rc1.bottom = rc1.top + 5;
02066         else if (iLastDragItemDrawType == 1) { rc1.top -= 4; rc1.bottom = rc1.top + 9; }
02067         else if (iLastDragItemDrawType == 2) { rc1.top -= 4; rc1.bottom = rc1.top + 5; }
02068         InvalidateRect(rc1, true);
02069         UpdateWindow();
02070     }
02071     iLastDragItemDraw = iTo;
02072
02073     if (iLastDragItemDraw >= 0)
02074     {
02075         iLastDragItemDrawType = GetDragItemRect(iLastDragItemDraw, rc1);
02076
02077         CPen * op = pDC->SelectObject(pBlackPen);
02078
02079         pDC->MoveTo(rc1.left, rc1.top);
02080         pDC->LineTo(rc1.right, rc1.top);
02081
02082         if (iLastDragItemDrawType != 2)
02083         {
02084             pDC->MoveTo(rc1.left, rc1.top+1);
02085             pDC->LineTo(rc1.left + 7, rc1.top+1);
02086             pDC->MoveTo(rc1.left, rc1.top+2);
02087             pDC->LineTo(rc1.left + 5, rc1.top+2);
02088             pDC->MoveTo(rc1.left, rc1.top+3);
02089             pDC->LineTo(rc1.left + 3, rc1.top+3);
02090             pDC->MoveTo(rc1.left, rc1.top+4);
02091             pDC->LineTo(rc1.left + 1, rc1.top+4);
02092
02093             pDC->MoveTo(rc1.right-1, rc1.top+1);
02094             pDC->LineTo(rc1.right - 7, rc1.top+1);
02095             pDC->MoveTo(rc1.right-1, rc1.top+2);
02096             pDC->LineTo(rc1.right - 5, rc1.top+2);
02097             pDC->MoveTo(rc1.right-1, rc1.top+3);
02098             pDC->LineTo(rc1.right - 3, rc1.top+3);
02099         }
02100         if (iLastDragItemDrawType != 0)
02101         {
02102             pDC->MoveTo(rc1.left, rc1.top-1);
02103             pDC->LineTo(rc1.left + 7, rc1.top-1);
02104             pDC->MoveTo(rc1.left, rc1.top-2);
02105             pDC->LineTo(rc1.left + 5, rc1.top-2);
02106             pDC->MoveTo(rc1.left, rc1.top-3);
02107             pDC->LineTo(rc1.left + 3, rc1.top-3);
02108             pDC->MoveTo(rc1.left, rc1.top-4);
02109             pDC->LineTo(rc1.left + 1, rc1.top-4);
02110
02111             pDC->MoveTo(rc1.right-1, rc1.top-1);
02112             pDC->LineTo(rc1.right - 7, rc1.top-1);
02113             pDC->MoveTo(rc1.right-1, rc1.top-2);
02114             pDC->LineTo(rc1.right - 5, rc1.top-2);
02115             pDC->MoveTo(rc1.right-1, rc1.top-3);
02116             pDC->LineTo(rc1.right - 3, rc1.top-3);
02117             pDC->MoveTo(rc1.right-1, rc1.top-4);
02118             pDC->LineTo(rc1.right - 1, rc1.top-4);
02119         }
02120
02121         pDC->SelectObject(op);
02122     }
02123 }
02124
02125 int CGfxOutBarCtrl::GetDragItemRect(const int index, CRect & rect)
02126 {
02127     CRect rc, crc;
02128     GetInsideRect(crc);
02129     crc.InflateRect(-2, 0);
02130
02131     GetItemRect(iSelFolder, index < GetItemCount() ? index : index - 1, rc);
02132     int line = 0;
02133     if (index < GetItemCount())
02134     {
02135         line = rc.top - 4;
02136     }
02137     else
02138     {
02139         line = rc.bottom + 6;
02140     }
02141     int tpe;
02142     if (index == 0)
02143     {
02144         rect.SetRect(crc.left, line+2, crc.right, line + 7);
02145         tpe = 0;
02146     }
02147     else if (index < GetItemCount())
02148     {
02149         rect.SetRect(crc.left, line - 9, crc.right, line);
02150         tpe = 1;
02151         if (IsSmallIconView())
02152         {
02153             rect.top += 8;
02154             rect.bottom += 8;
02155         }
02156     }
02157     else
02158     {
02159         rect.SetRect(crc.left, line, crc.right, line + 5);
02160         tpe = 2;
02161     }
02162     return tpe;
02163 }
02164
02165
02166 void CGfxOutBarCtrl::AnimateFolderScroll(const int iFrom, const int iTo)
02167 {
02168     ASSERT(iFrom >= 0 && iFrom < GetFolderCount());
02169     ASSERT(iTo >= 0 && iTo < GetFolderCount());
02170
02171     CRect rc, rc1, frc, frc1;
02172     GetInsideRect(rc);
02173     rc1.SetRect(0,0,rc.Width(),rc.Height());
02174     GetFolderRect(iTo, frc);
02175     frc1 = frc;
02176
02177     CClientDC dc(this);
02178     CDC memDC;
02179     memDC.CreateCompatibleDC(&dc);
02180     CBitmap bmpFrom, bmpTo;
02181     bmpFrom.CreateCompatibleBitmap(&dc, rc1.Width(), rc1.Height() + frc.Height() * 2);
02182     bmpTo.CreateCompatibleBitmap(&dc, rc1.Width(), rc1.Height() + frc.Height() * 2);
02183     CDC * pDC = &memDC;
02184
02185     CWnd * pWnd1 = GetFolderChild(iFrom);
02186     CWnd * pWnd2 = GetFolderChild(iTo);
02187
02188     CBitmap * obmp = pDC->SelectObject(&bmpFrom);
02189     if (iTo > iFrom)
02190     {
02191         rc1.bottom += frc.Height() * 2;
02192         pDC->FillSolidRect(rc1, crBackGroundColor);
02193         if (pWnd1)
02194         {
02195             BOOL bPrev = pWnd1->ShowWindow(SW_SHOW);
02196             pWnd1->SendMessage(WM_ERASEBKGND, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02197             pWnd1->SendMessage(WM_PAINT, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02198             if (!bPrev) pWnd1->ShowWindow(SW_HIDE);
02199         }
02200         else PaintItems(pDC, iFrom, rc1);
02201
02202         pDC->SelectObject(&bmpTo);
02203         frc.SetRect(0,0,frc.Width(),frc.Height());
02204         rc1.SetRect(0,frc.Height(),rc.Width(), rc.Height()+frc.Height() * 2);
02205         pDC->FillSolidRect(rc1, crBackGroundColor);
02206
02207         if (pWnd2)
02208         {
02209             CPoint ovpt = pDC->SetViewportOrg(0, frc.Height());
02210             BOOL bPrev = pWnd2->ShowWindow(SW_SHOW);
02211             pWnd2->SendMessage(WM_ERASEBKGND, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02212             pWnd2->SendMessage(WM_PAINT, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02213             if (!bPrev) pWnd2->ShowWindow(SW_HIDE);
02214             pDC->SetViewportOrg(ovpt);
02215         }
02216         else PaintItems(pDC, iTo, rc1);
02217         DrawFolder(pDC, iTo, frc, false);
02218     }
02219     else
02220     {
02221         frc.SetRect(0,0,frc.Width(),frc.Height());
02222         rc1.top += frc.Height();
02223         rc1.bottom += frc.Height() * 2;
02224         pDC->FillSolidRect(rc1, crBackGroundColor);
02225         if (pWnd1)
02226         {
02227             CPoint ovpt = pDC->SetViewportOrg(0, frc.Height());
02228             BOOL bPrev = pWnd1->ShowWindow(SW_SHOW);
02229             pWnd1->SendMessage(WM_ERASEBKGND, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02230             pWnd1->SendMessage(WM_PAINT, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02231             if (!bPrev) pWnd1->ShowWindow(SW_HIDE);
02232             pDC->SetViewportOrg(ovpt);
02233         }
02234         else PaintItems(pDC, iFrom, rc1);
02235
02236         DrawFolder(pDC, iFrom, frc, false);
02237
02238         pDC->SelectObject(&bmpTo);
02239         rc1.SetRect(0,0,rc.Width(), rc.Height() + frc.Height() * 2);
02240         pDC->FillSolidRect(rc1, crBackGroundColor);
02241
02242         if (pWnd2)
02243         {
02244             BOOL bPrev = pWnd2->ShowWindow(SW_SHOW);
02245             pWnd2->SendMessage(WM_ERASEBKGND, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02246             pWnd2->SendMessage(WM_PAINT, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02247             if (!bPrev) pWnd2->ShowWindow(SW_HIDE);
02248         }
02249         else PaintItems(pDC, iTo, rc1);
02250     }
02251
02252     if (iTo > iFrom)
02253     {
02254         CRect rcFrom, rcTo;
02255         GetFolderRect(iFrom, rcFrom);
02256         GetFolderRect(iTo, rcTo);
02257         int fh = rcFrom.Height();
02258         for (int y = rcTo.top - fh; y > rcFrom.bottom; y -= fh)
02259         {
02260             pDC->SelectObject(&bmpFrom);
02261             dc.BitBlt(rc.left, rcFrom.bottom + 1, rc.Width(), y - rcFrom.bottom - 1, pDC, 0,fh, SRCCOPY);
02262             pDC->SelectObject(&bmpTo);
02263             dc.BitBlt(rc.left, y, rc.Width(), rc.bottom - y + fh, pDC, 0,0, SRCCOPY);
02264             Sleep(lAnimationTickCount);
02265         }
02266     }
02267     else
02268     {
02269         CRect rcFrom, rcTo;
02270         GetFolderRect(iFrom, rcFrom);
02271         int fh = rcFrom.Height();
02272         rcTo.SetRect(rc.left, rc.bottom, rc.right, rc.bottom - fh);
02273         for (int y = rcFrom.top + 1; y < rcTo.top - fh; y += fh)
02274         {
02275             pDC->SelectObject(&bmpTo);
02276             dc.BitBlt(rc.left, rcFrom.top, rc.Width(), y - rcFrom.top - 1, pDC, 0, fh*2, SRCCOPY);
02277             pDC->SelectObject(&bmpFrom);
02278             dc.BitBlt(rc.left, y, rc.Width(), rc.bottom - y, pDC, 0,0, SRCCOPY);
02279             Sleep(lAnimationTickCount);
02280         }
02281     }
02282
02283     pDC->SelectObject(obmp);
02284     // fix potential resource leak - KStowell - 10-21-99
02285     memDC.DeleteDC();
02286     bmpFrom.DeleteObject();
02287     bmpTo.DeleteObject();
02288 }
02289
02290
02291
02292
02293 CString CGfxOutBarCtrl::GetItemText(const int index)
02294 {
02295     CString item;
02296
02297     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02298     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02299     if (IsValidItem(index))
02300     {
02301         CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
02302         if (pi->cItem) item = pi->cItem;
02303     }
02304     return item;
02305 }
02306
02307 int CGfxOutBarCtrl::AddFolderBar( LPCTSTR pFolder, CWnd* pSon, const DWORD exData )
02308 {
02309     CBarFolder* pbf = new CBarFolder( pFolder, exData );
02310
02311     ASSERT( pbf );
02312
02313     pbf->pChild = pSon;
02314
02315     arFolder.Add((void*) pbf);
02316
02317     return arFolder.GetSize() - 1;
02318 }
02319
02320 CWnd * CGfxOutBarCtrl::GetFolderChild(int iFolder)
02321 {
02322     if (GetFolderCount())
02323     {
02324         if (iFolder < 0) iFolder = iSelFolder;
02325
02326         CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
02327         return pbf->pChild;
02328     }
02329     return NULL;
02330 }
02331
02332 DWORD CGfxOutBarCtrl::GetFolderData(int iFolder)
02333 {
02334     if (iFolder < 0) iFolder = iSelFolder;
02335     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
02336     return pbf->dwData;
02337 }
02338
02339 void CGfxOutBarCtrl::SetAnimSelHighlight(const int iTime)
02340 {
02341     if (iTime <= 0) KillTimer(3);
02342     else SetTimer(3, iTime, NULL);
02343     iSelAnimTiming = iTime;
02344 }
02345
02346 void CGfxOutBarCtrl::OnSysColorChange()
02347 {
02348     // TODO: Add your message handler code here
02349     crBackGroundColor   = ::GetSysColor(COLOR_3DSHADOW);//RGB(0,128,128);//
02350     crBackGroundColor1  = ::GetSysColor(COLOR_3DSHADOW);
02351     crTextColor         = ::GetSysColor(COLOR_WINDOW);
02352     cr3dFace            = ::GetSysColor(COLOR_3DFACE);
02353     crLightBorder       = ::GetSysColor(COLOR_3DLIGHT);
02354     crHilightBorder     = ::GetSysColor(COLOR_3DHILIGHT);
02355     crShadowBorder      = ::GetSysColor(COLOR_3DSHADOW);
02356     crDkShadowBorder    = ::GetSysColor(COLOR_3DDKSHADOW);
02357
02358     CWnd::OnSysColorChange();
02359 }
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/GfxSplitterWnd.cpp Source File

WinCvs/CJLib/CJLibrary/GfxSplitterWnd.cpp

Go to the documentation of this file.
00001 // Copyright (c) Iuri Apollonio 1998
00002 // Use & modify as you want & need, and leave those 3 lines.
00003 // http://www.codeguru.com
00004 //
00005 // GfxSplitterWnd.cpp: implementation of the CGfxSplitterWnd class.
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:49 $
00011  * $Revision: 1.1.1.2 $
00012  * $Archive: /CodeJock/CJLibrary/GfxSplitterWnd.cpp $
00013  *
00014  * $History: GfxSplitterWnd.cpp $
00015  *
00016  * *****************  Version 5  *****************
00017  * User: Kirk Stowell Date: 10/31/99   Time: 11:14p
00018  * Updated in $/CodeJock/CJLibrary
00019  * Modified tracker to use halftone brush so that it is more consistent
00020  * with other controls.
00021  *
00022  * *****************  Version 4  *****************
00023  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00024  * Updated in $/CodeJock/CJLibrary
00025  * Fixed potential resource and memory leak problems.
00026  *
00027  * *****************  Version 3  *****************
00028  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00029  * Updated in $/CodeJock/CJLibrary
00030  * Added source control history to file header.
00031  *
00032  ***************************************************************************/
00034
00035 #include "stdafx.h"
00036 #include "GfxSplitterWnd.h"
00037
00038 #ifdef _DEBUG
00039 #undef THIS_FILE
00040 static char THIS_FILE[]=__FILE__;
00041 #define new DEBUG_NEW
00042 #endif
00043
00044 #define CX_BORDER   1
00045 #define CY_BORDER   1
00046
00047 #include <afxpriv.h>
00048
00049 static BOOL bNotWin4;
00050
00052 // Construction/Destruction
00054
00055 BEGIN_MESSAGE_MAP(CGfxSplitterWnd, CSplitterWnd)
00056     //{{AFX_MSG_MAP(CGfxSplitterWnd)
00057     ON_WM_ERASEBKGND()
00058     ON_WM_PAINT()
00059     //}}AFX_MSG_MAP
00060 END_MESSAGE_MAP()
00061
00062 CGfxSplitterWnd::CGfxSplitterWnd()
00063 {
00064     m_cxBorder = 0;
00065     m_cyBorder = 0;
00066     m_cxSplitter = m_cySplitter = 2 + 2;
00067     m_cxSplitterGap = m_cySplitterGap = 2 + 2;
00068
00069
00070     DWORD dwVersion = ::GetVersion();
00071     BOOL bWin4 = (BYTE)dwVersion >= 4;
00072     bNotWin4 = 1 - bWin4;   // for convenience
00073
00074     m_upBorder = 5;
00075     bWhiteLine = false;
00076 }
00077
00078 CGfxSplitterWnd::~CGfxSplitterWnd()
00079 {
00080
00081 }
00082
00083 void CGfxSplitterWnd::OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rectArg)
00084 {
00085     if (pDC == NULL)
00086     {
00087         RedrawWindow(rectArg, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
00088         return;
00089     }
00090     ASSERT_VALID(pDC);
00091     CRect rect = rectArg;
00092     switch (nType)
00093     {
00094     case splitBorder:
00095         return;
00096     case splitBox:
00097         pDC->Draw3dRect(rect, GetSysColor(COLOR_3DFACE), GetSysColor(COLOR_WINDOWFRAME));
00098         rect.InflateRect(-CX_BORDER, -CY_BORDER);
00099         pDC->Draw3dRect(rect, GetSysColor(COLOR_BTNHIGHLIGHT), GetSysColor(COLOR_BTNSHADOW));
00100         rect.InflateRect(-CX_BORDER, -CY_BORDER);
00101         break;
00102     }
00103
00104     COLORREF clr = GetSysColor(COLOR_3DFACE);
00105     pDC->FillSolidRect(rect, clr);
00106 }
00107
00108 void CGfxSplitterWnd::OnInvertTracker(const CRect & rect)
00109 {
00110     ASSERT_VALID(this);
00111     ASSERT(!rect.IsRectEmpty());
00112     ASSERT((GetStyle() & WS_CLIPCHILDREN) == 0);
00113
00114     CDC* pDC = GetDC();
00115     CBrush* pBrush = CDC::GetHalftoneBrush();
00116     CBrush* pOldBrush = NULL;
00117
00118     if (pBrush != NULL) {
00119         pOldBrush = pDC->SelectObject(pBrush);
00120     }
00121
00122     pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATINVERT);
00123
00124     if (pOldBrush != NULL) {
00125         pDC->SelectObject(pOldBrush);
00126     }
00127     ReleaseDC(pDC);
00128 }
00129
00130 // repositions client area of specified window
00131 // assumes everything has WS_BORDER or is inset like it does
00132 //  (includes scroll bars)
00133 static void AFXAPI DeferClientPos(AFX_SIZEPARENTPARAMS* lpLayout,
00134     CWnd* pWnd, int x, int y, int cx, int cy, BOOL bScrollBar)
00135 {
00136     ASSERT(pWnd != NULL);
00137     ASSERT(pWnd->m_hWnd != NULL);
00138
00139     if (bScrollBar)
00140     {
00141         // if there is enough room, draw scroll bar without border
00142         // if there is not enough room, set the WS_BORDER bit so that
00143         //   we will at least get a proper border drawn
00144         BOOL bNeedBorder = (cx <= CX_BORDER || cy <= CY_BORDER);
00145         pWnd->ModifyStyle(bNeedBorder ? 0 : WS_BORDER,
00146             bNeedBorder ? WS_BORDER : 0);
00147     }
00148     CRect rect(x, y, x+cx, y+cy);
00149
00150     // adjust for border size (even if zero client size)
00151
00152     // adjust for 3d border (splitter windows have implied border)
00153     if ((pWnd->GetExStyle() & WS_EX_CLIENTEDGE) ||
00154           pWnd->IsKindOf(RUNTIME_CLASS(CSplitterWnd)))
00155         rect.InflateRect(CX_BORDER*2, CY_BORDER*2);
00156
00157     // first check if the new rectangle is the same as the current
00158     CRect rectOld;
00159     pWnd->GetWindowRect(rectOld);
00160     pWnd->GetParent()->ScreenToClient(&rectOld);
00161     if (rect != rectOld)
00162         AfxRepositionWindow(lpLayout, pWnd->m_hWnd, rect);
00163 }
00164
00165
00166 static void AFXAPI LayoutRowCol(CSplitterWnd::CRowColInfo* pInfoArray,
00167     int nMax, int nSize, int nSizeSplitter)
00168 {
00169     ASSERT(pInfoArray != NULL);
00170     ASSERT(nMax > 0);
00171     ASSERT(nSizeSplitter > 0);
00172
00173     CSplitterWnd::CRowColInfo* pInfo;
00174     int i;
00175
00176     if (nSize < 0)
00177         nSize = 0;  // if really too small, layout as zero size
00178
00179     // start with ideal sizes
00180     for (i = 0, pInfo = pInfoArray; i < nMax-1; i++, pInfo++)
00181     {
00182         if (pInfo->nIdealSize < pInfo->nMinSize)
00183             pInfo->nIdealSize = 0;      // too small to see
00184         pInfo->nCurSize = pInfo->nIdealSize;
00185     }
00186     pInfo->nCurSize = INT_MAX;  // last row/column takes the rest
00187
00188     for (i = 0, pInfo = pInfoArray; i < nMax; i++, pInfo++)
00189     {
00190         ASSERT(nSize >= 0);
00191         if (nSize == 0)
00192         {
00193             // no more room (set pane to be invisible)
00194             pInfo->nCurSize = 0;
00195             continue;       // don't worry about splitters
00196         }
00197         else if (nSize < pInfo->nMinSize && i != 0)
00198         {
00199             // additional panes below the recommended minimum size
00200             //   aren't shown and the size goes to the previous pane
00201             pInfo->nCurSize = 0;
00202
00203             // previous pane already has room for splitter + border
00204             //   add remaining size and remove the extra border
00205             ASSERT(CX_BORDER*2 == CY_BORDER*2);
00206             (pInfo-1)->nCurSize += nSize + CX_BORDER*2;
00207             nSize = 0;
00208         }
00209         else
00210         {
00211             // otherwise we can add the second pane
00212             ASSERT(nSize > 0);
00213             if (pInfo->nCurSize == 0)
00214             {
00215                 // too small to see
00216                 if (i != 0)
00217                     pInfo->nCurSize = 0;
00218             }
00219             else if (nSize < pInfo->nCurSize)
00220             {
00221                 // this row/col won't fit completely - make as small as possible
00222                 pInfo->nCurSize = nSize;
00223                 nSize = 0;
00224             }
00225             else
00226             {
00227                 // can fit everything
00228                 nSize -= pInfo->nCurSize;
00229             }
00230         }
00231
00232         // see if we should add a splitter
00233         ASSERT(nSize >= 0);
00234         if (i != nMax - 1)
00235         {
00236             // should have a splitter
00237             if (nSize > nSizeSplitter)
00238             {
00239                 nSize -= nSizeSplitter; // leave room for splitter + border
00240                 ASSERT(nSize > 0);
00241             }
00242             else
00243             {
00244                 // not enough room - add left over less splitter size
00245                 ASSERT(CX_BORDER*2 == CY_BORDER*2);
00246                 pInfo->nCurSize += nSize;
00247                 if (pInfo->nCurSize > (nSizeSplitter - CX_BORDER*2))
00248                     pInfo->nCurSize -= (nSizeSplitter - CY_BORDER*2);
00249                 nSize = 0;
00250             }
00251         }
00252     }
00253     ASSERT(nSize == 0); // all space should be allocated
00254 }
00255
00256 void CGfxSplitterWnd::RecalcLayout()
00257 {
00258     ASSERT_VALID(this);
00259     ASSERT(m_nRows > 0 && m_nCols > 0); // must have at least one pane
00260
00261     CRect rectClient;
00262     GetClientRect(rectClient);
00263     rectClient.InflateRect(-m_cxBorder, -m_cyBorder);
00264     rectClient.top += m_upBorder;
00265
00266     CRect rectInside;
00267     GetInsideRect(rectInside);
00268
00269     // layout columns (restrict to possible sizes)
00270     LayoutRowCol(m_pColInfo, m_nCols, rectInside.Width(), m_cxSplitterGap);
00271     LayoutRowCol(m_pRowInfo, m_nRows, rectInside.Height(), m_cySplitterGap);
00272
00273     // adjust the panes (and optionally scroll bars)
00274
00275     // give the hint for the maximum number of HWNDs
00276     AFX_SIZEPARENTPARAMS layout;
00277     layout.hDWP = ::BeginDeferWindowPos((m_nCols + 1) * (m_nRows + 1) + 1);
00278
00279     // size of scrollbars
00280     int cx = (rectClient.right - rectInside.right - bNotWin4);// - afxData.bNotWin4;
00281     int cy = (rectClient.bottom - rectInside.bottom - bNotWin4);// - afxData.bNotWin4;
00282
00283     // reposition size box
00284     if (m_bHasHScroll && m_bHasVScroll)
00285     {
00286         CWnd* pScrollBar = GetDlgItem(AFX_IDW_SIZE_BOX);
00287         ASSERT(pScrollBar != NULL);
00288
00289         // fix style if necessary
00290         BOOL bSizingParent = (GetSizingParent() != NULL);
00291         // modifyStyle returns TRUE if style changes
00292         if (pScrollBar->ModifyStyle(SBS_SIZEGRIP|SBS_SIZEBOX,
00293                 bSizingParent ? SBS_SIZEGRIP : SBS_SIZEBOX))
00294             pScrollBar->Invalidate();
00295         pScrollBar->EnableWindow(bSizingParent);
00296
00297         // reposition the size box
00298         DeferClientPos(&layout, pScrollBar,
00299             rectInside.right + bNotWin4,
00300             rectInside.bottom + bNotWin4, cx, cy, TRUE);
00301     }
00302
00303     // reposition scroll bars
00304     if (m_bHasHScroll)
00305     {
00306         int cxSplitterBox = m_cxSplitter + bNotWin4;// split box bigger
00307         int x = rectClient.left;
00308         int y = rectInside.bottom + bNotWin4;
00309         for (int col = 0; col < m_nCols; col++)
00310         {
00311             CWnd* pScrollBar = GetDlgItem(AFX_IDW_HSCROLL_FIRST + col);
00312             ASSERT(pScrollBar != NULL);
00313             int cx = m_pColInfo[col].nCurSize;
00314             if (col == 0 && m_nCols < m_nMaxCols)
00315                 x += cxSplitterBox, cx -= cxSplitterBox;
00316             DeferClientPos(&layout, pScrollBar, x, y, cx, cy, TRUE);
00317             x += cx + m_cxSplitterGap;
00318         }
00319     }
00320
00321     if (m_bHasVScroll)
00322     {
00323         int cySplitterBox = m_cySplitter + bNotWin4;// split box bigger
00324         int x = rectInside.right + bNotWin4;
00325         int y = rectClient.top;
00326         for (int row = 0; row < m_nRows; row++)
00327         {
00328             CWnd* pScrollBar = GetDlgItem(AFX_IDW_VSCROLL_FIRST + row);
00329             ASSERT(pScrollBar != NULL);
00330             int cy = m_pRowInfo[row].nCurSize;
00331             if (row == 0 && m_nRows < m_nMaxRows)
00332                 y += cySplitterBox, cy -= cySplitterBox;
00333             DeferClientPos(&layout, pScrollBar, x, y, cx, cy, TRUE);
00334             y += cy + m_cySplitterGap;
00335         }
00336     }
00337
00338     //BLOCK: Reposition all the panes
00339     {
00340         int x = rectClient.left;
00341         for (int col = 0; col < m_nCols; col++)
00342         {
00343             int cx = m_pColInfo[col].nCurSize;
00344             int y = rectClient.top;
00345             for (int row = 0; row < m_nRows; row++)
00346             {
00347                 int cy = m_pRowInfo[row].nCurSize;
00348                 CWnd* pWnd = GetPane(row, col);
00349                 DeferClientPos(&layout, pWnd, x, y, cx, cy, FALSE);
00350                 y += cy + m_cySplitterGap;
00351             }
00352             x += cx + m_cxSplitterGap;
00353         }
00354     }
00355
00356     // move and resize all the windows at once!
00357     if (layout.hDWP == NULL || !::EndDeferWindowPos(layout.hDWP))
00358         TRACE0("Warning: DeferWindowPos failed - low system resources.\n");
00359
00360     // invalidate all the splitter bars (with NULL pDC)
00361     DrawAllSplitBars(NULL, rectInside.right, rectInside.bottom);
00362 }
00363
00364 void CGfxSplitterWnd::GetInsideRect(CRect& rect) const
00365 {
00366     CSplitterWnd::GetInsideRect(rect);
00367     rect.top += m_upBorder;
00368 /*  ASSERT_VALID(this);
00369
00370     GetClientRect(rect);
00371     ASSERT(rect.left == 0 && rect.top == 0);
00372
00373     // subtract space for 3d borders
00374     rect.InflateRect(-m_cxBorder, -m_cyBorder);
00375     rect.top += m_upBorder;
00376
00377     // subtract scrollbar clearance
00378     if (m_bHasVScroll)
00379         rect.right -= GetSystemMetrics(SM_CXVSCROLL);
00380     if (m_bHasHScroll)
00381         rect.bottom -= GetSystemMetrics(SM_CYHSCROLL);*/
00382 }
00383
00384 BOOL CGfxSplitterWnd::OnEraseBkgnd(CDC* pDC)
00385 {
00386 //  return CSplitterWnd::OnEraseBkgnd(pDC);
00387
00388     CRect rectClient;
00389     GetClientRect(rectClient);
00390     rectClient.InflateRect(-m_cxBorder, -m_cyBorder);
00391     rectClient.bottom = rectClient.top + m_upBorder;
00392     pDC->FillSolidRect(rectClient, GetSysColor(COLOR_3DFACE));
00393     return true;
00394 }
00395
00396 void CGfxSplitterWnd::OnPaint()
00397 {
00398     CSplitterWnd::OnPaint();
00399     if (bWhiteLine)
00400     {
00401         CClientDC dc(this);
00402         CRect rectClient;
00403         GetClientRect(rectClient);
00404         CPen pn(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
00405         CPen * op = dc.SelectObject(&pn);
00406         dc.MoveTo(rectClient.left, rectClient.top);
00407         dc.LineTo(rectClient.right, rectClient.top);
00408         CPen pn1(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
00409         dc.SelectObject(&pn1);
00410         dc.MoveTo(rectClient.left, rectClient.top+1);
00411         dc.LineTo(rectClient.right, rectClient.top+1);
00412         dc.SelectObject(op);
00413
00414         // fix potential resource leak - KStowell - 10-21-99
00415         pn.DeleteObject();
00416         pn1.DeleteObject();
00417     }
00418 }
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TbEdit.cpp File Reference

WinCvs/TbEdit.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "TbEdit.h"

Include dependency graph for TbEdit.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TbEdit.h File Reference

WinCvs/TbEdit.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CTbEdit

Defines

#define | AFX_TBEDIT_H__AEA5EC19_1292_4A30_93EA_E209A6BAE000__INCLUDED_

Define Documentation

#define AFX_TBEDIT_H__AEA5EC19_1292_4A30_93EA_E209A6BAE000__INCLUDED_

Definition at line 2 of file TbEdit.h.

Generated on Sun Oct 21 12:45:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TipDlg.cpp File Reference

WinCvs/TipDlg.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <winreg.h>
#include <sys\stat.h>
#include <sys\types.h>
#include "wincvs.h"
#include "CPStr.h"
#include "TextBinary.h"

Include dependency graph for TipDlg.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | MAX_BUFLEN 1000

Variables

const TCHAR | szSection [] = _T("Tip")
const TCHAR | szIntFilePos [] = _T("FilePos")
const TCHAR | szTimeStamp [] = _T("TimeStamp")
const TCHAR | szIntStartup [] = _T("StartUp")

Define Documentation

#define MAX_BUFLEN 1000

Definition at line 22 of file TipDlg.cpp.

Variable Documentation

const TCHAR szIntFilePos[] = _T("FilePos") [static]

Definition at line 25 of file TipDlg.cpp.

const TCHAR szIntStartup[] = _T("StartUp") [static]

Definition at line 27 of file TipDlg.cpp.

const TCHAR szSection[] = _T("Tip") [static]

Definition at line 24 of file TipDlg.cpp.

const TCHAR szTimeStamp[] = _T("TimeStamp") [static]

Definition at line 26 of file TipDlg.cpp.

Generated on Sun Oct 21 12:45:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TipDlg.h File Reference

WinCvs/TipDlg.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CTipDlg

Defines

#define | TIPDLG_H_INCLUDED_

Define Documentation

#define TIPDLG_H_INCLUDED_

Definition at line 2 of file TipDlg.h.

Generated on Sun Oct 21 12:45:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ToolbarCombo.cpp File Reference

WinCvs/ToolbarCombo.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "ToolbarCombo.h"

Include dependency graph for ToolbarCombo.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ToolbarCombo.h File Reference

WinCvs/ToolbarCombo.h File Reference

#include "BrowseViewModel.h"
#include "tbedit.h"

Include dependency graph for ToolbarCombo.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CToolbarCombo

Defines

#define | AFX_TOOLBARCOMBO_H__3AE857F3_B4BD_11D4_8200_005004D6EF6C__INCLUDED_

Define Documentation

#define AFX_TOOLBARCOMBO_H__3AE857F3_B4BD_11D4_8200_005004D6EF6C__INCLUDED_

Definition at line 2 of file ToolbarCombo.h.

Generated on Sun Oct 21 12:45:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


version_fu.h File Reference

WinCvs/version_fu.h File Reference

Go to the source code of this file.

Defines

#define | PP_PASTE(x) #x
#define | PP_STRINGIZE(x) PP_PASTE(x)
#define | WINCVS_FILEVERSION WINCVS_FILE_MAJOR,WINCVS_FILE_MINOR,WINCVS_FILE_PATCHLEVEL,WINCVS_BUILD
#define | CVSNTDOS_FILEVERSION CVSNTDOS_FILE_MAJOR,CVSNTDOS_FILE_MINOR,CVSNTDOS_FILE_PATCHLEVEL,CVSNTDOS_BUILD
#define | WINCVS_PRODUCTVERSION WINCVS_PRODUCT_MAJOR,WINCVS_PRODUCT_MINOR,WINCVS_PRODUCT_PATCHLEVEL,WINCVS_BUILD
#define | WCVS_UNICODE_BUILD_STRING_PREFIX
#define | WCVS_PATCHED_FLAG 0
#define | WCVS_SPECIAL_BUILD_STRING_PREFIX
#define | WCVS_SPECIAL_BUILD_STRING
#define | WCVS_SPECIAL_BUILD_FLAG 0
#define | WCVS_PRIVATE_BUILD_STRING_PREFIX "Local "
#define | WCVS_PRIVATE_BUILD_STRING WCVS_PRIVATE_BUILD_STRING_PREFIX "build"
#define | WCVS_PRIVATE_BUILD_FLAG VS_FF_PRIVATEBUILD
#define | WCVS_PRERELEASE_BUILD_STRING_PREFIX "Prerelease "
#define | WCVS_PRERELEASE_FLAG VS_FF_PRERELEASE
#define | WCVS_DEBUG_BUILD_STRING_PREFIX
#define | WCVS_DEBUG_FLAG 0
#define | WINCVS_FILEVERSION_STRING PP_STRINGIZE(WINCVS_FILE_MAJOR.WINCVS_FILE_MINOR.WINCVS_FILE_PATCHLEVEL.WINCVS_BUILD) " " WCVS_PRERELEASE_BUILD_STRING_PREFIX "(" WCVS_PRIVATE_BUILD_STRING_PREFIX WCVS_SPECIAL_BUILD_STRING_PREFIX WCVS_UNICODE_BUILD_STRING_PREFIX WCVS_DEBUG_BUILD_STRING_PREFIX PP_STRINGIZE(Build WINCVS_BUILD) ")"
#define | CVSNTDOS_FILEVERSION_STRING PP_STRINGIZE(CVSNTDOS_FILE_MAJOR.CVSNTDOS_FILE_MINOR.CVSNTDOS_FILE_PATCHLEVEL.CVSNTDOS_BUILD) " " WCVS_PRERELEASE_BUILD_STRING_PREFIX "(" WCVS_PRIVATE_BUILD_STRING_PREFIX WCVS_SPECIAL_BUILD_STRING_PREFIX WCVS_UNICODE_BUILD_STRING_PREFIX WCVS_DEBUG_BUILD_STRING_PREFIX PP_STRINGIZE(Build CVSNTDOS_BUILD) ")"
#define | WINCVS_PRODUCTVERSION_STRING PP_STRINGIZE(WINCVS_FILE_MAJOR.WINCVS_FILE_MINOR.WINCVS_FILE_PATCHLEVEL.WINCVS_BUILD) " " WCVS_PRERELEASE_BUILD_STRING_PREFIX "(" WCVS_PRIVATE_BUILD_STRING_PREFIX WCVS_SPECIAL_BUILD_STRING_PREFIX WCVS_UNICODE_BUILD_STRING_PREFIX WCVS_DEBUG_BUILD_STRING_PREFIX PP_STRINGIZE(Build WINCVS_BUILD) ")"

Define Documentation

#define CVSNTDOS_FILEVERSION CVSNTDOS_FILE_MAJOR,CVSNTDOS_FILE_MINOR,CVSNTDOS_FILE_PATCHLEVEL,CVSNTDOS_BUILD

Definition at line 223 of file version_fu.h.

#define CVSNTDOS_FILEVERSION_STRING PP_STRINGIZE(CVSNTDOS_FILE_MAJOR.CVSNTDOS_FILE_MINOR.CVSNTDOS_FILE_PATCHLEVEL.CVSNTDOS_BUILD) " " WCVS_PRERELEASE_BUILD_STRING_PREFIX "(" WCVS_PRIVATE_BUILD_STRING_PREFIX WCVS_SPECIAL_BUILD_STRING_PREFIX WCVS_UNICODE_BUILD_STRING_PREFIX WCVS_DEBUG_BUILD_STRING_PREFIX PP_STRINGIZE(Build CVSNTDOS_BUILD) ")"

Definition at line 301 of file version_fu.h.

#define PP_PASTE ( x ) #x

Definition at line 219 of file version_fu.h.

#define PP_STRINGIZE ( x ) PP_PASTE(x)

Definition at line 220 of file version_fu.h.

#define WCVS_DEBUG_BUILD_STRING_PREFIX

Definition at line 293 of file version_fu.h.

#define WCVS_DEBUG_FLAG 0

Definition at line 294 of file version_fu.h.

#define WCVS_PATCHED_FLAG 0

Definition at line 235 of file version_fu.h.

#define WCVS_PRERELEASE_BUILD_STRING_PREFIX "Prerelease "

Definition at line 284 of file version_fu.h.

#define WCVS_PRERELEASE_FLAG VS_FF_PRERELEASE

Definition at line 286 of file version_fu.h.

#define WCVS_PRIVATE_BUILD_FLAG VS_FF_PRIVATEBUILD

Definition at line 259 of file version_fu.h.

#define WCVS_PRIVATE_BUILD_STRING WCVS_PRIVATE_BUILD_STRING_PREFIX "build"

Definition at line 258 of file version_fu.h.

#define WCVS_PRIVATE_BUILD_STRING_PREFIX "Local "

Definition at line 256 of file version_fu.h.

#define WCVS_SPECIAL_BUILD_FLAG 0

Definition at line 245 of file version_fu.h.

#define WCVS_SPECIAL_BUILD_STRING

Definition at line 244 of file version_fu.h.

#define WCVS_SPECIAL_BUILD_STRING_PREFIX

Definition at line 243 of file version_fu.h.

#define WCVS_UNICODE_BUILD_STRING_PREFIX

Definition at line 229 of file version_fu.h.

#define WINCVS_FILEVERSION WINCVS_FILE_MAJOR,WINCVS_FILE_MINOR,WINCVS_FILE_PATCHLEVEL,WINCVS_BUILD

Definition at line 222 of file version_fu.h.

#define WINCVS_FILEVERSION_STRING PP_STRINGIZE(WINCVS_FILE_MAJOR.WINCVS_FILE_MINOR.WINCVS_FILE_PATCHLEVEL.WINCVS_BUILD) " " WCVS_PRERELEASE_BUILD_STRING_PREFIX "(" WCVS_PRIVATE_BUILD_STRING_PREFIX WCVS_SPECIAL_BUILD_STRING_PREFIX WCVS_UNICODE_BUILD_STRING_PREFIX WCVS_DEBUG_BUILD_STRING_PREFIX PP_STRINGIZE(Build WINCVS_BUILD) ")"

Definition at line 300 of file version_fu.h.

#define WINCVS_PRODUCTVERSION WINCVS_PRODUCT_MAJOR,WINCVS_PRODUCT_MINOR,WINCVS_PRODUCT_PATCHLEVEL,WINCVS_BUILD

Definition at line 224 of file version_fu.h.

#define WINCVS_PRODUCTVERSION_STRING PP_STRINGIZE(WINCVS_FILE_MAJOR.WINCVS_FILE_MINOR.WINCVS_FILE_PATCHLEVEL.WINCVS_BUILD) " " WCVS_PRERELEASE_BUILD_STRING_PREFIX "(" WCVS_PRIVATE_BUILD_STRING_PREFIX WCVS_SPECIAL_BUILD_STRING_PREFIX WCVS_UNICODE_BUILD_STRING_PREFIX WCVS_DEBUG_BUILD_STRING_PREFIX PP_STRINGIZE(Build WINCVS_BUILD) ")"

Definition at line 303 of file version_fu.h.

Generated on Sun Oct 21 12:45:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


version_no.h File Reference

WinCvs/version_no.h File Reference

Go to the source code of this file.

Defines

#define | WINCVS_FILE_MAJOR 1
#define | WINCVS_FILE_MINOR 3
#define | WINCVS_FILE_PATCHLEVEL 6
#define | WINCVS_PRODUCT_MAJOR 1
#define | WINCVS_PRODUCT_MINOR 3
#define | WINCVS_PRODUCT_PATCHLEVEL 6
#define | CVSNTDOS_FILE_MAJOR 1
#define | CVSNTDOS_FILE_MINOR 11
#define | CVSNTDOS_FILE_PATCHLEVEL 1
#define | WINCVS_BUILD 1
#define | CVSNTDOS_BUILD 1
#define | WINCVS_BETA_RELEASE
#define | WINCVS_PRIVATE_BUILD "Local"

Define Documentation

#define CVSNTDOS_BUILD 1

Definition at line 45 of file version_no.h.

#define CVSNTDOS_FILE_MAJOR 1

Definition at line 37 of file version_no.h.

#define CVSNTDOS_FILE_MINOR 11

Definition at line 38 of file version_no.h.

#define CVSNTDOS_FILE_PATCHLEVEL 1

Definition at line 39 of file version_no.h.

#define WINCVS_BETA_RELEASE

Definition at line 58 of file version_no.h.

#define WINCVS_BUILD 1

Definition at line 44 of file version_no.h.

#define WINCVS_FILE_MAJOR 1

Definition at line 29 of file version_no.h.

#define WINCVS_FILE_MINOR 3

Definition at line 30 of file version_no.h.

#define WINCVS_FILE_PATCHLEVEL 6

Definition at line 31 of file version_no.h.

#define WINCVS_PRIVATE_BUILD "Local"

Definition at line 59 of file version_no.h.

#define WINCVS_PRODUCT_MAJOR 1

Definition at line 33 of file version_no.h.

#define WINCVS_PRODUCT_MINOR 3

Definition at line 34 of file version_no.h.

#define WINCVS_PRODUCT_PATCHLEVEL 6

Definition at line 35 of file version_no.h.

Generated on Sun Oct 21 12:45:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Win32wstring.hpp File Reference

WinCvs/Win32wstring.hpp File Reference

#include <string>
#include <windows.h>

Include dependency graph for Win32wstring.hpp:

Include dependency graph

Go to the source code of this file.

Compounds

class Win32wstring

Generated on Sun Oct 21 12:45:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


wincvs.cpp File Reference

WinCvs/wincvs.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "MainFrm.h"
#include "wincvsDoc.h"
#include "GraphDoc.h"
#include "LogFrm.h"
#include "GraphFrm.h"
#include "wincvsView.h"
#include "GraphView.h"
#include "WinCvsBrowser.h"
#include "BrowseFileView.h"
#include "AppGlue.h"
#include "CvsPrefs.h"
#include "AppConsole.h"
#include "Splash.h"
#include "TextBinary.h"
#include "MacrosSetup.h"
#include "MultiString.h"
#include "CvsCommands.h"
#include "Authen.h"
#include "TclGlue.h"
#include "PythonGlue.h"
#include "BrowserBar.h"
#include "FileTraversal.h"
#include "cvsgui_process.h"
#include "CVSTrace.h"
#include "CVS_Coworker_i.h"
#include "CVS_Coworker_i.c"
#include "CVSCoworker.h"

Include dependency graph for wincvs.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CAboutDlg
class | CLogoutThread

Defines

#define | DEBUG_MESSAGE(S) 0

Functions

bool | IsValidHandle (HANDLE handle)
void AFXAPI | DDV_MinChars (CDataExchange *pDX, CString const &value, int nChars)
bool | TrimRight (char *szValue, bool bTest=false)
void AFXAPI | DDV_CheckCVSROOT (CDataExchange *pDX, CString &strValue)
void AFXAPI | DDX_ComboMString (CDataExchange *pDX, int nIDC, CMString &mstr, CComboBox &combo)
bool | MatchToken (LPCTSTR sLine, LPCTSTR sToken)

Variables

CCVS_CoworkerModule _Module
CLogoutThread * | sLogout = 0L
CWincvsApp theApp
const CLSID | clsid

Define Documentation

#define DEBUG_MESSAGE ( S ) 0

Definition at line 1253 of file wincvs.cpp.

Referenced by CWincvsApp::InitATL().

Function Documentation

void AFXAPI DDV_CheckCVSROOT | ( | CDataExchange * | pDX,
 |  | CString & | strValue
 | ) |

Definition at line 865 of file wincvs.cpp.

00866 {
00867     //test 1
00868     //check after the trailing white spaces - often an unwanted result of copy-paste
00869     if( pDX->m_bSaveAndValidate &&
00870         TrimRight(strValue.GetBuffer(strValue.GetLength()+1), true) )
00871     {
00872         strValue.ReleaseBuffer();
00873
00874         if( AfxMessageBox("The CVSROOT value contains the trailing spaces. Do you want to trim them?", MB_ICONQUESTION | MB_YESNO) == IDYES )
00875         {
00876             TrimRight( strValue.GetBuffer(strValue.GetLength()+1) );
00877             strValue.ReleaseBuffer();
00878         }
00879     }
00880 }

void AFXAPI DDV_MinChars | ( | CDataExchange * | pDX,
 |  | CString const & | value,
 |  | int | nChars
 | ) |

Definition at line 809 of file wincvs.cpp.

00810 {
00811     ASSERT(nChars > 0);        // allow them something
00812     if (pDX->m_bSaveAndValidate && value.GetLength() < nChars)
00813     {
00814         TCHAR szT[255];
00815         wsprintf(szT, _T("Please enter more than %d character"), nChars);
00816         CString prompt;
00817         AfxMessageBox(szT, MB_ICONEXCLAMATION, AFX_IDP_PARSE_STRING_SIZE);
00818         prompt.Empty(); // exception prep
00819         pDX->Fail();
00820     }
00821 }

void AFXAPI DDX_ComboMString | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | CMString & | mstr,
 |  | CComboBox & | combo
 | ) |

Definition at line 883 of file wincvs.cpp.

00885 {
00886     if(!pDX || !pDX->m_bSaveAndValidate)
00887     {
00888         CString strOldText;
00889         combo.GetWindowText(strOldText);
00890
00891         combo.ResetContent();
00892         const vector<CStr> & list = mstr.GetList();
00893         vector<CStr>::const_iterator i;
00894         for(i = list.begin(); i != list.end(); ++i)
00895         {
00896             combo.AddString(*i);
00897         }
00898
00899         combo.SetWindowText(strOldText);
00900     }
00901     else
00902     {
00903         CString value;
00904         DDX_CBString(pDX, nIDC, value);
00905         if(!value.IsEmpty())
00906         {
00907             mstr.Insert(value);
00908         }
00909     }
00910 }

bool IsValidHandle ( HANDLE handle )

Definition at line 243 of file wincvs.cpp.

Referenced by CWincvsApp::InitInstance().

00244 {
00245     HANDLE dupedHandle = NULL;
00246
00247     /*
00248      * GetFileType() returns FILE_TYPE_UNKNOWN for invalid handles.
00249      */
00250
00251     if( GetFileType(handle) == FILE_TYPE_UNKNOWN )
00252     {
00253         if( !DuplicateHandle(GetCurrentProcess(),
00254             handle,
00255             GetCurrentProcess(),
00256             &dupedHandle,
00257             0,
00258             FALSE,
00259             DUPLICATE_SAME_ACCESS) )
00260         {
00261             /*
00262             * Unable to make a duplicate. It's definately invalid at this point
00263             */
00264
00265             return false;
00266         }
00267
00268         /*
00269         * Use structured exception handling (Win32 SEH) to protect the close
00270         * of this duped handle which might throw EXCEPTION_INVALID_HANDLE.
00271         */
00272         __try
00273         {
00274             CloseHandle(dupedHandle);
00275         }
00276         __except (EXCEPTION_EXECUTE_HANDLER)
00277         {
00278             /*
00279             * Definately an invalid handle.  So, therefore, the original
00280             * is invalid also.
00281             */
00282
00283             return false;
00284         }
00285     }
00286
00287     return true;
00288 }

bool MatchToken | ( | LPCTSTR | sLine,
 |  | LPCTSTR | sToken
 | ) | [inline, static]

Definition at line 1230 of file wincvs.cpp.

Referenced by CWincvsApp::InitATL().

01231 {
01232     int n = _tcslen(sToken);
01233     if (0 != _tcsnicmp(sLine,sToken,n)) {
01234         return false;
01235     }
01236     LPCTSTR p = sLine + n;
01237     return ((!*p) || (0 != _tcschr(_T(" \t"),*p)));
01238 }

bool TrimRight | ( | char * | szValue,
 |  | bool | bTest = false
 | ) |

Definition at line 826 of file wincvs.cpp.

Referenced by DDV_CheckCVSROOT().

00827 {
00828     bool bRes = false;
00829
00830     char* pszPos = szValue;
00831     char* pszLastSpacePos = NULL;
00832
00833     //locate last white space
00834     while( *pszPos != '\0' )
00835     {
00836         if( isspace(*pszPos) )
00837         {
00838             if( pszLastSpacePos == NULL )
00839             {
00840                 pszLastSpacePos = pszPos;
00841             }
00842         }
00843         else
00844         {
00845             pszLastSpacePos = NULL;
00846         }
00847
00848         pszPos++;
00849     }
00850
00851     //and cut it off
00852     if( pszLastSpacePos )
00853     {
00854         if( !bTest )
00855         {
00856             *pszLastSpacePos = '\0';
00857         }
00858         bRes = true;
00859     }
00860
00861     return bRes;
00862 }

Variable Documentation

CCVS_CoworkerModule _Module

Definition at line 62 of file wincvs.cpp.

const CLSID clsid [static]

Initial value:

{ 0xd2d77dc2, 0x8299, 0x11d1, { 0x89, 0x49, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } }

Definition at line 229 of file wincvs.cpp.

CLogoutThread* sLogout = 0L [static]

Definition at line 174 of file wincvs.cpp.

CWincvsApp theApp

Definition at line 223 of file wincvs.cpp.

Generated on Sun Oct 21 12:45:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


wincvs.h File Reference

WinCvs/wincvs.h File Reference

#include "resource.h"
#include "MultiString.h"

Include dependency graph for wincvs.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CWincvsApp

Defines

#define | AFX_WINCVS_H__D2D77DC7_8299_11D1_8949_444553540000__INCLUDED_

Functions

void AFXAPI | DDV_MinChars (CDataExchange *pDX, CString const &value, int nChars)
void AFXAPI | DDV_CheckCVSROOT (CDataExchange *pDX, CString &strValue)
void AFXAPI | DDX_ComboMString (CDataExchange *pDX, int nIDC, CMString &mstr, CComboBox &combo)

Define Documentation

#define AFX_WINCVS_H__D2D77DC7_8299_11D1_8949_444553540000__INCLUDED_

Definition at line 25 of file wincvs.h.

Function Documentation

void AFXAPI DDV_CheckCVSROOT | ( | CDataExchange * | pDX,
 |  | CString & | strValue
 | ) |

Definition at line 865 of file wincvs.cpp.

00866 {
00867     //test 1
00868     //check after the trailing white spaces - often an unwanted result of copy-paste
00869     if( pDX->m_bSaveAndValidate &&
00870         TrimRight(strValue.GetBuffer(strValue.GetLength()+1), true) )
00871     {
00872         strValue.ReleaseBuffer();
00873
00874         if( AfxMessageBox("The CVSROOT value contains the trailing spaces. Do you want to trim them?", MB_ICONQUESTION | MB_YESNO) == IDYES )
00875         {
00876             TrimRight( strValue.GetBuffer(strValue.GetLength()+1) );
00877             strValue.ReleaseBuffer();
00878         }
00879     }
00880 }

void AFXAPI DDV_MinChars | ( | CDataExchange * | pDX,
 |  | CString const & | value,
 |  | int | nChars
 | ) |

Definition at line 809 of file wincvs.cpp.

00810 {
00811     ASSERT(nChars > 0);        // allow them something
00812     if (pDX->m_bSaveAndValidate && value.GetLength() < nChars)
00813     {
00814         TCHAR szT[255];
00815         wsprintf(szT, _T("Please enter more than %d character"), nChars);
00816         CString prompt;
00817         AfxMessageBox(szT, MB_ICONEXCLAMATION, AFX_IDP_PARSE_STRING_SIZE);
00818         prompt.Empty(); // exception prep
00819         pDX->Fail();
00820     }
00821 }

void AFXAPI DDX_ComboMString | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | CMString & | mstr,
 |  | CComboBox & | combo
 | ) |

Definition at line 883 of file wincvs.cpp.

00885 {
00886     if(!pDX || !pDX->m_bSaveAndValidate)
00887     {
00888         CString strOldText;
00889         combo.GetWindowText(strOldText);
00890
00891         combo.ResetContent();
00892         const vector<CStr> & list = mstr.GetList();
00893         vector<CStr>::const_iterator i;
00894         for(i = list.begin(); i != list.end(); ++i)
00895         {
00896             combo.AddString(*i);
00897         }
00898
00899         combo.SetWindowText(strOldText);
00900     }
00901     else
00902     {
00903         CString value;
00904         DDX_CBString(pDX, nIDC, value);
00905         if(!value.IsEmpty())
00906         {
00907             mstr.Insert(value);
00908         }
00909     }
00910 }

Generated on Sun Oct 21 12:45:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


wincvs_winutil.cpp File Reference

WinCvs/wincvs_winutil.cpp File Reference

#include "stdafx.h"
#include "wincvs_winutil.h"
#include "MultiString.h"
#include "wincvs.h"
#include "MainFrm.h"
#include "CustomizeMenus.h"
#include "CvsPrefs.h"
#include "TextBinary.h"

Include dependency graph for wincvs_winutil.cpp:

Include dependency graph

Go to the source code of this file.

Functions

CWnd * | FindNextSiblingWindow (CWnd *pWnd, BOOL CheckTabStop)
CWnd * | FindNextChildWindow (CWnd *pWnd, BOOL CheckTabStop)
CWnd * | GetNextParentWindow (CWnd *pWnd)
CWnd * | FindPrevSiblingWindow (CWnd *pWnd, BOOL CheckTabStop)
CWnd * | GetPrevParentWindow (CWnd *pWnd)
CWnd * | GetEndOfDecendantWindow (CWnd *pWnd)
BOOL | IsTargetWindow (CWnd *pWnd, BOOL CheckTabStop)
CWnd * | FindNextWindow (CWnd *pWnd, BOOL CheckTabStop)
CWnd * | FindPrevWindow (CWnd *pWnd, BOOL CheckTabStop)
void | updateUIMenu (CMenu *pMyMenu, CView *pThis)
CMenu * | GetSubCMenu (int nStartId, CView *pThis)
CMenu * | _GetMenuEntryRecurs (CMenu *menu, int nStartId, int &pos)
CMenu * | GetMenuEntry (int nStartId, int &pos)
CMMenuString | gFilesMenu (99,"P_FilesMenu", sDefFilesMenu)
CMMenuString | gBrowserMenu (99,"P_BrowserMenu", sDefBrowserMenu)
CMenu * | GetCustomMenu (int whichmenu, CView *pThis)
void | CustomizeMenus (int whichmenu)
bool | FormatMenuString (int cmd, CString &str)

Variables

char * | sDefBrowserMenu []
char * | sDefFilesMenu []

Function Documentation

void CustomizeMenus ( int whichmenu )

Definition at line 475 of file wincvs_winutil.cpp.

00476 {
00477     CMMenuString *multiMenu;
00478
00479     switch(whichmenu)
00480     {
00481     case kCustomBrowserMenu:
00482         multiMenu = &gBrowserMenu;
00483         break;
00484     case kCustomFilesMenu:
00485         multiMenu = &gFilesMenu;
00486         break;
00487     default:
00488         ASSERT(0);
00489         return;
00490     }
00491
00492     CCustomizeMenus custom(multiMenu);
00493     if(custom.DoModal() == IDOK)
00494     {
00495         gCvsPrefs.save();
00496     }
00497 }

CWnd * FindNextChildWindow | ( | CWnd * | pWnd,
 |  | BOOL | CheckTabStop
 | ) |

Definition at line 106 of file wincvs_winutil.cpp.

Referenced by FindNextSiblingWindow(), and FindNextWindow().

00107 {
00108     if (pWnd)
00109     {
00110         CWnd* pChildWnd = pWnd->GetTopWindow();
00111         while (pChildWnd)
00112         {
00113             if (IsTargetWindow(pChildWnd, CheckTabStop))
00114                 return pChildWnd;
00115             CWnd* pSiblingWnd = FindNextSiblingWindow(pChildWnd, CheckTabStop);
00116             if (pSiblingWnd)
00117                 return pSiblingWnd;
00118             pChildWnd = pChildWnd->GetTopWindow();
00119         }
00120     }
00121     return NULL;
00122 }

CWnd * FindNextSiblingWindow | ( | CWnd * | pWnd,
 |  | BOOL | CheckTabStop
 | ) |

Definition at line 88 of file wincvs_winutil.cpp.

Referenced by FindNextChildWindow(), and FindNextWindow().

00089 {
00090     if (pWnd)
00091     {
00092         CWnd* pSiblingWnd = pWnd->GetNextWindow();
00093         while (pSiblingWnd)
00094         {
00095             if (IsTargetWindow(pSiblingWnd, CheckTabStop))
00096                 return pSiblingWnd;
00097             CWnd* pChildWnd = FindNextChildWindow(pSiblingWnd, CheckTabStop);
00098             if (pChildWnd)
00099                 return pChildWnd;
00100             pSiblingWnd = pSiblingWnd->GetNextWindow();
00101         }
00102     }
00103     return NULL;
00104 }

CWnd* FindNextWindow | ( | CWnd * | pWnd,
 |  | BOOL | CheckTabStop = TRUE
 | ) |

Definition at line 35 of file wincvs_winutil.cpp.

00036 {
00037     ASSERT_VALID(pWnd);
00038     if (pWnd)
00039     {
00040         CWnd* pNextWnd;
00041         pNextWnd = FindNextChildWindow(pWnd, CheckTabStop);
00042         if (pNextWnd)
00043             return pNextWnd;
00044
00045         pNextWnd = FindNextSiblingWindow(pWnd, CheckTabStop);
00046         if (pNextWnd)
00047             return pNextWnd;
00048
00049         CWnd* pParentWnd = GetNextParentWindow(pWnd);
00050         while ((pParentWnd) && (pNextWnd != pWnd))
00051         {
00052             pNextWnd = FindNextChildWindow(pParentWnd, CheckTabStop);
00053             if (pNextWnd)
00054                 return pNextWnd;
00055             pParentWnd = GetNextParentWindow(pParentWnd);
00056         }
00057     }
00058     return pWnd;
00059 }

CWnd * FindPrevSiblingWindow | ( | CWnd * | pWnd,
 |  | BOOL | CheckTabStop
 | ) |

Definition at line 163 of file wincvs_winutil.cpp.

Referenced by FindPrevWindow().

00164 {
00165     if (pWnd)
00166     {
00167         CWnd* pSiblingWnd = pWnd->GetWindow(GW_HWNDPREV);
00168         while (pSiblingWnd)
00169         {
00170             if (IsTargetWindow(pSiblingWnd, CheckTabStop))
00171                 return pSiblingWnd;
00172             pSiblingWnd = pSiblingWnd->GetWindow(GW_HWNDPREV);
00173         }
00174     }
00175     return NULL;
00176 }

CWnd* FindPrevWindow | ( | CWnd * | pWnd,
 |  | BOOL | CheckTabStop = TRUE
 | ) |

Definition at line 124 of file wincvs_winutil.cpp.

00125 {
00126     ASSERT_VALID(pWnd);
00127     if (pWnd)
00128     {
00129         CWnd* pWndCrntLevel = pWnd;
00130         while (TRUE)
00131         {
00132             CWnd* pFoundWnd;
00133             pFoundWnd = FindPrevSiblingWindow(pWndCrntLevel, CheckTabStop);
00134             if (pFoundWnd)
00135                 return pFoundWnd;
00136             pWndCrntLevel = GetPrevParentWindow(pWndCrntLevel);
00137             if (!pWndCrntLevel)
00138             {
00139                 pFoundWnd = GetEndOfDecendantWindow(pWnd->GetParentFrame());
00140                 if (IsTargetWindow(pFoundWnd, CheckTabStop))
00141                     return pFoundWnd;
00142                 pWndCrntLevel = pFoundWnd;
00143             }
00144         }
00145     }
00146     return NULL;
00147 }

bool FormatMenuString | ( | int | cmd,
 |  | CString & | str
 | ) |

Definition at line 499 of file wincvs_winutil.cpp.

00500 {
00501     bool res = false;
00502
00503     switch(cmd)
00504     {
00505     case ID_VIEW_EDITSELDEF:
00506         {
00507             CString viever("default viewer");
00508             if( gCvsPrefs.Viewer() != 0L )
00509             {
00510                 CStr uppath, folder;
00511                 SplitPath(gCvsPrefs.Viewer(), uppath, folder);
00512
00513                 viever = folder.empty() ? (uppath.empty() ? gCvsPrefs.Viewer() : uppath) : folder;
00514                 if( viever.Find(" ") > -1 )
00515                 {
00516                     viever = "\"" + viever + "\"";
00517                 }
00518             }
00519             str = "View &with " + viever;
00520
00521         }
00522         res = TRUE;
00523         break;
00524
00525     default:
00526         break;
00527     }
00528
00529     return res;
00530 }

CMenu* GetCustomMenu | ( | int | whichmenu,
 |  | CView * | pThis
 | ) |

Definition at line 414 of file wincvs_winutil.cpp.

00415 {
00416     CMMenuString *multiMenu;
00417
00418     switch(whichmenu)
00419     {
00420     case kCustomBrowserMenu:
00421         multiMenu = &gBrowserMenu;
00422         break;
00423     case kCustomFilesMenu:
00424         multiMenu = &gFilesMenu;
00425         break;
00426     default:
00427         ASSERT(0);
00428         return 0L;
00429     }
00430
00431     CMenu *res = new CMenu;
00432     VERIFY(res->CreatePopupMenu());
00433
00434     std::vector<UStr> & list = multiMenu->GetList();
00435     std::vector<UStr>::iterator i;
00436
00437     for(i = list.begin(); i != list.end(); ++i)
00438     {
00439         const CustInvertTable *tab = CustGetByKey(*i);
00440         if(tab == 0L)
00441         {
00442             TRACE1("Hum... was '%s' an old command ? Removing it...",
00443                 (const char *)*i);
00444             list.erase(i);
00445             i = list.begin();
00446         }
00447     }
00448
00449     for(i = list.begin(); i != list.end(); ++i)
00450     {
00451         const CustInvertTable *tab = CustGetByKey(*i);
00452
00453         if(tab->cmd == ID_SEPARATOR)
00454         {
00455             res->AppendMenu(MF_SEPARATOR);
00456         }
00457         else
00458         {
00459             CString str = tab->title;
00460             FormatMenuString(tab->cmd, str);
00461             res->AppendMenu(MF_STRING, tab->cmd, str);
00462         }
00463     }
00464
00465     res->AppendMenu(MF_SEPARATOR);
00466     res->AppendMenu(MF_STRING, whichmenu == kCustomFilesMenu ?
00467         ID_CUST_FILES_MENU : ID_CUST_FOLDER_MENU,
00468         CString("Customize this menu..."));
00469
00470     updateUIMenu(res, pThis);
00471
00472     return res;
00473 }

CWnd * GetEndOfDecendantWindow ( CWnd * pWnd )

Definition at line 178 of file wincvs_winutil.cpp.

Referenced by FindPrevWindow().

00179 {
00180     CWnd* pTmpWnd = pWnd;
00181     CWnd* pPreTmpWnd;
00182     while (pTmpWnd)
00183     {
00184         pPreTmpWnd = pTmpWnd;
00185         pTmpWnd = pTmpWnd->GetWindow(GW_CHILD);
00186         if (pTmpWnd)
00187         {
00188             pPreTmpWnd = pTmpWnd;
00189             pTmpWnd = pTmpWnd->GetWindow(GW_HWNDLAST);
00190         }
00191     }
00192     return pPreTmpWnd;
00193 }

CMenu* GetMenuEntry | ( | int | nStartId,
 |  | int & | pos
 | ) |

Definition at line 301 of file wincvs_winutil.cpp.

00302 {
00303     CMenu* pTopMenu = AfxGetMainWnd()->GetMenu();
00304     ASSERT(pTopMenu != 0L);
00305
00306     return _GetMenuEntryRecurs(pTopMenu, nStartId, pos);
00307 }

CWnd * GetNextParentWindow ( CWnd * pWnd )

Definition at line 61 of file wincvs_winutil.cpp.

Referenced by FindNextWindow().

00062 {
00063     if (pWnd)
00064     {
00065         if (pWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd)))
00066             return pWnd->GetTopWindow();
00067
00068         CFrameWnd* pFrameWnd = pWnd->GetParentFrame();
00069         ASSERT_VALID(pFrameWnd);
00070         CWnd* pParentWnd = pWnd->GetParent();
00071         ASSERT_VALID(pParentWnd);
00072
00073         CWnd* pCrntWnd;
00074         BOOL bFound = FALSE;
00075         while ((!bFound) && (pParentWnd != pFrameWnd))
00076         {
00077             pCrntWnd = pParentWnd->GetNextWindow();
00078             if (pCrntWnd)
00079                 bFound = TRUE;
00080             else
00081                 pParentWnd = pParentWnd->GetParent();
00082         }
00083         return (bFound) ? pCrntWnd : pParentWnd->GetTopWindow();
00084     }
00085     return NULL;
00086 }

CWnd * GetPrevParentWindow ( CWnd * pWnd )

Definition at line 149 of file wincvs_winutil.cpp.

Referenced by FindPrevWindow().

00150 {
00151     if (pWnd)
00152     {
00153         if (!pWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd)))
00154         {
00155             CWnd* pParentWnd = pWnd->GetParent();
00156             ASSERT_VALID(pParentWnd);
00157             return pParentWnd;
00158         }
00159     }
00160     return NULL;
00161 }

CMenu* GetSubCMenu | ( | int | nStartId,
 |  | CView * | pThis
 | ) |

Definition at line 248 of file wincvs_winutil.cpp.

00249 {
00250     CMenu* pTopMenu = AfxGetMainWnd()->GetMenu();
00251     ASSERT(pTopMenu != 0L);
00252     if(pTopMenu == 0L)
00253         return NULL;
00254
00255     CMenu* pMyMenu=NULL;
00256     int iPos;
00257     for (iPos = pTopMenu->GetMenuItemCount()-1; iPos >= 0; iPos--)
00258     {
00259         CMenu* pMenu = pTopMenu->GetSubMenu(iPos);
00260         if (pMenu && pMenu->GetMenuItemID(0) == nStartId)
00261         {
00262             pMyMenu = pMenu;
00263             break;
00264         }
00265     }
00266     ASSERT(pMyMenu != 0L);
00267     if(pMyMenu == 0L)
00268         return NULL;
00269
00270     updateUIMenu(pMyMenu, pThis);
00271
00272     return pMyMenu;
00273 }

BOOL IsTargetWindow | ( | CWnd * | pWnd,
 |  | BOOL | CheckTabStop
 | ) | [inline]

Definition at line 27 of file wincvs_winutil.cpp.

Referenced by FindNextChildWindow(), FindNextSiblingWindow(), FindPrevSiblingWindow(), and FindPrevWindow().

00028 {
00029     return ((!CheckTabStop) || (WS_TABSTOP & pWnd->GetStyle()));
00030 }

CMenu* _GetMenuEntryRecurs | ( | CMenu * | menu,
 |  | int | nStartId,
 |  | int & | pos
 | ) |

Definition at line 275 of file wincvs_winutil.cpp.

Referenced by GetMenuEntry().

00276 {
00277     if(menu == 0L)
00278         return 0l;
00279
00280     int iPos;
00281     for (iPos = 0; iPos < menu->GetMenuItemCount(); iPos++)
00282     {
00283         UINT id = menu->GetMenuItemID(iPos);
00284         if(id == nStartId)
00285         {
00286             pos = iPos;
00287             return menu;
00288         }
00289
00290         if(id == (UINT)-1)
00291         {
00292             CMenu *res = _GetMenuEntryRecurs(menu->GetSubMenu(iPos), nStartId, pos);
00293             if(res != 0L)
00294                 return res;
00295         }
00296     }
00297
00298     return 0L;
00299 }

CMMenuString gBrowserMenu | ( | 99 | ,
 |  | "P_BrowserMenu" | ,
 |  | sDefBrowserMenu |
 | ) | [static]

CMMenuString gFilesMenu | ( | 99 | ,
 |  | "P_FilesMenu" | ,
 |  | sDefFilesMenu |
 | ) | [static]

void updateUIMenu | ( | CMenu * | pMyMenu,
 |  | CView * | pThis
 | ) | [static]

Definition at line 195 of file wincvs_winutil.cpp.

Referenced by GetCustomMenu(), and GetSubCMenu().

00196 {
00197     CCmdUI state;
00198     state.m_pMenu = pMyMenu;
00199
00200     state.m_nIndexMax = pMyMenu->GetMenuItemCount();
00201     for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
00202       state.m_nIndex++)
00203     {
00204         state.m_nID = pMyMenu->GetMenuItemID(state.m_nIndex);
00205         if (state.m_nID == 0)
00206             continue; // menu separator or invalid cmd - ignore it
00207
00208         ASSERT(state.m_pOther == NULL);
00209         ASSERT(state.m_pMenu != NULL);
00210         if (state.m_nID == (UINT)-1)
00211         {
00212             // possibly a popup menu, route to first item of that popup
00213             state.m_pSubMenu = pMyMenu->GetSubMenu(state.m_nIndex);
00214             if (state.m_pSubMenu == NULL ||
00215                 (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
00216                 state.m_nID == (UINT)-1)
00217             {
00218                 continue;       // first item of popup can't be routed to
00219             }
00220             state.DoUpdate(pThis, FALSE);    // popups are never auto disabled
00221         }
00222         else
00223         {
00224             // normal menu item
00225             // Auto enable/disable if frame window has 'm_bAutoMenuEnable'
00226             //    set and command is _not_ a system command.
00227             state.m_pSubMenu = NULL;
00228             state.DoUpdate(pThis, TRUE);
00229         }
00230
00231 #   if 0 /* ??? */
00232         // adjust for menu deletions and additions
00233         UINT nCount = pMyMenu->GetMenuItemCount();
00234         if (nCount < state.m_nIndexMax)
00235         {
00236             state.m_nIndex -= (state.m_nIndexMax - nCount);
00237             while (state.m_nIndex < nCount &&
00238                 pMyMenu->GetMenuItemID(state.m_nIndex) == state.m_nID)
00239             {
00240                 state.m_nIndex++;
00241             }
00242         }
00243         state.m_nIndexMax = nCount;
00244 #   endif
00245     }
00246 }

Variable Documentation

char* sDefBrowserMenu[]

Initial value:

{
    "ID_VIEW_UPDATE",
    "ID_VIEW_COMMIT",
    "ID_SEPARATOR",
    "ID_VIEW_EXPLORE",
    "ID_VIEW_QUERYUPDATE",
    "ID_VIEW_RELOAD",
    "ID_SEPARATOR",
    "ID_VIEW_IMPORT",
    "ID_VIEW_CHECKOUT",
    0L
}

Definition at line 377 of file wincvs_winutil.cpp.

char* sDefFilesMenu[]

Initial value:

{
    "ID_VIEW_UPDATE",
    "ID_VIEW_COMMIT",
    "ID_SEPARATOR",
    "ID_VIEW_EXPLORE",
    "ID_VIEW_QUERYUPDATE",
    "ID_VIEW_RELOAD",
    "ID_SEPARATOR",
    "ID_VIEW_EDITSEL",
    "ID_VIEW_EDITSELDEF",
    "ID_SEPARATOR",
    "ID_VIEW_DIFF",
    "ID_VIEW_LOG",
    "ID_VIEW_STATUS",
    "ID_VIEW_GRAPH",
    "ID_QUERY_ANNOTATE",
    0L
}

Definition at line 391 of file wincvs_winutil.cpp.

Generated on Sun Oct 21 12:45:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


wincvs_winutil.h File Reference

WinCvs/wincvs_winutil.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CWndRedrawMngr
CWndRedrawManager supports efficient drawing of CWnd based windows,. More...

Enumerations

enum | { kCustomBrowserMenu, kCustomFilesMenu }

Functions

CWnd * | FindNextWindow (CWnd *pWnd, BOOL CheckTabStop=TRUE)
CWnd * | FindPrevWindow (CWnd *pWnd, BOOL CheckTabStop=TRUE)
CMenu * | GetSubCMenu (int nStartId, CView *pThis)
CMenu * | GetMenuEntry (int nStartId, int &pos)
CMenu * | GetCustomMenu (int whichmenu, CView *pThis)
void | CustomizeMenus (int whichmenu)
bool | FormatMenuString (int cmd, CString &str)

Enumeration Type Documentation

anonymous enum

Enumeration values:
kCustomBrowserMenu
kCustomFilesMenu

Definition at line 13 of file wincvs_winutil.h.

00014 {
00015     kCustomBrowserMenu,
00016     kCustomFilesMenu
00017 };

Function Documentation

void CustomizeMenus ( int whichmenu )

Definition at line 475 of file wincvs_winutil.cpp.

Referenced by CWinCvsBrowser::OnCustomize(), and CBrowseFileView::OnCustomize().

00476 {
00477     CMMenuString *multiMenu;
00478
00479     switch(whichmenu)
00480     {
00481     case kCustomBrowserMenu:
00482         multiMenu = &gBrowserMenu;
00483         break;
00484     case kCustomFilesMenu:
00485         multiMenu = &gFilesMenu;
00486         break;
00487     default:
00488         ASSERT(0);
00489         return;
00490     }
00491
00492     CCustomizeMenus custom(multiMenu);
00493     if(custom.DoModal() == IDOK)
00494     {
00495         gCvsPrefs.save();
00496     }
00497 }

CWnd* FindNextWindow | ( | CWnd * | pWnd,
 |  | BOOL | CheckTabStop = TRUE
 | ) |

Definition at line 35 of file wincvs_winutil.cpp.

00036 {
00037     ASSERT_VALID(pWnd);
00038     if (pWnd)
00039     {
00040         CWnd* pNextWnd;
00041         pNextWnd = FindNextChildWindow(pWnd, CheckTabStop);
00042         if (pNextWnd)
00043             return pNextWnd;
00044
00045         pNextWnd = FindNextSiblingWindow(pWnd, CheckTabStop);
00046         if (pNextWnd)
00047             return pNextWnd;
00048
00049         CWnd* pParentWnd = GetNextParentWindow(pWnd);
00050         while ((pParentWnd) && (pNextWnd != pWnd))
00051         {
00052             pNextWnd = FindNextChildWindow(pParentWnd, CheckTabStop);
00053             if (pNextWnd)
00054                 return pNextWnd;
00055             pParentWnd = GetNextParentWindow(pParentWnd);
00056         }
00057     }
00058     return pWnd;
00059 }

CWnd* FindPrevWindow | ( | CWnd * | pWnd,
 |  | BOOL | CheckTabStop = TRUE
 | ) |

Definition at line 124 of file wincvs_winutil.cpp.

00125 {
00126     ASSERT_VALID(pWnd);
00127     if (pWnd)
00128     {
00129         CWnd* pWndCrntLevel = pWnd;
00130         while (TRUE)
00131         {
00132             CWnd* pFoundWnd;
00133             pFoundWnd = FindPrevSiblingWindow(pWndCrntLevel, CheckTabStop);
00134             if (pFoundWnd)
00135                 return pFoundWnd;
00136             pWndCrntLevel = GetPrevParentWindow(pWndCrntLevel);
00137             if (!pWndCrntLevel)
00138             {
00139                 pFoundWnd = GetEndOfDecendantWindow(pWnd->GetParentFrame());
00140                 if (IsTargetWindow(pFoundWnd, CheckTabStop))
00141                     return pFoundWnd;
00142                 pWndCrntLevel = pFoundWnd;
00143             }
00144         }
00145     }
00146     return NULL;
00147 }

bool FormatMenuString | ( | int | cmd,
 |  | CString & | str
 | ) |

Definition at line 499 of file wincvs_winutil.cpp.

Referenced by GetCustomMenu(), and CBrowseFileView::OnUpdateViewEditseldef().

00500 {
00501     bool res = false;
00502
00503     switch(cmd)
00504     {
00505     case ID_VIEW_EDITSELDEF:
00506         {
00507             CString viever("default viewer");
00508             if( gCvsPrefs.Viewer() != 0L )
00509             {
00510                 CStr uppath, folder;
00511                 SplitPath(gCvsPrefs.Viewer(), uppath, folder);
00512
00513                 viever = folder.empty() ? (uppath.empty() ? gCvsPrefs.Viewer() : uppath) : folder;
00514                 if( viever.Find(" ") > -1 )
00515                 {
00516                     viever = "\"" + viever + "\"";
00517                 }
00518             }
00519             str = "View &with " + viever;
00520
00521         }
00522         res = TRUE;
00523         break;
00524
00525     default:
00526         break;
00527     }
00528
00529     return res;
00530 }

CMenu* GetCustomMenu | ( | int | whichmenu,
 |  | CView * | pThis
 | ) |

Definition at line 414 of file wincvs_winutil.cpp.

00415 {
00416     CMMenuString *multiMenu;
00417
00418     switch(whichmenu)
00419     {
00420     case kCustomBrowserMenu:
00421         multiMenu = &gBrowserMenu;
00422         break;
00423     case kCustomFilesMenu:
00424         multiMenu = &gFilesMenu;
00425         break;
00426     default:
00427         ASSERT(0);
00428         return 0L;
00429     }
00430
00431     CMenu *res = new CMenu;
00432     VERIFY(res->CreatePopupMenu());
00433
00434     std::vector<UStr> & list = multiMenu->GetList();
00435     std::vector<UStr>::iterator i;
00436
00437     for(i = list.begin(); i != list.end(); ++i)
00438     {
00439         const CustInvertTable *tab = CustGetByKey(*i);
00440         if(tab == 0L)
00441         {
00442             TRACE1("Hum... was '%s' an old command ? Removing it...",
00443                 (const char *)*i);
00444             list.erase(i);
00445             i = list.begin();
00446         }
00447     }
00448
00449     for(i = list.begin(); i != list.end(); ++i)
00450     {
00451         const CustInvertTable *tab = CustGetByKey(*i);
00452
00453         if(tab->cmd == ID_SEPARATOR)
00454         {
00455             res->AppendMenu(MF_SEPARATOR);
00456         }
00457         else
00458         {
00459             CString str = tab->title;
00460             FormatMenuString(tab->cmd, str);
00461             res->AppendMenu(MF_STRING, tab->cmd, str);
00462         }
00463     }
00464
00465     res->AppendMenu(MF_SEPARATOR);
00466     res->AppendMenu(MF_STRING, whichmenu == kCustomFilesMenu ?
00467         ID_CUST_FILES_MENU : ID_CUST_FOLDER_MENU,
00468         CString("Customize this menu..."));
00469
00470     updateUIMenu(res, pThis);
00471
00472     return res;
00473 }

CMenu* GetMenuEntry | ( | int | nStartId,
 |  | int & | pos
 | ) |

Definition at line 301 of file wincvs_winutil.cpp.

Referenced by cvsgui_GetTopMacroAdminMenu(), and cvsgui_GetTopMacroSelectionMenu().

00302 {
00303     CMenu* pTopMenu = AfxGetMainWnd()->GetMenu();
00304     ASSERT(pTopMenu != 0L);
00305
00306     return _GetMenuEntryRecurs(pTopMenu, nStartId, pos);
00307 }

CMenu* GetSubCMenu | ( | int | nStartId,
 |  | CView * | pThis
 | ) |

Definition at line 248 of file wincvs_winutil.cpp.

00249 {
00250     CMenu* pTopMenu = AfxGetMainWnd()->GetMenu();
00251     ASSERT(pTopMenu != 0L);
00252     if(pTopMenu == 0L)
00253         return NULL;
00254
00255     CMenu* pMyMenu=NULL;
00256     int iPos;
00257     for (iPos = pTopMenu->GetMenuItemCount()-1; iPos >= 0; iPos--)
00258     {
00259         CMenu* pMenu = pTopMenu->GetSubMenu(iPos);
00260         if (pMenu && pMenu->GetMenuItemID(0) == nStartId)
00261         {
00262             pMyMenu = pMenu;
00263             break;
00264         }
00265     }
00266     ASSERT(pMyMenu != 0L);
00267     if(pMyMenu == 0L)
00268         return NULL;
00269
00270     updateUIMenu(pMyMenu, pThis);
00271
00272     return pMyMenu;
00273 }

Generated on Sun Oct 21 12:45:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvsBrowser.cpp File Reference

WinCvs/WinCvsBrowser.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include "MainFrm.h"
#include "WinCvsBrowser.h"
#include "FileTraversal.h"
#include "AppConsole.h"
#include "CvsPrefs.h"
#include "CvsCommands.h"
#include "BrowseFileView.h"
#include "TclGlue.h"
#include "MacrosSetup.h"
#include "wincvs_winutil.h"
#include "PythonGlue.h"
#include "umain.h"

Include dependency graph for WinCvsBrowser.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | TBrowserFill
class | TBrowserFillDummy

Enumerations

enum {
kIconFolderClosed, kIconFolderOpened, kIconFolderCVSClosed, kIconFolderCVSOpened,
kIconFolderIgnoreClosed, kIconFolderIgnoreOpened, kIconFolderIgnoreLost
}

Functions

void | SetIcon (CTreeCtrl &treeCtrl, HTREEITEM item, bool hasCvsInfos, bool expand, EntnodeData *data=0L)
void | onIgnoreChanged (CObject *obj)

Variables

const int | WM_RESETVIEW = WM_APP + 12
const char * | gDummyFile = "@@@dummy file@@@"

Enumeration Type Documentation

anonymous enum

Enumeration values:
kIconFolderClosed
kIconFolderOpened
kIconFolderCVSClosed
kIconFolderCVSOpened
kIconFolderIgnoreClosed
kIconFolderIgnoreOpened
kIconFolderIgnoreLost

Definition at line 32 of file WinCvsBrowser.cpp.

00033 {
00034     kIconFolderClosed,
00035     kIconFolderOpened,
00036     kIconFolderCVSClosed,
00037     kIconFolderCVSOpened,
00038     kIconFolderIgnoreClosed,
00039     kIconFolderIgnoreOpened,
00040     kIconFolderIgnoreLost
00041 };

Function Documentation

void SetIcon | ( | CTreeCtrl & | treeCtrl,
 |  | HTREEITEM | item,
 |  | bool | hasCvsInfos,
 |  | bool | expand,
 |  | EntnodeData * | data = 0L
 | ) | [static]

Definition at line 235 of file WinCvsBrowser.cpp.

Referenced by CCJBrowseButton::Create(), TBrowserFill::ExitDirectory(), TBrowserFillDummy::ExitDirectory(), TBrowserFill::OnDirectory(), and CCJFlatButton::SetIcon().

00237 {
00238     TV_ITEM pItem;
00239     pItem.hItem = item;
00240     pItem.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
00241     VERIFY(treeCtrl.GetItem(&pItem));
00242
00243     int newImage;
00244     if(data == 0L)
00245     {
00246         if(expand)
00247             newImage = hasCvsInfos ? kIconFolderCVSOpened : kIconFolderOpened;
00248         else
00249             newImage = hasCvsInfos ? kIconFolderCVSClosed : kIconFolderClosed;
00250     }
00251     else
00252     {
00253         if(expand)
00254         {
00255             if(data->IsIgnored())
00256                 newImage = kIconFolderIgnoreOpened;
00257             else if(data->IsUnknown())
00258                 newImage = kIconFolderOpened;
00259             else
00260                 newImage = kIconFolderCVSOpened;
00261         }
00262         else
00263         {
00264             if(data->IsIgnored())
00265                 newImage = kIconFolderIgnoreClosed;
00266             else if(data->IsUnknown())
00267                 newImage = kIconFolderClosed;
00268             else
00269                 newImage = kIconFolderCVSClosed;
00270         }
00271     }
00272
00273     if(pItem.iImage != newImage)
00274     {
00275         pItem.iImage = newImage;
00276         pItem.iSelectedImage = newImage;
00277         pItem.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
00278         treeCtrl.SetItem(&pItem);
00279     }
00280 }

void onIgnoreChanged ( CObject * obj ) [static]

Definition at line 931 of file WinCvsBrowser.cpp.

00932 {
00933     ((CWinCvsBrowser *)obj)->OnIgnoreChanged();
00934 }

Variable Documentation

const int WM_RESETVIEW = WM_APP + 12 [static]

Definition at line 30 of file WinCvsBrowser.cpp.

const char* gDummyFile = "@@@dummy file@@@" [static]

Definition at line 112 of file WinCvsBrowser.cpp.

Generated on Sun Oct 21 12:45:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvsBrowser.h File Reference

WinCvs/WinCvsBrowser.h File Reference

#include <afxcview.h>
#include "CPStr.h"

Include dependency graph for WinCvsBrowser.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CWinCvsBrowser::CSelectionChangeNotifier
class | CWinCvsBrowser

Defines

#define | AFX_WINCVSBROWSER_H__144A4971_CAB4_11D1_BC80_000000000000__INCLUDED_

Define Documentation

#define AFX_WINCVSBROWSER_H__144A4971_CAB4_11D1_BC80_000000000000__INCLUDED_

Definition at line 2 of file WinCvsBrowser.h.

Generated on Sun Oct 21 12:45:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvsDebug.cpp File Reference

WinCvs/WinCvsDebug.cpp File Reference

#include "stdafx.h"
#include "WinCvsDebug.h"

Include dependency graph for WinCvsDebug.cpp:

Include dependency graph

Go to the source code of this file.

Functions

unsigned long | GetWinCvsDebugMask (bool clear_mask)
void | SetWinCvsDebugMask (unsigned long umask)
void | AppendWinCvsDebugMask (unsigned long umask)
void | SetWinCvsDebugMaskBit (unsigned char bit, bool val)
bool | GetWinCvsDebugMaskBit (unsigned char bit, bool clear_mask)

Variables

unsigned long | wincvs_debug_mask = 0L

Function Documentation

void AppendWinCvsDebugMask ( unsigned long umask )

Definition at line 46 of file WinCvsDebug.cpp.

00047 {
00048     wincvs_debug_mask = wincvs_debug_mask | umask;
00049 }

unsigned long GetWinCvsDebugMask ( bool clear_mask = true )

Definition at line 33 of file WinCvsDebug.cpp.

00034 {
00035     unsigned long retval = wincvs_debug_mask;
00036     if ( clear_mask && (wincvs_debug_mask & wcvsdbg_one_shot) )
00037         wincvs_debug_mask = wcvsdbg_one_shot;
00038     return retval;
00039 }

bool GetWinCvsDebugMaskBit | ( | unsigned char | bit,
 |  | bool | clear_mask = true
 | ) |

Definition at line 67 of file WinCvsDebug.cpp.

00068 {
00069     bool retval = (wincvs_debug_mask & (1 << bit)) != 0;
00070     if ( clear_mask && (wincvs_debug_mask & wcvsdbg_one_shot) && (bit != wcvsdbg_one_shot_bit) )
00071     {
00072         wincvs_debug_mask = wincvs_debug_mask & ~(1 << bit);
00073     }
00074     return retval;
00075 }

void SetWinCvsDebugMask ( unsigned long umask )

Definition at line 41 of file WinCvsDebug.cpp.

00042 {
00043     wincvs_debug_mask = umask;
00044 }

void SetWinCvsDebugMaskBit | ( | unsigned char | bit,
 |  | bool | val
 | ) |

Definition at line 51 of file WinCvsDebug.cpp.

00052 {
00053     if (bit > sizeof(wincvs_debug_mask) * 8)
00054     {
00055         return;
00056     }
00057     if (val)
00058     {
00059         wincvs_debug_mask = wincvs_debug_mask | 1 << bit;
00060     }
00061     else
00062     {
00063         wincvs_debug_mask = wincvs_debug_mask & ~(1 << bit);
00064     }
00065 }

Variable Documentation

unsigned long wincvs_debug_mask = 0L [static]

Definition at line 30 of file WinCvsDebug.cpp.

Generated on Sun Oct 21 12:45:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvsDebug.h File Reference

WinCvs/WinCvsDebug.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | WINCVSDEBUG_H_INCLUDED

Enumerations

enum wcvs_debug_mask_bits {
wcvsdbg_one_shot_bit = 0, wcvsdbg_verbose_bit, wcvsdbg_trace_dst_checks_bit, wcvsdbg_trace_modified_checks_bit,
wcvsdbg_trace_stat_bit
}
enum wcvs_debug_mask_flags {
wcvsdbg_one_shot = 1L << wcvsdbg_one_shot_bit, wcvsdbg_verbose = 1L << wcvsdbg_verbose_bit, wcvsdbg_trace_dst_checks = 1L << wcvsdbg_trace_dst_checks_bit, wcvsdbg_trace_modified_checks = 1L << wcvsdbg_trace_modified_checks_bit,
wcvsdbg_trace_stat = 1L << wcvsdbg_trace_stat_bit
}

Functions

unsigned long | GetWinCvsDebugMask (bool clear_mask=true)
bool | GetWinCvsDebugMaskBit (unsigned char bit, bool clear_mask=true)
void | SetWinCvsDebugMask (unsigned long umask)
void | AppendWinCvsDebugMask (unsigned long umask)
void | SetWinCvsDebugMaskBit (unsigned char bit, bool val)

Define Documentation

#define WINCVSDEBUG_H_INCLUDED

Definition at line 27 of file WinCvsDebug.h.

Enumeration Type Documentation

enum wcvs_debug_mask_bits

Enumeration values:
wcvsdbg_one_shot_bit
wcvsdbg_verbose_bit
wcvsdbg_trace_dst_checks_bit
wcvsdbg_trace_modified_checks_bit
wcvsdbg_trace_stat_bit

Definition at line 29 of file WinCvsDebug.h.

00030 {
00031     wcvsdbg_one_shot_bit = 0,
00032     wcvsdbg_verbose_bit,
00033     wcvsdbg_trace_dst_checks_bit,
00034     wcvsdbg_trace_modified_checks_bit,
00035     wcvsdbg_trace_stat_bit
00036 };

enum wcvs_debug_mask_flags

Enumeration values:
wcvsdbg_one_shot
wcvsdbg_verbose
wcvsdbg_trace_dst_checks
wcvsdbg_trace_modified_checks
wcvsdbg_trace_stat

Definition at line 38 of file WinCvsDebug.h.

00039 {
00040     wcvsdbg_one_shot = 1L << wcvsdbg_one_shot_bit,
00041     wcvsdbg_verbose = 1L << wcvsdbg_verbose_bit,
00042     wcvsdbg_trace_dst_checks = 1L << wcvsdbg_trace_dst_checks_bit,
00043     wcvsdbg_trace_modified_checks = 1L << wcvsdbg_trace_modified_checks_bit,
00044     wcvsdbg_trace_stat = 1L << wcvsdbg_trace_stat_bit
00045 };

Function Documentation

void AppendWinCvsDebugMask ( unsigned long umask )

Definition at line 46 of file WinCvsDebug.cpp.

Referenced by FileTraverse().

00047 {
00048     wincvs_debug_mask = wincvs_debug_mask | umask;
00049 }

unsigned long GetWinCvsDebugMask ( bool clear_mask = true )

Definition at line 33 of file WinCvsDebug.cpp.

Referenced by FileTraverse().

00034 {
00035     unsigned long retval = wincvs_debug_mask;
00036     if ( clear_mask && (wincvs_debug_mask & wcvsdbg_one_shot) )
00037         wincvs_debug_mask = wcvsdbg_one_shot;
00038     return retval;
00039 }

bool GetWinCvsDebugMaskBit | ( | unsigned char | bit,
 |  | bool | clear_mask = true
 | ) |

Definition at line 67 of file WinCvsDebug.cpp.

Referenced by Entries_SetVisited(), and FileTimeToUnixTime().

00068 {
00069     bool retval = (wincvs_debug_mask & (1 << bit)) != 0;
00070     if ( clear_mask && (wincvs_debug_mask & wcvsdbg_one_shot) && (bit != wcvsdbg_one_shot_bit) )
00071     {
00072         wincvs_debug_mask = wincvs_debug_mask & ~(1 << bit);
00073     }
00074     return retval;
00075 }

void SetWinCvsDebugMask ( unsigned long umask )

Definition at line 41 of file WinCvsDebug.cpp.

Referenced by FileTraverse().

00042 {
00043     wincvs_debug_mask = umask;
00044 }

void SetWinCvsDebugMaskBit | ( | unsigned char | bit,
 |  | bool | val
 | ) |

Definition at line 51 of file WinCvsDebug.cpp.

00052 {
00053     if (bit > sizeof(wincvs_debug_mask) * 8)
00054     {
00055         return;
00056     }
00057     if (val)
00058     {
00059         wincvs_debug_mask = wincvs_debug_mask | 1 << bit;
00060     }
00061     else
00062     {
00063         wincvs_debug_mask = wincvs_debug_mask & ~(1 << bit);
00064     }
00065 }

Generated on Sun Oct 21 12:45:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


wincvsDoc.cpp File Reference

WinCvs/wincvsDoc.cpp File Reference

#include "stdafx.h"
#include "wincvs.h"
#include <afxrich.h>
#include "wincvsDoc.h"
#include "CvsCommands.h"
#include "GetPrefs.h"
#include "Authen.h"
#include "CvsPrefs.h"
#include "AppConsole.h"
#include "PromptFiles.h"
#include "WinCvsBrowser.h"
#include "TclGlue.h"
#include "PythonGlue.h"
#include "MacrosSetup.h"
#include "cvsgui_process.h"

Include dependency graph for wincvsDoc.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | _afxRichEditCookie

Functions

DWORD CALLBACK | EditStreamCallBack (DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)

Variables

const IID | IID_IWincvs

Function Documentation

DWORD CALLBACK EditStreamCallBack | ( | DWORD | dwCookie,
 |  | LPBYTE | pbBuff,
 |  | LONG | cb,
 |  | LONG * | pcb
 | ) |

Definition at line 156 of file wincvsDoc.cpp.

00157 {
00158     _afxRichEditCookie* pCookie = (_afxRichEditCookie*)dwCookie;
00159     CArchive& ar = pCookie->m_ar;
00160     ar.Flush();
00161     DWORD dw = 0;
00162     *pcb = cb;
00163     TRY
00164     {
00165         if (ar.IsStoring())
00166             ar.GetFile()->WriteHuge(pbBuff, cb);
00167         else
00168             *pcb = ar.GetFile()->ReadHuge(pbBuff, cb);
00169     }
00170     CATCH(CFileException, e)
00171     {
00172         *pcb = 0;
00173         pCookie->m_dwError = (DWORD)e->m_cause;
00174         dw = 1;
00175     }
00176     AND_CATCH_ALL(e)
00177     {
00178         *pcb = 0;
00179         pCookie->m_dwError = (DWORD)CFileException::generic;
00180         dw = 1;
00181     }
00182     END_CATCH_ALL
00183     return dw;
00184 }

Variable Documentation

const IID IID_IWincvs [static]

Initial value:

{ 0xd2d77dc4, 0x8299, 0x11d1, { 0x89, 0x49, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } }

Definition at line 102 of file wincvsDoc.cpp.

Generated on Sun Oct 21 12:45:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


wincvsDoc.h File Reference

WinCvs/wincvsDoc.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CWincvsDoc

Defines

#define | AFX_WINCVSDOC_H__D2D77DCE_8299_11D1_8949_444553540000__INCLUDED_

Define Documentation

#define AFX_WINCVSDOC_H__D2D77DCE_8299_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file wincvsDoc.h.

Generated on Sun Oct 21 12:45:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


wincvsView.cpp File Reference

WinCvs/wincvsView.cpp File Reference

#include "stdafx.h"
#include <atlconv.h>
#include "wincvs.h"
#include "wincvsDoc.h"
#include "wincvsView.h"
#include "wincvs_winutil.h"
#include "MainFrm.h"
#include "Persistent.h"
#include "CvsPrefs.h"
#include "AppGlue.h"
#include "TclGlue.h"
#include "PythonGlue.h"

Include dependency graph for wincvsView.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CCharFormat

Functions

CPersistentT< CCharFormat > | gViewFont ("P_ViewFont", CCharFormat(), kNoClass)

Function Documentation

CPersistentT<CCharFormat> gViewFont | ( | "P_ViewFont" | ,
 |  | CCharFormat() | ,
 |  | kNoClass |
 | ) | [static]

Generated on Sun Oct 21 12:45:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


wincvsView.h File Reference

WinCvs/wincvsView.h File Reference

#include <afxrich.h>
#include "AppConsole.h"

Include dependency graph for wincvsView.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCvsThreadLock
class | CWincvsView

Defines

#define | AFX_WINCVSVIEW_H__D2D77DD0_8299_11D1_8949_444553540000__INCLUDED_
#define | MAX_CHAR_BY_LINE 1024

Define Documentation

#define AFX_WINCVSVIEW_H__D2D77DD0_8299_11D1_8949_444553540000__INCLUDED_

Definition at line 26 of file wincvsView.h.

#define MAX_CHAR_BY_LINE 1024

Definition at line 101 of file wincvsView.h.

Generated on Sun Oct 21 12:45:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AdminOptionDlg.cpp Source File

common/AdminOptionDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- October 2001
00019  */
00020
00021 /*
00022  * AdminOptionDlg.cpp --- admin options dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #include "wincvs.h"
00029 #include "AdminOptionDlg.h"
00030 #endif /* WIN32 */
00031
00032 #ifdef _DEBUG
00033 #define new DEBUG_NEW
00034 #undef THIS_FILE
00035 static char THIS_FILE[] = __FILE__;
00036 #endif
00037
00039 // CAdminOptionDlg dialog
00040
00041 #ifdef WIN32
00042
00043 CAdminOptionDlg::CAdminOptionDlg(kAdminOptionDlgType type,
00044                                  CWnd* pParent /*=NULL*/)
00045     : CDialog(CAdminOptionDlg::IDD, pParent)
00046 {
00047     //{{AFX_DATA_INIT(CAdminOptionDlg)
00048     //}}AFX_DATA_INIT
00049
00050     m_optionString = _T("");
00051     m_type = type;
00052     m_singeLine = FALSE;
00053 }
00054
00055
00056 void CAdminOptionDlg::DoDataExchange(CDataExchange* pDX)
00057 {
00058     CDialog::DoDataExchange(pDX);
00059     //{{AFX_DATA_MAP(CAdminOptionDlg)
00060     //}}AFX_DATA_MAP
00061
00062     DDX_Text(pDX, m_singeLine ? IDC_OPTIONSTRING_SL : IDC_OPTIONSTRING, m_optionString);
00063
00064     if( pDX->m_bSaveAndValidate )
00065     {
00066         if( kSetState == m_type && m_optionString.Find(" ") > -1 )
00067         {
00068             AfxMessageBox( "State can't contain the spaces.", MB_ICONSTOP );
00069             pDX->Fail();
00070         }
00071     }
00072 }
00073
00074
00075 BEGIN_MESSAGE_MAP(CAdminOptionDlg, CDialog)
00076     //{{AFX_MSG_MAP(CAdminOptionDlg)
00077     //}}AFX_MSG_MAP
00078 END_MESSAGE_MAP()
00079
00081 // CAdminOptionDlg message handlers
00082
00083 BOOL CAdminOptionDlg::OnInitDialog()
00084 {
00085     //set the title and description
00086     switch( m_type )
00087     {
00088     case kChangeLog:
00089         m_title = "Change log message";
00090         m_optionDescription = "&Log message:";
00091         break;
00092     case kSetState:
00093         m_title = "Set state";
00094         m_optionDescription = "&State:";
00095         m_singeLine = TRUE;
00096         break;
00097     case kSetDescription:
00098         m_title = "Set Description";
00099         m_optionDescription = "&Description";
00100         break;
00101     default:
00102         ASSERT(FALSE); //unknown type
00103         return FALSE;
00104     }
00105
00106     //hide the unneccessary controls and re-position the window if neccessary
00107     GetDlgItem(m_singeLine ? IDC_OPTIONSTRING : IDC_OPTIONSTRING_SL)->EnableWindow(FALSE);
00108     GetDlgItem(m_singeLine ? IDC_OPTIONSTRING : IDC_OPTIONSTRING_SL)->ShowWindow(SW_HIDE);
00109     if( m_singeLine )
00110     {
00111         CRect rectSingleLine;
00112         CRect rectMultiLine;
00113         GetDlgItem(IDC_OPTIONSTRING_SL)->GetWindowRect(rectSingleLine);
00114         GetDlgItem(IDC_OPTIONSTRING)->GetWindowRect(rectMultiLine);
00115         int diff = rectMultiLine.Height() - rectSingleLine.Height();
00116
00117         CRect rect;
00118         GetWindowRect(rect);
00119         SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height() - diff, SWP_NOMOVE | SWP_NOZORDER);
00120         GetDlgItem(IDC_OPTIONDESC)->GetWindowRect(rect);
00121         GetDlgItem(IDC_OPTIONDESC)->SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height() - diff, SWP_NOMOVE | SWP_NOZORDER);
00122         GetDlgItem(IDOK)->GetWindowRect(rect);
00123         ScreenToClient(rect);
00124         rect.OffsetRect(0, -diff);
00125         GetDlgItem(IDOK)->MoveWindow(rect);
00126         GetDlgItem(IDCANCEL)->GetWindowRect(rect);
00127         ScreenToClient(rect);
00128         rect.OffsetRect(0, -diff);
00129         GetDlgItem(IDCANCEL)->MoveWindow(rect);
00130     }
00131
00132     //fix the line endings
00133     m_optionString.Replace("\n", "\r\n");
00134
00135     CDialog::OnInitDialog();
00136
00137     if( !m_title.IsEmpty() )
00138     {
00139         SetWindowText(m_title);
00140     }
00141
00142     if( !m_optionDescription.IsEmpty() )
00143     {
00144         GetDlgItem(IDC_OPTIONDESC)->SetWindowText(m_optionDescription);
00145     }
00146
00147     return TRUE;  // return TRUE unless you set the focus to a control
00148                   // EXCEPTION: OCX Property Pages should return FALSE
00149 }
00150
00151 #endif /* WIN32 */
00152
00153 bool CompatGetAdminOptions(kAdminOptionDlgType type, CPStr& optionString)
00154 {
00155     bool userHitOK = false;
00156
00157 #ifdef WIN32
00158     CAdminOptionDlg adminOptionDlg(type);
00159     adminOptionDlg.m_optionString = (const char*)optionString;
00160     if( adminOptionDlg.DoModal() == IDOK )
00161     {
00162         optionString = (const char*)adminOptionDlg.m_optionString;
00163         userHitOK = true;
00164     }
00165 #endif /* WIN32 */
00166 #ifdef qMacCvsPP
00167 #endif /* qMacCvsPP */
00168 #if qUnix
00169 #endif // qUnix
00170
00171     return userHitOK;
00172 }
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AdminOptionDlg.h Source File

common/AdminOptionDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- October 2001
00019  */
00020
00021 /*
00022  * AdminOptionDlg.h --- admin options dialog
00023  */
00024
00025 #if !defined(AFX_ADMINOPTIONDLG_H__C9A89564_F0A4_4294_8C6C_18469D18BCB3__INCLUDED_)
00026 #define AFX_ADMINOPTIONDLG_H__C9A89564_F0A4_4294_8C6C_18469D18BCB3__INCLUDED_
00027
00028 #if _MSC_VER > 1000
00029 #pragma once
00030 #endif // _MSC_VER > 1000
00031 // AdminOptionDlg.h : header file
00032 //
00033
00034 typedef enum
00035 {
00036     kChangeLog,
00037     kSetState,
00038     kSetDescription
00039 } kAdminOptionDlgType;
00040
00041 bool CompatGetAdminOptions(kAdminOptionDlgType type, CPStr& optionString);
00042     // get the admin options...
00043
00044
00045 #ifdef WIN32
00046
00048 // CAdminOptionDlg dialog
00049
00050 class CAdminOptionDlg : public CDialog
00051 {
00052 // Construction
00053 public:
00054     CAdminOptionDlg(kAdminOptionDlgType type,
00055         CWnd* pParent = NULL);   // standard constructor
00056
00057 // Dialog Data
00058     //{{AFX_DATA(CAdminOptionDlg)
00059     enum { IDD = IDD_ADMINOPTION };
00060     //}}AFX_DATA
00061
00062
00063 // Overrides
00064     // ClassWizard generated virtual function overrides
00065     //{{AFX_VIRTUAL(CAdminOptionDlg)
00066     protected:
00067     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00068     //}}AFX_VIRTUAL
00069
00070 // Implementation
00071 protected:
00072
00073     // Generated message map functions
00074     //{{AFX_MSG(CAdminOptionDlg)
00075     virtual BOOL OnInitDialog();
00076     //}}AFX_MSG
00077     DECLARE_MESSAGE_MAP()
00078 public:
00079     CString m_optionString;
00080 private:
00081     kAdminOptionDlgType m_type;
00082     BOOL m_singeLine;
00083
00084     CString m_title;
00085     CString m_optionDescription;
00086 };
00087
00088 //{{AFX_INSERT_LOCATION}}
00089 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00090
00091 #endif /* WIN32 */
00092
00093 #endif // !defined(AFX_ADMINOPTIONDLG_H__C9A89564_F0A4_4294_8C6C_18469D18BCB3__INCLUDED_)
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AnnotateDlg.cpp Source File

common/AnnotateDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- June 2001
00019  */
00020
00021 /*
00022  * AnnotateDlg.cpp : the cvs annotate dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #   include "OptionalPropertySheet.h"
00030 #endif /* WIN32 */
00031
00032 #if qUnix
00033 #   include "UCvsDialogs.h"
00034 #endif
00035
00036 #ifdef qMacCvsPP
00037 #   include <UModalDialogs.h>
00038 #   include <LRadioButton.h>
00039 #   include <LEditText.h>
00040 #   include <LCheckBox.h>
00041 #   include <LMultiPanelView.h>
00042 #   include <LPopupGroupBox.h>
00043 #   include "LPopupFiller.h"
00044
00045 #   include "MacCvsApp.h"
00046 #endif /* qMacCvsPP */
00047
00048 #include "AnnotateDlg.h"
00049 #include "CvsPrefs.h"
00050
00051
00052 #ifdef WIN32
00053 #include "GetPrefs.h"
00054
00055 #ifdef _DEBUG
00056 #define new DEBUG_NEW
00057 #undef THIS_FILE
00058 static char THIS_FILE[] = __FILE__;
00059 #endif
00060
00062 // CAnnotate_MAIN property page
00063
00064 IMPLEMENT_DYNCREATE(CAnnotate_MAIN, CPropertyPage)
00065
00066 CAnnotate_MAIN::CAnnotate_MAIN() : CPropertyPage(CAnnotate_MAIN::IDD)
00067 {
00068     //{{AFX_DATA_INIT(CAnnotate_MAIN)
00069     m_hasRev = FALSE;
00070     m_isDate = FALSE;
00071     m_force = FALSE;
00072     m_noRecurse = FALSE;
00073     m_strRev = _T("");
00074     //}}AFX_DATA_INIT
00075 }
00076
00077 CAnnotate_MAIN::CAnnotate_MAIN(const char *rev, bool isDate)
00078     : CPropertyPage(CAnnotate_MAIN::IDD)
00079 {
00080     m_hasRev = FALSE;
00081     m_isDate = isDate;
00082     m_strRev = rev;
00083     m_force = FALSE;
00084     m_noRecurse = FALSE;
00085 }
00086
00087 CAnnotate_MAIN::~CAnnotate_MAIN()
00088 {
00089 }
00090
00091 void CAnnotate_MAIN::DoDataExchange(CDataExchange* pDX)
00092 {
00093     CPropertyPage::DoDataExchange(pDX);
00094     //{{AFX_DATA_MAP(CAnnotate_MAIN)
00095     DDX_Control(pDX, IDC_COMBO_REV, m_revCombo);
00096     DDX_Check(pDX, IDC_SPECIFY_REV, m_hasRev);
00097     DDX_Check(pDX, IDC_ISDATE, m_isDate);
00098     DDX_Check(pDX, IDC_FORCE, m_force);
00099     DDX_Check(pDX, IDC_NORECURS, m_noRecurse);
00100     DDX_CBString(pDX, IDC_COMBO_REV, m_strRev);
00101     //}}AFX_DATA_MAP
00102
00103     if(m_hasRev)
00104         DDV_MinChars(pDX, m_strRev, 1);
00105
00106     DDX_ComboMString(pDX, IDC_COMBO_REV, m_isDate ? gDateNames : gRevNames, m_revCombo);
00107
00108     if(!pDX->m_bSaveAndValidate)
00109         OnSpecifyRev();
00110 }
00111
00112
00113 BEGIN_MESSAGE_MAP(CAnnotate_MAIN, CPropertyPage)
00114 //{{AFX_MSG_MAP(CAnnotate_MAIN)
00115 ON_BN_CLICKED(IDC_SPECIFY_REV, OnSpecifyRev)
00116 ON_BN_CLICKED(IDC_ISDATE, OnIsdate)
00117 //}}AFX_MSG_MAP
00118 END_MESSAGE_MAP()
00119
00121 // CAnnotate_MAIN message handlers
00122
00123 void CAnnotate_MAIN::OnSpecifyRev()
00124 {
00125     CButton* btnHasRev = (CButton*)GetDlgItem(IDC_SPECIFY_REV);
00126     CWnd* wndIsDate = GetDlgItem(IDC_ISDATE);
00127     CWnd* wndRev = GetDlgItem(IDC_COMBO_REV);
00128     CWnd* wndForce = GetDlgItem(IDC_FORCE);
00129
00130     BOOL bEnable = btnHasRev->GetCheck();
00131
00132     wndIsDate->EnableWindow(bEnable);
00133     wndRev->EnableWindow(bEnable);
00134     wndForce->EnableWindow(bEnable);
00135 }
00136
00137 void CAnnotate_MAIN::OnIsdate()
00138 {
00139     CButton* btnIsDate = (CButton*)GetDlgItem(IDC_ISDATE);
00140     DDX_ComboMString(NULL, IDC_COMBO_REV, btnIsDate->GetCheck() ? gDateNames : gRevNames, m_revCombo);
00141 }
00142
00143 #endif /* WIN32 */
00144
00145 bool CompatGetAnnotate(bool & noRecurs, bool & isDate, CPStr & rev, bool & force)
00146 {
00147     bool userHitOK = false;
00148
00149     static CPStr sLastRev;
00150     static bool bIsDate = false;
00151
00152     rev = "";
00153     noRecurs = false;
00154     force = false;
00155     bool hasRev = false;
00156     isDate = bIsDate;
00157
00158 #ifdef WIN32
00159     COptionalPropertySheet pages(gCvsPrefs.HideCommandDlgAnnotate(), "Annotate settings");
00160     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00161     CAnnotate_MAIN page1(sLastRev, isDate);
00162     CGetPrefs_GLOBALS page2;
00163     pages.AddPage(&page1);
00164     pages.AddPage(&page2);
00165     if(pages.DoModal() == IDOK)
00166     {
00167         noRecurs = page1.m_noRecurse == TRUE;
00168
00169         sLastRev = page1.m_strRev;
00170         isDate = page1.m_isDate == TRUE;
00171         hasRev = page1.m_hasRev == TRUE;
00172         force = page1.m_force == TRUE;
00173
00174         page2.StoreValues();
00175         gCvsPrefs.SetHideCommandDlgAnnotate(pages.GetHideCommandDlg());
00176         userHitOK = true;
00177     }
00178 #endif /* WIN32 */
00179
00180 #ifdef qMacCvsPP
00181 #endif /* qMacCvsPP */
00182
00183 #if qUnix
00184 #endif // qUnix
00185
00186     if(userHitOK)
00187     {
00188         if(hasRev)
00189             rev = sLastRev;
00190         bIsDate = isDate;
00191
00192         gCvsPrefs.save();
00193     }
00194
00195     return userHitOK;
00196 }
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AnnotateDlg.h Source File

common/AnnotateDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- June 2001
00019  */
00020
00021 /*
00022  * AnnotateDlg.h : the cvs annotate dialog
00023  */
00024
00025 #if !defined(AFX_ANNOTATEDLG_H__864729EE_838B_473D_8723_E1269829F781__INCLUDED_)
00026 #define AFX_ANNOTATEDLG_H__864729EE_838B_473D_8723_E1269829F781__INCLUDED_
00027
00028 #if _MSC_VER > 1000
00029 #pragma once
00030 #endif // _MSC_VER > 1000
00031
00032 #include "CPStr.h"
00033 #include "MultiString.h"
00034
00035 bool CompatGetAnnotate(bool & noRecurs, bool & isDate, CPStr & rev, bool & force);
00036     // get the annotate options...
00037
00038 extern CMString gRevNames;
00039 extern CMString gDateNames;
00040     // persistent default values for the dates, tags...
00041
00042 #ifdef WIN32
00043
00045 // CAnnotate_MAIN dialog
00046
00047 class CAnnotate_MAIN : public CPropertyPage
00048 {
00049     DECLARE_DYNCREATE(CAnnotate_MAIN)
00050
00051 // Construction
00052 public:
00053     CAnnotate_MAIN(const char *rev, bool isDate);
00054     CAnnotate_MAIN();
00055     ~CAnnotate_MAIN();
00056
00057 // Dialog Data
00058     //{{AFX_DATA(CAnnotate_MAIN)
00059     enum { IDD = IDD_ANNOTATE_MAIN };
00060     CComboBox   m_revCombo;
00061     BOOL    m_hasRev;
00062     BOOL    m_isDate;
00063     BOOL    m_force;
00064     BOOL    m_noRecurse;
00065     CString m_strRev;
00066     //}}AFX_DATA
00067
00068
00069 // Overrides
00070     // ClassWizard generate virtual function overrides
00071     //{{AFX_VIRTUAL(CAnnotate_MAIN)
00072     protected:
00073     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00074     //}}AFX_VIRTUAL
00075
00076 // Implementation
00077 protected:
00078     // Generated message map functions
00079     //{{AFX_MSG(CAnnotate_MAIN)
00080     afx_msg void OnSpecifyRev();
00081     afx_msg void OnIsdate();
00082     //}}AFX_MSG
00083     DECLARE_MESSAGE_MAP()
00084
00085 };
00086
00087 //{{AFX_INSERT_LOCATION}}
00088 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00089 #endif /* WIN32 */
00090
00091 #endif // !defined(AFX_ANNOTATEDLG_H__864729EE_838B_473D_8723_E1269829F781__INCLUDED_)
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AppConsole.cpp Source File

common/AppConsole.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * AppConsole.cpp --- output to the console
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef qMacCvsPP
00028 #   include "MacCvsApp.h"
00029 #   include "LogWindow.h"
00030 #endif /* qMacCvsPP */
00031
00032 #ifdef qUnix
00033 #   include "UCvsConsole.h"
00034 #   include "UCvsCommands.h"
00035 #   include "uconsole.h"
00036 #endif /* qUnix */
00037
00038 #include <string.h>
00039 #include <stdarg.h>
00040 #include <stdio.h>
00041 #include "AppConsole.h"
00042
00043 #ifdef WIN32
00044 #   include "wincvs.h"
00045 #   include "wincvsView.h"
00046
00047 #   ifdef _DEBUG
00048 #   define new DEBUG_NEW
00049 #   undef THIS_FILE
00050     static char THIS_FILE[] = __FILE__;
00051 #   endif
00052 #endif /* WIN32 */
00053
00054 void cvs_out(const char *format, ...)
00055 {
00056     va_list args;
00057     char mess[1024] = {'\0'};
00058
00059     va_start (args, format);
00060     vsprintf (mess, format, args);
00061     va_end (args);
00062
00063 #ifdef WIN32
00064     CWinApp* app = AfxGetApp();
00065     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00066     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00067     if(view == NULL)
00068         return;
00069
00070     view->OutConsole(mess, strlen(mess));
00071 #endif /* WIN32 */
00072 #ifdef qMacCvsPP
00073     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00074     if(log == 0L)
00075         return;
00076     log->WriteCharsToConsole(mess, strlen(mess));
00077 #endif /* qMacCvsPP */
00078 #ifdef qUnix
00079     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00080     if(console == 0L)
00081     {
00082         UAppConsole(mess);
00083         return;
00084     }
00085
00086     console->OutConsole(mess, strlen(mess));
00087 #endif /* qUnix */
00088 }
00089
00090 void cvs_err(const char *format, ...)
00091 {
00092     va_list args;
00093     char mess[1024] = {'\0'};
00094
00095     va_start (args, format);
00096     vsprintf (mess, format, args);
00097     va_end (args);
00098
00099 #ifdef WIN32
00100     CWinApp* app = AfxGetApp();
00101     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00102     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00103     if(view == NULL)
00104         return;
00105
00106     view->OutConsole(mess, strlen(mess), true);
00107 #endif /* WIN32 */
00108 #ifdef qMacCvsPP
00109     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00110     if(log == 0L)
00111         return;
00112     log->WriteCharsToConsole(mess, strlen(mess), true);
00113 #endif /* qMacCvsPP */
00114 #ifdef qUnix
00115     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00116     if(console == 0L)
00117     {
00118         UAppConsole(mess);
00119         return;
00120     }
00121
00122     console->OutConsole(mess, strlen(mess), true);
00123 #endif /* qUnix */
00124 }
00125
00126 void cvs_outstr(const char *str, size_t len)
00127 {
00128 #ifdef WIN32
00129     CWinApp* app = AfxGetApp();
00130     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00131     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00132     if(view == NULL)
00133         return;
00134
00135     view->OutConsole(str, len);
00136 #endif /* WIN32 */
00137 #ifdef qMacCvsPP
00138     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00139     if(log == 0L)
00140         return;
00141     log->WriteCharsToConsole(str, len);
00142 #endif /* qMacCvsPP */
00143 #ifdef qUnix
00144     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00145     if(console == 0L)
00146     {
00147         UAppConsole(str);
00148         return;
00149     }
00150
00151     console->OutConsole(str, len);
00152 #endif /* qUnix */
00153 }
00154
00155 void cvs_errstr(const char *str, size_t len)
00156 {
00157 #ifdef WIN32
00158     CWinApp* app = AfxGetApp();
00159     //ASSERT(app->IsKindOf(RUNTIME_CLASS(CWincvsApp)));
00160     CWincvsView *view = ((CWincvsApp *)app)->GetConsoleView();
00161     if(view == NULL)
00162         return;
00163
00164     view->OutConsole(str, len, true);
00165 #endif /* WIN32 */
00166 #ifdef qMacCvsPP
00167     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00168     if(log == 0L)
00169         return;
00170     log->WriteCharsToConsole(str, len, true);
00171 #endif /* qMacCvsPP */
00172 #ifdef qUnix
00173     UCvsConsole* console = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00174     if(console == 0L)
00175     {
00176         UAppConsole(str);
00177         return;
00178     }
00179
00180     console->OutConsole(str, len, true);
00181 #endif /* qUnix */
00182 }
00183
00184 #ifdef WIN32
00185 CWincvsView * CColorConsole::GetView()
00186 {
00187     CWinApp* app = AfxGetApp();
00188     CWincvsView *view = fView != 0L ? fView : ((CWincvsApp *)app)->GetConsoleView();
00189     if(view && view->m_hWnd == 0L)
00190         view = 0L;
00191     return view;
00192 }
00193 #endif /* WIN32 */
00194
00195 CColorConsole::CColorConsole()
00196 {
00197 #ifdef WIN32
00198     fView = 0L;
00199     CWincvsView *view = GetView();
00200     if(view == 0L)
00201         return;
00202
00203     oldFormat = view->GetCurFormat();
00204 #else /* !WIN32 */
00205     *this << kNormal;
00206 #endif /* !WIN32 */
00207 }
00208
00209 #ifdef WIN32
00210 CColorConsole::CColorConsole(CWincvsView * aview)
00211 {
00212     fView = aview;
00213     CWincvsView *view = GetView();
00214     if(view == 0L)
00215         return;
00216
00217     oldFormat = view->GetCurFormat();
00218 }
00219 #endif /* WIN32 */
00220
00221 CColorConsole::~CColorConsole()
00222 {
00223     *this << kNormal;
00224 }
00225
00226 CColorConsole & CColorConsole::operator<<(char c)
00227 {
00228 #ifdef WIN32
00229     CWincvsView *view = GetView();
00230     if(view == 0L)
00231         return *this;
00232
00233     view->OutColor(&c, 1);
00234 #endif /* WIN32 */
00235 #ifdef qMacCvsPP
00236     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00237     if(log == 0L)
00238         return *this;
00239
00240     log->OutColor(&c, 1);
00241 #endif /* qMacCvsPP */
00242 #ifdef qUnix
00243     UCvsConsole *log = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00244     if(log == 0L)
00245         return *this;
00246
00247     log->OutColor(&c, 1);
00248 #endif /* qUnix */
00249
00250     return *this;
00251 }
00252
00253 CColorConsole & CColorConsole::operator<<(kConsoleColor color)
00254 {
00255 #ifdef WIN32
00256     CWincvsView *view = GetView();
00257     if(view == 0L)
00258         return *this;
00259
00260     if(color == kNL)
00261     {
00262         char tmp[2] = {0x0a};
00263         view->OutColor(tmp, 1);
00264     }
00265     else if(color == kNormal)
00266     {
00267         oldFormat.dwMask = CFM_COLOR | CFM_BOLD | CFM_ITALIC | CFE_UNDERLINE;
00268         view->OutColor(oldFormat);
00269     }
00270     else
00271         view->OutColor(color);
00272 #endif /* WIN32 */
00273 #ifdef qMacCvsPP
00274     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00275     if(log == 0L)
00276         return *this;
00277
00278     if(color == kNL)
00279     {
00280         char tmp[1] = {0x0d};
00281         log->OutColor(tmp, 1);
00282     }
00283     else
00284         log->OutColor(color);
00285 #endif /* qMacCvsPP */
00286 #ifdef qUnix
00287     UCvsConsole *log = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00288     if(log == 0L)
00289         return *this;
00290
00291     if(color == kNL)
00292     {
00293         char tmp[1] = {0x0a};
00294         log->OutColor(tmp, 1);
00295     }
00296     else
00297         log->OutColor(color);
00298 #endif /* qUnix */
00299
00300     return *this;
00301 }
00302
00303 CColorConsole & CColorConsole::operator<<(const char *str)
00304 {
00305 #ifdef WIN32
00306     CWincvsView *view = GetView();
00307     if(view == 0L)
00308         return *this;
00309
00310     view->OutColor(str, strlen(str));
00311 #endif /* WIN32 */
00312 #ifdef qMacCvsPP
00313     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00314     if(log == 0L)
00315         return *this;
00316
00317     log->OutColor(str, strlen(str));
00318 #endif /* qMacCvsPP */
00319 #ifdef qUnix
00320     UCvsConsole *log = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00321     if(log == 0L)
00322         return *this;
00323
00324     log->OutColor(str, strlen(str));
00325 #endif /* qUnix */
00326
00327     return *this;
00328 }
00329
00330 CColorConsole & CColorConsole::operator<<(int value)
00331 {
00332 #ifdef WIN32
00333     CWincvsView *view = GetView();
00334     if(view == 0L)
00335         return *this;
00336
00337     char tmp[20] = {'\0'};
00338     sprintf(tmp, "%d", value);
00339     view->OutColor(tmp, strlen(tmp));
00340 #endif /* WIN32 */
00341 #ifdef qMacCvsPP
00342     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00343     if(log == 0L)
00344         return *this;
00345
00346     char tmp[20] = {'\0'};
00347     sprintf(tmp, "%d", value);
00348     log->OutColor(tmp, strlen(tmp));
00349 #endif /* qMacCvsPP */
00350 #ifdef qUnix
00351     UCvsConsole *log = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00352     if(log == 0L)
00353         return *this;
00354
00355     char tmp[20] = {'\0'};
00356     sprintf(tmp, "%d", value);
00357     log->OutColor(tmp, strlen(tmp));
00358 #endif /* qUnix */
00359
00360     return *this;
00361 }
00362
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AppConsole.h Source File

common/AppConsole.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * AppConsole.h --- output to the console
00023  */
00024
00025 #ifndef APPCONSOLE_H
00026 #define APPCONSOLE_H
00027
00028 #include <stdio.h>
00029
00030 void cvs_out(const char *format, ...);
00031 void cvs_err(const char *format, ...);
00032 void cvs_outstr(const char *str, size_t len);
00033 void cvs_errstr(const char *str, size_t len);
00034
00035 typedef enum
00036 {
00037     kNormal,
00038     kBrown,
00039     kGreen,
00040     kMagenta,
00041     kRed,
00042     kBlue,
00043     kBold,
00044     kItalic,
00045     kUnderline,
00046     kNL // newline
00047 } kConsoleColor;
00048
00049 #ifdef WIN32
00050 class CWincvsView;
00051 #endif /* WIN32 */
00052
00053 class CColorConsole
00054 {
00055 public:
00056     CColorConsole();
00057     virtual ~CColorConsole();
00058
00059     CColorConsole & operator<<(char c);
00060     CColorConsole & operator<<(kConsoleColor color);
00061     CColorConsole & operator<<(const char *str);
00062     CColorConsole & operator<<(int value);
00063 protected:
00064 #ifdef WIN32
00065     CWincvsView * fView;
00066     CWincvsView * GetView();
00067     CHARFORMAT oldFormat;
00068 public:
00069     CColorConsole(CWincvsView * aview);
00070 #endif /* WIN32 */
00071 };
00072
00073 #if defined(macintosh) && !defined(qMacCvsPP)
00074     // for the mpw tools
00075 #   define cvs_out printf
00076 #   define cvs_err printf
00077 #endif /* macintosh && !qMacCvsPP */
00078
00079 #endif /* APPCONSOLE_H */
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AppGlue.cpp Source File

common/AppGlue.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * AppGlue.cpp --- glue code to access CVS services
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef macintosh
00028 #   include <TextUtils.h>
00029 #   include <Strings.h>
00030 #   include <Dialogs.h>
00031 #   include <unistd.h>
00032 #   include <errno.h>
00033 #   include <console.h>
00034 #   include <ctype.h>
00035 #   include "mktemp.h"
00036 #   include "dll_process.h"
00037 #   include "AppGlue.mac.h"
00038 #endif /* macintosh */
00039
00040 #ifdef qMacCvsPP
00041 #   include "MacCvsApp.h"
00042 #   include "LogWindow.h"
00043 #   include "MacBinEncoding.h"
00044 #   include "MacCvsAE.h"
00045 #endif /* qMacCvsPP */
00046
00047 #ifdef WIN32
00048 #   include "wincvs.h"
00049 #   include "wincvsView.h"
00050 #   include "PromptFiles.h"
00051 #   include "BrowseFileView.h"
00052 #   include <process.h>
00053 #   include <direct.h>
00054
00055 #   ifdef _DEBUG
00056 #   define new DEBUG_NEW
00057 #   undef THIS_FILE
00058     static char THIS_FILE[] = __FILE__;
00059 #   endif
00060 #endif /* WIN32 */
00061
00062 #if defined(qUnix) || defined(WIN32)
00063 #   include "cvsgui_process.h"
00064 #endif
00065
00066 #if qUnix
00067 #   include "UCvsApp.h"
00068 #   include "UCvsFiles.h"
00069 #   include <ctype.h>
00070 #endif /* qUnix */
00071
00072 #include <stdio.h>
00073 #include <stdlib.h>
00074 #include <string.h>
00075 #include <stdarg.h>
00076
00077 #ifdef HAVE_ERRNO_H
00078 #   include <errno.h>
00079 #endif
00080
00081 #ifdef HAVE_UNISTD_H
00082 #   include <unistd.h>
00083 #endif
00084
00085 #include <vector>
00086
00087 #include "Authen.h"
00088 #include "CvsPrefs.h"
00089 #include "AppGlue.h"
00090 #include "AppConsole.h"
00091 #include "GetPassword.h"
00092 #include "AskYesNo.h"
00093 #include "CvsArgs.h"
00094 #include "FileTraversal.h"
00095
00096 // overide console
00097 CCvsConsole * gConsole = 0L;
00098 static int sLastExitCode;
00099
00100 #ifdef _MSC_VER
00101 #   define CVS_EXTERN_C extern "C"
00102 #else
00103 #   define CVS_EXTERN_C
00104 #endif
00105
00106 #if qUnix || defined(WIN32)
00107 static CvsProcessCallbacks sCallTable = {
00108     glue_consoleout,
00109     glue_consoleerr,
00110     glue_getenv,
00111     glue_exit
00112 };
00113 #endif
00114
00115 CVS_EXTERN_C void glue_exit(int code)
00116 {
00117     if(!gCvsPrefs.IsTclFileRunning())
00118         cvs_out("\n*****CVS exited normally with code %d*****\n\n", code);
00119     sLastExitCode = code;
00120 }
00121
00122 CVS_EXTERN_C long glue_consoleout(char *txt, long len)
00123 {
00124     if(gConsole != 0L)
00125         return gConsole->cvs_out(txt, len);
00126
00127 #ifdef macintosh
00128     // apple event output
00129     long newlen;
00130     if((newlen = ae_consoleout(txt, len)) != -1)
00131         return newlen;
00132 #endif
00133
00134     cvs_outstr(txt, len);
00135
00136     return len;
00137 }
00138
00139 CVS_EXTERN_C long glue_consoleerr(char *txt, long len)
00140 {
00141     if(gConsole != 0L)
00142         return gConsole->cvs_err(txt, len);
00143
00144 #ifdef macintosh
00145     // apple event output
00146     long newlen;
00147     if((newlen = ae_consoleout(txt, len)) != -1)
00148         return newlen;
00149 #endif
00150
00151     cvs_errstr(txt, len);
00152
00153     return len;
00154 }
00155
00156 CVS_EXTERN_C long glue_consolein(char *txt, long len)
00157 {
00158 #ifdef macintosh
00159     // apple event input
00160     long newlen;
00161     if((newlen = ae_consolein(txt, len)) != -1)
00162         return newlen;
00163 #endif /* !macintosh */
00164
00165     return 0;
00166 }
00167
00168 #ifdef macintosh
00169 #   define isGlobalEnvVariable(name) ( \
00170         strcmp(name, "CVS_PSERVER_PORT") == 0 || \
00171         strcmp(name, "CVS_RCMD_PORT") == 0 || \
00172         strcmp(name, "CVS_SERVER") == 0 || \
00173         strcmp(name, "CVS_RSH") == 0 || \
00174         strcmp(name, "CVS_RSA_IDENTITY") == 0 || \
00175         strcmp(name, "HOME") == 0 || \
00176         strcmp(name, "ISO8859") == 0 || \
00177         strcmp(name, "IC_ON_TXT") == 0 || \
00178         strcmp(name, "MAC_DEFAULT_RESOURCE_ENCODING") == 0 || \
00179         strcmp(name, "MAC_BINARY_TYPES_SINGLE") == 0 || \
00180         strcmp(name, "MAC_BINARY_TYPES_HQX") == 0 || \
00181         strcmp(name, "MAC_BINARY_TYPES_PLAIN") == 0 || \
00182         strcmp(name, "DIRTY_MCP") == 0 \
00183         )
00184 #endif /* macintosh */
00185
00186 CVS_EXTERN_C const char *glue_getenv(char *name)
00187 {
00188     if(name == NULL)
00189         return NULL;
00190
00191 #ifdef WIN32
00192     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00193     if(::GetCurrentThreadId() != app->m_nThreadID &&
00194         (strcmp(name, "CVS_GETPASS") == 0 || strcmp(name, "CVSLIB_YESNO") == 0 ||
00195         strcmp(name, "HOME") == 0))
00196     {
00197         // synchonize it since the thread calls and
00198         // we call some MFC objects in it (prompt
00199         // password, get path...)
00200         CCvsThreadLock threadLock;
00201
00202         return app->GetEnvMainThread(name);
00203     }
00204 #endif /* WIN32 */
00205
00206 #ifdef macintosh
00207     char *result;
00208     if((result = ae_getenv(name)) != (char *)-1)
00209     {
00210         if(result == 0L && isGlobalEnvVariable(name))
00211         {
00212             // in this case only we let continue
00213             // to get the MacCVS settings. So the CWCVS
00214             // users (or any AppleEvent user) can set
00215             // these variables in MacCVS but still can overide
00216             // them using Apple Events.
00217         }
00218         else
00219             return result;
00220     }
00221 #endif /* macintosh */
00222
00223     // new : give a chance for the new AuthenModel to react to the getenv
00224     // callback
00225     AuthenModel *curModel = AuthenModel::GetInstance(gAuthen.kind());
00226     std::vector<AuthenModel *> & allInstances = AuthenModel::GetAllInstances();
00227     std::vector<AuthenModel *>::const_iterator i;
00228
00229     if(curModel != 0L)
00230     {
00231         const char *res = curModel->OnGetEnv(name);
00232         if(res != 0L)
00233             return res;
00234     }
00235
00236     for(i = allInstances.begin(); i != allInstances.end(); ++i)
00237     {
00238         AuthenModel *model = *i;
00239
00240         if(model == curModel)
00241             continue;
00242
00243         const char *res = model->OnGetEnv(name);
00244         if(res != 0L)
00245             return res;
00246     }
00247
00248     if(strcmp(name, "USER") == 0
00249 #ifdef WIN32
00250         // I do that (and see the "STRATA_HACK" in
00251         // subr.c) because people get tired on Windows
00252         // to have to check their Windows login :
00253         // this is only for .rhosts authentication.
00254         || strcmp(name, "LOGNAME") == 0
00255 #endif /* WIN32 */
00256         )
00257     {
00258         static char user[64];
00259
00260         // extract from the cvsroot
00261         const char *ccvsroot = gCvsPrefs;
00262         ccvsroot = Authen::skiptoken(ccvsroot);
00263         char *login = strchr(ccvsroot, '@');
00264         if(login == NULL)
00265         {
00266             // for WIN32 this means the CVSROOT is local
00267 #ifdef macintosh
00268             cvs_err("MacCvs: Cannot extract login from cvsroot %s !\n", ccvsroot);
00269 #endif /* macintosh */
00270             return NULL;
00271         }
00272         int length = login - ccvsroot;
00273         memcpy(user, ccvsroot, length * sizeof(char));
00274         user[length] = '\0';
00275         return user;
00276     }
00277     else if(strcmp(name, "CVSROOT") == 0)
00278     {
00279         static CStr root;
00280
00281         // extract from the cvsroot
00282         const char *ccvsroot = gCvsPrefs;
00283         ccvsroot = Authen::skiptoken(ccvsroot);
00284         root = gAuthen.token();
00285         root << ccvsroot;
00286         return root;
00287     }
00288     else if(strcmp(name, "CVSREAD") == 0)
00289     {
00290         return gCvsPrefs.CheckoutRO() ? (char *)"1" : 0L;
00291     }
00292     else if(strncmp(name, "CVS_GETPASS", strlen("CVS_GETPASS")) == 0)
00293     {
00294         UStr str("Enter the password:");
00295         char *tmp;
00296         if((tmp = strchr(name, '=')) != 0L)
00297         {
00298             str = ++tmp;
00299         }
00300         return CompatGetPassword(str);
00301     }
00302     else if(strcmp(name, "CVSLIB_YESNO") == 0)
00303     {
00304         return (char *)AskYesNo();
00305     }
00306     else if(strcmp(name, "DIRTY_MCP") == 0)
00307     {
00308         return gCvsPrefs.DirtySupport() ? (char *)"yes" : (char *)"no";
00309     }
00310 #ifdef WIN32
00311     else if(strcmp(name, "HOME") == 0)
00312     {
00313         // prompt for home the first time
00314         if(gCvsPrefs.Home() == 0L)
00315         {
00316             char oldpath[512];
00317             getcwd(oldpath, 511);
00318             const char *chome = BrowserGetDirectory("Select your home directory :");
00319             if(chome == 0L)
00320             {
00321                 chdir(oldpath);
00322                 return 0L;
00323             }
00324
00325             gCvsPrefs.SetHome(chome);
00326             gCvsPrefs.save();
00327             chdir(oldpath);
00328         }
00329
00330         // Windows 98 doesn't like C:\/.cvspass
00331         static CStr home;
00332         home = gCvsPrefs.Home();
00333         if(home.endsWith(kPathDelimiter))
00334         {
00335             home[home.length() - 1] = '\0';
00336         }
00337
00338         return home;
00339     }
00340     else if(strcmp(name, "CVSUSEUNIXLF") == 0)
00341     {
00342         return gCvsPrefs.UnixLF() ? (char *)"1" : 0L;
00343     }
00344 #endif /*WIN32 */
00345 #ifdef macintosh
00346     else if(strcmp(name, "HOME") == 0)
00347     {
00348         FSSpec theFolder;
00349         static char thePath[256];
00350         Str255 aPath;
00351
00352         if(MacGetPrefsFolder(theFolder, aPath) != noErr)
00353         {
00354             cvs_err("Unable to locate the preferences folder !\n");
00355             return 0L;
00356         }
00357
00358         // We do not use any more the "@@@" trick. Instead
00359         // we let cvs convert it to a Unix path.
00360         //strcpy(thePath, "@@@");
00361         p2cstrcpy(thePath, aPath);
00362         return thePath;
00363     }
00364     else if(strcmp(name, "ISO8859") == 0)
00365     {
00366         static char iso[6];
00367
00368         if(gCvsPrefs.IsoConvert() == ISO8559_none)
00369             return 0L;
00370
00371         sprintf(iso, "%d", (int)gCvsPrefs.IsoConvert());
00372         return iso;
00373     }
00374     else if(strcmp(name, "IC_ON_TXT") == 0)
00375     {
00376         return gCvsPrefs.ICTextOption() ? (char *)"1" : 0L;
00377     }
00378     else if(strcmp(name, "MAC_DEFAULT_RESOURCE_ENCODING") == 0)
00379     {
00380         switch(gCvsPrefs.MacBinEncoding())
00381         {
00382             case MAC_HQX:
00383                 return (char *)"HQX";
00384                 break;
00385             case MAC_APPSINGLE:
00386                 return (char *)"AppleSingle";
00387                 break;
00388         }
00389         return 0L;
00390     }
00391 #   ifdef qMacCvsPP
00392     else if(strcmp(name, "MAC_BINARY_TYPES_SINGLE") == 0)
00393     {
00394         return (char *)MacBinMaps::GetEnvTypes(MAC_APPSINGLE);
00395     }
00396     else if(strcmp(name, "MAC_BINARY_TYPES_HQX") == 0)
00397     {
00398         return (char *)MacBinMaps::GetEnvTypes(MAC_HQX);
00399     }
00400     else if(strcmp(name, "MAC_BINARY_TYPES_PLAIN") == 0)
00401     {
00402         return (char *)MacBinMaps::GetEnvPlainTypes();
00403     }
00404 #   endif /* qMacCvsPP */
00405 #endif /* macintosh */
00406     else
00407         return getenv(name);
00408
00409     return NULL;
00410 }
00411
00412 class CAuthenSetUp
00413 {
00414 public:
00415     CAuthenSetUp()
00416     {
00417         AuthenModel *curModel = AuthenModel::GetInstance(gAuthen.kind());
00418         if(curModel != 0L)
00419             curModel->OnSetupEnv();
00420     }
00421
00422     ~CAuthenSetUp()
00423     {
00424         AuthenModel *curModel = AuthenModel::GetInstance(gAuthen.kind());
00425         if(curModel != 0L)
00426             curModel->OnRestoreEnv();
00427     }
00428 };
00429
00430 int launchCVS(const char *path, int argc, char * const *argv, CCvsConsole * console)
00431 {
00432     CAuthenSetUp setupEnv;
00433
00434     gConsole = console;
00435
00436 #ifdef macintosh
00437     CompatConnectID connID;
00438
00439     if(!loadCVS(connID))
00440         return errInternal;
00441
00442     int exitc = 0;
00443
00444     // call the main
00445     if(!CompatCallLibrary3(connID, exitc, uppMainProcInfo, "dllglue_main",
00446         dllglue_main_func, path, argc, (char **)argv))
00447     {
00448         cvs_err("Error : Cannot find symbol ""dllglue_main""\n");
00449         exitc = errInternal;
00450     }
00451
00452     unloadCVS(connID, exitc);
00453
00454     return exitc;
00455 #elif qUnix
00456     CStr cvscmd;
00457
00458     sLastExitCode = 0;
00459
00460     if(UCvsApp::gApp->IsCvsRunning())
00461     {
00462         cvs_err("Error : cvs is already running !\n");
00463         return errInternal;
00464     }
00465
00466     if(path != 0L && chdir(path) != 0)
00467     {
00468         cvs_err("Error : cannot chdir to %s (error %d)!\n", path, errno);
00469     }
00470
00471     UCvsApp::gApp->SetCvsStopping(false);
00472
00473     struct stat sb;
00474     cvscmd = UCvsApp::gApp->GetAppLibFolder();
00475     if(!cvscmd.endsWith(kPathDelimiter))
00476         cvscmd << kPathDelimiter;
00477     cvscmd << "cvs";
00478     UStr firstCmd = cvscmd;
00479     if(stat(cvscmd, &sb) == -1 || !(S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode)))
00480     {
00481         cvscmd = PACKAGE_SOURCE_DIR;
00482         CStr uppath, folder;
00483         SplitPath(cvscmd, uppath, folder);
00484         cvscmd = uppath;
00485         if(!cvscmd.endsWith(kPathDelimiter))
00486             cvscmd << kPathDelimiter;
00487         cvscmd << "cvsunix/src/cvs";
00488     }
00489
00490     if(stat(cvscmd, &sb) == -1 || !(S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode)))
00491     {
00492         cvs_err("Unable to find the cvs process in : (error %d)\n", errno);
00493         cvs_err("1) %s\n", (const char *)firstCmd);
00494         cvs_err("2) %s\n", (const char *)cvscmd);
00495     }
00496
00497     CvsProcess *proc = cvs_process_open(cvscmd, argc - 1, (char **)argv + 1, &sCallTable, false, 0L);
00498     if(proc == 0L)
00499     {
00500         cvs_err("Unable to initialize the cvs process (error %d)\n", errno);
00501         cvs_err("The cvs used is : %s\n", (const char *)cvscmd);
00502     }
00503     else if(console != 0L)
00504     {
00505         while(1)
00506         {
00507             cvs_process_give_time();
00508             if(!cvs_process_is_active(proc))
00509                 break;
00510         }
00511     }
00512     else
00513     {
00514         UCvsApp::gApp->SetCvsRunning(true);
00515         UCvsApp::gCurCvs = proc;
00516     }
00517
00518     return sLastExitCode;
00519 #elif defined(WIN32)
00520     CStr cvscmd;
00521
00522     sLastExitCode = 0;
00523
00524     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00525     if(app->gCvsRunning)
00526     {
00527         cvs_err("Error : cvs is already running !\n");
00528         return -1;
00529     }
00530
00531 //Jerzy - we don't want to chdir, on windows we can use the "currentDirectory" parameter
00532 #if 0
00533     if(path != 0L && chdir(path) != 0)
00534     {
00535         cvs_err("Error : cannot chdir to %s (error %d)!\n", path, errno);
00536     }
00537 #endif
00538
00539     app->gCvsStopping = false;
00540
00541     gCvsPrefs.WhichCvs(cvscmd);
00542
00543     struct stat sb;
00544     if(stat(cvscmd, &sb) == -1 || !(S_ISREG(sb.st_mode)))
00545     {
00546         cvs_err("Unable to find the cvs process in : (error %d)\n", errno);
00547         cvs_err("1) %s\n", (const char *)cvscmd);
00548     }
00549
00550     CvsProcess *proc = cvs_process_open(cvscmd, argc - 1, (char **)argv + 1,
00551         &sCallTable, gCvsPrefs.CvsConsole(), path);
00552     if(proc == 0L)
00553     {
00554         cvs_err("Unable to initialize the cvs process (error %d)\n", errno);
00555         cvs_err("The cvs used is : %s\n", (const char *)cvscmd);
00556     }
00557     else
00558     {
00559         app->gCvsRunning = true;
00560         app->gCvsProcess = proc;
00561         if(console != 0L)
00562         {
00563             while(1)
00564             {
00565                 app->PumpMessage();
00566                 if(!cvs_process_is_active(proc))
00567                     break;
00568             }
00569         }
00570     }
00571
00572     return sLastExitCode;
00573 #endif
00574 }
00575
00576 class CStreamConsole : public CCvsConsole
00577 {
00578 public:
00579     CStreamConsole(FILE *out) : fOut(out) {}
00580
00581     virtual long cvs_out(char *txt, long len)
00582     {
00583         fwrite(txt, sizeof(char), len, fOut);
00584         return len;
00585     }
00586     virtual long cvs_err(char *txt, long len)
00587     {
00588         cvs_errstr(txt, len);
00589         return len;
00590     }
00591 protected:
00592     FILE *fOut;
00593 };
00594
00595 FILE *launchCVS(const char *dir, const CvsArgs & args, CStr & tmpFile, const char *prefix, const char *extension)
00596 {
00597     if(!MakeTmpFile(tmpFile, prefix, extension))
00598         return 0L;
00599
00600     FILE * res = fopen(tmpFile, "w+");
00601     if(res == 0L)
00602     {
00603         cvs_err("Impossible to open for write the temp file '%s' (error %d)",
00604             (const char *)tmpFile, errno);
00605         return 0L;
00606     }
00607
00608     CStreamConsole myconsole(res);
00609
00610     launchCVS(dir, args.Argc(), args.Argv(), &myconsole);
00611
00612     fseek(res, 0L, SEEK_SET);
00613
00614     return res;
00615 }
00616
00617 class CTmpFiles
00618 {
00619 public:
00620     ~CTmpFiles()
00621     {
00622         std::vector<CStr>::const_iterator i;
00623         for(i = allfiles.begin(); i != allfiles.end(); ++i)
00624         {
00625             const char *file = *i;
00626             unlink((char *)file);
00627         }
00628     }
00629
00630     inline const char *push_back(const char *file)
00631     {
00632         allfiles.push_back(file);
00633         return allfiles[allfiles.size() - 1];
00634     }
00635 protected:
00636     std::vector<CStr> allfiles;
00637 } sTmpList;
00638
00639 const char *launchCVS(const char *dir, const CvsArgs & args, const char *prefix, const char *extension)
00640 {
00641     CStr filename;
00642     FILE *file = launchCVS(dir, args, filename, prefix, extension);
00643     if(file == 0L)
00644         return 0L;
00645
00646     fclose(file);
00647     return sTmpList.push_back(filename);
00648 }
00649
00650 #ifdef WIN32
00651 void WaitForCvs(void)
00652 {
00653     // pump messages manually
00654     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00655
00656     while(1)
00657     {
00658         if(app->gCvsProcess == 0L)
00659             return;
00660
00661         if(!cvs_process_is_active(app->gCvsProcess))
00662             return;
00663
00664         Sleep(100);
00665     }
00666 }
00667 #endif
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AppGlue.h Source File

common/AppGlue.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * AppGlue.h --- glue code to access CVS services
00023  */
00024
00025 #ifndef APPGLUE_H
00026 #define APPGLUE_H
00027
00028 #include <stdio.h>
00029
00030 class CCvsConsole
00031 {
00032 public:
00033     virtual long cvs_out(char *txt, long len) = 0L;
00034     virtual long cvs_err(char *txt, long len) = 0L;
00035 };
00036
00037 #define errInternal -99
00038 #define errThreadRunning -98
00039
00040 int launchCVS(const char *path, int argc, char * const *argv,
00041     CCvsConsole * console = 0L);
00042     // return the exit() error code.
00043     // Optionally overides the default console.
00044
00045 class CvsArgs;
00046 class UStr;
00047
00048 FILE *launchCVS(const char *dir, const CvsArgs & args, UStr & tmpFile, const char *prefix = 0L,
00049                 const char *extension = 0L);
00050     // make a stream of the cvs output in a temporary file.
00051
00052 const char *launchCVS(const char *dir, const CvsArgs & args, const char *prefix = 0L,
00053                       const char *extension = 0L);
00054     // put the cvs output in a temp file (the temp file is automatically
00055     // removed when quitting)
00056
00057 // hooks for cvs
00058 extern "C" {
00059     extern long glue_consoleout(char *txt, long len);
00060     extern long glue_consoleerr(char *txt, long len);
00061     extern long glue_consolein(char *txt, long len);
00062     extern const char *glue_getenv(char *name);
00063     extern void glue_exit(int code);
00064 }
00065
00066 extern CCvsConsole *gConsole;
00067     // console is which the currebt cvs process write
00068
00069 #ifdef WIN32
00070     void WaitForCvs(void);
00071         // wait for the cvs thread to terminate
00072 #else
00073 #   define WaitForCvs()
00074 #endif
00075
00076 #endif /* APPGLUE_H */
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AppGlue.mac.cpp Source File

common/AppGlue.mac.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * AppGlue.mac.cpp --- glue code to access CVS shared library
00023  */
00024
00025 #include "stdafx.h"
00026 #include "AppGlue.mac.h"
00027 #include "AppGlue.h"
00028 #include "MacCvsApp.h"
00029 #include "AppConsole.h"
00030 #include "dll_process.h"
00031 #include "GUSIMSLSetup.h"
00032 #include "FileTraversal.h"
00033
00034 int glue_eventdispatcher(EventRecord *ev)
00035 {
00036     if(CMacCvsApp::app == 0L || !(CMacCvsApp::app->cvsLoaded || TraversalReport::gRunning))
00037         return 0;
00038
00039     EventRecord localEvent;
00040     if (!ev) {
00041         //  Spin callback
00042         UInt32  kSpinSleep = TraversalReport::gRunning ? CMacCvsApp::app->GetSleepTime() : 6;
00043             // for CWCVS, we want to go fast on background. But for a traversal operation,
00044             // we want to be smooth
00045         static  UInt32  spinTicks = 0;
00046         if ((::TickCount () - spinTicks) < kSpinSleep)
00047             return 0;
00048
00049         ev = &localEvent;
00050         ::WaitNextEvent (everyEvent, ev, kSpinSleep, nil);
00051         spinTicks = ::TickCount ();
00052     } // if
00053
00054     if(ev->what == mouseDown)
00055     {
00056         WindowPtr macWindowP;
00057         SInt16 thePart = ::FindWindow(ev->where, &macWindowP);
00058         switch (thePart)
00059         {
00060             case inDrag:
00061             case inGrow:
00062             case inZoomIn:
00063             case inZoomOut:
00064                 CMacCvsApp::app->DispatchEvent(*ev);
00065                 break;
00066             case inContent:
00067                 if (macWindowP != ::FrontWindow())
00068                 {
00069                     // Clicked Window is not the front one
00070                     LWindow *frontW = LWindow::FetchWindowObject(macWindowP);
00071                     if (frontW != nil && !UDesktop::WindowIsSelected(frontW))
00072                         CMacCvsApp::app->DispatchEvent(*ev);
00073                 }
00074                 break;
00075         }
00076         return 0;
00077     }
00078     else if(ev->what == nullEvent)
00079     {
00080         CMacCvsApp::app->DoSpinCursor();
00081     }
00082     else if(ev->what != keyDown && ev->what != keyUp && ev->what != mouseUp)
00083     {
00084         CMacCvsApp::app->DispatchEvent(*ev);
00085     }
00086     return 0;
00087 }
00088
00089 bool loadCVS(CompatConnectID & connID)
00090 {
00091     int result = 0;
00092     const char *name_dll2;
00093
00094     // restore it in case it was not restored correctly by lsh
00095     GusiMSLSetWriteConsole(GUSIMSL_WriteConsoleHook);
00096     GusiMSLSetErrConsole(GUSIMSL_WriteErrHook);
00097     GusiMSLSetHandleEvent(GUSIMSL_HandleEventHook);
00098
00099     // get cvs shared library
00100 #if qCarbon
00101 #   if qCvsDebug
00102         name_dll2 = "cvsXDbgLib";
00103 #   else
00104         name_dll2 = "cvsXLib";
00105 #   endif
00106 #else
00107 #   if qCvsDebug
00108         name_dll2 = "cvs2DbgLib";
00109 #   else
00110         name_dll2 = "cvs2Lib";
00111 #   endif
00112 #endif
00113
00114     // open the library
00115     if(!CompatLoadLibrary(&connID, name_dll2))
00116     {
00117         cvs_err("Error: Unable to load the library %s\n", name_dll2);
00118         return false;
00119     }
00120
00121     // set the console out
00122     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setconsoleout",
00123         dllglue_setglue_func, CompatFuncArg(uppConsoleOutProcInfo, glue_consoleout)))
00124     {
00125         cvs_err("Error : Cannot find symbol ""dllglue_setconsoleout""\n");
00126         goto closeandfail;
00127     }
00128
00129     // set the console err
00130     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setconsoleerr",
00131         dllglue_setglue_func, CompatFuncArg(uppConsoleOutProcInfo, glue_consoleerr)))
00132     {
00133         cvs_err("Error : Cannot find symbol ""dllglue_setconsoleerr""\n");
00134         goto closeandfail;
00135     }
00136
00137     // set the console in
00138     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setconsolein",
00139         dllglue_setglue_func, CompatFuncArg(uppConsoleInProcInfo, glue_consolein)))
00140     {
00141         cvs_err("Error : Cannot find symbol ""dllglue_setconsolein""\n");
00142         goto closeandfail;
00143     }
00144
00145     // set the getenv
00146     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_setgetenv",
00147         dllglue_setglue_func, CompatFuncArg(uppGetEnvProcInfo, glue_getenv)))
00148     {
00149         cvs_err("Error : Cannot find symbol ""dllglue_setgetenv""\n");
00150         goto closeandfail;
00151     }
00152
00153     // set the event dispatcher
00154     if(!CompatCallLibrary1(connID, result, uppSetGlueProcInfo, "dllglue_seteventdispatch",
00155         dllglue_setglue_func, CompatFuncArg(uppEventDispatchProcInfo, glue_eventdispatcher)))
00156     {
00157         cvs_err("Error : Cannot find symbol ""dllglue_seteventdispatch""\n");
00158         goto closeandfail;
00159     }
00160
00161     CMacCvsApp::app->cvsLoaded = true;
00162
00163     return true;
00164
00165 closeandfail:
00166     CompatCloseLibrary(&connID);
00167     return false;
00168 }
00169
00170 void unloadCVS(CompatConnectID connID, int exitc)
00171 {
00172     // restore it in case it was not restored correctly by lsh
00173     GusiMSLSetWriteConsole(GUSIMSL_WriteConsoleHook);
00174     GusiMSLSetErrConsole(GUSIMSL_WriteErrHook);
00175     GusiMSLSetHandleEvent(GUSIMSL_HandleEventHook);
00176
00177     CompatCloseLibrary(&connID);
00178
00179     glue_exit(exitc);
00180
00181     CMacCvsApp::app->cvsLoaded = false;
00182     CMacCvsApp::app->RefreshBrowsers();
00183 }
00184
00185 int decodeCVS(char* path)
00186 {
00187     gConsole = 0;
00188
00189     CompatConnectID connID;
00190
00191     if(!loadCVS(connID))
00192         return errInternal;
00193
00194     int exitc = 0;
00195
00196     // call the main
00197     if(!CompatCallLibrary1(connID, exitc, uppDecodeFileProcInfo, "dllglue_decode_file",
00198         dllglue_decode_file_func, path))
00199     {
00200         cvs_err("Error : Cannot find symbol ""dllglue_decode_file""\n");
00201         exitc = errInternal;
00202     }
00203
00204     unloadCVS(connID, exitc);
00205
00206     return exitc;
00207 }
00208
00209 long GUSIMSL_WriteConsoleHook(char *buffer, long n)
00210 {
00211     return glue_consoleout(buffer, n);
00212 }
00213 long GUSIMSL_WriteErrHook(char *buffer, long n)
00214 {
00215     return glue_consoleerr(buffer, n);
00216 }
00217 int GUSIMSL_HandleEventHook(EventRecord *ev)
00218 {
00219     return glue_eventdispatcher(ev);
00220 }
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AppGlue.mac.h Source File

common/AppGlue.mac.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * AppGlue.mac.h --- glue code to access CVS shared library
00023  */
00024
00025 #ifndef APPGLUEMAC_H
00026 #define APPGLUEMAC_H
00027
00028 #include "dll_loader.h"
00029
00030 extern "C"
00031 {
00032     long GUSIMSL_WriteConsoleHook(char *buffer, long n);
00033     long GUSIMSL_WriteErrHook(char *buffer, long n);
00034     int GUSIMSL_HandleEventHook(EventRecord *ev);
00035 }
00036
00037 extern "C" int glue_eventdispatcher(EventRecord *ev);
00038
00039 bool loadCVS(CompatConnectID & connID);
00040 void unloadCVS(CompatConnectID connID, int exitc);
00041 int decodeCVS(char* path);
00042
00043 #endif /* APPGLUEMAC_H */
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AskYesNo.cpp Source File

common/AskYesNo.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 // AskYesNo.cpp : ask yes or no !
00022
00023 #include "stdafx.h"
00024
00025 #ifdef WIN32
00026 #   include "resource.h"
00027 #endif /* WIN32 */
00028
00029 #ifdef qUnix
00030 #   include "CvsAlert.h"
00031 #endif /* qUnix */
00032
00033 #ifdef qMacCvsPP
00034 #   include <UModalDialogs.h>
00035
00036 #   include "MacCvsApp.h"
00037 #   include "MacCvsConstant.h"
00038 #endif /* qMacCvsPP */
00039
00040 #include "AskYesNo.h"
00041 #include "uwidget.h"
00042
00043 #ifdef _DEBUG
00044 #define new DEBUG_NEW
00045 #undef THIS_FILE
00046 static char THIS_FILE[] = __FILE__;
00047 #endif
00048
00049 #ifdef WIN32
00050
00051 // CAskYesNo dialog
00052
00053
00054 CAskYesNo::CAskYesNo(CWnd* pParent /*=NULL*/)
00055     : CDialog(CAskYesNo::IDD, pParent)
00056 {
00057     //{{AFX_DATA_INIT(CAskYesNo)
00058     //}}AFX_DATA_INIT
00059 }
00060
00061
00062 void CAskYesNo::DoDataExchange(CDataExchange* pDX)
00063 {
00064     CDialog::DoDataExchange(pDX);
00065     //{{AFX_DATA_MAP(CAskYesNo)
00066     //}}AFX_DATA_MAP
00067 }
00068
00069
00070 BEGIN_MESSAGE_MAP(CAskYesNo, CDialog)
00071     //{{AFX_MSG_MAP(CAskYesNo)
00072         // NOTE: the ClassWizard will add message map macros here
00073     //}}AFX_MSG_MAP
00074 END_MESSAGE_MAP()
00075
00077 // CAskYesNo message handlers
00078 #endif /* WIN32 */
00079
00080 const char *AskYesNo(void)
00081 {
00082 #ifdef WIN32
00083     CAskYesNo gp;
00084     return gp.DoModal() == IDOK ? "yes" : "no";
00085 #endif /* WIN32 */
00086 #ifdef qMacCvsPP
00087     if(!CMacCvsApp::app->IsFrontProcess() && CMacCvsApp::app->NotifyUser(0L))
00088     {
00089         while(!CMacCvsApp::app->IsFrontProcess())
00090         {
00091             CMacCvsApp::app->SpendSomeTime();
00092         }
00093     }
00094
00095     StDialogHandler theHandler(dlg_YesNo, LCommander::GetTopCommander());
00096     LWindow *theDialog = theHandler.GetDialog();
00097     ThrowIfNil_(theDialog);
00098
00099     theDialog->Show();
00100     MessageT hitMessage;
00101     while (true)
00102     {       // Let DialogHandler process events
00103         hitMessage = theHandler.DoDialog();
00104
00105         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00106             break;
00107     }
00108     theDialog->Hide();
00109
00110     return hitMessage == msg_OK ? "yes" : "no";
00111 #endif /* qMacCvsPP */
00112 #ifdef qUnix
00113     return CvsAlert("cvs is requiring you to answer yes or no (see the console for details)", "No", "Yes") ?
00114         "no" : "yes";
00115 #endif /* qUnix */
00116 }
00117
00118 class UPromptMessage : public UWidget
00119 {
00120     UDECLARE_DYNAMIC(UPromptMessage)
00121 public:
00122     UPromptMessage(const char *msg, const char *title, const char *def,
00123         const char *cncl) : UWidget(UEventGetWidID()), m_msg(msg), m_title(title),
00124         m_ok(def), m_cncl(cncl)
00125     {
00126     }
00127
00128     virtual ~UPromptMessage() {}
00129
00130     enum
00131     {
00132         kOK = EV_COMMAND_START, // 0
00133         kCancel,                // 1
00134         kMsg                    // 2
00135     };
00136
00137     virtual void DoDataExchange(bool fill)
00138     {
00139         if(fill)
00140         {
00141             UEventSendMessage(GetWidID(), EV_SETTEXT, kOK, (void *)m_ok.c_str());
00142             UEventSendMessage(GetWidID(), EV_SETTEXT, kUMainWidget, (void *)m_title.c_str());
00143             UEventSendMessage(GetWidID(), EV_SETTEXT, kCancel, (void *)m_cncl.c_str());
00144             UEventSendMessage(GetWidID(), EV_SETTEXT, kMsg, (void *)m_msg.c_str());
00145         }
00146         else
00147         {
00148         }
00149     }
00150
00151 protected:
00152     UStr m_msg, m_title, m_ok, m_cncl;
00153
00154     ev_msg int OnOK(void);
00155     ev_msg int OnCancel(void);
00156
00157     UDECLARE_MESSAGE_MAP()
00158 };
00159
00160 UIMPLEMENT_DYNAMIC(UPromptMessage, UWidget)
00161
00162 UBEGIN_MESSAGE_MAP(UPromptMessage, UWidget)
00163     ON_UCOMMAND(kOK, UPromptMessage::OnOK)
00164     ON_UCOMMAND(kCancel, UPromptMessage::OnCancel)
00165 UEND_MESSAGE_MAP()
00166
00167 int UPromptMessage::OnOK(void)
00168 {
00169     EndModal(true);
00170     return 0;
00171 }
00172
00173 int UPromptMessage::OnCancel(void)
00174 {
00175     EndModal(false);
00176     return 0;
00177 }
00178
00179 bool PromptMessage(const char *msg, const char *title, const char *def, const char *cncl)
00180 {
00181     std::auto_ptr<UPromptMessage> dlg(new UPromptMessage(msg, title, def, cncl));
00182     bool res = false;
00183
00184 #ifdef WIN32
00185     res = dlg->DoModal(IDD_PROMPTMESSAGE);
00186 #endif
00187 #ifdef qMacCvsPP
00188     res = dlg->DoModal(dlg_PromptCommand);
00189 #endif
00190
00191     return res;
00192 }
00193
00194 class UEditMessage : public UPromptMessage
00195 {
00196     UDECLARE_DYNAMIC(UEditMessage)
00197 public:
00198     UEditMessage(const char *msg, const char *edit, const char *title, const char *def,
00199         const char *cncl) : m_edit(edit), UPromptMessage(msg, title, def, cncl)
00200     {
00201     }
00202
00203     virtual ~UEditMessage() {}
00204
00205     enum
00206     {
00207         kOK = EV_COMMAND_START, // 0
00208         kCancel,                // 1
00209         kMsg,                   // 2
00210         kEdit                   // 3
00211     };
00212
00213     virtual void DoDataExchange(bool fill)
00214     {
00215         UPromptMessage::DoDataExchange(fill);
00216
00217         if(fill)
00218         {
00219             UEventSendMessage(GetWidID(), EV_SETTEXT, kEdit, (void *)m_edit.c_str());
00220         }
00221         else
00222         {
00223             UEventSendMessage(GetWidID(), EV_GETTEXT, kEdit, &m_edit);
00224         }
00225     }
00226
00227     UStr m_edit;
00228
00229 protected:
00230
00231     UDECLARE_MESSAGE_MAP()
00232 };
00233
00234 UIMPLEMENT_DYNAMIC(UEditMessage, UPromptMessage)
00235
00236 UBEGIN_MESSAGE_MAP(UEditMessage, UPromptMessage)
00237 UEND_MESSAGE_MAP()
00238
00239 bool PromptEditMessage(const char *msg, UStr & edit, const char *title, const char *def, const char *cncl)
00240 {
00241     std::auto_ptr<UEditMessage> dlg(new UEditMessage(msg, edit, title, def, cncl));
00242     bool res = false;
00243
00244 #ifdef WIN32
00245     res = dlg->DoModal(IDD_EDITMESSAGE);
00246 #endif
00247 #ifdef qMacCvsPP
00248     res = dlg->DoModal(dlg_PromptEditCommand);
00249 #endif
00250
00251     if(res)
00252         edit = dlg->m_edit;
00253
00254     return res;
00255 }
Generated on Sun Oct 21 12:41:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/AskYesNo.h Source File

common/AskYesNo.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 // AskYesNo.h : ask yes or no !
00022
00023 #if !defined(AFX_ASKYESNO_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_)
00024 #define AFX_ASKYESNO_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_
00025
00026 #if _MSC_VER >= 1000
00027 #pragma once
00028 #endif // _MSC_VER >= 1000
00029
00030 class UStr;
00031
00032 const char *AskYesNo(void);
00033     // prompt for yes or no, returns "yes" or "no"
00034
00035 bool PromptMessage(const char *msg, const char *title = "Message",
00036                    const char *def = "OK", const char *cncl = "Cancel");
00037     // prompt for yes or no, returns "yes" or "no"
00038
00039 bool PromptEditMessage(const char *msg, UStr & edit, const char *title = "Message",
00040                    const char *def = "OK", const char *cncl = "Cancel");
00041     // prompt for yes or no, returns "yes" or "no" and the value of the edit
00042     // field.
00043
00044 #ifdef WIN32
00045
00046 // CAskYesNo dialog
00047
00048 class CAskYesNo : public CDialog
00049 {
00050 // Construction
00051 public:
00052     CAskYesNo(CWnd* pParent = NULL);   // standard constructor
00053
00054 // Dialog Data
00055     //{{AFX_DATA(CAskYesNo)
00056     enum { IDD = IDD_YESNO };
00057     CString m_passwd;
00058     //}}AFX_DATA
00059
00060
00061 // Overrides
00062     // ClassWizard generated virtual function overrides
00063     //{{AFX_VIRTUAL(CAskYesNo)
00064     protected:
00065     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00066     //}}AFX_VIRTUAL
00067
00068 // Implementation
00069 protected:
00070
00071     // Generated message map functions
00072     //{{AFX_MSG(CAskYesNo)
00073         // NOTE: the ClassWizard will add member functions here
00074     //}}AFX_MSG
00075     DECLARE_MESSAGE_MAP()
00076 };
00077
00078 //{{AFX_INSERT_LOCATION}}
00079 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00080 #endif /* WIN32 */
00081
00082 #endif // !defined(AFX_ASKYESNO_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/Authen.cpp Source File

common/Authen.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * Authen.cpp --- class to manage CVS authentication kind
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include <string.h>
00028 #include <ctype.h>
00029 #include <errno.h>
00030 #include "Authen.h"
00031 #include "CvsPrefs.h"
00032 #include "AppConsole.h"
00033 #include "MultiFiles.h"
00034 #include "PromptFiles.h"
00035 #include "CvsArgs.h"
00036 #include "TextBinary.h"
00037 #include "uwidget.h"
00038
00039 #include <algorithm>
00040
00041 #ifdef WIN32
00042 #   include "resource.h"
00043 #endif
00044
00045 static CPersistentT<AuthenKind> gAuthenKind("P_Authen",
00046 #ifdef macintosh
00047     rhosts,
00048 #else /* !macintosh */
00049     local,
00050 #endif /* !macintosh */
00051     kNoClass);
00052
00053 #ifdef WIN32
00054 #   ifdef _DEBUG
00055 #   define new DEBUG_NEW
00056 #   undef THIS_FILE
00057     static char THIS_FILE[] = __FILE__;
00058 #   endif
00059 #endif /* WIN32 */
00060
00061 #ifdef macintosh
00062 #define putenv(a)
00063 #endif
00064
00065 Authen gAuthen;
00066
00067 // authentication class
00068 AuthenKind Authen::kind(void)
00069 {
00070     return gAuthenKind;
00071 }
00072
00073 void Authen::setkind(AuthenKind newkind)
00074 {
00075     gAuthenKind = newkind;
00076 }
00077
00078 const char * Authen::kindstr(void)
00079 {
00080     static CStr res;
00081
00082     switch(kind())
00083     {
00084         case pserver : res = "password authentication"; break;
00085         case kserver : res = "kerberos authentication"; break;
00086         case ssh : res = "ssh authentication"; break;
00087         case local : res = "local mounted directory"; break;
00088         case ntserver : res = "NT server services"; break;
00089         default :
00090         case rhosts : res = ".rhosts authentication"; break;
00091     }
00092
00093     if(kind() == pserver && gCvsPrefs.UseProxy())
00094     {
00095         res << " using a proxy";
00096     }
00097
00098     return res;
00099 }
00100
00101 const char * Authen::token(void)
00102 {
00103     static CStr res;
00104
00105     switch(kind())
00106     {
00107         case pserver :
00108             res = ":pserver";
00109             if(gCvsPrefs.UseProxy())
00110             {
00111                 res << ";proxy=";
00112                 res << gCvsPrefs.ProxyHost();
00113                 res << ";proxyport=";
00114                 res << gCvsPrefs.ProxyPort();
00115             }
00116             res << ':';
00117             break;
00118         case kserver : res = ":kserver:"; break;
00119         case ssh : res = ":ext:"; break;
00120         case local : res = ":local:"; break;
00121         case ntserver : res = ":ntserver:"; break;
00122         default :
00123         case rhosts : res = ""; break;
00124     }
00125
00126     return res;
00127 }
00128
00129 const char * Authen::skiptoken(const char *cvsroot)
00130 {
00131     const char *secondColon;
00132     if(cvsroot[0] != ':' || (secondColon = strchr(cvsroot + 1, ':')) == NULL)
00133         return cvsroot;
00134     return secondColon + 1;
00135 }
00136
00137 const char *Authen::kindToToken(AuthenKind k)
00138 {
00139     AuthenModel *model = AuthenModel::GetInstance(k);
00140     return model->GetToken();
00141 }
00142
00143 AuthenKind Authen::tokenToKind(const char *t)
00144 {
00145     std::vector<AuthenModel *> & allInstances = AuthenModel::GetAllInstances();
00146     std::vector<AuthenModel *>::const_iterator i;
00147     for(i = allInstances.begin(); i != allInstances.end(); ++i)
00148     {
00149         AuthenModel *model = *i;
00150         if(strcmp(model->GetToken(), t) == 0)
00151             return model->GetKind();
00152     }
00153
00154     cvs_err("Unknown authentication kind '%s'\n", t);
00155     return local;
00156 }
00157
00158 short Authen::kindToNum(AuthenKind k)
00159 {
00160     std::vector<AuthenModel *> & allInstances = AuthenModel::GetAllInstances();
00161     std::vector<AuthenModel *>::const_iterator i;
00162     int cnt = 0;
00163     for(i = allInstances.begin(); i != allInstances.end(); ++i, cnt++)
00164     {
00165         AuthenModel *model = *i;
00166         if(model->GetKind() == k)
00167             return cnt;
00168     }
00169
00170     return 0;
00171 }
00172
00173 AuthenKind Authen::numToKind(short num)
00174 {
00175     std::vector<AuthenModel *> & allInstances = AuthenModel::GetAllInstances();
00176     std::vector<AuthenModel *>::const_iterator i;
00177     int cnt = 0;
00178     for(i = allInstances.begin(); i != allInstances.end(); ++i, cnt++)
00179     {
00180         AuthenModel *model = *i;
00181         if(cnt == num)
00182             return model->GetKind();
00183     }
00184
00185     return local;
00186 }
00187
00188 bool Authen::parse_cvsroot (const char *CVSroot, UStr & theMethod, UStr & theUser, UStr & theHost, UStr & thePath)
00189 {
00190     char *p;
00191     UStr copyroot(CVSroot);
00192     char *cvsroot_copy = copyroot;
00193
00194     theUser = "";
00195     theHost = "";
00196     thePath = "";
00197
00198     if (*cvsroot_copy == ':')
00199     {
00200         char *method = ++cvsroot_copy;
00201         bool have_semicolon;
00202
00203         /* Access method specified, as in
00204         * "cvs -d :pserver:user@host:/path",
00205         * "cvs -d :local:e:\path",
00206         * "cvs -d :kserver:user@host:/path", or
00207         * "cvs -d :fork:/path".
00208         * We need to get past that part of CVSroot before parsing the
00209         * rest of it.
00210         */
00211
00212         if (! (p = strchr (method, ':')))
00213             return false;
00214
00215         p = strpbrk (method, ":;#");
00216         if (p == 0L)
00217             return false;
00218
00219         have_semicolon = (*p == ';' || *p == '#');
00220         *p = '\0';
00221         cvsroot_copy = ++p;
00222
00223         theMethod = method;
00224
00225         while (have_semicolon)
00226         {
00227             /* More elaborate implementation would allow multiple
00228             semicolons, for example:
00229
00230             :server;rsh=34;command=cvs-1.6:
00231
00232             we will allow
00233             :server;port=22;proxy=www-proxy;proxyport=8080:
00234
00235             we will also allow # as well as ; as a separator to
00236             avoid having to quote the root in a shell.
00237             */
00238             /* FIXME: lots of error conditions should be better handled,
00239             e.g. garbage after the number or no valid number.
00240
00241             Would be nice to have testcases for some of these cases
00242             including the error cases.  */
00243             p = strpbrk (cvsroot_copy, ":;#");
00244             if (p == NULL)
00245                 return false;
00246
00247             /* pick up more options if we have them */
00248             have_semicolon = (*p == ';' || *p == '#');
00249             *p = '\0';
00250
00251             cvsroot_copy = ++p;
00252         }
00253     }
00254     else
00255     {
00256         theMethod = "";
00257     }
00258
00259     if (theMethod != "local")
00260     {
00261         /* Check to see if there is a username in the string. */
00262
00263         if ((p = strchr (cvsroot_copy, '@')) != NULL)
00264         {
00265             *p = '\0';
00266             theUser = cvsroot_copy;
00267             cvsroot_copy = ++p;
00268         }
00269
00270         if ((p = strchr (cvsroot_copy, ':')) != NULL)
00271         {
00272             *p = '\0';
00273             theHost = cvsroot_copy;
00274             cvsroot_copy = ++p;
00275         }
00276     }
00277
00278     thePath = cvsroot_copy;
00279
00280     return true;
00281 }
00282
00283 std::vector<AuthenModel *> * AuthenModel::m_instances = 0L;
00284
00285 AuthenModel::AuthenModel()
00286 {
00287     if(m_instances == 0L)
00288     {
00289         m_instances = new std::vector<AuthenModel *>;
00290         if(m_instances == 0L)
00291             throw std::bad_alloc();
00292     }
00293
00294     m_instances->push_back(this);
00295 }
00296
00297 AuthenModel::~AuthenModel()
00298 {
00299     std::vector<AuthenModel *>::iterator i;
00300     i = std::find(m_instances->begin(), m_instances->end(), this);
00301     if(i != m_instances->end())
00302         m_instances->erase(i);
00303
00304     if(m_instances->empty())
00305         delete m_instances;
00306 }
00307
00308 std::vector<AuthenModel *> & AuthenModel::GetAllInstances(void)
00309 {
00310     return *AuthenModel::m_instances;
00311 }
00312
00313 AuthenModel *AuthenModel::GetInstance(AuthenKind k)
00314 {
00315     std::vector<AuthenModel *> & allInstances = GetAllInstances();
00316     std::vector<AuthenModel *>::const_iterator i;
00317     for(i = allInstances.begin(); i != allInstances.end(); ++i)
00318     {
00319         AuthenModel *model = *i;
00320         if(model->GetKind() == k)
00321             return model;
00322     }
00323
00324     // default to local
00325     cvs_err("Unknown authentication kind %d\n", k);
00326     return GetInstance(local);
00327 }
00328
00329 void AuthenModel::OnSetupEnv(void)
00330 {
00331     UStr home("HOME=");
00332     home << gCvsPrefs.Home();
00333     putenv(home);
00334 }
00335
00336 void AuthenModel::OnRestoreEnv(void)
00337 {
00338     putenv("HOME=");
00339 }
00340
00341 class AuthenLocal : public AuthenModel
00342 {
00343 public :
00344     AuthenLocal() {}
00345     virtual ~AuthenLocal() {}
00346
00347     virtual AuthenKind GetKind(void) const { return local; }
00348     virtual const char *GetToken(void) const { return "local"; }
00349 };
00350
00351 #if qMacCvsPP
00352 class AuthenLSH : public AuthenModel
00353 {
00354 public :
00355     AuthenLSH() {}
00356     virtual ~AuthenLSH() {}
00357
00358     virtual AuthenKind GetKind(void) const { return ssh; }
00359     virtual const char *GetToken(void) const { return "ssh"; }
00360
00361     virtual bool HasSettings(void) const { return true; }
00362     virtual bool HasHost(void) const { return true; }
00363     virtual bool HasUser(void) const { return true; }
00364
00365     virtual void DoSettings(void);
00366     virtual void GetSettingsDesc(UStr & desc);
00367
00368     virtual char * OnGetEnv(char *env);
00369
00370     static CPersistentInt gLSHEncrypt;
00371     static CPersistentInt gLSHAuthen;
00372     static CPersistentInt gLSHCompress;
00373     static CPersistentInt gLSHPort;
00374     static CPersistentBool gLSHVerbose;
00375     static CPersistentBool gLSHTrace;
00376     static CPersistentBool gLSHDebug;
00377     static CPersistentBool gLSHKeychain;
00378     static CPersistentBool gLSHIdentity;
00379
00380 };
00381
00382 class UAuthen_LSH : public UWidget
00383 {
00384     UDECLARE_DYNAMIC(UAuthen_LSH)
00385 public:
00386     UAuthen_LSH();
00387     virtual ~UAuthen_LSH() {}
00388
00389     enum
00390     {
00391         kOK = EV_COMMAND_START, // 0
00392         kCancel,            // 1
00393         kEncryptPopup,      // 2
00394         kAuthenPopup,       // 3
00395         kCompressPopup,     // 4
00396         kCheckPort,         // 5
00397         kEditPort,          // 6
00398         kCheckVerbose,      // 7
00399         kCheckTrace,        // 8
00400         kCheckDebug,        // 9
00401         kKeychain,          // 10
00402         kSendIdentity       // 11
00403     };
00404
00405     virtual void DoDataExchange(bool fill);
00406
00407 protected:
00408
00409     ev_msg int OnCheckPort(void);
00410
00411     UDECLARE_MESSAGE_MAP()
00412 };
00413
00414 UIMPLEMENT_DYNAMIC(UAuthen_LSH, UWidget)
00415
00416 UBEGIN_MESSAGE_MAP(UAuthen_LSH, UWidget)
00417     ON_UCOMMAND(kCheckPort, UAuthen_LSH::OnCheckPort)
00418 UEND_MESSAGE_MAP()
00419
00420 UAuthen_LSH::UAuthen_LSH() : UWidget(::UEventGetWidID())
00421 {
00422 }
00423
00424 void UAuthen_LSH::DoDataExchange(bool fill)
00425 {
00426     if(fill)
00427     {
00428         UEventSendMessage(GetWidID(), EV_COMBO_SETSEL, UMAKEINT(kEncryptPopup, (int)AuthenLSH::gLSHEncrypt), 0L);
00429         UEventSendMessage(GetWidID(), EV_COMBO_SETSEL, UMAKEINT(kAuthenPopup, (int)AuthenLSH::gLSHAuthen), 0L);
00430         UEventSendMessage(GetWidID(), EV_COMBO_SETSEL, UMAKEINT(kCompressPopup, (int)AuthenLSH::gLSHCompress), 0L);
00431
00432         int port = (int)AuthenLSH::gLSHPort > 0 ? (int)AuthenLSH::gLSHPort : -1;
00433         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, port != -1), 0L);
00434         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kEditPort, port == -1 ? 0 : port), 0L);
00435         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckPort, port != -1), 0L);
00436
00437         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckVerbose, (bool)AuthenLSH::gLSHVerbose), 0L);
00438         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckTrace, (bool)AuthenLSH::gLSHTrace), 0L);
00439         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckDebug, (bool)AuthenLSH::gLSHDebug), 0L);
00440         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kKeychain, (bool)AuthenLSH::gLSHKeychain), 0L);
00441         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kSendIdentity, (bool)AuthenLSH::gLSHIdentity), 0L);
00442     }
00443     else
00444     {
00445         AuthenLSH::gLSHEncrypt = UEventSendMessage(GetWidID(), EV_COMBO_GETSEL, kEncryptPopup, 0L);
00446         AuthenLSH::gLSHAuthen = UEventSendMessage(GetWidID(), EV_COMBO_GETSEL, kAuthenPopup, 0L);
00447         AuthenLSH::gLSHCompress = UEventSendMessage(GetWidID(), EV_COMBO_GETSEL, kCompressPopup, 0L);
00448
00449         int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
00450         int value = UEventSendMessage(GetWidID(), EV_GETINTEGER, kEditPort, 0L);
00451         AuthenLSH::gLSHPort = state ? value : -1;
00452
00453         AuthenLSH::gLSHVerbose = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckVerbose, 0L) != 0;
00454         AuthenLSH::gLSHTrace = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckTrace, 0L) != 0;
00455         AuthenLSH::gLSHDebug = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDebug, 0L) != 0;
00456         AuthenLSH::gLSHKeychain = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kKeychain, 0L) != 0;
00457         AuthenLSH::gLSHIdentity = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kSendIdentity, 0L) != 0;
00458     }
00459 }
00460
00461 int UAuthen_LSH::OnCheckPort(void)
00462 {
00463     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
00464     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, state), 0L);
00465
00466     return 0;
00467 }
00468
00469 void AuthenLSH::DoSettings(void)
00470 {
00471     UAuthen_LSH *dlg = new UAuthen_LSH();
00472
00473     try
00474     {
00475         dlg->DoModal(3004);
00476     }
00477     catch(...)
00478     {
00479     }
00480
00481     delete dlg;
00482 }
00483
00484 void AuthenLSH::GetSettingsDesc(UStr & desc)
00485 {
00486     if((int)gLSHPort <= 0)
00487         desc << "Using default port";
00488     else
00489         desc << "Using port " << (int)gLSHPort;
00490
00491     if((bool)gLSHKeychain)
00492         desc << " and key chain";
00493
00494     if((bool)gLSHIdentity)
00495         desc << " and identity file";
00496 }
00497
00498 char * AuthenLSH::OnGetEnv(char *env)
00499 {
00500     if(strcmp(env, "LSH_SEND_IDENTITY") == 0)
00501     {
00502         return (bool)gLSHIdentity ? (char *)"yes" : (char *)"no";
00503     }
00504     else if(strcmp(env, "LSH_ENCRYPTION") == 0)
00505     {
00506         static char *encryptions[] =
00507         {
00508             "-call",
00509             "-c3des",
00510             "-ctwofish",
00511             "-ccast128",
00512             "-cserpent",
00513             "-crijndael",
00514             "-cblowfish",
00515             "-carcfour",
00516             "-cnone"
00517         };
00518         return encryptions[(int)gLSHEncrypt];
00519     }
00520     else if(strcmp(env, "LSH_AUTHENTICATION") == 0)
00521     {
00522         static char *authentications[] =
00523         {
00524             "",
00525             "-msha1",
00526             "-mmd5",
00527             "-mnone"
00528         };
00529         return authentications[(int)gLSHAuthen];
00530     }
00531     else if(strcmp(env, "LSH_ZLIB") == 0)
00532     {
00533         static char *zlib[] =
00534         {
00535             "",
00536             "-znone",
00537             "-zzlib"
00538         };
00539         return zlib[(int)gLSHCompress];
00540     }
00541     else if(strcmp(env, "LSH_MORE_ARGS") == 0)
00542     {
00543         static UStr res;
00544
00545         res = "";
00546         if((bool)gLSHVerbose)
00547             res << " --verbose";
00548         if((bool)gLSHTrace)
00549             res << " --trace";
00550         if((bool)gLSHDebug)
00551             res << " --debug";
00552
00553         return res;
00554     }
00555     else if(strcmp(env, "LSH_PORT") == 0)
00556     {
00557         int port = (int)gLSHPort;
00558         if(port > 0)
00559         {
00560             static char portstr[10];
00561             sprintf(portstr, "%d", port);
00562             return portstr;
00563         }
00564     }
00565
00566     return 0L;
00567 }
00568
00569 CPersistentInt AuthenLSH::gLSHEncrypt("P_LSHEncrypt", 0, kAddSettings);
00570 CPersistentInt AuthenLSH::gLSHAuthen("P_LSHAuthen", 0, kAddSettings);
00571 CPersistentInt AuthenLSH::gLSHCompress("P_LSHCompress", 2, kAddSettings);
00572 CPersistentInt AuthenLSH::gLSHPort("P_LSHPort", -1, kAddSettings);
00573 CPersistentBool AuthenLSH::gLSHVerbose("P_LSHVerbose", false, kAddSettings);
00574 CPersistentBool AuthenLSH::gLSHTrace("P_LSHTrace", false, kAddSettings);
00575 CPersistentBool AuthenLSH::gLSHDebug("P_LSHDebug", false, kAddSettings);
00576 CPersistentBool AuthenLSH::gLSHKeychain("P_LSHKeychain", false, kAddSettings);
00577 CPersistentBool AuthenLSH::gLSHIdentity("P_LSHIdentity", true, kAddSettings);
00578 #else // !qMacCvsPP
00579 class AuthenSSH : public AuthenModel
00580 {
00581 public :
00582     AuthenSSH() {}
00583     virtual ~AuthenSSH() {}
00584
00585     virtual AuthenKind GetKind(void) const { return ssh; }
00586     virtual const char *GetToken(void) const { return "ssh"; }
00587
00588     virtual bool HasSettings(void) const { return true; }
00589     virtual bool HasHost(void) const { return true; }
00590     virtual bool HasUser(void) const { return true; }
00591
00592     virtual void DoSettings(void);
00593     virtual void GetSettingsDesc(UStr & desc);
00594
00595     virtual const char * OnGetEnv(char *env);
00596
00597     virtual void OnSetupEnv(void);
00598     virtual void OnRestoreEnv(void);
00599
00600     static PCStr gSSHName;
00601     static PCStr gSSHOptions;
00602     static CPersistentBool gRsaIdentity;
00603     static CMString gRsaIdentityFile;
00604     static PCStr gCurRsaIdentity;
00605
00606     static const char * RsaIdentityFile(void);
00607 };
00608
00609 PCStr AuthenSSH::gSSHName("P_SSHName", "ssh", kAddSettings);
00610 PCStr AuthenSSH::gSSHOptions("P_SSHOptions", "", kAddSettings);
00611 CPersistentBool AuthenSSH::gRsaIdentity("P_RsaIdentity", false, kAddSettings);
00612 CMString AuthenSSH::gRsaIdentityFile(10, "P_RsaIdentityFiles");
00613 PCStr AuthenSSH::gCurRsaIdentity("P_CurrentRsaIdentity", 0L, kAddSettings);
00614
00615 const char * AuthenSSH::RsaIdentityFile(void)
00616 {
00617     if(gRsaIdentityFile.GetList().size() != 0)
00618         gCurRsaIdentity = gRsaIdentityFile.GetList()[0];
00619
00620 #ifdef WIN32
00621     // Fill in a default value, if one empty slot
00622     if( gCurRsaIdentity.empty())
00623     {
00624         char *env = getenv( "HOME" );
00625         if(env != 0L )
00626         {
00627             char default_identity_folder[] = ".ssh/identity";
00628             char default_identity[ MAX_PATH ];
00629             _makepath( default_identity, NULL, env, default_identity_folder, NULL );
00630             gCurRsaIdentity = default_identity;
00631         }
00632     }
00633 #endif
00634
00635     return gCurRsaIdentity.empty() ? 0L : (const char *)gCurRsaIdentity;
00636 }
00637
00638 class UAuthen_SSH : public UWidget
00639 {
00640     UDECLARE_DYNAMIC(UAuthen_SSH)
00641 public:
00642     UAuthen_SSH();
00643     virtual ~UAuthen_SSH() {}
00644
00645     enum
00646     {
00647         kOK = EV_COMMAND_START, // 0
00648         kCancel,            // 1
00649         kRSACheck,          // 2
00650         kRSAEdit,           // 3
00651         kRSABtn,            // 4
00652         kSSHCheck,          // 5
00653         kSSHName,           // 6
00654         kOptionsText,       // 7
00655         kOptionsCheck,      // 8
00656         kOptionsEdit,       // 9
00657         kSSHBtn,            // 10
00658     };
00659
00660     virtual void DoDataExchange(bool fill);
00661
00662 protected:
00663     bool m_rsaidentity;
00664     UStr m_rsaidentityfile;
00665     UStr m_options;
00666
00667     ev_msg int OnCheckRSA(void);
00668     ev_msg int OnBtnRSA(void);
00669     ev_msg int OnCheckName(void);
00670     ev_msg int OnBtnName(void);
00671     ev_msg int OnCheckOptions(void);
00672
00673     UDECLARE_MESSAGE_MAP()
00674 };
00675
00676 UIMPLEMENT_DYNAMIC(UAuthen_SSH, UWidget)
00677
00678 UBEGIN_MESSAGE_MAP(UAuthen_SSH, UWidget)
00679     ON_UCOMMAND(kRSACheck, UAuthen_SSH::OnCheckRSA)
00680     ON_UCOMMAND(kRSABtn, UAuthen_SSH::OnBtnRSA)
00681     ON_UCOMMAND(kSSHCheck, UAuthen_SSH::OnCheckName)
00682     ON_UCOMMAND(kSSHBtn, UAuthen_SSH::OnBtnName)
00683     ON_UCOMMAND(kOptionsCheck, UAuthen_SSH::OnCheckOptions)
00684 UEND_MESSAGE_MAP()
00685
00686 UAuthen_SSH::UAuthen_SSH() : UWidget(::UEventGetWidID())
00687 {
00688 }
00689
00690 int UAuthen_SSH::OnCheckRSA(void)
00691 {
00692     m_rsaidentity = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kRSACheck, 0L) != 0;
00693     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kRSAEdit, m_rsaidentity), 0L);
00694     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kRSABtn, m_rsaidentity), 0L);
00695
00696     return 0;
00697 }
00698
00699 int UAuthen_SSH::OnCheckName(void)
00700 {
00701     bool state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kSSHCheck, 0L) != 0;
00702     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kSSHName, state), 0L);
00703     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kSSHBtn, state), 0L);
00704
00705     return 0;
00706 }
00707
00708 int UAuthen_SSH::OnCheckOptions(void)
00709 {
00710     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kOptionsCheck, 0L);
00711     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kOptionsEdit, state), 0L);
00712     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kOptionsText, state), 0L);
00713
00714     return 0;
00715 }
00716
00717 int UAuthen_SSH::OnBtnRSA(void)
00718 {
00719     MultiFiles mf;
00720     if(!BrowserGetMultiFiles("Select a RSA identity :", mf))
00721         return 0;
00722
00723     CvsArgs args(false);
00724     mf.next();
00725     const char *dir = mf.add(args);
00726     char * const *argv = args.Argv();
00727     UStr fullpath;
00728     fullpath = dir;
00729     if(!fullpath.endsWith(kPathDelimiter))
00730         fullpath << kPathDelimiter;
00731     fullpath << argv[0];
00732
00733     UEventSendMessage(GetWidID(), EV_SETTEXT, kRSAEdit, (void *)fullpath.c_str());
00734
00735     return 0;
00736 }
00737
00738 int UAuthen_SSH::OnBtnName(void)
00739 {
00740     MultiFiles mf;
00741 #ifdef WIN32
00742     if(!BrowserGetMultiFiles("Select SSH :", mf, "Executable Files (*.exe)|*.exe|All Files (*.*)|*.*||"))
00743         return 0;
00744 #else
00745     if(!BrowserGetMultiFiles("Select SSH :", mf))
00746         return 0;
00747 #endif
00748
00749     CvsArgs args(false);
00750     mf.next();
00751     const char *dir = mf.add(args);
00752     char * const *argv = args.Argv();
00753     UStr fullpath;
00754     fullpath = dir;
00755     if(!fullpath.endsWith(kPathDelimiter))
00756         fullpath << kPathDelimiter;
00757     fullpath << argv[0];
00758
00759     UEventSendMessage(GetWidID(), EV_SETTEXT, kSSHName, (void *)fullpath.c_str());
00760
00761     return 0;
00762 }
00763
00764 void UAuthen_SSH::DoDataExchange(bool fill)
00765 {
00766     if(fill)
00767     {
00768         m_rsaidentity = AuthenSSH::gRsaIdentity;
00769         m_rsaidentityfile = AuthenSSH::RsaIdentityFile();
00770         UStr helpMsg = "* Some Cygwin/OpenSSH options :\n"
00771             "-v : Verbose mode\n"
00772             "-C : Request compression\n"
00773             "-1 : Forces ssh to try protocol version 1 only\n"
00774             "-2 : Forces ssh to try protocol version 2 only\n"
00775             "-4 : Forces ssh to try protocol version 2 only\n"
00776             "-6 : Forces ssh to use IPv6 addresses only";
00777
00778         UEventSendMessage(GetWidID(), EV_SETTEXT, kOptionsText, (void *)helpMsg.c_str());
00779
00780         UEventSendMessage(GetWidID(), EV_COMBO_RESETALL, kRSAEdit, 0L);
00781         const CMString::list_t & rsastrings = AuthenSSH::gRsaIdentityFile.GetList();
00782         CMString::list_t::const_iterator i;
00783         for(i = rsastrings.begin(); i != rsastrings.end(); ++i)
00784         {
00785             UEventSendMessage(GetWidID(), EV_COMBO_APPEND, kRSAEdit,
00786                 (void *)(const char *)*i);
00787         }
00788
00789         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kRSACheck, m_rsaidentity), 0L);
00790         UEventSendMessage(GetWidID(), EV_SETTEXT, kRSAEdit, (void *)m_rsaidentityfile.c_str());
00791
00792         if(!AuthenSSH::gSSHName.empty())
00793         {
00794             UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kSSHCheck, 1), 0L);
00795             UEventSendMessage(GetWidID(), EV_SETTEXT, kSSHName, (void *)AuthenSSH::gSSHName.c_str());
00796         }
00797
00798         if(!AuthenSSH::gSSHOptions.empty())
00799         {
00800             UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kOptionsCheck, 1), 0L);
00801             UEventSendMessage(GetWidID(), EV_SETTEXT, kOptionsEdit, (void *)AuthenSSH::gSSHOptions.c_str());
00802         }
00803
00804         OnCheckRSA();
00805         OnCheckName();
00806         OnCheckOptions();
00807     }
00808     else
00809     {
00810         AuthenSSH::gRsaIdentity = m_rsaidentity;
00811         if(m_rsaidentity)
00812         {
00813             UEventSendMessage(GetWidID(), EV_GETTEXT, kRSAEdit, &m_rsaidentityfile);
00814             AuthenSSH::gRsaIdentityFile.Insert(m_rsaidentityfile);
00815             AuthenSSH::gCurRsaIdentity = m_rsaidentityfile;
00816         }
00817
00818         if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kSSHCheck, 0L))
00819             UEventSendMessage(GetWidID(), EV_GETTEXT, kSSHName, &AuthenSSH::gSSHName);
00820         else
00821             AuthenSSH::gSSHName = "";
00822
00823         if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kOptionsCheck, 0L))
00824             UEventSendMessage(GetWidID(), EV_GETTEXT, kOptionsEdit, &AuthenSSH::gSSHOptions);
00825         else
00826             AuthenSSH::gSSHOptions = "";
00827     }
00828 }
00829
00830 void AuthenSSH::DoSettings(void)
00831 {
00832     UAuthen_SSH *dlg = new UAuthen_SSH();
00833
00834     try
00835     {
00836 #ifdef WIN32
00837         dlg->DoModal(IDD_SSH);
00838 #endif
00839     }
00840     catch(...)
00841     {
00842     }
00843
00844     delete dlg;
00845 }
00846
00847 void AuthenSSH::GetSettingsDesc(UStr & desc)
00848 {
00849     if(!gSSHOptions.empty())
00850     {
00851         desc << "Using ";
00852         desc << gSSHOptions.c_str();
00853         desc << " ";
00854     }
00855
00856     if((bool)gRsaIdentity)
00857     {
00858         if(gSSHOptions.empty())
00859             desc << "Using ";
00860         desc << "-i ";
00861         desc << RsaIdentityFile();
00862     }
00863 }
00864
00865 void AuthenSSH::OnSetupEnv(void)
00866 {
00867     AuthenModel::OnSetupEnv();
00868
00869     UStr rsh("CVS_RSH=");
00870     if(gSSHName.empty())
00871         rsh << "ssh";
00872     else
00873         rsh << gSSHName.c_str();
00874
00875     putenv(rsh);
00876
00877     UStr options("CVS_RSA_OPTIONS=");
00878     if(!gSSHOptions.empty())
00879     {
00880         options << gSSHOptions.c_str();
00881         putenv(options);
00882     }
00883
00884     UStr identity("CVS_RSA_IDENTITY=");
00885     if((bool)gRsaIdentity)
00886     {
00887         identity << RsaIdentityFile();
00888         putenv(identity);
00889     }
00890 }
00891
00892 void AuthenSSH::OnRestoreEnv(void)
00893 {
00894     AuthenModel::OnRestoreEnv();
00895
00896     putenv("CVS_RSH=");
00897     putenv("CVS_RSA_OPTIONS=");
00898     putenv("CVS_RSA_IDENTITY=");
00899 }
00900
00901 const char * AuthenSSH::OnGetEnv(char *env)
00902 {
00903     if(strcmp(env, "CVS_RSH") == 0)
00904     {
00905         return gSSHName.empty() ? "ssh" : (char *)gSSHName.c_str();
00906     }
00907     else if( strcmp(env, "CVS_RSA_OPTIONS") == 0)
00908     {
00909         return gSSHOptions.empty() ? 0L : (char *)gSSHOptions.c_str();
00910     }
00911     else if( strcmp(env, "CVS_RSA_IDENTITY") == 0 && (bool)gRsaIdentity)
00912     {
00913         const char *tmp = RsaIdentityFile();
00914         if( tmp && *tmp )
00915         {
00916 #ifdef WIN32
00917             while( *tmp && iswspace( *tmp ) )
00918 #else
00919             while( *tmp && isspace( *tmp ) )
00920 #endif
00921                 tmp++;
00922
00923             return *tmp ? (char *)tmp : 0L;
00924         }
00925         return 0L;
00926     }
00927     return 0L;
00928 }
00929 #endif // qMacCvsPP
00930
00931 bool CvsPrefs::UseKeyChain(void) const
00932 {
00933 #if qMacCvsPP
00934     return (bool)AuthenLSH::gLSHKeychain;
00935 #else
00936     return false;
00937 #endif
00938 }
00939
00940 class AuthenPserver : public AuthenModel
00941 {
00942 public :
00943     AuthenPserver() {}
00944     virtual ~AuthenPserver() {}
00945
00946     virtual AuthenKind GetKind(void) const { return pserver; }
00947     virtual const char *GetToken(void) const { return "pserver"; }
00948
00949     virtual bool HasSettings(void) const { return true; }
00950     virtual bool HasHost(void) const { return true; }
00951     virtual bool HasUser(void) const { return true; }
00952
00953     virtual void DoSettings(void);
00954     virtual void GetSettingsDesc(UStr & desc);
00955
00956     virtual const char * OnGetEnv(char *env);
00957
00958     virtual void OnSetupEnv(void);
00959     virtual void OnRestoreEnv(void);
00960 };
00961
00962 class UAuthen_Pserver : public UWidget
00963 {
00964     UDECLARE_DYNAMIC(UAuthen_Pserver)
00965 public:
00966     UAuthen_Pserver();
00967     virtual ~UAuthen_Pserver() {}
00968
00969     enum
00970     {
00971         kOK = EV_COMMAND_START, // 0
00972         kCancel,            // 1
00973         kCheckPort,         // 2
00974         kEditPort,          // 3
00975         kCheckProxy,        // 4
00976         kNameProxy,         // 5
00977         kEditProxy          // 6
00978     };
00979
00980     virtual void DoDataExchange(bool fill);
00981
00982 protected:
00983     int m_port;
00984     int m_pport;
00985     UStr m_pname;
00986
00987     ev_msg int OnCheckPort(void);
00988     ev_msg int OnCheckProxy(void);
00989
00990     UDECLARE_MESSAGE_MAP()
00991 };
00992
00993 UIMPLEMENT_DYNAMIC(UAuthen_Pserver, UWidget)
00994
00995 UBEGIN_MESSAGE_MAP(UAuthen_Pserver, UWidget)
00996     ON_UCOMMAND(kCheckPort, UAuthen_Pserver::OnCheckPort)
00997     ON_UCOMMAND(kCheckProxy,  UAuthen_Pserver::OnCheckProxy)
00998 UEND_MESSAGE_MAP()
00999
01000 UAuthen_Pserver::UAuthen_Pserver() : UWidget(::UEventGetWidID())
01001 {
01002 }
01003
01004 int UAuthen_Pserver::OnCheckPort(void)
01005 {
01006     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01007     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, state), 0L);
01008
01009     return 0;
01010 }
01011
01012 int UAuthen_Pserver::OnCheckProxy(void)
01013 {
01014     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckProxy, 0L);
01015     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kNameProxy, state), 0L);
01016     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditProxy, state), 0L);
01017
01018     return 0;
01019 }
01020
01021 void UAuthen_Pserver::DoDataExchange(bool fill)
01022 {
01023     if(fill)
01024     {
01025         m_port = gCvsPrefs.PserverPort();
01026
01027         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, m_port != -1), 0L);
01028         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kEditPort, m_port == -1 ? 2401 : m_port), 0L);
01029         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckPort, m_port != -1), 0L);
01030
01031         m_pport = gCvsPrefs.ProxyPort();
01032         m_pname = gCvsPrefs.ProxyHost();
01033         bool useProxy = gCvsPrefs.UseProxy();
01034         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditProxy, useProxy), 0L);
01035         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kNameProxy, useProxy), 0L);
01036         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kEditProxy, m_pport), 0L);
01037         UEventSendMessage(GetWidID(), EV_SETTEXT, kNameProxy, (void *)(const char *)m_pname);
01038         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckProxy, useProxy), 0L);
01039     }
01040     else
01041     {
01042         int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01043         int value = UEventSendMessage(GetWidID(), EV_GETINTEGER, kEditPort, 0L);
01044         gCvsPrefs.SetPserverPort(state ? value : -1);
01045
01046         state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckProxy, 0L);
01047         value = UEventSendMessage(GetWidID(), EV_GETINTEGER, kEditProxy, 0L);
01048         UEventSendMessage(GetWidID(), EV_GETTEXT, kNameProxy, &m_pname);
01049         gCvsPrefs.SetUseProxy(state != 0);
01050         if(state != 0)
01051         {
01052             gCvsPrefs.SetProxyHost(m_pname);
01053             gCvsPrefs.SetProxyPort(value);
01054         }
01055     }
01056 }
01057
01058 void AuthenPserver::DoSettings(void)
01059 {
01060     UAuthen_Pserver *dlg = new UAuthen_Pserver();
01061
01062     try
01063     {
01064 #if qMacCvsPP
01065         dlg->DoModal(3002);
01066 #endif
01067 #ifdef WIN32
01068         dlg->DoModal(IDD_PSERVER);
01069 #endif
01070     }
01071     catch(...)
01072     {
01073     }
01074
01075     delete dlg;
01076 }
01077
01078 void AuthenPserver::GetSettingsDesc(UStr & desc)
01079 {
01080     if(gCvsPrefs.PserverPort() == -1)
01081         desc << "Using default port and ";
01082     else
01083         desc << "Using port " << gCvsPrefs.PserverPort() << " and ";
01084
01085     if(!gCvsPrefs.UseProxy())
01086         desc << "no proxy";
01087     else
01088         desc << "using proxy host " << gCvsPrefs.ProxyHost() << " with port " << gCvsPrefs.ProxyPort();
01089 }
01090
01091 void AuthenPserver::OnSetupEnv(void)
01092 {
01093     AuthenModel::OnSetupEnv();
01094
01095     UStr options("CVS_PSERVER_PORT=");
01096     if(gCvsPrefs.PserverPort() != -1)
01097     {
01098         options << gCvsPrefs.PserverPort();
01099         putenv(options);
01100     }
01101 }
01102
01103 void AuthenPserver::OnRestoreEnv(void)
01104 {
01105     AuthenModel::OnRestoreEnv();
01106
01107     putenv("CVS_PSERVER_PORT=");
01108 }
01109
01110 const char * AuthenPserver::OnGetEnv(char *env)
01111 {
01112     if(strcmp(env, "CVS_PSERVER_PORT") == 0)
01113     {
01114         if(gCvsPrefs.PserverPort() != -1)
01115         {
01116             static char port[10];
01117             sprintf(port, "%d", gCvsPrefs.PserverPort());
01118             return port;
01119         }
01120
01121         return 0L;
01122     }
01123     return 0L;
01124 }
01125
01126 class AuthenRhosts : public AuthenModel
01127 {
01128 public :
01129     AuthenRhosts() {}
01130     virtual ~AuthenRhosts() {}
01131
01132     virtual AuthenKind GetKind(void) const { return rhosts; }
01133     virtual const char *GetToken(void) const { return "rhosts"; }
01134
01135     virtual bool HasSettings(void) const { return true; }
01136     virtual bool HasHost(void) const { return true; }
01137     virtual bool HasUser(void) const { return true; }
01138
01139     virtual void DoSettings(void);
01140     virtual void GetSettingsDesc(UStr & desc);
01141
01142     virtual const char * OnGetEnv(char *env);
01143
01144     virtual void OnSetupEnv(void);
01145     virtual void OnRestoreEnv(void);
01146 };
01147
01148 class UAuthen_Rhosts : public UWidget
01149 {
01150     UDECLARE_DYNAMIC(UAuthen_Rhosts)
01151 public:
01152     UAuthen_Rhosts();
01153     virtual ~UAuthen_Rhosts() {}
01154
01155     enum
01156     {
01157         kOK = EV_COMMAND_START, // 0
01158         kCancel,            // 1
01159         kCheckPort,         // 2
01160         kEditPort,          // 3
01161         kCheckRSHName,      // 4
01162         kEditRSHName,       // 5
01163         kCheckServerName,   // 6
01164         kEditServerName     // 7
01165     };
01166
01167     virtual void DoDataExchange(bool fill);
01168
01169 protected:
01170     int m_port;
01171     UStr m_rshname;
01172     UStr m_servername;
01173
01174     ev_msg int OnCheckPort(void);
01175     ev_msg int OnCheckRshName(void);
01176     ev_msg int OnCheckServerName(void);
01177
01178     UDECLARE_MESSAGE_MAP()
01179 };
01180
01181 UIMPLEMENT_DYNAMIC(UAuthen_Rhosts, UWidget)
01182
01183 UBEGIN_MESSAGE_MAP(UAuthen_Rhosts, UWidget)
01184     ON_UCOMMAND(kCheckPort, UAuthen_Rhosts::OnCheckPort)
01185     ON_UCOMMAND(kCheckRSHName, UAuthen_Rhosts::OnCheckRshName)
01186     ON_UCOMMAND(kCheckServerName, UAuthen_Rhosts::OnCheckServerName)
01187 UEND_MESSAGE_MAP()
01188
01189 UAuthen_Rhosts::UAuthen_Rhosts() : UWidget(::UEventGetWidID())
01190 {
01191 }
01192
01193 int UAuthen_Rhosts::OnCheckPort(void)
01194 {
01195     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01196     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, state), 0L);
01197
01198     return 0;
01199 }
01200
01201 int UAuthen_Rhosts::OnCheckRshName(void)
01202 {
01203     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRSHName, 0L);
01204     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditRSHName, state), 0L);
01205
01206     return 0;
01207 }
01208
01209 int UAuthen_Rhosts::OnCheckServerName(void)
01210 {
01211     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckServerName, 0L);
01212     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditServerName, state), 0L);
01213
01214     return 0;
01215 }
01216
01217 void UAuthen_Rhosts::DoDataExchange(bool fill)
01218 {
01219     if(fill)
01220     {
01221         m_port = gCvsPrefs.RhostPort();
01222         m_rshname = gCvsPrefs.RshName();
01223         m_servername = gCvsPrefs.ServerName();
01224
01225         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, m_port != -1), 0L);
01226         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kEditPort, m_port == -1 ? 0 : m_port), 0L);
01227         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckPort, m_port != -1), 0L);
01228
01229         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditRSHName, !m_rshname.empty()), 0L);
01230         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditRSHName, (void *)m_rshname.c_str());
01231         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRSHName, !m_rshname.empty()), 0L);
01232
01233         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditServerName, !m_servername.empty()), 0L);
01234         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditServerName, (void *)m_servername.c_str());
01235         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckServerName, !m_servername.empty()), 0L);
01236     }
01237     else
01238     {
01239         int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01240         int value = UEventSendMessage(GetWidID(), EV_GETINTEGER, kEditPort, 0L);
01241         gCvsPrefs.SetRhostPort(state ? value : -1);
01242
01243         state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRSHName, 0L);
01244         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditRSHName, &m_rshname);
01245         gCvsPrefs.SetRshName(state ? m_rshname.c_str() : "");
01246
01247         state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckServerName, 0L);
01248         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditServerName, &m_servername);
01249         gCvsPrefs.SetServerName(state ? m_servername.c_str() : "");
01250     }
01251 }
01252
01253 void AuthenRhosts::DoSettings(void)
01254 {
01255     UAuthen_Rhosts *dlg = new UAuthen_Rhosts();
01256
01257     try
01258     {
01259 #if qMacCvsPP
01260         dlg->DoModal(3001);
01261 #endif
01262 #if WIN32
01263         dlg->DoModal(IDD_RSH);
01264 #endif
01265     }
01266     catch(...)
01267     {
01268     }
01269
01270     delete dlg;
01271 }
01272
01273 void AuthenRhosts::GetSettingsDesc(UStr & desc)
01274 {
01275     if(gCvsPrefs.RhostPort() == -1)
01276         desc << "Using default port and ";
01277     else
01278         desc << "Using port " << gCvsPrefs.RhostPort() << " and ";
01279
01280     if(gCvsPrefs.RshName() == 0L)
01281         desc << "default shell name";
01282     else
01283         desc << "shell named " << gCvsPrefs.RshName();
01284 }
01285
01286 void AuthenRhosts::OnSetupEnv(void)
01287 {
01288     AuthenModel::OnSetupEnv();
01289
01290     UStr rsh("CVS_RSH=");
01291     if(gCvsPrefs.RshName() != 0L)
01292     {
01293         rsh << gCvsPrefs.RshName();
01294         putenv(rsh);
01295     }
01296
01297     UStr port("CVS_RCMD_PORT=");
01298     if(gCvsPrefs.RhostPort() != -1)
01299     {
01300         port << gCvsPrefs.RhostPort();
01301         putenv(port);
01302     }
01303
01304     UStr server("CVS_SERVER=");
01305     if(gCvsPrefs.ServerName() != 0L)
01306     {
01307         server << gCvsPrefs.ServerName();
01308         putenv(server);
01309     }
01310 }
01311
01312 void AuthenRhosts::OnRestoreEnv(void)
01313 {
01314     AuthenModel::OnRestoreEnv();
01315
01316     putenv("CVS_RSH=");
01317     putenv("CVS_RCMD_PORT=");
01318     putenv("CVS_SERVER=");
01319 }
01320
01321 const char * AuthenRhosts::OnGetEnv(char *env)
01322 {
01323     if(strcmp(env, "CVS_RSH") == 0)
01324     {
01325         return (char *)gCvsPrefs.RshName();
01326     }
01327     else if(strcmp(env, "CVS_RCMD_PORT") == 0)
01328     {
01329         if(gCvsPrefs.RhostPort() != -1)
01330         {
01331             static char port[10];
01332             sprintf(port, "%d", gCvsPrefs.RhostPort());
01333             return port;
01334         }
01335
01336         return 0L;
01337     }
01338     else if(strcmp(env, "CVS_SERVER") == 0)
01339     {
01340         return (char *)gCvsPrefs.ServerName();
01341     }
01342     return 0L;
01343 }
01344
01345 class AuthenKserver : public AuthenModel
01346 {
01347 public :
01348     AuthenKserver() {}
01349     virtual ~AuthenKserver() {}
01350
01351     virtual AuthenKind GetKind(void) const { return kserver; }
01352     virtual const char *GetToken(void) const { return "kserver"; }
01353
01354     virtual bool HasSettings(void) const { return true; }
01355     virtual bool HasHost(void) const { return true; }
01356     virtual bool HasUser(void) const { return true; }
01357
01358     virtual void DoSettings(void);
01359     virtual void GetSettingsDesc(UStr & desc);
01360
01361     virtual const char * OnGetEnv(char *env);
01362 };
01363
01364 class UAuthen_Kserver : public UWidget
01365 {
01366     UDECLARE_DYNAMIC(UAuthen_Kserver)
01367 public:
01368     UAuthen_Kserver();
01369     virtual ~UAuthen_Kserver() {}
01370
01371     enum
01372     {
01373         kOK = EV_COMMAND_START, // 0
01374         kCancel,            // 1
01375         kCheckPort,         // 2
01376         kEditPort           // 3
01377     };
01378
01379     virtual void DoDataExchange(bool fill);
01380
01381 protected:
01382     int m_port;
01383
01384     ev_msg int OnCheckPort(void);
01385
01386     UDECLARE_MESSAGE_MAP()
01387 };
01388
01389 UIMPLEMENT_DYNAMIC(UAuthen_Kserver, UWidget)
01390
01391 UBEGIN_MESSAGE_MAP(UAuthen_Kserver, UWidget)
01392     ON_UCOMMAND(kCheckPort, UAuthen_Kserver::OnCheckPort)
01393 UEND_MESSAGE_MAP()
01394
01395 UAuthen_Kserver::UAuthen_Kserver() : UWidget(::UEventGetWidID())
01396 {
01397 }
01398
01399 int UAuthen_Kserver::OnCheckPort(void)
01400 {
01401     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01402     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, state), 0L);
01403
01404     return 0;
01405 }
01406
01407 void UAuthen_Kserver::DoDataExchange(bool fill)
01408 {
01409     if(fill)
01410     {
01411         m_port = gCvsPrefs.KserverPort();
01412
01413         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, m_port != -1), 0L);
01414         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kEditPort, m_port == -1 ? 0 : m_port), 0L);
01415         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckPort, m_port != -1), 0L);
01416     }
01417     else
01418     {
01419         int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01420         int value = UEventSendMessage(GetWidID(), EV_GETINTEGER, kEditPort, 0L);
01421         gCvsPrefs.SetKserverPort(state ? value : -1);
01422     }
01423 }
01424
01425 void AuthenKserver::DoSettings(void)
01426 {
01427     UAuthen_Kserver *dlg = new UAuthen_Kserver();
01428
01429     try
01430     {
01431 #if qMacCvsPP
01432         dlg->DoModal(3003);
01433 #endif
01434     }
01435     catch(...)
01436     {
01437     }
01438
01439     delete dlg;
01440 }
01441
01442 void AuthenKserver::GetSettingsDesc(UStr & desc)
01443 {
01444     if(gCvsPrefs.KserverPort() == -1)
01445         desc << "Using default port";
01446     else
01447         desc << "Using port " << gCvsPrefs.KserverPort();
01448 }
01449
01450 const char * AuthenKserver::OnGetEnv(char *env)
01451 {
01452     return 0L;
01453 }
01454
01455 class AuthenNtserver : public AuthenModel
01456 {
01457 public :
01458     AuthenNtserver() {}
01459     virtual ~AuthenNtserver() {}
01460
01461     virtual AuthenKind GetKind(void) const { return ntserver; }
01462     virtual const char *GetToken(void) const { return "ntserver"; }
01463
01464     virtual bool HasSettings(void) const { return false; }
01465     virtual bool HasHost(void) const { return true; }
01466     virtual bool HasUser(void) const { return true; }
01467
01468     virtual const char * OnGetEnv(char *env);
01469 };
01470
01471 const char * AuthenNtserver::OnGetEnv(char *env)
01472 {
01473     return 0L;
01474 }
01475
01476 static AuthenLocal localInstance;
01477 static AuthenPserver pserverInstance;
01478 static AuthenRhosts rhostsInstance;
01479 #ifndef WIN32
01480 static AuthenKserver kserverInstance;
01481 #else
01482 static AuthenNtserver ntserverInstance;
01483 #endif
01484 #if qMacCvsPP
01485 static AuthenLSH sshInstance;
01486 #else
01487 static AuthenSSH sshInstance;
01488 #endif
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/Authen.h Source File

common/Authen.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * Authen.h --- class to manage CVS authentication kind
00023  */
00024
00025 #ifndef AUTHEN_H
00026 #define AUTHEN_H
00027
00028 #include "MultiString.h"
00029
00030 // authentication class
00031 typedef enum
00032 {
00033     rhosts, // rhosts file
00034     pserver, // pserver
00035     kserver, // kserver
00036     local, // mounted point
00037     ssh, // ssh
00038     ntserver // ntserver
00039 } AuthenKind;
00040
00041 class Authen
00042 {
00043 public :
00044     Authen() {}
00045
00046     AuthenKind kind(void);
00047     const char *kindstr(void);
00048     void setkind(AuthenKind newkind);
00049
00050     static const char *kindToToken(AuthenKind k);
00051     static AuthenKind tokenToKind(const char *t);
00052     static short kindToNum(AuthenKind k);
00053     static AuthenKind numToKind(short num);
00054
00055     static bool parse_cvsroot (const char *CVSroot,
00056         UStr & theMethod, UStr & theUser, UStr & theHost, UStr & thePath);
00057
00058     // ":pserver:", ":kserver:"
00059     const char *token(void);
00060     static const char * skiptoken(const char *cvsroot);
00061 };
00062
00063 class AuthenModel
00064 {
00065 public :
00066     AuthenModel();
00067     virtual ~AuthenModel();
00068
00069     static std::vector<AuthenModel *> & GetAllInstances(void);
00070     static AuthenModel *GetInstance(AuthenKind k);
00071
00072     virtual AuthenKind GetKind(void) const = 0;
00073     virtual const char *GetToken(void) const = 0;
00074
00075     virtual bool HasSettings(void) const { return false; }
00076     virtual bool HasHost(void) const { return false; }
00077     virtual bool HasUser(void) const { return false; }
00078
00079     virtual void DoSettings(void) {}
00080     virtual void GetSettingsDesc(UStr & desc) { desc = ""; }
00081
00082     virtual const char * OnGetEnv(char *env) { return 0L; }
00083
00084     /* This is intended for "cvs release". This command spawns
00085     another cvs and use the output for doing the release. The
00086     problem is that it beats the cvsgui protocol and thus we need
00087     to set up the env. variable correctly */
00088     virtual void OnSetupEnv(void);
00089     virtual void OnRestoreEnv(void);
00090 protected:
00091     static std::vector<AuthenModel *> * m_instances;
00092 };
00093
00094 extern Authen gAuthen;
00095
00096 #endif /* AUTHEN_H */
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/BrowseViewColumn.cpp Source File

common/BrowseViewColumn.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 #include "stdafx.h"
00018
00019 #include "BrowseViewColumn.h"
00020 #include "CvsEntries.h"
00021
00022 #if TIME_WITH_SYS_TIME
00023 #   include <sys/time.h>
00024 #   include <time.h>
00025 #elif HAVE_SYS_TIME_H
00026 #   include <sys/time.h>
00027 #else
00028 #   include <time.h>
00029 #endif
00030
00031 #if qMacPP
00032 #   include "MacMisc.h"
00033 #endif
00034
00035 #ifndef _countof
00036 #   define _countof(array) (sizeof(array)/sizeof(array[0]))
00037 #endif
00038
00039 extern "C" time_t get_date(const char *date, struct timeb *now);
00040     // Jonathan M. Gilligan <jonathan.gilligan@vanderbilt.edu>
00041
00042 static void SafeCopy(char* buffer, const char *value, int bufferSize)
00043 {
00044     if (value && *value)
00045     {
00046         strncpy(buffer, value, bufferSize);
00047     }
00048     else
00049     {
00050         *buffer = 0;
00051     }
00052 }
00053
00054 #ifdef WIN32
00055 static bool IsLargeFonts()
00056 {
00057     //JK - large fonts support for Windows
00058     static bool bLargeFonts = false;
00059     static bool defined = false;
00060     if (!defined)
00061     {
00062         defined = true;
00063         HWND hDesktop = ::GetDesktopWindow();
00064         HDC hDesktopDC = ::GetDC(hDesktop);
00065         short nLogPixels = ::GetDeviceCaps(hDesktopDC, LOGPIXELSX);
00066         ::ReleaseDC(hDesktop, hDesktopDC);
00067         bLargeFonts = (nLogPixels > 96);
00068     }
00069     return bLargeFonts;
00070 }
00071 #endif
00072
00073 const class KoNameColumn : public KiColumn
00074 {
00075 // Interfaces
00076 public:
00077 #ifdef WIN32
00078     // retrieve column label
00079     virtual void GetSetupData(LV_COLUMN* lvc) const
00080     {
00081         lvc->mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
00082         lvc->pszText = _T("Name");
00083         lvc->cx = 150;
00084         lvc->fmt = LVCFMT_LEFT;
00085     }
00086 #else
00087     // retrieve column label
00088     virtual void GetSetupData(LV_COLUMN* lvc) const
00089     {
00090         lvc->name = "Name";
00091         lvc->width = 210;
00092     }
00093 #endif
00094
00095     // retrieve formatted text as pertained to a node
00096     virtual void GetText(KoColumnContext* /*context*/, EntnodeData* data, char* buffer, int bufferSize) const
00097     {
00098         SafeCopy(buffer, data->GetName(), bufferSize);
00099     }
00100
00101     // compare two nodes (-1,0,+1)
00102     virtual int Compare(KoColumnContext* /*context*/, EntnodeData* d1, EntnodeData* d2) const
00103     {
00104         int res = stricmp(d1->GetName(), d2->GetName());
00105         return res;
00106     }
00107
00108     // tells if the column shall be sorted ascending initially
00109     virtual bool IsDefaultAscending() const
00110     {
00111         return false;
00112     }
00113
00114 } nameColumn;
00115
00116 const class KoPathColumn : public KiColumn
00117 {
00118 // Interfaces
00119 public:
00120     // retrieve column label
00121 #ifdef WIN32
00122     virtual void GetSetupData(LV_COLUMN* lvc) const
00123     {
00124         lvc->mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
00125         lvc->pszText = _T("Path");
00126         lvc->cx = 150;
00127         lvc->fmt = LVCFMT_LEFT;
00128     }
00129 #else
00130     // retrieve column label
00131     virtual void GetSetupData(LV_COLUMN* lvc) const
00132     {
00133         lvc->name = "Path";
00134         lvc->width = 300;
00135     }
00136 #endif
00137
00138     // retrieve formatted text as pertained to a node
00139     virtual void GetText(KoColumnContext* context, EntnodeData* data, char* buffer, int bufferSize) const
00140     {
00141         UStr buf;
00142         const char *fullpath = data->GetFullPathName(buf);
00143         int len = context->m_path.length();
00144         fullpath += len;
00145         if (*fullpath == '\\')
00146         {
00147             fullpath++;
00148         }
00149         SafeCopy(buffer, fullpath, bufferSize);
00150         const char *name = data->GetName();
00151         if (name)
00152         {
00153             int lenName = strlen(name) + 1;
00154             int lenPath = strlen(buffer);
00155             if (lenPath <= lenName)
00156             {
00157                 strncpy(buffer, ".", bufferSize);
00158             }
00159             else
00160             {
00161                 buffer[lenPath - lenName] = 0;
00162             }
00163         }
00164     }
00165
00166     // compare two nodes (-1,0,+1)
00167     virtual int Compare(KoColumnContext* context, EntnodeData* d1, EntnodeData* d2) const
00168     {
00169         char text1[256];
00170         GetText(context, d1, text1, 256);
00171         char text2[256];
00172         GetText(context, d2, text2, 256);
00173         int res = stricmp(text1, text2);
00174         return res;
00175     }
00176
00177     // tells if the column shall be sorted ascending initially
00178     virtual bool IsDefaultAscending() const
00179     {
00180         return false;
00181     }
00182
00183 } pathColumn;
00184
00185
00186 const class KoRevisionColumn : public KiColumn
00187 {
00188 // Interfaces
00189 public:
00190     // retrieve column label
00191 #ifdef WIN32
00192     virtual void GetSetupData(LV_COLUMN* lvc) const
00193     {
00194         lvc->mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
00195         lvc->pszText = _T("Rev.");
00196         lvc->cx = 50;
00197         lvc->fmt = LVCFMT_LEFT;
00198     }
00199 #else
00200     // retrieve column label
00201     virtual void GetSetupData(LV_COLUMN* lvc) const
00202     {
00203         lvc->name = "Rev.";
00204         lvc->width = 70;
00205     }
00206 #endif
00207
00208     // retrieve formatted text as pertained to a node
00209     virtual void GetText(KoColumnContext* /*context*/, EntnodeData* data, char* buffer, int bufferSize) const
00210     {
00211         SafeCopy(buffer, (*data)[EntnodeFile::kVN], bufferSize);
00212     }
00213
00214     // compare two nodes (-1,0,+1)
00215     virtual int Compare(KoColumnContext* /*context*/, EntnodeData* d1, EntnodeData* d2) const
00216     {
00217         const char *s1 = (*d1)[EntnodeFile::kVN];
00218         const char *s2 = (*d2)[EntnodeFile::kVN];
00219         int res;
00220         if(s1 != 0L && s2 != 0L)
00221             res = revcmp(s1, s2);
00222         else
00223             res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
00224         return res;
00225     }
00226
00227
00228     static int revcmp(const char *rev1, const char *rev2)
00229     {
00230         if(rev1 == 0L && rev2 == 0L)
00231             return 0;
00232         else if(rev1 == 0L || rev2 == 0L)
00233             return rev1 == 0L ? -1 : 1;
00234
00235         CStr r1(rev1), r2(rev2);
00236         CStr q1, q2;
00237         char *tmp;
00238         int v1, v2;
00239
00240         if((tmp = strchr(r1, '.')) != 0L)
00241         {
00242             tmp[0] = '\0';
00243             q1 = tmp + 1;
00244         }
00245
00246         v1 = atoi(r1);
00247
00248         if((tmp = strchr(r2, '.')) != 0L)
00249         {
00250             tmp[0] = '\0';
00251             q2 = tmp + 1;
00252         }
00253         v2 = atoi(r2);
00254
00255         if(v1 == v2)
00256             return revcmp(q1.empty() ? (char *)0L : q1, q2.empty() ? (char *)0L : q2);
00257
00258         return v1 < v2 ? -1 : 1;
00259     }
00260
00261     // tells if the column shall be sorted ascending initially
00262     virtual bool IsDefaultAscending() const
00263     {
00264         return true;
00265     }
00266
00267 } revisionColumn;
00268
00269 const class KoOptionColumn : public KiColumn
00270 {
00271 // Interfaces
00272 public:
00273     // retrieve column label
00274 #ifdef WIN32
00275     virtual void GetSetupData(LV_COLUMN* lvc) const
00276     {
00277         lvc->mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
00278         lvc->pszText = _T("Option");
00279         lvc->cx = 50;
00280         lvc->fmt = LVCFMT_LEFT;
00281     }
00282 #else
00283     // retrieve column label
00284     virtual void GetSetupData(LV_COLUMN* lvc) const
00285     {
00286         lvc->name = "Option";
00287         lvc->width = 55;
00288     }
00289 #endif
00290
00291     // retrieve formatted text as pertained to a node
00292     virtual void GetText(KoColumnContext* /*context*/, EntnodeData* data, char* buffer, int bufferSize) const
00293     {
00294         SafeCopy(buffer, (*data)[EntnodeFile::kOption], bufferSize);
00295     }
00296
00297     // compare two nodes (-1,0,+1)
00298     virtual int Compare(KoColumnContext* /*context*/, EntnodeData* d1, EntnodeData* d2) const
00299     {
00300         const char *s1 = (*d1)[EntnodeFile::kOption];
00301         const char *s2 = (*d2)[EntnodeFile::kOption];
00302         int res;
00303         if(s1 != 0L && s2 != 0L)
00304             res = strcmp(s1, s2);
00305         else
00306             res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
00307         return res;
00308     }
00309
00310     // tells if the column shall be sorted ascending initially
00311     virtual bool IsDefaultAscending() const
00312     {
00313         return true;
00314     }
00315
00316 } optionColumn;
00317
00318 const class KoStatusColumn : public KiColumn
00319 {
00320 // Interfaces
00321 public:
00322     // retrieve column label
00323 #ifdef WIN32
00324     virtual void GetSetupData(LV_COLUMN* lvc) const
00325     {
00326         lvc->mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
00327         lvc->pszText = _T("Status");
00328         lvc->cx = 100;
00329         lvc->fmt = LVCFMT_LEFT;
00330     }
00331 #else
00332     // retrieve column label
00333     virtual void GetSetupData(LV_COLUMN* lvc) const
00334     {
00335         lvc->name = "Status";
00336         lvc->width = 70;
00337     }
00338 #endif
00339
00340     // retrieve formatted text as pertained to a node
00341     virtual void GetText(KoColumnContext* /*context*/, EntnodeData* data, char* buffer, int bufferSize) const
00342     {
00343         SafeCopy(buffer, (*data)[EntnodeData::kStatus], bufferSize);
00344     }
00345
00346     // compare two nodes (-1,0,+1)
00347     virtual int Compare(KoColumnContext* /*context*/, EntnodeData* d1, EntnodeData* d2) const
00348     {
00349         int res = stricmp((*d1)[EntnodeData::kStatus], (*d2)[EntnodeData::kStatus]);
00350         return res;
00351     }
00352
00353     // tells if the column shall be sorted ascending initially
00354     virtual bool IsDefaultAscending() const
00355     {
00356         return true;
00357     }
00358
00359 } statusColumn;
00360
00361 const class KoTagColumn : public KiColumn
00362 {
00363 // Interfaces
00364 public:
00365     // retrieve column label
00366 #ifdef WIN32
00367     virtual void GetSetupData(LV_COLUMN* lvc) const
00368     {
00369         lvc->mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
00370         lvc->pszText = _T("Tag");
00371         lvc->cx = 150;
00372         lvc->fmt = LVCFMT_LEFT;
00373     }
00374 #else
00375     // retrieve column label
00376     virtual void GetSetupData(LV_COLUMN* lvc) const
00377     {
00378         lvc->name = "Tag";
00379         lvc->width = 90;
00380     }
00381 #endif
00382
00383     // retrieve formatted text as pertained to a node
00384     virtual void GetText(KoColumnContext* /*context*/, EntnodeData* data, char* buffer, int bufferSize) const
00385     {
00386         SafeCopy(buffer, (*data)[EntnodeFile::kTag], bufferSize);
00387     }
00388
00389     // compare two nodes (-1,0,+1)
00390     virtual int Compare(KoColumnContext* /*context*/, EntnodeData* d1, EntnodeData* d2) const
00391     {
00392         const char *s1 = (*d1)[EntnodeFile::kTag];
00393         const char *s2 = (*d2)[EntnodeFile::kTag];
00394         int res;
00395         if(s1 != 0L && s2 != 0L)
00396             res = strcmp(s1, s2);
00397         else
00398             res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
00399         return res;
00400
00401     }
00402
00403     // tells if the column shall be sorted ascending initially
00404     virtual bool IsDefaultAscending() const
00405     {
00406         return true;
00407     }
00408
00409 } tagColumn;
00410
00411
00412 const class KoDateColumn : public KiColumn
00413 {
00414 // Interfaces
00415 public:
00416     // retrieve column label
00417 #ifdef WIN32
00418     virtual void GetSetupData(LV_COLUMN* lvc) const
00419     {
00420         lvc->mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
00421         lvc->pszText = _T("Date");
00422         lvc->cx = (IsLargeFonts()) ? 170 : 150;
00423         lvc->fmt = LVCFMT_LEFT;
00424     }
00425 #else
00426     // retrieve column label
00427     virtual void GetSetupData(LV_COLUMN* lvc) const
00428     {
00429         lvc->name = "Date";
00430         lvc->width = 135;
00431     }
00432 #endif
00433
00434     // retrieve formatted text as pertained to a node
00435     virtual void GetText(KoColumnContext* /*context*/, EntnodeData* data, char* buffer, int bufferSize) const
00436     {
00437         SafeCopy(buffer, (*data)[EntnodeFile::kTS], bufferSize);
00438     }
00439
00440     // compare two nodes (-1,0,+1)
00441     virtual int Compare(KoColumnContext* /*context*/, EntnodeData* d1, EntnodeData* d2) const
00442     {
00443         const char *s1 = (*d1)[EntnodeFile::kTS];
00444         const char *s2 = (*d2)[EntnodeFile::kTS];
00445         int res;
00446
00447         if(s1 != 0L && s2 != 0L) {
00448             time_t t1 = get_date(s1,(struct timeb *)NULL);
00449             time_t t2 = get_date(s2,(struct timeb *)NULL);
00450
00451             res = t1 < t2 ? -1 : (t1 > t2 ? 1 : 0);
00452         }
00453         else
00454             res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
00455         return res;
00456     }
00457
00458     // tells if the column shall be sorted ascending initially
00459     virtual bool IsDefaultAscending() const
00460     {
00461         return true;
00462     }
00463
00464
00465 } dateColumn;
00466
00467 const class KoConflictColumn : public KiColumn
00468 {
00469 // Interfaces
00470 public:
00471     // retrieve column label
00472 #ifdef WIN32
00473     virtual void GetSetupData(LV_COLUMN* lvc) const
00474     {
00475         lvc->mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
00476         lvc->pszText = _T("Conflict");
00477         lvc->cx = 150;
00478         lvc->fmt = LVCFMT_LEFT;
00479     }
00480 #else
00481     // retrieve column label
00482     virtual void GetSetupData(LV_COLUMN* lvc) const
00483     {
00484         lvc->name = "Conflict";
00485         lvc->width = 100;
00486     }
00487 #endif
00488
00489     // retrieve formatted text as pertained to a node
00490     virtual void GetText(KoColumnContext* /*context*/, EntnodeData* data, char* buffer, int bufferSize) const
00491     {
00492         SafeCopy(buffer, data->GetConflict(), bufferSize);
00493     }
00494
00495     // compare two nodes (-1,0,+1)
00496     virtual int Compare(KoColumnContext* /*context*/, EntnodeData* d1, EntnodeData* d2) const
00497     {
00498         const char *s1 = d1->GetConflict();
00499         const char *s2 = d2->GetConflict();
00500         int res;
00501         if(s1 != 0L && s2 != 0L)
00502             res = strcmp(s1, s2);
00503         else
00504             res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
00505         return res;
00506     }
00507
00508     // tells if the column shall be sorted ascending initially
00509     virtual bool IsDefaultAscending() const
00510     {
00511         return true;
00512     }
00513
00514
00515 } conflictColumn;
00516
00517 // all known columns for view's perusal
00518 static const KiColumn* columnsRegular[] = {
00519     &nameColumn, &revisionColumn, &optionColumn, &statusColumn, &tagColumn, &dateColumn, &conflictColumn
00520 };
00521
00522 static const int typesRegular[] = {
00523     EntnodeData::kName, EntnodeFile::kVN, EntnodeFile::kOption, EntnodeData::kStatus,
00524     EntnodeFile::kTag, EntnodeFile::kTS, EntnodeFile::kConflict
00525 };
00526
00527 static const KiColumn* columnsRecursive[] = {
00528     &nameColumn, &pathColumn, &revisionColumn, &optionColumn, &statusColumn, &tagColumn, &dateColumn, &conflictColumn
00529 };
00530
00531 static const int typesRecursive[] = {
00532     EntnodeData::kName, EntnodeFile::kPath, EntnodeFile::kVN, EntnodeFile::kOption, EntnodeData::kStatus,
00533     EntnodeFile::kTag, EntnodeFile::kTS, EntnodeFile::kConflict
00534 };
00535
00536 // regular columnar model
00537 class KoRegularModel : public KiColumnModel
00538 {
00539
00540
00541 // Interfaces
00542 public:
00543     virtual const KiColumn* GetAt(int pos) const
00544     {
00545         return columnsRegular[pos];
00546     }
00547
00548
00549     virtual int GetType(int pos) const
00550     {
00551         return typesRegular[pos];
00552     }
00553
00554
00555     virtual int GetCount() const
00556     {
00557         return _countof(columnsRegular);
00558     }
00559
00560 } modelRegular;
00561
00562 // recursive columnar model
00563 class KoRecursiveModel : public KiColumnModel
00564 {
00565 // Interfaces
00566 public:
00567     virtual const KiColumn* GetAt(int pos) const
00568     {
00569         return columnsRecursive[pos];
00570     }
00571
00572
00573     virtual int GetType(int pos) const
00574     {
00575         return typesRecursive[pos];
00576     }
00577
00578
00579     virtual int GetCount() const
00580     {
00581         return _countof(columnsRecursive);
00582     }
00583
00584 } modelRecursive;
00585
00587 // instantiation
00588 KiColumnModel* KiColumnModel::GetRecursiveModel()
00589 {
00590     return &modelRecursive;
00591 }
00592
00593 KiColumnModel* KiColumnModel::GetRegularModel()
00594 {
00595     return &modelRegular;
00596 }
00597
00598 int KiColumnModel::GetColumn(int type) const
00599 {
00600     int numColumns = GetCount();
00601     for(int i = 0; i < numColumns; i++)
00602     {
00603         if(type == GetType(i))
00604             return i;
00605     }
00606     return 0;
00607 }
00608
00609 #ifdef WIN32
00610 int CALLBACK _Compare(LPARAM data1, LPARAM data2, LPARAM data)
00611 #else
00612 int _Compare(void *data1, void *data2, void *data)
00613 #endif
00614 {
00615     int res = 0;
00616     bool fOneDirOnly = false;
00617
00618     EntnodeData *d1 = (EntnodeData *)data1;
00619     EntnodeData *d2 = (EntnodeData *)data2;
00620
00621     const CSortParam *pSortParam = (CSortParam*)data;
00622
00623     //  Group sub dirs ?
00624     if (pSortParam->m_fGroupSubDir)
00625     {
00626         int d1IsDir = d1->GetType()==ENT_SUBDIR;
00627         int d2IsDir = d2->GetType()==ENT_SUBDIR;
00628
00629         if( (d1IsDir + d2IsDir) == 1)
00630         {
00631             //  One (and only one of them) is a directory
00632             fOneDirOnly = true;
00633             res = d1IsDir ? -1 : 1;
00634         }
00635     }
00636
00637     if (!res)
00638     {
00639         res = pSortParam->m_column->Compare(pSortParam->m_context, d1, d2);
00640     }
00641
00642     if (res==0 && pSortParam->m_column != pSortParam->m_columnAlt)
00643         res = pSortParam->m_columnAlt->Compare(pSortParam->m_context, d1, d2);
00644     else if (!fOneDirOnly)
00645         res = pSortParam->m_fAccendant ? -res : res;
00646     return res;
00647 }
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/BrowseViewColumn.h Source File

common/BrowseViewColumn.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 #ifndef __BROWSEVIEW_COLUMN_H__
00018 #define __BROWSEVIEW_COLUMN_H__
00019
00020 class EntnodeData;
00021
00022 #include "ustr.h"
00023
00024 // context in which a collumn is accessed
00025 class KoColumnContext
00026 {
00027 // Attributes
00028 public:
00029     UStr m_path;
00030     // current path
00031
00032 public:
00033     KoColumnContext(const char *path)
00034     : m_path(path)
00035     {}
00036 };
00037
00038 #ifndef WIN32
00039     struct LV_COLUMN
00040     {
00041         int width;
00042         const char *name;
00043     };
00044 #endif
00045
00046 //  column descriptor interface
00047 class KiColumn
00048 {
00049 // Interfaces
00050 public:
00051     // retrieve setup data
00052     virtual void GetSetupData(LV_COLUMN* lvc) const = 0;
00053
00054     // tells if the column shall be sorted ascending initially
00055     virtual bool IsDefaultAscending() const = 0;
00056
00057     // retrieve formatted text as pertained to a node
00058     virtual void GetText(KoColumnContext* context, EntnodeData* data, char* buffer, int buffersize) const = 0;
00059
00060     // compare two nodes (-1,0,+1)
00061     virtual int Compare(KoColumnContext* context, EntnodeData* d1, EntnodeData* d2) const = 0;
00062 };
00063
00064 // columnar model of the data
00065 class KiColumnModel
00066 {
00067 // Interfaces
00068 public:
00069     virtual const KiColumn* GetAt(int pos) const = 0;
00070     // gets column descriptor by its index
00071
00072     virtual int GetType(int pos) const = 0;
00073     // gets column type by its index
00074
00075     virtual int GetCount() const = 0;
00076     // returns count of the columns
00077
00078     virtual int GetColumn(int type) const;
00079     // gets column index by its type
00080
00081 // Factory methods
00082 public:
00083     static KiColumnModel* GetRecursiveModel();
00084     static KiColumnModel* GetRegularModel();
00085 };
00086
00087 struct CSortParam
00088 {
00089     CSortParam (bool fAccendant, bool fGroupSubDir, const KiColumn* column, const KiColumn* columnAlt, KoColumnContext* context)
00090     : m_fAccendant(fAccendant)
00091     , m_fGroupSubDir(fGroupSubDir)
00092     , m_column(column)
00093     , m_columnAlt(columnAlt)
00094     , m_context(context)
00095     {};
00096
00097     const KiColumn* m_column;     // descriptor of the column being sorted
00098     const KiColumn* m_columnAlt;// descriptor of the alternate sorting column
00099     KoColumnContext* m_context;
00100     bool m_fAccendant;
00101     bool m_fGroupSubDir;
00102 };
00103
00104 #ifdef WIN32
00105 int CALLBACK _Compare(LPARAM data1, LPARAM data2, LPARAM data);
00106 #else
00107 int _Compare(void *data1, void *data2, void *data);
00108 #endif
00109
00110 #endif
00111 // __BROWSEVIEW_COLUMN_H__
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/BrowseViewHandlers.h Source File

common/BrowseViewHandlers.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 #ifndef _BROWSEVIEWHANDLERS_H_
00018 #define _BROWSEVIEWHANDLERS_H_
00019
00020 # include "CvsAlert.h"
00021
00022 // interface describing a handler to process a selection-related command
00023 class KiSelectionHandler
00024 {
00025 public:
00026     // called for each folder in selection
00027     virtual void OnFolder(const char* fullpath) = 0;
00028
00029     // called after all folders are processed and there are selected files
00030     virtual void OnFiles(MultiFiles* mf) = 0;
00031 };
00032
00033
00034 // handles moving files to trash
00035 class KoMoveToTrashHandler : public KiSelectionHandler
00036 {
00037 public:
00038     // called for each folder in selection
00039     virtual void OnFolder(const char* fullpath)
00040     { /* ignore */ }
00041
00042     // called after all folders are processed and there are selected files
00043     virtual void OnFiles(MultiFiles* mf)
00044     {
00045         if( !CvsAlert("Are you sure you want to erase selected files?", "Yes", "No") )
00046         {
00047             return;
00048         }
00049
00050         while(mf->next())
00051         {
00052             int count = mf->NumFiles();
00053             for (int i = 0; i < count; i++)
00054             {
00055                 CStr path, fileName;
00056                 if (mf->get(i, path, fileName))
00057                 {
00058                     char fn[_MAX_PATH];
00059                     _makepath(fn, NULL, path, fileName, NULL);
00060                     if(!CompatMoveToTrash(fn))
00061                     {
00062                         cvs_err("Unable to remove '%s' (error %d)\n", fn, errno);
00063                     }
00064                     else
00065                     {
00066                         cvs_out("'%s' has been moved successfully to the recycle bin...\n", fn);
00067                     }
00068                 }
00069             }
00070         }
00071     }
00072
00073 };
00074
00075 // handles figuring out if moving files to trash is enabled
00076 class KoUpdateMoveToTrashHandler  : public KiSelectionHandler
00077 {
00078 // Attributes
00079     bool m_isFolders, m_isFiles;
00080
00081 public:
00082     KoUpdateMoveToTrashHandler()
00083     : m_isFolders(false), m_isFiles(false)
00084     {}
00085
00086     virtual void OnFolder(const char* fullpath)
00087     {
00088         m_isFolders = true;
00089     }
00090
00091     // called after all folders are processed and there are selected files
00092     virtual void OnFiles(MultiFiles* /*mf*/)
00093     {
00094         m_isFiles = true;
00095     }
00096
00097     bool IsEnabled() const
00098     {
00099         return !m_isFolders && m_isFiles;
00100     }
00101 };
00102
00103
00104 // handles create tag request on the selected items
00105 class KoCreateTagHandler : public KiSelectionHandler
00106 {
00107     virtual void OnFolder(const char* fullpath)
00108     {
00109         CvsCmdTagCreateFolder(fullpath);
00110     }
00111
00112     virtual void OnFiles(MultiFiles* pmf)
00113     {
00114         CvsCmdTagCreateFiles(pmf);
00115     }
00116 };
00117
00118 // handles delete tag request on the selected items
00119 class KoDeleteTagHandler : public KiSelectionHandler
00120 {
00121     virtual void OnFolder(const char* fullpath)
00122     {
00123         CvsCmdTagDeleteFolder(fullpath);
00124     }
00125
00126     virtual void OnFiles(MultiFiles* pmf)
00127     {
00128         CvsCmdTagDeleteFiles(pmf);
00129     }
00130 };
00131
00132 // handles branch request on the selected items
00133 class KoBranchTagHandler : public KiSelectionHandler
00134 {
00135     virtual void OnFolder(const char* fullpath)
00136     {
00137         CvsCmdTagBranchFolder(fullpath);
00138     }
00139
00140     virtual void OnFiles(MultiFiles* pmf)
00141     {
00142         CvsCmdTagBranchFiles(pmf);
00143     }
00144 };
00145
00146 // handles edit start request on the selected items
00147 class KoEditHandler : public KiSelectionHandler
00148 {
00149     virtual void OnFolder(const char* fullpath)
00150     {
00151         CvsCmdEditFolder(fullpath);
00152     }
00153
00154     virtual void OnFiles(MultiFiles* pmf)
00155     {
00156         CvsCmdEditFiles(pmf);
00157     }
00158 };
00159
00160 // handles edit stop request on the selected items
00161 class KoUneditHandler : public KiSelectionHandler
00162 {
00163     virtual void OnFolder(const char* fullpath)
00164     {
00165         CvsCmdUneditFolder(fullpath);
00166     }
00167
00168     virtual void OnFiles(MultiFiles* pmf)
00169     {
00170         CvsCmdUneditFiles(pmf);
00171     }
00172 };
00173
00174 // handles releasing on the selected items
00175 class KoReleaseHandler : public KiSelectionHandler
00176 {
00177     virtual void OnFolder(const char* fullpath)
00178     {
00179         CvsCmdReleaseFolder(fullpath);
00180     }
00181
00182     virtual void OnFiles(MultiFiles* /*pmf*/)
00183     {   }
00184 };
00185
00186 // handles watchers on the selected items
00187 class KoWatchersHandler : public KiSelectionHandler
00188 {
00189     virtual void OnFolder(const char* fullpath)
00190     {
00191         CvsCmdWatchersFolder(fullpath);
00192     }
00193
00194     virtual void OnFiles(MultiFiles* pmf)
00195     {
00196         CvsCmdWatchersFiles(pmf);
00197     }
00198 };
00199
00200 // handles editors on the selected items
00201 class KoEditorsHandler : public KiSelectionHandler
00202 {
00203     virtual void OnFolder(const char* fullpath)
00204     {
00205         CvsCmdEditorsFolder(fullpath);
00206     }
00207
00208     virtual void OnFiles(MultiFiles* pmf)
00209     {
00210         CvsCmdEditorsFiles(pmf);
00211     }
00212 };
00213
00214 // handles watch on on the selected items
00215 class KoWatchOnHandler : public KiSelectionHandler
00216 {
00217     virtual void OnFolder(const char* fullpath)
00218     {
00219         CvsCmdWatchOnFolder(fullpath);
00220     }
00221
00222     virtual void OnFiles(MultiFiles* pmf)
00223     {
00224         CvsCmdWatchOnFiles(pmf);
00225     }
00226 };
00227
00228 // handles watch off on the selected items
00229 class KoWatchOffHandler : public KiSelectionHandler
00230 {
00231     virtual void OnFolder(const char* fullpath)
00232     {
00233         CvsCmdWatchOffFolder(fullpath);
00234     }
00235
00236     virtual void OnFiles(MultiFiles* pmf)
00237     {
00238         CvsCmdWatchOffFiles(pmf);
00239     }
00240 };
00241
00242 // handles diffing on the selected items
00243 class KoDiffHandler : public KiSelectionHandler
00244 {
00245     virtual void OnFolder(const char* fullpath)
00246     {
00247         CvsCmdDiffFolder(fullpath);
00248     }
00249
00250     virtual void OnFiles(MultiFiles* pmf)
00251     {
00252         CvsCmdDiffFiles(pmf);
00253     }
00254 };
00255
00256 // handles log queries on the selected items
00257 class KoLogHandler : public KiSelectionHandler
00258 {
00259     virtual void OnFolder(const char* fullpath)
00260     {
00261         CvsCmdLogFolder(fullpath);
00262     }
00263
00264     virtual void OnFiles(MultiFiles* pmf)
00265     {
00266         CvsCmdLogFiles(pmf);
00267     }
00268 };
00269
00270 // handles graph log queries on the selected items
00271 class KoGraphHandler : public KiSelectionHandler
00272 {
00273     virtual void OnFolder(const char* /*fullpath*/)
00274     {
00275         /*we avoid processing directory*/
00276     }
00277
00278     virtual void OnFiles(MultiFiles* pmf)
00279     {
00280         CvsCmdLogFiles(pmf, true);
00281     }
00282 };
00283
00284 // handles status queries on the selected items
00285 class KoStatusHandler : public KiSelectionHandler
00286 {
00287     virtual void OnFolder(const char* fullpath)
00288     {
00289         CvsCmdStatusFolder(fullpath);
00290     }
00291
00292     virtual void OnFiles(MultiFiles* pmf)
00293     {
00294         CvsCmdStatusFiles(pmf);
00295     }
00296 };
00297
00298 // handles file remove requests
00299 class KoFileRemoveHandler : public KiSelectionHandler
00300 {
00301     virtual void OnFolder(const char* fullpath)
00302     { /*folder cannot be removed */ }
00303
00304     virtual void OnFiles(MultiFiles* pmf)
00305     {
00306         CvsCmdRemoveFiles(pmf);
00307     }
00308 };
00309
00310 // handles locking on the selected items
00311 class KoLockHandler : public KiSelectionHandler
00312 {
00313     virtual void OnFolder(const char* fullpath)
00314     {
00315         CvsCmdLockFolder(fullpath);
00316     }
00317
00318     virtual void OnFiles(MultiFiles* pmf)
00319     {
00320         CvsCmdLockFiles(pmf);
00321     }
00322 };
00323
00324 // handles unlocking on the selected items
00325 class KoUnlockHandler : public KiSelectionHandler
00326 {
00327     virtual void OnFolder(const char* fullpath)
00328     {
00329         CvsCmdUnlockFolder(fullpath);
00330     }
00331
00332     virtual void OnFiles(MultiFiles* pmf)
00333     {
00334         CvsCmdUnlockFiles(pmf);
00335     }
00336 };
00337
00338 // handles addition of the selected items
00339 class KoAddHandler : public KiSelectionHandler
00340 {
00341     virtual void OnFolder(const char* fullpath)
00342     {
00343         CvsCmdAddFolder(fullpath);
00344     }
00345
00346     virtual void OnFiles(MultiFiles* pmf)
00347     {
00348         CvsCmdAddFiles(pmf);
00349     }
00350 };
00351
00352 // handles binary addition of the selected items
00353 class KoAddBinaryHandler : public KiSelectionHandler
00354 {
00355     virtual void OnFolder(const char* fullpath)
00356     {
00357         CvsCmdAddFolder(fullpath);
00358     }
00359
00360     virtual void OnFiles(MultiFiles* pmf)
00361     {
00362         CvsCmdAddBinaryFiles(pmf);
00363     }
00364 };
00365
00366 // handles commits of the selected items
00367 class KoCommitHandler : public KiSelectionHandler
00368 {
00369     virtual void OnFolder(const char* fullpath)
00370     {
00371         CvsCmdCommitFolder(fullpath);
00372     }
00373
00374     virtual void OnFiles(MultiFiles* pmf)
00375     {
00376         CvsCmdCommitFiles(pmf);
00377     }
00378 };
00379
00380 // handles updates on the selected items
00381 class KoUpdateHandler : public KiSelectionHandler
00382 {
00383     virtual void OnFolder(const char* fullpath)
00384     {
00385         CvsCmdUpdateFolder(fullpath);
00386     }
00387
00388     virtual void OnFiles(MultiFiles* pmf)
00389     {
00390         CvsCmdUpdateFiles(pmf);
00391     }
00392 };
00393
00394 // handles query updates on the selected items
00395 class KoQueryUpdateHandler : public KiSelectionHandler
00396 {
00397     virtual void OnFolder(const char* fullpath)
00398     {
00399         CvsCmdUpdateFolder(fullpath, true);
00400     }
00401
00402     virtual void OnFiles(MultiFiles* pmf)
00403     {
00404         CvsCmdUpdateFiles(pmf, true);
00405     }
00406 };
00407
00408 // handles annotate on the selected items
00409 class KoAnnotateHandler : public KiSelectionHandler
00410 {
00411     virtual void OnFolder(const char* /*fullpath*/)
00412     {
00413         /*we avoid processing directory*/
00414     }
00415
00416     virtual void OnFiles(MultiFiles* pmf)
00417     {
00418         CvsCmdAnnotateFiles(pmf);
00419     }
00420 };
00421
00422 #endif
00423 // OWSEVIEWHANDLERS_H_
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/BrowseViewModel.cpp Source File

common/BrowseViewModel.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 #include "stdafx.h"
00018
00019 #include "BrowseViewModel.h"
00020 #include "Persistent.h"
00021 #include "CvsEntries.h"
00022
00023 #if qMacPP
00024 #   include "MacMisc.h"
00025 #endif
00026
00028 // KoFilterModel implementation
00029 static CPersistentBool persistentChanged("P_ViewChanged", false);
00030 static CPersistentBool persistentAdded("P_ViewAdded", false);
00031 static CPersistentBool persistentRemoved("P_ViewRemoved", false);
00032 static CPersistentBool persistentConflicts("P_ViewConflicts", false);
00033 static CPersistentBool persistentUnknown("P_ViewUnknown", false);
00034 static CPersistentBool persistentHideUnknown("P_ViewHideUnknown", false);
00035 static CPersistentBool persistentMissing("P_ViewMissing", false);
00036
00037 KoFilterModel::KoFilterModel()
00038 : m_isChanged(persistentChanged)
00039 , m_isAdded(persistentAdded)
00040 , m_isRemoved(persistentRemoved)
00041 , m_isConflicts(persistentConflicts)
00042 , m_isUnknown(persistentUnknown)
00043 , m_isMissing(persistentMissing)
00044 , m_isHideUnknown(persistentHideUnknown)
00045 {}
00046
00047 KoFilterModel::~KoFilterModel()
00048 {
00049     persistentChanged = m_isChanged;
00050     persistentAdded = m_isAdded;
00051     persistentRemoved = m_isRemoved;
00052     persistentConflicts = m_isConflicts;
00053     persistentUnknown = m_isUnknown;
00054     persistentMissing = m_isMissing;
00055     persistentHideUnknown = m_isHideUnknown;
00056 }
00057
00058 bool KoFilterModel::IsDefaultMode() const
00059 {
00060     return !m_isConflicts && !m_isChanged && !m_isMissing && !m_isAdded && !m_isRemoved;
00061 }
00062
00063 bool KoFilterModel::IsMatch(EntnodeData* data)
00064 {
00065     // check to see if file name matches
00066     if (m_match.size() && !MatchIgnoredList(data->GetName(), m_match))
00067     {
00068         return false;
00069     }
00070
00071     if (IsDefaultMode() && !m_isUnknown)
00072     {
00073         // check if unknown files are to be hidden
00074         if (data->IsUnknown() && m_isHideUnknown)
00075         {
00076             // unknown item match
00077             return false;
00078         }
00079
00080         return true;
00081     }
00082
00083     if (data->IsMissing() && data->IsRemoved() && m_isRemoved)
00084     {
00085         // removed item match
00086         return true;
00087     }
00088
00089     if (data->IsMissing() && !data->IsRemoved() && m_isMissing)
00090     {
00091         // missing item match
00092         return true;
00093     }
00094
00095     if (data->IsUnknown() && m_isUnknown)
00096     {
00097         // unknown item match
00098         return true;
00099     }
00100
00101     if ((data->GetConflict() != NULL) && m_isConflicts)
00102     {
00103         // conflict match
00104         return true;
00105     }
00106
00107     if (!data->IsUnmodified())
00108     {
00109         // can be either changed or added
00110         const char* vn = (*data)[EntnodeFile::kVN];
00111         bool isAdded = vn && (strcmp(vn, "0") == 0);
00112         if (isAdded && m_isAdded)
00113         {
00114             // added file match
00115             return true;
00116         }
00117         if (!isAdded && m_isChanged)
00118         {
00119             // changed file match
00120             return true;
00121         }
00122     }
00123
00124     // no match
00125     return false;
00126 }
00127
00128 // toggles hide unknown flag
00129 void KoFilterModel::ToggleHideUnknown()
00130 {
00131     m_isHideUnknown = !m_isHideUnknown;
00132     if (m_isHideUnknown)
00133     {
00134         m_isUnknown = false;
00135     }
00136 }
00137
00138 // toggles show conflict flag
00139 void KoFilterModel::ToggleUnknown()
00140 {
00141     m_isUnknown = !m_isUnknown;
00142     if (m_isUnknown)
00143     {
00144         m_isHideUnknown = false;
00145     }
00146 }
00147
00148
00149 void KoFilterModel::ToggleModified()
00150 {
00151     m_isAdded =
00152     m_isChanged =
00153     m_isRemoved =
00154     m_isConflicts = !IsModified();
00155 }
00156
00157 //accessor for modified flag
00158 bool KoFilterModel::IsModified() const
00159 {
00160     bool isModified = m_isAdded && m_isChanged && m_isRemoved && m_isConflicts;
00161     return isModified;
00162 }
00163
00164 NotificationManager* KoFilterModel::GetNotificationManager()
00165 {
00166     return &m_manager;
00167 }
00168
00169 bool KoFilterModel::SetMask(const char *fileMask)
00170 {
00171     bool changed = m_mask.empty() || fileMask == 0L || stricmp(m_mask, fileMask) != 0;
00172     if (changed)
00173     {
00174         m_mask = fileMask;
00175         m_match.clear();
00176         if (!m_mask.empty())
00177         {
00178             // build match list
00179             UStr mask = fileMask;
00180             char * buffer = mask;
00181             static const char separators[] = " \t;";
00182             for (char * token = strtok(buffer, separators); token; token = strtok(NULL, separators))
00183             {
00184                 m_match.push_back(UStr(token));
00185             }
00186         }
00187     }
00188     return changed;
00189 }
00190
00192 // recursion model implementation
00193 static CPersistentBool persistentRecursive("P_DisplayRecursive", false);
00194
00195 KoRecursionModel::KoRecursionModel()
00196 : m_isRecursive(persistentRecursive)
00197 {}
00198
00199 KoRecursionModel::~KoRecursionModel()
00200 {
00201     persistentRecursive = m_isRecursive;
00202 }
00203
00204 bool KoRecursionModel::IsShowRecursive()
00205 {
00206     return m_isRecursive;
00207 }
00208
00209 NotificationManager* KoRecursionModel::GetNotificationManager()
00210 {
00211     return &m_manager;
00212 }
00213
00214 void KoRecursionModel::ToggleRecursion()
00215 {
00216     m_isRecursive = !m_isRecursive;
00217 };
00218
00220 // ignore model implementation
00221 static CPersistentBool persistentIgnore("P_FileViewIgnore", true);
00222
00223 KoIgnoreModel::KoIgnoreModel()
00224 : m_isIgnore(persistentIgnore)
00225 {}
00226
00227 KoIgnoreModel::~KoIgnoreModel()
00228 {
00229     persistentIgnore =  m_isIgnore;
00230 }
00231
00232 bool KoIgnoreModel::IsShowIgnored()
00233 {
00234     return m_isIgnore;
00235 }
00236
00237 NotificationManager* KoIgnoreModel::GetNotificationManager()
00238 {
00239     return &m_manager;
00240 }
00241
00242 void KoIgnoreModel::ToggleIgnore()
00243 {
00244     m_isIgnore = !m_isIgnore;
00245 };
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/BrowseViewModel.h Source File

common/BrowseViewModel.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 #ifndef __MODEL__H__
00018 #define __MODEL__H__
00019
00020 #include "UStr.h"
00021 #include <vector>
00022
00023 // forward references
00024 class EntnodeData;
00025
00026 #if qMacPP
00027 #define CObject LPane
00028 #endif
00029
00030 // use this to cast to proper notification handler
00031 typedef void (*FNOBSERVER)(CObject*);
00032
00033
00034 // notification handler
00035 //template <class TObserver>
00036 class NotificationManager
00037 {
00038 // used types
00039 public:
00040
00041 private:
00042     // node describing observer registration
00043     struct Node
00044     {
00045         CObject* observer;
00046         // observer
00047
00048         FNOBSERVER handler;
00049         // its notification handler
00050
00051         // default constructor just zeroes everything
00052         Node()
00053         : observer(NULL), handler(NULL)
00054         {}
00055
00056         // full-blown construction
00057         Node(CObject* o, FNOBSERVER h)
00058         : observer(o), handler(h)
00059         {}
00060
00061         Node(const Node & n)
00062         {
00063             observer = n.observer;
00064             handler = n.handler;
00065         }
00066
00067         Node & operator=(const Node & n)
00068         {
00069             observer = n.observer;
00070             handler = n.handler;
00071             return *this;
00072         }
00073
00074     };
00075
00076 // Attributes
00077 private:
00078     std::vector<Node> m_nodes;
00079
00080 // Construction
00081 public:
00082     NotificationManager()   {}
00083
00084 // Operations
00085 public:
00086     // register an observer
00087     void CheckIn(CObject* observer, FNOBSERVER handler)
00088     {
00089         m_nodes.push_back(Node(observer, handler));
00090     }
00091
00092     // unregister an observer
00093     void CheckOut(CObject* observer)
00094     {
00095         for (std::vector<Node>::iterator i = m_nodes.begin(); i != m_nodes.end(); i++)
00096         {
00097             if ((*i).observer == observer)
00098             {
00099                 m_nodes.erase(i);
00100                 break;
00101             }
00102         }
00103     }
00104
00105     // fire up a notification once done with changes in observable
00106     void NotifyAll()
00107     {
00108         for (std::vector<Node>::iterator i = m_nodes.begin(); i != m_nodes.end(); i++)
00109         {
00110             // make a local copy so that observers can freely unregister during the process
00111             Node & node = *i;
00112             node.handler(node.observer);
00113         }
00114     }
00115
00116 };
00117
00118 // interface to filtering entries
00119 class KiFilterModel
00120 {
00121 // Interfaces
00122 public:
00123     // checks to see if an item satisfies current filtering criteria
00124     virtual bool IsMatch(EntnodeData* data) = 0;
00125
00126     // retrieves notification manager for observing changes in the
00127     virtual NotificationManager* GetNotificationManager() = 0;
00128 };
00129
00130 // interface to recursive display of entries
00131 class KiRecursionModel
00132 {
00133 // Interfaces
00134 public:
00135     // returns true if displaying files recursively
00136     virtual bool IsShowRecursive() = 0;
00137
00138     // retrieves notification manager for observing changes in the
00139     virtual NotificationManager* GetNotificationManager() = 0;
00140 };
00141
00142 // interface to recursive display of entries
00143 class KiIgnoreModel
00144 {
00145 // Interfaces
00146 public:
00147     // returns true if displaying ignored files
00148     virtual bool IsShowIgnored() = 0;
00149
00150     // retrieves notification manager for observing changes in the
00151     virtual NotificationManager* GetNotificationManager() = 0;
00152 };
00153
00154 // interface to filtering entries
00155 class KoFilterModel : public KiFilterModel
00156 {
00157 // Attributes
00158 protected:
00159     NotificationManager m_manager; // manager for filter change notifications
00160     UStr m_mask;             // current file mask
00161     std::vector<UStr> m_match;  // itemized array of file masks to display as found
00162     bool m_isChanged;       // flag to tell if only changed files are to be displayed
00163     bool m_isAdded;         // flag to tell if only added files are to be displayed
00164     bool m_isRemoved;       // flag to tell if only removed files are to be displayed
00165     bool m_isConflicts;     // flag to tell if conflicting files shall be displayed
00166
00167     bool m_isUnknown;       // flag to tell if unknown files have to be shown
00168     bool m_isHideUnknown;   // flag to tell if unknown files have to be hidden, mutually
00169                             // exclusive with above
00170     bool m_isMissing;       // flag to tell if missing files have to be shown
00171
00172 // Construction
00173 public:
00174     KoFilterModel();
00175     ~KoFilterModel();
00176
00177 // Interfaces
00178 public:
00179     // checks to see if an item satisfies current filtering criteria
00180     virtual bool IsMatch(EntnodeData* data);
00181
00182     // retrieves notification manager for observing changes in the
00183     virtual NotificationManager* GetNotificationManager();
00184
00185 // Operations
00186 public:
00187     // tells if the filter is in default mode - fo show flags are set
00188     bool IsDefaultMode() const;
00189
00190     // toggles modified flag
00191     void ToggleModified();
00192
00193     //accessor for modified flag
00194     bool IsModified() const;
00195
00196     // sets new file mask, returns true if changed
00197     bool SetMask(const char *mask);
00198
00199     // toggles show conflict flag
00200     void ToggleConflict()
00201     {
00202         m_isConflicts = !m_isConflicts;
00203     }
00204
00205     //accessor for show conflict flag
00206     bool IsConflict() const
00207     {
00208         return m_isConflicts;
00209     }
00210
00211     // toggles show conflict flag
00212     void ToggleUnknown();
00213
00214     //accessor for show unknown flag
00215     bool IsUnknown() const
00216     {
00217         return m_isUnknown;
00218     }
00219
00220     // toggles hide unknown flag
00221     void ToggleHideUnknown();
00222
00223     //accessor for hide unknown flag
00224     bool IsHideUnknown() const
00225     {
00226         return m_isHideUnknown;
00227     }
00228
00229
00230     // toggles show conflict flag
00231     void ToggleMissing()
00232     {
00233         m_isMissing = !m_isMissing;
00234     }
00235
00236     //accessor for show unknown flag
00237     bool IsMissing() const
00238     {
00239         return m_isMissing;
00240     }
00241
00242     void ToggleChanged()
00243     {
00244         m_isChanged = !m_isChanged;
00245     }
00246
00247     bool IsChanged() const
00248     {
00249         return m_isChanged;
00250     }
00251
00252     void ToggleAdded()
00253     {
00254         m_isAdded = !m_isAdded;
00255     }
00256
00257     bool IsAdded() const
00258     {
00259         return m_isAdded;
00260     }
00261
00262     void ToggleRemoved()
00263     {
00264         m_isRemoved = !m_isRemoved;
00265     }
00266
00267     bool IsRemoved() const
00268     {
00269         return m_isRemoved;
00270     }
00271 };
00272
00273 // interface to recursive display of entries
00274 class KoRecursionModel : public KiRecursionModel
00275 {
00276     NotificationManager m_manager;
00277     // manager for change notifications
00278
00279     bool m_isRecursive;
00280     // flag to tell if files in subfolders shall be iterated
00281 // Construction
00282 public:
00283     KoRecursionModel();
00284     ~KoRecursionModel();
00285
00286 // Interfaces
00287 public:
00288     // returns true if displaying files recursively
00289     virtual bool IsShowRecursive();
00290
00291     // retrieves notification manager for observing changes in the
00292     virtual NotificationManager* GetNotificationManager();
00293
00294     // toggle recursion switch
00295     void ToggleRecursion();
00296
00297 };
00298
00299 // interface to r\ecursive display of entries
00300 class KoIgnoreModel : public KiIgnoreModel
00301 {
00302     NotificationManager m_manager;
00303     // manager for change notifications
00304
00305     bool m_isIgnore;
00306     // flag to tell if ignored files are displayed
00307
00308 // Construction
00309 public:
00310     KoIgnoreModel();
00311     ~KoIgnoreModel();
00312
00313 // Interfaces
00314 public:
00315     // returns true if displaying ignored files
00316     virtual bool IsShowIgnored();
00317
00318     // retrieves notification manager for observing changes in the
00319     virtual NotificationManager* GetNotificationManager();
00320
00321     // toggle recursion switch
00322     void ToggleIgnore();
00323 };
00324 #endif
00325 // __MODEL__H__
00326
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CheckoutDlg.cpp Source File

common/CheckoutDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * CheckoutDlg.h : the cvs checkout dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #   include <sys\stat.h>
00030 #   include <direct.h>
00031 #   include <errno.h>
00032 #endif /* WIN32 */
00033
00034 #if qUnix
00035 #   include "UCvsDialogs.h"
00036 #endif
00037
00038 #ifdef qMacCvsPP
00039 #   include <UModalDialogs.h>
00040 #   include <LMultiPanelView.h>
00041 #   include <LPopupGroupBox.h>
00042 #   include <LCheckBox.h>
00043 #   include <LTextEditView.h>
00044 #   include <LEditText.h>
00045 #   include <LPushButton.h>
00046 #   include "LPopupFiller.h"
00047
00048 #   include "MacCvsConstant.h"
00049 #endif /* qMacCvsPP */
00050
00051 #include "CheckoutDlg.h"
00052 #include "CvsPrefs.h"
00053 #include "UpdateDlg.h"
00054 #include "MultiString.h"
00055 #include "PromptFiles.h"
00056 #include "MakeSurePathExists.h"
00057
00058 CMString gOldModules(10, "P_OldModules");
00059
00060 #ifdef WIN32
00061 #   include "GetPrefs.h"
00062 #   ifdef _DEBUG
00063 #   define new DEBUG_NEW
00064 #   undef THIS_FILE
00065     static char THIS_FILE[] = __FILE__;
00066 #   endif
00067
00068 IMPLEMENT_DYNCREATE(CCheckout_MAIN, CPropertyPage)
00069
00070 CCheckout_MAIN::CCheckout_MAIN(const char * modname, const char * path) :
00071     CPropertyPage(CCheckout_MAIN::IDD)
00072 {
00073     //{{AFX_DATA_INIT(CCheckout_MAIN)
00074     m_norecurs = FALSE;
00075     m_stdout = FALSE;
00076     m_overrideCheckoutDir = FALSE;
00077     m_checkoutDir = _T("");
00078     //}}AFX_DATA_INIT
00079     m_modname = modname;
00080     m_path = path;
00081     if( m_path.IsEmpty() )
00082     {
00083         CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00084         if( 0L != app )
00085             m_path = app->GetRoot();
00086     }
00087 }
00088
00089 CCheckout_MAIN::CCheckout_MAIN() : CPropertyPage(CCheckout_MAIN::IDD)
00090 {
00091 }
00092
00093 CCheckout_MAIN::~CCheckout_MAIN()
00094 {
00095 }
00096
00097 void CCheckout_MAIN::DoDataExchange(CDataExchange* pDX)
00098 {
00099     CPropertyPage::DoDataExchange(pDX);
00100
00101     //{{AFX_DATA_MAP(CCheckout_MAIN)
00102     DDX_Control(pDX, IDC_PATH, m_editPath);
00103     DDX_Control(pDX, IDC_MODNAME, m_modcombo);
00104     DDX_Text(pDX, IDC_MODNAME, m_modname);
00105     DDV_MinChars(pDX, m_modname, 1);
00106     DDX_Text(pDX, IDC_PATH, m_path);
00107     DDX_Check(pDX, IDC_NORECURS, m_norecurs);
00108     DDX_Check(pDX, IDC_STDOUT, m_stdout);
00109     DDX_Check(pDX, IDC_CHECK_OVERRIDECHECKOUTDIR, m_overrideCheckoutDir);
00110     DDX_Text(pDX, IDC_EDIT_CHECKOUTDIR, m_checkoutDir);
00111     //}}AFX_DATA_MAP
00112     DDX_ComboMString(pDX, IDC_MODNAME, gOldModules, m_modcombo);
00113
00114     if (pDX->m_bSaveAndValidate)
00115     {
00116         if (!CompatMakeSurePathExists(m_path))
00117         {
00118             AfxMessageBox("Cannot find folder " + m_path);
00119             pDX->PrepareEditCtrl(IDC_PATH);
00120             pDX->Fail();
00121         }
00122     }
00123     else
00124     {
00125         //see if we are overriding the checkout directory
00126         OnCheckOverridecheckoutdir();
00127     }
00128 }
00129
00130
00131 BEGIN_MESSAGE_MAP(CCheckout_MAIN, CPropertyPage)
00132     //{{AFX_MSG_MAP(CCheckout_MAIN)
00133     ON_BN_CLICKED(IDC_BTNPATH, OnBtnPath)
00134     ON_BN_CLICKED(IDC_CHECK_OVERRIDECHECKOUTDIR, OnCheckOverridecheckoutdir)
00135     //}}AFX_MSG_MAP
00136 END_MESSAGE_MAP()
00137
00139 // CCheckout_MAIN message handlers
00140
00141 void CCheckout_MAIN::OnBtnPath()
00142 {
00143     // copy controls to member variables, then update those and finally refresh controls
00144     TCHAR path[_MAX_PATH];
00145     m_editPath.GetWindowText(path, _MAX_PATH);
00146     BOOL selected = BrowserGetDirectory("Select a directory to checkout :", path, MAX_PATH, IsWindow(this->m_hWnd) ? this : NULL );
00147     if (selected)
00148     {
00149         m_path = path;
00150         m_editPath.SetWindowText(path);
00151     }
00152 }
00153
00154 void CCheckout_MAIN::OnCheckOverridecheckoutdir()
00155 {
00156     // TODO: Add your control notification handler code here
00157     CButton* but = (CButton *)GetDlgItem(IDC_CHECK_OVERRIDECHECKOUTDIR);
00158     CWnd* wnd = GetDlgItem(IDC_EDIT_CHECKOUTDIR);
00159     BOOL enableCheckoutDir = but->GetCheck() == 1;
00160
00161     wnd->EnableWindow(enableCheckoutDir);
00162     if( enableCheckoutDir )
00163     {
00164         CString strCheckoutDir;
00165         wnd->GetWindowText(strCheckoutDir);
00166         if( strCheckoutDir.IsEmpty() )
00167         {
00168             CString strModuleName;
00169             if( GetDlgItemText(IDC_MODNAME, strModuleName) )
00170             {
00171                 wnd->SetWindowText(strModuleName);
00172                 GotoDlgCtrl(wnd);
00173             }
00174         }
00175     }
00176 }
00177
00178 IMPLEMENT_DYNCREATE(CCheckout_OPTIONS, CPropertyPage)
00179
00180 CCheckout_OPTIONS::CCheckout_OPTIONS(const char *rev, const char *date) : CPropertyPage(CCheckout_OPTIONS::IDD)
00181 {
00182     //{{AFX_DATA_INIT(CCheckout_OPTIONS)
00183     m_date = date;
00184     m_rev = rev;
00185     m_hasdate = FALSE;
00186     m_match = FALSE;
00187     m_hasrev = FALSE;
00188     m_export = FALSE;
00189     m_forceroot = FALSE;
00190     //}}AFX_DATA_INIT
00191 }
00192
00193 CCheckout_OPTIONS::CCheckout_OPTIONS() : CPropertyPage(CCheckout_OPTIONS::IDD)
00194 {
00195 }
00196
00197 CCheckout_OPTIONS::~CCheckout_OPTIONS()
00198 {
00199 }
00200
00201 void CCheckout_OPTIONS::DoDataExchange(CDataExchange* pDX)
00202 {
00203     CPropertyPage::DoDataExchange(pDX);
00204     //{{AFX_DATA_MAP(CCheckout_OPTIONS)
00205     DDX_Control(pDX, IDC_COMBOREV, m_revdef);
00206     DDX_Control(pDX, IDC_COMBODATE, m_datedef);
00207     DDX_CBString(pDX, IDC_COMBODATE, m_date);
00208     DDX_CBString(pDX, IDC_COMBOREV, m_rev);
00209     DDX_Check(pDX, IDC_DATE, m_hasdate);
00210     DDX_Check(pDX, IDC_MATCH, m_match);
00211     DDX_Check(pDX, IDC_REV, m_hasrev);
00212     DDX_Check(pDX, IDC_EXPORT, m_export);
00213     DDX_Check(pDX, IDC_FORCEROOT, m_forceroot);
00214     //}}AFX_DATA_MAP
00215     if(m_hasrev)
00216         DDV_MinChars(pDX, m_rev, 1);
00217     if(m_hasdate)
00218         DDV_MinChars(pDX, m_date, 1);
00219     if(!pDX->m_bSaveAndValidate)
00220     {
00221         OnDate();
00222         OnRev();
00223     }
00224     DDX_ComboMString(pDX, IDC_COMBOREV, gRevNames, m_revdef);
00225     DDX_ComboMString(pDX, IDC_COMBODATE, gDateNames, m_datedef);
00226 }
00227
00228
00229 BEGIN_MESSAGE_MAP(CCheckout_OPTIONS, CPropertyPage)
00230     //{{AFX_MSG_MAP(CCheckout_OPTIONS)
00231     ON_BN_CLICKED(IDC_DATE, OnDate)
00232     ON_BN_CLICKED(IDC_REV, OnRev)
00233     //}}AFX_MSG_MAP
00234 END_MESSAGE_MAP()
00235
00237 // CCheckout_OPTIONS message handlers
00238
00239 void CCheckout_OPTIONS::OnDate()
00240 {
00241     CButton* but = (CButton *)GetDlgItem(IDC_DATE);
00242     CWnd* wnd = GetDlgItem(IDC_COMBODATE);
00243     wnd->EnableWindow(but->GetCheck() == 1);
00244 }
00245
00246 void CCheckout_OPTIONS::OnRev()
00247 {
00248     CButton* but = (CButton *)GetDlgItem(IDC_REV);
00249     CWnd* wnd = GetDlgItem(IDC_COMBOREV);
00250     wnd->EnableWindow(but->GetCheck() == 1);
00251 }
00252 #endif /* WIN32 */
00253
00254 #ifdef qMacCvsPP
00255 static void DoDataExchange_CheckoutMain(LWindow *theDialog, CPStr & modname,
00256     bool & norecurs, bool & toStdout, bool & overrideCheckoutDir, CPStr & checkoutDir, bool putValue)
00257 {
00258     LEditText *mname = dynamic_cast<LEditText*>
00259         (theDialog->FindPaneByID(item_ModuleName));
00260     LPopupFiller *filler = dynamic_cast<LPopupFiller*>
00261         (theDialog->FindPaneByID(item_PopModName));
00262
00263     filler->DoDataExchange(gOldModules, putValue);
00264
00265     DoDataExchange (theDialog, item_NoRecurs, norecurs, putValue);
00266     DoDataExchange (theDialog, item_ToStout, toStdout, putValue);
00267     DoDataExchange (theDialog, item_CheckGroupPath, overrideCheckoutDir, putValue);
00268     DoDataExchange (theDialog, item_EditPath, checkoutDir, putValue);
00269
00270     if(putValue)
00271     {
00272         mname->SetText((Ptr)(const char *)modname, modname.length());
00273         theDialog->SetLatentSub(mname);
00274
00275         // this will take care about an empty module name
00276         mname->AddListener(GetDlgHandler());
00277         if(modname.length() == 0)
00278         {
00279             LPushButton *theOK = dynamic_cast<LPushButton*>
00280                                         (theDialog->FindPaneByID(item_OK));
00281             Assert_(theOK != 0L);
00282             theOK->Disable();
00283         }
00284     }
00285     else
00286     {
00287         char buf[512];
00288         Size len;
00289         mname->GetText(buf, 511, &len);
00290         modname.set(buf, len);
00291         }
00292 }
00293
00294
00295
00296 static void
00297 DoDataExchange_CheckoutOptions(
00298
00299     LView *theDialog,
00300     bool & hasDate,
00301     bool & hasRev,
00302     CPStr & sLastDate,
00303     CPStr & sLastRev,
00304     bool & useMostRecent,
00305     bool & doexport,
00306     bool & forceCvsroot,
00307     bool putValue)
00308
00309 {
00310     LPopupFiller *fillTag = dynamic_cast<LPopupFiller*>
00311         (theDialog->FindPaneByID(item_FillerTag));
00312     LPopupFiller *fillDate = dynamic_cast<LPopupFiller*>
00313         (theDialog->FindPaneByID(item_FillerDate));
00314
00315     fillTag->DoDataExchange(gRevNames, putValue);
00316     fillDate->DoDataExchange(gDateNames, putValue);
00317
00318     DoDataExchange (theDialog, item_CheckDate, hasDate, putValue);
00319     DoDataExchange (theDialog, item_CheckRevTag, hasRev, putValue);
00320     DoDataExchange (theDialog, item_EditDate, sLastDate, putValue);
00321     DoDataExchange (theDialog, item_EditRevTag, sLastRev, putValue);
00322     DoDataExchange (theDialog, item_MostRecentRev, useMostRecent, putValue);
00323     DoDataExchange (theDialog, item_CheckForceRoot, forceCvsroot, putValue);
00324     DoDataExchange (theDialog, item_CheckExport, doexport, putValue);
00325
00326 }
00327 #endif /* qMacCvsPP */
00328
00329 #if qUnix
00330 class UCvsCheckout : public UWidget
00331 {
00332     UDECLARE_DYNAMIC(UCvsCheckout)
00333 public:
00334     UCvsCheckout() : UWidget(::UEventGetWidID()) {}
00335     virtual ~UCvsCheckout() {}
00336
00337     enum
00338     {
00339         kOK = EV_COMMAND_START, // 0
00340         kCancel,                // 1
00341         kTabGeneral             // 2
00342     };
00343
00344     virtual void DoDataExchange(bool fill);
00345
00346 protected:
00347     ev_msg int OnOK(void);
00348     ev_msg int OnCancel(void);
00349
00350     UDECLARE_MESSAGE_MAP()
00351 };
00352
00353 UIMPLEMENT_DYNAMIC(UCvsCheckout, UWidget)
00354
00355 UBEGIN_MESSAGE_MAP(UCvsCheckout, UWidget)
00356     ON_UCOMMAND(UCvsCheckout::kOK, UCvsCheckout::OnOK)
00357     ON_UCOMMAND(UCvsCheckout::kCancel, UCvsCheckout::OnCancel)
00358 UEND_MESSAGE_MAP()
00359
00360 int UCvsCheckout::OnOK(void)
00361 {
00362     EndModal(true);
00363     return 0;
00364 }
00365
00366 int UCvsCheckout::OnCancel(void)
00367 {
00368     EndModal(false);
00369     return 0;
00370 }
00371
00372 void UCvsCheckout::DoDataExchange(bool fill)
00373 {
00374     if(fill)
00375     {
00376     }
00377     else
00378     {
00379     }
00380 }
00381
00382 class UCvsCheckout_MAIN : public UWidget
00383 {
00384     UDECLARE_DYNAMIC(UCvsCheckout_MAIN)
00385 public:
00386     UCvsCheckout_MAIN(const char * modname, const char * path);
00387     virtual ~UCvsCheckout_MAIN() {}
00388
00389     enum
00390     {
00391         kComboPath = EV_COMMAND_START,  // 0
00392         kStaticPath,            // 1
00393         kBtnPath,               // 2
00394         kCheckStdout,           // 3
00395         kCheckRecurse           // 4
00396     };
00397
00398     virtual void DoDataExchange(bool fill);
00399
00400     UStr m_path;
00401     UStr m_modname;
00402     bool m_norecurs;
00403     bool m_stdout;
00404
00405 protected:
00406     ev_msg int OnPath(void);
00407
00408     UDECLARE_MESSAGE_MAP()
00409 };
00410
00411 UIMPLEMENT_DYNAMIC(UCvsCheckout_MAIN, UWidget)
00412
00413 UBEGIN_MESSAGE_MAP(UCvsCheckout_MAIN, UWidget)
00414     ON_UCOMMAND(UCvsCheckout_MAIN::kBtnPath, UCvsCheckout_MAIN::OnPath)
00415 UEND_MESSAGE_MAP()
00416
00417 UCvsCheckout_MAIN::UCvsCheckout_MAIN(const char * modname, const char * path) : UWidget(::UEventGetWidID())
00418 {
00419     m_path = path;
00420     m_modname = modname;
00421     m_norecurs = false;
00422     m_stdout = false;
00423 }
00424
00425 int UCvsCheckout_MAIN::OnPath(void)
00426 {
00427     const char *dir = BrowserGetDirectory("Select a directory to checkout to :");
00428     if(dir != 0L)
00429         UEventSendMessage(GetWidID(), EV_SETTEXT, kStaticPath, (void *)dir);
00430
00431     return 0;
00432 }
00433
00434 void UCvsCheckout_MAIN::DoDataExchange(bool fill)
00435 {
00436     ::DoDataExchange(fill, GetWidID(), kComboPath, gOldModules);
00437
00438     if(fill)
00439     {
00440         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckStdout, m_stdout), 0L);
00441         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRecurse, m_norecurs), 0L);
00442
00443         UEventSendMessage(GetWidID(), EV_SETTEXT, kComboPath, (void *)(const char *)m_modname);
00444         UEventSendMessage(GetWidID(), EV_SETTEXT, kStaticPath, (void *)(const char *)m_path);
00445     }
00446     else
00447     {
00448         m_stdout = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckStdout, 0L) != 0;
00449         m_norecurs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRecurse, 0L) != 0;
00450
00451         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboPath, &m_modname);
00452         UEventSendMessage(GetWidID(), EV_GETTEXT, kStaticPath, &m_path);
00453     }
00454 }
00455
00456 class UCvsCheckout_STICKY : public UWidget
00457 {
00458     UDECLARE_DYNAMIC(UCvsCheckout_STICKY)
00459 public:
00460     UCvsCheckout_STICKY(const char *rev, const char *date);
00461     virtual ~UCvsCheckout_STICKY() {}
00462
00463     enum
00464     {
00465         kCheckDate = EV_COMMAND_START,  // 0
00466         kComboDate,         // 1
00467         kCheckRev,          // 2
00468         kComboRev,          // 3
00469         kCheckMatch         // 4
00470     };
00471
00472     virtual void DoDataExchange(bool fill);
00473
00474     UStr m_date;
00475     UStr m_rev;
00476     bool m_hasdate;
00477     bool m_hasrev;
00478     bool m_match;
00479 protected:
00480
00481     ev_msg int OnDate(void);
00482     ev_msg int OnRev(void);
00483
00484     UDECLARE_MESSAGE_MAP()
00485 };
00486
00487 UIMPLEMENT_DYNAMIC(UCvsCheckout_STICKY, UWidget)
00488
00489 UBEGIN_MESSAGE_MAP(UCvsCheckout_STICKY, UWidget)
00490     ON_UCOMMAND(UCvsCheckout_STICKY::kCheckDate, UCvsCheckout_STICKY::OnDate)
00491     ON_UCOMMAND(UCvsCheckout_STICKY::kCheckRev, UCvsCheckout_STICKY::OnRev)
00492 UEND_MESSAGE_MAP()
00493
00494 UCvsCheckout_STICKY::UCvsCheckout_STICKY(const char *rev, const char *date) : UWidget(::UEventGetWidID())
00495 {
00496     m_date = date;
00497     m_rev = rev;
00498     m_hasdate = false;
00499     m_hasrev = false;
00500     m_match = false;
00501 }
00502
00503 int UCvsCheckout_STICKY::OnDate()
00504 {
00505     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDate, 0L);
00506     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboDate, state), 0L);
00507     return 0;
00508 }
00509
00510 int UCvsCheckout_STICKY::OnRev()
00511 {
00512     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRev, 0L);
00513     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboRev, state), 0L);
00514     return 0;
00515 }
00516
00517 void UCvsCheckout_STICKY::DoDataExchange(bool fill)
00518 {
00519     ::DoDataExchange(fill, GetWidID(), kComboRev, gRevNames);
00520     ::DoDataExchange(fill, GetWidID(), kComboDate, gDateNames);
00521
00522     if(fill)
00523     {
00524         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckDate, m_hasdate), 0L);
00525         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRev, m_hasrev), 0L);
00526         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckMatch, m_match), 0L);
00527
00528         OnDate();
00529         OnRev();
00530     }
00531     else
00532     {
00533         m_hasdate = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDate, 0L);
00534         m_hasrev = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRev, 0L);
00535         m_match = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckMatch, 0L);
00536
00537         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboDate, &m_date);
00538         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboRev, &m_rev);
00539     }
00540 }
00541
00542 class UCvsCheckout_OPTIONS : public UWidget
00543 {
00544     UDECLARE_DYNAMIC(UCvsCheckout_OPTIONS)
00545 public:
00546     UCvsCheckout_OPTIONS();
00547     virtual ~UCvsCheckout_OPTIONS() {}
00548
00549     enum
00550     {
00551         kCheckForce = EV_COMMAND_START, // 0
00552         kCheckExport        // 1
00553     };
00554
00555     virtual void DoDataExchange(bool fill);
00556
00557     bool m_export;
00558     bool m_forceroot;
00559 protected:
00560
00561     UDECLARE_MESSAGE_MAP()
00562 };
00563
00564 UIMPLEMENT_DYNAMIC(UCvsCheckout_OPTIONS, UWidget)
00565
00566 UBEGIN_MESSAGE_MAP(UCvsCheckout_OPTIONS, UWidget)
00567 UEND_MESSAGE_MAP()
00568
00569 UCvsCheckout_OPTIONS::UCvsCheckout_OPTIONS() : UWidget(::UEventGetWidID())
00570 {
00571     m_export = false;
00572     m_forceroot = false;
00573 }
00574
00575 void UCvsCheckout_OPTIONS::DoDataExchange(bool fill)
00576 {
00577     if(fill)
00578     {
00579         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckForce, m_forceroot), 0L);
00580         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckExport, m_export), 0L);
00581     }
00582     else
00583     {
00584         m_forceroot = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckForce, 0L);
00585         m_export = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckExport, 0L);
00586     }
00587 }
00588 #endif // qUnix
00589
00590 bool CompatGetCheckout(CPStr & modname, CPStr & path, bool & norecurs,
00591                        bool & toStdout, CPStr & date, CPStr & rev,
00592                        bool & useMostRecent, bool & doexport, bool & forceCvsroot,
00593                        bool & overrideCheckoutDir, CPStr & checkoutDir)
00594 {
00595     bool userHitOK = false;
00596
00597     date = "";
00598     rev = "";
00599     modname = "";
00600     norecurs = false;
00601     toStdout = false;
00602     useMostRecent = false;
00603     doexport = false;
00604     forceCvsroot = false;
00605     overrideCheckoutDir = false;
00606
00607     bool hasDate = false;
00608     bool hasRev = false;
00609     static CPStr sLastModName;
00610     static CPStr sLastRev;
00611     static CPStr sLastDate;
00612
00613 #ifdef WIN32
00614     CPropertySheet pages("Checkout settings");
00615     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00616     CCheckout_MAIN page1(sLastModName, path);
00617     CCheckout_OPTIONS page2(sLastRev, sLastDate);
00618     CGetPrefs_CVSROOT page3;
00619     CGetPrefs_GLOBALS page4;
00620     pages.AddPage(&page1);
00621     pages.AddPage(&page2);
00622     pages.AddPage(&page3);
00623     pages.AddPage(&page4);
00624     if(pages.DoModal() == IDOK)
00625     {
00626         sLastModName = (const char *)page1.m_modname;
00627         path = (const char *)page1.m_path;
00628         norecurs = page1.m_norecurs == TRUE;
00629         toStdout = page1.m_stdout == TRUE;
00630         overrideCheckoutDir = page1.m_overrideCheckoutDir == TRUE;
00631         checkoutDir = (const char *)page1.m_checkoutDir;
00632
00633         sLastDate = page2.m_date;
00634         sLastRev = page2.m_rev;
00635         hasDate = page2.m_hasdate == TRUE;
00636         hasRev = page2.m_hasrev == TRUE;
00637         useMostRecent = page2.m_match == TRUE;
00638         doexport = page2.m_export == TRUE;
00639         forceCvsroot = page2.m_forceroot == TRUE;
00640
00641         page3.StoreValues();
00642         page4.StoreValues();
00643         userHitOK = true;
00644     }
00645 #endif /* WIN32 */
00646 #ifdef qMacCvsPP
00647     StDialogHandler theHandler(dlg_Checkout, LCommander::GetTopCommander());
00648     LWindow *theDialog = theHandler.GetDialog();
00649     ThrowIfNil_(theDialog);
00650     static UInt16 sRuntimePanel = 1;
00651
00652     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00653         (theDialog->FindPaneByID(item_MultiViewPrefs));
00654     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00655
00656     multiView->SwitchToPanel(3);
00657     DoDataExchange_Globals(theDialog, true);
00658     multiView->SwitchToPanel(2);
00659     DoDataExchange_CheckoutOptions(theDialog, hasDate, hasRev,
00660         sLastDate, sLastRev, useMostRecent, doexport, forceCvsroot, true);
00661     multiView->SwitchToPanel(1);
00662     DoDataExchange_CheckoutMain(theDialog, sLastModName, norecurs, toStdout, overrideCheckoutDir, checkoutDir, true);
00663     dynamic_cast<LBroadcaster*> (theDialog->FindPaneByID (item_EditPath))->AddListener (&theHandler);
00664     dynamic_cast<LBroadcaster*> (theDialog->FindPaneByID (item_CheckGroupPath))->AddListener (&theHandler);
00665
00666
00667     groupView->SetValue(sRuntimePanel);
00668     theDialog->Show();
00669     MessageT hitMessage;
00670     while (true)
00671     {       // Let DialogHandler process events
00672         hitMessage = theHandler.DoDialog();
00673
00674         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00675             break;
00676
00677         if(hitMessage == item_CheckGroupPath || hitMessage == item_EditPath)
00678         {
00679             if(theDialog->GetValueForPaneID(item_CheckGroupPath) == Button_Off)
00680             {
00681                 continue;
00682             }
00683
00684             const char* dir = BrowserGetDirectory("Select the checkout directory :");
00685             if(dir != 0L)
00686             {
00687                 CPStr tmp(dir);
00688                 theDialog->SetDescriptorForPaneID(item_EditPath, tmp);
00689             }
00690             else if(hitMessage == item_CheckGroupPath)
00691             {
00692                 theDialog->SetValueForPaneID(item_CheckGroupPath, Button_Off);
00693             }
00694         }
00695     }
00696     theDialog->Hide();
00697     sRuntimePanel = groupView->GetValue();
00698
00699     if(hitMessage == msg_OK)
00700     {
00701         multiView->SwitchToPanel(1);
00702         DoDataExchange_CheckoutMain(theDialog, sLastModName, norecurs, toStdout, overrideCheckoutDir, checkoutDir, false);
00703         multiView->SwitchToPanel(2);
00704         DoDataExchange_CheckoutOptions(theDialog, hasDate, hasRev,
00705             sLastDate, sLastRev, useMostRecent, doexport, forceCvsroot, false);
00706         multiView->SwitchToPanel(3);
00707         DoDataExchange_Globals(theDialog, false);
00708
00709         Assert_(sLastModName.length() != 0);
00710
00711         userHitOK = true;
00712     }
00713 #endif /* qMacCvsPP */
00714 #if qUnix
00715     void *wid = UCreate_CheckoutDlg();
00716
00717     UCvsCheckout *dlg = new UCvsCheckout();
00718     UCvsCheckout_MAIN *tab1 = new UCvsCheckout_MAIN(sLastModName, path);
00719     UCvsCheckout_STICKY *tab2 = new UCvsCheckout_STICKY(sLastRev, sLastDate);
00720     UCvsCheckout_OPTIONS *tab3 = new UCvsCheckout_OPTIONS();
00721     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00722     dlg->AddPage(tab1, UCvsCheckout::kTabGeneral, 0);
00723     dlg->AddPage(tab2, UCvsCheckout::kTabGeneral, 1);
00724     dlg->AddPage(tab3, UCvsCheckout::kTabGeneral, 2);
00725
00726     if(dlg->DoModal())
00727     {
00728         sLastModName = tab1->m_modname;
00729         path = tab1->m_path;
00730         norecurs = tab1->m_norecurs;
00731         toStdout = tab1->m_stdout;
00732
00733         sLastDate = tab2->m_date;
00734         sLastRev = tab2->m_rev;
00735         hasDate = tab2->m_hasdate;
00736         hasRev = tab2->m_hasrev;
00737         useMostRecent = tab2->m_match;
00738
00739         doexport = tab3->m_export;
00740         forceCvsroot = tab3->m_forceroot;
00741
00742         userHitOK = true;
00743     }
00744
00745     delete dlg;
00746 #endif // qUnix
00747
00748     if(userHitOK)
00749     {
00750         if(hasDate && !sLastDate.empty())
00751             date = sLastDate;
00752         if(hasRev && !sLastRev.empty())
00753             rev = sLastRev;
00754
00755         modname = sLastModName;
00756
00757         gCvsPrefs.save();
00758     }
00759     return userHitOK;
00760 }
00761
00762
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CheckoutDlg.h Source File

common/CheckoutDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * CheckoutDlg.cpp : the cvs checkout dialog
00023  */
00024
00025 #if !defined(AFX_CHECKOUTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_CHECKOUTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 #include "CPStr.h"
00033 #include "MultiString.h"
00034
00035 bool CompatGetCheckout(CPStr & modname, CPStr & path, bool & norecurs,
00036                        bool & toStdout, CPStr & date, CPStr & rev,
00037                        bool & useMostRecent, bool & doexport, bool & forceCvsroot,
00038                        bool & overrideCheckoutDir, CPStr & checkoutDir);
00039     // get the checkout module name and misc options...
00040
00041 extern CMString gOldModules;
00042
00043 #ifdef WIN32
00044 class CCheckout_MAIN : public CPropertyPage
00045 {
00046     DECLARE_DYNCREATE(CCheckout_MAIN)
00047
00048 // Construction
00049 public:
00050     CCheckout_MAIN();
00051     CCheckout_MAIN(const char * modname, const char * path);
00052     ~CCheckout_MAIN();
00053
00054 // Dialog Data
00055     //{{AFX_DATA(CCheckout_MAIN)
00056     enum { IDD = IDD_CHECKOUT_MAIN };
00057     CEdit   m_editPath;
00058     CComboBox   m_modcombo;
00059     CString m_modname;
00060     CString m_path;
00061     BOOL    m_norecurs;
00062     BOOL    m_stdout;
00063     BOOL    m_overrideCheckoutDir;
00064     CString m_checkoutDir;
00065     //}}AFX_DATA
00066
00067
00068 // Overrides
00069     // ClassWizard generate virtual function overrides
00070     //{{AFX_VIRTUAL(CCheckout_MAIN)
00071     protected:
00072     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00073     //}}AFX_VIRTUAL
00074
00075 // Implementation
00076 protected:
00077     // Generated message map functions
00078     //{{AFX_MSG(CCheckout_MAIN)
00079     afx_msg void OnBtnPath();
00080     afx_msg void OnCheckOverridecheckoutdir();
00081     //}}AFX_MSG
00082     DECLARE_MESSAGE_MAP()
00083
00084 };
00085
00086 class CCheckout_OPTIONS : public CPropertyPage
00087 {
00088     DECLARE_DYNCREATE(CCheckout_OPTIONS)
00089
00090 // Construction
00091 public:
00092     CCheckout_OPTIONS(const char *rev, const char *date);
00093     CCheckout_OPTIONS();
00094     ~CCheckout_OPTIONS();
00095
00096 // Dialog Data
00097     //{{AFX_DATA(CCheckout_OPTIONS)
00098     enum { IDD = IDD_CHECKOUT_OPTIONS };
00099     CComboBox   m_revdef;
00100     CComboBox   m_datedef;
00101     CString m_date;
00102     CString m_rev;
00103     BOOL    m_hasdate;
00104     BOOL    m_match;
00105     BOOL    m_hasrev;
00106     BOOL    m_export;
00107     BOOL    m_forceroot;
00108     //}}AFX_DATA
00109
00110
00111 // Overrides
00112     // ClassWizard generate virtual function overrides
00113     //{{AFX_VIRTUAL(CCheckout_OPTIONS)
00114     protected:
00115     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00116     //}}AFX_VIRTUAL
00117
00118 // Implementation
00119 protected:
00120     // Generated message map functions
00121     //{{AFX_MSG(CCheckout_OPTIONS)
00122     afx_msg void OnDate();
00123     afx_msg void OnRev();
00124     //}}AFX_MSG
00125     DECLARE_MESSAGE_MAP()
00126
00127 };
00128
00129 //{{AFX_INSERT_LOCATION}}
00130 #endif /* WIN32 */
00131
00132 #endif // !defined(AFX_CHECKOUTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CommitDlg.cpp Source File

common/CommitDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 1998
00019  */
00020
00021 /*
00022  * CommitDlg.cpp : the cvs commit dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #   include <process.h>
00030 #else /* !WIN32 */
00031 #   include <ctype.h>
00032 #endif /* !WIN32 */
00033
00034 #if qUnix
00035 #   include "UCvsDialogs.h"
00036 #endif
00037
00038 #ifdef qMacCvsPP
00039 #   include <UModalDialogs.h>
00040 #   include <LMultiPanelView.h>
00041 #   include <LPopupGroupBox.h>
00042 #   include <LCheckBox.h>
00043 #   include <LTextEditView.h>
00044 #   include "LPopupFiller.h"
00045
00046 #   include "MacCvsConstant.h"
00047 #endif /* qMacCvsPP */
00048
00049 #include "CommitDlg.h"
00050 #include "CvsPrefs.h"
00051 #include "getline.h"
00052 #include "TextBinary.h"
00053 #include "MultiString.h"
00054 #include "CvsCommands.h"
00055 #include "EditorMonDlg.h"
00056
00057 static CMString gCommitLogs(10, "P_CommitLogs");
00058
00059 void combozify(CStr & str)
00060 {
00061     // extract the first xxx words
00062     const char *tmp = str;
00063     CStr result;
00064     int numWords = 0;
00065 #   define HOWMUCH_WORDS 5
00066     while(*tmp != '\0' && numWords < HOWMUCH_WORDS)
00067     {
00068         while(*tmp != '\0' && isspace(*tmp))
00069             tmp++;
00070
00071         while(*tmp != '\0' && !isspace(*tmp))
00072             result << *tmp ++;
00073
00074         if(*tmp != '\0')
00075             result << ' ';
00076
00077         numWords++;
00078     }
00079
00080     if(*tmp != '\0')
00081     {
00082         result << "...";
00083     }
00084     str = result;
00085 }
00086
00087 #ifdef WIN32
00088 #   include "GetPrefs.h"
00089 #   ifdef _DEBUG
00090 #       define new DEBUG_NEW
00091 #       undef THIS_FILE
00092         static char THIS_FILE[] = __FILE__;
00093 #   endif
00094
00095 IMPLEMENT_DYNCREATE(CCommit_MAIN, CPropertyPage)
00096
00097 CCommit_MAIN::CCommit_MAIN() : CPropertyPage(CCommit_MAIN::IDD)
00098 {
00099 }
00100
00101 CCommit_MAIN::CCommit_MAIN(const char *logmsg, const char *pathTmpl, MultiFiles *mf) :
00102     CPropertyPage(CCommit_MAIN::IDD)
00103 {
00104     //{{AFX_DATA_INIT(CCommit_MAIN)
00105     m_logmsg = logmsg;
00106     m_norecurs = FALSE;
00107     m_wordwrap = FALSE;
00108     //}}AFX_DATA_INIT
00109     m_tmplPath = pathTmpl;
00110     if(!m_tmplPath.empty())
00111     {
00112         if(!m_tmplPath.endsWith(kPathDelimiter))
00113             m_tmplPath << kPathDelimiter;
00114         m_tmplPath << "CVS";
00115         m_tmplPath << kPathDelimiter;
00116         m_tmplPath << "Template";
00117     }
00118     m_pmfarg = mf;
00119
00120     m_bSwitchingWrap = FALSE;
00121     m_wordwrap = gCvsPrefs.WordWrapLogMsg();
00122 }
00123
00124 CCommit_MAIN::~CCommit_MAIN()
00125 {
00126 }
00127
00128 void CCommit_MAIN::DoDataExchange(CDataExchange* pDX)
00129 {
00130     CPropertyPage::DoDataExchange(pDX);
00131     //{{AFX_DATA_MAP(CCommit_MAIN)
00132     DDX_Control(pDX, IDC_FILETODIFF, m_fileToDiffCombo);
00133     DDX_Control(pDX, IDC_WORDWRAP, m_wordwrapctrl);
00134     DDX_Control(pDX, IDC_LOGMSG_WRAP, m_logmsgctrlwrap);
00135     DDX_Control(pDX, IDC_LOGMSG, m_logmsgctrl);
00136     DDX_Control(pDX, IDC_COMBO, m_combodef);
00137     DDX_Check(pDX, IDC_NORECURS, m_norecurs);
00138     DDX_Check(pDX, IDC_WORDWRAP, m_wordwrap);
00139     //}}AFX_DATA_MAP
00140
00141     //JK - this DDX call is outside the main section to allow class wizard parse properly
00142     if( !pDX->m_bSaveAndValidate )
00143     {
00144         DDX_Text(pDX, IDC_LOGMSG_WRAP, m_logmsg);
00145         DDX_Text(pDX, IDC_LOGMSG, m_logmsg);
00146     }
00147     else
00148     {
00149         DDX_Text(pDX, GetLogMsgID(), m_logmsg);
00150     }
00151
00152     if(!pDX->m_bSaveAndValidate)
00153     {
00154         m_combodef.ResetContent();
00155         m_combodef.AddString("Insert CVS/Template");
00156         const NAMESPACE(std) vector<CStr> & list = gCommitLogs.GetList();
00157         NAMESPACE(std) vector<CStr>::const_iterator i;
00158         for(i = list.begin(); i != list.end(); ++i)
00159         {
00160             CStr str = *i;
00161             combozify(str);
00162             m_combodef.AddString(str);
00163         }
00164     }
00165     else
00166     {
00167         if(!m_logmsg.IsEmpty())
00168         {
00169             gCommitLogs.Insert(m_logmsg);
00170         }
00171     }
00172 }
00173
00174 void CCommit_MAIN::OnSelchangeCombo()
00175 {
00176     int sel = m_combodef.GetCurSel();
00177     if(sel == CB_ERR)
00178         return;
00179
00180     CEdit* pEdit = (CEdit*)GetLogMsgWnd();
00181
00182     pEdit->SetSel(0, -1);
00183     if(sel == 0)
00184     {
00185         bool gotIt = false;
00186         FILE *output;
00187
00188         if(!m_tmplPath.empty() && (output = fopen(m_tmplPath, "r")) != 0L)
00189         {
00190             char *line = 0L;
00191             size_t line_chars_allocated = 0;
00192             int line_length;
00193             while ((line_length = getline (&line, &line_chars_allocated, output)) > 0)
00194             {
00195                 //correct the new line characters for edit box and insert the line
00196                 CString strLine(line);
00197                 strLine.Replace( "\n", "\r\n" );
00198                 pEdit->ReplaceSel(strLine);
00199             }
00200
00201             gotIt = true;
00202             if (line_length < 0 && !feof (output))
00203                 gotIt = false;
00204
00205             if(line != 0L)
00206                 free (line);
00207
00208             fclose(output);
00209         }
00210         if(!gotIt)
00211             pEdit->ReplaceSel("*found no CVS/Template file*");
00212     }
00213     else
00214     {
00215         const NAMESPACE(std) vector<CStr> & list = gCommitLogs.GetList();
00216         pEdit->ReplaceSel(list[sel - 1]);
00217     }
00218 }
00219
00220 BEGIN_MESSAGE_MAP(CCommit_MAIN, CPropertyPage)
00221     //{{AFX_MSG_MAP(CCommit_MAIN)
00222     ON_CBN_SELCHANGE(IDC_COMBO, OnSelchangeCombo)
00223     ON_BN_CLICKED(IDC_LAUNCHEDITOR, OnLauncheditor)
00224     ON_WM_ERASEBKGND()
00225     ON_BN_CLICKED(IDC_WORDWRAP, OnWordwrap)
00226     ON_BN_CLICKED(IDC_DIFF, OnDiff)
00227     //}}AFX_MSG_MAP
00228 END_MESSAGE_MAP()
00229
00230 BOOL CCommit_MAIN::PreTranslateMessage(MSG* pMsg)
00231 {
00232     if( pMsg->message >= WM_KEYFIRST ||
00233         pMsg->message <= WM_KEYLAST ||
00234         pMsg->message == WM_COPY || pMsg->message == WM_CUT || pMsg->message == WM_PASTE )
00235     {
00236         UpdateInfo();
00237     }
00238
00239     return CPropertyPage::PreTranslateMessage(pMsg);
00240 }
00241
00242 void CCommit_MAIN::UpdateInfo()
00243 {
00244     CEdit* pEdit = (CEdit*)GetLogMsgWnd();
00245
00246     CString strOldInfo;
00247     CString strInfo;
00248     int nLineNumber = pEdit->LineFromChar();
00249     int nLineLenght = pEdit->LineLength( pEdit->LineIndex() );
00250
00251     strInfo.Format( "Line %d (%d chars)", nLineNumber + 1, nLineLenght );
00252
00253     GetDlgItemText( IDC_EDIT_POSITION, strOldInfo );
00254     if( strOldInfo != strInfo )
00255     {
00256         SetDlgItemText( IDC_EDIT_POSITION, strInfo );
00257     }
00258 }
00259
00260 void CCommit_MAIN::OnLauncheditor()
00261 {
00262     UStr message;
00263
00264     if( CompatGetEditorMsg(message) )
00265     {
00266         CString strMessage(message);
00267         strMessage.Replace("\n", "\r\n");
00268
00269         if( !strMessage.IsEmpty() )
00270         {
00271             CEdit* pEdit = (CEdit*)GetLogMsgWnd();
00272             pEdit->SetSel(0, -1);
00273             pEdit->ReplaceSel(strMessage);
00274         }
00275     }
00276
00277     GotoDlgCtrl( GetLogMsgWnd() );
00278 }
00279
00280 //switch the edit boxes
00281 void CCommit_MAIN::SwitchWrapEdit(BOOL bWordWrap)
00282 {
00283     CString strMessage;
00284
00285     if( bWordWrap )
00286     {
00287         m_logmsgctrl.GetWindowText( strMessage );
00288         m_logmsgctrlwrap.SetWindowText( strMessage );
00289
00290         m_bSwitchingWrap = TRUE;
00291         m_logmsgctrl.ShowWindow( SW_HIDE );
00292         m_logmsgctrlwrap.ShowWindow( SW_SHOW );
00293         m_bSwitchingWrap = FALSE;
00294     }
00295     else
00296     {
00297         m_logmsgctrlwrap.GetWindowText( strMessage );
00298         m_logmsgctrl.SetWindowText( strMessage );
00299
00300         m_bSwitchingWrap = TRUE;
00301         m_logmsgctrlwrap.ShowWindow( SW_HIDE );
00302         m_logmsgctrl.ShowWindow( SW_SHOW );
00303         m_bSwitchingWrap = FALSE;
00304     }
00305 }
00306
00307 int CCommit_MAIN::GetLogMsgID()
00308 {
00309     return m_wordwrapctrl.GetCheck() ? IDC_LOGMSG_WRAP : IDC_LOGMSG;
00310 }
00311
00312 CWnd* CCommit_MAIN::GetLogMsgWnd()
00313 {
00314     return GetDlgItem( GetLogMsgID() );
00315 }
00316
00317 BOOL CCommit_MAIN::OnEraseBkgnd(CDC* pDC)
00318 {
00319     if( m_bSwitchingWrap )
00320     {
00321         return TRUE;
00322     }
00323
00324     return CPropertyPage::OnEraseBkgnd(pDC);
00325 }
00326
00327 void CCommit_MAIN::OnWordwrap()
00328 {
00329     gCvsPrefs.SetWordWrapLogMsg( m_wordwrapctrl.GetCheck() );
00330
00331     SwitchWrapEdit( gCvsPrefs.WordWrapLogMsg() );
00332 }
00333
00334 void CCommit_MAIN::OnDiff()
00335 {
00336     const int nComboIndex = m_fileToDiffCombo.GetCurSel();
00337     if( nComboIndex > CB_ERR )
00338     {
00339         int nIndex = (int)m_fileToDiffCombo.GetItemData(nComboIndex);
00340         CStr path;
00341         CStr fileName;
00342         if( m_pmfarg->get(nIndex, path, fileName) )
00343         {
00344             MultiFiles mf;
00345             mf.newdir(path);
00346             mf.newfile(fileName);
00347
00348             CvsCmdDiffFiles(&mf);
00349         }
00350     }
00351 }
00352
00353 BOOL CCommit_MAIN::OnInitDialog()
00354 {
00355     CPropertyPage::OnInitDialog();
00356
00357     // Extra initialization here
00358     SwitchWrapEdit( gCvsPrefs.WordWrapLogMsg() );
00359     if( m_pmfarg )
00360     {
00361         for( int nIndex = 0; nIndex < m_pmfarg->NumFiles(); nIndex++ )
00362         {
00363             CStr path;
00364             CStr fileName;
00365             m_pmfarg->get(nIndex, path, fileName);
00366             int nComboIndex = m_fileToDiffCombo.AddString(CString(path) + CString(fileName));
00367             m_fileToDiffCombo.SetItemData(nComboIndex, (DWORD)nIndex);
00368         }
00369     }
00370
00371     if( m_fileToDiffCombo.GetCount() )
00372     {
00373         //set the combo box to read-only
00374         CEdit* pEdit = (CEdit*)m_fileToDiffCombo.GetDlgItem(1001);
00375         if( pEdit && IsWindow(pEdit->m_hWnd) )
00376         {
00377             pEdit->SetReadOnly();
00378         }
00379
00380         m_fileToDiffCombo.SetCurSel(0);
00381     }
00382     else
00383     {
00384         m_fileToDiffCombo.EnableWindow(FALSE);
00385         CWnd* pButton = GetDlgItem(IDC_DIFF);
00386         if( pButton )
00387         {
00388             pButton->EnableWindow(FALSE);
00389         }
00390     }
00391
00392     return TRUE;  // return TRUE unless you set the focus to a control
00393                   // EXCEPTION: OCX Property Pages should return FALSE
00394 }
00395
00396
00398 // CCommit_OPTIONS property page
00399
00400 IMPLEMENT_DYNCREATE(CCommit_OPTIONS, CPropertyPage)
00401
00402 CCommit_OPTIONS::CCommit_OPTIONS() : CPropertyPage(CCommit_OPTIONS::IDD)
00403 {
00404     //{{AFX_DATA_INIT(CCommit_OPTIONS)
00405     m_forceCommit = FALSE;
00406     m_rev = _T("");
00407     m_forceRecurse = FALSE;
00408     m_forceRevision = FALSE;
00409     m_noModuleProgram = FALSE;
00410     //}}AFX_DATA_INIT
00411 }
00412
00413 CCommit_OPTIONS::~CCommit_OPTIONS()
00414 {
00415 }
00416
00417 void CCommit_OPTIONS::DoDataExchange(CDataExchange* pDX)
00418 {
00419     CPropertyPage::DoDataExchange(pDX);
00420     //{{AFX_DATA_MAP(CCommit_OPTIONS)
00421     DDX_Control(pDX, IDC_COMBOREV, m_refDef);
00422     DDX_Check(pDX, IDC_FORCECOMMIT, m_forceCommit);
00423     DDX_CBString(pDX, IDC_COMBOREV, m_rev);
00424     DDX_Check(pDX, IDC_FORCERECURSE, m_forceRecurse);
00425     DDX_Check(pDX, IDC_FORCEREVISION, m_forceRevision);
00426     DDX_Check(pDX, IDC_NOMODULEPROGRAM, m_noModuleProgram);
00427     //}}AFX_DATA_MAP
00428
00429     if(m_forceRevision)
00430         DDV_MinChars(pDX, m_rev, 1);
00431     if(!pDX->m_bSaveAndValidate)
00432     {
00433         OnForcerevision();
00434     }
00435     DDX_ComboMString(pDX, IDC_COMBOREV, gRevNames, m_refDef);
00436 }
00437
00438
00439 BEGIN_MESSAGE_MAP(CCommit_OPTIONS, CPropertyPage)
00440 //{{AFX_MSG_MAP(CCommit_OPTIONS)
00441     ON_BN_CLICKED(IDC_FORCEREVISION, OnForcerevision)
00442     //}}AFX_MSG_MAP
00443 END_MESSAGE_MAP()
00444
00446 // CCommit_OPTIONS message handlers
00447
00448 void CCommit_OPTIONS::OnForcerevision()
00449 {
00450     CButton* but = (CButton *)GetDlgItem(IDC_FORCEREVISION);
00451     CWnd* wnd = GetDlgItem(IDC_COMBOREV);
00452     wnd->EnableWindow(but->GetCheck() == 1);
00453 }
00454
00455
00456 #endif /* WIN32 */
00457
00458 #ifdef qMacCvsPP
00459 class LLogFillerWrapper : public LFillerWrapper
00460 {
00461 public:
00462     LLogFillerWrapper(LMenuController *menu, CMString & mstr, const char *pathTmpl) :
00463         LFillerWrapper(menu), fMStr(mstr), fFirstTime(true)
00464     {
00465         fTmplPath = pathTmpl;
00466         if(!fTmplPath.empty())
00467         {
00468             if(!fTmplPath.endsWith(kPathDelimiter))
00469                 fTmplPath << kPathDelimiter;
00470             fTmplPath << "CVS";
00471             fTmplPath << kPathDelimiter;
00472             fTmplPath << "Template";
00473         }
00474
00475     }
00476
00477     virtual void OnAddingItem(CStr & str)
00478     {
00479         if(fFirstTime)
00480         {
00481             fMenu->InsertMenuItem("\pInsert CVS/Template", max_Int16);
00482             fMenu->InsertMenuItem("\p(-", max_Int16, false);
00483             fFirstTime = false;
00484         }
00485
00486         combozify(str);
00487         CPStr pstr(str);
00488         fMenu->InsertMenuItem(pstr, max_Int16);
00489     }
00490
00491     virtual bool OnSelectingItem(SInt32 inItem, CStr & str)
00492     {
00493         str = "";
00494         if(inItem == 2)
00495         {
00496             bool gotIt = false;
00497             FILE *output;
00498             if(!fTmplPath.empty() && (output = fopen(fTmplPath, "r")) != 0L)
00499             {
00500                 char *line = 0L;
00501                 size_t line_chars_allocated = 0;
00502                 int line_length;
00503                 while ((line_length = getline (&line, &line_chars_allocated, output)) > 0)
00504                 {
00505                     char *tmp = line;
00506                     while((tmp = strchr(tmp, '\n')) != 0L)
00507                     {
00508                         *tmp++ = '\r';
00509                     }
00510                     str << line;
00511                 }
00512
00513                 gotIt = true;
00514                 if (line_length < 0 && !feof (output))
00515                     gotIt = false;
00516
00517                 if(line != 0L)
00518                     free (line);
00519
00520                 fclose(output);
00521             }
00522             if(!gotIt)
00523                 str << "*found no CVS/Template file*";
00524             return true;
00525         }
00526         else if(inItem >= 4)
00527         {
00528             str = fMStr.GetList()[inItem - 4];
00529             return true;
00530         }
00531
00532         return false;
00533     }
00534 protected:
00535     CMString & fMStr;
00536     CStr fTmplPath;
00537     bool fFirstTime;
00538 };
00539
00540 static void DoDataExchange_Commit(LWindow *theDialog, CStr & commit, bool & norecurs,
00541     const char *pathTmpl, bool putValue)
00542 {
00543     LCheckBox *chkNoRecurs = dynamic_cast<LCheckBox*>
00544         (theDialog->FindPaneByID(item_NoRecurs));
00545     LTextEditView *editLog = dynamic_cast<LTextEditView*>
00546         (theDialog->FindPaneByID(item_LogMsg));
00547     LPopupFiller *fillLog = dynamic_cast<LPopupFiller*>
00548         (theDialog->FindPaneByID(item_FillerRev1));
00549     LLogFillerWrapper *wrapper = putValue ? NEW LLogFillerWrapper(fillLog, gCommitLogs, pathTmpl) : 0L;
00550
00551     fillLog->DoDataExchange(gCommitLogs, putValue, wrapper);
00552
00553     if(putValue)
00554     {
00555         chkNoRecurs->SetValue(norecurs ? Button_On : Button_Off);
00556         editLog->SetTextPtr((Ptr)(const char *)commit, commit.length());
00557         theDialog->SetLatentSub(editLog);
00558     }
00559     else
00560     {
00561         norecurs = chkNoRecurs->GetValue() == Button_On;
00562         Handle hdl = editLog->GetTextHandle();
00563         Assert_(hdl != 0L);
00564         commit.set(*hdl, GetHandleSize(hdl));
00565
00566     }
00567 }
00568
00569 static void
00570 DoDataExchange_CommitOptions(
00571
00572     LView *theDialog,
00573     bool & forceCommit,
00574     bool & forceRecurse,
00575     bool & hasRev,
00576     CPStr & lastRev,
00577     bool & noModuleProgram,
00578     bool putValue)
00579 {
00580     LPopupFiller *fillTag = dynamic_cast<LPopupFiller*> (theDialog->FindPaneByID(item_FillerTag));
00581     fillTag->DoDataExchange(gRevNames, putValue);
00582
00583     DoDataExchange (theDialog, item_ForceCommit, forceCommit, putValue);
00584     DoDataExchange (theDialog, item_ForceRecurse, forceRecurse, putValue);
00585     DoDataExchange (theDialog, item_NoModuleProgram, noModuleProgram, putValue);
00586     DoDataExchange (theDialog, item_CheckRevTag, hasRev, putValue);
00587     DoDataExchange (theDialog, item_EditRevTag, lastRev, putValue);
00588 }
00589 #endif /* qMacCvsPP */
00590
00591 #if qUnix
00592 class UCvsCommit : public UWidget
00593 {
00594     UDECLARE_DYNAMIC(UCvsCommit)
00595 public:
00596     UCvsCommit() : UWidget(::UEventGetWidID()) {}
00597     virtual ~UCvsCommit() {}
00598
00599     enum
00600     {
00601         kOK = EV_COMMAND_START, // 0
00602         kCancel,                // 1
00603         kTabGeneral             // 2
00604     };
00605
00606     virtual void DoDataExchange(bool fill);
00607
00608 protected:
00609     ev_msg int OnOK(void);
00610     ev_msg int OnCancel(void);
00611
00612     UDECLARE_MESSAGE_MAP()
00613 };
00614
00615 UIMPLEMENT_DYNAMIC(UCvsCommit, UWidget)
00616
00617 UBEGIN_MESSAGE_MAP(UCvsCommit, UWidget)
00618     ON_UCOMMAND(UCvsCommit::kOK, UCvsCommit::OnOK)
00619     ON_UCOMMAND(UCvsCommit::kCancel, UCvsCommit::OnCancel)
00620 UEND_MESSAGE_MAP()
00621
00622 int UCvsCommit::OnOK(void)
00623 {
00624     EndModal(true);
00625     return 0;
00626 }
00627
00628 int UCvsCommit::OnCancel(void)
00629 {
00630     EndModal(false);
00631     return 0;
00632 }
00633
00634 void UCvsCommit::DoDataExchange(bool fill)
00635 {
00636     if(fill)
00637     {
00638     }
00639     else
00640     {
00641     }
00642 }
00643
00644 class UCvsCommit_MAIN : public UWidget
00645 {
00646     UDECLARE_DYNAMIC(UCvsCommit_MAIN)
00647 public:
00648     UCvsCommit_MAIN(const char *logmsg, const char *pathTmpl);
00649     virtual ~UCvsCommit_MAIN() {}
00650
00651     enum
00652     {
00653         kEditLog = EV_COMMAND_START,    // 0
00654         kComboLog,              // 1
00655         kCheckRecurs            // 2
00656     };
00657
00658     virtual void DoDataExchange(bool fill);
00659
00660     UStr m_logmsg;
00661     bool m_norecurs;
00662     UStr m_tmplPath;
00663 protected:
00664
00665     ev_msg void OnComboSel(int pos, const char *txt);
00666
00667     UDECLARE_MESSAGE_MAP()
00668 };
00669
00670 UIMPLEMENT_DYNAMIC(UCvsCommit_MAIN, UWidget)
00671
00672 UBEGIN_MESSAGE_MAP(UCvsCommit_MAIN, UWidget)
00673     ON_COMBO_SEL(UCvsCommit_MAIN::kComboLog, UCvsCommit_MAIN::OnComboSel)
00674 UEND_MESSAGE_MAP()
00675
00676 UCvsCommit_MAIN::UCvsCommit_MAIN(const char *logmsg, const char *pathTmpl) : UWidget(::UEventGetWidID())
00677 {
00678     m_logmsg = logmsg;
00679     m_norecurs = false;
00680     m_tmplPath = pathTmpl;
00681     if(!m_tmplPath.empty())
00682     {
00683         if(!m_tmplPath.endsWith(kPathDelimiter))
00684             m_tmplPath << kPathDelimiter;
00685         m_tmplPath << "CVS";
00686         m_tmplPath << kPathDelimiter;
00687         m_tmplPath << "Template";
00688     }
00689 }
00690
00691 void UCvsCommit_MAIN::OnComboSel(int pos, const char *txt)
00692 {
00693     if(pos == 0)
00694     {
00695         bool gotIt = false;
00696         FILE *output;
00697
00698         if(!m_tmplPath.empty() && (output = fopen(m_tmplPath, "r")) != 0L)
00699         {
00700             char *line = 0L;
00701             size_t line_chars_allocated = 0;
00702             int line_length;
00703             while ((line_length = getline (&line, &line_chars_allocated, output)) > 0)
00704             {
00705                 UEventSendMessage(GetWidID(), EV_SETTEXT, kEditLog, line);
00706             }
00707
00708             gotIt = true;
00709             if (line_length < 0 && !feof (output))
00710                 gotIt = false;
00711
00712             if(line != 0L)
00713                 free (line);
00714
00715             fclose(output);
00716         }
00717         if(!gotIt)
00718             UEventSendMessage(GetWidID(), EV_SETTEXT, kEditLog, (void *)"*found no CVS/Template file*");
00719     }
00720     else
00721     {
00722         const std::vector<CStr> & list = gCommitLogs.GetList();
00723         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditLog, (void *)(const char *)list[pos - 1]);
00724     }
00725 }
00726
00727 void UCvsCommit_MAIN::DoDataExchange(bool fill)
00728 {
00729     if(fill)
00730     {
00731         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditLog, (void *)(const char *)m_logmsg);
00732
00733         UEventSendMessage(GetWidID(), EV_COMBO_RESETALL, kComboLog, 0L);
00734         UEventSendMessage(GetWidID(), EV_COMBO_APPEND, kComboLog,
00735                           (void *)"Insert CVS/Template");
00736         const std::vector<CStr> & list = gCommitLogs.GetList();
00737         std::vector<CStr>::const_iterator i;
00738         for(i = list.begin(); i != list.end(); ++i)
00739         {
00740             CStr str = *i;
00741             combozify(str);
00742             UEventSendMessage(GetWidID(), EV_COMBO_APPEND, kComboLog, (void *)(const char *)str);
00743         }
00744
00745         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRecurs, m_norecurs), 0L);
00746     }
00747     else
00748     {
00749         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditLog, &m_logmsg);
00750         if(!m_logmsg.empty())
00751             gCommitLogs.Insert(m_logmsg);
00752
00753         m_norecurs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRecurs, 0L) != 0;
00754     }
00755 }
00756
00757 #endif // qUnix
00758
00759 bool CompatGetCommit(CStr & commit, bool & norecurs,
00760                      bool & forceCommit, bool & forceRecurse, CPStr & rev, bool & noModuleProgram,
00761                      const char *pathTmpl,
00762                      MultiFiles *mf)
00763 {
00764     bool userHitOK = false;
00765
00766     static CStr sLastMsg;
00767     static CPStr sLastRev;
00768
00769     bool hasRev = false;
00770
00771     norecurs = false;
00772     commit = "";
00773     forceCommit = false;
00774     forceRecurse = false;
00775     rev = "";
00776     noModuleProgram = false;
00777
00778
00779 #ifdef WIN32
00780     CPropertySheet pages("Commit settings");
00781     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00782     CCommit_MAIN page1(sLastMsg, pathTmpl, mf);
00783     CCommit_OPTIONS page2;
00784     CGetPrefs_GLOBALS page3;
00785     pages.AddPage(&page1);
00786     pages.AddPage(&page2);
00787     pages.AddPage(&page3);
00788     if(pages.DoModal() == IDOK)
00789     {
00790         commit = (const char *)page1.m_logmsg;
00791         sLastMsg = (const char *)page1.m_logmsg;
00792         norecurs = page1.m_norecurs ? true : false;
00793         forceCommit = page2.m_forceCommit ? true : false;
00794         forceRecurse = page2.m_forceRecurse ? true : false;
00795         hasRev = page2.m_forceRevision ? true : false;
00796         sLastRev = page2.m_rev;
00797         noModuleProgram = page2.m_noModuleProgram ? true : false;
00798         page3.StoreValues();
00799
00800         userHitOK = true;
00801     }
00802 #endif /* WIN32 */
00803 #ifdef qMacCvsPP
00804     StDialogHandler theHandler(dlg_Commit, LCommander::GetTopCommander());
00805     LWindow *theDialog = theHandler.GetDialog();
00806     ThrowIfNil_(theDialog);
00807     static UInt16 sRuntimePanel = 1;
00808
00809     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00810         (theDialog->FindPaneByID(item_MultiViewPrefs));
00811     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00812
00813     multiView->SwitchToPanel(3);
00814     DoDataExchange_Globals(theDialog, true);
00815     multiView->SwitchToPanel(2);
00816     DoDataExchange_CommitOptions(theDialog, forceCommit, forceRecurse, hasRev, sLastRev, noModuleProgram, true);
00817     multiView->SwitchToPanel(1);
00818     DoDataExchange_Commit(theDialog, sLastMsg, norecurs, pathTmpl, true);
00819
00820     groupView->SetValue(sRuntimePanel);
00821     theDialog->Show();
00822     MessageT hitMessage;
00823     while (true)
00824     {       // Let DialogHandler process events
00825         hitMessage = theHandler.DoDialog();
00826
00827         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00828             break;
00829     }
00830     theDialog->Hide();
00831     sRuntimePanel = groupView->GetValue();
00832
00833     if(hitMessage == msg_OK)
00834     {
00835         multiView->SwitchToPanel(1);
00836         DoDataExchange_Commit(theDialog, sLastMsg, norecurs, pathTmpl, false);
00837         multiView->SwitchToPanel(2);
00838         DoDataExchange_CommitOptions(theDialog, forceCommit, forceRecurse, hasRev, sLastRev, noModuleProgram, false);
00839         multiView->SwitchToPanel(3);
00840         DoDataExchange_Globals(theDialog, false);
00841         commit = sLastMsg;
00842         commit.replace('\015', '\012');
00843         userHitOK = true;
00844     }
00845 #endif /* qMacCvsPP */
00846 #if qUnix
00847     void *wid = UCreate_CommitDlg();
00848
00849     UCvsCommit *dlg = new UCvsCommit();
00850     UCvsCommit_MAIN *tab1 = new UCvsCommit_MAIN(sLastMsg, pathTmpl);
00851     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00852     dlg->AddPage(tab1, UCvsCommit::kTabGeneral, 0);
00853
00854     if(dlg->DoModal())
00855     {
00856         commit = tab1->m_logmsg;
00857         sLastMsg = tab1->m_logmsg;
00858         norecurs = tab1->m_norecurs;
00859
00860         userHitOK = true;
00861     }
00862
00863     delete dlg;
00864 #endif // qUnix
00865
00866     if(userHitOK)
00867     {
00868         if(commit.length() == 0)
00869             commit = "no message";
00870         if(hasRev && !sLastRev.empty())
00871             rev = sLastRev;
00872         gCvsPrefs.save();
00873     }
00874     return userHitOK;
00875 }
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CommitDlg.h Source File

common/CommitDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- February 1998
00019  */
00020
00021 /*
00022  * CommitDlg.h : the cvs commit dialog
00023  */
00024
00025 #if !defined(AFX_COMMITDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_COMMITDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 #include "CPStr.h"
00033 #include "MultiString.h"
00034 #include "MultiFiles.h"
00035
00036
00037 bool CompatGetCommit(CStr & commit, bool & norecurs,
00038                      bool & forceCommit, bool & forceRecurse, CPStr & rev, bool & noModuleProgram,
00039                      const char *pathTmpl = 0L,
00040                      MultiFiles *mf = 0L);
00041     // get the commit log and misc options...
00042     // the path is used to read the /path/CVS/Template optionally
00043
00044 void combozify(CStr & str);
00045     // strip the string with the few first words.
00046
00047 extern CMString gRevNames;
00048
00049 #ifdef WIN32
00050 class CCommit_MAIN : public CPropertyPage
00051 {
00052     DECLARE_DYNCREATE(CCommit_MAIN)
00053
00054 // Construction
00055 public:
00056     CCommit_MAIN();
00057     CCommit_MAIN(const char *logmsg, const char *pathTmpl = 0L, MultiFiles *mf = 0L);
00058     ~CCommit_MAIN();
00059
00060 // Dialog Data
00061     //{{AFX_DATA(CCommit_MAIN)
00062     enum { IDD = IDD_COMMIT_MAIN };
00063     CComboBox   m_fileToDiffCombo;
00064     CButton m_wordwrapctrl;
00065     CEdit   m_logmsgctrlwrap;
00066     CEdit   m_logmsgctrl;
00067     CComboBox   m_combodef;
00068     CString m_logmsg;
00069     BOOL    m_norecurs;
00070     BOOL    m_wordwrap;
00071     //}}AFX_DATA
00072
00073     CStr m_tmplPath;
00074     MultiFiles *m_pmfarg;
00075
00076 // Overrides
00077     // ClassWizard generate virtual function overrides
00078     //{{AFX_VIRTUAL(CCommit_MAIN)
00079     public:
00080     virtual BOOL PreTranslateMessage(MSG* pMsg);
00081     protected:
00082     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00083     //}}AFX_VIRTUAL
00084
00085 // Implementation
00086 protected:
00087     // Generated message map functions
00088     //{{AFX_MSG(CCommit_MAIN)
00089     afx_msg void OnSelchangeCombo();
00090     afx_msg void OnLauncheditor();
00091     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00092     afx_msg void OnWordwrap();
00093     virtual BOOL OnInitDialog();
00094     afx_msg void OnDiff();
00095     //}}AFX_MSG
00096     DECLARE_MESSAGE_MAP()
00097
00098 private:
00099     void UpdateInfo();
00100     void SwitchWrapEdit(BOOL bWordWrap);
00101     int GetLogMsgID();
00102     CWnd* GetLogMsgWnd();
00103
00104     BOOL m_bSwitchingWrap;
00105 };
00106
00108 // CCommit_OPTIONS dialog
00109
00110 class CCommit_OPTIONS : public CPropertyPage
00111 {
00112     DECLARE_DYNCREATE(CCommit_OPTIONS)
00113
00114 // Construction
00115 public:
00116     CCommit_OPTIONS();
00117     ~CCommit_OPTIONS();
00118
00119 // Dialog Data
00120     //{{AFX_DATA(CCommit_OPTIONS)
00121     enum { IDD = IDD_COMMIT_OPTIONS };
00122     CComboBox   m_refDef;
00123     BOOL    m_forceCommit;
00124     CString m_rev;
00125     BOOL    m_forceRecurse;
00126     BOOL    m_forceRevision;
00127     BOOL    m_noModuleProgram;
00128     //}}AFX_DATA
00129
00130
00131 // Overrides
00132     // ClassWizard generate virtual function overrides
00133     //{{AFX_VIRTUAL(CCommit_OPTIONS)
00134     protected:
00135     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00136     //}}AFX_VIRTUAL
00137
00138 // Implementation
00139 protected:
00140     // Generated message map functions
00141     //{{AFX_MSG(CCommit_OPTIONS)
00142     afx_msg void OnForcerevision();
00143     //}}AFX_MSG
00144     DECLARE_MESSAGE_MAP()
00145
00146 };
00147 //{{AFX_INSERT_LOCATION}}
00148 #endif /* WIN32 */
00149
00150 #endif // !defined(AFX_COMMITDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CPStr.cpp Source File

common/CPStr.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- January 1997
00019  */
00020
00021 /*
00022  * CPStr.cpp --- simple Pascal-C string
00023  * Moved in ustr.cpp
00024  */
00025
00026 #include "stdafx.h"
00027
00028 #include "CPStr.h"
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CPStr.h Source File

common/CPStr.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- January 1997
00019  */
00020
00021 /*
00022  * CPStr.h --- simple Pascal-C string
00023  */
00024
00025 #ifndef CPSTR_H
00026 #define CPSTR_H
00027
00028 #include <string.h>
00029 #include <stdlib.h>
00030
00031 #include "Persistent.h"
00032
00033 #include "ustr.h"
00034 #include <exception>
00035 #define CPStr UPStr
00036 #define CStr UStr
00037
00038 // the persistent version
00039 class PCPStr : public CPStr, public CPersistent
00040 {
00041     UDECLARE_DYNAMIC(PCPStr)
00042 public:
00043     PCPStr(const char *uniqueName, const char *defValue = 0L, kClassPersistent pclass = kNoClass) : CPStr(),
00044         CPersistent(uniqueName, pclass)
00045     {
00046         if(defValue != 0L)
00047             *(CPStr *)this = defValue;
00048     }
00049     virtual ~PCPStr()
00050     {
00051     }
00052
00053     virtual unsigned int SizeOf(void) const
00054     {
00055         return str != 0L ? length() + 1 : 1;
00056     }
00057
00058     virtual const void *GetData(void) const
00059     {
00060         const void *res = (const char *)(*(CPStr *)this);
00061         return res == 0L ? "" : res;
00062     }
00063
00064     virtual void SetData(const void *ptr, unsigned int size)
00065     {
00066         if(strlen((const char *)ptr) == (size - 1))
00067             *(CPStr *)this = (const char *)ptr;
00068     }
00069
00070     inline operator const unsigned char *() const
00071         { return *(CPStr *)this; }
00072     inline operator unsigned char *() EGCS_CONST
00073         { return *(CPStr *)this; }
00074         // as a P string
00075
00076     inline operator const char *() const { return *(CPStr *)this; }
00077     inline operator char *() EGCS_CONST { return *(CPStr *)this; }
00078         // as a C string
00079
00080     inline const char *operator=(const char *newstr)
00081         { return ((CPStr *)this)->operator=(newstr); }
00082         // set from a C String (0L is OK)
00083     inline const unsigned char *operator=(const unsigned char *newstr)
00084         { return ((CPStr *)this)->operator=(newstr); }
00085         // set from a P String (0L is OK)
00086 };
00087
00088 class PCStr : public CStr, public CPersistent
00089 {
00090     UDECLARE_DYNAMIC(PCStr)
00091 public:
00092     PCStr(const char *uniqueName, const char *defValue = 0L, kClassPersistent pclass = kNoClass) : CStr(),
00093         CPersistent(uniqueName, pclass)
00094     {
00095         if(defValue != 0L)
00096             *(CStr *)this = defValue;
00097     }
00098     virtual ~PCStr()
00099     {
00100     }
00101
00102     virtual unsigned int SizeOf(void) const
00103     {
00104         return str != 0L ? length() + 1 : 0;
00105     }
00106
00107     virtual const void *GetData(void) const
00108     {
00109         const void *res = (const char *)(*(CStr *)this);
00110         return res == 0L ? "" : res;
00111     }
00112
00113     virtual void SetData(const void *ptr, unsigned int size)
00114     {
00115         if(strlen((const char *)ptr) == (size - 1))
00116             *(CStr *)this = (const char *)ptr;
00117     }
00118
00119     inline operator const char *() const { return *(CStr *)this; }
00120     inline operator char *() EGCS_CONST { return *(CStr *)this; }
00121         // as a C string
00122
00123     inline const char *operator=(const char *newstr)
00124     {
00125         TouchTimeStamp();
00126         return ((CStr *)this)->operator=(newstr);
00127     }
00128         // set from a C String (0L is OK)
00129     inline const char *operator=(const unsigned char *newstr)
00130     {
00131         TouchTimeStamp();
00132         return ((CStr *)this)->operator=(newstr);
00133     }
00134         // set from a P String (0L is OK)
00135 };
00136
00137 // class to use when fed-up with realloc, malloc...
00138 template <class T>
00139 class CStaticAllocT
00140 {
00141 public:
00142     CStaticAllocT()
00143     {
00144         buf = 0L;
00145         numbuf = 0;
00146     }
00147
00148     ~CStaticAllocT()
00149     {
00150         if(buf != 0L)
00151             free(buf);
00152     }
00153
00154     void AdjustSize(size_t size)
00155     {
00156         if(numbuf < size)
00157         {
00158             if(buf == 0L)
00159                 buf = (T *)malloc(size * sizeof(T));
00160             else
00161                 buf = (T *)realloc(buf, size * sizeof(T));
00162             if(buf == 0L)
00163                 throw std::bad_alloc();
00164             numbuf = size;
00165         }
00166     }
00167
00168     inline operator T *(void) const /* egcs const */ { return buf; }
00169     inline operator const T *(void) const { return buf; }
00170 #ifdef __GNUC__
00171     inline const T & operator[](int i) const { return buf[i]; }
00172     inline T & operator[](int i) { return buf[i]; }
00173 #endif
00174
00175     inline size_t size() const { return numbuf; }
00176 protected:
00177     T *buf;
00178     size_t numbuf;
00179 };
00180
00181 #endif /* CPSTR_H */
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CTCP2Parse.cpp Source File

common/CTCP2Parse.cpp

Go to the documentation of this file.
00001 /*
00002  ------------------------------------------------------------------------------
00003  * CTCP2Parse.cpp  --
00004  *
00005  *  a C++ implementation of the Text attribute section of the CTCP/2
00006  *  draft by Robey Pointer (that eggdrop dude) and friends.  This code
00007  *  is based directly from Robey's Java example.  This code includes
00008  *  full support for decoding mIrc, ANSI, and ircII attributes as well.
00009  *
00010  *  See --> http://www.lag.net/~robey/ctcp
00011  *      --> http://www.egroups.com/group/ctcp2
00012  *
00013  *  Depends: STL string template, no OS specifics.
00014  *
00015  *  This source is under BSD license and has no restrictions the way
00016  *  the GPL does.  Sell it for all I care.  Just be nice and give me
00017  *  credit for it.  Although it's not a requirement.
00018  *
00019  *  Author: David Gravereaux <davygrvy@pobox.com>
00020  *      Tomahawk Software Group
00021  *
00022  *  Conversion routines donated by Keith Lea <keith@cs.oswego.edu>
00023  *
00024  * RCS: @(#) $Id: CTCP2Parse.cpp,v 1.4 2001/01/14 15:33:39 davygrvy Exp $
00025  ------------------------------------------------------------------------------
00026  */
00027
00028 #include "stdafx.h"
00029 #include "CTCP2Parse.hpp"
00030
00031 CTCP2Parse::CTCP2Parse ()
00032 {
00033     boldCnt = revCnt = overCnt = underCnt = italicCnt = blinkCnt = urlCnt = 0;
00034     boldLast = revLast = overLast = underLast = italicLast = blinkLast = urlLast = 0;
00035     fntSize = fntLast = 0;
00036
00037     fg.RGB = fgLast.RGB = fgDef.RGB = Lt_Grey;
00038     bg.RGB = bgLast.RGB = bgDef.RGB = Black;
00039
00040     cp = cpLast = cpDef = Fixed;
00041     enc = encLast = encDef = iso8859_1;
00042 }
00043
00044 void CTCP2Parse::SetDefaults (
00045     unsigned char fgR, unsigned char fgG, unsigned char fgB,    // default foreground color
00046     unsigned char bgR, unsigned char bgG, unsigned char bgB,    // default background color
00047     CharSpacingType cpDef_,
00048     EncodingType encDef_)
00049 {
00050
00051     // reassemble the seperate RGB values into our internal rep.
00052
00053     fg.R = fgLast.R = fgDef.R = fgR;
00054     fg.G = fgLast.G = fgDef.G = fgG;
00055     fg.B = fgLast.B = fgDef.B = fgB;
00056
00057     bg.R = bgLast.R = bgDef.R = bgR;
00058     bg.G = bgLast.G = bgDef.G = bgG;
00059     bg.B = bgLast.B = bgDef.B = bgB;
00060
00061     cp = cpLast = cpDef = cpDef_;
00062     enc = encLast = encDef = encDef_;
00063 }
00064
00065 void CTCP2Parse::ParseIt (std::string *line)
00066 {
00067     int parseFrmChar = 0, parseEndChar = 0, parseStart = 0;
00068     int fntVal, fntDir = 1;
00069     int rollBack;
00070
00071     // Pre-parse and replace other attribute standards with
00072     // the ctcp2 equivalents for display.
00073     mirc2ctcp(line);
00074     ircii2ctcp(line);
00075     ansi2ctcp(line);
00076
00077
00078     // find an opening ctcp/2 format character (^F)
00079     parseFrmChar = line->find_first_of("\006");
00080
00081     // do we have any?
00082     while (parseFrmChar != std::string::npos)
00083     {
00084         // find the closing ctcp/2 format character (^F)
00085         parseEndChar = line->find_first_of("\006", parseFrmChar+1);
00086
00087         if (parseEndChar == std::string::npos)
00088         {
00089             // an opening without a closing is bogus
00090             // so remove it and fallout of the while loop
00091             line->replace(parseFrmChar, 1, "");
00092             break;
00093         }
00094
00095         // check for text before this format character
00096         // and after the last format character (or index 0 for
00097         // the first iteration.
00098         if (parseFrmChar > parseStart)
00099         {
00100             // yes.. we got a text segment ready to push.
00101             segment = new std::string(line->substr(parseStart, (parseFrmChar - parseStart)));
00102             PushOut();
00103             delete segment;
00104         }
00105
00106         // now, interpret this format code and decode this attribute
00107         // (and options, if any).
00108
00109
00110         parseFrmChar++;  // consume the first ^F.
00111
00112
00113         switch (line->at(parseFrmChar)) {
00114
00115 #   define CTCP2_TOGGLE(ch, var)  \
00116         case (ch): \
00117         decodeToggle(line, &parseFrmChar, &parseEndChar, &(var)); \
00118             break;
00119
00120         // bold
00121         CTCP2_TOGGLE('B', boldCnt);
00122
00123         // reverse
00124         CTCP2_TOGGLE('V', revCnt);
00125
00126         // underline
00127         CTCP2_TOGGLE('U', underCnt);
00128
00129         // over-strike
00130         CTCP2_TOGGLE('S', overCnt);
00131
00132         // italics
00133         CTCP2_TOGGLE('I', italicCnt);
00134
00135         // blink
00136         CTCP2_TOGGLE('K', blinkCnt);
00137
00138         // URL
00139         CTCP2_TOGGLE('L', urlCnt);
00140
00141 #   undef CTCP2_TOGGLE
00142
00143         // color
00144         case 'C':
00145             parseFrmChar++;   // consume the 'C'
00146             if (parseFrmChar < parseEndChar)
00147             {
00148                 if (line->at(parseFrmChar) == '.')
00149                 {
00150                     // reset to default
00151                     fg.RGB = fgDef.RGB;
00152                     parseFrmChar++;  // consume the '.'
00153                 }
00154                 else if (line->at(parseFrmChar) == '-')
00155                 {
00156                     // ignore
00157                     parseFrmChar++;   // consume the '-'
00158                 }
00159                 else
00160                 {
00161                     if (rollBack = decodeColor(line, &parseFrmChar, &parseEndChar, &fg))
00162                     {
00163                         // rollback the error to the 'C'
00164                         parseFrmChar -= rollBack;
00165                         fg.RGB = fgDef.RGB;
00166                         break;
00167                     }
00168                 }
00169
00170
00171                 // background color?
00172                 if (parseFrmChar < parseEndChar)
00173                 {
00174                     if (line->at(parseFrmChar) == '.')
00175                     {
00176                         bg.RGB = bgDef.RGB;
00177                         parseFrmChar++;  // consume the '.'
00178                     }
00179                     else if (line->at(parseFrmChar) == '-')
00180                     {
00181                         // ignore
00182                         parseFrmChar++;   // consume the '-'
00183                     }
00184                     else
00185                     {
00186                         if (rollBack = decodeColor(line, &parseFrmChar, &parseEndChar, &bg))
00187                         {
00188                             // rollback the error to the 'C'
00189                             parseFrmChar -= rollBack;
00190                             bg.RGB = bgDef.RGB;
00191                             break;
00192                         }
00193                     }
00194                 }
00195                 else
00196                     parseFrmChar--;   // rollback one
00197             }
00198             else
00199             {
00200                 // no colors were specified: reset to normal
00201                 fg.RGB = fgDef.RGB;
00202                 bg.RGB = bgDef.RGB;
00203             }
00204
00205             // if fg/bg are too similar, reset to defaults.
00206             // (this is in the ctcp2 draft).  These calculations
00207             // are DIRECTLY from ctcp2's draft.
00208             if ((fg.R >= bg.R - 8) && (fg.R <= bg.R + 8) &&
00209                 (fg.G >= bg.G - 8) && (fg.G <= bg.G + 8) &&
00210                 (fg.B >= bg.B - 8) && (fg.B <= bg.B + 8))
00211             {
00212                 fg.RGB = fgDef.RGB;
00213                 bg.RGB = bgDef.RGB;
00214             }
00215             break;
00216
00217         // font size
00218         case 'F':
00219             parseFrmChar++;
00220             if (parseFrmChar < parseEndChar)
00221             {
00222                 if (line->at(parseFrmChar) == '+') fntDir = 1;
00223                 else fntDir = -1;
00224                 parseFrmChar++;
00225                 if (parseFrmChar < parseEndChar)
00226                 {
00227                     fntVal = line->at(parseFrmChar) - 48;
00228                     if (fntVal > 4) fntVal = 4;
00229                 } else {
00230                     // no amount -- assume 1
00231                     fntVal = 1;
00232                     parseFrmChar--;
00233                 }
00234                 fntSize += (fntDir*fntVal);
00235             } else {
00236                 // no parameters -- reset to normal
00237                 fntSize = 0;
00238                 parseFrmChar--;
00239             }
00240             break;
00241
00242         // character spacing
00243         case 'P':
00244             parseFrmChar++;   // consume it
00245             if (parseFrmChar < parseEndChar)
00246             {
00247                 switch (line->at(parseFrmChar))
00248                 {
00249                 case 'P':
00250                     cp = Proportional; parseFrmChar++; break;
00251                 case 'F':
00252                     cp = Fixed; parseFrmChar++; break;
00253                 default:
00254                     // rollback to show the error.
00255                     parseFrmChar -= 2;
00256                 }
00257             } else {
00258                 // no parameters -- reset to normal
00259                 cp = cpDef;
00260             }
00261             break;
00262
00263         // text encoding
00264         case 'E':
00265             parseFrmChar++;   // consume it
00266             switch (line->at(parseFrmChar))
00267             {
00268             case '1':
00269                 if (line->at(parseFrmChar+1) == '0') parseFrmChar++; // what's iso8859-10 ???
00270                 enc = iso8859_1; parseFrmChar++; break;
00271             case '2':
00272                 enc = iso8859_2; parseFrmChar++; break;
00273             case '3':
00274                 enc = iso8859_3; parseFrmChar++; break;
00275             case '4':
00276                 enc = iso8859_4; parseFrmChar++; break;
00277             case '5':
00278                 enc = iso8859_5; parseFrmChar++; break;
00279             case '6':
00280                 enc = iso8859_6; parseFrmChar++; break;
00281             case '7':
00282                 enc = iso8859_7; parseFrmChar++; break;
00283             case '8':
00284                 enc = iso8859_8; parseFrmChar++; break;
00285             case '9':
00286                 enc = iso8859_9; parseFrmChar++; break;
00287             case 'U':
00288                 enc = UTF_8; parseFrmChar++; break;
00289             default:
00290                 // rollback to show the error.
00291                 parseFrmChar -= 2;
00292             }
00293             break;
00294
00295         // revert to normal
00296         case 'N':
00297             parseFrmChar++;   // consume it
00298             boldCnt = revCnt = overCnt = underCnt = italicCnt = blinkCnt = urlCnt = 0;
00299             enc = encDef;
00300             fg.RGB = fgDef.RGB;
00301             bg.RGB = bgDef.RGB;
00302             cp = cpDef;
00303             break;
00304
00305         // client extensions
00306         case 'X':
00307             //  no extensions are defined at this time.
00308             /*
00309             parseFrmChar++;
00310             switch (line->at(parseFrmChar)) {
00311             case '':
00312             default:
00313                  rollback to show the error.
00314                 parseFrmChar -= 2;
00315             }
00316             */
00317             parseFrmChar--;
00318             break;
00319
00320         // error condition...
00321         default:
00322             // rollback one.  unrecognized format specifier.
00323             parseFrmChar--;
00324         }
00325
00326         // extra params? include them in the text surrounded by "[ ]"
00327         // (This is recommended, in case someone chooses to "hide" a
00328         //    message by doing "^FNsell yoyodyne stocks!^F" -- this code
00329         //    effectively "unhides" it, and is [yet again] recommended
00330         //    by the CTCP2 draft.)
00331
00332         parseFrmChar++;
00333         if (parseFrmChar < parseEndChar)
00334         {
00335             line->replace(parseFrmChar, parseEndChar - parseFrmChar,
00336                 std::string("\006[") +
00337                 line->substr(parseFrmChar, parseEndChar-parseFrmChar) +
00338                 std::string("]"));
00339
00340             parseEndChar = parseFrmChar;
00341         }
00342
00343         // save old end position
00344         parseStart = parseEndChar+1;
00345
00346         // got any more?
00347         parseFrmChar = line->find_first_of("\006", parseStart);
00348     };
00349
00350
00351
00352     // anything left?
00353     if (parseStart < line->length())
00354     {
00355         // last text segment is ready to push.
00356         segment = new std::string(line->substr(parseStart));
00357         PushOut();
00358         delete segment;
00359     }
00360 };
00361
00362 const CTCP2Parse::RGBColor CTCP2Parse::indexColor[16] = {
00363     Black, Blue, Green, Cyan, Red, Magenta, Yellow, Lt_Grey, Grey,
00364     Lt_Blue, Lt_Green, Lt_Cyan, Lt_Red, Lt_Magenta, Lt_Yellow, White
00365 };
00366
00367
00368
00369 #define CCOLOR (char)3  // ctr-c
00370 #define CCTCP2 (char)6  // ctr-f
00371 #define MIRC_TRANSPARENT    16
00372 #define isn(ch) ((ch) >= '0' && (ch) <= '9')
00373
00374
00375 const char
00376 mircAttrCvt::tokens[2] = {
00377     CCOLOR, 0
00378 };
00379
00380
00381 const char *
00382 mircAttrCvt::mirc2ctcpmap[17] = {
00383     "F",        // white
00384     "0",        // black
00385     "1",        // blue
00386     "2",        // green
00387     "C",        // bright red
00388     "#7F3F3F",  // brown   (not exactly red (7F0000))
00389     "5",        // purple
00390     "#FF7F00",  // orange  (definately not yellow (7F7F00))
00391     "E",        // bright yellow
00392     "A",        // bright green
00393     "3",        // cyan
00394     "B",        // bright cyan
00395     "9",        // bright blue
00396     "#FF7FC0",  // pink    (not really bright magenta (FF00FF))
00397     "8",        // grey
00398     "7",        // light grey
00399     "."     // return to default (^K99)
00400 };
00401
00402
00403 void
00404 mircAttrCvt::mirc2ctcp(std::string *in)
00405 {
00406     int col;
00407     char f[20];
00408     bool eqf, eqb;
00409     short oldfg, oldbg, fg = -1, bg = -1;
00410     int pos;
00411
00412     pos = in->find_first_of(tokens);
00413
00414     while (pos != std::string::npos)
00415     {
00416         oldfg = fg;
00417         oldbg = bg;
00418         col = extractcolor(in, pos+1, &fg, &bg);
00419         eqf = (oldfg == fg);
00420         eqb = (oldbg == bg);
00421
00422         if (col && (!eqf || !eqb))
00423         {
00424             // if the color hasn't changed, we insert a - which means
00425             // basically "ignore me"
00426             sprintf(f, "C%s%s",
00427                 eqf ? "-" : mirc2ctcpmap[fg],
00428                 eqb ? (eqf ? 0 : "-") : mirc2ctcpmap[bg]);
00429
00430             in->replace(pos, col+1,
00431                 std::string("") + CCTCP2 + f + CCTCP2);
00432             pos += (2 + strlen(f));   // consume the additions
00433         }
00434         else
00435         {
00436             in->replace(pos, 1, std::string("") + CCTCP2 + 'C' + CCTCP2);
00437             pos += 2;   // consume the additions
00438         }
00439         pos = in->find_first_of(tokens, pos);
00440     }
00441 };
00442
00443
00444 int
00445 mircAttrCvt::extractcolor (std::string *in, int start, short *fg, short *bg)
00446 {
00447     int ptr = start, len = in->length(), preColor;
00448
00449     if (ptr == len) return 0;
00450
00451     if (isn(in->at(ptr)))
00452     {
00453         // there's a foreground
00454
00455         if (ptr + 1 < len && isn(in->at(ptr + 1)))
00456         {
00457             // it's 2 digits
00458             preColor = (((in->at(ptr) - '0') * 10) + (in->at(ptr + 1) - '0'));
00459             if (preColor == 99) *fg = MIRC_TRANSPARENT;
00460             else *fg = preColor % 16;
00461             ptr += 2;
00462         }
00463         else
00464         {
00465             // it's 1 digit
00466             *fg = in->at(ptr) - '0';
00467             ptr++;
00468         }
00469         if (ptr + 1 < len && in->at(ptr) == ',' && isn(in->at(ptr + 1)))
00470         {
00471             // there's a background
00472             ptr++; // the comma
00473
00474             if (ptr + 1 < len && isn(in->at(ptr + 1)))
00475             {
00476                 // it's 2 digits
00477                 preColor = (((in->at(ptr) - '0') * 10) + (in->at(ptr + 1) - '0'));
00478                 if (preColor == 99) *bg = MIRC_TRANSPARENT;
00479                 else *bg = preColor % 16;
00480                 ptr += 2;
00481             }
00482             else
00483             {
00484                 // it's 1 digit
00485                 *bg = in->at(ptr) - '0';
00486                 ptr++;
00487             }
00488         }
00489     }
00490     return (ptr - start);
00491 };
00492
00493
00494 // ------------------------------ macro definitions -------------------
00495 #define CBOLD  (char)2  // ctr-b
00496 #define CCTCP2 (char)6  // ctr-f
00497 #define CSTOP  (char)15 // ctr-o
00498 #define CREV   (char)22 // ctr-v, reverse
00499 #define CUNDR  (char)31 // ctr-underscore
00500
00501
00502 const char irciiAttrCvt::tokens[5] = {
00503     CBOLD, CUNDR, CREV, CSTOP, 0
00504 };
00505
00506 void
00507 irciiAttrCvt::ircii2ctcp (std::string *in)
00508 {
00509     int pos, bold = 0, under = 0, rev = 0;
00510
00511     pos = in->find_first_of(tokens);
00512
00513     while (pos != std::string::npos)
00514     {
00515         switch (in->at(pos))
00516         {
00517         case CBOLD:
00518             bold = !bold;
00519             in->replace(pos, 1,
00520                 std::string("") + CCTCP2 + 'B' + (bold?'+':'-') + CCTCP2);
00521             pos += 3;   // consume the additions
00522             break;
00523
00524         case CUNDR:
00525             under = !under;
00526             in->replace(pos, 1,
00527                 std::string("") + CCTCP2 + 'U' + (under?'+':'-') + CCTCP2);
00528             pos += 3;   // consume the additions
00529             break;
00530
00531         case CREV:
00532             rev = !rev;
00533             in->replace(pos, 1,
00534                 std::string("") + CCTCP2 + 'V' + (rev?'+':'-') + CCTCP2);
00535             pos += 3;   // consume the additions
00536             break;
00537
00538         case CSTOP:
00539             bold = under = rev = 0;
00540             in->replace(pos, 1, std::string("") + CCTCP2 + 'N' + CCTCP2);
00541             pos += 2;   // consume the additions
00542         }
00543         pos = in->find_first_of(tokens,++pos);
00544     }
00545 }
00546
00547
00548 // See http://www.delorie.com/gnu/docs/screen/screen_48.html for a good list of ansi escapes.
00549 // We're not supporting everything, though.  Just the small bit about colors and cursor move right.
00550
00551
00552 #define INVALID_SEQUENCE    -1
00553 const char *ansiAttrCvt::AnsiSeq::_notOf = "1234567890=;";
00554
00555 ansiAttrCvt::AnsiSeq::AnsiSeq (std::string *in, int pos)
00556     : _seq(0), _verb(0)
00557 {
00558     int verbPos;
00559     int seqLen;
00560     int pos1, pos2;
00561
00562     verbPos = in->find_first_not_of(_notOf, pos + 2);
00563
00564     if (verbPos == std::string::npos || in->at(verbPos) == '\033')
00565     {
00566         _verb = INVALID_SEQUENCE;
00567         in->replace(pos, 2, "");
00568         return;
00569     }
00570
00571     seqLen = verbPos - pos - 1;
00572
00573     // get a copy of the ansi sequence without the "esc["
00574     _seq = new std::string(in->substr(pos + 2, seqLen));
00575
00576     // remove it from the original, now that we have the needed info
00577     in->replace(pos, verbPos - pos + 1, "");
00578
00579     // set the verb
00580     _verb = _seq->at(seqLen - 1);
00581
00582     for (pos1 = 0, pos2 = 0; pos2 < seqLen; pos2++)
00583     {
00584         if (_seq->at(pos2) != ';' && pos2 < (seqLen - 1)) continue;
00585         _params.push_back(atoi(_seq->substr(pos1, pos2 - pos1).c_str()));
00586         pos1 = pos2 + 1;
00587     }
00588
00589 }
00590
00591
00592 ansiAttrCvt::AnsiSeq::~AnsiSeq ()
00593 {
00594     if (_seq) delete _seq;
00595 }
00596
00597
00598 #define ANSI_SGM_TA_RESET   0
00599 #define ANSI_SGM_TA_BOLD    1
00600 #define ANSI_SGM_TA_FAINT   2
00601 #define ANSI_SGM_TA_ITALIC  3
00602 #define ANSI_SGM_TA_ULINE   4
00603 #define ANSI_SGM_TA_BLINK   5
00604 #define ANSI_SGM_TA_REV     7
00605 #define ANSI_SGM_TA_CONSEAL 8
00606 #define ANSI_SGM_TA_NORMAL  22
00607 #define ANSI_SGM_TA_ITALIC_OFF  23
00608 #define ANSI_SGM_TA_ULINE_OFF   24
00609 #define ANSI_SGM_TA_BLINK_OFF   25
00610 #define ANSI_SGM_TA_REV_OFF 27
00611
00612 #define ANSI_SGM_FC_BLK     30
00613 #define ANSI_SGM_FC_RED     31
00614 #define ANSI_SGM_FC_GRN     32
00615 #define ANSI_SGM_FC_YEL     33
00616 #define ANSI_SGM_FC_BLU     34
00617 #define ANSI_SGM_FC_MAG     35
00618 #define ANSI_SGM_FC_CYN     36
00619 #define ANSI_SGM_FC_WHT     37
00620 #define ANSI_SGM_FC_DEFAULT 39
00621
00622 #define ANSI_SGM_BC_BLK     40
00623 #define ANSI_SGM_BC_RED     41
00624 #define ANSI_SGM_BC_GRN     42
00625 #define ANSI_SGM_BC_YEL     43
00626 #define ANSI_SGM_BC_BLU     44
00627 #define ANSI_SGM_BC_MAG     45
00628 #define ANSI_SGM_BC_CYN     46
00629 #define ANSI_SGM_BC_WHT     47
00630 #define ANSI_SGM_BC_DEFAULT 49
00631
00632
00633 const char *ansiAttrCvt::escSeq = "\033\133";
00634
00635 void
00636 ansiAttrCvt::ansi2ctcp (std::string *in)
00637 {
00638     bold = underline = reverse = blink = italic = 0;
00639     _in = in;
00640
00641     pos = in->find(escSeq);
00642
00643     while (pos != std::string::npos)
00644     {
00645         _seq = new AnsiSeq(in, pos);
00646
00647         switch (_seq->verb())
00648         {
00649         case INVALID_SEQUENCE:
00650             break;
00651
00652         case 'm':       // set graphic mode
00653             do_m();
00654             break;
00655         case 'C':       // move cursor right
00656             do_C();
00657             break;
00658         case 'f':       // move to cursor position
00659         case 'H':       //          "
00660         case 'A':       // move cursor up
00661         case 'B':       // move cursor down
00662         case 'D':       // move cursor left
00663         case 's':       // save cursor position
00664         case 'u':       // restore cursor position
00665         case 'J':       // erase display and goto home
00666         case 'K':       // erase line
00667         case 'h':       // set display mode
00668         case 'l':       // reset display mode
00669         default:
00670             std::string errmsg(std::string ("[ansi error: '") + _seq->seq() +
00671                 "' sequence unsupported]");
00672             in->insert(pos, errmsg);
00673             pos += errmsg.length();
00674         }
00675         delete _seq;
00676         pos = in->find(escSeq, pos);
00677     }
00678 };
00679
00680 const char *ansiAttrCvt::fgColorMap[16] = {
00681     "C0-",      // Black
00682     "C4-",      // Red
00683     "C2-",      // Green
00684     "C6-",      // Yellow
00685     "C1-",      // Blue
00686     "C5-",      // Magenta
00687     "C3-",      // Cyan
00688     "C7-",      // Light Grey
00689     "C8-",      // Grey
00690     "CC-",      // Light Red
00691     "CA-",      // Light Green
00692     "CE-",      // Light Yellow
00693     "C9-",      // Light Blue
00694     "CD-",      // Light Magenta
00695     "CB-",      // Light Cyan
00696     "CF-"       // White
00697 };
00698
00699 const char *ansiAttrCvt::bgColorMap[8] = {
00700     "C-0",      // Black
00701     "C-4",      // Red
00702     "C-2",      // Green
00703     "C-6",      // Yellow
00704     "C-1",      // Blue
00705     "C-5",      // Magenta
00706     "C-3",      // Cyan
00707     "C-7"       // Light Grey
00708 };
00709
00710 void
00711 ansiAttrCvt::do_m ()
00712 {
00713     int i;
00714     for (i = 0; i < _seq->paramc(); i++)
00715     {
00716         switch (_seq->param(i))
00717         {
00718         // reset
00719         case ANSI_SGM_TA_RESET:
00720             bold = underline = reverse = blink = 0;
00721             _in->insert(pos, std::string("") + CCTCP2 + 'N' + CCTCP2);
00722             pos += 3;
00723             break;
00724
00725         // bold intensity
00726         case ANSI_SGM_TA_BOLD:
00727             if (!bold) bold = 1;
00728             break;
00729
00730         // bold intensity
00731         case ANSI_SGM_TA_FAINT:
00732             // TODO: what do I do for this ???
00733             break;
00734
00735         // bold + faint off (normal intensity)
00736         case ANSI_SGM_TA_NORMAL:
00737             if (bold) bold = 0;
00738             break;
00739
00740         // standout (italic)
00741         case ANSI_SGM_TA_ITALIC:
00742             if (!italic)
00743             {
00744                 italic = 1;
00745                 _in->insert(pos, std::string("") + CCTCP2 + "I+" + CCTCP2);
00746                 pos += 4;       // consume the additions
00747             }
00748             break;
00749
00750         // standout (italic) off
00751         case ANSI_SGM_TA_ITALIC_OFF:
00752             if (italic)
00753             {
00754                 italic = 0;
00755                 _in->insert(pos, std::string("") + CCTCP2 + "I-" + CCTCP2);
00756                 pos += 4;       // consume the additions
00757             }
00758             break;
00759
00760         // underline
00761         case ANSI_SGM_TA_ULINE:
00762             if (!underline)
00763             {
00764                 underline = 1;
00765                 _in->insert(pos, std::string("") + CCTCP2 + "U+" + CCTCP2);
00766                 pos += 4;       // consume the additions
00767             }
00768             break;
00769
00770         // underline off
00771         case ANSI_SGM_TA_ULINE_OFF:
00772             if (underline)
00773             {
00774                 underline = 0;
00775                 _in->insert(pos, std::string("") + CCTCP2 + "U-" + CCTCP2);
00776                 pos += 4;       // consume the additions
00777             }
00778             break;
00779
00780         // blink
00781         case ANSI_SGM_TA_BLINK:
00782             if (!blink)
00783             {
00784                 blink = 1;
00785                 _in->insert(pos, std::string("") + CCTCP2 + "K+" + CCTCP2);
00786                 pos += 4;   // consume additions.
00787             }
00788             break;
00789
00790         // blink off
00791         case ANSI_SGM_TA_BLINK_OFF:
00792             if (blink)
00793             {
00794                 blink = 0;
00795                 _in->insert(pos, std::string("") + CCTCP2 + "K-" + CCTCP2);
00796                 pos += 4;   // consume additions.
00797             }
00798             break;
00799
00800         // reverse
00801         case ANSI_SGM_TA_REV:
00802             if (!reverse)
00803             {
00804                 reverse = 1;
00805                 _in->insert(pos, std::string("") + CCTCP2 + "V+" + CCTCP2);
00806                 pos += 4;   // consume the additions
00807             }
00808             break;
00809
00810         // reverse off
00811         case ANSI_SGM_TA_REV_OFF:
00812             if (reverse)
00813             {
00814                 reverse = 0;
00815                 _in->insert(pos, std::string("") + CCTCP2 + "V-" + CCTCP2);
00816                 pos += 4;   // consume the additions
00817             }
00818             break;
00819
00820         // concealed
00821         case ANSI_SGM_TA_CONSEAL:
00822             // TODO: wtf is this?  make foreground same color as back?
00823             break;
00824
00825         case ANSI_SGM_FC_BLK:
00826         case ANSI_SGM_FC_RED:
00827         case ANSI_SGM_FC_GRN:
00828         case ANSI_SGM_FC_YEL:
00829         case ANSI_SGM_FC_BLU:
00830         case ANSI_SGM_FC_MAG:
00831         case ANSI_SGM_FC_CYN:
00832         case ANSI_SGM_FC_WHT:
00833             _in->insert(pos, std::string("") + CCTCP2 +
00834                 fgColorMap[_seq->param(i) - 30 + (bold ? 8 : 0)] +
00835                 CCTCP2);
00836             pos += 5;       // consume the additions
00837             break;
00838
00839         case ANSI_SGM_FC_DEFAULT:
00840             _in->insert(pos, std::string("") + CCTCP2 + "C.-" + CCTCP2);
00841             pos += 5;       // consume the additions
00842             break;
00843
00844         case ANSI_SGM_BC_BLK:
00845         case ANSI_SGM_BC_RED:
00846         case ANSI_SGM_BC_GRN:
00847         case ANSI_SGM_BC_YEL:
00848         case ANSI_SGM_BC_BLU:
00849         case ANSI_SGM_BC_MAG:
00850         case ANSI_SGM_BC_CYN:
00851         case ANSI_SGM_BC_WHT:
00852             _in->insert(pos, std::string("") +
00853                 CCTCP2 + bgColorMap[_seq->param(i) - 40] + CCTCP2);
00854             pos += 5;       // consume the additions
00855             break;
00856
00857         case ANSI_SGM_BC_DEFAULT:
00858             _in->insert(pos, std::string("") + CCTCP2 + "C-." + CCTCP2);
00859             pos += 5;       // consume the additions
00860             break;
00861
00862         }
00863     }
00864 }
00865
00866
00867 void
00868 ansiAttrCvt::do_C ()
00869 {
00870     for (int i = 0; i < _seq->param(_seq->paramc() - 1); i++)
00871         _in->insert(pos++, " ");
00872 }
Generated on Sun Oct 21 12:41:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CTCP2Parse.hpp Source File

common/CTCP2Parse.hpp

Go to the documentation of this file.
00001 /*
00002  ------------------------------------------------------------------------------
00003  * CTCP2Parse.hpp --
00004  *
00005  *  a C++ implementation of the Text attribute section of the CTCP/2
00006  *  draft by Robey Pointer (that eggdrop dude) and friends.  This code
00007  *  is based directly from Robey's Java example.  This code includes
00008  *  full support for decoding mIrc, ANSI, and ircII attributes as well.
00009  *
00010  *  See -+-> http://www.lag.net/~robey/ctcp
00011  *       +-> http://www.egroups.com/group/ctcp2
00012  *
00013  *  Depends: STL string template, no OS specifics.
00014  *
00015  *  This source is under BSD license and has no restrictions the way
00016  *  the GPL does.  Sell it for all I care.  Just be nice and give me
00017  *  credit for it.  Although it's not a requirement.
00018  *
00019  *  Author: David Gravereaux <davygrvy@pobox.com>
00020  *      Tomahawk Software Group
00021  *
00022  *  Conversion routines donated by Keith Lea <keith@cs.oswego.edu>
00023  *
00024  * RCS: @(#) $Id: CTCP2Parse.hpp,v 1.4 2001/02/04 10:19:57 davygrvy Exp $
00025  ------------------------------------------------------------------------------
00026  */
00027
00028
00029 #ifndef Inc_CTCP2Parse_hpp__
00030 #define Inc_CTCP2Parse_hpp__
00031
00032 #include <string>
00033 #include <vector>
00034
00035
00036 // mIrc to CTCP/2 attribute convertor
00037 class mircAttrCvt
00038 {
00039 public:
00040     void mirc2ctcp(std::string *in);
00041 private:
00042     static const char tokens[2];
00043     static const char *mirc2ctcpmap[17];
00044     int extractcolor (std::string *in, int start, short *fg, short *bg);
00045 };
00046
00047
00048 // ircII to CTCP/2 attribute convertor
00049 class irciiAttrCvt
00050 {
00051 public:
00052     void ircii2ctcp(std::string *in);
00053 private:
00054     static const char tokens[5];
00055 };
00056
00057
00058 // ANSI escape sequences to CTCP/2 attribute convertor
00059 class ansiAttrCvt
00060 {
00061 public:
00062     void ansi2ctcp(std::string *in);
00063 private:
00064     void do_m ();
00065     void do_C ();
00066
00067     const static char *escSeq;
00068     const static char *fgColorMap[16];
00069     const static char *bgColorMap[8];
00070
00071     int pos;
00072     int bold, underline, reverse, blink, italic;
00073
00074     std::string *_in;
00075
00076     //  A simple ansi escape sequence extractor class
00077     class AnsiSeq
00078     {
00079         std::string *_seq;
00080         std::vector<int> _params;
00081         char _verb;
00082         static const char *_notOf;
00083
00084     public:
00085         AnsiSeq (std::string *in, int pos);
00086         ~AnsiSeq ();
00087
00088         char verb () { return _verb; }
00089         const char *seq () { return _seq->c_str(); }
00090         int paramc () { return _params.size(); }
00091         int param (int index) { return _params[index]; }
00092     };
00093
00094     AnsiSeq *_seq;
00095 };
00096
00097
00098 // CTCP/2 embedded attribute parser and action invoker.
00099 //
00100 class CTCP2Parse : protected mircAttrCvt, irciiAttrCvt, ansiAttrCvt
00101 {
00102 protected:
00103     // encoding flags.
00104     enum EncodingType
00105     {
00106         iso8859_1, iso8859_2, iso8859_3, iso8859_4, iso8859_5, iso8859_6,
00107         iso8859_7, iso8859_8, iso8859_9, UTF_8
00108     };
00109
00110     // Character spacing.
00111     enum CharSpacingType { Fixed, Proportional };
00112
00113     // 24-bit colors (initialized here as integers for clarity)
00114     enum ColorType
00115     {
00116         Black      = 0x000000,
00117         Blue       = 0x00007F,
00118         Green      = 0x007F00,
00119         Cyan       = 0x007F7F,
00120         Red        = 0x7F0000,
00121         Magenta    = 0x7F007F,
00122         Yellow     = 0x7F7F00,
00123         Lt_Grey    = 0xC0C0C0,
00124         Grey       = 0x7F7F7F,
00125         Lt_Blue    = 0x0000FF,
00126         Lt_Green   = 0x00FF00,
00127         Lt_Cyan    = 0x00FFFF,
00128         Lt_Red     = 0xFF0000,
00129         Lt_Magenta = 0xFF00FF,
00130         Lt_Yellow  = 0xFFFF00,
00131         White      = 0xFFFFFF
00132     };
00133
00134     CTCP2Parse();
00135
00136     void SetDefaults (
00137         unsigned char fgR = (unsigned char) ((Lt_Grey & 0xFF0000) >> 16),
00138         unsigned char fgG = (unsigned char) ((Lt_Grey & 0x00FF00) >> 8),
00139         unsigned char fgB = (unsigned char) (Lt_Grey & 0x0000FF),       // default foreground color.
00140
00141         unsigned char bgR = (unsigned char) ((Black & 0xFF0000) >> 16),
00142         unsigned char bgG = (unsigned char) ((Black & 0x00FF00) >> 8),
00143         unsigned char bgB = (unsigned char) (Black & 0x0000FF),     // default background color.
00144
00145         CharSpacingType cpDef_ = Fixed,     // default spacing.
00146         EncodingType encDef_ = iso8859_1    // default encoding.
00147         );
00148
00149     void ParseIt(std::string *line);
00150
00151     virtual void PushStart () = 0;
00152     virtual void PushBold (bool) = 0;
00153     virtual void PushReverse (bool) = 0;
00154     virtual void PushUnderline (bool) = 0;
00155     virtual void PushOverstrike (bool) = 0;
00156     virtual void PushItalic (bool) = 0;
00157     virtual void PushBlink (bool) = 0;
00158     virtual void PushURL (bool) = 0;
00159     virtual void PushEncoding (EncodingType) = 0;
00160     virtual void PushSpacing (CharSpacingType) = 0;
00161     virtual void PushFontSize (int) = 0;
00162     virtual void PushForegroundColor (unsigned char R, unsigned char G, unsigned char B) = 0;
00163     virtual void PushBackgroundColor (unsigned char R, unsigned char G, unsigned char B) = 0;
00164     virtual void PushTextSegment (std::string *) = 0;
00165
00166 private:
00167     typedef struct
00168     {
00169         union
00170         {
00171             // don't assume the sizeof(int)
00172             __int32 RGB;
00173             struct
00174             {
00175 #ifdef _M_IX86  /* little endien */
00176                 unsigned char B;
00177                 unsigned char G;
00178                 unsigned char R;
00179                 unsigned char nul_void_ignore;
00180 #else           /* big endien */
00181                 unsigned char nul_void_ignore;
00182                 unsigned char R;
00183                 unsigned char G;
00184                 unsigned char B;
00185 #endif
00186             };
00187         };
00188     } RGBColor;
00189
00190     inline void decodeToggle (std::string *line, int *parseFrmChar, int *parseEndChar, int *varCnt)
00191     {
00192         (*parseFrmChar)++;   // consume the attribute
00193         if (*parseFrmChar < *parseEndChar)
00194         {
00195             if (line->at(*parseFrmChar) == '+')
00196             {
00197                 (*varCnt)++;
00198                 (*parseFrmChar)++;   // consume the '+'
00199             }
00200             else if (line->at(*parseFrmChar) == '-')
00201             {
00202                 if ((*varCnt) > 0)
00203                     (*varCnt)--;
00204                 (*parseFrmChar)++;   // consume the '-'
00205             }
00206         }
00207         else
00208             (*varCnt)++;  // default to a '+'
00209     }
00210
00211     inline int decodeColor
00212         (std::string *line, int *parseFrmChar, int *parseEndChar, RGBColor *c)
00213     {
00214         if (line->at(*parseFrmChar) == '#')
00215         {
00216             (*parseFrmChar)++;   // consume it
00217             if (*parseFrmChar + 6 <= *parseEndChar)
00218             {
00219                 unsigned char C = 0;
00220
00221                 c->RGB = 0;     // start with a clean plate
00222
00223                 // hi-byte red
00224                 if (!fromHex(line->at(*parseFrmChar), &C)) return 3;
00225                 (*parseFrmChar)++;  // consume the hex character
00226                 c->R |= (C << 4);
00227
00228                 // lo-byte red
00229                 if (!fromHex(line->at(*parseFrmChar), &C)) return 4;
00230                 (*parseFrmChar)++;  // consume the hex character
00231                 c->R |= C;
00232
00233                 // hi-byte green
00234                 if (!fromHex(line->at(*parseFrmChar), &C)) return 5;
00235                 (*parseFrmChar)++;  // consume the hex character
00236                 c->G |= (C << 4);
00237
00238                 // lo-byte green
00239                 if (!fromHex(line->at(*parseFrmChar), &C)) return 6;
00240                 (*parseFrmChar)++;  // consume the hex character
00241                 c->G |= C;
00242
00243                 // hi-byte blue
00244                 if (!fromHex(line->at(*parseFrmChar), &C)) return 7;
00245                 (*parseFrmChar)++;  // consume the hex character
00246                 c->B |= (C << 4);
00247
00248                 // lo-byte blue
00249                 if (!fromHex(line->at(*parseFrmChar), &C)) return 8;
00250                 (*parseFrmChar)++;  // consume the hex character
00251                 c->B |= C;
00252             } else {
00253                 // rollback the error...
00254                 return 3;
00255             }
00256         } else {
00257             unsigned char index = 0;
00258             if (!fromHex(line->at(*parseFrmChar), &index)) return 3;
00259             (*parseFrmChar)++;  // consume the hex character
00260             c->RGB = indexColor[index].RGB;
00261         }
00262         return 0;
00263     }
00264
00265     inline int fromHex(unsigned char h, unsigned char *val)
00266     {
00267         // 0 - 9
00268         if (h > 47 && h < 58) *val = (h - 48);
00269         // A - F
00270         else if (h > 64 && h < 71) *val = (h - 55);
00271         else return 0;   // throw a little conversion exception
00272         return 1;
00273     }
00274
00275     inline void PushOut (void)
00276     {
00277         // notify the derived class, we are about to start a new attribute set.
00278         PushStart();
00279
00280         // never push-out ALL the attributes -- only the CHANGED ones.
00281
00282         if ((boldCnt > 0) ^ boldLast) PushBold (boldLast = !boldLast ? true : false);
00283         if ((revCnt > 0) ^ revLast) PushReverse (revLast = !revLast ? true : false);
00284         if ((underCnt > 0) ^ underLast) PushUnderline (underLast = !underLast ? true : false);
00285         if ((overCnt > 0) ^ overLast) PushOverstrike (overLast = !overLast ? true : false);
00286         if ((italicCnt > 0) ^ italicLast) PushItalic (italicLast = !italicLast ? true : false);
00287         if ((blinkCnt > 0) ^ blinkLast) PushBlink (blinkLast = !blinkLast ? true : false);
00288         if ((urlCnt > 0) ^ urlLast) PushURL (urlLast = !urlLast ? true : false);
00289         if (enc ^ encLast) PushEncoding (encLast = enc);
00290         if (cp ^ cpLast) PushSpacing (cpLast = cp);
00291         if (fntSize ^ fntLast) PushFontSize (fntLast = fntSize);
00292
00293         if (fg.RGB ^ fgLast.RGB)
00294         {
00295             fgLast.RGB = fg.RGB;
00296             PushForegroundColor(fg.R, fg.G, fg.B);
00297         }
00298         if (bg.RGB ^ bgLast.RGB)
00299         {
00300             bgLast.RGB = bg.RGB;
00301             PushBackgroundColor(bg.R, bg.G, bg.B);
00302         }
00303
00304         PushTextSegment(segment);
00305     }
00306
00307     static const RGBColor indexColor[16];   // Array for indexing the color values
00308     EncodingType enc, encLast, encDef;  // storage for the encoding type
00309
00310     // storage for the toggle states
00311     int boldCnt,  revCnt,  overCnt,  underCnt,  italicCnt,  blinkCnt,  urlCnt;
00312     int boldLast, revLast, overLast, underLast, italicLast, blinkLast, urlLast;
00313     int fntSize, fntLast;
00314
00315     CharSpacingType cp, cpLast, cpDef;  // storage for font spacing type
00316
00317     RGBColor    fg, fgLast, fgDef, bg, bgLast, bgDef;
00318
00319     std::string *segment;
00320 };
00321
00322 #endif
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsAlert.cpp Source File

common/CvsAlert.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // CvsAlert.cpp : implementation file
00022 //
00023
00024 #include "stdafx.h"
00025
00026 #ifdef macintosh
00027 #   define kDlgIdAlert 129
00028 #   include <Dialogs.h>
00029 #   include <TextUtils.h>
00030 #   include <string.h>
00031 #   include "MacMisc.h"
00032 #endif /* macintosh */
00033
00034 #if qUnix
00035 #   include "UCvsDialogs.h"
00036 #endif
00037
00038 #ifdef WIN32
00039 #   include "resource.h"
00040
00041 #   ifdef _DEBUG
00042 #   define new DEBUG_NEW
00043 #   undef THIS_FILE
00044     static char THIS_FILE[] = __FILE__;
00045 #   endif
00046 #endif /* WIN32 */
00047
00048 #include "CvsAlert.h"
00049
00050 #ifdef WIN32
00051
00052 // CCVSAlert dialog
00053
00054
00055 CCVSAlert::CCVSAlert(const char *prompt, const char *defhit, const char *cnclhit,
00056                      CWnd* pParent /*=NULL*/)
00057     : CDialog(CCVSAlert::IDD, pParent)
00058 {
00059     //{{AFX_DATA_INIT(CCVSAlert)
00060     m_prompt = prompt != NULL ? prompt : "";
00061     m_cnclhit = cnclhit != NULL ? cnclhit : "";
00062     m_defhit = defhit != NULL ? defhit : "";
00063     //}}AFX_DATA_INIT
00064 }
00065
00066
00067 void CCVSAlert::DoDataExchange(CDataExchange* pDX)
00068 {
00069     CDialog::DoDataExchange(pDX);
00070     //{{AFX_DATA_MAP(CCVSAlert)
00071     DDX_Text(pDX, IDC_ALRTMSG, m_prompt);
00072     DDX_Text(pDX, IDCANCEL, m_cnclhit);
00073     DDX_Text(pDX, IDOK, m_defhit);
00074     //}}AFX_DATA_MAP
00075 }
00076
00077
00078 BEGIN_MESSAGE_MAP(CCVSAlert, CDialog)
00079     //{{AFX_MSG_MAP(CCVSAlert)
00080         // NOTE: the ClassWizard will add message map macros here
00081     //}}AFX_MSG_MAP
00082 END_MESSAGE_MAP()
00083
00085 // CCVSAlert message handlers
00086 #endif /* WIN32 */
00087
00088 #ifdef macintosh
00089     static const char *sPrompt = 0L, *sDefhit = 0L, *sCnclhit = 0L;
00090
00091     static pascal Boolean AlertModalFilter(DialogPtr dlog, EventRecord *event, short *itemHit)
00092     {
00093         DialogPtr evtDlog;
00094         short selStart,selEnd;
00095
00096         if (event->what == activateEvt && (event->modifiers & activeFlag) != 0)
00097         {
00098             Str255 pp, pd, pc;
00099             c2pstrcpy(pp, sPrompt);
00100             c2pstrcpy(pd, sDefhit);
00101             c2pstrcpy(pc, sCnclhit);
00102
00103             SetControlTitle(GetDItemCtrlHdl(dlog, 1), pd);
00104             SetControlTitle(GetDItemCtrlHdl(dlog, 2), pc);
00105             SetDialogItemText(GetDItemHdl(dlog, 3), pp);
00106         }
00107
00108         return false;          // For all non-keyDown events
00109     }
00110 #endif /* macintosh */
00111
00112 #if qUnix
00113 class UAskYesNo : public UWidget
00114 {
00115     UDECLARE_DYNAMIC(UAskYesNo)
00116 public:
00117     UAskYesNo() : UWidget(::UEventGetWidID()) {}
00118     virtual ~UAskYesNo() {}
00119
00120     enum
00121     {
00122         kOK = EV_COMMAND_START, // 0
00123         kCancel,                // 1
00124         kText                   // 2
00125     };
00126
00127 protected:
00128     ev_msg int OnOK(void);
00129     ev_msg int OnCancel(void);
00130
00131     UDECLARE_MESSAGE_MAP()
00132 };
00133
00134 UIMPLEMENT_DYNAMIC(UAskYesNo, UWidget)
00135
00136 UBEGIN_MESSAGE_MAP(UAskYesNo, UWidget)
00137     ON_UCOMMAND(UAskYesNo::kOK, UAskYesNo::OnOK)
00138     ON_UCOMMAND(UAskYesNo::kCancel, UAskYesNo::OnCancel)
00139 UEND_MESSAGE_MAP()
00140
00141 int UAskYesNo::OnOK(void)
00142 {
00143     EndModal(true);
00144     return 0;
00145 }
00146
00147 int UAskYesNo::OnCancel(void)
00148 {
00149     EndModal(false);
00150     return 0;
00151 }
00152 #endif
00153
00154 bool CvsAlert(const char *prompt, const char *defhit, const char *cnclhit)
00155 {
00156 #ifdef WIN32
00157     CCVSAlert gv(prompt, defhit, cnclhit);
00158     return gv.DoModal() == IDOK;
00159 #endif /* WIN32 */
00160 #ifdef macintosh
00161     static ModalFilterUPP filter = NULL;
00162
00163     if(filter == NULL)
00164         filter = NewModalFilterUPP(AlertModalFilter);
00165
00166     sPrompt = prompt;
00167     sDefhit = defhit;
00168     sCnclhit = cnclhit;
00169
00170     return CautionAlert(kDlgIdAlert, filter) == 1;
00171 #endif /* macintosh */
00172 #if qUnix
00173     void *wid = UCreate_AskYesNo();
00174
00175     UAskYesNo *dlg = new UAskYesNo();
00176     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00177     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, kUMainWidget, (void *)"Alert");
00178     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, UAskYesNo::kOK, (void *)defhit);
00179     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, UAskYesNo::kCancel, (void *)cnclhit);
00180     UEventSendMessage(dlg->GetWidID(), EV_SETTEXT, UAskYesNo::kText, (void *)prompt);
00181
00182     bool res = dlg->DoModal();
00183     delete dlg;
00184     return res;
00185 #endif
00186 }
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsAlert.h Source File

common/CvsAlert.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 // CvsAlert.h : header file
00022 //
00023
00024 #if !defined(AFX_CVSALERT_H__ACFE8C41_9836_11D1_AE50_00C0F0067852__INCLUDED_)
00025 #define AFX_CVSALERT_H__ACFE8C41_9836_11D1_AE50_00C0F0067852__INCLUDED_
00026
00027 #if _MSC_VER >= 1000
00028 #pragma once
00029 #endif // _MSC_VER >= 1000
00030
00031 bool CvsAlert(const char *prompt, const char *defhit, const char *cnclhit);
00032     // return true if defhit is hit.
00033
00034 #ifdef WIN32
00035
00036 // CCVSAlert dialog
00037
00038 class CCVSAlert : public CDialog
00039 {
00040 // Construction
00041 public:
00042     CCVSAlert(const char *prompt, const char *defhit, const char *cnclhit,
00043         CWnd* pParent = NULL);   // standard constructor
00044
00045 // Dialog Data
00046     //{{AFX_DATA(CCVSAlert)
00047     enum { IDD = IDD_ALERT };
00048     CString m_prompt;
00049     CString m_defhit;
00050     CString m_cnclhit;
00051     //}}AFX_DATA
00052
00053
00054 // Overrides
00055     // ClassWizard generated virtual function overrides
00056     //{{AFX_VIRTUAL(CCVSAlert)
00057     protected:
00058     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00059     //}}AFX_VIRTUAL
00060
00061 // Implementation
00062 protected:
00063
00064     // Generated message map functions
00065     //{{AFX_MSG(CCVSAlert)
00066         // NOTE: the ClassWizard will add member functions here
00067     //}}AFX_MSG
00068     DECLARE_MESSAGE_MAP()
00069 };
00070
00071 //{{AFX_INSERT_LOCATION}}
00072 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00073 #endif /* WIN32 */
00074
00075 #endif // !defined(AFX_CVSALERT_H__ACFE8C41_9836_11D1_AE50_00C0F0067852__INCLUDED_)
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsArgs.cpp Source File

common/CvsArgs.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * CvsArgs.cpp --- class to handle cvs arguments
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include <stdlib.h>
00028 #include <string.h>
00029
00030 #include "CvsPrefs.h"
00031 #include "CvsArgs.h"
00032 #include "AppConsole.h"
00033 #include "Authen.h"
00034
00035 #ifdef WIN32
00036 #   ifdef _DEBUG
00037 #   define new DEBUG_NEW
00038 #   undef THIS_FILE
00039     static char THIS_FILE[] = __FILE__;
00040 #   endif
00041 #endif /* WIN32 */
00042
00043 static char *mystrdup(const char *string)
00044 {
00045     int size = strlen(string);
00046     char *result = (char *)malloc((size + 1) * sizeof(char));
00047     if(result == NULL)
00048     {
00049         cvs_err("Impossible to allocate %d bytes !\n", size + 1);
00050         exit(1);
00051     }
00052     strcpy(result, string);
00053     return result;
00054 }
00055
00056 CvsArgs::CvsArgs(bool defargs)
00057 {
00058     argv = NULL;
00059     argc = 0;
00060
00061     reset(defargs);
00062 }
00063
00064 CvsArgs::CvsArgs(char * const *fromargv, int fromargc)
00065 {
00066     argv = NULL;
00067     argc = 0;
00068
00069     reset(false);
00070
00071     for(int i = 0; i < fromargc; i++)
00072     {
00073         add(fromargv[i]);
00074     }
00075 }
00076
00077 CvsArgs::~CvsArgs()
00078 {
00079     reset(false);
00080 }
00081
00082 void CvsArgs::reset(bool defargs)
00083 {
00084     if(argv != 0L)
00085     {
00086         for(int i = 0; i < argc; i++)
00087         {
00088             if(argv[i] != 0L)
00089                 free(argv[i]);
00090         }
00091         free(argv);
00092     }
00093
00094     argc = 0;
00095     argv = NULL;
00096
00097     if(defargs)
00098     {
00099         int numargs = 1;
00100
00101         if(gCvsPrefs.Z9Option())
00102             numargs++;
00103         if(gCvsPrefs.QuietOption())
00104             numargs++;
00105         if(gCvsPrefs.AlwaysUseCvsroot())
00106             numargs += 2;
00107
00108         argv = (char **)malloc(numargs * sizeof(char *));
00109         argv[argc++] = mystrdup("cvs");
00110         if(gCvsPrefs.AlwaysUseCvsroot())
00111         {
00112             argv[argc++] = mystrdup("-d");
00113             CStr root;
00114             const char *ccvsroot = gCvsPrefs;
00115             ccvsroot = Authen::skiptoken(ccvsroot);
00116             root = gAuthen.token();
00117             root << ccvsroot;
00118             argv[argc++] = mystrdup(root);
00119         }
00120         if(gCvsPrefs.Z9Option())
00121         {
00122             CStr zlev("-z");
00123             zlev << gCvsPrefs.ZLevel();
00124             argv[argc++] = mystrdup(zlev);
00125         }
00126         if(gCvsPrefs.QuietOption())
00127             argv[argc++] = mystrdup("-q");
00128     }
00129 }
00130
00131 // reduce a long string for printing, add "..." if the length
00132 // is up the limit
00133 #define MAX_PRINT_ARG 80
00134 static char *reduceString(const char *str, CStaticAllocT<char> & buf)
00135 {
00136     buf.AdjustSize(MAX_PRINT_ARG + 4); // "..." + '\0'
00137     size_t len = strlen(str);
00138     if(len < MAX_PRINT_ARG)
00139     {
00140         strcpy(buf, str);
00141     }
00142     else
00143     {
00144         memcpy((char *)buf, str, MAX_PRINT_ARG * sizeof(char));
00145         char *tmp = (char *)buf + MAX_PRINT_ARG;
00146         *tmp++ = '.';
00147         *tmp++ = '.';
00148         *tmp++ = '.';
00149         *tmp = '\0';
00150     }
00151
00152     return buf;
00153 }
00154
00155 // replace \n by "\n" so it's readable
00156 static char *expandLF(const char *str, CStaticAllocT<char> & buf)
00157 {
00158     int numLFs = 0;
00159     const char *runner = str;
00160     while((runner = strchr(runner, '\n')) != 0L)
00161     {
00162         numLFs++;
00163         runner++;
00164     }
00165
00166     size_t len = strlen(str);
00167     buf.AdjustSize(len + numLFs + 1); // numLFs * "\n" + '\0'
00168
00169     char *tmp = buf;
00170     char c;
00171     runner = str;
00172     while((c = *runner++) != '\0')
00173     {
00174         if(c == '\n')
00175         {
00176             *tmp++ = '\\';
00177             *tmp++ = 'n';
00178         }
00179         else
00180             *tmp++ = c;
00181     }
00182     *tmp++ = '\0';
00183
00184     return buf;
00185 }
00186
00187 static CStaticAllocT<char> buf;
00188
00189 void CvsArgs::print(const char *indirectory)
00190 {
00191     static CStaticAllocT<char> buf;
00192
00193     for(int i = 0; i < argc; i++)
00194     {
00195         CStr newarg;
00196         newarg = argv[i];
00197         bool hasLF = strchr(newarg, '\n') != 0L;
00198         size_t len = newarg.length();
00199
00200         if(len > MAX_PRINT_ARG)
00201             newarg = reduceString(newarg, buf);
00202
00203         if(hasLF)
00204             newarg = expandLF(newarg, buf);
00205
00206         bool hasSpace = strchr(newarg, ' ') != 0L;
00207         if(hasSpace)
00208             cvs_out("\"");
00209         cvs_outstr(newarg, newarg.length());
00210         if(hasSpace)
00211             cvs_out("\"");
00212         cvs_out(" ");
00213     }
00214     if(indirectory != NULL)
00215         cvs_out("(in directory %s)", indirectory);
00216     cvs_out("\n");
00217 }
00218
00219 void CvsArgs::add(const char *arg)
00220 {
00221     if(argv == 0L)
00222         argv = (char **)malloc(2 * sizeof(char *));
00223     else
00224         argv = (char **)realloc(argv, (argc + 2) * sizeof(char *));
00225     argv[argc++] = arg != 0L ? mystrdup(arg) : 0L;
00226     argv[argc] = 0L;
00227 }
00228
00229 void CvsArgs::addfile(const char *arg, const char * /*dir*/, const FSSpec * /*spec*/)
00230 {
00231     add(arg);
00232 }
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsArgs.h Source File

common/CvsArgs.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * CvsArgs.h --- class to handle cvs arguments
00023  */
00024
00025 #ifndef CVSARGS_H
00026 #define CVSARGS_H
00027
00028 #ifdef macintosh
00029 #   include <Files.h>
00030 #else /* !macintosh */
00031     typedef int FSSpec;
00032 #endif /* !macintosh */
00033
00034 class CvsArgs
00035 {
00036 public :
00037     CvsArgs(bool defargs = true);
00038         // append "cvs" and misc options
00039         // defined by preferences ("-z9" for example)
00040     CvsArgs(char * const *fromargv, int fromargc);
00041     virtual ~CvsArgs();
00042
00043     // add arguments
00044     virtual void add(const char *arg);
00045     virtual void addfile(const char *arg, const char *dir = 0L,
00046         const FSSpec *spec = 0L);
00047
00048     void reset(bool defargs = true);
00049         // see the constructor
00050
00051     void print(const char *indirectory = 0L);
00052         // print the command line to the console
00053
00054     char * const *Argv(void) const {return argv;}
00055     int Argc(void) const {return argc;}
00056 protected:
00057     char **argv;
00058     int argc;
00059 };
00060
00061 #endif /* CVSPREFS_H */
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsCommands.cpp Source File

common/CvsCommands.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * CvsCommands.cpp --- set of CVS commands
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include <errno.h>
00028
00029 #ifdef WIN32
00030 #   include "wincvs.h"
00031
00032 #   ifdef _DEBUG
00033 #   define new DEBUG_NEW
00034 #   undef THIS_FILE
00035     static char THIS_FILE[] = __FILE__;
00036 #   endif
00037 #endif /* WIN32 */
00038
00039 #include "CvsCommands.h"
00040 #include "CvsPrefs.h"
00041 #include "Authen.h"
00042 #include "CvsArgs.h"
00043 #include "MultiFiles.h"
00044 #include "PromptFiles.h"
00045 #include "AppConsole.h"
00046 #include "AppGlue.h"
00047 #include "MoveToTrash.h"
00048 #include "LineCmd.h"
00049 #include "CvsAlert.h"
00050 #include "TextBinary.h"
00051 #include "CommitDlg.h"
00052 #include "ImportDlg.h"
00053 #include "CheckoutDlg.h"
00054 #include "TclGlue.h"
00055 #include "ImportFilterDlg.h"
00056 #include "UpdateDlg.h"
00057 #include "LogDlg.h"
00058 #include "DiffDlg.h"
00059 #include "LogParse.h"
00060 #include "RtagDlg.h"
00061 #include "TagDlg.h"
00062 #include "InitDlg.h"
00063 #include "ReleaseDlg.h"
00064 #include "AnnotateDlg.h"
00065
00066 #ifdef qMacCvsPP
00067 #   include "AppGlue.mac.h"
00068 #endif
00069
00070 // - clean up the log message for the server.
00071 // - put the good line feeds
00072 // - TODO mac : ISO conversion
00073 char *cleanUpLogMsg(const char *msg)
00074 {
00075     static CStaticAllocT<char> buf;
00076
00077     size_t len = strlen(msg);
00078     buf.AdjustSize(len + 1);
00079
00080     char *tmp = buf;
00081     char c;
00082     while((c = *msg++) != '\0')
00083     {
00084 #ifdef WIN32
00085         if(c == '\r')
00086             continue;
00087 #endif /* WIN32 */
00088 #ifdef macintosh
00089         if(c == '\r')
00090             c = '\n';
00091 #endif /* macintosh */
00092         *tmp++ = c;
00093     }
00094     *tmp++ = '\0';
00095
00096     return buf;
00097 }
00098
00099 void
00100 CvsCmdUpdateFolder(const char *dir, bool queryOnly)
00101 {
00102     if(gCvsPrefs.empty())
00103         return;
00104
00105     if(dir == 0L)
00106         dir = BrowserGetDirectory("Select a directory to update :");
00107     if(dir == 0L)
00108         return;
00109
00110     bool toStdout;
00111     bool noRecurs;
00112     bool resetSticky;
00113     CPStr date;
00114     CPStr rev;
00115     bool useMostRecent;
00116     CPStr rev1;
00117     CPStr rev2;
00118     bool createMissDir;
00119     bool getCleanCopy;
00120
00121     if(!queryOnly && !CompatGetUpdate(toStdout, noRecurs, resetSticky,
00122         date, rev, useMostRecent, rev1, rev2, createMissDir, getCleanCopy))
00123         return;
00124
00125     CvsArgs args;
00126     if(queryOnly)
00127         args.add("-n");
00128     args.add("update");
00129     if(gCvsPrefs.PruneOption())
00130         args.add("-P");
00131
00132     if(!queryOnly)
00133     {
00134         if(resetSticky)
00135             args.add("-A");
00136         if(createMissDir)
00137             args.add("-d");
00138         if(getCleanCopy)
00139             args.add("-C");
00140         if(!date.empty())
00141         {
00142             args.add("-D");
00143             args.add(date);
00144         }
00145         if(useMostRecent)
00146             args.add("-f");
00147         if(!rev1.empty())
00148         {
00149             CPStr tmp;
00150             tmp = "-j";
00151             tmp << rev1;
00152             args.add(tmp);
00153         }
00154         if(!rev2.empty())
00155         {
00156             CPStr tmp;
00157             tmp = "-j";
00158             tmp << rev2;
00159             args.add(tmp);
00160         }
00161         if(noRecurs)
00162             args.add("-l");
00163         if(toStdout)
00164             args.add("-p");
00165         if(!rev.empty())
00166         {
00167             args.add("-r");
00168             args.add(rev);
00169         }
00170     }
00171
00172     args.print(dir);
00173     launchCVS(dir, args.Argc(), args.Argv());
00174 }
00175
00176 void
00177 CvsCmdCommitFolder(const char *dir)
00178 {
00179     if(gCvsPrefs.empty())
00180         return;
00181
00182     if(dir == 0L)
00183         dir = BrowserGetDirectory("Select a directory to commit :");
00184     if(dir == 0L)
00185         return;
00186
00187     bool norecurs;
00188     CStr logmsg;
00189     bool forceCommit;
00190     bool forceRecurse;
00191     CPStr rev;
00192     bool noModuleProgram;
00193     if(!CompatGetCommit(logmsg, norecurs, forceCommit, forceRecurse, rev, noModuleProgram, dir))
00194         return;
00195
00196     CvsArgs args;
00197     args.add("commit");
00198     if(norecurs)
00199         args.add("-l");
00200     if(noModuleProgram)
00201         args.add("-n");
00202     if(forceRecurse)
00203         args.add("-R");
00204     if(forceCommit)
00205         args.add("-f");
00206     args.add("-m");
00207     args.add(cleanUpLogMsg(logmsg));
00208     if(!rev.empty())
00209     {
00210         args.add("-r");
00211         args.add(rev);
00212     }
00213     args.print(dir);
00214     launchCVS(dir, args.Argc(), args.Argv());
00215 }
00216
00217 void
00218 CvsCmdDiffFolder(const char *dir)
00219 {
00220     if(gCvsPrefs.empty())
00221         return;
00222
00223     if(dir == 0L)
00224         dir = BrowserGetDirectory("Select a directory to diff :");
00225
00226     if(dir == 0L)
00227         return;
00228
00229     bool noRecurs;
00230     bool isDate1;
00231     bool isDate2;
00232     bool useExtDiff;
00233     CPStr rev1;
00234     CPStr rev2;
00235     bool noWhiteSpace;
00236     bool ignoreCase;
00237
00238     if(!CompatGetDiff(noRecurs, isDate1, isDate2, rev1, rev2, useExtDiff, noWhiteSpace, ignoreCase))
00239         return;
00240
00241     CvsArgs args;
00242     args.add("diff");
00243
00244     if(noRecurs)
00245         args.add("-l");
00246     if(!rev1.empty())
00247     {
00248         args.add(isDate1 ? "-D" : "-r");
00249         args.add(rev1);
00250     }
00251     if(!rev2.empty())
00252     {
00253         args.add(isDate2 ? "-D" : "-r");
00254         args.add(rev2);
00255     }
00256     if(noWhiteSpace)
00257         args.add("-w"); //--ignore-all-space
00258     if(ignoreCase)
00259         args.add("-i"); //--ignore-case
00260
00261     args.print(dir);
00262     launchCVS(dir, args.Argc(), args.Argv());
00263 }
00264
00265 void
00266 CvsCmdAddFolder(const char *dir)
00267 {
00268     if(gCvsPrefs.empty())
00269         return;
00270
00271     if(dir == 0L)
00272         dir = BrowserGetDirectory("Select a directory to add :");
00273     if(dir == 0L)
00274         return;
00275
00276     CStr uppath, folder;
00277     if(!SplitPath(dir, uppath, folder))
00278     {
00279         cvs_err("Unable to convert path name '%s'\n", dir);
00280         return;
00281     }
00282
00283     CvsArgs args;
00284     args.add("add");
00285     args.add(folder);
00286     args.print(uppath);
00287     launchCVS(uppath, args.Argc(), args.Argv());
00288 }
00289
00290 void
00291 CvsCmdInit(const char *dir)
00292 {
00293     if(gCvsPrefs.empty())
00294         return;
00295
00296     bool forceCvsroot;
00297
00298     if(!CompatGetInit(forceCvsroot))
00299         return;
00300
00301     CvsArgs args;
00302
00303     if(forceCvsroot)
00304     {
00305         CStr root;
00306
00307         // extract from the cvsroot
00308         const char *ccvsroot = gCvsPrefs;
00309         ccvsroot = Authen::skiptoken(ccvsroot);
00310         root = gAuthen.token();
00311         root << ccvsroot;
00312         args.add("-d");
00313         args.add(root);
00314     }
00315
00316     args.add("init");
00317     args.print();
00318     launchCVS(0L, args.Argc(), args.Argv());
00319 }
00320
00321 void
00322 CvsCmdImportModule(const char *dir)
00323 {
00324     if(gCvsPrefs.empty())
00325         return;
00326
00327     if(dir == 0L)
00328         dir = BrowserGetDirectory("Select a directory to import :");
00329     if(dir == 0L)
00330         return;
00331
00332     ReportConflict * entries;
00333     ReportWarning * warnings;
00334
00335     if(!CompatImportFilter(dir, entries, warnings))
00336         return;
00337
00338     CPStr modname, vendortag, reltag, path(dir);
00339     CStr logmsg;
00340     bool useDefIgnore;
00341
00342     if(!CompatGetImport(modname, logmsg, vendortag, reltag, path, useDefIgnore))
00343         return;
00344
00345     CvsArgs args;
00346     args.add("import");
00347
00348     // fill the wrappers
00349     ReportConflict * tmpentry = entries;
00350     if( !useDefIgnore )
00351     {
00352         args.add("-I"); // no default (core, *.o...)
00353         args.add("!");
00354         args.add("-I"); // but ignore the CVS folders
00355         args.add("CVS");
00356     }
00357     while(tmpentry != 0L)
00358     {
00359         if(tmpentry->HasIgnore())
00360         {
00361             CPStr ign;
00362             args.add("-I");
00363             if(tmpentry->IsExtension())
00364                 ign << '*';
00365             ign << tmpentry->GetPattern();
00366             args.add(ign);
00367         }
00368         else if(!tmpentry->HasForceText() &&
00369             (tmpentry->IsBinary() || tmpentry->HasForceBinary() || tmpentry->HasForceNoKeywords() ))
00370         {
00371             CPStr wrap;
00372             const char *pattern = tmpentry->GetPattern();
00373             bool hasSpace = strchr(pattern, ' ') != 0L;
00374             args.add("-W");
00375             if(hasSpace)
00376                 wrap << '"';
00377             if(tmpentry->IsExtension())
00378                 wrap << '*';
00379             wrap << pattern;
00380             if(hasSpace)
00381                 wrap << '"';
00382             if( tmpentry->HasForceNoKeywords() )
00383                 wrap << " -k 'o'";
00384             else
00385                 wrap << " -k 'b'";
00386
00387             args.add(wrap);
00388         }
00389         tmpentry = tmpentry->next;
00390     }
00391
00392     free_list_types(warnings, entries);
00393
00394     args.add("-m");
00395     args.add(cleanUpLogMsg(logmsg));
00396     args.add(modname);
00397     args.add(vendortag);
00398     args.add(reltag);
00399     args.print(path);
00400     launchCVS(path, args.Argc(), args.Argv());
00401 }
00402
00403 void
00404 CvsCmdCheckoutModule(const char *dir)
00405 {
00406     if(gCvsPrefs.empty())
00407         return;
00408
00409 #ifndef WIN32
00410     if(dir == 0L)
00411         dir = BrowserGetDirectory("Select a directory to checkout to :");
00412     if(dir == 0L)
00413         return;
00414 #endif
00415
00416     bool norecurs;
00417     CPStr modname;
00418     CPStr path(dir);
00419     bool toStdout;
00420     CPStr date;
00421     CPStr rev;
00422     bool useMostRecent;
00423     bool doexport;
00424     bool forceCvsroot;
00425     bool overrideCheckoutDir;
00426     CPStr checkoutDir;
00427
00428     if( !CompatGetCheckout(modname, path, norecurs,
00429         toStdout, date, rev, useMostRecent, doexport, forceCvsroot,
00430         overrideCheckoutDir, checkoutDir) )
00431     {
00432         return;
00433     }
00434
00435     CvsArgs args;
00436
00437     if(forceCvsroot)
00438     {
00439         CStr root;
00440
00441         // extract from the cvsroot
00442         const char *ccvsroot = gCvsPrefs;
00443         ccvsroot = Authen::skiptoken(ccvsroot);
00444         root = gAuthen.token();
00445         root << ccvsroot;
00446         args.add("-d");
00447         args.add(root);
00448     }
00449
00450     args.add(doexport ? "export" : "checkout");
00451
00452     if(gCvsPrefs.PruneOption() && !doexport)
00453         args.add("-P");
00454     if(norecurs)
00455         args.add("-l");
00456     if(toStdout)
00457         args.add("-p");
00458     if(useMostRecent)
00459         args.add("-f");
00460     if(!date.empty())
00461     {
00462         args.add("-D");
00463         args.add(date);
00464     }
00465     if(!rev.empty())
00466     {
00467         args.add("-r");
00468         args.add(rev);
00469     }
00470
00471     if(doexport && rev.empty() && date.empty())
00472     {
00473         args.add("-r");
00474         args.add("HEAD");
00475     }
00476
00477     if( overrideCheckoutDir )
00478     {
00479         args.add("-d");
00480         args.add(checkoutDir);
00481     }
00482
00483     args.add(modname);
00484     args.print(path);
00485     launchCVS(path, args.Argc(), args.Argv());
00486 }
00487
00488 void
00489 CvsCmdRtagCreate(void)
00490 {
00491     if(gCvsPrefs.empty())
00492         return;
00493
00494     bool norecurs;
00495     bool useMostRecent;
00496     bool overwriteExisting;
00497     bool lookAttic;
00498     CPStr modname;
00499     CPStr tagname;
00500     CPStr date;
00501     CPStr rev;
00502
00503     if(!CompatRtagCreate(norecurs, overwriteExisting, tagname, modname, date, rev,
00504         useMostRecent, lookAttic))
00505             return;
00506
00507     CvsArgs args;
00508     args.add("rtag");
00509     if(norecurs)
00510         args.add("-l");
00511     if(useMostRecent)
00512         args.add("-f");
00513     if(overwriteExisting)
00514         args.add("-F");
00515     if(lookAttic)
00516         args.add("-a");
00517     if(!date.empty())
00518     {
00519         args.add("-D");
00520         args.add(date);
00521     }
00522     if(!rev.empty())
00523     {
00524         args.add("-r");
00525         args.add(rev);
00526     }
00527
00528     args.add(tagname);
00529     args.add(modname);
00530     args.print();
00531     launchCVS(0L, args.Argc(), args.Argv());
00532 }
00533
00534 void
00535 CvsCmdRtagDelete(void)
00536 {
00537     if(gCvsPrefs.empty())
00538         return;
00539
00540     bool norecurs;
00541     bool lookAttic;
00542     CPStr modname;
00543     CPStr tagname;
00544
00545     if(!CompatRtagDelete(norecurs, lookAttic, tagname, modname))
00546             return;
00547
00548     CvsArgs args;
00549     args.add("rtag");
00550     args.add("-d");
00551     if(norecurs)
00552         args.add("-l");
00553     if(lookAttic)
00554         args.add("-a");
00555
00556     args.add(tagname);
00557     args.add(modname);
00558     args.print();
00559     launchCVS(0L, args.Argc(), args.Argv());
00560 }
00561
00562 void
00563 CvsCmdRtagBranch(void)
00564 {
00565     if(gCvsPrefs.empty())
00566         return;
00567
00568     bool norecurs;
00569     bool useMostRecent;
00570     bool lookAttic;
00571     CPStr modname;
00572     CPStr branchname;
00573     CPStr date;
00574     CPStr rev;
00575
00576     if(!CompatRtagBranch(norecurs, branchname, modname, date, rev,
00577         useMostRecent, lookAttic))
00578             return;
00579
00580     CvsArgs args;
00581     args.add("rtag");
00582     args.add("-b");
00583     if(norecurs)
00584         args.add("-l");
00585     if(useMostRecent)
00586         args.add("-f");
00587     if(lookAttic)
00588         args.add("-a");
00589     if(!date.empty())
00590     {
00591         args.add("-D");
00592         args.add(date);
00593     }
00594     if(!rev.empty())
00595     {
00596         args.add("-r");
00597         args.add(rev);
00598     }
00599
00600     args.add(branchname);
00601     args.add(modname);
00602     args.print();
00603     launchCVS(0L, args.Argc(), args.Argv());
00604 }
00605
00606 void
00607 CvsCmdLogin(void)
00608 {
00609     if(gCvsPrefs.empty())
00610         return;
00611
00612     if(gAuthen.kind() != pserver)
00613     {
00614         cvs_err("Set the password authentication first in the preferences !\n");
00615         return;
00616     }
00617
00618     if(gCvsPrefs.HasLoogedIn() && gCvsPrefs.LogoutTimeOut() > 0)
00619     {
00620         cvs_err("Making automatic logout:\n");
00621         CvsCmdLogout();
00622         WaitForCvs();
00623     }
00624     gCvsPrefs.SetHasLoogedIn(true);
00625
00626     CvsArgs args;
00627     args.add("login");
00628     args.print();
00629     launchCVS(0L, args.Argc(), args.Argv());
00630 }
00631
00632 void
00633 CvsCmdLogout(void)
00634 {
00635     if(gCvsPrefs.empty())
00636         return;
00637
00638     if(gAuthen.kind() != pserver)
00639     {
00640         cvs_err("Set the password authentication first in the preferences !\n");
00641         return;
00642     }
00643
00644     gCvsPrefs.SetHasLoogedIn(false);
00645
00646     CvsArgs args;
00647     args.add("logout");
00648     args.print();
00649     launchCVS(0L, args.Argc(), args.Argv());
00650 }
00651
00652 void
00653 CvsCmdUpdateFiles(MultiFiles *mfarg, bool queryOnly)
00654 {
00655     if(gCvsPrefs.empty())
00656         return;
00657
00658     MultiFiles mf;
00659     if(mfarg == 0L)
00660     {
00661         if(!BrowserGetMultiFiles("Select files to update :", mf))
00662             return;
00663         mfarg = &mf;
00664     }
00665
00666     bool toStdout;
00667     bool noRecurs;
00668     bool resetSticky;
00669     CPStr date;
00670     CPStr rev;
00671     bool useMostRecent;
00672     CPStr rev1;
00673     CPStr rev2;
00674     bool createMissDir;
00675     bool getCleanCopy;
00676
00677     if(!queryOnly && !CompatGetUpdate(toStdout, noRecurs, resetSticky,
00678         date, rev, useMostRecent, rev1, rev2, createMissDir, getCleanCopy))
00679         return;
00680
00681     while(mfarg->next())
00682     {
00683         CvsArgs args;
00684         if(queryOnly)
00685             args.add("-n");
00686         args.add("update");
00687
00688         if(!queryOnly)
00689         {
00690             if(resetSticky)
00691                 args.add("-A");
00692             if(createMissDir)
00693                 args.add("-d");
00694             if(getCleanCopy)
00695                 args.add("-C");
00696             if(!date.empty())
00697             {
00698                 args.add("-D");
00699                 args.add(date);
00700             }
00701             if(useMostRecent)
00702                 args.add("-f");
00703             if(!rev1.empty())
00704             {
00705                 CPStr tmp;
00706                 tmp = "-j";
00707                 tmp << rev1;
00708                 args.add(tmp);
00709             }
00710             if(!rev2.empty())
00711             {
00712                 CPStr tmp;
00713                 tmp = "-j";
00714                 tmp << rev2;
00715                 args.add(tmp);
00716             }
00717             /*if(noRecurs)
00718                 args.add("-l");*/
00719             if(toStdout)
00720                 args.add("-p");
00721             if(!rev.empty())
00722             {
00723                 args.add("-r");
00724                 args.add(rev);
00725             }
00726         }
00727
00728         const char *dir = mfarg->add(args);
00729         args.print(dir);
00730         launchCVS(dir, args.Argc(), args.Argv());
00731     }
00732 }
00733
00734 void
00735 CvsCmdCommitFiles(MultiFiles *mfarg)
00736 {
00737     if(gCvsPrefs.empty())
00738         return;
00739
00740     MultiFiles mf;
00741     if(mfarg == 0L)
00742     {
00743         if(!BrowserGetMultiFiles("Select files to commit :", mf))
00744             return;
00745         mfarg = &mf;
00746     }
00747
00748     bool firstTime = true;
00749     bool norecurs;
00750     CStr logmsg;
00751     bool forceCommit;
00752     bool forceRecurse;
00753     CPStr rev;
00754     bool noModuleProgram;
00755     while(mfarg->next())
00756     {
00757         if(firstTime)
00758         {
00759             // we have to give the path where the commit is done is
00760             // the user expects to fill the CVS/Template file. we just
00761             // grab the first one for this purpose.
00762             const char *tmplDir = 0L;
00763             CStr pathTmpl, dontCareFile;
00764             if(mfarg->get(0, pathTmpl, dontCareFile))
00765                 tmplDir = pathTmpl;
00766
00767             if(!CompatGetCommit(logmsg, norecurs, forceCommit, forceRecurse, rev, noModuleProgram, tmplDir, mfarg))
00768                 return;
00769
00770             firstTime = false;
00771         }
00772
00773         CvsArgs args;
00774         args.add("commit");
00775         if(norecurs)
00776             args.add("-l");
00777         if(noModuleProgram)
00778             args.add("-n");
00779         if(forceRecurse)
00780             args.add("-R");
00781         if(forceCommit)
00782             args.add("-f");
00783         args.add("-m");
00784         args.add(cleanUpLogMsg(logmsg));
00785         if(!rev.empty())
00786         {
00787             args.add("-r");
00788             args.add(rev);
00789         }
00790         const char *dir = mfarg->add(args);
00791         args.print(dir);
00792         launchCVS(dir, args.Argc(), args.Argv());
00793     }
00794 }
00795
00796 #ifdef WIN32
00797 // Windows client may provide file names pointing into subfolders.
00798 // The function below removes folder separators by replacing them with dots,
00799 // the reason is that temporary file could be created without creating
00800 // matching subfolders in the temporary file folder
00801 static
00802 void
00803 FlatenSubFolders(CStr& tmpf)
00804 {
00805     char* cp = (char*)tmpf;
00806     if (cp)
00807     {
00808         while(*cp)
00809         {
00810             if (*cp == kPathDelimiter)
00811             {
00812                 *cp = '.';
00813             }
00814             cp++;
00815         }
00816     }
00817 }
00818 #else
00819 #define FlatenSubFolders(tmpf) // no-op on other platforms
00820 #endif
00821
00822 void
00823 CvsCmdDiffFiles(MultiFiles *mfarg)
00824 {
00825     if(gCvsPrefs.empty())
00826         return;
00827
00828     MultiFiles mf;
00829     if(mfarg == 0L)
00830     {
00831         if(!BrowserGetMultiFiles("Select files to diff :", mf))
00832             return;
00833         mfarg = &mf;
00834     }
00835
00836     bool noRecurs;
00837     bool isDate1;
00838     bool isDate2;
00839     bool useExtDiff;
00840     CPStr rev1;
00841     CPStr rev2;
00842     bool noWhiteSpace;
00843     bool ignoreCase;
00844     bool extDiffResult;
00845
00846     if(!CompatGetDiff(noRecurs, isDate1, isDate2, rev1, rev2, useExtDiff, noWhiteSpace, ignoreCase, true))
00847         return;
00848
00849     while(mfarg->next())
00850     {
00851         extDiffResult = false;
00852
00853         if (useExtDiff)
00854         {
00855             CStr path, filename, ext, base;
00856             CStr file1, file2;
00857             for(int i = 0; ; i++)
00858             {
00859                 if(!mfarg->get(i, path, filename))
00860                     break;
00861                 // note that filename can contain subfolders
00862
00863                 GetExtension(filename, base, ext);
00864
00865                 CvsArgs args;
00866                 CStr tmpf(base);
00867                 if(!rev1.empty())
00868                 {
00869                     tmpf << '_';
00870                     tmpf << rev1;
00871                     tmpf << '_';
00872                 }
00873                 else
00874                     tmpf << "_orig_";
00875
00876                 // convert subfolder names to regular name
00877                 FlatenSubFolders(tmpf);
00878
00879                 args.add("update");
00880                 args.add("-p");
00881                 if(!rev1.empty())
00882                 {
00883                     args.add(isDate1 ? "-D" : "-r");
00884                     args.add(rev1);
00885                 }
00886                 args.add(filename);
00887                 args.print(path);
00888                 file1 = launchCVS(path, args, (const char *)tmpf, ext);
00889 #ifdef qMacCvsPP
00890                 decodeCVS (file1);
00891 #endif
00892
00893                 if(rev2.empty())
00894                 {
00895                     file2 = path;
00896                     if(!file2.endsWith(kPathDelimiter))
00897                         file2 << kPathDelimiter;
00898                     file2 << filename;
00899                 }
00900                 else
00901                 {
00902                     CvsArgs args2;
00903
00904                     tmpf = base;
00905                     tmpf << '_';
00906                     tmpf << rev2;
00907                     tmpf << '_';
00908
00909                     // convert subfolder names to regular name
00910                     FlatenSubFolders(tmpf);
00911
00912                     args2.add("update");
00913                     args2.add("-p");
00914                     args2.add(isDate2 ? "-D" : "-r");
00915                     args2.add(rev2);
00916                     args2.add(filename);
00917                     args2.print(path);
00918                     file2 = launchCVS(path, args2, (const char *)tmpf, ext);
00919 #ifdef qMacCvsPP
00920                     decodeCVS (file2);
00921 #endif
00922                 }
00923
00924                 if(file1.empty() || file2.empty())
00925                     continue;
00926
00927                 extDiffResult = LaunchDiff(file1, file2);
00928             }
00929         }
00930
00931         if (!useExtDiff || !extDiffResult)
00932         {
00933             CvsArgs args;
00934             args.add("diff");
00935
00936             if(noRecurs)
00937                 args.add("-l");
00938             if(!rev1.empty())
00939             {
00940                 args.add(isDate1 ? "-D" : "-r");
00941                 args.add(rev1);
00942             }
00943             if(!rev2.empty())
00944             {
00945                 args.add(isDate2 ? "-D" : "-r");
00946                 args.add(rev2);
00947             }
00948             if(noWhiteSpace)
00949                 args.add("-w"); //--ignore-all-space
00950             if(ignoreCase)
00951                 args.add("-i"); //--ignore-case
00952
00953             const char *dir = mfarg->add(args);
00954             args.print(dir);
00955             launchCVS(dir, args.Argc(), args.Argv());
00956         }
00957     }
00958 }
00959
00960 void
00961 CvsCmdLogFiles(MultiFiles *mfarg, bool outGraph, void *defWnd)
00962 {
00963     if(gCvsPrefs.empty())
00964         return;
00965
00966     MultiFiles mf;
00967     if(mfarg == 0L)
00968     {
00969         if(!BrowserGetMultiFiles("Select files to log :", mf))
00970             return;
00971         mfarg = &mf;
00972     }
00973
00974     bool noRecurs;
00975     bool defBranch;
00976     CPStr date;
00977     bool headerOnly;
00978     bool noTags;
00979     bool onlyRCSfile;
00980     bool hasRev;
00981     CPStr rev;
00982     CPStr states;
00983     bool hasUser;
00984     CPStr users;
00985
00986     if( !CompatGetLog(noRecurs, defBranch, date,
00987         headerOnly, noTags, onlyRCSfile, hasRev,
00988         rev, states, hasUser, users,
00989         outGraph) )
00990     {
00991         return;
00992     }
00993
00994     while(mfarg->next())
00995     {
00996         CvsArgs args;
00997         args.add("log");
00998
00999         if(noRecurs)
01000             args.add("-l");
01001         if(defBranch)
01002             args.add("-b");
01003         if(headerOnly)
01004             args.add("-h");
01005         if(noTags)
01006             args.add("-N");
01007         if(onlyRCSfile)
01008             args.add("-R");
01009
01010         if(!date.empty())
01011         {
01012             args.add("-d");
01013             args.add(date);
01014         }
01015         if(!states.empty())
01016         {
01017             args.add("-s");
01018             args.add(states);
01019         }
01020         if(hasRev)
01021         {
01022             CPStr tmp;
01023             tmp = "-r";
01024             tmp << rev;
01025             args.add(tmp);
01026         }
01027         if(hasUser)
01028         {
01029             CPStr tmp;
01030             tmp = "-w";
01031             tmp << users;
01032             args.add(tmp);
01033         }
01034
01035         const char *dir = mfarg->add(args);
01036         args.print(dir);
01037         CvsLogParse(dir, args, outGraph, defWnd);
01038     }
01039 }
01040
01041 class AddCvsArgs : public CvsArgs
01042 {
01043 public:
01044     AddCvsArgs() : gotProblem(false) {}
01045
01046     virtual void addfile(const char *arg, const char *dir = 0L,
01047         const FSSpec *spec = 0L);
01048
01049     inline bool HasProblem(void) {return gotProblem;}
01050 protected:
01051     bool gotProblem;
01052 };
01053
01054 void AddCvsArgs::addfile(const char *arg, const char *dir, const FSSpec *spec)
01055 {
01056     CvsArgs::addfile(arg, dir, spec);
01057
01058     if(!gCvsPrefs.AddControl())
01059         return;
01060
01061 #ifdef macintosh
01062     // here a bug of MSL : it refuses to open a file beginning by
01063     // ".". So we skip this file out of the test and warn the user.
01064     if(arg[0] == '.')
01065     {
01066         cvs_out("Warning : \'%s\' cannot be verified due to a bug in MW MSL, please\n", arg);
01067         cvs_out("          verify manually \'%s\' *is* a TEXT file\n", arg);
01068         return;
01069     }
01070 #endif
01071
01072     kTextBinTYPE state = FileIsText(arg, dir, spec);
01073     switch(state)
01074     {
01075         case kFileIsOK:
01076             break;
01077         case kFileMissing:
01078             // we can resurect a file which is missing by re-adding it
01079             break;
01080         case kFileIsAlias:
01081             cvs_err("Warning : \'%s\' is an alias\n", arg);
01082             gotProblem = true;
01083             break;
01084         case kFileInvalidName:
01085             cvs_err("Warning : \'%s\' has an invalid name\n", arg);
01086             gotProblem = true;
01087             break;
01088         case kTextWrongLF:
01089             cvs_err("Warning : \'%s\' seems to have the wrong line feed for this machine, you should correct it first\n", arg);
01090             gotProblem = true;
01091             break;
01092         case kTextIsBinary:
01093             cvs_err("Warning : \'%s\' seems to be \'binary\', you should use the \'Add binary files...\' command instead...\n", arg);
01094             gotProblem = true;
01095             break;
01096         case kTextEscapeChar:
01097 #ifdef macintosh
01098             if(gCvsPrefs.IsoConvert() == ISO8559_none)
01099             {
01100                 cvs_err("Warning : \'%s\' has some escape characters in it (0x00-0x20, 0x80-0xFF),\n", arg);
01101                 cvs_err("Warning   so you may need to have the ISO8559 translation option set in the preferences\n");
01102                 cvs_err("Warning   before commiting\n");
01103             }
01104 #else /* !macintosh */
01105             cvs_err("Warning : \'%s\' has some escape characters in it (0x00-0x20, 0x80-0xFF), you should correct it first\n", arg);
01106 #endif /* !macintosh */
01107             break;
01108         case kTextWrongSig:
01109             cvs_err("Warning : \'%s\' has a file type different from \'TEXT\', you should correct it first\n", arg);
01110             gotProblem = true;
01111             break;
01112         default:
01113             cvs_err("Warning : \'%s\' has some unknown problems\n", arg);
01114             gotProblem = true;
01115             break;
01116     }
01117 }
01118
01119 void
01120 CvsCmdAddFiles(MultiFiles *mfarg)
01121 {
01122     if(gCvsPrefs.empty())
01123         return;
01124
01125     MultiFiles mf;
01126     if(mfarg == 0L)
01127     {
01128         if(!BrowserGetMultiFiles("Select files to add :", mf))
01129             return;
01130         mfarg = &mf;
01131     }
01132
01133     while(mfarg->next())
01134     {
01135         AddCvsArgs args;
01136         args.add("add");
01137         const char *dir = mfarg->add(args);
01138
01139         if(!args.HasProblem() || !CvsAlert("Some problems have been found while adding files and should be corrected",
01140                 "Cancel", "Ignore"))
01141         {
01142             args.print(dir);
01143             launchCVS(dir, args.Argc(), args.Argv());
01144         }
01145     }
01146 }
01147
01148 class AddBinCvsArgs : public CvsArgs
01149 {
01150 public:
01151     AddBinCvsArgs() : gotProblem(false) {}
01152
01153     virtual void addfile(const char *arg, const char *dir = 0L,
01154         const FSSpec *spec = 0L);
01155
01156     inline bool HasProblem(void) {return gotProblem;}
01157 protected:
01158     bool gotProblem;
01159 };
01160
01161 void AddBinCvsArgs::addfile(const char *arg, const char *dir, const FSSpec *spec)
01162 {
01163     CvsArgs::addfile(arg, dir, spec);
01164
01165     if(!gCvsPrefs.AddControl())
01166         return;
01167
01168 #ifdef macintosh
01169     // here a bug of MSL : it refuses to open a file beginning by
01170     // ".". So we skip this file out of the test and warn the user.
01171     if(arg[0] == '.')
01172     {
01173         cvs_out("Warning : \'%s\' cannot be verified due to a bug in MW MSL, please\n", arg);
01174         cvs_out("          verify manually \'%s\' *is not* a TEXT file\n", arg);
01175         return;
01176     }
01177 #endif
01178
01179     kTextBinTYPE state = FileIsBinary(arg, dir, spec);
01180
01181     switch(state)
01182     {
01183         case kFileIsOK:
01184             break;
01185         case kFileMissing:
01186             // we can resurect a file which is missing by re-adding it
01187             break;
01188         case kFileIsAlias:
01189             cvs_err("Warning : \'%s\' is an alias\n", arg);
01190             gotProblem = true;
01191             break;
01192         case kFileInvalidName:
01193             cvs_err("Warning : \'%s\' has an invalid name\n", arg);
01194             gotProblem = true;
01195             break;
01196         case kBinIsText:
01197             cvs_err("Warning : \'%s\' seems to be a text file, you should correct it first\n", arg);
01198             gotProblem = true;
01199             break;
01200         case kBinWrongSig:
01201             cvs_err("Warning : \'%s\' has a file type of \'TEXT\', you should correct it first\n", arg);
01202             gotProblem = true;
01203             break;
01204         default:
01205             cvs_err("Warning : \'%s\' has some unknown problems\n", arg);
01206             gotProblem = true;
01207             break;
01208     }
01209 }
01210
01211 void
01212 CvsCmdAddBinaryFiles(MultiFiles *mfarg)
01213 {
01214     if(gCvsPrefs.empty())
01215         return;
01216
01217     MultiFiles mf;
01218     if(mfarg == 0L)
01219     {
01220         if(!BrowserGetMultiFiles("Select binary files to add :", mf))
01221             return;
01222         mfarg = &mf;
01223     }
01224
01225     while(mfarg->next())
01226     {
01227         AddBinCvsArgs args;
01228         args.add("add");
01229         args.add("-kb");
01230         const char *dir = mfarg->add(args);
01231
01232         if(!args.HasProblem() || !CvsAlert("Some problems have been found while adding binary files and should be corrected",
01233                 "Cancel", "Ignore"))
01234         {
01235             args.print(dir);
01236             launchCVS(dir, args.Argc(), args.Argv());
01237         }
01238     }
01239 }
01240
01241 class RemoveCvsArgs : public CvsArgs
01242 {
01243 public:
01244     virtual void addfile(const char *arg, const char *dir = 0L,
01245         const FSSpec *spec = 0L);
01246 };
01247
01248 void RemoveCvsArgs::addfile(const char *arg, const char *dir, const FSSpec *spec)
01249 {
01250     CvsArgs::addfile(arg, dir, spec);
01251
01252     CStr fullpath(dir);
01253     if(!fullpath.endsWith(kPathDelimiter))
01254         fullpath << kPathDelimiter;
01255     fullpath << arg;
01256
01257     // check the file is not already deleted
01258     struct stat sb;
01259     if (stat(dir, &sb) != -1 && S_ISDIR(sb.st_mode) &&
01260         stat(fullpath, &sb) == -1 && errno == ENOENT)
01261     {
01262         return;
01263     }
01264
01265     if(!CompatMoveToTrash(arg, dir, spec))
01266 #ifdef WIN32
01267         cvs_err("Unable to send \'%s\' to the recycle bin\n", arg);
01268     else
01269         cvs_out("\'%s\' has been moved successfully to the recycle bin...\n", arg);
01270 #elif !defined(macintosh)
01271         cvs_err("Unable to send \'%s\' to the trash\n", arg);
01272     else
01273         cvs_out("\'%s\' has been moved successfully to trash...\n", arg);
01274 #else
01275     {}
01276 #endif
01277 }
01278
01279 void
01280 CvsCmdRemoveFiles(MultiFiles *mfarg)
01281 {
01282     if(gCvsPrefs.empty())
01283         return;
01284
01285     MultiFiles mf;
01286     if(mfarg == 0L)
01287     {
01288         if(!BrowserGetMultiFiles("Select files to remove :", mf))
01289             return;
01290         mfarg = &mf;
01291     }
01292
01293     while(mfarg->next())
01294     {
01295         RemoveCvsArgs args;
01296
01297         CompatBeginMoveToTrash();
01298
01299         args.add("remove");
01300         const char *dir = mfarg->add(args);
01301         args.print(dir);
01302
01303         CompatEndMoveToTrash();
01304
01305         launchCVS(dir, args.Argc(), args.Argv());
01306     }
01307 }
01308
01309 void
01310 CvsCmdStatusFiles(MultiFiles *mfarg)
01311 {
01312     if(gCvsPrefs.empty())
01313         return;
01314
01315     MultiFiles mf;
01316     if(mfarg == 0L)
01317     {
01318         if(!BrowserGetMultiFiles("Select files to status :", mf))
01319             return;
01320         mfarg = &mf;
01321     }
01322
01323     while(mfarg->next())
01324     {
01325         CvsArgs args;
01326         args.add("status");
01327         args.add("-v");
01328         const char *dir = mfarg->add(args);
01329         args.print(dir);
01330         launchCVS(dir, args.Argc(), args.Argv());
01331     }
01332 }
01333
01334 void
01335 CvsCmdCancelChangesFiles(MultiFiles *mfarg)
01336 {
01337     if(gCvsPrefs.empty())
01338         return;
01339
01340     MultiFiles mf;
01341     if(mfarg == 0L)
01342     {
01343         if(!BrowserGetMultiFiles("Select files to cancel changes :", mf))
01344             return;
01345         mfarg = &mf;
01346     }
01347
01348     while(mfarg->next())
01349     {
01350         RemoveCvsArgs args;
01351         args.add("update");
01352         const char *dir = mfarg->add(args);
01353         args.print(dir);
01354         launchCVS(dir, args.Argc(), args.Argv());
01355     }
01356 }
01357
01358 void CvsCmdLine(void)
01359 {
01360     CvsArgs args(false);
01361     const char *dir;
01362     if(!CompatGetCommand(args, dir))
01363         return;
01364     args.print(dir);
01365     launchCVS(dir, args.Argc(), args.Argv());
01366 }
01367
01368 void
01369 CvsCmdLogFolder(const char *dir)
01370 {
01371     if(gCvsPrefs.empty())
01372         return;
01373
01374     if(dir == 0L)
01375         dir = BrowserGetDirectory("Select a directory to log :");
01376     if(dir == 0L)
01377         return;
01378
01379     bool noRecurs;
01380     bool defBranch;
01381     CPStr date;
01382     bool headerOnly;
01383     bool noTags;
01384     bool onlyRCSfile;
01385     bool hasRev;
01386     CPStr rev;
01387     CPStr states;
01388     bool hasUser;
01389     CPStr users;
01390
01391     if(!CompatGetLog(noRecurs, defBranch, date,
01392         headerOnly, noTags, onlyRCSfile, hasRev,
01393         rev, states, hasUser, users))
01394             return;
01395
01396     CvsArgs args;
01397     args.add("log");
01398
01399     if(noRecurs)
01400         args.add("-l");
01401     if(defBranch)
01402         args.add("-b");
01403     if(headerOnly)
01404         args.add("-h");
01405     if(noTags)
01406         args.add("-N");
01407     if(onlyRCSfile)
01408         args.add("-R");
01409
01410     if(!date.empty())
01411     {
01412         args.add("-d");
01413         args.add(date);
01414     }
01415     if(!states.empty())
01416     {
01417         args.add("-s");
01418         args.add(states);
01419     }
01420     if(hasRev)
01421     {
01422         CPStr tmp;
01423         tmp = "-r";
01424         tmp << rev;
01425         args.add(tmp);
01426     }
01427     if(hasUser)
01428     {
01429         CPStr tmp;
01430         tmp = "-w";
01431         tmp << users;
01432         args.add(tmp);
01433     }
01434
01435     args.print(dir);
01436     CvsLogParse(dir, args, false, NULL);
01437 }
01438
01439 void
01440 CvsCmdStatusFolder(const char *dir)
01441 {
01442     if(gCvsPrefs.empty())
01443         return;
01444
01445     if(dir == 0L)
01446         dir = BrowserGetDirectory("Select a directory to get status :");
01447     if(dir == 0L)
01448         return;
01449
01450     CvsArgs args;
01451     args.add("status");
01452     args.add("-v");
01453
01454     args.print(dir);
01455     launchCVS(dir, args.Argc(), args.Argv());
01456 }
01457
01458 void
01459 CvsCmdLockFiles(MultiFiles *mfarg)
01460 {
01461     if(gCvsPrefs.empty())
01462         return;
01463
01464     MultiFiles mf;
01465     if(mfarg == 0L)
01466     {
01467         if(!BrowserGetMultiFiles("Select files to lock :", mf))
01468             return;
01469         mfarg = &mf;
01470     }
01471
01472     while(mfarg->next())
01473     {
01474         CvsArgs args;
01475         args.add("admin");
01476         args.add("-l");
01477
01478         const char *dir = mfarg->add(args);
01479         args.print(dir);
01480         launchCVS(dir, args.Argc(), args.Argv());
01481     }
01482 }
01483
01484 void
01485 CvsCmdUnlockFiles(MultiFiles *mfarg)
01486 {
01487     if(gCvsPrefs.empty())
01488         return;
01489
01490     MultiFiles mf;
01491     if(mfarg == 0L)
01492     {
01493         if(!BrowserGetMultiFiles("Select files to unlock :", mf))
01494             return;
01495         mfarg = &mf;
01496     }
01497
01498     while(mfarg->next())
01499     {
01500         CvsArgs args;
01501         args.add("admin");
01502         args.add("-u");
01503
01504         const char *dir = mfarg->add(args);
01505         args.print(dir);
01506         launchCVS(dir, args.Argc(), args.Argv());
01507     }
01508 }
01509
01510 void
01511 CvsCmdTagCreateFiles(MultiFiles *mfarg)
01512 {
01513     if(gCvsPrefs.empty())
01514         return;
01515
01516     MultiFiles mf;
01517     if(mfarg == 0L)
01518     {
01519         if(!BrowserGetMultiFiles("Select files to tag :", mf))
01520             return;
01521         mfarg = &mf;
01522     }
01523
01524     bool noRecurs, overwriteExisting, checkUnmod;
01525     CPStr tagName;
01526     if(!CompatTagCreate(noRecurs, overwriteExisting, tagName, checkUnmod))
01527         return;
01528
01529     while(mfarg->next())
01530     {
01531         CvsArgs args;
01532         args.add("tag");
01533         if(noRecurs)
01534             args.add("-l");
01535         if(overwriteExisting)
01536             args.add("-F");
01537         if(checkUnmod)
01538             args.add("-c");
01539         args.add(tagName);
01540
01541         const char *dir = mfarg->add(args);
01542         args.print(dir);
01543         launchCVS(dir, args.Argc(), args.Argv());
01544     }
01545 }
01546
01547 void
01548 CvsCmdTagDeleteFiles(MultiFiles *mfarg)
01549 {
01550     if(gCvsPrefs.empty())
01551         return;
01552
01553     MultiFiles mf;
01554     if(mfarg == 0L)
01555     {
01556         if(!BrowserGetMultiFiles("Select files to untag :", mf))
01557             return;
01558         mfarg = &mf;
01559     }
01560
01561     bool noRecurs;
01562     CPStr tagName;
01563     if(!CompatTagDelete(noRecurs, tagName))
01564         return;
01565
01566     while(mfarg->next())
01567     {
01568         CvsArgs args;
01569         args.add("tag");
01570         args.add("-d");
01571         if(noRecurs)
01572             args.add("-l");
01573         args.add(tagName);
01574
01575         const char *dir = mfarg->add(args);
01576         args.print(dir);
01577         launchCVS(dir, args.Argc(), args.Argv());
01578     }
01579 }
01580
01581 void
01582 CvsCmdTagBranchFiles(MultiFiles *mfarg)
01583 {
01584     if(gCvsPrefs.empty())
01585         return;
01586
01587     MultiFiles mf;
01588     if(mfarg == 0L)
01589     {
01590         if(!BrowserGetMultiFiles("Select files to branch :", mf))
01591             return;
01592         mfarg = &mf;
01593     }
01594
01595     bool noRecurs, checkUnmod;
01596     CPStr branchName;
01597     if(!CompatTagBranch(noRecurs, branchName, checkUnmod))
01598         return;
01599
01600     while(mfarg->next())
01601     {
01602         CvsArgs args;
01603         args.add("tag");
01604         args.add("-b");
01605         if(noRecurs)
01606             args.add("-l");
01607         if(checkUnmod)
01608             args.add("-c");
01609         args.add(branchName);
01610
01611         const char *dir = mfarg->add(args);
01612         args.print(dir);
01613         launchCVS(dir, args.Argc(), args.Argv());
01614     }
01615 }
01616
01617 void
01618 CvsCmdLockFolder(const char *dir)
01619 {
01620     if(gCvsPrefs.empty())
01621         return;
01622
01623     if(dir == 0L)
01624         dir = BrowserGetDirectory("Select a directory to lock :");
01625     if(dir == 0L)
01626         return;
01627
01628     CvsArgs args;
01629     args.add("admin");
01630     args.add("-l");
01631
01632     args.print(dir);
01633     launchCVS(dir, args.Argc(), args.Argv());
01634 }
01635
01636 void
01637 CvsCmdUnlockFolder(const char *dir)
01638 {
01639     if(gCvsPrefs.empty())
01640         return;
01641
01642     if(dir == 0L)
01643         dir = BrowserGetDirectory("Select a directory to unlock :");
01644     if(dir == 0L)
01645         return;
01646
01647     CvsArgs args;
01648     args.add("admin");
01649     args.add("-u");
01650
01651     args.print(dir);
01652     launchCVS(dir, args.Argc(), args.Argv());
01653 }
01654
01655 void
01656 CvsCmdTagCreateFolder(const char *dir)
01657 {
01658     if(gCvsPrefs.empty())
01659         return;
01660
01661     if(dir == 0L)
01662         dir = BrowserGetDirectory("Select a directory to tag :");
01663     if(dir == 0L)
01664         return;
01665
01666     bool noRecurs, overwriteExisting, checkUnmod;
01667     CPStr tagName;
01668     if(!CompatTagCreate(noRecurs, overwriteExisting, tagName, checkUnmod))
01669         return;
01670
01671     CvsArgs args;
01672     args.add("tag");
01673     if(noRecurs)
01674         args.add("-l");
01675     if(overwriteExisting)
01676         args.add("-F");
01677     if(checkUnmod)
01678         args.add("-c");
01679     args.add(tagName);
01680
01681     args.print(dir);
01682     launchCVS(dir, args.Argc(), args.Argv());
01683 }
01684
01685 void
01686 CvsCmdTagDeleteFolder(const char *dir)
01687 {
01688     if(gCvsPrefs.empty())
01689         return;
01690
01691     if(dir == 0L)
01692         dir = BrowserGetDirectory("Select a directory to untag :");
01693     if(dir == 0L)
01694         return;
01695
01696     bool noRecurs;
01697     CPStr tagName;
01698     if(!CompatTagDelete(noRecurs, tagName))
01699         return;
01700
01701     CvsArgs args;
01702     args.add("tag");
01703     args.add("-d");
01704     if(noRecurs)
01705         args.add("-l");
01706     args.add(tagName);
01707
01708     args.print(dir);
01709     launchCVS(dir, args.Argc(), args.Argv());
01710 }
01711
01712 void
01713 CvsCmdTagBranchFolder(const char *dir)
01714 {
01715     if(gCvsPrefs.empty())
01716         return;
01717
01718     if(dir == 0L)
01719         dir = BrowserGetDirectory("Select a directory to branch :");
01720     if(dir == 0L)
01721         return;
01722
01723     bool noRecurs, checkUnmod;
01724     CPStr tagName;
01725     if(!CompatTagBranch(noRecurs, tagName, checkUnmod))
01726         return;
01727
01728     CvsArgs args;
01729     args.add("tag");
01730     args.add("-b");
01731     if(noRecurs)
01732         args.add("-l");
01733     if(checkUnmod)
01734         args.add("-c");
01735     args.add(tagName);
01736
01737     args.print(dir);
01738     launchCVS(dir, args.Argc(), args.Argv());
01739 }
01740
01741 void CvsCmdEditFiles(MultiFiles *mfarg)
01742 {
01743     if(gCvsPrefs.empty())
01744         return;
01745
01746     MultiFiles mf;
01747     if(mfarg == 0L)
01748     {
01749         if(!BrowserGetMultiFiles("Select the files to edit :", mf))
01750             return;
01751         mfarg = &mf;
01752     }
01753
01754     while(mfarg->next())
01755     {
01756         CvsArgs args;
01757         args.add("edit");
01758
01759         const char *dir = mfarg->add(args);
01760         args.print(dir);
01761         launchCVS(dir, args.Argc(), args.Argv());
01762     }
01763 }
01764
01765 void CvsCmdUneditFiles(MultiFiles *mfarg)
01766 {
01767     if(gCvsPrefs.empty())
01768         return;
01769
01770     MultiFiles mf;
01771     if(mfarg == 0L)
01772     {
01773         if(!BrowserGetMultiFiles("Select the files to unedit :", mf))
01774             return;
01775         mfarg = &mf;
01776     }
01777
01778     while(mfarg->next())
01779     {
01780         CvsArgs args;
01781         args.add("unedit");
01782
01783         const char *dir = mfarg->add(args);
01784         args.print(dir);
01785         launchCVS(dir, args.Argc(), args.Argv());
01786     }
01787 }
01788
01789 void CvsCmdWatchOnFiles(MultiFiles *mfarg)
01790 {
01791     if(gCvsPrefs.empty())
01792         return;
01793
01794     MultiFiles mf;
01795     if(mfarg == 0L)
01796     {
01797         if(!BrowserGetMultiFiles("Select the files to watch :", mf))
01798             return;
01799         mfarg = &mf;
01800     }
01801
01802     while(mfarg->next())
01803     {
01804         CvsArgs args;
01805         args.add("watch");
01806         args.add("add");
01807
01808         const char *dir = mfarg->add(args);
01809         args.print(dir);
01810         launchCVS(dir, args.Argc(), args.Argv());
01811     }
01812 }
01813
01814 void CvsCmdWatchOffFiles(MultiFiles *mfarg)
01815 {
01816     if(gCvsPrefs.empty())
01817         return;
01818
01819     MultiFiles mf;
01820     if(mfarg == 0L)
01821     {
01822         if(!BrowserGetMultiFiles("Select the files to unwatch :", mf))
01823             return;
01824         mfarg = &mf;
01825     }
01826
01827     while(mfarg->next())
01828     {
01829         CvsArgs args;
01830         args.add("watch");
01831         args.add("remove");
01832
01833         const char *dir = mfarg->add(args);
01834         args.print(dir);
01835         launchCVS(dir, args.Argc(), args.Argv());
01836     }
01837 }
01838
01839 void CvsCmdWatchersFiles(MultiFiles *mfarg)
01840 {
01841     if(gCvsPrefs.empty())
01842         return;
01843
01844     MultiFiles mf;
01845     if(mfarg == 0L)
01846     {
01847         if(!BrowserGetMultiFiles("Select the files to get the watchers from :", mf))
01848             return;
01849         mfarg = &mf;
01850     }
01851
01852     while(mfarg->next())
01853     {
01854         CvsArgs args;
01855         args.add("watchers");
01856
01857         const char *dir = mfarg->add(args);
01858         args.print(dir);
01859         launchCVS(dir, args.Argc(), args.Argv());
01860     }
01861 }
01862
01863 void CvsCmdEditorsFiles(MultiFiles *mfarg)
01864 {
01865     if(gCvsPrefs.empty())
01866         return;
01867
01868     MultiFiles mf;
01869     if(mfarg == 0L)
01870     {
01871         if(!BrowserGetMultiFiles("Select the files to get the editors from :", mf))
01872             return;
01873         mfarg = &mf;
01874     }
01875
01876     while(mfarg->next())
01877     {
01878         CvsArgs args;
01879         args.add("editors");
01880
01881         const char *dir = mfarg->add(args);
01882         args.print(dir);
01883         launchCVS(dir, args.Argc(), args.Argv());
01884     }
01885 }
01886
01887 void CvsCmdEditFolder(const char *dir)
01888 {
01889     if(gCvsPrefs.empty())
01890         return;
01891
01892     if(dir == 0L)
01893         dir = BrowserGetDirectory("Select a directory to edit :");
01894     if(dir == 0L)
01895         return;
01896
01897     CvsArgs args;
01898     args.add("edit");
01899
01900     args.print(dir);
01901     launchCVS(dir, args.Argc(), args.Argv());
01902 }
01903
01904 void CvsCmdUneditFolder(const char *dir)
01905 {
01906     if(gCvsPrefs.empty())
01907         return;
01908
01909     if(dir == 0L)
01910         dir = BrowserGetDirectory("Select a directory to unedit :");
01911     if(dir == 0L)
01912         return;
01913
01914     CvsArgs args;
01915     args.add("unedit");
01916
01917     args.print(dir);
01918     launchCVS(dir, args.Argc(), args.Argv());
01919 }
01920
01921 void CvsCmdWatchOnFolder(const char *dir)
01922 {
01923     if(gCvsPrefs.empty())
01924         return;
01925
01926     if(dir == 0L)
01927         dir = BrowserGetDirectory("Select a directory to watch :");
01928     if(dir == 0L)
01929         return;
01930
01931     CvsArgs args;
01932     args.add("watch");
01933     args.add("add");
01934
01935     args.print(dir);
01936     launchCVS(dir, args.Argc(), args.Argv());
01937 }
01938
01939 void CvsCmdWatchOffFolder(const char *dir)
01940 {
01941     if(gCvsPrefs.empty())
01942         return;
01943
01944     if(dir == 0L)
01945         dir = BrowserGetDirectory("Select a directory to unwatch :");
01946     if(dir == 0L)
01947         return;
01948
01949     CvsArgs args;
01950     args.add("watch");
01951     args.add("remove");
01952
01953     args.print(dir);
01954     launchCVS(dir, args.Argc(), args.Argv());
01955 }
01956
01957 void CvsCmdReleaseFolder(const char *dir)
01958 {
01959     if(gCvsPrefs.empty())
01960         return;
01961
01962     if(dir == 0L)
01963         dir = BrowserGetDirectory("Select a directory to release :");
01964     if(dir == 0L)
01965         return;
01966
01967     CStr uppath, folder;
01968     if( !SplitPath(dir, uppath, folder) )
01969     {
01970         cvs_err("Unable to convert path name '%s'\n", dir);
01971         //even thought something didn't work we will try to continue and put all the responsibility onto the user
01972         uppath = dir;
01973         folder = ".";
01974     }
01975
01976     bool removeDirectory = false;
01977
01978     if( !CompatGetRelease(dir, removeDirectory) )
01979     {
01980         return;
01981     }
01982
01983     CvsArgs args;
01984     args.add("release");
01985     if( removeDirectory )
01986         args.add("-d");
01987     args.add(folder);
01988
01989     args.print(uppath);
01990     launchCVS(uppath, args.Argc(), args.Argv());
01991 }
01992
01993 void CvsCmdWatchersFolder(const char *dir)
01994 {
01995     if(gCvsPrefs.empty())
01996         return;
01997
01998     if(dir == 0L)
01999         dir = BrowserGetDirectory("Select a directory to get the watchers from :");
02000     if(dir == 0L)
02001         return;
02002
02003     CvsArgs args;
02004     args.add("watchers");
02005
02006     args.print(dir);
02007     launchCVS(dir, args.Argc(), args.Argv());
02008 }
02009
02010 void CvsCmdEditorsFolder(const char *dir)
02011 {
02012     if(gCvsPrefs.empty())
02013         return;
02014
02015     if(dir == 0L)
02016         dir = BrowserGetDirectory("Select a directory to get the editors from :");
02017     if(dir == 0L)
02018         return;
02019
02020     CvsArgs args;
02021     args.add("editors");
02022
02023     args.print(dir);
02024     launchCVS(dir, args.Argc(), args.Argv());
02025 }
02026
02027 void CvsCmdMacrosAdmin(const char *macroName)
02028 {
02029     if(gCvsPrefs.empty() || !CTcl_Interp::IsAvail())
02030         return;
02031
02032     CTcl_Interp interp;
02033     CStr path = macroName;
02034     CTcl_Interp::Unixfy(path);
02035     interp.DoScriptVar("source \"%s\"", (const char *)path);
02036 }
02037
02038 void
02039 CvsCmdAnnotateFiles(MultiFiles *mfarg)
02040 {
02041     if(gCvsPrefs.empty())
02042         return;
02043
02044     MultiFiles mf;
02045     if(mfarg == 0L)
02046     {
02047         if(!BrowserGetMultiFiles("Select files to annotate :", mf))
02048             return;
02049         mfarg = &mf;
02050     }
02051
02052     bool noRecurs;
02053     bool isDate;
02054     CPStr rev;
02055     bool force;
02056
02057     if(!CompatGetAnnotate(noRecurs, isDate, rev, force))
02058         return;
02059
02060     while(mfarg->next())
02061     {
02062         CStr path, filename, ext, base;
02063         CStr file;
02064         for(int i = 0; ; i++)
02065         {
02066             if(!mfarg->get(i, path, filename))
02067                 break;
02068             // note that filename can contain subfolders
02069
02070             GetExtension(filename, base, ext);
02071
02072             CvsArgs args;
02073             CStr tmpf(base);
02074             if(!rev.empty())
02075             {
02076                 tmpf << "_ann_";
02077                 tmpf << rev;
02078                 tmpf << '_';
02079             }
02080             else
02081                 tmpf << "_ann_";
02082
02083             // convert subfolder names to regular name
02084             FlatenSubFolders(tmpf);
02085
02086             args.add("annotate");
02087             if(noRecurs)
02088             {
02089                 args.add("-l");
02090             }
02091             if(force)
02092             {
02093                 args.add("-f");
02094             }
02095             if(!rev.empty())
02096             {
02097                 args.add(isDate ? "-D" : "-r");
02098                 args.add(rev);
02099             }
02100             args.add(filename);
02101             args.print(path);
02102             file = launchCVS(path, args, (const char *)tmpf, ext);
02103 #ifdef qMacCvsPP
02104             decodeCVS (file);
02105 #endif
02106
02107             if(file.empty())
02108                 continue;
02109
02110             LaunchViewer(file, true);
02111         }
02112     }
02113 }
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsCommands.h Source File

common/CvsCommands.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * CvsCommands.h --- set of CVS commands
00023  */
00024
00025 #ifndef CVSCOMMANDS_H
00026 #define CVSCOMMANDS_H
00027
00028 class MultiFiles;
00029 char *cleanUpLogMsg(const char *msg);
00030
00031 void CvsCmdUpdateFolder(const char *dir = 0L, bool queryOnly = false);
00032 void CvsCmdCommitFolder(const char *dir = 0L);
00033 void CvsCmdDiffFolder(const char *dir = 0L);
00034 void CvsCmdAddFolder(const char *dir = 0L);
00035 void CvsCmdLogFolder(const char *dir = 0L);
00036 void CvsCmdStatusFolder(const char *dir = 0L);
00037 void CvsCmdLockFolder(const char *dir = 0L);
00038 void CvsCmdUnlockFolder(const char *dir = 0L);
00039 void CvsCmdTagCreateFolder(const char *dir = 0L);
00040 void CvsCmdTagDeleteFolder(const char *dir = 0L);
00041 void CvsCmdTagBranchFolder(const char *dir = 0L);
00042
00043 void CvsCmdInit(const char *dir = 0L);
00044 void CvsCmdImportModule(const char *dir = 0L);
00045 void CvsCmdCheckoutModule(const char *dir = 0L);
00046 void CvsCmdRtagCreate(void);
00047 void CvsCmdRtagDelete(void);
00048 void CvsCmdRtagBranch(void);
00049
00050 void CvsCmdLogin(void);
00051 void CvsCmdLogout(void);
00052
00053 void CvsCmdUpdateFiles(MultiFiles *mf = 0L, bool queryOnly = false);
00054 void CvsCmdCommitFiles(MultiFiles *mf = 0L);
00055 void CvsCmdDiffFiles(MultiFiles *mf = 0L);
00056 void CvsCmdAnnotateFiles(MultiFiles *mf = 0L);
00057 void CvsCmdLogFiles(MultiFiles *mf = 0L, bool outGraph = false, void *defWnd = 0L);
00058 void CvsCmdAddFiles(MultiFiles *mf = 0L);
00059 void CvsCmdAddBinaryFiles(MultiFiles *mf = 0L);
00060 void CvsCmdRemoveFiles(MultiFiles *mf = 0L);
00061 void CvsCmdStatusFiles(MultiFiles *mf = 0L);
00062 void CvsCmdCancelChangesFiles(MultiFiles *mf = 0L);
00063 void CvsCmdLockFiles(MultiFiles *mf = 0L);
00064 void CvsCmdUnlockFiles(MultiFiles *mf = 0L);
00065 void CvsCmdTagCreateFiles(MultiFiles *mf = 0L);
00066 void CvsCmdTagDeleteFiles(MultiFiles *mf = 0L);
00067 void CvsCmdTagBranchFiles(MultiFiles *mf = 0L);
00068
00069 void CvsCmdLine(void);
00070
00071 void CvsCmdEditFiles(MultiFiles *mf = 0L);
00072 void CvsCmdUneditFiles(MultiFiles *mf = 0L);
00073 void CvsCmdWatchOnFiles(MultiFiles *mf = 0L);
00074 void CvsCmdWatchOffFiles(MultiFiles *mf = 0L);
00075 void CvsCmdWatchersFiles(MultiFiles *mf = 0L);
00076 void CvsCmdEditorsFiles(MultiFiles *mf = 0L);
00077
00078 void CvsCmdEditFolder(const char *dir = 0L);
00079 void CvsCmdUneditFolder(const char *dir = 0L);
00080 void CvsCmdWatchOnFolder(const char *dir = 0L);
00081 void CvsCmdWatchOffFolder(const char *dir = 0L);
00082 void CvsCmdReleaseFolder(const char *dir = 0L);
00083 void CvsCmdWatchersFolder(const char *dir = 0L);
00084 void CvsCmdEditorsFolder(const char *dir = 0L);
00085
00086 void CvsCmdMacrosAdmin(const char *macroName);
00087     // TO_OBSOLETE
00088
00089 #endif /* CVSCOMMANDS_H */
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsEntries.cpp Source File

common/CvsEntries.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 /*
00022  * CvsEntries.cpp --- adaptation from cvs/src/entries.c
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef macintosh
00028 #   include "GUSIInternal.h"
00029 #   include "GUSIFileSpec.h"
00030 #   define S_IWRITE S_IWUSR
00031 #endif
00032
00033 #include <stdlib.h>
00034 #include <string.h>
00035 #include <sys/types.h>
00036 #include <sys/stat.h>
00037
00038 #include "CvsEntries.h"
00039 #include "AppConsole.h"
00040 #include "getline.h"
00041 #include "FileTraversal.h"
00042
00043 #ifdef WIN32
00044 #   ifdef _DEBUG
00045 #       define new DEBUG_NEW
00046 #       undef THIS_FILE
00047         static char THIS_FILE[] = __FILE__;
00048 #   endif
00049 #   include "WinCvsDebug.h"
00050 #endif /* WIN32 */
00051
00052 #if TIME_WITH_SYS_TIME
00053 #   include <sys/time.h>
00054 #   include <time.h>
00055 #elif HAVE_SYS_TIME_H
00056 #   include <sys/time.h>
00057 #else
00058 #   include <time.h>
00059 #endif
00060
00061 #ifndef NEW
00062 #define NEW new
00063 #endif
00064
00065 static const char* cloneStr(const char* cp)
00066 {
00067     if(cp && *cp)
00068     {
00069         cp = strdup(cp);
00070         if (!cp)
00071         {
00072             throw std::bad_alloc();
00073         }
00074     }
00075     else
00076     {
00077         cp = 0L;
00078     }
00079     return cp;
00080 }
00081
00082 static void disposeStr(const char* cp)
00083 {
00084     if (cp)
00085     {
00086         free((void*)cp);
00087     }
00088 }
00089
00090 EntnodePath::EntnodePath(const char* path) : fullpathname(0L), ref(1)
00091 {
00092     fullpathname = cloneStr(path);
00093 }
00094
00095 EntnodePath::~EntnodePath()
00096 {
00097     disposeStr(fullpathname);
00098 }
00099
00100 const char* EntnodePath::GetFullPathName(UStr & resPath, const char* name) const
00101 {
00102     resPath = fullpathname;
00103     if(!resPath.endsWith(kPathDelimiter))
00104         resPath << kPathDelimiter;
00105     resPath << name;
00106
00107     return resPath;
00108 }
00109
00110 EntnodeData::EntnodeData(const char* name, EntnodePath *path)
00111     : ref(1), missing(false), visited(false), unknown(false),
00112       unmodified(true), ignored(false), locked(false), removed(false),
00113       user(0L), desc(0L), fullpathname(0L)
00114 {
00115 #ifdef macintosh
00116     macspec.vRefNum = 0;
00117     macspec.parID = 0;
00118     macspec.name[0] = '\0';
00119 #endif /* macintosh */
00120     user = cloneStr(name);
00121     fullpathname = path->Ref();
00122 }
00123
00124 EntnodeData::~EntnodeData()
00125 {
00126     disposeStr(user);
00127     if(fullpathname)
00128         fullpathname->UnRef();
00129 }
00130
00131 void EntnodeData::SetDesc(const char *newdesc)
00132 {
00133     desc = newdesc;
00134 }
00135
00136 UStr EntnodeData::sbuffer;
00137
00138 EntnodeFile::~EntnodeFile()
00139 {
00140     disposeStr(vn);
00141     disposeStr(ts);
00142     disposeStr(option);
00143     disposeStr(tag);
00144     disposeStr(date);
00145     disposeStr(ts_conflict);
00146 }
00147
00148 EntnodeFile::EntnodeFile(const char* name, EntnodePath *path, const char *newvn,
00149     const char *newts, const char *newoptions, const char *newtag,
00150     const char *newdate, const char *newts_conflict) : EntnodeData(name, path)
00151 {
00152     vn = 0L;
00153     ts = 0L;
00154     option = 0L;
00155     tag = 0L;
00156     date = 0L;
00157     ts_conflict = 0L;
00158
00159     vn = cloneStr(newvn);
00160     ts = cloneStr(newts);
00161     option = cloneStr(newoptions);
00162     tag = cloneStr(newtag);
00163     date = cloneStr(newdate);
00164     ts_conflict = cloneStr(newts_conflict);
00165
00166     if(newvn != 0L && newvn[0] == '-')
00167         SetRemoved(true);
00168 }
00169
00170 EntnodeFolder::~EntnodeFolder()
00171 {
00172 }
00173
00174 EntnodeFolder::EntnodeFolder(const char* name, EntnodePath *path, const char *newvn,
00175     const char *newts, const char *newoptions, const char *newtag,
00176     const char *newdate, const char *newts_conflict) : EntnodeData(name, path)
00177 {
00178 }
00179
00180 /* Return the next real Entries line.  On end of file, returns NULL.
00181    On error, prints an error message and returns NULL.  */
00182
00183 static EntnodeData * fgetentent(FILE *fpin, const char* path, char *cmd = 0L)
00184 {
00185     EntnodeData *ent;
00186     char *line = 0L;
00187     size_t line_chars_allocated = 0;
00188     register char *cp;
00189     ent_type type;
00190     char *l, *user, *vn, *ts, *options;
00191     char *tag_or_date, *tag, *date, *ts_conflict;
00192     int line_length;
00193
00194     EntnodePath *thePath = new EntnodePath(path);
00195
00196     ent = 0L;
00197     while ((line_length = getline (&line, &line_chars_allocated, fpin)) > 0)
00198     {
00199         l = line;
00200
00201         /* If CMD is not NULL, we are reading an Entries.Log file.
00202         Each line in the Entries.Log file starts with a single
00203         character command followed by a space.  For backward
00204         compatibility, the absence of a space indicates an add
00205         command.  */
00206         if (cmd != 0L)
00207         {
00208             if (l[1] != ' ')
00209                 *cmd = 'A';
00210             else
00211             {
00212                 *cmd = l[0];
00213                 l += 2;
00214             }
00215         }
00216         type = ENT_FILE;
00217
00218         if (l[0] == 'D')
00219         {
00220             type = ENT_SUBDIR;
00221             ++l;
00222             /* An empty D line is permitted; it is a signal that this
00223             Entries file lists all known subdirectories.  */
00224         }
00225
00226         if (l[0] != '/')
00227             continue;
00228
00229         user = l + 1;
00230         if ((cp = strchr (user, '/')) == 0L)
00231             continue;
00232         *cp++ = '\0';
00233         vn = cp;
00234         if ((cp = strchr (vn, '/')) == 0L)
00235             continue;
00236         *cp++ = '\0';
00237         ts = cp;
00238         if ((cp = strchr (ts, '/')) == 0L)
00239             continue;
00240         *cp++ = '\0';
00241         options = cp;
00242         if ((cp = strchr (options, '/')) == 0L)
00243             continue;
00244         *cp++ = '\0';
00245         tag_or_date = cp;
00246         if ((cp = strchr (tag_or_date, '\n')) == 0L
00247 #ifdef macintosh
00248             && (cp = strchr (tag_or_date, '\r')) == 0L
00249 #endif
00250         )
00251             continue;
00252         *cp = '\0';
00253         tag = (char *) 0L;
00254         date = (char *) 0L;
00255         if (*tag_or_date == 'T')
00256             tag = tag_or_date + 1;
00257         else if (*tag_or_date == 'D')
00258             date = tag_or_date + 1;
00259
00260         if ((ts_conflict = strchr (ts, '+')))
00261             *ts_conflict++ = '\0';
00262
00263         if(type == ENT_SUBDIR)
00264             ent = NEW EntnodeFolder(user, thePath);
00265         else
00266             ent = NEW EntnodeFile(user, thePath, vn, ts, options,
00267                 tag, date, ts_conflict);
00268         break;
00269     }
00270
00271     if (line_length < 0 && !feof (fpin))
00272         cvs_err("Cannot read entries file (error %d)\n", errno);
00273
00274     free (line);
00275
00276     thePath->UnRef();
00277
00278     return ent;
00279 }
00280
00281 /* Read the entries file into a list, hashing on the file name.
00282
00283    UPDATE_DIR is the name of the current directory, for use in error
00284    messages, or NULL if not known (that is, noone has gotten around
00285    to updating the caller to pass in the information).  */
00286 bool Entries_Open (CSortList<ENTNODE> & entries, const char *fullpath)
00287 {
00288     EntnodeData *ent;
00289
00290     UStr adminPath(fullpath);
00291     if(!adminPath.endsWith(kPathDelimiter))
00292         adminPath << kPathDelimiter;
00293     adminPath << "CVS";
00294     adminPath << kPathDelimiter;
00295
00296     entries.Reset();
00297     UStr filename = adminPath;
00298     filename << "Entries";
00299     FILE *fpin = fopen(filename, "r");
00300     if (fpin == 0L)
00301         return false;
00302
00303     while ((ent = fgetentent (fpin, fullpath)) != 0L)
00304     {
00305         ENTNODE newnode(ent);
00306         ent->UnRef();
00307
00308         if(entries.InsideAndInsert(newnode))
00309         {
00310             cvs_err("Warning : duplicated entry in the 'CVS/Entries' file in directory '%s'\n",
00311                 fullpath);
00312         }
00313     }
00314
00315     fclose (fpin);
00316
00317     filename = adminPath;
00318     filename << "Entries.log";
00319     fpin = fopen(filename, "r");
00320     if (fpin != 0L)
00321     {
00322         char cmd;
00323
00324         while ((ent = fgetentent (fpin, &cmd)) != 0L)
00325         {
00326             ENTNODE newnode(ent);
00327             ent->UnRef();
00328
00329             switch (cmd)
00330             {
00331             case 'A':
00332                 if(entries.InsideAndInsert(newnode))
00333                 {
00334                     // dont care
00335                 }
00336                 break;
00337             case 'R':
00338                 entries.Delete(newnode);
00339                 break;
00340             default:
00341                 /* Ignore unrecognized commands.  */
00342                 break;
00343             }
00344         }
00345         fclose (fpin);
00346     }
00347     return true;
00348 }
00349
00350 // mostly the cvs one...
00351 static bool unmodified(const struct stat & sb, const char *ts)
00352 {
00353     char *cp;
00354     struct tm *tm_p;
00355     struct tm local_tm;
00356     /* We want to use the same timestamp format as is stored in the
00357     st_mtime.  For unix (and NT I think) this *must* be universal
00358     time (UT), so that files don't appear to be modified merely
00359     because the timezone has changed.  For VMS, or hopefully other
00360     systems where gmtime returns NULL, the modification time is
00361     stored in local time, and therefore it is not possible to cause
00362     st_mtime to be out of sync by changing the timezone.  */
00363     tm_p = gmtime (&sb.st_mtime);
00364     if (tm_p)
00365     {
00366         memcpy (&local_tm, tm_p, sizeof (local_tm));
00367         cp = asctime (&local_tm);   /* copy in the modify time */
00368     }
00369     else
00370         cp = ctime(&sb.st_mtime);
00371
00372     cp[24] = 0;
00373
00374 // [6/8/2001] Jerzy K. - the code has been replaced by the version from cvsnt
00375 //which seems simpler and giving the same effect
00376 //keep it here for a while and remove eventually
00377 #if 0
00378 // Bug 432
00379     if( cp[8]=='0') cp[8]=' ';
00380 //  The C Standard Library and the Unix/cygwin versions of CVS
00381 //  write a padding space before days 1-9; Visual C++ libraries use
00382 //  a leading 0.  This affects ctime() and asctime() calls.  Bug 432
00383 //  adopts the padding space standard.  The following allows for backward
00384 //  compatibility with a WinCVS working area checked out prior to the
00385 //  Bug 432 fix.  (cp is the timestamp from the stat of the working file;
00386 //  ts is the timestamp as read from CVS/Entries).
00387     char *ns = (char *)malloc( (strlen(ts) + 1) * sizeof( char ) );
00388     if ( ns == NULL ) {
00389         cvs_err("Could not allocate memory for string ns\n");
00390         return 1;
00391     }
00392     strcpy( ns, ts );
00393     if( ns[8]=='0') ns[8]=' ';
00394     int compare_result = strcmp(ns, cp);
00395     free( ns );
00396     return compare_result == 0;
00397 // Bug 432
00398 #else
00399
00400     /* Deal with the differences in timestamps - posix uses space filled, NT uses zero filled */
00401     if(cp[8]=='0' && ts[8]==' ')
00402         cp[8]=' ';
00403     if(cp[8]==' ' && ts[8]=='0')
00404         cp[8]='0';
00405
00406     return strcmp(cp, ts) == 0;
00407 #endif
00408 }
00409
00410 EntnodeData *Entries_SetVisited(const char *path, CSortList<ENTNODE> & entries, const char *name,
00411     const struct stat & finfo, bool isFolder, const std::vector<CStr> * ignlist)
00412 {
00413     int index;
00414     bool isCvs = false;
00415
00416     EntnodePath *thePath = new EntnodePath(path);
00417
00418     if(isFolder)
00419     {
00420         EntnodeFolder *adata = NEW EntnodeFolder(name, thePath);
00421         ENTNODE anode(adata);
00422         adata->UnRef();
00423         isCvs = entries.InsideAndInsert(anode, &index);
00424     }
00425     else
00426     {
00427         EntnodeFile *adata = NEW EntnodeFile(name, thePath);
00428         ENTNODE anode(adata);
00429         adata->UnRef();
00430         isCvs = entries.InsideAndInsert(anode, &index);
00431     }
00432
00433     thePath->UnRef();
00434
00435     const ENTNODE & theNode = entries.Get(index);
00436     EntnodeData *data = theNode.Data();
00437     data->SetVisited(true);
00438     if(!isCvs)
00439     {
00440         data->SetUnknown(true);
00441         if(ignlist != 0L && MatchIgnoredList(name, *ignlist))
00442             data->SetIgnored(true);
00443
00444         // the folder may have some cvs informations in it, despite the fact
00445         // that it is not referenced by the parent directory, so try
00446         // to figure it.
00447
00448         if(!data->IsIgnored())
00449         {
00450             CStr cvsFile(path);
00451             if(!cvsFile.endsWith(kPathDelimiter))
00452                 cvsFile << kPathDelimiter;
00453             cvsFile << name;
00454             if(!cvsFile.endsWith(kPathDelimiter))
00455                 cvsFile << kPathDelimiter;
00456             cvsFile << "CVS";
00457             struct stat sb;
00458             if (stat(cvsFile, &sb) != -1 && S_ISDIR(sb.st_mode))
00459             {
00460                 data->SetUnknown(false);
00461             }
00462         }
00463     }
00464
00465     if(isFolder)
00466     {
00467         if(data->IsIgnored())
00468         {
00469             data->SetDesc("Ignored Folder");
00470         }
00471         else if(data->IsUnknown())
00472         {
00473             data->SetDesc("NonCvs Folder");
00474         }
00475         else
00476         {
00477             data->SetDesc("Folder");
00478         }
00479     }
00480     else
00481     {
00482         const char *ts = (*data)[EntnodeFile::kTS];
00483         if(ts == 0L)
00484             data->SetUnmodified(true);
00485         else
00486             data->SetUnmodified(unmodified(finfo, ts));
00487
00488 #if defined(WIN32)
00489         if (GetWinCvsDebugMaskBit(wcvsdbg_trace_modified_checks_bit))
00490         {
00491             char scratch[128];
00492
00493             /* copied from unmodified... */
00494             char *cp;
00495             struct tm *tm_p;
00496             struct tm local_tm;
00497             tm_p = gmtime (& finfo.st_mtime);
00498             if (tm_p)
00499             {
00500                 memcpy (&local_tm, tm_p, sizeof (local_tm));
00501                 cp = asctime (&local_tm);   /* copy in the modify time */
00502             }
00503             else
00504             {
00505                 cp = "NULL";
00506             }
00507
00508             _snprintf(scratch, 128,
00509                 "Checking timestamps for %s: Entries: %s, file: %s --> %s\n",
00510                 name, ts, cp,
00511                 data->IsUnmodified() ? "unmodified" : "modified");
00512             cvs_err(scratch);
00513             OutputDebugString(scratch);
00514         }
00515 #endif
00516
00517         data->SetLocked((finfo.st_mode & S_IWRITE) == 0);
00518
00519         const char *info = 0L;
00520         if(data->IsIgnored())
00521         {
00522             data->SetDesc("Ignored");
00523         }
00524         else if(data->IsUnknown())
00525         {
00526             data->SetDesc("NonCvs file");
00527         }
00528         else if(data->GetConflict() != 0L)
00529         {
00530             data->SetDesc("Conflict");
00531         }
00532         else if((info = (*data)[EntnodeFile::kOption]) != 0L && strcmp(info, "-kb") == 0)
00533         {
00534             data->SetDesc(data->IsUnmodified() ? "Binary" : "Mod. Binary");
00535         }
00536         else
00537         {
00538             data->SetDesc(data->IsUnmodified() ? "File" : "Mod. File");
00539         }
00540     }
00541
00542     return data;
00543 }
00544
00545 void Entries_SetMissing(CSortList<ENTNODE> & entries)
00546 {
00547     int numEntries = entries.NumOfElements();
00548     for(int i = 0; i < numEntries; i++)
00549     {
00550         const ENTNODE & theNode = entries.Get(i);
00551         EntnodeData *data = theNode.Data();
00552         if(data->IsVisited())
00553             continue;
00554
00555         data->SetMissing(true);
00556         data->SetDesc(data->IsRemoved() ? "Removed" : "Missing");
00557     }
00558 }
00559
00560 bool Tag_Open(CStr & tag, const char *fullpath)
00561 {
00562     tag = "";
00563     CStr tagFile(fullpath);
00564     if(!tagFile.endsWith(kPathDelimiter))
00565         tagFile << kPathDelimiter;
00566     tagFile << "Tag";
00567
00568     FILE *fpin = fopen(tagFile, "r");
00569     if (fpin == 0L)
00570         return false;
00571
00572     char *line = 0L;
00573     size_t line_chars_allocated = 0;
00574     int line_length;
00575     if((line_length = getline (&line, &line_chars_allocated, fpin)) > 0)
00576     {
00577         char *tmp = strchr(line, '\n');
00578         if(tmp != 0L)
00579             *tmp = '\0';
00580         if(line[0] == 'T')
00581             tag = line + 1;
00582     }
00583     if(line != 0L)
00584         free(line);
00585     if (line_length < 0 && !feof (fpin))
00586     {
00587         cvs_err("Cannot open Tag file in '%s' (error %d)\n", fullpath, errno);
00588         return false;
00589     }
00590
00591     fclose (fpin);
00592     return !tag.empty();
00593 }
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsEntries.h Source File

common/CvsEntries.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  * Modified: Jerzy Kaczorowski <kaczoroj@hotmail.com> - 27 Jan 2001 - fix warning C4800 (Add "0 != " for all the int variables forced to bool value)
00020  */
00021
00022 /*
00023  * CvsEntries.h --- adaptation from cvs/src/entries.c
00024  */
00025
00026 #ifndef CVSENTRIES_H
00027 #define CVSENTRIES_H
00028
00029 #include "SortList.h"
00030 #include "CvsIgnore.h"
00031
00032 typedef enum
00033 {
00034     ENT_FILE,
00035     ENT_SUBDIR
00036 } ent_type;
00037
00038 // ref counted full path description, see below
00039 class EntnodePath
00040 {
00041 protected:
00042     // reference counted, we don't use delete on it.
00043     ~EntnodePath();
00044 public:
00045     EntnodePath(const char* path);
00046
00047     // ref counting
00048     inline EntnodePath *Ref(void) {++ref; return this;}
00049     inline EntnodePath *UnRef(void)
00050     {
00051         if(--ref == 0)
00052         {
00053             delete this;
00054             return 0L;
00055         }
00056         return this;
00057     }
00058
00059     const char* GetFullPathName(UStr & resPath, const char* name) const;
00060
00061 protected:
00062     const char* fullpathname; // fully qualified pathname of the folder containing the item
00063     int ref;
00064 };
00065
00066 class EntnodeData
00067 {
00068 // Construction
00069 protected:
00070     // used by derived classes only
00071     EntnodeData(const char* name, EntnodePath *path);
00072
00073     // cannot use 'delete', use UnRef() instead.
00074     virtual ~EntnodeData();
00075
00076 public:
00077
00078     enum
00079     {
00080         kName = 0,
00081         kStatus = 3,
00082         kPath = 7
00083     };
00084
00085     virtual ent_type GetType(void) const = 0;
00086     inline static int Compare(const EntnodeData & node1, const EntnodeData & node2)
00087     {
00088 #ifdef WIN32
00089         return stricmp(node1.user, node2.user);
00090 #else /* !WIN32 */
00091         return strcmp(node1.user, node2.user);
00092 #endif /* !WIN32 */
00093     }
00094     inline EntnodeData *Ref(void) {++ref; return this;}
00095     inline EntnodeData *UnRef(void)
00096     {
00097         if(--ref == 0)
00098         {
00099             delete this;
00100             return 0L;
00101         }
00102         return this;
00103     }
00104
00105     virtual const char *operator[](int index) const
00106     {
00107         if(index == kName)
00108             return user;
00109         else if(index == kStatus)
00110             return desc;
00111         else if(index == kPath)
00112             return GetFullPathName(sbuffer);
00113         return 0L;
00114     }
00115
00116     inline void SetMissing(bool state) {missing = state;}
00117     inline bool IsMissing(void) const {return 0 != missing;}
00118     inline void SetVisited(bool state) {visited = state;}
00119     inline bool IsVisited(void) const {return 0 != visited;}
00120     inline void SetUnknown(bool state) {unknown = state;}
00121     inline bool IsUnknown(void) const {return 0 != unknown;}
00122     inline void SetIgnored(bool state) {ignored = state;}
00123     inline bool IsIgnored(void) const {return 0 != ignored;}
00124     inline void SetLocked(bool state) {locked = state;}
00125     inline bool IsLocked(void) const {return 0 != locked;}
00126     inline void SetRemoved(bool state) {removed = state;}
00127     inline bool IsRemoved(void) const {return 0 != removed;}
00128     void SetDesc(const char *newdesc);
00129     inline const char *GetDesc(void) const {return desc;}
00130
00131     // accessor for item name
00132     const char* GetName(void) const
00133     {
00134         return user;
00135     }
00136
00137     // accessor for fully qualified item name
00138     const char* GetFullPathName(UStr & resPath) const
00139     {
00140         return fullpathname->GetFullPathName(resPath, user);
00141     }
00142
00143     // returns non-null if this is a files that is marked as having merge conflict
00144     virtual const char* GetConflict() const
00145     {
00146         return 0L;
00147     }
00148
00149     inline void SetUnmodified(bool state) {unmodified = state;}
00150     inline bool IsUnmodified(void) const {return 0 != unmodified;}
00151
00152 #ifdef macintosh
00153     FSSpec & MacSpec(void) {return macspec;}
00154     const FSSpec & GetMacSpec(void) const {return macspec;}
00155 #endif /* macintosh */
00156 protected:
00157     int ref;
00158     int missing : 1;
00159     int visited : 1;
00160     int unknown : 1;
00161     int unmodified : 1;
00162     int ignored : 1;
00163     int locked : 1;
00164     int removed : 1;
00165 #ifdef macintosh
00166     FSSpec macspec;
00167 #endif /* macintosh */
00168 private:
00169     const char* user; // name of this item
00170     const char* desc; // its description
00171     EntnodePath *fullpathname; // fully qualified pathname of the folder containing the item
00172
00173     static UStr sbuffer;
00174 };
00175
00176 class EntnodeFile : public EntnodeData
00177 {
00178 public:
00179     EntnodeFile(const char* name, EntnodePath *path, const char *newvn = 0L,
00180         const char *newts = 0L, const char *newoptions = 0L,
00181         const char *newtag = 0L, const char *newdate = 0L,
00182         const char *newts_conflict = 0L);
00183 protected:
00184     // cannot use 'delete', use UnRef() instead.
00185     virtual ~EntnodeFile();
00186
00187 // Attribute access
00188 public:
00189
00190     enum
00191     {
00192         kVN = 1,
00193         kTS = 5,
00194         kOption = 2,
00195         kTag = 4,
00196         kConflict = 6
00197     };
00198
00199     // access fields
00200     virtual const char *operator[](int index) const
00201     {
00202         if(index == kVN)
00203             return vn;
00204         else if(index == kTS)
00205             return ts;
00206         else if(index == kOption)
00207             return option;
00208         else if(index == kTag)
00209             return tag != 0L ? tag : date;
00210         else if(index == kConflict)
00211             return ts_conflict;
00212
00213         return EntnodeData::operator[](index);
00214     }
00215
00216     virtual ent_type GetType(void) const
00217     {
00218         return ENT_FILE;
00219     }
00220
00221     // returns non-null if this is a files that is marked as having merge conflict
00222     virtual const char* GetConflict() const
00223     {
00224         return ts_conflict;
00225     }
00226
00227 protected:
00228     const char *vn;
00229     const char *ts;
00230     const char *option;
00231     const char *tag; // can be nil
00232     const char *date; // can be nil
00233     const char *ts_conflict; // can be nil
00234 };
00235
00236 class EntnodeFolder : public EntnodeData
00237 {
00238 // Construction
00239 public:
00240     EntnodeFolder(const char* name, EntnodePath * path, const char *newvn = 0L,
00241         const char *newts = 0L, const char *newoptions = 0L, const char *newtag = 0L,
00242         const char *newdate = 0L, const char *newts_conflict = 0L);
00243
00244 protected:
00245     // cannot use 'delete', use UnRef() instead.
00246     virtual ~EntnodeFolder();
00247
00248 // Attribute access
00249 public:
00250     // access fields
00251     virtual const char *operator[](int index) const
00252     {
00253         return EntnodeData::operator[](index);
00254     }
00255
00256     virtual ent_type GetType(void) const
00257     {
00258         return ENT_SUBDIR;
00259     }
00260
00261 protected:
00262 };
00263
00264 // ENTNODE gets a node file or a node folder
00265 // and reference it.
00266 class ENTNODE
00267 {
00268 public:
00269     ENTNODE() : shareData(0L) {}
00270     ENTNODE(EntnodeData *data) : shareData(data->Ref()) {}
00271     ENTNODE(EntnodeData & data) : shareData(data.Ref()) {}
00272     ENTNODE(const ENTNODE & anode) : shareData(0L)
00273     {
00274         *this = anode;
00275     }
00276     ~ENTNODE()
00277     {
00278         if(shareData != 0L)
00279             shareData->UnRef();
00280     }
00281
00282     inline static int Compare(const ENTNODE & node1, const ENTNODE & node2)
00283     {
00284         return EntnodeData::Compare(*node1.shareData, *node2.shareData);
00285     }
00286
00287     inline ENTNODE & operator=(const ENTNODE & anode)
00288     {
00289         EntnodeData* oldData = shareData;
00290         shareData = anode.shareData;
00291         if(shareData != 0L)
00292         {
00293             shareData->Ref();
00294         }
00295         if(oldData != 0L)
00296         {
00297             oldData->UnRef();
00298         }
00299         return *this;
00300     }
00301
00302     inline EntnodeData* Data() const { return shareData; }
00303     inline operator EntnodeData *() const { return shareData; }
00304
00305 protected:
00306     EntnodeData *shareData;
00307 };
00308
00309 bool Entries_Open (CSortList<ENTNODE> & entries, const char *fullpath);
00310     // return false if no CVS/Entries
00311
00312 EntnodeData *Entries_SetVisited(const char *path, CSortList<ENTNODE> & entries, const char *name,
00313     const struct stat & finfo, bool isFolder, const std::vector<CStr> * ignlist = 0L);
00314     // fill an ENTNODE when the file appears on the disk : it set
00315     // some flags like "visited", "unknown", "ignored"... and return
00316     // a reference to the node.
00317
00318 void Entries_SetMissing(CSortList<ENTNODE> & entries);
00319     // After the traversal and for the entries which didn't have a
00320     // "Entries_SetVisited" call associated with, mark them to be "missing".
00321
00322 bool Tag_Open(CStr & tag, const char *fullpath);
00323     // return false if no CVS/Tag
00324
00325 #endif /* CVSENTRIES_H */
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/cvsgui.c Source File

common/cvsgui.c

Go to the documentation of this file.
00001 /*
00002 ** The cvsgui protocol used by WinCvs
00003 **
00004 ** This library is free software; you can redistribute it and/or
00005 ** modify it under the terms of the GNU Lesser General Public
00006 ** License as published by the Free Software Foundation; either
00007 ** version 2.1 of the License, or (at your option) any later version.
00008 **
00009 ** This library is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 ** Lesser General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU Lesser General Public
00015 ** License along with this library; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018
00019 /*
00020  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- November 1999
00021  */
00022
00023 /*
00024  * cvsgui.c --- glue code for communicating with cvs over pipes
00025  */
00026
00027 #ifdef HAVE_CONFIG_H
00028 #include "config.h"
00029 #endif
00030
00031 #include <string.h>
00032 #include <stdio.h>
00033
00034 #include "cvsgui_process.h"
00035 #include "cvsgui_protocol.h"
00036
00037 #undef main
00038 #undef getpass
00039 #undef getenv
00040 #undef exit
00041
00042 #ifdef WIN32
00043     extern char *getpass(const char *prompt);
00044 #endif
00045
00046 pipe_t _cvsgui_readfd = 0;
00047 pipe_t _cvsgui_writefd = 0;
00048
00049 static long outseek;
00050 static long errseek;
00051 static char *outname;
00052 static char *errname;
00053 static FILE *outlog;
00054 static FILE *errlog;
00055
00056 char * cvsguiglue_getenv(const char *env)
00057 {
00058     char *res = 0L;
00059
00060     if(_cvsgui_readfd == 0)
00061         return getenv(env);
00062
00063     cvsguiglue_flushconsole(1);
00064
00065     if(env && gp_getenv_write (_cvsgui_writefd, env))
00066     {
00067         res = gp_getenv_read(_cvsgui_readfd);;
00068     }
00069
00070     return res;
00071 }
00072
00073 char * cvsguiglue_getpass(const char *prompt)
00074 {
00075     if(_cvsgui_readfd == 0)
00076         return getpass(prompt);
00077
00078     return cvsguiglue_getenv("CVS_GETPASS");
00079 }
00080
00081 void cvsguiglue_exit(int code)
00082 {
00083     if(_cvsgui_writefd != 0)
00084         gp_quit_write (_cvsgui_writefd, code);
00085     exit(code);
00086 }
00087
00088 static void reopen_consoles(void)
00089 {
00090 #ifndef WIN32
00091     outname = tempnam(0L, 0L);
00092     if(outname == 0L)
00093     {
00094         fprintf(stderr, "Unable to open tmp file !\n");
00095         exit(1);
00096     }
00097     errname = tempnam(0L, 0L);
00098     if(errname == 0L)
00099     {
00100         fprintf(stderr, "Unable to open tmp file !\n");
00101         exit(1);
00102     }
00103     outlog = freopen(outname, "w+", stdout);
00104     if(outlog == 0L)
00105     {
00106         fprintf(stderr, "Unable to reopen stdout !\n");
00107         exit(1);
00108     }
00109     errlog = freopen(errname, "w+", stderr);
00110     if(errlog == 0L)
00111     {
00112         fprintf(stderr, "Unable to reopen stderr !\n");
00113         exit(1);
00114     }
00115     outseek = 0;
00116     errseek = 0;
00117 #endif
00118 }
00119
00120 static void
00121 close_consoles(void)
00122 {
00123 #ifndef WIN32
00124     if(outlog != 0L)
00125         fclose(outlog);
00126     if(errlog != 0L)
00127         fclose(errlog);
00128     if(outname != 0L)
00129     {
00130         unlink(outname);
00131         free(outname);
00132     }
00133     if(errname != 0L)
00134     {
00135         unlink(errname);
00136         free(errname);
00137     }
00138 #endif
00139 }
00140
00141 static void
00142 myflush(FILE *log, long *oldpos)
00143 {
00144     long newpos, pos;
00145 #   define BUF_SIZE 8000
00146     char buf[BUF_SIZE];
00147     size_t len;
00148
00149     pos = fseek(log, *oldpos, SEEK_SET);
00150     if(pos != 0)
00151         goto fail;
00152
00153     while(!feof(log) && !ferror(log))
00154     {
00155         len = fread(buf, sizeof(char), BUF_SIZE, log);
00156         if(len > 0)
00157         {
00158             if(log == outlog)
00159                 gp_console_write (_cvsgui_writefd, buf, len, 0);
00160             if(log == errlog)
00161                 gp_console_write (_cvsgui_writefd, buf, len, 1);
00162         }
00163     }
00164
00165     if(ferror(log))
00166         goto fail;
00167
00168     newpos = ftell(log);
00169     if(newpos < 0)
00170         goto fail;
00171
00172     *oldpos = newpos;
00173     return;
00174 fail:
00175     fprintf(stderr, "Unable to redirect stdout/stderr !\n");
00176 }
00177
00178 void
00179 cvsguiglue_flushconsole(int closeit)
00180 {
00181     fflush(stdout);
00182     fflush(stderr);
00183 #ifndef WIN32
00184     if(outlog != 0L)
00185         myflush(outlog, &outseek);
00186     if(errlog != 0L)
00187         myflush(errlog, &errseek);
00188     if(closeit)
00189         close_consoles();
00190 #endif
00191 }
00192
00193 int main(int argc, char *argv[])
00194 {
00195     int res;
00196     char **tmparg = 0L;
00197
00198     if(argc >= 4 && strcmp(argv[1], "-cvsgui") == 0)
00199     {
00200         int i;
00201
00202         _cvsgui_readfd = (pipe_t)atoi (argv[2]);
00203         _cvsgui_writefd = (pipe_t)atoi (argv[3]);
00204
00205         tmparg = (char **)malloc((argc - 2) * sizeof(char *));
00206         if(tmparg == 0L)
00207             goto ignore;
00208
00209         tmparg[0] = argv[0];
00210         for(i = 4; i < argc; i++)
00211         {
00212             tmparg[i - 3] = argv[i];
00213         }
00214         tmparg[argc - 3] = 0L;
00215         argc -= 3;
00216
00217         cvs_process_init();
00218         reopen_consoles();
00219     }
00220
00221 ignore:
00222     res = cvsguiglue_main(argc, tmparg != 0L ? tmparg :  argv);
00223
00224     if(tmparg != 0L)
00225     {
00226         cvsguiglue_flushconsole(1);
00227         gp_quit_write (_cvsgui_writefd, res);
00228         free(tmparg);
00229     }
00230
00231     return res;
00232 }
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/cvsgui.h Source File

common/cvsgui.h

Go to the documentation of this file.
00001 /*
00002 ** The cvsgui protocol used by WinCvs
00003 **
00004 ** This library is free software; you can redistribute it and/or
00005 ** modify it under the terms of the GNU Lesser General Public
00006 ** License as published by the Free Software Foundation; either
00007 ** version 2.1 of the License, or (at your option) any later version.
00008 **
00009 ** This library is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 ** Lesser General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU Lesser General Public
00015 ** License along with this library; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018
00019 /*
00020  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- November 1999
00021  */
00022
00023 /*
00024  * cvsgui.h --- glue code for communicating with cvs over pipes
00025  */
00026
00027 #ifndef CVSGUI_H
00028 #define CVSGUI_H
00029
00030 #include <stdlib.h>
00031
00032 #ifdef HAVE_UNISTD_H
00033 #   include <unistd.h>
00034 #endif
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00040 /*
00041  * glue code to intercept some low level calls and tunnel them
00042  * inside the communication pipes.
00043  */
00044 #define getenv cvsguiglue_getenv
00045 #define getpass cvsguiglue_getpass
00046
00047 // RCH - extra #define for Solaris
00048 #define getpassphrase cvsguiglue_getpass
00049
00050 #define main cvsguiglue_main
00051 #define exit cvsguiglue_exit
00052
00053 extern char * cvsguiglue_getenv(const char *env);
00054 extern char * cvsguiglue_getpass(const char *prompt);
00055 extern int cvsguiglue_main(int argc, char *argv[]);
00056 extern void cvsguiglue_exit(int code);
00057 extern void cvsguiglue_flushconsole(int closeit);
00058
00059 #ifdef __cplusplus
00060 }
00061 #endif
00062
00063 #endif /* CVSGUI_H */
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/cvsgui_process.cpp Source File

common/cvsgui_process.cpp

Go to the documentation of this file.
00001 /*
00002 ** The cvsgui protocol used by WinCvs
00003 **
00004 ** This library is free software; you can redistribute it and/or
00005 ** modify it under the terms of the GNU Lesser General Public
00006 ** License as published by the Free Software Foundation; either
00007 ** version 2.1 of the License, or (at your option) any later version.
00008 **
00009 ** This library is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 ** Lesser General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU Lesser General Public
00015 ** License along with this library; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018
00019 /*
00020  * plugin.c from the GIMP modified for the cvsgui project by :
00021  * Alexandre Parenteau <aubonbeurre@hotmail.com> --- November 1999
00022  */
00023
00024 #ifdef HAVE_CONFIG_H
00025 #include "config.h"
00026 #endif
00027
00028 #ifdef HAVE_STRINGS_H
00029 #include <strings.h>
00030 #endif
00031
00032 #include <errno.h>
00033 #include <signal.h>
00034 #include <stdlib.h>
00035 #include <stdio.h>
00036 #include <string.h>
00037 #include <sys/types.h>
00038 #include <sys/stat.h>
00039 #include <time.h>
00040
00041 #ifndef WIN32
00042 #   include <sys/wait.h>
00043 #   include <sys/time.h>
00044 #   include <sys/param.h>
00045 #   include <unistd.h>
00046 #endif
00047
00048 #include <stack>
00049 #include <vector>
00050 #include <algorithm>
00051
00052 #include "cvsgui_process.h"
00053 #include "cvsgui_protocol.h"
00054
00055 static int  cvs_process_write                 (pipe_t                fd,
00056                                            guint8            *buf,
00057                                            gulong             count);
00058 static int  cvs_process_flush                 (pipe_t                fd);
00059 static void cvs_process_push                  (CvsProcess            *cvs_process);
00060 static void cvs_process_pop                   (void);
00061 static void cvs_process_recv_message          (CvsProcess *p);
00062 static void cvs_process_handle_message        (WireMessage       *msg);
00063 static void cvs_process_close (CvsProcess *cvs_process, int kill_it);
00064 static void cvs_process_destroy (CvsProcess *cvs_process);
00065 static CvsProcess* cvs_process_new (char *name, int argc, char **argv);
00066
00067 static std::deque<CvsProcess *> cvs_process_stack;
00068 static std::vector<CvsProcess *> open_cvs_process;
00069 static CvsProcess *current_cvs_process = NULL;
00070 static int current_write_buffer_index = 0;
00071 static char *current_write_buffer = NULL;
00072
00073 static char process_write_buffer[WRITE_BUFFER_SIZE];    /* Buffer for writing, only for the process */
00074
00075 #ifdef WIN32
00076 // use the runtime to initialize/delete a critical section
00077 class CDummyInit
00078 {
00079 public:
00080     CDummyInit()
00081     {
00082         ::InitializeCriticalSection(&m_destroylock);
00083         ::InitializeCriticalSection(&m_stacklock);
00084     }
00085
00086     ~CDummyInit()
00087     {
00088         ::DeleteCriticalSection(&m_destroylock);
00089         ::DeleteCriticalSection(&m_stacklock);
00090     }
00091
00092     static CRITICAL_SECTION m_destroylock;
00093     static CRITICAL_SECTION m_stacklock;
00094 } sDummyObject;
00095
00096 CRITICAL_SECTION CDummyInit::m_destroylock;
00097 CRITICAL_SECTION CDummyInit::m_stacklock;
00098 #endif
00099
00100 #ifdef WIN32
00101 static int write(pipe_t fd, const void *buf, int count)
00102 {
00103     DWORD dwrite;
00104     if(!WriteFile(fd,buf,count,&dwrite,NULL))
00105     {
00106         errno = EINVAL;
00107         return -1;
00108     }
00109     return dwrite;
00110 }
00111 #endif
00112
00113 #ifndef WIN32
00114 struct CDestroyThreadLock
00115 {
00116 public:
00117     inline CDestroyThreadLock()
00118     {
00119     }
00120     inline ~CDestroyThreadLock()
00121     {
00122     }
00123 };
00124 struct CStackThreadLock
00125 {
00126 public:
00127     inline CStackThreadLock()
00128     {
00129     }
00130     inline ~CStackThreadLock()
00131     {
00132     }
00133 };
00134 #else
00135 struct CDestroyThreadLock
00136 {
00137 public:
00138     inline CDestroyThreadLock()
00139     {
00140         EnterCriticalSection(&CDummyInit::m_destroylock);
00141     }
00142     inline ~CDestroyThreadLock()
00143     {
00144         LeaveCriticalSection(&CDummyInit::m_destroylock);
00145     }
00146 };
00147 struct CStackThreadLock
00148 {
00149 public:
00150     inline CStackThreadLock()
00151     {
00152         EnterCriticalSection(&CDummyInit::m_stacklock);
00153     }
00154     inline ~CStackThreadLock()
00155     {
00156         LeaveCriticalSection(&CDummyInit::m_stacklock);
00157     }
00158 };
00159 #endif
00160
00161 static void
00162 _gp_quit_read (pipe_t fd, WireMessage *msg)
00163 {
00164     GPT_QUIT *t = (GPT_QUIT *)malloc(sizeof(GPT_QUIT));
00165     if(t == 0L)
00166         return;
00167
00168     if (!wire_read_int32 (fd, (guint32 *)&t->code, 1))
00169         return;
00170
00171     msg->data = t;
00172 }
00173
00174 static void
00175 _gp_quit_write (pipe_t fd, WireMessage *msg)
00176 {
00177     GPT_QUIT *t = (GPT_QUIT *)msg->data;
00178     if (!wire_write_int32 (fd, (guint32 *)&t->code, 1))
00179         return;
00180 }
00181
00182 static void
00183 _gp_quit_destroy (WireMessage *msg)
00184 {
00185     free(msg->data);
00186 }
00187
00188 static void
00189 _gp_getenv_read (pipe_t fd, WireMessage *msg)
00190 {
00191     GPT_GETENV *t = (GPT_GETENV *)malloc(sizeof(GPT_GETENV));
00192     if(t == 0L)
00193         return;
00194
00195     if (!wire_read_int8 (fd, &t->empty, 1))
00196         return;
00197     if (!wire_read_string (fd, &t->str, 1))
00198         return;
00199
00200     msg->data = t;
00201 }
00202
00203 static void
00204 _gp_getenv_write (pipe_t fd, WireMessage *msg)
00205 {
00206     GPT_GETENV *t = (GPT_GETENV *)msg->data;
00207     if (!wire_write_int8 (fd, &t->empty, 1))
00208         return;
00209     if (!wire_write_string (fd, &t->str, 1))
00210         return;
00211 }
00212
00213 static void
00214 _gp_getenv_destroy (WireMessage *msg)
00215 {
00216     GPT_GETENV *t = (GPT_GETENV *)msg->data;
00217     free(t->str);
00218     free(t);
00219 }
00220
00221 static void
00222 _gp_console_read (pipe_t fd, WireMessage *msg)
00223 {
00224     GPT_CONSOLE *t = (GPT_CONSOLE *)malloc(sizeof(GPT_CONSOLE));
00225     if(t == 0L)
00226         return;
00227
00228     if (!wire_read_int8 (fd, &t->isStderr, 1))
00229         return;
00230     if (!wire_read_int32 (fd, &t->len, 1))
00231         return;
00232     if (!wire_read_string (fd, &t->str, 1))
00233         return;
00234
00235     msg->data = t;
00236 }
00237
00238 static void
00239 _gp_console_write (pipe_t fd, WireMessage *msg)
00240 {
00241     GPT_CONSOLE *t = (GPT_CONSOLE *)msg->data;
00242     if (!wire_write_int8 (fd, &t->isStderr, 1))
00243         return;
00244     if (!wire_write_int32 (fd, &t->len, 1))
00245         return;
00246     if (!wire_write_string (fd, &t->str, 1))
00247         return;
00248 }
00249
00250 static void
00251 _gp_console_destroy (WireMessage *msg)
00252 {
00253     GPT_CONSOLE *t = (GPT_CONSOLE *)msg->data;
00254     free(t->str);
00255     free(t);
00256 }
00257
00258 void
00259 gp_init ()
00260 {
00261     wire_register (GP_QUIT,
00262                    _gp_quit_read,
00263                    _gp_quit_write,
00264                    _gp_quit_destroy);
00265     wire_register (GP_GETENV,
00266                    _gp_getenv_read,
00267                    _gp_getenv_write,
00268                    _gp_getenv_destroy);
00269     wire_register (GP_CONSOLE,
00270                    _gp_console_read,
00271                    _gp_console_write,
00272                    _gp_console_destroy);
00273 }
00274
00275 int
00276 gp_quit_write (pipe_t fd, int code)
00277 {
00278     WireMessage msg;
00279     GPT_QUIT *t = (GPT_QUIT *)malloc(sizeof(GPT_QUIT));
00280
00281     msg.type = GP_QUIT;
00282     msg.data = t;
00283
00284     t->code = code;
00285
00286     if (!wire_write_msg (fd, &msg))
00287         return FALSE;
00288     if (!wire_flush (fd))
00289         return FALSE;
00290
00291     return TRUE;
00292 }
00293
00294 int
00295 gp_getenv_write (pipe_t fd, const char *env)
00296 {
00297     WireMessage msg;
00298     GPT_GETENV *t = (GPT_GETENV *)malloc(sizeof(GPT_GETENV));
00299
00300     msg.type = GP_GETENV;
00301     msg.data = t;
00302
00303     t->empty = env == 0L;
00304     t->str = strdup(env == 0L ? "" : env);
00305
00306     if (!wire_write_msg (fd, &msg))
00307         return FALSE;
00308     wire_destroy (&msg);
00309     if (!wire_flush (fd))
00310         return FALSE;
00311     return TRUE;
00312 }
00313
00314 char *
00315 gp_getenv_read (pipe_t fd)
00316 {
00317     WireMessage msg;
00318     char *res;
00319
00320     memset (&msg, 0, sizeof (WireMessage));
00321     if (!wire_read_msg (fd, &msg) || msg.type != GP_GETENV)
00322     {
00323         fprintf(stderr, "cvsgui protocol error !\n");
00324         exit(-1);
00325     }
00326     GPT_GETENV *t = (GPT_GETENV *)msg.data;
00327     res = t->empty ? 0L : strdup(t->str);
00328     wire_destroy (&msg);
00329
00330     return res;
00331 }
00332
00333 #ifdef WIN32
00334 extern "C"
00335 #endif
00336 int  gp_console_write (pipe_t fd, const char *str, int len, int isStderr)
00337 {
00338     WireMessage msg;
00339     GPT_CONSOLE *t = (GPT_CONSOLE *)malloc(sizeof(GPT_CONSOLE));
00340
00341     msg.type = GP_CONSOLE;
00342     msg.data = t;
00343
00344     t->isStderr = isStderr;
00345     t->len = len;
00346     t->str = (char *)malloc((len + 1) * sizeof(char));
00347     memcpy(t->str, str, len * sizeof(char));
00348     t->str[len] = '\0';
00349
00350     if (!wire_write_msg (fd, &msg))
00351         return FALSE;
00352     if (!wire_flush (fd))
00353         return FALSE;
00354     return TRUE;
00355 }
00356
00357 void
00358 cvs_process_init ()
00359 {
00360     /* initialize the gimp protocol library and set the read and
00361      *  write handlers.
00362      */
00363     gp_init ();
00364     wire_set_writer (cvs_process_write);
00365     wire_set_flusher (cvs_process_flush);
00366 }
00367
00368 static CvsProcess*
00369 cvs_process_new (char *path, int argc, char **argv)
00370 {
00371     CvsProcess *cvs_process;
00372
00373     cvs_process_init();
00374
00375     cvs_process = (CvsProcess *)malloc(sizeof(CvsProcess));
00376     if(cvs_process == 0L)
00377         return 0L;
00378
00379     cvs_process->open = FALSE;
00380     cvs_process->destroy = FALSE;
00381 #ifdef WIN32
00382     cvs_process->starting = TRUE;
00383 #endif
00384     cvs_process->pid = 0;
00385     cvs_process->callbacks = 0L;
00386     cvs_process->argc = argc + 4;
00387     cvs_process->args = (char **)malloc((cvs_process->argc + 1) * sizeof(char *));
00388     cvs_process->args[0] = strdup (path);
00389     cvs_process->args[1] = strdup ("-cvsgui");
00390     cvs_process->args[2] = (char *)malloc(16 * sizeof(char));
00391     cvs_process->args[3] = (char *)malloc(16 * sizeof(char));
00392     for(int i = 0; i < argc; i++)
00393     {
00394         cvs_process->args[4 + i] = strdup(argv[i]);
00395     }
00396     cvs_process->args[cvs_process->argc] = 0L;
00397     cvs_process->my_read = 0;
00398     cvs_process->my_write = 0;
00399     cvs_process->his_read = 0;
00400     cvs_process->his_write = 0;
00401     cvs_process->write_buffer_index = 0;
00402     cvs_process->pstdin = 0;
00403     cvs_process->pstdout = 0;
00404     cvs_process->pstderr = 0;
00405 #ifdef WIN32
00406     memset(cvs_process->threads, 0, sizeof(cvs_process->threads));
00407     memset(cvs_process->threadsID, 0, sizeof(cvs_process->threadsID));
00408 #endif
00409
00410     return cvs_process;
00411 }
00412
00413 static void
00414 cvs_process_destroy (CvsProcess *cvs_process)
00415 {
00416     if (cvs_process)
00417     {
00418         cvs_process_close (cvs_process, TRUE);
00419
00420         if(cvs_process->args != 0L)
00421         {
00422             for(int i = 0; i < cvs_process->argc; i++)
00423             {
00424                 if (cvs_process->args[i])
00425                 {
00426                     free (cvs_process->args[i]);
00427                     cvs_process->args[i] = 0L;
00428                 }
00429             }
00430             free(cvs_process->args);
00431             cvs_process->args = 0L;
00432         }
00433
00434         if (cvs_process == current_cvs_process)
00435             cvs_process_pop ();
00436
00437         if (!cvs_process->destroy)
00438         {
00439             cvs_process->destroy = TRUE;
00440 #ifdef WIN32
00441             // wait so the threads do not continue to use the pointer
00442             HANDLE WaitH[4];
00443             int cnt = 0;
00444             DWORD curT = GetCurrentThreadId();
00445             for(int i = 0; i < 4; i++)
00446             {
00447                 if(cvs_process->threads[i] && curT != cvs_process->threadsID[i])
00448                     WaitH[cnt++] = cvs_process->threads[i];
00449             }
00450             WaitForMultipleObjects(cnt, WaitH, TRUE, INFINITE);
00451
00452             //close the handles
00453             for(i = 0; i < 4; i++)
00454             {
00455                 if( cvs_process->threads[i] && CloseHandle(cvs_process->threads[i]) )
00456                 {
00457                     cvs_process->threads[i] = NULL;
00458                 }
00459             }
00460 #endif
00461             free (cvs_process);
00462         }
00463     }
00464 }
00465
00466 #ifdef WIN32
00467 /* Given an array of arguments that one might pass to spawnv,
00468    construct a command line that one might pass to CreateProcess.
00469    Try to quote things appropriately.  */
00470 static char *
00471 build_command (int argc, char * const *argv)
00472 {
00473     int len;
00474
00475     /* Compute the total length the command will have.  */
00476     {
00477         int i;
00478
00479         len = 0;
00480         for (i = 0; i < argc; i++)
00481         {
00482             char *p;
00483
00484             len += 2;  /* for the double quotes */
00485
00486             for (p = argv[i]; *p; p++)
00487             {
00488                 if (*p == '"')
00489                     len += 2;
00490                 else
00491                     len++;
00492             }
00493             len++;  /* for the space or the '\0'  */
00494         }
00495     }
00496
00497     {
00498         /* The + 10 is in case len is 0.  */
00499         char *command = (char *) malloc (len + 10);
00500         int i;
00501         char *p;
00502
00503         if (! command)
00504         {
00505             errno = ENOMEM;
00506             return command;
00507         }
00508
00509         p = command;
00510         *p = '\0';
00511         /* copy each element of argv to command, putting each command
00512         in double quotes, and backslashing any quotes that appear
00513         within an argument.  */
00514         for (i = 0; i < argc; i++)
00515         {
00516             char *a;
00517             *p++ = '"';
00518             for (a = argv[i]; *a; a++)
00519             {
00520                 if (*a == '"')
00521                     *p++ = '\\', *p++ = '"';
00522                 else
00523                     *p++ = *a;
00524             }
00525             *p++ = '"';
00526             *p++ = ' ';
00527         }
00528         if (p > command)
00529             p[-1] = '\0';
00530
00531         return command;
00532     }
00533 }
00534
00535 #define BUFFSIZE 1024
00536
00537 static DWORD
00538 GetChldOutput(
00539     CvsProcess *process
00540     )
00541 {
00542     char  buff[BUFFSIZE];
00543     DWORD dread;
00544
00545     while(ReadFile(process->pstdout,buff,BUFFSIZE-1,&dread,NULL))
00546     {
00547         buff[dread]='\0';
00548         process->callbacks->consoleout(buff, dread);
00549     }
00550     return(1);
00551 }
00552
00553 static DWORD
00554 GetChldError(
00555     CvsProcess *process
00556     )
00557 {
00558     char  buff[BUFFSIZE];
00559     DWORD dread;
00560
00561     while(ReadFile(process->pstderr,buff,BUFFSIZE-1,&dread,NULL))
00562     {
00563         buff[dread]='\0';
00564         process->callbacks->consoleerr(buff, dread);
00565     }
00566     return(1);
00567 }
00568
00569 static DWORD
00570 WaitChld(
00571     CvsProcess *process
00572     )
00573 {
00574     WaitForSingleObject(process->pid, INFINITE);
00575     cvs_process_destroy(process);
00576     return(1);
00577 }
00578
00579 static DWORD
00580 ServeProtocol(
00581     CvsProcess *process
00582     )
00583 {
00584     while(process->starting)
00585     {
00586         Sleep(20);
00587         continue;
00588     }
00589
00590     DWORD avail;
00591     while(cvs_process_is_active(process) && process->open)
00592     {
00593         if(!PeekNamedPipe(process->my_read, 0L, 0 , 0L, &avail, 0L))
00594             break;
00595
00596         if(avail == 0)
00597         {
00598             Sleep(20);
00599             continue;
00600         }
00601
00602         cvs_process_recv_message(process);
00603     }
00604     return(1);
00605 }
00606 #endif
00607
00608 CvsProcess *
00609 cvs_process_open (char *name, int argc, char **argv, CvsProcessCallbacks *callbacks, int hasTty, const char* currentDirectory)
00610 {
00611     CvsProcess *cvs_process = cvs_process_new(name, argc, argv);
00612
00613     if (!cvs_process)
00614         return 0L;
00615
00616     cvs_process->callbacks = callbacks;
00617
00618 #ifndef WIN32
00619     int my_read[2];
00620     int my_write[2];
00621
00622     /* Open two pipes. (Bidirectional communication).
00623          */
00624     if ((pipe (my_read) == -1) || (pipe (my_write) == -1))
00625     {
00626         fprintf(stderr, "unable to open pipe\n");
00627         cvs_process_destroy (cvs_process);
00628         return 0L;
00629     }
00630
00631     cvs_process->my_read = my_read[0];
00632     cvs_process->my_write = my_write[1];
00633     cvs_process->his_read = my_write[0];
00634     cvs_process->his_write = my_read[1];
00635
00636     /* Remember the file descriptors for the pipes.
00637          */
00638     sprintf (cvs_process->args[2], "%d", cvs_process->his_read);
00639     sprintf (cvs_process->args[3], "%d", cvs_process->his_write);
00640
00641         /* Fork another process. We'll remember the process id
00642          *  so that we can later use it to kill the filter if
00643          *  necessary.
00644          */
00645     cvs_process->pid = fork ();
00646
00647     if (cvs_process->pid == 0)
00648     {
00649         close(cvs_process->my_read);
00650         close(cvs_process->my_write);
00651         /* Execute the filter. The "_exit" call should never
00652          *  be reached, unless some strange error condition
00653          *  exists.
00654          */
00655         execvp (cvs_process->args[0], cvs_process->args);
00656         _exit (1);
00657     }
00658     else if (cvs_process->pid == -1)
00659     {
00660         cvs_process_destroy (cvs_process);
00661         return 0L;
00662     }
00663
00664     close(cvs_process->his_read);  cvs_process->his_read  = -1;
00665     close(cvs_process->his_write); cvs_process->his_write = -1;
00666 #else
00667     SECURITY_ATTRIBUTES lsa;
00668     STARTUPINFO         si;
00669     PROCESS_INFORMATION pi;
00670
00671     HANDLE dupIn = 0L, dupOut = 0L;
00672     HANDLE stdChildIn = 0L, stdChildOut = 0L, stdChildErr = 0L;
00673     HANDLE stdoldIn = 0L, stdoldOut = 0L, stdoldErr = 0L;
00674     HANDLE stddupIn = 0L, stddupOut = 0L, stddupErr = 0L;
00675     char *command = 0L;
00676     BOOL resCreate;
00677     int cnt, i;
00678     LPTHREAD_START_ROUTINE threadsFunc[4];
00679
00680     lsa.nLength=sizeof(SECURITY_ATTRIBUTES);
00681     lsa.lpSecurityDescriptor=NULL;
00682     lsa.bInheritHandle=TRUE;
00683
00684     // create the pipes used for the cvsgui protocol
00685     if (!CreatePipe(&cvs_process->his_read,&dupIn,&lsa,0))
00686         goto error;
00687     if (!CreatePipe(&dupOut,&cvs_process->his_write,&lsa,0))
00688         goto error;
00689
00690     // duplicate the App side handles so they lose the inheritance
00691     if(!DuplicateHandle(GetCurrentProcess(), dupIn,
00692         GetCurrentProcess(), &cvs_process->my_write, 0, FALSE, DUPLICATE_SAME_ACCESS))
00693             goto error;
00694     CloseHandle(dupIn);
00695     dupIn = 0;
00696     if(!DuplicateHandle(GetCurrentProcess(), dupOut,
00697         GetCurrentProcess(), &cvs_process->my_read, 0, FALSE, DUPLICATE_SAME_ACCESS))
00698             goto error;
00699     CloseHandle(dupOut);
00700     dupOut = 0;
00701
00702     if(!hasTty)
00703     {
00704         // redirect stdout, stderr, stdin
00705         if (!CreatePipe(&stdChildIn,&stddupIn,&lsa,0))
00706             goto error;
00707         if (!CreatePipe(&stddupOut,&stdChildOut,&lsa,0))
00708             goto error;
00709         if (!CreatePipe(&stddupErr,&stdChildErr, &lsa,0))
00710             goto error;
00711
00712         // same thing as above
00713         if(!DuplicateHandle(GetCurrentProcess(), stddupIn,
00714             GetCurrentProcess(), &cvs_process->pstdin, 0, FALSE, DUPLICATE_SAME_ACCESS))
00715                 goto error;
00716         CloseHandle(stddupIn);
00717         stddupIn = 0;
00718         if(!DuplicateHandle(GetCurrentProcess(), stddupOut,
00719             GetCurrentProcess(), &cvs_process->pstdout, 0, FALSE, DUPLICATE_SAME_ACCESS))
00720                 goto error;
00721         CloseHandle(stddupOut);
00722         stddupOut = 0;
00723         if(!DuplicateHandle(GetCurrentProcess(), stddupErr,
00724             GetCurrentProcess(), &cvs_process->pstderr, 0, FALSE, DUPLICATE_SAME_ACCESS))
00725                 goto error;
00726         CloseHandle(stddupErr);
00727         stddupErr = 0;
00728     }
00729
00730     // Build the arguments for cvs
00731     sprintf (cvs_process->args[2], "%d", cvs_process->his_read);
00732     sprintf (cvs_process->args[3], "%d", cvs_process->his_write);
00733
00734     command = build_command(cvs_process->argc, cvs_process->args);
00735     if(command == 0L)
00736         goto error;
00737
00738     // Lets Redirect Console StdHandles and set the start options
00739     memset(&si,0,sizeof(STARTUPINFO));
00740     si.cb=sizeof(STARTUPINFO);
00741     si.dwFlags=hasTty ? 0 : STARTF_USESTDHANDLES;
00742     si.hStdInput =stdChildIn;
00743     si.hStdOutput=stdChildOut;
00744     si.hStdError =stdChildErr;
00745     if(!hasTty)
00746     {
00747         si.dwFlags|=STARTF_USESHOWWINDOW;
00748         si.wShowWindow = SW_SHOWMINNOACTIVE;
00749     }
00750
00751     if(!hasTty)
00752     {
00753         stdoldIn = GetStdHandle(STD_INPUT_HANDLE);
00754         stdoldOut = GetStdHandle(STD_OUTPUT_HANDLE);
00755         stdoldErr = GetStdHandle(STD_ERROR_HANDLE);
00756         SetStdHandle(STD_INPUT_HANDLE, stdChildIn);
00757         SetStdHandle(STD_OUTPUT_HANDLE, stdChildOut);
00758         SetStdHandle(STD_ERROR_HANDLE, stdChildErr);
00759     }
00760
00761     //Create Child Process
00762     resCreate = CreateProcess
00763          (
00764             NULL,
00765             command,
00766             NULL,
00767             NULL,
00768             TRUE,
00769             NORMAL_PRIORITY_CLASS,
00770             NULL,
00771             currentDirectory,
00772             &si,
00773             &pi);
00774
00775     if(!hasTty)
00776     {
00777         SetStdHandle(STD_INPUT_HANDLE, stdoldIn);
00778         SetStdHandle(STD_OUTPUT_HANDLE, stdoldOut);
00779         SetStdHandle(STD_ERROR_HANDLE, stdoldErr);
00780     }
00781
00782     if(!resCreate)
00783         goto error;
00784
00785     cvs_process->pid = pi.hProcess;
00786
00787     cnt = 0;
00788
00789     // now open-up threads which will serve the pipes
00790     threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)ServeProtocol;
00791     threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)WaitChld;
00792     if(!hasTty)
00793     {
00794         threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)GetChldOutput;
00795         threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)GetChldError;
00796     }
00797
00798     for(i = 0; i < cnt; i++)
00799     {
00800         if ((cvs_process->threads[i]=::CreateThread
00801                       (
00802                          (LPSECURITY_ATTRIBUTES)NULL,           // No security attributes.
00803                          (DWORD)0,                              // Use same stack size.
00804                          (LPTHREAD_START_ROUTINE)threadsFunc[i], // Thread procedure.
00805                          (LPVOID)cvs_process,                   // Parameter to pass.
00806                          (DWORD)0,                              // Run immediately.
00807                          (LPDWORD)&cvs_process->threadsID[i])
00808                       )==NULL)
00809         {
00810             TerminateProcess(cvs_process->pid,0);
00811             goto error;
00812         }
00813     }
00814
00815     //Close unneccesary Handles
00816     CloseHandle(cvs_process->his_read);
00817     cvs_process->his_read = 0;
00818     CloseHandle(cvs_process->his_write);
00819     cvs_process->his_write = 0;
00820
00821     if(!hasTty)
00822     {
00823         CloseHandle(stdChildIn);
00824         CloseHandle(stdChildOut);
00825         CloseHandle(stdChildErr);
00826     }
00827
00828     CloseHandle(pi.hThread);
00829
00830     free(command);
00831
00832     goto goodboy;
00833
00834 error:
00835     if(cvs_process->his_read != 0L)
00836         CloseHandle(cvs_process->his_read);
00837     if(cvs_process->his_write != 0L)
00838         CloseHandle(cvs_process->his_write);
00839     if(dupIn != 0L)
00840         CloseHandle(dupIn);
00841     if(dupOut != 0L)
00842         CloseHandle(dupOut);
00843     if(cvs_process->my_read != 0L)
00844         CloseHandle(cvs_process->my_read);
00845     if(cvs_process->my_write != 0L)
00846         CloseHandle(cvs_process->my_write);
00847     if(command != 0L)
00848         free(command);
00849     if(stdChildIn != 0L)
00850         CloseHandle(stdChildIn);
00851     if(stdChildOut != 0L)
00852         CloseHandle(stdChildOut);
00853     if(stdChildErr != 0L)
00854         CloseHandle(stdChildErr);
00855     if(stddupIn != 0L)
00856         CloseHandle(stddupIn);
00857     if(stddupOut != 0L)
00858         CloseHandle(stddupOut);
00859     if(stddupErr != 0L)
00860         CloseHandle(stddupErr);
00861     if(cvs_process->pstdin != 0L)
00862         CloseHandle(cvs_process->pstdin);
00863     if(cvs_process->pstdout != 0L)
00864         CloseHandle(cvs_process->pstdout);
00865     if(cvs_process->pstderr != 0L)
00866         CloseHandle(cvs_process->pstderr);
00867
00868     cvs_process_destroy (cvs_process);
00869     return 0L;
00870
00871 goodboy:
00872 #endif
00873
00874     {
00875         CStackThreadLock locker;
00876
00877         open_cvs_process.push_back(cvs_process);
00878     }
00879
00880     cvs_process->open = TRUE;
00881 #ifdef WIN32
00882     cvs_process->starting = FALSE;
00883 #endif
00884
00885     return cvs_process;
00886 }
00887
00888 static void
00889 cvs_process_close (CvsProcess *cvs_process,
00890                int     kill_it)
00891 {
00892     CDestroyThreadLock locker;
00893
00894     if (cvs_process && cvs_process->open)
00895     {
00896 #ifdef WIN32
00897         if(GetCurrentThreadId() != cvs_process->threadsID[0])
00898         {
00899             // we wait for all the protocol to be over before we close
00900             // the process and the pipe.
00901             WaitForSingleObject(cvs_process->threads[0], 500);
00902             cvs_process->open = FALSE;
00903             WaitForSingleObject(cvs_process->threads[0], 500);
00904         }
00905 #endif
00906
00907         cvs_process->open = FALSE;
00908
00909 #ifndef WIN32
00910         int status;
00911
00912         /* If necessary, kill the filter.
00913          */
00914         if (kill_it && cvs_process->pid)
00915             status = kill (cvs_process->pid, SIGKILL);
00916
00917         /* Wait for the process to exit. This will happen
00918          *  immediately if it was just killed.
00919          */
00920         if (cvs_process->pid)
00921             waitpid (cvs_process->pid, &status, 0);
00922
00923         /* Close the pipes.
00924          */
00925         if (cvs_process->my_read)
00926             close (cvs_process->my_read);
00927         if (cvs_process->my_write)
00928             close (cvs_process->my_write);
00929         if (cvs_process->his_read)
00930             close (cvs_process->his_read);
00931         if (cvs_process->his_write)
00932             close (cvs_process->his_write);
00933 #else
00934         cvs_process->starting = TRUE;
00935
00936         // this is bad to do that, cvs won't have a chance
00937         // to raise the KILL signal (sigh...)
00938         if (kill_it && cvs_process->pid)
00939         {
00940             TerminateProcess(cvs_process->pid, -1);
00941         }
00942
00943         if (cvs_process->pid)
00944             CloseHandle(cvs_process->pid);
00945         if (cvs_process->my_read)
00946             CloseHandle(cvs_process->my_read);
00947         if (cvs_process->my_write)
00948             CloseHandle(cvs_process->my_write);
00949         if (cvs_process->his_read)
00950             CloseHandle(cvs_process->his_read);
00951         if (cvs_process->his_write)
00952             CloseHandle(cvs_process->his_write);
00953         if (cvs_process->pstdin)
00954             CloseHandle(cvs_process->pstdin);
00955         if (cvs_process->pstdout)
00956             CloseHandle(cvs_process->pstdout);
00957         if (cvs_process->pstderr)
00958             CloseHandle(cvs_process->pstderr);
00959 #endif
00960
00961         wire_clear_error();
00962
00963         /* Set the fields to null values.
00964          */
00965         cvs_process->pid = 0;
00966         cvs_process->my_read = 0;
00967         cvs_process->my_write = 0;
00968         cvs_process->his_read = 0;
00969         cvs_process->his_write = 0;
00970         cvs_process->pstdin = 0;
00971         cvs_process->pstdout = 0;
00972         cvs_process->pstderr = 0;
00973
00974         {
00975             CStackThreadLock locker;
00976
00977             std::vector<CvsProcess *>::iterator i = std::find(open_cvs_process.begin(), open_cvs_process.end(), cvs_process);
00978             if(i != open_cvs_process.end())
00979                 open_cvs_process.erase(i);
00980         }
00981     }
00982 }
00983
00984 int
00985 cvs_process_is_active(CvsProcess *cvs_process)
00986 {
00987     int res;
00988
00989     {
00990         CStackThreadLock locker;
00991
00992         std::vector<CvsProcess *>::iterator i =
00993             std::find(open_cvs_process.begin(), open_cvs_process.end(), cvs_process);
00994         res = i != open_cvs_process.end() ? 1 : 0;
00995     }
00996
00997     return res;
00998 }
00999
01000 void
01001 cvs_process_kill(CvsProcess *cvs_process)
01002 {
01003     if(cvs_process_is_active(cvs_process))
01004     {
01005         cvs_process_destroy(cvs_process);
01006     }
01007 }
01008
01009 void
01010 cvs_process_give_time(void)
01011 {
01012 #ifndef WIN32
01013     fd_set rset;
01014     int ready;
01015     int maxfd = 0;
01016     int fd;
01017     struct timeval tv;
01018
01019     FD_ZERO (&rset);
01020
01021     std::vector<CvsProcess *>::iterator i;
01022
01023     for (i = open_cvs_process.begin(); i != open_cvs_process.end(); ++i)
01024     {
01025         fd = (*i)->my_read;
01026
01027         FD_SET (fd, &rset);
01028         if (fd > maxfd)
01029             maxfd = fd;
01030     }
01031
01032     tv.tv_sec = 0;
01033     tv.tv_usec = 100000;
01034     ready = select (maxfd + 1, &rset, 0L, 0L, &tv);
01035
01036     std::vector<CvsProcess *> toFire;
01037     if (ready > 0)
01038     {
01039         for (i = open_cvs_process.begin(); i != open_cvs_process.end(); ++i)
01040         {
01041             fd = (*i)->my_read;
01042
01043             if (FD_ISSET (fd, &rset))
01044                 toFire.push_back(*i);
01045         }
01046     }
01047
01048     for (i = toFire.begin(); i != toFire.end(); ++i)
01049     {
01050         fd = (*i)->my_read;
01051
01052         if (FD_ISSET (fd, &rset))
01053             cvs_process_recv_message (*i);
01054     }
01055 #else
01056     // we don't have to do yield since we use preemptive threads
01057 #endif
01058 }
01059
01060 static void
01061 cvs_process_recv_message (CvsProcess *p)
01062 {
01063     WireMessage msg;
01064
01065     cvs_process_push (p);
01066
01067     memset (&msg, 0, sizeof (WireMessage));
01068     if (!wire_read_msg (p->my_read, &msg))
01069     {
01070         cvs_process_close (p, TRUE);
01071     }
01072     else
01073     {
01074         cvs_process_handle_message (&msg);
01075         wire_destroy (&msg);
01076     }
01077
01078     if(cvs_process_is_active(current_cvs_process))
01079     {
01080         if (!current_cvs_process->open)
01081         {
01082 #ifndef WIN32
01083             cvs_process_destroy (current_cvs_process);
01084 #endif
01085         }
01086         else
01087             cvs_process_pop ();
01088     }
01089 }
01090
01091 static void
01092 cvs_process_handle_message (WireMessage *msg)
01093 {
01094     switch (msg->type)
01095     {
01096     case GP_QUIT:
01097     {
01098         GPT_QUIT *t = (GPT_QUIT *)msg->data;
01099         current_cvs_process->callbacks->exit(t->code);
01100         cvs_process_close (current_cvs_process, FALSE);
01101         break;
01102     }
01103     case GP_GETENV:
01104     {
01105         GPT_GETENV *t = (GPT_GETENV *)msg->data;
01106         cvs_process_push (current_cvs_process);
01107         gp_getenv_write (current_cvs_process->my_write,
01108                          current_cvs_process->callbacks->getenv(t->str));
01109         cvs_process_pop ();
01110         break;
01111     }
01112     case GP_CONSOLE:
01113     {
01114         GPT_CONSOLE *t = (GPT_CONSOLE *)msg->data;
01115         if(t->isStderr)
01116             current_cvs_process->callbacks->consoleerr(t->str, t->len);
01117         else
01118             current_cvs_process->callbacks->consoleout(t->str, t->len);
01119         break;
01120     }
01121     }
01122 }
01123
01124 static int
01125 cvs_process_write (pipe_t     fd,
01126                guint8 *buf,
01127                gulong  count)
01128 {
01129     gulong bytes;
01130
01131     if(current_write_buffer == 0L)
01132         current_write_buffer = process_write_buffer;
01133
01134     while (count > 0)
01135     {
01136         if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE)
01137         {
01138             bytes = WRITE_BUFFER_SIZE - current_write_buffer_index;
01139             memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes);
01140             current_write_buffer_index += bytes;
01141             if (!wire_flush (fd))
01142                 return FALSE;
01143         }
01144         else
01145         {
01146             bytes = count;
01147             memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes);
01148             current_write_buffer_index += bytes;
01149         }
01150
01151         buf += bytes;
01152         count -= bytes;
01153     }
01154
01155     return TRUE;
01156 }
01157
01158 static int
01159 cvs_process_flush (pipe_t fd)
01160 {
01161     int count;
01162     int bytes;
01163
01164     if (current_write_buffer_index > 0)
01165     {
01166         count = 0;
01167         while (count != current_write_buffer_index)
01168         {
01169             do {
01170                 bytes = write (fd, &current_write_buffer[count],
01171                                (current_write_buffer_index - count));
01172             } while ((bytes == -1) && (errno == EAGAIN));
01173
01174             if (bytes == -1)
01175                 return FALSE;
01176
01177             count += bytes;
01178         }
01179
01180         current_write_buffer_index = 0;
01181     }
01182
01183     return TRUE;
01184 }
01185
01186 static void
01187 cvs_process_push (CvsProcess *cvs_process)
01188 {
01189     CStackThreadLock locker;
01190
01191     if (cvs_process)
01192     {
01193         current_cvs_process = cvs_process;
01194
01195         cvs_process_stack.push_back(current_cvs_process);
01196
01197         current_write_buffer_index = current_cvs_process->write_buffer_index;
01198         current_write_buffer = current_cvs_process->write_buffer;
01199     }
01200     else
01201     {
01202         current_write_buffer_index = 0;
01203         current_write_buffer = NULL;
01204     }
01205 }
01206
01207 static void
01208 cvs_process_pop ()
01209 {
01210     CStackThreadLock locker;
01211
01212     if (current_cvs_process)
01213     {
01214         current_cvs_process->write_buffer_index = current_write_buffer_index;
01215
01216         cvs_process_stack.pop_back();
01217     }
01218
01219     if (!cvs_process_stack.empty())
01220     {
01221         current_cvs_process = cvs_process_stack.back();
01222         current_write_buffer_index = current_cvs_process->write_buffer_index;
01223         current_write_buffer = current_cvs_process->write_buffer;
01224     }
01225     else
01226     {
01227         current_cvs_process = NULL;
01228         current_write_buffer_index = 0;
01229         current_write_buffer = NULL;
01230     }
01231 }
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/cvsgui_process.h Source File

common/cvsgui_process.h

Go to the documentation of this file.
00001 /*
00002 ** The cvsgui protocol used by WinCvs
00003 **
00004 ** This library is free software; you can redistribute it and/or
00005 ** modify it under the terms of the GNU Lesser General Public
00006 ** License as published by the Free Software Foundation; either
00007 ** version 2.1 of the License, or (at your option) any later version.
00008 **
00009 ** This library is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 ** Lesser General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU Lesser General Public
00015 ** License along with this library; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018
00019 /*
00020  * plugin.h from the GIMP modified for the cvsgui project by :
00021  * Alexandre Parenteau <aubonbeurre@hotmail.com> --- November 1999
00022  */
00023
00024 #ifndef CVSGUI_PROCESS_H
00025 #define CVSGUI_PROCESS_H
00026
00027 #include <sys/types.h>
00028 #include "cvsgui_wire.h"
00029
00030 #define WRITE_BUFFER_SIZE  512
00031
00032 typedef struct _CvsProcess             CvsProcess;
00033
00034 typedef struct
00035 {
00036     long (*consoleout)(char *txt, long len);    /* Get cvs stdout */
00037     long (*consoleerr)(char *txt, long len);    /* Get cvs stderr */
00038     const char *(*getenv)(char *name);              /* Ask about env. variable */
00039     void (*exit)(int code);                     /* Tells the exit code */
00040 } CvsProcessCallbacks;
00041
00042 struct _CvsProcess
00043 {
00044     unsigned int open : 1;                  /* Is the process open */
00045     unsigned int destroy : 1;               /* Should the process by destroyed */
00046 #ifdef WIN32
00047     unsigned int starting : 1;              /* Is the process starting or not */
00048 #endif
00049     pid_t pid;                              /* process process id */
00050     char **args;                            /* process command line arguments */
00051     int argc;
00052
00053     pipe_t my_read, my_write;               /* Apps read and write file descriptors */
00054     pipe_t his_read, his_write;             /* process read and write file descriptors */
00055     pipe_t pstdin, pstdout, pstderr;        /* tty descriptors used by the child */
00056
00057     char write_buffer[WRITE_BUFFER_SIZE];   /* Buffer for writing */
00058     int write_buffer_index;                 /* Buffer index for writing */
00059     CvsProcessCallbacks *callbacks;         /* Jump table */
00060 #ifdef WIN32
00061     HANDLE threads[4];
00062     DWORD threadsID[4];
00063 #endif
00064 };
00065
00066 #ifdef __cplusplus
00067 extern "C" {
00068 #endif
00069
00070 /* Open a process. This cause the process to run.
00071  * Optionnally, let the child have a TTY (console)
00072  */
00073 CvsProcess *cvs_process_open (char *name, int argc, char **argv,
00074                               CvsProcessCallbacks *callbacks, int hasTty, const char* currentDirectory);
00075
00076 /* Close a process. This kills the process and releases
00077  *  its resources.
00078  */
00079 void cvs_process_kill(CvsProcess *cvs_process);
00080
00081 /* Initialize initialize the protocol library (both for the
00082  * process and the application)
00083  */
00084 void cvs_process_init (void);
00085
00086 /*
00087  * Called by the application to answer calls from the process
00088  */
00089 void cvs_process_give_time(void);
00090
00091 /*
00092  * Tells if the process is still alive
00093  */
00094 int cvs_process_is_active(CvsProcess *cvs_process);
00095
00096 /*
00097  * Kills the process
00098  */
00099
00100 #ifdef __cplusplus
00101 }
00102 #endif
00103
00104 #endif /* CVSGUI_PROCESS_H */
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/cvsgui_protocol.h Source File

common/cvsgui_protocol.h

Go to the documentation of this file.
00001 /*
00002 ** The cvsgui protocol used by WinCvs
00003 **
00004 ** This library is free software; you can redistribute it and/or
00005 ** modify it under the terms of the GNU Lesser General Public
00006 ** License as published by the Free Software Foundation; either
00007 ** version 2.1 of the License, or (at your option) any later version.
00008 **
00009 ** This library is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 ** Lesser General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU Lesser General Public
00015 ** License along with this library; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018
00019 /*
00020  * gimpprotocol.h from the GIMP modified for the cvsgui project by :
00021  * Alexandre Parenteau <aubonbeurre@hotmail.com> --- January 2000
00022  */
00023
00024 #ifndef CVSGUI_PROTOCOL_H
00025 #define CVSGUI_PROTOCOL_H
00026
00027 #include "cvsgui_wire.h"
00028
00029 enum {
00030     GP_QUIT,
00031     GP_GETENV,
00032     GP_CONSOLE
00033 };
00034
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038
00039 typedef struct
00040 {
00041     gint32 code;
00042 } GPT_QUIT;
00043
00044 typedef struct
00045 {
00046     guint8 empty;
00047     char *str;
00048 } GPT_GETENV;
00049
00050 typedef struct
00051 {
00052     guint8 isStderr;
00053     guint32 len;
00054     char *str;
00055 } GPT_CONSOLE;
00056
00057 int  gp_quit_write (pipe_t fd, int code);
00058 int  gp_getenv_write (pipe_t fd, const char *env);
00059 int  gp_console_write (pipe_t fd, const char *str, int len, int isStderr);
00060 char *gp_getenv_read (pipe_t fd);
00061
00062 extern pipe_t _cvsgui_readfd;
00063 extern pipe_t _cvsgui_writefd;
00064
00065 #ifdef __cplusplus
00066 }
00067 #endif
00068
00069 #endif /* CVSGUI_PROTOCOL_H */
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/cvsgui_wire.cpp Source File

common/cvsgui_wire.cpp

Go to the documentation of this file.
00001 /*
00002 ** The cvsgui protocol used by WinCvs
00003 **
00004 ** This library is free software; you can redistribute it and/or
00005 ** modify it under the terms of the GNU Lesser General Public
00006 ** License as published by the Free Software Foundation; either
00007 ** version 2.1 of the License, or (at your option) any later version.
00008 **
00009 ** This library is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 ** Lesser General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU Lesser General Public
00015 ** License along with this library; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018
00019 /*
00020  * gimpwire.c from the GIMP modified for the cvsgui project by :
00021  * Alexandre Parenteau <aubonbeurre@hotmail.com> --- November 1999
00022  */
00023
00024 #include <errno.h>
00025 #include <stdio.h>
00026 #include <stdlib.h>
00027 #include <string.h>
00028
00029 #include <sys/types.h>
00030 #include "cvsgui_wire.h"
00031
00032 #ifndef WIN32
00033 #   include <unistd.h>
00034 #   include <sys/param.h>
00035 #   include <netinet/in.h>
00036 #else
00037 #   pragma warning (disable : 4786)
00038 #endif
00039
00040 #include <map>
00041
00042 #ifdef WIN32
00043 static int read(pipe_t fd, void *buf, int count)
00044 {
00045     DWORD dread;
00046     if(!ReadFile(fd,buf,count,&dread,NULL))
00047     {
00048         DWORD err = GetLastError();
00049         errno = EINVAL;
00050         return -1;
00051     }
00052     return dread;
00053 }
00054
00055 static int write(pipe_t fd, const void *buf, int count)
00056 {
00057     DWORD dwrite;
00058     if(!WriteFile(fd,buf,count,&dwrite,NULL))
00059     {
00060         errno = EINVAL;
00061         return -1;
00062     }
00063     return dwrite;
00064 }
00065 #endif
00066
00067 typedef struct _WireHandler  WireHandler;
00068
00069 struct _WireHandler
00070 {
00071     guint32 type;
00072     WireReadFunc read_func;
00073     WireWriteFunc write_func;
00074     WireDestroyFunc destroy_func;
00075 };
00076
00077 static WireIOFunc wire_read_func = NULL;
00078 static WireIOFunc wire_write_func = NULL;
00079 static WireFlushFunc wire_flush_func = NULL;
00080 static int wire_error_val = FALSE;
00081
00082 struct CAllHandlers
00083 {
00084 public:
00085     CAllHandlers() {}
00086     ~CAllHandlers()
00087     {
00088         std::map<guint32, WireHandler *>::iterator i;
00089         for(i = wire_ht.begin(); i != wire_ht.end(); ++i)
00090         {
00091             WireHandler *handler = (*i).second;
00092             free(handler);
00093         }
00094     }
00095
00096     std::map<guint32, WireHandler *> wire_ht;
00097 } sHandlers;
00098
00099 void
00100 wire_register (guint32         type,
00101                WireReadFunc    read_func,
00102                WireWriteFunc   write_func,
00103                WireDestroyFunc destroy_func)
00104 {
00105     WireHandler *handler;
00106
00107     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(type);
00108     if(i == sHandlers.wire_ht.end())
00109         handler = (WireHandler *)malloc(sizeof(WireHandler));
00110     else
00111         handler = (*i).second;
00112
00113     handler->type = type;
00114     handler->read_func = read_func;
00115     handler->write_func = write_func;
00116     handler->destroy_func = destroy_func;
00117
00118     sHandlers.wire_ht.insert(std::map<guint32, WireHandler *>::value_type(type, handler));
00119 }
00120
00121 void
00122 wire_set_reader (WireIOFunc read_func)
00123 {
00124     wire_read_func = read_func;
00125 }
00126
00127 void
00128 wire_set_writer (WireIOFunc write_func)
00129 {
00130     wire_write_func = write_func;
00131 }
00132
00133 void
00134 wire_set_flusher (WireFlushFunc flush_func)
00135 {
00136     wire_flush_func = flush_func;
00137 }
00138
00139 int
00140 wire_read (pipe_t fd,
00141            guint8 *buf,
00142            gulong  count)
00143 {
00144     if (wire_read_func)
00145     {
00146         if (!(* wire_read_func) (fd, buf, count))
00147         {
00148             //g_print ("wire_read: error\n");
00149             wire_error_val = TRUE;
00150             return FALSE;
00151         }
00152     }
00153     else
00154     {
00155         int bytes;
00156
00157         while (count > 0)
00158         {
00159             do {
00160                 bytes = read (fd, (char*) buf, count);
00161             } while ((bytes == -1) && ((errno == EAGAIN) || (errno == EINTR)));
00162
00163             if (bytes == -1)
00164             {
00165                 //g_print ("wire_read: error\n");
00166                 wire_error_val = TRUE;
00167                 return FALSE;
00168             }
00169
00170             if (bytes == 0)
00171             {
00172                 //g_print ("wire_read: unexpected EOF (plug-in crashed?)\n");
00173                 wire_error_val = TRUE;
00174                 return FALSE;
00175             }
00176
00177             count -= bytes;
00178             buf += bytes;
00179         }
00180     }
00181
00182     return TRUE;
00183 }
00184
00185 int
00186 wire_write (pipe_t fd,
00187             guint8 *buf,
00188             gulong  count)
00189 {
00190     if (wire_write_func)
00191     {
00192         if (!(* wire_write_func) (fd, buf, count))
00193         {
00194             //g_print ("wire_write: error\n");
00195             wire_error_val = TRUE;
00196             return FALSE;
00197         }
00198     }
00199     else
00200     {
00201         int bytes;
00202
00203         while (count > 0)
00204         {
00205             do {
00206                 bytes = write (fd, (char*) buf, count);
00207             } while ((bytes == -1) && ((errno == EAGAIN) || (errno == EINTR)));
00208
00209             if (bytes == -1)
00210             {
00211                 //g_print ("wire_write: error\n");
00212                 wire_error_val = TRUE;
00213                 return FALSE;
00214             }
00215
00216             count -= bytes;
00217             buf += bytes;
00218         }
00219     }
00220
00221     return TRUE;
00222 }
00223
00224 int
00225 wire_flush (pipe_t fd)
00226 {
00227     if (wire_flush_func)
00228         return (* wire_flush_func) (fd);
00229     return FALSE;
00230 }
00231
00232 int
00233 wire_error ()
00234 {
00235     return wire_error_val;
00236 }
00237
00238 void
00239 wire_clear_error ()
00240 {
00241     wire_error_val = FALSE;
00242 }
00243
00244 int
00245 wire_read_msg (pipe_t       fd,
00246                WireMessage *msg)
00247 {
00248     WireHandler *handler;
00249
00250     if (wire_error_val)
00251         return !wire_error_val;
00252
00253     if (!wire_read_int32 (fd, &msg->type, 1))
00254         return FALSE;
00255
00256     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(msg->type);
00257     if(i == sHandlers.wire_ht.end())
00258         return FALSE;
00259
00260     handler = (*i).second;
00261     (* handler->read_func) (fd, msg);
00262
00263     return !wire_error_val;
00264 }
00265
00266 int
00267 wire_write_msg (pipe_t       fd,
00268                 WireMessage *msg)
00269 {
00270     WireHandler *handler;
00271
00272     if (wire_error_val)
00273         return !wire_error_val;
00274
00275     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(msg->type);
00276     if(i == sHandlers.wire_ht.end())
00277         return FALSE;
00278
00279     handler = (*i).second;
00280
00281     if (!wire_write_int32 (fd, &msg->type, 1))
00282         return FALSE;
00283
00284     (* handler->write_func) (fd, msg);
00285
00286     return !wire_error_val;
00287 }
00288
00289 void
00290 wire_destroy (WireMessage *msg)
00291 {
00292     WireHandler *handler;
00293
00294     std::map<guint32, WireHandler *>::iterator i = sHandlers.wire_ht.find(msg->type);
00295     if(i == sHandlers.wire_ht.end())
00296         return;
00297
00298     handler = (*i).second;
00299     (* handler->destroy_func) (msg);
00300 }
00301
00302 int
00303 wire_read_int32 (pipe_t   fd,
00304                  guint32 *data,
00305                  gint     count)
00306 {
00307     if (count > 0)
00308     {
00309         if (!wire_read_int8 (fd, (guint8*) data, count * 4))
00310             return FALSE;
00311
00312         while (count--)
00313         {
00314             *data = ntohl (*data);
00315             data++;
00316         }
00317     }
00318
00319     return TRUE;
00320 }
00321
00322 int
00323 wire_read_int16 (pipe_t   fd,
00324                  guint16 *data,
00325                  gint     count)
00326 {
00327     if (count > 0)
00328     {
00329         if (!wire_read_int8 (fd, (guint8*) data, count * 2))
00330             return FALSE;
00331
00332         while (count--)
00333         {
00334             *data = ntohs (*data);
00335             data++;
00336         }
00337     }
00338
00339     return TRUE;
00340 }
00341
00342 int
00343 wire_read_int8 (pipe_t fd,
00344                 guint8 *data,
00345                 gint    count)
00346 {
00347     return wire_read (fd, data, count);
00348 }
00349
00350 int
00351 wire_read_double (pipe_t   fd,
00352                   gdouble *data,
00353                   gint     count)
00354 {
00355     char *str;
00356     int i;
00357
00358     for (i = 0; i < count; i++)
00359     {
00360         if (!wire_read_string (fd, &str, 1))
00361             return FALSE;
00362         sscanf (str, "%le", &data[i]);
00363         free (str);
00364     }
00365
00366     return TRUE;
00367 }
00368
00369 int
00370 wire_read_string (pipe_t fd,
00371                   gchar **data,
00372                   gint    count)
00373 {
00374     guint32 tmp;
00375     int i;
00376
00377     for (i = 0; i < count; i++)
00378     {
00379         if (!wire_read_int32 (fd, &tmp, 1))
00380             return FALSE;
00381
00382         if (tmp > 0)
00383         {
00384             data[i] = (gchar *)malloc(tmp * sizeof(gchar));
00385             if (!wire_read_int8 (fd, (guint8*) data[i], tmp))
00386             {
00387                 free (data[i]);
00388                 return FALSE;
00389             }
00390         }
00391         else
00392         {
00393             data[i] = NULL;
00394         }
00395     }
00396
00397     return TRUE;
00398 }
00399
00400 int
00401 wire_write_int32 (pipe_t   fd,
00402                   guint32 *data,
00403                   gint     count)
00404 {
00405     guint32 tmp;
00406     int i;
00407
00408     if (count > 0)
00409     {
00410         for (i = 0; i < count; i++)
00411         {
00412             tmp = htonl (data[i]);
00413             if (!wire_write_int8 (fd, (guint8*) &tmp, 4))
00414                 return FALSE;
00415         }
00416     }
00417
00418     return TRUE;
00419 }
00420
00421 int
00422 wire_write_int16 (pipe_t   fd,
00423                   guint16 *data,
00424                   gint     count)
00425 {
00426     guint16 tmp;
00427     int i;
00428
00429     if (count > 0)
00430     {
00431         for (i = 0; i < count; i++)
00432         {
00433             tmp = htons (data[i]);
00434             if (!wire_write_int8 (fd, (guint8*) &tmp, 2))
00435                 return FALSE;
00436         }
00437     }
00438
00439     return TRUE;
00440 }
00441
00442 int
00443 wire_write_int8 (pipe_t fd,
00444                  guint8 *data,
00445                  gint    count)
00446 {
00447     return wire_write (fd, data, count);
00448 }
00449
00450 int
00451 wire_write_double (pipe_t   fd,
00452                    gdouble *data,
00453                    gint     count)
00454 {
00455     gchar *t, buf[128];
00456     int i;
00457
00458     t = buf;
00459     for (i = 0; i < count; i++)
00460     {
00461         sprintf (buf, "%0.50e", data[i]);
00462         if (!wire_write_string (fd, &t, 1))
00463             return FALSE;
00464     }
00465
00466     return TRUE;
00467 }
00468
00469 int
00470 wire_write_string (pipe_t fd,
00471                    gchar **data,
00472                    gint    count)
00473 {
00474     guint32 tmp;
00475     int i;
00476
00477     for (i = 0; i < count; i++)
00478     {
00479         if (data[i])
00480             tmp = strlen (data[i]) + 1;
00481         else
00482             tmp = 0;
00483
00484         if (!wire_write_int32 (fd, &tmp, 1))
00485             return FALSE;
00486         if (tmp > 0)
00487             if (!wire_write_int8 (fd, (guint8*) data[i], tmp))
00488                 return FALSE;
00489     }
00490
00491     return TRUE;
00492 }
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/cvsgui_wire.h Source File

common/cvsgui_wire.h

Go to the documentation of this file.
00001 /*
00002 ** The cvsgui protocol used by WinCvs
00003 **
00004 ** This library is free software; you can redistribute it and/or
00005 ** modify it under the terms of the GNU Lesser General Public
00006 ** License as published by the Free Software Foundation; either
00007 ** version 2.1 of the License, or (at your option) any later version.
00008 **
00009 ** This library is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 ** Lesser General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU Lesser General Public
00015 ** License along with this library; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018
00019 /*
00020  * gimpwire.h from the GIMP modified for the cvsgui project by :
00021  * Alexandre Parenteau <aubonbeurre@hotmail.com> --- November 1999
00022  */
00023
00024 #ifndef CVSGUI_WIRE_H
00025 #define CVSGUI_WIRE_H
00026
00027 #ifdef WIN32
00028 #   include <Windows.h>
00029 #endif
00030
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034
00035 #ifndef __G_LIB_H__
00036 typedef signed char gint8;
00037 typedef unsigned char guint8;
00038 typedef signed short gint16;
00039 typedef unsigned short guint16;
00040 typedef signed int gint32;
00041 typedef unsigned int guint32;
00042
00043 typedef char   gchar;
00044 typedef short  gshort;
00045 typedef long   glong;
00046 typedef int    gint;
00047 typedef gint   gboolean;
00048
00049 typedef unsigned char   guchar;
00050 typedef unsigned short  gushort;
00051 typedef unsigned long   gulong;
00052 typedef unsigned int    guint;
00053
00054 typedef float   gfloat;
00055 typedef double  gdouble;
00056
00057 typedef void* gpointer;
00058 typedef const void *gconstpointer;
00059
00060 #ifndef FALSE
00061 #define FALSE   (0)
00062 #endif
00063
00064 #ifndef TRUE
00065 #define TRUE    (!FALSE)
00066 #endif
00067 #endif // !__G_LIB_H__
00068
00069 #ifdef WIN32
00070 #   ifdef pid_t
00071 #       undef pid_t // config.h of cvs
00072 #   endif
00073     typedef HANDLE pid_t;
00074     typedef HANDLE pipe_t;
00075 #else
00076     typedef int pipe_t;
00077 #endif
00078
00079 typedef struct _WireMessage  WireMessage;
00080
00081 typedef void (* WireReadFunc)    (pipe_t fd, WireMessage *msg);
00082 typedef void (* WireWriteFunc)   (pipe_t fd, WireMessage *msg);
00083 typedef void (* WireDestroyFunc) (WireMessage *msg);
00084 typedef int  (* WireIOFunc)      (pipe_t fd, guint8 *buf, gulong count);
00085 typedef int  (* WireFlushFunc)   (pipe_t fd);
00086
00087
00088 struct _WireMessage
00089 {
00090   guint32 type;
00091   gpointer data;
00092 };
00093
00094
00095 void wire_register     (guint32          type,
00096                 WireReadFunc     read_func,
00097                 WireWriteFunc    write_func,
00098                 WireDestroyFunc  destroy_func);
00099 void wire_set_reader   (WireIOFunc       read_func);
00100 void wire_set_writer   (WireIOFunc       write_func);
00101 void wire_set_flusher  (WireFlushFunc    flush_func);
00102 int  wire_read         (pipe_t              fd,
00103             guint8          *buf,
00104             gulong           count);
00105 int  wire_write        (pipe_t              fd,
00106             guint8          *buf,
00107             gulong           count);
00108 int  wire_flush        (pipe_t              fd);
00109 int  wire_error        (void);
00110 void wire_clear_error  (void);
00111 int  wire_read_msg     (pipe_t              fd,
00112                 WireMessage     *msg);
00113 int  wire_write_msg    (pipe_t              fd,
00114                 WireMessage     *msg);
00115 void wire_destroy      (WireMessage     *msg);
00116 int  wire_read_int32   (pipe_t              fd,
00117                 guint32         *data,
00118                 gint             count);
00119 int  wire_read_int16   (pipe_t              fd,
00120                 guint16         *data,
00121                 gint             count);
00122 int  wire_read_int8    (pipe_t              fd,
00123                 guint8          *data,
00124                 gint             count);
00125 int  wire_read_double  (pipe_t              fd,
00126                 gdouble         *data,
00127                 gint             count);
00128 int  wire_read_string  (pipe_t              fd,
00129             gchar          **data,
00130             gint             count);
00131 int  wire_write_int32  (pipe_t              fd,
00132                 guint32         *data,
00133                 gint             count);
00134 int  wire_write_int16  (pipe_t              fd,
00135                 guint16         *data,
00136                 gint             count);
00137 int  wire_write_int8   (pipe_t              fd,
00138                 guint8          *data,
00139                 gint             count);
00140 int  wire_write_double (pipe_t              fd,
00141             gdouble         *data,
00142             gint             count);
00143 int  wire_write_string (pipe_t              fd,
00144             gchar          **data,
00145             gint             count);
00146
00147 #ifdef __cplusplus
00148 }
00149 #endif
00150
00151 #endif /* CVSGUI_WIRE_H */
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsIgnore.cpp Source File

common/CvsIgnore.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- June 1998
00019  */
00020
00021 /*
00022  * CvsIgnore.cpp --- parse the .cvsignore
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include <stdlib.h>
00028 #include <string.h>
00029
00030 #include "FileTraversal.h"
00031 #include "AppConsole.h"
00032 #include "CvsIgnore.h"
00033 #include "getline.h"
00034 #include "fnmatch.h"
00035 #include "CvsPrefs.h"
00036
00037 #ifndef WIN32
00038 #   include <ctype.h>
00039 #endif /* !WIN32 */
00040
00041 #ifdef qMacCvsPP
00042 #       include "MacCvsApp.h"
00043 #endif /* qMacCvsPP */
00044
00045 #ifdef WIN32
00046 #   include "wincvs.h"
00047
00048 #   ifdef _DEBUG
00049 #       define new DEBUG_NEW
00050 #       undef THIS_FILE
00051         static char THIS_FILE[] = __FILE__;
00052 #   endif
00053 #endif /* WIN32 */
00054
00055 /* Parse a line of space-separated wildcards and add them to the list. */
00056 /* mostly duplicated from cvs/src/ignore.c */
00057 static void ign_add (char *ign, bool hold, std::vector<CStr> & ignlist)
00058 {
00059     if (!ign || !*ign)
00060         return;
00061
00062     int ign_hold = ignlist.size() == 0 ? -1 : (int)ignlist.size();
00063
00064     for (; *ign; ign++)
00065     {
00066         char *mark;
00067         char save;
00068
00069         /* ignore whitespace before the token */
00070         if (isspace (*ign))
00071             continue;
00072
00073         /*
00074         * if we find a single character !, we must re-set the ignore list
00075         * (saving it if necessary).  We also catch * as a special case in a
00076         * global ignore file as an optimization
00077         */
00078         if ((!*(ign+1) || isspace (*(ign+1))) && (*ign == '!' || *ign == '*'))
00079         {
00080             if (!hold)
00081             {
00082                 /* permanently reset the ignore list */
00083                 ignlist.erase(ignlist.begin(), ignlist.end());
00084
00085                 /* if we are doing a '!', continue; otherwise add the '*' */
00086                 if (*ign == '!')
00087                 {
00088                     continue;
00089                 }
00090             }
00091             else if (*ign == '!')
00092             {
00093                 /* temporarily reset the ignore list */
00094                 if (ign_hold >= 0)
00095                 {
00096                     ignlist.erase(ignlist.begin(), ignlist.begin() + ign_hold);
00097                     ign_hold = -1;
00098                 }
00099                 continue;
00100             }
00101         }
00102
00103         /* find the end of this token */
00104         for (mark = ign; *mark && !isspace (*mark); mark++)
00105             /* do nothing */ ;
00106
00107         save = *mark;
00108         *mark = '\0';
00109
00110         ignlist.push_back(CStr(ign));
00111
00112         *mark = save;
00113         if (save)
00114             ign = mark;
00115         else
00116             ign = mark - 1;
00117     }
00118 }
00119
00120
00121 // Read .cvsignore file and append entries to ignlist
00122 static bool ReadIgnoredFile(const char* fileName, std::vector<CStr> & ignlist)
00123 {
00124     FILE *fp;
00125     char *line = NULL;
00126     size_t line_allocated = 0;
00127
00128     fp = fopen(fileName, "r");
00129     if(fp != 0L)
00130     {
00131         while (getline (&line, &line_allocated, fp) >= 0)
00132             ign_add (line, false, ignlist);
00133
00134         if (ferror (fp))
00135             cvs_err("Problem while parsing '%s'", fileName);
00136
00137         fclose (fp);
00138     }
00139
00140     if(line != 0L)
00141         free (line);
00142
00143     return(fp != 0L);
00144 }
00145
00146
00147 void BuildIgnoredList(std::vector<CStr> & ignlist, const char *path)
00148 {
00149     ignlist.erase(ignlist.begin(), ignlist.end());
00150
00151     static std::vector<CStr> deflist;
00152     static bool deflistparsed = false;
00153
00154     if(!deflistparsed)
00155     {
00156 #ifdef macintosh
00157         FSSpec theFolder;
00158         Str255 aPath;
00159
00160         if(MacGetPrefsFolder(theFolder, aPath) == noErr)
00161         {
00162             CStr home(aPath);
00163 #else /* !macintosh */
00164         if(gCvsPrefs.Home() != 0L)
00165         {
00166             CStr home(gCvsPrefs.Home());
00167 #endif /* !macintosh */
00168             struct stat sb;
00169             if (stat(home, &sb) != 0 || !S_ISDIR(sb.st_mode))
00170             {
00171                 cvs_err("Warning : unable to access your HOME path '%s'\n", gCvsPrefs.Home());
00172                 cvs_err("          ~/.cvsignore will not be read\n");
00173             }
00174             if(!home.empty() && !home.endsWith(kPathDelimiter))
00175                 home << kPathDelimiter;
00176             home << ".cvsignore";
00177
00178             // Read .cvsignore file from HOME directory.
00179             // If HOME dir doesn't have such a file then
00180             // try to read global file from executable path.
00181             if(ReadIgnoredFile(home, deflist) == false)
00182             {
00183                 CStr appPath;
00184
00185 #ifdef WIN32
00186                 ((CWincvsApp *)AfxGetApp())->GetAppPath(appPath);
00187 #elif defined(qUnix)
00188                 // Unix version uses only .cvsignore file in HOME dir
00189 #else
00190 #   ifdef qMacCvsPP
00191                 appPath = CMacCvsApp::GetAppPath();
00192 #   endif /* qMacCvsPP */
00193 #endif
00194                 if(!appPath.empty())
00195                 {
00196                     if(!appPath.endsWith(kPathDelimiter))
00197                         appPath << kPathDelimiter;
00198
00199                     appPath << ".cvsignore";
00200
00201                     ReadIgnoredFile(appPath, deflist);
00202                 }
00203             }
00204         }
00205         deflistparsed = true;
00206     }
00207     else
00208         ignlist = deflist;
00209
00210 #if qUnix
00211     // from cvs/src/ignore.c
00212     CStr ign_default(". .. core RCSLOG tags TAGS RCS SCCS .make.state\
00213  .nse_depinfo #* .#* cvslog.* ,* CVS CVS.adm .del-* *.a *.olb *.o *.obj\
00214  *.so *.Z *~ *.old *.elc *.ln *.bak *.BAK *.orig *.rej *.exe _$* *$");
00215     ign_add (ign_default, false, ignlist);
00216 #endif
00217
00218     UStr ignPath(path);
00219     if(!ignPath.endsWith(kPathDelimiter))
00220         ignPath << kPathDelimiter;
00221     ignPath << ".cvsignore";
00222
00223     // load the file from the current source directory
00224     ReadIgnoredFile(ignPath, ignlist);
00225 }
00226
00227 bool MatchIgnoredList(const char * filename, const std::vector<CStr> & ignlist)
00228 {
00229     std::vector<CStr>::const_iterator i;
00230     for(i = ignlist.begin(); i != ignlist.end(); ++i)
00231     {
00232         if(fnmatch (*i, filename, 0) == 0)
00233             return true;
00234     }
00235     return false;
00236 }
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsIgnore.h Source File

common/CvsIgnore.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- June 1998
00019  */
00020
00021 /*
00022  * CvsIgnore.h --- parse the .cvsignore
00023  */
00024
00025 #ifndef CVSIGNORE_H
00026 #define CVSIGNORE_H
00027
00028 #include <vector>
00029 #include "CPStr.h"
00030
00031 #ifdef _MSC_VER
00032     using namespace std;
00033 #endif
00034
00035 void BuildIgnoredList(std::vector<CStr> & ignlist, const char *path);
00036     // open and parse the .cvsignore in the current folder
00037
00038 bool MatchIgnoredList(const char * filename, const std::vector<CStr> & ignlist);
00039     // tells if the name match the .cvsignore
00040
00041 #endif /* CVSIGNORE_H */
Generated on Sun Oct 21 12:41:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsPrefs.cpp Source File

common/CvsPrefs.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * CvsPrefs.cpp --- class to handle CVS settings
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #include <string.h>
00028 #include <stdlib.h>
00029 #include "CvsPrefs.h"
00030 #include "Authen.h"
00031 #include "AppConsole.h"
00032 #include "CvsArgs.h"
00033 #include "MultiString.h"
00034 #include "FileTraversal.h"
00035
00036 #ifdef macintosh
00037 #   define PCVS "\pCVSROOT"
00038 #   include <Resources.h>
00039 #   include <Folders.h>
00040 #   include <Errors.h>
00041 #   include <TextUtils.h>
00042 #   include "VolsPaths.h"
00043 #   include "MacMisc.h"
00044 #   include "AppGlue.h"
00045 #endif /* macintosh */
00046
00047 #ifdef HAVE_UNISTD_H
00048 #   include <unistd.h>
00049 #endif
00050
00051 #ifdef HAVE_PWD_H
00052 #   include <pwd.h>
00053 #endif
00054
00055 #ifdef WIN32
00056 #   include <process.h>
00057 #   include "WinCvsBrowser.h"
00058 #   include "wincvs.h"
00059 #   include "TextBinary.h"
00060 #   ifdef _DEBUG
00061 #   define new DEBUG_NEW
00062 #   undef THIS_FILE
00063     static char THIS_FILE[] = __FILE__;
00064 #   endif
00065 #endif /* WIN32 */
00066
00067 #ifdef qMacCvsPP
00068 #   include "GUSIInternal.h"
00069 #   include "GUSIFileSpec.h"
00070 #   include "MacCvsApp.h"
00071 #   include <UProcess.h>
00072 #endif
00073
00074 #if qUnix
00075 #   include "UCvsApp.h"
00076 #   include "UCvsFolders.h"
00077 #endif
00078
00079 CvsPrefs gCvsPrefs;
00080
00081 static CPersistentBool gCheckoutRO("P_CheckoutRO", true, kAddSettings);
00082 static CPersistentBool gZ9Option("P_Z9Option", false, kAddSettings);
00083 static CPersistentBool gPruneOption("P_PruneOption", true, kAddSettings);
00084 static CPersistentBool gQuietOption("P_QuietOption", false);
00085 static CPersistentInt gIsoConvert("P_NIsoConvert", ISO8559_none, kAddSettings);
00086 static CPersistentBool gICTextOption("P_ICTextOption", false, kAddSettings);
00087 static CPersistentBool gAddBinControl("P_AddBinControl", true);
00088 static CPersistentBool gUseViewerAlways("P_UseViewerAlways", false, kAddSettings);
00089 static CPersistentInt gMacBinEncoding("P_NMacBinEncoding", MAC_HQX, kAddSettings);
00090 static CPersistentInt gUseShell("P_UseShell", SHELL_TCL);
00091
00092 static PCPStr gCvsroot("P_Cvsroot");
00093 static PCPStr gCvsroot1("P_Cvsroot1");
00094 static PCPStr gCvsroot2("P_Cvsroot2");
00095 static PCPStr gCvsroot3("P_Cvsroot3");
00096 static PCPStr gCvsroot4("P_Cvsroot4");
00097 static PCPStr gCvsroot5("P_Cvsroot5");
00098 static PCPStr gCvsroot6("P_Cvsroot6");
00099 static PCPStr gCvsroot7("P_Cvsroot7");
00100 static PCPStr gCvsroot8("P_Cvsroot8");
00101 static PCPStr gCvsroot9("P_Cvsroot9");
00102 static PCPStr gCvsroot10("P_Cvsroot10");
00103 static PCPStr gCvsroot11("P_Cvsroot11");
00104 static PCPStr gCvsroot12("P_Cvsroot12");
00105 static PCPStr gCvsroot13("P_Cvsroot13");
00106 static PCPStr gCvsroot14("P_Cvsroot14");
00107 static PCPStr gCvsroot15("P_Cvsroot15");
00108 static PCPStr gCvsroot16("P_Cvsroot16");
00109 static PCPStr gCvsroot17("P_Cvsroot17");
00110 static PCPStr gCvsroot18("P_Cvsroot18");
00111 static PCPStr gCvsroot19("P_Cvsroot19");
00112 static PCPStr gCvsroot20("P_Cvsroot20");
00113
00114 static CPersistentInt gKserverPort("P_KserverPort", -1, kAddSettings);
00115 static CPersistentInt gPserverPort("P_PserverPort", -1, kAddSettings);
00116 static CPersistentInt gRhostPort("P_RhostPort", -1, kAddSettings);
00117 static PCPStr gServerName("P_ServerName", 0L, kAddSettings);
00118 static PCStr gRshName("P_RshName", 0L, kAddSettings);
00119 #ifndef qUnix
00120 static PCStr gHome("P_Home", 0L, kAddSettings);
00121 #endif /* !qUnix */
00122 #ifdef qUnix
00123 static PCStr gViewer("P_Viewer", "emacs"); // not vi ;-)
00124 #else
00125 static PCStr gViewer("P_Viewer", "Notepad");
00126 #endif
00127 static PCStr gHelper("P_Helper", "netscape");
00128 static PCStr gBrowser("P_Browser", "gmc");
00129 #ifdef qUnix
00130 static PCStr gExtdiff("P_Extdiff", "emacs");
00131 #else
00132 static PCStr gExtdiff("P_Extdiff", "");
00133 #endif
00134 static CPersistentBool gDirtySupport("P_DirtySupport", true, kAddSettings);
00135 static CPersistentBool gAlwaysUseCvsroot("P_AlwaysUseCvsroot", false, kAddSettings);
00136 static CPersistentInt gLogoutTimeOut("P_LogoutTimeOut", 0);
00137 static PCStr gProxyHost("P_ProxyHost", "www.mydomain", kAddSettings);
00138 static CPersistentInt gProxyPort("P_ProxyPort", 8888, kAddSettings);
00139 static CPersistentBool gUseProxy("P_UseProxy", false, kAddSettings);
00140 static CPersistentBool gUnixLF("P_UnixLF", false, kAddSettings);
00141 static CPersistentInt gZLevel("P_ZLevel", 9, kAddSettings);
00142 static CPersistentInt gCvsVersion("P_CvsVersion", 0, kAddSettings);
00143 static CPersistentBool gCvsConsole("P_CvsConsole", false, kAddSettings);
00144 static CPersistentInt gWordWrapLogMsg("P_WordWrapLogMsg", 0, kAddSettings);
00145 static PCStr gLastWorkingDir("P_LastWorkingDir", 0L, kAddSettings);
00146
00147 static CPersistentBool gHideCommandDlgUpdate("P_HideCommandDlgUpdate", false);
00148 static CPersistentBool gHideCommandDlgDiff("P_HideCommandDlgDiff", false);
00149 static CPersistentBool gHideCommandDlgLog("P_HideCommandDlgLog", false);
00150 static CPersistentBool gHideCommandDlgGraph("P_HideCommandDlgGraph", false);
00151 static CPersistentBool gHideCommandDlgAnnotate("P_HideCommandDlgAnnotate", false);
00152 static CPersistentBool gHideCommandDlgUseShift("P_HideCommandDlgUseShift", true);
00153
00154 bool CvsPrefs::CheckoutRO(void) const {return gCheckoutRO;}
00155 bool CvsPrefs::Z9Option(void) const
00156 {
00157 #ifdef macintosh
00158     // because of the problem with LSH...
00159     return true;
00160 #endif
00161     return gZ9Option;
00162 }
00163 bool CvsPrefs::PruneOption(void) const {return gPruneOption;}
00164 bool CvsPrefs::QuietOption(void) const {return gQuietOption;}
00165 ISO8559 CvsPrefs::IsoConvert(void) const {return (ISO8559)(int)gIsoConvert;}
00166 bool CvsPrefs::ICTextOption(void) const {return gICTextOption;}
00167 bool CvsPrefs::AddControl(void) const {return gAddBinControl;}
00168 bool CvsPrefs::UseViewerAlways(void) const {return gUseViewerAlways;}
00169 MACENCODING CvsPrefs::MacBinEncoding(void) const {return (MACENCODING)(int)gMacBinEncoding;}
00170 int CvsPrefs::KserverPort(void) const {return gKserverPort;}
00171 int CvsPrefs::PserverPort(void) const {return gPserverPort;}
00172 int CvsPrefs::RhostPort(void) const {return gRhostPort;}
00173
00174 static CKeyString gWhichCvs(10, "P_WhichCvs");
00175
00176 const char * CvsPrefs::ServerName(void) const
00177 {
00178     return gServerName.empty() ? 0L : (const char *)gServerName;
00179 }
00180 const char * CvsPrefs::RshName(void) const
00181 {
00182     return gRshName.empty() ? 0L : (const char *)gRshName;
00183 }
00184 const char * CvsPrefs::Home(void) const
00185 {
00186 #ifndef qUnix
00187 #   ifdef WIN32
00188     // Windows 98 doesn't like C:\/.cvspass
00189     if(!gHome.empty() && gHome.endsWith(kPathDelimiter))
00190     {
00191         gHome[gHome.length() - 1] = '\0';
00192     }
00193 #   endif
00194     return gHome.empty() ? 0L : (const char *)gHome;
00195 #else /* qUnix */
00196     static CStr home;
00197     if (!home.empty())
00198         return home;
00199
00200     char *env = getenv ("HOME");
00201     struct passwd *pw;
00202     if (env)
00203         home = env;
00204     else if ((pw = (struct passwd *) getpwuid (getuid ()))
00205              && pw->pw_dir)
00206         home = pw->pw_dir;
00207     else
00208         return 0L;
00209
00210     return home;
00211 #endif /* qUnix */
00212 }
00213 const char * CvsPrefs::Viewer(void) const
00214 {
00215     return gViewer.empty() ? 0L : (const char *)gViewer;
00216 }
00217 const char * CvsPrefs::Helper(void) const
00218 {
00219     return gHelper.empty() ? 0L : (const char *)gHelper;
00220 }
00221 const char * CvsPrefs::Browser(void) const
00222 {
00223     return gBrowser.empty() ? 0L : (const char *)gBrowser;
00224 }
00225 const char * CvsPrefs::ExtDiff(void) const
00226 {
00227     return gExtdiff.empty() ? 0L : (const char *)gExtdiff;
00228 }
00229 bool CvsPrefs::DirtySupport(void) const {return gDirtySupport;}
00230 int CvsPrefs::LogoutTimeOut(void) const {return gLogoutTimeOut;}
00231 bool CvsPrefs::AlwaysUseCvsroot(void) const {return gAlwaysUseCvsroot;}
00232 const char *CvsPrefs::ProxyHost(void) const {return gProxyHost;}
00233 int CvsPrefs::ProxyPort(void) const {return gProxyPort;}
00234 bool CvsPrefs::UseProxy(void) const {return gUseProxy;}
00235 bool CvsPrefs::UnixLF(void) const {return gUnixLF;}
00236 int CvsPrefs::ZLevel(void) const {return gZLevel;}
00237 int CvsPrefs::CvsVersion(void) const {return gCvsVersion;}
00238 bool CvsPrefs::CvsConsole(void) const {return gCvsConsole;}
00239 int CvsPrefs::WordWrapLogMsg(void) const {return gWordWrapLogMsg;}
00240 SHELL_KIND CvsPrefs::GetUseShell(void) const {return (SHELL_KIND)(int)gUseShell;}
00241
00242 /* Return the current working dir (last working dir).   */
00243 /* This directory is automatically selected when WinCVS */
00244 /* is opened the next time. */
00245 const char * CvsPrefs::LastWorkingDir(void) const
00246 {
00247     return gLastWorkingDir.empty() ? 0L : (const char *)gLastWorkingDir;
00248 }
00249
00250 bool CvsPrefs::HideCommandDlgUpdate(void) const {return gHideCommandDlgUpdate;}
00251 bool CvsPrefs::HideCommandDlgDiff(void) const {return gHideCommandDlgDiff;}
00252 bool CvsPrefs::HideCommandDlgLog(void) const {return gHideCommandDlgLog;}
00253 bool CvsPrefs::HideCommandDlgGraph(void) const {return gHideCommandDlgGraph;}
00254 bool CvsPrefs::HideCommandDlgAnnotate(void) const {return gHideCommandDlgAnnotate;}
00255 bool CvsPrefs::HideCommandDlgUseShift(void) const {return gHideCommandDlgUseShift;}
00256
00257 void CvsPrefs::SetCheckoutRO(bool newState) {gCheckoutRO = newState;}
00258 void CvsPrefs::SetZ9Option(bool newState) {gZ9Option = newState;}
00259 void CvsPrefs::SetPruneOption(bool newState) {gPruneOption = newState;}
00260 void CvsPrefs::SetQuietOption(bool newState) {gQuietOption = newState;}
00261 void CvsPrefs::SetIsoConvert(ISO8559 newState) {gIsoConvert = (int)newState;}
00262 void CvsPrefs::SetICTextOption(bool newState) {gICTextOption = newState;}
00263 void CvsPrefs::SetAddControl(bool newState) {gAddBinControl = newState;}
00264 void CvsPrefs::SetUseViewerAlways(bool newState) {gUseViewerAlways = newState;}
00265 void CvsPrefs::SetMacBinEncoding(MACENCODING newState) {gMacBinEncoding = (int)newState;}
00266 void CvsPrefs::SetKserverPort(int newState) {gKserverPort = newState;}
00267 void CvsPrefs::SetPserverPort(int newState) {gPserverPort = newState;}
00268 void CvsPrefs::SetRhostPort(int newState) {gRhostPort = newState;}
00269 void CvsPrefs::SetServerName(const char *newservername) {gServerName = newservername;}
00270 void CvsPrefs::SetRshName(const char *newrshname) {gRshName = newrshname;}
00271 void CvsPrefs::SetHome(const char *newhome)
00272 {
00273 #ifndef qUnix
00274     gHome = newhome;
00275 #   ifdef WIN32
00276     // Windows 98 doesn't like C:\/.cvspass
00277     if(!gHome.empty() && gHome.endsWith(kPathDelimiter))
00278     {
00279         gHome[gHome.length() - 1] = '\0';
00280     }
00281 #   endif
00282 #endif /* !qUnix */
00283 }
00284 void CvsPrefs::SetViewer(const char *newviewer) {gViewer = newviewer;}
00285 void CvsPrefs::SetBrowser(const char *newviewer) {gBrowser = newviewer;}
00286 void CvsPrefs::SetHelper(const char *newviewer) {gHelper = newviewer;}
00287 void CvsPrefs::SetExtDiff(const char *newdiff) {gExtdiff = newdiff;}
00288 void CvsPrefs::SetDirtySupport(bool newState) {gDirtySupport = newState;}
00289 void CvsPrefs::SetLogoutTimeOut(int newTimeout) {gLogoutTimeOut = newTimeout;}
00290 void CvsPrefs::SetAlwaysUseCvsroot(bool newState) {gAlwaysUseCvsroot = newState;}
00291 void CvsPrefs::SetUseProxy(bool useit) {gUseProxy = useit;}
00292 void CvsPrefs::SetUnixLF(bool useit) {gUnixLF = useit;}
00293 void CvsPrefs::SetZLevel(int level) {gZLevel = level;}
00294 void CvsPrefs::SetProxyHost(const char *newhost) {gProxyHost = newhost;}
00295 void CvsPrefs::SetProxyPort(int newport) {gProxyPort = newport;}
00296 void CvsPrefs::SetCvsVersion(int vers) {gCvsVersion = vers;}
00297 void CvsPrefs::SetCvsConsole(bool console) {gCvsConsole = console;}
00298 void CvsPrefs::SetWordWrapLogMsg(int wordwrap) {gWordWrapLogMsg = wordwrap;}
00299 void CvsPrefs::SetLastWorkingDir(const char *workdir) {gLastWorkingDir = workdir;}
00300 void CvsPrefs::SetUseShell(SHELL_KIND shell) {gUseShell = shell;}
00301
00302 void CvsPrefs::SetHideCommandDlgUpdate(bool newState) {gHideCommandDlgUpdate = newState;}
00303 void CvsPrefs::SetHideCommandDlgDiff(bool newState) {gHideCommandDlgDiff = newState;}
00304 void CvsPrefs::SetHideCommandDlgLog(bool newState) {gHideCommandDlgLog = newState;}
00305 void CvsPrefs::SetHideCommandDlgGraph(bool newState) {gHideCommandDlgGraph = newState;}
00306 void CvsPrefs::SetHideCommandDlgAnnotate(bool newState) {gHideCommandDlgAnnotate = newState;}
00307 void CvsPrefs::SetHideCommandDlgUseShift(bool newState) {gHideCommandDlgUseShift = newState;}
00308
00309 bool CvsPrefs::empty(void) const
00310 {
00311     return gCvsroot.empty();
00312 }
00313
00314 int CvsPrefs::length(void) const
00315 {
00316     return gCvsroot.length();
00317 }
00318
00319 CvsPrefs::operator const char *() const
00320 {
00321     return (const char *)gCvsroot;
00322 }
00323
00324 CvsPrefs::operator const unsigned char *() const
00325 {
00326     return (const unsigned char *)gCvsroot;
00327 }
00328
00329 const char *CvsPrefs::operator=(const char *newstr)
00330 {
00331     return gCvsroot = newstr;
00332 }
00333
00334 const unsigned char *CvsPrefs::operator=(const unsigned char *newstr)
00335 {
00336     return gCvsroot = newstr;
00337 }
00338
00339 CPStr & CvsPrefs::get_cvsroot_list(int entry)
00340 {
00341     switch(entry)
00342     {
00343     case 0:
00344         return gCvsroot1;
00345         break;
00346     case 1:
00347         return gCvsroot2;
00348         break;
00349     case 2:
00350         return gCvsroot3;
00351         break;
00352     case 3:
00353         return gCvsroot4;
00354         break;
00355     case 4:
00356         return gCvsroot5;
00357         break;
00358         break;
00359     case 5:
00360         return gCvsroot6;
00361         break;
00362     case 6:
00363         return gCvsroot7;
00364         break;
00365     case 7:
00366         return gCvsroot8;
00367         break;
00368     case 8:
00369         return gCvsroot9;
00370         break;
00371     case 9:
00372         return gCvsroot10;
00373         break;
00374     case 10:
00375         return gCvsroot11;
00376         break;
00377     case 11:
00378         return gCvsroot12;
00379         break;
00380     case 12:
00381         return gCvsroot13;
00382         break;
00383     case 13:
00384         return gCvsroot14;
00385         break;
00386     case 14:
00387         return gCvsroot15;
00388         break;
00389     case 15:
00390         return gCvsroot16;
00391         break;
00392     case 16:
00393         return gCvsroot17;
00394         break;
00395     case 17:
00396         return gCvsroot18;
00397         break;
00398     case 18:
00399         return gCvsroot19;
00400         break;
00401     case 19:
00402         return gCvsroot20;
00403         break;
00404     }
00405     return gCvsroot1;
00406 }
00407
00408 bool CvsPrefs::has_cvsroot_in_list(const char *cvsroot, int & entry)
00409 {
00410     for(int i = 0; i < NUM_CVSROOT; i++)
00411     {
00412         CPStr & str = get_cvsroot_list(i);
00413         if(str.empty())
00414             continue;
00415         if(strcmp(str, cvsroot) == 0)
00416         {
00417             entry = i;
00418             return true;
00419         }
00420     }
00421     return false;
00422 }
00423
00424 void CvsPrefs::insert_cvsroot_in_list(const char *cvsroot)
00425 {
00426     int entry;
00427
00428     if(has_cvsroot_in_list(cvsroot, entry))
00429     {
00430         // move to the first entry
00431         CPStr tmp;
00432         tmp = get_cvsroot_list(0);
00433         get_cvsroot_list(0) = get_cvsroot_list(entry);
00434         get_cvsroot_list(entry) = tmp;
00435     }
00436     else
00437     {
00438         // push back the entry
00439         for(int i = (NUM_CVSROOT - 1); i >= 1; i--)
00440         {
00441             get_cvsroot_list(i) = get_cvsroot_list(i - 1);
00442         }
00443         get_cvsroot_list(0) = cvsroot;
00444     }
00445 }
00446
00447 void CvsPrefs::flush_list(void)
00448 {
00449     for(int i = 0; i < NUM_CVSROOT; i++)
00450     {
00451         get_cvsroot_list(i) = "";
00452     }
00453 }
00454
00455 void CvsPrefs::save(void)
00456 {
00457     if(empty())
00458         return;
00459
00460     bool needSave = CPersistent::NeedSave();
00461     bool needSaveSettings = CPersistent::NeedSave(true);
00462     if(!needSave)
00463         return;
00464
00465     // update the CVSROOT list
00466     insert_cvsroot_in_list((const char *)*this);
00467
00468     CPersistent::SaveAll();
00469
00470     if(!needSaveSettings)
00471         return;
00472
00473 #ifdef WIN32
00474     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00475     SavePersistentSettings(app->GetBrowserView()->GetRoot());
00476 #endif
00477 #ifdef qMacCvsPP
00478     CMacCvsApp::SavePersistentSettings();
00479 #endif /* qMacCvsPP */
00480 #if qUnix
00481     UCvsFolders *browser = UCvsApp::gApp->GetBrowserView();
00482     if(browser != 0L && browser->GetRoot() != 0L)
00483         SavePersistentSettings(browser->GetRoot());
00484 #endif
00485 }
00486
00487 void CvsPrefs::load(void)
00488 {
00489     // flush the CVSROOT list, it will be filled later
00490     flush_list();
00491
00492     bool loaded = CPersistent::LoadAll();
00493
00494     if( loaded )
00495         return;
00496
00497     // backward compatibility
00498 #ifdef WIN32
00499     UINT value;
00500
00501     CString cstr = AfxGetApp()->GetProfileString(PROFILE_NAME, "CVSROOT");
00502     if(!cstr.IsEmpty())
00503         *this = (const char *)cstr;
00504
00505     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "CheckoutRO", -1)) != -1)
00506         SetCheckoutRO(value ? 1 : 0);
00507     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "Z9Option", -1)) != -1)
00508         SetZ9Option(value ? 1 : 0);
00509     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "QuietOption", -1)) != -1)
00510         SetQuietOption(value ? 1 : 0);
00511     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "PruneOption", -1)) != -1)
00512         SetPruneOption(value ? 1 : 0);
00513     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "Authentication", -1)) != -1)
00514         gAuthen.setkind((AuthenKind)value);
00515     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "AddControl", -1)) != -1)
00516         SetAddControl(value ? 1 : 0);
00517
00518     char tmp[20];
00519     for(int i = 0; i < NUM_CVSROOT; i++)
00520     {
00521         sprintf(tmp, "CVSROOTLIST%d", i);
00522         cstr = AfxGetApp()->GetProfileString(PROFILE_NAME, tmp);
00523         if(!cstr.IsEmpty())
00524             get_cvsroot_list(i) = (const char *)cstr;
00525     }
00526 #endif /* WIN32 */
00527
00528 #if defined(macintosh) && !TARGET_API_MAC_CARBON
00529     FSSpec theFolder;
00530     short FRef;
00531     Handle hdl;
00532     OSErr err;
00533     Str255 thePath;
00534
00535     err = MacGetPrefsFolder(theFolder, thePath);
00536     if(err != noErr)
00537         return;
00538
00539     err = HSetVol(NULL, theFolder.vRefNum, theFolder.parID);
00540     FRef = OpenResFile(PCVS);
00541     if(FRef < 0)
00542         return;
00543
00544     hdl = GetResource('CVS ', 128);
00545     if(hdl != NULL)
00546     {
00547         Str255 str;
00548         HLock(hdl);
00549         BlockMove(*hdl, str, (*hdl)[0] + 1);
00550         str[str[0] + 1] = '\0';
00551         *this = (const char *)str + 1;
00552         HUnlock(hdl);
00553     }
00554     hdl = GetResource('CHRO', 128);
00555     if(hdl != NULL)
00556     {
00557         SetCheckoutRO(**hdl);
00558     }
00559     hdl = GetResource('Z9OP', 128);
00560     if(hdl != NULL)
00561     {
00562         SetZ9Option(**hdl);
00563     }
00564     hdl = GetResource('QUIE', 128);
00565     if(hdl != NULL)
00566     {
00567         SetQuietOption(**hdl);
00568     }
00569     hdl = GetResource('POPT', 128);
00570     if(hdl != NULL)
00571     {
00572         SetPruneOption(**hdl);
00573     }
00574     hdl = GetResource('AUTH', 128);
00575     if(hdl != NULL)
00576     {
00577         gAuthen.setkind((AuthenKind)**hdl);
00578     }
00579     hdl = GetResource('ISOC', 128);
00580     if(hdl != NULL)
00581     {
00582         SetIsoConvert((ISO8559)**hdl);
00583     }
00584     hdl = GetResource('ICTO', 128);
00585     if(hdl != NULL)
00586     {
00587         SetICTextOption(**hdl);
00588     }
00589     hdl = GetResource('ACTL', 128);
00590     if(hdl != NULL)
00591     {
00592         SetAddControl(**hdl);
00593     }
00594
00595     for(int i = 0; i < NUM_CVSROOT; i++)
00596     {
00597         hdl = GetResource('CROL', 128 + i);
00598         if(hdl != NULL)
00599         {
00600             HLock(hdl);
00601             get_cvsroot_list(i) = (const char *)*hdl;
00602             HUnlock(hdl);
00603         }
00604     }
00605     CloseResFile (FRef);
00606 #endif /* macintosh && !TARGET_API_MAC_CARBON */
00607 }
00608
00609 #ifdef WIN32
00610 kWinVersion CvsPrefs::WhichVersion()
00611 {
00612     DWORD dwVersion = GetVersion(); // Get major and minor version numbers of Windows
00613     DWORD dwWindowsMajorVersion =  (DWORD)(LOBYTE(LOWORD(dwVersion)));
00614     DWORD dwWindowsMinorVersion =  (DWORD)(HIBYTE(LOWORD(dwVersion)));
00615     DWORD dwBuild;
00616
00617     // Get build numbers for Windows NT or Win32s
00618     if (dwVersion < 0x80000000)                // Windows NT
00619     {
00620         dwBuild = (DWORD)(HIWORD(dwVersion));
00621         return dwWindowsMajorVersion == 3 ? kWinNT35 : kWinNT4;
00622     }
00623     else if (dwWindowsMajorVersion < 4)        // Win16s
00624     {
00625         dwBuild = (DWORD)(HIWORD(dwVersion));
00626         return kWin16;
00627     }
00628
00629     // Windows 95 -- No build numbers provided    dwBuild =  0;
00630     return kWin32;
00631 }
00632 #endif /* WIN32 */
00633
00634
00635 //
00636 // TODO: If we sometimes implement multi-threaded CVS/TCL macro
00637 // execution then we have to implement thread synchronization in
00638 // IsXXXRunning and SetXXXRunning methods.
00639 //
00640 // NOTE! IsCvsRunning and SetCvsRunning methods are not yet
00641 // used in Mac/Unix/WinCVS. Each of these version have had
00642 // their own app.gCvsRunning variable. I haven't cleaned up
00643 // the code and changed them to use this "one and only"
00644 // CvsRunning methods.
00645 //
00646 bool CvsPrefs::IsCvsRunning(void) const
00647 {
00648     return(fCvsRunningCounter > 0);
00649 }
00650
00651 int  CvsPrefs::SetCvsRunning(bool launched)
00652 {
00653     if(launched)
00654         fCvsRunningCounter++;
00655     else if(fCvsRunningCounter > 0)
00656         fCvsRunningCounter--;
00657
00658     return fCvsRunningCounter;
00659 }
00660
00661 bool CvsPrefs::IsTclFileRunning(void) const
00662 {
00663     return(fTclFileRunningCounter > 0);
00664 }
00665
00666 int  CvsPrefs::SetTclFileRunning(bool launched)
00667 {
00668     if(launched)
00669         fTclFileRunningCounter++;
00670     else if(fTclFileRunningCounter > 0)
00671         fTclFileRunningCounter--;
00672
00673     return fTclFileRunningCounter;
00674 }
00675
00676
00677 bool LaunchDiff(const char *f1, const char *f2)
00678 {
00679 #ifdef qMacCvsPP
00680     const   OSType      kBBEditDiffCreatorCode  = FOUR_CHAR_CODE('BBds');
00681     const   OSType      kResourcererCreatorCode = FOUR_CHAR_CODE('Doug');
00682
00683     //  Resourcerer's Compare suite
00684     const   DescType    kAECompareClass = 'Comp';
00685     const   DescType    kAECompareEvent = 'Comp';
00686         const   DescType    keyNewer        = 'kNew';
00687         const   DescType    keyOlder        = 'kOld';
00688         const   DescType    keyShowDiff     = 'kShD';
00689         const   DescType    keyReturnDiff   = 'kRtD';
00690
00691     OSErr               e = noErr;
00692
00693     try {
00694         //  Convert to file specs
00695         Boolean             inShowDiffs = true;
00696         FSSpec              spec1 = GUSIFileSpec (f1);
00697         FSSpec              spec2 = GUSIFileSpec (f2);
00698
00699         //  Find the file type
00700         FInfo   info;
00701         e = ::FSpGetFInfo (&spec2, &info);
00702         ThrowIfOSErr_(e);
00703
00704         //  Decide on the application
00705         OSType              applCreator = FOUR_CHAR_CODE('????');
00706         switch (info.fdType) {
00707             case 'TEXT':
00708                 applCreator = kBBEditDiffCreatorCode;
00709                 break;
00710
00711             default:
00712                 applCreator = kResourcererCreatorCode;
00713                 break;
00714             } // switch
00715
00716         //  Try to launch it
00717         LaunchFlags         launchFlags = launchContinue + launchNoFileFlags;
00718         OSType              applType = FOUR_CHAR_CODE('APPL');
00719         FSSpec              applSpec;
00720         ProcessSerialNumber applPSN;
00721         if (!UProcess::Launch (applCreator, applType, launchFlags, &applSpec, &applPSN)) Throw_(fnfErr);
00722
00723         //  Now, diff the files.  We use the Resourcerer suite and a BBEdit glue applet.
00724             //  Create the parameters
00725         StAEDescriptor  newerDesc (spec1);
00726         StAEDescriptor  olderDesc (spec2);
00727         StAEDescriptor  showDesc (inShowDiffs);
00728
00729             //  Create the event
00730         StAEDescriptor  addressDesc (typeProcessSerialNumber, &applPSN, sizeof (applPSN));
00731
00732         StAEDescriptor  diffEvent;
00733         e = ::AECreateAppleEvent (kAECompareClass, kAECompareEvent, addressDesc, kAutoGenerateReturnID, kAnyTransactionID, diffEvent);
00734         ThrowIfOSErr_(e);
00735
00736             //  Add the parameters
00737         e = ::AEPutParamDesc (diffEvent, keyNewer, newerDesc);
00738         ThrowIfOSErr_(e);
00739         e = ::AEPutParamDesc (diffEvent, keyOlder, olderDesc);
00740         ThrowIfOSErr_(e);
00741         e = ::AEPutParamDesc (diffEvent, keyShowDiff, showDesc);
00742         ThrowIfOSErr_(e);
00743
00744             //  Send the event
00745         UAppleEventsMgr::SendAppleEvent (diffEvent);
00746
00747         return true;
00748         } // try
00749
00750     catch (LException ex) {
00751         } // catch
00752 #endif
00753     if(gCvsPrefs.ExtDiff() == 0L)
00754     {
00755         cvs_err("The external diff program is not defined,\n");
00756         cvs_err("you need to set it in the preferences dialog.\n");
00757         return false;
00758     }
00759 #ifdef WIN32
00760     CString args;
00761     CStr program, file1, file2;
00762     if(strchr(gCvsPrefs.ExtDiff(), ' ') != 0L)
00763     {
00764         program << '\"';
00765         program << gCvsPrefs.ExtDiff();
00766         program << '\"';
00767     }
00768     else
00769         program = gCvsPrefs.ExtDiff();
00770
00771     if(strchr(f1, ' ') != 0L)
00772     {
00773         file1 << '\"';
00774         file1 << f1;
00775         file1 << '\"';
00776     }
00777     else
00778         file1 = f1;
00779
00780     if(strchr(f2, ' ') != 0L)
00781     {
00782         file2 << '\"';
00783         file2 << f2;
00784         file2 << '\"';
00785     }
00786     else
00787         file2 = f2;
00788
00789     args += file1;
00790     args += " ";
00791     args += file2;
00792
00793     HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), NULL, gCvsPrefs.ExtDiff(), args,
00794                         NULL, SW_SHOWDEFAULT);
00795
00796     if((UINT)hInst < 32)
00797     {
00798         // ExtDiff app was not found. Let's try to execute it from
00799         // the application path. However, this is done only when ExtDiff
00800         // value doesn't contain absolute path ("c:\subdir\" or "\subdir\").
00801         if(strchr(gCvsPrefs.ExtDiff(), ':') == 0L && (gCvsPrefs.ExtDiff()[0]) != '\\')
00802         {
00803             CStr appPath;
00804
00805             ((CWincvsApp *)AfxGetApp())->GetAppPath(appPath);
00806             if(!appPath.endsWith(kPathDelimiter))
00807                 appPath << kPathDelimiter;
00808
00809             appPath << gCvsPrefs.ExtDiff();
00810
00811             hInst = ShellExecute(*AfxGetMainWnd(), NULL, appPath, args,
00812                     NULL, SW_SHOWDEFAULT);
00813         }
00814     }
00815
00816     if((UINT)hInst < 32)
00817     {
00818         LPVOID lpMsgBuf;
00819         FormatMessage(
00820             FORMAT_MESSAGE_ALLOCATE_BUFFER |
00821             FORMAT_MESSAGE_FROM_SYSTEM |
00822             FORMAT_MESSAGE_IGNORE_INSERTS,
00823             NULL,
00824             GetLastError(),
00825             MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
00826             (LPTSTR) &lpMsgBuf,
00827             0,
00828             NULL
00829             );
00830         cvs_err("Unable to open '%s' (%s), using console instead\n",
00831             (char *)gCvsPrefs.ExtDiff(), (LPCSTR)lpMsgBuf);
00832         // Free the buffer.
00833         LocalFree( lpMsgBuf );
00834         return false;
00835     }
00836
00837     return true;
00838 #elif qUnix
00839     CvsArgs args(false);
00840     args.add(gCvsPrefs.ExtDiff());
00841     args.add(f1);
00842     args.add(f2);
00843     UCvsApp::gApp->Execute(args.Argc(), args.Argv());
00844     return true;
00845 #else
00846     return false;
00847 #endif
00848 }
00849
00850 bool LaunchViewer(const char *fullpath,bool useDefault /*= false*/)
00851 {
00852 #ifdef WIN32
00853     bool done = false;
00854
00855     if( !gCvsPrefs.UseViewerAlways() )
00856     {
00857         char viewer[_MAX_PATH];
00858         UStr buf;
00859         CStr uppath, folder;
00860         SplitPath(fullpath, uppath, folder);
00861
00862         HINSTANCE hInst = FindExecutable(fullpath, folder, viewer);
00863         if(!useDefault && (UINT)hInst >= 32)
00864         {
00865             // see Article ID: Q140724 for the problem desc of FindExecutable
00866             struct stat sb;
00867             HINSTANCE hInst;
00868             if (stat(viewer, &sb) != -1 && S_ISREG(sb.st_mode))
00869             {
00870                 CStr fullpathQuote;
00871                 if(strchr(fullpath, ' ') != 0L)
00872                 {
00873                     fullpathQuote << '\"';
00874                     fullpathQuote << fullpath;
00875                     fullpathQuote << '\"';
00876                 }
00877                 else
00878                     fullpathQuote = fullpath;
00879
00880                 hInst = ShellExecute(*AfxGetMainWnd(), "open", viewer, fullpathQuote,
00881                     folder, SW_SHOWDEFAULT);
00882             }
00883             else
00884                 hInst = ShellExecute(*AfxGetMainWnd(), "open", fullpath, 0L,
00885                     folder, SW_SHOWDEFAULT);
00886
00887             if((long)hInst < 32)
00888             {
00889                 cvs_err("Unable to open '%s' (error %d), using default viewer instead\n", (char *)fullpath, GetLastError());
00890             }
00891             else
00892                 done = true;
00893         }
00894     }
00895
00896     if(!done)
00897     {
00898         if(gCvsPrefs.Viewer() == 0L)
00899         {
00900             cvs_err("You need to define a default viewer for this file in the preferences\n");
00901             return false;
00902         }
00903
00904         const char * argv[3] = {0L, 0L, 0L};
00905         CStr program, file;
00906         if(strchr(gCvsPrefs.Viewer(), ' ') != 0L)
00907         {
00908             program << '\"';
00909             program << gCvsPrefs.Viewer();
00910             program << '\"';
00911         }
00912         else
00913             program = gCvsPrefs.Viewer();
00914         if(strchr(fullpath, ' ') != 0L)
00915         {
00916             file << '\"';
00917             file << fullpath;
00918             file << '\"';
00919         }
00920         else
00921             file = fullpath;
00922         argv[0] = program;
00923         argv[1] = file;
00924         int process = _spawnvp(_P_NOWAIT, gCvsPrefs.Viewer(), argv);
00925     }
00926
00927     return true;
00928 #endif /* WIN32 */
00929
00930 #ifdef qMacCvsPP
00931     return true;
00932 #endif /* qMacCvsPP */
00933
00934 #if qUnix
00935     return true;
00936 #endif // qUnix
00937 }
00938
00939 bool LaunchEditor(const char* tmpFile, void* par /*= 0L*/)
00940 {
00941     CStr program, file;
00942     if(strchr(gCvsPrefs.Viewer(), ' ') != 0L)
00943     {
00944         program << '\"';
00945         program << gCvsPrefs.Viewer();
00946         program << '\"';
00947     }
00948     else
00949         program = gCvsPrefs.Viewer();
00950     if(strchr(tmpFile, ' ') != 0L)
00951     {
00952         file << '\"';
00953         file << tmpFile;
00954         file << '\"';
00955     }
00956     else
00957         file = tmpFile;
00958
00959     CStr command;
00960     command << program;
00961     command << " ";
00962     command << file;
00963
00964 #ifdef WIN32
00965     STARTUPINFO sStartupInfo;
00966     PROCESS_INFORMATION sProcessInformation;
00967
00968     // Execute the command with a call to the CreateProcess API call.
00969     memset( &sStartupInfo, 0, sizeof(sStartupInfo) );
00970     sStartupInfo.cb = sizeof( sStartupInfo );
00971     sStartupInfo.dwFlags = STARTF_USESHOWWINDOW;
00972     sStartupInfo.wShowWindow = SW_SHOWNORMAL;
00973
00974     if( !CreateProcess( NULL,
00975         (char*)command,
00976         NULL,
00977         NULL,
00978         FALSE,
00979         0,
00980         NULL,
00981         NULL,
00982         &sStartupInfo,
00983         &sProcessInformation) )
00984     {
00985         sProcessInformation.hProcess = INVALID_HANDLE_VALUE;
00986         sProcessInformation.hThread = INVALID_HANDLE_VALUE;
00987     }
00988
00989     *((PROCESS_INFORMATION*)par) = sProcessInformation;
00990     return sProcessInformation.hProcess != INVALID_HANDLE_VALUE;
00991 #endif /* WIN32 */
00992
00993 #ifdef qMacCvsPP
00994     return true;
00995 #endif /* qMacCvsPP */
00996
00997 #if qUnix
00998     return true;
00999 #endif // qUnix
01000 }
01001
01002 void CvsPrefs::SetWhichCvs(const char *cvsPath)
01003 {
01004     UStr appPath;
01005
01006 #ifdef WIN32
01007     HINSTANCE hInst = ::AfxGetInstanceHandle();
01008     char apath[512];
01009     DWORD len;
01010     if(hInst != 0L && (len = ::GetModuleFileName(hInst, apath, 512)) > 0)
01011     {
01012         CString tmp(apath);
01013         tmp.MakeLower();
01014         appPath = tmp;
01015     }
01016 #endif
01017
01018     if(!appPath.empty())
01019     {
01020         UStr value;
01021         gWhichCvs.Concatenate(value, appPath, cvsPath);
01022         gWhichCvs.Insert(value);
01023     }
01024 }
01025
01026 const char *CvsPrefs::WhichCvs(UStr & path, bool userOnly) const
01027 {
01028     path = "";
01029
01030     UStr appPath;
01031
01032 #ifdef WIN32
01033     HINSTANCE hInst = ::AfxGetInstanceHandle();
01034     char apath[512];
01035     DWORD len;
01036     if(hInst != 0L && (len = ::GetModuleFileName(hInst, apath, 512)) > 0)
01037     {
01038         CString tmp(apath);
01039         tmp.MakeLower();
01040         appPath = tmp;
01041     }
01042 #endif
01043
01044     // search if beside the default cvs, the user defined one to use
01045     // with this application only.
01046     UStr candidate;
01047     if(!appPath.empty())
01048     {
01049         UStr value;
01050         gWhichCvs.Concatenate(value, appPath, "");
01051         TMString<UStr>::list_t::const_iterator i = gWhichCvs.Find(value);
01052         if(i != gWhichCvs.end())
01053         {
01054             UStr key;
01055             gWhichCvs.Split(*i, key, candidate);
01056         }
01057     }
01058
01059     // verify this cvs exe is still there
01060     struct stat sb;
01061     if(!candidate.empty() && stat(candidate, &sb) != -1 && S_ISREG(sb.st_mode))
01062     {
01063         path = candidate;
01064         return path.c_str();
01065     }
01066
01067     // fallback to the default one.
01068     if(userOnly)
01069         return 0L;
01070
01071 #ifdef WIN32
01072     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01073
01074     app->GetAppPath(path);
01075     if(!path.endsWith(kPathDelimiter))
01076         path << kPathDelimiter;
01077     path << (gCvsPrefs.WhichVersion() == kWin32 ? "cvs95.exe" : "cvs.exe");
01078 #endif
01079
01080     return path.c_str();
01081 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/CvsPrefs.h Source File

common/CvsPrefs.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * CvsPrefs.h --- class to handle CVS settings
00023  */
00024
00025 #ifndef CVSPREFS_H
00026 #define CVSPREFS_H
00027
00028 #include <string.h>
00029
00030 #include "CPStr.h"
00031 #include "Persistent.h"
00032
00033 #ifdef macintosh
00034 #   include <Files.h>
00035 #endif /* macintosh */
00036
00037 typedef enum
00038 {
00039     ISO8559_none, // no conversion
00040     ISO8559_1, // Latin1
00041     ISO8559_2, // Latin2
00042     ISO8559_3, // Latin3
00043     ISO8559_4, // Latin4
00044     ISO8559_5, // Cyrillic
00045     ISO8559_6, // Arabic
00046     ISO8559_7, // Greek
00047     ISO8559_8, // Hebrew
00048     ISO8559_9, // Latin5 (Turkish)
00049     ISO8559_10 // Latin6 (Nordic)
00050 } ISO8559;
00051
00052 typedef enum
00053 {
00054     MAC_HQX, // HQX (7bits)
00055     MAC_APPSINGLE // Apple Single
00056 } MACENCODING;
00057
00058 typedef enum
00059 {
00060     SHELL_TCL,
00061     SHELL_PYTHON
00062 } SHELL_KIND;
00063
00064 #define NUM_CVSROOT 20
00065
00066 #ifdef WIN32
00067     typedef enum
00068     {
00069         kWin16,
00070         kWinNT35,
00071         kWinNT4,
00072         kWin32
00073     } kWinVersion;
00074 #endif /* WIN32 */
00075
00076 class CKeyString;
00077
00078 class CvsPrefs
00079 {
00080
00081 public :
00082     inline CvsPrefs() : fHasLoggedIn(false),
00083         fCvsRunningCounter(0), fTclFileRunningCounter(0) {}
00084     inline ~CvsPrefs() {}
00085
00086     // CVSROOT
00087     bool empty(void) const;
00088     int length(void) const;
00089
00090     const char *operator=(const char *newstr);
00091         // set to a new C String (0L is OK)
00092     const unsigned char *operator=(const unsigned char *newstr);
00093         // set to a new P String (0L is OK)
00094
00095     operator const char *() const;
00096         // as a C string
00097     operator const unsigned char *() const;
00098         // as a P string
00099
00100     // misc. options
00101     bool CheckoutRO(void) const;
00102     bool Z9Option(void) const;
00103     bool PruneOption(void) const;
00104     bool QuietOption(void) const;
00105     ISO8559 IsoConvert(void) const;
00106     bool ICTextOption(void) const;
00107     bool AddControl(void) const;
00108     bool UseViewerAlways(void) const;
00109     MACENCODING MacBinEncoding(void) const;
00110     int KserverPort(void) const;
00111     int PserverPort(void) const;
00112     int RhostPort(void) const;
00113     const char * ServerName(void) const;
00114     const char * RshName(void) const;
00115     const char * Home(void) const;
00116     const char * Viewer(void) const;
00117     const char * ExtDiff(void) const;
00118     const char * Helper(void) const;
00119     const char * Browser(void) const;
00120     bool DirtySupport(void) const;
00121     int LogoutTimeOut(void) const;
00122     bool AlwaysUseCvsroot(void) const;
00123     bool UseProxy(void) const;
00124     const char *ProxyHost(void) const;
00125     int ProxyPort(void) const;
00126     bool UnixLF(void) const;
00127     int ZLevel(void) const;
00128     int CvsVersion(void) const;
00129     bool CvsConsole(void) const;
00130     int WordWrapLogMsg(void) const;
00131     const char * LastWorkingDir(void) const;
00132     bool UseKeyChain(void) const; // on mac
00133     bool HideCommandDlgUpdate(void) const;
00134     bool HideCommandDlgDiff(void) const;
00135     bool HideCommandDlgLog(void) const;
00136     bool HideCommandDlgGraph(void) const;
00137     bool HideCommandDlgAnnotate(void) const;
00138     bool HideCommandDlgUseShift(void) const;
00139     SHELL_KIND GetUseShell(void) const;
00140
00141     void SetCheckoutRO(bool newState);
00142     void SetZ9Option(bool newState);
00143     void SetPruneOption(bool newState);
00144     void SetQuietOption(bool newState);
00145     void SetIsoConvert(ISO8559 newState);
00146     void SetICTextOption(bool newState);
00147     void SetAddControl(bool newState);
00148     void SetUseViewerAlways(bool newState);
00149     void SetMacBinEncoding(MACENCODING newState);
00150     void SetKserverPort(int newState);
00151     void SetPserverPort(int newState);
00152     void SetRhostPort(int newState);
00153     void SetServerName(const char *newservername);
00154     void SetRshName(const char *newrshname);
00155     void SetHome(const char *newhome);
00156     void SetViewer(const char *newviewer);
00157     void SetExtDiff(const char *newdiff);
00158     void SetHelper(const char *newhelper);
00159     void SetBrowser(const char *newbrowser);
00160     void SetDirtySupport(bool newState);
00161     void SetLogoutTimeOut(int newTimeout);
00162     void SetAlwaysUseCvsroot(bool newState);
00163     void SetUseProxy(bool useit);
00164     void SetProxyHost(const char *newhost);
00165     void SetProxyPort(int newport);
00166     void SetUnixLF(bool useit);
00167     void SetZLevel(int level);
00168     void SetCvsVersion(int version);
00169     void SetCvsConsole(bool console);
00170     void SetWordWrapLogMsg(int wordwrap);
00171     void SetLastWorkingDir(const char *workdir);
00172     void SetHideCommandDlgUpdate(bool newState);
00173     void SetHideCommandDlgDiff(bool newState);
00174     void SetHideCommandDlgLog(bool newState);
00175     void SetHideCommandDlgGraph(bool newState);
00176     void SetHideCommandDlgAnnotate(bool newState);
00177     void SetHideCommandDlgUseShift(bool newState);
00178     void SetUseShell(SHELL_KIND shell);
00179
00180 #ifdef WIN32
00181     kWinVersion WhichVersion();
00182 #endif /* WIN32 */
00183
00184     const char *WhichCvs(UStr & path, bool userOnly = false) const;
00185     void SetWhichCvs(const char *cvsPath);
00186         // full path of the cvs used
00187
00188     // login/logout flag in order to manage auto-logout
00189     inline bool HasLoogedIn(void) const { return fHasLoggedIn; }
00190     inline void SetHasLoogedIn(bool newstate) { fHasLoggedIn = newstate; }
00191
00192     // Usage counter flags for CVS commands and TCL macro files.
00193     // Each SetCvsRunning(TRUE) must have equivalent
00194     // SetCvsRunning(FALSE) call.
00195     bool IsCvsRunning(void) const;
00196     int  SetCvsRunning(bool launched);
00197     bool IsTclFileRunning(void) const;
00198     int  SetTclFileRunning(bool launched);
00199
00200     // save/load preferences
00201     void save(void);
00202     void load(void);
00203
00204     // access the CVSROOT list
00205     inline const CPStr & get_cvsroot_list(int entry) const
00206         {return ((CvsPrefs *)this)->get_cvsroot_list(entry);}
00207 protected :
00208     bool fHasLoggedIn;
00209
00210     int  fCvsRunningCounter;      // Usage counters to CVS commands
00211     int  fTclFileRunningCounter;  // and Tcl macro file executions
00212
00213     CPStr & get_cvsroot_list(int entry);
00214
00215     bool has_cvsroot_in_list(const char *cvsroot, int & entry);
00216     void insert_cvsroot_in_list(const char *cvsroot);
00217     void flush_list(void);
00218 };
00219
00220 extern CvsPrefs gCvsPrefs;
00221
00222 bool LaunchDiff(const char *file1, const char *file2);
00223     // launch a two diff files
00224
00225 bool LaunchViewer(const char *fullpath,bool useDefault = false);
00226     // launch a viewer for file
00227
00228 bool LaunchEditor(const char* tmpFile, void* par = 0L);
00229     // launch an editor for a file
00230
00231 #endif /* CVSPREFS_H */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/DiffDlg.cpp Source File

common/DiffDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * DiffDlg.cpp : the cvs diff dialog
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "wincvs.h"
00029 #   include "OptionalPropertySheet.h"
00030 #endif /* WIN32 */
00031
00032 #if qUnix
00033 #   include "UCvsDialogs.h"
00034 #endif
00035
00036 #ifdef qMacCvsPP
00037 #   include <UModalDialogs.h>
00038 #   include <LRadioButton.h>
00039 #   include <LEditText.h>
00040 #   include <LCheckBox.h>
00041 #   include <LMultiPanelView.h>
00042 #   include <LPopupGroupBox.h>
00043 #   include "LPopupFiller.h"
00044
00045 #   include "MacCvsConstant.h"
00046 #endif /* qMacCvsPP */
00047
00048 #include "DiffDlg.h"
00049 #include "CvsPrefs.h"
00050 #include "UpdateDlg.h"
00051
00052 static CPersistentBool gUseExtDiff("P_DiffUseExtDiff", false);
00053
00054 #ifdef WIN32
00055 #include "GetPrefs.h"
00056
00057 #ifdef _DEBUG
00058 #define new DEBUG_NEW
00059 #undef THIS_FILE
00060 static char THIS_FILE[] = __FILE__;
00061 #endif
00062
00063 IMPLEMENT_DYNCREATE(CDiff_MAIN, CPropertyPage)
00064
00065 CDiff_MAIN::CDiff_MAIN(const char *rev1, const char *rev2, bool allowExtDiff, bool noWhiteSpace, bool ignoreCare) :
00066     CPropertyPage(CDiff_MAIN::IDD), m_allowExtDiff(allowExtDiff)
00067 {
00068     //{{AFX_DATA_INIT(CDiff_MAIN)
00069     m_check1 = FALSE;
00070     m_check2 = FALSE;
00071     m_str1 = rev1;
00072     m_str2 = rev2;
00073     m_diff = 0;
00074     m_norecurs = FALSE;
00075     m_extdiff = (bool)gUseExtDiff;
00076     m_noWhiteSpace = noWhiteSpace;
00077     m_ignoreCase = ignoreCare;
00078     //}}AFX_DATA_INIT
00079 }
00080
00081 CDiff_MAIN::CDiff_MAIN() : CPropertyPage(CDiff_MAIN::IDD)
00082 {
00083 }
00084
00085 CDiff_MAIN::~CDiff_MAIN()
00086 {
00087 }
00088
00089 void CDiff_MAIN::DoDataExchange(CDataExchange* pDX)
00090 {
00091     CPropertyPage::DoDataExchange(pDX);
00092     //{{AFX_DATA_MAP(CDiff_MAIN)
00093     DDX_Control(pDX, IDC_EXTDIFF, m_extdiffctl);
00094     DDX_Control(pDX, IDC_COMBO2, m_def2);
00095     DDX_Control(pDX, IDC_COMBO1, m_def1);
00096     DDX_Check(pDX, IDC_CHECK1, m_check1);
00097     DDX_Check(pDX, IDC_CHECK2, m_check2);
00098     DDX_CBString(pDX, IDC_COMBO1, m_str1);
00099     DDX_CBString(pDX, IDC_COMBO2, m_str2);
00100     DDX_Radio(pDX, IDC_DIFF1, m_diff);
00101     DDX_Check(pDX, IDC_NORECURS, m_norecurs);
00102     DDX_Check(pDX, IDC_EXTDIFF, m_extdiff);
00103     DDX_Check(pDX, IDC_IGNOREWHITESPACE, m_noWhiteSpace);
00104     DDX_Check(pDX, IDC_IGNORECASE, m_ignoreCase);
00105     //}}AFX_DATA_MAP
00106     if(m_diff == 1 || m_diff == 2)
00107         DDV_MinChars(pDX, m_str1, 1);
00108     if(m_diff == 2)
00109         DDV_MinChars(pDX, m_str2, 1);
00110     if(!pDX->m_bSaveAndValidate)
00111     {
00112         OnDiff1();
00113     }
00114
00115     DDX_ComboMString(pDX, IDC_COMBO1, m_check1 ? gDateNames : gRevNames, m_def1);
00116     DDX_ComboMString(pDX, IDC_COMBO2, m_check2 ? gDateNames : gRevNames, m_def2);
00117
00118     m_extdiffctl.EnableWindow(m_allowExtDiff ? true : false);
00119     OnExtdiff();
00120 }
00121
00122 BEGIN_MESSAGE_MAP(CDiff_MAIN, CPropertyPage)
00123     //{{AFX_MSG_MAP(CDiff_MAIN)
00124     ON_BN_CLICKED(IDC_DIFF1, OnDiff1)
00125     ON_BN_CLICKED(IDC_DIFF2, OnDiff2)
00126     ON_BN_CLICKED(IDC_DIFF3, OnDiff3)
00127     ON_BN_CLICKED(IDC_EXTDIFF, OnExtdiff)
00128     ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
00129     ON_BN_CLICKED(IDC_CHECK2, OnCheck2)
00130     //}}AFX_MSG_MAP
00131 END_MESSAGE_MAP()
00132
00134 // CDiff_MAIN message handlers
00135
00136 void CDiff_MAIN::OnDiff1()
00137 {
00138     CButton* but = (CButton *)GetDlgItem(IDC_DIFF1);
00139     CButton* but1 = (CButton *)GetDlgItem(IDC_DIFF2);
00140     CButton* but2 = (CButton *)GetDlgItem(IDC_DIFF3);
00141     CWnd* wnd1 = GetDlgItem(IDC_COMBO1);
00142     CWnd* wnd2 = GetDlgItem(IDC_COMBO2);
00143     CWnd* wnd3 = GetDlgItem(IDC_CHECK1);
00144     CWnd* wnd4 = GetDlgItem(IDC_CHECK2);
00145     if(but->GetCheck() == 1)
00146     {
00147         wnd1->EnableWindow(FALSE);
00148         wnd2->EnableWindow(FALSE);
00149         wnd3->EnableWindow(FALSE);
00150         wnd4->EnableWindow(FALSE);
00151     }
00152     else if(but1->GetCheck() == 1)
00153     {
00154         wnd1->EnableWindow(TRUE);
00155         wnd2->EnableWindow(FALSE);
00156         wnd3->EnableWindow(TRUE);
00157         wnd4->EnableWindow(FALSE);
00158     }
00159     else
00160     {
00161         wnd1->EnableWindow(TRUE);
00162         wnd2->EnableWindow(TRUE);
00163         wnd3->EnableWindow(TRUE);
00164         wnd4->EnableWindow(TRUE);
00165     }
00166 }
00167
00168 void CDiff_MAIN::OnDiff2()
00169 {
00170     OnDiff1();
00171 }
00172
00173 void CDiff_MAIN::OnDiff3()
00174 {
00175     OnDiff1();
00176 }
00177 #endif /* WIN32 */
00178
00179 #ifdef qMacCvsPP
00180 static void DoDataExchange_DiffMain(LWindow *theDialog, bool & noRecurs, bool & isDate1, bool & isDate2,
00181     CPStr & sLastRev1, CPStr & sLastRev2, bool & hasRev1, bool & hasRev2, bool putValue)
00182 {
00183     LRadioButton *chkHasRev = dynamic_cast<LRadioButton*>
00184         (theDialog->FindPaneByID(item_CheckRevTag1));
00185     LEditText *editRev = dynamic_cast<LEditText*>
00186         (theDialog->FindPaneByID(item_EditRevTag1));
00187     LRadioButton *chkHasRev2 = dynamic_cast<LRadioButton*>
00188         (theDialog->FindPaneByID(item_CheckRevTag2));
00189     LEditText *editRev2 = dynamic_cast<LEditText*>
00190         (theDialog->FindPaneByID(item_EditRevTag2));
00191     LCheckBox *chkHasDate1 = dynamic_cast<LCheckBox*>
00192         (theDialog->FindPaneByID(item_CheckDate1));
00193     LCheckBox *chkHasDate2 = dynamic_cast<LCheckBox*>
00194         (theDialog->FindPaneByID(item_CheckDate2));
00195     LPopupFiller *fill1 = dynamic_cast<LPopupFiller*>
00196         (theDialog->FindPaneByID(item_FillerRev1));
00197     LPopupFiller *fill2 = dynamic_cast<LPopupFiller*>
00198         (theDialog->FindPaneByID(item_FillerRev2));
00199     LPane *extDiff = theDialog->FindPaneByID(item_DiffExternal);
00200
00201     if(putValue)
00202     {
00203         chkHasDate1->SetValue(isDate1 ? Button_On : Button_Off);
00204         chkHasDate2->SetValue(isDate2 ? Button_On : Button_Off);
00205         if(hasRev1 && hasRev2)
00206             theDialog->SetValueForPaneID (item_CheckRevTag2, Button_On);
00207         else if(hasRev1)
00208             theDialog->SetValueForPaneID (item_CheckRevTag1, Button_On);
00209         else
00210             theDialog->SetValueForPaneID (item_MergeNone, Button_On);
00211
00212         editRev->SetText((Ptr)(const char *)sLastRev1, sLastRev1.length());
00213         editRev2->SetText((Ptr)(const char *)sLastRev2, sLastRev2.length());
00214
00215         fill1->DoDataExchange(gRevNames, putValue);
00216         fill2->DoDataExchange(gRevNames, putValue);
00217
00218         extDiff->SetValue ((bool)gUseExtDiff ? Button_On : Button_Off);
00219     }
00220     else
00221     {
00222         isDate1 = chkHasDate1->GetValue() == Button_On;
00223         isDate2 = chkHasDate2->GetValue() == Button_On;
00224
00225         if(theDialog->GetValueForPaneID (item_CheckRevTag2) == Button_On)
00226         {
00227             hasRev1 = hasRev2 = true;
00228         }
00229         else if (theDialog->GetValueForPaneID (item_CheckRevTag1) == Button_On)
00230         {
00231             hasRev1 = true;
00232             hasRev2 = false;
00233         }
00234         else
00235         {
00236             hasRev1 = hasRev2 = false;
00237         }
00238
00239         fill1->DoDataExchange(isDate1 ? gDateNames : gRevNames, putValue);
00240         fill2->DoDataExchange(isDate2 ? gDateNames : gRevNames, putValue);
00241
00242         char str[255];
00243         Size len;
00244
00245         editRev->GetText(str, 254, &len);
00246         sLastRev1.set(str, len);
00247         editRev2->GetText(str, 254, &len);
00248         sLastRev2.set(str, len);
00249
00250         gUseExtDiff = extDiff->GetValue () == Button_On;
00251     }
00252 }
00253 #endif /* qMacCvsPP */
00254
00255 #if qUnix
00256 class UCvsDiff : public UWidget
00257 {
00258     UDECLARE_DYNAMIC(UCvsDiff)
00259 public:
00260     UCvsDiff() : UWidget(::UEventGetWidID()) {}
00261     virtual ~UCvsDiff() {}
00262
00263     enum
00264     {
00265         kOK = EV_COMMAND_START, // 0
00266         kCancel,                // 1
00267         kTabGeneral             // 2
00268     };
00269
00270     virtual void DoDataExchange(bool fill);
00271
00272 protected:
00273     ev_msg int OnOK(void);
00274     ev_msg int OnCancel(void);
00275
00276     UDECLARE_MESSAGE_MAP()
00277 };
00278
00279 UIMPLEMENT_DYNAMIC(UCvsDiff, UWidget)
00280
00281 UBEGIN_MESSAGE_MAP(UCvsDiff, UWidget)
00282     ON_UCOMMAND(UCvsDiff::kOK, UCvsDiff::OnOK)
00283     ON_UCOMMAND(UCvsDiff::kCancel, UCvsDiff::OnCancel)
00284 UEND_MESSAGE_MAP()
00285
00286 int UCvsDiff::OnOK(void)
00287 {
00288     EndModal(true);
00289     return 0;
00290 }
00291
00292 int UCvsDiff::OnCancel(void)
00293 {
00294     EndModal(false);
00295     return 0;
00296 }
00297
00298 void UCvsDiff::DoDataExchange(bool fill)
00299 {
00300     if(fill)
00301     {
00302     }
00303     else
00304     {
00305     }
00306 }
00307
00308 class UCvsDiff_MAIN : public UWidget
00309 {
00310     UDECLARE_DYNAMIC(UCvsDiff_MAIN)
00311 public:
00312     UCvsDiff_MAIN(const char *rev1, const char *rev2, bool allowExtDiff);
00313     virtual ~UCvsDiff_MAIN() {}
00314
00315     enum
00316     {
00317         kCheckDiff1 = EV_COMMAND_START, // 0
00318         kCheckDiff2,            // 1
00319         kCheckDiff3,            // 2
00320         kCheckDate1,            // 3
00321         kCheckDate2,            // 4
00322         kComboRev1,             // 5
00323         kComboRev2,             // 6
00324         kCheckRecurs,           // 7
00325         kCheckExtDiff           // 8
00326     };
00327
00328     virtual void DoDataExchange(bool fill);
00329
00330     bool m_check1;
00331     bool m_check2;
00332     UStr m_str1;
00333     UStr m_str2;
00334     int m_diff;
00335     bool m_norecurs;
00336     bool m_extdiff;
00337     bool m_allowExtDiff;
00338
00339 protected:
00340     ev_msg int OnDiff(int cmd);
00341
00342     UDECLARE_MESSAGE_MAP()
00343 };
00344
00345 UIMPLEMENT_DYNAMIC(UCvsDiff_MAIN, UWidget)
00346
00347 UBEGIN_MESSAGE_MAP(UCvsDiff_MAIN, UWidget)
00348     ON_UCOMMAND_RANGE(UCvsDiff_MAIN::kCheckDiff1, UCvsDiff_MAIN::kCheckDiff2, UCvsDiff_MAIN::OnDiff)
00349 UEND_MESSAGE_MAP()
00350
00351 UCvsDiff_MAIN::UCvsDiff_MAIN(const char *rev1, const char *rev2, bool allowExtDiff) : UWidget(::UEventGetWidID())
00352 {
00353     m_check1 = false;
00354     m_check2 = false;
00355     m_str1 = rev1;
00356     m_str2 = rev2;
00357     m_diff = 0;
00358     m_norecurs = false;
00359     m_extdiff = gUseExtDiff;
00360     m_allowExtDiff = allowExtDiff;
00361 }
00362
00363 int UCvsDiff_MAIN::OnDiff(int cmd)
00364 {
00365     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDiff1, 0L);
00366     if(state)
00367     {
00368         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kCheckDate1, 0), 0L);
00369         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboRev1, 0), 0L);
00370         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kCheckDate2, 0), 0L);
00371         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboRev2, 0), 0L);
00372     }
00373     else
00374     {
00375         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kCheckDate1, 1), 0L);
00376         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboRev1, 1), 0L);
00377         state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDiff2, 0L);
00378         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kCheckDate2, state == 0), 0L);
00379         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kComboRev2, state == 0), 0L);
00380     }
00381     return 0;
00382 }
00383
00384 void UCvsDiff_MAIN::DoDataExchange(bool fill)
00385 {
00386     ::DoDataExchange(fill, GetWidID(), kComboRev1, gDateOrRevNames);
00387     ::DoDataExchange(fill, GetWidID(), kComboRev2, gDateOrRevNames);
00388
00389     if(fill)
00390     {
00391         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kCheckExtDiff, m_allowExtDiff), 0L);
00392
00393         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckDate1, m_check1), 0L);
00394         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckDate2, m_check2), 0L);
00395         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRecurs, m_norecurs), 0L);
00396         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckExtDiff, m_extdiff), 0L);
00397         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckDiff1 + m_diff, 1), 0L);
00398
00399         UEventSendMessage(GetWidID(), EV_SETTEXT, kComboRev1, (void *)(const char *)m_str1);
00400         UEventSendMessage(GetWidID(), EV_SETTEXT, kComboRev2, (void *)(const char *)m_str2);
00401
00402         OnDiff(kCheckDiff1 + m_diff);
00403     }
00404     else
00405     {
00406         m_check1 = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDate1, 0L);
00407         m_check2 = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDate2, 0L);
00408         m_norecurs = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRecurs, 0L);
00409         m_extdiff = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckExtDiff, 0L);
00410
00411         if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDiff1, 0L))
00412             m_diff = 0;
00413         else if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckDiff2, 0L))
00414             m_diff = 1;
00415         else
00416             m_diff = 2;
00417
00418         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboRev1, &m_str1);
00419         UEventSendMessage(GetWidID(), EV_GETTEXT, kComboRev2, &m_str2);
00420     }
00421 }
00422 #endif // qUnix
00423
00424 bool CompatGetDiff(bool & noRecurs, bool & isDate1, bool & isDate2,
00425                    CPStr & rev1, CPStr & rev2, bool & useExtDiff,
00426                    bool & noWhiteSpace, bool & ignoreCare,
00427                    bool allowExtDiff)
00428 {
00429     bool userHitOK = false;
00430
00431     static CPStr sLastRev1;
00432     static CPStr sLastRev2;
00433     static bool bNoWhiteSpace = false;
00434     static bool bIgnoreCare = false;
00435
00436     rev1 = "";
00437     rev2 = "";
00438     noRecurs = false;
00439     isDate1 = false;
00440     isDate2 = false;
00441     useExtDiff = (bool)gUseExtDiff;
00442     noWhiteSpace = bNoWhiteSpace;
00443     ignoreCare = bIgnoreCare;
00444     bool hasRev1 = false;
00445     bool hasRev2 = false;
00446
00447 #ifdef WIN32
00448     COptionalPropertySheet pages(gCvsPrefs.HideCommandDlgDiff(), "Diff settings");
00449     pages.m_psh.dwFlags |= PSH_NOAPPLYNOW;
00450     CDiff_MAIN page1(sLastRev1, sLastRev2, allowExtDiff, noWhiteSpace, ignoreCare);
00451     CGetPrefs_GLOBALS page2;
00452     pages.AddPage(&page1);
00453     pages.AddPage(&page2);
00454     if(pages.DoModal() == IDOK)
00455     {
00456         noRecurs = page1.m_norecurs == TRUE;
00457
00458         sLastRev1 = page1.m_str1;
00459         sLastRev2 = page1.m_str2;
00460         isDate1 = page1.m_check1 == TRUE;
00461         isDate2 = page1.m_check2 == TRUE;
00462         gUseExtDiff = page1.m_extdiff == TRUE;
00463         if(page1.m_diff == 0)
00464         {
00465             hasRev1 = hasRev2 = false;
00466         }
00467         else if(page1.m_diff == 1)
00468         {
00469             hasRev1 = true;
00470             hasRev2 = false;
00471         }
00472         else
00473         {
00474             hasRev1 = true;
00475             hasRev2 = true;
00476         }
00477
00478         noWhiteSpace = page1.m_noWhiteSpace == TRUE;
00479         ignoreCare = page1.m_ignoreCase == TRUE;
00480
00481         page2.StoreValues();
00482         gCvsPrefs.SetHideCommandDlgDiff(pages.GetHideCommandDlg());
00483         userHitOK = true;
00484     }
00485 #endif /* WIN32 */
00486 #ifdef qMacCvsPP
00487     StDialogHandler theHandler(dlg_Diff, LCommander::GetTopCommander());
00488     LWindow *theDialog = theHandler.GetDialog();
00489     ThrowIfNil_(theDialog);
00490     static UInt16 sRuntimePanel = 1;
00491
00492     LMultiPanelView *multiView = dynamic_cast<LMultiPanelView*>
00493         (theDialog->FindPaneByID(item_MultiViewPrefs));
00494     LPane *groupView = theDialog->FindPaneByID(item_GroupViewPrefs);
00495
00496     multiView->SwitchToPanel(2);
00497     DoDataExchange_Globals(theDialog, true);
00498     multiView->SwitchToPanel(1);
00499     DoDataExchange_DiffMain(theDialog, noRecurs, isDate1, isDate2, sLastRev1, sLastRev2,
00500         hasRev1, hasRev2, true);
00501
00502     groupView->SetValue(sRuntimePanel);
00503     theDialog->Show();
00504     MessageT hitMessage;
00505     while (true)
00506     {       // Let DialogHandler process events
00507         hitMessage = theHandler.DoDialog();
00508
00509         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00510             break;
00511     }
00512     theDialog->Hide();
00513     sRuntimePanel = groupView->GetValue();
00514
00515     if(hitMessage == msg_OK)
00516     {
00517         multiView->SwitchToPanel(1);
00518         DoDataExchange_DiffMain(theDialog, noRecurs, isDate1, isDate2, sLastRev1, sLastRev2,
00519             hasRev1, hasRev2, false);
00520         multiView->SwitchToPanel(2);
00521         DoDataExchange_Globals(theDialog, false);
00522         userHitOK = true;
00523     }
00524 #endif /* qMacCvsPP */
00525 #if qUnix
00526     void *wid = UCreate_DiffDlg();
00527
00528     UCvsDiff *dlg = new UCvsDiff();
00529     UCvsDiff_MAIN *tab1 = new UCvsDiff_MAIN(sLastRev1, sLastRev2, allowExtDiff);
00530     UEventSendMessage(dlg->GetWidID(), EV_INIT_WIDGET, kUMainWidget, wid);
00531     dlg->AddPage(tab1, UCvsDiff::kTabGeneral, 0);
00532
00533     if(dlg->DoModal())
00534     {
00535         noRecurs = tab1->m_norecurs;
00536
00537         sLastRev1 = tab1->m_str1;
00538         sLastRev2 = tab1->m_str2;
00539         isDate1 = tab1->m_check1;
00540         isDate2 = tab1->m_check2;
00541         gUseExtDiff = tab1->m_extdiff;
00542         if(tab1->m_diff == 0)
00543         {
00544             hasRev1 = hasRev2 = false;
00545         }
00546         else if(tab1->m_diff == 1)
00547         {
00548             hasRev1 = true;
00549             hasRev2 = false;
00550         }
00551         else
00552         {
00553             hasRev1 = true;
00554             hasRev2 = true;
00555         }
00556
00557         userHitOK = true;
00558     }
00559
00560     delete dlg;
00561 #endif // qUnix
00562
00563     if(userHitOK)
00564     {
00565         if(hasRev1)
00566             rev1 = sLastRev1;
00567         if(hasRev2)
00568             rev2 = sLastRev2;
00569         useExtDiff = (bool)gUseExtDiff;
00570
00571         bNoWhiteSpace = noWhiteSpace;
00572         bIgnoreCare = ignoreCare;
00573
00574         gCvsPrefs.save();
00575     }
00576
00577     return userHitOK;
00578 }
00579
00580 #ifdef WIN32
00581
00582 void CDiff_MAIN::OnExtdiff()
00583 {
00584     // TODO: Add your control notification handler code here
00585     CButton* but = (CButton *)GetDlgItem(IDC_EXTDIFF);
00586     CWnd* wnd1 = GetDlgItem(IDC_IGNOREWHITESPACE);
00587     CWnd* wnd2 = GetDlgItem(IDC_IGNORECASE);
00588     BOOL bEnableDiffOptions = ( !but->GetCheck() || !but->IsWindowEnabled() );
00589     wnd1->EnableWindow(bEnableDiffOptions);
00590     wnd2->EnableWindow(bEnableDiffOptions);
00591 }
00592
00593 void CDiff_MAIN::OnCheck1()
00594 {
00595     CButton* btnIsDate = (CButton*)GetDlgItem(IDC_CHECK1);
00596     DDX_ComboMString(NULL, IDC_COMBO1, btnIsDate->GetCheck() ? gDateNames : gRevNames, m_def1);
00597 }
00598
00599 void CDiff_MAIN::OnCheck2()
00600 {
00601     CButton* btnIsDate = (CButton*)GetDlgItem(IDC_CHECK2);
00602     DDX_ComboMString(NULL, IDC_COMBO2, btnIsDate->GetCheck() ? gDateNames : gRevNames, m_def2);
00603 }
00604
00605 #endif /* WIN32 */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/DiffDlg.h Source File

common/DiffDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * DiffDlg.h : the cvs diff dialog
00023  */
00024
00025 #if !defined(AFX_DIFFDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_DIFFDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 #include "CPStr.h"
00033
00034 bool CompatGetDiff(bool & noRecurs, bool & isDate1, bool & isDate2,
00035                    CPStr & rev1, CPStr & rev2, bool & useExtDiff,
00036                    bool & noWhiteSpace, bool & ignoreCase,
00037                    bool allowExtDiff = false);
00038     // get the diff options...
00039
00040 #ifdef WIN32
00041 class CDiff_MAIN : public CPropertyPage
00042 {
00043     DECLARE_DYNCREATE(CDiff_MAIN)
00044
00045 // Construction
00046 public:
00047     CDiff_MAIN(const char *rev1, const char *rev2, bool allowExtDiff, bool noWhiteSpace, bool ignoreCare);
00048     CDiff_MAIN();
00049     ~CDiff_MAIN();
00050
00051 // Dialog Data
00052     //{{AFX_DATA(CDiff_MAIN)
00053     enum { IDD = IDD_DIFF_MAIN };
00054     CButton m_extdiffctl;
00055     CComboBox   m_def2;
00056     CComboBox   m_def1;
00057     BOOL    m_check1;
00058     BOOL    m_check2;
00059     CString m_str1;
00060     CString m_str2;
00061     int     m_diff;
00062     BOOL    m_norecurs;
00063     BOOL    m_extdiff;
00064     BOOL    m_noWhiteSpace;
00065     BOOL    m_ignoreCase;
00066     //}}AFX_DATA
00067
00068     bool m_allowExtDiff;
00069
00070 // Overrides
00071     // ClassWizard generate virtual function overrides
00072     //{{AFX_VIRTUAL(CDiff_MAIN)
00073     protected:
00074     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00075     //}}AFX_VIRTUAL
00076
00077 // Implementation
00078 protected:
00079     // Generated message map functions
00080     //{{AFX_MSG(CDiff_MAIN)
00081     afx_msg void OnDiff1();
00082     afx_msg void OnDiff2();
00083     afx_msg void OnDiff3();
00084     afx_msg void OnExtdiff();
00085     afx_msg void OnCheck1();
00086     afx_msg void OnCheck2();
00087     //}}AFX_MSG
00088     DECLARE_MESSAGE_MAP()
00089
00090 };
00091
00092 //{{AFX_INSERT_LOCATION}}
00093 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00094 #endif /* WIN32 */
00095
00096 #endif // !defined(AFX_DIFFDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/dll_garbage.c Source File

common/dll_garbage.c

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * dll_garbage.c --- memory garbage collection for the dll
00023  */
00024
00025 #ifdef HAVE_CONFIG_H
00026 #include "config.h"
00027 #endif /* HAVE_CONFIG_H */
00028
00029 #include <stdio.h>
00030
00031 #ifdef HAVE_STRING_H
00032 #   include <string.h>
00033 #endif /* HAVE_STRING_H */
00034
00035 #include "dll_garbage.h"
00036
00037 #undef malloc
00038 #undef free
00039 #undef calloc
00040 #undef realloc
00041
00042 #if qMFC || qCvsDebug
00043     /* to intercept static C++ allocations */
00044 #   define AUTO_INITALIZE 1
00045 #else /* !macintosh */
00046 #   define AUTO_INITALIZE 0
00047 #endif /* !macintosh */
00048
00049 #if qCvsDebug && defined(macintosh)
00050 #   define qRangeCheck 0
00051 #else /* !qCvsDebug */
00052 #   define qRangeCheck 0
00053 #endif /* !qCvsDebug */
00054
00055 #if qRangeCheck && defined(macintosh)
00056 #include <MacMemory.h>
00057 static void *   platform_calloc(size_t nmemb, size_t size)
00058 {
00059     size_t tot = nmemb * size;
00060     void *res = NewPtr(tot);
00061     if(res != 0L)
00062         memset(res, 0, tot);
00063     return res;
00064 }
00065
00066 static void *   platform_malloc(size_t size)
00067 {
00068     return NewPtr(size);
00069 }
00070
00071 static void *   platform_realloc(void * ptr, size_t size)
00072 {
00073     void *newptr = NewPtr(size);
00074     if(newptr != 0L && ptr != 0L)
00075     {
00076         Size oldS = GetPtrSize((Ptr)ptr);
00077         if(oldS != 0)
00078         {
00079             size_t copySize = size < oldS ? size : oldS;
00080             memcpy(newptr, ptr, copySize);
00081         }
00082         DisposePtr((Ptr)ptr);
00083     }
00084     return newptr;
00085 }
00086
00087 static void platform_free(void *ptr)
00088 {
00089     if(ptr != 0L)
00090         DisposePtr((Ptr)ptr);
00091 }
00092 #else
00093 #   define platform_calloc(s1, s2) calloc(s1, s2)
00094 #   define platform_malloc(s) malloc(s)
00095 #   define platform_realloc(p, s) realloc(p, s)
00096 #   define platform_free(p) free(p)
00097 #endif
00098
00099 #if qRangeCheck
00100 #   include <assert.h>
00101 #   ifdef macintosh
00102 #       define ASSERT_RANGE(cond) do {if(!(cond)) DebugStr("\pRange check failed !");} while(0)
00103 #   else /* !macintosh */
00104 #       define ASSERT_RANGE(cond) assert(cond)
00105 #   endif /* !macintosh */
00106     static void garbyRangeCheck(void);
00107
00108 #   define RANGE_MAGIC_SIZE (3 * sizeof(size_t))
00109 #   define RANGE_TO_PTR(ptr) ((void *)(((size_t *)(ptr))+2))
00110 #   define PTR_TO_RANGE(ptr) ((void *)(((size_t *)(ptr))-2))
00111 #   define SIZE_FROM_PTR(ptr) (((size_t *)(ptr))[-2])
00112 #   define MAGIC1_FROM_PTR(ptr) ((void *)&(((size_t *)(ptr))[-1]))
00113 #   define MAGIC2_FROM_PTR(ptr) ((void *)&(((char *)(ptr))[SIZE_FROM_PTR(ptr)]))
00114 #   define RANGE_MAGIC ((char)0xFC)
00115     static void FILL_MAGIC(void *ptr)
00116     {
00117         char *tmp = (char *)ptr;
00118         *tmp++ = RANGE_MAGIC;
00119         *tmp++ = RANGE_MAGIC;
00120         *tmp++ = RANGE_MAGIC;
00121         *tmp = RANGE_MAGIC;
00122     }
00123
00124     static void CHECK_MAGIC(void *ptr)
00125     {
00126         char *tmp = (char *)ptr;
00127         ASSERT_RANGE(*tmp++ == RANGE_MAGIC);
00128         ASSERT_RANGE(*tmp++ == RANGE_MAGIC);
00129         ASSERT_RANGE(*tmp++ == RANGE_MAGIC);
00130         ASSERT_RANGE(*tmp == RANGE_MAGIC);
00131     }
00132
00133     static void *malloc_check(size_t size)
00134     {
00135         void *result, *range;
00136
00137         garbyRangeCheck();
00138
00139         if(size == 0)
00140             return 0L;
00141
00142         range = platform_malloc(size + RANGE_MAGIC_SIZE);
00143         if(range == 0L)
00144             return 0L;
00145
00146         result = RANGE_TO_PTR(range);
00147         SIZE_FROM_PTR(result) = size;
00148         FILL_MAGIC(MAGIC1_FROM_PTR(result));
00149         FILL_MAGIC(MAGIC2_FROM_PTR(result));
00150
00151         return result;
00152     }
00153
00154     static void *calloc_check(size_t nmemb, size_t size)
00155     {
00156         void *result;
00157         size_t totsize = nmemb * size;
00158
00159         garbyRangeCheck();
00160
00161         if(totsize == 0)
00162             return 0L;
00163
00164         result = malloc_check(totsize);
00165         if(result == 0L)
00166             return 0L;
00167
00168         memset(result, 0, totsize);
00169         return result;
00170     }
00171
00172     static void free_check(void *ptr)
00173     {
00174         void *range;
00175
00176         garbyRangeCheck();
00177
00178         if(ptr == 0L)
00179             return;
00180
00181         ASSERT_RANGE(SIZE_FROM_PTR(ptr) > 0);
00182         CHECK_MAGIC(MAGIC1_FROM_PTR(ptr));
00183         CHECK_MAGIC(MAGIC2_FROM_PTR(ptr));
00184
00185         range = PTR_TO_RANGE(ptr);
00186         memset(range, 0xFC, SIZE_FROM_PTR(ptr) + RANGE_MAGIC_SIZE);
00187         platform_free(range);
00188     }
00189
00190     static void *realloc_check(void *ptr, size_t size)
00191     {
00192         void *result, *range;
00193
00194         garbyRangeCheck();
00195
00196         if(ptr == 0L)
00197             return malloc_check(size);
00198         if(size == 0)
00199         {
00200             free_check(ptr);
00201             return 0L;
00202         }
00203
00204         ASSERT_RANGE(SIZE_FROM_PTR(ptr) > 0);
00205         CHECK_MAGIC(MAGIC1_FROM_PTR(ptr));
00206         CHECK_MAGIC(MAGIC2_FROM_PTR(ptr));
00207
00208         range = PTR_TO_RANGE(ptr);
00209         range = platform_realloc(range, size + RANGE_MAGIC_SIZE);
00210         if(range == 0L)
00211             return 0L;
00212
00213         result = RANGE_TO_PTR(range);
00214         SIZE_FROM_PTR(result) = size;
00215         FILL_MAGIC(MAGIC1_FROM_PTR(result));
00216         FILL_MAGIC(MAGIC2_FROM_PTR(result));
00217
00218         return result;
00219     }
00220 #   define platform_malloc malloc_check
00221 #   define platform_free free_check
00222 #   define platform_calloc calloc_check
00223 #   define platform_realloc realloc_check
00224 #endif /* qRangeCheck */
00225
00226 #if qRangeCheck && defined(macintosh)
00227 #ifdef __cplusplus
00228 extern "C"
00229 #endif
00230 void *  calloc(size_t nmemb, size_t   s)
00231 {
00232     return shl_calloc(nmemb, s, 0, 0L);
00233 }
00234
00235 #ifdef __cplusplus
00236 extern "C"
00237 #endif
00238 void    free(void *  p)
00239 {
00240     shl_free(p);
00241 }
00242
00243 #ifdef __cplusplus
00244 extern "C"
00245 #endif
00246 void *  malloc(size_t   s)
00247 {
00248     return shl_malloc(s, 0, 0L);
00249 }
00250
00251 #ifdef __cplusplus
00252 extern "C"
00253 #endif
00254 void *  realloc(void *   p, size_t   s)
00255 {
00256     return shl_realloc(p, s, 0, 0L);
00257 }
00258
00259 #endif
00260
00261 #define GARBY_DEF_ALLOC 20
00262 #define GARBY_DEF_POOL 20
00263 #define MODULE_SIZE 8
00264
00265 typedef struct _frameRec
00266 {
00267     void *entry;
00268 #if qCvsDebug
00269     char module[MODULE_SIZE];
00270     short line;
00271 #endif
00272     struct _frameRec *next;
00273 } frameRec;
00274
00275 typedef struct DYN_LIST
00276 {
00277     int numentries;
00278     int defaultnumcells;
00279     int sizeofcell;
00280     int totpage;
00281
00282     void *first;
00283     struct DYN_LIST *next;
00284     struct DYN_LIST *current;
00285 #ifdef hpux /* align 8 bytes for hpux */
00286     void *nothing;
00287 #endif /* hpux */
00288 } DYN_LIST;
00289
00290 typedef struct
00291 {
00292     frameRec *firstentry;
00293     frameRec *firstfree;
00294     DYN_LIST *pool;
00295 } poolRec, *poolPtr;
00296
00297 typedef struct
00298 {
00299     poolRec pools[GARBY_DEF_POOL];
00300 } garbyRec, *garbyPtr;
00301
00302 static garbyPtr gGarbage = NULL;
00303
00304 static DYN_LIST *
00305 listNew(int sizeOfCell, int numOfDefaultCell)
00306 {
00307     DYN_LIST *result;
00308
00309     result = (DYN_LIST *)platform_malloc(sizeof(DYN_LIST) + sizeOfCell * numOfDefaultCell);
00310     if(result == NULL)
00311     {
00312         fprintf(stderr, "failed to allocate %d bytes\n", sizeof(DYN_LIST) + sizeOfCell * numOfDefaultCell);
00313         exit(-1);
00314     }
00315
00316     result->numentries = result->totpage = 0;
00317     result->defaultnumcells = numOfDefaultCell;
00318     result->sizeofcell = sizeOfCell;
00319     result->next = NULL;
00320     result->current = result;
00321
00322     return result;
00323 }
00324
00325 static void
00326 listFree(DYN_LIST *list)
00327 {
00328     DYN_LIST *ptc1, *ptc2;
00329
00330     ptc1 = list;
00331     while(ptc1 != NULL)
00332     {
00333         ptc2 = ptc1;
00334         ptc1 = ptc1->next;
00335         platform_free(ptc2);
00336     }
00337 }
00338
00339 static void *
00340 listAddCell(DYN_LIST *list)
00341 {
00342     DYN_LIST *current;
00343
00344     current = list->current;
00345
00346     if(current->numentries == list->defaultnumcells)
00347     {
00348         current->next = (DYN_LIST *)platform_malloc(sizeof(DYN_LIST) + list->sizeofcell * list->defaultnumcells);
00349         if(current->next == NULL)
00350         {
00351             fprintf(stderr, "failed to allocate %d bytes\n", sizeof(DYN_LIST) + list->sizeofcell * list->defaultnumcells);
00352             exit(-1);
00353         }
00354
00355         current = current->next;
00356         current->numentries = 0;
00357         current->next = NULL;
00358         list->current = current;
00359         list->totpage++;
00360     }
00361
00362     return (char *)(current + 1) + current->numentries++ * list->sizeofcell;
00363 }
00364
00365 static int
00366 GARBY_KEY(void *address)
00367 {
00368     register unsigned long add = (unsigned long)address;
00369
00370     return (add >> 8) % GARBY_DEF_POOL;
00371 }
00372
00373 void
00374 garbyNew(void)
00375 {
00376     int i;
00377
00378 #if AUTO_INITALIZE
00379     if(gGarbage != 0L)
00380         return;
00381 #endif /* AUTO_INITALIZE */
00382
00383     gGarbage = (garbyPtr) platform_malloc(sizeof(garbyRec));
00384     if(gGarbage == NULL)
00385     {
00386         fprintf(stderr, "failed to allocate %d bytes\n", sizeof(garbyRec));
00387         exit(-1);
00388     }
00389
00390 #if qRangeCheck
00391     for(i = 0; i < GARBY_DEF_POOL; i++)
00392     {
00393         gGarbage->pools[i].firstentry = NULL;
00394         gGarbage->pools[i].firstfree = NULL;
00395         gGarbage->pools[i].pool = 0L;
00396     }
00397 #endif /* qRangeCheck */
00398     for(i = 0; i < GARBY_DEF_POOL; i++)
00399     {
00400         gGarbage->pools[i].firstentry = NULL;
00401         gGarbage->pools[i].firstfree = NULL;
00402         gGarbage->pools[i].pool = listNew(sizeof(frameRec), GARBY_DEF_ALLOC);
00403     }
00404 }
00405
00406 static void
00407 poolRemove(poolPtr collector, int reallyRemove, int verboseMemoryLeak, int *numLeaks)
00408 {
00409     frameRec *frame = collector->firstentry;
00410
00411 #if qRangeCheck
00412     DYN_LIST *pool;
00413     if(reallyRemove)
00414     {
00415         collector->firstentry = 0L;
00416         collector->firstfree = 0L;
00417     }
00418 #endif /* qRangeCheck */
00419
00420     while(frame != NULL)
00421     {
00422 #if qCvsDebug
00423         if(verboseMemoryLeak)
00424             fprintf(stderr, "MEMORY LEAK!: %s line:%d\n", frame->module, frame->line);
00425 #endif
00426         if(reallyRemove)
00427             platform_free(frame->entry);
00428         frame = frame->next;
00429         (*numLeaks)++;
00430     }
00431     if(reallyRemove)
00432     {
00433 #if qRangeCheck
00434         pool = collector->pool;
00435         collector->pool = 0L;
00436         listFree(pool);
00437 #else /* !qRangeCheck */
00438         listFree(collector->pool);
00439 #endif /* !qRangeCheck */
00440     }
00441 }
00442
00443 void
00444 garbyRemove(int verboseSummary, int verboseMemoryLeak)
00445 {
00446     int i;
00447     int numLeaks = 0;
00448     int reallyRemove = !verboseSummary;
00449
00450     if(gGarbage == NULL)
00451         return;
00452
00453     for(i = 0; i < GARBY_DEF_POOL; i++)
00454         poolRemove(&gGarbage->pools[i], reallyRemove, verboseMemoryLeak, &numLeaks);
00455
00456     if(reallyRemove)
00457     {
00458         platform_free(gGarbage);
00459         gGarbage = NULL;
00460     }
00461
00462 #if qCvsDebug
00463     if(verboseSummary)
00464         fprintf(stderr, "\nGarbage collection : purged %d allocations\n", numLeaks);
00465 #endif
00466 }
00467
00468 #if qRangeCheck
00469 static void
00470 garbyRangeCheck(void)
00471 {
00472     poolPtr collector;
00473     frameRec *frame;
00474     DYN_LIST *pool;
00475     int i;
00476
00477     if(gGarbage == 0L)
00478         return;
00479
00480     for(i = 0; i < GARBY_DEF_POOL; i++)
00481     {
00482         collector = &gGarbage->pools[i];
00483         pool = collector->pool;
00484         while(pool != 0L)
00485         {
00486             ASSERT_RANGE(SIZE_FROM_PTR(pool) > 0);
00487             CHECK_MAGIC(MAGIC1_FROM_PTR(pool));
00488             CHECK_MAGIC(MAGIC2_FROM_PTR(pool));
00489             pool = pool->next;
00490         }
00491
00492         frame = collector->firstentry;
00493
00494         while(frame != NULL)
00495         {
00496             ASSERT_RANGE(SIZE_FROM_PTR(frame->entry) > 0);
00497             CHECK_MAGIC(MAGIC1_FROM_PTR(frame->entry));
00498             CHECK_MAGIC(MAGIC2_FROM_PTR(frame->entry));
00499             frame = frame->next;
00500         }
00501     }
00502 }
00503 #endif /* qRangeCheck */
00504
00505 static void
00506 setModule(char *where, const char *what)
00507 {
00508     int len, cp;
00509
00510     if(what == 0L)
00511     {
00512         strcpy(where, "Unknown");
00513         return;
00514     }
00515
00516     cp = len = strlen(what);
00517     if(len > (MODULE_SIZE - 1))
00518         cp = MODULE_SIZE - 1;
00519
00520     memcpy(where, what + len - cp, cp * sizeof(char));
00521     where[cp] = '\0';
00522 }
00523
00524 #if qCvsDebug
00525 static void * poolAlloc(poolPtr pool, void *ptr, int line, const char *file)
00526 #else
00527 static void * poolAlloc(poolPtr pool, void *ptr)
00528 #endif
00529 {
00530     frameRec *newframe;
00531
00532     if(pool->firstfree != NULL)
00533     {
00534         /*
00535          * there is place already free inside collector
00536          */
00537         newframe = pool->firstfree;
00538         pool->firstfree = newframe->next;
00539     }
00540     else
00541     {
00542         /*
00543          * create a new entry into the pool
00544          */
00545         newframe = (frameRec *)listAddCell(pool->pool);
00546     }
00547
00548     newframe->entry = ptr;
00549     newframe->next = pool->firstentry;
00550     pool->firstentry = newframe;
00551
00552 #if qCvsDebug
00553     setModule(newframe->module, file);
00554     newframe->line = line;
00555 #endif
00556
00557     return ptr;
00558 }
00559
00560 static void * poolFree(register poolPtr garb, void *ptr)
00561 {
00562     frameRec *frame, *prev;
00563
00564     /*
00565      * if failed, collector is corrupted
00566      */
00567     frame = garb->firstentry;
00568     if(frame == NULL)
00569     {
00570 #ifdef macintosh
00571         /* only  on mac cause we are sure to intercept every allocations */
00572         fprintf(stderr, "panic ! memory collector is corrupted !\n");
00573         return NULL;
00574 #else /* !macintosh */
00575         return ptr;
00576 #endif /* !macintosh */
00577     }
00578
00579     /*
00580      * - we mark the entry to be free
00581      */
00582     if(frame->entry == ptr)
00583     {
00584         frame = garb->firstentry;
00585         garb->firstentry = frame->next;
00586     }
00587     else
00588     {
00589         prev = NULL;
00590         while(frame->entry != ptr)
00591         {
00592             prev = frame;
00593             frame = frame->next;
00594             /*
00595              * if failed, collector is corrupted
00596              */
00597             if(frame == NULL)
00598             {
00599 #ifdef macintosh
00600                 /* only  on mac cause we are sure to intercept every allocations */
00601                 fprintf(stderr, "panic ! memory collector is corrupted !\n");
00602                 return NULL;
00603 #else /* !macintosh */
00604                 return ptr;
00605 #endif /* !macintosh */
00606             }
00607         }
00608         prev->next = frame->next;
00609     }
00610
00611     /*
00612      * insert frame into free list
00613      */
00614     frame->next = garb->firstfree;
00615     garb->firstfree = frame;
00616
00617     return ptr;
00618 }
00619
00620 static void *garby_free(void *ptr);
00621 #define garbyFree(ptr) garby_free(ptr)
00622
00623 #if qCvsDebug
00624     static void *garby_alloc(void *ptr, int line, const char *file);
00625     static void *garby_realloc(void *ptr, void *newptr, int line, const char *file);
00626
00627 #   define garbyAlloc(ptr, line, file) garby_alloc(ptr, line, file)
00628 #   define garbyRealloc(ptr, NewPtr, line, file) garby_realloc(ptr, NewPtr, line, file)
00629 #else
00630     static void *garby_alloc(void *ptr);
00631     static void *garby_realloc(void *ptr, void *newptr);
00632
00633 #   define garbyAlloc(ptr, line, file) garby_alloc(ptr)
00634 #   define garbyRealloc(ptr, NewPtr, line, file) garby_realloc(ptr, NewPtr)
00635 #endif
00636
00637 #if qCvsDebug
00638 static void *garby_alloc(void *ptr, int line, const char *file)
00639 #else
00640 static void *garby_alloc(void *ptr)
00641 #endif
00642 {
00643 #if AUTO_INITALIZE
00644     if(gGarbage == 0L)
00645         garbyNew();
00646 #endif /* AUTO_INITALIZE */
00647
00648     if(gGarbage == NULL || ptr == NULL)
00649         return ptr;
00650
00651 #if qCvsDebug
00652     return poolAlloc(&gGarbage->pools[GARBY_KEY(ptr)], ptr, line, file);
00653 #else
00654     return poolAlloc(&gGarbage->pools[GARBY_KEY(ptr)], ptr);
00655 #endif
00656 }
00657
00658 static void *garby_free(void *ptr)
00659 {
00660     if(gGarbage == NULL || ptr == NULL)
00661         return ptr;
00662
00663     return poolFree(&gGarbage->pools[GARBY_KEY(ptr)], ptr);
00664 }
00665
00666 #if qCvsDebug
00667 static void *garby_realloc(void *ptr, void *newptr, int line, const char *file)
00668 #else
00669 static void *garby_realloc(void *ptr, void *newptr)
00670 #endif
00671 {
00672 #if AUTO_INITALIZE
00673     if(gGarbage == 0L)
00674         garbyNew();
00675 #endif /* AUTO_INITALIZE */
00676
00677     garby_free(ptr);
00678 #if qCvsDebug
00679     return garby_alloc(newptr, line, file);
00680 #else
00681     return garby_alloc(newptr);
00682 #endif
00683 }
00684
00685 #if qCvsDebug
00686 void *  shl_malloc(size_t size, int line, const char *file)
00687 #else
00688 void *  shl_malloc(size_t size)
00689 #endif
00690 {
00691     char *ptr;
00692
00693     if (size == 0)
00694         return NULL;
00695
00696     ptr = (char *)platform_malloc(size);
00697     return garbyAlloc(ptr, line, file);
00698 }
00699
00700 #if qCvsDebug
00701 void *  shl_calloc(size_t nmemb, size_t size, int line, const char *file)
00702 #else
00703 void *  shl_calloc(size_t nmemb, size_t size)
00704 #endif
00705 {
00706     char *ptr;
00707
00708     if (nmemb == 0 || size == 0)
00709         return NULL;
00710
00711     ptr = (char *)platform_calloc(nmemb, size);
00712     return garbyAlloc(ptr, line, file);
00713 }
00714
00715 #if qCvsDebug
00716 void *  shl_realloc(void * ptr, size_t size, int line, const char *file)
00717 #else
00718 void *  shl_realloc(void * ptr, size_t size)
00719 #endif
00720 {
00721     char *Newptr;
00722
00723     if (ptr == NULL)
00724     {
00725         Newptr = (char *)platform_malloc(size);
00726         return garbyAlloc(Newptr, line, file);
00727     }
00728
00729     if (size == 0)
00730     {
00731         platform_free(garbyFree(ptr));
00732         return NULL;
00733     }
00734
00735     Newptr = (char *)platform_realloc(ptr, size);
00736     if(Newptr == ptr)
00737         return ptr;
00738
00739     return garbyRealloc(ptr, Newptr, line, file);
00740 }
00741
00742 void    shl_free(void *ptr)
00743 {
00744     if (ptr != NULL)
00745         platform_free (garbyFree(ptr));
00746 }
00747
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/dll_garbage.h Source File

common/dll_garbage.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * dll_garbage.h --- memory garbage collection for the dll
00023  */
00024
00025 #ifndef DLL_GARBAGE_H
00026 #define DLL_GARBAGE_H
00027
00028 #include <stdlib.h>
00029 #ifdef WIN32
00030 #   include <malloc.h>
00031 #endif /* WIN32 */
00032
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036
00037 #if qCvsDebug
00038 #   define malloc(s) shl_malloc(s, __LINE__, __FILE__)
00039 #   define calloc(m, s) shl_calloc(m, s, __LINE__, __FILE__)
00040 #   define realloc(p, s) shl_realloc(p, s, __LINE__, __FILE__)
00041     void *  shl_calloc(size_t nmemb, size_t size, int line, const char *file);
00042     void *  shl_malloc(size_t size, int line, const char *file);
00043     void *  shl_realloc(void * ptr, size_t size, int line, const char *file);
00044 #else /* !qCvsDebug */
00045 #   define malloc shl_malloc
00046 #   define calloc shl_calloc
00047 #   define realloc shl_realloc
00048     void *  shl_calloc(size_t nmemb, size_t size);
00049     void *  shl_malloc(size_t size);
00050     void *  shl_realloc(void * ptr, size_t size);
00051 #endif /* !qCvsDebug */
00052
00053 #define free shl_free
00054 void shl_free(void *ptr);
00055
00056 void garbyNew(void);
00057 void garbyRemove(int verboseSummary, int verboseMemoryLeak);
00058
00059 #ifdef __cplusplus
00060 }
00061 #endif
00062
00063 #endif /* DLL_GARBAGE_H */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/dll_glue.c Source File

common/dll_glue.c

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * dll_glue.cpp --- glue code for the dll to communicate with the caller
00023  */
00024
00025 #ifdef HAVE_CONFIG_H
00026 #include "config.h"
00027 #endif /* HAVE_CONFIG_H */
00028
00029 #include <unistd.h>
00030 #include <stdio.h>
00031 #include <setjmp.h>
00032 #include <errno.h>
00033
00034 #include "dll_glue.h"
00035 #include "dll_garbage.h"
00036 #include "GUSIMSLSetup.h"
00037
00038 #if !TARGET_API_MAC_CARBON
00039     static UniversalProcPtr __glue_getenv = 0L;
00040     static UniversalProcPtr __glue_consoleout = 0L;
00041     static UniversalProcPtr __glue_consoleerr = 0L;
00042     static UniversalProcPtr __glue_consolein = 0L;
00043     static UniversalProcPtr __glue_eventdispatch = 0L;
00044 #else /* TARGET_API_MAC_CARBON */
00045     static dllglue_getenv_func __glue_getenv = 0L;
00046     static dllglue_consoleout_func __glue_consoleout = 0L;
00047     static dllglue_consoleout_func __glue_consoleerr = 0L;
00048     static dllglue_consolein_func __glue_consolein = 0L;
00049     static dllglue_eventdispath_func __glue_eventdispatch = 0L;
00050 #endif /* TARGET_API_MAC_CARBON */
00051
00052 static int __glue_exit_code = 0;
00053 static jmp_buf _glue_buf;
00054
00055 extern int main(int argc, char **argv);
00056
00057 void
00058 dllglue_flushconsole(void)
00059 {
00060     fflush(stdout);
00061     fflush(stderr);
00062 }
00063
00064 static void initialize_all(void)
00065 {
00066     GusiMSLSetWriteConsole(dllglue_consoleout);
00067     GusiMSLSetErrConsole(dllglue_consoleerr);
00068     GusiMSLSetInConsole(dllglue_consolein);
00069     GusiMSLSetHandleEvent(dllglue_dispatchevent);
00070 }
00071
00072 static void flush_all(void)
00073 {
00074     garbyRemove(true, false);
00075     dllglue_flushconsole();
00076     dllglue_setgetenv(0L);
00077     dllglue_setconsoleout(0L);
00078     dllglue_setconsoleerr(0L);
00079     dllglue_setconsolein(0L);
00080     dllglue_seteventdispatch(0L);
00081 }
00082
00083 void
00084 dllglue_exit(int code)
00085 {
00086     __glue_exit_code = code;
00087     longjmp(_glue_buf, 1);
00088 }
00089
00090 char *
00091 dllglue_getenv(const char * name)
00092 {
00093     if(__glue_getenv != 0L)
00094     {
00095 #if !TARGET_API_MAC_CARBON
00096         return (char *)CallUniversalProc(__glue_getenv, uppGetEnvProcInfo, name);
00097 #else /* TARGET_API_MAC_CARBON */
00098         return __glue_getenv(name);
00099 #endif /* TARGET_API_MAC_CARBON */
00100     }
00101     return 0L;
00102 }
00103
00104 long dllglue_consoleout(char *buffer, long n)
00105 {
00106 #if !TARGET_API_MAC_CARBON
00107     if(__glue_consoleout != 0L)
00108     {
00109         return (int)CallUniversalProc(__glue_consoleout, uppConsoleOutProcInfo, buffer, n);
00110     }
00111 #else
00112     if(__glue_consoleout != 0L)
00113     {
00114         return __glue_consoleout(buffer, n);
00115     }
00116 #endif
00117     return 0;
00118 }
00119
00120 long dllglue_consoleerr(char *buffer, long n)
00121 {
00122 #if !TARGET_API_MAC_CARBON
00123     if(__glue_consoleerr != 0L)
00124     {
00125         return (int)CallUniversalProc(__glue_consoleerr, uppConsoleOutProcInfo, buffer, n);
00126     }
00127 #else
00128     if(__glue_consoleerr != 0L)
00129     {
00130         return __glue_consoleerr(buffer, n);
00131     }
00132 #endif
00133     return 0;
00134 }
00135
00136 long dllglue_consolein(char *buffer, long n)
00137 {
00138 #if !TARGET_API_MAC_CARBON
00139     if(__glue_consolein != 0L)
00140     {
00141         return (int)CallUniversalProc(__glue_consolein, uppConsoleInProcInfo, buffer, n);
00142     }
00143 #else
00144     if(__glue_consolein != 0L)
00145     {
00146         return __glue_consolein(buffer, n);
00147     }
00148 #endif
00149     return 0;
00150 }
00151
00152 int dllglue_dispatchevent(EventRecord *userevent)
00153 {
00154 #if !TARGET_API_MAC_CARBON
00155     if(__glue_eventdispatch != 0L)
00156     {
00157         return (int)CallUniversalProc(__glue_eventdispatch, uppEventDispatchProcInfo, userevent);
00158     }
00159 #else
00160     if(__glue_eventdispatch != 0L)
00161     {
00162         return __glue_eventdispatch(userevent);
00163     }
00164 #endif
00165     return 0;
00166 }
00167
00168 int
00169 dllglue_main(const char *path, int argc, char **argv)
00170 {
00171     if(setjmp(_glue_buf) == 0)
00172     {
00173         initialize_all();
00174
00175         if(path != 0L && chdir(path) != 0)
00176         {
00177             fprintf(stderr, "Error: Unable to chdir %s (error %d)\n", path, errno);
00178             exit(1);
00179         }
00180
00181         main(argc, argv);
00182     }
00183     else
00184     {
00185     }
00186
00187     flush_all();
00188
00189     return __glue_exit_code;
00190 }
00191
00192 int
00193 dllglue_decode_file(char *infile)
00194 {
00195     if(setjmp(_glue_buf) == 0)
00196     {
00197         initialize_all();
00198
00199         __glue_exit_code = decode_file (infile);
00200     }
00201     else
00202     {
00203     }
00204
00205     flush_all();
00206
00207     return __glue_exit_code;
00208 }
00209
00210 int
00211 #if !TARGET_API_MAC_CARBON
00212 dllglue_setgetenv(UniversalProcPtr agetenv)
00213 #else /* TARGET_API_MAC_CARBON */
00214 dllglue_setgetenv(dllglue_getenv_func agetenv)
00215 #endif /* TARGET_API_MAC_CARBON */
00216 {
00217     if(__glue_getenv != 0L)
00218     {
00219 #if !TARGET_API_MAC_CARBON
00220         DisposeRoutineDescriptor(__glue_getenv);
00221 #endif /* !TARGET_API_MAC_CARBON */
00222         __glue_getenv = 0L;
00223     }
00224     __glue_getenv = agetenv;
00225     return 0;
00226 }
00227
00228 #if !TARGET_API_MAC_CARBON
00229 int
00230 dllglue_seteventdispatch(UniversalProcPtr aeventdispatch)
00231 #else
00232 int
00233 dllglue_seteventdispatch(dllglue_eventdispath_func aeventdispatch)
00234 #endif
00235 {
00236 #if !TARGET_API_MAC_CARBON
00237     if(__glue_eventdispatch != 0L)
00238     {
00239         DisposeRoutineDescriptor(__glue_eventdispatch);
00240         __glue_eventdispatch = 0L;
00241     }
00242 #endif
00243     __glue_eventdispatch = aeventdispatch;
00244     return 0;
00245 }
00246
00247 int
00248 #if !TARGET_API_MAC_CARBON
00249 dllglue_setconsoleout(UniversalProcPtr aconsoleout)
00250 #else /* TARGET_API_MAC_CARBON */
00251 dllglue_setconsoleout(dllglue_consoleout_func aconsoleout)
00252 #endif /* TARGET_API_MAC_CARBON */
00253 {
00254     if(__glue_consoleout != 0L)
00255     {
00256 #if !TARGET_API_MAC_CARBON
00257         DisposeRoutineDescriptor(__glue_consoleout);
00258 #endif /* !TARGET_API_MAC_CARBON */
00259         __glue_consoleout = 0L;
00260     }
00261     __glue_consoleout = aconsoleout;
00262     return 0;
00263 }
00264
00265 int
00266 #if !TARGET_API_MAC_CARBON
00267 dllglue_setconsoleerr(UniversalProcPtr aconsoleerr)
00268 #else /* TARGET_API_MAC_CARBON */
00269 dllglue_setconsoleerr(dllglue_consoleout_func aconsoleerr)
00270 #endif /* TARGET_API_MAC_CARBON */
00271 {
00272     if(__glue_consoleerr != 0L)
00273     {
00274 #if !TARGET_API_MAC_CARBON
00275         DisposeRoutineDescriptor(__glue_consoleerr);
00276 #endif /* !TARGET_API_MAC_CARBON */
00277         __glue_consoleerr = 0L;
00278     }
00279     __glue_consoleerr = aconsoleerr;
00280     return 0;
00281 }
00282
00283 int
00284 #if !TARGET_API_MAC_CARBON
00285 dllglue_setconsolein(UniversalProcPtr aconsolein)
00286 #else /* TARGET_API_MAC_CARBON */
00287 dllglue_setconsolein(dllglue_consolein_func aconsolein)
00288 #endif /* TARGET_API_MAC_CARBON */
00289 {
00290     if(__glue_consolein != 0L)
00291     {
00292 #if !TARGET_API_MAC_CARBON
00293         DisposeRoutineDescriptor(__glue_consolein);
00294 #endif /* !TARGET_API_MAC_CARBON */
00295         __glue_consolein = 0L;
00296     }
00297     __glue_consolein = aconsolein;
00298     return 0;
00299 }
00300
00301 //
00302 // Runtime intialization
00303 //
00304
00305 // from Metrowerks runtime
00306 extern pascal OSErr __initialize(CFragConnectionID connID);
00307 extern pascal void __terminate(void);
00308
00309 // for cvs
00310 pascal OSErr __cvs_initialize(const CFragInitBlock * theInitBlock);
00311 pascal void __cvs_terminate(void);
00312
00313 FSSpec sCvsContainerFileSpec;
00314
00315 pascal OSErr __cvs_initialize(const CFragInitBlock * theInitBlock)
00316 {
00317     OSErr result = noErr;
00318
00319     if(CFragHasFileLocation(theInitBlock->fragLocator.where) &&
00320         theInitBlock->fragLocator.u.onDisk.fileSpec != 0L)
00321     {
00322         sCvsContainerFileSpec = *theInitBlock->fragLocator.u.onDisk.fileSpec;
00323     }
00324     garbyNew();
00325
00326     result = __initialize(theInitBlock->connectionID);
00327
00328     return result;
00329 }
00330
00331 pascal void __cvs_terminate(void)
00332 {
00333     __terminate();
00334
00335     garbyRemove(false, false);
00336 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/dll_glue.h Source File

common/dll_glue.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * dll_glue.h --- glue code for the dll to communicate with the caller
00023  */
00024
00025 #ifndef DLL_GLUE_H
00026 #define DLL_GLUE_H
00027
00028 #include <stdlib.h>
00029 #include "dll_process.h"
00030 #include <Events.h>
00031
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035
00036 #pragma export on
00037
00038 int dllglue_decode_file (char *infile);
00039 int dllglue_main(const char *path, int argc, char **argv);
00040 #if !TARGET_API_MAC_CARBON
00041     int dllglue_setgetenv(UniversalProcPtr agetenv);
00042     int dllglue_setconsoleout(UniversalProcPtr aconsoleout);
00043     int dllglue_setconsoleerr(UniversalProcPtr aconsoleerr);
00044     int dllglue_setconsolein(UniversalProcPtr aconsolein);
00045     int dllglue_seteventdispatch(UniversalProcPtr adispatch);
00046 #else /* TARGET_API_MAC_CARBON */
00047     int dllglue_setgetenv(dllglue_getenv_func agetenv);
00048     int dllglue_setconsoleout(dllglue_consoleout_func aconsoleout);
00049     int dllglue_setconsoleerr(dllglue_consoleout_func aconsoleerr);
00050     int dllglue_setconsolein(dllglue_consolein_func aconsolein);
00051     int dllglue_seteventdispatch(dllglue_eventdispath_func adispatch);
00052 #endif /* TARGET_API_MAC_CARBON */
00053
00054 #pragma export reset
00055
00056 /* glue code to intercept the getenv and exit */
00057 #define exit dllglue_exit
00058 #define getenv dllglue_getenv
00059
00060 void dllglue_exit(int code);
00061 char * dllglue_getenv(const char *);
00062
00063 int dllglue_dispatchevent(EventRecord *userevent);
00064 long dllglue_consoleout(char *buffer, long n);
00065 long dllglue_consoleerr(char *buffer, long n);
00066 long dllglue_consolein(char *buffer, long n);
00067
00068 /* console management, captures stdout and stderr */
00069 void dllglue_flushconsole(void);
00070
00071 #ifdef __cplusplus
00072 }
00073 #endif
00074
00075 #endif /* DLL_GLUE_H */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/dll_loader.c Source File

common/dll_loader.c

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * dll_loader.cpp --- code to load dynamic code
00023  */
00024
00025 #ifdef HAVE_CONFIG_H
00026 #   include "config.h"
00027 #endif /* HAVE_CONFIG_H */
00028
00029 #if !defined(WIN32) && !defined(macintosh)
00030 #   include "dynl.h"
00031 #endif /* !WIN32 && !macintosh */
00032
00033 #ifdef WIN32
00034 #   include <windows.h>
00035 #endif /* WIN32 */
00036
00037 #include <string.h>
00038
00039 #include "dll_loader.h"
00040
00041 #if defined(macintosh) && !TARGET_API_MAC_CARBON
00042     RoutineDescriptor sCompatProcRD;
00043     UniversalProcPtr sCompatProc;
00044 #else /* !macintosh || TARGET_API_MAC_CARBON */
00045     void *sCompatProc;
00046 #endif /* !macintosh || TARGET_API_MAC_CARBON */
00047
00048 #ifdef macintosh
00049 #   include <TextUtils.h>
00050     static ProcPtr getSymFunction(CompatConnectID connID, const Str255 name)
00051     {
00052         long symCount;
00053         Ptr symAddr;
00054         int i;
00055         OSErr err = CountSymbols(connID, &symCount);
00056         if(err != noErr)
00057             return 0L;
00058
00059         for(i = 0; i < symCount; i++)
00060         {
00061             CFragSymbolClass symClass;
00062             Str255 symName;
00063             err = GetIndSymbol(connID, i, symName, &symAddr, &symClass);
00064             if(err != noErr)
00065                 return 0L;
00066             if(memcmp(symName, name, name[0]) == 0)
00067                 break;
00068         }
00069         if(i == symCount)
00070             return 0L;
00071         return (ProcPtr)symAddr;
00072     }
00073 #endif /* macintosh */
00074
00075 int
00076 CompatLoadLibrary(CompatConnectID * connID, const char *name_dll)
00077 {
00078     if(connID == 0L)
00079         return 0;
00080
00081 #ifdef macintosh
00082     {
00083     OSErr err;
00084     Ptr mainAddr;
00085     Str255 errMessage;
00086     Str255 pname;
00087
00088     c2pstrcpy(pname, name_dll);
00089     err = GetSharedLibrary(pname, kPowerPCCFragArch, kPrivateCFragCopy, connID, &mainAddr, errMessage);
00090     return err == noErr;
00091     }
00092 #elif defined(WIN32)
00093     *connID = LoadLibrary(name_dll);
00094
00095     return (*connID) != 0L;
00096 #else /* !WIN32 && !macintosh */
00097     *connID = dynl_link(name_dll);
00098     return (*connID) != 0L;
00099 #endif /* !WIN32 && !macintosh */
00100 }
00101
00102 int
00103 CompatCloseLibrary(CompatConnectID * connID)
00104 {
00105     if(connID == 0L)
00106         return 0;
00107
00108 #ifdef macintosh
00109     CloseConnection(connID);
00110     return 1;
00111 #elif defined(WIN32)
00112     FreeLibrary(*connID);
00113     connID = 0L;
00114     return 1;
00115 #else /* !WIN32 && !macintosh */
00116     dynl_unlink(*connID);
00117     connID = 0L;
00118     return 1;
00119 #endif /* !WIN32 && !macintosh */
00120 }
00121
00122 #if defined(macintosh) && !TARGET_API_MAC_CARBON
00123 UniversalProcPtr
00124 _CompatCallLibrary(CompatConnectID connID, long id_func, const char *name_func)
00125 #else /* !macintosh || TARGET_API_MAC_CARBON */
00126 void *
00127 _CompatCallLibrary(CompatConnectID connID, const char *name_func)
00128 #endif /* !macintosh || TARGET_API_MAC_CARBON */
00129 {
00130 #ifdef macintosh
00131     ProcPtr symAddr;
00132     UniversalProcPtr proc;
00133     Str255 pname;
00134
00135     c2pstrcpy(pname, name_func);
00136
00137     symAddr = getSymFunction(connID, pname);
00138 #   if TARGET_API_MAC_CARBON
00139     return symAddr;
00140 #   else
00141     if(symAddr == 0L)
00142         return 0L;
00143
00144     proc = NewRoutineDescriptor(symAddr, id_func, kPowerPCISA);
00145     return proc;
00146 #   endif
00147 #elif defined(WIN32)
00148     return GetProcAddress(connID, name_func);
00149 #else /* !WIN32 && !macintosh */
00150     return dynl_func(name_func, connID);
00151 #endif /* !WIN32 && !macintosh */
00152 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/dll_loader.h Source File

common/dll_loader.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- December 1997
00019  */
00020
00021 /*
00022  * dll_loader.h --- code to load dynamic code
00023  */
00024
00025 #ifndef DLLLOADER_H
00026 #define DLLLOADER_H
00027
00028 #ifdef macintosh
00029 #   include <CodeFragments.h>
00030     typedef CFragConnectionID CompatConnectID;
00031 #elif defined(WIN32)
00032     typedef HINSTANCE CompatConnectID;
00033 #else /* !macintosh && !WIN32 */
00034 #   include <dlfcn.h>
00035     typedef void *CompatConnectID;
00036 #endif /* !macintosh && !WIN32 */
00037
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041
00042 int CompatLoadLibrary(CompatConnectID * connID, const char *name_dll);
00043     // return false if failed
00044     // mac : name_dll is the fragment name of the shared library
00045     // others : name_dll is the filename of the library
00046
00047 int CompatCloseLibrary(CompatConnectID * connID);
00048     // unload the shared library, connID should not
00049     // be used anymore after this call
00050
00051 // CompatCallLibrary(CompatConnectID ID, <atype> result, macFuncDescInfo idf,
00052 //     const char *nf, <atype> tf, <arguments...>
00053 //
00054 // Call a function named "nf", prototype "tf", macDescInfo idf (0 if not mac)
00055 // with the arguments "a1", "a2"... and put the result in "res"
00056
00057 #if defined(macintosh) && !TARGET_API_MAC_CARBON
00058     extern UniversalProcPtr sCompatProc;
00059 #   define CompatCallLibrary1(ID, res, idf, nf, tf, a1) \
00060         ( \
00061             sCompatProc = _CompatCallLibrary(ID, idf, nf), \
00062             res = sCompatProc != NULL ? \
00063                 CallUniversalProc(sCompatProc, idf, a1) : res, \
00064             sCompatProc != NULL ? (DisposeRoutineDescriptor(sCompatProc), true) : false \
00065         )
00066 #   define CompatCallLibrary2(ID, res, idf, nf, tf, a1, a2) \
00067         ( \
00068             sCompatProc = _CompatCallLibrary(ID, idf, nf), \
00069             res = sCompatProc != NULL ? \
00070                 CallUniversalProc(sCompatProc, idf, a1, a2) : res, \
00071             sCompatProc != NULL ? (DisposeRoutineDescriptor(sCompatProc), true) : false \
00072         )
00073 #   define CompatCallLibrary3(ID, res, idf, nf, tf, a1, a2, a3) \
00074         ( \
00075             sCompatProc = _CompatCallLibrary(ID, idf, nf), \
00076             res = sCompatProc != NULL ? \
00077                 CallUniversalProc(sCompatProc, idf, a1, a2, a3) : res, \
00078             sCompatProc != NULL ? (DisposeRoutineDescriptor(sCompatProc), true) : false \
00079         )
00080     UniversalProcPtr _CompatCallLibrary(CompatConnectID connID, long id_func, const char *name_func);
00081 #else /* !macintosh || TARGET_API_MAC_CARBON */
00082     extern void *sCompatProc;
00083 #   define CompatCallLibrary1(ID, res, idf, nf, tf, a1) \
00084         ( \
00085             sCompatProc = _CompatCallLibrary(ID, nf), \
00086             res = sCompatProc != NULL ? \
00087                 ((tf)sCompatProc)(a1) : res, \
00088             sCompatProc != NULL \
00089         )
00090 #   define CompatCallLibrary2(ID, res, idf, nf, tf, a1, a2) \
00091         ( \
00092             sCompatProc = _CompatCallLibrary(ID, nf), \
00093             res = sCompatProc != NULL ? \
00094                 ((tf)sCompatProc)(a1, a2) : res, \
00095             sCompatProc != NULL \
00096         )
00097 #   define CompatCallLibrary3(ID, res, idf, nf, tf, a1, a2, a3) \
00098         ( \
00099             sCompatProc = _CompatCallLibrary(ID, nf), \
00100             res = sCompatProc != NULL ? \
00101                 ((tf)sCompatProc)(a1, a2, a3) : res, \
00102             sCompatProc != NULL \
00103         )
00104     void *_CompatCallLibrary(CompatConnectID connID, const char *name_func);
00105 #endif /* !macintosh || TARGET_API_MAC_CARBON */
00106
00107 // used with CompatCallLibrary when you want to give a function
00108 // as an argument : for mac funcInfo is the desc. of the function
00109 // arguments, if not 0
00110
00111 #if defined(macintosh) && !TARGET_API_MAC_CARBON
00112 #   define CompatFuncArg(funcInfo, func) \
00113         NewRoutineDescriptor((ProcPtr)func, funcInfo, kPowerPCISA)
00114 #else /* !macintosh || TARGET_API_MAC_CARBON */
00115 #   define CompatFuncArg(funcInfo, func) func
00116 #endif /* macintosh || TARGET_API_MAC_CARBON */
00117
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121
00122 #endif /* DLLLOADER_H */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/dll_process.h Source File

common/dll_process.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- March 1998
00019  */
00020
00021 /*
00022  * dll_process.h --- allow to simulate a process using the dll mechanism
00023  */
00024
00025 #ifndef DLL_PROCESS_H
00026 #define DLL_PROCESS_H
00027
00028 #ifdef macintosh
00029 #   include <CodeFragments.h>
00030 #   include <Events.h>
00031 #endif
00032
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036
00037 #if defined(macintosh) && !TARGET_API_MAC_CARBON
00038     enum {
00039         uppGetEnvProcInfo = kCStackBased
00040             | RESULT_SIZE(SIZE_CODE(sizeof(char *)))
00041             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *)))
00042     };
00043
00044     enum {
00045         uppConsoleOutProcInfo = kCStackBased
00046             | RESULT_SIZE(SIZE_CODE(sizeof(long)))
00047             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *)))
00048             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
00049     };
00050
00051     enum {
00052         uppConsoleInProcInfo = kCStackBased
00053             | RESULT_SIZE(SIZE_CODE(sizeof(long)))
00054             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *)))
00055             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
00056     };
00057
00058     enum {
00059         uppMainProcInfo = kCStackBased
00060             | RESULT_SIZE(SIZE_CODE(sizeof(int)))
00061             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *)))
00062             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(int)))
00063             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(char **)))
00064     };
00065
00066     enum {
00067         uppSetGlueProcInfo = kCStackBased
00068             | RESULT_SIZE(SIZE_CODE(sizeof(int)))
00069             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UniversalProcPtr)))
00070     };
00071
00072     enum {
00073         uppEventDispatchProcInfo = kCStackBased
00074             | RESULT_SIZE(SIZE_CODE(sizeof(int)))
00075             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void */*EventRecord **/)))
00076     };
00077
00078     enum {
00079         uppDecodeFileProcInfo = kCStackBased
00080             | RESULT_SIZE(SIZE_CODE(sizeof(int)))
00081             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *)))
00082     };
00083 #else /* !macintosh || TARGET_API_MAC_CARBON */
00084     typedef char * (*dllglue_getenv_func) (const char *);
00085     typedef long (*dllglue_consoleout_func) (char *, long);
00086     typedef long (*dllglue_consolein_func) (char *, long);
00087     typedef int (*dllglue_main_func) (const char *, int, char**);
00088     typedef int (*dllglue_setglue_func) (void *);
00089 #   if TARGET_API_MAC_CARBON
00090     typedef int (*dllglue_eventdispath_func) (EventRecord *);
00091     typedef int (*dllglue_decode_file_func) (char *);
00092 #   endif
00093 #endif /* !macintosh || TARGET_API_MAC_CARBON */
00094
00095 #ifdef __cplusplus
00096 }
00097 #endif
00098
00099 #endif /* DLL_PROCESS_H */
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/EditorMonDlg.cpp Source File

common/EditorMonDlg.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- October 2001
00019  */
00020
00021 /*
00022  * EditorMonDlg.cpp --- editor monitor dialog
00023  */
00024
00025 #include "stdafx.h"
00026 #include "CvsPrefs.h"
00027 #include "TextBinary.h"
00028
00029 #ifdef WIN32
00030 #include "wincvs.h"
00031 #include "EditorMonDlg.h"
00032 #endif /* WIN32 */
00033
00034 #ifdef _DEBUG
00035 #define new DEBUG_NEW
00036 #undef THIS_FILE
00037 static char THIS_FILE[] = __FILE__;
00038 #endif
00039
00041 // CEditorMonDlg dialog
00042
00043 #ifdef WIN32
00044
00045 CEditorMonDlg::CEditorMonDlg(CWnd* pParent /*=NULL*/)
00046     : CDialog(CEditorMonDlg::IDD, pParent)
00047 {
00048     //{{AFX_DATA_INIT(CEditorMonDlg)
00049     m_tempFile = _T("");
00050     //}}AFX_DATA_INIT
00051 }
00052
00053
00054 void CEditorMonDlg::DoDataExchange(CDataExchange* pDX)
00055 {
00056     CDialog::DoDataExchange(pDX);
00057     //{{AFX_DATA_MAP(CEditorMonDlg)
00058     DDX_Text(pDX, IDC_TEMPFILE, m_tempFile);
00059     //}}AFX_DATA_MAP
00060 }
00061
00062
00063 BEGIN_MESSAGE_MAP(CEditorMonDlg, CDialog)
00064     //{{AFX_MSG_MAP(CEditorMonDlg)
00065     ON_WM_DESTROY()
00066     ON_WM_TIMER()
00067     //}}AFX_MSG_MAP
00068 END_MESSAGE_MAP()
00069
00071 // CEditorMonDlg message handlers
00072
00073 void CEditorMonDlg::OnDestroy()
00074 {
00075     if( m_timer )
00076     {
00077         KillTimer(m_timer);
00078     }
00079
00080     CDialog::OnDestroy();
00081 }
00082
00083 BOOL CEditorMonDlg::OnInitDialog()
00084 {
00085     CDialog::OnInitDialog();
00086
00087     // Extra initialization here
00088     m_timer = SetTimer(2048, 200, NULL);
00089
00090     return TRUE;  // return TRUE unless you set the focus to a control
00091                   // EXCEPTION: OCX Property Pages should return FALSE
00092 }
00093
00094 void CEditorMonDlg::OnTimer(UINT nIDEvent)
00095 {
00096     if( nIDEvent == m_timer && INVALID_HANDLE_VALUE != m_hProcess )
00097     {
00098         int status = WaitForSingleObject( m_hProcess, 0 );
00099         if( status == WAIT_OBJECT_0 )   //have been terminated...
00100         {
00101             EndDialog(IDOK);
00102         }
00103     }
00104
00105     CDialog::OnTimer(nIDEvent);
00106 }
00107
00108 #endif /* WIN32 */
00109
00110 bool CompatGetEditorMsg(UStr& message)
00111 {
00112     bool msgOK = false;
00113
00114 #ifdef WIN32
00115
00116     if(gCvsPrefs.Viewer() == 0L)
00117     {
00118         AfxMessageBox("You need to define a default viewer in the preferences", MB_OK | MB_ICONSTOP);
00119         return msgOK;
00120     }
00121
00122     CStr tmpFile;
00123     if( MakeTmpFile(tmpFile, "LogMsg", "tmp", true) )
00124     {
00125         //launch editor
00126         PROCESS_INFORMATION sProcessInformation;
00127         if( LaunchEditor( tmpFile, (void*)&sProcessInformation ) )
00128         {
00129             //we don't need the thread's handle so close it now
00130             CloseHandle( sProcessInformation.hThread );
00131
00132             //track the editor until it closes
00133             CStr uppath, folder;
00134             SplitPath(tmpFile, uppath, folder);
00135
00136             CEditorMonDlg editorMonDlg;
00137             editorMonDlg.m_hProcess = sProcessInformation.hProcess;
00138             editorMonDlg.m_tempFile = folder;
00139
00140             if( editorMonDlg.DoModal() == IDOK )
00141             {
00142                 msgOK = true;
00143             }
00144             else
00145             {
00146                 if( PostThreadMessage(sProcessInformation.dwThreadId, WM_QUIT, (WPARAM)EXIT_SUCCESS, 0) )
00147                 {
00148                     WaitForSingleObject( sProcessInformation.hProcess, 500 );
00149                 }
00150
00151                 int nStatus = WaitForSingleObject( sProcessInformation.hProcess, 0 );
00152                 if( nStatus != WAIT_OBJECT_0 )
00153                 {
00154                     TerminateProcess(sProcessInformation.hProcess, EXIT_SUCCESS);
00155                 }
00156             }
00157
00158             CloseHandle(sProcessInformation.hProcess);
00159         }
00160
00161         //copy the file into message string
00162         FILE* stream = fopen(tmpFile, "r");
00163         if( stream )
00164         {
00165             char line[100];
00166             while( fgets(line, 100, stream) )
00167             {
00168                 message << line;
00169             }
00170             fclose(stream);
00171         }
00172
00173         //cleanup
00174         ::DeleteFile(tmpFile);
00175     }
00176
00177 #if 0
00178     adminOptionDlg.m_optionString = (const char*)optionString;
00179     if( adminOptionDlg.DoModal() == IDOK )
00180     {
00181         optionString = (const char*)adminOptionDlg.m_optionString;
00182         userHitOK = true;
00183     }
00184 #endif
00185
00186 #endif /* WIN32 */
00187
00188 // the code below might help to do stuff on Unix or Mac later on
00189 #if 0
00190     const char * argv[2] = { 0L, 0L };
00191     CStr program;
00192     if(strchr(gCvsPrefs.Viewer(), ' ') != 0L)
00193     {
00194         program << '\"';
00195         program << gCvsPrefs.Viewer();
00196         program << '\"';
00197     }
00198     else
00199         program = gCvsPrefs.Viewer();
00200
00201     argv[0] = program;
00202     int process = _spawnvp(_P_NOWAIT, gCvsPrefs.Viewer(), argv);
00203 #endif
00204
00205
00206 #ifdef qMacCvsPP
00207 #endif /* qMacCvsPP */
00208 #if qUnix
00209 #endif // qUnix
00210
00211     return msgOK;
00212 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/EditorMonDlg.h Source File

common/EditorMonDlg.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Jerzy Kaczorowski <kaczoroj@hotmail.com> --- October 2001
00019  */
00020
00021 /*
00022  * EditorMonDlg.h --- editor monitor dialog
00023  */
00024
00025 #if !defined(AFX_EDITORMONDLG_H__5146BF16_567B_4017_A1FD_619A7BD07906__INCLUDED_)
00026 #define AFX_EDITORMONDLG_H__5146BF16_567B_4017_A1FD_619A7BD07906__INCLUDED_
00027
00028 #if _MSC_VER > 1000
00029 #pragma once
00030 #endif // _MSC_VER > 1000
00031 // EditorMonDlg.h : header file
00032 //
00033
00034 bool CompatGetEditorMsg(UStr& message);
00035     // launch and monitor editor to get log message
00036
00038 // CEditorMonDlg dialog
00039
00040 #ifdef WIN32
00041
00042 class CEditorMonDlg : public CDialog
00043 {
00044 // Construction
00045 public:
00046     CEditorMonDlg(CWnd* pParent = NULL);   // standard constructor
00047
00048 // Dialog Data
00049     //{{AFX_DATA(CEditorMonDlg)
00050     enum { IDD = IDD_EDITORMON };
00051     CString m_tempFile;
00052     //}}AFX_DATA
00053
00054
00055 // Overrides
00056     // ClassWizard generated virtual function overrides
00057     //{{AFX_VIRTUAL(CEditorMonDlg)
00058     protected:
00059     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00060     //}}AFX_VIRTUAL
00061
00062 // Implementation
00063 protected:
00064
00065     // Generated message map functions
00066     //{{AFX_MSG(CEditorMonDlg)
00067     afx_msg void OnDestroy();
00068     virtual BOOL OnInitDialog();
00069     afx_msg void OnTimer(UINT nIDEvent);
00070     //}}AFX_MSG
00071     DECLARE_MESSAGE_MAP()
00072 public:
00073     HANDLE m_hProcess;
00074 private:
00075     UINT m_timer;
00076 };
00077
00078 //{{AFX_INSERT_LOCATION}}
00079 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00080
00081 #endif /* WIN32 */
00082
00083 #endif // !defined(AFX_EDITORMONDLG_H__5146BF16_567B_4017_A1FD_619A7BD07906__INCLUDED_)
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/FileTraversal.cpp Source File

common/FileTraversal.cpp

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 /*
00022  * FileTraversal.cpp : class to traverse a file hierarchy
00023  */
00024
00025 #include "stdafx.h"
00026
00027 #ifdef WIN32
00028 #   include "resource.h"
00029 #endif /* WIN32 */
00030
00031 #ifdef macintosh
00032 #   include "GUSIInternal.h"
00033 #   include "GUSIFileSpec.h"
00034 #   include "GUSIDevice.h"
00035 #   include <unistd.h>
00036 #endif /* macintosh */
00037
00038 #ifdef HAVE_UNISTD_H
00039 #   include <unistd.h>
00040 #endif /* HAVE_UNISTD_H */
00041
00042 #ifdef HAVE_ERRNO_H
00043 #   include <errno.h>
00044 #endif /* HAVE_ERRNO_H */
00045
00046 #include "FileTraversal.h"
00047 #include "CPStr.h"
00048 #include "umain.h"
00049
00050 #ifdef WIN32
00051 #   include "AppConsole.h"
00052 #   include "wincvsdebug.h"
00053
00054 #   ifdef _DEBUG
00055 #   define new DEBUG_NEW
00056 #   undef THIS_FILE
00057     static char THIS_FILE[] = __FILE__;
00058 #   endif
00059 #endif /* WIN32 */
00060
00061 // in order to accelerate GUSI, we avoid using full paths
00062 #ifdef macintosh
00063 typedef GUSIDirectory * GUSIDirPtr;
00064
00065 static DIR * opendir(const GUSIFileSpec & spec)
00066 {
00067     GUSIFileToken   file(spec, GUSIFileToken::kWillOpendir);
00068
00069     GUSIDirectory * dir;
00070     if (GUSIDevice * device = file.Device())
00071         dir = device->opendir(file);
00072     else
00073     {
00074         GUSISetPosixError(ENOENT);
00075         dir = static_cast<GUSIDirectory *>(nil);
00076     }
00077
00078     return dir ? reinterpret_cast<DIR *>(new GUSIDirPtr(dir)) : 0;
00079 }
00080
00081 static int stat(const GUSIFileSpec & inspec, struct stat * sb)
00082 {
00083     GUSIFileToken   file(inspec, GUSIFileToken::kWillStat);
00084
00085     if (GUSIDevice * device = file.Device())
00086         return device->stat(file, sb);
00087
00088     GUSISetPosixError(ENOENT);
00089     return -1;
00090 }
00091 #endif
00092
00093 bool TraversalReport::gRunning = false;
00094
00095 kTraversal FileTraverse(const char *path, TraversalReport & report, const FSSpec * macDirSpec)
00096 {
00097     DIR *dirp = 0L;
00098     STRUCT_DIRENT *dp;
00099     struct stat sb;
00100     CStr fullname, errstr, dirname, tmpname;
00101     kTraversal res = kContinueTraversal;
00102     char *tmp;
00103     const FSSpec *macspec = 0L;
00104 #if defined(WIN32)
00105     unsigned long dbg_mask = GetWinCvsDebugMask(false);
00106     CStr tracestr;
00107 #endif
00108
00109     // used to restore the current directory
00110     static bool getPathFlag = false;
00111     char* szOriginalPath = NULL;
00112     USemaphore policeman(getPathFlag);
00113     USemaphore runstate(TraversalReport::gRunning);
00114
00115     if(!policeman.IsEnteredTwice())
00116     {
00117         szOriginalPath = getcwd(NULL, MAX_PATH);
00118     }
00119
00120 #ifndef macintosh
00121     if(path == 0L || (dirp = opendir(path)) == 0L)
00122 #else
00123     GUSIFileSpec folderspec;
00124     FSSpec foldermacspec;
00125     if(macDirSpec != 0L)
00126         folderspec = *macDirSpec;
00127     else if(path != 0L)
00128         folderspec = path;
00129     foldermacspec = folderspec;
00130     macspec = &foldermacspec;
00131
00132     if((dirp = opendir(folderspec)) == 0L)
00133 #endif
00134     {
00135         errstr = "Error while accessing ";
00136         errstr << path;
00137         errstr << " (error " << errno << ')';
00138         res =  report.OnError(errstr, errno);
00139         goto exit;
00140     }
00141
00142     tmpname = path;
00143     tmp = tmpname;
00144     char *next;
00145     if(tmpname.endsWith(kPathDelimiter))
00146         tmp[strlen(tmp) - 1] = '\0';
00147     next = tmp;
00148     while((tmp = strchr(next, kPathDelimiter)) != 0L)
00149     {
00150         next = ++tmp;
00151     }
00152     dirname = next;
00153
00154     res = report.EnterDirectory(path, dirname, macspec);
00155     if(res != kContinueTraversal)
00156         goto abort;
00157
00158     while ((dp = readdir (dirp)) != NULL)
00159     {
00160         res = report.OnIdle(path);
00161         if(res != kContinueTraversal)
00162             goto abort;
00163
00164 #ifndef macintosh
00165         if(strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
00166             continue;
00167 #endif /* !macintosh */
00168
00169         fullname = path;
00170         if(!fullname.endsWith(kPathDelimiter))
00171             fullname << kPathDelimiter;
00172         fullname << dp->d_name;
00173
00174         macspec = 0L;
00175         int statres;
00176
00177 #ifdef macintosh
00178         GUSIFileSpec inspec(folderspec);
00179         inspec += dp->d_name;
00180         FSSpec infspec = inspec;
00181         macspec = &infspec;
00182
00183         statres = stat(inspec, &sb);
00184 #else /* macintosh */
00185 #   if defined(WIN32)
00186         if ( (dbg_mask & wcvsdbg_trace_modified_checks) && (dbg_mask & wcvsdbg_verbose) )
00187         {
00188             AppendWinCvsDebugMask(wcvsdbg_trace_dst_checks
00189                                     | wcvsdbg_trace_stat);
00190             tracestr = "Stat(";
00191             tracestr << static_cast<const char *>(fullname);
00192             tracestr << ") ...\n";
00193             cvs_err(tracestr);
00194             OutputDebugString(tracestr);
00195         }
00196 #   endif   // defined(WIN32)
00197
00198         statres = stat(fullname, &sb);
00199 #endif /* macintosh */
00200
00201         if (statres != -1)
00202         {
00203             if(S_ISDIR(sb.st_mode))
00204             {
00205                 res = report.OnDirectory(path, fullname, dp->d_name, sb, macspec);
00206
00207                 if(res == kSkipFile)
00208                     continue;
00209                 if(res != kContinueTraversal)
00210                     goto abort;
00211
00212                 res = FileTraverse(fullname, report, macspec);
00213                 if(res != kContinueTraversal)
00214                     goto abort;
00215
00216             }
00217             else if(S_ISREG(sb.st_mode))
00218             {
00219                 res = report.OnFile(path, fullname, dp->d_name, sb, macspec);
00220                 if(res == kSkipFile)
00221                     continue;
00222                 if(res != kContinueTraversal)
00223                     goto abort;
00224             }
00225 #ifdef S_ISLNK
00226             else if(S_ISLNK(sb.st_mode))
00227             {
00228                 res = report.OnAlias(path, fullname, dp->d_name, sb, macspec);
00229                 if(res == kSkipFile)
00230                     continue;
00231                 if(res != kContinueTraversal)
00232                     goto abort;
00233             }
00234 #endif /* S_ISLNK */
00235             else
00236             {
00237                 /* TODO : Unix devices */
00238                 errstr = "Error while accessing ";
00239                 errstr << fullname;
00240                 errstr << " (error " << errno << ')';
00241                 res = report.OnError(errstr, errno);
00242                 goto abort;
00243             }
00244         }
00245         else
00246         {
00247             errstr = "Error while accessing ";
00248             errstr << fullname;
00249             errstr << " (error " << errno << ')';
00250             res = report.OnError(errstr, errno);
00251             goto abort;
00252         }
00253     }
00254
00255     res = report.ExitDirectory(path);
00256
00257 abort:
00258     closedir (dirp);
00259 exit:
00260     if(0L != szOriginalPath)
00261     {
00262 #ifndef macintosh
00263         chdir(szOriginalPath);
00264 #endif
00265         free(szOriginalPath);
00266         szOriginalPath = NULL;
00267     }
00268
00269 #if defined(WIN32)
00270     SetWinCvsDebugMask(dbg_mask);
00271 #endif  // defined(WIN32)
00272
00273     return res;
00274 }
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


common/FileTraversal.h Source File

common/FileTraversal.h

Go to the documentation of this file.
00001 /*
00002 ** This program is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 1, or (at your option)
00005 ** any later version.
00006
00007 ** This program is distributed in the hope that it will be useful,
00008 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 ** GNU General Public License for more details.
00011
00012 ** You should have received a copy of the GNU General Public License
00013 ** along with this program; if not, write to the Free Software
00014 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00015 */
00016
00017 /*
00018  * Author : Alexandre Parenteau <aubonbeurre@hotmail.com> --- April 1998
00019  */
00020
00021 /*
00022  * FileTraversal.h : class to traverse a file hierarchy
00023  */
00024
00025 #if !defined(AFX_FILETRAVERSAL_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
00026 #define AFX_FILETRAVERSAL_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_
00027
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif // _MSC_VER >= 1000
00031
00032 #include "TextBinary.h"
00033
00034 #ifdef macintosh
00035 #   include <Files.h>
00036 #   include <sys/types.h>
00037 #else /* !macintosh */
00038     typedef int FSSpec;
00039 #endif /* !macintosh */
00040 #include <sys/stat.h>
00041
00042 #if !defined(S_ISDIR) && defined(S_IFDIR)
00043 #   if defined(S_IFMT)
00044 #       define  S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
00045 #   else
00046 #       define S_ISDIR(m) ((m) & S_IFDIR)
00047 #   endif
00048 #endif
00049
00050 #if !defined(S_ISREG) && defined(S_IFREG)
00051 #   if defined(S_IFMT)
00052 #       define  S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
00053 #   else
00054 #       define S_ISREG(m) ((m) & S_IFREG)
00055 #   endif
00056 #endif
00057
00058 #if !defined(S_ISLNK) && defined(S_IFLNK)
00059 #   if defined(S_IFMT)
00060 #       define  S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
00061 #   else
00062 #       define S_ISLNK(m) ((m) & S_IFLNK)
00063 #   endif
00064 #endif
00065
00066 #ifndef MAX_PATH
00067 #   ifdef PATH_MAX
00068 #       define MAX_PATH PATH_MAX
00069 #   else
00070 #       define MAX_PATH 5000
00071 #   endif
00072 #endif
00073
00074 #ifdef WIN32
00075 #   include "ndir.h"
00076 #   include <direct.h>
00077 #   define STRUCT_DIRENT struct direct
00078 #else /* !WIN32 */
00079 #   include <dirent.h>
00080 #   define STRUCT_DIRENT struct dirent
00081 #endif /* !WIN32 */
00082
00083 typedef enum
00084 {
00085     kContinueTraversal,
00086     kStopTraversal,
00087     kSkipFile,
00088     kTraversalError
00089 } kTraversal;
00090
00091 class TraversalReport
00092 {
00093 public:
00094     static bool gRunning;
00095         // says that a traversal is ongoing
00096
00097     virtual kTraversal EnterDirectory(const char *fullpath, const char *dirname, const FSSpec * macspec)
00098     {
00099         return kContinueTraversal;
00100     }
00101
00102     virtual kTraversal ExitDirectory(const char *fullpath)
00103     {
00104         return kContinueTraversal;
00105     }
00106
00107     virtual kTraversal OnError(const char *err, int errcode)
00108     {
00109         return kTraversalError;
00110     }
00111
00112     virtual kTraversal OnIdle(const char *fullpath)
00113     {
00114         return kContinueTraversal;
00115     }
00116
00117     virtual kTraversal OnAnyDevice(const char *fullpath,
00118         const char *fullname,
00119         const char *name,
00120         const struct stat & dir, const FSSpec * macspec)
00121     {
00122         return kContinueTraversal;
00123     }
00124
00125     virtual kTraversal OnDirectory(const char *fullpath,
00126         const char *fullname,
00127         const char *name,
00128         const struct stat & dir, const FSSpec * macspec)
00129     {
00130         return OnAnyDevice(fullpath, fullname, name, dir, macspec);
00131     }
00132
00133     virtual kTraversal OnFile(const char *fullpath,
00134         const char *fullname,
00135         const char *name,
00136         const struct stat & dir, const FSSpec * macspec)
00137     {
00138         return OnAnyDevice(fullpath, fullname, name, dir, macspec);
00139     }
00140
00141     virtual kTraversal OnAlias(const char *fullpath,
00142         const char *fullname,
00143         const char *name,
00144         const struct stat & dir, const FSSpec * macspec)
00145     {
00146         return OnAnyDevice(fullpath, fullname, name, dir, macspec);
00147     }
00148 };
00149
00150 kTraversal FileTraverse(const char *path, TraversalReport & report, const FSSpec * macDirSpec = 0L);
00151
00152 #endif // !defined(AFX_FILETRAVERSAL_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_)
Generated on Sun Oct 21 12:41:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJBrowseEdit.cpp File Reference

WinCvs/CJLib/CJLibrary/CJBrowseEdit.cpp File Reference

#include "stdafx.h"
#include "CJBrowseEdit.h"
#include "CJShell.h"
#include "CJMenu.h"
#include "CJResource.h"

Include dependency graph for CJBrowseEdit.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJCaption.cpp File Reference

WinCvs/CJLib/CJLibrary/CJCaption.cpp File Reference

#include "StdAfx.h"
#include "CJResource.h"
#include "CJCaption.h"
#include "CJCaptionPopupWnd.h"

Include dependency graph for CJCaption.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJCaptionPopupWnd.cpp File Reference

WinCvs/CJLib/CJLibrary/CJCaptionPopupWnd.cpp File Reference

#include "stdafx.h"
#include "CJResource.h"
#include "CJCaptionPopupWnd.h"

Include dependency graph for CJCaptionPopupWnd.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJColorPicker.cpp File Reference

WinCvs/CJLib/CJLibrary/CJColorPicker.cpp File Reference

#include "stdafx.h"
#include "CJColorPopup.h"
#include "CJColorPicker.h"
#include "CJResource.h"

Include dependency graph for CJColorPicker.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void AFXAPI DDX_CJColorPicker (CDataExchange *pDX, int nIDC, COLORREF &crColor)

Function Documentation

void AFXAPI DDX_CJColorPicker | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | COLORREF & | crColor
 | ) |

Definition at line 80 of file CJColorPicker.cpp.

00081 {
00082     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
00083     ASSERT (hWndCtrl != NULL);
00084
00085     CCJColorPicker* pColorPicker = (CCJColorPicker*) CWnd::FromHandle(hWndCtrl);
00086     if (pDX->m_bSaveAndValidate)
00087     {
00088         crColor = pColorPicker->GetColor();
00089     }
00090     else // initializing
00091     {
00092         pColorPicker->SetColor(crColor);
00093     }
00094 }

Generated on Sun Oct 21 12:44:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJColorPopup.cpp File Reference

WinCvs/CJLib/CJLibrary/CJColorPopup.cpp File Reference

#include "stdafx.h"
#include <math.h>
#include "CJColorPicker.h"
#include "CJColorPopup.h"
#include "CJResource.h"

Include dependency graph for CJColorPopup.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | DEFAULT_BOX_VALUE -3
#define | CUSTOM_BOX_VALUE -2
#define | INVALID_Color -1
#define | MAX_ColorS 100
#define | NUM_COLUMNS 10

Define Documentation

#define CUSTOM_BOX_VALUE -2

Definition at line 76 of file CJColorPopup.cpp.

#define DEFAULT_BOX_VALUE -3

Definition at line 75 of file CJColorPopup.cpp.

#define INVALID_Color -1

Definition at line 77 of file CJColorPopup.cpp.

#define MAX_ColorS 100

Definition at line 79 of file CJColorPopup.cpp.

#define NUM_COLUMNS 10

Definition at line 80 of file CJColorPopup.cpp.

Generated on Sun Oct 21 12:44:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJComboBoxEx.cpp File Reference

WinCvs/CJLib/CJLibrary/CJComboBoxEx.cpp File Reference

#include "stdafx.h"
#include "CJComboBoxEx.h"

Include dependency graph for CJComboBoxEx.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJControlBar.cpp File Reference

WinCvs/CJLib/CJLibrary/CJControlBar.cpp File Reference

#include "stdafx.h"
#include "CJControlBar.h"
#include "CJDockContext.h"
#include "CJSizeDockBar.h"
#include "CJResource.h"

Include dependency graph for CJControlBar.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | GRIP_INTRASPACING 1
#define | GRIP_SIZE 3
#define | GRIP_START 8
#define | TRACK_BORDER_SIZE 4
#define | COLOR_WHITE RGB(255,255,255)
#define | COLOR_BLACK RGB(0,0,0)
#define | NCOLORSHADES 64

Define Documentation

#define COLOR_BLACK RGB(0,0,0)

Definition at line 1121 of file CJControlBar.cpp.

#define COLOR_WHITE RGB(255,255,255)

Definition at line 1120 of file CJControlBar.cpp.

#define GRIP_INTRASPACING 1

Definition at line 210 of file CJControlBar.cpp.

#define GRIP_SIZE 3

Definition at line 211 of file CJControlBar.cpp.

#define GRIP_START 8

Definition at line 212 of file CJControlBar.cpp.

#define NCOLORSHADES 64

Definition at line 1122 of file CJControlBar.cpp.

#define TRACK_BORDER_SIZE 4

Definition at line 213 of file CJControlBar.cpp.

Generated on Sun Oct 21 12:44:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJDateTimeCtrl.cpp File Reference

WinCvs/CJLib/CJLibrary/CJDateTimeCtrl.cpp File Reference

#include "stdafx.h"
#include "CJDateTimeCtrl.h"
#include <math.h>

Include dependency graph for CJDateTimeCtrl.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | MAX_TIME_BUFFER_SIZE 128
#define | MIN_DATE (-657434L)
#define | MAX_DATE 2958465L
#define | HALF_SECOND (1.0/172800.0)

Functions

BOOL | GetAsSystemTime (const CTime &tm, SYSTEMTIME &timeDest)
BOOL | GetAsSystemTime (const CTime *ptm, SYSTEMTIME &timeDest)
BOOL | TmFromOleDate (DATE dtSrc, struct tm &tmDest)
BOOL | GetAsSystemTime (const COleDateTime &dtm, SYSTEMTIME &sysTime)
BOOL | GetAsSystemTime (const COleDateTime *pdtm, SYSTEMTIME &sysTime)
void AFXAPI | DDX_CJDateTimeCtrl (CDataExchange *pDX, int nIDC, COleDateTime &value)
void AFXAPI | DDX_CJDateTimeCtrl (CDataExchange *pDX, int nIDC, CTime &value)
void AFXAPI | DDX_CJMonthCalCtrl (CDataExchange *pDX, int nIDC, COleDateTime &value)
void AFXAPI | DDX_CJMonthCalCtrl (CDataExchange *pDX, int nIDC, CTime &value)
void AFXAPI | DDV_CJMinMaxDateTime (CDataExchange *pDX, CTime &refValue, const CTime *pMinRange, const CTime *pMaxRange)
void AFXAPI | DDV_CJMinMaxDateTime (CDataExchange *pDX, COleDateTime &refValue, const COleDateTime *pMinRange, const COleDateTime *pMaxRange)
void AFXAPI | DDV_CJMinMaxMonth (CDataExchange *pDX, CTime &refValue, const CTime *pMinRange, const CTime *pMaxRange)
void AFXAPI | DDV_CJMinMaxMonth (CDataExchange *pDX, COleDateTime &refValue, const COleDateTime *pMinRange, const COleDateTime *pMaxRange)

Variables

int | nMonthDays [13]

Define Documentation

#define HALF_SECOND (1.0/172800.0)

Definition at line 84 of file CJDateTimeCtrl.cpp.

#define MAX_DATE 2958465L

Definition at line 81 of file CJDateTimeCtrl.cpp.

#define MAX_TIME_BUFFER_SIZE 128

Definition at line 79 of file CJDateTimeCtrl.cpp.

#define MIN_DATE (-657434L)

Definition at line 80 of file CJDateTimeCtrl.cpp.

Function Documentation

void AFXAPI DDV_CJMinMaxDateTime | ( | CDataExchange * | pDX,
 |  | COleDateTime & | refValue,
 |  | const COleDateTime * | pMinRange,
 |  | const COleDateTime * | pMaxRange
 | ) |

Definition at line 1068 of file CJDateTimeCtrl.cpp.

01070 {
01071     ASSERT(pMinRange == NULL || pMaxRange == NULL || *pMinRange <= *pMaxRange);
01072     CCJDateTimeCtrl* pWnd =
01073         (CCJDateTimeCtrl*) CWnd::FromHandle(pDX->m_hWndLastControl);
01074
01075     if (!pDX->m_bSaveAndValidate)
01076     {
01077         if ( (pMinRange != NULL && *pMinRange > refValue) ||
01078               (pMaxRange != NULL && *pMaxRange < refValue))
01079         {
01080             int nIDC = GetWindowLong(pDX->m_hWndLastControl, GWL_ID);
01081             TRACE1("Warning: initial dialog data is out of range in control ID %d.\n", nIDC);
01082             return;     // don't stop now
01083         }
01084     }
01085
01086     pWnd->SetRange(pMinRange, pMaxRange);
01087 }

void AFXAPI DDV_CJMinMaxDateTime | ( | CDataExchange * | pDX,
 |  | CTime & | refValue,
 |  | const CTime * | pMinRange,
 |  | const CTime * | pMaxRange
 | ) |

Definition at line 1044 of file CJDateTimeCtrl.cpp.

01046 {
01047     ASSERT(pMinRange == NULL || pMaxRange == NULL || *pMinRange <= *pMaxRange);
01048
01049     CCJDateTimeCtrl* pWnd =
01050         (CCJDateTimeCtrl*) CWnd::FromHandle(pDX->m_hWndLastControl);
01051
01052     if (!pDX->m_bSaveAndValidate)
01053     {
01054         if ( (pMinRange != NULL && *pMinRange > refValue) ||
01055               (pMaxRange != NULL && *pMaxRange < refValue))
01056         {
01057 #ifdef _DEBUG
01058             int nIDC = GetWindowLong(pDX->m_hWndLastControl, GWL_ID);
01059             TRACE1("Warning: initial dialog data is out of range in control ID %d.\n", nIDC);
01060 #endif
01061             return;     // don't stop now
01062         }
01063     }
01064
01065     pWnd->SetRange(pMinRange, pMaxRange);
01066 }

void AFXAPI DDV_CJMinMaxMonth | ( | CDataExchange * | pDX,
 |  | COleDateTime & | refValue,
 |  | const COleDateTime * | pMinRange,
 |  | const COleDateTime * | pMaxRange
 | ) |

Definition at line 1112 of file CJDateTimeCtrl.cpp.

01114 {
01115     ASSERT(pMinRange == NULL || pMaxRange == NULL || *pMinRange <= *pMaxRange);
01116     CCJMonthCalCtrl* pWnd =
01117         (CCJMonthCalCtrl*) CWnd::FromHandle(pDX->m_hWndLastControl);
01118
01119     if (!pDX->m_bSaveAndValidate)
01120     {
01121         if ( (pMinRange != NULL && *pMinRange > refValue) ||
01122               (pMaxRange != NULL && *pMaxRange < refValue))
01123         {
01124 #ifdef _DEBUG
01125             int nIDC = GetWindowLong(pDX->m_hWndLastControl, GWL_ID);
01126             TRACE1("Warning: initial dialog data is out of range in control ID %d.\n", nIDC);
01127 #endif
01128             return;     // don't stop now
01129         }
01130     }
01131
01132     pWnd->SetRange(pMinRange, pMaxRange);
01133 }

void AFXAPI DDV_CJMinMaxMonth | ( | CDataExchange * | pDX,
 |  | CTime & | refValue,
 |  | const CTime * | pMinRange,
 |  | const CTime * | pMaxRange
 | ) |

Definition at line 1089 of file CJDateTimeCtrl.cpp.

01091 {
01092     ASSERT(pMinRange == NULL || pMaxRange == NULL || *pMinRange <= *pMaxRange);
01093     CCJMonthCalCtrl* pWnd =
01094         (CCJMonthCalCtrl*) CWnd::FromHandle(pDX->m_hWndLastControl);
01095
01096     if (!pDX->m_bSaveAndValidate)
01097     {
01098         if ( (pMinRange != NULL && *pMinRange > refValue) ||
01099               (pMaxRange != NULL && *pMaxRange < refValue))
01100         {
01101 #ifdef _DEBUG
01102             int nIDC = GetWindowLong(pDX->m_hWndLastControl, GWL_ID);
01103             TRACE1("Warning: initial dialog data is out of range in control ID %d.\n", nIDC);
01104 #endif
01105             return;     // don't stop now
01106         }
01107     }
01108
01109     pWnd->SetRange(pMinRange, pMaxRange);
01110 }

void AFXAPI DDX_CJDateTimeCtrl | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | CTime & | value
 | ) |

Definition at line 1010 of file CJDateTimeCtrl.cpp.

01011 {
01012     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
01013     CCJDateTimeCtrl* pWnd = (CCJDateTimeCtrl*) CWnd::FromHandle(hWndCtrl);
01014
01015     if (pDX->m_bSaveAndValidate)
01016         pWnd->GetTime(value);
01017     else
01018         pWnd->SetTime(&value);
01019 }

void AFXAPI DDX_CJDateTimeCtrl | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | COleDateTime & | value
 | ) |

Definition at line 999 of file CJDateTimeCtrl.cpp.

01000 {
01001     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
01002     CCJDateTimeCtrl* pWnd = (CCJDateTimeCtrl*) CWnd::FromHandle(hWndCtrl);
01003
01004     if (pDX->m_bSaveAndValidate)
01005         pWnd->GetTime(value);
01006     else
01007         pWnd->SetTime(value);
01008 }

void AFXAPI DDX_CJMonthCalCtrl | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | CTime & | value
 | ) |

Definition at line 1033 of file CJDateTimeCtrl.cpp.

01034 {
01035     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
01036     CCJMonthCalCtrl* pWnd = (CCJMonthCalCtrl*) CWnd::FromHandle(hWndCtrl);
01037
01038     if (pDX->m_bSaveAndValidate)
01039         pWnd->GetCurSel(value);
01040     else
01041         pWnd->SetCurSel(value);
01042 }

void AFXAPI DDX_CJMonthCalCtrl | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | COleDateTime & | value
 | ) |

Definition at line 1021 of file CJDateTimeCtrl.cpp.

01023 {
01024     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
01025     CCJMonthCalCtrl* pWnd = (CCJMonthCalCtrl*) CWnd::FromHandle(hWndCtrl);
01026
01027     if (pDX->m_bSaveAndValidate)
01028         pWnd->GetCurSel(value);
01029     else
01030         pWnd->SetCurSel(value);
01031 }

BOOL GetAsSystemTime | ( | const COleDateTime * | pdtm,
 |  | SYSTEMTIME & | sysTime
 | ) | [static]

Definition at line 242 of file CJDateTimeCtrl.cpp.

Referenced by GetAsSystemTime(), CCJMonthCalCtrl::SetCurSel(), CCJMonthCalCtrl::SetRange(), CCJDateTimeCtrl::SetRange(), CCJMonthCalCtrl::SetSelRange(), CCJDateTimeCtrl::SetTime(), and CCJMonthCalCtrl::SetToday().

00243 {
00244     return GetAsSystemTime(*pdtm, sysTime);
00245 }

BOOL GetAsSystemTime | ( | const COleDateTime & | dtm,
 |  | SYSTEMTIME & | sysTime
 | ) | [static]

Definition at line 218 of file CJDateTimeCtrl.cpp.

00219 {
00220     BOOL bRetVal = FALSE;
00221     if (dtm.GetStatus() == COleDateTime::valid)
00222     {
00223         struct tm tmTemp;
00224         if (TmFromOleDate(dtm, tmTemp))
00225         {
00226             sysTime.wYear = (WORD) tmTemp.tm_year;
00227             sysTime.wMonth = (WORD) tmTemp.tm_mon;
00228             sysTime.wDayOfWeek = (WORD) tmTemp.tm_wday;
00229             sysTime.wDay = (WORD) tmTemp.tm_mday;
00230             sysTime.wHour = (WORD) tmTemp.tm_hour;
00231             sysTime.wMinute = (WORD) tmTemp.tm_min;
00232             sysTime.wSecond = (WORD) tmTemp.tm_sec;
00233             sysTime.wMilliseconds = 0;
00234
00235             bRetVal = TRUE;
00236         }
00237     }
00238
00239     return bRetVal;
00240 }

BOOL GetAsSystemTime | ( | const CTime * | ptm,
 |  | SYSTEMTIME & | timeDest
 | ) | [static]

Definition at line 73 of file CJDateTimeCtrl.cpp.

00074 {
00075     return GetAsSystemTime(*ptm, timeDest);
00076 }

BOOL GetAsSystemTime | ( | const CTime & | tm,
 |  | SYSTEMTIME & | timeDest
 | ) | [static]

Definition at line 56 of file CJDateTimeCtrl.cpp.

00057 {
00058     struct tm* ptm = tm.GetLocalTm(NULL);
00059     if (ptm == NULL)
00060         return FALSE;
00061
00062     timeDest.wYear = (WORD) (1900 + ptm->tm_year);
00063     timeDest.wMonth = (WORD) (1 + ptm->tm_mon);
00064     timeDest.wDay = (WORD) ptm->tm_mday;
00065     timeDest.wHour = (WORD) ptm->tm_hour;
00066     timeDest.wMinute = (WORD) ptm->tm_min;
00067     timeDest.wSecond = (WORD) ptm->tm_sec;
00068     timeDest.wMilliseconds = 0;
00069
00070     return TRUE;
00071 }

BOOL TmFromOleDate | ( | DATE | dtSrc,
 |  | struct tm & | tmDest
 | ) | [static]

Definition at line 90 of file CJDateTimeCtrl.cpp.

Referenced by GetAsSystemTime().

00091 {
00092     // The legal range does not actually span year 0 to 9999.
00093     if (dtSrc > MAX_DATE || dtSrc < MIN_DATE) // about year 100 to about 9999
00094         return FALSE;
00095
00096     long nDays;             // Number of days since Dec. 30, 1899
00097     long nDaysAbsolute;     // Number of days since 1/1/0
00098     long nSecsInDay;        // Time in seconds since midnight
00099     long nMinutesInDay;     // Minutes in day
00100
00101     long n400Years;         // Number of 400 year increments since 1/1/0
00102     long n400Century;       // Century within 400 year block (0,1,2 or 3)
00103     long n4Years;           // Number of 4 year increments since 1/1/0
00104     long n4Day;             // Day within 4 year block
00105     //  (0 is 1/1/yr1, 1460 is 12/31/yr4)
00106     long n4Yr;              // Year within 4 year block (0,1,2 or 3)
00107     BOOL bLeap4 = TRUE;     // TRUE if 4 year block includes leap year
00108
00109     double dblDate = dtSrc; // tempory serial date
00110
00111     // If a valid date, then this conversion should not overflow
00112     nDays = (long)dblDate;
00113
00114     // Round to the second
00115     dblDate += ((dtSrc > 0.0) ? HALF_SECOND : -HALF_SECOND);
00116
00117     nDaysAbsolute = (long)dblDate + 693959L; // Add days from 1/1/0 to 12/30/1899
00118
00119     dblDate = fabs(dblDate);
00120     nSecsInDay = (long)((dblDate - floor(dblDate)) * 86400.);
00121
00122     // Calculate the day of week (sun=1, mon=2...)
00123     //   -1 because 1/1/0 is Sat.  +1 because we want 1-based
00124     tmDest.tm_wday = (int)((nDaysAbsolute - 1) % 7L) + 1;
00125
00126     // Leap years every 4 yrs except centuries not multiples of 400.
00127     n400Years = (long)(nDaysAbsolute / 146097L);
00128
00129     // Set nDaysAbsolute to day within 400-year block
00130     nDaysAbsolute %= 146097L;
00131
00132     // -1 because first century has extra day
00133     n400Century = (long)((nDaysAbsolute - 1) / 36524L);
00134
00135     // Non-leap century
00136     if (n400Century != 0)
00137     {
00138         // Set nDaysAbsolute to day within century
00139         nDaysAbsolute = (nDaysAbsolute - 1) % 36524L;
00140
00141         // +1 because 1st 4 year increment has 1460 days
00142         n4Years = (long)((nDaysAbsolute + 1) / 1461L);
00143
00144         if (n4Years != 0)
00145             n4Day = (long)((nDaysAbsolute + 1) % 1461L);
00146         else
00147         {
00148             bLeap4 = FALSE;
00149             n4Day = (long)nDaysAbsolute;
00150         }
00151     }
00152     else
00153     {
00154         // Leap century - not special case!
00155         n4Years = (long)(nDaysAbsolute / 1461L);
00156         n4Day = (long)(nDaysAbsolute % 1461L);
00157     }
00158
00159     if (bLeap4)
00160     {
00161         // -1 because first year has 366 days
00162         n4Yr = (n4Day - 1) / 365;
00163
00164         if (n4Yr != 0)
00165             n4Day = (n4Day - 1) % 365;
00166     }
00167     else
00168     {
00169         n4Yr = n4Day / 365;
00170         n4Day %= 365;
00171     }
00172
00173     // n4Day is now 0-based day of year. Save 1-based day of year, year number
00174     tmDest.tm_yday = (int)n4Day + 1;
00175     tmDest.tm_year = n400Years * 400 + n400Century * 100 + n4Years * 4 + n4Yr;
00176
00177     // Handle leap year: before, on, and after Feb. 29.
00178     if (n4Yr == 0 && bLeap4)
00179     {
00180         // Leap Year
00181         if (n4Day == 59)
00182         {
00183             /* Feb. 29 */
00184             tmDest.tm_mon = 2;
00185             tmDest.tm_mday = 29;
00186             goto DoTime;
00187         }
00188
00189         // Pretend it's not a leap year for month/day comp.
00190         if (n4Day >= 60)
00191             --n4Day;
00192     }
00193
00194     // Make n4DaY a 1-based day of non-leap year and compute
00195     //  month/day for everything but Feb. 29.
00196     ++n4Day;
00197
00198     // Month number always >= n/32, so save some loop time */
00199     for (tmDest.tm_mon = (n4Day >> 5) + 1;
00200     n4Day > nMonthDays[tmDest.tm_mon]; tmDest.tm_mon++);
00201
00202     tmDest.tm_mday = (int)(n4Day - nMonthDays[tmDest.tm_mon-1]);
00203
00204 DoTime:
00205     if (nSecsInDay == 0)
00206         tmDest.tm_hour = tmDest.tm_min = tmDest.tm_sec = 0;
00207     else
00208     {
00209         tmDest.tm_sec = (int)nSecsInDay % 60L;
00210         nMinutesInDay = nSecsInDay / 60L;
00211         tmDest.tm_min = (int)nMinutesInDay % 60;
00212         tmDest.tm_hour = (int)nMinutesInDay / 60;
00213     }
00214
00215     return TRUE;
00216 }

Variable Documentation

int nMonthDays[13] [static]

Initial value:

{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}

Definition at line 87 of file CJDateTimeCtrl.cpp.

Generated on Sun Oct 21 12:44:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJDockBar.cpp File Reference

WinCvs/CJLib/CJLibrary/CJDockBar.cpp File Reference

#include "stdafx.h"
#include "CJDockBar.h"
#include "CJToolBar.h"

Include dependency graph for CJDockBar.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJDockContext.cpp File Reference

WinCvs/CJLib/CJLibrary/CJDockContext.cpp File Reference

#include "stdafx.h"
#include "CJDockContext.h"
#include "CJControlBar.h"
#include "CJSizeDockBar.h"

Include dependency graph for CJDockContext.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | HORZF(dw) (dw & CBRS_ORIENT_HORZ)
#define | VERTF(dw) (dw & CBRS_ORIENT_VERT)
#define | m_rectRequestedSize m_rectDragHorz
#define | m_rectActualSize m_rectDragVert
#define | m_rectActualFrameSize m_rectFrameDragHorz
#define | m_rectFrameBorders m_rectFrameDragVert

Functions

void | AdjustRectangle (CRect &rect, CPoint pt)

Define Documentation

#define HORZF ( dw ) (dw & CBRS_ORIENT_HORZ)

Definition at line 91 of file CJDockContext.cpp.

Referenced by CCJDockContext::CanDockDockBar(), CCJDockContext::EndDragDockBar(), CCJDockContext::GetDockBar(), and CCJDockContext::StartDragDockBar().

#define VERTF ( dw ) (dw & CBRS_ORIENT_VERT)

Definition at line 92 of file CJDockContext.cpp.

Referenced by CCJDockContext::CanDockDockBar(), CCJDockContext::EndDragDockBar(), and CCJDockContext::GetDockBar().

#define m_rectActualFrameSize m_rectFrameDragHorz

Definition at line 512 of file CJDockContext.cpp.

#define m_rectActualSize m_rectDragVert

Definition at line 511 of file CJDockContext.cpp.

#define m_rectFrameBorders m_rectFrameDragVert

Definition at line 513 of file CJDockContext.cpp.

#define m_rectRequestedSize m_rectDragHorz

Definition at line 510 of file CJDockContext.cpp.

Function Documentation

void AdjustRectangle | ( | CRect & | rect,
 |  | CPoint | pt
 | ) | [static]

Definition at line 94 of file CJDockContext.cpp.

Referenced by CCJDockContext::StartDragDockBar().

00095 {
00096     int nXOffset = (pt.x < rect.left) ? (pt.x - rect.left) :
00097                     (pt.x > rect.right) ? (pt.x - rect.right) : 0;
00098     int nYOffset = (pt.y < rect.top) ? (pt.y - rect.top) :
00099                     (pt.y > rect.bottom) ? (pt.y - rect.bottom) : 0;
00100     rect.OffsetRect(nXOffset, nYOffset);
00101 }

Generated on Sun Oct 21 12:44:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJExplorerBar.cpp File Reference

WinCvs/CJLib/CJLibrary/CJExplorerBar.cpp File Reference

#include "stdafx.h"
#include "CJResource.h"
#include "CJExplorerBar.h"

Include dependency graph for CJExplorerBar.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFlatButton.cpp File Reference

WinCvs/CJLib/CJLibrary/CJFlatButton.cpp File Reference

#include "stdafx.h"
#include "CJFlatButton.h"
#include "CJResource.h"

Include dependency graph for CJFlatButton.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFlatComboBox.cpp File Reference

WinCvs/CJLib/CJLibrary/CJFlatComboBox.cpp File Reference

#include "stdafx.h"
#include "CJFlatComboBox.h"

Include dependency graph for CJFlatComboBox.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFlatHeaderCtrl.cpp File Reference

WinCvs/CJLib/CJLibrary/CJFlatHeaderCtrl.cpp File Reference

#include "stdafx.h"
#include "CJFlatHeaderCtrl.h"

Include dependency graph for CJFlatHeaderCtrl.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFlatSplitterWnd.cpp File Reference

WinCvs/CJLib/CJLibrary/CJFlatSplitterWnd.cpp File Reference

#include "StdAfx.h"
#include "CJFlatSplitterWnd.h"

Include dependency graph for CJFlatSplitterWnd.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFlatTabCtrl.cpp File Reference

WinCvs/CJLib/CJLibrary/CJFlatTabCtrl.cpp File Reference

#include "stdafx.h"
#include "CJResource.h"
#include "CJFlatTabCtrl.h"

Include dependency graph for CJFlatTabCtrl.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFontCombo.cpp File Reference

WinCvs/CJLib/CJLibrary/CJFontCombo.cpp File Reference

#include "stdafx.h"
#include "CJFontCombo.h"

Include dependency graph for CJFontCombo.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFrameWnd.cpp File Reference

WinCvs/CJLib/CJLibrary/CJFrameWnd.cpp File Reference

#include "stdafx.h"
#include "CJFrameWnd.h"
#include "CJDockBar.h"
#include "CJSizeDockBar.h"
#include "CJControlBar.h"
#include "CJMiniDockFrameWnd.h"
#include "CJToolBar.h"

Include dependency graph for CJFrameWnd.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJHexEdit.cpp File Reference

WinCvs/CJLib/CJLibrary/CJHexEdit.cpp File Reference

#include "StdAfx.h"
#include "CJResource.h"
#include "CJHexEdit.h"
#include <ctype.h>
#include <afxole.h>
#include <afxdisp.h>

Include dependency graph for CJHexEdit.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | TOHEX(a, b) {*b++ = hextable[a >> 4];*b++ = hextable[a&0xf];}

Variables

char | hextable [16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}

Define Documentation

#define TOHEX | ( | a,
 |  | b | ) | {*b++ = hextable[a >> 4];*b++ = hextable[a&0xf];}

Definition at line 42 of file CJHexEdit.cpp.

Referenced by CCJHexEdit::OnEditCopy(), and CCJHexEdit::OnPaint().

Variable Documentation

char hextable[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}

Definition at line 41 of file CJHexEdit.cpp.

Generated on Sun Oct 21 12:44:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJHtmlView.cpp File Reference

WinCvs/CJLib/CJLibrary/CJHtmlView.cpp File Reference

#include "StdAfx.h"
#include "CJHtmlView.h"

Include dependency graph for CJHtmlView.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | RELEASE(lpUnk) _AfxRelease((LPUNKNOWN*)&lpUnk)

Functions

DWORD AFXAPI | _AfxRelease (LPUNKNOWN *lplpUnknown)
void | MakeOleVariant (COleVariant &ov, LPCITEMIDLIST pidl)

Define Documentation

#define RELEASE ( lpUnk ) _AfxRelease((LPUNKNOWN*)&lpUnk)

Definition at line 79 of file CJHtmlView.cpp.

Referenced by CCJHtmlView::OnDestroy().

Function Documentation

void MakeOleVariant | ( | COleVariant & | ov,
 |  | LPCITEMIDLIST | pidl
 | ) |

Definition at line 567 of file CJHtmlView.cpp.

Referenced by CCJHtmlView::Navigate2().

00568 {
00569     AfxVariantInit(&ov);
00570
00571     if (pidl != NULL)
00572     {
00573         // walk through entries in the list and accumulate their size
00574
00575         UINT cbTotal = 0;
00576         SAFEARRAY *psa = NULL;
00577         LPCITEMIDLIST pidlWalker = pidl;
00578
00579         while (pidlWalker->mkid.cb)
00580         {
00581             cbTotal += pidlWalker->mkid.cb;
00582             pidlWalker = (LPCITEMIDLIST)
00583                 (((LPBYTE)pidlWalker) + pidlWalker->mkid.cb);
00584         }
00585
00586         // add the base structure size
00587         cbTotal += sizeof(ITEMIDLIST);
00588
00589         // get a safe array for them
00590         psa = SafeArrayCreateVector(VT_UI1, 0, cbTotal);
00591
00592         // copy it and set members
00593         if (psa != NULL)
00594         {
00595             memcpy(psa->pvData, (LPBYTE) pidl, cbTotal);
00596             ov.vt = VT_ARRAY | VT_UI1;
00597             ov.parray = psa;
00598         }
00599     }
00600 }

DWORD AFXAPI _AfxRelease ( LPUNKNOWN * plpUnknown )

Definition at line 63 of file CJHtmlView.cpp.

00064 {
00065     ASSERT(lplpUnknown != NULL);
00066     if (*lplpUnknown != NULL)
00067     {
00068         DWORD dwRef = (*lplpUnknown)->Release();
00069         *lplpUnknown = NULL;
00070         return dwRef;
00071     }
00072     return 0;
00073 }

Generated on Sun Oct 21 12:44:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJHyperLink.cpp File Reference

WinCvs/CJLib/CJLibrary/CJHyperLink.cpp File Reference

#include "stdafx.h"
#include "CJHyperLink.h"

Include dependency graph for CJHyperLink.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define TOOLTIP_ID 1

Define Documentation

#define TOOLTIP_ID 1

Definition at line 50 of file CJHyperLink.cpp.

Generated on Sun Oct 21 12:44:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJLibrary.cpp File Reference

WinCvs/CJLib/CJLibrary/CJLibrary.cpp File Reference

#include "stdafx.h"
#include <afxdllx.h>
#include "CJToolBar.h"

Include dependency graph for CJLibrary.cpp:

Include dependency graph

Go to the source code of this file.

Functions

int APIENTRY | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)

Variables

AFX_EXTENSION_MODULE | CJLibraryDLL = { NULL, NULL }

Function Documentation

int APIENTRY DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |

Definition at line 42 of file CJLibrary.cpp.

00043 {
00044     // Remove this if you use lpReserved
00045     UNREFERENCED_PARAMETER(lpReserved);
00046
00047     if (dwReason == DLL_PROCESS_ATTACH)
00048     {
00049         TRACE0("CJLIBRARY.DLL Initializing!\n");
00050
00051         // Extension DLL one-time initialization
00052         if (!AfxInitExtensionModule(CJLibraryDLL, hInstance))
00053             return 0;
00054
00055         // see what version of the common control we are using.
00056         _GetComCtlVersion();
00057         if (_ComCtlVersion < VERSION_IE4) {
00058             ::MessageBox(NULL, _T("Invalid Common Control DLL!\nYou need version 4.70 or higher to use CJLibrary...\nAborting!\n\nCopyright © 1999 CodeJock.com and Copyright © 1998-1999 Kirk W. Stowell, All Rights Reserved\nmailto:kstowell@codejock.com\nhttp://www.codejock.com"), _T("Invalid COMCTL32.DLL"), MB_ICONSTOP);
00059             return 0;
00060         }
00061
00062         // Insert this DLL into the resource chain
00063         // NOTE: If this Extension DLL is being implicitly linked to by
00064         //  an MFC Regular DLL (such as an ActiveX Control)
00065         //  instead of an MFC application, then you will want to
00066         //  remove this line from DllMain and put it in a separate
00067         //  function exported from this Extension DLL.  The Regular DLL
00068         //  that uses this Extension DLL should then explicitly call that
00069         //  function to initialize this Extension DLL.  Otherwise,
00070         //  the CDynLinkLibrary object will not be attached to the
00071         //  Regular DLL's resource chain, and serious problems will
00072         //  result.
00073
00074         new CDynLinkLibrary(CJLibraryDLL);
00075     }
00076     else if (dwReason == DLL_PROCESS_DETACH)
00077     {
00078         TRACE0("CJLIBRARY.DLL Terminating!\n");
00079         // Terminate the library before destructors are called
00080         AfxTermExtensionModule(CJLibraryDLL);
00081     }
00082     return 1;   // ok
00083 }

Variable Documentation

AFX_EXTENSION_MODULE CJLibraryDLL = { NULL, NULL } [static]

Definition at line 39 of file CJLibrary.cpp.

Generated on Sun Oct 21 12:44:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJListBox.cpp File Reference

WinCvs/CJLib/CJLibrary/CJListBox.cpp File Reference

#include "StdAfx.h"
#include "CJListBox.h"

Include dependency graph for CJListBox.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJListCtrl.cpp File Reference

WinCvs/CJLib/CJLibrary/CJListCtrl.cpp File Reference

#include "stdafx.h"
#include "CJListCtrl.h"
#include "CJFlatHeaderCtrl.h"
#include "CJResource.h"

Include dependency graph for CJListCtrl.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJListView.cpp File Reference

WinCvs/CJLib/CJLibrary/CJListView.cpp File Reference

#include "stdafx.h"
#include "CJListView.h"
#include "CJFlatHeaderCtrl.h"
#include "CJResource.h"

Include dependency graph for CJListView.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJLogoPane.cpp File Reference

WinCvs/CJLib/CJLibrary/CJLogoPane.cpp File Reference

#include "StdAfx.h"
#include "CJLogoPane.h"

Include dependency graph for CJLogoPane.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMaskEdit.cpp File Reference

WinCvs/CJLib/CJLibrary/CJMaskEdit.cpp File Reference

#include "StdAfx.h"
#include "CJMaskEdit.h"

Include dependency graph for CJMaskEdit.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void AFXAPI DDX_OleDateTime (CDataExchange *pDX, int nIDC, CCJDateEdit &rControl, COleDateTime &rDateTime)

Function Documentation

void AFXAPI DDX_OleDateTime | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | CCJDateEdit & | rControl,
 |  | COleDateTime & | rDateTime
 | ) |

Definition at line 391 of file CJMaskEdit.cpp.

00392 {
00393     DDX_Control( pDX, nIDC, rControl );
00394
00395     if( pDX->m_bSaveAndValidate ) {
00396         rDateTime = rControl.GetDateTime();
00397     }
00398     else {
00399         rControl.SetDateTime( rDateTime );
00400     }
00401 }

Generated on Sun Oct 21 12:44:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMDIChildWnd.cpp File Reference

WinCvs/CJLib/CJLibrary/CJMDIChildWnd.cpp File Reference

#include "stdafx.h"
#include "CJMDIChildWnd.h"
#include "CJDockBar.h"
#include "CJSizeDockBar.h"
#include "CJControlBar.h"
#include "CJMiniDockFrameWnd.h"
#include "CJToolBar.h"
#include "CJMDIFrameWnd.h"

Include dependency graph for CJMDIChildWnd.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMDIFrameWnd.cpp File Reference

WinCvs/CJLib/CJLibrary/CJMDIFrameWnd.cpp File Reference

#include "stdafx.h"
#include "CJMDIFrameWnd.h"
#include "CJDockBar.h"
#include "CJSizeDockBar.h"
#include "CJControlBar.h"
#include "CJMiniDockFrameWnd.h"
#include "CJToolBar.h"

Include dependency graph for CJMDIFrameWnd.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMemFile.cpp File Reference

WinCvs/CJLib/CJLibrary/CJMemFile.cpp File Reference

#include "stdafx.h"
#include "CJMemFile.h"

Include dependency graph for CJMemFile.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMenu.cpp File Reference

WinCvs/CJLib/CJLibrary/CJMenu.cpp File Reference

#include "stdafx.h"
#include "CJMenu.h"
#include <afxpriv.h>

Include dependency graph for CJMenu.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | GAP 1
#define | OBM_CHECK 32760

Enumerations

enum | Win32Type { Win32s, Windoze95, WinNT3, WinNT4orHigher }

Functions

Win32Type IsShellType ()

Variables

CPINFO | CPInfo
Win32Type | g_Shell = IsShellType()

Define Documentation

#define GAP 1

Definition at line 49 of file CJMenu.cpp.

#define OBM_CHECK 32760

Definition at line 51 of file CJMenu.cpp.

Enumeration Type Documentation

enum Win32Type

Enumeration values:
Win32s
Windoze95
WinNT3
WinNT4orHigher

Definition at line 60 of file CJMenu.cpp.

00060               {
00061     Win32s,
00062     Windoze95,
00063     WinNT3,
00064     WinNT4orHigher
00065 };

Function Documentation

Win32Type IsShellType ( )

Definition at line 68 of file CJMenu.cpp.

00069 {
00070     Win32Type  ShellType;
00071     DWORD winVer;
00072     OSVERSIONINFO *osvi;
00073
00074     winVer=GetVersion();
00075     if(winVer<0x80000000){/*NT */
00076         ShellType=WinNT3;
00077         osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO));
00078         if (osvi!=NULL){
00079             memset(osvi,0,sizeof(OSVERSIONINFO));
00080             osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
00081             GetVersionEx(osvi);
00082             if (osvi->dwMajorVersion>=4L)
00083                 ShellType=WinNT4orHigher;//yup, it is NT 4 or higher!
00084             free(osvi);
00085         }
00086     }
00087     else if  (LOBYTE(LOWORD(winVer))<4)
00088         ShellType=Win32s;/*Win32s*/
00089     else
00090         ShellType=Windoze95;/*Windoze95*/
00091     return ShellType;
00092 }

Variable Documentation

CPINFO CPInfo [static]

Definition at line 58 of file CJMenu.cpp.

Win32Type g_Shell = IsShellType() [static]

Definition at line 94 of file CJMenu.cpp.

Generated on Sun Oct 21 12:44:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMenuBar.cpp File Reference

WinCvs/CJLib/CJLibrary/CJMenuBar.cpp File Reference

#include "stdafx.h"
#include "CJMenuBar.h"
#include "CJMenu.h"

Include dependency graph for CJMenuBar.cpp:

Include dependency graph

Go to the source code of this file.

Variables

CCJMenuBar * | g_pMenuBar = NULL
HHOOK | g_hMsgHook = NULL

Variable Documentation

HHOOK g_hMsgHook = NULL [static]

Definition at line 431 of file CJMenuBar.cpp.

CCJMenuBar* g_pMenuBar = NULL [static]

Definition at line 430 of file CJMenuBar.cpp.

Generated on Sun Oct 21 12:44:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMetaFileButton.cpp File Reference

WinCvs/CJLib/CJLibrary/CJMetaFileButton.cpp File Reference

#include "stdafx.h"
#include "CJResource.h"
#include "CJMetaFileButton.h"

Include dependency graph for CJMetaFileButton.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMiniDockFrameWnd.cpp File Reference

WinCvs/CJLib/CJLibrary/CJMiniDockFrameWnd.cpp File Reference

#include "stdafx.h"
#include "CJMiniDockFrameWnd.h"
#include "CJDockContext.h"
#include "CJSizeDockBar.h"
#include "CJControlBar.h"

Include dependency graph for CJMiniDockFrameWnd.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJOutlookBar.cpp File Reference

WinCvs/CJLib/CJLibrary/CJOutlookBar.cpp File Reference

#include "stdafx.h"
#include "CJOutlookBar.h"

Include dependency graph for CJOutlookBar.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJPagerCtrl.cpp File Reference

WinCvs/CJLib/CJLibrary/CJPagerCtrl.cpp File Reference

#include "stdafx.h"
#include "CJPagerCtrl.h"

Include dependency graph for CJPagerCtrl.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJReBar.cpp File Reference

WinCvs/CJLib/CJLibrary/CJReBar.cpp File Reference

#include "stdafx.h"
#include "CJReBar.h"
#include "CJToolBar.h"

Include dependency graph for CJReBar.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | _CjxGetDlgCtrlID(hWnd) ((UINT)(WORD)::GetDlgCtrlID(hWnd))

Functions

HWND | _CjxChildWindowFromPoint (HWND hWnd, POINT pt)

Define Documentation

#define _CjxGetDlgCtrlID ( hWnd ) ((UINT)(WORD)::GetDlgCtrlID(hWnd))

Definition at line 62 of file CJReBar.cpp.

Referenced by _CjxChildWindowFromPoint().

Function Documentation

HWND _CjxChildWindowFromPoint | ( | HWND | hWnd,
 |  | POINT | pt
 | ) | [static]

Definition at line 64 of file CJReBar.cpp.

Referenced by CCJReBar::OnToolHitTest().

00065 {
00066   ASSERT(hWnd != NULL);
00067
00068   // check child windows
00069   ::ClientToScreen(hWnd, &pt);
00070   HWND hWndChild = ::GetWindow(hWnd, GW_CHILD);
00071   for (; hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT))
00072   {
00073     if (_CjxGetDlgCtrlID(hWndChild) != (WORD)-1 &&
00074       (::GetWindowLong(hWndChild, GWL_STYLE) & WS_VISIBLE))
00075     {
00076       // see if point hits the child window
00077       CRect rect;
00078       ::GetWindowRect(hWndChild, rect);
00079       if (rect.PtInRect(pt))
00080         return hWndChild;
00081     }
00082   }
00083
00084   return NULL;    // not found
00085 }

Generated on Sun Oct 21 12:44:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJReBarCtrl.cpp File Reference

WinCvs/CJLib/CJLibrary/CJReBarCtrl.cpp File Reference

#include "stdafx.h"
#include "CJReBarCtrl.h"

Include dependency graph for CJReBarCtrl.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJShell.cpp File Reference

WinCvs/CJLib/CJLibrary/CJShell.cpp File Reference

#include "StdAfx.h"
#include "CJShell.h"

Include dependency graph for CJShell.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJShellList.cpp File Reference

WinCvs/CJLib/CJLibrary/CJShellList.cpp File Reference

#include "stdafx.h"
#include "CJResource.h"
#include "CJShellTree.h"
#include "CJShellList.h"
#include "CJSortClass.h"

Include dependency graph for CJShellList.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJShellTree.cpp File Reference

WinCvs/CJLib/CJLibrary/CJShellTree.cpp File Reference

#include "stdafx.h"
#include "CJShellTree.h"
#include "CJShellList.h"
#include "CJShell.h"
#include "CJFlatComboBox.h"
#include <direct.h>

Include dependency graph for CJShellTree.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJSizeDockBar.cpp File Reference

WinCvs/CJLib/CJLibrary/CJSizeDockBar.cpp File Reference

#include "stdafx.h"
#include "CJSizeDockBar.h"
#include "CJControlBar.h"
#include "CJToolBar.h"
#include "CJResource.h"

Include dependency graph for CJSizeDockBar.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define TRACK_BORDER_SIZE 4

Define Documentation

#define TRACK_BORDER_SIZE 4

Definition at line 104 of file CJSizeDockBar.cpp.

Generated on Sun Oct 21 12:44:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJSortClass.cpp File Reference

WinCvs/CJLib/CJLibrary/CJSortClass.cpp File Reference

#include "stdafx.h"
#include "CJSortClass.h"

Include dependency graph for CJSortClass.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJStatusBar.cpp File Reference

WinCvs/CJLib/CJLibrary/CJStatusBar.cpp File Reference

#include "StdAfx.h"
#include "CJStatusBar.h"

Include dependency graph for CJStatusBar.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJTabCtrl.cpp File Reference

WinCvs/CJLib/CJLibrary/CJTabCtrl.cpp File Reference

#include "StdAfx.h"
#include "CJTabCtrl.h"

Include dependency graph for CJTabCtrl.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJTabCtrlBar.cpp File Reference

WinCvs/CJLib/CJLibrary/CJTabCtrlBar.cpp File Reference

#include "stdafx.h"
#include "CJTabCtrlBar.h"
#include "CJResource.h"

Include dependency graph for CJTabCtrlBar.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJTabView.cpp File Reference

WinCvs/CJLib/CJLibrary/CJTabView.cpp File Reference

#include "stdafx.h"
#include "CJTabView.h"

Include dependency graph for CJTabView.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJToolBar.cpp File Reference

WinCvs/CJLib/CJLibrary/CJToolBar.cpp File Reference

#include "stdafx.h"
#include "CJToolBar.h"
#include "CJFlatComboBox.h"
#include "CJComboBoxEx.h"
#include "CJFontCombo.h"
#include "CJMenu.h"

Include dependency graph for CJToolBar.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

struct | AFX_DLLVERSIONINFO
class | CCJToolCmdUI
struct | CJX_COLORMAP
struct | CJX_CONTROLPOS
struct | CToolBarData

Defines

#define | IDC_CUSTOMIZE_BAR 0xFF
#define | _RGB_TO_RGBQUAD(r, g, b) (RGB(b,g,r))
#define | _CLR_TO_RGBQUAD(clr) (RGB(GetBValue(clr), GetGValue(clr), GetRValue(clr)))
#define | CX_OVERLAP 0

Functions

HBITMAP AFXAPI | _LoadSysColorBitmap (HINSTANCE hInst, HRSRC hRsrc, BOOL bMono)
typedef | HRESULT (CALLBACK *AFX_DLLGETVERSIONPROC)(AFX_DLLVERSIONINFO *)
DWORD AFXAPI | _GetComCtlVersion ()
int AFXAPI | _GetDropDownWidth ()

Variables

const CJX_COLORMAP | _sysColorMap []
int | _ComCtlVersion = -1
int | _dropDownWidth = -1

Define Documentation

#define CX_OVERLAP 0

Definition at line 1368 of file CJToolBar.cpp.

#define IDC_CUSTOMIZE_BAR 0xFF

Definition at line 111 of file CJToolBar.cpp.

#define _CLR_TO_RGBQUAD ( clr ) (RGB(GetBValue(clr), GetGValue(clr), GetRValue(clr)))

Definition at line 122 of file CJToolBar.cpp.

Referenced by _LoadSysColorBitmap().

#define _RGB_TO_RGBQUAD | ( | r,
 |  | g,
 |  | b | ) | (RGB(b,g,r))

Definition at line 121 of file CJToolBar.cpp.

Referenced by _LoadSysColorBitmap().

Function Documentation

typedef HRESULT ( CALLBACK * AFX_DLLGETVERSIONPROC )

DWORD AFXAPI _GetComCtlVersion ( )

Definition at line 229 of file CJToolBar.cpp.

Referenced by CCJReBar::Create(), CCJToolBar::CreateEx(), and DllMain().

00230 {
00231     // return cached version if already determined...
00232     if (_ComCtlVersion != -1)
00233         return _ComCtlVersion;
00234
00235     // otherwise determine comctl32.dll version via DllGetVersion
00236     HINSTANCE hInst = ::GetModuleHandleA("COMCTL32.DLL");
00237     ASSERT(hInst != NULL);
00238     AFX_DLLGETVERSIONPROC pfn;
00239     pfn = (AFX_DLLGETVERSIONPROC)GetProcAddress(hInst, "DllGetVersion");
00240     DWORD dwVersion = VERSION_WIN4;
00241     if (pfn != NULL)
00242     {
00243         AFX_DLLVERSIONINFO dvi;
00244         memset(&dvi, 0, sizeof(dvi));
00245         dvi.cbSize = sizeof(dvi);
00246         HRESULT hr = (*pfn)(&dvi);
00247         if (SUCCEEDED(hr))
00248         {
00249             ASSERT(dvi.dwMajorVersion <= 0xFFFF);
00250             ASSERT(dvi.dwMinorVersion <= 0xFFFF);
00251             dwVersion = MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion);
00252         }
00253     }
00254     _ComCtlVersion = dwVersion;
00255     return dwVersion;
00256 }

int AFXAPI _GetDropDownWidth ( )

Definition at line 266 of file CJToolBar.cpp.

Referenced by CCJToolBar::CreateEx().

00267 {
00268     // return cached version if already determined...
00269     if (_dropDownWidth != -1)
00270         return _dropDownWidth;
00271
00272     // otherwise calculate it...
00273     HDC hDC = GetDC(NULL);
00274     ASSERT(hDC != NULL);
00275     HFONT hFont;
00276     if ((hFont = ::CreateFont(GetSystemMetrics(SM_CYMENUCHECK), 0, 0, 0,
00277         FW_NORMAL, 0, 0, 0, SYMBOL_CHARSET, 0, 0, 0, 0, _T("Marlett"))) != NULL)
00278     {
00279         HFONT hOldFont = (HFONT)::SelectObject(hDC, hFont);
00280
00281         VERIFY(GetCharWidth(hDC, '6', '6', &_dropDownWidth));
00282
00283         // fix potential resource leak - KStowell - 10-21-99
00284         if (hFont != NULL) {
00285             ::SelectObject(hDC, hOldFont);
00286             ::DeleteObject(hFont);
00287         }
00288     }
00289
00290     ::ReleaseDC(NULL, hDC);
00291     ASSERT(_dropDownWidth != -1);
00292     return _dropDownWidth;
00293 }

HBITMAP AFXAPI _LoadSysColorBitmap | ( | HINSTANCE | hInst,
 |  | HRSRC | hRsrc,
 |  | BOOL | bMono = FALSE
 | ) |

Definition at line 141 of file CJToolBar.cpp.

00142 {
00143     HGLOBAL hglb;
00144     if ((hglb = LoadResource(hInst, hRsrc)) == NULL)
00145         return NULL;
00146
00147     LPBITMAPINFOHEADER lpBitmap = (LPBITMAPINFOHEADER)LockResource(hglb);
00148     if (lpBitmap == NULL)
00149         return NULL;
00150
00151     // make copy of BITMAPINFOHEADER so we can modify the color table
00152     const int nColorTableSize = 16;
00153     UINT nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
00154     LPBITMAPINFOHEADER lpBitmapInfo = (LPBITMAPINFOHEADER)::malloc(nSize);
00155     if (lpBitmapInfo == NULL)
00156         return NULL;
00157     memcpy(lpBitmapInfo, lpBitmap, nSize);
00158
00159     // color table is in RGBQUAD DIB format
00160     DWORD* pColorTable =
00161         (DWORD*)(((LPBYTE)lpBitmapInfo) + (UINT)lpBitmapInfo->biSize);
00162
00163     for (int iColor = 0; iColor < nColorTableSize; iColor++)
00164     {
00165         // look for matching RGBQUAD color in original
00166         for (int i = 0; i < _countof(_sysColorMap); i++)
00167         {
00168             if (pColorTable[iColor] == _sysColorMap[i].rgbqFrom)
00169             {
00170                 if (bMono)
00171                 {
00172                     // all colors except text become white
00173                     if (_sysColorMap[i].iSysColorTo != COLOR_BTNTEXT)
00174                         pColorTable[iColor] = _RGB_TO_RGBQUAD(255, 255, 255);
00175                 }
00176                 else
00177                     pColorTable[iColor] =
00178                     _CLR_TO_RGBQUAD(::GetSysColor(_sysColorMap[i].iSysColorTo));
00179                 break;
00180             }
00181         }
00182     }
00183
00184     int nWidth = (int)lpBitmapInfo->biWidth;
00185     int nHeight = (int)lpBitmapInfo->biHeight;
00186     HDC hDCScreen = ::GetDC(NULL);
00187     HBITMAP hbm = ::CreateCompatibleBitmap(hDCScreen, nWidth, nHeight);
00188
00189     if (hbm != NULL)
00190     {
00191         HDC hDCGlyphs = ::CreateCompatibleDC(hDCScreen);
00192         HBITMAP hbmOld = (HBITMAP)::SelectObject(hDCGlyphs, hbm);
00193
00194         LPBYTE lpBits;
00195         lpBits = (LPBYTE)(lpBitmap + 1);
00196         lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
00197
00198         StretchDIBits(hDCGlyphs, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
00199             lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS, SRCCOPY);
00200         SelectObject(hDCGlyphs, hbmOld);
00201         ::DeleteDC(hDCGlyphs);
00202     }
00203     ::ReleaseDC(NULL, hDCScreen);
00204
00205     // free copy of bitmap info struct and resource itself
00206     ::free(lpBitmapInfo);
00207     ::FreeResource(hglb);
00208
00209     return hbm;
00210 }

Variable Documentation

int _ComCtlVersion = -1

Definition at line 227 of file CJToolBar.cpp.

int _dropDownWidth = -1

Definition at line 264 of file CJToolBar.cpp.

const CJX_COLORMAP _sysColorMap[]

Initial value:

{

    { (RGB( 0x00 , 0x00 , 0x00 )),  COLOR_BTNTEXT },
    { (RGB( 0x80 , 0x80 , 0x80 )),  COLOR_BTNSHADOW },
    { (RGB( 0xC0 , 0xC0 , 0xC0 )),  COLOR_BTNFACE },
    { (RGB( 0xFF , 0xFF , 0xFF )),  COLOR_BTNHIGHLIGHT }
}

Definition at line 131 of file CJToolBar.cpp.

Generated on Sun Oct 21 12:44:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJToolBarBase.cpp File Reference

WinCvs/CJLib/CJLibrary/CJToolBarBase.cpp File Reference

#include "stdafx.h"
#include "CJToolBarBase.h"

Include dependency graph for CJToolBarBase.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | CX_GRIPPER 3
#define | CY_GRIPPER 3
#define | CX_BORDER_GRIPPER 2
#define | CY_BORDER_GRIPPER 2

Define Documentation

#define CX_BORDER_GRIPPER 2

Definition at line 309 of file CJToolBarBase.cpp.

#define CX_GRIPPER 3

Definition at line 307 of file CJToolBarBase.cpp.

#define CY_BORDER_GRIPPER 2

Definition at line 310 of file CJToolBarBase.cpp.

#define CY_GRIPPER 3

Definition at line 308 of file CJToolBarBase.cpp.

Generated on Sun Oct 21 12:44:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJToolBarCtrl.cpp File Reference

WinCvs/CJLib/CJLibrary/CJToolBarCtrl.cpp File Reference

#include "stdafx.h"
#include "CJToolBarCtrl.h"

Include dependency graph for CJToolBarCtrl.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJTreeCtrl.cpp File Reference

WinCvs/CJLib/CJLibrary/CJTreeCtrl.cpp File Reference

#include "stdafx.h"
#include "CJResource.h"
#include "CJTreeCtrl.h"

Include dependency graph for CJTreeCtrl.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJWindowPlacement.cpp File Reference

WinCvs/CJLib/CJLibrary/CJWindowPlacement.cpp File Reference

#include "StdAfx.h"
#include "CJResource.h"
#include "CJWindowPlacement.h"

Include dependency graph for CJWindowPlacement.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GfxGroupEdit.cpp File Reference

WinCvs/CJLib/CJLibrary/GfxGroupEdit.cpp File Reference

#include "stdafx.h"
#include "GfxGroupEdit.h"
#include "GfxOutBarCtrl.h"

Include dependency graph for GfxGroupEdit.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GfxOutBarCtrl.cpp File Reference

WinCvs/CJLib/CJLibrary/GfxOutBarCtrl.cpp File Reference

#include "stdafx.h"
#include "CJResource.h"
#include "GfxOutBarCtrl.h"
#include "GfxGroupEdit.h"
#include "CJMenu.h"

Include dependency graph for GfxOutBarCtrl.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GfxSplitterWnd.cpp File Reference

WinCvs/CJLib/CJLibrary/GfxSplitterWnd.cpp File Reference

#include "stdafx.h"
#include "GfxSplitterWnd.h"
#include <afxpriv.h>

Include dependency graph for GfxSplitterWnd.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | CX_BORDER 1
#define | CY_BORDER 1

Functions

void AFXAPI | DeferClientPos (AFX_SIZEPARENTPARAMS *lpLayout, CWnd *pWnd, int x, int y, int cx, int cy, BOOL bScrollBar)
void AFXAPI | LayoutRowCol (CSplitterWnd::CRowColInfo *pInfoArray, int nMax, int nSize, int nSizeSplitter)

Variables

BOOL | bNotWin4

Define Documentation

#define CX_BORDER 1

Definition at line 44 of file GfxSplitterWnd.cpp.

#define CY_BORDER 1

Definition at line 45 of file GfxSplitterWnd.cpp.

Function Documentation

void AFXAPI DeferClientPos | ( | AFX_SIZEPARENTPARAMS * | lpLayout,
 |  | CWnd * | pWnd,
 |  | int | x,
 |  | int | y,
 |  | int | cx,
 |  | int | cy,
 |  | BOOL | bScrollBar
 | ) | [static]

Definition at line 133 of file GfxSplitterWnd.cpp.

Referenced by CGfxSplitterWnd::RecalcLayout().

00135 {
00136     ASSERT(pWnd != NULL);
00137     ASSERT(pWnd->m_hWnd != NULL);
00138
00139     if (bScrollBar)
00140     {
00141         // if there is enough room, draw scroll bar without border
00142         // if there is not enough room, set the WS_BORDER bit so that
00143         //   we will at least get a proper border drawn
00144         BOOL bNeedBorder = (cx <= CX_BORDER || cy <= CY_BORDER);
00145         pWnd->ModifyStyle(bNeedBorder ? 0 : WS_BORDER,
00146             bNeedBorder ? WS_BORDER : 0);
00147     }
00148     CRect rect(x, y, x+cx, y+cy);
00149
00150     // adjust for border size (even if zero client size)
00151
00152     // adjust for 3d border (splitter windows have implied border)
00153     if ((pWnd->GetExStyle() & WS_EX_CLIENTEDGE) ||
00154           pWnd->IsKindOf(RUNTIME_CLASS(CSplitterWnd)))
00155         rect.InflateRect(CX_BORDER*2, CY_BORDER*2);
00156
00157     // first check if the new rectangle is the same as the current
00158     CRect rectOld;
00159     pWnd->GetWindowRect(rectOld);
00160     pWnd->GetParent()->ScreenToClient(&rectOld);
00161     if (rect != rectOld)
00162         AfxRepositionWindow(lpLayout, pWnd->m_hWnd, rect);
00163 }

void AFXAPI LayoutRowCol | ( | CSplitterWnd::CRowColInfo * | pInfoArray,
 |  | int | nMax,
 |  | int | nSize,
 |  | int | nSizeSplitter
 | ) | [static]

Definition at line 166 of file GfxSplitterWnd.cpp.

Referenced by CGfxSplitterWnd::RecalcLayout().

00168 {
00169     ASSERT(pInfoArray != NULL);
00170     ASSERT(nMax > 0);
00171     ASSERT(nSizeSplitter > 0);
00172
00173     CSplitterWnd::CRowColInfo* pInfo;
00174     int i;
00175
00176     if (nSize < 0)
00177         nSize = 0;  // if really too small, layout as zero size
00178
00179     // start with ideal sizes
00180     for (i = 0, pInfo = pInfoArray; i < nMax-1; i++, pInfo++)
00181     {
00182         if (pInfo->nIdealSize < pInfo->nMinSize)
00183             pInfo->nIdealSize = 0;      // too small to see
00184         pInfo->nCurSize = pInfo->nIdealSize;
00185     }
00186     pInfo->nCurSize = INT_MAX;  // last row/column takes the rest
00187
00188     for (i = 0, pInfo = pInfoArray; i < nMax; i++, pInfo++)
00189     {
00190         ASSERT(nSize >= 0);
00191         if (nSize == 0)
00192         {
00193             // no more room (set pane to be invisible)
00194             pInfo->nCurSize = 0;
00195             continue;       // don't worry about splitters
00196         }
00197         else if (nSize < pInfo->nMinSize && i != 0)
00198         {
00199             // additional panes below the recommended minimum size
00200             //   aren't shown and the size goes to the previous pane
00201             pInfo->nCurSize = 0;
00202
00203             // previous pane already has room for splitter + border
00204             //   add remaining size and remove the extra border
00205             ASSERT(CX_BORDER*2 == CY_BORDER*2);
00206             (pInfo-1)->nCurSize += nSize + CX_BORDER*2;
00207             nSize = 0;
00208         }
00209         else
00210         {
00211             // otherwise we can add the second pane
00212             ASSERT(nSize > 0);
00213             if (pInfo->nCurSize == 0)
00214             {
00215                 // too small to see
00216                 if (i != 0)
00217                     pInfo->nCurSize = 0;
00218             }
00219             else if (nSize < pInfo->nCurSize)
00220             {
00221                 // this row/col won't fit completely - make as small as possible
00222                 pInfo->nCurSize = nSize;
00223                 nSize = 0;
00224             }
00225             else
00226             {
00227                 // can fit everything
00228                 nSize -= pInfo->nCurSize;
00229             }
00230         }
00231
00232         // see if we should add a splitter
00233         ASSERT(nSize >= 0);
00234         if (i != nMax - 1)
00235         {
00236             // should have a splitter
00237             if (nSize > nSizeSplitter)
00238             {
00239                 nSize -= nSizeSplitter; // leave room for splitter + border
00240                 ASSERT(nSize > 0);
00241             }
00242             else
00243             {
00244                 // not enough room - add left over less splitter size
00245                 ASSERT(CX_BORDER*2 == CY_BORDER*2);
00246                 pInfo->nCurSize += nSize;
00247                 if (pInfo->nCurSize > (nSizeSplitter - CX_BORDER*2))
00248                     pInfo->nCurSize -= (nSizeSplitter - CY_BORDER*2);
00249                 nSize = 0;
00250             }
00251         }
00252     }
00253     ASSERT(nSize == 0); // all space should be allocated
00254 }

Variable Documentation

BOOL bNotWin4 [static]

Definition at line 49 of file GfxSplitterWnd.cpp.

Generated on Sun Oct 21 12:44:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Resource.h File Reference

WinCvs/CJLib/CJLibrary/Resource.h File Reference

Go to the source code of this file.

Generated on Sun Oct 21 12:44:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/Resource.h Source File

WinCvs/CJLib/CJLibrary/Resource.h

Go to the documentation of this file.
00001 //{{NO_DEPENDENCIES}}
00002 // Microsoft Visual C++ generated include file.
00003 // Used by CJLIBRARY.RC
00004 //
00005
00006 // Next default values for new objects
00007 //
00008 #ifdef APSTUDIO_INVOKED
00009 #ifndef APSTUDIO_READONLY_SYMBOLS
00010
00011 #define _APS_NEXT_RESOURCE_VALUE        129
00012 #define _APS_NEXT_COMMAND_VALUE         32771
00013 #define _APS_NEXT_CONTROL_VALUE         1000
00014 #define _APS_NEXT_SYMED_VALUE           101
00015 #endif
00016 #endif
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


StdAfx.cpp File Reference

WinCvs/CJLib/CJLibrary/StdAfx.cpp File Reference

#include "stdafx.h"

Include dependency graph for StdAfx.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:44:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/StdAfx.cpp Source File

WinCvs/CJLib/CJLibrary/StdAfx.cpp

Go to the documentation of this file.
00001 // stdafx.cpp : source file that includes just the standard includes
00002 //  CJLibrary.pch will be the pre-compiled header
00003 //  stdafx.obj will contain the pre-compiled type information
00004 //
00005 // Copyright © 1999 CodeJock.com and
00006 // Copyright © 1998-1999 Kirk W. Stowell, All Rights Reserved.
00007 //
00008 // mailto:kstowell@codejock.com
00009 // http://www.codejock.com
00010 //
00011 // Not to be used or distributed without proper registration.
00012 //
00014 /****************************************************************************
00015  *
00016  * $Date: 1999/11/30 21:45:49 $
00017  * $Revision: 1.1.1.3 $
00018  * $Archive: /CodeJockey/CJLibrary/StdAfx.cpp $
00019  *
00020  * $History: StdAfx.cpp $
00021  *
00022  * *****************  Version 4  *****************
00023  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00024  * Updated in $/CodeJockey/CJLibrary
00025  * Updated copyright and contact information.
00026  *
00027  * *****************  Version 3  *****************
00028  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00029  * Updated in $/CodeJockey/CJLibrary
00030  *
00031  * *****************  Version 2  *****************
00032  * User: Kirk Stowell Date: 7/25/99    Time: 12:15a
00033  * Updated in $/CodeJockey/CJLibrary
00034  *
00035  * *****************  Version 1  *****************
00036  * User: Kirk Stowell Date: 6/23/99    Time: 12:05a
00037  * Created in $/CodeJockey/CJLibrary
00038  *
00039  ***************************************************************************/
00041
00042 #include "stdafx.h"
Generated on Sun Oct 21 12:41:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


StdAfx.h File Reference

WinCvs/CJLib/CJLibrary/StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxole.h>
#include <afxodlgs.h>
#include <afxdisp.h>
#include <afxdb.h>
#include <afxdao.h>
#include <afxcmn.h>
#include <afxtempl.h>
#include <afxpriv.h>
#include <..\src\afximpl.h>

Include dependency graph for StdAfx.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | AFX_STDAFX_H__F235A078_2921_11D3_8733_000000000000__INCLUDED_
#define | VC_EXTRALEAN
#define | _VC_VERSION_5
#define | _CJXLIB_INLINE inline
#define | _delete(p) {if(p){delete p;p=NULL;}}
#define | _destroyIcon(h) {if(h){::DestroyIcon(h);h=NULL;}}

Define Documentation

#define AFX_STDAFX_H__F235A078_2921_11D3_8733_000000000000__INCLUDED_

Definition at line 30 of file StdAfx.h.

#define VC_EXTRALEAN

Definition at line 36 of file StdAfx.h.

#define _CJXLIB_INLINE inline

Definition at line 70 of file StdAfx.h.

#define _VC_VERSION_5

Definition at line 66 of file StdAfx.h.

#define _delete ( p ) {if(p){delete p;p=NULL;}}

Definition at line 91 of file StdAfx.h.

Referenced by CCJFlatTabCtrl::DeleteAllItems(), CCJFlatTabCtrl::DeleteItem(), CCJCaption::KillChildWindow(), CCJCaption::OnCaptButton(), CCJFontCombo::OnDestroy(), CCJCaption::OnPushPinCancel(), CCJTabCtrlBar::RemoveListItem(), CCJFlatTabCtrl::~CCJFlatTabCtrl(), CCJListCtrl::~CCJListCtrl(), CCJListView::~CCJListView(), CCJMDIFrameWnd::~CCJMDIFrameWnd(), CCJTabCtrlBar::~CCJTabCtrlBar(), and CCJTabView::~CCJTabView().

#define _destroyIcon ( h ) {if(h){::DestroyIcon(h);h=NULL;}}

Definition at line 92 of file StdAfx.h.

Referenced by CCJControlBar::OnUpdateCmdUI(), CCJBrowseButton::~CCJBrowseButton(), CCJCaptionPopupWnd::~CCJCaptionPopupWnd(), CCJControlBar::~CCJControlBar(), and CCJExplorerBar::~CCJExplorerBar().

Generated on Sun Oct 21 12:44:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/StdAfx.h Source File

WinCvs/CJLib/CJLibrary/StdAfx.h

Go to the documentation of this file.
00001 // stdafx.h : include file for standard system include files,
00002 //  or project specific include files that are used frequently, but
00003 //      are changed infrequently
00004 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00005 // See ReadMe.txt for TERMS OF USE.
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:49 $
00011  * $Revision: 1.1.1.3 $
00012  * $Archive: /CodeJock/CJLibrary/StdAfx.h $
00013  *
00014  * $History: StdAfx.h $
00015  *
00016  * *****************  Version 9  *****************
00017  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00018  * Updated in $/CodeJock/CJLibrary
00019  * Fixed potential resource and memory leak problems.
00020  *
00021  * *****************  Version 8  *****************
00022  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00023  * Updated in $/CodeJock/CJLibrary
00024  * Added source control history to file header.
00025  *
00026  ***************************************************************************/
00028
00029 #if !defined(AFX_STDAFX_H__F235A078_2921_11D3_8733_000000000000__INCLUDED_)
00030 #define AFX_STDAFX_H__F235A078_2921_11D3_8733_000000000000__INCLUDED_
00031
00032 #if _MSC_VER >= 1000
00033 #pragma once
00034 #endif // _MSC_VER >= 1000
00035
00036 #define VC_EXTRALEAN        // Exclude rarely-used stuff from Windows headers
00037
00038 #ifdef _UNICODE
00039 #define UNICODE
00040 #endif
00041
00042 #include <afxwin.h>         // MFC core and standard components
00043 #include <afxext.h>         // MFC extensions
00044
00045 #ifndef _AFX_NO_OLE_SUPPORT
00046 #include <afxole.h>         // MFC OLE classes
00047 #include <afxodlgs.h>       // MFC OLE dialog classes
00048 #include <afxdisp.h>        // MFC OLE automation classes
00049 #endif // _AFX_NO_OLE_SUPPORT
00050
00051
00052 #ifndef _AFX_NO_DB_SUPPORT
00053 #include <afxdb.h>          // MFC ODBC database classes
00054 #endif // _AFX_NO_DB_SUPPORT
00055
00056 #ifndef _AFX_NO_DAO_SUPPORT
00057 #include <afxdao.h>         // MFC DAO database classes
00058 #endif // _AFX_NO_DAO_SUPPORT
00059
00060 #ifndef _AFX_NO_AFXCMN_SUPPORT
00061 #include <afxcmn.h>         // MFC support for Windows Common Controls
00062 #endif // _AFX_NO_AFXCMN_SUPPORT
00063
00064
00065 #if _MSC_VER < 1200
00066 #define _VC_VERSION_5
00067 #endif  // _VC_VERSION_5
00068
00069 #ifndef _CJXLIB_INLINE
00070 #define _CJXLIB_INLINE inline
00071 #endif // _AFXCMN_INLINE
00072
00073 #ifndef _CJX_EXT_CLASS
00074 #ifdef _AFXDLL
00075 #define _CJX_EXT_CLASS  AFX_CLASS_EXPORT // Always export CJLibrary files...
00076 #else
00077 #define _CJX_EXT_CLASS  // not used with static builds.
00078 #endif
00079 #endif // _CJX_EXT_CLASS
00080
00081 #ifndef __AFXTEMPL_H__
00082 #include <afxtempl.h>
00083 #endif
00084
00085 #ifndef __AFXPRIV_H__
00086 #include <afxpriv.h>
00087 #endif
00088
00089 #include <..\src\afximpl.h>
00090
00091 #define _delete(p){if(p){delete p;p=NULL;}}
00092 #define _destroyIcon(h){if(h){::DestroyIcon(h);h=NULL;}}
00093
00094 //{{AFX_INSERT_LOCATION}}
00095 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00096
00097 #endif // !defined(AFX_STDAFX_H__F235A078_2921_11D3_8733_000000000000__INCLUDED_)
Generated on Sun Oct 21 12:41:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/CJLibrary/Subclass.cpp Source File

WinCvs/CJLib/CJLibrary/Subclass.cpp

Go to the documentation of this file.
00001
00002 // Copyright 1998 Paul DiLascia
00003 // If this code works, it was written by Paul DiLascia.
00004 // If not, I don't know who wrote it.
00005 //
00006 // CSubclassWnd is a generic class for hooking another window's messages.
00007 //
00009 /****************************************************************************
00010  *
00011  * $Date: 1999/11/30 21:45:49 $
00012  * $Revision: 1.1.1.2 $
00013  * $Archive: /CodeJock/CJLibrary/Subclass.cpp $
00014  *
00015  * $History: Subclass.cpp $
00016  *
00017  * *****************  Version 2  *****************
00018  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00019  * Updated in $/CodeJock/CJLibrary
00020  * Added source control history to file header.
00021  *
00022  ***************************************************************************/
00024
00025 #include "StdAfx.h"
00026 #include "Subclass.h"
00027
00028 #ifdef _DEBUG
00029 #define new DEBUG_NEW
00030 #undef THIS_FILE
00031 static char THIS_FILE[] = __FILE__;
00032 #endif
00033
00035 // The message hook map is derived from CMapPtrToPtr, which associates
00036 // a pointer with another pointer. It maps an HWND to a CSubclassWnd, like
00037 // the way MFC's internal maps map HWND's to CWnd's. The first CSubclassWnd
00038 // attached to a window is stored in the map; all other CSubclassWnd's for that
00039 // window are then chained via CSubclassWnd::m_pNext.
00040 //
00041 class CSubclassWndMap : private CMapPtrToPtr {
00042 public:
00043     CSubclassWndMap();
00044     ~CSubclassWndMap();
00045     static CSubclassWndMap& GetHookMap();
00046     void Add(HWND hwnd, CSubclassWnd* pSubclassWnd);
00047     void Remove(CSubclassWnd* pSubclassWnd);
00048     void RemoveAll(HWND hwnd);
00049     CSubclassWnd* Lookup(HWND hwnd);
00050 };
00051
00052 // This trick is used so the hook map isn't
00053 // instantiated until someone actually requests it.
00054 //
00055 #define theHookMap  (CSubclassWndMap::GetHookMap())
00056
00057 IMPLEMENT_DYNAMIC(CSubclassWnd, CWnd);
00058
00059 CSubclassWnd::CSubclassWnd()
00060 {
00061     m_pNext = NULL;
00062     m_pOldWndProc = NULL;
00063     m_hWnd  = NULL;
00064 }
00065
00066 CSubclassWnd::~CSubclassWnd()
00067 {
00068     if (m_hWnd)
00069         HookWindow((HWND)NULL);     // unhook window
00070 }
00071
00073 // Hook a window.
00074 // This installs a new window proc that directs messages to the CSubclassWnd.
00075 // pWnd=NULL to remove.
00076 //
00077 BOOL CSubclassWnd::HookWindow(HWND hwnd)
00078 {
00079     ASSERT_VALID(this);
00080     if (hwnd) {
00081         // Hook the window
00082         ASSERT(m_hWnd==NULL);
00083         ASSERT(::IsWindow(hwnd));
00084         theHookMap.Add(hwnd, this);         // Add to map of hooks
00085
00086     } else if (m_hWnd) {
00087         // Unhook the window
00088         theHookMap.Remove(this);                // Remove from map
00089         m_pOldWndProc = NULL;
00090     }
00091     m_hWnd = hwnd;
00092     return TRUE;
00093 }
00094
00096 // Window proc-like virtual function which specific CSubclassWnds will
00097 // override to do stuff. Default passes the message to the next hook;
00098 // the last hook passes the message to the original window.
00099 // You MUST call this at the end of your WindowProc if you want the real
00100 // window to get the message. This is just like CWnd::WindowProc, except that
00101 // a CSubclassWnd is not a window.
00102 //
00103 LRESULT CSubclassWnd::WindowProc(UINT msg, WPARAM wp, LPARAM lp)
00104 {
00105 //  ASSERT_VALID(this);  // removed for speed
00106     ASSERT(m_pOldWndProc);
00107     return m_pNext ? m_pNext->WindowProc(msg, wp, lp) :
00108         ::CallWindowProc(m_pOldWndProc, m_hWnd, msg, wp, lp);
00109 }
00110
00112 // Like calling base class WindowProc, but with no args, so individual
00113 // message handlers can do the default thing. Like CWnd::Default
00114 //
00115 LRESULT CSubclassWnd::Default()
00116 {
00117     // MFC stores current MSG in thread state
00118     MSG& curMsg = AfxGetThreadState()->m_lastSentMsg;
00119     // Note: must explicitly call CSubclassWnd::WindowProc to avoid infinte
00120     // recursion on virtual function
00121     return CSubclassWnd::WindowProc(curMsg.message, curMsg.wParam, curMsg.lParam);
00122 }
00123
00124 #ifdef _DEBUG
00125 void CSubclassWnd::AssertValid() const
00126 {
00127     CObject::AssertValid();
00128     ASSERT(m_hWnd==NULL || ::IsWindow(m_hWnd));
00129     if (m_hWnd) {
00130         for (CSubclassWnd* p = theHookMap.Lookup(m_hWnd); p; p=p->m_pNext) {
00131             if (p==this)
00132                 break;
00133         }
00134         ASSERT(p); // should have found it!
00135     }
00136 }
00137
00138 void CSubclassWnd::Dump(CDumpContext& dc) const
00139 {
00140     CObject::Dump(dc);
00141 }
00142
00143 #endif
00144
00146 // Subclassed window proc for message hooks. Replaces AfxWndProc (or whatever
00147 // else was there before.)
00148 //
00149 LRESULT CALLBACK
00150 HookWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
00151 {
00152 #ifdef _USRDLL
00153     // If this is a DLL, need to set up MFC state
00154     AFX_MANAGE_STATE(AfxGetStaticModuleState());
00155 #endif
00156
00157     // Set up MFC message state just in case anyone wants it
00158     // This is just like AfxCallWindowProc, but we can't use that because
00159     // a CSubclassWnd is not a CWnd.
00160     //
00161     MSG& curMsg = AfxGetThreadState()->m_lastSentMsg;
00162     MSG  oldMsg = curMsg;   // save for nesting
00163     curMsg.hwnd     = hwnd;
00164     curMsg.message = msg;
00165     curMsg.wParam  = wp;
00166     curMsg.lParam  = lp;
00167
00168     // Get hook object for this window. Get from hook map
00169     CSubclassWnd* pSubclassWnd = theHookMap.Lookup(hwnd);
00170     ASSERT(pSubclassWnd);
00171
00172     LRESULT lr;
00173     if (msg==WM_NCDESTROY) {
00174         // Window is being destroyed: unhook all hooks (for this window)
00175         // and pass msg to orginal window proc
00176         //
00177         WNDPROC wndproc = pSubclassWnd->m_pOldWndProc;
00178         theHookMap.RemoveAll(hwnd);
00179         lr = ::CallWindowProc(wndproc, hwnd, msg, wp, lp);
00180
00181     } else {
00182         // pass to msg hook
00183         lr = pSubclassWnd->WindowProc(msg, wp, lp);
00184     }
00185     curMsg = oldMsg;            // pop state
00186     return lr;
00187 }
00188
00190 // CSubclassWndMap implementation
00191 //
00192 CSubclassWndMap::CSubclassWndMap()
00193 {
00194 }
00195
00196 CSubclassWndMap::~CSubclassWndMap()
00197 {
00198 // This assert bombs when posting WM_QUIT, so I've deleted it.
00199 //  ASSERT(IsEmpty());  // all hooks should be removed!
00200 }
00201
00203 // Get the one and only global hook map
00204 //
00205 CSubclassWndMap& CSubclassWndMap::GetHookMap()
00206 {
00207     // By creating theMap here, C++ doesn't instantiate it until/unless
00208     // it's ever used! This is a good trick to use in C++, to
00209     // instantiate/initialize a static object the first time it's used.
00210     //
00211     static CSubclassWndMap theMap;
00212     return theMap;
00213 }
00214
00216 // Add hook to map; i.e., associate hook with window
00217 //
00218 void CSubclassWndMap::Add(HWND hwnd, CSubclassWnd* pSubclassWnd)
00219 {
00220     ASSERT(hwnd && ::IsWindow(hwnd));
00221
00222     // Add to front of list
00223     pSubclassWnd->m_pNext = Lookup(hwnd);
00224     SetAt(hwnd, pSubclassWnd);
00225
00226     if (pSubclassWnd->m_pNext==NULL) {
00227         // If this is the first hook added, subclass the window
00228         pSubclassWnd->m_pOldWndProc =
00229             (WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (DWORD)HookWndProc);
00230
00231     } else {
00232         // just copy wndproc from next hook
00233         pSubclassWnd->m_pOldWndProc = pSubclassWnd->m_pNext->m_pOldWndProc;
00234     }
00235     ASSERT(pSubclassWnd->m_pOldWndProc);
00236 }
00237
00239 // Remove hook from map
00240 //
00241 void CSubclassWndMap::Remove(CSubclassWnd* pUnHook)
00242 {
00243     HWND hwnd = pUnHook->m_hWnd;
00244     ASSERT(hwnd && ::IsWindow(hwnd));
00245
00246     CSubclassWnd* pHook = Lookup(hwnd);
00247     ASSERT(pHook);
00248     if (pHook==pUnHook) {
00249         // hook to remove is the one in the hash table: replace w/next
00250         if (pHook->m_pNext)
00251             SetAt(hwnd, pHook->m_pNext);
00252         else {
00253             // This is the last hook for this window: restore wnd proc
00254             RemoveKey(hwnd);
00255             SetWindowLong(hwnd, GWL_WNDPROC, (DWORD)pHook->m_pOldWndProc);
00256         }
00257     } else {
00258         // Hook to remove is in the middle: just remove from linked list
00259         while (pHook->m_pNext!=pUnHook)
00260             pHook = pHook->m_pNext;
00261         ASSERT(pHook && pHook->m_pNext==pUnHook);
00262         pHook->m_pNext = pUnHook->m_pNext;
00263     }
00264 }
00265
00267 // Remove all the hooks for a window
00268 //
00269 void CSubclassWndMap::RemoveAll(HWND hwnd)
00270 {
00271     CSubclassWnd* pSubclassWnd;
00272     while ((pSubclassWnd = Lookup(hwnd))!=NULL)
00273         pSubclassWnd->HookWindow((HWND)NULL);   // (unhook)
00274 }
00275
00277 // Find first hook associate with window
00278 //
00279 CSubclassWnd* CSubclassWndMap::Lookup(HWND hwnd)
00280 {
00281     CSubclassWnd* pFound = NULL;
00282     if (!CMapPtrToPtr::Lookup(hwnd, (void*&)pFound))
00283         return NULL;
00284     ASSERT_KINDOF(CSubclassWnd, pFound);
00285     return pFound;
00286 }
00287
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJBrowseEdit.h Source File

WinCvs/CJLib/Include/CJBrowseEdit.h

Go to the documentation of this file.
00001 // CJCJBrowseEdit.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJBrowseEdit.h $
00011  *
00012  * $History: CJBrowseEdit.h $
00013  *
00014  * *****************  Version 9  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:35p
00016  * Updated in $/CodeJock/Include
00017  * Modified resource include for static builds.
00018  *
00019  * Fixed potential resource and memory leak problems.
00020  *
00021  * Made class methods virtual for inheritance purposes.
00022  *
00023  * *****************  Version 8  *****************
00024  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00025  * Updated in $/CodeJockey/Include
00026  * Updated copyright and contact information.
00027  *
00028  * *****************  Version 7  *****************
00029  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00030  * Updated in $/CodeJockey/Include
00031  *
00032  * *****************  Version 6  *****************
00033  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00034  * Updated in $/CodeJockey/Include
00035  *
00036  * *****************  Version 5  *****************
00037  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00038  * Updated in $/CodeJockey/Include
00039  * Cleaned up inline functions, and import/export macro so that class will
00040  * be imported when linked to, and exported at compile time.
00041  *
00042  * *****************  Version 4  *****************
00043  * User: Kirk Stowell Date: 6/25/99    Time: 11:03a
00044  * Updated in $/CodeJockey/Include
00045  * Chaned image list color mask and export macros.
00046  *
00047  * *****************  Version 3  *****************
00048  * User: Kirk Stowell Date: 6/14/99    Time: 10:41p
00049  * Updated in $/CodeJockey/Include
00050  * Cleaned up control and pointer initialization, creation and activation.
00051  * Added support for CCJMenu popup.
00052  *
00053  * *****************  Version 2  *****************
00054  * User: Kirk Stowell Date: 4/03/99    Time: 10:54p
00055  * Updated in $/CodeJockey/Include
00056  * Added comments and cleaned up code.
00057  *
00058  * *****************  Version 1  *****************
00059  * User: Kirk Stowell Date: 1/16/99    Time: 10:53p
00060  * Created in $/CodeJockey/Include
00061  * Initial release.
00062  *
00063  ***************************************************************************/
00065
00066 #ifndef __CJBROWSEEDIT_H__
00067 #define __CJBROWSEEDIT_H__
00068
00069 #if _MSC_VER >= 1000
00070 #pragma once
00071 #endif // _MSC_VER >= 1000
00072
00073 // holds the current search style for the control.
00074 typedef enum BROWSE_TYPE {
00075     BT_DIRECTORY = 1,
00076     BT_FILE      = 2,
00077     BT_POPUPMENU = 3
00078 };
00079
00080 // CCJBrowseButton is a CButton derived class which is used by
00081 // the CCJBrowseEdit class.
00082 class _CJX_EXT_CLASS CCJBrowseButton : public CButton
00083 {
00084
00085 public:
00086
00087     // Default constructor
00088     //
00089     CCJBrowseButton();
00090
00091     // Virtual destructor
00092     //
00093     virtual ~CCJBrowseButton();
00094
00095 public:
00096
00097     BOOL            m_bOpenFileDialog;  // TRUE for open file dialog, FALSE for
00098                                         // save as see SetDlgOpenFile(...)
00099     CString         m_strDefExt;
00100     CString         m_strFileName;
00101     DWORD           m_dwFlags;
00102     CString         m_strFilter;
00103     CString         m_strTitle;
00104     CWnd*           m_pParentWnd;   // parent of edit control.
00105
00106 protected:
00107
00108     UINT            m_nID;          // resource id for push button
00109     CWnd*           m_pEditWnd;     // edit control.
00110     CFont           m_Font;         // button font
00111     BROWSE_TYPE     m_eType;        // search type
00112     UINT            m_nMenu;        // popup menu id
00113     UINT            m_nSubMenuIndx; // index of popup submenu.
00114     HICON           m_hIcon;        // handle to button icon.
00115
00116 public:
00117     virtual void UpdateFont();
00118
00119     // returns an unused resource id for use by the control
00120     //
00121     virtual UINT GetNextID(
00122         // window to search for availiable resource ids
00123         CWnd* pWnd) const;
00124
00125 // Overrides
00126     // ClassWizard generated virtual function overrides
00127     //{{AFX_VIRTUAL(CCJBrowseButton)
00128     public:
00129     virtual BOOL Create(CWnd* pWnd, BROWSE_TYPE eType, UINT nMenu, UINT nSubMenuIndx);
00130     //}}AFX_VIRTUAL
00131
00132     // Generated message map functions
00133 protected:
00134
00135     //{{AFX_MSG(CCJBrowseButton)
00136     afx_msg void OnClicked();
00137     //}}AFX_MSG
00138
00139     DECLARE_MESSAGE_MAP()
00140 };
00141
00142 // CCJBrowseEdit is a CEdit derived class which has a push button associated
00143 // with it. It can be used to search for directories, files or activate a
00144 // popup menu
00145 class _CJX_EXT_CLASS CCJBrowseEdit : public CEdit
00146 {
00147 public:
00148
00149     // Default constructor
00150     //
00151     CCJBrowseEdit();
00152
00153     // Virtual destructor
00154     //
00155     virtual ~CCJBrowseEdit();
00156
00157 protected:
00158
00159     CCJBrowseButton     m_btnBrowse;    // push button
00160     BROWSE_TYPE         m_eType;        // search type
00161     UINT                m_nMenu;        // popup menu id
00162     UINT                m_nSubMenuIndx; // index of popup submenu.
00163
00164 public:
00165
00166     // this member function will initialize the control to
00167     // default values.
00168     //
00169     virtual void InitializeControl();
00170
00171     // Set to TRUE to construct a File Open dialog box or
00172     // FALSE to construct a File Save As dialog box
00173     //
00174     virtual void SetDlgOpenFile(BOOL bOpenFileDialog);
00175
00176     // this member function sets the default extension for the file
00177     // open dialog.
00178     //
00179     virtual void SetDlgDefExt(LPCTSTR strDefExt);
00180
00181     // this member funciton sets the default file name for the file
00182     // open dialog.
00183     //
00184     virtual void SetDlgFileName(LPCTSTR strFileName);
00185
00186     // this member function sets the style flags for the file
00187     // open dialog.
00188     //
00189     virtual void SetDlgStyle(DWORD dwFlags);
00190
00191     // this member function sets the file filter for the file
00192     // open dialog.
00193     //
00194     virtual void SetDlgFilter(LPCTSTR strFilter);
00195
00196     // this member function sets the owner for the file
00197     // open dialog
00198     //
00199     virtual void SetDlgOwner(CWnd* pParentWnd);
00200
00201     // this member function sets the title for the directory
00202     // dialog
00203     //
00204     virtual void SetDlgTitle(LPCTSTR strTitle);
00205
00206     // this member function sets the current search type
00207     // for the control
00208     //
00209     virtual void SetSearchType(
00210         // type of search to perform - BT_FILE, BT_DIRECTORY, BT_POPUPMENU
00211         BROWSE_TYPE eType,
00212         // if eType is a popup menu, resource id of menu.
00213         UINT nMenu = 0,
00214         // index of submenu to display.
00215         int nSubMenuIndx = 0);
00216
00217 // Overrides
00218     // ClassWizard generated virtual function overrides
00219     //{{AFX_VIRTUAL(CCJBrowseEdit)
00220     protected:
00221     virtual void PreSubclassWindow();
00222     //}}AFX_VIRTUAL
00223
00224     // Generated message map functions
00225 protected:
00226     //{{AFX_MSG(CCJBrowseEdit)
00227     afx_msg void OnEnable(BOOL bEnable);
00228     afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
00229     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00230     //}}AFX_MSG
00231
00232     DECLARE_MESSAGE_MAP()
00233 };
00234
00236 //  Inline Functions
00238
00239 _CJXLIB_INLINE UINT CCJBrowseButton::GetNextID(CWnd* pWnd) const
00240     { for(UINT nID=32767; nID!=1; --nID){if(!pWnd->GetDlgItem(nID)){return nID;}}return 0; }
00241
00242 _CJXLIB_INLINE void CCJBrowseEdit::SetDlgOpenFile(BOOL bOpenFileDialog=TRUE)
00243     { m_btnBrowse.m_bOpenFileDialog = bOpenFileDialog; }
00244
00245 _CJXLIB_INLINE void CCJBrowseEdit::SetDlgDefExt(LPCTSTR strDefExt=NULL)
00246     { m_btnBrowse.m_strDefExt = strDefExt; }
00247
00248 _CJXLIB_INLINE void CCJBrowseEdit::SetDlgFileName(LPCTSTR strFileName=NULL)
00249     { m_btnBrowse.m_strFileName = strFileName; }
00250
00251 _CJXLIB_INLINE void CCJBrowseEdit::SetDlgStyle(DWORD dwFlags=OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT)
00252     { m_btnBrowse.m_dwFlags = dwFlags; }
00253
00254 _CJXLIB_INLINE void CCJBrowseEdit::SetDlgFilter(LPCTSTR strFilter=NULL)
00255     { m_btnBrowse.m_strFilter = strFilter; }
00256
00257 _CJXLIB_INLINE void CCJBrowseEdit::SetDlgOwner(CWnd* pParentWnd=NULL)
00258     { m_btnBrowse.m_pParentWnd = pParentWnd; }
00259
00260 _CJXLIB_INLINE void CCJBrowseEdit::SetDlgTitle(LPCTSTR strTitle=NULL)
00261     { m_btnBrowse.m_strTitle = strTitle; }
00262
00263 _CJXLIB_INLINE void CCJBrowseEdit::SetSearchType(BROWSE_TYPE eType, UINT nMenu, int nSubMenuIndx)
00264     { m_eType = eType; m_nMenu = nMenu; m_nSubMenuIndx = nSubMenuIndx; }
00265
00267
00268 //{{AFX_INSERT_LOCATION}}
00269 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00270
00271 #endif // __CJBROWSEEDIT_H__
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJCaption.h Source File

WinCvs/CJLib/Include/CJCaption.h

Go to the documentation of this file.
00001 // CJCaption.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJCaption.h $
00011  *
00012  * $History: CJCaption.h $
00013  *
00014  * *****************  Version 15  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:41p
00016  * Updated in $/CodeJock/Include
00017  * Updated OnEraseBkgnd(...) and OnPaint() for flicker free drawing.
00018  *
00019  * Fixed bug when popup window is closed, the mainframe resizes and then
00020  * the popup is reopened and pushpin is pressed, the child will not be
00021  * correctly sized and positioned. Added changes to handle flicker free
00022  * drawing of the control window.
00023  *
00024  * Modified resource include for static builds.
00025  *
00026  * Fixed the bug where the icon on the right hand side of the bar doesn't
00027  * clip when you resize the bar to almost nothing. Added method
00028  * SetTextStyle(...) to set the CDC:: DrawText(...) text styles to be user
00029  * defined. Thanks to Adrian for help with this.
00030  *
00031  * Fixed potential resource and memory leak problems.
00032  *
00033  * Fixed small bug with UNICODE display placing unwanted character at the
00034  * end of the string.
00035  *
00036  * Made class methods virtual for inheritance purposes.
00037  *
00038  * *****************  Version 14  *****************
00039  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00040  * Updated in $/CodeJockey/Include
00041  * Updated copyright and contact information.
00042  *
00043  * *****************  Version 13  *****************
00044  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00045  * Updated in $/CodeJockey/Include
00046  *
00047  * *****************  Version 12  *****************
00048  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00049  * Updated in $/CodeJockey/Include
00050  *
00051  * *****************  Version 11  *****************
00052  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00053  * Updated in $/CodeJockey/Include
00054  *
00055  * *****************  Version 10  *****************
00056  * User: Kirk Stowell Date: 7/25/99    Time: 12:15a
00057  * Updated in $/CodeJockey/Include
00058  *
00059  * *****************  Version 9  *****************
00060  * User: Kirk Stowell Date: 7/24/99    Time: 9:32p
00061  * Updated in $/CodeJockey/Include
00062  *
00063  * *****************  Version 5  *****************
00064  * User: Kirk Stowell Date: 5/17/99    Time: 8:13p
00065  * Updated in $/CodeJockey/Include
00066  * Fixed painting bug with border, cleaned up inline methods.
00067  *
00068  * *****************  Version 4  *****************
00069  * User: Kirk Stowell Date: 4/03/99    Time: 12:36p
00070  * Updated in $/Code Jockey/Include
00071  * Added comments and cleaned up code.
00072  *
00073  * *****************  Version 3  *****************
00074  * User: Kirk Stowell Date: 3/03/99    Time: 12:27p
00075  * Updated in $/CodeJockey/Include
00076  * Added further functionality to class so that you can define text size,
00077  * text color, border size, border and background color. Basically to
00078  * create a look similar to Outlook's Captions.
00079  *
00080  * *****************  Version 2  *****************
00081  * User: Kirk Stowell Date: 2/01/99    Time: 12:28p
00082  * Updated in $/CodeJockey/Include
00083  * Made some cosmetic fixes.
00084  *
00085  * *****************  Version 1  *****************
00086  * User: Kirk Stowell Date: 1/16/99    Time: 12:27p
00087  * Created in $/CodeJockey/Include
00088  * Initial first release.
00089  *
00090  ***************************************************************************/
00092
00093 #ifndef __CJCAPTION_H__
00094 #define __CJCAPTION_H__
00095
00096 #if _MSC_VER >= 1000
00097 #pragma once
00098 #endif // _MSC_VER >= 1000
00099
00100 #include "CJFlatButton.h"
00101
00102 // CCJCaptionButton is a CCJFlatButton derived class which is used by
00103 // the CCJCaption class to activate a CCJCaptionPopupWnd window.
00104 class _CJX_EXT_CLASS CCJCaptionButton : public CCJFlatButton
00105 {
00106 public:
00107
00108     virtual BOOL SetButtonStyle(CFont* pFont, COLORREF clrBackground, COLORREF clrFont);
00109
00110 // Overrides
00111     // ClassWizard generated virtual function overrides
00112     //{{AFX_VIRTUAL(CCJCaptionButton)
00113     virtual void DrawButtonText(CDC* pDC, UINT nState, CRect& rcItem);
00114     //}}AFX_VIRTUAL
00115
00116 // Generated message map functions
00117 protected:
00118     //{{AFX_MSG(CCJCaptionButton)
00119     afx_msg void OnSysColorChange();
00120     //}}AFX_MSG
00121
00122     DECLARE_MESSAGE_MAP()
00123 };
00124
00125 class CCJCaptionPopupWnd;
00126
00127 #define WS_EX_FLATEDGE  0x01
00128
00129 // CCJCaption is a CStatic derived class which is simular to the
00130 // caption or info bars that are seen in Microsoft Outlook
00131 class _CJX_EXT_CLASS CCJCaption : public CStatic
00132 {
00133 public:
00134
00135     // Default constructor.
00136     //
00137     CCJCaption();
00138
00139     // Virtual destructor
00140     //
00141     virtual ~CCJCaption();
00142
00143 protected:
00144
00145     COLORREF            m_clrBtnHilite; // set to system color COLOR_BTNHILIGHT
00146     COLORREF            m_clrBtnShadow; // set to system color COLOR_BTNSHADOW
00147     COLORREF            m_clrBtnFace;   // set to system color COLOR_BTNFACE
00148     COLORREF            m_clrBorder;    // user defined border color
00149     COLORREF            m_clrBackgnd;   // user defined background color
00150     COLORREF            m_clrFont;      // user defined font color
00151     int                 m_nBorder;      // size in pixels for the caption border
00152     CFont*              m_pFont;        // user defined font pointer, default value NULL
00153     CFont               m_Font;         // default font created by control if m_pFont is NULL
00154     HICON               m_hIcon;        // user defined icon handle, default value NULL
00155     CString             m_strWindText;  // text that will be displayed in caption.
00156     int                 m_cx;           // icon width.
00157     int                 m_cy;           // icon height.
00158     int                 m_nOffset;
00159
00160     CWnd*               m_pChildWnd;
00161     CWnd*               m_pNotifyWnd;
00162     CCJCaptionButton    m_CaptionButton;
00163     CCJCaptionPopupWnd* m_pWndPopDown;
00164     CRect               m_rcChild;
00165     DWORD               m_dwExStyle;
00166     CRect               m_rcClient;
00167     DWORD               m_dwTextStyle;
00168
00169 public:
00170
00171     // Call this member function to set the caption bar border, background and
00172     // font colors.
00173     //
00174     virtual void SetCaptionColors(
00175         // A COLORREF value for the new border color.
00176         COLORREF clrBorder,
00177         // A COLORREF value for the new background color.
00178         COLORREF clrBackground,
00179         // A COLORREF value for the new font color.
00180         COLORREF clrFont);
00181
00182     // Call this function to modify the caption style. You can use this member function
00183     // to set the border size that is drawn around the caption banner, the font that the
00184     // caption will use, the caption text and icon to be displayed.
00185     //
00186     virtual void ModifyCaptionStyle(
00187         // Specifies size in pixels of the banner border.
00188         int nBorderSize,
00189         // Specifies the new caption font.
00190         CFont* pFont=NULL,
00191         // Address of a null-terminated string specifying the new caption text.
00192         LPCTSTR lpszWindText=NULL,
00193         // Handle of the icon to be drawn in the caption.
00194         HICON hIcon=NULL);
00195
00196     virtual void SetChildWindow(CWnd* pChild, CWnd* pNotifyWnd);
00197     virtual void KillChildWindow();
00198
00199     virtual void DrawCaptionBack(CDC* pDC, CRect& rcItem);
00200     virtual void DrawCaptionText(CDC* pDC, CRect& rcItem);
00201     virtual void DrawCaptionIcon(CDC* pDC, CRect& rcItem);
00202
00203 public:
00204     virtual void UpdateFont();
00205     virtual void UpdateCaption(LPCTSTR lpszWindowText, HICON hIcon);
00206     virtual void UpdateCaptionBack(CDC* pDC, CRect& rcItem);
00207     virtual void UpdateCaptionText(CDC* pDC, CRect& rcItem);
00208     virtual void SetTextStyle(DWORD dwStyle);
00209
00210 // Overrides
00211     // ClassWizard generated virtual function overrides
00212     //{{AFX_VIRTUAL(CCJCaption)
00213     public:
00214     virtual BOOL Create(CWnd* pParentWnd, LPCTSTR lpszWindowName, DWORD dwExStyle=WS_EX_FLATEDGE, DWORD dwStyle=WS_VISIBLE|SS_CENTER|SS_CENTERIMAGE, const CRect& rect=CRect(0,0,0,0), UINT nID = 0xffff);
00215     //}}AFX_VIRTUAL
00216
00217     // Generated message map functions
00218
00219 protected:
00220     //{{AFX_MSG(CCJCaption)
00221     afx_msg void OnPaint();
00222     afx_msg void OnSysColorChange();
00223     afx_msg void OnSize(UINT nType, int cx, int cy);
00224     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00225     //}}AFX_MSG
00226     afx_msg void OnCaptButton();
00227     afx_msg void OnPushPinButton(UINT lParam, LONG wParam);
00228     afx_msg void OnPushPinCancel(UINT lParam, LONG wParam);
00229
00230     DECLARE_MESSAGE_MAP()
00231 };
00232
00234 //  Inline Functions
00236
00237 _CJXLIB_INLINE void CCJCaption::SetTextStyle(DWORD dwStyle)
00238     { m_dwTextStyle = dwStyle; }
00239
00240 _CJXLIB_INLINE void CCJCaption::SetCaptionColors(COLORREF clrBorder, COLORREF clrBackground, COLORREF clrFont)
00241     { ASSERT(::IsWindow(m_hWnd)); m_clrBorder = clrBorder; m_clrBackgnd = clrBackground; m_clrFont = clrFont; }
00242
00244
00245 //{{AFX_INSERT_LOCATION}}
00246 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00247
00248 #endif // __CJCAPTION_H__
00249
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJCaptionPopupWnd.h Source File

WinCvs/CJLib/Include/CJCaptionPopupWnd.h

Go to the documentation of this file.
00001 // CJCaptionPopupWnd.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJCaptionPopupWnd.h $
00011  *
00012  * $History: CJCaptionPopupWnd.h $
00013  *
00014  * *****************  Version 5  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:44p
00016  * Updated in $/CodeJock/Include
00017  * Modified resource include for static builds.
00018  *
00019  * Fixed potential resource and memory leak problems.
00020  *
00021  * *****************  Version 4  *****************
00022  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00023  * Updated in $/CodeJockey/Include
00024  * Updated copyright and contact information.
00025  *
00026  * *****************  Version 3  *****************
00027  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00028  * Updated in $/CodeJockey/Include
00029  *
00030  * *****************  Version 2  *****************
00031  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00032  * Updated in $/CodeJockey/Include
00033  *
00034  * *****************  Version 1  *****************
00035  * User: Kirk Stowell Date: 7/14/99    Time: 9:46p
00036  * Created in $/CodeJockey/Include
00037  * Initial creation. Added popup class as a helper class for the
00038  * CCJCaption class. This class is used to display a popup window which
00039  * contains a child CWnd derived object.
00040  *
00041  ***************************************************************************/
00043
00044 #ifndef __CJCAPTIONPOPUPWND_H__
00045 #define __CJCAPTIONPOPUPWND_H__
00046
00047 #if _MSC_VER > 1000
00048 #pragma once
00049 #endif // _MSC_VER > 1000
00050
00052 // CCJCaptionPopupWnd window
00053
00054 #include "CJCaption.h"
00055 #include "CJFlatButton.h"
00056
00057 // caption popup window messages
00058 #define CM_ONPUSHPINBUTTON   WM_USER + 1001        // push pin clicked.
00059 #define CM_ONPUSHPINCANCEL   WM_USER + 1002        // push pin clicked.
00060
00061 // CCJCaptionPopupWnd is a CWnd derived class which is used by
00062 // the CCJCaption class to display a popup child window simular to Outlook
00063 class _CJX_EXT_CLASS CCJCaptionPopupWnd : public CWnd
00064 {
00065 // Construction
00066 public:
00067     CCJCaptionPopupWnd();
00068
00069 // Attributes
00070 public:
00071     CWnd*           m_pParentWnd;
00072     CWnd*           m_pChildWnd;
00073     CWnd*           m_pChildParent;
00074 protected:
00075     CCJCaption      m_Caption;
00076     CCJFlatButton   m_CaptionButton;
00077     HICON           m_hIconOn;      // handle to normal button icon.
00078     HICON           m_hIconOff;     // handle to pressed button icon.
00079
00080 // Operations
00081 public:
00082
00083 // Overrides
00084     // ClassWizard generated virtual function overrides
00085     //{{AFX_VIRTUAL(CCJCaptionPopupWnd)
00086     public:
00087     virtual BOOL Create(const CRect& rect, CWnd* pParentWnd, CWnd* pChildWnd);
00088     //}}AFX_VIRTUAL
00089
00090 // Implementation
00091 public:
00092     virtual ~CCJCaptionPopupWnd();
00093
00094     // Generated message map functions
00095 protected:
00096     //{{AFX_MSG(CCJCaptionPopupWnd)
00097     afx_msg void OnDestroy();
00098     afx_msg void OnCaptButton();
00099     afx_msg void OnPaint();
00100     afx_msg void OnTimer(UINT nIDEvent);
00101     //}}AFX_MSG
00102     DECLARE_MESSAGE_MAP()
00103 };
00104
00106
00107 //{{AFX_INSERT_LOCATION}}
00108 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00109
00110 #endif // !defined(__CJCAPTIONPOPUPWND_H__)
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJColorPicker.h Source File

WinCvs/CJLib/Include/CJColorPicker.h

Go to the documentation of this file.
00001 #ifndef __CJCOLORPICKER_H__
00002 #define __CJCOLORPICKER_H__
00003
00004 #if _MSC_VER >= 1000
00005 #pragma once
00006 #endif // _MSC_VER >= 1000
00007
00008 // CJColorPicker.h : header file
00009 //
00010 // Written by Chris Maunder (chrismaunder@codeguru.com)
00011 // Extended by Alexander Bischofberger (bischofb@informatik.tu-muenchen.de)
00012 // Copyright (c) 1998.
00013 //
00014 // This code may be used in compiled form in any way you desire. This
00015 // file may be redistributed unmodified by any means PROVIDING it is
00016 // not sold for profit without the authors written consent, and
00017 // providing that this notice and the authors name is included. If
00018 // the source code in  this file is used in any commercial application
00019 // then a simple email would be nice.
00020 //
00021 // This file is provided "as is" with no expressed or implied warranty.
00022 // The author accepts no liability if it causes any damage whatsoever.
00023 // It's free - so you get what you pay for.
00024 //
00026 /****************************************************************************
00027  *
00028  * $Date: 1999/11/30 21:45:49 $
00029  * $Revision: 1.1.1.3 $
00030  * $Archive: /CodeJock/Include/CJColorPicker.h $
00031  *
00032  * $History: CJColorPicker.h $
00033  *
00034  * *****************  Version 6  *****************
00035  * User: Kirk Stowell Date: 10/31/99   Time: 11:50p
00036  * Updated in $/CodeJock/Include
00037  * Overrode OnEraseBkgnd(...), OnPaint() and made modifications to
00038  * DrawItem(...) for flicker free drawing.
00039  *
00040  * Modified resource include for static builds.
00041  *
00042  * Added method CheckTextColor(...) which tests if the intensity of the
00043  * color is greater as 128. If the intensity < 128 => color is dark, so
00044  * the text must be light. Stephane Routelous
00045  * [routelous@cad-cam-concept.de]
00046  *
00047  * Fixed potential resource and memory leak problems.
00048  *
00049  * Removed un-necessary calls to GetParent(), a call is made only once at
00050  * initialization, to ensure we are working with a valid handle.
00051  *
00052  * Made class methods virtual for inheritance purposes.
00053  *
00054  * *****************  Version 5  *****************
00055  * User: Kirk Stowell Date: 10/14/99   Time: 12:22p
00056  * Updated in $/CodeJock/Include
00057  * Added source control history to file header.
00058  *
00059  ***************************************************************************/
00061
00062 #include "CJColorPopup.h"
00063
00065 // CCJColorPicker window
00066
00067 void AFXAPI DDX_CJColorPicker(CDataExchange *pDX, int nIDC, COLORREF& crColor);
00068
00070 // CCJColorPicker window
00071
00072 #define CP_MODE_TEXT 1  // edit text Color
00073 #define CP_MODE_BK   2  // edit background Color (default)
00074
00075 class _CJX_EXT_CLASS CCJColorPicker : public CButton
00076 {
00077 // Construction
00078 public:
00079     CCJColorPicker();
00080     DECLARE_DYNCREATE(CCJColorPicker);
00081
00082 // Attributes
00083 public:
00084     virtual COLORREF GetColor();
00085     virtual void     SetColor(COLORREF crColor);
00086
00087     virtual void     SetDefaultText(LPCTSTR szDefaultText);
00088     virtual void     SetCustomText(LPCTSTR szCustomText);
00089
00090     virtual void     SetTrackSelection(BOOL bTracking = TRUE)  { m_bTrackSelection = bTracking; }
00091     virtual BOOL     GetTrackSelection()                       { return m_bTrackSelection; }
00092
00093     virtual void     SetSelectionMode(UINT nMode)              { m_nSelectionMode = nMode; }
00094     virtual UINT     GetSelectionMode()                        { return m_nSelectionMode; };
00095
00096     virtual void     SetBkColor(COLORREF crColorBk);
00097     virtual COLORREF GetBkColor()                             { return m_crColorBk; }
00098
00099     virtual void     SetTextColor(COLORREF crColorText);
00100     virtual COLORREF GetTextColor()                           { return m_crColorText;}
00101
00102     virtual void     CheckTextColor(COLORREF crColor);
00103
00104 // Operations
00105 public:
00106
00107 // Overrides
00108     // ClassWizard generated virtual function overrides
00109     //{{AFX_VIRTUAL(CCJColorPicker)
00110     public:
00111     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
00112     protected:
00113     virtual void PreSubclassWindow();
00114     //}}AFX_VIRTUAL
00115
00116 // Implementation
00117 public:
00118     virtual ~CCJColorPicker();
00119
00120 protected:
00121     void SetWindowSize();
00122
00123 // protected attributes
00124 protected:
00125     BOOL     m_bActive,                // Is the dropdown active?
00126              m_bTrackSelection;        // track Color changes?
00127     COLORREF m_crColorBk;
00128     COLORREF m_crColorText;
00129     UINT     m_nSelectionMode;
00130     CRect    m_ArrowRect;
00131     CString  m_strDefaultText;
00132     CString  m_strCustomText;
00133     bool     m_bLBtnDown;
00134     CWnd*    m_pParentWnd;              // holds a pointer to the parent window.
00135
00136     // Generated message map functions
00137 protected:
00138     //{{AFX_MSG(CCJColorPicker)
00139     afx_msg BOOL OnClicked();
00140     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00141     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00142     afx_msg void OnPaint();
00143     //}}AFX_MSG
00144     afx_msg LONG OnSelEndOK(UINT lParam, LONG wParam);
00145     afx_msg LONG OnSelEndCancel(UINT lParam, LONG wParam);
00146     afx_msg LONG OnSelChange(UINT lParam, LONG wParam);
00147
00148     DECLARE_MESSAGE_MAP()
00149 };
00150
00152
00153 //{{AFX_INSERT_LOCATION}}
00154 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00155
00156 #endif // !defined(__CJCOLORPICKER_H__)
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJColorPopup.h Source File

WinCvs/CJLib/Include/CJColorPopup.h

Go to the documentation of this file.
00001 #ifndef __CJCOLORPOPUP_H__
00002 #define __CJCOLORPOPUP_H__
00003
00004 #if _MSC_VER >= 1000
00005 #pragma once
00006 #endif // _MSC_VER >= 1000
00007
00008 // CJColorPopup.h : header file
00009 //
00010 // Written by Chris Maunder (chrismaunder@codeguru.com)
00011 // Extended by Alexander Bischofberger (bischofb@informatik.tu-muenchen.de)
00012 // Copyright (c) 1998.
00013 //
00014 // This code may be used in compiled form in any way you desire. This
00015 // file may be redistributed unmodified by any means PROVIDING it is
00016 // not sold for profit without the authors written consent, and
00017 // providing that this notice and the authors name is included. If
00018 // the source code in  this file is used in any commercial application
00019 // then a simple email would be nice.
00020 //
00021 // This file is provided "as is" with no expressed or implied warranty.
00022 // The author accepts no liability if it causes any damage whatsoever.
00023 // It's free - so you get what you pay for.
00024 //
00026 /****************************************************************************
00027  *
00028  * $Date: 1999/11/30 21:45:49 $
00029  * $Revision: 1.1.1.2 $
00030  * $Archive: /CodeJock/Include/CJColorPopup.h $
00031  *
00032  * $History: CJColorPopup.h $
00033  *
00034  * *****************  Version 7  *****************
00035  * User: Kirk Stowell Date: 10/31/99   Time: 11:53p
00036  * Updated in $/CodeJock/Include
00037  * Overrode OnEraseBkgnd(...) and made modifications to OnPaint(...) to
00038  * handle flicker free drawing.
00039  *
00040  * Modified resource include for static builds.
00041  *
00042  * Fixed potential resource and memory leak problems.
00043  *
00044  * Made class methods virtual for inheritance purposes.
00045  *
00046  * *****************  Version 6  *****************
00047  * User: Kirk Stowell Date: 10/14/99   Time: 12:23p
00048  * Updated in $/CodeJock/Include
00049  * Added source control history to file header.
00050  *
00051  ***************************************************************************/
00053
00054 // CCJColorPopup messages
00055 #define CPN_SELCHANGE        WM_USER + 1001        // Color Picker Selection change
00056 #define CPN_DROPDOWN         WM_USER + 1002        // Color Picker drop down
00057 #define CPN_CLOSEUP          WM_USER + 1003        // Color Picker close up
00058 #define CPN_SELENDOK         WM_USER + 1004        // Color Picker end OK
00059 #define CPN_SELENDCANCEL     WM_USER + 1005        // Color Picker end (cancelled)
00060
00061 // forward declaration
00062 class CColorPicker;
00063
00064 // To hold the Colors and their names
00065 typedef struct {
00066     COLORREF crColor;
00067     TCHAR    *szName;
00068 } ColorTableEntry;
00069
00071 // CCJColorPopup window
00072
00073 class _CJX_EXT_CLASS CCJColorPopup : public CWnd
00074 {
00075 // Construction
00076 public:
00077     CCJColorPopup();
00078     CCJColorPopup(CPoint p, COLORREF crColor, CWnd* pParentWnd,
00079                  LPCTSTR szDefaultText = NULL, LPCTSTR szCustomText = NULL);
00080     virtual void Initialise();
00081
00082 // Attributes
00083 public:
00084
00085 // Operations
00086 public:
00087     virtual BOOL Create(CPoint p, COLORREF crColor, CWnd* pParentWnd,
00088                 LPCTSTR szDefaultText = NULL, LPCTSTR szCustomText = NULL);
00089
00090 // Overrides
00091     // ClassWizard generated virtual function overrides
00092     //{{AFX_VIRTUAL(CCJColorPopup)
00093     public:
00094     virtual BOOL PreTranslateMessage(MSG* pMsg);
00095     //}}AFX_VIRTUAL
00096
00097 // Implementation
00098 public:
00099     virtual void UpdateFont();
00100     virtual ~CCJColorPopup();
00101
00102 protected:
00103     virtual BOOL GetCellRect(int nIndex, const LPRECT& rect);
00104     virtual void FindCellFromColor(COLORREF crColor);
00105     virtual void SetWindowSize();
00106     virtual void CreateToolTips();
00107     virtual void ChangeSelection(int nIndex);
00108     virtual void EndSelection(int nMessage);
00109     virtual void DrawCell(CDC* pDC, int nIndex);
00110
00111     virtual COLORREF GetColor(int nIndex)              { return m_crColors[nIndex].crColor; }
00112     virtual LPCTSTR GetColorName(int nIndex)           { return m_crColors[nIndex].szName; }
00113     virtual int  GetIndex(int row, int col) const;
00114     virtual int  GetRow(int nIndex) const;
00115     virtual int  GetColumn(int nIndex) const;
00116
00117 // protected attributes
00118 protected:
00119     static ColorTableEntry m_crColors[];
00120     int            m_nNumColors;
00121     int            m_nNumColumns, m_nNumRows;
00122     int            m_nBoxSize, m_nMargin;
00123     int            m_nCurrentSel;
00124     int            m_nChosenColorSel;
00125     CString        m_strDefaultText;
00126     CString        m_strCustomText;
00127     CRect          m_CustomTextRect, m_DefaultTextRect, m_WindowRect;
00128     CFont          m_Font;
00129     CPalette       m_Palette;
00130     COLORREF       m_crInitialColor, m_crColor;
00131     CToolTipCtrl   m_ToolTip;
00132     CWnd*          m_pParent;
00133
00134     // Generated message map functions
00135 protected:
00136     //{{AFX_MSG(CCJColorPopup)
00137     afx_msg void OnNcDestroy();
00138     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00139     afx_msg void OnPaint();
00140     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00141     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00142     afx_msg BOOL OnQueryNewPalette();
00143     afx_msg void OnPaletteChanged(CWnd* pFocusWnd);
00144     afx_msg void OnKillFocus(CWnd* pNewWnd);
00145     afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
00146     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00147     //}}AFX_MSG
00148     DECLARE_MESSAGE_MAP()
00149 };
00150
00152
00153 //{{AFX_INSERT_LOCATION}}
00154 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00155
00156 #endif // !defined(__CJCOLORPOPUP_H__)
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJComboBoxEx.h Source File

WinCvs/CJLib/Include/CJComboBoxEx.h

Go to the documentation of this file.
00001 // CJComboBoxEx.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new
00007 // IE4 controls' http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/Include/CJComboBoxEx.h $
00015  *
00016  * $History: CJComboBoxEx.h $
00017  *
00018  * *****************  Version 6  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/Include
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 5  *****************
00024  * User: Kirk Stowell Date: 7/28/99    Time: 12:39a
00025  * Updated in $/CodeJockey/Include
00026  * Final pass for release 6.08.
00027  *
00028  * *****************  Version 4  *****************
00029  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00030  * Updated in $/CodeJockey/Include
00031  *
00032  * *****************  Version 3  *****************
00033  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00034  * Updated in $/CodeJockey/Include
00035  *
00036  * *****************  Version 2  *****************
00037  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00038  * Updated in $/CodeJockey/Include
00039  * Cleaned up inline functions, and import/export macro so that class will
00040  * be imported when linked to, and exported at compile time.
00041  *
00042  * *****************  Version 1  *****************
00043  * User: Kirk Stowell Date: 6/25/99    Time: 12:05p
00044  * Created in $/CodeJockey/Include
00045  * Copied from MFC, Visual C++ 6. Added to extend functionality to Visual
00046  * C++ 5 users.
00047  *
00048  ***************************************************************************/
00050
00051 #ifndef __CJCOMBOBOXEX_H__
00052 #define __CJCOMBOBOXEX_H__
00053
00054 // The CCJComboBoxEx class extends the combo box control by providing support
00055 // for image lists. By using CCJComboBoxEx to create combo box controls, you no
00056 // longer need to implement your own image drawing code. Instead, use CCJComboBoxEx
00057 // to access images from an image list.
00058 class _CJX_EXT_CLASS CCJComboBoxEx : public CComboBox
00059 {
00060     DECLARE_DYNAMIC(CCJComboBoxEx)
00061
00062 // Construction / destruction
00063 public:
00064
00065     // Constructs a CCJComboBoxEx object
00066     //
00067     CCJComboBoxEx();
00068
00069     // Destroys a CCJCombboBoxEx object
00070     //
00071     virtual ~CCJComboBoxEx();
00072
00073 // Initialization
00074 public:
00075
00076     // Creates the combo box and attaches it to the CCJComboBoxEx object.
00077     //
00078     BOOL Create(
00079         // Specifies the combination of combo box styles
00080         // applied to the combo box.
00081         DWORD dwStyle,
00082         // A reference to a CRect object orRECT structure, which
00083         // is the position and size of the combo box
00084         const RECT& rect,
00085         // A pointer to a CWnd object that is the parent window of
00086         // the combo box (usually a CDialog). It must not be NULL
00087         CWnd* pParentWnd,
00088         // Specifies the combo box’s control ID.
00089         UINT nID);
00090
00091 // Operators
00092 public:
00093
00094     // Removes an item from a ComboBoxEx control.
00095     // Returns the number of items remaining in the control. If iIndex
00096     // is invalid, the function returns CB_ERR.
00097     //
00098     int DeleteItem(
00099         // Zero-based index of the item to be removed.
00100         int iIndex);
00101
00102     // Retrieves item information for a given ComboBoxEx item
00103     // Returns nonzero if the operation was successful; otherwise 0.
00104     //
00105     BOOL GetItem(
00106         // A pointer to aCOMBOBOXEXITEM structure that will receive
00107         // the item information.
00108         COMBOBOXEXITEM* pCBItem);
00109
00110     // Inserts a new item in a ComboBoxEx control.
00111     // Returns the index at which the new item was inserted if
00112     // successful; otherwise -1
00113     int InsertItem(
00114         // A pointer to aCOMBOBOXEXITEM structure that will receive the
00115         // item information. This structure contains callback flag values for the item.
00116         const COMBOBOXEXITEM* pCBItem);
00117
00118     // Inserts a new item in a ComboBoxEx control.
00119     // Returns the index at which the new item was inserted if
00120     // successful; otherwise -1
00121     int InsertItem(
00122         // item index.
00123         int iItem,
00124         // string resource.
00125         UINT nStringID,
00126         // ammount (in pixels) image is to be indented.
00127         int iIndent=0,
00128         // image index.
00129         int iImage=0,
00130         // selected image index.
00131         int iSelectedImage=0,
00132         // style mask.
00133         UINT mask=CBEIF_TEXT|CBEIF_IMAGE|CBEIF_SELECTEDIMAGE|CBEIF_INDENT);
00134
00135     // Inserts a new item in a ComboBoxEx control.
00136     // Returns the index at which the new item was inserted if
00137     // successful; otherwise -1
00138     int InsertItem(
00139         // item index.
00140         int iItem,
00141         // item string.
00142         LPCTSTR lpszItem,
00143         // ammount (in pixels) image is to be indented.
00144         int iIndent=0,
00145         // image index.
00146         int iImage=0,
00147         // selected image index.
00148         int iSelectedImage=0,
00149         // style mask.
00150         UINT mask=CBEIF_TEXT|CBEIF_IMAGE|CBEIF_SELECTEDIMAGE|CBEIF_INDENT);
00151
00152     // Sets the attributes for an item in a ComboBoxEx control.
00153     // Returns nonzero if the operation was successful; otherwise 0.
00154     //
00155     BOOL SetItem(
00156         // A pointer to aCOMBOBOXEXITEM structure that will receive the
00157         // item information
00158         const COMBOBOXEXITEM* pCBItem);
00159
00160 // Atrributes
00161 public:
00162
00163     // Retrieves the extended styles that are in use for a ComboBoxEx
00164     // control. Returns the DWORD value that contains the extended styles
00165     // that are used for the combo box control.
00166     //
00167     DWORD GetExtendedStyle() const;
00168
00169     // Sets extended styles within a ComboBoxEx control.
00170     // Returns a DWORD value that contains the extended styles previously
00171     // used for the control.
00172     //
00173     DWORD SetExtendedStyle(
00174         // A DWORD value that indicates which styles in dwExStyles are to
00175         // be affected. Only the extended styles in dwExMask will be changed.
00176         // All other styles will be maintained as is. If this parameter is
00177         // zero, then all of the styles in dwExStyles will be affected
00178         DWORD dwExMask,
00179         // A DWORD value that contains the combo box control extended styles
00180         // to set for the control
00181         DWORD dwExStyles);
00182
00183     // Determines if the user has changed the contents of the ComboBoxEx
00184     // edit control by typing.
00185     // Returns nonzero if the user has typed in the control's
00186     // edit box; otherwise 0.
00187     BOOL HasEditChanged();
00188
00189     // Retrieves the handle to the edit control portion of a ComboBoxEx
00190     // control. Returns a pointer to a CEdit object.
00191     //
00192     CEdit* GetEditCtrl();
00193
00194     // Retrieves a pointer to the child combo box control.
00195     // Returns a pointer to a CComboBox object.
00196     //
00197     CComboBox* GetComboBoxCtrl();
00198
00199     // Retrieves a pointer to the image list assigned to a ComboBoxEx
00200     // control. Returns a pointer to a CImageList object. If it fails,
00201     // this member function returns NULL.
00202     //
00203     CImageList* GetImageList() const;
00204
00205     // Sets an image list for a ComboBoxEx control.
00206     // Returns a pointer to a CImageList object containing the images
00207     // previously used by the CCJComboBoxEx control. NULL if no image list
00208     //was previously set.
00209     //
00210     CImageList* SetImageList(
00211         // A pointer to a CImageList object containing the images to use with
00212         // the CCJComboBoxEx control.
00213         CImageList* pImageList);
00214
00215 // Un-supported
00216 public:
00217
00218     // Un-supported base class message.
00219     //
00220     int Dir(UINT attr, LPCTSTR lpszWildCard);
00221
00222     // Un-supported base class message.
00223     //
00224     int FindString(int nIndexStart, LPCTSTR lpszFind) const;
00225
00226     // Un-supported base class message.
00227     //
00228     int AddString(LPCTSTR lpszString);
00229
00230     // Un-supported base class message.
00231     //
00232     BOOL SetEditSel(int nStartChar, int nEndChar);
00233
00234     // Un-supported base class message.
00235     //
00236     int InsertString(int nIndex, LPCTSTR lpszString);
00237 };
00238
00240 //  Inline Functions
00242
00243 _CJXLIB_INLINE CCJComboBoxEx::CCJComboBoxEx()
00244     { }
00245 _CJXLIB_INLINE DWORD CCJComboBoxEx::GetExtendedStyle() const
00246     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, CBEM_GETEXTENDEDSTYLE, 0, 0); }
00247 _CJXLIB_INLINE DWORD CCJComboBoxEx::SetExtendedStyle(DWORD dwExMask, DWORD dwExStyles)
00248     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, CBEM_SETEXTENDEDSTYLE, (DWORD) dwExMask, (LPARAM) dwExStyles); }
00249 _CJXLIB_INLINE BOOL CCJComboBoxEx::HasEditChanged()
00250     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, CBEM_HASEDITCHANGED, 0, 0); }
00251 _CJXLIB_INLINE CEdit* CCJComboBoxEx::GetEditCtrl()
00252     { ASSERT(::IsWindow(m_hWnd)); return (CEdit*) CEdit::FromHandle((HWND) ::SendMessage(m_hWnd, CBEM_GETEDITCONTROL, 0, 0)); }
00253 _CJXLIB_INLINE CComboBox* CCJComboBoxEx::GetComboBoxCtrl()
00254     { ASSERT(::IsWindow(m_hWnd)); return (CComboBox*) CComboBox::FromHandle((HWND) ::SendMessage(m_hWnd, CBEM_GETCOMBOCONTROL, 0, 0)); }
00255 _CJXLIB_INLINE CImageList* CCJComboBoxEx::SetImageList(CImageList* pImageList)
00256     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, CBEM_SETIMAGELIST, 0, (LPARAM)pImageList->GetSafeHandle())); }
00257 _CJXLIB_INLINE CImageList* CCJComboBoxEx::GetImageList() const
00258     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, CBEM_GETIMAGELIST, 0, 0)); }
00259
00260 // While CCJComboBoxEx derives from CComboBox, there are some
00261 // CB_messages the underlying ComboBoxEx control doesn't support.
00262
00263 _CJXLIB_INLINE int CCJComboBoxEx::Dir(UINT attr, LPCTSTR lpszWildCard)
00264     { UNUSED_ALWAYS(attr); UNUSED_ALWAYS(lpszWildCard); ASSERT(FALSE); return CB_ERR; }
00265 _CJXLIB_INLINE int CCJComboBoxEx::FindString(int nIndexStart, LPCTSTR lpszFind) const
00266     { UNUSED_ALWAYS(nIndexStart); UNUSED_ALWAYS(lpszFind); ASSERT(FALSE); return CB_ERR; }
00267 _CJXLIB_INLINE int CCJComboBoxEx::AddString(LPCTSTR lpszString)
00268     { UNUSED_ALWAYS(lpszString); ASSERT(FALSE); return CB_ERR; }
00269 _CJXLIB_INLINE BOOL CCJComboBoxEx::SetEditSel(int nStartChar, int nEndChar)
00270     { UNUSED_ALWAYS(nStartChar); UNUSED_ALWAYS(nEndChar); ASSERT(FALSE); return FALSE; }
00271 _CJXLIB_INLINE int CCJComboBoxEx::InsertString(int nIndex, LPCTSTR lpszString)
00272     { UNUSED_ALWAYS(nIndex); UNUSED_ALWAYS(lpszString); ASSERT(FALSE); return CB_ERR; }
00273
00274 #endif //__CJCOMBOBOXEX_H__
00275
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJControlBar.h Source File

WinCvs/CJLib/Include/CJControlBar.h

Go to the documentation of this file.
00001 // CJControlBar.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJControlBar.h $
00011  *
00012  * $History: CJControlBar.h $
00013  *
00014  * *****************  Version 19  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:21p
00016  * Updated in $/CodeJock/Include
00017  * Overrode OnEraseBkgnd(...) and OnPaint() to handle flicker free
00018  * drawing. Made additional modifications to load and save bar state
00019  * methods.
00020  *
00021  * Modified resource include for static builds.
00022  *
00023  * Enabled OnInitialUpdate() to be called for view classes added to a
00024  * CCJTabCtrlBar while the control bar is floating.
00025  *
00026  * Fixed potential resource and memory leak problems.
00027  *
00028  * Overloaded EnableFlatLook() method so that the gripper, frame buttons
00029  * and borders can be set flat individually.  Added inline function
00030  * EnableSaveState() which can be used to enable or disable the restore
00031  * bar state.
00032  *
00033  * Fixed bug with save / restore bar state, and with saved bar size
00034  * changing whenever the application starts.
00035  *
00036  * Fixed small initialization bug.
00037  *
00038  * Made class methods virtual for inheritence purposes.
00039  *
00040  * *****************  Version 18  *****************
00041  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00042  * Updated in $/CodeJockey/Include
00043  * Updated copyright and contact information.
00044  *
00045  * *****************  Version 17  *****************
00046  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00047  * Updated in $/CodeJockey/Include
00048  *
00049  * *****************  Version 16  *****************
00050  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00051  * Updated in $/CodeJockey/Include
00052  *
00053  * *****************  Version 15  *****************
00054  * User: Kirk Stowell Date: 7/18/99    Time: 10:18p
00055  * Updated in $/CodeJockey/Include
00056  * Added derived button class to handle control bar caption button
00057  * updates. Cleaned up inline functions, and import/export macro so that
00058  * class will be imported when linked to, and exported at compile time.
00059  *
00060  * *****************  Version 14  *****************
00061  * User: Kirk Stowell Date: 6/11/99    Time: 8:24p
00062  * Updated in $/CodeJockey/Include
00063  * Slight modification made to popup menu code.
00064  *
00065  * *****************  Version 13  *****************
00066  * User: Kirk Stowell Date: 6/09/99    Time: 8:33p
00067  * Updated in $/CodeJockey/Include
00068  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00069  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00070  * message handler, this is now automatically handled by the base class.
00071  * Added redraw flags to the create method and modified paint and layout
00072  * handlers to reduce flicker and un-necessary command handling. Dragging
00073  * rect now reflects actual control bar docked size. Added "flat" look to
00074  * the control bars, the control bars can now use the classic DevStudio
00075  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00076  * docking windows now handle dragging, docking and floating much better,
00077  * and behave more like DevStudio.
00078  *
00079  * *****************  Version 12  *****************
00080  * User: Kirk Stowell Date: 5/03/99    Time: 9:52p
00081  * Updated in $/CodeJockey/Include
00082  * Changed gripper and button macros to enums. Renamed popup member
00083  * variables to begin with popup, this will be consistent throughout all
00084  * classes. Added m_nPos member variable which can be set to the index of
00085  * the popup menu in the menu resource. Removed windows message handler
00086  * ON_WM_CONTEXTMENU(), and added handlers ON_WM_RBUTTONDOWN(),
00087  * ON_WM_MEASUREITEM(), ON_WM_MENUCHAR() and ON_WM_INITMENUPOPUP() to
00088  * support the CCJMenu popup. Added WS_CLIPSIBLINGS to control bar style.
00089  * Changed OnEraseBkgnd(CDC* pDC) to only draw client area when a child is
00090  * not present.
00091  *
00092  * *****************  Version 11  *****************
00093  * User: Kirk Stowell Date: 4/14/99    Time: 12:54p
00094  * Updated in $/CodeJockey/Include
00095  * Modified context menu to use Brent Corkum's BCMenu (CCJMenu).
00096  *
00097  * *****************  Version 10  *****************
00098  * User: Kirk Stowell Date: 4/03/99    Time: 12:52p
00099  * Updated in $/CodeJockey/Include
00100  * Added comments and cleaned up code.
00101  *
00102  * *****************  Version 9  *****************
00103  * User: Kirk Stowell Date: 3/13/99    Time: 12:54p
00104  * Updated in $/CodeJockey/Include
00105  * Patrick Bergeron [patb@softimage.com] fixed the following bugs:
00106  *
00107  * I had a dialog nested in a CJControlBar. Unfortunately when I tried to
00108  * dock it to the left or right, the bottom part of my dialog would be
00109  * clipped off.
00110  *
00111  * Fix: When in docked mode, ::CalcDynamicLayout needed to return the
00112  * desired size, while taking into account the size of the gripper bar (if
00113  * any). Simply added a simple "+GetMinExt()" Now my dialog's bottom
00114  * doesn't get clipped. Woo-ha.
00115  *
00116  * When nesting a CDialog based window inside a CJControlBar, the 3D rect
00117  * drawn by ::OnEraseBkgnd would be overwritten by the top and left dialog
00118  * borders. The problem was caused by the fact that in the
00119  * ::OnWindowPosChanged() method, the rectangle which is used to move the
00120  * window contains the border. A simple call to rc.DeflateRect(1,1) solved
00121  * this problem.
00122  *
00123  * Added a call to UpdateWindow() in ::OnEraseBkgnd(). This helps with the
00124  * flickering a bit, but I Am not sure this is the correct way to go.
00125  * Incorporate at your own risks.
00126  *
00127  * Added 2 ASSERT()s in ::OnMouseMove(). This was not to fix a bug, but at
00128  * one point I was seeing strange things that lead me to add these
00129  * asserts. They don't do anything bad, so why remove them?
00130  *
00131  * *****************  Version 8  *****************
00132  * User: Kirk Stowell Date: 3/10/99    Time: 12:50p
00133  * Updated in $/CodeJockey/Include
00134  * Fixed memory leak with button tooltips.
00135  *
00136  * *****************  Version 7  *****************
00137  * User: Kirk Stowell Date: 3/10/99    Time: 12:48p
00138  * Updated in $/CodeJockey/Include
00139  * Added AfxRegisterWndClass() to create method to handle double clicks.
00140  * Thanks to Takehiko Mizoguti [mizoguti@m2.sys.to.casio.co.jp] for some
00141  * thoughts on this.
00142  *
00143  * *****************  Version 6  *****************
00144  * User: Kirk Stowell Date: 2/28/99    Time: 12:47p
00145  * Updated in $/CodeJockey/Include
00146  * Calls default wnd proc if no context menu is defined Gonzalo Pereyra
00147  * [persys@adinet.com.uy]
00148  *
00149  * *****************  Version 5  *****************
00150  * User: Kirk Stowell Date: 1/31/99    Time: 12:48p
00151  * Updated in $/CodeJockey/Include
00152  * Removed extra line (typo) from OnLButtonUp(). Thanks to Ioannis
00153  * Stamatopoulos (ystamat@mail.datamedia.gr) for pointing this out.
00154  *
00155  * *****************  Version 4  *****************
00156  * User: Kirk Stowell Date: 1/12/99    Time: 12:46p
00157  * Updated in $/CodeJockey/Include
00158  * Total class re-write, added multiple/side-by-side controlbar docking.
00159  * No longer uses CSizingControlBar base class.
00160  *
00161  * *****************  Version 3  *****************
00162  * User: Kirk Stowell Date: 11/22/98   Time: 12:47p
00163  * Updated in $/CodeJockey/Include
00164  * Modified set cursor to display normal size cursor when static linked.
00165  *
00166  * *****************  Version 2  *****************
00167  * User: Kirk Stowell Date: 10/20/98   Time: 12:45p
00168  * Updated in $/CodeJockey/Include
00169  * Fixed problem with gripper and buttons disappearing when docking
00170  * toggled. Overloaded IsFloating() method from base class.
00171  *
00172  * *****************  Version 1  *****************
00173  * User: Kirk Stowell Date: 10/17/98   Time: 12:44p
00174  * Created in $/CodeJockey/Include
00175  * Initial re-write and release.
00176  *
00177  ***************************************************************************/
00179
00180 #ifndef __CJCONTROLBAR_H__
00181 #define __CJCONTROLBAR_H__
00182
00183 #if _MSC_VER >= 1000
00184 #pragma once
00185 #endif // _MSC_VER >= 1000
00186
00187 #include "CJFlatButton.h"
00188 #include "CJMenu.h"        // CCJMenu class declaration
00189
00190 // CCJCBarButton is a CCJFlatButton derived class which is used by
00191 // the CCJControlBar class.
00192 class _CJX_EXT_CLASS CCJCBarButton : public CCJFlatButton
00193 {
00194 protected:
00195     virtual void DrawButtonIcon(CDC* pDC, UINT nState, CRect& rcItem);
00196 };
00197
00198 typedef enum { HIDE_CONTRLBAR,
00199     MAXI_H_DISABLE, MAXI_H_ENABLED, MAXI_V_DISABLE, MAXI_V_ENABLED,
00200     NORM_H_DISABLE, NORM_H_ENABLED, NORM_V_DISABLE, NORM_V_ENABLED
00201 } BTN_IMG_INDEX;
00202
00203 typedef enum { NONE, OUTLINE, SUNKEN, RAISED } CHILD_BORDER;
00204
00205 // CCJControlBar is a CControlBar derived class which is simular to
00206 // the sizing / docking windows that are seen in Developer Studio.
00207 class _CJX_EXT_CLASS CCJControlBar : public CControlBar
00208 {
00209     DECLARE_DYNAMIC(CCJControlBar)
00210
00211 public:
00212
00213     // Default constructor
00214     //
00215     CCJControlBar();
00216
00217     // Virtual destructor
00218     //
00219     virtual ~CCJControlBar();
00220
00221 public:
00222
00223     BOOL            m_bUnique;              // used by CCJControlBar and CCJSizeDockBar,
00224                                             // set to true when the controlbar is the
00225                                             // only one docked on any given side.
00226
00227     BOOL            m_bToFit;               // used by CCJControlBar and CCJSizeDockBar,
00228                                             // to determine border layouts depending on bar
00229                                             // state.
00230
00231     CHILD_BORDER    m_eChildBorder;         // determines if a border should be drawn around the child area.
00232
00233 protected:
00234
00235     int             m_cxOffset;             // used to offset the horizontal client area
00236                                             // to allow room for the caption when docked.
00237
00238     int             m_cyOffset;             // used to offset the vertical client area to
00239                                             // allow room for the caption when docked.
00240
00241     BTN_IMG_INDEX   m_eAuxIndex;            // used to determine which button icon to
00242                                             // display when the control bar is minimized
00243                                             // or maximized depending on which side docked.
00244
00245     UINT            m_popToolbarID;         // popup menu toolbar resource id, associates
00246                                             // toolbar icons with the popup menu.
00247
00248     UINT            m_popupMenuID;          // popup menu resource id
00249     CCJMenu         m_popupMenu;            // popup menu
00250     int             m_nPos;                 // index of the pop-up menu contained in the menu
00251
00252     BOOL            m_bOkToDrag;            // used to determine if a drag operation
00253                                             // should occur.
00254
00255     BOOL            m_bMaximized;           // used to determine if the control bar has
00256                                             // been maximized.
00257
00258     BOOL            m_bDragging;            // set to TRUE when a drag operation is in
00259                                             // process.
00260
00261
00262     BOOL            m_bButtons;             // user defined flag, set to TRUE if the
00263                                             // control bar should display buttons.
00264
00265     CRect           m_rcTrack;              // used to determine rect of the tracker window.
00266     CSize           m_sizeDesired;          // the desired size of the control bar.
00267     CSize           m_sizeNormal;           // normal size of the control bar.
00268     CSize           m_sizeVert;             // vertical size
00269     CSize           m_sizeHorz;             // horizontal size
00270     CSize           m_sizeFloat;            // float size
00271     CPoint          m_ptCurDrag;            // cursor location during a drag operation.
00272     CPoint          m_ptStartDrag;          // cursor starting point during a drag operation.
00273
00274     CWnd*           m_pChildWnd;            // CWnd pointer which is contains child window
00275                                             // that is displayed in the control bar, see
00276                                             // SetChild(CWnd* pWnd).
00277
00278     CImageList      m_ImageList;            // contains the caption control buttons images.
00279     CCJCBarButton   m_btnClose;             // close button used in caption area.
00280     CCJCBarButton   m_btnMinim;             // minimize button used in the caption area.
00281     CToolTipCtrl    m_ToolTip;              // tooltip used for caption buttons.
00282
00283     BOOL            m_bGripper;             // user defined flag, set to TRUE if a
00284                                             // gripper should be drawn in the control
00285                                             // bar, see ShowFrameControls(...).
00286     BOOL            m_bFlatGripper;         // user defined flag, set to TRUE if for a flat
00287                                             // Gripper look
00288     BOOL            m_bFlatBorder;          // user defined flag, set to TRUE if for a flat
00289                                             // Border look
00290     CString         m_strSection;           // used by the control bar for registry entries.
00291     bool            m_bAutoSave;            // true to restore size and position true by default.
00292     HICON           m_hIcon;                // handle to close button icon.
00293     HICON           m_hAuxIcon;             // handle to auxiliary button icon.
00294     int             m_nID;                  // holds the resource id for this control.
00295     BOOL            m_bFloating;            // true if the control bar was floating when last destroyed.
00296
00297 public:
00298
00299     // this member function is called to enable/disable size and
00300     // position at startup.
00301     //
00302     virtual void EnableSaveState(bool bAutoSave=true);
00303
00304     // this member function is used to create a sizing / docking control bar.
00305     //
00306     virtual BOOL Create(
00307         // the parent window.
00308         CWnd* pParentWnd,
00309         // The ID of the control bar.
00310         UINT nID,
00311         // Points to a null-terminated character string that contains the
00312         // control bar title.
00313         LPCTSTR lpszWindowName = NULL,
00314         // The default size the control bar is to be.
00315         CSize sizeDefault = CSize(200,100),
00316         // Specifies the window style attributes.
00317         DWORD dwStyle = CBRS_LEFT,
00318         // TRUE for flat style control bars.
00319         BOOL bFlatBorders = FALSE);
00320
00321     // this member function is called by the control bar, and
00322     // can be overloaded in derived classes to return the rect
00323     // for the child window associated with the control bar.
00324     //
00325     virtual void GetChildRect(
00326         // reference to a CRect object which contains the size of
00327         // the child window associated with the control bar.
00328         CRect &rect);
00329
00330     // this member function is called by the control bar to
00331     // determine the minimum size of the control bar should be
00332     // when miminized or maximized.
00333     //
00334     virtual int GetMinExt();
00335
00336     // this member function returns TRUE if the control
00337     // bar is docked on the left.
00338     //
00339     virtual BOOL IsLeftDocked() const;
00340
00341     // this member function returns TRUE if the control
00342     // bar is docked on the right.
00343     //
00344     virtual BOOL IsRightDocked() const;
00345
00346     // this member function returns TRUE if the control
00347     // bar is docked on the top.
00348     //
00349     virtual BOOL IsTopDocked() const;
00350
00351     // this member function returns TRUE if the control
00352     // bar is docked on the bottom.
00353     //
00354     virtual BOOL IsBottomDocked() const;
00355
00356     // this member function returns TRUE if the control
00357     // bar is docked horizontal.
00358     //
00359     virtual BOOL IsHorzDocked() const;
00360
00361     // this member function returns TRUE if the control
00362     // bar is docked vertical.
00363     //
00364     virtual BOOL IsVertDocked() const;
00365
00366     // this member function returns TRUE if the control
00367     // bar is currently floating.
00368     //
00369     virtual BOOL IsFloating() const;
00370
00371     // this member function is called by the control bar
00372     // to set the normal size the control bar should be.
00373     //
00374     virtual void SetNormalSize(const CSize &cs);
00375
00376     // this member function is called by the control bar
00377     // to return the control bar to its normal size.
00378     //
00379     virtual void Normalize();
00380
00381     // this member function is called by the control bar
00382     // to minimize the control bar.
00383     //
00384     virtual void Minimize();
00385
00386     // this member function is called by the control bar
00387     // to maximize the control bar.
00388     //
00389     virtual void Maximize(int size);
00390
00391     // this member function is to be called after creation to enable
00392     // docking on the control bar.
00393     //
00394     virtual void EnableDockingOnSizeBar(
00395         // Specifies which sides of the frame window can serve as docking sites
00396         // for control bars. It can be one or more of the following:
00397         //
00398         // CBRS_ALIGN_TOP   Allows docking at the top of the client area.
00399         // CBRS_ALIGN_BOTTOM   Allows docking at the bottom of the client area.
00400         // CBRS_ALIGN_LEFT   Allows docking on the left side of the client area.
00401         // CBRS_ALIGN_RIGHT   Allows docking on the right side of the client area.
00402         // CBRS_ALIGN_ANY   Allows docking on any side of the client area.
00403         DWORD dwDockStyle);
00404
00405     // this member function is used to show / hide the frame controls
00406     // for the control bar.
00407     //
00408     virtual void ShowFrameControls(
00409         // set to FALSE to hide the gripper.
00410         BOOL bGripper = TRUE,
00411         // set to FALSE to hide the frame buttons.
00412         BOOL bButtons = TRUE);
00413
00414     // this member function is used to set the resource id for the popup menu used.
00415     //
00416     virtual void SetMenuID(UINT popupMenuID, UINT popToolbarID=0, int nPos=0);
00417
00418     // this member function returns the resource id of the context menu used.
00419     //
00420     virtual UINT GetMenuID();
00421
00422     virtual void EnableFlatLook(BOOL bFlat=TRUE);
00423
00424     virtual void EnableFlatLook(BOOL bGripper, BOOL bBorder, BOOL bButtons);
00425
00426     // this member function is used to determine the width when docked vertical.
00427     //
00428     virtual int GetVertSize();
00429
00430     // this member function is used to determine the height when docked horizontal
00431     //
00432     virtual int GetHorzSize();
00433
00434 protected:
00435
00436     // this member function is called by the control bar to caluclate
00437     // the size of the gripper in the caption area.
00438     //
00439     virtual CRect GetGripperRect();
00440
00441     // this member function is called by the control bar to calculate the
00442     // size of the buttons used in the caption area.
00443     //
00444     virtual CRect GetButtonRect();
00445
00446     // this member function is called by the control bar to draw
00447     // the gripper in the caption area.
00448     //
00449     virtual void DrawGripper(CDC* pDC);
00450
00451     // this member function is used to associate a child window
00452     // that is to be displayed in the control bar.
00453     //
00454     virtual void SetChild(CWnd* pWnd);
00455
00456     // this member function is called by the control bar
00457     // during resizing of splitters.
00458     //
00459     virtual void OnInvertTracker(const CRect& rect);
00460
00461     // this member function is called by the control bar
00462     // to determine cursor position
00463     // for drag operations.
00464     //
00465     virtual void HitTest(CPoint &point);
00466
00467     // this member function is called by the control bar
00468     // to draw its borders.
00469     //
00470     virtual void DrawBorders(CDC *pDC, CRect &rect);
00471
00472     // this member function is called by the control bar
00473     // to perform paint operations.
00474     //
00475     virtual void EraseNonClient();
00476
00477     // this member function is used to draw the new flat style control bar.
00478     //
00479     virtual void DrawGriperCaption( CDC * pDC, LPRECT pRect );
00480
00481     virtual void LoadBarState(CSize& size, int nID);
00482
00483     virtual void SaveBarState(CSize& size);
00484
00485 // Overrides
00486     // ClassWizard generated virtual function overrides
00487     //{{AFX_VIRTUAL(CCJControlBar)
00488     public:
00489     virtual BOOL PreTranslateMessage(MSG* pMsg);
00490     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
00491     virtual CSize CalcDynamicLayout(int nLength, DWORD nMode);
00492     //}}AFX_VIRTUAL
00493
00494 // Generated message map functions
00495 protected:
00496     //{{AFX_MSG(CCJControlBar)
00497     afx_msg void OnNcPaint();
00498     afx_msg void OnPaint();
00499     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00500     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00501     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00502     afx_msg UINT OnNcHitTest(CPoint point);
00503     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00504     afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
00505     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00506     afx_msg void OnButtonClose();
00507     afx_msg void OnUpdateButtonClose(CCmdUI* pCmdUI);
00508     afx_msg void OnButtonMinimize();
00509     afx_msg void OnUpdateButtonMinimize(CCmdUI* pCmdUI);
00510     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00511     afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
00512     afx_msg LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu);
00513     afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
00514     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00515     //}}AFX_MSG
00516     DECLARE_MESSAGE_MAP()
00517 };
00518
00519 #define AFX_IDW_SIZEBAR_LEFT    AFX_IDW_DOCKBAR_LEFT    + 4
00520 #define AFX_IDW_SIZEBAR_RIGHT   AFX_IDW_DOCKBAR_RIGHT   + 5
00521 #define AFX_IDW_SIZEBAR_TOP     AFX_IDW_DOCKBAR_TOP     + 6
00522 #define AFX_IDW_SIZEBAR_BOTTOM  AFX_IDW_DOCKBAR_BOTTOM  + 7
00523
00524 const DWORD dwSizeBarMap[4][2] =
00525 {
00526     { AFX_IDW_SIZEBAR_TOP,      CBRS_TOP    },
00527     { AFX_IDW_SIZEBAR_BOTTOM,   CBRS_BOTTOM },
00528     { AFX_IDW_SIZEBAR_LEFT,     CBRS_LEFT   },
00529     { AFX_IDW_SIZEBAR_RIGHT,    CBRS_RIGHT  },
00530 };
00531
00533 //  Inline Functions
00535
00536 _CJXLIB_INLINE void CCJControlBar::EnableSaveState(bool bAutoSave)
00537     { ASSERT(::IsWindow(m_hWnd)); m_bAutoSave = bAutoSave; }
00538
00539 _CJXLIB_INLINE int CCJControlBar::GetVertSize()
00540     { ASSERT(::IsWindow(m_hWnd)); return m_sizeDesired.cx; }
00541
00542 _CJXLIB_INLINE int CCJControlBar::GetHorzSize()
00543     { ASSERT(::IsWindow(m_hWnd)); return m_sizeDesired.cy; }
00544
00545 _CJXLIB_INLINE UINT CCJControlBar::GetMenuID()
00546     { ASSERT(::IsWindow(m_hWnd)); return m_popupMenuID; }
00547
00548 _CJXLIB_INLINE void CCJControlBar::SetMenuID(UINT popupMenuID, UINT popToolbarID, int nPos)
00549     { ASSERT(::IsWindow(m_hWnd)); m_popupMenuID=popupMenuID; m_popToolbarID=popToolbarID; m_nPos=nPos; }
00550
00551 _CJXLIB_INLINE void CCJControlBar::ShowFrameControls(BOOL bGripper, BOOL bButtons)
00552     { ASSERT(::IsWindow(m_hWnd)); m_bGripper=bGripper; m_bButtons=bButtons; }
00553
00554 _CJXLIB_INLINE void CCJControlBar::SetNormalSize(const CSize &cs)
00555     { ASSERT(::IsWindow(m_hWnd)); m_sizeDesired=m_sizeNormal=cs; }
00556
00557 _CJXLIB_INLINE BOOL CCJControlBar::IsVertDocked() const
00558     { ASSERT(::IsWindow(m_hWnd)); return (IsLeftDocked() || IsRightDocked()); }
00559
00560 _CJXLIB_INLINE BOOL CCJControlBar::IsHorzDocked() const
00561     { ASSERT(::IsWindow(m_hWnd)); return (IsTopDocked() || IsBottomDocked()); }
00562
00563 _CJXLIB_INLINE BOOL CCJControlBar::IsBottomDocked() const
00564     { ASSERT(::IsWindow(m_hWnd)); return (GetParent()->GetDlgCtrlID()==AFX_IDW_SIZEBAR_BOTTOM); }
00565
00566 _CJXLIB_INLINE BOOL CCJControlBar::IsTopDocked() const
00567     { ASSERT(::IsWindow(m_hWnd)); return (GetParent()->GetDlgCtrlID()==AFX_IDW_SIZEBAR_TOP); }
00568
00569 _CJXLIB_INLINE BOOL CCJControlBar::IsRightDocked() const
00570     { ASSERT(::IsWindow(m_hWnd)); return (GetParent()->GetDlgCtrlID()==AFX_IDW_SIZEBAR_RIGHT); }
00571
00572 _CJXLIB_INLINE BOOL CCJControlBar::IsLeftDocked() const
00573     { ASSERT(::IsWindow(m_hWnd)); return (GetParent()->GetDlgCtrlID()==AFX_IDW_SIZEBAR_LEFT); }
00574
00575 _CJXLIB_INLINE BOOL CCJControlBar::IsFloating() const
00576     { ASSERT(::IsWindow(m_hWnd)); return (!IsHorzDocked() && !IsVertDocked()); }
00577
00578 _CJXLIB_INLINE void CCJControlBar::SetChild(CWnd *pWnd)
00579     { ASSERT(::IsWindow(m_hWnd)); m_pChildWnd=pWnd; }
00580
00582
00583 //{{AFX_INSERT_LOCATION}}
00584 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00585
00586 #endif // __CJCONTROLBAR_H__
00587
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJDateTimeCtrl.h Source File

WinCvs/CJLib/Include/CJDateTimeCtrl.h

Go to the documentation of this file.
00001 // CJDateTimeCtrl.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new
00007 // IE4 controls' http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:49 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/Include/CJDateTimeCtrl.h $
00015  *
00016  * $History: CJDateTimeCtrl.h $
00017  *
00018  * *****************  Version 7  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/Include
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 6  *****************
00024  * User: Kirk Stowell Date: 7/31/99    Time: 4:27p
00025  * Updated in $/CodeJockey/Include
00026  *
00027  * *****************  Version 4  *****************
00028  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00029  * Updated in $/CodeJockey/Include
00030  *
00031  * *****************  Version 3  *****************
00032  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00033  * Updated in $/CodeJockey/Include
00034  *
00035  * *****************  Version 2  *****************
00036  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00037  * Updated in $/CodeJockey/Include
00038  * Cleaned up inline functions, and import/export macro so that class will
00039  * be imported when linked to, and exported at compile time.
00040  *
00041  * *****************  Version 1  *****************
00042  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00043  * Created in $/CodeJockey/Include
00044  * Copied from MFC, Visual C++ 6 and vc5 Tech. Preview. Added to extend
00045  * functionality to Visual C++ 5 users.
00046  *
00047  ***************************************************************************/
00049
00050 #ifndef __CJDATETIMECTRL_H__
00051 #define __CJDATETIMECTRL_H__
00052
00053
00054 class CCJMonthCalCtrl;
00055
00056 // A CCJDateTimeCtrl object encapsulates the functionality of a date and time picker
00057 // control. The date and time picker control (DTP control) provides a simple interface
00058 // to exchange date and time information with a user. This interface contains fields,
00059 // each of which displays a part of the date and time information stored in the control.
00060 // The user can change the information stored in the control by changing the content of
00061 // the string in a given field. The user can move from field to field using the mouse or
00062 // the keyboard.
00063 class _CJX_EXT_CLASS CCJDateTimeCtrl : public CWnd
00064 {
00065     DECLARE_DYNAMIC(CCJDateTimeCtrl)
00066
00067 // Construction / destruction
00068 public:
00069
00070     // Constructs a CDateTimeCtrl object.
00071     //
00072     CCJDateTimeCtrl();
00073
00074     // Destroys a CDateTimeCtrl object.
00075     //
00076     virtual ~CCJDateTimeCtrl();
00077
00078 // Initialization
00079 public:
00080
00081     // Creates the date and time picker control and attaches it to the
00082     // CDateTimeCtrl object. Returns nonzero if creation was successful;
00083     // otherwise 0.
00084     //
00085     BOOL Create(
00086         // Specifies the combination of date time control styles. SeeDate
00087         // and Time Picker Control Styles in the Platform SDK for more information
00088         //about date and time picker styles.
00089         DWORD dwStyle,
00090         // A reference to aRECT structure, which is the position and size of the
00091         // date and time picker control.
00092         const RECT& rect,
00093         // A pointer to a CWnd object that is the parent window of the date and
00094         // time picker control. It must not be NULL.
00095         CWnd* pParentWnd,
00096         // Specifies the date and time picker control's control ID.
00097         UINT nID);
00098
00099 // Attributes
00100 public:
00101
00102     // Retrieves the color for a given portion of the month calendar within the
00103     // date and time picker control. Returns a COLORREF value that represents the
00104     // color setting for the specified portion of the month calendar control if
00105     // successful. The function returns -1 if unsuccessful.
00106     //
00107     COLORREF GetMonthCalColor(
00108         // An int value specifying which color area of the month calendar to
00109         // retrieve. For a list of values, see the iColor parameter for
00110         // SetMonthCalColor.
00111         int iColor) const;
00112
00113     // Sets the color for a given portion of the month calendar within a date
00114     // and time picker control. Returns a COLORREF value that represents the
00115     // previous color setting for the specified portion of the month calendar
00116     // control if successful. Otherwise, the message returns -1.
00117     //
00118     COLORREF SetMonthCalColor(
00119         // int value specifying which area of the month calendar control to set.
00120         // This value can be one of the following.
00121         //
00122         // Value                Meaning
00123         // MCSC_BACKGROUND      Set the background color displayed between months.
00124         // MCSC_MONTHBK         Set the background color displayed within a month.
00125         // MCSC_TEXT            Set the color used to display text within a month.
00126         // MCSC_TITLEBK         Set the background color displayed in the calendar's title.
00127         // MCSC_TITLETEXT       Set the color used to display text within the calendar's title.
00128         // MCSC_TRAILINGTEXT    Set the color used to display header and trailing-day text. Header and trailing days are the days from the previous and following months that appear on the current calendar.
00129         int iColor,
00130         // A COLORREF value representing the color that will be set for the specified
00131         // area of the month calendar.
00132         COLORREF ref);
00133
00134     // Sets the display of a date and time picker control based on a given format string.
00135     // Returns nonzero if successful; otherwise 0.
00136     //
00137     BOOL SetFormat(
00138         // A pointer to a zero-terminated format string that defines the desired display.
00139         // Setting this parameter to NULL will reset the control to the default format
00140         // string for the current style.
00141         LPCTSTR pstrFormat);
00142
00143     // Retrieves the date and time picker's child month calendar control.
00144     // Returns a pointer to a CMonthCalCtrl object, or NULL if unsuccessful or if
00145     // the window is not visible.
00146     //
00147     CCJMonthCalCtrl* GetMonthCalCtrl() const;
00148
00149     // Retrieves the font currently used by the date and time picker control's child
00150     // month calendar control. Returns a pointer to a CFont object, or NULL if unsuccessful.
00151     //
00152     CFont* GetMonthCalFont() const;
00153
00154     // Sets the font to be used by the date and time picker control's child month
00155     // calendar control.
00156     void SetMonthCalFont(
00157         // Handle to the font that will be set.
00158         HFONT hFont,
00159         // Specifies whether the control should be redrawn immediately upon setting the
00160         // font. Setting this parameter to TRUE causes the control to redraw itself.
00161         BOOL bRedraw = TRUE);
00162
00163     // Sets the minimum and maximum allowable system times for a date and time
00164     // picker control. Returns nonzero if successful; otherwise 0.
00165     //
00166     BOOL SetRange(
00167         // A pointer to a COleDateTime object containing the
00168         // earliest time allowed in the CDateTimeCtrl object.
00169         const COleDateTime* pMinRange,
00170         // A pointer to a COleDateTime object containing the
00171         // latest time allowed in the CDateTimeCtrl object.
00172         const COleDateTime* pMaxRange);
00173
00174     // Sets the minimum and maximum allowable system times for a date and time
00175     // picker control. Returns nonzero if successful; otherwise 0.
00176     //
00177     BOOL SetRange(
00178         // A pointer to a CTime object containing the
00179         // earliest time allowed in the CDateTimeCtrl object.
00180         const CTime* pMinRange,
00181         // A pointer to a CTime object containing the
00182         // latest time allowed in the CDateTimeCtrl object.
00183         const CTime* pMaxRange);
00184
00185     // Retrieves the current minimum and maximum allowable system times for a date
00186     // and time picker control. Returns a DWORD value containing flags that indicate
00187     // which ranges are set.
00188     //
00189     DWORD GetRange(
00190         // A pointer to a COleDateTime object containing the
00191         // earliest time allowed in the CDateTimeCtrl object.
00192         COleDateTime* pMinRange,
00193         // A pointer to a COleDateTime object containing the
00194         // latest time allowed in the CDateTimeCtrl object.
00195         COleDateTime* pMaxRange) const;
00196
00197     // Retrieves the current minimum and maximum allowable system times for a date
00198     // and time picker control. Returns a DWORD value containing flags that indicate
00199     // which ranges are set.
00200     //
00201     DWORD GetRange(
00202         // A pointer to a CTime object containing the
00203         // earliest time allowed in the CDateTimeCtrl object.
00204         CTime* pMinRange,
00205         // A pointer to a CTime object containing the
00206         // latest time allowed in the CDateTimeCtrl object.
00207         CTime* pMaxRange) const;
00208
00209 // Operations
00210 public:
00211
00212     // Sets the time in a date and time picker control. Returns nonzero if successful;
00213     // otherwise 0.
00214     //
00215     BOOL SetTime(
00216         // A pointer to a CTime object containing the time to which the control will be set.
00217         const CTime* pTimeNew);
00218
00219     // Sets the time in a date and time picker control. Returns nonzero if successful;
00220     // otherwise 0.
00221     //
00222     BOOL SetTime(
00223         // A reference to a COleDateTime object containing the to which the control
00224         // will be set.
00225         const COleDateTime& timeNew);
00226
00227     // Sets the time in a date and time picker control. Returns nonzero if successful;
00228     // otherwise 0.
00229     //
00230     BOOL SetTime(
00231         // A pointer to a SYSTEMTIME structure containing the time to which the control
00232         // will be set.
00233         LPSYSTEMTIME pTimeNew = NULL);
00234
00235     // Retrieves the currently selected time from a date and time picker control and
00236     // places it in a specified SYSTEMTIME structure. Returns a DWORD value equal to
00237     // the dwFlag member set in theNMDATETIMECHANGE structure
00238     //
00239     DWORD GetTime(
00240         // a reference to a CTime object that will receive the system time information
00241         CTime& timeDest) const;
00242
00243     // Retrieves the currently selected time from a date and time picker control and
00244     // places it in a specified SYSTEMTIME structure. Returns nonzero if the time is
00245     // successfully written to the COleDateTime object; otherwise 0.
00246     //
00247     BOOL GetTime(
00248         // a reference to a COleDateTime object that will receive the system
00249         // time information
00250         COleDateTime& timeDest) const;
00251
00252     // Retrieves the currently selected time from a date and time picker control and
00253     // places it in a specified SYSTEMTIME structure. Returns a DWORD value equal to
00254     // the dwFlag member set in theNMDATETIMECHANGE structure
00255     //
00256     DWORD GetTime(
00257         // A pointer to theSYSTEMTIME structure to receive the system time information.
00258         // Must not be NULL.
00259         LPSYSTEMTIME pTimeDest) const;
00260 };
00261
00262 // A CCJMonthCalCtrl object encapsulates the functionality of a month calendar control.
00263 // The month calendar control provides the user with a simple calendar interface, from
00264 // which the user can select a date.
00265 class _CJX_EXT_CLASS CCJMonthCalCtrl : public CWnd
00266 {
00267   DECLARE_DYNAMIC(CCJMonthCalCtrl)
00268
00269
00270 // Construction / destruction
00271 public:
00272
00273     // Constructs a CCJMonthCalCtrl object.
00274     //
00275     CCJMonthCalCtrl();
00276
00277     // Destroys a CCJMonthCalCtrl object.
00278     //
00279     virtual ~CCJMonthCalCtrl();
00280
00281 // Initialization
00282 public:
00283
00284     // Creates a month calendar control and attaches it to the CMonthCalCtrl object.
00285     // Returns nonzero if initialization was successful; otherwise 0.
00286     //
00287     BOOL Create(
00288         // Specifies the combination of Windows styles applied to the month
00289         // calendar control. SeeMonth Calendar Control Styles in the Platform
00290         // SDK for more information about the styles.
00291         DWORD dwStyle,
00292         // A reference to aRECT structure. Contains the position and size of
00293         // the month calendar control
00294         const RECT& rect,
00295         // A pointer to a CWnd object that is the parent window of the month
00296         // calendar control. It must not be NULL.
00297         CWnd* pParentWnd,
00298         // Specifies the month calendar control’s control ID.
00299         UINT nID);
00300
00301     // Creates a month calendar control and attaches it to the CMonthCalCtrl object.
00302     // Returns nonzero if initialization was successful; otherwise 0.
00303     //
00304     BOOL Create(
00305         // Specifies the combination of Windows styles applied to the month
00306         // calendar control. SeeMonth Calendar Control Styles in the Platform
00307         // SDK for more information about the styles.
00308         DWORD dwStyle,
00309         // A reference to aPOINT structure that identifies the location of
00310         // the month calendar control
00311         const POINT& pt,
00312         // A pointer to a CWnd object that is the parent window of the month
00313         // calendar control. It must not be NULL.
00314         CWnd* pParentWnd,
00315         // Specifies the month calendar control’s control ID.
00316         UINT nID);
00317
00318 //Attributes
00319 public:
00320
00321     // Retrieves the minimum size required to show a full month in a month calendar
00322     // control. Returns nonzero and lpRect receives the applicable bounding information.
00323     // If unsuccessful, the member function returns 0.
00324     //
00325     BOOL GetMinReqRect(
00326         // A pointer to aRECT structure that will receive bounding rectangle information.
00327         // This parameter must be a valid address and cannot be NULL.
00328         RECT* pRect) const;
00329
00330     // Sets the scroll rate for a month calendar control. Returns the previous scroll
00331     // rate. If the scroll rate has not been previously set, the return value is 0.
00332     //
00333     int SetMonthDelta(
00334         // The number of months to be set as the control's scroll rate. If this value
00335         // is zero, the month delta is reset to the default, which is the number of
00336         // months displayed in the control.
00337         int iDelta);
00338
00339     // Retrieves the scroll rate for a month calendar control. Returns The scroll rate
00340     // for the month calendar control. The scroll rate is the number of months that the
00341     // control moves its display when the user clicks a scroll button once.
00342     //
00343     int GetMonthDelta() const;
00344
00345     // Sets the day of week to be displayed in the leftmost column of the calendar.
00346     // Returns nonzero if the previous first day of the week is set to a value other
00347     // than that of LOCALE_IFIRSTDAYOFWEEK, which is the day indicated in the control
00348     // panel setting. Otherwise, this function returns 0.
00349     BOOL SetFirstDayOfWeek(
00350         // An integer value representing which day is to be set as the first day of
00351         // the week. This value must be one of the day numbers. See GetFirstDayOfWeek
00352         // for a description of the day numbers.
00353         int iDay,
00354         // A pointer to an integer indicating the first day of the week previously set.
00355         int* lpnOld = NULL);
00356
00357     // Gets the first day of the week to be displayed in the leftmost column of the
00358     // calendar. Returns an integer value that represents the first day of the week.
00359     // The days of the week are represented as integers, as follows.
00360     //
00361     // Value    Day of the Week
00362     // 0        Monday
00363     // 1        Tuesday
00364     // 2        Wednesday
00365     // 3        Thursday
00366     // 4        Friday
00367     // 5        Saturday
00368     // 6        Sunday
00369     //
00370     int GetFirstDayOfWeek(
00371         // A pointer to a BOOL value. If the value is non-zero, the control's setting
00372         // does not match the setting in the control panel.
00373         BOOL* pbLocal = NULL) const;
00374
00375     // Gets the color of a specified area of a month calendar control. Returns a COLORREF
00376     // value specifying the color associated with the portion of the month calendar
00377     // control, if successful. Otherwise, this member function returns -1.
00378     //
00379     COLORREF GetColor(
00380         // The region of the month calendar control from which the color is retrieved.
00381         // For a list of values, see the nRegion parameter of  SetColor.
00382         int nRegion) const;
00383
00384     // Sets the color of a specified area of a month calendar control. Returns a COLORREF
00385     // value that represents the previous color setting for the specified portion of the
00386     // month calendar control, if successful. Otherwise this message returns -1.
00387     //
00388     COLORREF SetColor(
00389         // An integer value specifying which month calendar color to set. This value can be one of the following.
00390         //
00391         // Value                Meaning
00392         // MCSC_BACKGROUND      The background color displayed between months.
00393         // MCSC_MONTHBK         The background color displayed within the month.
00394         // MCSC_TEXT            The color used to display text within a month.
00395         // MCSC_TITLEBK         The background color displayed in the calendar's title.
00396         // MCSC_TITLETEXT       The color used to display text within the calendar's title.
00397         // MCSC_TRAILINGTEXT    The color used to display header and trailing-day text. Header and trailing days are the days from the previous and following months that appear on the current calendar.
00398         //
00399         int nRegion,
00400         // A COLORREF value for the new color setting for the specified portion of the
00401         // month calendar control
00402         COLORREF ref);
00403
00404 // Operations
00405 public:
00406
00407     // Repaints the month calendar control to its minimum, one-month size. Returns
00408     // nonzero if the month calendar control is sized to its minimum; otherwise 0.
00409     //
00410     BOOL SizeMinReq(
00411         // Specifies whether the control is to be repainted. By default, TRUE.
00412         // If FALSE, no repainting occurs.
00413         BOOL bRepaint = TRUE);
00414
00415     // Sets the calendar control for the current day.
00416     //
00417     void SetToday(
00418         // A reference to a COleDateTime object that contains the current date.
00419         const COleDateTime& refDateTime);
00420
00421     // Sets the calendar control for the current day.
00422     //
00423     void SetToday(
00424         // A pointer to a CTime object containing the current date information.
00425         const CTime* pDateTime);
00426
00427     // Sets the calendar control for the current day.
00428     //
00429     void SetToday(
00430         // A pointer to aSYSTEMTIME structure that contains the current date information.
00431         const LPSYSTEMTIME pDateTime);
00432
00433     // Retrieves the date information for the date specified as "today" for a month
00434     // calendar control. Returns nonzero if successful; otherwise 0.
00435     //
00436     BOOL GetToday(
00437         // A reference to a CTime object indicating the current day.
00438         CTime& refTime) const;
00439
00440     // Retrieves the date information for the date specified as "today" for a month
00441     // calendar control. Returns nonzero if successful; otherwise 0.
00442     //
00443     BOOL GetToday(
00444         // A reference to a COleDateTime object indicating the current day.
00445         COleDateTime& refDateTime) const;
00446
00447     // Retrieves the date information for the date specified as "today" for a month
00448     // calendar control. Returns nonzero if successful; otherwise 0.
00449     //
00450     BOOL GetToday(
00451         // A pointer to aSYSTEMTIME structure that will receive the date information.
00452         // This parameter must be a valid address and cannot be NULL.
00453         LPSYSTEMTIME pDateTime) const;
00454
00455     // Retrieves the system time as indicated by the currently-selected date. Returns
00456     // nonzero if successful; otherwize 0.
00457     //
00458     BOOL GetCurSel(
00459         // A pointer to aSYSTEMTIME structure that will receive the currently-selected
00460         // date information. This parameter must be a valid address and cannot be NULL.
00461         LPSYSTEMTIME pDateTime) const;
00462
00463     // Retrieves the system time as indicated by the currently-selected date. Returns
00464     // nonzero if successful; otherwize 0.
00465     //
00466     BOOL GetCurSel(
00467         // A reference to a CTime object. Receives the current time.
00468         CTime& refDateTime) const;
00469
00470     // Retrieves the system time as indicated by the currently-selected date. Returns
00471     // nonzero if successful; otherwize 0.
00472     //
00473     BOOL GetCurSel(
00474         // A reference to a COleDateTime object. Receives the current time.
00475         COleDateTime& refDateTime) const;
00476
00477     // Sets the currently-selected date for a month calendar control. Returns
00478     // nonzero if successful; otherwise 0.
00479     //
00480     BOOL SetCurSel(
00481         // Pointer to aSYSTEMTIME structure that contains the date to be set
00482         // as the current selection.
00483         const LPSYSTEMTIME pDateTime);
00484
00485     // Sets the currently-selected date for a month calendar control. Returns
00486     // nonzero if successful; otherwise 0.
00487     //
00488     BOOL SetCurSel(
00489         // A reference to a CTime object indicating the currently-selected
00490         // month calendar control.
00491         const CTime& refDateTime);
00492
00493     // Sets the currently-selected date for a month calendar control. Returns
00494     // nonzero if successful; otherwise 0.
00495     //
00496     BOOL SetCurSel(
00497         // A reference to a COleDateTime indicating the currently-selected month
00498         // calendar control.
00499         const COleDateTime& refDateTime);
00500
00501     // Sets the display for days in a month calendar control. Returns nonzero
00502     // if successful; otherwise 0.
00503     //
00504     BOOL SetDayState(
00505         // Value indicating how many elements are in the array that pStates
00506         // points to.
00507         int nMonths,
00508         // A pointer to aMONTHDAYSTATE array of values that define how the month
00509         // calendar control will draw each day in its display. The MONTHDAYSTATE
00510         // data type is a bit field, where each bit (1 through 31) represents the
00511         // state of a day in a month. If a bit is on, the corresponding day will be
00512         // displayed in bold; otherwise it will be displayed with no emphasis.
00513         LPMONTHDAYSTATE pStates);
00514
00515     // Sets the maximum number of days that can be selected in a month
00516     // calendar control. Returns nonzero if successful; otherwise 0.
00517     //
00518     BOOL SetMaxSelCount(
00519         //
00520         int nMax);
00521
00522     // Retrieves the current maximum number of days that can be selected
00523     // in a month calendar control. Returns an integer value that represents
00524     // the total number of days that can be selected for the control.
00525     //
00526     int GetMaxSelCount() const;
00527
00528     // Sets the minimum and maximum allowable dates for a month calendar control.
00529     // Returns nonzero if successful; otherwise 0.
00530     //
00531     BOOL SetRange(
00532         // A pointer to a COleDateTime object containing the date at the lowest
00533         // end of the range.
00534         const COleDateTime* pMinRange,
00535         // A pointer to a COleDateTime object containing the date at the highest
00536         // end of the range.
00537         const COleDateTime* pMaxRange);
00538
00539     // Sets the minimum and maximum allowable dates for a month calendar control.
00540     // Returns nonzero if successful; otherwise 0.
00541     //
00542     BOOL SetRange(
00543         // A pointer to a CTime object containing the date at the lowest
00544         // end of the range.
00545         const CTime* pMinRange,
00546         // A pointer to a CTime object containing the date at the highest
00547         // end of the range.
00548         const CTime* pMaxRange);
00549
00550     // Sets the minimum and maximum allowable dates for a month calendar control.
00551     // Returns nonzero if successful; otherwise 0.
00552     //
00553     BOOL SetRange(
00554         // A pointer to a SYSTEMTIME structure containing the date at the lowest
00555         // end of the range.
00556         const LPSYSTEMTIME pMinRange,
00557         // A pointer to a SYSTEMTIME structure containing the date at the highest
00558         // end of the range.
00559         const LPSYSTEMTIME pMaxRange);
00560
00561     // Retrieves the current minimum and maximum dates set in a month calendar control.
00562     // Returns A DWORD that can be zero (no limits are set) or a combination of the
00563     // following values that specify limit information.
00564     //
00565     // Value        Meaning
00566     // GDTR_MAX     A maximum limit is set for the control;
00567     //              pMaxRange is valid and contains the applicable date information.
00568     // GDTR_MIN     A minimum limit is set for the control;
00569     //              pMinRange is valid and contains the applicable date information.
00570     //
00571     DWORD GetRange(
00572         // A pointer to a COleDateTime object containing the date at the lowest end
00573         // of the range.
00574         COleDateTime* pMinRange,
00575         // A pointer to a COleDateTime object containing the date at the highest end
00576         // of the range.
00577         COleDateTime* pMaxRange) const;
00578
00579     // Retrieves the current minimum and maximum dates set in a month calendar control.
00580     // Returns A DWORD that can be zero (no limits are set) or a combination of the
00581     // following values that specify limit information.
00582     //
00583     // Value        Meaning
00584     // GDTR_MAX     A maximum limit is set for the control;
00585     //              pMaxRange is valid and contains the applicable date information.
00586     // GDTR_MIN     A minimum limit is set for the control;
00587     //              pMinRange is valid and contains the applicable date information.
00588     //
00589     DWORD GetRange(
00590         // A pointer to a CTime object containing the date at the lowest end of the range.
00591         CTime* pMinRange,
00592         // A pointer to a CTime object containing the date at the highest end of the range.
00593         CTime* pMaxRange) const;
00594
00595     // Retrieves the current minimum and maximum dates set in a month calendar control.
00596     // Returns A DWORD that can be zero (no limits are set) or a combination of the
00597     // following values that specify limit information.
00598     //
00599     // Value        Meaning
00600     // GDTR_MAX     A maximum limit is set for the control;
00601     //              pMaxRange is valid and contains the applicable date information.
00602     // GDTR_MIN     A minimum limit is set for the control;
00603     //              pMinRange is valid and contains the applicable date information.
00604     //
00605     DWORD GetRange(
00606         // A pointer to a SYSTEMTIME structure containing the date at the
00607         // lowest end of the range.
00608         LPSYSTEMTIME pMinRange,
00609         // A pointer to a COleDateTime object, a CTime object, orSYSTEMTIME structure
00610         // containing the date at the highest end of the range.
00611         LPSYSTEMTIME pMaxRange) const;
00612
00613     // Retrieves date information representing the high and low limits of a month
00614     // calendar control's display. Returns An integer that represents the range,
00615     // in months, spanned by the two limits indicated by refMinRange and
00616     // refMaxRange.
00617     //
00618     int GetMonthRange(
00619         // A reference to a COleDateTime object containing the minimum date allowed.
00620         COleDateTime& refMinRange,
00621         // A reference to a COleDateTime object containing the maximum date allowed.
00622         COleDateTime& refMaxRange,
00623         // Value specifying the scope of the range limits to be retrieved. This value must be one of the following.
00624         //
00625         // Value            Meaning
00626         // GMR_DAYSTATE     Include preceding and trailing months of visible range that are only partially displayed.
00627         // GMR_VISIBLE      Include only those months that are entirely displayed.
00628         DWORD dwFlags) const;
00629
00630     // Retrieves date information representing the high and low limits of a month
00631     // calendar control's display. Returns An integer that represents the range,
00632     // in months, spanned by the two limits indicated by refMinRange and
00633     // refMaxRange.
00634     //
00635     int GetMonthRange(
00636         // A reference to a CTime object containing the minimum date allowed.
00637         CTime& refMinRange,
00638         // A reference to a CTime object containing the maximum date allowed.
00639         CTime& refMaxRange,
00640         // Value specifying the scope of the range limits to be retrieved. This value must be one of the following.
00641         //
00642         // Value            Meaning
00643         // GMR_DAYSTATE     Include preceding and trailing months of visible range that are only partially displayed.
00644         // GMR_VISIBLE      Include only those months that are entirely displayed.
00645         DWORD dwFlags) const;
00646
00647     // Retrieves date information representing the high and low limits of a month
00648     // calendar control's display. Returns An integer that represents the range,
00649     // in months, spanned by the two limits indicated by pMinRange and pMaxRange.
00650     //
00651     int GetMonthRange(
00652         // A pointer to aSYSTEMTIME structure containing the date at the lowest
00653         // end of the range.
00654         LPSYSTEMTIME pMinRange,
00655         // A pointer to a SYSTEMTIME structure containing the date at the highest
00656         // end of the range.
00657         LPSYSTEMTIME pMaxRange,
00658         // Value specifying the scope of the range limits to be retrieved. This value must be one of the following.
00659         //
00660         // Value            Meaning
00661         // GMR_DAYSTATE     Include preceding and trailing months of visible range that are only partially displayed.
00662         // GMR_VISIBLE      Include only those months that are entirely displayed.
00663         DWORD dwFlags) const;
00664
00665     // Sets the selection for a month calendar control to a given date range.
00666     // Returns nonzero if successful; otherwise 0.
00667     //
00668     BOOL SetSelRange(
00669         // A pointer to a COleDateTime object containing the date at the lowest
00670         // end of the range.
00671         const COleDateTime& pMinRange,
00672         // A pointer to a COleDateTime object containing the date at the highest
00673         // end of the range.
00674         const COleDateTime& pMaxRange);
00675
00676     // Sets the selection for a month calendar control to a given date range.
00677     // Returns nonzero if successful; otherwise 0.
00678     //
00679     BOOL SetSelRange(
00680         // A pointer to a CTime object containing the date at the lowest
00681         // end of the range.
00682         const CTime& pMinRange,
00683         // A pointer to a CTime object containing the date at the highest
00684         // end of the range.
00685         const CTime& pMaxRange);
00686
00687     // Sets the selection for a month calendar control to a given date range.
00688     // Returns nonzero if successful; otherwise 0.
00689     //
00690     BOOL SetSelRange(
00691         // A pointer to a SYSTEMTIME structure containing the date at the lowest
00692         // end of the range.
00693         const LPSYSTEMTIME pMinRange,
00694         // A pointer to a SYSTEMTIME structure containing the date at the highest
00695         // end of the range.
00696         const LPSYSTEMTIME pMaxRange);
00697
00698     // Retrieves date information representing the upper and lower limits of
00699     // the date range currently selected by the user. Returns nonzero if successful;
00700     // otherwise 0.
00701     //
00702     BOOL GetSelRange(
00703         // A reference to a COleDateTime object containing the minimum date allowed.
00704         COleDateTime& refMinRange,
00705         // A reference to a COleDateTime object containing the maximum date allowed.
00706         COleDateTime& refMaxRange) const;
00707
00708     // Retrieves date information representing the upper and lower limits of
00709     // the date range currently selected by the user. Returns nonzero if successful;
00710     // otherwise 0.
00711     //
00712     BOOL GetSelRange(
00713         // A reference to a CTime object containing the minimum date allowed.
00714         CTime& refMinRange,
00715         // A reference to a CTime object containing the maximum date allowed.
00716         CTime& refMaxRange) const;
00717
00718     // Retrieves date information representing the upper and lower limits of
00719     // the date range currently selected by the user. Returns nonzero if successful;
00720     // otherwise 0.
00721     //
00722     BOOL GetSelRange(
00723         // A pointer to aSYSTEMTIME structure containing the date at the lowest
00724         // end of the range.
00725         LPSYSTEMTIME pMinRange,
00726         // A pointer to a SYSTEMTIME structure containing the date at the highest
00727         // end of the range.
00728         LPSYSTEMTIME pMaxRange) const;
00729
00730     // Determines which portion of a month calendar control is at a given point on
00731     // the screen. Returns A DWORD value. Equal to the uHit member of the MCHITTESTINFO
00732     // structure.
00733     //
00734     DWORD HitTest(
00735         // A pointer to aMCHITTESTINFO structure containing hit testing points for the
00736         // month calendar control.
00737         PMCHITTESTINFO pMCHitTest);
00738 };
00739
00741 // Standard Dialog Data Exchange routines
00743
00744 void AFXAPI DDX_CJDateTimeCtrl(CDataExchange* pDX, int nIDC, COleDateTime& value);
00745 void AFXAPI DDX_CJDateTimeCtrl(CDataExchange* pDX, int nIDC, CTime& value);
00746 void AFXAPI DDX_CJMonthCalCtrl(CDataExchange* pDX, int nIDC, COleDateTime& value);
00747 void AFXAPI DDX_CJMonthCalCtrl(CDataExchange* pDX, int nIDC, CTime& value);
00748
00750 // Standard Dialog Data Validation routines
00752
00753 void AFXAPI DDV_CJMinMaxDateTime(CDataExchange* pDX, CTime& refValue, const CTime* pMinRange, const CTime* pMaxRange);
00754 void AFXAPI DDV_CJMinMaxDateTime(CDataExchange* pDX,  COleDateTime& refValue, const COleDateTime* pMinRange, const COleDateTime* pMaxRange);
00755 void AFXAPI DDV_CJMinMaxMonth(CDataExchange* pDX, CTime& refValue, const CTime* pMinRange, const CTime* pMaxRange);
00756 void AFXAPI DDV_CJMinMaxMonth(CDataExchange* pDX, COleDateTime& refValue, const COleDateTime* pMinRange, const COleDateTime* pMaxRange);
00757
00759 //  Inline Functions
00761
00762 //CJDateTimeCtrl
00763 _CJXLIB_INLINE CCJDateTimeCtrl::CCJDateTimeCtrl()
00764     { }
00765 _CJXLIB_INLINE CFont* CCJDateTimeCtrl::GetMonthCalFont() const
00766     { ASSERT(::IsWindow(m_hWnd)); return CFont::FromHandle((HFONT) ::SendMessage(m_hWnd, DTM_GETMCFONT, 0, 0)); }
00767 _CJXLIB_INLINE CCJMonthCalCtrl* CCJDateTimeCtrl::GetMonthCalCtrl() const
00768     { ASSERT(::IsWindow(m_hWnd)); return (CCJMonthCalCtrl*) CWnd::FromHandle((HWND) ::SendMessage(m_hWnd, DTM_GETMONTHCAL, 0, 0)); }
00769 _CJXLIB_INLINE void CCJDateTimeCtrl::SetMonthCalFont(HFONT hFont, BOOL bRedraw /* = TRUE */)
00770     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, DTM_SETMCFONT, (WPARAM) hFont, MAKELONG(bRedraw, 0)); }
00771 _CJXLIB_INLINE COLORREF CCJDateTimeCtrl::SetMonthCalColor(int iColor, COLORREF ref)
00772     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, DTM_SETMCCOLOR, (WPARAM) iColor, (LPARAM) ref); }
00773 _CJXLIB_INLINE DWORD CCJDateTimeCtrl::GetTime(LPSYSTEMTIME pTimeDest) const
00774     { ASSERT(::IsWindow(m_hWnd)); ASSERT(pTimeDest != NULL); return (DWORD) ::SendMessage(m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM) pTimeDest); }
00775 _CJXLIB_INLINE COLORREF CCJDateTimeCtrl::GetMonthCalColor(int iColor) const
00776     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, DTM_GETMCCOLOR, (WPARAM) iColor, 0); }
00777 _CJXLIB_INLINE BOOL CCJDateTimeCtrl::SetFormat(LPCTSTR pstrFormat)
00778     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, DTM_SETFORMAT, 0, (LPARAM) pstrFormat); }
00779
00780 //CCJMonthCalCtrl
00781 _CJXLIB_INLINE CCJMonthCalCtrl::CCJMonthCalCtrl()
00782     { }
00783 _CJXLIB_INLINE DWORD CCJMonthCalCtrl::HitTest(PMCHITTESTINFO pMCHitTest)
00784     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, MCM_HITTEST, 0, (LPARAM) pMCHitTest); }
00785 _CJXLIB_INLINE BOOL CCJMonthCalCtrl::GetMinReqRect(RECT* pRect) const
00786     { ASSERT(m_hWnd != NULL); return (BOOL) ::SendMessage(m_hWnd, MCM_GETMINREQRECT, 0, (LPARAM) pRect); }
00787 _CJXLIB_INLINE int CCJMonthCalCtrl::SetMonthDelta(int iDelta)
00788     { ASSERT(m_hWnd != NULL); return (int) ::SendMessage(m_hWnd, MCM_SETMONTHDELTA, (WPARAM) iDelta, 0); }
00789 _CJXLIB_INLINE int CCJMonthCalCtrl::GetMonthDelta() const
00790     { ASSERT(m_hWnd != NULL); return (int) ::SendMessage(m_hWnd, MCM_GETMONTHDELTA, 0, 0); }
00791 _CJXLIB_INLINE COLORREF CCJMonthCalCtrl::GetColor(int nRegion) const
00792     { ASSERT(m_hWnd != NULL); return (COLORREF) ::SendMessage(m_hWnd, MCM_GETCOLOR, (WPARAM) nRegion, 0); }
00793 _CJXLIB_INLINE COLORREF CCJMonthCalCtrl::SetColor(int nRegion, COLORREF ref)
00794     { ASSERT(m_hWnd != NULL); return (COLORREF) ::SendMessage(m_hWnd, MCM_SETCOLOR, (WPARAM) nRegion, (LPARAM) ref); }
00795 _CJXLIB_INLINE BOOL CCJMonthCalCtrl::SetMaxSelCount(int nMax)
00796     { ASSERT(m_hWnd != NULL); return (BOOL) ::SendMessage(m_hWnd, MCM_SETMAXSELCOUNT, nMax, 0); }
00797 _CJXLIB_INLINE int CCJMonthCalCtrl::GetMaxSelCount() const
00798     { ASSERT(m_hWnd != NULL); return (int) ::SendMessage(m_hWnd, MCM_GETMAXSELCOUNT, 0, 0); }
00799 _CJXLIB_INLINE void CCJMonthCalCtrl::SetToday(const LPSYSTEMTIME pDateTime)
00800     { ASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, MCM_SETTODAY, 0, (LPARAM) pDateTime); }
00801 _CJXLIB_INLINE BOOL CCJMonthCalCtrl::GetToday(LPSYSTEMTIME pDateTime) const
00802     { ASSERT(m_hWnd != NULL); return (BOOL) ::SendMessage(m_hWnd, MCM_GETTODAY, 0, (LPARAM) pDateTime); }
00803 _CJXLIB_INLINE BOOL CCJMonthCalCtrl::SetCurSel(const LPSYSTEMTIME pDateTime)
00804     { ASSERT(m_hWnd != NULL); return (BOOL) ::SendMessage(m_hWnd, MCM_SETCURSEL, 0, (LPARAM) pDateTime); }
00805 _CJXLIB_INLINE BOOL CCJMonthCalCtrl::GetCurSel(LPSYSTEMTIME pDateTime) const
00806     { ASSERT(m_hWnd != NULL); return (BOOL) ::SendMessage(m_hWnd, MCM_GETCURSEL, 0, (LPARAM) pDateTime); }
00807
00808 #endif //__CJDATETIMECTRL_H__
00809
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJDockBar.h Source File

WinCvs/CJLib/Include/CJDockBar.h

Go to the documentation of this file.
00001 // CJDockBar.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJockey/Include/CJDockBar.h $
00011  *
00012  * $History: CJDockBar.h $
00013  *
00014  * *****************  Version 5  *****************
00015  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00016  * Updated in $/CodeJockey/Include
00017  * Updated copyright and contact information.
00018  *
00019  * *****************  Version 4  *****************
00020  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00021  * Updated in $/CodeJockey/Include
00022  *
00023  * *****************  Version 3  *****************
00024  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00025  * Updated in $/CodeJockey/Include
00026  * Cleaned up inline functions, and import/export macro so that class will
00027  * be imported when linked to, and exported at compile time.
00028  *
00029  * *****************  Version 2  *****************
00030  * User: Kirk Stowell Date: 4/03/99    Time: 12:53p
00031  * Updated in $/CodeJockey/Include
00032  * Added comments and cleaned up code.
00033  *
00034  * *****************  Version 1  *****************
00035  * User: Kirk Stowell Date: 10/17/98   Time: 12:53p
00036  * Created in $/CodeJockey/CJ60Lib
00037  * Initial re-write and release.
00038  *
00039  ***************************************************************************/
00041
00042 #ifndef __CJDOCKBAR_H__
00043 #define __CJDOCKBAR_H__
00044
00045 #if _MSC_VER >= 1000
00046 #pragma once
00047 #endif // _MSC_VER >= 1000
00048
00049 // CCJDockBar is a CDockBar derived class used by CCJFrameWnd and CCJMDIFrameWnd
00050 // to offset CCJToolBars to allow 3D borders.
00051 class _CJX_EXT_CLASS CCJDockBar : public CDockBar
00052 {
00053     DECLARE_DYNAMIC(CCJDockBar)
00054
00055 public:
00056
00057     // Default constructor
00058     //
00059     CCJDockBar();
00060
00061     // Virtual destructor
00062     //
00063     virtual ~CCJDockBar();
00064
00065 // Overrides
00066     // ClassWizard generated virtual function overrides
00067     //{{AFX_VIRTUAL(CCJDockBar)
00068     public:
00069     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
00070     //}}AFX_VIRTUAL
00071
00072 // Generated message map functions
00073 protected:
00074     //{{AFX_MSG(CCJDockBar)
00075         // NOTE - the ClassWizard will add and remove member functions here.
00076         //    DO NOT EDIT what you see in these blocks of generated code !
00077     //}}AFX_MSG
00078     DECLARE_MESSAGE_MAP()
00079 };
00080
00082
00083 //{{AFX_INSERT_LOCATION}}
00084 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00085
00086 #endif // __CJDOCKBAR_H__
00087
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJDockContext.h Source File

WinCvs/CJLib/Include/CJDockContext.h

Go to the documentation of this file.
00001 // CJDockContext.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJockey/Include/CJDockContext.h $
00011  *
00012  * $History: CJDockContext.h $
00013  *
00014  * *****************  Version 9  *****************
00015  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00016  * Updated in $/CodeJockey/Include
00017  * Updated copyright and contact information.
00018  *
00019  * *****************  Version 8  *****************
00020  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00021  * Updated in $/CodeJockey/Include
00022  *
00023  * *****************  Version 7  *****************
00024  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00025  * Updated in $/CodeJockey/Include
00026  * Cleaned up inline functions, and import/export macro so that class will
00027  * be imported when linked to, and exported at compile time.
00028  *
00029  * *****************  Version 6  *****************
00030  * User: Kirk Stowell Date: 6/09/99    Time: 8:33p
00031  * Updated in $/CodeJockey/Include
00032  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00033  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00034  * message handler, this is now automatically handled by the base class.
00035  * Added redraw flags to the create method and modified paint and layout
00036  * handlers to reduce flicker and un-necessary command handling. Dragging
00037  * rect now reflects actual control bar docked size. Added "flat" look to
00038  * the control bars, the control bars can now use the classic DevStudio
00039  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00040  * docking windows now handle dragging, docking and floating much better,
00041  * and behave more like DevStudio.
00042  *
00043  * *****************  Version 5  *****************
00044  * User: Kirk Stowell Date: 4/14/99    Time: 12:57p
00045  * Updated in $/CodeJockey/Include
00046  * Daniel Harth [danielh@mail.matco.ro] - Added support for diagonal
00047  * sizing.
00048  *
00049  * *****************  Version 4  *****************
00050  * User: Kirk Stowell Date: 4/03/99    Time: 12:56p
00051  * Updated in $/CodeJockey/Include
00052  * Added comments and cleaned up code.
00053  *
00054  * *****************  Version 3  *****************
00055  * User: Kirk Stowell Date: 3/10/99    Time: 12:56p
00056  * Updated in $/CodeJockey/Include
00057  * Added support for toggle docking.
00058  *
00059  * *****************  Version 2  *****************
00060  * User: Kirk Stowell Date: 3/03/99    Time: 12:54p
00061  * Updated in $/CodeJockey/Include
00062  * Scott Killen [s_killen@yahoo.com] - If your frame is not your main
00063  * window in your app, you cannot dock a floating CCJControlBar. Changed
00064  * (CFrameWnd*)AfxGetApp()->m_pMainWnd to (CFrameWnd*)m_pDockSite in
00065  * CanDockDockBar() and DockSizeBar()
00066  *
00067  * *****************  Version 1  *****************
00068  * User: Kirk Stowell Date: 1/12/99    Time: 12:53p
00069  * Created in $/CodeJockey/Include
00070  * Initial creation to add side-by-side docking support for CCJControlBar
00071  * class.
00072  *
00073  ***************************************************************************/
00075
00076 #ifndef __CJDOCKCONTEXT_H__
00077 #define __CJDOCKCONTEXT_H__
00078
00079 #if _MSC_VER >= 1000
00080 #pragma once
00081 #endif // _MSC_VER >= 1000
00082
00083 // class forwards
00084 class CCJSizeDockBar;
00085 class CCJControlBar;
00086
00087 // CCJDockContext is a CDockContext derived class which is used by
00088 // CCJControlBar and CCJMiniDockFrameWnd for docking / sizing control bars.
00089 class _CJX_EXT_CLASS CCJDockContext : public CDockContext
00090 {
00091 public:
00092
00093     // Default constructor
00094     //
00095     CCJDockContext(CControlBar* pBar);
00096
00097     // Virtual destructor
00098     //
00099     virtual ~CCJDockContext();
00100
00101 public:
00102
00103     CPoint      m_ptOrig; // Yiannhs: trying to handle some extra use
00104
00105 public:
00106
00107     // this member function is called by CCJDockContext when a drag
00108     // operation completes.
00109     //
00110     void EndDragDockBar();
00111
00112     // this member function is called by CCJDockContext during a
00113     // drag process.
00114     //
00115     void MoveDockBar(CPoint pt);
00116
00117     // this member function is called by CCJControlBar and CCJMiniDockFrameWnd
00118     // whenever a drag operation begins.
00119     //
00120     void StartDragDockBar(CPoint pt);
00121
00122     // this member function is called by CCJDockContext to determine
00123     // wether a control bar is dockable.
00124     //
00125     DWORD CanDockDockBar();
00126
00127     // this member function is called by CCJDockContext to determine
00128     // wether a control bar is dockable.
00129     //
00130     DWORD CanDockDockBar(CRect rect, DWORD dwDockStyle, CDockBar** ppDockBar = NULL);
00131
00132     // this member function is called by CCJDockContext
00133     // whenever a drag operation begins.
00134     //
00135     BOOL TrackDockBar();
00136
00137     // this member function is called by CCJDockContext
00138     // and returns a CCJSizeDock bar pointer.
00139     //
00140     CCJSizeDockBar* GetDockBar(DWORD dwOverDockStyle);
00141
00142     // this member function is used by the framework to dock a
00143     // control bar.
00144     //
00145     void DockSizeBar(CControlBar *,CCJSizeDockBar* =NULL,LPRECT =NULL);
00146
00147     // this member function is used to toggle the docked state of
00148     // a control bar.
00149     //
00150     virtual void ToggleDocking();
00151
00152     // this member function is called to enable diagonal sizing
00153     // for the control bar.
00154     //
00155     void Stretch(CPoint pt);
00156     virtual void StartResize(int nHitTest, CPoint pt);
00157 };
00158
00160
00161 #endif // __CJDOCKCONTEXT_H__
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJExplorerBar.h Source File

WinCvs/CJLib/Include/CJExplorerBar.h

Go to the documentation of this file.
00001 // CJExplorerBar.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:49 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJExplorerBar.h $
00011  *
00012  * $History: CJExplorerBar.h $
00013  *
00014  * *****************  Version 8  *****************
00015  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00016  * Updated in $/CodeJock/Include
00017  * Fixed potential resource and memory leak problems.
00018  *
00019  * *****************  Version 7  *****************
00020  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00021  * Updated in $/CodeJockey/Include
00022  * Updated copyright and contact information.
00023  *
00024  * *****************  Version 6  *****************
00025  * User: Kirk Stowell Date: 6/23/99    Time: 7:23a
00026  * Updated in $/CodeJockey/Include
00027  *
00028  * *****************  Version 5  *****************
00029  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00030  * Updated in $/CodeJockey/Include
00031  *
00032  * *****************  Version 4  *****************
00033  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00034  * Updated in $/CodeJockey/Include
00035  * Cleaned up inline functions, and import/export macro so that class will
00036  * be imported when linked to, and exported at compile time.
00037  *
00038  * *****************  Version 3  *****************
00039  * User: Kirk Stowell Date: 4/03/99    Time: 4:23p
00040  * Updated in $/CodeJockey/Include
00041  * Added comments and cleaned up code.
00042  *
00043  * *****************  Version 2  *****************
00044  * User: Kirk Stowell Date: 1/31/99    Time: 4:23p
00045  * Updated in $/CodeJockey/Include
00046  * Made some cosmetic enhancements to more closely match the windows
00047  * explorer bar.
00048  *
00049  * *****************  Version 1  *****************
00050  * User: Kirk Stowell Date: 1/16/99    Time: 4:22p
00051  * Created in $/CodeJockey/Include
00052  * Initial release
00053  *
00054  ***************************************************************************/
00056
00057 #ifndef __CJEXPLORERBAR_H__
00058 #define __CJEXPLORERBAR_H__
00059
00060 #if _MSC_VER >= 1000
00061 #pragma once
00062 #endif // _MSC_VER >= 1000
00063
00064 #include "CJControlBar.h"
00065 #include "CJCaption.h"
00066
00067 // CCJExplorerBar is a CCJControlBar derived class which is simular
00068 // to the explorer bar that is seen in Windows or Internet Explorer.
00069 class _CJX_EXT_CLASS CCJExplorerBar : public CCJControlBar
00070 {
00071     DECLARE_DYNAMIC(CCJExplorerBar)
00072
00073 public:
00074
00075     // Default constructor
00076     //
00077     CCJExplorerBar();
00078
00079     // Virtual destructor
00080     //
00081     virtual ~CCJExplorerBar();
00082
00083 protected:
00084
00085     CCJCaption      m_Caption;          // frame caption contains
00086     CCJFlatButton   m_CaptionButton;    // close button located on frame
00087     CString         m_strCaption;       // text that is displayed in the caption
00088     HICON           m_hIcon;            // handle to button icon.
00089
00090 public:
00091
00092     // this member function is used to create an explorer bar
00093     //
00094     virtual BOOL Create(
00095         // the parent window.
00096         CWnd* pParentWnd,
00097         // The ID of the control bar.
00098         UINT nID,
00099         // Points to a null-terminated character string that contains the
00100         // control bar title.
00101         LPCTSTR lpszWindowName = NULL,
00102         // The default size the control bar is to be.
00103         CSize sizeDefault = CSize(200,100),
00104         // Specifies the window style attributes.
00105         DWORD dwStyle = CBRS_LEFT);
00106
00107     // this member function is called by the control bar, and
00108     // can be overloaded in derived classes to return the rect
00109     // for the child window associated with the control bar.
00110     //
00111     virtual void GetChildRect(
00112         // reference to a CRect object which contains the size of
00113         // the child window associated with the control bar.
00114         CRect &rect);
00115
00116 // Overrides
00117     // ClassWizard generated virtual function overrides
00118     //{{AFX_VIRTUAL(CCJExplorerBar)
00119     //}}AFX_VIRTUAL
00120
00121 // Generated message map functions
00122 protected:
00123     //{{AFX_MSG(CCJExplorerBar)
00124     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00125     afx_msg void OnButtonClose();
00126     afx_msg void OnUpdateButtonClose(CCmdUI* pCmdUI);
00127     afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
00128     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00129     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00130     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00131     //}}AFX_MSG
00132     DECLARE_MESSAGE_MAP()
00133 };
00134
00136
00137 //{{AFX_INSERT_LOCATION}}
00138 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00139
00140 #endif // __CJEXPLORERBAR_H__
00141
Generated on Sun Oct 21 12:41:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJFlatButton.h Source File

WinCvs/CJLib/Include/CJFlatButton.h

Go to the documentation of this file.
00001 // CJFlatButton.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 2000/02/29 22:28:40 $
00009  * $Revision: 1.2 $
00010  * $Archive: /CodeJock/Include/CJFlatButton.h $
00011  *
00012  * $History: CJFlatButton.h $
00013  *
00014  * *****************  Version 17  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:00p
00016  * Updated in $/CodeJock/Include
00017  * Further Updates to OnEraseBkgnd(...) and OnPaint() for flicker free
00018  * drawing.
00019  *
00020  * *****************  Version 16  *****************
00021  * User: Kirk Stowell Date: 10/30/99   Time: 2:25p
00022  * Updated in $/CodeJock/Include
00023  * Overrode OnEraseBkgnd(...) and made modifications to DrawItem(...) to
00024  * handle flicker free drawing.
00025  *
00026  * *****************  Version 15  *****************
00027  * User: Kirk Stowell Date: 10/26/99   Time: 10:39p
00028  * Updated in $/CodeJock/Include
00029  * Made class methods virtual for inheritance purposes.
00030  *
00031  * *****************  Version 14  *****************
00032  * User: Kirk Stowell Date: 10/24/99   Time: 4:28p
00033  * Updated in $/CodeJock/Include
00034  * Added method SetAlternateColors(...) which will allow the user to
00035  * define the "face", "hilight" and "shadow" colors used by the control
00036  * rather than used the system defaults. Thanks to Ronen Magid
00037  * [ronenm@simplement.co.il] for his suggestions.
00038  *
00039  * *****************  Version 13  *****************
00040  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00041  * Updated in $/CodeJock/Include
00042  * Fixed potential resource and memory leak problems.
00043  *
00044  * *****************  Version 12  *****************
00045  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00046  * Updated in $/CodeJockey/Include
00047  * Updated copyright and contact information.
00048  *
00049  * *****************  Version 11  *****************
00050  * User: Kirk Stowell Date: 8/29/99    Time: 9:46p
00051  * Updated in $/CodeJockey/Include
00052  * Fixed bug when the button is pressed 2 times very quickly, the button
00053  * is only pressed once - Stephan Neumann <neumann@dialogs.de>
00054  *
00055  * *****************  Version 10  *****************
00056  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00057  * Updated in $/CodeJockey/Include
00058  *
00059  * *****************  Version 9  *****************
00060  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00061  * Updated in $/CodeJockey/Include
00062  *
00063  * *****************  Version 8  *****************
00064  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00065  * Updated in $/CodeJockey/Include
00066  *
00067  * *****************  Version 7  *****************
00068  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00069  * Updated in $/CodeJockey/Include
00070  * Cleaned up inline functions, and import/export macro so that class will
00071  * be imported when linked to, and exported at compile time.
00072  *
00073  * *****************  Version 6  *****************
00074  * User: Kirk Stowell Date: 7/14/99    Time: 9:58p
00075  * Updated in $/CodeJockey/Include
00076  * Re-wrote class to handle icons, text and bitmaps and added additional
00077  * functionality which was needed by the CCJCaption class.
00078  *
00079  * *****************  Version 5  *****************
00080  * User: Kirk Stowell Date: 6/09/99    Time: 8:45p
00081  * Updated in $/CodeJockey/Include
00082  * cleaned up _CJXLIB_INLINE functions, added validation assert.
00083  *
00084  * *****************  Version 4  *****************
00085  * User: Kirk Stowell Date: 4/03/99    Time: 4:23p
00086  * Updated in $/CodeJockey/Include
00087  * Added comments and cleaned up code.
00088  *
00089  * *****************  Version 3  *****************
00090  * User: Kirk Stowell Date: 3/13/99    Time: 4:24p
00091  * Updated in $/CodeJockey/Include
00092  * Patrick Bergeron [patb@softimage.com] fixed the following bugs:
00093  *
00094  * Moving the cursor over the flat button doesn't raise the button right
00095  * away. We have to wait for the first timer message to arrive, which is a
00096  * bit annoying. It gives the impression that the system isn't very
00097  * responsive. So in the OnMouseMove method, we call OnTimer(1) to force
00098  * the initial update of the button.
00099  *
00100  * Sometimes, a CJFlatButton would stay in a raised state when moving the
00101  * mouse quickly over the client area of a few CJFlatButtons. The reason
00102  * turned out to be the use of a static (ahem, global) variable
00103  * "bPainted". The simple fix for this was to put bPainted as a member
00104  * variable ("m_bPainted") and use this member variable instead.
00105  *
00106  * Flat buttons are now much more responsive and behave correctly in all
00107  * cases.
00108  *
00109  * *****************  Version 2  *****************
00110  * User: Kirk Stowell Date: 10/17/98   Time: 4:24p
00111  * Updated in $/CodeJockey/Include
00112  * Code clean up and re-organization, renamed CCJButton to CCJFlatButton.
00113  *
00114  * *****************  Version 1  *****************
00115  * User: Kirk Stowell Date: 10/17/98   Time: 4:23p
00116  * Created in $/CodeJockey/Include
00117  * Initial re-write and release.
00118  *
00119  ***************************************************************************/
00121
00122 #ifndef __CJFLATBUTTON_H__
00123 #define __CJFLATBUTTON_H__
00124
00125 #if _MSC_VER > 1000
00126 #pragma once
00127 #endif // _MSC_VER > 1000
00128
00129 // CCJFlatButton is a CButton derived class used to create flat buttons.
00130 // this class can only be used with the BS_OWNERDRAW style bit set.
00131 class _CJX_EXT_CLASS CCJFlatButton : public CButton
00132 {
00133     DECLARE_DYNAMIC(CCJFlatButton)
00134
00135 public:
00136
00137     // Default constructor
00138     //
00139     CCJFlatButton();
00140
00141     // Virtual destructor
00142     //
00143     virtual ~CCJFlatButton();
00144
00145 protected:
00146
00147     BOOL        m_bMouseOver;
00148     BOOL        m_bLBtnDown;    // true if left mouse button is pressed
00149     BOOL        m_bFlatLook;    // true for flat buttons see DisableFlatLook()
00150     CSize       m_sizeIcon;     // size of the icon if any associated with the button
00151     COLORREF    m_clrHilite;    // set to ::GetSysColor(COLOR_BTNHIGHLIGHT)
00152     COLORREF    m_clrShadow;    // set to ::GetSysColor(COLOR_BTNSHADOW)
00153     COLORREF    m_clrDkShad;    // set to ::GetSysColor(COLOR_3DDKSHADOW)
00154     COLORREF    m_clrNormal;    // set to ::GetSysColor(COLOR_BTNFACE)
00155     COLORREF    m_clrTextGy;    // set to ::GetSysColor(COLOR_GRAYTEXT)
00156     COLORREF    m_clrTextNm;    // set to ::GetSysColor(COLOR_BTNTEXT)
00157     COLORREF    m_clrAltNormal; // user defined replacement for face color.
00158     COLORREF    m_clrAltHilite; // user defined replacement for hilite color.
00159     COLORREF    m_clrAltShadow; // user defined replacement for shadow color.
00160     COLORREF    m_clrAltTextNm; // user defined replacement for text color.
00161     BOOL        m_bAltColor;    // TRUE if user defined colors are used.
00162     BOOL        m_bPainted;     // used during paint operations
00163     HICON       m_hPushed;
00164     CFont*      m_pFont;
00165     CFont       m_Font;         // default font created by control if m_pFont is NULL
00166     HCURSOR     m_hCursor;
00167
00168 public:
00169
00170     virtual void SetButtonFont(CFont* pFont);
00171
00172     // this method will allow the user to define the default colors for the background
00173     // shadow and hilight colors for the button.
00174     //
00175     virtual void SetAlternateColors(COLORREF clrAltNormal, COLORREF clrAltHilite, COLORREF clrAltShadow, COLORREF clrAltTextNm);
00176
00177     // this member function is used to disable or enable the flat
00178     // look for the button
00179     //
00180     virtual void DisableFlatLook(
00181         // set to true to disable the flat look.
00182         BOOL bDisable = FALSE);
00183
00184     // this memeber function is used to associate an icon with the
00185     // flat button.
00186     //
00187     virtual void SetIcon(
00188         // handle to icon to be associated with button.
00189         HICON hIcon,
00190         // desired size of the icon, must be smaller than
00191         // button size for best results.
00192         CSize size);
00193
00194     // this memeber function is used to associate an icon with the
00195     // flat button.
00196     //
00197     virtual void SetIcon(
00198         // handle to icon to be associated with button.
00199         HICON hIcon,
00200         // handle of the pushed icon to be associated with button.
00201         HICON hPushed,
00202         // desired size of the icon, must be smaller than
00203         // button size for best results.
00204         CSize size);
00205
00206 protected:
00207
00208     // these memeber functions are called by the control during paint
00209     // operations.
00210     //
00211     virtual void DrawButtonIcon(CDC* pDC, UINT nState, CRect& rcItem);
00212     virtual void DrawButtonText(CDC* pDC, UINT nState, CRect& rcItem);
00213     virtual void DrawButtonBitmap(CDC* pDC, UINT nState, CRect& rcItem);
00214
00215     // used by the control to initialize the default font.
00216     //
00217     virtual void UpdateFont();
00218
00219 // Overrides
00220     // ClassWizard generated virtual function overrides
00221     //{{AFX_VIRTUAL(CCJFlatButton)
00222     public:
00223     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
00224     //}}AFX_VIRTUAL
00225
00226     // Generated message map functions
00227 protected:
00228     //{{AFX_MSG(CCJFlatButton)
00229     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00230     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00231     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00232     afx_msg void OnTimer(UINT nIDEvent);
00233     afx_msg void OnSysColorChange();
00234     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00235     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00236     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00237     afx_msg void OnPaint();
00238     //}}AFX_MSG
00239
00240     DECLARE_MESSAGE_MAP()
00241 };
00242
00244 //  Inline Functions
00246
00247 _CJXLIB_INLINE void CCJFlatButton::DisableFlatLook(BOOL bDisable)
00248     { ASSERT(::IsWindow(m_hWnd)); m_bFlatLook = bDisable; Invalidate(); }
00249
00250 _CJXLIB_INLINE void CCJFlatButton::SetIcon(HICON hIcon, CSize size)
00251     { ASSERT(::IsWindow(m_hWnd)); m_sizeIcon = size; CButton::SetIcon(hIcon); }
00252
00253 _CJXLIB_INLINE void CCJFlatButton::SetIcon(HICON hIcon, HICON hPushed, CSize size)
00254     { ASSERT(::IsWindow(m_hWnd)); m_hPushed = hPushed; SetIcon(hIcon, size); }
00255
00256 _CJXLIB_INLINE void CCJFlatButton::SetButtonFont(CFont *pFont)
00257     { ASSERT(::IsWindow(m_hWnd)); m_pFont = pFont; }
00258
00260
00261 //{{AFX_INSERT_LOCATION}}
00262 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00263
00264 #endif // __CJFLATBUTTON_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJFlatComboBox.h Source File

WinCvs/CJLib/Include/CJFlatComboBox.h

Go to the documentation of this file.
00001 // CJFlatComboBox.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJFlatComboBox.h $
00011  *
00012  * $History: CJFlatComboBox.h $
00013  *
00014  * *****************  Version 17  *****************
00015  * User: Kirk Stowell Date: 10/30/99   Time: 6:01p
00016  * Updated in $/CodeJock/Include
00017  * Overrode OnEraseBkgnd(...) and re-wrote OnPaint() to handle flicker
00018  * free drawing.
00019  *
00020  * *****************  Version 16  *****************
00021  * User: Kirk Stowell Date: 10/30/99   Time: 2:24p
00022  * Updated in $/CodeJock/Include
00023  * Added COLORREF members to class to eliminate continuous calls to
00024  * GetSysColor(...). Overrode OnSysColorChange() to re-initialize COLORREF
00025  * variables.
00026  *
00027  * *****************  Version 15  *****************
00028  * User: Kirk Stowell Date: 10/26/99   Time: 10:39p
00029  * Updated in $/CodeJock/Include
00030  * Made class methods virtual for inheritance purposes.
00031  *
00032  * *****************  Version 14  *****************
00033  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00034  * Updated in $/CodeJockey/Include
00035  * Updated copyright and contact information.
00036  *
00037  * *****************  Version 13  *****************
00038  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00039  * Updated in $/CodeJockey/Include
00040  *
00041  * *****************  Version 12  *****************
00042  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00043  * Updated in $/CodeJockey/Include
00044  *
00045  * *****************  Version 11  *****************
00046  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00047  * Updated in $/CodeJockey/Include
00048  *
00049  * *****************  Version 10  *****************
00050  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00051  * Updated in $/CodeJockey/Include
00052  * Cleaned up inline functions, and import/export macro so that class will
00053  * be imported when linked to, and exported at compile time.
00054  *
00055  * *****************  Version 9  *****************
00056  * User: Kirk Stowell Date: 5/17/99    Time: 9:24p
00057  * Updated in $/CodeJockey/Include
00058  * Gilberto Botaro [seafox@techno.com.br] - Added code for auto
00059  * completion.
00060  *
00061  * *****************  Version 8  *****************
00062  * User: Kirk Stowell Date: 5/03/99    Time: 10:44p
00063  * Updated in $/CodeJockey/Include
00064  * Fixed code ommisions.
00065  *
00066  * *****************  Version 7  *****************
00067  * User: Kirk Stowell Date: 5/03/99    Time: 8:42p
00068  * Updated in $/CodeJockey/Include
00069  * Danilo Lax [Danilo_Lax@www2.alpeng.com] - The control is painted flat
00070  * when the mouse leaves the box, even if the control has the focus, now
00071  * checking for the focus in OnTimer(.
00072  *
00073  * Removed, unhandled msgs are processed by
00074  * CComboBox::PreTranslateMessage(pMsg). Used reflected msgs
00075  * BN_GETFOCUS/CBN_KILLFOCUS instead of WM_GETFOCUS/WM_KILLFOCUS.
00076  *
00077  * ::GetFocus() doesn't return CFlatComboBox::m_hWnd, even if the control
00078  * has the focus (don't know why, maybe ::GetFocus() only returns the
00079  * handle to the EditField part of the ComboBox), used flag m_bHasFocus
00080  * instead.
00081  *
00082  * *****************  Version 6  *****************
00083  * User: Kirk Stowell Date: 4/03/99    Time: 4:26p
00084  * Updated in $/CodeJockey/Include
00085  * Added comments and cleaned up code.
00086  *
00087  * *****************  Version 5  *****************
00088  * User: Kirk Stowell Date: 1/22/99    Time: 4:26p
00089  * Updated in $/CodeJockey/Include
00090  * Fixed accelerator problem reported by YOSH YAMASHITA
00091  * (yosh@muj.biglobe.ne.jp) with Matt Weagle's solution of overloading
00092  * PreTranslateMessage().
00093  *
00094  * *****************  Version 4  *****************
00095  * User: Kirk Stowell Date: 1/02/99    Time: 4:25p
00096  * Updated in $/CodeJockey/Include
00097  * Renamed class from CJComboBox to CCJFlatComboBox, changed DRAWSTATE to
00098  * enum, removed method Offset(), and replaced with a direct call to
00099  * ::GetSystemMetrics().
00100  *
00101  * *****************  Version 3  *****************
00102  * User: Kirk Stowell Date: 11/02/98   Time: 4:24p
00103  * Updated in $/CodeJockey/Include
00104  * Added OnSetFocus(), OnKillFocus() and modified OnPaint() so the control
00105  * remains beveled until it actually looses focus - (Vachik
00106  * Hovhannissian).
00107  *
00108  * *****************  Version 2  *****************
00109  * User: Kirk Stowell Date: 10/05/98   Time: 4:24p
00110  * Updated in $/CodeJockey/Include
00111  * Fixed offset bug to use GetSystemMetrics(), instead of hard coded
00112  * values -
00113  * Todd Brannam (tbrannam@msn.com).
00114  *
00115  * *****************  Version 1  *****************
00116  * User: Kirk Stowell Date: 10/02/98   Time: 4:23p
00117  * Created in $/CodeJockey/Include
00118  * First release version.
00119  *
00120  ***************************************************************************/
00122
00123 #ifndef __CJFLATCOMBOBOX_H__
00124 #define __CJFLATCOMBOBOX_H__
00125
00126 #if _MSC_VER > 1000
00127 #pragma once
00128 #endif // _MSC_VER > 1000
00129
00130 // CCJFlatComboBox is a CComboBox derived class which is simular to
00131 // the flat combobox as seen in the Microsoft office products.
00132 class _CJX_EXT_CLASS CCJFlatComboBox : public CComboBox
00133 {
00134     DECLARE_DYNAMIC(CCJFlatComboBox)
00135
00136 public:
00137
00138     // Default constructor
00139     //
00140     CCJFlatComboBox();
00141
00142     // Virtual destructor
00143     //
00144     virtual ~CCJFlatComboBox();
00145
00146 protected:
00147
00148     // enum used to determine the state the combo box should be
00149     //
00150     enum STATE { NORMAL = 1, RAISED = 2, PRESSED = 3 };
00151
00152     BOOL        m_bLBtnDown;        // TRUE if left mouse button is pressed
00153     BOOL        m_bPainted;         // used during paint operations
00154     BOOL        m_bHasFocus;        // TRUE if control has focus
00155     BOOL        m_bAutoComp;        // Used by Autocompleting.
00156     COLORREF    m_clrHilite;        // set to ::GetSysColor(COLOR_BTNHIGHLIGHT)
00157     COLORREF    m_clrShadow;        // set to ::GetSysColor(COLOR_BTNSHADOW)
00158     COLORREF    m_clrNormal;        // set to ::GetSysColor(COLOR_BTNFACE)
00159
00160 public:
00161     BOOL IsWin95();
00162
00163     // Call this member function to enable auto completion.
00164     //
00165     virtual void EnableAutoCompletion(BOOL bEnable=TRUE);
00166
00167     // This member function determines if the mouse is within
00168     // the controls rect.
00169     //
00170     virtual BOOL PointInRect();
00171
00172 protected:
00173
00174     // this member function is called by the combo box whenever a paint
00175     // operation should occur.
00176     //
00177     virtual void DrawCombo(STATE eState, COLORREF clrTopLeft, COLORREF clrBottomRight, CDC* pDC=NULL);
00178
00179 // Overrides
00180     // ClassWizard generated virtual function overrides
00181     //{{AFX_VIRTUAL(CCJFlatComboBox)
00182     public:
00183     virtual BOOL PreTranslateMessage(MSG* pMsg);
00184     //}}AFX_VIRTUAL
00185
00186     // Generated message map functions
00187 protected:
00188     //{{AFX_MSG(CCJFlatComboBox)
00189     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00190     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00191     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00192     afx_msg void OnTimer(UINT nIDEvent);
00193     afx_msg void OnPaint();
00194     afx_msg void OnSetFocus();
00195     afx_msg void OnKillFocus();
00196     afx_msg void OnEditUpdate();
00197     afx_msg void OnSysColorChange();
00198     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00199     //}}AFX_MSG
00200
00201     DECLARE_MESSAGE_MAP()
00202 };
00203
00205 //  Inline Functions
00207
00208 _CJXLIB_INLINE void CCJFlatComboBox::EnableAutoCompletion(BOOL bEnable/*=TRUE*/)
00209     { ASSERT(::IsWindow(m_hWnd)); m_bAutoComp = bEnable; }
00210
00211 _CJXLIB_INLINE BOOL CCJFlatComboBox::PointInRect()
00212     { ASSERT(::IsWindow(m_hWnd)); CPoint pt; GetCursorPos(&pt); CRect rcItem; GetWindowRect(&rcItem); return rcItem.PtInRect(pt); }
00213
00214 //{{AFX_INSERT_LOCATION}}
00215 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00216
00217 #endif // __CJCOMBOBOX_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJFlatHeaderCtrl.h Source File

WinCvs/CJLib/Include/CJFlatHeaderCtrl.h

Go to the documentation of this file.
00001 // CJFlatHeaderCtrl.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJFlatHeaderCtrl.h $
00011  *
00012  * $History: CJFlatHeaderCtrl.h $
00013  *
00014  * *****************  Version 16  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:01p
00016  * Updated in $/CodeJock/Include
00017  * Further Updates to OnEraseBkgnd(...) and OnPaint() for flicker free
00018  * drawing.
00019  *
00020  * *****************  Version 15  *****************
00021  * User: Kirk Stowell Date: 10/30/99   Time: 2:23p
00022  * Updated in $/CodeJock/Include
00023  * Overrode OnPaint(...) for flicker free drawing and fixed bug where
00024  * column is resized and border leaves a trail.
00025  *
00026  * *****************  Version 14  *****************
00027  * User: Kirk Stowell Date: 10/26/99   Time: 10:39p
00028  * Updated in $/CodeJock/Include
00029  * Made class methods virtual for inheritance purposes.
00030  *
00031  * *****************  Version 13  *****************
00032  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00033  * Updated in $/CodeJock/Include
00034  * Fixed potential resource and memory leak problems.
00035  *
00036  * *****************  Version 12  *****************
00037  * User: Kirk Stowell Date: 10/14/99   Time: 8:23p
00038  * Updated in $/CodeJock/Include
00039  * Fixed size bug with header control where the end does not display
00040  * correctly.
00041  *
00042  * *****************  Version 11  *****************
00043  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00044  * Updated in $/CodeJockey/Include
00045  * Updated copyright and contact information.
00046  *
00047  * *****************  Version 10  *****************
00048  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00049  * Updated in $/CodeJockey/Include
00050  *
00051  * *****************  Version 9  *****************
00052  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00053  * Updated in $/CodeJockey/Include
00054  *
00055  * *****************  Version 8  *****************
00056  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00057  * Updated in $/CodeJockey/Include
00058  * Cleaned up inline functions, and import/export macro so that class will
00059  * be imported when linked to, and exported at compile time.
00060  *
00061  * *****************  Version 7  *****************
00062  * User: Kirk Stowell Date: 6/14/99    Time: 10:43p
00063  * Updated in $/CodeJockey/Include
00064  * Cleaned up code to eliminate level 4 compilier warnings.
00065  *
00066  * *****************  Version 6  *****************
00067  * User: Kirk Stowell Date: 5/17/99    Time: 8:00p
00068  * Updated in $/CodeJockey/Include
00069  * Added popup menu support and vc5 compatibility.
00070  *
00071  * *****************  Version 5  *****************
00072  * User: Kirk Stowell Date: 4/15/99    Time: 4:27p
00073  * Updated in $/CodeJockey/Include
00074  * Igor Ostriz [iostriz@usa.net] - fixed bug with drag/drop and changing
00075  * column order.
00076  *
00077  * *****************  Version 4  *****************
00078  * User: Kirk Stowell Date: 4/03/99    Time: 4:26p
00079  * Updated in $/CodeJockey/Include
00080  * Added comments and cleaned up code.
00081  *
00082  * *****************  Version 3  *****************
00083  * User: Kirk Stowell Date: 2/24/99    Time: 4:26p
00084  * Updated in $/CodeJockey/Include
00085  * Fixed repainting problem when header is moved or window is resized. The
00086  * class now uses log font instead of hard coded Tahoma font.
00087  *
00088  * *****************  Version 2  *****************
00089  * User: Kirk Stowell Date: 1/31/99    Time: 4:27p
00090  * Updated in $/CodeJockey/Include
00091  * Fixed problem with sort arrow drawn. If hditem has an associated
00092  * bitmap, the arrow is not drawn.
00093  *
00094  * *****************  Version 1  *****************
00095  * User: Kirk Stowell Date: 1/16/99    Time: 4:26p
00096  * Created in $/CodeJockey/Include
00097  * Initial release.
00098  *
00099  ***************************************************************************/
00101
00102 #ifndef __CJFLATHEADERCTRL_H__
00103 #define __CJFLATHEADERCTRL_H__
00104
00105 #if _MSC_VER >= 1000
00106 #pragma once
00107 #endif // _MSC_VER >= 1000
00108
00109 #include "CJMenu.h"        // CCJMenu class declaration
00110
00111 // CCJFlatHeaderCtrl is a CHeaderCtrl derived class which is simular
00112 // to the listbox flat header controls seen in Visual Studio and Outlook.
00113 class _CJX_EXT_CLASS CCJFlatHeaderCtrl : public CHeaderCtrl
00114 {
00115
00116 public:
00117
00118     // Default constructor
00119     //
00120     CCJFlatHeaderCtrl();
00121
00122     // Virtual destructor
00123     //
00124     virtual ~CCJFlatHeaderCtrl();
00125
00126 protected:
00127     UINT    m_popToolbarID; // popup menu toolbar resource id, associates
00128                             // toolbar icons with the popup menu.
00129
00130     UINT    m_popupMenuID;  // popup menu resource id
00131     CCJMenu m_popupMenu;    // popup menu
00132     int     m_nPos;         // index of the pop-up menu contained in the menu
00133     BOOL    m_bBoldFont;    // true for bold fonts see SetFontBold(...)
00134     BOOL    m_bLBtnDown;    // true if left mouse button is pressed
00135     BOOL    m_bSortAsc;     // used when column is pressed to draw sort arrow.
00136     CFont   m_Font;         // font the header will use
00137     int     m_nOffset;      // ammount to offset the sort arrow.
00138     int     m_nSortCol;     // last column pressed during sort.
00139     CWnd*   m_pParentWnd;   // holds a pointer to the parent window.
00140     CRect   m_rcOldSize;
00141
00142 public:
00143
00144     // this member function is called to associate a menu and toolbar
00145     // resource with the context menu.
00146     //
00147     virtual void SetMenuID(UINT popupMenuID, UINT popToolbarID=0, int nPos=0);
00148
00149     // this member function returns the menu resource associated with
00150     // the tab control.
00151     //
00152     virtual UINT GetMenuID();
00153
00154     // this member function must be called after creation to initialize the
00155     // font the header will use.
00156     //
00157     virtual void InitializeHeader(bool bBoldFont);
00158
00159     // this member function can be used to toggle the font from bold to
00160     // normal.
00161     //
00162     virtual void SetFontBold(BOOL bBoldFont = TRUE);
00163
00164     // this member function is called by the header during sort
00165     // operations
00166     //
00167     virtual int SetSortImage( int nCol, BOOL bAsc );
00168
00169 protected:
00170
00171     // this member function is called by the header during paint
00172     // operations.
00173     //
00174     virtual void DrawFlatBorder(CDC* pDC);
00175     virtual void ResizeWindow();
00176
00177 #ifdef _VC_VERSION_5
00178     // this member function was added for vc5 support. It returns the number
00179     // of columns currently in the header.
00180     //
00181     virtual int CCJFlatHeaderCtrl::GetItemCount() const;
00182     virtual BOOL GetOrderArray(LPINT piArray, int iCount= -1);
00183 #endif
00184
00185 // Overrides
00186     // ClassWizard generated virtual function overrides
00187     //{{AFX_VIRTUAL(CCJFlatHeaderCtrl)
00188     public:
00189     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
00190     protected:
00191     virtual void PreSubclassWindow();
00192     //}}AFX_VIRTUAL
00193
00194     // Generated message map functions
00195 protected:
00196     //{{AFX_MSG(CCJFlatHeaderCtrl)
00197     afx_msg void OnPaint();
00198     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00199     afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
00200     afx_msg LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu);
00201     afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
00202     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00203     afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
00204     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00205     //}}AFX_MSG
00206
00207     DECLARE_MESSAGE_MAP()
00208 };
00209
00211 //  Inline Functions
00213
00214 _CJXLIB_INLINE void CCJFlatHeaderCtrl::SetMenuID(UINT popupMenuID, UINT popToolbarID, int nPos)
00215     { ASSERT(::IsWindow(m_hWnd)); m_popupMenuID=popupMenuID; m_popToolbarID=popToolbarID; m_nPos=nPos; }
00216
00217 _CJXLIB_INLINE UINT CCJFlatHeaderCtrl::GetMenuID()
00218     { ASSERT(::IsWindow(m_hWnd)); return m_popupMenuID; }
00219
00220 _CJXLIB_INLINE void CCJFlatHeaderCtrl::SetFontBold(BOOL bBoldFont)
00221     { ASSERT(::IsWindow(m_hWnd)); m_bBoldFont = bBoldFont; }
00222
00223 #ifdef _VC_VERSION_5
00224 _CJXLIB_INLINE int CCJFlatHeaderCtrl::GetItemCount() const
00225     { ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, HDM_GETITEMCOUNT, 0, 0L); }
00226 #endif
00227
00229
00230 //{{AFX_INSERT_LOCATION}}
00231 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00232
00233 #endif // __CJFLATHEADERCTRL_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJFlatSplitterWnd.h Source File

WinCvs/CJLib/Include/CJFlatSplitterWnd.h

Go to the documentation of this file.
00001 // CJFlatSplitterWnd.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the CSplitterWndEx class written by Oleg G. Galkin.
00006 // mailto:OlegGa@vest.msk.ru
00007 // http://www.codeguru.com/splitter/show_hide_static_panes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJock/Include/CJFlatSplitterWnd.h $
00015  *
00016  * $History: CJFlatSplitterWnd.h $
00017  *
00018  * *****************  Version 5  *****************
00019  * User: Kirk Stowell Date: 10/26/99   Time: 10:39p
00020  * Updated in $/CodeJock/Include
00021  * Made class methods virtual for inheritance purposes.
00022  *
00023  * *****************  Version 4  *****************
00024  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00025  * Updated in $/CodeJockey/Include
00026  * Updated copyright and contact information.
00027  *
00028  * *****************  Version 3  *****************
00029  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00030  * Updated in $/CodeJockey/Include
00031  *
00032  * *****************  Version 2  *****************
00033  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00034  * Updated in $/CodeJockey/Include
00035  * Cleaned up inline functions, and import/export macro so that class will
00036  * be imported when linked to, and exported at compile time.
00037  *
00038  * *****************  Version 1  *****************
00039  * User: Kirk Stowell Date: 7/14/99    Time: 10:00p
00040  * Created in $/CodeJockey/Include
00041  * Class added to support flat splitters, removable splitter views and
00042  * view manipulation.
00043  *
00044  ***************************************************************************/
00046
00047 #ifndef __CJFLATSPLITTERWND_H__
00048 #define __CJFLATSPLITTERWND_H__
00049
00050 #if _MSC_VER >= 1000
00051 #pragma once
00052 #endif // _MSC_VER >= 1000
00053
00054 // CCJFlatSplitterWnd is a CSplitterWnd derived class which adds the ability
00055 // to hide and show splitter panes, based upon its index, and
00056 // to draw flat splitter windows simular to Oultook.
00057 class _CJX_EXT_CLASS CCJFlatSplitterWnd : public CSplitterWnd
00058 {
00059 public:
00060
00061     // Default constructor
00062     //
00063     CCJFlatSplitterWnd();
00064
00065     // Virtual destructor
00066     //
00067     virtual ~CCJFlatSplitterWnd();
00068
00069 protected:
00070
00071     int     m_nHiddenCol;       // Index of the hidden column.
00072     int     m_nHiddenRow;       // Index of the hidden row.
00073     BOOL    m_bFlatSplitter;    // true if the SPLS_FLATEDGE style was used during creation.
00074
00075 public:
00076
00077     // call this member function to enable or disable flat splitters.
00078     //
00079     virtual void DisableFlatStyle(BOOL bDisable=TRUE);
00080
00081     // this member function is called to switch, or swap a splitter
00082     // view with another.
00083     //
00084     virtual BOOL SwitchView(int nRow, int nCol, CView *pNewView);
00085
00086     // this member function is called to replace an existing splitter
00087     // view with another.
00088     //
00089     virtual BOOL ReplaceView(int nRow, int nCol, CRuntimeClass *pViewClass);
00090
00091     // this member function is called to show the column that was
00092     // previously hidden.
00093     //
00094     virtual void ShowColumn();
00095
00096     // this member function will hide a column based upon its index.
00097     //
00098     virtual void HideColumn(int nColHide);
00099
00100     // this member function is called to show the row that was
00101     // previously hidden.
00102     //
00103     virtual void ShowRow();
00104
00105     // this member function will hide a row based upon its index.
00106     //
00107     virtual void HideRow(int nRowHide);
00108
00109 // Overrides
00110     // ClassWizard generated virtual function overrides
00111     //{{AFX_VIRTUAL(CCJFlatSplitterWnd)
00112     virtual void OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rect);
00113     //}}AFX_VIRTUAL
00114
00115 // Generated message map functions
00116 protected:
00117     //{{AFX_MSG(CCJFlatSplitterWnd)
00118     afx_msg void OnPaint();
00119     //}}AFX_MSG
00120     DECLARE_MESSAGE_MAP()
00121 };
00122
00124
00125 _CJXLIB_INLINE void CCJFlatSplitterWnd::DisableFlatStyle(BOOL bDisable)
00126     { m_bFlatSplitter = !bDisable; }
00127
00128 //{{AFX_INSERT_LOCATION}}
00129 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00130
00131 #endif // __CJFLATSPLITTERWND_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJFlatTabCtrl.h Source File

WinCvs/CJLib/Include/CJFlatTabCtrl.h

Go to the documentation of this file.
00001 // FlatTab.h : header file
00002 //
00003 // Copyright © 1999 Ian Brumby
00004 //
00005 // This source code may be used in compiled form in any way you desire.
00006 // Source file(s) may be redistributed unmodified by any means PROVIDING
00007 // they are not sold for profit without the authors expressed written consent,
00008 // and providing that this notice and the authors name and all copyright
00009 // notices remain intact.
00010 //
00011 // ==========================================================================
00012 // HISTORY:
00013 // ==========================================================================
00014 //          1.4     21 Jul 1999 - Initial release.
00015 //          1.5     30 Aug 1999 - Several enhancements by Phil Baxter
00016 //                  <Phil.Baxter@mrjinx.demon.co.uk>
00017 // ==========================================================================
00018
00019 // Excel uses FF_ROMAN and Font Height = ~(control's height - 4)
00020 // Excel draws its tabs right to left
00021 // Excel has 3DLIGHT highlighting on the left diagonal
00022 // Excel has home/end buttons
00023 // Excel's buttons change width as the control's height changes
00024 //
00026 /****************************************************************************
00027  *
00028  * $Date: 1999/11/30 21:45:51 $
00029  * $Revision: 1.1.1.3 $
00030  * $Archive: /CodeJock/Include/CJFlatTabCtrl.h $
00031  *
00032  * $History: CJFlatTabCtrl.h $
00033  *
00034  * *****************  Version 8  *****************
00035  * User: Kirk Stowell Date: 10/26/99   Time: 10:40p
00036  * Updated in $/CodeJock/Include
00037  * Made class methods virtual for inheritance purposes.
00038  *
00039  * *****************  Version 7  *****************
00040  * User: Kirk Stowell Date: 10/24/99   Time: 12:15a
00041  * Updated in $/CodeJock/Include
00042  * Fixed minor bug with tab font creation.
00043  *
00044  * *****************  Version 6  *****************
00045  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00046  * Updated in $/CodeJock/Include
00047  * Fixed potential resource and memory leak problems.
00048  *
00049  * *****************  Version 5  *****************
00050  * User: Kirk Stowell Date: 10/14/99   Time: 12:25p
00051  * Updated in $/CodeJock/Include
00052  * Added source control history to file header.
00053  *
00054  ***************************************************************************/
00056
00057 #ifndef __CCJFLATTABCTRL_H__
00058 #define __CCJFLATTABCTRL_H__
00059
00060 #if _MSC_VER > 1000
00061 #pragma once
00062 #endif // _MSC_VER > 1000
00063
00064 #include <afxtempl.h>
00065 #include "CJMetaFileButton.h"
00066
00067 // control styles
00068 #define FTS_BOTTOM              0x0002
00069 #define FTS_HASARROWS           0x0004
00070 #define FTS_HASHOMEEND          0x0008 // Must be used with FTS_HASARROWS
00071
00072 typedef CList <CString*, CString*> CTabList;
00073
00074 // CCJFlatTabCtrl is a CWnd derived class which is used to create a flat tab
00075 // control simular to DevStudio.
00076 class _CJX_EXT_CLASS CCJFlatTabCtrl : public CWnd
00077 {
00078
00079 // Construction
00080 public:
00081     CCJFlatTabCtrl();
00082
00083 // Attributes
00084 public:
00085
00086 // Operations
00087 public:
00088
00089     virtual BOOL InsertItem(const int nItem, LPCTSTR lpszItem);
00090     virtual BOOL DeleteItem(int nItem);
00091     virtual BOOL DeleteAllItems();
00092     virtual BOOL GetItemRect(int nItem, LPRECT lpRect);
00093     virtual int HitTest(TCHITTESTINFO *pHitTestInfo) const;
00094     virtual int GetCurSel() const {return m_iCurSel;}
00095     virtual int SetCurSel(int nItem);
00096     virtual int GetItemCount() const { return m_TabList.GetCount(); }
00097     virtual void SetTipText(int nItem, LPCTSTR lpszTabTip);
00098     virtual CString GetTipText(int nItem);
00099     virtual void Home();
00100
00101 // Overrides
00102     // ClassWizard generated virtual function overrides
00103     //{{AFX_VIRTUAL(CCJFlatTabCtrl)
00104     protected:
00105     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00106     virtual BOOL PreTranslateMessage(MSG* pMsg);
00107     //}}AFX_VIRTUAL
00108
00109 // Implementation
00110 public:
00111     virtual ~CCJFlatTabCtrl();
00112
00113     // Generated message map functions
00114 protected:
00115     //{{AFX_MSG(CCJFlatTabCtrl)
00116     afx_msg void OnPaint();
00117     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00118     afx_msg void OnSize(UINT nType, int cx, int cy);
00119     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00120     afx_msg void OnLeftArrow();
00121     afx_msg void OnRightArrow();
00122     afx_msg void OnHomeArrow();
00123     afx_msg void OnEndArrow();
00124     //}}AFX_MSG
00125     DECLARE_MESSAGE_MAP()
00126
00127 private:
00128
00129     void CreateTabFont(const int iTabHeight);
00130     int GetTabWidth(const int nItem) const;
00131     int GetTotalArrowWidth(void) const;
00132     int GetTotalTabWidth(void) const;
00133     void InvalidateTabs(void);
00134     void EnableButtons(void);
00135     int DrawTab(CDC &dc, const int x, const int y, const int iHeight, bool bSelected, bool bBottom, LPCTSTR lpszTab) const;
00136
00137     bool m_bHasArrows;
00138     bool m_bHasHomeEnd;
00139     bool m_bTabsOnBottom;
00140     int m_iCurSel;
00141     int m_iClientWidth;
00142     int m_iClientHeight;
00143     int m_iTotalTabWidth;
00144     int m_iXOffset;
00145     CTabList m_TabList;
00146     CTabList m_TabTipList;
00147     CFont m_Font;
00148     CFont m_BoldFont;
00149     CCJMetaFileButton *m_pLeftButton;
00150     CCJMetaFileButton *m_pRightButton;
00151     CCJMetaFileButton *m_pHomeButton;
00152     CCJMetaFileButton *m_pEndButton;
00153     HENHMETAFILE m_hLeftArrow;
00154     HENHMETAFILE m_hLeftArrowDisabled;
00155     HENHMETAFILE m_hRightArrow;
00156     HENHMETAFILE m_hRightArrowDisabled;
00157     HENHMETAFILE m_hHomeArrow;
00158     HENHMETAFILE m_hHomeArrowDisabled;
00159     HENHMETAFILE m_hEndArrow;
00160     HENHMETAFILE m_hEndArrowDisabled;
00161
00162     CToolTipCtrl        m_ToolTip;
00163 };
00164
00166
00167 //{{AFX_INSERT_LOCATION}}
00168 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00169
00170 #endif // __CCJFLATTABCTRL_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJFontCombo.h Source File

WinCvs/CJLib/Include/CJFontCombo.h

Go to the documentation of this file.
00001
00002 // CJFontCombo.h : header file
00003 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00004 // See ReadMe.txt for TERMS OF USE.
00005 //
00006 // Based on the article 'Owner Drawn Font Selection ComboBox' by Girish Bharadwaj
00007 // http://www.codeguru.com/misc/font_selection_combo.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJock/Include/CJFontCombo.h $
00015  *
00016  * $History: CJFontCombo.h $
00017  *
00018  * *****************  Version 4  *****************
00019  * User: Kirk Stowell Date: 10/31/99   Time: 11:01p
00020  * Updated in $/CodeJock/Include
00021  * Overrode OnEraseBkgnd(...) and OnPaint() for flicker free drawing.
00022  *
00023  * *****************  Version 3  *****************
00024  * User: Kirk Stowell Date: 10/26/99   Time: 10:41p
00025  * Updated in $/CodeJock/Include
00026  * Made class methods virtual for inheritance purposes. Added the
00027  * DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC macros to CCJFontCombo for access
00028  * to run-time information
00029  *
00030  * *****************  Version 2  *****************
00031  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00032  * Updated in $/CodeJockey/Include
00033  * Updated copyright and contact information.
00034  *
00035  * *****************  Version 1  *****************
00036  * User: Kirk Stowell Date: 7/26/99    Time: 2:11p
00037  * Created in $/CodeJockey/Include
00038  *
00039  ***************************************************************************/
00041
00042 #ifndef __CJFONTCOMBO_H__
00043 #define __CJFONTCOMBO_H__
00044
00045 #if _MSC_VER >= 1000
00046 #pragma once
00047 #endif // _MSC_VER >= 1000
00048
00050 // CCJFontCombo window
00051 class _CJX_EXT_CLASS CCJFontCombo : public CComboBox
00052 {
00053     DECLARE_DYNAMIC(CCJFontCombo)
00054
00055 // Construction
00056 public:
00057      CCJFontCombo();
00058
00059 // Attributes
00060 protected:
00061
00062     COLORREF    m_clrHilight;
00063     COLORREF    m_clrNormalText;
00064     COLORREF    m_clrHilightText;
00065     COLORREF    m_clrBkgnd;
00066
00067 // Operations
00068 public:
00069
00070     virtual int GetSelFont(LOGFONT& logFont);
00071     virtual void SetHilightColors(COLORREF clrHilight,COLORREF clrHilightText);
00072     virtual void SetNormalColors(COLORREF clrBkgnd,COLORREF clrNormalText);
00073     static BOOL CALLBACK EnumFontProc(LPLOGFONT lpLogFont, LPTEXTMETRIC lpTextMetric, short nFontType, LPHANDLE lpData);
00074
00075 protected:
00076
00077     virtual void InitializeFonts();
00078
00079 // Overrides
00080     // ClassWizard generated virtual function overrides
00081     //{{AFX_VIRTUAL(CCJFontCombo)
00082     public:
00083     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
00084     virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
00085     protected:
00086     virtual void PreSubclassWindow();
00087     //}}AFX_VIRTUAL
00088
00089 // Implementation
00090 public:
00091      virtual ~CCJFontCombo();
00092
00093 // Generated message map functions
00094 protected:
00095
00096     //{{AFX_MSG(CCJFontCombo)
00097     afx_msg void OnDestroy();
00098     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00099     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00100     afx_msg void OnPaint();
00101     //}}AFX_MSG
00102     DECLARE_MESSAGE_MAP()
00103 };
00104
00106 //  Inline Functions
00108
00109 _CJXLIB_INLINE void CCJFontCombo::SetHilightColors( COLORREF clrHilight, COLORREF clrHilightText )
00110     { m_clrHilight = clrHilight; m_clrHilightText = clrHilightText; };
00111
00112 _CJXLIB_INLINE void CCJFontCombo::SetNormalColors( COLORREF clrBkgnd, COLORREF clrNormalText )
00113     { m_clrNormalText = clrNormalText; m_clrBkgnd = clrBkgnd; };
00114
00116
00117 //{{AFX_INSERT_LOCATION}}
00118 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00119
00120 #endif // __CJFONTCOMBO_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJFrameWnd.h Source File

WinCvs/CJLib/Include/CJFrameWnd.h

Go to the documentation of this file.
00001 // CJFrameWnd.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJFrameWnd.h $
00011  *
00012  * $History: CJFrameWnd.h $
00013  *
00014  * *****************  Version 16  *****************
00015  * User: Kirk Stowell Date: 10/29/99   Time: 12:43a
00016  * Updated in $/CodeJock/Include
00017  * Overloaded PreCreateWindow(...) for flicker free drawing.
00018  *
00019  * *****************  Version 15  *****************
00020  * User: Kirk Stowell Date: 10/26/99   Time: 10:41p
00021  * Updated in $/CodeJock/Include
00022  * Made class methods virtual for inheritance purposes.
00023  *
00024  * *****************  Version 14  *****************
00025  * User: Kirk Stowell Date: 10/14/99   Time: 6:15p
00026  * Updated in $/CodeJock/Include
00027  * Fixed bug with a document becomes the active document when the user
00028  * clicks inside a tab in the CCJTabControlBar to perform some operation.
00029  * When closing the application, MFC decides in CFrameWnd::OnClose() to
00030  * check if the 'active' document is modified before checking all other
00031  * documuents. If the active document is not modified and can close its
00032  * frame, it does not check other documents individually and shuts down
00033  * without asking the important 'modified save' questions. To fix this,
00034  * OnClose() was overriden to add a call to "SetActiveView(NULL)" just
00035  * before the base class OnClose is called. This will check all documents
00036  * asking the save question before closing the application. Thanks to
00037  * Simon Clark [spc@otleda.com] for help with this.
00038  *
00039  * *****************  Version 13  *****************
00040  * User: Kirk Stowell Date: 10/14/99   Time: 10:05a
00041  * Updated in $/CodeJock/Include
00042  * Overrode OnEraseBkgnd(...) to help to eliminate screen flicker.
00043  *
00044  * *****************  Version 12  *****************
00045  * User: Kirk Stowell Date: 9/16/99    Time: 2:35p
00046  * Updated in $/CodeJockey/Include
00047  * Fixed bug with save / restore bar state, and with saved bar size
00048  * changing whenever the application starts.
00049  *
00050  * *****************  Version 11  *****************
00051  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00052  * Updated in $/CodeJockey/Include
00053  * Updated copyright and contact information.
00054  *
00055  * *****************  Version 10  *****************
00056  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00057  * Updated in $/CodeJockey/Include
00058  *
00059  * *****************  Version 9  *****************
00060  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00061  * Updated in $/CodeJockey/Include
00062  *
00063  * *****************  Version 8  *****************
00064  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00065  * Updated in $/CodeJockey/Include
00066  * Cleaned up inline functions, and import/export macro so that class will
00067  * be imported when linked to, and exported at compile time.
00068  *
00069  * *****************  Version 7  *****************
00070  * User: Kirk Stowell Date: 6/11/99    Time: 8:25p
00071  * Updated in $/CodeJockey/Include
00072  * Slight modification made to popup menu code.
00073  *
00074  * *****************  Version 6  *****************
00075  * User: Kirk Stowell Date: 6/09/99    Time: 8:33p
00076  * Updated in $/CodeJockey/Include
00077  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00078  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00079  * message handler, this is now automatically handled by the base class.
00080  * Added redraw flags to the create method and modified paint and layout
00081  * handlers to reduce flicker and un-necessary command handling. Dragging
00082  * rect now reflects actual control bar docked size. Added "flat" look to
00083  * the control bars, the control bars can now use the classic DevStudio
00084  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00085  * docking windows now handle dragging, docking and floating much better,
00086  * and behave more like DevStudio.
00087  *
00088  * *****************  Version 5  *****************
00089  * User: Kirk Stowell Date: 5/02/99    Time: 2:18a
00090  * Updated in $/CodeJockey/Include
00091  *
00092  * *****************  Version 4  *****************
00093  * User: Kirk Stowell Date: 5/02/99    Time: 2:13a
00094  * Updated in $/CodeJockey/Include
00095  * Re-wrote CCJMenu initialization routines with a more cleaner approach.
00096  *
00097  * *****************  Version 3  *****************
00098  * User: Kirk Stowell Date: 4/03/99    Time: 4:47p
00099  * Updated in $/CodeJockey/Include
00100  * Added comments and cleaned up code.  Added support for Brent Corkum's
00101  * BCMenu (CCJMenu), which is a replacement for the CCoolMenu class.
00102  *
00103  * *****************  Version 2  *****************
00104  * User: Kirk Stowell Date: 1/12/99    Time: 4:46p
00105  * Updated in $/CodeJockey/Include
00106  * Total re-write to add side-by-side docking support for CCJControlBar
00107  * class.
00108  *
00109  * *****************  Version 1  *****************
00110  * User: Kirk Stowell Date: 10/17/98   Time: 4:46p
00111  * Created in $/CodeJockey/Include
00112  * Initial re-write and release.
00113  *
00114  ***************************************************************************/
00116
00117 #ifndef __CJFRAMEWND_H__
00118 #define __CJFRAMEWND_H__
00119
00120 #if _MSC_VER >= 1000
00121 #pragma once
00122 #endif // _MSC_VER >= 1000
00123
00124 #include "CJMenuBar.h"
00125 #include "CJMenu.h"
00126
00127 // class forwards
00128 class CCJSizeDockBar;
00129
00130 // CCJFrameWnd is a CFrameWnd derived class which is used to
00131 // reposition toolbar layout for 3D effect, in addition to docking
00132 // methods for CCJToolBar and CCJControlBar class
00133 class _CJX_EXT_CLASS CCJFrameWnd : public CFrameWnd
00134 {
00135     DECLARE_DYNCREATE(CCJFrameWnd)
00136
00137 public:
00138
00139     // Default constructor
00140     //
00141     CCJFrameWnd();
00142
00143     // Virtual destructor
00144     //
00145     virtual ~CCJFrameWnd();
00146
00147 protected:
00148
00149     static DWORD    dwDockBarMap[4][2]; // array used for docking masks
00150     CCJMenu         m_menu;             // SDI frame menu.
00151     CCJMenuBar      m_wndMenuBar;       // menu bar
00152
00153     // Yiannhs to parameterize and the dock bar border
00154     enum DockFlatBorders {
00155         brdrAllRaised       = 0x0000,
00156         brdrFlatTop         = 0x0001,
00157         brdrFlatBottom      = 0x0002,
00158         brdrFlatLeft        = 0x0004,
00159         brdrFlatRight       = 0x0008,
00160         brdrFlatVertical    = 0x0003,
00161         brdrFlatHorizontal  = 0x000C,
00162         brdrFlatAll         = 0x000F
00163     };
00164
00165 protected:
00166
00167     // this member function is called by the framework to associate
00168     // toolbar resources with the frame menu
00169     //
00170     virtual HMENU NewMenu(
00171         // resource id for menu
00172         UINT nMenuID,
00173         // array of toolbar resource ids
00174         UINT* nToolbarIDs = NULL,
00175         // size of array.
00176         int nSize = 0);
00177
00178     // this member function is called by the framework to associate
00179     // a toolbar resource with the frame menu
00180     //
00181     virtual HMENU NewMenu(
00182         // resource id for menu
00183         UINT nMenuID,
00184         // toolbar resource
00185         UINT nToolbarID = NULL);
00186
00187 public:
00188
00189     virtual void LoadBarState(LPCTSTR lpszProfileName);
00190     virtual void SaveBarState(LPCTSTR lpszProfileName) const;
00191
00192     // this member function is called to initialize the CCJMenu
00193     //
00194     virtual BOOL InitializeMenu(
00195         // resource id for menu
00196         UINT nMenuID,
00197         // array of toolbar resource ids
00198         UINT* nToolbarIDs = NULL,
00199         // size of array.
00200         int nSize = 0);
00201
00202     // this member function is called to initialize the Menu
00203     //
00204     virtual BOOL InitializeMenu(
00205         // resource id for menu
00206         UINT nMenuID,
00207         // toolbar resource
00208         UINT nToolbarID = NULL);
00209
00210     // this member function is called to calculate the size of
00211     // a CCJControlBar
00212     //
00213     virtual void RecalcAllExcept(CCJSizeDockBar *pBar);
00214
00215     // this member function enables docking for standard
00216     // toolbar and control bars
00217     //
00218     virtual void EnableDocking(DWORD dwDockStyle);
00219
00220     // this member function enables docking for CCJControl bars only
00221     //
00222     virtual void EnableDockingSizeBar(
00223         // Specifies which sides of the frame window can serve as docking sites
00224         // for control bars. It can be one or more of the following:
00225         //
00226         // CBRS_ALIGN_TOP   Allows docking at the top of the client area.
00227         // CBRS_ALIGN_BOTTOM   Allows docking at the bottom of the client area.
00228         // CBRS_ALIGN_LEFT   Allows docking on the left side of the client area.
00229         // CBRS_ALIGN_RIGHT   Allows docking on the right side of the client area.
00230         // CBRS_ALIGN_ANY   Allows docking on any side of the client area.
00231         DWORD dwDockStyle,
00232         // enum for flat border styles.
00233         DockFlatBorders FlatFlags = brdrAllRaised );
00234
00235     // this member function will dock a CCJControlBar
00236     //
00237     virtual void DockSizeBar(
00238         // toolbar to dock
00239         CControlBar* pBar,
00240         // dockbar object usually NULL
00241         CCJSizeDockBar* pDockBar=NULL,
00242         // initial size usually NULL
00243         LPRECT lpRect=NULL);
00244
00245     // this memeber function will dock the control bar passed in
00246     // as the first argument, and dock the control bar that is passed in
00247     // as the second argument to the left of the first one.
00248     //
00249     virtual void DockControlBarLeftOf(
00250         // control bar to dock to the right of
00251         CControlBar* Bar,
00252         // already docked control bar
00253         CControlBar* LeftOf);
00254
00255 // Overrides
00256     // ClassWizard generated virtual function overrides
00257     //{{AFX_VIRTUAL(CCJFrameWnd)
00258     public:
00259     virtual void RecalcLayout(BOOL bNotify = TRUE);
00260     virtual BOOL PreTranslateMessage(MSG* pMsg);
00261     protected:
00262     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00263     virtual BOOL PreCreateWindow(CREATESTRUCT& cs, UINT nIconID);
00264     //}}AFX_VIRTUAL
00265
00266 // Generated message map functions
00267 protected:
00268     //{{AFX_MSG(CCJFrameWnd)
00269     afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
00270     afx_msg LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu);
00271     afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
00272     afx_msg void OnClose();
00273     //}}AFX_MSG
00274     DECLARE_MESSAGE_MAP()
00275 };
00276
00278
00279 //{{AFX_INSERT_LOCATION}}
00280 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00281
00282 #endif // __CJFRAMEWND_H__
00283
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJHexEdit.h Source File

WinCvs/CJLib/Include/CJHexEdit.h

Go to the documentation of this file.
00001 // CJHexEdit.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the article "HexEdit Control" by Andreas Saurwein [saurwein@uniwares.com]
00006 // http://www.codeguru.com/editctrl/hexeditctrl.shtml
00007 //
00009 /****************************************************************************
00010  *
00011  * $Date: 1999/11/30 21:45:51 $
00012  * $Revision: 1.1.1.1 $
00013  * $Archive: /CodeJock/Include/CJHexEdit.h $
00014  *
00015  * $History: CJHexEdit.h $
00016  *
00017  * *****************  Version 1  *****************
00018  * User: Kirk Stowell Date: 10/30/99   Time: 9:20p
00019  * Created in $/CodeJock/Include
00020  *
00021  ***************************************************************************/
00023
00024 #ifndef __CJHEXEDIT_H__
00025 #define __CJHEXEDIT_H__
00026
00027 #if _MSC_VER >= 1000
00028 #pragma once
00029 #endif // _MSC_VER >= 1000
00030
00031 // CCJHexEdit is a CEdit derived class which allows editing in hex
00032 // display format.
00033 class _CJX_EXT_CLASS CCJHexEdit : public CEdit
00034 {
00035     DECLARE_DYNAMIC(CCJHexEdit)
00036
00037 // Construction
00038 public:
00039     CCJHexEdit();
00040
00041 // Attributes
00042 public:
00043
00044     enum EDITMODE{ EDIT_NONE, EDIT_ASCII, EDIT_HIGH, EDIT_LOW } ;
00045
00046     LPBYTE      m_pData;            // pointer to data
00047     int         m_length;           // length of data
00048     int         m_topindex;         // offset of first visible byte on screen
00049     int         m_currentAddress;   // address under cursor
00050     EDITMODE    m_currentMode;      // current editing mode: address/hex/ascii
00051     int         m_selStart;         // start address of selection
00052     int         m_selEnd;           // end address of selection
00053     int         m_bpr;              // byte per row
00054     int         m_lpp;              // lines per page
00055     BOOL        m_bShowAddress;
00056     BOOL        m_bShowAscii;
00057     BOOL        m_bShowHex;
00058     BOOL        m_bAddressIsWide;
00059     BOOL        m_bNoAddressChange; // internally used
00060     BOOL        m_bHalfPage;
00061     CFont       m_Font;
00062     int         m_lineHeight;
00063     int         m_nullWidth;
00064     BOOL        m_bUpdate;
00065     int         m_offHex;
00066     int         m_offAscii;
00067     int         m_offAddress;
00068     CPoint      m_editPos;
00069
00070 // Operations
00071 public:
00072
00073     virtual int     GetData(LPBYTE p, int len);
00074     virtual void    SetData(LPBYTE p, int len);
00075     virtual CSize   GetSel(void);
00076     virtual void    SetSel(int s, int e);
00077     virtual void    SetBPR(int bpr);
00078     virtual void    SetOptions(BOOL a, BOOL h, BOOL c, BOOL w);
00079
00080 protected:
00081
00082     virtual void    ScrollIntoView(int p);
00083     virtual void    RepositionCaret(int p);
00084     virtual void    Move(int x, int y);
00085     virtual BOOL    IsSelected(void);
00086     virtual void    UpdateScrollbars(void);
00087     virtual void    CreateEditCaret(void);
00088     virtual void    CreateAddressCaret(void);
00089     virtual CPoint  CalcPos(int x, int y);
00090     virtual void    SelInsert(int s, int l);
00091     virtual void    SelDelete(int s, int e);
00092     virtual void    NormalizeSel(void);
00093
00094 // Overrides
00095     // ClassWizard generated virtual function overrides
00096     //{{AFX_VIRTUAL(CCJHexEdit)
00097     public:
00098     virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
00099     protected:
00100     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00101     //}}AFX_VIRTUAL
00102
00103 // Implementation
00104 public:
00105     virtual ~CCJHexEdit();
00106
00107 // Generated message map functions
00108 protected:
00109     //{{AFX_MSG(CCJHexEdit)
00110     afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
00111     afx_msg void OnKillFocus(CWnd* pNewWnd);
00112     afx_msg void OnPaint();
00113     afx_msg void OnSetFocus(CWnd* pOldWnd);
00114     afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00115     afx_msg UINT OnGetDlgCode();
00116     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00117     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00118     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00119     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00120     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00121     afx_msg void OnEditClear();
00122     afx_msg void OnEditCopy();
00123     afx_msg void OnEditCut();
00124     afx_msg void OnEditPaste();
00125     afx_msg void OnEditSelectAll();
00126     afx_msg void OnEditUndo();
00127     afx_msg void OnContextMenu(CWnd*, CPoint point);
00128     afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00129     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00130     //}}AFX_MSG
00131     DECLARE_MESSAGE_MAP()
00132 };
00133
00135 //  Inline Functions
00137
00138 _CJXLIB_INLINE UINT CCJHexEdit::OnGetDlgCode()
00139     { return DLGC_WANTALLKEYS; }
00140
00141 _CJXLIB_INLINE void CCJHexEdit::SetOptions(BOOL a, BOOL h, BOOL c, BOOL w)
00142     { m_bShowHex = h; m_bShowAscii = c; m_bShowAddress = a; m_bAddressIsWide = w; m_bUpdate = TRUE; }
00143
00144 _CJXLIB_INLINE void CCJHexEdit::SetBPR(int bpr)
00145     { m_bpr = bpr; m_bUpdate = TRUE; }
00146
00147 _CJXLIB_INLINE BOOL CCJHexEdit::IsSelected()
00148     { return m_selStart != 0xffffffff; }
00149
00150 _CJXLIB_INLINE CSize CCJHexEdit::GetSel()
00151     { return CSize(m_selStart, m_selEnd); }
00152
00153 _CJXLIB_INLINE int CCJHexEdit::GetData(LPBYTE p, int len)
00154     { memcpy(p, m_pData, min(len, m_length)); return m_length; }
00155
00157
00158 //{{AFX_INSERT_LOCATION}}
00159 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00160
00161 #endif // __CJHEXEDIT_H__
00162
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJHtmlView.h Source File

WinCvs/CJLib/Include/CJHtmlView.h

Go to the documentation of this file.
00001 // CJHtmlView.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Iuri Apollonio's article 'Doc / View -
00007 // Using HtmlView apart from Tecno Preview' http://www.codeguru.com/doc_view/htmlview.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJock/Include/CJHtmlView.h $
00015  *
00016  * $History: CJHtmlView.h $
00017  *
00018  * *****************  Version 9  *****************
00019  * User: Kirk Stowell Date: 11/01/99   Time: 8:53p
00020  * Updated in $/CodeJock/Include
00021  *
00022  * *****************  Version 8  *****************
00023  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00024  * Updated in $/CodeJockey/Include
00025  * Updated copyright and contact information.
00026  *
00027  * *****************  Version 7  *****************
00028  * User: Kirk Stowell Date: 7/31/99    Time: 4:27p
00029  * Updated in $/CodeJockey/Include
00030  *
00031  * *****************  Version 5  *****************
00032  * User: Kirk Stowell Date: 7/25/99    Time: 1:29a
00033  * Updated in $/CodeJockey/Include
00034  *
00035  * *****************  Version 4  *****************
00036  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00037  * Updated in $/CodeJockey/Include
00038  *
00039  * *****************  Version 3  *****************
00040  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00041  * Updated in $/CodeJockey/Include
00042  *
00043  * *****************  Version 2  *****************
00044  * User: Kirk Stowell Date: 7/18/99    Time: 10:17p
00045  * Updated in $/CodeJockey/Include
00046  * Cleaned up inline functions, and import/export macro so that class will
00047  * be imported when linked to, and exported at compile time.
00048  *
00049  * *****************  Version 1  *****************
00050  * User: Kirk Stowell Date: 7/14/99    Time: 10:29p
00051  * Created in $/CodeJockey/Include
00052  * Copied from MFC v6 and techno preview for v5. Added to extend
00053  * functionality to Visual C++ 5.0 users.
00054  *
00055  ***************************************************************************/
00057
00058 #ifndef __CJHTMLVIEW_H__
00059 #define __CJHTMLVIEW_H__
00060
00061 #include <docobj.h>
00062 #include <shlobj.h>
00063 #include <exdisp.h>
00064 #include <afxconv.h>
00065
00066 #if _MSC_VER >= 1000
00067 #pragma once
00068 #endif // _MSC_VER >= 1000
00069
00070 // The CCJHtmlView class provides the functionality of the WebBrowser control
00071 // within the context of MFC's document/view architecture. The WebBrowser control
00072 // is a window in which the user can browse sites on the World Wide Web, as well
00073 // as folders in the local file system and on a network. The WebBrowser control
00074 // supports hyperlinking, Uniform Resource Locator (URL) navigation, and maintains
00075 // a history list.
00076 class _CJX_EXT_CLASS CCJHtmlView : public CFormView
00077 {
00078     DECLARE_DYNCREATE(CCJHtmlView)
00079     DECLARE_EVENTSINK_MAP()
00080
00081 protected: // create from serialization only
00082
00083     CCJHtmlView();
00084
00085     virtual ~CCJHtmlView();
00086
00087 // Attributes
00088 public:
00089
00090     CString GetType() const;
00091     long GetLeft() const;
00092     void SetLeft(long nNewValue);
00093     long GetTop() const;
00094     void SetTop(long nNewValue);
00095     long GetHeight() const;
00096     void SetHeight(long nNewValue);
00097     void SetVisible(BOOL bNewValue);
00098     BOOL GetVisible() const;
00099     CString GetLocationName() const;
00100     READYSTATE GetReadyState() const;
00101     BOOL GetOffline() const;
00102     void SetOffline(BOOL bNewValue);
00103     BOOL GetSilent() const;
00104     void SetSilent(BOOL bNewValue);
00105     BOOL GetTopLevelContainer() const;
00106     CString GetLocationURL() const;
00107     BOOL GetBusy() const;
00108     LPDISPATCH GetApplication() const;
00109     LPDISPATCH GetParentBrowser() const;
00110     LPDISPATCH GetContainer() const;
00111     LPDISPATCH GetHtmlDocument() const;
00112     CString GetFullName() const;
00113     int GetToolBar() const;
00114     void SetToolBar(int nNewValue);
00115     BOOL GetMenuBar() const;
00116     void SetMenuBar(BOOL bNewValue);
00117     BOOL GetFullScreen() const;
00118     void SetFullScreen(BOOL bNewValue);
00119     OLECMDF QueryStatusWB(OLECMDID cmdID) const;
00120     BOOL GetRegisterAsBrowser() const;
00121     void SetRegisterAsBrowser(BOOL bNewValue);
00122     BOOL GetRegisterAsDropTarget() const;
00123     void SetRegisterAsDropTarget(BOOL bNewValue);
00124     BOOL GetTheaterMode() const;
00125     void SetTheaterMode(BOOL bNewValue);
00126     BOOL GetAddressBar() const;
00127     void SetAddressBar(BOOL bNewValue);
00128     BOOL GetStatusBar() const;
00129     void SetStatusBar(BOOL bNewValue);
00130
00131 // Operations
00132 public:
00133
00134     void GoBack();
00135     void GoForward();
00136     void GoHome();
00137     void GoSearch();
00138     void Navigate(LPCTSTR URL, DWORD dwFlags = 0,
00139         LPCTSTR lpszTargetFrameName = NULL,
00140         LPCTSTR lpszHeaders = NULL, LPVOID lpvPostData = NULL,
00141         DWORD dwPostDataLen = 0);
00142     void Navigate2(LPITEMIDLIST pIDL, DWORD dwFlags = 0,
00143         LPCTSTR lpszTargetFrameName = NULL);
00144     void Navigate2(LPCTSTR lpszURL, DWORD dwFlags = 0,
00145         LPCTSTR lpszTargetFrameName = NULL, LPCTSTR lpszHeaders = NULL,
00146         LPVOID lpvPostData = NULL, DWORD dwPostDataLen = 0);
00147     void Navigate2(LPCTSTR lpszURL, DWORD dwFlags,
00148         CByteArray& baPostedData,
00149         LPCTSTR lpszTargetFrameName = NULL, LPCTSTR lpszHeader = NULL);
00150     void Refresh();
00151     void Refresh2(int nLevel);
00152     void Stop();
00153     void PutProperty(LPCTSTR lpszProperty, const VARIANT& vtValue);
00154     void PutProperty(LPCTSTR lpszPropertyName, double dValue);
00155     void PutProperty(LPCTSTR lpszPropertyName, LPCTSTR lpszValue);
00156     void PutProperty(LPCTSTR lpszPropertyName, long lValue);
00157     void PutProperty(LPCTSTR lpszPropertyName, short nValue);
00158     BOOL GetProperty(LPCTSTR lpszProperty, CString& strValue);
00159     COleVariant GetProperty(LPCTSTR lpszProperty);
00160     void ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt, VARIANT* pvaIn,
00161         VARIANT* pvaOut);
00162     BOOL LoadFromResource(LPCTSTR lpszResource);
00163     BOOL LoadFromResource(UINT nRes);
00164
00165 // Overrides
00166 public:
00167
00168     // ClassWizard generated virtual function overrides
00169     //{{AFX_VIRTUAL(CCJHtmlView)
00170     public:
00171     virtual void OnDraw(CDC* pDC);
00172     virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
00173     virtual void OnNavigateComplete2(LPCTSTR strURL);
00174     virtual void OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel);
00175     virtual void OnStatusTextChange(LPCTSTR lpszText);
00176     virtual void OnProgressChange(long nProgress, long nProgressMax);
00177     virtual void OnCommandStateChange(long nCommand, BOOL bEnable);
00178     virtual void OnDownloadBegin();
00179     virtual void OnDownloadComplete();
00180     virtual void OnTitleChange(LPCTSTR lpszText);
00181     virtual void OnPropertyChange(LPCTSTR lpszProperty);
00182     virtual void OnNewWindow2(LPDISPATCH* ppDisp, BOOL* Cancel);
00183     virtual void OnDocumentComplete(LPCTSTR lpszURL);
00184     virtual void OnQuit();
00185     virtual void OnVisible(BOOL bVisible);
00186     virtual void OnToolBar(BOOL bToolBar);
00187     virtual void OnMenuBar(BOOL bMenuBar);
00188     virtual void OnStatusBar(BOOL bStatusBar);
00189     virtual void OnFullScreen(BOOL bFullScreen);
00190     virtual void OnTheaterMode(BOOL bTheaterMode);
00191     protected:
00192     virtual void NavigateComplete2(LPDISPATCH pDisp, VARIANT* URL);
00193     virtual void BeforeNavigate2(LPDISPATCH pDisp, VARIANT* URL, VARIANT* Flags, VARIANT* TargetFrameName, VARIANT* PostData, VARIANT* Headers,   BOOL* Cancel);
00194     virtual void DocumentComplete(LPDISPATCH pDisp, VARIANT* URL);
00195     //}}AFX_VIRTUAL
00196
00197 // Implementation
00198 public:
00199
00200     CWnd m_wndBrowser;
00201
00202 #ifdef _DEBUG
00203     virtual void AssertValid() const;
00204     virtual void Dump(CDumpContext& dc) const;
00205 #endif
00206
00207 protected:
00208
00209     IWebBrowser2* m_pBrowserApp;
00210
00211 // Generated message map functions
00212 protected:
00213     //{{AFX_MSG(CCJHtmlView)
00214     afx_msg void OnSize(UINT nType, int cx, int cy);
00215     afx_msg void OnPaint();
00216     afx_msg void OnDestroy();
00217     afx_msg void OnFilePrint();
00218     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00219     //}}AFX_MSG
00220     DECLARE_MESSAGE_MAP()
00221 };
00222
00224 // Inline functions
00226
00227 _CJXLIB_INLINE void CCJHtmlView::SetRegisterAsBrowser(BOOL bNewValue)
00228     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_RegisterAsBrowser((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }
00229
00230 _CJXLIB_INLINE void CCJHtmlView::SetRegisterAsDropTarget(BOOL bNewValue)
00231     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_RegisterAsDropTarget((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }
00232
00233 _CJXLIB_INLINE void CCJHtmlView::SetTheaterMode(BOOL bNewValue)
00234     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_TheaterMode((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }
00235
00236 _CJXLIB_INLINE void CCJHtmlView::SetVisible(BOOL bNewValue)
00237     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Visible((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }
00238
00239 _CJXLIB_INLINE void CCJHtmlView::SetMenuBar(BOOL bNewValue)
00240     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_MenuBar((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }
00241
00242 _CJXLIB_INLINE void CCJHtmlView::SetToolBar(int nNewValue)
00243     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_ToolBar(nNewValue); }
00244
00245 _CJXLIB_INLINE void CCJHtmlView::SetOffline(BOOL bNewValue)
00246     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Offline((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }
00247
00248 _CJXLIB_INLINE void CCJHtmlView::SetSilent(BOOL bNewValue)
00249     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Silent((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }
00250
00251 _CJXLIB_INLINE void CCJHtmlView::GoBack()
00252     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->GoBack(); }
00253
00254 _CJXLIB_INLINE void CCJHtmlView::GoForward()
00255     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->GoForward(); }
00256
00257 _CJXLIB_INLINE void CCJHtmlView::GoHome()
00258     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->GoHome(); }
00259
00260 _CJXLIB_INLINE void CCJHtmlView::GoSearch()
00261     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->GoSearch(); }
00262
00263 _CJXLIB_INLINE void CCJHtmlView::Refresh()
00264     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->Refresh(); }
00265
00266 _CJXLIB_INLINE void CCJHtmlView::Refresh2(int nLevel)
00267     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->Refresh2(COleVariant((long) nLevel, VT_I4)); }
00268
00269 _CJXLIB_INLINE void CCJHtmlView::Stop()
00270     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->Stop(); }
00271
00272 _CJXLIB_INLINE void CCJHtmlView::SetFullScreen(BOOL bNewValue)
00273     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_FullScreen((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }
00274
00275 _CJXLIB_INLINE void CCJHtmlView::SetAddressBar(BOOL bNewValue)
00276     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_AddressBar((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }
00277
00278 _CJXLIB_INLINE void CCJHtmlView::SetHeight(long nNewValue)
00279     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Height(nNewValue); }
00280
00281 _CJXLIB_INLINE void CCJHtmlView::PutProperty(LPCTSTR lpszPropertyName, long lValue)
00282     { ASSERT(m_pBrowserApp != NULL); ASSERT(m_pBrowserApp != NULL); PutProperty(lpszPropertyName, COleVariant(lValue, VT_UI4)); }
00283
00284 _CJXLIB_INLINE void CCJHtmlView::PutProperty(LPCTSTR lpszPropertyName, short nValue)
00285     { ASSERT(m_pBrowserApp != NULL); ASSERT(m_pBrowserApp != NULL); PutProperty(lpszPropertyName, COleVariant(nValue, VT_UI2)); }
00286
00287 _CJXLIB_INLINE void CCJHtmlView::PutProperty(LPCTSTR lpszPropertyName, LPCTSTR lpszValue)
00288     { ASSERT(m_pBrowserApp != NULL); ASSERT(m_pBrowserApp != NULL); PutProperty(lpszPropertyName, COleVariant(lpszValue, VT_BSTR)); }
00289
00290 _CJXLIB_INLINE void CCJHtmlView::PutProperty(LPCTSTR lpszPropertyName, double dValue)
00291     { ASSERT(m_pBrowserApp != NULL); ASSERT(m_pBrowserApp != NULL); PutProperty(lpszPropertyName, COleVariant(dValue)); }
00292
00293 _CJXLIB_INLINE void CCJHtmlView::SetTop(long nNewValue)
00294     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Top(nNewValue); }
00295
00296 _CJXLIB_INLINE void CCJHtmlView::SetLeft(long nNewValue)
00297     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Left(nNewValue); }
00298
00299 _CJXLIB_INLINE void CCJHtmlView::SetStatusBar(BOOL bNewValue)
00300     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_StatusBar((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }
00301
00303
00304 //{{AFX_INSERT_LOCATION}}
00305 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00306
00307 #endif // __CJHTMLVIEW_H__
00308
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJHyperLink.h Source File

WinCvs/CJLib/Include/CJHyperLink.h

Go to the documentation of this file.
00001 // CJHyperLink.h : header file
00002 //
00003 //
00004 // CJHyperLink static control. Will open the default browser with the given URL
00005 // when the user clicks on the link.
00006 //
00007 // Copyright Chris Maunder, 1997
00008 // Feel free to use and distribute. May not be sold for profit.
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.2 $
00014  * $Archive: /CodeJock/Include/CJHyperLink.h $
00015  *
00016  * $History: CJHyperLink.h $
00017  *
00018  * *****************  Version 6  *****************
00019  * User: Kirk Stowell Date: 10/26/99   Time: 10:42p
00020  * Updated in $/CodeJock/Include
00021  * Made class methods virtual for inheritance purposes.
00022  *
00023  * *****************  Version 5  *****************
00024  * User: Kirk Stowell Date: 10/14/99   Time: 12:26p
00025  * Updated in $/CodeJock/Include
00026  * Added source control history to file header.
00027  *
00028  ***************************************************************************/
00030
00031 #ifndef __CJHYPERLINK_H__
00032 #define __CJHYPERLINK_H__
00033
00034 #if _MSC_VER >= 1000
00035 #pragma once
00036 #endif // _MSC_VER >= 1000
00037
00038 // A CStatic derived classc will open the default browser with the
00039 // given URL when the user clicks on the link.
00040 class _CJX_EXT_CLASS CCJHyperLink : public CStatic
00041 {
00042 // Construction/destruction
00043 public:
00044     CCJHyperLink();
00045     virtual ~CCJHyperLink();
00046
00047 // Attributes
00048 public:
00049
00050 // Operations
00051 public:
00052
00053     virtual void SetURL(CString strURL);
00054     virtual CString GetURL() const;
00055
00056     virtual void SetColors(COLORREF crLinkColor, COLORREF crVisitedColor,
00057                     COLORREF crHoverColor = -1);
00058     virtual COLORREF GetLinkColor() const;
00059     virtual COLORREF GetVisitedColor() const;
00060     virtual COLORREF GetHoverColor() const;
00061
00062     virtual void SetVisited(BOOL bVisited = TRUE);
00063     virtual BOOL GetVisited() const;
00064
00065     virtual void SetLinkCursor(HCURSOR hCursor);
00066     virtual HCURSOR GetLinkCursor() const;
00067
00068     virtual void SetUnderline(BOOL bUnderline = TRUE);
00069     virtual BOOL GetUnderline() const;
00070
00071     virtual void SetAutoSize(BOOL bAutoSize = TRUE);
00072     virtual BOOL GetAutoSize() const;
00073
00074     virtual HINSTANCE GotoURL(LPCTSTR url, int showcmd);
00075
00076 // Overrides
00077     // ClassWizard generated virtual function overrides
00078     //{{AFX_VIRTUAL(CCJHyperLink)
00079     public:
00080     virtual BOOL PreTranslateMessage(MSG* pMsg);
00081     protected:
00082     virtual void PreSubclassWindow();
00083     //}}AFX_VIRTUAL
00084
00085 // Implementation
00086 protected:
00087     virtual void ReportError(int nError);
00088     virtual LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
00089     virtual void PositionWindow();
00090     virtual void SetDefaultCursor();
00091
00092 // Protected attributes
00093 protected:
00094     COLORREF m_crLinkColor, m_crVisitedColor;     // Hyperlink Colors
00095     COLORREF m_crHoverColor;                       // Hover Color
00096     BOOL     m_bOverControl;                        // cursor over control?
00097     BOOL     m_bVisited;                            // Has it been visited?
00098     BOOL     m_bUnderline;                          // underline hyperlink?
00099     BOOL     m_bAdjustToFit;                        // Adjust window size to fit text?
00100     CString  m_strURL;                              // hyperlink URL
00101     CFont    m_Font;                                // Underline font if necessary
00102     HCURSOR  m_hLinkCursor;                         // Cursor for hyperlink
00103     CToolTipCtrl m_ToolTip;                         // The tooltip
00104
00105     // Generated message map functions
00106 protected:
00107     //{{AFX_MSG(CCJHyperLink)
00108     afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
00109     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00110     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00111     //}}AFX_MSG
00112     afx_msg void OnClicked();
00113     DECLARE_MESSAGE_MAP()
00114 };
00115
00117
00118 //{{AFX_INSERT_LOCATION}}
00119 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00120
00121 #endif // __CJHYPERLINK_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJLibrary.h Source File

WinCvs/CJLib/Include/CJLibrary.h

Go to the documentation of this file.
00001 // CJLibrary.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJLibrary.h $
00011  *
00012  * $History: CJLibrary.h $
00013  *
00014  * *****************  Version 15  *****************
00015  * User: Kirk Stowell Date: 10/30/99   Time: 9:39p
00016  * Updated in $/CodeJock/Include
00017  * Added includes for CJHexEdit and CJListBox.
00018  *
00019  * *****************  Version 14  *****************
00020  * User: Kirk Stowell Date: 10/26/99   Time: 10:57p
00021  * Updated in $/CodeJock/Include
00022  * Added includes for CCJMemFile, CCJStatusBar and CCJLogoPane.
00023  *
00024  * *****************  Version 13  *****************
00025  * User: Kirk Stowell Date: 10/14/99   Time: 7:22p
00026  * Updated in $/CodeJock/Include
00027  * Updated for 6.09 release.
00028  *
00029  * *****************  Version 12  *****************
00030  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00031  * Updated in $/CodeJockey/Include
00032  * Updated copyright and contact information.
00033  *
00034  * *****************  Version 11  *****************
00035  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00036  * Updated in $/CodeJockey/Include
00037  * Added Unicode compliance, thanks to Barry Burton for his help with
00038  * this.
00039  *
00040  *
00041  * *****************  Version 9  *****************
00042  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00043  * Updated in $/CodeJockey/Include
00044  *
00045  * *****************  Version 8  *****************
00046  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00047  * Updated in $/CodeJockey/Include
00048  *
00049  * *****************  Version 7  *****************
00050  * User: Kirk Stowell Date: 7/25/99    Time: 12:15a
00051  * Updated in $/CodeJockey/Include
00052  *
00053  * *****************  Version 6  *****************
00054  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00055  * Updated in $/CodeJockey/Include
00056  *
00057  * *****************  Version 5  *****************
00058  * User: Kirk Stowell Date: 7/18/99    Time: 10:19p
00059  * Updated in $/CodeJockey/Include
00060  * Cleaned up import/export macro so that class will be imported when
00061  * linked to, and exported at compile time.
00062  *
00063  * *****************  Version 4  *****************
00064  * User: Kirk Stowell Date: 7/14/99    Time: 10:18p
00065  * Updated in $/CodeJockey/Include
00066  * Added additional class header files.
00067  *
00068  * *****************  Version 3  *****************
00069  * User: Kirk Stowell Date: 6/26/99    Time: 8:32p
00070  * Updated in $/CodeJockey/Include
00071  * Added include for class CCJMDIChildWnd.
00072  *
00073  * *****************  Version 2  *****************
00074  * User: Kirk Stowell Date: 6/25/99    Time: 12:04p
00075  * Updated in $/CodeJockey/Include
00076  * Newly added file which supports CJLibrary includes for both Visual C++
00077  * 5 and 6
00078  *
00079  ***************************************************************************/
00081
00082 #ifndef __CJLIBRARY_H__
00083 #define __CJLIBRARY_H__
00084
00085 #if _MSC_VER >= 1000
00086 #pragma once
00087 #endif // _MSC_VER >= 1000
00088
00089 #if _MSC_VER < 1200
00090 #define _VC_VERSION_5
00091 #endif
00092
00093 #ifndef _CJX_EXT_CLASS
00094 #ifdef _AFXDLL
00095 #define _CJX_EXT_CLASS  AFX_CLASS_IMPORT // Always import CJLibrary files...
00096 #else
00097 #define _CJX_EXT_CLASS  // not used with static builds.
00098 #endif
00099 #endif // _CJX_EXT_CLASS
00100
00101 #ifndef _CJXLIB_INLINE
00102 #define _CJXLIB_INLINE inline
00103 #endif // _CJXLIB_INLINE
00104
00105 #ifndef __AFXTEMPL_H__
00106 #include <afxtempl.h>
00107 #endif
00108
00109 #ifndef __AFXPRIV_H__
00110 #include <afxpriv.h>
00111 #endif
00112
00113 #include <..\src\afximpl.h>
00114
00115 #ifndef __CJBROWSEEDIT_H__
00116 #include "CJBrowseEdit.h"
00117 #endif
00118
00119 #ifndef __CJCAPTION_H__
00120 #include "CJCaption.h"
00121 #endif
00122
00123 #ifndef __CJCAPTIONPOPUPWND_H__
00124 #include "CJCaptionPopupWnd.h"
00125 #endif
00126
00127 #ifndef __CJCOLORPICKER_H__
00128 #include "CJColorPicker.h"
00129 #endif
00130
00131 #ifndef __CJCOLORPOPUP_H__
00132 #include "CJColorPopup.h"
00133 #endif
00134
00135 #ifndef __CJCOMBOBOXEX_H__
00136 #include "CJComboBoxEx.h"
00137 #endif
00138
00139 #ifndef __CJCONTROLBAR_H__
00140 #include "CJControlBar.h"
00141 #endif
00142
00143 #ifndef __CJDATETIMECTRL_H__
00144 #include "CJDateTimeCtrl.h"
00145 #endif
00146
00147 #ifndef __CJDOCKBAR_H__
00148 #include "CJDockBar.h"
00149 #endif
00150
00151 #ifndef __CJDOCKCONTEXT_H__
00152 #include "CJDockContext.h"
00153 #endif
00154
00155 #ifndef __CJEXPLORERBAR_H__
00156 #include "CJExplorerBar.h"
00157 #endif
00158
00159 #ifndef __CJFLATBUTTON_H__
00160 #include "CJFlatButton.h"
00161 #endif
00162
00163 #ifndef __CJFLATCOMBOBOX_H__
00164 #include "CJFlatComboBox.h"
00165 #endif
00166
00167 #ifndef __CJFLATHEADERCTRL_H__
00168 #include "CJFlatHeaderCtrl.h"
00169 #endif
00170
00171 #ifndef __CJFLATSPLITTERWND_H__
00172 #include "CJFlatSplitterWnd.h"
00173 #endif
00174
00175 #ifndef __CCJFLATTABCTRL_H__
00176 #include "CJFlatTabCtrl.h"
00177 #endif
00178
00179 #ifndef __CJFONTCOMBO_H__
00180 #include "CJFontCombo.h"
00181 #endif
00182
00183 #ifndef __CJFRAMEWND_H__
00184 #include "CJFrameWnd.h"
00185 #endif
00186
00187 #ifndef __CJHEXEDIT_H__
00188 #include "CJHexEdit.h"
00189 #endif
00190
00191 #ifndef __CJHTMLVIEW_H__
00192 #include "CJHtmlView.h"
00193 #endif
00194
00195 #ifndef __CJHYPERLINK_H__
00196 #include "CJHyperLink.h"
00197 #endif
00198
00199 #ifndef __CJLISTBOX_H__
00200 #include "CJListBox.h"
00201 #endif
00202
00203 #ifndef __CJLISTCTRL_H__
00204 #include "CJListCtrl.h"
00205 #endif
00206
00207 #ifndef __CJLISTVIEW_H__
00208 #include "CJListView.h"
00209 #endif
00210
00211 #ifndef __CJLOGOPANE_H__
00212 #include "CJLogoPane.h"
00213 #endif
00214
00215 #ifndef __CJMASKEDIT_H__
00216 #include "CJMaskEdit.h"
00217 #endif
00218
00219 #ifndef __CJMDICHILDWND_H__
00220 #include "CJMDIChildWnd.h"
00221 #endif
00222
00223 #ifndef __CJMDIFRAMEWND_H__
00224 #include "CJMDIFrameWnd.h"
00225 #endif
00226
00227 #ifndef __CJMEMFILE_H__
00228 #include "CJMemFile.h"
00229 #endif
00230
00231 #ifndef __CJMENU_H__
00232 #include "CJMenu.h"        // CCJMenu class declaration
00233 #endif
00234
00235 #ifndef __CJMENUBAR_H__
00236 #include "CJMenuBar.h"
00237 #endif
00238
00239 #ifndef __CJMETAFILEBUTTON_H__
00240 #include "CJMetaFileButton.h"
00241 #endif
00242
00243 #ifndef __CJMINIDOCKFRAMEWND_H__
00244 #include "CJMiniDockFrameWnd.h"
00245 #endif
00246
00247 #ifndef __CJOUTLOOKBAR_H__
00248 #include "CJOutlookBar.h"
00249 #endif
00250
00251 #ifndef __CJPAGERCTRL_H__
00252 #include "CJPagerCtrl.h"
00253 #endif
00254
00255 #ifndef __CJREBAR_H__
00256 #include "CJReBar.h"
00257 #endif
00258
00259 #ifndef __CJREBARCTRL_H__
00260 #include "CJReBarCtrl.h"
00261 #endif
00262
00263 #ifndef __CJSHELL_H__
00264 #include "CJShell.h"
00265 #endif
00266
00267 #ifndef __CJSHELLLIST_H__
00268 #include "CJShellList.h"
00269 #endif
00270
00271 #ifndef __CJSHELLTREE_H__
00272 #include "CJShellTree.h"
00273 #endif
00274
00275 #ifndef __CJSIZEDOCKBAR_H__
00276 #include "CJSizeDockBar.h"
00277 #endif
00278
00279 #ifndef __CJSORTCLASS_H__
00280 #include "CJSortClass.h"
00281 #endif
00282
00283 #ifndef __CJSTATUSBAR_H__
00284 #include "CJStatusBar.h"
00285 #endif
00286
00287 #ifndef __CJTABCTRL_H__
00288 #include "CJTabCtrl.h"
00289 #endif
00290
00291 #ifndef __CJTABCTRLBAR_H__
00292 #include "CJTabCtrlBar.h"
00293 #endif
00294
00295 #ifndef __CJTABVIEW_H__
00296 #include "CJTabView.h"
00297 #endif
00298
00299 #ifndef __CJTOOLBAR_H__
00300 #include "CJToolBar.h"
00301 #endif
00302
00303 #ifndef __CCJTOOLBARBASE_H__
00304 #include "CJToolBarBase.h"
00305 #endif
00306
00307 #ifndef __CJTOOLBARCTRL_H__
00308 #include "CJToolBarCtrl.h"
00309 #endif
00310
00311 #ifndef __CJTREECTRL_H__
00312 #include "CJTreeCtrl.h"
00313 #endif
00314
00315 #ifndef __CJWINDOWPLACEMENT_H__
00316 #include "CJWindowPlacement.h"
00317 #endif
00318
00319 #ifndef __GFXGROUPEDIT_H__
00320 #include "GfxGroupEdit.h"
00321 #endif
00322
00323 #ifndef __GFXOUTBARCTRL_H__
00324 #include "GfxOutBarCtrl.h"
00325 #endif
00326
00327 #ifndef __GFXSPLITTERWND_H__
00328 #include "GfxSplitterWnd.h"
00329 #endif
00330
00331 #define _delete(p){if(p){delete p;p=NULL;}}
00332
00333 #ifdef _AFXDLL
00334     #ifdef _DEBUG
00335         #if defined(_UNICODE)
00336             #define _CJX_COMMENT "CJ609Libud.lib"
00337             #define _CJX_MESSAGE "Automatically linking with CJ609Libud.dll"
00338         #else
00339             #define _CJX_COMMENT "CJ609Libd.lib"
00340             #define _CJX_MESSAGE "Automatically linking with CJ609Libd.dll"
00341         #endif
00342     #else
00343         #if defined(_UNICODE)
00344             #define _CJX_COMMENT "CJ609Libu.lib"
00345             #define _CJX_MESSAGE "Automatically linking with CJ609Libu.dll"
00346         #else
00347             #define _CJX_COMMENT "CJ609Lib.lib"
00348             #define _CJX_MESSAGE "Automatically linking with CJ609Lib.dll"
00349         #endif
00350     #endif
00351 #else
00352     #ifdef _DEBUG
00353         #if defined(_UNICODE)
00354             #define _CJX_COMMENT "CJ609LibStaticud.lib"
00355             #define _CJX_MESSAGE "Automatically linking with CJ609LibStaticud.lib"
00356         #else
00357             #define _CJX_COMMENT "CJ609LibStaticd.lib"
00358             #define _CJX_MESSAGE "Automatically linking with CJ609LibStaticd.lib"
00359         #endif
00360     #else
00361         #if defined(_UNICODE)
00362             #define _CJX_COMMENT "CJ609LibStaticu.lib"
00363             #define _CJX_MESSAGE "Automatically linking with CJ609LibStaticu.lib"
00364         #else
00365             #define _CJX_COMMENT "CJ609LibStatic.lib"
00366             #define _CJX_MESSAGE "Automatically linking with CJ609LibStatic.lib"
00367         #endif
00368     #endif
00369 #endif
00370
00371 #pragma comment(lib, _CJX_COMMENT)
00372 #pragma message(_CJX_MESSAGE)
00373
00374 #endif // __CJLIBRARY_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJListBox.h Source File

WinCvs/CJLib/Include/CJListBox.h

Go to the documentation of this file.
00001 // CJListBox.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.1 $
00010  * $Archive: /CodeJock/Include/CJListBox.h $
00011  *
00012  * $History: CJListBox.h $
00013  *
00014  * *****************  Version 1  *****************
00015  * User: Kirk Stowell Date: 10/30/99   Time: 9:36p
00016  * Created in $/CodeJock/Include
00017  *
00018  ***************************************************************************/
00020
00021 #ifndef __CJLISTBOX_H__
00022 #define __CJLISTBOX_H__
00023
00024 #if _MSC_VER >= 1000
00025 #pragma once
00026 #endif // _MSC_VER >= 1000
00027
00028 // CCJListBox is a CListBox derived class which creates a
00029 // flicker free listbox control.
00030 class _CJX_EXT_CLASS CCJListBox : public CListBox
00031 {
00032     DECLARE_DYNAMIC(CCJListBox)
00033
00034 // Construction
00035 public:
00036     CCJListBox();
00037
00038 // Attributes
00039 public:
00040
00041 // Operations
00042 public:
00043
00044 // Overrides
00045     // ClassWizard generated virtual function overrides
00046     //{{AFX_VIRTUAL(CCJListBox)
00047     //}}AFX_VIRTUAL
00048
00049 // Implementation
00050 public:
00051     virtual ~CCJListBox();
00052
00053 // Generated message map functions
00054 protected:
00055     //{{AFX_MSG(CCJListBox)
00056     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00057     afx_msg void OnPaint();
00058     //}}AFX_MSG
00059     DECLARE_MESSAGE_MAP()
00060 };
00061
00063
00064 //{{AFX_INSERT_LOCATION}}
00065 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00066
00067 #endif // __CJLISTBOX_H__
00068
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJListCtrl.h Source File

WinCvs/CJLib/Include/CJListCtrl.h

Go to the documentation of this file.
00001 // CJListCtrl.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the CListView articles from http://www.codeguru.com/listview
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:51 $
00011  * $Revision: 1.1.1.2 $
00012  * $Archive: /CodeJock/Include/CJListCtrl.h $
00013  *
00014  * $History: CJListCtrl.h $
00015  *
00016  * *****************  Version 10  *****************
00017  * User: Kirk Stowell Date: 10/30/99   Time: 7:13p
00018  * Updated in $/CodeJock/Include
00019  * Made m_bAscending protected rather than private for access in derived
00020  * classes.
00021  *
00022  * *****************  Version 9  *****************
00023  * User: Kirk Stowell Date: 10/30/99   Time: 2:22p
00024  * Updated in $/CodeJock/Include
00025  * Overrode OnPaint() and  OnEraseBkgnd(...) for flicker free drawing.
00026  *
00027  * *****************  Version 8  *****************
00028  * User: Kirk Stowell Date: 10/26/99   Time: 10:42p
00029  * Updated in $/CodeJock/Include
00030  * Made class methods virtual for inheritance purposes.
00031  *
00032  * *****************  Version 7  *****************
00033  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00034  * Updated in $/CodeJockey/Include
00035  *
00036  * *****************  Version 6  *****************
00037  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00038  * Updated in $/CodeJockey/Include
00039  *
00040  * *****************  Version 5  *****************
00041  * User: Kirk Stowell Date: 7/18/99    Time: 10:14p
00042  * Updated in $/CodeJockey/Include
00043  * Cleaned up inline functions, and import/export macro so that class will
00044  * be imported when linked to, and exported at compile time.
00045  *
00046  * *****************  Version 4  *****************
00047  * User: Kirk Stowell Date: 6/12/99    Time: 3:15a
00048  * Updated in $/CodeJockey/Include
00049  * Cleaned up initialization, sorting and column info saving. Removed sort
00050  * functions, which were replaced with the virtual function SortList(...).
00051  * Override this function in your derived class to perform custom sorting.
00052  * See CCJShellList for an implementation of this virtual function.
00053  *
00054  * *****************  Version 3  *****************
00055  * User: Kirk Stowell Date: 4/03/99    Time: 8:38p
00056  * Updated in $/CodeJockey/Include
00057  * Added comments and cleaned up code.
00058  *
00059  * *****************  Version 2  *****************
00060  * User: Kirk Stowell Date: 3/03/99    Time: 8:37p
00061  * Updated in $/CodeJockey/Include
00062  * Added InitializeFlatHeader() in order to initialize the list control
00063  * manually.
00064  *
00065  * *****************  Version 1  *****************
00066  * User: Kirk Stowell Date: 1/16/99    Time: 8:37p
00067  * Created in $/CodeJockey/Include
00068  * Initial release.
00069  *
00070  ***************************************************************************/
00072
00073 #ifndef __CJLISTCTRL_H__
00074 #define __CJLISTCTRL_H__
00075
00076 #if _MSC_VER > 1000
00077 #pragma once
00078 #endif // _MSC_VER > 1000
00079
00080 class CCJFlatHeaderCtrl;
00081
00082 // CCJListCtrl is a CListCtrl derived class which implements a
00083 // flat header and generic sorting routines.
00084 class _CJX_EXT_CLASS CCJListCtrl : public CListCtrl
00085 {
00086     DECLARE_DYNAMIC(CCJListCtrl)
00087
00088 public:
00089
00090     // Default constructor
00091     //
00092     CCJListCtrl();
00093
00094     // Virtual destructor
00095     //
00096     virtual ~CCJListCtrl();
00097
00098 protected:
00099
00100     int                 m_nMinColWidth;     // minimum width for columns
00101     int                 m_nMaxColWidth;     // maximum width for columns
00102     int                 m_nSortedCol;       // index of currently selected column
00103     CCJFlatHeaderCtrl*  m_pHeaderCtrl;      // points to subclassed flat header control.
00104     CString             m_strSection;       // registry section name.
00105     CString             m_strEntry;         // registry entry name.
00106     CString             m_strDefault;       // registry default value.
00107     CListCtrl*          m_pListCtrl;        // points to the list control associated with this view.
00108     COLORREF            m_clrText;          // RGB value for row text color.
00109     COLORREF            m_clrTextBk;        // RGB value for row text background color.
00110     bool                m_bNoColSizing;     // if true, column sizing is disabled.
00111     int                 m_nMinSize;         // if set, columns will have a minimum size requirement.
00112     bool                m_bAscending;       // flag to determine sorting order
00113
00114 private:
00115
00116     bool                m_bAutoSave;        // true if saving column widths.
00117
00118 // Operations
00119 public:
00120
00121     // this member function will return the column width stored in the registry.
00122     //
00123     virtual int GetStoredWidth(int nCol);
00124
00125     // this member function will automatically size a given column.
00126     //
00127     virtual void AutoSizeColumn(int nCol=-1);
00128
00129     // this member function will set the column width from the
00130     // registry settings.
00131     //
00132     virtual void SetColumnWidth(int nCol);
00133
00134     // this member function loads column widths from the registry.
00135     //
00136     virtual void LoadColumnWidths();
00137
00138     // this member function saves column widths to the registry.
00139     //
00140     virtual void SaveColumnWidths();
00141
00142     // this member function will initialize the autosave feature. If called
00143     // column widths will be saved to system registry when the list control
00144     // window is destroyed.
00145     //
00146     virtual void AutoSaveColumns(
00147         // registry section name, if NULL the default is "Settings".
00148         LPCTSTR lpszSection=NULL,
00149         // registry entry name, if NULL the default is "Column Info".
00150         LPCTSTR lpszEntry=NULL,
00151         // registry default value, if NULL the default id "".
00152         LPCTSTR lpszDefault=NULL);
00153
00154     // call this member function to subclass the the flat header control.
00155     //
00156     virtual bool SubclassHeader(bool bBoldFont=false);
00157
00158     // override this member function in your derived class to
00159     // peform custom sort routines.
00160     //
00161     virtual bool SortList(
00162         // passed in from control, index of column clicked.
00163         int nCol,
00164         // passed in from control, true if sort order should be ascending.
00165         bool bAscending );
00166
00167     // this member function is called to set extended styles for the list
00168     // control ie: LVS_EX_FULLROWSELECT, LVS_EX_GRIDLINES, LVS_EX_HEADERDRAGDROP.
00169     //
00170     virtual void SetExtendedStyle( DWORD dwExStyle );
00171
00172     // this member function is called to return the list control extended style.
00173     //
00174     virtual DWORD GetExtendedStyle();
00175
00176     // call this member function to enable/disable column sizing
00177     //
00178     virtual void DisableColumnSizing(bool bDisable);
00179
00180     // call this member function to set a minimum column size
00181     //
00182     virtual void SetMinimumColSize(int nSize);
00183
00184     // call this member function to determine the row index and column index for a point.
00185     // returns the row index or -1 if point is not over a row.
00186     //
00187     virtual int HitTestEx(
00188         // point to be tested.
00189         CPoint &point,
00190         // to hold the column index
00191         int *col) const;
00192
00193     // adds column after the right most column.
00194     //
00195     virtual int AddColumn(
00196         // the column's heading
00197         LPCTSTR lpszColHeading,
00198         // Width of the column, in pixels. If this parameter is -1,
00199         // the column width is the same as previous column
00200         int nWidth = -1,
00201         // the alignment of the column. Can be LVCFMT_LEFT,
00202         // LVCFMT_RIGHT, or LVCFMT_CENTER.
00203         int nFormat=LVCFMT_LEFT);
00204
00205     // this member function will build the columns for the list control. Returns
00206     // false if an error occured.
00207     //
00208     virtual bool BuildColumns(
00209         // number of columns the list control contains
00210         int nCols,
00211         // int array containing the column widths
00212         int* nWidth,
00213         // CString array containing the string for each column
00214         CString* strColString );
00215
00216     // this member function will build the columns for the list control. Returns
00217     // false if an error occured.
00218     //
00219     virtual bool BuildColumns(
00220         // number of columns the list control contains
00221         int nCols,
00222         // int array containing the column widths
00223         int* nWidth,
00224         // int array containing the  string resource id for each column
00225         int* nColString );
00226
00227     // sets the row text and background colors.
00228     virtual void SetRowColors(COLORREF clrText, COLORREF clrTextBk);
00229
00230     // returns the number of columns in the list.
00231     virtual int GetColumnCount() const;
00232
00233     // copies a row to a new location.
00234     //
00235     virtual bool CopyRow(int nFrom, int nTo);
00236
00237     // moves a row to a new location.
00238     //
00239     virtual bool MoveRow(int nFrom, int nTo);
00240
00241 // Overrides
00242     // ClassWizard generated virtual function overrides
00243     //{{AFX_VIRTUAL(CCJListCtrl)
00244     protected:
00245     virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
00246     //}}AFX_VIRTUAL
00247
00248     // Generated message map functions
00249 protected:
00250     //{{AFX_MSG(CCJListCtrl)
00251     afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
00252     afx_msg void OnDestroy();
00253     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00254     afx_msg void OnPaint();
00255     //}}AFX_MSG
00256
00257     DECLARE_MESSAGE_MAP()
00258 };
00259
00261 //  Inline Functions
00263
00264 _CJXLIB_INLINE DWORD CCJListCtrl::GetExtendedStyle()
00265     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); }
00266
00267 _CJXLIB_INLINE void CCJListCtrl::SetExtendedStyle(DWORD dwExStyle)
00268     { ASSERT(::IsWindow(m_hWnd)); SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, GetExtendedStyle()|dwExStyle); }
00269
00270 _CJXLIB_INLINE void CCJListCtrl::SetRowColors(COLORREF clrText, COLORREF clrTextBk)
00271     { m_clrText = clrText; m_clrTextBk = clrTextBk; }
00272
00273 _CJXLIB_INLINE void CCJListCtrl::SetMinimumColSize(int nSize)
00274     { m_nMinSize = nSize; }
00275
00276 _CJXLIB_INLINE void CCJListCtrl::DisableColumnSizing(bool bDisable)
00277     { m_bNoColSizing = bDisable; }
00278
00280
00281 //{{AFX_INSERT_LOCATION}}
00282 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00283
00284 #endif // __CJLISTCTRL_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJListView.h Source File

WinCvs/CJLib/Include/CJListView.h

Go to the documentation of this file.
00001 // CJListView.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the CListView articles from http://www.codeguru.com/listview
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:51 $
00011  * $Revision: 1.1.1.2 $
00012  * $Archive: /CodeJock/Include/CJListView.h $
00013  *
00014  * $History: CJListView.h $
00015  *
00016  * *****************  Version 10  *****************
00017  * User: Kirk Stowell Date: 10/30/99   Time: 2:22p
00018  * Updated in $/CodeJock/Include
00019  * Overrode OnEraseBkgnd(...) for flicker free drawing.
00020  *
00021  * *****************  Version 9  *****************
00022  * User: Kirk Stowell Date: 10/26/99   Time: 10:42p
00023  * Updated in $/CodeJock/Include
00024  * Made class methods virtual for inheritance purposes.
00025  *
00026  * *****************  Version 8  *****************
00027  * User: Kirk Stowell Date: 7/31/99    Time: 4:27p
00028  * Updated in $/CodeJockey/Include
00029  *
00030  * *****************  Version 7  *****************
00031  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00032  * Updated in $/CodeJockey/Include
00033  *
00034  * *****************  Version 6  *****************
00035  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00036  * Updated in $/CodeJockey/Include
00037  *
00038  * *****************  Version 5  *****************
00039  * User: Kirk Stowell Date: 7/18/99    Time: 10:14p
00040  * Updated in $/CodeJockey/Include
00041  * Cleaned up inline functions, and import/export macro so that class will
00042  * be imported when linked to, and exported at compile time.
00043  *
00044  * *****************  Version 4  *****************
00045  * User: Kirk Stowell Date: 6/12/99    Time: 2:12a
00046  * Updated in $/CodeJockey/Include
00047  * Cleaned up initialization, sorting and column info saving. Removed sort
00048  * functions, which were replaced with the virtual function SortList(...).
00049  * Override this function in your derived class to perform custom sorting.
00050  * See CCJShellList for an implementation of this virtual function.
00051  *
00052  * *****************  Version 3  *****************
00053  * User: Kirk Stowell Date: 4/03/99    Time: 12:06a
00054  * Updated in $/CodeJockey/Include
00055  * Added comments and cleaned up code.
00056  *
00057  * *****************  Version 2  *****************
00058  * User: Kirk Stowell Date: 3/03/99    Time: 12:06a
00059  * Updated in $/CodeJockey/Include
00060  * Added InitializeFlatHeader() in order to initialize the list control
00061  * manually.
00062  *
00063  * *****************  Version 1  *****************
00064  * User: Kirk Stowell Date: 1/16/99    Time: 12:06a
00065  * Created in $/CodeJockey/Include
00066  * Initial release.
00067  *
00068  ***************************************************************************/
00070
00071 #ifndef __CJLISTVIEW_H__
00072 #define __CJLISTVIEW_H__
00073
00074 #if _MSC_VER >= 1000
00075 #pragma once
00076 #endif // _MSC_VER >= 1000
00077
00078 #include <afxcview.h>
00079 class CCJFlatHeaderCtrl;
00080
00081 // CCJListView is a CListView derived class which implements a
00082 // flat header and generic sorting routines.
00083 class _CJX_EXT_CLASS CCJListView : public CListView
00084 {
00085     DECLARE_DYNCREATE(CCJListView)
00086
00087 public:
00088
00089     // Default constructor
00090     //
00091     CCJListView();
00092
00093     // Virtual destructor
00094     //
00095     virtual ~CCJListView();
00096
00097 protected:
00098
00099     int                 m_nMinColWidth;     // minimum width for columns
00100     int                 m_nMaxColWidth;     // maximum width for columns
00101     int                 m_nSortedCol;       // index of currently selected column
00102     CCJFlatHeaderCtrl*  m_pHeaderCtrl;      // points to subclassed flat header control.
00103     CString             m_strSection;       // registry section name.
00104     CString             m_strEntry;         // registry entry name.
00105     CString             m_strDefault;       // registry default value.
00106     CListCtrl*          m_pListCtrl;        // points to the list control associated with this view.
00107     COLORREF            m_clrText;          // RGB value for row text color.
00108     COLORREF            m_clrTextBk;        // RGB value for row text background color.
00109     bool                m_bNoColSizing;     // if true, column sizing is disabled.
00110     int                 m_nMinSize;         // if set, columns will have a minimum size requirement.
00111
00112 private:
00113
00114     bool                m_bAutoSave;        // true if saving column widths.
00115     bool                m_bAscending;       // flag to determine sorting order
00116
00117 // Operations
00118 public:
00119
00120     // this member function will return the column width stored in the registry.
00121     //
00122     virtual int GetStoredWidth(int nCol);
00123
00124     // this member function will automatically size a given column.
00125     //
00126     virtual void AutoSizeColumn(int nCol=-1);
00127
00128     // this member function will set the column width from the
00129     // registry settings.
00130     //
00131     virtual void SetColumnWidth(int nCol);
00132
00133     // this member function loads column widths from the registry.
00134     //
00135     virtual void LoadColumnWidths();
00136
00137     // this member function saves column widths to the registry.
00138     //
00139     virtual void SaveColumnWidths();
00140
00141     // this member function will initialize the autosave feature. If called
00142     // column widths will be saved to system registry when the list control
00143     // window is destroyed.
00144     //
00145     virtual void AutoSaveColumns(
00146         // registry section name, if NULL the default is "Settings".
00147         LPCTSTR lpszSection=NULL,
00148         // registry entry name, if NULL the default is "Column Info".
00149         LPCTSTR lpszEntry=NULL,
00150         // registry default value, if NULL the default id "".
00151         LPCTSTR lpszDefault=NULL);
00152
00153     // call this member function to subclass the the flat header control.
00154     //
00155     virtual bool SubclassHeader(bool bBoldFont=false);
00156
00157     // override this member function in your derived class to
00158     // peform custom sort routines.
00159     //
00160     virtual bool SortList(
00161         // passed in from control, index of column clicked.
00162         int nCol,
00163         // passed in from control, true if sort order should be ascending.
00164         bool bAscending );
00165
00166     // this member function is called to set extended styles for the list
00167     // control ie: LVS_EX_FULLROWSELECT, LVS_EX_GRIDLINES, LVS_EX_HEADERDRAGDROP.
00168     //
00169     virtual void SetExtendedStyle( DWORD dwExStyle );
00170
00171     // this member function is called to return the list control extended style.
00172     //
00173     virtual DWORD GetExtendedStyle();
00174
00175     // call this member function to enable/disable column sizing
00176     //
00177     virtual void DisableColumnSizing(bool bDisable);
00178
00179     // call this member function to set a minimum column size
00180     //
00181     virtual void SetMinimumColSize(int nSize);
00182
00183     // call this member function to determine the row index and column index for a point.
00184     // returns the row index or -1 if point is not over a row.
00185     //
00186     virtual int HitTestEx(
00187         // point to be tested.
00188         CPoint &point,
00189         // to hold the column index
00190         int *col) const;
00191
00192     // adds column after the right most column.
00193     //
00194     virtual int AddColumn(
00195         // the column's heading
00196         LPCTSTR lpszColHeading,
00197         // Width of the column, in pixels. If this parameter is -1,
00198         // the column width is the same as previous column
00199         int nWidth = -1,
00200         // the alignment of the column. Can be LVCFMT_LEFT,
00201         // LVCFMT_RIGHT, or LVCFMT_CENTER.
00202         int nFormat=LVCFMT_LEFT);
00203
00204     // this member function will build the columns for the list control. Returns
00205     // false if an error occured.
00206     //
00207     virtual bool BuildColumns(
00208         // number of columns the list control contains
00209         int nCols,
00210         // int array containing the column widths
00211         int* nWidth,
00212         // CString array containing the string for each column
00213         CString* strColString );
00214
00215     // this member function will build the columns for the list control. Returns
00216     // false if an error occured.
00217     //
00218     virtual bool BuildColumns(
00219         // number of columns the list control contains
00220         int nCols,
00221         // int array containing the column widths
00222         int* nWidth,
00223         // int array containing the  string resource id for each column
00224         int* nColString );
00225
00226     // sets the row text and background colors.
00227     virtual void SetRowColors(COLORREF clrText, COLORREF clrTextBk);
00228
00229     // returns the number of columns in the list.
00230     virtual int GetColumnCount() const;
00231
00232     // copies a row to a new location.
00233     //
00234     virtual bool CopyRow(int nFrom, int nTo);
00235
00236     // moves a row to a new location.
00237     //
00238     virtual bool MoveRow(int nFrom, int nTo);
00239
00240 // Overrides
00241     // ClassWizard generated virtual function overrides
00242     //{{AFX_VIRTUAL(CCJListView)
00243     public:
00244     virtual void OnInitialUpdate();
00245     protected:
00246     virtual void OnDraw(CDC* pDC);      // overridden to draw this view
00247     virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
00248     //}}AFX_VIRTUAL
00249
00250 // Implementation
00251 protected:
00252 #ifdef _DEBUG
00253     virtual void AssertValid() const;
00254     virtual void Dump(CDumpContext& dc) const;
00255 #endif
00256
00257     // Generated message map functions
00258 protected:
00259     //{{AFX_MSG(CCJListView)
00260     afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
00261     afx_msg void OnDestroy();
00262     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00263     //}}AFX_MSG
00264     DECLARE_MESSAGE_MAP()
00265 };
00266
00268 //  Inline Functions
00270
00271 _CJXLIB_INLINE DWORD CCJListView::GetExtendedStyle()
00272     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); }
00273
00274 _CJXLIB_INLINE void CCJListView::SetExtendedStyle(DWORD dwExStyle)
00275     { ASSERT(::IsWindow(m_hWnd)); SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, GetExtendedStyle()|dwExStyle); }
00276
00277 _CJXLIB_INLINE void CCJListView::SetRowColors(COLORREF clrText, COLORREF clrTextBk)
00278     { m_clrText = clrText; m_clrTextBk = clrTextBk; }
00279
00280 _CJXLIB_INLINE void CCJListView::SetMinimumColSize(int nSize)
00281     { m_nMinSize = nSize; }
00282
00283 _CJXLIB_INLINE void CCJListView::DisableColumnSizing(bool bDisable)
00284     { m_bNoColSizing = bDisable; }
00285
00287
00288 //{{AFX_INSERT_LOCATION}}
00289 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00290
00291 #endif // __CJLISTVIEW_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJLogoPane.h Source File

WinCvs/CJLib/Include/CJLogoPane.h

Go to the documentation of this file.
00001 // CJLogoPane.h : header file
00002 //
00003 // Copyright © 1999 Pierre MELLINAND
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.1 $
00010  * $Archive: /CodeJock/Include/CJLogoPane.h $
00011  *
00012  * $History: CJLogoPane.h $
00013  *
00014  * *****************  Version 1  *****************
00015  * User: Kirk Stowell Date: 10/26/99   Time: 11:08p
00016  * Created in $/CodeJock/Include
00017  *
00018  ***************************************************************************/
00020
00021 #ifndef __CJLOGOPANE_H__
00022 #define __CJLOGOPANE_H__
00023
00024 #if _MSC_VER >= 1000
00025 #pragma once
00026 #endif // _MSC_VER >= 1000
00027
00029 // CCJLogoPane class
00030
00031 class _CJX_EXT_CLASS CCJLogoPane : public CWnd
00032 {
00033     DECLARE_DYNCREATE(CCJLogoPane)
00034
00035 // Construction
00036 public:
00037     CCJLogoPane();
00038
00039 // Attributes
00040 public:
00041     CString m_strLogoText;
00042     CFont   m_Font;
00043
00044 // Operations
00045 public:
00046     virtual void    SetLogoText(LPCTSTR lpszLogoText);
00047     virtual CString GetLogoText();
00048     virtual void    SetLogoFont(LPCTSTR lpszFontName, int nHeight=24, int nWeight=FW_BOLD, BOOL bItalic=TRUE, BOOL bUnderline=FALSE);
00049
00050 // Overrides
00051     // ClassWizard generated virtual function overrides
00052     //{{AFX_VIRTUAL(CCJLogoPane)
00053     public:
00054     virtual BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, CWnd* pParentWnd, UINT nID);
00055     //}}AFX_VIRTUAL
00056
00057 // Implementation
00058 public:
00059     virtual ~CCJLogoPane();
00060
00061 // Generated message map functions
00062 protected:
00063     //{{AFX_MSG(CCJLogoPane)
00064     afx_msg void OnPaint();
00065     //}}AFX_MSG
00066     DECLARE_MESSAGE_MAP()
00067 };
00068
00070 //  Inline Functions
00072
00073 _CJXLIB_INLINE void CCJLogoPane::SetLogoText(LPCTSTR lpszLogoText)
00074     { m_strLogoText = lpszLogoText; }
00075
00076 _CJXLIB_INLINE CString CCJLogoPane::GetLogoText()
00077     { return m_strLogoText; }
00078
00080
00081 //{{AFX_INSERT_LOCATION}}
00082 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00083
00084 #endif // __CJLOGOPANE_H__
00085
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJMaskEdit.h Source File

WinCvs/CJLib/Include/CJMaskEdit.h

Go to the documentation of this file.
00001 // CJMaskEdit.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the article "A masked edit control (2)" by Jeremy Davis [jmd@jvf.co.uk]
00006 // http://www.codeguru.com/editctrl/masked_edit2.shtml
00007 //
00009 /****************************************************************************
00010  *
00011  * $Date: 1999/11/30 21:45:51 $
00012  * $Revision: 1.1.1.3 $
00013  * $Archive: /CodeJock/Include/CJMaskEdit.h $
00014  *
00015  * $History: CJMaskEdit.h $
00016  *
00017  * *****************  Version 7  *****************
00018  * User: Kirk Stowell Date: 10/30/99   Time: 2:21p
00019  * Updated in $/CodeJock/Include
00020  * Overrode OnPaint() and  OnEraseBkgnd(...) for flicker free drawing.
00021  *
00022  * *****************  Version 6  *****************
00023  * User: Kirk Stowell Date: 10/26/99   Time: 10:44p
00024  * Updated in $/CodeJock/Include
00025  * Made class methods virtual for inheritance purposes.
00026  *
00027  * *****************  Version 5  *****************
00028  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00029  * Updated in $/CodeJockey/Include
00030  * Updated copyright and contact information.
00031  *
00032  * *****************  Version 4  *****************
00033  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00034  * Updated in $/CodeJockey/Include
00035  *
00036  * *****************  Version 3  *****************
00037  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00038  * Updated in $/CodeJockey/Include
00039  *
00040  * *****************  Version 2  *****************
00041  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00042  * Updated in $/CodeJockey/Include
00043  *
00044  * *****************  Version 1  *****************
00045  * User: Kirk Stowell Date: 7/19/99    Time: 12:35a
00046  * Created in $/CodeJockey/Include
00047  * Initial creation and addition to library.
00048  *
00049  ***************************************************************************/
00051
00052 #ifndef __CJMASKEDIT_H__
00053 #define __CJMASKEDIT_H__
00054
00055 #if _MSC_VER >= 1000
00056 #pragma once
00057 #endif // _MSC_VER >= 1000
00058
00059 // CCJMaskEdit is a CEdit derived class which allows text masking to be
00060 // applied to the control to format it for special editing restrictions.
00061 class _CJX_EXT_CLASS CCJMaskEdit : public CEdit
00062 {
00063     DECLARE_DYNAMIC(CCJMaskEdit)
00064
00065 // Construction
00066 public:
00067     CCJMaskEdit();
00068
00069 // Attributes
00070 public:
00071
00072     bool        m_bUseMask;             // true to use edit mask.
00073     bool        m_bMaskKeyInProgress;   // true when
00074     CString     m_strWindowText;        // buffer that holds the actual edit text.
00075     CString     m_strMask;              // buffer that holds the actual edit mask value.
00076     CString     m_strLiteral;
00077     CString     m_strValid;
00078     CString     m_strMaskLiteral;
00079     CFont       m_Font;                 // font used by masked edit control.
00080
00081 // Operations
00082 public:
00083
00084     virtual void SetEditMask(LPCTSTR lpszMask, LPCTSTR lpszLiteral, LPCTSTR lpszWindowText);
00085     virtual void SendChar(UINT nChar);
00086     virtual bool CheckChar(UINT nChar);
00087
00088 // Overrides
00089     // ClassWizard generated virtual function overrides
00090     //{{AFX_VIRTUAL(CCJMaskEdit)
00091     //}}AFX_VIRTUAL
00092
00093     virtual bool ProcessMask(UINT nChar, int nEndPos);
00094
00095 // Implementation
00096 public:
00097     virtual void UpdateFont();
00098     virtual ~CCJMaskEdit();
00099
00100     // Generated message map functions
00101 protected:
00102     //{{AFX_MSG(CCJMaskEdit)
00103     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00104     afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
00105     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00106     afx_msg void OnPaint();
00107     //}}AFX_MSG
00108
00109     DECLARE_MESSAGE_MAP()
00110 };
00111
00112 // CCJDateEdit is a CCJMaskEdit derived class which is specifically
00113 // geared toward editing date fields.
00114 class _CJX_EXT_CLASS CCJDateEdit : public CCJMaskEdit
00115 {
00116     DECLARE_DYNAMIC(CCJDateEdit)
00117
00118 // Construction
00119 public:
00120     CCJDateEdit();
00121
00122     virtual void SetDateTime(COleDateTime& dt);
00123     virtual void SetDateTime(CString strDate);
00124     virtual COleDateTime GetDateTime();
00125     virtual CString GetWindowDateTime();
00126     virtual COleDateTime ReadOleDateTime(LPCTSTR lpszData);
00127
00128     virtual bool ProcessMask(UINT nChar, int nEndPos);
00129     virtual void FormatOleDateTime(CString& strData, COleDateTime dt);
00130 };
00131
00132 // CCJTimeEdit is a CCJDateEdit derived class which is specifically geared
00133 // toward editing time fields.
00134 class _CJX_EXT_CLASS CCJTimeEdit : public CCJDateEdit
00135 {
00136     DECLARE_DYNAMIC(CCJTimeEdit)
00137
00138 // Construction
00139 public:
00140     CCJTimeEdit();
00141
00142     CString     m_strHours;
00143     CString     m_strMins;
00144
00145     virtual void SetHours(int nHours);
00146     virtual void SetMins(int nMins);
00147
00148     virtual bool ProcessMask(UINT nChar, int nEndPos);
00149     virtual void FormatOleDateTime(CString& strData, COleDateTime dt);
00150 };
00151
00153 // DDX for date mask control
00154
00155 void AFXAPI DDX_OleDateTime(CDataExchange* pDX, int nIDC, CCJDateEdit& rControl, COleDateTime& rDateTime);
00156
00158
00159 //{{AFX_INSERT_LOCATION}}
00160 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00161
00162 #endif // __CJMASKEDIT_H__
00163
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJMDIChildWnd.h Source File

WinCvs/CJLib/Include/CJMDIChildWnd.h

Go to the documentation of this file.
00001 // CJMDIChildWnd.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJMDIChildWnd.h $
00011  *
00012  * $History: CJMDIChildWnd.h $
00013  *
00014  * *****************  Version 7  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:02p
00016  * Updated in $/CodeJock/Include
00017  * Overrode OnEraseBkgnd(...) for flicker free drawing.
00018  *
00019  * *****************  Version 6  *****************
00020  * User: Kirk Stowell Date: 10/26/99   Time: 10:44p
00021  * Updated in $/CodeJock/Include
00022  * Made class methods virtual for inheritance purposes.
00023  *
00024  * *****************  Version 5  *****************
00025  * User: Kirk Stowell Date: 10/06/99   Time: 6:21a
00026  * Updated in $/CodeJockey/Include
00027  * Added cool menu support for MDI applications that do not have a
00028  * document/view architecture. Added GetInitializedMenu() to
00029  * CCJMDIChildWnd which will initialize the menu for a given view,  and
00030  * overloaded InitializeMenu() in CCJMDIFrameWnd. Thanks to Golovanov
00031  * Michael [Golovanov@SoftLab.RU] for help with this.
00032  *
00033  * *****************  Version 4  *****************
00034  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00035  * Updated in $/CodeJockey/Include
00036  * Updated copyright and contact information.
00037  *
00038  * *****************  Version 3  *****************
00039  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00040  * Updated in $/CodeJockey/Include
00041  *
00042  * *****************  Version 2  *****************
00043  * User: Kirk Stowell Date: 7/18/99    Time: 10:14p
00044  * Updated in $/CodeJockey/Include
00045  * Cleaned up inline functions, and import/export macro so that class will
00046  * be imported when linked to, and exported at compile time.
00047  *
00048  * *****************  Version 1  *****************
00049  * User: Kirk Stowell Date: 6/26/99    Time: 8:30p
00050  * Created in $/CodeJockey/Include
00051  * Initial creation. Added to library to allow CCJControlBar and
00052  * CCJToolBar docking.
00053  *
00054  ***************************************************************************/
00056
00057 #ifndef __CJMDICHILDWND_H__
00058 #define __CJMDICHILDWND_H__
00059
00060 #if _MSC_VER > 1000
00061 #pragma once
00062 #endif // _MSC_VER > 1000
00063
00064 // class forwards
00065 class CCJSizeDockBar;
00066
00067 // The CCJMDIChildWnd class provides the functionality of a Windows multiple
00068 // document interface (MDI) child window, along with members for managing the
00069 // window. This class extends the standard CMDIChildWnd class to allow CCJControlBar
00070 // and CCJToolBar docking.
00071 class _CJX_EXT_CLASS CCJMDIChildWnd : public CMDIChildWnd
00072 {
00073     DECLARE_DYNCREATE(CCJMDIChildWnd)
00074
00075 // Construction / destruction
00076 public:
00077
00078     // Constructs a CCJMDIChildWnd object
00079     //
00080     CCJMDIChildWnd();
00081
00082     // Destroys a CCJMDIChildWnd object
00083     //
00084     virtual ~CCJMDIChildWnd();
00085
00086     virtual HMENU GetInitializedMenu(
00087         UINT nMenuID,
00088         UINT nToolBarID);
00089
00090     virtual HMENU GetInitializedMenu(
00091         UINT nMenuID,
00092         UINT* nToolbarIDs,
00093         int nSize);
00094
00095     virtual UINT GetMenuID();
00096     virtual UINT GetToolBarID();
00097     virtual UINT* GetToolBarIDs(int& nCount);
00098     virtual void SetResourceIDs(UINT nMenuID, UINT nToolBarID);
00099     virtual void SetResourceIDs(UINT nMenuID, UINT* nToolBarIDs, int nCount);
00100
00101 protected:
00102
00103     HMENU   m_hMenu;
00104     UINT    m_nMenuID;
00105     UINT    m_nToolBarID;
00106     UINT*   m_nToolBarIDs;
00107     int     m_nCount;
00108
00109     static DWORD dwDockBarMap[4][2];    // array used for docking masks
00110
00111     // Yiannhs to parameterize and the dock bar border
00112     enum DockFlatBorders {
00113         brdrAllRaised       = 0x0000,
00114         brdrFlatTop         = 0x0001,
00115         brdrFlatBottom      = 0x0002,
00116         brdrFlatLeft        = 0x0004,
00117         brdrFlatRight       = 0x0008,
00118         brdrFlatVertical    = 0x0003,
00119         brdrFlatHorizontal  = 0x000C,
00120         brdrFlatAll         = 0x000F
00121     };
00122
00123     // This member function is called to calculate the size of
00124     // a CCJControlBar
00125     //
00126     virtual void RecalcAllExcept(CCJSizeDockBar *pBar);
00127
00128     // This member function enables docking for standard
00129     // toolbar and control bars
00130     //
00131     virtual void EnableDocking(DWORD dwDockStyle);
00132
00133     // This member function enables docking for CCJControl bars only
00134     //
00135     virtual void EnableDockingSizeBar(
00136         // Specifies which sides of the frame window can serve as docking sites
00137         // for control bars. It can be one or more of the following:
00138         //
00139         // CBRS_ALIGN_TOP   Allows docking at the top of the client area.
00140         // CBRS_ALIGN_BOTTOM   Allows docking at the bottom of the client area.
00141         // CBRS_ALIGN_LEFT   Allows docking on the left side of the client area.
00142         // CBRS_ALIGN_RIGHT   Allows docking on the right side of the client area.
00143         // CBRS_ALIGN_ANY   Allows docking on any side of the client area.
00144         DWORD dwDockStyle,
00145         // enum for flat border styles.
00146         DockFlatBorders FlatFlags = brdrAllRaised );
00147
00148     // This member function will dock a CCJControlBar
00149     //
00150     virtual void DockSizeBar(
00151         // toolbar to dock
00152         CControlBar* pBar,
00153         // dockbar object usually NULL
00154         CCJSizeDockBar* pDockBar=NULL,
00155         // initial size usually NULL
00156         LPRECT lpRect=NULL);
00157
00158     // This memeber function will dock the control bar passed in
00159     // as the first argument, and dock the control bar that is passed in
00160     // as the second argument to the left of the first one.
00161     //
00162     virtual void DockControlBarLeftOf(
00163         // control bar to dock to the right of
00164         CControlBar* Bar,
00165         // already docked control bar
00166         CControlBar* LeftOf);
00167
00168 // Overrides
00169     // ClassWizard generated virtual function overrides
00170     //{{AFX_VIRTUAL(CCJMDIChildWnd)
00171     public:
00172     virtual void RecalcLayout(BOOL bNotify = TRUE);
00173     //}}AFX_VIRTUAL
00174
00175 // Implementation
00176 protected:
00177     // Generated message map functions
00178     //{{AFX_MSG(CCJMDIChildWnd)
00179     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00180     //}}AFX_MSG
00181     DECLARE_MESSAGE_MAP()
00182 };
00183
00185 // Inline functions
00187
00188 _CJXLIB_INLINE UINT CCJMDIChildWnd::GetMenuID()
00189     { return m_nMenuID; }
00190
00191 _CJXLIB_INLINE UINT CCJMDIChildWnd::GetToolBarID()
00192     { return m_nToolBarID; }
00193
00194 _CJXLIB_INLINE UINT* CCJMDIChildWnd::GetToolBarIDs(int& nCount)
00195     { nCount = m_nCount; return m_nToolBarIDs; }
00196
00197 _CJXLIB_INLINE void CCJMDIChildWnd::SetResourceIDs(UINT nMenuID, UINT nToolBarID)
00198     { m_nMenuID = nMenuID; m_nToolBarID = nToolBarID; }
00199
00200 _CJXLIB_INLINE void CCJMDIChildWnd::SetResourceIDs(UINT nMenuID, UINT* nToolBarIDs, int nCount)
00201     { m_nMenuID = nMenuID; m_nToolBarIDs = nToolBarIDs; m_nCount = nCount; }
00202
00204
00205 //{{AFX_INSERT_LOCATION}}
00206 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00207
00208 #endif // __CJMDICHILDWND_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJMDIFrameWnd.h Source File

WinCvs/CJLib/Include/CJMDIFrameWnd.h

Go to the documentation of this file.
00001 // CJMDIFrameWnd.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJMDIFrameWnd.h $
00011  *
00012  * $History: CJMDIFrameWnd.h $
00013  *
00014  * *****************  Version 17  *****************
00015  * User: Kirk Stowell Date: 10/29/99   Time: 12:43a
00016  * Updated in $/CodeJock/Include
00017  * Overloaded PreCreateWindow(...) for flicker free drawing.
00018  *
00019  * *****************  Version 16  *****************
00020  * User: Kirk Stowell Date: 10/27/99   Time: 12:06a
00021  * Updated in $/CodeJock/Include
00022  *
00023  * *****************  Version 15  *****************
00024  * User: Kirk Stowell Date: 10/26/99   Time: 10:58p
00025  * Updated in $/CodeJock/Include
00026  * Added menu bar and made class members virtual for inheritance purposes.
00027  *
00028  * *****************  Version 14  *****************
00029  * User: Kirk Stowell Date: 10/14/99   Time: 6:15p
00030  * Updated in $/CodeJock/Include
00031  * Fixed bug with a document becomes the active document when the user
00032  * clicks inside a tab in the CCJTabControlBar to perform some operation.
00033  * When closing the application, MFC decides in CFrameWnd::OnClose() to
00034  * check if the 'active' document is modified before checking all other
00035  * documuents. If the active document is not modified and can close its
00036  * frame, it does not check other documents individually and shuts down
00037  * without asking the important 'modified save' questions. To fix this,
00038  * OnClose() was overriden to add a call to "SetActiveView(NULL)" just
00039  * before the base class OnClose is called. This will check all documents
00040  * asking the save question before closing the application. Thanks to
00041  * Simon Clark [spc@otleda.com] for help with this.
00042  *
00043  * *****************  Version 13  *****************
00044  * User: Kirk Stowell Date: 10/14/99   Time: 10:05a
00045  * Updated in $/CodeJock/Include
00046  * Overrode OnEraseBkgnd(...) to help to eliminate screen flicker.
00047  *
00048  * *****************  Version 12  *****************
00049  * User: Kirk Stowell Date: 10/06/99   Time: 6:21a
00050  * Updated in $/CodeJockey/Include
00051  * Added cool menu support for MDI applications that do not have a
00052  * document/view architecture. Added GetInitializedMenu() to
00053  * CCJMDIChildWnd which will initialize the menu for a given view,  and
00054  * overloaded InitializeMenu() in CCJMDIFrameWnd. Thanks to Golovanov
00055  * Michael [Golovanov@SoftLab.RU] for help with this.
00056  *
00057  * *****************  Version 11  *****************
00058  * User: Kirk Stowell Date: 9/16/99    Time: 2:35p
00059  * Updated in $/CodeJockey/Include
00060  * Fixed bug with save / restore bar state, and with saved bar size
00061  * changing whenever the application starts.
00062  *
00063  * *****************  Version 10  *****************
00064  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00065  * Updated in $/CodeJockey/Include
00066  * Updated copyright and contact information.
00067  *
00068  * *****************  Version 9  *****************
00069  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00070  * Updated in $/CodeJockey/Include
00071  *
00072  * *****************  Version 8  *****************
00073  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00074  * Updated in $/CodeJockey/Include
00075  * Cleaned up inline functions, and import/export macro so that class will
00076  * be imported when linked to, and exported at compile time.
00077  *
00078  * *****************  Version 7  *****************
00079  * User: Kirk Stowell Date: 6/11/99    Time: 8:25p
00080  * Updated in $/CodeJockey/Include
00081  * Slight modification made to popup menu code.
00082  *
00083  * *****************  Version 6  *****************
00084  * User: Kirk Stowell Date: 6/09/99    Time: 8:33p
00085  * Updated in $/CodeJockey/Include
00086  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00087  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00088  * message handler, this is now automatically handled by the base class.
00089  * Added redraw flags to the create method and modified paint and layout
00090  * handlers to reduce flicker and un-necessary command handling. Dragging
00091  * rect now reflects actual control bar docked size. Added "flat" look to
00092  * the control bars, the control bars can now use the classic DevStudio
00093  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00094  * docking windows now handle dragging, docking and floating much better,
00095  * and behave more like DevStudio.
00096  *
00097  * *****************  Version 5  *****************
00098  * User: Kirk Stowell Date: 5/02/99    Time: 2:13a
00099  * Updated in $/CodeJockey/Include
00100  * Re-wrote CCJMenu releated methods so that multiple documents can be
00101  * added with associated menu support. Added typedef CList <CCJMenu*,
00102  * CCJMenu*> CMDIMenuList; so that menus pointers are stored in a list and
00103  * not member variables.
00104  *
00105  * *****************  Version 4  *****************
00106  * User: Kirk Stowell Date: 4/25/99    Time: 10:37p
00107  * Updated in $/CodeJockey/Include
00108  * Added support for Brent Corkum's BCMenu (CCJMenu), which is a replacement for the
00109  * CCoolMenu class.
00110  *
00111  * *****************  Version 3  *****************
00112  * User: Kirk Stowell Date: 4/03/99    Time: 8:41p
00113  * Updated in $/CodeJockey/Include
00114  * Added comments and cleaned up code.
00115  *
00116  * *****************  Version 2  *****************
00117  * User: Kirk Stowell Date: 1/12/99    Time: 8:41p
00118  * Updated in $/CodeJockey/Include
00119  * Total re-write to add side-by-side docking support for CCJControlBar
00120  * class.
00121  *
00122  * *****************  Version 1  *****************
00123  * User: Kirk Stowell Date: 10/17/98   Time: 8:41p
00124  * Created in $/CodeJockey/Include
00125  * Initial re-write and release.
00126  *
00127  ***************************************************************************/
00129
00130 #ifndef __CJMDIFRAMEWND_H__
00131 #define __CJMDIFRAMEWND_H__
00132
00133 #if _MSC_VER >= 1000
00134 #pragma once
00135 #endif // _MSC_VER >= 1000
00136
00137 #include "CJMenuBar.h"
00138 #include "CJMenu.h"
00139
00140 // template list used to store menu objects.
00141 typedef CList <CCJMenu*, CCJMenu*> CMDIMenuList;
00142
00143 // class forwards
00144 class CCJSizeDockBar;
00145
00146 // CCJMDIFrameWnd is a CMDIFrameWnd derived class which is used to
00147 // reposition toolbar layout for 3D effect, in addition to docking
00148 // methods for CCJToolBar and CCJControlBar class
00149 class _CJX_EXT_CLASS CCJMDIFrameWnd : public CMDIFrameWnd
00150 {
00151     DECLARE_DYNCREATE(CCJMDIFrameWnd)
00152
00153 public:
00154
00155     // Default constructor
00156     //
00157     CCJMDIFrameWnd();
00158
00159     // Virtual destructor
00160     //
00161     virtual ~CCJMDIFrameWnd();
00162
00163 protected:
00164
00165     static DWORD    dwDockBarMap[4][2]; // array used for docking masks
00166     CMDIMenuList    m_menuList;         // template used to store associated menus.
00167     CCJMenuBar      m_wndMenuBar;       // menu bar
00168
00169     // Yiannhs to parameterize and the dock bar border
00170     enum DockFlatBorders {
00171         brdrAllRaised       = 0x0000,
00172         brdrFlatTop         = 0x0001,
00173         brdrFlatBottom      = 0x0002,
00174         brdrFlatLeft        = 0x0004,
00175         brdrFlatRight       = 0x0008,
00176         brdrFlatVertical    = 0x0003,
00177         brdrFlatHorizontal  = 0x000C,
00178         brdrFlatAll         = 0x000F
00179     };
00180
00181 protected:
00182
00183     // This member function is called by the framework to associate
00184     // toolbar resources with the frame menu
00185     //
00186     virtual HMENU NewMenu(
00187         // resource id for menu
00188         UINT nMenuID,
00189         // array of toolbar resource ids
00190         UINT* nToolbarIDs = NULL,
00191         // size of array.
00192         int nSize = 0);
00193
00194     // This member function is called by the framework to associate
00195     // a toolbar resource with the frame menu
00196     //
00197     virtual HMENU NewMenu(
00198         // resource id for menu
00199         UINT nMenuID,
00200         // toolbar resource
00201         UINT nToolbarID = NULL);
00202
00203 public:
00204
00205     virtual void LoadBarState(LPCTSTR lpszProfileName);
00206     virtual void SaveBarState(LPCTSTR lpszProfileName) const;
00207
00208     // This member function is called to initialize the CCJMenu
00209     //
00210     virtual BOOL InitializeMenu(
00211         // points to the document template for your app
00212         CMultiDocTemplate* pDocTemplate,
00213         // resource id for menu
00214         UINT nMenuID,
00215         // array of toolbar resource ids
00216         UINT* nToolbarIDs = NULL,
00217         // size of array.
00218         int nSize = 0,
00219         // resource id for default menu, for subsequent calls,
00220         // default menu is ignored.
00221         UINT nDefaultMenuID = NULL);
00222
00223     // This member function is called to initialize the Menu
00224     //
00225     virtual BOOL InitializeMenu(
00226         // points to the document template for your app
00227         CMultiDocTemplate* pDocTemplate,
00228         // resource id for menu
00229         UINT nMenuID,
00230         // toolbar resource
00231         UINT nToolbarID = NULL,
00232         // resource id for default menu, for subsequent calls,
00233         // default menu is ignored.
00234         UINT nDefaultMenuID = NULL);
00235
00236     virtual BOOL CCJMDIFrameWnd::InitializeMenu(
00237         HMENU* phMenu,
00238         UINT nMenuID,
00239         UINT nToolbarID = NULL );
00240
00241     virtual BOOL InitializeMenu(
00242         HMENU* phMenu,
00243         UINT nMenuID,
00244         UINT* nToolbarIDs = NULL ,
00245         int nSize = NULL );
00246
00247     // This member function is called to calculate the size of
00248     // a CCJControlBar
00249     //
00250     virtual void RecalcAllExcept(CCJSizeDockBar *pBar);
00251
00252     // This member function enables docking for standard
00253     // toolbar and control bars
00254     //
00255     virtual void EnableDocking(DWORD dwDockStyle);
00256
00257     // This member function enables docking for CCJControl bars only
00258     //
00259     virtual void EnableDockingSizeBar(
00260         // Specifies which sides of the frame window can serve as docking sites
00261         // for control bars. It can be one or more of the following:
00262         //
00263         // CBRS_ALIGN_TOP   Allows docking at the top of the client area.
00264         // CBRS_ALIGN_BOTTOM   Allows docking at the bottom of the client area.
00265         // CBRS_ALIGN_LEFT   Allows docking on the left side of the client area.
00266         // CBRS_ALIGN_RIGHT   Allows docking on the right side of the client area.
00267         // CBRS_ALIGN_ANY   Allows docking on any side of the client area.
00268         DWORD dwDockStyle,
00269         // enum for flat border styles.
00270         DockFlatBorders FlatFlags = brdrAllRaised );
00271
00272     // This member function will dock a CCJControlBar
00273     //
00274     virtual void DockSizeBar(
00275         // toolbar to dock
00276         CControlBar* pBar,
00277         // dockbar object usually NULL
00278         CCJSizeDockBar* pDockBar=NULL,
00279         // initial size usually NULL
00280         LPRECT lpRect=NULL);
00281
00282     // This memeber function will dock the control bar passed in
00283     // as the first argument, and dock the control bar that is passed in
00284     // as the second argument to the left of the first one.
00285     //
00286     virtual void DockControlBarLeftOf(
00287         // control bar to dock to the right of
00288         CControlBar* Bar,
00289         // already docked control bar
00290         CControlBar* LeftOf);
00291
00292 // Overrides
00293     // ClassWizard generated virtual function overrides
00294     //{{AFX_VIRTUAL(CCJMDIFrameWnd)
00295     public:
00296     virtual void RecalcLayout(BOOL bNotify = TRUE);
00297     protected:
00298     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00299     virtual BOOL PreCreateWindow(CREATESTRUCT& cs, UINT nIconID);
00300     //}}AFX_VIRTUAL
00301
00302 // Generated message map functions
00303 protected:
00304     //{{AFX_MSG(CCJMDIFrameWnd)
00305     afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
00306     afx_msg LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu);
00307     afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
00308     afx_msg void OnClose();
00309     //}}AFX_MSG
00310     DECLARE_MESSAGE_MAP()
00311 };
00312
00314
00315 //{{AFX_INSERT_LOCATION}}
00316 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00317
00318 #endif // __CJMDIFRAMEWND_H__
00319
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJMemFile.h Source File

WinCvs/CJLib/Include/CJMemFile.h

Go to the documentation of this file.
00001 // CJMemFile.h: interface for the CCJMemFile class.
00002 //
00003 // Copyright © 1999 Maxallion
00004 // mailto:XFile@maxallion.8m.com
00005 // ICQ# 32304418
00006 //
00007 // CCJMemFile - Extended Memory File - Beta - w/o a lot of error checking
00008 // - Is used like a normal CFile or CStdioFile or CMemFile object
00009 // - String Functions : ReadString, WriteString
00010 // - Loads physical files into memory on creation and saves them back to disk on destruction
00011 // - Can duplicate itself to other CFile derived objects
00012 // - Has a Search function
00013 // - can be read-accessed like an array
00014 //
00015 // OVERLOADED OPERATORS:
00016 // = Imports from another file or sets file Position
00017 // += Appends another file
00018 // [] reads a byte like an array
00019 //
00021 /****************************************************************************
00022  *
00023  * $Date: 1999/11/30 21:45:51 $
00024  * $Revision: 1.1.1.1 $
00025  * $Archive: /CodeJock/Include/CJMemFile.h $
00026  *
00027  * $History: CJMemFile.h $
00028  *
00029  * *****************  Version 1  *****************
00030  * User: Kirk Stowell Date: 10/24/99   Time: 3:01a
00031  * Created in $/CodeJock/Include
00032  * Initial creation.
00033  *
00034  ***************************************************************************/
00036
00037 #ifndef __CJMEMFILE_H__
00038 #define __CJMEMFILE_H__
00039
00040 #if _MSC_VER > 1000
00041 #pragma once
00042 #endif // _MSC_VER > 1000
00043
00044 class _CJX_EXT_CLASS CCJMemFile : public CMemFile
00045 {
00046 private:
00047     CFileException* m_pError;
00048     CFile m_File;
00049     UINT m_uiOpenFlags;
00050     bool m_bOpen;
00051
00052 public:
00053     CCJMemFile( UINT nGrowBytes = 1024 );
00054     CCJMemFile( BYTE* lpBuffer, UINT nBufferSize, UINT nGrowBytes = 0 );
00055     CCJMemFile(LPCTSTR lpstFilename, UINT uiOpenFlags);
00056     virtual ~CCJMemFile();
00057
00058 protected:
00059     // Load() loads the file into Memory
00060     virtual bool Load();
00061
00062     // Save() saves the file to Disk
00063     virtual bool Save();
00064
00065     // Import() imports the data of a CFile derived object (operator = )
00066     virtual bool Import(CFile *fImp);
00067
00068     // Appends a CFile derived object to the file (operator += )
00069     virtual bool Append(CFile *fApp);
00070
00071 public:
00072     // Flush() saves the memory to disk
00073     virtual void Flush();
00074
00075     // Open(...) opens and loads a physical File into memory
00076     virtual bool Open(CString strFilename, UINT uiOpenFlags, CFileException *pError = NULL);
00077
00078     // Close() saves the contents of the memory to the disk and closes it.
00079     virtual void Close();
00080
00081     // ReadString(...) reads a string
00082     virtual BOOL ReadString(CString& rString);
00083
00084     // WriteString(...) appends a string
00085     virtual void WriteString( LPCTSTR lpsz );
00086
00087     // Duplicate(...) Duplicates the CCJMemFile to a CFile derived class
00088     virtual bool Duplicate(CFile *fDuplicate);
00089     virtual bool Duplicate(CString strDup);
00090
00091     // Discard() discards all changes to file since Open() or last Flush()
00092     virtual bool Discard();
00093
00094     // Insert(...) inserts any File and returns the length of actual copied bytes
00095     virtual DWORD Insert(CFile* fSrc, DWORD dwSourcePos, DWORD dwDestPos, DWORD dwBytes);
00096     virtual DWORD Insert(CString strSrc, DWORD dwSourcePos, DWORD dwDestPos, DWORD dwBytes);
00097
00098     // Extract(...) Extracts bytes to a file and returns the length of actual copied bytes
00099     virtual DWORD Extract(CFile *fDest,DWORD dwStartPos, DWORD dwBytes);
00100     virtual DWORD Extract(CString strDest, DWORD dwStartPos, DWORD dwBytes);
00101
00102     // Find(...) Finds data in the file
00103     LONG FindData(void* pData, DWORD dwDataLen, LONG lStartPos);
00104
00105 // Overloaded Operators
00106 public:
00107     // Importing Operators
00108     void operator =( CFile *fDup);
00109     void operator =( CString strDup);
00110
00111     // Positioning
00112     void operator =( DWORD dwFilePos);
00113
00114     // Appending operators
00115     void operator +=( CFile *fApp);
00116     void operator +=( CString strApp);
00117
00118     // Indexing Operators
00119     BYTE operator [](DWORD dwFilePos);
00120
00121
00122 };
00123
00124 #endif // !defined(__CJMEMFILE_H__)
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJMenu.h Source File

WinCvs/CJLib/Include/CJMenu.h

Go to the documentation of this file.
00001 //*************************************************************************
00002 // CJMenu.h : header file
00003 // Version : 2.5
00004 // Date : October 18, 1999
00005 // Author : Brent Corkum
00006 //
00007 // Portions of code supplied by:
00008 // Ben Ashley,Girish Bharadwaj,Jean-Edouard Lachand-Robert,
00009 // Robert Edward Caldecott,Kenny Goers,Leonardo Zide,
00010 // Stefan Kuhr, Reiner Jung
00011 //
00012 // Bug Fixes:
00013 // Stefan Kuhr,Martin Vladic,Kim Yoo Chul
00014 //
00015 // You are free to use/modify this code but leave this header intact.
00016 //
00018 /****************************************************************************
00019  *
00020  * $Date: 1999/11/30 21:45:51 $
00021  * $Revision: 1.1.1.3 $
00022  * $Archive: /CodeJock/Include/CJMenu.h $
00023  *
00024  * $History: CJMenu.h $
00025  *
00026  * *****************  Version 6  *****************
00027  * User: Kirk Stowell Date: 10/24/99   Time: 2:09a
00028  * Updated in $/CodeJock/Include
00029  * Upgraded to version 2.5 of BCMenu
00030  *
00031  * *****************  Version 5  *****************
00032  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00033  * Updated in $/CodeJock/Include
00034  * Added source control history to file header.
00035  *
00036  ***************************************************************************/
00038
00039 #ifndef __CJMENU_H__
00040 #define __CJMENU_H__
00041
00042 #include <afxtempl.h>
00043
00044 // CCJMenuData class. Fill this class structure to define a single menu item:
00045
00046 class _CJX_EXT_CLASS CCJMenuData
00047 {
00048     wchar_t *m_szMenuText;
00049 public:
00050     CCJMenuData () {menuIconNormal=-1;xoffset=-1;bitmap=NULL;
00051     nFlags=0;nID=0;syncflag=0;m_szMenuText=NULL;};
00052     void SetAnsiString(LPCSTR szAnsiString);
00053     void SetWideString(const wchar_t *szWideString);
00054     const wchar_t *GetWideString(void) {return m_szMenuText;};
00055     ~CCJMenuData ();
00056     CString GetString(void);//returns the menu text in ANSI or UNICODE
00057     int xoffset;
00058     int menuIconNormal;
00059     UINT nFlags,nID,syncflag;
00060     CImageList *bitmap;
00061 };
00062
00063 //struct CMenuItemInfo : public MENUITEMINFO {
00064 struct _CJX_EXT_CLASS CMenuItemInfo : public
00065 //MENUITEMINFO
00066 #ifndef UNICODE   //SK: this fixes warning C4097: typedef-name 'MENUITEMINFO' used as synonym for class-name 'tagMENUITEMINFOA'
00067 tagMENUITEMINFOA
00068 #else
00069 tagMENUITEMINFOW
00070 #endif
00071     {
00072     CMenuItemInfo()
00073     { memset(this, 0, sizeof(MENUITEMINFO));
00074       cbSize = sizeof(MENUITEMINFO);
00075     }
00076 };
00077
00078 typedef enum {Normal,TextOnly} HIGHLIGHTSTYLE;
00079
00080 #ifndef UNICODE
00081 #define AppendMenu AppendMenuA
00082 #define InsertMenu InsertMenuA
00083 #define InsertODMenu InsertODMenuA
00084 #define AppendODMenu AppendODMenuA
00085 #define AppendODPopupMenu AppendODPopupMenuA
00086 #define ModifyODMenu ModifyODMenuA
00087 #else
00088 #define AppendMenu AppendMenuW
00089 #define InsertMenu InsertMenuW
00090 #define InsertODMenu InsertODMenuW
00091 #define AppendODMenu AppendODMenuW
00092 #define ModifyODMenu ModifyODMenuW
00093 #define AppendODPopupMenu AppendODPopupMenuW
00094 #endif
00095
00096 class _CJX_EXT_CLASS CCJMenu : public CMenu  // Derived from CMenu
00097 {
00098     // Construction
00099 public:
00100     CCJMenu();
00101
00102     // Attributes
00103 protected:
00104     CTypedPtrArray<CPtrArray, CCJMenuData*> m_MenuList;  // Stores list of menu items
00105
00106     // When loading an owner-drawn menu using a Resource, CCJMenu must keep track of
00107     // the popup menu's that it creates. Warning, this list *MUST* be destroyed
00108     // last item first :)
00109     CTypedPtrArray<CPtrArray, HMENU>  m_SubMenus;  // Stores list of sub-menus
00110
00111     // Stores a list of all CCJMenu's ever created
00112     static CTypedPtrArray<CPtrArray, HMENU>  m_AllSubMenus;
00113
00114     // Operations
00115 public:
00116     // Overrides
00117     // ClassWizard generated virtual function overrides
00118     //{{AFX_VIRTUAL(CCustomMenu)
00119     //}}AFX_VIRTUAL
00120     // Implementation
00121 public:
00122     static BOOL IsNewShell(void);
00123     void SetBitmapBackground(COLORREF color);
00124     void SetDisableOldStyle(void);
00125     void UnSetDisableOldStyle(void);
00126     BOOL GetDisableOldStyle(void);
00127     void UnSetBitmapBackground(void);
00128     BOOL AddBitmapToImageList(CImageList *list,UINT nResourceID);
00129     BOOL LoadFromToolBar(UINT nID,UINT nToolBar,int& xoffset);
00130     void InsertSpaces(void);
00131     static LRESULT FindKeyboardShortcut(UINT nChar,UINT nFlags,CMenu *pMenu);
00132     static void UpdateMenu(CMenu *pmenu);
00133     static BOOL IsMenu(CMenu *submenu);
00134     static BOOL IsMenu(HMENU submenu);
00135     void DrawCheckMark(CDC *pDC,int x,int y,COLORREF color);
00136     void DrawRadioDot(CDC *pDC,int x,int y,COLORREF color);
00137     CCJMenu *FindMenuOption(int nId,int& nLoc);
00138     CCJMenuData *FindMenuOption(wchar_t *lpstrText);
00139     BOOL GetMenuText(UINT id,CString &string,UINT nFlags = MF_BYPOSITION );
00140     CImageList *checkmaps;
00141     BOOL checkmapsshare;
00142     int m_selectcheck;
00143     int m_unselectcheck;
00144     void LoadCheckmarkBitmap(int unselect,int select);
00145     void DitherBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth,
00146         int nHeight, HBITMAP hbm, int nXSrc, int nYSrc);
00147     void DitherBlt2(CDC *drawdc, int nXDest, int nYDest, int nWidth,
00148         int nHeight, CBitmap &bmp, int nXSrc, int nYSrc);
00149     static HBITMAP LoadSysColorBitmap(int nResourceId);
00150     BOOL GetBitmapFromImageList(CDC* pDC,CImageList *imglist,int nIndex,CBitmap &bmp);
00151
00152     virtual ~CCJMenu();  // Virtual Destructor
00153     // Drawing:
00154     virtual void DrawItem( LPDRAWITEMSTRUCT);  // Draw an item
00155     virtual void MeasureItem( LPMEASUREITEMSTRUCT );  // Measure an item
00156
00157     // Customizing:
00158
00159     void SetIconSize (int, int);  // Set icon size
00160
00161     BOOL AppendODMenuA(LPCSTR lpstrText,
00162         UINT nFlags = MF_OWNERDRAW,
00163         UINT nID = 0,
00164         int nIconNormal = -1);
00165
00166     BOOL AppendODMenuW(wchar_t *lpstrText,
00167         UINT nFlags = MF_OWNERDRAW,
00168         UINT nID = 0,
00169         int nIconNormal = -1);
00170
00171     BOOL AppendODMenuA(LPCSTR lpstrText,
00172         UINT nFlags,
00173         UINT nID,
00174         CImageList *il,
00175         int xoffset);
00176
00177     BOOL AppendODMenuW(wchar_t *lpstrText,
00178         UINT nFlags,
00179         UINT nID,
00180         CImageList *il,
00181         int xoffset);
00182
00183     BOOL AppendMenu( UINT nFlags, UINT nIDNewItem = 0, LPCTSTR lpszNewItem = NULL )
00184         { return CMenu::AppendMenu( nFlags, nIDNewItem, lpszNewItem ); }
00185
00186     BOOL AppendMenu( UINT nFlags, UINT nIDNewItem, const CBitmap* pBmp )
00187         { return CMenu::AppendMenu( nFlags, nIDNewItem, pBmp ); }
00188
00189     BOOL InsertODMenuA(UINT nPosition,
00190         LPCSTR lpstrText,
00191         UINT nFlags = MF_OWNERDRAW,
00192         UINT nID = 0,
00193         int nIconNormal = -1);
00194
00195     BOOL InsertODMenuW(UINT nPosition,
00196         wchar_t *lpstrText,
00197         UINT nFlags = MF_OWNERDRAW,
00198         UINT nID = 0,
00199         int nIconNormal = -1);
00200
00201     BOOL InsertODMenuA(UINT nPosition,
00202         LPCSTR lpstrText,
00203         UINT nFlags,
00204         UINT nID,
00205         CImageList *il,
00206         int xoffset);
00207
00208     BOOL InsertODMenuW(UINT nPosition,
00209         wchar_t *lpstrText,
00210         UINT nFlags,
00211         UINT nID,
00212         CImageList *il,
00213         int xoffset);
00214
00215     BOOL ModifyODMenuA(const char *lpstrText,UINT nID=0,int nIconNormal=-1);
00216     BOOL ModifyODMenuA(const char *lpstrText,UINT nID,CImageList *il,int xoffset);
00217     BOOL ModifyODMenuA(const char *lpstrText,UINT nID,CBitmap *bmp);
00218     BOOL ModifyODMenuA(const char *lpstrText,const char *OptionText,int nIconNormal);
00219     BOOL ModifyODMenuW(wchar_t *lpstrText,UINT nID=0,int nIconNormal=-1);
00220     BOOL ModifyODMenuW(wchar_t *lpstrText,UINT nID,CImageList *il,int xoffset);
00221     BOOL ModifyODMenuW(wchar_t *lpstrText,UINT nID,CBitmap *bmp);
00222     BOOL ModifyODMenuW(wchar_t *lpstrText,wchar_t *OptionText,int nIconNormal);
00223     CCJMenuData *NewODMenu(UINT pos,UINT nFlags,UINT nID,CString string);
00224     void SynchronizeMenu(void);
00225     void CCJMenu::InitializeMenuList(int value);
00226     void CCJMenu::DeleteMenuList(void);
00227     CCJMenuData *CCJMenu::FindMenuList(UINT nID);
00228     virtual BOOL LoadMenu(LPCTSTR lpszResourceName);  // Load a menu
00229     virtual BOOL LoadMenu(int nResource);  // ...
00230     void AddFromToolBar(CToolBar* pToolBar, int nResourceID);
00231     BOOL Draw3DCheckmark(CDC *dc, const CRect& rc,BOOL bSelected,
00232         HBITMAP hbmCheck);
00233     BOOL LoadToolbar(UINT nToolBar);
00234     BOOL LoadToolbars(const UINT *arID,int n);
00235
00236     // new overrides for dynamic menu's
00237     BOOL    RemoveMenu(UINT uiId,UINT nFlags);
00238     BOOL    DeleteMenu(UINT uiId,UINT nFlags);
00239     BOOL  AppendMenuA(UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,int nIconNormal=-1);
00240     BOOL  AppendMenuA(UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CImageList *il,int xoffset);
00241     BOOL  AppendMenuA(UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CBitmap *bmp);
00242     BOOL  AppendMenuW(UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,int nIconNormal=-1);
00243     BOOL  AppendMenuW(UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CImageList *il,int xoffset);
00244     BOOL  AppendMenuW(UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CBitmap *bmp);
00245     BOOL  InsertMenuA(UINT nPosition,UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,int nIconNormal=-1);
00246     BOOL  InsertMenuA(UINT nPosition,UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CImageList *il,int xoffset);
00247     BOOL  InsertMenuA(UINT nPosition,UINT nFlags,UINT nIDNewItem,const char *lpszNewItem,CBitmap *bmp);
00248     BOOL  InsertMenuW(UINT nPosition,UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,int nIconNormal=-1);
00249     BOOL  InsertMenuW(UINT nPosition,UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CImageList *il,int xoffset);
00250     BOOL  InsertMenuW(UINT nPosition,UINT nFlags,UINT nIDNewItem,wchar_t *lpszNewItem,CBitmap *bmp);
00251     CCJMenu* AppendODPopupMenuA(LPCSTR lpstrText);
00252     CCJMenu* AppendODPopupMenuW(wchar_t *lpstrText);
00253
00254     // Destoying:
00255
00256     virtual BOOL DestroyMenu();
00257
00258     // Generated message map functions
00259 protected:
00260     int m_iconX,m_iconY;
00261     COLORREF m_bitmapBackground;
00262     BOOL m_bitmapBackgroundFlag;
00263     BOOL disable_old_style;
00264 };
00265
00266 #endif
00267
00268 //*************************************************************************
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJMenuBar.h Source File

WinCvs/CJLib/Include/CJMenuBar.h

Go to the documentation of this file.
00001 // CJMenuBar.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the code written by Paul DiLascia for MSJ.
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:51 $
00011  * $Revision: 1.1.1.3 $
00012  * $Archive: /CodeJockey/Include/CJMenuBar.h $
00013  *
00014  * $History: CJMenuBar.h $
00015  *
00016  * *****************  Version 5  *****************
00017  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00018  * Updated in $/CodeJockey/Include
00019  * Updated copyright and contact information.
00020  *
00021  * *****************  Version 4  *****************
00022  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00023  * Updated in $/CodeJockey/Include
00024  *
00025  * *****************  Version 3  *****************
00026  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00027  * Updated in $/CodeJockey/Include
00028  *
00029  * *****************  Version 2  *****************
00030  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00031  * Updated in $/CodeJockey/Include
00032  * Cleaned up inline functions, and import/export macro so that class will
00033  * be imported when linked to, and exported at compile time.
00034  *
00035  * *****************  Version 1  *****************
00036  * User: Kirk Stowell Date: 7/15/99    Time: 12:34a
00037  * Created in $/CodeJockey/Include
00038  * Initial creation. Extended the original class written by Paul DiLascia
00039  * for MSJ. Class uses CCJMenu and fixes some bugs with the original
00040  * class.
00041  *
00042  ***************************************************************************/
00044
00045 #ifndef __CJMENUBAR_H__
00046 #define __CJMENUBAR_H__
00047
00048 #if _MSC_VER > 1000
00049 #pragma once
00050 #endif // _MSC_VER > 1000
00051
00052 #include "CJToolBar.h"
00053 #include "CJMenu.h"        // CCJMenu class declaration
00054 #include "Subclass.h"
00055
00057 // CCJMenuBar uses this private class to intercept messages on behalf
00058 // of its owning frame, as well as the MDI client window. Conceptually,
00059 // these should be two different hooks, but I want to save code.
00060 //
00061 class _CJX_EXT_CLASS CCJMenuBarFrameHook : public CSubclassWnd {
00062 protected:
00063    friend class CCJMenuBar;
00064    CCJMenuBar* m_pMenuBar;
00065    CCJMenuBarFrameHook();
00066    ~CCJMenuBarFrameHook();
00067    BOOL Install(CCJMenuBar* pMenuBar, HWND hWndToHook);
00068    virtual LRESULT WindowProc(UINT msg, WPARAM wp, LPARAM lp);
00069 };
00070
00071 typedef enum TRACKINGSTATE { // menubar has three states:
00072     TRACK_NONE = 0,   // * normal, not tracking anything
00073     TRACK_BUTTON,     // * tracking buttons (F10/Alt mode)
00074     TRACK_POPUP       // * tracking popups
00075 };
00076
00078 // CCJMenuBar implements an Office 97-style menu bar. Use it the way you would
00079 // a CToolBar, only you need not call LoadToolbar. All you have to do is
00080 //
00081 // * Create the CCJMenuBar from your OnCreate or OnCreateBands handler.
00082 //
00083 // * Call LoadMenu to load a menu. This will set your frame's menu to NULL.
00084 //
00085 // * Implemenent your frame's PreTranslateMessage function, to call
00086 //   CCJMenuBar::TranslateFrameMessage.
00087 //
00088 class _CJX_EXT_CLASS CCJMenuBar : public CCJToolBar
00089 {
00090     DECLARE_DYNAMIC(CCJMenuBar)
00091 // Construction
00092 public:
00093     CCJMenuBar();
00094     virtual ~CCJMenuBar();
00095
00096     virtual BOOL Create(CWnd* pParentWnd,
00097         DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP,
00098         UINT nID = AFX_IDW_TOOLBAR);
00099
00100     virtual BOOL CreateEx(CWnd* pParentWnd, DWORD dwCtrlStyle = TBSTYLE_FLAT,
00101         DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP,
00102         CRect rcBorders = CRect(0, 0, 0, 0),
00103         UINT nID = AFX_IDW_TOOLBAR);
00104
00105 // Attributes
00106 public:
00107
00108     BOOL                m_bAutoRemoveFrameMenu; // set frame's menu to NULL
00109
00110 protected:
00111
00112     friend class CCJMenuBarFrameHook;
00113
00114     CCJMenuBarFrameHook m_frameHook;            // hooks frame window messages
00115     CStringArray        m_arStrings;            // array of menu item names
00116     int                 m_nMenuID;              // menu resource id.
00117     CCJMenu             m_popupMenu;            // the menu.
00118
00119     // menu tracking stuff:
00120     int                 m_iPopupTracking;       // which popup I'm tracking if any
00121     int                 m_iNewPopup;            // next menu to track
00122     BOOL                m_bProcessRightArrow;   // process l/r arrow keys?
00123     BOOL                m_bProcessLeftArrow;    // ...
00124     BOOL                m_bEscapeWasPressed;    // user pressed escape to exit menu
00125     CPoint              m_ptMouse;              // mouse location when tracking popup
00126     HMENU               m_hMenuTracking;        // current popup I'm tracking
00127     CFont               m_Font;                 // menu font.
00128
00129     TRACKINGSTATE       m_iTrackingState;       // current tracking state
00130
00131 // Operations
00132 public:
00133
00134     BOOL LoadMenu(UINT nID);
00135     CCJMenu* GetMenu(); // get current menu
00136     TRACKINGSTATE GetTrackingState(int& iPopup);
00137     static BOOL bTRACE;                      // set TRUE to see TRACE msgs
00138
00139 protected:
00140
00141     // helpers
00142     void RecomputeToolbarSize();
00143     void RecomputeMenuLayout();
00144     void UpdateFont();
00145     int GetNextOrPrevButton(int iButton, BOOL bPrev);
00146     void SetTrackingState(TRACKINGSTATE iState, int iButton=-1);
00147     void TrackPopup(int iButton);
00148     void ToggleTrackButtonMode();
00149     void CancelMenuAndTrackNewOne(int iButton);
00150     void OnMenuSelect(HMENU hmenu, UINT nItemID);
00151     CPoint ComputeMenuTrackPoint(const CRect& rcButn, TPMPARAMS& tpm);
00152     BOOL IsValidButton(int iButton) const;
00153     int HitTest(CPoint p) const;
00154
00155 #ifdef _DEBUG
00156     virtual void AssertValid() const;
00157     virtual void Dump(CDumpContext& dc) const;
00158 #endif
00159
00160 public:
00161 // Overrides
00162     // ClassWizard generated virtual function overrides
00163     //{{AFX_VIRTUAL(CCJMenuBar)
00164     public:
00165     virtual BOOL TranslateFrameMessage(MSG* pMsg);
00166     protected:
00167     virtual BOOL OnMenuInput(MSG& m);    // handle popup menu input
00168     virtual void OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle);
00169     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
00170     //}}AFX_VIRTUAL
00171
00172 // Implementation
00173 public:
00174
00175     // Generated message map functions
00176 protected:
00177     //{{AFX_MSG(CCJMenuBar)
00178     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00179     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00180     afx_msg void OnSize(UINT nType, int cx, int cy);
00181     afx_msg void OnUpdateMenuButton(CCmdUI* pCmdUI);
00182     //}}AFX_MSG
00183     DECLARE_MESSAGE_MAP()
00184
00185     static LRESULT CALLBACK MenuInputFilter(int code, WPARAM wp, LPARAM lp);
00186 };
00187
00189 //  Inline Functions
00191
00192 _CJXLIB_INLINE BOOL CCJMenuBar::IsValidButton(int iButton) const
00193     { return 0 <= iButton && iButton < GetButtonCount(); }
00194
00195 _CJXLIB_INLINE CCJMenu* CCJMenuBar::GetMenu()
00196     { return &m_popupMenu; }
00197
00198 _CJXLIB_INLINE TRACKINGSTATE CCJMenuBar::GetTrackingState(int& iPopup)
00199     { iPopup = m_iPopupTracking; return m_iTrackingState; }
00200
00201 //{{AFX_INSERT_LOCATION}}
00202 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00203
00204 #endif // __CJMENUBAR_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJMetaFileButton.h Source File

WinCvs/CJLib/Include/CJMetaFileButton.h

Go to the documentation of this file.
00001 // CJMetaFileButton.h : header file
00002 //
00003 // Copyright © 1999 Ian Brumby
00004 //
00005 // This source code may be used in compiled form in any way you desire.
00006 // Source file(s) may be redistributed unmodified by any means PROVIDING
00007 // they are not sold for profit without the authors expressed written consent,
00008 // and providing that this notice and the authors name and all copyright
00009 // notices remain intact.
00010 //
00011 // ==========================================================================
00012 // HISTORY:
00013 // ==========================================================================
00014 //          1.20    21 Apr 1999 - Initial release.
00015 // ==========================================================================
00016 //
00018 /****************************************************************************
00019  *
00020  * $Date: 1999/11/30 21:45:51 $
00021  * $Revision: 1.1.1.2 $
00022  * $Archive: /CodeJock/Include/CJMetaFileButton.h $
00023  *
00024  * $History: CJMetaFileButton.h $
00025  *
00026  * *****************  Version 6  *****************
00027  * User: Kirk Stowell Date: 10/31/99   Time: 11:04p
00028  * Updated in $/CodeJock/Include
00029  * Overrode OnEraseBkgnd(...) and OnPaint() for flicker free drawing.
00030  *
00031  * *****************  Version 5  *****************
00032  * User: Kirk Stowell Date: 10/26/99   Time: 10:45p
00033  * Updated in $/CodeJock/Include
00034  * Made class methods virtual for inheritance purposes.
00035  *
00036  * *****************  Version 4  *****************
00037  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00038  * Updated in $/CodeJock/Include
00039  * Added source control history to file header.
00040  *
00041  ***************************************************************************/
00043
00044 #ifndef __CJMETAFILEBUTTON_H__
00045 #define __CJMETAFILEBUTTON_H__
00046
00047 #if _MSC_VER > 1000
00048 #pragma once
00049 #endif // _MSC_VER > 1000
00050
00051 // CCJMetaFileButton is a CButton derived class which is used by
00052 // the CCJFlatTabCtrl class.
00053 class _CJX_EXT_CLASS CCJMetaFileButton : public CButton
00054 {
00055 // Construction
00056 public:
00057     CCJMetaFileButton();
00058
00059 // Attributes
00060 public:
00061
00062 // Operations
00063 public:
00064     virtual void SetMetaFiles(HENHMETAFILE hMetaFile,
00065         HENHMETAFILE hMetaFileSel = NULL,
00066         HENHMETAFILE hMetaFileFocus = NULL,
00067         HENHMETAFILE hMetaFileDisabled = NULL);
00068
00069 // Overrides
00070     // ClassWizard generated virtual function overrides
00071     //{{AFX_VIRTUAL(CCJMetaFileButton)
00072     public:
00073     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
00074     //}}AFX_VIRTUAL
00075
00076 // Implementation
00077 public:
00078     virtual ~CCJMetaFileButton();
00079
00080     // Generated message map functions
00081 protected:
00082     //{{AFX_MSG(CCJMetaFileButton)
00083     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00084     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00085     afx_msg void OnPaint();
00086     //}}AFX_MSG
00087     DECLARE_MESSAGE_MAP()
00088
00089 private:
00090     HENHMETAFILE m_hEnhMetaFile;
00091     HENHMETAFILE m_hEnhMetaFileSel;
00092     HENHMETAFILE m_hEnhMetaFileFocus;
00093     HENHMETAFILE m_hEnhMetaFileDisabled;
00094 };
00095
00097
00098 //{{AFX_INSERT_LOCATION}}
00099 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00100
00101 #endif // __CJMETAFILEBUTTON_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJMiniDockFrameWnd.h Source File

WinCvs/CJLib/Include/CJMiniDockFrameWnd.h

Go to the documentation of this file.
00001 // CJMiniDockFrameWnd.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJockey/Include/CJMiniDockFrameWnd.h $
00011  *
00012  * $History: CJMiniDockFrameWnd.h $
00013  *
00014  * *****************  Version 7  *****************
00015  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00016  * Updated in $/CodeJockey/Include
00017  * Updated copyright and contact information.
00018  *
00019  * *****************  Version 6  *****************
00020  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00021  * Updated in $/CodeJockey/Include
00022  *
00023  * *****************  Version 5  *****************
00024  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00025  * Updated in $/CodeJockey/Include
00026  * Cleaned up inline functions, and import/export macro so that class will
00027  * be imported when linked to, and exported at compile time.
00028  *
00029  * *****************  Version 4  *****************
00030  * User: Kirk Stowell Date: 6/14/99    Time: 10:46p
00031  * Updated in $/CodeJockey/Include
00032  * Cleaned up code to eliminate level 4 compilier warnings.
00033  *
00034  * *****************  Version 3  *****************
00035  * User: Kirk Stowell Date: 4/14/99    Time: 10:40p
00036  * Updated in $/CodeJockey/Include
00037  * Daniel Harth [danielh@mail.matco.ro] - Added support for diagonal
00038  * sizing.
00039  *
00040  * *****************  Version 2  *****************
00041  * User: Kirk Stowell Date: 4/03/99    Time: 10:39p
00042  * Updated in $/CodeJockey/Include
00043  * Added comments and cleaned up code.
00044  *
00045  * *****************  Version 1  *****************
00046  * User: Kirk Stowell Date: 1/16/99    Time: 10:39p
00047  * Created in $/CodeJockey/Include
00048  * Initial release.
00049  *
00050  ***************************************************************************/
00052
00053 #ifndef __CJMINIDOCKFRAMEWND_H__
00054 #define __CJMINIDOCKFRAMEWND_H__
00055
00056 #if _MSC_VER >= 1000
00057 #pragma once
00058 #endif // _MSC_VER >= 1000
00059
00060 // CCJMiniDockFrameWnd is a CMiniDockFrameWnd class which is used to
00061 // handle docking for the CCJControlBar class.
00062 class _CJX_EXT_CLASS CCJMiniDockFrameWnd : public CMiniDockFrameWnd
00063 {
00064     DECLARE_DYNCREATE(CCJMiniDockFrameWnd)
00065
00066 public:
00067
00068     // Default constructor
00069     //
00070     CCJMiniDockFrameWnd();
00071
00072     // Virtual destructor
00073     //
00074     virtual ~CCJMiniDockFrameWnd();
00075
00076 protected:
00077
00078     // make CDockBar a friend to this class for access to member data
00079     //
00080     friend class CDockBar;
00081
00082 // Overrides
00083     // ClassWizard generated virtual function overrides
00084     //{{AFX_VIRTUAL(CCJMiniDockFrameWnd)
00085     public:
00086     virtual BOOL Create(CWnd* pParent, DWORD dwBarStyle);
00087     //}}AFX_VIRTUAL
00088
00089 // Generated message map functions
00090 protected:
00091     //{{AFX_MSG(CCJMiniDockFrameWnd)
00092     afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
00093     afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
00094     //}}AFX_MSG
00095     DECLARE_MESSAGE_MAP()
00096 };
00097
00099
00100 //{{AFX_INSERT_LOCATION}}
00101 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00102
00103 #endif // __CJMINIDOCKFRAMEWND_H__
00104
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJOutlookBar.h Source File

WinCvs/CJLib/Include/CJOutlookBar.h

Go to the documentation of this file.
00001 // CJOutlookBar.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJOutlookBar.h $
00011  *
00012  * $History: CJOutlookBar.h $
00013  *
00014  * *****************  Version 11  *****************
00015  * User: Kirk Stowell Date: 10/30/99   Time: 2:19p
00016  * Updated in $/CodeJock/Include
00017  * Added COLORREF members to class to eliminate continuous calls to
00018  * GetSysColor(...). Overrode OnSysColorChange() to re-initialize COLORREF
00019  * variables.
00020  *
00021  * *****************  Version 10  *****************
00022  * User: Kirk Stowell Date: 10/26/99   Time: 10:45p
00023  * Updated in $/CodeJock/Include
00024  * Made class methods virtual for inheritance purposes.
00025  *
00026  * *****************  Version 9  *****************
00027  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00028  * Updated in $/CodeJockey/Include
00029  * Updated copyright and contact information.
00030  *
00031  * *****************  Version 8  *****************
00032  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00033  * Updated in $/CodeJockey/Include
00034  *
00035  * *****************  Version 7  *****************
00036  * User: Kirk Stowell Date: 7/25/99    Time: 3:16a
00037  * Updated in $/CodeJockey/Include
00038  * Added ResetContent() thanks to Hiren Patel [hpatel@spss.com] for
00039  * pointing this out.
00040  *
00041  * *****************  Version 6  *****************
00042  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00043  * Updated in $/CodeJockey/Include
00044  *
00045  * *****************  Version 5  *****************
00046  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00047  * Updated in $/CodeJockey/Include
00048  * Cleaned up inline functions, and import/export macro so that class will
00049  * be imported when linked to, and exported at compile time.
00050  *
00051  * *****************  Version 4  *****************
00052  * User: Kirk Stowell Date: 4/03/99    Time: 10:43p
00053  * Updated in $/CodeJockey/Include
00054  * Added comments and cleaned up code.
00055  *
00056  * *****************  Version 3  *****************
00057  * User: Kirk Stowell Date: 3/03/99    Time: 10:43p
00058  * Updated in $/CodeJockey/Include
00059  * Changed images list's to pointer vars passed into class.
00060  *
00061  * *****************  Version 2  *****************
00062  * User: Kirk Stowell Date: 2/24/99    Time: 10:42p
00063  * Updated in $/CodeJockey/Include
00064  * Christopher Brown (Allknowing@earthlink.net) some modifications to
00065  * correct icon resource leak, and eliminate screen flicker.
00066  *
00067  * *****************  Version 1  *****************
00068  * User: Kirk Stowell Date: 10/17/98   Time: 10:42p
00069  * Created in $/CodeJockey/Include
00070  * Initial re-write and release.
00071  *
00072  ***************************************************************************/
00074
00075 #ifndef __CJOUTLOOKBAR_H__
00076 #define __CJOUTLOOKBAR_H__
00077
00078 #if _MSC_VER >= 1000
00079 #pragma once
00080 #endif // _MSC_VER >= 1000
00081
00082 // CContentItems is a utility class used as a Container for
00083 // CJOutlookBar menu items.
00084 class _CJX_EXT_CLASS CContentItems
00085 {
00086 public:
00087
00088     // non-default constructor used to initialize
00089     // member data
00090     //
00091     CContentItems(UINT nID, CString str);
00092
00093 protected:
00094
00095     UINT    m_nImageID; // index of menu item
00096     CString m_csText;   // text of menu item
00097
00098 public:
00099
00100     // overloaded operator which copies a CContentItem object
00101     //
00102     void operator = (CContentItems& pItems);
00103
00104     // returns the index of a menu item
00105     //
00106     virtual UINT GetImageID();
00107
00108     // returns the text of a menu item
00109     //
00110     virtual CString GetText();
00111 };
00112
00113 // CJOutlookBar is a CListBox derived class which simulates a control simular
00114 // to the Outlook bar as seen in Outlook, can only be used with the
00115 // LBS_OWNERDRAWVARIABLE style bit set. very generic
00116 class _CJX_EXT_CLASS CCJOutlookBar : public CListBox
00117 {
00118     DECLARE_DYNAMIC(CCJOutlookBar)
00119
00120 public:
00121
00122     // Default constructor
00123     //
00124     CCJOutlookBar();
00125
00126     // Virtual destructor
00127     //
00128     virtual ~CCJOutlookBar();
00129
00130 protected:
00131
00132     CWnd*           m_pOwner;           // points to the parent window for this control see SetOwner(...)
00133     CPoint          m_point;            // holds the cursor position
00134     CImageList*     m_pImageListLarge;  // points to the small image list for this control see SetImageLists(...)
00135     CImageList*     m_pImageListSmall;  // points to the large image list for this control see SetImageLists(...)
00136     CContentItems*  m_pContents;        // points to a CContentItem array see SetItems(...)
00137     int             m_nNumItems;        // number of menu items in this control see SetItems(...)
00138     int             m_nIndex;           // currently selected menu index
00139     bool            m_bHilight;         // true when menu item is selected
00140     bool            m_bLBDown;          // true when left mouse button is pressed
00141     CFont           m_Font;             // font used by the control.
00142     COLORREF        m_clrHilite;        // set to ::GetSysColor(COLOR_BTNHIGHLIGHT)
00143     COLORREF        m_clrShadow;        // set to ::GetSysColor(COLOR_BTNSHADOW)
00144     COLORREF        m_clrDkShad;        // set to ::GetSysColor(COLOR_3DDKSHADOW)
00145     COLORREF        m_clrNormal;        // set to ::GetSysColor(COLOR_BTNFACE)
00146     COLORREF        m_clrTextNm;        // set to ::GetSysColor(COLOR_WINDOW)
00147
00148 public:
00149
00150     // sets the large and small image lists for the control. currently
00151     // only large image list is implemented
00152     //
00153     virtual void SetImageLists(CImageList* pImageListSmall=NULL, CImageList* pImageListLarge=NULL);
00154
00155     // sets the CContentItem array and m_nNumItems member variables
00156     //
00157     virtual void SetItems(CContentItems* pItems, int nNumItems);
00158
00159     // sets the window that will receive messages from this control
00160     //
00161     virtual void SetOwner(CWnd* pWnd);
00162
00163     // called by the control to initialize the controls font.
00164     //
00165     virtual void UpdateFont();
00166
00167
00168 // Overrides
00169     // ClassWizard generated virtual function overrides
00170     //{{AFX_VIRTUAL(CCJOutlookBar)
00171     public:
00172     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
00173     virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
00174     //}}AFX_VIRTUAL
00175
00176 // Generated message map functions
00177 protected:
00178     //{{AFX_MSG(CCJOutlookBar)
00179     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00180     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00181     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00182     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00183     afx_msg void OnTimer(UINT nIDEvent);
00184     afx_msg void OnPaint();
00185     afx_msg void OnSysColorChange();
00186     //}}AFX_MSG
00187     DECLARE_MESSAGE_MAP()
00188 };
00189
00191 //  Inline Functions for CContentItems
00193
00194 _CJXLIB_INLINE CContentItems::CContentItems( UINT nID, CString str )
00195     { m_nImageID = nID; m_csText = str; }
00196
00197 _CJXLIB_INLINE CString CContentItems::GetText()
00198     { return m_csText; }
00199
00200 _CJXLIB_INLINE UINT CContentItems::GetImageID()
00201     { return m_nImageID; }
00202
00203 _CJXLIB_INLINE void CContentItems::operator = ( CContentItems& pItems )
00204     { m_nImageID = pItems.m_nImageID; m_csText = pItems.m_csText; }
00205
00207 //  Inline Functions for CCJOutlookBar
00209
00210 _CJXLIB_INLINE void CCJOutlookBar::SetImageLists(CImageList* pImageListSmall, CImageList* pImageListLarge)
00211     { m_pImageListLarge = pImageListLarge; m_pImageListSmall = pImageListSmall; }
00212
00213 _CJXLIB_INLINE void CCJOutlookBar::SetItems(CContentItems * pItems, int nNumItems)
00214     { m_pContents = pItems; m_nNumItems = nNumItems; ResetContent(); for (int i = 0; i < nNumItems; ++i) AddString(m_pContents[i].GetText()); }
00215
00216 _CJXLIB_INLINE void CCJOutlookBar::SetOwner(CWnd* pWnd)
00217     { m_pOwner = pWnd; }
00218
00219 #define OBN_SELENDOK    (WM_USER + 1)   // for message handler
00220 #define OB_CYBUTTON     70              // average button height
00221
00223
00224 //{{AFX_INSERT_LOCATION}}
00225 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00226
00227 #endif // __CJOUTLOOKBAR_H__
00228
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJPagerCtrl.h Source File

WinCvs/CJLib/Include/CJPagerCtrl.h

Go to the documentation of this file.
00001 // CJPagerCtrl.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJockey/Include/CJPagerCtrl.h $
00011  *
00012  * $History: CJPagerCtrl.h $
00013  *
00014  * *****************  Version 7  *****************
00015  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00016  * Updated in $/CodeJockey/Include
00017  * Updated copyright and contact information.
00018  *
00019  * *****************  Version 6  *****************
00020  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00021  * Updated in $/CodeJockey/Include
00022  *
00023  * *****************  Version 5  *****************
00024  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00025  * Updated in $/CodeJockey/Include
00026  *
00027  * *****************  Version 4  *****************
00028  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00029  * Updated in $/CodeJockey/Include
00030  * Cleaned up inline functions, and import/export macro so that class will
00031  * be imported when linked to, and exported at compile time.
00032  *
00033  * *****************  Version 3  *****************
00034  * User: Kirk Stowell Date: 4/03/99    Time: 10:45p
00035  * Updated in $/CodeJockey/Include
00036  * Added comments and cleaned up code.
00037  *
00038  * *****************  Version 2  *****************
00039  * User: Kirk Stowell Date: 1/02/99    Time: 10:44p
00040  * Updated in $/CodeJockey/Include
00041  * Cleaned up class source, wrapped all pager messages.
00042  *
00043  * *****************  Version 1  *****************
00044  * User: Kirk Stowell Date: 10/02/98   Time: 10:44p
00045  * Created in $/CodeJockey/Include
00046  * First release version.
00047  *
00048  ***************************************************************************/
00050
00051 #ifndef __CJPAGERCTRL_H__
00052 #define __CJPAGERCTRL_H__
00053
00054 #if _MSC_VER >= 1000
00055 #pragma once
00056 #endif // _MSC_VER >= 1000
00057
00058 // CCJPagerCtrl is a CWnd derived class which wraps the windows
00059 // Pager common control.
00060 class _CJX_EXT_CLASS CCJPagerCtrl : public CWnd
00061 {
00062     DECLARE_DYNAMIC(CCJPagerCtrl)
00063 public:
00064
00065     // Default constructor
00066     //
00067     CCJPagerCtrl();
00068
00069     // Virtual destructor
00070     //
00071     virtual ~CCJPagerCtrl();
00072
00073 protected:
00074
00075     int m_nWidth;   // user defined scroll width see SetScrollArea(...)
00076     int m_nHeight;  // user defined scroll height see SetScrollArea(...)
00077
00078 public:
00079
00080     // this member function sets the scroll area for the
00081     // pager
00082     //
00083     void SetScrollArea (int nWidth, int nHeight);
00084
00086     // CPagerCtrl class wrappers.
00088
00089     // Sets the contained window for the pager control
00090     //
00091     void SetChild(
00092         // Handle to the window to be contained.
00093         HWND hwndChild);
00094
00095     // Forces the pager control to recalculate the size of the
00096     // contained window
00097     //
00098     void RecalcSize();
00099
00100     // Enables or disables mouse forwarding for the pager control
00101     //
00102     void ForwardMouse(
00103         // BOOL value that determines if mouse forwarding is enabled
00104         // or disabled. If this value is nonzero, mouse forwarding is
00105         // enabled. If this value is zero, mouse forwarding is disabled.
00106         BOOL bForward);
00107
00108     // Sets the current background color for the pager control
00109     //
00110     COLORREF SetBkColor(
00111         // COLORREF value that contains the new background
00112         // color of the pager control
00113         COLORREF clr);
00114
00115     // Retrieves the current background color for the pager control
00116     //
00117     COLORREF GetBkColor();
00118
00119     // Sets the current border size for the pager control
00120     //
00121     int SetBorder(
00122         // INT value that contains the new size of the
00123         // border, in pixels
00124         int iBorder);
00125
00126     // Retrieves the current border size for the pager control
00127     //
00128     int GetBorder();
00129
00130     // Sets the scroll position for the pager control
00131     //
00132     int SetPos(
00133         // INT value that contains the new scroll position, in pixels
00134         int iPos);
00135
00136     // Retrieves the current scroll position of the pager control
00137     //
00138     int GetPos();
00139
00140     // Sets the current button size for the pager control
00141     //
00142     int SetButtonSize(
00143         // INT value that contains the new button size, in pixels
00144         int iSize);
00145
00146     // Retrieves the current button size for the pager control
00147     //
00148     int GetButtonSize();
00149
00150     // Retrieves the state of the specified button in a pager control
00151     //
00152     DWORD GetButtonState(
00153         // Indicates which button to retrieve the state for
00154         int iButton);
00155
00156     // Retrieves a pager control's IDropTarget interface pointer
00157     //
00158     void GetDropTarget(
00159         // Address of an IDropTarget pointer that receives the
00160         // interface pointer
00161         IDropTarget **ppdt);
00162
00163 // Overrides
00164     // ClassWizard generated virtual function overrides
00165     //{{AFX_VIRTUAL(CCJPagerCtrl)
00166     public:
00167     virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
00168     //}}AFX_VIRTUAL
00169
00170     // Generated message map functions
00171 protected:
00172     //{{AFX_MSG(CCJPagerCtrl)
00173     virtual BOOL OnPagerScroll(NMPGSCROLL* pNMPGScroll, LRESULT * pResult);
00174     virtual BOOL OnPagerCalcSize(NMPGCALCSIZE * pNMPGCalcSize, LRESULT* pResult);
00175     //}}AFX_MSG
00176     DECLARE_MESSAGE_MAP()
00177 };
00178
00180 //  Inline Functions
00182
00183 _CJXLIB_INLINE void CCJPagerCtrl::SetScrollArea (int nWidth, int nHeight)
00184     { ASSERT(::IsWindow(m_hWnd)); m_nWidth  = nWidth; m_nHeight = nHeight; }
00185
00186 _CJXLIB_INLINE void CCJPagerCtrl::SetChild(HWND hwndChild)
00187     { ASSERT(::IsWindow(m_hWnd)); Pager_SetChild(m_hWnd, hwndChild); }
00188
00189 _CJXLIB_INLINE void CCJPagerCtrl::RecalcSize()
00190     { ASSERT(::IsWindow(m_hWnd)); Pager_RecalcSize(m_hWnd); }
00191
00192 _CJXLIB_INLINE void CCJPagerCtrl::ForwardMouse(BOOL bForward)
00193     { ASSERT(::IsWindow(m_hWnd)); Pager_ForwardMouse(m_hWnd, bForward); }
00194
00195 _CJXLIB_INLINE COLORREF CCJPagerCtrl::SetBkColor(COLORREF clr)
00196     { ASSERT(::IsWindow(m_hWnd)); return Pager_SetBkColor(m_hWnd, clr); }
00197
00198 _CJXLIB_INLINE COLORREF CCJPagerCtrl::GetBkColor()
00199     { ASSERT(::IsWindow(m_hWnd)); return Pager_GetBkColor(m_hWnd); }
00200
00201 _CJXLIB_INLINE int CCJPagerCtrl::SetBorder(int iBorder)
00202     { ASSERT(::IsWindow(m_hWnd)); return Pager_SetBorder(m_hWnd, iBorder); }
00203
00204 _CJXLIB_INLINE int CCJPagerCtrl::GetBorder()
00205     { ASSERT(::IsWindow(m_hWnd)); return Pager_GetBorder(m_hWnd); }
00206
00207 _CJXLIB_INLINE int CCJPagerCtrl::SetPos(int iPos)
00208     { ASSERT(::IsWindow(m_hWnd)); return Pager_SetPos(m_hWnd, iPos); }
00209
00210 _CJXLIB_INLINE int CCJPagerCtrl::GetPos()
00211     { ASSERT(::IsWindow(m_hWnd)); return Pager_GetPos(m_hWnd); }
00212
00213 _CJXLIB_INLINE int CCJPagerCtrl::SetButtonSize(int iSize)
00214     { ASSERT(::IsWindow(m_hWnd)); return Pager_SetButtonSize(m_hWnd, iSize); }
00215
00216 _CJXLIB_INLINE int CCJPagerCtrl::GetButtonSize()
00217     { ASSERT(::IsWindow(m_hWnd)); return Pager_GetButtonSize(m_hWnd); }
00218
00219 _CJXLIB_INLINE DWORD CCJPagerCtrl::GetButtonState(int iButton)
00220     { ASSERT(::IsWindow(m_hWnd)); return Pager_GetButtonState(m_hWnd, iButton); }
00221
00222 _CJXLIB_INLINE void CCJPagerCtrl::GetDropTarget(IDropTarget **ppdt)
00223     { ASSERT(::IsWindow(m_hWnd)); Pager_GetDropTarget(m_hWnd, ppdt); }
00224
00225 #ifndef PGM_SETCHILD
00226 #error CJPagerCtrl requires a newer version of the SDK than you have!
00227 #error Please update your SDK files.
00228 #endif
00229
00231
00232 //{{AFX_INSERT_LOCATION}}
00233 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00234
00235 #endif // __CJPAGERCTRL_H__
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJReBar.h Source File

WinCvs/CJLib/Include/CJReBar.h

Go to the documentation of this file.
00001 // CJReBar.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new IE4 controls'
00007 // http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/Include/CJReBar.h $
00015  *
00016  * $History: CJReBar.h $
00017  *
00018  * *****************  Version 8  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/Include
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 7  *****************
00024  * User: Kirk Stowell Date: 7/31/99    Time: 4:27p
00025  * Updated in $/CodeJockey/Include
00026  *
00027  * *****************  Version 5  *****************
00028  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00029  * Updated in $/CodeJockey/Include
00030  *
00031  * *****************  Version 4  *****************
00032  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00033  * Updated in $/CodeJockey/Include
00034  *
00035  * *****************  Version 3  *****************
00036  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00037  * Updated in $/CodeJockey/Include
00038  *
00039  * *****************  Version 2  *****************
00040  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00041  * Updated in $/CodeJockey/Include
00042  * Cleaned up inline functions, and import/export macro so that class will
00043  * be imported when linked to, and exported at compile time.
00044  *
00045  * *****************  Version 1  *****************
00046  * User: Kirk Stowell Date: 7/14/99    Time: 10:29p
00047  * Created in $/CodeJockey/Include
00048  * Copied from MFC v6 and techno preview for v5. Added to extend
00049  * functionality to Visual C++ 5.0 users.
00050  *
00051  ***************************************************************************/
00053
00054 #ifndef __CJREBAR_H__
00055 #define __CJREBAR_H__
00056
00057 #include "CJToolBarBase.h"
00058
00059 #ifdef _VC_VERSION_5
00060 #define AFX_IDW_REBAR       0xE804  // COMCTL32 "rebar" Bar
00061 #define AFX_IDW_DIALOGBAR   0xE805  // CDialogBar
00062 #endif // _VC_VERSION_5
00063
00065
00066 class CCJReBarCtrl;
00067
00068 // A CCJReBar object is a control bar that provides layout, persistence, and state
00069 // information for rebar controls.
00070 class _CJX_EXT_CLASS CCJReBar : public CCJToolBarBase
00071 {
00072     DECLARE_DYNAMIC(CCJReBar)
00073
00074 // Construction
00075 public:
00076     CCJReBar();
00077     BOOL Create(CWnd* pParentWnd, DWORD dwCtrlStyle = RBS_BANDBORDERS,
00078         DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_TOP,
00079         UINT nID = AFX_IDW_REBAR);
00080
00081 // Attributes
00082 public:
00083     // for direct access to the underlying common control
00084     CCJReBarCtrl& GetReBarCtrl() const;
00085
00086 // Operations
00087 public:
00088     BOOL AddBar(CWnd* pBar, LPCTSTR pszText = NULL, CBitmap* pbmp = NULL,
00089         DWORD dwStyle = RBBS_GRIPPERALWAYS | RBBS_FIXEDBMP);
00090     BOOL AddBar(CWnd* pBar, COLORREF clrFore, COLORREF clrBack,
00091         LPCTSTR pszText = NULL, DWORD dwStyle = RBBS_GRIPPERALWAYS);
00092
00093 // Implementation
00094     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
00095     virtual int OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
00096     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
00097     virtual CSize CalcDynamicLayout(int nLength, DWORD nMode);
00098 #ifdef _DEBUG
00099     void EnableDocking(DWORD dwDockStyle);
00100 #endif
00101
00102 protected:
00103     virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
00104     BOOL _AddBar(CWnd* pBar, REBARBANDINFO* pRBBI);
00105
00106     //{{AFX_MSG(CCJReBar)
00107     afx_msg BOOL OnNcCreate(LPCREATESTRUCT);
00108     afx_msg void OnPaint();
00109     afx_msg void OnHeightChange(NMHDR* pNMHDR, LRESULT* pResult);
00110     afx_msg void OnNcPaint();
00111     afx_msg void OnNcCalcSize(BOOL, NCCALCSIZE_PARAMS*);
00112     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00113     afx_msg LRESULT OnShowBand(WPARAM wParam, LPARAM lParam);
00114     afx_msg void OnRecalcParent();
00115     //}}AFX_MSG
00116     DECLARE_MESSAGE_MAP()
00117 };
00118
00120 // Inline functions
00122
00123 _CJXLIB_INLINE CCJReBarCtrl& CCJReBar::GetReBarCtrl() const
00124     { return *(CCJReBarCtrl*)this; }
00125
00126 #endif //__CJREBAR_H__
00127
00129
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJReBarCtrl.h Source File

WinCvs/CJLib/Include/CJReBarCtrl.h

Go to the documentation of this file.
00001 // CJReBarCtrl.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new IE4 controls'
00007 // http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/Include/CJReBarCtrl.h $
00015  *
00016  * $History: CJReBarCtrl.h $
00017  *
00018  * *****************  Version 7  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/Include
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 6  *****************
00024  * User: Kirk Stowell Date: 7/31/99    Time: 4:27p
00025  * Updated in $/CodeJockey/Include
00026  *
00027  * *****************  Version 4  *****************
00028  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00029  * Updated in $/CodeJockey/Include
00030  *
00031  * *****************  Version 3  *****************
00032  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00033  * Updated in $/CodeJockey/Include
00034  *
00035  * *****************  Version 2  *****************
00036  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00037  * Updated in $/CodeJockey/Include
00038  * Cleaned up inline functions, and import/export macro so that class will
00039  * be imported when linked to, and exported at compile time.
00040  *
00041  * *****************  Version 1  *****************
00042  * User: Kirk Stowell Date: 7/14/99    Time: 10:29p
00043  * Created in $/CodeJockey/Include
00044  * Copied from MFC v6 and techno preview for v5. Added to extend
00045  * functionality to Visual C++ 5.0 users.
00046  *
00047  ***************************************************************************/
00049
00050 #ifndef __CJREBARCTRL_H__
00051 #define __CJREBARCTRL_H__
00052
00054
00055   class CImageList;
00056   class CToolTipCtrl;
00057
00058 // The CCJReBarCtrl class encapsulates the functionality of a rebar control,
00059 // which is a container for a child window. The application in which the rebar
00060 // control resides assigns the child window contained by the rebar control to the
00061 // rebar band. The child window is usually another common control.
00062 class _CJX_EXT_CLASS CCJReBarCtrl : public CWnd
00063 {
00064   DECLARE_DYNAMIC(CCJReBarCtrl)
00065
00066 // Construction
00067 public:
00068   CCJReBarCtrl();
00069   BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
00070
00071 // Attributes
00072 public:
00073   UINT GetBandCount() const;
00074   BOOL GetBandInfo(UINT uBand, REBARBANDINFO* prbbi) const;
00075   UINT GetBarHeight() const;
00076   BOOL GetBarInfo(REBARINFO* prbi) const;
00077   COLORREF GetBkColor() const;
00078   IDropTarget* GetDropTarget() const;
00079   BOOL GetRect(UINT uBand, LPRECT prc) const;
00080   UINT GetRowCount() const;
00081   UINT GetRowHeight(UINT uRow) const;
00082   COLORREF GetTextColor() const;
00083   CToolTipCtrl* GetToolTips() const;
00084   int IDToIndex(UINT uBandID) const;
00085   BOOL SetBandInfo(UINT uBand, REBARBANDINFO* prbbi);
00086   BOOL SetBarInfo(REBARINFO* prbi);
00087   COLORREF SetBkColor(COLORREF clr);
00088   CWnd* SetOwner(CWnd* pWnd);
00089   COLORREF SetTextColor(COLORREF clr);
00090   void SetToolTips(CToolTipCtrl* pToolTip);
00091   CImageList* GetImageList() const;
00092   BOOL SetImageList(CImageList* pImageList);
00093   void GetBandBorders(UINT uBand, LPRECT prc) const;
00094   CPalette* GetPalette() const;
00095   CPalette* SetPalette(HPALETTE hPal);
00096   BOOL GetColorScheme(COLORSCHEME* lpcs);
00097   void SetColorScheme(const COLORSCHEME* lpcs);
00098
00099 // Operations
00100 public:
00101   void BeginDrag(UINT uBand, DWORD dwPos = (DWORD)-1);
00102   BOOL DeleteBand(UINT uBand);
00103   void DragMove(DWORD dwPos = (DWORD)-1);
00104   void EndDrag();
00105   int HitTest(RBHITTESTINFO* prbht);
00106   BOOL InsertBand(UINT uIndex, REBARBANDINFO* prbbi);
00107   void MaximizeBand(UINT uBand);
00108   void MinimizeBand(UINT uBand);
00109   BOOL ShowBand(UINT uBand, BOOL fShow = TRUE);
00110   BOOL SizeToRect(CRect& rect);
00111   BOOL MoveBand(UINT uFrom, UINT uTo);
00112 };
00113
00115 //  Inline Functions
00117
00118 _CJXLIB_INLINE UINT CCJReBarCtrl::GetBandCount() const
00119     { ASSERT(::IsWindow(m_hWnd)); return (UINT) ::SendMessage(m_hWnd, RB_GETBANDCOUNT, 0, 0L); }
00120
00121 _CJXLIB_INLINE BOOL CCJReBarCtrl::GetBandInfo(UINT uBand, REBARBANDINFO* prbbi) const
00122     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_GETBANDINFO, uBand, (LPARAM)prbbi); }
00123
00124 _CJXLIB_INLINE UINT CCJReBarCtrl::GetBarHeight() const
00125     { ASSERT(::IsWindow(m_hWnd)); return (UINT) ::SendMessage(m_hWnd, RB_GETBARHEIGHT, 0, 0L); }
00126
00127 _CJXLIB_INLINE BOOL CCJReBarCtrl::GetBarInfo(REBARINFO* prbi) const
00128     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_GETBARINFO, 0, (LPARAM)prbi); }
00129
00130 _CJXLIB_INLINE COLORREF CCJReBarCtrl::GetBkColor() const
00131     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, RB_GETBKCOLOR, 0, 0L); }
00132
00133 _CJXLIB_INLINE IDropTarget* CCJReBarCtrl::GetDropTarget() const
00134     { ASSERT(::IsWindow(m_hWnd)); IDropTarget* pdt; ::SendMessage(m_hWnd, RB_GETDROPTARGET, 0, (LPARAM)&pdt); return pdt; }
00135
00136 _CJXLIB_INLINE BOOL CCJReBarCtrl::GetRect(UINT uBand, LPRECT prc) const
00137     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_GETRECT, uBand, (LPARAM)prc); }
00138
00139 _CJXLIB_INLINE UINT CCJReBarCtrl::GetRowCount() const
00140     { ASSERT(::IsWindow(m_hWnd)); return (UINT) ::SendMessage(m_hWnd, RB_GETROWCOUNT, 0, 0L); }
00141
00142 _CJXLIB_INLINE UINT CCJReBarCtrl::GetRowHeight(UINT uRow) const
00143     { ASSERT(::IsWindow(m_hWnd)); return (UINT) ::SendMessage(m_hWnd, RB_GETROWHEIGHT, uRow, 0L); }
00144
00145 _CJXLIB_INLINE COLORREF CCJReBarCtrl::GetTextColor() const
00146     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, RB_GETTEXTCOLOR, 0, 0L); }
00147
00148 _CJXLIB_INLINE CToolTipCtrl* CCJReBarCtrl::GetToolTips() const
00149     { ASSERT(::IsWindow(m_hWnd)); return (CToolTipCtrl*)CWnd::FromHandle((HWND)::SendMessage(m_hWnd, RB_GETTOOLTIPS, 0, 0L)); }
00150
00151 _CJXLIB_INLINE int CCJReBarCtrl::IDToIndex(UINT uBandID) const
00152     { ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, RB_IDTOINDEX, uBandID, 0L); }
00153
00154 _CJXLIB_INLINE BOOL CCJReBarCtrl::SetBandInfo(UINT uBand, REBARBANDINFO* prbbi)
00155     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_SETBANDINFO, uBand, (LPARAM)prbbi); }
00156
00157 _CJXLIB_INLINE BOOL CCJReBarCtrl::SetBarInfo(REBARINFO* prbi)
00158     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_SETBARINFO, 0, (LPARAM)prbi); }
00159
00160 _CJXLIB_INLINE COLORREF CCJReBarCtrl::SetBkColor(COLORREF clr)
00161     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, RB_SETBKCOLOR, 0, (LPARAM)clr); }
00162
00163 _CJXLIB_INLINE CWnd* CCJReBarCtrl::SetOwner(CWnd* pWnd)
00164     { ASSERT(::IsWindow(m_hWnd)); return CWnd::FromHandle((HWND)::SendMessage(m_hWnd, RB_SETPARENT, (WPARAM)pWnd->m_hWnd, 0L)); }
00165
00166 _CJXLIB_INLINE COLORREF CCJReBarCtrl::SetTextColor(COLORREF clr)
00167     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, RB_SETTEXTCOLOR, 0, (LPARAM)clr); }
00168
00169 _CJXLIB_INLINE void CCJReBarCtrl::SetToolTips(CToolTipCtrl* pToolTip)
00170     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_SETTOOLTIPS, (WPARAM)pToolTip->m_hWnd, 0L); }
00171
00172 _CJXLIB_INLINE void CCJReBarCtrl::GetBandBorders(UINT uBand, LPRECT prc) const
00173     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_GETBANDBORDERS, uBand, (LPARAM)prc); }
00174
00175 _CJXLIB_INLINE CPalette* CCJReBarCtrl::GetPalette() const
00176     { ASSERT(::IsWindow(m_hWnd)); return CPalette::FromHandle((HPALETTE)::SendMessage(m_hWnd, RB_GETPALETTE, 0, 0L)); }
00177
00178 _CJXLIB_INLINE CPalette* CCJReBarCtrl::SetPalette(HPALETTE hPal)
00179     { ASSERT(::IsWindow(m_hWnd)); return CPalette::FromHandle((HPALETTE)::SendMessage(m_hWnd, RB_SETPALETTE, 0, (LPARAM)hPal)); }
00180
00181 _CJXLIB_INLINE void CCJReBarCtrl::BeginDrag(UINT uBand, DWORD dwPos)
00182     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_BEGINDRAG, uBand, dwPos); }
00183
00184 _CJXLIB_INLINE BOOL CCJReBarCtrl::DeleteBand(UINT uBand)
00185     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_DELETEBAND, uBand, 0L); }
00186
00187 _CJXLIB_INLINE void CCJReBarCtrl::DragMove(DWORD dwPos)
00188     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_DRAGMOVE, 0, dwPos); }
00189
00190 _CJXLIB_INLINE void CCJReBarCtrl::EndDrag()
00191     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_ENDDRAG, 0, 0L); }
00192
00193 _CJXLIB_INLINE int CCJReBarCtrl::HitTest(RBHITTESTINFO* prbht)
00194     { ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, RB_HITTEST, 0, (LPARAM)prbht); }
00195
00196 _CJXLIB_INLINE BOOL CCJReBarCtrl::InsertBand(UINT uIndex, REBARBANDINFO* prbbi)
00197     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_INSERTBAND, uIndex, (LPARAM)prbbi); }
00198
00199 _CJXLIB_INLINE void CCJReBarCtrl::MaximizeBand(UINT uBand)
00200     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_MAXIMIZEBAND, uBand, 0L); }
00201
00202 _CJXLIB_INLINE void CCJReBarCtrl::MinimizeBand(UINT uBand)
00203     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_MINIMIZEBAND, uBand, 0L); }
00204
00205 _CJXLIB_INLINE BOOL CCJReBarCtrl::ShowBand(UINT uBand, BOOL fShow)
00206     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_SHOWBAND, uBand, fShow); }
00207
00208 _CJXLIB_INLINE BOOL CCJReBarCtrl::SizeToRect(CRect& rect)
00209     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_SIZETORECT, 0, (LPARAM)&rect); }
00210
00211 _CJXLIB_INLINE BOOL CCJReBarCtrl::MoveBand(UINT uFrom, UINT uTo)
00212     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_MOVEBAND, uFrom, uTo); }
00213
00214 #endif //__CJREBARCTRL_H__
00215
00217
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJResource.h Source File

WinCvs/CJLib/Include/CJResource.h

Go to the documentation of this file.
00001 //{{NO_DEPENDENCIES}}
00002 // Microsoft Developer Studio generated include file.
00003 // Used by CJResource.rc
00004 //
00005 #define IDR_POPUP_HEX_EDIT              103
00006 #define IDS_HIDE                        5000
00007 #define IDC_NODRAGGING                  5001
00008 #define IDS_NAME                        5001
00009 #define IDS_EXPAND                      5002
00010 #define IDC_DRAGGING                    5003
00011 #define IDS_SIZE                        5003
00012 #define IDS_CONTRACT                    5004
00013 #define IDC_HANDCUR                     5005
00014 #define IDS_TYPE                        5005
00015 #define IDB_BUTTON_IMAGES               5006
00016 #define IDS_MODIFIED                    5006
00017 #define IDC_TAB_CONTROL                 5007
00018 #define IDS_REGKEY                      5007
00019 #define IDR_CBAR_POPUP                  5008
00020 #define IDS_INVALID_VER                 5008
00021 #define IDC_URL_CODEJOCKEY              5009
00022 #define IDS_WIN_PLACEMENT               5009
00023 #define IDB_BTN_EXPLORER                5010
00024 #define IDS_COLOR_AUTO                  5010
00025 #define IDM_CBAR_MENU                   5011
00026 #define IDS_COLOR_CUST                  5011
00027 #define IDC_BUTTON_HIDE                 5012
00028 #define IDS_SECTION                     5012
00029 #define IDC_BUTTON_MINI                 5013
00030 #define IDS_ENTRY                       5013
00031 #define IDC_BAR_BUTTON                  5014
00032 #define IDS_REMOVEITEM                  5014
00033 #define IDC_BAR_CAPTION                 5015
00034 #define IDS_RENAMEITEM                  5015
00035 #define IDB_BTN_ARROW                   5016
00036 #define ID_GFX_LARGEICON                5017
00037 #define ID_GFX_SMALLICON                5018
00038 #define ID_GFX_REMOVEITEM               5019
00039 #define IDC_VSPLITBAR                   5020
00040 #define ID_GFX_RENAMEITEM               5021
00041 #define IDC_HSPLITBAR                   5022
00042 #define IDR_GFXOUTBAR                   5023
00043 #define IDR_POPUP_TOOLBAR               5024
00044 #define IDS_SETTINGS                    5025
00045 #define IDS_TBAR_SETTINGS               5026
00046 #define ID_POPUP_CUSTOMIZE              5027
00047 #define IDS_WNDPOS                      5028
00048 #define IDC_CAPT_BUTTON                 5029
00049 #define IDB_PUSHPIN                     5030
00050 #define IDC_LEFTBUTTON                  5031
00051 #define IDC_RIGHTBUTTON                 5032
00052 #define IDC_HOMEBUTTON                  5033
00053 #define IDC_ENDBUTTON                   5034
00054
00055 // Next default values for new objects
00056 //
00057 #ifdef APSTUDIO_INVOKED
00058 #ifndef APSTUDIO_READONLY_SYMBOLS
00059 #define _APS_NEXT_RESOURCE_VALUE        5032
00060 #define _APS_NEXT_COMMAND_VALUE         32773
00061 #define _APS_NEXT_CONTROL_VALUE         5030
00062 #define _APS_NEXT_SYMED_VALUE           101
00063 #endif
00064 #endif
Generated on Sun Oct 21 12:41:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJShell.h Source File

WinCvs/CJLib/Include/CJShell.h

Go to the documentation of this file.
00001 // CJShell.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based upon the MFCENUM example. MFCENUM is a companion sample application
00006 // for Chapter 14 in "Programming the Windows 95 User Interface" by Nancy Cluts,
00007 // available in the Microsoft(R) Development Library.
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJock/Include/CJShell.h $
00015  *
00016  * $History: CJShell.h $
00017  *
00018  * *****************  Version 13  *****************
00019  * User: Kirk Stowell Date: 10/26/99   Time: 10:46p
00020  * Updated in $/CodeJock/Include
00021  * Made class methods virtual for inheritance purposes.
00022  *
00023  * *****************  Version 12  *****************
00024  * User: Kirk Stowell Date: 10/24/99   Time: 12:01a
00025  * Updated in $/CodeJock/Include
00026  * Fixed potential resource and memory leak problems.
00027  *
00028  * *****************  Version 11  *****************
00029  * User: Kirk Stowell Date: 10/14/99   Time: 10:25a
00030  * Updated in $/CodeJock/Include
00031  * Added four new shell methods which deal with PIDL's including a new
00032  * version of an Explorer context menu called DoExplorerMenu(...) which
00033  * can be used in place of the existing DoTheMenuThing(...) method.
00034  *
00035  * *****************  Version 10  *****************
00036  * User: Kirk Stowell Date: 9/13/99    Time: 5:52a
00037  * Updated in $/CodeJockey/Include
00038  * Fixed build errors which occured with UNICODE builds.
00039  *
00040  * *****************  Version 9  *****************
00041  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00042  * Updated in $/CodeJockey/Include
00043  * Updated copyright and contact information.
00044  *
00045  * *****************  Version 8  *****************
00046  * User: Kirk Stowell Date: 8/29/99    Time: 9:14p
00047  * Updated in $/CodeJockey/Include
00048  * Added Unicode compliance, thanks to Barry Burton for his help with
00049  * this.
00050  *
00051  *
00052  * *****************  Version 5  *****************
00053  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00054  * Updated in $/CodeJockey/Include
00055  *
00056  * *****************  Version 4  *****************
00057  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00058  * Updated in $/CodeJockey/Include
00059  * Cleaned up inline functions, and import/export macro so that class will
00060  * be imported when linked to, and exported at compile time.
00061  *
00062  * *****************  Version 3  *****************
00063  * User: Kirk Stowell Date: 6/11/99    Time: 10:06p
00064  * Updated in $/CodeJockey/Include
00065  * Renamed class from CCJShellFile to CCJShell.
00066  *
00067  * *****************  Version 2  *****************
00068  * User: Kirk Stowell Date: 5/02/99    Time: 3:38p
00069  * Updated in $/CodeJockey/Include
00070  * Added version macro  _WIN32_IE, you will need to have at IE4 or greater
00071  * installed to use this class. This will ensure that the version of
00072  * SHELL32.DLL is compatible.
00073  *
00074  * *****************  Version 1  *****************
00075  * User: Kirk Stowell Date: 3/19/99    Time: 11:01p
00076  * Created in $/CodeJockey/Include
00077  * Initial re-write and release.
00078  *
00079  ***************************************************************************/
00081
00082 #ifndef __CJSHELL_H__
00083 #define __CJSHELL_H__
00084
00085 #if _WIN32_IE >= 0x0400 // Need to have at IE4 or greater installed.
00086
00087 #if _MSC_VER > 1000
00088 #pragma once
00089 #endif // _MSC_VER > 1000
00090
00091 #include <shlobj.h>
00092
00093 #define WM_SHELL_NOTIFY     WM_USER + 1
00094 #define NM_SH_SHELLMENU     1
00095
00096 // helper struct that holds list item data
00097 typedef struct tagLVID
00098 {
00099    LPSHELLFOLDER lpsfParent;
00100    LPITEMIDLIST  lpi;
00101    ULONG         ulAttribs;
00102 } LVITEMDATA, *LPLVITEMDATA;
00103
00104 // helper struct that holds tree item data
00105 typedef struct tagTVID
00106 {
00107    LPSHELLFOLDER lpsfParent;
00108    LPITEMIDLIST  lpi;
00109    LPITEMIDLIST  lpifq;
00110 } TVITEMDATA, *LPTVITEMDATA;
00111
00112 // CCJShell class is used to perform shell file operations
00113 class _CJX_EXT_CLASS CCJShell
00114 {
00115
00116 public:
00117
00118     // Default constructor
00119     //
00120     CCJShell(LPCTSTR lpszFileName=NULL);
00121
00122     // Virtual destructor
00123     //
00124     virtual ~CCJShell();
00125
00126 public:
00127
00128     int         m_iImageIndex;  // index into system image list
00129     CString     m_strPath;      // full file path used with BrowseForFolder(...)
00130     CString     m_strInitDir;   // start directory used with BrowseForFolder(...)
00131     CString     m_strSelDir;    // selected directory used with BrowseForFolder(...)
00132     CString     m_strTitle;     // dialog title used with BrowseForFolder(...)
00133
00134 protected:
00135
00136     CString     m_strFileName;          // contains the full path to a file or folder
00137     char        m_szDrive[_MAX_DRIVE];  // contains the drive letter
00138     char        m_szDir[_MAX_DIR];      // contains the directory string
00139     char        m_szFname[_MAX_FNAME];  // contains the file name minus path and ext
00140     char        m_szExt[_MAX_EXT];      // contains the file extension
00141
00142 public:
00143     virtual void SplitPath(CString strFileName, char* szDrive, char* szDir, char* szFile, char* szExt);
00144
00145     // this member function is used to retrieve a key from the registry
00146     //
00147     virtual LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
00148
00149     // this member funciont is used to perform execute command
00150     //
00151     virtual HINSTANCE ShellExec(LPCTSTR lpszExec, int nShow);
00152
00153     // this member function returns the size of the file formatted in KB.
00154     //
00155     virtual CString GetFileSizeString(
00156         // a string containing the system file size
00157         LPCTSTR lpszFileSize);
00158
00159     // this member function returns a formatted string for the last
00160     // time file was written to.
00161     //
00162     virtual CString GetLastWriteTime(
00163         // points to a CTime object
00164         CTime* pTime);
00165
00166     // retrieves the path only of the current filename. if the filename
00167     // is "c:\incoming\hello.txt", this function returns "c:"
00168     //
00169     virtual CString GetFileDrive(
00170         // full path of file name to parse
00171         LPCTSTR lpszFileName=NULL);
00172
00173     // this member function determines whether a file or directory exists.
00174     //
00175     virtual BOOL Exist(
00176         // full path of file or directory name
00177         LPCTSTR lpszFileName=NULL);
00178
00179     // this member function returns the icon index of the file or folder
00180     //
00181     virtual int GetIconIndex(
00182         // full path of file or directory name.
00183         LPCTSTR lpszFileName=NULL,
00184         // can be large or small icon
00185         UINT uFlags=SHGFI_SMALLICON);
00186
00187     // this member function returns the system display name for the file.
00188     //
00189     virtual CString GetDisplayName(
00190         // full path of file or directory name.
00191         LPCTSTR lpszFileName=NULL);
00192
00193     // this member function returns the system description for the file.
00194     //
00195     virtual CString GetFileType(
00196         // full path of file or directory name.
00197         LPCTSTR lpszFileName=NULL);
00198
00199     // this member function retrieves the file extension. if the filename is
00200     // "c:\incoming\hello.txt", this function returns "txt".
00201     //
00202     virtual CString GetFileExt(
00203         // full path of file or directory name.
00204         LPCTSTR lpszFileName=NULL);
00205
00206     // this member function retrieves the title of the filename excluding
00207     // the path and extension. if the filename is "c:\incoming\hello.txt",
00208     // this function returns "hello".
00209     //
00210     virtual CString GetFileTitle(
00211         // full path of file or directory name.
00212         LPCTSTR lpszFileName=NULL);
00213
00214     // this member function retrieves the path only of the current filename.
00215     // if the filename is "c:\incoming\hello.txt", this function returns "c:\incoming\".
00216     //
00217     virtual CString GetRoot(
00218         // full path of file or directory name.
00219         LPCTSTR lpszFileName=NULL);
00220
00221     // this member function retrieves current filename minus the path if the
00222     // filename is "c:\incoming\hello.txt", this function returns "hello.txt".
00223     //
00224     virtual CString GetFileName(
00225         // full path of file or directory name.
00226         LPCTSTR lpszFileName=NULL);
00227
00228     // this member function returns the system image list for small and large icons.
00229     // if you use this method, you must call CImageList::Detach() for both
00230     // image lists
00231     //
00232     virtual void GetSystemImageList(
00233         // points to a CImageList object that contains small icons
00234         CImageList* pSmallList,
00235         // points to a CImageList object that contains large icons
00236         CImageList* pLargeList);
00237
00238     // this member function displays browse for folder dialog.
00239     //
00240     virtual BOOL BrowseForFolder(
00241         // points to the parent window
00242         CWnd* pParentWnd);
00243
00244     // callback function for the BrowseForFolder method.
00245     //
00246     static int CALLBACK BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
00247
00248 // FUNCTIONS THAT DEAL WITH PIDLs
00249
00250     // this member function gets the next PIDL in the list
00251     //
00252     virtual LPITEMIDLIST Next(LPCITEMIDLIST pidl);
00253
00254     // this member function gets the size of the PIDL
00255     //
00256     virtual UINT GetSize(LPCITEMIDLIST pidl);
00257
00258     // this member function allocates a PIDL
00259     //
00260     virtual LPITEMIDLIST Create(UINT cbSize);
00261
00262     // this member function concatenates two PIDLs
00263     //
00264     virtual LPITEMIDLIST ConcatPidls(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
00265
00266     // this member function copies the ITEMID
00267     //
00268     virtual LPITEMIDLIST CopyITEMID(LPMALLOC lpMalloc, LPITEMIDLIST lpi);
00269
00270     // this member function gets the friendly name for the folder
00271     //
00272     virtual BOOL GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPTSTR lpFriendlyName);
00273
00274     // this member function gets the Fully qualified Pidls for the folder
00275     //
00276     virtual LPITEMIDLIST GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi);
00277
00278     // this member function Displays a popup context menu, given a parent shell folder,
00279     // relative item id and screen location. returns TRUE on success, FALSE on failure
00280     //
00281     virtual BOOL DoTheMenuThing(
00282         // parent window handle
00283         HWND hwnd,
00284         // pointer to parent shell folder
00285         LPSHELLFOLDER lpsfParent,
00286         // pointer to item id that is relative to lpsfParent
00287         LPITEMIDLIST lpi,
00288         // screen location of where to popup the menu
00289         LPPOINT lppt);
00290
00291     // this member function gets the index for the current icon. Index is
00292     // index into system image list. returns icon index for current item.
00293     //
00294     virtual int GetIcon(
00295         // fully qualified item id list for current item.
00296         LPITEMIDLIST lpi,
00297         // flags for SHGetFileInfo()
00298         UINT uFlags);
00299
00300     // this member function gets the index for the normal and
00301     // selected icons for the current item.
00302     //
00303     virtual void GetNormalAndSelectedIcons(
00304         // fully qualified item id list for current item.
00305         LPITEMIDLIST lpifq,
00306         // pointer to treeview item we are about to add to the tree.
00307         LPTV_ITEM lptvitem);
00308
00309     // Makes a copy of the next item in an item ID list. Returns pointer to
00310     // an ITEMIDLIST containing the copied item ID.
00311     //
00312     virtual LPITEMIDLIST DuplicateItem (
00313         // Pointer to an IMalloc interface.
00314         LPMALLOC pMalloc,
00315         // Pointer to an item ID list.
00316         LPITEMIDLIST pidl);
00317
00318     // Finds the next item in an item ID list. Returns pointer to the next item.
00319     //
00320     virtual LPITEMIDLIST GetNextItem (
00321         // Pointer to an item ID list.
00322         LPITEMIDLIST pidl);
00323
00324     // Computes the number of item IDs in an item ID list. Returns number
00325     // of item IDs in the list.
00326     virtual UINT GetItemCount (
00327         // Pointer to an item ID list.
00328         LPITEMIDLIST pidl);
00329
00330     // Given a path name to a file or folder object, displays the shell's context
00331     // menu for that object and executes the menu command (if any) selected by the user.
00332     //
00333     virtual BOOL DoExplorerMenu (
00334         // Handle of the window in which the menu will be displayed.
00335         HWND hwnd,
00336         // Pointer to an ANSI or Unicode string specifying the path to the object.
00337         LPCTSTR pszPath,
00338         // x and y coordinates of the point where the menu's upper left corner should be
00339         // located, in client coordinates relative to hwnd.
00340         POINT point);
00341 };
00342
00344
00345 #endif // _WIN32_IE >= 0x0400
00346 #endif // __CJSHELL_H__
00347
Generated on Sun Oct 21 12:41:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJShellList.h Source File

WinCvs/CJLib/Include/CJShellList.h

Go to the documentation of this file.
00001 // CJShellList.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based upon the MFCENUM example. MFCENUM is a companion sample application
00006 // for Chapter 14 in "Programming the Windows 95 User Interface" by Nancy Cluts,
00007 // available in the Microsoft(R) Development Library.
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJock/Include/CJShellList.h $
00015  *
00016  * $History: CJShellList.h $
00017  *
00018  * *****************  Version 9  *****************
00019  * User: Kirk Stowell Date: 10/26/99   Time: 10:46p
00020  * Updated in $/CodeJock/Include
00021  * Made class methods virtual for inheritance purposes.
00022  *
00023  * *****************  Version 8  *****************
00024  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00025  * Updated in $/CodeJockey/Include
00026  * Updated copyright and contact information.
00027  *
00028  * *****************  Version 7  *****************
00029  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00030  * Updated in $/CodeJockey/Include
00031  *
00032  * *****************  Version 6  *****************
00033  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00034  * Updated in $/CodeJockey/Include
00035  *
00036  * *****************  Version 5  *****************
00037  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00038  * Updated in $/CodeJockey/Include
00039  * Cleaned up inline functions, and import/export macro so that class will
00040  * be imported when linked to, and exported at compile time.
00041  *
00042  * *****************  Version 4  *****************
00043  * User: Kirk Stowell Date: 6/12/99    Time: 3:00a
00044  * Updated in $/CodeJockey/Include
00045  * Cleaned up image list, view initialization and sorting to use base
00046  * class virtual function SortList(...).
00047  *
00048  * *****************  Version 3  *****************
00049  * User: Kirk Stowell Date: 5/02/99    Time: 3:38p
00050  * Updated in $/CodeJockey/Include
00051  * Added version macro  _WIN32_IE, you will need to have at IE4 or greater
00052  * installed to use this class. This will ensure that the version of
00053  * SHELL32.DLL is compatible.
00054  *
00055  * *****************  Version 2  *****************
00056  * User: Kirk Stowell Date: 5/02/99    Time: 2:05a
00057  * Updated in $/CodeJockey/Include
00058  * Added flag m_bBuildingList, set to true whenever the list is refreshed
00059  * or initialized.
00060  *
00061  * *****************  Version 1  *****************
00062  * User: Kirk Stowell Date: 3/19/99    Time: 11:03p
00063  * Created in $/CodeJockey/Include
00064  * Initial release.
00065  *
00066  ***************************************************************************/
00068
00069 #ifndef __CJSHELLLIST_H__
00070 #define __CJSHELLLIST_H__
00071
00072 #if _WIN32_IE >= 0x0400 // Need to have at IE4 or greater installed.
00073
00074 #if _MSC_VER > 1000
00075 #pragma once
00076 #endif // _MSC_VER > 1000
00077
00078 #include "CJShell.h"
00079 #include "CJListCtrl.h"
00080
00081 // class forwards
00082 class CCJShellTree;
00083
00084 // CCJShellList is a CCJListCtrl derived class which is used to display
00085 // system files and folders, typically associated with a CCJShellTree object
00086 class _CJX_EXT_CLASS CCJShellList : public CCJListCtrl
00087 {
00088     DECLARE_DYNAMIC(CCJShellList)
00089
00090 public:
00091
00092     // Default constructor
00093     //
00094     CCJShellList();
00095
00096     // Virtual destructor
00097     //
00098     virtual ~CCJShellList();
00099
00100 public:
00101
00102     CCJShell        m_shell;            // used for shell operations
00103     CCJShellTree*   m_pTreeCtrl;        // points to a CCJShellTree that is associated with this control
00104     BOOL            m_bBuildingList;
00105     BOOL            m_bShowHidden;
00106
00107 public:
00108     virtual void BuildDefaultColumns();
00109
00110     // this member function rebuilds the current directory list.
00111     //
00112     virtual void RefreshList();
00113
00114     // call this member function to associate a CCJShellTree object with
00115     // this control
00116     //
00117     virtual void AssociateTree(CCJShellTree *pTreeCtrl);
00118
00119     // this member function is called to initialize the system image list
00120     // used by the list control
00121     //
00122     virtual BOOL InitSystemImageLists();
00123
00124     // this member function is called to initialize the list control items
00125     //
00126     virtual BOOL InitListViewItems(
00127         // Pointer to TreeView item data
00128         LPTVITEMDATA lptvid,
00129         // Pointer to parent shell folder
00130         LPSHELLFOLDER lpsf);
00131
00132     // this member function is called to actually populate the list control
00133     // items
00134     //
00135     virtual BOOL PopulateListView(LPTVITEMDATA lptvid, LPSHELLFOLDER lpsf);
00136
00137     // this member function is called to insert a single item into the
00138     // list control
00139     //
00140     virtual int InsertListItem(CString strFileName, BOOL bParse=TRUE);
00141
00142     // Callback routine for sorting list
00143     //
00144     static int CALLBACK ListViewCompareProc(LPARAM, LPARAM, LPARAM);
00145
00146     // override this member function in your derived class to
00147     // peform custom sort routines.
00148     //
00149     virtual bool SortList(
00150         // passed in from control, index of column clicked.
00151         int nCol,
00152         // passed in from control, true if sort order should be ascending.
00153         bool bAscending );
00154
00155 // Overrides
00156     // ClassWizard generated virtual function overrides
00157     //{{AFX_VIRTUAL(CCJShellList)
00158     //}}AFX_VIRTUAL
00159
00160     // Generated message map functions
00161 protected:
00162     //{{AFX_MSG(CCJShellList)
00163     afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
00164     afx_msg void OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
00165     afx_msg void OnGetdispinfo(NMHDR* pNMHDR, LRESULT* pResult);
00166     //}}AFX_MSG
00167     afx_msg long OnShellNotify(WPARAM wParam, LPARAM lParam);
00168
00169     DECLARE_MESSAGE_MAP()
00170 };
00171
00173 //  Inline Functions
00175
00176 _CJXLIB_INLINE void CCJShellList::AssociateTree(CCJShellTree *pTreeCtrl)
00177     { ASSERT( pTreeCtrl ); m_pTreeCtrl = pTreeCtrl; }
00178
00180
00181 //{{AFX_INSERT_LOCATION}}
00182 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00183
00184 #endif // _WIN32_IE >= 0x0400
00185 #endif // __CJSHELLLIST_H__
Generated on Sun Oct 21 12:41:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJShellTree.h Source File

WinCvs/CJLib/Include/CJShellTree.h

Go to the documentation of this file.
00001 // CJShellTree.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based upon the MFCENUM example. MFCENUM is a companion sample application
00006 // for Chapter 14 in "Programming the Windows 95 User Interface" by Nancy Cluts,
00007 // available in the Microsoft(R) Development Library.
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJock/Include/CJShellTree.h $
00015  *
00016  * $History: CJShellTree.h $
00017  *
00018  * *****************  Version 10  *****************
00019  * User: Kirk Stowell Date: 10/30/99   Time: 2:19p
00020  * Updated in $/CodeJock/Include
00021  * Changed base class from CTreeCtrl to CCJTreeCtrl for flicker free
00022  * drawing.
00023  *
00024  * *****************  Version 9  *****************
00025  * User: Kirk Stowell Date: 10/26/99   Time: 10:47p
00026  * Updated in $/CodeJock/Include
00027  * Made class methods virtual for inheritance purposes.
00028  *
00029  * *****************  Version 8  *****************
00030  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00031  * Updated in $/CodeJockey/Include
00032  * Updated copyright and contact information.
00033  *
00034  * *****************  Version 7  *****************
00035  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00036  * Updated in $/CodeJockey/Include
00037  *
00038  * *****************  Version 6  *****************
00039  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00040  * Updated in $/CodeJockey/Include
00041  *
00042  * *****************  Version 5  *****************
00043  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00044  * Updated in $/CodeJockey/Include
00045  * Cleaned up inline functions, and import/export macro so that class will
00046  * be imported when linked to, and exported at compile time.
00047  *
00048  * *****************  Version 4  *****************
00049  * User: Kirk Stowell Date: 6/11/99    Time: 10:14p
00050  * Updated in $/CodeJockey/Include
00051  * Cleaned up system image list initialization.
00052  *
00053  * *****************  Version 3  *****************
00054  * User: Kirk Stowell Date: 5/02/99    Time: 3:38p
00055  * Updated in $/CodeJockey/Include
00056  * Added version macro  _WIN32_IE, you will need to have at IE4 or greater
00057  * installed to use this class. This will ensure that the version of
00058  * SHELL32.DLL is compatible.
00059  *
00060  * *****************  Version 2  *****************
00061  * User: Kirk Stowell Date: 3/19/99    Time: 11:05p
00062  * Updated in $/CodeJockey/Include
00063  * Initial re-write and release.
00064  *
00065  * *****************  Version 1  *****************
00066  * User: Kirk Stowell Date: 2/24/99    Time: 11:05p
00067  * Created in $/CodeJockey/Include
00068  * Overloaded PopulateTree(LPCTSTR lpszPath) in the class CCJShellTree to
00069  * fill the tree based upon path. Takehiko Mizoguti
00070  * [mizoguti@m2.sys.to.casio.co.jp]
00071  *
00072  ***************************************************************************/
00074
00075 #ifndef __CJSHELLTREE_H__
00076 #define __CJSHELLTREE_H__
00077
00078 #if _WIN32_IE >= 0x0400 // Need to have at IE4 or greater installed.
00079
00080 #if _MSC_VER > 1000
00081 #pragma once
00082 #endif // _MSC_VER > 1000
00083
00084 #include "CJShell.h"
00085 #include "CJTreeCtrl.h"
00086
00087 // class forwards
00088 class CCJShellList;
00089
00090 // CCJShellTree is a CCJTreeCtrl derived class which is used to display
00091 // system files and folders, typically associated with a CCJShellList object
00092 class _CJX_EXT_CLASS CCJShellTree : public CCJTreeCtrl
00093 {
00094     DECLARE_DYNAMIC(CCJShellTree)
00095
00096 public:
00097
00098     // Default constructor
00099     //
00100     CCJShellTree();
00101
00102     // Virtual destructor
00103     //
00104     virtual ~CCJShellTree();
00105
00106 public:
00107
00108     CCJShell        m_shell;        // used for shell operations
00109     CCJShellList*   m_pListCtrl;    // CCJShellList that is associated with this control
00110     CComboBox*      m_pComboBox;    // CComboBox that is associated with this control see AssociateCombo(...)
00111     bool            m_bRefresh;     // true when the control is to be refreshed
00112     bool            m_bOutaHere;    // true when the control is destroyed
00113     HTREEITEM       m_htiCurrent;   // currently selected tree item
00114
00115     // enumeration that holds the type of object folder or drive
00116     //
00117     enum FindAttribs { type_drive, type_folder };
00118
00119 public:
00120
00121     // this member function obtains a handle to the system image
00122     // list and attaches it to the tree control. DO NOT DELETE the imagelist
00123     //
00124     virtual BOOL InitSystemImageLists();
00125
00126     // this member function fills a branch of the TreeView control. Given the
00127     // shell folder, enumerate the subitems of this folder,
00128     // and add the appropriate items to the tree.
00129     //
00130     // This function enumerates the items in the folder identifed by lpsf.
00131     // Note that since we are filling the left hand pane, we will only add
00132     // items that are folders and/or have sub-folders.  We *could* put all
00133     // items in here if we wanted, but that's not the intent.
00134     //
00135     virtual void FillTreeView(
00136         // pointer to shell folder that we want to enumerate items
00137         LPSHELLFOLDER lpsf,
00138         // fully qualified item id list to the item that we are enumerating
00139         // items for.  In other words, this is the PIDL to the item
00140         // identified by the lpsf parameter.
00141         LPITEMIDLIST lpifq,
00142         // parent node
00143         HTREEITEM hParent);
00144
00145     // this member function processes the File.Fill/RefreshTree command
00146     //
00147     virtual void OnFill(
00148         // true when refreshing tree
00149         bool bRefresh=false);
00150
00151     // this member function populates tree based upon path. this method was
00152     // written by Takehiko Mizoguti [mizoguti@m2.sys.to.casio.co.jp]
00153     //
00154     virtual void PopulateTree(
00155         // path to populate
00156         LPCTSTR lpszPath);
00157
00158     // this member function will "tunnel" the tree to find the specified path.
00159     // this will only work when the OnFill(...) method is used to populate the tree
00160     // written by Selom Ofori [sofori@chat.carleton.ca]
00161     //
00162     virtual void TunnelTree(
00163         // path to find
00164         CString szFindPath);
00165
00166     // this member function is used to associate a CComboBox object with the
00167     // control. whenever the path changes, the combo is updated.
00168     //
00169     virtual void AssociateCombo(
00170         // combo box to associate
00171         CComboBox *pComboBox);
00172
00173     // this member function is used to associate a CCJShellList object with the
00174     // control. whenever the path changes, the list is updated.
00175     //
00176     virtual void AssociateList(
00177         // list control to associate
00178         CCJShellList *pListCtrl);
00179
00180     // this member function retrieves the path of a folder item, does not have
00181     // to be selected. Pass a CString object that will hold the folder path.
00182     // If the path is not in the filesystem(eg MyComputer)
00183     // or none is selected it returns FALSE.
00184     //
00185     virtual BOOL GetFolderItemPath(
00186         // tree item to get path for
00187         HTREEITEM hItem,
00188         // reference to a CString object to contain folder path
00189         CString &strFolderPath);
00190
00191     // this member function retrieves the path of a folder item, does not have
00192     // to be selected. Pass a CString object that will hold the folder path.
00193     // If the path is not in the filesystem(eg MyComputer)
00194     // or none is selected it returns FALSE.
00195     // written by Selom Ofori [sofori@chat.carleton.ca]
00196     //
00197     virtual BOOL GetSelectedFolderPath(
00198         // reference to a CString object to contain folder path
00199         CString &strFolderPath);
00200
00201     // this member function searchs the tree for a specified folder
00202     // written by Selom Ofori [sofori@chat.carleton.ca]
00203     //
00204     virtual BOOL SearchTree(
00205         // tree item to begin search from
00206         HTREEITEM treeNode,
00207         // string to search for
00208         CString szSearchName,
00209         // looking for folder or drive
00210         FindAttribs attr);
00211
00212     // Callback routine for sorting tree
00213     //
00214     static int CALLBACK TreeViewCompareProc(LPARAM lparam1, LPARAM lparam2, LPARAM lparamSort);
00215
00216 // Overrides
00217     // ClassWizard generated virtual function overrides
00218     //{{AFX_VIRTUAL(CCJShellTree)
00219     protected:
00220     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00221     //}}AFX_VIRTUAL
00222
00223     // Generated message map functions
00224 protected:
00225     //{{AFX_MSG(CCJShellTree)
00226     afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
00227     afx_msg void OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
00228     afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
00229     afx_msg void OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult);
00230     afx_msg void OnDestroy();
00231     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00232     //}}AFX_MSG
00233
00234     DECLARE_MESSAGE_MAP()
00235 };
00236
00238 //  Inline Functions
00240
00241 _CJXLIB_INLINE void CCJShellTree::AssociateList(CCJShellList *pListCtrl)
00242     { ASSERT( pListCtrl != NULL ); m_pListCtrl = pListCtrl; }
00243
00244 _CJXLIB_INLINE void CCJShellTree::AssociateCombo(CComboBox *pComboBox)
00245     { ASSERT( pComboBox != NULL );  m_pComboBox = pComboBox; }
00246
00248
00249 //{{AFX_INSERT_LOCATION}}
00250 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00251
00252 #endif // _WIN32_IE >= 0x0400
00253 #endif // __CJSHELLTREE_H__
Generated on Sun Oct 21 12:41:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJSizeDockBar.h Source File

WinCvs/CJLib/Include/CJSizeDockBar.h

Go to the documentation of this file.
00001 // CJSizeDockBar.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJSizeDockBar.h $
00011  *
00012  * $History: CJSizeDockBar.h $
00013  *
00014  * *****************  Version 12  *****************
00015  * User: Kirk Stowell Date: 10/29/99   Time: 12:44a
00016  * Updated in $/CodeJock/Include
00017  * Added static member variable CCJSizeDockBar::m_bIsDockBar used for save
00018  * and restore bar state.
00019  *
00020  * *****************  Version 11  *****************
00021  * User: Kirk Stowell Date: 10/14/99   Time: 2:55p
00022  * Updated in $/CodeJock/Include
00023  * Fixed bug with just clicking on the sizing tracker and the control bar
00024  * resizing one pixel to the left or right. The bar will only be sized if
00025  * the cursor has changed its location.
00026  *
00027  * *****************  Version 10  *****************
00028  * User: Kirk Stowell Date: 9/16/99    Time: 2:35p
00029  * Updated in $/CodeJockey/Include
00030  * Fixed bug with save / restore bar state, and with saved bar size
00031  * changing whenever the application starts.
00032  *
00033  * *****************  Version 9  *****************
00034  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00035  * Updated in $/CodeJockey/Include
00036  * Updated copyright and contact information.
00037  *
00038  * *****************  Version 8  *****************
00039  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00040  * Updated in $/CodeJockey/Include
00041  *
00042  * *****************  Version 7  *****************
00043  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00044  * Updated in $/CodeJockey/Include
00045  *
00046  * *****************  Version 6  *****************
00047  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00048  * Updated in $/CodeJockey/Include
00049  * Cleaned up inline functions, and import/export macro so that class will
00050  * be imported when linked to, and exported at compile time.
00051  *
00052  * *****************  Version 5  *****************
00053  * User: Kirk Stowell Date: 6/09/99    Time: 10:25p
00054  * Updated in $/CodeJockey/Include
00055  * Ioannhs Stamatopoulos (Yiannhs) [ystamat@mail.datamedia.gr] - Extended
00056  * docking windows, removed ::GetSysColor(...) calls and WM_SYSCOLORCHANGE
00057  * message handler, this is now automatically handled by the base class.
00058  * Added redraw flags to the create method and modified paint and layout
00059  * handlers to reduce flicker and un-necessary command handling. Dragging
00060  * rect now reflects actual control bar docked size. Added "flat" look to
00061  * the control bars, the control bars can now use the classic DevStudio
00062  * look, or use flat gradient gripper, borders and frame buttons. Overall,
00063  * docking windows now handle dragging, docking and floating much better,
00064  * and behave more like DevStudio.
00065  *
00066  * *****************  Version 4  *****************
00067  * User: Kirk Stowell Date: 4/14/99    Time: 11:07p
00068  * Updated in $/CodeJockey/Include
00069  * Changed CFrameWnd *pFrame = (CFrameWnd*)AfxGetApp()->m_pMainWnd; to
00070  * CFrameWnd *pFrame = GetParentFrame(); see line 432.
00071  *
00072  * *****************  Version 3  *****************
00073  * User: Kirk Stowell Date: 4/03/99    Time: 11:06p
00074  * Updated in $/CodeJockey/Include
00075  * Added comments and cleaned up code.
00076  *
00077  * *****************  Version 2  *****************
00078  * User: Kirk Stowell Date: 1/29/99    Time: 11:06p
00079  * Updated in $/CodeJockey/Include
00080  * Made some cosmetic enhancements to more closely match DevStudio docking
00081  * windows.
00082  *
00083  * *****************  Version 1  *****************
00084  * User: Kirk Stowell Date: 1/12/99    Time: 11:06p
00085  * Created in $/CodeJockey/Include
00086  * Initial release to add side-by-side docking support for CCJControlBar
00087  * class.
00088  *
00089  ***************************************************************************/
00091
00092 #ifndef __CJSIZEDOCKBAR_H__
00093 #define __CJSIZEDOCKBAR_H__
00094
00095 #if _MSC_VER >= 1000
00096 #pragma once
00097 #endif // _MSC_VER >= 1000
00098
00099 // class forwards
00100 class CCJControlBar;
00101
00102 // CCJSizeDockBar is a CDockBar derived class which is used by the framework
00103 // to handle CCJControlBar's.
00104 class _CJX_EXT_CLASS CCJSizeDockBar : public CDockBar
00105 {
00106     DECLARE_DYNAMIC(CCJSizeDockBar)
00107
00108 public:
00109
00110     // Default constructor
00111     //
00112     CCJSizeDockBar();
00113
00114     // Virtual destructor
00115     //
00116     virtual ~CCJSizeDockBar();
00117
00118     static bool m_bIsDockBar;
00119
00120 protected:
00121
00122     int         m_iSafeSpace;           // dockbar offset when docked
00123
00124     int         m_iActualSize;          // actual size of the dockbar
00125
00126     BOOL        m_bDragging;            // set to TRUE when a drag operation is in
00127                                         // process.
00128
00129     BOOL        m_bOkToDrag;            // used to determine if a drag operation
00130                                         // should occur.
00131
00132     CRect       m_rcTrack;              // used to determine rect of the tracker window.
00133     CPoint      m_ptCurDrag;            // cursor location during a drag operation.
00134     CPoint      m_ptStartDrag;          // cursor starting point during a drag operation.
00135
00136     HCURSOR     m_curHSplitBar;         // handle of the cursor to be displayed when
00137                                         // the mouse passes over a horizontal splitter.
00138
00139     HCURSOR     m_curVSplitBar;         // handle of the cursor to be displayed when
00140                                         // the mouse passes over a vertical splitter.
00141
00142     BOOL        m_bFlatBorder;          // set to TRUE for flat border.
00143     CPoint      m_ptCurrent;            // holds the current cursor position.
00144
00145 public:
00146
00147     // this member function is called by the control bar
00148     // to return the control bar to its normal size.
00149     //
00150     void Normalize(CCJControlBar*);
00151
00152     // this member function is called by the control bar
00153     // to maximize the control bar.
00154     //
00155     void Maximize(CCJControlBar*);
00156
00157     // This member function is called to recalculate the
00158     // CCJControlBar docked layout
00159     //
00160     void CalcSizeBarLayout();
00161
00162     // This member function is called to set the size
00163     // of a CCJControlBar
00164     //
00165     void SetActualSize(int iSize);
00166
00167     // this member function is called by the control bar
00168     // to perform paint operations.
00169     //
00170     void EraseNonClient();
00171
00172     // this member function is called by the control bar
00173     // to draw its borders.
00174     //
00175     void DrawBorders(CDC *pDC,CRect& rect);
00176
00177     // This member function is called to recalculate the
00178     // CCJControlBar docked layout
00179     //
00180     void RecalcAllExcept(CCJSizeDockBar *pBar);
00181
00182     // this member function returns a pointer to a CCJControlBar
00183     // object based upon docked position
00184     //
00185     CCJControlBar* GetDockedSizeBar(int nPos);
00186
00187     // this member function is used to initialize flat borders.
00188     //
00189     void FlatBorder( BOOL bFlat = TRUE );
00190
00191 protected:
00192
00193     // this member function is called to determine if there
00194     // are any additional control bars left.
00195     //
00196     BOOL IsLastControlBar(int index);
00197
00198     // this member function returns the size for a docked
00199     // control bar
00200     //
00201     void GetAvailableRect(CRect &rect);
00202
00203 // Overrides
00204     // ClassWizard generated virtual function overrides
00205     //{{AFX_VIRTUAL(CCJSizeDockBar)
00206     public:
00207     virtual CSize CalcDynamicLayout(int nLength, DWORD nMode);
00208     virtual void DoPaint(CDC *pDC);
00209     virtual BOOL IsDockBar() const;
00210     virtual BOOL IsDockSizeBar() const;
00211     virtual void OnInvertTracker(const CRect&);
00212     virtual void HitTest(const CPoint& point);
00213     //}}AFX_VIRTUAL
00214
00215 // Generated message map functions
00216 protected:
00217     //{{AFX_MSG(CCJSizeDockBar)
00218     afx_msg void OnNcPaint();
00219     afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
00220     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00221     afx_msg UINT OnNcHitTest(CPoint point);
00222     afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
00223     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00224     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00225     //}}AFX_MSG
00226     DECLARE_MESSAGE_MAP()
00227 };
00228
00230 //  Inline Functions
00232
00233 _CJXLIB_INLINE BOOL CCJSizeDockBar::IsDockBar() const
00234     { return m_bIsDockBar; }
00235
00236 _CJXLIB_INLINE BOOL CCJSizeDockBar::IsDockSizeBar() const
00237     { return TRUE; }
00238
00239 _CJXLIB_INLINE void CCJSizeDockBar::SetActualSize(int iSize)
00240     { m_iActualSize=iSize; }
00241
00242 _CJXLIB_INLINE void CCJSizeDockBar::FlatBorder( BOOL bFlat )
00243     { if(m_bFlatBorder!=bFlat){m_bFlatBorder=bFlat;InvalidateRect(NULL,FALSE);UpdateWindow();}}
00244
00246
00247 //{{AFX_INSERT_LOCATION}}
00248 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00249
00250 #endif // __CJSIZEDOCKBAR_H__
00251
Generated on Sun Oct 21 12:41:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJSortClass.h Source File

WinCvs/CJLib/Include/CJSortClass.h

Go to the documentation of this file.
00001 // Copyright (c) Iuri Apollonio 1998
00002 // Use & modify as you want & need, and leave those 3 lines.
00003 // http://www.codeguru.com
00004 // class extended by Max Poliashenko.
00005
00006 // CJSortClass.h: interface for the CCJSortClass class.
00007 //
00009 /****************************************************************************
00010  *
00011  * $Date: 1999/11/30 21:45:51 $
00012  * $Revision: 1.1.1.2 $
00013  * $Archive: /CodeJock/Include/CJSortClass.h $
00014  *
00015  * $History: CJSortClass.h $
00016  *
00017  * *****************  Version 5  *****************
00018  * User: Kirk Stowell Date: 10/26/99   Time: 10:47p
00019  * Updated in $/CodeJock/Include
00020  * Made class methods virtual for inheritance purposes.
00021  *
00022  * *****************  Version 4  *****************
00023  * User: Kirk Stowell Date: 10/14/99   Time: 12:20p
00024  * Updated in $/CodeJock/Include
00025  * Added source control history to file header.
00026  *
00027  ***************************************************************************/
00029
00030 #ifndef __CJSORTCLASS_H__
00031 #define __CJSORTCLASS_H__
00032
00033 #if _MSC_VER > 1000
00034 #pragma once
00035 #endif // _MSC_VER > 1000
00036
00037 // enumeration data type for sorting
00038 typedef enum DATA_TYPE
00039 {
00040     DT_INT = 1,     // sort type int
00041     DT_STRING,      // sort type string
00042     DT_DATETIME,    // sort type date / time
00043     DT_DEC          // sort type decimal
00044 };
00045
00046 // This class will sort a List control by a column of text, integer, float or
00047 // date/time type. It could be easily extended for other data types.
00048 class _CJX_EXT_CLASS CCJSortClass
00049 {
00050
00051 public:
00052
00053     // Default constructor
00054     //
00055     CCJSortClass(CListCtrl* pWnd, const int nCol);
00056
00057     // Virtual destructor
00058     //
00059     virtual ~CCJSortClass();
00060
00061 public:
00062
00063     // this member function is call to peform the actual sort
00064     // proceedure.
00065     //
00066     virtual void Sort(bool bAsc, DATA_TYPE eType);
00067
00068 protected:
00069
00070     CListCtrl* m_pWnd;  // pointer to the CListCtrl object to peform sort on
00071
00072     // this callback member function is called to compare to data items
00073     // during sorting operations
00074     //
00075     static int CALLBACK Compare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
00076
00077     // helper struct used during sorting operations
00078     //
00079     struct CSortItem
00080     {
00081         CSortItem(const DWORD dwData, const CString &strItemText);
00082         DWORD   m_dwData;
00083         CString m_strItemText;
00084     };
00085 };
00086
00088 //  Inline Functions
00090
00091 _CJXLIB_INLINE CCJSortClass::CSortItem::CSortItem(const DWORD dwData, const CString & strItemText)
00092     { m_dwData  = dwData; m_strItemText = strItemText; }
00093
00094 #endif // __CJSORTCLASS_H__
Generated on Sun Oct 21 12:41:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJStatusBar.h Source File

WinCvs/CJLib/Include/CJStatusBar.h

Go to the documentation of this file.
00001 // CJStatusBar.h : header file
00002 //
00003 // Copyright © 1999 Pierre MELLINAND
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.1 $
00010  * $Archive: /CodeJock/Include/CJStatusBar.h $
00011  *
00012  * $History: CJStatusBar.h $
00013  *
00014  * *****************  Version 1  *****************
00015  * User: Kirk Stowell Date: 10/26/99   Time: 11:08p
00016  * Created in $/CodeJock/Include
00017  *
00018  ***************************************************************************/
00020
00021 #ifndef __CJSTATUSBAR_H__
00022 #define __CJSTATUSBAR_H__
00023
00024 #if _MSC_VER >= 1000
00025 #pragma once
00026 #endif // _MSC_VER >= 1000
00027
00029 // CCJStatusBarPaneControlInfo class
00030
00031 class _CJX_EXT_CLASS CCJStatusBarPaneControlInfo : public CObject
00032 {
00033     DECLARE_DYNCREATE(CCJStatusBarPaneControlInfo)
00034
00035 // Construction
00036 public:
00037     CCJStatusBarPaneControlInfo();
00038     virtual ~CCJStatusBarPaneControlInfo();
00039
00040 // Attributes
00041 public:
00042     CWnd*   m_pWnd;
00043     int     m_nPaneID;
00044     BOOL    m_bAutodelete;
00045 };
00046
00048 // CCJStatusBarPane class
00049
00050 class _CJX_EXT_CLASS CCJStatusBarPane : public CObject
00051 {
00052 // Construction
00053 public:
00054     CCJStatusBarPane();
00055     CCJStatusBarPane (CCJStatusBarPane& rPane);
00056     virtual ~CCJStatusBarPane();
00057
00058 // Attributes
00059 public:
00060     UINT    m_nID;
00061     int     m_cxText;
00062     UINT    m_nStyle;
00063     UINT    m_nFlags;
00064     CString m_strText;
00065
00066 // Operations
00067 public:
00068     CCJStatusBarPane& operator=(CCJStatusBarPane& rPane);
00069 };
00070
00072 // CCJStatusBar class
00073
00074 class _CJX_EXT_CLASS CCJStatusBar : public CStatusBar
00075 {
00076     DECLARE_DYNCREATE(CCJStatusBar)
00077
00078 // Construction
00079 public:
00080     CCJStatusBar();
00081     virtual ~CCJStatusBar();
00082
00083 // Attributes
00084 private:
00085     CArray<CCJStatusBarPaneControlInfo*, CCJStatusBarPaneControlInfo*>  m_aPans;
00086
00087 // Operations
00088 public:
00089     virtual void PositionControls();
00090     virtual CCJStatusBarPaneControlInfo* GetPanControl(int nPaneID);
00091     virtual BOOL AddControl(CWnd * pWnd, int nPaneID, BOOL bAutodeleteControl = TRUE );
00092     virtual void SetPaneWidth(int index, int cxWidth);
00093     virtual BOOL AddIndicator( int position, UINT paneID);
00094     virtual BOOL GetStatusPane(int nIndex, CCJStatusBarPane & xfxpane);
00095     virtual void RemovePane(int nPaneID);
00096
00097 // Overrides
00098     // ClassWizard generated virtual function overrides
00099     //{{AFX_VIRTUAL(CCJStatusBar)
00100     //}}AFX_VIRTUAL
00101
00102 // Implementation
00103 public:
00104
00105 // Generated message map functions
00106 protected:
00107     //{{AFX_MSG(CCJStatusBar)
00108     afx_msg void OnSize(UINT nType, int cx, int cy);
00109     //}}AFX_MSG
00110     DECLARE_MESSAGE_MAP()
00111 };
00112
00114
00115 //{{AFX_INSERT_LOCATION}}
00116 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00117
00118 #endif // __CJSTATUSBAR_H__
00119
Generated on Sun Oct 21 12:41:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJTabCtrl.h Source File

WinCvs/CJLib/Include/CJTabCtrl.h

Go to the documentation of this file.
00001 // CJTabCtrl.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJTabCtrl.h $
00011  *
00012  * $History: CJTabCtrl.h $
00013  *
00014  * *****************  Version 11  *****************
00015  * User: Kirk Stowell Date: 10/30/99   Time: 2:18p
00016  * Updated in $/CodeJock/Include
00017  * OverrodeOnEraseBkgnd(...) and OnPaint() for flicker free drawing.
00018  *
00019  * *****************  Version 10  *****************
00020  * User: Kirk Stowell Date: 10/26/99   Time: 10:48p
00021  * Updated in $/CodeJock/Include
00022  * Made class methods virtual for inheritance purposes.
00023  *
00024  * *****************  Version 9  *****************
00025  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00026  * Updated in $/CodeJockey/Include
00027  * Updated copyright and contact information.
00028  *
00029  * *****************  Version 8  *****************
00030  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00031  * Updated in $/CodeJockey/Include
00032  *
00033  * *****************  Version 7  *****************
00034  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00035  * Updated in $/CodeJockey/Include
00036  *
00037  * *****************  Version 6  *****************
00038  * User: Kirk Stowell Date: 7/18/99    Time: 10:13p
00039  * Updated in $/CodeJockey/Include
00040  * Cleaned up inline functions, and import/export macro so that class will
00041  * be imported when linked to, and exported at compile time.
00042  *
00043  * *****************  Version 5  *****************
00044  * User: Kirk Stowell Date: 7/14/99    Time: 9:44p
00045  * Updated in $/CodeJockey/Include
00046  * Added _DYNAMIC macros for access to the CObject::IsKindOf to determine
00047  * the class object at runtime. Thanks to Sid Price
00048  * [sidprice@softtools.com] for suggesting this.
00049  *
00050  * *****************  Version 4  *****************
00051  * User: Kirk Stowell Date: 6/14/99    Time: 10:47p
00052  * Updated in $/CodeJockey/Include
00053  * Cleaned up code to eliminate level 4 compilier warnings.
00054  *
00055  * *****************  Version 3  *****************
00056  * User: Kirk Stowell Date: 5/11/99    Time: 9:33p
00057  * Updated in $/CodeJockey/Include
00058  * Renamed popup menu resource id to m_popupMenuID to be consistent with
00059  * other classes.  Added member variable m_popToolbarID to contain the
00060  * toolbar resource to be used for popup menus  and m_nPos to contain the
00061  * index of the submenu in the menu resource. Added
00062  * CCJTabCtrl::Create(...) to simplify the creation process, and to set
00063  * the tab font.  Cleaned up OnRButtonDown(..) message handler which
00064  * activates the popup menu. Modified SetMenuID(...) to accept the index
00065  * of the popup menu in the menu resource.
00066  *
00067  * *****************  Version 2  *****************
00068  * User: Kirk Stowell Date: 5/02/99    Time: 5:25p
00069  * Updated in $/CodeJockey/Include
00070  * Removed class from CCJTabCtrlBar files into its own files. Added popup
00071  * menu support for CCJMenus.
00072  *
00073  * *****************  Version 1  *****************
00074  * User: Kirk Stowell Date: 5/02/99    Time: 4:34p
00075  * Created in $/CodeJockey/Include
00076  *
00077  ***************************************************************************/
00079
00080 #ifndef __CJTABCTRL_H__
00081 #define __CJTABCTRL_H__
00082
00083 #if _MSC_VER >= 1000
00084 #pragma once
00085 #endif // _MSC_VER >= 1000
00086
00087 #include "CJMenu.h"        // CCJMenu class declaration
00088
00089 // CCJTabCtrl is a CTabCtrl derived class which is used by CCJTabCtrl
00090 // to help fix problems with repainting in the tab control
00091 class _CJX_EXT_CLASS CCJTabCtrl : public CTabCtrl
00092 {
00093     DECLARE_DYNAMIC(CCJTabCtrl)
00094
00095 public:
00096
00097     // Default constructor
00098     //
00099     CCJTabCtrl();
00100
00101     // Virtual destructor
00102     //
00103     virtual ~CCJTabCtrl();
00104
00105 public:
00106
00107     UINT            m_popToolbarID; // popup menu toolbar resource id, associates
00108                                     // toolbar icons with the popup menu.
00109
00110     UINT            m_popupMenuID;  // popup menu resource id
00111     CCJMenu         m_popupMenu;    // popup menu
00112     int             m_nPos;         // index of the pop-up menu contained in the menu
00113     CFont           m_Font;         // font used by tab control.
00114
00115 public:
00116     virtual void UpdateFont();
00117
00118     // this member function is called to associate a menu and toolbar
00119     // resource with the context menu.
00120     //
00121     virtual void SetMenuID(UINT popupMenuID, UINT popToolbarID=0, int nPos=0);
00122
00123     // this member function returns the menu resource associated with
00124     // the tab control.
00125     //
00126     virtual UINT GetMenuID();
00127
00128 // Overrides
00129     // ClassWizard generated virtual function overrides
00130     //{{AFX_VIRTUAL(CCJTabCtrl)
00131     public:
00132     virtual BOOL Create(CWnd* pParentWnd, UINT nID=AFX_IDC_TAB_CONTROL, DWORD dwStyle=WS_VISIBLE|WS_CHILD|TCS_BOTTOM|TCS_TOOLTIPS|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, const CRect& rect=CRect(0,0,0,0));
00133     //}}AFX_VIRTUAL
00134
00135 // Generated message map functions
00136 protected:
00137     //{{AFX_MSG(CCJTabCtrl)
00138     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00139     afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
00140     afx_msg LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu);
00141     afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
00142     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00143     afx_msg void OnPaint();
00144     //}}AFX_MSG
00145     DECLARE_MESSAGE_MAP()
00146 };
00147
00149 //  Inline Functions
00151
00152 _CJXLIB_INLINE void CCJTabCtrl::SetMenuID(UINT popupMenuID, UINT popToolbarID, int nPos)
00153     { m_popupMenuID = popupMenuID; m_popToolbarID = popToolbarID; m_nPos = nPos; }
00154
00155 _CJXLIB_INLINE UINT CCJTabCtrl::GetMenuID()
00156     { return m_popupMenuID; }
00157
00159
00160 //{{AFX_INSERT_LOCATION}}
00161 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00162
00163 #endif // __CJTABCTRL_H__
00164
Generated on Sun Oct 21 12:41:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJTabCtrlBar.h Source File

WinCvs/CJLib/Include/CJTabCtrlBar.h

Go to the documentation of this file.
00001 // CJTabCtrlBar.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJTabCtrlBar.h $
00011  *
00012  * $History: CJTabCtrlBar.h $
00013  *
00014  * *****************  Version 16  *****************
00015  * User: Kirk Stowell Date: 10/31/99   Time: 11:29p
00016  * Updated in $/CodeJock/Include
00017  * Enabled OnInitialUpdate() to be called for tab views added to
00018  * CCJTabCtrlBar whenever the control bar is floating.
00019  *
00020  * Fixed potential resource and memory leak problems.
00021  *
00022  * Fixed problems with AddView(...) setting the wrong view index to
00023  * active.
00024  *
00025  * Added  EnableToolTips method which enables and disables the tooltips.
00026  * Thanks to Phil Baxter for help with this.
00027  *
00028  * Fixed problem with dangling pointer in DeleteView. Thanks to Gero Kuehn
00029  * [gero.kuehn@isc-soft.de] for help with this.
00030  *
00031  * Fixed potential bug with CCJTabControlBar returning image index, fixed
00032  * bug with GetTabFromPoint(...) returning invalid index.
00033  *
00034  * Made class methods virtual for inhertance purposes.
00035  *
00036  * *****************  Version 14  *****************
00037  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00038  * Updated in $/CodeJockey/Include
00039  * Updated copyright and contact information.
00040  *
00041  * *****************  Version 13  *****************
00042  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00043  * Updated in $/CodeJockey/Include
00044  *
00045  * *****************  Version 12  *****************
00046  * User: Kirk Stowell Date: 7/18/99    Time: 10:11p
00047  * Updated in $/CodeJockey/Include
00048  * Cleaned up inline functions, and import/export macro so that class will
00049  * be imported when linked to, and exported at compile time.
00050  *
00051  * *****************  Version 11  *****************
00052  * User: Kirk Stowell Date: 7/14/99    Time: 9:43p
00053  * Updated in $/CodeJockey/Include
00054  * Added _DYNAMIC macros for access to the CObject::IsKindOf to determine
00055  * the class object at runtime. Added method GetTabFromPoint which returns
00056  * the tab index based upon cursor position. Thanks to Sid Price
00057  * [sidprice@softtools.com] for suggesting this.
00058  *
00059  * *****************  Version 10  *****************
00060  * User: Kirk Stowell Date: 5/17/99    Time: 9:07p
00061  * Updated in $/CodeJockey/Include
00062  * Paul [RowingWolf@aol.com] - Added the following support methods:
00063  * void SetActiveView(CView* pUserView)
00064  * void AssociateImageIndexWithRuntimeClass(int nIndex, CRuntimeClass*
00065  * pRuntimeClass)
00066  * void AssociateImageIndexWithRuntimeClass(int nIndex, LPCTSTR
00067  * lpszRuntimeClassName)
00068  * short GetImageIndexFromRuntimeClass(CRuntimeClass* pRuntimeClass)
00069  * BOOL RemoveAllTabs().
00070  *
00071  * *****************  Version 9  *****************
00072  * User: Kirk Stowell Date: 5/11/99    Time: 10:02p
00073  * Updated in $/CodeJockey/Include
00074  * After much frustration, a class re-write. Fixed many of the issues with
00075  * painting, invalid pointers and memory leaks. Added document support for
00076  * views associated with the tab control.
00077  *
00078  * *****************  Version 8  *****************
00079  * User: Kirk Stowell Date: 4/14/99    Time: 11:53p
00080  * Updated in $/CodeJockey/Include
00081  * Added context popupMenu for CJTabCtrl to use Brent Corkum's BCMenu.
00082  *
00083  * *****************  Version 7  *****************
00084  * User: Kirk Stowell Date: 4/03/99    Time: 11:52p
00085  * Updated in $/CodeJockey/Include
00086  * Added comments and cleaned up code, modified AddView(...) to allow a
00087  * CDocument to be associated with the view added to the tab control.
00088  *
00089  * *****************  Version 6  *****************
00090  * User: Kirk Stowell Date: 3/14/99    Time: 11:51p
00091  * Updated in $/CodeJockey/Include
00092  * Gonzalo Pereyra [ persys@adinet.com.uy ] - I wanted to trap NM_RETURN
00093  * notifications in my CTreeView Class. I couldn't... It turns out that
00094  * CControlbar::PreTranslateMessage() will eat all dialog messages...It
00095  * will never get dispatched to my window. So I Overrided it in :
00096  * CCJTabCtrlBar::PreTranslateMessage(). this will allow for message
00097  * reflection and we will get NM_RETURN. I don't know if this a good
00098  * solution but for now , it works.
00099  *
00100  * *****************  Version 5  *****************
00101  * User: Kirk Stowell Date: 2/24/99    Time: 11:49p
00102  * Updated in $/CodeJockey/Include
00103  * Phil Baxter [pgb@mrjinx.demon.co.uk] - Fixed the following problems
00104  * when tabs are added after creation:
00105  * 1. The tab was created, but the view that was showing on the tab was
00106  * not visible.
00107  * 2. Get an assertion when the AddView function attempts to perform the
00108  * AddTool function.
00109  * 3. When a new view is added, although you set it to be the active view,
00110  * it isn't raised to the top of the stack in the display.
00111  * 4. The Tab name as stored in the TCB_ITEM structure is now a CString,
00112  * this removes the 32 byte limit that it previously had.
00113  * 5. New methods for obtaining the name as stored in the TCB_ITEM
00114  * structure.
00115  * 6. New Methods for deleting a view from the control, this removes the
00116  * view entirely including its  associated tab.
00117  * 7. Some minor fixes around assertions when trying to manipulate the
00118  * control when it has not had any tabs created.
00119  * 8. Added two new member functions:
00120  * void SetViewToolTip(int nView, LPCTSTR lpszLabel);
00121  * void SetViewToolTip(CRuntimeClass *pViewClass, LPCTSTR lpszLabel);
00122  *
00123  * *****************  Version 4  *****************
00124  * User: Kirk Stowell Date: 1/31/99    Time: 11:48p
00125  * Updated in $/CodeJockey/Include
00126  * Commented out 2 calls to SetActiveView(). This somewhat fixes the
00127  * problem with CTRL+TAB in activatation of MDI child windows, however if
00128  * you click inside the view, this breaks CTRL+TAB again, will look at
00129  * this when I get some free time. Thanks to Pierre Guimont
00130  * (Pierre_Guimont@mitel.com) for pointing this out.
00131  *
00132  * Added m_TabCtrl.GetRowCount() as per Rashid Thadha
00133  * rashidt@consort.co.uk) request.
00134  *
00135  * *****************  Version 3  *****************
00136  * User: Kirk Stowell Date: 1/17/99    Time: 11:46p
00137  * Updated in $/CodeJockey/Include
00138  * Added helper class CCJTabCtrl to eliminate re-painting problems such as
00139  * when the app is minimized then restored.
00140  *
00141  * *****************  Version 2  *****************
00142  * User: Kirk Stowell Date: 1/03/99    Time: 11:46p
00143  * Updated in $/CodeJockey/Include
00144  * Application freezing bug fixed by
00145  * LiangYiBin.Donald(mailto:lybd@yahoo.com)
00146  *
00147  * *****************  Version 1  *****************
00148  * User: Kirk Stowell Date: 10/17/98   Time: 11:45p
00149  * Created in $/CodeJockey/Include
00150  * Initial re-write and release.
00151  *
00152  ***************************************************************************/
00154
00155 #ifndef __CJTABCTRLBAR_H__
00156 #define __CJTABCTRLBAR_H__
00157
00158 #if _MSC_VER >= 1000
00159 #pragma once
00160 #endif // _MSC_VER >= 1000
00161
00162 #include <afxtempl.h>
00163 #include "CJControlBar.h"
00164 #include "CJTabCtrl.h"
00165
00166 // helper struct used by CCJTabCtrlBar
00167 typedef struct tagTCB_ITEM
00168 {
00169     CWnd    *pWnd;          // this points to the window associated with a tab
00170     CString szTabLabel;     // label for the tab
00171     CString szToolTipLabel; // tooltip text for the tab
00172     UINT    uiToolTipId;    // resource id for tooltip
00173 } TCB_ITEM;
00174
00175 // class forwards
00176 class CCJTabCtrl;
00177
00178 // template list used to contain tab information
00179 typedef CList <TCB_ITEM *,TCB_ITEM *> CTabViews;
00180
00181 // CCJTabCtrlBar is a CCJControl bar derived class which implements a
00182 // tabbed window simular to VisualStudio's workspace window.
00183 class _CJX_EXT_CLASS CCJTabCtrlBar : public CCJControlBar
00184 {
00185     DECLARE_DYNAMIC(CCJTabCtrlBar)
00186
00187 public:
00188
00189     // Default constructor
00190     //
00191     CCJTabCtrlBar();
00192
00193     // Virtual destructor
00194     //
00195     virtual ~CCJTabCtrlBar();
00196
00197 protected:
00198
00199     int             m_nPointTab;                // tab index set from GetTabFromPoint(...)
00200     int             m_nActiveTab;               // currently selected tab
00201     int             m_nNextToolTipId;           // tooltip resource id
00202     CView*          m_pActiveView;              // this points to the active view
00203     CTabViews       m_viewList;                 // template list containing tab information
00204     CCJTabCtrl      m_TabCtrl;                  // tab control
00205     CMapStringToPtr m_ClassNameToImageIndexMap; // Map class name to the image index
00206     BOOL            m_bToolTipsEnabled;         // TRUE if tooltips are enabled.
00207
00208 public:
00209
00210     // this member function is called to add a view to the tab control
00211     //
00212     virtual BOOL AddView(
00213         // tab text
00214         LPCTSTR lpszLabel,
00215         // CView object associated with tab
00216         CRuntimeClass *pViewClass,
00217         // CDocument associated with view
00218         CDocument* pDoc = NULL,
00219         // index of tab to add
00220         UINT nIndex=-1,
00221         // create context for view
00222         CCreateContext *pContext = NULL);
00223
00224     // this member function will remove a view based on its index
00225     //
00226     virtual void RemoveView(int nView);
00227
00228     // this member function will set a view active
00229     // based on index
00230     //
00231     virtual void SetActiveView(int nView);
00232
00233     // this member function will set a view active
00234     // based on a CView object
00235     //
00236     virtual void SetActiveView(CRuntimeClass *pViewClass);
00237
00238     // this member function returns a pointer to the
00239     // active view in the tab control
00240     //
00241     virtual CView* GetActiveView();
00242
00243     // this member function returns a pointer to a view
00244     // based on its index
00245     //
00246     virtual CView* GetView(int nView);
00247
00248     // this member function returns a pointer to a view
00249     // based on a CView object
00250     //
00251     virtual CView* GetView(CRuntimeClass *pViewClass);
00252
00253     // this member function initializes the image list
00254     // for the tab control
00255     //
00256     virtual CImageList* SetTabImageList(CImageList *pImageList);
00257
00258     // this member function will modify the style for the
00259     // tab control associated with this control.
00260     //
00261     virtual BOOL ModifyTabStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags=0);
00262
00263     // this member function will return the name for a view
00264     // based on index
00265     virtual LPCTSTR GetViewName(int nView);
00266
00267     // this member function will return the name for a view
00268     // based upon a CView object
00269     //
00270     virtual LPCTSTR GetViewName(CRuntimeClass *pViewClass);
00271
00272     // this member function will delete a view based upon
00273     // its index
00274     virtual void DeleteView(int nView);
00275
00276     // this member function will delete a view based upon
00277     // a CView object
00278     virtual void DeleteView(CRuntimeClass *pViewClass);
00279
00280     // this member function will set the tooltip for a peticular view
00281     // in the tab control based on its index
00282     //
00283     virtual void SetViewToolTip(int nView, LPCTSTR lpszLabel);
00284
00285     // this member function will set the tooltip for a peticular view
00286     //  in the tab control based on a CView object
00287     //
00288     virtual void SetViewToolTip(CRuntimeClass *pViewClass, LPCTSTR lpszLabel);
00289
00290     // this member function is called by the control bar, and
00291     // can be overloaded in derived classes to return the rect
00292     // for the child window associated with the control bar.
00293     //
00294     virtual void GetChildRect(
00295         // reference to a CRect object which contains the size of
00296         // the child window associated with the control bar.
00297         CRect &rect);
00298
00299     // this member function is used to set the resource id for the popup menu used
00300     // by the tab control.
00301     //
00302     virtual void SetTabMenuID(
00303         // id for the tab control popup menu
00304         UINT popupMenuID,
00305         // id for toolbar resource associated with popup
00306         UINT popToolbarID=0,
00307         // index position in menu resource
00308         int nPos=0);
00309
00310     // Use this member function to set the active view to the specified view -- this
00311     // provides more user control than the other SetActiveView()'s
00312     //
00313     virtual void SetActiveView(CView* pUserView);
00314
00315     // Use this member function to map the image index to the class name,
00316     // and allows the image to be set based on the view's runtime class type
00317     //
00318     virtual void AssociateImageIndexWithRuntimeClass(int nIndex, CRuntimeClass* pRuntimeClass);
00319
00320     // Use this member function to map the image index to the class name,
00321     // and allows the image to be set based on the name of the view's runtime class name
00322     //
00323     void AssociateImageIndexWithRuntimeClass(int nIndex, LPCTSTR lpszRuntimeClassName);
00324
00325     // Use this member function to clear out all the tabs, but the user MUST
00326     // take care of the views themselves
00327     //
00328     virtual BOOL RemoveAllTabs();
00329
00330     // call this member function to retrieve the tab index from
00331     // current cursor position.
00332     virtual int GetTabFromPoint(
00333         // Pointer to a CPoint object that contains the cursor
00334         // screen coordinates. Use default for current cursor position.
00335         CPoint point = CPoint(0,0));
00336
00337 protected:
00338
00339     // This member function returns the image associated with a runtime class, and
00340     // indicates which image will be displayed with the associated view class
00341     //
00342     virtual short GetImageIndexFromRuntimeClass(CRuntimeClass* pRuntimeClass);
00343
00344     // This member function is used by the tab control bar to remove an item from the
00345     // view list.
00346     //
00347     virtual void RemoveListItem(POSITION pos);
00348
00349     // This member function is used by the tab control bar to simply to perform
00350     // debug assertion validation.
00351     //
00352     virtual void OverkillAssert(CRuntimeClass *pViewClass);
00353
00354     // This member function is called by the tab control bar to resize the
00355     // tab control window.
00356     //
00357     virtual void SizeTabView(CWnd* pWnd);
00358
00359     // This member function is used by the tab control bar to return a pointer
00360     // to the tooltip control associated with this control.
00361     //
00362     virtual CToolTipCtrl* GetToolTip();
00363
00364     // This member function is used by the tab control bar to add a
00365     // tooltip to a tab.
00366     //
00367     virtual void AddToolTip(TCB_ITEM* pMember, LPCTSTR lpszLabel);
00368
00369     // This member function is used by the tab control bar to reset the tooltip control.
00370     //
00371     virtual void ResetToolTips(CToolTipCtrl* pToolTip);
00372
00373     // This member function is used by the control bar to create a tab item.
00374     //
00375     virtual TCB_ITEM* CreateTabListItem(LPCTSTR lpszLabel);
00376
00377     // This member function is used by the control bar to create a view to
00378     // be associated with a tab control item.
00379     //
00380     virtual BOOL CreateTabView(CRuntimeClass *pViewClass, CDocument *pDocument, CCreateContext *pContext);
00381
00382     // This member function enables / disables tooltips
00383     //
00384     virtual BOOL EnableToolTips(BOOL bEnable);
00385
00386 // Overrides
00387 public:
00388     // ClassWizard generated virtual function overrides
00389     //{{AFX_VIRTUAL(CCJTabCtrlBar)
00390     public:
00391     virtual BOOL PreTranslateMessage(MSG* pMsg);
00392     //}}AFX_VIRTUAL
00393
00394 // Generated message map functions
00395 protected:
00396     //{{AFX_MSG(CCJTabCtrlBar)
00397     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00398     afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
00399     afx_msg void OnTabSelChange(NMHDR* pNMHDR, LRESULT* pResult) ;
00400     //}}AFX_MSG
00401
00402     DECLARE_MESSAGE_MAP()
00403 };
00404
00406 //  Inline Functions
00408
00409 _CJXLIB_INLINE void CCJTabCtrlBar::SetTabMenuID(UINT popupMenuID, UINT popToolbarID, int nPos)
00410     { m_TabCtrl.SetMenuID(popupMenuID, popToolbarID, nPos); }
00411
00412 _CJXLIB_INLINE CView* CCJTabCtrlBar::GetActiveView()
00413     { return m_pActiveView; }
00414
00415 _CJXLIB_INLINE CImageList* CCJTabCtrlBar::SetTabImageList(CImageList *pImageList)
00416     { return m_TabCtrl.SetImageList (pImageList); }
00417
00418 _CJXLIB_INLINE BOOL CCJTabCtrlBar::ModifyTabStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags)
00419     { return m_TabCtrl.ModifyStyle(dwRemove, dwAdd, nFlags); }
00420
00422
00423 //{{AFX_INSERT_LOCATION}}
00424 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00425
00426 #endif // __CJTABCTRLBAR_H__
Generated on Sun Oct 21 12:41:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJTabView.h Source File

WinCvs/CJLib/Include/CJTabView.h

Go to the documentation of this file.
00001 // CJTabView.h: interface for the CCJTabView class.
00002 //
00003 // Copyright © 1999 Mike Manzo
00004 // mailto:mmanzo@ieee.org
00005 //
00007 /****************************************************************************
00008  *
00009  * $Date: 1999/11/30 21:45:51 $
00010  * $Revision: 1.1.1.3 $
00011  * $Archive: /CodeJock/Include/CJTabView.h $
00012  *
00013  * $History: CJTabView.h $
00014  *
00015  * *****************  Version 10  *****************
00016  * User: Kirk Stowell Date: 10/30/99   Time: 2:17p
00017  * Updated in $/CodeJock/Include
00018  * Overrode OnEraseBkgnd(...) for flicker free drawing.
00019  *
00020  * *****************  Version 9  *****************
00021  * User: Kirk Stowell Date: 10/26/99   Time: 10:48p
00022  * Updated in $/CodeJock/Include
00023  * Made class methods virtual for inheritance purposes.
00024  *
00025  * *****************  Version 8  *****************
00026  * User: Kirk Stowell Date: 10/24/99   Time: 3:15a
00027  * Updated in $/CodeJock/Include
00028  *
00029  * *****************  Version 7  *****************
00030  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00031  * Updated in $/CodeJock/Include
00032  * Added source control history to file header.
00033  *
00034  ***************************************************************************/
00036
00037 #ifndef __CJTABVIEW_H__
00038 #define __CJTABVIEW_H__
00039
00040 #if _MSC_VER > 1000
00041 #pragma once
00042 #endif // _MSC_VER > 1000
00043 // CJTabView.h : header file
00044 //
00045
00046 typedef struct tagCTV_ITEM
00047 {
00048     CWnd *pWnd;
00049     TCHAR szLabel[32];
00050 } CTV_ITEM;
00051
00052 #define TABVIEW_BORDER 3
00053
00054 // template list used to contain tab information
00055 typedef CList <CTV_ITEM*, CTV_ITEM *> CListViews;
00056
00057 // CCJTabView is a CCtrlView derived class which can be used to
00058 // create a view that contains a tab control
00059 class _CJX_EXT_CLASS CCJTabView : public CCtrlView
00060 {
00061     DECLARE_DYNCREATE(CCJTabView)
00062
00063 protected:
00064
00065     // Default constructor
00066     //
00067     CCJTabView();
00068
00069     // Virtual destructor
00070     //
00071     virtual ~CCJTabView();
00072
00073 protected:
00074
00075     CView*          m_pActiveView;  // pointer to the active view
00076     int             m_nActiveTab;   // index of the active tab
00077     CTabCtrl*       m_pTabCtrl;     // pointer to the tab control
00078     CToolTipCtrl*   m_pToolTip;     // pointer to the tooltip control
00079     CFont           m_TabFont;      // font used by tab control
00080     CListViews      m_views;        // template list containing tab information
00081
00082 public:
00083
00084     // this member function is called to add a view to the tab control
00085     //
00086     virtual BOOL AddView(
00087         // tab text
00088         LPCTSTR lpszLabel,
00089         // CView object associated with tab
00090         CRuntimeClass *pViewClass,
00091         // CDocument associated with view
00092         CDocument* pDoc = NULL,
00093         // create context for view
00094         CCreateContext *pContext = NULL);
00095
00096     // this member function will modify the style for the
00097     // tab control associated with this control.
00098     //
00099     virtual BOOL ModifyTabStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags=0);
00100
00101     // this member function will set a view active
00102     // based on a CView object
00103     //
00104     virtual void SetActiveView(CRuntimeClass *pViewClass);
00105
00106     // this member function will set a view active
00107     // based on index
00108     //
00109     virtual void SetActiveView(int nNewTab);
00110
00111     // this member function will remove a view based on its index
00112     //
00113     virtual void RemoveView(int nView);
00114
00115     // this member function returns a pointer to a view
00116     // based on a CView object
00117     //
00118     virtual CView* GetView(CRuntimeClass *pViewClass);
00119
00120     // this member function returns a pointer to a view
00121     // based on its index
00122     //
00123     virtual CView* GetView(int nView);
00124
00125     // this member function returns a pointer to the
00126     // active view in the tab control
00127     //
00128     virtual CView* GetActiveView();
00129
00130     // this member function initializes the image list
00131     // for the tab control
00132     //
00133     virtual CImageList* SetTabImageList(CImageList *pImageList);
00134
00135     // this member function returns a pointer to the
00136     // tab control associated with this control
00137     //
00138     virtual CTabCtrl* GetTabCtrl();
00139
00140     // this member function is called by the view, and
00141     // can be overloaded in derived classes to return the rect
00142     // for the child window associated with the control bar.
00143     //
00144     virtual void GetChildRect(
00145         // reference to a CRect object which contains the size of
00146         // the child window associated with the control bar.
00147         CRect &rect);
00148
00149 private:
00150
00151     void CalcViewRect(CRect* pRect);
00152
00153 // Overrides
00154     // ClassWizard generated virtual function overrides
00155     //{{AFX_VIRTUAL(CCJTabView)
00156     //}}AFX_VIRTUAL
00157
00158     // Generated message map functions
00159 protected:
00160     //{{AFX_MSG(CCJTabView)
00161     afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
00162     afx_msg void OnSelchange(NMHDR* pNMHDR, LRESULT* pResult);
00163     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00164     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00165     //}}AFX_MSG
00166     DECLARE_MESSAGE_MAP()
00167 };
00168
00170 //  Inline Functions
00172
00173 _CJXLIB_INLINE CTabCtrl* CCJTabView::GetTabCtrl()
00174     { return m_pTabCtrl; }
00175
00176 _CJXLIB_INLINE CView* CCJTabView::GetActiveView()
00177     { return m_pActiveView; }
00178
00180
00181 //{{AFX_INSERT_LOCATION}}
00182 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00183
00184 #endif // __CJTABVIEW_H__
Generated on Sun Oct 21 12:41:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJToolBar.h Source File

WinCvs/CJLib/Include/CJToolBar.h

Go to the documentation of this file.
00001 // CJToolBar.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJockey/Include/CJToolBar.h $
00011  *
00012  * $History: CJToolBar.h $
00013  *
00014  * *****************  Version 12  *****************
00015  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00016  * Updated in $/CodeJockey/Include
00017  * Updated copyright and contact information.
00018  *
00019  * *****************  Version 11  *****************
00020  * User: Kirk Stowell Date: 7/31/99    Time: 4:27p
00021  * Updated in $/CodeJockey/Include
00022  *
00023  * *****************  Version 10  *****************
00024  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00025  * Updated in $/CodeJockey/Include
00026  *
00027  * *****************  Version 6  *****************
00028  * User: Kirk Stowell Date: 7/18/99    Time: 10:20p
00029  * Updated in $/CodeJockey/Include
00030  * Re-wrote toolbar class for vc5 compatibility. Added customization based
00031  * on the "Customizable toolbar" article by Doug Keith -
00032  * http://www.codeguru.com/toolbar/customizable_tb.shtml.
00033  *
00034  * Cleaned up inline functions, and import/export macro so that class will
00035  * be imported when linked to, and exported at compile time.
00036  *
00037  * *****************  Version 5  *****************
00038  * User: Kirk Stowell Date: 4/03/99    Time: 11:44p
00039  * Updated in $/CodeJockey/Include
00040  * Added comments and cleaned up code.
00041  *
00042  * *****************  Version 4  *****************
00043  * User: Kirk Stowell Date: 3/13/99    Time: 11:43p
00044  * Updated in $/CodeJockey/Include
00045  * Changed class to handle both Office and DevStudio style to toolbars. To
00046  * use Office toolbars, use the CreateEx() method, otherwise your toolbars
00047  * will look like DevStudio.
00048  *
00049  * *****************  Version 3  *****************
00050  * User: Kirk Stowell Date: 12/14/98   Time: 11:42p
00051  * Updated in $/CodeJockey/Include
00052  * Changed class to derive from Paul DiLascia's CFlatToolBar, this class
00053  * adds gripper and control insertion.
00054  *
00055  * *****************  Version 2  *****************
00056  * User: Kirk Stowell Date: 11/02/98   Time: 11:41p
00057  * Updated in $/CodeJockey/Include
00058  * Fixed bug with DrawNoGripper() method - (Christian Skovdal Andersen).
00059  *
00060  * *****************  Version 1  *****************
00061  * User: Kirk Stowell Date: 10/17/98   Time: 11:41p
00062  * Created in $/CodeJockey/Include
00063  * Initial re-write and release.
00064  *
00065  ***************************************************************************/
00067
00068 #ifndef __CJTOOLBAR_H__
00069 #define __CJTOOLBAR_H__
00070
00071 #include "CJToolBarBase.h"
00072 #include "CJToolBarCtrl.h"
00073
00075
00076 // for determining version of COMCTL32.DLL
00077 #define VERSION_WIN4    MAKELONG(0, 4)
00078 #define VERSION_IE3     MAKELONG(70, 4)
00079 #define VERSION_IE4     MAKELONG(71, 4)
00080 #define VERSION_IE401   MAKELONG(72, 4)
00081
00082 extern int _ComCtlVersion;
00083 DWORD   AFXAPI _GetComCtlVersion();
00084 HBITMAP AFXAPI _LoadSysColorBitmap(HINSTANCE hInst, HRSRC hRsrc, BOOL bMono = FALSE);
00085
00086 // One of these for each drop-down button
00087 struct DROPDOWNBUTTON {
00088     DROPDOWNBUTTON* next;
00089     UINT            idButton;       // command ID of button
00090     UINT            idMenu;         // popup menu to display
00091 } ;
00092
00093 struct TOOLBARINFO {
00094     TBBUTTON         tbButton;      // information regarding the button
00095     LPCTSTR          btnText;       // text for the button
00096 };
00097
00098 class CCJToolBarCtrl;
00099
00100
00101 // CCJToolBar is a CCJToolBarBase derived class which Allows the
00102 // creation of toolbars simular to VisualStudio, Microsoft Office or Internet Explorer
00103 class _CJX_EXT_CLASS CCJToolBar : public CCJToolBarBase
00104 {
00105     DECLARE_DYNAMIC(CCJToolBar)
00106
00107 public:
00108
00109     // Default constructor
00110     //
00111     CCJToolBar();
00112
00113     // Virtual destructor
00114     //
00115     virtual ~CCJToolBar();
00116
00117 protected:
00118
00119     TOOLBARINFO*        m_pBarInfo;             // points to a TOOLBARINFO array used for toolbar customization.
00120     CObList*            m_pControls;            // CObject pointer list which contains controls added to the toolbar
00121     bool                m_bShowDropArrow;       // true to display a drop arrow when docked vertical
00122     HRSRC               m_hRsrcImageWell;       // handle to loaded resource for image well
00123     HINSTANCE           m_hInstImageWell;       // instance handle to load image well from
00124     HBITMAP             m_hbmImageWell;         // contains color mapped button images
00125     BOOL                m_bDelayedButtonLayout; // used to manage when button layout should be done
00126     CRect               m_rcOldPos;             // used when toolbar is moved
00127     int                 m_nButtons;             // used for customization
00128     HKEY                m_hKeyRoot;             // used for customization, holds registry key.
00129     CString             m_strSubKey;            // used for customization, holds registry subkey name.
00130     CString             m_strValueName;         // used for customization, holds registry value.
00131     static int          m_nBarNumber;           // used for customization, holds bar number for restoration.
00132     CSize               m_sizeImage;            // current image size
00133     CSize               m_sizeButton;           // current button size
00134     DROPDOWNBUTTON*     m_pDropButtons;         // list of dropdown button/menu pairs
00135     CMapStringToPtr*    m_pStringMap;           // used as CMapStringToUInt
00136
00137 public:
00138
00139     virtual BOOL Create(CWnd* pParentWnd,
00140         DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP,
00141         UINT nID = AFX_IDW_TOOLBAR);
00142
00143     virtual BOOL CreateEx(CWnd* pParentWnd, DWORD dwCtrlStyle = TBSTYLE_FLAT,
00144         DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP,
00145         CRect rcBorders = CRect(0, 0, 0, 0),
00146         UINT nID = AFX_IDW_TOOLBAR);
00147
00148     // this member function is called to insert a control into the toolbar
00149     // and returns a pointer to the newly inserted control
00150     //
00151     CWnd* InsertControl(
00152         // CRuntimeClass of the control to be inserted.
00153         CRuntimeClass* pClass,
00154         // window title ( if any ) of the control
00155         LPCTSTR lpszWindowName,
00156         // size of the control to be inserted
00157         CRect& rect,
00158         // resource id of the button where the control is to be placed
00159         UINT nID,
00160         // style flags for the control
00161         DWORD dwStyle );
00162
00163     CWnd* InsertControl(
00164         // points to already created control to be inserted.
00165         CWnd* pCtrl,
00166         // size of the control to be inserted
00167         CRect& rect,
00168         // resource id of the button where the control is to be placed
00169         UINT nID);
00170
00171     // call to add drop-down buttons
00172     BOOL AddDropDownButton(
00173         // resource id for toolbar button
00174         UINT nIDButton,
00175         // resource id of dropdown menu to be associated with button.
00176         UINT nIDMenu,
00177         // if the button is to have a drop arrow
00178         BOOL bArrow=TRUE);
00179
00180     // Find buttons structure for given ID
00181     DROPDOWNBUTTON* FindDropDownButton(
00182         // id of button to find.
00183         UINT nID);
00184
00185     // silly function to fake out compiler with const-ness
00186     LRESULT SendMessageC(UINT m, WPARAM wp=0, LPARAM lp=0) const;
00187
00188     void SetSizes(SIZE sizeButton, SIZE sizeImage);
00189
00190     // button size should be bigger than image
00191     void SetHeight(int cyHeight);
00192
00193     // call after SetSizes, height overrides bitmap size
00194     BOOL LoadToolBar(LPCTSTR lpszResourceName, TOOLBARINFO* pBarInfo=NULL);
00195     BOOL LoadToolBar(UINT nIDResource, TOOLBARINFO* pBarInfo=NULL);
00196
00197     BOOL LoadBitmap(LPCTSTR lpszResourceName);
00198     BOOL LoadBitmap(UINT nIDResource);
00199     BOOL SetBitmap(HBITMAP hbmImageWell);
00200
00201     // lpIDArray can be NULL to allocate empty buttons
00202     BOOL SetButtons(const UINT* lpIDArray, int nIDCount);
00203
00204     // standard control bar things
00205     int CommandToIndex(UINT nIDFind) const;
00206     UINT GetItemID(int nIndex) const;
00207     UINT GetButtonStyle(int nIndex) const;
00208     void SetButtonStyle(int nIndex, UINT nStyle);
00209
00210     void SaveState();
00211     void RestoreState();
00212
00213     // for changing button info
00214     void GetButtonInfo(int nIndex, UINT& nID, UINT& nStyle, int& iImage) const;
00215     void SetButtonInfo(int nIndex, UINT nID, UINT nStyle, int iImage);
00216     BOOL SetButtonText(int nIndex, LPCTSTR lpszText);
00217     CString GetButtonText(int nIndex) const;
00218     void GetButtonText(int nIndex, CString& rString) const;
00219
00220     // for direct access to the underlying common control
00221     CCJToolBarCtrl& GetToolBarCtrl() const;
00222
00223     void SetOwner(CWnd* pOwnerWnd);
00224     BOOL AddReplaceBitmap(HBITMAP hbmImageWell);
00225
00226     void GetButton(int nIndex, TBBUTTON* pButton) const;
00227     void SetButton(int nIndex, TBBUTTON* pButton);
00228
00229     // Wrappers that are not in MFC but should be;
00230     // I copied these from CToolBarCtrl
00231     BOOL EnableButton(int nID, BOOL bEnable);
00232     BOOL CheckButton(int nID, BOOL bCheck);
00233     BOOL PressButton(int nID, BOOL bPress);
00234     BOOL HideButton(int nID, BOOL bHide);
00235     BOOL Indeterminate(int nID, BOOL bIndeterminate);
00236     BOOL IsButtonEnabled(int nID) const;
00237     BOOL IsButtonChecked(int nID) const;
00238     BOOL IsButtonPressed(int nID) const;
00239     BOOL IsButtonHidden(int nID) const;
00240     BOOL IsButtonIndeterminate(int nID) const;
00241     BOOL SetState(int nID, UINT nState);
00242     int GetState(int nID) const;
00243     BOOL AddButtons(int nNumButtons, LPTBBUTTON lpButtons);
00244     BOOL InsertButton(int nIndex, LPTBBUTTON lpButton);
00245     BOOL DeleteButton(int nIndex);
00246     int GetButtonCount() const;
00247     void Customize();
00248     int AddStrings(LPCTSTR lpszStrings);
00249     void SetButtonStructSize(int nSize);
00250     BOOL SetButtonSize(CSize sz);
00251     BOOL SetBitmapSize(CSize sz);
00252     void AutoSize();
00253     CToolTipCtrl* GetToolTips() const;
00254     void SetToolTips(CToolTipCtrl* pTip);
00255     void SetRows(int nRows, BOOL bLarger, LPRECT lpRect);
00256     int GetRows() const;
00257     BOOL SetCmdID(int nIndex, UINT nID);
00258     UINT GetBitmapFlags() const;
00259
00260     // Wrappers for some of the newer messages--not complete
00261     BOOL SetIndent(int indent);
00262     HIMAGELIST GetImageList() const;
00263     HIMAGELIST SetImageList(HIMAGELIST hImgList);
00264     int GetBitmap(UINT nIdButton) const;
00265     DWORD SetExtendedStyle(DWORD dwStyle);
00266     BOOL GetRect(UINT nIdButton, RECT& rc) const;
00267     DWORD GetToolbarStyle() const;
00268     void SetToolbarStyle(DWORD dwStyle);
00269     int HitTest(CPoint p) const;
00270     int  GetHotItem() const;
00271     void SetHotItem(int iHot);
00272     BOOL MapAccelerator(TCHAR ch, UINT& nID) const;
00273     CSize GetPadding() const;
00274     CSize SetPadding(CSize sz);
00275
00276     // Implementation
00277 public:
00278
00279 #ifdef _DEBUG
00280     virtual void AssertValid() const;
00281     virtual void Dump(CDumpContext& dc) const;
00282 #endif
00283
00284 protected:
00285
00286     // implementation helpers
00287     CSize CalcLayout(DWORD nMode, int nLength = -1);
00288     CSize CalcSize(TBBUTTON* pData, int nCount);
00289     int WrapToolBar(TBBUTTON* pData, int nCount, int nWidth);
00290     void SizeToolBar(TBBUTTON* pData, int nCount, int nLength, BOOL bVert = FALSE);
00291     void Layout(); // called for for delayed button layout
00292
00293 public:
00294
00295 // Overrides
00296     // ClassWizard generated virtual function overrides
00297     //{{AFX_VIRTUAL(CCJToolBar)
00298     public:
00299     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
00300     virtual CSize CalcDynamicLayout(int nLength, DWORD nMode);
00301     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
00302     virtual void OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle);
00303     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00304     virtual int OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
00305     virtual void GetItemRect(int nIndex, LPRECT lpRect) const;
00306     //}}AFX_VIRTUAL
00307
00308     // helpers
00309     virtual void InvalidateOldPos(const CRect& rcInvalid);
00310     virtual CSize GetButtonSize(TBBUTTON* pData, int iButton);
00311
00312     // override to do your own weird drop-down buttons
00313     virtual void OnDropDownButton(const NMTOOLBAR& nmtb, UINT nID, CRect rc);
00314
00315 // Generated message map functions
00316 protected:
00317
00318     LRESULT OnSetSizeHelper(CSize& size, LPARAM lParam);
00319
00320     //{{AFX_MSG(CCJToolBar)
00321     afx_msg UINT OnNcHitTest(CPoint);
00322     afx_msg void OnNcPaint();
00323     afx_msg void OnPaint();
00324     afx_msg void OnNcCalcSize(BOOL, NCCALCSIZE_PARAMS*);
00325     afx_msg void OnWindowPosChanging(LPWINDOWPOS);
00326     afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos);
00327     afx_msg void OnSysColorChange();
00328     afx_msg LRESULT OnSetButtonSize(WPARAM, LPARAM);
00329     afx_msg LRESULT OnSetBitmapSize(WPARAM, LPARAM);
00330     afx_msg BOOL OnNcCreate(LPCREATESTRUCT);
00331     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00332     afx_msg void OnDestroy();
00333     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00334     //}}AFX_MSG
00335
00336     afx_msg void OnToolBarBtnDropDown(NMHDR* pNMHDR, LRESULT* pResult);
00337     afx_msg void OnToolBarQueryDelete(NMHDR *pNMHDR, LRESULT *pResult);
00338     afx_msg void OnToolBarQueryInsert(NMHDR *pNMHDR, LRESULT *pResult);
00339     afx_msg void OnToolBarChange(NMHDR *pNMHDR, LRESULT *pResult);
00340     afx_msg void OnToolBarBeginDrag(NMHDR *pNMHDR, LRESULT *pResult);
00341     afx_msg void OnToolBarEndDrag(NMHDR *pNMHDR, LRESULT *pResult);
00342     afx_msg void OnToolBarBeginAdjust(NMHDR *pNMHDR, LRESULT *pResult);
00343     afx_msg void OnToolBarCustomHelp(NMHDR *pNMHDR, LRESULT *pResult);
00344     afx_msg void OnToolBarEndAdjust(NMHDR *pNMHDR, LRESULT *pResult);
00345     afx_msg void OnToolBarGetButtonInfo(NMHDR *pNMHDR, LRESULT *pResult);
00346     afx_msg void OnToolBarReset(NMHDR *pNMHDR, LRESULT *pResult);
00347     afx_msg LRESULT OnPreserveZeroBorderHelper(WPARAM, LPARAM);
00348     DECLARE_MESSAGE_MAP()
00349 };
00350
00352 // inline functions
00354
00355 _CJXLIB_INLINE CCJToolBarCtrl& CCJToolBar::GetToolBarCtrl() const
00356     { ASSERT(::IsWindow(m_hWnd)); return *(CCJToolBarCtrl*)this; }
00357
00358 _CJXLIB_INLINE BOOL CCJToolBar::LoadBitmap(UINT nIDResource)
00359     { return LoadBitmap(MAKEINTRESOURCE(nIDResource)); }
00360
00361 _CJXLIB_INLINE BOOL CCJToolBar::LoadToolBar(UINT nIDResource, TOOLBARINFO* pBarInfo)
00362     { return LoadToolBar(MAKEINTRESOURCE(nIDResource), pBarInfo); }
00363
00364 _CJXLIB_INLINE LRESULT CCJToolBar::SendMessageC(UINT m, WPARAM wp, LPARAM lp) const
00365     { ASSERT(::IsWindow(m_hWnd)); return ((CCJToolBar*)this)->SendMessage(m, wp, lp); }
00366
00367 _CJXLIB_INLINE BOOL CCJToolBar::EnableButton(int nID, BOOL bEnable)
00368     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_ENABLEBUTTON, nID, MAKELPARAM(bEnable, 0)); }
00369
00370 _CJXLIB_INLINE BOOL CCJToolBar::CheckButton(int nID, BOOL bCheck)
00371     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_CHECKBUTTON, nID, MAKELPARAM(bCheck, 0)); }
00372
00373 _CJXLIB_INLINE BOOL CCJToolBar::PressButton(int nID, BOOL bPress)
00374     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_PRESSBUTTON, nID, MAKELPARAM(bPress, 0)); }
00375
00376 _CJXLIB_INLINE BOOL CCJToolBar::HideButton(int nID, BOOL bHide)
00377     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_HIDEBUTTON, nID, MAKELPARAM(bHide, 0)); }
00378
00379 _CJXLIB_INLINE BOOL CCJToolBar::Indeterminate(int nID, BOOL bIndeterminate)
00380     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_INDETERMINATE, nID, MAKELPARAM(bIndeterminate, 0)); }
00381
00382 _CJXLIB_INLINE BOOL CCJToolBar::IsButtonEnabled(int nID) const
00383     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_ISBUTTONENABLED, nID); }
00384
00385 _CJXLIB_INLINE BOOL CCJToolBar::IsButtonChecked(int nID) const
00386     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_ISBUTTONCHECKED, nID); }
00387
00388 _CJXLIB_INLINE BOOL CCJToolBar::IsButtonPressed(int nID) const
00389     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_ISBUTTONPRESSED, nID); }
00390
00391 _CJXLIB_INLINE BOOL CCJToolBar::IsButtonHidden(int nID) const
00392     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_ISBUTTONHIDDEN, nID); }
00393
00394 _CJXLIB_INLINE BOOL CCJToolBar::IsButtonIndeterminate(int nID) const
00395     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_ISBUTTONINDETERMINATE, nID); }
00396
00397 _CJXLIB_INLINE BOOL CCJToolBar::SetState(int nID, UINT nState)
00398     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETSTATE, nID, MAKELPARAM(nState, 0)); }
00399
00400 _CJXLIB_INLINE int CCJToolBar::GetState(int nID) const
00401     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETSTATE, nID); }
00402
00403 _CJXLIB_INLINE BOOL CCJToolBar::AddButtons(int nNumButtons, LPTBBUTTON lpButtons)
00404     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_ADDBUTTONS, nNumButtons, (LPARAM)lpButtons); }
00405
00406 _CJXLIB_INLINE BOOL CCJToolBar::InsertButton(int nIndex, LPTBBUTTON lpButton)
00407     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_INSERTBUTTON, nIndex, (LPARAM)lpButton); }
00408
00409 _CJXLIB_INLINE BOOL CCJToolBar::DeleteButton(int nIndex)
00410     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_DELETEBUTTON, nIndex); }
00411
00412 _CJXLIB_INLINE int CCJToolBar::GetButtonCount() const
00413     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_BUTTONCOUNT); }
00414
00415 _CJXLIB_INLINE void CCJToolBar::Customize()
00416     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_CUSTOMIZE, 0, 0L); }
00417
00418 _CJXLIB_INLINE int CCJToolBar::AddStrings(LPCTSTR lpszStrings)
00419     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_ADDSTRING, 0, (LPARAM)lpszStrings); }
00420
00421 _CJXLIB_INLINE void CCJToolBar::SetButtonStructSize(int nSize)
00422     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_BUTTONSTRUCTSIZE, nSize); }
00423
00424 _CJXLIB_INLINE BOOL CCJToolBar::SetButtonSize(CSize sz)
00425     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETBUTTONSIZE, 0, MAKELPARAM(sz.cx, sz.cy)); }
00426
00427 _CJXLIB_INLINE BOOL CCJToolBar::SetBitmapSize(CSize sz)
00428     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETBITMAPSIZE, 0, MAKELPARAM(sz.cx, sz.cy)); }
00429
00430 _CJXLIB_INLINE void CCJToolBar::AutoSize()
00431     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_AUTOSIZE); }
00432
00433 _CJXLIB_INLINE CToolTipCtrl* CCJToolBar::GetToolTips() const
00434     { ASSERT(::IsWindow(m_hWnd)); return (CToolTipCtrl*)CWnd::FromHandle((HWND)SendMessageC(TB_GETTOOLTIPS)); }
00435
00436 _CJXLIB_INLINE void CCJToolBar::SetToolTips(CToolTipCtrl* pTip)
00437     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_SETTOOLTIPS, (WPARAM)pTip->m_hWnd); }
00438
00439 _CJXLIB_INLINE void CCJToolBar::SetRows(int nRows, BOOL bLarger, LPRECT lpRect)
00440     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_SETROWS, MAKELPARAM(nRows, bLarger), (LPARAM)lpRect); }
00441
00442 _CJXLIB_INLINE int CCJToolBar::GetRows() const
00443     { ASSERT(::IsWindow(m_hWnd)); return (int) SendMessageC(TB_GETROWS); }
00444
00445 _CJXLIB_INLINE BOOL CCJToolBar::SetCmdID(int nIndex, UINT nID)
00446     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETCMDID, nIndex, nID); }
00447
00448 _CJXLIB_INLINE UINT CCJToolBar::GetBitmapFlags() const
00449     { ASSERT(::IsWindow(m_hWnd)); return (UINT) SendMessageC(TB_GETBITMAPFLAGS); }
00450
00451 // Wrappers for some of the newer messages--not complete
00452 _CJXLIB_INLINE BOOL CCJToolBar::SetIndent(int indent)
00453     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETINDENT, indent); }
00454
00455 _CJXLIB_INLINE HIMAGELIST CCJToolBar::GetImageList() const
00456     { ASSERT(::IsWindow(m_hWnd)); return (HIMAGELIST)SendMessageC(TB_GETIMAGELIST); }
00457
00458 _CJXLIB_INLINE HIMAGELIST CCJToolBar::SetImageList(HIMAGELIST hImgList)
00459     { ASSERT(::IsWindow(m_hWnd)); return (HIMAGELIST)SendMessage(TB_SETIMAGELIST, 0, (LPARAM)hImgList); }
00460
00461 _CJXLIB_INLINE int CCJToolBar::GetBitmap(UINT nIdButton) const
00462     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETBITMAP, nIdButton); }
00463
00464 _CJXLIB_INLINE DWORD CCJToolBar::SetExtendedStyle(DWORD dwStyle)
00465     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETEXTENDEDSTYLE, 0, dwStyle); }
00466
00467 _CJXLIB_INLINE BOOL CCJToolBar::GetRect(UINT nIdButton, RECT& rc) const
00468     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETRECT, nIdButton, (LPARAM)&rc); }
00469
00470 _CJXLIB_INLINE DWORD CCJToolBar::GetToolbarStyle() const
00471     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETSTYLE); }
00472
00473 _CJXLIB_INLINE void CCJToolBar::SetToolbarStyle(DWORD dwStyle)
00474     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_SETSTYLE, 0, dwStyle); }
00475
00476 _CJXLIB_INLINE int CCJToolBar::HitTest(CPoint p) const
00477     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_HITTEST, 0, (LPARAM)&p); }
00478
00479 _CJXLIB_INLINE int CCJToolBar:: GetHotItem() const
00480     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETHOTITEM); }
00481
00482 _CJXLIB_INLINE void CCJToolBar::SetHotItem(int iHot)
00483     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_SETHOTITEM, iHot); }
00484
00485 _CJXLIB_INLINE BOOL CCJToolBar::MapAccelerator(TCHAR ch, UINT& nID) const
00486     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_MAPACCELERATOR, (WPARAM)ch, (LPARAM)&nID); }
00487
00488 _CJXLIB_INLINE CSize CCJToolBar::GetPadding() const
00489     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETPADDING); }
00490
00491 _CJXLIB_INLINE CSize CCJToolBar::SetPadding(CSize sz)
00492     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETPADDING, 0, MAKELPARAM(sz.cx,sz.cy)); }
00493
00494 // Styles for toolbar buttons
00495 #define TBBS_BUTTON     MAKELONG(TBSTYLE_BUTTON, 0) // this entry is button
00496 #define TBBS_SEPARATOR  MAKELONG(TBSTYLE_SEP, 0)    // this entry is a separator
00497 #define TBBS_CHECKBOX   MAKELONG(TBSTYLE_CHECK, 0)  // this is an auto check button
00498 #define TBBS_GROUP      MAKELONG(TBSTYLE_GROUP, 0)  // marks the start of a group
00499 #define TBBS_CHECKGROUP (TBBS_GROUP|TBBS_CHECKBOX)  // normal use of TBBS_GROUP
00500 #define TBBS_DROPDOWN   MAKELONG(TBSTYLE_DROPDOWN, 0) // drop down style
00501 #define TBBS_AUTOSIZE   MAKELONG(TBSTYLE_AUTOSIZE, 0) // autocalc button width
00502 #define TBBS_NOPREFIX   MAKELONG(TBSTYLE_NOPREFIX, 0) // no accel prefix for this button
00503
00504 // styles for display states
00505 #define TBBS_CHECKED    MAKELONG(0, TBSTATE_CHECKED)    // button is checked/down
00506 #define TBBS_PRESSED    MAKELONG(0, TBSTATE_PRESSED)    // button is being depressed
00507 #define TBBS_DISABLED   MAKELONG(0, TBSTATE_ENABLED)    // button is disabled
00508 #define TBBS_INDETERMINATE  MAKELONG(0, TBSTATE_INDETERMINATE)  // third state
00509 #define TBBS_HIDDEN     MAKELONG(0, TBSTATE_HIDDEN) // button is hidden
00510 #define TBBS_WRAPPED    MAKELONG(0, TBSTATE_WRAP)   // button is wrapped at this point
00511 #define TBBS_ELLIPSES   MAKELONG(0, TBSTATE_ELIPSES)
00512 #define TBBS_MARKED     MAKELONG(0, TBSTATE_MARKED)
00513
00514 #endif //__TBCTL_H__
00515
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJToolBarBase.h Source File

WinCvs/CJLib/Include/CJToolBarBase.h

Go to the documentation of this file.
00001 // CJToolBarBase.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new IE4 controls'
00007 // http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/Include/CJToolBarBase.h $
00015  *
00016  * $History: CJToolBarBase.h $
00017  *
00018  * *****************  Version 8  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/Include
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 7  *****************
00024  * User: Kirk Stowell Date: 7/31/99    Time: 4:27p
00025  * Updated in $/CodeJockey/Include
00026  *
00027  * *****************  Version 5  *****************
00028  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00029  * Updated in $/CodeJockey/Include
00030  *
00031  * *****************  Version 4  *****************
00032  * User: Kirk Stowell Date: 7/25/99    Time: 12:12a
00033  * Updated in $/CodeJockey/Include
00034  *
00035  * *****************  Version 3  *****************
00036  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00037  * Updated in $/CodeJockey/Include
00038  *
00039  * *****************  Version 2  *****************
00040  * User: Kirk Stowell Date: 7/18/99    Time: 10:10p
00041  * Updated in $/CodeJockey/Include
00042  * Cleaned up inline functions, and import/export macro so that class will
00043  * be imported when linked to, and exported at compile time.
00044  *
00045  * *****************  Version 1  *****************
00046  * User: Kirk Stowell Date: 7/14/99    Time: 10:29p
00047  * Created in $/CodeJockey/Include
00048  * Copied from MFC v6 and techno preview for v5. Added to extend
00049  * functionality to Visual C++ 5.0 users.
00050  *
00051  ***************************************************************************/
00053
00054 #ifndef __CCJTOOLBARBASE_H__
00055 #define __CCJTOOLBARBASE_H__
00056
00057 #ifdef _VC_VERSION_5
00058 typedef struct tagAFX_OLDTOOLINFO
00059 {
00060     UINT cbSize;
00061     UINT uFlags;
00062     HWND hwnd;
00063     UINT uId;
00064     RECT rect;
00065     HINSTANCE hinst;
00066     LPTSTR lpszText;
00067 } AFX_OLDTOOLINFO;
00068
00069 #define CBRS_GRIPPER                    0x00400000L
00070 #endif // _VC_VERSION_5
00071
00072 // CCJToolBarBase is a CControlBar derived class whis is used
00073 // by the CCJToolBar class.
00074 class _CJX_EXT_CLASS CCJToolBarBase : public CControlBar
00075 {
00076     DECLARE_DYNAMIC(CCJToolBarBase)
00077         // Construction
00078 protected:
00079     CCJToolBarBase();
00080
00081 // Attributes
00082     // getting and setting border space
00083     void SetBorders(LPCRECT lpRect);
00084     void SetBorders(int cxLeft = 0, int cyTop = 0, int cxRight = 0, int cyBottom = 0);
00085     CRect GetBorders() const;
00086
00087 // Implementation
00088 public:
00089     bool    m_bInReBar; // true if rebar is parent.
00090     bool    m_bExStyle; // true if created with the CreateEx style.
00091
00092     virtual ~CCJToolBarBase();
00093     virtual void DoPaint(CDC* pDC);
00094     void DrawGripper(CDC* pDC, const CRect& rect);
00095
00096     // implementation helpers
00097     virtual LRESULT WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam);
00098     void CalcInsideRect(CRect& rect, BOOL bHorz) const; // adjusts borders etc
00099     void EraseNonClient();
00100     void DrawBorders(CDC* pDC, CRect& rect);
00101
00102     //{{AFX_MSG(CCJToolBarBase)
00103     afx_msg void OnPaint();
00104     afx_msg void OnWindowPosChanging(LPWINDOWPOS lpWndPos);
00105     //}}AFX_MSG
00106     DECLARE_MESSAGE_MAP()
00107 };
00108
00110 // inline functions
00112
00113 _CJXLIB_INLINE void CCJToolBarBase::SetBorders(LPCRECT lpRect)
00114     { SetBorders(lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); }
00115
00116 #endif //__CCJTOOLBARBASE_H__
00117
00119
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJToolBarCtrl.h Source File

WinCvs/CJLib/Include/CJToolBarCtrl.h

Go to the documentation of this file.
00001 // CJToolBarCtrl.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Copied from MFC, Visual C++ 6, to extend functionality to Visual C++ 5
00006 // users, with some ideas taken from Luis Barreira's article 'Classes for new IE4 controls'
00007 // http://www.codeguru.com/controls/ie4_controls_classes.shtml
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.3 $
00014  * $Archive: /CodeJockey/Include/CJToolBarCtrl.h $
00015  *
00016  * $History: CJToolBarCtrl.h $
00017  *
00018  * *****************  Version 8  *****************
00019  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00020  * Updated in $/CodeJockey/Include
00021  * Updated copyright and contact information.
00022  *
00023  * *****************  Version 7  *****************
00024  * User: Kirk Stowell Date: 7/31/99    Time: 4:27p
00025  * Updated in $/CodeJockey/Include
00026  *
00027  * *****************  Version 5  *****************
00028  * User: Kirk Stowell Date: 7/25/99    Time: 10:00p
00029  * Updated in $/CodeJockey/Include
00030  *
00031  * *****************  Version 4  *****************
00032  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00033  * Updated in $/CodeJockey/Include
00034  *
00035  * *****************  Version 3  *****************
00036  * User: Kirk Stowell Date: 6/23/99    Time: 12:33a
00037  * Updated in $/CodeJockey/Include
00038  *
00039  * *****************  Version 2  *****************
00040  * User: Kirk Stowell Date: 7/18/99    Time: 10:10p
00041  * Updated in $/CodeJockey/Include
00042  * Cleaned up inline functions, and import/export macro so that class will
00043  * be imported when linked to, and exported at compile time.
00044  *
00045  * *****************  Version 1  *****************
00046  * User: Kirk Stowell Date: 7/14/99    Time: 10:29p
00047  * Created in $/CodeJockey/Include
00048  * Copied from MFC v6 and techno preview for v5. Added to extend
00049  * functionality to Visual C++ 5.0 users.
00050  *
00051  ***************************************************************************/
00052
00053 #ifndef __CJTOOLBARCTRL_H__
00054 #define __CJTOOLBARCTRL_H__
00055
00056 // The CCJToolBarCtrl class provides the functionality of the Windows toolbar
00057 // common control. This control (and therefore the CCJToolBarCtrl class) is available
00058 // only to programs running under Windows 95 and Windows NT version 3.51 and later.
00059 class _CJX_EXT_CLASS CCJToolBarCtrl : public CToolBarCtrl
00060 {
00061 // Construction
00062 public:
00063   CCJToolBarCtrl();
00064   BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
00065
00066 // Attributes
00067 public:
00068     DWORD GetButtonSize() const;
00069     CImageList* GetDisabledImageList() const;
00070     CImageList* GetHotImageList() const;
00071     CImageList* GetImageList() const;
00072     DWORD GetStyle() const;
00073     int GetMaxTextRows() const;
00074     BOOL IsButtonHighlighted(int nID) const;
00075     BOOL SetButtonWidth(int cxMin, int cxMax);
00076     CImageList* SetDisabledImageList(CImageList* pImageList);
00077     CImageList* SetHotImageList(CImageList* pImageList);
00078     CImageList* SetImageList(CImageList* pImageList);
00079     HRESULT GetDropTarget(IDropTarget** ppDropTarget) const;;
00080     BOOL SetIndent(int iIndent);
00081     BOOL SetMaxTextRows(int iMaxRows);
00082     void SetStyle(DWORD dwStyle);
00083     BOOL GetButtonInfo(int nID, TBBUTTONINFO* ptbbi) const;
00084     BOOL SetButtonInfo(int nID, TBBUTTONINFO* ptbbi);
00085     DWORD SetDrawTextFlags(DWORD dwMask, DWORD dwDTFlags);
00086     BOOL GetAnchorHighlight() const;
00087     BOOL SetAnchorHighlight(BOOL fAnchor = TRUE);
00088     int GetHotItem() const;
00089     int SetHotItem(int nHot);
00090     void GetInsertMark(TBINSERTMARK* ptbim) const;
00091     void SetInsertMark(TBINSERTMARK* ptbim);
00092     BOOL GetMaxSize(LPSIZE pSize) const;
00093     BOOL InsertMarkHitTest(LPPOINT ppt, LPTBINSERTMARK ptbim) const;
00094     DWORD GetExtendedStyle() const;
00095     DWORD SetExtendedStyle(DWORD dwExStyle);
00096     COLORREF GetInsertMarkColor() const;
00097     COLORREF SetInsertMarkColor(COLORREF clrNew);
00098
00099 // Operations
00100 public:
00101     BOOL MapAccelerator(TCHAR chAccel, UINT* pIDBtn);
00102     BOOL MarkButton(int nID, BOOL bHighlight = TRUE);
00103     BOOL MoveButton(UINT nOldPos, UINT nNewPos);
00104     int HitTest(LPPOINT ppt) const;
00105
00106 // Overrides
00107     // ClassWizard generated virtual function overrides
00108     //{{AFX_VIRTUAL(CCJToolBarCtrl)
00109     //}}AFX_VIRTUAL
00110
00111 // Implementation
00112 public:
00113     virtual ~CCJToolBarCtrl();
00114
00115     // Generated message map functions
00116 protected:
00117     //{{AFX_MSG(CCJToolBarCtrl)
00118     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00119     //}}AFX_MSG
00120
00121     DECLARE_MESSAGE_MAP()
00122 };
00123
00125 // inline functions
00127
00128 _CJXLIB_INLINE DWORD CCJToolBarCtrl::GetButtonSize() const
00129     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, TB_GETBUTTONSIZE, 0, 0L); }
00130
00131 _CJXLIB_INLINE CImageList* CCJToolBarCtrl::GetDisabledImageList() const
00132     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_GETDISABLEDIMAGELIST, 0, 0)); }
00133
00134 _CJXLIB_INLINE CImageList* CCJToolBarCtrl::GetHotImageList() const
00135     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_GETHOTIMAGELIST, 0, 0)); }
00136
00137 _CJXLIB_INLINE CImageList* CCJToolBarCtrl::GetImageList() const
00138     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_GETIMAGELIST, 0, 0)); }
00139
00140 _CJXLIB_INLINE DWORD CCJToolBarCtrl::GetStyle() const
00141     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, TB_GETSTYLE, 0, 0L); }
00142
00143 _CJXLIB_INLINE int CCJToolBarCtrl::GetMaxTextRows() const
00144     { ASSERT(::IsWindow(m_hWnd)); return (INT) ::SendMessage(m_hWnd, TB_GETTEXTROWS, 0, 0L); }
00145
00146 _CJXLIB_INLINE BOOL CCJToolBarCtrl::IsButtonHighlighted(int nID) const
00147     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_ISBUTTONHIGHLIGHTED, nID, 0); }
00148
00149 _CJXLIB_INLINE BOOL CCJToolBarCtrl::SetButtonWidth(int cxMin, int cxMax)
00150     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_SETBUTTONWIDTH, 0, MAKELPARAM(cxMin, cxMax)); }
00151
00152 _CJXLIB_INLINE CImageList* CCJToolBarCtrl::SetDisabledImageList(CImageList* pImageList)
00153     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)pImageList->GetSafeHandle())); }
00154
00155 _CJXLIB_INLINE CImageList* CCJToolBarCtrl::SetHotImageList(CImageList* pImageList)
00156     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_SETHOTIMAGELIST, 0, (LPARAM)pImageList->GetSafeHandle())); }
00157
00158 _CJXLIB_INLINE CImageList* CCJToolBarCtrl::SetImageList(CImageList* pImageList)
00159     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_SETIMAGELIST, 0, (LPARAM)pImageList->GetSafeHandle())); }
00160
00161 _CJXLIB_INLINE BOOL CCJToolBarCtrl::SetIndent(int iIndent)
00162     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_SETINDENT, iIndent, 0L); }
00163
00164 _CJXLIB_INLINE BOOL CCJToolBarCtrl::SetMaxTextRows(int iMaxRows)
00165     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_SETMAXTEXTROWS, iMaxRows, 0L); }
00166
00167 _CJXLIB_INLINE void CCJToolBarCtrl::SetStyle(DWORD dwStyle)
00168     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, TB_SETSTYLE, 0, dwStyle); }
00169
00170 _CJXLIB_INLINE BOOL CCJToolBarCtrl::GetButtonInfo(int nID, TBBUTTONINFO* ptbbi) const
00171     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_GETBUTTONINFO, nID, (LPARAM)ptbbi); }
00172
00173 _CJXLIB_INLINE BOOL CCJToolBarCtrl::SetButtonInfo(int nID, TBBUTTONINFO* ptbbi)
00174     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)ptbbi); }
00175
00176 _CJXLIB_INLINE DWORD CCJToolBarCtrl::SetDrawTextFlags(DWORD dwMask, DWORD dwDTFlags)
00177     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, TB_SETDRAWTEXTFLAGS, dwMask, dwDTFlags); }
00178
00179 _CJXLIB_INLINE BOOL CCJToolBarCtrl::GetAnchorHighlight() const
00180     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_GETANCHORHIGHLIGHT, 0, 0); }
00181
00182 _CJXLIB_INLINE BOOL CCJToolBarCtrl::SetAnchorHighlight(BOOL fAnchor)
00183     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_SETANCHORHIGHLIGHT, fAnchor, 0); }
00184
00185 _CJXLIB_INLINE int CCJToolBarCtrl::GetHotItem() const
00186     { ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, TB_GETHOTITEM, 0, 0); }
00187
00188 _CJXLIB_INLINE int CCJToolBarCtrl::SetHotItem(int nHot)
00189     { ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, TB_SETHOTITEM, nHot, 0); }
00190
00191 _CJXLIB_INLINE void CCJToolBarCtrl::GetInsertMark(TBINSERTMARK* ptbim) const
00192     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, TB_GETINSERTMARK, 0, (LPARAM)ptbim); }
00193
00194 _CJXLIB_INLINE void CCJToolBarCtrl::SetInsertMark(TBINSERTMARK* ptbim)
00195     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, TB_SETINSERTMARK, 0, (LPARAM)ptbim); }
00196
00197 _CJXLIB_INLINE BOOL CCJToolBarCtrl::GetMaxSize(LPSIZE pSize) const
00198     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_GETMAXSIZE, 0, (LPARAM)pSize); }
00199
00200 _CJXLIB_INLINE BOOL CCJToolBarCtrl::InsertMarkHitTest(LPPOINT ppt, LPTBINSERTMARK ptbim) const
00201     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)ppt, (LPARAM)ptbim); }
00202
00203 _CJXLIB_INLINE DWORD CCJToolBarCtrl::GetExtendedStyle() const
00204     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, TB_GETEXTENDEDSTYLE, 0, 0L); }
00205
00206 _CJXLIB_INLINE DWORD CCJToolBarCtrl::SetExtendedStyle(DWORD dwExStyle)
00207     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, TB_SETEXTENDEDSTYLE, 0, dwExStyle); }
00208
00209 _CJXLIB_INLINE COLORREF CCJToolBarCtrl::GetInsertMarkColor() const
00210     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, TB_GETINSERTMARKCOLOR, 0, 0); }
00211
00212 _CJXLIB_INLINE COLORREF CCJToolBarCtrl::SetInsertMarkColor(COLORREF clrNew)
00213     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, TB_SETINSERTMARKCOLOR, 0, (LPARAM) clrNew); }
00214
00215 _CJXLIB_INLINE BOOL CCJToolBarCtrl::MapAccelerator(TCHAR chAccel, UINT* pIDBtn)
00216     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_MAPACCELERATOR, (WPARAM)chAccel, (LPARAM)pIDBtn); }
00217
00218 _CJXLIB_INLINE BOOL CCJToolBarCtrl::MarkButton(int nID, BOOL bHighlight)
00219     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_MARKBUTTON, nID, MAKELPARAM(bHighlight, 0)); }
00220
00221 _CJXLIB_INLINE BOOL CCJToolBarCtrl::MoveButton(UINT nOldPos, UINT nNewPos)
00222     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_MOVEBUTTON, nOldPos, nNewPos); }
00223
00224 _CJXLIB_INLINE int CCJToolBarCtrl::HitTest(LPPOINT ppt) const
00225     { ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, TB_HITTEST, 0, (LPARAM)ppt); }
00226
00227 #endif //__CJTOOLBARCTRL_H__
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJTreeCtrl.h Source File

WinCvs/CJLib/Include/CJTreeCtrl.h

Go to the documentation of this file.
00001 // CJTreeCtrl.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00005 // Based on the CTreeView articles from http://www.codeguru.com/treeview
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:51 $
00011  * $Revision: 1.1.1.2 $
00012  * $Archive: /CodeJock/Include/CJTreeCtrl.h $
00013  *
00014  * $History: CJTreeCtrl.h $
00015  *
00016  * *****************  Version 6  *****************
00017  * User: Kirk Stowell Date: 10/30/99   Time: 2:17p
00018  * Updated in $/CodeJock/Include
00019  * Overrode OnEraseBkgnd(...) for flicker free drawing.
00020  *
00021  * *****************  Version 5  *****************
00022  * User: Kirk Stowell Date: 10/26/99   Time: 10:49p
00023  * Updated in $/CodeJock/Include
00024  * Made class methods virtual for inheritance purposes.
00025  *
00026  * *****************  Version 4  *****************
00027  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00028  * Updated in $/CodeJockey/Include
00029  *
00030  * *****************  Version 3  *****************
00031  * User: Kirk Stowell Date: 7/25/99    Time: 12:15a
00032  * Updated in $/CodeJockey/Include
00033  *
00034  * *****************  Version 2  *****************
00035  * User: Kirk Stowell Date: 6/23/99    Time: 12:09a
00036  * Updated in $/CodeJockey/Include
00037  *
00038  * *****************  Version 1  *****************
00039  * User: Kirk Stowell Date: 6/23/99    Time: 12:04a
00040  * Created in $/CodeJockey/Include
00041  * Initial creation.
00042  *
00043  ***************************************************************************/
00045
00046 #ifndef __CJTREECTRL_H__
00047 #define __CJTREECTRL_H__
00048
00049 #if _MSC_VER >= 1000
00050 #pragma once
00051 #endif // _MSC_VER >= 1000
00052
00053 #include <afxtempl.h>
00054
00055 // CCJTreeCtrl is a CTreeCtrl derived class which extends the base class to add
00056 // additional functionality and enhancements.
00057 class _CJX_EXT_CLASS CCJTreeCtrl : public CTreeCtrl
00058 {
00059     DECLARE_DYNAMIC(CCJTreeCtrl)
00060
00061 public:
00062
00063     // Default constructor
00064     //
00065     CCJTreeCtrl();
00066
00067     // Virtual destructor
00068     //
00069     virtual ~CCJTreeCtrl();
00070
00071 protected:
00072
00073     HTREEITEM   m_hItemFirstSel;    // first selected item in a multi selection tree control.
00074     DWORD       m_dwDragStart;      // the number of milliseconds that have elapsed since the system was started.
00075     BOOL        m_bMultiSelect;     // TRUE for a multiselection tree control.
00076
00077     struct Color_Font { COLORREF color; LOGFONT logfont; };
00078     CMap< void*, void*, Color_Font, Color_Font& > m_mapColorFont ;
00079
00080 public:
00081
00082     // Call this function to retrieve the tree view item that has the specified
00083     // relationship, indicated by the nCode parameter, to hItem.
00084     // Returns The handle of the next item if successful; otherwise NULL.
00085     virtual HTREEITEM GetNextItem(
00086         // Handle of a tree item.
00087         HTREEITEM hItem,
00088         // A flag indicating the type of relation to hItem. This flag can be one of the
00089         // following values:
00090         // TVGN_CARET   Retrieves the currently selected item.
00091         // TVGN_CHILD   Retrieves the first child item. The hItem parameter must be NULL.
00092         // TVGN_DROPHILITE   Retrieves the item that is the target of a drag-and-drop operation.
00093         // TVGN_FIRSTVISIBLE   Retrieves the first visible item.
00094         // TVGN_NEXT   Retrieves the next sibling item.
00095         // TVGN_NEXTVISIBLE   Retrieves the next visible item that follows the specified item.
00096         // TVGN_PARENT   Retrieves the parent of the specified item.
00097         // TVGN_PREVIOUS   Retrieves the previous sibling item.
00098         // TVGN_PREVIOUSVISIBLE   Retrieves the first visible item that precedes the specified item.
00099         // TVGN_ROOT   Retrieves the first child item of the root item of which the specified item is a part.
00100         UINT nCode );
00101
00102     // Get next item as if outline was completely expanded
00103     // Returns the item immediately below the reference item.
00104     //
00105     virtual HTREEITEM GetNextItem(
00106         // The reference item
00107         HTREEITEM hItem );
00108
00109     // Get previous item as if outline was completely expanded.
00110     // Returns the item immediately above the reference item.
00111     //
00112     virtual HTREEITEM GetPrevItem(
00113         // The reference item
00114         HTREEITEM hItem );
00115
00116     // Gets last item in the branch, returns the last item.
00117     //
00118     virtual HTREEITEM GetLastItem(
00119         // Node identifying the branch. NULL will return the last item in outine.
00120         HTREEITEM hItem );
00121
00122     // Returns the previously selected tree item in a multi selection tree control.
00123     //
00124     virtual HTREEITEM GetPrevSelectedItem(
00125         // The reference item.
00126         HTREEITEM hItem );
00127
00128     // Returns the next selected item in a multi selection tree control.
00129     virtual HTREEITEM GetNextSelectedItem(
00130         // The reference item.
00131         HTREEITEM hItem );
00132
00133     // Returns the first selected item in a multi selection tree control.
00134     //
00135     virtual HTREEITEM GetFirstSelectedItem();
00136
00137     // Returns the RGB text value for the referenced tree item.
00138     // Returns (COLORREF)-1 if color was not set.
00139     //
00140     virtual COLORREF GetItemColor(
00141         // The reference item
00142         HTREEITEM hItem);
00143
00144     // Clears all selections from multi selection tree control.
00145     //
00146     virtual void ClearSelection();
00147
00148     // sets the font for the reference tree item.
00149     //
00150     virtual void SetItemFont(
00151         // The reference item
00152         HTREEITEM hItem,
00153         // new font for tree item.
00154         LOGFONT& logfont);
00155
00156     // sets the font to bold for the refernece tree item.
00157     //
00158     virtual void SetItemBold(
00159         // The reference item
00160         HTREEITEM hItem,
00161         // TRUE for bold font.
00162         BOOL bBold=TRUE);
00163
00164     // Sets the text color for the tree item.
00165     //
00166     virtual void SetItemColor(
00167         // The reference item
00168         HTREEITEM hItem,
00169         // RGB value for the tree items text.
00170         COLORREF color);
00171
00172     // enables multi selection tree control.
00173     //
00174     virtual void EnableMultiSelect(
00175         // TRUE for multi selection tree control.
00176         BOOL bMultiSelect=TRUE);
00177
00178     // returns the current font used by the tree item.
00179     //
00180     virtual BOOL GetItemFont(
00181         // The reference item
00182         HTREEITEM hItem,
00183         // item font.
00184         LOGFONT * plogfont);
00185
00186     // returns TRUE if the tree item has a bold font.
00187     virtual BOOL GetItemBold(
00188         // The reference item
00189         HTREEITEM hItem);
00190
00191     // Selects items from hItemFrom to hItemTo in a multi selection tree control.
00192     // Does not select child item if parent is collapsed. Removes selection from
00193     // all other items.
00194     //
00195     virtual BOOL SelectItems(
00196         // item to start selecting from.
00197         HTREEITEM hItemFrom,
00198         // item to end selection at.
00199         HTREEITEM hItemTo);
00200
00201     // Finds an item that contains the search string, returns the handle
00202     // to the item or NULL.
00203     //
00204     virtual HTREEITEM FindItem(
00205         // String to search for.
00206         LPCTSTR lpszSearch,
00207         // Should the search be case sensitive.
00208         BOOL bCaseSensitive = FALSE,
00209         // Search direction - TRUE for down.
00210         BOOL bDownDir = TRUE,
00211         // True if search should match whole words.
00212         BOOL bWholeWord = FALSE,
00213         // Item to start searching from. NULL for currently selected item.
00214         HTREEITEM hItem = NULL);
00215
00216 protected:
00217
00218     // Virtual function used by FindItem to allow this function to filter the
00219     // result of FindItem returns TRUE if item matches the criteria.
00220     //
00221     virtual BOOL IsFindValid(
00222         // Handle of the item
00223         HTREEITEM hti);
00224
00225 // Overrides
00226     // ClassWizard generated virtual function overrides
00227     //{{AFX_VIRTUAL(CCJTreeCtrl)
00228     protected:
00229     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00230     //}}AFX_VIRTUAL
00231
00232     // Generated message map functions
00233 protected:
00234     //{{AFX_MSG(CCJTreeCtrl)
00235     afx_msg void OnPaint();
00236     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00237     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00238     //}}AFX_MSG
00239
00240     DECLARE_MESSAGE_MAP()
00241 };
00242
00244 //  Inline Functions
00246
00247 _CJXLIB_INLINE HTREEITEM CCJTreeCtrl::GetNextItem( HTREEITEM hItem, UINT nCode )
00248     { return CTreeCtrl::GetNextItem( hItem, nCode ); }
00249
00250 _CJXLIB_INLINE void CCJTreeCtrl::EnableMultiSelect(BOOL bMultiSelect)
00251     { m_bMultiSelect = bMultiSelect; }
00252
00254
00255 //{{AFX_INSERT_LOCATION}}
00256 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00257
00258 #endif // __CJTREECTRL_H__
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/CJWindowPlacement.h Source File

WinCvs/CJLib/Include/CJWindowPlacement.h

Go to the documentation of this file.
00001 // CJWindowPlacement.h : header file
00002 // Copyright © 1998-1999 CodeJock.com, All Rights Reserved.
00003 // See ReadMe.txt for TERMS OF USE.
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/CJWindowPlacement.h $
00011  *
00012  * $History: CJWindowPlacement.h $
00013  *
00014  * *****************  Version 7  *****************
00015  * User: Kirk Stowell Date: 10/26/99   Time: 10:49p
00016  * Updated in $/CodeJock/Include
00017  * Made class methods virtual for inheritance purposes.
00018  *
00019  * *****************  Version 6  *****************
00020  * User: Kirk Stowell Date: 8/31/99    Time: 1:11a
00021  * Updated in $/CodeJockey/Include
00022  * Updated copyright and contact information.
00023  *
00024  * *****************  Version 5  *****************
00025  * User: Kirk Stowell Date: 7/25/99    Time: 12:42a
00026  * Updated in $/CodeJockey/Include
00027  *
00028  * *****************  Version 4  *****************
00029  * User: Kirk Stowell Date: 7/18/99    Time: 10:09p
00030  * Updated in $/CodeJockey/Include
00031  * Cleaned up inline functions, and import/export macro so that class will
00032  * be imported when linked to, and exported at compile time.
00033  *
00034  * *****************  Version 3  *****************
00035  * User: Kirk Stowell Date: 6/11/99    Time: 10:15p
00036  * Updated in $/CodeJockey/Include
00037  * Modified LoadWindowPos(...) to allow registry names to be directly
00038  * passed in.
00039  *
00040  * *****************  Version 2  *****************
00041  * User: Kirk Stowell Date: 6/11/99    Time: 9:41p
00042  * Updated in $/CodeJockey/Include
00043  * Initial creation.
00044  *
00045  * *****************  Version 1  *****************
00046  * User: Kirk Stowell Date: 6/01/99    Time: 9:30p
00047  * Created in $/CodeJockey/Include
00048  *
00049  ***************************************************************************/
00051
00052 #ifndef __CJWINDOWPLACEMENT_H__
00053 #define __CJWINDOWPLACEMENT_H__
00054
00055 // CCJWindowPlacement is a WINDOWPLACEMENT derived class which is used to
00056 // save and restore your applications window position.
00057 class _CJX_EXT_CLASS CCJWindowPlacement : public WINDOWPLACEMENT
00058 {
00059 public:
00060
00061     // Default constructor
00062     //
00063     CCJWindowPlacement();
00064
00065     // Virtual destructor
00066     //
00067     virtual ~CCJWindowPlacement();
00068
00069 private:
00070
00071     CString     m_strFormat;    // format string for registry settings.
00072     CString     m_strSection;   // registry section name.
00073     CString     m_strWndPos;    // registry entry name.
00074
00075 public:
00076
00077     // call this member function to load your applications previously saved
00078     // window position. To use, add a member variable to your CWinApp derived
00079     // class ie: CCJWindowPlacement m_wndPlacement; then replace the call
00080     // to pMainFrame->ShowWindow(...) with m_wndPlacement.LoadWindowPos( pMainFrame );
00081     //
00082     virtual BOOL LoadWindowPos( CFrameWnd* pFrameWnd, LPCTSTR lpszFormat=NULL, LPCTSTR lpszSection=NULL, LPCTSTR lpszWndPos=NULL );
00083
00084     // call this member function to save your applications window position. To
00085     // use, add the ON_WM_CLOSE message handler to your CFrameWnd derived class,
00086     // then make a call to theApp.m_wndPlacement.SaveWindowPos( this ); just before
00087     // you call the base class OnClose().
00088     //
00089     virtual void SaveWindowPos( CFrameWnd* pFrameWnd );
00090 };
00091
00093
00094 #endif // __CJWINDOWPLACEMENT_H__
00095
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/GfxGroupEdit.h Source File

WinCvs/CJLib/Include/GfxGroupEdit.h

Go to the documentation of this file.
00001 // Copyright (c) Iuri Apollonio 1998
00002 // Use & modify as you want & need, and leave those 4 lines.
00003 // Strongly based on article "Inplace edit control" of Mario Contestabile and "Editable subitems" of Zafir
00004 // http://www.codeguru.com
00005 //
00007 /****************************************************************************
00008  *
00009  * $Date: 1999/11/30 21:45:51 $
00010  * $Revision: 1.1.1.2 $
00011  * $Archive: /CodeJock/Include/GfxGroupEdit.h $
00012  *
00013  * $History: GfxGroupEdit.h $
00014  *
00015  * *****************  Version 3  *****************
00016  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00017  * Updated in $/CodeJock/Include
00018  * Added source control history to file header.
00019  *
00020  ***************************************************************************/
00022
00023 #ifndef __GFXGROUPEDIT_H__
00024 #define __GFXGROUPEDIT_H__
00025
00026 #if _MSC_VER >= 1000
00027 #pragma once
00028 #endif // _MSC_VER >= 1000
00029 // GfxGroupEdit.h : header file
00030 //
00031
00033 // CGfxGroupEdit window
00034
00035 class _CJX_EXT_CLASS CGfxGroupEdit : public CEdit
00036 {
00037 // Construction
00038 public:
00039     CGfxGroupEdit();
00040
00041 // Attributes
00042 public:
00043     BOOL    bEscapeKey;
00044     CString text;
00045     WPARAM  msgSend;
00046     bool    bNoDown;
00047
00048 // Operations
00049 public:
00050
00051 // Overrides
00052     // ClassWizard generated virtual function overrides
00053     //{{AFX_VIRTUAL(CGfxGroupEdit)
00054     public:
00055     virtual BOOL PreTranslateMessage(MSG* pMsg);
00056     protected:
00057     virtual void PostNcDestroy();
00058     //}}AFX_VIRTUAL
00059
00060 // Implementation
00061 public:
00062     int iIndex;
00063     virtual ~CGfxGroupEdit();
00064
00065     // Generated message map functions
00066 protected:
00067     //{{AFX_MSG(CGfxGroupEdit)
00068     afx_msg void OnKillFocus(CWnd* pNewWnd);
00069     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00070     afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
00071     //}}AFX_MSG
00072
00073     DECLARE_MESSAGE_MAP()
00074 };
00075
00077
00078 //{{AFX_INSERT_LOCATION}}
00079 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00080
00081 #endif // __GFXGROUPEDIT_H__
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/GfxOutBarCtrl.h Source File

WinCvs/CJLib/Include/GfxOutBarCtrl.h

Go to the documentation of this file.
00001 // Copyright (c) Iuri Apollonio 1998
00002 // Use & modify as you want & need, and leave those 3 lines.
00003 // http://www.codeguru.com
00004 //
00006 /****************************************************************************
00007  *
00008  * $Date: 1999/11/30 21:45:51 $
00009  * $Revision: 1.1.1.3 $
00010  * $Archive: /CodeJock/Include/GfxOutBarCtrl.h $
00011  *
00012  * $History: GfxOutBarCtrl.h $
00013  *
00014  * *****************  Version 6  *****************
00015  * User: Kirk Stowell Date: 10/26/99   Time: 10:50p
00016  * Updated in $/CodeJock/Include
00017  * Made class methods virtual for inheritance purposes.
00018  *
00019  * *****************  Version 5  *****************
00020  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00021  * Updated in $/CodeJock/Include
00022  * Added source control history to file header.
00023  *
00024  ***************************************************************************/
00026
00027 #ifndef __GFXOUTBARCTRL_H__
00028 #define __GFXOUTBARCTRL_H__
00029
00030 #if _MSC_VER >= 1000
00031 #pragma once
00032 #endif // _MSC_VER >= 1000
00033 // GfxOutBarCtrl.h : header file
00034 //
00035
00037 // CGfxOutBarCtrl window
00038
00039 #include <afxcoll.h>
00040 #include "CJMenu.h"        // CCJMenu class declaration
00041
00042 #define WM_OUTBAR_NOTIFY        WM_USER + 1
00043 #define NM_OB_ITEMCLICK         1
00044 #define NM_OB_ONLABELENDEDIT    2
00045 #define NM_OB_ONGROUPENDEDIT    3
00046 #define NM_OB_DRAGITEM          4
00047 #define NM_FOLDERCHANGE         5
00048 #define NM_OB_ITEMHOVER         6
00049
00050 struct OUTBAR_INFO
00051 {
00052     int     index;
00053     int     iDragFrom;
00054     int     iDragTo;
00055
00056     LPCTSTR cText;
00057 };
00058
00059 class _CJX_EXT_CLASS CGfxOutBarCtrl : public CWnd
00060 {
00061 // Construction
00062     DECLARE_DYNCREATE(CGfxOutBarCtrl)
00063 public:
00064     CGfxOutBarCtrl();
00065
00066     enum {  fSmallIcon = 1 << 0, fLargeIcon = 1 << 1, fEditGroups = 1 << 2, fEditItems = 1 << 3,
00067             fRemoveGroups = 1 << 4, fRemoveItems = 1 << 5, fAddGroups = 1 << 6,
00068             fDragItems = 1 << 7, fAnimation = 1 << 8, fSelHighlight = 1 << 9 };
00069
00070     enum { ircIcon = 1, ircLabel = 2, ircAll = 3 };
00071
00072 // Attributes
00073 public:
00074     COLORREF    crBackGroundColor, crBackGroundColor1;
00075     COLORREF    crTextColor;
00076     COLORREF    cr3dFace, crLightBorder, crHilightBorder, crShadowBorder, crDkShadowBorder;
00077     int         iFolderHeight;
00078
00079     int         xSmallIconLabelOffset, yLargeIconLabelOffset;
00080     int         ySmallIconSpacing, yLargeIconSpacing;
00081
00082     int         xLeftMargin, yTopMargin;
00083     bool        bUpArrow, bDownArrow, bUpPressed, bDownPressed;
00084     CRect       rcUpArrow, rcDownArrow;
00085     bool        bLooping;
00086
00087     int         iHitInternal1, iHitInternal2;
00088
00089     long        lAnimationTickCount;
00090
00091     int         iLastSel, iSelAnimTiming;
00092     int         iSelAnimCount;
00093
00094
00095     DWORD       dwFlags;
00096
00097     CPtrArray   arFolder;
00098
00099     int         iLastFolderHighlighted;
00100     int         iLastSelectedFolder;
00101     int         iFirstItem;
00102
00103     int         iLastItemHighlighted;
00104     bool        bPressedHighlight;
00105
00106     int         iLastDragItemDraw, iLastDragItemDrawType;
00107
00108     class CBarItem
00109     {
00110     public:
00111         CBarItem( LPCTSTR name, const int image, DWORD exData);
00112         virtual  ~CBarItem();
00113         int             iImageIndex;
00114         LPTSTR          cItem;
00115         DWORD           dwData;
00116     };
00117
00118     class CBarFolder
00119     {
00120     public:
00121         CBarFolder( LPCTSTR name, DWORD exData);
00122         virtual  ~CBarFolder();
00123         int GetItemCount();
00124         int InsertItem( int index, LPCTSTR text, const int image, const DWORD exData);
00125         LPTSTR          cName;
00126         DWORD           dwData;
00127         CImageList *    pLargeImageList;
00128         CImageList *    pSmallImageList;
00129         CPtrArray       arItems;
00130         CWnd *          pChild;
00131     };
00132
00133     int iSelFolder;
00134
00135     CImageList *    pLargeImageList;
00136     CImageList *    pSmallImageList;
00137
00138     HCURSOR         hHandCursor;
00139     HCURSOR         hDragCursor;
00140     HCURSOR         hNoDragCursor;
00141
00142     CPen *          pBlackPen;
00143
00144     CCJMenu         m_popupMenu;    // popup menu fix...07-29-1999 - KStowell
00145     CString         m_strRemoveItem;
00146     CString         m_strRenameItem;
00147
00148 // Operations
00149 public:
00150     enum { htNothing = -1, htFolder, htItem, htUpScroll, htDownScroll};
00151
00152 // Overrides
00153     // ClassWizard generated virtual function overrides
00154     //{{AFX_VIRTUAL(CGfxOutBarCtrl)
00155     //}}AFX_VIRTUAL
00156
00157 // Implementation
00158 public:
00159     virtual void DrawAnimItem(const int xoffset, const int yoffset, const int index);
00160     virtual void SetAnimSelHighlight(const int iTime);
00161     virtual DWORD GetFolderData(int iFolder = -1);
00162     virtual CWnd * GetFolderChild(int iFolder = -1);
00163     virtual int AddFolderBar(LPCTSTR pFolder, CWnd * pSon, const DWORD exData = 0);
00164     virtual CString GetItemText(const int index);
00165     virtual void SetAnimationTickCount(const long value) { lAnimationTickCount = value; };
00166     virtual long GetAnimationTickCount() { return lAnimationTickCount; };
00167
00168     virtual void AnimateFolderScroll(const int iFrom, const int iTo);
00169     virtual int GetDragItemRect(const int index, CRect &rect);
00170     virtual void DrawDragArrow(CDC * pDC, const int iFrom, const int iTo);
00171     virtual void SetItemImage(const int index, const int iImage);
00172     virtual void SetItemData(const int index, const DWORD dwData);
00173     virtual int  GetItemImage(const int index) const;
00174     virtual DWORD GetItemData(const int index) const;
00175     virtual bool IsValidItem(const int index) const;
00176     virtual void RemoveItem(const int index);
00177     virtual void SetItemText(const int index, LPCTSTR text);
00178     virtual void StartItemEdit(const int index);
00179     virtual void SetFolderText(const int index, LPCTSTR text);
00180     virtual void StartGroupEdit(const int index);
00181     virtual void GetLabelRect(const int iFolder, const int iIndex, CRect &rect);
00182     virtual void GetIconRect(const int iFolder, const int iIndex, CRect &rect);
00183     virtual void HighlightItem(const int index, const bool bPressed = false);
00184     virtual void GetVisibleRange(const int iFolder, int &first, int &last);
00185     virtual void DrawItem(CDC * pDC, const int iFolder, CRect rc, const int index, const bool bOnlyImage = false);
00186     virtual CImageList * GetFolderImageList(const int index, const bool bSmall) const;
00187     virtual CSize GetItemSize(const int iFolder, const int index, const int type);
00188     virtual void PaintItems(CDC * pDC, const int iFolder, CRect rc);
00189     virtual CImageList * GetImageList(CImageList * pImageList, int nImageList);
00190     virtual CImageList * SetFolderImageList(const int folder, CImageList * pImageList, int nImageList);
00191     virtual CImageList * SetImageList(CImageList * pImageList, int nImageList);
00192     virtual int GetCountPerPage() const;
00193     virtual void RemoveFolder(const int index);
00194     virtual int GetSelFolder() const;
00195     virtual int GetFolderCount() const;
00196     virtual void SetSelFolder(const int index);
00197     virtual int GetItemCount() const;
00198     virtual int InsertItem(const int folder, const int index, LPCTSTR text, const int image = -1, const DWORD exData = 0);
00199     virtual void HighlightFolder(const int index);
00200     virtual int HitTestEx(const CPoint &point, int &index);
00201     virtual void GetInsideRect(CRect &rect) const;
00202     virtual int AddFolder(LPCTSTR cFolderName, const DWORD exData);
00203     virtual void GetItemRect(const int iFolder, const int iIndex, CRect &rect);
00204     virtual bool GetFolderRect(const int iIndex, CRect &rect) const;
00205     virtual void ModifyFlag(const DWORD &dwRemove, const DWORD &dwAdd, const UINT redraw = 0);
00206     virtual DWORD GetFlag() const;
00207     virtual void SetSmallIconView(const bool bSet);
00208     virtual bool IsSmallIconView() const;
00209     virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd * pParentWnd, UINT nID, const DWORD dwFlag = fDragItems|fEditGroups|fEditItems|fRemoveGroups|fRemoveItems|fAddGroups|fAnimation|fSelHighlight);
00210     virtual ~CGfxOutBarCtrl();
00211
00212     // Generated message map functions
00213 protected:
00214     void DrawFolder(CDC * pDC, const int iIdx, CRect rect, const bool bSelected);
00215     //{{AFX_MSG(CGfxOutBarCtrl)
00216     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00217     afx_msg void OnTimer(UINT nIDEvent);
00218     afx_msg void OnPaint();
00219     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00220     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00221     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00222     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00223     afx_msg void OnSize(UINT nType, int cx, int cy);
00224     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00225     afx_msg void OnGfxLargeicon();
00226     afx_msg void OnUpdateGfxLargeicon(CCmdUI* pCmdUI);
00227     afx_msg void OnGfxSmallicon();
00228     afx_msg void OnUpdateGfxSmallicon(CCmdUI* pCmdUI);
00229     afx_msg void OnGfxRemoveitem();
00230     afx_msg void OnUpdateGfxRemoveitem(CCmdUI* pCmdUI);
00231     afx_msg void OnGfxRenameitem();
00232     afx_msg void OnUpdateGfxRenameitem(CCmdUI* pCmdUI);
00233     afx_msg void OnSysColorChange();
00234     //}}AFX_MSG
00235     afx_msg long OnEndLabelEdit(WPARAM wParam, LPARAM lParam);
00236     DECLARE_MESSAGE_MAP()
00237 };
00238
00240
00241 //{{AFX_INSERT_LOCATION}}
00242 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00243
00244 #endif // __GFXOUTBARCTRL_H__
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/GfxSplitterWnd.h Source File

WinCvs/CJLib/Include/GfxSplitterWnd.h

Go to the documentation of this file.
00001 // Copyright (c) Iuri Apollonio 1998
00002 // Use & modify as you want & need, and leave those 3 lines.
00003 // http://www.codeguru.com
00004 //
00005 // GfxSplitterWnd.h: interface for the CGfxSplitterWnd class.
00006 //
00008 /****************************************************************************
00009  *
00010  * $Date: 1999/11/30 21:45:51 $
00011  * $Revision: 1.1.1.2 $
00012  * $Archive: /CodeJock/Include/GfxSplitterWnd.h $
00013  *
00014  * $History: GfxSplitterWnd.h $
00015  *
00016  * *****************  Version 4  *****************
00017  * User: Kirk Stowell Date: 10/26/99   Time: 10:50p
00018  * Updated in $/CodeJock/Include
00019  * Made class methods virtual for inheritance purposes.
00020  *
00021  * *****************  Version 3  *****************
00022  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00023  * Updated in $/CodeJock/Include
00024  * Added source control history to file header.
00025  *
00026  ***************************************************************************/
00028
00029 #ifndef __GFXSPLITTERWND_H__
00030 #define __GFXSPLITTERWND_H__
00031
00032 #if _MSC_VER >= 1000
00033 #pragma once
00034 #endif // _MSC_VER >= 1000
00035
00036 class _CJX_EXT_CLASS CGfxSplitterWnd : public CSplitterWnd
00037 {
00038 public:
00039     int m_upBorder;
00040     bool bWhiteLine;
00041     CGfxSplitterWnd();
00042     virtual ~CGfxSplitterWnd();
00043     virtual void OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rectArg);
00044     virtual void OnInvertTracker(const CRect & rect);
00045
00046     virtual void RecalcLayout();
00047 protected:
00048     virtual void GetInsideRect(CRect& rect) const;
00049     // Generated message map functions
00050     //{{AFX_MSG(CGfxSplitterWnd)
00051     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00052     afx_msg void OnPaint();
00053     //}}AFX_MSG
00054     DECLARE_MESSAGE_MAP()
00055 };
00056
00057 #endif // __GFXSPLITTERWND_H__
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CJLib/Include/Subclass.h Source File

WinCvs/CJLib/Include/Subclass.h

Go to the documentation of this file.
00001 #ifndef _SUBCLASSW_H
00002 #define _SUBCLASSW_H
00003
00005 // Copyright 1998 Paul DiLascia
00006 // If this code works, it was written by Paul DiLascia.
00007 // If not, I don't know who wrote it.
00008 //
00010 /****************************************************************************
00011  *
00012  * $Date: 1999/11/30 21:45:51 $
00013  * $Revision: 1.1.1.2 $
00014  * $Archive: /CodeJock/Include/Subclass.h $
00015  *
00016  * $History: Subclass.h $
00017  *
00018  * *****************  Version 4  *****************
00019  * User: Kirk Stowell Date: 10/26/99   Time: 10:50p
00020  * Updated in $/CodeJock/Include
00021  * Made class methods virtual for inheritance purposes.
00022  *
00023  * *****************  Version 3  *****************
00024  * User: Kirk Stowell Date: 10/14/99   Time: 12:41p
00025  * Updated in $/CodeJock/Include
00026  * Added source control history to file header.
00027  *
00028  ***************************************************************************/
00030
00032 // Generic class to hook messages on behalf of a CWnd.
00033 // Once hooked, all messages go to CSubclassWnd::WindowProc before going
00034 // to the window. Specific subclasses can trap messages and do something.
00035 //
00036 // To use:
00037 //
00038 // * Derive a class from CSubclassWnd.
00039 //
00040 // * Override CSubclassWnd::WindowProc to handle messages. Make sure you call
00041 //   CSubclassWnd::WindowProc if you don't handle the message, or your
00042 //   window will never get messages. If you write seperate message handlers,
00043 //   you can call Default() to pass the message to the window.
00044 //
00045 // * Instantiate your derived class somewhere and call HookWindow(pWnd)
00046 //   to hook your window, AFTER it has been created.
00047 //    To unhook, call HookWindow(NULL).
00048 //
00049 // This is a very important class, crucial to many of the widgets Window
00050 // widgets implemented in PixieLib. To see how it works, look at the HOOK
00051 // sample program.
00052 //
00053 class _CJX_EXT_CLASS CSubclassWnd : public CObject {
00054 public:
00055     DECLARE_DYNAMIC(CSubclassWnd);
00056     CSubclassWnd();
00057     ~CSubclassWnd();
00058
00059     // Subclass a window. Hook(NULL) to unhook (automatic on WM_NCDESTROY)
00060     virtual BOOL    HookWindow(HWND  hwnd);
00061     virtual BOOL    HookWindow(CWnd* pWnd)  { return HookWindow(pWnd->GetSafeHwnd()); }
00062     virtual BOOL    IsHooked()                  { return m_hWnd!=NULL; }
00063
00064     friend LRESULT CALLBACK HookWndProc(HWND, UINT, WPARAM, LPARAM);
00065     friend class CSubclassWndMap;
00066
00067 #ifdef _DEBUG
00068     virtual void AssertValid() const;
00069     virtual void Dump(CDumpContext& dc) const;
00070 #endif
00071
00072 protected:
00073     HWND                m_hWnd;             // the window hooked
00074     WNDPROC         m_pOldWndProc;      // ..and original window proc
00075     CSubclassWnd*   m_pNext;                // next in chain of hooks for this window
00076
00077     // Override this to handle messages in specific handlers
00078     virtual LRESULT WindowProc(UINT msg, WPARAM wp, LPARAM lp);
00079     virtual LRESULT Default();              // call this at the end of handler fns
00080 };
00081
00082 #endif // _SUBCLASSW_H
00083
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/cvs_coworker.h Source File

WinCvs/CoWorker/cvs_coworker.h

Go to the documentation of this file.
00001 /* this ALWAYS GENERATED file contains the definitions for the interfaces */
00002
00003
00004 /* File created by MIDL compiler version 5.01.0164 */
00005 /* at Tue May 25 19:23:37 1999
00006  */
00007 /* Compiler settings for cvs_coworker.idl:
00008     Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext
00009     error checks: allocation ref bounds_check enum stub_data
00010 */
00011 //@@MIDL_FILE_HEADING(  )
00012
00013
00014 /* verify that the <rpcndr.h> version is high enough to compile this file*/
00015 #ifndef __REQUIRED_RPCNDR_H_VERSION__
00016 #define __REQUIRED_RPCNDR_H_VERSION__ 440
00017 #endif
00018
00019 #include "rpc.h"
00020 #include "rpcndr.h"
00021
00022 #ifndef __RPCNDR_H_VERSION__
00023 #error this stub requires an updated version of <rpcndr.h>
00024 #endif // __RPCNDR_H_VERSION__
00025
00026 #ifndef COM_NO_WINDOWS_H
00027 #include "windows.h"
00028 #include "ole2.h"
00029 #endif /*COM_NO_WINDOWS_H*/
00030
00031 #ifndef __cvs_coworker_h__
00032 #define __cvs_coworker_h__
00033
00034 #ifdef __cplusplus
00035 extern "C"{
00036 #endif
00037
00038 /* Forward Declarations */
00039
00040 #ifndef __ICvsCoworker_FWD_DEFINED__
00041 #define __ICvsCoworker_FWD_DEFINED__
00042 typedef interface ICvsCoworker ICvsCoworker;
00043 #endif  /* __ICvsCoworker_FWD_DEFINED__ */
00044
00045
00046 #ifndef __CvsCoworker_FWD_DEFINED__
00047 #define __CvsCoworker_FWD_DEFINED__
00048
00049 #ifdef __cplusplus
00050 typedef class CvsCoworker CvsCoworker;
00051 #else
00052 typedef struct CvsCoworker CvsCoworker;
00053 #endif /* __cplusplus */
00054
00055 #endif  /* __CvsCoworker_FWD_DEFINED__ */
00056
00057
00058 /* header files for imported files */
00059 #include "oaidl.h"
00060 #include "ocidl.h"
00061
00062 void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
00063 void __RPC_USER MIDL_user_free( void __RPC_FAR * );
00064
00065 /* interface __MIDL_itf_cvs_coworker_0000 */
00066 /* [local] */
00067
00068 typedef /* [helpstring][uuid] */
00069 enum CvsOption
00070     {   cvsOptionCompareContents    = 1,
00071     cvsOptionCompareChecksum    = 2,
00072     cvsOptionCompareTimestamp   = 3
00073     }   CvsOption;
00074
00075 typedef /* [helpstring][uuid] */
00076 enum CvsCommand
00077     {   cvsCommandUpdate    = 0,
00078     cvsCommandCheckout  = 1,
00079     cvsCommandCheckin   = 2,
00080     cvsCommandUncheckout    = 3,
00081     cvsCommandAdd   = 4,
00082     cvsCommandRemove    = 5,
00083     cvsCommandDiff  = 6,
00084     cvsCommandHistory   = 7,
00085     cvsCommandRename    = 8,
00086     cvsCommandProperties    = 9,
00087     cvsCommandOptions   = 10
00088     }   CvsCommand;
00089
00090
00091
00092 extern RPC_IF_HANDLE __MIDL_itf_cvs_coworker_0000_v0_0_c_ifspec;
00093 extern RPC_IF_HANDLE __MIDL_itf_cvs_coworker_0000_v0_0_s_ifspec;
00094
00095 #ifndef __ICvsCoworker_INTERFACE_DEFINED__
00096 #define __ICvsCoworker_INTERFACE_DEFINED__
00097
00098 /* interface ICvsCoworker */
00099 /* [unique][helpstring][oleautomation][uuid][object] */
00100
00101
00102 EXTERN_C const IID IID_ICvsCoworker;
00103
00104 #if defined(__cplusplus) && !defined(CINTERFACE)
00105
00106     MIDL_INTERFACE("10E5359C-F454-11D2-B442-0080C6F9179D")
00107     ICvsCoworker : public IUnknown
00108     {
00109     public:
00110         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetLastError(
00111             /* [in] */ int handle,
00112             /* [out] */ int __RPC_FAR *piError) = 0;
00113
00114         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetErrorMessage(
00115             /* [in] */ int handle,
00116             /* [in] */ int iError,
00117             /* [in] */ int cbErrorBuffer,
00118             /* [size_is][string][out] */ unsigned char __RPC_FAR *sErrorBuffer) = 0;
00119
00120         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE OpenProject(
00121             /* [out] */ int __RPC_FAR *pHandle,
00122             /* [string][in] */ const unsigned char __RPC_FAR *sUsername,
00123             /* [string][in] */ const unsigned char __RPC_FAR *sProjectName,
00124             /* [string][in] */ const unsigned char __RPC_FAR *sProjectHome) = 0;
00125
00126         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetProject(
00127             /* [out] */ int __RPC_FAR *pHandle,
00128             /* [in] */ const unsigned char __RPC_FAR *sUsername,
00129             /* [in] */ int cbProjectNameBuffer,
00130             /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectName,
00131             /* [in] */ int cbProjectHomeBuffer,
00132             /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectHome,
00133             /* [in] */ BOOL bAllowPathChange,
00134             /* [in] */ BOOL bAllowNewProject,
00135             /* [out] */ BOOL __RPC_FAR *pbNewProject) = 0;
00136
00137         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE UpdateFiles(
00138             /* [in] */ int handle,
00139             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00140             /* [in] */ BOOL bDirectories,
00141             /* [in] */ BOOL bRecurse) = 0;
00142
00143         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CheckoutFiles(
00144             /* [in] */ int handle,
00145             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames) = 0;
00146
00147         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CheckinFiles(
00148             /* [in] */ int handle,
00149             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00150             /* [in] */ BOOL bKeepCheckedOut) = 0;
00151
00152         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE UncheckoutFiles(
00153             /* [in] */ int handle,
00154             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames) = 0;
00155
00156         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AddFiles(
00157             /* [in] */ int handle,
00158             /* [string][in] */ const unsigned char __RPC_FAR *sOptionsAndFilenames,
00159             /* [string][in] */ const unsigned char __RPC_FAR *sComment) = 0;
00160
00161         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RemoveFiles(
00162             /* [in] */ int handle,
00163             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames) = 0;
00164
00165         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RenameFile(
00166             /* [in] */ int handle,
00167             /* [string][in] */ const unsigned char __RPC_FAR *sOldFilename,
00168             /* [string][in] */ const unsigned char __RPC_FAR *sNewFilename) = 0;
00169
00170         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DiffFile(
00171             /* [in] */ int handle,
00172             /* [string][in] */ const unsigned char __RPC_FAR *sFilename,
00173             /* [in] */ BOOL bIgnoreCase,
00174             /* [in] */ BOOL bIgnoreBlanks) = 0;
00175
00176         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ShowFileHistory(
00177             /* [in] */ int handle,
00178             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames) = 0;
00179
00180         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ShowFileProperties(
00181             /* [in] */ int handle,
00182             /* [string][in] */ const unsigned char __RPC_FAR *sFilename) = 0;
00183
00184         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ShowUserInterface(
00185             /* [in] */ int handle,
00186             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames) = 0;
00187
00188         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE HasAdvancedOptionsForCommand(
00189             /* [in] */ int handle,
00190             /* [in] */ CvsCommand command,
00191             /* [retval][out] */ BOOL __RPC_FAR *pbAdvancedOptions) = 0;
00192
00193         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ShowAdvancedOptionsForCommand(
00194             /* [in] */ int handle,
00195             /* [in] */ CvsCommand command) = 0;
00196
00197         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetFileChanges(
00198             /* [in] */ int handle,
00199             /* [in] */ int cbFilenameBuffer,
00200             /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenameBuffer) = 0;
00201
00202         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetFilesToAdd(
00203             /* [in] */ int handle,
00204             /* [in] */ int cbFilenamesBuffer,
00205             /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenamesBuffer) = 0;
00206
00207         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CloseProject(
00208             /* [in] */ int handle) = 0;
00209
00210     };
00211
00212 #else   /* C style interface */
00213
00214     typedef struct ICvsCoworkerVtbl
00215     {
00216         BEGIN_INTERFACE
00217
00218         HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
00219             ICvsCoworker __RPC_FAR * This,
00220             /* [in] */ REFIID riid,
00221             /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
00222
00223         ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
00224             ICvsCoworker __RPC_FAR * This);
00225
00226         ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
00227             ICvsCoworker __RPC_FAR * This);
00228
00229         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLastError )(
00230             ICvsCoworker __RPC_FAR * This,
00231             /* [in] */ int handle,
00232             /* [out] */ int __RPC_FAR *piError);
00233
00234         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetErrorMessage )(
00235             ICvsCoworker __RPC_FAR * This,
00236             /* [in] */ int handle,
00237             /* [in] */ int iError,
00238             /* [in] */ int cbErrorBuffer,
00239             /* [size_is][string][out] */ unsigned char __RPC_FAR *sErrorBuffer);
00240
00241         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *OpenProject )(
00242             ICvsCoworker __RPC_FAR * This,
00243             /* [out] */ int __RPC_FAR *pHandle,
00244             /* [string][in] */ const unsigned char __RPC_FAR *sUsername,
00245             /* [string][in] */ const unsigned char __RPC_FAR *sProjectName,
00246             /* [string][in] */ const unsigned char __RPC_FAR *sProjectHome);
00247
00248         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetProject )(
00249             ICvsCoworker __RPC_FAR * This,
00250             /* [out] */ int __RPC_FAR *pHandle,
00251             /* [in] */ const unsigned char __RPC_FAR *sUsername,
00252             /* [in] */ int cbProjectNameBuffer,
00253             /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectName,
00254             /* [in] */ int cbProjectHomeBuffer,
00255             /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectHome,
00256             /* [in] */ BOOL bAllowPathChange,
00257             /* [in] */ BOOL bAllowNewProject,
00258             /* [out] */ BOOL __RPC_FAR *pbNewProject);
00259
00260         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *UpdateFiles )(
00261             ICvsCoworker __RPC_FAR * This,
00262             /* [in] */ int handle,
00263             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00264             /* [in] */ BOOL bDirectories,
00265             /* [in] */ BOOL bRecurse);
00266
00267         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CheckoutFiles )(
00268             ICvsCoworker __RPC_FAR * This,
00269             /* [in] */ int handle,
00270             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00271
00272         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CheckinFiles )(
00273             ICvsCoworker __RPC_FAR * This,
00274             /* [in] */ int handle,
00275             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00276             /* [in] */ BOOL bKeepCheckedOut);
00277
00278         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *UncheckoutFiles )(
00279             ICvsCoworker __RPC_FAR * This,
00280             /* [in] */ int handle,
00281             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00282
00283         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddFiles )(
00284             ICvsCoworker __RPC_FAR * This,
00285             /* [in] */ int handle,
00286             /* [string][in] */ const unsigned char __RPC_FAR *sOptionsAndFilenames,
00287             /* [string][in] */ const unsigned char __RPC_FAR *sComment);
00288
00289         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RemoveFiles )(
00290             ICvsCoworker __RPC_FAR * This,
00291             /* [in] */ int handle,
00292             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00293
00294         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RenameFile )(
00295             ICvsCoworker __RPC_FAR * This,
00296             /* [in] */ int handle,
00297             /* [string][in] */ const unsigned char __RPC_FAR *sOldFilename,
00298             /* [string][in] */ const unsigned char __RPC_FAR *sNewFilename);
00299
00300         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DiffFile )(
00301             ICvsCoworker __RPC_FAR * This,
00302             /* [in] */ int handle,
00303             /* [string][in] */ const unsigned char __RPC_FAR *sFilename,
00304             /* [in] */ BOOL bIgnoreCase,
00305             /* [in] */ BOOL bIgnoreBlanks);
00306
00307         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ShowFileHistory )(
00308             ICvsCoworker __RPC_FAR * This,
00309             /* [in] */ int handle,
00310             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00311
00312         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ShowFileProperties )(
00313             ICvsCoworker __RPC_FAR * This,
00314             /* [in] */ int handle,
00315             /* [string][in] */ const unsigned char __RPC_FAR *sFilename);
00316
00317         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ShowUserInterface )(
00318             ICvsCoworker __RPC_FAR * This,
00319             /* [in] */ int handle,
00320             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00321
00322         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *HasAdvancedOptionsForCommand )(
00323             ICvsCoworker __RPC_FAR * This,
00324             /* [in] */ int handle,
00325             /* [in] */ CvsCommand command,
00326             /* [retval][out] */ BOOL __RPC_FAR *pbAdvancedOptions);
00327
00328         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ShowAdvancedOptionsForCommand )(
00329             ICvsCoworker __RPC_FAR * This,
00330             /* [in] */ int handle,
00331             /* [in] */ CvsCommand command);
00332
00333         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFileChanges )(
00334             ICvsCoworker __RPC_FAR * This,
00335             /* [in] */ int handle,
00336             /* [in] */ int cbFilenameBuffer,
00337             /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenameBuffer);
00338
00339         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFilesToAdd )(
00340             ICvsCoworker __RPC_FAR * This,
00341             /* [in] */ int handle,
00342             /* [in] */ int cbFilenamesBuffer,
00343             /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenamesBuffer);
00344
00345         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CloseProject )(
00346             ICvsCoworker __RPC_FAR * This,
00347             /* [in] */ int handle);
00348
00349         END_INTERFACE
00350     } ICvsCoworkerVtbl;
00351
00352     interface ICvsCoworker
00353     {
00354         CONST_VTBL struct ICvsCoworkerVtbl __RPC_FAR *lpVtbl;
00355     };
00356
00357
00358
00359 #ifdef COBJMACROS
00360
00361
00362 #define ICvsCoworker_QueryInterface(This,riid,ppvObject)    \
00363     (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
00364
00365 #define ICvsCoworker_AddRef(This)   \
00366     (This)->lpVtbl -> AddRef(This)
00367
00368 #define ICvsCoworker_Release(This)  \
00369     (This)->lpVtbl -> Release(This)
00370
00371
00372 #define ICvsCoworker_GetLastError(This,handle,piError)  \
00373     (This)->lpVtbl -> GetLastError(This,handle,piError)
00374
00375 #define ICvsCoworker_GetErrorMessage(This,handle,iError,cbErrorBuffer,sErrorBuffer) \
00376     (This)->lpVtbl -> GetErrorMessage(This,handle,iError,cbErrorBuffer,sErrorBuffer)
00377
00378 #define ICvsCoworker_OpenProject(This,pHandle,sUsername,sProjectName,sProjectHome)  \
00379     (This)->lpVtbl -> OpenProject(This,pHandle,sUsername,sProjectName,sProjectHome)
00380
00381 #define ICvsCoworker_GetProject(This,pHandle,sUsername,cbProjectNameBuffer,sProjectName,cbProjectHomeBuffer,sProjectHome,bAllowPathChange,bAllowNewProject,pbNewProject)    \
00382     (This)->lpVtbl -> GetProject(This,pHandle,sUsername,cbProjectNameBuffer,sProjectName,cbProjectHomeBuffer,sProjectHome,bAllowPathChange,bAllowNewProject,pbNewProject)
00383
00384 #define ICvsCoworker_UpdateFiles(This,handle,sFilenames,bDirectories,bRecurse)  \
00385     (This)->lpVtbl -> UpdateFiles(This,handle,sFilenames,bDirectories,bRecurse)
00386
00387 #define ICvsCoworker_CheckoutFiles(This,handle,sFilenames)  \
00388     (This)->lpVtbl -> CheckoutFiles(This,handle,sFilenames)
00389
00390 #define ICvsCoworker_CheckinFiles(This,handle,sFilenames,bKeepCheckedOut)   \
00391     (This)->lpVtbl -> CheckinFiles(This,handle,sFilenames,bKeepCheckedOut)
00392
00393 #define ICvsCoworker_UncheckoutFiles(This,handle,sFilenames)    \
00394     (This)->lpVtbl -> UncheckoutFiles(This,handle,sFilenames)
00395
00396 #define ICvsCoworker_AddFiles(This,handle,sOptionsAndFilenames,sComment)    \
00397     (This)->lpVtbl -> AddFiles(This,handle,sOptionsAndFilenames,sComment)
00398
00399 #define ICvsCoworker_RemoveFiles(This,handle,sFilenames)    \
00400     (This)->lpVtbl -> RemoveFiles(This,handle,sFilenames)
00401
00402 #define ICvsCoworker_RenameFile(This,handle,sOldFilename,sNewFilename)  \
00403     (This)->lpVtbl -> RenameFile(This,handle,sOldFilename,sNewFilename)
00404
00405 #define ICvsCoworker_DiffFile(This,handle,sFilename,bIgnoreCase,bIgnoreBlanks)  \
00406     (This)->lpVtbl -> DiffFile(This,handle,sFilename,bIgnoreCase,bIgnoreBlanks)
00407
00408 #define ICvsCoworker_ShowFileHistory(This,handle,sFilenames)    \
00409     (This)->lpVtbl -> ShowFileHistory(This,handle,sFilenames)
00410
00411 #define ICvsCoworker_ShowFileProperties(This,handle,sFilename)  \
00412     (This)->lpVtbl -> ShowFileProperties(This,handle,sFilename)
00413
00414 #define ICvsCoworker_ShowUserInterface(This,handle,sFilenames)  \
00415     (This)->lpVtbl -> ShowUserInterface(This,handle,sFilenames)
00416
00417 #define ICvsCoworker_HasAdvancedOptionsForCommand(This,handle,command,pbAdvancedOptions)    \
00418     (This)->lpVtbl -> HasAdvancedOptionsForCommand(This,handle,command,pbAdvancedOptions)
00419
00420 #define ICvsCoworker_ShowAdvancedOptionsForCommand(This,handle,command) \
00421     (This)->lpVtbl -> ShowAdvancedOptionsForCommand(This,handle,command)
00422
00423 #define ICvsCoworker_GetFileChanges(This,handle,cbFilenameBuffer,sFilenameBuffer)   \
00424     (This)->lpVtbl -> GetFileChanges(This,handle,cbFilenameBuffer,sFilenameBuffer)
00425
00426 #define ICvsCoworker_GetFilesToAdd(This,handle,cbFilenamesBuffer,sFilenamesBuffer)  \
00427     (This)->lpVtbl -> GetFilesToAdd(This,handle,cbFilenamesBuffer,sFilenamesBuffer)
00428
00429 #define ICvsCoworker_CloseProject(This,handle)  \
00430     (This)->lpVtbl -> CloseProject(This,handle)
00431
00432 #endif /* COBJMACROS */
00433
00434
00435 #endif  /* C style interface */
00436
00437
00438
00439 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetLastError_Proxy(
00440     ICvsCoworker __RPC_FAR * This,
00441     /* [in] */ int handle,
00442     /* [out] */ int __RPC_FAR *piError);
00443
00444
00445 void __RPC_STUB ICvsCoworker_GetLastError_Stub(
00446     IRpcStubBuffer *This,
00447     IRpcChannelBuffer *_pRpcChannelBuffer,
00448     PRPC_MESSAGE _pRpcMessage,
00449     DWORD *_pdwStubPhase);
00450
00451
00452 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetErrorMessage_Proxy(
00453     ICvsCoworker __RPC_FAR * This,
00454     /* [in] */ int handle,
00455     /* [in] */ int iError,
00456     /* [in] */ int cbErrorBuffer,
00457     /* [size_is][string][out] */ unsigned char __RPC_FAR *sErrorBuffer);
00458
00459
00460 void __RPC_STUB ICvsCoworker_GetErrorMessage_Stub(
00461     IRpcStubBuffer *This,
00462     IRpcChannelBuffer *_pRpcChannelBuffer,
00463     PRPC_MESSAGE _pRpcMessage,
00464     DWORD *_pdwStubPhase);
00465
00466
00467 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_OpenProject_Proxy(
00468     ICvsCoworker __RPC_FAR * This,
00469     /* [out] */ int __RPC_FAR *pHandle,
00470     /* [string][in] */ const unsigned char __RPC_FAR *sUsername,
00471     /* [string][in] */ const unsigned char __RPC_FAR *sProjectName,
00472     /* [string][in] */ const unsigned char __RPC_FAR *sProjectHome);
00473
00474
00475 void __RPC_STUB ICvsCoworker_OpenProject_Stub(
00476     IRpcStubBuffer *This,
00477     IRpcChannelBuffer *_pRpcChannelBuffer,
00478     PRPC_MESSAGE _pRpcMessage,
00479     DWORD *_pdwStubPhase);
00480
00481
00482 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetProject_Proxy(
00483     ICvsCoworker __RPC_FAR * This,
00484     /* [out] */ int __RPC_FAR *pHandle,
00485     /* [in] */ const unsigned char __RPC_FAR *sUsername,
00486     /* [in] */ int cbProjectNameBuffer,
00487     /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectName,
00488     /* [in] */ int cbProjectHomeBuffer,
00489     /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectHome,
00490     /* [in] */ BOOL bAllowPathChange,
00491     /* [in] */ BOOL bAllowNewProject,
00492     /* [out] */ BOOL __RPC_FAR *pbNewProject);
00493
00494
00495 void __RPC_STUB ICvsCoworker_GetProject_Stub(
00496     IRpcStubBuffer *This,
00497     IRpcChannelBuffer *_pRpcChannelBuffer,
00498     PRPC_MESSAGE _pRpcMessage,
00499     DWORD *_pdwStubPhase);
00500
00501
00502 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_UpdateFiles_Proxy(
00503     ICvsCoworker __RPC_FAR * This,
00504     /* [in] */ int handle,
00505     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00506     /* [in] */ BOOL bDirectories,
00507     /* [in] */ BOOL bRecurse);
00508
00509
00510 void __RPC_STUB ICvsCoworker_UpdateFiles_Stub(
00511     IRpcStubBuffer *This,
00512     IRpcChannelBuffer *_pRpcChannelBuffer,
00513     PRPC_MESSAGE _pRpcMessage,
00514     DWORD *_pdwStubPhase);
00515
00516
00517 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckoutFiles_Proxy(
00518     ICvsCoworker __RPC_FAR * This,
00519     /* [in] */ int handle,
00520     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00521
00522
00523 void __RPC_STUB ICvsCoworker_CheckoutFiles_Stub(
00524     IRpcStubBuffer *This,
00525     IRpcChannelBuffer *_pRpcChannelBuffer,
00526     PRPC_MESSAGE _pRpcMessage,
00527     DWORD *_pdwStubPhase);
00528
00529
00530 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckinFiles_Proxy(
00531     ICvsCoworker __RPC_FAR * This,
00532     /* [in] */ int handle,
00533     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00534     /* [in] */ BOOL bKeepCheckedOut);
00535
00536
00537 void __RPC_STUB ICvsCoworker_CheckinFiles_Stub(
00538     IRpcStubBuffer *This,
00539     IRpcChannelBuffer *_pRpcChannelBuffer,
00540     PRPC_MESSAGE _pRpcMessage,
00541     DWORD *_pdwStubPhase);
00542
00543
00544 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_UncheckoutFiles_Proxy(
00545     ICvsCoworker __RPC_FAR * This,
00546     /* [in] */ int handle,
00547     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00548
00549
00550 void __RPC_STUB ICvsCoworker_UncheckoutFiles_Stub(
00551     IRpcStubBuffer *This,
00552     IRpcChannelBuffer *_pRpcChannelBuffer,
00553     PRPC_MESSAGE _pRpcMessage,
00554     DWORD *_pdwStubPhase);
00555
00556
00557 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_AddFiles_Proxy(
00558     ICvsCoworker __RPC_FAR * This,
00559     /* [in] */ int handle,
00560     /* [string][in] */ const unsigned char __RPC_FAR *sOptionsAndFilenames,
00561     /* [string][in] */ const unsigned char __RPC_FAR *sComment);
00562
00563
00564 void __RPC_STUB ICvsCoworker_AddFiles_Stub(
00565     IRpcStubBuffer *This,
00566     IRpcChannelBuffer *_pRpcChannelBuffer,
00567     PRPC_MESSAGE _pRpcMessage,
00568     DWORD *_pdwStubPhase);
00569
00570
00571 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_RemoveFiles_Proxy(
00572     ICvsCoworker __RPC_FAR * This,
00573     /* [in] */ int handle,
00574     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00575
00576
00577 void __RPC_STUB ICvsCoworker_RemoveFiles_Stub(
00578     IRpcStubBuffer *This,
00579     IRpcChannelBuffer *_pRpcChannelBuffer,
00580     PRPC_MESSAGE _pRpcMessage,
00581     DWORD *_pdwStubPhase);
00582
00583
00584 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_RenameFile_Proxy(
00585     ICvsCoworker __RPC_FAR * This,
00586     /* [in] */ int handle,
00587     /* [string][in] */ const unsigned char __RPC_FAR *sOldFilename,
00588     /* [string][in] */ const unsigned char __RPC_FAR *sNewFilename);
00589
00590
00591 void __RPC_STUB ICvsCoworker_RenameFile_Stub(
00592     IRpcStubBuffer *This,
00593     IRpcChannelBuffer *_pRpcChannelBuffer,
00594     PRPC_MESSAGE _pRpcMessage,
00595     DWORD *_pdwStubPhase);
00596
00597
00598 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_DiffFile_Proxy(
00599     ICvsCoworker __RPC_FAR * This,
00600     /* [in] */ int handle,
00601     /* [string][in] */ const unsigned char __RPC_FAR *sFilename,
00602     /* [in] */ BOOL bIgnoreCase,
00603     /* [in] */ BOOL bIgnoreBlanks);
00604
00605
00606 void __RPC_STUB ICvsCoworker_DiffFile_Stub(
00607     IRpcStubBuffer *This,
00608     IRpcChannelBuffer *_pRpcChannelBuffer,
00609     PRPC_MESSAGE _pRpcMessage,
00610     DWORD *_pdwStubPhase);
00611
00612
00613 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileHistory_Proxy(
00614     ICvsCoworker __RPC_FAR * This,
00615     /* [in] */ int handle,
00616     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00617
00618
00619 void __RPC_STUB ICvsCoworker_ShowFileHistory_Stub(
00620     IRpcStubBuffer *This,
00621     IRpcChannelBuffer *_pRpcChannelBuffer,
00622     PRPC_MESSAGE _pRpcMessage,
00623     DWORD *_pdwStubPhase);
00624
00625
00626 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileProperties_Proxy(
00627     ICvsCoworker __RPC_FAR * This,
00628     /* [in] */ int handle,
00629     /* [string][in] */ const unsigned char __RPC_FAR *sFilename);
00630
00631
00632 void __RPC_STUB ICvsCoworker_ShowFileProperties_Stub(
00633     IRpcStubBuffer *This,
00634     IRpcChannelBuffer *_pRpcChannelBuffer,
00635     PRPC_MESSAGE _pRpcMessage,
00636     DWORD *_pdwStubPhase);
00637
00638
00639 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowUserInterface_Proxy(
00640     ICvsCoworker __RPC_FAR * This,
00641     /* [in] */ int handle,
00642     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00643
00644
00645 void __RPC_STUB ICvsCoworker_ShowUserInterface_Stub(
00646     IRpcStubBuffer *This,
00647     IRpcChannelBuffer *_pRpcChannelBuffer,
00648     PRPC_MESSAGE _pRpcMessage,
00649     DWORD *_pdwStubPhase);
00650
00651
00652 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_HasAdvancedOptionsForCommand_Proxy(
00653     ICvsCoworker __RPC_FAR * This,
00654     /* [in] */ int handle,
00655     /* [in] */ CvsCommand command,
00656     /* [retval][out] */ BOOL __RPC_FAR *pbAdvancedOptions);
00657
00658
00659 void __RPC_STUB ICvsCoworker_HasAdvancedOptionsForCommand_Stub(
00660     IRpcStubBuffer *This,
00661     IRpcChannelBuffer *_pRpcChannelBuffer,
00662     PRPC_MESSAGE _pRpcMessage,
00663     DWORD *_pdwStubPhase);
00664
00665
00666 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy(
00667     ICvsCoworker __RPC_FAR * This,
00668     /* [in] */ int handle,
00669     /* [in] */ CvsCommand command);
00670
00671
00672 void __RPC_STUB ICvsCoworker_ShowAdvancedOptionsForCommand_Stub(
00673     IRpcStubBuffer *This,
00674     IRpcChannelBuffer *_pRpcChannelBuffer,
00675     PRPC_MESSAGE _pRpcMessage,
00676     DWORD *_pdwStubPhase);
00677
00678
00679 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFileChanges_Proxy(
00680     ICvsCoworker __RPC_FAR * This,
00681     /* [in] */ int handle,
00682     /* [in] */ int cbFilenameBuffer,
00683     /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenameBuffer);
00684
00685
00686 void __RPC_STUB ICvsCoworker_GetFileChanges_Stub(
00687     IRpcStubBuffer *This,
00688     IRpcChannelBuffer *_pRpcChannelBuffer,
00689     PRPC_MESSAGE _pRpcMessage,
00690     DWORD *_pdwStubPhase);
00691
00692
00693 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFilesToAdd_Proxy(
00694     ICvsCoworker __RPC_FAR * This,
00695     /* [in] */ int handle,
00696     /* [in] */ int cbFilenamesBuffer,
00697     /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenamesBuffer);
00698
00699
00700 void __RPC_STUB ICvsCoworker_GetFilesToAdd_Stub(
00701     IRpcStubBuffer *This,
00702     IRpcChannelBuffer *_pRpcChannelBuffer,
00703     PRPC_MESSAGE _pRpcMessage,
00704     DWORD *_pdwStubPhase);
00705
00706
00707 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_CloseProject_Proxy(
00708     ICvsCoworker __RPC_FAR * This,
00709     /* [in] */ int handle);
00710
00711
00712 void __RPC_STUB ICvsCoworker_CloseProject_Stub(
00713     IRpcStubBuffer *This,
00714     IRpcChannelBuffer *_pRpcChannelBuffer,
00715     PRPC_MESSAGE _pRpcMessage,
00716     DWORD *_pdwStubPhase);
00717
00718
00719
00720 #endif  /* __ICvsCoworker_INTERFACE_DEFINED__ */
00721
00722
00723
00724 #ifndef __CVS_COWORKERLib_LIBRARY_DEFINED__
00725 #define __CVS_COWORKERLib_LIBRARY_DEFINED__
00726
00727 /* library CVS_COWORKERLib */
00728 /* [helpstring][version][uuid] */
00729
00730
00731 EXTERN_C const IID LIBID_CVS_COWORKERLib;
00732
00733 EXTERN_C const CLSID CLSID_CvsCoworker;
00734
00735 #ifdef __cplusplus
00736
00737 class DECLSPEC_UUID("10E5359D-F454-11D2-B442-0080C6F9179D")
00738 CvsCoworker;
00739 #endif
00740 #endif /* __CVS_COWORKERLib_LIBRARY_DEFINED__ */
00741
00742 /* Additional Prototypes for ALL interfaces */
00743
00744 /* end of Additional Prototypes */
00745
00746 #ifdef __cplusplus
00747 }
00748 #endif
00749
00750 #endif
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CVS_Coworker_i.c Source File

WinCvs/CoWorker/CVS_Coworker_i.c

Go to the documentation of this file.
00001 /* this file contains the actual definitions of */
00002 /* the IIDs and CLSIDs */
00003
00004 /* link this file in with the server and any clients */
00005
00006
00007 /* File created by MIDL compiler version 5.01.0164 */
00008 /* at Tue May 25 19:23:37 1999
00009  */
00010 /* Compiler settings for cvs_coworker.idl:
00011     Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext
00012     error checks: allocation ref bounds_check enum stub_data
00013 */
00014 //@@MIDL_FILE_HEADING(  )
00015 #ifdef __cplusplus
00016 extern "C"{
00017 #endif
00018
00019
00020 #ifndef __IID_DEFINED__
00021 #define __IID_DEFINED__
00022
00023 typedef struct _IID
00024 {
00025     unsigned long x;
00026     unsigned short s1;
00027     unsigned short s2;
00028     unsigned char  c[8];
00029 } IID;
00030
00031 #endif // __IID_DEFINED__
00032
00033 #ifndef CLSID_DEFINED
00034 #define CLSID_DEFINED
00035 typedef IID CLSID;
00036 #endif // CLSID_DEFINED
00037
00038 const IID IID_ICvsCoworker = {0x10E5359C,0xF454,0x11D2,{0xB4,0x42,0x00,0x80,0xC6,0xF9,0x17,0x9D}};
00039
00040
00041 const IID LIBID_CVS_COWORKERLib = {0x10E53590,0xF454,0x11D2,{0xB4,0x42,0x00,0x80,0xC6,0xF9,0x17,0x9D}};
00042
00043
00044 const CLSID CLSID_CvsCoworker = {0x10E5359D,0xF454,0x11D2,{0xB4,0x42,0x00,0x80,0xC6,0xF9,0x17,0x9D}};
00045
00046
00047 #ifdef __cplusplus
00048 }
00049 #endif
00050
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CVS_Coworker_i.h Source File

WinCvs/CoWorker/CVS_Coworker_i.h

Go to the documentation of this file.
00001 /* this ALWAYS GENERATED file contains the definitions for the interfaces */
00002
00003
00004 /* File created by MIDL compiler version 5.01.0164 */
00005 /* at Tue May 25 17:48:18 1999
00006  */
00007 /* Compiler settings for E:\cvsscc\coworker1\CVS_Coworker.idl:
00008     Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
00009     error checks: allocation ref bounds_check enum stub_data
00010 */
00011 //@@MIDL_FILE_HEADING(  )
00012
00013
00014 /* verify that the <rpcndr.h> version is high enough to compile this file*/
00015 #ifndef __REQUIRED_RPCNDR_H_VERSION__
00016 #define __REQUIRED_RPCNDR_H_VERSION__ 440
00017 #endif
00018
00019 #include "rpc.h"
00020 #include "rpcndr.h"
00021
00022 #ifndef __RPCNDR_H_VERSION__
00023 #error this stub requires an updated version of <rpcndr.h>
00024 #endif // __RPCNDR_H_VERSION__
00025
00026 #ifndef COM_NO_WINDOWS_H
00027 #include "windows.h"
00028 #include "ole2.h"
00029 #endif /*COM_NO_WINDOWS_H*/
00030
00031 #ifndef __CVS_Coworker_i_h__
00032 #define __CVS_Coworker_i_h__
00033
00034 #ifdef __cplusplus
00035 extern "C"{
00036 #endif
00037
00038 /* Forward Declarations */
00039
00040 #ifndef __ICvsCoworker_FWD_DEFINED__
00041 #define __ICvsCoworker_FWD_DEFINED__
00042 typedef interface ICvsCoworker ICvsCoworker;
00043 #endif  /* __ICvsCoworker_FWD_DEFINED__ */
00044
00045
00046 #ifndef __CvsCoworker_FWD_DEFINED__
00047 #define __CvsCoworker_FWD_DEFINED__
00048
00049 #ifdef __cplusplus
00050 typedef class CvsCoworker CvsCoworker;
00051 #else
00052 typedef struct CvsCoworker CvsCoworker;
00053 #endif /* __cplusplus */
00054
00055 #endif  /* __CvsCoworker_FWD_DEFINED__ */
00056
00057
00058 /* header files for imported files */
00059 #include "oaidl.h"
00060 #include "ocidl.h"
00061
00062 void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
00063 void __RPC_USER MIDL_user_free( void __RPC_FAR * );
00064
00065 /* interface __MIDL_itf_CVS_Coworker_0000 */
00066 /* [local] */
00067
00068 typedef /* [helpstring][uuid] */
00069 enum CvsOption
00070     {   cvsOptionCompareContents    = 1,
00071     cvsOptionCompareChecksum    = 2,
00072     cvsOptionCompareTimestamp   = 3
00073     }   CvsOption;
00074
00075 typedef /* [helpstring][uuid] */
00076 enum CvsCommand
00077     {   cvsCommandUpdate    = 0,
00078     cvsCommandCheckout  = 1,
00079     cvsCommandCheckin   = 2,
00080     cvsCommandUncheckout    = 3,
00081     cvsCommandAdd   = 4,
00082     cvsCommandRemove    = 5,
00083     cvsCommandDiff  = 6,
00084     cvsCommandHistory   = 7,
00085     cvsCommandRename    = 8,
00086     cvsCommandProperties    = 9,
00087     cvsCommandOptions   = 10
00088     }   CvsCommand;
00089
00090
00091
00092 extern RPC_IF_HANDLE __MIDL_itf_CVS_Coworker_0000_v0_0_c_ifspec;
00093 extern RPC_IF_HANDLE __MIDL_itf_CVS_Coworker_0000_v0_0_s_ifspec;
00094
00095 #ifndef __ICvsCoworker_INTERFACE_DEFINED__
00096 #define __ICvsCoworker_INTERFACE_DEFINED__
00097
00098 /* interface ICvsCoworker */
00099 /* [unique][helpstring][oleautomation][uuid][object] */
00100
00101
00102 EXTERN_C const IID IID_ICvsCoworker;
00103
00104 #if defined(__cplusplus) && !defined(CINTERFACE)
00105
00106     MIDL_INTERFACE("10E5359C-F454-11D2-B442-0080C6F9179D")
00107     ICvsCoworker : public IUnknown
00108     {
00109     public:
00110         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetLastError(
00111             /* [in] */ int handle,
00112             /* [out] */ int __RPC_FAR *piError) = 0;
00113
00114         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetErrorMessage(
00115             /* [in] */ int handle,
00116             /* [in] */ int iError,
00117             /* [in] */ int cbErrorBuffer,
00118             /* [size_is][string][out] */ unsigned char __RPC_FAR *sErrorBuffer) = 0;
00119
00120         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE OpenProject(
00121             /* [out] */ int __RPC_FAR *pHandle,
00122             /* [string][in] */ const unsigned char __RPC_FAR *sUsername,
00123             /* [string][in] */ const unsigned char __RPC_FAR *sProjectName,
00124             /* [string][in] */ const unsigned char __RPC_FAR *sProjectHome) = 0;
00125
00126         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetProject(
00127             /* [out] */ int __RPC_FAR *pHandle,
00128             /* [in] */ const unsigned char __RPC_FAR *sUsername,
00129             /* [in] */ int cbProjectNameBuffer,
00130             /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectName,
00131             /* [in] */ int cbProjectHomeBuffer,
00132             /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectHome,
00133             /* [in] */ BOOL bAllowPathChange,
00134             /* [in] */ BOOL bAllowNewProject,
00135             /* [out] */ BOOL __RPC_FAR *pbNewProject) = 0;
00136
00137         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE UpdateFiles(
00138             /* [in] */ int handle,
00139             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00140             /* [in] */ BOOL bDirectories,
00141             /* [in] */ BOOL bRecurse) = 0;
00142
00143         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CheckoutFiles(
00144             /* [in] */ int handle,
00145             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames) = 0;
00146
00147         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CheckinFiles(
00148             /* [in] */ int handle,
00149             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00150             /* [in] */ BOOL bKeepCheckedOut) = 0;
00151
00152         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE UncheckoutFiles(
00153             /* [in] */ int handle,
00154             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames) = 0;
00155
00156         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AddFiles(
00157             /* [in] */ int handle,
00158             /* [string][in] */ const unsigned char __RPC_FAR *sOptionsAndFilenames,
00159             /* [string][in] */ const unsigned char __RPC_FAR *sComment) = 0;
00160
00161         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RemoveFiles(
00162             /* [in] */ int handle,
00163             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames) = 0;
00164
00165         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RenameFile(
00166             /* [in] */ int handle,
00167             /* [string][in] */ const unsigned char __RPC_FAR *sOldFilename,
00168             /* [string][in] */ const unsigned char __RPC_FAR *sNewFilename) = 0;
00169
00170         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DiffFile(
00171             /* [in] */ int handle,
00172             /* [string][in] */ const unsigned char __RPC_FAR *sFilename,
00173             /* [in] */ BOOL bIgnoreCase,
00174             /* [in] */ BOOL bIgnoreBlanks) = 0;
00175
00176         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ShowFileHistory(
00177             /* [in] */ int handle,
00178             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames) = 0;
00179
00180         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ShowFileProperties(
00181             /* [in] */ int handle,
00182             /* [string][in] */ const unsigned char __RPC_FAR *sFilename) = 0;
00183
00184         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ShowUserInterface(
00185             /* [in] */ int handle,
00186             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames) = 0;
00187
00188         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE HasAdvancedOptionsForCommand(
00189             /* [in] */ int handle,
00190             /* [in] */ CvsCommand command,
00191             /* [retval][out] */ BOOL __RPC_FAR *pbAdvancedOptions) = 0;
00192
00193         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ShowAdvancedOptionsForCommand(
00194             /* [in] */ int handle,
00195             /* [in] */ CvsCommand command) = 0;
00196
00197         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetFileChanges(
00198             /* [in] */ int handle,
00199             /* [in] */ int cbFilenameBuffer,
00200             /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenameBuffer) = 0;
00201
00202         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetFilesToAdd(
00203             /* [in] */ int handle,
00204             /* [in] */ int cbFilenamesBuffer,
00205             /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenamesBuffer) = 0;
00206
00207         virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CloseProject(
00208             /* [in] */ int handle) = 0;
00209
00210     };
00211
00212 #else   /* C style interface */
00213
00214     typedef struct ICvsCoworkerVtbl
00215     {
00216         BEGIN_INTERFACE
00217
00218         HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
00219             ICvsCoworker __RPC_FAR * This,
00220             /* [in] */ REFIID riid,
00221             /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
00222
00223         ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
00224             ICvsCoworker __RPC_FAR * This);
00225
00226         ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
00227             ICvsCoworker __RPC_FAR * This);
00228
00229         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLastError )(
00230             ICvsCoworker __RPC_FAR * This,
00231             /* [in] */ int handle,
00232             /* [out] */ int __RPC_FAR *piError);
00233
00234         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetErrorMessage )(
00235             ICvsCoworker __RPC_FAR * This,
00236             /* [in] */ int handle,
00237             /* [in] */ int iError,
00238             /* [in] */ int cbErrorBuffer,
00239             /* [size_is][string][out] */ unsigned char __RPC_FAR *sErrorBuffer);
00240
00241         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *OpenProject )(
00242             ICvsCoworker __RPC_FAR * This,
00243             /* [out] */ int __RPC_FAR *pHandle,
00244             /* [string][in] */ const unsigned char __RPC_FAR *sUsername,
00245             /* [string][in] */ const unsigned char __RPC_FAR *sProjectName,
00246             /* [string][in] */ const unsigned char __RPC_FAR *sProjectHome);
00247
00248         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetProject )(
00249             ICvsCoworker __RPC_FAR * This,
00250             /* [out] */ int __RPC_FAR *pHandle,
00251             /* [in] */ const unsigned char __RPC_FAR *sUsername,
00252             /* [in] */ int cbProjectNameBuffer,
00253             /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectName,
00254             /* [in] */ int cbProjectHomeBuffer,
00255             /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectHome,
00256             /* [in] */ BOOL bAllowPathChange,
00257             /* [in] */ BOOL bAllowNewProject,
00258             /* [out] */ BOOL __RPC_FAR *pbNewProject);
00259
00260         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *UpdateFiles )(
00261             ICvsCoworker __RPC_FAR * This,
00262             /* [in] */ int handle,
00263             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00264             /* [in] */ BOOL bDirectories,
00265             /* [in] */ BOOL bRecurse);
00266
00267         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CheckoutFiles )(
00268             ICvsCoworker __RPC_FAR * This,
00269             /* [in] */ int handle,
00270             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00271
00272         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CheckinFiles )(
00273             ICvsCoworker __RPC_FAR * This,
00274             /* [in] */ int handle,
00275             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00276             /* [in] */ BOOL bKeepCheckedOut);
00277
00278         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *UncheckoutFiles )(
00279             ICvsCoworker __RPC_FAR * This,
00280             /* [in] */ int handle,
00281             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00282
00283         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddFiles )(
00284             ICvsCoworker __RPC_FAR * This,
00285             /* [in] */ int handle,
00286             /* [string][in] */ const unsigned char __RPC_FAR *sOptionsAndFilenames,
00287             /* [string][in] */ const unsigned char __RPC_FAR *sComment);
00288
00289         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RemoveFiles )(
00290             ICvsCoworker __RPC_FAR * This,
00291             /* [in] */ int handle,
00292             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00293
00294         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RenameFile )(
00295             ICvsCoworker __RPC_FAR * This,
00296             /* [in] */ int handle,
00297             /* [string][in] */ const unsigned char __RPC_FAR *sOldFilename,
00298             /* [string][in] */ const unsigned char __RPC_FAR *sNewFilename);
00299
00300         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DiffFile )(
00301             ICvsCoworker __RPC_FAR * This,
00302             /* [in] */ int handle,
00303             /* [string][in] */ const unsigned char __RPC_FAR *sFilename,
00304             /* [in] */ BOOL bIgnoreCase,
00305             /* [in] */ BOOL bIgnoreBlanks);
00306
00307         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ShowFileHistory )(
00308             ICvsCoworker __RPC_FAR * This,
00309             /* [in] */ int handle,
00310             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00311
00312         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ShowFileProperties )(
00313             ICvsCoworker __RPC_FAR * This,
00314             /* [in] */ int handle,
00315             /* [string][in] */ const unsigned char __RPC_FAR *sFilename);
00316
00317         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ShowUserInterface )(
00318             ICvsCoworker __RPC_FAR * This,
00319             /* [in] */ int handle,
00320             /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00321
00322         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *HasAdvancedOptionsForCommand )(
00323             ICvsCoworker __RPC_FAR * This,
00324             /* [in] */ int handle,
00325             /* [in] */ CvsCommand command,
00326             /* [retval][out] */ BOOL __RPC_FAR *pbAdvancedOptions);
00327
00328         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ShowAdvancedOptionsForCommand )(
00329             ICvsCoworker __RPC_FAR * This,
00330             /* [in] */ int handle,
00331             /* [in] */ CvsCommand command);
00332
00333         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFileChanges )(
00334             ICvsCoworker __RPC_FAR * This,
00335             /* [in] */ int handle,
00336             /* [in] */ int cbFilenameBuffer,
00337             /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenameBuffer);
00338
00339         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFilesToAdd )(
00340             ICvsCoworker __RPC_FAR * This,
00341             /* [in] */ int handle,
00342             /* [in] */ int cbFilenamesBuffer,
00343             /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenamesBuffer);
00344
00345         /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CloseProject )(
00346             ICvsCoworker __RPC_FAR * This,
00347             /* [in] */ int handle);
00348
00349         END_INTERFACE
00350     } ICvsCoworkerVtbl;
00351
00352     interface ICvsCoworker
00353     {
00354         CONST_VTBL struct ICvsCoworkerVtbl __RPC_FAR *lpVtbl;
00355     };
00356
00357
00358
00359 #ifdef COBJMACROS
00360
00361
00362 #define ICvsCoworker_QueryInterface(This,riid,ppvObject)    \
00363     (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
00364
00365 #define ICvsCoworker_AddRef(This)   \
00366     (This)->lpVtbl -> AddRef(This)
00367
00368 #define ICvsCoworker_Release(This)  \
00369     (This)->lpVtbl -> Release(This)
00370
00371
00372 #define ICvsCoworker_GetLastError(This,handle,piError)  \
00373     (This)->lpVtbl -> GetLastError(This,handle,piError)
00374
00375 #define ICvsCoworker_GetErrorMessage(This,handle,iError,cbErrorBuffer,sErrorBuffer) \
00376     (This)->lpVtbl -> GetErrorMessage(This,handle,iError,cbErrorBuffer,sErrorBuffer)
00377
00378 #define ICvsCoworker_OpenProject(This,pHandle,sUsername,sProjectName,sProjectHome)  \
00379     (This)->lpVtbl -> OpenProject(This,pHandle,sUsername,sProjectName,sProjectHome)
00380
00381 #define ICvsCoworker_GetProject(This,pHandle,sUsername,cbProjectNameBuffer,sProjectName,cbProjectHomeBuffer,sProjectHome,bAllowPathChange,bAllowNewProject,pbNewProject)    \
00382     (This)->lpVtbl -> GetProject(This,pHandle,sUsername,cbProjectNameBuffer,sProjectName,cbProjectHomeBuffer,sProjectHome,bAllowPathChange,bAllowNewProject,pbNewProject)
00383
00384 #define ICvsCoworker_UpdateFiles(This,handle,sFilenames,bDirectories,bRecurse)  \
00385     (This)->lpVtbl -> UpdateFiles(This,handle,sFilenames,bDirectories,bRecurse)
00386
00387 #define ICvsCoworker_CheckoutFiles(This,handle,sFilenames)  \
00388     (This)->lpVtbl -> CheckoutFiles(This,handle,sFilenames)
00389
00390 #define ICvsCoworker_CheckinFiles(This,handle,sFilenames,bKeepCheckedOut)   \
00391     (This)->lpVtbl -> CheckinFiles(This,handle,sFilenames,bKeepCheckedOut)
00392
00393 #define ICvsCoworker_UncheckoutFiles(This,handle,sFilenames)    \
00394     (This)->lpVtbl -> UncheckoutFiles(This,handle,sFilenames)
00395
00396 #define ICvsCoworker_AddFiles(This,handle,sOptionsAndFilenames,sComment)    \
00397     (This)->lpVtbl -> AddFiles(This,handle,sOptionsAndFilenames,sComment)
00398
00399 #define ICvsCoworker_RemoveFiles(This,handle,sFilenames)    \
00400     (This)->lpVtbl -> RemoveFiles(This,handle,sFilenames)
00401
00402 #define ICvsCoworker_RenameFile(This,handle,sOldFilename,sNewFilename)  \
00403     (This)->lpVtbl -> RenameFile(This,handle,sOldFilename,sNewFilename)
00404
00405 #define ICvsCoworker_DiffFile(This,handle,sFilename,bIgnoreCase,bIgnoreBlanks)  \
00406     (This)->lpVtbl -> DiffFile(This,handle,sFilename,bIgnoreCase,bIgnoreBlanks)
00407
00408 #define ICvsCoworker_ShowFileHistory(This,handle,sFilenames)    \
00409     (This)->lpVtbl -> ShowFileHistory(This,handle,sFilenames)
00410
00411 #define ICvsCoworker_ShowFileProperties(This,handle,sFilename)  \
00412     (This)->lpVtbl -> ShowFileProperties(This,handle,sFilename)
00413
00414 #define ICvsCoworker_ShowUserInterface(This,handle,sFilenames)  \
00415     (This)->lpVtbl -> ShowUserInterface(This,handle,sFilenames)
00416
00417 #define ICvsCoworker_HasAdvancedOptionsForCommand(This,handle,command,pbAdvancedOptions)    \
00418     (This)->lpVtbl -> HasAdvancedOptionsForCommand(This,handle,command,pbAdvancedOptions)
00419
00420 #define ICvsCoworker_ShowAdvancedOptionsForCommand(This,handle,command) \
00421     (This)->lpVtbl -> ShowAdvancedOptionsForCommand(This,handle,command)
00422
00423 #define ICvsCoworker_GetFileChanges(This,handle,cbFilenameBuffer,sFilenameBuffer)   \
00424     (This)->lpVtbl -> GetFileChanges(This,handle,cbFilenameBuffer,sFilenameBuffer)
00425
00426 #define ICvsCoworker_GetFilesToAdd(This,handle,cbFilenamesBuffer,sFilenamesBuffer)  \
00427     (This)->lpVtbl -> GetFilesToAdd(This,handle,cbFilenamesBuffer,sFilenamesBuffer)
00428
00429 #define ICvsCoworker_CloseProject(This,handle)  \
00430     (This)->lpVtbl -> CloseProject(This,handle)
00431
00432 #endif /* COBJMACROS */
00433
00434
00435 #endif  /* C style interface */
00436
00437
00438
00439 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetLastError_Proxy(
00440     ICvsCoworker __RPC_FAR * This,
00441     /* [in] */ int handle,
00442     /* [out] */ int __RPC_FAR *piError);
00443
00444
00445 void __RPC_STUB ICvsCoworker_GetLastError_Stub(
00446     IRpcStubBuffer *This,
00447     IRpcChannelBuffer *_pRpcChannelBuffer,
00448     PRPC_MESSAGE _pRpcMessage,
00449     DWORD *_pdwStubPhase);
00450
00451
00452 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetErrorMessage_Proxy(
00453     ICvsCoworker __RPC_FAR * This,
00454     /* [in] */ int handle,
00455     /* [in] */ int iError,
00456     /* [in] */ int cbErrorBuffer,
00457     /* [size_is][string][out] */ unsigned char __RPC_FAR *sErrorBuffer);
00458
00459
00460 void __RPC_STUB ICvsCoworker_GetErrorMessage_Stub(
00461     IRpcStubBuffer *This,
00462     IRpcChannelBuffer *_pRpcChannelBuffer,
00463     PRPC_MESSAGE _pRpcMessage,
00464     DWORD *_pdwStubPhase);
00465
00466
00467 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_OpenProject_Proxy(
00468     ICvsCoworker __RPC_FAR * This,
00469     /* [out] */ int __RPC_FAR *pHandle,
00470     /* [string][in] */ const unsigned char __RPC_FAR *sUsername,
00471     /* [string][in] */ const unsigned char __RPC_FAR *sProjectName,
00472     /* [string][in] */ const unsigned char __RPC_FAR *sProjectHome);
00473
00474
00475 void __RPC_STUB ICvsCoworker_OpenProject_Stub(
00476     IRpcStubBuffer *This,
00477     IRpcChannelBuffer *_pRpcChannelBuffer,
00478     PRPC_MESSAGE _pRpcMessage,
00479     DWORD *_pdwStubPhase);
00480
00481
00482 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetProject_Proxy(
00483     ICvsCoworker __RPC_FAR * This,
00484     /* [out] */ int __RPC_FAR *pHandle,
00485     /* [in] */ const unsigned char __RPC_FAR *sUsername,
00486     /* [in] */ int cbProjectNameBuffer,
00487     /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectName,
00488     /* [in] */ int cbProjectHomeBuffer,
00489     /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectHome,
00490     /* [in] */ BOOL bAllowPathChange,
00491     /* [in] */ BOOL bAllowNewProject,
00492     /* [out] */ BOOL __RPC_FAR *pbNewProject);
00493
00494
00495 void __RPC_STUB ICvsCoworker_GetProject_Stub(
00496     IRpcStubBuffer *This,
00497     IRpcChannelBuffer *_pRpcChannelBuffer,
00498     PRPC_MESSAGE _pRpcMessage,
00499     DWORD *_pdwStubPhase);
00500
00501
00502 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_UpdateFiles_Proxy(
00503     ICvsCoworker __RPC_FAR * This,
00504     /* [in] */ int handle,
00505     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00506     /* [in] */ BOOL bDirectories,
00507     /* [in] */ BOOL bRecurse);
00508
00509
00510 void __RPC_STUB ICvsCoworker_UpdateFiles_Stub(
00511     IRpcStubBuffer *This,
00512     IRpcChannelBuffer *_pRpcChannelBuffer,
00513     PRPC_MESSAGE _pRpcMessage,
00514     DWORD *_pdwStubPhase);
00515
00516
00517 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckoutFiles_Proxy(
00518     ICvsCoworker __RPC_FAR * This,
00519     /* [in] */ int handle,
00520     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00521
00522
00523 void __RPC_STUB ICvsCoworker_CheckoutFiles_Stub(
00524     IRpcStubBuffer *This,
00525     IRpcChannelBuffer *_pRpcChannelBuffer,
00526     PRPC_MESSAGE _pRpcMessage,
00527     DWORD *_pdwStubPhase);
00528
00529
00530 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckinFiles_Proxy(
00531     ICvsCoworker __RPC_FAR * This,
00532     /* [in] */ int handle,
00533     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00534     /* [in] */ BOOL bKeepCheckedOut);
00535
00536
00537 void __RPC_STUB ICvsCoworker_CheckinFiles_Stub(
00538     IRpcStubBuffer *This,
00539     IRpcChannelBuffer *_pRpcChannelBuffer,
00540     PRPC_MESSAGE _pRpcMessage,
00541     DWORD *_pdwStubPhase);
00542
00543
00544 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_UncheckoutFiles_Proxy(
00545     ICvsCoworker __RPC_FAR * This,
00546     /* [in] */ int handle,
00547     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00548
00549
00550 void __RPC_STUB ICvsCoworker_UncheckoutFiles_Stub(
00551     IRpcStubBuffer *This,
00552     IRpcChannelBuffer *_pRpcChannelBuffer,
00553     PRPC_MESSAGE _pRpcMessage,
00554     DWORD *_pdwStubPhase);
00555
00556
00557 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_AddFiles_Proxy(
00558     ICvsCoworker __RPC_FAR * This,
00559     /* [in] */ int handle,
00560     /* [string][in] */ const unsigned char __RPC_FAR *sOptionsAndFilenames,
00561     /* [string][in] */ const unsigned char __RPC_FAR *sComment);
00562
00563
00564 void __RPC_STUB ICvsCoworker_AddFiles_Stub(
00565     IRpcStubBuffer *This,
00566     IRpcChannelBuffer *_pRpcChannelBuffer,
00567     PRPC_MESSAGE _pRpcMessage,
00568     DWORD *_pdwStubPhase);
00569
00570
00571 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_RemoveFiles_Proxy(
00572     ICvsCoworker __RPC_FAR * This,
00573     /* [in] */ int handle,
00574     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00575
00576
00577 void __RPC_STUB ICvsCoworker_RemoveFiles_Stub(
00578     IRpcStubBuffer *This,
00579     IRpcChannelBuffer *_pRpcChannelBuffer,
00580     PRPC_MESSAGE _pRpcMessage,
00581     DWORD *_pdwStubPhase);
00582
00583
00584 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_RenameFile_Proxy(
00585     ICvsCoworker __RPC_FAR * This,
00586     /* [in] */ int handle,
00587     /* [string][in] */ const unsigned char __RPC_FAR *sOldFilename,
00588     /* [string][in] */ const unsigned char __RPC_FAR *sNewFilename);
00589
00590
00591 void __RPC_STUB ICvsCoworker_RenameFile_Stub(
00592     IRpcStubBuffer *This,
00593     IRpcChannelBuffer *_pRpcChannelBuffer,
00594     PRPC_MESSAGE _pRpcMessage,
00595     DWORD *_pdwStubPhase);
00596
00597
00598 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_DiffFile_Proxy(
00599     ICvsCoworker __RPC_FAR * This,
00600     /* [in] */ int handle,
00601     /* [string][in] */ const unsigned char __RPC_FAR *sFilename,
00602     /* [in] */ BOOL bIgnoreCase,
00603     /* [in] */ BOOL bIgnoreBlanks);
00604
00605
00606 void __RPC_STUB ICvsCoworker_DiffFile_Stub(
00607     IRpcStubBuffer *This,
00608     IRpcChannelBuffer *_pRpcChannelBuffer,
00609     PRPC_MESSAGE _pRpcMessage,
00610     DWORD *_pdwStubPhase);
00611
00612
00613 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileHistory_Proxy(
00614     ICvsCoworker __RPC_FAR * This,
00615     /* [in] */ int handle,
00616     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00617
00618
00619 void __RPC_STUB ICvsCoworker_ShowFileHistory_Stub(
00620     IRpcStubBuffer *This,
00621     IRpcChannelBuffer *_pRpcChannelBuffer,
00622     PRPC_MESSAGE _pRpcMessage,
00623     DWORD *_pdwStubPhase);
00624
00625
00626 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileProperties_Proxy(
00627     ICvsCoworker __RPC_FAR * This,
00628     /* [in] */ int handle,
00629     /* [string][in] */ const unsigned char __RPC_FAR *sFilename);
00630
00631
00632 void __RPC_STUB ICvsCoworker_ShowFileProperties_Stub(
00633     IRpcStubBuffer *This,
00634     IRpcChannelBuffer *_pRpcChannelBuffer,
00635     PRPC_MESSAGE _pRpcMessage,
00636     DWORD *_pdwStubPhase);
00637
00638
00639 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowUserInterface_Proxy(
00640     ICvsCoworker __RPC_FAR * This,
00641     /* [in] */ int handle,
00642     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames);
00643
00644
00645 void __RPC_STUB ICvsCoworker_ShowUserInterface_Stub(
00646     IRpcStubBuffer *This,
00647     IRpcChannelBuffer *_pRpcChannelBuffer,
00648     PRPC_MESSAGE _pRpcMessage,
00649     DWORD *_pdwStubPhase);
00650
00651
00652 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_HasAdvancedOptionsForCommand_Proxy(
00653     ICvsCoworker __RPC_FAR * This,
00654     /* [in] */ int handle,
00655     /* [in] */ CvsCommand command,
00656     /* [retval][out] */ BOOL __RPC_FAR *pbAdvancedOptions);
00657
00658
00659 void __RPC_STUB ICvsCoworker_HasAdvancedOptionsForCommand_Stub(
00660     IRpcStubBuffer *This,
00661     IRpcChannelBuffer *_pRpcChannelBuffer,
00662     PRPC_MESSAGE _pRpcMessage,
00663     DWORD *_pdwStubPhase);
00664
00665
00666 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy(
00667     ICvsCoworker __RPC_FAR * This,
00668     /* [in] */ int handle,
00669     /* [in] */ CvsCommand command);
00670
00671
00672 void __RPC_STUB ICvsCoworker_ShowAdvancedOptionsForCommand_Stub(
00673     IRpcStubBuffer *This,
00674     IRpcChannelBuffer *_pRpcChannelBuffer,
00675     PRPC_MESSAGE _pRpcMessage,
00676     DWORD *_pdwStubPhase);
00677
00678
00679 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFileChanges_Proxy(
00680     ICvsCoworker __RPC_FAR * This,
00681     /* [in] */ int handle,
00682     /* [in] */ int cbFilenameBuffer,
00683     /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenameBuffer);
00684
00685
00686 void __RPC_STUB ICvsCoworker_GetFileChanges_Stub(
00687     IRpcStubBuffer *This,
00688     IRpcChannelBuffer *_pRpcChannelBuffer,
00689     PRPC_MESSAGE _pRpcMessage,
00690     DWORD *_pdwStubPhase);
00691
00692
00693 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFilesToAdd_Proxy(
00694     ICvsCoworker __RPC_FAR * This,
00695     /* [in] */ int handle,
00696     /* [in] */ int cbFilenamesBuffer,
00697     /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenamesBuffer);
00698
00699
00700 void __RPC_STUB ICvsCoworker_GetFilesToAdd_Stub(
00701     IRpcStubBuffer *This,
00702     IRpcChannelBuffer *_pRpcChannelBuffer,
00703     PRPC_MESSAGE _pRpcMessage,
00704     DWORD *_pdwStubPhase);
00705
00706
00707 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_CloseProject_Proxy(
00708     ICvsCoworker __RPC_FAR * This,
00709     /* [in] */ int handle);
00710
00711
00712 void __RPC_STUB ICvsCoworker_CloseProject_Stub(
00713     IRpcStubBuffer *This,
00714     IRpcChannelBuffer *_pRpcChannelBuffer,
00715     PRPC_MESSAGE _pRpcMessage,
00716     DWORD *_pdwStubPhase);
00717
00718
00719
00720 #endif  /* __ICvsCoworker_INTERFACE_DEFINED__ */
00721
00722
00723
00724 #ifndef __CVS_COWORKERLib_LIBRARY_DEFINED__
00725 #define __CVS_COWORKERLib_LIBRARY_DEFINED__
00726
00727 /* library CVS_COWORKERLib */
00728 /* [helpstring][version][uuid] */
00729
00730
00731 EXTERN_C const IID LIBID_CVS_COWORKERLib;
00732
00733 EXTERN_C const CLSID CLSID_CvsCoworker;
00734
00735 #ifdef __cplusplus
00736
00737 class DECLSPEC_UUID("10E5359D-F454-11D2-B442-0080C6F9179D")
00738 CvsCoworker;
00739 #endif
00740 #endif /* __CVS_COWORKERLib_LIBRARY_DEFINED__ */
00741
00742 /* Additional Prototypes for ALL interfaces */
00743
00744 /* end of Additional Prototypes */
00745
00746 #ifdef __cplusplus
00747 }
00748 #endif
00749
00750 #endif
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CVS_Coworker_p.c Source File

WinCvs/CoWorker/CVS_Coworker_p.c

Go to the documentation of this file.
00001 /* this ALWAYS GENERATED file contains the proxy stub code */
00002
00003
00004 /* File created by MIDL compiler version 5.01.0164 */
00005 /* at Tue May 25 19:23:37 1999
00006  */
00007 /* Compiler settings for cvs_coworker.idl:
00008     Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext
00009     error checks: allocation ref bounds_check enum stub_data
00010 */
00011 //@@MIDL_FILE_HEADING(  )
00012
00013
00014 /* verify that the <rpcproxy.h> version is high enough to compile this file*/
00015 #ifndef __REDQ_RPCPROXY_H_VERSION__
00016 #define __REQUIRED_RPCPROXY_H_VERSION__ 440
00017 #endif
00018
00019
00020 #include "rpcproxy.h"
00021 #ifndef __RPCPROXY_H_VERSION__
00022 #error this stub requires an updated version of <rpcproxy.h>
00023 #endif // __RPCPROXY_H_VERSION__
00024
00025
00026 #include "cvs_coworker.h"
00027
00028 #define TYPE_FORMAT_STRING_SIZE   65
00029 #define PROC_FORMAT_STRING_SIZE   151
00030
00031 typedef struct _MIDL_TYPE_FORMAT_STRING
00032     {
00033     short          Pad;
00034     unsigned char  Format[ TYPE_FORMAT_STRING_SIZE ];
00035     } MIDL_TYPE_FORMAT_STRING;
00036
00037 typedef struct _MIDL_PROC_FORMAT_STRING
00038     {
00039     short          Pad;
00040     unsigned char  Format[ PROC_FORMAT_STRING_SIZE ];
00041     } MIDL_PROC_FORMAT_STRING;
00042
00043
00044 extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;
00045 extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;
00046
00047
00048 /* Standard interface: __MIDL_itf_cvs_coworker_0000, ver. 0.0,
00049    GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */
00050
00051
00052 /* Object interface: IUnknown, ver. 0.0,
00053    GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
00054
00055
00056 /* Object interface: ICvsCoworker, ver. 0.0,
00057    GUID={0x10E5359C,0xF454,0x11D2,{0xB4,0x42,0x00,0x80,0xC6,0xF9,0x17,0x9D}} */
00058
00059
00060 extern const MIDL_STUB_DESC Object_StubDesc;
00061
00062
00063 #pragma code_seg(".orpc")
00064
00065 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetLastError_Proxy(
00066     ICvsCoworker __RPC_FAR * This,
00067     /* [in] */ int handle,
00068     /* [out] */ int __RPC_FAR *piError)
00069 {
00070
00071     HRESULT _RetVal;
00072
00073     RPC_MESSAGE _RpcMessage;
00074
00075     MIDL_STUB_MESSAGE _StubMsg;
00076
00077     RpcTryExcept
00078         {
00079         NdrProxyInitialize(
00080                       ( void __RPC_FAR *  )This,
00081                       ( PRPC_MESSAGE  )&_RpcMessage,
00082                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00083                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00084                       3);
00085
00086
00087
00088         if(!piError)
00089             {
00090             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00091             }
00092         RpcTryFinally
00093             {
00094
00095             _StubMsg.BufferLength = 4U;
00096             NdrProxyGetBuffer(This, &_StubMsg);
00097             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00098
00099             NdrProxySendReceive(This, &_StubMsg);
00100
00101             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00102                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] );
00103
00104             *piError = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00105
00106             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00107
00108             }
00109         RpcFinally
00110             {
00111             NdrProxyFreeBuffer(This, &_StubMsg);
00112
00113             }
00114         RpcEndFinally
00115
00116         }
00117     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00118         {
00119         NdrClearOutParameters(
00120                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00121                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00122                          ( void __RPC_FAR * )piError);
00123         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00124         }
00125     RpcEndExcept
00126     return _RetVal;
00127 }
00128
00129 void __RPC_STUB ICvsCoworker_GetLastError_Stub(
00130     IRpcStubBuffer *This,
00131     IRpcChannelBuffer *_pRpcChannelBuffer,
00132     PRPC_MESSAGE _pRpcMessage,
00133     DWORD *_pdwStubPhase)
00134 {
00135     int _M0;
00136     HRESULT _RetVal;
00137     MIDL_STUB_MESSAGE _StubMsg;
00138     int handle;
00139     int __RPC_FAR *piError;
00140
00141 NdrStubInitialize(
00142                      _pRpcMessage,
00143                      &_StubMsg,
00144                      &Object_StubDesc,
00145                      _pRpcChannelBuffer);
00146     ( int __RPC_FAR * )piError = 0;
00147     RpcTryFinally
00148         {
00149         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00150             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] );
00151
00152         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00153
00154         piError = &_M0;
00155
00156         *_pdwStubPhase = STUB_CALL_SERVER;
00157         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetLastError(
00158                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00159                 handle,
00160                 piError);
00161
00162         *_pdwStubPhase = STUB_MARSHAL;
00163
00164         _StubMsg.BufferLength = 4U + 4U;
00165         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00166         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *piError;
00167
00168         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00169
00170         }
00171     RpcFinally
00172         {
00173         }
00174     RpcEndFinally
00175     _pRpcMessage->BufferLength =
00176         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00177
00178 }
00179
00180
00181 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetErrorMessage_Proxy(
00182     ICvsCoworker __RPC_FAR * This,
00183     /* [in] */ int handle,
00184     /* [in] */ int iError,
00185     /* [in] */ int cbErrorBuffer,
00186     /* [size_is][string][out] */ unsigned char __RPC_FAR *sErrorBuffer)
00187 {
00188
00189     HRESULT _RetVal;
00190
00191     RPC_MESSAGE _RpcMessage;
00192
00193     MIDL_STUB_MESSAGE _StubMsg;
00194
00195     RpcTryExcept
00196         {
00197         NdrProxyInitialize(
00198                       ( void __RPC_FAR *  )This,
00199                       ( PRPC_MESSAGE  )&_RpcMessage,
00200                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00201                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00202                       4);
00203
00204
00205
00206         if(!sErrorBuffer)
00207             {
00208             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00209             }
00210         RpcTryFinally
00211             {
00212
00213             _StubMsg.BufferLength = 4U + 4U + 4U;
00214             NdrProxyGetBuffer(This, &_StubMsg);
00215             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00216
00217             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = iError;
00218
00219             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbErrorBuffer;
00220
00221             NdrProxySendReceive(This, &_StubMsg);
00222
00223             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00224                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[8] );
00225
00226             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00227                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sErrorBuffer,
00228                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10],
00229                                            (unsigned char)0 );
00230
00231             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00232             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00233
00234             }
00235         RpcFinally
00236             {
00237             NdrProxyFreeBuffer(This, &_StubMsg);
00238
00239             }
00240         RpcEndFinally
00241
00242         }
00243     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00244         {
00245         _StubMsg.MaxCount = cbErrorBuffer;
00246
00247         NdrClearOutParameters(
00248                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00249                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[6],
00250                          ( void __RPC_FAR * )sErrorBuffer);
00251         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00252         }
00253     RpcEndExcept
00254     return _RetVal;
00255 }
00256
00257 void __RPC_STUB ICvsCoworker_GetErrorMessage_Stub(
00258     IRpcStubBuffer *This,
00259     IRpcChannelBuffer *_pRpcChannelBuffer,
00260     PRPC_MESSAGE _pRpcMessage,
00261     DWORD *_pdwStubPhase)
00262 {
00263     HRESULT _RetVal;
00264     MIDL_STUB_MESSAGE _StubMsg;
00265     int cbErrorBuffer;
00266     int handle;
00267     int iError;
00268     unsigned char __RPC_FAR *sErrorBuffer;
00269
00270 NdrStubInitialize(
00271                      _pRpcMessage,
00272                      &_StubMsg,
00273                      &Object_StubDesc,
00274                      _pRpcChannelBuffer);
00275     ( unsigned char __RPC_FAR * )sErrorBuffer = 0;
00276     RpcTryFinally
00277         {
00278         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00279             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[8] );
00280
00281         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00282
00283         iError = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00284
00285         cbErrorBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00286
00287         if(cbErrorBuffer * 1 < 0)
00288             {
00289             RpcRaiseException(RPC_X_INVALID_BOUND);
00290             }
00291         sErrorBuffer = NdrAllocate(&_StubMsg,cbErrorBuffer * 1);
00292
00293         *_pdwStubPhase = STUB_CALL_SERVER;
00294         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetErrorMessage(
00295                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00296                    handle,
00297                    iError,
00298                    cbErrorBuffer,
00299                    sErrorBuffer);
00300
00301         *_pdwStubPhase = STUB_MARSHAL;
00302
00303         _StubMsg.BufferLength = 12U + 11U;
00304         _StubMsg.MaxCount = cbErrorBuffer;
00305
00306         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00307                                        (unsigned char __RPC_FAR *)sErrorBuffer,
00308                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10] );
00309
00310         _StubMsg.BufferLength += 16;
00311
00312         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00313         _StubMsg.MaxCount = cbErrorBuffer;
00314
00315         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00316                                      (unsigned char __RPC_FAR *)sErrorBuffer,
00317                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10] );
00318
00319         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00320         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00321
00322         }
00323     RpcFinally
00324         {
00325         _StubMsg.MaxCount = cbErrorBuffer;
00326
00327         NdrPointerFree( &_StubMsg,
00328                         (unsigned char __RPC_FAR *)sErrorBuffer,
00329                         &__MIDL_TypeFormatString.Format[6] );
00330
00331         }
00332     RpcEndFinally
00333     _pRpcMessage->BufferLength =
00334         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00335
00336 }
00337
00338
00339 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_OpenProject_Proxy(
00340     ICvsCoworker __RPC_FAR * This,
00341     /* [out] */ int __RPC_FAR *pHandle,
00342     /* [string][in] */ const unsigned char __RPC_FAR *sUsername,
00343     /* [string][in] */ const unsigned char __RPC_FAR *sProjectName,
00344     /* [string][in] */ const unsigned char __RPC_FAR *sProjectHome)
00345 {
00346
00347     HRESULT _RetVal;
00348
00349     RPC_MESSAGE _RpcMessage;
00350
00351     MIDL_STUB_MESSAGE _StubMsg;
00352
00353     RpcTryExcept
00354         {
00355         NdrProxyInitialize(
00356                       ( void __RPC_FAR *  )This,
00357                       ( PRPC_MESSAGE  )&_RpcMessage,
00358                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00359                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00360                       5);
00361
00362
00363
00364         if(!pHandle)
00365             {
00366             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00367             }
00368         if(!sUsername)
00369             {
00370             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00371             }
00372         if(!sProjectName)
00373             {
00374             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00375             }
00376         if(!sProjectHome)
00377             {
00378             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00379             }
00380         RpcTryFinally
00381             {
00382
00383             _StubMsg.BufferLength = 12U + 13U + 13U;
00384             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00385                                            (unsigned char __RPC_FAR *)sUsername,
00386                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00387
00388             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00389                                            (unsigned char __RPC_FAR *)sProjectName,
00390                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00391
00392             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00393                                            (unsigned char __RPC_FAR *)sProjectHome,
00394                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00395
00396             NdrProxyGetBuffer(This, &_StubMsg);
00397             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00398                                          (unsigned char __RPC_FAR *)sUsername,
00399                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00400
00401             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00402                                          (unsigned char __RPC_FAR *)sProjectName,
00403                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00404
00405             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00406                                          (unsigned char __RPC_FAR *)sProjectHome,
00407                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00408
00409             NdrProxySendReceive(This, &_StubMsg);
00410
00411             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00412                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[20] );
00413
00414             *pHandle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00415
00416             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00417
00418             }
00419         RpcFinally
00420             {
00421             NdrProxyFreeBuffer(This, &_StubMsg);
00422
00423             }
00424         RpcEndFinally
00425
00426         }
00427     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00428         {
00429         NdrClearOutParameters(
00430                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00431                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00432                          ( void __RPC_FAR * )pHandle);
00433         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00434         }
00435     RpcEndExcept
00436     return _RetVal;
00437 }
00438
00439 void __RPC_STUB ICvsCoworker_OpenProject_Stub(
00440     IRpcStubBuffer *This,
00441     IRpcChannelBuffer *_pRpcChannelBuffer,
00442     PRPC_MESSAGE _pRpcMessage,
00443     DWORD *_pdwStubPhase)
00444 {
00445     int _M9;
00446     HRESULT _RetVal;
00447     MIDL_STUB_MESSAGE _StubMsg;
00448     int __RPC_FAR *pHandle;
00449     const unsigned char __RPC_FAR *sProjectHome;
00450     const unsigned char __RPC_FAR *sProjectName;
00451     const unsigned char __RPC_FAR *sUsername;
00452
00453 NdrStubInitialize(
00454                      _pRpcMessage,
00455                      &_StubMsg,
00456                      &Object_StubDesc,
00457                      _pRpcChannelBuffer);
00458     ( int __RPC_FAR * )pHandle = 0;
00459     ( unsigned char __RPC_FAR * )sUsername = 0;
00460     ( unsigned char __RPC_FAR * )sProjectName = 0;
00461     ( unsigned char __RPC_FAR * )sProjectHome = 0;
00462     RpcTryFinally
00463         {
00464         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00465             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[20] );
00466
00467         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00468                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sUsername,
00469                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00470                                        (unsigned char)0 );
00471
00472         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00473                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00474                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00475                                        (unsigned char)0 );
00476
00477         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00478                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00479                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00480                                        (unsigned char)0 );
00481
00482         pHandle = &_M9;
00483
00484         *_pdwStubPhase = STUB_CALL_SERVER;
00485         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> OpenProject(
00486                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00487                pHandle,
00488                sUsername,
00489                sProjectName,
00490                sProjectHome);
00491
00492         *_pdwStubPhase = STUB_MARSHAL;
00493
00494         _StubMsg.BufferLength = 4U + 4U;
00495         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00496         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *pHandle;
00497
00498         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00499
00500         }
00501     RpcFinally
00502         {
00503         }
00504     RpcEndFinally
00505     _pRpcMessage->BufferLength =
00506         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00507
00508 }
00509
00510
00511 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetProject_Proxy(
00512     ICvsCoworker __RPC_FAR * This,
00513     /* [out] */ int __RPC_FAR *pHandle,
00514     /* [in] */ const unsigned char __RPC_FAR *sUsername,
00515     /* [in] */ int cbProjectNameBuffer,
00516     /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectName,
00517     /* [in] */ int cbProjectHomeBuffer,
00518     /* [size_is][string][out][in] */ unsigned char __RPC_FAR *sProjectHome,
00519     /* [in] */ BOOL bAllowPathChange,
00520     /* [in] */ BOOL bAllowNewProject,
00521     /* [out] */ BOOL __RPC_FAR *pbNewProject)
00522 {
00523
00524     HRESULT _RetVal;
00525
00526     RPC_MESSAGE _RpcMessage;
00527
00528     MIDL_STUB_MESSAGE _StubMsg;
00529
00530     RpcTryExcept
00531         {
00532         NdrProxyInitialize(
00533                       ( void __RPC_FAR *  )This,
00534                       ( PRPC_MESSAGE  )&_RpcMessage,
00535                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00536                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00537                       6);
00538
00539
00540
00541         if(!pHandle)
00542             {
00543             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00544             }
00545         if(!sUsername)
00546             {
00547             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00548             }
00549         if(!sProjectName)
00550             {
00551             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00552             }
00553         if(!sProjectHome)
00554             {
00555             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00556             }
00557         if(!pbNewProject)
00558             {
00559             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00560             }
00561         RpcTryFinally
00562             {
00563
00564             _StubMsg.BufferLength = 1U + 7U + 12U + 11U + 13U + 11U + 7U;
00565             _StubMsg.MaxCount = cbProjectNameBuffer;
00566
00567             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00568                                            (unsigned char __RPC_FAR *)sProjectName,
00569                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00570
00571             _StubMsg.MaxCount = cbProjectHomeBuffer;
00572
00573             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00574                                            (unsigned char __RPC_FAR *)sProjectHome,
00575                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00576
00577             NdrProxyGetBuffer(This, &_StubMsg);
00578             *(( unsigned char __RPC_FAR * )_StubMsg.Buffer)++ = *sUsername;
00579
00580             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00581             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbProjectNameBuffer;
00582
00583             _StubMsg.MaxCount = cbProjectNameBuffer;
00584
00585             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00586                                          (unsigned char __RPC_FAR *)sProjectName,
00587                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00588
00589             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00590             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbProjectHomeBuffer;
00591
00592             _StubMsg.MaxCount = cbProjectHomeBuffer;
00593
00594             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00595                                          (unsigned char __RPC_FAR *)sProjectHome,
00596                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00597
00598             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00599             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bAllowPathChange;
00600
00601             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bAllowNewProject;
00602
00603             NdrProxySendReceive(This, &_StubMsg);
00604
00605             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00606                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[38] );
00607
00608             *pHandle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00609
00610             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00611                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00612                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28],
00613                                            (unsigned char)0 );
00614
00615             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00616                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00617                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38],
00618                                            (unsigned char)0 );
00619
00620             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00621             *pbNewProject = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00622
00623             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00624
00625             }
00626         RpcFinally
00627             {
00628             NdrProxyFreeBuffer(This, &_StubMsg);
00629
00630             }
00631         RpcEndFinally
00632
00633         }
00634     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00635         {
00636         NdrClearOutParameters(
00637                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00638                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00639                          ( void __RPC_FAR * )pHandle);
00640         _StubMsg.MaxCount = cbProjectNameBuffer;
00641
00642         NdrClearOutParameters(
00643                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00644                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[24],
00645                          ( void __RPC_FAR * )sProjectName);
00646         _StubMsg.MaxCount = cbProjectHomeBuffer;
00647
00648         NdrClearOutParameters(
00649                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00650                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[34],
00651                          ( void __RPC_FAR * )sProjectHome);
00652         NdrClearOutParameters(
00653                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00654                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00655                          ( void __RPC_FAR * )pbNewProject);
00656         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00657         }
00658     RpcEndExcept
00659     return _RetVal;
00660 }
00661
00662 void __RPC_STUB ICvsCoworker_GetProject_Stub(
00663     IRpcStubBuffer *This,
00664     IRpcChannelBuffer *_pRpcChannelBuffer,
00665     PRPC_MESSAGE _pRpcMessage,
00666     DWORD *_pdwStubPhase)
00667 {
00668     int _M14;
00669     BOOL _M15;
00670     HRESULT _RetVal;
00671     MIDL_STUB_MESSAGE _StubMsg;
00672     BOOL bAllowNewProject;
00673     BOOL bAllowPathChange;
00674     int cbProjectHomeBuffer;
00675     int cbProjectNameBuffer;
00676     int __RPC_FAR *pHandle;
00677     BOOL __RPC_FAR *pbNewProject;
00678     unsigned char __RPC_FAR *sProjectHome;
00679     unsigned char __RPC_FAR *sProjectName;
00680     const unsigned char __RPC_FAR *sUsername;
00681
00682 NdrStubInitialize(
00683                      _pRpcMessage,
00684                      &_StubMsg,
00685                      &Object_StubDesc,
00686                      _pRpcChannelBuffer);
00687     ( int __RPC_FAR * )pHandle = 0;
00688     ( unsigned char __RPC_FAR * )sUsername = 0;
00689     ( unsigned char __RPC_FAR * )sProjectName = 0;
00690     ( unsigned char __RPC_FAR * )sProjectHome = 0;
00691     ( BOOL __RPC_FAR * )pbNewProject = 0;
00692     RpcTryFinally
00693         {
00694         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00695             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[38] );
00696
00697         sUsername = ( unsigned char __RPC_FAR * )_StubMsg.Buffer;
00698         _StubMsg.Buffer += sizeof( unsigned char  );
00699
00700         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00701         cbProjectNameBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00702
00703         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00704                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00705                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28],
00706                                        (unsigned char)0 );
00707
00708         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00709         cbProjectHomeBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00710
00711         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00712                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00713                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38],
00714                                        (unsigned char)0 );
00715
00716         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00717         bAllowPathChange = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00718
00719         bAllowNewProject = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00720
00721         pHandle = &_M14;
00722         pbNewProject = &_M15;
00723
00724         *_pdwStubPhase = STUB_CALL_SERVER;
00725         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetProject(
00726               (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00727               pHandle,
00728               sUsername,
00729               cbProjectNameBuffer,
00730               sProjectName,
00731               cbProjectHomeBuffer,
00732               sProjectHome,
00733               bAllowPathChange,
00734               bAllowNewProject,
00735               pbNewProject);
00736
00737         *_pdwStubPhase = STUB_MARSHAL;
00738
00739         _StubMsg.BufferLength = 4U + 12U + 13U + 11U + 7U;
00740         _StubMsg.MaxCount = cbProjectNameBuffer;
00741
00742         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00743                                        (unsigned char __RPC_FAR *)sProjectName,
00744                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00745
00746         _StubMsg.MaxCount = cbProjectHomeBuffer;
00747
00748         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00749                                        (unsigned char __RPC_FAR *)sProjectHome,
00750                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00751
00752         _StubMsg.BufferLength += 16;
00753
00754         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00755         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *pHandle;
00756
00757         _StubMsg.MaxCount = cbProjectNameBuffer;
00758
00759         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00760                                      (unsigned char __RPC_FAR *)sProjectName,
00761                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00762
00763         _StubMsg.MaxCount = cbProjectHomeBuffer;
00764
00765         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00766                                      (unsigned char __RPC_FAR *)sProjectHome,
00767                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00768
00769         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00770         *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = *pbNewProject;
00771
00772         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00773
00774         }
00775     RpcFinally
00776         {
00777         _StubMsg.MaxCount = cbProjectNameBuffer;
00778
00779         NdrPointerFree( &_StubMsg,
00780                         (unsigned char __RPC_FAR *)sProjectName,
00781                         &__MIDL_TypeFormatString.Format[24] );
00782
00783         _StubMsg.MaxCount = cbProjectHomeBuffer;
00784
00785         NdrPointerFree( &_StubMsg,
00786                         (unsigned char __RPC_FAR *)sProjectHome,
00787                         &__MIDL_TypeFormatString.Format[34] );
00788
00789         }
00790     RpcEndFinally
00791     _pRpcMessage->BufferLength =
00792         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00793
00794 }
00795
00796
00797 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_UpdateFiles_Proxy(
00798     ICvsCoworker __RPC_FAR * This,
00799     /* [in] */ int handle,
00800     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
00801     /* [in] */ BOOL bDirectories,
00802     /* [in] */ BOOL bRecurse)
00803 {
00804
00805     HRESULT _RetVal;
00806
00807     RPC_MESSAGE _RpcMessage;
00808
00809     MIDL_STUB_MESSAGE _StubMsg;
00810
00811     RpcTryExcept
00812         {
00813         NdrProxyInitialize(
00814                       ( void __RPC_FAR *  )This,
00815                       ( PRPC_MESSAGE  )&_RpcMessage,
00816                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00817                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00818                       7);
00819
00820
00821
00822         if(!sFilenames)
00823             {
00824             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00825             }
00826         RpcTryFinally
00827             {
00828
00829             _StubMsg.BufferLength = 4U + 12U + 11U + 7U;
00830             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00831                                            (unsigned char __RPC_FAR *)sFilenames,
00832                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00833
00834             NdrProxyGetBuffer(This, &_StubMsg);
00835             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00836
00837             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00838                                          (unsigned char __RPC_FAR *)sFilenames,
00839                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00840
00841             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00842             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bDirectories;
00843
00844             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bRecurse;
00845
00846             NdrProxySendReceive(This, &_StubMsg);
00847
00848             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00849                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
00850
00851             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00852
00853             }
00854         RpcFinally
00855             {
00856             NdrProxyFreeBuffer(This, &_StubMsg);
00857
00858             }
00859         RpcEndFinally
00860
00861         }
00862     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00863         {
00864         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00865         }
00866     RpcEndExcept
00867     return _RetVal;
00868 }
00869
00870 void __RPC_STUB ICvsCoworker_UpdateFiles_Stub(
00871     IRpcStubBuffer *This,
00872     IRpcChannelBuffer *_pRpcChannelBuffer,
00873     PRPC_MESSAGE _pRpcMessage,
00874     DWORD *_pdwStubPhase)
00875 {
00876     HRESULT _RetVal;
00877     MIDL_STUB_MESSAGE _StubMsg;
00878     BOOL bDirectories;
00879     BOOL bRecurse;
00880     int handle;
00881     const unsigned char __RPC_FAR *sFilenames;
00882
00883 NdrStubInitialize(
00884                      _pRpcMessage,
00885                      &_StubMsg,
00886                      &Object_StubDesc,
00887                      _pRpcChannelBuffer);
00888     ( unsigned char __RPC_FAR * )sFilenames = 0;
00889     RpcTryFinally
00890         {
00891         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00892             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
00893
00894         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00895
00896         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00897                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
00898                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00899                                        (unsigned char)0 );
00900
00901         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00902         bDirectories = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00903
00904         bRecurse = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00905
00906
00907         *_pdwStubPhase = STUB_CALL_SERVER;
00908         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> UpdateFiles(
00909                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00910                handle,
00911                sFilenames,
00912                bDirectories,
00913                bRecurse);
00914
00915         *_pdwStubPhase = STUB_MARSHAL;
00916
00917         _StubMsg.BufferLength = 4U;
00918         _StubMsg.BufferLength += 16;
00919
00920         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00921         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00922
00923         }
00924     RpcFinally
00925         {
00926         }
00927     RpcEndFinally
00928     _pRpcMessage->BufferLength =
00929         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00930
00931 }
00932
00933
00934 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckoutFiles_Proxy(
00935     ICvsCoworker __RPC_FAR * This,
00936     /* [in] */ int handle,
00937     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames)
00938 {
00939
00940     HRESULT _RetVal;
00941
00942     RPC_MESSAGE _RpcMessage;
00943
00944     MIDL_STUB_MESSAGE _StubMsg;
00945
00946     RpcTryExcept
00947         {
00948         NdrProxyInitialize(
00949                       ( void __RPC_FAR *  )This,
00950                       ( PRPC_MESSAGE  )&_RpcMessage,
00951                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00952                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00953                       8);
00954
00955
00956
00957         if(!sFilenames)
00958             {
00959             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00960             }
00961         RpcTryFinally
00962             {
00963
00964             _StubMsg.BufferLength = 4U + 12U;
00965             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00966                                            (unsigned char __RPC_FAR *)sFilenames,
00967                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00968
00969             NdrProxyGetBuffer(This, &_StubMsg);
00970             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00971
00972             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00973                                          (unsigned char __RPC_FAR *)sFilenames,
00974                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00975
00976             NdrProxySendReceive(This, &_StubMsg);
00977
00978             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00979                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
00980
00981             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00982
00983             }
00984         RpcFinally
00985             {
00986             NdrProxyFreeBuffer(This, &_StubMsg);
00987
00988             }
00989         RpcEndFinally
00990
00991         }
00992     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00993         {
00994         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00995         }
00996     RpcEndExcept
00997     return _RetVal;
00998 }
00999
01000 void __RPC_STUB ICvsCoworker_CheckoutFiles_Stub(
01001     IRpcStubBuffer *This,
01002     IRpcChannelBuffer *_pRpcChannelBuffer,
01003     PRPC_MESSAGE _pRpcMessage,
01004     DWORD *_pdwStubPhase)
01005 {
01006     HRESULT _RetVal;
01007     MIDL_STUB_MESSAGE _StubMsg;
01008     int handle;
01009     const unsigned char __RPC_FAR *sFilenames;
01010
01011 NdrStubInitialize(
01012                      _pRpcMessage,
01013                      &_StubMsg,
01014                      &Object_StubDesc,
01015                      _pRpcChannelBuffer);
01016     ( unsigned char __RPC_FAR * )sFilenames = 0;
01017     RpcTryFinally
01018         {
01019         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01020             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01021
01022         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01023
01024         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01025                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01026                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01027                                        (unsigned char)0 );
01028
01029
01030         *_pdwStubPhase = STUB_CALL_SERVER;
01031         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CheckoutFiles(
01032                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01033                  handle,
01034                  sFilenames);
01035
01036         *_pdwStubPhase = STUB_MARSHAL;
01037
01038         _StubMsg.BufferLength = 4U;
01039         _StubMsg.BufferLength += 16;
01040
01041         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01042         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01043
01044         }
01045     RpcFinally
01046         {
01047         }
01048     RpcEndFinally
01049     _pRpcMessage->BufferLength =
01050         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01051
01052 }
01053
01054
01055 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckinFiles_Proxy(
01056     ICvsCoworker __RPC_FAR * This,
01057     /* [in] */ int handle,
01058     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames,
01059     /* [in] */ BOOL bKeepCheckedOut)
01060 {
01061
01062     HRESULT _RetVal;
01063
01064     RPC_MESSAGE _RpcMessage;
01065
01066     MIDL_STUB_MESSAGE _StubMsg;
01067
01068     RpcTryExcept
01069         {
01070         NdrProxyInitialize(
01071                       ( void __RPC_FAR *  )This,
01072                       ( PRPC_MESSAGE  )&_RpcMessage,
01073                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01074                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01075                       9);
01076
01077
01078
01079         if(!sFilenames)
01080             {
01081             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01082             }
01083         RpcTryFinally
01084             {
01085
01086             _StubMsg.BufferLength = 4U + 12U + 11U;
01087             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01088                                            (unsigned char __RPC_FAR *)sFilenames,
01089                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01090
01091             NdrProxyGetBuffer(This, &_StubMsg);
01092             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01093
01094             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01095                                          (unsigned char __RPC_FAR *)sFilenames,
01096                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01097
01098             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01099             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bKeepCheckedOut;
01100
01101             NdrProxySendReceive(This, &_StubMsg);
01102
01103             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01104                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[88] );
01105
01106             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01107
01108             }
01109         RpcFinally
01110             {
01111             NdrProxyFreeBuffer(This, &_StubMsg);
01112
01113             }
01114         RpcEndFinally
01115
01116         }
01117     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01118         {
01119         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01120         }
01121     RpcEndExcept
01122     return _RetVal;
01123 }
01124
01125 void __RPC_STUB ICvsCoworker_CheckinFiles_Stub(
01126     IRpcStubBuffer *This,
01127     IRpcChannelBuffer *_pRpcChannelBuffer,
01128     PRPC_MESSAGE _pRpcMessage,
01129     DWORD *_pdwStubPhase)
01130 {
01131     HRESULT _RetVal;
01132     MIDL_STUB_MESSAGE _StubMsg;
01133     BOOL bKeepCheckedOut;
01134     int handle;
01135     const unsigned char __RPC_FAR *sFilenames;
01136
01137 NdrStubInitialize(
01138                      _pRpcMessage,
01139                      &_StubMsg,
01140                      &Object_StubDesc,
01141                      _pRpcChannelBuffer);
01142     ( unsigned char __RPC_FAR * )sFilenames = 0;
01143     RpcTryFinally
01144         {
01145         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01146             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[88] );
01147
01148         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01149
01150         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01151                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01152                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01153                                        (unsigned char)0 );
01154
01155         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01156         bKeepCheckedOut = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01157
01158
01159         *_pdwStubPhase = STUB_CALL_SERVER;
01160         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CheckinFiles(
01161                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01162                 handle,
01163                 sFilenames,
01164                 bKeepCheckedOut);
01165
01166         *_pdwStubPhase = STUB_MARSHAL;
01167
01168         _StubMsg.BufferLength = 4U;
01169         _StubMsg.BufferLength += 16;
01170
01171         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01172         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01173
01174         }
01175     RpcFinally
01176         {
01177         }
01178     RpcEndFinally
01179     _pRpcMessage->BufferLength =
01180         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01181
01182 }
01183
01184
01185 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_UncheckoutFiles_Proxy(
01186     ICvsCoworker __RPC_FAR * This,
01187     /* [in] */ int handle,
01188     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames)
01189 {
01190
01191     HRESULT _RetVal;
01192
01193     RPC_MESSAGE _RpcMessage;
01194
01195     MIDL_STUB_MESSAGE _StubMsg;
01196
01197     RpcTryExcept
01198         {
01199         NdrProxyInitialize(
01200                       ( void __RPC_FAR *  )This,
01201                       ( PRPC_MESSAGE  )&_RpcMessage,
01202                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01203                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01204                       10);
01205
01206
01207
01208         if(!sFilenames)
01209             {
01210             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01211             }
01212         RpcTryFinally
01213             {
01214
01215             _StubMsg.BufferLength = 4U + 12U;
01216             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01217                                            (unsigned char __RPC_FAR *)sFilenames,
01218                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01219
01220             NdrProxyGetBuffer(This, &_StubMsg);
01221             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01222
01223             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01224                                          (unsigned char __RPC_FAR *)sFilenames,
01225                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01226
01227             NdrProxySendReceive(This, &_StubMsg);
01228
01229             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01230                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01231
01232             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01233
01234             }
01235         RpcFinally
01236             {
01237             NdrProxyFreeBuffer(This, &_StubMsg);
01238
01239             }
01240         RpcEndFinally
01241
01242         }
01243     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01244         {
01245         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01246         }
01247     RpcEndExcept
01248     return _RetVal;
01249 }
01250
01251 void __RPC_STUB ICvsCoworker_UncheckoutFiles_Stub(
01252     IRpcStubBuffer *This,
01253     IRpcChannelBuffer *_pRpcChannelBuffer,
01254     PRPC_MESSAGE _pRpcMessage,
01255     DWORD *_pdwStubPhase)
01256 {
01257     HRESULT _RetVal;
01258     MIDL_STUB_MESSAGE _StubMsg;
01259     int handle;
01260     const unsigned char __RPC_FAR *sFilenames;
01261
01262 NdrStubInitialize(
01263                      _pRpcMessage,
01264                      &_StubMsg,
01265                      &Object_StubDesc,
01266                      _pRpcChannelBuffer);
01267     ( unsigned char __RPC_FAR * )sFilenames = 0;
01268     RpcTryFinally
01269         {
01270         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01271             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01272
01273         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01274
01275         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01276                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01277                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01278                                        (unsigned char)0 );
01279
01280
01281         *_pdwStubPhase = STUB_CALL_SERVER;
01282         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> UncheckoutFiles(
01283                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01284                    handle,
01285                    sFilenames);
01286
01287         *_pdwStubPhase = STUB_MARSHAL;
01288
01289         _StubMsg.BufferLength = 4U;
01290         _StubMsg.BufferLength += 16;
01291
01292         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01293         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01294
01295         }
01296     RpcFinally
01297         {
01298         }
01299     RpcEndFinally
01300     _pRpcMessage->BufferLength =
01301         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01302
01303 }
01304
01305
01306 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_AddFiles_Proxy(
01307     ICvsCoworker __RPC_FAR * This,
01308     /* [in] */ int handle,
01309     /* [string][in] */ const unsigned char __RPC_FAR *sOptionsAndFilenames,
01310     /* [string][in] */ const unsigned char __RPC_FAR *sComment)
01311 {
01312
01313     HRESULT _RetVal;
01314
01315     RPC_MESSAGE _RpcMessage;
01316
01317     MIDL_STUB_MESSAGE _StubMsg;
01318
01319     RpcTryExcept
01320         {
01321         NdrProxyInitialize(
01322                       ( void __RPC_FAR *  )This,
01323                       ( PRPC_MESSAGE  )&_RpcMessage,
01324                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01325                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01326                       11);
01327
01328
01329
01330         if(!sOptionsAndFilenames)
01331             {
01332             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01333             }
01334         if(!sComment)
01335             {
01336             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01337             }
01338         RpcTryFinally
01339             {
01340
01341             _StubMsg.BufferLength = 4U + 12U + 13U;
01342             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01343                                            (unsigned char __RPC_FAR *)sOptionsAndFilenames,
01344                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01345
01346             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01347                                            (unsigned char __RPC_FAR *)sComment,
01348                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01349
01350             NdrProxyGetBuffer(This, &_StubMsg);
01351             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01352
01353             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01354                                          (unsigned char __RPC_FAR *)sOptionsAndFilenames,
01355                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01356
01357             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01358                                          (unsigned char __RPC_FAR *)sComment,
01359                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01360
01361             NdrProxySendReceive(This, &_StubMsg);
01362
01363             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01364                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01365
01366             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01367
01368             }
01369         RpcFinally
01370             {
01371             NdrProxyFreeBuffer(This, &_StubMsg);
01372
01373             }
01374         RpcEndFinally
01375
01376         }
01377     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01378         {
01379         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01380         }
01381     RpcEndExcept
01382     return _RetVal;
01383 }
01384
01385 void __RPC_STUB ICvsCoworker_AddFiles_Stub(
01386     IRpcStubBuffer *This,
01387     IRpcChannelBuffer *_pRpcChannelBuffer,
01388     PRPC_MESSAGE _pRpcMessage,
01389     DWORD *_pdwStubPhase)
01390 {
01391     HRESULT _RetVal;
01392     MIDL_STUB_MESSAGE _StubMsg;
01393     int handle;
01394     const unsigned char __RPC_FAR *sComment;
01395     const unsigned char __RPC_FAR *sOptionsAndFilenames;
01396
01397 NdrStubInitialize(
01398                      _pRpcMessage,
01399                      &_StubMsg,
01400                      &Object_StubDesc,
01401                      _pRpcChannelBuffer);
01402     ( unsigned char __RPC_FAR * )sOptionsAndFilenames = 0;
01403     ( unsigned char __RPC_FAR * )sComment = 0;
01404     RpcTryFinally
01405         {
01406         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01407             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01408
01409         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01410
01411         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01412                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sOptionsAndFilenames,
01413                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01414                                        (unsigned char)0 );
01415
01416         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01417                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sComment,
01418                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01419                                        (unsigned char)0 );
01420
01421
01422         *_pdwStubPhase = STUB_CALL_SERVER;
01423         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> AddFiles(
01424             (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01425             handle,
01426             sOptionsAndFilenames,
01427             sComment);
01428
01429         *_pdwStubPhase = STUB_MARSHAL;
01430
01431         _StubMsg.BufferLength = 4U;
01432         _StubMsg.BufferLength += 16;
01433
01434         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01435         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01436
01437         }
01438     RpcFinally
01439         {
01440         }
01441     RpcEndFinally
01442     _pRpcMessage->BufferLength =
01443         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01444
01445 }
01446
01447
01448 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_RemoveFiles_Proxy(
01449     ICvsCoworker __RPC_FAR * This,
01450     /* [in] */ int handle,
01451     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames)
01452 {
01453
01454     HRESULT _RetVal;
01455
01456     RPC_MESSAGE _RpcMessage;
01457
01458     MIDL_STUB_MESSAGE _StubMsg;
01459
01460     RpcTryExcept
01461         {
01462         NdrProxyInitialize(
01463                       ( void __RPC_FAR *  )This,
01464                       ( PRPC_MESSAGE  )&_RpcMessage,
01465                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01466                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01467                       12);
01468
01469
01470
01471         if(!sFilenames)
01472             {
01473             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01474             }
01475         RpcTryFinally
01476             {
01477
01478             _StubMsg.BufferLength = 4U + 12U;
01479             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01480                                            (unsigned char __RPC_FAR *)sFilenames,
01481                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01482
01483             NdrProxyGetBuffer(This, &_StubMsg);
01484             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01485
01486             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01487                                          (unsigned char __RPC_FAR *)sFilenames,
01488                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01489
01490             NdrProxySendReceive(This, &_StubMsg);
01491
01492             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01493                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01494
01495             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01496
01497             }
01498         RpcFinally
01499             {
01500             NdrProxyFreeBuffer(This, &_StubMsg);
01501
01502             }
01503         RpcEndFinally
01504
01505         }
01506     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01507         {
01508         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01509         }
01510     RpcEndExcept
01511     return _RetVal;
01512 }
01513
01514 void __RPC_STUB ICvsCoworker_RemoveFiles_Stub(
01515     IRpcStubBuffer *This,
01516     IRpcChannelBuffer *_pRpcChannelBuffer,
01517     PRPC_MESSAGE _pRpcMessage,
01518     DWORD *_pdwStubPhase)
01519 {
01520     HRESULT _RetVal;
01521     MIDL_STUB_MESSAGE _StubMsg;
01522     int handle;
01523     const unsigned char __RPC_FAR *sFilenames;
01524
01525 NdrStubInitialize(
01526                      _pRpcMessage,
01527                      &_StubMsg,
01528                      &Object_StubDesc,
01529                      _pRpcChannelBuffer);
01530     ( unsigned char __RPC_FAR * )sFilenames = 0;
01531     RpcTryFinally
01532         {
01533         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01534             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01535
01536         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01537
01538         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01539                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01540                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01541                                        (unsigned char)0 );
01542
01543
01544         *_pdwStubPhase = STUB_CALL_SERVER;
01545         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> RemoveFiles(
01546                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01547                handle,
01548                sFilenames);
01549
01550         *_pdwStubPhase = STUB_MARSHAL;
01551
01552         _StubMsg.BufferLength = 4U;
01553         _StubMsg.BufferLength += 16;
01554
01555         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01556         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01557
01558         }
01559     RpcFinally
01560         {
01561         }
01562     RpcEndFinally
01563     _pRpcMessage->BufferLength =
01564         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01565
01566 }
01567
01568
01569 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_RenameFile_Proxy(
01570     ICvsCoworker __RPC_FAR * This,
01571     /* [in] */ int handle,
01572     /* [string][in] */ const unsigned char __RPC_FAR *sOldFilename,
01573     /* [string][in] */ const unsigned char __RPC_FAR *sNewFilename)
01574 {
01575
01576     HRESULT _RetVal;
01577
01578     RPC_MESSAGE _RpcMessage;
01579
01580     MIDL_STUB_MESSAGE _StubMsg;
01581
01582     RpcTryExcept
01583         {
01584         NdrProxyInitialize(
01585                       ( void __RPC_FAR *  )This,
01586                       ( PRPC_MESSAGE  )&_RpcMessage,
01587                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01588                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01589                       13);
01590
01591
01592
01593         if(!sOldFilename)
01594             {
01595             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01596             }
01597         if(!sNewFilename)
01598             {
01599             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01600             }
01601         RpcTryFinally
01602             {
01603
01604             _StubMsg.BufferLength = 4U + 12U + 13U;
01605             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01606                                            (unsigned char __RPC_FAR *)sOldFilename,
01607                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01608
01609             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01610                                            (unsigned char __RPC_FAR *)sNewFilename,
01611                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01612
01613             NdrProxyGetBuffer(This, &_StubMsg);
01614             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01615
01616             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01617                                          (unsigned char __RPC_FAR *)sOldFilename,
01618                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01619
01620             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01621                                          (unsigned char __RPC_FAR *)sNewFilename,
01622                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01623
01624             NdrProxySendReceive(This, &_StubMsg);
01625
01626             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01627                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01628
01629             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01630
01631             }
01632         RpcFinally
01633             {
01634             NdrProxyFreeBuffer(This, &_StubMsg);
01635
01636             }
01637         RpcEndFinally
01638
01639         }
01640     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01641         {
01642         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01643         }
01644     RpcEndExcept
01645     return _RetVal;
01646 }
01647
01648 void __RPC_STUB ICvsCoworker_RenameFile_Stub(
01649     IRpcStubBuffer *This,
01650     IRpcChannelBuffer *_pRpcChannelBuffer,
01651     PRPC_MESSAGE _pRpcMessage,
01652     DWORD *_pdwStubPhase)
01653 {
01654     HRESULT _RetVal;
01655     MIDL_STUB_MESSAGE _StubMsg;
01656     int handle;
01657     const unsigned char __RPC_FAR *sNewFilename;
01658     const unsigned char __RPC_FAR *sOldFilename;
01659
01660 NdrStubInitialize(
01661                      _pRpcMessage,
01662                      &_StubMsg,
01663                      &Object_StubDesc,
01664                      _pRpcChannelBuffer);
01665     ( unsigned char __RPC_FAR * )sOldFilename = 0;
01666     ( unsigned char __RPC_FAR * )sNewFilename = 0;
01667     RpcTryFinally
01668         {
01669         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01670             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01671
01672         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01673
01674         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01675                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sOldFilename,
01676                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01677                                        (unsigned char)0 );
01678
01679         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01680                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sNewFilename,
01681                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01682                                        (unsigned char)0 );
01683
01684
01685         *_pdwStubPhase = STUB_CALL_SERVER;
01686         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> RenameFile(
01687               (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01688               handle,
01689               sOldFilename,
01690               sNewFilename);
01691
01692         *_pdwStubPhase = STUB_MARSHAL;
01693
01694         _StubMsg.BufferLength = 4U;
01695         _StubMsg.BufferLength += 16;
01696
01697         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01698         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01699
01700         }
01701     RpcFinally
01702         {
01703         }
01704     RpcEndFinally
01705     _pRpcMessage->BufferLength =
01706         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01707
01708 }
01709
01710
01711 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_DiffFile_Proxy(
01712     ICvsCoworker __RPC_FAR * This,
01713     /* [in] */ int handle,
01714     /* [string][in] */ const unsigned char __RPC_FAR *sFilename,
01715     /* [in] */ BOOL bIgnoreCase,
01716     /* [in] */ BOOL bIgnoreBlanks)
01717 {
01718
01719     HRESULT _RetVal;
01720
01721     RPC_MESSAGE _RpcMessage;
01722
01723     MIDL_STUB_MESSAGE _StubMsg;
01724
01725     RpcTryExcept
01726         {
01727         NdrProxyInitialize(
01728                       ( void __RPC_FAR *  )This,
01729                       ( PRPC_MESSAGE  )&_RpcMessage,
01730                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01731                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01732                       14);
01733
01734
01735
01736         if(!sFilename)
01737             {
01738             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01739             }
01740         RpcTryFinally
01741             {
01742
01743             _StubMsg.BufferLength = 4U + 12U + 11U + 7U;
01744             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01745                                            (unsigned char __RPC_FAR *)sFilename,
01746                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01747
01748             NdrProxyGetBuffer(This, &_StubMsg);
01749             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01750
01751             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01752                                          (unsigned char __RPC_FAR *)sFilename,
01753                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01754
01755             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01756             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bIgnoreCase;
01757
01758             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bIgnoreBlanks;
01759
01760             NdrProxySendReceive(This, &_StubMsg);
01761
01762             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01763                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
01764
01765             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01766
01767             }
01768         RpcFinally
01769             {
01770             NdrProxyFreeBuffer(This, &_StubMsg);
01771
01772             }
01773         RpcEndFinally
01774
01775         }
01776     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01777         {
01778         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01779         }
01780     RpcEndExcept
01781     return _RetVal;
01782 }
01783
01784 void __RPC_STUB ICvsCoworker_DiffFile_Stub(
01785     IRpcStubBuffer *This,
01786     IRpcChannelBuffer *_pRpcChannelBuffer,
01787     PRPC_MESSAGE _pRpcMessage,
01788     DWORD *_pdwStubPhase)
01789 {
01790     HRESULT _RetVal;
01791     MIDL_STUB_MESSAGE _StubMsg;
01792     BOOL bIgnoreBlanks;
01793     BOOL bIgnoreCase;
01794     int handle;
01795     const unsigned char __RPC_FAR *sFilename;
01796
01797 NdrStubInitialize(
01798                      _pRpcMessage,
01799                      &_StubMsg,
01800                      &Object_StubDesc,
01801                      _pRpcChannelBuffer);
01802     ( unsigned char __RPC_FAR * )sFilename = 0;
01803     RpcTryFinally
01804         {
01805         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01806             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
01807
01808         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01809
01810         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01811                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilename,
01812                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01813                                        (unsigned char)0 );
01814
01815         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01816         bIgnoreCase = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01817
01818         bIgnoreBlanks = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01819
01820
01821         *_pdwStubPhase = STUB_CALL_SERVER;
01822         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> DiffFile(
01823             (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01824             handle,
01825             sFilename,
01826             bIgnoreCase,
01827             bIgnoreBlanks);
01828
01829         *_pdwStubPhase = STUB_MARSHAL;
01830
01831         _StubMsg.BufferLength = 4U;
01832         _StubMsg.BufferLength += 16;
01833
01834         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01835         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01836
01837         }
01838     RpcFinally
01839         {
01840         }
01841     RpcEndFinally
01842     _pRpcMessage->BufferLength =
01843         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01844
01845 }
01846
01847
01848 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileHistory_Proxy(
01849     ICvsCoworker __RPC_FAR * This,
01850     /* [in] */ int handle,
01851     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames)
01852 {
01853
01854     HRESULT _RetVal;
01855
01856     RPC_MESSAGE _RpcMessage;
01857
01858     MIDL_STUB_MESSAGE _StubMsg;
01859
01860     RpcTryExcept
01861         {
01862         NdrProxyInitialize(
01863                       ( void __RPC_FAR *  )This,
01864                       ( PRPC_MESSAGE  )&_RpcMessage,
01865                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01866                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01867                       15);
01868
01869
01870
01871         if(!sFilenames)
01872             {
01873             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01874             }
01875         RpcTryFinally
01876             {
01877
01878             _StubMsg.BufferLength = 4U + 12U;
01879             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01880                                            (unsigned char __RPC_FAR *)sFilenames,
01881                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01882
01883             NdrProxyGetBuffer(This, &_StubMsg);
01884             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01885
01886             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01887                                          (unsigned char __RPC_FAR *)sFilenames,
01888                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01889
01890             NdrProxySendReceive(This, &_StubMsg);
01891
01892             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01893                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01894
01895             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01896
01897             }
01898         RpcFinally
01899             {
01900             NdrProxyFreeBuffer(This, &_StubMsg);
01901
01902             }
01903         RpcEndFinally
01904
01905         }
01906     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01907         {
01908         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01909         }
01910     RpcEndExcept
01911     return _RetVal;
01912 }
01913
01914 void __RPC_STUB ICvsCoworker_ShowFileHistory_Stub(
01915     IRpcStubBuffer *This,
01916     IRpcChannelBuffer *_pRpcChannelBuffer,
01917     PRPC_MESSAGE _pRpcMessage,
01918     DWORD *_pdwStubPhase)
01919 {
01920     HRESULT _RetVal;
01921     MIDL_STUB_MESSAGE _StubMsg;
01922     int handle;
01923     const unsigned char __RPC_FAR *sFilenames;
01924
01925 NdrStubInitialize(
01926                      _pRpcMessage,
01927                      &_StubMsg,
01928                      &Object_StubDesc,
01929                      _pRpcChannelBuffer);
01930     ( unsigned char __RPC_FAR * )sFilenames = 0;
01931     RpcTryFinally
01932         {
01933         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01934             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01935
01936         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01937
01938         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01939                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01940                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01941                                        (unsigned char)0 );
01942
01943
01944         *_pdwStubPhase = STUB_CALL_SERVER;
01945         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowFileHistory(
01946                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01947                    handle,
01948                    sFilenames);
01949
01950         *_pdwStubPhase = STUB_MARSHAL;
01951
01952         _StubMsg.BufferLength = 4U;
01953         _StubMsg.BufferLength += 16;
01954
01955         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01956         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01957
01958         }
01959     RpcFinally
01960         {
01961         }
01962     RpcEndFinally
01963     _pRpcMessage->BufferLength =
01964         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01965
01966 }
01967
01968
01969 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileProperties_Proxy(
01970     ICvsCoworker __RPC_FAR * This,
01971     /* [in] */ int handle,
01972     /* [string][in] */ const unsigned char __RPC_FAR *sFilename)
01973 {
01974
01975     HRESULT _RetVal;
01976
01977     RPC_MESSAGE _RpcMessage;
01978
01979     MIDL_STUB_MESSAGE _StubMsg;
01980
01981     RpcTryExcept
01982         {
01983         NdrProxyInitialize(
01984                       ( void __RPC_FAR *  )This,
01985                       ( PRPC_MESSAGE  )&_RpcMessage,
01986                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01987                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01988                       16);
01989
01990
01991
01992         if(!sFilename)
01993             {
01994             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01995             }
01996         RpcTryFinally
01997             {
01998
01999             _StubMsg.BufferLength = 4U + 12U;
02000             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02001                                            (unsigned char __RPC_FAR *)sFilename,
02002                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02003
02004             NdrProxyGetBuffer(This, &_StubMsg);
02005             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02006
02007             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02008                                          (unsigned char __RPC_FAR *)sFilename,
02009                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02010
02011             NdrProxySendReceive(This, &_StubMsg);
02012
02013             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02014                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02015
02016             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02017
02018             }
02019         RpcFinally
02020             {
02021             NdrProxyFreeBuffer(This, &_StubMsg);
02022
02023             }
02024         RpcEndFinally
02025
02026         }
02027     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02028         {
02029         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02030         }
02031     RpcEndExcept
02032     return _RetVal;
02033 }
02034
02035 void __RPC_STUB ICvsCoworker_ShowFileProperties_Stub(
02036     IRpcStubBuffer *This,
02037     IRpcChannelBuffer *_pRpcChannelBuffer,
02038     PRPC_MESSAGE _pRpcMessage,
02039     DWORD *_pdwStubPhase)
02040 {
02041     HRESULT _RetVal;
02042     MIDL_STUB_MESSAGE _StubMsg;
02043     int handle;
02044     const unsigned char __RPC_FAR *sFilename;
02045
02046 NdrStubInitialize(
02047                      _pRpcMessage,
02048                      &_StubMsg,
02049                      &Object_StubDesc,
02050                      _pRpcChannelBuffer);
02051     ( unsigned char __RPC_FAR * )sFilename = 0;
02052     RpcTryFinally
02053         {
02054         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02055             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02056
02057         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02058
02059         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02060                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilename,
02061                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
02062                                        (unsigned char)0 );
02063
02064
02065         *_pdwStubPhase = STUB_CALL_SERVER;
02066         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowFileProperties(
02067                       (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02068                       handle,
02069                       sFilename);
02070
02071         *_pdwStubPhase = STUB_MARSHAL;
02072
02073         _StubMsg.BufferLength = 4U;
02074         _StubMsg.BufferLength += 16;
02075
02076         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02077         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02078
02079         }
02080     RpcFinally
02081         {
02082         }
02083     RpcEndFinally
02084     _pRpcMessage->BufferLength =
02085         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02086
02087 }
02088
02089
02090 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowUserInterface_Proxy(
02091     ICvsCoworker __RPC_FAR * This,
02092     /* [in] */ int handle,
02093     /* [string][in] */ const unsigned char __RPC_FAR *sFilenames)
02094 {
02095
02096     HRESULT _RetVal;
02097
02098     RPC_MESSAGE _RpcMessage;
02099
02100     MIDL_STUB_MESSAGE _StubMsg;
02101
02102     RpcTryExcept
02103         {
02104         NdrProxyInitialize(
02105                       ( void __RPC_FAR *  )This,
02106                       ( PRPC_MESSAGE  )&_RpcMessage,
02107                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02108                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02109                       17);
02110
02111
02112
02113         if(!sFilenames)
02114             {
02115             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02116             }
02117         RpcTryFinally
02118             {
02119
02120             _StubMsg.BufferLength = 4U + 12U;
02121             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02122                                            (unsigned char __RPC_FAR *)sFilenames,
02123                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02124
02125             NdrProxyGetBuffer(This, &_StubMsg);
02126             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02127
02128             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02129                                          (unsigned char __RPC_FAR *)sFilenames,
02130                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02131
02132             NdrProxySendReceive(This, &_StubMsg);
02133
02134             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02135                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02136
02137             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02138
02139             }
02140         RpcFinally
02141             {
02142             NdrProxyFreeBuffer(This, &_StubMsg);
02143
02144             }
02145         RpcEndFinally
02146
02147         }
02148     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02149         {
02150         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02151         }
02152     RpcEndExcept
02153     return _RetVal;
02154 }
02155
02156 void __RPC_STUB ICvsCoworker_ShowUserInterface_Stub(
02157     IRpcStubBuffer *This,
02158     IRpcChannelBuffer *_pRpcChannelBuffer,
02159     PRPC_MESSAGE _pRpcMessage,
02160     DWORD *_pdwStubPhase)
02161 {
02162     HRESULT _RetVal;
02163     MIDL_STUB_MESSAGE _StubMsg;
02164     int handle;
02165     const unsigned char __RPC_FAR *sFilenames;
02166
02167 NdrStubInitialize(
02168                      _pRpcMessage,
02169                      &_StubMsg,
02170                      &Object_StubDesc,
02171                      _pRpcChannelBuffer);
02172     ( unsigned char __RPC_FAR * )sFilenames = 0;
02173     RpcTryFinally
02174         {
02175         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02176             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02177
02178         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02179
02180         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02181                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
02182                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
02183                                        (unsigned char)0 );
02184
02185
02186         *_pdwStubPhase = STUB_CALL_SERVER;
02187         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowUserInterface(
02188                      (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02189                      handle,
02190                      sFilenames);
02191
02192         *_pdwStubPhase = STUB_MARSHAL;
02193
02194         _StubMsg.BufferLength = 4U;
02195         _StubMsg.BufferLength += 16;
02196
02197         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02198         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02199
02200         }
02201     RpcFinally
02202         {
02203         }
02204     RpcEndFinally
02205     _pRpcMessage->BufferLength =
02206         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02207
02208 }
02209
02210
02211 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_HasAdvancedOptionsForCommand_Proxy(
02212     ICvsCoworker __RPC_FAR * This,
02213     /* [in] */ int handle,
02214     /* [in] */ CvsCommand command,
02215     /* [retval][out] */ BOOL __RPC_FAR *pbAdvancedOptions)
02216 {
02217
02218     HRESULT _RetVal;
02219
02220     RPC_MESSAGE _RpcMessage;
02221
02222     MIDL_STUB_MESSAGE _StubMsg;
02223
02224     RpcTryExcept
02225         {
02226         NdrProxyInitialize(
02227                       ( void __RPC_FAR *  )This,
02228                       ( PRPC_MESSAGE  )&_RpcMessage,
02229                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02230                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02231                       18);
02232
02233
02234
02235         if(!pbAdvancedOptions)
02236             {
02237             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02238             }
02239         RpcTryFinally
02240             {
02241
02242             _StubMsg.BufferLength = 4U + 2U;
02243             NdrProxyGetBuffer(This, &_StubMsg);
02244             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02245
02246             NdrSimpleTypeMarshall(
02247                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02248                          ( unsigned char __RPC_FAR * )&command,
02249                          13);
02250             NdrProxySendReceive(This, &_StubMsg);
02251
02252             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02253                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[110] );
02254
02255             *pbAdvancedOptions = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
02256
02257             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02258
02259             }
02260         RpcFinally
02261             {
02262             NdrProxyFreeBuffer(This, &_StubMsg);
02263
02264             }
02265         RpcEndFinally
02266
02267         }
02268     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02269         {
02270         NdrClearOutParameters(
02271                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02272                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
02273                          ( void __RPC_FAR * )pbAdvancedOptions);
02274         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02275         }
02276     RpcEndExcept
02277     return _RetVal;
02278 }
02279
02280 void __RPC_STUB ICvsCoworker_HasAdvancedOptionsForCommand_Stub(
02281     IRpcStubBuffer *This,
02282     IRpcChannelBuffer *_pRpcChannelBuffer,
02283     PRPC_MESSAGE _pRpcMessage,
02284     DWORD *_pdwStubPhase)
02285 {
02286     BOOL _M42;
02287     HRESULT _RetVal;
02288     MIDL_STUB_MESSAGE _StubMsg;
02289     CvsCommand command;
02290     int handle;
02291     BOOL __RPC_FAR *pbAdvancedOptions;
02292
02293 NdrStubInitialize(
02294                      _pRpcMessage,
02295                      &_StubMsg,
02296                      &Object_StubDesc,
02297                      _pRpcChannelBuffer);
02298     ( BOOL __RPC_FAR * )pbAdvancedOptions = 0;
02299     RpcTryFinally
02300         {
02301         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02302             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[110] );
02303
02304         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02305
02306         NdrSimpleTypeUnmarshall(
02307                            ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02308                            ( unsigned char __RPC_FAR * )&command,
02309                            13);
02310         pbAdvancedOptions = &_M42;
02311
02312         *_pdwStubPhase = STUB_CALL_SERVER;
02313         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> HasAdvancedOptionsForCommand(
02314                                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02315                                 handle,
02316                                 command,
02317                                 pbAdvancedOptions);
02318
02319         *_pdwStubPhase = STUB_MARSHAL;
02320
02321         _StubMsg.BufferLength = 4U + 4U;
02322         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02323         *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = *pbAdvancedOptions;
02324
02325         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02326
02327         }
02328     RpcFinally
02329         {
02330         }
02331     RpcEndFinally
02332     _pRpcMessage->BufferLength =
02333         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02334
02335 }
02336
02337
02338 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy(
02339     ICvsCoworker __RPC_FAR * This,
02340     /* [in] */ int handle,
02341     /* [in] */ CvsCommand command)
02342 {
02343
02344     HRESULT _RetVal;
02345
02346     RPC_MESSAGE _RpcMessage;
02347
02348     MIDL_STUB_MESSAGE _StubMsg;
02349
02350     RpcTryExcept
02351         {
02352         NdrProxyInitialize(
02353                       ( void __RPC_FAR *  )This,
02354                       ( PRPC_MESSAGE  )&_RpcMessage,
02355                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02356                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02357                       19);
02358
02359
02360
02361         RpcTryFinally
02362             {
02363
02364             _StubMsg.BufferLength = 4U + 2U;
02365             NdrProxyGetBuffer(This, &_StubMsg);
02366             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02367
02368             NdrSimpleTypeMarshall(
02369                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02370                          ( unsigned char __RPC_FAR * )&command,
02371                          13);
02372             NdrProxySendReceive(This, &_StubMsg);
02373
02374             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02375                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[120] );
02376
02377             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02378
02379             }
02380         RpcFinally
02381             {
02382             NdrProxyFreeBuffer(This, &_StubMsg);
02383
02384             }
02385         RpcEndFinally
02386
02387         }
02388     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02389         {
02390         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02391         }
02392     RpcEndExcept
02393     return _RetVal;
02394 }
02395
02396 void __RPC_STUB ICvsCoworker_ShowAdvancedOptionsForCommand_Stub(
02397     IRpcStubBuffer *This,
02398     IRpcChannelBuffer *_pRpcChannelBuffer,
02399     PRPC_MESSAGE _pRpcMessage,
02400     DWORD *_pdwStubPhase)
02401 {
02402     HRESULT _RetVal;
02403     MIDL_STUB_MESSAGE _StubMsg;
02404     CvsCommand command;
02405     int handle;
02406
02407 NdrStubInitialize(
02408                      _pRpcMessage,
02409                      &_StubMsg,
02410                      &Object_StubDesc,
02411                      _pRpcChannelBuffer);
02412     RpcTryFinally
02413         {
02414         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02415             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[120] );
02416
02417         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02418
02419         NdrSimpleTypeUnmarshall(
02420                            ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02421                            ( unsigned char __RPC_FAR * )&command,
02422                            13);
02423
02424         *_pdwStubPhase = STUB_CALL_SERVER;
02425         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowAdvancedOptionsForCommand(
02426                                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02427                                  handle,
02428                                  command);
02429
02430         *_pdwStubPhase = STUB_MARSHAL;
02431
02432         _StubMsg.BufferLength = 4U;
02433         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02434         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02435
02436         }
02437     RpcFinally
02438         {
02439         }
02440     RpcEndFinally
02441     _pRpcMessage->BufferLength =
02442         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02443
02444 }
02445
02446
02447 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFileChanges_Proxy(
02448     ICvsCoworker __RPC_FAR * This,
02449     /* [in] */ int handle,
02450     /* [in] */ int cbFilenameBuffer,
02451     /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenameBuffer)
02452 {
02453
02454     HRESULT _RetVal;
02455
02456     RPC_MESSAGE _RpcMessage;
02457
02458     MIDL_STUB_MESSAGE _StubMsg;
02459
02460     RpcTryExcept
02461         {
02462         NdrProxyInitialize(
02463                       ( void __RPC_FAR *  )This,
02464                       ( PRPC_MESSAGE  )&_RpcMessage,
02465                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02466                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02467                       20);
02468
02469
02470
02471         if(!sFilenameBuffer)
02472             {
02473             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02474             }
02475         RpcTryFinally
02476             {
02477
02478             _StubMsg.BufferLength = 4U + 4U;
02479             NdrProxyGetBuffer(This, &_StubMsg);
02480             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02481
02482             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbFilenameBuffer;
02483
02484             NdrProxySendReceive(This, &_StubMsg);
02485
02486             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02487                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[126] );
02488
02489             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02490                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenameBuffer,
02491                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48],
02492                                            (unsigned char)0 );
02493
02494             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02495             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02496
02497             }
02498         RpcFinally
02499             {
02500             NdrProxyFreeBuffer(This, &_StubMsg);
02501
02502             }
02503         RpcEndFinally
02504
02505         }
02506     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02507         {
02508         _StubMsg.MaxCount = cbFilenameBuffer;
02509
02510         NdrClearOutParameters(
02511                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02512                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[44],
02513                          ( void __RPC_FAR * )sFilenameBuffer);
02514         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02515         }
02516     RpcEndExcept
02517     return _RetVal;
02518 }
02519
02520 void __RPC_STUB ICvsCoworker_GetFileChanges_Stub(
02521     IRpcStubBuffer *This,
02522     IRpcChannelBuffer *_pRpcChannelBuffer,
02523     PRPC_MESSAGE _pRpcMessage,
02524     DWORD *_pdwStubPhase)
02525 {
02526     HRESULT _RetVal;
02527     MIDL_STUB_MESSAGE _StubMsg;
02528     int cbFilenameBuffer;
02529     int handle;
02530     unsigned char __RPC_FAR *sFilenameBuffer;
02531
02532 NdrStubInitialize(
02533                      _pRpcMessage,
02534                      &_StubMsg,
02535                      &Object_StubDesc,
02536                      _pRpcChannelBuffer);
02537     ( unsigned char __RPC_FAR * )sFilenameBuffer = 0;
02538     RpcTryFinally
02539         {
02540         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02541             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[126] );
02542
02543         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02544
02545         cbFilenameBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02546
02547         if(cbFilenameBuffer * 1 < 0)
02548             {
02549             RpcRaiseException(RPC_X_INVALID_BOUND);
02550             }
02551         sFilenameBuffer = NdrAllocate(&_StubMsg,cbFilenameBuffer * 1);
02552
02553         *_pdwStubPhase = STUB_CALL_SERVER;
02554         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetFileChanges(
02555                   (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02556                   handle,
02557                   cbFilenameBuffer,
02558                   sFilenameBuffer);
02559
02560         *_pdwStubPhase = STUB_MARSHAL;
02561
02562         _StubMsg.BufferLength = 12U + 11U;
02563         _StubMsg.MaxCount = cbFilenameBuffer;
02564
02565         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02566                                        (unsigned char __RPC_FAR *)sFilenameBuffer,
02567                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48] );
02568
02569         _StubMsg.BufferLength += 16;
02570
02571         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02572         _StubMsg.MaxCount = cbFilenameBuffer;
02573
02574         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02575                                      (unsigned char __RPC_FAR *)sFilenameBuffer,
02576                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48] );
02577
02578         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02579         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02580
02581         }
02582     RpcFinally
02583         {
02584         _StubMsg.MaxCount = cbFilenameBuffer;
02585
02586         NdrPointerFree( &_StubMsg,
02587                         (unsigned char __RPC_FAR *)sFilenameBuffer,
02588                         &__MIDL_TypeFormatString.Format[44] );
02589
02590         }
02591     RpcEndFinally
02592     _pRpcMessage->BufferLength =
02593         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02594
02595 }
02596
02597
02598 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFilesToAdd_Proxy(
02599     ICvsCoworker __RPC_FAR * This,
02600     /* [in] */ int handle,
02601     /* [in] */ int cbFilenamesBuffer,
02602     /* [size_is][string][out] */ unsigned char __RPC_FAR *sFilenamesBuffer)
02603 {
02604
02605     HRESULT _RetVal;
02606
02607     RPC_MESSAGE _RpcMessage;
02608
02609     MIDL_STUB_MESSAGE _StubMsg;
02610
02611     RpcTryExcept
02612         {
02613         NdrProxyInitialize(
02614                       ( void __RPC_FAR *  )This,
02615                       ( PRPC_MESSAGE  )&_RpcMessage,
02616                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02617                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02618                       21);
02619
02620
02621
02622         if(!sFilenamesBuffer)
02623             {
02624             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02625             }
02626         RpcTryFinally
02627             {
02628
02629             _StubMsg.BufferLength = 4U + 4U;
02630             NdrProxyGetBuffer(This, &_StubMsg);
02631             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02632
02633             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbFilenamesBuffer;
02634
02635             NdrProxySendReceive(This, &_StubMsg);
02636
02637             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02638                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[136] );
02639
02640             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02641                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenamesBuffer,
02642                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58],
02643                                            (unsigned char)0 );
02644
02645             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02646             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02647
02648             }
02649         RpcFinally
02650             {
02651             NdrProxyFreeBuffer(This, &_StubMsg);
02652
02653             }
02654         RpcEndFinally
02655
02656         }
02657     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02658         {
02659         _StubMsg.MaxCount = cbFilenamesBuffer;
02660
02661         NdrClearOutParameters(
02662                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02663                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[54],
02664                          ( void __RPC_FAR * )sFilenamesBuffer);
02665         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02666         }
02667     RpcEndExcept
02668     return _RetVal;
02669 }
02670
02671 void __RPC_STUB ICvsCoworker_GetFilesToAdd_Stub(
02672     IRpcStubBuffer *This,
02673     IRpcChannelBuffer *_pRpcChannelBuffer,
02674     PRPC_MESSAGE _pRpcMessage,
02675     DWORD *_pdwStubPhase)
02676 {
02677     HRESULT _RetVal;
02678     MIDL_STUB_MESSAGE _StubMsg;
02679     int cbFilenamesBuffer;
02680     int handle;
02681     unsigned char __RPC_FAR *sFilenamesBuffer;
02682
02683 NdrStubInitialize(
02684                      _pRpcMessage,
02685                      &_StubMsg,
02686                      &Object_StubDesc,
02687                      _pRpcChannelBuffer);
02688     ( unsigned char __RPC_FAR * )sFilenamesBuffer = 0;
02689     RpcTryFinally
02690         {
02691         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02692             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[136] );
02693
02694         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02695
02696         cbFilenamesBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02697
02698         if(cbFilenamesBuffer * 1 < 0)
02699             {
02700             RpcRaiseException(RPC_X_INVALID_BOUND);
02701             }
02702         sFilenamesBuffer = NdrAllocate(&_StubMsg,cbFilenamesBuffer * 1);
02703
02704         *_pdwStubPhase = STUB_CALL_SERVER;
02705         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetFilesToAdd(
02706                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02707                  handle,
02708                  cbFilenamesBuffer,
02709                  sFilenamesBuffer);
02710
02711         *_pdwStubPhase = STUB_MARSHAL;
02712
02713         _StubMsg.BufferLength = 12U + 11U;
02714         _StubMsg.MaxCount = cbFilenamesBuffer;
02715
02716         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02717                                        (unsigned char __RPC_FAR *)sFilenamesBuffer,
02718                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58] );
02719
02720         _StubMsg.BufferLength += 16;
02721
02722         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02723         _StubMsg.MaxCount = cbFilenamesBuffer;
02724
02725         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02726                                      (unsigned char __RPC_FAR *)sFilenamesBuffer,
02727                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58] );
02728
02729         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02730         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02731
02732         }
02733     RpcFinally
02734         {
02735         _StubMsg.MaxCount = cbFilenamesBuffer;
02736
02737         NdrPointerFree( &_StubMsg,
02738                         (unsigned char __RPC_FAR *)sFilenamesBuffer,
02739                         &__MIDL_TypeFormatString.Format[54] );
02740
02741         }
02742     RpcEndFinally
02743     _pRpcMessage->BufferLength =
02744         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02745
02746 }
02747
02748
02749 /* [helpstring] */ HRESULT STDMETHODCALLTYPE ICvsCoworker_CloseProject_Proxy(
02750     ICvsCoworker __RPC_FAR * This,
02751     /* [in] */ int handle)
02752 {
02753
02754     HRESULT _RetVal;
02755
02756     RPC_MESSAGE _RpcMessage;
02757
02758     MIDL_STUB_MESSAGE _StubMsg;
02759
02760     RpcTryExcept
02761         {
02762         NdrProxyInitialize(
02763                       ( void __RPC_FAR *  )This,
02764                       ( PRPC_MESSAGE  )&_RpcMessage,
02765                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02766                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02767                       22);
02768
02769
02770
02771         RpcTryFinally
02772             {
02773
02774             _StubMsg.BufferLength = 4U;
02775             NdrProxyGetBuffer(This, &_StubMsg);
02776             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02777
02778             NdrProxySendReceive(This, &_StubMsg);
02779
02780             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02781                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[146] );
02782
02783             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02784
02785             }
02786         RpcFinally
02787             {
02788             NdrProxyFreeBuffer(This, &_StubMsg);
02789
02790             }
02791         RpcEndFinally
02792
02793         }
02794     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02795         {
02796         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02797         }
02798     RpcEndExcept
02799     return _RetVal;
02800 }
02801
02802 void __RPC_STUB ICvsCoworker_CloseProject_Stub(
02803     IRpcStubBuffer *This,
02804     IRpcChannelBuffer *_pRpcChannelBuffer,
02805     PRPC_MESSAGE _pRpcMessage,
02806     DWORD *_pdwStubPhase)
02807 {
02808     HRESULT _RetVal;
02809     MIDL_STUB_MESSAGE _StubMsg;
02810     int handle;
02811
02812 NdrStubInitialize(
02813                      _pRpcMessage,
02814                      &_StubMsg,
02815                      &Object_StubDesc,
02816                      _pRpcChannelBuffer);
02817     RpcTryFinally
02818         {
02819         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02820             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[146] );
02821
02822         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02823
02824
02825         *_pdwStubPhase = STUB_CALL_SERVER;
02826         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CloseProject((ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,handle);
02827
02828         *_pdwStubPhase = STUB_MARSHAL;
02829
02830         _StubMsg.BufferLength = 4U;
02831         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02832         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02833
02834         }
02835     RpcFinally
02836         {
02837         }
02838     RpcEndFinally
02839     _pRpcMessage->BufferLength =
02840         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02841
02842 }
02843
02844
02845 static const MIDL_STUB_DESC Object_StubDesc =
02846     {
02847     0,
02848     NdrOleAllocate,
02849     NdrOleFree,
02850     0,
02851     0,
02852     0,
02853     0,
02854     0,
02855     __MIDL_TypeFormatString.Format,
02856     1, /* -error bounds_check flag */
02857     0x10001, /* Ndr library version */
02858     0,
02859     0x50100a4, /* MIDL Version 5.1.164 */
02860     0,
02861     0,
02862     0,  /* notify & notify_flag routine table */
02863     1,  /* Flags */
02864     0,  /* Reserved3 */
02865     0,  /* Reserved4 */
02866     0   /* Reserved5 */
02867     };
02868
02869 const CINTERFACE_PROXY_VTABLE(23) _ICvsCoworkerProxyVtbl =
02870 {
02871     &IID_ICvsCoworker,
02872     IUnknown_QueryInterface_Proxy,
02873     IUnknown_AddRef_Proxy,
02874     IUnknown_Release_Proxy ,
02875     ICvsCoworker_GetLastError_Proxy ,
02876     ICvsCoworker_GetErrorMessage_Proxy ,
02877     ICvsCoworker_OpenProject_Proxy ,
02878     ICvsCoworker_GetProject_Proxy ,
02879     ICvsCoworker_UpdateFiles_Proxy ,
02880     ICvsCoworker_CheckoutFiles_Proxy ,
02881     ICvsCoworker_CheckinFiles_Proxy ,
02882     ICvsCoworker_UncheckoutFiles_Proxy ,
02883     ICvsCoworker_AddFiles_Proxy ,
02884     ICvsCoworker_RemoveFiles_Proxy ,
02885     ICvsCoworker_RenameFile_Proxy ,
02886     ICvsCoworker_DiffFile_Proxy ,
02887     ICvsCoworker_ShowFileHistory_Proxy ,
02888     ICvsCoworker_ShowFileProperties_Proxy ,
02889     ICvsCoworker_ShowUserInterface_Proxy ,
02890     ICvsCoworker_HasAdvancedOptionsForCommand_Proxy ,
02891     ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy ,
02892     ICvsCoworker_GetFileChanges_Proxy ,
02893     ICvsCoworker_GetFilesToAdd_Proxy ,
02894     ICvsCoworker_CloseProject_Proxy
02895 };
02896
02897
02898 static const PRPC_STUB_FUNCTION ICvsCoworker_table[] =
02899 {
02900     ICvsCoworker_GetLastError_Stub,
02901     ICvsCoworker_GetErrorMessage_Stub,
02902     ICvsCoworker_OpenProject_Stub,
02903     ICvsCoworker_GetProject_Stub,
02904     ICvsCoworker_UpdateFiles_Stub,
02905     ICvsCoworker_CheckoutFiles_Stub,
02906     ICvsCoworker_CheckinFiles_Stub,
02907     ICvsCoworker_UncheckoutFiles_Stub,
02908     ICvsCoworker_AddFiles_Stub,
02909     ICvsCoworker_RemoveFiles_Stub,
02910     ICvsCoworker_RenameFile_Stub,
02911     ICvsCoworker_DiffFile_Stub,
02912     ICvsCoworker_ShowFileHistory_Stub,
02913     ICvsCoworker_ShowFileProperties_Stub,
02914     ICvsCoworker_ShowUserInterface_Stub,
02915     ICvsCoworker_HasAdvancedOptionsForCommand_Stub,
02916     ICvsCoworker_ShowAdvancedOptionsForCommand_Stub,
02917     ICvsCoworker_GetFileChanges_Stub,
02918     ICvsCoworker_GetFilesToAdd_Stub,
02919     ICvsCoworker_CloseProject_Stub
02920 };
02921
02922 const CInterfaceStubVtbl _ICvsCoworkerStubVtbl =
02923 {
02924     &IID_ICvsCoworker,
02925     0,
02926     23,
02927     &ICvsCoworker_table[-3],
02928     CStdStubBuffer_METHODS
02929 };
02930
02931 #pragma data_seg(".rdata")
02932
02933 #if !defined(__RPC_WIN32__)
02934 #error  Invalid build platform for this stub.
02935 #endif
02936
02937 static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =
02938     {
02939         0,
02940         {
02941             0x4e,       /* FC_IN_PARAM_BASETYPE */
02942             0x8,        /* FC_LONG */
02943 /*  2 */
02944             0x51,       /* FC_OUT_PARAM */
02945 #ifndef _ALPHA_
02946             0x1,        /* x86, MIPS & PPC Stack size = 1 */
02947 #else
02948             0x2,        /* Alpha Stack size = 2 */
02949 #endif
02950 /*  4 */    NdrFcShort( 0x2 ),  /* Type Offset=2 */
02951 /*  6 */    0x53,       /* FC_RETURN_PARAM_BASETYPE */
02952             0x8,        /* FC_LONG */
02953 /*  8 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
02954             0x8,        /* FC_LONG */
02955 /* 10 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
02956             0x8,        /* FC_LONG */
02957 /* 12 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
02958             0x8,        /* FC_LONG */
02959 /* 14 */
02960             0x51,       /* FC_OUT_PARAM */
02961 #ifndef _ALPHA_
02962             0x1,        /* x86, MIPS & PPC Stack size = 1 */
02963 #else
02964             0x2,        /* Alpha Stack size = 2 */
02965 #endif
02966 /* 16 */    NdrFcShort( 0x6 ),  /* Type Offset=6 */
02967 /* 18 */    0x53,       /* FC_RETURN_PARAM_BASETYPE */
02968             0x8,        /* FC_LONG */
02969 /* 20 */
02970             0x51,       /* FC_OUT_PARAM */
02971 #ifndef _ALPHA_
02972             0x1,        /* x86, MIPS & PPC Stack size = 1 */
02973 #else
02974             0x2,        /* Alpha Stack size = 2 */
02975 #endif
02976 /* 22 */    NdrFcShort( 0x2 ),  /* Type Offset=2 */
02977 /* 24 */
02978             0x4d,       /* FC_IN_PARAM */
02979 #ifndef _ALPHA_
02980             0x1,        /* x86, MIPS & PPC Stack size = 1 */
02981 #else
02982             0x2,        /* Alpha Stack size = 2 */
02983 #endif
02984 /* 26 */    NdrFcShort( 0x10 ), /* Type Offset=16 */
02985 /* 28 */
02986             0x4d,       /* FC_IN_PARAM */
02987 #ifndef _ALPHA_
02988             0x1,        /* x86, MIPS & PPC Stack size = 1 */
02989 #else
02990             0x2,        /* Alpha Stack size = 2 */
02991 #endif
02992 /* 30 */    NdrFcShort( 0x10 ), /* Type Offset=16 */
02993 /* 32 */
02994             0x4d,       /* FC_IN_PARAM */
02995 #ifndef _ALPHA_
02996             0x1,        /* x86, MIPS & PPC Stack size = 1 */
02997 #else
02998             0x2,        /* Alpha Stack size = 2 */
02999 #endif
03000 /* 34 */    NdrFcShort( 0x10 ), /* Type Offset=16 */
03001 /* 36 */    0x53,       /* FC_RETURN_PARAM_BASETYPE */
03002             0x8,        /* FC_LONG */
03003 /* 38 */
03004             0x51,       /* FC_OUT_PARAM */
03005 #ifndef _ALPHA_
03006             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03007 #else
03008             0x2,        /* Alpha Stack size = 2 */
03009 #endif
03010 /* 40 */    NdrFcShort( 0x2 ),  /* Type Offset=2 */
03011 /* 42 */
03012             0x4d,       /* FC_IN_PARAM */
03013 #ifndef _ALPHA_
03014             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03015 #else
03016             0x2,        /* Alpha Stack size = 2 */
03017 #endif
03018 /* 44 */    NdrFcShort( 0x14 ), /* Type Offset=20 */
03019 /* 46 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
03020             0x8,        /* FC_LONG */
03021 /* 48 */
03022             0x50,       /* FC_IN_OUT_PARAM */
03023 #ifndef _ALPHA_
03024             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03025 #else
03026             0x2,        /* Alpha Stack size = 2 */
03027 #endif
03028 /* 50 */    NdrFcShort( 0x18 ), /* Type Offset=24 */
03029 /* 52 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
03030             0x8,        /* FC_LONG */
03031 /* 54 */
03032             0x50,       /* FC_IN_OUT_PARAM */
03033 #ifndef _ALPHA_
03034             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03035 #else
03036             0x2,        /* Alpha Stack size = 2 */
03037 #endif
03038 /* 56 */    NdrFcShort( 0x22 ), /* Type Offset=34 */
03039 /* 58 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
03040             0x8,        /* FC_LONG */
03041 /* 60 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
03042             0x8,        /* FC_LONG */
03043 /* 62 */
03044             0x51,       /* FC_OUT_PARAM */
03045 #ifndef _ALPHA_
03046             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03047 #else
03048             0x2,        /* Alpha Stack size = 2 */
03049 #endif
03050 /* 64 */    NdrFcShort( 0x2 ),  /* Type Offset=2 */
03051 /* 66 */    0x53,       /* FC_RETURN_PARAM_BASETYPE */
03052             0x8,        /* FC_LONG */
03053 /* 68 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
03054             0x8,        /* FC_LONG */
03055 /* 70 */
03056             0x4d,       /* FC_IN_PARAM */
03057 #ifndef _ALPHA_
03058             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03059 #else
03060             0x2,        /* Alpha Stack size = 2 */
03061 #endif
03062 /* 72 */    NdrFcShort( 0x10 ), /* Type Offset=16 */
03063 /* 74 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
03064             0x8,        /* FC_LONG */
03065 /* 76 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
03066             0x8,        /* FC_LONG */
03067 /* 78 */    0x53,       /* FC_RETURN_PARAM_BASETYPE */
03068             0x8,        /* FC_LONG */
03069 /* 80 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
03070             0x8,        /* FC_LONG */
03071 /* 82 */
03072             0x4d,       /* FC_IN_PARAM */
03073 #ifndef _ALPHA_
03074             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03075 #else
03076             0x2,        /* Alpha Stack size = 2 */
03077 #endif
03078 /* 84 */    NdrFcShort( 0x10 ), /* Type Offset=16 */
03079 /* 86 */    0x53,       /* FC_RETURN_PARAM_BASETYPE */
03080             0x8,        /* FC_LONG */
03081 /* 88 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
03082             0x8,        /* FC_LONG */
03083 /* 90 */
03084             0x4d,       /* FC_IN_PARAM */
03085 #ifndef _ALPHA_
03086             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03087 #else
03088             0x2,        /* Alpha Stack size = 2 */
03089 #endif
03090 /* 92 */    NdrFcShort( 0x10 ), /* Type Offset=16 */
03091 /* 94 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
03092             0x8,        /* FC_LONG */
03093 /* 96 */    0x53,       /* FC_RETURN_PARAM_BASETYPE */
03094             0x8,        /* FC_LONG */
03095 /* 98 */    0x4e,       /* FC_IN_PARAM_BASETYPE */
03096             0x8,        /* FC_LONG */
03097 /* 100 */
03098             0x4d,       /* FC_IN_PARAM */
03099 #ifndef _ALPHA_
03100             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03101 #else
03102             0x2,        /* Alpha Stack size = 2 */
03103 #endif
03104 /* 102 */   NdrFcShort( 0x10 ), /* Type Offset=16 */
03105 /* 104 */
03106             0x4d,       /* FC_IN_PARAM */
03107 #ifndef _ALPHA_
03108             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03109 #else
03110             0x2,        /* Alpha Stack size = 2 */
03111 #endif
03112 /* 106 */   NdrFcShort( 0x10 ), /* Type Offset=16 */
03113 /* 108 */   0x53,       /* FC_RETURN_PARAM_BASETYPE */
03114             0x8,        /* FC_LONG */
03115 /* 110 */   0x4e,       /* FC_IN_PARAM_BASETYPE */
03116             0x8,        /* FC_LONG */
03117 /* 112 */   0x4e,       /* FC_IN_PARAM_BASETYPE */
03118             0xd,        /* FC_ENUM16 */
03119 /* 114 */
03120             0x51,       /* FC_OUT_PARAM */
03121 #ifndef _ALPHA_
03122             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03123 #else
03124             0x2,        /* Alpha Stack size = 2 */
03125 #endif
03126 /* 116 */   NdrFcShort( 0x2 ),  /* Type Offset=2 */
03127 /* 118 */   0x53,       /* FC_RETURN_PARAM_BASETYPE */
03128             0x8,        /* FC_LONG */
03129 /* 120 */   0x4e,       /* FC_IN_PARAM_BASETYPE */
03130             0x8,        /* FC_LONG */
03131 /* 122 */   0x4e,       /* FC_IN_PARAM_BASETYPE */
03132             0xd,        /* FC_ENUM16 */
03133 /* 124 */   0x53,       /* FC_RETURN_PARAM_BASETYPE */
03134             0x8,        /* FC_LONG */
03135 /* 126 */   0x4e,       /* FC_IN_PARAM_BASETYPE */
03136             0x8,        /* FC_LONG */
03137 /* 128 */   0x4e,       /* FC_IN_PARAM_BASETYPE */
03138             0x8,        /* FC_LONG */
03139 /* 130 */
03140             0x51,       /* FC_OUT_PARAM */
03141 #ifndef _ALPHA_
03142             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03143 #else
03144             0x2,        /* Alpha Stack size = 2 */
03145 #endif
03146 /* 132 */   NdrFcShort( 0x2c ), /* Type Offset=44 */
03147 /* 134 */   0x53,       /* FC_RETURN_PARAM_BASETYPE */
03148             0x8,        /* FC_LONG */
03149 /* 136 */   0x4e,       /* FC_IN_PARAM_BASETYPE */
03150             0x8,        /* FC_LONG */
03151 /* 138 */   0x4e,       /* FC_IN_PARAM_BASETYPE */
03152             0x8,        /* FC_LONG */
03153 /* 140 */
03154             0x51,       /* FC_OUT_PARAM */
03155 #ifndef _ALPHA_
03156             0x1,        /* x86, MIPS & PPC Stack size = 1 */
03157 #else
03158             0x2,        /* Alpha Stack size = 2 */
03159 #endif
03160 /* 142 */   NdrFcShort( 0x36 ), /* Type Offset=54 */
03161 /* 144 */   0x53,       /* FC_RETURN_PARAM_BASETYPE */
03162             0x8,        /* FC_LONG */
03163 /* 146 */   0x4e,       /* FC_IN_PARAM_BASETYPE */
03164             0x8,        /* FC_LONG */
03165 /* 148 */   0x53,       /* FC_RETURN_PARAM_BASETYPE */
03166             0x8,        /* FC_LONG */
03167
03168             0x0
03169         }
03170     };
03171
03172 static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =
03173     {
03174         0,
03175         {
03176             NdrFcShort( 0x0 ),  /* 0 */
03177 /*  2 */
03178             0x11, 0xc,  /* FC_RP [alloced_on_stack] [simple_pointer] */
03179 /*  4 */    0x8,        /* FC_LONG */
03180             0x5c,       /* FC_PAD */
03181 /*  6 */
03182             0x11, 0x0,  /* FC_RP */
03183 /*  8 */    NdrFcShort( 0x2 ),  /* Offset= 2 (10) */
03184 /* 10 */
03185             0x22,       /* FC_C_CSTRING */
03186             0x44,       /* FC_STRING_SIZED */
03187 /* 12 */    0x28,       /* Corr desc:  parameter, FC_LONG */
03188             0x0,        /*  */
03189 #ifndef _ALPHA_
03190 /* 14 */    NdrFcShort( 0xc ),  /* x86, MIPS, PPC Stack size/offset = 12 */
03191 #else
03192             NdrFcShort( 0x18 ), /* Alpha Stack size/offset = 24 */
03193 #endif
03194 /* 16 */
03195             0x11, 0x8,  /* FC_RP [simple_pointer] */
03196 /* 18 */
03197             0x22,       /* FC_C_CSTRING */
03198             0x5c,       /* FC_PAD */
03199 /* 20 */
03200             0x11, 0x8,  /* FC_RP [simple_pointer] */
03201 /* 22 */    0x2,        /* FC_CHAR */
03202             0x5c,       /* FC_PAD */
03203 /* 24 */
03204             0x11, 0x0,  /* FC_RP */
03205 /* 26 */    NdrFcShort( 0x2 ),  /* Offset= 2 (28) */
03206 /* 28 */
03207             0x22,       /* FC_C_CSTRING */
03208             0x44,       /* FC_STRING_SIZED */
03209 /* 30 */    0x28,       /* Corr desc:  parameter, FC_LONG */
03210             0x0,        /*  */
03211 #ifndef _ALPHA_
03212 /* 32 */    NdrFcShort( 0xc ),  /* x86, MIPS, PPC Stack size/offset = 12 */
03213 #else
03214             NdrFcShort( 0x18 ), /* Alpha Stack size/offset = 24 */
03215 #endif
03216 /* 34 */
03217             0x11, 0x0,  /* FC_RP */
03218 /* 36 */    NdrFcShort( 0x2 ),  /* Offset= 2 (38) */
03219 /* 38 */
03220             0x22,       /* FC_C_CSTRING */
03221             0x44,       /* FC_STRING_SIZED */
03222 /* 40 */    0x28,       /* Corr desc:  parameter, FC_LONG */
03223             0x0,        /*  */
03224 #ifndef _ALPHA_
03225 /* 42 */    NdrFcShort( 0x14 ), /* x86, MIPS, PPC Stack size/offset = 20 */
03226 #else
03227             NdrFcShort( 0x28 ), /* Alpha Stack size/offset = 40 */
03228 #endif
03229 /* 44 */
03230             0x11, 0x0,  /* FC_RP */
03231 /* 46 */    NdrFcShort( 0x2 ),  /* Offset= 2 (48) */
03232 /* 48 */
03233             0x22,       /* FC_C_CSTRING */
03234             0x44,       /* FC_STRING_SIZED */
03235 /* 50 */    0x28,       /* Corr desc:  parameter, FC_LONG */
03236             0x0,        /*  */
03237 #ifndef _ALPHA_
03238 /* 52 */    NdrFcShort( 0x8 ),  /* x86, MIPS, PPC Stack size/offset = 8 */
03239 #else
03240             NdrFcShort( 0x10 ), /* Alpha Stack size/offset = 16 */
03241 #endif
03242 /* 54 */
03243             0x11, 0x0,  /* FC_RP */
03244 /* 56 */    NdrFcShort( 0x2 ),  /* Offset= 2 (58) */
03245 /* 58 */
03246             0x22,       /* FC_C_CSTRING */
03247             0x44,       /* FC_STRING_SIZED */
03248 /* 60 */    0x28,       /* Corr desc:  parameter, FC_LONG */
03249             0x0,        /*  */
03250 #ifndef _ALPHA_
03251 /* 62 */    NdrFcShort( 0x8 ),  /* x86, MIPS, PPC Stack size/offset = 8 */
03252 #else
03253             NdrFcShort( 0x10 ), /* Alpha Stack size/offset = 16 */
03254 #endif
03255
03256             0x0
03257         }
03258     };
03259
03260 const CInterfaceProxyVtbl * _cvs_coworker_ProxyVtblList[] =
03261 {
03262     ( CInterfaceProxyVtbl *) &_ICvsCoworkerProxyVtbl,
03263     0
03264 };
03265
03266 const CInterfaceStubVtbl * _cvs_coworker_StubVtblList[] =
03267 {
03268     ( CInterfaceStubVtbl *) &_ICvsCoworkerStubVtbl,
03269     0
03270 };
03271
03272 PCInterfaceName const _cvs_coworker_InterfaceNamesList[] =
03273 {
03274     "ICvsCoworker",
03275     0
03276 };
03277
03278
03279 #define _cvs_coworker_CHECK_IID(n)  IID_GENERIC_CHECK_IID( _cvs_coworker, pIID, n)
03280
03281 int __stdcall _cvs_coworker_IID_Lookup( const IID * pIID, int * pIndex )
03282 {
03283
03284     if(!_cvs_coworker_CHECK_IID(0))
03285         {
03286         *pIndex = 0;
03287         return 1;
03288         }
03289
03290     return 0;
03291 }
03292
03293 const ExtendedProxyFileInfo cvs_coworker_ProxyFileInfo =
03294 {
03295     (PCInterfaceProxyVtblList *) & _cvs_coworker_ProxyVtblList,
03296     (PCInterfaceStubVtblList *) & _cvs_coworker_StubVtblList,
03297     (const PCInterfaceName * ) & _cvs_coworker_InterfaceNamesList,
03298     0, // no delegation
03299     & _cvs_coworker_IID_Lookup,
03300     1,
03301     1,
03302     0, /* table of [async_uuid] interfaces */
03303     0, /* Filler1 */
03304     0, /* Filler2 */
03305     0  /* Filler3 */
03306 };
Generated on Sun Oct 21 12:41:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CvsCoworker.cpp Source File

WinCvs/CoWorker/CvsCoworker.cpp

Go to the documentation of this file.
00001 //
00002 // CvsCoworker.cpp : Implementation of CvsCoworker
00003 //
00004 //  This module is mostly boilerplate: dispatching from a single instance
00005 //  handle-based interface to method calls on object based context.
00006 //  In other words, you are unlikely to want to change this file.
00007 //
00008
00009 #include "stdafx.h"
00010 #include "CVS_Coworker_i.h"
00011 #include "CvsTrace.h"
00012 #include "CvsCoworkerErrors.h"
00013 #include "CvsCoworker.h"
00014 #include "CvsProject.h"
00015 #include "CvsFilenames.h"
00016
00017 //
00018 //  Common bit of code,
00019 //
00020
00021 #ifdef NDEBUG
00022 #define CATCH_EXCEPTIONS(FN) \
00023 catch (...) {} return S_FALSE;
00024 #else
00025 #define CATCH_EXCEPTIONS(FN) \
00026 catch (const char* e) { qTRACE(("*EXCEPTION from " #FN "() : %s",e)); } \
00027 catch (...) { qTRACE(("*EXCEPTION from " #FN "()")); } return S_FALSE;
00028 #endif
00029
00030 //
00031 //  Copy a string into a fixed length buffer.
00032 //
00033
00034 static inline void CopyString(char* s1,const char* s2,int n)
00035 {
00036     ASSERT(s1);
00037     ASSERT(s2);
00038     ASSERT(0<n);
00039     strncpy(s1,s2,n);
00040     s1[n-1] = 0;
00041 }
00042
00043 static inline void CopyString(unsigned char* s1,const char* s2,int n)
00044 {
00045     CopyString((char*)s1,s2,n);
00046 }
00047
00049 // CvsCoworker
00050
00051 STDMETHODIMP CvsCoworker::InterfaceSupportsErrorInfo(REFIID riid)
00052 {
00053     qTRACE_FN(CvsCoworker::InterfaceSupportsErrorInfo);
00054     static const IID* arr[] = {
00055         &IID_ICvsCoworker,
00056         0
00057     };
00058     for (int i=0; arr[i]; ++i) {
00059         if (::ATL::InlineIsEqualGUID(*arr[i],riid)) {   //Jerzy[6/13/2001] - fix according to Q243298 at MSDN
00060             return S_OK;
00061         }
00062     }
00063     return S_FALSE;
00064 }
00065
00066 STDMETHODIMP CvsCoworker::GetLastError(
00067     int handle,
00068     int* piError
00069     )
00070 {
00071     ASSERT(piError);
00072     *piError = 0;
00073     CvsProject* pProject = CvsProject::FindProject(handle);
00074     if (!pProject) {
00075         return CVS_E_FAILED_PROJECT_INVALID;
00076     }
00077     *piError = pProject->getLastError();
00078     return S_OK;
00079 }
00080
00081 STDMETHODIMP CvsCoworker::GetErrorMessage(
00082     int handle,
00083     int iError,
00084     int cbErrorBuffer,
00085     unsigned char *sErrorBuffer
00086     )
00087 {
00088     LOG_API_FN(GetErrorMessage);
00089     LOG_API_N(iError);
00090     ASSERT(sErrorBuffer);
00091     ASSERT(0 < cbErrorBuffer);
00092     if (sErrorBuffer) {
00093         *sErrorBuffer = 0;
00094     }
00095     CvsProject* pProject = CvsProject::FindProject(handle);
00096     if (!pProject) {
00097         return CVS_E_FAILED_PROJECT_INVALID;
00098     }
00099     CvsString sError;
00100     if (!pProject->getErrorMessage(iError,sError)) {
00101         return S_FALSE;
00102     }
00103     CopyString(sErrorBuffer,sError,cbErrorBuffer);
00104     LOG_API_S(sErrorBuffer);
00105     return S_OK;
00106 }
00107
00108 STDMETHODIMP CvsCoworker::GetProject(
00109     int *pHandle,
00110     const unsigned char *sUsername,
00111     int cbProjectNameBuffer,
00112     unsigned char *sProjectNameBuffer,
00113     int cbProjectHomeBuffer,
00114     unsigned char *sProjectHomeBuffer,
00115     BOOL bAllowPathChange,
00116     BOOL bAllowNewProject,
00117     BOOL *pbNewProject
00118     )
00119 {
00120     LOG_API_FN(GetProject);
00121     LOG_API_S(sUsername);
00122     LOG_API_S(sProjectNameBuffer);
00123     LOG_API_S(sProjectHomeBuffer);
00124     LOG_API_N(bAllowPathChange);
00125     LOG_API_N(bAllowNewProject);
00126     ASSERT(pHandle);
00127     ASSERT(sUsername);
00128     ASSERT(0 < cbProjectNameBuffer);
00129     ASSERT(sProjectNameBuffer);
00130     ASSERT(0 < cbProjectHomeBuffer);
00131     ASSERT(sProjectHomeBuffer);
00132     ASSERT(pbNewProject);
00133     try {
00134         *pHandle = 0;
00135         *pbNewProject = false;
00136         CvsProject* pProject = new CvsProject;
00137         *pHandle = pProject->getProjectHandle();
00138         bool bOK = pProject->getProject(
00139             (char*)sUsername,
00140             (char*)sProjectNameBuffer,
00141             (char*)sProjectHomeBuffer,
00142             bAllowPathChange,
00143             bAllowNewProject,
00144             *pbNewProject
00145             );
00146         CopyString(sProjectNameBuffer,pProject->getProjectName(),cbProjectNameBuffer);
00147         CopyString(sProjectHomeBuffer,pProject->getProjectHome(),cbProjectHomeBuffer);
00148         LOG_API_N(bOK);
00149         LOG_API_S(sProjectNameBuffer);
00150         LOG_API_S(sProjectHomeBuffer);
00151         if (!bOK) {
00152             return CVS_E_FAILED_OPEN_PROJECT;
00153         }
00154         return S_OK;
00155     }
00156     CATCH_EXCEPTIONS(GetProject);
00157 }
00158
00159 STDMETHODIMP CvsCoworker::OpenProject(
00160     int* pHandle,
00161     const unsigned char *sUsername,
00162     const unsigned char *sProjectName,
00163     const unsigned char *sProjectHome
00164     )
00165 {
00166     LOG_API_FN(OpenProject);
00167     LOG_API_S(sUsername);
00168     LOG_API_S(sProjectName);
00169     LOG_API_S(sProjectHome);
00170     ASSERT(pHandle);
00171     ASSERT(sUsername);
00172     ASSERT(sProjectName);
00173     ASSERT(sProjectHome);
00174     try {
00175         *pHandle = 0;
00176         CvsProject* pProject = new CvsProject;
00177         *pHandle = pProject->getProjectHandle();
00178         bool bOK = pProject->openProject(
00179             (const char*)sUsername,
00180             (const char*)sProjectName,
00181             (const char*)sProjectHome
00182             );
00183         LOG_API_N(bOK);
00184         if (!bOK) {
00185             return CVS_E_FAILED_OPEN_PROJECT;
00186         }
00187         return S_OK;
00188     }
00189     CATCH_EXCEPTIONS(OpenProject);
00190 }
00191
00192 // Standard preamble for mapping a handle to an class instance.
00193 #define PREAMBLE(H) \
00194 CvsProject* pProject = CvsProject::FindProject(handle); \
00195 ASSERT(pProject); \
00196 if (!pProject) { return CVS_E_FAILED_PROJECT_INVALID; }
00197
00198 STDMETHODIMP CvsCoworker::CloseProject(
00199     int handle
00200     )
00201 {
00202     LOG_API_FN(CloseProject);
00203     PREAMBLE(handle);
00204     try {
00205         bool bOK = pProject->closeProject();
00206         LOG_API_N(bOK);
00207         if (!bOK) {
00208             return CVS_E_FAILED_CLOSE_PROJECT;
00209         }
00210         return S_OK;
00211     }
00212     CATCH_EXCEPTIONS(CloseProject);
00213 }
00214
00215 STDMETHODIMP CvsCoworker::UpdateFiles(
00216     int handle,
00217     const unsigned char *sFilenames,
00218     BOOL bDirectories,
00219     BOOL bRecurse
00220     )
00221 {
00222     LOG_API_FN(UpdateFiles);
00223     LOG_API_S(sFilenames);
00224     LOG_API_N(bDirectories);
00225     LOG_API_N(bRecurse);
00226     ASSERT(sFilenames);
00227     PREAMBLE(handle);
00228     try {
00229         bool bOK = pProject->updateFiles(
00230             CvsFilenames(sFilenames),
00231             bDirectories,
00232             bRecurse
00233             );
00234         LOG_API_N(bOK);
00235         if (!bOK) {
00236             return CVS_E_FAILED;
00237         }
00238         return S_OK;
00239     }
00240     CATCH_EXCEPTIONS(UpdateFiles);
00241 }
00242
00243 STDMETHODIMP CvsCoworker::CheckoutFiles(
00244     int handle,
00245     const unsigned char *sFilenames
00246     )
00247 {
00248     LOG_API_FN(CheckoutFiles);
00249     LOG_API_S(sFilenames);
00250     ASSERT(sFilenames);
00251     PREAMBLE(handle);
00252     try {
00253         bool bOK = pProject->checkoutFiles(
00254             CvsFilenames(sFilenames)
00255             );
00256         LOG_API_N(bOK);
00257         if (!bOK) {
00258             return CVS_E_FAILED;
00259         }
00260         return S_OK;
00261     }
00262     CATCH_EXCEPTIONS(CheckoutFiles);
00263 }
00264
00265 STDMETHODIMP CvsCoworker::CheckinFiles(
00266     int handle,
00267     const unsigned char *sFilenames,
00268     BOOL bKeepCheckedOut
00269     )
00270 {
00271     LOG_API_FN(CheckinFiles);
00272     LOG_API_S(sFilenames);
00273     LOG_API_N(bKeepCheckedOut);
00274     ASSERT(sFilenames);
00275     PREAMBLE(handle);
00276     try {
00277         bool bOK = pProject->checkinFiles(
00278             CvsFilenames(sFilenames),
00279             bKeepCheckedOut
00280             );
00281         LOG_API_N(bOK);
00282         if (!bOK) {
00283             return CVS_E_FAILED;
00284         }
00285         return S_OK;
00286     }
00287     CATCH_EXCEPTIONS(CheckinFiles);
00288 }
00289
00290 STDMETHODIMP CvsCoworker::UncheckoutFiles(
00291     int handle,
00292     const unsigned char *sFilenames
00293     )
00294 {
00295     LOG_API_FN(UncheckoutFiles);
00296     LOG_API_S(sFilenames);
00297     ASSERT(sFilenames);
00298     PREAMBLE(handle);
00299     try {
00300         bool bOK = pProject->uncheckoutFiles(
00301             CvsFilenames(sFilenames)
00302             );
00303         LOG_API_N(bOK);
00304         if (!bOK) {
00305             return CVS_E_FAILED;
00306         }
00307         return S_OK;
00308     }
00309     CATCH_EXCEPTIONS(UncheckoutFiles);
00310 }
00311
00312 STDMETHODIMP CvsCoworker::AddFiles(
00313     int handle,
00314     const unsigned char* sOptionsAndFilenames,
00315     const unsigned char* sComment
00316     )
00317 {
00318     LOG_API_FN(AddFiles);
00319     LOG_API_S(sOptionsAndFilenames);
00320     LOG_API_S(sComment);
00321     ASSERT(sOptionsAndFilenames);
00322     PREAMBLE(handle);
00323     try {
00324         bool bOK = pProject->addFiles(
00325             CvsFilenames(sOptionsAndFilenames),
00326             (const char*)sComment
00327             );
00328         LOG_API_N(bOK);
00329         if (!bOK) {
00330             return CVS_E_FAILED;
00331         }
00332         return S_OK;
00333     }
00334     CATCH_EXCEPTIONS(AddFiles);
00335 }
00336
00337 STDMETHODIMP CvsCoworker::RemoveFiles(
00338     int handle,
00339     const unsigned char *sFilenames
00340     )
00341 {
00342     LOG_API_FN(RemoveFiles);
00343     LOG_API_S(sFilenames);
00344     ASSERT(sFilenames);
00345     PREAMBLE(handle);
00346     try {
00347         bool bOK = pProject->removeFiles(
00348             CvsFilenames(sFilenames)
00349             );
00350         LOG_API_N(bOK);
00351         if (!bOK) {
00352             return CVS_E_FAILED;
00353         }
00354         return S_OK;
00355     }
00356     CATCH_EXCEPTIONS(RemoveFiles);
00357 }
00358
00359 STDMETHODIMP CvsCoworker::RenameFile(
00360     int handle,
00361     const unsigned char *sOldFilename,
00362     const unsigned char *sNewFilename
00363     )
00364 {
00365     LOG_API_FN(RenameFiles);
00366     LOG_API_S(sOldFilename);
00367     LOG_API_S(sNewFilename);
00368     ASSERT(sOldFilename);
00369     ASSERT(sNewFilename);
00370     PREAMBLE(handle);
00371     try {
00372         bool bOK = pProject->renameFile(
00373             (const char*)sOldFilename,
00374             (const char*)sNewFilename
00375             );
00376         LOG_API_N(bOK);
00377         if (!bOK) {
00378             return CVS_E_FAILED;
00379         }
00380         return S_OK;
00381     }
00382     CATCH_EXCEPTIONS(RenameFile);
00383 }
00384
00385 STDMETHODIMP CvsCoworker::DiffFile(
00386     int handle,
00387     const unsigned char *sFilename,
00388     BOOL bIgnoreCase,
00389     BOOL bIgnoreWhitespace
00390     )
00391 {
00392     LOG_API_FN(DiffFiles);
00393     LOG_API_S(sFilename);
00394     LOG_API_N(bIgnoreCase);
00395     LOG_API_N(bIgnoreWhitespace);
00396     ASSERT(sFilename);
00397     PREAMBLE(handle);
00398     try {
00399         bool bOK = pProject->diffFile(
00400             (const char*)sFilename,
00401             bIgnoreCase,
00402             bIgnoreWhitespace
00403             );
00404         LOG_API_N(bOK);
00405         if (!bOK) {
00406             return CVS_E_FAILED;
00407         }
00408         return S_OK;
00409     }
00410     CATCH_EXCEPTIONS(DiffFile);
00411 }
00412
00413 STDMETHODIMP CvsCoworker::ShowFileHistory(
00414     int handle,
00415     const unsigned char *sFilenames
00416     )
00417 {
00418     LOG_API_FN(ShowFileHistory);
00419     LOG_API_S(sFilenames);
00420     ASSERT(sFilenames);
00421     PREAMBLE(handle);
00422     try {
00423         bool bOK = pProject->showFileHistory(
00424             CvsFilenames(sFilenames)
00425             );
00426         LOG_API_N(bOK);
00427         if (!bOK) {
00428             return CVS_E_FAILED;
00429         }
00430         return S_OK;
00431     }
00432     CATCH_EXCEPTIONS(ShowFileHistory);
00433 }
00434
00435 STDMETHODIMP CvsCoworker::ShowFileProperties(
00436     int handle,
00437     const unsigned char *sFilename
00438     )
00439 {
00440     LOG_API_FN(ShowFileProperties);
00441     LOG_API_S(sFilename);
00442     ASSERT(sFilename);
00443     PREAMBLE(handle);
00444     try {
00445         bool bOK = pProject->showFileProperties(
00446             (const char*)sFilename
00447             );
00448         LOG_API_N(bOK);
00449         if (!bOK) {
00450             return CVS_E_FAILED;
00451         }
00452         return S_OK;
00453     }
00454     CATCH_EXCEPTIONS(ShowFileProperties);
00455 }
00456
00457 STDMETHODIMP CvsCoworker::ShowUserInterface(
00458     int handle,
00459     const unsigned char *sFilenames
00460     )
00461 {
00462     LOG_API_FN(ShowUserInterface);
00463     LOG_API_S(sFilenames);
00464     ASSERT(sFilenames);
00465     PREAMBLE(handle);
00466     try {
00467         bool bOK = pProject->showUserInterface(
00468             CvsFilenames(sFilenames)
00469             );
00470         LOG_API_N(bOK);
00471         if (!bOK) {
00472             return CVS_E_FAILED;
00473         }
00474         return S_OK;
00475     }
00476     CATCH_EXCEPTIONS(ShowUserInterface);
00477 }
00478
00479 STDMETHODIMP CvsCoworker::HasAdvancedOptionsForCommand(
00480     int handle,
00481     CvsCommand command,
00482     BOOL *pbAdvancedOptions
00483     )
00484 {
00485     LOG_API_FN(HasAdvancedOptionsForCommand);
00486     LOG_API_N(command);
00487     ASSERT(pbAdvancedOptions);
00488     PREAMBLE(handle);
00489     try {
00490         bool bOK = pProject->hasAdvancedOptionsForCommand(
00491             command,
00492             *pbAdvancedOptions
00493             );
00494         LOG_API_N(bOK);
00495         LOG_API_N(*pbAdvancedOptions);
00496         if (!bOK) {
00497             return CVS_E_FAILED;
00498         }
00499         return S_OK;
00500     }
00501     CATCH_EXCEPTIONS(HasAdvancedOptionsForCommand);
00502 }
00503
00504 STDMETHODIMP CvsCoworker::ShowAdvancedOptionsForCommand(
00505     int handle,
00506     CvsCommand command
00507     )
00508 {
00509     LOG_API_FN(ShowAdvancedOptionsForCommand);
00510     LOG_API_N(command);
00511     PREAMBLE(handle);
00512     try {
00513         bool bOK = pProject->showAdvancedOptionsForCommand(
00514             command
00515             );
00516         LOG_API_N(bOK);
00517         if (!bOK) {
00518             return CVS_E_FAILED;
00519         }
00520         return S_OK;
00521     }
00522     CATCH_EXCEPTIONS(ShowAdvancedOptionsForCommand);
00523 }
00524
00525 STDMETHODIMP CvsCoworker::GetFileChanges(
00526     int handle,
00527     int cbFilenameBuffer,
00528     unsigned char *sFilenameBuffer
00529     )
00530 {
00531     LOG_API_FN(GetFileChanges);
00532     ASSERT(0<cbFilenameBuffer);
00533     ASSERT(sFilenameBuffer);
00534     PREAMBLE(handle);
00535     CvsString sFilename;
00536     try {
00537         bool bOK = pProject->getFileChanges(
00538             sFilename
00539             );
00540         CopyString(sFilenameBuffer,sFilename,cbFilenameBuffer);
00541         LOG_API_N(bOK);
00542         LOG_API_S(sFilenameBuffer);
00543         if (!bOK) {
00544             return CVS_E_FAILED;
00545         }
00546         return S_OK;
00547     }
00548     CATCH_EXCEPTIONS(GetFileChanges);
00549 }
00550
00551 STDMETHODIMP CvsCoworker::GetFilesToAdd(
00552     int handle,
00553     int cbFilenamesBuffer,
00554     unsigned char *sFilenamesBuffer
00555     )
00556 {
00557     LOG_API_FN(GetFilesToAdd);
00558     ASSERT(0<cbFilenamesBuffer);
00559     ASSERT(sFilenamesBuffer);
00560     PREAMBLE(handle);
00561     CvsString sFilenames;
00562     try {
00563         bool bOK = pProject->getFilesToAdd(
00564             sFilenames
00565             );
00566         CopyString(sFilenamesBuffer,sFilenames,cbFilenamesBuffer);
00567         LOG_API_N(bOK);
00568         LOG_API_S(sFilenamesBuffer);
00569         if (!bOK) {
00570             return CVS_E_FAILED;
00571         }
00572         return S_OK;
00573     }
00574     CATCH_EXCEPTIONS(GetFilesToAdd);
00575 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CvsCoworker.h Source File

WinCvs/CoWorker/CvsCoworker.h

Go to the documentation of this file.
00001 // CvsCoworker.h : Declaration of the CvsCoworker
00002
00003 #ifndef __CVSCOWORKER_H_
00004 #define __CVSCOWORKER_H_
00005
00006 #include "resource.h"       // main symbols
00007
00009 // CvsCoworker
00010 class ATL_NO_VTABLE CvsCoworker :
00011     public CComObjectRootEx<CComSingleThreadModel>,
00012     public CComCoClass<CvsCoworker, &CLSID_CvsCoworker>,
00013     public ISupportErrorInfo,
00014     public ICvsCoworker
00015 {
00016 public:
00017     CvsCoworker()
00018     {
00019         qTRACE_FN(CvsCoworker);
00020     }
00021
00022 DECLARE_REGISTRY_RESOURCEID(IDR_CVSCOWORKER)
00023 DECLARE_NOT_AGGREGATABLE(CvsCoworker)
00024
00025 DECLARE_PROTECT_FINAL_CONSTRUCT()
00026
00027 BEGIN_COM_MAP(CvsCoworker)
00028     COM_INTERFACE_ENTRY(ICvsCoworker)
00029     COM_INTERFACE_ENTRY(ISupportErrorInfo)
00030 END_COM_MAP()
00031
00032 // ISupportsErrorInfo
00033     STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
00034
00035 // ICvsCoworker
00036 public:
00037     STDMETHOD(GetErrorMessage)(
00038             int handle,
00039             int iError,
00040             int cbErrorBuffer,
00041             unsigned char* sError
00042             );
00043     STDMETHOD(GetLastError)(
00044             int handle,
00045             int* piError
00046             );
00047     STDMETHOD(OpenProject)(
00048             int* pHandle,
00049             const unsigned char* sUsername,
00050             const unsigned char* sProjectName,
00051             const unsigned char* sProjectHome
00052             );
00053     STDMETHOD(GetProject)(
00054             int* pHandle,
00055             const unsigned char* sUsername,
00056             int cbProjectNameBuffer,
00057             unsigned char* sProjectName,
00058             int cbProjectHomeBuffer,
00059             unsigned char* sProjectHome,
00060             BOOL bAllowPathChange,
00061             BOOL bAllowNewProject,
00062             BOOL* pbNewProject
00063             );
00064     STDMETHOD(CloseProject)(
00065             int handle
00066             );
00067     STDMETHOD(UpdateFiles)(
00068             int handle,
00069             const unsigned char* sFilenames,
00070             BOOL bDirectories,
00071             BOOL bRecurse
00072             );
00073     STDMETHOD(CheckoutFiles)(
00074             int handle,
00075             const unsigned char* sFilenames
00076             );
00077     STDMETHOD(CheckinFiles)(
00078             int handle,
00079             const unsigned char* sFilenames,
00080             BOOL bKeepCheckedOut
00081             );
00082     STDMETHOD(UncheckoutFiles)(
00083             int handle,
00084             const unsigned char* sFilenames
00085             );
00086     STDMETHOD(AddFiles)(
00087             int handle,
00088             const unsigned char* sOptionsAndFilenames,
00089             const unsigned char* sComment
00090             );
00091     STDMETHOD(RemoveFiles)(
00092             int handle,
00093             const unsigned char* sFilenames
00094             );
00095     STDMETHOD(RenameFile)(
00096             int handle,
00097             const unsigned char* sOldFilename,
00098             const unsigned char* sNewFilename
00099             );
00100     STDMETHOD(DiffFile)(
00101             int handle,
00102             const unsigned char* sFilename,
00103             BOOL bIgnoreCase,
00104             BOOL bIgnoreWhitespace
00105             );
00106     STDMETHOD(ShowFileHistory)(
00107             int handle,
00108             const unsigned char* sFilenames
00109             );
00110     STDMETHOD(ShowFileProperties)(
00111             int handle,
00112             const unsigned char* sFilename
00113             );
00114     STDMETHOD(ShowUserInterface)(
00115             int handle,
00116             const unsigned char* sFilenames
00117             );
00118     STDMETHOD(HasAdvancedOptionsForCommand)(
00119             int handle,
00120             CvsCommand command,
00121             BOOL* pbAdvancedOptions
00122             );
00123     STDMETHOD(ShowAdvancedOptionsForCommand)(
00124             int handle,
00125             CvsCommand command
00126             );
00127     STDMETHOD(GetFileChanges)(
00128             int handle,
00129             int cbFilenameBuffer,
00130             unsigned char* sFilenameBuffer
00131             );
00132     STDMETHOD(GetFilesToAdd)(
00133             int handle,
00134             int cbFilenamesBuffer,
00135             unsigned char* sFilenamesBuffer
00136             );
00137 };
00138
00139 #endif //__CVSCOWORKER_H_
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CvsCoworkerErrors.h Source File

WinCvs/CoWorker/CvsCoworkerErrors.h

Go to the documentation of this file.
00001 #ifndef _CVSCOWORKERERROR_H_
00002 #define _CVSCOWORKERERROR_H_
00003
00004 //
00005 //  Likely errors to be returned from coworker API.
00006 //  Will expand or shrink this list as needed.
00007 //
00008
00009 // Returns from OpenProject()
00010 #define CVS_E_FAILED_OPEN_PROJECT           MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,100)
00011 #define CVS_E_FAILED_OPEN_DISALLOWED        MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,101)
00012 #define CVS_E_FAILED_OPEN_INVALID_USER      MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,102)
00013 #define CVS_E_FAILED_OPEN_CREATE            MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,103)
00014 #define CVS_E_FAILED_OPEN_BAD_PATH          MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,104)
00015
00016 // Returns from CloseProject()
00017 #define CVS_E_FAILED_CLOSE_PROJECT          MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,200)
00018
00019 // Returns from UpdateFiles()
00020 #define CVS_E_FAILED_UPDATE_FILES           MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,300)
00021 #define CVS_E_FAILED_UPDATE_DISALLOWED      MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,301)
00022 #define CVS_E_FAILED_UPDATE_NOT_IN_CVS      MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,302)
00023
00024 // Return from CheckoutFiles()
00025 #define CVS_E_FAILED_CHECKOUT_FILES         MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,400)
00026 #define CVS_E_FAILED_CHECKOUT_DISALLOWED    MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,401)
00027 #define CVS_E_FAILED_CHECKOUT_NOT_IN_CVS    MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,402)
00028
00029 // Return from CheckinFiles()
00030 #define CVS_E_FAILED_CHECKIN_FILES          MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,500)
00031 #define CVS_E_FAILED_CHECKIN_DISALLOWED     MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,501)
00032 #define CVS_E_FAILED_CHECKIN_NOT_IN_CVS     MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,502)
00033 #define CVS_E_FAILED_CHECKIN_NEED_UPDATE    MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,503)
00034
00035 // Returns common to many functions.
00036 #define CVS_E_FAILED_PROJECT_INVALID        MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,9900)
00037 #define CVS_E_FAILED                        MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,9901)
00038
00039 #endif
00040
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CvsFilenames.cpp Source File

WinCvs/CoWorker/CvsFilenames.cpp

Go to the documentation of this file.
00001 // CvsFilenames.cpp: implementation of the CvsFilenames class.
00002 //
00004
00005 #include "stdafx.h"
00006 #include "CvsTrace.h"
00007 #include "CvsFilenames.h"
00008
00010 // Construction/Destruction
00012
00013 CvsFilenames::CvsFilenames(const unsigned char* sFilenames)
00014 :   m_sBuffer((const char*)sFilenames),
00015     m_nFilenames(0),
00016     m_arrayOffsetName(0)
00017 {
00018     qTRACE_FN(CvsFilenames);
00019     qTRACE(("* strlen(sFilenames) = %d",strlen((const char*)sFilenames)));
00020
00021     char* sBase = m_sBuffer.getBuffer();
00022
00023     // count \n separators
00024     int nNames = 0;
00025     char* sName = sBase;
00026     for (;;) {
00027         char* s = strchr(sName,'\n');
00028         if (!s) break;
00029         ++nNames;
00030         sName = s + 1;
00031     }
00032
00033     qTRACE(("* found %d names",nNames));
00034
00035     // set name offsets and replace \n with \0
00036     m_arrayOffsetName = new int[nNames];
00037     int iName = 0;
00038     sName = sBase;
00039     for (;;) {
00040         char* s = strchr(sName,'\n');
00041         if (!s) break;
00042         m_arrayOffsetName[iName++] = (int)(sName - sBase);
00043         *s++ = 0;
00044         sName = s;
00045     }
00046     ASSERT(iName == nNames);
00047     ASSERT((0 == iName) || !*sName);
00048 }
00049
00050 CvsFilenames::~CvsFilenames()
00051 {
00052     delete [] m_arrayOffsetName;
00053 }
00054
00055 //
00056 //
00057 //
00058
00059 const char* CvsFilenames::getFilename(int i)
00060 {
00061     if ((i < 0) || (m_nFilenames <= i)) return "";
00062     int iOffset = m_arrayOffsetName[i];
00063     ASSERT(0 <= iOffset);
00064     ASSERT(iOffset < m_sBuffer.getBufferMax());
00065     const char* p = m_sBuffer;
00066     return p + iOffset;
00067 }
00068
00069 //
00070 //
00071 //
00072
00073 bool CvsFilenames::getOptionsAndFilename(int i,CvsString& sOptions,CvsString& sFilename)
00074 {
00075     if ((i < 0) || (m_nFilenames <= i)) {
00076         sOptions.strcpy("");
00077         sFilename.strcpy("");
00078         return false;
00079     }
00080     int iOffset = m_arrayOffsetName[i];
00081     ASSERT(0 <= iOffset);
00082     ASSERT(iOffset < m_sBuffer.getBufferMax());
00083     const char* pBase = m_sBuffer + iOffset;
00084     const char* pTab  = strchr(pBase,'\t');
00085     if (pTab) {
00086         sOptions.strncpy(pBase,(int)(pTab - pBase));
00087         sFilename.strcpy(pTab+1);
00088     } else {
00089         sOptions.strcpy("");
00090         sFilename.strcpy(pBase);
00091     }
00092     return true;
00093 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CvsFilenames.h Source File

WinCvs/CoWorker/CvsFilenames.h

Go to the documentation of this file.
00001 // CvsFilenames.h: interface for the CvsFilenames class.
00002 //
00004
00005 #if !defined(AFX_CVSFILENAMES_H__582FF616_FAA5_11D2_B442_0080C6F9179D__INCLUDED_)
00006 #define AFX_CVSFILENAMES_H__582FF616_FAA5_11D2_B442_0080C6F9179D__INCLUDED_
00007
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011
00012 #include "CvsString.h"
00013
00014 class CvsFilenames
00015 {
00016 public:
00017     CvsFilenames(const unsigned char*);
00018     ~CvsFilenames();
00019 public:
00020     bool getOptionsAndFilename(int i,CvsString&,CvsString&);
00021     const char* getFilename(int);
00022     int getNumberOfFilenames() { return m_nFilenames; }
00023 protected:
00024     CvsString m_sBuffer;
00025     int m_nFilenames;
00026     int* m_arrayOffsetName;
00027 };
00028
00029 #endif // !defined(AFX_CVSFILENAMES_H__582FF616_FAA5_11D2_B442_0080C6F9179D__INCLUDED_)
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CvsProject.cpp Source File

WinCvs/CoWorker/CvsProject.cpp

Go to the documentation of this file.
00001 // CvsProject.cpp: implementation of the CvsProject class.
00002 //
00004
00005 #include "stdafx.h"
00006 #include "CVS_Coworker_i.h"
00007 #include "CvsTrace.h"
00008 #include "CvsProject.h"
00009
00010 // Unique project number counter.
00011 static int g_hNextProject = 1000;
00012
00013 // Global list of projects.
00014 static CvsProject* g_pProjects;
00015
00017 // Construction/Destruction
00019
00020 CvsProject::CvsProject()
00021 :   m_hProject(g_hNextProject++),
00022     m_pNextProject(g_pProjects),
00023     m_iLastError(0)
00024 {
00025     g_pProjects = this;
00026 }
00027
00028 CvsProject::~CvsProject()
00029 {
00030     ASSERT(!m_pNextProject);
00031     // Not freed immediately for error catching.
00032 }
00033
00034 //
00035 //  Access to global list of projects.
00036 //
00037
00038 CvsProject* CvsProject::FindProject(int h)
00039 {
00040     CvsProject* pProject = g_pProjects;
00041     while (pProject) {
00042         if (h == pProject->getProjectHandle()) {
00043             return pProject;
00044         }
00045         pProject = pProject->m_pNextProject;
00046     }
00047     return 0;
00048 }
00049
00050 //
00051 //  Error reporting
00052 //
00053
00054 bool CvsProject::getErrorMessage(int iError,CvsString& sError)
00055 {
00056     // TODO: Add your implementation code here
00057     sError = "No error";
00058     return true;
00059 }
00060
00061 //
00062 //  Implementation of CVS coworker operations.
00063 //
00064
00065 bool CvsProject::getProject(
00066     const char* sUsername,
00067     const char* sProjectName,
00068     const char* sProjectHome,
00069     BOOL bAllowPathChange,
00070     BOOL bAllowNewProject,
00071     BOOL& bNewProject
00072     )
00073 {
00074     m_sUsername     = sUsername;
00075     m_sProjectName  = sProjectName;
00076     m_sProjectHome  = sProjectHome;
00077     // TODO: Add your implementation code here
00078     return false;
00079 }
00080
00081 bool CvsProject::openProject(
00082     const char* sUsername,
00083     const char* sProjectName,
00084     const char* sProjectHome
00085     )
00086 {
00087     m_sUsername     = sUsername;
00088     m_sProjectName  = sProjectName;
00089     m_sProjectHome  = sProjectHome;
00090     // TODO: Add your implementation code here
00091     return true;
00092 }
00093
00094 bool CvsProject::closeProject()
00095 {
00096     // TODO: Add your implementation code here
00097     return true;
00098 }
00099
00100 bool CvsProject::updateFiles(
00101     CvsFilenames& filenames,
00102     BOOL bDirectories,
00103     BOOL bRecurse
00104     )
00105 {
00106     // TODO: Add your implementation code here
00107     return true;
00108 }
00109
00110 bool CvsProject::checkoutFiles(
00111     CvsFilenames& filenames
00112     )
00113 {
00114     // TODO: Add your implementation code here
00115     return true;
00116 }
00117
00118 bool CvsProject::checkinFiles(
00119     CvsFilenames& filenames,
00120     BOOL bKeepCheckedOut
00121     )
00122 {
00123     // TODO: Add your implementation code here
00124     return true;
00125 }
00126
00127 bool CvsProject::uncheckoutFiles(
00128     CvsFilenames& filenames
00129     )
00130 {
00131     // TODO: Add your implementation code here
00132     return true;
00133 }
00134
00135 bool CvsProject::addFiles(
00136     CvsFilenames& sOptionsAndFilenames,
00137     const char* sComment
00138     )
00139 {
00140     // TODO: Add your implementation code here
00141     return true;
00142 }
00143
00144 bool CvsProject::removeFiles(
00145     CvsFilenames& filenames
00146     )
00147 {
00148     // TODO: Add your implementation code here
00149     return true;
00150 }
00151
00152 bool CvsProject::renameFile(
00153     const char* sOldFilename,
00154     const char* sNewFilename
00155     )
00156 {
00157     // TODO: Add your implementation code here
00158     return true;
00159 }
00160
00161 bool CvsProject::diffFile(
00162     const char* sFilename,
00163     BOOL bIgnoreCase,
00164     BOOL bIgnoreWhitespace
00165     )
00166 {
00167     // TODO: Add your implementation code here
00168     return true;
00169 }
00170
00171 bool CvsProject::isFileDifferent(
00172     const char* sFilename,
00173     CvsOption option,
00174     BOOL& bFileIsDifferent
00175     )
00176 {
00177     bFileIsDifferent = false;
00178     // TODO: Add your implementation code here
00179     return true;
00180 }
00181
00182 bool CvsProject::showFileHistory(
00183     CvsFilenames& filenames
00184     )
00185 {
00186     // TODO: Add your implementation code here
00187     return true;
00188 }
00189
00190 bool CvsProject::showFileProperties(
00191     const char* sFilename
00192     )
00193 {
00194     // TODO: Add your implementation code here
00195     return true;
00196 }
00197
00198 bool CvsProject::showUserInterface(
00199     CvsFilenames& filenames
00200     )
00201 {
00202     CWnd* pMainWnd = AfxGetMainWnd();
00203     if (pMainWnd) {
00204         pMainWnd->ShowWindow(SW_SHOWDEFAULT);
00205     }
00206     CWinApp* pApp = AfxGetApp();
00207     if (pApp) {
00208          // TBD
00209     }
00210     // TODO: Add your implementation code here
00211     return true;
00212 }
00213
00214 bool CvsProject::hasAdvancedOptionsForCommand(
00215     CvsCommand command,
00216     BOOL& bAdvancedOptions
00217     )
00218 {
00219     // TODO: Add your implementation code here
00220     return true;
00221 }
00222
00223 bool CvsProject::showAdvancedOptionsForCommand(
00224     CvsCommand command
00225     )
00226 {
00227     // TODO: Add your implementation code here
00228     return true;
00229 }
00230
00231 bool CvsProject::getFileChanges(
00232     CvsString& sFilenames
00233     )
00234 {
00235     // TODO: Add your implementation code here
00236     return true;
00237 }
00238
00239 bool CvsProject::getFilesToAdd(
00240     CvsString& sFilenames
00241     )
00242 {
00243     // TODO: Add your implementation code here
00244     return true;
00245 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CvsProject.h Source File

WinCvs/CoWorker/CvsProject.h

Go to the documentation of this file.
00001 // CvsProject.h: interface for the CvsProject class.
00002 //
00004
00005 #if !defined(AFX_CVSPROJECT_H__582FF611_FAA5_11D2_B442_0080C6F9179D__INCLUDED_)
00006 #define AFX_CVSPROJECT_H__582FF611_FAA5_11D2_B442_0080C6F9179D__INCLUDED_
00007
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011
00012 #include "CvsString.h"
00013 #include "CvsFilenames.h"
00014 //#include "CVS_Coworker.h"
00015
00016 //
00017 //  Context for a Project.
00018 //
00019
00020 class CvsProject
00021 {
00022 public:
00023     CvsProject();
00024     ~CvsProject();
00025 public:
00026     int getProjectHandle() { return m_hProject; }
00027     int getLastError() { return m_iLastError; }
00028     const char* getProjectName() { return m_sProjectName; }
00029     const char* getProjectHome() { return m_sProjectHome; }
00030 public:
00031     static CvsProject* FindProject(int);
00032 public:
00033     bool getErrorMessage(int,CvsString&);
00034 public:
00035     bool getFilesToAdd(CvsString&);
00036     bool getFileChanges(CvsString&);
00037     bool showAdvancedOptionsForCommand(CvsCommand);
00038     bool hasAdvancedOptionsForCommand(CvsCommand,BOOL&);
00039     bool showUserInterface(CvsFilenames&);
00040     bool showFileProperties(const char*);
00041     bool showFileHistory(CvsFilenames&);
00042     bool isFileDifferent(const char*,CvsOption,BOOL&);
00043     bool diffFile(const char*,BOOL,BOOL);
00044     bool renameFile(const char*,const char*);
00045     bool removeFiles(CvsFilenames&);
00046     bool addFiles(CvsFilenames&,const char*);
00047     bool uncheckoutFiles(CvsFilenames&);
00048     bool checkinFiles(CvsFilenames&,BOOL);
00049     bool checkoutFiles(CvsFilenames&);
00050     bool updateFiles(CvsFilenames&,BOOL,BOOL);
00051     bool getProject(const char*,const char*,const char*,BOOL,BOOL,BOOL&);
00052     bool openProject(const char*,const char*,const char*);
00053     bool closeProject();
00054 protected:
00055     CvsProject*     m_pNextProject;
00056     int             m_hProject;
00057     int             m_iLastError;
00058     CvsString       m_sProjectName;
00059     CvsString       m_sProjectHome;
00060     CvsString       m_sUsername;
00061 };
00062
00063 #endif // !defined(AFX_CVSPROJECT_H__582FF611_FAA5_11D2_B442_0080C6F9179D__INCLUDED_)
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CvsString.cpp Source File

WinCvs/CoWorker/CvsString.cpp

Go to the documentation of this file.
00001 #include "stdafx.h"
00002 #include "CvsTrace.h"
00003 #include "CvsString.h"
00004
00005 //
00006 //  Keep a list of 256 byte buffers to recycle.
00007 //
00008
00009 enum {
00010     cbQuanta    = 256,
00011     cBOB        = 0xA5,
00012     cEOB        = 0xA6
00013 };
00014
00015 static char* g_pListOfFreeBuffers;
00016
00017 //
00018 //
00019 //
00020
00021 inline static void CheckBuffer(const char* pBuffer,int cbBuffer = cbQuanta)
00022 {
00023     ASSERT(pBuffer);
00024     ASSERT(cBOB == (255&*(pBuffer-1)));
00025     ASSERT(cEOB == (255&*(pBuffer+cbBuffer)));
00026 }
00027
00028 //
00029 //
00030 //
00031
00032 void CvsString::recycle(char* p,int cb)
00033 {
00034     CheckBuffer(p,cb);
00035     --p;
00036     if (cbQuanta == cb) {
00037         *(char**)p = g_pListOfFreeBuffers;
00038         g_pListOfFreeBuffers = p;
00039         qTRACE(("* recycle %08lx (%d bytes)",(int)p,cb));
00040     } else {
00041         delete p;
00042         qTRACE(("* recycle %08lx (%d bytes) DELETE",(int)p,cb));
00043     }
00044 }
00045
00046 //
00047 //
00048 //
00049
00050 CvsString::~CvsString()
00051 {
00052     if (m_sBuffer) {
00053         char* p = m_sBuffer;
00054         m_sBuffer = 0;
00055         recycle(p,m_cbBufferMax);
00056     }
00057 }
00058
00059 //
00060 //  Upsize the string buffer to at least the given size.
00061 //
00062
00063 void CvsString::resize(int cbNew)
00064 {
00065     char* sOld      = m_sBuffer;
00066     int cbOld       = m_cbBufferMax;
00067
00068     // upsize to 256 byte quanta
00069     cbNew = (cbNew+255)&~255;
00070
00071     char* pNew = g_pListOfFreeBuffers;
00072     if ((cbQuanta == cbNew) && pNew) {
00073         qTRACE(("* resize %08lx (%d bytes) RECYCLED",(int)pNew,cbNew));
00074         g_pListOfFreeBuffers = *(char**)pNew;
00075         *pNew++         = (char)cBOB;
00076     } else {
00077         pNew = new char[cbNew+2];
00078         qTRACE(("* resize %08lx (%d bytes) NEW",(int)pNew,cbNew));
00079         *pNew++         = (char)cBOB;
00080         *(pNew+cbNew)   = (char)cEOB;
00081     }
00082     memset(pNew,0,cbNew);
00083     CheckBuffer(pNew,cbNew);
00084
00085     m_cbBufferMax   = cbNew;
00086     m_sBuffer       = pNew;
00087
00088     if (sOld) {
00089         ASSERT(cbOld <= cbNew);
00090         memcpy(m_sBuffer,sOld,cbOld);
00091         recycle(sOld,cbOld);
00092     }
00093 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CvsString.h Source File

WinCvs/CoWorker/CvsString.h

Go to the documentation of this file.
00001 #ifndef _CVSSTRING_H_
00002 #define _CVSSTRING_H_
00003
00004 //
00005 //  Thin wrapper around a char* string.
00006 //  Allocates exactly as much space as is needed.
00007 //
00008
00009 class CvsString
00010 {
00011 public:
00012     void requireSize(int);
00013 protected:
00014     void resize(int);
00015     static void recycle(char*,int);
00016 public:
00017     int strlen() const { return ::strlen(m_sBuffer); }
00018     void strcpy(const char*);
00019     void strncpy(const char*,int);
00020     void strcat(const char*);
00021 public:
00022     // Assignable access to characters within the string.
00023     // An index outside the string returns a reference to a junk character.
00024     char& operator[] (int i) {
00025         if ((i < 0) || ((int)strlen() <= i)) { static char c; return c; }
00026         return m_sBuffer[i];
00027     }
00028 public:
00029     CvsString& operator = (const char* s) { strcpy(s); return *this; }
00030     CvsString& operator = (const CvsString& s) { strcpy(s); return *this; }
00031     CvsString& operator += (const char* s) { strcat(s); return *this; }
00032     CvsString operator + (const char* s) const { CvsString v(m_sBuffer); v.strcat(s); return v; }
00033 public:
00034     int operator == (const char* s) const { return 0 == strcmp(m_sBuffer,s); }
00035 public:
00036     operator const char*() const { return m_sBuffer; }
00037 public:
00038     int   getBufferMax() const { return m_cbBufferMax; }
00039     char* getBuffer()    { return m_sBuffer; }
00040 public:
00041     CvsString() : m_sBuffer(0), m_cbBufferMax(0) { strcpy(""); }
00042     CvsString(const char* s) : m_sBuffer(0), m_cbBufferMax(0) { strcpy(s); }
00043     CvsString(const CvsString& s) : m_sBuffer(0), m_cbBufferMax(0) { strcpy(s); }
00044     ~CvsString();
00045 protected:
00046     char* m_sBuffer;
00047     int   m_cbBufferMax;
00048 };
00049
00050 //
00051 //  Upsize the string buffer to at least the given size.
00052 //
00053
00054 inline void CvsString::requireSize(int cbNew)
00055 {
00056     if (m_cbBufferMax < cbNew) {
00057         resize(cbNew);
00058     }
00059 }
00060
00061 //
00062 //  Copy the given string into this string.
00063 //
00064
00065 inline void CvsString::strcpy(const char* s)
00066 {
00067     requireSize(::strlen(s)+1);
00068     ::strcpy(m_sBuffer,s);
00069 }
00070
00071 //
00072 //  Copy the given string into this string.
00073 //
00074
00075 inline void CvsString::strncpy(const char* s,int n)
00076 {
00077     requireSize(n+1);
00078     ::strncpy(m_sBuffer,s,n);
00079     m_sBuffer[n] = 0;
00080 }
00081
00082 //
00083 //  Concatenate the given string onto this string.
00084 //
00085
00086 inline void CvsString::strcat(const char* s)
00087 {
00088     requireSize(strlen()+::strlen(s)+1);
00089     ::strcat(m_sBuffer,s);
00090 }
00091
00092 #endif
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CvsTrace.cpp Source File

WinCvs/CoWorker/CvsTrace.cpp

Go to the documentation of this file.
00001 #include "stdafx.h"
00002 #include "CvsTrace.h"
00003 #include "AppConsole.h"
00004 #include <time.h>
00005
00006 #ifdef _DEBUG
00007 #define new DEBUG_NEW
00008 #undef THIS_FILE
00009 static char THIS_FILE[] = __FILE__;
00010 #endif
00011
00012 //
00013 //
00014 //
00015
00016 static const char* g_sFilter = "*<>Aa";
00017 static BOOL g_bLogUnbuffered = FALSE;
00018
00019 void LogSetFilter(const char* s)
00020 {
00021     g_sFilter = strdup(s);
00022 }
00023
00024 static inline int InFilter(char c) {
00025     return 0 != strchr(g_sFilter,c);
00026 }
00027
00028 //
00029 //  Important!
00030 //
00031 //  If using for a Win16 DLL, the log file cannot be owned by the DLL.
00032 //
00033
00034 static HANDLE g_hLogFile = INVALID_HANDLE_VALUE;
00035
00036 #define IS_LOGGING() \
00037     (true)
00038
00039 //
00040 //
00041 //
00042
00043 static inline char* AddPrefix(char* p)
00044 {
00045     // add line break
00046     *p++ = '\n';
00047     return p;
00048 }
00049
00050 //
00051 //  Log file support
00052 //
00053
00054 static void LogWrite(const char* s)
00055 {
00056     // skip if not logging
00057     if (IS_LOGGING()) {
00058         cvs_outstr(s,strlen(s));
00059     }
00060 }
00061
00062 //
00063 //
00064 //
00065
00066 void LogInitialize(LPCSTR sFileName)
00067 {
00068     if ('!' == *sFileName) {
00069         g_bLogUnbuffered = TRUE;
00070         ++sFileName;
00071     }
00072     time_t t = time(0);
00073     LogWrite(ctime(&t));
00074 }
00075
00076 void LogCleanup(void)
00077 {
00078 }
00079
00080 //
00081 //
00082 //
00083
00084 static unsigned g_nLevel = 0;
00085
00086 static inline char* AddIndent(char* p)
00087 {
00088     for (int n = 31 & g_nLevel; 0<n; --n) {
00089         *p++ = ' ';
00090         *p++ = ' ';
00091     }
00092     return p;
00093 }
00094
00095 void LogString(const char* s,const char* sValue)
00096 {
00097     // skip if not logging
00098     if (!IS_LOGGING()) {
00099         return;
00100     }
00101     if (256 < strlen(sValue)) {
00102         LogBuffer(s,sValue,strlen(sValue));
00103         return;
00104     }
00105     // omit if not in filter
00106     if (!InFilter(*s++)) {
00107         return;
00108     }
00109     char sBuffer[1000];
00110     char* p = AddPrefix(sBuffer);
00111         // insert leading spaces as required
00112     if (' ' == *s) { ++s; p = AddIndent(p); }
00113     // format the arguments
00114     wsprintf(p,"%s : \"%s\"",s,sValue);
00115     ASSERT(strlen((const char*)sBuffer)<sizeof(sBuffer));
00116     // drop into log file
00117     LogWrite(sBuffer);
00118 }
00119
00120 void __cdecl Log_printf(const char* s,...)
00121 {
00122     // skip if not logging
00123     if (!IS_LOGGING()) {
00124         return;
00125     }
00126     // omit if not in filter
00127     if (!InFilter(*s++)) {
00128         return;
00129     }
00130     char sBuffer[1000];
00131     char* p = AddPrefix(sBuffer);
00132         // insert leading spaces as required
00133     if (' ' == *s) { ++s; p = AddIndent(p); }
00134     // format the arguments
00135     va_list a;
00136     va_start(a,s);
00137     wvsprintf(p,s,a);
00138     va_end(a);
00139     ASSERT(strlen((const char*)sBuffer)<sizeof(sBuffer));
00140     // drop into log file
00141     LogWrite(sBuffer);
00142 }
00143
00144 static const char sHex[] = "0123456789ABCDEF";
00145
00146 void LogBuffer(const char* sName,const char* sBuffer,unsigned cbBuffer)
00147 {
00148     // skip if not logging
00149     if (!IS_LOGGING()) {
00150         return;
00151     }
00152     // omit if not in filter
00153     if (!InFilter(*sName++)) {
00154         return;
00155     }
00156     // mark start of buffer
00157     Log_printf("*[BUFFER %s (%u bytes)]",sName,cbBuffer);
00158     // dump contents of buffer
00159     for (unsigned i=0; i<cbBuffer;) {
00160         char sLine[256];
00161         char* s1 = sLine;
00162         wsprintf(s1,"\n%05x:",i);
00163         s1 += strlen(s1);
00164         memset(s1,' ',50);
00165         char* s2 = s1 + 50;
00166         while (i<cbBuffer) {
00167             unsigned b = *(unsigned char*)(sBuffer+i);
00168             ++s1;
00169             *s1++ = sHex[15&(b>>4)];
00170             *s1++ = sHex[15&b];
00171             *s2++ = (char)(((31<b) && (b<127)) ? b : '.');
00172             ++i;
00173             if (!(15&i)) break;
00174         }
00175         *s2 = 0;
00176         LogWrite(sLine);
00177     }
00178     // mark end of buffer
00179     Log_printf("*[END BUFFER %s]",sName);
00180 }
00181
00182 //
00183 //
00184 //
00185
00186 static const char* g_sCurrent = "(BASE)";
00187
00188 CvsTrace::CvsTrace(const char* s)
00189 :   m_sOuter(0)
00190 {
00191     // skip if not logging
00192     if (!IS_LOGGING()) {
00193         return;
00194     }
00195     Log_printf("> > %s",s);
00196     {
00197         m_sOuter = g_sCurrent;
00198         g_sCurrent = s;
00199         ++g_nLevel;
00200     }
00201 }
00202
00203 CvsTrace::~CvsTrace()
00204 {
00205     // skip if not logging
00206     if (!IS_LOGGING()) {
00207         return;
00208     }
00209     const char* s;
00210     {
00211         --g_nLevel;
00212         s = g_sCurrent;
00213         g_sCurrent = m_sOuter;
00214     }
00215     Log_printf("< < %s",s);
00216 }
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/CvsTrace.h Source File

WinCvs/CoWorker/CvsTrace.h

Go to the documentation of this file.
00001 //
00002 //  Trace log and assertions.
00003 //
00004
00005 #ifndef _TRACE_H_
00006 #define _TRACE_H_
00007
00008 //
00009 //  for trace/logging
00010 //
00011
00012 #ifdef __cplusplus
00013 extern "C" {
00014 #endif
00015
00016 void LogSetFilter(const char*);
00017 void LogInitialize(LPCSTR);
00018 void LogCleanup(void);
00019 void LogAttach(HFILE,LPCSTR);
00020 void LogBuffer(const char*,const char*,unsigned);
00021
00022 void __cdecl Log_printf(const char*,...);
00023 void LogString(const char*,const char*);
00024
00025 #ifdef __cplusplus
00026 };
00027 #endif
00028
00029 #ifdef __cplusplus
00030
00031 class CvsTrace {
00032 public:
00033     CvsTrace(const char*);
00034     ~CvsTrace();
00035 private:
00036     const char* m_sOuter;
00037 };
00038
00039 #endif
00040
00041 //
00042 //  Logging calls always compiled into release.
00043 //
00044
00045 #define LOG_API_FN(FN) \
00046 CvsTrace _fn_(#FN)
00047
00048 #define LOG_API_S(S) \
00049 if (S) { LogString("A " #S,(const char*)(S)); }
00050
00051 #define LOG_API_X(X) \
00052 /*if (X)*/ { Log_printf("A " #X " : 0x%lx",(long)(X)); }
00053
00054 #define LOG_API_N(N) \
00055 /*if (N)*/ { Log_printf("A " #N " : %lu",(long)(N)); }
00056
00057 //
00058 //  Trace calls only compiled into DEBUG version.
00059 //
00060
00061 #ifdef NDEBUG
00062 #define qTRACE_FN(FN)
00063 #define qTRACE(L)
00064 #define LOG_BUFFER(A,B,N)
00065 #else
00066 #define qTRACE_FN(FN)       CvsTrace _fn_(#FN)
00067 #define qTRACE(L)           Log_printf L
00068 #define LOG_BUFFER(A,B,N)   LogBuffer(A,B,N)
00069 #endif
00070
00071 #define qTRACE_S(S) \
00072 if (S) { qTRACE(("a " #S " : \"%s\"",(S))); }
00073
00074 #define qTRACE_X(X) \
00075 /*if (X)*/ { qTRACE(("a " #X " : 0x%lx",(long)(X))); }
00076
00077 #define qTRACE_N(N) \
00078 /*if (N)*/ { qTRACE(("a " #N " : %lu",(long)(N))); }
00079
00080 //
00081 //  for debugging
00082 //
00083
00084 #undef ASSERT
00085 #undef VERIFY
00086
00087 #ifdef NDEBUG
00088 #define ASSERT(X)
00089 #define VERIFY(X)   (X)
00090 #else
00091 #define ASSERT(X)   if (!(X)) { __Assert(__FILE__,__LINE__,#X); DebugBreak(); } else 0
00092 #define VERIFY(X)   if (!(X)) { __Assert(__FILE__,__LINE__,#X); DebugBreak(); } else 0
00093
00094 #ifdef _M_IX86
00095 #define DebugBreak()    __asm { int 3 }
00096 #endif
00097
00098 static void __Assert(const char* sFile,unsigned iLine,const char* sExpression)
00099 {
00100     Log_printf("*%s:%u ASSERT FAILED: %s",sFile,iLine,sExpression);
00101 }
00102 #endif
00103
00104 #endif
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/CoWorker/dlldata.c Source File

WinCvs/CoWorker/dlldata.c

Go to the documentation of this file.
00001 /*********************************************************
00002    DllData file -- generated by MIDL compiler
00003
00004         DO NOT ALTER THIS FILE
00005
00006    This file is regenerated by MIDL on every IDL file compile.
00007
00008    To completely reconstruct this file, delete it and rerun MIDL
00009    on all the IDL files in this DLL, specifying this file for the
00010    /dlldata command line option
00011
00012 *********************************************************/
00013
00014
00015 #include <rpcproxy.h>
00016
00017 #ifdef __cplusplus
00018 extern "C"   {
00019 #endif
00020
00021 EXTERN_PROXY_FILE( cvs_coworker )
00022
00023
00024 PROXYFILE_LIST_START
00025 /* Start of list */
00026   REFERENCE_PROXY_FILE( cvs_coworker ),
00027 /* End of list */
00028 PROXYFILE_LIST_END
00029
00030
00031 DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
00032
00033 #ifdef __cplusplus
00034 }  /*extern "C" */
00035 #endif
00036
00037 /* end of generated dlldata file */
Generated on Sun Oct 21 12:41:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WinCvs/res/resrc1.h Source File

WinCvs/res/resrc1.h

Go to the documentation of this file.
00001 //{{NO_DEPENDENCIES}}
00002 // Microsoft Developer Studio generated include file.
00003 // Used by wincvs2.rc
00004 //
00005
00006 // Next default values for new objects
00007 //
00008 #ifdef APSTUDIO_INVOKED
00009 #ifndef APSTUDIO_READONLY_SYMBOLS
00010 #define _APS_3D_CONTROLS                     1
00011 #define _APS_NEXT_RESOURCE_VALUE        131
00012 #define _APS_NEXT_COMMAND_VALUE         32790
00013 #define _APS_NEXT_CONTROL_VALUE         1008
00014 #define _APS_NEXT_SYMED_VALUE           101
00015 #endif
00016 #endif
Generated on Sun Oct 21 12:41:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Subclass.cpp File Reference

WinCvs/CJLib/CJLibrary/Subclass.cpp File Reference

#include "StdAfx.h"
#include "Subclass.h"

Include dependency graph for Subclass.cpp:

Include dependency graph

Go to the source code of this file.

Compounds

class | CSubclassWndMap

Defines

#define | theHookMap (CSubclassWndMap::GetHookMap())

Functions

LRESULT CALLBACK | HookWndProc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)

Define Documentation

#define theHookMap (CSubclassWndMap::GetHookMap())

Definition at line 55 of file Subclass.cpp.

Function Documentation

LRESULT CALLBACK HookWndProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wp,
 |  | LPARAM | lp
 | ) |

Definition at line 150 of file Subclass.cpp.

00151 {
00152 #ifdef _USRDLL
00153     // If this is a DLL, need to set up MFC state
00154     AFX_MANAGE_STATE(AfxGetStaticModuleState());
00155 #endif
00156
00157     // Set up MFC message state just in case anyone wants it
00158     // This is just like AfxCallWindowProc, but we can't use that because
00159     // a CSubclassWnd is not a CWnd.
00160     //
00161     MSG& curMsg = AfxGetThreadState()->m_lastSentMsg;
00162     MSG  oldMsg = curMsg;   // save for nesting
00163     curMsg.hwnd     = hwnd;
00164     curMsg.message = msg;
00165     curMsg.wParam  = wp;
00166     curMsg.lParam  = lp;
00167
00168     // Get hook object for this window. Get from hook map
00169     CSubclassWnd* pSubclassWnd = theHookMap.Lookup(hwnd);
00170     ASSERT(pSubclassWnd);
00171
00172     LRESULT lr;
00173     if (msg==WM_NCDESTROY) {
00174         // Window is being destroyed: unhook all hooks (for this window)
00175         // and pass msg to orginal window proc
00176         //
00177         WNDPROC wndproc = pSubclassWnd->m_pOldWndProc;
00178         theHookMap.RemoveAll(hwnd);
00179         lr = ::CallWindowProc(wndproc, hwnd, msg, wp, lp);
00180
00181     } else {
00182         // pass to msg hook
00183         lr = pSubclassWnd->WindowProc(msg, wp, lp);
00184     }
00185     curMsg = oldMsg;            // pop state
00186     return lr;
00187 }

Generated on Sun Oct 21 12:44:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJBrowseEdit.h File Reference

WinCvs/CJLib/Include/CJBrowseEdit.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJBrowseButton
class | CCJBrowseEdit

Enumerations

enum | BROWSE_TYPE { BT_DIRECTORY = 1, BT_FILE = 2, BT_POPUPMENU = 3 }

Enumeration Type Documentation

enum BROWSE_TYPE

Enumeration values:
BT_DIRECTORY
BT_FILE
BT_POPUPMENU

Definition at line 74 of file CJBrowseEdit.h.

00074                          {
00075     BT_DIRECTORY = 1,
00076     BT_FILE      = 2,
00077     BT_POPUPMENU = 3
00078 };

Generated on Sun Oct 21 12:44:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJCaption.h File Reference

WinCvs/CJLib/Include/CJCaption.h File Reference

#include "CJFlatButton.h"

Include dependency graph for CJCaption.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJCaption
class | CCJCaptionButton

Defines

#define | WS_EX_FLATEDGE 0x01

Define Documentation

#define WS_EX_FLATEDGE 0x01

Definition at line 127 of file CJCaption.h.

Generated on Sun Oct 21 12:44:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJCaptionPopupWnd.h File Reference

WinCvs/CJLib/Include/CJCaptionPopupWnd.h File Reference

#include "CJCaption.h"
#include "CJFlatButton.h"

Include dependency graph for CJCaptionPopupWnd.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJCaptionPopupWnd

Defines

#define | CM_ONPUSHPINBUTTON WM_USER + 1001
#define | CM_ONPUSHPINCANCEL WM_USER + 1002

Define Documentation

#define CM_ONPUSHPINBUTTON WM_USER + 1001

Definition at line 58 of file CJCaptionPopupWnd.h.

#define CM_ONPUSHPINCANCEL WM_USER + 1002

Definition at line 59 of file CJCaptionPopupWnd.h.

Generated on Sun Oct 21 12:44:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJColorPicker.h File Reference

WinCvs/CJLib/Include/CJColorPicker.h File Reference

#include "CJColorPopup.h"

Include dependency graph for CJColorPicker.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJColorPicker

Defines

#define | CP_MODE_TEXT 1
#define | CP_MODE_BK 2

Functions

void AFXAPI | DDX_CJColorPicker (CDataExchange *pDX, int nIDC, COLORREF &crColor)

Define Documentation

#define CP_MODE_BK 2

Definition at line 73 of file CJColorPicker.h.

#define CP_MODE_TEXT 1

Definition at line 72 of file CJColorPicker.h.

Function Documentation

void AFXAPI DDX_CJColorPicker | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | COLORREF & | crColor
 | ) |

Definition at line 80 of file CJColorPicker.cpp.

00081 {
00082     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
00083     ASSERT (hWndCtrl != NULL);
00084
00085     CCJColorPicker* pColorPicker = (CCJColorPicker*) CWnd::FromHandle(hWndCtrl);
00086     if (pDX->m_bSaveAndValidate)
00087     {
00088         crColor = pColorPicker->GetColor();
00089     }
00090     else // initializing
00091     {
00092         pColorPicker->SetColor(crColor);
00093     }
00094 }

Generated on Sun Oct 21 12:44:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJColorPopup.h File Reference

WinCvs/CJLib/Include/CJColorPopup.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJColorPopup
struct | ColorTableEntry

Defines

#define | CPN_SELCHANGE WM_USER + 1001
#define | CPN_DROPDOWN WM_USER + 1002
#define | CPN_CLOSEUP WM_USER + 1003
#define | CPN_SELENDOK WM_USER + 1004
#define | CPN_SELENDCANCEL WM_USER + 1005

Define Documentation

#define CPN_CLOSEUP WM_USER + 1003

Definition at line 57 of file CJColorPopup.h.

#define CPN_DROPDOWN WM_USER + 1002

Definition at line 56 of file CJColorPopup.h.

#define CPN_SELCHANGE WM_USER + 1001

Definition at line 55 of file CJColorPopup.h.

#define CPN_SELENDCANCEL WM_USER + 1005

Definition at line 59 of file CJColorPopup.h.

#define CPN_SELENDOK WM_USER + 1004

Definition at line 58 of file CJColorPopup.h.

Generated on Sun Oct 21 12:44:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJComboBoxEx.h File Reference

WinCvs/CJLib/Include/CJComboBoxEx.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJComboBoxEx

Generated on Sun Oct 21 12:44:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJControlBar.h File Reference

WinCvs/CJLib/Include/CJControlBar.h File Reference

#include "CJFlatButton.h"
#include "CJMenu.h"

Include dependency graph for CJControlBar.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJCBarButton
class | CCJControlBar

Defines

#define | AFX_IDW_SIZEBAR_LEFT AFX_IDW_DOCKBAR_LEFT + 4
#define | AFX_IDW_SIZEBAR_RIGHT AFX_IDW_DOCKBAR_RIGHT + 5
#define | AFX_IDW_SIZEBAR_TOP AFX_IDW_DOCKBAR_TOP + 6
#define | AFX_IDW_SIZEBAR_BOTTOM AFX_IDW_DOCKBAR_BOTTOM + 7

Enumerations

enum BTN_IMG_INDEX {
HIDE_CONTRLBAR, MAXI_H_DISABLE, MAXI_H_ENABLED, MAXI_V_DISABLE,
MAXI_V_ENABLED, NORM_H_DISABLE, NORM_H_ENABLED, NORM_V_DISABLE,
NORM_V_ENABLED
}
enum | CHILD_BORDER { NONE, OUTLINE, SUNKEN, RAISED }

Variables

const DWORD | dwSizeBarMap [4][2]

Define Documentation

#define AFX_IDW_SIZEBAR_BOTTOM AFX_IDW_DOCKBAR_BOTTOM + 7

Definition at line 522 of file CJControlBar.h.

#define AFX_IDW_SIZEBAR_LEFT AFX_IDW_DOCKBAR_LEFT + 4

Definition at line 519 of file CJControlBar.h.

#define AFX_IDW_SIZEBAR_RIGHT AFX_IDW_DOCKBAR_RIGHT + 5

Definition at line 520 of file CJControlBar.h.

#define AFX_IDW_SIZEBAR_TOP AFX_IDW_DOCKBAR_TOP + 6

Definition at line 521 of file CJControlBar.h.

Enumeration Type Documentation

enum BTN_IMG_INDEX

Enumeration values:
HIDE_CONTRLBAR
MAXI_H_DISABLE
MAXI_H_ENABLED
MAXI_V_DISABLE
MAXI_V_ENABLED
NORM_H_DISABLE
NORM_H_ENABLED
NORM_V_DISABLE
NORM_V_ENABLED

Definition at line 198 of file CJControlBar.h.

00198              { HIDE_CONTRLBAR,
00199     MAXI_H_DISABLE, MAXI_H_ENABLED, MAXI_V_DISABLE, MAXI_V_ENABLED,
00200     NORM_H_DISABLE, NORM_H_ENABLED, NORM_V_DISABLE, NORM_V_ENABLED
00201 } BTN_IMG_INDEX;

enum CHILD_BORDER

Enumeration values:
NONE
OUTLINE
SUNKEN
RAISED

Definition at line 203 of file CJControlBar.h.

00203 { NONE, OUTLINE, SUNKEN, RAISED } CHILD_BORDER;

Variable Documentation

const DWORD dwSizeBarMap[4][2]

Initial value:

{
    {  AFX_IDW_DOCKBAR_TOP + 6 ,      CBRS_TOP    },
    {  AFX_IDW_DOCKBAR_BOTTOM + 7 ,   CBRS_BOTTOM },
    {  AFX_IDW_DOCKBAR_LEFT + 4 ,     CBRS_LEFT   },
    {  AFX_IDW_DOCKBAR_RIGHT + 5 ,    CBRS_RIGHT  },
}

Definition at line 524 of file CJControlBar.h.

Generated on Sun Oct 21 12:45:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJDateTimeCtrl.h File Reference

WinCvs/CJLib/Include/CJDateTimeCtrl.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJDateTimeCtrl
class | CCJMonthCalCtrl

Functions

void AFXAPI | DDX_CJDateTimeCtrl (CDataExchange *pDX, int nIDC, COleDateTime &value)
void AFXAPI | DDX_CJDateTimeCtrl (CDataExchange *pDX, int nIDC, CTime &value)
void AFXAPI | DDX_CJMonthCalCtrl (CDataExchange *pDX, int nIDC, COleDateTime &value)
void AFXAPI | DDX_CJMonthCalCtrl (CDataExchange *pDX, int nIDC, CTime &value)
void AFXAPI | DDV_CJMinMaxDateTime (CDataExchange *pDX, CTime &refValue, const CTime *pMinRange, const CTime *pMaxRange)
void AFXAPI | DDV_CJMinMaxDateTime (CDataExchange *pDX, COleDateTime &refValue, const COleDateTime *pMinRange, const COleDateTime *pMaxRange)
void AFXAPI | DDV_CJMinMaxMonth (CDataExchange *pDX, CTime &refValue, const CTime *pMinRange, const CTime *pMaxRange)
void AFXAPI | DDV_CJMinMaxMonth (CDataExchange *pDX, COleDateTime &refValue, const COleDateTime *pMinRange, const COleDateTime *pMaxRange)

Function Documentation

void AFXAPI DDV_CJMinMaxDateTime | ( | CDataExchange * | pDX,
 |  | COleDateTime & | refValue,
 |  | const COleDateTime * | pMinRange,
 |  | const COleDateTime * | pMaxRange
 | ) |

Definition at line 1068 of file CJDateTimeCtrl.cpp.

01070 {
01071     ASSERT(pMinRange == NULL || pMaxRange == NULL || *pMinRange <= *pMaxRange);
01072     CCJDateTimeCtrl* pWnd =
01073         (CCJDateTimeCtrl*) CWnd::FromHandle(pDX->m_hWndLastControl);
01074
01075     if (!pDX->m_bSaveAndValidate)
01076     {
01077         if ( (pMinRange != NULL && *pMinRange > refValue) ||
01078               (pMaxRange != NULL && *pMaxRange < refValue))
01079         {
01080             int nIDC = GetWindowLong(pDX->m_hWndLastControl, GWL_ID);
01081             TRACE1("Warning: initial dialog data is out of range in control ID %d.\n", nIDC);
01082             return;     // don't stop now
01083         }
01084     }
01085
01086     pWnd->SetRange(pMinRange, pMaxRange);
01087 }

void AFXAPI DDV_CJMinMaxDateTime | ( | CDataExchange * | pDX,
 |  | CTime & | refValue,
 |  | const CTime * | pMinRange,
 |  | const CTime * | pMaxRange
 | ) |

void AFXAPI DDV_CJMinMaxMonth | ( | CDataExchange * | pDX,
 |  | COleDateTime & | refValue,
 |  | const COleDateTime * | pMinRange,
 |  | const COleDateTime * | pMaxRange
 | ) |

Definition at line 1112 of file CJDateTimeCtrl.cpp.

01114 {
01115     ASSERT(pMinRange == NULL || pMaxRange == NULL || *pMinRange <= *pMaxRange);
01116     CCJMonthCalCtrl* pWnd =
01117         (CCJMonthCalCtrl*) CWnd::FromHandle(pDX->m_hWndLastControl);
01118
01119     if (!pDX->m_bSaveAndValidate)
01120     {
01121         if ( (pMinRange != NULL && *pMinRange > refValue) ||
01122               (pMaxRange != NULL && *pMaxRange < refValue))
01123         {
01124 #ifdef _DEBUG
01125             int nIDC = GetWindowLong(pDX->m_hWndLastControl, GWL_ID);
01126             TRACE1("Warning: initial dialog data is out of range in control ID %d.\n", nIDC);
01127 #endif
01128             return;     // don't stop now
01129         }
01130     }
01131
01132     pWnd->SetRange(pMinRange, pMaxRange);
01133 }

void AFXAPI DDV_CJMinMaxMonth | ( | CDataExchange * | pDX,
 |  | CTime & | refValue,
 |  | const CTime * | pMinRange,
 |  | const CTime * | pMaxRange
 | ) |

void AFXAPI DDX_CJDateTimeCtrl | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | CTime & | value
 | ) |

Definition at line 1010 of file CJDateTimeCtrl.cpp.

01011 {
01012     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
01013     CCJDateTimeCtrl* pWnd = (CCJDateTimeCtrl*) CWnd::FromHandle(hWndCtrl);
01014
01015     if (pDX->m_bSaveAndValidate)
01016         pWnd->GetTime(value);
01017     else
01018         pWnd->SetTime(&value);
01019 }

void AFXAPI DDX_CJDateTimeCtrl | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | COleDateTime & | value
 | ) |

void AFXAPI DDX_CJMonthCalCtrl | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | CTime & | value
 | ) |

Definition at line 1033 of file CJDateTimeCtrl.cpp.

01034 {
01035     HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
01036     CCJMonthCalCtrl* pWnd = (CCJMonthCalCtrl*) CWnd::FromHandle(hWndCtrl);
01037
01038     if (pDX->m_bSaveAndValidate)
01039         pWnd->GetCurSel(value);
01040     else
01041         pWnd->SetCurSel(value);
01042 }

void AFXAPI DDX_CJMonthCalCtrl | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | COleDateTime & | value
 | ) |

Generated on Sun Oct 21 12:45:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJDockBar.h File Reference

WinCvs/CJLib/Include/CJDockBar.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJDockBar

Generated on Sun Oct 21 12:45:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJDockContext.h File Reference

WinCvs/CJLib/Include/CJDockContext.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJDockContext

Generated on Sun Oct 21 12:45:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJExplorerBar.h File Reference

WinCvs/CJLib/Include/CJExplorerBar.h File Reference

#include "CJControlBar.h"
#include "CJCaption.h"

Include dependency graph for CJExplorerBar.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJExplorerBar

Generated on Sun Oct 21 12:45:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFlatButton.h File Reference

WinCvs/CJLib/Include/CJFlatButton.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJFlatButton

Generated on Sun Oct 21 12:45:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFlatComboBox.h File Reference

WinCvs/CJLib/Include/CJFlatComboBox.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJFlatComboBox

Generated on Sun Oct 21 12:45:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFlatHeaderCtrl.h File Reference

WinCvs/CJLib/Include/CJFlatHeaderCtrl.h File Reference

#include "CJMenu.h"

Include dependency graph for CJFlatHeaderCtrl.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJFlatHeaderCtrl

Generated on Sun Oct 21 12:45:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFlatSplitterWnd.h File Reference

WinCvs/CJLib/Include/CJFlatSplitterWnd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJFlatSplitterWnd

Generated on Sun Oct 21 12:45:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFlatTabCtrl.h File Reference

WinCvs/CJLib/Include/CJFlatTabCtrl.h File Reference

#include <afxtempl.h>
#include "CJMetaFileButton.h"

Include dependency graph for CJFlatTabCtrl.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJFlatTabCtrl

Defines

#define | FTS_BOTTOM 0x0002
#define | FTS_HASARROWS 0x0004
#define | FTS_HASHOMEEND 0x0008

Typedefs

typedef CList< CString *,
CString *> 		CTabList

Define Documentation

#define FTS_BOTTOM 0x0002

Definition at line 68 of file CJFlatTabCtrl.h.

#define FTS_HASARROWS 0x0004

Definition at line 69 of file CJFlatTabCtrl.h.

#define FTS_HASHOMEEND 0x0008

Definition at line 70 of file CJFlatTabCtrl.h.

Typedef Documentation

typedef CList<CString*, CString*> CTabList

Definition at line 72 of file CJFlatTabCtrl.h.

Generated on Sun Oct 21 12:45:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFontCombo.h File Reference

WinCvs/CJLib/Include/CJFontCombo.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJFontCombo

Generated on Sun Oct 21 12:45:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJFrameWnd.h File Reference

WinCvs/CJLib/Include/CJFrameWnd.h File Reference

#include "CJMenuBar.h"
#include "CJMenu.h"

Include dependency graph for CJFrameWnd.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJFrameWnd

Generated on Sun Oct 21 12:45:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJHexEdit.h File Reference

WinCvs/CJLib/Include/CJHexEdit.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJHexEdit

Generated on Sun Oct 21 12:45:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJHtmlView.h File Reference

WinCvs/CJLib/Include/CJHtmlView.h File Reference

#include <docobj.h>
#include <shlobj.h>
#include <exdisp.h>
#include <afxconv.h>

Include dependency graph for CJHtmlView.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJHtmlView

Generated on Sun Oct 21 12:45:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJHyperLink.h File Reference

WinCvs/CJLib/Include/CJHyperLink.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJHyperLink

Generated on Sun Oct 21 12:45:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJLibrary.h File Reference

WinCvs/CJLib/Include/CJLibrary.h File Reference

#include <afxtempl.h>
#include <afxpriv.h>
#include <..\src\afximpl.h>
#include "CJBrowseEdit.h"
#include "CJCaption.h"
#include "CJCaptionPopupWnd.h"
#include "CJColorPicker.h"
#include "CJComboBoxEx.h"
#include "CJControlBar.h"
#include "CJDateTimeCtrl.h"
#include "CJDockBar.h"
#include "CJDockContext.h"
#include "CJExplorerBar.h"
#include "CJFlatComboBox.h"
#include "CJFlatHeaderCtrl.h"
#include "CJFlatSplitterWnd.h"
#include "CJFlatTabCtrl.h"
#include "CJFontCombo.h"
#include "CJFrameWnd.h"
#include "CJHexEdit.h"
#include "CJHtmlView.h"
#include "CJHyperLink.h"
#include "CJListBox.h"
#include "CJListCtrl.h"
#include "CJListView.h"
#include "CJLogoPane.h"
#include "CJMaskEdit.h"
#include "CJMDIChildWnd.h"
#include "CJMDIFrameWnd.h"
#include "CJMemFile.h"
#include "CJMiniDockFrameWnd.h"
#include "CJOutlookBar.h"
#include "CJPagerCtrl.h"
#include "CJReBar.h"
#include "CJReBarCtrl.h"
#include "CJShell.h"
#include "CJShellList.h"
#include "CJShellTree.h"
#include "CJSizeDockBar.h"
#include "CJSortClass.h"
#include "CJStatusBar.h"
#include "CJTabCtrl.h"
#include "CJTabCtrlBar.h"
#include "CJTabView.h"
#include "CJTreeCtrl.h"
#include "CJWindowPlacement.h"
#include "GfxGroupEdit.h"
#include "GfxOutBarCtrl.h"
#include "GfxSplitterWnd.h"

Include dependency graph for CJLibrary.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | _VC_VERSION_5
#define | _CJXLIB_INLINE inline
#define | _delete(p) {if(p){delete p;p=NULL;}}
#define | _CJX_COMMENT "CJ609LibStatic.lib"
#define | _CJX_MESSAGE "Automatically linking with CJ609LibStatic.lib"

Define Documentation

#define _CJXLIB_INLINE inline

Definition at line 102 of file CJLibrary.h.

#define _CJX_COMMENT "CJ609LibStatic.lib"

Definition at line 365 of file CJLibrary.h.

#define _CJX_MESSAGE "Automatically linking with CJ609LibStatic.lib"

Definition at line 366 of file CJLibrary.h.

#define _VC_VERSION_5

Definition at line 90 of file CJLibrary.h.

#define _delete ( p ) {if(p){delete p;p=NULL;}}

Definition at line 331 of file CJLibrary.h.

Generated on Sun Oct 21 12:45:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJListBox.h File Reference

WinCvs/CJLib/Include/CJListBox.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJListBox

Generated on Sun Oct 21 12:45:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJListCtrl.h File Reference

WinCvs/CJLib/Include/CJListCtrl.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJListCtrl

Generated on Sun Oct 21 12:45:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJListView.h File Reference

WinCvs/CJLib/Include/CJListView.h File Reference

#include <afxcview.h>

Include dependency graph for CJListView.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJListView

Generated on Sun Oct 21 12:45:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJLogoPane.h File Reference

WinCvs/CJLib/Include/CJLogoPane.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJLogoPane

Generated on Sun Oct 21 12:45:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMaskEdit.h File Reference

WinCvs/CJLib/Include/CJMaskEdit.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJDateEdit
class | CCJMaskEdit
class | CCJTimeEdit

Functions

void AFXAPI | DDX_OleDateTime (CDataExchange *pDX, int nIDC, CCJDateEdit &rControl, COleDateTime &rDateTime)

Function Documentation

void AFXAPI DDX_OleDateTime | ( | CDataExchange * | pDX,
 |  | int | nIDC,
 |  | CCJDateEdit & | rControl,
 |  | COleDateTime & | rDateTime
 | ) |

Definition at line 391 of file CJMaskEdit.cpp.

00392 {
00393     DDX_Control( pDX, nIDC, rControl );
00394
00395     if( pDX->m_bSaveAndValidate ) {
00396         rDateTime = rControl.GetDateTime();
00397     }
00398     else {
00399         rControl.SetDateTime( rDateTime );
00400     }
00401 }

Generated on Sun Oct 21 12:45:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMDIChildWnd.h File Reference

WinCvs/CJLib/Include/CJMDIChildWnd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJMDIChildWnd

Generated on Sun Oct 21 12:45:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMDIFrameWnd.h File Reference

WinCvs/CJLib/Include/CJMDIFrameWnd.h File Reference

#include "CJMenuBar.h"
#include "CJMenu.h"

Include dependency graph for CJMDIFrameWnd.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJMDIFrameWnd

Typedefs

typedef CList< CCJMenu *,
CCJMenu *> 		CMDIMenuList

Typedef Documentation

typedef CList<CCJMenu*, CCJMenu*> CMDIMenuList

Definition at line 141 of file CJMDIFrameWnd.h.

Generated on Sun Oct 21 12:45:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMemFile.h File Reference

WinCvs/CJLib/Include/CJMemFile.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJMemFile

Generated on Sun Oct 21 12:45:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMenu.h File Reference

WinCvs/CJLib/Include/CJMenu.h File Reference

#include <afxtempl.h>

Include dependency graph for CJMenu.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJMenu
class | CCJMenuData
struct | CMenuItemInfo

Defines

#define | AppendMenu AppendMenuA
#define | InsertMenu InsertMenuA
#define | InsertODMenu InsertODMenuA
#define | AppendODMenu AppendODMenuA
#define | AppendODPopupMenu AppendODPopupMenuA
#define | ModifyODMenu ModifyODMenuA

Enumerations

enum | HIGHLIGHTSTYLE { Normal, TextOnly }

Define Documentation

#define AppendMenu AppendMenuA

Definition at line 81 of file CJMenu.h.

Referenced by CCJMenu::AppendMenuA(), CCJMenu::AppendODMenuW(), GetCustomMenu(), CMainFrame::OnInitMenu(), CGfxOutBarCtrl::OnRButtonDown(), UMenuAddButton(), UMenuAddPulldown(), UMenuAddSeparator(), and UMenuAddToggle().

#define AppendODMenu AppendODMenuA

Definition at line 84 of file CJMenu.h.

#define AppendODPopupMenu AppendODPopupMenuA

Definition at line 85 of file CJMenu.h.

#define InsertMenu InsertMenuA

Definition at line 82 of file CJMenu.h.

Referenced by CCJMenu::InsertODMenuW(), CMainFrame::OnInitMenu(), and CCJToolBar::OnRButtonDown().

#define InsertODMenu InsertODMenuA

Definition at line 83 of file CJMenu.h.

#define ModifyODMenu ModifyODMenuA

Definition at line 86 of file CJMenu.h.

Referenced by CCJMenu::LoadToolbar().

Enumeration Type Documentation

enum HIGHLIGHTSTYLE

Enumeration values:
Normal
TextOnly

Definition at line 78 of file CJMenu.h.

00078 {Normal,TextOnly} HIGHLIGHTSTYLE;

Generated on Sun Oct 21 12:45:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMenuBar.h File Reference

WinCvs/CJLib/Include/CJMenuBar.h File Reference

#include "CJToolBar.h"
#include "CJMenu.h"
#include "Subclass.h"

Include dependency graph for CJMenuBar.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJMenuBar
class | CCJMenuBarFrameHook

Enumerations

enum | TRACKINGSTATE { TRACK_NONE = 0, TRACK_BUTTON, TRACK_POPUP }

Enumeration Type Documentation

enum TRACKINGSTATE

Enumeration values:
TRACK_NONE
TRACK_BUTTON
TRACK_POPUP

Definition at line 71 of file CJMenuBar.h.

00071                            { // menubar has three states:
00072     TRACK_NONE = 0,   // * normal, not tracking anything
00073     TRACK_BUTTON,     // * tracking buttons (F10/Alt mode)
00074     TRACK_POPUP       // * tracking popups
00075 };

Generated on Sun Oct 21 12:45:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMetaFileButton.h File Reference

WinCvs/CJLib/Include/CJMetaFileButton.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJMetaFileButton

Generated on Sun Oct 21 12:45:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJMiniDockFrameWnd.h File Reference

WinCvs/CJLib/Include/CJMiniDockFrameWnd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJMiniDockFrameWnd

Generated on Sun Oct 21 12:45:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJOutlookBar.h File Reference

WinCvs/CJLib/Include/CJOutlookBar.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJOutlookBar
class | CContentItems

Defines

#define | OBN_SELENDOK (WM_USER + 1)
#define | OB_CYBUTTON 70

Define Documentation

#define OBN_SELENDOK (WM_USER + 1)

Definition at line 219 of file CJOutlookBar.h.

#define OB_CYBUTTON 70

Definition at line 220 of file CJOutlookBar.h.

Generated on Sun Oct 21 12:45:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJPagerCtrl.h File Reference

WinCvs/CJLib/Include/CJPagerCtrl.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJPagerCtrl

Generated on Sun Oct 21 12:45:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJReBar.h File Reference

WinCvs/CJLib/Include/CJReBar.h File Reference

#include "CJToolBarBase.h"

Include dependency graph for CJReBar.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJReBar

Defines

#define | AFX_IDW_REBAR 0xE804
#define | AFX_IDW_DIALOGBAR 0xE805

Define Documentation

#define AFX_IDW_DIALOGBAR 0xE805

Definition at line 61 of file CJReBar.h.

#define AFX_IDW_REBAR 0xE804

Definition at line 60 of file CJReBar.h.

Generated on Sun Oct 21 12:45:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJReBarCtrl.h File Reference

WinCvs/CJLib/Include/CJReBarCtrl.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJReBarCtrl

Generated on Sun Oct 21 12:45:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJResource.h File Reference

WinCvs/CJLib/Include/CJResource.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | IDR_POPUP_HEX_EDIT 103
#define | IDS_HIDE 5000
#define | IDC_NODRAGGING 5001
#define | IDS_NAME 5001
#define | IDS_EXPAND 5002
#define | IDC_DRAGGING 5003
#define | IDS_SIZE 5003
#define | IDS_CONTRACT 5004
#define | IDC_HANDCUR 5005
#define | IDS_TYPE 5005
#define | IDB_BUTTON_IMAGES 5006
#define | IDS_MODIFIED 5006
#define | IDC_TAB_CONTROL 5007
#define | IDS_REGKEY 5007
#define | IDR_CBAR_POPUP 5008
#define | IDS_INVALID_VER 5008
#define | IDC_URL_CODEJOCKEY 5009
#define | IDS_WIN_PLACEMENT 5009
#define | IDB_BTN_EXPLORER 5010
#define | IDS_COLOR_AUTO 5010
#define | IDM_CBAR_MENU 5011
#define | IDS_COLOR_CUST 5011
#define | IDC_BUTTON_HIDE 5012
#define | IDS_SECTION 5012
#define | IDC_BUTTON_MINI 5013
#define | IDS_ENTRY 5013
#define | IDC_BAR_BUTTON 5014
#define | IDS_REMOVEITEM 5014
#define | IDC_BAR_CAPTION 5015
#define | IDS_RENAMEITEM 5015
#define | IDB_BTN_ARROW 5016
#define | ID_GFX_LARGEICON 5017
#define | ID_GFX_SMALLICON 5018
#define | ID_GFX_REMOVEITEM 5019
#define | IDC_VSPLITBAR 5020
#define | ID_GFX_RENAMEITEM 5021
#define | IDC_HSPLITBAR 5022
#define | IDR_GFXOUTBAR 5023
#define | IDR_POPUP_TOOLBAR 5024
#define | IDS_SETTINGS 5025
#define | IDS_TBAR_SETTINGS 5026
#define | ID_POPUP_CUSTOMIZE 5027
#define | IDS_WNDPOS 5028
#define | IDC_CAPT_BUTTON 5029
#define | IDB_PUSHPIN 5030
#define | IDC_LEFTBUTTON 5031
#define | IDC_RIGHTBUTTON 5032
#define | IDC_HOMEBUTTON 5033
#define | IDC_ENDBUTTON 5034

Define Documentation

#define IDB_BTN_ARROW 5016

Definition at line 35 of file CJResource.h.

#define IDB_BTN_EXPLORER 5010

Definition at line 23 of file CJResource.h.

#define IDB_BUTTON_IMAGES 5006

Definition at line 15 of file CJResource.h.

#define IDB_PUSHPIN 5030

Definition at line 49 of file CJResource.h.

#define IDC_BAR_BUTTON 5014

Definition at line 31 of file CJResource.h.

#define IDC_BAR_CAPTION 5015

Definition at line 33 of file CJResource.h.

#define IDC_BUTTON_HIDE 5012

Definition at line 27 of file CJResource.h.

#define IDC_BUTTON_MINI 5013

Definition at line 29 of file CJResource.h.

#define IDC_CAPT_BUTTON 5029

Definition at line 48 of file CJResource.h.

#define IDC_DRAGGING 5003

Definition at line 10 of file CJResource.h.

#define IDC_ENDBUTTON 5034

Definition at line 53 of file CJResource.h.

#define IDC_HANDCUR 5005

Definition at line 13 of file CJResource.h.

#define IDC_HOMEBUTTON 5033

Definition at line 52 of file CJResource.h.

#define IDC_HSPLITBAR 5022

Definition at line 41 of file CJResource.h.

#define IDC_LEFTBUTTON 5031

Definition at line 50 of file CJResource.h.

#define IDC_NODRAGGING 5001

Definition at line 7 of file CJResource.h.

#define IDC_RIGHTBUTTON 5032

Definition at line 51 of file CJResource.h.

#define IDC_TAB_CONTROL 5007

Definition at line 17 of file CJResource.h.

#define IDC_URL_CODEJOCKEY 5009

Definition at line 21 of file CJResource.h.

#define IDC_VSPLITBAR 5020

Definition at line 39 of file CJResource.h.

#define IDM_CBAR_MENU 5011

Definition at line 25 of file CJResource.h.

#define IDR_CBAR_POPUP 5008

Definition at line 19 of file CJResource.h.

#define IDR_GFXOUTBAR 5023

Definition at line 42 of file CJResource.h.

#define IDR_POPUP_HEX_EDIT 103

Definition at line 5 of file CJResource.h.

#define IDR_POPUP_TOOLBAR 5024

Definition at line 43 of file CJResource.h.

#define IDS_COLOR_AUTO 5010

Definition at line 24 of file CJResource.h.

#define IDS_COLOR_CUST 5011

Definition at line 26 of file CJResource.h.

#define IDS_CONTRACT 5004

Definition at line 12 of file CJResource.h.

#define IDS_ENTRY 5013

Definition at line 30 of file CJResource.h.

#define IDS_EXPAND 5002

Definition at line 9 of file CJResource.h.

#define IDS_HIDE 5000

Definition at line 6 of file CJResource.h.

#define IDS_INVALID_VER 5008

Definition at line 20 of file CJResource.h.

#define IDS_MODIFIED 5006

Definition at line 16 of file CJResource.h.

#define IDS_NAME 5001

Definition at line 8 of file CJResource.h.

#define IDS_REGKEY 5007

Definition at line 18 of file CJResource.h.

#define IDS_REMOVEITEM 5014

Definition at line 32 of file CJResource.h.

#define IDS_RENAMEITEM 5015

Definition at line 34 of file CJResource.h.

#define IDS_SECTION 5012

Definition at line 28 of file CJResource.h.

#define IDS_SETTINGS 5025

Definition at line 44 of file CJResource.h.

#define IDS_SIZE 5003

Definition at line 11 of file CJResource.h.

#define IDS_TBAR_SETTINGS 5026

Definition at line 45 of file CJResource.h.

#define IDS_TYPE 5005

Definition at line 14 of file CJResource.h.

#define IDS_WIN_PLACEMENT 5009

Definition at line 22 of file CJResource.h.

#define IDS_WNDPOS 5028

Definition at line 47 of file CJResource.h.

#define ID_GFX_LARGEICON 5017

Definition at line 36 of file CJResource.h.

#define ID_GFX_REMOVEITEM 5019

Definition at line 38 of file CJResource.h.

#define ID_GFX_RENAMEITEM 5021

Definition at line 40 of file CJResource.h.

#define ID_GFX_SMALLICON 5018

Definition at line 37 of file CJResource.h.

#define ID_POPUP_CUSTOMIZE 5027

Definition at line 46 of file CJResource.h.

Generated on Sun Oct 21 12:45:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJShell.h File Reference

WinCvs/CJLib/Include/CJShell.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJShellList.h File Reference

WinCvs/CJLib/Include/CJShellList.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJShellTree.h File Reference

WinCvs/CJLib/Include/CJShellTree.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJSizeDockBar.h File Reference

WinCvs/CJLib/Include/CJSizeDockBar.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJSizeDockBar

Generated on Sun Oct 21 12:45:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJSortClass.h File Reference

WinCvs/CJLib/Include/CJSortClass.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJSortClass
struct | CCJSortClass::CSortItem

Enumerations

enum | DATA_TYPE { DT_INT = 1, DT_STRING, DT_DATETIME, DT_DEC }

Enumeration Type Documentation

enum DATA_TYPE

Enumeration values:
DT_INT
DT_STRING
DT_DATETIME
DT_DEC

Definition at line 38 of file CJSortClass.h.

00039 {
00040     DT_INT = 1,     // sort type int
00041     DT_STRING,      // sort type string
00042     DT_DATETIME,    // sort type date / time
00043     DT_DEC          // sort type decimal
00044 };

Generated on Sun Oct 21 12:45:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJStatusBar.h File Reference

WinCvs/CJLib/Include/CJStatusBar.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJStatusBar
class | CCJStatusBarPane
class | CCJStatusBarPaneControlInfo

Generated on Sun Oct 21 12:45:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJTabCtrl.h File Reference

WinCvs/CJLib/Include/CJTabCtrl.h File Reference

#include "CJMenu.h"

Include dependency graph for CJTabCtrl.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJTabCtrl

Generated on Sun Oct 21 12:45:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJTabCtrlBar.h File Reference

WinCvs/CJLib/Include/CJTabCtrlBar.h File Reference

#include <afxtempl.h>
#include "CJControlBar.h"
#include "CJTabCtrl.h"

Include dependency graph for CJTabCtrlBar.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJTabCtrlBar
struct | tagTCB_ITEM

Typedefs

typedef tagTCB_ITEM | TCB_ITEM
typedef CList< TCB_ITEM *,
TCB_ITEM *> 		CTabViews

Typedef Documentation

typedef CList<TCB_ITEM *,TCB_ITEM *> CTabViews

Definition at line 179 of file CJTabCtrlBar.h.

typedef struct tagTCB_ITEM TCB_ITEM

Generated on Sun Oct 21 12:45:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJTabView.h File Reference

WinCvs/CJLib/Include/CJTabView.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJTabView
struct | tagCTV_ITEM

Defines

#define | TABVIEW_BORDER 3

Typedefs

typedef tagCTV_ITEM | CTV_ITEM
typedef CList< CTV_ITEM *,
CTV_ITEM *> 		CListViews

Define Documentation

#define TABVIEW_BORDER 3

Definition at line 52 of file CJTabView.h.

Typedef Documentation

typedef CList<CTV_ITEM*, CTV_ITEM *> CListViews

Definition at line 55 of file CJTabView.h.

typedef struct tagCTV_ITEM CTV_ITEM

Generated on Sun Oct 21 12:45:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJToolBar.h File Reference

WinCvs/CJLib/Include/CJToolBar.h File Reference

#include "CJToolBarBase.h"
#include "CJToolBarCtrl.h"

Include dependency graph for CJToolBar.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJToolBar
struct | DROPDOWNBUTTON
struct | TOOLBARINFO

Defines

#define | VERSION_WIN4 MAKELONG(0, 4)
#define | VERSION_IE3 MAKELONG(70, 4)
#define | VERSION_IE4 MAKELONG(71, 4)
#define | VERSION_IE401 MAKELONG(72, 4)
#define | TBBS_BUTTON MAKELONG(TBSTYLE_BUTTON, 0)
#define | TBBS_SEPARATOR MAKELONG(TBSTYLE_SEP, 0)
#define | TBBS_CHECKBOX MAKELONG(TBSTYLE_CHECK, 0)
#define | TBBS_GROUP MAKELONG(TBSTYLE_GROUP, 0)
#define | TBBS_CHECKGROUP (TBBS_GROUP|TBBS_CHECKBOX)
#define | TBBS_DROPDOWN MAKELONG(TBSTYLE_DROPDOWN, 0)
#define | TBBS_AUTOSIZE MAKELONG(TBSTYLE_AUTOSIZE, 0)
#define | TBBS_NOPREFIX MAKELONG(TBSTYLE_NOPREFIX, 0)
#define | TBBS_CHECKED MAKELONG(0, TBSTATE_CHECKED)
#define | TBBS_PRESSED MAKELONG(0, TBSTATE_PRESSED)
#define | TBBS_DISABLED MAKELONG(0, TBSTATE_ENABLED)
#define | TBBS_INDETERMINATE MAKELONG(0, TBSTATE_INDETERMINATE)
#define | TBBS_HIDDEN MAKELONG(0, TBSTATE_HIDDEN)
#define | TBBS_WRAPPED MAKELONG(0, TBSTATE_WRAP)
#define | TBBS_ELLIPSES MAKELONG(0, TBSTATE_ELIPSES)
#define | TBBS_MARKED MAKELONG(0, TBSTATE_MARKED)

Functions

DWORD AFXAPI | _GetComCtlVersion ()
HBITMAP AFXAPI | _LoadSysColorBitmap (HINSTANCE hInst, HRSRC hRsrc, BOOL bMono=FALSE)

Variables

int | _ComCtlVersion

Define Documentation

#define TBBS_AUTOSIZE MAKELONG(TBSTYLE_AUTOSIZE, 0)

Definition at line 501 of file CJToolBar.h.

#define TBBS_BUTTON MAKELONG(TBSTYLE_BUTTON, 0)

Definition at line 495 of file CJToolBar.h.

#define TBBS_CHECKBOX MAKELONG(TBSTYLE_CHECK, 0)

Definition at line 497 of file CJToolBar.h.

#define TBBS_CHECKED MAKELONG(0, TBSTATE_CHECKED)

Definition at line 505 of file CJToolBar.h.

#define TBBS_CHECKGROUP (TBBS_GROUP|TBBS_CHECKBOX)

Definition at line 499 of file CJToolBar.h.

#define TBBS_DISABLED MAKELONG(0, TBSTATE_ENABLED)

Definition at line 507 of file CJToolBar.h.

#define TBBS_DROPDOWN MAKELONG(TBSTYLE_DROPDOWN, 0)

Definition at line 500 of file CJToolBar.h.

#define TBBS_ELLIPSES MAKELONG(0, TBSTATE_ELIPSES)

Definition at line 511 of file CJToolBar.h.

#define TBBS_GROUP MAKELONG(TBSTYLE_GROUP, 0)

Definition at line 498 of file CJToolBar.h.

#define TBBS_HIDDEN MAKELONG(0, TBSTATE_HIDDEN)

Definition at line 509 of file CJToolBar.h.

#define TBBS_INDETERMINATE MAKELONG(0, TBSTATE_INDETERMINATE)

Definition at line 508 of file CJToolBar.h.

#define TBBS_MARKED MAKELONG(0, TBSTATE_MARKED)

Definition at line 512 of file CJToolBar.h.

#define TBBS_NOPREFIX MAKELONG(TBSTYLE_NOPREFIX, 0)

Definition at line 502 of file CJToolBar.h.

#define TBBS_PRESSED MAKELONG(0, TBSTATE_PRESSED)

Definition at line 506 of file CJToolBar.h.

#define TBBS_SEPARATOR MAKELONG(TBSTYLE_SEP, 0)

Definition at line 496 of file CJToolBar.h.

#define TBBS_WRAPPED MAKELONG(0, TBSTATE_WRAP)

Definition at line 510 of file CJToolBar.h.

#define VERSION_IE3 MAKELONG(70, 4)

Definition at line 78 of file CJToolBar.h.

#define VERSION_IE4 MAKELONG(71, 4)

Definition at line 79 of file CJToolBar.h.

#define VERSION_IE401 MAKELONG(72, 4)

Definition at line 80 of file CJToolBar.h.

#define VERSION_WIN4 MAKELONG(0, 4)

Definition at line 77 of file CJToolBar.h.

Function Documentation

DWORD AFXAPI _GetComCtlVersion ( )

Definition at line 229 of file CJToolBar.cpp.

00230 {
00231     // return cached version if already determined...
00232     if (_ComCtlVersion != -1)
00233         return _ComCtlVersion;
00234
00235     // otherwise determine comctl32.dll version via DllGetVersion
00236     HINSTANCE hInst = ::GetModuleHandleA("COMCTL32.DLL");
00237     ASSERT(hInst != NULL);
00238     AFX_DLLGETVERSIONPROC pfn;
00239     pfn = (AFX_DLLGETVERSIONPROC)GetProcAddress(hInst, "DllGetVersion");
00240     DWORD dwVersion = VERSION_WIN4;
00241     if (pfn != NULL)
00242     {
00243         AFX_DLLVERSIONINFO dvi;
00244         memset(&dvi, 0, sizeof(dvi));
00245         dvi.cbSize = sizeof(dvi);
00246         HRESULT hr = (*pfn)(&dvi);
00247         if (SUCCEEDED(hr))
00248         {
00249             ASSERT(dvi.dwMajorVersion <= 0xFFFF);
00250             ASSERT(dvi.dwMinorVersion <= 0xFFFF);
00251             dwVersion = MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion);
00252         }
00253     }
00254     _ComCtlVersion = dwVersion;
00255     return dwVersion;
00256 }

HBITMAP AFXAPI _LoadSysColorBitmap | ( | HINSTANCE | hInst,
 |  | HRSRC | hRsrc,
 |  | BOOL | bMono = FALSE
 | ) |

Definition at line 141 of file CJToolBar.cpp.

Referenced by CCJToolBar::LoadBitmap(), and CCJToolBar::OnSysColorChange().

00142 {
00143     HGLOBAL hglb;
00144     if ((hglb = LoadResource(hInst, hRsrc)) == NULL)
00145         return NULL;
00146
00147     LPBITMAPINFOHEADER lpBitmap = (LPBITMAPINFOHEADER)LockResource(hglb);
00148     if (lpBitmap == NULL)
00149         return NULL;
00150
00151     // make copy of BITMAPINFOHEADER so we can modify the color table
00152     const int nColorTableSize = 16;
00153     UINT nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
00154     LPBITMAPINFOHEADER lpBitmapInfo = (LPBITMAPINFOHEADER)::malloc(nSize);
00155     if (lpBitmapInfo == NULL)
00156         return NULL;
00157     memcpy(lpBitmapInfo, lpBitmap, nSize);
00158
00159     // color table is in RGBQUAD DIB format
00160     DWORD* pColorTable =
00161         (DWORD*)(((LPBYTE)lpBitmapInfo) + (UINT)lpBitmapInfo->biSize);
00162
00163     for (int iColor = 0; iColor < nColorTableSize; iColor++)
00164     {
00165         // look for matching RGBQUAD color in original
00166         for (int i = 0; i < _countof(_sysColorMap); i++)
00167         {
00168             if (pColorTable[iColor] == _sysColorMap[i].rgbqFrom)
00169             {
00170                 if (bMono)
00171                 {
00172                     // all colors except text become white
00173                     if (_sysColorMap[i].iSysColorTo != COLOR_BTNTEXT)
00174                         pColorTable[iColor] = _RGB_TO_RGBQUAD(255, 255, 255);
00175                 }
00176                 else
00177                     pColorTable[iColor] =
00178                     _CLR_TO_RGBQUAD(::GetSysColor(_sysColorMap[i].iSysColorTo));
00179                 break;
00180             }
00181         }
00182     }
00183
00184     int nWidth = (int)lpBitmapInfo->biWidth;
00185     int nHeight = (int)lpBitmapInfo->biHeight;
00186     HDC hDCScreen = ::GetDC(NULL);
00187     HBITMAP hbm = ::CreateCompatibleBitmap(hDCScreen, nWidth, nHeight);
00188
00189     if (hbm != NULL)
00190     {
00191         HDC hDCGlyphs = ::CreateCompatibleDC(hDCScreen);
00192         HBITMAP hbmOld = (HBITMAP)::SelectObject(hDCGlyphs, hbm);
00193
00194         LPBYTE lpBits;
00195         lpBits = (LPBYTE)(lpBitmap + 1);
00196         lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
00197
00198         StretchDIBits(hDCGlyphs, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
00199             lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS, SRCCOPY);
00200         SelectObject(hDCGlyphs, hbmOld);
00201         ::DeleteDC(hDCGlyphs);
00202     }
00203     ::ReleaseDC(NULL, hDCScreen);
00204
00205     // free copy of bitmap info struct and resource itself
00206     ::free(lpBitmapInfo);
00207     ::FreeResource(hglb);
00208
00209     return hbm;
00210 }

Variable Documentation

int _ComCtlVersion

Definition at line 82 of file CJToolBar.h.

Generated on Sun Oct 21 12:45:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJToolBarBase.h File Reference

WinCvs/CJLib/Include/CJToolBarBase.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJToolBarBase
struct | tagAFX_OLDTOOLINFO

Defines

#define | CBRS_GRIPPER 0x00400000L

Typedefs

typedef tagAFX_OLDTOOLINFO | AFX_OLDTOOLINFO

Define Documentation

#define CBRS_GRIPPER 0x00400000L

Definition at line 69 of file CJToolBarBase.h.

Typedef Documentation

typedef struct tagAFX_OLDTOOLINFO AFX_OLDTOOLINFO

Generated on Sun Oct 21 12:45:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJToolBarCtrl.h File Reference

WinCvs/CJLib/Include/CJToolBarCtrl.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJToolBarCtrl

Generated on Sun Oct 21 12:45:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJTreeCtrl.h File Reference

WinCvs/CJLib/Include/CJTreeCtrl.h File Reference

#include <afxtempl.h>

Include dependency graph for CJTreeCtrl.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CCJTreeCtrl
struct | CCJTreeCtrl::Color_Font

Generated on Sun Oct 21 12:45:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJWindowPlacement.h File Reference

WinCvs/CJLib/Include/CJWindowPlacement.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CCJWindowPlacement

Generated on Sun Oct 21 12:45:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GfxGroupEdit.h File Reference

WinCvs/CJLib/Include/GfxGroupEdit.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CGfxGroupEdit

Generated on Sun Oct 21 12:45:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GfxOutBarCtrl.h File Reference

WinCvs/CJLib/Include/GfxOutBarCtrl.h File Reference

#include <afxcoll.h>
#include "CJMenu.h"

Include dependency graph for GfxOutBarCtrl.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CGfxOutBarCtrl::CBarFolder
class | CGfxOutBarCtrl::CBarItem
class | CGfxOutBarCtrl
struct | OUTBAR_INFO

Defines

#define | WM_OUTBAR_NOTIFY WM_USER + 1
#define | NM_OB_ITEMCLICK 1
#define | NM_OB_ONLABELENDEDIT 2
#define | NM_OB_ONGROUPENDEDIT 3
#define | NM_OB_DRAGITEM 4
#define | NM_FOLDERCHANGE 5
#define | NM_OB_ITEMHOVER 6

Define Documentation

#define NM_FOLDERCHANGE 5

Definition at line 47 of file GfxOutBarCtrl.h.

#define NM_OB_DRAGITEM 4

Definition at line 46 of file GfxOutBarCtrl.h.

#define NM_OB_ITEMCLICK 1

Definition at line 43 of file GfxOutBarCtrl.h.

#define NM_OB_ITEMHOVER 6

Definition at line 48 of file GfxOutBarCtrl.h.

#define NM_OB_ONGROUPENDEDIT 3

Definition at line 45 of file GfxOutBarCtrl.h.

#define NM_OB_ONLABELENDEDIT 2

Definition at line 44 of file GfxOutBarCtrl.h.

#define WM_OUTBAR_NOTIFY WM_USER + 1

Definition at line 42 of file GfxOutBarCtrl.h.

Generated on Sun Oct 21 12:45:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GfxSplitterWnd.h File Reference

WinCvs/CJLib/Include/GfxSplitterWnd.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CGfxSplitterWnd

Generated on Sun Oct 21 12:45:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Subclass.h File Reference

WinCvs/CJLib/Include/Subclass.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CSubclassWnd

Generated on Sun Oct 21 12:45:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs_coworker.h File Reference

WinCvs/CoWorker/cvs_coworker.h File Reference

#include "rpc.h"
#include "rpcndr.h"
#include "windows.h"
#include "ole2.h"
#include "oaidl.h"
#include "ocidl.h"

Include dependency graph for cvs_coworker.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | __REQUIRED_RPCNDR_H_VERSION__ 440

Typedefs

typedef interface ICvsCoworker | ICvsCoworker
typedef CvsCoworker | CvsCoworker
typedef enum CvsOption | CvsOption
typedef enum CvsCommand | CvsCommand

Enumerations

enum | CvsOption { cvsOptionCompareContents = 1, cvsOptionCompareChecksum = 2, cvsOptionCompareTimestamp = 3 }
enum CvsCommand {
cvsCommandUpdate = 0, cvsCommandCheckout = 1, cvsCommandCheckin = 2, cvsCommandUncheckout = 3,
cvsCommandAdd = 4, cvsCommandRemove = 5, cvsCommandDiff = 6, cvsCommandHistory = 7,
cvsCommandRename = 8, cvsCommandProperties = 9, cvsCommandOptions = 10
}

Functions

void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *)
virtual HRESULT STDMETHODCALLTYPE | GetErrorMessage (int handle, int iError, int cbErrorBuffer, unsigned char __RPC_FAR *sErrorBuffer)=0
virtual HRESULT STDMETHODCALLTYPE | OpenProject (int __RPC_FAR *pHandle, const unsigned char __RPC_FAR *sUsername, const unsigned char __RPC_FAR *sProjectName, const unsigned char __RPC_FAR *sProjectHome)=0
virtual HRESULT STDMETHODCALLTYPE | GetProject (int __RPC_FAR *pHandle, const unsigned char __RPC_FAR *sUsername, int cbProjectNameBuffer, unsigned char __RPC_FAR *sProjectName, int cbProjectHomeBuffer, unsigned char __RPC_FAR *sProjectHome, BOOL bAllowPathChange, BOOL bAllowNewProject, BOOL __RPC_FAR *pbNewProject)=0
virtual HRESULT STDMETHODCALLTYPE | UpdateFiles (int handle, const unsigned char __RPC_FAR *sFilenames, BOOL bDirectories, BOOL bRecurse)=0
virtual HRESULT STDMETHODCALLTYPE | CheckoutFiles (int handle, const unsigned char __RPC_FAR *sFilenames)=0
virtual HRESULT STDMETHODCALLTYPE | CheckinFiles (int handle, const unsigned char __RPC_FAR *sFilenames, BOOL bKeepCheckedOut)=0
virtual HRESULT STDMETHODCALLTYPE | UncheckoutFiles (int handle, const unsigned char __RPC_FAR *sFilenames)=0
virtual HRESULT STDMETHODCALLTYPE | AddFiles (int handle, const unsigned char __RPC_FAR *sOptionsAndFilenames, const unsigned char __RPC_FAR *sComment)=0
virtual HRESULT STDMETHODCALLTYPE | RemoveFiles (int handle, const unsigned char __RPC_FAR *sFilenames)=0
virtual HRESULT STDMETHODCALLTYPE | RenameFile (int handle, const unsigned char __RPC_FAR *sOldFilename, const unsigned char __RPC_FAR *sNewFilename)=0
virtual HRESULT STDMETHODCALLTYPE | DiffFile (int handle, const unsigned char __RPC_FAR *sFilename, BOOL bIgnoreCase, BOOL bIgnoreBlanks)=0
virtual HRESULT STDMETHODCALLTYPE | ShowFileHistory (int handle, const unsigned char __RPC_FAR *sFilenames)=0
virtual HRESULT STDMETHODCALLTYPE | ShowFileProperties (int handle, const unsigned char __RPC_FAR *sFilename)=0
virtual HRESULT STDMETHODCALLTYPE | ShowUserInterface (int handle, const unsigned char __RPC_FAR *sFilenames)=0
virtual HRESULT STDMETHODCALLTYPE | HasAdvancedOptionsForCommand (int handle, CvsCommand command, BOOL __RPC_FAR *pbAdvancedOptions)=0
virtual HRESULT STDMETHODCALLTYPE | ShowAdvancedOptionsForCommand (int handle, CvsCommand command)=0
virtual HRESULT STDMETHODCALLTYPE | GetFileChanges (int handle, int cbFilenameBuffer, unsigned char __RPC_FAR *sFilenameBuffer)=0
virtual HRESULT STDMETHODCALLTYPE | GetFilesToAdd (int handle, int cbFilenamesBuffer, unsigned char __RPC_FAR *sFilenamesBuffer)=0
virtual HRESULT STDMETHODCALLTYPE | CloseProject (int handle)=0
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetLastError_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int __RPC_FAR *piError)
void __RPC_STUB | ICvsCoworker_GetLastError_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetErrorMessage_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int iError, int cbErrorBuffer, unsigned char __RPC_FAR *sErrorBuffer)
void __RPC_STUB | ICvsCoworker_GetErrorMessage_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_OpenProject_Proxy (ICvsCoworker __RPC_FAR *This, int __RPC_FAR *pHandle, const unsigned char __RPC_FAR *sUsername, const unsigned char __RPC_FAR *sProjectName, const unsigned char __RPC_FAR *sProjectHome)
void __RPC_STUB | ICvsCoworker_OpenProject_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetProject_Proxy (ICvsCoworker __RPC_FAR *This, int __RPC_FAR *pHandle, const unsigned char __RPC_FAR *sUsername, int cbProjectNameBuffer, unsigned char __RPC_FAR *sProjectName, int cbProjectHomeBuffer, unsigned char __RPC_FAR *sProjectHome, BOOL bAllowPathChange, BOOL bAllowNewProject, BOOL __RPC_FAR *pbNewProject)
void __RPC_STUB | ICvsCoworker_GetProject_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_UpdateFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames, BOOL bDirectories, BOOL bRecurse)
void __RPC_STUB | ICvsCoworker_UpdateFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_CheckoutFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_CheckoutFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_CheckinFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames, BOOL bKeepCheckedOut)
void __RPC_STUB | ICvsCoworker_CheckinFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_UncheckoutFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_UncheckoutFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_AddFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sOptionsAndFilenames, const unsigned char __RPC_FAR *sComment)
void __RPC_STUB | ICvsCoworker_AddFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_RemoveFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_RemoveFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_RenameFile_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sOldFilename, const unsigned char __RPC_FAR *sNewFilename)
void __RPC_STUB | ICvsCoworker_RenameFile_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_DiffFile_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilename, BOOL bIgnoreCase, BOOL bIgnoreBlanks)
void __RPC_STUB | ICvsCoworker_DiffFile_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowFileHistory_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_ShowFileHistory_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowFileProperties_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilename)
void __RPC_STUB | ICvsCoworker_ShowFileProperties_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowUserInterface_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_ShowUserInterface_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_HasAdvancedOptionsForCommand_Proxy (ICvsCoworker __RPC_FAR *This, int handle, CvsCommand command, BOOL __RPC_FAR *pbAdvancedOptions)
void __RPC_STUB | ICvsCoworker_HasAdvancedOptionsForCommand_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy (ICvsCoworker __RPC_FAR *This, int handle, CvsCommand command)
void __RPC_STUB | ICvsCoworker_ShowAdvancedOptionsForCommand_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetFileChanges_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int cbFilenameBuffer, unsigned char __RPC_FAR *sFilenameBuffer)
void __RPC_STUB | ICvsCoworker_GetFileChanges_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetFilesToAdd_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int cbFilenamesBuffer, unsigned char __RPC_FAR *sFilenamesBuffer)
void __RPC_STUB | ICvsCoworker_GetFilesToAdd_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_CloseProject_Proxy (ICvsCoworker __RPC_FAR *This, int handle)
void __RPC_STUB | ICvsCoworker_CloseProject_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
class | DECLSPEC_UUID ("10E5359D-F454-11D2-B442-0080C6F9179D") CvsCoworker

Variables

RPC_IF_HANDLE | __MIDL_itf_cvs_coworker_0000_v0_0_c_ifspec
RPC_IF_HANDLE | __MIDL_itf_cvs_coworker_0000_v0_0_s_ifspec
EXTERN_C const IID | IID_ICvsCoworker
ICvsCoworker __pad13__
ICvsCoworker int __RPC_FAR * | piError = 0
EXTERN_C const IID | LIBID_CVS_COWORKERLib
EXTERN_C const CLSID | CLSID_CvsCoworker

Define Documentation

#define __REQUIRED_RPCNDR_H_VERSION__ 440

Definition at line 16 of file cvs_coworker.h.

Typedef Documentation

typedef enum CvsCommand CvsCommand

typedef class CvsCoworker CvsCoworker

Definition at line 50 of file cvs_coworker.h.

typedef enum CvsOption CvsOption

typedef interface ICvsCoworker ICvsCoworker

Definition at line 42 of file cvs_coworker.h.

Enumeration Type Documentation

enum CvsCommand

Enumeration values:
cvsCommandUpdate
cvsCommandCheckout
cvsCommandCheckin
cvsCommandUncheckout
cvsCommandAdd
cvsCommandRemove
cvsCommandDiff
cvsCommandHistory
cvsCommandRename
cvsCommandProperties
cvsCommandOptions

Definition at line 76 of file cvs_coworker.h.

00077     {   cvsCommandUpdate    = 0,
00078     cvsCommandCheckout  = 1,
00079     cvsCommandCheckin   = 2,
00080     cvsCommandUncheckout    = 3,
00081     cvsCommandAdd   = 4,
00082     cvsCommandRemove    = 5,
00083     cvsCommandDiff  = 6,
00084     cvsCommandHistory   = 7,
00085     cvsCommandRename    = 8,
00086     cvsCommandProperties    = 9,
00087     cvsCommandOptions   = 10
00088     }   CvsCommand;

enum CvsOption

Enumeration values:
cvsOptionCompareContents
cvsOptionCompareChecksum
cvsOptionCompareTimestamp

Definition at line 69 of file cvs_coworker.h.

00070     {   cvsOptionCompareContents    = 1,
00071     cvsOptionCompareChecksum    = 2,
00072     cvsOptionCompareTimestamp   = 3
00073     }   CvsOption;

Function Documentation

virtual HRESULT STDMETHODCALLTYPE AddFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sOptionsAndFilenames,
 |  | const unsigned char __RPC_FAR * | sComment
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE CheckinFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames,
 |  | BOOL | bKeepCheckedOut
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE CheckoutFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE CloseProject ( int handle ) [pure virtual]

class DECLSPEC_UUID ( "10E5359D-F454-11D2-B442-0080C6F9179D" )

virtual HRESULT STDMETHODCALLTYPE DiffFile | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilename,
 |  | BOOL | bIgnoreCase,
 |  | BOOL | bIgnoreBlanks
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE GetErrorMessage | ( | int | handle,
 |  | int | iError,
 |  | int | cbErrorBuffer,
 |  | unsigned char __RPC_FAR * | sErrorBuffer
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE GetFileChanges | ( | int | handle,
 |  | int | cbFilenameBuffer,
 |  | unsigned char __RPC_FAR * | sFilenameBuffer
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE GetFilesToAdd | ( | int | handle,
 |  | int | cbFilenamesBuffer,
 |  | unsigned char __RPC_FAR * | sFilenamesBuffer
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE GetProject | ( | int __RPC_FAR * | pHandle,
 |  | const unsigned char __RPC_FAR * | sUsername,
 |  | int | cbProjectNameBuffer,
 |  | unsigned char __RPC_FAR * | sProjectName,
 |  | int | cbProjectHomeBuffer,
 |  | unsigned char __RPC_FAR * | sProjectHome,
 |  | BOOL | bAllowPathChange,
 |  | BOOL | bAllowNewProject,
 |  | BOOL __RPC_FAR * | pbNewProject
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE HasAdvancedOptionsForCommand | ( | int | handle,
 |  | CvsCommand | command,
 |  | BOOL __RPC_FAR * | pbAdvancedOptions
 | ) | [pure virtual]

HRESULT STDMETHODCALLTYPE ICvsCoworker_AddFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sOptionsAndFilenames,
 |  | const unsigned char __RPC_FAR * | sComment
 | ) |

Definition at line 1306 of file CVS_Coworker_p.c.

01311 {
01312
01313     HRESULT _RetVal;
01314
01315     RPC_MESSAGE _RpcMessage;
01316
01317     MIDL_STUB_MESSAGE _StubMsg;
01318
01319     RpcTryExcept
01320         {
01321         NdrProxyInitialize(
01322                       ( void __RPC_FAR *  )This,
01323                       ( PRPC_MESSAGE  )&_RpcMessage,
01324                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01325                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01326                       11);
01327
01328
01329
01330         if(!sOptionsAndFilenames)
01331             {
01332             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01333             }
01334         if(!sComment)
01335             {
01336             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01337             }
01338         RpcTryFinally
01339             {
01340
01341             _StubMsg.BufferLength = 4U + 12U + 13U;
01342             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01343                                            (unsigned char __RPC_FAR *)sOptionsAndFilenames,
01344                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01345
01346             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01347                                            (unsigned char __RPC_FAR *)sComment,
01348                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01349
01350             NdrProxyGetBuffer(This, &_StubMsg);
01351             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01352
01353             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01354                                          (unsigned char __RPC_FAR *)sOptionsAndFilenames,
01355                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01356
01357             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01358                                          (unsigned char __RPC_FAR *)sComment,
01359                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01360
01361             NdrProxySendReceive(This, &_StubMsg);
01362
01363             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01364                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01365
01366             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01367
01368             }
01369         RpcFinally
01370             {
01371             NdrProxyFreeBuffer(This, &_StubMsg);
01372
01373             }
01374         RpcEndFinally
01375
01376         }
01377     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01378         {
01379         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01380         }
01381     RpcEndExcept
01382     return _RetVal;
01383 }

void __RPC_STUB ICvsCoworker_AddFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1385 of file CVS_Coworker_p.c.

01390 {
01391     HRESULT _RetVal;
01392     MIDL_STUB_MESSAGE _StubMsg;
01393     int handle;
01394     const unsigned char __RPC_FAR *sComment;
01395     const unsigned char __RPC_FAR *sOptionsAndFilenames;
01396
01397 NdrStubInitialize(
01398                      _pRpcMessage,
01399                      &_StubMsg,
01400                      &Object_StubDesc,
01401                      _pRpcChannelBuffer);
01402     ( unsigned char __RPC_FAR * )sOptionsAndFilenames = 0;
01403     ( unsigned char __RPC_FAR * )sComment = 0;
01404     RpcTryFinally
01405         {
01406         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01407             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01408
01409         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01410
01411         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01412                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sOptionsAndFilenames,
01413                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01414                                        (unsigned char)0 );
01415
01416         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01417                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sComment,
01418                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01419                                        (unsigned char)0 );
01420
01421
01422         *_pdwStubPhase = STUB_CALL_SERVER;
01423         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> AddFiles(
01424             (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01425             handle,
01426             sOptionsAndFilenames,
01427             sComment);
01428
01429         *_pdwStubPhase = STUB_MARSHAL;
01430
01431         _StubMsg.BufferLength = 4U;
01432         _StubMsg.BufferLength += 16;
01433
01434         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01435         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01436
01437         }
01438     RpcFinally
01439         {
01440         }
01441     RpcEndFinally
01442     _pRpcMessage->BufferLength =
01443         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01444
01445 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckinFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames,
 |  | BOOL | bKeepCheckedOut
 | ) |

Definition at line 1055 of file CVS_Coworker_p.c.

01060 {
01061
01062     HRESULT _RetVal;
01063
01064     RPC_MESSAGE _RpcMessage;
01065
01066     MIDL_STUB_MESSAGE _StubMsg;
01067
01068     RpcTryExcept
01069         {
01070         NdrProxyInitialize(
01071                       ( void __RPC_FAR *  )This,
01072                       ( PRPC_MESSAGE  )&_RpcMessage,
01073                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01074                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01075                       9);
01076
01077
01078
01079         if(!sFilenames)
01080             {
01081             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01082             }
01083         RpcTryFinally
01084             {
01085
01086             _StubMsg.BufferLength = 4U + 12U + 11U;
01087             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01088                                            (unsigned char __RPC_FAR *)sFilenames,
01089                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01090
01091             NdrProxyGetBuffer(This, &_StubMsg);
01092             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01093
01094             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01095                                          (unsigned char __RPC_FAR *)sFilenames,
01096                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01097
01098             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01099             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bKeepCheckedOut;
01100
01101             NdrProxySendReceive(This, &_StubMsg);
01102
01103             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01104                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[88] );
01105
01106             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01107
01108             }
01109         RpcFinally
01110             {
01111             NdrProxyFreeBuffer(This, &_StubMsg);
01112
01113             }
01114         RpcEndFinally
01115
01116         }
01117     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01118         {
01119         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01120         }
01121     RpcEndExcept
01122     return _RetVal;
01123 }

void __RPC_STUB ICvsCoworker_CheckinFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1125 of file CVS_Coworker_p.c.

01130 {
01131     HRESULT _RetVal;
01132     MIDL_STUB_MESSAGE _StubMsg;
01133     BOOL bKeepCheckedOut;
01134     int handle;
01135     const unsigned char __RPC_FAR *sFilenames;
01136
01137 NdrStubInitialize(
01138                      _pRpcMessage,
01139                      &_StubMsg,
01140                      &Object_StubDesc,
01141                      _pRpcChannelBuffer);
01142     ( unsigned char __RPC_FAR * )sFilenames = 0;
01143     RpcTryFinally
01144         {
01145         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01146             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[88] );
01147
01148         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01149
01150         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01151                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01152                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01153                                        (unsigned char)0 );
01154
01155         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01156         bKeepCheckedOut = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01157
01158
01159         *_pdwStubPhase = STUB_CALL_SERVER;
01160         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CheckinFiles(
01161                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01162                 handle,
01163                 sFilenames,
01164                 bKeepCheckedOut);
01165
01166         *_pdwStubPhase = STUB_MARSHAL;
01167
01168         _StubMsg.BufferLength = 4U;
01169         _StubMsg.BufferLength += 16;
01170
01171         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01172         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01173
01174         }
01175     RpcFinally
01176         {
01177         }
01178     RpcEndFinally
01179     _pRpcMessage->BufferLength =
01180         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01181
01182 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckoutFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 934 of file CVS_Coworker_p.c.

00938 {
00939
00940     HRESULT _RetVal;
00941
00942     RPC_MESSAGE _RpcMessage;
00943
00944     MIDL_STUB_MESSAGE _StubMsg;
00945
00946     RpcTryExcept
00947         {
00948         NdrProxyInitialize(
00949                       ( void __RPC_FAR *  )This,
00950                       ( PRPC_MESSAGE  )&_RpcMessage,
00951                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00952                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00953                       8);
00954
00955
00956
00957         if(!sFilenames)
00958             {
00959             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00960             }
00961         RpcTryFinally
00962             {
00963
00964             _StubMsg.BufferLength = 4U + 12U;
00965             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00966                                            (unsigned char __RPC_FAR *)sFilenames,
00967                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00968
00969             NdrProxyGetBuffer(This, &_StubMsg);
00970             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00971
00972             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00973                                          (unsigned char __RPC_FAR *)sFilenames,
00974                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00975
00976             NdrProxySendReceive(This, &_StubMsg);
00977
00978             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00979                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
00980
00981             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00982
00983             }
00984         RpcFinally
00985             {
00986             NdrProxyFreeBuffer(This, &_StubMsg);
00987
00988             }
00989         RpcEndFinally
00990
00991         }
00992     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00993         {
00994         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00995         }
00996     RpcEndExcept
00997     return _RetVal;
00998 }

void __RPC_STUB ICvsCoworker_CheckoutFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1000 of file CVS_Coworker_p.c.

01005 {
01006     HRESULT _RetVal;
01007     MIDL_STUB_MESSAGE _StubMsg;
01008     int handle;
01009     const unsigned char __RPC_FAR *sFilenames;
01010
01011 NdrStubInitialize(
01012                      _pRpcMessage,
01013                      &_StubMsg,
01014                      &Object_StubDesc,
01015                      _pRpcChannelBuffer);
01016     ( unsigned char __RPC_FAR * )sFilenames = 0;
01017     RpcTryFinally
01018         {
01019         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01020             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01021
01022         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01023
01024         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01025                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01026                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01027                                        (unsigned char)0 );
01028
01029
01030         *_pdwStubPhase = STUB_CALL_SERVER;
01031         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CheckoutFiles(
01032                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01033                  handle,
01034                  sFilenames);
01035
01036         *_pdwStubPhase = STUB_MARSHAL;
01037
01038         _StubMsg.BufferLength = 4U;
01039         _StubMsg.BufferLength += 16;
01040
01041         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01042         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01043
01044         }
01045     RpcFinally
01046         {
01047         }
01048     RpcEndFinally
01049     _pRpcMessage->BufferLength =
01050         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01051
01052 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_CloseProject_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle
 | ) |

Definition at line 2749 of file CVS_Coworker_p.c.

02752 {
02753
02754     HRESULT _RetVal;
02755
02756     RPC_MESSAGE _RpcMessage;
02757
02758     MIDL_STUB_MESSAGE _StubMsg;
02759
02760     RpcTryExcept
02761         {
02762         NdrProxyInitialize(
02763                       ( void __RPC_FAR *  )This,
02764                       ( PRPC_MESSAGE  )&_RpcMessage,
02765                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02766                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02767                       22);
02768
02769
02770
02771         RpcTryFinally
02772             {
02773
02774             _StubMsg.BufferLength = 4U;
02775             NdrProxyGetBuffer(This, &_StubMsg);
02776             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02777
02778             NdrProxySendReceive(This, &_StubMsg);
02779
02780             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02781                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[146] );
02782
02783             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02784
02785             }
02786         RpcFinally
02787             {
02788             NdrProxyFreeBuffer(This, &_StubMsg);
02789
02790             }
02791         RpcEndFinally
02792
02793         }
02794     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02795         {
02796         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02797         }
02798     RpcEndExcept
02799     return _RetVal;
02800 }

void __RPC_STUB ICvsCoworker_CloseProject_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2802 of file CVS_Coworker_p.c.

02807 {
02808     HRESULT _RetVal;
02809     MIDL_STUB_MESSAGE _StubMsg;
02810     int handle;
02811
02812 NdrStubInitialize(
02813                      _pRpcMessage,
02814                      &_StubMsg,
02815                      &Object_StubDesc,
02816                      _pRpcChannelBuffer);
02817     RpcTryFinally
02818         {
02819         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02820             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[146] );
02821
02822         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02823
02824
02825         *_pdwStubPhase = STUB_CALL_SERVER;
02826         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CloseProject((ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,handle);
02827
02828         *_pdwStubPhase = STUB_MARSHAL;
02829
02830         _StubMsg.BufferLength = 4U;
02831         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02832         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02833
02834         }
02835     RpcFinally
02836         {
02837         }
02838     RpcEndFinally
02839     _pRpcMessage->BufferLength =
02840         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02841
02842 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_DiffFile_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilename,
 |  | BOOL | bIgnoreCase,
 |  | BOOL | bIgnoreBlanks
 | ) |

Definition at line 1711 of file CVS_Coworker_p.c.

01717 {
01718
01719     HRESULT _RetVal;
01720
01721     RPC_MESSAGE _RpcMessage;
01722
01723     MIDL_STUB_MESSAGE _StubMsg;
01724
01725     RpcTryExcept
01726         {
01727         NdrProxyInitialize(
01728                       ( void __RPC_FAR *  )This,
01729                       ( PRPC_MESSAGE  )&_RpcMessage,
01730                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01731                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01732                       14);
01733
01734
01735
01736         if(!sFilename)
01737             {
01738             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01739             }
01740         RpcTryFinally
01741             {
01742
01743             _StubMsg.BufferLength = 4U + 12U + 11U + 7U;
01744             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01745                                            (unsigned char __RPC_FAR *)sFilename,
01746                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01747
01748             NdrProxyGetBuffer(This, &_StubMsg);
01749             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01750
01751             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01752                                          (unsigned char __RPC_FAR *)sFilename,
01753                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01754
01755             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01756             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bIgnoreCase;
01757
01758             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bIgnoreBlanks;
01759
01760             NdrProxySendReceive(This, &_StubMsg);
01761
01762             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01763                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
01764
01765             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01766
01767             }
01768         RpcFinally
01769             {
01770             NdrProxyFreeBuffer(This, &_StubMsg);
01771
01772             }
01773         RpcEndFinally
01774
01775         }
01776     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01777         {
01778         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01779         }
01780     RpcEndExcept
01781     return _RetVal;
01782 }

void __RPC_STUB ICvsCoworker_DiffFile_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1784 of file CVS_Coworker_p.c.

01789 {
01790     HRESULT _RetVal;
01791     MIDL_STUB_MESSAGE _StubMsg;
01792     BOOL bIgnoreBlanks;
01793     BOOL bIgnoreCase;
01794     int handle;
01795     const unsigned char __RPC_FAR *sFilename;
01796
01797 NdrStubInitialize(
01798                      _pRpcMessage,
01799                      &_StubMsg,
01800                      &Object_StubDesc,
01801                      _pRpcChannelBuffer);
01802     ( unsigned char __RPC_FAR * )sFilename = 0;
01803     RpcTryFinally
01804         {
01805         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01806             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
01807
01808         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01809
01810         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01811                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilename,
01812                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01813                                        (unsigned char)0 );
01814
01815         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01816         bIgnoreCase = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01817
01818         bIgnoreBlanks = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01819
01820
01821         *_pdwStubPhase = STUB_CALL_SERVER;
01822         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> DiffFile(
01823             (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01824             handle,
01825             sFilename,
01826             bIgnoreCase,
01827             bIgnoreBlanks);
01828
01829         *_pdwStubPhase = STUB_MARSHAL;
01830
01831         _StubMsg.BufferLength = 4U;
01832         _StubMsg.BufferLength += 16;
01833
01834         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01835         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01836
01837         }
01838     RpcFinally
01839         {
01840         }
01841     RpcEndFinally
01842     _pRpcMessage->BufferLength =
01843         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01844
01845 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetErrorMessage_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int | iError,
 |  | int | cbErrorBuffer,
 |  | unsigned char __RPC_FAR * | sErrorBuffer
 | ) |

Definition at line 181 of file CVS_Coworker_p.c.

00187 {
00188
00189     HRESULT _RetVal;
00190
00191     RPC_MESSAGE _RpcMessage;
00192
00193     MIDL_STUB_MESSAGE _StubMsg;
00194
00195     RpcTryExcept
00196         {
00197         NdrProxyInitialize(
00198                       ( void __RPC_FAR *  )This,
00199                       ( PRPC_MESSAGE  )&_RpcMessage,
00200                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00201                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00202                       4);
00203
00204
00205
00206         if(!sErrorBuffer)
00207             {
00208             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00209             }
00210         RpcTryFinally
00211             {
00212
00213             _StubMsg.BufferLength = 4U + 4U + 4U;
00214             NdrProxyGetBuffer(This, &_StubMsg);
00215             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00216
00217             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = iError;
00218
00219             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbErrorBuffer;
00220
00221             NdrProxySendReceive(This, &_StubMsg);
00222
00223             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00224                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[8] );
00225
00226             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00227                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sErrorBuffer,
00228                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10],
00229                                            (unsigned char)0 );
00230
00231             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00232             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00233
00234             }
00235         RpcFinally
00236             {
00237             NdrProxyFreeBuffer(This, &_StubMsg);
00238
00239             }
00240         RpcEndFinally
00241
00242         }
00243     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00244         {
00245         _StubMsg.MaxCount = cbErrorBuffer;
00246
00247         NdrClearOutParameters(
00248                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00249                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[6],
00250                          ( void __RPC_FAR * )sErrorBuffer);
00251         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00252         }
00253     RpcEndExcept
00254     return _RetVal;
00255 }

void __RPC_STUB ICvsCoworker_GetErrorMessage_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 257 of file CVS_Coworker_p.c.

00262 {
00263     HRESULT _RetVal;
00264     MIDL_STUB_MESSAGE _StubMsg;
00265     int cbErrorBuffer;
00266     int handle;
00267     int iError;
00268     unsigned char __RPC_FAR *sErrorBuffer;
00269
00270 NdrStubInitialize(
00271                      _pRpcMessage,
00272                      &_StubMsg,
00273                      &Object_StubDesc,
00274                      _pRpcChannelBuffer);
00275     ( unsigned char __RPC_FAR * )sErrorBuffer = 0;
00276     RpcTryFinally
00277         {
00278         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00279             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[8] );
00280
00281         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00282
00283         iError = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00284
00285         cbErrorBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00286
00287         if(cbErrorBuffer * 1 < 0)
00288             {
00289             RpcRaiseException(RPC_X_INVALID_BOUND);
00290             }
00291         sErrorBuffer = NdrAllocate(&_StubMsg,cbErrorBuffer * 1);
00292
00293         *_pdwStubPhase = STUB_CALL_SERVER;
00294         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetErrorMessage(
00295                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00296                    handle,
00297                    iError,
00298                    cbErrorBuffer,
00299                    sErrorBuffer);
00300
00301         *_pdwStubPhase = STUB_MARSHAL;
00302
00303         _StubMsg.BufferLength = 12U + 11U;
00304         _StubMsg.MaxCount = cbErrorBuffer;
00305
00306         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00307                                        (unsigned char __RPC_FAR *)sErrorBuffer,
00308                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10] );
00309
00310         _StubMsg.BufferLength += 16;
00311
00312         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00313         _StubMsg.MaxCount = cbErrorBuffer;
00314
00315         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00316                                      (unsigned char __RPC_FAR *)sErrorBuffer,
00317                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10] );
00318
00319         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00320         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00321
00322         }
00323     RpcFinally
00324         {
00325         _StubMsg.MaxCount = cbErrorBuffer;
00326
00327         NdrPointerFree( &_StubMsg,
00328                         (unsigned char __RPC_FAR *)sErrorBuffer,
00329                         &__MIDL_TypeFormatString.Format[6] );
00330
00331         }
00332     RpcEndFinally
00333     _pRpcMessage->BufferLength =
00334         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00335
00336 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFileChanges_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int | cbFilenameBuffer,
 |  | unsigned char __RPC_FAR * | sFilenameBuffer
 | ) |

Definition at line 2447 of file CVS_Coworker_p.c.

02452 {
02453
02454     HRESULT _RetVal;
02455
02456     RPC_MESSAGE _RpcMessage;
02457
02458     MIDL_STUB_MESSAGE _StubMsg;
02459
02460     RpcTryExcept
02461         {
02462         NdrProxyInitialize(
02463                       ( void __RPC_FAR *  )This,
02464                       ( PRPC_MESSAGE  )&_RpcMessage,
02465                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02466                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02467                       20);
02468
02469
02470
02471         if(!sFilenameBuffer)
02472             {
02473             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02474             }
02475         RpcTryFinally
02476             {
02477
02478             _StubMsg.BufferLength = 4U + 4U;
02479             NdrProxyGetBuffer(This, &_StubMsg);
02480             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02481
02482             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbFilenameBuffer;
02483
02484             NdrProxySendReceive(This, &_StubMsg);
02485
02486             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02487                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[126] );
02488
02489             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02490                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenameBuffer,
02491                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48],
02492                                            (unsigned char)0 );
02493
02494             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02495             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02496
02497             }
02498         RpcFinally
02499             {
02500             NdrProxyFreeBuffer(This, &_StubMsg);
02501
02502             }
02503         RpcEndFinally
02504
02505         }
02506     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02507         {
02508         _StubMsg.MaxCount = cbFilenameBuffer;
02509
02510         NdrClearOutParameters(
02511                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02512                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[44],
02513                          ( void __RPC_FAR * )sFilenameBuffer);
02514         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02515         }
02516     RpcEndExcept
02517     return _RetVal;
02518 }

void __RPC_STUB ICvsCoworker_GetFileChanges_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2520 of file CVS_Coworker_p.c.

02525 {
02526     HRESULT _RetVal;
02527     MIDL_STUB_MESSAGE _StubMsg;
02528     int cbFilenameBuffer;
02529     int handle;
02530     unsigned char __RPC_FAR *sFilenameBuffer;
02531
02532 NdrStubInitialize(
02533                      _pRpcMessage,
02534                      &_StubMsg,
02535                      &Object_StubDesc,
02536                      _pRpcChannelBuffer);
02537     ( unsigned char __RPC_FAR * )sFilenameBuffer = 0;
02538     RpcTryFinally
02539         {
02540         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02541             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[126] );
02542
02543         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02544
02545         cbFilenameBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02546
02547         if(cbFilenameBuffer * 1 < 0)
02548             {
02549             RpcRaiseException(RPC_X_INVALID_BOUND);
02550             }
02551         sFilenameBuffer = NdrAllocate(&_StubMsg,cbFilenameBuffer * 1);
02552
02553         *_pdwStubPhase = STUB_CALL_SERVER;
02554         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetFileChanges(
02555                   (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02556                   handle,
02557                   cbFilenameBuffer,
02558                   sFilenameBuffer);
02559
02560         *_pdwStubPhase = STUB_MARSHAL;
02561
02562         _StubMsg.BufferLength = 12U + 11U;
02563         _StubMsg.MaxCount = cbFilenameBuffer;
02564
02565         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02566                                        (unsigned char __RPC_FAR *)sFilenameBuffer,
02567                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48] );
02568
02569         _StubMsg.BufferLength += 16;
02570
02571         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02572         _StubMsg.MaxCount = cbFilenameBuffer;
02573
02574         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02575                                      (unsigned char __RPC_FAR *)sFilenameBuffer,
02576                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48] );
02577
02578         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02579         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02580
02581         }
02582     RpcFinally
02583         {
02584         _StubMsg.MaxCount = cbFilenameBuffer;
02585
02586         NdrPointerFree( &_StubMsg,
02587                         (unsigned char __RPC_FAR *)sFilenameBuffer,
02588                         &__MIDL_TypeFormatString.Format[44] );
02589
02590         }
02591     RpcEndFinally
02592     _pRpcMessage->BufferLength =
02593         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02594
02595 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFilesToAdd_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int | cbFilenamesBuffer,
 |  | unsigned char __RPC_FAR * | sFilenamesBuffer
 | ) |

Definition at line 2598 of file CVS_Coworker_p.c.

02603 {
02604
02605     HRESULT _RetVal;
02606
02607     RPC_MESSAGE _RpcMessage;
02608
02609     MIDL_STUB_MESSAGE _StubMsg;
02610
02611     RpcTryExcept
02612         {
02613         NdrProxyInitialize(
02614                       ( void __RPC_FAR *  )This,
02615                       ( PRPC_MESSAGE  )&_RpcMessage,
02616                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02617                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02618                       21);
02619
02620
02621
02622         if(!sFilenamesBuffer)
02623             {
02624             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02625             }
02626         RpcTryFinally
02627             {
02628
02629             _StubMsg.BufferLength = 4U + 4U;
02630             NdrProxyGetBuffer(This, &_StubMsg);
02631             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02632
02633             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbFilenamesBuffer;
02634
02635             NdrProxySendReceive(This, &_StubMsg);
02636
02637             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02638                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[136] );
02639
02640             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02641                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenamesBuffer,
02642                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58],
02643                                            (unsigned char)0 );
02644
02645             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02646             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02647
02648             }
02649         RpcFinally
02650             {
02651             NdrProxyFreeBuffer(This, &_StubMsg);
02652
02653             }
02654         RpcEndFinally
02655
02656         }
02657     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02658         {
02659         _StubMsg.MaxCount = cbFilenamesBuffer;
02660
02661         NdrClearOutParameters(
02662                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02663                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[54],
02664                          ( void __RPC_FAR * )sFilenamesBuffer);
02665         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02666         }
02667     RpcEndExcept
02668     return _RetVal;
02669 }

void __RPC_STUB ICvsCoworker_GetFilesToAdd_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2671 of file CVS_Coworker_p.c.

02676 {
02677     HRESULT _RetVal;
02678     MIDL_STUB_MESSAGE _StubMsg;
02679     int cbFilenamesBuffer;
02680     int handle;
02681     unsigned char __RPC_FAR *sFilenamesBuffer;
02682
02683 NdrStubInitialize(
02684                      _pRpcMessage,
02685                      &_StubMsg,
02686                      &Object_StubDesc,
02687                      _pRpcChannelBuffer);
02688     ( unsigned char __RPC_FAR * )sFilenamesBuffer = 0;
02689     RpcTryFinally
02690         {
02691         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02692             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[136] );
02693
02694         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02695
02696         cbFilenamesBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02697
02698         if(cbFilenamesBuffer * 1 < 0)
02699             {
02700             RpcRaiseException(RPC_X_INVALID_BOUND);
02701             }
02702         sFilenamesBuffer = NdrAllocate(&_StubMsg,cbFilenamesBuffer * 1);
02703
02704         *_pdwStubPhase = STUB_CALL_SERVER;
02705         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetFilesToAdd(
02706                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02707                  handle,
02708                  cbFilenamesBuffer,
02709                  sFilenamesBuffer);
02710
02711         *_pdwStubPhase = STUB_MARSHAL;
02712
02713         _StubMsg.BufferLength = 12U + 11U;
02714         _StubMsg.MaxCount = cbFilenamesBuffer;
02715
02716         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02717                                        (unsigned char __RPC_FAR *)sFilenamesBuffer,
02718                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58] );
02719
02720         _StubMsg.BufferLength += 16;
02721
02722         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02723         _StubMsg.MaxCount = cbFilenamesBuffer;
02724
02725         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02726                                      (unsigned char __RPC_FAR *)sFilenamesBuffer,
02727                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58] );
02728
02729         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02730         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02731
02732         }
02733     RpcFinally
02734         {
02735         _StubMsg.MaxCount = cbFilenamesBuffer;
02736
02737         NdrPointerFree( &_StubMsg,
02738                         (unsigned char __RPC_FAR *)sFilenamesBuffer,
02739                         &__MIDL_TypeFormatString.Format[54] );
02740
02741         }
02742     RpcEndFinally
02743     _pRpcMessage->BufferLength =
02744         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02745
02746 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetLastError_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int __RPC_FAR * | piError
 | ) |

Definition at line 65 of file CVS_Coworker_p.c.

00069 {
00070
00071     HRESULT _RetVal;
00072
00073     RPC_MESSAGE _RpcMessage;
00074
00075     MIDL_STUB_MESSAGE _StubMsg;
00076
00077     RpcTryExcept
00078         {
00079         NdrProxyInitialize(
00080                       ( void __RPC_FAR *  )This,
00081                       ( PRPC_MESSAGE  )&_RpcMessage,
00082                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00083                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00084                       3);
00085
00086
00087
00088         if(!piError)
00089             {
00090             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00091             }
00092         RpcTryFinally
00093             {
00094
00095             _StubMsg.BufferLength = 4U;
00096             NdrProxyGetBuffer(This, &_StubMsg);
00097             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00098
00099             NdrProxySendReceive(This, &_StubMsg);
00100
00101             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00102                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] );
00103
00104             *piError = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00105
00106             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00107
00108             }
00109         RpcFinally
00110             {
00111             NdrProxyFreeBuffer(This, &_StubMsg);
00112
00113             }
00114         RpcEndFinally
00115
00116         }
00117     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00118         {
00119         NdrClearOutParameters(
00120                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00121                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00122                          ( void __RPC_FAR * )piError);
00123         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00124         }
00125     RpcEndExcept
00126     return _RetVal;
00127 }

void __RPC_STUB ICvsCoworker_GetLastError_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 129 of file CVS_Coworker_p.c.

00134 {
00135     int _M0;
00136     HRESULT _RetVal;
00137     MIDL_STUB_MESSAGE _StubMsg;
00138     int handle;
00139     int __RPC_FAR *piError;
00140
00141 NdrStubInitialize(
00142                      _pRpcMessage,
00143                      &_StubMsg,
00144                      &Object_StubDesc,
00145                      _pRpcChannelBuffer);
00146     ( int __RPC_FAR * )piError = 0;
00147     RpcTryFinally
00148         {
00149         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00150             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] );
00151
00152         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00153
00154         piError = &_M0;
00155
00156         *_pdwStubPhase = STUB_CALL_SERVER;
00157         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetLastError(
00158                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00159                 handle,
00160                 piError);
00161
00162         *_pdwStubPhase = STUB_MARSHAL;
00163
00164         _StubMsg.BufferLength = 4U + 4U;
00165         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00166         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *piError;
00167
00168         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00169
00170         }
00171     RpcFinally
00172         {
00173         }
00174     RpcEndFinally
00175     _pRpcMessage->BufferLength =
00176         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00177
00178 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetProject_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int __RPC_FAR * | pHandle,
 |  | const unsigned char __RPC_FAR * | sUsername,
 |  | int | cbProjectNameBuffer,
 |  | unsigned char __RPC_FAR * | sProjectName,
 |  | int | cbProjectHomeBuffer,
 |  | unsigned char __RPC_FAR * | sProjectHome,
 |  | BOOL | bAllowPathChange,
 |  | BOOL | bAllowNewProject,
 |  | BOOL __RPC_FAR * | pbNewProject
 | ) |

Definition at line 511 of file CVS_Coworker_p.c.

00522 {
00523
00524     HRESULT _RetVal;
00525
00526     RPC_MESSAGE _RpcMessage;
00527
00528     MIDL_STUB_MESSAGE _StubMsg;
00529
00530     RpcTryExcept
00531         {
00532         NdrProxyInitialize(
00533                       ( void __RPC_FAR *  )This,
00534                       ( PRPC_MESSAGE  )&_RpcMessage,
00535                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00536                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00537                       6);
00538
00539
00540
00541         if(!pHandle)
00542             {
00543             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00544             }
00545         if(!sUsername)
00546             {
00547             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00548             }
00549         if(!sProjectName)
00550             {
00551             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00552             }
00553         if(!sProjectHome)
00554             {
00555             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00556             }
00557         if(!pbNewProject)
00558             {
00559             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00560             }
00561         RpcTryFinally
00562             {
00563
00564             _StubMsg.BufferLength = 1U + 7U + 12U + 11U + 13U + 11U + 7U;
00565             _StubMsg.MaxCount = cbProjectNameBuffer;
00566
00567             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00568                                            (unsigned char __RPC_FAR *)sProjectName,
00569                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00570
00571             _StubMsg.MaxCount = cbProjectHomeBuffer;
00572
00573             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00574                                            (unsigned char __RPC_FAR *)sProjectHome,
00575                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00576
00577             NdrProxyGetBuffer(This, &_StubMsg);
00578             *(( unsigned char __RPC_FAR * )_StubMsg.Buffer)++ = *sUsername;
00579
00580             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00581             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbProjectNameBuffer;
00582
00583             _StubMsg.MaxCount = cbProjectNameBuffer;
00584
00585             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00586                                          (unsigned char __RPC_FAR *)sProjectName,
00587                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00588
00589             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00590             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbProjectHomeBuffer;
00591
00592             _StubMsg.MaxCount = cbProjectHomeBuffer;
00593
00594             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00595                                          (unsigned char __RPC_FAR *)sProjectHome,
00596                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00597
00598             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00599             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bAllowPathChange;
00600
00601             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bAllowNewProject;
00602
00603             NdrProxySendReceive(This, &_StubMsg);
00604
00605             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00606                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[38] );
00607
00608             *pHandle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00609
00610             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00611                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00612                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28],
00613                                            (unsigned char)0 );
00614
00615             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00616                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00617                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38],
00618                                            (unsigned char)0 );
00619
00620             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00621             *pbNewProject = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00622
00623             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00624
00625             }
00626         RpcFinally
00627             {
00628             NdrProxyFreeBuffer(This, &_StubMsg);
00629
00630             }
00631         RpcEndFinally
00632
00633         }
00634     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00635         {
00636         NdrClearOutParameters(
00637                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00638                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00639                          ( void __RPC_FAR * )pHandle);
00640         _StubMsg.MaxCount = cbProjectNameBuffer;
00641
00642         NdrClearOutParameters(
00643                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00644                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[24],
00645                          ( void __RPC_FAR * )sProjectName);
00646         _StubMsg.MaxCount = cbProjectHomeBuffer;
00647
00648         NdrClearOutParameters(
00649                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00650                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[34],
00651                          ( void __RPC_FAR * )sProjectHome);
00652         NdrClearOutParameters(
00653                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00654                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00655                          ( void __RPC_FAR * )pbNewProject);
00656         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00657         }
00658     RpcEndExcept
00659     return _RetVal;
00660 }

void __RPC_STUB ICvsCoworker_GetProject_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 662 of file CVS_Coworker_p.c.

00667 {
00668     int _M14;
00669     BOOL _M15;
00670     HRESULT _RetVal;
00671     MIDL_STUB_MESSAGE _StubMsg;
00672     BOOL bAllowNewProject;
00673     BOOL bAllowPathChange;
00674     int cbProjectHomeBuffer;
00675     int cbProjectNameBuffer;
00676     int __RPC_FAR *pHandle;
00677     BOOL __RPC_FAR *pbNewProject;
00678     unsigned char __RPC_FAR *sProjectHome;
00679     unsigned char __RPC_FAR *sProjectName;
00680     const unsigned char __RPC_FAR *sUsername;
00681
00682 NdrStubInitialize(
00683                      _pRpcMessage,
00684                      &_StubMsg,
00685                      &Object_StubDesc,
00686                      _pRpcChannelBuffer);
00687     ( int __RPC_FAR * )pHandle = 0;
00688     ( unsigned char __RPC_FAR * )sUsername = 0;
00689     ( unsigned char __RPC_FAR * )sProjectName = 0;
00690     ( unsigned char __RPC_FAR * )sProjectHome = 0;
00691     ( BOOL __RPC_FAR * )pbNewProject = 0;
00692     RpcTryFinally
00693         {
00694         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00695             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[38] );
00696
00697         sUsername = ( unsigned char __RPC_FAR * )_StubMsg.Buffer;
00698         _StubMsg.Buffer += sizeof( unsigned char  );
00699
00700         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00701         cbProjectNameBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00702
00703         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00704                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00705                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28],
00706                                        (unsigned char)0 );
00707
00708         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00709         cbProjectHomeBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00710
00711         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00712                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00713                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38],
00714                                        (unsigned char)0 );
00715
00716         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00717         bAllowPathChange = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00718
00719         bAllowNewProject = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00720
00721         pHandle = &_M14;
00722         pbNewProject = &_M15;
00723
00724         *_pdwStubPhase = STUB_CALL_SERVER;
00725         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetProject(
00726               (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00727               pHandle,
00728               sUsername,
00729               cbProjectNameBuffer,
00730               sProjectName,
00731               cbProjectHomeBuffer,
00732               sProjectHome,
00733               bAllowPathChange,
00734               bAllowNewProject,
00735               pbNewProject);
00736
00737         *_pdwStubPhase = STUB_MARSHAL;
00738
00739         _StubMsg.BufferLength = 4U + 12U + 13U + 11U + 7U;
00740         _StubMsg.MaxCount = cbProjectNameBuffer;
00741
00742         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00743                                        (unsigned char __RPC_FAR *)sProjectName,
00744                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00745
00746         _StubMsg.MaxCount = cbProjectHomeBuffer;
00747
00748         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00749                                        (unsigned char __RPC_FAR *)sProjectHome,
00750                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00751
00752         _StubMsg.BufferLength += 16;
00753
00754         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00755         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *pHandle;
00756
00757         _StubMsg.MaxCount = cbProjectNameBuffer;
00758
00759         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00760                                      (unsigned char __RPC_FAR *)sProjectName,
00761                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00762
00763         _StubMsg.MaxCount = cbProjectHomeBuffer;
00764
00765         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00766                                      (unsigned char __RPC_FAR *)sProjectHome,
00767                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00768
00769         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00770         *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = *pbNewProject;
00771
00772         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00773
00774         }
00775     RpcFinally
00776         {
00777         _StubMsg.MaxCount = cbProjectNameBuffer;
00778
00779         NdrPointerFree( &_StubMsg,
00780                         (unsigned char __RPC_FAR *)sProjectName,
00781                         &__MIDL_TypeFormatString.Format[24] );
00782
00783         _StubMsg.MaxCount = cbProjectHomeBuffer;
00784
00785         NdrPointerFree( &_StubMsg,
00786                         (unsigned char __RPC_FAR *)sProjectHome,
00787                         &__MIDL_TypeFormatString.Format[34] );
00788
00789         }
00790     RpcEndFinally
00791     _pRpcMessage->BufferLength =
00792         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00793
00794 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_HasAdvancedOptionsForCommand_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | CvsCommand | command,
 |  | BOOL __RPC_FAR * | pbAdvancedOptions
 | ) |

Definition at line 2211 of file CVS_Coworker_p.c.

02216 {
02217
02218     HRESULT _RetVal;
02219
02220     RPC_MESSAGE _RpcMessage;
02221
02222     MIDL_STUB_MESSAGE _StubMsg;
02223
02224     RpcTryExcept
02225         {
02226         NdrProxyInitialize(
02227                       ( void __RPC_FAR *  )This,
02228                       ( PRPC_MESSAGE  )&_RpcMessage,
02229                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02230                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02231                       18);
02232
02233
02234
02235         if(!pbAdvancedOptions)
02236             {
02237             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02238             }
02239         RpcTryFinally
02240             {
02241
02242             _StubMsg.BufferLength = 4U + 2U;
02243             NdrProxyGetBuffer(This, &_StubMsg);
02244             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02245
02246             NdrSimpleTypeMarshall(
02247                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02248                          ( unsigned char __RPC_FAR * )&command,
02249                          13);
02250             NdrProxySendReceive(This, &_StubMsg);
02251
02252             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02253                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[110] );
02254
02255             *pbAdvancedOptions = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
02256
02257             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02258
02259             }
02260         RpcFinally
02261             {
02262             NdrProxyFreeBuffer(This, &_StubMsg);
02263
02264             }
02265         RpcEndFinally
02266
02267         }
02268     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02269         {
02270         NdrClearOutParameters(
02271                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02272                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
02273                          ( void __RPC_FAR * )pbAdvancedOptions);
02274         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02275         }
02276     RpcEndExcept
02277     return _RetVal;
02278 }

void __RPC_STUB ICvsCoworker_HasAdvancedOptionsForCommand_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2280 of file CVS_Coworker_p.c.

02285 {
02286     BOOL _M42;
02287     HRESULT _RetVal;
02288     MIDL_STUB_MESSAGE _StubMsg;
02289     CvsCommand command;
02290     int handle;
02291     BOOL __RPC_FAR *pbAdvancedOptions;
02292
02293 NdrStubInitialize(
02294                      _pRpcMessage,
02295                      &_StubMsg,
02296                      &Object_StubDesc,
02297                      _pRpcChannelBuffer);
02298     ( BOOL __RPC_FAR * )pbAdvancedOptions = 0;
02299     RpcTryFinally
02300         {
02301         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02302             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[110] );
02303
02304         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02305
02306         NdrSimpleTypeUnmarshall(
02307                            ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02308                            ( unsigned char __RPC_FAR * )&command,
02309                            13);
02310         pbAdvancedOptions = &_M42;
02311
02312         *_pdwStubPhase = STUB_CALL_SERVER;
02313         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> HasAdvancedOptionsForCommand(
02314                                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02315                                 handle,
02316                                 command,
02317                                 pbAdvancedOptions);
02318
02319         *_pdwStubPhase = STUB_MARSHAL;
02320
02321         _StubMsg.BufferLength = 4U + 4U;
02322         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02323         *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = *pbAdvancedOptions;
02324
02325         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02326
02327         }
02328     RpcFinally
02329         {
02330         }
02331     RpcEndFinally
02332     _pRpcMessage->BufferLength =
02333         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02334
02335 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_OpenProject_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int __RPC_FAR * | pHandle,
 |  | const unsigned char __RPC_FAR * | sUsername,
 |  | const unsigned char __RPC_FAR * | sProjectName,
 |  | const unsigned char __RPC_FAR * | sProjectHome
 | ) |

Definition at line 339 of file CVS_Coworker_p.c.

00345 {
00346
00347     HRESULT _RetVal;
00348
00349     RPC_MESSAGE _RpcMessage;
00350
00351     MIDL_STUB_MESSAGE _StubMsg;
00352
00353     RpcTryExcept
00354         {
00355         NdrProxyInitialize(
00356                       ( void __RPC_FAR *  )This,
00357                       ( PRPC_MESSAGE  )&_RpcMessage,
00358                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00359                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00360                       5);
00361
00362
00363
00364         if(!pHandle)
00365             {
00366             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00367             }
00368         if(!sUsername)
00369             {
00370             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00371             }
00372         if(!sProjectName)
00373             {
00374             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00375             }
00376         if(!sProjectHome)
00377             {
00378             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00379             }
00380         RpcTryFinally
00381             {
00382
00383             _StubMsg.BufferLength = 12U + 13U + 13U;
00384             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00385                                            (unsigned char __RPC_FAR *)sUsername,
00386                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00387
00388             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00389                                            (unsigned char __RPC_FAR *)sProjectName,
00390                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00391
00392             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00393                                            (unsigned char __RPC_FAR *)sProjectHome,
00394                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00395
00396             NdrProxyGetBuffer(This, &_StubMsg);
00397             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00398                                          (unsigned char __RPC_FAR *)sUsername,
00399                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00400
00401             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00402                                          (unsigned char __RPC_FAR *)sProjectName,
00403                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00404
00405             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00406                                          (unsigned char __RPC_FAR *)sProjectHome,
00407                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00408
00409             NdrProxySendReceive(This, &_StubMsg);
00410
00411             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00412                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[20] );
00413
00414             *pHandle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00415
00416             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00417
00418             }
00419         RpcFinally
00420             {
00421             NdrProxyFreeBuffer(This, &_StubMsg);
00422
00423             }
00424         RpcEndFinally
00425
00426         }
00427     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00428         {
00429         NdrClearOutParameters(
00430                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00431                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00432                          ( void __RPC_FAR * )pHandle);
00433         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00434         }
00435     RpcEndExcept
00436     return _RetVal;
00437 }

void __RPC_STUB ICvsCoworker_OpenProject_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 439 of file CVS_Coworker_p.c.

00444 {
00445     int _M9;
00446     HRESULT _RetVal;
00447     MIDL_STUB_MESSAGE _StubMsg;
00448     int __RPC_FAR *pHandle;
00449     const unsigned char __RPC_FAR *sProjectHome;
00450     const unsigned char __RPC_FAR *sProjectName;
00451     const unsigned char __RPC_FAR *sUsername;
00452
00453 NdrStubInitialize(
00454                      _pRpcMessage,
00455                      &_StubMsg,
00456                      &Object_StubDesc,
00457                      _pRpcChannelBuffer);
00458     ( int __RPC_FAR * )pHandle = 0;
00459     ( unsigned char __RPC_FAR * )sUsername = 0;
00460     ( unsigned char __RPC_FAR * )sProjectName = 0;
00461     ( unsigned char __RPC_FAR * )sProjectHome = 0;
00462     RpcTryFinally
00463         {
00464         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00465             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[20] );
00466
00467         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00468                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sUsername,
00469                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00470                                        (unsigned char)0 );
00471
00472         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00473                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00474                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00475                                        (unsigned char)0 );
00476
00477         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00478                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00479                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00480                                        (unsigned char)0 );
00481
00482         pHandle = &_M9;
00483
00484         *_pdwStubPhase = STUB_CALL_SERVER;
00485         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> OpenProject(
00486                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00487                pHandle,
00488                sUsername,
00489                sProjectName,
00490                sProjectHome);
00491
00492         *_pdwStubPhase = STUB_MARSHAL;
00493
00494         _StubMsg.BufferLength = 4U + 4U;
00495         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00496         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *pHandle;
00497
00498         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00499
00500         }
00501     RpcFinally
00502         {
00503         }
00504     RpcEndFinally
00505     _pRpcMessage->BufferLength =
00506         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00507
00508 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_RemoveFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 1448 of file CVS_Coworker_p.c.

01452 {
01453
01454     HRESULT _RetVal;
01455
01456     RPC_MESSAGE _RpcMessage;
01457
01458     MIDL_STUB_MESSAGE _StubMsg;
01459
01460     RpcTryExcept
01461         {
01462         NdrProxyInitialize(
01463                       ( void __RPC_FAR *  )This,
01464                       ( PRPC_MESSAGE  )&_RpcMessage,
01465                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01466                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01467                       12);
01468
01469
01470
01471         if(!sFilenames)
01472             {
01473             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01474             }
01475         RpcTryFinally
01476             {
01477
01478             _StubMsg.BufferLength = 4U + 12U;
01479             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01480                                            (unsigned char __RPC_FAR *)sFilenames,
01481                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01482
01483             NdrProxyGetBuffer(This, &_StubMsg);
01484             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01485
01486             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01487                                          (unsigned char __RPC_FAR *)sFilenames,
01488                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01489
01490             NdrProxySendReceive(This, &_StubMsg);
01491
01492             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01493                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01494
01495             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01496
01497             }
01498         RpcFinally
01499             {
01500             NdrProxyFreeBuffer(This, &_StubMsg);
01501
01502             }
01503         RpcEndFinally
01504
01505         }
01506     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01507         {
01508         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01509         }
01510     RpcEndExcept
01511     return _RetVal;
01512 }

void __RPC_STUB ICvsCoworker_RemoveFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1514 of file CVS_Coworker_p.c.

01519 {
01520     HRESULT _RetVal;
01521     MIDL_STUB_MESSAGE _StubMsg;
01522     int handle;
01523     const unsigned char __RPC_FAR *sFilenames;
01524
01525 NdrStubInitialize(
01526                      _pRpcMessage,
01527                      &_StubMsg,
01528                      &Object_StubDesc,
01529                      _pRpcChannelBuffer);
01530     ( unsigned char __RPC_FAR * )sFilenames = 0;
01531     RpcTryFinally
01532         {
01533         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01534             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01535
01536         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01537
01538         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01539                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01540                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01541                                        (unsigned char)0 );
01542
01543
01544         *_pdwStubPhase = STUB_CALL_SERVER;
01545         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> RemoveFiles(
01546                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01547                handle,
01548                sFilenames);
01549
01550         *_pdwStubPhase = STUB_MARSHAL;
01551
01552         _StubMsg.BufferLength = 4U;
01553         _StubMsg.BufferLength += 16;
01554
01555         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01556         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01557
01558         }
01559     RpcFinally
01560         {
01561         }
01562     RpcEndFinally
01563     _pRpcMessage->BufferLength =
01564         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01565
01566 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_RenameFile_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sOldFilename,
 |  | const unsigned char __RPC_FAR * | sNewFilename
 | ) |

Definition at line 1569 of file CVS_Coworker_p.c.

01574 {
01575
01576     HRESULT _RetVal;
01577
01578     RPC_MESSAGE _RpcMessage;
01579
01580     MIDL_STUB_MESSAGE _StubMsg;
01581
01582     RpcTryExcept
01583         {
01584         NdrProxyInitialize(
01585                       ( void __RPC_FAR *  )This,
01586                       ( PRPC_MESSAGE  )&_RpcMessage,
01587                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01588                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01589                       13);
01590
01591
01592
01593         if(!sOldFilename)
01594             {
01595             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01596             }
01597         if(!sNewFilename)
01598             {
01599             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01600             }
01601         RpcTryFinally
01602             {
01603
01604             _StubMsg.BufferLength = 4U + 12U + 13U;
01605             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01606                                            (unsigned char __RPC_FAR *)sOldFilename,
01607                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01608
01609             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01610                                            (unsigned char __RPC_FAR *)sNewFilename,
01611                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01612
01613             NdrProxyGetBuffer(This, &_StubMsg);
01614             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01615
01616             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01617                                          (unsigned char __RPC_FAR *)sOldFilename,
01618                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01619
01620             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01621                                          (unsigned char __RPC_FAR *)sNewFilename,
01622                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01623
01624             NdrProxySendReceive(This, &_StubMsg);
01625
01626             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01627                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01628
01629             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01630
01631             }
01632         RpcFinally
01633             {
01634             NdrProxyFreeBuffer(This, &_StubMsg);
01635
01636             }
01637         RpcEndFinally
01638
01639         }
01640     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01641         {
01642         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01643         }
01644     RpcEndExcept
01645     return _RetVal;
01646 }

void __RPC_STUB ICvsCoworker_RenameFile_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1648 of file CVS_Coworker_p.c.

01653 {
01654     HRESULT _RetVal;
01655     MIDL_STUB_MESSAGE _StubMsg;
01656     int handle;
01657     const unsigned char __RPC_FAR *sNewFilename;
01658     const unsigned char __RPC_FAR *sOldFilename;
01659
01660 NdrStubInitialize(
01661                      _pRpcMessage,
01662                      &_StubMsg,
01663                      &Object_StubDesc,
01664                      _pRpcChannelBuffer);
01665     ( unsigned char __RPC_FAR * )sOldFilename = 0;
01666     ( unsigned char __RPC_FAR * )sNewFilename = 0;
01667     RpcTryFinally
01668         {
01669         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01670             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01671
01672         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01673
01674         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01675                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sOldFilename,
01676                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01677                                        (unsigned char)0 );
01678
01679         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01680                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sNewFilename,
01681                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01682                                        (unsigned char)0 );
01683
01684
01685         *_pdwStubPhase = STUB_CALL_SERVER;
01686         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> RenameFile(
01687               (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01688               handle,
01689               sOldFilename,
01690               sNewFilename);
01691
01692         *_pdwStubPhase = STUB_MARSHAL;
01693
01694         _StubMsg.BufferLength = 4U;
01695         _StubMsg.BufferLength += 16;
01696
01697         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01698         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01699
01700         }
01701     RpcFinally
01702         {
01703         }
01704     RpcEndFinally
01705     _pRpcMessage->BufferLength =
01706         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01707
01708 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | CvsCommand | command
 | ) |

Definition at line 2338 of file CVS_Coworker_p.c.

02342 {
02343
02344     HRESULT _RetVal;
02345
02346     RPC_MESSAGE _RpcMessage;
02347
02348     MIDL_STUB_MESSAGE _StubMsg;
02349
02350     RpcTryExcept
02351         {
02352         NdrProxyInitialize(
02353                       ( void __RPC_FAR *  )This,
02354                       ( PRPC_MESSAGE  )&_RpcMessage,
02355                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02356                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02357                       19);
02358
02359
02360
02361         RpcTryFinally
02362             {
02363
02364             _StubMsg.BufferLength = 4U + 2U;
02365             NdrProxyGetBuffer(This, &_StubMsg);
02366             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02367
02368             NdrSimpleTypeMarshall(
02369                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02370                          ( unsigned char __RPC_FAR * )&command,
02371                          13);
02372             NdrProxySendReceive(This, &_StubMsg);
02373
02374             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02375                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[120] );
02376
02377             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02378
02379             }
02380         RpcFinally
02381             {
02382             NdrProxyFreeBuffer(This, &_StubMsg);
02383
02384             }
02385         RpcEndFinally
02386
02387         }
02388     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02389         {
02390         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02391         }
02392     RpcEndExcept
02393     return _RetVal;
02394 }

void __RPC_STUB ICvsCoworker_ShowAdvancedOptionsForCommand_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2396 of file CVS_Coworker_p.c.

02401 {
02402     HRESULT _RetVal;
02403     MIDL_STUB_MESSAGE _StubMsg;
02404     CvsCommand command;
02405     int handle;
02406
02407 NdrStubInitialize(
02408                      _pRpcMessage,
02409                      &_StubMsg,
02410                      &Object_StubDesc,
02411                      _pRpcChannelBuffer);
02412     RpcTryFinally
02413         {
02414         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02415             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[120] );
02416
02417         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02418
02419         NdrSimpleTypeUnmarshall(
02420                            ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02421                            ( unsigned char __RPC_FAR * )&command,
02422                            13);
02423
02424         *_pdwStubPhase = STUB_CALL_SERVER;
02425         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowAdvancedOptionsForCommand(
02426                                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02427                                  handle,
02428                                  command);
02429
02430         *_pdwStubPhase = STUB_MARSHAL;
02431
02432         _StubMsg.BufferLength = 4U;
02433         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02434         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02435
02436         }
02437     RpcFinally
02438         {
02439         }
02440     RpcEndFinally
02441     _pRpcMessage->BufferLength =
02442         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02443
02444 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileHistory_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 1848 of file CVS_Coworker_p.c.

01852 {
01853
01854     HRESULT _RetVal;
01855
01856     RPC_MESSAGE _RpcMessage;
01857
01858     MIDL_STUB_MESSAGE _StubMsg;
01859
01860     RpcTryExcept
01861         {
01862         NdrProxyInitialize(
01863                       ( void __RPC_FAR *  )This,
01864                       ( PRPC_MESSAGE  )&_RpcMessage,
01865                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01866                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01867                       15);
01868
01869
01870
01871         if(!sFilenames)
01872             {
01873             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01874             }
01875         RpcTryFinally
01876             {
01877
01878             _StubMsg.BufferLength = 4U + 12U;
01879             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01880                                            (unsigned char __RPC_FAR *)sFilenames,
01881                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01882
01883             NdrProxyGetBuffer(This, &_StubMsg);
01884             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01885
01886             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01887                                          (unsigned char __RPC_FAR *)sFilenames,
01888                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01889
01890             NdrProxySendReceive(This, &_StubMsg);
01891
01892             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01893                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01894
01895             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01896
01897             }
01898         RpcFinally
01899             {
01900             NdrProxyFreeBuffer(This, &_StubMsg);
01901
01902             }
01903         RpcEndFinally
01904
01905         }
01906     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01907         {
01908         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01909         }
01910     RpcEndExcept
01911     return _RetVal;
01912 }

void __RPC_STUB ICvsCoworker_ShowFileHistory_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1914 of file CVS_Coworker_p.c.

01919 {
01920     HRESULT _RetVal;
01921     MIDL_STUB_MESSAGE _StubMsg;
01922     int handle;
01923     const unsigned char __RPC_FAR *sFilenames;
01924
01925 NdrStubInitialize(
01926                      _pRpcMessage,
01927                      &_StubMsg,
01928                      &Object_StubDesc,
01929                      _pRpcChannelBuffer);
01930     ( unsigned char __RPC_FAR * )sFilenames = 0;
01931     RpcTryFinally
01932         {
01933         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01934             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01935
01936         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01937
01938         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01939                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01940                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01941                                        (unsigned char)0 );
01942
01943
01944         *_pdwStubPhase = STUB_CALL_SERVER;
01945         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowFileHistory(
01946                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01947                    handle,
01948                    sFilenames);
01949
01950         *_pdwStubPhase = STUB_MARSHAL;
01951
01952         _StubMsg.BufferLength = 4U;
01953         _StubMsg.BufferLength += 16;
01954
01955         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01956         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01957
01958         }
01959     RpcFinally
01960         {
01961         }
01962     RpcEndFinally
01963     _pRpcMessage->BufferLength =
01964         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01965
01966 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileProperties_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilename
 | ) |

Definition at line 1969 of file CVS_Coworker_p.c.

01973 {
01974
01975     HRESULT _RetVal;
01976
01977     RPC_MESSAGE _RpcMessage;
01978
01979     MIDL_STUB_MESSAGE _StubMsg;
01980
01981     RpcTryExcept
01982         {
01983         NdrProxyInitialize(
01984                       ( void __RPC_FAR *  )This,
01985                       ( PRPC_MESSAGE  )&_RpcMessage,
01986                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01987                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01988                       16);
01989
01990
01991
01992         if(!sFilename)
01993             {
01994             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01995             }
01996         RpcTryFinally
01997             {
01998
01999             _StubMsg.BufferLength = 4U + 12U;
02000             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02001                                            (unsigned char __RPC_FAR *)sFilename,
02002                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02003
02004             NdrProxyGetBuffer(This, &_StubMsg);
02005             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02006
02007             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02008                                          (unsigned char __RPC_FAR *)sFilename,
02009                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02010
02011             NdrProxySendReceive(This, &_StubMsg);
02012
02013             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02014                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02015
02016             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02017
02018             }
02019         RpcFinally
02020             {
02021             NdrProxyFreeBuffer(This, &_StubMsg);
02022
02023             }
02024         RpcEndFinally
02025
02026         }
02027     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02028         {
02029         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02030         }
02031     RpcEndExcept
02032     return _RetVal;
02033 }

void __RPC_STUB ICvsCoworker_ShowFileProperties_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2035 of file CVS_Coworker_p.c.

02040 {
02041     HRESULT _RetVal;
02042     MIDL_STUB_MESSAGE _StubMsg;
02043     int handle;
02044     const unsigned char __RPC_FAR *sFilename;
02045
02046 NdrStubInitialize(
02047                      _pRpcMessage,
02048                      &_StubMsg,
02049                      &Object_StubDesc,
02050                      _pRpcChannelBuffer);
02051     ( unsigned char __RPC_FAR * )sFilename = 0;
02052     RpcTryFinally
02053         {
02054         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02055             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02056
02057         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02058
02059         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02060                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilename,
02061                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
02062                                        (unsigned char)0 );
02063
02064
02065         *_pdwStubPhase = STUB_CALL_SERVER;
02066         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowFileProperties(
02067                       (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02068                       handle,
02069                       sFilename);
02070
02071         *_pdwStubPhase = STUB_MARSHAL;
02072
02073         _StubMsg.BufferLength = 4U;
02074         _StubMsg.BufferLength += 16;
02075
02076         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02077         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02078
02079         }
02080     RpcFinally
02081         {
02082         }
02083     RpcEndFinally
02084     _pRpcMessage->BufferLength =
02085         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02086
02087 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowUserInterface_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 2090 of file CVS_Coworker_p.c.

02094 {
02095
02096     HRESULT _RetVal;
02097
02098     RPC_MESSAGE _RpcMessage;
02099
02100     MIDL_STUB_MESSAGE _StubMsg;
02101
02102     RpcTryExcept
02103         {
02104         NdrProxyInitialize(
02105                       ( void __RPC_FAR *  )This,
02106                       ( PRPC_MESSAGE  )&_RpcMessage,
02107                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02108                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02109                       17);
02110
02111
02112
02113         if(!sFilenames)
02114             {
02115             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02116             }
02117         RpcTryFinally
02118             {
02119
02120             _StubMsg.BufferLength = 4U + 12U;
02121             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02122                                            (unsigned char __RPC_FAR *)sFilenames,
02123                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02124
02125             NdrProxyGetBuffer(This, &_StubMsg);
02126             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02127
02128             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02129                                          (unsigned char __RPC_FAR *)sFilenames,
02130                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02131
02132             NdrProxySendReceive(This, &_StubMsg);
02133
02134             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02135                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02136
02137             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02138
02139             }
02140         RpcFinally
02141             {
02142             NdrProxyFreeBuffer(This, &_StubMsg);
02143
02144             }
02145         RpcEndFinally
02146
02147         }
02148     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02149         {
02150         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02151         }
02152     RpcEndExcept
02153     return _RetVal;
02154 }

void __RPC_STUB ICvsCoworker_ShowUserInterface_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2156 of file CVS_Coworker_p.c.

02161 {
02162     HRESULT _RetVal;
02163     MIDL_STUB_MESSAGE _StubMsg;
02164     int handle;
02165     const unsigned char __RPC_FAR *sFilenames;
02166
02167 NdrStubInitialize(
02168                      _pRpcMessage,
02169                      &_StubMsg,
02170                      &Object_StubDesc,
02171                      _pRpcChannelBuffer);
02172     ( unsigned char __RPC_FAR * )sFilenames = 0;
02173     RpcTryFinally
02174         {
02175         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02176             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02177
02178         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02179
02180         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02181                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
02182                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
02183                                        (unsigned char)0 );
02184
02185
02186         *_pdwStubPhase = STUB_CALL_SERVER;
02187         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowUserInterface(
02188                      (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02189                      handle,
02190                      sFilenames);
02191
02192         *_pdwStubPhase = STUB_MARSHAL;
02193
02194         _StubMsg.BufferLength = 4U;
02195         _StubMsg.BufferLength += 16;
02196
02197         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02198         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02199
02200         }
02201     RpcFinally
02202         {
02203         }
02204     RpcEndFinally
02205     _pRpcMessage->BufferLength =
02206         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02207
02208 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_UncheckoutFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 1185 of file CVS_Coworker_p.c.

01189 {
01190
01191     HRESULT _RetVal;
01192
01193     RPC_MESSAGE _RpcMessage;
01194
01195     MIDL_STUB_MESSAGE _StubMsg;
01196
01197     RpcTryExcept
01198         {
01199         NdrProxyInitialize(
01200                       ( void __RPC_FAR *  )This,
01201                       ( PRPC_MESSAGE  )&_RpcMessage,
01202                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01203                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01204                       10);
01205
01206
01207
01208         if(!sFilenames)
01209             {
01210             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01211             }
01212         RpcTryFinally
01213             {
01214
01215             _StubMsg.BufferLength = 4U + 12U;
01216             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01217                                            (unsigned char __RPC_FAR *)sFilenames,
01218                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01219
01220             NdrProxyGetBuffer(This, &_StubMsg);
01221             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01222
01223             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01224                                          (unsigned char __RPC_FAR *)sFilenames,
01225                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01226
01227             NdrProxySendReceive(This, &_StubMsg);
01228
01229             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01230                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01231
01232             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01233
01234             }
01235         RpcFinally
01236             {
01237             NdrProxyFreeBuffer(This, &_StubMsg);
01238
01239             }
01240         RpcEndFinally
01241
01242         }
01243     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01244         {
01245         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01246         }
01247     RpcEndExcept
01248     return _RetVal;
01249 }

void __RPC_STUB ICvsCoworker_UncheckoutFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1251 of file CVS_Coworker_p.c.

01256 {
01257     HRESULT _RetVal;
01258     MIDL_STUB_MESSAGE _StubMsg;
01259     int handle;
01260     const unsigned char __RPC_FAR *sFilenames;
01261
01262 NdrStubInitialize(
01263                      _pRpcMessage,
01264                      &_StubMsg,
01265                      &Object_StubDesc,
01266                      _pRpcChannelBuffer);
01267     ( unsigned char __RPC_FAR * )sFilenames = 0;
01268     RpcTryFinally
01269         {
01270         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01271             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01272
01273         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01274
01275         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01276                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01277                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01278                                        (unsigned char)0 );
01279
01280
01281         *_pdwStubPhase = STUB_CALL_SERVER;
01282         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> UncheckoutFiles(
01283                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01284                    handle,
01285                    sFilenames);
01286
01287         *_pdwStubPhase = STUB_MARSHAL;
01288
01289         _StubMsg.BufferLength = 4U;
01290         _StubMsg.BufferLength += 16;
01291
01292         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01293         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01294
01295         }
01296     RpcFinally
01297         {
01298         }
01299     RpcEndFinally
01300     _pRpcMessage->BufferLength =
01301         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01302
01303 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_UpdateFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames,
 |  | BOOL | bDirectories,
 |  | BOOL | bRecurse
 | ) |

Definition at line 797 of file CVS_Coworker_p.c.

00803 {
00804
00805     HRESULT _RetVal;
00806
00807     RPC_MESSAGE _RpcMessage;
00808
00809     MIDL_STUB_MESSAGE _StubMsg;
00810
00811     RpcTryExcept
00812         {
00813         NdrProxyInitialize(
00814                       ( void __RPC_FAR *  )This,
00815                       ( PRPC_MESSAGE  )&_RpcMessage,
00816                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00817                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00818                       7);
00819
00820
00821
00822         if(!sFilenames)
00823             {
00824             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00825             }
00826         RpcTryFinally
00827             {
00828
00829             _StubMsg.BufferLength = 4U + 12U + 11U + 7U;
00830             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00831                                            (unsigned char __RPC_FAR *)sFilenames,
00832                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00833
00834             NdrProxyGetBuffer(This, &_StubMsg);
00835             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00836
00837             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00838                                          (unsigned char __RPC_FAR *)sFilenames,
00839                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00840
00841             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00842             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bDirectories;
00843
00844             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bRecurse;
00845
00846             NdrProxySendReceive(This, &_StubMsg);
00847
00848             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00849                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
00850
00851             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00852
00853             }
00854         RpcFinally
00855             {
00856             NdrProxyFreeBuffer(This, &_StubMsg);
00857
00858             }
00859         RpcEndFinally
00860
00861         }
00862     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00863         {
00864         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00865         }
00866     RpcEndExcept
00867     return _RetVal;
00868 }

void __RPC_STUB ICvsCoworker_UpdateFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 870 of file CVS_Coworker_p.c.

00875 {
00876     HRESULT _RetVal;
00877     MIDL_STUB_MESSAGE _StubMsg;
00878     BOOL bDirectories;
00879     BOOL bRecurse;
00880     int handle;
00881     const unsigned char __RPC_FAR *sFilenames;
00882
00883 NdrStubInitialize(
00884                      _pRpcMessage,
00885                      &_StubMsg,
00886                      &Object_StubDesc,
00887                      _pRpcChannelBuffer);
00888     ( unsigned char __RPC_FAR * )sFilenames = 0;
00889     RpcTryFinally
00890         {
00891         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00892             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
00893
00894         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00895
00896         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00897                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
00898                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00899                                        (unsigned char)0 );
00900
00901         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00902         bDirectories = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00903
00904         bRecurse = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00905
00906
00907         *_pdwStubPhase = STUB_CALL_SERVER;
00908         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> UpdateFiles(
00909                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00910                handle,
00911                sFilenames,
00912                bDirectories,
00913                bRecurse);
00914
00915         *_pdwStubPhase = STUB_MARSHAL;
00916
00917         _StubMsg.BufferLength = 4U;
00918         _StubMsg.BufferLength += 16;
00919
00920         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00921         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00922
00923         }
00924     RpcFinally
00925         {
00926         }
00927     RpcEndFinally
00928     _pRpcMessage->BufferLength =
00929         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00930
00931 }

void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t )

void __RPC_USER MIDL_user_free ( void __RPC_FAR * )

virtual HRESULT STDMETHODCALLTYPE OpenProject | ( | int __RPC_FAR * | pHandle,
 |  | const unsigned char __RPC_FAR * | sUsername,
 |  | const unsigned char __RPC_FAR * | sProjectName,
 |  | const unsigned char __RPC_FAR * | sProjectHome
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE RemoveFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE RenameFile | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sOldFilename,
 |  | const unsigned char __RPC_FAR * | sNewFilename
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE ShowAdvancedOptionsForCommand | ( | int | handle,
 |  | CvsCommand | command
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE ShowFileHistory | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE ShowFileProperties | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilename
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE ShowUserInterface | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE UncheckoutFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) | [pure virtual]

virtual HRESULT STDMETHODCALLTYPE UpdateFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames,
 |  | BOOL | bDirectories,
 |  | BOOL | bRecurse
 | ) | [pure virtual]

Variable Documentation

EXTERN_C const CLSID CLSID_CvsCoworker

Definition at line 733 of file cvs_coworker.h.

EXTERN_C const IID IID_ICvsCoworker

Definition at line 102 of file cvs_coworker.h.

EXTERN_C const IID LIBID_CVS_COWORKERLib

Definition at line 731 of file cvs_coworker.h.

RPC_IF_HANDLE __MIDL_itf_cvs_coworker_0000_v0_0_c_ifspec

Definition at line 92 of file cvs_coworker.h.

RPC_IF_HANDLE __MIDL_itf_cvs_coworker_0000_v0_0_s_ifspec

Definition at line 93 of file cvs_coworker.h.

ICvsCoworker __pad13__

Definition at line 111 of file cvs_coworker.h.

ICvsCoworker int __RPC_FAR* piError = 0

Definition at line 112 of file cvs_coworker.h.

Generated on Sun Oct 21 12:45:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CVS_Coworker_i.c File Reference

WinCvs/CoWorker/CVS_Coworker_i.c File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct | _IID

Typedefs

typedef _IID | IID
typedef IID | CLSID

Variables

const IID | IID_ICvsCoworker = {0x10E5359C,0xF454,0x11D2,{0xB4,0x42,0x00,0x80,0xC6,0xF9,0x17,0x9D}}
const IID | LIBID_CVS_COWORKERLib = {0x10E53590,0xF454,0x11D2,{0xB4,0x42,0x00,0x80,0xC6,0xF9,0x17,0x9D}}
const CLSID | CLSID_CvsCoworker = {0x10E5359D,0xF454,0x11D2,{0xB4,0x42,0x00,0x80,0xC6,0xF9,0x17,0x9D}}

Typedef Documentation

typedef IID CLSID

Definition at line 35 of file CVS_Coworker_i.c.

typedef struct _IID IID

Variable Documentation

const CLSID CLSID_CvsCoworker = {0x10E5359D,0xF454,0x11D2,{0xB4,0x42,0x00,0x80,0xC6,0xF9,0x17,0x9D}}

Definition at line 44 of file CVS_Coworker_i.c.

const IID IID_ICvsCoworker = {0x10E5359C,0xF454,0x11D2,{0xB4,0x42,0x00,0x80,0xC6,0xF9,0x17,0x9D}}

Definition at line 38 of file CVS_Coworker_i.c.

const IID LIBID_CVS_COWORKERLib = {0x10E53590,0xF454,0x11D2,{0xB4,0x42,0x00,0x80,0xC6,0xF9,0x17,0x9D}}

Definition at line 41 of file CVS_Coworker_i.c.

Generated on Sun Oct 21 12:45:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CVS_Coworker_i.h File Reference

WinCvs/CoWorker/CVS_Coworker_i.h File Reference

#include "rpc.h"
#include "rpcndr.h"
#include "windows.h"
#include "ole2.h"
#include "oaidl.h"
#include "ocidl.h"

Include dependency graph for CVS_Coworker_i.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | __REQUIRED_RPCNDR_H_VERSION__ 440

Typedefs

typedef interface ICvsCoworker | ICvsCoworker
typedef CvsCoworker | CvsCoworker
typedef enum CvsOption | CvsOption
typedef enum CvsCommand | CvsCommand

Enumerations

enum | CvsOption { cvsOptionCompareContents = 1, cvsOptionCompareChecksum = 2, cvsOptionCompareTimestamp = 3 }
enum CvsCommand {
cvsCommandUpdate = 0, cvsCommandCheckout = 1, cvsCommandCheckin = 2, cvsCommandUncheckout = 3,
cvsCommandAdd = 4, cvsCommandRemove = 5, cvsCommandDiff = 6, cvsCommandHistory = 7,
cvsCommandRename = 8, cvsCommandProperties = 9, cvsCommandOptions = 10
}

Functions

void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *)
virtual HRESULT STDMETHODCALLTYPE | GetErrorMessage (int handle, int iError, int cbErrorBuffer, unsigned char __RPC_FAR *sErrorBuffer)=0
virtual HRESULT STDMETHODCALLTYPE | OpenProject (int __RPC_FAR *pHandle, const unsigned char __RPC_FAR *sUsername, const unsigned char __RPC_FAR *sProjectName, const unsigned char __RPC_FAR *sProjectHome)=0
virtual HRESULT STDMETHODCALLTYPE | GetProject (int __RPC_FAR *pHandle, const unsigned char __RPC_FAR *sUsername, int cbProjectNameBuffer, unsigned char __RPC_FAR *sProjectName, int cbProjectHomeBuffer, unsigned char __RPC_FAR *sProjectHome, BOOL bAllowPathChange, BOOL bAllowNewProject, BOOL __RPC_FAR *pbNewProject)=0
virtual HRESULT STDMETHODCALLTYPE | UpdateFiles (int handle, const unsigned char __RPC_FAR *sFilenames, BOOL bDirectories, BOOL bRecurse)=0
virtual HRESULT STDMETHODCALLTYPE | CheckoutFiles (int handle, const unsigned char __RPC_FAR *sFilenames)=0
virtual HRESULT STDMETHODCALLTYPE | CheckinFiles (int handle, const unsigned char __RPC_FAR *sFilenames, BOOL bKeepCheckedOut)=0
virtual HRESULT STDMETHODCALLTYPE | UncheckoutFiles (int handle, const unsigned char __RPC_FAR *sFilenames)=0
virtual HRESULT STDMETHODCALLTYPE | AddFiles (int handle, const unsigned char __RPC_FAR *sOptionsAndFilenames, const unsigned char __RPC_FAR *sComment)=0
virtual HRESULT STDMETHODCALLTYPE | RemoveFiles (int handle, const unsigned char __RPC_FAR *sFilenames)=0
virtual HRESULT STDMETHODCALLTYPE | RenameFile (int handle, const unsigned char __RPC_FAR *sOldFilename, const unsigned char __RPC_FAR *sNewFilename)=0
virtual HRESULT STDMETHODCALLTYPE | DiffFile (int handle, const unsigned char __RPC_FAR *sFilename, BOOL bIgnoreCase, BOOL bIgnoreBlanks)=0
virtual HRESULT STDMETHODCALLTYPE | ShowFileHistory (int handle, const unsigned char __RPC_FAR *sFilenames)=0
virtual HRESULT STDMETHODCALLTYPE | ShowFileProperties (int handle, const unsigned char __RPC_FAR *sFilename)=0
virtual HRESULT STDMETHODCALLTYPE | ShowUserInterface (int handle, const unsigned char __RPC_FAR *sFilenames)=0
virtual HRESULT STDMETHODCALLTYPE | HasAdvancedOptionsForCommand (int handle, CvsCommand command, BOOL __RPC_FAR *pbAdvancedOptions)=0
virtual HRESULT STDMETHODCALLTYPE | ShowAdvancedOptionsForCommand (int handle, CvsCommand command)=0
virtual HRESULT STDMETHODCALLTYPE | GetFileChanges (int handle, int cbFilenameBuffer, unsigned char __RPC_FAR *sFilenameBuffer)=0
virtual HRESULT STDMETHODCALLTYPE | GetFilesToAdd (int handle, int cbFilenamesBuffer, unsigned char __RPC_FAR *sFilenamesBuffer)=0
virtual HRESULT STDMETHODCALLTYPE | CloseProject (int handle)=0
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetLastError_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int __RPC_FAR *piError)
void __RPC_STUB | ICvsCoworker_GetLastError_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetErrorMessage_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int iError, int cbErrorBuffer, unsigned char __RPC_FAR *sErrorBuffer)
void __RPC_STUB | ICvsCoworker_GetErrorMessage_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_OpenProject_Proxy (ICvsCoworker __RPC_FAR *This, int __RPC_FAR *pHandle, const unsigned char __RPC_FAR *sUsername, const unsigned char __RPC_FAR *sProjectName, const unsigned char __RPC_FAR *sProjectHome)
void __RPC_STUB | ICvsCoworker_OpenProject_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetProject_Proxy (ICvsCoworker __RPC_FAR *This, int __RPC_FAR *pHandle, const unsigned char __RPC_FAR *sUsername, int cbProjectNameBuffer, unsigned char __RPC_FAR *sProjectName, int cbProjectHomeBuffer, unsigned char __RPC_FAR *sProjectHome, BOOL bAllowPathChange, BOOL bAllowNewProject, BOOL __RPC_FAR *pbNewProject)
void __RPC_STUB | ICvsCoworker_GetProject_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_UpdateFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames, BOOL bDirectories, BOOL bRecurse)
void __RPC_STUB | ICvsCoworker_UpdateFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_CheckoutFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_CheckoutFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_CheckinFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames, BOOL bKeepCheckedOut)
void __RPC_STUB | ICvsCoworker_CheckinFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_UncheckoutFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_UncheckoutFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_AddFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sOptionsAndFilenames, const unsigned char __RPC_FAR *sComment)
void __RPC_STUB | ICvsCoworker_AddFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_RemoveFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_RemoveFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_RenameFile_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sOldFilename, const unsigned char __RPC_FAR *sNewFilename)
void __RPC_STUB | ICvsCoworker_RenameFile_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_DiffFile_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilename, BOOL bIgnoreCase, BOOL bIgnoreBlanks)
void __RPC_STUB | ICvsCoworker_DiffFile_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowFileHistory_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_ShowFileHistory_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowFileProperties_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilename)
void __RPC_STUB | ICvsCoworker_ShowFileProperties_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowUserInterface_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_ShowUserInterface_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_HasAdvancedOptionsForCommand_Proxy (ICvsCoworker __RPC_FAR *This, int handle, CvsCommand command, BOOL __RPC_FAR *pbAdvancedOptions)
void __RPC_STUB | ICvsCoworker_HasAdvancedOptionsForCommand_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy (ICvsCoworker __RPC_FAR *This, int handle, CvsCommand command)
void __RPC_STUB | ICvsCoworker_ShowAdvancedOptionsForCommand_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetFileChanges_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int cbFilenameBuffer, unsigned char __RPC_FAR *sFilenameBuffer)
void __RPC_STUB | ICvsCoworker_GetFileChanges_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetFilesToAdd_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int cbFilenamesBuffer, unsigned char __RPC_FAR *sFilenamesBuffer)
void __RPC_STUB | ICvsCoworker_GetFilesToAdd_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_CloseProject_Proxy (ICvsCoworker __RPC_FAR *This, int handle)
void __RPC_STUB | ICvsCoworker_CloseProject_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
class | DECLSPEC_UUID ("10E5359D-F454-11D2-B442-0080C6F9179D") CvsCoworker

Variables

RPC_IF_HANDLE | __MIDL_itf_CVS_Coworker_0000_v0_0_c_ifspec
RPC_IF_HANDLE | __MIDL_itf_CVS_Coworker_0000_v0_0_s_ifspec
EXTERN_C const IID | IID_ICvsCoworker
ICvsCoworker __pad14__
ICvsCoworker int __RPC_FAR * | piError = 0
EXTERN_C const IID | LIBID_CVS_COWORKERLib
EXTERN_C const CLSID | CLSID_CvsCoworker

Define Documentation

#define __REQUIRED_RPCNDR_H_VERSION__ 440

Definition at line 16 of file CVS_Coworker_i.h.

Typedef Documentation

typedef enum CvsCommand CvsCommand

typedef class CvsCoworker CvsCoworker

Definition at line 50 of file CVS_Coworker_i.h.

typedef enum CvsOption CvsOption

typedef interface ICvsCoworker ICvsCoworker

Definition at line 42 of file CVS_Coworker_i.h.

Enumeration Type Documentation

enum CvsCommand

Enumeration values:
cvsCommandUpdate
cvsCommandCheckout
cvsCommandCheckin
cvsCommandUncheckout
cvsCommandAdd
cvsCommandRemove
cvsCommandDiff
cvsCommandHistory
cvsCommandRename
cvsCommandProperties
cvsCommandOptions

Definition at line 76 of file CVS_Coworker_i.h.

00077     {   cvsCommandUpdate    = 0,
00078     cvsCommandCheckout  = 1,
00079     cvsCommandCheckin   = 2,
00080     cvsCommandUncheckout    = 3,
00081     cvsCommandAdd   = 4,
00082     cvsCommandRemove    = 5,
00083     cvsCommandDiff  = 6,
00084     cvsCommandHistory   = 7,
00085     cvsCommandRename    = 8,
00086     cvsCommandProperties    = 9,
00087     cvsCommandOptions   = 10
00088     }   CvsCommand;

enum CvsOption

Enumeration values:
cvsOptionCompareContents
cvsOptionCompareChecksum
cvsOptionCompareTimestamp

Definition at line 69 of file CVS_Coworker_i.h.

00070     {   cvsOptionCompareContents    = 1,
00071     cvsOptionCompareChecksum    = 2,
00072     cvsOptionCompareTimestamp   = 3
00073     }   CvsOption;

Function Documentation

virtual HRESULT STDMETHODCALLTYPE AddFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sOptionsAndFilenames,
 |  | const unsigned char __RPC_FAR * | sComment
 | ) | [pure virtual]

Referenced by ICvsCoworker_AddFiles_Stub().

virtual HRESULT STDMETHODCALLTYPE CheckinFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames,
 |  | BOOL | bKeepCheckedOut
 | ) | [pure virtual]

Referenced by ICvsCoworker_CheckinFiles_Stub().

virtual HRESULT STDMETHODCALLTYPE CheckoutFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) | [pure virtual]

Referenced by ICvsCoworker_CheckoutFiles_Stub().

virtual HRESULT STDMETHODCALLTYPE CloseProject ( int handle ) [pure virtual]

Referenced by ICvsCoworker_CloseProject_Stub().

class DECLSPEC_UUID ( "10E5359D-F454-11D2-B442-0080C6F9179D" )

virtual HRESULT STDMETHODCALLTYPE DiffFile | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilename,
 |  | BOOL | bIgnoreCase,
 |  | BOOL | bIgnoreBlanks
 | ) | [pure virtual]

Referenced by ICvsCoworker_DiffFile_Stub().

virtual HRESULT STDMETHODCALLTYPE GetErrorMessage | ( | int | handle,
 |  | int | iError,
 |  | int | cbErrorBuffer,
 |  | unsigned char __RPC_FAR * | sErrorBuffer
 | ) | [pure virtual]

Referenced by ICvsCoworker_GetErrorMessage_Stub().

virtual HRESULT STDMETHODCALLTYPE GetFileChanges | ( | int | handle,
 |  | int | cbFilenameBuffer,
 |  | unsigned char __RPC_FAR * | sFilenameBuffer
 | ) | [pure virtual]

Referenced by ICvsCoworker_GetFileChanges_Stub().

virtual HRESULT STDMETHODCALLTYPE GetFilesToAdd | ( | int | handle,
 |  | int | cbFilenamesBuffer,
 |  | unsigned char __RPC_FAR * | sFilenamesBuffer
 | ) | [pure virtual]

Referenced by ICvsCoworker_GetFilesToAdd_Stub().

virtual HRESULT STDMETHODCALLTYPE GetProject | ( | int __RPC_FAR * | pHandle,
 |  | const unsigned char __RPC_FAR * | sUsername,
 |  | int | cbProjectNameBuffer,
 |  | unsigned char __RPC_FAR * | sProjectName,
 |  | int | cbProjectHomeBuffer,
 |  | unsigned char __RPC_FAR * | sProjectHome,
 |  | BOOL | bAllowPathChange,
 |  | BOOL | bAllowNewProject,
 |  | BOOL __RPC_FAR * | pbNewProject
 | ) | [pure virtual]

Referenced by ICvsCoworker_GetProject_Stub().

virtual HRESULT STDMETHODCALLTYPE HasAdvancedOptionsForCommand | ( | int | handle,
 |  | CvsCommand | command,
 |  | BOOL __RPC_FAR * | pbAdvancedOptions
 | ) | [pure virtual]

Referenced by ICvsCoworker_HasAdvancedOptionsForCommand_Stub().

HRESULT STDMETHODCALLTYPE ICvsCoworker_AddFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sOptionsAndFilenames,
 |  | const unsigned char __RPC_FAR * | sComment
 | ) |

Definition at line 1306 of file CVS_Coworker_p.c.

01311 {
01312
01313     HRESULT _RetVal;
01314
01315     RPC_MESSAGE _RpcMessage;
01316
01317     MIDL_STUB_MESSAGE _StubMsg;
01318
01319     RpcTryExcept
01320         {
01321         NdrProxyInitialize(
01322                       ( void __RPC_FAR *  )This,
01323                       ( PRPC_MESSAGE  )&_RpcMessage,
01324                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01325                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01326                       11);
01327
01328
01329
01330         if(!sOptionsAndFilenames)
01331             {
01332             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01333             }
01334         if(!sComment)
01335             {
01336             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01337             }
01338         RpcTryFinally
01339             {
01340
01341             _StubMsg.BufferLength = 4U + 12U + 13U;
01342             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01343                                            (unsigned char __RPC_FAR *)sOptionsAndFilenames,
01344                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01345
01346             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01347                                            (unsigned char __RPC_FAR *)sComment,
01348                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01349
01350             NdrProxyGetBuffer(This, &_StubMsg);
01351             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01352
01353             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01354                                          (unsigned char __RPC_FAR *)sOptionsAndFilenames,
01355                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01356
01357             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01358                                          (unsigned char __RPC_FAR *)sComment,
01359                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01360
01361             NdrProxySendReceive(This, &_StubMsg);
01362
01363             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01364                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01365
01366             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01367
01368             }
01369         RpcFinally
01370             {
01371             NdrProxyFreeBuffer(This, &_StubMsg);
01372
01373             }
01374         RpcEndFinally
01375
01376         }
01377     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01378         {
01379         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01380         }
01381     RpcEndExcept
01382     return _RetVal;
01383 }

void __RPC_STUB ICvsCoworker_AddFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1385 of file CVS_Coworker_p.c.

01390 {
01391     HRESULT _RetVal;
01392     MIDL_STUB_MESSAGE _StubMsg;
01393     int handle;
01394     const unsigned char __RPC_FAR *sComment;
01395     const unsigned char __RPC_FAR *sOptionsAndFilenames;
01396
01397 NdrStubInitialize(
01398                      _pRpcMessage,
01399                      &_StubMsg,
01400                      &Object_StubDesc,
01401                      _pRpcChannelBuffer);
01402     ( unsigned char __RPC_FAR * )sOptionsAndFilenames = 0;
01403     ( unsigned char __RPC_FAR * )sComment = 0;
01404     RpcTryFinally
01405         {
01406         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01407             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01408
01409         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01410
01411         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01412                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sOptionsAndFilenames,
01413                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01414                                        (unsigned char)0 );
01415
01416         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01417                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sComment,
01418                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01419                                        (unsigned char)0 );
01420
01421
01422         *_pdwStubPhase = STUB_CALL_SERVER;
01423         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> AddFiles(
01424             (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01425             handle,
01426             sOptionsAndFilenames,
01427             sComment);
01428
01429         *_pdwStubPhase = STUB_MARSHAL;
01430
01431         _StubMsg.BufferLength = 4U;
01432         _StubMsg.BufferLength += 16;
01433
01434         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01435         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01436
01437         }
01438     RpcFinally
01439         {
01440         }
01441     RpcEndFinally
01442     _pRpcMessage->BufferLength =
01443         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01444
01445 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckinFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames,
 |  | BOOL | bKeepCheckedOut
 | ) |

Definition at line 1055 of file CVS_Coworker_p.c.

01060 {
01061
01062     HRESULT _RetVal;
01063
01064     RPC_MESSAGE _RpcMessage;
01065
01066     MIDL_STUB_MESSAGE _StubMsg;
01067
01068     RpcTryExcept
01069         {
01070         NdrProxyInitialize(
01071                       ( void __RPC_FAR *  )This,
01072                       ( PRPC_MESSAGE  )&_RpcMessage,
01073                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01074                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01075                       9);
01076
01077
01078
01079         if(!sFilenames)
01080             {
01081             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01082             }
01083         RpcTryFinally
01084             {
01085
01086             _StubMsg.BufferLength = 4U + 12U + 11U;
01087             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01088                                            (unsigned char __RPC_FAR *)sFilenames,
01089                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01090
01091             NdrProxyGetBuffer(This, &_StubMsg);
01092             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01093
01094             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01095                                          (unsigned char __RPC_FAR *)sFilenames,
01096                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01097
01098             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01099             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bKeepCheckedOut;
01100
01101             NdrProxySendReceive(This, &_StubMsg);
01102
01103             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01104                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[88] );
01105
01106             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01107
01108             }
01109         RpcFinally
01110             {
01111             NdrProxyFreeBuffer(This, &_StubMsg);
01112
01113             }
01114         RpcEndFinally
01115
01116         }
01117     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01118         {
01119         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01120         }
01121     RpcEndExcept
01122     return _RetVal;
01123 }

void __RPC_STUB ICvsCoworker_CheckinFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1125 of file CVS_Coworker_p.c.

01130 {
01131     HRESULT _RetVal;
01132     MIDL_STUB_MESSAGE _StubMsg;
01133     BOOL bKeepCheckedOut;
01134     int handle;
01135     const unsigned char __RPC_FAR *sFilenames;
01136
01137 NdrStubInitialize(
01138                      _pRpcMessage,
01139                      &_StubMsg,
01140                      &Object_StubDesc,
01141                      _pRpcChannelBuffer);
01142     ( unsigned char __RPC_FAR * )sFilenames = 0;
01143     RpcTryFinally
01144         {
01145         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01146             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[88] );
01147
01148         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01149
01150         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01151                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01152                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01153                                        (unsigned char)0 );
01154
01155         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01156         bKeepCheckedOut = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01157
01158
01159         *_pdwStubPhase = STUB_CALL_SERVER;
01160         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CheckinFiles(
01161                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01162                 handle,
01163                 sFilenames,
01164                 bKeepCheckedOut);
01165
01166         *_pdwStubPhase = STUB_MARSHAL;
01167
01168         _StubMsg.BufferLength = 4U;
01169         _StubMsg.BufferLength += 16;
01170
01171         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01172         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01173
01174         }
01175     RpcFinally
01176         {
01177         }
01178     RpcEndFinally
01179     _pRpcMessage->BufferLength =
01180         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01181
01182 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckoutFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 934 of file CVS_Coworker_p.c.

00938 {
00939
00940     HRESULT _RetVal;
00941
00942     RPC_MESSAGE _RpcMessage;
00943
00944     MIDL_STUB_MESSAGE _StubMsg;
00945
00946     RpcTryExcept
00947         {
00948         NdrProxyInitialize(
00949                       ( void __RPC_FAR *  )This,
00950                       ( PRPC_MESSAGE  )&_RpcMessage,
00951                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00952                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00953                       8);
00954
00955
00956
00957         if(!sFilenames)
00958             {
00959             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00960             }
00961         RpcTryFinally
00962             {
00963
00964             _StubMsg.BufferLength = 4U + 12U;
00965             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00966                                            (unsigned char __RPC_FAR *)sFilenames,
00967                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00968
00969             NdrProxyGetBuffer(This, &_StubMsg);
00970             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00971
00972             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00973                                          (unsigned char __RPC_FAR *)sFilenames,
00974                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00975
00976             NdrProxySendReceive(This, &_StubMsg);
00977
00978             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00979                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
00980
00981             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00982
00983             }
00984         RpcFinally
00985             {
00986             NdrProxyFreeBuffer(This, &_StubMsg);
00987
00988             }
00989         RpcEndFinally
00990
00991         }
00992     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00993         {
00994         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00995         }
00996     RpcEndExcept
00997     return _RetVal;
00998 }

void __RPC_STUB ICvsCoworker_CheckoutFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1000 of file CVS_Coworker_p.c.

01005 {
01006     HRESULT _RetVal;
01007     MIDL_STUB_MESSAGE _StubMsg;
01008     int handle;
01009     const unsigned char __RPC_FAR *sFilenames;
01010
01011 NdrStubInitialize(
01012                      _pRpcMessage,
01013                      &_StubMsg,
01014                      &Object_StubDesc,
01015                      _pRpcChannelBuffer);
01016     ( unsigned char __RPC_FAR * )sFilenames = 0;
01017     RpcTryFinally
01018         {
01019         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01020             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01021
01022         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01023
01024         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01025                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01026                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01027                                        (unsigned char)0 );
01028
01029
01030         *_pdwStubPhase = STUB_CALL_SERVER;
01031         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CheckoutFiles(
01032                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01033                  handle,
01034                  sFilenames);
01035
01036         *_pdwStubPhase = STUB_MARSHAL;
01037
01038         _StubMsg.BufferLength = 4U;
01039         _StubMsg.BufferLength += 16;
01040
01041         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01042         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01043
01044         }
01045     RpcFinally
01046         {
01047         }
01048     RpcEndFinally
01049     _pRpcMessage->BufferLength =
01050         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01051
01052 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_CloseProject_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle
 | ) |

Definition at line 2749 of file CVS_Coworker_p.c.

02752 {
02753
02754     HRESULT _RetVal;
02755
02756     RPC_MESSAGE _RpcMessage;
02757
02758     MIDL_STUB_MESSAGE _StubMsg;
02759
02760     RpcTryExcept
02761         {
02762         NdrProxyInitialize(
02763                       ( void __RPC_FAR *  )This,
02764                       ( PRPC_MESSAGE  )&_RpcMessage,
02765                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02766                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02767                       22);
02768
02769
02770
02771         RpcTryFinally
02772             {
02773
02774             _StubMsg.BufferLength = 4U;
02775             NdrProxyGetBuffer(This, &_StubMsg);
02776             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02777
02778             NdrProxySendReceive(This, &_StubMsg);
02779
02780             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02781                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[146] );
02782
02783             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02784
02785             }
02786         RpcFinally
02787             {
02788             NdrProxyFreeBuffer(This, &_StubMsg);
02789
02790             }
02791         RpcEndFinally
02792
02793         }
02794     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02795         {
02796         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02797         }
02798     RpcEndExcept
02799     return _RetVal;
02800 }

void __RPC_STUB ICvsCoworker_CloseProject_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2802 of file CVS_Coworker_p.c.

02807 {
02808     HRESULT _RetVal;
02809     MIDL_STUB_MESSAGE _StubMsg;
02810     int handle;
02811
02812 NdrStubInitialize(
02813                      _pRpcMessage,
02814                      &_StubMsg,
02815                      &Object_StubDesc,
02816                      _pRpcChannelBuffer);
02817     RpcTryFinally
02818         {
02819         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02820             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[146] );
02821
02822         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02823
02824
02825         *_pdwStubPhase = STUB_CALL_SERVER;
02826         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CloseProject((ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,handle);
02827
02828         *_pdwStubPhase = STUB_MARSHAL;
02829
02830         _StubMsg.BufferLength = 4U;
02831         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02832         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02833
02834         }
02835     RpcFinally
02836         {
02837         }
02838     RpcEndFinally
02839     _pRpcMessage->BufferLength =
02840         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02841
02842 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_DiffFile_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilename,
 |  | BOOL | bIgnoreCase,
 |  | BOOL | bIgnoreBlanks
 | ) |

Definition at line 1711 of file CVS_Coworker_p.c.

01717 {
01718
01719     HRESULT _RetVal;
01720
01721     RPC_MESSAGE _RpcMessage;
01722
01723     MIDL_STUB_MESSAGE _StubMsg;
01724
01725     RpcTryExcept
01726         {
01727         NdrProxyInitialize(
01728                       ( void __RPC_FAR *  )This,
01729                       ( PRPC_MESSAGE  )&_RpcMessage,
01730                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01731                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01732                       14);
01733
01734
01735
01736         if(!sFilename)
01737             {
01738             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01739             }
01740         RpcTryFinally
01741             {
01742
01743             _StubMsg.BufferLength = 4U + 12U + 11U + 7U;
01744             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01745                                            (unsigned char __RPC_FAR *)sFilename,
01746                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01747
01748             NdrProxyGetBuffer(This, &_StubMsg);
01749             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01750
01751             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01752                                          (unsigned char __RPC_FAR *)sFilename,
01753                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01754
01755             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01756             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bIgnoreCase;
01757
01758             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bIgnoreBlanks;
01759
01760             NdrProxySendReceive(This, &_StubMsg);
01761
01762             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01763                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
01764
01765             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01766
01767             }
01768         RpcFinally
01769             {
01770             NdrProxyFreeBuffer(This, &_StubMsg);
01771
01772             }
01773         RpcEndFinally
01774
01775         }
01776     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01777         {
01778         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01779         }
01780     RpcEndExcept
01781     return _RetVal;
01782 }

void __RPC_STUB ICvsCoworker_DiffFile_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1784 of file CVS_Coworker_p.c.

01789 {
01790     HRESULT _RetVal;
01791     MIDL_STUB_MESSAGE _StubMsg;
01792     BOOL bIgnoreBlanks;
01793     BOOL bIgnoreCase;
01794     int handle;
01795     const unsigned char __RPC_FAR *sFilename;
01796
01797 NdrStubInitialize(
01798                      _pRpcMessage,
01799                      &_StubMsg,
01800                      &Object_StubDesc,
01801                      _pRpcChannelBuffer);
01802     ( unsigned char __RPC_FAR * )sFilename = 0;
01803     RpcTryFinally
01804         {
01805         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01806             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
01807
01808         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01809
01810         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01811                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilename,
01812                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01813                                        (unsigned char)0 );
01814
01815         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01816         bIgnoreCase = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01817
01818         bIgnoreBlanks = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01819
01820
01821         *_pdwStubPhase = STUB_CALL_SERVER;
01822         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> DiffFile(
01823             (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01824             handle,
01825             sFilename,
01826             bIgnoreCase,
01827             bIgnoreBlanks);
01828
01829         *_pdwStubPhase = STUB_MARSHAL;
01830
01831         _StubMsg.BufferLength = 4U;
01832         _StubMsg.BufferLength += 16;
01833
01834         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01835         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01836
01837         }
01838     RpcFinally
01839         {
01840         }
01841     RpcEndFinally
01842     _pRpcMessage->BufferLength =
01843         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01844
01845 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetErrorMessage_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int | iError,
 |  | int | cbErrorBuffer,
 |  | unsigned char __RPC_FAR * | sErrorBuffer
 | ) |

Definition at line 181 of file CVS_Coworker_p.c.

00187 {
00188
00189     HRESULT _RetVal;
00190
00191     RPC_MESSAGE _RpcMessage;
00192
00193     MIDL_STUB_MESSAGE _StubMsg;
00194
00195     RpcTryExcept
00196         {
00197         NdrProxyInitialize(
00198                       ( void __RPC_FAR *  )This,
00199                       ( PRPC_MESSAGE  )&_RpcMessage,
00200                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00201                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00202                       4);
00203
00204
00205
00206         if(!sErrorBuffer)
00207             {
00208             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00209             }
00210         RpcTryFinally
00211             {
00212
00213             _StubMsg.BufferLength = 4U + 4U + 4U;
00214             NdrProxyGetBuffer(This, &_StubMsg);
00215             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00216
00217             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = iError;
00218
00219             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbErrorBuffer;
00220
00221             NdrProxySendReceive(This, &_StubMsg);
00222
00223             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00224                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[8] );
00225
00226             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00227                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sErrorBuffer,
00228                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10],
00229                                            (unsigned char)0 );
00230
00231             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00232             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00233
00234             }
00235         RpcFinally
00236             {
00237             NdrProxyFreeBuffer(This, &_StubMsg);
00238
00239             }
00240         RpcEndFinally
00241
00242         }
00243     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00244         {
00245         _StubMsg.MaxCount = cbErrorBuffer;
00246
00247         NdrClearOutParameters(
00248                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00249                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[6],
00250                          ( void __RPC_FAR * )sErrorBuffer);
00251         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00252         }
00253     RpcEndExcept
00254     return _RetVal;
00255 }

void __RPC_STUB ICvsCoworker_GetErrorMessage_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 257 of file CVS_Coworker_p.c.

00262 {
00263     HRESULT _RetVal;
00264     MIDL_STUB_MESSAGE _StubMsg;
00265     int cbErrorBuffer;
00266     int handle;
00267     int iError;
00268     unsigned char __RPC_FAR *sErrorBuffer;
00269
00270 NdrStubInitialize(
00271                      _pRpcMessage,
00272                      &_StubMsg,
00273                      &Object_StubDesc,
00274                      _pRpcChannelBuffer);
00275     ( unsigned char __RPC_FAR * )sErrorBuffer = 0;
00276     RpcTryFinally
00277         {
00278         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00279             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[8] );
00280
00281         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00282
00283         iError = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00284
00285         cbErrorBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00286
00287         if(cbErrorBuffer * 1 < 0)
00288             {
00289             RpcRaiseException(RPC_X_INVALID_BOUND);
00290             }
00291         sErrorBuffer = NdrAllocate(&_StubMsg,cbErrorBuffer * 1);
00292
00293         *_pdwStubPhase = STUB_CALL_SERVER;
00294         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetErrorMessage(
00295                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00296                    handle,
00297                    iError,
00298                    cbErrorBuffer,
00299                    sErrorBuffer);
00300
00301         *_pdwStubPhase = STUB_MARSHAL;
00302
00303         _StubMsg.BufferLength = 12U + 11U;
00304         _StubMsg.MaxCount = cbErrorBuffer;
00305
00306         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00307                                        (unsigned char __RPC_FAR *)sErrorBuffer,
00308                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10] );
00309
00310         _StubMsg.BufferLength += 16;
00311
00312         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00313         _StubMsg.MaxCount = cbErrorBuffer;
00314
00315         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00316                                      (unsigned char __RPC_FAR *)sErrorBuffer,
00317                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10] );
00318
00319         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00320         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00321
00322         }
00323     RpcFinally
00324         {
00325         _StubMsg.MaxCount = cbErrorBuffer;
00326
00327         NdrPointerFree( &_StubMsg,
00328                         (unsigned char __RPC_FAR *)sErrorBuffer,
00329                         &__MIDL_TypeFormatString.Format[6] );
00330
00331         }
00332     RpcEndFinally
00333     _pRpcMessage->BufferLength =
00334         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00335
00336 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFileChanges_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int | cbFilenameBuffer,
 |  | unsigned char __RPC_FAR * | sFilenameBuffer
 | ) |

Definition at line 2447 of file CVS_Coworker_p.c.

02452 {
02453
02454     HRESULT _RetVal;
02455
02456     RPC_MESSAGE _RpcMessage;
02457
02458     MIDL_STUB_MESSAGE _StubMsg;
02459
02460     RpcTryExcept
02461         {
02462         NdrProxyInitialize(
02463                       ( void __RPC_FAR *  )This,
02464                       ( PRPC_MESSAGE  )&_RpcMessage,
02465                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02466                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02467                       20);
02468
02469
02470
02471         if(!sFilenameBuffer)
02472             {
02473             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02474             }
02475         RpcTryFinally
02476             {
02477
02478             _StubMsg.BufferLength = 4U + 4U;
02479             NdrProxyGetBuffer(This, &_StubMsg);
02480             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02481
02482             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbFilenameBuffer;
02483
02484             NdrProxySendReceive(This, &_StubMsg);
02485
02486             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02487                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[126] );
02488
02489             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02490                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenameBuffer,
02491                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48],
02492                                            (unsigned char)0 );
02493
02494             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02495             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02496
02497             }
02498         RpcFinally
02499             {
02500             NdrProxyFreeBuffer(This, &_StubMsg);
02501
02502             }
02503         RpcEndFinally
02504
02505         }
02506     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02507         {
02508         _StubMsg.MaxCount = cbFilenameBuffer;
02509
02510         NdrClearOutParameters(
02511                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02512                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[44],
02513                          ( void __RPC_FAR * )sFilenameBuffer);
02514         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02515         }
02516     RpcEndExcept
02517     return _RetVal;
02518 }

void __RPC_STUB ICvsCoworker_GetFileChanges_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2520 of file CVS_Coworker_p.c.

02525 {
02526     HRESULT _RetVal;
02527     MIDL_STUB_MESSAGE _StubMsg;
02528     int cbFilenameBuffer;
02529     int handle;
02530     unsigned char __RPC_FAR *sFilenameBuffer;
02531
02532 NdrStubInitialize(
02533                      _pRpcMessage,
02534                      &_StubMsg,
02535                      &Object_StubDesc,
02536                      _pRpcChannelBuffer);
02537     ( unsigned char __RPC_FAR * )sFilenameBuffer = 0;
02538     RpcTryFinally
02539         {
02540         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02541             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[126] );
02542
02543         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02544
02545         cbFilenameBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02546
02547         if(cbFilenameBuffer * 1 < 0)
02548             {
02549             RpcRaiseException(RPC_X_INVALID_BOUND);
02550             }
02551         sFilenameBuffer = NdrAllocate(&_StubMsg,cbFilenameBuffer * 1);
02552
02553         *_pdwStubPhase = STUB_CALL_SERVER;
02554         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetFileChanges(
02555                   (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02556                   handle,
02557                   cbFilenameBuffer,
02558                   sFilenameBuffer);
02559
02560         *_pdwStubPhase = STUB_MARSHAL;
02561
02562         _StubMsg.BufferLength = 12U + 11U;
02563         _StubMsg.MaxCount = cbFilenameBuffer;
02564
02565         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02566                                        (unsigned char __RPC_FAR *)sFilenameBuffer,
02567                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48] );
02568
02569         _StubMsg.BufferLength += 16;
02570
02571         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02572         _StubMsg.MaxCount = cbFilenameBuffer;
02573
02574         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02575                                      (unsigned char __RPC_FAR *)sFilenameBuffer,
02576                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48] );
02577
02578         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02579         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02580
02581         }
02582     RpcFinally
02583         {
02584         _StubMsg.MaxCount = cbFilenameBuffer;
02585
02586         NdrPointerFree( &_StubMsg,
02587                         (unsigned char __RPC_FAR *)sFilenameBuffer,
02588                         &__MIDL_TypeFormatString.Format[44] );
02589
02590         }
02591     RpcEndFinally
02592     _pRpcMessage->BufferLength =
02593         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02594
02595 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFilesToAdd_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int | cbFilenamesBuffer,
 |  | unsigned char __RPC_FAR * | sFilenamesBuffer
 | ) |

Definition at line 2598 of file CVS_Coworker_p.c.

02603 {
02604
02605     HRESULT _RetVal;
02606
02607     RPC_MESSAGE _RpcMessage;
02608
02609     MIDL_STUB_MESSAGE _StubMsg;
02610
02611     RpcTryExcept
02612         {
02613         NdrProxyInitialize(
02614                       ( void __RPC_FAR *  )This,
02615                       ( PRPC_MESSAGE  )&_RpcMessage,
02616                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02617                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02618                       21);
02619
02620
02621
02622         if(!sFilenamesBuffer)
02623             {
02624             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02625             }
02626         RpcTryFinally
02627             {
02628
02629             _StubMsg.BufferLength = 4U + 4U;
02630             NdrProxyGetBuffer(This, &_StubMsg);
02631             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02632
02633             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbFilenamesBuffer;
02634
02635             NdrProxySendReceive(This, &_StubMsg);
02636
02637             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02638                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[136] );
02639
02640             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02641                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenamesBuffer,
02642                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58],
02643                                            (unsigned char)0 );
02644
02645             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02646             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02647
02648             }
02649         RpcFinally
02650             {
02651             NdrProxyFreeBuffer(This, &_StubMsg);
02652
02653             }
02654         RpcEndFinally
02655
02656         }
02657     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02658         {
02659         _StubMsg.MaxCount = cbFilenamesBuffer;
02660
02661         NdrClearOutParameters(
02662                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02663                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[54],
02664                          ( void __RPC_FAR * )sFilenamesBuffer);
02665         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02666         }
02667     RpcEndExcept
02668     return _RetVal;
02669 }

void __RPC_STUB ICvsCoworker_GetFilesToAdd_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2671 of file CVS_Coworker_p.c.

02676 {
02677     HRESULT _RetVal;
02678     MIDL_STUB_MESSAGE _StubMsg;
02679     int cbFilenamesBuffer;
02680     int handle;
02681     unsigned char __RPC_FAR *sFilenamesBuffer;
02682
02683 NdrStubInitialize(
02684                      _pRpcMessage,
02685                      &_StubMsg,
02686                      &Object_StubDesc,
02687                      _pRpcChannelBuffer);
02688     ( unsigned char __RPC_FAR * )sFilenamesBuffer = 0;
02689     RpcTryFinally
02690         {
02691         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02692             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[136] );
02693
02694         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02695
02696         cbFilenamesBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02697
02698         if(cbFilenamesBuffer * 1 < 0)
02699             {
02700             RpcRaiseException(RPC_X_INVALID_BOUND);
02701             }
02702         sFilenamesBuffer = NdrAllocate(&_StubMsg,cbFilenamesBuffer * 1);
02703
02704         *_pdwStubPhase = STUB_CALL_SERVER;
02705         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetFilesToAdd(
02706                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02707                  handle,
02708                  cbFilenamesBuffer,
02709                  sFilenamesBuffer);
02710
02711         *_pdwStubPhase = STUB_MARSHAL;
02712
02713         _StubMsg.BufferLength = 12U + 11U;
02714         _StubMsg.MaxCount = cbFilenamesBuffer;
02715
02716         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02717                                        (unsigned char __RPC_FAR *)sFilenamesBuffer,
02718                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58] );
02719
02720         _StubMsg.BufferLength += 16;
02721
02722         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02723         _StubMsg.MaxCount = cbFilenamesBuffer;
02724
02725         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02726                                      (unsigned char __RPC_FAR *)sFilenamesBuffer,
02727                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58] );
02728
02729         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02730         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02731
02732         }
02733     RpcFinally
02734         {
02735         _StubMsg.MaxCount = cbFilenamesBuffer;
02736
02737         NdrPointerFree( &_StubMsg,
02738                         (unsigned char __RPC_FAR *)sFilenamesBuffer,
02739                         &__MIDL_TypeFormatString.Format[54] );
02740
02741         }
02742     RpcEndFinally
02743     _pRpcMessage->BufferLength =
02744         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02745
02746 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetLastError_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int __RPC_FAR * | piError
 | ) |

Definition at line 65 of file CVS_Coworker_p.c.

00069 {
00070
00071     HRESULT _RetVal;
00072
00073     RPC_MESSAGE _RpcMessage;
00074
00075     MIDL_STUB_MESSAGE _StubMsg;
00076
00077     RpcTryExcept
00078         {
00079         NdrProxyInitialize(
00080                       ( void __RPC_FAR *  )This,
00081                       ( PRPC_MESSAGE  )&_RpcMessage,
00082                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00083                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00084                       3);
00085
00086
00087
00088         if(!piError)
00089             {
00090             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00091             }
00092         RpcTryFinally
00093             {
00094
00095             _StubMsg.BufferLength = 4U;
00096             NdrProxyGetBuffer(This, &_StubMsg);
00097             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00098
00099             NdrProxySendReceive(This, &_StubMsg);
00100
00101             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00102                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] );
00103
00104             *piError = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00105
00106             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00107
00108             }
00109         RpcFinally
00110             {
00111             NdrProxyFreeBuffer(This, &_StubMsg);
00112
00113             }
00114         RpcEndFinally
00115
00116         }
00117     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00118         {
00119         NdrClearOutParameters(
00120                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00121                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00122                          ( void __RPC_FAR * )piError);
00123         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00124         }
00125     RpcEndExcept
00126     return _RetVal;
00127 }

void __RPC_STUB ICvsCoworker_GetLastError_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 129 of file CVS_Coworker_p.c.

00134 {
00135     int _M0;
00136     HRESULT _RetVal;
00137     MIDL_STUB_MESSAGE _StubMsg;
00138     int handle;
00139     int __RPC_FAR *piError;
00140
00141 NdrStubInitialize(
00142                      _pRpcMessage,
00143                      &_StubMsg,
00144                      &Object_StubDesc,
00145                      _pRpcChannelBuffer);
00146     ( int __RPC_FAR * )piError = 0;
00147     RpcTryFinally
00148         {
00149         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00150             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] );
00151
00152         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00153
00154         piError = &_M0;
00155
00156         *_pdwStubPhase = STUB_CALL_SERVER;
00157         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetLastError(
00158                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00159                 handle,
00160                 piError);
00161
00162         *_pdwStubPhase = STUB_MARSHAL;
00163
00164         _StubMsg.BufferLength = 4U + 4U;
00165         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00166         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *piError;
00167
00168         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00169
00170         }
00171     RpcFinally
00172         {
00173         }
00174     RpcEndFinally
00175     _pRpcMessage->BufferLength =
00176         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00177
00178 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetProject_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int __RPC_FAR * | pHandle,
 |  | const unsigned char __RPC_FAR * | sUsername,
 |  | int | cbProjectNameBuffer,
 |  | unsigned char __RPC_FAR * | sProjectName,
 |  | int | cbProjectHomeBuffer,
 |  | unsigned char __RPC_FAR * | sProjectHome,
 |  | BOOL | bAllowPathChange,
 |  | BOOL | bAllowNewProject,
 |  | BOOL __RPC_FAR * | pbNewProject
 | ) |

Definition at line 511 of file CVS_Coworker_p.c.

00522 {
00523
00524     HRESULT _RetVal;
00525
00526     RPC_MESSAGE _RpcMessage;
00527
00528     MIDL_STUB_MESSAGE _StubMsg;
00529
00530     RpcTryExcept
00531         {
00532         NdrProxyInitialize(
00533                       ( void __RPC_FAR *  )This,
00534                       ( PRPC_MESSAGE  )&_RpcMessage,
00535                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00536                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00537                       6);
00538
00539
00540
00541         if(!pHandle)
00542             {
00543             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00544             }
00545         if(!sUsername)
00546             {
00547             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00548             }
00549         if(!sProjectName)
00550             {
00551             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00552             }
00553         if(!sProjectHome)
00554             {
00555             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00556             }
00557         if(!pbNewProject)
00558             {
00559             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00560             }
00561         RpcTryFinally
00562             {
00563
00564             _StubMsg.BufferLength = 1U + 7U + 12U + 11U + 13U + 11U + 7U;
00565             _StubMsg.MaxCount = cbProjectNameBuffer;
00566
00567             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00568                                            (unsigned char __RPC_FAR *)sProjectName,
00569                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00570
00571             _StubMsg.MaxCount = cbProjectHomeBuffer;
00572
00573             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00574                                            (unsigned char __RPC_FAR *)sProjectHome,
00575                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00576
00577             NdrProxyGetBuffer(This, &_StubMsg);
00578             *(( unsigned char __RPC_FAR * )_StubMsg.Buffer)++ = *sUsername;
00579
00580             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00581             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbProjectNameBuffer;
00582
00583             _StubMsg.MaxCount = cbProjectNameBuffer;
00584
00585             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00586                                          (unsigned char __RPC_FAR *)sProjectName,
00587                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00588
00589             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00590             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbProjectHomeBuffer;
00591
00592             _StubMsg.MaxCount = cbProjectHomeBuffer;
00593
00594             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00595                                          (unsigned char __RPC_FAR *)sProjectHome,
00596                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00597
00598             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00599             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bAllowPathChange;
00600
00601             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bAllowNewProject;
00602
00603             NdrProxySendReceive(This, &_StubMsg);
00604
00605             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00606                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[38] );
00607
00608             *pHandle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00609
00610             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00611                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00612                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28],
00613                                            (unsigned char)0 );
00614
00615             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00616                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00617                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38],
00618                                            (unsigned char)0 );
00619
00620             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00621             *pbNewProject = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00622
00623             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00624
00625             }
00626         RpcFinally
00627             {
00628             NdrProxyFreeBuffer(This, &_StubMsg);
00629
00630             }
00631         RpcEndFinally
00632
00633         }
00634     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00635         {
00636         NdrClearOutParameters(
00637                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00638                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00639                          ( void __RPC_FAR * )pHandle);
00640         _StubMsg.MaxCount = cbProjectNameBuffer;
00641
00642         NdrClearOutParameters(
00643                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00644                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[24],
00645                          ( void __RPC_FAR * )sProjectName);
00646         _StubMsg.MaxCount = cbProjectHomeBuffer;
00647
00648         NdrClearOutParameters(
00649                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00650                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[34],
00651                          ( void __RPC_FAR * )sProjectHome);
00652         NdrClearOutParameters(
00653                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00654                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00655                          ( void __RPC_FAR * )pbNewProject);
00656         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00657         }
00658     RpcEndExcept
00659     return _RetVal;
00660 }

void __RPC_STUB ICvsCoworker_GetProject_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 662 of file CVS_Coworker_p.c.

00667 {
00668     int _M14;
00669     BOOL _M15;
00670     HRESULT _RetVal;
00671     MIDL_STUB_MESSAGE _StubMsg;
00672     BOOL bAllowNewProject;
00673     BOOL bAllowPathChange;
00674     int cbProjectHomeBuffer;
00675     int cbProjectNameBuffer;
00676     int __RPC_FAR *pHandle;
00677     BOOL __RPC_FAR *pbNewProject;
00678     unsigned char __RPC_FAR *sProjectHome;
00679     unsigned char __RPC_FAR *sProjectName;
00680     const unsigned char __RPC_FAR *sUsername;
00681
00682 NdrStubInitialize(
00683                      _pRpcMessage,
00684                      &_StubMsg,
00685                      &Object_StubDesc,
00686                      _pRpcChannelBuffer);
00687     ( int __RPC_FAR * )pHandle = 0;
00688     ( unsigned char __RPC_FAR * )sUsername = 0;
00689     ( unsigned char __RPC_FAR * )sProjectName = 0;
00690     ( unsigned char __RPC_FAR * )sProjectHome = 0;
00691     ( BOOL __RPC_FAR * )pbNewProject = 0;
00692     RpcTryFinally
00693         {
00694         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00695             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[38] );
00696
00697         sUsername = ( unsigned char __RPC_FAR * )_StubMsg.Buffer;
00698         _StubMsg.Buffer += sizeof( unsigned char  );
00699
00700         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00701         cbProjectNameBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00702
00703         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00704                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00705                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28],
00706                                        (unsigned char)0 );
00707
00708         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00709         cbProjectHomeBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00710
00711         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00712                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00713                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38],
00714                                        (unsigned char)0 );
00715
00716         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00717         bAllowPathChange = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00718
00719         bAllowNewProject = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00720
00721         pHandle = &_M14;
00722         pbNewProject = &_M15;
00723
00724         *_pdwStubPhase = STUB_CALL_SERVER;
00725         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetProject(
00726               (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00727               pHandle,
00728               sUsername,
00729               cbProjectNameBuffer,
00730               sProjectName,
00731               cbProjectHomeBuffer,
00732               sProjectHome,
00733               bAllowPathChange,
00734               bAllowNewProject,
00735               pbNewProject);
00736
00737         *_pdwStubPhase = STUB_MARSHAL;
00738
00739         _StubMsg.BufferLength = 4U + 12U + 13U + 11U + 7U;
00740         _StubMsg.MaxCount = cbProjectNameBuffer;
00741
00742         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00743                                        (unsigned char __RPC_FAR *)sProjectName,
00744                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00745
00746         _StubMsg.MaxCount = cbProjectHomeBuffer;
00747
00748         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00749                                        (unsigned char __RPC_FAR *)sProjectHome,
00750                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00751
00752         _StubMsg.BufferLength += 16;
00753
00754         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00755         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *pHandle;
00756
00757         _StubMsg.MaxCount = cbProjectNameBuffer;
00758
00759         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00760                                      (unsigned char __RPC_FAR *)sProjectName,
00761                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00762
00763         _StubMsg.MaxCount = cbProjectHomeBuffer;
00764
00765         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00766                                      (unsigned char __RPC_FAR *)sProjectHome,
00767                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00768
00769         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00770         *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = *pbNewProject;
00771
00772         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00773
00774         }
00775     RpcFinally
00776         {
00777         _StubMsg.MaxCount = cbProjectNameBuffer;
00778
00779         NdrPointerFree( &_StubMsg,
00780                         (unsigned char __RPC_FAR *)sProjectName,
00781                         &__MIDL_TypeFormatString.Format[24] );
00782
00783         _StubMsg.MaxCount = cbProjectHomeBuffer;
00784
00785         NdrPointerFree( &_StubMsg,
00786                         (unsigned char __RPC_FAR *)sProjectHome,
00787                         &__MIDL_TypeFormatString.Format[34] );
00788
00789         }
00790     RpcEndFinally
00791     _pRpcMessage->BufferLength =
00792         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00793
00794 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_HasAdvancedOptionsForCommand_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | CvsCommand | command,
 |  | BOOL __RPC_FAR * | pbAdvancedOptions
 | ) |

Definition at line 2211 of file CVS_Coworker_p.c.

02216 {
02217
02218     HRESULT _RetVal;
02219
02220     RPC_MESSAGE _RpcMessage;
02221
02222     MIDL_STUB_MESSAGE _StubMsg;
02223
02224     RpcTryExcept
02225         {
02226         NdrProxyInitialize(
02227                       ( void __RPC_FAR *  )This,
02228                       ( PRPC_MESSAGE  )&_RpcMessage,
02229                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02230                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02231                       18);
02232
02233
02234
02235         if(!pbAdvancedOptions)
02236             {
02237             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02238             }
02239         RpcTryFinally
02240             {
02241
02242             _StubMsg.BufferLength = 4U + 2U;
02243             NdrProxyGetBuffer(This, &_StubMsg);
02244             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02245
02246             NdrSimpleTypeMarshall(
02247                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02248                          ( unsigned char __RPC_FAR * )&command,
02249                          13);
02250             NdrProxySendReceive(This, &_StubMsg);
02251
02252             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02253                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[110] );
02254
02255             *pbAdvancedOptions = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
02256
02257             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02258
02259             }
02260         RpcFinally
02261             {
02262             NdrProxyFreeBuffer(This, &_StubMsg);
02263
02264             }
02265         RpcEndFinally
02266
02267         }
02268     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02269         {
02270         NdrClearOutParameters(
02271                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02272                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
02273                          ( void __RPC_FAR * )pbAdvancedOptions);
02274         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02275         }
02276     RpcEndExcept
02277     return _RetVal;
02278 }

void __RPC_STUB ICvsCoworker_HasAdvancedOptionsForCommand_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2280 of file CVS_Coworker_p.c.

02285 {
02286     BOOL _M42;
02287     HRESULT _RetVal;
02288     MIDL_STUB_MESSAGE _StubMsg;
02289     CvsCommand command;
02290     int handle;
02291     BOOL __RPC_FAR *pbAdvancedOptions;
02292
02293 NdrStubInitialize(
02294                      _pRpcMessage,
02295                      &_StubMsg,
02296                      &Object_StubDesc,
02297                      _pRpcChannelBuffer);
02298     ( BOOL __RPC_FAR * )pbAdvancedOptions = 0;
02299     RpcTryFinally
02300         {
02301         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02302             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[110] );
02303
02304         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02305
02306         NdrSimpleTypeUnmarshall(
02307                            ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02308                            ( unsigned char __RPC_FAR * )&command,
02309                            13);
02310         pbAdvancedOptions = &_M42;
02311
02312         *_pdwStubPhase = STUB_CALL_SERVER;
02313         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> HasAdvancedOptionsForCommand(
02314                                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02315                                 handle,
02316                                 command,
02317                                 pbAdvancedOptions);
02318
02319         *_pdwStubPhase = STUB_MARSHAL;
02320
02321         _StubMsg.BufferLength = 4U + 4U;
02322         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02323         *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = *pbAdvancedOptions;
02324
02325         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02326
02327         }
02328     RpcFinally
02329         {
02330         }
02331     RpcEndFinally
02332     _pRpcMessage->BufferLength =
02333         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02334
02335 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_OpenProject_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int __RPC_FAR * | pHandle,
 |  | const unsigned char __RPC_FAR * | sUsername,
 |  | const unsigned char __RPC_FAR * | sProjectName,
 |  | const unsigned char __RPC_FAR * | sProjectHome
 | ) |

Definition at line 339 of file CVS_Coworker_p.c.

00345 {
00346
00347     HRESULT _RetVal;
00348
00349     RPC_MESSAGE _RpcMessage;
00350
00351     MIDL_STUB_MESSAGE _StubMsg;
00352
00353     RpcTryExcept
00354         {
00355         NdrProxyInitialize(
00356                       ( void __RPC_FAR *  )This,
00357                       ( PRPC_MESSAGE  )&_RpcMessage,
00358                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00359                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00360                       5);
00361
00362
00363
00364         if(!pHandle)
00365             {
00366             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00367             }
00368         if(!sUsername)
00369             {
00370             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00371             }
00372         if(!sProjectName)
00373             {
00374             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00375             }
00376         if(!sProjectHome)
00377             {
00378             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00379             }
00380         RpcTryFinally
00381             {
00382
00383             _StubMsg.BufferLength = 12U + 13U + 13U;
00384             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00385                                            (unsigned char __RPC_FAR *)sUsername,
00386                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00387
00388             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00389                                            (unsigned char __RPC_FAR *)sProjectName,
00390                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00391
00392             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00393                                            (unsigned char __RPC_FAR *)sProjectHome,
00394                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00395
00396             NdrProxyGetBuffer(This, &_StubMsg);
00397             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00398                                          (unsigned char __RPC_FAR *)sUsername,
00399                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00400
00401             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00402                                          (unsigned char __RPC_FAR *)sProjectName,
00403                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00404
00405             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00406                                          (unsigned char __RPC_FAR *)sProjectHome,
00407                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00408
00409             NdrProxySendReceive(This, &_StubMsg);
00410
00411             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00412                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[20] );
00413
00414             *pHandle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00415
00416             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00417
00418             }
00419         RpcFinally
00420             {
00421             NdrProxyFreeBuffer(This, &_StubMsg);
00422
00423             }
00424         RpcEndFinally
00425
00426         }
00427     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00428         {
00429         NdrClearOutParameters(
00430                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00431                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00432                          ( void __RPC_FAR * )pHandle);
00433         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00434         }
00435     RpcEndExcept
00436     return _RetVal;
00437 }

void __RPC_STUB ICvsCoworker_OpenProject_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 439 of file CVS_Coworker_p.c.

00444 {
00445     int _M9;
00446     HRESULT _RetVal;
00447     MIDL_STUB_MESSAGE _StubMsg;
00448     int __RPC_FAR *pHandle;
00449     const unsigned char __RPC_FAR *sProjectHome;
00450     const unsigned char __RPC_FAR *sProjectName;
00451     const unsigned char __RPC_FAR *sUsername;
00452
00453 NdrStubInitialize(
00454                      _pRpcMessage,
00455                      &_StubMsg,
00456                      &Object_StubDesc,
00457                      _pRpcChannelBuffer);
00458     ( int __RPC_FAR * )pHandle = 0;
00459     ( unsigned char __RPC_FAR * )sUsername = 0;
00460     ( unsigned char __RPC_FAR * )sProjectName = 0;
00461     ( unsigned char __RPC_FAR * )sProjectHome = 0;
00462     RpcTryFinally
00463         {
00464         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00465             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[20] );
00466
00467         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00468                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sUsername,
00469                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00470                                        (unsigned char)0 );
00471
00472         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00473                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00474                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00475                                        (unsigned char)0 );
00476
00477         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00478                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00479                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00480                                        (unsigned char)0 );
00481
00482         pHandle = &_M9;
00483
00484         *_pdwStubPhase = STUB_CALL_SERVER;
00485         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> OpenProject(
00486                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00487                pHandle,
00488                sUsername,
00489                sProjectName,
00490                sProjectHome);
00491
00492         *_pdwStubPhase = STUB_MARSHAL;
00493
00494         _StubMsg.BufferLength = 4U + 4U;
00495         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00496         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *pHandle;
00497
00498         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00499
00500         }
00501     RpcFinally
00502         {
00503         }
00504     RpcEndFinally
00505     _pRpcMessage->BufferLength =
00506         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00507
00508 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_RemoveFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 1448 of file CVS_Coworker_p.c.

01452 {
01453
01454     HRESULT _RetVal;
01455
01456     RPC_MESSAGE _RpcMessage;
01457
01458     MIDL_STUB_MESSAGE _StubMsg;
01459
01460     RpcTryExcept
01461         {
01462         NdrProxyInitialize(
01463                       ( void __RPC_FAR *  )This,
01464                       ( PRPC_MESSAGE  )&_RpcMessage,
01465                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01466                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01467                       12);
01468
01469
01470
01471         if(!sFilenames)
01472             {
01473             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01474             }
01475         RpcTryFinally
01476             {
01477
01478             _StubMsg.BufferLength = 4U + 12U;
01479             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01480                                            (unsigned char __RPC_FAR *)sFilenames,
01481                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01482
01483             NdrProxyGetBuffer(This, &_StubMsg);
01484             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01485
01486             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01487                                          (unsigned char __RPC_FAR *)sFilenames,
01488                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01489
01490             NdrProxySendReceive(This, &_StubMsg);
01491
01492             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01493                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01494
01495             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01496
01497             }
01498         RpcFinally
01499             {
01500             NdrProxyFreeBuffer(This, &_StubMsg);
01501
01502             }
01503         RpcEndFinally
01504
01505         }
01506     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01507         {
01508         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01509         }
01510     RpcEndExcept
01511     return _RetVal;
01512 }

void __RPC_STUB ICvsCoworker_RemoveFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1514 of file CVS_Coworker_p.c.

01519 {
01520     HRESULT _RetVal;
01521     MIDL_STUB_MESSAGE _StubMsg;
01522     int handle;
01523     const unsigned char __RPC_FAR *sFilenames;
01524
01525 NdrStubInitialize(
01526                      _pRpcMessage,
01527                      &_StubMsg,
01528                      &Object_StubDesc,
01529                      _pRpcChannelBuffer);
01530     ( unsigned char __RPC_FAR * )sFilenames = 0;
01531     RpcTryFinally
01532         {
01533         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01534             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01535
01536         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01537
01538         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01539                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01540                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01541                                        (unsigned char)0 );
01542
01543
01544         *_pdwStubPhase = STUB_CALL_SERVER;
01545         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> RemoveFiles(
01546                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01547                handle,
01548                sFilenames);
01549
01550         *_pdwStubPhase = STUB_MARSHAL;
01551
01552         _StubMsg.BufferLength = 4U;
01553         _StubMsg.BufferLength += 16;
01554
01555         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01556         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01557
01558         }
01559     RpcFinally
01560         {
01561         }
01562     RpcEndFinally
01563     _pRpcMessage->BufferLength =
01564         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01565
01566 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_RenameFile_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sOldFilename,
 |  | const unsigned char __RPC_FAR * | sNewFilename
 | ) |

Definition at line 1569 of file CVS_Coworker_p.c.

01574 {
01575
01576     HRESULT _RetVal;
01577
01578     RPC_MESSAGE _RpcMessage;
01579
01580     MIDL_STUB_MESSAGE _StubMsg;
01581
01582     RpcTryExcept
01583         {
01584         NdrProxyInitialize(
01585                       ( void __RPC_FAR *  )This,
01586                       ( PRPC_MESSAGE  )&_RpcMessage,
01587                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01588                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01589                       13);
01590
01591
01592
01593         if(!sOldFilename)
01594             {
01595             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01596             }
01597         if(!sNewFilename)
01598             {
01599             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01600             }
01601         RpcTryFinally
01602             {
01603
01604             _StubMsg.BufferLength = 4U + 12U + 13U;
01605             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01606                                            (unsigned char __RPC_FAR *)sOldFilename,
01607                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01608
01609             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01610                                            (unsigned char __RPC_FAR *)sNewFilename,
01611                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01612
01613             NdrProxyGetBuffer(This, &_StubMsg);
01614             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01615
01616             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01617                                          (unsigned char __RPC_FAR *)sOldFilename,
01618                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01619
01620             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01621                                          (unsigned char __RPC_FAR *)sNewFilename,
01622                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01623
01624             NdrProxySendReceive(This, &_StubMsg);
01625
01626             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01627                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01628
01629             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01630
01631             }
01632         RpcFinally
01633             {
01634             NdrProxyFreeBuffer(This, &_StubMsg);
01635
01636             }
01637         RpcEndFinally
01638
01639         }
01640     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01641         {
01642         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01643         }
01644     RpcEndExcept
01645     return _RetVal;
01646 }

void __RPC_STUB ICvsCoworker_RenameFile_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1648 of file CVS_Coworker_p.c.

01653 {
01654     HRESULT _RetVal;
01655     MIDL_STUB_MESSAGE _StubMsg;
01656     int handle;
01657     const unsigned char __RPC_FAR *sNewFilename;
01658     const unsigned char __RPC_FAR *sOldFilename;
01659
01660 NdrStubInitialize(
01661                      _pRpcMessage,
01662                      &_StubMsg,
01663                      &Object_StubDesc,
01664                      _pRpcChannelBuffer);
01665     ( unsigned char __RPC_FAR * )sOldFilename = 0;
01666     ( unsigned char __RPC_FAR * )sNewFilename = 0;
01667     RpcTryFinally
01668         {
01669         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01670             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01671
01672         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01673
01674         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01675                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sOldFilename,
01676                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01677                                        (unsigned char)0 );
01678
01679         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01680                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sNewFilename,
01681                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01682                                        (unsigned char)0 );
01683
01684
01685         *_pdwStubPhase = STUB_CALL_SERVER;
01686         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> RenameFile(
01687               (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01688               handle,
01689               sOldFilename,
01690               sNewFilename);
01691
01692         *_pdwStubPhase = STUB_MARSHAL;
01693
01694         _StubMsg.BufferLength = 4U;
01695         _StubMsg.BufferLength += 16;
01696
01697         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01698         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01699
01700         }
01701     RpcFinally
01702         {
01703         }
01704     RpcEndFinally
01705     _pRpcMessage->BufferLength =
01706         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01707
01708 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | CvsCommand | command
 | ) |

Definition at line 2338 of file CVS_Coworker_p.c.

02342 {
02343
02344     HRESULT _RetVal;
02345
02346     RPC_MESSAGE _RpcMessage;
02347
02348     MIDL_STUB_MESSAGE _StubMsg;
02349
02350     RpcTryExcept
02351         {
02352         NdrProxyInitialize(
02353                       ( void __RPC_FAR *  )This,
02354                       ( PRPC_MESSAGE  )&_RpcMessage,
02355                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02356                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02357                       19);
02358
02359
02360
02361         RpcTryFinally
02362             {
02363
02364             _StubMsg.BufferLength = 4U + 2U;
02365             NdrProxyGetBuffer(This, &_StubMsg);
02366             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02367
02368             NdrSimpleTypeMarshall(
02369                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02370                          ( unsigned char __RPC_FAR * )&command,
02371                          13);
02372             NdrProxySendReceive(This, &_StubMsg);
02373
02374             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02375                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[120] );
02376
02377             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02378
02379             }
02380         RpcFinally
02381             {
02382             NdrProxyFreeBuffer(This, &_StubMsg);
02383
02384             }
02385         RpcEndFinally
02386
02387         }
02388     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02389         {
02390         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02391         }
02392     RpcEndExcept
02393     return _RetVal;
02394 }

void __RPC_STUB ICvsCoworker_ShowAdvancedOptionsForCommand_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2396 of file CVS_Coworker_p.c.

02401 {
02402     HRESULT _RetVal;
02403     MIDL_STUB_MESSAGE _StubMsg;
02404     CvsCommand command;
02405     int handle;
02406
02407 NdrStubInitialize(
02408                      _pRpcMessage,
02409                      &_StubMsg,
02410                      &Object_StubDesc,
02411                      _pRpcChannelBuffer);
02412     RpcTryFinally
02413         {
02414         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02415             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[120] );
02416
02417         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02418
02419         NdrSimpleTypeUnmarshall(
02420                            ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02421                            ( unsigned char __RPC_FAR * )&command,
02422                            13);
02423
02424         *_pdwStubPhase = STUB_CALL_SERVER;
02425         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowAdvancedOptionsForCommand(
02426                                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02427                                  handle,
02428                                  command);
02429
02430         *_pdwStubPhase = STUB_MARSHAL;
02431
02432         _StubMsg.BufferLength = 4U;
02433         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02434         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02435
02436         }
02437     RpcFinally
02438         {
02439         }
02440     RpcEndFinally
02441     _pRpcMessage->BufferLength =
02442         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02443
02444 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileHistory_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 1848 of file CVS_Coworker_p.c.

01852 {
01853
01854     HRESULT _RetVal;
01855
01856     RPC_MESSAGE _RpcMessage;
01857
01858     MIDL_STUB_MESSAGE _StubMsg;
01859
01860     RpcTryExcept
01861         {
01862         NdrProxyInitialize(
01863                       ( void __RPC_FAR *  )This,
01864                       ( PRPC_MESSAGE  )&_RpcMessage,
01865                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01866                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01867                       15);
01868
01869
01870
01871         if(!sFilenames)
01872             {
01873             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01874             }
01875         RpcTryFinally
01876             {
01877
01878             _StubMsg.BufferLength = 4U + 12U;
01879             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01880                                            (unsigned char __RPC_FAR *)sFilenames,
01881                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01882
01883             NdrProxyGetBuffer(This, &_StubMsg);
01884             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01885
01886             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01887                                          (unsigned char __RPC_FAR *)sFilenames,
01888                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01889
01890             NdrProxySendReceive(This, &_StubMsg);
01891
01892             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01893                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01894
01895             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01896
01897             }
01898         RpcFinally
01899             {
01900             NdrProxyFreeBuffer(This, &_StubMsg);
01901
01902             }
01903         RpcEndFinally
01904
01905         }
01906     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01907         {
01908         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01909         }
01910     RpcEndExcept
01911     return _RetVal;
01912 }

void __RPC_STUB ICvsCoworker_ShowFileHistory_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1914 of file CVS_Coworker_p.c.

01919 {
01920     HRESULT _RetVal;
01921     MIDL_STUB_MESSAGE _StubMsg;
01922     int handle;
01923     const unsigned char __RPC_FAR *sFilenames;
01924
01925 NdrStubInitialize(
01926                      _pRpcMessage,
01927                      &_StubMsg,
01928                      &Object_StubDesc,
01929                      _pRpcChannelBuffer);
01930     ( unsigned char __RPC_FAR * )sFilenames = 0;
01931     RpcTryFinally
01932         {
01933         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01934             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01935
01936         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01937
01938         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01939                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01940                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01941                                        (unsigned char)0 );
01942
01943
01944         *_pdwStubPhase = STUB_CALL_SERVER;
01945         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowFileHistory(
01946                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01947                    handle,
01948                    sFilenames);
01949
01950         *_pdwStubPhase = STUB_MARSHAL;
01951
01952         _StubMsg.BufferLength = 4U;
01953         _StubMsg.BufferLength += 16;
01954
01955         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01956         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01957
01958         }
01959     RpcFinally
01960         {
01961         }
01962     RpcEndFinally
01963     _pRpcMessage->BufferLength =
01964         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01965
01966 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileProperties_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilename
 | ) |

Definition at line 1969 of file CVS_Coworker_p.c.

01973 {
01974
01975     HRESULT _RetVal;
01976
01977     RPC_MESSAGE _RpcMessage;
01978
01979     MIDL_STUB_MESSAGE _StubMsg;
01980
01981     RpcTryExcept
01982         {
01983         NdrProxyInitialize(
01984                       ( void __RPC_FAR *  )This,
01985                       ( PRPC_MESSAGE  )&_RpcMessage,
01986                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01987                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01988                       16);
01989
01990
01991
01992         if(!sFilename)
01993             {
01994             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01995             }
01996         RpcTryFinally
01997             {
01998
01999             _StubMsg.BufferLength = 4U + 12U;
02000             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02001                                            (unsigned char __RPC_FAR *)sFilename,
02002                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02003
02004             NdrProxyGetBuffer(This, &_StubMsg);
02005             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02006
02007             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02008                                          (unsigned char __RPC_FAR *)sFilename,
02009                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02010
02011             NdrProxySendReceive(This, &_StubMsg);
02012
02013             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02014                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02015
02016             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02017
02018             }
02019         RpcFinally
02020             {
02021             NdrProxyFreeBuffer(This, &_StubMsg);
02022
02023             }
02024         RpcEndFinally
02025
02026         }
02027     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02028         {
02029         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02030         }
02031     RpcEndExcept
02032     return _RetVal;
02033 }

void __RPC_STUB ICvsCoworker_ShowFileProperties_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2035 of file CVS_Coworker_p.c.

02040 {
02041     HRESULT _RetVal;
02042     MIDL_STUB_MESSAGE _StubMsg;
02043     int handle;
02044     const unsigned char __RPC_FAR *sFilename;
02045
02046 NdrStubInitialize(
02047                      _pRpcMessage,
02048                      &_StubMsg,
02049                      &Object_StubDesc,
02050                      _pRpcChannelBuffer);
02051     ( unsigned char __RPC_FAR * )sFilename = 0;
02052     RpcTryFinally
02053         {
02054         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02055             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02056
02057         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02058
02059         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02060                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilename,
02061                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
02062                                        (unsigned char)0 );
02063
02064
02065         *_pdwStubPhase = STUB_CALL_SERVER;
02066         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowFileProperties(
02067                       (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02068                       handle,
02069                       sFilename);
02070
02071         *_pdwStubPhase = STUB_MARSHAL;
02072
02073         _StubMsg.BufferLength = 4U;
02074         _StubMsg.BufferLength += 16;
02075
02076         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02077         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02078
02079         }
02080     RpcFinally
02081         {
02082         }
02083     RpcEndFinally
02084     _pRpcMessage->BufferLength =
02085         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02086
02087 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowUserInterface_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 2090 of file CVS_Coworker_p.c.

02094 {
02095
02096     HRESULT _RetVal;
02097
02098     RPC_MESSAGE _RpcMessage;
02099
02100     MIDL_STUB_MESSAGE _StubMsg;
02101
02102     RpcTryExcept
02103         {
02104         NdrProxyInitialize(
02105                       ( void __RPC_FAR *  )This,
02106                       ( PRPC_MESSAGE  )&_RpcMessage,
02107                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02108                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02109                       17);
02110
02111
02112
02113         if(!sFilenames)
02114             {
02115             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02116             }
02117         RpcTryFinally
02118             {
02119
02120             _StubMsg.BufferLength = 4U + 12U;
02121             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02122                                            (unsigned char __RPC_FAR *)sFilenames,
02123                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02124
02125             NdrProxyGetBuffer(This, &_StubMsg);
02126             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02127
02128             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02129                                          (unsigned char __RPC_FAR *)sFilenames,
02130                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02131
02132             NdrProxySendReceive(This, &_StubMsg);
02133
02134             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02135                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02136
02137             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02138
02139             }
02140         RpcFinally
02141             {
02142             NdrProxyFreeBuffer(This, &_StubMsg);
02143
02144             }
02145         RpcEndFinally
02146
02147         }
02148     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02149         {
02150         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02151         }
02152     RpcEndExcept
02153     return _RetVal;
02154 }

void __RPC_STUB ICvsCoworker_ShowUserInterface_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2156 of file CVS_Coworker_p.c.

02161 {
02162     HRESULT _RetVal;
02163     MIDL_STUB_MESSAGE _StubMsg;
02164     int handle;
02165     const unsigned char __RPC_FAR *sFilenames;
02166
02167 NdrStubInitialize(
02168                      _pRpcMessage,
02169                      &_StubMsg,
02170                      &Object_StubDesc,
02171                      _pRpcChannelBuffer);
02172     ( unsigned char __RPC_FAR * )sFilenames = 0;
02173     RpcTryFinally
02174         {
02175         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02176             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02177
02178         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02179
02180         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02181                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
02182                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
02183                                        (unsigned char)0 );
02184
02185
02186         *_pdwStubPhase = STUB_CALL_SERVER;
02187         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowUserInterface(
02188                      (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02189                      handle,
02190                      sFilenames);
02191
02192         *_pdwStubPhase = STUB_MARSHAL;
02193
02194         _StubMsg.BufferLength = 4U;
02195         _StubMsg.BufferLength += 16;
02196
02197         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02198         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02199
02200         }
02201     RpcFinally
02202         {
02203         }
02204     RpcEndFinally
02205     _pRpcMessage->BufferLength =
02206         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02207
02208 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_UncheckoutFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 1185 of file CVS_Coworker_p.c.

01189 {
01190
01191     HRESULT _RetVal;
01192
01193     RPC_MESSAGE _RpcMessage;
01194
01195     MIDL_STUB_MESSAGE _StubMsg;
01196
01197     RpcTryExcept
01198         {
01199         NdrProxyInitialize(
01200                       ( void __RPC_FAR *  )This,
01201                       ( PRPC_MESSAGE  )&_RpcMessage,
01202                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01203                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01204                       10);
01205
01206
01207
01208         if(!sFilenames)
01209             {
01210             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01211             }
01212         RpcTryFinally
01213             {
01214
01215             _StubMsg.BufferLength = 4U + 12U;
01216             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01217                                            (unsigned char __RPC_FAR *)sFilenames,
01218                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01219
01220             NdrProxyGetBuffer(This, &_StubMsg);
01221             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01222
01223             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01224                                          (unsigned char __RPC_FAR *)sFilenames,
01225                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01226
01227             NdrProxySendReceive(This, &_StubMsg);
01228
01229             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01230                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01231
01232             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01233
01234             }
01235         RpcFinally
01236             {
01237             NdrProxyFreeBuffer(This, &_StubMsg);
01238
01239             }
01240         RpcEndFinally
01241
01242         }
01243     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01244         {
01245         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01246         }
01247     RpcEndExcept
01248     return _RetVal;
01249 }

void __RPC_STUB ICvsCoworker_UncheckoutFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1251 of file CVS_Coworker_p.c.

01256 {
01257     HRESULT _RetVal;
01258     MIDL_STUB_MESSAGE _StubMsg;
01259     int handle;
01260     const unsigned char __RPC_FAR *sFilenames;
01261
01262 NdrStubInitialize(
01263                      _pRpcMessage,
01264                      &_StubMsg,
01265                      &Object_StubDesc,
01266                      _pRpcChannelBuffer);
01267     ( unsigned char __RPC_FAR * )sFilenames = 0;
01268     RpcTryFinally
01269         {
01270         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01271             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01272
01273         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01274
01275         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01276                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01277                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01278                                        (unsigned char)0 );
01279
01280
01281         *_pdwStubPhase = STUB_CALL_SERVER;
01282         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> UncheckoutFiles(
01283                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01284                    handle,
01285                    sFilenames);
01286
01287         *_pdwStubPhase = STUB_MARSHAL;
01288
01289         _StubMsg.BufferLength = 4U;
01290         _StubMsg.BufferLength += 16;
01291
01292         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01293         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01294
01295         }
01296     RpcFinally
01297         {
01298         }
01299     RpcEndFinally
01300     _pRpcMessage->BufferLength =
01301         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01302
01303 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_UpdateFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames,
 |  | BOOL | bDirectories,
 |  | BOOL | bRecurse
 | ) |

Definition at line 797 of file CVS_Coworker_p.c.

00803 {
00804
00805     HRESULT _RetVal;
00806
00807     RPC_MESSAGE _RpcMessage;
00808
00809     MIDL_STUB_MESSAGE _StubMsg;
00810
00811     RpcTryExcept
00812         {
00813         NdrProxyInitialize(
00814                       ( void __RPC_FAR *  )This,
00815                       ( PRPC_MESSAGE  )&_RpcMessage,
00816                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00817                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00818                       7);
00819
00820
00821
00822         if(!sFilenames)
00823             {
00824             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00825             }
00826         RpcTryFinally
00827             {
00828
00829             _StubMsg.BufferLength = 4U + 12U + 11U + 7U;
00830             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00831                                            (unsigned char __RPC_FAR *)sFilenames,
00832                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00833
00834             NdrProxyGetBuffer(This, &_StubMsg);
00835             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00836
00837             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00838                                          (unsigned char __RPC_FAR *)sFilenames,
00839                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00840
00841             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00842             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bDirectories;
00843
00844             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bRecurse;
00845
00846             NdrProxySendReceive(This, &_StubMsg);
00847
00848             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00849                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
00850
00851             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00852
00853             }
00854         RpcFinally
00855             {
00856             NdrProxyFreeBuffer(This, &_StubMsg);
00857
00858             }
00859         RpcEndFinally
00860
00861         }
00862     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00863         {
00864         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00865         }
00866     RpcEndExcept
00867     return _RetVal;
00868 }

void __RPC_STUB ICvsCoworker_UpdateFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 870 of file CVS_Coworker_p.c.

00875 {
00876     HRESULT _RetVal;
00877     MIDL_STUB_MESSAGE _StubMsg;
00878     BOOL bDirectories;
00879     BOOL bRecurse;
00880     int handle;
00881     const unsigned char __RPC_FAR *sFilenames;
00882
00883 NdrStubInitialize(
00884                      _pRpcMessage,
00885                      &_StubMsg,
00886                      &Object_StubDesc,
00887                      _pRpcChannelBuffer);
00888     ( unsigned char __RPC_FAR * )sFilenames = 0;
00889     RpcTryFinally
00890         {
00891         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00892             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
00893
00894         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00895
00896         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00897                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
00898                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00899                                        (unsigned char)0 );
00900
00901         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00902         bDirectories = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00903
00904         bRecurse = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00905
00906
00907         *_pdwStubPhase = STUB_CALL_SERVER;
00908         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> UpdateFiles(
00909                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00910                handle,
00911                sFilenames,
00912                bDirectories,
00913                bRecurse);
00914
00915         *_pdwStubPhase = STUB_MARSHAL;
00916
00917         _StubMsg.BufferLength = 4U;
00918         _StubMsg.BufferLength += 16;
00919
00920         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00921         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00922
00923         }
00924     RpcFinally
00925         {
00926         }
00927     RpcEndFinally
00928     _pRpcMessage->BufferLength =
00929         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00930
00931 }

void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t )

void __RPC_USER MIDL_user_free ( void __RPC_FAR * )

virtual HRESULT STDMETHODCALLTYPE OpenProject | ( | int __RPC_FAR * | pHandle,
 |  | const unsigned char __RPC_FAR * | sUsername,
 |  | const unsigned char __RPC_FAR * | sProjectName,
 |  | const unsigned char __RPC_FAR * | sProjectHome
 | ) | [pure virtual]

Referenced by ICvsCoworker_OpenProject_Stub().

virtual HRESULT STDMETHODCALLTYPE RemoveFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) | [pure virtual]

Referenced by ICvsCoworker_RemoveFiles_Stub().

virtual HRESULT STDMETHODCALLTYPE RenameFile | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sOldFilename,
 |  | const unsigned char __RPC_FAR * | sNewFilename
 | ) | [pure virtual]

Referenced by ICvsCoworker_RenameFile_Stub().

virtual HRESULT STDMETHODCALLTYPE ShowAdvancedOptionsForCommand | ( | int | handle,
 |  | CvsCommand | command
 | ) | [pure virtual]

Referenced by ICvsCoworker_ShowAdvancedOptionsForCommand_Stub().

virtual HRESULT STDMETHODCALLTYPE ShowFileHistory | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) | [pure virtual]

Referenced by ICvsCoworker_ShowFileHistory_Stub().

virtual HRESULT STDMETHODCALLTYPE ShowFileProperties | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilename
 | ) | [pure virtual]

Referenced by ICvsCoworker_ShowFileProperties_Stub().

virtual HRESULT STDMETHODCALLTYPE ShowUserInterface | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) | [pure virtual]

Referenced by ICvsCoworker_ShowUserInterface_Stub().

virtual HRESULT STDMETHODCALLTYPE UncheckoutFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) | [pure virtual]

Referenced by ICvsCoworker_UncheckoutFiles_Stub().

virtual HRESULT STDMETHODCALLTYPE UpdateFiles | ( | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames,
 |  | BOOL | bDirectories,
 |  | BOOL | bRecurse
 | ) | [pure virtual]

Referenced by ICvsCoworker_UpdateFiles_Stub().

Variable Documentation

EXTERN_C const CLSID CLSID_CvsCoworker

Definition at line 733 of file CVS_Coworker_i.h.

EXTERN_C const IID IID_ICvsCoworker

Definition at line 102 of file CVS_Coworker_i.h.

EXTERN_C const IID LIBID_CVS_COWORKERLib

Definition at line 731 of file CVS_Coworker_i.h.

RPC_IF_HANDLE __MIDL_itf_CVS_Coworker_0000_v0_0_c_ifspec

Definition at line 92 of file CVS_Coworker_i.h.

RPC_IF_HANDLE __MIDL_itf_CVS_Coworker_0000_v0_0_s_ifspec

Definition at line 93 of file CVS_Coworker_i.h.

ICvsCoworker __pad14__

Definition at line 111 of file CVS_Coworker_i.h.

ICvsCoworker int __RPC_FAR* piError = 0

Definition at line 112 of file CVS_Coworker_i.h.

Generated on Sun Oct 21 12:45:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CVS_Coworker_p.c File Reference

WinCvs/CoWorker/CVS_Coworker_p.c File Reference

#include "rpcproxy.h"
#include "cvs_coworker.h"

Include dependency graph for CVS_Coworker_p.c:

Include dependency graph

Go to the source code of this file.

Compounds

struct | _MIDL_PROC_FORMAT_STRING
struct | _MIDL_TYPE_FORMAT_STRING

Defines

#define | __REQUIRED_RPCPROXY_H_VERSION__ 440
#define | TYPE_FORMAT_STRING_SIZE 65
#define | PROC_FORMAT_STRING_SIZE 151
#define | _cvs_coworker_CHECK_IID(n) IID_GENERIC_CHECK_IID( _cvs_coworker, pIID, n)

Typedefs

typedef _MIDL_TYPE_FORMAT_STRING | MIDL_TYPE_FORMAT_STRING
typedef _MIDL_PROC_FORMAT_STRING | MIDL_PROC_FORMAT_STRING

Functions

HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetLastError_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int __RPC_FAR *piError)
void __RPC_STUB | ICvsCoworker_GetLastError_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetErrorMessage_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int iError, int cbErrorBuffer, unsigned char __RPC_FAR *sErrorBuffer)
void __RPC_STUB | ICvsCoworker_GetErrorMessage_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_OpenProject_Proxy (ICvsCoworker __RPC_FAR *This, int __RPC_FAR *pHandle, const unsigned char __RPC_FAR *sUsername, const unsigned char __RPC_FAR *sProjectName, const unsigned char __RPC_FAR *sProjectHome)
void __RPC_STUB | ICvsCoworker_OpenProject_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetProject_Proxy (ICvsCoworker __RPC_FAR *This, int __RPC_FAR *pHandle, const unsigned char __RPC_FAR *sUsername, int cbProjectNameBuffer, unsigned char __RPC_FAR *sProjectName, int cbProjectHomeBuffer, unsigned char __RPC_FAR *sProjectHome, BOOL bAllowPathChange, BOOL bAllowNewProject, BOOL __RPC_FAR *pbNewProject)
void __RPC_STUB | ICvsCoworker_GetProject_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_UpdateFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames, BOOL bDirectories, BOOL bRecurse)
void __RPC_STUB | ICvsCoworker_UpdateFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_CheckoutFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_CheckoutFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_CheckinFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames, BOOL bKeepCheckedOut)
void __RPC_STUB | ICvsCoworker_CheckinFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_UncheckoutFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_UncheckoutFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_AddFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sOptionsAndFilenames, const unsigned char __RPC_FAR *sComment)
void __RPC_STUB | ICvsCoworker_AddFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_RemoveFiles_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_RemoveFiles_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_RenameFile_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sOldFilename, const unsigned char __RPC_FAR *sNewFilename)
void __RPC_STUB | ICvsCoworker_RenameFile_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_DiffFile_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilename, BOOL bIgnoreCase, BOOL bIgnoreBlanks)
void __RPC_STUB | ICvsCoworker_DiffFile_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowFileHistory_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_ShowFileHistory_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowFileProperties_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilename)
void __RPC_STUB | ICvsCoworker_ShowFileProperties_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowUserInterface_Proxy (ICvsCoworker __RPC_FAR *This, int handle, const unsigned char __RPC_FAR *sFilenames)
void __RPC_STUB | ICvsCoworker_ShowUserInterface_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_HasAdvancedOptionsForCommand_Proxy (ICvsCoworker __RPC_FAR *This, int handle, CvsCommand command, BOOL __RPC_FAR *pbAdvancedOptions)
void __RPC_STUB | ICvsCoworker_HasAdvancedOptionsForCommand_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy (ICvsCoworker __RPC_FAR *This, int handle, CvsCommand command)
void __RPC_STUB | ICvsCoworker_ShowAdvancedOptionsForCommand_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetFileChanges_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int cbFilenameBuffer, unsigned char __RPC_FAR *sFilenameBuffer)
void __RPC_STUB | ICvsCoworker_GetFileChanges_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_GetFilesToAdd_Proxy (ICvsCoworker __RPC_FAR *This, int handle, int cbFilenamesBuffer, unsigned char __RPC_FAR *sFilenamesBuffer)
void __RPC_STUB | ICvsCoworker_GetFilesToAdd_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ICvsCoworker_CloseProject_Proxy (ICvsCoworker __RPC_FAR *This, int handle)
void __RPC_STUB | ICvsCoworker_CloseProject_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
const | CINTERFACE_PROXY_VTABLE (23) _ICvsCoworkerProxyVtbl=
int __stdcall | _cvs_coworker_IID_Lookup (const IID *pIID, int *pIndex)

Variables

const MIDL_TYPE_FORMAT_STRING | __MIDL_TypeFormatString
const MIDL_PROC_FORMAT_STRING | __MIDL_ProcFormatString
const MIDL_STUB_DESC | Object_StubDesc
const PRPC_STUB_FUNCTION | ICvsCoworker_table []
const CInterfaceStubVtbl | _ICvsCoworkerStubVtbl
const CInterfaceProxyVtbl * | _cvs_coworker_ProxyVtblList []
const CInterfaceStubVtbl * | _cvs_coworker_StubVtblList []
PCInterfaceName const | _cvs_coworker_InterfaceNamesList []
const ExtendedProxyFileInfo | cvs_coworker_ProxyFileInfo

Define Documentation

#define PROC_FORMAT_STRING_SIZE 151

Definition at line 29 of file CVS_Coworker_p.c.

#define TYPE_FORMAT_STRING_SIZE 65

Definition at line 28 of file CVS_Coworker_p.c.

#define __REQUIRED_RPCPROXY_H_VERSION__ 440

Definition at line 16 of file CVS_Coworker_p.c.

#define _cvs_coworker_CHECK_IID ( n ) IID_GENERIC_CHECK_IID( _cvs_coworker, pIID, n)

Definition at line 3279 of file CVS_Coworker_p.c.

Referenced by _cvs_coworker_IID_Lookup().

Typedef Documentation

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING

typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING

Function Documentation

const CINTERFACE_PROXY_VTABLE ( 23 )

Definition at line 2869 of file CVS_Coworker_p.c.

02870 {
02871     &IID_ICvsCoworker,
02872     IUnknown_QueryInterface_Proxy,
02873     IUnknown_AddRef_Proxy,
02874     IUnknown_Release_Proxy ,
02875     ICvsCoworker_GetLastError_Proxy ,
02876     ICvsCoworker_GetErrorMessage_Proxy ,
02877     ICvsCoworker_OpenProject_Proxy ,
02878     ICvsCoworker_GetProject_Proxy ,
02879     ICvsCoworker_UpdateFiles_Proxy ,
02880     ICvsCoworker_CheckoutFiles_Proxy ,
02881     ICvsCoworker_CheckinFiles_Proxy ,
02882     ICvsCoworker_UncheckoutFiles_Proxy ,
02883     ICvsCoworker_AddFiles_Proxy ,
02884     ICvsCoworker_RemoveFiles_Proxy ,
02885     ICvsCoworker_RenameFile_Proxy ,
02886     ICvsCoworker_DiffFile_Proxy ,
02887     ICvsCoworker_ShowFileHistory_Proxy ,
02888     ICvsCoworker_ShowFileProperties_Proxy ,
02889     ICvsCoworker_ShowUserInterface_Proxy ,
02890     ICvsCoworker_HasAdvancedOptionsForCommand_Proxy ,
02891     ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy ,
02892     ICvsCoworker_GetFileChanges_Proxy ,
02893     ICvsCoworker_GetFilesToAdd_Proxy ,
02894     ICvsCoworker_CloseProject_Proxy
02895 };

HRESULT STDMETHODCALLTYPE ICvsCoworker_AddFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sOptionsAndFilenames,
 |  | const unsigned char __RPC_FAR * | sComment
 | ) |

Definition at line 1306 of file CVS_Coworker_p.c.

01311 {
01312
01313     HRESULT _RetVal;
01314
01315     RPC_MESSAGE _RpcMessage;
01316
01317     MIDL_STUB_MESSAGE _StubMsg;
01318
01319     RpcTryExcept
01320         {
01321         NdrProxyInitialize(
01322                       ( void __RPC_FAR *  )This,
01323                       ( PRPC_MESSAGE  )&_RpcMessage,
01324                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01325                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01326                       11);
01327
01328
01329
01330         if(!sOptionsAndFilenames)
01331             {
01332             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01333             }
01334         if(!sComment)
01335             {
01336             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01337             }
01338         RpcTryFinally
01339             {
01340
01341             _StubMsg.BufferLength = 4U + 12U + 13U;
01342             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01343                                            (unsigned char __RPC_FAR *)sOptionsAndFilenames,
01344                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01345
01346             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01347                                            (unsigned char __RPC_FAR *)sComment,
01348                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01349
01350             NdrProxyGetBuffer(This, &_StubMsg);
01351             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01352
01353             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01354                                          (unsigned char __RPC_FAR *)sOptionsAndFilenames,
01355                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01356
01357             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01358                                          (unsigned char __RPC_FAR *)sComment,
01359                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01360
01361             NdrProxySendReceive(This, &_StubMsg);
01362
01363             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01364                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01365
01366             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01367
01368             }
01369         RpcFinally
01370             {
01371             NdrProxyFreeBuffer(This, &_StubMsg);
01372
01373             }
01374         RpcEndFinally
01375
01376         }
01377     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01378         {
01379         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01380         }
01381     RpcEndExcept
01382     return _RetVal;
01383 }

void __RPC_STUB ICvsCoworker_AddFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1385 of file CVS_Coworker_p.c.

01390 {
01391     HRESULT _RetVal;
01392     MIDL_STUB_MESSAGE _StubMsg;
01393     int handle;
01394     const unsigned char __RPC_FAR *sComment;
01395     const unsigned char __RPC_FAR *sOptionsAndFilenames;
01396
01397 NdrStubInitialize(
01398                      _pRpcMessage,
01399                      &_StubMsg,
01400                      &Object_StubDesc,
01401                      _pRpcChannelBuffer);
01402     ( unsigned char __RPC_FAR * )sOptionsAndFilenames = 0;
01403     ( unsigned char __RPC_FAR * )sComment = 0;
01404     RpcTryFinally
01405         {
01406         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01407             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01408
01409         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01410
01411         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01412                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sOptionsAndFilenames,
01413                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01414                                        (unsigned char)0 );
01415
01416         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01417                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sComment,
01418                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01419                                        (unsigned char)0 );
01420
01421
01422         *_pdwStubPhase = STUB_CALL_SERVER;
01423         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> AddFiles(
01424             (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01425             handle,
01426             sOptionsAndFilenames,
01427             sComment);
01428
01429         *_pdwStubPhase = STUB_MARSHAL;
01430
01431         _StubMsg.BufferLength = 4U;
01432         _StubMsg.BufferLength += 16;
01433
01434         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01435         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01436
01437         }
01438     RpcFinally
01439         {
01440         }
01441     RpcEndFinally
01442     _pRpcMessage->BufferLength =
01443         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01444
01445 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckinFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames,
 |  | BOOL | bKeepCheckedOut
 | ) |

Definition at line 1055 of file CVS_Coworker_p.c.

01060 {
01061
01062     HRESULT _RetVal;
01063
01064     RPC_MESSAGE _RpcMessage;
01065
01066     MIDL_STUB_MESSAGE _StubMsg;
01067
01068     RpcTryExcept
01069         {
01070         NdrProxyInitialize(
01071                       ( void __RPC_FAR *  )This,
01072                       ( PRPC_MESSAGE  )&_RpcMessage,
01073                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01074                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01075                       9);
01076
01077
01078
01079         if(!sFilenames)
01080             {
01081             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01082             }
01083         RpcTryFinally
01084             {
01085
01086             _StubMsg.BufferLength = 4U + 12U + 11U;
01087             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01088                                            (unsigned char __RPC_FAR *)sFilenames,
01089                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01090
01091             NdrProxyGetBuffer(This, &_StubMsg);
01092             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01093
01094             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01095                                          (unsigned char __RPC_FAR *)sFilenames,
01096                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01097
01098             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01099             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bKeepCheckedOut;
01100
01101             NdrProxySendReceive(This, &_StubMsg);
01102
01103             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01104                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[88] );
01105
01106             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01107
01108             }
01109         RpcFinally
01110             {
01111             NdrProxyFreeBuffer(This, &_StubMsg);
01112
01113             }
01114         RpcEndFinally
01115
01116         }
01117     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01118         {
01119         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01120         }
01121     RpcEndExcept
01122     return _RetVal;
01123 }

void __RPC_STUB ICvsCoworker_CheckinFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1125 of file CVS_Coworker_p.c.

01130 {
01131     HRESULT _RetVal;
01132     MIDL_STUB_MESSAGE _StubMsg;
01133     BOOL bKeepCheckedOut;
01134     int handle;
01135     const unsigned char __RPC_FAR *sFilenames;
01136
01137 NdrStubInitialize(
01138                      _pRpcMessage,
01139                      &_StubMsg,
01140                      &Object_StubDesc,
01141                      _pRpcChannelBuffer);
01142     ( unsigned char __RPC_FAR * )sFilenames = 0;
01143     RpcTryFinally
01144         {
01145         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01146             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[88] );
01147
01148         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01149
01150         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01151                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01152                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01153                                        (unsigned char)0 );
01154
01155         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01156         bKeepCheckedOut = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01157
01158
01159         *_pdwStubPhase = STUB_CALL_SERVER;
01160         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CheckinFiles(
01161                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01162                 handle,
01163                 sFilenames,
01164                 bKeepCheckedOut);
01165
01166         *_pdwStubPhase = STUB_MARSHAL;
01167
01168         _StubMsg.BufferLength = 4U;
01169         _StubMsg.BufferLength += 16;
01170
01171         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01172         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01173
01174         }
01175     RpcFinally
01176         {
01177         }
01178     RpcEndFinally
01179     _pRpcMessage->BufferLength =
01180         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01181
01182 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_CheckoutFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 934 of file CVS_Coworker_p.c.

00938 {
00939
00940     HRESULT _RetVal;
00941
00942     RPC_MESSAGE _RpcMessage;
00943
00944     MIDL_STUB_MESSAGE _StubMsg;
00945
00946     RpcTryExcept
00947         {
00948         NdrProxyInitialize(
00949                       ( void __RPC_FAR *  )This,
00950                       ( PRPC_MESSAGE  )&_RpcMessage,
00951                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00952                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00953                       8);
00954
00955
00956
00957         if(!sFilenames)
00958             {
00959             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00960             }
00961         RpcTryFinally
00962             {
00963
00964             _StubMsg.BufferLength = 4U + 12U;
00965             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00966                                            (unsigned char __RPC_FAR *)sFilenames,
00967                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00968
00969             NdrProxyGetBuffer(This, &_StubMsg);
00970             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00971
00972             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00973                                          (unsigned char __RPC_FAR *)sFilenames,
00974                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00975
00976             NdrProxySendReceive(This, &_StubMsg);
00977
00978             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00979                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
00980
00981             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00982
00983             }
00984         RpcFinally
00985             {
00986             NdrProxyFreeBuffer(This, &_StubMsg);
00987
00988             }
00989         RpcEndFinally
00990
00991         }
00992     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00993         {
00994         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00995         }
00996     RpcEndExcept
00997     return _RetVal;
00998 }

void __RPC_STUB ICvsCoworker_CheckoutFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1000 of file CVS_Coworker_p.c.

01005 {
01006     HRESULT _RetVal;
01007     MIDL_STUB_MESSAGE _StubMsg;
01008     int handle;
01009     const unsigned char __RPC_FAR *sFilenames;
01010
01011 NdrStubInitialize(
01012                      _pRpcMessage,
01013                      &_StubMsg,
01014                      &Object_StubDesc,
01015                      _pRpcChannelBuffer);
01016     ( unsigned char __RPC_FAR * )sFilenames = 0;
01017     RpcTryFinally
01018         {
01019         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01020             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01021
01022         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01023
01024         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01025                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01026                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01027                                        (unsigned char)0 );
01028
01029
01030         *_pdwStubPhase = STUB_CALL_SERVER;
01031         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CheckoutFiles(
01032                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01033                  handle,
01034                  sFilenames);
01035
01036         *_pdwStubPhase = STUB_MARSHAL;
01037
01038         _StubMsg.BufferLength = 4U;
01039         _StubMsg.BufferLength += 16;
01040
01041         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01042         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01043
01044         }
01045     RpcFinally
01046         {
01047         }
01048     RpcEndFinally
01049     _pRpcMessage->BufferLength =
01050         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01051
01052 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_CloseProject_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle
 | ) |

Definition at line 2749 of file CVS_Coworker_p.c.

02752 {
02753
02754     HRESULT _RetVal;
02755
02756     RPC_MESSAGE _RpcMessage;
02757
02758     MIDL_STUB_MESSAGE _StubMsg;
02759
02760     RpcTryExcept
02761         {
02762         NdrProxyInitialize(
02763                       ( void __RPC_FAR *  )This,
02764                       ( PRPC_MESSAGE  )&_RpcMessage,
02765                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02766                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02767                       22);
02768
02769
02770
02771         RpcTryFinally
02772             {
02773
02774             _StubMsg.BufferLength = 4U;
02775             NdrProxyGetBuffer(This, &_StubMsg);
02776             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02777
02778             NdrProxySendReceive(This, &_StubMsg);
02779
02780             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02781                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[146] );
02782
02783             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02784
02785             }
02786         RpcFinally
02787             {
02788             NdrProxyFreeBuffer(This, &_StubMsg);
02789
02790             }
02791         RpcEndFinally
02792
02793         }
02794     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02795         {
02796         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02797         }
02798     RpcEndExcept
02799     return _RetVal;
02800 }

void __RPC_STUB ICvsCoworker_CloseProject_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2802 of file CVS_Coworker_p.c.

02807 {
02808     HRESULT _RetVal;
02809     MIDL_STUB_MESSAGE _StubMsg;
02810     int handle;
02811
02812 NdrStubInitialize(
02813                      _pRpcMessage,
02814                      &_StubMsg,
02815                      &Object_StubDesc,
02816                      _pRpcChannelBuffer);
02817     RpcTryFinally
02818         {
02819         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02820             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[146] );
02821
02822         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02823
02824
02825         *_pdwStubPhase = STUB_CALL_SERVER;
02826         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> CloseProject((ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,handle);
02827
02828         *_pdwStubPhase = STUB_MARSHAL;
02829
02830         _StubMsg.BufferLength = 4U;
02831         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02832         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02833
02834         }
02835     RpcFinally
02836         {
02837         }
02838     RpcEndFinally
02839     _pRpcMessage->BufferLength =
02840         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02841
02842 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_DiffFile_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilename,
 |  | BOOL | bIgnoreCase,
 |  | BOOL | bIgnoreBlanks
 | ) |

Definition at line 1711 of file CVS_Coworker_p.c.

01717 {
01718
01719     HRESULT _RetVal;
01720
01721     RPC_MESSAGE _RpcMessage;
01722
01723     MIDL_STUB_MESSAGE _StubMsg;
01724
01725     RpcTryExcept
01726         {
01727         NdrProxyInitialize(
01728                       ( void __RPC_FAR *  )This,
01729                       ( PRPC_MESSAGE  )&_RpcMessage,
01730                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01731                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01732                       14);
01733
01734
01735
01736         if(!sFilename)
01737             {
01738             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01739             }
01740         RpcTryFinally
01741             {
01742
01743             _StubMsg.BufferLength = 4U + 12U + 11U + 7U;
01744             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01745                                            (unsigned char __RPC_FAR *)sFilename,
01746                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01747
01748             NdrProxyGetBuffer(This, &_StubMsg);
01749             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01750
01751             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01752                                          (unsigned char __RPC_FAR *)sFilename,
01753                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01754
01755             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01756             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bIgnoreCase;
01757
01758             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bIgnoreBlanks;
01759
01760             NdrProxySendReceive(This, &_StubMsg);
01761
01762             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01763                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
01764
01765             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01766
01767             }
01768         RpcFinally
01769             {
01770             NdrProxyFreeBuffer(This, &_StubMsg);
01771
01772             }
01773         RpcEndFinally
01774
01775         }
01776     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01777         {
01778         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01779         }
01780     RpcEndExcept
01781     return _RetVal;
01782 }

void __RPC_STUB ICvsCoworker_DiffFile_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1784 of file CVS_Coworker_p.c.

01789 {
01790     HRESULT _RetVal;
01791     MIDL_STUB_MESSAGE _StubMsg;
01792     BOOL bIgnoreBlanks;
01793     BOOL bIgnoreCase;
01794     int handle;
01795     const unsigned char __RPC_FAR *sFilename;
01796
01797 NdrStubInitialize(
01798                      _pRpcMessage,
01799                      &_StubMsg,
01800                      &Object_StubDesc,
01801                      _pRpcChannelBuffer);
01802     ( unsigned char __RPC_FAR * )sFilename = 0;
01803     RpcTryFinally
01804         {
01805         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01806             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
01807
01808         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01809
01810         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01811                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilename,
01812                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01813                                        (unsigned char)0 );
01814
01815         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
01816         bIgnoreCase = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01817
01818         bIgnoreBlanks = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
01819
01820
01821         *_pdwStubPhase = STUB_CALL_SERVER;
01822         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> DiffFile(
01823             (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01824             handle,
01825             sFilename,
01826             bIgnoreCase,
01827             bIgnoreBlanks);
01828
01829         *_pdwStubPhase = STUB_MARSHAL;
01830
01831         _StubMsg.BufferLength = 4U;
01832         _StubMsg.BufferLength += 16;
01833
01834         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01835         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01836
01837         }
01838     RpcFinally
01839         {
01840         }
01841     RpcEndFinally
01842     _pRpcMessage->BufferLength =
01843         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01844
01845 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetErrorMessage_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int | iError,
 |  | int | cbErrorBuffer,
 |  | unsigned char __RPC_FAR * | sErrorBuffer
 | ) |

Definition at line 181 of file CVS_Coworker_p.c.

00187 {
00188
00189     HRESULT _RetVal;
00190
00191     RPC_MESSAGE _RpcMessage;
00192
00193     MIDL_STUB_MESSAGE _StubMsg;
00194
00195     RpcTryExcept
00196         {
00197         NdrProxyInitialize(
00198                       ( void __RPC_FAR *  )This,
00199                       ( PRPC_MESSAGE  )&_RpcMessage,
00200                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00201                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00202                       4);
00203
00204
00205
00206         if(!sErrorBuffer)
00207             {
00208             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00209             }
00210         RpcTryFinally
00211             {
00212
00213             _StubMsg.BufferLength = 4U + 4U + 4U;
00214             NdrProxyGetBuffer(This, &_StubMsg);
00215             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00216
00217             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = iError;
00218
00219             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbErrorBuffer;
00220
00221             NdrProxySendReceive(This, &_StubMsg);
00222
00223             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00224                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[8] );
00225
00226             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00227                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sErrorBuffer,
00228                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10],
00229                                            (unsigned char)0 );
00230
00231             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00232             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00233
00234             }
00235         RpcFinally
00236             {
00237             NdrProxyFreeBuffer(This, &_StubMsg);
00238
00239             }
00240         RpcEndFinally
00241
00242         }
00243     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00244         {
00245         _StubMsg.MaxCount = cbErrorBuffer;
00246
00247         NdrClearOutParameters(
00248                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00249                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[6],
00250                          ( void __RPC_FAR * )sErrorBuffer);
00251         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00252         }
00253     RpcEndExcept
00254     return _RetVal;
00255 }

void __RPC_STUB ICvsCoworker_GetErrorMessage_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 257 of file CVS_Coworker_p.c.

00262 {
00263     HRESULT _RetVal;
00264     MIDL_STUB_MESSAGE _StubMsg;
00265     int cbErrorBuffer;
00266     int handle;
00267     int iError;
00268     unsigned char __RPC_FAR *sErrorBuffer;
00269
00270 NdrStubInitialize(
00271                      _pRpcMessage,
00272                      &_StubMsg,
00273                      &Object_StubDesc,
00274                      _pRpcChannelBuffer);
00275     ( unsigned char __RPC_FAR * )sErrorBuffer = 0;
00276     RpcTryFinally
00277         {
00278         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00279             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[8] );
00280
00281         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00282
00283         iError = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00284
00285         cbErrorBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00286
00287         if(cbErrorBuffer * 1 < 0)
00288             {
00289             RpcRaiseException(RPC_X_INVALID_BOUND);
00290             }
00291         sErrorBuffer = NdrAllocate(&_StubMsg,cbErrorBuffer * 1);
00292
00293         *_pdwStubPhase = STUB_CALL_SERVER;
00294         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetErrorMessage(
00295                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00296                    handle,
00297                    iError,
00298                    cbErrorBuffer,
00299                    sErrorBuffer);
00300
00301         *_pdwStubPhase = STUB_MARSHAL;
00302
00303         _StubMsg.BufferLength = 12U + 11U;
00304         _StubMsg.MaxCount = cbErrorBuffer;
00305
00306         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00307                                        (unsigned char __RPC_FAR *)sErrorBuffer,
00308                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10] );
00309
00310         _StubMsg.BufferLength += 16;
00311
00312         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00313         _StubMsg.MaxCount = cbErrorBuffer;
00314
00315         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00316                                      (unsigned char __RPC_FAR *)sErrorBuffer,
00317                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[10] );
00318
00319         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00320         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00321
00322         }
00323     RpcFinally
00324         {
00325         _StubMsg.MaxCount = cbErrorBuffer;
00326
00327         NdrPointerFree( &_StubMsg,
00328                         (unsigned char __RPC_FAR *)sErrorBuffer,
00329                         &__MIDL_TypeFormatString.Format[6] );
00330
00331         }
00332     RpcEndFinally
00333     _pRpcMessage->BufferLength =
00334         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00335
00336 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFileChanges_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int | cbFilenameBuffer,
 |  | unsigned char __RPC_FAR * | sFilenameBuffer
 | ) |

Definition at line 2447 of file CVS_Coworker_p.c.

02452 {
02453
02454     HRESULT _RetVal;
02455
02456     RPC_MESSAGE _RpcMessage;
02457
02458     MIDL_STUB_MESSAGE _StubMsg;
02459
02460     RpcTryExcept
02461         {
02462         NdrProxyInitialize(
02463                       ( void __RPC_FAR *  )This,
02464                       ( PRPC_MESSAGE  )&_RpcMessage,
02465                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02466                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02467                       20);
02468
02469
02470
02471         if(!sFilenameBuffer)
02472             {
02473             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02474             }
02475         RpcTryFinally
02476             {
02477
02478             _StubMsg.BufferLength = 4U + 4U;
02479             NdrProxyGetBuffer(This, &_StubMsg);
02480             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02481
02482             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbFilenameBuffer;
02483
02484             NdrProxySendReceive(This, &_StubMsg);
02485
02486             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02487                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[126] );
02488
02489             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02490                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenameBuffer,
02491                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48],
02492                                            (unsigned char)0 );
02493
02494             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02495             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02496
02497             }
02498         RpcFinally
02499             {
02500             NdrProxyFreeBuffer(This, &_StubMsg);
02501
02502             }
02503         RpcEndFinally
02504
02505         }
02506     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02507         {
02508         _StubMsg.MaxCount = cbFilenameBuffer;
02509
02510         NdrClearOutParameters(
02511                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02512                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[44],
02513                          ( void __RPC_FAR * )sFilenameBuffer);
02514         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02515         }
02516     RpcEndExcept
02517     return _RetVal;
02518 }

void __RPC_STUB ICvsCoworker_GetFileChanges_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2520 of file CVS_Coworker_p.c.

02525 {
02526     HRESULT _RetVal;
02527     MIDL_STUB_MESSAGE _StubMsg;
02528     int cbFilenameBuffer;
02529     int handle;
02530     unsigned char __RPC_FAR *sFilenameBuffer;
02531
02532 NdrStubInitialize(
02533                      _pRpcMessage,
02534                      &_StubMsg,
02535                      &Object_StubDesc,
02536                      _pRpcChannelBuffer);
02537     ( unsigned char __RPC_FAR * )sFilenameBuffer = 0;
02538     RpcTryFinally
02539         {
02540         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02541             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[126] );
02542
02543         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02544
02545         cbFilenameBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02546
02547         if(cbFilenameBuffer * 1 < 0)
02548             {
02549             RpcRaiseException(RPC_X_INVALID_BOUND);
02550             }
02551         sFilenameBuffer = NdrAllocate(&_StubMsg,cbFilenameBuffer * 1);
02552
02553         *_pdwStubPhase = STUB_CALL_SERVER;
02554         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetFileChanges(
02555                   (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02556                   handle,
02557                   cbFilenameBuffer,
02558                   sFilenameBuffer);
02559
02560         *_pdwStubPhase = STUB_MARSHAL;
02561
02562         _StubMsg.BufferLength = 12U + 11U;
02563         _StubMsg.MaxCount = cbFilenameBuffer;
02564
02565         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02566                                        (unsigned char __RPC_FAR *)sFilenameBuffer,
02567                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48] );
02568
02569         _StubMsg.BufferLength += 16;
02570
02571         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02572         _StubMsg.MaxCount = cbFilenameBuffer;
02573
02574         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02575                                      (unsigned char __RPC_FAR *)sFilenameBuffer,
02576                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48] );
02577
02578         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02579         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02580
02581         }
02582     RpcFinally
02583         {
02584         _StubMsg.MaxCount = cbFilenameBuffer;
02585
02586         NdrPointerFree( &_StubMsg,
02587                         (unsigned char __RPC_FAR *)sFilenameBuffer,
02588                         &__MIDL_TypeFormatString.Format[44] );
02589
02590         }
02591     RpcEndFinally
02592     _pRpcMessage->BufferLength =
02593         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02594
02595 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetFilesToAdd_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int | cbFilenamesBuffer,
 |  | unsigned char __RPC_FAR * | sFilenamesBuffer
 | ) |

Definition at line 2598 of file CVS_Coworker_p.c.

02603 {
02604
02605     HRESULT _RetVal;
02606
02607     RPC_MESSAGE _RpcMessage;
02608
02609     MIDL_STUB_MESSAGE _StubMsg;
02610
02611     RpcTryExcept
02612         {
02613         NdrProxyInitialize(
02614                       ( void __RPC_FAR *  )This,
02615                       ( PRPC_MESSAGE  )&_RpcMessage,
02616                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02617                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02618                       21);
02619
02620
02621
02622         if(!sFilenamesBuffer)
02623             {
02624             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02625             }
02626         RpcTryFinally
02627             {
02628
02629             _StubMsg.BufferLength = 4U + 4U;
02630             NdrProxyGetBuffer(This, &_StubMsg);
02631             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02632
02633             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbFilenamesBuffer;
02634
02635             NdrProxySendReceive(This, &_StubMsg);
02636
02637             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02638                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[136] );
02639
02640             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02641                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenamesBuffer,
02642                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58],
02643                                            (unsigned char)0 );
02644
02645             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02646             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02647
02648             }
02649         RpcFinally
02650             {
02651             NdrProxyFreeBuffer(This, &_StubMsg);
02652
02653             }
02654         RpcEndFinally
02655
02656         }
02657     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02658         {
02659         _StubMsg.MaxCount = cbFilenamesBuffer;
02660
02661         NdrClearOutParameters(
02662                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02663                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[54],
02664                          ( void __RPC_FAR * )sFilenamesBuffer);
02665         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02666         }
02667     RpcEndExcept
02668     return _RetVal;
02669 }

void __RPC_STUB ICvsCoworker_GetFilesToAdd_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2671 of file CVS_Coworker_p.c.

02676 {
02677     HRESULT _RetVal;
02678     MIDL_STUB_MESSAGE _StubMsg;
02679     int cbFilenamesBuffer;
02680     int handle;
02681     unsigned char __RPC_FAR *sFilenamesBuffer;
02682
02683 NdrStubInitialize(
02684                      _pRpcMessage,
02685                      &_StubMsg,
02686                      &Object_StubDesc,
02687                      _pRpcChannelBuffer);
02688     ( unsigned char __RPC_FAR * )sFilenamesBuffer = 0;
02689     RpcTryFinally
02690         {
02691         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02692             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[136] );
02693
02694         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02695
02696         cbFilenamesBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02697
02698         if(cbFilenamesBuffer * 1 < 0)
02699             {
02700             RpcRaiseException(RPC_X_INVALID_BOUND);
02701             }
02702         sFilenamesBuffer = NdrAllocate(&_StubMsg,cbFilenamesBuffer * 1);
02703
02704         *_pdwStubPhase = STUB_CALL_SERVER;
02705         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetFilesToAdd(
02706                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02707                  handle,
02708                  cbFilenamesBuffer,
02709                  sFilenamesBuffer);
02710
02711         *_pdwStubPhase = STUB_MARSHAL;
02712
02713         _StubMsg.BufferLength = 12U + 11U;
02714         _StubMsg.MaxCount = cbFilenamesBuffer;
02715
02716         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02717                                        (unsigned char __RPC_FAR *)sFilenamesBuffer,
02718                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58] );
02719
02720         _StubMsg.BufferLength += 16;
02721
02722         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02723         _StubMsg.MaxCount = cbFilenamesBuffer;
02724
02725         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02726                                      (unsigned char __RPC_FAR *)sFilenamesBuffer,
02727                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[58] );
02728
02729         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
02730         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02731
02732         }
02733     RpcFinally
02734         {
02735         _StubMsg.MaxCount = cbFilenamesBuffer;
02736
02737         NdrPointerFree( &_StubMsg,
02738                         (unsigned char __RPC_FAR *)sFilenamesBuffer,
02739                         &__MIDL_TypeFormatString.Format[54] );
02740
02741         }
02742     RpcEndFinally
02743     _pRpcMessage->BufferLength =
02744         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02745
02746 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetLastError_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | int __RPC_FAR * | piError
 | ) |

Definition at line 65 of file CVS_Coworker_p.c.

00069 {
00070
00071     HRESULT _RetVal;
00072
00073     RPC_MESSAGE _RpcMessage;
00074
00075     MIDL_STUB_MESSAGE _StubMsg;
00076
00077     RpcTryExcept
00078         {
00079         NdrProxyInitialize(
00080                       ( void __RPC_FAR *  )This,
00081                       ( PRPC_MESSAGE  )&_RpcMessage,
00082                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00083                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00084                       3);
00085
00086
00087
00088         if(!piError)
00089             {
00090             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00091             }
00092         RpcTryFinally
00093             {
00094
00095             _StubMsg.BufferLength = 4U;
00096             NdrProxyGetBuffer(This, &_StubMsg);
00097             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00098
00099             NdrProxySendReceive(This, &_StubMsg);
00100
00101             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00102                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] );
00103
00104             *piError = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00105
00106             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00107
00108             }
00109         RpcFinally
00110             {
00111             NdrProxyFreeBuffer(This, &_StubMsg);
00112
00113             }
00114         RpcEndFinally
00115
00116         }
00117     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00118         {
00119         NdrClearOutParameters(
00120                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00121                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00122                          ( void __RPC_FAR * )piError);
00123         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00124         }
00125     RpcEndExcept
00126     return _RetVal;
00127 }

void __RPC_STUB ICvsCoworker_GetLastError_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 129 of file CVS_Coworker_p.c.

00134 {
00135     int _M0;
00136     HRESULT _RetVal;
00137     MIDL_STUB_MESSAGE _StubMsg;
00138     int handle;
00139     int __RPC_FAR *piError;
00140
00141 NdrStubInitialize(
00142                      _pRpcMessage,
00143                      &_StubMsg,
00144                      &Object_StubDesc,
00145                      _pRpcChannelBuffer);
00146     ( int __RPC_FAR * )piError = 0;
00147     RpcTryFinally
00148         {
00149         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00150             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] );
00151
00152         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00153
00154         piError = &_M0;
00155
00156         *_pdwStubPhase = STUB_CALL_SERVER;
00157         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetLastError(
00158                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00159                 handle,
00160                 piError);
00161
00162         *_pdwStubPhase = STUB_MARSHAL;
00163
00164         _StubMsg.BufferLength = 4U + 4U;
00165         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00166         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *piError;
00167
00168         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00169
00170         }
00171     RpcFinally
00172         {
00173         }
00174     RpcEndFinally
00175     _pRpcMessage->BufferLength =
00176         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00177
00178 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_GetProject_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int __RPC_FAR * | pHandle,
 |  | const unsigned char __RPC_FAR * | sUsername,
 |  | int | cbProjectNameBuffer,
 |  | unsigned char __RPC_FAR * | sProjectName,
 |  | int | cbProjectHomeBuffer,
 |  | unsigned char __RPC_FAR * | sProjectHome,
 |  | BOOL | bAllowPathChange,
 |  | BOOL | bAllowNewProject,
 |  | BOOL __RPC_FAR * | pbNewProject
 | ) |

Definition at line 511 of file CVS_Coworker_p.c.

00522 {
00523
00524     HRESULT _RetVal;
00525
00526     RPC_MESSAGE _RpcMessage;
00527
00528     MIDL_STUB_MESSAGE _StubMsg;
00529
00530     RpcTryExcept
00531         {
00532         NdrProxyInitialize(
00533                       ( void __RPC_FAR *  )This,
00534                       ( PRPC_MESSAGE  )&_RpcMessage,
00535                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00536                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00537                       6);
00538
00539
00540
00541         if(!pHandle)
00542             {
00543             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00544             }
00545         if(!sUsername)
00546             {
00547             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00548             }
00549         if(!sProjectName)
00550             {
00551             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00552             }
00553         if(!sProjectHome)
00554             {
00555             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00556             }
00557         if(!pbNewProject)
00558             {
00559             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00560             }
00561         RpcTryFinally
00562             {
00563
00564             _StubMsg.BufferLength = 1U + 7U + 12U + 11U + 13U + 11U + 7U;
00565             _StubMsg.MaxCount = cbProjectNameBuffer;
00566
00567             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00568                                            (unsigned char __RPC_FAR *)sProjectName,
00569                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00570
00571             _StubMsg.MaxCount = cbProjectHomeBuffer;
00572
00573             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00574                                            (unsigned char __RPC_FAR *)sProjectHome,
00575                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00576
00577             NdrProxyGetBuffer(This, &_StubMsg);
00578             *(( unsigned char __RPC_FAR * )_StubMsg.Buffer)++ = *sUsername;
00579
00580             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00581             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbProjectNameBuffer;
00582
00583             _StubMsg.MaxCount = cbProjectNameBuffer;
00584
00585             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00586                                          (unsigned char __RPC_FAR *)sProjectName,
00587                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00588
00589             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00590             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = cbProjectHomeBuffer;
00591
00592             _StubMsg.MaxCount = cbProjectHomeBuffer;
00593
00594             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00595                                          (unsigned char __RPC_FAR *)sProjectHome,
00596                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00597
00598             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00599             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bAllowPathChange;
00600
00601             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bAllowNewProject;
00602
00603             NdrProxySendReceive(This, &_StubMsg);
00604
00605             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00606                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[38] );
00607
00608             *pHandle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00609
00610             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00611                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00612                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28],
00613                                            (unsigned char)0 );
00614
00615             NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00616                                            (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00617                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38],
00618                                            (unsigned char)0 );
00619
00620             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00621             *pbNewProject = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00622
00623             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00624
00625             }
00626         RpcFinally
00627             {
00628             NdrProxyFreeBuffer(This, &_StubMsg);
00629
00630             }
00631         RpcEndFinally
00632
00633         }
00634     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00635         {
00636         NdrClearOutParameters(
00637                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00638                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00639                          ( void __RPC_FAR * )pHandle);
00640         _StubMsg.MaxCount = cbProjectNameBuffer;
00641
00642         NdrClearOutParameters(
00643                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00644                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[24],
00645                          ( void __RPC_FAR * )sProjectName);
00646         _StubMsg.MaxCount = cbProjectHomeBuffer;
00647
00648         NdrClearOutParameters(
00649                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00650                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[34],
00651                          ( void __RPC_FAR * )sProjectHome);
00652         NdrClearOutParameters(
00653                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00654                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00655                          ( void __RPC_FAR * )pbNewProject);
00656         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00657         }
00658     RpcEndExcept
00659     return _RetVal;
00660 }

void __RPC_STUB ICvsCoworker_GetProject_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 662 of file CVS_Coworker_p.c.

00667 {
00668     int _M14;
00669     BOOL _M15;
00670     HRESULT _RetVal;
00671     MIDL_STUB_MESSAGE _StubMsg;
00672     BOOL bAllowNewProject;
00673     BOOL bAllowPathChange;
00674     int cbProjectHomeBuffer;
00675     int cbProjectNameBuffer;
00676     int __RPC_FAR *pHandle;
00677     BOOL __RPC_FAR *pbNewProject;
00678     unsigned char __RPC_FAR *sProjectHome;
00679     unsigned char __RPC_FAR *sProjectName;
00680     const unsigned char __RPC_FAR *sUsername;
00681
00682 NdrStubInitialize(
00683                      _pRpcMessage,
00684                      &_StubMsg,
00685                      &Object_StubDesc,
00686                      _pRpcChannelBuffer);
00687     ( int __RPC_FAR * )pHandle = 0;
00688     ( unsigned char __RPC_FAR * )sUsername = 0;
00689     ( unsigned char __RPC_FAR * )sProjectName = 0;
00690     ( unsigned char __RPC_FAR * )sProjectHome = 0;
00691     ( BOOL __RPC_FAR * )pbNewProject = 0;
00692     RpcTryFinally
00693         {
00694         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00695             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[38] );
00696
00697         sUsername = ( unsigned char __RPC_FAR * )_StubMsg.Buffer;
00698         _StubMsg.Buffer += sizeof( unsigned char  );
00699
00700         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00701         cbProjectNameBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00702
00703         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00704                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00705                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28],
00706                                        (unsigned char)0 );
00707
00708         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00709         cbProjectHomeBuffer = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00710
00711         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00712                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00713                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38],
00714                                        (unsigned char)0 );
00715
00716         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00717         bAllowPathChange = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00718
00719         bAllowNewProject = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00720
00721         pHandle = &_M14;
00722         pbNewProject = &_M15;
00723
00724         *_pdwStubPhase = STUB_CALL_SERVER;
00725         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> GetProject(
00726               (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00727               pHandle,
00728               sUsername,
00729               cbProjectNameBuffer,
00730               sProjectName,
00731               cbProjectHomeBuffer,
00732               sProjectHome,
00733               bAllowPathChange,
00734               bAllowNewProject,
00735               pbNewProject);
00736
00737         *_pdwStubPhase = STUB_MARSHAL;
00738
00739         _StubMsg.BufferLength = 4U + 12U + 13U + 11U + 7U;
00740         _StubMsg.MaxCount = cbProjectNameBuffer;
00741
00742         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00743                                        (unsigned char __RPC_FAR *)sProjectName,
00744                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00745
00746         _StubMsg.MaxCount = cbProjectHomeBuffer;
00747
00748         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00749                                        (unsigned char __RPC_FAR *)sProjectHome,
00750                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00751
00752         _StubMsg.BufferLength += 16;
00753
00754         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00755         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *pHandle;
00756
00757         _StubMsg.MaxCount = cbProjectNameBuffer;
00758
00759         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00760                                      (unsigned char __RPC_FAR *)sProjectName,
00761                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[28] );
00762
00763         _StubMsg.MaxCount = cbProjectHomeBuffer;
00764
00765         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00766                                      (unsigned char __RPC_FAR *)sProjectHome,
00767                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[38] );
00768
00769         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00770         *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = *pbNewProject;
00771
00772         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00773
00774         }
00775     RpcFinally
00776         {
00777         _StubMsg.MaxCount = cbProjectNameBuffer;
00778
00779         NdrPointerFree( &_StubMsg,
00780                         (unsigned char __RPC_FAR *)sProjectName,
00781                         &__MIDL_TypeFormatString.Format[24] );
00782
00783         _StubMsg.MaxCount = cbProjectHomeBuffer;
00784
00785         NdrPointerFree( &_StubMsg,
00786                         (unsigned char __RPC_FAR *)sProjectHome,
00787                         &__MIDL_TypeFormatString.Format[34] );
00788
00789         }
00790     RpcEndFinally
00791     _pRpcMessage->BufferLength =
00792         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00793
00794 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_HasAdvancedOptionsForCommand_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | CvsCommand | command,
 |  | BOOL __RPC_FAR * | pbAdvancedOptions
 | ) |

Definition at line 2211 of file CVS_Coworker_p.c.

02216 {
02217
02218     HRESULT _RetVal;
02219
02220     RPC_MESSAGE _RpcMessage;
02221
02222     MIDL_STUB_MESSAGE _StubMsg;
02223
02224     RpcTryExcept
02225         {
02226         NdrProxyInitialize(
02227                       ( void __RPC_FAR *  )This,
02228                       ( PRPC_MESSAGE  )&_RpcMessage,
02229                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02230                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02231                       18);
02232
02233
02234
02235         if(!pbAdvancedOptions)
02236             {
02237             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02238             }
02239         RpcTryFinally
02240             {
02241
02242             _StubMsg.BufferLength = 4U + 2U;
02243             NdrProxyGetBuffer(This, &_StubMsg);
02244             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02245
02246             NdrSimpleTypeMarshall(
02247                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02248                          ( unsigned char __RPC_FAR * )&command,
02249                          13);
02250             NdrProxySendReceive(This, &_StubMsg);
02251
02252             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02253                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[110] );
02254
02255             *pbAdvancedOptions = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
02256
02257             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02258
02259             }
02260         RpcFinally
02261             {
02262             NdrProxyFreeBuffer(This, &_StubMsg);
02263
02264             }
02265         RpcEndFinally
02266
02267         }
02268     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02269         {
02270         NdrClearOutParameters(
02271                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02272                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
02273                          ( void __RPC_FAR * )pbAdvancedOptions);
02274         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02275         }
02276     RpcEndExcept
02277     return _RetVal;
02278 }

void __RPC_STUB ICvsCoworker_HasAdvancedOptionsForCommand_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2280 of file CVS_Coworker_p.c.

02285 {
02286     BOOL _M42;
02287     HRESULT _RetVal;
02288     MIDL_STUB_MESSAGE _StubMsg;
02289     CvsCommand command;
02290     int handle;
02291     BOOL __RPC_FAR *pbAdvancedOptions;
02292
02293 NdrStubInitialize(
02294                      _pRpcMessage,
02295                      &_StubMsg,
02296                      &Object_StubDesc,
02297                      _pRpcChannelBuffer);
02298     ( BOOL __RPC_FAR * )pbAdvancedOptions = 0;
02299     RpcTryFinally
02300         {
02301         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02302             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[110] );
02303
02304         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02305
02306         NdrSimpleTypeUnmarshall(
02307                            ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02308                            ( unsigned char __RPC_FAR * )&command,
02309                            13);
02310         pbAdvancedOptions = &_M42;
02311
02312         *_pdwStubPhase = STUB_CALL_SERVER;
02313         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> HasAdvancedOptionsForCommand(
02314                                 (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02315                                 handle,
02316                                 command,
02317                                 pbAdvancedOptions);
02318
02319         *_pdwStubPhase = STUB_MARSHAL;
02320
02321         _StubMsg.BufferLength = 4U + 4U;
02322         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02323         *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = *pbAdvancedOptions;
02324
02325         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02326
02327         }
02328     RpcFinally
02329         {
02330         }
02331     RpcEndFinally
02332     _pRpcMessage->BufferLength =
02333         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02334
02335 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_OpenProject_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int __RPC_FAR * | pHandle,
 |  | const unsigned char __RPC_FAR * | sUsername,
 |  | const unsigned char __RPC_FAR * | sProjectName,
 |  | const unsigned char __RPC_FAR * | sProjectHome
 | ) |

Definition at line 339 of file CVS_Coworker_p.c.

00345 {
00346
00347     HRESULT _RetVal;
00348
00349     RPC_MESSAGE _RpcMessage;
00350
00351     MIDL_STUB_MESSAGE _StubMsg;
00352
00353     RpcTryExcept
00354         {
00355         NdrProxyInitialize(
00356                       ( void __RPC_FAR *  )This,
00357                       ( PRPC_MESSAGE  )&_RpcMessage,
00358                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00359                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00360                       5);
00361
00362
00363
00364         if(!pHandle)
00365             {
00366             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00367             }
00368         if(!sUsername)
00369             {
00370             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00371             }
00372         if(!sProjectName)
00373             {
00374             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00375             }
00376         if(!sProjectHome)
00377             {
00378             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00379             }
00380         RpcTryFinally
00381             {
00382
00383             _StubMsg.BufferLength = 12U + 13U + 13U;
00384             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00385                                            (unsigned char __RPC_FAR *)sUsername,
00386                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00387
00388             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00389                                            (unsigned char __RPC_FAR *)sProjectName,
00390                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00391
00392             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00393                                            (unsigned char __RPC_FAR *)sProjectHome,
00394                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00395
00396             NdrProxyGetBuffer(This, &_StubMsg);
00397             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00398                                          (unsigned char __RPC_FAR *)sUsername,
00399                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00400
00401             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00402                                          (unsigned char __RPC_FAR *)sProjectName,
00403                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00404
00405             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00406                                          (unsigned char __RPC_FAR *)sProjectHome,
00407                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00408
00409             NdrProxySendReceive(This, &_StubMsg);
00410
00411             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00412                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[20] );
00413
00414             *pHandle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00415
00416             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00417
00418             }
00419         RpcFinally
00420             {
00421             NdrProxyFreeBuffer(This, &_StubMsg);
00422
00423             }
00424         RpcEndFinally
00425
00426         }
00427     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00428         {
00429         NdrClearOutParameters(
00430                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00431                          ( PFORMAT_STRING  )&__MIDL_TypeFormatString.Format[2],
00432                          ( void __RPC_FAR * )pHandle);
00433         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00434         }
00435     RpcEndExcept
00436     return _RetVal;
00437 }

void __RPC_STUB ICvsCoworker_OpenProject_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 439 of file CVS_Coworker_p.c.

00444 {
00445     int _M9;
00446     HRESULT _RetVal;
00447     MIDL_STUB_MESSAGE _StubMsg;
00448     int __RPC_FAR *pHandle;
00449     const unsigned char __RPC_FAR *sProjectHome;
00450     const unsigned char __RPC_FAR *sProjectName;
00451     const unsigned char __RPC_FAR *sUsername;
00452
00453 NdrStubInitialize(
00454                      _pRpcMessage,
00455                      &_StubMsg,
00456                      &Object_StubDesc,
00457                      _pRpcChannelBuffer);
00458     ( int __RPC_FAR * )pHandle = 0;
00459     ( unsigned char __RPC_FAR * )sUsername = 0;
00460     ( unsigned char __RPC_FAR * )sProjectName = 0;
00461     ( unsigned char __RPC_FAR * )sProjectHome = 0;
00462     RpcTryFinally
00463         {
00464         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00465             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[20] );
00466
00467         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00468                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sUsername,
00469                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00470                                        (unsigned char)0 );
00471
00472         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00473                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectName,
00474                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00475                                        (unsigned char)0 );
00476
00477         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00478                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sProjectHome,
00479                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00480                                        (unsigned char)0 );
00481
00482         pHandle = &_M9;
00483
00484         *_pdwStubPhase = STUB_CALL_SERVER;
00485         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> OpenProject(
00486                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00487                pHandle,
00488                sUsername,
00489                sProjectName,
00490                sProjectHome);
00491
00492         *_pdwStubPhase = STUB_MARSHAL;
00493
00494         _StubMsg.BufferLength = 4U + 4U;
00495         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00496         *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *pHandle;
00497
00498         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00499
00500         }
00501     RpcFinally
00502         {
00503         }
00504     RpcEndFinally
00505     _pRpcMessage->BufferLength =
00506         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00507
00508 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_RemoveFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 1448 of file CVS_Coworker_p.c.

01452 {
01453
01454     HRESULT _RetVal;
01455
01456     RPC_MESSAGE _RpcMessage;
01457
01458     MIDL_STUB_MESSAGE _StubMsg;
01459
01460     RpcTryExcept
01461         {
01462         NdrProxyInitialize(
01463                       ( void __RPC_FAR *  )This,
01464                       ( PRPC_MESSAGE  )&_RpcMessage,
01465                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01466                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01467                       12);
01468
01469
01470
01471         if(!sFilenames)
01472             {
01473             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01474             }
01475         RpcTryFinally
01476             {
01477
01478             _StubMsg.BufferLength = 4U + 12U;
01479             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01480                                            (unsigned char __RPC_FAR *)sFilenames,
01481                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01482
01483             NdrProxyGetBuffer(This, &_StubMsg);
01484             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01485
01486             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01487                                          (unsigned char __RPC_FAR *)sFilenames,
01488                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01489
01490             NdrProxySendReceive(This, &_StubMsg);
01491
01492             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01493                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01494
01495             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01496
01497             }
01498         RpcFinally
01499             {
01500             NdrProxyFreeBuffer(This, &_StubMsg);
01501
01502             }
01503         RpcEndFinally
01504
01505         }
01506     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01507         {
01508         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01509         }
01510     RpcEndExcept
01511     return _RetVal;
01512 }

void __RPC_STUB ICvsCoworker_RemoveFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1514 of file CVS_Coworker_p.c.

01519 {
01520     HRESULT _RetVal;
01521     MIDL_STUB_MESSAGE _StubMsg;
01522     int handle;
01523     const unsigned char __RPC_FAR *sFilenames;
01524
01525 NdrStubInitialize(
01526                      _pRpcMessage,
01527                      &_StubMsg,
01528                      &Object_StubDesc,
01529                      _pRpcChannelBuffer);
01530     ( unsigned char __RPC_FAR * )sFilenames = 0;
01531     RpcTryFinally
01532         {
01533         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01534             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01535
01536         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01537
01538         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01539                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01540                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01541                                        (unsigned char)0 );
01542
01543
01544         *_pdwStubPhase = STUB_CALL_SERVER;
01545         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> RemoveFiles(
01546                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01547                handle,
01548                sFilenames);
01549
01550         *_pdwStubPhase = STUB_MARSHAL;
01551
01552         _StubMsg.BufferLength = 4U;
01553         _StubMsg.BufferLength += 16;
01554
01555         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01556         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01557
01558         }
01559     RpcFinally
01560         {
01561         }
01562     RpcEndFinally
01563     _pRpcMessage->BufferLength =
01564         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01565
01566 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_RenameFile_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sOldFilename,
 |  | const unsigned char __RPC_FAR * | sNewFilename
 | ) |

Definition at line 1569 of file CVS_Coworker_p.c.

01574 {
01575
01576     HRESULT _RetVal;
01577
01578     RPC_MESSAGE _RpcMessage;
01579
01580     MIDL_STUB_MESSAGE _StubMsg;
01581
01582     RpcTryExcept
01583         {
01584         NdrProxyInitialize(
01585                       ( void __RPC_FAR *  )This,
01586                       ( PRPC_MESSAGE  )&_RpcMessage,
01587                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01588                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01589                       13);
01590
01591
01592
01593         if(!sOldFilename)
01594             {
01595             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01596             }
01597         if(!sNewFilename)
01598             {
01599             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01600             }
01601         RpcTryFinally
01602             {
01603
01604             _StubMsg.BufferLength = 4U + 12U + 13U;
01605             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01606                                            (unsigned char __RPC_FAR *)sOldFilename,
01607                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01608
01609             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01610                                            (unsigned char __RPC_FAR *)sNewFilename,
01611                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01612
01613             NdrProxyGetBuffer(This, &_StubMsg);
01614             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01615
01616             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01617                                          (unsigned char __RPC_FAR *)sOldFilename,
01618                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01619
01620             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01621                                          (unsigned char __RPC_FAR *)sNewFilename,
01622                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01623
01624             NdrProxySendReceive(This, &_StubMsg);
01625
01626             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01627                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01628
01629             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01630
01631             }
01632         RpcFinally
01633             {
01634             NdrProxyFreeBuffer(This, &_StubMsg);
01635
01636             }
01637         RpcEndFinally
01638
01639         }
01640     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01641         {
01642         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01643         }
01644     RpcEndExcept
01645     return _RetVal;
01646 }

void __RPC_STUB ICvsCoworker_RenameFile_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1648 of file CVS_Coworker_p.c.

01653 {
01654     HRESULT _RetVal;
01655     MIDL_STUB_MESSAGE _StubMsg;
01656     int handle;
01657     const unsigned char __RPC_FAR *sNewFilename;
01658     const unsigned char __RPC_FAR *sOldFilename;
01659
01660 NdrStubInitialize(
01661                      _pRpcMessage,
01662                      &_StubMsg,
01663                      &Object_StubDesc,
01664                      _pRpcChannelBuffer);
01665     ( unsigned char __RPC_FAR * )sOldFilename = 0;
01666     ( unsigned char __RPC_FAR * )sNewFilename = 0;
01667     RpcTryFinally
01668         {
01669         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01670             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[98] );
01671
01672         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01673
01674         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01675                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sOldFilename,
01676                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01677                                        (unsigned char)0 );
01678
01679         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01680                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sNewFilename,
01681                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01682                                        (unsigned char)0 );
01683
01684
01685         *_pdwStubPhase = STUB_CALL_SERVER;
01686         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> RenameFile(
01687               (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01688               handle,
01689               sOldFilename,
01690               sNewFilename);
01691
01692         *_pdwStubPhase = STUB_MARSHAL;
01693
01694         _StubMsg.BufferLength = 4U;
01695         _StubMsg.BufferLength += 16;
01696
01697         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01698         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01699
01700         }
01701     RpcFinally
01702         {
01703         }
01704     RpcEndFinally
01705     _pRpcMessage->BufferLength =
01706         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01707
01708 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | CvsCommand | command
 | ) |

Definition at line 2338 of file CVS_Coworker_p.c.

02342 {
02343
02344     HRESULT _RetVal;
02345
02346     RPC_MESSAGE _RpcMessage;
02347
02348     MIDL_STUB_MESSAGE _StubMsg;
02349
02350     RpcTryExcept
02351         {
02352         NdrProxyInitialize(
02353                       ( void __RPC_FAR *  )This,
02354                       ( PRPC_MESSAGE  )&_RpcMessage,
02355                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02356                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02357                       19);
02358
02359
02360
02361         RpcTryFinally
02362             {
02363
02364             _StubMsg.BufferLength = 4U + 2U;
02365             NdrProxyGetBuffer(This, &_StubMsg);
02366             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02367
02368             NdrSimpleTypeMarshall(
02369                          ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02370                          ( unsigned char __RPC_FAR * )&command,
02371                          13);
02372             NdrProxySendReceive(This, &_StubMsg);
02373
02374             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02375                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[120] );
02376
02377             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02378
02379             }
02380         RpcFinally
02381             {
02382             NdrProxyFreeBuffer(This, &_StubMsg);
02383
02384             }
02385         RpcEndFinally
02386
02387         }
02388     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02389         {
02390         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02391         }
02392     RpcEndExcept
02393     return _RetVal;
02394 }

void __RPC_STUB ICvsCoworker_ShowAdvancedOptionsForCommand_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2396 of file CVS_Coworker_p.c.

02401 {
02402     HRESULT _RetVal;
02403     MIDL_STUB_MESSAGE _StubMsg;
02404     CvsCommand command;
02405     int handle;
02406
02407 NdrStubInitialize(
02408                      _pRpcMessage,
02409                      &_StubMsg,
02410                      &Object_StubDesc,
02411                      _pRpcChannelBuffer);
02412     RpcTryFinally
02413         {
02414         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02415             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[120] );
02416
02417         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02418
02419         NdrSimpleTypeUnmarshall(
02420                            ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02421                            ( unsigned char __RPC_FAR * )&command,
02422                            13);
02423
02424         *_pdwStubPhase = STUB_CALL_SERVER;
02425         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowAdvancedOptionsForCommand(
02426                                  (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02427                                  handle,
02428                                  command);
02429
02430         *_pdwStubPhase = STUB_MARSHAL;
02431
02432         _StubMsg.BufferLength = 4U;
02433         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02434         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02435
02436         }
02437     RpcFinally
02438         {
02439         }
02440     RpcEndFinally
02441     _pRpcMessage->BufferLength =
02442         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02443
02444 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileHistory_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 1848 of file CVS_Coworker_p.c.

01852 {
01853
01854     HRESULT _RetVal;
01855
01856     RPC_MESSAGE _RpcMessage;
01857
01858     MIDL_STUB_MESSAGE _StubMsg;
01859
01860     RpcTryExcept
01861         {
01862         NdrProxyInitialize(
01863                       ( void __RPC_FAR *  )This,
01864                       ( PRPC_MESSAGE  )&_RpcMessage,
01865                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01866                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01867                       15);
01868
01869
01870
01871         if(!sFilenames)
01872             {
01873             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01874             }
01875         RpcTryFinally
01876             {
01877
01878             _StubMsg.BufferLength = 4U + 12U;
01879             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01880                                            (unsigned char __RPC_FAR *)sFilenames,
01881                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01882
01883             NdrProxyGetBuffer(This, &_StubMsg);
01884             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01885
01886             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01887                                          (unsigned char __RPC_FAR *)sFilenames,
01888                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01889
01890             NdrProxySendReceive(This, &_StubMsg);
01891
01892             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01893                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01894
01895             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01896
01897             }
01898         RpcFinally
01899             {
01900             NdrProxyFreeBuffer(This, &_StubMsg);
01901
01902             }
01903         RpcEndFinally
01904
01905         }
01906     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01907         {
01908         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01909         }
01910     RpcEndExcept
01911     return _RetVal;
01912 }

void __RPC_STUB ICvsCoworker_ShowFileHistory_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1914 of file CVS_Coworker_p.c.

01919 {
01920     HRESULT _RetVal;
01921     MIDL_STUB_MESSAGE _StubMsg;
01922     int handle;
01923     const unsigned char __RPC_FAR *sFilenames;
01924
01925 NdrStubInitialize(
01926                      _pRpcMessage,
01927                      &_StubMsg,
01928                      &Object_StubDesc,
01929                      _pRpcChannelBuffer);
01930     ( unsigned char __RPC_FAR * )sFilenames = 0;
01931     RpcTryFinally
01932         {
01933         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01934             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01935
01936         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01937
01938         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01939                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01940                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01941                                        (unsigned char)0 );
01942
01943
01944         *_pdwStubPhase = STUB_CALL_SERVER;
01945         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowFileHistory(
01946                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01947                    handle,
01948                    sFilenames);
01949
01950         *_pdwStubPhase = STUB_MARSHAL;
01951
01952         _StubMsg.BufferLength = 4U;
01953         _StubMsg.BufferLength += 16;
01954
01955         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01956         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01957
01958         }
01959     RpcFinally
01960         {
01961         }
01962     RpcEndFinally
01963     _pRpcMessage->BufferLength =
01964         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01965
01966 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowFileProperties_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilename
 | ) |

Definition at line 1969 of file CVS_Coworker_p.c.

01973 {
01974
01975     HRESULT _RetVal;
01976
01977     RPC_MESSAGE _RpcMessage;
01978
01979     MIDL_STUB_MESSAGE _StubMsg;
01980
01981     RpcTryExcept
01982         {
01983         NdrProxyInitialize(
01984                       ( void __RPC_FAR *  )This,
01985                       ( PRPC_MESSAGE  )&_RpcMessage,
01986                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01987                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01988                       16);
01989
01990
01991
01992         if(!sFilename)
01993             {
01994             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01995             }
01996         RpcTryFinally
01997             {
01998
01999             _StubMsg.BufferLength = 4U + 12U;
02000             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02001                                            (unsigned char __RPC_FAR *)sFilename,
02002                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02003
02004             NdrProxyGetBuffer(This, &_StubMsg);
02005             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02006
02007             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02008                                          (unsigned char __RPC_FAR *)sFilename,
02009                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02010
02011             NdrProxySendReceive(This, &_StubMsg);
02012
02013             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02014                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02015
02016             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02017
02018             }
02019         RpcFinally
02020             {
02021             NdrProxyFreeBuffer(This, &_StubMsg);
02022
02023             }
02024         RpcEndFinally
02025
02026         }
02027     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02028         {
02029         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02030         }
02031     RpcEndExcept
02032     return _RetVal;
02033 }

void __RPC_STUB ICvsCoworker_ShowFileProperties_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2035 of file CVS_Coworker_p.c.

02040 {
02041     HRESULT _RetVal;
02042     MIDL_STUB_MESSAGE _StubMsg;
02043     int handle;
02044     const unsigned char __RPC_FAR *sFilename;
02045
02046 NdrStubInitialize(
02047                      _pRpcMessage,
02048                      &_StubMsg,
02049                      &Object_StubDesc,
02050                      _pRpcChannelBuffer);
02051     ( unsigned char __RPC_FAR * )sFilename = 0;
02052     RpcTryFinally
02053         {
02054         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02055             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02056
02057         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02058
02059         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02060                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilename,
02061                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
02062                                        (unsigned char)0 );
02063
02064
02065         *_pdwStubPhase = STUB_CALL_SERVER;
02066         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowFileProperties(
02067                       (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02068                       handle,
02069                       sFilename);
02070
02071         *_pdwStubPhase = STUB_MARSHAL;
02072
02073         _StubMsg.BufferLength = 4U;
02074         _StubMsg.BufferLength += 16;
02075
02076         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02077         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02078
02079         }
02080     RpcFinally
02081         {
02082         }
02083     RpcEndFinally
02084     _pRpcMessage->BufferLength =
02085         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02086
02087 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_ShowUserInterface_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 2090 of file CVS_Coworker_p.c.

02094 {
02095
02096     HRESULT _RetVal;
02097
02098     RPC_MESSAGE _RpcMessage;
02099
02100     MIDL_STUB_MESSAGE _StubMsg;
02101
02102     RpcTryExcept
02103         {
02104         NdrProxyInitialize(
02105                       ( void __RPC_FAR *  )This,
02106                       ( PRPC_MESSAGE  )&_RpcMessage,
02107                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
02108                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
02109                       17);
02110
02111
02112
02113         if(!sFilenames)
02114             {
02115             RpcRaiseException(RPC_X_NULL_REF_POINTER);
02116             }
02117         RpcTryFinally
02118             {
02119
02120             _StubMsg.BufferLength = 4U + 12U;
02121             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
02122                                            (unsigned char __RPC_FAR *)sFilenames,
02123                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02124
02125             NdrProxyGetBuffer(This, &_StubMsg);
02126             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
02127
02128             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
02129                                          (unsigned char __RPC_FAR *)sFilenames,
02130                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
02131
02132             NdrProxySendReceive(This, &_StubMsg);
02133
02134             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02135                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02136
02137             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
02138
02139             }
02140         RpcFinally
02141             {
02142             NdrProxyFreeBuffer(This, &_StubMsg);
02143
02144             }
02145         RpcEndFinally
02146
02147         }
02148     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
02149         {
02150         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
02151         }
02152     RpcEndExcept
02153     return _RetVal;
02154 }

void __RPC_STUB ICvsCoworker_ShowUserInterface_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 2156 of file CVS_Coworker_p.c.

02161 {
02162     HRESULT _RetVal;
02163     MIDL_STUB_MESSAGE _StubMsg;
02164     int handle;
02165     const unsigned char __RPC_FAR *sFilenames;
02166
02167 NdrStubInitialize(
02168                      _pRpcMessage,
02169                      &_StubMsg,
02170                      &Object_StubDesc,
02171                      _pRpcChannelBuffer);
02172     ( unsigned char __RPC_FAR * )sFilenames = 0;
02173     RpcTryFinally
02174         {
02175         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
02176             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
02177
02178         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
02179
02180         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
02181                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
02182                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
02183                                        (unsigned char)0 );
02184
02185
02186         *_pdwStubPhase = STUB_CALL_SERVER;
02187         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> ShowUserInterface(
02188                      (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
02189                      handle,
02190                      sFilenames);
02191
02192         *_pdwStubPhase = STUB_MARSHAL;
02193
02194         _StubMsg.BufferLength = 4U;
02195         _StubMsg.BufferLength += 16;
02196
02197         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
02198         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
02199
02200         }
02201     RpcFinally
02202         {
02203         }
02204     RpcEndFinally
02205     _pRpcMessage->BufferLength =
02206         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
02207
02208 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_UncheckoutFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames
 | ) |

Definition at line 1185 of file CVS_Coworker_p.c.

01189 {
01190
01191     HRESULT _RetVal;
01192
01193     RPC_MESSAGE _RpcMessage;
01194
01195     MIDL_STUB_MESSAGE _StubMsg;
01196
01197     RpcTryExcept
01198         {
01199         NdrProxyInitialize(
01200                       ( void __RPC_FAR *  )This,
01201                       ( PRPC_MESSAGE  )&_RpcMessage,
01202                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
01203                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
01204                       10);
01205
01206
01207
01208         if(!sFilenames)
01209             {
01210             RpcRaiseException(RPC_X_NULL_REF_POINTER);
01211             }
01212         RpcTryFinally
01213             {
01214
01215             _StubMsg.BufferLength = 4U + 12U;
01216             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
01217                                            (unsigned char __RPC_FAR *)sFilenames,
01218                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01219
01220             NdrProxyGetBuffer(This, &_StubMsg);
01221             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
01222
01223             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
01224                                          (unsigned char __RPC_FAR *)sFilenames,
01225                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
01226
01227             NdrProxySendReceive(This, &_StubMsg);
01228
01229             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01230                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01231
01232             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
01233
01234             }
01235         RpcFinally
01236             {
01237             NdrProxyFreeBuffer(This, &_StubMsg);
01238
01239             }
01240         RpcEndFinally
01241
01242         }
01243     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
01244         {
01245         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
01246         }
01247     RpcEndExcept
01248     return _RetVal;
01249 }

void __RPC_STUB ICvsCoworker_UncheckoutFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 1251 of file CVS_Coworker_p.c.

01256 {
01257     HRESULT _RetVal;
01258     MIDL_STUB_MESSAGE _StubMsg;
01259     int handle;
01260     const unsigned char __RPC_FAR *sFilenames;
01261
01262 NdrStubInitialize(
01263                      _pRpcMessage,
01264                      &_StubMsg,
01265                      &Object_StubDesc,
01266                      _pRpcChannelBuffer);
01267     ( unsigned char __RPC_FAR * )sFilenames = 0;
01268     RpcTryFinally
01269         {
01270         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
01271             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[80] );
01272
01273         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
01274
01275         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
01276                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
01277                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
01278                                        (unsigned char)0 );
01279
01280
01281         *_pdwStubPhase = STUB_CALL_SERVER;
01282         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> UncheckoutFiles(
01283                    (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
01284                    handle,
01285                    sFilenames);
01286
01287         *_pdwStubPhase = STUB_MARSHAL;
01288
01289         _StubMsg.BufferLength = 4U;
01290         _StubMsg.BufferLength += 16;
01291
01292         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
01293         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
01294
01295         }
01296     RpcFinally
01297         {
01298         }
01299     RpcEndFinally
01300     _pRpcMessage->BufferLength =
01301         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
01302
01303 }

HRESULT STDMETHODCALLTYPE ICvsCoworker_UpdateFiles_Proxy | ( | ICvsCoworker __RPC_FAR * | This,
 |  | int | handle,
 |  | const unsigned char __RPC_FAR * | sFilenames,
 |  | BOOL | bDirectories,
 |  | BOOL | bRecurse
 | ) |

Definition at line 797 of file CVS_Coworker_p.c.

00803 {
00804
00805     HRESULT _RetVal;
00806
00807     RPC_MESSAGE _RpcMessage;
00808
00809     MIDL_STUB_MESSAGE _StubMsg;
00810
00811     RpcTryExcept
00812         {
00813         NdrProxyInitialize(
00814                       ( void __RPC_FAR *  )This,
00815                       ( PRPC_MESSAGE  )&_RpcMessage,
00816                       ( PMIDL_STUB_MESSAGE  )&_StubMsg,
00817                       ( PMIDL_STUB_DESC  )&Object_StubDesc,
00818                       7);
00819
00820
00821
00822         if(!sFilenames)
00823             {
00824             RpcRaiseException(RPC_X_NULL_REF_POINTER);
00825             }
00826         RpcTryFinally
00827             {
00828
00829             _StubMsg.BufferLength = 4U + 12U + 11U + 7U;
00830             NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
00831                                            (unsigned char __RPC_FAR *)sFilenames,
00832                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00833
00834             NdrProxyGetBuffer(This, &_StubMsg);
00835             *(( int __RPC_FAR * )_StubMsg.Buffer)++ = handle;
00836
00837             NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
00838                                          (unsigned char __RPC_FAR *)sFilenames,
00839                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18] );
00840
00841             _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00842             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bDirectories;
00843
00844             *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++ = bRecurse;
00845
00846             NdrProxySendReceive(This, &_StubMsg);
00847
00848             if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00849                 NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
00850
00851             _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++;
00852
00853             }
00854         RpcFinally
00855             {
00856             NdrProxyFreeBuffer(This, &_StubMsg);
00857
00858             }
00859         RpcEndFinally
00860
00861         }
00862     RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)
00863         {
00864         _RetVal = NdrProxyErrorHandler(RpcExceptionCode());
00865         }
00866     RpcEndExcept
00867     return _RetVal;
00868 }

void __RPC_STUB ICvsCoworker_UpdateFiles_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |

Definition at line 870 of file CVS_Coworker_p.c.

00875 {
00876     HRESULT _RetVal;
00877     MIDL_STUB_MESSAGE _StubMsg;
00878     BOOL bDirectories;
00879     BOOL bRecurse;
00880     int handle;
00881     const unsigned char __RPC_FAR *sFilenames;
00882
00883 NdrStubInitialize(
00884                      _pRpcMessage,
00885                      &_StubMsg,
00886                      &Object_StubDesc,
00887                      _pRpcChannelBuffer);
00888     ( unsigned char __RPC_FAR * )sFilenames = 0;
00889     RpcTryFinally
00890         {
00891         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
00892             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[68] );
00893
00894         handle = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
00895
00896         NdrConformantStringUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
00897                                        (unsigned char __RPC_FAR * __RPC_FAR *)&sFilenames,
00898                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[18],
00899                                        (unsigned char)0 );
00900
00901         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 3) & ~ 0x3);
00902         bDirectories = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00903
00904         bRecurse = *(( BOOL __RPC_FAR * )_StubMsg.Buffer)++;
00905
00906
00907         *_pdwStubPhase = STUB_CALL_SERVER;
00908         _RetVal = (((ICvsCoworker*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> UpdateFiles(
00909                (ICvsCoworker *) ((CStdStubBuffer *)This)->pvServerObject,
00910                handle,
00911                sFilenames,
00912                bDirectories,
00913                bRecurse);
00914
00915         *_pdwStubPhase = STUB_MARSHAL;
00916
00917         _StubMsg.BufferLength = 4U;
00918         _StubMsg.BufferLength += 16;
00919
00920         NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);
00921         *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
00922
00923         }
00924     RpcFinally
00925         {
00926         }
00927     RpcEndFinally
00928     _pRpcMessage->BufferLength =
00929         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
00930
00931 }

int __stdcall _cvs_coworker_IID_Lookup | ( | const IID * | pIID,
 |  | int * | pIndex
 | ) |

Definition at line 3281 of file CVS_Coworker_p.c.

03282 {
03283
03284     if(!_cvs_coworker_CHECK_IID(0))
03285         {
03286         *pIndex = 0;
03287         return 1;
03288         }
03289
03290     return 0;
03291 }

Variable Documentation

const PRPC_STUB_FUNCTION ICvsCoworker_table[] [static]

Initial value:

{
    ICvsCoworker_GetLastError_Stub,
    ICvsCoworker_GetErrorMessage_Stub,
    ICvsCoworker_OpenProject_Stub,
    ICvsCoworker_GetProject_Stub,
    ICvsCoworker_UpdateFiles_Stub,
    ICvsCoworker_CheckoutFiles_Stub,
    ICvsCoworker_CheckinFiles_Stub,
    ICvsCoworker_UncheckoutFiles_Stub,
    ICvsCoworker_AddFiles_Stub,
    ICvsCoworker_RemoveFiles_Stub,
    ICvsCoworker_RenameFile_Stub,
    ICvsCoworker_DiffFile_Stub,
    ICvsCoworker_ShowFileHistory_Stub,
    ICvsCoworker_ShowFileProperties_Stub,
    ICvsCoworker_ShowUserInterface_Stub,
    ICvsCoworker_HasAdvancedOptionsForCommand_Stub,
    ICvsCoworker_ShowAdvancedOptionsForCommand_Stub,
    ICvsCoworker_GetFileChanges_Stub,
    ICvsCoworker_GetFilesToAdd_Stub,
    ICvsCoworker_CloseProject_Stub
}

Definition at line 2898 of file CVS_Coworker_p.c.

const MIDL_STUB_DESC Object_StubDesc

Initial value:

    {
    0,
    NdrOleAllocate,
    NdrOleFree,
    0,
    0,
    0,
    0,
    0,
    __MIDL_TypeFormatString.Format,
    1,
    0x10001,
    0,
    0x50100a4,
    0,
    0,
    0,
    1,
    0,
    0,
    0
    }

Definition at line 2845 of file CVS_Coworker_p.c.

const CInterfaceStubVtbl _ICvsCoworkerStubVtbl

Initial value:

{
    &IID_ICvsCoworker,
    0,
    23,
    &ICvsCoworker_table[-3],
    CStdStubBuffer_METHODS
}

Definition at line 2922 of file CVS_Coworker_p.c.

const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString

Definition at line 2937 of file CVS_Coworker_p.c.

const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString

Definition at line 3172 of file CVS_Coworker_p.c.

PCInterfaceName const _cvs_coworker_InterfaceNamesList[]

Initial value:

{
    "ICvsCoworker",
    0
}

Definition at line 3272 of file CVS_Coworker_p.c.

const CInterfaceProxyVtbl* _cvs_coworker_ProxyVtblList[]

Initial value:

{
    ( CInterfaceProxyVtbl *) &_ICvsCoworkerProxyVtbl,
    0
}

Definition at line 3260 of file CVS_Coworker_p.c.

const CInterfaceStubVtbl* _cvs_coworker_StubVtblList[]

Initial value:

{
    ( CInterfaceStubVtbl *) &_ICvsCoworkerStubVtbl,
    0
}

Definition at line 3266 of file CVS_Coworker_p.c.

const ExtendedProxyFileInfo cvs_coworker_ProxyFileInfo

Initial value:

{
    (PCInterfaceProxyVtblList *) & _cvs_coworker_ProxyVtblList,
    (PCInterfaceStubVtblList *) & _cvs_coworker_StubVtblList,
    (const PCInterfaceName * ) & _cvs_coworker_InterfaceNamesList,
    0,
    & _cvs_coworker_IID_Lookup,
    1,
    1,
    0,
    0,
    0,
    0
}

Definition at line 3293 of file CVS_Coworker_p.c.

Generated on Sun Oct 21 12:45:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsCoworker.cpp File Reference

WinCvs/CoWorker/CvsCoworker.cpp File Reference

#include "stdafx.h"
#include "CVS_Coworker_i.h"
#include "CvsTrace.h"
#include "CvsCoworkerErrors.h"
#include "CvsCoworker.h"
#include "CvsProject.h"
#include "CvsFilenames.h"

Include dependency graph for CvsCoworker.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | CATCH_EXCEPTIONS(FN)
#define | PREAMBLE(H)

Functions

void | CopyString (char *s1, const char *s2, int n)
void | CopyString (unsigned char *s1, const char *s2, int n)

Define Documentation

#define CATCH_EXCEPTIONS ( FN )

Value:

catch (const char* e) { qTRACE(("*EXCEPTION from " #FN "() : %s",e)); } \
catch (...) { qTRACE(("*EXCEPTION from " #FN "()")); } return S_FALSE;

Definition at line 25 of file CvsCoworker.cpp.

Referenced by CvsCoworker::AddFiles(), CvsCoworker::CheckinFiles(), CvsCoworker::CheckoutFiles(), CvsCoworker::CloseProject(), CvsCoworker::DiffFile(), CvsCoworker::GetFileChanges(), CvsCoworker::GetFilesToAdd(), CvsCoworker::GetProject(), CvsCoworker::HasAdvancedOptionsForCommand(), CvsCoworker::OpenProject(), CvsCoworker::RemoveFiles(), CvsCoworker::RenameFile(), CvsCoworker::ShowAdvancedOptionsForCommand(), CvsCoworker::ShowFileHistory(), CvsCoworker::ShowFileProperties(), CvsCoworker::ShowUserInterface(), CvsCoworker::UncheckoutFiles(), and CvsCoworker::UpdateFiles().

#define PREAMBLE ( H )

Value:

CvsProject* pProject = CvsProject::FindProject(handle); \
ASSERT(pProject); \
if (!pProject) { return CVS_E_FAILED_PROJECT_INVALID; }

Definition at line 193 of file CvsCoworker.cpp.

Referenced by CvsCoworker::AddFiles(), CvsCoworker::CheckinFiles(), CvsCoworker::CheckoutFiles(), CvsCoworker::CloseProject(), CvsCoworker::DiffFile(), CvsCoworker::GetFileChanges(), CvsCoworker::GetFilesToAdd(), CvsCoworker::HasAdvancedOptionsForCommand(), CvsCoworker::RemoveFiles(), CvsCoworker::RenameFile(), CvsCoworker::ShowAdvancedOptionsForCommand(), CvsCoworker::ShowFileHistory(), CvsCoworker::ShowFileProperties(), CvsCoworker::ShowUserInterface(), CvsCoworker::UncheckoutFiles(), and CvsCoworker::UpdateFiles().

Function Documentation

void CopyString | ( | unsigned char * | s1,
 |  | const char * | s2,
 |  | int | n
 | ) | [inline, static]

Definition at line 43 of file CvsCoworker.cpp.

Referenced by CvsCoworker::GetErrorMessage(), CvsCoworker::GetFileChanges(), CvsCoworker::GetFilesToAdd(), and CvsCoworker::GetProject().

00044 {
00045     CopyString((char*)s1,s2,n);
00046 }

void CopyString | ( | char * | s1,
 |  | const char * | s2,
 |  | int | n
 | ) | [inline, static]

Definition at line 34 of file CvsCoworker.cpp.

00035 {
00036     ASSERT(s1);
00037     ASSERT(s2);
00038     ASSERT(0<n);
00039     strncpy(s1,s2,n);
00040     s1[n-1] = 0;
00041 }

Generated on Sun Oct 21 12:45:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsCoworker.h File Reference

WinCvs/CoWorker/CvsCoworker.h File Reference

#include "resource.h"

Include dependency graph for CvsCoworker.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CvsCoworker

Generated on Sun Oct 21 12:45:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsCoworkerErrors.h File Reference

WinCvs/CoWorker/CvsCoworkerErrors.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define | CVS_E_FAILED_OPEN_PROJECT MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,100)
#define | CVS_E_FAILED_OPEN_DISALLOWED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,101)
#define | CVS_E_FAILED_OPEN_INVALID_USER MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,102)
#define | CVS_E_FAILED_OPEN_CREATE MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,103)
#define | CVS_E_FAILED_OPEN_BAD_PATH MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,104)
#define | CVS_E_FAILED_CLOSE_PROJECT MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,200)
#define | CVS_E_FAILED_UPDATE_FILES MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,300)
#define | CVS_E_FAILED_UPDATE_DISALLOWED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,301)
#define | CVS_E_FAILED_UPDATE_NOT_IN_CVS MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,302)
#define | CVS_E_FAILED_CHECKOUT_FILES MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,400)
#define | CVS_E_FAILED_CHECKOUT_DISALLOWED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,401)
#define | CVS_E_FAILED_CHECKOUT_NOT_IN_CVS MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,402)
#define | CVS_E_FAILED_CHECKIN_FILES MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,500)
#define | CVS_E_FAILED_CHECKIN_DISALLOWED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,501)
#define | CVS_E_FAILED_CHECKIN_NOT_IN_CVS MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,502)
#define | CVS_E_FAILED_CHECKIN_NEED_UPDATE MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,503)
#define | CVS_E_FAILED_PROJECT_INVALID MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,9900)
#define | CVS_E_FAILED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,9901)

Define Documentation

#define CVS_E_FAILED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,9901)

Definition at line 37 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_CHECKIN_DISALLOWED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,501)

Definition at line 31 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_CHECKIN_FILES MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,500)

Definition at line 30 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_CHECKIN_NEED_UPDATE MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,503)

Definition at line 33 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_CHECKIN_NOT_IN_CVS MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,502)

Definition at line 32 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_CHECKOUT_DISALLOWED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,401)

Definition at line 26 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_CHECKOUT_FILES MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,400)

Definition at line 25 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_CHECKOUT_NOT_IN_CVS MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,402)

Definition at line 27 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_CLOSE_PROJECT MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,200)

Definition at line 17 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_OPEN_BAD_PATH MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,104)

Definition at line 14 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_OPEN_CREATE MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,103)

Definition at line 13 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_OPEN_DISALLOWED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,101)

Definition at line 11 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_OPEN_INVALID_USER MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,102)

Definition at line 12 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_OPEN_PROJECT MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,100)

Definition at line 10 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_PROJECT_INVALID MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,9900)

Definition at line 36 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_UPDATE_DISALLOWED MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,301)

Definition at line 21 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_UPDATE_FILES MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,300)

Definition at line 20 of file CvsCoworkerErrors.h.

#define CVS_E_FAILED_UPDATE_NOT_IN_CVS MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,302)

Definition at line 22 of file CvsCoworkerErrors.h.

Generated on Sun Oct 21 12:45:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsFilenames.cpp File Reference

WinCvs/CoWorker/CvsFilenames.cpp File Reference

#include "stdafx.h"
#include "CvsTrace.h"
#include "CvsFilenames.h"

Include dependency graph for CvsFilenames.cpp:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsFilenames.h File Reference

WinCvs/CoWorker/CvsFilenames.h File Reference

#include "CvsString.h"

Include dependency graph for CvsFilenames.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CvsFilenames

Defines

#define | AFX_CVSFILENAMES_H__582FF616_FAA5_11D2_B442_0080C6F9179D__INCLUDED_

Define Documentation

#define AFX_CVSFILENAMES_H__582FF616_FAA5_11D2_B442_0080C6F9179D__INCLUDED_

Definition at line 6 of file CvsFilenames.h.

Generated on Sun Oct 21 12:45:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsProject.cpp File Reference

WinCvs/CoWorker/CvsProject.cpp File Reference

#include "stdafx.h"
#include "CVS_Coworker_i.h"
#include "CvsTrace.h"
#include "CvsProject.h"

Include dependency graph for CvsProject.cpp:

Include dependency graph

Go to the source code of this file.

Variables

int g_hNextProject = 1000
CvsProject * g_pProjects

Variable Documentation

int g_hNextProject = 1000 [static]

Definition at line 11 of file CvsProject.cpp.

CvsProject* g_pProjects [static]

Definition at line 14 of file CvsProject.cpp.

Generated on Sun Oct 21 12:45:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsProject.h File Reference

WinCvs/CoWorker/CvsProject.h File Reference

#include "CvsString.h"
#include "CvsFilenames.h"

Include dependency graph for CvsProject.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CvsProject

Defines

#define | AFX_CVSPROJECT_H__582FF611_FAA5_11D2_B442_0080C6F9179D__INCLUDED_

Define Documentation

#define AFX_CVSPROJECT_H__582FF611_FAA5_11D2_B442_0080C6F9179D__INCLUDED_

Definition at line 6 of file CvsProject.h.

Generated on Sun Oct 21 12:45:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsString.cpp File Reference

WinCvs/CoWorker/CvsString.cpp File Reference

#include "stdafx.h"
#include "CvsTrace.h"
#include "CvsString.h"

Include dependency graph for CvsString.cpp:

Include dependency graph

Go to the source code of this file.

Enumerations

enum | { cbQuanta = 256, cBOB = 0xA5, cEOB = 0xA6 }

Functions

void | CheckBuffer (const char *pBuffer, int cbBuffer=cbQuanta)

Variables

char * | g_pListOfFreeBuffers

Enumeration Type Documentation

anonymous enum

Enumeration values:
cbQuanta
cBOB
cEOB

Definition at line 9 of file CvsString.cpp.

00009      {
00010     cbQuanta    = 256,
00011     cBOB        = 0xA5,
00012     cEOB        = 0xA6
00013 };

Function Documentation

void CheckBuffer | ( | const char * | pBuffer,
 |  | int | cbBuffer = cbQuanta
 | ) | [inline, static]

Definition at line 21 of file CvsString.cpp.

Referenced by CvsString::recycle(), and CvsString::resize().

00022 {
00023     ASSERT(pBuffer);
00024     ASSERT(cBOB == (255&*(pBuffer-1)));
00025     ASSERT(cEOB == (255&*(pBuffer+cbBuffer)));
00026 }

Variable Documentation

char* g_pListOfFreeBuffers [static]

Definition at line 15 of file CvsString.cpp.

Generated on Sun Oct 21 12:45:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsString.h File Reference

WinCvs/CoWorker/CvsString.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class CvsString

Generated on Sun Oct 21 12:45:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsTrace.cpp File Reference

WinCvs/CoWorker/CvsTrace.cpp File Reference

#include "stdafx.h"
#include "CvsTrace.h"
#include "AppConsole.h"
#include <time.h>

Include dependency graph for CvsTrace.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define | IS_LOGGING() (true)

Functions

void | LogSetFilter (const char *s)
int | InFilter (char c)
char * | AddPrefix (char *p)
void | LogWrite (const char *s)
void | LogInitialize (LPCSTR sFileName)
void | LogCleanup (void)
char * | AddIndent (char *p)
void | LogString (const char *s, const char *sValue)
void __cdecl | Log_printf (const char *s,...)
void | LogBuffer (const char *sName, const char *sBuffer, unsigned cbBuffer)

Variables

const char * | g_sFilter = "*<>Aa"
BOOL | g_bLogUnbuffered = FALSE
HANDLE | g_hLogFile = INVALID_HANDLE_VALUE
unsigned | g_nLevel = 0
const char | sHex [] = "0123456789ABCDEF"
const char * | g_sCurrent = "(BASE)"

Define Documentation

#define IS_LOGGING ( ) (true)

Definition at line 36 of file CvsTrace.cpp.

Referenced by CvsTrace::CvsTrace(), LogBuffer(), LogString(), LogWrite(), Log_printf(), and CvsTrace::~CvsTrace().

Function Documentation

char* AddIndent ( char * p ) [inline, static]

Definition at line 86 of file CvsTrace.cpp.

Referenced by LogString(), and Log_printf().

00087 {
00088     for (int n = 31 & g_nLevel; 0<n; --n) {
00089         *p++ = ' ';
00090         *p++ = ' ';
00091     }
00092     return p;
00093 }

char* AddPrefix ( char * p ) [inline, static]

Definition at line 43 of file CvsTrace.cpp.

Referenced by LogString(), and Log_printf().

00044 {
00045     // add line break
00046     *p++ = '\n';
00047     return p;
00048 }

int InFilter ( char c ) [inline, static]

Definition at line 24 of file CvsTrace.cpp.

Referenced by LogBuffer(), LogString(), and Log_printf().

00024                                    {
00025     return 0 != strchr(g_sFilter,c);
00026 }

void LogBuffer | ( | const char * | sName,
 |  | const char * | sBuffer,
 |  | unsigned | cbBuffer
 | ) |

Definition at line 146 of file CvsTrace.cpp.

00147 {
00148     // skip if not logging
00149     if (!IS_LOGGING()) {
00150         return;
00151     }
00152     // omit if not in filter
00153     if (!InFilter(*sName++)) {
00154         return;
00155     }
00156     // mark start of buffer
00157     Log_printf("*[BUFFER %s (%u bytes)]",sName,cbBuffer);
00158     // dump contents of buffer
00159     for (unsigned i=0; i<cbBuffer;) {
00160         char sLine[256];
00161         char* s1 = sLine;
00162         wsprintf(s1,"\n%05x:",i);
00163         s1 += strlen(s1);
00164         memset(s1,' ',50);
00165         char* s2 = s1 + 50;
00166         while (i<cbBuffer) {
00167             unsigned b = *(unsigned char*)(sBuffer+i);
00168             ++s1;
00169             *s1++ = sHex[15&(b>>4)];
00170             *s1++ = sHex[15&b];
00171             *s2++ = (char)(((31<b) && (b<127)) ? b : '.');
00172             ++i;
00173             if (!(15&i)) break;
00174         }
00175         *s2 = 0;
00176         LogWrite(sLine);
00177     }
00178     // mark end of buffer
00179     Log_printf("*[END BUFFER %s]",sName);
00180 }

void LogCleanup ( void )

Definition at line 76 of file CvsTrace.cpp.

Referenced by CWincvsApp::ExitInstance().

00077 {
00078 }

void LogInitialize ( LPCSTR sFileName )

Definition at line 66 of file CvsTrace.cpp.

00067 {
00068     if ('!' == *sFileName) {
00069         g_bLogUnbuffered = TRUE;
00070         ++sFileName;
00071     }
00072     time_t t = time(0);
00073     LogWrite(ctime(&t));
00074 }

void LogSetFilter ( const char * s )

Definition at line 19 of file CvsTrace.cpp.

00020 {
00021     g_sFilter = strdup(s);
00022 }

void LogString | ( | const char * | s,
 |  | const char * | sValue
 | ) |

Definition at line 95 of file CvsTrace.cpp.

00096 {
00097     // skip if not logging
00098     if (!IS_LOGGING()) {
00099         return;
00100     }
00101     if (256 < strlen(sValue)) {
00102         LogBuffer(s,sValue,strlen(sValue));
00103         return;
00104     }
00105     // omit if not in filter
00106     if (!InFilter(*s++)) {
00107         return;
00108     }
00109     char sBuffer[1000];
00110     char* p = AddPrefix(sBuffer);
00111         // insert leading spaces as required
00112     if (' ' == *s) { ++s; p = AddIndent(p); }
00113     // format the arguments
00114     wsprintf(p,"%s : \"%s\"",s,sValue);
00115     ASSERT(strlen((const char*)sBuffer)<sizeof(sBuffer));
00116     // drop into log file
00117     LogWrite(sBuffer);
00118 }

void LogWrite ( const char * s ) [static]

Definition at line 54 of file CvsTrace.cpp.

Referenced by LogBuffer(), LogInitialize(), LogString(), and Log_printf().

00055 {
00056     // skip if not logging
00057     if (IS_LOGGING()) {
00058         cvs_outstr(s,strlen(s));
00059     }
00060 }

void __cdecl Log_printf | ( | const char * | s,
 |  | ... |
 | ) |

Definition at line 120 of file CvsTrace.cpp.

00121 {
00122     // skip if not logging
00123     if (!IS_LOGGING()) {
00124         return;
00125     }
00126     // omit if not in filter
00127     if (!InFilter(*s++)) {
00128         return;
00129     }
00130     char sBuffer[1000];
00131     char* p = AddPrefix(sBuffer);
00132         // insert leading spaces as required
00133     if (' ' == *s) { ++s; p = AddIndent(p); }
00134     // format the arguments
00135     va_list a;
00136     va_start(a,s);
00137     wvsprintf(p,s,a);
00138     va_end(a);
00139     ASSERT(strlen((const char*)sBuffer)<sizeof(sBuffer));
00140     // drop into log file
00141     LogWrite(sBuffer);
00142 }

Variable Documentation

BOOL g_bLogUnbuffered = FALSE [static]

Definition at line 17 of file CvsTrace.cpp.

HANDLE g_hLogFile = INVALID_HANDLE_VALUE [static]

Definition at line 34 of file CvsTrace.cpp.

unsigned g_nLevel = 0 [static]

Definition at line 84 of file CvsTrace.cpp.

const char* g_sCurrent = "(BASE)" [static]

Definition at line 186 of file CvsTrace.cpp.

const char* g_sFilter = "*<>Aa" [static]

Definition at line 16 of file CvsTrace.cpp.

const char sHex[] = "0123456789ABCDEF" [static]

Definition at line 144 of file CvsTrace.cpp.

Generated on Sun Oct 21 12:45:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsTrace.h File Reference

WinCvs/CoWorker/CvsTrace.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

class | CvsTrace

Defines

#define | LOG_API_FN(FN) CvsTrace _fn_(#FN)
#define | LOG_API_S(S) if (S) { LogString("A " #S,(const char*)(S)); }
#define | LOG_API_X(X) { Log_printf("A " #X " : 0x%lx",(long)(X)); }
#define | LOG_API_N(N) { Log_printf("A " #N " : %lu",(long)(N)); }
#define | qTRACE_FN(FN) CvsTrace _fn_(#FN)
#define | qTRACE(L) Log_printf L
#define | LOG_BUFFER(A, B, N) LogBuffer(A,B,N)
#define | qTRACE_S(S) if (S) { qTRACE(("a " #S " : \"%s\"",(S))); }
#define | qTRACE_X(X) { qTRACE(("a " #X " : 0x%lx",(long)(X))); }
#define | qTRACE_N(N) { qTRACE(("a " #N " : %lu",(long)(N))); }
#define | ASSERT(X) if (!(X)) { __Assert(__FILE__,__LINE__,#X); DebugBreak(); } else 0
#define | VERIFY(X) if (!(X)) { __Assert(__FILE__,__LINE__,#X); DebugBreak(); } else 0

Functions

void | LogSetFilter (const char *)
void | LogInitialize (LPCSTR)
void | LogCleanup (void)
void | LogAttach (HFILE, LPCSTR)
void | LogBuffer (const char *, const char *, unsigned)
void __cdecl | Log_printf (const char *,...)
void | LogString (const char *, const char *)
void | __Assert (const char *sFile, unsigned iLine, const char *sExpression)

Define Documentation

#define ASSERT ( X ) if (!(X)) { __Assert(__FILE__,__LINE__,#X); DebugBreak(); } else 0

Definition at line 91 of file CvsTrace.h.

Referenced by CSubclassWndMap::Add(), CCJToolBar::AddButtons(), CCJToolBar::AddDropDownButton(), CvsCoworker::AddFiles(), CGfxOutBarCtrl::AddFolder(), CGfxOutBarCtrl::AddFolderBar(), CCJComboBoxEx::AddString(), CCJToolBar::AddStrings(), CCJTabView::AddView(), CGfxOutBarCtrl::AnimateFolderScroll(), CCJToolBar::AutoSize(), CCJHtmlView::BeforeNavigate2(), CCJReBarCtrl::BeginDrag(), CGfxOutBarCtrl::CBarFolder::CBarFolder(), CGfxOutBarCtrl::CBarItem::CBarItem(), CCJSortClass::CCJSortClass(), CCJToolBar::CCJToolBar(), CCharFormat::CCharFormat(), CWndRedrawMngr::CWndRedrawMngr(), CCJReBar::CalcDynamicLayout(), CCJReBar::CalcFixedLayout(), CCJToolBar::CalcLayout(), CCJToolBar::CalcSize(), CCJDockContext::CanDockDockBar(), CheckBuffer(), CCJToolBar::CheckButton(), CvsCoworker::CheckinFiles(), CvsCoworker::CheckoutFiles(), CCJToolBar::CommandToIndex(), CCJSortClass::Compare(), CompareTargetDate(), CopyString(), CCJReBar::Create(), CCJColorPopup::Create(), CCJCaptionPopupWnd::Create(), CCJBrowseButton::Create(), CCJToolBar::CreateEx(), CCJTabCtrlBar::CreateTabView(), CCJHyperLink::CtlColor(), CCJToolBar::Customize(), CustomizeMenus(), CvsFilenames::CvsFilenames(), DDV_CJMinMaxDateTime(), DDV_CJMinMaxMonth(), DDV_MinChars(), DDX_CJColorPicker(), DeferClientPos(), CWinCvsBrowser::DeleteAllItems(), UCvsFolders::DeleteAllItems(), CCJReBarCtrl::DeleteBand(), CCJToolBar::DeleteButton(), CCJFlatTabCtrl::DeleteItem(), CCJComboBoxEx::DeleteItem(), CCJTabCtrlBar::DeleteView(), CvsCoworker::DiffFile(), CCJComboBoxEx::Dir(), CCJFlatButton::DisableFlatLook(), CCJMenu::DitherBlt(), CCJMDIFrameWnd::DockSizeBar(), CCJMDIChildWnd::DockSizeBar(), CCJFrameWnd::DockSizeBar(), CCJDockContext::DockSizeBar(), CCJHtmlView::DocumentComplete(), CCJReBarCtrl::DragMove(), CGfxOutBarCtrl::DrawAnimItem(), CCJToolBarBase::DrawBorders(), CGfxOutBarCtrl::DrawItem(), CCJMetaFileButton::DrawItem(), CCJMenu::DrawItem(), CCJFlatHeaderCtrl::DrawItem(), CCJFlatButton::DrawItem(), CCJColorPicker::DrawItem(), DrawNode(), CCJToolCmdUI::Enable(), CCJFlatComboBox::EnableAutoCompletion(), CCJToolBar::EnableButton(), CCJMDIFrameWnd::EnableDocking(), CCJMDIChildWnd::EnableDocking(), CCJFrameWnd::EnableDocking(), CCJControlBar::EnableDockingOnSizeBar(), CCJMDIFrameWnd::EnableDockingSizeBar(), CCJMDIChildWnd::EnableDockingSizeBar(), CCJFrameWnd::EnableDockingSizeBar(), CCJControlBar::EnableFlatLook(), CCJControlBar::EnableSaveState(), CCJReBarCtrl::EndDrag(), TBrowserFill::EnterDirectory(), CCJFontCombo::EnumFontProc(), CCJHtmlView::ExecWB(), CCJComboBoxEx::FindString(), CCJPagerCtrl::ForwardMouse(), CCJHtmlView::GetAddressBar(), CCJToolBarCtrl::GetAnchorHighlight(), CCJHtmlView::GetApplication(), CCJReBarCtrl::GetBandBorders(), CCJReBarCtrl::GetBandCount(), CCJReBarCtrl::GetBandInfo(), CCJReBarCtrl::GetBarHeight(), CCJReBarCtrl::GetBarInfo(), CCJToolBar::GetBitmap(), CCJToolBar::GetBitmapFlags(), CCJReBarCtrl::GetBkColor(), CCJPagerCtrl::GetBkColor(), CCJPagerCtrl::GetBorder(), CCJHtmlView::GetBusy(), CCJToolBar::GetButtonCount(), CCJToolBarCtrl::GetButtonInfo(), CCJToolBar::GetButtonInfo(), CCJToolBarCtrl::GetButtonSize(), CCJPagerCtrl::GetButtonSize(), CCJToolBar::GetButtonSize(), CCJPagerCtrl::GetButtonState(), CCJToolBar::GetButtonStyle(), CCJMonthCalCtrl::GetColor(), CCJComboBoxEx::GetComboBoxCtrl(), CCJHtmlView::GetContainer(), CCJMonthCalCtrl::GetCurSel(), GetCustomMenu(), CCJToolBarCtrl::GetDisabledImageList(), CCJDockContext::GetDockBar(), CWincvsApp::GetDocument(), CCJReBarCtrl::GetDropTarget(), CCJPagerCtrl::GetDropTarget(), CCJToolBarCtrl::GetDropTarget(), CCJComboBoxEx::GetEditCtrl(), CMainFrame::GetEnvMainThread(), CvsCoworker::GetErrorMessage(), CCJToolBarCtrl::GetExtendedStyle(), CCJListView::GetExtendedStyle(), CCJListCtrl::GetExtendedStyle(), CCJComboBoxEx::GetExtendedStyle(), CvsCoworker::GetFileChanges(), CvsCoworker::GetFilesToAdd(), CCJMonthCalCtrl::GetFirstDayOfWeek(), CGfxOutBarCtrl::GetFolderImageList(), CGfxOutBarCtrl::GetFolderRect(), CCJHtmlView::GetFullName(), CCJHtmlView::GetFullScreen(), CCJHtmlView::GetHeight(), CCJControlBar::GetHorzSize(), CCJToolBarCtrl::GetHotImageList(), CCJToolBarCtrl::GetHotItem(), CCJToolBar::GetHotItem(), CCJHtmlView::GetHtmlDocument(), CCJTabCtrlBar::GetImageIndexFromRuntimeClass(), CCJToolBarCtrl::GetImageList(), CCJToolBar::GetImageList(), CCJComboBoxEx::GetImageList(), CCJToolBarCtrl::GetInsertMark(), CCJToolBarCtrl::GetInsertMarkColor(), CCJComboBoxEx::GetItem(), CGfxOutBarCtrl::GetItemCount(), CGfxOutBarCtrl::GetItemData(), CCJToolBar::GetItemID(), CGfxOutBarCtrl::GetItemImage(), CCJToolBar::GetItemRect(), CGfxOutBarCtrl::GetItemSize(), CGfxOutBarCtrl::GetItemText(), CvsCoworker::GetLastError(), CCJHtmlView::GetLeft(), CCJHtmlView::GetLocationName(), CCJHtmlView::GetLocationURL(), CCJMonthCalCtrl::GetMaxSelCount(), CCJToolBarCtrl::GetMaxSize(), CCJToolBarCtrl::GetMaxTextRows(), CCJHtmlView::GetMenuBar(), GetMenuEntry(), CCJFlatHeaderCtrl::GetMenuID(), CCJControlBar::GetMenuID(), CCJMonthCalCtrl::GetMinReqRect(), CCJDateTimeCtrl::GetMonthCalColor(), CCJDateTimeCtrl::GetMonthCalCtrl(), CCJDateTimeCtrl::GetMonthCalFont(), CCJMonthCalCtrl::GetMonthDelta(), CCJMonthCalCtrl::GetMonthRange(), CCJHtmlView::GetOffline(), CCJFlatHeaderCtrl::GetOrderArray(), CCJToolBar::GetPadding(), CCJReBarCtrl::GetPalette(), CCJHtmlView::GetParentBrowser(), CCJPagerCtrl::GetPos(), CvsCoworker::GetProject(), CCJHtmlView::GetProperty(), CCJMonthCalCtrl::GetRange(), CCJDateTimeCtrl::GetRange(), CCJHtmlView::GetReadyState(), CCJToolBar::GetRect(), CCJReBarCtrl::GetRect(), CCJHtmlView::GetRegisterAsBrowser(), CCJHtmlView::GetRegisterAsDropTarget(), CCJReBarCtrl::GetRowCount(), CCJReBarCtrl::GetRowHeight(), CCJToolBar::GetRows(), CCJMonthCalCtrl::GetSelRange(), CCJHtmlView::GetSilent(), CCJToolBar::GetState(), CCJHtmlView::GetStatusBar(), CCJToolBarCtrl::GetStyle(), GetSubCMenu(), CCJReBarCtrl::GetTextColor(), CCJHtmlView::GetTheaterMode(), CCJDateTimeCtrl::GetTime(), GetTimeZoneBias(), CCJMonthCalCtrl::GetToday(), CCJHtmlView::GetToolBar(), CCJToolBar::GetToolBarCtrl(), CCJTabCtrlBar::GetToolTip(), CCJToolBar::GetToolTips(), CCJReBarCtrl::GetToolTips(), CCJToolBar::GetToolbarStyle(), CCJHtmlView::GetTop(), CCJHtmlView::GetTopLevelContainer(), CCJHtmlView::GetType(), CCJControlBar::GetVertSize(), CCJTabView::GetView(), CCJTabCtrlBar::GetView(), CCJTabCtrlBar::GetViewName(), CCJHtmlView::GetVisible(), CCJHtmlView::GoBack(), CCJHtmlView::GoForward(), CCJHtmlView::GoHome(), CCJHtmlView::GoSearch(), CvsCoworker::HasAdvancedOptionsForCommand(), CCJComboBoxEx::HasEditChanged(), CCJToolBar::HideButton(), CCJFlatSplitterWnd::HideColumn(), CCJFlatSplitterWnd::HideRow(), CCJToolBarCtrl::HitTest(), CCJToolBar::HitTest(), CCJReBarCtrl::HitTest(), CCJMonthCalCtrl::HitTest(), CSubclassWnd::HookWindow(), HookWndProc(), CCJReBarCtrl::IDToIndex(), CCJToolBar::Indeterminate(), CCJColorPopup::Initialise(), CCJMDIFrameWnd::InitializeMenu(), CCJFrameWnd::InitializeMenu(), CCJReBarCtrl::InsertBand(), CCJToolBar::InsertButton(), CCJToolBar::InsertControl(), CGfxOutBarCtrl::CBarFolder::InsertItem(), CGfxOutBarCtrl::InsertItem(), CCJFlatTabCtrl::InsertItem(), CCJComboBoxEx::InsertItem(), CCJToolBarCtrl::InsertMarkHitTest(), CCJComboBoxEx::InsertString(), CCJControlBar::IsBottomDocked(), CCJToolBar::IsButtonChecked(), CCJToolBar::IsButtonEnabled(), CCJToolBar::IsButtonHidden(), CCJToolBarCtrl::IsButtonHighlighted(), CCJToolBar::IsButtonIndeterminate(), CCJToolBar::IsButtonPressed(), IsDST(), CCJControlBar::IsFloating(), CCJControlBar::IsHorzDocked(), CCJControlBar::IsLeftDocked(), CCJControlBar::IsRightDocked(), CCJControlBar::IsTopDocked(), CGfxOutBarCtrl::IsValidItem(), CCJControlBar::IsVertDocked(), CCJToolBar::Layout(), LayoutRowCol(), CCJToolBar::LoadBitmap(), CCJHtmlView::LoadFromResource(), CCJMenu::LoadMenu(), CCJToolBar::LoadToolBar(), CCJMenu::LoadToolbars(), LogString(), Log_printf(), CCJToolBarCtrl::MapAccelerator(), CCJToolBar::MapAccelerator(), CCJToolBarCtrl::MarkButton(), CCJReBarCtrl::MaximizeBand(), CCJReBarCtrl::MinimizeBand(), CCJCaption::ModifyCaptionStyle(), CCJMenu::ModifyODMenuW(), CCJReBarCtrl::MoveBand(), CCJToolBarCtrl::MoveButton(), CCJHtmlView::Navigate2(), CCJHtmlView::NavigateComplete2(), CCJMenu::NewODMenu(), CMainFrame::OnActivate(), CCJToolBar::OnBarStyleChange(), CCJBrowseButton::OnClicked(), UCvsFolders::OnCmdAdd(), UCvsFolders::OnCmdCommit(), UCvsFolders::OnCmdDiff(), UCvsFolders::OnCmdEdit(), UCvsFolders::OnCmdEditors(), UCvsFolders::OnCmdExplore(), UCvsFolders::OnCmdLock(), UCvsFolders::OnCmdLog(), UCvsFolders::OnCmdQueryUpdate(), UCvsFolders::OnCmdRelease(), UCvsFolders::OnCmdStatus(), UCvsFolders::OnCmdTagBranch(), UCvsFolders::OnCmdTagDelete(), UCvsFolders::OnCmdTagNew(), UCvsFolders::OnCmdUnedit(), UCvsFolders::OnCmdUnlock(), UCvsFolders::OnCmdUpdate(), UCvsFolders::OnCmdWatchOff(), UCvsFolders::OnCmdWatchOn(), UCvsFolders::OnCmdWatchers(), CCJHexEdit::OnContextMenu(), CMainFrame::OnCreate(), CCJTabView::OnCreate(), CCJFlatHeaderCtrl::OnCreate(), CCJHtmlView::OnDraw(), CCJFlatSplitterWnd::OnDrawSplitter(), CCJToolBar::OnDropDownButton(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CMainFrame::OnInitMenu(), CGraphView::OnInitMenuPopup(), CGfxSplitterWnd::OnInvertTracker(), CCJSizeDockBar::OnInvertTracker(), CCJControlBar::OnInvertTracker(), CGfxOutBarCtrl::OnLButtonDown(), CCJOutlookBar::OnLButtonUp(), CCJMenuBar::OnMenuInput(), CCJControlBar::OnMouseMove(), CCJToolBar::OnNcCalcSize(), CCJToolBar::OnNcCreate(), CCJMiniDockFrameWnd::OnNcLButtonDblClk(), CCJMiniDockFrameWnd::OnNcLButtonDown(), CCJHexEdit::OnPaint(), CCJToolBar::OnPreserveZeroBorderHelper(), CGfxOutBarCtrl::OnRButtonDown(), CCJTabCtrl::OnRButtonDown(), CCJFlatHeaderCtrl::OnRButtonDown(), CCJControlBar::OnRButtonDown(), CCJReBar::OnRecalcParent(), CCJToolBar::OnSetSizeHelper(), CMainFrame::OnSysCommand(), UToolbar::OnTbButton(), UToolbar::OnTbCheckBtn(), UToolbar::OnTbDropDown(), UToolbar::OnTbSeparator(), CCJToolBar::OnToolHitTest(), CCJReBar::OnToolHitTest(), UCvsFolders::OnTreeSelecting(), CCJTabCtrlBar::OnWindowPosChanged(), CvsCoworker::OpenProject(), CCJTabCtrlBar::OverkillAssert(), CGfxOutBarCtrl::PaintItems(), CCJFlatComboBox::PointInRect(), CCJMDIFrameWnd::PreCreateWindow(), CCJFrameWnd::PreCreateWindow(), CCJHyperLink::PreSubclassWindow(), CCJFlatHeaderCtrl::PreSubclassWindow(), CCJToolBar::PressButton(), CCJHtmlView::PutProperty(), CWincvsView::QueryAcceptData(), CCJHtmlView::QueryStatusWB(), CGfxSplitterWnd::RecalcLayout(), CCJPagerCtrl::RecalcSize(), CCJMenuBar::RecomputeToolbarSize(), CCJHtmlView::Refresh(), CCJHtmlView::Refresh2(), CSubclassWndMap::Remove(), CvsCoworker::RemoveFiles(), CGfxOutBarCtrl::RemoveFolder(), CGfxOutBarCtrl::RemoveItem(), CCJTabCtrlBar::RemoveListItem(), CCJTabView::RemoveView(), CCJTabCtrlBar::RemoveView(), CvsCoworker::RenameFile(), CCJToolBar::SendMessageC(), CCJTabView::SetActiveView(), CCJTabCtrlBar::SetActiveView(), CCJHtmlView::SetAddressBar(), CCJToolBarCtrl::SetAnchorHighlight(), CCJReBarCtrl::SetBandInfo(), CCJReBarCtrl::SetBarInfo(), CCJToolBar::SetBitmap(), CCJToolBar::SetBitmapSize(), CCJReBarCtrl::SetBkColor(), CCJPagerCtrl::SetBkColor(), CCJPagerCtrl::SetBorder(), CCJToolBarBase::SetBorders(), CCJFlatButton::SetButtonFont(), CCJToolBarCtrl::SetButtonInfo(), CCJToolBar::SetButtonSize(), CCJPagerCtrl::SetButtonSize(), CCJToolBar::SetButtonStructSize(), CCJToolBar::SetButtonStyle(), CCJToolBar::SetButtonText(), CCJToolBarCtrl::SetButtonWidth(), CCJToolBar::SetButtons(), CCJCaption::SetCaptionColors(), CCJToolCmdUI::SetCheck(), CCJPagerCtrl::SetChild(), CCJControlBar::SetChild(), CCJCaption::SetChildWindow(), CCJToolBar::SetCmdID(), CCJMonthCalCtrl::SetColor(), CCJMonthCalCtrl::SetCurSel(), CCJMonthCalCtrl::SetDayState(), CCJToolBarCtrl::SetDisabledImageList(), CCJToolBarCtrl::SetDrawTextFlags(), CCJMaskEdit::SetEditMask(), CCJComboBoxEx::SetEditSel(), CCJToolBarCtrl::SetExtendedStyle(), CCJToolBar::SetExtendedStyle(), CCJListView::SetExtendedStyle(), CCJListCtrl::SetExtendedStyle(), CCJComboBoxEx::SetExtendedStyle(), CCJMonthCalCtrl::SetFirstDayOfWeek(), CGfxOutBarCtrl::SetFolderImageList(), CGfxOutBarCtrl::SetFolderText(), CCJFlatHeaderCtrl::SetFontBold(), CCJDateTimeCtrl::SetFormat(), CCJHtmlView::SetFullScreen(), CCJHtmlView::SetHeight(), CCJToolBarCtrl::SetHotImageList(), CCJToolBarCtrl::SetHotItem(), CCJToolBar::SetHotItem(), CCJFlatButton::SetIcon(), CCJToolBarCtrl::SetImageList(), CCJToolBar::SetImageList(), CCJComboBoxEx::SetImageList(), CCJToolBarCtrl::SetIndent(), CCJToolBar::SetIndent(), CCJToolBarCtrl::SetInsertMark(), CCJToolBarCtrl::SetInsertMarkColor(), CCJComboBoxEx::SetItem(), CGfxOutBarCtrl::SetItemData(), CGfxOutBarCtrl::SetItemImage(), CGfxOutBarCtrl::SetItemText(), CCJHtmlView::SetLeft(), CCJMonthCalCtrl::SetMaxSelCount(), CCJToolBarCtrl::SetMaxTextRows(), CCJHtmlView::SetMenuBar(), CCJFlatHeaderCtrl::SetMenuID(), CCJControlBar::SetMenuID(), CCJDateTimeCtrl::SetMonthCalColor(), CCJDateTimeCtrl::SetMonthCalFont(), CCJMonthCalCtrl::SetMonthDelta(), CCJControlBar::SetNormalSize(), CCJHtmlView::SetOffline(), CCJReBarCtrl::SetOwner(), CCJToolBar::SetOwner(), CCJToolBar::SetPadding(), CCJReBarCtrl::SetPalette(), CCJPagerCtrl::SetPos(), CCJMonthCalCtrl::SetRange(), CCJDateTimeCtrl::SetRange(), CCJHtmlView::SetRegisterAsBrowser(), CCJHtmlView::SetRegisterAsDropTarget(), CCJToolBar::SetRows(), CCJPagerCtrl::SetScrollArea(), CGfxOutBarCtrl::SetSelFolder(), CCJMonthCalCtrl::SetSelRange(), CCJHtmlView::SetSilent(), CCJToolBar::SetSizes(), CCJToolBar::SetState(), CCJHtmlView::SetStatusBar(), CCJToolBarCtrl::SetStyle(), CCJReBarCtrl::SetTextColor(), CCJHtmlView::SetTheaterMode(), CCJDateTimeCtrl::SetTime(), CCJMonthCalCtrl::SetToday(), CCJHtmlView::SetToolBar(), CCJToolBar::SetToolTips(), CCJReBarCtrl::SetToolTips(), CCJToolBar::SetToolbarStyle(), UCmdUI::SetTooltip(), CCJHtmlView::SetTop(), CCJTabCtrlBar::SetViewToolTip(), CCJHtmlView::SetVisible(), CCJReBarCtrl::ShowBand(), CCJFlatSplitterWnd::ShowColumn(), CvsCoworker::ShowFileHistory(), CvsCoworker::ShowFileProperties(), CCJControlBar::ShowFrameControls(), CCJFlatSplitterWnd::ShowRow(), CvsCoworker::ShowUserInterface(), CCJReBarCtrl::SizeToRect(), CCJToolBar::SizeToolBar(), CGfxOutBarCtrl::StartGroupEdit(), CGfxOutBarCtrl::StartItemEdit(), CCJDockContext::StartResize(), CCJHtmlView::Stop(), CCJListView::SubclassHeader(), CCJListCtrl::SubclassHeader(), CCJDockContext::ToggleDocking(), CCJDockContext::TrackDockBar(), CCJMenuBar::TrackPopup(), CCJMenuBar::TranslateFrameMessage(), UMenuAddToggle(), UWinPseudoWindowProc(), CvsCoworker::UncheckoutFiles(), CCJCaption::UpdateCaption(), CvsCoworker::UpdateFiles(), CSubclassWnd::WindowProc(), CCJToolBar::WrapToolBar(), CCJReBar::_AddBar(), _AfxRelease(), _CjxChildWindowFromPoint(), _GetComCtlVersion(), _GetDropDownWidth(), _statcore(), CvsFilenames::getFilename(), CvsFilenames::getOptionsAndFilename(), CvsString::resize(), updateUIMenu(), width(), CCJSortClass::~CCJSortClass(), CSplashWnd::~CSplashWnd(), and CvsProject::~CvsProject().

#define LOG_API_FN ( FN ) CvsTrace _fn_(#FN)

Definition at line 45 of file CvsTrace.h.

Referenced by CvsCoworker::AddFiles(), CvsCoworker::CheckinFiles(), CvsCoworker::CheckoutFiles(), CvsCoworker::CloseProject(), CvsCoworker::DiffFile(), CvsCoworker::GetErrorMessage(), CvsCoworker::GetFileChanges(), CvsCoworker::GetFilesToAdd(), CvsCoworker::GetProject(), CvsCoworker::HasAdvancedOptionsForCommand(), CvsCoworker::OpenProject(), CvsCoworker::RemoveFiles(), CvsCoworker::RenameFile(), CvsCoworker::ShowAdvancedOptionsForCommand(), CvsCoworker::ShowFileHistory(), CvsCoworker::ShowFileProperties(), CvsCoworker::ShowUserInterface(), CvsCoworker::UncheckoutFiles(), and CvsCoworker::UpdateFiles().

#define LOG_API_N ( N ) { Log_printf("A " #N " : %lu",(long)(N)); }

Definition at line 54 of file CvsTrace.h.

Referenced by CvsCoworker::AddFiles(), CvsCoworker::CheckinFiles(), CvsCoworker::CheckoutFiles(), CvsCoworker::CloseProject(), CvsCoworker::DiffFile(), CvsCoworker::GetErrorMessage(), CvsCoworker::GetFileChanges(), CvsCoworker::GetFilesToAdd(), CvsCoworker::GetProject(), CvsCoworker::HasAdvancedOptionsForCommand(), CvsCoworker::OpenProject(), CvsCoworker::RemoveFiles(), CvsCoworker::RenameFile(), CvsCoworker::ShowAdvancedOptionsForCommand(), CvsCoworker::ShowFileHistory(), CvsCoworker::ShowFileProperties(), CvsCoworker::ShowUserInterface(), CvsCoworker::UncheckoutFiles(), and CvsCoworker::UpdateFiles().

#define LOG_API_S ( S ) if (S) { LogString("A " #S,(const char*)(S)); }

Definition at line 48 of file CvsTrace.h.

Referenced by CvsCoworker::AddFiles(), CvsCoworker::CheckinFiles(), CvsCoworker::CheckoutFiles(), CvsCoworker::DiffFile(), CvsCoworker::GetErrorMessage(), CvsCoworker::GetFileChanges(), CvsCoworker::GetFilesToAdd(), CvsCoworker::GetProject(), CvsCoworker::OpenProject(), CvsCoworker::RemoveFiles(), CvsCoworker::RenameFile(), CvsCoworker::ShowFileHistory(), CvsCoworker::ShowFileProperties(), CvsCoworker::ShowUserInterface(), CvsCoworker::UncheckoutFiles(), and CvsCoworker::UpdateFiles().

#define LOG_API_X ( X ) { Log_printf("A " #X " : 0x%lx",(long)(X)); }

Definition at line 51 of file CvsTrace.h.

#define LOG_BUFFER | ( | A,
 |  | B,
 |  | N | ) | LogBuffer(A,B,N)

Definition at line 68 of file CvsTrace.h.

#define VERIFY ( X ) if (!(X)) { __Assert(__FILE__,__LINE__,#X); DebugBreak(); } else 0

Definition at line 92 of file CvsTrace.h.

Referenced by CCJToolBar::AddReplaceBitmap(), CCJPagerCtrl::CCJPagerCtrl(), CCJToolBarCtrl::CCJToolBarCtrl(), CCJReBar::CalcFixedLayout(), CCJReBarCtrl::Create(), CCJReBar::Create(), CCJMonthCalCtrl::Create(), CCJDateTimeCtrl::Create(), CCJComboBoxEx::Create(), CBrowserBar::Create(), CCJToolBar::CreateEx(), CWinCvsBrowser::DeleteAllItems(), CCJMenu::DitherBlt(), CCJMenu::DrawItem(), CCJToolBar::GetButton(), GetCustomMenu(), CToolbarCombo::GetItemText(), CWincvsApp::InitInstance(), CCJFlatHeaderCtrl::InitializeHeader(), CCJMenu::InsertSpaces(), CCJMenuBar::LoadMenu(), CCJMenu::MeasureItem(), CCJTabView::ModifyTabStyle(), CCustomizeMenus::OnAdd(), CCJBrowseButton::OnClicked(), CCJHexEdit::OnContextMenu(), CCJTabView::OnCreate(), CCJToolBar::OnDropDownButton(), UWidget::OnGetSliderProperty(), CWinCvsBrowser::OnInitialUpdate(), CGfxOutBarCtrl::OnLButtonDown(), UWidget::OnListAddSel(), UWidget::OnListDelRow(), UWidget::OnListResetAll(), UWidget::OnListSetColTitle(), UWidget::OnListSetColWidth(), CCustomizeMenus::OnMove(), CGfxOutBarCtrl::OnRButtonDown(), CCJToolBar::OnRButtonDown(), CCJTabCtrl::OnRButtonDown(), CCJFlatHeaderCtrl::OnRButtonDown(), CCJControlBar::OnRButtonDown(), CCustomizeMenus::OnRemove(), UWidget::OnSetSliderProperty(), CCJReBar::OnShowBand(), UToolbar::OnTbInit(), CWinCvsBrowser::ResetBrowser(), CWinCvsBrowser::ResetView(), CBrowseFileView::ResetView(), CWinCvsBrowser::RetrievePath(), CCJToolBar::SetButton(), CCJToolBar::SetButtons(), SetIcon(), CCJToolBar::SetSizes(), CWinCvsBrowser::StepToLocation(), CWinCvsBrowser::StoreExpanded(), UMenuAddButton(), UMenuAddPulldown(), UMenuAddSeparator(), UMenuAddToggle(), UMenuCount(), UMenuDelete(), UMenuDeleteByCmd(), UWinPseudoWindowProc(), CCJTabCtrl::UpdateFont(), CCJOutlookBar::UpdateFont(), CCJMenuBar::UpdateFont(), CCJMaskEdit::UpdateFont(), CCJFlatButton::UpdateFont(), CCJColorPopup::UpdateFont(), CCJCaption::UpdateFont(), CCJBrowseButton::UpdateFont(), and _GetDropDownWidth().

#define qTRACE ( L ) Log_printf L

Definition at line 67 of file CvsTrace.h.

Referenced by CvsFilenames::CvsFilenames(), CvsString::recycle(), and CvsString::resize().

#define qTRACE_FN ( FN ) CvsTrace _fn_(#FN)

Definition at line 66 of file CvsTrace.h.

Referenced by CvsCoworker::CvsCoworker(), CvsFilenames::CvsFilenames(), and CvsCoworker::InterfaceSupportsErrorInfo().

#define qTRACE_N ( N ) { qTRACE(("a " #N " : %lu",(long)(N))); }

Definition at line 77 of file CvsTrace.h.

#define qTRACE_S ( S ) if (S) { qTRACE(("a " #S " : \"%s\"",(S))); }

Definition at line 71 of file CvsTrace.h.

#define qTRACE_X ( X ) { qTRACE(("a " #X " : 0x%lx",(long)(X))); }

Definition at line 74 of file CvsTrace.h.

Function Documentation

void LogAttach | ( | HFILE | ,
 |  | LPCSTR |
 | ) |

void LogBuffer | ( | const char * | sName,
 |  | const char * | sBuffer,
 |  | unsigned | cbBuffer
 | ) |

Definition at line 146 of file CvsTrace.cpp.

Referenced by LogString().

00147 {
00148     // skip if not logging
00149     if (!IS_LOGGING()) {
00150         return;
00151     }
00152     // omit if not in filter
00153     if (!InFilter(*sName++)) {
00154         return;
00155     }
00156     // mark start of buffer
00157     Log_printf("*[BUFFER %s (%u bytes)]",sName,cbBuffer);
00158     // dump contents of buffer
00159     for (unsigned i=0; i<cbBuffer;) {
00160         char sLine[256];
00161         char* s1 = sLine;
00162         wsprintf(s1,"\n%05x:",i);
00163         s1 += strlen(s1);
00164         memset(s1,' ',50);
00165         char* s2 = s1 + 50;
00166         while (i<cbBuffer) {
00167             unsigned b = *(unsigned char*)(sBuffer+i);
00168             ++s1;
00169             *s1++ = sHex[15&(b>>4)];
00170             *s1++ = sHex[15&b];
00171             *s2++ = (char)(((31<b) && (b<127)) ? b : '.');
00172             ++i;
00173             if (!(15&i)) break;
00174         }
00175         *s2 = 0;
00176         LogWrite(sLine);
00177     }
00178     // mark end of buffer
00179     Log_printf("*[END BUFFER %s]",sName);
00180 }

void LogCleanup ( void )

Definition at line 76 of file CvsTrace.cpp.

00077 {
00078 }

void LogInitialize ( LPCSTR sFileName )

Definition at line 66 of file CvsTrace.cpp.

00067 {
00068     if ('!' == *sFileName) {
00069         g_bLogUnbuffered = TRUE;
00070         ++sFileName;
00071     }
00072     time_t t = time(0);
00073     LogWrite(ctime(&t));
00074 }

void LogSetFilter ( const char * s )

Definition at line 19 of file CvsTrace.cpp.

00020 {
00021     g_sFilter = strdup(s);
00022 }

void LogString | ( | const char * | s,
 |  | const char * | sValue
 | ) |

Definition at line 95 of file CvsTrace.cpp.

00096 {
00097     // skip if not logging
00098     if (!IS_LOGGING()) {
00099         return;
00100     }
00101     if (256 < strlen(sValue)) {
00102         LogBuffer(s,sValue,strlen(sValue));
00103         return;
00104     }
00105     // omit if not in filter
00106     if (!InFilter(*s++)) {
00107         return;
00108     }
00109     char sBuffer[1000];
00110     char* p = AddPrefix(sBuffer);
00111         // insert leading spaces as required
00112     if (' ' == *s) { ++s; p = AddIndent(p); }
00113     // format the arguments
00114     wsprintf(p,"%s : \"%s\"",s,sValue);
00115     ASSERT(strlen((const char*)sBuffer)<sizeof(sBuffer));
00116     // drop into log file
00117     LogWrite(sBuffer);
00118 }

void __cdecl Log_printf | ( | const char * | s,
 |  | ... |
 | ) |

Definition at line 120 of file CvsTrace.cpp.

Referenced by CvsTrace::CvsTrace(), LogBuffer(), __Assert(), and CvsTrace::~CvsTrace().

00121 {
00122     // skip if not logging
00123     if (!IS_LOGGING()) {
00124         return;
00125     }
00126     // omit if not in filter
00127     if (!InFilter(*s++)) {
00128         return;
00129     }
00130     char sBuffer[1000];
00131     char* p = AddPrefix(sBuffer);
00132         // insert leading spaces as required
00133     if (' ' == *s) { ++s; p = AddIndent(p); }
00134     // format the arguments
00135     va_list a;
00136     va_start(a,s);
00137     wvsprintf(p,s,a);
00138     va_end(a);
00139     ASSERT(strlen((const char*)sBuffer)<sizeof(sBuffer));
00140     // drop into log file
00141     LogWrite(sBuffer);
00142 }

void __Assert | ( | const char * | sFile,
 |  | unsigned | iLine,
 |  | const char * | sExpression
 | ) | [static]

Definition at line 98 of file CvsTrace.h.

00099 {
00100     Log_printf("*%s:%u ASSERT FAILED: %s",sFile,iLine,sExpression);
00101 }

Generated on Sun Oct 21 12:45:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dlldata.c File Reference

WinCvs/CoWorker/dlldata.c File Reference

#include <rpcproxy.h>

Include dependency graph for dlldata.c:

Include dependency graph

Go to the source code of this file.

Generated on Sun Oct 21 12:45:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


resrc1.h File Reference

WinCvs/res/resrc1.h File Reference

Go to the source code of this file.

Generated on Sun Oct 21 12:45:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Annotated Index

WinCvs 1.3b6 Source Doc Compound List

Here are the classes, structs, unions and interfaces with brief descriptions:
_afxRichEditCookie |
_CvsProcess |
_dircontents |
_dirdesc |
_frameRec |
_IID |
_linkname |
_MIDL_PROC_FORMAT_STRING |
_MIDL_TYPE_FORMAT_STRING |
_name |
_SUBIO |
_TABLE |
_version |
_WireHandler |
_WireMessage |
CAboutDlg |
AddBinCvsArgs |
AddCvsArgs |
addremove_args |
admin_data |
admin_file |
AFX_DLLVERSIONINFO |
CAllHandlers |
CAllTargets |
ansiAttrCvt |
ansiAttrCvt::AnsiSeq |
AREF |
aref |
ASEntry |
ASFileDates |
ASFinderInfo |
ASHeader |
ASMacInfo |
Authen |
UAuthen_Kserver |
UAuthen_Pserver |
UAuthen_Rhosts |
UAuthen_SSH |
AuthenKserver |
AuthenLocal |
AuthenModel |
AuthenNtserver |
AuthenPserver |
AuthenRhosts |
CAuthenSetUp |
AuthenSSH |
awidget |
CBarConsole |
CBrowseFileView |
CBrowserBar |
UBrush |
CBuffer |
CButton |
change |
CCharFormat |
CCJBrowseButton |
CCJBrowseEdit |
CCJCaption |
CCJCaptionButton |
CCJCaptionPopupWnd |
CCJCBarButton |
CCJColorPicker |
CCJColorPopup |
CCJComboBoxEx |
CCJControlBar |
CCJDateEdit |
CCJDateTimeCtrl |
CCJDockBar |
CCJDockContext |
CCJExplorerBar |
CCJFlatButton |
CCJFlatComboBox |
CCJFlatHeaderCtrl |
CCJFlatSplitterWnd |
CCJFlatTabCtrl |
CCJFontCombo |
CCJFrameWnd |
CCJHexEdit |
CCJHtmlView |
CCJHyperLink |
CCJListBox |
CCJListCtrl |
CCJListView |
CCJLogoPane |
CCJMaskEdit |
CCJMDIChildWnd |
CCJMDIFrameWnd |
CCJMemFile |
CCJMenu |
CCJMenuBar |
CCJMenuBarFrameHook |
CCJMenuData |
CCJMetaFileButton |
CCJMiniDockFrameWnd |
CCJMonthCalCtrl |
CCJOutlookBar |
CCJPagerCtrl |
CCJReBar |
CCJReBarCtrl |
CCJShellTree |
CCJSizeDockBar |
CCJSortClass |
CCJSortClass::CSortItem |
CCJStatusBar |
CCJStatusBarPane |
CCJStatusBarPaneControlInfo |
CCJTabCtrl |
CCJTabCtrlBar |
CCJTabView |
CCJTimeEdit |
CCJToolBar |
CCJToolBarBase |
CCJToolBarCtrl |
CCJToolCmdUI |
CCJTreeCtrl |
CCJTreeCtrl::Color_Font |
CCJWindowPlacement |
cmd |
UCmdTarget |
CCmdUI |
UCmdUI |
UCOLOR |
UColor | Portable color definition
CColorConsole |
CColorStatic |
CComboBox |
CComboBoxEx |
CComCoClass |
commit_info |
CComModule |
CComObjectRootEx |
config_s |
CContentItems |
context |
CControlBar |
ct_data_s |
CCtrlView |
CCustInvertTable |
CCustomizeMenus |
CCVS_CoworkerModule |
cvs_MD5Context |
UCvsApp |
UCvsConsole |
CCvsConsole |
UCvsFiles |
UCvsFolders |
UCvsFrame |
UCvsGraph |
UCvsMenubar |
CCvsStatusBar |
CCvsThreadLock |
UCvsToolbar |
datelist |
UDC |
deltatext |
CDestroyThreadLock |
CDialog |
diff3_block |
diff_block |
diff_callbacks |
dirdata |
direct |
dirent |
CDockBar |
CDockContext |
CDocument |
DROPDOWNBUTTON |
CDummyClass |
DYN_LIST |
CEdit |
UEditMessage |
ENTNODE |
entnode |
EntnodeData |
EntnodeFile |
EntnodeFolder |
EntnodePath |
equivclass |
err_strs |
error_info |
EXHCB |
CExploreBar |
fatdef |
fchdef |
file_data |
file_info |
file_list_str |
FileEntry |
CFillPyEntries |
CFillTclEntries |
CFindSettings |
fjndef |
CFormView |
frame_and_entries |
frame_and_file |
CFrameWnd |
garbyRec |
CGfxGroupEdit |
CGfxOutBarCtrl |
CGfxOutBarCtrl::CBarFolder |
CGfxOutBarCtrl::CBarItem |
CGfxSplitterWnd |
GPT_CONSOLE |
GPT_GETENV |
GPT_QUIT |
CGraphConsole |
CGraphDoc |
CGraphFrame |
CGraphRectTracker |
CGraphView |
group |
gusilsh_ctx |
gz_stream |
hardlink_info |
CHARFORMAT |
CHeaderCtrl |
CHistComboBoxEx |
HQXDecodeVars |
HQXEncodeVars |
hrec |
ICvsCoworker |
ImportReport |
inflate_blocks_state |
inflate_codes_state |
inflate_huft_s |
internal_state |
IOSB |
irciiAttrCvt |
ISupportErrorInfo |
CJX_COLORMAP |
CJX_CONTROLPOS |
CKeyString |
KiColumn |
KiColumnModel |
KiFilterModel |
KiIgnoreModel |
KiRecursionModel |
KiSelectionHandler |
KoAddBinaryHandler |
KoAddHandler |
KoAnnotateHandler |
KoBranchTagHandler |
KoColumnContext |
KoCommitHandler |
KoConflictColumn |
KoCreateTagHandler |
KoDateColumn |
KoDeleteTagHandler |
KoDiffHandler |
KoEditHandler |
KoEditorsHandler |
KoFileRemoveHandler |
KoFilterModel |
KoGraphHandler |
KoIgnoreModel |
KoLockHandler |
KoLogHandler |
KoMoveToTrashHandler |
KoNameColumn |
KoOptionColumn |
KoPathColumn |
KoQueryUpdateHandler |
KoRecursionModel |
KoRecursiveModel |
KoRegularModel |
KoReleaseHandler |
KoRevisionColumn |
KoStatusColumn |
KoStatusHandler |
KoTagColumn |
KoTraversalContext |
KoUneditHandler |
KoUnlockHandler |
KoUpdateHandler |
KoUpdateMoveToTrashHandler |
KoWatcher |
KoWatchersHandler |
KoWatchOffHandler |
KoWatchOnHandler |
LAttachment |
LBevelButton |
LCommander |
linevector |
list |
list3 |
ULIST_INFO |
ULIST_INSERT |
CListBox |
CListCtrl |
CListView |
LListener |
LMainPseudoAttachment |
LOCK |
lock |
log_data |
log_data_and_rcs |
logfile_info |
CLogFrame |
CLogNode |
CLogNodeBranch |
CLogNodeData |
CLogNodeHeader |
CLogNodeRev |
CLogNodeTag |
CLogoutThread |
CLogStr |
LOutlineItem |
LOutlineTable |
LPane |
LPeriodical |
LPlaceHolder |
LPseudoDrawAttachment |
LPseudoWinAttachment |
LV_COLUMN |
UMacAppMenu |
CMacBinItem |
MACBINMAP |
MACBINMAPENTRIES |
MacBinMaps |
CMacBinTable |
CMacroEntry |
CMacroSet |
MacroTraversal |
CMainFrame |
CMapPtrToPtr |
master_lists |
CMDIChildWnd |
CMDIFrameWnd |
CMemFile |
CMenu |
UMenu |
CMenuItemInfo |
UMessageMapFunctions |
CMiniDockFrameWnd |
mircAttrCvt |
CMMenuString |
CMPString |
CMsg |
msg |
UMSGMAP |
UMSGMAP_ENTRY |
CMString |
MultiFiles |
MultiFilesEntry |
CMyShellTree |
node |
CNoPython |
NotificationManager |
NotificationManager::Node |
CObject |
UObject |
ColorTableEntry |
option |
option_revlist |
COptionalPropertySheet |
OUTBAR_INFO |
partition |
passwd |
PCPStr |
PCStr |
UPen |
CPersistent |
CPersistent::CPersistentEntry |
CPersistentBool |
CPersistentInt |
CPersistentT< T > |
pid_list |
PIPE |
PMacBinMaps |
UPoint |
UPOINT |
poolRec |
UPPMenu |
CProgress |
CProgressDialog |
UPromptMessage |
CPropertySheet |
CPseudoButton |
UPseudoCmdStatusWrapper |
CPseudoDlg |
CPseudoDraw |
UPseudoFakePane |
CPseudoItem |
CPseudoList |
UPseudoPageHider |
UPseudoPlaceHolder |
CPseudoRotButton |
UPseudoRotButton |
CPseudoToggle |
UPStr | Up to 255 characters pascal and C string
PyAutoObject< T > |
PyCmdUI |
PyCmdUI::obj_t |
PyColorConsole |
PyColorConsole::obj_t |
PyContainer |
CPyCvsConsole |
PyCvsEntry |
PyCvsEntry::obj_t |
PyMenuMgr |
PyMenuMgr::obj_t |
PyPersistent |
PyPersistent::obj_t |
PyRegistry |
CPython_Interp |
CPyThreadState |
rcsbuffer |
CRcsFile |
rcsnode |
rcsversnode |
re_pattern_buffer |
re_registers |
URECT |
URect |
CRectTracker |
recursion_frame |
CRecursionLock |
regexp_list |
regmatch_t |
RemoveCvsArgs |
ReportConflict |
ReportWarning |
request |
response |
CRevFile |
CRevisionConsole |
revlist |
CRevNumber |
CRichEditView |
URuntimeClass |
S_Dir |
S_NAME |
saved_cwd |
USaveSettings |
CScrollView |
USemaphore |
SIG_hlist |
USIZE |
USize |
USLIDER |
CSortHeaderCtrl |
CSortList< T > |
CSortParam |
sortrec |
CSplashWnd |
CSplitterWnd |
CStackThreadLock |
CStatic |
static_tree_desc_s |
CStaticAllocT< T > |
CStatusBar |
stickydirtag |
UStr | C string class
CStreamConsole |
CSubclassWnd |
CSubclassWndMap |
CTabCtrl |
TAdorner |
tag_info |
tagAFX_OLDTOOLINFO |
tagCTV_ITEM |
tagMENUITEMINFOA |
tagTCB_ITEM |
UTB_BUTTON |
UTB_DROPDOWN |
UTB_INIT |
CTbEdit |
TBehavior |
TbEntry |
TbEntryButton |
TbEntryChkButton |
TbEntryDropDown |
TbEntrySeparator |
TBrowserFill |
TBrowserFillDummy |
TBuggyPopup |
CTcl_Interp |
CTCLBrowserEnt |
CTCLCvsConsole |
CTCP2Parse |
CTCP2Parse::RGBColor |
TEditText |
CTempToggleBool |
TGraph |
TGraphCmdStatus |
TGraphDelCmd |
TGraphRectSelect |
TGraphSelNonSig |
TIconButton |
TIconCheckBox |
TIconPopup |
timeb |
UTimer | Used by the UWidget class to implement timers/repeaters
CTipDlg |
TMPersistent< T > |
CTmpFiles |
TMString< T > |
UToolbar |
CToolbarCombo |
CToolBarCtrl |
CToolBarData |
TOOLBARINFO |
TPopup |
TPseudoAppBehavior |
TPseudoCustomView |
TPseudoDoubleNumberText |
TPseudoIconButton |
TPseudoIconCheckBox |
TPseudoIconPopup |
TPseudoRotateIconButton |
TPseudoScrollBar |
TPseudoTextListView |
TPseudoWinAdorner |
TPseudoWinBehavior |
TraversalReport |
tree_desc_s |
UTREE_INFO |
UTREE_INSERT |
CTreeCtrl |
CTreeView |
TScrollBar |
TTextListView |
CTurnOffDispatching |
TView |
TViewFill |
unreaped |
unrecog |
CustInvertTable |
utimbuf |
vector |
vers_ts |
CView |
CViewInfo |
VMS_DIR |
VMStimbuf |
CvsArgs |
CvsCoworker |
CvsFilenames |
CvsPrefs |
CvsProcessCallbacks |
CvsProject |
CvsString |
CvsTrace |
Vstring |
UWaitCursor |
UWidget | This is the pseudo widget class. The pseudo widget class allows to access mapped widgets (using the event EV_INIT_WIDGET) and to manipulate them (i.e. set the caption, visible state...). By derivating this class, you can also take advantage of features like modaling dialogs, timers..
Win32wstring |
CWinApp |
CWincvsApp |
CWinCvsBrowser |
CWinCvsBrowser::CSelectionChangeNotifier |
CWincvsDoc |
CWincvsView |
WINDOWPLACEMENT |
WININFO |
CWinLogBranchData |
CWinLogData |
CWinLogHeaderData |
CWinLogRevData |
CWinLogTagData |
CWinPlacement |
CWinThread |
CWnd |
CWndRedrawMngr | CWndRedrawManager supports efficient drawing of CWnd based windows,
wnt_stat |
WrapperEntry |
wstring |
yy_buffer_state |
yystack |
YYSTYPE |
yytoktype |
z_stream_s |
Generated on Sun Oct 21 12:45:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_afxRichEditCookie Class Reference

Collaboration diagram for _afxRichEditCookie:

[legend]
List of all members.

Public Methods

_afxRichEditCookie (CArchive &ar)

Public Attributes

CArchive & | m_ar
DWORD | m_dwError

Constructor & Destructor Documentation

_afxRichEditCookie::_afxRichEditCookie ( CArchive & ar ) [inline]

Definition at line 152 of file wincvsDoc.cpp.

00152 : m_ar(ar) {m_dwError=0;}

Member Data Documentation

CArchive& _afxRichEditCookie::m_ar

Definition at line 150 of file wincvsDoc.cpp.

Referenced by EditStreamCallBack().

DWORD _afxRichEditCookie::m_dwError

Definition at line 151 of file wincvsDoc.cpp.

Referenced by EditStreamCallBack().

The documentation for this class was generated from the following file:
  • WinCvs/wincvsDoc.cpp
Generated on Sun Oct 21 12:45:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_CvsProcess Struct Reference

#include <cvsgui_process.h>

Collaboration diagram for _CvsProcess:

[legend]
List of all members.

Public Attributes

unsigned int | open: 1
unsigned int | destroy: 1
pid_t | pid
char ** | args
int | argc
pipe_t my_read
pipe_t my_write
pipe_t his_read
pipe_t his_write
pipe_t pstdin
pipe_t pstdout
pipe_t pstderr
char | write_buffer [512]
int | write_buffer_index
CvsProcessCallbacks * callbacks

Member Data Documentation

int _CvsProcess::argc

Definition at line 51 of file cvsgui_process.h.

Referenced by cvs_process_destroy(), cvs_process_new(), and cvs_process_open().

char** _CvsProcess::args

Definition at line 50 of file cvsgui_process.h.

Referenced by cvs_process_destroy(), cvs_process_new(), and cvs_process_open().

CvsProcessCallbacks* _CvsProcess::callbacks

Definition at line 59 of file cvsgui_process.h.

Referenced by cvs_process_handle_message(), cvs_process_new(), and cvs_process_open().

unsigned int _CvsProcess::destroy

Definition at line 45 of file cvsgui_process.h.

Referenced by cvs_process_destroy(), and cvs_process_new().

pipe_t _CvsProcess::his_read

Definition at line 54 of file cvsgui_process.h.

Referenced by cvs_process_close(), cvs_process_new(), and cvs_process_open().

pipe_t _CvsProcess::his_write

Definition at line 54 of file cvsgui_process.h.

Referenced by cvs_process_close(), cvs_process_new(), and cvs_process_open().

pipe_t _CvsProcess::my_read

Definition at line 53 of file cvsgui_process.h.

Referenced by cvs_process_close(), cvs_process_new(), cvs_process_open(), and cvs_process_recv_message().

pipe_t _CvsProcess::my_write

Definition at line 53 of file cvsgui_process.h.

Referenced by cvs_process_close(), cvs_process_handle_message(), cvs_process_new(), and cvs_process_open().

unsigned int _CvsProcess::open

Definition at line 44 of file cvsgui_process.h.

Referenced by cvs_process_close(), cvs_process_new(), cvs_process_open(), and cvs_process_recv_message().

pid_t _CvsProcess::pid

Definition at line 49 of file cvsgui_process.h.

Referenced by cvs_process_close(), cvs_process_new(), and cvs_process_open().

pipe_t _CvsProcess::pstderr

Definition at line 55 of file cvsgui_process.h.

Referenced by cvs_process_close(), cvs_process_new(), and cvs_process_open().

pipe_t _CvsProcess::pstdin

Definition at line 55 of file cvsgui_process.h.

Referenced by cvs_process_close(), cvs_process_new(), and cvs_process_open().

pipe_t _CvsProcess::pstdout

Definition at line 55 of file cvsgui_process.h.

Referenced by cvs_process_close(), cvs_process_new(), and cvs_process_open().

char _CvsProcess::write_buffer[ 512 ]

Definition at line 57 of file cvsgui_process.h.

Referenced by cvs_process_pop(), and cvs_process_push().

int _CvsProcess::write_buffer_index

Definition at line 58 of file cvsgui_process.h.

Referenced by cvs_process_new(), cvs_process_pop(), and cvs_process_push().

The documentation for this struct was generated from the following file:
  • common/cvsgui_process.h
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_dircontents Struct Reference

#include <ndir.h>

Collaboration diagram for _dircontents:

[legend]
List of all members.

Public Attributes

char * | _d_entry
_dircontents * | _d_next
char * | _d_entry
_dircontents * | _d_next

Member Data Documentation

char* _dircontents::_d_entry

Definition at line 49 of file ndir.h.

char* _dircontents::_d_entry

Definition at line 38 of file ndir.h.

Referenced by free_dircontents(), and opendir().

struct _dircontents* _dircontents::_d_next

Definition at line 50 of file ndir.h.

struct _dircontents* _dircontents::_d_next

Definition at line 39 of file ndir.h.

Referenced by opendir(), and seekdir().

The documentation for this struct was generated from the following files:
  • cvs-1.10/windows-NT/ndir.h
  • WinCvs/ndir.h
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_dirdesc Struct Reference

#include <ndir.h>

Collaboration diagram for _dirdesc:

[legend]
List of all members.

Public Attributes

int | dd_id
long | dd_loc
_dircontents * dd_contents
_dircontents * dd_cp
_dircontents * dd_contents
_dircontents * dd_cp

Member Data Documentation

struct _dircontents* _dirdesc::dd_contents

Definition at line 57 of file ndir.h.

struct _dircontents* _dirdesc::dd_contents

Definition at line 46 of file ndir.h.

Referenced by closedir(), and seekdir().

struct _dircontents* _dirdesc::dd_cp

Definition at line 58 of file ndir.h.

struct _dircontents* _dirdesc::dd_cp

Definition at line 47 of file ndir.h.

Referenced by seekdir().

int _dirdesc::dd_id

Definition at line 55 of file ndir.h.

long _dirdesc::dd_loc

Definition at line 56 of file ndir.h.

Referenced by seekdir(), and telldir().

The documentation for this struct was generated from the following files:
  • cvs-1.10/windows-NT/ndir.h
  • WinCvs/ndir.h
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_frameRec Struct Reference

Collaboration diagram for _frameRec:

[legend]
List of all members.

Public Attributes

void * | entry
_frameRec * | next

Member Data Documentation

void* _frameRec::entry

Definition at line 267 of file dll_garbage.c.

struct _frameRec* _frameRec::next

Definition at line 272 of file dll_garbage.c.

The documentation for this struct was generated from the following file:
  • common/dll_garbage.c
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_IID Struct Reference

Collaboration diagram for _IID:

[legend]
List of all members.

Public Attributes

unsigned long | x
unsigned short | s1
unsigned short | s2
unsigned char | c [8]

Member Data Documentation

unsigned char _IID::c[8]

Definition at line 28 of file CVS_Coworker_i.c.

unsigned short _IID::s1

Definition at line 26 of file CVS_Coworker_i.c.

unsigned short _IID::s2

Definition at line 27 of file CVS_Coworker_i.c.

unsigned long _IID::x

Definition at line 25 of file CVS_Coworker_i.c.

The documentation for this struct was generated from the following file:
  • WinCvs/CoWorker/CVS_Coworker_i.c
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_linkname Struct Reference

#include <dir.h>

Collaboration diagram for _linkname:

[legend]
List of all members.

Public Attributes

char b_flags dir__b_flags
dir_b_flags 		t_linkname []

Member Data Documentation

char b_flags dir__b_flags dir_b_flags _linkname::t_linkname[]

Definition at line 90 of file dir.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/dir.h
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_MIDL_PROC_FORMAT_STRING Struct Reference

Collaboration diagram for _MIDL_PROC_FORMAT_STRING:

[legend]
List of all members.

Public Attributes

short | Pad
unsigned char | Format [151]

Member Data Documentation

unsigned char _MIDL_PROC_FORMAT_STRING::Format[ 151 ]

Definition at line 40 of file CVS_Coworker_p.c.

Referenced by ICvsCoworker_AddFiles_Proxy(), ICvsCoworker_AddFiles_Stub(), ICvsCoworker_CheckinFiles_Proxy(), ICvsCoworker_CheckinFiles_Stub(), ICvsCoworker_CheckoutFiles_Proxy(), ICvsCoworker_CheckoutFiles_Stub(), ICvsCoworker_CloseProject_Proxy(), ICvsCoworker_CloseProject_Stub(), ICvsCoworker_DiffFile_Proxy(), ICvsCoworker_DiffFile_Stub(), ICvsCoworker_GetErrorMessage_Proxy(), ICvsCoworker_GetErrorMessage_Stub(), ICvsCoworker_GetFileChanges_Proxy(), ICvsCoworker_GetFileChanges_Stub(), ICvsCoworker_GetFilesToAdd_Proxy(), ICvsCoworker_GetFilesToAdd_Stub(), ICvsCoworker_GetLastError_Proxy(), ICvsCoworker_GetLastError_Stub(), ICvsCoworker_GetProject_Proxy(), ICvsCoworker_GetProject_Stub(), ICvsCoworker_HasAdvancedOptionsForCommand_Proxy(), ICvsCoworker_HasAdvancedOptionsForCommand_Stub(), ICvsCoworker_OpenProject_Proxy(), ICvsCoworker_OpenProject_Stub(), ICvsCoworker_RemoveFiles_Proxy(), ICvsCoworker_RemoveFiles_Stub(), ICvsCoworker_RenameFile_Proxy(), ICvsCoworker_RenameFile_Stub(), ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy(), ICvsCoworker_ShowAdvancedOptionsForCommand_Stub(), ICvsCoworker_ShowFileHistory_Proxy(), ICvsCoworker_ShowFileHistory_Stub(), ICvsCoworker_ShowFileProperties_Proxy(), ICvsCoworker_ShowFileProperties_Stub(), ICvsCoworker_ShowUserInterface_Proxy(), ICvsCoworker_ShowUserInterface_Stub(), ICvsCoworker_UncheckoutFiles_Proxy(), ICvsCoworker_UncheckoutFiles_Stub(), ICvsCoworker_UpdateFiles_Proxy(), and ICvsCoworker_UpdateFiles_Stub().

short _MIDL_PROC_FORMAT_STRING::Pad

Definition at line 39 of file CVS_Coworker_p.c.

The documentation for this struct was generated from the following file:
  • WinCvs/CoWorker/CVS_Coworker_p.c
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_MIDL_TYPE_FORMAT_STRING Struct Reference

Collaboration diagram for _MIDL_TYPE_FORMAT_STRING:

[legend]
List of all members.

Public Attributes

short | Pad
unsigned char | Format [65]

Member Data Documentation

unsigned char _MIDL_TYPE_FORMAT_STRING::Format[ 65 ]

Definition at line 34 of file CVS_Coworker_p.c.

Referenced by ICvsCoworker_AddFiles_Proxy(), ICvsCoworker_AddFiles_Stub(), ICvsCoworker_CheckinFiles_Proxy(), ICvsCoworker_CheckinFiles_Stub(), ICvsCoworker_CheckoutFiles_Proxy(), ICvsCoworker_CheckoutFiles_Stub(), ICvsCoworker_DiffFile_Proxy(), ICvsCoworker_DiffFile_Stub(), ICvsCoworker_GetErrorMessage_Proxy(), ICvsCoworker_GetErrorMessage_Stub(), ICvsCoworker_GetFileChanges_Proxy(), ICvsCoworker_GetFileChanges_Stub(), ICvsCoworker_GetFilesToAdd_Proxy(), ICvsCoworker_GetFilesToAdd_Stub(), ICvsCoworker_GetLastError_Proxy(), ICvsCoworker_GetProject_Proxy(), ICvsCoworker_GetProject_Stub(), ICvsCoworker_HasAdvancedOptionsForCommand_Proxy(), ICvsCoworker_OpenProject_Proxy(), ICvsCoworker_OpenProject_Stub(), ICvsCoworker_RemoveFiles_Proxy(), ICvsCoworker_RemoveFiles_Stub(), ICvsCoworker_RenameFile_Proxy(), ICvsCoworker_RenameFile_Stub(), ICvsCoworker_ShowFileHistory_Proxy(), ICvsCoworker_ShowFileHistory_Stub(), ICvsCoworker_ShowFileProperties_Proxy(), ICvsCoworker_ShowFileProperties_Stub(), ICvsCoworker_ShowUserInterface_Proxy(), ICvsCoworker_ShowUserInterface_Stub(), ICvsCoworker_UncheckoutFiles_Proxy(), ICvsCoworker_UncheckoutFiles_Stub(), ICvsCoworker_UpdateFiles_Proxy(), ICvsCoworker_UpdateFiles_Stub(), and Object_StubDesc().

short _MIDL_TYPE_FORMAT_STRING::Pad

Definition at line 33 of file CVS_Coworker_p.c.

The documentation for this struct was generated from the following file:
  • WinCvs/CoWorker/CVS_Coworker_p.c
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_name Struct Reference

#include <dir.h>

Collaboration diagram for _name:

[legend]
List of all members.

Public Attributes

short dir | w_verlimit
_name:: { ... } | dir__b_flags
unsigned char b_flags dir__b_flags
dir_b_flags 		b_namecount
char b_flags dir__b_flags
dir_b_flags 		t_name []
unsigned char | dir_b_flags
unsigned char | dir_v_type: $C_FID 0 $S_TYPE
unsigned | char: 3
unsigned char | dir_v_nextrec: 1
unsigned char | dir_v_prevrec: 1
_name:: { ... } ::@39 | dir___b_flags

Member Data Documentation

unsigned char b_flags dir__b_flags dir_b_flags _name::b_namecount

Definition at line 68 of file dir.h.

unsigned _name::char

Definition at line 61 of file dir.h.

struct { ... } _name::dir___b_flags

union { ... } _name::dir__b_flags

unsigned char _name::dir_b_flags

Definition at line 56 of file dir.h.

unsigned char _name::dir_v_nextrec

Definition at line 62 of file dir.h.

unsigned char _name::dir_v_prevrec

Definition at line 64 of file dir.h.

unsigned char _name::dir_v_type

Definition at line 59 of file dir.h.

char b_flags dir__b_flags dir_b_flags _name::t_name[]

Definition at line 69 of file dir.h.

short dir _name::w_verlimit

Definition at line 54 of file dir.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/dir.h
Generated on Sun Oct 21 12:45:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_SUBIO Struct Reference

Collaboration diagram for _SUBIO:

[legend]
List of all members.

Public Attributes

_SUBIO * | self
_SUBIO * | prev
_SUBIO * | next
short | read_chan
short | write_chan
FILE * | read_fp
FILE * | write_fp
IOSB read_iosb
IOSB write_iosb
int | pid
int | return_status
unsigned long | event_flag
unsigned char | event_flag_byte

Member Data Documentation

unsigned long _SUBIO::event_flag

Definition at line 44 of file piped_child.c.

unsigned char _SUBIO::event_flag_byte

Definition at line 45 of file piped_child.c.

struct _SUBIO* _SUBIO::next

Definition at line 35 of file piped_child.c.

int _SUBIO::pid

Definition at line 42 of file piped_child.c.

struct _SUBIO* _SUBIO::prev

Definition at line 34 of file piped_child.c.

short _SUBIO::read_chan

Definition at line 36 of file piped_child.c.

FILE* _SUBIO::read_fp

Definition at line 38 of file piped_child.c.

struct IOSB _SUBIO::read_iosb

Definition at line 40 of file piped_child.c.

int _SUBIO::return_status

Definition at line 43 of file piped_child.c.

struct _SUBIO* _SUBIO::self

Definition at line 33 of file piped_child.c.

short _SUBIO::write_chan

Definition at line 37 of file piped_child.c.

FILE* _SUBIO::write_fp

Definition at line 39 of file piped_child.c.

struct IOSB _SUBIO::write_iosb

Definition at line 41 of file piped_child.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/piped_child.c
Generated on Sun Oct 21 12:45:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_TABLE Struct Reference

Collaboration diagram for _TABLE:

[legend]
List of all members.

Public Attributes

char * | name
int | type
time_t | value
char * | name

Member Data Documentation

char* _TABLE::name

Definition at line 97 of file getdate.c.

char* _TABLE::name

Definition at line 157 of file getdate.c.

Referenced by LookupWord().

int _TABLE::type

Definition at line 98 of file getdate.c.

Referenced by LookupWord().

time_t _TABLE::value

Definition at line 99 of file getdate.c.

Referenced by LookupWord().

The documentation for this struct was generated from the following files:
  • cvs-1.10/lib/getdate.c
  • cvs-1.10/os2/getdate.c
Generated on Sun Oct 21 12:45:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_version Struct Reference

#include <dir.h>

Collaboration diagram for _version:

[legend]
List of all members.

Public Attributes

short b_flags dir__b_flags
dir_b_flags 		w_version
short b_flags dir__b_flags
dir_b_flags 		w_fid_num
short b_flags dir__b_flags
dir_b_flags 		w_fid_seq
_version:: { ... } | dir__w_fid_rvn
short | dir_w_fid_rvn
char | dir_b_fid_rvn
char | dir_b_fid_nmx
_version:: { ... } ::@41 | dir___w_fid_rvn

Member Data Documentation

struct { ... } _version::dir___w_fid_rvn

union { ... } _version::dir__w_fid_rvn

char _version::dir_b_fid_nmx

Definition at line 82 of file dir.h.

char _version::dir_b_fid_rvn

Definition at line 80 of file dir.h.

short _version::dir_w_fid_rvn

Definition at line 77 of file dir.h.

short b_flags dir__b_flags dir_b_flags _version::w_fid_num

Definition at line 74 of file dir.h.

short b_flags dir__b_flags dir_b_flags _version::w_fid_seq

Definition at line 75 of file dir.h.

short b_flags dir__b_flags dir_b_flags _version::w_version

Definition at line 73 of file dir.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/dir.h
Generated on Sun Oct 21 12:45:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_WireHandler Struct Reference

Collaboration diagram for _WireHandler:

[legend]
List of all members.

Public Attributes

guint32 type
WireReadFunc read_func
WireWriteFunc write_func
WireDestroyFunc destroy_func

Member Data Documentation

WireDestroyFunc _WireHandler::destroy_func

Definition at line 74 of file cvsgui_wire.cpp.

Referenced by wire_destroy(), and wire_register().

WireReadFunc _WireHandler::read_func

Definition at line 72 of file cvsgui_wire.cpp.

Referenced by wire_read_msg(), and wire_register().

guint32 _WireHandler::type

Definition at line 71 of file cvsgui_wire.cpp.

Referenced by wire_register().

WireWriteFunc _WireHandler::write_func

Definition at line 73 of file cvsgui_wire.cpp.

Referenced by wire_register(), and wire_write_msg().

The documentation for this struct was generated from the following file:
  • common/cvsgui_wire.cpp
Generated on Sun Oct 21 12:45:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


_WireMessage Struct Reference

#include <cvsgui_wire.h>

Collaboration diagram for _WireMessage:

[legend]
List of all members.

Public Attributes

guint32 type
gpointer data

Member Data Documentation

gpointer _WireMessage::data

Definition at line 91 of file cvsgui_wire.h.

Referenced by _gp_console_destroy(), _gp_console_read(), _gp_console_write(), _gp_getenv_destroy(), _gp_getenv_read(), _gp_getenv_write(), _gp_quit_destroy(), _gp_quit_read(), _gp_quit_write(), cvs_process_handle_message(), gp_console_write(), gp_getenv_read(), gp_getenv_write(), and gp_quit_write().

guint32 _WireMessage::type

Definition at line 90 of file cvsgui_wire.h.

Referenced by cvs_process_handle_message(), gp_console_write(), gp_getenv_read(), gp_getenv_write(), gp_quit_write(), wire_destroy(), wire_read_msg(), and wire_write_msg().

The documentation for this struct was generated from the following file:
  • common/cvsgui_wire.h
Generated on Sun Oct 21 12:45:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CAboutDlg Class Reference

Inheritance diagram for CAboutDlg:

[legend]
Collaboration diagram for CAboutDlg:

[legend]
List of all members.

Public Types

enum | { IDD = 100 }

Public Methods

CAboutDlg ()

Public Attributes

CString | m_vers
CCJHyperLink m_url

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()

Member Enumeration Documentation

anonymous enum

Enumeration values:
IDD

Definition at line 638 of file wincvs.cpp.

00638 { IDD = IDD_ABOUTBOX };

Constructor & Destructor Documentation

CAboutDlg::CAboutDlg ( )

Definition at line 657 of file wincvs.cpp.

00657                      : CDialog(CAboutDlg::IDD)
00658 {
00659     //{{AFX_DATA_INIT(CAboutDlg)
00660     m_vers = _T("WinCvs ");
00661     //}}AFX_DATA_INIT
00662
00663     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00664     CStr vers;
00665
00666     if(app->GetAppVersion(vers))
00667     {
00668         m_vers = vers;
00669     }
00670 }

Member Function Documentation

void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 682 of file wincvs.cpp.

00683 {
00684     CDialog::DoDataExchange(pDX);
00685     //{{AFX_DATA_MAP(CAboutDlg)
00686     DDX_Control(pDX, IDC_WINCVSURL, m_url);
00687     DDX_Text(pDX, IDC_WINCVSVER, m_vers);
00688     //}}AFX_DATA_MAP
00689 }

BOOL CAboutDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 672 of file wincvs.cpp.

00673 {
00674     CDialog::OnInitDialog();
00675
00676     m_url.SetURL(_T("http://www.cvsgui.org"));
00677
00678     return TRUE;  // return TRUE unless you set the focus to a control
00679                   // EXCEPTION: OCX Property Pages should return FALSE
00680 }

Member Data Documentation

CCJHyperLink CAboutDlg::m_url

Definition at line 640 of file wincvs.cpp.

CString CAboutDlg::m_vers

Definition at line 639 of file wincvs.cpp.

The documentation for this class was generated from the following file:
  • WinCvs/wincvs.cpp
Generated on Sun Oct 21 12:45:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AddBinCvsArgs Class Reference

Inheritance diagram for AddBinCvsArgs:

[legend]
Collaboration diagram for AddBinCvsArgs:

[legend]
List of all members.

Public Methods

AddBinCvsArgs ()
virtual void | addfile (const char *arg, const char *dir=0L, const FSSpec *spec=0L)
bool | HasProblem (void)

Protected Attributes

bool | gotProblem

Constructor & Destructor Documentation

AddBinCvsArgs::AddBinCvsArgs ( ) [inline]

Definition at line 1151 of file CvsCommands.cpp.

01151 : gotProblem(false) {}

Member Function Documentation

bool AddBinCvsArgs::HasProblem ( void ) [inline]

Definition at line 1156 of file CvsCommands.cpp.

Referenced by CvsCmdAddBinaryFiles().

01156 {return gotProblem;}

void AddBinCvsArgs::addfile | ( | const char * | arg,
 |  | const char * | dir = 0L,
 |  | const FSSpec * | spec = 0L
 | ) | [virtual]

Reimplemented from CvsArgs.

Definition at line 1161 of file CvsCommands.cpp.

01162 {
01163     CvsArgs::addfile(arg, dir, spec);
01164
01165     if(!gCvsPrefs.AddControl())
01166         return;
01167
01168 #ifdef macintosh
01169     // here a bug of MSL : it refuses to open a file beginning by
01170     // ".". So we skip this file out of the test and warn the user.
01171     if(arg[0] == '.')
01172     {
01173         cvs_out("Warning : \'%s\' cannot be verified due to a bug in MW MSL, please\n", arg);
01174         cvs_out("          verify manually \'%s\' *is not* a TEXT file\n", arg);
01175         return;
01176     }
01177 #endif
01178
01179     kTextBinTYPE state = FileIsBinary(arg, dir, spec);
01180
01181     switch(state)
01182     {
01183         case kFileIsOK:
01184             break;
01185         case kFileMissing:
01186             // we can resurect a file which is missing by re-adding it
01187             break;
01188         case kFileIsAlias:
01189             cvs_err("Warning : \'%s\' is an alias\n", arg);
01190             gotProblem = true;
01191             break;
01192         case kFileInvalidName:
01193             cvs_err("Warning : \'%s\' has an invalid name\n", arg);
01194             gotProblem = true;
01195             break;
01196         case kBinIsText:
01197             cvs_err("Warning : \'%s\' seems to be a text file, you should correct it first\n", arg);
01198             gotProblem = true;
01199             break;
01200         case kBinWrongSig:
01201             cvs_err("Warning : \'%s\' has a file type of \'TEXT\', you should correct it first\n", arg);
01202             gotProblem = true;
01203             break;
01204         default:
01205             cvs_err("Warning : \'%s\' has some unknown problems\n", arg);
01206             gotProblem = true;
01207             break;
01208     }
01209 }

Member Data Documentation

bool AddBinCvsArgs::gotProblem [protected]

Definition at line 1158 of file CvsCommands.cpp.

The documentation for this class was generated from the following file:
  • common/CvsCommands.cpp
Generated on Sun Oct 21 12:45:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AddCvsArgs Class Reference

Inheritance diagram for AddCvsArgs:

[legend]
Collaboration diagram for AddCvsArgs:

[legend]
List of all members.

Public Methods

AddCvsArgs ()
virtual void | addfile (const char *arg, const char *dir=0L, const FSSpec *spec=0L)
bool | HasProblem (void)

Protected Attributes

bool | gotProblem

Constructor & Destructor Documentation

AddCvsArgs::AddCvsArgs ( ) [inline]

Definition at line 1044 of file CvsCommands.cpp.

01044 : gotProblem(false) {}

Member Function Documentation

bool AddCvsArgs::HasProblem ( void ) [inline]

Definition at line 1049 of file CvsCommands.cpp.

Referenced by CvsCmdAddFiles().

01049 {return gotProblem;}

void AddCvsArgs::addfile | ( | const char * | arg,
 |  | const char * | dir = 0L,
 |  | const FSSpec * | spec = 0L
 | ) | [virtual]

Reimplemented from CvsArgs.

Definition at line 1054 of file CvsCommands.cpp.

01055 {
01056     CvsArgs::addfile(arg, dir, spec);
01057
01058     if(!gCvsPrefs.AddControl())
01059         return;
01060
01061 #ifdef macintosh
01062     // here a bug of MSL : it refuses to open a file beginning by
01063     // ".". So we skip this file out of the test and warn the user.
01064     if(arg[0] == '.')
01065     {
01066         cvs_out("Warning : \'%s\' cannot be verified due to a bug in MW MSL, please\n", arg);
01067         cvs_out("          verify manually \'%s\' *is* a TEXT file\n", arg);
01068         return;
01069     }
01070 #endif
01071
01072     kTextBinTYPE state = FileIsText(arg, dir, spec);
01073     switch(state)
01074     {
01075         case kFileIsOK:
01076             break;
01077         case kFileMissing:
01078             // we can resurect a file which is missing by re-adding it
01079             break;
01080         case kFileIsAlias:
01081             cvs_err("Warning : \'%s\' is an alias\n", arg);
01082             gotProblem = true;
01083             break;
01084         case kFileInvalidName:
01085             cvs_err("Warning : \'%s\' has an invalid name\n", arg);
01086             gotProblem = true;
01087             break;
01088         case kTextWrongLF:
01089             cvs_err("Warning : \'%s\' seems to have the wrong line feed for this machine, you should correct it first\n", arg);
01090             gotProblem = true;
01091             break;
01092         case kTextIsBinary:
01093             cvs_err("Warning : \'%s\' seems to be \'binary\', you should use the \'Add binary files...\' command instead...\n", arg);
01094             gotProblem = true;
01095             break;
01096         case kTextEscapeChar:
01097 #ifdef macintosh
01098             if(gCvsPrefs.IsoConvert() == ISO8559_none)
01099             {
01100                 cvs_err("Warning : \'%s\' has some escape characters in it (0x00-0x20, 0x80-0xFF),\n", arg);
01101                 cvs_err("Warning   so you may need to have the ISO8559 translation option set in the preferences\n");
01102                 cvs_err("Warning   before commiting\n");
01103             }
01104 #else /* !macintosh */
01105             cvs_err("Warning : \'%s\' has some escape characters in it (0x00-0x20, 0x80-0xFF), you should correct it first\n", arg);
01106 #endif /* !macintosh */
01107             break;
01108         case kTextWrongSig:
01109             cvs_err("Warning : \'%s\' has a file type different from \'TEXT\', you should correct it first\n", arg);
01110             gotProblem = true;
01111             break;
01112         default:
01113             cvs_err("Warning : \'%s\' has some unknown problems\n", arg);
01114             gotProblem = true;
01115             break;
01116     }
01117 }

Member Data Documentation

bool AddCvsArgs::gotProblem [protected]

Definition at line 1051 of file CvsCommands.cpp.

The documentation for this class was generated from the following file:
  • common/CvsCommands.cpp
Generated on Sun Oct 21 12:45:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


addremove_args Struct Reference

#include <watch.h>

Collaboration diagram for addremove_args:

[legend]
List of all members.

Public Attributes

int | edit
int | unedit
int | commit
int | adding
int | add_tedit
int | add_tunedit
int | add_tcommit
int | remove_temp
int | setting_default

Member Data Documentation

int addremove_args::add_tcommit

Definition at line 34 of file watch.h.

int addremove_args::add_tedit

Definition at line 30 of file watch.h.

int addremove_args::add_tunedit

Definition at line 32 of file watch.h.

int addremove_args::adding

Definition at line 27 of file watch.h.

int addremove_args::commit

Definition at line 23 of file watch.h.

int addremove_args::edit

Definition at line 21 of file watch.h.

int addremove_args::remove_temp

Definition at line 37 of file watch.h.

int addremove_args::setting_default

Definition at line 42 of file watch.h.

int addremove_args::unedit

Definition at line 22 of file watch.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/watch.h
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


admin_data Struct Reference

Collaboration diagram for admin_data:

[legend]
List of all members.

Public Attributes

char * | branch
char * | comment
int | set_strict
int | set_nonstrict
char * | delete_revs
char * | kflag
char * | desc
int | interactive
int | quiet
int | ac
char ** | av
int | av_alloc

Member Data Documentation

int admin_data::ac

Definition at line 109 of file admin.c.

char** admin_data::av

Definition at line 110 of file admin.c.

int admin_data::av_alloc

Definition at line 111 of file admin.c.

char* admin_data::branch

Definition at line 74 of file admin.c.

char* admin_data::comment

Definition at line 80 of file admin.c.

char* admin_data::delete_revs

Definition at line 89 of file admin.c.

char* admin_data::desc

Definition at line 95 of file admin.c.

int admin_data::interactive

Definition at line 98 of file admin.c.

char* admin_data::kflag

Definition at line 92 of file admin.c.

int admin_data::quiet

Definition at line 102 of file admin.c.

int admin_data::set_nonstrict

Definition at line 86 of file admin.c.

int admin_data::set_strict

Definition at line 83 of file admin.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/admin.c
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


admin_file Struct Reference

Collaboration diagram for admin_file:

[legend]
List of all members.

Public Attributes

char * | filename
char * | errormsg
const char *const * | contents

Member Data Documentation

const char* const* admin_file::contents

Definition at line 46 of file mkmodules.c.

char* admin_file::errormsg

Definition at line 34 of file mkmodules.c.

char* admin_file::filename

Definition at line 28 of file mkmodules.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/mkmodules.c
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AFX_DLLVERSIONINFO Struct Reference

Collaboration diagram for AFX_DLLVERSIONINFO:

[legend]
List of all members.

Public Attributes

DWORD | cbSize
DWORD | dwMajorVersion
DWORD | dwMinorVersion
DWORD | dwBuildNumber
DWORD | dwPlatformID

Member Data Documentation

DWORD AFX_DLLVERSIONINFO::cbSize

Definition at line 218 of file CJToolBar.cpp.

Referenced by _GetComCtlVersion().

DWORD AFX_DLLVERSIONINFO::dwBuildNumber

Definition at line 221 of file CJToolBar.cpp.

DWORD AFX_DLLVERSIONINFO::dwMajorVersion

Definition at line 219 of file CJToolBar.cpp.

Referenced by _GetComCtlVersion().

DWORD AFX_DLLVERSIONINFO::dwMinorVersion

Definition at line 220 of file CJToolBar.cpp.

Referenced by _GetComCtlVersion().

DWORD AFX_DLLVERSIONINFO::dwPlatformID

Definition at line 222 of file CJToolBar.cpp.

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/CJLibrary/CJToolBar.cpp
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CAllHandlers Struct Reference

Collaboration diagram for CAllHandlers:

[legend]
List of all members.

Public Methods

CAllHandlers ()
~CAllHandlers ()

Public Attributes

std::map< guint32, WireHandler *> wire_ht

Constructor & Destructor Documentation

CAllHandlers::CAllHandlers ( ) [inline]

Definition at line 85 of file cvsgui_wire.cpp.

00085 {}

CAllHandlers::~CAllHandlers ( ) [inline]

Definition at line 86 of file cvsgui_wire.cpp.

00087     {
00088         std::map<guint32, WireHandler *>::iterator i;
00089         for(i = wire_ht.begin(); i != wire_ht.end(); ++i)
00090         {
00091             WireHandler *handler = (*i).second;
00092             free(handler);
00093         }
00094     }

Member Data Documentation

std::map<guint32, WireHandler *> CAllHandlers::wire_ht

Definition at line 96 of file cvsgui_wire.cpp.

The documentation for this struct was generated from the following file:
  • common/cvsgui_wire.cpp
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CAllTargets Class Reference

Collaboration diagram for CAllTargets:

[legend]
List of all members.

Public Methods

CAllTargets ()
~CAllTargets ()
std::map< int, UCmdTarget *> & | Get (void)
const std::map< int, UCmdTarget *> & | Get (void) const

Protected Attributes

std::map< int, UCmdTarget *> | targets

Constructor & Destructor Documentation

CAllTargets::CAllTargets ( ) [inline]

Definition at line 88 of file uevent.cpp.

00088 {}

CAllTargets::~CAllTargets ( ) [inline]

Definition at line 89 of file uevent.cpp.

00090     {
00091         // delete the remaining widgets at exit.
00092         // we don't make a loop because the widget gets
00093         // removed from the map when calling the destructor.
00094         STD map<int, UCmdTarget *>::iterator i;
00095         while(targets.size() != 0)
00096         {
00097             i = targets.begin();
00098             delete (*i).second;
00099         }
00100     }

Member Function Documentation

const std:: map<int, UCmdTarget *>& CAllTargets::Get ( void ) const [inline]

Definition at line 103 of file uevent.cpp.

00103 { return targets; }

std:: map<int, UCmdTarget *>& CAllTargets::Get ( void ) [inline]

Definition at line 102 of file uevent.cpp.

00102 { return targets; }

Member Data Documentation

std:: map<int, UCmdTarget *> CAllTargets::targets [protected]

Definition at line 105 of file uevent.cpp.

The documentation for this class was generated from the following file:
  • rf/uevent.cpp
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ansiAttrCvt Class Reference

#include <CTCP2Parse.hpp>

Inheritance diagram for ansiAttrCvt:

[legend]
Collaboration diagram for ansiAttrCvt:

[legend]
List of all members.

Public Methods

void | ansi2ctcp (std::string *in)

Private Methods

void | do_m ()
void | do_C ()

Private Attributes

int | pos
int | bold
int | underline
int | reverse
int | blink
int | italic
std::string * _in
AnsiSeq * _seq

Static Private Attributes

const char * | escSeq = "\033\133"
const char * | fgColorMap [16]
const char * | bgColorMap [8]

Member Function Documentation

void ansiAttrCvt::ansi2ctcp ( std::string * in )

Definition at line 636 of file CTCP2Parse.cpp.

Referenced by CTCP2Parse::ParseIt().

00637 {
00638     bold = underline = reverse = blink = italic = 0;
00639     _in = in;
00640
00641     pos = in->find(escSeq);
00642
00643     while (pos != std::string::npos)
00644     {
00645         _seq = new AnsiSeq(in, pos);
00646
00647         switch (_seq->verb())
00648         {
00649         case INVALID_SEQUENCE:
00650             break;
00651
00652         case 'm':       // set graphic mode
00653             do_m();
00654             break;
00655         case 'C':       // move cursor right
00656             do_C();
00657             break;
00658         case 'f':       // move to cursor position
00659         case 'H':       //          "
00660         case 'A':       // move cursor up
00661         case 'B':       // move cursor down
00662         case 'D':       // move cursor left
00663         case 's':       // save cursor position
00664         case 'u':       // restore cursor position
00665         case 'J':       // erase display and goto home
00666         case 'K':       // erase line
00667         case 'h':       // set display mode
00668         case 'l':       // reset display mode
00669         default:
00670             std::string errmsg(std::string ("[ansi error: '") + _seq->seq() +
00671                 "' sequence unsupported]");
00672             in->insert(pos, errmsg);
00673             pos += errmsg.length();
00674         }
00675         delete _seq;
00676         pos = in->find(escSeq, pos);
00677     }
00678 };

void ansiAttrCvt::do_C ( ) [private]

Definition at line 868 of file CTCP2Parse.cpp.

Referenced by ansi2ctcp().

00869 {
00870     for (int i = 0; i < _seq->param(_seq->paramc() - 1); i++)
00871         _in->insert(pos++, " ");
00872 }

void ansiAttrCvt::do_m ( ) [private]

Definition at line 711 of file CTCP2Parse.cpp.

Referenced by ansi2ctcp().

00712 {
00713     int i;
00714     for (i = 0; i < _seq->paramc(); i++)
00715     {
00716         switch (_seq->param(i))
00717         {
00718         // reset
00719         case ANSI_SGM_TA_RESET:
00720             bold = underline = reverse = blink = 0;
00721             _in->insert(pos, std::string("") + CCTCP2 + 'N' + CCTCP2);
00722             pos += 3;
00723             break;
00724
00725         // bold intensity
00726         case ANSI_SGM_TA_BOLD:
00727             if (!bold) bold = 1;
00728             break;
00729
00730         // bold intensity
00731         case ANSI_SGM_TA_FAINT:
00732             // TODO: what do I do for this ???
00733             break;
00734
00735         // bold + faint off (normal intensity)
00736         case ANSI_SGM_TA_NORMAL:
00737             if (bold) bold = 0;
00738             break;
00739
00740         // standout (italic)
00741         case ANSI_SGM_TA_ITALIC:
00742             if (!italic)
00743             {
00744                 italic = 1;
00745                 _in->insert(pos, std::string("") + CCTCP2 + "I+" + CCTCP2);
00746                 pos += 4;       // consume the additions
00747             }
00748             break;
00749
00750         // standout (italic) off
00751         case ANSI_SGM_TA_ITALIC_OFF:
00752             if (italic)
00753             {
00754                 italic = 0;
00755                 _in->insert(pos, std::string("") + CCTCP2 + "I-" + CCTCP2);
00756                 pos += 4;       // consume the additions
00757             }
00758             break;
00759
00760         // underline
00761         case ANSI_SGM_TA_ULINE:
00762             if (!underline)
00763             {
00764                 underline = 1;
00765                 _in->insert(pos, std::string("") + CCTCP2 + "U+" + CCTCP2);
00766                 pos += 4;       // consume the additions
00767             }
00768             break;
00769
00770         // underline off
00771         case ANSI_SGM_TA_ULINE_OFF:
00772             if (underline)
00773             {
00774                 underline = 0;
00775                 _in->insert(pos, std::string("") + CCTCP2 + "U-" + CCTCP2);
00776                 pos += 4;       // consume the additions
00777             }
00778             break;
00779
00780         // blink
00781         case ANSI_SGM_TA_BLINK:
00782             if (!blink)
00783             {
00784                 blink = 1;
00785                 _in->insert(pos, std::string("") + CCTCP2 + "K+" + CCTCP2);
00786                 pos += 4;   // consume additions.
00787             }
00788             break;
00789
00790         // blink off
00791         case ANSI_SGM_TA_BLINK_OFF:
00792             if (blink)
00793             {
00794                 blink = 0;
00795                 _in->insert(pos, std::string("") + CCTCP2 + "K-" + CCTCP2);
00796                 pos += 4;   // consume additions.
00797             }
00798             break;
00799
00800         // reverse
00801         case ANSI_SGM_TA_REV:
00802             if (!reverse)
00803             {
00804                 reverse = 1;
00805                 _in->insert(pos, std::string("") + CCTCP2 + "V+" + CCTCP2);
00806                 pos += 4;   // consume the additions
00807             }
00808             break;
00809
00810         // reverse off
00811         case ANSI_SGM_TA_REV_OFF:
00812             if (reverse)
00813             {
00814                 reverse = 0;
00815                 _in->insert(pos, std::string("") + CCTCP2 + "V-" + CCTCP2);
00816                 pos += 4;   // consume the additions
00817             }
00818             break;
00819
00820         // concealed
00821         case ANSI_SGM_TA_CONSEAL:
00822             // TODO: wtf is this?  make foreground same color as back?
00823             break;
00824
00825         case ANSI_SGM_FC_BLK:
00826         case ANSI_SGM_FC_RED:
00827         case ANSI_SGM_FC_GRN:
00828         case ANSI_SGM_FC_YEL:
00829         case ANSI_SGM_FC_BLU:
00830         case ANSI_SGM_FC_MAG:
00831         case ANSI_SGM_FC_CYN:
00832         case ANSI_SGM_FC_WHT:
00833             _in->insert(pos, std::string("") + CCTCP2 +
00834                 fgColorMap[_seq->param(i) - 30 + (bold ? 8 : 0)] +
00835                 CCTCP2);
00836             pos += 5;       // consume the additions
00837             break;
00838
00839         case ANSI_SGM_FC_DEFAULT:
00840             _in->insert(pos, std::string("") + CCTCP2 + "C.-" + CCTCP2);
00841             pos += 5;       // consume the additions
00842             break;
00843
00844         case ANSI_SGM_BC_BLK:
00845         case ANSI_SGM_BC_RED:
00846         case ANSI_SGM_BC_GRN:
00847         case ANSI_SGM_BC_YEL:
00848         case ANSI_SGM_BC_BLU:
00849         case ANSI_SGM_BC_MAG:
00850         case ANSI_SGM_BC_CYN:
00851         case ANSI_SGM_BC_WHT:
00852             _in->insert(pos, std::string("") +
00853                 CCTCP2 + bgColorMap[_seq->param(i) - 40] + CCTCP2);
00854             pos += 5;       // consume the additions
00855             break;
00856
00857         case ANSI_SGM_BC_DEFAULT:
00858             _in->insert(pos, std::string("") + CCTCP2 + "C-." + CCTCP2);
00859             pos += 5;       // consume the additions
00860             break;
00861
00862         }
00863     }
00864 }

Member Data Documentation

std::string* ansiAttrCvt::_in [private]

Definition at line 74 of file CTCP2Parse.hpp.

AnsiSeq* ansiAttrCvt::_seq [private]

Definition at line 94 of file CTCP2Parse.hpp.

const char * ansiAttrCvt::bgColorMap [static, private]

Initial value:

 {
    "C-0",
    "C-4",
    "C-2",
    "C-6",
    "C-1",
    "C-5",
    "C-3",
    "C-7"
}

Definition at line 699 of file CTCP2Parse.cpp.

int ansiAttrCvt::blink [private]

Definition at line 72 of file CTCP2Parse.hpp.

int ansiAttrCvt::bold [private]

Definition at line 72 of file CTCP2Parse.hpp.

const char * ansiAttrCvt::escSeq = "\033\133" [static, private]

Definition at line 633 of file CTCP2Parse.cpp.

const char * ansiAttrCvt::fgColorMap [static, private]

Initial value:

 {
    "C0-",
    "C4-",
    "C2-",
    "C6-",
    "C1-",
    "C5-",
    "C3-",
    "C7-",
    "C8-",
    "CC-",
    "CA-",
    "CE-",
    "C9-",
    "CD-",
    "CB-",
    "CF-"
}

Definition at line 680 of file CTCP2Parse.cpp.

int ansiAttrCvt::italic [private]

Definition at line 72 of file CTCP2Parse.hpp.

int ansiAttrCvt::pos [private]

Definition at line 71 of file CTCP2Parse.hpp.

int ansiAttrCvt::reverse [private]

Definition at line 72 of file CTCP2Parse.hpp.

int ansiAttrCvt::underline [private]

Definition at line 72 of file CTCP2Parse.hpp.

The documentation for this class was generated from the following files:
  • common/CTCP2Parse.hpp
  • common/CTCP2Parse.cpp
Generated on Sun Oct 21 12:45:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ansiAttrCvt::AnsiSeq Class Reference

Collaboration diagram for ansiAttrCvt::AnsiSeq:

[legend]
List of all members.

Public Methods

AnsiSeq (std::string *in, int pos)
~AnsiSeq ()
char | verb ()
const char * | seq ()
int | paramc ()
int | param (int index)

Private Attributes

std::string * _seq
std::vector< int > | _params
char | _verb

Static Private Attributes

const char * | _notOf = "1234567890=;"

Constructor & Destructor Documentation

ansiAttrCvt::AnsiSeq::AnsiSeq | ( | std::string * | in,
 |  | int | pos
 | ) |

Definition at line 555 of file CTCP2Parse.cpp.

00556     : _seq(0), _verb(0)
00557 {
00558     int verbPos;
00559     int seqLen;
00560     int pos1, pos2;
00561
00562     verbPos = in->find_first_not_of(_notOf, pos + 2);
00563
00564     if (verbPos == std::string::npos || in->at(verbPos) == '\033')
00565     {
00566         _verb = INVALID_SEQUENCE;
00567         in->replace(pos, 2, "");
00568         return;
00569     }
00570
00571     seqLen = verbPos - pos - 1;
00572
00573     // get a copy of the ansi sequence without the "esc["
00574     _seq = new std::string(in->substr(pos + 2, seqLen));
00575
00576     // remove it from the original, now that we have the needed info
00577     in->replace(pos, verbPos - pos + 1, "");
00578
00579     // set the verb
00580     _verb = _seq->at(seqLen - 1);
00581
00582     for (pos1 = 0, pos2 = 0; pos2 < seqLen; pos2++)
00583     {
00584         if (_seq->at(pos2) != ';' && pos2 < (seqLen - 1)) continue;
00585         _params.push_back(atoi(_seq->substr(pos1, pos2 - pos1).c_str()));
00586         pos1 = pos2 + 1;
00587     }
00588
00589 }

ansiAttrCvt::AnsiSeq::~AnsiSeq ( )

Definition at line 592 of file CTCP2Parse.cpp.

00593 {
00594     if (_seq) delete _seq;
00595 }

Member Function Documentation

int ansiAttrCvt::AnsiSeq::param ( int index ) [inline]

Definition at line 91 of file CTCP2Parse.hpp.

Referenced by ansiAttrCvt::do_C(), and ansiAttrCvt::do_m().

00091 { return _params[index]; }

int ansiAttrCvt::AnsiSeq::paramc ( ) [inline]

Definition at line 90 of file CTCP2Parse.hpp.

Referenced by ansiAttrCvt::do_C(), and ansiAttrCvt::do_m().

00090 { return _params.size(); }

const char* ansiAttrCvt::AnsiSeq::seq ( ) [inline]

Definition at line 89 of file CTCP2Parse.hpp.

Referenced by ansiAttrCvt::ansi2ctcp().

00089 { return _seq->c_str(); }

char ansiAttrCvt::AnsiSeq::verb ( ) [inline]

Definition at line 88 of file CTCP2Parse.hpp.

Referenced by ansiAttrCvt::ansi2ctcp().

00088 { return _verb; }

Member Data Documentation

const char * ansiAttrCvt::AnsiSeq::_notOf = "1234567890=;" [static, private]

Definition at line 553 of file CTCP2Parse.cpp.

std::vector<int> ansiAttrCvt::AnsiSeq::_params [private]

Definition at line 80 of file CTCP2Parse.hpp.

std::string* ansiAttrCvt::AnsiSeq::_seq [private]

Definition at line 79 of file CTCP2Parse.hpp.

char ansiAttrCvt::AnsiSeq::_verb [private]

Definition at line 81 of file CTCP2Parse.hpp.

The documentation for this class was generated from the following files:
  • common/CTCP2Parse.hpp
  • common/CTCP2Parse.cpp
Generated on Sun Oct 21 12:45:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AREF Struct Reference

Collaboration diagram for AREF:

[legend]
List of all members.

Public Attributes

int cnt
HBITMAP bitmap

Member Data Documentation

HBITMAP AREF::bitmap

Definition at line 95 of file utoolbar.cpp.

Referenced by aref::UnRef(), aref::aref(), and aref::operator HBITMAP().

int AREF::cnt

Definition at line 94 of file utoolbar.cpp.

Referenced by aref::Ref(), aref::UnRef(), and aref::aref().

The documentation for this struct was generated from the following file:
  • rf/utoolbar.cpp
Generated on Sun Oct 21 12:45:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


aref Class Reference

Collaboration diagram for aref:

[legend]
List of all members.

Public Methods

aref ()
aref (HBITMAP b)
aref (const aref &src)
virtual | ~aref ()
AREF * | Ref (void) const
AREF * | UnRef (void) const
aref & | operator= (const aref &src)
operator HBITMAP ()

Protected Attributes

AREF * ref

Constructor & Destructor Documentation

aref::aref ( ) [inline]

Definition at line 101 of file utoolbar.cpp.

00101            : ref(0L)
00102     {
00103     }

aref::aref ( HBITMAP b ) [inline]

Definition at line 104 of file utoolbar.cpp.

00105     {
00106         ref = NEW AREF;
00107         ref->cnt = 1;
00108         ref->bitmap = b;
00109     }

aref::aref ( const aref & src ) [inline]

Definition at line 110 of file utoolbar.cpp.

00111     {
00112         ref = src.Ref();
00113     }

virtual aref::~aref ( ) [inline, virtual]

Definition at line 114 of file utoolbar.cpp.

00115     {
00116         UnRef();
00117     }

Member Function Documentation

AREF* aref::Ref ( void ) const [inline]

Definition at line 118 of file utoolbar.cpp.

Referenced by aref(), and operator=().

00119     {
00120         if(ref != 0L)
00121             ref->cnt++;
00122         return ref;
00123     }

AREF* aref::UnRef ( void ) const [inline]

Definition at line 124 of file utoolbar.cpp.

Referenced by operator=(), and ~aref().

00125     {
00126         if(ref != 0L && --ref->cnt == 0)
00127         {
00128 #ifdef WIN32
00129             if(ref->bitmap != 0L)
00130                 ::DeleteObject(ref->bitmap);
00131 #endif
00132             delete ref;
00133             ((aref *)this)->ref = 0L;
00134         }
00135         return ref;
00136     }

aref::operator HBITMAP ( ) [inline]

Definition at line 143 of file utoolbar.cpp.

00144     {
00145         return ref != 0L ? ref->bitmap : 0L;
00146     }

aref& aref::operator= ( const aref & src ) [inline]

Definition at line 137 of file utoolbar.cpp.

00138     {
00139         UnRef();
00140         ref = src.Ref();
00141         return *this;
00142     }

Member Data Documentation

AREF* aref::ref [protected]

Definition at line 148 of file utoolbar.cpp.

The documentation for this class was generated from the following file:
  • rf/utoolbar.cpp
Generated on Sun Oct 21 12:45:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ASEntry Struct Reference

Collaboration diagram for ASEntry:

[legend]
List of all members.

Public Attributes

UInt32 | entryID
UInt32 | entryOffset
UInt32 | entryLength

Member Data Documentation

UInt32 ASEntry::entryID

Definition at line 31 of file apsingle.c.

Referenced by decodeAppleSingle(), encodeAppleSingle(), and processASEntry().

UInt32 ASEntry::entryLength

Definition at line 34 of file apsingle.c.

Referenced by asEntryToMacFile(), decodeComment(), decodeFileDates(), decodeFinderInfo(), decodeMacInfo(), decodeRealName(), and encodeAppleSingle().

UInt32 ASEntry::entryOffset

Definition at line 32 of file apsingle.c.

Referenced by asEntryToMacFile(), decodeComment(), decodeFileDates(), decodeFinderInfo(), decodeMacInfo(), decodeRealName(), and encodeAppleSingle().

The documentation for this struct was generated from the following file:
  • cvs-1.10/macintosh/apsingle.c
Generated on Sun Oct 21 12:45:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ASFileDates Struct Reference

Collaboration diagram for ASFileDates:

[legend]
List of all members.

Public Attributes

SInt32 | create
SInt32 | modify
SInt32 | backup
SInt32 | access

Member Data Documentation

SInt32 ASFileDates::access

Definition at line 54 of file apsingle.c.

Referenced by encodeFileDates().

SInt32 ASFileDates::backup

Definition at line 53 of file apsingle.c.

Referenced by decodeFileDates(), and encodeFileDates().

SInt32 ASFileDates::create

Definition at line 51 of file apsingle.c.

Referenced by decodeFileDates(), and encodeFileDates().

SInt32 ASFileDates::modify

Definition at line 52 of file apsingle.c.

Referenced by decodeFileDates(), and encodeFileDates().

The documentation for this struct was generated from the following file:
  • cvs-1.10/macintosh/apsingle.c
Generated on Sun Oct 21 12:45:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ASFinderInfo Struct Reference

Collaboration diagram for ASFinderInfo:

[legend]
List of all members.

Public Attributes

FInfo | ioFlFndrInfo
FXInfo | ioFlXFndrInfo

Member Data Documentation

FInfo ASFinderInfo::ioFlFndrInfo

Definition at line 39 of file apsingle.c.

Referenced by decodeFinderInfo(), and encodeFinderInfo().

FXInfo ASFinderInfo::ioFlXFndrInfo

Definition at line 40 of file apsingle.c.

Referenced by decodeFinderInfo(), and encodeFinderInfo().

The documentation for this struct was generated from the following file:
  • cvs-1.10/macintosh/apsingle.c
Generated on Sun Oct 21 12:45:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ASHeader Struct Reference

Collaboration diagram for ASHeader:

[legend]
List of all members.

Public Attributes

UInt32 | magicNum
UInt32 | versionNum
UInt8 | filler [16]
UInt16 | numEntries

Member Data Documentation

UInt8 ASHeader::filler[16]

Definition at line 25 of file apsingle.c.

UInt32 ASHeader::magicNum

Definition at line 23 of file apsingle.c.

Referenced by decodeAppleSingle(), and encodeAppleSingle().

UInt16 ASHeader::numEntries

Definition at line 26 of file apsingle.c.

Referenced by decodeAppleSingle(), and encodeAppleSingle().

UInt32 ASHeader::versionNum

Definition at line 24 of file apsingle.c.

Referenced by decodeAppleSingle(), and encodeAppleSingle().

The documentation for this struct was generated from the following file:
  • cvs-1.10/macintosh/apsingle.c
Generated on Sun Oct 21 12:45:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ASMacInfo Struct Reference

Collaboration diagram for ASMacInfo:

[legend]
List of all members.

Public Attributes

UInt8 | filler [3]
UInt8 | ioFlAttrib

Member Data Documentation

UInt8 ASMacInfo::filler[3]

Definition at line 45 of file apsingle.c.

UInt8 ASMacInfo::ioFlAttrib

Definition at line 46 of file apsingle.c.

Referenced by decodeMacInfo(), and encodeMacInfo().

The documentation for this struct was generated from the following file:
  • cvs-1.10/macintosh/apsingle.c
Generated on Sun Oct 21 12:45:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Authen Class Reference

#include <Authen.h>

List of all members.

Public Methods

Authen ()
AuthenKind | kind (void)
const char * | kindstr (void)
void | setkind (AuthenKind newkind)
const char * | token (void)

Static Public Methods

const char * | kindToToken (AuthenKind k)
AuthenKind | tokenToKind (const char *t)
short | kindToNum (AuthenKind k)
AuthenKind | numToKind (short num)
bool | parse_cvsroot (const char *CVSroot, UStr &theMethod, UStr &theUser, UStr &theHost, UStr &thePath)
const char * | skiptoken (const char *cvsroot)

Constructor & Destructor Documentation

Authen::Authen ( ) [inline]

Definition at line 44 of file Authen.h.

00044 {}

Member Function Documentation

AuthenKind Authen::kind ( void )

Definition at line 68 of file Authen.cpp.

Referenced by kindstr(), and token().

00069 {
00070     return gAuthenKind;
00071 }

short Authen::kindToNum ( AuthenKind k ) [static]

Definition at line 158 of file Authen.cpp.

00159 {
00160     std::vector<AuthenModel *> & allInstances = AuthenModel::GetAllInstances();
00161     std::vector<AuthenModel *>::const_iterator i;
00162     int cnt = 0;
00163     for(i = allInstances.begin(); i != allInstances.end(); ++i, cnt++)
00164     {
00165         AuthenModel *model = *i;
00166         if(model->GetKind() == k)
00167             return cnt;
00168     }
00169
00170     return 0;
00171 }

const char * Authen::kindToToken ( AuthenKind k ) [static]

Definition at line 137 of file Authen.cpp.

00138 {
00139     AuthenModel *model = AuthenModel::GetInstance(k);
00140     return model->GetToken();
00141 }

const char * Authen::kindstr ( void )

Definition at line 78 of file Authen.cpp.

00079 {
00080     static CStr res;
00081
00082     switch(kind())
00083     {
00084         case pserver : res = "password authentication"; break;
00085         case kserver : res = "kerberos authentication"; break;
00086         case ssh : res = "ssh authentication"; break;
00087         case local : res = "local mounted directory"; break;
00088         case ntserver : res = "NT server services"; break;
00089         default :
00090         case rhosts : res = ".rhosts authentication"; break;
00091     }
00092
00093     if(kind() == pserver && gCvsPrefs.UseProxy())
00094     {
00095         res << " using a proxy";
00096     }
00097
00098     return res;
00099 }

AuthenKind Authen::numToKind ( short num ) [static]

Definition at line 173 of file Authen.cpp.

00174 {
00175     std::vector<AuthenModel *> & allInstances = AuthenModel::GetAllInstances();
00176     std::vector<AuthenModel *>::const_iterator i;
00177     int cnt = 0;
00178     for(i = allInstances.begin(); i != allInstances.end(); ++i, cnt++)
00179     {
00180         AuthenModel *model = *i;
00181         if(cnt == num)
00182             return model->GetKind();
00183     }
00184
00185     return local;
00186 }

bool Authen::parse_cvsroot | ( | const char * | CVSroot,
 |  | UStr & | theMethod,
 |  | UStr & | theUser,
 |  | UStr & | theHost,
 |  | UStr & | thePath
 | ) | [static]

Definition at line 188 of file Authen.cpp.

00189 {
00190     char *p;
00191     UStr copyroot(CVSroot);
00192     char *cvsroot_copy = copyroot;
00193
00194     theUser = "";
00195     theHost = "";
00196     thePath = "";
00197
00198     if (*cvsroot_copy == ':')
00199     {
00200         char *method = ++cvsroot_copy;
00201         bool have_semicolon;
00202
00203         /* Access method specified, as in
00204         * "cvs -d :pserver:user@host:/path",
00205         * "cvs -d :local:e:\path",
00206         * "cvs -d :kserver:user@host:/path", or
00207         * "cvs -d :fork:/path".
00208         * We need to get past that part of CVSroot before parsing the
00209         * rest of it.
00210         */
00211
00212         if (! (p = strchr (method, ':')))
00213             return false;
00214
00215         p = strpbrk (method, ":;#");
00216         if (p == 0L)
00217             return false;
00218
00219         have_semicolon = (*p == ';' || *p == '#');
00220         *p = '\0';
00221         cvsroot_copy = ++p;
00222
00223         theMethod = method;
00224
00225         while (have_semicolon)
00226         {
00227             /* More elaborate implementation would allow multiple
00228             semicolons, for example:
00229
00230             :server;rsh=34;command=cvs-1.6:
00231
00232             we will allow
00233             :server;port=22;proxy=www-proxy;proxyport=8080:
00234
00235             we will also allow # as well as ; as a separator to
00236             avoid having to quote the root in a shell.
00237             */
00238             /* FIXME: lots of error conditions should be better handled,
00239             e.g. garbage after the number or no valid number.
00240
00241             Would be nice to have testcases for some of these cases
00242             including the error cases.  */
00243             p = strpbrk (cvsroot_copy, ":;#");
00244             if (p == NULL)
00245                 return false;
00246
00247             /* pick up more options if we have them */
00248             have_semicolon = (*p == ';' || *p == '#');
00249             *p = '\0';
00250
00251             cvsroot_copy = ++p;
00252         }
00253     }
00254     else
00255     {
00256         theMethod = "";
00257     }
00258
00259     if (theMethod != "local")
00260     {
00261         /* Check to see if there is a username in the string. */
00262
00263         if ((p = strchr (cvsroot_copy, '@')) != NULL)
00264         {
00265             *p = '\0';
00266             theUser = cvsroot_copy;
00267             cvsroot_copy = ++p;
00268         }
00269
00270         if ((p = strchr (cvsroot_copy, ':')) != NULL)
00271         {
00272             *p = '\0';
00273             theHost = cvsroot_copy;
00274             cvsroot_copy = ++p;
00275         }
00276     }
00277
00278     thePath = cvsroot_copy;
00279
00280     return true;
00281 }

void Authen::setkind ( AuthenKind newkind )

Definition at line 73 of file Authen.cpp.

00074 {
00075     gAuthenKind = newkind;
00076 }

const char * Authen::skiptoken ( const char * cvsroot ) [static]

Definition at line 129 of file Authen.cpp.

Referenced by CvsCmdCheckoutModule(), CvsCmdInit(), glue_getenv(), and CvsArgs::reset().

00130 {
00131     const char *secondColon;
00132     if(cvsroot[0] != ':' || (secondColon = strchr(cvsroot + 1, ':')) == NULL)
00133         return cvsroot;
00134     return secondColon + 1;
00135 }

const char * Authen::token ( void )

Definition at line 101 of file Authen.cpp.

00102 {
00103     static CStr res;
00104
00105     switch(kind())
00106     {
00107         case pserver :
00108             res = ":pserver";
00109             if(gCvsPrefs.UseProxy())
00110             {
00111                 res << ";proxy=";
00112                 res << gCvsPrefs.ProxyHost();
00113                 res << ";proxyport=";
00114                 res << gCvsPrefs.ProxyPort();
00115             }
00116             res << ':';
00117             break;
00118         case kserver : res = ":kserver:"; break;
00119         case ssh : res = ":ext:"; break;
00120         case local : res = ":local:"; break;
00121         case ntserver : res = ":ntserver:"; break;
00122         default :
00123         case rhosts : res = ""; break;
00124     }
00125
00126     return res;
00127 }

AuthenKind Authen::tokenToKind ( const char * t ) [static]

Definition at line 143 of file Authen.cpp.

00144 {
00145     std::vector<AuthenModel *> & allInstances = AuthenModel::GetAllInstances();
00146     std::vector<AuthenModel *>::const_iterator i;
00147     for(i = allInstances.begin(); i != allInstances.end(); ++i)
00148     {
00149         AuthenModel *model = *i;
00150         if(strcmp(model->GetToken(), t) == 0)
00151             return model->GetKind();
00152     }
00153
00154     cvs_err("Unknown authentication kind '%s'\n", t);
00155     return local;
00156 }

The documentation for this class was generated from the following files:
  • common/Authen.h
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UAuthen_Kserver Class Reference

Inheritance diagram for UAuthen_Kserver:

[legend]
Collaboration diagram for UAuthen_Kserver:

[legend]
List of all members.

Public Types

enum | { kOK = EV_COMMAND_START, kCancel, kCheckPort, kEditPort }

Public Methods

UAuthen_Kserver ()
virtual | ~UAuthen_Kserver ()
virtual void | DoDataExchange (bool fill)
while modaling, allows to fill/read the dialog content.
  • fill says if it expects to fill or read the dialog content.
 More...

Protected Methods

int | OnCheckPort (void)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

int | m_port

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

anonymous enum

Enumeration values:
kOK
kCancel
kCheckPort
kEditPort

Definition at line 1371 of file Authen.cpp.

01372     {
01373         kOK = EV_COMMAND_START, // 0
01374         kCancel,            // 1
01375         kCheckPort,         // 2
01376         kEditPort           // 3
01377     };

Constructor & Destructor Documentation

UAuthen_Kserver::UAuthen_Kserver ( )

Definition at line 1395 of file Authen.cpp.

01395                                  : UWidget(::UEventGetWidID())
01396 {
01397 }

virtual UAuthen_Kserver::~UAuthen_Kserver ( ) [inline, virtual]

Definition at line 1369 of file Authen.cpp.

01369 {}

Member Function Documentation

void UAuthen_Kserver::DoDataExchange ( bool fill ) [virtual]

while modaling, allows to fill/read the dialog content.

  • fill says if it expects to fill or read the dialog content.

Reimplemented from UWidget.

Definition at line 1407 of file Authen.cpp.

01408 {
01409     if(fill)
01410     {
01411         m_port = gCvsPrefs.KserverPort();
01412
01413         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, m_port != -1), 0L);
01414         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kEditPort, m_port == -1 ? 0 : m_port), 0L);
01415         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckPort, m_port != -1), 0L);
01416     }
01417     else
01418     {
01419         int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01420         int value = UEventSendMessage(GetWidID(), EV_GETINTEGER, kEditPort, 0L);
01421         gCvsPrefs.SetKserverPort(state ? value : -1);
01422     }
01423 }

const UMSGMAP* UAuthen_Kserver::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

virtual const UMSGMAP* UAuthen_Kserver::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

const UMSGMAP* UAuthen_Kserver::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

int UAuthen_Kserver::OnCheckPort ( void ) [protected]

Definition at line 1399 of file Authen.cpp.

01400 {
01401     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01402     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, state), 0L);
01403
01404     return 0;
01405 }

Member Data Documentation

const UMSGMAP_ENTRY UAuthen_Kserver::_messageEntries[] [static, private]

Reimplemented from UWidget.

Definition at line 1386 of file Authen.cpp.

int UAuthen_Kserver::m_port [protected]

Definition at line 1382 of file Authen.cpp.

const UMSGMAP UAuthen_Kserver::messageMap [static, protected]

Reimplemented from UWidget.

Definition at line 1386 of file Authen.cpp.

The documentation for this class was generated from the following file:
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UAuthen_Pserver Class Reference

Inheritance diagram for UAuthen_Pserver:

[legend]
Collaboration diagram for UAuthen_Pserver:

[legend]
List of all members.

Public Types

enum {
kOK = EV_COMMAND_START, kCancel, kCheckPort, kEditPort,
kCheckProxy, kNameProxy, kEditProxy
}

Public Methods

UAuthen_Pserver ()
virtual | ~UAuthen_Pserver ()
virtual void | DoDataExchange (bool fill)
while modaling, allows to fill/read the dialog content.
  • fill says if it expects to fill or read the dialog content.
 More...

Protected Methods

int | OnCheckPort (void)
int | OnCheckProxy (void)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

int | m_port
int | m_pport
UStr m_pname

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

anonymous enum

Enumeration values:
kOK
kCancel
kCheckPort
kEditPort
kCheckProxy
kNameProxy
kEditProxy

Definition at line 969 of file Authen.cpp.

00970     {
00971         kOK = EV_COMMAND_START, // 0
00972         kCancel,            // 1
00973         kCheckPort,         // 2
00974         kEditPort,          // 3
00975         kCheckProxy,        // 4
00976         kNameProxy,         // 5
00977         kEditProxy          // 6
00978     };

Constructor & Destructor Documentation

UAuthen_Pserver::UAuthen_Pserver ( )

Definition at line 1000 of file Authen.cpp.

01000                                  : UWidget(::UEventGetWidID())
01001 {
01002 }

virtual UAuthen_Pserver::~UAuthen_Pserver ( ) [inline, virtual]

Definition at line 967 of file Authen.cpp.

00967 {}

Member Function Documentation

void UAuthen_Pserver::DoDataExchange ( bool fill ) [virtual]

while modaling, allows to fill/read the dialog content.

  • fill says if it expects to fill or read the dialog content.

Reimplemented from UWidget.

Definition at line 1021 of file Authen.cpp.

01022 {
01023     if(fill)
01024     {
01025         m_port = gCvsPrefs.PserverPort();
01026
01027         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, m_port != -1), 0L);
01028         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kEditPort, m_port == -1 ? 2401 : m_port), 0L);
01029         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckPort, m_port != -1), 0L);
01030
01031         m_pport = gCvsPrefs.ProxyPort();
01032         m_pname = gCvsPrefs.ProxyHost();
01033         bool useProxy = gCvsPrefs.UseProxy();
01034         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditProxy, useProxy), 0L);
01035         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kNameProxy, useProxy), 0L);
01036         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kEditProxy, m_pport), 0L);
01037         UEventSendMessage(GetWidID(), EV_SETTEXT, kNameProxy, (void *)(const char *)m_pname);
01038         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckProxy, useProxy), 0L);
01039     }
01040     else
01041     {
01042         int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01043         int value = UEventSendMessage(GetWidID(), EV_GETINTEGER, kEditPort, 0L);
01044         gCvsPrefs.SetPserverPort(state ? value : -1);
01045
01046         state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckProxy, 0L);
01047         value = UEventSendMessage(GetWidID(), EV_GETINTEGER, kEditProxy, 0L);
01048         UEventSendMessage(GetWidID(), EV_GETTEXT, kNameProxy, &m_pname);
01049         gCvsPrefs.SetUseProxy(state != 0);
01050         if(state != 0)
01051         {
01052             gCvsPrefs.SetProxyHost(m_pname);
01053             gCvsPrefs.SetProxyPort(value);
01054         }
01055     }
01056 }

const UMSGMAP* UAuthen_Pserver::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

virtual const UMSGMAP* UAuthen_Pserver::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

const UMSGMAP* UAuthen_Pserver::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

int UAuthen_Pserver::OnCheckPort ( void ) [protected]

Definition at line 1004 of file Authen.cpp.

01005 {
01006     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01007     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, state), 0L);
01008
01009     return 0;
01010 }

int UAuthen_Pserver::OnCheckProxy ( void ) [protected]

Definition at line 1012 of file Authen.cpp.

01013 {
01014     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckProxy, 0L);
01015     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kNameProxy, state), 0L);
01016     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditProxy, state), 0L);
01017
01018     return 0;
01019 }

Member Data Documentation

const UMSGMAP_ENTRY UAuthen_Pserver::_messageEntries[] [static, private]

Reimplemented from UWidget.

Definition at line 990 of file Authen.cpp.

UStr UAuthen_Pserver::m_pname [protected]

Definition at line 985 of file Authen.cpp.

int UAuthen_Pserver::m_port [protected]

Definition at line 983 of file Authen.cpp.

int UAuthen_Pserver::m_pport [protected]

Definition at line 984 of file Authen.cpp.

const UMSGMAP UAuthen_Pserver::messageMap [static, protected]

Reimplemented from UWidget.

Definition at line 990 of file Authen.cpp.

The documentation for this class was generated from the following file:
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UAuthen_Rhosts Class Reference

Inheritance diagram for UAuthen_Rhosts:

[legend]
Collaboration diagram for UAuthen_Rhosts:

[legend]
List of all members.

Public Types

enum {
kOK = EV_COMMAND_START, kCancel, kCheckPort, kEditPort,
kCheckRSHName, kEditRSHName, kCheckServerName, kEditServerName
}

Public Methods

UAuthen_Rhosts ()
virtual | ~UAuthen_Rhosts ()
virtual void | DoDataExchange (bool fill)
while modaling, allows to fill/read the dialog content.
  • fill says if it expects to fill or read the dialog content.
 More...

Protected Methods

int | OnCheckPort (void)
int | OnCheckRshName (void)
int | OnCheckServerName (void)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

int | m_port
UStr m_rshname
UStr m_servername

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

anonymous enum

Enumeration values:
kOK
kCancel
kCheckPort
kEditPort
kCheckRSHName
kEditRSHName
kCheckServerName
kEditServerName

Definition at line 1155 of file Authen.cpp.

01156     {
01157         kOK = EV_COMMAND_START, // 0
01158         kCancel,            // 1
01159         kCheckPort,         // 2
01160         kEditPort,          // 3
01161         kCheckRSHName,      // 4
01162         kEditRSHName,       // 5
01163         kCheckServerName,   // 6
01164         kEditServerName     // 7
01165     };

Constructor & Destructor Documentation

UAuthen_Rhosts::UAuthen_Rhosts ( )

Definition at line 1189 of file Authen.cpp.

01189                                : UWidget(::UEventGetWidID())
01190 {
01191 }

virtual UAuthen_Rhosts::~UAuthen_Rhosts ( ) [inline, virtual]

Definition at line 1153 of file Authen.cpp.

01153 {}

Member Function Documentation

void UAuthen_Rhosts::DoDataExchange ( bool fill ) [virtual]

while modaling, allows to fill/read the dialog content.

  • fill says if it expects to fill or read the dialog content.

Reimplemented from UWidget.

Definition at line 1217 of file Authen.cpp.

01218 {
01219     if(fill)
01220     {
01221         m_port = gCvsPrefs.RhostPort();
01222         m_rshname = gCvsPrefs.RshName();
01223         m_servername = gCvsPrefs.ServerName();
01224
01225         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, m_port != -1), 0L);
01226         UEventSendMessage(GetWidID(), EV_SETINTEGER, UMAKEINT(kEditPort, m_port == -1 ? 0 : m_port), 0L);
01227         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckPort, m_port != -1), 0L);
01228
01229         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditRSHName, !m_rshname.empty()), 0L);
01230         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditRSHName, (void *)m_rshname.c_str());
01231         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckRSHName, !m_rshname.empty()), 0L);
01232
01233         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditServerName, !m_servername.empty()), 0L);
01234         UEventSendMessage(GetWidID(), EV_SETTEXT, kEditServerName, (void *)m_servername.c_str());
01235         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kCheckServerName, !m_servername.empty()), 0L);
01236     }
01237     else
01238     {
01239         int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01240         int value = UEventSendMessage(GetWidID(), EV_GETINTEGER, kEditPort, 0L);
01241         gCvsPrefs.SetRhostPort(state ? value : -1);
01242
01243         state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRSHName, 0L);
01244         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditRSHName, &m_rshname);
01245         gCvsPrefs.SetRshName(state ? m_rshname.c_str() : "");
01246
01247         state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckServerName, 0L);
01248         UEventSendMessage(GetWidID(), EV_GETTEXT, kEditServerName, &m_servername);
01249         gCvsPrefs.SetServerName(state ? m_servername.c_str() : "");
01250     }
01251 }

const UMSGMAP* UAuthen_Rhosts::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

virtual const UMSGMAP* UAuthen_Rhosts::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

const UMSGMAP* UAuthen_Rhosts::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

int UAuthen_Rhosts::OnCheckPort ( void ) [protected]

Definition at line 1193 of file Authen.cpp.

01194 {
01195     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckPort, 0L);
01196     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditPort, state), 0L);
01197
01198     return 0;
01199 }

int UAuthen_Rhosts::OnCheckRshName ( void ) [protected]

Definition at line 1201 of file Authen.cpp.

01202 {
01203     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckRSHName, 0L);
01204     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditRSHName, state), 0L);
01205
01206     return 0;
01207 }

int UAuthen_Rhosts::OnCheckServerName ( void ) [protected]

Definition at line 1209 of file Authen.cpp.

01210 {
01211     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCheckServerName, 0L);
01212     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kEditServerName, state), 0L);
01213
01214     return 0;
01215 }

Member Data Documentation

const UMSGMAP_ENTRY UAuthen_Rhosts::_messageEntries[] [static, private]

Reimplemented from UWidget.

Definition at line 1178 of file Authen.cpp.

int UAuthen_Rhosts::m_port [protected]

Definition at line 1170 of file Authen.cpp.

UStr UAuthen_Rhosts::m_rshname [protected]

Definition at line 1171 of file Authen.cpp.

UStr UAuthen_Rhosts::m_servername [protected]

Definition at line 1172 of file Authen.cpp.

const UMSGMAP UAuthen_Rhosts::messageMap [static, protected]

Reimplemented from UWidget.

Definition at line 1178 of file Authen.cpp.

The documentation for this class was generated from the following file:
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UAuthen_SSH Class Reference

Inheritance diagram for UAuthen_SSH:

[legend]
Collaboration diagram for UAuthen_SSH:

[legend]
List of all members.

Public Types

enum {
kOK = EV_COMMAND_START, kCancel, kRSACheck, kRSAEdit,
kRSABtn, kSSHCheck, kSSHName, kOptionsText,
kOptionsCheck, kOptionsEdit, kSSHBtn
}

Public Methods

UAuthen_SSH ()
virtual | ~UAuthen_SSH ()
virtual void | DoDataExchange (bool fill)
while modaling, allows to fill/read the dialog content.
  • fill says if it expects to fill or read the dialog content.
 More...

Protected Methods

int | OnCheckRSA (void)
int | OnBtnRSA (void)
int | OnCheckName (void)
int | OnBtnName (void)
int | OnCheckOptions (void)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

bool | m_rsaidentity
UStr m_rsaidentityfile
UStr m_options

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

anonymous enum

Enumeration values:
kOK
kCancel
kRSACheck
kRSAEdit
kRSABtn
kSSHCheck
kSSHName
kOptionsText
kOptionsCheck
kOptionsEdit
kSSHBtn

Definition at line 645 of file Authen.cpp.

00646     {
00647         kOK = EV_COMMAND_START, // 0
00648         kCancel,            // 1
00649         kRSACheck,          // 2
00650         kRSAEdit,           // 3
00651         kRSABtn,            // 4
00652         kSSHCheck,          // 5
00653         kSSHName,           // 6
00654         kOptionsText,       // 7
00655         kOptionsCheck,      // 8
00656         kOptionsEdit,       // 9
00657         kSSHBtn,            // 10
00658     };

Constructor & Destructor Documentation

UAuthen_SSH::UAuthen_SSH ( )

Definition at line 686 of file Authen.cpp.

00686                          : UWidget(::UEventGetWidID())
00687 {
00688 }

virtual UAuthen_SSH::~UAuthen_SSH ( ) [inline, virtual]

Definition at line 643 of file Authen.cpp.

00643 {}

Member Function Documentation

void UAuthen_SSH::DoDataExchange ( bool fill ) [virtual]

while modaling, allows to fill/read the dialog content.

  • fill says if it expects to fill or read the dialog content.

Reimplemented from UWidget.

Definition at line 764 of file Authen.cpp.

00765 {
00766     if(fill)
00767     {
00768         m_rsaidentity = AuthenSSH::gRsaIdentity;
00769         m_rsaidentityfile = AuthenSSH::RsaIdentityFile();
00770         UStr helpMsg = "* Some Cygwin/OpenSSH options :\n"
00771             "-v : Verbose mode\n"
00772             "-C : Request compression\n"
00773             "-1 : Forces ssh to try protocol version 1 only\n"
00774             "-2 : Forces ssh to try protocol version 2 only\n"
00775             "-4 : Forces ssh to try protocol version 2 only\n"
00776             "-6 : Forces ssh to use IPv6 addresses only";
00777
00778         UEventSendMessage(GetWidID(), EV_SETTEXT, kOptionsText, (void *)helpMsg.c_str());
00779
00780         UEventSendMessage(GetWidID(), EV_COMBO_RESETALL, kRSAEdit, 0L);
00781         const CMString::list_t & rsastrings = AuthenSSH::gRsaIdentityFile.GetList();
00782         CMString::list_t::const_iterator i;
00783         for(i = rsastrings.begin(); i != rsastrings.end(); ++i)
00784         {
00785             UEventSendMessage(GetWidID(), EV_COMBO_APPEND, kRSAEdit,
00786                 (void *)(const char *)*i);
00787         }
00788
00789         UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kRSACheck, m_rsaidentity), 0L);
00790         UEventSendMessage(GetWidID(), EV_SETTEXT, kRSAEdit, (void *)m_rsaidentityfile.c_str());
00791
00792         if(!AuthenSSH::gSSHName.empty())
00793         {
00794             UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kSSHCheck, 1), 0L);
00795             UEventSendMessage(GetWidID(), EV_SETTEXT, kSSHName, (void *)AuthenSSH::gSSHName.c_str());
00796         }
00797
00798         if(!AuthenSSH::gSSHOptions.empty())
00799         {
00800             UEventSendMessage(GetWidID(), EV_SETSTATE, UMAKEINT(kOptionsCheck, 1), 0L);
00801             UEventSendMessage(GetWidID(), EV_SETTEXT, kOptionsEdit, (void *)AuthenSSH::gSSHOptions.c_str());
00802         }
00803
00804         OnCheckRSA();
00805         OnCheckName();
00806         OnCheckOptions();
00807     }
00808     else
00809     {
00810         AuthenSSH::gRsaIdentity = m_rsaidentity;
00811         if(m_rsaidentity)
00812         {
00813             UEventSendMessage(GetWidID(), EV_GETTEXT, kRSAEdit, &m_rsaidentityfile);
00814             AuthenSSH::gRsaIdentityFile.Insert(m_rsaidentityfile);
00815             AuthenSSH::gCurRsaIdentity = m_rsaidentityfile;
00816         }
00817
00818         if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kSSHCheck, 0L))
00819             UEventSendMessage(GetWidID(), EV_GETTEXT, kSSHName, &AuthenSSH::gSSHName);
00820         else
00821             AuthenSSH::gSSHName = "";
00822
00823         if(UEventSendMessage(GetWidID(), EV_QUERYSTATE, kOptionsCheck, 0L))
00824             UEventSendMessage(GetWidID(), EV_GETTEXT, kOptionsEdit, &AuthenSSH::gSSHOptions);
00825         else
00826             AuthenSSH::gSSHOptions = "";
00827     }
00828 }

const UMSGMAP* UAuthen_SSH::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

virtual const UMSGMAP* UAuthen_SSH::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

const UMSGMAP* UAuthen_SSH::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

int UAuthen_SSH::OnBtnName ( void ) [protected]

Definition at line 738 of file Authen.cpp.

00739 {
00740     MultiFiles mf;
00741 #ifdef WIN32
00742     if(!BrowserGetMultiFiles("Select SSH :", mf, "Executable Files (*.exe)|*.exe|All Files (*.*)|*.*||"))
00743         return 0;
00744 #else
00745     if(!BrowserGetMultiFiles("Select SSH :", mf))
00746         return 0;
00747 #endif
00748
00749     CvsArgs args(false);
00750     mf.next();
00751     const char *dir = mf.add(args);
00752     char * const *argv = args.Argv();
00753     UStr fullpath;
00754     fullpath = dir;
00755     if(!fullpath.endsWith(kPathDelimiter))
00756         fullpath << kPathDelimiter;
00757     fullpath << argv[0];
00758
00759     UEventSendMessage(GetWidID(), EV_SETTEXT, kSSHName, (void *)fullpath.c_str());
00760
00761     return 0;
00762 }

int UAuthen_SSH::OnBtnRSA ( void ) [protected]

Definition at line 717 of file Authen.cpp.

00718 {
00719     MultiFiles mf;
00720     if(!BrowserGetMultiFiles("Select a RSA identity :", mf))
00721         return 0;
00722
00723     CvsArgs args(false);
00724     mf.next();
00725     const char *dir = mf.add(args);
00726     char * const *argv = args.Argv();
00727     UStr fullpath;
00728     fullpath = dir;
00729     if(!fullpath.endsWith(kPathDelimiter))
00730         fullpath << kPathDelimiter;
00731     fullpath << argv[0];
00732
00733     UEventSendMessage(GetWidID(), EV_SETTEXT, kRSAEdit, (void *)fullpath.c_str());
00734
00735     return 0;
00736 }

int UAuthen_SSH::OnCheckName ( void ) [protected]

Definition at line 699 of file Authen.cpp.

Referenced by DoDataExchange().

00700 {
00701     bool state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kSSHCheck, 0L) != 0;
00702     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kSSHName, state), 0L);
00703     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kSSHBtn, state), 0L);
00704
00705     return 0;
00706 }

int UAuthen_SSH::OnCheckOptions ( void ) [protected]

Definition at line 708 of file Authen.cpp.

Referenced by DoDataExchange().

00709 {
00710     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kOptionsCheck, 0L);
00711     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kOptionsEdit, state), 0L);
00712     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kOptionsText, state), 0L);
00713
00714     return 0;
00715 }

int UAuthen_SSH::OnCheckRSA ( void ) [protected]

Definition at line 690 of file Authen.cpp.

Referenced by DoDataExchange().

00691 {
00692     m_rsaidentity = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kRSACheck, 0L) != 0;
00693     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kRSAEdit, m_rsaidentity), 0L);
00694     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kRSABtn, m_rsaidentity), 0L);
00695
00696     return 0;
00697 }

Member Data Documentation

const UMSGMAP_ENTRY UAuthen_SSH::_messageEntries[] [static, private]

Reimplemented from UWidget.

Definition at line 673 of file Authen.cpp.

UStr UAuthen_SSH::m_options [protected]

Definition at line 665 of file Authen.cpp.

bool UAuthen_SSH::m_rsaidentity [protected]

Definition at line 663 of file Authen.cpp.

UStr UAuthen_SSH::m_rsaidentityfile [protected]

Definition at line 664 of file Authen.cpp.

const UMSGMAP UAuthen_SSH::messageMap [static, protected]

Reimplemented from UWidget.

Definition at line 673 of file Authen.cpp.

The documentation for this class was generated from the following file:
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AuthenKserver Class Reference

Inheritance diagram for AuthenKserver:

[legend]
Collaboration diagram for AuthenKserver:

[legend]
List of all members.

Public Methods

AuthenKserver ()
virtual | ~AuthenKserver ()
virtual AuthenKind | GetKind (void) const
virtual const char * | GetToken (void) const
virtual bool | HasSettings (void) const
virtual bool | HasHost (void) const
virtual bool | HasUser (void) const
virtual void | DoSettings (void)
virtual void | GetSettingsDesc (UStr &desc)
virtual const char * | OnGetEnv (char *env)

Constructor & Destructor Documentation

AuthenKserver::AuthenKserver ( ) [inline]

Definition at line 1348 of file Authen.cpp.

01348 {}

virtual AuthenKserver::~AuthenKserver ( ) [inline, virtual]

Definition at line 1349 of file Authen.cpp.

01349 {}

Member Function Documentation

void AuthenKserver::DoSettings ( void ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1425 of file Authen.cpp.

01426 {
01427     UAuthen_Kserver *dlg = new UAuthen_Kserver();
01428
01429     try
01430     {
01431 #if qMacCvsPP
01432         dlg->DoModal(3003);
01433 #endif
01434     }
01435     catch(...)
01436     {
01437     }
01438
01439     delete dlg;
01440 }

virtual AuthenKind AuthenKserver::GetKind ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1351 of file Authen.cpp.

01351 { return kserver; }

void AuthenKserver::GetSettingsDesc ( UStr & desc ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1442 of file Authen.cpp.

01443 {
01444     if(gCvsPrefs.KserverPort() == -1)
01445         desc << "Using default port";
01446     else
01447         desc << "Using port " << gCvsPrefs.KserverPort();
01448 }

virtual const char* AuthenKserver::GetToken ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1352 of file Authen.cpp.

01352 { return "kserver"; }

virtual bool AuthenKserver::HasHost ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1355 of file Authen.cpp.

01355 { return true; }

virtual bool AuthenKserver::HasSettings ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1354 of file Authen.cpp.

01354 { return true; }

virtual bool AuthenKserver::HasUser ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1356 of file Authen.cpp.

01356 { return true; }

const char * AuthenKserver::OnGetEnv ( char * env ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1450 of file Authen.cpp.

01451 {
01452     return 0L;
01453 }

The documentation for this class was generated from the following file:
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AuthenLocal Class Reference

Inheritance diagram for AuthenLocal:

[legend]
Collaboration diagram for AuthenLocal:

[legend]
List of all members.

Public Methods

AuthenLocal ()
virtual | ~AuthenLocal ()
virtual AuthenKind | GetKind (void) const
virtual const char * | GetToken (void) const

Constructor & Destructor Documentation

AuthenLocal::AuthenLocal ( ) [inline]

Definition at line 344 of file Authen.cpp.

00344 {}

virtual AuthenLocal::~AuthenLocal ( ) [inline, virtual]

Definition at line 345 of file Authen.cpp.

00345 {}

Member Function Documentation

virtual AuthenKind AuthenLocal::GetKind ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 347 of file Authen.cpp.

00347 { return local; }

virtual const char* AuthenLocal::GetToken ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 348 of file Authen.cpp.

00348 { return "local"; }

The documentation for this class was generated from the following file:
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AuthenModel Class Reference

#include <Authen.h>

Inheritance diagram for AuthenModel:

[legend]
Collaboration diagram for AuthenModel:

[legend]
List of all members.

Public Methods

AuthenModel ()
virtual | ~AuthenModel ()
virtual AuthenKind | GetKind (void) const=0
virtual const char * | GetToken (void) const=0
virtual bool | HasSettings (void) const
virtual bool | HasHost (void) const
virtual bool | HasUser (void) const
virtual void | DoSettings (void)
virtual void | GetSettingsDesc (UStr &desc)
virtual const char * | OnGetEnv (char *env)
virtual void | OnSetupEnv (void)
virtual void | OnRestoreEnv (void)

Static Public Methods

std::vector< AuthenModel *> & | GetAllInstances (void)
AuthenModel * | GetInstance (AuthenKind k)

Static Protected Attributes

std::vector< AuthenModel *> * | m_instances = 0L

Constructor & Destructor Documentation

AuthenModel::AuthenModel ( )

Definition at line 285 of file Authen.cpp.

00286 {
00287     if(m_instances == 0L)
00288     {
00289         m_instances = new std::vector<AuthenModel *>;
00290         if(m_instances == 0L)
00291             throw std::bad_alloc();
00292     }
00293
00294     m_instances->push_back(this);
00295 }

AuthenModel::~AuthenModel ( ) [virtual]

Definition at line 297 of file Authen.cpp.

00298 {
00299     std::vector<AuthenModel *>::iterator i;
00300     i = std::find(m_instances->begin(), m_instances->end(), this);
00301     if(i != m_instances->end())
00302         m_instances->erase(i);
00303
00304     if(m_instances->empty())
00305         delete m_instances;
00306 }

Member Function Documentation

virtual void AuthenModel::DoSettings ( void ) [inline, virtual]

Reimplemented in AuthenSSH, AuthenPserver, AuthenRhosts, and AuthenKserver.

Definition at line 79 of file Authen.h.

00079 {}

std::vector< AuthenModel *> & AuthenModel::GetAllInstances ( void ) [static]

Definition at line 308 of file Authen.cpp.

Referenced by GetInstance(), glue_getenv(), Authen::kindToNum(), Authen::numToKind(), and Authen::tokenToKind().

00309 {
00310     return *AuthenModel::m_instances;
00311 }

AuthenModel * AuthenModel::GetInstance ( AuthenKind k ) [static]

Definition at line 313 of file Authen.cpp.

Referenced by CAuthenSetUp::CAuthenSetUp(), glue_getenv(), Authen::kindToToken(), and CAuthenSetUp::~CAuthenSetUp().

00314 {
00315     std::vector<AuthenModel *> & allInstances = GetAllInstances();
00316     std::vector<AuthenModel *>::const_iterator i;
00317     for(i = allInstances.begin(); i != allInstances.end(); ++i)
00318     {
00319         AuthenModel *model = *i;
00320         if(model->GetKind() == k)
00321             return model;
00322     }
00323
00324     // default to local
00325     cvs_err("Unknown authentication kind %d\n", k);
00326     return GetInstance(local);
00327 }

virtual AuthenKind AuthenModel::GetKind ( void ) const [pure virtual]

Reimplemented in AuthenLocal, AuthenSSH, AuthenPserver, AuthenRhosts, AuthenKserver, and AuthenNtserver.

Referenced by GetInstance(), Authen::kindToNum(), Authen::numToKind(), and Authen::tokenToKind().

virtual void AuthenModel::GetSettingsDesc ( UStr & desc ) [inline, virtual]

Reimplemented in AuthenSSH, AuthenPserver, AuthenRhosts, and AuthenKserver.

Definition at line 80 of file Authen.h.

00080 { desc = ""; }

virtual const char* AuthenModel::GetToken ( void ) const [pure virtual]

Reimplemented in AuthenLocal, AuthenSSH, AuthenPserver, AuthenRhosts, AuthenKserver, and AuthenNtserver.

Referenced by Authen::kindToToken(), and Authen::tokenToKind().

virtual bool AuthenModel::HasHost ( void ) const [inline, virtual]

Reimplemented in AuthenSSH, AuthenPserver, AuthenRhosts, AuthenKserver, and AuthenNtserver.

Definition at line 76 of file Authen.h.

00076 { return false; }

virtual bool AuthenModel::HasSettings ( void ) const [inline, virtual]

Reimplemented in AuthenSSH, AuthenPserver, AuthenRhosts, AuthenKserver, and AuthenNtserver.

Definition at line 75 of file Authen.h.

00075 { return false; }

virtual bool AuthenModel::HasUser ( void ) const [inline, virtual]

Reimplemented in AuthenSSH, AuthenPserver, AuthenRhosts, AuthenKserver, and AuthenNtserver.

Definition at line 77 of file Authen.h.

00077 { return false; }

virtual const char* AuthenModel::OnGetEnv ( char * env ) [inline, virtual]

Reimplemented in AuthenSSH, AuthenPserver, AuthenRhosts, AuthenKserver, and AuthenNtserver.

Definition at line 82 of file Authen.h.

Referenced by glue_getenv().

00082 { return 0L; }

void AuthenModel::OnRestoreEnv ( void ) [virtual]

Reimplemented in AuthenSSH, AuthenPserver, and AuthenRhosts.

Definition at line 336 of file Authen.cpp.

Referenced by AuthenRhosts::OnRestoreEnv(), AuthenPserver::OnRestoreEnv(), AuthenSSH::OnRestoreEnv(), and CAuthenSetUp::~CAuthenSetUp().

00337 {
00338     putenv("HOME=");
00339 }

void AuthenModel::OnSetupEnv ( void ) [virtual]

Reimplemented in AuthenSSH, AuthenPserver, and AuthenRhosts.

Definition at line 329 of file Authen.cpp.

Referenced by CAuthenSetUp::CAuthenSetUp(), AuthenRhosts::OnSetupEnv(), AuthenPserver::OnSetupEnv(), and AuthenSSH::OnSetupEnv().

00330 {
00331     UStr home("HOME=");
00332     home << gCvsPrefs.Home();
00333     putenv(home);
00334 }

Member Data Documentation

std::vector< AuthenModel *> * AuthenModel::m_instances = 0L [static, protected]

Definition at line 283 of file Authen.cpp.

The documentation for this class was generated from the following files:
  • common/Authen.h
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AuthenNtserver Class Reference

Inheritance diagram for AuthenNtserver:

[legend]
Collaboration diagram for AuthenNtserver:

[legend]
List of all members.

Public Methods

AuthenNtserver ()
virtual | ~AuthenNtserver ()
virtual AuthenKind | GetKind (void) const
virtual const char * | GetToken (void) const
virtual bool | HasSettings (void) const
virtual bool | HasHost (void) const
virtual bool | HasUser (void) const
virtual const char * | OnGetEnv (char *env)

Constructor & Destructor Documentation

AuthenNtserver::AuthenNtserver ( ) [inline]

Definition at line 1458 of file Authen.cpp.

01458 {}

virtual AuthenNtserver::~AuthenNtserver ( ) [inline, virtual]

Definition at line 1459 of file Authen.cpp.

01459 {}

Member Function Documentation

virtual AuthenKind AuthenNtserver::GetKind ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1461 of file Authen.cpp.

01461 { return ntserver; }

virtual const char* AuthenNtserver::GetToken ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1462 of file Authen.cpp.

01462 { return "ntserver"; }

virtual bool AuthenNtserver::HasHost ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1465 of file Authen.cpp.

01465 { return true; }

virtual bool AuthenNtserver::HasSettings ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1464 of file Authen.cpp.

01464 { return false; }

virtual bool AuthenNtserver::HasUser ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1466 of file Authen.cpp.

01466 { return true; }

const char * AuthenNtserver::OnGetEnv ( char * env ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1471 of file Authen.cpp.

01472 {
01473     return 0L;
01474 }

The documentation for this class was generated from the following file:
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AuthenPserver Class Reference

Inheritance diagram for AuthenPserver:

[legend]
Collaboration diagram for AuthenPserver:

[legend]
List of all members.

Public Methods

AuthenPserver ()
virtual | ~AuthenPserver ()
virtual AuthenKind | GetKind (void) const
virtual const char * | GetToken (void) const
virtual bool | HasSettings (void) const
virtual bool | HasHost (void) const
virtual bool | HasUser (void) const
virtual void | DoSettings (void)
virtual void | GetSettingsDesc (UStr &desc)
virtual const char * | OnGetEnv (char *env)
virtual void | OnSetupEnv (void)
virtual void | OnRestoreEnv (void)

Constructor & Destructor Documentation

AuthenPserver::AuthenPserver ( ) [inline]

Definition at line 943 of file Authen.cpp.

00943 {}

virtual AuthenPserver::~AuthenPserver ( ) [inline, virtual]

Definition at line 944 of file Authen.cpp.

00944 {}

Member Function Documentation

void AuthenPserver::DoSettings ( void ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1058 of file Authen.cpp.

01059 {
01060     UAuthen_Pserver *dlg = new UAuthen_Pserver();
01061
01062     try
01063     {
01064 #if qMacCvsPP
01065         dlg->DoModal(3002);
01066 #endif
01067 #ifdef WIN32
01068         dlg->DoModal(IDD_PSERVER);
01069 #endif
01070     }
01071     catch(...)
01072     {
01073     }
01074
01075     delete dlg;
01076 }

virtual AuthenKind AuthenPserver::GetKind ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 946 of file Authen.cpp.

00946 { return pserver; }

void AuthenPserver::GetSettingsDesc ( UStr & desc ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1078 of file Authen.cpp.

01079 {
01080     if(gCvsPrefs.PserverPort() == -1)
01081         desc << "Using default port and ";
01082     else
01083         desc << "Using port " << gCvsPrefs.PserverPort() << " and ";
01084
01085     if(!gCvsPrefs.UseProxy())
01086         desc << "no proxy";
01087     else
01088         desc << "using proxy host " << gCvsPrefs.ProxyHost() << " with port " << gCvsPrefs.ProxyPort();
01089 }

virtual const char* AuthenPserver::GetToken ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 947 of file Authen.cpp.

00947 { return "pserver"; }

virtual bool AuthenPserver::HasHost ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 950 of file Authen.cpp.

00950 { return true; }

virtual bool AuthenPserver::HasSettings ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 949 of file Authen.cpp.

00949 { return true; }

virtual bool AuthenPserver::HasUser ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 951 of file Authen.cpp.

00951 { return true; }

const char * AuthenPserver::OnGetEnv ( char * env ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1110 of file Authen.cpp.

01111 {
01112     if(strcmp(env, "CVS_PSERVER_PORT") == 0)
01113     {
01114         if(gCvsPrefs.PserverPort() != -1)
01115         {
01116             static char port[10];
01117             sprintf(port, "%d", gCvsPrefs.PserverPort());
01118             return port;
01119         }
01120
01121         return 0L;
01122     }
01123     return 0L;
01124 }

void AuthenPserver::OnRestoreEnv ( void ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1103 of file Authen.cpp.

01104 {
01105     AuthenModel::OnRestoreEnv();
01106
01107     putenv("CVS_PSERVER_PORT=");
01108 }

void AuthenPserver::OnSetupEnv ( void ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1091 of file Authen.cpp.

01092 {
01093     AuthenModel::OnSetupEnv();
01094
01095     UStr options("CVS_PSERVER_PORT=");
01096     if(gCvsPrefs.PserverPort() != -1)
01097     {
01098         options << gCvsPrefs.PserverPort();
01099         putenv(options);
01100     }
01101 }

The documentation for this class was generated from the following file:
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AuthenRhosts Class Reference

Inheritance diagram for AuthenRhosts:

[legend]
Collaboration diagram for AuthenRhosts:

[legend]
List of all members.

Public Methods

AuthenRhosts ()
virtual | ~AuthenRhosts ()
virtual AuthenKind | GetKind (void) const
virtual const char * | GetToken (void) const
virtual bool | HasSettings (void) const
virtual bool | HasHost (void) const
virtual bool | HasUser (void) const
virtual void | DoSettings (void)
virtual void | GetSettingsDesc (UStr &desc)
virtual const char * | OnGetEnv (char *env)
virtual void | OnSetupEnv (void)
virtual void | OnRestoreEnv (void)

Constructor & Destructor Documentation

AuthenRhosts::AuthenRhosts ( ) [inline]

Definition at line 1129 of file Authen.cpp.

01129 {}

virtual AuthenRhosts::~AuthenRhosts ( ) [inline, virtual]

Definition at line 1130 of file Authen.cpp.

01130 {}

Member Function Documentation

void AuthenRhosts::DoSettings ( void ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1253 of file Authen.cpp.

01254 {
01255     UAuthen_Rhosts *dlg = new UAuthen_Rhosts();
01256
01257     try
01258     {
01259 #if qMacCvsPP
01260         dlg->DoModal(3001);
01261 #endif
01262 #if WIN32
01263         dlg->DoModal(IDD_RSH);
01264 #endif
01265     }
01266     catch(...)
01267     {
01268     }
01269
01270     delete dlg;
01271 }

virtual AuthenKind AuthenRhosts::GetKind ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1132 of file Authen.cpp.

01132 { return rhosts; }

void AuthenRhosts::GetSettingsDesc ( UStr & desc ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1273 of file Authen.cpp.

01274 {
01275     if(gCvsPrefs.RhostPort() == -1)
01276         desc << "Using default port and ";
01277     else
01278         desc << "Using port " << gCvsPrefs.RhostPort() << " and ";
01279
01280     if(gCvsPrefs.RshName() == 0L)
01281         desc << "default shell name";
01282     else
01283         desc << "shell named " << gCvsPrefs.RshName();
01284 }

virtual const char* AuthenRhosts::GetToken ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1133 of file Authen.cpp.

01133 { return "rhosts"; }

virtual bool AuthenRhosts::HasHost ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1136 of file Authen.cpp.

01136 { return true; }

virtual bool AuthenRhosts::HasSettings ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1135 of file Authen.cpp.

01135 { return true; }

virtual bool AuthenRhosts::HasUser ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 1137 of file Authen.cpp.

01137 { return true; }

const char * AuthenRhosts::OnGetEnv ( char * env ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1321 of file Authen.cpp.

01322 {
01323     if(strcmp(env, "CVS_RSH") == 0)
01324     {
01325         return (char *)gCvsPrefs.RshName();
01326     }
01327     else if(strcmp(env, "CVS_RCMD_PORT") == 0)
01328     {
01329         if(gCvsPrefs.RhostPort() != -1)
01330         {
01331             static char port[10];
01332             sprintf(port, "%d", gCvsPrefs.RhostPort());
01333             return port;
01334         }
01335
01336         return 0L;
01337     }
01338     else if(strcmp(env, "CVS_SERVER") == 0)
01339     {
01340         return (char *)gCvsPrefs.ServerName();
01341     }
01342     return 0L;
01343 }

void AuthenRhosts::OnRestoreEnv ( void ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1312 of file Authen.cpp.

01313 {
01314     AuthenModel::OnRestoreEnv();
01315
01316     putenv("CVS_RSH=");
01317     putenv("CVS_RCMD_PORT=");
01318     putenv("CVS_SERVER=");
01319 }

void AuthenRhosts::OnSetupEnv ( void ) [virtual]

Reimplemented from AuthenModel.

Definition at line 1286 of file Authen.cpp.

01287 {
01288     AuthenModel::OnSetupEnv();
01289
01290     UStr rsh("CVS_RSH=");
01291     if(gCvsPrefs.RshName() != 0L)
01292     {
01293         rsh << gCvsPrefs.RshName();
01294         putenv(rsh);
01295     }
01296
01297     UStr port("CVS_RCMD_PORT=");
01298     if(gCvsPrefs.RhostPort() != -1)
01299     {
01300         port << gCvsPrefs.RhostPort();
01301         putenv(port);
01302     }
01303
01304     UStr server("CVS_SERVER=");
01305     if(gCvsPrefs.ServerName() != 0L)
01306     {
01307         server << gCvsPrefs.ServerName();
01308         putenv(server);
01309     }
01310 }

The documentation for this class was generated from the following file:
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CAuthenSetUp Class Reference

List of all members.

Public Methods

CAuthenSetUp ()
~CAuthenSetUp ()

Constructor & Destructor Documentation

CAuthenSetUp::CAuthenSetUp ( ) [inline]

Definition at line 415 of file AppGlue.cpp.

00416     {
00417         AuthenModel *curModel = AuthenModel::GetInstance(gAuthen.kind());
00418         if(curModel != 0L)
00419             curModel->OnSetupEnv();
00420     }

CAuthenSetUp::~CAuthenSetUp ( ) [inline]

Definition at line 422 of file AppGlue.cpp.

00423     {
00424         AuthenModel *curModel = AuthenModel::GetInstance(gAuthen.kind());
00425         if(curModel != 0L)
00426             curModel->OnRestoreEnv();
00427     }

The documentation for this class was generated from the following file:
  • common/AppGlue.cpp
Generated on Sun Oct 21 12:45:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


AuthenSSH Class Reference

Inheritance diagram for AuthenSSH:

[legend]
Collaboration diagram for AuthenSSH:

[legend]
List of all members.

Public Methods

AuthenSSH ()
virtual | ~AuthenSSH ()
virtual AuthenKind | GetKind (void) const
virtual const char * | GetToken (void) const
virtual bool | HasSettings (void) const
virtual bool | HasHost (void) const
virtual bool | HasUser (void) const
virtual void | DoSettings (void)
virtual void | GetSettingsDesc (UStr &desc)
virtual const char * | OnGetEnv (char *env)
virtual void | OnSetupEnv (void)
virtual void | OnRestoreEnv (void)

Static Public Methods

const char * | RsaIdentityFile (void)

Static Public Attributes

PCStr gSSHName
PCStr gSSHOptions
CPersistentBool gRsaIdentity
CMString gRsaIdentityFile
PCStr gCurRsaIdentity

Constructor & Destructor Documentation

AuthenSSH::AuthenSSH ( ) [inline]

Definition at line 582 of file Authen.cpp.

00582 {}

virtual AuthenSSH::~AuthenSSH ( ) [inline, virtual]

Definition at line 583 of file Authen.cpp.

00583 {}

Member Function Documentation

void AuthenSSH::DoSettings ( void ) [virtual]

Reimplemented from AuthenModel.

Definition at line 830 of file Authen.cpp.

00831 {
00832     UAuthen_SSH *dlg = new UAuthen_SSH();
00833
00834     try
00835     {
00836 #ifdef WIN32
00837         dlg->DoModal(IDD_SSH);
00838 #endif
00839     }
00840     catch(...)
00841     {
00842     }
00843
00844     delete dlg;
00845 }

virtual AuthenKind AuthenSSH::GetKind ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 585 of file Authen.cpp.

00585 { return ssh; }

void AuthenSSH::GetSettingsDesc ( UStr & desc ) [virtual]

Reimplemented from AuthenModel.

Definition at line 847 of file Authen.cpp.

00848 {
00849     if(!gSSHOptions.empty())
00850     {
00851         desc << "Using ";
00852         desc << gSSHOptions.c_str();
00853         desc << " ";
00854     }
00855
00856     if((bool)gRsaIdentity)
00857     {
00858         if(gSSHOptions.empty())
00859             desc << "Using ";
00860         desc << "-i ";
00861         desc << RsaIdentityFile();
00862     }
00863 }

virtual const char* AuthenSSH::GetToken ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 586 of file Authen.cpp.

00586 { return "ssh"; }

virtual bool AuthenSSH::HasHost ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 589 of file Authen.cpp.

00589 { return true; }

virtual bool AuthenSSH::HasSettings ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 588 of file Authen.cpp.

00588 { return true; }

virtual bool AuthenSSH::HasUser ( void ) const [inline, virtual]

Reimplemented from AuthenModel.

Definition at line 590 of file Authen.cpp.

00590 { return true; }

const char * AuthenSSH::OnGetEnv ( char * env ) [virtual]

Reimplemented from AuthenModel.

Definition at line 901 of file Authen.cpp.

00902 {
00903     if(strcmp(env, "CVS_RSH") == 0)
00904     {
00905         return gSSHName.empty() ? "ssh" : (char *)gSSHName.c_str();
00906     }
00907     else if( strcmp(env, "CVS_RSA_OPTIONS") == 0)
00908     {
00909         return gSSHOptions.empty() ? 0L : (char *)gSSHOptions.c_str();
00910     }
00911     else if( strcmp(env, "CVS_RSA_IDENTITY") == 0 && (bool)gRsaIdentity)
00912     {
00913         const char *tmp = RsaIdentityFile();
00914         if( tmp && *tmp )
00915         {
00916 #ifdef WIN32
00917             while( *tmp && iswspace( *tmp ) )
00918 #else
00919             while( *tmp && isspace( *tmp ) )
00920 #endif
00921                 tmp++;
00922
00923             return *tmp ? (char *)tmp : 0L;
00924         }
00925         return 0L;
00926     }
00927     return 0L;
00928 }

void AuthenSSH::OnRestoreEnv ( void ) [virtual]

Reimplemented from AuthenModel.

Definition at line 892 of file Authen.cpp.

00893 {
00894     AuthenModel::OnRestoreEnv();
00895
00896     putenv("CVS_RSH=");
00897     putenv("CVS_RSA_OPTIONS=");
00898     putenv("CVS_RSA_IDENTITY=");
00899 }

void AuthenSSH::OnSetupEnv ( void ) [virtual]

Reimplemented from AuthenModel.

Definition at line 865 of file Authen.cpp.

00866 {
00867     AuthenModel::OnSetupEnv();
00868
00869     UStr rsh("CVS_RSH=");
00870     if(gSSHName.empty())
00871         rsh << "ssh";
00872     else
00873         rsh << gSSHName.c_str();
00874
00875     putenv(rsh);
00876
00877     UStr options("CVS_RSA_OPTIONS=");
00878     if(!gSSHOptions.empty())
00879     {
00880         options << gSSHOptions.c_str();
00881         putenv(options);
00882     }
00883
00884     UStr identity("CVS_RSA_IDENTITY=");
00885     if((bool)gRsaIdentity)
00886     {
00887         identity << RsaIdentityFile();
00888         putenv(identity);
00889     }
00890 }

const char * AuthenSSH::RsaIdentityFile ( void ) [static]

Definition at line 615 of file Authen.cpp.

Referenced by UAuthen_SSH::DoDataExchange(), GetSettingsDesc(), OnGetEnv(), and OnSetupEnv().

00616 {
00617     if(gRsaIdentityFile.GetList().size() != 0)
00618         gCurRsaIdentity = gRsaIdentityFile.GetList()[0];
00619
00620 #ifdef WIN32
00621     // Fill in a default value, if one empty slot
00622     if( gCurRsaIdentity.empty())
00623     {
00624         char *env = getenv( "HOME" );
00625         if(env != 0L )
00626         {
00627             char default_identity_folder[] = ".ssh/identity";
00628             char default_identity[ MAX_PATH ];
00629             _makepath( default_identity, NULL, env, default_identity_folder, NULL );
00630             gCurRsaIdentity = default_identity;
00631         }
00632     }
00633 #endif
00634
00635     return gCurRsaIdentity.empty() ? 0L : (const char *)gCurRsaIdentity;
00636 }

Member Data Documentation

PCStr AuthenSSH::gCurRsaIdentity [static]

CPersistentBool AuthenSSH::gRsaIdentity [static]

CMString AuthenSSH::gRsaIdentityFile [static]

PCStr AuthenSSH::gSSHName [static]

PCStr AuthenSSH::gSSHOptions [static]

The documentation for this class was generated from the following file:
  • common/Authen.cpp
Generated on Sun Oct 21 12:45:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


awidget Class Reference

Collaboration diagram for awidget:

[legend]
List of all members.

Public Methods

awidget (HBITMAP b, int c, const char *t, UTB_VAR v)
awidget ()
awidget (const awidget &src)
virtual | ~awidget ()
awidget & | operator= (const awidget &src)

Public Attributes

aref bitmap
int | cmd
char * | tooltip
UTB_VAR var

Constructor & Destructor Documentation

awidget::awidget | ( | HBITMAP | b,
 |  | int | c,
 |  | const char * | t,
 |  | UTB_VAR | v
 | ) | [inline]

Definition at line 154 of file utoolbar.cpp.

00154                                                         :
00155         bitmap(b), cmd(c), tooltip(0L), var(v)
00156     {
00157         if(t != 0L)
00158             tooltip = strdup(t);
00159     }

awidget::awidget ( ) [inline]

Definition at line 160 of file utoolbar.cpp.

00160               : bitmap(0L), cmd(0), tooltip(0L)
00161     {
00162     }

awidget::awidget ( const awidget & src ) [inline]

Definition at line 163 of file utoolbar.cpp.

00164     {
00165         *this = src;
00166     }

virtual awidget::~awidget ( ) [inline, virtual]

Definition at line 168 of file utoolbar.cpp.

00169     {
00170         if(tooltip != 0L)
00171             free(tooltip);
00172     }

Member Function Documentation

awidget& awidget::operator= ( const awidget & src ) [inline]

Definition at line 174 of file utoolbar.cpp.

00175     {
00176         bitmap = src.bitmap;
00177         cmd = src.cmd;
00178         var = src.var;
00179         tooltip = src.tooltip != 0L ? strdup(src.tooltip) : 0L;
00180
00181         return *this;
00182     }

Member Data Documentation

aref awidget::bitmap

Definition at line 183 of file utoolbar.cpp.

Referenced by operator=().

int awidget::cmd

Definition at line 184 of file utoolbar.cpp.

Referenced by UToolbar::OnUpdateUI(), WININFO::Search(), and operator=().

char* awidget::tooltip

Definition at line 185 of file utoolbar.cpp.

Referenced by UToolbar::OnSetTooltip(), and operator=().

UTB_VAR awidget::var

Definition at line 186 of file utoolbar.cpp.

Referenced by operator=().

The documentation for this class was generated from the following file:
  • rf/utoolbar.cpp
Generated on Sun Oct 21 12:45:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CBarConsole Class Reference

#include <ConsoleBar.h>

Inheritance diagram for CBarConsole:

[legend]
Collaboration diagram for CBarConsole:

[legend]
List of all members.

Public Methods

CBarConsole ()
virtual | ~CBarConsole ()

Public Attributes

CWincvsView * m_view

Protected Methods

afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)

Constructor & Destructor Documentation

CBarConsole::CBarConsole ( )

Definition at line 39 of file ConsoleBar.cpp.

00039                          : m_view(0L)
00040 {
00041     // TODO: add construction code here.
00042 }

CBarConsole::~CBarConsole ( ) [virtual]

Definition at line 44 of file ConsoleBar.cpp.

00045 {
00046     // TODO: add destruction code here.
00047 }

Member Function Documentation

int CBarConsole::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Reimplemented from CCJControlBar.

Definition at line 58 of file ConsoleBar.cpp.

00059 {
00060     if (CCJControlBar::OnCreate(lpCreateStruct) == -1)
00061         return -1;
00062
00063     m_view = (CWincvsView *)RUNTIME_CLASS(CWincvsView)->CreateObject();
00064     if(m_view == 0L)
00065     {
00066         TRACE0("Failed to create view for CBarConsole\n");
00067         return -1;
00068     }
00069
00070     // TODO: Add your specialized creation code here
00071     if (!m_view->Create(NULL, "",WS_CHILD | WS_VISIBLE | WS_BORDER,
00072         CRect(0,0,0,0), this, 0/*IDC_LIST_CTRL_2*/))
00073     {
00074         TRACE0("Failed to create view for CMyBarLeft\n");
00075         return -1;
00076     }
00077
00078     SetChild(m_view);
00079
00080     return 0;
00081 }

Member Data Documentation

CWincvsView* CBarConsole::m_view

Definition at line 45 of file ConsoleBar.h.

Referenced by CMainFrame::GetConsoleView().

The documentation for this class was generated from the following files:
  • WinCvs/ConsoleBar.h
  • WinCvs/ConsoleBar.cpp
Generated on Sun Oct 21 12:45:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CBrowseFileView Class Reference

#include <BrowseFileView.h>

Inheritance diagram for CBrowseFileView:

[legend]
Collaboration diagram for CBrowseFileView:

[legend]
List of all members.

Public Methods

void | OnFilteringChanged ()
void | ResetView (const char *path, bool notifyBrowser=false, const char *selectFile=0L)
void | ResetView (bool notifyBrowser=false, const char *selectFile=0L)
void | CheckChanges (void)
void | Resort (void)
void | InvalidateView (void)
CFrameWnd * GetMainFrame ()
void | ProcessSelectionCommand (KiSelectionHandler *handler)
void | SaveColumns ()
bool | LoadColumns ()
KiColumnModel * | GetColumnModel () const
void | AddColumns ()
void | DeleteColumns ()
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
virtual | ~CBrowseFileView ()
BOOL | SetViewType (DWORD dwViewType)
DWORD | GetViewType ()
const UStr & | GetPath () const

Static Public Methods

int | GetImageForEntry (EntnodeData *data)

Protected Methods

CBrowseFileView ()
bool | DisableCommon (bool bCheckSelection=true)
virtual void | OnInitialUpdate ()
virtual void | OnBeginPrinting (CDC *pDC, CPrintInfo *pInfo)
virtual BOOL | OnPreparePrinting (CPrintInfo *pInfo)
virtual void | OnPrint (CDC *pDC, CPrintInfo *pInfo)
void | GetEntriesModTime (time_t &newEntriesMod, time_t &newEntriesLogMod)
void | EditSel (EntnodeData *data, bool useDefault=false)
void | DoDrag ()
void | SetRecursive (bool isRecursive)
afx_msg void | OnViewSmallIcons ()
afx_msg void | OnViewList ()
afx_msg void | OnViewFullRowDetails ()
afx_msg void | OnUpdateViewSmallIcons (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewAdd (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewAddB (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewUpdate (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewRelease (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewRmv (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewGraph (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewList (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewEditseldef (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewFullRowDetails (CCmdUI *pCmdUI)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnLButtonDblClk (UINT nFlags, CPoint point)
afx_msg void | OnColumnclick (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnViewAdd ()
afx_msg void | OnViewAddb ()
afx_msg void | OnViewCommit ()
afx_msg void | OnViewRmv ()
afx_msg void | OnViewUpdate ()
afx_msg void | OnViewQueryUpdate ()
afx_msg void | OnUpdateViewReload (CCmdUI *pCmdUI)
afx_msg void | OnViewReload ()
afx_msg void | OnKeydown (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnViewUpone ()
afx_msg void | OnUpdateViewUpone (CCmdUI *pCmdUI)
afx_msg void | OnViewTrash ()
afx_msg void | OnUpdateViewTrash (CCmdUI *pCmdUI)
afx_msg void | OnViewDiff ()
afx_msg void | OnViewLog ()
afx_msg void | OnViewGraph ()
afx_msg void | OnViewStatus ()
afx_msg void | OnViewLock ()
afx_msg void | OnViewUnlock ()
afx_msg void | OnViewWatchOn ()
afx_msg void | OnViewWatchOff ()
afx_msg void | OnViewEdit ()
afx_msg void | OnViewUnedit ()
afx_msg void | OnViewWatchers ()
afx_msg void | OnViewEditors ()
afx_msg void | OnViewRelease ()
afx_msg void | OnViewTagNew ()
afx_msg void | OnViewTagDelete ()
afx_msg void | OnViewTagBranch ()
afx_msg void | OnRButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnViewExplore ()
afx_msg void | OnUpdateViewExplore (CCmdUI *pCmdUI)
afx_msg void | OnTimer (UINT nIDEvent)
afx_msg void | OnViewEditsel ()
afx_msg void | OnViewEditseldef ()
afx_msg void | OnViewCheckout ()
afx_msg void | OnUpdateViewCheckout (CCmdUI *pCmdUI)
afx_msg void | OnViewImport ()
afx_msg void | OnUpdateViewImport (CCmdUI *pCmdUI)
afx_msg void | OnBegindrag (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnBeginrdrag (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg BOOL | OnSetCursor (CWnd *pWnd, UINT nHitTest, UINT message)
afx_msg void | OnDeleteitem (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnDestroy ()
afx_msg void | OnUpdateQueryAnnotate (CCmdUI *pCmdUI)
afx_msg void | OnQueryAnnotate ()
afx_msg void | OnEditSelectAll ()
afx_msg void | OnUpdateMacro (CCmdUI *pCmdUI)
afx_msg BOOL | OnMacro (UINT nID)
afx_msg void | OnUpdateCustomize (CCmdUI *pCmdUI)
afx_msg BOOL | OnCustomize (UINT nID)
afx_msg LRESULT | OnFileChange (WPARAM, LPARAM)
afx_msg LRESULT | OnResetView (WPARAM, LPARAM)
void | SetFullRowSel (BOOL bFullRowSel)

Protected Attributes

CSortHeaderCtrl m_ctrlHeader
UStr m_path
time_t | m_entriesMod
time_t | m_entriesLogMod
int | m_sort
bool | m_ascendant
KiColumnModel * m_modelColumns
bool | m_checkChanges
int | m_numberOfLines
int | m_numberByPages
int | m_numberOfPages
int | m_heightOfLines
bool | m_isRecursive
KoWatcher * m_watch
bool | m_isResetViewLocked
bool | m_isFilesChange
UINT | m_uiFilechangeTimer
bool | m_isResetViewPending

Static Protected Attributes

CImageList | m_SmallImageList
CImageList | m_StateImageList

Constructor & Destructor Documentation

CBrowseFileView::CBrowseFileView ( ) [protected]

Definition at line 391 of file BrowseFileView.cpp.

00392 : m_checkChanges(false)
00393 , m_watch(NULL)
00394 , m_isResetViewLocked(false)
00395 , m_isFilesChange(false)
00396 , m_isResetViewPending(false)
00397 , m_uiFilechangeTimer(0)
00398 {
00399     m_sort = (int)gFileViewSort;
00400     SetRecursive(false);
00401     m_ascendant = (bool)gFileViewSortAsc;
00402     m_entriesMod = 0;
00403     m_entriesLogMod = 0;
00404 }

CBrowseFileView::~CBrowseFileView ( ) [virtual]

Definition at line 406 of file BrowseFileView.cpp.

00407 {
00408     gFileViewSortAsc = m_ascendant;
00409     gFileViewSort = m_sort;
00410 }

Member Function Documentation

void CBrowseFileView::AddColumns ( )

Definition at line 538 of file BrowseFileView.cpp.

Referenced by OnInitialUpdate(), and ResetView().

00539 {
00540     KiColumnModel* model = GetColumnModel();
00541     int columnCount = model->GetCount();
00542     CListCtrl& listCtrl = GetListCtrl();
00543     for(int i = 0; i<columnCount; i++)
00544     {
00545         LV_COLUMN lvc;
00546         model->GetAt(i)->GetSetupData(&lvc);
00547         lvc.iSubItem = i;
00548         lvc.mask |= LVCF_SUBITEM;
00549         listCtrl.InsertColumn(i,&lvc);
00550     }
00551 }

void CBrowseFileView::CheckChanges ( void ) [inline]

Definition at line 89 of file BrowseFileView.h.

00089 { m_checkChanges = true; }

void CBrowseFileView::DeleteColumns ( )

Definition at line 553 of file BrowseFileView.cpp.

Referenced by ResetView().

00554 {
00555     KiColumnModel* model = GetColumnModel();
00556     int columnCount = model->GetCount();
00557     CListCtrl& listCtrl = GetListCtrl();
00558     for(int i = 0; i<columnCount; i++)
00559     {
00560         listCtrl.DeleteColumn(0);
00561     }
00562 }

bool CBrowseFileView::DisableCommon ( bool bCheckSelection = true ) [protected]

Definition at line 882 of file BrowseFileView.cpp.

Referenced by OnRButtonDown(), OnUpdateMacro(), OnUpdateQueryAnnotate(), OnUpdateViewAdd(), OnUpdateViewAddB(), OnUpdateViewCheckout(), OnUpdateViewEditseldef(), OnUpdateViewExplore(), OnUpdateViewGraph(), OnUpdateViewImport(), OnUpdateViewRelease(), OnUpdateViewRmv(), OnUpdateViewTrash(), and OnUpdateViewUpdate().

00883 {
00884     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00885     CListCtrl& ListCtrl = GetListCtrl();
00886     bool bCommon = app->gCvsRunning || gCvsPrefs.empty();
00887     bool bSelection = ListCtrl.GetSelectedCount() == 0 || this != CWnd::GetFocus();
00888
00889     return bCheckSelection ? bCommon || bSelection : bCommon;
00890 }

void CBrowseFileView::DoDrag ( ) [protected]

Definition at line 1799 of file BrowseFileView.cpp.

Referenced by OnBegindrag(), and OnBeginrdrag().

01800 {
01801     CListCtrl& ListCtrl = GetListCtrl();
01802     int nItem=-1;
01803     int nSize = 0;
01804     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01805     {
01806         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01807         if(data->GetType()!=ENT_SUBDIR)
01808         {
01809             UStr buf;
01810             const char* fullpath = data->GetFullPathName(buf);
01811             nSize += strlen(fullpath) + 1;
01812         }
01813     }
01814     if(nSize>0)
01815     {
01816         HGLOBAL hMem = GlobalAlloc(GMEM_FIXED, sizeof(DROPFILES)+nSize+1);
01817         if(hMem!=NULL)
01818         {
01819             DROPFILES& df = *reinterpret_cast<DROPFILES*>(hMem);
01820             df.pFiles = sizeof(DROPFILES);
01821             df.fNC = FALSE;
01822             df.pt.x = df.pt.y = 0;
01823             df.fWide = FALSE;
01824
01825             nItem=-1;
01826             int Offset = sizeof(DROPFILES);
01827             while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01828             {
01829                 EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01830                 if(data->GetType()!=ENT_SUBDIR)
01831                 {
01832                     UStr buf;
01833                     const char* fullpath = data->GetFullPathName(buf);
01834                     int len = strlen(fullpath) + 1;
01835                     memcpy(reinterpret_cast<BYTE*>(hMem)+Offset, fullpath, len);
01836                     Offset+=len;
01837                 }
01838             }
01839             reinterpret_cast<BYTE*>(hMem)[Offset]=0;
01840
01841             COleDataSource ds;
01842             ds.CacheGlobalData( CF_HDROP, hMem );
01843             ds.DoDragDrop( DROPEFFECT_COPY );
01844         }
01845     }
01846 }

void CBrowseFileView::EditSel | ( | EntnodeData * | data,
 |  | bool | useDefault = false
 | ) | [protected]

Definition at line 836 of file BrowseFileView.cpp.

Referenced by OnKeydown(), OnLButtonDblClk(), OnViewEditsel(), and OnViewEditseldef().

00837 {
00838     UStr buf;
00839     const char* fullpath = data->GetFullPathName(buf);
00840     if(data->GetType() == ENT_SUBDIR)
00841     {
00842         struct stat st;
00843         if (stat(fullpath, &st) != 0 && errno == ENOENT)
00844         {
00845             // Assume we're looking at directory previously in CVS,
00846             // but not currently in the filesystem.
00847             // If we ever run across another case (permissions perhaps)
00848             // then you might want to add code here.
00849             cvs_err("'%s' is not accessible\n", (char*)fullpath);
00850         }
00851         else
00852         {
00853             ResetView(fullpath, true);
00854             gCvsPrefs.SetLastWorkingDir(fullpath);
00855         }
00856     }
00857     else
00858     {
00859         LaunchViewer(fullpath, useDefault);
00860     }
00861 }

KiColumnModel* CBrowseFileView::GetColumnModel ( ) const [inline]

Definition at line 117 of file BrowseFileView.h.

Referenced by AddColumns(), DeleteColumns(), OnColumnclick(), OnPrint(), ResetView(), and Resort().

00118     {
00119         return m_modelColumns;
00120     }

void CBrowseFileView::GetEntriesModTime | ( | time_t & | newEntriesMod,
 |  | time_t & | newEntriesLogMod
 | ) | [protected]

Definition at line 564 of file BrowseFileView.cpp.

Referenced by OnTimer(), and ResetView().

00566 {
00567     newEntriesMod = 0;
00568     newEntriesLogMod = 0;
00569     if(chdir(m_path) != 0)
00570         return;
00571     if(chdir("CVS") != 0)
00572         return;
00573
00574     struct stat sb;
00575     if (stat("Entries", &sb) != -1)
00576         newEntriesMod = sb.st_mtime;
00577     if (stat("Entries.log", &sb) != -1)
00578         newEntriesLogMod = sb.st_mtime;
00579     chdir(m_path);
00580 }

int CBrowseFileView::GetImageForEntry ( EntnodeData * data ) [static]

Definition at line 425 of file BrowseFileView.cpp.

00426 {
00427     int result;
00428     if(data->GetType() == ENT_FILE)
00429     {
00430         const char *info = 0L;
00431         if(data->IsIgnored())
00432         {
00433             result = kFileIconIgnored;
00434         }
00435         else if(data->IsUnknown())
00436         {
00437             result = kFileIconUnknown;
00438         }
00439         else if(data->GetConflict() != 0L)
00440         {
00441             result = kFileIconConflict;
00442         }
00443         else if(data->IsRemoved())
00444         {
00445             result = kFileIconRemoved;
00446         }
00447         else if((info = (*data)[EntnodeFile::kOption]) != 0L && strcmp(info, "-kb") == 0)
00448         {
00449             const char* vn = (*data)[EntnodeFile::kVN];
00450             bool isAdded = vn && (strcmp(vn, "0") == 0);
00451
00452             result = data->IsUnmodified() ? kFileIconBinary :
00453                 isAdded ? kFileIconBinaryAdded : kFileIconBinaryMod;
00454         }
00455         else
00456         {
00457             const char* vn = (*data)[EntnodeFile::kVN];
00458             bool isAdded = vn && (strcmp(vn, "0") == 0);
00459
00460             result = data->IsUnmodified() ? kFileIconText :
00461                 isAdded ? kFileIconAdded : kFileIconTextMod;
00462         }
00463     }
00464     else
00465     {
00466         if(data->IsIgnored())
00467         {
00468             result = kFolderIconIgnored;
00469         }
00470         else if(data->IsUnknown())
00471         {
00472             result = kFolderIconUnknown;
00473         }
00474         else
00475         {
00476             result = kFolderIcon;
00477         }
00478     }
00479
00480     return result;
00481 }

CFrameWnd* CBrowseFileView::GetMainFrame ( ) [inline]

Definition at line 104 of file BrowseFileView.h.

00104 { return GetRoutingFrame(); }

const UStr& CBrowseFileView::GetPath ( ) const [inline]

Definition at line 283 of file BrowseFileView.h.

Referenced by CWincvsApp::InitInstance(), OnPrint(), ProcessSelectionCommand(), and Resort().

00283 { return m_path; };

DWORD CBrowseFileView::GetViewType ( )

Definition at line 793 of file BrowseFileView.cpp.

Referenced by OnUpdateViewFullRowDetails(), OnUpdateViewList(), OnUpdateViewSmallIcons(), OnViewFullRowDetails(), OnViewList(), and OnViewSmallIcons().

00794 {
00795     return(GetStyle() & LVS_TYPEMASK);
00796 }

void CBrowseFileView::InvalidateView ( void )

Definition at line 412 of file BrowseFileView.cpp.

00413 {
00414     m_entriesMod = 0;
00415 }

bool CBrowseFileView::LoadColumns ( )

Definition at line 1912 of file BrowseFileView.cpp.

Referenced by OnInitialUpdate().

01913 {
01914     CString widths = AfxGetApp()->GetProfileString("FileDetailView", "Column Widths");
01915     CString orders  = AfxGetApp()->GetProfileString("FileDetailView", "Column Order");
01916     if (widths.IsEmpty() || orders.IsEmpty())
01917     {
01918         return false;
01919     }
01920
01921     int count = m_ctrlHeader.GetItemCount();
01922     int order[128];
01923     for (int i = 0; i < count; ++i)
01924     {
01925         CString strSubString;
01926         AfxExtractSubString( strSubString, widths, i, _T(' '));
01927         int width =  _ttoi( strSubString );
01928         GetListCtrl().SetColumnWidth(i, width);
01929
01930         AfxExtractSubString( strSubString, orders, i, _T(' '));
01931         order[i] =  _ttoi( strSubString );
01932     }
01933     m_ctrlHeader.SetOrderArray(count, order);
01934
01935     return true;
01936 }

void CBrowseFileView::OnBeginPrinting | ( | CDC * | pDC,
 |  | CPrintInfo * | pInfo
 | ) | [protected, virtual]

Definition at line 1591 of file BrowseFileView.cpp.

01592 {
01593     CListView::OnBeginPrinting(pDC, pInfo);
01594
01595     int nPageHeight = pDC->GetDeviceCaps(VERTRES);
01596     TEXTMETRIC tm;
01597     pDC->GetTextMetrics(&tm);
01598
01599     // compute the bounds
01600     CListCtrl& ListCtrl = GetListCtrl();
01601     m_numberOfLines = ListCtrl.GetItemCount();
01602     m_heightOfLines = 2 * tm.tmHeight;
01603     m_numberByPages = nPageHeight / m_heightOfLines;
01604     m_numberOfPages = m_numberOfLines / m_numberByPages + 1;
01605
01606     pInfo->SetMaxPage(m_numberOfPages);
01607 }

void CBrowseFileView::OnBegindrag | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 1848 of file BrowseFileView.cpp.

01849 {
01850     DoDrag();
01851     *pResult = 0;
01852 }

void CBrowseFileView::OnBeginrdrag | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 1854 of file BrowseFileView.cpp.

01855 {
01856     DoDrag();
01857     *pResult = 0;
01858 }

void CBrowseFileView::OnColumnclick | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 1105 of file BrowseFileView.cpp.

01106 {
01107     NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
01108     CListCtrl& ListCtrl = GetListCtrl();
01109
01110     if(pNMListView->iSubItem == m_sort)
01111         m_ascendant = !m_ascendant;
01112     else
01113     {
01114         m_ascendant = true;
01115         m_sort = pNMListView->iSubItem;
01116         KiColumnModel* model = GetColumnModel();
01117         m_ascendant = model->GetAt(m_sort)->IsDefaultAscending();
01118     }
01119
01120     Resort();
01121     *pResult = 0;
01122 }

BOOL CBrowseFileView::OnCustomize ( UINT nID ) [protected]

Definition at line 1426 of file BrowseFileView.cpp.

01427 {
01428     CustomizeMenus(nID == ID_CUST_FILES_MENU ? kCustomFilesMenu : kCustomBrowserMenu);
01429     return TRUE;
01430 }

void CBrowseFileView::OnDeleteitem | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 1960 of file BrowseFileView.cpp.

01961 {
01962     NM_LISTVIEW* p = (NM_LISTVIEW*)pNMHDR;
01963     if (p->lParam)
01964     {
01965         EntnodeData* data = (EntnodeData*)(LPVOID)p->lParam;
01966         data->UnRef();
01967     }
01968     *pResult = 0;
01969 }

void CBrowseFileView::OnDestroy ( void ) [protected]

Definition at line 1860 of file BrowseFileView.cpp.

01861 {
01862     SaveColumns();
01863     if(m_watch)
01864     {
01865         m_watch->SignalTerminate();
01866         m_watch = NULL;
01867     }
01868
01869     // unregister notifications
01870     if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
01871     {
01872         app->GetFilterModel()->GetNotificationManager()->CheckOut(this);
01873         app->GetRecursionModel()->GetNotificationManager()->CheckOut(this);
01874         app->GetIgnoreModel()->GetNotificationManager()->CheckOut(this);
01875     }
01876
01877     //kill the timer
01878     if( m_uiFilechangeTimer )
01879     {
01880         KillTimer(m_uiFilechangeTimer);
01881     }
01882
01883     CListView::OnDestroy();
01884 }

void CBrowseFileView::OnEditSelectAll ( ) [protected]

Definition at line 2010 of file BrowseFileView.cpp.

02011 {
02012     CListCtrl& ListCtrl = GetListCtrl();
02013
02014     for( int nIndex = 0; nIndex < ListCtrl.GetItemCount(); nIndex++ )
02015     {
02016         EntnodeData *data = (EntnodeData*)ListCtrl.GetItemData(nIndex);
02017         if( data->GetType() == ENT_FILE )
02018         {
02019             ListCtrl.SetItemState(nIndex, LVIS_SELECTED, LVIS_SELECTED);
02020         }
02021     }
02022
02023     if( ListCtrl.GetSelectedCount() )
02024     {
02025         ListCtrl.SetFocus();
02026     }
02027 }

LRESULT CBrowseFileView::OnFileChange | ( | WPARAM | ,
 |  | LPARAM |
 | ) | [protected]

Definition at line 1574 of file BrowseFileView.cpp.

01575 {
01576     m_isFilesChange = true;
01577     return 0;
01578 }

void CBrowseFileView::OnFilteringChanged ( )

Definition at line 1951 of file BrowseFileView.cpp.

01952 {
01953     if (!m_isResetViewPending)
01954     {
01955         m_isResetViewPending = true;
01956         PostMessage(WM_RESETVIEW);
01957     }
01958 }

void CBrowseFileView::OnInitialUpdate ( ) [protected, virtual]

Definition at line 494 of file BrowseFileView.cpp.

00495 {
00496     CListView::OnInitialUpdate();
00497
00498     CListCtrl& ListCtrl = GetListCtrl();
00499
00500     // Replace standard header with sort header
00501     if (HWND hWnd = ListView_GetHeader(ListCtrl.m_hWnd))
00502     {
00503         m_ctrlHeader.SubclassWindow(hWnd);
00504     }
00505     ListCtrl.SetExtendedStyle(LVS_EX_HEADERDRAGDROP);
00506
00507 // set image lists
00508     if(m_SmallImageList.m_hImageList == 0L)
00509         m_SmallImageList.Create(IDB_SMALLICONS, 16, 1, RGB(255, 255, 255));
00510     if(m_StateImageList.m_hImageList == 0L)
00511         m_StateImageList.Create(IDR_STATEICONS, 16, 1, RGB(255, 0, 0));
00512
00513     ListCtrl.SetImageList(&m_SmallImageList, LVSIL_SMALL);
00514     ListCtrl.SetImageList(&m_StateImageList, LVSIL_STATE);
00515
00516     KoTraversalContext context(this);
00517     SetRecursive(context.IsRecursive());
00518     AddColumns();
00519     SetFullRowSel(TRUE);
00520
00521     LoadColumns();
00522
00523     // register for notifications on filter change
00524     if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
00525     {
00526         app->GetFilterModel()->GetNotificationManager()->CheckIn(this, onFilteringChanged);
00527         app->GetRecursionModel()->GetNotificationManager()->CheckIn(this, onFilteringChanged);
00528         app->GetIgnoreModel()->GetNotificationManager()->CheckIn(this, onFilteringChanged);
00529     }
00530
00531     m_uiFilechangeTimer = SetTimer(FILECHANGE_TIMER, 200, 0L);
00532     if( 0L == m_uiFilechangeTimer )
00533     {
00534         cvs_err("Can't start the file change notification timer.\n");
00535     }
00536 }

void CBrowseFileView::OnKeydown | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 1208 of file BrowseFileView.cpp.

01209 {
01210     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01211     if(app->gCvsRunning)
01212         return;
01213
01214     CListCtrl& ListCtrl = GetListCtrl();
01215     LV_KEYDOWN* pLVKeyDow = (LV_KEYDOWN*)pNMHDR;
01216
01217     if(pLVKeyDow->wVKey == VK_BACK)
01218     {
01219         OnViewUpone();
01220     }
01221     else if(pLVKeyDow->wVKey == VK_RETURN && ListCtrl.GetSelectedCount() == 1)
01222     {
01223         int nItem = -1;
01224         if((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01225         {
01226             EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01227             if(data->GetType() == ENT_SUBDIR)
01228             {
01229                 UStr buf;
01230                 const char* fullpath = data->GetFullPathName(buf);
01231                 ResetView(fullpath, true);
01232             }
01233             else
01234             {
01235                 EditSel(data);
01236             }
01237         }
01238     }
01239
01240     *pResult = 0;
01241 }

void CBrowseFileView::OnLButtonDblClk | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 863 of file BrowseFileView.cpp.

00864 {
00865     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00866     if(app->gCvsRunning)
00867         return;
00868
00869     CListCtrl& ListCtrl = GetListCtrl();
00870
00871     UINT pFlags;
00872     int nItem = ListCtrl.HitTest(point, &pFlags);
00873     if(nItem != -1)
00874     {
00875         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00876         EditSel(data);
00877     }
00878
00879     CListView::OnLButtonDblClk(nFlags, point);
00880 }

void CBrowseFileView::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 831 of file BrowseFileView.cpp.

00832 {
00833     CListView::OnLButtonDown(nFlags, point);
00834 }

BOOL CBrowseFileView::OnMacro ( UINT nID ) [protected]

Definition at line 1437 of file BrowseFileView.cpp.

01438 {
01439     PyDoPython(WINCMD_to_UCMD(nID));
01440
01441     return 1;
01442 }

BOOL CBrowseFileView::OnPreparePrinting ( CPrintInfo * pInfo ) [protected, virtual]

Definition at line 1609 of file BrowseFileView.cpp.

01610 {
01611     BOOL res = DoPreparePrinting(pInfo);
01612     if(!res)
01613         return res;
01614
01615     return TRUE;
01616 }

void CBrowseFileView::OnPrint | ( | CDC * | pDC,
 |  | CPrintInfo * | pInfo
 | ) | [protected, virtual]

Definition at line 1618 of file BrowseFileView.cpp.

01619 {
01620     if (!pDC->IsPrinting())
01621         return;
01622
01623     // now compute the first item to draw
01624     CListCtrl& ListCtrl = GetListCtrl();
01625     int nFirstItem = -1;
01626     int numToIgnore = m_numberByPages * (pInfo->m_nCurPage - 1);
01627     while(numToIgnore-- && (nFirstItem = ListCtrl.GetNextItem(nFirstItem, LVNI_ALL)) != -1)
01628     {
01629     }
01630
01631     TEXTMETRIC tm;
01632     pDC->GetTextMetrics(&tm);
01633
01634     int nItem = nFirstItem, n = 0;
01635     int horz = pInfo->m_rectDraw.Width();
01636     int vert = pInfo->m_rectDraw.Height();
01637     // measure for each column
01638     KiColumnModel* model = GetColumnModel();
01639     int columnCount = model->GetCount();
01640     std::vector<int> widths(columnCount, 0);
01641     int totalwidth = 0;
01642     int j;
01643     KoColumnContext context(GetPath());
01644     while(n++ < m_numberByPages && (nItem = ListCtrl.GetNextItem(nItem, LVNI_ALL)) != -1)
01645     {
01646         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01647         for(j = 0; j < columnCount; j++)
01648         {
01649             TCHAR buffer[256];
01650             model->GetAt(j)->GetText(&context, data, buffer, 256);
01651             int width = pDC->GetTextExtent(buffer, _tcslen(buffer)).cx + kSpc;
01652             widths[j] = max(widths[j], width);
01653         }
01654     }
01655
01656     for(j = 0; j < columnCount; j++)
01657     {
01658         totalwidth += widths[j];
01659     }
01660
01661     for(j = 0; j < columnCount; j++)
01662     {
01663         widths[j] += (horz - totalwidth) / columnCount;
01664     }
01665
01666     // compute the margins
01667     for(j = columnCount - 1; j >= 0; j--)
01668     {
01669         int margin = 0;
01670         for(int i = j - 1; i >= 0; i--)
01671         {
01672             margin += widths[i];
01673         }
01674         widths[j] = margin;
01675     }
01676     // now print
01677     nItem = nFirstItem;
01678     n = 0;
01679     CPoint off = pInfo->m_rectDraw.TopLeft();
01680     while(n++ < m_numberByPages && (nItem = ListCtrl.GetNextItem(nItem, LVNI_ALL)) != -1)
01681     {
01682         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01683         for(j = 0; j < columnCount; j++)
01684         {
01685             const char *info = (*data)[j];
01686             if(info == 0L)
01687                 continue;
01688
01689             CPoint where = off;
01690             where.x += widths[j];
01691             CString s(info);
01692             CRect r(0,0,0,0);
01693             pDC->DrawText(s, -1, &r, DT_CALCRECT);
01694             r.OffsetRect(where);
01695             pDC->DrawText(s, -1, &r, DT_CENTER);
01696         }
01697         off += CPoint(0, m_heightOfLines);
01698     }
01699     //CListView::OnPrint(pDC, pInfo);
01700 }

void CBrowseFileView::OnQueryAnnotate ( ) [protected]

Definition at line 2004 of file BrowseFileView.cpp.

02005 {
02006     KoAnnotateHandler handler;
02007     ProcessSelectionCommand(&handler);
02008 }

void CBrowseFileView::OnRButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 1378 of file BrowseFileView.cpp.

01379 {
01380     CListView::OnRButtonDown(nFlags, point);
01381
01382     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01383     CListCtrl& ListCtrl = GetListCtrl();
01384
01385     if(DisableCommon())
01386         return;
01387
01388     UINT pFlags;
01389     int testItem = ListCtrl.HitTest(point, &pFlags);
01390     if(testItem == -1)
01391         return;
01392
01393     if(ListCtrl.GetItemState(testItem, LVIS_SELECTED) == 0)
01394         return;
01395
01396     if(pFlags & (LVHT_ONITEMICON|LVHT_ONITEMLABEL|LVHT_ONITEMSTATEICON) == 0)
01397         return;
01398
01399     CMenu* pMyMenu=::GetCustomMenu(kCustomFilesMenu,this);
01400     if (pMyMenu)
01401     {
01402         ClientToScreen(&point);
01403         pMyMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x, point.y, this);
01404         delete pMyMenu;
01405     }
01406 }

LRESULT CBrowseFileView::OnResetView | ( | WPARAM | ,
 |  | LPARAM |
 | ) | [protected]

Definition at line 1971 of file BrowseFileView.cpp.

01972 {
01973     ResetView(false, NULL);
01974     return 0;
01975 }

BOOL CBrowseFileView::OnSetCursor | ( | CWnd * | pWnd,
 |  | UINT | nHitTest,
 |  | UINT | message
 | ) | [protected]

Definition at line 1938 of file BrowseFileView.cpp.

01939 {
01940     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01941     if(app->gCvsRunning)
01942     {
01943         SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
01944         return TRUE;
01945     }
01946
01947     return CListView::OnSetCursor(pWnd, nHitTest, message);
01948 }

void CBrowseFileView::OnTimer ( UINT nIDEvent ) [protected]

Definition at line 1523 of file BrowseFileView.cpp.

01524 {
01525     if (nIDEvent == m_uiFilechangeTimer)
01526     {
01527         CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01528         if(!app->gCvsRunning)
01529         {
01530             // cvs command finished
01531             if( m_checkChanges )
01532             {
01533                 // Get the active MDI child window.
01534                 CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
01535                 CMDIChildWnd *pChild = NULL;
01536                 if( pFrame )
01537                 {
01538                     pChild = pFrame->MDIGetActive();
01539                 }
01540
01541                 // Refresh the directory tree and file view
01542                 m_checkChanges = false;
01543                 ResetView(true);
01544
01545                 // Restore the previously active view
01546                 if( pFrame && pChild )
01547                 {
01548                     pFrame->MDIActivate(pChild);
01549                 }
01550
01551                 return;
01552             }
01553
01554             // file change
01555             if (m_isFilesChange )
01556             {
01557                 ResetView();
01558             }
01559
01560             // check if we need to reload
01561             time_t newEntriesMod;
01562             time_t newEntriesLogMod;
01563             GetEntriesModTime(newEntriesMod, newEntriesLogMod);
01564             if (m_entriesMod != newEntriesMod || m_entriesLogMod != newEntriesLogMod)
01565             {
01566                 ResetView();
01567             }
01568         }
01569         return;
01570     }
01571     CListView::OnTimer(nIDEvent);
01572 }

void CBrowseFileView::OnUpdateCustomize ( CCmdUI * pCmdUI ) [protected]

Definition at line 1432 of file BrowseFileView.cpp.

01433 {
01434     pCmdUI->Enable(TRUE);
01435 }

void CBrowseFileView::OnUpdateMacro ( CCmdUI * pCmdUI ) [protected]

Definition at line 1444 of file BrowseFileView.cpp.

01445 {
01446     if(DisableCommon(false))
01447     {
01448         pCmdUI->Enable(FALSE);
01449         return;
01450     }
01451
01452     // fill the cache with current selection
01453     if(!PyIsUICacheValid())
01454     {
01455         CListCtrl& ListCtrl = GetListCtrl();
01456         int nItem = -1;
01457         while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01458         {
01459             EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01460             PyAppendCache(data);
01461         }
01462     }
01463
01464     UCmdUI ucmdui(WINCMD_to_UCMD(pCmdUI->m_nID));
01465     ucmdui.pCmdUI = pCmdUI;
01466     PyDoCmdUI(&ucmdui);
01467 }

void CBrowseFileView::OnUpdateQueryAnnotate ( CCmdUI * pCmdUI ) [protected]

Definition at line 1977 of file BrowseFileView.cpp.

01978 {
01979     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01980     CListCtrl& ListCtrl = GetListCtrl();
01981
01982     if(DisableCommon())
01983     {
01984         pCmdUI->Enable(FALSE);
01985         return;
01986     }
01987
01988     int nItem = -1;
01989     BOOL res = TRUE;
01990
01991     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01992     {
01993         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01994         if(data->IsUnknown() || data->GetType() == ENT_SUBDIR)
01995         {
01996             res = FALSE;
01997             break;
01998         }
01999     }
02000
02001     pCmdUI->Enable(res);
02002 }

void CBrowseFileView::OnUpdateViewAdd ( CCmdUI * pCmdUI ) [protected]

Definition at line 928 of file BrowseFileView.cpp.

00929 {
00930     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00931     CListCtrl& ListCtrl = GetListCtrl();
00932
00933     if(DisableCommon())
00934     {
00935         pCmdUI->Enable(FALSE);
00936         return;
00937     }
00938
00939     int nItem = -1;
00940     BOOL res = TRUE;
00941     int numFiles = 0;
00942     int numFolders = 0;
00943
00944     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
00945     {
00946         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00947         if(!(data->IsUnknown() || (data->IsRemoved() && data->IsMissing())))
00948         {
00949             res = FALSE;
00950             break;
00951         }
00952         if(data->GetType() == ENT_FILE)
00953         {
00954             numFiles++;
00955         }
00956         else
00957             numFolders++;
00958
00959         if((numFiles != 0 && numFolders != 0) || numFolders > 1)
00960         {
00961             res = FALSE;
00962             break;
00963         }
00964     }
00965
00966     pCmdUI->Enable(res);
00967 }

void CBrowseFileView::OnUpdateViewAddB ( CCmdUI * pCmdUI ) [protected]

Definition at line 969 of file BrowseFileView.cpp.

00970 {
00971     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00972     CListCtrl& ListCtrl = GetListCtrl();
00973
00974     if(DisableCommon())
00975     {
00976         pCmdUI->Enable(FALSE);
00977         return;
00978     }
00979
00980     int nItem = -1;
00981     BOOL res = TRUE;
00982
00983     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
00984     {
00985         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00986         if(data->GetType() != ENT_FILE)
00987         {
00988             res = FALSE;
00989             break;
00990         }
00991         if(!(data->IsUnknown() || (data->IsRemoved() && data->IsMissing())))
00992         {
00993             res = FALSE;
00994             break;
00995         }
00996     }
00997
00998     pCmdUI->Enable(res);
00999 }

void CBrowseFileView::OnUpdateViewCheckout ( CCmdUI * pCmdUI ) [protected]

Definition at line 1765 of file BrowseFileView.cpp.

01766 {
01767     if(DisableCommon(false))
01768     {
01769         pCmdUI->Enable(FALSE);
01770         return;
01771     }
01772     pCmdUI->Enable(TRUE);
01773     pCmdUI->SetText("Chec&kout module...");
01774 }

void CBrowseFileView::OnUpdateViewEditseldef ( CCmdUI * pCmdUI ) [protected]

Definition at line 1728 of file BrowseFileView.cpp.

01729 {
01730     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01731     CListCtrl& ListCtrl = GetListCtrl();
01732     if(DisableCommon())
01733     {
01734         pCmdUI->Enable(FALSE);
01735         return;
01736     }
01737
01738     int nItem = -1;
01739     BOOL res = TRUE;
01740
01741     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01742     {
01743         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01744         if(data->GetType() == ENT_SUBDIR || data->IsMissing())
01745         {
01746             res = FALSE;
01747             break;
01748         }
01749     }
01750
01751     CString str;
01752     if( FormatMenuString(pCmdUI->m_nID, str) && pCmdUI->m_pParentMenu )
01753     {
01754         pCmdUI->SetText(str);
01755     }
01756
01757     pCmdUI->Enable(res);
01758 }

void CBrowseFileView::OnUpdateViewExplore ( CCmdUI * pCmdUI ) [protected]

Definition at line 1496 of file BrowseFileView.cpp.

01497 {
01498     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01499     CListCtrl& ListCtrl = GetListCtrl();
01500     if(DisableCommon())
01501     {
01502         pCmdUI->Enable(FALSE);
01503         return;
01504     }
01505
01506     int nItem = -1;
01507     int numItem = 0;
01508     BOOL res = TRUE;
01509
01510     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01511     {
01512         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01513         if(data->IsMissing() || ++numItem > 1)
01514         {
01515             res = FALSE;
01516             break;
01517         }
01518     }
01519
01520     pCmdUI->Enable(res);
01521 }

void CBrowseFileView::OnUpdateViewFullRowDetails ( CCmdUI * pCmdUI ) [protected]

Definition at line 826 of file BrowseFileView.cpp.

00827 {
00828     pCmdUI->SetCheck(GetViewType() == LVS_REPORT);
00829 }

void CBrowseFileView::OnUpdateViewGraph ( CCmdUI * pCmdUI ) [protected]

Definition at line 1040 of file BrowseFileView.cpp.

01041 {
01042     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01043     CListCtrl& ListCtrl = GetListCtrl();
01044
01045     if(DisableCommon())
01046     {
01047         pCmdUI->Enable(FALSE);
01048         return;
01049     }
01050
01051     int nItem = -1;
01052     BOOL res = TRUE;
01053
01054     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01055     {
01056         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01057         if(data->IsUnknown() || data->GetType() == ENT_SUBDIR)
01058         {
01059             res = FALSE;
01060             break;
01061         }
01062     }
01063
01064     pCmdUI->Enable(res);
01065 }

void CBrowseFileView::OnUpdateViewImport ( CCmdUI * pCmdUI ) [protected]

Definition at line 1781 of file BrowseFileView.cpp.

01782 {
01783     if(DisableCommon())
01784     {
01785         pCmdUI->Enable(FALSE);
01786         return;
01787     }
01788     pCmdUI->Enable(TRUE);
01789     pCmdUI->SetText("&Import module...");
01790 }

void CBrowseFileView::OnUpdateViewList ( CCmdUI * pCmdUI ) [protected]

Definition at line 821 of file BrowseFileView.cpp.

00822 {
00823     pCmdUI->SetCheck(GetViewType() == LVS_LIST);
00824 }

void CBrowseFileView::OnUpdateViewRelease ( CCmdUI * pCmdUI ) [protected]

Definition at line 892 of file BrowseFileView.cpp.

00893 {
00894     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00895     CListCtrl& ListCtrl = GetListCtrl();
00896
00897     if(DisableCommon())
00898     {
00899         pCmdUI->Enable(FALSE);
00900         return;
00901     }
00902
00903     int nItem = -1;
00904     BOOL res = TRUE;
00905     int numFiles = 0;
00906     int numFolders = 0;
00907
00908     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
00909     {
00910         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00911         if(data->IsUnknown() || data->GetType() != ENT_SUBDIR)
00912         {
00913             res = FALSE;
00914             break;
00915         }
00916         numFolders++;
00917
00918         if(numFolders > 1)
00919         {
00920             res = FALSE;
00921             break;
00922         }
00923     }
00924
00925     pCmdUI->Enable(res);
00926 }

void CBrowseFileView::OnUpdateViewReload ( CCmdUI * pCmdUI ) [protected]

Definition at line 1197 of file BrowseFileView.cpp.

01198 {
01199     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01200     pCmdUI->Enable(!app->gCvsRunning);
01201 }

void CBrowseFileView::OnUpdateViewRmv ( CCmdUI * pCmdUI ) [protected]

Definition at line 1067 of file BrowseFileView.cpp.

01068 {
01069     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01070     CListCtrl& ListCtrl = GetListCtrl();
01071
01072     if(DisableCommon())
01073     {
01074         pCmdUI->Enable(FALSE);
01075         return;
01076     }
01077
01078     int nItem = -1;
01079     BOOL res = TRUE;
01080
01081     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01082     {
01083         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01084         if(data->IsUnknown() || data->IsRemoved() || data->GetType() == ENT_SUBDIR)
01085         {
01086             res = FALSE;
01087             break;
01088         }
01089     }
01090
01091     pCmdUI->Enable(res);
01092 }

void CBrowseFileView::OnUpdateViewSmallIcons ( CCmdUI * pCmdUI ) [protected]

Definition at line 816 of file BrowseFileView.cpp.

00817 {
00818     pCmdUI->SetCheck(GetViewType() == LVS_SMALLICON);
00819 }

void CBrowseFileView::OnUpdateViewTrash ( CCmdUI * pCmdUI ) [protected]

Definition at line 1288 of file BrowseFileView.cpp.

01289 {
01290     bool enabled = !DisableCommon();
01291     if(enabled)
01292     {
01293         KoUpdateMoveToTrashHandler handler;
01294         ProcessSelectionCommand(&handler);
01295         enabled = handler.IsEnabled();
01296     }
01297     pCmdUI->Enable(enabled);
01298 }

void CBrowseFileView::OnUpdateViewUpdate ( CCmdUI * pCmdUI ) [protected]

Definition at line 1001 of file BrowseFileView.cpp.

01002 {
01003     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01004     CListCtrl& ListCtrl = GetListCtrl();
01005
01006     if(DisableCommon())
01007     {
01008         pCmdUI->Enable(FALSE);
01009         return;
01010     }
01011
01012     int nItem = -1;
01013     BOOL res = TRUE;
01014     int numFiles = 0;
01015     int numFolders = 0;
01016
01017     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01018     {
01019         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01020         if(data->IsUnknown())
01021         {
01022             res = FALSE;
01023             break;
01024         }
01025         if(data->GetType() == ENT_FILE)
01026             numFiles++;
01027         else
01028             numFolders++;
01029
01030         if((numFiles != 0 && numFolders != 0) || numFolders > 1)
01031         {
01032             res = FALSE;
01033             break;
01034         }
01035     }
01036
01037     pCmdUI->Enable(res);
01038 }

void CBrowseFileView::OnUpdateViewUpone ( CCmdUI * pCmdUI ) [protected]

Definition at line 1276 of file BrowseFileView.cpp.

01277 {
01278     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01279     pCmdUI->Enable(!app->gCvsRunning && !IsSamePath(m_path, GetRoot()));
01280 }

void CBrowseFileView::OnViewAdd ( ) [protected]

Definition at line 1161 of file BrowseFileView.cpp.

01162 {
01163     KoAddHandler handler;
01164     ProcessSelectionCommand(&handler);
01165 }

void CBrowseFileView::OnViewAddb ( ) [protected]

Definition at line 1167 of file BrowseFileView.cpp.

01168 {
01169     KoAddBinaryHandler handler;
01170     ProcessSelectionCommand(&handler);
01171 }

void CBrowseFileView::OnViewCheckout ( ) [protected]

Definition at line 1760 of file BrowseFileView.cpp.

01761 {
01762     CvsCmdCheckoutModule();
01763 }

void CBrowseFileView::OnViewCommit ( ) [protected]

Definition at line 1173 of file BrowseFileView.cpp.

01174 {
01175     KoCommitHandler handler;
01176     ProcessSelectionCommand(&handler);
01177 }

void CBrowseFileView::OnViewDiff ( ) [protected]

Definition at line 1300 of file BrowseFileView.cpp.

01301 {
01302     KoDiffHandler handler;
01303     ProcessSelectionCommand(&handler);
01304 }

void CBrowseFileView::OnViewEdit ( ) [protected]

Definition at line 1348 of file BrowseFileView.cpp.

01349 {
01350     KoEditHandler handler;
01351     ProcessSelectionCommand(&handler);
01352 }

void CBrowseFileView::OnViewEditors ( ) [protected]

Definition at line 1372 of file BrowseFileView.cpp.

01373 {
01374     KoEditorsHandler handler;
01375     ProcessSelectionCommand(&handler);
01376 }

void CBrowseFileView::OnViewEditsel ( ) [protected]

Definition at line 1702 of file BrowseFileView.cpp.

01703 {
01704     CListCtrl& ListCtrl = GetListCtrl();
01705     int nItem = -1;
01706
01707     // first add the folders
01708     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01709     {
01710         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01711         EditSel(data);
01712     }
01713 }

void CBrowseFileView::OnViewEditseldef ( ) [protected]

Definition at line 1715 of file BrowseFileView.cpp.

01716 {
01717     CListCtrl& ListCtrl = GetListCtrl();
01718     int nItem = -1;
01719
01720     // first add the folders
01721     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01722     {
01723         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01724         EditSel(data, true);
01725     }
01726 }

void CBrowseFileView::OnViewExplore ( ) [protected]

Definition at line 1469 of file BrowseFileView.cpp.

01470 {
01471     const char* fullpath = m_path;
01472
01473     CListCtrl& ListCtrl = GetListCtrl();
01474     int nItem = -1;
01475
01476     // first add the folders
01477     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01478     {
01479         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01480         if(data->GetType() == ENT_SUBDIR)
01481         {
01482             UStr buf;
01483             fullpath = data->GetFullPathName(buf);
01484             break;
01485         }
01486     }
01487
01488     HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), "explore", fullpath,
01489             0L, 0L, SW_SHOWDEFAULT);
01490     if((long)hInst < 32)
01491     {
01492         cvs_err("Unable to explore '%s' (error %d)\n", (char *)m_path, GetLastError());
01493     }
01494 }

void CBrowseFileView::OnViewFullRowDetails ( ) [protected]

Definition at line 810 of file BrowseFileView.cpp.

00811 {
00812     if (GetViewType() != LVS_REPORT)
00813         SetViewType(LVS_REPORT);
00814 }

void CBrowseFileView::OnViewGraph ( ) [protected]

Definition at line 1312 of file BrowseFileView.cpp.

01313 {
01314     KoGraphHandler handler;
01315     ProcessSelectionCommand(&handler);
01316 }

void CBrowseFileView::OnViewImport ( ) [protected]

Definition at line 1776 of file BrowseFileView.cpp.

01777 {
01778     CvsCmdImportModule();
01779 }

void CBrowseFileView::OnViewList ( ) [protected]

Definition at line 804 of file BrowseFileView.cpp.

00805 {
00806     if (GetViewType() != LVS_LIST)
00807         SetViewType(LVS_LIST);
00808 }

void CBrowseFileView::OnViewLock ( ) [protected]

Definition at line 1324 of file BrowseFileView.cpp.

01325 {
01326     KoLockHandler handler;
01327     ProcessSelectionCommand(&handler);
01328 }

void CBrowseFileView::OnViewLog ( ) [protected]

Definition at line 1306 of file BrowseFileView.cpp.

01307 {
01308     KoLogHandler handler;
01309     ProcessSelectionCommand(&handler);
01310 }

void CBrowseFileView::OnViewQueryUpdate ( ) [protected]

Definition at line 1191 of file BrowseFileView.cpp.

01192 {
01193     KoQueryUpdateHandler handler;
01194     ProcessSelectionCommand(&handler);
01195 }

void CBrowseFileView::OnViewRelease ( ) [protected]

Definition at line 1360 of file BrowseFileView.cpp.

01361 {
01362     KoReleaseHandler handler;
01363     ProcessSelectionCommand(&handler);
01364 }

void CBrowseFileView::OnViewReload ( ) [protected]

Definition at line 1203 of file BrowseFileView.cpp.

01204 {
01205     ResetView(true);
01206 }

void CBrowseFileView::OnViewRmv ( ) [protected]

Definition at line 1179 of file BrowseFileView.cpp.

01180 {
01181     KoFileRemoveHandler handler;
01182     ProcessSelectionCommand(&handler);
01183 }

void CBrowseFileView::OnViewSmallIcons ( ) [protected]

Definition at line 798 of file BrowseFileView.cpp.

00799 {
00800     if (GetViewType() != LVS_SMALLICON)
00801         SetViewType(LVS_SMALLICON);
00802 }

void CBrowseFileView::OnViewStatus ( ) [protected]

Definition at line 1318 of file BrowseFileView.cpp.

01319 {
01320     KoStatusHandler handler;
01321     ProcessSelectionCommand(&handler);
01322 }

void CBrowseFileView::OnViewTagBranch ( ) [protected]

Definition at line 1420 of file BrowseFileView.cpp.

01421 {
01422     KoBranchTagHandler handler;
01423     ProcessSelectionCommand(&handler);
01424 }

void CBrowseFileView::OnViewTagDelete ( ) [protected]

Definition at line 1414 of file BrowseFileView.cpp.

01415 {
01416     KoDeleteTagHandler handler;
01417     ProcessSelectionCommand(&handler);
01418 }

void CBrowseFileView::OnViewTagNew ( ) [protected]

Definition at line 1408 of file BrowseFileView.cpp.

01409 {
01410     KoCreateTagHandler handler;
01411     ProcessSelectionCommand(&handler);
01412 }

void CBrowseFileView::OnViewTrash ( ) [protected]

Definition at line 1282 of file BrowseFileView.cpp.

01283 {
01284     KoMoveToTrashHandler handler;
01285     ProcessSelectionCommand(&handler);
01286 }

void CBrowseFileView::OnViewUnedit ( ) [protected]

Definition at line 1354 of file BrowseFileView.cpp.

01355 {
01356     KoUneditHandler handler;
01357     ProcessSelectionCommand(&handler);
01358 }

void CBrowseFileView::OnViewUnlock ( ) [protected]

Definition at line 1330 of file BrowseFileView.cpp.

01331 {
01332     KoUnlockHandler handler;
01333     ProcessSelectionCommand(&handler);
01334 }

void CBrowseFileView::OnViewUpdate ( ) [protected]

Definition at line 1185 of file BrowseFileView.cpp.

01186 {
01187     KoUpdateHandler handler;
01188     ProcessSelectionCommand(&handler);
01189 }

void CBrowseFileView::OnViewUpone ( ) [protected]

Definition at line 1262 of file BrowseFileView.cpp.

Referenced by OnKeydown().

01263 {
01264     if(!IsSamePath(m_path, GetRoot()) && chdir(m_path) == 0 && chdir("..") == 0)
01265     {
01266         char newpath[1024];
01267         getcwd(newpath, 1023);
01268         ResetView(newpath, true);
01269     }
01270     else
01271     {
01272         MessageBeep(MB_ICONHAND);
01273     }
01274 }

void CBrowseFileView::OnViewWatchOff ( ) [protected]

Definition at line 1342 of file BrowseFileView.cpp.

01343 {
01344     KoWatchOffHandler handler;
01345     ProcessSelectionCommand(&handler);
01346 }

void CBrowseFileView::OnViewWatchOn ( ) [protected]

Definition at line 1336 of file BrowseFileView.cpp.

01337 {
01338     KoWatchOnHandler handler;
01339     ProcessSelectionCommand(&handler);
01340 }

void CBrowseFileView::OnViewWatchers ( ) [protected]

Definition at line 1366 of file BrowseFileView.cpp.

01367 {
01368     KoWatchersHandler handler;
01369     ProcessSelectionCommand(&handler);
01370 }

BOOL CBrowseFileView::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]

Definition at line 417 of file BrowseFileView.cpp.

00418 {
00419     cs.style |= WS_TABSTOP | LVS_SHOWSELALWAYS | LVS_REPORT;
00420     cs.dwExStyle |= LVS_EX_FULLROWSELECT;
00421
00422     return CListView::PreCreateWindow(cs);
00423 }

void CBrowseFileView::ProcessSelectionCommand ( KiSelectionHandler * handler )

Definition at line 1124 of file BrowseFileView.cpp.

Referenced by OnQueryAnnotate(), OnUpdateViewTrash(), OnViewAdd(), OnViewAddb(), OnViewCommit(), OnViewDiff(), OnViewEdit(), OnViewEditors(), OnViewGraph(), OnViewLock(), OnViewLog(), OnViewQueryUpdate(), OnViewRelease(), OnViewRmv(), OnViewStatus(), OnViewTagBranch(), OnViewTagDelete(), OnViewTagNew(), OnViewTrash(), OnViewUnedit(), OnViewUnlock(), OnViewUpdate(), OnViewWatchOff(), OnViewWatchOn(), and OnViewWatchers().

01125 {
01126     CListCtrl& ListCtrl = GetListCtrl();
01127     int nItem = -1;
01128     int pathLen = GetPath().length();
01129
01130     MultiFiles mf;
01131
01132     // first add the folders
01133     mf.newdir(GetPath());
01134
01135     //  process selection
01136     while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
01137     {
01138         EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
01139         UStr buf;
01140         const char* fullpath = data->GetFullPathName(buf);
01141         if(data->GetType() == ENT_SUBDIR)
01142         {
01143             handler->OnFolder(fullpath);
01144         }
01145         else
01146         {
01147             const char* fn = data->GetFullPathName(buf) + pathLen;
01148             if (*fn == '\\')
01149             {
01150                 fn++;
01151             }
01152             mf.newfile(fn);
01153         }
01154     }
01155     if(mf.NumFiles() != 0)
01156     {
01157         handler->OnFiles(&mf);
01158     }
01159 }

void CBrowseFileView::ResetView | ( | bool | notifyBrowser = false,
 |  | const char * | selectFile = 0L
 | ) |

Definition at line 598 of file BrowseFileView.cpp.

00599 {
00600     // no outstanding request to reset the view any more
00601     m_isResetViewPending = false;
00602
00603     if (m_isResetViewLocked)
00604     {
00605         // no recursion
00606         return;
00607     }
00608     CRecursionLock recursionLock(m_isResetViewLocked);
00609
00610     // reset dirty indicators
00611     m_isFilesChange = false;
00612     GetEntriesModTime(m_entriesMod, m_entriesLogMod);
00613
00614     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00615     app->GetMainFrame()->MDIActivate(GetParentFrame());
00616
00617     CWaitCursor doWait;
00618
00619     bool bPartialOK = true;
00620
00621     CListCtrl& ListCtrl = GetListCtrl();
00622     int i;
00623
00624     // get the selection to later try to restore it
00625     CvsArgs selection(false);
00626     if (!selectFile)
00627     {
00628         int nItem = -1;
00629         UStr buf;
00630         while((nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) != -1)
00631         {
00632             EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00633             selection.add(data->GetFullPathName(buf));
00634         }
00635     }
00636
00637     // delete all items
00638     VERIFY( ListCtrl.DeleteAllItems() );
00639
00640     // make sure columns are ok
00641     KoTraversalContext context(this);
00642     if ((context.IsRecursive() && !m_isRecursive) || (!context.IsRecursive() && m_isRecursive))
00643     {
00644
00645         KiColumnModel* oldModel = GetColumnModel();
00646         int oldCount = oldModel->GetCount();
00647         const KiColumn* oldColumn = (0 <= m_sort && m_sort < oldCount) ? oldModel->GetAt(m_sort) : NULL;
00648         DeleteColumns();
00649         SetRecursive(context.IsRecursive());
00650         AddColumns();
00651         if (oldColumn == NULL)
00652         {
00653             m_sort = 0;
00654         }
00655         else
00656         {
00657             KiColumnModel* newModel = GetColumnModel();
00658             int newCount = newModel->GetCount();
00659             int sort = -1;
00660             for (int pos = 0; pos < newCount && sort == -1; pos++)
00661             {
00662                 if (newModel->GetAt(pos) == oldColumn)
00663                 {
00664                     sort = pos;
00665                 }
00666             }
00667             m_sort = (sort >= 0) ? sort : 0;
00668         }
00669     }
00670
00671     // refetch all items
00672     TViewFill traverse(&context);
00673     kTraversal res = FileTraverse(m_path, traverse);
00674
00675     //JK - find the file for selection
00676     if( selectFile != 0L )
00677     {
00678         int count = ListCtrl.GetItemCount();
00679         for (int i = 0; i < count; i++)
00680         {
00681             EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(i);
00682
00683             //files only
00684             if(data->GetType() == ENT_SUBDIR)
00685                 continue;
00686
00687             UStr buf;
00688             const char* currentFile = data->GetFullPathName(buf);
00689             if( stricmp( selectFile, currentFile) == 0 )
00690             {
00691                 selection.reset(false); //we don't want any other selection
00692                 selection.add(currentFile);
00693                 bPartialOK = FALSE;
00694                 break;
00695             }
00696         }
00697     }
00698
00699     Resort();
00700
00701     // now restore the selection
00702     int argc = selection.Argc();
00703     char * const *argv = selection.Argv();
00704     bool isFirst = true;
00705     bool focusSet = false;
00706     int count = ListCtrl.GetItemCount();
00707     //If there are no selections, then skip the looping
00708     if( argc )
00709     {
00710         for (int nItem = 0; nItem < count; nItem++)
00711         {
00712             EntnodeData *data = (EntnodeData *)ListCtrl.GetItemData(nItem);
00713             UStr buf;
00714             const char* currentFile = data->GetFullPathName(buf);
00715             for(i = 0; i < argc; i++)
00716             {
00717                 const char* fn = argv[i];
00718                 if (stricmp(fn, currentFile) == 0)
00719                 {
00720                     VERIFY( ListCtrl.SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED) );
00721                     if(isFirst)
00722                     {
00723                         isFirst = false;
00724                         if( !bPartialOK )
00725                         {
00726                             //move to the bottom first, so the selection will be on top
00727                             ListCtrl.EnsureVisible(ListCtrl.GetItemCount()-1 , bPartialOK);
00728                         }
00729                         //make sure the first selected file is visible
00730                         VERIFY( ListCtrl.EnsureVisible(nItem, bPartialOK/*TRUE*/) );
00731                         VERIFY( focusSet = (ListCtrl.SetItemState(nItem, LVIS_FOCUSED, LVIS_FOCUSED)!=0) );
00732                     }
00733                     break;
00734                 }
00735             }
00736         }
00737     }
00738
00739     if( !focusSet && ListCtrl.GetItemCount())
00740     {
00741         //VERIFY( ListCtrl.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED) );
00742         VERIFY( focusSet = (ListCtrl.SetItemState(0, LVIS_FOCUSED, LVIS_FOCUSED)!=0) );
00743     }
00744
00745     if(notifyBrowser)
00746     {
00747         // notify the tree
00748         app->GetBrowserView()->ResetView(true);
00749     }
00750
00751     // start monitoring file changes
00752     if (!m_watch)
00753     {
00754         m_watch = new KoWatcher(m_hWnd);
00755     }
00756     m_watch->SignalStartWatch(m_path, m_isRecursive);
00757 }

void CBrowseFileView::ResetView | ( | const char * | path,
 |  | bool | notifyBrowser = false,
 |  | const char * | selectFile = 0L
 | ) |

Definition at line 759 of file BrowseFileView.cpp.

Referenced by EditSel(), CWincvsApp::InitInstance(), CWinCvsBrowser::NotifySelectionChange(), CMainFrame::OnDropFiles(), OnKeydown(), OnResetView(), CMyShellTree::OnSelchanged(), OnTimer(), OnViewReload(), and CWinCvsBrowser::ResetView().

00760 {
00761     m_path = path;
00762     ResetView(false, selectFile);
00763     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00764     app->GetDocument()->SetTitle(m_path);
00765
00766     if(notifyBrowser)
00767     {
00768         // notify the tree
00769         app->GetBrowserView()->StepToLocation(path);
00770     }
00771 }

void CBrowseFileView::Resort ( void )

Definition at line 1094 of file BrowseFileView.cpp.

Referenced by OnColumnclick(), and ResetView().

01095 {
01096     CListCtrl& ListCtrl = GetListCtrl();
01097     KoColumnContext context(GetPath());
01098     KiColumnModel* model = GetColumnModel();
01099     CSortParam sortParam(m_ascendant, true, model->GetAt(m_sort), model->GetAt(0), &context);
01100     m_ctrlHeader.SetSortImage(m_sort, m_ascendant);
01101
01102     ListCtrl.SortItems( _Compare, (LPARAM)&sortParam);
01103 }

void CBrowseFileView::SaveColumns ( )

Definition at line 1886 of file BrowseFileView.cpp.

Referenced by OnDestroy().

01887 {
01888     AfxGetApp()->WriteProfileString("FileDetailView", NULL, NULL);
01889
01890     char buffer[2048];
01891     char* cp = buffer;
01892     int count = m_ctrlHeader.GetItemCount();
01893     for (int i = 0; i < count; ++i)
01894     {
01895         int width = GetListCtrl().GetColumnWidth(i);
01896         cp += sprintf(cp, "%d ", width);
01897     }
01898     AfxGetApp()->WriteProfileString("FileDetailView", "Column Widths", buffer);
01899
01900     int order[128];
01901     if (m_ctrlHeader.GetOrderArray(order, count))
01902     {
01903         cp = buffer;
01904         for (int i = 0; i < count; ++i)
01905         {
01906             cp += sprintf(cp, "%d ", order[i]);
01907         }
01908         AfxGetApp()->WriteProfileString("FileDetailView", "Column Order", buffer);
01909     }
01910 }

void CBrowseFileView::SetFullRowSel ( BOOL bFullRowSel ) [protected]

Definition at line 1580 of file BrowseFileView.cpp.

Referenced by OnInitialUpdate().

01581 {
01582     CListCtrl& ListCtrl = GetListCtrl();
01583     DWORD dwExStyle = ListView_GetExtendedListViewStyle(ListCtrl.m_hWnd);
01584     if (bFullRowSel)
01585         (dwExStyle |= LVS_EX_FULLROWSELECT);
01586     else
01587         (dwExStyle &= ~LVS_EX_FULLROWSELECT);
01588     ListView_SetExtendedListViewStyle(ListCtrl.m_hWnd, dwExStyle);
01589 }

void CBrowseFileView::SetRecursive ( bool isRecursive ) [protected]

Definition at line 483 of file BrowseFileView.cpp.

Referenced by CBrowseFileView(), OnInitialUpdate(), and ResetView().

00484 {
00485     m_isRecursive = isRecursive;
00486     m_modelColumns = (m_isRecursive) ? KiColumnModel::GetRecursiveModel() : KiColumnModel::GetRegularModel();
00487 }

BOOL CBrowseFileView::SetViewType ( DWORD dwViewType )

Definition at line 788 of file BrowseFileView.cpp.

Referenced by OnViewFullRowDetails(), OnViewList(), and OnViewSmallIcons().

00789 {
00790     return(ModifyStyle(LVS_TYPEMASK,dwViewType & LVS_TYPEMASK));
00791 }

Member Data Documentation

CImageList CBrowseFileView::m_SmallImageList [static, protected]

Definition at line 167 of file BrowseFileView.cpp.

CImageList CBrowseFileView::m_StateImageList [static, protected]

Definition at line 168 of file BrowseFileView.cpp.

bool CBrowseFileView::m_ascendant [protected]

Definition at line 164 of file BrowseFileView.h.

bool CBrowseFileView::m_checkChanges [protected]

Definition at line 170 of file BrowseFileView.h.

CSortHeaderCtrl CBrowseFileView::m_ctrlHeader [protected]

Definition at line 154 of file BrowseFileView.h.

time_t CBrowseFileView::m_entriesLogMod [protected]

Definition at line 160 of file BrowseFileView.h.

time_t CBrowseFileView::m_entriesMod [protected]

Definition at line 159 of file BrowseFileView.h.

int CBrowseFileView::m_heightOfLines [protected]

Definition at line 175 of file BrowseFileView.h.

bool CBrowseFileView::m_isFilesChange [protected]

Definition at line 187 of file BrowseFileView.h.

bool CBrowseFileView::m_isRecursive [protected]

Definition at line 178 of file BrowseFileView.h.

bool CBrowseFileView::m_isResetViewLocked [protected]

Definition at line 184 of file BrowseFileView.h.

bool CBrowseFileView::m_isResetViewPending [protected]

Definition at line 193 of file BrowseFileView.h.

KiColumnModel* CBrowseFileView::m_modelColumns [protected]

Definition at line 167 of file BrowseFileView.h.

int CBrowseFileView::m_numberByPages [protected]

Definition at line 173 of file BrowseFileView.h.

int CBrowseFileView::m_numberOfLines [protected]

Definition at line 172 of file BrowseFileView.h.

int CBrowseFileView::m_numberOfPages [protected]

Definition at line 174 of file BrowseFileView.h.

UStr CBrowseFileView::m_path [protected]

Definition at line 157 of file BrowseFileView.h.

int CBrowseFileView::m_sort [protected]

Definition at line 162 of file BrowseFileView.h.

UINT CBrowseFileView::m_uiFilechangeTimer [protected]

Definition at line 190 of file BrowseFileView.h.

KoWatcher* CBrowseFileView::m_watch [protected]

Definition at line 181 of file BrowseFileView.h.

The documentation for this class was generated from the following files:
  • WinCvs/BrowseFileView.h
  • WinCvs/BrowseFileView.cpp
Generated on Sun Oct 21 12:46:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CBrowserBar Class Reference

#include <BrowserBar.h>

Inheritance diagram for CBrowserBar:

[legend]
Collaboration diagram for CBrowserBar:

[legend]
List of all members.

Public Methods

virtual | ~CBrowserBar ()
CWinCvsBrowser * GetBrowserView ()
virtual BOOL | Create (LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL)

Protected Methods

CBrowserBar ()
virtual void | OnDraw (CDC *pDC)
afx_msg void | OnWindowPosChanged (WINDOWPOS *lpwndpos)
afx_msg void | OnDestroy ()
afx_msg void | OnPaint ()

Protected Attributes

CWinCvsBrowser * m_browser

Constructor & Destructor Documentation

CBrowserBar::~CBrowserBar ( ) [virtual]

Definition at line 23 of file BrowserBar.cpp.

00024 {
00025 }

CBrowserBar::CBrowserBar ( ) [protected]

Definition at line 19 of file BrowserBar.cpp.

00019                          : m_browser(0L)
00020 {
00021 }

Member Function Documentation

BOOL CBrowserBar::Create | ( | LPCTSTR | lpszClassName,
 |  | LPCTSTR | lpszWindowName,
 |  | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | CCreateContext * | pContext = NULL
 | ) | [virtual]

Definition at line 62 of file BrowserBar.cpp.

00063 {
00064     BOOL res = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
00065     if(!res)
00066         return FALSE;
00067
00068     m_browser = (CWinCvsBrowser *)RUNTIME_CLASS(CWinCvsBrowser)->CreateObject();
00069     VERIFY(m_browser->Create(0L, "", WS_CHILD | WS_VISIBLE | WS_TABSTOP, CRect(0,0,0,0), this, 0));
00070
00071     return TRUE;
00072 }

CWinCvsBrowser* CBrowserBar::GetBrowserView ( void ) [inline]

Definition at line 29 of file BrowserBar.h.

Referenced by CMainFrame::GetBrowserView().

00029 { return m_browser; }

void CBrowserBar::OnDestroy ( void ) [protected]

Definition at line 85 of file BrowserBar.cpp.

00086 {
00087     if(m_browser)
00088         m_browser->DestroyWindow();
00089
00090     CView::OnDestroy();
00091 }

void CBrowserBar::OnDraw ( CDC * pDC ) [protected, virtual]

Definition at line 57 of file BrowserBar.cpp.

00058 {
00059     CDocument* pDoc = GetDocument();
00060 }

void CBrowserBar::OnPaint ( ) [protected]

Definition at line 93 of file BrowserBar.cpp.

00094 {
00095     CPaintDC dc(this); // device context for painting
00096
00097     CRect r;
00098     GetClientRect(&r);
00099     CBrush brush(GetSysColor(COLOR_WINDOW));
00100     dc.FillRect(r, &brush);
00101 }

void CBrowserBar::OnWindowPosChanged ( WINDOWPOS * wp ) [protected]

Definition at line 74 of file BrowserBar.cpp.

00075 {
00076     CView::OnWindowPosChanged(wp);
00077
00078     //m_browser->SetWindowPos(NULL, wp->x, wp->y, wp->cx, wp->cy, SWP_NOZORDER);
00079     CRect r;
00080     GetClientRect(&r);
00081     if(m_browser != 0L)
00082         m_browser->SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER);
00083 }

Member Data Documentation

CWinCvsBrowser* CBrowserBar::m_browser [protected]

Definition at line 47 of file BrowserBar.h.

The documentation for this class was generated from the following files:
  • WinCvs/BrowserBar.h
  • WinCvs/BrowserBar.cpp
Generated on Sun Oct 21 12:46:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UBrush Class Reference

#include <udraw.h>

List of all members.

Public Methods

UBrush ()
~UBrush ()
bool | DeleteObject (void)
bool | CreateSolidBrush (UCOLORREF crColor)

Friends

class | UDC

Constructor & Destructor Documentation

UBrush::UBrush ( )

Definition at line 437 of file udraw.cpp.

00439     : m_set(false)
00440 #endif
00441 {
00442 }

UBrush::~UBrush ( )

Definition at line 444 of file udraw.cpp.

00445 {
00446     DeleteObject();
00447 }

Member Function Documentation

bool UBrush::CreateSolidBrush ( UCOLORREF crColor )

Definition at line 469 of file udraw.cpp.

Referenced by DrawNode().

00470 {
00471     bool res = false;
00472
00473 #if qGTK
00474     DeleteObject();
00475     GdkColormap *cmap = gdk_colormap_get_system();
00476     if(cmap != 0L)
00477     {
00478         m_col.red = UGetRValue(crColor) << 8;
00479         m_col.green = UGetGValue(crColor) << 8;
00480         m_col.blue = UGetBValue(crColor) << 8;
00481         if(gdk_color_alloc(cmap, &m_col))
00482             m_set = true;
00483     }
00484     res = m_set;
00485 #endif
00486     return res;
00487 }

bool UBrush::DeleteObject ( void )

Definition at line 449 of file udraw.cpp.

Referenced by CreateSolidBrush(), and DrawNode().

00450 {
00451     bool res = false;
00452 #if qGTK
00453     if(m_set)
00454     {
00455         m_set = false;
00456         GdkColormap *cmap = gdk_colormap_get_system();
00457         if(cmap != 0L)
00458         {
00459             gdk_colormap_free_colors(cmap, &m_col, 1);
00460             res = true;
00461         }
00462     }
00463     else
00464         res = true;
00465 #endif
00466     return res;
00467 }

Friends And Related Function Documentation

friend class UDC [friend]

Definition at line 497 of file udraw.h.

The documentation for this class was generated from the following files:
  • rf/udraw.h
  • rf/udraw.cpp
Generated on Sun Oct 21 12:46:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CBuffer Class Reference

Collaboration diagram for CBuffer:

[legend]
List of all members.

Public Methods

CBuffer ()
void | append (const char *ptr, size_t s)
size_t | size () const
operator char * (void) const

Protected Attributes

size_t | m_curSize
CStaticAllocT< char > | m_buf

Constructor & Destructor Documentation

CBuffer::CBuffer ( ) [inline]

Definition at line 456 of file PythonGlue.cpp.

00456               : m_curSize(0)
00457     {
00458     }

Member Function Documentation

void CBuffer::append | ( | const char * | ptr,
 |  | size_t | s
 | ) | [inline]

Definition at line 460 of file PythonGlue.cpp.

Referenced by CPyCvsConsole::cvs_err(), and CPyCvsConsole::cvs_out().

00461     {
00462         if((s + m_curSize) > m_buf.size())
00463         {
00464             size_t step = s > 1024 ? s : 1024;
00465             m_buf.AdjustSize(m_buf.size() + step);
00466         }
00467 #ifdef WIN32
00468         char *tmp = (char *)m_buf + m_curSize;
00469         size_t incs = 0;
00470         while(s--)
00471         {
00472             char c = *ptr++;
00473             if(c == '\r')
00474                 continue;
00475             *tmp++ = c;
00476             incs++;
00477         }
00478         m_curSize += incs;
00479 #elif defined(macintosh)
00480         char *tmp = (char *)m_buf + m_curSize;
00481         size_t cnt = s;
00482         while(cnt--)
00483         {
00484             char c = *ptr++;
00485             if(c == '\r')
00486                 c = '\n';
00487             *tmp++ = c;
00488         }
00489         m_curSize += s;
00490 #else
00491         memcpy((char *)m_buf + m_curSize, ptr, s * sizeof(char));
00492         m_curSize += s;
00493 #endif
00494     }

CBuffer::operator char * ( void ) const [inline]

Definition at line 497 of file PythonGlue.cpp.

00497 { return m_buf; }

size_t CBuffer::size ( ) const [inline]

Definition at line 496 of file PythonGlue.cpp.

Referenced by cvsgui_RunCvs().

00496 { return m_curSize; }

Member Data Documentation

CStaticAllocT<char> CBuffer::m_buf [protected]

Definition at line 501 of file PythonGlue.cpp.

size_t CBuffer::m_curSize [protected]

Definition at line 500 of file PythonGlue.cpp.

The documentation for this class was generated from the following file:
  • common/PythonGlue.cpp
Generated on Sun Oct 21 12:46:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CButton Class Reference

Inheritance diagram for CButton:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJColorPicker.h
Generated on Sun Oct 21 12:46:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


change Struct Reference

#include <diff.h>

Collaboration diagram for change:

[legend]
List of all members.

Public Attributes

change * | link
int | inserted
int | deleted
int | line0
int | line1
char | ignore

Member Data Documentation

int change::deleted

Definition at line 203 of file diff.h.

char change::ignore

Definition at line 206 of file diff.h.

int change::inserted

Definition at line 202 of file diff.h.

int change::line0

Definition at line 204 of file diff.h.

int change::line1

Definition at line 205 of file diff.h.

struct change* change::link

Definition at line 201 of file diff.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/diff/diff.h
Generated on Sun Oct 21 12:46:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCharFormat Class Reference

Inheritance diagram for CCharFormat:

[legend]
Collaboration diagram for CCharFormat:

[legend]
List of all members.

Public Methods

CCharFormat ()
CCharFormat (const CHARFORMAT &newf)
operator CHARFORMAT & ()

Constructor & Destructor Documentation

CCharFormat::CCharFormat ( ) [inline]

Definition at line 50 of file wincvsView.cpp.

00051     {
00052         USES_CONVERSION;
00053         CString strDefFont = _T("Courier New");
00054         //VERIFY(strDefFont.LoadString(IDS_DEFFONT));
00055         cbSize = sizeof(CHARFORMAT);
00056         dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_STRIKEOUT|CFM_SIZE|
00057             CFM_COLOR|CFM_OFFSET|CFM_PROTECTED;
00058         dwEffects = CFE_AUTOCOLOR;
00059         yHeight = 200; //10pt
00060         yOffset = 0;
00061         crTextColor = RGB(0, 0, 0);
00062         bCharSet = 0;
00063         bPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
00064         ASSERT(strDefFont.GetLength() < LF_FACESIZE);
00065         lstrcpynA(szFaceName, T2A((LPTSTR) (LPCTSTR) strDefFont), LF_FACESIZE);
00066         dwMask |= CFM_FACE;
00067     }

CCharFormat::CCharFormat ( const CHARFORMAT & newf ) [inline]

Definition at line 68 of file wincvsView.cpp.

00069     {
00070         *(CHARFORMAT *)this = newf;
00071     }

Member Function Documentation

CCharFormat::operator CHARFORMAT & ( ) [inline]

Definition at line 72 of file wincvsView.cpp.

00073     {
00074         return *(CHARFORMAT *)this;
00075     }

The documentation for this class was generated from the following file:
  • WinCvs/wincvsView.cpp
Generated on Sun Oct 21 12:46:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJBrowseButton Class Reference

#include <CJBrowseEdit.h>

Inheritance diagram for CCJBrowseButton:

[legend]
Collaboration diagram for CCJBrowseButton:

[legend]
List of all members.

Public Methods

CCJBrowseButton ()
virtual | ~CCJBrowseButton ()
virtual void | UpdateFont ()
virtual UINT | GetNextID (CWnd *pWnd) const
virtual BOOL | Create (CWnd *pWnd, BROWSE_TYPE eType, UINT nMenu, UINT nSubMenuIndx)

Public Attributes

BOOL | m_bOpenFileDialog
CString | m_strDefExt
CString | m_strFileName
DWORD | m_dwFlags
CString | m_strFilter
CString | m_strTitle
CWnd * m_pParentWnd

Protected Methods

afx_msg void | OnClicked ()

Protected Attributes

UINT | m_nID
CWnd * m_pEditWnd
CFont | m_Font
BROWSE_TYPE m_eType
UINT | m_nMenu
UINT | m_nSubMenuIndx
HICON | m_hIcon

Constructor & Destructor Documentation

CCJBrowseButton::CCJBrowseButton ( )

Definition at line 105 of file CJBrowseEdit.cpp.

00106 {
00107     m_pParentWnd = NULL;
00108     m_pEditWnd   = NULL;
00109     m_hIcon      = NULL;
00110 }

CCJBrowseButton::~CCJBrowseButton ( ) [virtual]

Definition at line 112 of file CJBrowseEdit.cpp.

00113 {
00114     // fix potential resource leak - KStowell - 10-22-99.
00115     m_Font.DeleteObject();
00116     _destroyIcon(m_hIcon);
00117 }

Member Function Documentation

BOOL CCJBrowseButton::Create | ( | CWnd * | pWnd,
 |  | BROWSE_TYPE | eType,
 |  | UINT | nMenu,
 |  | UINT | nSubMenuIndx
 | ) | [virtual]

Definition at line 125 of file CJBrowseEdit.cpp.

Referenced by CCJBrowseEdit::InitializeControl().

00126 {
00127     ASSERT( eType );
00128     ASSERT_VALID( pWnd );
00129     ASSERT_VALID( pWnd->GetParent() );
00130
00131     m_pEditWnd      = pWnd;
00132     m_pParentWnd    = m_pEditWnd->GetParent();
00133     m_eType         = eType;
00134     m_nMenu         = nMenu;
00135     m_nSubMenuIndx  = nSubMenuIndx;
00136
00137     CRect rc;
00138     m_pEditWnd->GetWindowRect( &rc );
00139     m_pEditWnd->SetWindowPos( NULL, 0, 0, rc.Width()-23, rc.Height(), SWP_NOZORDER|SWP_NOMOVE );
00140     m_pParentWnd->ScreenToClient( &rc );
00141     rc.left = rc.right-18;
00142
00143     DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_CENTER|BS_VCENTER;
00144
00145     // if this is a browse for directory or file edit control.
00146     if(( m_eType == BT_DIRECTORY ) || ( m_eType == BT_FILE ))
00147     {
00148         if( !CButton::Create(_T("..."), dwStyle, rc, m_pParentWnd, GetNextID( m_pParentWnd )))
00149         {
00150             TRACE0( "Failed to create browse edit browse button.\n" );
00151             return FALSE;
00152         }
00153
00154         // set the tab order and font, enable the window based on parent's state.
00155         SetWindowPos( m_pEditWnd, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE );
00156         EnableWindow( m_pEditWnd->IsWindowEnabled( ));
00157         UpdateFont();
00158
00159         return TRUE;
00160     }
00161
00162     // if this is a popup menu edit control.
00163     else if( m_eType == BT_POPUPMENU )
00164     {
00165         if( !CButton::Create( NULL, dwStyle|BS_ICON, rc, m_pParentWnd, GetNextID( m_pParentWnd )))
00166         {
00167             TRACE0( "Failed to create browse edit browse button.\n" );
00168             return FALSE;
00169         }
00170
00171         // set the tab order and font, enable the window based on parent's state.
00172         SetWindowPos( m_pEditWnd, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE );
00173         EnableWindow( m_pEditWnd->IsWindowEnabled( ));
00174         UpdateFont();
00175
00176         // create the icon arrow that is displayed on the button.
00177         CImageList imageList;
00178         CBitmap    bitmap;
00179
00180         bitmap.LoadBitmap( IDB_BTN_ARROW );
00181         imageList.Create( 15, 17, ILC_COLORDDB|ILC_MASK, 1, 1 );
00182         imageList.Add( &bitmap, RGB( 255,0,255 ));
00183
00184         // set the icon and free resources.
00185         // fix potential resource leak - KStowell - 10-22-99.
00186         m_hIcon = imageList.ExtractIcon( 0 );
00187         SetIcon(m_hIcon);
00188         imageList.Detach();
00189         bitmap.DeleteObject();
00190
00191         return TRUE;
00192     }
00193
00194     return FALSE;
00195 }

_CJXLIB_INLINE UINT CCJBrowseButton::GetNextID ( CWnd * pWnd ) const [virtual]

Definition at line 239 of file CJBrowseEdit.h.

00240     { for(UINT nID=32767; nID!=1; --nID){if(!pWnd->GetDlgItem(nID)){return nID;}}return 0; }

void CCJBrowseButton::OnClicked ( ) [protected]

Definition at line 197 of file CJBrowseEdit.cpp.

00198 {
00199     if( m_eType == BT_DIRECTORY )
00200     {
00201         CCJShell sfi;
00202         sfi.m_strTitle = m_strTitle;
00203
00204         if( sfi.BrowseForFolder( m_pParentWnd ) == IDOK ) {
00205             m_pEditWnd->SetWindowText( sfi.m_strPath );
00206         }
00207     }
00208
00209     else if( m_eType == BT_FILE )
00210     {
00211         CFileDialog dlg( m_bOpenFileDialog, m_strDefExt, m_strFileName,
00212             m_dwFlags, m_strFilter, m_pParentWnd );
00213
00214         if( dlg.DoModal() == IDOK ) {
00215             m_pEditWnd->SetWindowText( dlg.GetPathName( ));
00216         }
00217     }
00218
00219     else if( m_eType == BT_POPUPMENU )
00220     {
00221         ASSERT( m_nMenu != 0 );
00222         SetState( true );
00223
00224         CRect rc;
00225         GetWindowRect( &rc );
00226
00227         CMenu menu;
00228         VERIFY( menu.LoadMenu( m_nMenu ));
00229
00230         CCJMenu* pPopup = (CCJMenu*)menu.GetSubMenu( m_nSubMenuIndx );
00231         ASSERT( pPopup != NULL );
00232
00233         pPopup->TrackPopupMenu( TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL,
00234             rc.right, rc.top, m_pParentWnd, &rc );
00235
00236         // Return the button state to normal.
00237         SetState( false );
00238     }
00239 }

void CCJBrowseButton::UpdateFont ( ) [virtual]

Definition at line 241 of file CJBrowseEdit.cpp.

00242 {
00243     m_Font.DeleteObject();
00244     NONCLIENTMETRICS ncm;
00245     ncm.cbSize = sizeof(ncm);
00246     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00247     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00248     SetFont(&m_Font);
00249 }

Member Data Documentation

CFont CCJBrowseButton::m_Font [protected]

Definition at line 110 of file CJBrowseEdit.h.

BOOL CCJBrowseButton::m_bOpenFileDialog

Definition at line 97 of file CJBrowseEdit.h.

Referenced by CCJBrowseEdit::SetDlgOpenFile().

DWORD CCJBrowseButton::m_dwFlags

Definition at line 101 of file CJBrowseEdit.h.

Referenced by CCJBrowseEdit::SetDlgStyle().

BROWSE_TYPE CCJBrowseButton::m_eType [protected]

Definition at line 111 of file CJBrowseEdit.h.

HICON CCJBrowseButton::m_hIcon [protected]

Definition at line 114 of file CJBrowseEdit.h.

UINT CCJBrowseButton::m_nID [protected]

Definition at line 108 of file CJBrowseEdit.h.

UINT CCJBrowseButton::m_nMenu [protected]

Definition at line 112 of file CJBrowseEdit.h.

UINT CCJBrowseButton::m_nSubMenuIndx [protected]

Definition at line 113 of file CJBrowseEdit.h.

CWnd* CCJBrowseButton::m_pEditWnd [protected]

Definition at line 109 of file CJBrowseEdit.h.

CWnd* CCJBrowseButton::m_pParentWnd

Definition at line 104 of file CJBrowseEdit.h.

Referenced by CCJBrowseEdit::SetDlgOwner().

CString CCJBrowseButton::m_strDefExt

Definition at line 99 of file CJBrowseEdit.h.

Referenced by CCJBrowseEdit::SetDlgDefExt().

CString CCJBrowseButton::m_strFileName

Definition at line 100 of file CJBrowseEdit.h.

Referenced by CCJBrowseEdit::SetDlgFileName().

CString CCJBrowseButton::m_strFilter

Definition at line 102 of file CJBrowseEdit.h.

Referenced by CCJBrowseEdit::SetDlgFilter().

CString CCJBrowseButton::m_strTitle

Definition at line 103 of file CJBrowseEdit.h.

Referenced by CCJBrowseEdit::SetDlgTitle().

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJBrowseEdit.h
  • WinCvs/CJLib/CJLibrary/CJBrowseEdit.cpp
Generated on Sun Oct 21 12:46:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJBrowseEdit Class Reference

#include <CJBrowseEdit.h>

Inheritance diagram for CCJBrowseEdit:

[legend]
Collaboration diagram for CCJBrowseEdit:

[legend]
List of all members.

Public Methods

CCJBrowseEdit ()
virtual | ~CCJBrowseEdit ()
virtual void | InitializeControl ()
virtual void | SetDlgOpenFile (BOOL bOpenFileDialog)
virtual void | SetDlgDefExt (LPCTSTR strDefExt)
virtual void | SetDlgFileName (LPCTSTR strFileName)
virtual void | SetDlgStyle (DWORD dwFlags)
virtual void | SetDlgFilter (LPCTSTR strFilter)
virtual void | SetDlgOwner (CWnd *pParentWnd)
virtual void | SetDlgTitle (LPCTSTR strTitle)
virtual void | SetSearchType (BROWSE_TYPE eType, UINT nMenu=0, int nSubMenuIndx=0)

Protected Methods

virtual void | PreSubclassWindow ()
afx_msg void | OnEnable (BOOL bEnable)
afx_msg void | OnShowWindow (BOOL bShow, UINT nStatus)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)

Protected Attributes

CCJBrowseButton m_btnBrowse
BROWSE_TYPE m_eType
UINT | m_nMenu
UINT | m_nSubMenuIndx

Constructor & Destructor Documentation

CCJBrowseEdit::CCJBrowseEdit ( )

Definition at line 254 of file CJBrowseEdit.cpp.

00254                              : m_eType( BT_DIRECTORY ), m_nMenu( (UINT)-1 )
00255 {
00256
00257 }

CCJBrowseEdit::~CCJBrowseEdit ( ) [virtual]

Definition at line 259 of file CJBrowseEdit.cpp.

00260 {
00261 }

Member Function Documentation

void CCJBrowseEdit::InitializeControl ( ) [virtual]

Definition at line 305 of file CJBrowseEdit.cpp.

Referenced by OnCreate(), and PreSubclassWindow().

00306 {
00307     // create the browse button associated with this control.
00308     if( m_btnBrowse.Create( this, m_eType, m_nMenu, m_nSubMenuIndx ))
00309     {
00310         // initialize some defaults
00311         SetDlgOpenFile();
00312         SetDlgDefExt( _T( "*.*" ));
00313         SetDlgFileName();
00314         SetDlgStyle( OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_EXPLORER );
00315         SetDlgFilter( _T( "All Files (*.*)|*.*||" ));
00316         SetDlgOwner( GetParent( ));
00317         SetDlgTitle( _T( "Select Folder" ));
00318     }
00319 }

int CCJBrowseEdit::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 294 of file CJBrowseEdit.cpp.

00295 {
00296     if (CEdit::OnCreate(lpCreateStruct) == -1)
00297         return -1;
00298
00299     // initialize control to defaults.
00300     InitializeControl();
00301
00302     return 0;
00303 }

void CCJBrowseEdit::OnEnable ( BOOL bEnable ) [protected]

Definition at line 274 of file CJBrowseEdit.cpp.

00275 {
00276     CEdit::OnEnable(bEnable);
00277     m_btnBrowse.EnableWindow(bEnable);
00278 }

void CCJBrowseEdit::OnShowWindow | ( | BOOL | bShow,
 |  | UINT | nStatus
 | ) | [protected]

Definition at line 280 of file CJBrowseEdit.cpp.

00281 {
00282     CEdit::OnShowWindow( bShow, nStatus );
00283     m_btnBrowse.ShowWindow( bShow?SW_SHOW:SW_HIDE );
00284 }

void CCJBrowseEdit::PreSubclassWindow ( ) [protected, virtual]

Definition at line 286 of file CJBrowseEdit.cpp.

00287 {
00288     CEdit::PreSubclassWindow();
00289
00290     // initialize control to defaults.
00291     InitializeControl();
00292 }

_CJXLIB_INLINE void CCJBrowseEdit::SetDlgDefExt ( LPCTSTR strDefExt = NULL ) [virtual]

Definition at line 245 of file CJBrowseEdit.h.

Referenced by InitializeControl().

00246     { m_btnBrowse.m_strDefExt = strDefExt; }

_CJXLIB_INLINE void CCJBrowseEdit::SetDlgFileName ( LPCTSTR strFileName = NULL ) [virtual]

Definition at line 248 of file CJBrowseEdit.h.

Referenced by InitializeControl().

00249     { m_btnBrowse.m_strFileName = strFileName; }

_CJXLIB_INLINE void CCJBrowseEdit::SetDlgFilter ( LPCTSTR strFilter = NULL ) [virtual]

Definition at line 254 of file CJBrowseEdit.h.

Referenced by InitializeControl().

00255     { m_btnBrowse.m_strFilter = strFilter; }

_CJXLIB_INLINE void CCJBrowseEdit::SetDlgOpenFile ( BOOL bOpenFileDialog = TRUE ) [virtual]

Definition at line 242 of file CJBrowseEdit.h.

Referenced by InitializeControl().

00243     { m_btnBrowse.m_bOpenFileDialog = bOpenFileDialog; }

_CJXLIB_INLINE void CCJBrowseEdit::SetDlgOwner ( CWnd * pParentWnd = NULL ) [virtual]

Definition at line 257 of file CJBrowseEdit.h.

Referenced by InitializeControl().

00258     { m_btnBrowse.m_pParentWnd = pParentWnd; }

_CJXLIB_INLINE void CCJBrowseEdit::SetDlgStyle ( DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT ) [virtual]

Definition at line 251 of file CJBrowseEdit.h.

Referenced by InitializeControl().

00252     { m_btnBrowse.m_dwFlags = dwFlags; }

_CJXLIB_INLINE void CCJBrowseEdit::SetDlgTitle ( LPCTSTR strTitle = NULL ) [virtual]

Definition at line 260 of file CJBrowseEdit.h.

Referenced by InitializeControl().

00261     { m_btnBrowse.m_strTitle = strTitle; }

_CJXLIB_INLINE void CCJBrowseEdit::SetSearchType | ( | BROWSE_TYPE | eType,
 |  | UINT | nMenu = 0,
 |  | int | nSubMenuIndx = 0
 | ) | [virtual]

Definition at line 263 of file CJBrowseEdit.h.

00264     { m_eType = eType; m_nMenu = nMenu; m_nSubMenuIndx = nSubMenuIndx; }

Member Data Documentation

CCJBrowseButton CCJBrowseEdit::m_btnBrowse [protected]

Definition at line 159 of file CJBrowseEdit.h.

BROWSE_TYPE CCJBrowseEdit::m_eType [protected]

Definition at line 160 of file CJBrowseEdit.h.

UINT CCJBrowseEdit::m_nMenu [protected]

Definition at line 161 of file CJBrowseEdit.h.

UINT CCJBrowseEdit::m_nSubMenuIndx [protected]

Definition at line 162 of file CJBrowseEdit.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJBrowseEdit.h
  • WinCvs/CJLib/CJLibrary/CJBrowseEdit.cpp
Generated on Sun Oct 21 12:46:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJCaption Class Reference

#include <CJCaption.h>

Inheritance diagram for CCJCaption:

[legend]
Collaboration diagram for CCJCaption:

[legend]
List of all members.

Public Methods

CCJCaption ()
virtual | ~CCJCaption ()
virtual void | SetCaptionColors (COLORREF clrBorder, COLORREF clrBackground, COLORREF clrFont)
virtual void | ModifyCaptionStyle (int nBorderSize, CFont *pFont=NULL, LPCTSTR lpszWindText=NULL, HICON hIcon=NULL)
virtual void | SetChildWindow (CWnd *pChild, CWnd *pNotifyWnd)
virtual void | KillChildWindow ()
virtual void | DrawCaptionBack (CDC *pDC, CRect &rcItem)
virtual void | DrawCaptionText (CDC *pDC, CRect &rcItem)
virtual void | DrawCaptionIcon (CDC *pDC, CRect &rcItem)
virtual void | UpdateFont ()
virtual void | UpdateCaption (LPCTSTR lpszWindowText, HICON hIcon)
virtual void | UpdateCaptionBack (CDC *pDC, CRect &rcItem)
virtual void | UpdateCaptionText (CDC *pDC, CRect &rcItem)
virtual void | SetTextStyle (DWORD dwStyle)
virtual BOOL | Create (CWnd *pParentWnd, LPCTSTR lpszWindowName, DWORD dwExStyle=0x01, DWORD dwStyle=WS_VISIBLE|SS_CENTER|SS_CENTERIMAGE, const CRect &rect=CRect(0, 0, 0, 0), UINT nID=0xffff)

Protected Methods

afx_msg void | OnPaint ()
afx_msg void | OnSysColorChange ()
afx_msg void | OnSize (UINT nType, int cx, int cy)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnCaptButton ()
afx_msg void | OnPushPinButton (UINT lParam, LONG wParam)
afx_msg void | OnPushPinCancel (UINT lParam, LONG wParam)

Protected Attributes

COLORREF | m_clrBtnHilite
COLORREF | m_clrBtnShadow
COLORREF | m_clrBtnFace
COLORREF | m_clrBorder
COLORREF | m_clrBackgnd
COLORREF | m_clrFont
int | m_nBorder
CFont * | m_pFont
CFont | m_Font
HICON | m_hIcon
CString | m_strWindText
int | m_cx
int | m_cy
int | m_nOffset
CWnd * m_pChildWnd
CWnd * m_pNotifyWnd
CCJCaptionButton m_CaptionButton
CCJCaptionPopupWnd * m_pWndPopDown
CRect | m_rcChild
DWORD | m_dwExStyle
CRect | m_rcClient
DWORD | m_dwTextStyle

Constructor & Destructor Documentation

CCJCaption::CCJCaption ( )

Definition at line 193 of file CJCaption.cpp.

00194 {
00195     m_strWindText   = _T("");
00196     m_pNotifyWnd    = NULL;
00197     m_pWndPopDown   = NULL;
00198     m_pChildWnd     = NULL;
00199     m_cx            = ::GetSystemMetrics(SM_CXSMICON);
00200     m_cy            = ::GetSystemMetrics(SM_CYSMICON);
00201     m_clrBtnHilite  = ::GetSysColor(COLOR_BTNHILIGHT);
00202     m_clrBtnShadow  = ::GetSysColor(COLOR_BTNSHADOW);
00203     m_clrBtnFace    = ::GetSysColor(COLOR_BTNFACE);
00204     m_clrFont       = ::GetSysColor(COLOR_WINDOWTEXT);
00205     m_clrBorder     = ::GetSysColor(COLOR_BTNFACE);
00206     m_clrBackgnd    = ::GetSysColor(COLOR_BTNFACE);
00207     m_nBorder       = 0;
00208     m_pFont         = NULL;
00209     m_hIcon         = NULL;
00210
00211     SetTextStyle( DT_SINGLELINE|DT_END_ELLIPSIS );
00212 }

CCJCaption::~CCJCaption ( ) [virtual]

Definition at line 214 of file CJCaption.cpp.

00215 {
00216     // fix potential resource leak - KStowell - 10-22-99.
00217     m_Font.DeleteObject();
00218 }

Member Function Documentation

BOOL CCJCaption::Create | ( | CWnd * | pParentWnd,
 |  | LPCTSTR | lpszWindowName,
 |  | DWORD | dwExStyle = 0x01,
 |  | DWORD | dwStyle = WS_VISIBLE|SS_CENTER|SS_CENTERIMAGE,
 |  | const CRect & | rect = CRect(0,0,0,0),
 |  | UINT | nID = 0xffff
 | ) | [virtual]

Definition at line 355 of file CJCaption.cpp.

Referenced by CCJExplorerBar::OnCreate().

00356 {
00357     // Let the base class create the control.
00358     if( !CStatic::Create( NULL, dwStyle, rect, pParentWnd, nID ))
00359     {
00360         TRACE(_T("Unable to create caption.\n"));
00361         return FALSE;
00362     }
00363
00364     UpdateFont();
00365
00366     // save the style.
00367     if( dwExStyle & WS_EX_FLATEDGE ) {
00368         m_dwExStyle = dwExStyle;
00369     }
00370
00371     else {
00372         ModifyStyleEx( 0, dwExStyle );
00373     }
00374
00375     // Save the window text.
00376     m_strWindText = lpszWindowName;
00377
00378     // Create the button to be used with child window.
00379     if( !m_CaptionButton.Create( m_strWindText, BS_ICON|BS_OWNERDRAW|BS_VCENTER,
00380         CRect(0,0,0,0), this, IDC_CAPT_BUTTON ))
00381     {
00382         TRACE0( "Unable to create caption button.\n" );
00383         return FALSE;
00384     }
00385
00386     // set the button font and colors.
00387     m_CaptionButton.SetButtonStyle( m_pFont, m_clrBackgnd, m_clrFont );
00388
00389     return TRUE;
00390 }

void CCJCaption::DrawCaptionBack | ( | CDC * | pDC,
 |  | CRect & | rcItem
 | ) | [virtual]

Definition at line 270 of file CJCaption.cpp.

00271 {
00272     CRect rc = rcItem;
00273
00274     // Set the background mode to transparent.
00275     pDC->SetBkMode( TRANSPARENT );
00276
00277     // repaint the background.
00278     pDC->FillSolidRect( rc, m_clrBtnFace );
00279
00280     // draw the caption border.
00281     if( m_dwExStyle & WS_EX_FLATEDGE ) {
00282         pDC->Draw3dRect(rc, m_clrBtnHilite, m_clrBtnShadow);
00283     }
00284
00285     // draw the caption banner border.
00286     if( m_nBorder != 0 ) {
00287         rc.DeflateRect( m_nBorder, m_nBorder );
00288         pDC->FillSolidRect(rc, m_clrBackgnd);
00289     }
00290 }

void CCJCaption::DrawCaptionIcon | ( | CDC * | pDC,
 |  | CRect & | rcItem
 | ) | [virtual]

Definition at line 320 of file CJCaption.cpp.

Referenced by UpdateCaption().

00321 {
00322     // If no icon was defined, just return.
00323     if( m_hIcon == NULL )
00324         return;
00325
00326     CRect rc = rcItem;
00327     rc.left = ( rc.right - m_cx )-( m_nBorder + 2 );
00328
00329     // stop the icon at the left hand border
00330     if (rc.left < m_nBorder) {
00331         rc.left = m_nBorder;
00332     }
00333
00334     rc.top = ( rcItem.Height() - m_cy )/2;
00335     rc.right = rc.left + m_cx;
00336     rc.bottom = rc.top + m_cy;
00337
00338     // Only draw the icon if it will fit into the space between the borders
00339     if (rc.right < rcItem.right - m_nBorder) {
00340         // draw the icon associated with the caption.
00341         ::DrawIconEx( pDC->GetSafeHdc(), rc.left, rc.top, m_hIcon,
00342             rc.Width(), rc.Height(), NULL, (HBRUSH)NULL, DI_NORMAL);
00343     }
00344 }

void CCJCaption::DrawCaptionText | ( | CDC * | pDC,
 |  | CRect & | rcItem
 | ) | [virtual]

Definition at line 292 of file CJCaption.cpp.

Referenced by UpdateCaptionText().

00293 {
00294     // if the caption text is empty, return.
00295     if( m_strWindText.IsEmpty( ))
00296         return;
00297
00298     if( m_pFont == NULL ) {
00299         m_pFont = &m_Font;
00300     }
00301
00302     CRect rc = rcItem;
00303     rc.OffsetRect( 10,0 );
00304
00305     // Set the text color and select the caption font.
00306     pDC->SetTextColor( m_clrFont );
00307     CFont* oldFont = pDC->SelectObject( m_pFont );
00308
00309     // get the height of the text to be displayed.
00310     int cy = pDC->DrawText( m_strWindText, -1, rc, DT_SINGLELINE|DT_CALCRECT );
00311     rc.top = (rcItem.Height()-cy)/2;
00312     rc.bottom = rc.top+cy;
00313     rc.right  = rcItem.right-(m_cx + m_nBorder);
00314
00315     // draw the text, and select the original font.
00316     pDC->DrawText( m_strWindText, rc, m_dwTextStyle );
00317     pDC->SelectObject( oldFont );
00318 }

void CCJCaption::KillChildWindow ( ) [virtual]

Definition at line 436 of file CJCaption.cpp.

Referenced by OnPushPinButton().

00437 {
00438     m_CaptionButton.SetState(FALSE);
00439     m_CaptionButton.ModifyStyle( WS_VISIBLE, 0 );
00440     m_pWndPopDown->DestroyWindow();
00441     _delete( m_pWndPopDown );
00442 }

void CCJCaption::ModifyCaptionStyle | ( | int | nBorderSize,
 |  | CFont * | pFont = NULL,
 |  | LPCTSTR | lpszWindText = NULL,
 |  | HICON | hIcon = NULL
 | ) | [virtual]

Definition at line 392 of file CJCaption.cpp.

00393 {
00394     ASSERT(::IsWindow(m_hWnd));
00395
00396     if( nBorderSize ) {
00397         m_nBorder = nBorderSize;
00398     }
00399
00400     if( pFont ) {
00401         m_pFont = pFont;
00402         m_CaptionButton.SetButtonStyle( m_pFont, m_clrBackgnd, m_clrFont );
00403     }
00404
00405     if( lpszWindText ) {
00406         m_strWindText = lpszWindText;
00407     }
00408
00409     if( hIcon ) {
00410         m_hIcon = hIcon;
00411     }
00412
00413     Invalidate();
00414 }

void CCJCaption::OnCaptButton ( ) [protected]

Definition at line 467 of file CJCaption.cpp.

00468 {
00469     CRect rc;
00470     m_CaptionButton.GetWindowRect(&rc);
00471     rc.right  = rc.left + m_rcChild.Width();
00472     rc.top    = rc.bottom;
00473     rc.bottom = rc.top + m_rcChild.Height();
00474
00475     //if window is already present delete it
00476     _delete( m_pWndPopDown );
00477
00478     // Get the class name and create the window
00479     m_pWndPopDown = new CCJCaptionPopupWnd;
00480     m_pWndPopDown->Create( rc, this, m_pChildWnd );
00481     m_pChildWnd->ShowWindow(SW_SHOW);
00482     m_CaptionButton.SetState(TRUE);
00483 }

BOOL CCJCaption::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 584 of file CJCaption.cpp.

00585 {
00586     // KStowell - overridden for flicker-free drawing.
00587     UNUSED_ALWAYS(pDC);
00588     return TRUE;
00589 }

void CCJCaption::OnPaint ( ) [protected]

Definition at line 235 of file CJCaption.cpp.

00236 {
00237     CPaintDC dc(this); // device context for painting
00238
00239     // KStowell - Get the client rect.
00240     CRect rcClient;
00241     GetClientRect( &rcClient );
00242
00243     // KStowell - Create a memory device-context. This is done to help reduce
00244     // screen flicker, since we will paint the entire control to the
00245     // off screen device context first.
00246     CDC memDC;
00247     CBitmap bitmap;
00248     memDC.CreateCompatibleDC(&dc);
00249     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00250     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00251     memDC.FillSolidRect( rcClient, m_clrBtnFace );
00252
00253     // First let the control do its default drawing.
00254     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00255
00256     // draw the backgound, text and icon.
00257     DrawCaptionBack( &memDC, rcClient );
00258     DrawCaptionText( &memDC, rcClient );
00259     DrawCaptionIcon( &memDC, rcClient );
00260
00261     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00262     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00263
00264     // KStowell - Cleanup resources.
00265     memDC.SelectObject(pOldBitmap);
00266     memDC.DeleteDC();
00267     bitmap.DeleteObject();
00268 }

void CCJCaption::OnPushPinButton | ( | UINT | lParam,
 |  | LONG | wParam
 | ) | [protected]

Definition at line 485 of file CJCaption.cpp.

00486 {
00487     UNUSED_ALWAYS( lParam );
00488     UNUSED_ALWAYS( wParam );
00489
00490     KillChildWindow();
00491     m_pNotifyWnd->SendMessage(CM_ONPUSHPINBUTTON, 0, 0);
00492     m_pChildWnd->GetParent()->GetClientRect(&m_rcChild);
00493     if(m_nOffset>0) {
00494         m_rcChild.top += m_nOffset;
00495     }
00496     m_pChildWnd->MoveWindow(m_rcChild);
00497     Invalidate();
00498 }

void CCJCaption::OnPushPinCancel | ( | UINT | lParam,
 |  | LONG | wParam
 | ) | [protected]

Definition at line 500 of file CJCaption.cpp.

00501 {
00502     UNUSED_ALWAYS( lParam );
00503     UNUSED_ALWAYS( wParam );
00504
00505     m_CaptionButton.SetState(FALSE);
00506     m_pWndPopDown->DestroyWindow();
00507
00508     _delete( m_pWndPopDown );
00509
00510     m_pNotifyWnd->SendMessage(CM_ONPUSHPINCANCEL, 0, 0);
00511 }

void CCJCaption::OnSize | ( | UINT | nType,
 |  | int | cx,
 |  | int | cy
 | ) | [protected]

Definition at line 444 of file CJCaption.cpp.

00445 {
00446     CStatic::OnSize(nType, cx, cy);
00447
00448     if( m_CaptionButton.GetSafeHwnd())
00449     {
00450         CDC* pDC = GetDC();
00451         CFont* pOldFont = pDC->SelectObject(m_pFont);
00452
00453         TEXTMETRIC tm;
00454         pDC->GetTextMetrics(&tm);
00455
00456         CSize size = pDC->GetTextExtent(m_strWindText, m_strWindText.GetLength());
00457         size.cx += tm.tmAveCharWidth+21;
00458         pDC->SelectObject(pOldFont);
00459         ReleaseDC(pDC);
00460
00461         CRect rc( 0, 0, size.cx, cy );
00462         rc.DeflateRect(m_nBorder+1, m_nBorder+1);
00463         m_CaptionButton.MoveWindow(rc);
00464     }
00465 }

void CCJCaption::OnSysColorChange ( ) [protected]

Definition at line 346 of file CJCaption.cpp.

00347 {
00348     CStatic::OnSysColorChange();
00349
00350     m_clrBtnHilite = ::GetSysColor(COLOR_BTNHILIGHT);
00351     m_clrBtnShadow = ::GetSysColor(COLOR_BTNSHADOW);
00352     m_clrBtnFace   = ::GetSysColor(COLOR_BTNFACE);
00353 }

_CJXLIB_INLINE void CCJCaption::SetCaptionColors | ( | COLORREF | clrBorder,
 |  | COLORREF | clrBackground,
 |  | COLORREF | clrFont
 | ) | [virtual]

Definition at line 240 of file CJCaption.h.

00241     { ASSERT(::IsWindow(m_hWnd)); m_clrBorder = clrBorder; m_clrBackgnd = clrBackground; m_clrFont = clrFont; }

void CCJCaption::SetChildWindow | ( | CWnd * | pChild,
 |  | CWnd * | pNotifyWnd
 | ) | [virtual]

Definition at line 416 of file CJCaption.cpp.

00417 {
00418     ASSERT( pChild != NULL );       // must be valid.
00419     ASSERT( pNotifyWnd != NULL );   // must be valid.
00420
00421     // save window pointers, and show caption button.
00422     m_pChildWnd  = pChild;
00423     m_pNotifyWnd = pNotifyWnd;
00424
00425     // set the size of the child window.
00426     m_pChildWnd->GetWindowRect(&m_rcChild);
00427
00428     CRect rcClient;
00429     m_pChildWnd->GetParent()->GetClientRect(&rcClient);
00430     m_nOffset = rcClient.Height()-m_rcChild.Height();
00431
00432     m_CaptionButton.ModifyStyle( 0, WS_VISIBLE );
00433     Invalidate();
00434 }

_CJXLIB_INLINE void CCJCaption::SetTextStyle ( DWORD dwStyle ) [virtual]

Definition at line 237 of file CJCaption.h.

Referenced by CCJCaption().

00238     { m_dwTextStyle = dwStyle; }

void CCJCaption::UpdateCaption | ( | LPCTSTR | lpszWindowText,
 |  | HICON | hIcon
 | ) | [virtual]

Definition at line 513 of file CJCaption.cpp.

00514 {
00515     ASSERT(::IsWindow(m_hWnd));
00516
00517     CRect rcClient;
00518     GetClientRect(&rcClient);
00519     CDC* pDC = GetDC();
00520
00521     UpdateCaptionBack(pDC, rcClient);
00522
00523     if( lpszWindowText )
00524     {
00525         m_strWindText = lpszWindowText;
00526         UpdateCaptionText(pDC, rcClient);
00527     }
00528
00529     if( hIcon ) {
00530         m_hIcon = hIcon;
00531         DrawCaptionIcon( pDC, rcClient );
00532     }
00533
00534     ReleaseDC(pDC);
00535 }

void CCJCaption::UpdateCaptionBack | ( | CDC * | pDC,
 |  | CRect & | rcItem
 | ) | [virtual]

Definition at line 537 of file CJCaption.cpp.

Referenced by UpdateCaption().

00538 {
00539     CRect rc = rcItem;
00540
00541     // Set the background mode to transparent.
00542     pDC->SetBkMode( TRANSPARENT );
00543
00544     rc.DeflateRect(1,1);
00545     // repaint the background.
00546     pDC->FillSolidRect( rc, m_clrBtnFace );
00547
00548     // draw the caption banner border.
00549     if( m_nBorder != 0 ) {
00550         rc.DeflateRect( m_nBorder-1, m_nBorder-1 );
00551         pDC->FillSolidRect(rc, m_clrBackgnd);
00552     }
00553 }

void CCJCaption::UpdateCaptionText | ( | CDC * | pDC,
 |  | CRect & | rcItem
 | ) | [virtual]

Definition at line 555 of file CJCaption.cpp.

Referenced by UpdateCaption().

00556 {
00557     CFont* pOldFont = pDC->SelectObject(m_pFont);
00558
00559     TEXTMETRIC tm;
00560     pDC->GetTextMetrics(&tm);
00561
00562     CSize size = pDC->GetTextExtent(m_strWindText, m_strWindText.GetLength());
00563     size.cx += tm.tmAveCharWidth+21;
00564     pDC->SelectObject(pOldFont);
00565
00566     CRect rc( 0, 0, size.cx, rcItem.Height() );
00567     rc.DeflateRect(m_nBorder+1, m_nBorder+1);
00568     m_CaptionButton.MoveWindow(rc);
00569     m_CaptionButton.SetWindowText(m_strWindText);
00570
00571     DrawCaptionText( pDC, rcItem );
00572 }

void CCJCaption::UpdateFont ( ) [virtual]

Definition at line 574 of file CJCaption.cpp.

00575 {
00576     m_Font.DeleteObject();
00577     NONCLIENTMETRICS ncm;
00578     ncm.cbSize = sizeof(ncm);
00579     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00580     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00581     m_pFont = &m_Font;
00582 }

Member Data Documentation

CCJCaptionButton CCJCaption::m_CaptionButton [protected]

Definition at line 162 of file CJCaption.h.

CFont CCJCaption::m_Font [protected]

Definition at line 153 of file CJCaption.h.

COLORREF CCJCaption::m_clrBackgnd [protected]

Definition at line 149 of file CJCaption.h.

COLORREF CCJCaption::m_clrBorder [protected]

Definition at line 148 of file CJCaption.h.

COLORREF CCJCaption::m_clrBtnFace [protected]

Definition at line 147 of file CJCaption.h.

COLORREF CCJCaption::m_clrBtnHilite [protected]

Definition at line 145 of file CJCaption.h.

COLORREF CCJCaption::m_clrBtnShadow [protected]

Definition at line 146 of file CJCaption.h.

COLORREF CCJCaption::m_clrFont [protected]

Definition at line 150 of file CJCaption.h.

int CCJCaption::m_cx [protected]

Definition at line 156 of file CJCaption.h.

int CCJCaption::m_cy [protected]

Definition at line 157 of file CJCaption.h.

DWORD CCJCaption::m_dwExStyle [protected]

Definition at line 165 of file CJCaption.h.

DWORD CCJCaption::m_dwTextStyle [protected]

Definition at line 167 of file CJCaption.h.

HICON CCJCaption::m_hIcon [protected]

Definition at line 154 of file CJCaption.h.

int CCJCaption::m_nBorder [protected]

Definition at line 151 of file CJCaption.h.

int CCJCaption::m_nOffset [protected]

Definition at line 158 of file CJCaption.h.

CWnd* CCJCaption::m_pChildWnd [protected]

Definition at line 160 of file CJCaption.h.

CFont* CCJCaption::m_pFont [protected]

Definition at line 152 of file CJCaption.h.

CWnd* CCJCaption::m_pNotifyWnd [protected]

Definition at line 161 of file CJCaption.h.

CCJCaptionPopupWnd* CCJCaption::m_pWndPopDown [protected]

Definition at line 163 of file CJCaption.h.

CRect CCJCaption::m_rcChild [protected]

Definition at line 164 of file CJCaption.h.

CRect CCJCaption::m_rcClient [protected]

Definition at line 166 of file CJCaption.h.

CString CCJCaption::m_strWindText [protected]

Definition at line 155 of file CJCaption.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJCaption.h
  • WinCvs/CJLib/CJLibrary/CJCaption.cpp
Generated on Sun Oct 21 12:46:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJCaptionButton Class Reference

#include <CJCaption.h>

Inheritance diagram for CCJCaptionButton:

[legend]
Collaboration diagram for CCJCaptionButton:

[legend]
List of all members.

Public Methods

virtual BOOL | SetButtonStyle (CFont *pFont, COLORREF clrBackground, COLORREF clrFont)
virtual void | DrawButtonText (CDC *pDC, UINT nState, CRect &rcItem)

Protected Methods

afx_msg void | OnSysColorChange ()

Member Function Documentation

void CCJCaptionButton::DrawButtonText | ( | CDC * | pDC,
 |  | UINT | nState,
 |  | CRect & | rcItem
 | ) | [virtual]

Reimplemented from CCJFlatButton.

Definition at line 135 of file CJCaption.cpp.

00136 {
00137     // Get the window text, return if empty.
00138     CString strWindowText; GetWindowText(strWindowText);
00139     if( strWindowText.IsEmpty( ))
00140         return;
00141
00142     if( m_pFont == NULL ) {
00143         m_pFont = &m_Font;
00144     }
00145
00146     CRect rc = rcItem;
00147     rc.DeflateRect( 5,0 );
00148
00149     // Set the text color and select the button font.
00150     pDC->SetTextColor(( nState & ODS_DISABLED )?m_clrTextGy:m_clrTextNm);
00151     CFont *oldFont = pDC->SelectObject( m_pFont );
00152
00153     // get the height of the text to be displayed.
00154     int cy = pDC->DrawText( strWindowText, -1, rc, DT_SINGLELINE|DT_CALCRECT );
00155     rc.top = (rcItem.Height()-cy)/2;
00156
00157     // draw the text, and select the original font.
00158     pDC->DrawState( rc.TopLeft(), strWindowText.GetLength(), strWindowText,
00159         ( nState & ODS_DISABLED )?DSS_DISABLED:DSS_NORMAL, TRUE, 0, (HBRUSH)NULL );
00160
00161     // Set up pen to use for drawing the triangle
00162     CPen pen(PS_SOLID, 1, m_clrTextNm);
00163     CPen *pOldPen = pDC->SelectObject( &pen );
00164
00165     // get the client rect.
00166     CRect rcWnd;
00167     GetClientRect(&rcWnd);
00168
00169     // initialize coordinates for triangle.
00170     int x1 = rcWnd.right-11;
00171     int x2 = rcWnd.right-6;
00172     int y1 = rcWnd.bottom-7;
00173     int y2 = rcWnd.bottom-5;
00174
00175     // draw the triangle.
00176     pDC->MoveTo( x1, y1 );
00177     pDC->LineTo( x2, y1 );
00178     pDC->MoveTo( x1+1, y1+1 );
00179     pDC->LineTo( x2-1, y1+1 );
00180     pDC->SetPixel( x1+2, y2, m_clrTextNm );
00181
00182     // restore old pen and font.
00183     pDC->SelectObject( oldFont );
00184     pDC->SelectObject( pOldPen );
00185
00186     // fix potential resource leak - KStowell - 10-21-99
00187     pen.DeleteObject();
00188 }

afx_msg void CCJCaptionButton::OnSysColorChange ( ) [protected]

Reimplemented from CCJFlatButton.

BOOL CCJCaptionButton::SetButtonStyle | ( | CFont * | pFont,
 |  | COLORREF | clrBackground,
 |  | COLORREF | clrFont
 | ) | [virtual]

Definition at line 128 of file CJCaption.cpp.

Referenced by CCJCaption::ModifyCaptionStyle().

00129 {
00130     m_pFont = pFont;
00131     SetAlternateColors(clrBackground, m_clrHilite, m_clrDkShad, clrFont);
00132     return TRUE;
00133 }

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJCaption.h
  • WinCvs/CJLib/CJLibrary/CJCaption.cpp
Generated on Sun Oct 21 12:46:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJCaptionPopupWnd Class Reference

#include <CJCaptionPopupWnd.h>

Inheritance diagram for CCJCaptionPopupWnd:

[legend]
Collaboration diagram for CCJCaptionPopupWnd:

[legend]
List of all members.

Public Methods

CCJCaptionPopupWnd ()
virtual BOOL | Create (const CRect &rect, CWnd *pParentWnd, CWnd *pChildWnd)
virtual | ~CCJCaptionPopupWnd ()

Public Attributes

CWnd * m_pParentWnd
CWnd * m_pChildWnd
CWnd * m_pChildParent

Protected Methods

afx_msg void | OnDestroy ()
afx_msg void | OnCaptButton ()
afx_msg void | OnPaint ()
afx_msg void | OnTimer (UINT nIDEvent)

Protected Attributes

CCJCaption m_Caption
CCJFlatButton m_CaptionButton
HICON | m_hIconOn
HICON | m_hIconOff

Constructor & Destructor Documentation

CCJCaptionPopupWnd::CCJCaptionPopupWnd ( )

Definition at line 60 of file CJCaptionPopupWnd.cpp.

00061 {
00062     m_pChildWnd     = NULL;
00063     m_pChildParent  = NULL;
00064     m_pParentWnd    = NULL;
00065     m_hIconOn       = NULL;
00066     m_hIconOff      = NULL;
00067 }

CCJCaptionPopupWnd::~CCJCaptionPopupWnd ( ) [virtual]

Definition at line 69 of file CJCaptionPopupWnd.cpp.

00070 {
00071     // fix potential resource leak - KStowell - 10-22-99.
00072     _destroyIcon(m_hIconOn);
00073     _destroyIcon(m_hIconOff);
00074     DestroyWindow();
00075 }

Member Function Documentation

BOOL CCJCaptionPopupWnd::Create | ( | const CRect & | rect,
 |  | CWnd * | pParentWnd,
 |  | CWnd * | pChildWnd
 | ) | [virtual]

Definition at line 89 of file CJCaptionPopupWnd.cpp.

Referenced by CCJCaption::OnCaptButton().

00090 {
00091     ASSERT(pParentWnd != NULL); // must be valid.
00092     m_pParentWnd = pParentWnd;
00093
00094     ASSERT(pChildWnd  != NULL); // must be valid.
00095     m_pChildWnd = pChildWnd;
00096
00097     // register the wnd class.
00098     CString wndClass = ::AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW,
00099         0, ::GetSysColorBrush(COLOR_BTNFACE));
00100
00101     // define the styles for this window.
00102     DWORD dwStyleEx = WS_EX_TOOLWINDOW;
00103     DWORD dwStyle   = WS_VISIBLE|WS_POPUP|WS_DLGFRAME;
00104
00105     // call the base class for creation.
00106     if( !CWnd::CreateEx( dwStyleEx, wndClass, _T(""), dwStyle, rect.left, rect.top,
00107         rect.Width(), rect.Height(), pParentWnd->GetSafeHwnd(), 0, NULL ))
00108     {
00109         TRACE0( "Failed to create caption popdown window.\n" );
00110         return FALSE;
00111     }
00112
00113     // set the child windows parent to this popup window, save
00114     // the previous parent, since we need to reset this when the
00115     // window is destroyed.
00116     m_pChildParent = m_pChildWnd->SetParent(this);
00117     ASSERT(m_pChildParent != NULL);
00118
00119     // define the caption and client rect.
00120     CRect rcClient;
00121     GetClientRect(&rcClient);
00122     rcClient.DeflateRect(2,2);
00123     CRect rcCapt( rcClient );
00124
00125     // move the window to fit the client area of this window.
00126     rcClient.top += 19;
00127     m_pChildWnd->MoveWindow(rcClient);
00128
00129     // define the size for the push pin caption.
00130     rcCapt.bottom = rcCapt.top + 19;
00131
00132     // Create the caption.
00133     if( !m_Caption.Create( this, _T( "Click push pin to keep open" ), WS_EX_FLATEDGE,
00134         WS_VISIBLE|SS_CENTER|SS_CENTERIMAGE, rcCapt ))
00135     {
00136         TRACE0( "Unable to create caption.\n" );
00137         return FALSE;
00138     }
00139
00140     // define the size for the caption button.
00141     CRect rcButton( rcCapt );
00142     rcButton.DeflateRect(2,2);
00143     rcButton.left = rcButton.right - 16;
00144
00145     // Create the caption button.
00146     if( !m_CaptionButton.Create( NULL, WS_VISIBLE|BS_ICON|BS_OWNERDRAW|BS_CENTER|BS_VCENTER,
00147         rcButton, this, IDC_CAPT_BUTTON ))
00148     {
00149         TRACE0( "Unable to create caption button.\n" );
00150         return FALSE;
00151     }
00152
00153     CImageList imageList;
00154     imageList.Create(IDB_PUSHPIN, 16, 1, RGB(255,0,255));
00155
00156     // Associate the button icon
00157     m_hIconOff = imageList.ExtractIcon(0);
00158     m_hIconOn  = imageList.ExtractIcon(1);
00159     m_CaptionButton.SetIcon(m_hIconOff, m_hIconOn, CSize(16,15));
00160     imageList.DeleteImageList();
00161
00162     // start the timer after everything has been initialized.
00163     SetTimer(1, 10, NULL);
00164
00165     return TRUE;
00166 }

void CCJCaptionPopupWnd::OnCaptButton ( ) [protected]

Definition at line 175 of file CJCaptionPopupWnd.cpp.

00176 {
00177     // send message to parent control that push pin button was pressed.
00178     m_pParentWnd->SendMessage(CM_ONPUSHPINBUTTON, 0, 0);
00179 }

void CCJCaptionPopupWnd::OnDestroy ( void ) [protected]

Definition at line 168 of file CJCaptionPopupWnd.cpp.

00169 {
00170     // set the child window's parent back it's original parent.
00171     m_pChildWnd->SetParent(m_pChildParent);
00172     CWnd::OnDestroy();
00173 }

void CCJCaptionPopupWnd::OnPaint ( ) [protected]

Definition at line 181 of file CJCaptionPopupWnd.cpp.

00182 {
00183     CPaintDC dc(this); // device context for painting
00184
00185     CRect rc;
00186     GetClientRect(&rc);
00187     rc.DeflateRect(1,1);
00188
00189     // draw a border for the client area.
00190     dc.Draw3dRect( rc, ::GetSysColor(COLOR_BTNSHADOW),
00191         ::GetSysColor(COLOR_BTNHILIGHT));
00192 }

void CCJCaptionPopupWnd::OnTimer ( UINT nIDEvent ) [protected]

Definition at line 194 of file CJCaptionPopupWnd.cpp.

00195 {
00196     UNUSED_ALWAYS( nIDEvent );
00197
00198     // get a handle to the window which currently
00199     // has the input focus...
00200     HWND hWnd_HasFocus      = GetFocus()->GetSafeHwnd();
00201
00202     // get a handle to the caption, caption button, child window
00203     // and popup window...
00204     HWND hWnd_Caption       = m_Caption.GetSafeHwnd();
00205     HWND hWnd_CaptionButton = m_CaptionButton.GetSafeHwnd();
00206     HWND hWnd_Popup         = GetSafeHwnd();
00207     HWND hWnd_PopupChild    = m_pChildWnd->GetSafeHwnd();
00208
00209     // check to see if the window that has input focus is part
00210     // of the caption popup window, if not, send a message
00211     // to the parent control.
00212     if(( hWnd_HasFocus != hWnd_Caption ) &&
00213        ( hWnd_HasFocus != hWnd_CaptionButton ) &&
00214        ( hWnd_HasFocus != hWnd_Popup ) &&
00215        ( hWnd_HasFocus != hWnd_PopupChild ))
00216     {
00217         // send message to parent control that our popup window
00218         // has lost input focus.
00219         m_pParentWnd->SendMessage(CM_ONPUSHPINCANCEL, 0, 0);
00220     }
00221 }

Member Data Documentation

CCJCaption CCJCaptionPopupWnd::m_Caption [protected]

Definition at line 75 of file CJCaptionPopupWnd.h.

CCJFlatButton CCJCaptionPopupWnd::m_CaptionButton [protected]

Definition at line 76 of file CJCaptionPopupWnd.h.

HICON CCJCaptionPopupWnd::m_hIconOff [protected]

Definition at line 78 of file CJCaptionPopupWnd.h.

HICON CCJCaptionPopupWnd::m_hIconOn [protected]

Definition at line 77 of file CJCaptionPopupWnd.h.

CWnd* CCJCaptionPopupWnd::m_pChildParent

Definition at line 73 of file CJCaptionPopupWnd.h.

CWnd* CCJCaptionPopupWnd::m_pChildWnd

Definition at line 72 of file CJCaptionPopupWnd.h.

CWnd* CCJCaptionPopupWnd::m_pParentWnd

Definition at line 71 of file CJCaptionPopupWnd.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJCaptionPopupWnd.h
  • WinCvs/CJLib/CJLibrary/CJCaptionPopupWnd.cpp
Generated on Sun Oct 21 12:46:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJCBarButton Class Reference

#include <CJControlBar.h>

Inheritance diagram for CCJCBarButton:

[legend]
Collaboration diagram for CCJCBarButton:

[legend]
List of all members.

Protected Methods

virtual void DrawButtonIcon (CDC *pDC, UINT nState, CRect &rcItem)

Member Function Documentation

void CCJCBarButton::DrawButtonIcon | ( | CDC * | pDC,
 |  | UINT | nState,
 |  | CRect & | rcItem
 | ) | [protected, virtual]

Reimplemented from CCJFlatButton.

Definition at line 215 of file CJControlBar.cpp.

00216 {
00217     UNUSED_ALWAYS( rcItem );
00218
00219     // get the handle to the icon (if any) associated
00220     // with this button.
00221     HICON hIcon = GetIcon();
00222     if( hIcon == NULL ) {
00223         return;
00224     }
00225
00226     CRect rcWnd;
00227     GetWindowRect(&rcWnd);
00228
00229     int left   = (rcWnd.Width()-m_sizeIcon.cx)/2;
00230     int right  = left+m_sizeIcon.cx;
00231     int top    = (rcWnd.Height()-m_sizeIcon.cy)/2;
00232     int bottom = top+m_sizeIcon.cy;
00233
00234     // determine the size of the icon to be drawn.
00235     CRect rc(left,top,right,bottom);
00236
00237     // if the button is selected.
00238     if( nState & ODS_SELECTED )
00239     {
00240         if( m_hPushed ) {
00241             hIcon = m_hPushed;
00242         }
00243         else {
00244             rc.OffsetRect(1,1);
00245         }
00246     }
00247
00248     // draw the icon associated with this button.
00249     pDC->DrawState( rc.TopLeft(), rc.Size(), hIcon, DSS_NORMAL, (HBRUSH)NULL );
00250 }

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJControlBar.h
  • WinCvs/CJLib/CJLibrary/CJControlBar.cpp
Generated on Sun Oct 21 12:46:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJColorPicker Class Reference

#include <CJColorPicker.h>

Inheritance diagram for CCJColorPicker:

[legend]
Collaboration diagram for CCJColorPicker:

[legend]
List of all members.

Public Methods

CCJColorPicker ()
virtual COLORREF | GetColor ()
virtual void | SetColor (COLORREF crColor)
virtual void | SetDefaultText (LPCTSTR szDefaultText)
virtual void | SetCustomText (LPCTSTR szCustomText)
virtual void | SetTrackSelection (BOOL bTracking=TRUE)
virtual BOOL | GetTrackSelection ()
virtual void | SetSelectionMode (UINT nMode)
virtual UINT | GetSelectionMode ()
virtual void | SetBkColor (COLORREF crColorBk)
virtual COLORREF | GetBkColor ()
virtual void | SetTextColor (COLORREF crColorText)
virtual COLORREF | GetTextColor ()
virtual void | CheckTextColor (COLORREF crColor)
virtual void | DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
virtual | ~CCJColorPicker ()

Protected Methods

virtual void | PreSubclassWindow ()
void | SetWindowSize ()
afx_msg BOOL | OnClicked ()
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnPaint ()
afx_msg LONG | OnSelEndOK (UINT lParam, LONG wParam)
afx_msg LONG | OnSelEndCancel (UINT lParam, LONG wParam)
afx_msg LONG | OnSelChange (UINT lParam, LONG wParam)

Protected Attributes

BOOL | m_bActive
BOOL | m_bTrackSelection
COLORREF | m_crColorBk
COLORREF | m_crColorText
UINT | m_nSelectionMode
CRect | m_ArrowRect
CString | m_strDefaultText
CString | m_strCustomText
bool | m_bLBtnDown
CWnd * m_pParentWnd

Constructor & Destructor Documentation

CCJColorPicker::CCJColorPicker ( )

Definition at line 99 of file CJColorPicker.cpp.

00100 {
00101     SetBkColor(GetSysColor(COLOR_3DFACE));
00102     SetTextColor(GetSysColor(COLOR_BTNTEXT));
00103
00104     m_bTrackSelection = FALSE;
00105     m_nSelectionMode = CP_MODE_BK;
00106     m_bActive = FALSE;
00107
00108 // 1999-06-11 begin mods KStowell
00109     m_strDefaultText.LoadString( IDS_COLOR_AUTO );
00110     m_strCustomText.LoadString( IDS_COLOR_CUST );
00111 // 1999-06-11 end mods KStowell
00112
00113 // 10-14-1999 - Kirk Stowell
00114     m_pParentWnd = NULL;
00115 }

CCJColorPicker::~CCJColorPicker ( ) [virtual]

Definition at line 117 of file CJColorPicker.cpp.

00118 {
00119 }

Member Function Documentation

void CCJColorPicker::CheckTextColor ( COLORREF crColor ) [virtual]

Definition at line 420 of file CJColorPicker.cpp.

Referenced by OnSelChange(), OnSelEndCancel(), and SetBkColor().

00421 {
00422     int R = GetRValue(crColor);
00423     int G = GetGValue(crColor);
00424     int B = GetBValue(crColor);
00425
00426     double Intensity = .299 * R + .587 * G + .114 * B ;
00427
00428     if ( Intensity >= 127 ) {
00429         SetTextColor(RGB(0,0,0));
00430     } else {
00431         SetTextColor(RGB(255,255,255));
00432     }
00433 }

void CCJColorPicker::DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct ) [virtual]

Definition at line 230 of file CJColorPicker.cpp.

00231 {
00232     ASSERT(lpDrawItemStruct != NULL);
00233
00234     // define some temporary variables.
00235     CDC*    pDC         = CDC::FromHandle( lpDrawItemStruct->hDC );
00236     CRect   rcItem      = lpDrawItemStruct->rcItem;
00237     int     nState      = lpDrawItemStruct->itemState;
00238     DWORD   dwState     = EDGE_RAISED;
00239     DWORD   dwArrow     = DFCS_SCROLLDOWN;
00240
00241     // Paint the background.
00242     pDC->FillSolidRect(rcItem, ::GetSysColor(COLOR_3DFACE));
00243
00244     // set display flags based on state.
00245     if((nState & ODS_SELECTED) || (m_bActive == TRUE)) {
00246         dwState = EDGE_SUNKEN;
00247         dwArrow = DFCS_SCROLLDOWN|DFCS_PUSHED;
00248     }
00249     if(nState & ODS_DISABLED) {
00250         dwArrow = DFCS_SCROLLDOWN|DFCS_INACTIVE;
00251     }
00252
00253     // Draw the drop arrow.
00254     CRect rcArrow( rcItem );
00255     rcArrow.left = rcArrow.Width()-::GetSystemMetrics( SM_CXHTHUMB );
00256     pDC->DrawFrameControl( &rcArrow, DFC_SCROLL, dwArrow );
00257     pDC->Draw3dRect( rcArrow, ::GetSysColor( COLOR_3DFACE ), ::GetSysColor( COLOR_3DFACE ));
00258     rcArrow.DeflateRect( 1,1 );
00259     pDC->Draw3dRect( rcArrow, ::GetSysColor( COLOR_3DFACE ), ::GetSysColor( COLOR_3DFACE ));
00260
00261     if((nState & ODS_SELECTED) || (m_bActive == TRUE))
00262         rcArrow.OffsetRect( 1,1 );
00263
00264     // draw the seperator line.
00265     CPen penShadow( PS_SOLID, 1, ::GetSysColor( COLOR_3DSHADOW  ));
00266     CPen* pOldPen = pDC->SelectObject( &penShadow );
00267     pDC->MoveTo( rcArrow.left-1, rcArrow.top+2 );
00268     pDC->LineTo( rcArrow.left-1, rcArrow.bottom-2 );
00269
00270     CPen penHilite( PS_SOLID, 1, ::GetSysColor( COLOR_3DHILIGHT ));
00271     pDC->SelectObject( &penHilite );
00272     pDC->MoveTo( rcArrow.left, rcArrow.top+2 );
00273     pDC->LineTo( rcArrow.left, rcArrow.bottom-2 );
00274
00275     // draw the control border.
00276     pDC->DrawEdge( rcItem, dwState, BF_RECT );
00277
00278     // draw the focus rect.
00279     rcItem.DeflateRect( 2, 2 );
00280     pDC->Draw3dRect( rcItem, ::GetSysColor( COLOR_3DFACE ), ::GetSysColor( COLOR_3DFACE ) );
00281     if( nState & ODS_FOCUS ) {
00282         pDC->DrawFocusRect( rcItem );
00283     }
00284
00285     // draw the color box.
00286     if((nState & ODS_SELECTED) || (m_bActive == TRUE))
00287         rcItem.OffsetRect( 1,1 );
00288
00289     rcItem.DeflateRect( 2, 2 );
00290     rcItem.right = rcArrow.left-4;
00291
00292     CBrush brush( ((nState & ODS_DISABLED) || m_crColorBk == CLR_DEFAULT)?
00293         ::GetSysColor(COLOR_3DFACE) : m_crColorBk);
00294     CBrush* pOldBrush = (CBrush*)pDC->SelectObject( &brush );
00295     pDC->SelectStockObject(( nState & ODS_DISABLED )?WHITE_PEN:BLACK_PEN );
00296     pDC->Rectangle( rcItem );
00297
00298     // Draw the window text (if any)
00299     CString strText;
00300     GetWindowText(strText);
00301     if (strText.GetLength())
00302     {
00303         pDC->SetBkMode(TRANSPARENT);
00304         if (nState & ODS_DISABLED)
00305         {
00306             rcItem.OffsetRect(1,1);
00307             pDC->SetTextColor(::GetSysColor(COLOR_3DHILIGHT));
00308             pDC->DrawText(strText, rcItem, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
00309             rcItem.OffsetRect(-1,-1);
00310             pDC->SetTextColor(::GetSysColor(COLOR_3DSHADOW));
00311             pDC->DrawText(strText, rcItem, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
00312         }
00313         else
00314         {
00315             pDC->SetTextColor((m_crColorText == CLR_DEFAULT)? 0 : m_crColorText);
00316             pDC->DrawText(strText, rcItem, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
00317         }
00318     }
00319
00320     // fix potential resource leak - KStowell - 10-21-99
00321     pDC->SelectObject( pOldPen );
00322     pDC->SelectObject( pOldBrush );
00323     brush.DeleteObject();
00324     penHilite.DeleteObject();
00325     penHilite.DeleteObject();
00326 }

virtual COLORREF CCJColorPicker::GetBkColor ( ) [inline, virtual]

Definition at line 97 of file CJColorPicker.h.

Referenced by GetColor().

00097 { return m_crColorBk; }

COLORREF CCJColorPicker::GetColor ( ) [virtual]

Definition at line 342 of file CJColorPicker.cpp.

Referenced by DDX_CJColorPicker(), and OnClicked().

00343 {
00344     return (m_nSelectionMode == CP_MODE_TEXT)?
00345         GetTextColor(): GetBkColor();
00346 }

virtual UINT CCJColorPicker::GetSelectionMode ( ) [inline, virtual]

Definition at line 94 of file CJColorPicker.h.

00094 { return m_nSelectionMode; };

virtual COLORREF CCJColorPicker::GetTextColor ( ) [inline, virtual]

Definition at line 100 of file CJColorPicker.h.

Referenced by GetColor().

00100 { return m_crColorText;}

virtual BOOL CCJColorPicker::GetTrackSelection ( ) [inline, virtual]

Definition at line 91 of file CJColorPicker.h.

00091 { return m_bTrackSelection; }

BOOL CCJColorPicker::OnClicked ( ) [protected]

Definition at line 206 of file CJColorPicker.cpp.

00207 {
00208     m_bActive = TRUE;
00209
00210     CRect rect;
00211     GetWindowRect(rect);
00212     new CCJColorPopup(CPoint(rect.left, rect.bottom),    // Point to display popup
00213                      GetColor(),                       // Selected Color
00214                      this,                              // parent
00215                      m_strDefaultText,                  // "Default" text area
00216                      m_strCustomText);                  // Custom Text
00217
00218     // 10-14-1999 - Kirk Stowell - Removed redundant calls to GetParent().
00219     if (m_pParentWnd) {
00220         m_pParentWnd->SendMessage(CPN_DROPDOWN, (LPARAM)GetColor(), (WPARAM) GetDlgCtrlID());
00221     }
00222
00223     // Docs say I should return FALSE to stop the parent also getting the message.
00224     // HA! What a joke.
00225
00226     return TRUE;
00227 }

int CCJColorPicker::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 196 of file CJColorPicker.cpp.

00197 {
00198     if (CButton::OnCreate(lpCreateStruct) == -1)
00199         return -1;
00200
00201     SetWindowSize();    // resize appropriately
00202     return 0;
00203 }

BOOL CCJColorPicker::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 435 of file CJColorPicker.cpp.

00436 {
00437     // overridden for flicker-free drawing.
00438     UNUSED_ALWAYS(pDC);
00439     return TRUE;
00440 }

void CCJColorPicker::OnPaint ( ) [protected]

Definition at line 442 of file CJColorPicker.cpp.

00443 {
00444     CPaintDC dc(this); // device context for painting
00445
00446     // KStowell - Get the client rect.
00447     CRect rcClient, rcClip;
00448     dc.GetClipBox( &rcClip );
00449     GetClientRect( &rcClient );
00450
00451     // KStowell - Create a memory device-context. This is done to help reduce
00452     // screen flicker, since we will paint the entire control to the
00453     // off screen device context first.
00454     CDC memDC;
00455     CBitmap bitmap;
00456     memDC.CreateCompatibleDC(&dc);
00457     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00458     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00459
00460     // KStowell - Repaint the background.
00461     memDC.FillSolidRect( rcClient, ::GetSysColor(COLOR_WINDOW) );
00462
00463     // let the control do its default drawing.
00464     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00465
00466     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00467     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00468         rcClip.left, rcClip.top, SRCCOPY );
00469
00470     // KStowell - Cleanup resources.
00471     memDC.SelectObject(pOldBitmap);
00472     memDC.DeleteDC();
00473     bitmap.DeleteObject();
00474 }

LONG CCJColorPicker::OnSelChange | ( | UINT | lParam,
 |  | LONG | wParam
 | ) | [protected]

Definition at line 179 of file CJColorPicker.cpp.

00180 {
00181     if (m_bTrackSelection) {
00182         SetColor((COLORREF) lParam);
00183         //BEGIN SRO
00184         CheckTextColor((COLORREF) lParam);
00185         //END SRO
00186     }
00187
00188     // 10-14-1999 - Kirk Stowell - Removed redundant calls to GetParent().
00189     if (m_pParentWnd) {
00190         m_pParentWnd->SendMessage(CPN_SELCHANGE, lParam, (WPARAM) GetDlgCtrlID());
00191     }
00192
00193     return TRUE;
00194 }

LONG CCJColorPicker::OnSelEndCancel | ( | UINT | lParam,
 |  | LONG | wParam
 | ) | [protected]

Definition at line 162 of file CJColorPicker.cpp.

00163 {
00164     m_bActive = FALSE;
00165     SetColor((COLORREF) lParam);
00166     //BEGIN SRO
00167     CheckTextColor((COLORREF) lParam);
00168     //END SRO
00169
00170     // 10-14-1999 - Kirk Stowell - Removed redundant calls to GetParent().
00171     if (m_pParentWnd) {
00172         m_pParentWnd->SendMessage(CPN_CLOSEUP, lParam, (WPARAM) GetDlgCtrlID());
00173         m_pParentWnd->SendMessage(CPN_SELENDCANCEL, lParam, (WPARAM) GetDlgCtrlID());
00174     }
00175
00176     return TRUE;
00177 }

LONG CCJColorPicker::OnSelEndOK | ( | UINT | lParam,
 |  | LONG | wParam
 | ) | [protected]

Definition at line 138 of file CJColorPicker.cpp.

00139 {
00140     COLORREF crNewColor = (COLORREF) lParam;
00141     m_bActive = FALSE;
00142     SetColor(crNewColor);
00143     //BEGIN SRO
00144     CheckTextColor(crNewColor);
00145     //END SRO
00146
00147     // 10-14-1999 - Kirk Stowell - Removed redundant calls to GetParent().
00148     if (m_pParentWnd) {
00149         m_pParentWnd->SendMessage(CPN_CLOSEUP, lParam, (WPARAM) GetDlgCtrlID());
00150         m_pParentWnd->SendMessage(CPN_SELENDOK, lParam, (WPARAM) GetDlgCtrlID());
00151     }
00152
00153     if (crNewColor != GetColor()) {
00154         if (m_pParentWnd) {
00155             m_pParentWnd->SendMessage(CPN_SELCHANGE, lParam, (WPARAM) GetDlgCtrlID());
00156         }
00157     }
00158
00159     return TRUE;
00160 }

void CCJColorPicker::PreSubclassWindow ( ) [protected, virtual]

Definition at line 332 of file CJColorPicker.cpp.

00333 {
00334     ModifyStyle(0, BS_OWNERDRAW);        // Make it owner drawn
00335     CButton::PreSubclassWindow();
00336     SetWindowSize();                     // resize appropriately
00337 }

void CCJColorPicker::SetBkColor ( COLORREF crColorBk ) [virtual]

Definition at line 354 of file CJColorPicker.cpp.

Referenced by CCJColorPicker(), and SetColor().

00355 {
00356     m_crColorBk = crColorBk;
00357
00358     //BEGIN SRO
00359     CheckTextColor(crColorBk);
00360     //END SRO
00361
00362     if (IsWindow(m_hWnd)) RedrawWindow();
00363 }

void CCJColorPicker::SetColor ( COLORREF crColor ) [virtual]

Definition at line 348 of file CJColorPicker.cpp.

Referenced by DDX_CJColorPicker(), OnSelChange(), and OnSelEndCancel().

00349 {
00350     (m_nSelectionMode == CP_MODE_TEXT)?
00351         SetTextColor(crColor): SetBkColor(crColor);
00352 }

void CCJColorPicker::SetCustomText ( LPCTSTR szCustomText ) [virtual]

Definition at line 376 of file CJColorPicker.cpp.

00377 {
00378     m_strCustomText = (szCustomText)? szCustomText : _T("");
00379 }

void CCJColorPicker::SetDefaultText ( LPCTSTR szDefaultText ) [virtual]

Definition at line 371 of file CJColorPicker.cpp.

00372 {
00373     m_strDefaultText = (szDefaultText)? szDefaultText : _T("");
00374 }

virtual void CCJColorPicker::SetSelectionMode ( UINT nMode ) [inline, virtual]

Definition at line 93 of file CJColorPicker.h.

00093 { m_nSelectionMode = nMode; }

void CCJColorPicker::SetTextColor ( COLORREF crColorText ) [virtual]

Definition at line 365 of file CJColorPicker.cpp.

Referenced by CCJColorPicker(), CheckTextColor(), and SetColor().

00366 {
00367     m_crColorText = crColorText;
00368     if (IsWindow(m_hWnd)) RedrawWindow();
00369 }

virtual void CCJColorPicker::SetTrackSelection ( BOOL bTracking = TRUE ) [inline, virtual]

Definition at line 90 of file CJColorPicker.h.

00090 { m_bTrackSelection = bTracking; }

void CCJColorPicker::SetWindowSize ( ) [protected]

Definition at line 384 of file CJColorPicker.cpp.

Referenced by OnCreate(), and PreSubclassWindow().

00385 {
00386     // 10-14-1999 - Kirk Stowell - Added to help reduce flicker, we only need to make
00387     // a call to GetParent() once at initialization.
00388     m_pParentWnd = GetParent();
00389
00390     // Get size dimensions of edges
00391     CSize MarginSize(::GetSystemMetrics(SM_CXEDGE), ::GetSystemMetrics(SM_CYEDGE));
00392
00393     // Get size of dropdown arrow
00394     int nArrowWidth = max(::GetSystemMetrics(SM_CXHTHUMB), 5*MarginSize.cx);
00395     int nArrowHeight = max(::GetSystemMetrics(SM_CYVTHUMB), 5*MarginSize.cy);
00396     CSize ArrowSize(max(nArrowWidth, nArrowHeight), max(nArrowWidth, nArrowHeight));
00397
00398     // Get window size
00399     CRect rect;
00400     GetWindowRect(rect);
00401
00402     if (m_pParentWnd) {
00403         m_pParentWnd->ScreenToClient(rect);
00404     }
00405
00406     // Set window size at least as wide as 2 arrows, and as high as arrow + margins
00407     int nWidth = max(rect.Width(), 2*ArrowSize.cx + 2*MarginSize.cx);
00408     MoveWindow(rect.left, rect.top, nWidth, ArrowSize.cy+2*MarginSize.cy, TRUE);
00409
00410     // Get the new coords of this window
00411     GetWindowRect(rect);
00412     ScreenToClient(rect);
00413
00414     // Get the rect where the arrow goes, and convert to client coords.
00415     m_ArrowRect.SetRect(rect.right - ArrowSize.cx - MarginSize.cx,
00416                         rect.top + MarginSize.cy, rect.right - MarginSize.cx,
00417                         rect.bottom - MarginSize.cy);
00418 }

Member Data Documentation

CRect CCJColorPicker::m_ArrowRect [protected]

Definition at line 130 of file CJColorPicker.h.

BOOL CCJColorPicker::m_bActive [protected]

Definition at line 125 of file CJColorPicker.h.

bool CCJColorPicker::m_bLBtnDown [protected]

Definition at line 133 of file CJColorPicker.h.

BOOL CCJColorPicker::m_bTrackSelection [protected]

Definition at line 125 of file CJColorPicker.h.

COLORREF CCJColorPicker::m_crColorBk [protected]

Definition at line 127 of file CJColorPicker.h.

COLORREF CCJColorPicker::m_crColorText [protected]

Definition at line 128 of file CJColorPicker.h.

UINT CCJColorPicker::m_nSelectionMode [protected]

Definition at line 129 of file CJColorPicker.h.

CWnd* CCJColorPicker::m_pParentWnd [protected]

Definition at line 134 of file CJColorPicker.h.

CString CCJColorPicker::m_strCustomText [protected]

Definition at line 132 of file CJColorPicker.h.

CString CCJColorPicker::m_strDefaultText [protected]

Definition at line 131 of file CJColorPicker.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJColorPicker.h
  • WinCvs/CJLib/CJLibrary/CJColorPicker.cpp
Generated on Sun Oct 21 12:46:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJColorPopup Class Reference

#include <CJColorPopup.h>

Inheritance diagram for CCJColorPopup:

[legend]
Collaboration diagram for CCJColorPopup:

[legend]
List of all members.

Public Methods

CCJColorPopup ()
CCJColorPopup (CPoint p, COLORREF crColor, CWnd *pParentWnd, LPCTSTR szDefaultText=NULL, LPCTSTR szCustomText=NULL)
virtual void | Initialise ()
virtual BOOL | Create (CPoint p, COLORREF crColor, CWnd *pParentWnd, LPCTSTR szDefaultText=NULL, LPCTSTR szCustomText=NULL)
virtual BOOL | PreTranslateMessage (MSG *pMsg)
virtual void | UpdateFont ()
virtual | ~CCJColorPopup ()

Protected Methods

virtual BOOL | GetCellRect (int nIndex, const LPRECT &rect)
virtual void | FindCellFromColor (COLORREF crColor)
virtual void | SetWindowSize ()
virtual void | CreateToolTips ()
virtual void | ChangeSelection (int nIndex)
virtual void | EndSelection (int nMessage)
virtual void | DrawCell (CDC *pDC, int nIndex)
virtual COLORREF | GetColor (int nIndex)
virtual LPCTSTR | GetColorName (int nIndex)
virtual int | GetIndex (int row, int col) const
virtual int | GetRow (int nIndex) const
virtual int | GetColumn (int nIndex) const
afx_msg void | OnNcDestroy ()
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point)
afx_msg void | OnPaint ()
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg void | OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg BOOL | OnQueryNewPalette ()
afx_msg void | OnPaletteChanged (CWnd *pFocusWnd)
afx_msg void | OnKillFocus (CWnd *pNewWnd)
afx_msg void | OnActivateApp (BOOL bActive, HTASK hTask)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)

Protected Attributes

int | m_nNumColors
int | m_nNumColumns
int | m_nNumRows
int | m_nBoxSize
int | m_nMargin
int | m_nCurrentSel
int | m_nChosenColorSel
CString | m_strDefaultText
CString | m_strCustomText
CRect | m_CustomTextRect
CRect | m_DefaultTextRect
CRect | m_WindowRect
CFont | m_Font
CPalette | m_Palette
COLORREF | m_crInitialColor
COLORREF | m_crColor
CToolTipCtrl | m_ToolTip
CWnd * m_pParent

Static Protected Attributes

ColorTableEntry m_crColors []

Constructor & Destructor Documentation

CCJColorPopup::CCJColorPopup ( )

Definition at line 133 of file CJColorPopup.cpp.

00134 {
00135     Initialise();
00136 }

CCJColorPopup::CCJColorPopup | ( | CPoint | p,
 |  | COLORREF | crColor,
 |  | CWnd * | pParentWnd,
 |  | LPCTSTR | szDefaultText = NULL,
 |  | LPCTSTR | szCustomText = NULL
 | ) |

Definition at line 138 of file CJColorPopup.cpp.

00141 {
00142     Initialise();
00143
00144     m_crColor       = m_crInitialColor = crColor;
00145     m_pParent        = pParentWnd;
00146
00147 // 1999-06-11 begin mods KStowell
00148     if( szDefaultText == NULL )
00149         m_strDefaultText.LoadString( IDS_COLOR_AUTO );
00150     else
00151         m_strDefaultText = szDefaultText;
00152
00153     if( szCustomText == NULL )
00154         m_strCustomText.LoadString( IDS_COLOR_CUST );
00155     else
00156         m_strCustomText = szCustomText;
00157 // 1999-06-11 end mods KStowell
00158
00159     CCJColorPopup::Create(p, crColor, pParentWnd, szDefaultText, szCustomText);
00160 }

CCJColorPopup::~CCJColorPopup ( ) [virtual]

Definition at line 202 of file CJColorPopup.cpp.

00203 {
00204     m_Font.DeleteObject();
00205     m_Palette.DeleteObject();
00206 }

Member Function Documentation

void CCJColorPopup::ChangeSelection ( int nIndex ) [protected, virtual]

Definition at line 743 of file CJColorPopup.cpp.

Referenced by OnKeyDown(), and OnMouseMove().

00744 {
00745     CClientDC dc(this);        // device context for drawing
00746
00747     if (nIndex > m_nNumColors)
00748         nIndex = CUSTOM_BOX_VALUE;
00749
00750     if ((m_nCurrentSel >= 0 && m_nCurrentSel < m_nNumColors) ||
00751         m_nCurrentSel == CUSTOM_BOX_VALUE || m_nCurrentSel == DEFAULT_BOX_VALUE)
00752     {
00753         // Set Current selection as invalid and redraw old selection (this way
00754         // the old selection will be drawn unselected)
00755         int OldSel = m_nCurrentSel;
00756         m_nCurrentSel = INVALID_Color;
00757         DrawCell(&dc, OldSel);
00758     }
00759
00760     // Set the current selection as row/col and draw (it will be drawn selected)
00761     m_nCurrentSel = nIndex;
00762     DrawCell(&dc, m_nCurrentSel);
00763
00764     // Store the current Color
00765     if (m_nCurrentSel == CUSTOM_BOX_VALUE)
00766         m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crInitialColor, 0);
00767     else if (m_nCurrentSel == DEFAULT_BOX_VALUE)
00768     {
00769         m_crColor = CLR_DEFAULT;
00770         m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) CLR_DEFAULT, 0);
00771     }
00772     else
00773     {
00774         m_crColor = GetColor(m_nCurrentSel);
00775         m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crColor, 0);
00776     }
00777 }

BOOL CCJColorPopup::Create | ( | CPoint | p,
 |  | COLORREF | crColor,
 |  | CWnd * | pParentWnd,
 |  | LPCTSTR | szDefaultText = NULL,
 |  | LPCTSTR | szCustomText = NULL
 | ) | [virtual]

Definition at line 208 of file CJColorPopup.cpp.

Referenced by CCJColorPopup().

00211 {
00212     ASSERT(pParentWnd && ::IsWindow(pParentWnd->GetSafeHwnd()));
00213     ASSERT(pParentWnd->IsKindOf(RUNTIME_CLASS(CCJColorPicker)));
00214
00215     m_pParent  = pParentWnd;
00216     m_crColor = m_crInitialColor = crColor;
00217
00218     // Get the class name and create the window
00219     CString szClassName = AfxRegisterWndClass(CS_CLASSDC|CS_SAVEBITS|CS_HREDRAW|CS_VREDRAW,
00220                                               0,
00221                                               (HBRUSH) (COLOR_BTNFACE+1),
00222                                               0);
00223
00224     if (!CWnd::CreateEx(0, szClassName, _T(""), WS_VISIBLE|WS_POPUP,
00225                         p.x, p.y, 100, 100, // size updated soon
00226                         pParentWnd->GetSafeHwnd(), 0, NULL))
00227         return FALSE;
00228
00229     UpdateFont();
00230
00231     // Store the Custom text
00232     if (szCustomText != NULL)
00233         m_strCustomText = szCustomText;
00234
00235     // Store the Default Area text
00236     if (szDefaultText != NULL)
00237         m_strDefaultText = szDefaultText;
00238
00239     // Set the window size
00240     SetWindowSize();
00241
00242     // Create the tooltips
00243     CreateToolTips();
00244
00245     // Find which cell (if any) corresponds to the initial Color
00246     FindCellFromColor(crColor);
00247
00248     // Capture all mouse events for the life of this window
00249     SetCapture();
00250
00251     return TRUE;
00252 }

void CCJColorPopup::CreateToolTips ( ) [protected, virtual]

Definition at line 729 of file CJColorPopup.cpp.

Referenced by Create().

00730 {
00731     // Create the tool tip
00732     if (!m_ToolTip.Create(this)) return;
00733
00734     // Add a tool for each cell
00735     for (int i = 0; i < m_nNumColors; i++)
00736     {
00737         CRect rect;
00738         if (!GetCellRect(i, rect)) continue;
00739             m_ToolTip.AddTool(this, GetColorName(i), rect, 1);
00740     }
00741 }

void CCJColorPopup::DrawCell | ( | CDC * | pDC,
 |  | int | nIndex
 | ) | [protected, virtual]

Definition at line 802 of file CJColorPopup.cpp.

Referenced by ChangeSelection(), and OnPaint().

00803 {
00804     // For the Custom Text area
00805     if (m_strCustomText.GetLength() && nIndex == CUSTOM_BOX_VALUE)
00806     {
00807         // The extent of the actual text button
00808         CRect TextButtonRect = m_CustomTextRect;
00809         TextButtonRect.top += 2*m_nMargin;
00810
00811         // Fill background
00812         pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));
00813
00814         // Draw horizontal line
00815         pDC->FillSolidRect(m_CustomTextRect.left+2*m_nMargin, m_CustomTextRect.top,
00816                            m_CustomTextRect.Width()-4*m_nMargin, 1, ::GetSysColor(COLOR_3DSHADOW));
00817         pDC->FillSolidRect(m_CustomTextRect.left+2*m_nMargin, m_CustomTextRect.top+1,
00818                            m_CustomTextRect.Width()-4*m_nMargin, 1, ::GetSysColor(COLOR_3DHILIGHT));
00819
00820         TextButtonRect.DeflateRect(1,1);
00821
00822         // fill background
00823         if (m_nChosenColorSel == nIndex && m_nCurrentSel != nIndex)
00824             pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DLIGHT));
00825         else
00826             pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));
00827
00828         // Draw button
00829         if (m_nCurrentSel == nIndex)
00830             pDC->DrawEdge(TextButtonRect, BDR_RAISEDINNER, BF_RECT);
00831         else if (m_nChosenColorSel == nIndex)
00832             pDC->DrawEdge(TextButtonRect, BDR_SUNKENOUTER, BF_RECT);
00833
00834         // Draw custom text
00835         CFont *pOldFont = (CFont*) pDC->SelectObject(&m_Font);
00836         pDC->SetBkMode(TRANSPARENT);
00837         pDC->DrawText(m_strCustomText, TextButtonRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
00838         pDC->SelectObject(pOldFont);
00839
00840         return;
00841     }
00842
00843     // For the Default Text area
00844     if (m_strDefaultText.GetLength() && nIndex == DEFAULT_BOX_VALUE)
00845     {
00846         // Fill background
00847         pDC->FillSolidRect(m_DefaultTextRect, ::GetSysColor(COLOR_3DFACE));
00848
00849         // The extent of the actual text button
00850         CRect TextButtonRect = m_DefaultTextRect;
00851         TextButtonRect.DeflateRect(1,1);
00852
00853         // fill background
00854         if (m_nChosenColorSel == nIndex && m_nCurrentSel != nIndex)
00855             pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DLIGHT));
00856         else
00857             pDC->FillSolidRect(TextButtonRect, ::GetSysColor(COLOR_3DFACE));
00858
00859         // Draw thin line around text
00860         CRect LineRect = TextButtonRect;
00861         LineRect.DeflateRect(2*m_nMargin,2*m_nMargin);
00862         CPen pen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
00863         CPen* pOldPen = pDC->SelectObject(&pen);
00864         pDC->SelectStockObject(NULL_BRUSH);
00865         pDC->Rectangle(LineRect);
00866         pDC->SelectObject(pOldPen);
00867
00868         // Draw button
00869         if (m_nCurrentSel == nIndex)
00870             pDC->DrawEdge(TextButtonRect, BDR_RAISEDINNER, BF_RECT);
00871         else if (m_nChosenColorSel == nIndex)
00872             pDC->DrawEdge(TextButtonRect, BDR_SUNKENOUTER, BF_RECT);
00873
00874         // Draw custom text
00875         CFont *pOldFont = (CFont*) pDC->SelectObject(&m_Font);
00876         pDC->SetBkMode(TRANSPARENT);
00877         pDC->DrawText(m_strDefaultText, TextButtonRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
00878         pDC->SelectObject(pOldFont);
00879
00880         // fix potential resource leak - KStowell - 10-21-99
00881         pen.DeleteObject();
00882         return;
00883     }
00884
00885     CRect rect;
00886     if (!GetCellRect(nIndex, rect)) return;
00887
00888     // Select and realize the palette
00889     CPalette* pOldPalette = NULL;
00890     if (pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)
00891     {
00892         pOldPalette = pDC->SelectPalette(&m_Palette, FALSE);
00893         pDC->RealizePalette();
00894     }
00895
00896     // fill background
00897     if (m_nChosenColorSel == nIndex && m_nCurrentSel != nIndex)
00898         pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DHILIGHT));
00899     else
00900         pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE));
00901
00902     // Draw button
00903     if (m_nCurrentSel == nIndex)
00904         pDC->DrawEdge(rect, BDR_RAISEDINNER, BF_RECT);
00905     else if (m_nChosenColorSel == nIndex)
00906         pDC->DrawEdge(rect, BDR_SUNKENOUTER, BF_RECT);
00907
00908     CBrush brush(PALETTERGB(GetRValue(GetColor(nIndex)),
00909                             GetGValue(GetColor(nIndex)),
00910                             GetBValue(GetColor(nIndex)) ));
00911     CPen   pen;
00912     pen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
00913
00914     CBrush* pOldBrush = (CBrush*) pDC->SelectObject(&brush);
00915     CPen*   pOldPen   = (CPen*)   pDC->SelectObject(&pen);
00916
00917     // Draw the cell Color
00918     rect.DeflateRect(m_nMargin+1, m_nMargin+1);
00919     pDC->Rectangle(rect);
00920
00921     // restore DC and cleanup
00922     pDC->SelectObject(pOldBrush);
00923     pDC->SelectObject(pOldPen);
00924     brush.DeleteObject();
00925     pen.DeleteObject();
00926
00927     if (pOldPalette && pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)
00928         pDC->SelectPalette(pOldPalette, FALSE);
00929 }

void CCJColorPopup::EndSelection ( int nMessage ) [protected, virtual]

Definition at line 779 of file CJColorPopup.cpp.

Referenced by OnActivateApp(), OnKeyDown(), and OnLButtonUp().

00780 {
00781     ReleaseCapture();
00782
00783     // If custom text selected, perform a custom Color selection
00784     if (nMessage != CPN_SELENDCANCEL && m_nCurrentSel == CUSTOM_BOX_VALUE)
00785     {
00786         CColorDialog dlg(m_crInitialColor, CC_FULLOPEN | CC_ANYCOLOR, this);
00787
00788         if (dlg.DoModal() == IDOK)
00789             m_crColor = dlg.GetColor();
00790         else
00791             nMessage = CPN_SELENDCANCEL;
00792     }
00793
00794     if (nMessage == CPN_SELENDCANCEL)
00795         m_crColor = m_crInitialColor;
00796
00797     m_pParent->SendMessage(nMessage, (WPARAM) m_crColor, 0);
00798
00799     DestroyWindow();
00800 }

void CCJColorPopup::FindCellFromColor ( COLORREF crColor ) [protected, virtual]

Definition at line 577 of file CJColorPopup.cpp.

Referenced by Create().

00578 {
00579     if (crColor == CLR_DEFAULT && m_strDefaultText.GetLength())
00580     {
00581         m_nChosenColorSel = DEFAULT_BOX_VALUE;
00582         return;
00583     }
00584
00585     for (int i = 0; i < m_nNumColors; i++)
00586     {
00587         if (GetColor(i) == crColor)
00588         {
00589             m_nChosenColorSel = i;
00590             return;
00591         }
00592     }
00593
00594     if (m_strCustomText.GetLength())
00595         m_nChosenColorSel = CUSTOM_BOX_VALUE;
00596     else
00597         m_nChosenColorSel = INVALID_Color;
00598 }

BOOL CCJColorPopup::GetCellRect | ( | int | nIndex,
 |  | const LPRECT & | rect
 | ) | [protected, virtual]

Definition at line 601 of file CJColorPopup.cpp.

Referenced by CreateToolTips(), and DrawCell().

00602 {
00603     if (nIndex == CUSTOM_BOX_VALUE)
00604     {
00605         ::SetRect(rect,
00606                   m_CustomTextRect.left,  m_CustomTextRect.top,
00607                   m_CustomTextRect.right, m_CustomTextRect.bottom);
00608         return TRUE;
00609     }
00610     else if (nIndex == DEFAULT_BOX_VALUE)
00611     {
00612         ::SetRect(rect,
00613                   m_DefaultTextRect.left,  m_DefaultTextRect.top,
00614                   m_DefaultTextRect.right, m_DefaultTextRect.bottom);
00615         return TRUE;
00616     }
00617
00618     if (nIndex < 0 || nIndex >= m_nNumColors)
00619         return FALSE;
00620
00621     rect->left = GetColumn(nIndex) * m_nBoxSize + m_nMargin;
00622     rect->top  = GetRow(nIndex) * m_nBoxSize + m_nMargin;
00623
00624     // Move everything down if we are displaying a default text area
00625     if (m_strDefaultText.GetLength())
00626         rect->top += (m_nMargin + m_DefaultTextRect.Height());
00627
00628     rect->right = rect->left + m_nBoxSize;
00629     rect->bottom = rect->top + m_nBoxSize;
00630
00631     return TRUE;
00632 }

virtual COLORREF CCJColorPopup::GetColor ( int nIndex ) [inline, protected, virtual]

Definition at line 111 of file CJColorPopup.h.

Referenced by ChangeSelection(), DrawCell(), and FindCellFromColor().

00111 { return m_crColors[nIndex].crColor; }

virtual LPCTSTR CCJColorPopup::GetColorName ( int nIndex ) [inline, protected, virtual]

Definition at line 112 of file CJColorPopup.h.

Referenced by CreateToolTips().

00112 { return m_crColors[nIndex].szName; }

int CCJColorPopup::GetColumn ( int nIndex ) const [protected, virtual]

Definition at line 565 of file CJColorPopup.cpp.

Referenced by GetCellRect(), and OnKeyDown().

00566 {
00567     if (nIndex == CUSTOM_BOX_VALUE && m_strCustomText.GetLength())
00568         return CUSTOM_BOX_VALUE;
00569     else if (nIndex == DEFAULT_BOX_VALUE && m_strDefaultText.GetLength())
00570         return DEFAULT_BOX_VALUE;
00571     else if (nIndex < 0 || nIndex >= m_nNumColors)
00572         return INVALID_Color;
00573     else
00574         return nIndex % m_nNumColumns;
00575 }

int CCJColorPopup::GetIndex | ( | int | row,
 |  | int | col
 | ) | const [protected, virtual]

Definition at line 536 of file CJColorPopup.cpp.

Referenced by OnKeyDown(), and OnMouseMove().

00537 {
00538     if ((row == CUSTOM_BOX_VALUE || col == CUSTOM_BOX_VALUE) && m_strCustomText.GetLength())
00539         return CUSTOM_BOX_VALUE;
00540     else if ((row == DEFAULT_BOX_VALUE || col == DEFAULT_BOX_VALUE) && m_strDefaultText.GetLength())
00541         return DEFAULT_BOX_VALUE;
00542     else if (row < 0 || col < 0 || row >= m_nNumRows || col >= m_nNumColumns)
00543         return INVALID_Color;
00544     else
00545     {
00546         if (row*m_nNumColumns + col >= m_nNumColors)
00547             return INVALID_Color;
00548         else
00549             return row*m_nNumColumns + col;
00550     }
00551 }

int CCJColorPopup::GetRow ( int nIndex ) const [protected, virtual]

Definition at line 553 of file CJColorPopup.cpp.

Referenced by OnKeyDown().

00554 {
00555     if (nIndex == CUSTOM_BOX_VALUE && m_strCustomText.GetLength())
00556         return CUSTOM_BOX_VALUE;
00557     else if (nIndex == DEFAULT_BOX_VALUE && m_strDefaultText.GetLength())
00558         return DEFAULT_BOX_VALUE;
00559     else if (nIndex < 0 || nIndex >= m_nNumColors)
00560         return INVALID_Color;
00561     else
00562         return nIndex / m_nNumColumns;
00563 }

void CCJColorPopup::Initialise ( ) [virtual]

Definition at line 162 of file CJColorPopup.cpp.

Referenced by CCJColorPopup().

00163 {
00164     m_nNumColors       = sizeof(m_crColors)/sizeof(ColorTableEntry);
00165     ASSERT(m_nNumColors <= MAX_ColorS);
00166     if (m_nNumColors > MAX_ColorS)
00167         m_nNumColors = MAX_ColorS;
00168
00169     m_nNumColumns       = 0;
00170     m_nNumRows          = 0;
00171     m_nBoxSize          = 18;
00172     m_nMargin           = ::GetSystemMetrics(SM_CXEDGE);
00173     m_nCurrentSel       = INVALID_Color;
00174     m_nChosenColorSel  = INVALID_Color;
00175     m_pParent           = NULL;
00176     m_crColor          = m_crInitialColor = RGB(0,0,0);
00177
00178     // Idiot check: Make sure the Color square is at least 5 x 5;
00179     if (m_nBoxSize - 2*m_nMargin - 2 < 5) m_nBoxSize = 5 + 2*m_nMargin + 2;
00180
00181     // Create the palette
00182     struct {
00183         LOGPALETTE    LogPalette;
00184         PALETTEENTRY  PalEntry[MAX_ColorS];
00185     } pal;
00186
00187     LOGPALETTE* pLogPalette = (LOGPALETTE*) &pal;
00188     pLogPalette->palVersion    = 0x300;
00189     pLogPalette->palNumEntries = (WORD) m_nNumColors;
00190
00191     for (int i = 0; i < m_nNumColors; i++)
00192     {
00193         pLogPalette->palPalEntry[i].peRed   = GetRValue(m_crColors[i].crColor);
00194         pLogPalette->palPalEntry[i].peGreen = GetGValue(m_crColors[i].crColor);
00195         pLogPalette->palPalEntry[i].peBlue  = GetBValue(m_crColors[i].crColor);
00196         pLogPalette->palPalEntry[i].peFlags = 0;
00197     }
00198
00199     m_Palette.CreatePalette(pLogPalette);
00200 }

void CCJColorPopup::OnActivateApp | ( | BOOL | bActive,
 |  | HTASK | hTask
 | ) | [protected]

Definition at line 954 of file CJColorPopup.cpp.

00955 {
00956     CWnd::OnActivateApp(bActive, hTask);
00957
00958     // If Deactivating App, cancel this selection
00959     if (!bActive)
00960          EndSelection(CPN_SELENDCANCEL);
00961 }

BOOL CCJColorPopup::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 973 of file CJColorPopup.cpp.

00974 {
00975     // KStowell - overridden for flicker-free drawing.
00976     UNUSED_ALWAYS(pDC);
00977     return TRUE;
00978 }

void CCJColorPopup::OnKeyDown | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags
 | ) | [protected]

Definition at line 280 of file CJColorPopup.cpp.

00281 {
00282     int row = GetRow(m_nCurrentSel),
00283         col = GetColumn(m_nCurrentSel);
00284
00285     if (nChar == VK_DOWN)
00286     {
00287         if (row == DEFAULT_BOX_VALUE)
00288             row = col = 0;
00289         else if (row == CUSTOM_BOX_VALUE)
00290         {
00291             if (m_strDefaultText.GetLength())
00292                 row = col = DEFAULT_BOX_VALUE;
00293             else
00294                 row = col = 0;
00295         }
00296         else
00297         {
00298             row++;
00299             if (GetIndex(row,col) < 0)
00300             {
00301                 if (m_strCustomText.GetLength())
00302                     row = col = CUSTOM_BOX_VALUE;
00303                 else if (m_strDefaultText.GetLength())
00304                     row = col = DEFAULT_BOX_VALUE;
00305                 else
00306                     row = col = 0;
00307             }
00308         }
00309         ChangeSelection(GetIndex(row, col));
00310     }
00311
00312     if (nChar == VK_UP)
00313     {
00314         if (row == DEFAULT_BOX_VALUE)
00315         {
00316             if (m_strCustomText.GetLength())
00317                 row = col = CUSTOM_BOX_VALUE;
00318             else
00319            {
00320                 row = GetRow(m_nNumColors-1);
00321                 col = GetColumn(m_nNumColors-1);
00322             }
00323         }
00324         else if (row == CUSTOM_BOX_VALUE)
00325         {
00326             row = GetRow(m_nNumColors-1);
00327             col = GetColumn(m_nNumColors-1);
00328         }
00329         else if (row > 0) row--;
00330         else /* row == 0 */
00331         {
00332             if (m_strDefaultText.GetLength())
00333                 row = col = DEFAULT_BOX_VALUE;
00334             else if (m_strCustomText.GetLength())
00335                 row = col = CUSTOM_BOX_VALUE;
00336             else
00337             {
00338                 row = GetRow(m_nNumColors-1);
00339                 col = GetColumn(m_nNumColors-1);
00340             }
00341         }
00342         ChangeSelection(GetIndex(row, col));
00343     }
00344
00345     if (nChar == VK_RIGHT)
00346     {
00347         if (row == DEFAULT_BOX_VALUE)
00348             row = col = 0;
00349         else if (row == CUSTOM_BOX_VALUE)
00350         {
00351             if (m_strDefaultText.GetLength())
00352                 row = col = DEFAULT_BOX_VALUE;
00353             else
00354                 row = col = 0;
00355         }
00356         else if (col < m_nNumColumns-1)
00357             col++;
00358         else
00359         {
00360             col = 0; row++;
00361         }
00362
00363         if (GetIndex(row,col) == INVALID_Color)
00364         {
00365             if (m_strCustomText.GetLength())
00366                 row = col = CUSTOM_BOX_VALUE;
00367             else if (m_strDefaultText.GetLength())
00368                 row = col = DEFAULT_BOX_VALUE;
00369             else
00370                 row = col = 0;
00371         }
00372
00373         ChangeSelection(GetIndex(row, col));
00374     }
00375
00376     if (nChar == VK_LEFT)
00377     {
00378         if (row == DEFAULT_BOX_VALUE)
00379         {
00380             if (m_strCustomText.GetLength())
00381                 row = col = CUSTOM_BOX_VALUE;
00382             else
00383            {
00384                 row = GetRow(m_nNumColors-1);
00385                 col = GetColumn(m_nNumColors-1);
00386             }
00387         }
00388         else if (row == CUSTOM_BOX_VALUE)
00389         {
00390             row = GetRow(m_nNumColors-1);
00391             col = GetColumn(m_nNumColors-1);
00392         }
00393         else if (col > 0) col--;
00394         else /* col == 0 */
00395         {
00396             if (row > 0) { row--; col = m_nNumColumns-1; }
00397             else
00398             {
00399                 if (m_strDefaultText.GetLength())
00400                     row = col = DEFAULT_BOX_VALUE;
00401                 else if (m_strCustomText.GetLength())
00402                     row = col = CUSTOM_BOX_VALUE;
00403                 else
00404                 {
00405                     row = GetRow(m_nNumColors-1);
00406                     col = GetColumn(m_nNumColors-1);
00407                 }
00408             }
00409         }
00410         ChangeSelection(GetIndex(row, col));
00411     }
00412
00413     if (nChar == VK_ESCAPE)
00414     {
00415         m_crColor = m_crInitialColor;
00416         EndSelection(CPN_SELENDCANCEL);
00417         return;
00418     }
00419
00420     if (nChar == VK_RETURN || nChar == VK_SPACE)
00421     {
00422         EndSelection(CPN_SELENDOK);
00423         return;
00424     }
00425
00426     CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
00427 }

void CCJColorPopup::OnKillFocus ( CWnd * pNewWnd ) [protected]

Definition at line 945 of file CJColorPopup.cpp.

00946 {
00947     CWnd::OnKillFocus(pNewWnd);
00948
00949     ReleaseCapture();
00950     //DestroyWindow(); - causes crash when Custom Color dialog appears.
00951 }

void CCJColorPopup::OnLButtonUp | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 520 of file CJColorPopup.cpp.

00521 {
00522     CWnd::OnLButtonUp(nFlags, point);
00523
00524     DWORD pos = GetMessagePos();
00525     point = CPoint(LOWORD(pos), HIWORD(pos));
00526
00527     if (m_WindowRect.PtInRect(point))
00528         EndSelection(CPN_SELENDOK);
00529     else
00530         EndSelection(CPN_SELENDCANCEL);
00531 }

void CCJColorPopup::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 481 of file CJColorPopup.cpp.

00482 {
00483     int nNewSelection = INVALID_Color;
00484
00485     // Translate points to be relative raised window edge
00486     point.x -= m_nMargin;
00487     point.y -= m_nMargin;
00488
00489     // First check we aren't in text box
00490     if (m_strCustomText.GetLength() && m_CustomTextRect.PtInRect(point))
00491         nNewSelection = CUSTOM_BOX_VALUE;
00492     else if (m_strDefaultText.GetLength() && m_DefaultTextRect.PtInRect(point))
00493         nNewSelection = DEFAULT_BOX_VALUE;
00494     else
00495     {
00496         // Take into account text box
00497         if (m_strDefaultText.GetLength())
00498             point.y -= m_DefaultTextRect.Height();
00499
00500         // Get the row and column
00501         nNewSelection = GetIndex(point.y / m_nBoxSize, point.x / m_nBoxSize);
00502
00503         // In range? If not, default and exit
00504         if (nNewSelection < 0 || nNewSelection >= m_nNumColors)
00505         {
00506             CWnd::OnMouseMove(nFlags, point);
00507             return;
00508         }
00509     }
00510
00511     // OK - we have the row and column of the current selection (may be CUSTOM_BOX_VALUE)
00512     // Has the row/col selection changed? If yes, then redraw old and new cells.
00513     if (nNewSelection != m_nCurrentSel)
00514         ChangeSelection(nNewSelection);
00515
00516     CWnd::OnMouseMove(nFlags, point);
00517 }

void CCJColorPopup::OnNcDestroy ( ) [protected]

Definition at line 430 of file CJColorPopup.cpp.

00431 {
00432     CWnd::OnNcDestroy();
00433     delete this;
00434 }

void CCJColorPopup::OnPaint ( ) [protected]

Definition at line 436 of file CJColorPopup.cpp.

00437 {
00438     CPaintDC dc(this); // device context for painting
00439
00440     // KStowell - Get the client rect for this control.
00441     CRect rcClient;
00442     GetClientRect(&rcClient);
00443
00444     // KStowell - Create a memory device-context. This is done to help reduce
00445     // screen flicker, since we will paint the entire control to the
00446     // off screen device context first.
00447     CDC memDC;
00448     memDC.CreateCompatibleDC(&dc);
00449     CBitmap bitmap;
00450     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00451     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00452     memDC.FillSolidRect(rcClient, ::GetSysColor(COLOR_BTNFACE));
00453
00454     // Draw the Default Area text
00455     if (m_strDefaultText.GetLength())
00456         DrawCell(&memDC, DEFAULT_BOX_VALUE);
00457
00458     // Draw Color cells
00459     for (int i = 0; i < m_nNumColors; i++)
00460         DrawCell(&memDC, i);
00461
00462     // Draw custom text
00463     if (m_strCustomText.GetLength())
00464         DrawCell(&memDC, CUSTOM_BOX_VALUE);
00465
00466     // Draw raised window edge (ex-window style WS_EX_WINDOWEDGE is sposed to do this,
00467     // but for some reason isn't
00468     CRect rect;
00469     GetClientRect(rect);
00470     memDC.DrawEdge(rect, EDGE_RAISED, BF_RECT);
00471
00472     // KStowell - copy the memory device context back into the original DC via BitBlt().
00473     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00474
00475     // KStowell - cleanup.
00476     memDC.SelectObject(pOldBitmap);
00477     memDC.DeleteDC();
00478     bitmap.DeleteObject();
00479 }

void CCJColorPopup::OnPaletteChanged ( CWnd * pFocusWnd ) [protected]

Definition at line 937 of file CJColorPopup.cpp.

00938 {
00939     CWnd::OnPaletteChanged(pFocusWnd);
00940
00941     if (pFocusWnd->GetSafeHwnd() != GetSafeHwnd())
00942         Invalidate();
00943 }

BOOL CCJColorPopup::OnQueryNewPalette ( ) [protected]

Definition at line 931 of file CJColorPopup.cpp.

00932 {
00933     Invalidate();
00934     return CWnd::OnQueryNewPalette();
00935 }

BOOL CCJColorPopup::PreTranslateMessage ( MSG * pMsg ) [virtual]

Definition at line 273 of file CJColorPopup.cpp.

00274 {
00275     m_ToolTip.RelayEvent(pMsg);
00276     return CWnd::PreTranslateMessage(pMsg);
00277 }

void CCJColorPopup::SetWindowSize ( ) [protected, virtual]

Definition at line 635 of file CJColorPopup.cpp.

Referenced by Create().

00636 {
00637     CSize TextSize;
00638
00639     // If we are showing a custom or default text area, get the font and text size.
00640     if (m_strCustomText.GetLength() || m_strDefaultText.GetLength())
00641     {
00642         CClientDC dc(this);
00643         CFont* pOldFont = (CFont*) dc.SelectObject(&m_Font);
00644
00645         // Get the size of the custom text (if there IS custom text)
00646         TextSize = CSize(0,0);
00647         if (m_strCustomText.GetLength())
00648             TextSize = dc.GetTextExtent(m_strCustomText);
00649
00650         // Get the size of the default text (if there IS default text)
00651         if (m_strDefaultText.GetLength())
00652         {
00653             CSize DefaultSize = dc.GetTextExtent(m_strDefaultText);
00654             if (DefaultSize.cx > TextSize.cx) TextSize.cx = DefaultSize.cx;
00655             if (DefaultSize.cy > TextSize.cy) TextSize.cy = DefaultSize.cy;
00656         }
00657
00658         dc.SelectObject(pOldFont);
00659         TextSize += CSize(2*m_nMargin,2*m_nMargin);
00660
00661         // Add even more space to draw the horizontal line
00662         TextSize.cy += 2*m_nMargin + 2;
00663     }
00664
00665     // Get the number of columns and rows
00666     //m_nNumColumns = (int) sqrt((double)m_nNumColors);    // for a square window (yuk)
00667     m_nNumColumns = NUM_COLUMNS;
00668     m_nNumRows = m_nNumColors / m_nNumColumns;
00669     if (m_nNumColors % m_nNumColumns) m_nNumRows++;
00670
00671     // Get the current window position, and set the new size
00672     CRect rect;
00673     GetWindowRect(rect);
00674
00675     m_WindowRect.SetRect(rect.left, rect.top,
00676                          rect.left + m_nNumColumns*m_nBoxSize + 2*m_nMargin,
00677                          rect.top  + m_nNumRows*m_nBoxSize + 2*m_nMargin);
00678
00679     // if custom text, then expand window if necessary, and set text width as
00680     // window width
00681     if (m_strDefaultText.GetLength())
00682     {
00683         if (TextSize.cx > m_WindowRect.Width())
00684             m_WindowRect.right = m_WindowRect.left + TextSize.cx;
00685         TextSize.cx = m_WindowRect.Width()-2*m_nMargin;
00686
00687         // Work out the text area
00688         m_DefaultTextRect.SetRect(m_nMargin, m_nMargin,
00689                                   m_nMargin+TextSize.cx, 2*m_nMargin+TextSize.cy);
00690         m_WindowRect.bottom += m_DefaultTextRect.Height() + 2*m_nMargin;
00691     }
00692
00693     // if custom text, then expand window if necessary, and set text width as
00694     // window width
00695     if (m_strCustomText.GetLength())
00696     {
00697         if (TextSize.cx > m_WindowRect.Width())
00698             m_WindowRect.right = m_WindowRect.left + TextSize.cx;
00699         TextSize.cx = m_WindowRect.Width()-2*m_nMargin;
00700
00701         // Work out the text area
00702         m_CustomTextRect.SetRect(m_nMargin, m_WindowRect.Height(),
00703                                  m_nMargin+TextSize.cx,
00704                                  m_WindowRect.Height()+m_nMargin+TextSize.cy);
00705         m_WindowRect.bottom += m_CustomTextRect.Height() + 2*m_nMargin;
00706    }
00707
00708     // Need to check it'll fit on screen: Too far right?
00709     CSize ScreenSize(::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN));
00710     if (m_WindowRect.right > ScreenSize.cx)
00711         m_WindowRect.OffsetRect(-(m_WindowRect.right - ScreenSize.cx), 0);
00712
00713     // Too far left?
00714     if (m_WindowRect.left < 0)
00715         m_WindowRect.OffsetRect( -m_WindowRect.left, 0);
00716
00717     // Bottom falling out of screen?
00718     if (m_WindowRect.bottom > ScreenSize.cy)
00719     {
00720         CRect ParentRect;
00721         m_pParent->GetWindowRect(ParentRect);
00722         m_WindowRect.OffsetRect(0, -(ParentRect.Height() + m_WindowRect.Height()));
00723     }
00724
00725     // Set the window size and position
00726     MoveWindow(m_WindowRect, TRUE);
00727 }

void CCJColorPopup::UpdateFont ( ) [virtual]

Definition at line 963 of file CJColorPopup.cpp.

Referenced by Create().

00964 {
00965     m_Font.DeleteObject();
00966     NONCLIENTMETRICS ncm;
00967     ncm.cbSize = sizeof(ncm);
00968     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00969     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00970     SetFont(&m_Font);
00971 }

Member Data Documentation

CRect CCJColorPopup::m_CustomTextRect [protected]

Definition at line 127 of file CJColorPopup.h.

CRect CCJColorPopup::m_DefaultTextRect [protected]

Definition at line 127 of file CJColorPopup.h.

CFont CCJColorPopup::m_Font [protected]

Definition at line 128 of file CJColorPopup.h.

CPalette CCJColorPopup::m_Palette [protected]

Definition at line 129 of file CJColorPopup.h.

CToolTipCtrl CCJColorPopup::m_ToolTip [protected]

Definition at line 131 of file CJColorPopup.h.

CRect CCJColorPopup::m_WindowRect [protected]

Definition at line 127 of file CJColorPopup.h.

COLORREF CCJColorPopup::m_crColor [protected]

Definition at line 130 of file CJColorPopup.h.

ColorTableEntry CCJColorPopup::m_crColors [static, protected]

Definition at line 82 of file CJColorPopup.cpp.

COLORREF CCJColorPopup::m_crInitialColor [protected]

Definition at line 130 of file CJColorPopup.h.

int CCJColorPopup::m_nBoxSize [protected]

Definition at line 122 of file CJColorPopup.h.

int CCJColorPopup::m_nChosenColorSel [protected]

Definition at line 124 of file CJColorPopup.h.

int CCJColorPopup::m_nCurrentSel [protected]

Definition at line 123 of file CJColorPopup.h.

int CCJColorPopup::m_nMargin [protected]

Definition at line 122 of file CJColorPopup.h.

int CCJColorPopup::m_nNumColors [protected]

Definition at line 120 of file CJColorPopup.h.

int CCJColorPopup::m_nNumColumns [protected]

Definition at line 121 of file CJColorPopup.h.

int CCJColorPopup::m_nNumRows [protected]

Definition at line 121 of file CJColorPopup.h.

CWnd* CCJColorPopup::m_pParent [protected]

Definition at line 132 of file CJColorPopup.h.

CString CCJColorPopup::m_strCustomText [protected]

Definition at line 126 of file CJColorPopup.h.

CString CCJColorPopup::m_strDefaultText [protected]

Definition at line 125 of file CJColorPopup.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJColorPopup.h
  • WinCvs/CJLib/CJLibrary/CJColorPopup.cpp
Generated on Sun Oct 21 12:46:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJComboBoxEx Class Reference

#include <CJComboBoxEx.h>

Inheritance diagram for CCJComboBoxEx:

[legend]
Collaboration diagram for CCJComboBoxEx:

[legend]
List of all members.

Public Methods

CCJComboBoxEx ()
virtual | ~CCJComboBoxEx ()
BOOL | Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
int | DeleteItem (int iIndex)
BOOL | GetItem (COMBOBOXEXITEM *pCBItem)
int | InsertItem (const COMBOBOXEXITEM *pCBItem)
int | InsertItem (int iItem, UINT nStringID, int iIndent=0, int iImage=0, int iSelectedImage=0, UINT mask=CBEIF_TEXT|CBEIF_IMAGE|CBEIF_SELECTEDIMAGE|CBEIF_INDENT)
int | InsertItem (int iItem, LPCTSTR lpszItem, int iIndent=0, int iImage=0, int iSelectedImage=0, UINT mask=CBEIF_TEXT|CBEIF_IMAGE|CBEIF_SELECTEDIMAGE|CBEIF_INDENT)
BOOL | SetItem (const COMBOBOXEXITEM *pCBItem)
DWORD | GetExtendedStyle () const
DWORD | SetExtendedStyle (DWORD dwExMask, DWORD dwExStyles)
BOOL | HasEditChanged ()
CEdit * GetEditCtrl ()
CComboBox * GetComboBoxCtrl ()
CImageList * | GetImageList () const
CImageList * | SetImageList (CImageList *pImageList)
int | Dir (UINT attr, LPCTSTR lpszWildCard)
int | FindString (int nIndexStart, LPCTSTR lpszFind) const
int | AddString (LPCTSTR lpszString)
BOOL | SetEditSel (int nStartChar, int nEndChar)
int | InsertString (int nIndex, LPCTSTR lpszString)

Constructor & Destructor Documentation

_CJXLIB_INLINE CCJComboBoxEx::CCJComboBoxEx ( )

Definition at line 243 of file CJComboBoxEx.h.

00244     { }

CCJComboBoxEx::~CCJComboBoxEx ( ) [virtual]

Definition at line 126 of file CJComboBoxEx.cpp.

00127 {
00128     DestroyWindow();
00129 }

Member Function Documentation

_CJXLIB_INLINE int CCJComboBoxEx::AddString ( LPCTSTR lpszString )

Definition at line 267 of file CJComboBoxEx.h.

00268     { UNUSED_ALWAYS(lpszString); ASSERT(FALSE); return CB_ERR; }

BOOL CCJComboBoxEx::Create | ( | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID
 | ) |

Definition at line 55 of file CJComboBoxEx.cpp.

00057 {
00058   // initialize common controls
00059 #ifdef _VC_VERSION_5
00060     INITCOMMONCONTROLSEX icex;
00061     icex.dwSize = sizeof(icex);
00062     icex.dwICC = ICC_USEREX_CLASSES;
00063     VERIFY(InitCommonControlsEx(&icex));
00064 #else
00065     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_USEREX_REG));
00066 #endif
00067
00068     CWnd* pWnd = this;
00069     return pWnd->Create(WC_COMBOBOXEX, NULL, dwStyle, rect, pParentWnd, nID);
00070 }

int CCJComboBoxEx::DeleteItem ( int iIndex )

Definition at line 72 of file CJComboBoxEx.cpp.

00073 {
00074     ASSERT(::IsWindow(m_hWnd));
00075     return (int) ::SendMessage(m_hWnd, CBEM_DELETEITEM, (WPARAM) iIndex, 0);
00076 }

_CJXLIB_INLINE int CCJComboBoxEx::Dir | ( | UINT | attr,
 |  | LPCTSTR | lpszWildCard
 | ) |

Definition at line 263 of file CJComboBoxEx.h.

00264     { UNUSED_ALWAYS(attr); UNUSED_ALWAYS(lpszWildCard); ASSERT(FALSE); return CB_ERR; }

_CJXLIB_INLINE int CCJComboBoxEx::FindString | ( | int | nIndexStart,
 |  | LPCTSTR | lpszFind
 | ) | const

Definition at line 265 of file CJComboBoxEx.h.

00266     { UNUSED_ALWAYS(nIndexStart); UNUSED_ALWAYS(lpszFind); ASSERT(FALSE); return CB_ERR; }

_CJXLIB_INLINE CComboBox * CCJComboBoxEx::GetComboBoxCtrl ( )

Definition at line 253 of file CJComboBoxEx.h.

00254     { ASSERT(::IsWindow(m_hWnd)); return (CComboBox*) CComboBox::FromHandle((HWND) ::SendMessage(m_hWnd, CBEM_GETCOMBOCONTROL, 0, 0)); }

_CJXLIB_INLINE CEdit * CCJComboBoxEx::GetEditCtrl ( )

Definition at line 251 of file CJComboBoxEx.h.

00252     { ASSERT(::IsWindow(m_hWnd)); return (CEdit*) CEdit::FromHandle((HWND) ::SendMessage(m_hWnd, CBEM_GETEDITCONTROL, 0, 0)); }

_CJXLIB_INLINE DWORD CCJComboBoxEx::GetExtendedStyle ( ) const

Definition at line 245 of file CJComboBoxEx.h.

00246     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, CBEM_GETEXTENDEDSTYLE, 0, 0); }

_CJXLIB_INLINE CImageList * CCJComboBoxEx::GetImageList ( ) const

Definition at line 257 of file CJComboBoxEx.h.

00258     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, CBEM_GETIMAGELIST, 0, 0)); }

BOOL CCJComboBoxEx::GetItem ( COMBOBOXEXITEM * pCBItem )

Definition at line 78 of file CJComboBoxEx.cpp.

00079 {
00080     ASSERT(::IsWindow(m_hWnd));
00081     ASSERT(pCBItem != NULL);
00082     ASSERT(AfxIsValidAddress(pCBItem, sizeof(COMBOBOXEXITEM)));
00083
00084     return (int) ::SendMessage(m_hWnd, CBEM_GETITEM, 0, (LPARAM) pCBItem);
00085 }

_CJXLIB_INLINE BOOL CCJComboBoxEx::HasEditChanged ( )

Definition at line 249 of file CJComboBoxEx.h.

00250     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, CBEM_HASEDITCHANGED, 0, 0); }

int CCJComboBoxEx::InsertItem | ( | int | iItem,
 |  | LPCTSTR | lpszItem,
 |  | int | iIndent = 0,
 |  | int | iImage = 0,
 |  | int | iSelectedImage = 0,
 |  | UINT | mask = CBEIF_TEXT|CBEIF_IMAGE|CBEIF_SELECTEDIMAGE|CBEIF_INDENT
 | ) |

Definition at line 103 of file CJComboBoxEx.cpp.

00104 {
00105     COMBOBOXEXITEM cbItem;
00106
00107     cbItem.mask             = mask;
00108     cbItem.iItem            = iItem;
00109     cbItem.pszText          = const_cast<LPTSTR>(lpszItem);
00110     cbItem.iImage           = iImage;
00111     cbItem.iSelectedImage   = iSelectedImage;
00112     cbItem.iIndent          = iIndent;
00113
00114     return InsertItem(&cbItem);
00115 }

int CCJComboBoxEx::InsertItem | ( | int | iItem,
 |  | UINT | nStringID,
 |  | int | iIndent = 0,
 |  | int | iImage = 0,
 |  | int | iSelectedImage = 0,
 |  | UINT | mask = CBEIF_TEXT|CBEIF_IMAGE|CBEIF_SELECTEDIMAGE|CBEIF_INDENT
 | ) |

Definition at line 96 of file CJComboBoxEx.cpp.

00097 {
00098     CString strItem;
00099     strItem.LoadString(nStringID);
00100     return InsertItem(iItem, strItem, iIndent, iImage, iSelectedImage, mask);
00101 }

int CCJComboBoxEx::InsertItem ( const COMBOBOXEXITEM * pCBItem )

Definition at line 87 of file CJComboBoxEx.cpp.

Referenced by InsertItem().

00088 {
00089     ASSERT(::IsWindow(m_hWnd));
00090     ASSERT(pCBItem != NULL);
00091     ASSERT(AfxIsValidAddress(pCBItem, sizeof(COMBOBOXEXITEM), FALSE));
00092
00093     return (int) ::SendMessage(m_hWnd, CBEM_INSERTITEM, 0, (LPARAM) pCBItem);
00094 }

_CJXLIB_INLINE int CCJComboBoxEx::InsertString | ( | int | nIndex,
 |  | LPCTSTR | lpszString
 | ) |

Definition at line 271 of file CJComboBoxEx.h.

00272     { UNUSED_ALWAYS(nIndex); UNUSED_ALWAYS(lpszString); ASSERT(FALSE); return CB_ERR; }

_CJXLIB_INLINE BOOL CCJComboBoxEx::SetEditSel | ( | int | nStartChar,
 |  | int | nEndChar
 | ) |

Definition at line 269 of file CJComboBoxEx.h.

00270     { UNUSED_ALWAYS(nStartChar); UNUSED_ALWAYS(nEndChar); ASSERT(FALSE); return FALSE; }

_CJXLIB_INLINE DWORD CCJComboBoxEx::SetExtendedStyle | ( | DWORD | dwExMask,
 |  | DWORD | dwExStyles
 | ) |

Definition at line 247 of file CJComboBoxEx.h.

00248     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, CBEM_SETEXTENDEDSTYLE, (DWORD) dwExMask, (LPARAM) dwExStyles); }

_CJXLIB_INLINE CImageList * CCJComboBoxEx::SetImageList ( CImageList * pImageList )

Definition at line 255 of file CJComboBoxEx.h.

00256     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, CBEM_SETIMAGELIST, 0, (LPARAM)pImageList->GetSafeHandle())); }

BOOL CCJComboBoxEx::SetItem ( const COMBOBOXEXITEM * pCBItem )

Definition at line 117 of file CJComboBoxEx.cpp.

00118 {
00119     ASSERT(::IsWindow(m_hWnd));
00120     ASSERT(pCBItem != NULL);
00121     ASSERT(AfxIsValidAddress(pCBItem, sizeof(COMBOBOXEXITEM), FALSE));
00122
00123     return (int) ::SendMessage(m_hWnd, CBEM_SETITEM, 0, (LPARAM) pCBItem);
00124 }

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJComboBoxEx.h
  • WinCvs/CJLib/CJLibrary/CJComboBoxEx.cpp
Generated on Sun Oct 21 12:46:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJControlBar Class Reference

#include <CJControlBar.h>

Inheritance diagram for CCJControlBar:

[legend]
Collaboration diagram for CCJControlBar:

[legend]
List of all members.

Public Methods

CCJControlBar ()
virtual | ~CCJControlBar ()
virtual void | EnableSaveState (bool bAutoSave=true)
virtual BOOL | Create (CWnd *pParentWnd, UINT nID, LPCTSTR lpszWindowName=NULL, CSize sizeDefault=CSize(200, 100), DWORD dwStyle=CBRS_LEFT, BOOL bFlatBorders=FALSE)
virtual void | GetChildRect (CRect &rect)
virtual int | GetMinExt ()
virtual BOOL | IsLeftDocked () const
virtual BOOL | IsRightDocked () const
virtual BOOL | IsTopDocked () const
virtual BOOL | IsBottomDocked () const
virtual BOOL | IsHorzDocked () const
virtual BOOL | IsVertDocked () const
virtual BOOL | IsFloating () const
virtual void | SetNormalSize (const CSize &cs)
virtual void | Normalize ()
virtual void | Minimize ()
virtual void | Maximize (int size)
virtual void | EnableDockingOnSizeBar (DWORD dwDockStyle)
virtual void | ShowFrameControls (BOOL bGripper=TRUE, BOOL bButtons=TRUE)
virtual void | SetMenuID (UINT popupMenuID, UINT popToolbarID=0, int nPos=0)
virtual UINT | GetMenuID ()
virtual void | EnableFlatLook (BOOL bFlat=TRUE)
virtual void | EnableFlatLook (BOOL bGripper, BOOL bBorder, BOOL bButtons)
virtual int | GetVertSize ()
virtual int | GetHorzSize ()
virtual BOOL | PreTranslateMessage (MSG *pMsg)
virtual void | OnUpdateCmdUI (CFrameWnd *pTarget, BOOL bDisableIfNoHndler)
virtual CSize | CalcDynamicLayout (int nLength, DWORD nMode)

Public Attributes

BOOL | m_bUnique
BOOL | m_bToFit
CHILD_BORDER m_eChildBorder

Protected Methods

virtual CRect | GetGripperRect ()
virtual CRect | GetButtonRect ()
virtual void | DrawGripper (CDC *pDC)
virtual void | SetChild (CWnd *pWnd)
virtual void | OnInvertTracker (const CRect &rect)
virtual void | HitTest (CPoint &point)
virtual void | DrawBorders (CDC *pDC, CRect &rect)
virtual void | EraseNonClient ()
virtual void | DrawGriperCaption (CDC *pDC, LPRECT pRect)
virtual void | LoadBarState (CSize &size, int nID)
virtual void | SaveBarState (CSize &size)
afx_msg void | OnNcPaint ()
afx_msg void | OnPaint ()
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg BOOL | OnSetCursor (CWnd *pWnd, UINT nHitTest, UINT message)
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point)
afx_msg UINT | OnNcHitTest (CPoint point)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnWindowPosChanged (WINDOWPOS *lpwndpos)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnButtonClose ()
afx_msg void | OnUpdateButtonClose (CCmdUI *pCmdUI)
afx_msg void | OnButtonMinimize ()
afx_msg void | OnUpdateButtonMinimize (CCmdUI *pCmdUI)
afx_msg void | OnRButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnMeasureItem (int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
afx_msg LRESULT | OnMenuChar (UINT nChar, UINT nFlags, CMenu *pMenu)
afx_msg void | OnInitMenuPopup (CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)

Protected Attributes

int | m_cxOffset
int | m_cyOffset
BTN_IMG_INDEX m_eAuxIndex
UINT | m_popToolbarID
UINT | m_popupMenuID
CCJMenu m_popupMenu
int | m_nPos
BOOL | m_bOkToDrag
BOOL | m_bMaximized
BOOL | m_bDragging
BOOL | m_bButtons
CRect | m_rcTrack
CSize | m_sizeDesired
CSize | m_sizeNormal
CSize | m_sizeVert
CSize | m_sizeHorz
CSize | m_sizeFloat
CPoint | m_ptCurDrag
CPoint | m_ptStartDrag
CWnd * m_pChildWnd
CImageList | m_ImageList
CCJCBarButton m_btnClose
CCJCBarButton m_btnMinim
CToolTipCtrl | m_ToolTip
BOOL | m_bGripper
BOOL | m_bFlatGripper
BOOL | m_bFlatBorder
CString | m_strSection
bool | m_bAutoSave
HICON | m_hIcon
HICON | m_hAuxIcon
int | m_nID
BOOL | m_bFloating

Constructor & Destructor Documentation

CCJControlBar::CCJControlBar ( )

Definition at line 255 of file CJControlBar.cpp.

00256 {
00257     m_popupMenuID       = 0;
00258     m_popToolbarID      = 0;
00259     m_nPos              = 0;
00260     m_bToFit            = FALSE;
00261     m_bOkToDrag         = FALSE;
00262     m_bDragging         = FALSE;
00263     m_bMaximized        = FALSE;
00264     m_bUnique           = FALSE;
00265     m_bGripper          = TRUE;
00266     m_bButtons          = TRUE;
00267     m_bFlatGripper      = FALSE;            // Yiannhs Ver 6.06 Start Up With Flat Gripper
00268     m_bFlatBorder       = FALSE;            // Yiannhs Start Up With Flat Border
00269     m_bAutoSave         = TRUE;
00270     m_sizeVert          = CSize(200,100);   // Yiannhs to test different rectangles
00271     m_sizeHorz          = CSize(200,100);
00272     m_sizeFloat         = CSize(200,100);
00273     m_sizeDesired       = CSize(200,100);
00274     m_sizeNormal        = CSize(200,100);
00275     m_cxOffset          = 5;
00276     m_cyOffset          = 3;
00277     m_pChildWnd         = NULL;
00278     m_strSection        = _T("");
00279     m_eAuxIndex         = HIDE_CONTRLBAR;
00280     m_hIcon             = NULL;
00281     m_hAuxIcon          = NULL;
00282     m_eChildBorder      = NONE;
00283     m_nID               = 0;
00284     m_bFloating         = FALSE;
00285
00286     // Create the image list used by frame buttons.
00287     m_ImageList.Create(IDB_BUTTON_IMAGES,
00288         10, 1, RGB(255,255,255));
00289 }

CCJControlBar::~CCJControlBar ( ) [virtual]

Definition at line 291 of file CJControlBar.cpp.

00292 {
00293     // fix potential resource leak - KStowell - 10-22-99.
00294     m_ImageList.DeleteImageList();
00295     _destroyIcon(m_hIcon);
00296     _destroyIcon(m_hAuxIcon);
00297 }

Member Function Documentation

CSize CCJControlBar::CalcDynamicLayout | ( | int | nLength,
 |  | DWORD | nMode
 | ) | [virtual]

Definition at line 444 of file CJControlBar.cpp.

Referenced by CCJSizeDockBar::CalcSizeBarLayout().

00445 {
00446     CSize sizeResult = m_sizeDesired;
00447
00448     //1999-05-19 Yiannhs. Since We Get Here from different Places do some more calculations.
00449     //                    Give Visual Feedback to user.
00450
00451     if( !nLength )
00452     {
00453         CRect rect;
00454         GetWindowRect( rect );
00455         sizeResult = rect.Size();
00456
00457         if( nMode & LM_HORZDOCK )
00458         {
00459             if( !IsHorzDocked() ) {
00460                 sizeResult = m_sizeHorz;
00461             }
00462             else if( nMode & LM_VERTDOCK )
00463             {
00464                 if( !IsVertDocked() ) {
00465                     sizeResult = m_sizeVert;
00466                 }
00467                 else {
00468                     sizeResult = m_sizeFloat;           //Do not check if it is floating. Do it
00469                 }
00470                 return( sizeResult );                   //do not go on
00471             }
00472         }
00473     }
00474     //1999-05-19    Yiannhs
00475
00476     if( IsFloating( ))
00477     {
00478         if (nMode == LM_HORZ) {
00479             if (nLength < 50)
00480                 nLength = 50;
00481             m_sizeDesired.cx = nLength;
00482         }
00483
00484         if (nMode == (LM_LENGTHY | LM_HORZ)) {
00485             if (nLength < 50)
00486                 nLength = 50;
00487             m_sizeDesired.cy = nLength;
00488         }
00489
00490         sizeResult = m_sizeDesired;
00491
00492     }
00493
00494     return sizeResult;
00495 }

BOOL CCJControlBar::Create | ( | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | LPCTSTR | lpszWindowName = NULL,
 |  | CSize | sizeDefault = CSize(200,100),
 |  | DWORD | dwStyle = CBRS_LEFT,
 |  | BOOL | bFlatBorders = FALSE
 | ) | [virtual]

Definition at line 342 of file CJControlBar.cpp.

Referenced by CCJExplorerBar::Create(), and CMainFrame::InitializeDockingWindows().

00343 {
00344     ASSERT_VALID(pParentWnd);   // must have a parent
00345
00346     // If autosave is enabled, get the previous settings from the registry.
00347     if( m_bAutoSave ) {
00348         LoadBarState(sizeDefault, nID);
00349     }
00350
00351     // Set initial control bar style.
00352     SetBarStyle(dwStyle & CBRS_ALL|CBRS_HIDE_INPLACE|CBRS_SIZE_DYNAMIC|CBRS_FLOAT_MULTI);
00353
00354     dwStyle &= ~CBRS_ALL;
00355     dwStyle |= WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN;
00356
00357     m_sizeDesired = m_sizeNormal = sizeDefault;
00358     m_sizeHorz = m_sizeVert = m_sizeFloat = sizeDefault; // Yiannhs : Setup the new sizes as well
00359
00360     // Set flat control bar style.
00361     m_bFlatGripper = m_bFlatBorder = bFlatBorders;
00362
00363     // Yiannhs this seems a better way than mine, to register the double clicks class.
00364     // I have just added the redraw flags i was using in ver 6.06
00365     CString wndClass = ::AfxRegisterWndClass(
00366         CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW, 0, ::GetSysColorBrush(COLOR_BTNFACE));
00367
00368     CRect rect( 0, 0, sizeDefault.cx, sizeDefault.cy );
00369     return CWnd::Create( wndClass, lpszWindowName, dwStyle, rect, pParentWnd, nID );
00370 }

void CCJControlBar::DrawBorders | ( | CDC * | pDC,
 |  | CRect & | rect
 | ) | [protected, virtual]

Definition at line 1027 of file CJControlBar.cpp.

Referenced by OnPaint().

01028 {
01029     CRect rc;
01030     rc.CopyRect(&rect);
01031
01032     CRect rcTrack;
01033     rcTrack.CopyRect(&rc);
01034
01035     if(IsVertDocked())
01036     {
01037         if (!m_bToFit) {
01038             rcTrack.top = rc.bottom - TRACK_BORDER_SIZE;
01039             rcTrack.top-=2;
01040             rcTrack.bottom-=1;
01041
01042             //Yiannhs flat interface style
01043             if( !m_bFlatBorder )
01044                 pDC->Draw3dRect(rcTrack, afxData.clrBtnHilite, afxData.clrBtnShadow);
01045             else
01046                 pDC->FillSolidRect(rcTrack, afxData.clrBtnFace);
01047         }
01048     }
01049
01050     else if (IsHorzDocked())
01051     {
01052         if (!m_bToFit) {
01053             rcTrack.left = rc.right - TRACK_BORDER_SIZE;
01054             rcTrack.left-=2;
01055             rcTrack.right-=1;
01056
01057             //Yiannhs flat interface style
01058             if( !m_bFlatBorder )
01059                 pDC->Draw3dRect(rcTrack, afxData.clrBtnHilite, afxData.clrBtnShadow);
01060             else
01061                 pDC->FillSolidRect(rcTrack, afxData.clrBtnFace);
01062         }
01063     }
01064
01065     DrawGripper(pDC);
01066 }

void CCJControlBar::DrawGriperCaption | ( | CDC * | pDC,
 |  | LPRECT | pRect
 | ) | [protected, virtual]

Definition at line 1124 of file CJControlBar.cpp.

Referenced by DrawGripper().

01125 {
01126     ASSERT( pDC );
01127     ASSERT( pRect );
01128     if (!IsFloating() && m_bGripper)
01129     {
01130         BOOL m_bIsHorz = IsHorzDocked();
01131         CRect TheRect( pRect );
01132         COLORREF clrBG = GetSysColor(COLOR_ACTIVECAPTION); // background color
01133         int cxCap = 0;
01134         int cyCap = 0;
01135         int rx = TheRect.left;
01136         int ry = TheRect.top;
01137         if( !m_bIsHorz ) {
01138             cxCap = TheRect.Width();
01139             cyCap = TheRect.Height();
01140         } else {
01141             cxCap = TheRect.Height();
01142             cyCap = TheRect.Width();
01143             //            rx = TheRect.top;
01144             //            ry = TheRect.left;
01145         }
01146
01147         int r = GetRValue(clrBG);               // red..
01148         int g = GetGValue(clrBG);               // ..green
01149         int b = GetBValue(clrBG);               // ..blue color vals
01150         int w = cxCap;                          // width of area to shade
01151         int xDelta= max(w/NCOLORSHADES,1);      // width of one shade band
01152         int x = xDelta;
01153         CBrush* pOldBrush = NULL;
01154         {
01155             CBrush brush(RGB(0,0,0));
01156             pOldBrush = pDC->SelectObject(&brush);
01157             if( !m_bIsHorz ) {
01158                 pDC->PatBlt(rx, ry, x, cyCap, PATCOPY);
01159             } else {
01160                 pDC->PatBlt(rx, ry, cyCap, x, PATCOPY);
01161             }
01162             pDC->SelectObject(pOldBrush);
01163
01164             // fix potential resource leak - KStowell - 10-21-99
01165             brush.DeleteObject();
01166         }
01167         int w2  = w*w;                                              // w squared
01168         while( x < cxCap ) {                                       // paint bands right to left
01169             //x += xDelta;                                            // next band
01170             int wmx2 = (w-x)*(w-x);                                 // w minus x squared
01171             COLORREF clr = RGB( r-(r*wmx2)/w2, g-(g*wmx2)/w2, b-(b*wmx2)/w2 );
01172             {
01173                 CBrush brush(clr);
01174                 pDC->SelectObject(&brush);
01175                 if( !m_bIsHorz ) {
01176                     pDC->PatBlt(rx+x, ry, xDelta, cyCap, PATCOPY);
01177                 } else {
01178                     pDC->PatBlt(rx, ry+x, cyCap, xDelta, PATCOPY);
01179                 }
01180                 pDC->SelectObject(pOldBrush);
01181
01182                 // fix potential resource leak - KStowell - 10-21-99
01183                 brush.DeleteObject();
01184             }
01185             x += xDelta;
01186         }
01187         {
01188             CBrush brush(clrBG);
01189             pDC->SelectObject(&brush);
01190             if( !m_bIsHorz ) {
01191                 pDC->PatBlt(rx+x, ry, cxCap-x, cyCap, PATCOPY);
01192             }
01193             else {
01194                 pDC->PatBlt(rx, ry+x, cyCap, cxCap-x, PATCOPY);
01195             }
01196
01197             // fix potential resource leak - KStowell - 10-21-99
01198             brush.DeleteObject();
01199         }
01200         pDC->SelectObject(pOldBrush);
01201     }
01202 }//yiannhs new method ends

void CCJControlBar::DrawGripper ( CDC * pDC ) [protected, virtual]

Definition at line 1204 of file CJControlBar.cpp.

Referenced by DrawBorders().

01205 {
01206     //Yiannhs. changed to make evaluations on top. Replaced with flat gradient caption
01207     if (!IsFloating() && m_bGripper)
01208     {
01209         // draw the gripper.
01210         CRect pRect(GetGripperRect());
01211
01212         //Yiannhs New Lines
01213         CRect SecondGrip;
01214         SecondGrip.CopyRect( pRect );
01215         //Yiannhs: use the original beveled style gripper
01216         if (IsHorzDocked()) {
01217             SecondGrip.OffsetRect(4,0);
01218         } else {
01219             SecondGrip.OffsetRect(0,4);
01220         }
01221
01222         //Yiannhs Selective Gripper look
01223         if( !m_bFlatGripper ) {
01224
01225             //Yiannhs: also updated to use AfxData
01226             pDC->FillSolidRect( pRect, afxData.clrBtnShadow  );
01227             pDC->Draw3dRect( pRect, afxData.clrBtnHilite, afxData.clrBtnShadow );
01228
01229             pDC->FillSolidRect( SecondGrip, afxData.clrBtnShadow );
01230             pDC->Draw3dRect( SecondGrip, afxData.clrBtnHilite, afxData.clrBtnShadow );
01231
01232         } else {    //Yiannhs: Use Flat Gripper
01233
01234             CRect FlatRect( pRect.left, pRect.top, SecondGrip.right, SecondGrip.bottom);
01235             if (IsHorzDocked()) {
01236                 FlatRect.DeflateRect(-2,0);
01237             } else {
01238                 FlatRect.DeflateRect(0,-2);
01239             }
01240             DrawGriperCaption( pDC, FlatRect );
01241         }
01242     }
01243 }

void CCJControlBar::EnableDockingOnSizeBar ( DWORD dwDockStyle ) [virtual]

Definition at line 910 of file CJControlBar.cpp.

Referenced by CMainFrame::InitializeDockingWindows().

00911 {
00912     ASSERT(m_pDockContext == NULL);
00913     m_dwDockStyle = dwDockStyle;
00914
00915     if (m_pDockContext == NULL)
00916         m_pDockContext = new CCJDockContext(this);
00917
00918     if (m_hWndOwner == NULL)
00919         m_hWndOwner = ::GetParent(m_hWnd);
00920 }

void CCJControlBar::EnableFlatLook | ( | BOOL | bGripper,
 |  | BOOL | bBorder,
 |  | BOOL | bButtons
 | ) | [virtual]

Definition at line 332 of file CJControlBar.cpp.

00333 {
00334     ASSERT(::IsWindow(m_hWnd));
00335     m_bFlatGripper = bGripper;
00336     m_bFlatBorder  = bBorder;
00337     m_btnClose.DisableFlatLook( bButtons );
00338     m_btnMinim.DisableFlatLook( bButtons );
00339     Invalidate();
00340 }

void CCJControlBar::EnableFlatLook ( BOOL bFlat = TRUE ) [virtual]

Definition at line 327 of file CJControlBar.cpp.

00328 {
00329     EnableFlatLook(bFlat, bFlat, bFlat);
00330 }

_CJXLIB_INLINE void CCJControlBar::EnableSaveState ( bool bAutoSave = true ) [virtual]

Definition at line 536 of file CJControlBar.h.

00537     { ASSERT(::IsWindow(m_hWnd)); m_bAutoSave = bAutoSave; }

void CCJControlBar::EraseNonClient ( ) [protected, virtual]

Definition at line 1012 of file CJControlBar.cpp.

Referenced by OnNcPaint().

01013 {
01014     CWindowDC dc(this);
01015
01016     CRect rectClient;
01017     GetClientRect(rectClient);
01018     CRect rectWindow;
01019     GetWindowRect(rectWindow);
01020     ScreenToClient(rectWindow);
01021     rectClient.OffsetRect(-rectWindow.left, -rectWindow.top);
01022
01023     dc.ExcludeClipRect(rectClient);
01024     rectWindow.OffsetRect(-rectWindow.left, -rectWindow.top);
01025 }

CRect CCJControlBar::GetButtonRect ( ) [protected, virtual]

Definition at line 1245 of file CJControlBar.cpp.

Referenced by OnWindowPosChanged().

01246 {
01247     CRect rect;
01248     GetClientRect(&rect);
01249     rect.OffsetRect(-rect.left,-rect.top);
01250
01251     if (IsHorzDocked()) {
01252         rect.top     += 3;
01253         rect.bottom = rect.top+12;
01254         rect.left  += 2;
01255         rect.right  = rect.left+12;
01256     }
01257
01258     else {
01259         rect.right -= 19;
01260         rect.left   = rect.right-12;
01261         rect.top   += 3;
01262         rect.bottom = rect.top+12;
01263     }
01264
01265     return rect;
01266 }

void CCJControlBar::GetChildRect ( CRect & rect ) [virtual]

Reimplemented in CCJExplorerBar, and CCJTabCtrlBar.

Definition at line 980 of file CJControlBar.cpp.

Referenced by CCJTabCtrlBar::GetChildRect(), OnPaint(), and OnWindowPosChanged().

00981 {
00982     GetClientRect(&rect);
00983
00984     if (IsFloating()) {
00985         rect.DeflateRect(3,3);
00986     } else {
00987         if (IsVertDocked()) {
00988             rect.DeflateRect(m_cxOffset, 0);
00989             rect.top += (GetMinExt()-5);
00990             //Yiannhs: if it is the last bar inside a dockbar, cover the whole space
00991             if( !m_bToFit ) {
00992                 rect.bottom -= (TRACK_BORDER_SIZE + 4);
00993             } else {
00994                 rect.bottom -= 4;
00995             }
00996         } else {
00997             rect.left   += (GetMinExt()-5);
00998             //Yiannhs: if it is the last bar inside a dockbar, cover the whole space
00999             if( !m_bToFit ) {
01000                 rect.right  -= (TRACK_BORDER_SIZE + 4);
01001             } else {
01002                 rect.right  -= 4;
01003             }
01004             rect.DeflateRect(0, m_cxOffset);
01005         }
01006
01007         if( rect.left > rect.right || rect.top > rect.bottom )
01008             rect = CRect(0,0,0,0);
01009     }
01010 }

CRect CCJControlBar::GetGripperRect ( ) [protected, virtual]

Definition at line 1268 of file CJControlBar.cpp.

Referenced by DrawGripper().

01269 {
01270     CRect rect;
01271     GetClientRect(&rect);
01272     rect.OffsetRect(-rect.left,-rect.top);
01273
01274     if (IsHorzDocked()) {
01275         rect.DeflateRect(3,3);
01276         rect.left   += 1;
01277         rect.right  = rect.left+3;
01278         rect.bottom -= 1;
01279         rect.top    += m_bButtons?30:1;
01280     }
01281
01282     else {
01283         rect.DeflateRect(4,4);
01284         rect.top     += 2;
01285         rect.bottom  = rect.top+3;
01286         rect.right   -= m_bButtons?30:2;
01287     }
01288
01289     return rect;
01290 }

_CJXLIB_INLINE int CCJControlBar::GetHorzSize ( ) [virtual]

Definition at line 542 of file CJControlBar.h.

00543     { ASSERT(::IsWindow(m_hWnd)); return m_sizeDesired.cy; }

_CJXLIB_INLINE UINT CCJControlBar::GetMenuID ( ) [virtual]

Definition at line 545 of file CJControlBar.h.

00546     { ASSERT(::IsWindow(m_hWnd)); return m_popupMenuID; }

int CCJControlBar::GetMinExt ( ) [virtual]

Definition at line 964 of file CJControlBar.cpp.

Referenced by GetChildRect(), CCJSizeDockBar::Maximize(), Minimize(), and OnLButtonUp().

00965 {
00966     int nRet = TRACK_BORDER_SIZE;
00967
00968     if (m_bGripper || m_bButtons) {
00969         nRet += GRIP_START;
00970         nRet += GRIP_SIZE*2;
00971         nRet += GRIP_INTRASPACING*3+2;
00972     }
00973
00974     else
00975         nRet += 2;
00976
00977     return nRet;
00978 }

_CJXLIB_INLINE int CCJControlBar::GetVertSize ( ) [virtual]

Definition at line 539 of file CJControlBar.h.

00540     { ASSERT(::IsWindow(m_hWnd)); return m_sizeDesired.cx; }

void CCJControlBar::HitTest ( CPoint & point ) [protected, virtual]

Definition at line 1068 of file CJControlBar.cpp.

Referenced by OnMouseMove().

01069 {
01070     CRect rcWin;
01071     GetClientRect(&rcWin);
01072     HCURSOR hCur = ::LoadCursor(NULL,IDC_ARROW);
01073
01074     if( !m_bDragging )
01075     {
01076         if (IsVertDocked()) {
01077             rcWin.top = rcWin.bottom - TRACK_BORDER_SIZE;
01078             m_bOkToDrag = (rcWin.PtInRect(point) && !m_bToFit);
01079             if(m_bOkToDrag) {
01080                 hCur = AfxGetApp()->LoadCursor(IDC_VSPLITBAR);
01081             }
01082         }
01083
01084         else if (IsHorzDocked()) {
01085             rcWin.left = rcWin.right - TRACK_BORDER_SIZE;
01086             m_bOkToDrag = (rcWin.PtInRect(point) && !m_bToFit);
01087             if(m_bOkToDrag) {
01088                 hCur = AfxGetApp()->LoadCursor(IDC_HSPLITBAR);
01089             }
01090         }
01091
01092         SetCursor(hCur);
01093     }
01094 }

_CJXLIB_INLINE BOOL CCJControlBar::IsBottomDocked ( ) const [virtual]

Definition at line 563 of file CJControlBar.h.

Referenced by IsHorzDocked(), and CCJSizeDockBar::Maximize().

00564     { ASSERT(::IsWindow(m_hWnd)); return (GetParent()->GetDlgCtrlID()==AFX_IDW_SIZEBAR_BOTTOM); }

_CJXLIB_INLINE BOOL CCJControlBar::IsFloating ( ) const [virtual]

Definition at line 575 of file CJControlBar.h.

Referenced by CalcDynamicLayout(), DrawGripper(), CCJTabCtrlBar::GetChildRect(), CCJExplorerBar::GetChildRect(), GetChildRect(), OnLButtonDown(), OnRButtonDown(), OnUpdateCmdUI(), CCJExplorerBar::OnWindowPosChanged(), OnWindowPosChanged(), and SaveBarState().

00576     { ASSERT(::IsWindow(m_hWnd)); return (!IsHorzDocked() && !IsVertDocked()); }

_CJXLIB_INLINE BOOL CCJControlBar::IsHorzDocked ( ) const [virtual]

Definition at line 560 of file CJControlBar.h.

Referenced by CalcDynamicLayout(), DrawBorders(), DrawGripper(), GetButtonRect(), GetGripperRect(), HitTest(), IsFloating(), Maximize(), Minimize(), Normalize(), OnLButtonUp(), OnMouseMove(), OnUpdateCmdUI(), OnWindowPosChanged(), and SaveBarState().

00561     { ASSERT(::IsWindow(m_hWnd)); return (IsTopDocked() || IsBottomDocked()); }

_CJXLIB_INLINE BOOL CCJControlBar::IsLeftDocked ( ) const [virtual]

Definition at line 572 of file CJControlBar.h.

Referenced by IsVertDocked(), and CCJSizeDockBar::Maximize().

00573     { ASSERT(::IsWindow(m_hWnd)); return (GetParent()->GetDlgCtrlID()==AFX_IDW_SIZEBAR_LEFT); }

_CJXLIB_INLINE BOOL CCJControlBar::IsRightDocked ( ) const [virtual]

Definition at line 569 of file CJControlBar.h.

Referenced by IsVertDocked(), and CCJSizeDockBar::Maximize().

00570     { ASSERT(::IsWindow(m_hWnd)); return (GetParent()->GetDlgCtrlID()==AFX_IDW_SIZEBAR_RIGHT); }

_CJXLIB_INLINE BOOL CCJControlBar::IsTopDocked ( ) const [virtual]

Definition at line 566 of file CJControlBar.h.

Referenced by IsHorzDocked(), and CCJSizeDockBar::Maximize().

00567     { ASSERT(::IsWindow(m_hWnd)); return (GetParent()->GetDlgCtrlID()==AFX_IDW_SIZEBAR_TOP); }

_CJXLIB_INLINE BOOL CCJControlBar::IsVertDocked ( ) const [virtual]

Definition at line 557 of file CJControlBar.h.

Referenced by CalcDynamicLayout(), DrawBorders(), CCJExplorerBar::GetChildRect(), GetChildRect(), HitTest(), IsFloating(), Maximize(), Minimize(), Normalize(), CCJExplorerBar::OnEraseBkgnd(), OnLButtonDown(), OnLButtonUp(), OnMouseMove(), and CCJExplorerBar::OnWindowPosChanged().

00558     { ASSERT(::IsWindow(m_hWnd)); return (IsLeftDocked() || IsRightDocked()); }

void CCJControlBar::LoadBarState | ( | CSize & | size,
 |  | int | nID
 | ) | [protected, virtual]

Definition at line 1420 of file CJControlBar.cpp.

Referenced by Create().

01421 {
01422     m_nID = nID;
01423     int nIndex = 0;
01424     CWinApp* pApp = AfxGetApp();
01425
01426     // attempt to loop through all of the defaults stored in the
01427     // system until we find our control id.
01428     while( TRUE )
01429     {
01430         // start at 0 and search for a match to our control bars
01431         // resource id. If one was not found, return.
01432         m_strSection.Format(_T("Bar State-Bar%d"), nIndex);
01433         int nBarID = pApp->GetProfileInt( m_strSection, _T("BarID"), -1 );
01434
01435         // couldn't find a match, just bail...
01436         if( nBarID == -1 ) {
01437             TRACE1( "Warning: Could not find registry information for control bar ID %d\n", m_nID );
01438             return;
01439         }
01440
01441         // we have a match, read the information that was stored, and
01442         // update the CRect object that was passed in.
01443         if( nBarID == m_nID ) {
01444             //m_strSection += _T("\\CodeJock"); //JK - removed to fix the Bar savings, replaced by the code below... The fix taken from CodeJock Website Discussion board
01445             m_strSection.Format ( _T("CodeJock Bar State-Bar%d"), nIndex ) ;    //JK
01446
01447             size.cx     = pApp->GetProfileInt( m_strSection, _T("MRUDesiredCX"), size.cx );
01448             size.cy     = pApp->GetProfileInt( m_strSection, _T("MRUDesiredCY"), size.cy );
01449             m_bFloating = pApp->GetProfileInt( m_strSection, _T("MRUFloating" ), m_bFloating );
01450             return;
01451         }
01452
01453         // increment count.
01454         ++nIndex;
01455     }
01456 }

void CCJControlBar::Maximize ( int size ) [virtual]

Definition at line 922 of file CJControlBar.cpp.

Referenced by CCJSizeDockBar::Maximize().

00923 {
00924     m_sizeNormal = m_sizeDesired;
00925     if (IsHorzDocked()) {
00926         m_sizeDesired.cx = size;
00927     }
00928
00929     else if (IsVertDocked()) {
00930         m_sizeDesired.cy = size;
00931     }
00932
00933     m_bMaximized = TRUE;
00934 }

void CCJControlBar::Minimize ( ) [virtual]

Definition at line 936 of file CJControlBar.cpp.

Referenced by CCJSizeDockBar::Maximize().

00937 {
00938     m_sizeNormal = m_sizeDesired;
00939
00940     if (IsHorzDocked()) {
00941         m_sizeDesired.cx = GetMinExt();
00942     }
00943
00944     else if (IsVertDocked()) {
00945         m_sizeDesired.cy = GetMinExt();
00946     }
00947
00948     m_bMaximized = FALSE;
00949 }

void CCJControlBar::Normalize ( ) [virtual]

Definition at line 951 of file CJControlBar.cpp.

Referenced by CCJSizeDockBar::Normalize().

00952 {
00953     if (IsHorzDocked()) {
00954         m_sizeDesired.cx = m_sizeNormal.cx;
00955     }
00956
00957     else if (IsVertDocked()) {
00958         m_sizeDesired.cy = m_sizeNormal.cy;
00959     }
00960
00961     m_bMaximized = FALSE;
00962 }

void CCJControlBar::OnButtonClose ( ) [protected]

Reimplemented in CCJExplorerBar.

Definition at line 879 of file CJControlBar.cpp.

00880 {
00881     GetDockingFrame()->ShowControlBar(this,FALSE,FALSE);
00882 }

void CCJControlBar::OnButtonMinimize ( ) [protected]

Definition at line 889 of file CJControlBar.cpp.

00890 {
00891     if (!m_bMaximized) {
00892         ((CCJSizeDockBar *)GetParent())->Maximize(this);
00893         m_bMaximized = TRUE;
00894     }
00895
00896     else {
00897         ((CCJSizeDockBar *)GetParent())->Normalize(this);
00898         m_bMaximized = FALSE;
00899     }
00900 }

int CCJControlBar::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Reimplemented in CCJExplorerBar, CCJTabCtrlBar, and CBarConsole.

Definition at line 688 of file CJControlBar.cpp.

Referenced by CBarConsole::OnCreate(), CCJTabCtrlBar::OnCreate(), and CCJExplorerBar::OnCreate().

00689 {
00690     if (CControlBar::OnCreate(lpCreateStruct) == -1)
00691         return -1;
00692
00693     if (m_bButtons)
00694     {
00695         if(!m_btnClose.Create(NULL, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
00696             BS_NOTIFY | BS_OWNERDRAW | BS_ICON,
00697             CRect(0,0,0,0), this, IDC_BUTTON_HIDE ))
00698         {
00699             TRACE0( "Unable to create close button\n" );
00700             return -1;
00701         }
00702
00703
00704         if(!m_btnMinim.Create(NULL, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
00705             BS_NOTIFY | BS_OWNERDRAW | BS_ICON,
00706             CRect(0,0,0,0), this, IDC_BUTTON_MINI ))
00707         {
00708             TRACE0( "Unable to create minimize button\n" );
00709             return -1;
00710         }
00711
00712         // Yiannhs Selective flat style interface. The difference is in adding the if statement
00713         if( !m_bFlatBorder && !m_bFlatGripper ) {
00714             m_btnClose.DisableFlatLook();
00715             m_btnMinim.DisableFlatLook();
00716         }
00717
00718         m_hIcon = m_ImageList.ExtractIcon(0);
00719         m_btnClose.SetIcon(m_hIcon, CSize(10,10));
00720
00721         // Create the ToolTip control.
00722         m_ToolTip.Create(this);
00723         m_ToolTip.Activate(TRUE);
00724         m_ToolTip.AddTool (&m_btnClose, IDS_HIDE);
00725         m_ToolTip.AddTool (&m_btnMinim, IDS_EXPAND);
00726     }
00727
00728     return 0;
00729 }

BOOL CCJControlBar::OnEraseBkgnd ( CDC * pDC ) [protected]

Reimplemented in CCJExplorerBar.

Definition at line 681 of file CJControlBar.cpp.

00682 {
00683     // KStowell - overridden for flicker-free drawing.
00684     UNUSED_ALWAYS(pDC);
00685     return TRUE;
00686 }

void CCJControlBar::OnInitMenuPopup | ( | CMenu * | pPopupMenu,
 |  | UINT | nIndex,
 |  | BOOL | bSysMenu
 | ) | [protected]

Definition at line 1363 of file CJControlBar.cpp.

01364 {
01365     CControlBar::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
01366
01367     if(!bSysMenu) {
01368         if (m_popupMenu.IsMenu(pPopupMenu)) {
01369             CCJMenu::UpdateMenu(pPopupMenu);
01370         }
01371     }
01372 }

void CCJControlBar::OnInvertTracker ( const CRect & rect ) [protected, virtual]

Definition at line 1096 of file CJControlBar.cpp.

Referenced by OnLButtonDown(), OnLButtonUp(), and OnMouseMove().

01097 {
01098     ASSERT_VALID(this);
01099     ASSERT(!rect.IsRectEmpty());
01100
01101     CDC* pDC = GetDockingFrame()->GetDC();
01102     CBrush* pBrush = CDC::GetHalftoneBrush();
01103     CBrush* pOldBrush = NULL;
01104
01105     if (pBrush != NULL) {
01106         pOldBrush = pDC->SelectObject(pBrush);
01107     }
01108
01109     pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATINVERT);
01110
01111     if (pOldBrush != NULL) {
01112         pDC->SelectObject(pOldBrush);
01113     }
01114     GetDockingFrame()->ReleaseDC(pDC);
01115 }

void CCJControlBar::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Reimplemented in CCJExplorerBar.

Definition at line 795 of file CJControlBar.cpp.

00796 {
00797     // Yiannhs. When the bar is inside a mdiframe window, and click on area
00798     // the inner child does not cover, the whole area is grayed!!!
00799
00800     if( IsFloating( )) //see Tab ControlBar
00801     {
00802         // If the window is floating, we want to
00803         // bring it up to the top.
00804         SetFocus();
00805         SetWindowPos( NULL, 0,0,0,0,
00806             SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW );
00807         return;
00808     }
00809
00810     if (m_bOkToDrag)
00811     {
00812         CFrameWnd *pFrame=GetDockingFrame();
00813         GetClientRect(m_rcTrack);
00814
00815         if (IsVertDocked()) {
00816             // Yiannhs
00817             m_rcTrack.top = m_rcTrack.bottom - TRACK_BORDER_SIZE -2;
00818             m_rcTrack.bottom-=2;
00819         }
00820 //1999-05-19 Yiannhs. do not call one more function
00821         else { //if (IsHorzDocked()) {
00822             // Yiannhs
00823             m_rcTrack.left = m_rcTrack.right - TRACK_BORDER_SIZE -2;
00824             m_rcTrack.right-=2;
00825         }
00826
00827         ClientToScreen(&m_rcTrack);
00828         pFrame->ScreenToClient(&m_rcTrack);
00829         ClientToScreen(&point);
00830         pFrame->ScreenToClient(&point);
00831
00832         m_ptStartDrag = point;
00833         m_ptCurDrag = point;
00834
00835         SetCapture();
00836         m_bDragging = TRUE;
00837         OnInvertTracker(m_rcTrack);
00838     }
00839
00840     else if (m_pDockBar) {
00841         if (OnToolHitTest(point, NULL) == -1) {
00842             ClientToScreen(&point);
00843 //1999-05-26 Yiannhs
00844 //          Handle the message loop before CDockContext
00845             MSG msg;
00846             ValidateRect( NULL );   //Make sure this control bar will not ask for Paint messages later
00847             HWND    hwnd = NULL;
00848             while (::PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_REMOVE))
00849             {   //ask for messages in any window of the application, and remove those
00850                 DispatchMessage( &msg );
00851                 if( msg.hwnd != this->m_hWnd ) {
00852                     hwnd = msg.hwnd;    //keep the window which receives paint messages
00853                     break;              //exit the loop
00854                 }
00855             }
00856
00857             if( hwnd ) {    //if a window is getting Paint messages work on it
00858                 ::ValidateRect( hwnd, NULL );   //the window does not need painting
00859                 ::ValidateRect( ::GetParent( hwnd ), NULL );    //Its parent window as well
00860                 while (::PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_REMOVE)) {
00861                     //work on the Paint messages once more
00862                     ::TranslateMessage( &msg );
00863                     ::DispatchMessage( &msg );
00864                 }
00865             }
00866
00867 //1999-05-26 Yiannhs
00868
00869             ((CCJDockContext*)m_pDockContext)->StartDragDockBar(point);
00870         }
00871     }
00872
00873     // Yiannhs
00874     else {
00875         CControlBar::OnLButtonDown(nFlags, point);
00876     }
00877 }

void CCJControlBar::OnLButtonUp | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Reimplemented in CCJExplorerBar.

Definition at line 611 of file CJControlBar.cpp.

00612 {
00613     if( m_bDragging )
00614     {
00615         ReleaseCapture();
00616         OnInvertTracker(m_rcTrack);
00617 //1999-05-19 Yiannhs. Moved the statement below
00618         //m_bDragging = FALSE;
00619
00620         // Yiannhs: reduce unnessesary actions. Ok It works
00621  //1999-05-19 Yiannhs. Changed according to the statement above
00622         if( m_ptCurDrag == m_ptStartDrag ) {
00623             m_bDragging = FALSE;
00624             return;
00625         }
00626
00627         if(IsVertDocked()) {
00628             int newHeight = m_rcTrack.top-m_ptStartDrag.y;
00629             m_sizeDesired.cy += newHeight;
00630             m_sizeDesired.cy = m_sizeDesired.cy > GetMinExt() ? m_sizeDesired.cy : GetMinExt();
00631             // Yiannhs: there is a comment in the previous version for change. This is the Line
00632             // This is probably for sizing with many control bars in dock bar
00633             // m_sizeDesired.cy = m_sizeDesired.cy > rectAvail.Height() ? rectAvail.Height() : m_sizeDesired.cy;
00634
00635 //1999-05-19 Yiannhs. Assign unused sizes
00636             m_sizeVert = m_sizeDesired;
00637         }
00638
00639         else { //if (IsHorzDocked()) {  //1999-05-19. Floating control bars do not receive this message
00640
00641             int newWidth = m_rcTrack.left-m_ptStartDrag.x;
00642             m_sizeDesired.cx += newWidth;
00643             m_sizeDesired.cx = m_sizeDesired.cx > GetMinExt() ? m_sizeDesired.cx : GetMinExt();
00644             // Yiannhs: there is a comment in the previous version for change. This is the Line
00645             // This is probably for sizing with many control bars in dock bar
00646             // m_sizeDesired.cx = m_sizeDesired.cx > rectAvail.Width() ? rectAvail.Width() : m_sizeDesired.cx;
00647
00648 //1999-05-19 Yiannhs. Assign unused sizes
00649             m_sizeHorz = m_sizeDesired;
00650         }
00651
00652 //1999-05-19    Yiannhs
00653         //((CCJSizeDockBar *)GetParent())->CalcSizeBarLayout();
00654         //resizing a control bar, means, that the DockBar should be normalized.
00655         //and normalize does the layout
00656         m_sizeNormal = m_sizeDesired;       //set the new normal size here
00657         ((CCJSizeDockBar *)GetParent())->Normalize( this );
00658         m_bDragging = FALSE;        //flag off the drag action now. The movement has been complited
00659                                     //so as I can check it on change position
00660         CRect rc;                   // Now Use The Size of the control bar to fill the right sizes.
00661         GetWindowRect( rc );
00662         if( IsHorzDocked() )
00663             m_sizeNormal.cy = m_sizeHorz.cy = m_sizeDesired.cy = rc.Height();
00664         else
00665             m_sizeNormal.cx = m_sizeVert.cx = m_sizeDesired.cx = rc.Width();
00666 //1999-05-19    Yiannhs
00667
00668     }
00669
00670     else {
00671         // Yiannhs: again don't go to default handler if we have already handled the message
00672         CControlBar::OnLButtonUp(nFlags, point);
00673     }
00674 }

void CCJControlBar::OnMeasureItem | ( | int | nIDCtl,
 |  | LPMEASUREITEMSTRUCT | lpMeasureItemStruct
 | ) | [protected]

Definition at line 1337 of file CJControlBar.cpp.

01338 {
01339     if (lpMeasureItemStruct->CtlType == ODT_MENU)
01340     {
01341         if (IsMenu((HMENU)lpMeasureItemStruct->itemID)) {
01342             CMenu* pMenu = CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
01343
01344             if (m_popupMenu.IsMenu(pMenu)) {
01345                 m_popupMenu.MeasureItem(lpMeasureItemStruct);
01346                 return;
01347             }
01348         }
01349     }
01350
01351     CControlBar::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
01352 }

LRESULT CCJControlBar::OnMenuChar | ( | UINT | nChar,
 |  | UINT | nFlags,
 |  | CMenu * | pMenu
 | ) | [protected]

Definition at line 1354 of file CJControlBar.cpp.

01355 {
01356     if (m_popupMenu.IsMenu(pMenu)) {
01357         return CCJMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
01358     }
01359
01360     return CControlBar::OnMenuChar(nChar, nFlags, pMenu);
01361 }

void CCJControlBar::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 556 of file CJControlBar.cpp.

00557 {
00558     HitTest(point);
00559     CRect rectDock;
00560     if( m_bDragging )
00561     {
00562         ASSERT(GetParent() != NULL);
00563
00564         GetParent()->GetClientRect(&rectDock);
00565         ClientToScreen(&rectDock);
00566         ClientToScreen(&point);
00567
00568         CFrameWnd *pFrame=GetDockingFrame();
00569         ASSERT(pFrame != NULL);
00570
00571         pFrame -> ScreenToClient(&point);
00572         pFrame->ScreenToClient(&rectDock);
00573
00574         point.x = point.x>rectDock.right ? rectDock.right:point.x;
00575         point.x = point.x<rectDock.left ? rectDock.left:point.x;
00576         point.y = point.y>rectDock.bottom ? rectDock.bottom:point.y;
00577         point.y = point.y<rectDock.top ? rectDock.top:point.y;
00578
00579         OnInvertTracker(m_rcTrack);
00580         int deltaX = point.x-m_ptCurDrag.x;
00581         int deltaY = point.y-m_ptCurDrag.y;
00582
00583         if(IsVertDocked()) {
00584             m_rcTrack.top += deltaY;
00585             m_rcTrack.bottom += deltaY;
00586         }
00587
00588         else if (IsHorzDocked()) {
00589             m_rcTrack.left += deltaX;
00590             m_rcTrack.right += deltaX;
00591         }
00592
00593         OnInvertTracker(m_rcTrack);
00594         m_ptCurDrag = point;
00595     }
00596
00597     else {
00598         // Yiannhs: Do not let default handler go on, if we have worked with the message
00599         CControlBar::OnMouseMove(nFlags, point);
00600     }
00601 }

UINT CCJControlBar::OnNcHitTest ( CPoint point ) [protected]

Definition at line 676 of file CJControlBar.cpp.

00677 {
00678     return HTCLIENT;
00679 }

void CCJControlBar::OnNcPaint ( ) [protected]

Definition at line 500 of file CJControlBar.cpp.

00501 {
00502     EraseNonClient();
00503 }

void CCJControlBar::OnPaint ( ) [protected]

Definition at line 505 of file CJControlBar.cpp.

00506 {
00507     CPaintDC dc(this); // device context for painting
00508
00509     // Get the client rect.
00510     CRect rcClient;
00511     GetClientRect( &rcClient );
00512
00513     // Create a memory device-context. This is done to help reduce
00514     // screen flicker, since we will paint the entire control to the
00515     // off screen device context first.
00516     CDC memDC;
00517     CBitmap bitmap;
00518     memDC.CreateCompatibleDC(&dc);
00519     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00520     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00521
00522     // repaint the background.
00523     memDC.FillSolidRect( rcClient, afxData.clrBtnFace );
00524     DrawBorders(&memDC, rcClient);
00525
00526     // draw a border around the child area.
00527     if( m_eChildBorder != NONE )
00528     {
00529         CRect rect;
00530         GetChildRect(rect);
00531
00532         if( m_eChildBorder == OUTLINE ) {
00533             memDC.Draw3dRect(rect, afxData.clrWindowFrame, afxData.clrWindowFrame);
00534         } else if( m_eChildBorder == SUNKEN ) {
00535             rect.InflateRect(1,1);
00536             memDC.Draw3dRect(rect, afxData.clrBtnShadow, afxData.clrBtnHilite);
00537             rect.DeflateRect(1,1);
00538             memDC.Draw3dRect(rect, afxData.clrWindowFrame, afxData.clrBtnFace);
00539         } else if( m_eChildBorder == RAISED ) {
00540             rect.InflateRect(1,1);
00541             memDC.Draw3dRect(rect, afxData.clrBtnHilite, afxData.clrWindowFrame);
00542             rect.DeflateRect(1,1);
00543             memDC.Draw3dRect(rect, afxData.clrBtnFace, afxData.clrBtnShadow);
00544         }
00545     }
00546
00547     // copy the memory device context back into the original DC via BitBlt().
00548     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00549
00550     // cleanup resources.
00551     memDC.SelectObject(pOldBitmap);
00552     memDC.DeleteDC();
00553     bitmap.DeleteObject();
00554 }

void CCJControlBar::OnRButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 1292 of file CJControlBar.cpp.

01293 {
01294     // No menu was defined...
01295     if (!m_popupMenuID) {
01296         TRACE0( "Warning: No menu resource was associated with CCJControlBar.\n" );
01297     }
01298
01299     else
01300     {
01301         SetCapture();
01302
01303         // Since we are using the main window as the
01304         // parent, we need to convert the point to screen
01305         // coordinates...
01306         CPoint pt = point;
01307         ClientToScreen(&pt);
01308
01309         // Load the popup menu.
01310         VERIFY(m_popupMenu.LoadMenu(m_popupMenuID));
01311         CCJMenu* pPopup = (CCJMenu*)m_popupMenu.GetSubMenu(m_nPos);
01312         ASSERT(pPopup != NULL);
01313
01314         // Load toolbar resource if any for menu icons.
01315         if (m_popToolbarID) {
01316             pPopup->LoadToolbar(m_popToolbarID);
01317         }
01318
01319         //Yiannhs: When right clicking on a floating controlbar, the menu is inactive,
01320         //         this is due to the MiniFrame  apart from being a child is also
01321         //          a Frame Window. and only the main window handles the Bitmap menus
01322         //pWndPopupOwner = GetParentFrame();
01323         CWnd* pWndPopupOwner = GetParentFrame();    //this;
01324         if( IsFloating() )
01325             pWndPopupOwner = pWndPopupOwner->GetParentFrame();
01326
01327         // Display the popup menu, use the main window as its parent.
01328         pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
01329             pt.x, pt.y, pWndPopupOwner);
01330
01331         m_popupMenu.DestroyMenu();
01332
01333         ReleaseCapture();
01334     }
01335 }

BOOL CCJControlBar::OnSetCursor | ( | CWnd * | pWnd,
 |  | UINT | nHitTest,
 |  | UINT | message
 | ) | [protected]

Definition at line 603 of file CJControlBar.cpp.

00604 {
00605     return (!m_bOkToDrag && !m_bDragging)?
00606         CControlBar::OnSetCursor(pWnd, nHitTest, message):FALSE;
00607 }

void CCJControlBar::OnUpdateButtonClose ( CCmdUI * pCmdUI ) [protected]

Reimplemented in CCJExplorerBar.

Definition at line 884 of file CJControlBar.cpp.

00885 {
00886     pCmdUI->Enable();
00887 }

void CCJControlBar::OnUpdateButtonMinimize ( CCmdUI * pCmdUI ) [protected]

Definition at line 902 of file CJControlBar.cpp.

00903 {
00904     pCmdUI->Enable();
00905 }

void CCJControlBar::OnUpdateCmdUI | ( | CFrameWnd * | pTarget,
 |  | BOOL | bDisableIfNoHndler
 | ) | [virtual]

Definition at line 381 of file CJControlBar.cpp.

00382 {
00383     UNUSED_ALWAYS(pTarget);
00384     UNUSED_ALWAYS(bDisableIfNoHndler);
00385
00386     if((m_bButtons == FALSE) || IsFloating()) {
00387         return;
00388     }
00389
00390     BOOL            bEnable     = FALSE;
00391     UINT            uIDText     = NULL;
00392     BTN_IMG_INDEX   eAuxIndex   = m_eAuxIndex;
00393
00394     if (IsHorzDocked()) {
00395         if (m_bUnique) {
00396             uIDText   = IDS_EXPAND;
00397             eAuxIndex = MAXI_H_DISABLE;
00398             bEnable   = FALSE;
00399         } else if (!m_bMaximized) {
00400             uIDText   = IDS_EXPAND;
00401             eAuxIndex = MAXI_H_ENABLED;
00402             bEnable   = TRUE;
00403         } else {
00404             uIDText   = IDS_CONTRACT;
00405             eAuxIndex = NORM_H_ENABLED;
00406             bEnable   = TRUE;
00407         }
00408     } else {
00409         if (m_bUnique) {
00410             uIDText   = IDS_EXPAND;
00411             eAuxIndex = MAXI_V_DISABLE;
00412             bEnable   = FALSE;
00413         } else if (!m_bMaximized) {
00414             uIDText   = IDS_EXPAND;
00415             eAuxIndex = MAXI_V_ENABLED;
00416             bEnable   = TRUE;
00417         } else {
00418             uIDText   = IDS_CONTRACT;
00419             eAuxIndex = NORM_V_ENABLED;
00420             bEnable   = TRUE;
00421         }
00422     }
00423
00424     // we are only concerned if the image index has changed.
00425     if(eAuxIndex != m_eAuxIndex) {
00426         m_eAuxIndex = eAuxIndex;
00427
00428         // if the button is a valid window, set the new icon.
00429         if(m_btnMinim.GetSafeHwnd()) {
00430             // fix potential resource leak - KStowell - 10-22-99.
00431             _destroyIcon(m_hAuxIcon);
00432             m_hAuxIcon = m_ImageList.ExtractIcon((int)eAuxIndex);
00433             m_btnMinim.SetIcon(m_hAuxIcon, CSize(10,10));
00434             m_btnMinim.EnableWindow(bEnable);
00435
00436             // if the tooltip control is valid, update the tip text.
00437             if(m_ToolTip.GetSafeHwnd()) {
00438                 m_ToolTip.UpdateTipText(uIDText, &m_btnMinim);
00439             }
00440         }
00441     }
00442 }

void CCJControlBar::OnWindowPosChanged ( WINDOWPOS * lpwndpos ) [protected]

Reimplemented in CCJExplorerBar, and CCJTabCtrlBar.

Definition at line 731 of file CJControlBar.cpp.

Referenced by CCJTabCtrlBar::OnWindowPosChanged().

00732 {
00733     CControlBar::OnWindowPosChanged(lpwndpos);
00734
00735     if (m_bButtons)
00736     {
00737         if (IsFloating())
00738         {
00739             m_btnClose.ShowWindow(SW_HIDE);
00740             m_btnMinim.ShowWindow(SW_HIDE);
00741         }
00742
00743         else
00744         {
00745             m_btnClose.ShowWindow(SW_SHOW);
00746             m_btnMinim.ShowWindow(SW_SHOW);
00747
00748             CRect rcClose(GetButtonRect());
00749             CRect rcMinim(GetButtonRect());
00750
00751             if (IsHorzDocked()) {
00752                 rcMinim.OffsetRect(0,14);
00753             }
00754
00755             else {
00756                 rcClose.OffsetRect(14,0);
00757             }
00758
00759             m_btnClose.MoveWindow(rcClose);
00760             m_btnMinim.MoveWindow(rcMinim);
00761         }
00762     }
00763
00764     //1999-05-19 Yiannhs
00765     //Calculate Extra Size variables
00766     CSize sizeTemp( lpwndpos->cx, lpwndpos->cy );
00767
00768     // save the current size to the registry.
00769     if( m_bAutoSave ) {
00770         SaveBarState(sizeTemp);
00771     }
00772
00773     if( IsFloating() ) {
00774         m_sizeFloat = sizeTemp;
00775     }
00776
00777     else if( !m_bDragging )
00778     {
00779         if( IsHorzDocked() ) {
00780             m_sizeHorz = sizeTemp;
00781         } else {
00782             m_sizeVert = sizeTemp;
00783         }
00784     }
00785
00786     if( m_pChildWnd->GetSafeHwnd( )) {
00787         CRect rc;
00788         GetChildRect(rc);
00789         rc.DeflateRect(1,1);
00790         m_pChildWnd->MoveWindow(rc);
00791     }
00792 }

BOOL CCJControlBar::PreTranslateMessage ( MSG * pMsg ) [virtual]

Reimplemented in CCJTabCtrlBar.

Definition at line 372 of file CJControlBar.cpp.

Referenced by CCJTabCtrlBar::PreTranslateMessage().

00373 {
00374     // *** GK/ISC
00375     if (m_bButtons && m_ToolTip.GetSafeHwnd()) {
00376         m_ToolTip.RelayEvent(pMsg);
00377     }
00378     return CControlBar::PreTranslateMessage(pMsg);
00379 }

void CCJControlBar::SaveBarState ( CSize & size ) [protected, virtual]

Definition at line 1374 of file CJControlBar.cpp.

Referenced by OnWindowPosChanged().

01375 {
01376     int nIndex = 0;
01377     CWinApp* pApp = AfxGetApp();
01378
01379     // attempt to loop through all of the defaults stored in the
01380     // system until we find our control id.
01381     while( TRUE )
01382     {
01383         // start at 0 and search for a match to our control bars
01384         // resource id. If one was not found, return.
01385         m_strSection.Format(_T("Bar State-Bar%d"), nIndex);
01386         int nBarID = pApp->GetProfileInt( m_strSection, _T("BarID"), -1 );
01387
01388         // couldn't find a match, just bail...
01389         if( nBarID == -1 ) {
01390             TRACE1( "Warning: Could not find registry information for control bar ID %d\n", m_nID );
01391             return;
01392         }
01393
01394         // we have a match, read the information that was stored, and
01395         // update the cx and cy variables passed in.
01396         if( nBarID == m_nID )
01397         {
01398             if(IsHorzDocked()) {
01399                 size.cy += TRACK_BORDER_SIZE+2;
01400             } else {
01401                 size.cx += TRACK_BORDER_SIZE;
01402             }
01403             //m_strSection += _T("\\CodeJock"); //JK - removed to fix the Bar savings, replaced by the code below... The fix taken from CodeJock Website Discussion board
01404             m_strSection.Format ( _T("CodeJock Bar State-Bar%d"), nIndex ); //JK
01405
01406             // Write the BarID here in case it needs to be matched up in later revisions    //JK
01407             pApp->WriteProfileInt( m_strSection, _T("BarID"), m_nID );  //JK
01408
01409             pApp->WriteProfileInt( m_strSection, _T("MRUDesiredCX"), size.cx );
01410             pApp->WriteProfileInt( m_strSection, _T("MRUDesiredCY"), size.cy );
01411             pApp->WriteProfileInt( m_strSection, _T("MRUFloating" ), IsFloating() );
01412             return;
01413         }
01414
01415         // increment count.
01416         ++nIndex;
01417     }
01418 }

_CJXLIB_INLINE void CCJControlBar::SetChild ( CWnd * pWnd ) [protected, virtual]

Definition at line 578 of file CJControlBar.h.

Referenced by CCJTabCtrlBar::OnCreate().

00579     { ASSERT(::IsWindow(m_hWnd)); m_pChildWnd=pWnd; }

_CJXLIB_INLINE void CCJControlBar::SetMenuID | ( | UINT | popupMenuID,
 |  | UINT | popToolbarID = 0,
 |  | int | nPos = 0
 | ) | [virtual]

Definition at line 548 of file CJControlBar.h.

00549     { ASSERT(::IsWindow(m_hWnd)); m_popupMenuID=popupMenuID; m_popToolbarID=popToolbarID; m_nPos=nPos; }

_CJXLIB_INLINE void CCJControlBar::SetNormalSize ( const CSize & cs ) [virtual]

Definition at line 554 of file CJControlBar.h.

00555     { ASSERT(::IsWindow(m_hWnd)); m_sizeDesired=m_sizeNormal=cs; }

_CJXLIB_INLINE void CCJControlBar::ShowFrameControls | ( | BOOL | bGripper = TRUE,
 |  | BOOL | bButtons = TRUE
 | ) | [virtual]

Definition at line 551 of file CJControlBar.h.

00552     { ASSERT(::IsWindow(m_hWnd)); m_bGripper=bGripper; m_bButtons=bButtons; }

Member Data Documentation

CImageList CCJControlBar::m_ImageList [protected]

Definition at line 278 of file CJControlBar.h.

CToolTipCtrl CCJControlBar::m_ToolTip [protected]

Definition at line 281 of file CJControlBar.h.

bool CCJControlBar::m_bAutoSave [protected]

Definition at line 291 of file CJControlBar.h.

BOOL CCJControlBar::m_bButtons [protected]

Definition at line 262 of file CJControlBar.h.

BOOL CCJControlBar::m_bDragging [protected]

Definition at line 258 of file CJControlBar.h.

BOOL CCJControlBar::m_bFlatBorder [protected]

Definition at line 288 of file CJControlBar.h.

BOOL CCJControlBar::m_bFlatGripper [protected]

Definition at line 286 of file CJControlBar.h.

BOOL CCJControlBar::m_bFloating [protected]

Definition at line 295 of file CJControlBar.h.

BOOL CCJControlBar::m_bGripper [protected]

Definition at line 283 of file CJControlBar.h.

BOOL CCJControlBar::m_bMaximized [protected]

Definition at line 255 of file CJControlBar.h.

BOOL CCJControlBar::m_bOkToDrag [protected]

Definition at line 252 of file CJControlBar.h.

BOOL CCJControlBar::m_bToFit

Definition at line 227 of file CJControlBar.h.

Referenced by CCJSizeDockBar::CalcSizeBarLayout().

BOOL CCJControlBar::m_bUnique

Definition at line 223 of file CJControlBar.h.

Referenced by CCJSizeDockBar::CalcSizeBarLayout().

CCJCBarButton CCJControlBar::m_btnClose [protected]

Definition at line 279 of file CJControlBar.h.

CCJCBarButton CCJControlBar::m_btnMinim [protected]

Definition at line 280 of file CJControlBar.h.

int CCJControlBar::m_cxOffset [protected]

Definition at line 235 of file CJControlBar.h.

int CCJControlBar::m_cyOffset [protected]

Definition at line 238 of file CJControlBar.h.

BTN_IMG_INDEX CCJControlBar::m_eAuxIndex [protected]

Definition at line 241 of file CJControlBar.h.

CHILD_BORDER CCJControlBar::m_eChildBorder

Definition at line 231 of file CJControlBar.h.

HICON CCJControlBar::m_hAuxIcon [protected]

Definition at line 293 of file CJControlBar.h.

HICON CCJControlBar::m_hIcon [protected]

Reimplemented in CCJExplorerBar.

Definition at line 292 of file CJControlBar.h.

int CCJControlBar::m_nID [protected]

Definition at line 294 of file CJControlBar.h.

int CCJControlBar::m_nPos [protected]

Definition at line 250 of file CJControlBar.h.

CWnd* CCJControlBar::m_pChildWnd [protected]

Definition at line 274 of file CJControlBar.h.

UINT CCJControlBar::m_popToolbarID [protected]

Definition at line 245 of file CJControlBar.h.

CCJMenu CCJControlBar::m_popupMenu [protected]

Definition at line 249 of file CJControlBar.h.

UINT CCJControlBar::m_popupMenuID [protected]

Definition at line 248 of file CJControlBar.h.

CPoint CCJControlBar::m_ptCurDrag [protected]

Definition at line 271 of file CJControlBar.h.

CPoint CCJControlBar::m_ptStartDrag [protected]

Definition at line 272 of file CJControlBar.h.

CRect CCJControlBar::m_rcTrack [protected]

Definition at line 265 of file CJControlBar.h.

CSize CCJControlBar::m_sizeDesired [protected]

Definition at line 266 of file CJControlBar.h.

CSize CCJControlBar::m_sizeFloat [protected]

Definition at line 270 of file CJControlBar.h.

CSize CCJControlBar::m_sizeHorz [protected]

Definition at line 269 of file CJControlBar.h.

CSize CCJControlBar::m_sizeNormal [protected]

Definition at line 267 of file CJControlBar.h.

CSize CCJControlBar::m_sizeVert [protected]

Definition at line 268 of file CJControlBar.h.

CString CCJControlBar::m_strSection [protected]

Definition at line 290 of file CJControlBar.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJControlBar.h
  • WinCvs/CJLib/CJLibrary/CJControlBar.cpp
Generated on Sun Oct 21 12:46:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJDateEdit Class Reference

#include <CJMaskEdit.h>

Inheritance diagram for CCJDateEdit:

[legend]
Collaboration diagram for CCJDateEdit:

[legend]
List of all members.

Public Methods

CCJDateEdit ()
virtual void | SetDateTime (COleDateTime &dt)
virtual void | SetDateTime (CString strDate)
virtual COleDateTime | GetDateTime ()
virtual CString | GetWindowDateTime ()
virtual COleDateTime | ReadOleDateTime (LPCTSTR lpszData)
virtual bool | ProcessMask (UINT nChar, int nEndPos)
virtual void | FormatOleDateTime (CString &strData, COleDateTime dt)

Constructor & Destructor Documentation

CCJDateEdit::CCJDateEdit ( )

Definition at line 408 of file CJMaskEdit.cpp.

00409 {
00410     m_bUseMask      = true;
00411     m_strMask       = _T("00/00/0000");
00412     m_strLiteral    = _T("__/__/____");
00413 }

Member Function Documentation

void CCJDateEdit::FormatOleDateTime | ( | CString & | strData,
 |  | COleDateTime | dt
 | ) | [virtual]

Reimplemented in CCJTimeEdit.

Definition at line 422 of file CJMaskEdit.cpp.

Referenced by SetDateTime().

00423 {
00424     strData = dt.Format( _T("%d/%m/%Y"));
00425 }

COleDateTime CCJDateEdit::GetDateTime ( ) [virtual]

Definition at line 441 of file CJMaskEdit.cpp.

Referenced by DDX_OleDateTime().

00442 {
00443     CString strText;
00444     GetWindowText(strText);
00445     return ReadOleDateTime(strText);
00446 }

CString CCJDateEdit::GetWindowDateTime ( ) [virtual]

Definition at line 448 of file CJMaskEdit.cpp.

00449 {
00450     CString strText;
00451     GetWindowText(strText);
00452     return strText;
00453 }

bool CCJDateEdit::ProcessMask | ( | UINT | nChar,
 |  | int | nEndPos
 | ) | [virtual]

Reimplemented from CCJMaskEdit.

Reimplemented in CCJTimeEdit.

Definition at line 455 of file CJMaskEdit.cpp.

00456 {
00457     // check the key against the mask
00458     switch( m_strMask.GetAt( nEndPos ))
00459     {
00460     case '0':       // digit only //completely changed this
00461         {
00462             bool bReturn = true;
00463
00464             if( isdigit( nChar ))
00465             {
00466                 if( nEndPos == 0 )
00467                 {
00468                     if( nChar > '3' ) {
00469                         bReturn = false;
00470                     }
00471                 }
00472                 else if( nEndPos == 1 )
00473                 {
00474                     if( m_strWindowText.GetAt(0) == '3' )
00475                     {
00476                         if( nChar > '1' ) {
00477                             bReturn = false;
00478                         }
00479                     }
00480                 }
00481                 else if( nEndPos == 3 )
00482                 {
00483                     if( nChar > '1' ) {
00484                         bReturn = false;
00485                     }
00486                 }
00487                 else if( nEndPos == 4 )
00488                 {
00489                     if( m_strWindowText.GetAt(3) == '1' )
00490                     {
00491                         if( nChar > '2') {
00492                             bReturn = false;
00493                         }
00494                     }
00495                 }
00496                 return bReturn;
00497             }
00498             break;
00499         }
00500     }
00501
00502     MessageBeep((UINT)-1);
00503     return false;
00504 }

COleDateTime CCJDateEdit::ReadOleDateTime ( LPCTSTR lpszData ) [virtual]

Definition at line 415 of file CJMaskEdit.cpp.

Referenced by GetDateTime().

00416 {
00417     COleDateTime dt;
00418     dt.ParseDateTime(lpszData);
00419     return dt;
00420 }

void CCJDateEdit::SetDateTime ( CString strDate ) [virtual]

Definition at line 435 of file CJMaskEdit.cpp.

00436 {
00437     m_strWindowText = m_strMaskLiteral = strDate;
00438     SetWindowText(strDate);
00439 }

void CCJDateEdit::SetDateTime ( COleDateTime & dt ) [virtual]

Definition at line 427 of file CJMaskEdit.cpp.

Referenced by DDX_OleDateTime().

00428 {
00429     CString strText;
00430     FormatOleDateTime(strText, dt);
00431     m_strWindowText = m_strMaskLiteral = strText;
00432     SetWindowText(strText);
00433 }

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMaskEdit.h
  • WinCvs/CJLib/CJLibrary/CJMaskEdit.cpp
Generated on Sun Oct 21 12:46:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJDateTimeCtrl Class Reference

#include <CJDateTimeCtrl.h>

Inheritance diagram for CCJDateTimeCtrl:

[legend]
Collaboration diagram for CCJDateTimeCtrl:

[legend]
List of all members.

Public Methods

CCJDateTimeCtrl ()
virtual | ~CCJDateTimeCtrl ()
BOOL | Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
COLORREF | GetMonthCalColor (int iColor) const
COLORREF | SetMonthCalColor (int iColor, COLORREF ref)
BOOL | SetFormat (LPCTSTR pstrFormat)
CCJMonthCalCtrl * | GetMonthCalCtrl () const
CFont * | GetMonthCalFont () const
void | SetMonthCalFont (HFONT hFont, BOOL bRedraw=TRUE)
BOOL | SetRange (const COleDateTime *pMinRange, const COleDateTime *pMaxRange)
BOOL | SetRange (const CTime *pMinRange, const CTime *pMaxRange)
DWORD | GetRange (COleDateTime *pMinRange, COleDateTime *pMaxRange) const
DWORD | GetRange (CTime *pMinRange, CTime *pMaxRange) const
BOOL | SetTime (const CTime *pTimeNew)
BOOL | SetTime (const COleDateTime &timeNew)
BOOL | SetTime (LPSYSTEMTIME pTimeNew=NULL)
DWORD | GetTime (CTime &timeDest) const
BOOL | GetTime (COleDateTime &timeDest) const
DWORD | GetTime (LPSYSTEMTIME pTimeDest) const

Constructor & Destructor Documentation

_CJXLIB_INLINE CCJDateTimeCtrl::CCJDateTimeCtrl ( )

Definition at line 763 of file CJDateTimeCtrl.h.

00764     { }

CCJDateTimeCtrl::~CCJDateTimeCtrl ( ) [virtual]

Definition at line 443 of file CJDateTimeCtrl.cpp.

00444 {
00445     DestroyWindow();
00446 }

Member Function Documentation

BOOL CCJDateTimeCtrl::Create | ( | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID
 | ) |

Definition at line 250 of file CJDateTimeCtrl.cpp.

00252 {
00253    // initialize common controls
00254 #ifdef _VC_VERSION_5
00255     INITCOMMONCONTROLSEX icex;
00256     icex.dwSize = sizeof(icex);
00257     icex.dwICC = ICC_DATE_CLASSES;
00258     VERIFY(InitCommonControlsEx(&icex));
00259 #else
00260     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_DATE_REG));
00261 #endif
00262
00263     CWnd* pWnd = this;
00264     return pWnd->Create(DATETIMEPICK_CLASS, NULL, dwStyle, rect, pParentWnd, nID);
00265 }

_CJXLIB_INLINE COLORREF CCJDateTimeCtrl::GetMonthCalColor ( int iColor ) const

Definition at line 775 of file CJDateTimeCtrl.h.

00776     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, DTM_GETMCCOLOR, (WPARAM) iColor, 0); }

_CJXLIB_INLINE CCJMonthCalCtrl * CCJDateTimeCtrl::GetMonthCalCtrl ( ) const

Definition at line 767 of file CJDateTimeCtrl.h.

00768     { ASSERT(::IsWindow(m_hWnd)); return (CCJMonthCalCtrl*) CWnd::FromHandle((HWND) ::SendMessage(m_hWnd, DTM_GETMONTHCAL, 0, 0)); }

_CJXLIB_INLINE CFont * CCJDateTimeCtrl::GetMonthCalFont ( ) const

Definition at line 765 of file CJDateTimeCtrl.h.

00766     { ASSERT(::IsWindow(m_hWnd)); return CFont::FromHandle((HFONT) ::SendMessage(m_hWnd, DTM_GETMCFONT, 0, 0)); }

DWORD CCJDateTimeCtrl::GetRange | ( | CTime * | pMinTime,
 |  | CTime * | pMaxTime
 | ) | const

Definition at line 267 of file CJDateTimeCtrl.cpp.

00268 {
00269     ASSERT(::IsWindow(m_hWnd));
00270     SYSTEMTIME sysTimes[2];
00271     memset(sysTimes, 0, sizeof(sysTimes));
00272
00273     DWORD dwResult = ::SendMessage(m_hWnd, DTM_GETRANGE, 0, (LPARAM) &sysTimes);
00274
00275     if (pMinTime != NULL)
00276     {
00277         if (dwResult & GDTR_MIN)
00278             *pMinTime = CTime(sysTimes[0]);
00279     }
00280
00281     if (pMaxTime != NULL)
00282     {
00283         if (dwResult & GDTR_MAX)
00284             *pMaxTime = CTime(sysTimes[1]);
00285     }
00286
00287     return dwResult;
00288
00289 }

DWORD CCJDateTimeCtrl::GetRange | ( | COleDateTime * | pMinTime,
 |  | COleDateTime * | pMaxTime
 | ) | const

Definition at line 291 of file CJDateTimeCtrl.cpp.

00293 {
00294     ASSERT(::IsWindow(m_hWnd));
00295
00296     SYSTEMTIME sysTimes[2];
00297     memset(sysTimes, 0, sizeof(sysTimes));
00298
00299     DWORD dwResult = ::SendMessage(m_hWnd, DTM_GETRANGE, 0, (LPARAM) &sysTimes);
00300     if (pMinTime != NULL)
00301     {
00302         if (dwResult & GDTR_MIN)
00303             *pMinTime = COleDateTime(sysTimes[0]);
00304         else
00305             pMinTime->SetStatus(COleDateTime::null);
00306     }
00307
00308     if (pMaxTime != NULL)
00309     {
00310         if (dwResult & GDTR_MAX)
00311             *pMaxTime = COleDateTime(sysTimes[1]);
00312         else
00313             pMaxTime->SetStatus(COleDateTime::null);
00314     }
00315
00316     return dwResult;
00317 }

_CJXLIB_INLINE DWORD CCJDateTimeCtrl::GetTime ( LPSYSTEMTIME pTimeDest ) const

Definition at line 773 of file CJDateTimeCtrl.h.

00774     { ASSERT(::IsWindow(m_hWnd)); ASSERT(pTimeDest != NULL); return (DWORD) ::SendMessage(m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM) pTimeDest); }

BOOL CCJDateTimeCtrl::GetTime ( COleDateTime & timeDest ) const

Definition at line 409 of file CJDateTimeCtrl.cpp.

00410 {
00411     SYSTEMTIME sysTime;
00412     BOOL bRetVal = TRUE;
00413
00414     LRESULT result = ::SendMessage(m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM) &sysTime);
00415     if (result == GDT_VALID)
00416     {
00417         timeDest = COleDateTime(sysTime);
00418         bRetVal = TRUE;
00419         ASSERT(timeDest.GetStatus() == COleDateTime::valid);
00420     }
00421     else if (result == GDT_NONE)
00422     {
00423         timeDest.SetStatus(COleDateTime::null);
00424         bRetVal = TRUE;
00425     }
00426     else
00427         timeDest.SetStatus(COleDateTime::invalid);
00428     return bRetVal;
00429 }

DWORD CCJDateTimeCtrl::GetTime ( CTime & timeDest ) const

Definition at line 431 of file CJDateTimeCtrl.cpp.

Referenced by DDX_CJDateTimeCtrl().

00432 {
00433     SYSTEMTIME sysTime;
00434     DWORD dwResult = (DWORD)
00435         ::SendMessage(m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM) &sysTime);
00436
00437     if (dwResult == GDT_VALID)
00438         timeDest = CTime(sysTime);
00439
00440     return dwResult;
00441 }

_CJXLIB_INLINE BOOL CCJDateTimeCtrl::SetFormat ( LPCTSTR pstrFormat )

Definition at line 777 of file CJDateTimeCtrl.h.

00778     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, DTM_SETFORMAT, 0, (LPARAM) pstrFormat); }

_CJXLIB_INLINE COLORREF CCJDateTimeCtrl::SetMonthCalColor | ( | int | iColor,
 |  | COLORREF | ref
 | ) |

Definition at line 771 of file CJDateTimeCtrl.h.

00772     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, DTM_SETMCCOLOR, (WPARAM) iColor, (LPARAM) ref); }

_CJXLIB_INLINE void CCJDateTimeCtrl::SetMonthCalFont | ( | HFONT | hFont,
 |  | BOOL | bRedraw = TRUE
 | ) |

Definition at line 769 of file CJDateTimeCtrl.h.

00770     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, DTM_SETMCFONT, (WPARAM) hFont, MAKELONG(bRedraw, 0)); }

BOOL CCJDateTimeCtrl::SetRange | ( | const CTime * | pMinTime,
 |  | const CTime * | pMaxTime
 | ) |

Definition at line 319 of file CJDateTimeCtrl.cpp.

00320 {
00321     ASSERT(::IsWindow(m_hWnd));
00322
00323     SYSTEMTIME sysTimes[2];
00324
00325     WPARAM wFlags = 0;
00326     if (pMinTime != NULL && GetAsSystemTime(pMinTime, sysTimes[0]))
00327         wFlags |= GDTR_MIN;
00328
00329     if (pMaxTime != NULL && GetAsSystemTime(pMaxTime, sysTimes[1]))
00330         wFlags |= GDTR_MAX;
00331
00332     return (BOOL) ::SendMessage(m_hWnd, DTM_SETRANGE, wFlags, (LPARAM) &sysTimes);
00333 }

BOOL CCJDateTimeCtrl::SetRange | ( | const COleDateTime * | pMinTime,
 |  | const COleDateTime * | pMaxTime
 | ) |

Definition at line 335 of file CJDateTimeCtrl.cpp.

Referenced by DDV_CJMinMaxDateTime().

00336 {
00337     ASSERT(::IsWindow(m_hWnd));
00338     ASSERT(pMinTime == NULL || pMinTime->GetStatus() != COleDateTime::invalid);
00339     ASSERT(pMaxTime == NULL || pMaxTime->GetStatus() != COleDateTime::invalid);
00340
00341     SYSTEMTIME sysTime[2];
00342
00343     WPARAM wFlags = 0;
00344     if (pMinTime != NULL && pMinTime->GetStatus() != COleDateTime::null)
00345     {
00346         if (GetAsSystemTime(pMinTime, sysTime[0]))
00347             wFlags |= GDTR_MIN;
00348     }
00349
00350     if (pMaxTime != NULL && pMaxTime->GetStatus() != COleDateTime::null)
00351     {
00352         if (GetAsSystemTime(pMaxTime, sysTime[1]))
00353             wFlags |= GDTR_MAX;
00354     }
00355
00356     return (BOOL) ::SendMessage(m_hWnd, DTM_SETRANGE, wFlags, (LPARAM) &sysTime);
00357 }

BOOL CCJDateTimeCtrl::SetTime ( LPSYSTEMTIME pTimeNew = NULL )

Definition at line 359 of file CJDateTimeCtrl.cpp.

00360 {
00361     ASSERT(::IsWindow(m_hWnd));
00362     WPARAM wParam = (pTimeNew == NULL) ? GDT_NONE : GDT_VALID;
00363     return (BOOL) ::SendMessage(m_hWnd, DTM_SETSYSTEMTIME,
00364         wParam, (LPARAM) pTimeNew);
00365 }

BOOL CCJDateTimeCtrl::SetTime ( const COleDateTime & timeNew )

Definition at line 367 of file CJDateTimeCtrl.cpp.

00368 {
00369     BOOL bRetVal = FALSE;
00370
00371     // make sure the time isn't invalid
00372     ASSERT(timeNew.GetStatus() != COleDateTime::invalid);
00373     ASSERT(::IsWindow(m_hWnd));
00374
00375     SYSTEMTIME sysTime;
00376     WPARAM wParam = GDT_NONE;
00377     if (timeNew.GetStatus() == COleDateTime::valid &&
00378         GetAsSystemTime(timeNew, sysTime))
00379     {
00380         wParam = GDT_VALID;
00381     }
00382
00383     bRetVal = (BOOL) ::SendMessage(m_hWnd,
00384             DTM_SETSYSTEMTIME, wParam, (LPARAM) &sysTime);
00385
00386     return bRetVal;
00387 }

BOOL CCJDateTimeCtrl::SetTime ( const CTime * pTimeNew )

Definition at line 389 of file CJDateTimeCtrl.cpp.

Referenced by DDX_CJDateTimeCtrl().

00390 {
00391     BOOL bRetVal = FALSE;
00392
00393     // make sure the time isn't invalid
00394     ASSERT(::IsWindow(m_hWnd));
00395
00396     SYSTEMTIME sysTime;
00397     WPARAM wParam = GDT_NONE;
00398     if (pTimeNew != NULL && GetAsSystemTime(pTimeNew, sysTime))
00399     {
00400         wParam = GDT_VALID;
00401     }
00402
00403     bRetVal = (BOOL) ::SendMessage(m_hWnd,
00404             DTM_SETSYSTEMTIME, wParam, (LPARAM) &sysTime);
00405
00406     return bRetVal;
00407 }

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJDateTimeCtrl.h
  • WinCvs/CJLib/CJLibrary/CJDateTimeCtrl.cpp
Generated on Sun Oct 21 12:46:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJDockBar Class Reference

#include <CJDockBar.h>

Inheritance diagram for CCJDockBar:

[legend]
Collaboration diagram for CCJDockBar:

[legend]
List of all members.

Public Methods

CCJDockBar ()
virtual | ~CCJDockBar ()
virtual CSize | CalcFixedLayout (BOOL bStretch, BOOL bHorz)

Constructor & Destructor Documentation

CCJDockBar::CCJDockBar ( )

Definition at line 57 of file CJDockBar.cpp.

00058 {
00059     // TODO: add construction code here.
00060 }

CCJDockBar::~CCJDockBar ( ) [virtual]

Definition at line 62 of file CJDockBar.cpp.

00063 {
00064     // TODO: add destruction code here.
00065 }

Member Function Documentation

CSize CCJDockBar::CalcFixedLayout | ( | BOOL | bStretch,
 |  | BOOL | bHorz
 | ) | [virtual]

Definition at line 79 of file CJDockBar.cpp.

00080 {
00081     ASSERT_VALID(this);
00082
00083     CSize sizeFixed = CControlBar::CalcFixedLayout(bStretch, bHorz);
00084
00085     // get max size
00086     CSize sizeMax;
00087     if (!m_rectLayout.IsRectEmpty())
00088         sizeMax = m_rectLayout.Size();
00089     else
00090     {
00091         CRect rectFrame;
00092         CFrameWnd* pFrame = GetParentFrame();
00093         pFrame->GetClientRect(&rectFrame);
00094         sizeMax = rectFrame.Size();
00095     }
00096
00097     const int NormalcxBorder2=GetSystemMetrics(SM_CYBORDER)*2;
00098     const int NormalcyBorder2=2;
00099     const int AltcxBorder2=0;
00100     const int AltcyBorder2=0;
00101     int cxBorder2=0;
00102     int cyBorder2=0;
00103
00104     // prepare for layout
00105     AFX_SIZEPARENTPARAMS layout;
00106     layout.hDWP = m_bLayoutQuery ?
00107         NULL : ::BeginDeferWindowPos(m_arrBars.GetSize());
00108     CPoint pt(-cxBorder2, -NormalcyBorder2);
00109     int nWidth = 0;
00110
00111     BOOL bWrapped = FALSE;
00112
00113     // layout all the control bars
00114     for (int nPos = 0; nPos < m_arrBars.GetSize(); nPos++)
00115     {
00116         CControlBar* pBar = GetDockedControlBar(nPos);
00117         void* pVoid = m_arrBars[nPos];
00118
00119         if (pBar != NULL)
00120         {
00121             if (pBar->IsVisible())
00122             {
00123                 if(pBar->IsKindOf(RUNTIME_CLASS(CCJToolBar)))
00124                 {
00125                     cxBorder2=AltcxBorder2;
00126                     cyBorder2=AltcyBorder2;
00127                 }
00128                 else
00129                 {
00130                     cxBorder2=NormalcxBorder2;
00131                     cyBorder2=NormalcyBorder2;
00132                 }
00133                 // get ideal rect for bar
00134                 DWORD dwMode = 0;
00135                 if ((pBar->m_dwStyle & CBRS_SIZE_DYNAMIC) &&
00136                     (pBar->m_dwStyle & CBRS_FLOATING))
00137                     dwMode |= LM_HORZ | LM_MRUWIDTH;
00138                 else if (pBar->m_dwStyle & CBRS_ORIENT_HORZ)
00139                     dwMode |= LM_HORZ | LM_HORZDOCK;
00140                 else
00141                     dwMode |=  LM_VERTDOCK;
00142
00143                 CSize sizeBar = pBar->CalcDynamicLayout(-1, dwMode);
00144
00145                 CRect rect(pt, sizeBar);
00146
00147                 // get current rect for bar
00148                 CRect rectBar;
00149                 pBar->GetWindowRect(&rectBar);
00150                 ScreenToClient(&rectBar);
00151
00152                 if (bHorz)
00153                 {
00154                     // Offset Calculated Rect out to Actual
00155                     if (rectBar.left > rect.left && !m_bFloating)
00156                         rect.OffsetRect(rectBar.left - rect.left, 0);
00157
00158                     // If ControlBar goes off the right, then right justify
00159                     if (rect.right > sizeMax.cx && !m_bFloating)
00160                     {
00161                         int x = rect.Width() - cxBorder2;
00162                         x = max(sizeMax.cx - x, pt.x);
00163                         rect.OffsetRect(x - rect.left, 0);
00164                     }
00165
00166                     // If ControlBar has been wrapped, then left justify
00167                     if (bWrapped)
00168                     {
00169                         bWrapped = FALSE;
00170                         rect.OffsetRect(-(rect.left + cxBorder2), 0);
00171                     }
00172                     // If ControlBar is completely invisible, then wrap it
00173                     else if ((rect.left >= (sizeMax.cx - cxBorder2)) &&
00174                         (nPos > 0) && (m_arrBars[nPos - 1] != NULL))
00175                     {
00176                         m_arrBars.InsertAt(nPos, (CObject*)NULL);
00177                         pBar = NULL; pVoid = NULL;
00178                         bWrapped = TRUE;
00179                     }
00180                     if (!bWrapped)
00181                     {
00182                         if (rect != rectBar)
00183                         {
00184                             if (!m_bLayoutQuery &&
00185                                 !(pBar->m_dwStyle & CBRS_FLOATING))
00186                             {
00187                                 pBar->m_pDockContext->m_rectMRUDockPos = rect;
00188                             }
00189                             AfxRepositionWindow(&layout, pBar->m_hWnd, &rect);
00190                         }
00191                         pt.x = rect.left + sizeBar.cx - cxBorder2;
00192                         nWidth = max(nWidth, sizeBar.cy);
00193                     }
00194                 }
00195                 else
00196                 {
00197                     // Offset Calculated Rect out to Actual
00198                     if (rectBar.top > rect.top && !m_bFloating)
00199                         rect.OffsetRect(0, rectBar.top - rect.top);
00200
00201                     // If ControlBar goes off the bottom, then bottom justify
00202                     if (rect.bottom > sizeMax.cy && !m_bFloating)
00203                     {
00204                         int y = rect.Height() - cyBorder2;
00205                         y = max(sizeMax.cy - y, pt.y);
00206                         rect.OffsetRect(0, y - rect.top);
00207                     }
00208
00209                     // If ControlBar has been wrapped, then top justify
00210                     if (bWrapped)
00211                     {
00212                         bWrapped = FALSE;
00213                         rect.OffsetRect(0, -(rect.top + cyBorder2));
00214                     }
00215                     // If ControlBar is completely invisible, then wrap it
00216                     else if ((rect.top >= (sizeMax.cy - cyBorder2)) &&
00217                         (nPos > 0) && (m_arrBars[nPos - 1] != NULL))
00218                     {
00219                         m_arrBars.InsertAt(nPos, (CObject*)NULL);
00220                         pBar = NULL; pVoid = NULL;
00221                         bWrapped = TRUE;
00222                     }
00223                     if (!bWrapped)
00224                     {
00225                         if (rect != rectBar)
00226                         {
00227                             if (!m_bLayoutQuery &&
00228                                 !(pBar->m_dwStyle & CBRS_FLOATING))
00229                             {
00230                                 pBar->m_pDockContext->m_rectMRUDockPos = rect;
00231                             }
00232                             AfxRepositionWindow(&layout, pBar->m_hWnd, &rect);
00233                         }
00234                         pt.y = rect.top + sizeBar.cy - cyBorder2;
00235                         nWidth = max(nWidth, sizeBar.cx);
00236                     }
00237                 }
00238             }
00239             if (!bWrapped)
00240             {
00241                 // handle any delay/show hide for the bar
00242                 pBar->RecalcDelayShow(&layout);
00243             }
00244         }
00245         if (pBar == NULL && pVoid == NULL && nWidth != 0)
00246         {
00247             // end of row because pBar == NULL
00248             if (bHorz)
00249             {
00250                 pt.y += nWidth - cyBorder2;
00251                 sizeFixed.cx = max(sizeFixed.cx, pt.x);
00252                 sizeFixed.cy = max(sizeFixed.cy, pt.y);
00253                 pt.x = -cxBorder2;
00254             }
00255             else
00256             {
00257                 pt.x += nWidth - cxBorder2;
00258                 sizeFixed.cx = max(sizeFixed.cx, pt.x);
00259                 sizeFixed.cy = max(sizeFixed.cy, pt.y);
00260                 pt.y = -cyBorder2;
00261             }
00262             nWidth = 0;
00263         }
00264     }
00265     if (!m_bLayoutQuery)
00266     {
00267         // move and resize all the windows at once!
00268         if (layout.hDWP == NULL || !::EndDeferWindowPos(layout.hDWP))
00269             TRACE0("Warning: DeferWindowPos failed - low system resources.\n");
00270     }
00271
00272     // adjust size for borders on the dock bar itself
00273     CRect rect;
00274     rect.SetRectEmpty();
00275     CalcInsideRect(rect, bHorz);
00276
00277     if ((!bStretch || !bHorz) && sizeFixed.cx != 0)
00278         sizeFixed.cx += -rect.right + rect.left;
00279     if ((!bStretch || bHorz) && sizeFixed.cy != 0)
00280         sizeFixed.cy += -rect.bottom + rect.top;
00281
00282     return sizeFixed;
00283 }

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJDockBar.h
  • WinCvs/CJLib/CJLibrary/CJDockBar.cpp
Generated on Sun Oct 21 12:46:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJDockContext Class Reference

#include <CJDockContext.h>

Inheritance diagram for CCJDockContext:

[legend]
Collaboration diagram for CCJDockContext:

[legend]
List of all members.

Public Methods

CCJDockContext (CControlBar *pBar)
virtual | ~CCJDockContext ()
void | EndDragDockBar ()
void | MoveDockBar (CPoint pt)
void | StartDragDockBar (CPoint pt)
DWORD | CanDockDockBar ()
DWORD | CanDockDockBar (CRect rect, DWORD dwDockStyle, CDockBar **ppDockBar=NULL)
BOOL | TrackDockBar ()
CCJSizeDockBar * | GetDockBar (DWORD dwOverDockStyle)
void | DockSizeBar (CControlBar *, CCJSizeDockBar *=NULL, LPRECT=NULL)
virtual void | ToggleDocking ()
void | Stretch (CPoint pt)
virtual void | StartResize (int nHitTest, CPoint pt)

Public Attributes

CPoint | m_ptOrig

Constructor & Destructor Documentation

CCJDockContext::CCJDockContext ( CControlBar * pBar )

Definition at line 106 of file CJDockContext.cpp.

00106                                                 : CDockContext(pBar)
00107 {
00108     // TODO: add construction code here.
00109 }

CCJDockContext::~CCJDockContext ( ) [virtual]

Definition at line 111 of file CJDockContext.cpp.

00112 {
00113     // TODO: add destruction code here.
00114 }

Member Function Documentation

DWORD CCJDockContext::CanDockDockBar | ( | CRect | rect,
 |  | DWORD | dwDockStyle,
 |  | CDockBar ** | ppDockBar = NULL
 | ) |

Definition at line 257 of file CJDockContext.cpp.

00258 {
00259     CFrameWnd *pFrame = (CFrameWnd*)m_pDockSite;
00260     ASSERT_VALID(pFrame);
00261
00262     dwDockStyle &= CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI;
00263
00264     if (ppDockBar != NULL)
00265         *ppDockBar = NULL;
00266     POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
00267     while (pos != NULL)
00268     {
00269         CCJSizeDockBar* pDockBar = (CCJSizeDockBar*)pFrame->m_listControlBars.GetNext(pos);
00270         if( !pDockBar->IsKindOf(RUNTIME_CLASS(CCJSizeDockBar)) )
00271             continue;
00272         if (pDockBar->IsDockSizeBar() && pDockBar->IsWindowVisible() &&
00273             (pDockBar->m_dwStyle & dwDockStyle & CBRS_ALIGN_ANY) &&
00274             (!pDockBar->m_bFloating ||
00275                 (dwDockStyle & pDockBar->m_dwStyle & CBRS_FLOAT_MULTI)))
00276         {
00277             CRect rectBar;
00278             pDockBar->GetWindowRect(&rectBar);
00279             if (rectBar.Width() == 0)
00280                 rectBar.right++;
00281             if (rectBar.Height() == 0)
00282                 rectBar.bottom++;
00283             if (rectBar.IntersectRect(rectBar, rect))
00284             {
00285                 if (ppDockBar != NULL)
00286                     *ppDockBar = pDockBar;
00287                 return pDockBar->m_dwStyle & dwDockStyle;
00288             }
00289         }
00290     }
00291     return 0;
00292 }

DWORD CCJDockContext::CanDockDockBar ( )

Definition at line 209 of file CJDockContext.cpp.

Referenced by GetDockBar(), MoveDockBar(), and StartDragDockBar().

00210 {
00211     BOOL bStyleHorz;
00212     DWORD dwDock = 0;
00213     DWORD dwCurr = 0;
00214
00215     ASSERT(m_dwStyle != 0);
00216     ASSERT_KINDOF(CFrameWnd, m_pDockSite);
00217
00218     bStyleHorz = HORZF(m_dwStyle);
00219     bStyleHorz = m_bFlip ? !bStyleHorz : bStyleHorz;
00220
00221     if (bStyleHorz && HORZF(m_dwDockStyle))
00222     {
00223         dwDock = CanDockDockBar(m_rectDragHorz,
00224             m_dwDockStyle & ~CBRS_ORIENT_VERT);
00225     }
00226
00227     else if (VERTF(m_dwDockStyle))
00228     {
00229         dwDock = CanDockDockBar(m_rectDragVert,
00230             m_dwDockStyle & ~CBRS_ORIENT_HORZ);
00231     }
00232
00233     if (!m_bFlip)
00234     {
00235         if (dwDock == 0 && HORZF(m_dwDockStyle))
00236         {
00237             dwCurr = CanDockDockBar(m_rectDragVert,
00238                 m_dwDockStyle & ~CBRS_ORIENT_VERT);
00239             dwDock = CanDockDockBar(m_rectDragHorz,
00240                 m_dwDockStyle & ~CBRS_ORIENT_VERT);
00241             dwDock = (dwDock == dwCurr) ? dwDock : 0;
00242         }
00243
00244         if (dwDock == 0 && VERTF(m_dwDockStyle))
00245         {
00246             dwCurr = CanDockDockBar(m_rectDragHorz,
00247                 m_dwDockStyle & ~CBRS_ORIENT_HORZ);
00248             dwDock = CanDockDockBar(m_rectDragVert,
00249                 m_dwDockStyle & ~CBRS_ORIENT_HORZ);
00250             dwDock = (dwDock == dwCurr) ? dwDock : 0;
00251         }
00252     }
00253
00254     return dwDock;
00255 }

void CCJDockContext::DockSizeBar | ( | CControlBar * | pBar,
 |  | CCJSizeDockBar * | pDockBar = NULL,
 |  | LPRECT | lpRect = NULL
 | ) |

Definition at line 440 of file CJDockContext.cpp.

Referenced by EndDragDockBar(), and ToggleDocking().

00441 {
00442     CFrameWnd *pFrame = (CFrameWnd*)m_pDockSite;
00443     ASSERT_VALID(pFrame);
00444
00445     ASSERT(pBar != NULL);
00446     ASSERT(pBar->m_pDockContext != NULL);
00447
00448     if( pDockBar == NULL )
00449     {
00450         for (int i = 0; i < 4; i++)
00451         {
00452             if ((dwSizeBarMap[i][1] & CBRS_ALIGN_ANY) ==
00453                 (pBar->m_dwStyle & CBRS_ALIGN_ANY))
00454             {
00455                 pDockBar = (CCJSizeDockBar*)pFrame->GetControlBar(dwSizeBarMap[i][0]);
00456                 ASSERT(pDockBar != NULL);
00457                 break;
00458             }
00459         }
00460     }
00461
00462     ASSERT(pDockBar != NULL);
00463     ASSERT(pFrame->m_listControlBars.Find(pBar) != NULL);
00464     ASSERT(pBar->m_pDockSite == pFrame);
00465     ((CCJControlBar*)pBar)->Normalize();
00466     pDockBar->DockControlBar(pBar, lpRect);
00467 }

void CCJDockContext::EndDragDockBar ( )

Definition at line 352 of file CJDockContext.cpp.

Referenced by TrackDockBar().

00353 {
00354     CancelLoop();
00355     //Yiannhs: reduce some more flickering, and unexpected behaviour in floating bars
00356     //         ok did the expected.
00357     if( m_ptLast == m_ptOrig )
00358         return;
00359
00360     if (m_dwOverDockStyle != 0)
00361     {
00362         CCJSizeDockBar* pDockBar = GetDockBar(m_dwOverDockStyle);
00363         if( pDockBar == NULL ) // John Armstrong
00364             return;
00365
00366         CRect rect = (m_dwOverDockStyle & CBRS_ORIENT_VERT) ?
00367             m_rectDragVert : m_rectDragHorz;
00368
00369         UINT uID = _AfxGetDlgCtrlID(pDockBar->m_hWnd);
00370         m_uMRUDockID = uID;
00371         m_rectMRUDockPos = rect;
00372         pDockBar->ScreenToClient(&m_rectMRUDockPos);
00373         DockSizeBar(m_pBar, pDockBar, &rect);
00374
00375         //yiannhs. after testing the posibilities I think this is the best way
00376         m_pDockSite->RecalcLayout( FALSE );
00377     }
00378
00379     else if ((m_dwStyle & CBRS_SIZE_DYNAMIC) || (HORZF(m_dwStyle) && !m_bFlip) ||
00380         (VERTF(m_dwStyle) && m_bFlip))
00381     {
00382         m_dwMRUFloatStyle = CBRS_ALIGN_TOP | (m_dwDockStyle & CBRS_FLOAT_MULTI);
00383         m_ptMRUFloatPos = m_rectFrameDragHorz.TopLeft();
00384         m_pDockSite->FloatControlBar(m_pBar, m_ptMRUFloatPos, m_dwMRUFloatStyle);
00385
00386         //yiannhs. after testing the posibilities I think this is the best way
00387         m_pDockSite->RecalcLayout( FALSE );
00388     }
00389
00390     else
00391     {
00392         m_dwMRUFloatStyle = CBRS_ALIGN_LEFT | (m_dwDockStyle & CBRS_FLOAT_MULTI);
00393         m_ptMRUFloatPos = m_rectFrameDragVert.TopLeft();
00394         m_pDockSite->FloatControlBar(m_pBar, m_ptMRUFloatPos, m_dwMRUFloatStyle);
00395
00396         //yiannhs. after testing the posibilities I think this is the best way
00397         m_pDockSite->RecalcLayout( FALSE );
00398     }
00399 }

CCJSizeDockBar * CCJDockContext::GetDockBar ( DWORD dwOverDockStyle )

Definition at line 401 of file CJDockContext.cpp.

Referenced by EndDragDockBar().

00402 {
00403     DWORD dw = 0;
00404     CDockBar* pBar;
00405     if (HORZF(dwOverDockStyle))
00406     {
00407         ASSERT_KINDOF(CFrameWnd, m_pDockSite);
00408         dw = CanDockDockBar(m_rectDragHorz,
00409             dwOverDockStyle & ~CBRS_ORIENT_VERT, &pBar);
00410         ASSERT(dw != 0);
00411         ASSERT(pBar != NULL);
00412         return (CCJSizeDockBar*)pBar;
00413     }
00414
00415     if (VERTF(dwOverDockStyle))
00416     {
00417         dw = CanDockDockBar(m_rectDragVert,
00418             dwOverDockStyle & ~CBRS_ORIENT_HORZ, &pBar);
00419         ASSERT(dw != 0);
00420         ASSERT(pBar != NULL);
00421         return (CCJSizeDockBar*)pBar;
00422     }
00423
00424     return NULL;
00425 }

void CCJDockContext::MoveDockBar ( CPoint pt )

Definition at line 427 of file CJDockContext.cpp.

Referenced by StartDragDockBar(), and TrackDockBar().

00428 {
00429     CPoint ptOffset = pt - m_ptLast;
00430
00431     m_rectDragHorz.OffsetRect(ptOffset);
00432     m_rectFrameDragHorz.OffsetRect(ptOffset);
00433     m_rectDragVert.OffsetRect(ptOffset);
00434     m_rectFrameDragVert.OffsetRect(ptOffset);
00435     m_ptLast = pt;
00436     m_dwOverDockStyle = m_bForceFrame ? 0 : CanDockDockBar();
00437     DrawFocusRect();
00438 }

void CCJDockContext::StartDragDockBar ( CPoint pt )

Definition at line 119 of file CJDockContext.cpp.

00120 {
00121     ASSERT_VALID(m_pBar);
00122     m_bDragging = TRUE;
00123
00124     InitLoop();
00125
00126     if (m_pBar->m_dwStyle & CBRS_SIZE_DYNAMIC)
00127     {
00128         CRect rect;
00129         m_pBar->GetWindowRect(rect);
00130         // Yiannhs setup and the new member
00131         m_ptOrig = m_ptLast = pt;
00132         CSize sizeHorz = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_HORZDOCK);
00133         CSize sizeVert = m_pBar->CalcDynamicLayout(0, LM_VERTDOCK);
00134         CSize sizeFloat = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH);
00135
00136         m_rectDragHorz = CRect(rect.TopLeft(), sizeHorz);
00137         m_rectDragVert = CRect(rect.TopLeft(), sizeVert);
00138
00139         // calculate frame dragging rectangle
00140         m_rectFrameDragHorz = CRect(rect.TopLeft(), sizeFloat);
00141         m_rectFrameDragVert = CRect(rect.TopLeft(), sizeFloat);
00142
00143         CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz);
00144         CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert);
00145
00146         m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00147         m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00148     }
00149
00150     else if (m_pBar->m_dwStyle & CBRS_SIZE_FIXED)
00151     {
00152         CRect rect;
00153         m_pBar->GetWindowRect(rect);
00154         //Yiannhs setup and the new member
00155         m_ptOrig = m_ptLast = pt;
00156         CSize sizeHorz = m_pBar->CalcDynamicLayout(-1, LM_HORZ | LM_HORZDOCK);
00157         CSize sizeVert = m_pBar->CalcDynamicLayout(-1, LM_VERTDOCK);
00158
00159         m_rectFrameDragHorz = m_rectDragHorz = CRect(rect.TopLeft(), sizeHorz);
00160         m_rectFrameDragVert = m_rectDragVert = CRect(rect.TopLeft(), sizeVert);
00161
00162         CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz);
00163         CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert);
00164         m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00165         m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00166     }
00167
00168     else
00169     {
00170         CRect rect;
00171         m_pBar->GetWindowRect(rect);
00172         //Yiannhs setup and the new member
00173         m_ptOrig = m_ptLast = pt;
00174         BOOL bHorz = HORZF(m_dwStyle);
00175         DWORD dwMode = !bHorz ? (LM_HORZ | LM_HORZDOCK) : LM_VERTDOCK;
00176         CSize size = m_pBar->CalcDynamicLayout(-1, dwMode);
00177
00178         if (bHorz)
00179         {
00180             m_rectDragHorz = rect;
00181             m_rectDragVert = CRect(CPoint(pt.x - rect.Height()/2, rect.top), size);
00182         }
00183
00184         else
00185         {
00186             m_rectDragVert = rect;
00187             m_rectDragHorz = CRect(CPoint(rect.left, pt.y - rect.Width()/2), size);
00188         }
00189
00190         m_rectFrameDragHorz = m_rectDragHorz;
00191         m_rectFrameDragVert = m_rectDragVert;
00192
00193         CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz);
00194         CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert);
00195         m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00196         m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00197     }
00198
00199     AdjustRectangle(m_rectDragHorz, pt);
00200     AdjustRectangle(m_rectDragVert, pt);
00201     AdjustRectangle(m_rectFrameDragHorz, pt);
00202     AdjustRectangle(m_rectFrameDragVert, pt);
00203
00204     m_dwOverDockStyle = CanDockDockBar();
00205     MoveDockBar(pt);
00206     TrackDockBar();
00207 }

void CCJDockContext::StartResize | ( | int | nHitTest,
 |  | CPoint | pt
 | ) | [virtual]

Definition at line 515 of file CJDockContext.cpp.

00516 {
00517     ASSERT_VALID(m_pBar);
00518     ASSERT(m_pBar->m_dwStyle & CBRS_SIZE_DYNAMIC);
00519     m_bDragging = FALSE;
00520
00521     InitLoop();
00522
00523     // GetWindowRect returns screen coordinates(not mirrored)
00524     // So if the desktop is mirrored then turn off mirroring
00525     // for the desktop dc so that we draw correct focus rect
00526 #ifndef _VC_VERSION_5
00527     if (m_pDC->GetLayout() & LAYOUT_RTL)
00528         m_pDC->SetLayout(LAYOUT_LTR);
00529 #endif // _VC_VERSION_5
00530
00531     // get true bar size (including borders)
00532     CRect rect;
00533     m_pBar->GetWindowRect(rect);
00534     m_ptLast = pt;
00535     m_nHitTest = nHitTest;
00536
00537     CSize size = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH);
00538     m_rectRequestedSize = CRect(rect.TopLeft(), size);
00539     m_rectActualSize = CRect(rect.TopLeft(), size);
00540     m_rectActualFrameSize = CRect(rect.TopLeft(), size);
00541
00542     // calculate frame rectangle
00543     CMiniFrameWnd::CalcBorders(&m_rectActualFrameSize);
00544     m_rectActualFrameSize.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2);
00545
00546     m_rectFrameBorders = CRect(CPoint(0,0),
00547         m_rectActualFrameSize.Size() - m_rectActualSize.Size());
00548
00549     // initialize tracking state and enter tracking loop
00550     m_dwOverDockStyle = 0;
00551     Stretch(pt);   // call it here to handle special keys
00552     TrackDockBar();
00553 }

void CCJDockContext::Stretch ( CPoint pt )

Definition at line 555 of file CJDockContext.cpp.

Referenced by StartResize(), and TrackDockBar().

00556 {
00557     CPoint ptOffset = pt - m_ptLast;
00558     CSize size;
00559
00560     // offset all drag rects to new position
00561     if (m_nHitTest != HTTOP && m_nHitTest != HTBOTTOM)
00562     {
00563         if (m_nHitTest == HTLEFT || m_nHitTest == HTTOPLEFT || m_nHitTest == HTBOTTOMLEFT)
00564             m_rectRequestedSize.left += ptOffset.x;
00565         else
00566             m_rectRequestedSize.right += ptOffset.x;
00567         size = m_pBar->CalcDynamicLayout(m_rectRequestedSize.Width(), LM_HORZ);
00568     }
00569
00570     if (m_nHitTest != HTLEFT && m_nHitTest != HTRIGHT)
00571     {
00572         if (m_nHitTest == HTTOP || m_nHitTest == HTTOPLEFT || m_nHitTest == HTTOPRIGHT)
00573             m_rectRequestedSize.top += ptOffset.y;
00574         else
00575             m_rectRequestedSize.bottom += ptOffset.y;
00576         size = m_pBar->CalcDynamicLayout(m_rectRequestedSize.Height(), LM_HORZ|LM_LENGTHY);
00577     }
00578
00579     CRect rectDesk;
00580     HWND hWndDesk = ::GetDesktopWindow();
00581     ::GetWindowRect(hWndDesk, &rectDesk);
00582     CRect rectTemp = m_rectActualFrameSize;
00583
00584     // left, top, top left
00585     if (m_nHitTest == HTLEFT || m_nHitTest == HTTOP || m_nHitTest == HTTOPLEFT)
00586     {
00587         rectTemp.left = rectTemp.right -
00588             (size.cx + m_rectFrameBorders.Width());
00589         rectTemp.top = rectTemp.bottom -
00590             (size.cy + m_rectFrameBorders.Height());
00591         CRect rect;
00592         if (rect.IntersectRect(rectDesk, rectTemp))
00593         {
00594             m_rectActualSize.left = m_rectActualSize.right - size.cx;
00595             m_rectActualSize.top = m_rectActualSize.bottom - size.cy;
00596             m_rectActualFrameSize.left = rectTemp.left;
00597             m_rectActualFrameSize.top = rectTemp.top;
00598         }
00599     } else if (m_nHitTest == HTTOPRIGHT) // top right
00600     {
00601         rectTemp.top = rectTemp.bottom -
00602             (size.cy + m_rectFrameBorders.Height());
00603         rectTemp.right = rectTemp.left +
00604             (size.cx + m_rectFrameBorders.Width());
00605         CRect rect;
00606         if (rect.IntersectRect(rectDesk, rectTemp))
00607         {
00608             m_rectActualSize.left = m_rectActualSize.right - size.cx;
00609             m_rectActualSize.bottom = m_rectActualSize.top + size.cy;
00610             m_rectActualFrameSize.right = rectTemp.right;
00611             m_rectActualFrameSize.top = rectTemp.top;
00612         }
00613     } else if (m_nHitTest == HTBOTTOMLEFT) // bottom left
00614     {
00615         rectTemp.bottom = rectTemp.top +
00616             (size.cy + m_rectFrameBorders.Height());
00617         rectTemp.left = rectTemp.right -
00618             (size.cx + m_rectFrameBorders.Width());
00619         CRect rect;
00620         if (rect.IntersectRect(rectDesk, rectTemp))
00621         {
00622             m_rectActualSize.right = m_rectActualSize.left + size.cx;
00623             m_rectActualSize.top = m_rectActualSize.bottom - size.cy;
00624             m_rectActualFrameSize.left = rectTemp.left;
00625             m_rectActualFrameSize.bottom = rectTemp.bottom;
00626         }
00627     } else// bottom, right, bottom right
00628     {
00629         rectTemp.right = rectTemp.left +
00630             (size.cx + m_rectFrameBorders.Width());
00631         rectTemp.bottom = rectTemp.top +
00632             (size.cy + m_rectFrameBorders.Height());
00633         CRect rect;
00634         if (rect.IntersectRect(rectDesk, rectTemp))
00635         {
00636             m_rectActualSize.right = m_rectActualSize.left + size.cx;
00637             m_rectActualSize.bottom = m_rectActualSize.top + size.cy;
00638             m_rectActualFrameSize.right = rectTemp.right;
00639             m_rectActualFrameSize.bottom = rectTemp.bottom;
00640         }
00641     }
00642     m_ptLast = pt;
00643
00644     // update feedback
00645     DrawFocusRect();
00646 }

void CCJDockContext::ToggleDocking ( ) [virtual]

Definition at line 469 of file CJDockContext.cpp.

00470 {
00471     if (m_pBar->IsKindOf(RUNTIME_CLASS(CCJControlBar)))
00472     {
00473         if (m_pBar->IsFloating())
00474         {
00475             // Dock it only if is allowed to be docked
00476             if (m_pBar->m_dwDockStyle & CBRS_ALIGN_ANY)
00477             {
00478                 ASSERT((m_uMRUDockID >= AFX_IDW_DOCKBAR_TOP && m_uMRUDockID <= AFX_IDW_SIZEBAR_BOTTOM) ||
00479                     m_uMRUDockID == 0);
00480
00481                 CRect rect = m_rectMRUDockPos;
00482                 CCJSizeDockBar* pDockBar = NULL;
00483                 if (m_uMRUDockID != 0)
00484                 {
00485                     pDockBar = (CCJSizeDockBar*)m_pDockSite->GetControlBar(m_uMRUDockID);
00486                     pDockBar->ClientToScreen(&rect);
00487                 }
00488
00489                 // dock it at the specified position, RecalcLayout will snap
00490                 DockSizeBar(m_pBar, pDockBar, &rect);
00491                 m_pDockSite->RecalcLayout();
00492             }
00493         }
00494         else
00495         {
00496             CPoint ptFloat = m_ptMRUFloatPos;
00497             if (ptFloat.x < 0 || ptFloat.y < 0)
00498             {
00499                 ptFloat = m_rectMRUDockPos.TopLeft();
00500                 m_pBar->GetParent()->ClientToScreen(&ptFloat);
00501             }
00502             m_pDockSite->FloatControlBar(m_pBar, ptFloat, m_dwMRUFloatStyle);
00503         }
00504     }
00505 }

BOOL CCJDockContext::TrackDockBar ( )

Definition at line 294 of file CJDockContext.cpp.

Referenced by StartDragDockBar(), and StartResize().

00295 {
00296     if (::GetCapture() != NULL)
00297         return FALSE;
00298     m_pBar->SetCapture();
00299     ASSERT(m_pBar == CWnd::GetCapture());
00300
00301     while (CWnd::GetCapture() == m_pBar)
00302     {
00303         MSG msg;
00304         if (!::GetMessage(&msg, NULL, 0, 0))
00305         {
00306             AfxPostQuitMessage(msg.wParam);
00307             break;
00308         }
00309
00310         switch (msg.message)
00311         {
00312         case WM_LBUTTONUP:
00313             if (m_bDragging)
00314                 EndDragDockBar();
00315             else
00316                 EndResize();
00317             return TRUE;
00318         case WM_MOUSEMOVE:
00319             if (m_bDragging)
00320                 MoveDockBar(msg.pt);
00321             else
00322                 Stretch(msg.pt);
00323             break;
00324         case WM_KEYUP:
00325             if (m_bDragging)
00326                 OnKey((int)msg.wParam, FALSE);
00327             break;
00328         case WM_KEYDOWN:
00329             if (m_bDragging)
00330                 OnKey((int)msg.wParam, TRUE);
00331             if (msg.wParam == VK_ESCAPE)
00332             {
00333                 CancelLoop();
00334                 return FALSE;
00335             }
00336             break;
00337         case WM_RBUTTONDOWN:
00338             CancelLoop();
00339             return FALSE;
00340
00341             // just dispatch rest of the messages
00342         default:
00343             DispatchMessage(&msg);
00344             break;
00345         }
00346     }
00347
00348     CancelLoop();
00349     return FALSE;
00350 }

Member Data Documentation

CPoint CCJDockContext::m_ptOrig

Definition at line 103 of file CJDockContext.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJDockContext.h
  • WinCvs/CJLib/CJLibrary/CJDockContext.cpp
Generated on Sun Oct 21 12:46:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJExplorerBar Class Reference

#include <CJExplorerBar.h>

Inheritance diagram for CCJExplorerBar:

[legend]
Collaboration diagram for CCJExplorerBar:

[legend]
List of all members.

Public Methods

CCJExplorerBar ()
virtual | ~CCJExplorerBar ()
virtual BOOL | Create (CWnd *pParentWnd, UINT nID, LPCTSTR lpszWindowName=NULL, CSize sizeDefault=CSize(200, 100), DWORD dwStyle=CBRS_LEFT)
virtual void | GetChildRect (CRect &rect)

Protected Methods

afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnButtonClose ()
afx_msg void | OnUpdateButtonClose (CCmdUI *pCmdUI)
afx_msg void | OnWindowPosChanged (WINDOWPOS *lpwndpos)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point)

Protected Attributes

CCJCaption m_Caption
CCJFlatButton m_CaptionButton
CString | m_strCaption
HICON | m_hIcon

Constructor & Destructor Documentation

CCJExplorerBar::CCJExplorerBar ( )

Definition at line 99 of file CJExplorerBar.cpp.

00100 {
00101     m_hIcon = NULL;
00102     m_strCaption = _T("");
00103 }

CCJExplorerBar::~CCJExplorerBar ( ) [virtual]

Definition at line 105 of file CJExplorerBar.cpp.

00106 {
00107     // fix potential resource leak - KStowell - 10-22-99.
00108     _destroyIcon(m_hIcon);
00109 }

Member Function Documentation

BOOL CCJExplorerBar::Create | ( | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | LPCTSTR | lpszWindowName = NULL,
 |  | CSize | sizeDefault = CSize(200,100),
 |  | DWORD | dwStyle = CBRS_LEFT
 | ) | [virtual]

Definition at line 128 of file CJExplorerBar.cpp.

00129 {
00130     m_strCaption = lpszWindowName;
00131
00132     if(!CCJControlBar::Create(pParentWnd, nID, lpszWindowName, sizeDefault, dwStyle)) {
00133         return FALSE;
00134     }
00135
00136     ShowFrameControls(FALSE, FALSE);
00137     return TRUE;
00138 }

void CCJExplorerBar::GetChildRect ( CRect & rect ) [virtual]

Reimplemented from CCJControlBar.

Definition at line 182 of file CJExplorerBar.cpp.

Referenced by OnWindowPosChanged().

00183 {
00184     GetClientRect(&rect);
00185
00186     if (!IsFloating())
00187     {
00188         rect.left   += 1;
00189         rect.right  -= 1;
00190         rect.top    += (IsVertDocked()?26:22);
00191     }
00192
00193     else
00194         rect.DeflateRect(2,2);
00195 }

void CCJExplorerBar::OnButtonClose ( ) [protected]

Reimplemented from CCJControlBar.

Definition at line 172 of file CJExplorerBar.cpp.

00173 {
00174     GetDockingFrame()->ShowControlBar(this, FALSE, FALSE);
00175 }

int CCJExplorerBar::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Reimplemented from CCJControlBar.

Definition at line 140 of file CJExplorerBar.cpp.

00141 {
00142     if (CCJControlBar::OnCreate(lpCreateStruct) == -1)
00143         return -1;
00144
00145     // Create the caption.
00146     if (!m_Caption.Create(this, m_strCaption))
00147     {
00148         TRACE0( "Unable to create caption.\n" );
00149         return -1;
00150     }
00151
00152     // Create the caption button.
00153     if (!m_CaptionButton.Create(NULL, WS_VISIBLE|BS_ICON|BS_OWNERDRAW|BS_CENTER|BS_VCENTER,
00154         CRect(0,0,0,0), this, IDC_BAR_BUTTON))
00155     {
00156         TRACE0( "Unable to create caption button.\n" );
00157         return -1;
00158     }
00159
00160     // Create the image list used by frame buttons.
00161     CImageList imageList;
00162     imageList.Create(IDB_PUSHPIN, 16, 1, RGB(255,0,255));
00163     m_hIcon = imageList.ExtractIcon(2);
00164
00165     // Associate the button icon
00166     m_CaptionButton.SetIcon(m_hIcon, CSize(16,15));
00167     imageList.DeleteImageList();
00168
00169     return 0;
00170 }

BOOL CCJExplorerBar::OnEraseBkgnd ( CDC * pDC ) [protected]

Reimplemented from CCJControlBar.

Definition at line 229 of file CJExplorerBar.cpp.

00230 {
00231     int result = CControlBar::OnEraseBkgnd(pDC);
00232
00233     CRect rect;
00234     GetClientRect(rect);
00235     rect.top+=(IsVertDocked()?3:-1);
00236     rect.bottom += 1;
00237     //Yiannhs This was a side effect of removing the variables
00238     pDC->Draw3dRect(rect, afxData.clrBtnShadow, afxData.clrBtnShadow);
00239     //pDC->Draw3dRect(rect, m_clrBtnShadow, m_clrBtnShadow);
00240     return result;
00241 }

void CCJExplorerBar::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Reimplemented from CCJControlBar.

Definition at line 243 of file CJExplorerBar.cpp.

00244 {
00245     // bypass CCJControlBar.
00246 }

void CCJExplorerBar::OnLButtonUp | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Reimplemented from CCJControlBar.

Definition at line 248 of file CJExplorerBar.cpp.

00249 {
00250     // bypass CCJControlBar.
00251 }

void CCJExplorerBar::OnUpdateButtonClose ( CCmdUI * pCmdUI ) [protected]

Reimplemented from CCJControlBar.

Definition at line 177 of file CJExplorerBar.cpp.

00178 {
00179     pCmdUI->Enable(TRUE);
00180 }

void CCJExplorerBar::OnWindowPosChanged ( WINDOWPOS * lpwndpos ) [protected]

Reimplemented from CCJControlBar.

Definition at line 197 of file CJExplorerBar.cpp.

00198 {
00199     CControlBar::OnWindowPosChanged(lpwndpos);
00200
00201     int nCmdShow = IsFloating() ? SW_HIDE:SW_SHOW;
00202     m_Caption.ShowWindow(nCmdShow);
00203     m_CaptionButton.ShowWindow(nCmdShow);
00204
00205     if (!IsFloating())
00206     {
00207         if (IsVertDocked())
00208         {
00209             m_Caption.MoveWindow(1,4,lpwndpos->cx-1,22);
00210             m_CaptionButton.MoveWindow(CRect(lpwndpos->cx-25,
00211                 7, lpwndpos->cx-5, 24));
00212         }
00213         else
00214         {
00215             m_Caption.MoveWindow(1,0,lpwndpos->cx-1,22);
00216             m_CaptionButton.MoveWindow(CRect(lpwndpos->cx-25,
00217                 3, lpwndpos->cx-5, 20));
00218         }
00219     }
00220
00221     if (m_pChildWnd->GetSafeHwnd())
00222     {
00223         CRect rc;
00224         GetChildRect(rc);
00225         m_pChildWnd->MoveWindow(rc);
00226     }
00227 }

Member Data Documentation

CCJCaption CCJExplorerBar::m_Caption [protected]

Definition at line 85 of file CJExplorerBar.h.

CCJFlatButton CCJExplorerBar::m_CaptionButton [protected]

Definition at line 86 of file CJExplorerBar.h.

HICON CCJExplorerBar::m_hIcon [protected]

Reimplemented from CCJControlBar.

Definition at line 88 of file CJExplorerBar.h.

CString CCJExplorerBar::m_strCaption [protected]

Definition at line 87 of file CJExplorerBar.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJExplorerBar.h
  • WinCvs/CJLib/CJLibrary/CJExplorerBar.cpp
Generated on Sun Oct 21 12:46:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJFlatButton Class Reference

#include <CJFlatButton.h>

Inheritance diagram for CCJFlatButton:

[legend]
Collaboration diagram for CCJFlatButton:

[legend]
List of all members.

Public Methods

CCJFlatButton ()
virtual | ~CCJFlatButton ()
virtual void | SetButtonFont (CFont *pFont)
virtual void | SetAlternateColors (COLORREF clrAltNormal, COLORREF clrAltHilite, COLORREF clrAltShadow, COLORREF clrAltTextNm)
virtual void | DisableFlatLook (BOOL bDisable=FALSE)
virtual void | SetIcon (HICON hIcon, CSize size)
virtual void | SetIcon (HICON hIcon, HICON hPushed, CSize size)
virtual void | DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)

Protected Methods

virtual void | DrawButtonIcon (CDC *pDC, UINT nState, CRect &rcItem)
virtual void | DrawButtonText (CDC *pDC, UINT nState, CRect &rcItem)
virtual void | DrawButtonBitmap (CDC *pDC, UINT nState, CRect &rcItem)
virtual void | UpdateFont ()
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point)
afx_msg void | OnTimer (UINT nIDEvent)
afx_msg void | OnSysColorChange ()
afx_msg BOOL | OnSetCursor (CWnd *pWnd, UINT nHitTest, UINT message)
afx_msg void | OnLButtonDblClk (UINT nFlags, CPoint point)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnPaint ()

Protected Attributes

BOOL | m_bMouseOver
BOOL | m_bLBtnDown
BOOL | m_bFlatLook
CSize | m_sizeIcon
COLORREF | m_clrHilite
COLORREF | m_clrShadow
COLORREF | m_clrDkShad
COLORREF | m_clrNormal
COLORREF | m_clrTextGy
COLORREF | m_clrTextNm
COLORREF | m_clrAltNormal
COLORREF | m_clrAltHilite
COLORREF | m_clrAltShadow
COLORREF | m_clrAltTextNm
BOOL | m_bAltColor
BOOL | m_bPainted
HICON | m_hPushed
CFont * | m_pFont
CFont | m_Font
HCURSOR | m_hCursor

Constructor & Destructor Documentation

CCJFlatButton::CCJFlatButton ( )

Definition at line 146 of file CJFlatButton.cpp.

00147 {
00148     m_pFont     = NULL;
00149     m_hPushed   = NULL;
00150     m_bLBtnDown = FALSE;
00151     m_bFlatLook = TRUE;
00152     m_bPainted  = FALSE;
00153     m_bAltColor = FALSE;
00154
00155     m_clrHilite = ::GetSysColor(COLOR_BTNHIGHLIGHT);
00156     m_clrShadow = ::GetSysColor(COLOR_BTNSHADOW);
00157     m_clrDkShad = ::GetSysColor(COLOR_3DDKSHADOW);
00158     m_clrNormal = ::GetSysColor(COLOR_BTNFACE);
00159     m_clrTextGy = ::GetSysColor(COLOR_GRAYTEXT);
00160     m_clrTextNm = ::GetSysColor(COLOR_BTNTEXT);
00161
00162     m_hCursor   = AfxGetApp()->LoadCursor( IDC_HANDCUR );
00163     UpdateFont();
00164 }

CCJFlatButton::~CCJFlatButton ( ) [virtual]

Definition at line 166 of file CJFlatButton.cpp.

00167 {
00168     // fix potential resource leak - KStowell - 10-21-99
00169     m_Font.DeleteObject();
00170 }

Member Function Documentation

_CJXLIB_INLINE void CCJFlatButton::DisableFlatLook ( BOOL bDisable = FALSE ) [virtual]

Definition at line 247 of file CJFlatButton.h.

Referenced by CCJControlBar::EnableFlatLook(), and CCJControlBar::OnCreate().

00248     { ASSERT(::IsWindow(m_hWnd)); m_bFlatLook = bDisable; Invalidate(); }

void CCJFlatButton::DrawButtonBitmap | ( | CDC * | pDC,
 |  | UINT | nState,
 |  | CRect & | rcItem
 | ) | [protected, virtual]

Reimplemented in CPseudoButton.

Definition at line 368 of file CJFlatButton.cpp.

Referenced by DrawItem().

00369 {
00370     // get the handle to the bitmap (if any) associated
00371     // with this button.
00372     HBITMAP hBitmap = GetBitmap();
00373     if( hBitmap == NULL ) {
00374         return;
00375     }
00376
00377     CRect rc = rcItem;
00378
00379     // if the button is selected.
00380     if( nState & ODS_SELECTED ) {
00381         rcItem.OffsetRect(1,1);
00382     }
00383
00384     // draw the bitmap associated with this button.
00385     pDC->DrawState( rc.TopLeft(), rc.Size(), hBitmap,
00386         ( nState & ODS_DISABLED )?DSS_DISABLED:DSS_NORMAL, (HBRUSH)NULL );
00387 }

void CCJFlatButton::DrawButtonIcon | ( | CDC * | pDC,
 |  | UINT | nState,
 |  | CRect & | rcItem
 | ) | [protected, virtual]

Reimplemented in CCJCBarButton.

Definition at line 330 of file CJFlatButton.cpp.

Referenced by DrawItem().

00331 {
00332     UNUSED_ALWAYS( rcItem );
00333
00334     // get the handle to the icon (if any) associated
00335     // with this button.
00336     HICON hIcon = GetIcon();
00337     if( hIcon == NULL ) {
00338         return;
00339     }
00340
00341     CRect rcWnd;
00342     GetWindowRect(&rcWnd);
00343
00344     int left   = (rcWnd.Width()-m_sizeIcon.cx)/2;
00345     int right  = left+m_sizeIcon.cx;
00346     int top    = (rcWnd.Height()-m_sizeIcon.cy)/2;
00347     int bottom = top+m_sizeIcon.cy;
00348
00349     // determine the size of the icon to be drawn.
00350     CRect rc(left,top,right,bottom);
00351
00352     // if the button is selected.
00353     if( nState & ODS_SELECTED )
00354     {
00355         if( m_hPushed ) {
00356             hIcon = m_hPushed;
00357         }
00358         else {
00359             rc.OffsetRect(1,1);
00360         }
00361     }
00362
00363     // draw the icon associated with this button.
00364     pDC->DrawState( rc.TopLeft(), rc.Size(), hIcon,
00365         ( nState & ODS_DISABLED )?DSS_DISABLED:DSS_NORMAL, (HBRUSH)NULL );
00366 }

void CCJFlatButton::DrawButtonText | ( | CDC * | pDC,
 |  | UINT | nState,
 |  | CRect & | rcItem
 | ) | [protected, virtual]

Reimplemented in CCJCaptionButton.

Definition at line 302 of file CJFlatButton.cpp.

Referenced by DrawItem().

00303 {
00304     // Get the window text, return if empty.
00305     CString strWindowText; GetWindowText(strWindowText);
00306     if( strWindowText.IsEmpty( ))
00307         return;
00308
00309     if( m_pFont == NULL ) {
00310         m_pFont = &m_Font;
00311     }
00312
00313     CRect rc = rcItem;
00314     rc.DeflateRect( 2,0 );
00315
00316     // Set the text color and select the button font.
00317     pDC->SetTextColor(( nState & ODS_DISABLED )?m_clrTextGy:m_clrTextNm);
00318     CFont *oldFont = pDC->SelectObject( m_pFont );
00319
00320     // if the button is selected.
00321     if( nState & ODS_SELECTED ) {
00322         rc.OffsetRect(1,1);
00323     }
00324
00325     // draw the text, and select the original font.
00326     pDC->DrawText( strWindowText, -1, rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
00327     pDC->SelectObject( oldFont );
00328 }

void CCJFlatButton::DrawItem ( LPDRAWITEMSTRUCT lpDIS ) [virtual]

Reimplemented in CPseudoButton, and CPseudoToggle.

Definition at line 266 of file CJFlatButton.cpp.

Referenced by CPseudoButton::DrawItem().

00267 {
00268     ASSERT(lpDrawItemStruct != NULL);
00269
00270     // define some temporary variables.
00271     CDC*  pDC    = CDC::FromHandle( lpDrawItemStruct->hDC );
00272     CRect rcItem = lpDrawItemStruct->rcItem;
00273     int   nState = lpDrawItemStruct->itemState;
00274
00275     // Paint the background.
00276     pDC->FillSolidRect( rcItem, m_clrNormal );
00277
00278     // Draw flat button border.
00279     if( m_bFlatLook ) {
00280         pDC->Draw3dRect( rcItem, (nState & ODS_SELECTED)?m_clrShadow:m_clrNormal,
00281             (nState & ODS_SELECTED)?m_clrHilite:m_clrNormal );
00282     }
00283
00284     // Draw normal border.
00285     else {
00286         pDC->Draw3dRect( rcItem, (nState & ODS_SELECTED)?m_clrDkShad:m_clrHilite,
00287             (nState & ODS_SELECTED)?m_clrHilite:m_clrDkShad);
00288         rcItem.DeflateRect(1,1);
00289         pDC->Draw3dRect( rcItem, (nState & ODS_SELECTED)?m_clrShadow:m_clrNormal,
00290             (nState & ODS_SELECTED)?m_clrNormal:m_clrShadow);
00291     }
00292
00293     // Set the background mode to transparent.
00294     pDC->SetBkMode( TRANSPARENT );
00295
00296     // draw the button text, icon or bitmap.
00297     DrawButtonText(pDC, nState, rcItem);
00298     DrawButtonIcon(pDC, nState, rcItem);
00299     DrawButtonBitmap(pDC, nState, rcItem);
00300 }

BOOL CCJFlatButton::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 421 of file CJFlatButton.cpp.

00422 {
00423     // KStowell - overridden for flicker-free drawing.
00424     UNUSED_ALWAYS(pDC);
00425     return TRUE;
00426 }

void CCJFlatButton::OnLButtonDblClk | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 410 of file CJFlatButton.cpp.

00411 {
00412     POINT pt;
00413
00414     ::GetCursorPos(&pt);
00415     ::MapWindowPoints(NULL,(HWND)(m_hWnd),&pt,1);
00416     ::SendMessage((HWND)(m_hWnd),WM_LBUTTONDOWN,0,MAKELPARAM(pt.x,pt.y));
00417
00418     CButton::OnLButtonDblClk(nFlags, point);
00419 }

void CCJFlatButton::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 201 of file CJFlatButton.cpp.

00202 {
00203     m_bLBtnDown = TRUE;
00204     CButton::OnLButtonDown(nFlags, point);
00205 }

void CCJFlatButton::OnLButtonUp | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Reimplemented in CPseudoToggle.

Definition at line 207 of file CJFlatButton.cpp.

Referenced by CPseudoToggle::OnLButtonUp().

00208 {
00209     m_bLBtnDown = FALSE;
00210     CButton::OnLButtonUp(nFlags, point);
00211 }

void CCJFlatButton::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 190 of file CJFlatButton.cpp.

00191 {
00192     if (m_bFlatLook)
00193     {
00194         SetTimer(1, 10, NULL);
00195         OnTimer(1);
00196     }
00197
00198     CButton::OnMouseMove(nFlags, point);
00199 }

void CCJFlatButton::OnPaint ( ) [protected]

Definition at line 428 of file CJFlatButton.cpp.

00429 {
00430     CPaintDC dc(this); // device context for painting
00431
00432     // KStowell - Get the client rect.
00433     CRect rcClient, rcClip;
00434     dc.GetClipBox( &rcClip );
00435     GetClientRect( &rcClient );
00436
00437     // KStowell - Create a memory device-context. This is done to help reduce
00438     // screen flicker, since we will paint the entire control to the
00439     // off screen device context first.
00440     CDC memDC;
00441     CBitmap bitmap;
00442     memDC.CreateCompatibleDC(&dc);
00443     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00444     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00445
00446     // KStowell - Repaint the background.
00447     memDC.FillSolidRect(rcClient, m_clrNormal);
00448
00449     // let the control do its default drawing.
00450     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00451
00452     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00453     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00454         rcClip.left, rcClip.top, SRCCOPY );
00455
00456     // KStowell - Cleanup resources.
00457     memDC.SelectObject(pOldBitmap);
00458     memDC.DeleteDC();
00459     bitmap.DeleteObject();
00460 }

BOOL CCJFlatButton::OnSetCursor | ( | CWnd * | pWnd,
 |  | UINT | nHitTest,
 |  | UINT | message
 | ) | [protected]

Definition at line 390 of file CJFlatButton.cpp.

00391 {
00392     UNUSED_ALWAYS( pWnd );
00393     UNUSED_ALWAYS( nHitTest );
00394     UNUSED_ALWAYS( message );
00395
00396     ::SetCursor( m_hCursor );
00397
00398     return TRUE;
00399 }

void CCJFlatButton::OnSysColorChange ( ) [protected]

Reimplemented in CCJCaptionButton.

Definition at line 245 of file CJFlatButton.cpp.

00246 {
00247     CButton::OnSysColorChange();
00248
00249     m_clrDkShad = ::GetSysColor(COLOR_3DDKSHADOW);
00250     m_clrTextGy = ::GetSysColor(COLOR_GRAYTEXT);
00251     m_clrTextNm = (m_bAltColor ? m_clrAltTextNm : ::GetSysColor(COLOR_BTNTEXT));
00252     m_clrNormal = (m_bAltColor ? m_clrAltNormal : ::GetSysColor(COLOR_BTNFACE));
00253     m_clrHilite = (m_bAltColor ? m_clrAltHilite : ::GetSysColor(COLOR_BTNHIGHLIGHT));
00254     m_clrShadow = (m_bAltColor ? m_clrAltShadow : ::GetSysColor(COLOR_BTNSHADOW));
00255 }

void CCJFlatButton::OnTimer ( UINT nIDEvent ) [protected]

Definition at line 213 of file CJFlatButton.cpp.

00214 {
00215     CRect rcItem;
00216     GetWindowRect(rcItem);
00217
00218     CPoint ptCursor;
00219     GetCursorPos(&ptCursor);
00220
00221     if(( m_bLBtnDown == TRUE ) || ( !rcItem.PtInRect( ptCursor )))
00222     {
00223         KillTimer(1);
00224
00225         if (m_bPainted == TRUE) {
00226             InvalidateRect (NULL);
00227         }
00228
00229         m_bPainted = FALSE;
00230         return;
00231     }
00232
00233     // On mouse over, show raised button.
00234     else if(( m_bFlatLook ) && ( !m_bPainted )) {
00235         CDC* pDC = GetDC();
00236         GetClientRect(rcItem);
00237         pDC->Draw3dRect( rcItem, m_clrHilite, m_clrShadow );
00238         m_bPainted = TRUE;
00239         ReleaseDC(pDC);
00240     }
00241
00242     CButton::OnTimer(nIDEvent);
00243 }

void CCJFlatButton::SetAlternateColors | ( | COLORREF | clrAltNormal,
 |  | COLORREF | clrAltHilite,
 |  | COLORREF | clrAltShadow,
 |  | COLORREF | clrAltTextNm
 | ) | [virtual]

Definition at line 257 of file CJFlatButton.cpp.

00258 {
00259     m_clrNormal = m_clrAltNormal = clrAltNormal;
00260     m_clrHilite = m_clrAltHilite = clrAltHilite;
00261     m_clrShadow = m_clrAltShadow = clrAltShadow;
00262     m_clrTextNm = m_clrAltTextNm = clrAltTextNm;
00263     m_bAltColor = TRUE;
00264 }

_CJXLIB_INLINE void CCJFlatButton::SetButtonFont ( CFont * pFont ) [virtual]

Definition at line 256 of file CJFlatButton.h.

00257     { ASSERT(::IsWindow(m_hWnd)); m_pFont = pFont; }

_CJXLIB_INLINE void CCJFlatButton::SetIcon | ( | HICON | hIcon,
 |  | HICON | hPushed,
 |  | CSize | size
 | ) | [virtual]

Definition at line 253 of file CJFlatButton.h.

00254     { ASSERT(::IsWindow(m_hWnd)); m_hPushed = hPushed; SetIcon(hIcon, size); }

_CJXLIB_INLINE void CCJFlatButton::SetIcon | ( | HICON | hIcon,
 |  | CSize | size
 | ) | [virtual]

Definition at line 250 of file CJFlatButton.h.

Referenced by CCJExplorerBar::OnCreate(), CCJControlBar::OnCreate(), CCJControlBar::OnUpdateCmdUI(), and SetIcon().

00251     { ASSERT(::IsWindow(m_hWnd)); m_sizeIcon = size; CButton::SetIcon(hIcon); }

void CCJFlatButton::UpdateFont ( ) [protected, virtual]

Definition at line 401 of file CJFlatButton.cpp.

00402 {
00403     m_Font.DeleteObject();
00404     NONCLIENTMETRICS ncm;
00405     ncm.cbSize = sizeof(ncm);
00406     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00407     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00408 }

Member Data Documentation

CFont CCJFlatButton::m_Font [protected]

Definition at line 165 of file CJFlatButton.h.

BOOL CCJFlatButton::m_bAltColor [protected]

Definition at line 161 of file CJFlatButton.h.

BOOL CCJFlatButton::m_bFlatLook [protected]

Definition at line 149 of file CJFlatButton.h.

BOOL CCJFlatButton::m_bLBtnDown [protected]

Definition at line 148 of file CJFlatButton.h.

BOOL CCJFlatButton::m_bMouseOver [protected]

Definition at line 147 of file CJFlatButton.h.

BOOL CCJFlatButton::m_bPainted [protected]

Definition at line 162 of file CJFlatButton.h.

COLORREF CCJFlatButton::m_clrAltHilite [protected]

Definition at line 158 of file CJFlatButton.h.

COLORREF CCJFlatButton::m_clrAltNormal [protected]

Definition at line 157 of file CJFlatButton.h.

COLORREF CCJFlatButton::m_clrAltShadow [protected]

Definition at line 159 of file CJFlatButton.h.

COLORREF CCJFlatButton::m_clrAltTextNm [protected]

Definition at line 160 of file CJFlatButton.h.

COLORREF CCJFlatButton::m_clrDkShad [protected]

Definition at line 153 of file CJFlatButton.h.

COLORREF CCJFlatButton::m_clrHilite [protected]

Definition at line 151 of file CJFlatButton.h.

COLORREF CCJFlatButton::m_clrNormal [protected]

Definition at line 154 of file CJFlatButton.h.

COLORREF CCJFlatButton::m_clrShadow [protected]

Definition at line 152 of file CJFlatButton.h.

COLORREF CCJFlatButton::m_clrTextGy [protected]

Definition at line 155 of file CJFlatButton.h.

COLORREF CCJFlatButton::m_clrTextNm [protected]

Definition at line 156 of file CJFlatButton.h.

HCURSOR CCJFlatButton::m_hCursor [protected]

Definition at line 166 of file CJFlatButton.h.

HICON CCJFlatButton::m_hPushed [protected]

Definition at line 163 of file CJFlatButton.h.

CFont* CCJFlatButton::m_pFont [protected]

Definition at line 164 of file CJFlatButton.h.

CSize CCJFlatButton::m_sizeIcon [protected]

Definition at line 150 of file CJFlatButton.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJFlatButton.h
  • WinCvs/CJLib/CJLibrary/CJFlatButton.cpp
Generated on Sun Oct 21 12:46:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJFlatComboBox Class Reference

#include <CJFlatComboBox.h>

Inheritance diagram for CCJFlatComboBox:

[legend]
Collaboration diagram for CCJFlatComboBox:

[legend]
List of all members.

Public Methods

CCJFlatComboBox ()
virtual | ~CCJFlatComboBox ()
BOOL | IsWin95 ()
virtual void | EnableAutoCompletion (BOOL bEnable=TRUE)
virtual BOOL | PointInRect ()
virtual BOOL | PreTranslateMessage (MSG *pMsg)

Protected Types

enum | STATE { NORMAL = 1, RAISED = 2, PRESSED = 3 }

Protected Methods

virtual void | DrawCombo (STATE eState, COLORREF clrTopLeft, COLORREF clrBottomRight, CDC *pDC=NULL)
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point)
afx_msg void | OnTimer (UINT nIDEvent)
afx_msg void | OnPaint ()
afx_msg void | OnSetFocus ()
afx_msg void | OnKillFocus ()
afx_msg void | OnEditUpdate ()
afx_msg void | OnSysColorChange ()
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)

Protected Attributes

BOOL | m_bLBtnDown
BOOL | m_bPainted
BOOL | m_bHasFocus
BOOL | m_bAutoComp
COLORREF | m_clrHilite
COLORREF | m_clrShadow
COLORREF | m_clrNormal

Member Enumeration Documentation

enum CCJFlatComboBox::STATE [protected]

Enumeration values:
NORMAL
RAISED
PRESSED

Definition at line 150 of file CJFlatComboBox.h.

00150 { NORMAL = 1, RAISED = 2, PRESSED = 3 };

Constructor & Destructor Documentation

CCJFlatComboBox::CCJFlatComboBox ( )

Definition at line 126 of file CJFlatComboBox.cpp.

00127 {
00128     m_bLBtnDown     = FALSE;
00129     m_bPainted      = FALSE;
00130     m_bHasFocus     = FALSE;
00131     m_bAutoComp     = FALSE;
00132     m_clrHilite     = ::GetSysColor(COLOR_BTNHIGHLIGHT);
00133     m_clrShadow     = ::GetSysColor(COLOR_BTNSHADOW);
00134     m_clrNormal     = ::GetSysColor(COLOR_BTNFACE);
00135 }

CCJFlatComboBox::~CCJFlatComboBox ( ) [virtual]

Definition at line 137 of file CJFlatComboBox.cpp.

00138 {
00139 }

Member Function Documentation

void CCJFlatComboBox::DrawCombo | ( | STATE | eState,
 |  | COLORREF | clrTopLeft,
 |  | COLORREF | clrBottomRight,
 |  | CDC * | pDC = NULL
 | ) | [protected, virtual]

Definition at line 245 of file CJFlatComboBox.cpp.

Referenced by OnKillFocus(), OnPaint(), OnSetFocus(), and OnTimer().

00246 {
00247     CRect rcItem;
00248     GetClientRect(&rcItem);
00249     bool bRelease = false;
00250
00251     // if no device context was passed in, get the device context
00252     // for the CWnd client area ...
00253     if(pDC == NULL) {
00254         pDC = GetDC();
00255         bRelease = true;
00256     }
00257
00258     // Cover up dark 3D shadow.
00259     pDC->Draw3dRect(rcItem, clrTopLeft, clrBottomRight);
00260     rcItem.DeflateRect(1,1);
00261
00262     if (!IsWindowEnabled()) {
00263         pDC->Draw3dRect(rcItem, m_clrHilite, m_clrHilite);
00264     } else {
00265         pDC->Draw3dRect(rcItem, m_clrNormal, m_clrNormal);
00266     }
00267
00268     // Cover up dark 3D shadow on drop arrow.
00269     rcItem.DeflateRect(1,1);
00270     rcItem.left = rcItem.right-::GetSystemMetrics(SM_CXHTHUMB);;
00271     pDC->Draw3dRect(rcItem, m_clrNormal, m_clrNormal);
00272
00273     // Cover up NORMAL 3D shadow on drop arrow.
00274     rcItem.DeflateRect(1,1);
00275     pDC->Draw3dRect(rcItem, m_clrNormal, m_clrNormal);
00276
00277     if (!IsWindowEnabled()) {
00278         if(bRelease == true) {
00279             ReleaseDC(pDC);
00280         }
00281         return;
00282     }
00283
00284     rcItem.InflateRect(0,1);
00285     switch (eState)
00286     {
00287     case NORMAL:
00288         pDC->Draw3dRect(rcItem, m_clrHilite, m_clrHilite);
00289         rcItem.left -= 1;
00290         pDC->Draw3dRect(rcItem, m_clrHilite, m_clrHilite);
00291         break;
00292
00293     case RAISED:
00294         pDC->Draw3dRect(rcItem, m_clrHilite, m_clrShadow);
00295         break;
00296
00297     case PRESSED:
00298         rcItem.OffsetRect(1,1);
00299         pDC->Draw3dRect(rcItem, m_clrShadow, m_clrHilite);
00300         break;
00301     }
00302
00303     // KStowell - cleanup.
00304     if(bRelease == true) {
00305         ReleaseDC(pDC);
00306     }
00307 }

_CJXLIB_INLINE void CCJFlatComboBox::EnableAutoCompletion ( BOOL bEnable = TRUE ) [virtual]

Definition at line 208 of file CJFlatComboBox.h.

00209     { ASSERT(::IsWindow(m_hWnd)); m_bAutoComp = bEnable; }

BOOL CCJFlatComboBox::IsWin95 ( )

Definition at line 374 of file CJFlatComboBox.cpp.

Referenced by PreTranslateMessage().

00375 {
00376     OSVERSIONINFO info;
00377     info.dwOSVersionInfoSize = sizeof(info);
00378     GetVersionEx( &info );
00379     return ((VER_PLATFORM_WIN32_WINDOWS == info.dwPlatformId) && (info.dwMinorVersion == 0));
00380 }

void CCJFlatComboBox::OnEditUpdate ( ) [protected]

Definition at line 342 of file CJFlatComboBox.cpp.

00343 {
00344     // if we are not to auto update the text, get outta here
00345     if (!m_bAutoComp)
00346         return;
00347
00348     // Get the text in the edit box
00349     CString str;
00350     GetWindowText(str);
00351     int nLength = str.GetLength();
00352
00353     // Currently selected range
00354     DWORD dwCurSel = GetEditSel();
00355     WORD dStart = LOWORD(dwCurSel);
00356     WORD dEnd   = HIWORD(dwCurSel);
00357
00358     // Search for, and select in, and string in the combo box that is prefixed
00359     // by the text in the edit box
00360     if (SelectString(-1, str) == CB_ERR)
00361     {
00362         SetWindowText(str);     // No text selected, so restore what was there before
00363         if (dwCurSel != CB_ERR)
00364             SetEditSel(dStart, dEnd);   //restore cursor postion
00365     }
00366
00367     // Set the text selection as the additional text that we have added
00368     if (dEnd < nLength && dwCurSel != CB_ERR)
00369         SetEditSel(dStart, dEnd);
00370     else
00371         SetEditSel(nLength, -1);
00372 }

BOOL CCJFlatComboBox::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 391 of file CJFlatComboBox.cpp.

00392 {
00393     // KStowell - overridden for flicker-free drawing.
00394     UNUSED_ALWAYS(pDC);
00395     return TRUE;
00396 }

void CCJFlatComboBox::OnKillFocus ( ) [protected]

Definition at line 315 of file CJFlatComboBox.cpp.

00316 {
00317     m_bHasFocus = FALSE;
00318     DrawCombo(NORMAL, m_clrNormal, m_clrNormal);
00319 }

void CCJFlatComboBox::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 168 of file CJFlatComboBox.cpp.

00169 {
00170     m_bLBtnDown = TRUE;
00171     CComboBox::OnLButtonDown(nFlags, point);
00172 }

void CCJFlatComboBox::OnLButtonUp | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 174 of file CJFlatComboBox.cpp.

00175 {
00176     m_bLBtnDown = FALSE;
00177     Invalidate();
00178     CComboBox::OnLButtonUp(nFlags, point);
00179 }

void CCJFlatComboBox::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 161 of file CJFlatComboBox.cpp.

00162 {
00163     SetTimer(1,10,NULL);
00164     OnTimer(1);
00165     CComboBox::OnMouseMove(nFlags, point);
00166 }

void CCJFlatComboBox::OnPaint ( ) [protected]

Definition at line 207 of file CJFlatComboBox.cpp.

00208 {
00209     ModifyStyleEx (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE,
00210         0, SWP_FRAMECHANGED);
00211
00212     CPaintDC dc(this);
00213
00214     // KStowell - Get the client rect.
00215     CRect rcClient;
00216     GetClientRect( &rcClient );
00217
00218     // KStowell - Create a memory device-context. This is done to help reduce
00219     // screen flicker, since we will paint the entire control to the
00220     // off screen device context first.
00221     CDC memDC;
00222     CBitmap bitmap;
00223     memDC.CreateCompatibleDC(&dc);
00224     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00225     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00226
00227     // let the control do its default drawing.
00228     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00229
00230     if (PointInRect() || m_bHasFocus) {
00231         DrawCombo(RAISED, m_clrShadow, m_clrHilite, &memDC);
00232     } else {
00233         DrawCombo(NORMAL, m_clrNormal, m_clrNormal, &memDC);
00234     }
00235
00236     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00237     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00238
00239     // KStowell - Cleanup resources.
00240     memDC.SelectObject(pOldBitmap);
00241     memDC.DeleteDC();
00242     bitmap.DeleteObject();
00243 }

void CCJFlatComboBox::OnSetFocus ( ) [protected]

Definition at line 309 of file CJFlatComboBox.cpp.

00310 {
00311     m_bHasFocus = TRUE;
00312     DrawCombo(RAISED, m_clrShadow, m_clrHilite);
00313 }

void CCJFlatComboBox::OnSysColorChange ( ) [protected]

Definition at line 382 of file CJFlatComboBox.cpp.

00383 {
00384     CComboBox::OnSysColorChange();
00385
00386     m_clrHilite = ::GetSysColor(COLOR_BTNHIGHLIGHT);
00387     m_clrShadow = ::GetSysColor(COLOR_BTNSHADOW);
00388     m_clrNormal = ::GetSysColor(COLOR_BTNFACE);
00389 }

void CCJFlatComboBox::OnTimer ( UINT nIDEvent ) [protected]

Definition at line 181 of file CJFlatComboBox.cpp.

00182 {
00183     UNUSED_ALWAYS(nIDEvent);
00184
00185     if (m_bLBtnDown==TRUE) { // OnLButtonDown, show PRESSED.
00186         KillTimer (1);
00187         if (m_bPainted == TRUE) {
00188             DrawCombo(PRESSED, m_clrShadow, m_clrHilite);
00189             m_bPainted = FALSE;
00190         }
00191     } else if (!PointInRect() && !m_bHasFocus) { // If mouse leaves, show flat.
00192         KillTimer (1);
00193         if (m_bPainted == TRUE) {
00194             DrawCombo(NORMAL, m_clrNormal, m_clrNormal);
00195             m_bPainted = FALSE;
00196         }
00197     } else { // On mouse over, show RAISED.
00198         if (m_bPainted == TRUE) {
00199             return;
00200         } else {
00201             m_bPainted = TRUE;
00202             DrawCombo(RAISED, m_clrShadow, m_clrHilite);
00203         }
00204     }
00205 }

_CJXLIB_INLINE BOOL CCJFlatComboBox::PointInRect ( ) [virtual]

Definition at line 211 of file CJFlatComboBox.h.

Referenced by OnPaint(), and OnTimer().

00212     { ASSERT(::IsWindow(m_hWnd)); CPoint pt; GetCursorPos(&pt); CRect rcItem; GetWindowRect(&rcItem); return rcItem.PtInRect(pt); }

BOOL CCJFlatComboBox::PreTranslateMessage ( MSG * pMsg ) [virtual]

Definition at line 321 of file CJFlatComboBox.cpp.

00322 {
00323     if(IsWin95()) // alexander Golde [alex@viona.de]
00324     {
00325         // Make sure that the keystrokes continue to the appropriate handlers
00326         if (pMsg->message == WM_KEYDOWN || pMsg->message==WM_KEYUP)
00327         {
00328             ::TranslateMessage(pMsg);
00329             ::DispatchMessage(pMsg);
00330             return TRUE;
00331         }
00332
00333         // Catch the Alt key so we don't choke if focus
00334         // is going to an owner drawn button
00335         if (pMsg->message == WM_SYSCHAR)
00336             return TRUE;
00337     }
00338
00339     return CComboBox::PreTranslateMessage(pMsg);
00340 }

Member Data Documentation

BOOL CCJFlatComboBox::m_bAutoComp [protected]

Definition at line 155 of file CJFlatComboBox.h.

BOOL CCJFlatComboBox::m_bHasFocus [protected]

Definition at line 154 of file CJFlatComboBox.h.

BOOL CCJFlatComboBox::m_bLBtnDown [protected]

Definition at line 152 of file CJFlatComboBox.h.

BOOL CCJFlatComboBox::m_bPainted [protected]

Definition at line 153 of file CJFlatComboBox.h.

COLORREF CCJFlatComboBox::m_clrHilite [protected]

Definition at line 156 of file CJFlatComboBox.h.

COLORREF CCJFlatComboBox::m_clrNormal [protected]

Definition at line 158 of file CJFlatComboBox.h.

COLORREF CCJFlatComboBox::m_clrShadow [protected]

Definition at line 157 of file CJFlatComboBox.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJFlatComboBox.h
  • WinCvs/CJLib/CJLibrary/CJFlatComboBox.cpp
Generated on Sun Oct 21 12:46:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJFlatHeaderCtrl Class Reference

#include <CJFlatHeaderCtrl.h>

Inheritance diagram for CCJFlatHeaderCtrl:

[legend]
Collaboration diagram for CCJFlatHeaderCtrl:

[legend]
List of all members.

Public Methods

CCJFlatHeaderCtrl ()
virtual | ~CCJFlatHeaderCtrl ()
virtual void | SetMenuID (UINT popupMenuID, UINT popToolbarID=0, int nPos=0)
virtual UINT | GetMenuID ()
virtual void | InitializeHeader (bool bBoldFont)
virtual void | SetFontBold (BOOL bBoldFont=TRUE)
virtual int | SetSortImage (int nCol, BOOL bAsc)
virtual void | DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)

Protected Methods

virtual void | DrawFlatBorder (CDC *pDC)
virtual void | ResizeWindow ()
virtual int | CCJFlatHeaderCtrl::GetItemCount () const
virtual BOOL | GetOrderArray (LPINT piArray, int iCount=-1)
virtual void | PreSubclassWindow ()
afx_msg void | OnPaint ()
afx_msg void | OnRButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnMeasureItem (int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
afx_msg LRESULT | OnMenuChar (UINT nChar, UINT nFlags, CMenu *pMenu)
afx_msg void | OnInitMenuPopup (CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnWindowPosChanged (WINDOWPOS *lpwndpos)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)

Protected Attributes

UINT | m_popToolbarID
UINT | m_popupMenuID
CCJMenu m_popupMenu
int | m_nPos
BOOL | m_bBoldFont
BOOL | m_bLBtnDown
BOOL | m_bSortAsc
CFont | m_Font
int | m_nOffset
int | m_nSortCol
CWnd * m_pParentWnd
CRect | m_rcOldSize

Constructor & Destructor Documentation

CCJFlatHeaderCtrl::CCJFlatHeaderCtrl ( )

Definition at line 139 of file CJFlatHeaderCtrl.cpp.

00140 {
00141     m_nSortCol      = -1;
00142     m_bBoldFont     = FALSE;
00143     m_nOffset       = 6;
00144     m_bLBtnDown     = FALSE;
00145     m_popupMenuID   = 0;
00146     m_popToolbarID  = 0;
00147     m_nPos          = 0;
00148     m_pParentWnd    = NULL;
00149 }

CCJFlatHeaderCtrl::~CCJFlatHeaderCtrl ( ) [virtual]

Definition at line 151 of file CJFlatHeaderCtrl.cpp.

00152 {
00153     // fix potential resource leak - KStowell - 10-22-99.
00154     m_Font.DeleteObject();
00155 }

Member Function Documentation

virtual int CCJFlatHeaderCtrl::CCJFlatHeaderCtrl::GetItemCount ( ) const [protected, virtual]

void CCJFlatHeaderCtrl::DrawFlatBorder ( CDC * pDC ) [protected, virtual]

Definition at line 358 of file CJFlatHeaderCtrl.cpp.

Referenced by OnPaint().

00359 {
00360     CRect rci;
00361     GetWindowRect(&rci);
00362     ScreenToClient(&rci);
00363
00364     // Cover up thick 3D border.
00365     pDC->Draw3dRect(rci, afxData.clrBtnFace, afxData.clrBtnFace);
00366     rci.DeflateRect(1,1);
00367     pDC->Draw3dRect(rci, afxData.clrBtnFace, afxData.clrBtnFace);
00368
00369     // Draw flat style border around entire header.
00370     rci.InflateRect(1,1);
00371     pDC->Draw3dRect(rci, afxData.clrBtnHilite, afxData.clrBtnShadow);
00372
00373     // Create the pens for further cover-up.
00374     CPen penLite(PS_SOLID, 1, afxData.clrBtnHilite);
00375     CPen penShad(PS_SOLID, 1, afxData.clrBtnShadow);
00376     CPen penFace(PS_SOLID, 1, afxData.clrBtnFace);
00377     CPen *pOldPen = pDC->SelectObject( &penLite );
00378
00379     // Set up the header item struct.
00380     HD_ITEM hdi;
00381     memset (&hdi, 0, sizeof(HD_ITEM));
00382     hdi.fmt  = HDF_STRING | HDF_LEFT | HDF_OWNERDRAW;
00383     hdi.mask = HDI_WIDTH | HDI_TEXT | HDI_FORMAT | HDI_ORDER; // Yiannhs :1999-10-19
00384     int cx = 0;
00385
00386     long j = GetItemCount();    //Yiannhs
00387     long i = 0;                 //Yiannhs
00388
00389     long * ItemOrders = new long[j];    //Yiannhs :1999-10-19
00390     for( i=0; i<j; i++ ) {              //Yiannhs :1999-10-19
00391         GetItem(i, &hdi);               //Yiannhs :1999-10-19
00392         ItemOrders[hdi.iOrder] = i;     //Yiannhs :1999-10-19
00393     }
00394
00395     hdi.fmt  = HDF_STRING | HDF_LEFT | HDF_OWNERDRAW;   //Yiannhs :1999-10-19
00396     hdi.mask = HDI_WIDTH | HDI_TEXT | HDI_FORMAT;       //Yiannhs :1999-10-19
00397
00398     // For each header item found, do further cover up.
00399     for (i = 0; i < j; ++i)
00400     {
00401         GetItem( ItemOrders[i], &hdi);
00402         cx += hdi.cxy;
00403
00404         pDC->SelectObject(&penShad);
00405         pDC->MoveTo(cx, 2);
00406         pDC->LineTo(cx, rci.bottom-2);
00407
00408         pDC->SelectObject(&penLite);
00409         pDC->MoveTo(cx+1, 2);
00410         pDC->LineTo(cx+1, rci.bottom-2);
00411
00412         pDC->SelectObject(&penFace);
00413         pDC->MoveTo(cx-1, 2);
00414         pDC->LineTo(cx-1, rci.bottom-2);
00415
00416         pDC->SelectObject(&penFace);
00417         pDC->MoveTo(cx-2, 2);
00418         pDC->LineTo(cx-2, rci.bottom-2);
00419     }
00420
00421     delete [] ItemOrders; //Yiannhs :1999-10-19
00422
00423     // Restore the pen and release device context.
00424     pDC->SelectObject( pOldPen );
00425
00426     // fix potential resource leak - KStowell - 10-21-99
00427     penLite.DeleteObject();
00428     penShad.DeleteObject();
00429     penFace.DeleteObject();
00430 }

void CCJFlatHeaderCtrl::DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct ) [virtual]

Definition at line 211 of file CJFlatHeaderCtrl.cpp.

00212 {
00213     ASSERT(lpDrawItemStruct != NULL);
00214
00215     // define some temporary variables.
00216     CDC*    pDC         = CDC::FromHandle( lpDrawItemStruct->hDC );
00217     CRect   rcItem      = lpDrawItemStruct->rcItem;
00218     CRect   rcIcon      = lpDrawItemStruct->rcItem;
00219     int     nState      = lpDrawItemStruct->itemState;
00220     int     nItemID     = lpDrawItemStruct->itemID;
00221     int     nSavedDC    = pDC->SaveDC();
00222
00223     // Paint the background.
00224     pDC->FillSolidRect(rcItem, afxData.clrBtnFace);
00225     pDC->SetBkMode(TRANSPARENT);
00226
00227     // Set clipping region to limit drawing within column
00228     CRgn rgn;
00229     rgn.CreateRectRgnIndirect( &rcItem );
00230     pDC->SelectObject( &rgn );
00231     rgn.DeleteObject();
00232
00233     // Get the column text and format
00234     TCHAR buf[256];
00235     HD_ITEM hditem;
00236
00237     hditem.mask = HDI_TEXT | HDI_FORMAT;
00238     hditem.pszText = buf;
00239     hditem.cchTextMax = 255;
00240
00241     GetItem( nItemID, &hditem );
00242
00243     // Determine format for drawing column label
00244     UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP
00245         | DT_VCENTER | DT_END_ELLIPSIS ;
00246
00247     if( hditem.fmt & HDF_CENTER) {
00248         uFormat |= DT_CENTER;
00249     } else if( hditem.fmt & HDF_RIGHT) {
00250         uFormat |= DT_RIGHT;
00251     } else {
00252         uFormat |= DT_LEFT;
00253     }
00254
00255     // Adjust the rect if the mouse button is pressed on it
00256     if( nState == ODS_SELECTED ) {
00257         rcItem.left++;
00258         rcItem.top += 2;
00259         rcItem.right++;
00260     }
00261
00262     // Adjust the rect further if Sort arrow is to be displayed
00263     if( nItemID == m_nSortCol ) {
00264         rcItem.right -= 3 * m_nOffset;
00265     }
00266
00267     rcItem.left += m_nOffset;
00268     rcItem.right -= m_nOffset;
00269
00270     // Draw column label
00271     if( rcItem.left < rcItem.right ) {
00272         if (m_bBoldFont) {
00273             CFont* pOldFont = pDC->SelectObject(&m_Font);
00274             pDC->DrawText(buf,-1,rcItem, uFormat);
00275             pDC->SelectObject(pOldFont);
00276         } else {
00277             pDC->DrawText(buf,-1,rcItem, uFormat);
00278         }
00279     }
00280
00281     // Draw the Sort arrow
00282     if( nItemID == m_nSortCol )
00283     {
00284         // Set up pens to use for drawing the triangle
00285         CPen penLite(PS_SOLID, 1, afxData.clrBtnHilite);
00286         CPen penShad(PS_SOLID, 1, afxData.clrBtnShadow);
00287         CPen *pOldPen = pDC->SelectObject( &penLite );
00288
00289         if( m_bSortAsc )
00290         {
00291             // Draw triangle pointing upwards
00292             pDC->MoveTo( rcIcon.right - 2*m_nOffset, m_nOffset-1);
00293             pDC->LineTo( rcIcon.right - 3*m_nOffset/2, rcIcon.bottom - m_nOffset );
00294             pDC->LineTo( rcIcon.right - 5*m_nOffset/2-2, rcIcon.bottom - m_nOffset );
00295             pDC->MoveTo( rcIcon.right - 5*m_nOffset/2-1, rcIcon.bottom - m_nOffset-1 );
00296
00297             pDC->SelectObject( &penShad );
00298             pDC->LineTo( rcIcon.right - 2*m_nOffset, m_nOffset-2);
00299         }
00300         else
00301         {
00302             // Draw triangle pointing downwords
00303             pDC->MoveTo( rcIcon.right - 3*m_nOffset/2, m_nOffset-1);
00304             pDC->LineTo( rcIcon.right - 2*m_nOffset-1, rcIcon.bottom - m_nOffset + 1 );
00305             pDC->MoveTo( rcIcon.right - 2*m_nOffset-1, rcIcon.bottom - m_nOffset );
00306
00307             pDC->SelectObject( &penShad );
00308             pDC->LineTo( rcIcon.right - 5*m_nOffset/2-1, m_nOffset -1 );
00309             pDC->LineTo( rcIcon.right - 3*m_nOffset/2, m_nOffset -1);
00310         }
00311
00312         // Restore the pen
00313         pDC->SelectObject( pOldPen );
00314
00315         // fix potential resource leak - KStowell - 10-21-99
00316         penLite.DeleteObject();
00317         penShad.DeleteObject();
00318     }
00319
00320     // restore the device context
00321     pDC->RestoreDC(nSavedDC);
00322 }

_CJXLIB_INLINE UINT CCJFlatHeaderCtrl::GetMenuID ( ) [virtual]

Definition at line 217 of file CJFlatHeaderCtrl.h.

00218     { ASSERT(::IsWindow(m_hWnd)); return m_popupMenuID; }

BOOL CCJFlatHeaderCtrl::GetOrderArray | ( | LPINT | piArray,
 |  | int | iCount = -1
 | ) | [protected, virtual]

Definition at line 501 of file CJFlatHeaderCtrl.cpp.

00502 {
00503     ASSERT(::IsWindow(m_hWnd));
00504
00505     // if -1 was passed, find the count ourselves
00506
00507     int nCount = iCount;
00508     if (nCount == -1)
00509     {
00510         nCount = GetItemCount();
00511
00512         if (nCount == -1)
00513             return FALSE;
00514     }
00515
00516     ASSERT(AfxIsValidAddress(piArray, iCount * sizeof(int)));
00517
00518     return (BOOL) ::SendMessage(m_hWnd, HDM_GETORDERARRAY,
00519         (WPARAM) iCount, (LPARAM) piArray);
00520 }

void CCJFlatHeaderCtrl::InitializeHeader ( bool bBoldFont ) [virtual]

Definition at line 173 of file CJFlatHeaderCtrl.cpp.

Referenced by CCJListView::SubclassHeader(), and CCJListCtrl::SubclassHeader().

00174 {
00175     m_Font.DeleteObject();
00176     NONCLIENTMETRICS ncm;
00177     ncm.cbSize = sizeof(ncm);
00178     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00179     if(bBoldFont)
00180         ncm.lfMessageFont.lfWeight = 700;
00181     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00182     SetFont(&m_Font);
00183
00184     m_bBoldFont = bBoldFont;
00185 }

int CCJFlatHeaderCtrl::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 533 of file CJFlatHeaderCtrl.cpp.

00534 {
00535     if (CHeaderCtrl::OnCreate(lpCreateStruct) == -1)
00536         return -1;
00537
00538     m_pParentWnd = CWnd::FromHandle(lpCreateStruct->hwndParent);
00539     ASSERT(m_pParentWnd);
00540
00541     ResizeWindow();
00542     return 0;
00543 }

BOOL CCJFlatHeaderCtrl::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 571 of file CJFlatHeaderCtrl.cpp.

00572 {
00573     // KStowell - overridden for flicker-free drawing.
00574     UNUSED_ALWAYS(pDC);
00575     return TRUE;
00576 }

void CCJFlatHeaderCtrl::OnInitMenuPopup | ( | CMenu * | pPopupMenu,
 |  | UINT | nIndex,
 |  | BOOL | bSysMenu
 | ) | [protected]

Definition at line 489 of file CJFlatHeaderCtrl.cpp.

00490 {
00491     CHeaderCtrl::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
00492
00493     if(!bSysMenu) {
00494         if (m_popupMenu.IsMenu(pPopupMenu)) {
00495             CCJMenu::UpdateMenu(pPopupMenu);
00496         }
00497     }
00498 }

void CCJFlatHeaderCtrl::OnMeasureItem | ( | int | nIDCtl,
 |  | LPMEASUREITEMSTRUCT | lpMeasureItemStruct
 | ) | [protected]

Definition at line 463 of file CJFlatHeaderCtrl.cpp.

00464 {
00465     if (lpMeasureItemStruct->CtlType == ODT_MENU)
00466     {
00467         if (IsMenu((HMENU)lpMeasureItemStruct->itemID)) {
00468             CMenu* pMenu = CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
00469
00470             if (m_popupMenu.IsMenu(pMenu)) {
00471                 m_popupMenu.MeasureItem(lpMeasureItemStruct);
00472                 return;
00473             }
00474         }
00475     }
00476
00477     CHeaderCtrl::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
00478 }

LRESULT CCJFlatHeaderCtrl::OnMenuChar | ( | UINT | nChar,
 |  | UINT | nFlags,
 |  | CMenu * | pMenu
 | ) | [protected]

Definition at line 480 of file CJFlatHeaderCtrl.cpp.

00481 {
00482     if (m_popupMenu.IsMenu(pMenu)) {
00483         return CCJMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
00484     }
00485
00486     return CHeaderCtrl::OnMenuChar(nChar, nFlags, pMenu);
00487 }

void CCJFlatHeaderCtrl::OnPaint ( ) [protected]

Definition at line 324 of file CJFlatHeaderCtrl.cpp.

00325 {
00326     CPaintDC dc(this); // device context for painting
00327
00328     // KStowell - Get the client rect.
00329     CRect rcClient;
00330     GetClientRect( &rcClient );
00331
00332     // KStowell - Create a memory device-context. This is done to help reduce
00333     // screen flicker, since we will paint the entire control to the
00334     // off screen device context first.
00335     CDC memDC;
00336     CBitmap bitmap;
00337     memDC.CreateCompatibleDC(&dc);
00338     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00339     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00340     memDC.FillSolidRect(rcClient, afxData.clrBtnFace);
00341
00342     // First let the control do its default drawing.
00343     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00344
00345     // KStowell - Repaint the background.
00346     DrawFlatBorder(&memDC);
00347
00348     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00349     dc.BitBlt( rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC,
00350         rcClient.left, rcClient.top, SRCCOPY );
00351
00352     // KStowell - Cleanup resources.
00353     memDC.SelectObject(pOldBitmap);
00354     memDC.DeleteDC();
00355     bitmap.DeleteObject();
00356 }

void CCJFlatHeaderCtrl::OnRButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 432 of file CJFlatHeaderCtrl.cpp.

00433 {
00434     // No menu was defined...
00435     if (!m_popupMenuID) {
00436         TRACE0( "Warning: No menu resource was associated with CCJTabCtrl.\n" );
00437         return;
00438     }
00439
00440     // Since we are using the main window as the
00441     // parent, we need to convert the point to screen
00442     // coordinates...
00443     CPoint pt = point;
00444     ClientToScreen(&pt);
00445
00446     // Load the popup menu.
00447     VERIFY(m_popupMenu.LoadMenu(m_popupMenuID));
00448     CCJMenu* pPopup = (CCJMenu*)m_popupMenu.GetSubMenu(m_nPos);
00449     ASSERT(pPopup != NULL);
00450
00451     // Load toolbar resource if any for menu icons.
00452     if (m_popToolbarID) {
00453         pPopup->LoadToolbar(m_popToolbarID);
00454     }
00455
00456     // Display the popup menu, use the main window as its parent.
00457     pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
00458         pt.x, pt.y, AfxGetMainWnd());
00459
00460     m_popupMenu.DestroyMenu();
00461 }

void CCJFlatHeaderCtrl::OnWindowPosChanged ( WINDOWPOS * lpwndpos ) [protected]

Definition at line 545 of file CJFlatHeaderCtrl.cpp.

00546 {
00547     CHeaderCtrl::OnWindowPosChanged(lpwndpos);
00548     ResizeWindow();
00549 }

void CCJFlatHeaderCtrl::PreSubclassWindow ( ) [protected, virtual]

Definition at line 523 of file CJFlatHeaderCtrl.cpp.

00524 {
00525     CHeaderCtrl::PreSubclassWindow();
00526
00527     m_pParentWnd = GetParent();
00528     ASSERT(m_pParentWnd);
00529
00530     ResizeWindow();
00531 }

void CCJFlatHeaderCtrl::ResizeWindow ( ) [protected, virtual]

Definition at line 551 of file CJFlatHeaderCtrl.cpp.

Referenced by OnCreate(), OnWindowPosChanged(), and PreSubclassWindow().

00552 {
00553     ASSERT_VALID(this);
00554     ASSERT_VALID(m_pParentWnd);
00555
00556     // Get the client size of the parent window, this will give us the
00557     // actual width of the header we are looking for.
00558     CRect rcParent;
00559     m_pParentWnd->GetClientRect(&rcParent);
00560
00561     // Get the size of the header control, we will need this for the
00562     // height of the header.
00563     CRect rcWnd;
00564     GetWindowRect(&rcWnd);
00565
00566     // Now, resize the window.
00567     SetWindowPos(NULL, 0, 0, rcParent.Width(), rcWnd.Height(),
00568         SWP_NOMOVE|SWP_FRAMECHANGED);
00569 }

_CJXLIB_INLINE void CCJFlatHeaderCtrl::SetFontBold ( BOOL bBoldFont = TRUE ) [virtual]

Definition at line 220 of file CJFlatHeaderCtrl.h.

00221     { ASSERT(::IsWindow(m_hWnd)); m_bBoldFont = bBoldFont; }

_CJXLIB_INLINE void CCJFlatHeaderCtrl::SetMenuID | ( | UINT | popupMenuID,
 |  | UINT | popToolbarID = 0,
 |  | int | nPos = 0
 | ) | [virtual]

Definition at line 214 of file CJFlatHeaderCtrl.h.

00215     { ASSERT(::IsWindow(m_hWnd)); m_popupMenuID=popupMenuID; m_popToolbarID=popToolbarID; m_nPos=nPos; }

int CCJFlatHeaderCtrl::SetSortImage | ( | int | nCol,
 |  | BOOL | bAsc
 | ) | [virtual]

Definition at line 187 of file CJFlatHeaderCtrl.cpp.

Referenced by CCJListView::OnNotify(), and CCJListCtrl::OnNotify().

00188 {
00189     int nPrevCol = m_nSortCol;
00190
00191     m_nSortCol = nCol;
00192     m_bSortAsc = bAsc;
00193
00194     // Change the item to ownder drawn
00195     HD_ITEM hditem;
00196
00197     hditem.mask = HDI_BITMAP | HDI_FORMAT;
00198     GetItem( nCol, &hditem );
00199     if (hditem.hbm == NULL)
00200     {
00201         hditem.fmt |= HDF_OWNERDRAW;
00202         SetItem( nCol, &hditem );
00203
00204         // Invalidate header control so that it gets redrawn
00205         Invalidate();
00206     }
00207
00208     return nPrevCol;
00209 }

Member Data Documentation

CFont CCJFlatHeaderCtrl::m_Font [protected]

Definition at line 136 of file CJFlatHeaderCtrl.h.

BOOL CCJFlatHeaderCtrl::m_bBoldFont [protected]

Definition at line 133 of file CJFlatHeaderCtrl.h.

BOOL CCJFlatHeaderCtrl::m_bLBtnDown [protected]

Definition at line 134 of file CJFlatHeaderCtrl.h.

BOOL CCJFlatHeaderCtrl::m_bSortAsc [protected]

Definition at line 135 of file CJFlatHeaderCtrl.h.

int CCJFlatHeaderCtrl::m_nOffset [protected]

Definition at line 137 of file CJFlatHeaderCtrl.h.

int CCJFlatHeaderCtrl::m_nPos [protected]

Definition at line 132 of file CJFlatHeaderCtrl.h.

int CCJFlatHeaderCtrl::m_nSortCol [protected]

Definition at line 138 of file CJFlatHeaderCtrl.h.

CWnd* CCJFlatHeaderCtrl::m_pParentWnd [protected]

Definition at line 139 of file CJFlatHeaderCtrl.h.

UINT CCJFlatHeaderCtrl::m_popToolbarID [protected]

Definition at line 127 of file CJFlatHeaderCtrl.h.

CCJMenu CCJFlatHeaderCtrl::m_popupMenu [protected]

Definition at line 131 of file CJFlatHeaderCtrl.h.

UINT CCJFlatHeaderCtrl::m_popupMenuID [protected]

Definition at line 130 of file CJFlatHeaderCtrl.h.

CRect CCJFlatHeaderCtrl::m_rcOldSize [protected]

Definition at line 140 of file CJFlatHeaderCtrl.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJFlatHeaderCtrl.h
  • WinCvs/CJLib/CJLibrary/CJFlatHeaderCtrl.cpp
Generated on Sun Oct 21 12:46:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJFlatSplitterWnd Class Reference

#include <CJFlatSplitterWnd.h>

Inheritance diagram for CCJFlatSplitterWnd:

[legend]
Collaboration diagram for CCJFlatSplitterWnd:

[legend]
List of all members.

Public Methods

CCJFlatSplitterWnd ()
virtual | ~CCJFlatSplitterWnd ()
virtual void | DisableFlatStyle (BOOL bDisable=TRUE)
virtual BOOL | SwitchView (int nRow, int nCol, CView *pNewView)
virtual BOOL | ReplaceView (int nRow, int nCol, CRuntimeClass *pViewClass)
virtual void | ShowColumn ()
virtual void | HideColumn (int nColHide)
virtual void | ShowRow ()
virtual void | HideRow (int nRowHide)
virtual void | OnDrawSplitter (CDC *pDC, ESplitType nType, const CRect &rect)

Protected Methods

afx_msg void | OnPaint ()

Protected Attributes

int | m_nHiddenCol
int | m_nHiddenRow
BOOL | m_bFlatSplitter

Constructor & Destructor Documentation

CCJFlatSplitterWnd::CCJFlatSplitterWnd ( )

Definition at line 66 of file CJFlatSplitterWnd.cpp.

00067 {
00068     m_bFlatSplitter = TRUE;
00069     m_nHiddenCol    = -1;
00070     m_nHiddenRow    = -1;
00071 }

CCJFlatSplitterWnd::~CCJFlatSplitterWnd ( ) [virtual]

Definition at line 73 of file CJFlatSplitterWnd.cpp.

00074 {
00075
00076 }

Member Function Documentation

_CJXLIB_INLINE void CCJFlatSplitterWnd::DisableFlatStyle ( BOOL bDisable = TRUE ) [virtual]

Definition at line 125 of file CJFlatSplitterWnd.h.

00126     { m_bFlatSplitter = !bDisable; }

void CCJFlatSplitterWnd::HideColumn ( int nColHide ) [virtual]

Definition at line 288 of file CJFlatSplitterWnd.cpp.

00289 {
00290     ASSERT_VALID( this );
00291     ASSERT( m_nCols > 1 );
00292     ASSERT( nColHide < m_nCols );
00293     ASSERT( m_nHiddenCol == -1 );
00294     m_nHiddenCol = nColHide;
00295
00296     // if the column has an active window -- change it
00297     int nActiveRow, nActiveCol;
00298     if( GetActivePane( &nActiveRow, &nActiveCol ) != NULL )
00299     {
00300         if( nActiveCol == nColHide )
00301         {
00302             if( ++nActiveCol >= m_nCols )
00303                 nActiveCol = 0;
00304             SetActivePane( nActiveRow, nActiveCol );
00305         }
00306     }
00307
00308     // hide all column panes
00309     for( int nRow = 0; nRow < m_nRows; nRow++)
00310     {
00311         CWnd* pPaneHide = GetPane(nRow, nColHide);
00312         ASSERT( pPaneHide != NULL );
00313
00314         pPaneHide->ShowWindow(SW_HIDE);
00315         pPaneHide->SetDlgCtrlID( AFX_IDW_PANE_FIRST+m_nCols + 16*nRow );
00316
00317         for( int nCol = nColHide + 1; nCol < m_nCols; nCol++ )
00318         {
00319             CWnd* pPane = GetPane( nRow, nCol );
00320             ASSERT( pPane != NULL );
00321
00322             pPane->SetDlgCtrlID( IdFromRowCol( nRow, nCol - 1 ));
00323         }
00324     }
00325
00326     m_nCols--;
00327     m_pColInfo[m_nCols].nCurSize = m_pColInfo[nColHide].nCurSize;
00328     RecalcLayout();
00329 }

void CCJFlatSplitterWnd::HideRow ( int nRowHide ) [virtual]

Definition at line 203 of file CJFlatSplitterWnd.cpp.

00204 {
00205     ASSERT_VALID( this );
00206     ASSERT( m_nRows > 1 );
00207     ASSERT( nRowHide < m_nRows );
00208     ASSERT( m_nHiddenRow == -1 );
00209     m_nHiddenRow = nRowHide;
00210
00211     int nActiveRow, nActiveCol;
00212
00213     // if the nRow has an active window -- change it
00214     if( GetActivePane( &nActiveRow, &nActiveCol ) != NULL )
00215     {
00216         if( nActiveRow == nRowHide )
00217         {
00218             if( ++nActiveRow >= m_nRows )
00219                 nActiveRow = 0;
00220             SetActivePane( nActiveRow, nActiveCol );
00221         }
00222     }
00223
00224     // hide all nRow panes.
00225     for( int nCol = 0; nCol < m_nCols; ++nCol )
00226     {
00227         CWnd* pPaneHide = GetPane( nRowHide, nCol );
00228         ASSERT( pPaneHide != NULL );
00229
00230         pPaneHide->ShowWindow( SW_HIDE );
00231         pPaneHide->SetDlgCtrlID( AFX_IDW_PANE_FIRST+nCol + 16*m_nRows );
00232
00233         for( int nRow = nRowHide+1; nRow < m_nRows; ++nRow )
00234         {
00235             CWnd* pPane = GetPane( nRow, nCol );
00236             ASSERT( pPane != NULL );
00237
00238             pPane->SetDlgCtrlID( IdFromRowCol( nRow-1, nCol ));
00239         }
00240     }
00241
00242     m_nRows--;
00243     m_pRowInfo[m_nRows].nCurSize = m_pRowInfo[nRowHide].nCurSize;
00244     RecalcLayout();
00245 }

void CCJFlatSplitterWnd::OnDrawSplitter | ( | CDC * | pDC,
 |  | ESplitType | nType,
 |  | const CRect & | rectArg
 | ) | [virtual]

Definition at line 87 of file CJFlatSplitterWnd.cpp.

Referenced by OnPaint().

00089 {
00090     if( m_bFlatSplitter )
00091     {
00092         // if pDC == NULL, then just invalidate
00093         if (pDC == NULL)
00094         {
00095             RedrawWindow(rectArg, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
00096             return;
00097         }
00098         ASSERT_VALID(pDC);
00099
00100         // otherwise, actually draw
00101         CRect rect = rectArg;
00102         switch (nType)
00103         {
00104         case splitBorder:
00105             ASSERT(afxData.bWin4);
00106             pDC->Draw3dRect(rect, afxData.clrBtnFace, afxData.clrBtnFace);
00107             rect.InflateRect(-CX_BORDER, -CY_BORDER);
00108             pDC->Draw3dRect(rect, afxData.clrBtnShadow, afxData.clrBtnHilite);
00109             return;
00110
00111         case splitIntersection:
00112             ASSERT(!afxData.bWin4);
00113             break;
00114
00115         case splitBox:
00116             if (afxData.bWin4)
00117             {
00118                 pDC->Draw3dRect(rect, afxData.clrBtnFace, afxData.clrWindowFrame);
00119                 rect.InflateRect(-CX_BORDER, -CY_BORDER);
00120                 pDC->Draw3dRect(rect, afxData.clrBtnHilite, afxData.clrBtnShadow);
00121                 rect.InflateRect(-CX_BORDER, -CY_BORDER);
00122                 break;
00123             }
00124             // fall through...
00125         case splitBar:
00126             if (!afxData.bWin4)
00127             {
00128                 pDC->Draw3dRect(rect, afxData.clrBtnHilite, afxData.clrBtnShadow);
00129                 rect.InflateRect(-CX_BORDER, -CY_BORDER);
00130             }
00131             break;
00132
00133         default:
00134             ASSERT(FALSE);  // unknown splitter type
00135         }
00136
00137         // fill the middle
00138         pDC->FillSolidRect(rect, afxData.clrBtnFace);
00139     }
00140
00141     else {
00142         CSplitterWnd::OnDrawSplitter(pDC, nType, rectArg);
00143     }
00144 }

void CCJFlatSplitterWnd::OnPaint ( ) [protected]

Definition at line 146 of file CJFlatSplitterWnd.cpp.

00147 {
00148     if( m_bFlatSplitter )
00149     {
00150         ASSERT_VALID(this);
00151         CPaintDC dc(this);
00152
00153         CRect rectClient;
00154         GetClientRect(&rectClient);
00155
00156         CRect rectInside;
00157         GetInsideRect(rectInside);
00158         rectInside.InflateRect(4,4);
00159
00160         // draw the splitter boxes
00161         if (m_bHasVScroll && m_nRows < m_nMaxRows)
00162         {
00163             OnDrawSplitter(&dc, splitBox,
00164                 CRect(rectInside.right, rectClient.top,
00165                 rectClient.right, rectClient.top + m_cySplitter));
00166         }
00167
00168         if (m_bHasHScroll && m_nCols < m_nMaxCols)
00169         {
00170             OnDrawSplitter(&dc, splitBox,
00171                 CRect(rectClient.left, rectInside.bottom,
00172                 rectClient.left + m_cxSplitter, rectClient.bottom));
00173         }
00174
00175         // extend split bars to window border (past margins)
00176         DrawAllSplitBars(&dc, rectInside.right, rectInside.bottom);
00177
00178         // draw splitter intersections (inside only)
00179         GetInsideRect(rectInside);
00180         dc.IntersectClipRect(rectInside);
00181         CRect rect;
00182         rect.top = rectInside.top;
00183         for (int row = 0; row < m_nRows - 1; row++)
00184         {
00185             rect.top += m_pRowInfo[row].nCurSize + m_cyBorderShare;
00186             rect.bottom = rect.top + m_cySplitter;
00187             rect.left = rectInside.left;
00188             for (int col = 0; col < m_nCols - 1; col++)
00189             {
00190                 rect.left += m_pColInfo[col].nCurSize + m_cxBorderShare;
00191                 rect.right = rect.left + m_cxSplitter;
00192                 OnDrawSplitter(&dc, splitIntersection, rect);
00193                 rect.left = rect.right + m_cxBorderShare;
00194             }
00195             rect.top = rect.bottom + m_cxBorderShare;
00196         }
00197     }
00198     else {
00199         CSplitterWnd::OnPaint();
00200     }
00201 }

BOOL CCJFlatSplitterWnd::ReplaceView | ( | int | nRow,
 |  | int | nCol,
 |  | CRuntimeClass * | pViewClass
 | ) | [virtual]

Definition at line 372 of file CJFlatSplitterWnd.cpp.

00373 {
00374     CView *pView = DYNAMIC_DOWNCAST( CView, GetPane( nRow, nCol ));
00375     ASSERT_KINDOF( CView, pView );
00376
00377     if( pView->IsKindOf( pViewClass ))
00378         return FALSE;
00379
00380     // Get pointer to CDocument object so that it can be used in the creation
00381     // process of the new view
00382     CDocument *pDoc = pView->GetDocument();
00383
00384     int nID = pView->GetDlgCtrlID();
00385     int nWidth, nHeight, nMinWidth, nMinHeight;
00386
00387     GetRowInfo( nRow, nWidth, nMinWidth );
00388     GetColumnInfo( nCol, nHeight, nMinHeight );
00389
00390     // Delete existing view
00391     DeleteView(nRow, nCol);
00392
00393     // Create new view
00394     CCreateContext context;
00395     context.m_pCurrentDoc = pDoc;
00396     CreateView( nRow, nCol, pViewClass, CSize( nWidth, nHeight ), &context );
00397     pView = DYNAMIC_DOWNCAST( CView, GetPane( nRow, nCol ));
00398     ASSERT_KINDOF( CView, pView );
00399
00400     pView->SetDlgCtrlID( nID );
00401
00402     SetRowInfo( nRow, nWidth, nMinWidth );
00403     SetColumnInfo( nCol, nHeight, nMinHeight );
00404     RecalcLayout();
00405
00406     return TRUE;
00407 }

void CCJFlatSplitterWnd::ShowColumn ( ) [virtual]

Definition at line 331 of file CJFlatSplitterWnd.cpp.

00332 {
00333     ASSERT_VALID( this );
00334     ASSERT( m_nCols < m_nMaxCols );
00335     ASSERT( m_nHiddenCol != -1 );
00336
00337     int nShowCol = m_nHiddenCol;
00338     m_nHiddenCol = -1;
00339
00340     int cxNew = m_pColInfo[m_nCols].nCurSize;
00341     m_nCols++;  // add a column
00342
00343     ASSERT( m_nCols == m_nMaxCols );
00344
00345     int nCol;
00346
00347     // Show the hidden column
00348     for( int nRow = 0; nRow < m_nRows; ++nRow )
00349     {
00350         CWnd* pPaneShow = GetDlgItem( AFX_IDW_PANE_FIRST+m_nCols + 16*nRow );
00351         ASSERT( pPaneShow != NULL );
00352         pPaneShow->ShowWindow( SW_SHOWNA );
00353
00354         for( nCol = m_nCols - 2; nCol >= nShowCol; --nCol )
00355         {
00356             CWnd* pPane = GetPane( nRow, nCol );
00357             ASSERT( pPane != NULL );
00358             pPane->SetDlgCtrlID( IdFromRowCol( nRow, nCol + 1 ));
00359         }
00360
00361         pPaneShow->SetDlgCtrlID( IdFromRowCol( nRow, nShowCol ));
00362     }
00363
00364     // new panes have been created -- recalculate layout
00365     for( nCol = nShowCol+1; nCol < m_nCols; nCol++ )
00366         m_pColInfo[nCol].nIdealSize = m_pColInfo[nCol - 1].nCurSize;
00367
00368     m_pColInfo[nShowCol].nIdealSize = cxNew;
00369     RecalcLayout();
00370 }

void CCJFlatSplitterWnd::ShowRow ( ) [virtual]

Definition at line 247 of file CJFlatSplitterWnd.cpp.

00248 {
00249     ASSERT_VALID( this );
00250     ASSERT( m_nRows < m_nMaxRows );
00251     ASSERT( m_nHiddenRow != -1 );
00252
00253     int nShowRow = m_nHiddenRow;
00254     m_nHiddenRow = -1;
00255
00256     int cyNew = m_pRowInfo[m_nRows].nCurSize;
00257     m_nRows++;  // add a nRow
00258
00259     ASSERT( m_nRows == m_nMaxRows );
00260
00261     int nRow;
00262
00263     // Show the hidden nRow
00264     for( int nCol = 0; nCol < m_nCols; ++nCol )
00265     {
00266         CWnd* pPaneShow = GetDlgItem( AFX_IDW_PANE_FIRST+nCol + 16*m_nRows );
00267         ASSERT( pPaneShow != NULL );
00268         pPaneShow->ShowWindow( SW_SHOWNA );
00269
00270         for( nRow = m_nRows - 2; nRow >= nShowRow; --nRow )
00271         {
00272             CWnd* pPane = GetPane( nRow, nCol );
00273             ASSERT( pPane != NULL );
00274             pPane->SetDlgCtrlID( IdFromRowCol( nRow + 1, nCol ));
00275         }
00276
00277         pPaneShow->SetDlgCtrlID( IdFromRowCol( nShowRow, nCol ));
00278     }
00279
00280     // new panes have been created -- recalculate layout
00281     for( nRow = nShowRow+1; nRow < m_nRows; nRow++ )
00282         m_pRowInfo[nRow].nIdealSize = m_pRowInfo[nRow - 1].nCurSize;
00283
00284     m_pRowInfo[nShowRow].nIdealSize = cyNew;
00285     RecalcLayout();
00286 }

BOOL CCJFlatSplitterWnd::SwitchView | ( | int | nRow,
 |  | int | nCol,
 |  | CView * | pNewView
 | ) | [virtual]

Definition at line 409 of file CJFlatSplitterWnd.cpp.

00410 {
00411     CView *pOldView = DYNAMIC_DOWNCAST( CView, GetPane( nRow, nCol ));
00412     ASSERT_KINDOF( CView, pOldView );
00413
00414     if( pOldView == pNewView )
00415         return FALSE;
00416
00417     int nOldID, nNewID;
00418
00419     nOldID = pOldView->GetDlgCtrlID();
00420     nNewID = pNewView->GetDlgCtrlID();
00421
00422     pOldView->ShowWindow(SW_HIDE);
00423     pNewView->ShowWindow(SW_SHOW);
00424
00425     pOldView->SetDlgCtrlID(nNewID);
00426     pNewView->SetDlgCtrlID(nOldID);
00427
00428     RecalcLayout();
00429
00430     return TRUE;
00431 }

Member Data Documentation

BOOL CCJFlatSplitterWnd::m_bFlatSplitter [protected]

Definition at line 73 of file CJFlatSplitterWnd.h.

int CCJFlatSplitterWnd::m_nHiddenCol [protected]

Definition at line 71 of file CJFlatSplitterWnd.h.

int CCJFlatSplitterWnd::m_nHiddenRow [protected]

Definition at line 72 of file CJFlatSplitterWnd.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJFlatSplitterWnd.h
  • WinCvs/CJLib/CJLibrary/CJFlatSplitterWnd.cpp
Generated on Sun Oct 21 12:46:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJFlatTabCtrl Class Reference

#include <CJFlatTabCtrl.h>

Inheritance diagram for CCJFlatTabCtrl:

[legend]
Collaboration diagram for CCJFlatTabCtrl:

[legend]
List of all members.

Public Methods

CCJFlatTabCtrl ()
virtual BOOL | InsertItem (const int nItem, LPCTSTR lpszItem)
virtual BOOL | DeleteItem (int nItem)
virtual BOOL | DeleteAllItems ()
virtual BOOL | GetItemRect (int nItem, LPRECT lpRect)
virtual int | HitTest (TCHITTESTINFO *pHitTestInfo) const
virtual int | GetCurSel () const
virtual int | SetCurSel (int nItem)
virtual int | GetItemCount () const
virtual void | SetTipText (int nItem, LPCTSTR lpszTabTip)
virtual CString | GetTipText (int nItem)
virtual void | Home ()
virtual | ~CCJFlatTabCtrl ()

Protected Methods

virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
virtual BOOL | PreTranslateMessage (MSG *pMsg)
afx_msg void | OnPaint ()
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnSize (UINT nType, int cx, int cy)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnLeftArrow ()
afx_msg void | OnRightArrow ()
afx_msg void | OnHomeArrow ()
afx_msg void | OnEndArrow ()

Private Methods

void | CreateTabFont (const int iTabHeight)
int | GetTabWidth (const int nItem) const
int | GetTotalArrowWidth (void) const
int | GetTotalTabWidth (void) const
void | InvalidateTabs (void)
void | EnableButtons (void)
int | DrawTab (CDC &dc, const int x, const int y, const int iHeight, bool bSelected, bool bBottom, LPCTSTR lpszTab) const

Private Attributes

bool | m_bHasArrows
bool | m_bHasHomeEnd
bool | m_bTabsOnBottom
int | m_iCurSel
int | m_iClientWidth
int | m_iClientHeight
int | m_iTotalTabWidth
int | m_iXOffset
CTabList m_TabList
CTabList m_TabTipList
CFont | m_Font
CFont | m_BoldFont
CCJMetaFileButton * m_pLeftButton
CCJMetaFileButton * m_pRightButton
CCJMetaFileButton * m_pHomeButton
CCJMetaFileButton * m_pEndButton
HENHMETAFILE | m_hLeftArrow
HENHMETAFILE | m_hLeftArrowDisabled
HENHMETAFILE | m_hRightArrow
HENHMETAFILE | m_hRightArrowDisabled
HENHMETAFILE | m_hHomeArrow
HENHMETAFILE | m_hHomeArrowDisabled
HENHMETAFILE | m_hEndArrow
HENHMETAFILE | m_hEndArrowDisabled
CToolTipCtrl | m_ToolTip

Constructor & Destructor Documentation

CCJFlatTabCtrl::CCJFlatTabCtrl ( )

Definition at line 83 of file CJFlatTabCtrl.cpp.

00084 {
00085     m_bHasArrows          = false;
00086     m_bHasHomeEnd         = false;
00087     m_bTabsOnBottom       = false;
00088     m_iCurSel             = -1;
00089     m_pLeftButton         = NULL;
00090     m_pRightButton        = NULL;
00091     m_pHomeButton         = NULL;
00092     m_pEndButton          = NULL;
00093     m_hLeftArrow          = NULL;
00094     m_hLeftArrowDisabled  = NULL;
00095     m_hRightArrow         = NULL;
00096     m_hRightArrowDisabled = NULL;
00097     m_hHomeArrow          = NULL;
00098     m_hHomeArrowDisabled  = NULL;
00099     m_hEndArrow           = NULL;
00100     m_hEndArrowDisabled   = NULL;
00101     m_iXOffset            = 0;
00102 }

CCJFlatTabCtrl::~CCJFlatTabCtrl ( ) [virtual]

Definition at line 104 of file CJFlatTabCtrl.cpp.

00105 {
00106     _delete(m_pLeftButton);
00107     _delete(m_pRightButton);
00108     _delete(m_pHomeButton);
00109     _delete(m_pEndButton);
00110
00111     // free HENHMETAFILE handles.
00112     if(m_hLeftArrow) {
00113         ::DeleteEnhMetaFile(m_hLeftArrow);
00114     }
00115     if(m_hLeftArrowDisabled) {
00116         ::DeleteEnhMetaFile(m_hLeftArrowDisabled);
00117     }
00118     if(m_hRightArrow) {
00119         ::DeleteEnhMetaFile(m_hRightArrow);
00120     }
00121     if(m_hRightArrowDisabled) {
00122         ::DeleteEnhMetaFile(m_hRightArrowDisabled);
00123     }
00124     if(m_hHomeArrow) {
00125         ::DeleteEnhMetaFile(m_hHomeArrow);
00126     }
00127     if(m_hHomeArrowDisabled) {
00128         ::DeleteEnhMetaFile(m_hHomeArrowDisabled);
00129     }
00130     if(m_hEndArrow) {
00131         ::DeleteEnhMetaFile(m_hEndArrow);
00132     }
00133     if(m_hEndArrowDisabled) {
00134         ::DeleteEnhMetaFile(m_hEndArrowDisabled);
00135     }
00136     while(!m_TabList.IsEmpty()) {
00137         CString* pItem = m_TabList.RemoveTail();
00138         _delete(pItem);
00139     }
00140     while(!m_TabTipList.IsEmpty()) {
00141         CString* pItem = m_TabTipList.RemoveTail();
00142         _delete(pItem);
00143     }
00144
00145     // fix potential resource leak - KStowell - 10-21-99
00146     m_Font.DeleteObject();
00147     m_BoldFont.DeleteObject();
00148 }

Member Function Documentation

void CCJFlatTabCtrl::CreateTabFont ( const int iTabHeight ) [private]

Definition at line 150 of file CJFlatTabCtrl.cpp.

Referenced by OnSize().

00151 {
00152     int iHeight = -(iTabHeight - 6);
00153
00154     m_Font.DeleteObject();
00155     m_Font.CreateFont(iHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
00156         OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, PROOF_QUALITY, FF_SWISS, NULL);
00157
00158     m_BoldFont.DeleteObject();
00159     m_BoldFont.CreateFont(iHeight, 0, 0, 0, FW_EXTRABOLD, FALSE, FALSE, FALSE, ANSI_CHARSET,
00160         OUT_STROKE_PRECIS, CLIP_STROKE_PRECIS, PROOF_QUALITY, FF_SWISS, NULL);
00161 }

BOOL CCJFlatTabCtrl::DeleteAllItems ( ) [virtual]

Definition at line 393 of file CJFlatTabCtrl.cpp.

00394 {
00395     while(!m_TabList.IsEmpty()) {
00396         CString* pItem = m_TabList.RemoveTail();
00397         _delete(pItem);
00398     }
00399
00400     while(!m_TabTipList.IsEmpty()) {
00401         CString* pItem = m_TabTipList.RemoveTail();
00402         _delete(pItem);
00403     }
00404
00405     m_iCurSel = -1;                             // PGB - Reset the currently selected tab to -1 as we have no tabs in our list now.
00406
00407     m_iTotalTabWidth = GetTotalTabWidth();      // PGB - Recalculate the total tab width now we have deleted all items
00408
00409     EnableButtons();
00410     InvalidateTabs();
00411
00412     return TRUE;
00413 }

BOOL CCJFlatTabCtrl::DeleteItem ( int nItem ) [virtual]

Definition at line 348 of file CJFlatTabCtrl.cpp.

00349 {
00350     if (nItem < 0 || nItem >= m_TabList.GetCount())
00351         return FALSE;
00352
00353     POSITION pos = m_TabList.FindIndex(nItem);
00354     ASSERT(pos);
00355
00356     CString* pItem = m_TabList.GetAt(pos);
00357     m_TabList.RemoveAt(pos);
00358     _delete(pItem);
00359
00360     // PGB - Stole the following code from the OnLButtonDown() function
00361     // in order to cause the tab control to show the newly selected item
00362     // after deleting an item from the list
00363
00364     // warn parent that the selection is about to change
00365     int id = GetDlgCtrlID();
00366     NMHDR hdr;
00367     hdr.hwndFrom = m_hWnd;
00368     hdr.idFrom = id;
00369     hdr.code = TCN_SELCHANGING;
00370     if (GetParent()->SendMessage(WM_NOTIFY, id, (LPARAM)&hdr) == 0)
00371     {
00372         if (m_iCurSel >= m_TabList.GetCount())
00373         {
00374             SetCurSel(m_TabList.GetCount() - 1); // PGB - Reset the currently selected tab to the last one in the list
00375             InvalidateTabs();
00376         }
00377
00378         // notify parent that the selection has changed
00379         hdr.hwndFrom = m_hWnd;
00380         hdr.idFrom = id;
00381         hdr.code = TCN_SELCHANGE;
00382         GetParent()->SendMessage(WM_NOTIFY, id, (LPARAM)&hdr);
00383     }
00384
00385     m_iTotalTabWidth = GetTotalTabWidth();      // PGB - Recalculate the total tab width now we have deleted an item
00386
00387     EnableButtons();
00388     InvalidateTabs();
00389
00390     return TRUE;
00391 }

int CCJFlatTabCtrl::DrawTab | ( | CDC & | dc,
 |  | const int | x,
 |  | const int | y,
 |  | const int | iHeight,
 |  | bool | bSelected,
 |  | bool | bBottom,
 |  | LPCTSTR | lpszTab
 | ) | const [private]

Definition at line 240 of file CJFlatTabCtrl.cpp.

Referenced by OnPaint().

00241 {
00242     CFont* pOldFont = dc.SelectObject((CFont*)&m_BoldFont);
00243     CSize size(dc.GetTextExtent(lpszTab));
00244     CRect rcText;
00245     rcText.left = iHeight + x - 4;
00246     rcText.top = 2 + y;
00247     rcText.right = size.cx + iHeight + x - 4;
00248     rcText.bottom = size.cy + 2 + y;
00249
00250     int iHalf = iHeight / 2;
00251     int iWidth = iHeight + iHalf;
00252
00253     COLORREF crBack;
00254     COLORREF crFore;
00255     if (bSelected) {
00256         crBack = GetSysColor(COLOR_WINDOW);
00257         crFore = GetSysColor(COLOR_WINDOWTEXT);
00258     } else {
00259         crBack = GetSysColor(COLOR_3DFACE);
00260         crFore = GetSysColor(COLOR_BTNTEXT);
00261     }
00262
00263     CPen penOutline(PS_SOLID, 1, GetSysColor(COLOR_BTNTEXT));
00264     CPen penShadow(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
00265     CBrush brush;
00266     brush.CreateSolidBrush(crBack);
00267
00268     POINT points[4];
00269     points[0].x = x;                     points[0].y = iHeight + y - 1;
00270     points[1].x = iHalf + x;             points[1].y = y;
00271     points[2].x = size.cx + iHeight + x; points[2].y = y;
00272     points[3].x = size.cx + iWidth + x;  points[3].y = iHeight + y - 1;
00273
00274     if (bBottom) {
00275         // swap vertical coordinates
00276         points[0].y = points[1].y;
00277         points[2].y = points[3].y;
00278         points[1].y = points[2].y;
00279         points[3].y = points[0].y;
00280     }
00281
00282     CPen* pOldPen = dc.SelectObject(&penOutline);
00283     dc.SetBkColor(crBack);
00284     CBrush* pOldBrush = dc.SelectObject(&brush);
00285     dc.Polygon(points, 4);
00286     dc.SelectObject(bSelected ? (CFont*)&m_BoldFont : (CFont*)&m_Font);
00287     dc.SetTextColor(crFore);
00288     dc.DrawText(lpszTab, rcText, DT_CENTER);
00289     dc.SelectObject(&penShadow);
00290
00291     if (bSelected) {
00292         dc.MoveTo(iHalf + x + 1, points[1].y);
00293         dc.LineTo(size.cx + iHeight + x, points[1].y);
00294         CPen penBack(PS_SOLID, 1, crBack);
00295         dc.SelectObject(&penBack);
00296         dc.MoveTo(x + 1, points[0].y);
00297         dc.LineTo(size.cx + iWidth + x, points[0].y);
00298     } else {
00299         dc.MoveTo(iHalf + x + 1, points[1].y);
00300         dc.LineTo(size.cx + iHeight + x - 1, points[1].y);
00301         dc.LineTo(size.cx + iWidth + x - 1, points[0].y);
00302     }
00303
00304     // fix potential resource leak - KStowell - 10-21-99
00305     dc.SelectObject(pOldFont);
00306     dc.SelectObject(pOldPen);
00307     dc.SelectObject(pOldBrush);
00308     penOutline.DeleteObject();
00309     penShadow.DeleteObject();
00310     brush.DeleteObject();
00311
00312     return size.cx + iWidth;
00313 }

void CCJFlatTabCtrl::EnableButtons ( void ) [private]

Definition at line 223 of file CJFlatTabCtrl.cpp.

Referenced by DeleteAllItems(), DeleteItem(), InsertItem(), OnEndArrow(), OnHomeArrow(), OnLeftArrow(), OnRightArrow(), OnSize(), and SetCurSel().

00224 {
00225     if (m_bHasArrows)  //TCC: ADDED to handle situations where ther are no arrows
00226     {
00227         m_pLeftButton->EnableWindow(m_iXOffset);
00228         if (m_iClientWidth + m_iXOffset < m_iTotalTabWidth + GetTotalArrowWidth() + 1)
00229             m_pRightButton->EnableWindow(true);
00230         else
00231             m_pRightButton->EnableWindow(false);
00232         if (m_bHasHomeEnd)
00233         {
00234             m_pHomeButton->EnableWindow(m_iXOffset);
00235             m_pEndButton->EnableWindow(m_pRightButton->IsWindowEnabled());
00236         }
00237     }
00238 }

virtual int CCJFlatTabCtrl::GetCurSel ( ) const [inline, virtual]

Definition at line 94 of file CJFlatTabCtrl.h.

00094 {return m_iCurSel;}

virtual int CCJFlatTabCtrl::GetItemCount ( ) const [inline, virtual]

Definition at line 96 of file CJFlatTabCtrl.h.

00096 { return m_TabList.GetCount(); }

BOOL CCJFlatTabCtrl::GetItemRect | ( | int | nItem,
 |  | LPRECT | lpRect
 | ) | [virtual]

Definition at line 415 of file CJFlatTabCtrl.cpp.

Referenced by OnLeftArrow(), OnRightArrow(), and SetCurSel().

00416 {
00417     if (nItem < 0 || nItem >= m_TabList.GetCount())
00418         return FALSE;
00419
00420     int x = GetTotalArrowWidth();
00421     for (int i = 0; i < nItem; i++)
00422     {
00423         x += GetTabWidth(i);
00424         if (i != m_TabList.GetCount())
00425             x -= (m_iClientHeight / 2) + 2;
00426     }
00427     lpRect->left = x - m_iXOffset;
00428     lpRect->top = 0;
00429     lpRect->right = lpRect->left + GetTabWidth(nItem);
00430     lpRect->bottom = m_iClientHeight;
00431     return TRUE;
00432 }

int CCJFlatTabCtrl::GetTabWidth ( const int nItem ) const [private]

Definition at line 163 of file CJFlatTabCtrl.cpp.

Referenced by GetItemRect(), GetTotalTabWidth(), HitTest(), and OnPaint().

00164 {
00165     CDC dc;
00166     dc.CreateCompatibleDC(NULL);
00167     CFont* pOldFont = dc.SelectObject((CFont*)&m_BoldFont);
00168     CSize size(dc.GetTextExtent(*m_TabList.GetAt(m_TabList.FindIndex(nItem))));
00169
00170     // fix potential resource leak - KStowell - 10-20-99.
00171     dc.SelectObject(pOldFont);
00172     dc.DeleteDC();
00173
00174     return size.cx + m_iClientHeight + (m_iClientHeight / 2);
00175 }

CString CCJFlatTabCtrl::GetTipText ( int nItem ) [virtual]

Definition at line 945 of file CJFlatTabCtrl.cpp.

00946 {
00947     CString strText;
00948
00949     if (nItem < m_TabList.GetCount())
00950     {
00951         for (int i = 0; i < m_TabList.GetCount(); i++)
00952         {
00953             if (i == nItem)
00954             {
00955                 strText = *m_TabTipList.GetAt(m_TabTipList.FindIndex(nItem));
00956                 break;
00957             }
00958         }
00959     }
00960
00961     return strText;
00962 }

int CCJFlatTabCtrl::GetTotalArrowWidth ( void ) const [private]

Definition at line 190 of file CJFlatTabCtrl.cpp.

Referenced by EnableButtons(), GetItemRect(), HitTest(), InvalidateTabs(), OnEndArrow(), OnLeftArrow(), OnPaint(), OnRightArrow(), and SetCurSel().

00191 {
00192     int iWidth = 1;
00193     if (m_bHasArrows)
00194         iWidth += 32;
00195     if (m_bHasHomeEnd)
00196         iWidth += 32;
00197     return iWidth;
00198 }

int CCJFlatTabCtrl::GetTotalTabWidth ( void ) const [private]

Definition at line 177 of file CJFlatTabCtrl.cpp.

Referenced by DeleteAllItems(), DeleteItem(), InsertItem(), and OnSize().

00178 {
00179     int iWidth = 0;
00180     for (int i = 0; i < m_TabList.GetCount(); i++)
00181     {
00182         iWidth += GetTabWidth(i);
00183         if (i != m_TabList.GetCount()-1) {
00184             iWidth -= (m_iClientHeight / 2);
00185         }
00186     }
00187     return iWidth + 2;
00188 }

int CCJFlatTabCtrl::HitTest ( TCHITTESTINFO * pHitTestInfo ) const [virtual]

Definition at line 434 of file CJFlatTabCtrl.cpp.

Referenced by OnLButtonDown(), OnLeftArrow(), OnRightArrow(), and PreTranslateMessage().

00435 {
00436     // ignore hits on the buttons
00437     int iHitX = pHitTestInfo->pt.x;
00438     if (iHitX < GetTotalArrowWidth())
00439         return -1;
00440
00441     // check if any tabs were hit
00442     int x = GetTotalArrowWidth() - m_iXOffset;
00443     for (int i = 0; i < m_TabList.GetCount(); i++)
00444     {
00445         int iTabWidth = GetTabWidth(i);
00446         if (i != m_TabList.GetCount())
00447             iTabWidth -= (m_iClientHeight / 2) + 2;
00448         if ((x <= iHitX) && (iHitX <= x + iTabWidth))
00449             return i;
00450         x += iTabWidth;
00451     }
00452
00453     // hit point is right of rightmost tab
00454     return -1;
00455 }

void CCJFlatTabCtrl::Home ( void ) [virtual]

Definition at line 964 of file CJFlatTabCtrl.cpp.

00965 {
00966     OnHomeArrow();
00967 }

BOOL CCJFlatTabCtrl::InsertItem | ( | const int | nItem,
 |  | LPCTSTR | lpszItem
 | ) | [virtual]

Definition at line 315 of file CJFlatTabCtrl.cpp.

00316 {
00317     if (nItem < 0 || nItem > m_TabList.GetCount())
00318         return -1;
00319
00320     // add tab to our list
00321     CString* pItem = new CString;
00322     ASSERT(pItem);
00323
00324     *pItem = lpszItem;
00325     m_TabList.AddTail(pItem);
00326
00327     // PGB - Add the tabs tip text to the list
00328
00329     CString* pTipItem = new CString;
00330     ASSERT(pTipItem);
00331
00332     *pTipItem = lpszItem;
00333     m_TabTipList.AddTail(pTipItem);
00334
00335     //
00336
00337     if (m_TabList.GetCount() == 1)
00338         m_iCurSel = 0;
00339
00340     m_iTotalTabWidth = GetTotalTabWidth();      // PGB - Recalculate the total tab width now we have added a new item
00341
00342     EnableButtons();
00343     InvalidateTabs();
00344
00345     return nItem;
00346 }

void CCJFlatTabCtrl::InvalidateTabs ( void ) [private]

Definition at line 200 of file CJFlatTabCtrl.cpp.

Referenced by DeleteAllItems(), DeleteItem(), InsertItem(), OnEndArrow(), OnHomeArrow(), OnLButtonDown(), OnLeftArrow(), OnRightArrow(), and SetCurSel().

00201 {
00202     if (GetSafeHwnd())
00203     {
00204         // invalidate the visible tab area
00205         // to minimise flicker - don't erase the background
00206         CRect rcTabs;
00207
00208         rcTabs.left = GetTotalArrowWidth();
00209         rcTabs.top = 0;
00210         rcTabs.right = rcTabs.left + (m_iTotalTabWidth - m_iXOffset);
00211         rcTabs.bottom = m_iClientHeight;
00212         InvalidateRect(&rcTabs, false);
00213         // invalidate the blank area to the right of the tabs
00214         if (rcTabs.right < m_iClientWidth)
00215         {
00216             rcTabs.left = rcTabs.right;
00217             rcTabs.right = m_iClientWidth;
00218             InvalidateRect(&rcTabs, true);
00219         }
00220     }
00221 }

int CCJFlatTabCtrl::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 675 of file CJFlatTabCtrl.cpp.

00676 {
00677     if (CWnd::OnCreate(lpCreateStruct) == -1)
00678         return -1;
00679
00680     // TODO: Add your specialized creation code here
00681     if (lpCreateStruct->style & FTS_BOTTOM) {
00682         m_bTabsOnBottom = true;
00683     }
00684
00685     if (lpCreateStruct->style & TCS_TOOLTIPS) {
00686         m_ToolTip.Create(this);
00687         m_ToolTip.Activate(TRUE);
00688         m_ToolTip.AddTool(this, _T("Flat Tab Tool Tip"));
00689         m_ToolTip.SendMessage(TTM_SETMAXTIPWIDTH, 0, SHRT_MAX); // Allow multiline tooltips
00690     }
00691
00692     if (lpCreateStruct->style & FTS_HASARROWS)
00693     {
00694         m_bHasArrows = true;
00695         POINT points[4];
00696         points[0].x = 100; points[0].y = 0;
00697         points[1].x = 0;   points[1].y = 50;
00698         points[2].x = 100; points[2].y = 100;
00699         points[3].x = 100; points[3].y = 0;
00700
00702         // This portion of the code was re-written to help eliminate a nasty resource
00703         // leak. It would seem that the CMetaFileDC was not freeing the GDI resources
00704         // completely whenever CMetaFileDC::CloseEnhanced() was called. This may be due
00705         // to a BUG in MFC or perhaps this class, in any event, this seems to resolve
00706         // the issue. - KStowell - 10-23-99.
00708         HPEN   hPen           = ::CreatePen( PS_SOLID, 1, RGB( 0,0,0 ));
00709         HPEN   hPenDisabled   = ::CreatePen( PS_SOLID, 1, RGB( 128,128,128 ));
00710         HBRUSH hBrush         = ::CreateSolidBrush( RGB( 0,0,0 ));
00711         HBRUSH hBrushDisabled = ::CreateSolidBrush( RGB( 128,128,128 ));;
00712
00713         // create left arrow metafile
00714         HDC hMetaDC      = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00715         HPEN hOldPen     = (HPEN)::SelectObject( hMetaDC, hPen );
00716         HBRUSH hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrush );
00717         ::Polygon( hMetaDC, points, 4 );
00718         ::SelectObject( hMetaDC, hOldPen );
00719         ::SelectObject( hMetaDC, hOldBrush );
00720         m_hLeftArrow = ::CloseEnhMetaFile( hMetaDC );
00721
00722         // create disabled left arrow metafile
00723         hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00724         hOldPen   = (HPEN)::SelectObject( hMetaDC, hPenDisabled );
00725         hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrushDisabled );
00726         ::Polygon( hMetaDC, points, 4 );
00727         ::SelectObject( hMetaDC, hOldPen );
00728         ::SelectObject( hMetaDC, hOldBrush );
00729         m_hLeftArrowDisabled = ::CloseEnhMetaFile( hMetaDC );
00730
00731         points[0].x = 0;   points[0].y = 0;
00732         points[1].x = 100; points[1].y = 50;
00733         points[2].x = 0;   points[2].y = 100;
00734         points[3].x = 0;   points[3].y = 0;
00735
00736         // create right arrow metafile
00737         hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00738         hOldPen   = (HPEN)::SelectObject( hMetaDC, hPen );
00739         hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrush );
00740         ::Polygon( hMetaDC, points, 4 );
00741         ::SelectObject( hMetaDC, hOldPen );
00742         ::SelectObject( hMetaDC, hOldBrush );
00743         m_hRightArrow = ::CloseEnhMetaFile( hMetaDC );
00744
00745         // create disabled right arrow metafile
00746         hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00747         hOldPen   = (HPEN)::SelectObject( hMetaDC, hPenDisabled );
00748         hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrushDisabled );
00749         ::Polygon( hMetaDC, points, 4 );
00750         ::SelectObject( hMetaDC, hOldPen );
00751         ::SelectObject( hMetaDC, hOldBrush );
00752         m_hRightArrowDisabled = ::CloseEnhMetaFile( hMetaDC );
00753
00754         CRect rcButton(0, 0, 16, 16);
00755         m_pLeftButton = new CCJMetaFileButton;
00756         m_pLeftButton->Create(NULL, WS_CHILD | WS_VISIBLE | WS_DISABLED | BS_OWNERDRAW, rcButton, this, IDC_LEFTBUTTON);
00757         m_pLeftButton->SetMetaFiles(m_hLeftArrow, 0, 0, m_hLeftArrowDisabled);
00758
00759         m_pRightButton = new CCJMetaFileButton;
00760         m_pRightButton->Create(NULL, WS_CHILD | WS_VISIBLE | WS_DISABLED | BS_OWNERDRAW, rcButton, this, IDC_RIGHTBUTTON);
00761         m_pRightButton->SetMetaFiles(m_hRightArrow, 0, 0, m_hRightArrowDisabled);
00762
00763         if (lpCreateStruct->style & FTS_HASHOMEEND)
00764         {
00765             m_bHasHomeEnd = true;
00766
00767             // Setup the Home arrow button
00768             points[0].x = 100;   points[0].y = 0;
00769             points[1].x = 0;     points[1].y = 50;
00770             points[2].x = 100;   points[2].y = 100;
00771             points[3].x = 100;   points[3].y = 0;
00772
00773             // create right arrow metafile
00774             HDC hMetaDC      = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00775             HPEN hOldPen     = (HPEN)::SelectObject( hMetaDC, hPen );
00776             HBRUSH hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrush );
00777             ::Polygon( hMetaDC, points, 4 );
00778             ::MoveToEx( hMetaDC, 0, 0, NULL );
00779             ::LineTo( hMetaDC, 0, 100 );
00780             ::SelectObject( hMetaDC, hOldPen );
00781             ::SelectObject( hMetaDC, hOldBrush );
00782             m_hHomeArrow = ::CloseEnhMetaFile( hMetaDC );
00783
00784             // create disabled right arrow metafile
00785             hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00786             hOldPen   = (HPEN)::SelectObject( hMetaDC, hPenDisabled );
00787             hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrushDisabled );
00788             ::Polygon( hMetaDC, points, 4 );
00789             ::MoveToEx( hMetaDC, 0, 0, NULL );
00790             ::LineTo( hMetaDC, 0, 100 );
00791             ::SelectObject( hMetaDC, hOldPen );
00792             ::SelectObject( hMetaDC, hOldBrush );
00793             m_hHomeArrowDisabled = ::CloseEnhMetaFile( hMetaDC );
00794
00795             m_pHomeButton = new CCJMetaFileButton;
00796             m_pHomeButton->Create(NULL, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, rcButton, this, IDC_HOMEBUTTON);
00797             m_pHomeButton->SetMetaFiles(m_hHomeArrow, 0, 0, m_hHomeArrowDisabled);
00798
00799             // Setup the End arrow button
00800             points[0].x = 0;   points[0].y = 0;
00801             points[1].x = 100; points[1].y = 50;
00802             points[2].x = 0;   points[2].y = 100;
00803             points[3].x = 0;   points[3].y = 0;
00804
00805             // create right arrow metafile
00806             hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00807             hOldPen   = (HPEN)::SelectObject( hMetaDC, hPen );
00808             hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrush );
00809             ::Polygon( hMetaDC, points, 4 );
00810             ::MoveToEx( hMetaDC, 100, 0, NULL );
00811             ::LineTo( hMetaDC, 100, 100 );
00812             ::SelectObject( hMetaDC, hOldPen );
00813             ::SelectObject( hMetaDC, hOldBrush );
00814             m_hEndArrow = ::CloseEnhMetaFile( hMetaDC );
00815
00816             // create disabled right arrow metafile
00817             hMetaDC   = ::CreateEnhMetaFile( NULL, NULL, NULL, NULL );
00818             hOldPen   = (HPEN)::SelectObject( hMetaDC, hPenDisabled );
00819             hOldBrush = (HBRUSH)::SelectObject( hMetaDC, hBrushDisabled );
00820             ::Polygon( hMetaDC, points, 4 );
00821             ::MoveToEx( hMetaDC, 100, 0, NULL );
00822             ::LineTo( hMetaDC, 100, 100 );
00823             ::SelectObject( hMetaDC, hOldPen );
00824             ::SelectObject( hMetaDC, hOldBrush );
00825             m_hEndArrowDisabled = ::CloseEnhMetaFile( hMetaDC );
00826
00827             m_pEndButton = new CCJMetaFileButton;
00828             m_pEndButton->Create(NULL, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, rcButton, this, IDC_ENDBUTTON);
00829             m_pEndButton->SetMetaFiles(m_hEndArrow, 0, 0, m_hEndArrowDisabled);
00830
00831             m_pHomeButton->MoveWindow(1, 0, 16, 16);
00832             m_pLeftButton->MoveWindow(17, 0, 16, 16);
00833             m_pRightButton->MoveWindow(33, 0, 16, 16);
00834             m_pEndButton->MoveWindow(49, 0, 16, 16);
00835
00836         } else {
00837             m_pLeftButton->MoveWindow(1, 0, 16, 16);
00838             m_pRightButton->MoveWindow(17, 0, 16, 16);
00839         }
00840
00841         // fix potential resource leak - KStowell - 10-23-99
00842         ::DeleteObject(hPen);
00843         ::DeleteObject(hPenDisabled);
00844         ::DeleteObject(hBrush);
00845         ::DeleteObject(hBrushDisabled);
00846     }
00847
00848     return 0;
00849 }

void CCJFlatTabCtrl::OnEndArrow ( ) [protected]

Definition at line 917 of file CJFlatTabCtrl.cpp.

00918 {
00919     // TODO: Add your control notification handler code here
00920     m_iXOffset = m_iTotalTabWidth + GetTotalArrowWidth() - m_iClientWidth + 1;
00921     EnableButtons();
00922     InvalidateTabs();
00923 }

void CCJFlatTabCtrl::OnHomeArrow ( ) [protected]

Definition at line 909 of file CJFlatTabCtrl.cpp.

Referenced by Home().

00910 {
00911     // TODO: Add your control notification handler code here
00912     m_iXOffset = 0;
00913     EnableButtons();
00914     InvalidateTabs();
00915 }

void CCJFlatTabCtrl::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 618 of file CJFlatTabCtrl.cpp.

00619 {
00620     // TODO: Add your message handler code here and/or call default
00621     TCHITTESTINFO test;
00622     test.pt = point;
00623     int iTab = HitTest(&test);
00624     if ((iTab != -1) && (iTab != m_iCurSel))
00625     {
00626         // warn parent that the selection is about to change
00627         int id = GetDlgCtrlID();
00628         NMHDR hdr;
00629         hdr.hwndFrom = m_hWnd;
00630         hdr.idFrom = id;
00631         hdr.code = TCN_SELCHANGING;
00632         if (GetParent()->SendMessage(WM_NOTIFY, id, (LPARAM)&hdr) == 0)
00633         {
00634             // parent has given permission for the selection to change
00635             SetCurSel(iTab);
00636             InvalidateTabs();
00637
00638             // notify parent that the selection has changed
00639             hdr.hwndFrom = m_hWnd;
00640             hdr.idFrom = id;
00641             hdr.code = TCN_SELCHANGE;
00642             GetParent()->SendMessage(WM_NOTIFY, id, (LPARAM)&hdr);
00643         }
00644     }
00645
00646     CWnd::OnLButtonDown(nFlags, point);
00647 }

void CCJFlatTabCtrl::OnLeftArrow ( ) [protected]

Definition at line 851 of file CJFlatTabCtrl.cpp.

00852 {
00853     // Move the tabs right, ensuring that we move right by one
00854     // whole tab each time ala Microsoft Access
00855
00856     CPoint Point(GetTotalArrowWidth()+1, 1);
00857
00858     TCHITTESTINFO test;
00859     test.pt = Point;
00860     int iTab = HitTest(&test);
00861
00862     if (iTab != -1)
00863     {
00864         m_iXOffset = 0;
00865         for (int iLoop = 0; iLoop <= iTab - 1; iLoop++)
00866         {
00867             RECT rect;
00868             if (GetItemRect(iLoop, &rect))
00869             {
00870                 m_iXOffset += rect.left;
00871             }
00872         }
00873         m_iXOffset -= GetTotalArrowWidth();
00874
00875         EnableButtons();
00876         InvalidateTabs();
00877     }
00878 }

void CCJFlatTabCtrl::OnPaint ( ) [protected]

Definition at line 555 of file CJFlatTabCtrl.cpp.

00556 {
00557     CPaintDC dc(this); // device context for painting
00558
00559     CBrush brush;
00560     brush.CreateSysColorBrush(COLOR_3DFACE);
00561     CPen penBlack(PS_SOLID, 1, RGB(0,0,0));
00562
00563     // draw the black line along the left of the control
00564     CPen* pOldPen = dc.SelectObject(&penBlack);
00565     dc.MoveTo(0, 0);
00566     dc.LineTo(0, m_iClientHeight);
00567
00568     // draw the black line along the top/bottom of the control
00569     int iTotalArrowWidth = GetTotalArrowWidth();
00570     int iEndOfTab = iTotalArrowWidth + m_iTotalTabWidth - m_iXOffset;
00571     dc.MoveTo(iEndOfTab, m_bTabsOnBottom ? 0 : m_iClientHeight - 1);
00572     dc.LineTo(m_iClientWidth, m_bTabsOnBottom ? 0 : m_iClientHeight - 1);
00573
00574     // fill the empty background area
00575     int iFillHeight = m_iClientHeight - (m_bTabsOnBottom ? 0 : 1);
00576     CRect rcBack(iEndOfTab, m_bTabsOnBottom ? 1 : 0, m_iClientWidth, iFillHeight);
00577     dc.FillRect(rcBack, &brush);
00578
00579     // create a bitmap of all the tabs
00580     CDC dcMem;
00581     dcMem.CreateCompatibleDC(NULL);
00582     CBitmap bitmap;
00583     bitmap.CreateCompatibleBitmap(&dc, m_iTotalTabWidth, m_iClientHeight);
00584     CBitmap* pOldBitmap = dcMem.SelectObject(&bitmap);
00585     CBrush* pOldBrush = dcMem.SelectObject(&brush);
00586     CRect rc(0, m_bTabsOnBottom ? 1 : 0, m_iTotalTabWidth, iFillHeight);
00587     dcMem.FillRect(rc, &brush);
00588
00589     int iOverlap = (m_iClientHeight / 2) + 2;
00590     int x = 0;
00591     int iSelX = 0;
00592     for (int i = 0; i < m_TabList.GetCount(); i++)
00593     {
00594         if (i != m_iCurSel)
00595             x += DrawTab(dcMem, x, 0, m_iClientHeight, false, m_bTabsOnBottom, *m_TabList.GetAt(m_TabList.FindIndex(i))) - iOverlap;
00596         else
00597         {
00598             iSelX = x;
00599             x += GetTabWidth(i) - iOverlap;
00600         }
00601     }
00602     if (m_iCurSel >= 0)
00603         DrawTab(dcMem, iSelX, 0, m_iClientHeight, true, m_bTabsOnBottom, *m_TabList.GetAt(m_TabList.FindIndex(m_iCurSel)));
00604
00605     // blit the bitmap onto the control
00606     dc.BitBlt(iTotalArrowWidth, 0, m_iClientWidth - iTotalArrowWidth, m_iClientHeight, &dcMem, m_iXOffset, 0, SRCCOPY);
00607
00608     // fix potential resource leak - KStowell - 10-21-99.
00609     dcMem.SelectObject(pOldPen);
00610     dcMem.SelectObject(pOldBitmap);
00611     dcMem.SelectObject(pOldBrush);
00612     dcMem.DeleteDC();
00613     brush.DeleteObject();
00614     penBlack.DeleteObject();
00615     bitmap.DeleteObject();
00616 }

void CCJFlatTabCtrl::OnRightArrow ( ) [protected]

Definition at line 880 of file CJFlatTabCtrl.cpp.

00881 {
00882     // Move the tabs left, ensuring that we move left by one
00883     // whole tab each time ala Microsoft Access
00884
00885     CPoint Point(GetTotalArrowWidth()+1, 1);
00886
00887     TCHITTESTINFO test;
00888     test.pt = Point;
00889     int iTab = HitTest(&test);
00890
00891     if (iTab != -1)
00892     {
00893         m_iXOffset = 0;
00894         for (int iLoop = 0; iLoop <= iTab + 1; iLoop++)
00895         {
00896             RECT rect;
00897             if (GetItemRect(iLoop, &rect))
00898             {
00899                 m_iXOffset += rect.left;
00900             }
00901         }
00902         m_iXOffset -= GetTotalArrowWidth();
00903
00904         EnableButtons();
00905         InvalidateTabs();
00906     }
00907 }

void CCJFlatTabCtrl::OnSize | ( | UINT | nType,
 |  | int | cx,
 |  | int | cy
 | ) | [protected]

Definition at line 649 of file CJFlatTabCtrl.cpp.

00650 {
00651     CWnd::OnSize(nType, cx, cy);
00652
00653     // TODO: Add your message handler code here
00654     if (m_bHasHomeEnd) {
00655         m_pHomeButton->MoveWindow(1, 0, 16, cy);
00656         m_pLeftButton->MoveWindow(17, 0, 16, cy);
00657         m_pRightButton->MoveWindow(33, 0, 16, cy);
00658         m_pEndButton->MoveWindow(49, 0, 16, cy);
00659     } else {
00660         if (m_bHasArrows) { //TCC: ADDED to handle situations where ther are no arrows
00661             m_pLeftButton->MoveWindow(1, 0, 16, cy);
00662             m_pRightButton->MoveWindow(17, 0, 16, cy);
00663         }
00664     }
00665
00666     m_iClientWidth  = cx;
00667     m_iClientHeight = cy;
00668
00669     CreateTabFont(cy);
00670
00671     m_iTotalTabWidth = GetTotalTabWidth();
00672     EnableButtons();
00673 }

BOOL CCJFlatTabCtrl::PreCreateWindow ( CREATESTRUCT & cs ) [protected, virtual]

Definition at line 506 of file CJFlatTabCtrl.cpp.

00507 {
00508     if (!CWnd::PreCreateWindow(cs))
00509         return FALSE;
00510
00511     cs.lpszClass = AfxRegisterWndClass(CS_DBLCLKS,
00512             ::LoadCursor(NULL, IDC_ARROW), NULL, NULL);
00513
00514     return TRUE;
00515 }

BOOL CCJFlatTabCtrl::PreTranslateMessage ( MSG * pMsg ) [protected, virtual]

Definition at line 517 of file CJFlatTabCtrl.cpp.

00518 {
00519     ASSERT_VALID(this);
00520
00521     if (::IsWindow(m_ToolTip.m_hWnd))
00522                                                                                                                                                                                                                                                                                                                                                                                                                            {
00523         if(pMsg->message == WM_MOUSEMOVE && pMsg->hwnd == m_hWnd)
00524         {
00525             CPoint Point(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam));
00526
00527             TCHITTESTINFO test;
00528             test.pt = Point;
00529             int iTab = HitTest(&test);
00530
00531             if (iTab >= 0)
00532             {
00533                 CString strText;
00534
00535                 strText = (LPCTSTR) *m_TabTipList.GetAt(m_TabTipList.FindIndex(iTab));
00536
00537                 TRACE2("Mouse over tab %d : %s\n", iTab, strText);
00538
00539                 m_ToolTip.UpdateTipText(strText, this);
00540                 m_ToolTip.RelayEvent(pMsg);
00541             } else  {
00542                 // VC5 compatibility - Kirk Stowell - 10-21-99
00543                 ::SendMessage(m_ToolTip.m_hWnd, TTM_POP, 0, 0L);
00544             }
00545         }
00546         else {
00547             // VC5 compatibility - Kirk Stowell - 10-21-99
00548             ::SendMessage(m_ToolTip.m_hWnd, TTM_POP, 0, 0L);
00549         }
00550     }
00551
00552     return CWnd::PreTranslateMessage(pMsg);
00553 }

int CCJFlatTabCtrl::SetCurSel ( int nItem ) [virtual]

Definition at line 457 of file CJFlatTabCtrl.cpp.

Referenced by DeleteItem(), and OnLButtonDown().

00458 {
00459     if (nItem < 0 || nItem >= m_TabList.GetCount())
00460         return -1;
00461
00462     int iPrevSel = m_iCurSel;
00463     m_iCurSel = nItem;
00464
00465     // test if we need to center on the selected tab
00466     CRect rcItem;
00467     if (GetItemRect(nItem, &rcItem))
00468     {
00469         // test if the tab is off on the left
00470         int iTotalArrowWidth = GetTotalArrowWidth();
00471         rcItem.left -= iTotalArrowWidth;
00472         if (rcItem.left < 0)
00473             m_iXOffset += rcItem.left;
00474         else
00475         {
00476             // test if the tab is off on the right
00477             rcItem.right -= iTotalArrowWidth;
00478             int iTabAreaWidth = m_iClientWidth - iTotalArrowWidth;
00479             if (rcItem.right > iTabAreaWidth)
00480                 m_iXOffset += (rcItem.right - iTabAreaWidth);
00481         }
00482     }
00483
00484     EnableButtons();
00485     InvalidateTabs();
00486
00487     return iPrevSel;
00488 }

void CCJFlatTabCtrl::SetTipText | ( | int | nItem,
 |  | LPCTSTR | lpszTabTip
 | ) | [virtual]

Definition at line 925 of file CJFlatTabCtrl.cpp.

00926 {
00927     if (nItem < m_TabList.GetCount())
00928     {
00929         for (int i = 0; i < m_TabList.GetCount(); i++)
00930         {
00931             if (i == nItem)
00932             {
00933                 CString *pTipItem = m_TabTipList.GetAt(m_TabTipList.FindIndex(nItem));
00934
00935                 *pTipItem = lpszTabTip;
00936
00937                 break;
00938             }
00939         }
00940     }
00941
00942     return;
00943 }

Member Data Documentation

CFont CCJFlatTabCtrl::m_BoldFont [private]

Definition at line 148 of file CJFlatTabCtrl.h.

CFont CCJFlatTabCtrl::m_Font [private]

Definition at line 147 of file CJFlatTabCtrl.h.

CTabList CCJFlatTabCtrl::m_TabList [private]

Definition at line 145 of file CJFlatTabCtrl.h.

CTabList CCJFlatTabCtrl::m_TabTipList [private]

Definition at line 146 of file CJFlatTabCtrl.h.

CToolTipCtrl CCJFlatTabCtrl::m_ToolTip [private]

Definition at line 162 of file CJFlatTabCtrl.h.

bool CCJFlatTabCtrl::m_bHasArrows [private]

Definition at line 137 of file CJFlatTabCtrl.h.

bool CCJFlatTabCtrl::m_bHasHomeEnd [private]

Definition at line 138 of file CJFlatTabCtrl.h.

bool CCJFlatTabCtrl::m_bTabsOnBottom [private]

Definition at line 139 of file CJFlatTabCtrl.h.

HENHMETAFILE CCJFlatTabCtrl::m_hEndArrow [private]

Definition at line 159 of file CJFlatTabCtrl.h.

HENHMETAFILE CCJFlatTabCtrl::m_hEndArrowDisabled [private]

Definition at line 160 of file CJFlatTabCtrl.h.

HENHMETAFILE CCJFlatTabCtrl::m_hHomeArrow [private]

Definition at line 157 of file CJFlatTabCtrl.h.

HENHMETAFILE CCJFlatTabCtrl::m_hHomeArrowDisabled [private]

Definition at line 158 of file CJFlatTabCtrl.h.

HENHMETAFILE CCJFlatTabCtrl::m_hLeftArrow [private]

Definition at line 153 of file CJFlatTabCtrl.h.

HENHMETAFILE CCJFlatTabCtrl::m_hLeftArrowDisabled [private]

Definition at line 154 of file CJFlatTabCtrl.h.

HENHMETAFILE CCJFlatTabCtrl::m_hRightArrow [private]

Definition at line 155 of file CJFlatTabCtrl.h.

HENHMETAFILE CCJFlatTabCtrl::m_hRightArrowDisabled [private]

Definition at line 156 of file CJFlatTabCtrl.h.

int CCJFlatTabCtrl::m_iClientHeight [private]

Definition at line 142 of file CJFlatTabCtrl.h.

int CCJFlatTabCtrl::m_iClientWidth [private]

Definition at line 141 of file CJFlatTabCtrl.h.

int CCJFlatTabCtrl::m_iCurSel [private]

Definition at line 140 of file CJFlatTabCtrl.h.

int CCJFlatTabCtrl::m_iTotalTabWidth [private]

Definition at line 143 of file CJFlatTabCtrl.h.

int CCJFlatTabCtrl::m_iXOffset [private]

Definition at line 144 of file CJFlatTabCtrl.h.

CCJMetaFileButton* CCJFlatTabCtrl::m_pEndButton [private]

Definition at line 152 of file CJFlatTabCtrl.h.

CCJMetaFileButton* CCJFlatTabCtrl::m_pHomeButton [private]

Definition at line 151 of file CJFlatTabCtrl.h.

CCJMetaFileButton* CCJFlatTabCtrl::m_pLeftButton [private]

Definition at line 149 of file CJFlatTabCtrl.h.

CCJMetaFileButton* CCJFlatTabCtrl::m_pRightButton [private]

Definition at line 150 of file CJFlatTabCtrl.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJFlatTabCtrl.h
  • WinCvs/CJLib/CJLibrary/CJFlatTabCtrl.cpp
Generated on Sun Oct 21 12:46:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJFontCombo Class Reference

#include <CJFontCombo.h>

Inheritance diagram for CCJFontCombo:

[legend]
Collaboration diagram for CCJFontCombo:

[legend]
List of all members.

Public Methods

CCJFontCombo ()
virtual int | GetSelFont (LOGFONT &logFont)
virtual void | SetHilightColors (COLORREF clrHilight, COLORREF clrHilightText)
virtual void | SetNormalColors (COLORREF clrBkgnd, COLORREF clrNormalText)
virtual void | DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
virtual void | MeasureItem (LPMEASUREITEMSTRUCT lpMeasureItemStruct)
virtual | ~CCJFontCombo ()

Static Public Methods

BOOL CALLBACK | EnumFontProc (LPLOGFONT lpLogFont, LPTEXTMETRIC lpTextMetric, short nFontType, LPHANDLE lpData)

Protected Methods

virtual void | InitializeFonts ()
virtual void | PreSubclassWindow ()
afx_msg void | OnDestroy ()
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnPaint ()

Protected Attributes

COLORREF | m_clrHilight
COLORREF | m_clrNormalText
COLORREF | m_clrHilightText
COLORREF | m_clrBkgnd

Constructor & Destructor Documentation

CCJFontCombo::CCJFontCombo ( )

Definition at line 64 of file CJFontCombo.cpp.

00065 {
00066      m_clrHilight       = ::GetSysColor(COLOR_HIGHLIGHT);
00067      m_clrNormalText    = ::GetSysColor(COLOR_WINDOWTEXT);
00068      m_clrHilightText   = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
00069      m_clrBkgnd         = ::GetSysColor(COLOR_WINDOW);
00070 }

CCJFontCombo::~CCJFontCombo ( ) [virtual]

Definition at line 72 of file CJFontCombo.cpp.

00073 {
00074 }

Member Function Documentation

void CCJFontCombo::DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct ) [virtual]

Definition at line 90 of file CJFontCombo.cpp.

00091 {
00092     CDC*      pDC      = CDC::FromHandle(lpDrawItemStruct->hDC);
00093     CRect     rect     = lpDrawItemStruct->rcItem;
00094     int       nState   = lpDrawItemStruct->itemState;
00095     int       nItem    = lpDrawItemStruct->itemID;
00096     LPLOGFONT pLogFont = (LPLOGFONT)lpDrawItemStruct->itemData;
00097
00098     pDC->SetBkMode( TRANSPARENT );
00099
00100     if( nState & ODS_SELECTED ) {
00101         pDC->FillSolidRect( rect, m_clrHilight );
00102         pDC->SetTextColor( m_clrHilightText );
00103     }
00104     else {
00105         pDC->FillSolidRect( rect, m_clrBkgnd );
00106         pDC->SetTextColor( m_clrNormalText );
00107     }
00108
00109     if( nItem >= 0 )
00110     {
00111         CString strText;
00112         GetLBText( nItem, strText );
00113
00114         CFont newFont;
00115         pLogFont->lfHeight = 90; //9 point size
00116         pLogFont->lfWidth  = 0;
00117         newFont.CreatePointFontIndirect( pLogFont );
00118
00119         CFont *pOldFont = pDC->SelectObject( &newFont );
00120         pDC->DrawText(strText, rect, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
00121         pDC->SelectObject( pOldFont );
00122         newFont.DeleteObject();
00123     }
00124 }

BOOL CALLBACK CCJFontCombo::EnumFontProc | ( | LPLOGFONT | lpLogFont,
 |  | LPTEXTMETRIC | lpTextMetric,
 |  | short | nFontType,
 |  | LPHANDLE | lpData
 | ) | [static]

Definition at line 141 of file CJFontCombo.cpp.

00142 {
00143     UNUSED_ALWAYS( lpTextMetric );
00144
00145     if((nFontType == TRUETYPE_FONTTYPE) && (lpLogFont->lfCharSet != SYMBOL_CHARSET))
00146      {
00147          CCJFontCombo* pCombo = (CCJFontCombo*)lpData;
00148          ASSERT(pCombo);
00149
00150          int nIndex = pCombo->AddString(lpLogFont->lfFaceName);
00151          LPLOGFONT pLogFont = new LOGFONT;
00152
00153          ::CopyMemory((PVOID)pLogFont, (CONST VOID*)lpLogFont, (DWORD)sizeof( LOGFONT ));
00154          pCombo->SetItemData( nIndex, (DWORD)pLogFont );
00155      }
00156
00157      return TRUE;
00158 }

int CCJFontCombo::GetSelFont ( LOGFONT & logFont ) [virtual]

Definition at line 170 of file CJFontCombo.cpp.

00171 {
00172      int nIndex = GetCurSel ();
00173      if(nIndex != LB_ERR)
00174      {
00175         LPLOGFONT pLogFont = (LPLOGFONT)GetItemData(nIndex);
00176         ::CopyMemory((PVOID)&logFont, (CONST VOID*)pLogFont, sizeof(LOGFONT));
00177         return nIndex;
00178      }
00179
00180      return LB_ERR;
00181 }

void CCJFontCombo::InitializeFonts ( ) [protected, virtual]

Definition at line 131 of file CJFontCombo.cpp.

Referenced by OnCreate(), and PreSubclassWindow().

00132 {
00133     // Clear the combobox.
00134      ResetContent();
00135
00136      HDC hDC  = ::GetDC(m_hWnd);
00137      ::EnumFonts( hDC, NULL, (FONTENUMPROC)EnumFontProc, (LPARAM)this );//Enumerate
00138      ::ReleaseDC(m_hWnd, hDC);
00139 }

void CCJFontCombo::MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct ) [virtual]

Definition at line 126 of file CJFontCombo.cpp.

00127 {
00128     UNUSED_ALWAYS( lpMeasureItemStruct );
00129 }

int CCJFontCombo::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 183 of file CJFontCombo.cpp.

00184 {
00185     if (CComboBox::OnCreate(lpCreateStruct) == -1)
00186         return -1;
00187
00188     InitializeFonts();
00189     return 0;
00190 }

void CCJFontCombo::OnDestroy ( void ) [protected]

Definition at line 160 of file CJFontCombo.cpp.

00161 {
00162     for( int nIndex = 0; nIndex <  GetCount(); ++nIndex ) {
00163         LPLOGFONT pLogFont = (LPLOGFONT)GetItemData(nIndex);
00164         _delete( pLogFont );
00165     }
00166
00167      CComboBox::OnDestroy();
00168 }

BOOL CCJFontCombo::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 198 of file CJFontCombo.cpp.

00199 {
00200     // KStowell - overridden for flicker-free drawing.
00201     UNUSED_ALWAYS(pDC);
00202     return TRUE;
00203 }

void CCJFontCombo::OnPaint ( ) [protected]

Definition at line 205 of file CJFontCombo.cpp.

00206 {
00207     CPaintDC dc(this); // device context for painting
00208
00209     // KStowell - Get the client rect.
00210     CRect rcClient, rcClip;
00211     dc.GetClipBox( &rcClip );
00212     GetClientRect( &rcClient );
00213
00214     // KStowell - Create a memory device-context. This is done to help reduce
00215     // screen flicker, since we will paint the entire control to the
00216     // off screen device context first.
00217     CDC memDC;
00218     CBitmap bitmap;
00219     memDC.CreateCompatibleDC(&dc);
00220     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00221     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00222
00223     // KStowell - Repaint the background.
00224     memDC.FillSolidRect(rcClient, ::GetSysColor(COLOR_WINDOW));
00225
00226     // let the control do its default drawing.
00227     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00228
00229     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00230     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00231         rcClip.left, rcClip.top, SRCCOPY );
00232
00233     // KStowell - Cleanup resources.
00234     memDC.SelectObject(pOldBitmap);
00235     memDC.DeleteDC();
00236     bitmap.DeleteObject();
00237 }

void CCJFontCombo::PreSubclassWindow ( ) [protected, virtual]

Definition at line 192 of file CJFontCombo.cpp.

00193 {
00194     CComboBox::PreSubclassWindow();
00195     InitializeFonts();
00196 }

_CJXLIB_INLINE void CCJFontCombo::SetHilightColors | ( | COLORREF | clrHilight,
 |  | COLORREF | clrHilightText
 | ) | [virtual]

Definition at line 109 of file CJFontCombo.h.

00110     { m_clrHilight = clrHilight; m_clrHilightText = clrHilightText; };

_CJXLIB_INLINE void CCJFontCombo::SetNormalColors | ( | COLORREF | clrBkgnd,
 |  | COLORREF | clrNormalText
 | ) | [virtual]

Definition at line 112 of file CJFontCombo.h.

00113     { m_clrNormalText = clrNormalText; m_clrBkgnd = clrBkgnd; };

Member Data Documentation

COLORREF CCJFontCombo::m_clrBkgnd [protected]

Definition at line 65 of file CJFontCombo.h.

COLORREF CCJFontCombo::m_clrHilight [protected]

Definition at line 62 of file CJFontCombo.h.

COLORREF CCJFontCombo::m_clrHilightText [protected]

Definition at line 64 of file CJFontCombo.h.

COLORREF CCJFontCombo::m_clrNormalText [protected]

Definition at line 63 of file CJFontCombo.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJFontCombo.h
  • WinCvs/CJLib/CJLibrary/CJFontCombo.cpp
Generated on Sun Oct 21 12:46:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJFrameWnd Class Reference

#include <CJFrameWnd.h>

Inheritance diagram for CCJFrameWnd:

[legend]
Collaboration diagram for CCJFrameWnd:

[legend]
List of all members.

Public Methods

CCJFrameWnd ()
virtual | ~CCJFrameWnd ()
virtual void | LoadBarState (LPCTSTR lpszProfileName)
virtual void | SaveBarState (LPCTSTR lpszProfileName) const
virtual BOOL | InitializeMenu (UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=0)
virtual BOOL | InitializeMenu (UINT nMenuID, UINT nToolbarID=NULL)
virtual void | RecalcAllExcept (CCJSizeDockBar *pBar)
virtual void | EnableDocking (DWORD dwDockStyle)
virtual void | EnableDockingSizeBar (DWORD dwDockStyle, DockFlatBorders FlatFlags=brdrAllRaised)
virtual void | DockSizeBar (CControlBar *pBar, CCJSizeDockBar *pDockBar=NULL, LPRECT lpRect=NULL)
virtual void | DockControlBarLeftOf (CControlBar *Bar, CControlBar *LeftOf)
virtual void | RecalcLayout (BOOL bNotify=TRUE)
virtual BOOL | PreTranslateMessage (MSG *pMsg)

Protected Types

enum DockFlatBorders {
brdrAllRaised = 0x0000, brdrFlatTop = 0x0001, brdrFlatBottom = 0x0002, brdrFlatLeft = 0x0004,
brdrFlatRight = 0x0008, brdrFlatVertical = 0x0003, brdrFlatHorizontal = 0x000C, brdrFlatAll = 0x000F
}

Protected Methods

virtual HMENU | NewMenu (UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=0)
virtual HMENU | NewMenu (UINT nMenuID, UINT nToolbarID=NULL)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs, UINT nIconID)
afx_msg void | OnMeasureItem (int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
afx_msg LRESULT | OnMenuChar (UINT nChar, UINT nFlags, CMenu *pMenu)
afx_msg void | OnInitMenuPopup (CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu)
afx_msg void | OnClose ()

Protected Attributes

CCJMenu m_menu
CCJMenuBar m_wndMenuBar

Static Protected Attributes

DWORD | dwDockBarMap [4][2]

Member Enumeration Documentation

enum CCJFrameWnd::DockFlatBorders [protected]

Enumeration values:
brdrAllRaised
brdrFlatTop
brdrFlatBottom
brdrFlatLeft
brdrFlatRight
brdrFlatVertical
brdrFlatHorizontal
brdrFlatAll

Definition at line 154 of file CJFrameWnd.h.

00154                          {
00155         brdrAllRaised       = 0x0000,
00156         brdrFlatTop         = 0x0001,
00157         brdrFlatBottom      = 0x0002,
00158         brdrFlatLeft        = 0x0004,
00159         brdrFlatRight       = 0x0008,
00160         brdrFlatVertical    = 0x0003,
00161         brdrFlatHorizontal  = 0x000C,
00162         brdrFlatAll         = 0x000F
00163     };

Constructor & Destructor Documentation

CCJFrameWnd::CCJFrameWnd ( )

Definition at line 133 of file CJFrameWnd.cpp.

00134 {
00135
00136 }

CCJFrameWnd::~CCJFrameWnd ( ) [virtual]

Definition at line 138 of file CJFrameWnd.cpp.

00139 {
00140 }

Member Function Documentation

void CCJFrameWnd::DockControlBarLeftOf | ( | CControlBar * | Bar,
 |  | CControlBar * | LeftOf
 | ) | [virtual]

Definition at line 165 of file CJFrameWnd.cpp.

00166 {
00167     CRect rect;
00168     DWORD dw;
00169     UINT n;
00170
00171     // get MFC to adjust the dimensions of all docked ToolBars
00172     // so that GetWindowRect will be accurate
00173     RecalcLayout(TRUE);
00174
00175     LeftOf->GetWindowRect(&rect);
00176     rect.OffsetRect(1,0);
00177     dw=LeftOf->GetBarStyle();
00178     n = 0;
00179     n = (dw&CBRS_ALIGN_TOP)              ? AFX_IDW_DOCKBAR_TOP      : n;
00180     n = (dw&CBRS_ALIGN_BOTTOM   && n==0) ? AFX_IDW_DOCKBAR_BOTTOM   : n;
00181     n = (dw&CBRS_ALIGN_LEFT     && n==0) ? AFX_IDW_DOCKBAR_LEFT     : n;
00182     n = (dw&CBRS_ALIGN_RIGHT    && n==0) ? AFX_IDW_DOCKBAR_RIGHT    : n;
00183
00184     // When we take the default parameters on rect, DockControlBar will dock
00185     // each Toolbar on a seperate line. By calculating a rectangle, we in effect
00186     // are simulating a Toolbar being dragged to that location and docked.
00187     DockControlBar(Bar,n,&rect);
00188 }

void CCJFrameWnd::DockSizeBar | ( | CControlBar * | pBar,
 |  | CCJSizeDockBar * | pDockBar = NULL,
 |  | LPRECT | lpRect = NULL
 | ) | [virtual]

Definition at line 270 of file CJFrameWnd.cpp.

00271 {
00272     ASSERT(pBar != NULL);
00273     ASSERT(pBar->m_pDockContext != NULL);
00274
00275     if( pDockBar == NULL )
00276     {
00277         for (int i = 0; i < 4; i++)
00278         {
00279             if ((dwSizeBarMap[i][1] & CBRS_ALIGN_ANY) == (pBar->m_dwStyle & CBRS_ALIGN_ANY))
00280             {
00281                 pDockBar = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00282                 ASSERT(pDockBar != NULL);
00283
00284                 int nSize = 0;
00285
00286                 switch(i)
00287                 {
00288                 case 0: // horizontal dock
00289                 case 1:
00290                     nSize = ((CCJControlBar*)pBar)->GetHorzSize();
00291                     break;
00292                 case 2: // vertical dock
00293                 case 3:
00294                     nSize = ((CCJControlBar*)pBar)->GetVertSize();
00295                     break;
00296                 }
00297
00298                 pDockBar->SetActualSize( nSize );
00299                 break;
00300             }
00301         }
00302     }
00303
00304     ASSERT(pDockBar != NULL);
00305     ASSERT(m_listControlBars.Find(pBar) != NULL);
00306     ASSERT(pBar->m_pDockSite == this);
00307     ((CCJControlBar*)pBar)->Normalize();
00308     pDockBar->DockControlBar(pBar, lpRect);
00309 }

void CCJFrameWnd::EnableDocking ( DWORD dwDockStyle ) [virtual]

Definition at line 190 of file CJFrameWnd.cpp.

00191 {
00192     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00193     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00194     CFrameWnd::EnableDocking(dwDockStyle);
00195
00196     for (int i = 0; i < 4; i++) {
00197         if (dwDockBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY) {
00198             CDockBar* pDock = (CDockBar*)GetControlBar(dwDockBarMap[i][0]);
00199
00200             // make sure the dock bar is of correct type
00201             if( pDock || !pDock->IsKindOf(RUNTIME_CLASS(CCJDockBar)) ) {
00202                 BOOL bNeedDelete = ! pDock->m_bAutoDelete;
00203                 pDock->m_pDockSite->RemoveControlBar(pDock);
00204                 pDock->m_pDockSite = 0; // avoid problems in destroying the dockbar
00205                 pDock->DestroyWindow();
00206                 if( bNeedDelete )
00207                     delete pDock;
00208                 pDock = 0;
00209             }
00210
00211             if( pDock == 0 ) {
00212                 pDock = new CCJDockBar;
00213                 if (!pDock->Create(this,
00214                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00215                     dwDockBarMap[i][1], dwDockBarMap[i][0])) {
00216                     AfxThrowResourceException();
00217                 }
00218             }
00219         }
00220     }
00221 }

void CCJFrameWnd::EnableDockingSizeBar | ( | DWORD | dwDockStyle,
 |  | DockFlatBorders | FlatFlags = brdrAllRaised
 | ) | [virtual]

Definition at line 230 of file CJFrameWnd.cpp.

00231 {
00232     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00233     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00234
00235     m_pFloatingFrameClass = RUNTIME_CLASS(CCJMiniDockFrameWnd);
00236     for (int i = 0; i < 4; i++)
00237     {
00238         if (dwSizeBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY)
00239         {
00240             CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00241             if (pDock == NULL)
00242             {
00243                 pDock = new CCJSizeDockBar;
00244
00245                 if (!pDock->Create(this,
00246                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00247                         dwSizeBarMap[i][1], dwSizeBarMap[i][0]))
00248                 {
00249                     AfxThrowResourceException();
00250                 }
00251                 //Yiannhs enable Flat Borders For dock Bars
00252                 pDock->FlatBorder( (FlatFlags >> i) & 0x0001 );
00253             }
00254         }
00255     }
00256 }

BOOL CCJFrameWnd::InitializeMenu | ( | UINT | nMenuID,
 |  | UINT | nToolBarID = NULL
 | ) | [virtual]

Definition at line 335 of file CJFrameWnd.cpp.

00336 {
00337     ASSERT(nMenuID);     // must be valid.
00338
00339     // Get a pointer to the existing menu, and destroy it.
00340     CMenu* pMenu = GetMenu();
00341     ASSERT_VALID(pMenu);
00342     pMenu->DestroyMenu();
00343
00344     // Set the default menu with the newly created Menu.
00345     m_hMenuDefault = NewMenu(nMenuID, nToolBarID);
00346     SetMenu(CMenu::FromHandle(m_hMenuDefault));
00347
00348     return TRUE;
00349 }

BOOL CCJFrameWnd::InitializeMenu | ( | UINT | nMenuID,
 |  | UINT * | nToolbarIDs = NULL,
 |  | int | nSize = 0
 | ) | [virtual]

Definition at line 351 of file CJFrameWnd.cpp.

00352 {
00353     ASSERT(nMenuID);     // must be valid.
00354
00355     // Get a pointer to the existing menu, and destroy it.
00356     CMenu* pMenu = GetMenu();
00357     ASSERT_VALID(pMenu);
00358     pMenu->DestroyMenu();
00359
00360     // Set the default menu with the newly created Menu.
00361     m_hMenuDefault = NewMenu(nMenuID, nToolbarIDs, nSize);
00362     SetMenu(CMenu::FromHandle(m_hMenuDefault));
00363
00364     return TRUE;
00365 }

void CCJFrameWnd::LoadBarState ( LPCTSTR lpszProfileName ) [virtual]

Definition at line 416 of file CJFrameWnd.cpp.

00417 {
00418     CCJSizeDockBar::m_bIsDockBar = true;
00419     CFrameWnd::LoadBarState(lpszProfileName);
00420     CCJSizeDockBar::m_bIsDockBar = false;
00421 }

HMENU CCJFrameWnd::NewMenu | ( | UINT | nMenuID,
 |  | UINT | nToolbarID = NULL
 | ) | [protected, virtual]

Definition at line 311 of file CJFrameWnd.cpp.

00312 {
00313     // Load the menu and toolbar resource.
00314     m_menu.LoadMenu(nMenuID);
00315     if (nToolbarID) {
00316         m_menu.LoadToolbar(nToolbarID);
00317     }
00318
00319     // Detach the menu.
00320     return(m_menu.Detach());
00321 }

HMENU CCJFrameWnd::NewMenu | ( | UINT | nMenuID,
 |  | UINT * | nToolbarIDs = NULL,
 |  | int | nSize = 0
 | ) | [protected, virtual]

Definition at line 323 of file CJFrameWnd.cpp.

Referenced by InitializeMenu().

00324 {
00325     // Load the menu and toolbar resources.
00326     m_menu.LoadMenu(nMenuID);
00327     if (nToolbarIDs) {
00328         m_menu.LoadToolbars(nToolbarIDs, nSize);
00329     }
00330
00331     // Detach the menu.
00332     return(m_menu.Detach());
00333 }

void CCJFrameWnd::OnClose ( ) [protected]

Definition at line 430 of file CJFrameWnd.cpp.

00431 {
00432     // Clear active view before close
00433     SetActiveView (NULL);
00434     CFrameWnd::OnClose();
00435 }

void CCJFrameWnd::OnInitMenuPopup | ( | CMenu * | pPopupMenu,
 |  | UINT | nIndex,
 |  | BOOL | bSysMenu
 | ) | [protected]

Definition at line 393 of file CJFrameWnd.cpp.

00394 {
00395     CFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
00396
00397     if(!bSysMenu)
00398     {
00399         if(m_menu.IsMenu(pPopupMenu)) {
00400             CCJMenu::UpdateMenu(pPopupMenu);
00401         }
00402     }
00403 }

void CCJFrameWnd::OnMeasureItem | ( | int | nIDCtl,
 |  | LPMEASUREITEMSTRUCT | lpMeasureItemStruct
 | ) | [protected]

Definition at line 367 of file CJFrameWnd.cpp.

00368 {
00369     if (lpMeasureItemStruct->CtlType == ODT_MENU)
00370     {
00371         if (IsMenu((HMENU)lpMeasureItemStruct->itemID)) {
00372             CMenu* pMenu = CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
00373
00374             if(m_menu.IsMenu(pMenu)) {
00375                 m_menu.MeasureItem(lpMeasureItemStruct);
00376                 return;
00377             }
00378         }
00379     }
00380
00381     CFrameWnd::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
00382 }

LRESULT CCJFrameWnd::OnMenuChar | ( | UINT | nChar,
 |  | UINT | nFlags,
 |  | CMenu * | pMenu
 | ) | [protected]

Definition at line 384 of file CJFrameWnd.cpp.

00385 {
00386     if(m_menu.IsMenu(pMenu)) {
00387         return CCJMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
00388     }
00389
00390     return CFrameWnd::OnMenuChar(nChar, nFlags, pMenu);
00391 }

BOOL CCJFrameWnd::PreCreateWindow | ( | CREATESTRUCT & | cs,
 |  | UINT | nIconID
 | ) | [protected, virtual]

Definition at line 448 of file CJFrameWnd.cpp.

00449 {
00450     // Register wnd class with no redraw, cursor (use default), background
00451     // brush and load your apps icon resource.
00452     cs.lpszClass = AfxRegisterWndClass( 0, NULL, NULL,
00453         AfxGetApp()->LoadIcon(nIconID));
00454     ASSERT(cs.lpszClass);
00455
00456     return CFrameWnd::PreCreateWindow(cs);
00457 }

BOOL CCJFrameWnd::PreCreateWindow ( CREATESTRUCT & cs ) [protected, virtual]

Definition at line 438 of file CJFrameWnd.cpp.

00439 {
00440     return CFrameWnd::PreCreateWindow(cs);
00441 }

BOOL CCJFrameWnd::PreTranslateMessage ( MSG * pMsg ) [virtual]

Definition at line 405 of file CJFrameWnd.cpp.

00406 {
00407     if( m_wndMenuBar.GetSafeHwnd()) {
00408         if( m_wndMenuBar.TranslateFrameMessage(pMsg)) {
00409             return TRUE;
00410         }
00411     }
00412
00413     return CFrameWnd::PreTranslateMessage(pMsg);
00414 }

void CCJFrameWnd::RecalcAllExcept ( CCJSizeDockBar * pBar ) [virtual]

Definition at line 258 of file CJFrameWnd.cpp.

Referenced by RecalcLayout().

00259 {
00260     for (int i = 0; i < 4; i++)
00261     {
00262         CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00263         if (pDock != NULL && pDock != pBar)
00264         {
00265             pDock->CalcSizeBarLayout();
00266         }
00267     }
00268 }

void CCJFrameWnd::RecalcLayout ( BOOL bNotify = TRUE ) [virtual]

Definition at line 223 of file CJFrameWnd.cpp.

00224 {
00225     CFrameWnd::RecalcLayout(bNotify);
00226     RecalcAllExcept(NULL);
00227 }

void CCJFrameWnd::SaveBarState ( LPCTSTR lpszProfileName ) const [virtual]

Definition at line 423 of file CJFrameWnd.cpp.

00424 {
00425     CCJSizeDockBar::m_bIsDockBar = true;
00426     CFrameWnd::SaveBarState(lpszProfileName);
00427     CCJSizeDockBar::m_bIsDockBar = false;
00428 }

Member Data Documentation

DWORD CCJFrameWnd::dwDockBarMap [static, protected]

Initial value:

{
    { AFX_IDW_DOCKBAR_TOP,      CBRS_TOP    },
    { AFX_IDW_DOCKBAR_BOTTOM,   CBRS_BOTTOM },
    { AFX_IDW_DOCKBAR_LEFT,     CBRS_LEFT   },
    { AFX_IDW_DOCKBAR_RIGHT,    CBRS_RIGHT  },
}

Definition at line 157 of file CJFrameWnd.cpp.

CCJMenu CCJFrameWnd::m_menu [protected]

Definition at line 150 of file CJFrameWnd.h.

CCJMenuBar CCJFrameWnd::m_wndMenuBar [protected]

Definition at line 151 of file CJFrameWnd.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJFrameWnd.h
  • WinCvs/CJLib/CJLibrary/CJFrameWnd.cpp
Generated on Sun Oct 21 12:46:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJHexEdit Class Reference

#include <CJHexEdit.h>

Inheritance diagram for CCJHexEdit:

[legend]
Collaboration diagram for CCJHexEdit:

[legend]
List of all members.

Public Types

enum | EDITMODE { EDIT_NONE, EDIT_ASCII, EDIT_HIGH, EDIT_LOW }

Public Methods

CCJHexEdit ()
virtual int | GetData (LPBYTE p, int len)
virtual void | SetData (LPBYTE p, int len)
virtual CSize | GetSel (void)
virtual void | SetSel (int s, int e)
virtual void | SetBPR (int bpr)
virtual void | SetOptions (BOOL a, BOOL h, BOOL c, BOOL w)
virtual BOOL | Create (LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL)
virtual | ~CCJHexEdit ()

Public Attributes

LPBYTE | m_pData
int | m_length
int | m_topindex
int | m_currentAddress
EDITMODE m_currentMode
int | m_selStart
int | m_selEnd
int | m_bpr
int | m_lpp
BOOL | m_bShowAddress
BOOL | m_bShowAscii
BOOL | m_bShowHex
BOOL | m_bAddressIsWide
BOOL | m_bNoAddressChange
BOOL | m_bHalfPage
CFont | m_Font
int | m_lineHeight
int | m_nullWidth
BOOL | m_bUpdate
int | m_offHex
int | m_offAscii
int | m_offAddress
CPoint | m_editPos

Protected Methods

virtual void | ScrollIntoView (int p)
virtual void | RepositionCaret (int p)
virtual void | Move (int x, int y)
virtual BOOL | IsSelected (void)
virtual void | UpdateScrollbars (void)
virtual void | CreateEditCaret (void)
virtual void | CreateAddressCaret (void)
virtual CPoint | CalcPos (int x, int y)
virtual void | SelInsert (int s, int l)
virtual void | SelDelete (int s, int e)
virtual void | NormalizeSel (void)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
afx_msg void | OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg void | OnKillFocus (CWnd *pNewWnd)
afx_msg void | OnPaint ()
afx_msg void | OnSetFocus (CWnd *pOldWnd)
afx_msg void | OnVScroll (UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
afx_msg UINT | OnGetDlgCode ()
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point)
afx_msg void | OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg void | OnEditClear ()
afx_msg void | OnEditCopy ()
afx_msg void | OnEditCut ()
afx_msg void | OnEditPaste ()
afx_msg void | OnEditSelectAll ()
afx_msg void | OnEditUndo ()
afx_msg void | OnContextMenu (CWnd *, CPoint point)
afx_msg void | OnHScroll (UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
afx_msg void | OnLButtonDblClk (UINT nFlags, CPoint point)

Member Enumeration Documentation

enum CCJHexEdit::EDITMODE

Enumeration values:
EDIT_NONE
EDIT_ASCII
EDIT_HIGH
EDIT_LOW

Definition at line 44 of file CJHexEdit.h.

00044 { EDIT_NONE, EDIT_ASCII, EDIT_HIGH, EDIT_LOW } ;

Constructor & Destructor Documentation

CCJHexEdit::CCJHexEdit ( )

Definition at line 47 of file CJHexEdit.cpp.

00048 {
00049     m_pData         = NULL;     // pointer to data
00050     m_length        = 0;        // length of data
00051     m_length        = 0x40;
00052     m_topindex      = 0;
00053     m_bpr           = 8;        // byte per row
00054     m_lpp           = 1;
00055
00056     m_bShowHex      = TRUE;
00057     m_bShowAscii    = TRUE;
00058     m_bShowAddress  = TRUE;
00059     m_bAddressIsWide= TRUE;     // 4/8 byte address
00060
00061     m_offAddress    = 0;
00062     m_offHex        = 0;
00063     m_offAscii      = 0;
00064
00065     m_bUpdate = TRUE;           // update font info
00066     m_bNoAddressChange = FALSE;
00067     m_currentMode = EDIT_NONE;
00068
00069     m_editPos.x = m_editPos.y = 0;
00070     m_currentAddress = 0;
00071     m_bHalfPage = TRUE;
00072
00073     m_selStart  = 0xffffffff;
00074     m_selEnd    = 0xffffffff;
00075
00076     m_Font.CreateFont(-12, 0,0,0,0,0,0,0,0,0,0,0,0, _T("Courier New"));
00077
00078     AfxOleInit();
00079 }

CCJHexEdit::~CCJHexEdit ( ) [virtual]

Definition at line 81 of file CJHexEdit.cpp.

00082 {
00083     m_Font.DeleteObject();
00084 }

Member Function Documentation

CPoint CCJHexEdit::CalcPos | ( | int | x,
 |  | int | y
 | ) | [protected, virtual]

Definition at line 538 of file CJHexEdit.cpp.

Referenced by OnLButtonDown(), and OnMouseMove().

00539 {
00540     y /= m_lineHeight;
00541     if(y < 0 || y > m_lpp)
00542         return CPoint(-1, -1);
00543
00544     if(y * m_bpr > m_length)
00545         return CPoint(-1, -1);
00546
00547     x += m_nullWidth;
00548     x /= m_nullWidth;
00549
00550     int xp;
00551
00552     if(m_bShowAddress && x <= (m_bAddressIsWide ? 8 : 4))
00553     {
00554         m_currentAddress = m_topindex + (m_bpr * y);
00555         m_currentMode = EDIT_NONE;
00556         return CPoint(0, y);
00557     }
00558
00559     xp = (m_offHex  / m_nullWidth) + m_bpr * 3;
00560     if(m_bShowHex && x < xp)
00561     {
00562         if(x%3)
00563             x--;
00564         m_currentAddress = m_topindex + (m_bpr * y) + (x - (m_offHex  / m_nullWidth)) / 3;
00565         m_currentMode =  ((x%3) & 0x01) ? EDIT_LOW : EDIT_HIGH;
00566         return CPoint(x, y);
00567     }
00568
00569     xp = (m_offAscii  / m_nullWidth) + m_bpr;
00570     if(m_bShowAscii && x < xp)
00571     {
00572         m_currentAddress = m_topindex + (m_bpr * y) + (x - (m_offAscii  / m_nullWidth));
00573         m_currentMode = EDIT_ASCII;
00574         return CPoint(x, y);
00575     }
00576
00577     return CPoint(-1,-1);
00578 }

BOOL CCJHexEdit::Create | ( | LPCTSTR | lpszClassName,
 |  | LPCTSTR | lpszWindowName,
 |  | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | CCreateContext * | pContext = NULL
 | ) | [virtual]

Definition at line 466 of file CJHexEdit.cpp.

00467 {
00468     if(!CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext)) {
00469         return FALSE;
00470     }
00471
00472     SetFont(&m_Font);
00473     return TRUE;
00474 }

void CCJHexEdit::CreateAddressCaret ( void ) [protected, virtual]

Definition at line 580 of file CJHexEdit.cpp.

Referenced by OnLButtonDown(), OnSetFocus(), RepositionCaret(), and SetSel().

00581 {
00582     DestroyCaret();
00583     CreateSolidCaret(m_nullWidth * (m_bAddressIsWide ? 8 : 4), m_lineHeight);
00584 }

void CCJHexEdit::CreateEditCaret ( void ) [protected, virtual]

Definition at line 586 of file CJHexEdit.cpp.

Referenced by OnLButtonDown(), OnSetFocus(), RepositionCaret(), and SetSel().

00587 {
00588     DestroyCaret();
00589     CreateSolidCaret(m_nullWidth, m_lineHeight);
00590 }

_CJXLIB_INLINE int CCJHexEdit::GetData | ( | LPBYTE | p,
 |  | int | len
 | ) | [virtual]

Definition at line 153 of file CJHexEdit.h.

00154     { memcpy(p, m_pData, min(len, m_length)); return m_length; }

_CJXLIB_INLINE CSize CCJHexEdit::GetSel ( void ) [virtual]

Definition at line 150 of file CJHexEdit.h.

00151     { return CSize(m_selStart, m_selEnd); }

_CJXLIB_INLINE BOOL CCJHexEdit::IsSelected ( void ) [protected, virtual]

Definition at line 147 of file CJHexEdit.h.

Referenced by OnChar(), OnContextMenu(), OnKeyDown(), OnLButtonDown(), OnLButtonUp(), OnMouseMove(), and OnSetFocus().

00148     { return m_selStart != 0xffffffff; }

void CCJHexEdit::Move | ( | int | x,
 |  | int | y
 | ) | [protected, virtual]

Definition at line 976 of file CJHexEdit.cpp.

Referenced by OnChar(), and OnKeyDown().

00977 {
00978     switch(m_currentMode)
00979     {
00980         case EDIT_NONE:
00981             return;
00982         case EDIT_HIGH:
00983             if(x != 0)
00984                 m_currentMode = EDIT_LOW;
00985             if(x == -1)
00986                 m_currentAddress --;
00987             m_currentAddress += y* m_bpr;
00988             break;
00989         case EDIT_LOW:
00990             if(x != 0)
00991                 m_currentMode = EDIT_HIGH;
00992             if(x == 1)
00993                 m_currentAddress++;
00994             m_currentAddress += y* m_bpr;
00995             break;
00996         case EDIT_ASCII:
00997             {
00998                 m_currentAddress += x;
00999                 m_currentAddress += y*m_bpr;
01000             }
01001             break;
01002     }
01003     if(m_currentAddress < 0)
01004         m_currentAddress = 0;
01005
01006     if(m_currentAddress >= m_length)
01007     {
01008         m_currentAddress -= x;
01009         m_currentAddress -= y*m_bpr;
01010     }
01011     m_bNoAddressChange = TRUE;
01012     if(m_currentAddress < m_topindex)
01013     {
01014         OnVScroll(SB_LINEUP, 0, NULL);
01015     }
01016     if(m_currentAddress >= m_topindex + m_lpp*m_bpr)
01017     {
01018         OnVScroll(SB_LINEDOWN, 0, NULL);
01019     }
01020     m_bNoAddressChange = FALSE;
01021     //ScrollIntoView(m_currentAddress);
01022     RepositionCaret(m_currentAddress);
01023 }

void CCJHexEdit::NormalizeSel ( void ) [protected, virtual]

Definition at line 1269 of file CJHexEdit.cpp.

Referenced by OnEditPaste().

01270 {
01271     if(m_selStart > m_selEnd)
01272         m_selStart ^= m_selEnd ^= m_selStart ^= m_selEnd;
01273 }

void CCJHexEdit::OnChar | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags
 | ) | [protected]

Definition at line 671 of file CJHexEdit.cpp.

00672 {
00673     nFlags;nRepCnt;
00674     if(!m_pData)
00675         return;
00676     if(nChar == '\t')
00677         return;
00678     if(GetKeyState(VK_CONTROL) & 0x80000000)
00679     {
00680         switch(nChar)
00681         {
00682             case 0x03:
00683                 if(IsSelected())
00684                     OnEditCopy();
00685                 return;
00686             case 0x16:
00687                 OnEditPaste();
00688                 return;
00689             case 0x18:
00690                 if(IsSelected())
00691                     OnEditCut();
00692                 return;
00693             case 0x1a:
00694                 OnEditUndo();
00695                 return;
00696         }
00697     }
00698
00699     if(nChar == 0x08)
00700     {
00701         if(m_currentAddress > 0)
00702         {
00703             m_currentAddress--;
00704             SelDelete(m_currentAddress, m_currentAddress+1);
00705             RepositionCaret(m_currentAddress);
00706             RedrawWindow();
00707         }
00708         return;
00709     }
00710
00711     SetSel(-1, -1);
00712     switch(m_currentMode)
00713     {
00714         case EDIT_NONE:
00715             return;
00716         case EDIT_HIGH:
00717         case EDIT_LOW:
00718             if((nChar >= '0' && nChar <= '9') || (nChar >= 'a' && nChar <= 'f'))
00719             {
00720                 UINT b = nChar - '0';
00721                 if(b > 9)
00722                     b = 10 + nChar - 'a';
00723
00724                 if(m_currentMode == EDIT_HIGH)
00725                 {
00726                     m_pData[m_currentAddress] = (unsigned char)((m_pData[m_currentAddress] & 0x0f) | (b << 4));
00727                 }
00728                 else
00729                 {
00730                     m_pData[m_currentAddress] = (unsigned char)((m_pData[m_currentAddress] & 0xf0) | b);
00731                 }
00732                 Move(1,0);
00733             }
00734             break;
00735         case EDIT_ASCII:
00736             m_pData[m_currentAddress] = (unsigned char)nChar;
00737             Move(1,0);
00738             break;
00739     }
00740     RedrawWindow();
00741 }

void CCJHexEdit::OnContextMenu | ( | CWnd * | ,
 |  | CPoint | point
 | ) | [protected]

Definition at line 1094 of file CJHexEdit.cpp.

01095 {
01096     if (point.x == -1 && point.y == -1)
01097     {
01098         //keystroke invocation
01099         CRect rect;
01100         GetClientRect(rect);
01101         ClientToScreen(rect);
01102
01103         point = rect.TopLeft();
01104         point.Offset(5, 5);
01105     }
01106
01107     CMenu menu;
01108     VERIFY(menu.LoadMenu(IDR_POPUP_HEX_EDIT));
01109
01110     CMenu* pPopup = menu.GetSubMenu(0);
01111     ASSERT(pPopup != NULL);
01112
01113     pPopup->EnableMenuItem(ID_EDIT_UNDO, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
01114     if(!IsSelected())
01115     {
01116         pPopup->EnableMenuItem(ID_EDIT_CLEAR, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
01117         pPopup->EnableMenuItem(ID_EDIT_CUT, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
01118         pPopup->EnableMenuItem(ID_EDIT_COPY, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
01119     }
01120     {
01121         COleDataObject  obj;
01122         if (obj.AttachClipboard())
01123         {
01124             if(
01125                 !obj.IsDataAvailable(CF_TEXT) && !obj.IsDataAvailable((CLIPFORMAT)RegisterClipboardFormat( _T("BinaryData"))))
01126                 pPopup->EnableMenuItem(ID_EDIT_PASTE, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
01127         }
01128     }
01129
01130     pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
01131         this);
01132 }

void CCJHexEdit::OnEditClear ( ) [protected]

Definition at line 1134 of file CJHexEdit.cpp.

Referenced by OnKeyDown().

01135 {
01136     m_currentAddress = m_selStart;
01137     SelDelete(m_selStart, m_selEnd);
01138     RepositionCaret(m_currentAddress);
01139     RedrawWindow();
01140 }

void CCJHexEdit::OnEditCopy ( ) [protected]

Definition at line 1142 of file CJHexEdit.cpp.

Referenced by OnChar(), and OnEditCut().

01143 {
01144     COleDataSource*     pSource = new COleDataSource();
01145     EmptyClipboard();
01146     if(m_currentMode != EDIT_ASCII)
01147     {
01148         int         dwLen = (m_selEnd-m_selStart);
01149         HGLOBAL     hMemb = ::GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT, m_selEnd-m_selStart);
01150         HGLOBAL     hMema = ::GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT, (dwLen) * 3);
01151
01152         if (!hMema)
01153             return;
01154
01155         // copy binary
01156         LPBYTE  p = (BYTE*)::GlobalLock(hMemb);
01157         memcpy(p, m_pData+m_selStart, dwLen);
01158         ::GlobalUnlock(hMemb);
01159
01160         // copy ascii
01161         p = (BYTE*)::GlobalLock(hMema);
01162         for(int  i = 0; i < dwLen;)
01163         {
01164             TOHEX(m_pData[m_selStart+i], p);
01165             *p++ = ' ';
01166             i++;
01167         }
01168
01169         ::GlobalUnlock(hMema);
01170
01171         pSource->CacheGlobalData((CLIPFORMAT)RegisterClipboardFormat( _T("BinaryData")), hMemb);
01172         pSource->CacheGlobalData(CF_TEXT, hMema);
01173     }
01174     else
01175     {
01176         HGLOBAL             hMemb = ::GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT, m_selEnd-m_selStart);
01177         HGLOBAL             hMema = ::GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT, m_selEnd-m_selStart);
01178         if (!hMemb || !hMema)
01179             return;
01180
01181         // copy binary
01182         LPBYTE  p = (BYTE*)::GlobalLock(hMemb);
01183         int     dwLen = m_selEnd-m_selStart;
01184
01185         memcpy(p, m_pData+m_selStart, dwLen);
01186         ::GlobalUnlock(hMemb);
01187
01188         // copy ascii
01189         p = (BYTE*)::GlobalLock(hMema);
01190         memcpy(p, m_pData+m_selStart, dwLen);
01191         for(int i = 0; i < dwLen; p++, i++)
01192             if(!isprint(*p))
01193                 *p = '.';
01194         ::GlobalUnlock(hMema);
01195
01196         pSource->CacheGlobalData((CLIPFORMAT)RegisterClipboardFormat( _T("BinaryData")), hMemb);
01197         pSource->CacheGlobalData(CF_TEXT, hMema);
01198     }
01199     pSource->SetClipboard();
01200 }

void CCJHexEdit::OnEditCut ( ) [protected]

Definition at line 1202 of file CJHexEdit.cpp.

Referenced by OnChar().

01203 {
01204     OnEditCopy();
01205     SelDelete(m_selStart, m_selEnd);
01206     RedrawWindow();
01207 }

void CCJHexEdit::OnEditPaste ( ) [protected]

Definition at line 1209 of file CJHexEdit.cpp.

Referenced by OnChar().

01210 {
01211     COleDataObject  obj;
01212     if (obj.AttachClipboard())
01213     {
01214         HGLOBAL hmem = NULL;
01215         if (obj.IsDataAvailable((CLIPFORMAT)RegisterClipboardFormat( _T("BinaryData"))))
01216         {
01217             hmem = obj.GetGlobalData((CLIPFORMAT)RegisterClipboardFormat( _T("BinaryData")));
01218         }
01219         else if (obj.IsDataAvailable(CF_TEXT))
01220         {
01221             hmem = obj.GetGlobalData(CF_TEXT);
01222         }
01223         if(hmem)
01224         {
01225             LPBYTE  p = (BYTE*)::GlobalLock(hmem);
01226             DWORD   dwLen = ::GlobalSize(hmem);
01227             int     insert;
01228             int     oa = m_currentAddress;
01229
01230             NormalizeSel();
01231             if(m_selStart == 0xffffffff)
01232             {
01233                 if(m_currentMode == EDIT_LOW)
01234                     m_currentAddress++;
01235                 insert = m_currentAddress;
01236                 SelInsert(m_currentAddress, dwLen);
01237             }
01238             else
01239             {
01240                 insert = m_selStart;
01241                 SelDelete(m_selStart, m_selEnd);
01242                 SelInsert(insert, dwLen);
01243                 SetSel(-1, -1);
01244             }
01245
01246             memcpy(m_pData+insert, p, dwLen);
01247
01248             m_currentAddress = oa;
01249             RedrawWindow();
01250             ::GlobalUnlock(hmem);
01251         }
01252     }
01253 }

void CCJHexEdit::OnEditSelectAll ( ) [protected]

Definition at line 1255 of file CJHexEdit.cpp.

01256 {
01257     m_selStart = 0;
01258     m_selEnd = m_length;
01259     DestroyCaret();
01260     RedrawWindow();
01261 }

void CCJHexEdit::OnEditUndo ( ) [protected]

Definition at line 1263 of file CJHexEdit.cpp.

Referenced by OnChar().

01264 {
01265     // TODO: Add your command handler code here
01266
01267 }

BOOL CCJHexEdit::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 476 of file CJHexEdit.cpp.

00477 {
00478     // KStowell - overridden for flicker-free drawing.
00479     UNUSED_ALWAYS(pDC);
00480     return TRUE;
00481 }

_CJXLIB_INLINE UINT CCJHexEdit::OnGetDlgCode ( ) [protected]

Definition at line 138 of file CJHexEdit.h.

00139     { return DLGC_WANTALLKEYS; }

void CCJHexEdit::OnHScroll | ( | UINT | nSBCode,
 |  | UINT | nPos,
 |  | CScrollBar * | pScrollBar
 | ) | [protected]

Definition at line 1322 of file CJHexEdit.cpp.

01323 {
01324     UNUSED_ALWAYS(nSBCode);
01325     UNUSED_ALWAYS(nPos);
01326     UNUSED_ALWAYS(pScrollBar);
01327 }

void CCJHexEdit::OnKeyDown | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags
 | ) | [protected]

Definition at line 743 of file CJHexEdit.cpp.

00744 {
00745     nFlags; nRepCnt;
00746
00747     BOOL bShift = GetKeyState(VK_SHIFT) & 0x80000000;
00748     BOOL bac = m_bNoAddressChange;
00749     m_bNoAddressChange = TRUE;
00750     switch(nChar)
00751     {
00752         case VK_DOWN:
00753             if(bShift)
00754             {
00755                 if(!IsSelected())
00756                 {
00757                     m_selStart = m_currentAddress;
00758                 }
00759                 Move(0,1);
00760                 m_selEnd   = m_currentAddress;
00761                 if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
00762                     m_selEnd++;
00763                 RedrawWindow();
00764                 break;
00765             }
00766             else
00767                 SetSel(-1, -1);
00768             Move(0,1);
00769             break;
00770         case VK_UP:
00771             if(bShift)
00772             {
00773                 if(!IsSelected())
00774                 {
00775                     m_selStart = m_currentAddress;
00776                 }
00777                 Move(0,-1);
00778                 m_selEnd   = m_currentAddress;
00779                 RedrawWindow();
00780                 break;
00781             }
00782             else
00783                 SetSel(-1, -1);
00784             Move(0,-1);
00785             break;
00786         case VK_LEFT:
00787             if(bShift)
00788             {
00789                 if(!IsSelected())
00790                 {
00791                     m_selStart = m_currentAddress;
00792                 }
00793                 Move(-1,0);
00794                 m_selEnd   = m_currentAddress;
00795                 RedrawWindow();
00796                 break;
00797             }
00798             else
00799                 SetSel(-1, -1);
00800             Move(-1,0);
00801             break;
00802         case VK_RIGHT:
00803             if(bShift)
00804             {
00805                 if(!IsSelected())
00806                 {
00807                     m_selStart = m_currentAddress;
00808                 }
00809                 Move(1,0);
00810                 m_selEnd   = m_currentAddress;
00811                 if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
00812                     m_selEnd++;
00813                 RedrawWindow();
00814                 break;
00815             }
00816             else
00817                 SetSel(-1, -1);
00818             Move(1,0);
00819             break;
00820         case VK_PRIOR:
00821             if(bShift)
00822             {
00823                 if(!IsSelected())
00824                 {
00825                     m_selStart = m_currentAddress;
00826                 }
00827                 OnVScroll(SB_PAGEUP, 0, NULL);
00828                 Move(0,0);
00829                 m_selEnd   = m_currentAddress;
00830                 RedrawWindow();
00831                 break;
00832             }
00833             else
00834                 SetSel(-1, -1);
00835             OnVScroll(SB_PAGEUP, 0, NULL);
00836             Move(0,0);
00837             break;
00838         case VK_NEXT:
00839             if(bShift)
00840             {
00841                 if(!IsSelected())
00842                 {
00843                     m_selStart = m_currentAddress;
00844                 }
00845                 OnVScroll(SB_PAGEDOWN, 0, NULL);
00846                 Move(0,0);
00847                 m_selEnd   = m_currentAddress;
00848                 RedrawWindow();
00849                 break;
00850             }
00851             else
00852                 SetSel(-1, -1);
00853             OnVScroll(SB_PAGEDOWN, 0, NULL);
00854             Move(0,0);
00855             break;
00856         case VK_HOME:
00857             if(bShift)
00858             {
00859                 if(!IsSelected())
00860                 {
00861                     m_selStart = m_currentAddress;
00862                 }
00863                 if(GetKeyState(VK_CONTROL) & 0x80000000)
00864                 {
00865                     OnVScroll(SB_THUMBTRACK, 0, NULL);
00866                     Move(0,0);
00867                 }
00868                 else
00869                 {
00870                     m_currentAddress /= m_bpr;
00871                     m_currentAddress *= m_bpr;
00872                     Move(0,0);
00873                 }
00874                 m_selEnd   = m_currentAddress;
00875                 RedrawWindow();
00876                 break;
00877             }
00878             else
00879                 SetSel(-1, -1);
00880             if(GetKeyState(VK_CONTROL) & 0x80000000)
00881             {
00882                 OnVScroll(SB_THUMBTRACK, 0, NULL);
00883                 m_currentAddress = 0;
00884                 Move(0,0);
00885             }
00886             else
00887             {
00888                 m_currentAddress /= m_bpr;
00889                 m_currentAddress *= m_bpr;
00890                 Move(0,0);
00891             }
00892             break;
00893         case VK_END:
00894             if(bShift)
00895             {
00896                 if(!IsSelected())
00897                 {
00898                     m_selStart = m_currentAddress;
00899                 }
00900                 if(GetKeyState(VK_CONTROL) & 0x80000000)
00901                 {
00902                     m_currentAddress = m_length-1;
00903                     OnVScroll(SB_THUMBTRACK, ((m_length+(m_bpr/2)) / m_bpr) - m_lpp, NULL);
00904                     Move(0,0);
00905                 }
00906                 else
00907                 {
00908                     m_currentAddress /= m_bpr;
00909                     m_currentAddress *= m_bpr;
00910                     m_currentAddress += m_bpr - 1;
00911                     if(m_currentAddress > m_length)
00912                         m_currentAddress = m_length-1;
00913                     Move(0,0);
00914                 }
00915                 m_selEnd   = m_currentAddress;
00916                 RedrawWindow();
00917                 break;
00918             }
00919             else
00920                 SetSel(-1, -1);
00921             if(GetKeyState(VK_CONTROL) & 0x80000000)
00922             {
00923                 m_currentAddress = m_length-1;
00924                 if(m_bHalfPage)
00925                     OnVScroll(SB_THUMBTRACK, 0, NULL);
00926                 else
00927                     OnVScroll(SB_THUMBTRACK, ((m_length+(m_bpr/2)) / m_bpr) - m_lpp, NULL);
00928                 Move(0,0);
00929             }
00930             else
00931             {
00932                 m_currentAddress /= m_bpr;
00933                 m_currentAddress *= m_bpr;
00934                 m_currentAddress += m_bpr - 1;
00935                 if(m_currentAddress > m_length)
00936                     m_currentAddress = m_length-1;
00937                 Move(0,0);
00938             }
00939             break;
00940         case VK_INSERT:
00941             SelInsert(m_currentAddress, max(1, m_selEnd-m_selStart));
00942             RedrawWindow();
00943             break;
00944         case VK_DELETE:
00945             if(IsSelected())
00946             {
00947                 OnEditClear();
00948             }
00949             else
00950             {
00951                 SelDelete(m_currentAddress, m_currentAddress+1);
00952                 RedrawWindow();
00953             }
00954             break;
00955         case '\t':
00956             switch(m_currentMode)
00957             {
00958                 case EDIT_NONE:
00959                     m_currentMode = EDIT_HIGH;
00960                     break;
00961                 case EDIT_HIGH:
00962                 case EDIT_LOW:
00963                     m_currentMode = EDIT_ASCII;
00964                     break;
00965                 case EDIT_ASCII:
00966                     m_currentMode = EDIT_HIGH;
00967                     break;
00968             }
00969             Move(0,0);
00970             break;
00971
00972     }
00973     m_bNoAddressChange = bac;
00974 }

void CCJHexEdit::OnKillFocus ( CWnd * pNewWnd ) [protected]

Definition at line 392 of file CJHexEdit.cpp.

00393 {
00394     DestroyCaret();
00395     CWnd::OnKillFocus(pNewWnd);
00396 }

void CCJHexEdit::OnLButtonDblClk | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 1329 of file CJHexEdit.cpp.

01330 {
01331     UNUSED_ALWAYS(nFlags);
01332     UNUSED_ALWAYS(point);
01333 }

void CCJHexEdit::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 483 of file CJHexEdit.cpp.

00484 {
00485     SetFocus();
00486     if(!m_pData)
00487         return;
00488
00489     if(nFlags & MK_SHIFT)
00490     {
00491         m_selStart = m_currentAddress;
00492     }
00493     CPoint pt = CalcPos(point.x, point.y);
00494     if(pt.x > -1)
00495     {
00496         m_editPos = pt;
00497         pt.x *= m_nullWidth;
00498         pt.y *= m_lineHeight;
00499
00500         if(pt.x == 0 && m_bShowAddress)
00501             CreateAddressCaret();
00502         else
00503             CreateEditCaret();
00504
00505         SetCaretPos(pt);
00506         if(nFlags & MK_SHIFT)
00507         {
00508             m_selEnd = m_currentAddress;
00509             if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
00510                 m_selEnd++;
00511             RedrawWindow();
00512         }
00513     }
00514     if(!(nFlags & MK_SHIFT))
00515     {
00516         if(DragDetect(this->m_hWnd, point))
00517         {
00518             m_selStart = m_currentAddress;
00519             m_selEnd   = m_selStart;
00520             SetCapture();
00521         }
00522         else
00523         {
00524             BOOL bsel = m_selStart != 0xffffffff;
00525
00526             m_selStart = 0xffffffff;
00527             m_selEnd   = 0xffffffff;
00528             if(bsel)
00529                 RedrawWindow();
00530         }
00531     }
00532     if(!IsSelected())
00533     {
00534         ShowCaret();
00535     }
00536 }

void CCJHexEdit::OnLButtonUp | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 662 of file CJHexEdit.cpp.

00663 {
00664     if(IsSelected()) {
00665         ReleaseCapture();
00666     }
00667
00668     CWnd::OnLButtonUp(nFlags, point);
00669 }

void CCJHexEdit::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 592 of file CJHexEdit.cpp.

00593 {
00594     if(!m_pData) {
00595         return;
00596     }
00597
00598     if(nFlags & MK_LBUTTON && m_selStart != 0xffffffff)
00599     {
00600         CRect rc;
00601         GetClientRect(&rc);
00602         if(!rc.PtInRect(point))
00603         {
00604             if(point.y < 0)
00605             {
00606                 OnVScroll(SB_LINEUP, 0, NULL);
00607                 point.y = 0;
00608             }
00609             else if(point.y > rc.Height())
00610             {
00611                 OnVScroll(SB_LINEDOWN, 0, NULL);
00612                 point.y = rc.Height() -1;
00613             }
00614         }
00615
00616         //
00617         // we are selecting
00618         //
00619         int  seo = m_selEnd;
00620         CPoint pt = CalcPos(point.x, point.y);
00621         if(pt.x > -1)
00622         {
00623             m_selEnd = m_currentAddress;
00624             if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
00625                 m_selEnd++;
00626         }
00627         if(IsSelected())
00628             DestroyCaret();
00629
00630         if(seo != m_selEnd)
00631             RedrawWindow();
00632     }
00633 }

void CCJHexEdit::OnPaint ( ) [protected]

Definition at line 116 of file CJHexEdit.cpp.

00117 {
00118     CPaintDC dc(this); // device context for painting
00119
00120     // KStowell - Get the client rect.
00121     CRect rcClient;
00122     GetClientRect( &rcClient );
00123
00124     // KStowell - Create a memory device-context. This is done to help reduce
00125     // screen flicker, since we will paint the entire control to the
00126     // off screen device context first.
00127     CDC memDC;
00128     CBitmap bitmap;
00129     memDC.CreateCompatibleDC(&dc);
00130     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00131     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00132
00133     // KStowell - Repaint the background.
00134     memDC.FillSolidRect( rcClient, ::GetSysColor(COLOR_WINDOW) );
00135
00136     ASSERT(m_currentAddress >= 0);
00137     ASSERT(m_topindex >= 0);
00138
00139     CFont* pOldFont = memDC.SelectObject(&m_Font);
00140     int     height      = 0;
00141     int     x,y;
00142     TCHAR   buf[256];
00143
00144     x = rcClient.TopLeft().x;
00145     y = rcClient.TopLeft().y;
00146
00147     memDC.SetBoundsRect(&rcClient, DCB_DISABLE);
00148
00149     if(m_pData)
00150     {
00151         //
00152         // get char dimensions
00153         //
00154         if(m_bUpdate)
00155         {
00156             memDC.GetCharWidth('0', '0', &m_nullWidth);
00157             CSize sz = memDC.GetTextExtent(_T("0"), 1);
00158             m_lineHeight = sz.cy;
00159
00160             m_offHex    = m_bShowAddress ? (m_bAddressIsWide ? m_nullWidth * 9 : m_nullWidth * 5) : 0;
00161             m_offAscii  = m_bShowAddress ? (m_bAddressIsWide ? m_nullWidth * 9 : m_nullWidth * 5) : 0;
00162             m_offAscii += m_bShowHex     ? (m_bpr * 3 * m_nullWidth) : 0;
00163
00164             m_lpp = rcClient.Height() / m_lineHeight;
00165             m_bHalfPage = FALSE;
00166             if(m_lpp * m_bpr > m_length)
00167             {
00168                 m_lpp = (m_length + (m_bpr/2)) / m_bpr ;
00169                 if(m_length % m_bpr != 0)
00170                 {
00171                     m_bHalfPage = TRUE;
00172                     m_lpp++;
00173                 }
00174             }
00175             m_bUpdate = FALSE;
00176             UpdateScrollbars();
00177         }
00178
00179         height = rcClient.Height() / m_lineHeight;
00180         height *= m_lineHeight;
00181
00182         if(m_bShowAddress)
00183         {
00184             TCHAR fmt[8] = {'%','0','8','l','X'};
00185             fmt[2] = m_bAddressIsWide ? '8' : '4';
00186             int w = m_bAddressIsWide ? 8 : 4;
00187             y = 0;
00188             CRect rcd = rcClient;
00189             rcd.TopLeft().x = m_offAddress;
00190             for(int  i = m_topindex; (i < m_length) && (rcd.TopLeft().y < height); i+= m_bpr)
00191             {
00192                 _stprintf(buf, fmt, i);
00193                 memDC.DrawText(buf, w, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
00194                 rcd.TopLeft().y += m_lineHeight;
00195             }
00196         }
00197         if(m_bShowHex)
00198         {
00199             y = 0;
00200             CRect rcd = rcClient;
00201             rcd.TopLeft().x = x = m_offHex;
00202
00203             if(m_selStart != 0xffffffff && (m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW))
00204             {
00205                 int  i;
00206                 int  n = 0;
00207                 int  selStart = m_selStart, selEnd = m_selEnd;
00208                 if(selStart > selEnd)
00209                     selStart ^= selEnd ^= selStart ^= selEnd;
00210
00211                 for(i = m_topindex; (i < selStart) && (y < height); i++)
00212                 {
00213                     LPTSTR p = &buf[0];
00214
00215                     TOHEX(m_pData[i], p);
00216
00217                     *p++ = ' ';
00218                     memDC.TextOut(x, y, buf, 3);
00219                     x += m_nullWidth * 3;
00220                     n++;
00221                     if(n == m_bpr)
00222                     {
00223                         n = 0;
00224                         x = m_offHex;
00225                         y += m_lineHeight;
00226                     }
00227                 }
00228
00229                 memDC.SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
00230                 memDC.SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
00231                 for(; (i < selEnd) && (i < m_length) && (y < height); i++)
00232                 {
00233                     LPTSTR p = &buf[0];
00234
00235                     TOHEX(m_pData[i], p);
00236
00237                     *p++ = ' ';
00238                     memDC.TextOut(x, y, buf, 3);
00239                     x += m_nullWidth * 3;
00240                     n++;
00241                     if(n == m_bpr)
00242                     {
00243                         n = 0;
00244                         x = m_offHex;
00245                         y += m_lineHeight;
00246                     }
00247                 }
00248                 memDC.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
00249                 memDC.SetBkColor(GetSysColor(COLOR_WINDOW));
00250                 for(; (i < m_length) && (y < height); i++)
00251                 {
00252                     LPTSTR p = &buf[0];
00253
00254                     TOHEX(m_pData[i], p);
00255
00256                     *p++ = ' ';
00257                     memDC.TextOut(x, y, buf, 3);
00258                     x += m_nullWidth * 3;
00259                     n++;
00260                     if(n == m_bpr)
00261                     {
00262                         n = 0;
00263                         x = m_offHex;
00264                         y += m_lineHeight;
00265                     }
00266                 }
00267             }
00268             else
00269             {
00270                 for(int  i = m_topindex; (i < m_length) && (rcd.TopLeft().y < height);)
00271                 {
00272                     LPTSTR p = &buf[0];
00273
00274                     for(int  n = 0; (n < m_bpr) && (i < m_length); n++)
00275                     {
00276                         TOHEX(m_pData[i], p);
00277                         *p++ = ' ';
00278                         i++;
00279                     }
00280
00281                     while(n < m_bpr)
00282                     {
00283                         *p++ = ' '; *p++ = ' '; *p++ = ' ';
00284                         n++;
00285                     }
00286
00287                     memDC.DrawText(buf, m_bpr*3, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
00288                     rcd.TopLeft().y += m_lineHeight;
00289                 }
00290             }
00291         }
00292         if(m_bShowAscii)
00293         {
00294             y = 0;
00295             CRect rcd = rcClient;
00296             rcd.TopLeft().x = x = m_offAscii;
00297             if(m_selStart != 0xffffffff && m_currentMode == EDIT_ASCII)
00298             {
00299                 int  i;
00300                 int  n = 0;
00301                 int  selStart = m_selStart, selEnd = m_selEnd;
00302                 if(selStart > selEnd)
00303                     selStart ^= selEnd ^= selStart ^= selEnd;
00304
00305                 for(i = m_topindex; (i < selStart) && (y < height); i++)
00306                 {
00307                     buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
00308                     memDC.TextOut(x, y, buf, 1);
00309                     x += m_nullWidth;
00310                     n++;
00311                     if(n == m_bpr)
00312                     {
00313                         n = 0;
00314                         x = m_offAscii;
00315                         y += m_lineHeight;
00316                     }
00317                 }
00318                 memDC.SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
00319                 memDC.SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
00320                 for(; (i < selEnd) && (y < height); i++)
00321                 {
00322                     buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
00323                     memDC.TextOut(x, y, buf, 1);
00324                     x += m_nullWidth;
00325                     n++;
00326                     if(n == m_bpr)
00327                     {
00328                         n = 0;
00329                         x = m_offAscii;
00330                         y += m_lineHeight;
00331                     }
00332                 }
00333                 memDC.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
00334                 memDC.SetBkColor(GetSysColor(COLOR_WINDOW));
00335                 for(; (i < m_length) && y < height; i++)
00336                 {
00337                     buf[0] = isprint(m_pData[i]) ? m_pData[i] : '.';
00338                     memDC.TextOut(x, y, buf, 1);
00339                     x += m_nullWidth;
00340                     n++;
00341                     if(n == m_bpr)
00342                     {
00343                         n = 0;
00344                         x = m_offAscii;
00345                         y += m_lineHeight;
00346                     }
00347                 }
00348             }
00349             else
00350             {
00351                 for(int  i = m_topindex; (i < m_length) && (rcd.TopLeft().y < height);)
00352                 {
00353                     LPTSTR p = &buf[0];
00354
00355                     for(int  n = 0; (n < m_bpr) && (i < m_length); n++)
00356                     {
00357                         *p++ = isprint(m_pData[i]) ? m_pData[i] : '.';
00358                         i++;
00359                     }
00360
00361                     memDC.DrawText(buf, n, rcd, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_NOPREFIX);
00362                     rcd.TopLeft().y += m_lineHeight;
00363                 }
00364             }
00365         }
00366     }
00367
00368     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00369     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00370
00371     // KStowell - Cleanup resources.
00372     memDC.SelectObject(pOldBitmap);
00373     memDC.SelectObject(pOldFont);
00374     memDC.DeleteDC();
00375     bitmap.DeleteObject();
00376 }

void CCJHexEdit::OnSetFocus ( CWnd * pOldWnd ) [protected]

Definition at line 378 of file CJHexEdit.cpp.

00379 {
00380     if(m_pData && !IsSelected())
00381     {
00382         if(m_editPos.x == 0 && m_bShowAddress)
00383             CreateAddressCaret();
00384         else
00385             CreateEditCaret();
00386         SetCaretPos(m_editPos);
00387         ShowCaret();
00388     }
00389     CWnd::OnSetFocus(pOldWnd);
00390 }

void CCJHexEdit::OnVScroll | ( | UINT | nSBCode,
 |  | UINT | nPos,
 |  | CScrollBar * | pScrollBar
 | ) | [protected]

Definition at line 398 of file CJHexEdit.cpp.

Referenced by Move(), OnKeyDown(), and OnMouseMove().

00399 {
00400     UNUSED_ALWAYS(pScrollBar);
00401
00402     if(!m_pData) {
00403         return;
00404     }
00405
00406     int oa = m_topindex;
00407     switch(nSBCode)
00408     {
00409         case SB_LINEDOWN:
00410             if(m_topindex < m_length - m_lpp*m_bpr)
00411             {
00412                 m_topindex += m_bpr;
00413                 RedrawWindow();
00414             }
00415             break;
00416
00417         case SB_LINEUP:
00418             if(m_topindex > 0)
00419             {
00420                 m_topindex -= m_bpr;
00421                 RedrawWindow();
00422             }
00423             break;
00424
00425         case SB_PAGEDOWN:
00426             if(m_topindex < m_length - m_lpp*m_bpr)
00427             {
00428                 m_topindex += m_bpr * m_lpp;
00429                 if(m_topindex > m_length - m_lpp*m_bpr)
00430                     m_topindex = m_length - m_lpp*m_bpr;
00431                 RedrawWindow();
00432             }
00433             break;
00434
00435         case SB_PAGEUP:
00436             if(m_topindex > 0)
00437             {
00438                 m_topindex -= m_bpr * m_lpp;
00439                 if(m_topindex < 0)
00440                     m_topindex = 0;
00441                 RedrawWindow();
00442             }
00443             break;
00444
00445         case SB_THUMBTRACK:
00446             m_topindex = nPos * m_bpr;
00447             RedrawWindow();
00448             break;
00449     }
00450     ::SetScrollPos(this->m_hWnd, SB_VERT, m_topindex / m_bpr, TRUE);
00451     if(!m_bNoAddressChange)
00452         m_currentAddress += (m_topindex - oa);
00453     RepositionCaret(m_currentAddress);
00454 }

BOOL CCJHexEdit::PreCreateWindow ( CREATESTRUCT & cs ) [protected, virtual]

Definition at line 456 of file CJHexEdit.cpp.

00457 {
00458     if(!CEdit::PreCreateWindow(cs)) {
00459         return FALSE;
00460     }
00461
00462     cs.style |= WS_HSCROLL|WS_VSCROLL;
00463     return TRUE;
00464 }

void CCJHexEdit::RepositionCaret ( int p ) [protected, virtual]

Definition at line 1039 of file CJHexEdit.cpp.

Referenced by Move(), OnChar(), OnEditClear(), OnVScroll(), and SelDelete().

01040 {
01041     int x, y;
01042
01043     y = (p - m_topindex) / m_bpr;
01044     x = (p - m_topindex) % m_bpr;
01045
01046     switch(m_currentMode)
01047     {
01048         case EDIT_NONE:
01049             CreateAddressCaret();
01050             x = 0;
01051             break;
01052         case EDIT_HIGH:
01053             CreateEditCaret();
01054             x *= m_nullWidth*3;
01055             x += m_offHex;
01056             break;
01057         case EDIT_LOW:
01058             CreateEditCaret();
01059             x *= m_nullWidth*3;
01060             x += m_nullWidth;
01061             x += m_offHex;
01062             break;
01063         case EDIT_ASCII:
01064             CreateEditCaret();
01065             x *= m_nullWidth;
01066             x += m_offAscii;
01067             break;
01068     }
01069     m_editPos.x = x;
01070     m_editPos.y = y*m_lineHeight;
01071     CRect rc;
01072     GetClientRect(&rc);
01073     if(rc.PtInRect(m_editPos))
01074     {
01075         SetCaretPos(m_editPos);
01076         ShowCaret();
01077     }
01078 }

void CCJHexEdit::ScrollIntoView ( int p ) [protected, virtual]

Definition at line 1080 of file CJHexEdit.cpp.

01081 {
01082     if(p < m_topindex || p > m_topindex + m_lpp*m_bpr)
01083     {
01084         m_topindex = (p/m_bpr) * m_bpr;
01085         m_topindex -= (m_lpp / 3) * m_bpr;
01086         if(m_topindex < 0)
01087             m_topindex = 0;
01088
01089         UpdateScrollbars();
01090         RedrawWindow();
01091     }
01092 }

void CCJHexEdit::SelDelete | ( | int | s,
 |  | int | e
 | ) | [protected, virtual]

Definition at line 1275 of file CJHexEdit.cpp.

Referenced by OnChar(), OnEditClear(), OnEditCut(), OnEditPaste(), and OnKeyDown().

01276 {
01277     LPBYTE p = (LPBYTE) malloc(m_length - (e-s)+1);
01278     memcpy(p, m_pData, s);
01279     if(s < m_length-(e-s))
01280         memcpy(p+s, m_pData+e, (m_length -e));
01281
01282     free(m_pData);
01283     SetSel(-1, -1);
01284     m_pData = p;
01285     m_length = m_length-(e-s);
01286     if(m_currentAddress > m_length)
01287     {
01288         m_currentAddress = m_length;
01289         RepositionCaret(m_currentAddress);
01290     }
01291     m_bUpdate = TRUE;
01292 }

void CCJHexEdit::SelInsert | ( | int | s,
 |  | int | l
 | ) | [protected, virtual]

Definition at line 1294 of file CJHexEdit.cpp.

Referenced by OnEditPaste(), and OnKeyDown().

01295 {
01296     LPBYTE p = (LPBYTE) calloc(m_length + l, 1);
01297     memcpy(p, m_pData, s);
01298     memcpy(p+s+l, m_pData+s, (m_length-s));
01299     free(m_pData);
01300     SetSel(-1, -1);
01301     m_pData = p;
01302     m_length = m_length+l;
01303     m_bUpdate = TRUE;
01304 }

_CJXLIB_INLINE void CCJHexEdit::SetBPR ( int bpr ) [virtual]

Definition at line 144 of file CJHexEdit.h.

00145     { m_bpr = bpr; m_bUpdate = TRUE; }

void CCJHexEdit::SetData | ( | LPBYTE | p,
 |  | int | len
 | ) | [virtual]

Definition at line 1306 of file CJHexEdit.cpp.

01307 {
01308     free(m_pData);
01309
01310     m_pData = (LPBYTE) malloc(len);
01311     memcpy(m_pData, p, len);
01312
01313     SetSel(-1, -1);
01314     m_length = len;
01315     m_currentAddress = 0;
01316     m_editPos.x = m_editPos.y = 0;
01317     m_currentMode = EDIT_HIGH;
01318     m_topindex = 0;
01319     m_bUpdate = TRUE;
01320 }

_CJXLIB_INLINE void CCJHexEdit::SetOptions | ( | BOOL | a,
 |  | BOOL | h,
 |  | BOOL | c,
 |  | BOOL | w
 | ) | [virtual]

Definition at line 141 of file CJHexEdit.h.

00142     { m_bShowHex = h; m_bShowAscii = c; m_bShowAddress = a; m_bAddressIsWide = w; m_bUpdate = TRUE; }

void CCJHexEdit::SetSel | ( | int | s,
 |  | int | e
 | ) | [virtual]

Definition at line 1025 of file CJHexEdit.cpp.

Referenced by OnChar(), OnEditPaste(), OnKeyDown(), SelDelete(), SelInsert(), and SetData().

01026 {
01027     DestroyCaret();
01028     m_selStart = s;
01029     m_selEnd = e;
01030     RedrawWindow();
01031     if(m_editPos.x == 0 && m_bShowAddress)
01032         CreateAddressCaret();
01033     else
01034         CreateEditCaret();
01035     SetCaretPos(m_editPos);
01036     ShowCaret();
01037 }

void CCJHexEdit::UpdateScrollbars ( void ) [protected, virtual]

Definition at line 635 of file CJHexEdit.cpp.

Referenced by ScrollIntoView().

00636 {
00637     SCROLLINFO si;
00638
00639     si.cbSize = sizeof(SCROLLINFO);
00640     si.fMask = SIF_ALL;
00641     si.nMin = 0;
00642     si.nMax = (m_length / m_bpr) - 1;
00643     si.nPage = m_lpp;
00644     si.nPos = m_topindex / m_bpr;
00645
00646     ::SetScrollInfo(this->m_hWnd, SB_VERT, &si, TRUE);
00647     if(si.nMax > (int)si.nPage)
00648         ::EnableScrollBar(this->m_hWnd, SB_VERT, ESB_ENABLE_BOTH);
00649
00650     CRect rc;
00651     GetClientRect(&rc);
00652
00653     si.nMin = 0;
00654     si.nMax =((m_bShowAddress ? (m_bAddressIsWide ? 8 : 4) : 0) +
00655               (m_bShowHex ? m_bpr * 3 : 0) +
00656               (m_bShowAscii ? m_bpr : 0) ) * m_nullWidth;
00657     si.nPage = 1;
00658     si.nPos = 0;
00659     ::SetScrollInfo(this->m_hWnd, SB_HORZ, &si, TRUE);
00660 }

Member Data Documentation

CFont CCJHexEdit::m_Font

Definition at line 61 of file CJHexEdit.h.

BOOL CCJHexEdit::m_bAddressIsWide

Definition at line 58 of file CJHexEdit.h.

BOOL CCJHexEdit::m_bHalfPage

Definition at line 60 of file CJHexEdit.h.

BOOL CCJHexEdit::m_bNoAddressChange

Definition at line 59 of file CJHexEdit.h.

BOOL CCJHexEdit::m_bShowAddress

Definition at line 55 of file CJHexEdit.h.

BOOL CCJHexEdit::m_bShowAscii

Definition at line 56 of file CJHexEdit.h.

BOOL CCJHexEdit::m_bShowHex

Definition at line 57 of file CJHexEdit.h.

BOOL CCJHexEdit::m_bUpdate

Definition at line 64 of file CJHexEdit.h.

int CCJHexEdit::m_bpr

Definition at line 53 of file CJHexEdit.h.

int CCJHexEdit::m_currentAddress

Definition at line 49 of file CJHexEdit.h.

EDITMODE CCJHexEdit::m_currentMode

Definition at line 50 of file CJHexEdit.h.

CPoint CCJHexEdit::m_editPos

Definition at line 68 of file CJHexEdit.h.

int CCJHexEdit::m_length

Definition at line 47 of file CJHexEdit.h.

int CCJHexEdit::m_lineHeight

Definition at line 62 of file CJHexEdit.h.

int CCJHexEdit::m_lpp

Definition at line 54 of file CJHexEdit.h.

int CCJHexEdit::m_nullWidth

Definition at line 63 of file CJHexEdit.h.

int CCJHexEdit::m_offAddress

Definition at line 67 of file CJHexEdit.h.

int CCJHexEdit::m_offAscii

Definition at line 66 of file CJHexEdit.h.

int CCJHexEdit::m_offHex

Definition at line 65 of file CJHexEdit.h.

LPBYTE CCJHexEdit::m_pData

Definition at line 46 of file CJHexEdit.h.

int CCJHexEdit::m_selEnd

Definition at line 52 of file CJHexEdit.h.

int CCJHexEdit::m_selStart

Definition at line 51 of file CJHexEdit.h.

int CCJHexEdit::m_topindex

Definition at line 48 of file CJHexEdit.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJHexEdit.h
  • WinCvs/CJLib/CJLibrary/CJHexEdit.cpp
Generated on Sun Oct 21 12:46:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJHtmlView Class Reference

#include <CJHtmlView.h>

Inheritance diagram for CCJHtmlView:

[legend]
Collaboration diagram for CCJHtmlView:

[legend]
List of all members.

Public Methods

CString | GetType () const
long | GetLeft () const
void | SetLeft (long nNewValue)
long | GetTop () const
void | SetTop (long nNewValue)
long | GetHeight () const
void | SetHeight (long nNewValue)
void | SetVisible (BOOL bNewValue)
BOOL | GetVisible () const
CString | GetLocationName () const
READYSTATE | GetReadyState () const
BOOL | GetOffline () const
void | SetOffline (BOOL bNewValue)
BOOL | GetSilent () const
void | SetSilent (BOOL bNewValue)
BOOL | GetTopLevelContainer () const
CString | GetLocationURL () const
BOOL | GetBusy () const
LPDISPATCH | GetApplication () const
LPDISPATCH | GetParentBrowser () const
LPDISPATCH | GetContainer () const
LPDISPATCH | GetHtmlDocument () const
CString | GetFullName () const
int | GetToolBar () const
void | SetToolBar (int nNewValue)
BOOL | GetMenuBar () const
void | SetMenuBar (BOOL bNewValue)
BOOL | GetFullScreen () const
void | SetFullScreen (BOOL bNewValue)
OLECMDF | QueryStatusWB (OLECMDID cmdID) const
BOOL | GetRegisterAsBrowser () const
void | SetRegisterAsBrowser (BOOL bNewValue)
BOOL | GetRegisterAsDropTarget () const
void | SetRegisterAsDropTarget (BOOL bNewValue)
BOOL | GetTheaterMode () const
void | SetTheaterMode (BOOL bNewValue)
BOOL | GetAddressBar () const
void | SetAddressBar (BOOL bNewValue)
BOOL | GetStatusBar () const
void | SetStatusBar (BOOL bNewValue)
void | GoBack ()
void | GoForward ()
void | GoHome ()
void | GoSearch ()
void | Navigate (LPCTSTR URL, DWORD dwFlags=0, LPCTSTR lpszTargetFrameName=NULL, LPCTSTR lpszHeaders=NULL, LPVOID lpvPostData=NULL, DWORD dwPostDataLen=0)
void | Navigate2 (LPITEMIDLIST pIDL, DWORD dwFlags=0, LPCTSTR lpszTargetFrameName=NULL)
void | Navigate2 (LPCTSTR lpszURL, DWORD dwFlags=0, LPCTSTR lpszTargetFrameName=NULL, LPCTSTR lpszHeaders=NULL, LPVOID lpvPostData=NULL, DWORD dwPostDataLen=0)
void | Navigate2 (LPCTSTR lpszURL, DWORD dwFlags, CByteArray &baPostedData, LPCTSTR lpszTargetFrameName=NULL, LPCTSTR lpszHeader=NULL)
void | Refresh ()
void | Refresh2 (int nLevel)
void | Stop ()
void | PutProperty (LPCTSTR lpszProperty, const VARIANT &vtValue)
void | PutProperty (LPCTSTR lpszPropertyName, double dValue)
void | PutProperty (LPCTSTR lpszPropertyName, LPCTSTR lpszValue)
void | PutProperty (LPCTSTR lpszPropertyName, long lValue)
void | PutProperty (LPCTSTR lpszPropertyName, short nValue)
BOOL | GetProperty (LPCTSTR lpszProperty, CString &strValue)
COleVariant | GetProperty (LPCTSTR lpszProperty)
void | ExecWB (OLECMDID cmdID, OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
BOOL | LoadFromResource (LPCTSTR lpszResource)
BOOL | LoadFromResource (UINT nRes)
virtual void | OnDraw (CDC *pDC)
virtual BOOL | Create (LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL)
virtual void | OnNavigateComplete2 (LPCTSTR strURL)
virtual void | OnBeforeNavigate2 (LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray &baPostedData, LPCTSTR lpszHeaders, BOOL *pbCancel)
virtual void | OnStatusTextChange (LPCTSTR lpszText)
virtual void | OnProgressChange (long nProgress, long nProgressMax)
virtual void | OnCommandStateChange (long nCommand, BOOL bEnable)
virtual void | OnDownloadBegin ()
virtual void | OnDownloadComplete ()
virtual void | OnTitleChange (LPCTSTR lpszText)
virtual void | OnPropertyChange (LPCTSTR lpszProperty)
virtual void | OnNewWindow2 (LPDISPATCH *ppDisp, BOOL *Cancel)
virtual void | OnDocumentComplete (LPCTSTR lpszURL)
virtual void | OnQuit ()
virtual void | OnVisible (BOOL bVisible)
virtual void | OnToolBar (BOOL bToolBar)
virtual void | OnMenuBar (BOOL bMenuBar)
virtual void | OnStatusBar (BOOL bStatusBar)
virtual void | OnFullScreen (BOOL bFullScreen)
virtual void | OnTheaterMode (BOOL bTheaterMode)

Public Attributes

CWnd m_wndBrowser

Protected Methods

CCJHtmlView ()
virtual | ~CCJHtmlView ()
virtual void | NavigateComplete2 (LPDISPATCH pDisp, VARIANT *URL)
virtual void | BeforeNavigate2 (LPDISPATCH pDisp, VARIANT *URL, VARIANT *Flags, VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers, BOOL *Cancel)
virtual void | DocumentComplete (LPDISPATCH pDisp, VARIANT *URL)
afx_msg void | OnSize (UINT nType, int cx, int cy)
afx_msg void | OnPaint ()
afx_msg void | OnDestroy ()
afx_msg void | OnFilePrint ()
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)

Protected Attributes

IWebBrowser2 * | m_pBrowserApp

Constructor & Destructor Documentation

CCJHtmlView::CCJHtmlView ( ) [protected]

Definition at line 123 of file CJHtmlView.cpp.

00124     : CFormView((LPCTSTR) NULL)
00125 {
00126     m_pBrowserApp = NULL;
00127 }

CCJHtmlView::~CCJHtmlView ( ) [protected, virtual]

Definition at line 129 of file CJHtmlView.cpp.

00130 {
00131     if (m_pBrowserApp != NULL)
00132         m_pBrowserApp->Release();
00133 }

Member Function Documentation

void CCJHtmlView::BeforeNavigate2 | ( | LPDISPATCH | pDisp,
 |  | VARIANT * | URL,
 |  | VARIANT * | Flags,
 |  | VARIANT * | TargetFrameName,
 |  | VARIANT * | PostData,
 |  | VARIANT * | Headers,
 |  | BOOL * | Cancel
 | ) | [protected, virtual]

Definition at line 733 of file CJHtmlView.cpp.

00736 {
00737     ASSERT(V_VT(URL) == VT_BSTR);
00738     ASSERT(V_VT(TargetFrameName) == VT_BSTR);
00739     ASSERT(V_VT(PostData) == (VT_VARIANT | VT_BYREF));
00740     ASSERT(V_VT(Headers) == VT_BSTR);
00741     ASSERT(Cancel != NULL);
00742
00743     USES_CONVERSION;
00744
00745     VARIANT* vtPostedData = V_VARIANTREF(PostData);
00746     CByteArray array;
00747     if (V_VT(vtPostedData) & VT_ARRAY)
00748     {
00749         // must be a vector of bytes
00750         ASSERT(vtPostedData->parray->cDims == 1 && vtPostedData->parray->cbElements == 1);
00751
00752         vtPostedData->vt |= VT_UI1;
00753         COleSafeArray safe(vtPostedData);
00754
00755         DWORD dwSize = safe.GetOneDimSize();
00756         LPVOID pVoid;
00757         safe.AccessData(&pVoid);
00758
00759         array.SetSize(dwSize);
00760         LPBYTE lpByte = array.GetData();
00761
00762         memcpy(lpByte, pVoid, dwSize);
00763         safe.UnaccessData();
00764     }
00765     // make real parameters out of the notification
00766
00767     CString strTargetFrameName(V_BSTR(TargetFrameName));
00768     CString strURL = V_BSTR(URL);
00769     CString strHeaders = V_BSTR(Headers);
00770     DWORD nFlags = V_I4(Flags);
00771
00772     // notify the user's class
00773     OnBeforeNavigate2(strURL, nFlags, strTargetFrameName,
00774         array, strHeaders, Cancel);
00775 }

BOOL CCJHtmlView::Create | ( | LPCTSTR | lpszClassName,
 |  | LPCTSTR | lpszWindowName,
 |  | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | CCreateContext * | pContext = NULL
 | ) | [virtual]

Definition at line 220 of file CJHtmlView.cpp.

00223 {
00224     // create the view window itself
00225     m_pCreateContext = pContext;
00226     if (!CView::Create(lpszClassName, lpszWindowName,
00227                 dwStyle, rect, pParentWnd,  nID, pContext))
00228     {
00229         return FALSE;
00230     }
00231
00232     AfxEnableControlContainer();
00233
00234     RECT rectClient;
00235     GetClientRect(&rectClient);
00236
00237     // create the control window
00238     // AFX_IDW_PANE_FIRST is a safe but arbitrary ID
00239     if (!m_wndBrowser.CreateControl(CLSID_WebBrowser, lpszWindowName,
00240                 WS_VISIBLE | WS_CHILD, rectClient, this, AFX_IDW_PANE_FIRST))
00241     {
00242         DestroyWindow();
00243         return FALSE;
00244     }
00245
00246     LPUNKNOWN lpUnk = m_wndBrowser.GetControlUnknown();
00247     HRESULT hr = lpUnk->QueryInterface(IID_IWebBrowser2, (void**) &m_pBrowserApp);
00248     if (!SUCCEEDED(hr))
00249     {
00250         m_pBrowserApp = NULL;
00251         m_wndBrowser.DestroyWindow();
00252         DestroyWindow();
00253         return FALSE;
00254     }
00255
00256     return TRUE;
00257 }

void CCJHtmlView::DocumentComplete | ( | LPDISPATCH | pDisp,
 |  | VARIANT * | URL
 | ) | [protected, virtual]

Definition at line 777 of file CJHtmlView.cpp.

00778 {
00779     UNUSED_ALWAYS(pDisp);
00780     ASSERT(V_VT(URL) == VT_BSTR);
00781
00782     CString str(V_BSTR(URL));
00783     OnDocumentComplete(str);
00784 }

void CCJHtmlView::ExecWB | ( | OLECMDID | cmdID,
 |  | OLECMDEXECOPT | cmdexecopt,
 |  | VARIANT * | pvaIn,
 |  | VARIANT * | pvaOut
 | ) |

Definition at line 453 of file CJHtmlView.cpp.

00455 {
00456     ASSERT(m_pBrowserApp != NULL);
00457
00458     m_pBrowserApp->ExecWB(cmdID, cmdexecopt, pvaIn, pvaOut);
00459 }

BOOL CCJHtmlView::GetAddressBar ( ) const

Definition at line 488 of file CJHtmlView.cpp.

00489 {
00490     ASSERT(m_pBrowserApp != NULL);
00491
00492     VARIANT_BOOL result;
00493     m_pBrowserApp->get_AddressBar(&result);
00494     return result;
00495 }

LPDISPATCH CCJHtmlView::GetApplication ( ) const

Definition at line 371 of file CJHtmlView.cpp.

00372 {
00373     ASSERT(m_pBrowserApp != NULL);
00374
00375     LPDISPATCH result;
00376     m_pBrowserApp->get_Application(&result);
00377     return result;
00378 }

BOOL CCJHtmlView::GetBusy ( ) const

Definition at line 335 of file CJHtmlView.cpp.

00336 {
00337     ASSERT(m_pBrowserApp != NULL);
00338
00339     VARIANT_BOOL result;
00340     m_pBrowserApp->get_Busy(&result);
00341     return result;
00342 }

LPDISPATCH CCJHtmlView::GetContainer ( ) const

Definition at line 390 of file CJHtmlView.cpp.

00391 {
00392     ASSERT(m_pBrowserApp != NULL);
00393
00394     LPDISPATCH result;
00395     m_pBrowserApp->get_Container(&result);
00396     return result;
00397 }

CString CCJHtmlView::GetFullName ( ) const

Definition at line 710 of file CJHtmlView.cpp.

00711 {
00712     ASSERT(m_pBrowserApp != NULL);
00713
00714     BSTR bstr;
00715     m_pBrowserApp->get_FullName(&bstr);
00716     CString retVal(bstr);
00717     return retVal;
00718 }

BOOL CCJHtmlView::GetFullScreen ( ) const

Definition at line 426 of file CJHtmlView.cpp.

00427 {
00428     ASSERT(m_pBrowserApp != NULL);
00429
00430     VARIANT_BOOL result;
00431     m_pBrowserApp->get_FullScreen(&result);
00432     return result;
00433 }

long CCJHtmlView::GetHeight ( ) const

Definition at line 298 of file CJHtmlView.cpp.

00299 {
00300     ASSERT(m_pBrowserApp != NULL);
00301     long result;
00302     m_pBrowserApp->get_Height(&result);
00303     return result;
00304 }

LPDISPATCH CCJHtmlView::GetHtmlDocument ( ) const

Definition at line 399 of file CJHtmlView.cpp.

Referenced by OnFilePrint().

00400 {
00401     ASSERT(m_pBrowserApp != NULL);
00402
00403     LPDISPATCH result;
00404     m_pBrowserApp->get_Document(&result);
00405     return result;
00406 }

long CCJHtmlView::GetLeft ( ) const

Definition at line 272 of file CJHtmlView.cpp.

00273 {
00274     ASSERT(m_pBrowserApp != NULL);
00275
00276     long result;
00277     m_pBrowserApp->get_Left(&result);
00278     return result;
00279 }

CString CCJHtmlView::GetLocationName ( ) const

Definition at line 315 of file CJHtmlView.cpp.

00316 {
00317     ASSERT(m_pBrowserApp != NULL);
00318
00319     BSTR bstr;
00320     m_pBrowserApp->get_LocationName(&bstr);
00321     CString retVal(bstr);
00322     return retVal;
00323 }

CString CCJHtmlView::GetLocationURL ( ) const

Definition at line 325 of file CJHtmlView.cpp.

00326 {
00327     ASSERT(m_pBrowserApp != NULL);
00328
00329     BSTR bstr;
00330     m_pBrowserApp->get_LocationURL(&bstr);
00331     CString retVal(bstr);
00332     return retVal;
00333 }

BOOL CCJHtmlView::GetMenuBar ( ) const

Definition at line 417 of file CJHtmlView.cpp.

00418 {
00419     ASSERT(m_pBrowserApp != NULL);
00420
00421     VARIANT_BOOL result;
00422     m_pBrowserApp->get_MenuBar(&result);
00423     return result;
00424 }

BOOL CCJHtmlView::GetOffline ( ) const

Definition at line 353 of file CJHtmlView.cpp.

00354 {
00355     ASSERT(m_pBrowserApp != NULL);
00356
00357     VARIANT_BOOL result;
00358     m_pBrowserApp->get_Offline(&result);
00359     return result;
00360 }

LPDISPATCH CCJHtmlView::GetParentBrowser ( ) const

Definition at line 381 of file CJHtmlView.cpp.

00382 {
00383     ASSERT(m_pBrowserApp != NULL);
00384
00385     LPDISPATCH result;
00386     m_pBrowserApp->get_Parent(&result);
00387     return result;
00388 }

COleVariant CCJHtmlView::GetProperty ( LPCTSTR lpszProperty )

Definition at line 698 of file CJHtmlView.cpp.

00699 {
00700     COleVariant result;
00701
00702     static BYTE parms[] =
00703         VTS_BSTR;
00704     m_wndBrowser.InvokeHelper(0x12f, DISPATCH_METHOD,
00705         VT_VARIANT, (void*)&result, parms, lpszProperty);
00706
00707     return result;
00708 }

BOOL CCJHtmlView::GetProperty | ( | LPCTSTR | lpszProperty,
 |  | CString & | strValue
 | ) |

Definition at line 675 of file CJHtmlView.cpp.

00676 {
00677     ASSERT(m_pBrowserApp != NULL);
00678
00679     CString strProperty(lpszProperty);
00680     BSTR bstrProperty = strProperty.AllocSysString();
00681
00682     BOOL bResult = FALSE;
00683     VARIANT vReturn;
00684     vReturn.vt = VT_BSTR;
00685     vReturn.bstrVal = NULL;
00686     HRESULT hr = m_pBrowserApp->GetProperty(bstrProperty, &vReturn);
00687
00688     if (SUCCEEDED(hr))
00689     {
00690         strValue = CString(vReturn.bstrVal);
00691         bResult = TRUE;
00692     }
00693
00694     ::SysFreeString(bstrProperty);
00695     return bResult;
00696 }

READYSTATE CCJHtmlView::GetReadyState ( ) const

Definition at line 344 of file CJHtmlView.cpp.

00345 {
00346     ASSERT(m_pBrowserApp != NULL);
00347
00348     READYSTATE result;
00349     m_pBrowserApp->get_ReadyState(&result);
00350     return result;
00351 }

BOOL CCJHtmlView::GetRegisterAsBrowser ( ) const

Definition at line 461 of file CJHtmlView.cpp.

00462 {
00463     ASSERT(m_pBrowserApp != NULL);
00464
00465     VARIANT_BOOL result;
00466     m_pBrowserApp->get_RegisterAsBrowser(&result);
00467     return result;
00468 }

BOOL CCJHtmlView::GetRegisterAsDropTarget ( ) const

Definition at line 470 of file CJHtmlView.cpp.

00471 {
00472     ASSERT(m_pBrowserApp != NULL);
00473
00474     VARIANT_BOOL result;
00475     m_pBrowserApp->get_RegisterAsDropTarget(&result);
00476     return result;
00477 }

BOOL CCJHtmlView::GetSilent ( ) const

Definition at line 362 of file CJHtmlView.cpp.

00363 {
00364     ASSERT(m_pBrowserApp != NULL);
00365
00366     VARIANT_BOOL result;
00367     m_pBrowserApp->get_Silent(&result);
00368     return result;
00369 }

BOOL CCJHtmlView::GetStatusBar ( ) const

Definition at line 435 of file CJHtmlView.cpp.

00436 {
00437     ASSERT(m_pBrowserApp != NULL);
00438
00439     VARIANT_BOOL result;
00440     m_pBrowserApp->get_StatusBar(&result);
00441     return result;
00442 }

BOOL CCJHtmlView::GetTheaterMode ( ) const

Definition at line 479 of file CJHtmlView.cpp.

00480 {
00481     ASSERT(m_pBrowserApp != NULL);
00482
00483     VARIANT_BOOL result;
00484     m_pBrowserApp->get_TheaterMode(&result);
00485     return result;
00486 }

int CCJHtmlView::GetToolBar ( ) const

Definition at line 290 of file CJHtmlView.cpp.

00291 {
00292     ASSERT(m_pBrowserApp != NULL);
00293     int result;
00294     m_pBrowserApp->get_ToolBar(&result);
00295     return result;
00296 }

long CCJHtmlView::GetTop ( ) const

Definition at line 282 of file CJHtmlView.cpp.

00283 {
00284     ASSERT(m_pBrowserApp != NULL);
00285     long result;
00286     m_pBrowserApp->get_Top(&result);
00287     return result;
00288 }

BOOL CCJHtmlView::GetTopLevelContainer ( ) const

Definition at line 408 of file CJHtmlView.cpp.

00409 {
00410     ASSERT(m_pBrowserApp != NULL);
00411
00412     VARIANT_BOOL result;
00413     m_pBrowserApp->get_TopLevelContainer(&result);
00414     return result;
00415 }

CString CCJHtmlView::GetType ( void ) const

Definition at line 262 of file CJHtmlView.cpp.

00263 {
00264     ASSERT(m_pBrowserApp != NULL);
00265
00266     BSTR bstr;
00267     m_pBrowserApp->get_Type(&bstr);
00268     CString retVal(bstr);
00269     return retVal;
00270 }

BOOL CCJHtmlView::GetVisible ( ) const

Definition at line 306 of file CJHtmlView.cpp.

00307 {
00308     ASSERT(m_pBrowserApp != NULL);
00309
00310     VARIANT_BOOL result;
00311     m_pBrowserApp->get_Visible(&result);
00312     return result;
00313 }

_CJXLIB_INLINE void CCJHtmlView::GoBack ( )

Definition at line 251 of file CJHtmlView.h.

00252     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->GoBack(); }

_CJXLIB_INLINE void CCJHtmlView::GoForward ( )

Definition at line 254 of file CJHtmlView.h.

00255     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->GoForward(); }

_CJXLIB_INLINE void CCJHtmlView::GoHome ( )

Definition at line 257 of file CJHtmlView.h.

00258     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->GoHome(); }

_CJXLIB_INLINE void CCJHtmlView::GoSearch ( )

Definition at line 260 of file CJHtmlView.h.

00261     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->GoSearch(); }

BOOL CCJHtmlView::LoadFromResource ( UINT nRes )

Definition at line 521 of file CJHtmlView.cpp.

00522 {
00523     HINSTANCE hInstance = AfxGetResourceHandle();
00524     ASSERT(hInstance != NULL);
00525
00526     CString strResourceURL;
00527     BOOL bRetVal = TRUE;
00528     LPTSTR lpszModule = new TCHAR[_MAX_PATH];
00529
00530     if (GetModuleFileName(hInstance, lpszModule, _MAX_PATH))
00531     {
00532         strResourceURL.Format(_T("res://%s/%d"), lpszModule, nRes);
00533         Navigate(strResourceURL, 0, 0, 0);
00534     }
00535     else
00536         bRetVal = FALSE;
00537
00538     delete [] lpszModule;
00539     return bRetVal;
00540 }

BOOL CCJHtmlView::LoadFromResource ( LPCTSTR lpszResource )

Definition at line 500 of file CJHtmlView.cpp.

00501 {
00502     HINSTANCE hInstance = AfxGetResourceHandle();
00503     ASSERT(hInstance != NULL);
00504
00505     CString strResourceURL;
00506     BOOL bRetVal = TRUE;
00507     LPTSTR lpszModule = new TCHAR[_MAX_PATH];
00508
00509     if (GetModuleFileName(hInstance, lpszModule, _MAX_PATH))
00510     {
00511         strResourceURL.Format(_T("res://%s/%s"), lpszModule, lpszResource);
00512         Navigate(strResourceURL, 0, 0, 0);
00513     }
00514     else
00515         bRetVal = FALSE;
00516
00517     delete [] lpszModule;
00518     return bRetVal;
00519 }

void CCJHtmlView::Navigate | ( | LPCTSTR | lpszURL,
 |  | DWORD | dwFlags = 0,
 |  | LPCTSTR | lpszTargetFrameName = NULL,
 |  | LPCTSTR | lpszHeaders = NULL,
 |  | LPVOID | lpvPostData = NULL,
 |  | DWORD | dwPostDataLen = 0
 | ) |

Definition at line 542 of file CJHtmlView.cpp.

Referenced by LoadFromResource().

00546 {
00547     CString strURL(lpszURL);
00548     BSTR bstrURL = strURL.AllocSysString();
00549
00550     COleSafeArray vPostData;
00551     if (lpvPostData != NULL)
00552     {
00553         if (dwPostDataLen == 0)
00554             dwPostDataLen = lstrlen((LPCTSTR) lpvPostData);
00555
00556         vPostData.CreateOneDim(VT_UI1, dwPostDataLen, lpvPostData);
00557     }
00558
00559     m_pBrowserApp->Navigate(bstrURL,
00560         COleVariant((long) dwFlags, VT_I4),
00561         COleVariant(lpszTargetFrameName, VT_BSTR),
00562         vPostData,
00563         COleVariant(lpszHeaders, VT_BSTR));
00564 }

void CCJHtmlView::Navigate2 | ( | LPCTSTR | lpszURL,
 |  | DWORD | dwFlags,
 |  | CByteArray & | baPostData,
 |  | LPCTSTR | lpszTargetFrameName = NULL,
 |  | LPCTSTR | lpszHeaders = NULL
 | ) |

Definition at line 647 of file CJHtmlView.cpp.

00650 {
00651     ASSERT(m_pBrowserApp != NULL);
00652
00653     COleVariant vPostData = baPostData;
00654     COleVariant vURL(lpszURL, VT_BSTR);
00655     COleVariant vHeaders(lpszHeaders, VT_BSTR);
00656     COleVariant vTargetFrameName(lpszTargetFrameName, VT_BSTR);
00657     COleVariant vFlags((long) dwFlags, VT_I4);
00658
00659     ASSERT(m_pBrowserApp != NULL);
00660
00661     m_pBrowserApp->Navigate2(vURL, vFlags, vTargetFrameName,
00662         vPostData, vHeaders);
00663 }

void CCJHtmlView::Navigate2 | ( | LPCTSTR | lpszURL,
 |  | DWORD | dwFlags = 0,
 |  | LPCTSTR | lpszTargetFrameName = NULL,
 |  | LPCTSTR | lpszHeaders = NULL,
 |  | LPVOID | lpvPostData = NULL,
 |  | DWORD | dwPostDataLen = 0
 | ) |

Definition at line 622 of file CJHtmlView.cpp.

00626 {
00627     ASSERT(m_pBrowserApp != NULL);
00628
00629     COleSafeArray vPostData;
00630     if (lpvPostData != NULL)
00631     {
00632         if (dwPostDataLen == 0)
00633             dwPostDataLen = lstrlen((LPCTSTR) lpvPostData);
00634
00635         vPostData.CreateOneDim(VT_UI1, dwPostDataLen, lpvPostData);
00636     }
00637
00638     COleVariant vURL(lpszURL, VT_BSTR);
00639     COleVariant vHeaders(lpszHeaders, VT_BSTR);
00640     COleVariant vTargetFrameName(lpszTargetFrameName, VT_BSTR);
00641     COleVariant vFlags((long) dwFlags, VT_I4);
00642
00643     m_pBrowserApp->Navigate2(vURL,
00644         vFlags, vTargetFrameName, vPostData, vHeaders);
00645 }

void CCJHtmlView::Navigate2 | ( | LPITEMIDLIST | pIDL,
 |  | DWORD | dwFlags = 0,
 |  | LPCTSTR | lpszTargetFrameName = NULL
 | ) |

Definition at line 603 of file CJHtmlView.cpp.

00605 {
00606     ASSERT(m_pBrowserApp != NULL);
00607
00608 #ifdef _VC_VERSION_5
00609     COleVariant vPIDL;
00610     MakeOleVariant(vPIDL, pIDL);
00611 #else
00612     COleVariant vPIDL(pIDL);
00613 #endif
00614     COleVariant empty;
00615
00616     m_pBrowserApp->Navigate2(vPIDL,
00617         COleVariant((long) dwFlags, VT_I4),
00618         COleVariant(lpszTargetFrameName, VT_BSTR),
00619         empty, empty);
00620 }

void CCJHtmlView::NavigateComplete2 | ( | LPDISPATCH | pDisp,
 |  | VARIANT * | URL
 | ) | [protected, virtual]

Definition at line 723 of file CJHtmlView.cpp.

00724 {
00725     ASSERT(V_VT(URL) == VT_BSTR);
00726
00727     USES_CONVERSION;
00728
00729     CString str = OLE2T(V_BSTR(URL));
00730     OnNavigateComplete2(str);
00731 }

void CCJHtmlView::OnBeforeNavigate2 | ( | LPCTSTR | lpszURL,
 |  | DWORD | nFlags,
 |  | LPCTSTR | lpszTargetFrameName,
 |  | CByteArray & | baPostData,
 |  | LPCTSTR | lpszHeaders,
 |  | BOOL * | bCancel
 | ) | [virtual]

Definition at line 887 of file CJHtmlView.cpp.

Referenced by BeforeNavigate2().

00890 {
00891     // default to continuing
00892     bCancel = FALSE;
00893
00894     // user will override to handle this notification
00895     UNUSED_ALWAYS(lpszURL);
00896     UNUSED_ALWAYS(nFlags);
00897     UNUSED_ALWAYS(lpszTargetFrameName);
00898     UNUSED_ALWAYS(baPostData);
00899     UNUSED_ALWAYS(lpszHeaders);
00900 }

void CCJHtmlView::OnCommandStateChange | ( | long | lCommand,
 |  | BOOL | bEnable
 | ) | [virtual]

Definition at line 796 of file CJHtmlView.cpp.

00797 {
00798     // user will override to handle this notification
00799     UNUSED_ALWAYS(lCommand);
00800     UNUSED_ALWAYS(bEnable);
00801 }

void CCJHtmlView::OnDestroy ( void ) [protected]

Definition at line 191 of file CJHtmlView.cpp.

00192 {
00193     RELEASE(m_pBrowserApp);
00194 }

void CCJHtmlView::OnDocumentComplete ( LPCTSTR lpszURL ) [virtual]

Definition at line 834 of file CJHtmlView.cpp.

Referenced by DocumentComplete().

00835 {
00836     // user will override to handle this notification
00837     UNUSED_ALWAYS(lpszURL);
00838 }

void CCJHtmlView::OnDownloadBegin ( ) [virtual]

Definition at line 803 of file CJHtmlView.cpp.

00804 {
00805     // user will override to handle this notification
00806 }

void CCJHtmlView::OnDownloadComplete ( ) [virtual]

Definition at line 808 of file CJHtmlView.cpp.

00809 {
00810     // user will override to handle this notification
00811 }

void CCJHtmlView::OnDraw ( CDC * pDC ) [virtual]

Definition at line 138 of file CJHtmlView.cpp.

00139 {
00140     // this class should never do its own drawing;
00141     // the browser control should handle everything
00142
00143     ASSERT(FALSE);
00144 }

BOOL CCJHtmlView::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 914 of file CJHtmlView.cpp.

00915 {
00916     CRect rectClient;
00917     GetClientRect( &rectClient );
00918     pDC->ExcludeClipRect( &rectClient );
00919     return CFormView::OnEraseBkgnd(pDC);
00920 }

void CCJHtmlView::OnFilePrint ( ) [protected]

Definition at line 149 of file CJHtmlView.cpp.

00150 {
00151     // get the HTMLDocument
00152
00153     if (m_pBrowserApp != NULL)
00154     {
00155         LPOLECOMMANDTARGET lpTarget = NULL;
00156         LPDISPATCH lpDisp = GetHtmlDocument();
00157
00158         if (lpDisp != NULL)
00159         {
00160             // the control will handle all printing UI
00161
00162             if (SUCCEEDED(lpDisp->QueryInterface(IID_IOleCommandTarget,
00163                     (LPVOID*) &lpTarget)))
00164             {
00165                 lpTarget->Exec(NULL, OLECMDID_PRINT, 0, NULL, NULL);
00166                 lpTarget->Release();
00167             }
00168             lpDisp->Release();
00169         }
00170     }
00171 }

void CCJHtmlView::OnFullScreen ( BOOL bFullScreen ) [virtual]

Definition at line 869 of file CJHtmlView.cpp.

00870 {
00871     // user will override to handle this notification
00872     UNUSED_ALWAYS(bFullScreen);
00873 }

void CCJHtmlView::OnMenuBar ( BOOL bMenuBar ) [virtual]

Definition at line 857 of file CJHtmlView.cpp.

00858 {
00859     // user will override to handle this notification
00860     UNUSED_ALWAYS(bMenuBar);
00861 }

void CCJHtmlView::OnNavigateComplete2 ( LPCTSTR lpszURL ) [virtual]

Definition at line 881 of file CJHtmlView.cpp.

Referenced by NavigateComplete2().

00882 {
00883     // user will override to handle this notification
00884     UNUSED_ALWAYS(lpszURL);
00885 }

void CCJHtmlView::OnNewWindow2 | ( | LPDISPATCH * | ppDisp,
 |  | BOOL * | bCancel
 | ) | [virtual]

Definition at line 825 of file CJHtmlView.cpp.

00826 {
00827     // default to continuing
00828     bCancel = FALSE;
00829
00830     // user will override to handle this notification
00831     UNUSED_ALWAYS(ppDisp);
00832 }

void CCJHtmlView::OnPaint ( ) [protected]

Definition at line 212 of file CJHtmlView.cpp.

00213 {
00214     Default();
00215 }

void CCJHtmlView::OnProgressChange | ( | long | lProgress,
 |  | long | lProgressMax
 | ) | [virtual]

Definition at line 789 of file CJHtmlView.cpp.

00790 {
00791     // user will override to handle this notification
00792     UNUSED_ALWAYS(lProgress);
00793     UNUSED_ALWAYS(lProgressMax);
00794 }

void CCJHtmlView::OnPropertyChange ( LPCTSTR lpszProperty ) [virtual]

Definition at line 819 of file CJHtmlView.cpp.

00820 {
00821     // user will override to handle this notification
00822     UNUSED_ALWAYS(lpszProperty);
00823 }

void CCJHtmlView::OnQuit ( void ) [virtual]

Definition at line 840 of file CJHtmlView.cpp.

00841 {
00842     // user will override to handle this notification
00843 }

void CCJHtmlView::OnSize | ( | UINT | nType,
 |  | int | cx,
 |  | int | cy
 | ) | [protected]

Definition at line 196 of file CJHtmlView.cpp.

00197 {
00198     CFormView::OnSize(nType, cx, cy);
00199
00200     if (::IsWindow(m_wndBrowser.m_hWnd))
00201     {
00202         // need to push non-client borders out of the client area
00203         CRect rect;
00204         GetClientRect(rect);
00205         ::AdjustWindowRectEx(rect,
00206             m_wndBrowser.GetStyle(), FALSE, WS_EX_CLIENTEDGE);
00207         m_wndBrowser.SetWindowPos(NULL, rect.left, rect.top,
00208             rect.Width(), rect.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
00209     }
00210 }

void CCJHtmlView::OnStatusBar ( BOOL bStatusBar ) [virtual]

Definition at line 863 of file CJHtmlView.cpp.

00864 {
00865     // user will override to handle this notification
00866     UNUSED_ALWAYS(bStatusBar);
00867 }

void CCJHtmlView::OnStatusTextChange ( LPCTSTR pszText ) [virtual]

Definition at line 902 of file CJHtmlView.cpp.

00903 {
00904     // try to set the status bar text via the frame
00905
00906     CFrameWnd* pFrame = GetParentFrame();
00907     if (pFrame != NULL)
00908         pFrame->SetMessageText(pszText);
00909 }

void CCJHtmlView::OnTheaterMode ( BOOL bTheaterMode ) [virtual]

Definition at line 875 of file CJHtmlView.cpp.

00876 {
00877     // user will override to handle this notification
00878     UNUSED_ALWAYS(bTheaterMode);
00879 }

void CCJHtmlView::OnTitleChange ( LPCTSTR lpszText ) [virtual]

Definition at line 813 of file CJHtmlView.cpp.

00814 {
00815     // user will override to handle this notification
00816     UNUSED_ALWAYS(lpszText);
00817 }

void CCJHtmlView::OnToolBar ( BOOL bToolBar ) [virtual]

Definition at line 851 of file CJHtmlView.cpp.

00852 {
00853     // user will override to handle this notification
00854     UNUSED_ALWAYS(bToolBar);
00855 }

void CCJHtmlView::OnVisible ( BOOL bVisible ) [virtual]

Definition at line 845 of file CJHtmlView.cpp.

00846 {
00847     // user will override to handle this notification
00848     UNUSED_ALWAYS(bVisible);
00849 }

_CJXLIB_INLINE void CCJHtmlView::PutProperty | ( | LPCTSTR | lpszPropertyName,
 |  | short | nValue
 | ) |

Definition at line 284 of file CJHtmlView.h.

00285     { ASSERT(m_pBrowserApp != NULL); ASSERT(m_pBrowserApp != NULL); PutProperty(lpszPropertyName, COleVariant(nValue, VT_UI2)); }

_CJXLIB_INLINE void CCJHtmlView::PutProperty | ( | LPCTSTR | lpszPropertyName,
 |  | long | lValue
 | ) |

Definition at line 281 of file CJHtmlView.h.

00282     { ASSERT(m_pBrowserApp != NULL); ASSERT(m_pBrowserApp != NULL); PutProperty(lpszPropertyName, COleVariant(lValue, VT_UI4)); }

_CJXLIB_INLINE void CCJHtmlView::PutProperty | ( | LPCTSTR | lpszPropertyName,
 |  | LPCTSTR | lpszValue
 | ) |

Definition at line 287 of file CJHtmlView.h.

00288     { ASSERT(m_pBrowserApp != NULL); ASSERT(m_pBrowserApp != NULL); PutProperty(lpszPropertyName, COleVariant(lpszValue, VT_BSTR)); }

_CJXLIB_INLINE void CCJHtmlView::PutProperty | ( | LPCTSTR | lpszPropertyName,
 |  | double | dValue
 | ) |

Definition at line 290 of file CJHtmlView.h.

00291     { ASSERT(m_pBrowserApp != NULL); ASSERT(m_pBrowserApp != NULL); PutProperty(lpszPropertyName, COleVariant(dValue)); }

void CCJHtmlView::PutProperty | ( | LPCTSTR | lpszProperty,
 |  | const VARIANT & | vtValue
 | ) |

Definition at line 665 of file CJHtmlView.cpp.

Referenced by PutProperty().

00666 {
00667     ASSERT(m_pBrowserApp != NULL);
00668
00669     CString strProp(lpszProperty);
00670     BSTR bstrProp = strProp.AllocSysString();
00671     m_pBrowserApp->PutProperty(bstrProp, vtValue);
00672     ::SysFreeString(bstrProp);
00673 }

OLECMDF CCJHtmlView::QueryStatusWB ( OLECMDID cmdID ) const

Definition at line 444 of file CJHtmlView.cpp.

00445 {
00446     ASSERT(m_pBrowserApp != NULL);
00447
00448     OLECMDF result;
00449     m_pBrowserApp->QueryStatusWB(cmdID, &result);
00450     return result;
00451 }

_CJXLIB_INLINE void CCJHtmlView::Refresh ( )

Definition at line 263 of file CJHtmlView.h.

00264     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->Refresh(); }

_CJXLIB_INLINE void CCJHtmlView::Refresh2 ( int nLevel )

Definition at line 266 of file CJHtmlView.h.

00267     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->Refresh2(COleVariant((long) nLevel, VT_I4)); }

_CJXLIB_INLINE void CCJHtmlView::SetAddressBar ( BOOL bNewValue )

Definition at line 275 of file CJHtmlView.h.

00276     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_AddressBar((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }

_CJXLIB_INLINE void CCJHtmlView::SetFullScreen ( BOOL bNewValue )

Definition at line 272 of file CJHtmlView.h.

00273     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_FullScreen((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }

_CJXLIB_INLINE void CCJHtmlView::SetHeight ( long nNewValue )

Definition at line 278 of file CJHtmlView.h.

00279     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Height(nNewValue); }

_CJXLIB_INLINE void CCJHtmlView::SetLeft ( long nNewValue )

Definition at line 296 of file CJHtmlView.h.

00297     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Left(nNewValue); }

_CJXLIB_INLINE void CCJHtmlView::SetMenuBar ( BOOL bNewValue )

Definition at line 239 of file CJHtmlView.h.

00240     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_MenuBar((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }

_CJXLIB_INLINE void CCJHtmlView::SetOffline ( BOOL bNewValue )

Definition at line 245 of file CJHtmlView.h.

00246     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Offline((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }

_CJXLIB_INLINE void CCJHtmlView::SetRegisterAsBrowser ( BOOL bNewValue )

Definition at line 227 of file CJHtmlView.h.

00228     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_RegisterAsBrowser((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }

_CJXLIB_INLINE void CCJHtmlView::SetRegisterAsDropTarget ( BOOL bNewValue )

Definition at line 230 of file CJHtmlView.h.

00231     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_RegisterAsDropTarget((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }

_CJXLIB_INLINE void CCJHtmlView::SetSilent ( BOOL bNewValue )

Definition at line 248 of file CJHtmlView.h.

00249     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Silent((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }

_CJXLIB_INLINE void CCJHtmlView::SetStatusBar ( BOOL bNewValue )

Definition at line 299 of file CJHtmlView.h.

00300     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_StatusBar((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }

_CJXLIB_INLINE void CCJHtmlView::SetTheaterMode ( BOOL bNewValue )

Definition at line 233 of file CJHtmlView.h.

00234     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_TheaterMode((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }

_CJXLIB_INLINE void CCJHtmlView::SetToolBar ( int nNewValue )

Definition at line 242 of file CJHtmlView.h.

00243     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_ToolBar(nNewValue); }

_CJXLIB_INLINE void CCJHtmlView::SetTop ( long nNewValue )

Definition at line 293 of file CJHtmlView.h.

00294     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Top(nNewValue); }

_CJXLIB_INLINE void CCJHtmlView::SetVisible ( BOOL bNewValue )

Definition at line 236 of file CJHtmlView.h.

00237     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->put_Visible((short) (bNewValue ? AFX_OLE_TRUE : AFX_OLE_FALSE)); }

_CJXLIB_INLINE void CCJHtmlView::Stop ( )

Definition at line 269 of file CJHtmlView.h.

00270     { ASSERT(m_pBrowserApp != NULL); m_pBrowserApp->Stop(); }

Member Data Documentation

IWebBrowser2* CCJHtmlView::m_pBrowserApp [protected]

Definition at line 209 of file CJHtmlView.h.

CWnd CCJHtmlView::m_wndBrowser

Definition at line 200 of file CJHtmlView.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJHtmlView.h
  • WinCvs/CJLib/CJLibrary/CJHtmlView.cpp
Generated on Sun Oct 21 12:46:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJHyperLink Class Reference

#include <CJHyperLink.h>

Inheritance diagram for CCJHyperLink:

[legend]
Collaboration diagram for CCJHyperLink:

[legend]
List of all members.

Public Methods

CCJHyperLink ()
virtual | ~CCJHyperLink ()
virtual void | SetURL (CString strURL)
virtual CString | GetURL () const
virtual void | SetColors (COLORREF crLinkColor, COLORREF crVisitedColor, COLORREF crHoverColor=-1)
virtual COLORREF | GetLinkColor () const
virtual COLORREF | GetVisitedColor () const
virtual COLORREF | GetHoverColor () const
virtual void | SetVisited (BOOL bVisited=TRUE)
virtual BOOL | GetVisited () const
virtual void | SetLinkCursor (HCURSOR hCursor)
virtual HCURSOR | GetLinkCursor () const
virtual void | SetUnderline (BOOL bUnderline=TRUE)
virtual BOOL | GetUnderline () const
virtual void | SetAutoSize (BOOL bAutoSize=TRUE)
virtual BOOL | GetAutoSize () const
virtual HINSTANCE | GotoURL (LPCTSTR url, int showcmd)
virtual BOOL | PreTranslateMessage (MSG *pMsg)

Protected Methods

virtual void | PreSubclassWindow ()
virtual void | ReportError (int nError)
virtual LONG | GetRegKey (HKEY key, LPCTSTR subkey, LPTSTR retdata)
virtual void | PositionWindow ()
virtual void | SetDefaultCursor ()
afx_msg HBRUSH | CtlColor (CDC *pDC, UINT nCtlColor)
afx_msg BOOL | OnSetCursor (CWnd *pWnd, UINT nHitTest, UINT message)
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg void | OnClicked ()

Protected Attributes

COLORREF | m_crLinkColor
COLORREF | m_crVisitedColor
COLORREF | m_crHoverColor
BOOL | m_bOverControl
BOOL | m_bVisited
BOOL | m_bUnderline
BOOL | m_bAdjustToFit
CString | m_strURL
CFont | m_Font
HCURSOR | m_hLinkCursor
CToolTipCtrl | m_ToolTip

Constructor & Destructor Documentation

CCJHyperLink::CCJHyperLink ( )

Definition at line 55 of file CJHyperLink.cpp.

00056 {
00057     m_hLinkCursor       = NULL;                 // No cursor as yet
00058     m_crLinkColor      = RGB(  0,   0, 238);   // Blue
00059     m_crVisitedColor   = RGB( 85,  26, 139);   // Purple
00060     m_crHoverColor     = ::GetSysColor(COLOR_HIGHLIGHT);
00061     m_bOverControl      = FALSE;                // Cursor not yet over control
00062     m_bVisited          = FALSE;                // Hasn't been visited yet.
00063     m_bUnderline        = TRUE;                 // Underline the link?
00064     m_bAdjustToFit      = TRUE;                 // Resize the window to fit the text?
00065     m_strURL.Empty();
00066 }

CCJHyperLink::~CCJHyperLink ( ) [virtual]

Definition at line 68 of file CJHyperLink.cpp.

00069 {
00070     m_Font.DeleteObject();
00071     if (m_hLinkCursor) {
00072         DestroyCursor(m_hLinkCursor);
00073     }
00074 }

Member Function Documentation

HBRUSH CCJHyperLink::CtlColor | ( | CDC * | pDC,
 |  | UINT | nCtlColor
 | ) | [protected]

Definition at line 105 of file CJHyperLink.cpp.

00106 {
00107 #ifdef _DEBUG
00108     ASSERT(nCtlColor == CTLCOLOR_STATIC);
00109 #else
00110     UNUSED_ALWAYS( nCtlColor );
00111 #endif
00112
00113     if (m_bOverControl)
00114         pDC->SetTextColor(m_crHoverColor);
00115     else if (m_bVisited)
00116         pDC->SetTextColor(m_crVisitedColor);
00117     else
00118         pDC->SetTextColor(m_crLinkColor);
00119
00120     // transparent text.
00121     pDC->SetBkMode(TRANSPARENT);
00122     return (HBRUSH)GetStockObject(NULL_BRUSH);
00123 }

BOOL CCJHyperLink::GetAutoSize ( ) const [virtual]

Definition at line 301 of file CJHyperLink.cpp.

00302 {
00303     return m_bAdjustToFit;
00304 }

COLORREF CCJHyperLink::GetHoverColor ( ) const [virtual]

Definition at line 240 of file CJHyperLink.cpp.

00241 {
00242     return m_crHoverColor;
00243 }

COLORREF CCJHyperLink::GetLinkColor ( ) const [virtual]

Definition at line 230 of file CJHyperLink.cpp.

00231 {
00232     return m_crLinkColor;
00233 }

HCURSOR CCJHyperLink::GetLinkCursor ( ) const [virtual]

Definition at line 265 of file CJHyperLink.cpp.

00266 {
00267     return m_hLinkCursor;
00268 }

LONG CCJHyperLink::GetRegKey | ( | HKEY | key,
 |  | LPCTSTR | subkey,
 |  | LPTSTR | retdata
 | ) | [protected, virtual]

Definition at line 384 of file CJHyperLink.cpp.

Referenced by GotoURL().

00385 {
00386     HKEY hkey;
00387     LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
00388
00389     if (retval == ERROR_SUCCESS) {
00390         long datasize = MAX_PATH;
00391         TCHAR data[MAX_PATH];
00392         RegQueryValue(hkey, NULL, data, &datasize);
00393         _tcscpy(retdata,data);
00394         RegCloseKey(hkey);
00395     }
00396
00397     return retval;
00398 }

CString CCJHyperLink::GetURL ( ) const [virtual]

Definition at line 210 of file CJHyperLink.cpp.

00211 {
00212     return m_strURL;
00213 }

BOOL CCJHyperLink::GetUnderline ( ) const [virtual]

Definition at line 288 of file CJHyperLink.cpp.

00289 {
00290     return m_bUnderline;
00291 }

BOOL CCJHyperLink::GetVisited ( ) const [virtual]

Definition at line 253 of file CJHyperLink.cpp.

00254 {
00255     return m_bVisited;
00256 }

COLORREF CCJHyperLink::GetVisitedColor ( ) const [virtual]

Definition at line 235 of file CJHyperLink.cpp.

00236 {
00237     return m_crVisitedColor;
00238 }

HINSTANCE CCJHyperLink::GotoURL | ( | LPCTSTR | url,
 |  | int | showcmd
 | ) | [virtual]

Definition at line 423 of file CJHyperLink.cpp.

Referenced by OnClicked().

00424 {
00425     TCHAR key[MAX_PATH + MAX_PATH];
00426
00427     // First try ShellExecute()
00428     HINSTANCE result = ShellExecute( NULL, _T("open"), url, NULL, NULL, showcmd );
00429
00430     // If it failed, get the .htm regkey and lookup the program
00431     if((UINT)result <= HINSTANCE_ERROR)
00432     {
00433         if( GetRegKey( HKEY_CLASSES_ROOT, _T(".htm"), key ) == ERROR_SUCCESS )
00434         {
00435             lstrcat( key, _T("\\shell\\open\\command"));
00436
00437             if( GetRegKey( HKEY_CLASSES_ROOT, key, key ) == ERROR_SUCCESS )
00438             {
00439                 LPTSTR pos;
00440
00441                 pos = _tcsstr(key, _T("\"%1\""));
00442
00443                 if( pos == NULL )                       // No quotes found
00444                 {
00445                     pos = _tcsstr( key, _T("%1"));      // Check for %1, without quotes
00446
00447                     if( pos == NULL )                   // No parameter at all...
00448                     {
00449                         pos = key + _tcslen( key ) - 1;
00450                     }
00451                     else
00452                     {
00453                         *pos = _T('\0');                // Remove the parameter
00454                     }
00455                 }
00456                 else
00457                 {
00458                     *pos = _T('\0');                    // Remove the parameter
00459                 }
00460
00461                 lstrcat( pos, _T(" "));
00462                 lstrcat( pos, url );
00463
00464                 PROCESS_INFORMATION pi;
00465
00466                 STARTUPINFO         si;
00467
00468                 ::ZeroMemory( &si, sizeof( si ));
00469
00470                 si.cb = sizeof( si );
00471
00472                 if( ::CreateProcess( NULL,
00473                                      pos,
00474                                      NULL,
00475                                      NULL,
00476                                      FALSE,
00477                                      0,
00478                                      NULL,
00479                                      NULL,
00480                                      &si,
00481                                     &pi ) == FALSE )
00482                 {
00483                     return NULL;
00484                 }
00485
00486                 result = (HINSTANCE) pi.hProcess;
00487             }
00488         }
00489     }
00490
00491     return result;
00492 }

void CCJHyperLink::OnClicked ( ) [protected]

Definition at line 94 of file CJHyperLink.cpp.

00095 {
00096     int result = (int)GotoURL(m_strURL, SW_SHOW);
00097     m_bVisited = (result > HINSTANCE_ERROR);
00098     if (!m_bVisited) {
00099         MessageBeep(MB_ICONEXCLAMATION);     // Unable to follow link
00100         ReportError(result);
00101     } else
00102         SetVisited();                        // Repaint to show visited Color
00103 }

void CCJHyperLink::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 125 of file CJHyperLink.cpp.

00126 {
00127     CStatic::OnMouseMove(nFlags, point);
00128
00129     if (m_bOverControl)        // Cursor is currently over control
00130     {
00131         CRect rect;
00132         GetClientRect(rect);
00133
00134         if (!rect.PtInRect(point))
00135         {
00136             m_bOverControl = FALSE;
00137             ReleaseCapture();
00138             RedrawWindow();
00139             return;
00140         }
00141     }
00142     else                      // Cursor has just moved over control
00143     {
00144         m_bOverControl = TRUE;
00145         RedrawWindow();
00146         SetCapture();
00147     }
00148 }

BOOL CCJHyperLink::OnSetCursor | ( | CWnd * | pWnd,
 |  | UINT | nHitTest,
 |  | UINT | message
 | ) | [protected]

Definition at line 150 of file CJHyperLink.cpp.

00151 {
00152     if (m_hLinkCursor)
00153     {
00154         ::SetCursor(m_hLinkCursor);
00155         return TRUE;
00156     }
00157     return FALSE;
00158 }

void CCJHyperLink::PositionWindow ( ) [protected, virtual]

Definition at line 315 of file CJHyperLink.cpp.

Referenced by PreSubclassWindow(), SetAutoSize(), and SetURL().

00316 {
00317     if (!::IsWindow(GetSafeHwnd()) || !m_bAdjustToFit)
00318         return;
00319
00320     // Get the current window position
00321     CRect rect;
00322     GetWindowRect(rect);
00323
00324     CWnd* pParent = GetParent();
00325     if (pParent)
00326         pParent->ScreenToClient(rect);
00327
00328     // Get the size of the window text
00329     CString strWndText;
00330     GetWindowText(strWndText);
00331
00332     CDC* pDC = GetDC();
00333     CFont* pOldFont = pDC->SelectObject(&m_Font);
00334     CSize Extent = pDC->GetTextExtent(strWndText);
00335     pDC->SelectObject(pOldFont);
00336     ReleaseDC(pDC);
00337
00338     // Get the text justification via the window style
00339     DWORD dwStyle = GetStyle();
00340
00341     // Recalc the window size and position based on the text justification
00342     if (dwStyle & SS_CENTERIMAGE)
00343         rect.DeflateRect(0, (rect.Height() - Extent.cy)/2);
00344     else
00345         rect.bottom = rect.top + Extent.cy;
00346
00347     if (dwStyle & SS_CENTER)
00348         rect.DeflateRect((rect.Width() - Extent.cx)/2, 0);
00349     else if (dwStyle & SS_RIGHT)
00350         rect.left  = rect.right - Extent.cx;
00351     else // SS_LEFT = 0, so we can't test for it explicitly
00352         rect.right = rect.left + Extent.cx;
00353
00354     // Move the window
00355     SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
00356 }

void CCJHyperLink::PreSubclassWindow ( ) [protected, virtual]

Definition at line 160 of file CJHyperLink.cpp.

00161 {
00162     // We want to get mouse clicks via STN_CLICKED
00163     DWORD dwStyle = GetStyle();
00164     ::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY);
00165
00166     // Set the URL as the window text
00167     if (m_strURL.IsEmpty())
00168         GetWindowText(m_strURL);
00169
00170     // Check that the window text isn't empty. If it is, set it as the URL.
00171     CString strWndText;
00172     GetWindowText(strWndText);
00173     if (strWndText.IsEmpty()) {
00174         ASSERT(!m_strURL.IsEmpty());    // Window and URL both NULL. DUH!
00175         SetWindowText(m_strURL);
00176     }
00177
00178     // Create the font
00179     LOGFONT lf;
00180     GetFont()->GetLogFont(&lf);
00181     lf.lfUnderline = (char)m_bUnderline;
00182     m_Font.CreateFontIndirect(&lf);
00183     SetFont(&m_Font);
00184
00185     PositionWindow();        // Adjust size of window to fit URL if necessary
00186     SetDefaultCursor();      // Try and load up a "hand" cursor
00187
00188     // Create the tooltip
00189     CRect rect;
00190     GetClientRect(rect);
00191     m_ToolTip.Create(this);
00192     m_ToolTip.AddTool(this, m_strURL, rect, TOOLTIP_ID);
00193
00194     CStatic::PreSubclassWindow();
00195 }

BOOL CCJHyperLink::PreTranslateMessage ( MSG * pMsg ) [virtual]

Definition at line 88 of file CJHyperLink.cpp.

00089 {
00090     m_ToolTip.RelayEvent(pMsg);
00091     return CStatic::PreTranslateMessage(pMsg);
00092 }

void CCJHyperLink::ReportError ( int nError ) [protected, virtual]

Definition at line 400 of file CJHyperLink.cpp.

Referenced by OnClicked().

00401 {
00402     CString str;
00403     switch (nError) {
00404         case 0:                       str = _T("The operating system is out\nof memory or resources."); break;
00405         case SE_ERR_PNF:              str = _T("The specified path was not found."); break;
00406         case SE_ERR_FNF:              str = _T("The specified file was not found."); break;
00407         case ERROR_BAD_FORMAT:        str = _T("The .EXE file is invalid\n(non-Win32 .EXE or error in .EXE image)."); break;
00408         case SE_ERR_ACCESSDENIED:     str = _T("The operating system denied\naccess to the specified file."); break;
00409         case SE_ERR_ASSOCINCOMPLETE:  str = _T("The filename association is\nincomplete or invalid."); break;
00410         case SE_ERR_DDEBUSY:          str = _T("The DDE transaction could not\nbe completed because other DDE transactions\nwere being processed."); break;
00411         case SE_ERR_DDEFAIL:          str = _T("The DDE transaction failed."); break;
00412         case SE_ERR_DDETIMEOUT:       str = _T("The DDE transaction could not\nbe completed because the request timed out."); break;
00413         case SE_ERR_DLLNOTFOUND:      str = _T("The specified dynamic-link library was not found."); break;
00414         case SE_ERR_NOASSOC:          str = _T("There is no application associated\nwith the given filename extension."); break;
00415         case SE_ERR_OOM:              str = _T("There was not enough memory to complete the operation."); break;
00416         case SE_ERR_SHARE:            str = _T("A sharing violation occurred. ");
00417         default:                      str.Format(_T("Unknown Error (%d) occurred."), nError); break;
00418     }
00419     str = _T("Unable to open hyperlink:\n\n") + str;
00420     AfxMessageBox(str, MB_ICONEXCLAMATION | MB_OK);
00421 }

void CCJHyperLink::SetAutoSize ( BOOL bAutoSize = TRUE ) [virtual]

Definition at line 293 of file CJHyperLink.cpp.

00294 {
00295     m_bAdjustToFit = bAutoSize;
00296
00297     if (::IsWindow(GetSafeHwnd()))
00298         PositionWindow();
00299 }

void CCJHyperLink::SetColors | ( | COLORREF | crLinkColor,
 |  | COLORREF | crVisitedColor,
 |  | COLORREF | crHoverColor = -1
 | ) | [virtual]

Definition at line 215 of file CJHyperLink.cpp.

00217 {
00218     m_crLinkColor    = crLinkColor;
00219     m_crVisitedColor = crVisitedColor;
00220
00221     if (crHoverColor == -1)
00222         m_crHoverColor = ::GetSysColor(COLOR_HIGHLIGHT);
00223     else
00224         m_crHoverColor = crHoverColor;
00225
00226     if (::IsWindow(m_hWnd))
00227         Invalidate();
00228 }

void CCJHyperLink::SetDefaultCursor ( ) [protected, virtual]

Definition at line 363 of file CJHyperLink.cpp.

Referenced by PreSubclassWindow(), and SetLinkCursor().

00364 {
00365     if (m_hLinkCursor == NULL)                // No cursor handle - load our own
00366     {
00367         // Get the windows directory
00368         CString strWndDir;
00369         GetWindowsDirectory(strWndDir.GetBuffer(MAX_PATH), MAX_PATH);
00370         strWndDir.ReleaseBuffer();
00371
00372         strWndDir += _T("\\winhlp32.exe");
00373         // This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
00374         HMODULE hModule = LoadLibrary(strWndDir);
00375         if (hModule) {
00376             HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
00377             if (hHandCursor)
00378                 m_hLinkCursor = CopyCursor(hHandCursor);
00379         }
00380         FreeLibrary(hModule);
00381     }
00382 }

void CCJHyperLink::SetLinkCursor ( HCURSOR hCursor ) [virtual]

Definition at line 258 of file CJHyperLink.cpp.

00259 {
00260     m_hLinkCursor = hCursor;
00261     if (m_hLinkCursor == NULL)
00262         SetDefaultCursor();
00263 }

void CCJHyperLink::SetURL ( CString strURL ) [virtual]

Definition at line 200 of file CJHyperLink.cpp.

Referenced by CAboutDlg::OnInitDialog().

00201 {
00202     m_strURL = strURL;
00203
00204     if (::IsWindow(GetSafeHwnd())) {
00205         PositionWindow();
00206         m_ToolTip.UpdateTipText(strURL, this, TOOLTIP_ID);
00207     }
00208 }

void CCJHyperLink::SetUnderline ( BOOL bUnderline = TRUE ) [virtual]

Definition at line 270 of file CJHyperLink.cpp.

00271 {
00272     m_bUnderline = bUnderline;
00273
00274     if (::IsWindow(GetSafeHwnd()))
00275     {
00276         LOGFONT lf;
00277         GetFont()->GetLogFont(&lf);
00278         lf.lfUnderline = (char)m_bUnderline;
00279
00280         m_Font.DeleteObject();
00281         m_Font.CreateFontIndirect(&lf);
00282         SetFont(&m_Font);
00283
00284         Invalidate();
00285     }
00286 }

void CCJHyperLink::SetVisited ( BOOL bVisited = TRUE ) [virtual]

Definition at line 245 of file CJHyperLink.cpp.

Referenced by OnClicked().

00246 {
00247     m_bVisited = bVisited;
00248
00249     if (::IsWindow(GetSafeHwnd()))
00250         Invalidate();
00251 }

Member Data Documentation

CFont CCJHyperLink::m_Font [protected]

Definition at line 101 of file CJHyperLink.h.

CToolTipCtrl CCJHyperLink::m_ToolTip [protected]

Definition at line 103 of file CJHyperLink.h.

BOOL CCJHyperLink::m_bAdjustToFit [protected]

Definition at line 99 of file CJHyperLink.h.

BOOL CCJHyperLink::m_bOverControl [protected]

Definition at line 96 of file CJHyperLink.h.

BOOL CCJHyperLink::m_bUnderline [protected]

Definition at line 98 of file CJHyperLink.h.

BOOL CCJHyperLink::m_bVisited [protected]

Definition at line 97 of file CJHyperLink.h.

COLORREF CCJHyperLink::m_crHoverColor [protected]

Definition at line 95 of file CJHyperLink.h.

COLORREF CCJHyperLink::m_crLinkColor [protected]

Definition at line 94 of file CJHyperLink.h.

COLORREF CCJHyperLink::m_crVisitedColor [protected]

Definition at line 94 of file CJHyperLink.h.

HCURSOR CCJHyperLink::m_hLinkCursor [protected]

Definition at line 102 of file CJHyperLink.h.

CString CCJHyperLink::m_strURL [protected]

Definition at line 100 of file CJHyperLink.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJHyperLink.h
  • WinCvs/CJLib/CJLibrary/CJHyperLink.cpp
Generated on Sun Oct 21 12:46:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJListBox Class Reference

#include <CJListBox.h>

Inheritance diagram for CCJListBox:

[legend]
Collaboration diagram for CCJListBox:

[legend]
List of all members.

Public Methods

CCJListBox ()
virtual | ~CCJListBox ()

Protected Methods

afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnPaint ()

Constructor & Destructor Documentation

CCJListBox::CCJListBox ( )

Definition at line 33 of file CJListBox.cpp.

00034 {
00035     // TODO: add construction code here.
00036 }

CCJListBox::~CCJListBox ( ) [virtual]

Definition at line 38 of file CJListBox.cpp.

00039 {
00040     // TODO: add destruction code here.
00041 }

Member Function Documentation

BOOL CCJListBox::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 55 of file CJListBox.cpp.

00056 {
00057     // KStowell - overridden for flicker-free drawing.
00058     UNUSED_ALWAYS(pDC);
00059     return TRUE;
00060 }

void CCJListBox::OnPaint ( ) [protected]

Definition at line 62 of file CJListBox.cpp.

00063 {
00064     CPaintDC dc(this); // device context for painting
00065
00066     // KStowell - Get the client rect.
00067     CRect rcClient, rcClip;
00068     dc.GetClipBox( &rcClip );
00069     GetClientRect( &rcClient );
00070
00071     // KStowell - Create a memory device-context. This is done to help reduce
00072     // screen flicker, since we will paint the entire control to the
00073     // off screen device context first.
00074     CDC memDC;
00075     CBitmap bitmap;
00076     memDC.CreateCompatibleDC(&dc);
00077     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00078     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00079
00080     // KStowell - Repaint the background.
00081     memDC.FillSolidRect( rcClient, ::GetSysColor(COLOR_WINDOW) );
00082
00083     // let the control do its default drawing.
00084     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00085
00086     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00087     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00088         rcClip.left, rcClip.top, SRCCOPY );
00089
00090     // KStowell - Cleanup resources.
00091     memDC.SelectObject(pOldBitmap);
00092     memDC.DeleteDC();
00093     bitmap.DeleteObject();
00094 }

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJListBox.h
  • WinCvs/CJLib/CJLibrary/CJListBox.cpp
Generated on Sun Oct 21 12:46:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJListCtrl Class Reference

#include <CJListCtrl.h>

Inheritance diagram for CCJListCtrl:

[legend]
Collaboration diagram for CCJListCtrl:

[legend]
List of all members.

Public Methods

CCJListCtrl ()
virtual | ~CCJListCtrl ()
virtual int | GetStoredWidth (int nCol)
virtual void | AutoSizeColumn (int nCol=-1)
virtual void | SetColumnWidth (int nCol)
virtual void | LoadColumnWidths ()
virtual void | SaveColumnWidths ()
virtual void | AutoSaveColumns (LPCTSTR lpszSection=NULL, LPCTSTR lpszEntry=NULL, LPCTSTR lpszDefault=NULL)
virtual bool | SubclassHeader (bool bBoldFont=false)
virtual bool | SortList (int nCol, bool bAscending)
virtual void | SetExtendedStyle (DWORD dwExStyle)
virtual DWORD | GetExtendedStyle ()
virtual void | DisableColumnSizing (bool bDisable)
virtual void | SetMinimumColSize (int nSize)
virtual int | HitTestEx (CPoint &point, int *col) const
virtual int | AddColumn (LPCTSTR lpszColHeading, int nWidth=-1, int nFormat=LVCFMT_LEFT)
virtual bool | BuildColumns (int nCols, int *nWidth, CString *strColString)
virtual bool | BuildColumns (int nCols, int *nWidth, int *nColString)
virtual void | SetRowColors (COLORREF clrText, COLORREF clrTextBk)
virtual int | GetColumnCount () const
virtual bool | CopyRow (int nFrom, int nTo)
virtual bool | MoveRow (int nFrom, int nTo)

Protected Methods

virtual BOOL | OnNotify (WPARAM wParam, LPARAM lParam, LRESULT *pResult)
afx_msg void | OnCustomDraw (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnDestroy ()
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnPaint ()

Protected Attributes

int | m_nMinColWidth
int | m_nMaxColWidth
int | m_nSortedCol
CCJFlatHeaderCtrl * m_pHeaderCtrl
CString | m_strSection
CString | m_strEntry
CString | m_strDefault
CListCtrl * m_pListCtrl
COLORREF | m_clrText
COLORREF | m_clrTextBk
bool | m_bNoColSizing
int | m_nMinSize
bool | m_bAscending

Private Attributes

bool | m_bAutoSave

Constructor & Destructor Documentation

CCJListCtrl::CCJListCtrl ( )

Definition at line 88 of file CJListCtrl.cpp.

00089 {
00090     m_nMinSize      = 0;
00091     m_nMinColWidth  = 50;
00092     m_nMaxColWidth  = 500;
00093     m_nSortedCol    = -1;
00094     m_bAscending    = true;
00095     m_bAutoSave     = false;
00096     m_bNoColSizing  = false;
00097     m_pHeaderCtrl   = NULL;
00098     m_clrText       = ::GetSysColor(COLOR_WINDOWTEXT);
00099     m_clrTextBk     = ::GetSysColor(COLOR_WINDOW);
00100 }

CCJListCtrl::~CCJListCtrl ( ) [virtual]

Definition at line 102 of file CJListCtrl.cpp.

00103 {
00104     _delete( m_pHeaderCtrl );
00105 }

Member Function Documentation

int CCJListCtrl::AddColumn | ( | LPCTSTR | lpszColHeading,
 |  | int | nWidth = -1,
 |  | int | nFormat = LVCFMT_LEFT
 | ) | [virtual]

Definition at line 291 of file CJListCtrl.cpp.

Referenced by BuildColumns().

00292 {
00293     CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
00294     int nColumnCount = pHeader->GetItemCount();
00295
00296     if( nWidth == -1 )
00297     {
00298         // The line below return zero for ICON views
00299         //nWidth = GetColumnWidth( nColumnCount - 1 );
00300
00301         // Get the column width of the previous column from header control
00302         HD_ITEM hd_item;
00303         hd_item.mask = HDI_WIDTH;               //indicate that we want the width
00304         pHeader->GetItem( nColumnCount - 1, &hd_item );
00305         nWidth = hd_item.cxy;
00306     }
00307     return InsertColumn( nColumnCount, lpszColHeading, nFormat, nWidth, nColumnCount );
00308 }

void CCJListCtrl::AutoSaveColumns | ( | LPCTSTR | lpszSection = NULL,
 |  | LPCTSTR | lpszEntry = NULL,
 |  | LPCTSTR | lpszDefault = NULL
 | ) | [virtual]

Definition at line 405 of file CJListCtrl.cpp.

00406 {
00407     m_bAutoSave = true;
00408
00409     // initialize registry strings.
00410     if( lpszSection == NULL ) m_strSection = _T("Settings");
00411     else m_strSection = lpszSection;
00412
00413     if( lpszEntry == NULL ) m_strEntry = _T("Column Info");
00414     else m_strEntry = lpszEntry;
00415
00416     if( lpszDefault == NULL ) m_strDefault = _T("");
00417     else m_strDefault = lpszDefault;
00418
00419     LoadColumnWidths();
00420 }

void CCJListCtrl::AutoSizeColumn ( int nCol = -1 ) [virtual]

Definition at line 481 of file CJListCtrl.cpp.

Referenced by SetColumnWidth().

00482 {
00483     // Call this after your list control is filled
00484     SetRedraw( false );
00485
00486     int nMinCol = nCol < 0 ? 0 : nCol;
00487     int nMaxCol = nCol < 0 ? GetColumnCount()-1 : nCol;
00488
00489     for (nCol = nMinCol; nCol <= nMaxCol; nCol++)
00490     {
00491         CListCtrl::SetColumnWidth( nCol, LVSCW_AUTOSIZE );
00492         int wc1 = GetColumnWidth( nCol );
00493
00494         CListCtrl::SetColumnWidth( nCol, LVSCW_AUTOSIZE_USEHEADER );
00495         int wc2 = GetColumnWidth( nCol );
00496         int wc = max( m_nMinColWidth, max( wc1, wc2 ));
00497
00498         if( wc > m_nMaxColWidth )
00499             wc = m_nMaxColWidth;
00500
00501         // set the column width.
00502         CListCtrl::SetColumnWidth( nCol,wc );
00503     }
00504
00505     SetRedraw();
00506 }

bool CCJListCtrl::BuildColumns | ( | int | nCols,
 |  | int * | nWidth,
 |  | int * | nColString
 | ) | [virtual]

Definition at line 310 of file CJListCtrl.cpp.

00311 {
00312     for( int i = 0; i < nCols; ++i ) {
00313         CString strTemp; strTemp.LoadString( nColString[i] );
00314         if(AddColumn(strTemp, nWidth[i])==-1)
00315             return false;
00316     }
00317
00318     return true;
00319 }

bool CCJListCtrl::BuildColumns | ( | int | nCols,
 |  | int * | nWidth,
 |  | CString * | strColString
 | ) | [virtual]

Definition at line 321 of file CJListCtrl.cpp.

00322 {
00323     for( int i = 0; i < nCols; ++i ) {
00324         if(AddColumn(strColString[i], nWidth[i])==-1)
00325             return false;
00326     }
00327
00328     return true;
00329 }

bool CCJListCtrl::CopyRow | ( | int | nFrom,
 |  | int | nTo
 | ) | [virtual]

Definition at line 148 of file CJListCtrl.cpp.

00149 {
00150     //Can't move to the same place, or from or to a negative index
00151     if(nFrom == nTo || nFrom < 0 || nTo < 0)
00152         return false;
00153
00154     //Copy the row to the new index
00155     InsertItem(nTo, GetItemText(nFrom, 0));
00156
00157     //If row has been inserted before original
00158     //increment the original
00159     if(nFrom > nTo)
00160         nFrom++;
00161
00162     //Loop through subitems
00163     for(int i = 1; i < GetColumnCount(); i++)
00164     {
00165         SetItemText(nTo, i, GetItemText(nFrom, i));
00166     }
00167
00168     return true;
00169 }

_CJXLIB_INLINE void CCJListCtrl::DisableColumnSizing ( bool bDisable ) [virtual]

Definition at line 276 of file CJListCtrl.h.

00277     { m_bNoColSizing = bDisable; }

int CCJListCtrl::GetColumnCount ( ) const [virtual]

Definition at line 173 of file CJListCtrl.cpp.

Referenced by AutoSizeColumn(), and CopyRow().

00174 {
00175     CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
00176     return pHeader->GetItemCount();
00177 }

_CJXLIB_INLINE DWORD CCJListCtrl::GetExtendedStyle ( ) [virtual]

Definition at line 264 of file CJListCtrl.h.

Referenced by SetExtendedStyle().

00265     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); }

int CCJListCtrl::GetStoredWidth ( int nCol ) [virtual]

Definition at line 458 of file CJListCtrl.cpp.

Referenced by SetColumnWidth().

00459 {
00460     // get the value from the registry.
00461     CString strValue = AfxGetApp()->GetProfileString(
00462         m_strSection, m_strEntry, m_strDefault );
00463
00464     // extract the sub string to get the column width.
00465     CString strSubString;
00466     AfxExtractSubString( strSubString, strValue, nCol, _T(','));
00467
00468     // return the width from the registry.
00469     return _ttoi( strSubString );
00470 }

int CCJListCtrl::HitTestEx | ( | CPoint & | point,
 |  | int * | nCol
 | ) | const [virtual]

Definition at line 338 of file CJListCtrl.cpp.

00339 {
00340     int colnum = 0;
00341     int row = HitTest( point, NULL );
00342
00343     if( nCol ) *nCol = 0;
00344
00345     // Make sure that the ListView is in LVS_REPORT
00346     if( (GetWindowLong(m_hWnd, GWL_STYLE) & LVS_TYPEMASK) != LVS_REPORT )
00347         return row;
00348
00349     // Get the top and bottom row visible
00350     row = GetTopIndex();
00351     int bottom = row + GetCountPerPage();
00352     if( bottom > GetItemCount() )
00353         bottom = GetItemCount();
00354
00355     // Get the number of columns
00356     CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
00357     int nColumnCount = pHeader->GetItemCount();
00358
00359     // Loop through the visible rows
00360     for( ;row <= bottom;row++)
00361     {
00362         // Get bounding rect of item and check whether point falls in it.
00363         CRect rect;
00364         GetItemRect( row, &rect, LVIR_BOUNDS );
00365         if( rect.PtInRect(point) )
00366         {
00367             // Now find the column
00368             for( colnum = 0; colnum < nColumnCount; colnum++ )
00369             {
00370                 int colwidth = GetColumnWidth(colnum);
00371                 if( point.x >= rect.left
00372                     && point.x <= (rect.left + colwidth ) )
00373                 {
00374                     if( nCol ) *nCol = colnum;
00375                     return row;
00376                 }
00377                 rect.left += colwidth;
00378             }
00379         }
00380     }
00381     return -1;
00382 }

void CCJListCtrl::LoadColumnWidths ( ) [virtual]

Definition at line 439 of file CJListCtrl.cpp.

Referenced by AutoSaveColumns().

00440 {
00441     // get a pointer to the header control.
00442     CHeaderCtrl* pHeader = DYNAMIC_DOWNCAST(CHeaderCtrl, GetDlgItem(0));
00443     ASSERT_KINDOF( CHeaderCtrl, pHeader );
00444
00445     for( int i = 0; i < pHeader->GetItemCount(); ++i )
00446         SetColumnWidth(i);
00447 }

bool CCJListCtrl::MoveRow | ( | int | nFrom,
 |  | int | nTo
 | ) | [virtual]

Definition at line 123 of file CJListCtrl.cpp.

00124 {
00125     //Can't move to the same place, or from or to a negative index
00126     if(nFrom == nTo || nFrom < 0 || nTo < 0)
00127         return false;
00128
00129     //First Copy the row to the new location
00130     if(CopyRow(nFrom, nTo))
00131     {
00132         //If we have just inserted a row before
00133         //this one in the list, we need to increment
00134         //our index.
00135         if(nFrom > nTo)
00136             DeleteItem(nFrom + 1);
00137         else
00138             DeleteItem(nFrom);
00139
00140         return true;
00141     }
00142     else
00143         return false;
00144 }

void CCJListCtrl::OnCustomDraw | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 181 of file CJListCtrl.cpp.

00182 {
00183     LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
00184
00185     switch(lplvcd->nmcd.dwDrawStage)
00186     {
00187     case CDDS_PREPAINT:
00188         // Request prepaint notifications for each item.
00189         *pResult = CDRF_NOTIFYITEMDRAW;
00190         break;
00191
00192     case CDDS_ITEMPREPAINT: // Requested notification
00193         if(lplvcd->nmcd.dwItemSpec % 2)
00194         {
00195             lplvcd->clrText   = m_clrText;
00196             lplvcd->clrTextBk = m_clrTextBk;
00197         }
00198         *pResult = CDRF_DODEFAULT;
00199         break;
00200     }
00201 }

void CCJListCtrl::OnDestroy ( void ) [protected]

Definition at line 472 of file CJListCtrl.cpp.

00473 {
00474     if( m_bAutoSave ) SaveColumnWidths();
00475     CListCtrl::OnDestroy();
00476 }

BOOL CCJListCtrl::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 508 of file CJListCtrl.cpp.

00509 {
00510     // KStowell - overridden for flicker-free drawing.
00511     UNUSED_ALWAYS(pDC);
00512     return TRUE;
00513 }

BOOL CCJListCtrl::OnNotify | ( | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | LRESULT * | pResult
 | ) | [protected, virtual]

Definition at line 203 of file CJListCtrl.cpp.

00204 {
00205     HD_NOTIFY *pHDNotify = (HD_NOTIFY*)lParam;
00206
00207     switch( pHDNotify->hdr.code )
00208     {
00209     // Sorting the list when user clicks on column header by Zafir Anjum.
00210     // http://www.codeguru.com/listview/sort_on_col_click.shtml
00211     case HDN_ITEMCLICKA:
00212     case HDN_ITEMCLICKW:
00213         {
00214             if( pHDNotify->iButton == 0 )
00215             {
00216                 // set the sort order.
00217                 if( pHDNotify->iItem == m_nSortedCol )
00218                     m_bAscending = !m_bAscending;
00219                 else
00220                     m_bAscending = true;
00221
00222                 // save the column index.
00223                 m_nSortedCol = pHDNotify->iItem;
00224
00225                 // virtual call to sort list.
00226                 SortList( m_nSortedCol, m_bAscending );
00227
00228                 // set the sort image in the header control.
00229                 if( m_pHeaderCtrl && m_pHeaderCtrl->GetSafeHwnd( ))
00230                     m_pHeaderCtrl->SetSortImage( m_nSortedCol, m_bAscending );
00231             }
00232         }
00233         break;
00234
00235     // How to force a minimum column width Cees Mechielsen.
00236     // http://www.codeguru.com/mfc/comments/866.shtml
00237     case HDN_ITEMCHANGINGA:
00238     case HDN_ITEMCHANGINGW:
00239     case HDN_ENDTRACK:
00240         {
00241             if( pHDNotify->pitem->mask & HDI_WIDTH &&
00242                 pHDNotify->pitem->cxy < m_nMinSize &&
00243                 pHDNotify->pitem->cxy >= 0 )
00244             {
00245                 pHDNotify->pitem->cxy = m_nMinSize; // Set the column width
00246             }
00247         }
00248         break;
00249
00250     // Prevent CListCtrl column resizing by Zafir Anjum.
00251     // http://www.codeguru.com/listview/no_col_resize.shtml
00252     case HDN_DIVIDERDBLCLICKA:
00253     case HDN_DIVIDERDBLCLICKW:
00254     case HDN_BEGINTRACKW:
00255     case HDN_BEGINTRACKA:
00256         {
00257             if(m_bNoColSizing)
00258             {
00259                 *pResult = TRUE;                // disable tracking
00260                 return TRUE;                    // Processed message
00261             }
00262             break;
00263         }
00264     }
00265
00266     return CListCtrl::OnNotify(wParam, lParam, pResult);
00267 }

void CCJListCtrl::OnPaint ( ) [protected]

Definition at line 515 of file CJListCtrl.cpp.

00516 {
00517     CPaintDC dc(this); // device context for painting
00518
00519     // KStowell - Get the client rect.
00520     CRect rcClient, rcClip;
00521     dc.GetClipBox( &rcClip );
00522     GetClientRect( &rcClient );
00523
00524     // Exclude the header control from being painted over.
00525     CWnd* pWnd = GetDlgItem(0);
00526     if(pWnd && pWnd->IsWindowVisible()) {
00527         CRect rcItem;
00528         pWnd->GetClientRect(&rcItem);
00529         dc.ExcludeClipRect(&rcItem);
00530     }
00531
00532     // KStowell - Create a memory device-context. This is done to help reduce
00533     // screen flicker, since we will paint the entire control to the
00534     // off screen device context first.
00535     CDC memDC;
00536     CBitmap bitmap;
00537     memDC.CreateCompatibleDC(&dc);
00538     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00539     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00540
00541     // KStowell - Repaint the background.
00542     memDC.FillSolidRect( rcClient, ::GetSysColor(COLOR_WINDOW) );
00543
00544     // let the control do its default drawing.
00545     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00546
00547     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00548     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00549         rcClip.left, rcClip.top, SRCCOPY );
00550
00551     // KStowell - Cleanup resources.
00552     memDC.SelectObject(pOldBitmap);
00553     memDC.DeleteDC();
00554     bitmap.DeleteObject();
00555 }

void CCJListCtrl::SaveColumnWidths ( ) [virtual]

Definition at line 422 of file CJListCtrl.cpp.

Referenced by OnDestroy().

00423 {
00424     // get a pointer to the header control.
00425     CHeaderCtrl* pHeader = DYNAMIC_DOWNCAST(CHeaderCtrl, GetDlgItem(0));
00426     ASSERT_KINDOF( CHeaderCtrl, pHeader );
00427
00428     CString strValue;
00429     for( int i = 0; i < pHeader->GetItemCount(); ++i )
00430     {
00431         CString strTemp;
00432         strTemp.Format(_T("%d,"), GetColumnWidth( i ));
00433         strValue += strTemp;
00434     }
00435
00436     AfxGetApp()->WriteProfileString( m_strSection, m_strEntry, strValue );
00437 }

void CCJListCtrl::SetColumnWidth ( int nCol ) [virtual]

Definition at line 449 of file CJListCtrl.cpp.

Referenced by LoadColumnWidths().

00450 {
00451     int nWidth = GetStoredWidth( nCol );
00452     if( nWidth > m_nMinColWidth )
00453         CListCtrl::SetColumnWidth( nCol, nWidth );
00454     else
00455         AutoSizeColumn( nCol );
00456 }

_CJXLIB_INLINE void CCJListCtrl::SetExtendedStyle ( DWORD dwExStyle ) [virtual]

Definition at line 267 of file CJListCtrl.h.

00268     { ASSERT(::IsWindow(m_hWnd)); SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, GetExtendedStyle()|dwExStyle); }

_CJXLIB_INLINE void CCJListCtrl::SetMinimumColSize ( int nSize ) [virtual]

Definition at line 273 of file CJListCtrl.h.

00274     { m_nMinSize = nSize; }

_CJXLIB_INLINE void CCJListCtrl::SetRowColors | ( | COLORREF | clrText,
 |  | COLORREF | clrTextBk
 | ) | [virtual]

Definition at line 270 of file CJListCtrl.h.

00271     { m_clrText = clrText; m_clrTextBk = clrTextBk; }

bool CCJListCtrl::SortList | ( | int | nCol,
 |  | bool | bAscending
 | ) | [virtual]

Definition at line 269 of file CJListCtrl.cpp.

Referenced by OnNotify().

00270 {
00271 #ifdef _DEBUG
00272     TRACE2("Column sort on column index %d, ascending=%d", nCol, bAscending);
00273 #else
00274     UNUSED_ALWAYS( nCol );
00275     UNUSED_ALWAYS( bAscending );
00276 #endif
00277
00278     return true;
00279 }

bool CCJListCtrl::SubclassHeader ( bool bBoldFont = false ) [virtual]

Definition at line 384 of file CJListCtrl.cpp.

00385 {
00386     // allocate memory for the flat header.
00387     m_pHeaderCtrl = new CCJFlatHeaderCtrl;
00388     ASSERT( m_pHeaderCtrl );
00389
00390     // get the window handle to the existing header
00391     // control.
00392     HWND hWnd = GetDlgItem(0)->GetSafeHwnd();
00393     ASSERT( hWnd );
00394
00395     // subclass the flat header control.
00396     if( !m_pHeaderCtrl->SubclassWindow( hWnd ))
00397         return false;
00398
00399     // finish header initialization.
00400     m_pHeaderCtrl->InitializeHeader( bBoldFont );
00401
00402     return true;
00403 }

Member Data Documentation

bool CCJListCtrl::m_bAscending [protected]

Definition at line 112 of file CJListCtrl.h.

bool CCJListCtrl::m_bAutoSave [private]

Definition at line 116 of file CJListCtrl.h.

bool CCJListCtrl::m_bNoColSizing [protected]

Definition at line 110 of file CJListCtrl.h.

COLORREF CCJListCtrl::m_clrText [protected]

Definition at line 108 of file CJListCtrl.h.

COLORREF CCJListCtrl::m_clrTextBk [protected]

Definition at line 109 of file CJListCtrl.h.

int CCJListCtrl::m_nMaxColWidth [protected]

Definition at line 101 of file CJListCtrl.h.

int CCJListCtrl::m_nMinColWidth [protected]

Definition at line 100 of file CJListCtrl.h.

int CCJListCtrl::m_nMinSize [protected]

Definition at line 111 of file CJListCtrl.h.

int CCJListCtrl::m_nSortedCol [protected]

Definition at line 102 of file CJListCtrl.h.

CCJFlatHeaderCtrl* CCJListCtrl::m_pHeaderCtrl [protected]

Definition at line 103 of file CJListCtrl.h.

CListCtrl* CCJListCtrl::m_pListCtrl [protected]

Definition at line 107 of file CJListCtrl.h.

CString CCJListCtrl::m_strDefault [protected]

Definition at line 106 of file CJListCtrl.h.

CString CCJListCtrl::m_strEntry [protected]

Definition at line 105 of file CJListCtrl.h.

CString CCJListCtrl::m_strSection [protected]

Definition at line 104 of file CJListCtrl.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJListCtrl.h
  • WinCvs/CJLib/CJLibrary/CJListCtrl.cpp
Generated on Sun Oct 21 12:46:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJListView Class Reference

#include <CJListView.h>

Inheritance diagram for CCJListView:

[legend]
Collaboration diagram for CCJListView:

[legend]
List of all members.

Public Methods

CCJListView ()
virtual | ~CCJListView ()
virtual int | GetStoredWidth (int nCol)
virtual void | AutoSizeColumn (int nCol=-1)
virtual void | SetColumnWidth (int nCol)
virtual void | LoadColumnWidths ()
virtual void | SaveColumnWidths ()
virtual void | AutoSaveColumns (LPCTSTR lpszSection=NULL, LPCTSTR lpszEntry=NULL, LPCTSTR lpszDefault=NULL)
virtual bool | SubclassHeader (bool bBoldFont=false)
virtual bool | SortList (int nCol, bool bAscending)
virtual void | SetExtendedStyle (DWORD dwExStyle)
virtual DWORD | GetExtendedStyle ()
virtual void | DisableColumnSizing (bool bDisable)
virtual void | SetMinimumColSize (int nSize)
virtual int | HitTestEx (CPoint &point, int *col) const
virtual int | AddColumn (LPCTSTR lpszColHeading, int nWidth=-1, int nFormat=LVCFMT_LEFT)
virtual bool | BuildColumns (int nCols, int *nWidth, CString *strColString)
virtual bool | BuildColumns (int nCols, int *nWidth, int *nColString)
virtual void | SetRowColors (COLORREF clrText, COLORREF clrTextBk)
virtual int | GetColumnCount () const
virtual bool | CopyRow (int nFrom, int nTo)
virtual bool | MoveRow (int nFrom, int nTo)
virtual void | OnInitialUpdate ()

Protected Methods

virtual void | OnDraw (CDC *pDC)
virtual BOOL | OnNotify (WPARAM wParam, LPARAM lParam, LRESULT *pResult)
afx_msg void | OnCustomDraw (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnDestroy ()
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)

Protected Attributes

int | m_nMinColWidth
int | m_nMaxColWidth
int | m_nSortedCol
CCJFlatHeaderCtrl * m_pHeaderCtrl
CString | m_strSection
CString | m_strEntry
CString | m_strDefault
CListCtrl * m_pListCtrl
COLORREF | m_clrText
COLORREF | m_clrTextBk
bool | m_bNoColSizing
int | m_nMinSize

Private Attributes

bool | m_bAutoSave
bool | m_bAscending

Constructor & Destructor Documentation

CCJListView::CCJListView ( )

Definition at line 84 of file CJListView.cpp.

00085 {
00086     m_nMinSize      = 0;
00087     m_nMinColWidth  = 50;
00088     m_nMaxColWidth  = 500;
00089     m_nSortedCol    = -1;
00090     m_bAscending    = true;
00091     m_bAutoSave     = false;
00092     m_bNoColSizing  = false;
00093     m_pHeaderCtrl   = NULL;
00094     m_pListCtrl     = NULL;
00095     m_clrText       = ::GetSysColor(COLOR_WINDOWTEXT);
00096     m_clrTextBk     = ::GetSysColor(COLOR_WINDOW);
00097 }

CCJListView::~CCJListView ( ) [virtual]

Definition at line 99 of file CJListView.cpp.

00100 {
00101     _delete( m_pHeaderCtrl );
00102 }

Member Function Documentation

int CCJListView::AddColumn | ( | LPCTSTR | lpszColHeading,
 |  | int | nWidth = -1,
 |  | int | nFormat = LVCFMT_LEFT
 | ) | [virtual]

Definition at line 317 of file CJListView.cpp.

Referenced by BuildColumns().

00318 {
00319     CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
00320     int nColumnCount = pHeader->GetItemCount();
00321
00322     if( nWidth == -1 )
00323     {
00324         // The line below return zero for ICON views
00325         //nWidth = GetColumnWidth( nColumnCount - 1 );
00326
00327         // Get the column width of the previous column from header control
00328         HD_ITEM hd_item;
00329         hd_item.mask = HDI_WIDTH;               //indicate that we want the width
00330         pHeader->GetItem( nColumnCount - 1, &hd_item );
00331         nWidth = hd_item.cxy;
00332     }
00333     return m_pListCtrl->InsertColumn( nColumnCount, lpszColHeading, nFormat, nWidth, nColumnCount );
00334 }

void CCJListView::AutoSaveColumns | ( | LPCTSTR | lpszSection = NULL,
 |  | LPCTSTR | lpszEntry = NULL,
 |  | LPCTSTR | lpszDefault = NULL
 | ) | [virtual]

Definition at line 431 of file CJListView.cpp.

00432 {
00433     m_bAutoSave = true;
00434
00435     // initialize registry strings.
00436     if( lpszSection == NULL ) m_strSection = _T("Settings");
00437     else m_strSection = lpszSection;
00438
00439     if( lpszEntry == NULL ) m_strEntry = _T("Column Info");
00440     else m_strEntry = lpszEntry;
00441
00442     if( lpszDefault == NULL ) m_strDefault = _T("");
00443     else m_strDefault = lpszDefault;
00444
00445     LoadColumnWidths();
00446 }

void CCJListView::AutoSizeColumn ( int nCol = -1 ) [virtual]

Definition at line 507 of file CJListView.cpp.

Referenced by SetColumnWidth().

00508 {
00509     // Call this after your list control is filled
00510     SetRedraw( false );
00511
00512     int nMinCol = nCol < 0 ? 0 : nCol;
00513     int nMaxCol = nCol < 0 ? GetColumnCount()-1 : nCol;
00514
00515     for (nCol = nMinCol; nCol <= nMaxCol; nCol++)
00516     {
00517         m_pListCtrl->SetColumnWidth( nCol, LVSCW_AUTOSIZE );
00518         int wc1 = m_pListCtrl->GetColumnWidth( nCol );
00519
00520         m_pListCtrl->SetColumnWidth( nCol, LVSCW_AUTOSIZE_USEHEADER );
00521         int wc2 = m_pListCtrl->GetColumnWidth( nCol );
00522         int wc = max( m_nMinColWidth, max( wc1, wc2 ));
00523
00524         if( wc > m_nMaxColWidth )
00525             wc = m_nMaxColWidth;
00526
00527         // set the column width.
00528         m_pListCtrl->SetColumnWidth( nCol,wc );
00529     }
00530
00531     SetRedraw();
00532 }

bool CCJListView::BuildColumns | ( | int | nCols,
 |  | int * | nWidth,
 |  | int * | nColString
 | ) | [virtual]

Definition at line 336 of file CJListView.cpp.

00337 {
00338     for( int i = 0; i < nCols; ++i ) {
00339         CString strTemp; strTemp.LoadString( nColString[i] );
00340         if(AddColumn(strTemp, nWidth[i])==-1)
00341             return false;
00342     }
00343
00344     return true;
00345 }

bool CCJListView::BuildColumns | ( | int | nCols,
 |  | int * | nWidth,
 |  | CString * | strColString
 | ) | [virtual]

Definition at line 347 of file CJListView.cpp.

00348 {
00349     for( int i = 0; i < nCols; ++i ) {
00350         if(AddColumn(strColString[i], nWidth[i])==-1)
00351             return false;
00352     }
00353
00354     return true;
00355 }

bool CCJListView::CopyRow | ( | int | nFrom,
 |  | int | nTo
 | ) | [virtual]

Definition at line 174 of file CJListView.cpp.

Referenced by MoveRow().

00175 {
00176     //Can't move to the same place, or from or to a negative index
00177     if(nFrom == nTo || nFrom < 0 || nTo < 0)
00178         return false;
00179
00180     //Copy the row to the new index
00181     m_pListCtrl->InsertItem(nTo, m_pListCtrl->GetItemText(nFrom, 0));
00182
00183     //If row has been inserted before original
00184     //increment the original
00185     if(nFrom > nTo)
00186         nFrom++;
00187
00188     //Loop through subitems
00189     for(int i = 1; i < GetColumnCount(); i++)
00190     {
00191         m_pListCtrl->SetItemText(nTo, i, m_pListCtrl->GetItemText(nFrom, i));
00192     }
00193
00194     return true;
00195 }

_CJXLIB_INLINE void CCJListView::DisableColumnSizing ( bool bDisable ) [virtual]

Definition at line 283 of file CJListView.h.

00284     { m_bNoColSizing = bDisable; }

int CCJListView::GetColumnCount ( ) const [virtual]

Definition at line 199 of file CJListView.cpp.

Referenced by AutoSizeColumn(), and CopyRow().

00200 {
00201     CHeaderCtrl* pHeader = (CHeaderCtrl*)m_pListCtrl->GetDlgItem(0);
00202     return pHeader->GetItemCount();
00203 }

_CJXLIB_INLINE DWORD CCJListView::GetExtendedStyle ( ) [virtual]

Definition at line 271 of file CJListView.h.

Referenced by SetExtendedStyle().

00272     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); }

int CCJListView::GetStoredWidth ( int nCol ) [virtual]

Definition at line 484 of file CJListView.cpp.

Referenced by SetColumnWidth().

00485 {
00486     // get the value from the registry.
00487     CString strValue = AfxGetApp()->GetProfileString(
00488         m_strSection, m_strEntry, m_strDefault );
00489
00490     // extract the sub string to get the column width.
00491     CString strSubString;
00492     AfxExtractSubString( strSubString, strValue, nCol, _T(','));
00493
00494     // return the width from the registry.
00495     return _ttoi( strSubString );
00496 }

int CCJListView::HitTestEx | ( | CPoint & | point,
 |  | int * | nCol
 | ) | const [virtual]

Definition at line 364 of file CJListView.cpp.

00365 {
00366     int colnum = 0;
00367     int row = m_pListCtrl->HitTest( point, NULL );
00368
00369     if( nCol ) *nCol = 0;
00370
00371     // Make sure that the ListView is in LVS_REPORT
00372     if( (GetWindowLong(m_hWnd, GWL_STYLE) & LVS_TYPEMASK) != LVS_REPORT )
00373         return row;
00374
00375     // Get the top and bottom row visible
00376     row = m_pListCtrl->GetTopIndex();
00377     int bottom = row + m_pListCtrl->GetCountPerPage();
00378     if( bottom > m_pListCtrl->GetItemCount() )
00379         bottom = m_pListCtrl->GetItemCount();
00380
00381     // Get the number of columns
00382     CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
00383     int nColumnCount = pHeader->GetItemCount();
00384
00385     // Loop through the visible rows
00386     for( ;row <= bottom;row++)
00387     {
00388         // Get bounding rect of item and check whether point falls in it.
00389         CRect rect;
00390         m_pListCtrl->GetItemRect( row, &rect, LVIR_BOUNDS );
00391         if( rect.PtInRect(point) )
00392         {
00393             // Now find the column
00394             for( colnum = 0; colnum < nColumnCount; colnum++ )
00395             {
00396                 int colwidth = m_pListCtrl->GetColumnWidth(colnum);
00397                 if( point.x >= rect.left
00398                     && point.x <= (rect.left + colwidth ) )
00399                 {
00400                     if( nCol ) *nCol = colnum;
00401                     return row;
00402                 }
00403                 rect.left += colwidth;
00404             }
00405         }
00406     }
00407     return -1;
00408 }

void CCJListView::LoadColumnWidths ( ) [virtual]

Definition at line 465 of file CJListView.cpp.

Referenced by AutoSaveColumns().

00466 {
00467     // get a pointer to the header control.
00468     CHeaderCtrl* pHeader = DYNAMIC_DOWNCAST(CHeaderCtrl, GetDlgItem(0));
00469     ASSERT_KINDOF( CHeaderCtrl, pHeader );
00470
00471     for( int i = 0; i < pHeader->GetItemCount(); ++i )
00472         SetColumnWidth(i);
00473 }

bool CCJListView::MoveRow | ( | int | nFrom,
 |  | int | nTo
 | ) | [virtual]

Definition at line 149 of file CJListView.cpp.

00150 {
00151     //Can't move to the same place, or from or to a negative index
00152     if(nFrom == nTo || nFrom < 0 || nTo < 0)
00153         return false;
00154
00155     //First Copy the row to the new location
00156     if(CopyRow(nFrom, nTo))
00157     {
00158         //If we have just inserted a row before
00159         //this one in the list, we need to increment
00160         //our index.
00161         if(nFrom > nTo)
00162             m_pListCtrl->DeleteItem(nFrom + 1);
00163         else
00164             m_pListCtrl->DeleteItem(nFrom);
00165
00166         return true;
00167     }
00168     else
00169         return false;
00170 }

void CCJListView::OnCustomDraw | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 207 of file CJListView.cpp.

00208 {
00209     LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
00210
00211     switch(lplvcd->nmcd.dwDrawStage)
00212     {
00213     case CDDS_PREPAINT:
00214         // Request prepaint notifications for each item.
00215         *pResult = CDRF_NOTIFYITEMDRAW;
00216         break;
00217
00218     case CDDS_ITEMPREPAINT: // Requested notification
00219         if(lplvcd->nmcd.dwItemSpec % 2)
00220         {
00221             lplvcd->clrText   = m_clrText;
00222             lplvcd->clrTextBk = m_clrTextBk;
00223         }
00224         *pResult = CDRF_DODEFAULT;
00225         break;
00226     }
00227 }

void CCJListView::OnDestroy ( void ) [protected]

Definition at line 498 of file CJListView.cpp.

00499 {
00500     if( m_bAutoSave ) SaveColumnWidths();
00501     CListView::OnDestroy();
00502 }

void CCJListView::OnDraw ( CDC * pDC ) [protected, virtual]

Definition at line 116 of file CJListView.cpp.

00117 {
00118     UNUSED_ALWAYS( pDC );
00119 }

BOOL CCJListView::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 534 of file CJListView.cpp.

00535 {
00536     CRect rectClient;
00537     GetClientRect( &rectClient );
00538     pDC->ExcludeClipRect( &rectClient );
00539     return CListView::OnEraseBkgnd(pDC);
00540 }

void CCJListView::OnInitialUpdate ( ) [virtual]

Definition at line 139 of file CJListView.cpp.

00140 {
00141     CListView::OnInitialUpdate();
00142
00143     // Set a pointer to the list control.
00144     m_pListCtrl = &GetListCtrl();
00145 }

BOOL CCJListView::OnNotify | ( | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | LRESULT * | pResult
 | ) | [protected, virtual]

Definition at line 229 of file CJListView.cpp.

00230 {
00231     HD_NOTIFY *pHDNotify = (HD_NOTIFY*)lParam;
00232
00233     switch( pHDNotify->hdr.code )
00234     {
00235     // Sorting the list when user clicks on column header by Zafir Anjum.
00236     // http://www.codeguru.com/listview/sort_on_col_click.shtml
00237     case HDN_ITEMCLICKA:
00238     case HDN_ITEMCLICKW:
00239         {
00240             if( pHDNotify->iButton == 0 )
00241             {
00242                 // set the sort order.
00243                 if( pHDNotify->iItem == m_nSortedCol )
00244                     m_bAscending = !m_bAscending;
00245                 else
00246                     m_bAscending = true;
00247
00248                 // save the column index.
00249                 m_nSortedCol = pHDNotify->iItem;
00250
00251                 // virtual call to sort list.
00252                 SortList( m_nSortedCol, m_bAscending );
00253
00254                 // set the sort image in the header control.
00255                 if( m_pHeaderCtrl && m_pHeaderCtrl->GetSafeHwnd( ))
00256                     m_pHeaderCtrl->SetSortImage( m_nSortedCol, m_bAscending );
00257             }
00258         }
00259         break;
00260
00261     // How to force a minimum column width Cees Mechielsen.
00262     // http://www.codeguru.com/mfc/comments/866.shtml
00263     case HDN_ITEMCHANGINGA:
00264     case HDN_ITEMCHANGINGW:
00265     case HDN_ENDTRACK:
00266         {
00267             if( pHDNotify->pitem->mask & HDI_WIDTH &&
00268                 pHDNotify->pitem->cxy < m_nMinSize &&
00269                 pHDNotify->pitem->cxy >= 0 )
00270             {
00271                 pHDNotify->pitem->cxy = m_nMinSize; // Set the column width
00272             }
00273         }
00274         break;
00275
00276     // Prevent CListCtrl column resizing by Zafir Anjum.
00277     // http://www.codeguru.com/listview/no_col_resize.shtml
00278     case HDN_DIVIDERDBLCLICKA:
00279     case HDN_DIVIDERDBLCLICKW:
00280     case HDN_BEGINTRACKW:
00281     case HDN_BEGINTRACKA:
00282         {
00283             if(m_bNoColSizing)
00284             {
00285                 *pResult = TRUE;                // disable tracking
00286                 return TRUE;                    // Processed message
00287             }
00288             break;
00289         }
00290     }
00291
00292     return CListView::OnNotify(wParam, lParam, pResult);
00293 }

void CCJListView::SaveColumnWidths ( ) [virtual]

Definition at line 448 of file CJListView.cpp.

Referenced by OnDestroy().

00449 {
00450     // get a pointer to the header control.
00451     CHeaderCtrl* pHeader = DYNAMIC_DOWNCAST(CHeaderCtrl, GetDlgItem(0));
00452     ASSERT_KINDOF( CHeaderCtrl, pHeader );
00453
00454     CString strValue;
00455     for( int i = 0; i < pHeader->GetItemCount(); ++i )
00456     {
00457         CString strTemp;
00458         strTemp.Format(_T("%d,"), m_pListCtrl->GetColumnWidth( i ));
00459         strValue += strTemp;
00460     }
00461
00462     AfxGetApp()->WriteProfileString( m_strSection, m_strEntry, strValue );
00463 }

void CCJListView::SetColumnWidth ( int nCol ) [virtual]

Definition at line 475 of file CJListView.cpp.

Referenced by LoadColumnWidths().

00476 {
00477     int nWidth = GetStoredWidth( nCol );
00478     if( nWidth > m_nMinColWidth )
00479         m_pListCtrl->SetColumnWidth( nCol, nWidth );
00480     else
00481         AutoSizeColumn( nCol );
00482 }

_CJXLIB_INLINE void CCJListView::SetExtendedStyle ( DWORD dwExStyle ) [virtual]

Definition at line 274 of file CJListView.h.

00275     { ASSERT(::IsWindow(m_hWnd)); SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, GetExtendedStyle()|dwExStyle); }

_CJXLIB_INLINE void CCJListView::SetMinimumColSize ( int nSize ) [virtual]

Definition at line 280 of file CJListView.h.

00281     { m_nMinSize = nSize; }

_CJXLIB_INLINE void CCJListView::SetRowColors | ( | COLORREF | clrText,
 |  | COLORREF | clrTextBk
 | ) | [virtual]

Definition at line 277 of file CJListView.h.

00278     { m_clrText = clrText; m_clrTextBk = clrTextBk; }

bool CCJListView::SortList | ( | int | nCol,
 |  | bool | bAscending
 | ) | [virtual]

Definition at line 295 of file CJListView.cpp.

Referenced by OnNotify().

00296 {
00297 #ifdef _DEBUG
00298     TRACE2("Column sort on column index %d, ascending=%d", nCol, bAscending);
00299 #else
00300     UNUSED_ALWAYS( nCol );
00301     UNUSED_ALWAYS( bAscending );
00302 #endif
00303
00304     return true;
00305 }

bool CCJListView::SubclassHeader ( bool bBoldFont = false ) [virtual]

Definition at line 410 of file CJListView.cpp.

00411 {
00412     // allocate memory for the flat header.
00413     m_pHeaderCtrl = new CCJFlatHeaderCtrl;
00414     ASSERT( m_pHeaderCtrl );
00415
00416     // get the window handle to the existing header
00417     // control.
00418     HWND hWnd = GetDlgItem(0)->GetSafeHwnd();
00419     ASSERT( hWnd );
00420
00421     // subclass the flat header control.
00422     if( !m_pHeaderCtrl->SubclassWindow( hWnd ))
00423         return false;
00424
00425     // finish header initialization.
00426     m_pHeaderCtrl->InitializeHeader( bBoldFont );
00427
00428     return true;
00429 }

Member Data Documentation

bool CCJListView::m_bAscending [private]

Definition at line 115 of file CJListView.h.

bool CCJListView::m_bAutoSave [private]

Definition at line 114 of file CJListView.h.

bool CCJListView::m_bNoColSizing [protected]

Definition at line 109 of file CJListView.h.

COLORREF CCJListView::m_clrText [protected]

Definition at line 107 of file CJListView.h.

COLORREF CCJListView::m_clrTextBk [protected]

Definition at line 108 of file CJListView.h.

int CCJListView::m_nMaxColWidth [protected]

Definition at line 100 of file CJListView.h.

int CCJListView::m_nMinColWidth [protected]

Definition at line 99 of file CJListView.h.

int CCJListView::m_nMinSize [protected]

Definition at line 110 of file CJListView.h.

int CCJListView::m_nSortedCol [protected]

Definition at line 101 of file CJListView.h.

CCJFlatHeaderCtrl* CCJListView::m_pHeaderCtrl [protected]

Definition at line 102 of file CJListView.h.

CListCtrl* CCJListView::m_pListCtrl [protected]

Definition at line 106 of file CJListView.h.

CString CCJListView::m_strDefault [protected]

Definition at line 105 of file CJListView.h.

CString CCJListView::m_strEntry [protected]

Definition at line 104 of file CJListView.h.

CString CCJListView::m_strSection [protected]

Definition at line 103 of file CJListView.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJListView.h
  • WinCvs/CJLib/CJLibrary/CJListView.cpp
Generated on Sun Oct 21 12:46:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJLogoPane Class Reference

#include <CJLogoPane.h>

Inheritance diagram for CCJLogoPane:

[legend]
Collaboration diagram for CCJLogoPane:

[legend]
List of all members.

Public Methods

CCJLogoPane ()
virtual void | SetLogoText (LPCTSTR lpszLogoText)
virtual CString | GetLogoText ()
virtual void | SetLogoFont (LPCTSTR lpszFontName, int nHeight=24, int nWeight=FW_BOLD, BOOL bItalic=TRUE, BOOL bUnderline=FALSE)
virtual BOOL | Create (LPCTSTR lpszWindowName, DWORD dwStyle, CWnd *pParentWnd, UINT nID)
virtual | ~CCJLogoPane ()

Public Attributes

CString | m_strLogoText
CFont | m_Font

Protected Methods

afx_msg void | OnPaint ()

Constructor & Destructor Documentation

CCJLogoPane::CCJLogoPane ( )

Definition at line 33 of file CJLogoPane.cpp.

00034 {
00035     SetLogoFont(_T("Arial"));
00036 }

CCJLogoPane::~CCJLogoPane ( ) [virtual]

Definition at line 38 of file CJLogoPane.cpp.

00039 {
00040     m_Font.DeleteObject();
00041 }

Member Function Documentation

BOOL CCJLogoPane::Create | ( | LPCTSTR | lpszWindowName,
 |  | DWORD | dwStyle,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID
 | ) | [virtual]

Definition at line 93 of file CJLogoPane.cpp.

00094 {
00095     CString wndClass = ::AfxRegisterWndClass(CS_BYTEALIGNCLIENT);
00096
00097     if(!CWnd::Create(wndClass, lpszWindowName, dwStyle, CRect(0,0,0,0), pParentWnd, nID)) {
00098         return FALSE;
00099     }
00100
00101     m_strLogoText = lpszWindowName;
00102     return TRUE;
00103 }

_CJXLIB_INLINE CString CCJLogoPane::GetLogoText ( ) [virtual]

Definition at line 76 of file CJLogoPane.h.

00077     { return m_strLogoText; }

void CCJLogoPane::OnPaint ( ) [protected]

Definition at line 64 of file CJLogoPane.cpp.

00065 {
00066     CPaintDC dc(this); // device context for painting
00067
00068     CRect rect;
00069     GetWindowRect(rect);
00070
00071     dc.SetBkMode(TRANSPARENT);
00072
00073     CFont * OldFont = dc.SelectObject(&m_Font);
00074
00075     // draw text in DC
00076     COLORREF OldColor = dc.SetTextColor(::GetSysColor( COLOR_3DHILIGHT));
00077
00078     rect.right  = rect.Width();
00079     rect.bottom = rect.Height();
00080     rect.left   = rect.top = 0;
00081     dc.FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE));
00082
00083     dc.DrawText( m_strLogoText, rect + CPoint(1,1), DT_SINGLELINE | DT_LEFT | DT_VCENTER);
00084     dc.SetTextColor( ::GetSysColor( COLOR_3DSHADOW));
00085     dc.DrawText( m_strLogoText, rect, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
00086
00087     // restore old text color
00088     dc.SetTextColor( OldColor);
00089     // restore old font
00090     dc.SelectObject(OldFont);
00091 }

void CCJLogoPane::SetLogoFont | ( | LPCTSTR | lpszFontName,
 |  | int | nHeight = 24,
 |  | int | nWeight = FW_BOLD,
 |  | BOOL | bItalic = TRUE,
 |  | BOOL | bUnderline = FALSE
 | ) | [virtual]

Definition at line 54 of file CJLogoPane.cpp.

Referenced by CCJLogoPane().

00056 {
00057     if(m_Font.m_hObject) {
00058         m_Font.DeleteObject();
00059     }
00060
00061     m_Font.CreateFont(nHeight, 0, 0, 0, nWeight, (BYTE)bItalic, (BYTE)bUnderline, 0,0,0,0,0,0, lpszFontName);
00062 }

_CJXLIB_INLINE void CCJLogoPane::SetLogoText ( LPCTSTR lpszLogoText ) [virtual]

Definition at line 73 of file CJLogoPane.h.

00074     { m_strLogoText = lpszLogoText; }

Member Data Documentation

CFont CCJLogoPane::m_Font

Definition at line 42 of file CJLogoPane.h.

CString CCJLogoPane::m_strLogoText

Definition at line 41 of file CJLogoPane.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJLogoPane.h
  • WinCvs/CJLib/CJLibrary/CJLogoPane.cpp
Generated on Sun Oct 21 12:46:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJMaskEdit Class Reference

#include <CJMaskEdit.h>

Inheritance diagram for CCJMaskEdit:

[legend]
Collaboration diagram for CCJMaskEdit:

[legend]
List of all members.

Public Methods

CCJMaskEdit ()
virtual void | SetEditMask (LPCTSTR lpszMask, LPCTSTR lpszLiteral, LPCTSTR lpszWindowText)
virtual void | SendChar (UINT nChar)
virtual bool | CheckChar (UINT nChar)
virtual bool | ProcessMask (UINT nChar, int nEndPos)
virtual void | UpdateFont ()
virtual | ~CCJMaskEdit ()

Public Attributes

bool | m_bUseMask
bool | m_bMaskKeyInProgress
CString | m_strWindowText
CString | m_strMask
CString | m_strLiteral
CString | m_strValid
CString | m_strMaskLiteral
CFont | m_Font

Protected Methods

afx_msg void | OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg void | OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnPaint ()

Constructor & Destructor Documentation

CCJMaskEdit::CCJMaskEdit ( )

Definition at line 84 of file CJMaskEdit.cpp.

00085 {
00086     m_bUseMask              = true;
00087     m_bMaskKeyInProgress    = false;
00088     m_strWindowText         = _T("");
00089     m_strMask               = _T("");
00090     m_strLiteral            = _T("");
00091     m_strValid              = _T("");
00092     m_strMaskLiteral        = _T("");
00093 }

CCJMaskEdit::~CCJMaskEdit ( ) [virtual]

Definition at line 95 of file CJMaskEdit.cpp.

00096 {
00097     // fix potential resource leak - KStowell - 10-22-99.
00098     m_Font.DeleteObject();
00099 }

Member Function Documentation

bool CCJMaskEdit::CheckChar ( UINT nChar ) [virtual]

Definition at line 205 of file CJMaskEdit.cpp.

Referenced by OnChar().

00206 {
00207     // do not use mask
00208     if( !m_bUseMask ) {
00209         return true;
00210     }
00211
00212     // control character, OK
00213     if( !isprint( nChar )) {
00214         return true;
00215     }
00216
00217     // unselect all selections, if any
00218     int nStartPos, nEndPos;
00219     GetSel( nStartPos, nEndPos );
00220     SetSel( -1, 0 );
00221
00222     // advance to the first character input position.
00223     for( nStartPos; nStartPos < m_strLiteral.GetLength(); ++nStartPos )
00224     {
00225         if( m_strLiteral.GetAt( nStartPos ) == '_' ) {
00226             SetSel( nStartPos, nStartPos );
00227             break;
00228         }
00229     }
00230
00231     // check the key against the mask
00232     GetSel( nStartPos, nEndPos );
00233
00234     // make sure the string is not longer than the mask
00235     if( nEndPos >= m_strMask.GetLength( )) {
00236         MessageBeep((UINT)-1);
00237         return false;
00238     }
00239
00240     // check to see if a literal is in this position
00241     UINT c = '_';
00242     if( !m_strLiteral.IsEmpty( )) {
00243         c = m_strLiteral.GetAt( nEndPos );
00244     }
00245
00246     if( c != '_' ) {
00247         SendChar( c );
00248         GetSel( nStartPos, nEndPos );
00249     }
00250
00251     // check the valid string character
00252     if( m_strValid.Find( static_cast<TCHAR>(nChar)) != -1 ) {
00253         return true;
00254     }
00255
00256     if( ProcessMask( nChar, nEndPos ))
00257         return true;
00258
00259     MessageBeep((UINT)-1);
00260     return false;
00261 }

void CCJMaskEdit::OnChar | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags
 | ) | [protected]

Definition at line 129 of file CJMaskEdit.cpp.

00130 {
00131     if( !m_bMaskKeyInProgress ) {
00132         if( !CheckChar( nChar )) {
00133             return;
00134         }
00135     }
00136
00137     if( m_bUseMask )
00138     {
00139         int nStartPos;
00140         int nEndPos;
00141         GetSel( nStartPos, nEndPos );
00142
00143         if( isprint( nChar ))
00144         {
00145             SetSel( nStartPos, nEndPos+1 );
00146
00147             Clear();
00148
00149             m_strWindowText.SetAt( nEndPos, static_cast<TCHAR>(nChar));
00150         }
00151         else if( nChar == VK_BACK )
00152         {
00153             if(( nStartPos == nEndPos ) &&
00154                ( nStartPos >= 1 ) &&
00155                ( nStartPos <= m_strWindowText.GetLength( )))
00156             {
00157                 UINT c = 0x20;
00158
00159                 // get the masked literal representation.
00160                 if( m_strMaskLiteral.IsEmpty() == FALSE )
00161                 {
00162                     c = m_strMaskLiteral[ nStartPos - 1 ];
00163                 }
00164
00165                 // backspace the cursor.
00166                 SendMessage( WM_KEYDOWN, VK_LEFT, 0 );
00167
00168                 if( m_strMaskLiteral.IsEmpty() == FALSE )
00169                 {
00170                     // update the char backspacing over.
00171                     SendChar( c );
00172
00173                     // backspace the cursor again.
00174                     SendMessage( WM_KEYDOWN, VK_LEFT, 0 );
00175                 }
00176             }
00177             else
00178             {
00179                 MessageBeep((UINT)-1);
00180             }
00181
00182             return;
00183         }
00184     }
00185
00186     CEdit::OnChar(nChar, nRepCnt, nFlags);
00187
00188     if( !m_bMaskKeyInProgress && m_bUseMask && !m_strLiteral.IsEmpty( ))
00189     {
00190         int nStartPos;
00191         int nEndPos;
00192         GetSel( nStartPos, nEndPos );
00193
00194         // make sure the string is not longer than the mask
00195         if( nEndPos < m_strLiteral.GetLength( ))
00196         {
00197             UINT c = m_strLiteral.GetAt( nEndPos );
00198             if (c != '_') {
00199                 SetSel( nEndPos+1, nEndPos+1 );
00200             }
00201         }
00202     }
00203 }

BOOL CCJMaskEdit::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 601 of file CJMaskEdit.cpp.

00602 {
00603     // KStowell - overridden for flicker-free drawing.
00604     UNUSED_ALWAYS(pDC);
00605     return TRUE;
00606 }

void CCJMaskEdit::OnKeyDown | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags
 | ) | [protected]

Definition at line 115 of file CJMaskEdit.cpp.

00116 {
00117     if( m_bUseMask )
00118     {
00119         switch( nChar )
00120         {
00121         case VK_DELETE:
00122         case VK_INSERT: return;
00123         }
00124     }
00125
00126     CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
00127 }

void CCJMaskEdit::OnPaint ( ) [protected]

Definition at line 608 of file CJMaskEdit.cpp.

00609 {
00610     // Use a "Offscreen" DC to fill rect and send to DefWindowProc...
00611     CClientDC memDC(this);
00612
00613     CRect rcClip;
00614     GetClientRect(&rcClip);
00615     memDC.FillSolidRect(rcClip, ::GetSysColor(COLOR_WINDOW));
00616     DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, (LPARAM)0 );
00617
00618     // Default is called for cleanup.
00619     Default();
00620 }

bool CCJMaskEdit::ProcessMask | ( | UINT | nChar,
 |  | int | nEndPos
 | ) | [virtual]

Reimplemented in CCJDateEdit, and CCJTimeEdit.

Definition at line 274 of file CJMaskEdit.cpp.

Referenced by CheckChar().

00275 {
00276     // check the key against the mask
00277     switch( m_strMask.GetAt( nEndPos ))
00278     {
00279     case '0':       // digit only //completely changed this
00280         {
00281             if( isdigit( nChar )) {
00282                 return true;
00283             }
00284             break;
00285         }
00286     case '9':       // digit or space
00287         {
00288             if( isdigit( nChar )) {
00289                 return true;
00290             }
00291             if( nChar == VK_SPACE ) {
00292                 return true;
00293             }
00294             break;
00295         }
00296     case '#':       // digit or space or '+' or '-'
00297         {
00298             if( isdigit( nChar )) {
00299                 return true;
00300             }
00301             if( nChar == VK_SPACE || nChar == VK_ADD || nChar == VK_SUBTRACT ) {
00302                 return true;
00303             }
00304             break;
00305         }
00306     case 'L':       // alpha only
00307         {
00308             if( isalpha( nChar )) {
00309                 return true;
00310             }
00311             break;
00312         }
00313     case '?':       // alpha or space
00314         {
00315             if( isalpha( nChar )) {
00316                 return true;
00317             }
00318             if( nChar == VK_SPACE ) {
00319                 return true;
00320             }
00321             break;
00322         }
00323     case 'A':       // alpha numeric only
00324         {
00325             if( isalnum( nChar )) {
00326                 return true;
00327             }
00328             break;
00329         }
00330     case 'a':       // alpha numeric or space
00331         {
00332             if( isalnum( nChar )) {
00333                 return true;
00334             }
00335             if( nChar == VK_SPACE ) {
00336                 return true;
00337             }
00338             break;
00339         }
00340     case '&':       // all print character only
00341         {
00342             if( isprint( nChar )) {
00343                 return true;
00344             }
00345             break;
00346         }
00347     case 'H':       // hex digit
00348         {
00349             if( isxdigit( nChar )) {
00350                 return true;
00351             }
00352             break;
00353         }
00354     case 'X':       // hex digit or space
00355         {
00356             if( isxdigit( nChar )) {
00357                 return true;
00358             }
00359             if( nChar == VK_SPACE ) {
00360                 return true;
00361             }
00362             break;
00363         }
00364     }
00365
00366     return false;
00367 }

void CCJMaskEdit::SendChar ( UINT nChar ) [virtual]

Definition at line 263 of file CJMaskEdit.cpp.

Referenced by CheckChar(), and OnChar().

00264 {
00265     m_bMaskKeyInProgress = true;
00266 #ifdef WIN32
00267     AfxCallWndProc(this, m_hWnd, WM_CHAR, nChar, 1);
00268 #else
00269     SendMessage(WM_CHAR, nChar, 1);
00270 #endif
00271     m_bMaskKeyInProgress = false;
00272 }

void CCJMaskEdit::SetEditMask | ( | LPCTSTR | lpszMask,
 |  | LPCTSTR | lpszLiteral,
 |  | LPCTSTR | lpszWindowText
 | ) | [virtual]

Definition at line 369 of file CJMaskEdit.cpp.

00370 {
00371     ASSERT(lpszMask);
00372     ASSERT(lpszLiteral);
00373     ASSERT(lpszWindowText);
00374
00375     // initialize the mask for the control.
00376     m_strMask        = lpszMask;
00377     m_strLiteral     = lpszLiteral;
00378     m_strWindowText  = lpszWindowText;
00379     m_strMaskLiteral = m_strWindowText;
00380
00381     // set the window text for the control.
00382     SetWindowText( lpszWindowText );
00383
00384     // initialize the font used by the control.
00385     UpdateFont();
00386 }

void CCJMaskEdit::UpdateFont ( ) [virtual]

Definition at line 591 of file CJMaskEdit.cpp.

Referenced by SetEditMask().

00592 {
00593     m_Font.DeleteObject();
00594     NONCLIENTMETRICS ncm;
00595     ncm.cbSize = sizeof(ncm);
00596     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00597     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00598     SetFont(&m_Font);
00599 }

Member Data Documentation

CFont CCJMaskEdit::m_Font

Definition at line 79 of file CJMaskEdit.h.

bool CCJMaskEdit::m_bMaskKeyInProgress

Definition at line 73 of file CJMaskEdit.h.

bool CCJMaskEdit::m_bUseMask

Definition at line 72 of file CJMaskEdit.h.

CString CCJMaskEdit::m_strLiteral

Definition at line 76 of file CJMaskEdit.h.

CString CCJMaskEdit::m_strMask

Definition at line 75 of file CJMaskEdit.h.

CString CCJMaskEdit::m_strMaskLiteral

Definition at line 78 of file CJMaskEdit.h.

CString CCJMaskEdit::m_strValid

Definition at line 77 of file CJMaskEdit.h.

CString CCJMaskEdit::m_strWindowText

Definition at line 74 of file CJMaskEdit.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMaskEdit.h
  • WinCvs/CJLib/CJLibrary/CJMaskEdit.cpp
Generated on Sun Oct 21 12:46:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJMDIChildWnd Class Reference

#include <CJMDIChildWnd.h>

Inheritance diagram for CCJMDIChildWnd:

[legend]
Collaboration diagram for CCJMDIChildWnd:

[legend]
List of all members.

Public Methods

CCJMDIChildWnd ()
virtual | ~CCJMDIChildWnd ()
virtual HMENU | GetInitializedMenu (UINT nMenuID, UINT nToolBarID)
virtual HMENU | GetInitializedMenu (UINT nMenuID, UINT *nToolbarIDs, int nSize)
virtual UINT | GetMenuID ()
virtual UINT | GetToolBarID ()
virtual UINT * | GetToolBarIDs (int &nCount)
virtual void | SetResourceIDs (UINT nMenuID, UINT nToolBarID)
virtual void | SetResourceIDs (UINT nMenuID, UINT *nToolBarIDs, int nCount)
virtual void | RecalcLayout (BOOL bNotify=TRUE)

Protected Types

enum DockFlatBorders {
brdrAllRaised = 0x0000, brdrFlatTop = 0x0001, brdrFlatBottom = 0x0002, brdrFlatLeft = 0x0004,
brdrFlatRight = 0x0008, brdrFlatVertical = 0x0003, brdrFlatHorizontal = 0x000C, brdrFlatAll = 0x000F
}

Protected Methods

virtual void | RecalcAllExcept (CCJSizeDockBar *pBar)
virtual void | EnableDocking (DWORD dwDockStyle)
virtual void | EnableDockingSizeBar (DWORD dwDockStyle, DockFlatBorders FlatFlags=brdrAllRaised)
virtual void | DockSizeBar (CControlBar *pBar, CCJSizeDockBar *pDockBar=NULL, LPRECT lpRect=NULL)
virtual void | DockControlBarLeftOf (CControlBar *Bar, CControlBar *LeftOf)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)

Protected Attributes

HMENU | m_hMenu
UINT | m_nMenuID
UINT | m_nToolBarID
UINT * | m_nToolBarIDs
int | m_nCount

Static Protected Attributes

DWORD | dwDockBarMap [4][2]

Member Enumeration Documentation

enum CCJMDIChildWnd::DockFlatBorders [protected]

Enumeration values:
brdrAllRaised
brdrFlatTop
brdrFlatBottom
brdrFlatLeft
brdrFlatRight
brdrFlatVertical
brdrFlatHorizontal
brdrFlatAll

Definition at line 112 of file CJMDIChildWnd.h.

00112                          {
00113         brdrAllRaised       = 0x0000,
00114         brdrFlatTop         = 0x0001,
00115         brdrFlatBottom      = 0x0002,
00116         brdrFlatLeft        = 0x0004,
00117         brdrFlatRight       = 0x0008,
00118         brdrFlatVertical    = 0x0003,
00119         brdrFlatHorizontal  = 0x000C,
00120         brdrFlatAll         = 0x000F
00121     };

Constructor & Destructor Documentation

CCJMDIChildWnd::CCJMDIChildWnd ( )

Definition at line 72 of file CJMDIChildWnd.cpp.

00073 {
00074     m_hMenu       = NULL;
00075     m_nToolBarIDs = NULL;
00076     m_nMenuID     = 0;
00077     m_nToolBarID  = 0;
00078     m_nCount      = 0;
00079 }

CCJMDIChildWnd::~CCJMDIChildWnd ( ) [virtual]

Definition at line 81 of file CJMDIChildWnd.cpp.

00082 {
00083 }

Member Function Documentation

void CCJMDIChildWnd::DockControlBarLeftOf | ( | CControlBar * | Bar,
 |  | CControlBar * | LeftOf
 | ) | [protected, virtual]

Definition at line 104 of file CJMDIChildWnd.cpp.

00105 {
00106     CRect rect;
00107     DWORD dw;
00108     UINT n;
00109
00110     // get MFC to adjust the dimensions of all docked ToolBars
00111     // so that GetWindowRect will be accurate
00112     RecalcLayout(TRUE);
00113
00114     LeftOf->GetWindowRect(&rect);
00115     rect.OffsetRect(1,0);
00116     dw=LeftOf->GetBarStyle();
00117     n = 0;
00118     n = (dw&CBRS_ALIGN_TOP)              ? AFX_IDW_DOCKBAR_TOP      : n;
00119     n = (dw&CBRS_ALIGN_BOTTOM   && n==0) ? AFX_IDW_DOCKBAR_BOTTOM   : n;
00120     n = (dw&CBRS_ALIGN_LEFT     && n==0) ? AFX_IDW_DOCKBAR_LEFT     : n;
00121     n = (dw&CBRS_ALIGN_RIGHT    && n==0) ? AFX_IDW_DOCKBAR_RIGHT    : n;
00122
00123     // When we take the default parameters on rect, DockControlBar will dock
00124     // each Toolbar on a seperate line. By calculating a rectangle, we in effect
00125     // are simulating a Toolbar being dragged to that location and docked.
00126     DockControlBar(Bar,n,&rect);
00127 }

void CCJMDIChildWnd::DockSizeBar | ( | CControlBar * | pBar,
 |  | CCJSizeDockBar * | pDockBar = NULL,
 |  | LPRECT | lpRect = NULL
 | ) | [protected, virtual]

Definition at line 209 of file CJMDIChildWnd.cpp.

00210 {
00211     ASSERT(pBar != NULL);
00212     ASSERT(pBar->m_pDockContext != NULL);
00213
00214     if( pDockBar == NULL )
00215     {
00216         for (int i = 0; i < 4; i++)
00217         {
00218             if ((dwSizeBarMap[i][1] & CBRS_ALIGN_ANY) == (pBar->m_dwStyle & CBRS_ALIGN_ANY))
00219             {
00220                 pDockBar = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00221                 ASSERT(pDockBar != NULL);
00222
00223                 int nSize = 0;
00224
00225                 switch(i)
00226                 {
00227                 case 0: // horizontal dock
00228                 case 1:
00229                     nSize = ((CCJControlBar*)pBar)->GetHorzSize();
00230                     break;
00231                 case 2: // vertical dock
00232                 case 3:
00233                     nSize = ((CCJControlBar*)pBar)->GetVertSize();
00234                     break;
00235                 }
00236
00237                 pDockBar->SetActualSize( nSize );
00238                 break;
00239             }
00240         }
00241     }
00242
00243     ASSERT(pDockBar != NULL);
00244     ASSERT(m_listControlBars.Find(pBar) != NULL);
00245     ASSERT(pBar->m_pDockSite == this);
00246     ((CCJControlBar*)pBar)->Normalize();
00247     pDockBar->DockControlBar(pBar, lpRect);
00248 }

void CCJMDIChildWnd::EnableDocking ( DWORD dwDockStyle ) [protected, virtual]

Definition at line 129 of file CJMDIChildWnd.cpp.

00130 {
00131     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00132     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00133     CMDIChildWnd::EnableDocking(dwDockStyle);
00134
00135     for (int i = 0; i < 4; i++) {
00136         if (dwDockBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY) {
00137             CDockBar* pDock = (CDockBar*)GetControlBar(dwDockBarMap[i][0]);
00138
00139             // make sure the dock bar is of correct type
00140             if( pDock || !pDock->IsKindOf(RUNTIME_CLASS(CCJDockBar)) ) {
00141                 BOOL bNeedDelete = ! pDock->m_bAutoDelete;
00142                 pDock->m_pDockSite->RemoveControlBar(pDock);
00143                 pDock->m_pDockSite = 0; // avoid problems in destroying the dockbar
00144                 pDock->DestroyWindow();
00145                 if( bNeedDelete )
00146                     delete pDock;
00147                 pDock = 0;
00148             }
00149
00150             if( pDock == 0 ) {
00151                 pDock = new CCJDockBar;
00152                 if (!pDock->Create(this,
00153                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00154                     dwDockBarMap[i][1], dwDockBarMap[i][0])) {
00155                     AfxThrowResourceException();
00156                 }
00157             }
00158         }
00159     }
00160 }

void CCJMDIChildWnd::EnableDockingSizeBar | ( | DWORD | dwDockStyle,
 |  | DockFlatBorders | FlatFlags = brdrAllRaised
 | ) | [protected, virtual]

Definition at line 169 of file CJMDIChildWnd.cpp.

00170 {
00171     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00172     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00173
00174     m_pFloatingFrameClass = RUNTIME_CLASS(CCJMiniDockFrameWnd);
00175     for (int i = 0; i < 4; i++)
00176     {
00177         if (dwSizeBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY)
00178         {
00179             CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00180             if (pDock == NULL)
00181             {
00182                 pDock = new CCJSizeDockBar;
00183
00184                 if (!pDock->Create(this,
00185                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00186                         dwSizeBarMap[i][1], dwSizeBarMap[i][0]))
00187                 {
00188                     AfxThrowResourceException();
00189                 }
00190                 //Yiannhs enable Flat Borders For dock Bars
00191                 pDock->FlatBorder( (FlatFlags >> i) & 0x0001 );
00192             }
00193         }
00194     }
00195 }

HMENU CCJMDIChildWnd::GetInitializedMenu | ( | UINT | nMenuID,
 |  | UINT * | nToolbarIDs,
 |  | int | nSize
 | ) | [virtual]

Definition at line 266 of file CJMDIChildWnd.cpp.

00267 {
00268     if( m_hMenu ) {
00269         return m_hMenu;
00270     }
00271
00272     CCJMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CCJMDIFrameWnd, GetParentFrame());
00273     if( pMainFrame ) {
00274         pMainFrame->InitializeMenu( &m_hMenu, nMenuID, nToolbarIDs, nSize);
00275         m_nMenuID     = nMenuID;
00276         m_nToolBarIDs = nToolbarIDs;
00277         m_nCount      = nSize;
00278     }
00279
00280     return m_hMenu;
00281 }

HMENU CCJMDIChildWnd::GetInitializedMenu | ( | UINT | nMenuID,
 |  | UINT | nToolBarID
 | ) | [virtual]

Definition at line 250 of file CJMDIChildWnd.cpp.

00251 {
00252     if( m_hMenu ) {
00253         return m_hMenu;
00254     }
00255
00256     CCJMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CCJMDIFrameWnd, GetParentFrame());
00257     if( pMainFrame ) {
00258         pMainFrame->InitializeMenu( &m_hMenu, nMenuID, nToolBarID );
00259         m_nMenuID     = nMenuID;
00260         m_nToolBarID  = nToolBarID;
00261     }
00262
00263     return m_hMenu;
00264 }

_CJXLIB_INLINE UINT CCJMDIChildWnd::GetMenuID ( ) [virtual]

Definition at line 188 of file CJMDIChildWnd.h.

00189     { return m_nMenuID; }

_CJXLIB_INLINE UINT CCJMDIChildWnd::GetToolBarID ( ) [virtual]

Definition at line 191 of file CJMDIChildWnd.h.

00192     { return m_nToolBarID; }

_CJXLIB_INLINE UINT * CCJMDIChildWnd::GetToolBarIDs ( int & nCount ) [virtual]

Definition at line 194 of file CJMDIChildWnd.h.

00195     { nCount = m_nCount; return m_nToolBarIDs; }

BOOL CCJMDIChildWnd::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 283 of file CJMDIChildWnd.cpp.

00284 {
00285     CRect rect;
00286     GetClientRect(&rect);
00287     pDC->ExcludeClipRect(rect);
00288
00289     return CMDIChildWnd::OnEraseBkgnd(pDC);
00290 }

void CCJMDIChildWnd::RecalcAllExcept ( CCJSizeDockBar * pBar ) [protected, virtual]

Definition at line 197 of file CJMDIChildWnd.cpp.

Referenced by RecalcLayout().

00198 {
00199     for (int i = 0; i < 4; i++)
00200     {
00201         CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00202         if (pDock != NULL && pDock != pBar)
00203         {
00204             pDock->CalcSizeBarLayout();
00205         }
00206     }
00207 }

void CCJMDIChildWnd::RecalcLayout ( BOOL bNotify = TRUE ) [virtual]

Definition at line 162 of file CJMDIChildWnd.cpp.

00163 {
00164     CMDIChildWnd::RecalcLayout(bNotify);
00165     RecalcAllExcept(NULL);
00166 }

_CJXLIB_INLINE void CCJMDIChildWnd::SetResourceIDs | ( | UINT | nMenuID,
 |  | UINT * | nToolBarIDs,
 |  | int | nCount
 | ) | [virtual]

Definition at line 200 of file CJMDIChildWnd.h.

00201     { m_nMenuID = nMenuID; m_nToolBarIDs = nToolBarIDs; m_nCount = nCount; }

_CJXLIB_INLINE void CCJMDIChildWnd::SetResourceIDs | ( | UINT | nMenuID,
 |  | UINT | nToolBarID
 | ) | [virtual]

Definition at line 197 of file CJMDIChildWnd.h.

00198     { m_nMenuID = nMenuID; m_nToolBarID = nToolBarID; }

Member Data Documentation

DWORD CCJMDIChildWnd::dwDockBarMap [static, protected]

Initial value:

{
    { AFX_IDW_DOCKBAR_TOP,      CBRS_TOP    },
    { AFX_IDW_DOCKBAR_BOTTOM,   CBRS_BOTTOM },
    { AFX_IDW_DOCKBAR_LEFT,     CBRS_LEFT   },
    { AFX_IDW_DOCKBAR_RIGHT,    CBRS_RIGHT  },
}

Definition at line 96 of file CJMDIChildWnd.cpp.

HMENU CCJMDIChildWnd::m_hMenu [protected]

Definition at line 103 of file CJMDIChildWnd.h.

int CCJMDIChildWnd::m_nCount [protected]

Definition at line 107 of file CJMDIChildWnd.h.

UINT CCJMDIChildWnd::m_nMenuID [protected]

Definition at line 104 of file CJMDIChildWnd.h.

UINT CCJMDIChildWnd::m_nToolBarID [protected]

Definition at line 105 of file CJMDIChildWnd.h.

UINT* CCJMDIChildWnd::m_nToolBarIDs [protected]

Definition at line 106 of file CJMDIChildWnd.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMDIChildWnd.h
  • WinCvs/CJLib/CJLibrary/CJMDIChildWnd.cpp
Generated on Sun Oct 21 12:46:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJMDIFrameWnd Class Reference

#include <CJMDIFrameWnd.h>

Inheritance diagram for CCJMDIFrameWnd:

[legend]
Collaboration diagram for CCJMDIFrameWnd:

[legend]
List of all members.

Public Methods

CCJMDIFrameWnd ()
virtual | ~CCJMDIFrameWnd ()
virtual void | LoadBarState (LPCTSTR lpszProfileName)
virtual void | SaveBarState (LPCTSTR lpszProfileName) const
virtual BOOL | InitializeMenu (CMultiDocTemplate *pDocTemplate, UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=0, UINT nDefaultMenuID=NULL)
virtual BOOL | InitializeMenu (CMultiDocTemplate *pDocTemplate, UINT nMenuID, UINT nToolbarID=NULL, UINT nDefaultMenuID=NULL)
virtual BOOL | CCJMDIFrameWnd::InitializeMenu (HMENU *phMenu, UINT nMenuID, UINT nToolbarID=NULL)
virtual BOOL | InitializeMenu (HMENU *phMenu, UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=NULL)
virtual void | RecalcAllExcept (CCJSizeDockBar *pBar)
virtual void | EnableDocking (DWORD dwDockStyle)
virtual void | EnableDockingSizeBar (DWORD dwDockStyle, DockFlatBorders FlatFlags=brdrAllRaised)
virtual void | DockSizeBar (CControlBar *pBar, CCJSizeDockBar *pDockBar=NULL, LPRECT lpRect=NULL)
virtual void | DockControlBarLeftOf (CControlBar *Bar, CControlBar *LeftOf)
virtual void | RecalcLayout (BOOL bNotify=TRUE)

Protected Types

enum DockFlatBorders {
brdrAllRaised = 0x0000, brdrFlatTop = 0x0001, brdrFlatBottom = 0x0002, brdrFlatLeft = 0x0004,
brdrFlatRight = 0x0008, brdrFlatVertical = 0x0003, brdrFlatHorizontal = 0x000C, brdrFlatAll = 0x000F
}

Protected Methods

virtual HMENU | NewMenu (UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=0)
virtual HMENU | NewMenu (UINT nMenuID, UINT nToolbarID=NULL)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs, UINT nIconID)
afx_msg void | OnMeasureItem (int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
afx_msg LRESULT | OnMenuChar (UINT nChar, UINT nFlags, CMenu *pMenu)
afx_msg void | OnInitMenuPopup (CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu)
afx_msg void | OnClose ()

Protected Attributes

CMDIMenuList m_menuList
CCJMenuBar m_wndMenuBar

Static Protected Attributes

DWORD | dwDockBarMap [4][2]

Member Enumeration Documentation

enum CCJMDIFrameWnd::DockFlatBorders [protected]

Enumeration values:
brdrAllRaised
brdrFlatTop
brdrFlatBottom
brdrFlatLeft
brdrFlatRight
brdrFlatVertical
brdrFlatHorizontal
brdrFlatAll

Definition at line 170 of file CJMDIFrameWnd.h.

00170                          {
00171         brdrAllRaised       = 0x0000,
00172         brdrFlatTop         = 0x0001,
00173         brdrFlatBottom      = 0x0002,
00174         brdrFlatLeft        = 0x0004,
00175         brdrFlatRight       = 0x0008,
00176         brdrFlatVertical    = 0x0003,
00177         brdrFlatHorizontal  = 0x000C,
00178         brdrFlatAll         = 0x000F
00179     };

Constructor & Destructor Documentation

CCJMDIFrameWnd::CCJMDIFrameWnd ( )

Definition at line 148 of file CJMDIFrameWnd.cpp.

00149 {
00150
00151 }

CCJMDIFrameWnd::~CCJMDIFrameWnd ( ) [virtual]

Definition at line 153 of file CJMDIFrameWnd.cpp.

00154 {
00155     // Free up any allocated memory.
00156     while (!m_menuList.IsEmpty()) {
00157         CCJMenu* pMenu = m_menuList.RemoveTail();
00158         _delete(pMenu);
00159     }
00160 }

Member Function Documentation

virtual BOOL CCJMDIFrameWnd::CCJMDIFrameWnd::InitializeMenu | ( | HMENU * | phMenu,
 |  | UINT | nMenuID,
 |  | UINT | nToolbarID = NULL
 | ) | [virtual]

void CCJMDIFrameWnd::DockControlBarLeftOf | ( | CControlBar * | Bar,
 |  | CControlBar * | LeftOf
 | ) | [virtual]

Definition at line 185 of file CJMDIFrameWnd.cpp.

00186 {
00187     CRect rect;
00188     DWORD dw;
00189     UINT n;
00190
00191     // get MFC to adjust the dimensions of all docked ToolBars
00192     // so that GetWindowRect will be accurate
00193     RecalcLayout(TRUE);
00194
00195     LeftOf->GetWindowRect(&rect);
00196     rect.OffsetRect(1,0);
00197     dw=LeftOf->GetBarStyle();
00198     n = 0;
00199     n = (dw&CBRS_ALIGN_TOP)              ? AFX_IDW_DOCKBAR_TOP      : n;
00200     n = (dw&CBRS_ALIGN_BOTTOM   && n==0) ? AFX_IDW_DOCKBAR_BOTTOM   : n;
00201     n = (dw&CBRS_ALIGN_LEFT     && n==0) ? AFX_IDW_DOCKBAR_LEFT     : n;
00202     n = (dw&CBRS_ALIGN_RIGHT    && n==0) ? AFX_IDW_DOCKBAR_RIGHT    : n;
00203
00204     // When we take the default parameters on rect, DockControlBar will dock
00205     // each Toolbar on a seperate line. By calculating a rectangle, we in effect
00206     // are simulating a Toolbar being dragged to that location and docked.
00207     DockControlBar(Bar,n,&rect);
00208 }

void CCJMDIFrameWnd::DockSizeBar | ( | CControlBar * | pBar,
 |  | CCJSizeDockBar * | pDockBar = NULL,
 |  | LPRECT | lpRect = NULL
 | ) | [virtual]

Definition at line 290 of file CJMDIFrameWnd.cpp.

Referenced by CMainFrame::InitializeDockingWindows().

00291 {
00292     ASSERT(pBar != NULL);
00293     ASSERT(pBar->m_pDockContext != NULL);
00294
00295     if( pDockBar == NULL )
00296     {
00297         for (int i = 0; i < 4; i++)
00298         {
00299             if ((dwSizeBarMap[i][1] & CBRS_ALIGN_ANY) == (pBar->m_dwStyle & CBRS_ALIGN_ANY))
00300             {
00301                 pDockBar = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00302                 ASSERT(pDockBar != NULL);
00303
00304                 int nSize = 0;
00305
00306                 switch(i)
00307                 {
00308                 case 0: // horizontal dock
00309                 case 1:
00310                     nSize = ((CCJControlBar*)pBar)->GetHorzSize();
00311                     break;
00312                 case 2: // vertical dock
00313                 case 3:
00314                     nSize = ((CCJControlBar*)pBar)->GetVertSize();
00315                     break;
00316                 }
00317
00318                 pDockBar->SetActualSize( nSize );
00319                 break;
00320             }
00321         }
00322     }
00323
00324     ASSERT(pDockBar != NULL);
00325     ASSERT(m_listControlBars.Find(pBar) != NULL);
00326     ASSERT(pBar->m_pDockSite == this);
00327     ((CCJControlBar*)pBar)->Normalize();
00328     pDockBar->DockControlBar(pBar, lpRect);
00329 }

void CCJMDIFrameWnd::EnableDocking ( DWORD dwDockStyle ) [virtual]

Definition at line 210 of file CJMDIFrameWnd.cpp.

Referenced by CMainFrame::OnCreate().

00211 {
00212     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00213     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00214     CMDIFrameWnd::EnableDocking(dwDockStyle);
00215
00216     for (int i = 0; i < 4; i++) {
00217         if (dwDockBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY) {
00218             CDockBar* pDock = (CDockBar*)GetControlBar(dwDockBarMap[i][0]);
00219
00220             // make sure the dock bar is of correct type
00221             if( pDock || !pDock->IsKindOf(RUNTIME_CLASS(CCJDockBar)) ) {
00222                 BOOL bNeedDelete = ! pDock->m_bAutoDelete;
00223                 pDock->m_pDockSite->RemoveControlBar(pDock);
00224                 pDock->m_pDockSite = 0; // avoid problems in destroying the dockbar
00225                 pDock->DestroyWindow();
00226                 if( bNeedDelete )
00227                     delete pDock;
00228                 pDock = 0;
00229             }
00230
00231             if( pDock == 0 ) {
00232                 pDock = new CCJDockBar;
00233                 if (!pDock->Create(this,
00234                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00235                     dwDockBarMap[i][1], dwDockBarMap[i][0])) {
00236                     AfxThrowResourceException();
00237                 }
00238             }
00239         }
00240     }
00241 }

void CCJMDIFrameWnd::EnableDockingSizeBar | ( | DWORD | dwDockStyle,
 |  | DockFlatBorders | FlatFlags = brdrAllRaised
 | ) | [virtual]

Definition at line 250 of file CJMDIFrameWnd.cpp.

Referenced by CMainFrame::InitializeDockingWindows().

00251 {
00252     // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
00253     ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
00254
00255     m_pFloatingFrameClass = RUNTIME_CLASS(CCJMiniDockFrameWnd);
00256     for (int i = 0; i < 4; i++)
00257     {
00258         if (dwSizeBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY)
00259         {
00260             CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00261             if (pDock == NULL)
00262             {
00263                 pDock = new CCJSizeDockBar;
00264
00265                 if (!pDock->Create(this,
00266                     WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
00267                         dwSizeBarMap[i][1], dwSizeBarMap[i][0]))
00268                 {
00269                     AfxThrowResourceException();
00270                 }
00271                 //Yiannhs enable Flat Borders For dock Bars
00272                 pDock->FlatBorder( (FlatFlags >> i) & 0x0001 );
00273             }
00274         }
00275     }
00276 }

BOOL CCJMDIFrameWnd::InitializeMenu | ( | HMENU * | phMenu,
 |  | UINT | nMenuID,
 |  | UINT * | nToolbarIDs = NULL,
 |  | int | nSize = NULL
 | ) | [virtual]

Definition at line 426 of file CJMDIFrameWnd.cpp.

00427 {
00428     if( !phMenu ) {
00429         return FALSE;
00430     }
00431
00432     ASSERT(nMenuID);            // must be valid.
00433     *phMenu = NewMenu(nMenuID, nToolbarIDs, nSize);
00434
00435     return (BOOL)(*phMenu != NULL);
00436 }

BOOL CCJMDIFrameWnd::InitializeMenu | ( | CMultiDocTemplate * | pDocTemplate,
 |  | UINT | nMenuID,
 |  | UINT | nToolBarID = NULL,
 |  | UINT | nDefaultMenuID = NULL
 | ) | [virtual]

Definition at line 373 of file CJMDIFrameWnd.cpp.

00374 {
00375     ASSERT(nMenuID);            // must be valid.
00376
00377     // If no menus have been created yet, set the frame default,
00378     // this is the menu that is displayed when no views are active.
00379     if (m_menuList.IsEmpty()) {
00380         ASSERT(nDefaultMenuID != 0);
00381         m_hMenuDefault = NewMenu(nDefaultMenuID, nToolBarID);
00382         OnUpdateFrameMenu(m_hMenuDefault);
00383     }
00384     // Create the Doc/View menu. ONLY if there is a template passed.
00385     if( pDocTemplate )
00386     {
00387         ASSERT_VALID(pDocTemplate); // must be valid.
00388         pDocTemplate->m_hMenuShared = NewMenu(nMenuID, nToolBarID);
00389     }
00390     return TRUE;
00391 }

BOOL CCJMDIFrameWnd::InitializeMenu | ( | CMultiDocTemplate * | pDocTemplate,
 |  | UINT | nMenuID,
 |  | UINT * | nToolbarIDs = NULL,
 |  | int | nSize = 0,
 |  | UINT | nDefaultMenuID = NULL
 | ) | [virtual]

Definition at line 393 of file CJMDIFrameWnd.cpp.

Referenced by CCJMDIChildWnd::GetInitializedMenu(), and CWincvsApp::InitInstance().

00394 {
00395     ASSERT(nMenuID);            // must be valid.
00396
00397     // If no menus have been created yet, set the frame default,
00398     // this is the menu that is displayed when no views are active.
00399     if (m_menuList.IsEmpty()) {
00400         ASSERT(nDefaultMenuID != 0);
00401         m_hMenuDefault = NewMenu(nDefaultMenuID, nToolbarIDs, nSize);
00402         OnUpdateFrameMenu(m_hMenuDefault);
00403     }
00404     // Create the Doc/View menu. ONLY if there is a template passed.
00405     if( pDocTemplate )
00406     {
00407         ASSERT_VALID(pDocTemplate); // must be valid.
00408         pDocTemplate->m_hMenuShared = NewMenu(nMenuID, nToolbarIDs, nSize);
00409     }
00410
00411     return TRUE;
00412 }

void CCJMDIFrameWnd::LoadBarState ( LPCTSTR lpszProfileName ) [virtual]

Definition at line 495 of file CJMDIFrameWnd.cpp.

Referenced by CMainFrame::OnCreate().

00496 {
00497     CCJSizeDockBar::m_bIsDockBar = true;
00498     CFrameWnd::LoadBarState(lpszProfileName);
00499     CCJSizeDockBar::m_bIsDockBar = false;
00500 }

HMENU CCJMDIFrameWnd::NewMenu | ( | UINT | nMenuID,
 |  | UINT | nToolbarID = NULL
 | ) | [protected, virtual]

Definition at line 331 of file CJMDIFrameWnd.cpp.

00332 {
00333     // Allocate a new CCJMenu object.
00334     CCJMenu* pMenu = new CCJMenu;
00335     if( pMenu == NULL ) {
00336         return NULL;
00337     }
00338
00339     // Load the menu and toolbar resource.
00340     pMenu->LoadMenu(nMenuID);
00341     if (nToolbarID) {
00342         pMenu->LoadToolbar(nToolbarID);
00343     }
00344
00345     // Add the menu to the CList object.
00346     m_menuList.AddTail(pMenu);
00347
00348     // Detach the menu.
00349     return(pMenu->Detach());
00350 }

HMENU CCJMDIFrameWnd::NewMenu | ( | UINT | nMenuID,
 |  | UINT * | nToolbarIDs = NULL,
 |  | int | nSize = 0
 | ) | [protected, virtual]

Definition at line 352 of file CJMDIFrameWnd.cpp.

Referenced by InitializeMenu().

00353 {
00354     // Allocate a new CCJMenu object.
00355     CCJMenu* pMenu = new CCJMenu;
00356     if( pMenu == NULL ) {
00357         return NULL;
00358     }
00359
00360     // Load the menu and toolbar resources.
00361     pMenu->LoadMenu(nMenuID);
00362     if (nToolbarIDs) {
00363         pMenu->LoadToolbars(nToolbarIDs, nSize);
00364     }
00365
00366     // Add the menu to the CList object.
00367     m_menuList.AddTail(pMenu);
00368
00369     // Detach the menu.
00370     return(pMenu->Detach());
00371 }

void CCJMDIFrameWnd::OnClose ( ) [protected]

Reimplemented in CMainFrame.

Definition at line 509 of file CJMDIFrameWnd.cpp.

Referenced by CMainFrame::OnClose().

00510 {
00511     // Clear active view before close
00512     SetActiveView (NULL);
00513     CMDIFrameWnd::OnClose();
00514 }

void CCJMDIFrameWnd::OnInitMenuPopup | ( | CMenu * | pPopupMenu,
 |  | UINT | nIndex,
 |  | BOOL | bSysMenu
 | ) | [protected]

Definition at line 476 of file CJMDIFrameWnd.cpp.

00477 {
00478     CMDIFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
00479
00480     if(!bSysMenu)
00481     {
00482         // Loop through all menus in list.
00483         for (POSITION pos = m_menuList.GetHeadPosition(); pos; m_menuList.GetNext(pos))
00484         {
00485             CCJMenu* pListMenu = m_menuList.GetAt(pos);
00486
00487             if(pListMenu->IsMenu(pPopupMenu)) {
00488                 CCJMenu::UpdateMenu(pPopupMenu);
00489                 break;
00490             }
00491         }
00492     }
00493 }

void CCJMDIFrameWnd::OnMeasureItem | ( | int | nIDCtl,
 |  | LPMEASUREITEMSTRUCT | lpMeasureItemStruct
 | ) | [protected]

Definition at line 438 of file CJMDIFrameWnd.cpp.

00439 {
00440     if (lpMeasureItemStruct->CtlType == ODT_MENU)
00441     {
00442         if (IsMenu((HMENU)lpMeasureItemStruct->itemID)) {
00443             CMenu* pMenu = CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
00444
00445             // Loop through all menus in list.
00446             for (POSITION pos = m_menuList.GetHeadPosition(); pos; m_menuList.GetNext(pos))
00447             {
00448                 CCJMenu* pListMenu = m_menuList.GetAt(pos);
00449
00450                 if(pListMenu->IsMenu(pMenu)) {
00451                     pListMenu->MeasureItem(lpMeasureItemStruct);
00452                     return;
00453                 }
00454             }
00455         }
00456     }
00457
00458     CMDIFrameWnd::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
00459 }

LRESULT CCJMDIFrameWnd::OnMenuChar | ( | UINT | nChar,
 |  | UINT | nFlags,
 |  | CMenu * | pMenu
 | ) | [protected]

Definition at line 461 of file CJMDIFrameWnd.cpp.

00462 {
00463     // Loop through all menus in list.
00464     for (POSITION pos = m_menuList.GetHeadPosition(); pos; m_menuList.GetNext(pos))
00465     {
00466         CCJMenu* pListMenu = m_menuList.GetAt(pos);
00467
00468         if(pListMenu->IsMenu(pMenu)) {
00469             return CCJMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
00470         }
00471     }
00472
00473     return CMDIFrameWnd::OnMenuChar(nChar, nFlags, pMenu);
00474 }

BOOL CCJMDIFrameWnd::PreCreateWindow | ( | CREATESTRUCT & | cs,
 |  | UINT | nIconID
 | ) | [protected, virtual]

Definition at line 527 of file CJMDIFrameWnd.cpp.

00528 {
00529     // Register wnd class with no redraw, cursor (use default), background
00530     // brush and load your apps icon resource.
00531     cs.lpszClass = AfxRegisterWndClass( 0, NULL, NULL,
00532         AfxGetApp()->LoadIcon(nIconID));
00533     ASSERT(cs.lpszClass);
00534
00535     return CMDIFrameWnd::PreCreateWindow(cs);
00536 }

BOOL CCJMDIFrameWnd::PreCreateWindow ( CREATESTRUCT & cs ) [protected, virtual]

Reimplemented in CMainFrame.

Definition at line 517 of file CJMDIFrameWnd.cpp.

Referenced by CMainFrame::PreCreateWindow().

00518 {
00519     return CMDIFrameWnd::PreCreateWindow(cs);
00520 }

void CCJMDIFrameWnd::RecalcAllExcept ( CCJSizeDockBar * pBar ) [virtual]

Definition at line 278 of file CJMDIFrameWnd.cpp.

Referenced by RecalcLayout().

00279 {
00280     for (int i = 0; i < 4; i++)
00281     {
00282         CCJSizeDockBar* pDock = (CCJSizeDockBar*)GetControlBar(dwSizeBarMap[i][0]);
00283         if (pDock != NULL && pDock != pBar)
00284         {
00285             pDock->CalcSizeBarLayout();
00286         }
00287     }
00288 }

void CCJMDIFrameWnd::RecalcLayout ( BOOL bNotify = TRUE ) [virtual]

Definition at line 243 of file CJMDIFrameWnd.cpp.

Referenced by CMainFrame::DockControlBarLeftOf().

00244 {
00245     CMDIFrameWnd::RecalcLayout(bNotify);
00246     RecalcAllExcept(NULL);
00247 }

void CCJMDIFrameWnd::SaveBarState ( LPCTSTR lpszProfileName ) const [virtual]

Definition at line 502 of file CJMDIFrameWnd.cpp.

Referenced by CMainFrame::OnClose().

00503 {
00504     CCJSizeDockBar::m_bIsDockBar = true;
00505     CFrameWnd::SaveBarState(lpszProfileName);
00506     CCJSizeDockBar::m_bIsDockBar = false;
00507 }

Member Data Documentation

DWORD CCJMDIFrameWnd::dwDockBarMap [static, protected]

Initial value:

{
    { AFX_IDW_DOCKBAR_TOP,      CBRS_TOP    },
    { AFX_IDW_DOCKBAR_BOTTOM,   CBRS_BOTTOM },
    { AFX_IDW_DOCKBAR_LEFT,     CBRS_LEFT   },
    { AFX_IDW_DOCKBAR_RIGHT,    CBRS_RIGHT  },
}

Definition at line 177 of file CJMDIFrameWnd.cpp.

CMDIMenuList CCJMDIFrameWnd::m_menuList [protected]

Definition at line 166 of file CJMDIFrameWnd.h.

CCJMenuBar CCJMDIFrameWnd::m_wndMenuBar [protected]

Definition at line 167 of file CJMDIFrameWnd.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMDIFrameWnd.h
  • WinCvs/CJLib/CJLibrary/CJMDIFrameWnd.cpp
Generated on Sun Oct 21 12:46:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJMemFile Class Reference

#include <CJMemFile.h>

Inheritance diagram for CCJMemFile:

[legend]
Collaboration diagram for CCJMemFile:

[legend]
List of all members.

Public Methods

CCJMemFile (UINT nGrowBytes=1024)
CCJMemFile (BYTE *lpBuffer, UINT nBufferSize, UINT nGrowBytes=0)
CCJMemFile (LPCTSTR lpstFilename, UINT uiOpenFlags)
virtual | ~CCJMemFile ()
virtual void | Flush ()
virtual bool | Open (CString strFilename, UINT uiOpenFlags, CFileException *pError=NULL)
virtual void | Close ()
virtual BOOL | ReadString (CString &rString)
virtual void | WriteString (LPCTSTR lpsz)
virtual bool | Duplicate (CFile *fDuplicate)
virtual bool | Duplicate (CString strDup)
virtual bool | Discard ()
virtual DWORD | Insert (CFile *fSrc, DWORD dwSourcePos, DWORD dwDestPos, DWORD dwBytes)
virtual DWORD | Insert (CString strSrc, DWORD dwSourcePos, DWORD dwDestPos, DWORD dwBytes)
virtual DWORD | Extract (CFile *fDest, DWORD dwStartPos, DWORD dwBytes)
virtual DWORD | Extract (CString strDest, DWORD dwStartPos, DWORD dwBytes)
LONG | FindData (void *pData, DWORD dwDataLen, LONG lStartPos)
void | operator= (CFile *fDup)
void | operator= (CString strDup)
void | operator= (DWORD dwFilePos)
void | operator+= (CFile *fApp)
void | operator+= (CString strApp)
BYTE | operator[] (DWORD dwFilePos)

Protected Methods

virtual bool | Load ()
virtual bool | Save ()
virtual bool | Import (CFile *fImp)
virtual bool | Append (CFile *fApp)

Private Attributes

CFileException * | m_pError
CFile | m_File
UINT | m_uiOpenFlags
bool | m_bOpen

Constructor & Destructor Documentation

CCJMemFile::CCJMemFile ( UINT nGrowBytes = 1024 )

Definition at line 55 of file CJMemFile.cpp.

00056 {
00057     // Modified default constructor
00058
00059     m_File.m_hFile = NULL;
00060     m_bOpen = false;
00061     m_uiOpenFlags = 0;
00062     CMemFile::CMemFile(nGrowBytes);
00063 }

CCJMemFile::CCJMemFile | ( | BYTE * | lpBuffer,
 |  | UINT | nBufferSize,
 |  | UINT | nGrowBytes = 0
 | ) |

Definition at line 65 of file CJMemFile.cpp.

00066 {
00067     // Modified default constructor
00068
00069     m_File.m_hFile = NULL;
00070     m_bOpen = false;
00071     m_uiOpenFlags = 0;
00072     CMemFile::CMemFile(lpBuffer,nBufferSize, nGrowBytes );
00073 }

CCJMemFile::CCJMemFile | ( | LPCTSTR | lpszFilename,
 |  | UINT | uiOpenFlags
 | ) |

Definition at line 75 of file CJMemFile.cpp.

00076 {
00077     // CFile compatible constructor
00078
00079     m_File.m_hFile = NULL;
00080     m_bOpen = false;
00081     m_uiOpenFlags = uiOpenFlags;
00082     Open(lpszFilename,uiOpenFlags);
00083 }

CCJMemFile::~CCJMemFile ( ) [virtual]

Definition at line 85 of file CJMemFile.cpp.

00086 {
00087     if (m_bOpen)
00088         Close();
00089     m_File.m_hFile = NULL;
00090     m_uiOpenFlags = 0;
00091     CMemFile::~CMemFile();
00092 }

Member Function Documentation

bool CCJMemFile::Append ( CFile * fApp ) [protected, virtual]

Definition at line 285 of file CJMemFile.cpp.

Referenced by operator+=().

00286 {
00287     if ((fApp == NULL) || (fApp->m_hFile == NULL))
00288         return false;
00289
00290     DWORD dwLength = 1024;
00291     BYTE *pData = new BYTE[dwLength];
00292     if (pData == NULL)
00293         return false;
00294     SeekToEnd();
00295     fApp->SeekToBegin();
00296     while (fApp->GetPosition() < fApp->GetLength())
00297     {
00298         DWORD dwRead = fApp->Read(pData,dwLength);
00299         Write(pData,dwRead);
00300     }
00301
00302     delete pData;
00303     return true;
00304 }

void CCJMemFile::Close ( ) [virtual]

Definition at line 241 of file CJMemFile.cpp.

Referenced by ~CCJMemFile().

00242 {
00243     if ((m_File.m_hFile != NULL) && m_bOpen)
00244     {
00245         m_bOpen = false;
00246         Save();
00247         m_File.Close();
00248         m_File.m_hFile = NULL;
00249     }
00250 }

bool CCJMemFile::Discard ( ) [virtual]

Definition at line 258 of file CJMemFile.cpp.

00259 {
00260     return Load();
00261 }

bool CCJMemFile::Duplicate ( CString strDup ) [virtual]

Definition at line 161 of file CJMemFile.cpp.

00162 {
00163     // Duplicate With CString compatibility
00164
00165     CFile file(strDup,CFile::modeCreate | CFile::modeWrite);
00166     bool bResult = Duplicate(&file);
00167     file.Close();
00168     return bResult;
00169 }

bool CCJMemFile::Duplicate ( CFile * fDuplicate ) [virtual]

Definition at line 143 of file CJMemFile.cpp.

Referenced by Duplicate().

00144 {
00145     // Standard Copy Routine
00146
00147     BYTE *pbData = new BYTE[1024];
00148     DWORD dwPos = GetPosition();
00149     SeekToBegin();
00150     fDuplicate->SetLength(0);
00151     while (GetPosition() < GetLength())
00152     {
00153         DWORD dwRead = Read(pbData,1024);
00154         fDuplicate->Write(pbData,dwRead);
00155     }
00156     Seek(dwPos,fDuplicate->begin);
00157     delete pbData;
00158     return true;
00159 }

DWORD CCJMemFile::Extract | ( | CString | strDest,
 |  | DWORD | dwStartPos,
 |  | DWORD | dwBytes
 | ) | [virtual]

Definition at line 384 of file CJMemFile.cpp.

00385 {
00386     CFile file(strDest,CFile::modeCreate | CFile::modeWrite);
00387     DWORD dwResult = Extract(&file,dwStartPos,dwBytes);
00388     file.Close();
00389     return dwResult;
00390 }

DWORD CCJMemFile::Extract | ( | CFile * | fDest,
 |  | DWORD | dwStartPos,
 |  | DWORD | dwBytes
 | ) | [virtual]

Definition at line 357 of file CJMemFile.cpp.

Referenced by Extract(), and Insert().

00358 {
00359     if (dwBytes == 0)
00360         return 0;
00361     DWORD dwPos = GetPosition();
00362     DWORD dwLength = 1024;
00363     DWORD dwCounter = 0;
00364     BYTE *pData = new BYTE[dwLength];
00365     if (pData == NULL)
00366         return 0;
00367     Seek(dwStartPos,begin);
00368
00369     while (((GetPosition() - dwStartPos) < dwBytes) && (GetPosition() < GetLength()) )
00370     {
00371         DWORD dwRead = Read(pData,dwLength);
00372         if (dwCounter + dwRead > dwStartPos + dwBytes)
00373             dwRead = dwBytes - dwCounter;
00374         fDest->Write(pData,dwRead);
00375         dwCounter += dwRead;
00376     }
00377     Seek(dwPos,begin);
00378     delete pData;
00379     fDest->Flush();
00380     return dwCounter;
00381
00382 }

LONG CCJMemFile::FindData | ( | void * | pData,
 |  | DWORD | dwDataLen,
 |  | LONG | lStartPos
 | ) |

Definition at line 443 of file CJMemFile.cpp.

00444 {
00445     BYTE* pBytes = (BYTE*)pData;
00446
00447
00448     Seek(lStartPos,begin);
00449
00450     bool bFoundAll = false;
00451     LONG lPos = -1;
00452
00453     while ((!bFoundAll) && (GetPosition() < GetLength()))
00454     {
00455         bool bFoundFirst = false;
00456
00457         while ((!bFoundFirst) && (GetPosition() < GetLength()))
00458         {
00459             lPos = GetPosition();
00460             BYTE read;
00461             Read(&read,1);
00462             if (read != pBytes[0])
00463                 continue;
00464
00465             bFoundFirst = true;
00466             break;
00467         }
00468
00469         //Hier Die Restlichen Bytes (dwDataLen -1) vergleichen
00470
00471         DWORD i = 1;
00472         bool bFound = true;
00473
00474         while ((i < dwDataLen) && (GetPosition() < GetLength()) && bFoundFirst)
00475         {
00476             BYTE read;
00477             Read(&read,1);
00478             if (read == pBytes[i++])
00479                 continue;
00480
00481             bFound = false;
00482             Seek(lPos+1,begin);
00483             break;
00484         }
00485
00486         bFoundAll = bFound && bFoundFirst;
00487     }
00488
00489     lPos = bFoundAll ? lPos : -1;
00490 //  while (bFound && (iPos < strSeek.GetLength())
00491 //  {
00492 //  }
00493     return lPos;
00494 }

void CCJMemFile::Flush ( void ) [virtual]

Definition at line 252 of file CJMemFile.cpp.

00253 {
00254     CMemFile::Flush();
00255     Save();
00256 }

bool CCJMemFile::Import ( CFile * fImp ) [protected, virtual]

Definition at line 263 of file CJMemFile.cpp.

Referenced by operator=().

00264 {
00265     if ((fImp == NULL) || (fImp->m_hFile == NULL))
00266         return false;
00267
00268     DWORD dwLength = 1024;
00269     BYTE *pData = new BYTE[dwLength];
00270     if (pData == NULL)
00271         return false;
00272     SeekToBegin();
00273     SetLength(0);
00274     fImp->SeekToBegin();
00275     while (fImp->GetPosition() < fImp->GetLength())
00276     {
00277         DWORD dwRead = fImp->Read(pData,dwLength);
00278         Write(pData,dwRead);
00279     }
00280
00281     delete pData;
00282     return true;
00283 }

DWORD CCJMemFile::Insert | ( | CString | strSrc,
 |  | DWORD | dwSourcePos,
 |  | DWORD | dwDestPos,
 |  | DWORD | dwBytes
 | ) | [virtual]

Definition at line 349 of file CJMemFile.cpp.

00350 {
00351     CFile file(strSrc,CFile::modeRead);
00352     DWORD dwResult = Insert(&file, dwSourcePos, dwDestPos, dwBytes);
00353     file.Close();
00354     return dwResult;
00355 }

DWORD CCJMemFile::Insert | ( | CFile * | fSrc,
 |  | DWORD | dwSourcePos,
 |  | DWORD | dwDestPos,
 |  | DWORD | dwBytes
 | ) | [virtual]

Definition at line 306 of file CJMemFile.cpp.

Referenced by Insert().

00307 {
00308     if (dwBytes == 0)
00309         return 0;
00310
00311     CCJMemFile fPreIns;
00312     CCJMemFile fIns;
00313     CCJMemFile fPostIns;
00314     CCJMemFile fComplete;
00315
00316     Extract(&fPreIns,0,dwDestPos); // Extract Data BEFORE insertion point
00317     Extract(&fPostIns,dwDestPos,GetLength() - dwDestPos); // Extract Data AFTER intertion point
00318
00319     // Extract the "to be inserted" Data from the (fSrc) Source file
00320     {
00321         DWORD dwLength = 1024;
00322         DWORD dwCounter = 0;
00323         BYTE *pData = new BYTE[dwLength];
00324         if (pData == NULL)
00325             return 0;
00326         fSrc->Seek(dwSourcePos,begin);
00327
00328         while (((fSrc->GetPosition() - dwSourcePos) < dwBytes) && (fSrc->GetPosition() < fSrc->GetLength()) )
00329         {
00330             DWORD dwRead = fSrc->Read(pData,dwLength);
00331             if (dwCounter + dwRead > dwSourcePos + dwBytes)
00332                 dwRead = dwBytes - dwCounter;
00333             fIns.Write(pData,dwRead);
00334             dwCounter += dwRead;
00335         }
00336         delete pData;
00337     } // Finished Extraction
00338
00339
00340     fComplete += &fPreIns; // Append BEFORE Data
00341     fComplete += &fIns; // Append the "to be inserted" Data
00342     fComplete += &fPostIns;  // Append the AFTER Data
00343
00344     *this = &fComplete; // Copy completed File
00345
00346     return fIns.GetLength();
00347 }

bool CCJMemFile::Load ( ) [protected, virtual]

Definition at line 218 of file CJMemFile.cpp.

Referenced by Discard(), and Open().

00219 {
00220     if (m_File.m_hFile == NULL)
00221         return false;
00222
00223     DWORD dwLength = 1024;
00224     BYTE *pData = new BYTE[dwLength];
00225     if (pData == NULL)
00226         return false;
00227     SeekToBegin();
00228     SetLength(0);
00229     m_File.SeekToBegin();
00230     while (m_File.GetPosition() < m_File.GetLength())
00231     {
00232         DWORD dwRead = m_File.Read(pData,dwLength);
00233         Write(pData,dwRead);
00234     }
00235
00236     delete pData;
00237     return true;
00238 }

bool CCJMemFile::Open | ( | CString | strFilename,
 |  | UINT | uiOpenFlags,
 |  | CFileException * | pError = NULL
 | ) | [virtual]

Definition at line 171 of file CJMemFile.cpp.

Referenced by CCJMemFile().

00172 {
00173     // CFile compatible Open
00174
00175     if (m_File.m_hFile != NULL)
00176         return false;
00177     if (m_File.Open(strFilename,uiOpenFlags,pError))
00178     {
00179         m_uiOpenFlags = uiOpenFlags;
00180         Load();
00181         m_bOpen = true;
00182         return true;
00183     }
00184     else
00185         return false;
00186 }

BOOL CCJMemFile::ReadString ( CString & rString ) [virtual]

Definition at line 96 of file CJMemFile.cpp.

00097 {
00098     // Readstring Beta Version
00099
00100     rString.Empty();
00101     char ch;
00102
00103     bool bFound = false;
00104     while (GetPosition() < GetLength())
00105     {
00106         Read(&ch,1);
00107
00108         bFound = (ch == '\x0D');
00109         if (bFound || (ch == '\x0'))
00110             break;
00111         else
00112             rString = rString + ch;
00113     }
00114     if (bFound)
00115     {
00116         Read(&ch,1);
00117         if (ch != '\x0A')
00118             Seek(-1,current);
00119     }
00120
00121     if (rString.GetLength() > 0)
00122         return true;
00123     return false;
00124 }

bool CCJMemFile::Save ( ) [protected, virtual]

Definition at line 188 of file CJMemFile.cpp.

Referenced by Close(), and Flush().

00189 {
00190     if (m_File.m_hFile == NULL)
00191         return false;
00192     CString str;
00193
00194     // Check if the physical file has write access
00195     if (!(m_uiOpenFlags & modeWrite) && !(m_uiOpenFlags & modeReadWrite))
00196     {
00197         return false;
00198     }
00199
00200     DWORD dwPos = GetPosition();
00201     DWORD dwLength = 1024;
00202     BYTE *pData = new BYTE[dwLength];
00203     if (pData == NULL)
00204         return false;
00205     SeekToBegin();
00206     m_File.SetLength(0);
00207     while (GetPosition() < GetLength())
00208     {
00209         DWORD dwRead = Read(pData,dwLength);
00210         m_File.Write(pData,dwRead);
00211     }
00212     Seek(dwPos,begin);
00213     delete pData;
00214     m_File.Flush();
00215     return true;
00216 }

void CCJMemFile::WriteString ( LPCTSTR lpsz ) [virtual]

Definition at line 126 of file CJMemFile.cpp.

00127 {
00128     // WriteString Beta Version
00129
00130     if (_tcslen(lpsz) > 0)
00131     {
00132         for (UINT iCount = 0; iCount < _tcslen(lpsz); iCount++)
00133             if ((lpsz[iCount] != '\x0D') && (lpsz[iCount] != '\x00'))
00134                 Write(&lpsz[iCount],1);
00135     }
00136     char ch = '\x0D';
00137     Write(&ch,1);
00138     ch = '\x0A';
00139     Write(&ch,1);
00140
00141 }

void CCJMemFile::operator+= ( CString strApp )

Definition at line 420 of file CJMemFile.cpp.

00421 {
00422     CFile file;
00423     if (file.Open(strApp,CFile::modeRead))
00424     {
00425         Append(&file);
00426         file.Close();
00427     }
00428 }

void CCJMemFile::operator+= ( CFile * fApp )

Definition at line 415 of file CJMemFile.cpp.

00416 {
00417     Append(fApp);
00418 }

void CCJMemFile::operator= ( DWORD dwFilePos )

Definition at line 409 of file CJMemFile.cpp.

00410 {
00411     Seek(dwFilePos,begin);
00412 }

void CCJMemFile::operator= ( CString strDup )

Definition at line 399 of file CJMemFile.cpp.

00400 {
00401     CFile file;
00402     if (file.Open(strDup,CFile::modeRead))
00403     {
00404         Import(&file);
00405         file.Close();
00406     }
00407 }

void CCJMemFile::operator= ( CFile * fDup )

Definition at line 394 of file CJMemFile.cpp.

00395 {
00396     Import(fDup);
00397 }

BYTE CCJMemFile::operator[] ( DWORD dwFilePos )

Definition at line 432 of file CJMemFile.cpp.

00433 {
00434     if (dwFilePos > GetLength() -1)
00435         return 0;
00436
00437     BYTE bTemp;
00438     Seek(dwFilePos,begin);
00439     Read(&bTemp,sizeof(BYTE));
00440     return bTemp;
00441 }

Member Data Documentation

CFile CCJMemFile::m_File [private]

Definition at line 48 of file CJMemFile.h.

bool CCJMemFile::m_bOpen [private]

Definition at line 50 of file CJMemFile.h.

CFileException* CCJMemFile::m_pError [private]

Definition at line 47 of file CJMemFile.h.

UINT CCJMemFile::m_uiOpenFlags [private]

Definition at line 49 of file CJMemFile.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMemFile.h
  • WinCvs/CJLib/CJLibrary/CJMemFile.cpp
Generated on Sun Oct 21 12:46:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJMenu Class Reference

#include <CJMenu.h>

Inheritance diagram for CCJMenu:

[legend]
Collaboration diagram for CCJMenu:

[legend]
List of all members.

Public Methods

CCJMenu ()
void | SetBitmapBackground (COLORREF color)
void | SetDisableOldStyle (void)
void | UnSetDisableOldStyle (void)
BOOL | GetDisableOldStyle (void)
void | UnSetBitmapBackground (void)
BOOL | AddBitmapToImageList (CImageList *list, UINT nResourceID)
BOOL | LoadFromToolBar (UINT nID, UINT nToolBar, int &xoffset)
void | InsertSpaces (void)
void | DrawCheckMark (CDC *pDC, int x, int y, COLORREF color)
void | DrawRadioDot (CDC *pDC, int x, int y, COLORREF color)
CCJMenu * | FindMenuOption (int nId, int &nLoc)
CCJMenuData * | FindMenuOption (wchar_t *lpstrText)
BOOL | GetMenuText (UINT id, CString &string, UINT nFlags=MF_BYPOSITION)
void | LoadCheckmarkBitmap (int unselect, int select)
void | DitherBlt (HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HBITMAP hbm, int nXSrc, int nYSrc)
void | DitherBlt2 (CDC *drawdc, int nXDest, int nYDest, int nWidth, int nHeight, CBitmap &bmp, int nXSrc, int nYSrc)
BOOL | GetBitmapFromImageList (CDC *pDC, CImageList *imglist, int nIndex, CBitmap &bmp)
virtual | ~CCJMenu ()
virtual void | DrawItem (LPDRAWITEMSTRUCT)
virtual void | MeasureItem (LPMEASUREITEMSTRUCT)
void | SetIconSize (int, int)
BOOL | AppendODMenuA (LPCSTR lpstrText, UINT nFlags=MF_OWNERDRAW, UINT nID=0, int nIconNormal=-1)
BOOL | AppendODMenuW (wchar_t *lpstrText, UINT nFlags=MF_OWNERDRAW, UINT nID=0, int nIconNormal=-1)
BOOL | AppendODMenuA (LPCSTR lpstrText, UINT nFlags, UINT nID, CImageList *il, int xoffset)
BOOL | AppendODMenuW (wchar_t *lpstrText, UINT nFlags, UINT nID, CImageList *il, int xoffset)
BOOL | AppendMenuA (UINT nFlags, UINT nIDNewItem=0, LPCTSTR lpszNewItem=NULL)
BOOL | AppendMenuA (UINT nFlags, UINT nIDNewItem, const CBitmap *pBmp)
BOOL | InsertODMenuA (UINT nPosition, LPCSTR lpstrText, UINT nFlags=MF_OWNERDRAW, UINT nID=0, int nIconNormal=-1)
BOOL | InsertODMenuW (UINT nPosition, wchar_t *lpstrText, UINT nFlags=MF_OWNERDRAW, UINT nID=0, int nIconNormal=-1)
BOOL | InsertODMenuA (UINT nPosition, LPCSTR lpstrText, UINT nFlags, UINT nID, CImageList *il, int xoffset)
BOOL | InsertODMenuW (UINT nPosition, wchar_t *lpstrText, UINT nFlags, UINT nID, CImageList *il, int xoffset)
BOOL | ModifyODMenuA (const char *lpstrText, UINT nID=0, int nIconNormal=-1)
BOOL | ModifyODMenuA (const char *lpstrText, UINT nID, CImageList *il, int xoffset)
BOOL | ModifyODMenuA (const char *lpstrText, UINT nID, CBitmap *bmp)
BOOL | ModifyODMenuA (const char *lpstrText, const char *OptionText, int nIconNormal)
BOOL | ModifyODMenuW (wchar_t *lpstrText, UINT nID=0, int nIconNormal=-1)
BOOL | ModifyODMenuW (wchar_t *lpstrText, UINT nID, CImageList *il, int xoffset)
BOOL | ModifyODMenuW (wchar_t *lpstrText, UINT nID, CBitmap *bmp)
BOOL | ModifyODMenuW (wchar_t *lpstrText, wchar_t *OptionText, int nIconNormal)
CCJMenuData * | NewODMenu (UINT pos, UINT nFlags, UINT nID, CString string)
void | SynchronizeMenu (void)
void | CCJMenu::InitializeMenuList (int value)
void | CCJMenu::DeleteMenuList (void)
CCJMenuData * | CCJMenu::FindMenuList (UINT nID)
virtual BOOL | LoadMenu (LPCTSTR lpszResourceName)
virtual BOOL | LoadMenu (int nResource)
void | AddFromToolBar (CToolBar *pToolBar, int nResourceID)
BOOL | Draw3DCheckmark (CDC *dc, const CRect &rc, BOOL bSelected, HBITMAP hbmCheck)
BOOL | LoadToolbar (UINT nToolBar)
BOOL | LoadToolbars (const UINT *arID, int n)
BOOL | RemoveMenu (UINT uiId, UINT nFlags)
BOOL | DeleteMenu (UINT uiId, UINT nFlags)
BOOL | AppendMenuA (UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, int nIconNormal=-1)
BOOL | AppendMenuA (UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, CImageList *il, int xoffset)
BOOL | AppendMenuA (UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, CBitmap *bmp)
BOOL | AppendMenuW (UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, int nIconNormal=-1)
BOOL | AppendMenuW (UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, CImageList *il, int xoffset)
BOOL | AppendMenuW (UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, CBitmap *bmp)
BOOL | InsertMenuA (UINT nPosition, UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, int nIconNormal=-1)
BOOL | InsertMenuA (UINT nPosition, UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, CImageList *il, int xoffset)
BOOL | InsertMenuA (UINT nPosition, UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, CBitmap *bmp)
BOOL | InsertMenuW (UINT nPosition, UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, int nIconNormal=-1)
BOOL | InsertMenuW (UINT nPosition, UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, CImageList *il, int xoffset)
BOOL | InsertMenuW (UINT nPosition, UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, CBitmap *bmp)
CCJMenu * | AppendODPopupMenuA (LPCSTR lpstrText)
CCJMenu * | AppendODPopupMenuW (wchar_t *lpstrText)
virtual BOOL | DestroyMenu ()

Static Public Methods

BOOL | IsNewShell (void)
LRESULT | FindKeyboardShortcut (UINT nChar, UINT nFlags, CMenu *pMenu)
void | UpdateMenu (CMenu *pmenu)
BOOL | IsMenu (CMenu *submenu)
BOOL | IsMenu (HMENU submenu)
HBITMAP | LoadSysColorBitmap (int nResourceId)

Public Attributes

CImageList * | checkmaps
BOOL | checkmapsshare
int | m_selectcheck
int | m_unselectcheck

Protected Attributes

CTypedPtrArray< CPtrArray,
CCJMenuData *> 		m_MenuList
CTypedPtrArray< CPtrArray,
HMENU > 		m_SubMenus
int | m_iconX
int | m_iconY
COLORREF | m_bitmapBackground
BOOL | m_bitmapBackgroundFlag
BOOL | disable_old_style

Static Protected Attributes

CTypedPtrArray< CPtrArray,
HMENU > 		m_AllSubMenus

Constructor & Destructor Documentation

CCJMenu::CCJMenu ( )

Definition at line 128 of file CJMenu.cpp.

00129 {
00130     disable_old_style=FALSE;
00131     m_iconX = 16;            // Icon sizes default to 16 x 16
00132     m_iconY = 15;            // ...
00133     m_selectcheck = -1;
00134     m_unselectcheck = -1;
00135     checkmaps=NULL;
00136     checkmapsshare=FALSE;
00137     // set the color used for the transparent background in all bitmaps
00138     m_bitmapBackground=RGB(192,192,192); //gray
00139     m_bitmapBackgroundFlag=FALSE;
00140     GetCPInfo(CP_ACP,&CPInfo);
00141 }

CCJMenu::~CCJMenu ( ) [virtual]

Definition at line 144 of file CJMenu.cpp.

00145 {
00146     DestroyMenu();
00147 }

Member Function Documentation

BOOL CCJMenu::AddBitmapToImageList | ( | CImageList * | bmplist,
 |  | UINT | nResourceID
 | ) |

Definition at line 1523 of file CJMenu.cpp.

Referenced by AddFromToolBar(), AppendODMenuW(), InsertODMenuW(), LoadCheckmarkBitmap(), and ModifyODMenuW().

01524 {
01525     BOOL bReturn=TRUE;
01526
01527     HBITMAP hbmp=LoadSysColorBitmap(nResourceID);
01528     if(hbmp){
01529         CBitmap bmp;
01530         bmp.Attach(hbmp);
01531         if(m_bitmapBackgroundFlag) bmplist->Add(&bmp,m_bitmapBackground);
01532         else bmplist->Add(&bmp,GetSysColor(COLOR_3DFACE));
01533         bmp.Detach();
01534         DeleteObject(hbmp);
01535         bReturn=TRUE;
01536     }
01537     else bReturn = FALSE;
01538     return(bReturn);
01539 }

void CCJMenu::AddFromToolBar | ( | CToolBar * | pToolBar,
 |  | int | nResourceID
 | ) |

Definition at line 1555 of file CJMenu.cpp.

01556 {
01557     for (int i = 0; i < pToolBar->GetCount(); i++) {
01558         UINT nID = pToolBar->GetItemID(i);
01559         // See if this toolbar option
01560         // appears as a command on this
01561         // menu or is a separator
01562         if (nID == 0 || GetMenuState(nID, MF_BYCOMMAND) == 0xFFFFFFFF)
01563             continue; // Item doesn't exist
01564         UINT nStyle;
01565         int nImage;
01566         // Get the toolbar button info
01567         pToolBar->GetButtonInfo(i, nID, nStyle, nImage);
01568         // OK, we have the command ID of the toolbar
01569         // option, and the tollbar bitmap offset
01570         int nLoc;
01571         CCJMenuData* pData;
01572         CCJMenu *pSubMenu = FindMenuOption(nID, nLoc);
01573         if (pSubMenu && nLoc >= 0)pData = pSubMenu->m_MenuList[nLoc];
01574         else {
01575             // Create a new CCJMenuData structure
01576             pData = new CCJMenuData;
01577             m_MenuList.Add(pData);
01578         }
01579         // Set some default structure members
01580         pData->menuIconNormal = nResourceID;
01581         pData->nID = nID;
01582         pData->nFlags =  MF_BYCOMMAND | MF_OWNERDRAW;
01583         pData->xoffset = nImage;
01584         if (pData->bitmap)pData->bitmap->DeleteImageList();
01585         else pData->bitmap = new CImageList;
01586         pData->bitmap->Create(m_iconX, m_iconY,ILC_COLORDDB|ILC_MASK, 1, 1);
01587
01588         if(!AddBitmapToImageList(pData->bitmap, nResourceID)){
01589             pData->bitmap->DeleteImageList();
01590             delete pData->bitmap;
01591             pData->bitmap=NULL;
01592             pData->menuIconNormal = -1;
01593             pData->xoffset = -1;
01594         }
01595
01596         // Modify our menu
01597         ModifyMenu(nID,pData->nFlags,nID,(LPCTSTR)pData);
01598     }
01599 }

BOOL CCJMenu::AppendMenuA | ( | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | const char * | lpszNewItem,
 |  | CBitmap * | bmp
 | ) |

Definition at line 1806 of file CJMenu.cpp.

01807 {
01808     USES_CONVERSION;
01809     return AppendMenuW(nFlags,nIDNewItem,A2W(lpszNewItem),bmp);
01810 }

BOOL CCJMenu::AppendMenuA | ( | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | const char * | lpszNewItem,
 |  | CImageList * | il,
 |  | int | xoffset
 | ) |

Definition at line 1795 of file CJMenu.cpp.

01796 {
01797     USES_CONVERSION;
01798     return AppendMenuW(nFlags,nIDNewItem,A2W(lpszNewItem),il,xoffset);
01799 }

BOOL CCJMenu::AppendMenuA | ( | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | const char * | lpszNewItem,
 |  | int | nIconNormal = -1
 | ) |

Definition at line 1784 of file CJMenu.cpp.

01785 {
01786     USES_CONVERSION;
01787     return AppendMenuW(nFlags,nIDNewItem,A2W(lpszNewItem),nIconNormal);
01788 }

BOOL CCJMenu::AppendMenuA | ( | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | const CBitmap * | pBmp
 | ) | [inline]

Definition at line 186 of file CJMenu.h.

00187         { return CMenu::AppendMenu( nFlags, nIDNewItem, pBmp ); }

BOOL CCJMenu::AppendMenuA | ( | UINT | nFlags,
 |  | UINT | nIDNewItem = 0,
 |  | LPCTSTR | lpszNewItem = NULL
 | ) | [inline]

Definition at line 183 of file CJMenu.h.

00184         { return CMenu::AppendMenu( nFlags, nIDNewItem, lpszNewItem ); }

BOOL CCJMenu::AppendMenuW | ( | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | wchar_t * | lpszNewItem,
 |  | CBitmap * | bmp
 | ) |

Definition at line 1812 of file CJMenu.cpp.

01813 {
01814     if(bmp){
01815         CImageList temp;
01816         temp.Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
01817         if(m_bitmapBackgroundFlag)temp.Add(bmp,m_bitmapBackground);
01818         else temp.Add(bmp,GetSysColor(COLOR_3DFACE));
01819         return AppendODMenuW(lpszNewItem,nFlags,nIDNewItem,&temp,0);
01820     }
01821     return AppendODMenuW(lpszNewItem,nFlags,nIDNewItem,NULL,0);
01822 }

BOOL CCJMenu::AppendMenuW | ( | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | wchar_t * | lpszNewItem,
 |  | CImageList * | il,
 |  | int | xoffset
 | ) |

Definition at line 1801 of file CJMenu.cpp.

01802 {
01803     return AppendODMenuW(lpszNewItem,nFlags,nIDNewItem,il,xoffset);
01804 }

BOOL CCJMenu::AppendMenuW | ( | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | wchar_t * | lpszNewItem,
 |  | int | nIconNormal = -1
 | ) |

Definition at line 1790 of file CJMenu.cpp.

Referenced by AppendMenuA().

01791 {
01792     return AppendODMenuW(lpszNewItem,nFlags,nIDNewItem,nIconNormal);
01793 }

BOOL CCJMenu::AppendODMenuA | ( | LPCSTR | lpstrText,
 |  | UINT | nFlags,
 |  | UINT | nID,
 |  | CImageList * | il,
 |  | int | xoffset
 | ) |

Definition at line 654 of file CJMenu.cpp.

00656 {
00657     USES_CONVERSION;
00658     return AppendODMenuW(A2W(lpstrText),nFlags,nID,il,xoffset);
00659 }

BOOL CCJMenu::AppendODMenuA | ( | LPCSTR | lpstrText,
 |  | UINT | nFlags = MF_OWNERDRAW,
 |  | UINT | nID = 0,
 |  | int | nIconNormal = -1
 | ) |

Definition at line 609 of file CJMenu.cpp.

00611 {
00612     USES_CONVERSION;
00613     return AppendODMenuW(A2W(lpstrText),nFlags,nID,nIconNormal);//SK: See MFC Tech Note 059
00614 }

BOOL CCJMenu::AppendODMenuW | ( | wchar_t * | lpstrText,
 |  | UINT | nFlags,
 |  | UINT | nID,
 |  | CImageList * | il,
 |  | int | xoffset
 | ) |

Definition at line 661 of file CJMenu.cpp.

00663 {
00664     // Add the MF_OWNERDRAW flag if not specified:
00665     if(!nID)nFlags=MF_SEPARATOR|MF_OWNERDRAW;
00666     else if(!(nFlags & MF_OWNERDRAW))nFlags |= MF_OWNERDRAW;
00667
00668     if(nFlags & MF_POPUP){
00669         m_AllSubMenus.Add((HMENU)nID);
00670         m_SubMenus.Add((HMENU)nID);
00671     }
00672
00673     CCJMenuData *mdata = new CCJMenuData;
00674     m_MenuList.Add(mdata);
00675     mdata->SetWideString(lpstrText);    //SK: modified for dynamic allocation
00676
00677     if(il){
00678         mdata->menuIconNormal = 0;
00679         mdata->xoffset=xoffset;
00680         if(mdata->bitmap)mdata->bitmap->Detach();
00681         else mdata->bitmap=new(CImageList);
00682         mdata->bitmap->Attach(ImageList_Duplicate(il->m_hImageList));
00683     }
00684     else{
00685         mdata->menuIconNormal = -1;
00686         mdata->xoffset = -1;
00687     }
00688     mdata->nFlags = nFlags;
00689     mdata->nID = nID;
00690     return(CMenu::AppendMenu(nFlags, nID, (LPCTSTR)mdata));
00691 }

BOOL CCJMenu::AppendODMenuW | ( | wchar_t * | lpstrText,
 |  | UINT | nFlags = MF_OWNERDRAW,
 |  | UINT | nID = 0,
 |  | int | nIconNormal = -1
 | ) |

Definition at line 617 of file CJMenu.cpp.

Referenced by AppendMenuW(), AppendODMenuA(), and AppendODPopupMenuW().

00619 {
00620     // Add the MF_OWNERDRAW flag if not specified:
00621     if(!nID)nFlags=MF_SEPARATOR|MF_OWNERDRAW;
00622     else if(!(nFlags & MF_OWNERDRAW))nFlags |= MF_OWNERDRAW;
00623
00624     if(nFlags & MF_POPUP){
00625         m_AllSubMenus.Add((HMENU)nID);
00626         m_SubMenus.Add((HMENU)nID);
00627     }
00628
00629     CCJMenuData *mdata = new CCJMenuData;
00630     m_MenuList.Add(mdata);
00631     mdata->SetWideString(lpstrText);    //SK: modified for dynamic allocation
00632
00633     mdata->menuIconNormal = nIconNormal;
00634     mdata->xoffset=-1;
00635     if(nIconNormal>=0){
00636         mdata->xoffset=0;
00637         LoadFromToolBar(nID,nIconNormal,mdata->xoffset);
00638         if(mdata->bitmap)mdata->bitmap->DeleteImageList();
00639         else mdata->bitmap=new(CImageList);
00640         mdata->bitmap->Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
00641         if(!AddBitmapToImageList(mdata->bitmap,nIconNormal)){
00642             mdata->bitmap->DeleteImageList();
00643             delete mdata->bitmap;
00644             mdata->bitmap=NULL;
00645             mdata->menuIconNormal = nIconNormal = -1;
00646             mdata->xoffset = -1;
00647         }
00648     }
00649     mdata->nFlags = nFlags;
00650     mdata->nID = nID;
00651     return(CMenu::AppendMenu(nFlags, nID, (LPCTSTR)mdata));
00652 }

CCJMenu * CCJMenu::AppendODPopupMenuA ( LPCSTR lpstrText )

Definition at line 1880 of file CJMenu.cpp.

01881 {
01882     USES_CONVERSION;
01883     return AppendODPopupMenuW(A2W(lpstrText));
01884 }

CCJMenu * CCJMenu::AppendODPopupMenuW ( wchar_t * lpstrText )

Definition at line 1866 of file CJMenu.cpp.

Referenced by AppendODPopupMenuA().

01867 {
01868     CCJMenu* pSubMenu = new CCJMenu;
01869     pSubMenu->m_unselectcheck=m_unselectcheck;
01870     pSubMenu->m_selectcheck=m_selectcheck;
01871     pSubMenu->checkmaps=checkmaps;
01872     pSubMenu->checkmapsshare=TRUE;
01873     pSubMenu->CreatePopupMenu();
01874     AppendODMenuW(lpstrText,MF_POPUP,(UINT)pSubMenu->m_hMenu, -1);
01875     return pSubMenu;
01876 }

void CCJMenu::CCJMenu::DeleteMenuList ( void )

CCJMenuData* CCJMenu::CCJMenu::FindMenuList ( UINT nID )

void CCJMenu::CCJMenu::InitializeMenuList ( int value )

BOOL CCJMenu::DeleteMenu | ( | UINT | uiId,
 |  | UINT | nFlags
 | ) |

Definition at line 1738 of file CJMenu.cpp.

01739 {
01740     if(MF_BYPOSITION&nFlags){
01741         CCJMenu* pSubMenu = (CCJMenu*) GetSubMenu(uiId);
01742         if(NULL==pSubMenu){
01743             UINT uiCommandId = GetMenuItemID(uiId);
01744             for(int i=0;i<m_MenuList.GetSize(); i++){
01745                 if(m_MenuList[i]->nID==uiCommandId){
01746                     delete m_MenuList.GetAt(i);
01747                     m_MenuList.RemoveAt(i);
01748                     break;
01749                 }
01750             }
01751         }
01752         else{
01753             int numSubMenus = m_SubMenus.GetUpperBound();
01754             for(int m = numSubMenus; m >= 0; m--){
01755                 if(m_SubMenus[m]==pSubMenu->m_hMenu){
01756                     int numAllSubMenus = m_AllSubMenus.GetUpperBound();
01757                     for(int n = numAllSubMenus; n>= 0; n--){
01758                         if(m_AllSubMenus[n]==m_SubMenus[m])m_AllSubMenus.RemoveAt(n);
01759                     }
01760                     m_SubMenus.RemoveAt(m);
01761                 }
01762             }
01763             int num = pSubMenu->GetMenuItemCount();
01764             for(int i=num-1;i>=0;--i)pSubMenu->DeleteMenu(i,MF_BYPOSITION);
01765             for(i=m_MenuList.GetUpperBound();i>=0;i--){
01766                 if(m_MenuList[i]->nID==(UINT)pSubMenu->m_hMenu){
01767                     delete m_MenuList.GetAt(i);
01768                     m_MenuList.RemoveAt(i);
01769                     break;
01770                 }
01771             }
01772             delete pSubMenu;
01773         }
01774     }
01775     else{
01776         int iPosition =0;
01777         CCJMenu* pMenu = FindMenuOption(uiId,iPosition);
01778         if(pMenu)pMenu->DeleteMenu(iPosition,MF_BYPOSITION);
01779     }
01780     return CMenu::DeleteMenu(uiId,nFlags);
01781 }

BOOL CCJMenu::DestroyMenu ( ) [virtual]

Definition at line 198 of file CJMenu.cpp.

Referenced by CGfxOutBarCtrl::OnRButtonDown(), CCJFlatHeaderCtrl::OnRButtonDown(), CCJControlBar::OnRButtonDown(), CCJMenuBar::TrackPopup(), and ~CCJMenu().

00199 {
00200     // Destroy Sub menus:
00201     int m,n;
00202     int numAllSubMenus = m_AllSubMenus.GetUpperBound();
00203     for(n = numAllSubMenus; n>= 0; n--){
00204         if(m_AllSubMenus[n]==this->m_hMenu)m_AllSubMenus.RemoveAt(n);
00205     }
00206     int numSubMenus = m_SubMenus.GetUpperBound();
00207     for(m = numSubMenus; m >= 0; m--){
00208         numAllSubMenus = m_AllSubMenus.GetUpperBound();
00209         for(n = numAllSubMenus; n>= 0; n--){
00210             if(m_AllSubMenus[n]==m_SubMenus[m])m_AllSubMenus.RemoveAt(n);
00211         }
00212         delete((CCJMenu *)FromHandle(m_SubMenus[m]));
00213     }
00214     m_SubMenus.RemoveAll();
00215     // Destroy menu data
00216     int numItems = m_MenuList.GetUpperBound();
00217     for(m = 0; m <= numItems; m++)delete(m_MenuList[m]);
00218     m_MenuList.RemoveAll();
00219     if(checkmaps&&!checkmapsshare){
00220         delete checkmaps;
00221         checkmaps=NULL;
00222     }
00223     // Call base-class implementation last:
00224     return(CMenu::DestroyMenu());
00225 };

void CCJMenu::DitherBlt | ( | HDC | hdcDest,
 |  | int | nXDest,
 |  | int | nYDest,
 |  | int | nWidth,
 |  | int | nHeight,
 |  | HBITMAP | hbm,
 |  | int | nXSrc,
 |  | int | nYSrc
 | ) |

Definition at line 1440 of file CJMenu.cpp.

Referenced by DrawItem().

01442 {
01443     ASSERT(hdcDest && hbm);
01444     ASSERT(nWidth > 0 && nHeight > 0);
01445
01446     // Create a generic DC for all BitBlts
01447     HDC hDC = CreateCompatibleDC(hdcDest);
01448     ASSERT(hDC);
01449
01450     if (hDC)
01451     {
01452         // Create a DC for the monochrome DIB section
01453         HDC bwDC = CreateCompatibleDC(hDC);
01454         ASSERT(bwDC);
01455
01456         if (bwDC)
01457         {
01458             // Create the monochrome DIB section with a black and white palette
01459             struct {
01460                 BITMAPINFOHEADER bmiHeader;
01461                 RGBQUAD      bmiColors[2];
01462             } RGBBWBITMAPINFO = {
01463
01464                 {    // a BITMAPINFOHEADER
01465                     sizeof(BITMAPINFOHEADER),  // biSize
01466                         nWidth,         // biWidth;
01467                         nHeight,        // biHeight;
01468                         1,            // biPlanes;
01469                         1,            // biBitCount
01470                         BI_RGB,         // biCompression;
01471                         0,            // biSizeImage;
01472                         0,            // biXPelsPerMeter;
01473                         0,            // biYPelsPerMeter;
01474                         0,            // biClrUsed;
01475                         0            // biClrImportant;
01476                 },
01477                 {
01478                     { 0x00, 0x00, 0x00, 0x00 }, { 0xFF, 0xFF, 0xFF, 0x00 }
01479                     }
01480             };
01481             VOID *pbitsBW;
01482             HBITMAP hbmBW = CreateDIBSection(bwDC,
01483                 (LPBITMAPINFO)&RGBBWBITMAPINFO, DIB_RGB_COLORS, &pbitsBW, NULL, 0);
01484             ASSERT(hbmBW);
01485
01486             if (hbmBW)
01487             {
01488                 // Attach the monochrome DIB section and the bitmap to the DCs
01489                 HBITMAP olddib = (HBITMAP)SelectObject(bwDC, hbmBW);
01490                 HBITMAP hdcolddib = (HBITMAP)SelectObject(hDC, hbm);
01491
01492                 // BitBlt the bitmap into the monochrome DIB section
01493                 BitBlt(bwDC, 0, 0, nWidth, nHeight, hDC, nXSrc, nYSrc, SRCCOPY);
01494
01495                 // Paint the destination rectangle in gray
01496                 FillRect(hdcDest, CRect(nXDest, nYDest, nXDest + nWidth, nYDest +
01497                     nHeight), GetSysColorBrush((IsNewShell())?COLOR_3DFACE:COLOR_MENU));
01498                 //SK: looks better on the old shell
01499                 // BitBlt the black bits in the monochrome bitmap into COLOR_3DHILIGHT
01500                 // bits in the destination DC
01501                 // The magic ROP comes from the Charles Petzold's book
01502                 HBRUSH hb = CreateSolidBrush(GetSysColor(COLOR_3DHILIGHT));
01503                 HBRUSH oldBrush = (HBRUSH)SelectObject(hdcDest, hb);
01504                 BitBlt(hdcDest,nXDest+1,nYDest+1,nWidth,nHeight,bwDC,0,0,0xB8074A);
01505
01506                 // BitBlt the black bits in the monochrome bitmap into COLOR_3DSHADOW
01507                 // bits in the destination DC
01508                 hb = CreateSolidBrush(GetSysColor(COLOR_3DSHADOW));
01509                 DeleteObject(SelectObject(hdcDest, hb));
01510                 BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight,bwDC,0,0,0xB8074A);
01511                 DeleteObject(SelectObject(hdcDest, oldBrush));
01512                 VERIFY(DeleteObject(SelectObject(bwDC, olddib)));
01513                 SelectObject(hDC, hdcolddib);
01514             }
01515
01516             VERIFY(DeleteDC(bwDC));
01517         }
01518
01519         VERIFY(DeleteDC(hDC));
01520     }
01521 }

void CCJMenu::DitherBlt2 | ( | CDC * | drawdc,
 |  | int | nXDest,
 |  | int | nYDest,
 |  | int | nWidth,
 |  | int | nHeight,
 |  | CBitmap & | bmp,
 |  | int | nXSrc,
 |  | int | nYSrc
 | ) |

Definition at line 1617 of file CJMenu.cpp.

Referenced by DrawItem().

01619 {
01620     // create a monochrome memory DC
01621     CDC ddc;
01622     ddc.CreateCompatibleDC(0);
01623     CBitmap bwbmp;
01624     bwbmp.CreateCompatibleBitmap(&ddc, nWidth, nHeight);
01625     CBitmap * pddcOldBmp = ddc.SelectObject(&bwbmp);
01626
01627     CDC dc;
01628     dc.CreateCompatibleDC(0);
01629     CBitmap * pdcOldBmp = dc.SelectObject(&bmp);
01630
01631     // build a mask
01632     ddc.PatBlt(0, 0, nWidth, nHeight, WHITENESS);
01633     dc.SetBkColor(GetSysColor(COLOR_BTNFACE));
01634     ddc.BitBlt(0, 0, nWidth, nHeight, &dc, nXSrc,nYSrc, SRCCOPY);
01635     dc.SetBkColor(GetSysColor(COLOR_BTNHILIGHT));
01636     ddc.BitBlt(0, 0, nWidth, nHeight, &dc, nXSrc,nYSrc, SRCPAINT);
01637
01638     // Copy the image from the toolbar into the memory DC
01639     // and draw it (grayed) back into the toolbar.
01640     dc.FillSolidRect(0,0, nWidth, nHeight, GetSysColor((IsNewShell())?COLOR_3DFACE:COLOR_MENU));
01641     //SK: Looks better on the old shell
01642     dc.SetBkColor(RGB(0, 0, 0));
01643     dc.SetTextColor(RGB(255, 255, 255));
01644     CBrush brShadow, brHilight;
01645     brHilight.CreateSolidBrush(GetSysColor(COLOR_BTNHILIGHT));
01646     brShadow.CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
01647     CBrush * pOldBrush = dc.SelectObject(&brHilight);
01648     dc.BitBlt(0,0, nWidth, nHeight, &ddc, 0, 0, 0x00E20746L);
01649     drawdc->BitBlt(nXDest+1,nYDest+1,nWidth, nHeight, &dc,0,0,SRCCOPY);
01650     dc.BitBlt(1,1, nWidth, nHeight, &ddc, 0, 0, 0x00E20746L);
01651     dc.SelectObject(&brShadow);
01652     dc.BitBlt(0,0, nWidth, nHeight, &ddc, 0, 0, 0x00E20746L);
01653     drawdc->BitBlt(nXDest,nYDest,nWidth, nHeight, &dc,0,0,SRCCOPY);
01654     // reset DCs
01655     ddc.SelectObject(pddcOldBmp);
01656     ddc.DeleteDC();
01657     dc.SelectObject(pOldBrush);
01658     dc.SelectObject(pdcOldBmp);
01659     dc.DeleteDC();
01660
01661     brShadow.DeleteObject();
01662     brHilight.DeleteObject();
01663     bwbmp.DeleteObject();
01664 }

BOOL CCJMenu::Draw3DCheckmark | ( | CDC * | dc,
 |  | const CRect & | rc,
 |  | BOOL | bSelected,
 |  | HBITMAP | hbmCheck
 | ) |

Definition at line 1601 of file CJMenu.cpp.

Referenced by DrawItem().

01603 {
01604     CRect rcDest = rc;
01605     CBrush brush;
01606     COLORREF col=GetSysColor((bSelected||!IsNewShell())?COLOR_MENU:COLOR_3DLIGHT);//SK: Looks better on the old shell
01607     brush.CreateSolidBrush(col);
01608     dc->FillRect(rcDest,&brush);
01609     brush.DeleteObject();
01610     if (IsNewShell()) //SK: looks better on the old shell
01611         dc->DrawEdge(&rcDest, BDR_SUNKENOUTER, BF_RECT);
01612     if (!hbmCheck)DrawCheckMark(dc,rc.left+4,rc.top+4,GetSysColor(COLOR_MENUTEXT));
01613     else DrawRadioDot(dc,rc.left+5,rc.top+4,GetSysColor(COLOR_MENUTEXT));
01614     return TRUE;
01615 }

void CCJMenu::DrawCheckMark | ( | CDC * | pDC,
 |  | int | x,
 |  | int | y,
 |  | COLORREF | color
 | ) |

Definition at line 1291 of file CJMenu.cpp.

Referenced by Draw3DCheckmark().

01292 {
01293     pDC->SetPixel(x,y+2,color);
01294     pDC->SetPixel(x,y+3,color);
01295     pDC->SetPixel(x,y+4,color);
01296
01297     pDC->SetPixel(x+1,y+3,color);
01298     pDC->SetPixel(x+1,y+4,color);
01299     pDC->SetPixel(x+1,y+5,color);
01300
01301     pDC->SetPixel(x+2,y+4,color);
01302     pDC->SetPixel(x+2,y+5,color);
01303     pDC->SetPixel(x+2,y+6,color);
01304
01305     pDC->SetPixel(x+3,y+3,color);
01306     pDC->SetPixel(x+3,y+4,color);
01307     pDC->SetPixel(x+3,y+5,color);
01308
01309     pDC->SetPixel(x+4,y+2,color);
01310     pDC->SetPixel(x+4,y+3,color);
01311     pDC->SetPixel(x+4,y+4,color);
01312
01313     pDC->SetPixel(x+5,y+1,color);
01314     pDC->SetPixel(x+5,y+2,color);
01315     pDC->SetPixel(x+5,y+3,color);
01316
01317     pDC->SetPixel(x+6,y,color);
01318     pDC->SetPixel(x+6,y+1,color);
01319     pDC->SetPixel(x+6,y+2,color);
01320 }

void CCJMenu::DrawItem ( LPDRAWITEMSTRUCT lpDIS ) [virtual]

Definition at line 245 of file CJMenu.cpp.

00246 {
00247     ASSERT(lpDIS != NULL);
00248     CDC* pDC = CDC::FromHandle(lpDIS->hDC);
00249     CRect rect;
00250     UINT state = (((CCJMenuData*)(lpDIS->itemData))->nFlags);
00251     if(state & MF_SEPARATOR){
00252         rect.CopyRect(&lpDIS->rcItem);
00253         rect.top+=rect.Height()>>1;
00254         pDC->DrawEdge(&rect,EDGE_ETCHED,BF_TOP);
00255     }
00256     else{
00257         CRect rect2;
00258         BOOL standardflag=FALSE,selectedflag=FALSE,disableflag=FALSE;
00259         BOOL checkflag=FALSE;
00260         COLORREF crText = GetSysColor(COLOR_MENUTEXT);
00261         COLORREF m_clrBack=GetSysColor(COLOR_MENU);
00262         CBrush m_brBackground,m_brSelect;
00263         CPen m_penBack;
00264         int x0,y0,dy;
00265         int nIconNormal=-1,xoffset=-1;
00266         CImageList *bitmap=NULL;
00267         CFont m_fontMenu;
00268         LOGFONT m_lf;
00269
00270         // set some colors and the font
00271         m_penBack.CreatePen (PS_SOLID,0,GetSysColor(COLOR_MENU));
00272         m_brBackground.CreateSolidBrush(GetSysColor(COLOR_MENU));
00273         m_brSelect.CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
00274         ZeroMemory ((PVOID) &m_lf,sizeof (LOGFONT));
00275         NONCLIENTMETRICS nm;
00276         nm.cbSize = sizeof (NONCLIENTMETRICS);
00277         VERIFY (SystemParametersInfo(SPI_GETNONCLIENTMETRICS,nm.cbSize,&nm,0));
00278         m_lf =  nm.lfMenuFont;
00279         m_fontMenu.CreateFontIndirect (&m_lf);
00280
00281         // draw the colored rectangle portion
00282
00283         rect.CopyRect(&lpDIS->rcItem);
00284         rect2=rect;
00285
00286         // draw the up/down/focused/disabled state
00287
00288         UINT action = lpDIS->itemAction;
00289         UINT state = lpDIS->itemState;
00290         CString strText;
00291         LOGFONT lf;
00292         lf = m_lf;
00293
00294         CFont dispFont;
00295         CFont *pFont=NULL;
00296
00297         if(lpDIS->itemData != NULL){
00298             nIconNormal = (((CCJMenuData*)(lpDIS->itemData))->menuIconNormal);
00299             xoffset = (((CCJMenuData*)(lpDIS->itemData))->xoffset);
00300             bitmap = (((CCJMenuData*)(lpDIS->itemData))->bitmap);
00301             strText = ((CCJMenuData*) (lpDIS->itemData))->GetString();
00302
00303             if(state&ODS_CHECKED && nIconNormal<0){
00304                 if(state&ODS_SELECTED && m_selectcheck>0)checkflag=TRUE;
00305                 else if(m_unselectcheck>0) checkflag=TRUE;
00306             }
00307             else if(nIconNormal != -1){
00308                 standardflag=TRUE;
00309                 if(state&ODS_SELECTED && !(state&ODS_GRAYED))selectedflag=TRUE;
00310                 else if(state&ODS_GRAYED) disableflag=TRUE;
00311             }
00312         }
00313         else{
00314             strText.Empty();
00315         }
00316
00317         if(state&ODS_SELECTED){ // draw the down edges
00318
00319             CPen *pOldPen = pDC->SelectObject (&m_penBack);
00320
00321             // You need only Text highlight and thats what you get
00322
00323             if(checkflag||standardflag||selectedflag||disableflag||state&ODS_CHECKED)
00324                 rect2.SetRect(rect.left+m_iconX+4+GAP,rect.top,rect.right,rect.bottom);
00325             pDC->FillRect (rect2,&m_brSelect);
00326
00327             pDC->SelectObject (pOldPen);
00328             if((HFONT)dispFont != NULL)dispFont.DeleteObject ();
00329             dispFont.CreateFontIndirect (&lf);
00330             crText = GetSysColor(COLOR_HIGHLIGHTTEXT);
00331         }
00332         else {
00333             CPen *pOldPen = pDC->SelectObject (&m_penBack);
00334             pDC->FillRect (rect,&m_brBackground);
00335             pDC->SelectObject (pOldPen);
00336
00337             // draw the up edges
00338
00339             pDC->Draw3dRect (rect,m_clrBack,m_clrBack);
00340             if ((HFONT)dispFont != NULL) dispFont.DeleteObject ();
00341             dispFont.CreateFontIndirect (&lf); //Normal
00342         }
00343
00344         // draw the text if there is any
00345         //We have to paint the text only if the image is nonexistant
00346
00347         dy = (rect.Height()-4-m_iconY)/2;
00348         dy = dy<0 ? 0 : dy;
00349
00350         if(checkflag||standardflag||selectedflag||disableflag){
00351             rect2.SetRect(rect.left+1,rect.top+1+dy,rect.left+m_iconX+3,
00352                 rect.top+m_iconY+3+dy);
00353             pDC->Draw3dRect (rect2,m_clrBack,m_clrBack);
00354             if(checkflag && checkmaps){
00355                 pDC->FillRect (rect2,&m_brBackground);
00356                 rect2.SetRect(rect.left,rect.top+dy,rect.left+m_iconX+4,
00357                     rect.top+m_iconY+4+dy);
00358
00359                 pDC->Draw3dRect (rect2,m_clrBack,m_clrBack);
00360                 CPoint ptImage(rect.left+2,rect.top+2+dy);
00361
00362                 if(state&ODS_SELECTED)checkmaps->Draw(pDC,1,ptImage,ILD_TRANSPARENT);
00363                 else checkmaps->Draw(pDC,0,ptImage,ILD_TRANSPARENT);
00364             }
00365             else if(disableflag){
00366                 if(!selectedflag){
00367                     CBitmap bitmapstandard;
00368                     GetBitmapFromImageList(pDC,bitmap,xoffset,bitmapstandard);
00369                     rect2.SetRect(rect.left,rect.top+dy,rect.left+m_iconX+4,
00370                         rect.top+m_iconY+4+dy);
00371                     pDC->Draw3dRect (rect2,m_clrBack,m_clrBack);
00372                     if(disable_old_style)
00373                         DitherBlt(lpDIS->hDC,rect.left+2,rect.top+2+dy,m_iconX,m_iconY,
00374                         (HBITMAP)(bitmapstandard),0,0);
00375                     else
00376                         DitherBlt2(pDC,rect.left+2,rect.top+2+dy,m_iconX,m_iconY,
00377                         bitmapstandard,0,0);
00378                     bitmapstandard.DeleteObject();
00379                 }
00380             }
00381             else if(selectedflag){
00382                 pDC->FillRect (rect2,&m_brBackground);
00383                 rect2.SetRect(rect.left,rect.top+dy,rect.left+m_iconX+4,
00384                     rect.top+m_iconY+4+dy);
00385                 if (IsNewShell()){
00386                     if(state&ODS_CHECKED)
00387                         pDC->Draw3dRect(rect2,GetSysColor(COLOR_3DSHADOW),
00388                         GetSysColor(COLOR_3DHILIGHT));
00389                     else
00390                         pDC->Draw3dRect(rect2,GetSysColor(COLOR_3DHILIGHT),
00391                         GetSysColor(COLOR_3DSHADOW));
00392                 }
00393                 CPoint ptImage(rect.left+2,rect.top+2+dy);
00394                 if(bitmap)bitmap->Draw(pDC,xoffset,ptImage,ILD_TRANSPARENT);
00395             }
00396             else{
00397                 if(state&ODS_CHECKED){
00398                     CBrush brush;
00399                     COLORREF col =GetSysColor(COLOR_3DLIGHT);
00400                     brush.CreateSolidBrush(col);
00401                     pDC->FillRect(rect2,&brush);
00402                     brush.DeleteObject();
00403                     rect2.SetRect(rect.left,rect.top+dy,rect.left+m_iconX+4,
00404                         rect.top+m_iconY+4+dy);
00405                     if (IsNewShell())
00406                         pDC->Draw3dRect(rect2,GetSysColor(COLOR_3DSHADOW),
00407                         GetSysColor(COLOR_3DHILIGHT));
00408                 }
00409                 else{
00410                     pDC->FillRect (rect2,&m_brBackground);
00411                     rect2.SetRect(rect.left,rect.top+dy,rect.left+m_iconX+4,
00412                         rect.top+m_iconY+4+dy);
00413                     pDC->Draw3dRect (rect2,m_clrBack,m_clrBack);
00414                 }
00415                 CPoint ptImage(rect.left+2,rect.top+2+dy);
00416                 if(bitmap)bitmap->Draw(pDC,xoffset,ptImage,ILD_TRANSPARENT);
00417             }
00418         }
00419         if(nIconNormal<0 && state&ODS_CHECKED && !checkflag){
00420             rect2.SetRect(rect.left+1,rect.top+2+dy,rect.left+m_iconX+1,
00421                 rect.top+m_iconY+2+dy);
00422             CMenuItemInfo info;
00423             info.fMask = MIIM_CHECKMARKS;
00424             ::GetMenuItemInfo((HMENU)lpDIS->hwndItem,lpDIS->itemID,
00425                 MF_BYCOMMAND, &info);
00426             if(state&ODS_CHECKED || info.hbmpUnchecked) {
00427                 Draw3DCheckmark(pDC, rect2, state&ODS_SELECTED,
00428                     state&ODS_CHECKED ? info.hbmpChecked :
00429                 info.hbmpUnchecked);
00430             }
00431         }
00432
00433         //This is needed always so that we can have the space for check marks
00434
00435         x0=rect.left;y0=rect.top;
00436         rect.left = rect.left + m_iconX + 8 + GAP;
00437
00438         if(!strText.IsEmpty()){
00439
00440             CRect rectt(rect.left,rect.top-1,rect.right,rect.bottom-1);
00441
00442             //   Find tabs
00443
00444             CString leftStr,rightStr;
00445             leftStr.Empty();rightStr.Empty();
00446             int tablocr=strText.ReverseFind(_T('\t'));
00447             if(tablocr!=-1){
00448                 rightStr=strText.Mid(tablocr+1);
00449                 leftStr=strText.Left(strText.Find(_T('\t')));
00450                 rectt.right-=m_iconX;
00451             }
00452             else leftStr=strText;
00453
00454             int iOldMode = pDC->GetBkMode();
00455             pDC->SetBkMode( TRANSPARENT);
00456
00457             // Draw the text in the correct colour:
00458
00459             UINT nFormat  = DT_LEFT|DT_SINGLELINE|DT_VCENTER;
00460             UINT nFormatr = DT_RIGHT|DT_SINGLELINE|DT_VCENTER;
00461             if(!(lpDIS->itemState & ODS_GRAYED)){
00462                 pDC->SetTextColor(crText);
00463                 pDC->DrawText (leftStr,rectt,nFormat);
00464                 if(tablocr!=-1) pDC->DrawText (rightStr,rectt,nFormatr);
00465             }
00466             else{
00467
00468                 // Draw the disabled text
00469                 if(!(state & ODS_SELECTED)){
00470                     RECT offset = *rectt;
00471                     offset.left+=1;
00472                     offset.right+=1;
00473                     offset.top+=1;
00474                     offset.bottom+=1;
00475                     pDC->SetTextColor(GetSysColor(COLOR_BTNHILIGHT));
00476                     pDC->DrawText(leftStr,&offset, nFormat);
00477                     if(tablocr!=-1) pDC->DrawText (rightStr,&offset,nFormatr);
00478                     pDC->SetTextColor(GetSysColor(COLOR_GRAYTEXT));
00479                     pDC->DrawText(leftStr,rectt, nFormat);
00480                     if(tablocr!=-1) pDC->DrawText (rightStr,rectt,nFormatr);
00481                 }
00482                 else{
00483                     // And the standard Grey text:
00484                     pDC->SetTextColor(m_clrBack);
00485                     pDC->DrawText(leftStr,rectt, nFormat);
00486                     if(tablocr!=-1) pDC->DrawText (rightStr,rectt,nFormatr);
00487                 }
00488             }
00489             pFont = pDC->SelectObject (&dispFont);
00490             pDC->SetBkMode( iOldMode );
00491             pDC->SelectObject (pFont); //set it to the old font
00492         }
00493
00494         m_penBack.DeleteObject();
00495         m_brBackground.DeleteObject();
00496         m_fontMenu.DeleteObject();
00497         m_brSelect.DeleteObject();
00498         dispFont.DeleteObject ();
00499   }
00500 }

void CCJMenu::DrawRadioDot | ( | CDC * | pDC,
 |  | int | x,
 |  | int | y,
 |  | COLORREF | color
 | ) |

Definition at line 1275 of file CJMenu.cpp.

Referenced by Draw3DCheckmark().

01276 {
01277     CRect rcDot(x,y,x+6,y+6);
01278     CBrush brush;
01279     CPen pen;
01280     brush.CreateSolidBrush(color);
01281     pen.CreatePen(PS_SOLID,0,color);
01282     CBrush *pOldBrush=pDC->SelectObject(&brush);
01283     CPen *pOldPen=pDC->SelectObject(&pen);
01284     pDC->Ellipse(&rcDot);
01285     pDC->SelectObject(pOldBrush);
01286     pDC->SelectObject(pOldPen);
01287     pen.DeleteObject();
01288     brush.DeleteObject();
01289 }

LRESULT CCJMenu::FindKeyboardShortcut | ( | UINT | nChar,
 |  | UINT | nFlags,
 |  | CMenu * | pMenu
 | ) | [static]

Definition at line 1414 of file CJMenu.cpp.

Referenced by CCJTabCtrl::OnMenuChar(), CCJMDIFrameWnd::OnMenuChar(), CCJFrameWnd::OnMenuChar(), CCJFlatHeaderCtrl::OnMenuChar(), and CCJControlBar::OnMenuChar().

01416 {
01417 #ifdef _CPPRTTI
01418     CCJMenu *pCCJMenu = dynamic_cast<CCJMenu *>(pMenu);
01419 #else
01420     CCJMenu *pCCJMenu = (CCJMenu *)pMenu;
01421 #endif
01422     if(pCCJMenu && nFlags&MF_POPUP){
01423         CString key(_T('&'),2);//SK: modified for Unicode correctness
01424         key.SetAt(1,(TCHAR)nChar);
01425         key.MakeLower();
01426         CString menutext;
01427         int menusize = (int)pCCJMenu->GetMenuItemCount();
01428         if(menusize!=(pCCJMenu->m_MenuList.GetUpperBound()+1))
01429             pCCJMenu->SynchronizeMenu();
01430         for(int i=0;i<menusize;++i){
01431             if(pCCJMenu->GetMenuText(i,menutext)){
01432                 menutext.MakeLower();
01433                 if(menutext.Find(key)>=0)return(MAKELRESULT(i,2));
01434             }
01435         }
01436     }
01437     return(0);
01438 }

CCJMenuData * CCJMenu::FindMenuOption ( wchar_t * lpstrText )

Definition at line 1023 of file CJMenu.cpp.

01024 {
01025     int i,j;
01026     CCJMenu *psubmenu;
01027     CCJMenuData *pmenulist;
01028
01029     for(i=0;i<(int)(GetMenuItemCount());++i){
01030 #ifdef _CPPRTTI
01031         psubmenu=dynamic_cast<CCJMenu *>(GetSubMenu(i));
01032 #else
01033         psubmenu=(CCJMenu *)GetSubMenu(i);
01034 #endif
01035         if(psubmenu){
01036             pmenulist=psubmenu->FindMenuOption(lpstrText);
01037             if(pmenulist)return(pmenulist);
01038         }
01039         else{
01040             const wchar_t *szWide;//SK: we use const to prevent misuse of this Ptr
01041             for(j=0;j<=m_MenuList.GetUpperBound();++j){
01042                 szWide = m_MenuList[j]->GetWideString ();
01043                 if(szWide && !wcscmp(lpstrText,szWide))//SK: modified for dynamic allocation
01044                     return(m_MenuList[j]);
01045             }
01046         }
01047     }
01048     return(NULL);
01049 }

CCJMenu * CCJMenu::FindMenuOption | ( | int | nId,
 |  | int & | nLoc
 | ) |

Definition at line 999 of file CJMenu.cpp.

Referenced by AddFromToolBar(), DeleteMenu(), FindMenuOption(), GetMenuText(), ModifyODMenuW(), and RemoveMenu().

01000 {
01001     int i;
01002     CCJMenu *psubmenu,*pgoodmenu;
01003
01004     for(i=0;i<(int)(GetMenuItemCount());++i){
01005 #ifdef _CPPRTTI
01006         psubmenu=dynamic_cast<CCJMenu *>(GetSubMenu(i));
01007 #else
01008         psubmenu=(CCJMenu *)GetSubMenu(i);
01009 #endif
01010         if(psubmenu){
01011             pgoodmenu=psubmenu->FindMenuOption(nId,nLoc);
01012             if(pgoodmenu)return(pgoodmenu);
01013         }
01014         else if(nId==(int)GetMenuItemID(i)){
01015             nLoc=i;
01016             return(this);
01017         }
01018     }
01019     nLoc = -1;
01020     return(NULL);
01021 }

BOOL CCJMenu::GetBitmapFromImageList | ( | CDC * | pDC,
 |  | CImageList * | imglist,
 |  | int | nIndex,
 |  | CBitmap & | bmp
 | ) |

Definition at line 502 of file CJMenu.cpp.

Referenced by DrawItem().

00503 {
00504     HICON hIcon = imglist->ExtractIcon(nIndex);
00505     CDC dc;
00506     dc.CreateCompatibleDC(pDC);
00507     bmp.CreateCompatibleBitmap(pDC,m_iconX,m_iconY);
00508     CBitmap* pOldBmp = dc.SelectObject(&bmp);
00509     CBrush brush ;
00510     brush.CreateSolidBrush(GetSysColor(COLOR_MENU));
00511     ::DrawIconEx(
00512         dc.GetSafeHdc(),
00513         0,
00514         0,
00515         hIcon,
00516         m_iconX,
00517         m_iconY,
00518         0,
00519         (HBRUSH)brush,
00520         DI_NORMAL
00521         );
00522     dc.SelectObject( pOldBmp );
00523     dc.DeleteDC();
00524     // the icon is not longer needed
00525     DestroyIcon(hIcon);
00526     return(TRUE);
00527 }

BOOL CCJMenu::GetDisableOldStyle ( void )

Definition at line 1676 of file CJMenu.cpp.

01677 {
01678     return(disable_old_style);
01679 }

BOOL CCJMenu::GetMenuText | ( | UINT | id,
 |  | CString & | string,
 |  | UINT | nFlags = MF_BYPOSITION
 | ) |

Definition at line 1255 of file CJMenu.cpp.

Referenced by FindKeyboardShortcut().

01256 {
01257     BOOL returnflag=FALSE;
01258
01259     if(MF_BYPOSITION&nFlags){
01260         UINT numMenuItems = m_MenuList.GetUpperBound();
01261         if(id<=numMenuItems){
01262             string=m_MenuList[id]->GetString();
01263             returnflag=TRUE;
01264         }
01265     }
01266     else{
01267         int uiLoc;
01268         CCJMenu* pMenu = FindMenuOption(id,uiLoc);
01269         if(NULL!=pMenu) returnflag = pMenu->GetMenuText(uiLoc,string);
01270     }
01271     return(returnflag);
01272 }

BOOL CCJMenu::InsertMenuA | ( | UINT | nPosition,
 |  | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | const char * | lpszNewItem,
 |  | CBitmap * | bmp
 | ) |

Definition at line 1846 of file CJMenu.cpp.

01847 {
01848     USES_CONVERSION;
01849     return InsertMenuW(nPosition,nFlags,nIDNewItem,A2W(lpszNewItem),bmp);
01850 }

BOOL CCJMenu::InsertMenuA | ( | UINT | nPosition,
 |  | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | const char * | lpszNewItem,
 |  | CImageList * | il,
 |  | int | xoffset
 | ) |

Definition at line 1835 of file CJMenu.cpp.

01836 {
01837     USES_CONVERSION;
01838     return InsertMenuW(nPosition,nFlags,nIDNewItem,A2W(lpszNewItem),il,xoffset);
01839 }

BOOL CCJMenu::InsertMenuA | ( | UINT | nPosition,
 |  | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | const char * | lpszNewItem,
 |  | int | nIconNormal = -1
 | ) |

Definition at line 1824 of file CJMenu.cpp.

01825 {
01826     USES_CONVERSION;
01827     return InsertMenuW(nPosition,nFlags,nIDNewItem,A2W(lpszNewItem),nIconNormal);
01828 }

BOOL CCJMenu::InsertMenuW | ( | UINT | nPosition,
 |  | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | wchar_t * | lpszNewItem,
 |  | CBitmap * | bmp
 | ) |

Definition at line 1852 of file CJMenu.cpp.

01853 {
01854     if(bmp){
01855         CImageList temp;
01856         temp.Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
01857         if(m_bitmapBackgroundFlag)temp.Add(bmp,m_bitmapBackground);
01858         else temp.Add(bmp,GetSysColor(COLOR_3DFACE));
01859         return InsertODMenuW(nPosition,lpszNewItem,nFlags,nIDNewItem,&temp,0);
01860     }
01861     return InsertODMenuW(nPosition,lpszNewItem,nFlags,nIDNewItem,NULL,0);
01862 }

BOOL CCJMenu::InsertMenuW | ( | UINT | nPosition,
 |  | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | wchar_t * | lpszNewItem,
 |  | CImageList * | il,
 |  | int | xoffset
 | ) |

Definition at line 1841 of file CJMenu.cpp.

01842 {
01843     return InsertODMenuW(nPosition,lpszNewItem,nFlags,nIDNewItem,il,xoffset);
01844 }

BOOL CCJMenu::InsertMenuW | ( | UINT | nPosition,
 |  | UINT | nFlags,
 |  | UINT | nIDNewItem,
 |  | wchar_t * | lpszNewItem,
 |  | int | nIconNormal = -1
 | ) |

Definition at line 1830 of file CJMenu.cpp.

Referenced by InsertMenuA().

01831 {
01832     return InsertODMenuW(nPosition,lpszNewItem,nFlags,nIDNewItem,nIconNormal);
01833 }

BOOL CCJMenu::InsertODMenuA | ( | UINT | nPosition,
 |  | LPCSTR | lpstrText,
 |  | UINT | nFlags,
 |  | UINT | nID,
 |  | CImageList * | il,
 |  | int | xoffset
 | ) |

Definition at line 738 of file CJMenu.cpp.

00740 {
00741     USES_CONVERSION;
00742     return InsertODMenuW(nPosition,A2W(lpstrText),nFlags,nID,il,xoffset);
00743 }

BOOL CCJMenu::InsertODMenuA | ( | UINT | nPosition,
 |  | LPCSTR | lpstrText,
 |  | UINT | nFlags = MF_OWNERDRAW,
 |  | UINT | nID = 0,
 |  | int | nIconNormal = -1
 | ) |

Definition at line 693 of file CJMenu.cpp.

00695 {
00696     USES_CONVERSION;
00697     return InsertODMenuW(nPosition,A2W(lpstrText),nFlags,nID,nIconNormal);
00698 }

BOOL CCJMenu::InsertODMenuW | ( | UINT | nPosition,
 |  | wchar_t * | lpstrText,
 |  | UINT | nFlags,
 |  | UINT | nID,
 |  | CImageList * | il,
 |  | int | xoffset
 | ) |

Definition at line 745 of file CJMenu.cpp.

00747 {
00748     // Add the MF_OWNERDRAW flag if not specified:
00749     if(!nID)nFlags=MF_SEPARATOR|MF_OWNERDRAW;
00750     else if(!(nFlags & MF_OWNERDRAW))nFlags |= MF_OWNERDRAW;
00751
00752     if(nFlags & MF_POPUP){
00753         m_AllSubMenus.Add((HMENU)nID);
00754         m_SubMenus.InsertAt(nPosition,(HMENU)nID);
00755     }
00756
00757     CCJMenuData *mdata = new CCJMenuData;
00758     m_MenuList.InsertAt(nPosition,mdata);
00759     mdata->SetWideString(lpstrText);    //SK: modified for dynamic allocation
00760
00761     if(il){
00762         mdata->menuIconNormal = 0;
00763         mdata->xoffset=xoffset;
00764         if(mdata->bitmap)mdata->bitmap->Detach();
00765         else mdata->bitmap=new(CImageList);
00766         mdata->bitmap->Attach(ImageList_Duplicate(il->m_hImageList));
00767     }
00768     else{
00769         mdata->menuIconNormal = -1;
00770         mdata->xoffset = -1;
00771     }
00772     mdata->nFlags = nFlags;
00773     mdata->nID = nID;
00774     return(CMenu::InsertMenu(nPosition,nFlags,nID,(LPCTSTR)mdata));
00775 }

BOOL CCJMenu::InsertODMenuW | ( | UINT | nPosition,
 |  | wchar_t * | lpstrText,
 |  | UINT | nFlags = MF_OWNERDRAW,
 |  | UINT | nID = 0,
 |  | int | nIconNormal = -1
 | ) |

Definition at line 701 of file CJMenu.cpp.

Referenced by InsertMenuW(), and InsertODMenuA().

00703 {
00704     // Add the MF_OWNERDRAW flag if not specified:
00705     if(!nID)nFlags=MF_SEPARATOR|MF_OWNERDRAW;
00706     else if(!(nFlags & MF_OWNERDRAW))nFlags |= MF_OWNERDRAW;
00707
00708     if(nFlags & MF_POPUP){
00709         m_AllSubMenus.Add((HMENU)nID);
00710         m_SubMenus.InsertAt(nPosition,(HMENU)nID);
00711     }
00712
00713     CCJMenuData *mdata = new CCJMenuData;
00714     m_MenuList.InsertAt(nPosition,mdata);
00715     mdata->SetWideString(lpstrText);    //SK: modified for dynamic allocation
00716
00717     mdata->menuIconNormal = nIconNormal;
00718     mdata->xoffset=-1;
00719     if(nIconNormal>=0){
00720         mdata->xoffset=0;
00721         LoadFromToolBar(nID,nIconNormal,mdata->xoffset);
00722         if(mdata->bitmap)mdata->bitmap->DeleteImageList();
00723         else mdata->bitmap=new(CImageList);
00724         mdata->bitmap->Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
00725         if(!AddBitmapToImageList(mdata->bitmap,nIconNormal)){
00726             mdata->bitmap->DeleteImageList();
00727             delete mdata->bitmap;
00728             mdata->bitmap=NULL;
00729             mdata->menuIconNormal = nIconNormal = -1;
00730             mdata->xoffset = -1;
00731         }
00732     }
00733     mdata->nFlags = nFlags;
00734     mdata->nID = nID;
00735     return(CMenu::InsertMenu(nPosition,nFlags,nID,(LPCTSTR)mdata));
00736 }

void CCJMenu::InsertSpaces ( void )

Definition at line 1177 of file CJMenu.cpp.

01178 {
01179     int i,j,numitems,maxlength;
01180     CString string,newstring;
01181     CSize t;
01182     CFont m_fontMenu;
01183     LOGFONT m_lf;
01184
01185     ZeroMemory ((PVOID) &m_lf,sizeof (LOGFONT));
01186     NONCLIENTMETRICS nm;
01187     nm.cbSize = sizeof (NONCLIENTMETRICS);
01188     VERIFY (SystemParametersInfo (SPI_GETNONCLIENTMETRICS,nm.cbSize,&nm,0));
01189     m_lf =  nm.lfMenuFont;
01190     m_fontMenu.CreateFontIndirect (&m_lf);
01191
01192     CWnd *pWnd = AfxGetMainWnd();
01193     CDC *pDC = pWnd->GetDC();
01194     CFont* pFont = pDC->SelectObject (&m_fontMenu);
01195
01196     numitems=GetMenuItemCount();
01197     maxlength = -1;
01198     for(i=0;i<numitems;++i){
01199         string=m_MenuList[i]->GetString();
01200         j=string.Find((char)9);
01201         newstring.Empty();
01202         if(j!=-1)newstring=string.Left(j);
01203         else newstring=string;
01204         newstring+=_T(" ");//SK: modified for Unicode correctness.
01205         LPCTSTR lpstrText = (LPCTSTR)newstring;
01206         t=pDC->GetTextExtent(lpstrText,_tcslen(lpstrText));
01207         if(t.cx>maxlength)maxlength = t.cx;
01208     }
01209     for(i=0;i<numitems;++i){
01210         string=m_MenuList[i]->GetString();
01211         j=string.Find((char)9);
01212         if(j!=-1){
01213             newstring.Empty();
01214             newstring=string.Left(j);
01215             LPCTSTR lpstrText = (LPCTSTR)(newstring);
01216             t=pDC->GetTextExtent(lpstrText,_tcslen(lpstrText));
01217             while(t.cx<maxlength){
01218                 newstring+=_T(' ');//SK: modified for Unicode correctness
01219                 LPCTSTR lpstrText = (LPCTSTR)(newstring);
01220                 t=pDC->GetTextExtent(lpstrText,_tcslen(lpstrText));
01221             }
01222             newstring+=string.Mid(j);
01223 #ifdef UNICODE
01224             m_MenuList[i]->SetWideString(newstring);//SK: modified for dynamic allocation
01225 #else
01226             m_MenuList[i]->SetAnsiString(newstring);
01227 #endif
01228         }
01229     }
01230     pDC->SelectObject (pFont);              // Select old font in
01231     AfxGetMainWnd()->ReleaseDC(pDC);       // Release the DC
01232     m_fontMenu.DeleteObject();
01233 }

BOOL CCJMenu::IsMenu ( HMENU submenu ) [static]

Definition at line 188 of file CJMenu.cpp.

00189 {
00190     int m;
00191     int numSubMenus = m_AllSubMenus.GetUpperBound();
00192     for(m=0;m<=numSubMenus;++m){
00193         if(submenu==m_AllSubMenus[m])return(TRUE);
00194     }
00195     return(FALSE);
00196 }

BOOL CCJMenu::IsMenu ( CMenu * submenu ) [static]

Definition at line 178 of file CJMenu.cpp.

Referenced by CCJTabCtrl::OnInitMenuPopup(), CCJMDIFrameWnd::OnInitMenuPopup(), CCJFrameWnd::OnInitMenuPopup(), CCJFlatHeaderCtrl::OnInitMenuPopup(), CCJControlBar::OnInitMenuPopup(), CCJTabCtrl::OnMeasureItem(), CCJMDIFrameWnd::OnMeasureItem(), CCJFrameWnd::OnMeasureItem(), CCJFlatHeaderCtrl::OnMeasureItem(), CCJControlBar::OnMeasureItem(), CCJTabCtrl::OnMenuChar(), CCJMDIFrameWnd::OnMenuChar(), CCJFrameWnd::OnMenuChar(), CCJFlatHeaderCtrl::OnMenuChar(), and CCJControlBar::OnMenuChar().

00179 {
00180     int m;
00181     int numSubMenus = m_AllSubMenus.GetUpperBound();
00182     for(m=0;m<=numSubMenus;++m){
00183         if(submenu->m_hMenu==m_AllSubMenus[m])return(TRUE);
00184     }
00185     return(FALSE);
00186 }

BOOL CCJMenu::IsNewShell ( void ) [static]

Definition at line 149 of file CJMenu.cpp.

Referenced by DitherBlt(), DitherBlt2(), Draw3DCheckmark(), DrawItem(), and MeasureItem().

00150 {
00151     return (Windoze95==g_Shell || WinNT4orHigher==g_Shell);
00152 }

void CCJMenu::LoadCheckmarkBitmap | ( | int | unselect,
 |  | int | select
 | ) |

Definition at line 1235 of file CJMenu.cpp.

01236 {
01237     if(unselect>0 && select>0){
01238         m_selectcheck=select;
01239         m_unselectcheck=unselect;
01240         if(checkmaps)checkmaps->DeleteImageList();
01241         else checkmaps=new(CImageList);
01242         checkmaps->Create(m_iconX,m_iconY,ILC_MASK,2,1);
01243         BOOL flag1=AddBitmapToImageList(checkmaps,unselect);
01244         BOOL flag2=AddBitmapToImageList(checkmaps,select);
01245         if(!flag1||!flag2){
01246             checkmaps->DeleteImageList();
01247             delete checkmaps;
01248             checkmaps=NULL;
01249         }
01250     }
01251 }

BOOL CCJMenu::LoadFromToolBar | ( | UINT | nID,
 |  | UINT | nToolBar,
 |  | int & | xoffset
 | ) |

Definition at line 980 of file CJMenu.cpp.

Referenced by AppendODMenuW(), InsertODMenuW(), and ModifyODMenuW().

00981 {
00982     int xset,offset;
00983     UINT nStyle;
00984     BOOL returnflag=FALSE;
00985     CToolBar bar;
00986
00987     bar.Create(AfxGetMainWnd());
00988     if(bar.LoadToolBar(nToolBar)){
00989         offset=bar.CommandToIndex(nID);
00990         if(offset>=0){
00991             bar.GetButtonInfo(offset,nID,nStyle,xset);
00992             if(xset>0)xoffset=xset;
00993             returnflag=TRUE;
00994         }
00995     }
00996     return(returnflag);
00997 }

BOOL CCJMenu::LoadMenu ( int nResource ) [virtual]

Definition at line 1052 of file CJMenu.cpp.

01053 {
01054     return(CCJMenu::LoadMenu(MAKEINTRESOURCE(nResource)));
01055 };

BOOL CCJMenu::LoadMenu ( LPCTSTR lpszResourceName ) [virtual]

Definition at line 1057 of file CJMenu.cpp.

Referenced by LoadMenu(), CCJMDIFrameWnd::NewMenu(), CCJFrameWnd::NewMenu(), CCJToolBar::OnDropDownButton(), CGfxOutBarCtrl::OnRButtonDown(), CCJFlatHeaderCtrl::OnRButtonDown(), CCJControlBar::OnRButtonDown(), and CCJMenuBar::TrackPopup().

01058 {
01059     TRACE(_T(
01060         "IMPORTANT:Use CCJMenu::DestroyMenu to destroy Loaded Menu's\n"));
01061     ASSERT_VALID(this);
01062     ASSERT(lpszResourceName != NULL);
01063
01064     // Find the Menu Resource:
01065     HINSTANCE m_hInst = AfxFindResourceHandle(lpszResourceName,RT_MENU);
01066     HRSRC hRsrc = ::FindResource(m_hInst,lpszResourceName,RT_MENU);
01067     if(hRsrc == NULL)return FALSE;
01068
01069     // Get size of resource:
01070
01071     DWORD dwSize = SizeofResource(NULL, hRsrc);
01072
01073     // Load the Menu Resource:
01074
01075     HGLOBAL hGlobal = LoadResource(m_hInst, hRsrc);
01076     if(hGlobal == NULL)return FALSE;
01077
01078     // Attempt to create us as a menu...
01079
01080     if(!CMenu::CreateMenu())return FALSE;
01081
01082     // Get Item template Header, and calculate offset of MENUITEMTEMPLATES
01083
01084     MENUITEMTEMPLATEHEADER *pTpHdr=
01085         (MENUITEMTEMPLATEHEADER*)LockResource(hGlobal);
01086     BYTE* pTp=(BYTE*)pTpHdr +
01087         (sizeof(MENUITEMTEMPLATEHEADER) + pTpHdr->offset);
01088
01089
01090     // Variables needed during processing of Menu Item Templates:
01091
01092     int j=0;
01093     CCJMenuData*  pData = NULL;              // New OD Menu Item Data
01094     WORD    dwFlags = 0;              // Flags of the Menu Item
01095     WORD    dwID  = 0;              // ID of the Menu Item
01096     UINT    uFlags;                  // Actual Flags.
01097     wchar_t *szCaption=NULL;
01098     int      nLen   = 0;                // Length of caption
01099     CTypedPtrArray<CPtrArray, CCJMenu*>  m_Stack;    // Popup menu stack
01100     CArray<BOOL,BOOL>  m_StackEnd;    // Popup menu stack
01101     m_Stack.Add(this);                  // Add it to this...
01102     m_StackEnd.Add(FALSE);
01103
01104     do{
01105         // Obtain Flags and (if necessary), the ID...
01106         memcpy(&dwFlags, pTp, sizeof(WORD));pTp+=sizeof(WORD);// Obtain Flags
01107         if(!(dwFlags & MF_POPUP)){
01108             memcpy(&dwID, pTp, sizeof(WORD)); // Obtain ID
01109             pTp+=sizeof(WORD);
01110         }
01111         else dwID = 0;
01112
01113         uFlags = (UINT)dwFlags; // Remove MF_END from the flags that will
01114         if(uFlags & MF_END) // be passed to the Append(OD)Menu functions.
01115             uFlags -= MF_END;
01116
01117         // Obtain Caption (and length)
01118
01119         nLen = 0;
01120         char *ch = (char*)pTp;
01121         szCaption=new wchar_t[wcslen((wchar_t *)pTp)+1];
01122         wcscpy(szCaption,(wchar_t *)pTp);
01123         pTp=&pTp[(wcslen((wchar_t *)pTp)+1)*sizeof(wchar_t)];//modified SK
01124
01125         // Handle popup menus first....
01126
01127         //WideCharToMultiByte
01128         if(dwFlags & MF_POPUP){
01129             if(dwFlags & MF_END)m_StackEnd.SetAt(m_Stack.GetUpperBound(),TRUE);
01130             CCJMenu* pSubMenu = new CCJMenu;
01131             pSubMenu->m_unselectcheck=m_unselectcheck;
01132             pSubMenu->m_selectcheck=m_selectcheck;
01133             pSubMenu->checkmaps=checkmaps;
01134             pSubMenu->checkmapsshare=TRUE;
01135             pSubMenu->CreatePopupMenu();
01136
01137             // Append it to the top of the stack:
01138
01139             m_Stack[m_Stack.GetUpperBound()]->AppendODMenuW(szCaption,uFlags,
01140                 (UINT)pSubMenu->m_hMenu, -1);
01141             m_Stack.Add(pSubMenu);
01142             m_StackEnd.Add(FALSE);
01143         }
01144         else {
01145             m_Stack[m_Stack.GetUpperBound()]->AppendODMenuW(szCaption, uFlags,
01146                 dwID, -1);
01147             if(dwFlags & MF_END)m_StackEnd.SetAt(m_Stack.GetUpperBound(),TRUE);
01148             j = m_Stack.GetUpperBound();
01149             while(j>=0 && m_StackEnd.GetAt(j)){
01150                 m_Stack[m_Stack.GetUpperBound()]->InsertSpaces();
01151                 m_Stack.RemoveAt(j);
01152                 m_StackEnd.RemoveAt(j);
01153                 --j;
01154             }
01155         }
01156
01157         delete[] szCaption;
01158     }while(m_Stack.GetUpperBound() != -1);
01159
01160     for(int i=0;i<(int)GetMenuItemCount();++i){
01161         CString str=m_MenuList[i]->GetString();
01162
01163         if(GetSubMenu(i)){
01164             m_MenuList[i]->nFlags=MF_POPUP|MF_BYPOSITION;
01165             ModifyMenu(i,MF_POPUP|MF_BYPOSITION,
01166                 (UINT)GetSubMenu(i)->m_hMenu,str);
01167         }
01168         else{
01169             m_MenuList[i]->nFlags=MF_STRING|MF_BYPOSITION;
01170             ModifyMenu(i,MF_STRING|MF_BYPOSITION,m_MenuList[i]->nID,str);
01171         }
01172     }
01173
01174     return(TRUE);
01175 }

HBITMAP CCJMenu::LoadSysColorBitmap ( int nResourceId ) [static]

Definition at line 1682 of file CJMenu.cpp.

Referenced by AddBitmapToImageList().

01683 {
01684     HINSTANCE hInst =
01685         AfxFindResourceHandle(MAKEINTRESOURCE(nResourceId),RT_BITMAP);
01686     HRSRC hRsrc =
01687         ::FindResource(hInst,MAKEINTRESOURCE(nResourceId),RT_BITMAP);
01688     if (hRsrc == NULL)
01689         return NULL;
01690     return AfxLoadSysColorBitmap(hInst, hRsrc, FALSE);
01691 }

BOOL CCJMenu::LoadToolbar ( UINT nToolBar )

Definition at line 960 of file CJMenu.cpp.

Referenced by LoadToolbars(), CCJMDIFrameWnd::NewMenu(), CCJFrameWnd::NewMenu(), CGfxOutBarCtrl::OnRButtonDown(), CCJTabCtrl::OnRButtonDown(), CCJFlatHeaderCtrl::OnRButtonDown(), CCJControlBar::OnRButtonDown(), and CCJMenuBar::TrackPopup().

00961 {
00962     UINT nID;
00963     BOOL returnflag=FALSE;
00964     CToolBar bar;
00965
00966     bar.Create(AfxGetMainWnd());
00967     if(bar.LoadToolBar(nToolBar)){
00968         for(int i=0;i<bar.GetCount();++i){
00969             nID = bar.GetItemID(i);
00970             if(nID && GetMenuState(nID, MF_BYCOMMAND)
00971                 !=0xFFFFFFFF){
00972                 ModifyODMenu(NULL,nID,nToolBar);
00973             }
00974         }
00975         returnflag=TRUE;
00976     }
00977     return(returnflag);
00978 }

BOOL CCJMenu::LoadToolbars | ( | const UINT * | arID,
 |  | int | n
 | ) |

Definition at line 950 of file CJMenu.cpp.

Referenced by CCJMDIFrameWnd::NewMenu(), and CCJFrameWnd::NewMenu().

00951 {
00952     ASSERT(arID);
00953     BOOL returnflag=TRUE;
00954     for(int i=0;i<n;++i){
00955         if(!LoadToolbar(arID[i]))returnflag=FALSE;
00956     }
00957     return(returnflag);
00958 }

void CCJMenu::MeasureItem ( LPMEASUREITEMSTRUCT lpMIS ) [virtual]

Definition at line 541 of file CJMenu.cpp.

Referenced by CCJTabCtrl::OnMeasureItem(), CCJMDIFrameWnd::OnMeasureItem(), CCJFrameWnd::OnMeasureItem(), CCJFlatHeaderCtrl::OnMeasureItem(), and CCJControlBar::OnMeasureItem().

00542 {
00543     UINT state = (((CCJMenuData*)(lpMIS->itemData))->nFlags);
00544     if(state & MF_SEPARATOR){
00545         lpMIS->itemWidth = 0;
00546         lpMIS->itemHeight = GetSystemMetrics(SM_CYMENU)>>1;
00547     }
00548     else{
00549         CFont m_fontMenu;
00550         LOGFONT m_lf;
00551         ZeroMemory ((PVOID) &m_lf,sizeof (LOGFONT));
00552         NONCLIENTMETRICS nm;
00553         nm.cbSize = sizeof (NONCLIENTMETRICS);
00554         VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
00555             nm.cbSize,&nm,0));
00556         m_lf =  nm.lfMenuFont;
00557         m_fontMenu.CreateFontIndirect (&m_lf);
00558
00559         // Obtain the width of the text:
00560         CWnd *pWnd = AfxGetMainWnd();            // Get main window
00561         CDC *pDC = pWnd->GetDC();              // Get device context
00562         CFont* pFont=NULL;    // Select menu font in...
00563
00564         if (IsNewShell())
00565             pFont = pDC->SelectObject (&m_fontMenu);// Select menu font in...
00566
00567         //Get pointer to text SK
00568         const wchar_t *lpstrText = ((CCJMenuData*)(lpMIS->itemData))->GetWideString();//SK: we use const to prevent misuse
00569
00570
00571         SIZE size;
00572
00573         if (Win32s!=g_Shell)
00574             VERIFY(::GetTextExtentPoint32W(pDC->m_hDC,lpstrText,
00575             wcslen(lpstrText),&size)); //SK should also work on 95
00576 #ifndef UNICODE //can't be UNICODE for Win32s
00577         else{//it's Win32suckx
00578             RECT rect;
00579             rect.left=rect.top=0;
00580             size.cy=DrawText(pDC->m_hDC,(LPCTSTR)lpstrText,
00581                 wcslen(lpstrText),&rect,
00582                 DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_CALCRECT);
00583             //+3 makes at least three pixels space to the menu border
00584             size.cx=rect.right-rect.left+3;
00585             size.cx += 3*(size.cx/wcslen(lpstrText));
00586         }
00587 #endif
00588
00589         CSize t = CSize(size);
00590         if(IsNewShell())
00591             pDC->SelectObject (pFont);  // Select old font in
00592         AfxGetMainWnd()->ReleaseDC(pDC);  // Release the DC
00593
00594         // Set width and height:
00595
00596         lpMIS->itemWidth = m_iconX + t.cx + m_iconX + GAP;
00597         int temp = GetSystemMetrics(SM_CYMENU);
00598         lpMIS->itemHeight = temp>m_iconY+4 ? temp : m_iconY+4;
00599         m_fontMenu.DeleteObject();
00600     }
00601 }

BOOL CCJMenu::ModifyODMenuA | ( | const char * | lpstrText,
 |  | const char * | OptionText,
 |  | int | nIconNormal
 | ) |

Definition at line 879 of file CJMenu.cpp.

00881 {
00882     USES_CONVERSION;
00883     return ModifyODMenuW(A2W(lpstrText),A2W(OptionText),nIconNormal);//SK: see MFC  Tech Note 059
00884 }

BOOL CCJMenu::ModifyODMenuA | ( | const char * | lpstrText,
 |  | UINT | nID,
 |  | CBitmap * | bmp
 | ) |

Definition at line 860 of file CJMenu.cpp.

00861 {
00862     USES_CONVERSION;
00863     return ModifyODMenuW(A2W(lpstrText),nID,bmp);
00864 }

BOOL CCJMenu::ModifyODMenuA | ( | const char * | lpstrText,
 |  | UINT | nID,
 |  | CImageList * | il,
 |  | int | xoffset
 | ) |

Definition at line 821 of file CJMenu.cpp.

00822 {
00823     USES_CONVERSION;
00824     return ModifyODMenuW(A2W(lpstrText),nID,il,xoffset);
00825 }

BOOL CCJMenu::ModifyODMenuA | ( | const char * | lpstrText,
 |  | UINT | nID = 0,
 |  | int | nIconNormal = -1
 | ) |

Definition at line 777 of file CJMenu.cpp.

00778 {
00779     USES_CONVERSION;
00780     return ModifyODMenuW(A2W(lpstrText),nID,nIconNormal);//SK: see MFC Tech Note 059
00781 }

BOOL CCJMenu::ModifyODMenuW | ( | wchar_t * | lpstrText,
 |  | wchar_t * | OptionText,
 |  | int | nIconNormal
 | ) |

Definition at line 886 of file CJMenu.cpp.

00888 {
00889     CCJMenuData *mdata;
00890
00891     // Find the old CCJMenuData structure:
00892     CString junk=OptionText;
00893     mdata=FindMenuOption(OptionText);
00894     if(mdata){
00895         if(lpstrText)
00896             mdata->SetWideString(lpstrText);//SK: modified for dynamic allocation
00897         mdata->menuIconNormal = nIconNormal;
00898         mdata->xoffset=-1;
00899         if(nIconNormal>=0){
00900             mdata->xoffset=0;
00901             if(mdata->bitmap)mdata->bitmap->DeleteImageList();
00902             else mdata->bitmap=new(CImageList);
00903             mdata->bitmap->Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
00904             if(!AddBitmapToImageList(mdata->bitmap,nIconNormal)){
00905                 mdata->bitmap->DeleteImageList();
00906                 delete mdata->bitmap;
00907                 mdata->bitmap=NULL;
00908                 mdata->menuIconNormal = nIconNormal = -1;
00909                 mdata->xoffset = -1;
00910             }
00911         }
00912         return(TRUE);
00913     }
00914     return(FALSE);
00915 }

BOOL CCJMenu::ModifyODMenuW | ( | wchar_t * | lpstrText,
 |  | UINT | nID,
 |  | CBitmap * | bmp
 | ) |

Definition at line 866 of file CJMenu.cpp.

00867 {
00868     if(bmp){
00869         CImageList temp;
00870         temp.Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
00871         if(m_bitmapBackgroundFlag)temp.Add(bmp,m_bitmapBackground);
00872         else temp.Add(bmp,GetSysColor(COLOR_3DFACE));
00873         return ModifyODMenuW(lpstrText,nID,&temp,0);
00874     }
00875     return ModifyODMenuW(lpstrText,nID,NULL,0);
00876 }

BOOL CCJMenu::ModifyODMenuW | ( | wchar_t * | lpstrText,
 |  | UINT | nID,
 |  | CImageList * | il,
 |  | int | xoffset
 | ) |

Definition at line 827 of file CJMenu.cpp.

00828 {
00829     int nLoc;
00830     CCJMenuData *mdata;
00831
00832     // Find the old CCJMenuData structure:
00833     CCJMenu *psubmenu = FindMenuOption(nID,nLoc);
00834     if(psubmenu && nLoc>=0)mdata = psubmenu->m_MenuList[nLoc];
00835     else{
00836         // Create a new CCJMenuData structure:
00837         mdata = new CCJMenuData;
00838         m_MenuList.Add(mdata);
00839     }
00840
00841     ASSERT(mdata);
00842     if(lpstrText)
00843         mdata->SetWideString(lpstrText);  //SK: modified for dynamic allocation
00844     if(il){
00845         mdata->menuIconNormal = 0;
00846         mdata->xoffset=xoffset;
00847         if(mdata->bitmap)mdata->bitmap->Detach();
00848         else mdata->bitmap=new(CImageList);
00849         mdata->bitmap->Attach(ImageList_Duplicate(il->m_hImageList));
00850     }
00851     else{
00852         mdata->menuIconNormal = -1;
00853         mdata->xoffset = -1;
00854     }
00855     mdata->nFlags = MF_BYCOMMAND | MF_OWNERDRAW;
00856     mdata->nID = nID;
00857     return (CMenu::ModifyMenu(nID,mdata->nFlags,nID,(LPCTSTR)mdata));
00858 }

BOOL CCJMenu::ModifyODMenuW | ( | wchar_t * | lpstrText,
 |  | UINT | nID = 0,
 |  | int | nIconNormal = -1
 | ) |

Definition at line 783 of file CJMenu.cpp.

Referenced by ModifyODMenuA(), and ModifyODMenuW().

00784 {
00785     int nLoc;
00786     CCJMenuData *mdata;
00787
00788     // Find the old CCJMenuData structure:
00789     CCJMenu *psubmenu = FindMenuOption(nID,nLoc);
00790     if(psubmenu && nLoc>=0)mdata = psubmenu->m_MenuList[nLoc];
00791     else{
00792         // Create a new CCJMenuData structure:
00793         mdata = new CCJMenuData;
00794         m_MenuList.Add(mdata);
00795     }
00796
00797     ASSERT(mdata);
00798     if(lpstrText)
00799         mdata->SetWideString(lpstrText);  //SK: modified for dynamic allocation
00800     mdata->menuIconNormal = nIconNormal;
00801     mdata->xoffset=-1;
00802     if(nIconNormal>=0){
00803         mdata->xoffset=0;
00804         LoadFromToolBar(nID,nIconNormal,mdata->xoffset);
00805         if(mdata->bitmap)mdata->bitmap->DeleteImageList();
00806         else mdata->bitmap=new CImageList;
00807         mdata->bitmap->Create(m_iconX,m_iconY,ILC_COLORDDB|ILC_MASK,1,1);
00808         if(!AddBitmapToImageList(mdata->bitmap,nIconNormal)){
00809             mdata->bitmap->DeleteImageList();
00810             delete mdata->bitmap;
00811             mdata->bitmap=NULL;
00812             mdata->menuIconNormal = nIconNormal = -1;
00813             mdata->xoffset = -1;
00814         }
00815     }
00816     mdata->nFlags = MF_BYCOMMAND | MF_OWNERDRAW;
00817     mdata->nID = nID;
00818     return (CMenu::ModifyMenu(nID,mdata->nFlags,nID,(LPCTSTR)mdata));
00819 }

CCJMenuData * CCJMenu::NewODMenu | ( | UINT | pos,
 |  | UINT | nFlags,
 |  | UINT | nID,
 |  | CString | string
 | ) |

Definition at line 917 of file CJMenu.cpp.

Referenced by SynchronizeMenu().

00918 {
00919     CCJMenuData *mdata;
00920
00921     mdata = new CCJMenuData;
00922     mdata->menuIconNormal = -1;
00923     mdata->xoffset=-1;
00924 #ifdef UNICODE
00925     mdata->SetWideString((LPCTSTR)string);//SK: modified for dynamic allocation
00926 #else
00927     mdata->SetAnsiString(string);
00928 #endif
00929     mdata->nFlags = nFlags;
00930     mdata->nID = nID;
00931
00932     if(nFlags & MF_POPUP)m_AllSubMenus.Add((HMENU)nID);
00933
00934     if (nFlags&MF_OWNERDRAW){
00935         ASSERT(!(nFlags&MF_STRING));
00936         ModifyMenu(pos,nFlags,nID,(LPCTSTR)mdata);
00937     }
00938     else if (nFlags&MF_STRING){
00939         ASSERT(!(nFlags&MF_OWNERDRAW));
00940         ModifyMenu(pos,nFlags,nID,mdata->GetString());
00941     }
00942     else{
00943         ASSERT(nFlags&MF_SEPARATOR);
00944         ModifyMenu(pos,nFlags,nID);
00945     }
00946
00947     return(mdata);
00948 };

BOOL CCJMenu::RemoveMenu | ( | UINT | uiId,
 |  | UINT | nFlags
 | ) |

Definition at line 1693 of file CJMenu.cpp.

01694 {
01695     if(MF_BYPOSITION&nFlags){
01696         CCJMenu* pSubMenu = (CCJMenu*) GetSubMenu(uiId);
01697         if(NULL==pSubMenu){
01698             UINT uiCommandId = GetMenuItemID(uiId);
01699             for(int i=0;i<m_MenuList.GetSize(); i++){
01700                 if(m_MenuList[i]->nID==uiCommandId){
01701                     delete m_MenuList.GetAt(i);
01702                     m_MenuList.RemoveAt(i);
01703                     break;
01704                 }
01705             }
01706         }
01707         else{
01708             int numSubMenus = m_SubMenus.GetUpperBound();
01709             for(int m = numSubMenus; m >= 0; m--){
01710                 if(m_SubMenus[m]==pSubMenu->m_hMenu){
01711                     int numAllSubMenus = m_AllSubMenus.GetUpperBound();
01712                     for(int n = numAllSubMenus; n>= 0; n--){
01713                         if(m_AllSubMenus[n]==m_SubMenus[m])m_AllSubMenus.RemoveAt(n);
01714                     }
01715                     m_SubMenus.RemoveAt(m);
01716                 }
01717             }
01718             int num = pSubMenu->GetMenuItemCount();
01719             for(int i=num-1;i>=0;--i)pSubMenu->RemoveMenu(i,MF_BYPOSITION);
01720             for(i=m_MenuList.GetUpperBound();i>=0;i--){
01721                 if(m_MenuList[i]->nID==(UINT)pSubMenu->m_hMenu){
01722                     delete m_MenuList.GetAt(i);
01723                     m_MenuList.RemoveAt(i);
01724                     break;
01725                 }
01726             }
01727             delete pSubMenu;
01728         }
01729     }
01730     else{
01731         int iPosition =0;
01732         CCJMenu* pMenu = FindMenuOption(uiId,iPosition);
01733         if(pMenu)pMenu->RemoveMenu(iPosition,MF_BYPOSITION);
01734     }
01735     return CMenu::RemoveMenu(uiId,nFlags);
01736 }

void CCJMenu::SetBitmapBackground ( COLORREF color )

Definition at line 1541 of file CJMenu.cpp.

01542 {
01543     m_bitmapBackground=color;
01544     m_bitmapBackgroundFlag=TRUE;
01545 }

void CCJMenu::SetDisableOldStyle ( void )

Definition at line 1666 of file CJMenu.cpp.

01667 {
01668     disable_old_style=TRUE;
01669 }

void CCJMenu::SetIconSize | ( | int | width,
 |  | int | height
 | ) |

Definition at line 603 of file CJMenu.cpp.

00604 {
00605     m_iconX = width;
00606     m_iconY = height;
00607 }

void CCJMenu::SynchronizeMenu ( void )

Definition at line 1348 of file CJMenu.cpp.

Referenced by FindKeyboardShortcut(), and UpdateMenu().

01349 {
01350     CTypedPtrArray<CPtrArray, CCJMenuData*> temp;
01351     CCJMenuData *mdata;
01352     CString string;
01353     UINT submenu,nID=0,state,j;
01354
01355     InitializeMenuList(0);
01356     for(j=0;j<GetMenuItemCount();++j){
01357         mdata=NULL;
01358         state=GetMenuState(j,MF_BYPOSITION);
01359         if(state&MF_POPUP){
01360             submenu=(UINT)GetSubMenu(j)->m_hMenu;
01361             mdata=FindMenuList(submenu);
01362             GetMenuString(j,string,MF_BYPOSITION);
01363             if(!mdata)mdata=NewODMenu(j,
01364                 (state&0xFF)|MF_BYPOSITION|MF_POPUP|MF_OWNERDRAW,submenu,string);
01365             else if(string.GetLength()>0)
01366 #ifdef UNICODE
01367                 mdata->SetWideString(string);  //SK: modified for dynamic allocation
01368 #else
01369             mdata->SetAnsiString(string);
01370 #endif
01371         }
01372         else if(state&MF_SEPARATOR){
01373             mdata=FindMenuList(0);
01374             if(!mdata)mdata=NewODMenu(j,
01375                 state|MF_BYPOSITION|MF_SEPARATOR|MF_OWNERDRAW,0,_T(""));//SK: modified for Unicode correctness
01376             else ModifyMenu(j,mdata->nFlags,nID,(LPCTSTR)mdata);
01377         }
01378         else{
01379             nID=GetMenuItemID(j);
01380             mdata=FindMenuList(nID);
01381             GetMenuString(j,string,MF_BYPOSITION);
01382             if(!mdata)mdata=NewODMenu(j,state|MF_BYPOSITION|MF_OWNERDRAW,
01383                 nID,string);
01384             else{
01385                 mdata->nFlags=state|MF_BYPOSITION|MF_OWNERDRAW;
01386                 if(string.GetLength()>0)
01387 #ifdef UNICODE
01388                     mdata->SetWideString(string);//SK: modified for dynamic allocation
01389 #else
01390                 mdata->SetAnsiString(string);
01391 #endif
01392
01393                 ModifyMenu(j,mdata->nFlags,nID,(LPCTSTR)mdata);
01394             }
01395         }
01396         if(mdata)temp.Add(mdata);
01397     }
01398     DeleteMenuList();
01399     m_MenuList.RemoveAll();
01400     m_MenuList.Append(temp);
01401     temp.RemoveAll();
01402 }

void CCJMenu::UnSetBitmapBackground ( void )

Definition at line 1547 of file CJMenu.cpp.

01548 {
01549     m_bitmapBackgroundFlag=FALSE;
01550 }

void CCJMenu::UnSetDisableOldStyle ( void )

Definition at line 1671 of file CJMenu.cpp.

01672 {
01673     disable_old_style=FALSE;
01674 }

void CCJMenu::UpdateMenu ( CMenu * pmenu ) [static]

Definition at line 1404 of file CJMenu.cpp.

Referenced by CCJTabCtrl::OnInitMenuPopup(), CCJMDIFrameWnd::OnInitMenuPopup(), CCJFrameWnd::OnInitMenuPopup(), CCJFlatHeaderCtrl::OnInitMenuPopup(), and CCJControlBar::OnInitMenuPopup().

01405 {
01406 #ifdef _CPPRTTI
01407     CCJMenu *psubmenu = dynamic_cast<CCJMenu *>(pmenu);
01408 #else
01409     CCJMenu *psubmenu = (CCJMenu *)pmenu;
01410 #endif
01411     if(psubmenu)psubmenu->SynchronizeMenu();
01412 }

Member Data Documentation

CImageList* CCJMenu::checkmaps

Definition at line 140 of file CJMenu.h.

Referenced by AppendODPopupMenuW(), and LoadMenu().

BOOL CCJMenu::checkmapsshare

Definition at line 141 of file CJMenu.h.

Referenced by AppendODPopupMenuW(), and LoadMenu().

BOOL CCJMenu::disable_old_style [protected]

Definition at line 263 of file CJMenu.h.

CTypedPtrArray< CPtrArray, HMENU > CCJMenu::m_AllSubMenus [static, protected]

Definition at line 118 of file CJMenu.cpp.

CTypedPtrArray<CPtrArray, CCJMenuData*> CCJMenu::m_MenuList [protected]

Definition at line 104 of file CJMenu.h.

Referenced by AddFromToolBar(), FindKeyboardShortcut(), and ModifyODMenuW().

CTypedPtrArray<CPtrArray, HMENU> CCJMenu::m_SubMenus [protected]

Definition at line 109 of file CJMenu.h.

COLORREF CCJMenu::m_bitmapBackground [protected]

Definition at line 261 of file CJMenu.h.

BOOL CCJMenu::m_bitmapBackgroundFlag [protected]

Definition at line 262 of file CJMenu.h.

int CCJMenu::m_iconX [protected]

Definition at line 260 of file CJMenu.h.

int CCJMenu::m_iconY [protected]

Definition at line 260 of file CJMenu.h.

int CCJMenu::m_selectcheck

Definition at line 142 of file CJMenu.h.

Referenced by AppendODPopupMenuW(), and LoadMenu().

int CCJMenu::m_unselectcheck

Definition at line 143 of file CJMenu.h.

Referenced by AppendODPopupMenuW(), and LoadMenu().

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMenu.h
  • WinCvs/CJLib/CJLibrary/CJMenu.cpp
Generated on Sun Oct 21 12:46:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJMenuBar Class Reference

#include <CJMenuBar.h>

Inheritance diagram for CCJMenuBar:

[legend]
Collaboration diagram for CCJMenuBar:

[legend]
List of all members.

Public Methods

CCJMenuBar ()
virtual | ~CCJMenuBar ()
virtual BOOL | Create (CWnd *pParentWnd, DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_TOP, UINT nID=AFX_IDW_TOOLBAR)
virtual BOOL | CreateEx (CWnd *pParentWnd, DWORD dwCtrlStyle=TBSTYLE_FLAT, DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_ALIGN_TOP, CRect rcBorders=CRect(0, 0, 0, 0), UINT nID=AFX_IDW_TOOLBAR)
BOOL | LoadMenu (UINT nID)
CCJMenu * GetMenu ()
TRACKINGSTATE | GetTrackingState (int &iPopup)
virtual BOOL | TranslateFrameMessage (MSG *pMsg)

Public Attributes

BOOL | m_bAutoRemoveFrameMenu

Static Public Attributes

BOOL | bTRACE

Protected Methods

void | RecomputeToolbarSize ()
void | RecomputeMenuLayout ()
void | UpdateFont ()
int | GetNextOrPrevButton (int iButton, BOOL bPrev)
void | SetTrackingState (TRACKINGSTATE iState, int iButton=-1)
void | TrackPopup (int iButton)
void | ToggleTrackButtonMode ()
void | CancelMenuAndTrackNewOne (int iButton)
void | OnMenuSelect (HMENU hmenu, UINT nItemID)
CPoint | ComputeMenuTrackPoint (const CRect &rcButn, TPMPARAMS &tpm)
BOOL | IsValidButton (int iButton) const
int | HitTest (CPoint p) const
virtual BOOL | OnMenuInput (MSG &m)
virtual void | OnBarStyleChange (DWORD dwOldStyle, DWORD dwNewStyle)
virtual CSize | CalcFixedLayout (BOOL bStretch, BOOL bHorz)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg void | OnSize (UINT nType, int cx, int cy)
afx_msg void | OnUpdateMenuButton (CCmdUI *pCmdUI)

Static Protected Methods

LRESULT CALLBACK | MenuInputFilter (int code, WPARAM wp, LPARAM lp)

Protected Attributes

CCJMenuBarFrameHook m_frameHook
CStringArray | m_arStrings
int | m_nMenuID
CCJMenu m_popupMenu
int | m_iPopupTracking
int | m_iNewPopup
BOOL | m_bProcessRightArrow
BOOL | m_bProcessLeftArrow
BOOL | m_bEscapeWasPressed
CPoint | m_ptMouse
HMENU | m_hMenuTracking
CFont | m_Font
TRACKINGSTATE m_iTrackingState

Friends

class | CCJMenuBarFrameHook

Constructor & Destructor Documentation

CCJMenuBar::CCJMenuBar ( )

Definition at line 86 of file CJMenuBar.cpp.

00087 {
00088     m_iTrackingState        = TRACK_NONE;   // initial state: not tracking
00089     m_iPopupTracking        = -1;
00090     m_iNewPopup             = -1;           // invalid
00091     m_bAutoRemoveFrameMenu  = TRUE;         // set frame's menu to NULL
00092 }

CCJMenuBar::~CCJMenuBar ( ) [virtual]

Definition at line 94 of file CJMenuBar.cpp.

00095 {
00096     // fix potential resource leak - KStowell - 10-15-99
00097     m_Font.DeleteObject();
00098 }

Member Function Documentation

CSize CCJMenuBar::CalcFixedLayout | ( | BOOL | bStretch,
 |  | BOOL | bHorz
 | ) | [protected, virtual]

Reimplemented from CCJToolBar.

Definition at line 131 of file CJMenuBar.cpp.

00132 {
00133     if( m_bInReBar ) {
00134         return CCJToolBar::CalcFixedLayout(bStretch, bHorz);
00135     }
00136
00137     else
00138     {
00139         CSize size = CCJToolBar::CalcFixedLayout(bStretch, bHorz);
00140         CRect rcClient;
00141         GetParentFrame()->GetClientRect(&rcClient);
00142
00143         if( bHorz ) {
00144             size.cx = rcClient.Width();
00145         }
00146         else {
00147             size.cy = rcClient.Height();
00148         }
00149
00150         return size;
00151     }
00152 }

void CCJMenuBar::CancelMenuAndTrackNewOne ( int iNewPopup ) [protected]

Definition at line 500 of file CJMenuBar.cpp.

Referenced by OnMenuInput().

00501 {
00502     ASSERT_VALID(this);
00503     if (iNewPopup != m_iPopupTracking) {
00504         GetParentFrame()->PostMessage(WM_CANCELMODE); // quit menu loop
00505         m_iNewPopup = iNewPopup;                     // go to this popup (-1 = quit)
00506     }
00507 }

CPoint CCJMenuBar::ComputeMenuTrackPoint | ( | const CRect & | rcButn,
 |  | TPMPARAMS & | tpm
 | ) | [protected]

Definition at line 585 of file CJMenuBar.cpp.

Referenced by TrackPopup().

00586 {
00587     tpm.cbSize = sizeof(tpm);
00588     DWORD dwStyle = m_dwStyle;
00589     CPoint pt;
00590     CRect& rcExclude = (CRect&)tpm.rcExclude;
00591     rcExclude = rcButn;
00592     ::GetWindowRect(::GetDesktopWindow(), &rcExclude);
00593
00594     switch (dwStyle & CBRS_ALIGN_ANY) {
00595     case CBRS_ALIGN_BOTTOM:
00596         pt = CPoint(rcButn.left, rcButn.top);
00597         rcExclude.top = rcButn.top;
00598         break;
00599
00600     case CBRS_ALIGN_LEFT:
00601         pt = CPoint(rcButn.right, rcButn.top);
00602         rcExclude.right = rcButn.right;
00603         break;
00604
00605     case CBRS_ALIGN_RIGHT:
00606         pt = CPoint(rcButn.left, rcButn.top);
00607         rcExclude.left = rcButn.left;
00608         break;
00609
00610     default: // case CBRS_ALIGN_TOP:
00611         pt = CPoint(rcButn.left, rcButn.bottom);
00612         break;
00613     }
00614     return pt;
00615 }

BOOL CCJMenuBar::Create | ( | CWnd * | pParentWnd,
 |  | DWORD | dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP,
 |  | UINT | nID = AFX_IDW_TOOLBAR
 | ) | [virtual]

Reimplemented from CCJToolBar.

Definition at line 111 of file CJMenuBar.cpp.

00112 {
00113     return CreateEx(pParentWnd, NULL, dwStyle,
00114         CRect(m_cxLeftBorder, m_cyTopBorder, m_cxRightBorder, m_cyBottomBorder), nID);
00115 }

BOOL CCJMenuBar::CreateEx | ( | CWnd * | pParentWnd,
 |  | DWORD | dwCtrlStyle = TBSTYLE_FLAT,
 |  | DWORD | dwStyle = WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP,
 |  | CRect | rcBorders = CRect(0, 0, 0, 0),
 |  | UINT | nID = AFX_IDW_TOOLBAR
 | ) | [virtual]

Reimplemented from CCJToolBar.

Definition at line 117 of file CJMenuBar.cpp.

00118 {
00119     if( !CCJToolBar::CreateEx( pParentWnd, dwCtrlStyle, dwStyle, rcBorders, nID))
00120         return FALSE;
00121
00122     UpdateFont();
00123     m_frameHook.Install(this, *pParentWnd);
00124
00125     SetWindowText(_T("Menu Bar"));
00126     return TRUE;
00127 }

_CJXLIB_INLINE CCJMenu * CCJMenuBar::GetMenu ( )

Definition at line 195 of file CJMenuBar.h.

00196     { return &m_popupMenu; }

int CCJMenuBar::GetNextOrPrevButton | ( | int | iButton,
 |  | BOOL | bPrev
 | ) | [protected]

Definition at line 243 of file CJMenuBar.cpp.

Referenced by OnMenuInput(), and TranslateFrameMessage().

00244 {
00245     ASSERT_VALID(this);
00246     if (bPrev) {
00247         iButton--;
00248         if (iButton <0)
00249             iButton = GetButtonCount() - 1;
00250     } else {
00251         iButton++;
00252         if (iButton >= GetButtonCount())
00253             iButton = 0;
00254     }
00255     return iButton;
00256 }

_CJXLIB_INLINE TRACKINGSTATE CCJMenuBar::GetTrackingState ( int & iPopup )

Definition at line 198 of file CJMenuBar.h.

00199     { iPopup = m_iPopupTracking; return m_iTrackingState; }

int CCJMenuBar::HitTest ( CPoint p ) const [protected]

Reimplemented from CCJToolBar.

Definition at line 263 of file CJMenuBar.cpp.

Referenced by OnLButtonDown(), OnMenuInput(), and OnMouseMove().

00264 {
00265     int iHit = CCJToolBar::HitTest(p);
00266     if (iHit>0) {
00267         CRect rc;
00268         GetClientRect(&rc);
00269         if (!rc.PtInRect(p)) // if point is outside window
00270             iHit = -1;          // can't be a hit!
00271     }
00272     return iHit;
00273 }

_CJXLIB_INLINE BOOL CCJMenuBar::IsValidButton ( int iButton ) const [protected]

Definition at line 192 of file CJMenuBar.h.

Referenced by OnMenuInput(), OnMouseMove(), and OnUpdateMenuButton().

00193     { return 0 <= iButton && iButton < GetButtonCount(); }

BOOL CCJMenuBar::LoadMenu ( UINT nID )

Definition at line 279 of file CJMenuBar.cpp.

00280 {
00281     CFrameWnd* pFrame = GetParentFrame();
00282     ASSERT_VALID(pFrame);
00283
00284     pFrame->GetMenu()->DestroyMenu();
00285     pFrame->SetMenu(NULL);
00286
00287     CMenu menu;
00288     menu.LoadMenu(nID);
00289     m_nMenuID = nID;
00290
00291     // delete existing buttons
00292     int nCount = GetButtonCount();
00293     while (nCount--) {
00294         VERIFY(DeleteButton(0));
00295     }
00296
00297     DWORD dwStyle = GetStyle();
00298     BOOL bModifyStyle = ModifyStyle(0, TBSTYLE_FLAT|TBSTYLE_TRANSPARENT);
00299
00300     SetImageList(NULL);
00301     UINT nMenuItems = menu.GetMenuItemCount();
00302
00303     for( UINT i = 0; i < nMenuItems; i++ )
00304     {
00305         CString strName;
00306         if( menu.GetMenuString(i, strName, MF_BYPOSITION ))
00307         {
00308             TBBUTTON tbb;
00309             memset( &tbb, 0, sizeof( TBBUTTON ));
00310             tbb.idCommand = menu.GetMenuItemID(i);
00311
00312             // Because the toolbar is too brain-damaged to know if it already has
00313             // a string, and is also too brain-dead to even let you delete strings,
00314             // I have to determine if each string has been added already. Otherwise
00315             // in a MDI app, as the menus are repeatedly switched between doc and
00316             // no-doc menus, I will keep adding strings until somebody runs out of
00317             // memory. Sheesh!
00318             //
00319             int iString = -1;
00320             for (int j=0; j<m_arStrings.GetSize(); j++) {
00321                 if (m_arStrings[j] == strName) {
00322                     iString = j; // found it
00323                     break;
00324                 }
00325             }
00326             if (iString <0) {
00327                 // string not found: add it
00328                 iString = AddStrings(strName);
00329                 m_arStrings.SetAtGrow(iString, strName);
00330             }
00331
00332             tbb.iString = iString;
00333             tbb.fsState = TBSTATE_ENABLED;
00334             tbb.fsStyle = TBSTYLE_AUTOSIZE;
00335             tbb.iBitmap = -1;
00336             tbb.idCommand = i;
00337             VERIFY(AddButtons(1, &tbb));
00338         }
00339     }
00340
00341     if( bModifyStyle ) {
00342         SetWindowLong(m_hWnd, GWL_STYLE, dwStyle);
00343     }
00344
00345     if( ::IsMenu( menu )) {
00346         AutoSize();                              // size buttons
00347         RecomputeToolbarSize();              // and menubar itself
00348     }
00349
00350     menu.DestroyMenu();
00351     return TRUE;
00352 }

LRESULT CALLBACK CCJMenuBar::MenuInputFilter | ( | int | code,
 |  | WPARAM | wp,
 |  | LPARAM | lp
 | ) | [static, protected]

Definition at line 437 of file CJMenuBar.cpp.

00438 {
00439     return (code==MSGF_MENU && g_pMenuBar &&
00440         g_pMenuBar->OnMenuInput(*((MSG*)lp))) ? TRUE
00441         : CallNextHookEx(g_hMsgHook, code, wp, lp);
00442 }

void CCJMenuBar::OnBarStyleChange | ( | DWORD | dwOldStyle,
 |  | DWORD | dwNewStyle
 | ) | [protected, virtual]

Reimplemented from CCJToolBar.

Definition at line 407 of file CJMenuBar.cpp.

00408 {
00409     CCJToolBar::OnBarStyleChange(dwOldStyle, dwNewStyle);
00410     RecomputeMenuLayout();
00411 }

void CCJMenuBar::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | pt
 | ) | [protected]

Definition at line 358 of file CJMenuBar.cpp.

00359 {
00360     ASSERT_VALID(this);
00361     int iButton = HitTest(pt);
00362     if (iButton >= 0 && iButton<GetButtonCount()) // if mouse is over a button:
00363         TrackPopup(iButton);                                 //   track it
00364     else                                                         // otherwise:
00365         CCJToolBar::OnLButtonDown(nFlags, pt);   //   pass it on...
00366 }

BOOL CCJMenuBar::OnMenuInput ( MSG & m ) [protected, virtual]

Definition at line 449 of file CJMenuBar.cpp.

Referenced by MenuInputFilter().

00450 {
00451     ASSERT_VALID(this);
00452     ASSERT(m_iTrackingState == TRACK_POPUP); // sanity check
00453     int msg = m.message;
00454
00455     if (msg==WM_KEYDOWN) {
00456         // handle left/right-arow.
00457         TCHAR vkey = static_cast<TCHAR>(m.wParam);
00458
00459         if ((vkey == VK_LEFT  && m_bProcessLeftArrow) ||
00460             (vkey == VK_RIGHT && m_bProcessRightArrow)) {
00461
00462             CancelMenuAndTrackNewOne(
00463                 GetNextOrPrevButton(m_iPopupTracking, vkey==VK_LEFT));
00464             return TRUE; // eat it
00465
00466         } else if (vkey == VK_ESCAPE) {
00467             m_bEscapeWasPressed = TRUE;  // (menu will abort itself)
00468         }
00469
00470     } else if (msg==WM_MOUSEMOVE || msg==WM_LBUTTONDOWN) {
00471         // handle mouse move or click
00472         CPoint pt = m.lParam;
00473         ScreenToClient(&pt);
00474
00475         if (msg == WM_MOUSEMOVE) {
00476             if (pt != m_ptMouse) {
00477                 int iButton = HitTest(pt);
00478                 if (IsValidButton(iButton) && iButton != m_iPopupTracking) {
00479                     // user moved mouse over a different button: track its popup
00480                     CancelMenuAndTrackNewOne(iButton);
00481                 }
00482                 m_ptMouse = pt;
00483             }
00484
00485         } else if (msg == WM_LBUTTONDOWN) {
00486             if (HitTest(pt) == m_iPopupTracking) {
00487                 // user clicked on same button I am tracking: cancel menu
00488                 CancelMenuAndTrackNewOne(-1);
00489                 return TRUE; // eat it
00490             }
00491         }
00492     }
00493     return FALSE; // not handled
00494 }

void CCJMenuBar::OnMenuSelect | ( | HMENU | hmenu,
 |  | UINT | iItem
 | ) | [protected]

Definition at line 418 of file CJMenuBar.cpp.

Referenced by CCJMenuBarFrameHook::WindowProc().

00419 {
00420     if (m_iTrackingState > 0) {
00421         // process right-arrow if item is NOT a submenu
00422         m_bProcessRightArrow = (::GetSubMenu(hmenu, iItem) == NULL);
00423         // process left-arrow if curent menu is one I'm tracking
00424         m_bProcessLeftArrow = TRUE;
00425     }
00426 }

void CCJMenuBar::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | pt
 | ) | [protected]

Definition at line 371 of file CJMenuBar.cpp.

00372 {
00373     ASSERT_VALID(this);
00374
00375     if (m_iTrackingState==TRACK_BUTTON) {
00376
00377         // In button-tracking state, ignore mouse-over to non-button area.
00378         // Normally, the toolbar would de-select the hot item in this case.
00379         //
00380         // Only change the hot item if the mouse has actually moved.
00381         // This is necessary to avoid a bug where the user moves to a different
00382         // button from the one the mouse is over, and presses arrow-down to get
00383         // the menu, then Esc to cancel it. Without this code, the button will
00384         // jump to wherever the mouse is--not right.
00385
00386         int iHot = HitTest(pt);
00387         if (IsValidButton(iHot) && pt != m_ptMouse)
00388             SetHotItem(iHot);
00389         return;          // don't let toolbar get it
00390     }
00391     m_ptMouse = pt; // remember point
00392     CCJToolBar::OnMouseMove(nFlags, pt);
00393 }

void CCJMenuBar::OnSize | ( | UINT | nType,
 |  | int | cx,
 |  | int | cy
 | ) | [protected]

Definition at line 398 of file CJMenuBar.cpp.

00399 {
00400     CCJToolBar::OnSize(nType, cx, cy);
00401     RecomputeMenuLayout();
00402 }

void CCJMenuBar::OnUpdateMenuButton ( CCmdUI * pCmdUI ) [protected]

Definition at line 172 of file CJMenuBar.cpp.

00173 {
00174     ASSERT_VALID(this);
00175     if (IsValidButton(pCmdUI->m_nID))
00176         pCmdUI->Enable(TRUE);
00177 }

void CCJMenuBar::RecomputeMenuLayout ( ) [protected]

Definition at line 182 of file CJMenuBar.cpp.

Referenced by OnBarStyleChange(), and OnSize().

00183 {
00184     SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE |
00185         SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
00186 }

void CCJMenuBar::RecomputeToolbarSize ( ) [protected]

Definition at line 191 of file CJMenuBar.cpp.

Referenced by LoadMenu().

00192 {
00193     // Force toolbar to recompute size
00194     CFrameWnd* pFrame = (CFrameWnd*)GetParentFrame();
00195     ASSERT_VALID(pFrame);
00196     ASSERT(pFrame->IsFrameWnd());
00197     pFrame->RecalcLayout();
00198
00199     // floating frame
00200     pFrame = GetParentFrame();
00201     if (pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)))
00202         pFrame->RecalcLayout();
00203 }

void CCJMenuBar::SetTrackingState | ( | TRACKINGSTATE | iState,
 |  | int | iButton = -1
 | ) | [protected]

Definition at line 208 of file CJMenuBar.cpp.

Referenced by ToggleTrackButtonMode(), TrackPopup(), and TranslateFrameMessage().

00209 {
00210     ASSERT_VALID(this);
00211     if (iState != m_iTrackingState) {
00212         if (iState == TRACK_NONE)
00213             iButton = -1;
00214
00215         SetHotItem(iButton);                     // could be none (-1)
00216
00217         if (iState==TRACK_POPUP) {
00218             // set related state stuff
00219             m_bEscapeWasPressed = FALSE;     // assume Esc key not pressed
00220             m_bProcessRightArrow =           // assume left/right arrow..
00221                 m_bProcessLeftArrow = TRUE; // ..will move to prev/next popup
00222             m_iPopupTracking = iButton;  // which popup I'm tracking
00223         }
00224         m_iTrackingState = iState;
00225     }
00226 }

void CCJMenuBar::ToggleTrackButtonMode ( ) [protected]

Definition at line 231 of file CJMenuBar.cpp.

Referenced by TranslateFrameMessage().

00232 {
00233     ASSERT_VALID(this);
00234     if (m_iTrackingState == TRACK_NONE || m_iTrackingState == TRACK_BUTTON) {
00235         SetTrackingState(m_iTrackingState == TRACK_NONE ?
00236             TRACK_BUTTON : TRACK_NONE, 0);
00237     }
00238 }

void CCJMenuBar::TrackPopup ( int iButton ) [protected]

Definition at line 514 of file CJMenuBar.cpp.

Referenced by OnLButtonDown(), and TranslateFrameMessage().

00515 {
00516     ASSERT_VALID(this);
00517
00518     m_popupMenu.LoadMenu(m_nMenuID);
00519     m_popupMenu.LoadToolbar(m_nMenuID);
00520     ASSERT(::IsMenu(m_popupMenu));
00521
00522     while (iButton >= 0) {                   // while user selects another menu
00523
00524         m_iNewPopup = -1;                        // assume quit after this
00525         PressButton(iButton, TRUE);      // press the button
00526         UpdateWindow();                      // and force repaint now
00527
00528         // post a simulated arrow-down into the message stream
00529         // so TrackPopupMenu will read it and move to the first item
00530         GetParentFrame()->PostMessage(WM_KEYDOWN, VK_DOWN, 1);
00531         GetParentFrame()->PostMessage(WM_KEYUP, VK_DOWN, 1);
00532
00533         SetTrackingState(TRACK_POPUP, iButton); // enter tracking state
00534
00535         // Need to install a hook to trap menu input in order to make
00536         // left/right-arrow keys and "hot" mouse tracking work.
00537         //
00538         ASSERT(g_pMenuBar == NULL);
00539         g_pMenuBar = this;
00540         ASSERT(g_hMsgHook == NULL);
00541         g_hMsgHook = SetWindowsHookEx(WH_MSGFILTER,
00542             MenuInputFilter, NULL, ::GetCurrentThreadId());
00543
00544         // get submenu and display it beneath button
00545         TPMPARAMS tpm;
00546         CRect rcButton;
00547         GetRect(iButton, rcButton);
00548         ClientToScreen(&rcButton);
00549         CPoint pt = ComputeMenuTrackPoint(rcButton, tpm);
00550
00551         CCJMenu* pPopupMenu = (CCJMenu*)m_popupMenu.GetSubMenu(iButton);
00552         pPopupMenu->TrackPopupMenu( TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL,
00553             pt.x, pt.y, GetParentFrame());
00554
00555         // uninstall hook.
00556         ::UnhookWindowsHookEx(g_hMsgHook);
00557         g_hMsgHook = NULL;
00558         g_pMenuBar = NULL;
00559
00560         PressButton(iButton, FALSE);     // un-press button
00561         UpdateWindow();                  // and force repaint now
00562
00563         // If the user exited the menu loop by pressing Escape,
00564         // return to track-button state; otherwise normal non-tracking state.
00565         SetTrackingState(m_bEscapeWasPressed ?
00566             TRACK_BUTTON : TRACK_NONE, iButton);
00567
00568         // If the user moved mouse to a new top-level popup (eg from File to
00569         // Edit button), I will have posted a WM_CANCELMODE to quit
00570         // the first popup, and set m_iNewPopup to the new menu to show.
00571         // Otherwise, m_iNewPopup will be -1 as set above.
00572         // So just set iButton to the next popup menu and keep looping...
00573         iButton = m_iNewPopup;
00574     }
00575
00576     // fix potential resource leak - KStowell - 10-15-99
00577     m_popupMenu.DestroyMenu();
00578 }

BOOL CCJMenuBar::TranslateFrameMessage ( MSG * pMsg ) [virtual]

Definition at line 621 of file CJMenuBar.cpp.

Referenced by CCJFrameWnd::PreTranslateMessage().

00622 {
00623     ASSERT_VALID(this);
00624     ASSERT(pMsg);
00625     UINT msg = pMsg->message;
00626     if (WM_LBUTTONDOWN <= msg && msg <= WM_MOUSELAST) {
00627         if (pMsg->hwnd != m_hWnd && m_iTrackingState > 0) {
00628             // user clicked outside menu bar: exit tracking mode
00629             SetTrackingState(TRACK_NONE);
00630         }
00631
00632     } else if (msg==WM_SYSKEYDOWN || msg==WM_SYSKEYUP || msg==WM_KEYDOWN) {
00633
00634         TCHAR vkey = static_cast<TCHAR>(pMsg->wParam);  // get virt key
00635
00636         BOOL  bAlt = HIWORD(pMsg->lParam) & KF_ALTDOWN;     // Alt key down
00637
00638         if (vkey==VK_MENU ||
00639             (vkey==VK_F10 && !((GetKeyState(VK_SHIFT) & 0x80000000) ||
00640                                (GetKeyState(VK_CONTROL) & 0x80000000) || bAlt))) {
00641
00642             // key is VK_MENU or F10 with no alt/ctrl/shift: toggle menu mode
00643             if (msg==WM_SYSKEYUP) {
00644                 ToggleTrackButtonMode();
00645             }
00646             return TRUE;
00647
00648         } else if ((msg==WM_SYSKEYDOWN || msg==WM_KEYDOWN)) {
00649             if (m_iTrackingState == TRACK_BUTTON) {
00650                 // I am tracking: handle left/right/up/down/space/Esc
00651                 switch (vkey) {
00652                 case VK_LEFT:
00653                 case VK_RIGHT:
00654                     // left or right-arrow: change hot button if tracking buttons
00655                     SetHotItem(GetNextOrPrevButton(GetHotItem(), vkey==VK_LEFT));
00656                     return TRUE;
00657
00658                 case VK_SPACE:  // (personally, I like SPACE to enter menu too)
00659                 case VK_UP:
00660                 case VK_DOWN:
00661                     // up or down-arrow: move into current menu, if any
00662                     TrackPopup(GetHotItem());
00663                     return TRUE;
00664
00665                 case VK_ESCAPE:
00666                     // escape key: exit tracking mode
00667                     SetTrackingState(TRACK_NONE);
00668                     return TRUE;
00669                 }
00670             }
00671
00672             // Handle alphanumeric key: invoke menu. Note that Alt-X
00673             // chars come through as WM_SYSKEYDOWN, plain X as WM_KEYDOWN.
00674             if ((bAlt || m_iTrackingState == TRACK_BUTTON) && isalnum(vkey)) {
00675                 // Alt-X, or else X while in tracking mode
00676                 UINT nID;
00677                 if (MapAccelerator(vkey, nID)) {
00678                     TrackPopup(nID);     // found menu mnemonic: track it
00679                     return TRUE;         // handled
00680                 } else if (m_iTrackingState==TRACK_BUTTON && !bAlt) {
00681                     MessageBeep(0);
00682                     return TRUE;
00683                 }
00684             }
00685
00686             // Default for any key not handled so far: return to no-menu state
00687             if (m_iTrackingState > 0) {
00688                 SetTrackingState(TRACK_NONE);
00689             }
00690         }
00691     }
00692     return FALSE; // not handled, pass along
00693 }

void CCJMenuBar::UpdateFont ( ) [protected]

Definition at line 157 of file CJMenuBar.cpp.

Referenced by CreateEx(), and CCJMenuBarFrameHook::WindowProc().

00158 {
00159     m_Font.DeleteObject();
00160     NONCLIENTMETRICS ncm;
00161     ncm.cbSize = sizeof(ncm);
00162     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00163     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMenuFont));
00164     SetFont(&m_Font);
00165 }

Friends And Related Function Documentation

friend class CCJMenuBarFrameHook [friend]

Definition at line 112 of file CJMenuBar.h.

Member Data Documentation

BOOL CCJMenuBar::bTRACE [static]

Definition at line 137 of file CJMenuBar.h.

CFont CCJMenuBar::m_Font [protected]

Definition at line 127 of file CJMenuBar.h.

CStringArray CCJMenuBar::m_arStrings [protected]

Definition at line 115 of file CJMenuBar.h.

BOOL CCJMenuBar::m_bAutoRemoveFrameMenu

Definition at line 108 of file CJMenuBar.h.

BOOL CCJMenuBar::m_bEscapeWasPressed [protected]

Definition at line 124 of file CJMenuBar.h.

BOOL CCJMenuBar::m_bProcessLeftArrow [protected]

Definition at line 123 of file CJMenuBar.h.

BOOL CCJMenuBar::m_bProcessRightArrow [protected]

Definition at line 122 of file CJMenuBar.h.

CCJMenuBarFrameHook CCJMenuBar::m_frameHook [protected]

Definition at line 114 of file CJMenuBar.h.

HMENU CCJMenuBar::m_hMenuTracking [protected]

Definition at line 126 of file CJMenuBar.h.

int CCJMenuBar::m_iNewPopup [protected]

Definition at line 121 of file CJMenuBar.h.

int CCJMenuBar::m_iPopupTracking [protected]

Definition at line 120 of file CJMenuBar.h.

TRACKINGSTATE CCJMenuBar::m_iTrackingState [protected]

Definition at line 129 of file CJMenuBar.h.

int CCJMenuBar::m_nMenuID [protected]

Definition at line 116 of file CJMenuBar.h.

CCJMenu CCJMenuBar::m_popupMenu [protected]

Definition at line 117 of file CJMenuBar.h.

CPoint CCJMenuBar::m_ptMouse [protected]

Definition at line 125 of file CJMenuBar.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMenuBar.h
  • WinCvs/CJLib/CJLibrary/CJMenuBar.cpp
Generated on Sun Oct 21 12:46:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJMenuBarFrameHook Class Reference

#include <CJMenuBar.h>

Inheritance diagram for CCJMenuBarFrameHook:

[legend]
Collaboration diagram for CCJMenuBarFrameHook:

[legend]
List of all members.

Protected Methods

CCJMenuBarFrameHook ()
~CCJMenuBarFrameHook ()
BOOL | Install (CCJMenuBar *pMenuBar, HWND hWndToHook)
virtual LRESULT | WindowProc (UINT msg, WPARAM wp, LPARAM lp)

Protected Attributes

CCJMenuBar * m_pMenuBar

Friends

class | CCJMenuBar

Constructor & Destructor Documentation

CCJMenuBarFrameHook::CCJMenuBarFrameHook ( ) [protected]

Definition at line 717 of file CJMenuBar.cpp.

00718 {
00719 }

CCJMenuBarFrameHook::~CCJMenuBarFrameHook ( ) [protected]

Definition at line 721 of file CJMenuBar.cpp.

00722 {
00723     HookWindow((HWND)NULL); // (unhook)
00724 }

Member Function Documentation

BOOL CCJMenuBarFrameHook::Install | ( | CCJMenuBar * | pMenuBar,
 |  | HWND | hWndToHook
 | ) | [protected]

Definition at line 729 of file CJMenuBar.cpp.

Referenced by CCJMenuBar::CreateEx().

00730 {
00731     ASSERT_VALID(pMenuBar);
00732     m_pMenuBar = pMenuBar;
00733     return HookWindow(hWndToHook);
00734 }

LRESULT CCJMenuBarFrameHook::WindowProc | ( | UINT | msg,
 |  | WPARAM | wp,
 |  | LPARAM | lp
 | ) | [protected, virtual]

Reimplemented from CSubclassWnd.

Definition at line 739 of file CJMenuBar.cpp.

00740 {
00741     CCJMenuBar& mb = *m_pMenuBar;
00742
00743     switch (msg) {
00744     // The following messages are trapped for the frame window
00745     case WM_SYSCOLORCHANGE:
00746         mb.UpdateFont();
00747         break;
00748
00749     case WM_MENUSELECT:
00750         mb.OnMenuSelect((HMENU)lp, (UINT)LOWORD(wp));
00751         break;
00752     }
00753     return CSubclassWnd::WindowProc(msg, wp, lp);
00754 }

Friends And Related Function Documentation

friend class CCJMenuBar [friend]

Definition at line 63 of file CJMenuBar.h.

Member Data Documentation

CCJMenuBar* CCJMenuBarFrameHook::m_pMenuBar [protected]

Definition at line 64 of file CJMenuBar.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMenuBar.h
  • WinCvs/CJLib/CJLibrary/CJMenuBar.cpp
Generated on Sun Oct 21 12:46:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJMenuData Class Reference

#include <CJMenu.h>

Collaboration diagram for CCJMenuData:

[legend]
List of all members.

Public Methods

CCJMenuData ()
void | SetAnsiString (LPCSTR szAnsiString)
void | SetWideString (const wchar_t *szWideString)
const wchar_t * | GetWideString (void)
~CCJMenuData ()
CString | GetString (void)

Public Attributes

int | xoffset
int | menuIconNormal
UINT | nFlags
UINT | nID
UINT | syncflag
CImageList * | bitmap

Private Attributes

wchar_t * | m_szMenuText

Constructor & Destructor Documentation

CCJMenuData::CCJMenuData ( ) [inline]

Definition at line 50 of file CJMenu.h.

00050                    {menuIconNormal=-1;xoffset=-1;bitmap=NULL;
00051     nFlags=0;nID=0;syncflag=0;m_szMenuText=NULL;};

CCJMenuData::~CCJMenuData ( )

Definition at line 155 of file CJMenu.cpp.

00156 {
00157     if(bitmap)
00158         delete(bitmap);
00159
00160     delete[] m_szMenuText; //Need not check for NULL because ANSI X3J16 allows "delete NULL"
00161 }

Member Function Documentation

CString CCJMenuData::GetString ( void )

Definition at line 102 of file CJMenu.cpp.

Referenced by CCJMenu::GetMenuText(), CCJMenu::InsertSpaces(), CCJMenu::LoadMenu(), and CCJMenu::NewODMenu().

00104 {
00105     CString strText;
00106     if (m_szMenuText)
00107     {
00108 #ifdef UNICODE
00109         strText = m_szMenuText;
00110 #else
00111         USES_CONVERSION;
00112         strText=W2A(m_szMenuText);     //SK:  see MFC Tech Note 059
00113 #endif
00114     }
00115     return strText;
00116 }

const wchar_t* CCJMenuData::GetWideString ( void ) [inline]

Definition at line 54 of file CJMenu.h.

Referenced by CCJMenu::FindMenuOption().

00054 {return m_szMenuText;};

void CCJMenuData::SetAnsiString ( LPCSTR szAnsiString )

Definition at line 96 of file CJMenu.cpp.

Referenced by CCJMenu::InsertSpaces(), CCJMenu::NewODMenu(), and CCJMenu::SynchronizeMenu().

00097 {
00098     USES_CONVERSION;
00099     SetWideString(A2W(szAnsiString));  //SK:  see MFC Tech Note 059
00100 }

void CCJMenuData::SetWideString ( const wchar_t * szWideString )

Definition at line 164 of file CJMenu.cpp.

Referenced by CCJMenu::AppendODMenuW(), CCJMenu::InsertODMenuW(), CCJMenu::InsertSpaces(), CCJMenu::ModifyODMenuW(), CCJMenu::NewODMenu(), SetAnsiString(), and CCJMenu::SynchronizeMenu().

00165 {
00166     delete[] m_szMenuText;//Need not check for NULL because ANSI X3J16 allows "delete NULL"
00167
00168     if (szWideString)
00169     {
00170         m_szMenuText = new wchar_t[sizeof(wchar_t)*(wcslen(szWideString)+1)];
00171         if (m_szMenuText)
00172             wcscpy(m_szMenuText,szWideString);
00173     }
00174     else
00175         m_szMenuText=NULL;//set to NULL so we need not bother about dangling non-NULL Ptrs
00176 }

Member Data Documentation

CImageList* CCJMenuData::bitmap

Definition at line 60 of file CJMenu.h.

Referenced by CCJMenu::AddFromToolBar(), CCJMenu::AppendODMenuW(), CCJMenu::InsertODMenuW(), and CCJMenu::ModifyODMenuW().

wchar_t* CCJMenuData::m_szMenuText [private]

Definition at line 48 of file CJMenu.h.

int CCJMenuData::menuIconNormal

Definition at line 58 of file CJMenu.h.

Referenced by CCJMenu::AddFromToolBar(), CCJMenu::AppendODMenuW(), CCJMenu::InsertODMenuW(), CCJMenu::ModifyODMenuW(), and CCJMenu::NewODMenu().

UINT CCJMenuData::nFlags

Definition at line 59 of file CJMenu.h.

Referenced by CCJMenu::AddFromToolBar(), CCJMenu::AppendODMenuW(), CCJMenu::InsertODMenuW(), CCJMenu::LoadMenu(), CCJMenu::ModifyODMenuW(), CCJMenu::NewODMenu(), and CCJMenu::SynchronizeMenu().

UINT CCJMenuData::nID

Definition at line 59 of file CJMenu.h.

Referenced by CCJMenu::AddFromToolBar(), CCJMenu::AppendODMenuW(), CCJMenu::DeleteMenu(), CCJMenu::InsertODMenuW(), CCJMenu::ModifyODMenuW(), CCJMenu::NewODMenu(), and CCJMenu::RemoveMenu().

UINT CCJMenuData::syncflag

Definition at line 59 of file CJMenu.h.

int CCJMenuData::xoffset

Definition at line 57 of file CJMenu.h.

Referenced by CCJMenu::AddFromToolBar(), CCJMenu::AppendODMenuW(), CCJMenu::InsertODMenuW(), CCJMenu::ModifyODMenuW(), and CCJMenu::NewODMenu().

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMenu.h
  • WinCvs/CJLib/CJLibrary/CJMenu.cpp
Generated on Sun Oct 21 12:46:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJMetaFileButton Class Reference

#include <CJMetaFileButton.h>

Inheritance diagram for CCJMetaFileButton:

[legend]
Collaboration diagram for CCJMetaFileButton:

[legend]
List of all members.

Public Methods

CCJMetaFileButton ()
virtual void | SetMetaFiles (HENHMETAFILE hMetaFile, HENHMETAFILE hMetaFileSel=NULL, HENHMETAFILE hMetaFileFocus=NULL, HENHMETAFILE hMetaFileDisabled=NULL)
virtual void | DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
virtual | ~CCJMetaFileButton ()

Protected Methods

afx_msg void | OnLButtonDblClk (UINT nFlags, CPoint point)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnPaint ()

Private Attributes

HENHMETAFILE | m_hEnhMetaFile
HENHMETAFILE | m_hEnhMetaFileSel
HENHMETAFILE | m_hEnhMetaFileFocus
HENHMETAFILE | m_hEnhMetaFileDisabled

Constructor & Destructor Documentation

CCJMetaFileButton::CCJMetaFileButton ( )

Definition at line 61 of file CJMetaFileButton.cpp.

00062 {
00063 }

CCJMetaFileButton::~CCJMetaFileButton ( ) [virtual]

Definition at line 65 of file CJMetaFileButton.cpp.

00066 {
00067 }

Member Function Documentation

void CCJMetaFileButton::DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct ) [virtual]

Definition at line 100 of file CJMetaFileButton.cpp.

00101 {
00102     ASSERT(lpDrawItemStruct != NULL);
00103
00104     // define some temporary variables.
00105     CDC*  pDC    = CDC::FromHandle( lpDrawItemStruct->hDC );
00106     CRect rcItem = lpDrawItemStruct->rcItem;
00107     int   nState = lpDrawItemStruct->itemState;
00108
00109     // Paint the background.
00110     pDC->FillSolidRect(rcItem, ::GetSysColor(COLOR_3DFACE));
00111
00112     // draw 3D button outline
00113     CPen penOutline(PS_SOLID, 1, GetSysColor(COLOR_BTNTEXT));
00114     CPen penLight(PS_SOLID, 1, GetSysColor(COLOR_BTNHIGHLIGHT));
00115     CPen penDark(PS_SOLID, 1, GetSysColor(COLOR_BTNSHADOW));
00116     CPen* pOldPen = NULL;
00117
00118     if (nState & ODS_SELECTED)
00119     {
00120         pOldPen = pDC->SelectObject(&penDark);
00121         pDC->MoveTo(0, rcItem.bottom - 1);
00122         pDC->LineTo(0, 1);
00123         pDC->LineTo(rcItem.right - 1, 1);
00124     }
00125     else
00126     {
00127         pOldPen = pDC->SelectObject(&penLight);
00128         pDC->MoveTo(0, rcItem.bottom - 2);
00129         pDC->LineTo(0, 1);
00130         pDC->LineTo(rcItem.right - 2, 1);
00131         pDC->SelectObject(&penDark);
00132         pDC->MoveTo(0, rcItem.bottom - 1);
00133         pDC->LineTo(rcItem.right - 2, rcItem.bottom - 1);
00134         pDC->LineTo(rcItem.right - 2, 0);
00135         pDC->MoveTo(1, rcItem.bottom - 2);
00136         pDC->LineTo(rcItem.right - 3, rcItem.bottom - 2);
00137         pDC->LineTo(rcItem.right - 3, 1);
00138     }
00139     pDC->SelectObject(&penOutline);
00140     pDC->MoveTo(0, 0);
00141     pDC->LineTo(rcItem.right - 1, 0);
00142     pDC->LineTo(rcItem.right - 1, rcItem.bottom);
00143
00144     HENHMETAFILE hMetaFile = m_hEnhMetaFile;
00145     if ((nState & ODS_SELECTED) && m_hEnhMetaFileSel != NULL)
00146         hMetaFile = m_hEnhMetaFileSel;
00147     else if ((nState & ODS_FOCUS) && m_hEnhMetaFileFocus != NULL)
00148         hMetaFile = m_hEnhMetaFileFocus;   // third image for focused
00149     else if ((nState & ODS_DISABLED) && m_hEnhMetaFileDisabled != NULL)
00150         hMetaFile = m_hEnhMetaFileDisabled;   // last image for disabled
00151
00152     ASSERT(hMetaFile != NULL);
00153
00154     CRect rcBounds(5,4,0,0);
00155     int iButtonHeight = rcItem.Height();
00156     if (iButtonHeight > 15)
00157         iButtonHeight = 15;
00158     else if (iButtonHeight < 11)
00159         iButtonHeight = 11;
00160     int iArrowWidth = (iButtonHeight / 2) - 3;
00161     rcBounds.right = rcBounds.left + iArrowWidth - 1;
00162     rcBounds.bottom = rcBounds.top + (iArrowWidth * 2) - 2;
00163
00164     if (nState & ODS_SELECTED)
00165         rcBounds += CPoint(1, 1);
00166     pDC->PlayMetaFile(hMetaFile, rcBounds);
00167
00168     // fix potential resource leak - KStowell - 10-21-99
00169     pDC->SelectObject(pOldPen);
00170     penOutline.DeleteObject();
00171     penLight.DeleteObject();
00172     penDark.DeleteObject();
00173 }

BOOL CCJMetaFileButton::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 175 of file CJMetaFileButton.cpp.

00176 {
00177     // KStowell - overridden for flicker-free drawing.
00178     UNUSED_ALWAYS(pDC);
00179     return TRUE;
00180 }

void CCJMetaFileButton::OnLButtonDblClk | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 90 of file CJMetaFileButton.cpp.

00091 {
00092     // Fix for the double click problem with owner drawn buttons
00093     POINT pt;
00094     ::GetCursorPos(&pt);
00095     ::MapWindowPoints(NULL, (HWND)(m_hWnd), &pt, 1);
00096     ::SendMessage((HWND)(m_hWnd), WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x, pt.y));
00097     CButton::OnLButtonDblClk(nFlags, point);
00098 }

void CCJMetaFileButton::OnPaint ( ) [protected]

Definition at line 182 of file CJMetaFileButton.cpp.

00183 {
00184     CPaintDC dc(this); // device context for painting
00185
00186     // KStowell - Get the client rect.
00187     CRect rcClient, rcClip;
00188     dc.GetClipBox( &rcClip );
00189     GetClientRect( &rcClient );
00190
00191     // KStowell - Create a memory device-context. This is done to help reduce
00192     // screen flicker, since we will paint the entire control to the
00193     // off screen device context first.
00194     CDC memDC;
00195     CBitmap bitmap;
00196     memDC.CreateCompatibleDC(&dc);
00197     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00198     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00199
00200     // KStowell - Repaint the background.
00201     memDC.FillSolidRect( rcClient, ::GetSysColor(COLOR_WINDOW) );
00202
00203     // let the control do its default drawing.
00204     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00205
00206     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00207     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00208         rcClip.left, rcClip.top, SRCCOPY );
00209
00210     // KStowell - Cleanup resources.
00211     memDC.SelectObject(pOldBitmap);
00212     memDC.DeleteDC();
00213     bitmap.DeleteObject();
00214 }

void CCJMetaFileButton::SetMetaFiles | ( | HENHMETAFILE | hMetaFile,
 |  | HENHMETAFILE | hMetaFileSel = NULL,
 |  | HENHMETAFILE | hMetaFileFocus = NULL,
 |  | HENHMETAFILE | hMetaFileDisabled = NULL
 | ) | [virtual]

Definition at line 69 of file CJMetaFileButton.cpp.

Referenced by CCJFlatTabCtrl::OnCreate().

00071 {
00072     m_hEnhMetaFile         = hMetaFile;
00073     m_hEnhMetaFileSel      = hMetaFileSel;
00074     m_hEnhMetaFileFocus    = hMetaFileFocus;
00075     m_hEnhMetaFileDisabled = hMetaFileDisabled;
00076 }

Member Data Documentation

HENHMETAFILE CCJMetaFileButton::m_hEnhMetaFile [private]

Definition at line 90 of file CJMetaFileButton.h.

HENHMETAFILE CCJMetaFileButton::m_hEnhMetaFileDisabled [private]

Definition at line 93 of file CJMetaFileButton.h.

HENHMETAFILE CCJMetaFileButton::m_hEnhMetaFileFocus [private]

Definition at line 92 of file CJMetaFileButton.h.

HENHMETAFILE CCJMetaFileButton::m_hEnhMetaFileSel [private]

Definition at line 91 of file CJMetaFileButton.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMetaFileButton.h
  • WinCvs/CJLib/CJLibrary/CJMetaFileButton.cpp
Generated on Sun Oct 21 12:46:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJMiniDockFrameWnd Class Reference

#include <CJMiniDockFrameWnd.h>

Inheritance diagram for CCJMiniDockFrameWnd:

[legend]
Collaboration diagram for CCJMiniDockFrameWnd:

[legend]
List of all members.

Public Methods

CCJMiniDockFrameWnd ()
virtual | ~CCJMiniDockFrameWnd ()
virtual BOOL | Create (CWnd *pParent, DWORD dwBarStyle)

Protected Methods

afx_msg void | OnNcLButtonDown (UINT nHitTest, CPoint point)
afx_msg void | OnNcLButtonDblClk (UINT nHitTest, CPoint point)

Friends

class | CDockBar

Constructor & Destructor Documentation

CCJMiniDockFrameWnd::CCJMiniDockFrameWnd ( )

Definition at line 75 of file CJMiniDockFrameWnd.cpp.

00076 {
00077     // TODO: add construction code here.
00078 }

CCJMiniDockFrameWnd::~CCJMiniDockFrameWnd ( ) [virtual]

Definition at line 80 of file CJMiniDockFrameWnd.cpp.

00081 {
00082     // TODO: add destruction code here.
00083 }

Member Function Documentation

BOOL CCJMiniDockFrameWnd::Create | ( | CWnd * | pParent,
 |  | DWORD | dwBarStyle
 | ) | [virtual]

Definition at line 183 of file CJMiniDockFrameWnd.cpp.

00184 {
00185     // Let the base class do all the work.
00186     if (!CMiniDockFrameWnd::Create(pParent, dwBarStyle))
00187         return FALSE;
00188
00189     // remove the MFS_4THICKFRAME style to allow diagonal
00190     // resizing.
00191     ModifyStyle(MFS_4THICKFRAME, 0);
00192
00193     return TRUE;
00194 }

void CCJMiniDockFrameWnd::OnNcLButtonDblClk | ( | UINT | nHitTest,
 |  | CPoint | point
 | ) | [protected]

Definition at line 157 of file CJMiniDockFrameWnd.cpp.

00158 {
00159     if (nHitTest == HTCAPTION)
00160     {
00161         ActivateTopParent();
00162         CCJSizeDockBar * m_pSizeBar = (CCJSizeDockBar *)&m_wndDockBar;
00163
00164         if ((m_pSizeBar->m_dwStyle & CBRS_FLOAT_MULTI) == 0)
00165         {
00166             int nPos = 1;
00167             CControlBar* pBar = NULL;
00168             while(pBar == NULL && nPos < m_pSizeBar->m_arrBars.GetSize())
00169                 pBar = m_pSizeBar->GetDockedSizeBar(nPos++);
00170
00171             ASSERT(pBar != NULL);
00172             ASSERT_KINDOF(CControlBar, pBar);
00173             ASSERT(pBar->m_pDockContext != NULL);
00174
00175             if (pBar->IsKindOf(RUNTIME_CLASS(CCJControlBar)))
00176                 pBar->m_pDockContext->ToggleDocking();
00177
00178             return;
00179         }
00180     }
00181 }

void CCJMiniDockFrameWnd::OnNcLButtonDown | ( | UINT | nHitTest,
 |  | CPoint | point
 | ) | [protected]

Definition at line 99 of file CJMiniDockFrameWnd.cpp.

00100 {
00101     CCJSizeDockBar *pSizeBar = (CCJSizeDockBar*)&m_wndDockBar;
00102
00103     if (nHitTest == HTCAPTION)
00104     {
00105         ActivateTopParent();
00106         if ((m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0)
00107         {
00108             int nPos = 1;
00109             CControlBar* pBar = NULL;
00110             while(pBar == NULL && nPos < m_wndDockBar.m_arrBars.GetSize())
00111                 pBar = pSizeBar->GetDockedSizeBar(nPos++);
00112             ASSERT(pBar != NULL);
00113             ASSERT_KINDOF(CControlBar, pBar);
00114             ASSERT(pBar->m_pDockContext != NULL);
00115
00116             if (!pBar->IsKindOf(RUNTIME_CLASS(CCJControlBar))) {
00117                 CMiniDockFrameWnd::OnNcLButtonDown(nHitTest,point);
00118                 return;
00119             }
00120
00121             //Yiannhs: This has to be fixed!! when the bar is floating
00122             //         and is over a visible dockbar, it arranges it inside
00123             //         the dock bar and does not drag, by just clicking on the caption
00124             ((CCJDockContext *)pBar->m_pDockContext)->StartDragDockBar(point);
00125             pBar->SetFocus();
00126             return;
00127         }
00128     }
00129
00130     else if (nHitTest >= HTSIZEFIRST && nHitTest <= HTSIZELAST)
00131     {
00132         ActivateTopParent();
00133         int nPos = 1;
00134         CControlBar* pBar = NULL;
00135         while(pBar == NULL && nPos < m_wndDockBar.m_arrBars.GetSize())
00136             pBar = pSizeBar->GetDockedSizeBar(nPos++);
00137
00138         ASSERT(pBar != NULL);
00139         ASSERT_KINDOF(CControlBar, pBar);
00140         ASSERT(pBar->m_pDockContext != NULL);
00141         ASSERT((m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0);
00142
00143         if (!pBar->IsKindOf(RUNTIME_CLASS(CCJControlBar))) {
00144             CMiniDockFrameWnd::OnNcLButtonDown(nHitTest,point);
00145             return;
00146         }
00147
00148         pBar->m_pDockContext->StartResize(nHitTest, point);
00149         return;
00150     }
00151
00152     else {  //Yiannhs
00153         CMiniFrameWnd::OnNcLButtonDown(nHitTest, point);
00154     }
00155 }

Friends And Related Function Documentation

friend class CDockBar [friend]

Definition at line 80 of file CJMiniDockFrameWnd.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMiniDockFrameWnd.h
  • WinCvs/CJLib/CJLibrary/CJMiniDockFrameWnd.cpp
Generated on Sun Oct 21 12:46:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJMonthCalCtrl Class Reference

#include <CJDateTimeCtrl.h>

Inheritance diagram for CCJMonthCalCtrl:

[legend]
Collaboration diagram for CCJMonthCalCtrl:

[legend]
List of all members.

Public Methods

CCJMonthCalCtrl ()
virtual | ~CCJMonthCalCtrl ()
BOOL | Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
BOOL | Create (DWORD dwStyle, const POINT &pt, CWnd *pParentWnd, UINT nID)
BOOL | GetMinReqRect (RECT *pRect) const
int | SetMonthDelta (int iDelta)
int | GetMonthDelta () const
BOOL | SetFirstDayOfWeek (int iDay, int *lpnOld=NULL)
int | GetFirstDayOfWeek (BOOL *pbLocal=NULL) const
COLORREF | GetColor (int nRegion) const
COLORREF | SetColor (int nRegion, COLORREF ref)
BOOL | SizeMinReq (BOOL bRepaint=TRUE)
void | SetToday (const COleDateTime &refDateTime)
void | SetToday (const CTime *pDateTime)
void | SetToday (const LPSYSTEMTIME pDateTime)
BOOL | GetToday (CTime &refTime) const
BOOL | GetToday (COleDateTime &refDateTime) const
BOOL | GetToday (LPSYSTEMTIME pDateTime) const
BOOL | GetCurSel (LPSYSTEMTIME pDateTime) const
BOOL | GetCurSel (CTime &refDateTime) const
BOOL | GetCurSel (COleDateTime &refDateTime) const
BOOL | SetCurSel (const LPSYSTEMTIME pDateTime)
BOOL | SetCurSel (const CTime &refDateTime)
BOOL | SetCurSel (const COleDateTime &refDateTime)
BOOL | SetDayState (int nMonths, LPMONTHDAYSTATE pStates)
BOOL | SetMaxSelCount (int nMax)
int | GetMaxSelCount () const
BOOL | SetRange (const COleDateTime *pMinRange, const COleDateTime *pMaxRange)
BOOL | SetRange (const CTime *pMinRange, const CTime *pMaxRange)
BOOL | SetRange (const LPSYSTEMTIME pMinRange, const LPSYSTEMTIME pMaxRange)
DWORD | GetRange (COleDateTime *pMinRange, COleDateTime *pMaxRange) const
DWORD | GetRange (CTime *pMinRange, CTime *pMaxRange) const
DWORD | GetRange (LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange) const
int | GetMonthRange (COleDateTime &refMinRange, COleDateTime &refMaxRange, DWORD dwFlags) const
int | GetMonthRange (CTime &refMinRange, CTime &refMaxRange, DWORD dwFlags) const
int | GetMonthRange (LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange, DWORD dwFlags) const
BOOL | SetSelRange (const COleDateTime &pMinRange, const COleDateTime &pMaxRange)
BOOL | SetSelRange (const CTime &pMinRange, const CTime &pMaxRange)
BOOL | SetSelRange (const LPSYSTEMTIME pMinRange, const LPSYSTEMTIME pMaxRange)
BOOL | GetSelRange (COleDateTime &refMinRange, COleDateTime &refMaxRange) const
BOOL | GetSelRange (CTime &refMinRange, CTime &refMaxRange) const
BOOL | GetSelRange (LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange) const
DWORD | HitTest (PMCHITTESTINFO pMCHitTest)

Constructor & Destructor Documentation

_CJXLIB_INLINE CCJMonthCalCtrl::CCJMonthCalCtrl ( )

Definition at line 781 of file CJDateTimeCtrl.h.

00782     { }

CCJMonthCalCtrl::~CCJMonthCalCtrl ( ) [virtual]

Definition at line 659 of file CJDateTimeCtrl.cpp.

00660 {
00661     DestroyWindow();
00662 }

Member Function Documentation

BOOL CCJMonthCalCtrl::Create | ( | DWORD | dwStyle,
 |  | const POINT & | pt,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID
 | ) |

Definition at line 468 of file CJDateTimeCtrl.cpp.

00470 {
00471     BOOL bWasVisible = (dwStyle & WS_VISIBLE);
00472     dwStyle &= ~WS_VISIBLE;
00473
00474     CRect rect(pt.x, pt.y, 0, 0);
00475
00476     BOOL bRetVal = FALSE;
00477    if (Create(dwStyle, rect, pParentWnd, nID))
00478     {
00479         if (SizeMinReq())
00480         {
00481             if (bWasVisible)
00482                 ShowWindow(SW_SHOWNA);
00483             bRetVal = TRUE;
00484         }
00485         else
00486             DestroyWindow();
00487     }
00488
00489     return bRetVal;
00490 }

BOOL CCJMonthCalCtrl::Create | ( | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID
 | ) |

Definition at line 451 of file CJDateTimeCtrl.cpp.

Referenced by Create().

00453 {
00454     // initialize common controls
00455 #ifdef _VC_VERSION_5
00456     INITCOMMONCONTROLSEX icex;
00457     icex.dwSize = sizeof(icex);
00458     icex.dwICC = ICC_DATE_CLASSES;
00459     VERIFY(InitCommonControlsEx(&icex));
00460 #else
00461     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_DATE_REG));
00462 #endif
00463
00464     CWnd* pWnd = this;
00465     return pWnd->Create(MONTHCAL_CLASS, NULL, dwStyle, rect, pParentWnd, nID);
00466 }

_CJXLIB_INLINE COLORREF CCJMonthCalCtrl::GetColor ( int nRegion ) const

Definition at line 791 of file CJDateTimeCtrl.h.

00792     { ASSERT(m_hWnd != NULL); return (COLORREF) ::SendMessage(m_hWnd, MCM_GETCOLOR, (WPARAM) nRegion, 0); }

BOOL CCJMonthCalCtrl::GetCurSel ( COleDateTime & refTime ) const

Definition at line 591 of file CJDateTimeCtrl.cpp.

00592 {
00593     ASSERT(::IsWindow(m_hWnd));
00594
00595     // can't use this method on multiple selection controls
00596     ASSERT(!(GetStyle() & MCS_MULTISELECT));
00597
00598     SYSTEMTIME sysTime;
00599     BOOL bResult = (BOOL)
00600         ::SendMessage(m_hWnd, MCM_GETCURSEL, 0, (LPARAM) &sysTime);
00601
00602     if (bResult)
00603         refTime = COleDateTime(sysTime);
00604
00605     return bResult;
00606 }

BOOL CCJMonthCalCtrl::GetCurSel ( CTime & refTime ) const

Definition at line 625 of file CJDateTimeCtrl.cpp.

00626 {
00627     ASSERT(::IsWindow(m_hWnd));
00628
00629     // can't use this method on multiple selection controls
00630     ASSERT(!(GetStyle() & MCS_MULTISELECT));
00631
00632     SYSTEMTIME sysTime;
00633     BOOL bResult = (BOOL)
00634         ::SendMessage(m_hWnd, MCM_GETCURSEL, 0, (LPARAM) &sysTime);
00635
00636     if (bResult)
00637         refTime = CTime(sysTime);
00638
00639     return bResult;
00640 }

_CJXLIB_INLINE BOOL CCJMonthCalCtrl::GetCurSel ( LPSYSTEMTIME pDateTime ) const

Definition at line 805 of file CJDateTimeCtrl.h.

Referenced by DDX_CJMonthCalCtrl().

00806     { ASSERT(m_hWnd != NULL); return (BOOL) ::SendMessage(m_hWnd, MCM_GETCURSEL, 0, (LPARAM) pDateTime); }

int CCJMonthCalCtrl::GetFirstDayOfWeek ( BOOL * pbLocal = NULL ) const

Definition at line 664 of file CJDateTimeCtrl.cpp.

00665 {
00666     ASSERT(::IsWindow(m_hWnd));
00667     DWORD dwResult;
00668     dwResult = (DWORD) ::SendMessage(m_hWnd, MCM_GETFIRSTDAYOFWEEK, 0, 0);
00669
00670     // set *pbLocal to reflect if the first day of week
00671     // matches current locale setting
00672
00673     if (pbLocal)
00674         *pbLocal = HIWORD(dwResult);
00675     return LOWORD(dwResult);
00676 }

_CJXLIB_INLINE int CCJMonthCalCtrl::GetMaxSelCount ( ) const

Definition at line 797 of file CJDateTimeCtrl.h.

00798     { ASSERT(m_hWnd != NULL); return (int) ::SendMessage(m_hWnd, MCM_GETMAXSELCOUNT, 0, 0); }

_CJXLIB_INLINE BOOL CCJMonthCalCtrl::GetMinReqRect ( RECT * pRect ) const

Definition at line 785 of file CJDateTimeCtrl.h.

Referenced by SizeMinReq().

00786     { ASSERT(m_hWnd != NULL); return (BOOL) ::SendMessage(m_hWnd, MCM_GETMINREQRECT, 0, (LPARAM) pRect); }

_CJXLIB_INLINE int CCJMonthCalCtrl::GetMonthDelta ( ) const

Definition at line 789 of file CJDateTimeCtrl.h.

00790     { ASSERT(m_hWnd != NULL); return (int) ::SendMessage(m_hWnd, MCM_GETMONTHDELTA, 0, 0); }

int CCJMonthCalCtrl::GetMonthRange | ( | LPSYSTEMTIME | pMinRange,
 |  | LPSYSTEMTIME | pMaxRange,
 |  | DWORD | dwFlags
 | ) | const

Definition at line 839 of file CJDateTimeCtrl.cpp.

00841 {
00842     ASSERT(::IsWindow(m_hWnd));
00843     ASSERT_POINTER(pMinRange, SYSTEMTIME);
00844     ASSERT_POINTER(pMaxRange, SYSTEMTIME);
00845
00846     SYSTEMTIME sysTimes[2];
00847
00848     int nCount = (int) ::SendMessage(m_hWnd, MCM_GETMONTHRANGE,
00849         (WPARAM) dwFlags, (LPARAM) &sysTimes);
00850
00851     memcpy(pMinRange, &sysTimes[0], sizeof(SYSTEMTIME));
00852     memcpy(pMaxRange, &sysTimes[1], sizeof(SYSTEMTIME));
00853
00854     return nCount;
00855 }

int CCJMonthCalCtrl::GetMonthRange | ( | CTime & | refMinRange,
 |  | CTime & | refMaxRange,
 |  | DWORD | dwFlags
 | ) | const

Definition at line 857 of file CJDateTimeCtrl.cpp.

00859 {
00860     ASSERT(::IsWindow(m_hWnd));
00861     ASSERT(dwFlags == GMR_DAYSTATE || dwFlags == GMR_VISIBLE);
00862
00863     SYSTEMTIME sysTimes[2];
00864     memset(sysTimes, 0, sizeof(sysTimes));
00865     int nCount = (int) ::SendMessage(m_hWnd, MCM_GETMONTHRANGE,
00866         (WPARAM) dwFlags,   (LPARAM) &sysTimes);
00867
00868     refMinRange = CTime(sysTimes[0]);
00869     refMaxRange = CTime(sysTimes[1]);
00870
00871     return nCount;
00872 }

int CCJMonthCalCtrl::GetMonthRange | ( | COleDateTime & | refMinRange,
 |  | COleDateTime & | refMaxRange,
 |  | DWORD | dwFlags
 | ) | const

Definition at line 822 of file CJDateTimeCtrl.cpp.

00824 {
00825     ASSERT(::IsWindow(m_hWnd));
00826     ASSERT(dwFlags == GMR_DAYSTATE || dwFlags == GMR_VISIBLE);
00827
00828     SYSTEMTIME sysTimes[2];
00829     memset(sysTimes, 0, sizeof(sysTimes));
00830     int nCount = (int) ::SendMessage(m_hWnd, MCM_GETMONTHRANGE,
00831         (WPARAM) dwFlags, (LPARAM) &sysTimes);
00832
00833     refMinRange = COleDateTime(sysTimes[0]);
00834     refMaxRange = COleDateTime(sysTimes[1]);
00835
00836     return nCount;
00837 }

DWORD CCJMonthCalCtrl::GetRange | ( | LPSYSTEMTIME | pMinRange,
 |  | LPSYSTEMTIME | pMaxRange
 | ) | const

Definition at line 767 of file CJDateTimeCtrl.cpp.

00769 {
00770     ASSERT(::IsWindow(m_hWnd));
00771
00772     SYSTEMTIME sysTimes[2];
00773     memset(sysTimes, 0, sizeof(sysTimes));
00774
00775     DWORD dwRanges = (DWORD)
00776         ::SendMessage(m_hWnd, MCM_GETRANGE, 0, (LPARAM) &sysTimes);
00777
00778     if (dwRanges & GDTR_MIN && pMinRange)
00779         memcpy(pMinRange, &sysTimes[0], sizeof(SYSTEMTIME));
00780
00781     if (dwRanges & GDTR_MAX && pMaxRange)
00782         memcpy(pMaxRange, &sysTimes[1], sizeof(SYSTEMTIME));
00783
00784     return dwRanges;
00785 }

DWORD CCJMonthCalCtrl::GetRange | ( | CTime * | pMinRange,
 |  | CTime * | pMaxRange
 | ) | const

Definition at line 803 of file CJDateTimeCtrl.cpp.

00804 {
00805     ASSERT(::IsWindow(m_hWnd));
00806
00807     SYSTEMTIME sysTimes[2];
00808     memset(sysTimes, 0, sizeof(sysTimes));
00809
00810     DWORD dwRanges = (DWORD)
00811         ::SendMessage(m_hWnd, MCM_GETRANGE, 0, (LPARAM) &sysTimes);
00812
00813     if (dwRanges & GDTR_MIN && pMinRange)
00814         *pMinRange = CTime(sysTimes[0]);
00815
00816     if (dwRanges & GDTR_MAX && pMaxRange)
00817         *pMaxRange = CTime(sysTimes[1]);
00818
00819     return dwRanges;
00820 }

DWORD CCJMonthCalCtrl::GetRange | ( | COleDateTime * | pMinRange,
 |  | COleDateTime * | pMaxRange
 | ) | const

Definition at line 747 of file CJDateTimeCtrl.cpp.

00749 {
00750     ASSERT(::IsWindow(m_hWnd));
00751
00752     SYSTEMTIME sysTimes[2];
00753     memset(sysTimes, 0, sizeof(sysTimes));
00754
00755     DWORD dwRanges = (DWORD)
00756         ::SendMessage(m_hWnd, MCM_GETRANGE, 0, (LPARAM) &sysTimes);
00757
00758     if (dwRanges & GDTR_MIN && pMinRange)
00759         *pMinRange = COleDateTime(sysTimes[0]);
00760
00761     if (dwRanges & GDTR_MAX && pMaxRange)
00762         *pMaxRange = COleDateTime(sysTimes[1]);
00763
00764     return dwRanges;
00765 }

BOOL CCJMonthCalCtrl::GetSelRange | ( | LPSYSTEMTIME | pMinRange,
 |  | LPSYSTEMTIME | pMaxRange
 | ) | const

Definition at line 874 of file CJDateTimeCtrl.cpp.

00876 {
00877     ASSERT(m_hWnd != NULL);
00878     ASSERT((GetStyle() & MCS_MULTISELECT));
00879
00880     ASSERT_POINTER(pMinRange, SYSTEMTIME);
00881     ASSERT_POINTER(pMaxRange, SYSTEMTIME);
00882
00883     SYSTEMTIME sysTimes[2];
00884     BOOL bReturn = (BOOL) ::SendMessage(m_hWnd, MCM_GETSELRANGE,
00885                                         0, (LPARAM) &sysTimes);
00886
00887     if (bReturn)
00888     {
00889         memcpy(pMinRange, &sysTimes[0], sizeof(SYSTEMTIME));
00890         memcpy(pMaxRange, &sysTimes[1], sizeof(SYSTEMTIME));
00891     }
00892
00893     return bReturn;
00894 }

BOOL CCJMonthCalCtrl::GetSelRange | ( | CTime & | refMinRange,
 |  | CTime & | refMaxRange
 | ) | const

Definition at line 977 of file CJDateTimeCtrl.cpp.

00978 {
00979     // control must have multiple select
00980     ASSERT((GetStyle() & MCS_MULTISELECT));
00981     ASSERT(::IsWindow(m_hWnd));
00982
00983     SYSTEMTIME sysTimes[2];
00984     memset(sysTimes, 0, sizeof(sysTimes));
00985     BOOL bResult = (BOOL)
00986         ::SendMessage(m_hWnd, MCM_GETSELRANGE, 0, (LPARAM) &sysTimes);
00987
00988     if (bResult)
00989     {
00990         refMinRange = CTime(sysTimes[0]);
00991         refMaxRange = CTime(sysTimes[1]);
00992     }
00993     return bResult;
00994 }

BOOL CCJMonthCalCtrl::GetSelRange | ( | COleDateTime & | refMinRange,
 |  | COleDateTime & | refMaxRange
 | ) | const

Definition at line 937 of file CJDateTimeCtrl.cpp.

00939 {
00940     // control must have multiple select
00941     ASSERT((GetStyle() & MCS_MULTISELECT));
00942     ASSERT(::IsWindow(m_hWnd));
00943
00944     SYSTEMTIME sysTimes[2];
00945     memset(sysTimes, 0, sizeof(sysTimes));
00946     BOOL bResult = (BOOL)
00947         ::SendMessage(m_hWnd, MCM_GETSELRANGE, 0, (LPARAM) &sysTimes);
00948
00949     if (bResult)
00950     {
00951         refMinRange = COleDateTime(sysTimes[0]);
00952         refMaxRange = COleDateTime(sysTimes[1]);
00953     }
00954     return bResult;
00955 }

_CJXLIB_INLINE BOOL CCJMonthCalCtrl::GetToday ( LPSYSTEMTIME pDateTime ) const

Definition at line 801 of file CJDateTimeCtrl.h.

00802     { ASSERT(m_hWnd != NULL); return (BOOL) ::SendMessage(m_hWnd, MCM_GETTODAY, 0, (LPARAM) pDateTime); }

BOOL CCJMonthCalCtrl::GetToday ( COleDateTime & refTime ) const

Definition at line 608 of file CJDateTimeCtrl.cpp.

00609 {
00610     ASSERT(::IsWindow(m_hWnd));
00611
00612     // can't use this method on multiple selection controls
00613     ASSERT(!(GetStyle() & MCS_MULTISELECT));
00614
00615     SYSTEMTIME sysTime;
00616     BOOL bResult = (BOOL)
00617         ::SendMessage(m_hWnd, MCM_GETTODAY, 0, (LPARAM) &sysTime);
00618
00619     if (bResult)
00620         refTime = COleDateTime(sysTime);
00621
00622     return bResult;
00623 }

BOOL CCJMonthCalCtrl::GetToday ( CTime & refTime ) const

Definition at line 642 of file CJDateTimeCtrl.cpp.

00643 {
00644     ASSERT(::IsWindow(m_hWnd));
00645
00646     // can't use this method on multiple selection controls
00647     ASSERT(!(GetStyle() & MCS_MULTISELECT));
00648
00649     SYSTEMTIME sysTime;
00650     BOOL bResult = (BOOL)
00651         ::SendMessage(m_hWnd, MCM_GETTODAY, 0, (LPARAM) &sysTime);
00652
00653     if (bResult)
00654         refTime = CTime(sysTime);
00655
00656     return bResult;
00657 }

_CJXLIB_INLINE DWORD CCJMonthCalCtrl::HitTest ( PMCHITTESTINFO pMCHitTest )

Definition at line 783 of file CJDateTimeCtrl.h.

00784     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, MCM_HITTEST, 0, (LPARAM) pMCHitTest); }

_CJXLIB_INLINE COLORREF CCJMonthCalCtrl::SetColor | ( | int | nRegion,
 |  | COLORREF | ref
 | ) |

Definition at line 793 of file CJDateTimeCtrl.h.

00794     { ASSERT(m_hWnd != NULL); return (COLORREF) ::SendMessage(m_hWnd, MCM_SETCOLOR, (WPARAM) nRegion, (LPARAM) ref); }

BOOL CCJMonthCalCtrl::SetCurSel ( const COleDateTime & refTime )

Definition at line 555 of file CJDateTimeCtrl.cpp.

00556 {
00557     ASSERT(::IsWindow(m_hWnd));
00558
00559     SYSTEMTIME sysTime;
00560     BOOL bRetVal = FALSE;
00561
00562     // if the passed time is null or out of range,
00563     // we'll set the control to NULL
00564
00565     if (GetAsSystemTime(refTime, sysTime) &&
00566         refTime.GetStatus() == COleDateTime::valid)
00567     {
00568         bRetVal = (BOOL)
00569             ::SendMessage(m_hWnd, MCM_SETCURSEL, 0, (LPARAM) &sysTime);
00570     }
00571
00572     return bRetVal;
00573 }

BOOL CCJMonthCalCtrl::SetCurSel ( const CTime & refTime )

Definition at line 575 of file CJDateTimeCtrl.cpp.

00576 {
00577     ASSERT(::IsWindow(m_hWnd));
00578
00579     SYSTEMTIME sysTime;
00580     BOOL bRetVal = FALSE;
00581
00582     if (GetAsSystemTime(refTime, sysTime))
00583     {
00584         bRetVal = (BOOL)
00585             ::SendMessage(m_hWnd, MCM_SETCURSEL, 0, (LPARAM) &sysTime);
00586     }
00587
00588     return bRetVal;
00589 }

_CJXLIB_INLINE BOOL CCJMonthCalCtrl::SetCurSel ( const LPSYSTEMTIME pDateTime )

Definition at line 803 of file CJDateTimeCtrl.h.

Referenced by DDX_CJMonthCalCtrl().

00804     { ASSERT(m_hWnd != NULL); return (BOOL) ::SendMessage(m_hWnd, MCM_SETCURSEL, 0, (LPARAM) pDateTime); }

BOOL CCJMonthCalCtrl::SetDayState | ( | int | nMonths,
 |  | LPMONTHDAYSTATE | pStates
 | ) |

Definition at line 690 of file CJDateTimeCtrl.cpp.

00691 {
00692     ASSERT(::IsWindow(m_hWnd));
00693     ASSERT(AfxIsValidAddress(pStates, nMonths * sizeof(MONTHDAYSTATE), FALSE));
00694     return (BOOL) ::SendMessage(m_hWnd, MCM_SETDAYSTATE, (WPARAM) nMonths, (LPARAM) pStates);
00695 }

BOOL CCJMonthCalCtrl::SetFirstDayOfWeek | ( | int | iDay,
 |  | int * | lpnOld = NULL
 | ) |

Definition at line 678 of file CJDateTimeCtrl.cpp.

00679 {
00680     ASSERT(::IsWindow(m_hWnd));
00681     DWORD dwResult;
00682     dwResult = (DWORD) ::SendMessage(m_hWnd, MCM_SETFIRSTDAYOFWEEK, 0, (WPARAM) iDay);
00683
00684     if (lpnOld != NULL)
00685         *lpnOld = LOWORD(dwResult);
00686
00687     return (BOOL) HIWORD(dwResult);
00688 }

_CJXLIB_INLINE BOOL CCJMonthCalCtrl::SetMaxSelCount ( int nMax )

Definition at line 795 of file CJDateTimeCtrl.h.

00796     { ASSERT(m_hWnd != NULL); return (BOOL) ::SendMessage(m_hWnd, MCM_SETMAXSELCOUNT, nMax, 0); }

_CJXLIB_INLINE int CCJMonthCalCtrl::SetMonthDelta ( int iDelta )

Definition at line 787 of file CJDateTimeCtrl.h.

00788     { ASSERT(m_hWnd != NULL); return (int) ::SendMessage(m_hWnd, MCM_SETMONTHDELTA, (WPARAM) iDelta, 0); }

BOOL CCJMonthCalCtrl::SetRange | ( | const LPSYSTEMTIME | pMinRange,
 |  | const LPSYSTEMTIME | pMaxRange
 | ) |

Definition at line 723 of file CJDateTimeCtrl.cpp.

00725 {
00726     ASSERT(::IsWindow(m_hWnd));
00727
00728     SYSTEMTIME sysTimes[2];
00729     WPARAM wFlags = 0;
00730
00731     if (pMinRange != NULL)
00732     {
00733         memcpy(&sysTimes[0], pMinRange, sizeof(SYSTEMTIME));
00734         wFlags |= GDTR_MIN;
00735     }
00736
00737     if (pMaxRange != NULL)
00738     {
00739         memcpy(&sysTimes[1], pMaxRange, sizeof(SYSTEMTIME));
00740         wFlags |= GDTR_MAX;
00741     }
00742
00743     return (BOOL)
00744         ::SendMessage(m_hWnd, MCM_SETRANGE, wFlags, (LPARAM) &sysTimes);
00745 }

BOOL CCJMonthCalCtrl::SetRange | ( | const CTime * | pMinRange,
 |  | const CTime * | pMaxRange
 | ) |

Definition at line 787 of file CJDateTimeCtrl.cpp.

00788 {
00789     ASSERT(::IsWindow(m_hWnd));
00790
00791     SYSTEMTIME sysTimes[2];
00792     WPARAM wFlags = 0;
00793     if (pMinRange != NULL && GetAsSystemTime(pMinRange, sysTimes[0]))
00794         wFlags |= GDTR_MIN;
00795
00796     if (pMaxRange != NULL && GetAsSystemTime(pMaxRange, sysTimes[1]))
00797         wFlags |= GDTR_MAX;
00798
00799     return (BOOL)
00800         ::SendMessage(m_hWnd, MCM_SETRANGE, wFlags, (LPARAM) &sysTimes);
00801 }

BOOL CCJMonthCalCtrl::SetRange | ( | const COleDateTime * | pMinRange,
 |  | const COleDateTime * | pMaxRange
 | ) |

Definition at line 697 of file CJDateTimeCtrl.cpp.

Referenced by DDV_CJMinMaxMonth().

00699 {
00700     ASSERT(::IsWindow(m_hWnd));
00701     ASSERT(pMinRange == NULL || pMinRange->GetStatus() != COleDateTime::invalid);
00702     ASSERT(pMaxRange == NULL || pMaxRange->GetStatus() != COleDateTime::invalid);
00703
00704     SYSTEMTIME sysTimes[2];
00705     WPARAM wFlags = 0;
00706
00707     if (pMinRange != NULL && pMinRange->GetStatus() != COleDateTime::null)
00708     {
00709         if (GetAsSystemTime(pMinRange, sysTimes[0]))
00710             wFlags |= GDTR_MIN;
00711     }
00712
00713     if (pMaxRange != NULL && pMaxRange->GetStatus() != COleDateTime::null)
00714     {
00715         if (GetAsSystemTime(pMaxRange, sysTimes[1]))
00716             wFlags |= GDTR_MAX;
00717     }
00718
00719     return (BOOL)
00720         ::SendMessage(m_hWnd, MCM_SETRANGE, wFlags, (LPARAM) &sysTimes);
00721 }

BOOL CCJMonthCalCtrl::SetSelRange | ( | const LPSYSTEMTIME | pMinRange,
 |  | const LPSYSTEMTIME | pMaxRange
 | ) |

Definition at line 896 of file CJDateTimeCtrl.cpp.

00898 {
00899     ASSERT(m_hWnd != NULL);
00900     ASSERT((GetStyle() & MCS_MULTISELECT));
00901
00902     ASSERT_POINTER(pMinRange, SYSTEMTIME);
00903     ASSERT_POINTER(pMaxRange, SYSTEMTIME);
00904
00905     SYSTEMTIME sysTimes[2];
00906     memcpy(&sysTimes[0], pMinRange, sizeof(SYSTEMTIME));
00907     memcpy(&sysTimes[1], pMaxRange, sizeof(SYSTEMTIME));
00908
00909     return (BOOL) ::SendMessage(m_hWnd, MCM_SETSELRANGE,
00910         0, (LPARAM) &sysTimes);
00911 }

BOOL CCJMonthCalCtrl::SetSelRange | ( | const CTime & | refMinRange,
 |  | const CTime & | refMaxRange
 | ) |

Definition at line 957 of file CJDateTimeCtrl.cpp.

00959 {
00960     // control must have multiple select
00961     ASSERT((GetStyle() & MCS_MULTISELECT));
00962     ASSERT(::IsWindow(m_hWnd));
00963
00964     SYSTEMTIME sysTimes[2];
00965     BOOL bResult = FALSE;
00966
00967     if (GetAsSystemTime(refMinRange, sysTimes[0]) &&
00968         GetAsSystemTime(refMaxRange, sysTimes[1]))
00969     {
00970         bResult = (BOOL)
00971             ::SendMessage(m_hWnd, MCM_SETSELRANGE, 0, (LPARAM)sysTimes);
00972     }
00973
00974     return bResult;
00975 }

BOOL CCJMonthCalCtrl::SetSelRange | ( | const COleDateTime & | refMinRange,
 |  | const COleDateTime & | refMaxRange
 | ) |

Definition at line 913 of file CJDateTimeCtrl.cpp.

00915 {
00916     // control must have multiple select
00917     ASSERT((GetStyle() & MCS_MULTISELECT));
00918     ASSERT(::IsWindow(m_hWnd));
00919
00920     SYSTEMTIME sysTimes[2];
00921     BOOL bResult = FALSE;
00922
00923     if (refMinRange.GetStatus() == COleDateTime::valid &&
00924         refMinRange.GetStatus() == COleDateTime::valid)
00925     {
00926         if (GetAsSystemTime(refMinRange, sysTimes[0]) &&
00927             GetAsSystemTime(refMaxRange, sysTimes[1]))
00928         {
00929             bResult = (BOOL)
00930                 ::SendMessage(m_hWnd, MCM_SETSELRANGE, 0, (LPARAM)sysTimes);
00931         }
00932     }
00933
00934     return bResult;
00935 }

_CJXLIB_INLINE void CCJMonthCalCtrl::SetToday ( const LPSYSTEMTIME pDateTime )

Definition at line 799 of file CJDateTimeCtrl.h.

00800     { ASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, MCM_SETTODAY, 0, (LPARAM) pDateTime); }

void CCJMonthCalCtrl::SetToday ( const CTime * pDateTime )

Definition at line 533 of file CJDateTimeCtrl.cpp.

00534 {
00535     ASSERT(::IsWindow(m_hWnd));
00536     ASSERT_VALID(this);
00537
00538     // if the passed time is NULL, we'll set the
00539     // control to NULL
00540
00541     WPARAM wParam = GDT_NONE;
00542     LPSYSTEMTIME pSysTime = NULL;
00543     SYSTEMTIME sysTime;
00544
00545     if (pDateTime != NULL && GetAsSystemTime(pDateTime, sysTime))
00546     {
00547         wParam = GDT_VALID;
00548         pSysTime = &sysTime;
00549     }
00550
00551     if (::IsWindow(m_hWnd))
00552         ::SendMessage(m_hWnd, MCM_SETTODAY, wParam, (LPARAM) pSysTime);
00553 }

void CCJMonthCalCtrl::SetToday ( const COleDateTime & refTime )

Definition at line 508 of file CJDateTimeCtrl.cpp.

00509 {
00510     ASSERT_VALID(this);
00511
00512     // make sure the time isn't invalid
00513     ASSERT(refTime.GetStatus() != COleDateTime::invalid);
00514     ASSERT(::IsWindow(m_hWnd));
00515
00516     SYSTEMTIME sysTime;
00517     LPSYSTEMTIME pSysTime = NULL;
00518     WPARAM wParam = GDT_NONE;
00519
00520     // if the passed time is null or out of range,
00521     // we'll set the control to NULL
00522
00523     if (GetAsSystemTime(refTime, sysTime))
00524     {
00525         pSysTime = &sysTime;
00526         wParam = GDT_VALID;
00527     }
00528
00529     if (::IsWindow(m_hWnd))
00530         ::SendMessage(m_hWnd, MCM_SETTODAY, wParam, (LPARAM) pSysTime);
00531 }

BOOL CCJMonthCalCtrl::SizeMinReq ( BOOL bRepaint = TRUE )

Definition at line 492 of file CJDateTimeCtrl.cpp.

Referenced by Create().

00493 {
00494     CRect rect;
00495     BOOL bRetVal = FALSE;
00496     if (GetMinReqRect(rect))
00497     {
00498         DWORD dwFlags = SWP_NOZORDER | SWP_NOREPOSITION | SWP_NOMOVE | SWP_NOACTIVATE;
00499         if (!bRepaint)
00500             dwFlags |= SWP_NOREDRAW;
00501         SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), dwFlags);
00502         bRetVal = TRUE;
00503     }
00504
00505     return bRetVal;
00506 }

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJDateTimeCtrl.h
  • WinCvs/CJLib/CJLibrary/CJDateTimeCtrl.cpp
Generated on Sun Oct 21 12:46:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJOutlookBar Class Reference

#include <CJOutlookBar.h>

Inheritance diagram for CCJOutlookBar:

[legend]
Collaboration diagram for CCJOutlookBar:

[legend]
List of all members.

Public Methods

CCJOutlookBar ()
virtual | ~CCJOutlookBar ()
virtual void | SetImageLists (CImageList *pImageListSmall=NULL, CImageList *pImageListLarge=NULL)
virtual void | SetItems (CContentItems *pItems, int nNumItems)
virtual void | SetOwner (CWnd *pWnd)
virtual void | UpdateFont ()
virtual void | DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
virtual void | MeasureItem (LPMEASUREITEMSTRUCT lpMeasureItemStruct)

Protected Methods

afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point)
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg void | OnTimer (UINT nIDEvent)
afx_msg void | OnPaint ()
afx_msg void | OnSysColorChange ()

Protected Attributes

CWnd * m_pOwner
CPoint | m_point
CImageList * | m_pImageListLarge
CImageList * | m_pImageListSmall
CContentItems * m_pContents
int | m_nNumItems
int | m_nIndex
bool | m_bHilight
bool | m_bLBDown
CFont | m_Font
COLORREF | m_clrHilite
COLORREF | m_clrShadow
COLORREF | m_clrDkShad
COLORREF | m_clrNormal
COLORREF | m_clrTextNm

Constructor & Destructor Documentation

CCJOutlookBar::CCJOutlookBar ( )

Definition at line 84 of file CJOutlookBar.cpp.

00085 {
00086     m_bLBDown           = false;
00087     m_bHilight          = true;
00088     m_pImageListLarge   = NULL;
00089     m_pImageListSmall   = NULL;
00090     m_pOwner            = NULL;
00091     m_clrHilite         = ::GetSysColor(COLOR_BTNHIGHLIGHT);
00092     m_clrShadow         = ::GetSysColor(COLOR_BTNSHADOW);
00093     m_clrDkShad         = ::GetSysColor(COLOR_3DDKSHADOW);
00094     m_clrNormal         = ::GetSysColor(COLOR_BTNFACE);
00095     m_clrTextNm         = ::GetSysColor(COLOR_WINDOW);
00096
00097     UpdateFont();
00098 }

CCJOutlookBar::~CCJOutlookBar ( ) [virtual]

Definition at line 100 of file CJOutlookBar.cpp.

00101 {
00102     // fix potential resource leak - KStowell - 10-22-99.
00103     m_Font.DeleteObject();
00104 }

Member Function Documentation

void CCJOutlookBar::DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct ) [virtual]

Definition at line 194 of file CJOutlookBar.cpp.

00195 {
00196     CDC*            pDC = CDC::FromHandle( lpDrawItemStruct->hDC );
00197     CRect           rcItem(lpDrawItemStruct->rcItem);
00198     CRect           rClient(rcItem);
00199     CRect           rText;
00200     CPoint          Pt(((rcItem.Width() - 32) /2 ), rcItem.top + 15);
00201     CContentItems   pContents = m_pContents[ lpDrawItemStruct->itemID ];
00202     HICON           hIcon = m_pImageListLarge->ExtractIcon( pContents.GetImageID());
00203
00204     pDC->SetBkColor(m_clrShadow);
00205
00206     // deflate the client rect, and set up item and
00207     // text rect's.
00208     rClient.DeflateRect( 8, 5 );
00209     rcItem.CopyRect( rClient );
00210     rText.CopyRect( rClient );
00211     rText.top += 45;
00212     rText.bottom += 10;
00213
00214     // set the text color to white, and background mode
00215     // to transparent.
00216     pDC->SetTextColor( m_clrTextNm );
00217     pDC->SetBkMode( TRANSPARENT );
00218     CFont* pOldFont = pDC->SelectObject(&m_Font);
00219
00220     // draw the button icon and text.
00221     if( lpDrawItemStruct->itemAction& ODA_DRAWENTIRE ) {
00222         pDC->DrawIcon( Pt, hIcon );
00223         pDC->DrawText( pContents.GetText(), rText, DT_CENTER | DT_WORDBREAK );
00224     }
00225
00226     // if the left mouse button is pressed, offset
00227     // the button icon.
00228     if( m_bLBDown ) {
00229         Pt.x += 2;
00230         Pt.y += 2;
00231         rcItem.OffsetRect( 2, 2 );
00232     }
00233
00234     // deflate the button rect, and move up.
00235     rcItem.DeflateRect( 4, 16 );
00236     rcItem.top -= 8;
00237
00238     // Draw the button icon and text, if the mouse is over the
00239     // button, draw the 3d rect, either pressed,
00240     // or not pressed depending on left mouse button.
00241     if(( lpDrawItemStruct->itemState& ODS_SELECTED ) &&
00242         ( lpDrawItemStruct->itemAction& ( ODA_SELECT | ODA_DRAWENTIRE ))) {
00243
00244         rcItem.left = ( rcItem.Width()/2 )-5;
00245         rcItem.right = rcItem.left+37;
00246
00247         if( m_bHilight ) {
00248             if( m_bLBDown ) {
00249               pDC->Draw3dRect( rcItem, m_clrDkShad, m_clrNormal );
00250             } else {
00251               pDC->Draw3dRect( rcItem, m_clrNormal, m_clrDkShad );
00252             }
00253         }
00254
00255         pDC->DrawIcon( Pt, hIcon );
00256         pDC->DrawText( pContents.GetText(), rText, DT_CENTER | DT_WORDBREAK );
00257     }
00258
00259     if( !( lpDrawItemStruct->itemState& ODS_SELECTED ) &&
00260         ( lpDrawItemStruct->itemAction& ODA_SELECT )) {
00261         pDC->FillSolidRect( rClient, m_clrShadow );
00262         pDC->DrawIcon(Pt, hIcon);
00263         pDC->DrawText(pContents.GetText(), rText, DT_CENTER|DT_WORDBREAK);
00264     }
00265
00266     // To avoid ugly resource leaks that will
00267     // eventually TRASH the system, call DestroyIcon().
00268     // To reproduce bug, try resizing the window for a
00269     // good minute. Christopher Brown
00270
00271     ::DestroyIcon( hIcon );
00272     pDC->SelectObject(pOldFont);
00273 }

void CCJOutlookBar::MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct ) [virtual]

Definition at line 278 of file CJOutlookBar.cpp.

00279 {
00280     lpMeasureItemStruct->itemHeight = 70;
00281 }

BOOL CCJOutlookBar::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 286 of file CJOutlookBar.cpp.

00287 {
00288     // KStowell - overridden for flicker-free drawing.
00289     UNUSED_ALWAYS(pDC);
00290     return TRUE;
00291 }

void CCJOutlookBar::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 132 of file CJOutlookBar.cpp.

00133 {
00134     m_bLBDown = true;
00135     SetCurSel(GetCurSel());
00136     CListBox::OnLButtonDown(nFlags, point);
00137 }

void CCJOutlookBar::OnLButtonUp | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 140 of file CJOutlookBar.cpp.

00141 {
00142     m_bLBDown = false;
00143     int nIndex = GetCurSel();
00144     SetCurSel(nIndex);
00145
00146     ASSERT(m_pOwner);
00147     m_pOwner->SendMessage(OBN_SELENDOK, (LPARAM)nIndex, (WPARAM)GetDlgCtrlID());
00148
00149     CListBox::OnLButtonUp(nFlags, point);
00150 }

void CCJOutlookBar::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 124 of file CJOutlookBar.cpp.

00125 {
00126     m_point = point;
00127     SetTimer (1, 10, NULL);
00128     CListBox::OnMouseMove(nFlags, point);
00129 }

void CCJOutlookBar::OnPaint ( ) [protected]

Definition at line 293 of file CJOutlookBar.cpp.

00294 {
00295     // Christopher Brown
00296     // Use a "Offscreen" DC to fill rect and
00297     // send to DefWindowProc...
00298     CClientDC memDC(this); // Henrik E. Rasmussen
00299
00300     CRect rcClip;
00301     memDC.GetClipBox(&rcClip);
00302     memDC.FillSolidRect(rcClip, m_clrShadow);
00303     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, (LPARAM)0 );
00304
00305     // Default is called for cleanup.
00306     Default();
00307 }

void CCJOutlookBar::OnSysColorChange ( ) [protected]

Definition at line 318 of file CJOutlookBar.cpp.

00319 {
00320     CListBox::OnSysColorChange();
00321
00322     m_clrHilite = ::GetSysColor(COLOR_BTNHIGHLIGHT);
00323     m_clrShadow = ::GetSysColor(COLOR_BTNSHADOW);
00324     m_clrDkShad = ::GetSysColor(COLOR_3DDKSHADOW);
00325     m_clrNormal = ::GetSysColor(COLOR_BTNFACE);
00326     m_clrTextNm = ::GetSysColor(COLOR_WINDOW);
00327 }

void CCJOutlookBar::OnTimer ( UINT nIDEvent ) [protected]

Definition at line 153 of file CJOutlookBar.cpp.

00154 {
00155     BOOL   bOutSide;
00156     CRect  rItem;
00157     CRect  rWindow;
00158     CPoint pt;
00159     int    nIndex;
00160
00161     // Get the rect of the current window,
00162     // get the current cursor position.
00163     GetWindowRect (rWindow);
00164     GetCursorPos (&pt);
00165
00166     // If the mouse is in the rect of this window,
00167     // set hilite flag to true, get the item that
00168     // the mouse is over.
00169     if (rWindow.PtInRect (pt)) {
00170         m_bHilight = true;
00171         nIndex = ItemFromPoint (m_point, bOutSide);
00172
00173         if (nIndex != GetCurSel() && !bOutSide) {
00174             SetCurSel( nIndex );
00175         }
00176     }
00177
00178     // If the mouse is not in the rect of
00179     // this window, kill the timer, set hilite flag
00180     // to false, and return.
00181     else {
00182         m_bHilight = false;
00183         if( !m_bLBDown ) {
00184           SetCurSel (-1);
00185         }
00186         KillTimer(1);
00187     }
00188 }

_CJXLIB_INLINE void CCJOutlookBar::SetImageLists | ( | CImageList * | pImageListSmall = NULL,
 |  | CImageList * | pImageListLarge = NULL
 | ) | [virtual]

Definition at line 210 of file CJOutlookBar.h.

00211     { m_pImageListLarge = pImageListLarge; m_pImageListSmall = pImageListSmall; }

_CJXLIB_INLINE void CCJOutlookBar::SetItems | ( | CContentItems * | pItems,
 |  | int | nNumItems
 | ) | [virtual]

Definition at line 213 of file CJOutlookBar.h.

00214     { m_pContents = pItems; m_nNumItems = nNumItems; ResetContent(); for (int i = 0; i < nNumItems; ++i) AddString(m_pContents[i].GetText()); }

_CJXLIB_INLINE void CCJOutlookBar::SetOwner ( CWnd * pWnd ) [virtual]

Definition at line 216 of file CJOutlookBar.h.

00217     { m_pOwner = pWnd; }

void CCJOutlookBar::UpdateFont ( ) [virtual]

Definition at line 309 of file CJOutlookBar.cpp.

Referenced by CCJOutlookBar().

00310 {
00311     m_Font.DeleteObject();
00312     NONCLIENTMETRICS ncm;
00313     ncm.cbSize = sizeof(ncm);
00314     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00315     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00316 }

Member Data Documentation

CFont CCJOutlookBar::m_Font [protected]

Definition at line 141 of file CJOutlookBar.h.

bool CCJOutlookBar::m_bHilight [protected]

Definition at line 139 of file CJOutlookBar.h.

bool CCJOutlookBar::m_bLBDown [protected]

Definition at line 140 of file CJOutlookBar.h.

COLORREF CCJOutlookBar::m_clrDkShad [protected]

Definition at line 144 of file CJOutlookBar.h.

COLORREF CCJOutlookBar::m_clrHilite [protected]

Definition at line 142 of file CJOutlookBar.h.

COLORREF CCJOutlookBar::m_clrNormal [protected]

Definition at line 145 of file CJOutlookBar.h.

COLORREF CCJOutlookBar::m_clrShadow [protected]

Definition at line 143 of file CJOutlookBar.h.

COLORREF CCJOutlookBar::m_clrTextNm [protected]

Definition at line 146 of file CJOutlookBar.h.

int CCJOutlookBar::m_nIndex [protected]

Definition at line 138 of file CJOutlookBar.h.

int CCJOutlookBar::m_nNumItems [protected]

Definition at line 137 of file CJOutlookBar.h.

CContentItems* CCJOutlookBar::m_pContents [protected]

Definition at line 136 of file CJOutlookBar.h.

CImageList* CCJOutlookBar::m_pImageListLarge [protected]

Definition at line 134 of file CJOutlookBar.h.

CImageList* CCJOutlookBar::m_pImageListSmall [protected]

Definition at line 135 of file CJOutlookBar.h.

CWnd* CCJOutlookBar::m_pOwner [protected]

Definition at line 132 of file CJOutlookBar.h.

CPoint CCJOutlookBar::m_point [protected]

Definition at line 133 of file CJOutlookBar.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJOutlookBar.h
  • WinCvs/CJLib/CJLibrary/CJOutlookBar.cpp
Generated on Sun Oct 21 12:46:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJPagerCtrl Class Reference

#include <CJPagerCtrl.h>

Inheritance diagram for CCJPagerCtrl:

[legend]
Collaboration diagram for CCJPagerCtrl:

[legend]
List of all members.

Public Methods

CCJPagerCtrl ()
virtual | ~CCJPagerCtrl ()
void | SetScrollArea (int nWidth, int nHeight)
void | SetChild (HWND hwndChild)
void | RecalcSize ()
void | ForwardMouse (BOOL bForward)
COLORREF | SetBkColor (COLORREF clr)
COLORREF | GetBkColor ()
int | SetBorder (int iBorder)
int | GetBorder ()
int | SetPos (int iPos)
int | GetPos ()
int | SetButtonSize (int iSize)
int | GetButtonSize ()
DWORD | GetButtonState (int iButton)
void | GetDropTarget (IDropTarget **ppdt)
virtual BOOL | Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)

Protected Methods

virtual BOOL | OnPagerScroll (NMPGSCROLL *pNMPGScroll, LRESULT *pResult)
virtual BOOL | OnPagerCalcSize (NMPGCALCSIZE *pNMPGCalcSize, LRESULT *pResult)

Protected Attributes

int | m_nWidth
int | m_nHeight

Constructor & Destructor Documentation

CCJPagerCtrl::CCJPagerCtrl ( )

Definition at line 62 of file CJPagerCtrl.cpp.

00063 {
00064    // initialize common controls
00065     INITCOMMONCONTROLSEX icex;
00066     icex.dwSize = sizeof(icex);
00067     icex.dwICC = ICC_PAGESCROLLER_CLASS;
00068     VERIFY(InitCommonControlsEx(&icex));
00069 }

CCJPagerCtrl::~CCJPagerCtrl ( ) [virtual]

Definition at line 71 of file CJPagerCtrl.cpp.

00072 {
00073 }

Member Function Documentation

BOOL CCJPagerCtrl::Create | ( | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID
 | ) | [virtual]

Definition at line 84 of file CJPagerCtrl.cpp.

00085 {
00086     CWnd* pWnd = this;
00087     return pWnd->Create(WC_PAGESCROLLER, NULL, dwStyle, rect, pParentWnd, nID);
00088 }

_CJXLIB_INLINE void CCJPagerCtrl::ForwardMouse ( BOOL bForward )

Definition at line 192 of file CJPagerCtrl.h.

00193     { ASSERT(::IsWindow(m_hWnd)); Pager_ForwardMouse(m_hWnd, bForward); }

_CJXLIB_INLINE COLORREF CCJPagerCtrl::GetBkColor ( )

Definition at line 198 of file CJPagerCtrl.h.

00199     { ASSERT(::IsWindow(m_hWnd)); return Pager_GetBkColor(m_hWnd); }

_CJXLIB_INLINE int CCJPagerCtrl::GetBorder ( )

Definition at line 204 of file CJPagerCtrl.h.

00205     { ASSERT(::IsWindow(m_hWnd)); return Pager_GetBorder(m_hWnd); }

_CJXLIB_INLINE int CCJPagerCtrl::GetButtonSize ( )

Definition at line 216 of file CJPagerCtrl.h.

00217     { ASSERT(::IsWindow(m_hWnd)); return Pager_GetButtonSize(m_hWnd); }

_CJXLIB_INLINE DWORD CCJPagerCtrl::GetButtonState ( int iButton )

Definition at line 219 of file CJPagerCtrl.h.

00220     { ASSERT(::IsWindow(m_hWnd)); return Pager_GetButtonState(m_hWnd, iButton); }

_CJXLIB_INLINE void CCJPagerCtrl::GetDropTarget ( IDropTarget ** ppdt )

Definition at line 222 of file CJPagerCtrl.h.

00223     { ASSERT(::IsWindow(m_hWnd)); Pager_GetDropTarget(m_hWnd, ppdt); }

_CJXLIB_INLINE int CCJPagerCtrl::GetPos ( )

Definition at line 210 of file CJPagerCtrl.h.

00211     { ASSERT(::IsWindow(m_hWnd)); return Pager_GetPos(m_hWnd); }

BOOL CCJPagerCtrl::OnPagerCalcSize | ( | NMPGCALCSIZE * | pNMPGCalcSize,
 |  | LRESULT * | pResult
 | ) | [protected, virtual]

Definition at line 93 of file CJPagerCtrl.cpp.

00094 {
00095     switch(pNMPGCalcSize->dwFlag)
00096     {
00097     case PGF_CALCWIDTH:
00098         pNMPGCalcSize->iWidth = m_nWidth;
00099         break;
00100
00101     case PGF_CALCHEIGHT:
00102         pNMPGCalcSize->iHeight = m_nHeight;
00103         break;
00104     }
00105
00106     *pResult = 0;
00107     return FALSE;   // Let parent handle message
00108 }

BOOL CCJPagerCtrl::OnPagerScroll | ( | NMPGSCROLL * | pNMPGScroll,
 |  | LRESULT * | pResult
 | ) | [protected, virtual]

Definition at line 110 of file CJPagerCtrl.cpp.

00111 {
00112     *pResult = 0;
00113     return FALSE;   // Let parent handle message
00114 }

_CJXLIB_INLINE void CCJPagerCtrl::RecalcSize ( )

Definition at line 189 of file CJPagerCtrl.h.

00190     { ASSERT(::IsWindow(m_hWnd)); Pager_RecalcSize(m_hWnd); }

_CJXLIB_INLINE COLORREF CCJPagerCtrl::SetBkColor ( COLORREF clr )

Definition at line 195 of file CJPagerCtrl.h.

00196     { ASSERT(::IsWindow(m_hWnd)); return Pager_SetBkColor(m_hWnd, clr); }

_CJXLIB_INLINE int CCJPagerCtrl::SetBorder ( int iBorder )

Definition at line 201 of file CJPagerCtrl.h.

00202     { ASSERT(::IsWindow(m_hWnd)); return Pager_SetBorder(m_hWnd, iBorder); }

_CJXLIB_INLINE int CCJPagerCtrl::SetButtonSize ( int iSize )

Definition at line 213 of file CJPagerCtrl.h.

00214     { ASSERT(::IsWindow(m_hWnd)); return Pager_SetButtonSize(m_hWnd, iSize); }

_CJXLIB_INLINE void CCJPagerCtrl::SetChild ( HWND hwndChild )

Definition at line 186 of file CJPagerCtrl.h.

00187     { ASSERT(::IsWindow(m_hWnd)); Pager_SetChild(m_hWnd, hwndChild); }

_CJXLIB_INLINE int CCJPagerCtrl::SetPos ( int iPos )

Definition at line 207 of file CJPagerCtrl.h.

00208     { ASSERT(::IsWindow(m_hWnd)); return Pager_SetPos(m_hWnd, iPos); }

_CJXLIB_INLINE void CCJPagerCtrl::SetScrollArea | ( | int | nWidth,
 |  | int | nHeight
 | ) |

Definition at line 183 of file CJPagerCtrl.h.

00184     { ASSERT(::IsWindow(m_hWnd)); m_nWidth  = nWidth; m_nHeight = nHeight; }

Member Data Documentation

int CCJPagerCtrl::m_nHeight [protected]

Definition at line 76 of file CJPagerCtrl.h.

int CCJPagerCtrl::m_nWidth [protected]

Definition at line 75 of file CJPagerCtrl.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJPagerCtrl.h
  • WinCvs/CJLib/CJLibrary/CJPagerCtrl.cpp
Generated on Sun Oct 21 12:46:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJReBar Class Reference

#include <CJReBar.h>

Inheritance diagram for CCJReBar:

[legend]
Collaboration diagram for CCJReBar:

[legend]
List of all members.

Public Methods

CCJReBar ()
BOOL | Create (CWnd *pParentWnd, DWORD dwCtrlStyle=RBS_BANDBORDERS, DWORD dwStyle=WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|CBRS_TOP, UINT nID=0xE804)
CCJReBarCtrl & | GetReBarCtrl () const
BOOL | AddBar (CWnd *pBar, LPCTSTR pszText=NULL, CBitmap *pbmp=NULL, DWORD dwStyle=RBBS_GRIPPERALWAYS|RBBS_FIXEDBMP)
BOOL | AddBar (CWnd *pBar, COLORREF clrFore, COLORREF clrBack, LPCTSTR pszText=NULL, DWORD dwStyle=RBBS_GRIPPERALWAYS)
virtual void | OnUpdateCmdUI (CFrameWnd *pTarget, BOOL bDisableIfNoHndler)
virtual int | OnToolHitTest (CPoint point, TOOLINFO *pTI) const
virtual CSize | CalcFixedLayout (BOOL bStretch, BOOL bHorz)
virtual CSize | CalcDynamicLayout (int nLength, DWORD nMode)

Protected Methods

virtual LRESULT | WindowProc (UINT message, WPARAM wParam, LPARAM lParam)
BOOL | _AddBar (CWnd *pBar, REBARBANDINFO *pRBBI)
afx_msg BOOL | OnNcCreate (LPCREATESTRUCT)
afx_msg void | OnPaint ()
afx_msg void | OnHeightChange (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnNcPaint ()
afx_msg void | OnNcCalcSize (BOOL, NCCALCSIZE_PARAMS *)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg LRESULT | OnShowBand (WPARAM wParam, LPARAM lParam)
afx_msg void | OnRecalcParent ()

Constructor & Destructor Documentation

CCJReBar::CCJReBar ( )

Definition at line 104 of file CJReBar.cpp.

00105 {
00106     SetBorders();
00107 }

Member Function Documentation

BOOL CCJReBar::AddBar | ( | CWnd * | pBar,
 |  | COLORREF | clrFore,
 |  | COLORREF | clrBack,
 |  | LPCTSTR | pszText = NULL,
 |  | DWORD | dwStyle = RBBS_GRIPPERALWAYS
 | ) |

Definition at line 203 of file CJReBar.cpp.

00204 {
00205     REBARBANDINFO rbBand;
00206     rbBand.fMask = RBBIM_STYLE | RBBIM_COLORS;
00207     rbBand.fStyle = dwStyle;
00208     rbBand.clrFore = clrFore;
00209     rbBand.clrBack = clrBack;
00210     if (pszText != NULL)
00211     {
00212         rbBand.fMask |= RBBIM_TEXT;
00213         rbBand.lpText = const_cast<LPTSTR>(pszText);
00214     }
00215     return _AddBar(pBar, &rbBand);
00216 }

BOOL CCJReBar::AddBar | ( | CWnd * | pBar,
 |  | LPCTSTR | pszText = NULL,
 |  | CBitmap * | pbmp = NULL,
 |  | DWORD | dwStyle = RBBS_GRIPPERALWAYS | RBBS_FIXEDBMP
 | ) |

Definition at line 185 of file CJReBar.cpp.

00186 {
00187     REBARBANDINFO rbBand;
00188     rbBand.fMask = RBBIM_STYLE;
00189     rbBand.fStyle = dwStyle;
00190     if (pszText != NULL)
00191     {
00192         rbBand.fMask |= RBBIM_TEXT;
00193         rbBand.lpText = const_cast<LPTSTR>(pszText);
00194     }
00195     if (pbmp != NULL)
00196     {
00197         rbBand.fMask |= RBBIM_BACKGROUND;
00198         rbBand.hbmBack = (HBITMAP)*pbmp;
00199     }
00200     return _AddBar(pBar, &rbBand);
00201 }

CSize CCJReBar::CalcDynamicLayout | ( | int | nLength,
 |  | DWORD | dwMode
 | ) | [virtual]

Definition at line 272 of file CJReBar.cpp.

00273 {
00274     if (dwMode & LM_HORZDOCK)
00275         ASSERT(dwMode & LM_HORZ);
00276     return CalcFixedLayout(dwMode & LM_STRETCH, dwMode & LM_HORZ);
00277 }

CSize CCJReBar::CalcFixedLayout | ( | BOOL | bStretch,
 |  | BOOL | bHorz
 | ) | [virtual]

Definition at line 218 of file CJReBar.cpp.

Referenced by CalcDynamicLayout().

00219 {
00220     ASSERT_VALID(this);
00221     ASSERT(::IsWindow(m_hWnd));
00222
00223     // the union of the band rectangles is the total bounding rect
00224     int nCount = DefWindowProc(RB_GETBANDCOUNT, 0, 0);
00225     REBARBANDINFO rbBand;
00226     rbBand.cbSize = sizeof(rbBand);
00227     int nTemp;
00228
00229     // sync up hidden state of the bands
00230     for (nTemp = nCount; nTemp--; )
00231     {
00232         rbBand.fMask = RBBIM_CHILD|RBBIM_STYLE;
00233         VERIFY(DefWindowProc(RB_GETBANDINFO, nTemp, (LPARAM)&rbBand));
00234         CCJToolBarBase* pBar = DYNAMIC_DOWNCAST(CCJToolBarBase, CWnd::FromHandlePermanent(rbBand.hwndChild));
00235         BOOL bWindowVisible;
00236         if (pBar != NULL)
00237             bWindowVisible = pBar->IsVisible();
00238         else
00239             bWindowVisible =  (::GetWindowLong(rbBand.hwndChild, GWL_STYLE) & WS_VISIBLE) != 0;
00240         BOOL bBandVisible = (rbBand.fStyle & RBBS_HIDDEN) == 0;
00241         if (bWindowVisible != bBandVisible)
00242             VERIFY(DefWindowProc(RB_SHOWBAND, nTemp, bWindowVisible));
00243     }
00244
00245     // determine bounding rect of all visible bands
00246     CRect rectBound; rectBound.SetRectEmpty();
00247     for (nTemp = nCount; nTemp--; )
00248     {
00249         rbBand.fMask = RBBIM_STYLE;
00250         VERIFY(DefWindowProc(RB_GETBANDINFO, nTemp, (LPARAM)&rbBand));
00251         if ((rbBand.fStyle & RBBS_HIDDEN) == 0)
00252         {
00253             CRect rect;
00254             VERIFY(DefWindowProc(RB_GETRECT, nTemp, (LPARAM)&rect));
00255             rectBound |= rect;
00256         }
00257     }
00258
00259     // add borders as part of bounding rect
00260     if (!rectBound.IsRectEmpty())
00261     {
00262         CRect rect; rect.SetRectEmpty();
00263         CalcInsideRect(rect, bHorz);
00264         rectBound.right -= rect.Width();
00265         rectBound.bottom -= rect.Height();
00266     }
00267
00268     return CSize((bHorz && bStretch) ? 32767 : rectBound.Width(),
00269         (!bHorz && bStretch) ? 32767 : rectBound.Height());
00270 }

BOOL CCJReBar::Create | ( | CWnd * | pParentWnd,
 |  | DWORD | dwCtrlStyle = RBS_BANDBORDERS,
 |  | DWORD | dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_TOP,
 |  | UINT | nID = 0xE804
 | ) |

Definition at line 279 of file CJReBar.cpp.

00280 {
00281     ASSERT_VALID(pParentWnd);   // must have a parent
00282     ASSERT (!((dwStyle & CBRS_SIZE_FIXED) && (dwStyle & CBRS_SIZE_DYNAMIC)));
00283
00284     // save the style
00285     m_dwStyle = (dwStyle & CBRS_ALL);
00286     if (nID == AFX_IDW_REBAR)
00287         m_dwStyle |= CBRS_HIDE_INPLACE;
00288
00289     dwStyle &= ~CBRS_ALL;
00290     dwStyle |= CCS_NOPARENTALIGN|CCS_NOMOVEY|CCS_NODIVIDER|CCS_NORESIZE|RBS_VARHEIGHT;
00291     dwStyle |= dwCtrlStyle;
00292
00293     // initialize common controls
00294 #if _MSC_VER >= 1200
00295     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_COOL_REG));
00296 #else
00297     INITCOMMONCONTROLSEX icex;
00298     icex.dwSize = sizeof(icex);
00299     icex.dwICC = ICC_COOL_CLASSES;
00300     VERIFY(InitCommonControlsEx(&icex));
00301 #endif
00302
00303     _GetComCtlVersion();
00304     ASSERT(_ComCtlVersion != -1);
00305
00306     // create the HWND
00307     CRect rect; rect.SetRectEmpty();
00308     if (!CWnd::Create(REBARCLASSNAME, NULL, dwStyle, rect, pParentWnd, nID))
00309         return FALSE;
00310
00311     // Note: Parent must resize itself for control bar to be resized
00312     m_bInReBar = true;
00313
00314     return TRUE;
00315 }

_CJXLIB_INLINE CCJReBarCtrl & CCJReBar::GetReBarCtrl ( ) const

Definition at line 123 of file CJReBar.h.

00124     { return *(CCJReBarCtrl*)this; }

BOOL CCJReBar::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 334 of file CJReBar.cpp.

00335 {
00336     return (BOOL)Default();
00337 }

void CCJReBar::OnHeightChange | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 116 of file CJReBar.cpp.

00117 {
00118     CFrameWnd* pFrameWnd = GetParentFrame();
00119     if (pFrameWnd != NULL)
00120         pFrameWnd->RecalcLayout();
00121     *pResult = 0;
00122 }

void CCJReBar::OnNcCalcSize | ( | BOOL | ,
 |  | NCCALCSIZE_PARAMS * | lpncsp
 | ) | [protected]

Definition at line 339 of file CJReBar.cpp.

00340 {
00341     // calculate border space (will add to top/bottom, subtract from right/bottom)
00342     CRect rect; rect.SetRectEmpty();
00343     BOOL bHorz = (m_dwStyle & CBRS_ORIENT_HORZ) != 0;
00344     CCJToolBarBase::CalcInsideRect(rect, bHorz);
00345
00346     // adjust non-client area for border space
00347     lpncsp->rgrc[0].left += rect.left;
00348     lpncsp->rgrc[0].top += rect.top;
00349     lpncsp->rgrc[0].right += rect.right;
00350     lpncsp->rgrc[0].bottom += rect.bottom;
00351 }

BOOL CCJReBar::OnNcCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 322 of file CJReBar.cpp.

00323 {
00324     if (!CCJToolBarBase::OnNcCreate(lpCreateStruct))
00325         return FALSE;
00326
00327     // if the owner was set before the rebar was created, set it now
00328     if (m_hWndOwner != NULL)
00329         DefWindowProc(RB_SETPARENT, (WPARAM)m_hWndOwner, 0);
00330
00331     return TRUE;
00332 }

void CCJReBar::OnNcPaint ( ) [protected]

Definition at line 353 of file CJReBar.cpp.

00354 {
00355     EraseNonClient();
00356 }

void CCJReBar::OnPaint ( ) [protected]

Reimplemented from CCJToolBarBase.

Definition at line 358 of file CJReBar.cpp.

00359 {
00360     Default();
00361 }

void CCJReBar::OnRecalcParent ( ) [protected]

Definition at line 109 of file CJReBar.cpp.

00110 {
00111     CFrameWnd* pFrameWnd = GetParentFrame();
00112     ASSERT(pFrameWnd != NULL);
00113     pFrameWnd->RecalcLayout();
00114 }

LRESULT CCJReBar::OnShowBand | ( | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) | [protected]

Definition at line 124 of file CJReBar.cpp.

00125 {
00126     LRESULT lResult = Default();
00127     if (lResult)
00128     {
00129         // keep window visible state in sync with band visible state
00130         REBARBANDINFO rbBand;
00131         rbBand.cbSize = sizeof(rbBand);
00132         rbBand.fMask = RBBIM_CHILD|RBBIM_STYLE;
00133         VERIFY(DefWindowProc(RB_GETBANDINFO, wParam, (LPARAM)&rbBand));
00134         CCJToolBarBase* pBar = DYNAMIC_DOWNCAST(CCJToolBarBase, CWnd::FromHandlePermanent(rbBand.hwndChild));
00135         BOOL bWindowVisible;
00136         if (pBar != NULL)
00137             bWindowVisible = pBar->IsVisible();
00138         else
00139             bWindowVisible =  (::GetWindowLong(rbBand.hwndChild, GWL_STYLE) & WS_VISIBLE) != 0;
00140         BOOL bBandVisible = (rbBand.fStyle & RBBS_HIDDEN) == 0;
00141         if (bWindowVisible != bBandVisible)
00142             VERIFY(::ShowWindow(rbBand.hwndChild, bBandVisible ? SW_SHOW : SW_HIDE));
00143     }
00144     return lResult;
00145 }

int CCJReBar::OnToolHitTest | ( | CPoint | point,
 |  | TOOLINFO * | pTI
 | ) | const [virtual]

Definition at line 363 of file CJReBar.cpp.

00364 {
00365     ASSERT_VALID(this);
00366     ASSERT(::IsWindow(m_hWnd));
00367
00368     HWND hWndChild = _CjxChildWindowFromPoint(m_hWnd, point);
00369     CWnd* pWnd = CWnd::FromHandlePermanent(hWndChild);
00370     if (pWnd == NULL)
00371         return CCJToolBarBase::OnToolHitTest(point, pTI);
00372
00373     ASSERT(pWnd->m_hWnd == hWndChild);
00374     return pWnd->OnToolHitTest(point, pTI);
00375 }

void CCJReBar::OnUpdateCmdUI | ( | CFrameWnd * | pTarget,
 |  | BOOL | bDisableIfNoHandler
 | ) | [virtual]

Definition at line 317 of file CJReBar.cpp.

00318 {
00319     UpdateDialogControls(pTarget, bDisableIfNoHandler);
00320 }

LRESULT CCJReBar::WindowProc | ( | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) | [protected, virtual]

Reimplemented from CCJToolBarBase.

Definition at line 377 of file CJReBar.cpp.

00378 {
00379     // special handling for certain messages (forwarding to owner/parent)
00380     switch (message)
00381     {
00382     case WM_POPMESSAGESTRING:
00383     case WM_SETMESSAGESTRING:
00384         return GetOwner()->SendMessage(message, wParam, lParam);
00385     }
00386     return CCJToolBarBase::WindowProc(message, wParam, lParam);
00387 }

BOOL CCJReBar::_AddBar | ( | CWnd * | pBar,
 |  | REBARBANDINFO * | pRBBI
 | ) | [protected]

Definition at line 147 of file CJReBar.cpp.

Referenced by AddBar().

00148 {
00149     ASSERT_VALID(this);
00150     ASSERT(::IsWindow(m_hWnd));
00151     ASSERT(pBar != NULL);
00152     ASSERT(::IsWindow(pBar->m_hWnd));
00153
00154     pRBBI->cbSize = sizeof(REBARBANDINFO);
00155     pRBBI->fMask |= RBBIM_CHILD | RBBIM_CHILDSIZE;
00156     pRBBI->hwndChild = pBar->m_hWnd;
00157
00158     CSize size;
00159     CCJToolBarBase* pTemp = DYNAMIC_DOWNCAST(CCJToolBarBase, pBar);
00160     if (pTemp != NULL)
00161     {
00162         pTemp->m_bInReBar = true;
00163         size = pTemp->CalcFixedLayout(FALSE, m_dwStyle & CBRS_ORIENT_HORZ);
00164     }
00165     else
00166     {
00167         CRect rect;
00168         pBar->GetWindowRect(&rect);
00169         size = rect.Size();
00170     }
00171     //WINBUG: COMCTL32.DLL is off by 4 pixels in its sizing logic.  Whatever
00172     //  is specified as the minimum size, the system rebar will allow that band
00173     //  to be 4 actual pixels smaller!  That's why we add 4 to the size here.
00174     pRBBI->cxMinChild = size.cx + 4;
00175     pRBBI->cyMinChild = size.cy;
00176     BOOL bResult = (BOOL)DefWindowProc(RB_INSERTBAND, (WPARAM)-1, (LPARAM)pRBBI);
00177
00178     CFrameWnd* pFrameWnd = GetParentFrame();
00179     if (pFrameWnd != NULL)
00180         pFrameWnd->RecalcLayout();
00181
00182     return bResult;
00183 }

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJReBar.h
  • WinCvs/CJLib/CJLibrary/CJReBar.cpp
Generated on Sun Oct 21 12:46:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJReBarCtrl Class Reference

#include <CJReBarCtrl.h>

Inheritance diagram for CCJReBarCtrl:

[legend]
Collaboration diagram for CCJReBarCtrl:

[legend]
List of all members.

Public Methods

CCJReBarCtrl ()
BOOL | Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
UINT | GetBandCount () const
BOOL | GetBandInfo (UINT uBand, REBARBANDINFO *prbbi) const
UINT | GetBarHeight () const
BOOL | GetBarInfo (REBARINFO *prbi) const
COLORREF | GetBkColor () const
IDropTarget * | GetDropTarget () const
BOOL | GetRect (UINT uBand, LPRECT prc) const
UINT | GetRowCount () const
UINT | GetRowHeight (UINT uRow) const
COLORREF | GetTextColor () const
CToolTipCtrl * | GetToolTips () const
int | IDToIndex (UINT uBandID) const
BOOL | SetBandInfo (UINT uBand, REBARBANDINFO *prbbi)
BOOL | SetBarInfo (REBARINFO *prbi)
COLORREF | SetBkColor (COLORREF clr)
CWnd * | SetOwner (CWnd *pWnd)
COLORREF | SetTextColor (COLORREF clr)
void | SetToolTips (CToolTipCtrl *pToolTip)
CImageList * | GetImageList () const
BOOL | SetImageList (CImageList *pImageList)
void | GetBandBorders (UINT uBand, LPRECT prc) const
CPalette * | GetPalette () const
CPalette * | SetPalette (HPALETTE hPal)
BOOL | GetColorScheme (COLORSCHEME *lpcs)
void | SetColorScheme (const COLORSCHEME *lpcs)
void | BeginDrag (UINT uBand, DWORD dwPos=(DWORD)-1)
BOOL | DeleteBand (UINT uBand)
void | DragMove (DWORD dwPos=(DWORD)-1)
void | EndDrag ()
int | HitTest (RBHITTESTINFO *prbht)
BOOL | InsertBand (UINT uIndex, REBARBANDINFO *prbbi)
void | MaximizeBand (UINT uBand)
void | MinimizeBand (UINT uBand)
BOOL | ShowBand (UINT uBand, BOOL fShow=TRUE)
BOOL | SizeToRect (CRect &rect)
BOOL | MoveBand (UINT uFrom, UINT uTo)

Constructor & Destructor Documentation

CCJReBarCtrl::CCJReBarCtrl ( )

Definition at line 56 of file CJReBarCtrl.cpp.

00057 {
00058 }

Member Function Documentation

_CJXLIB_INLINE void CCJReBarCtrl::BeginDrag | ( | UINT | uBand,
 |  | DWORD | dwPos = (DWORD)-1
 | ) |

Definition at line 181 of file CJReBarCtrl.h.

00182     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_BEGINDRAG, uBand, dwPos); }

BOOL CCJReBarCtrl::Create | ( | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID
 | ) |

Definition at line 60 of file CJReBarCtrl.cpp.

00062 {
00063     // initialize common controls
00064 #if _MSC_VER >= 1200
00065     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_COOL_REG));
00066 #else
00067     INITCOMMONCONTROLSEX icex;
00068     icex.dwSize = sizeof(icex);
00069     icex.dwICC = ICC_COOL_CLASSES;
00070     VERIFY(InitCommonControlsEx(&icex));
00071 #endif
00072
00073     CWnd* pWnd = this;
00074     return pWnd->Create(REBARCLASSNAME, NULL, dwStyle, rect, pParentWnd, nID);
00075 }

_CJXLIB_INLINE BOOL CCJReBarCtrl::DeleteBand ( UINT uBand )

Definition at line 184 of file CJReBarCtrl.h.

00185     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_DELETEBAND, uBand, 0L); }

_CJXLIB_INLINE void CCJReBarCtrl::DragMove ( DWORD dwPos = (DWORD)-1 )

Definition at line 187 of file CJReBarCtrl.h.

00188     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_DRAGMOVE, 0, dwPos); }

_CJXLIB_INLINE void CCJReBarCtrl::EndDrag ( )

Definition at line 190 of file CJReBarCtrl.h.

00191     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_ENDDRAG, 0, 0L); }

_CJXLIB_INLINE void CCJReBarCtrl::GetBandBorders | ( | UINT | uBand,
 |  | LPRECT | prc
 | ) | const

Definition at line 172 of file CJReBarCtrl.h.

00173     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_GETBANDBORDERS, uBand, (LPARAM)prc); }

_CJXLIB_INLINE UINT CCJReBarCtrl::GetBandCount ( ) const

Definition at line 118 of file CJReBarCtrl.h.

00119     { ASSERT(::IsWindow(m_hWnd)); return (UINT) ::SendMessage(m_hWnd, RB_GETBANDCOUNT, 0, 0L); }

_CJXLIB_INLINE BOOL CCJReBarCtrl::GetBandInfo | ( | UINT | uBand,
 |  | REBARBANDINFO * | prbbi
 | ) | const

Definition at line 121 of file CJReBarCtrl.h.

00122     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_GETBANDINFO, uBand, (LPARAM)prbbi); }

_CJXLIB_INLINE UINT CCJReBarCtrl::GetBarHeight ( ) const

Definition at line 124 of file CJReBarCtrl.h.

00125     { ASSERT(::IsWindow(m_hWnd)); return (UINT) ::SendMessage(m_hWnd, RB_GETBARHEIGHT, 0, 0L); }

_CJXLIB_INLINE BOOL CCJReBarCtrl::GetBarInfo ( REBARINFO * prbi ) const

Definition at line 127 of file CJReBarCtrl.h.

Referenced by GetImageList().

00128     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_GETBARINFO, 0, (LPARAM)prbi); }

_CJXLIB_INLINE COLORREF CCJReBarCtrl::GetBkColor ( ) const

Definition at line 130 of file CJReBarCtrl.h.

00131     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, RB_GETBKCOLOR, 0, 0L); }

BOOL CCJReBarCtrl::GetColorScheme ( COLORSCHEME * lpcs )

Definition at line 94 of file CJReBarCtrl.cpp.

00095 {
00096   lpcs->dwSize = sizeof(COLORSCHEME);
00097   return SendMessage(RB_GETCOLORSCHEME, 0, (LPARAM)lpcs);
00098 }

_CJXLIB_INLINE IDropTarget * CCJReBarCtrl::GetDropTarget ( ) const

Definition at line 133 of file CJReBarCtrl.h.

00134     { ASSERT(::IsWindow(m_hWnd)); IDropTarget* pdt; ::SendMessage(m_hWnd, RB_GETDROPTARGET, 0, (LPARAM)&pdt); return pdt; }

CImageList * CCJReBarCtrl::GetImageList ( ) const

Definition at line 77 of file CJReBarCtrl.cpp.

00078 {
00079   REBARINFO rbi;
00080   rbi.cbSize = sizeof(rbi);
00081   rbi.fMask = RBIM_IMAGELIST;
00082   return GetBarInfo(&rbi) ? CImageList::FromHandle(rbi.himl) : NULL;
00083 }

_CJXLIB_INLINE CPalette * CCJReBarCtrl::GetPalette ( ) const

Definition at line 175 of file CJReBarCtrl.h.

00176     { ASSERT(::IsWindow(m_hWnd)); return CPalette::FromHandle((HPALETTE)::SendMessage(m_hWnd, RB_GETPALETTE, 0, 0L)); }

_CJXLIB_INLINE BOOL CCJReBarCtrl::GetRect | ( | UINT | uBand,
 |  | LPRECT | prc
 | ) | const

Definition at line 136 of file CJReBarCtrl.h.

00137     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_GETRECT, uBand, (LPARAM)prc); }

_CJXLIB_INLINE UINT CCJReBarCtrl::GetRowCount ( ) const

Definition at line 139 of file CJReBarCtrl.h.

00140     { ASSERT(::IsWindow(m_hWnd)); return (UINT) ::SendMessage(m_hWnd, RB_GETROWCOUNT, 0, 0L); }

_CJXLIB_INLINE UINT CCJReBarCtrl::GetRowHeight ( UINT uRow ) const

Definition at line 142 of file CJReBarCtrl.h.

00143     { ASSERT(::IsWindow(m_hWnd)); return (UINT) ::SendMessage(m_hWnd, RB_GETROWHEIGHT, uRow, 0L); }

_CJXLIB_INLINE COLORREF CCJReBarCtrl::GetTextColor ( ) const

Definition at line 145 of file CJReBarCtrl.h.

00146     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, RB_GETTEXTCOLOR, 0, 0L); }

_CJXLIB_INLINE CToolTipCtrl * CCJReBarCtrl::GetToolTips ( ) const

Definition at line 148 of file CJReBarCtrl.h.

00149     { ASSERT(::IsWindow(m_hWnd)); return (CToolTipCtrl*)CWnd::FromHandle((HWND)::SendMessage(m_hWnd, RB_GETTOOLTIPS, 0, 0L)); }

_CJXLIB_INLINE int CCJReBarCtrl::HitTest ( RBHITTESTINFO * prbht )

Definition at line 193 of file CJReBarCtrl.h.

00194     { ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, RB_HITTEST, 0, (LPARAM)prbht); }

_CJXLIB_INLINE int CCJReBarCtrl::IDToIndex ( UINT uBandID ) const

Definition at line 151 of file CJReBarCtrl.h.

00152     { ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, RB_IDTOINDEX, uBandID, 0L); }

_CJXLIB_INLINE BOOL CCJReBarCtrl::InsertBand | ( | UINT | uIndex,
 |  | REBARBANDINFO * | prbbi
 | ) |

Definition at line 196 of file CJReBarCtrl.h.

00197     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_INSERTBAND, uIndex, (LPARAM)prbbi); }

_CJXLIB_INLINE void CCJReBarCtrl::MaximizeBand ( UINT uBand )

Definition at line 199 of file CJReBarCtrl.h.

00200     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_MAXIMIZEBAND, uBand, 0L); }

_CJXLIB_INLINE void CCJReBarCtrl::MinimizeBand ( UINT uBand )

Definition at line 202 of file CJReBarCtrl.h.

00203     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_MINIMIZEBAND, uBand, 0L); }

_CJXLIB_INLINE BOOL CCJReBarCtrl::MoveBand | ( | UINT | uFrom,
 |  | UINT | uTo
 | ) |

Definition at line 211 of file CJReBarCtrl.h.

00212     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_MOVEBAND, uFrom, uTo); }

_CJXLIB_INLINE BOOL CCJReBarCtrl::SetBandInfo | ( | UINT | uBand,
 |  | REBARBANDINFO * | prbbi
 | ) |

Definition at line 154 of file CJReBarCtrl.h.

00155     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_SETBANDINFO, uBand, (LPARAM)prbbi); }

_CJXLIB_INLINE BOOL CCJReBarCtrl::SetBarInfo ( REBARINFO * prbi )

Definition at line 157 of file CJReBarCtrl.h.

Referenced by SetImageList().

00158     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_SETBARINFO, 0, (LPARAM)prbi); }

_CJXLIB_INLINE COLORREF CCJReBarCtrl::SetBkColor ( COLORREF clr )

Definition at line 160 of file CJReBarCtrl.h.

00161     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, RB_SETBKCOLOR, 0, (LPARAM)clr); }

void CCJReBarCtrl::SetColorScheme ( const COLORSCHEME * lpcs )

Definition at line 100 of file CJReBarCtrl.cpp.

00101 {
00102   ((COLORSCHEME*)lpcs)->dwSize = sizeof(COLORSCHEME);
00103   SendMessage(RB_SETCOLORSCHEME, 0, (LPARAM)lpcs);
00104 }

BOOL CCJReBarCtrl::SetImageList ( CImageList * pImageList )

Definition at line 85 of file CJReBarCtrl.cpp.

00086 {
00087   REBARINFO rbi;
00088   rbi.cbSize = sizeof(rbi);
00089   rbi.fMask = RBIM_IMAGELIST;
00090   rbi.himl = (HIMAGELIST)pImageList->GetSafeHandle();
00091   return SetBarInfo(&rbi);
00092 }

_CJXLIB_INLINE CWnd * CCJReBarCtrl::SetOwner ( CWnd * pWnd )

Definition at line 163 of file CJReBarCtrl.h.

00164     { ASSERT(::IsWindow(m_hWnd)); return CWnd::FromHandle((HWND)::SendMessage(m_hWnd, RB_SETPARENT, (WPARAM)pWnd->m_hWnd, 0L)); }

_CJXLIB_INLINE CPalette * CCJReBarCtrl::SetPalette ( HPALETTE hPal )

Definition at line 178 of file CJReBarCtrl.h.

00179     { ASSERT(::IsWindow(m_hWnd)); return CPalette::FromHandle((HPALETTE)::SendMessage(m_hWnd, RB_SETPALETTE, 0, (LPARAM)hPal)); }

_CJXLIB_INLINE COLORREF CCJReBarCtrl::SetTextColor ( COLORREF clr )

Definition at line 166 of file CJReBarCtrl.h.

00167     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, RB_SETTEXTCOLOR, 0, (LPARAM)clr); }

_CJXLIB_INLINE void CCJReBarCtrl::SetToolTips ( CToolTipCtrl * pToolTip )

Definition at line 169 of file CJReBarCtrl.h.

00170     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, RB_SETTOOLTIPS, (WPARAM)pToolTip->m_hWnd, 0L); }

_CJXLIB_INLINE BOOL CCJReBarCtrl::ShowBand | ( | UINT | uBand,
 |  | BOOL | fShow = TRUE
 | ) |

Definition at line 205 of file CJReBarCtrl.h.

00206     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_SHOWBAND, uBand, fShow); }

_CJXLIB_INLINE BOOL CCJReBarCtrl::SizeToRect ( CRect & rect )

Definition at line 208 of file CJReBarCtrl.h.

00209     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, RB_SIZETORECT, 0, (LPARAM)&rect); }

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJReBarCtrl.h
  • WinCvs/CJLib/CJLibrary/CJReBarCtrl.cpp
Generated on Sun Oct 21 12:46:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJShellTree Class Reference

Inheritance diagram for CCJShellTree:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/ExploreBar.h
Generated on Sun Oct 21 12:46:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJSizeDockBar Class Reference

#include <CJSizeDockBar.h>

Inheritance diagram for CCJSizeDockBar:

[legend]
Collaboration diagram for CCJSizeDockBar:

[legend]
List of all members.

Public Methods

CCJSizeDockBar ()
virtual | ~CCJSizeDockBar ()
void | Normalize (CCJControlBar *)
void | Maximize (CCJControlBar *)
void | CalcSizeBarLayout ()
void | SetActualSize (int iSize)
void | EraseNonClient ()
void | DrawBorders (CDC *pDC, CRect &rect)
void | RecalcAllExcept (CCJSizeDockBar *pBar)
CCJControlBar * | GetDockedSizeBar (int nPos)
void | FlatBorder (BOOL bFlat=TRUE)
virtual CSize | CalcDynamicLayout (int nLength, DWORD nMode)
virtual void | DoPaint (CDC *pDC)
virtual BOOL | IsDockBar () const
virtual BOOL | IsDockSizeBar () const
virtual void | OnInvertTracker (const CRect &)
virtual void | HitTest (const CPoint &point)

Static Public Attributes

bool | m_bIsDockBar = false

Protected Methods

BOOL | IsLastControlBar (int index)
void | GetAvailableRect (CRect &rect)
afx_msg void | OnNcPaint ()
afx_msg void | OnNcCalcSize (BOOL bCalcValidRects, NCCALCSIZE_PARAMS *lpncsp)
afx_msg BOOL | OnSetCursor (CWnd *pWnd, UINT nHitTest, UINT message)
afx_msg UINT | OnNcHitTest (CPoint point)
afx_msg void | OnNcLButtonDown (UINT nHitTest, CPoint point)
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point)
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)

Protected Attributes

int | m_iSafeSpace
int | m_iActualSize
BOOL | m_bDragging
BOOL | m_bOkToDrag
CRect | m_rcTrack
CPoint | m_ptCurDrag
CPoint | m_ptStartDrag
HCURSOR | m_curHSplitBar
HCURSOR | m_curVSplitBar
BOOL | m_bFlatBorder
CPoint | m_ptCurrent

Constructor & Destructor Documentation

CCJSizeDockBar::CCJSizeDockBar ( )

Definition at line 111 of file CJSizeDockBar.cpp.

00112 {
00113     m_cxLeftBorder      = 0;
00114     m_cyTopBorder       = 0;
00115     m_cxRightBorder     = 0;
00116     m_cyBottomBorder    = 0;
00117     m_iActualSize       = 100;
00118     m_iSafeSpace        = 25;
00119     m_bOkToDrag         = FALSE;
00120     m_bDragging         = FALSE;
00121     m_bAutoDelete       = TRUE;
00122     m_bFlatBorder       = TRUE;     //Yiannhs v6.06 for Docking bar flat border
00123     m_ptCurrent         = CPoint(0,0);
00124 }

CCJSizeDockBar::~CCJSizeDockBar ( ) [virtual]

Definition at line 126 of file CJSizeDockBar.cpp.

00127 {
00128     // TODO: add destruction code here.
00129 }

Member Function Documentation

CSize CCJSizeDockBar::CalcDynamicLayout | ( | int | nLength,
 |  | DWORD | nMode
 | ) | [virtual]

Definition at line 148 of file CJSizeDockBar.cpp.

00149 {
00150     int ActualSize = 0;
00151     for(int i=0;i<= m_arrBars.GetUpperBound();++i)
00152     {
00153         CCJControlBar *pBar = (CCJControlBar *)GetDockedControlBar(i);
00154         if (pBar != NULL && pBar->IsVisible())
00155         {
00156             ActualSize = m_iActualSize;
00157             break;
00158         }
00159     }
00160
00161     int cx=0,cy=0;
00162     if (nMode & LM_VERTDOCK) {
00163         cx = ActualSize ;
00164         cy = 32767;
00165     }
00166
00167     if (nMode & LM_HORZDOCK) {
00168         cx= 32767;
00169         cy = ActualSize;
00170     }
00171
00172     //Yiannhs. Use selective layout. Since the dock bar does not calculate the bar sizes yet
00173     if( !m_bLayoutQuery )
00174         CalcSizeBarLayout();
00175
00176     return CSize(cx,cy);
00177 }

void CCJSizeDockBar::CalcSizeBarLayout ( )

Definition at line 594 of file CJSizeDockBar.cpp.

Referenced by Maximize(), Normalize(), RecalcAllExcept(), CCJMDIFrameWnd::RecalcAllExcept(), CCJMDIChildWnd::RecalcAllExcept(), and CCJFrameWnd::RecalcAllExcept().

00595 {
00596     //Yiannhs: It is necessary to set all Control bars in one row.
00597     //         till now multiple rows are not handled
00598     int VisCount = GetDockedVisibleCount();
00599     if( !VisCount )
00600         return;      //Yiannhs v6.07 moved this on top
00601
00602     AFX_SIZEPARENTPARAMS layout;
00603     layout.hDWP = ::BeginDeferWindowPos( m_arrBars.GetSize( ));
00604     CRect rectAvail;
00605     GetClientRect(&rectAvail);
00606
00607     int nCount = 0;
00608     int lastLeft = 0;
00609     int lastTop = 0;
00610
00611     for (int i = 0; i < m_arrBars.GetSize(); i++)
00612     {
00613         CCJControlBar* pBar = STATIC_DOWNCAST(CCJControlBar, (CObject*)GetDockedControlBar(i));
00614         if (pBar != NULL && pBar->IsVisible())
00615         {
00616             if(!pBar->IsKindOf(RUNTIME_CLASS(CCJControlBar)))
00617                 continue;
00618
00619             CRect rectBar;
00620             ++nCount;
00621             pBar->GetWindowRect(&rectBar);
00622             pBar->m_bUnique = FALSE;        //Yiannhs ok in Ver 6.07
00623             ScreenToClient(&rectBar);
00624             CSize sizeIdeal = pBar->CalcDynamicLayout(-1, 0);
00625
00626             //Yiannhs  moved [if] code at the begining. It helps make these calculations near the top
00627             //         for checking the size of the last control bars
00628             int bIsLast = IsLastControlBar(i+1);
00629             pBar->m_bToFit = bIsLast;           //check fitting is setup here
00630             if( bIsLast && nCount == 1 ) {
00631                 pBar->m_bUnique = TRUE;
00632             }
00633
00635             //  so it is not completely hidden
00636             if( rectBar.right >= rectAvail.right && !bIsLast )
00637                 sizeIdeal.cx -= (sizeIdeal.cx / 4);
00638             if( rectBar.bottom >= rectAvail.bottom && !bIsLast )
00639                 sizeIdeal.cy -= (sizeIdeal.cy / 4);
00640
00641             //Yiannhs: The Dock bar is either horizontally or vertically docked itself.
00642             //         So are the ControlBars enclosed inside it. Since the control bars
00643             //         are docked, and Sizing dockbar does not derive from CCJControlBar
00644             //         we may be a bit more clever.
00645             if( m_dwStyle & CBRS_ORIENT_HORZ ) {//use some default data members
00646                 //horizontal;
00647                 rectBar.left = lastLeft;
00648                 rectBar.top = 0;
00649                 rectBar.bottom = rectAvail.Height();
00650                 rectBar.right = rectBar.left + sizeIdeal.cx;
00651
00652                 if( rectBar.left > lastLeft )
00653                     rectBar.left = lastLeft;
00654
00655                 lastLeft = rectBar.right;
00656                 if ( bIsLast ) {    //Yiannhs
00657                     rectBar.right = rectAvail.right;
00658                 }
00659
00660             } else if( m_dwStyle & CBRS_ORIENT_VERT ) {
00661                 //Vertical
00662                 rectBar.top = lastTop;
00663                 rectBar.left = 0;
00664                 rectBar.right = rectAvail.Width();
00665                 rectBar.bottom = rectBar.top + sizeIdeal.cy;
00666
00667                 if (rectBar.top > lastTop)
00668                     rectBar.top = lastTop;
00669
00670                 lastTop = rectBar.bottom;
00671                 if ( bIsLast ) {    //Yiannhs
00672                     rectBar.bottom = rectAvail.bottom;
00673                 }
00674             }
00675
00676             AfxRepositionWindow( &layout, pBar->m_hWnd, &rectBar );
00677         }
00678     }
00679
00680     // move and resize all the windows at once!
00681     if( layout.hDWP == NULL || !::EndDeferWindowPos( layout.hDWP ))
00682         TRACE0("Warning: DeferWindowPos failed - low system resources.\n");
00683 }

void CCJSizeDockBar::DoPaint ( CDC * pDC ) [virtual]

Definition at line 179 of file CJSizeDockBar.cpp.

00180 {
00181     CDockBar::DoPaint(pDC);
00182 }

void CCJSizeDockBar::DrawBorders | ( | CDC * | pDC,
 |  | CRect & | rect
 | ) |

Definition at line 495 of file CJSizeDockBar.cpp.

Referenced by EraseNonClient().

00496 {
00497     int cxBorderLeft    = 0;
00498     int cxBorderRight   = 0;
00499     int cyBorderTop     = 0;
00500     int cyBorderBottom  = 0;
00501
00502     CRect rc;
00503     rc.CopyRect(&rect);
00504
00505     //Yiannhs: i've replaced color variables with the afxdata ones.
00506     if (m_dwStyle & CBRS_BORDER_TOP) {
00507         pDC->FillSolidRect(rc.left, rc.top, rc.Width(), 1, afxData.clrBtnShadow);
00508         pDC->FillSolidRect(rc.left, rc.top+1, rc.Width(), 1, afxData.clrBtnHilite);
00509         cyBorderTop+=2;
00510     }
00511
00512     if (m_dwStyle & CBRS_BORDER_BOTTOM) {
00513         pDC->FillSolidRect(rc.left, rc.bottom-1, rc.Width(), 1, afxData.clrBtnHilite);
00514         pDC->FillSolidRect(rc.left, rc.bottom-2, rc.Width(), 1, afxData.clrBtnShadow);
00515         cyBorderBottom+=2;
00516     }
00517
00518     if (m_dwStyle & CBRS_BORDER_LEFT) {
00519         pDC->FillSolidRect(rc.left, rc.top, 1, rc.Height(), afxData.clrBtnShadow);
00520         pDC->FillSolidRect(rc.left+1, rc.top, 1, rc.Height(), afxData.clrBtnHilite);
00521         cxBorderLeft+=2;
00522     }
00523
00524     if (m_dwStyle & CBRS_BORDER_RIGHT) {
00525         pDC->FillSolidRect(rc.right-2, rc.top, 1, rc.Height(), afxData.clrBtnShadow);
00526         pDC->FillSolidRect(rc.right-1, rc.top, 1, rc.Height(), afxData.clrBtnHilite);
00527         cxBorderRight+=2;
00528     }
00529
00530     UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00531
00532     CRect rcTrack;
00533     rcTrack.CopyRect(&rc);
00534
00535     if (nID == AFX_IDW_SIZEBAR_LEFT) {
00536         rcTrack.left    = rc.right - TRACK_BORDER_SIZE;
00537         rcTrack.right  += 1;
00538         rcTrack.top    += 1;
00539         rcTrack.bottom -= 1;
00540         //Yiannhs moved below
00541         cxBorderRight = TRACK_BORDER_SIZE;
00542     }
00543
00544     else if (nID == AFX_IDW_SIZEBAR_TOP) {
00545         rcTrack.top = rc.bottom - TRACK_BORDER_SIZE;
00546         rcTrack.bottom+=1;
00547         //Yiannhs moved below
00548         cyBorderBottom = TRACK_BORDER_SIZE;
00549     }
00550
00551     else if (nID == AFX_IDW_SIZEBAR_RIGHT) {
00552         rcTrack.right   = rc.left + TRACK_BORDER_SIZE;
00553         rcTrack.left   -= 1;
00554         rcTrack.top    += 1;
00555         rcTrack.bottom -= 1;
00556         //Yiannhs moved below
00557         cxBorderLeft = TRACK_BORDER_SIZE;
00558     }
00559
00560     else if (nID == AFX_IDW_SIZEBAR_BOTTOM) {
00561         rcTrack.bottom = rc.top + TRACK_BORDER_SIZE;
00562         rcTrack.top-=1;
00563         //Yiannhs moved below
00564         cyBorderTop = TRACK_BORDER_SIZE;
00565     }
00566
00567     //Yiannhs Moved these here. in one place. The optimizer may do this, but lets help it.
00568     pDC->FillSolidRect(rcTrack, afxData.clrBtnFace);
00569     if( !m_bFlatBorder )    //Yiannhs handle flat borders
00570         pDC->Draw3dRect(rcTrack, afxData.clrBtnHilite, afxData.clrBtnShadow);
00571
00572     rect.left   += cxBorderLeft;
00573     rect.right  -= cxBorderRight;
00574     rect.top    += cyBorderTop;
00575     rect.bottom -= cyBorderBottom;
00576 }

void CCJSizeDockBar::EraseNonClient ( )

Definition at line 578 of file CJSizeDockBar.cpp.

Referenced by OnNcPaint().

00579 {
00580     CWindowDC dc(this);
00581     CRect rectClient;
00582     GetClientRect(rectClient);
00583     CRect rectWindow;
00584     GetWindowRect(rectWindow);
00585     ScreenToClient(rectWindow);
00586     rectClient.OffsetRect(-rectWindow.left, -rectWindow.top);
00587     dc.ExcludeClipRect(rectClient);
00588     rectWindow.OffsetRect(-rectWindow.left, -rectWindow.top);
00589     DrawBorders(&dc, rectWindow);
00590 }

_CJXLIB_INLINE void CCJSizeDockBar::FlatBorder ( BOOL bFlat = TRUE )

Definition at line 242 of file CJSizeDockBar.h.

Referenced by CCJMDIFrameWnd::EnableDockingSizeBar(), CCJMDIChildWnd::EnableDockingSizeBar(), and CCJFrameWnd::EnableDockingSizeBar().

00243     { if(m_bFlatBorder!=bFlat){m_bFlatBorder=bFlat;InvalidateRect(NULL,FALSE);UpdateWindow();}}

void CCJSizeDockBar::GetAvailableRect ( CRect & rect ) [protected]

Definition at line 455 of file CJSizeDockBar.cpp.

Referenced by OnLButtonUp(), and OnMouseMove().

00456 {
00457     GetDockingFrame()->GetClientRect(&rect);
00458     GetDockingFrame()->RepositionBars(0xffff, 0xffff, AFX_IDW_PANE_FIRST,reposQuery,
00459         &rect, &rect, TRUE);
00460 }

CCJControlBar * CCJSizeDockBar::GetDockedSizeBar ( int nPos )

Definition at line 476 of file CJSizeDockBar.cpp.

Referenced by CCJMiniDockFrameWnd::OnNcLButtonDblClk(), and CCJMiniDockFrameWnd::OnNcLButtonDown().

00477 {
00478     return (CCJControlBar*)GetDockedControlBar(nPos);
00479 }

void CCJSizeDockBar::HitTest ( const CPoint & point ) [virtual]

Definition at line 205 of file CJSizeDockBar.cpp.

Referenced by OnNcHitTest().

00206 {
00207     UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00208     CRect rcWin;
00209     GetWindowRect(&rcWin);
00210     HCURSOR hCur = NULL;
00211
00212     //Yiannhs: Check the if statements, and change of variable TRackBorder size
00213     if (nID == AFX_IDW_SIZEBAR_LEFT || nID == AFX_IDW_SIZEBAR_RIGHT ) {
00214         //we are sure the DOCK bar is vertical
00215         if( nID == AFX_IDW_SIZEBAR_LEFT )
00216             rcWin.left = rcWin.right - TRACK_BORDER_SIZE;
00217         else
00218             rcWin.right = rcWin.left + TRACK_BORDER_SIZE;
00219
00220         if( rcWin.PtInRect(point) )
00221             hCur = AfxGetApp()->LoadCursor(IDC_HSPLITBAR);
00222
00223     } else {
00224         //The DOCK bar is horizontal
00225         if (nID == AFX_IDW_SIZEBAR_TOP)
00226             rcWin.top = rcWin.bottom - TRACK_BORDER_SIZE;
00227         else
00228             rcWin.bottom = rcWin.top + TRACK_BORDER_SIZE;
00229
00230         if( rcWin.PtInRect(point) )
00231             hCur = AfxGetApp()->LoadCursor(IDC_VSPLITBAR);
00232     }
00233
00234     if( hCur )
00235         SetCursor(hCur);
00236
00237     m_bOkToDrag = BOOL((long)hCur);
00238 }

_CJXLIB_INLINE BOOL CCJSizeDockBar::IsDockBar ( ) const [virtual]

Definition at line 233 of file CJSizeDockBar.h.

00234     { return m_bIsDockBar; }

_CJXLIB_INLINE BOOL CCJSizeDockBar::IsDockSizeBar ( ) const [virtual]

Definition at line 236 of file CJSizeDockBar.h.

Referenced by CCJDockContext::CanDockDockBar().

00237     { return TRUE; }

BOOL CCJSizeDockBar::IsLastControlBar ( int index ) [protected]

Definition at line 462 of file CJSizeDockBar.cpp.

Referenced by CalcSizeBarLayout().

00463 {
00464     for( int i=index; i<m_arrBars.GetSize(); ++i)
00465     {
00466         CCJControlBar *pOther = (CCJControlBar *)GetDockedControlBar(i);
00467         if (pOther != NULL && pOther->IsVisible())
00468         {
00469             return FALSE;
00470         }
00471     }
00472
00473     return TRUE;
00474 }

void CCJSizeDockBar::Maximize ( CCJControlBar * pBar )

Definition at line 685 of file CJSizeDockBar.cpp.

00686 {
00687     int iExt=0;
00688     CRect rectAvail;
00689     GetClientRect(rectAvail);
00690
00691     for (int i=0; i<m_arrBars.GetSize(); ++i)
00692     {
00693         CCJControlBar *pBarDock = (CCJControlBar *)GetDockedControlBar(i);
00694         if (pBarDock && pBarDock->IsVisible() && pBarDock != pBar) {
00695             pBarDock->Minimize();
00696             iExt += pBarDock->GetMinExt();
00697         }
00698     }
00699
00700     if (pBar->IsLeftDocked() || pBar->IsRightDocked()) {
00701         iExt = rectAvail.Height()-iExt;
00702     }
00703
00704     if (pBar->IsTopDocked() || pBar->IsBottomDocked()) {
00705         iExt = rectAvail.Width()-iExt;
00706     }
00707
00708     pBar->Maximize(iExt);
00709
00710     //1999-05-26 Yiannhs
00711     //do not care too much about flickering when maximizing controlbars
00712     CalcSizeBarLayout();
00713
00714     for (i=0; i<m_arrBars.GetSize(); ++i)
00715     {
00716         CCJControlBar *pBarDock = (CCJControlBar *)GetDockedControlBar(i);
00717         if (pBarDock && pBarDock->IsVisible() ) {
00718             pBarDock->InvalidateRect(NULL, TRUE);
00719             pBarDock->UpdateWindow();
00720         }
00721     }
00722     //1999-05-26 Yiannhs
00723 }

void CCJSizeDockBar::Normalize ( CCJControlBar * )

Definition at line 725 of file CJSizeDockBar.cpp.

00726 {
00727     for( int i=0; i<m_arrBars.GetSize(); ++i) {
00728         CCJControlBar *pBarDock = (CCJControlBar*)GetDockedControlBar(i);
00729         if (pBarDock && pBarDock->IsVisible())
00730             pBarDock->Normalize();
00731     }
00732
00733
00734     //1999-05-26 Yiannhs
00735     //do not care too much about flickering when maximizing controlbars
00736
00737     CalcSizeBarLayout();
00738
00739     for (i=0; i<m_arrBars.GetSize(); ++i)
00740     {
00741         CCJControlBar *pBarDock = (CCJControlBar *)GetDockedControlBar(i);
00742         if (pBarDock && pBarDock->IsVisible() ) {
00743             pBarDock->InvalidateRect(NULL, TRUE);
00744             pBarDock->UpdateWindow();
00745         }
00746     }
00747     //1999-05-26 Yiannhs
00748 }

void CCJSizeDockBar::OnInvertTracker ( const CRect & rect ) [virtual]

Definition at line 184 of file CJSizeDockBar.cpp.

Referenced by OnLButtonUp(), OnMouseMove(), and OnNcLButtonDown().

00185 {
00186     ASSERT_VALID(this);
00187     ASSERT(!rect.IsRectEmpty());
00188
00189     CDC* pDC = GetDockingFrame()->GetDC();
00190     CBrush* pBrush = CDC::GetHalftoneBrush();
00191     CBrush* pOldBrush = NULL;
00192
00193     if (pBrush != NULL) {
00194         pOldBrush = pDC->SelectObject(pBrush);
00195     }
00196
00197     pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATINVERT);
00198
00199     if (pOldBrush != NULL) {
00200         pDC->SelectObject(pOldBrush);
00201     }
00202     GetDockingFrame()->ReleaseDC(pDC);
00203 }

void CCJSizeDockBar::OnLButtonUp | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 330 of file CJSizeDockBar.cpp.

00331 {
00332     if( m_ptCurrent == point ) {
00333         ReleaseCapture();
00334         m_bDragging = FALSE;
00335         OnInvertTracker(m_rcTrack);
00336         CDockBar::OnLButtonUp(nFlags, point);
00337     }
00338
00339     else if( m_bDragging )
00340     {
00341         CRect rectWin;
00342         CRect rectAvail;
00343         GetWindowRect(&rectWin);
00344         ReleaseCapture();
00345         m_bDragging = FALSE;
00346         OnInvertTracker(m_rcTrack);
00347         GetAvailableRect(rectAvail);
00348         UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00349
00350         if (nID == AFX_IDW_SIZEBAR_LEFT ) {
00351             int maxWidth = rectAvail.Width()-m_iSafeSpace;
00352             int newWidth = m_rcTrack.left-m_ptStartDrag.x;
00353             m_iActualSize = newWidth>maxWidth ? maxWidth: newWidth;
00354             m_iActualSize += rectWin.Width();
00355         }
00356
00357         else if (nID == AFX_IDW_SIZEBAR_TOP) {
00358             int maxHeight = rectAvail.Height()-m_iSafeSpace;
00359             int newHeight = m_rcTrack.top-m_ptStartDrag.y;
00360             m_iActualSize = newHeight>maxHeight ? maxHeight : newHeight;
00361             m_iActualSize += rectWin.Height();
00362         }
00363
00364         else if (nID == AFX_IDW_SIZEBAR_RIGHT) {
00365             int maxWidth = rectAvail.Width()-m_iSafeSpace;
00366             int newWidth = m_ptStartDrag.x-m_rcTrack.left;
00367             m_iActualSize = newWidth>maxWidth ? maxWidth: newWidth;
00368             m_iActualSize += rectWin.Width();
00369         }
00370
00371         else if (nID == AFX_IDW_SIZEBAR_BOTTOM) {
00372             int maxHeight = rectAvail.Height()-m_iSafeSpace;
00373             int newHeight = m_ptStartDrag.y-m_rcTrack.top;
00374             m_iActualSize = newHeight>maxHeight ? maxHeight : newHeight;
00375             m_iActualSize += rectWin.Height();
00376         }
00377
00378         if(m_iActualSize< TRACK_BORDER_SIZE )
00379             m_iActualSize = TRACK_BORDER_SIZE;
00380
00381         GetDockingFrame()->RecalcLayout();
00382         RecalcAllExcept(NULL);
00383
00384     } else {
00385         //Yiannhs
00386         CDockBar::OnLButtonUp(nFlags, point);
00387     }
00388 }

void CCJSizeDockBar::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 390 of file CJSizeDockBar.cpp.

00391 {
00392     if( m_bDragging )
00393     {
00394         CRect rectWin;
00395         GetWindowRect(&rectWin);
00396         CRect rectAvail;
00397         GetAvailableRect(rectAvail);
00398         CFrameWnd *pFrame=GetDockingFrame();
00399         ClientToScreen(&point);
00400         pFrame->ScreenToClient(&point);
00401         UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00402
00403         if (nID == AFX_IDW_SIZEBAR_LEFT) {
00404             point.x = point.x > rectAvail.right ? rectAvail.right : point.x;
00405             point.x = point.x < TRACK_BORDER_SIZE ? TRACK_BORDER_SIZE : point.x;
00406         }
00407
00408         else if (nID == AFX_IDW_SIZEBAR_TOP) {
00409             point.y = point.y > rectAvail.bottom ? rectAvail.bottom : point.y;
00410             point.y = point.y < TRACK_BORDER_SIZE ? TRACK_BORDER_SIZE : point.y;
00411         }
00412
00413         else if (nID == AFX_IDW_SIZEBAR_RIGHT) {
00414             point.x = point.x < rectAvail.left ? rectAvail.left:point.x;
00415             point.x = point.x > rectAvail.right + m_iActualSize - TRACK_BORDER_SIZE ?
00416                                 rectAvail.right - TRACK_BORDER_SIZE + m_iActualSize : point.x;
00417         }
00418
00419         else if (nID == AFX_IDW_SIZEBAR_BOTTOM) {
00420             point.y = point.y < rectAvail.top ? rectAvail.top : point.y;
00421             point.y = point.y > rectAvail.bottom + m_iActualSize - TRACK_BORDER_SIZE ?
00422                                 rectAvail.bottom - TRACK_BORDER_SIZE + m_iActualSize : point.y;
00423         }
00424
00425         int deltaX = point.x - m_ptCurDrag.x;
00426         int deltaY = point.y - m_ptCurDrag.y;
00427
00428         m_ptCurDrag = point;
00429
00430         if (nID == AFX_IDW_SIZEBAR_LEFT || nID == AFX_IDW_SIZEBAR_RIGHT && deltaX)
00431         {
00432             OnInvertTracker(m_rcTrack);
00433             m_rcTrack.left+=deltaX;
00434             m_rcTrack.right+=deltaX;
00435             OnInvertTracker(m_rcTrack);
00436         }
00437
00438         else if( nID == AFX_IDW_SIZEBAR_TOP || nID == AFX_IDW_SIZEBAR_BOTTOM && deltaY)
00439         {
00440             OnInvertTracker(m_rcTrack);
00441             m_rcTrack.top+=deltaY;
00442             m_rcTrack.bottom+=deltaY;
00443             OnInvertTracker(m_rcTrack);
00444         }
00445
00446     } else {
00447         //Yiannhs
00448         CDockBar::OnMouseMove(nFlags, point);
00449     }
00450 }

void CCJSizeDockBar::OnNcCalcSize | ( | BOOL | bCalcValidRects,
 |  | NCCALCSIZE_PARAMS * | lpncsp
 | ) | [protected]

Definition at line 248 of file CJSizeDockBar.cpp.

00249 {
00250     UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00251     //Yiannhs changed the tracksize variable
00252     if (nID == AFX_IDW_SIZEBAR_LEFT) {
00253         m_cyBottomBorder += TRACK_BORDER_SIZE;
00254         CDockBar::OnNcCalcSize(bCalcValidRects, lpncsp);
00255         m_cyBottomBorder -= TRACK_BORDER_SIZE;
00256     }
00257
00258     else if (nID == AFX_IDW_SIZEBAR_TOP) {
00259         m_cyBottomBorder += TRACK_BORDER_SIZE;
00260         CDockBar::OnNcCalcSize(bCalcValidRects, lpncsp);
00261         m_cyBottomBorder -= TRACK_BORDER_SIZE;
00262     }
00263
00264     else if (nID == AFX_IDW_SIZEBAR_RIGHT) {
00265         m_cyTopBorder += TRACK_BORDER_SIZE;
00266         CDockBar::OnNcCalcSize(bCalcValidRects, lpncsp);
00267         m_cyTopBorder -= TRACK_BORDER_SIZE;
00268     }
00269
00270     else if (nID == AFX_IDW_SIZEBAR_BOTTOM) {
00271         m_cyTopBorder += TRACK_BORDER_SIZE;
00272         CDockBar::OnNcCalcSize(bCalcValidRects, lpncsp);
00273         m_cyTopBorder -= TRACK_BORDER_SIZE;
00274     }
00275 }

UINT CCJSizeDockBar::OnNcHitTest ( CPoint point ) [protected]

Definition at line 283 of file CJSizeDockBar.cpp.

00284 {
00285     HitTest(point);
00286     return (m_bOkToDrag)?HTBORDER:CDockBar::OnNcHitTest(point);
00287 }

void CCJSizeDockBar::OnNcLButtonDown | ( | UINT | nHitTest,
 |  | CPoint | point
 | ) | [protected]

Definition at line 289 of file CJSizeDockBar.cpp.

00290 {
00291     // save the current cursor postion.
00292     m_ptCurrent = point;
00293     ScreenToClient(&m_ptCurrent);
00294
00295     if( m_bOkToDrag )
00296     {
00297         UINT nID = ((UINT)(WORD)::GetDlgCtrlID(m_hWnd));
00298         CFrameWnd *pFrame=GetDockingFrame();
00299         GetWindowRect(m_rcTrack);
00300
00301         //Yiannhs changed tracsize variable
00302         if (nID == AFX_IDW_SIZEBAR_LEFT)
00303             m_rcTrack.left = m_rcTrack.right - TRACK_BORDER_SIZE;
00304
00305         else if (nID == AFX_IDW_SIZEBAR_TOP)
00306             m_rcTrack.top = m_rcTrack.bottom - TRACK_BORDER_SIZE;
00307
00308         else if (nID == AFX_IDW_SIZEBAR_RIGHT)
00309             m_rcTrack.right = m_rcTrack.left + TRACK_BORDER_SIZE;
00310
00311         else if (nID == AFX_IDW_SIZEBAR_BOTTOM)
00312             m_rcTrack.bottom = m_rcTrack.top + TRACK_BORDER_SIZE;
00313
00314         pFrame->ScreenToClient(&m_rcTrack);
00315         pFrame->ScreenToClient(&point);
00316
00317         m_ptStartDrag = point;
00318         m_ptCurDrag = point;
00319
00320         SetCapture();
00321         m_bDragging = TRUE;
00322         OnInvertTracker(m_rcTrack);
00323
00324     } else {
00325         //Yiannhs
00326         CDockBar::OnNcLButtonDown(nHitTest, point);
00327     }
00328 }

void CCJSizeDockBar::OnNcPaint ( ) [protected]

Definition at line 243 of file CJSizeDockBar.cpp.

00244 {
00245     EraseNonClient();
00246 }

BOOL CCJSizeDockBar::OnSetCursor | ( | CWnd * | pWnd,
 |  | UINT | nHitTest,
 |  | UINT | message
 | ) | [protected]

Definition at line 277 of file CJSizeDockBar.cpp.

00278 {
00279     return (nHitTest == HTCLIENT)?
00280         CDockBar::OnSetCursor(pWnd, nHitTest, message):FALSE;
00281 }

void CCJSizeDockBar::RecalcAllExcept ( CCJSizeDockBar * pBar )

Definition at line 481 of file CJSizeDockBar.cpp.

Referenced by OnLButtonUp().

00482 {
00483     CFrameWnd *pFrame = GetParentFrame();
00484     ASSERT_VALID(pFrame);
00485
00486     for (int i = 0; i < 4; i++)
00487     {
00488         CCJSizeDockBar* pDock = (CCJSizeDockBar*)pFrame->GetControlBar(dwSizeBarMap[i][0]);
00489         if (pDock != NULL && pDock != pBar) {
00490             pDock->CalcSizeBarLayout();
00491         }
00492     }
00493 }

_CJXLIB_INLINE void CCJSizeDockBar::SetActualSize ( int iSize )

Definition at line 239 of file CJSizeDockBar.h.

Referenced by CCJMDIFrameWnd::DockSizeBar(), CCJMDIChildWnd::DockSizeBar(), and CCJFrameWnd::DockSizeBar().

00240     { m_iActualSize=iSize; }

Member Data Documentation

BOOL CCJSizeDockBar::m_bDragging [protected]

Definition at line 126 of file CJSizeDockBar.h.

BOOL CCJSizeDockBar::m_bFlatBorder [protected]

Definition at line 142 of file CJSizeDockBar.h.

bool CCJSizeDockBar::m_bIsDockBar = false [static]

Definition at line 106 of file CJSizeDockBar.cpp.

BOOL CCJSizeDockBar::m_bOkToDrag [protected]

Definition at line 129 of file CJSizeDockBar.h.

HCURSOR CCJSizeDockBar::m_curHSplitBar [protected]

Definition at line 136 of file CJSizeDockBar.h.

HCURSOR CCJSizeDockBar::m_curVSplitBar [protected]

Definition at line 139 of file CJSizeDockBar.h.

int CCJSizeDockBar::m_iActualSize [protected]

Definition at line 124 of file CJSizeDockBar.h.

int CCJSizeDockBar::m_iSafeSpace [protected]

Definition at line 122 of file CJSizeDockBar.h.

CPoint CCJSizeDockBar::m_ptCurDrag [protected]

Definition at line 133 of file CJSizeDockBar.h.

CPoint CCJSizeDockBar::m_ptCurrent [protected]

Definition at line 143 of file CJSizeDockBar.h.

CPoint CCJSizeDockBar::m_ptStartDrag [protected]

Definition at line 134 of file CJSizeDockBar.h.

CRect CCJSizeDockBar::m_rcTrack [protected]

Definition at line 132 of file CJSizeDockBar.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJSizeDockBar.h
  • WinCvs/CJLib/CJLibrary/CJSizeDockBar.cpp
Generated on Sun Oct 21 12:46:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJSortClass Class Reference

#include <CJSortClass.h>

Collaboration diagram for CCJSortClass:

[legend]
List of all members.

Public Methods

CCJSortClass (CListCtrl *pWnd, const int nCol)
virtual | ~CCJSortClass ()
virtual void | Sort (bool bAsc, DATA_TYPE eType)

Static Protected Methods

int CALLBACK | Compare (LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)

Protected Attributes

CListCtrl * m_pWnd

Constructor & Destructor Documentation

CCJSortClass::CCJSortClass | ( | CListCtrl * | pWnd,
 |  | const int | nCol
 | ) |

Definition at line 38 of file CJSortClass.cpp.

00039 {
00040     ASSERT(pWnd);
00041     m_pWnd = pWnd;
00042
00043     int nCount = m_pWnd->GetItemCount();
00044     DWORD dwData;
00045     CString strItemText;
00046
00047     // replace Item data with pointer to CSortItem structure
00048     for (int i = 0; i < nCount; i++)
00049     {
00050         dwData = m_pWnd->GetItemData(i); // save current data to restore it later
00051         strItemText = m_pWnd->GetItemText(i, nCol);
00052         m_pWnd->SetItemData(i, (DWORD) new CSortItem(dwData, strItemText));
00053     }
00054 }

CCJSortClass::~CCJSortClass ( ) [virtual]

Definition at line 56 of file CJSortClass.cpp.

00057 {
00058     ASSERT(m_pWnd);
00059     int nCount = m_pWnd->GetItemCount();
00060     CSortItem * pItem;
00061     for (int i = 0; i < nCount; i++)
00062     {
00063         pItem = (CSortItem *) m_pWnd->GetItemData(i);
00064         ASSERT(pItem);
00065         m_pWnd->SetItemData(i, pItem->m_dwData);
00066         delete pItem;
00067     }
00068 }

Member Function Documentation

int CALLBACK CCJSortClass::Compare | ( | LPARAM | lParam1,
 |  | LPARAM | lParam2,
 |  | LPARAM | lParamSort
 | ) | [static, protected]

Definition at line 81 of file CJSortClass.cpp.

00082 {
00083     CSortItem* item1 = (CSortItem *) lParam1;
00084     CSortItem* item2 = (CSortItem *) lParam2;
00085
00086     ASSERT(item1 && item2);
00087
00088     // restore data type and sort order from lParamSort
00089     // if lParamSort positive - ascending sort order, negative - descending
00090     short     sOrder = lParamSort < 0 ? (short) -1 : (short) 1;
00091
00092     DATA_TYPE eType  = (DATA_TYPE) (lParamSort * sOrder); // get rid of sign
00093
00094     // declare typed buffers
00095     COleDateTime t1, t2;
00096
00097     switch (eType)
00098     {
00099     case DT_INT:
00100         return ( _ttol( item1->m_strItemText ) - _ttol( item2->m_strItemText )) * sOrder;
00101
00102     case DT_DEC:
00103 #ifdef _UNICODE
00104         {
00105             char szText1[ 256 ];
00106             char szText2[ 256 ];
00107
00108             WideCharToMultiByte( CP_ACP,
00109                                  0,
00110                                  item1->m_strItemText,
00111                                  -1,
00112                                  szText1,
00113                                  255,
00114                                  NULL,
00115                                  NULL );
00116
00117             WideCharToMultiByte( CP_ACP,
00118                                  0,
00119                                  item2->m_strItemText,
00120                                  -1,
00121                                  szText2,
00122                                  255,
00123                                  NULL,
00124                                  NULL );
00125
00126
00127             return ( atof( szText1 ) < atof( szText2 ) ? -1 : 1) * sOrder;
00128         }
00129 #else
00130         return ( atof ( item1->m_strItemText ) < atof( item2->m_strItemText ) ? -1 : 1) * sOrder;
00131 #endif
00132
00133     case DT_DATETIME:
00134         if( t1.ParseDateTime( item1->m_strItemText ) && t2.ParseDateTime( item2->m_strItemText ))
00135         {
00136             return (t1 < t2 ? -1 : 1 ) * sOrder;
00137         }
00138         return 0;
00139
00140     case DT_STRING:
00141         return item1->m_strItemText.CompareNoCase( item2->m_strItemText ) * sOrder;
00142
00143     default:
00144         ASSERT("Error: attempt to sort a column without type.");
00145         return 0;
00146     }
00147 }

void CCJSortClass::Sort | ( | bool | bAsc,
 |  | DATA_TYPE | eType
 | ) | [virtual]

Definition at line 70 of file CJSortClass.cpp.

00071 {
00072     long lParamSort = eType;
00073
00074     // if lParamSort positive - ascending sort order, negative - descending
00075     if (!bAsc)
00076         lParamSort *= -1;
00077
00078     m_pWnd->SortItems(Compare, lParamSort);
00079 }

Member Data Documentation

CListCtrl* CCJSortClass::m_pWnd [protected]

Definition at line 70 of file CJSortClass.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJSortClass.h
  • WinCvs/CJLib/CJLibrary/CJSortClass.cpp
Generated on Sun Oct 21 12:46:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJSortClass::CSortItem Struct Reference

#include <CJSortClass.h>

Collaboration diagram for CCJSortClass::CSortItem:

[legend]
List of all members.

Public Methods

CSortItem (const DWORD dwData, const CString &strItemText)

Public Attributes

DWORD | m_dwData
CString | m_strItemText

Constructor & Destructor Documentation

_CJXLIB_INLINE CCJSortClass::CSortItem::CSortItem | ( | const DWORD | dwData,
 |  | const CString & | strItemText
 | ) |

Definition at line 91 of file CJSortClass.h.

00092     { m_dwData  = dwData; m_strItemText = strItemText; }

Member Data Documentation

DWORD CCJSortClass::CSortItem::m_dwData

Definition at line 82 of file CJSortClass.h.

CString CCJSortClass::CSortItem::m_strItemText

Definition at line 83 of file CJSortClass.h.

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/Include/CJSortClass.h
Generated on Sun Oct 21 12:46:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJStatusBar Class Reference

#include <CJStatusBar.h>

Inheritance diagram for CCJStatusBar:

[legend]
Collaboration diagram for CCJStatusBar:

[legend]
List of all members.

Public Methods

CCJStatusBar ()
virtual | ~CCJStatusBar ()
virtual void | PositionControls ()
virtual CCJStatusBarPaneControlInfo * | GetPanControl (int nPaneID)
virtual BOOL | AddControl (CWnd *pWnd, int nPaneID, BOOL bAutodeleteControl=TRUE)
virtual void | SetPaneWidth (int index, int cxWidth)
virtual BOOL | AddIndicator (int position, UINT paneID)
virtual BOOL | GetStatusPane (int nIndex, CCJStatusBarPane &xfxpane)
virtual void | RemovePane (int nPaneID)

Protected Methods

afx_msg void | OnSize (UINT nType, int cx, int cy)

Private Attributes

CArray< CCJStatusBarPaneControlInfo *,
CCJStatusBarPaneControlInfo *> 		m_aPans

Constructor & Destructor Documentation

CCJStatusBar::CCJStatusBar ( )

Definition at line 87 of file CJStatusBar.cpp.

00088 {
00089     // TODO: add construction code here.
00090 }

CCJStatusBar::~CCJStatusBar ( ) [virtual]

Definition at line 92 of file CJStatusBar.cpp.

00093 {
00094     for( int i = 0; i < m_aPans.GetSize(); i++ )
00095     {
00096         if( m_aPans[i]->m_pWnd && ::IsWindow(m_aPans[i]->m_pWnd->m_hWnd) )
00097             m_aPans[i]->m_pWnd->CloseWindow();
00098         if( m_aPans[i]->m_bAutodelete )
00099         {
00100             delete m_aPans[i]->m_pWnd;
00101         }
00102         delete m_aPans[i];
00103     }
00104 }

Member Function Documentation

BOOL CCJStatusBar::AddControl | ( | CWnd * | pWnd,
 |  | int | paneID,
 |  | BOOL | bAutodeleteControl = TRUE
 | ) | [virtual]

Definition at line 159 of file CJStatusBar.cpp.

00160 {
00161
00162     CCJStatusBarPaneControlInfo * pPanInfo = GetPanControl(paneID);
00163     if( pPanInfo )
00164         return FALSE;
00165
00166     int idx = CommandToIndex( paneID ) ;
00167     if( idx == -1 )
00168         return FALSE;
00169
00170     CCJStatusBarPaneControlInfo * pPan = new CCJStatusBarPaneControlInfo;
00171     pPan->m_nPaneID =  paneID;
00172     pPan->m_pWnd    =  pWnd;
00173     pPan->m_bAutodelete = bAutodeleteControl;
00174
00175     m_aPans.Add(pPan);
00176     PositionControls();
00177     Invalidate(TRUE);
00178     return TRUE;
00179 }

BOOL CCJStatusBar::AddIndicator | ( | int | position,
 |  | UINT | paneID
 | ) | [virtual]

Definition at line 200 of file CJStatusBar.cpp.

00201 {
00202     CArray<CCJStatusBarPane,CCJStatusBarPane> arPanes;
00203
00204     CCJStatusBarPane statusPane;
00205     int i;
00206
00207     i = 0;
00208     while( GetStatusPane(i,statusPane) )
00209     {
00210         arPanes.Add( statusPane );
00211         i++;
00212     }
00213     if( position < 0 )
00214         position = 0;
00215     if( position > arPanes.GetSize() )
00216         position = arPanes.GetSize()-1;
00217
00218     for(i = 0; i < arPanes.GetSize(); i ++ )
00219     {
00220         if( paneID == arPanes[i].m_nID )
00221         {
00222             TRACE0( "CCJStatusBar::AddIndicator(): Pane ID already exists \n" );
00223             return FALSE;
00224         }
00225     }
00226
00227     CCJStatusBarPane new_statusPane;
00228     new_statusPane.m_nID = paneID;
00229     if( arPanes.GetSize() )
00230         arPanes.InsertAt(position,new_statusPane);
00231     else
00232         arPanes.Add(new_statusPane);
00233
00234     UINT * pIndicators = new UINT[arPanes.GetSize()];
00235     for(i=0;i<arPanes.GetSize();i++)
00236         pIndicators[i]=arPanes[i].m_nID;
00237
00238     SetRedraw(FALSE);
00239     SetIndicators(pIndicators,arPanes.GetSize());
00240
00241     // Replace infos of indicators ..
00242     for(i = 0; i < arPanes.GetSize(); i++ )
00243     {
00244         if( arPanes[i].m_nID != paneID )
00245         {
00246             SetPaneInfo(i,arPanes[i].m_nID,arPanes[i].m_nStyle,arPanes[i].m_cxText);
00247             SetPaneText(i,arPanes[i].m_strText);
00248         }
00249         else
00250         {
00251             SetPaneWidth(i,50);
00252             SetPaneText(i,arPanes[i].m_strText);
00253         }
00254
00255     }
00256
00257     delete [] pIndicators;
00258     SetRedraw(TRUE);
00259     PositionControls();
00260     Invalidate(TRUE);
00261     return TRUE;
00262 }

CCJStatusBarPaneControlInfo * CCJStatusBar::GetPanControl ( int nPaneID ) [virtual]

Definition at line 149 of file CJStatusBar.cpp.

Referenced by AddControl().

00150 {
00151     for(int i = 0; i < m_aPans.GetSize(); i++ )
00152     {
00153         if( m_aPans[i]->m_nPaneID == nPaneID )
00154             return m_aPans[i];
00155     }
00156     return NULL;
00157 }

BOOL CCJStatusBar::GetStatusPane | ( | int | nIndex,
 |  | CCJStatusBarPane & | rPane
 | ) | [virtual]

Definition at line 189 of file CJStatusBar.cpp.

Referenced by AddIndicator(), and RemovePane().

00190 {
00191     if( nIndex < m_nCount  && nIndex >= 0 )
00192     {
00193         GetPaneInfo( nIndex,  rPane.m_nID, rPane.m_nStyle, rPane.m_cxText ) ;
00194         GetPaneText( nIndex , rPane.m_strText );
00195         return TRUE;
00196     }
00197     return FALSE;
00198 }

void CCJStatusBar::OnSize | ( | UINT | nType,
 |  | int | cx,
 |  | int | cy
 | ) | [protected]

Definition at line 117 of file CJStatusBar.cpp.

00118 {
00119     CStatusBar::OnSize(nType, cx, cy);
00120     PositionControls();
00121 }

void CCJStatusBar::PositionControls ( ) [virtual]

Definition at line 123 of file CJStatusBar.cpp.

Referenced by AddControl(), AddIndicator(), and RemovePane().

00124 {
00125     int h,v,s;
00126     GetStatusBarCtrl( ).GetBorders( h, v, s ) ;
00127
00128
00129     for(int i = 0; i < m_aPans.GetSize(); i++ )
00130     {
00131         CRect rect;
00132
00133         int index = CommandToIndex( m_aPans[i]->m_nPaneID );
00134         GetItemRect(index,rect);
00135         if( GetPaneStyle(index) & SBPS_NOBORDERS == SBPS_NOBORDERS)
00136             m_aPans[i]->m_pWnd->MoveWindow(rect);
00137         else
00138         {
00139             rect.top+=v;
00140             rect.bottom-=v;
00141             rect.left+=h+s;
00142             rect.right-=(h+s);
00143             m_aPans[i]->m_pWnd->MoveWindow(rect);
00144         }
00145
00146     }
00147 }

void CCJStatusBar::RemovePane ( int nPaneID ) [virtual]

Definition at line 264 of file CJStatusBar.cpp.

00265 {
00266     SetRedraw(FALSE);
00267     CWnd * pwnd = NULL;
00268     for( int i = 0; i < m_aPans.GetSize(); i++ )
00269     {
00270         if( m_aPans[i]->m_nPaneID == nPaneID )
00271         {
00272             if( m_aPans[i]->m_bAutodelete )
00273                 pwnd = m_aPans[i]->m_pWnd;
00274             delete m_aPans[i];
00275             m_aPans.RemoveAt(i);
00276             break;
00277         }
00278     }
00279     if( pwnd )
00280     {
00281         pwnd->DestroyWindow();
00282         delete pwnd;
00283     }
00284
00285     CArray<CCJStatusBarPane,CCJStatusBarPane> arPanes;
00286     CCJStatusBarPane statusPane;
00287     i = 0;
00288     while( GetStatusPane(i,statusPane) )
00289     {
00290         if( statusPane.m_nID != (UINT)nPaneID )
00291             arPanes.Add( statusPane );
00292         i++;
00293     }
00294     // Now remove the indicator
00295     UINT * pIndicators = new UINT[arPanes.GetSize()];
00296     for(i=0;i<arPanes.GetSize();i++)
00297         pIndicators[i]=arPanes[i].m_nID;
00298     SetIndicators(pIndicators,arPanes.GetSize());
00299
00300     // Replace infos of indicators ..
00301     for(i = 0; i < arPanes.GetSize(); i++ )
00302     {
00303         SetPaneInfo(i,arPanes[i].m_nID,arPanes[i].m_nStyle,arPanes[i].m_cxText);
00304         SetPaneText(i,arPanes[i].m_strText);
00305     }
00306
00307     delete [] pIndicators;
00308     SetRedraw(TRUE);
00309     PositionControls();
00310     Invalidate(TRUE);
00311 }

void CCJStatusBar::SetPaneWidth | ( | int | index,
 |  | int | cxWidth
 | ) | [virtual]

Definition at line 181 of file CJStatusBar.cpp.

Referenced by AddIndicator().

00182 {
00183     UINT nID,nStyle;
00184     int width;
00185     GetPaneInfo(index,nID,nStyle,width);
00186     SetPaneInfo(index,nID,nStyle,cxWidth);
00187 }

Member Data Documentation

CArray<CCJStatusBarPaneControlInfo*, CCJStatusBarPaneControlInfo*> CCJStatusBar::m_aPans [private]

Definition at line 85 of file CJStatusBar.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJStatusBar.h
  • WinCvs/CJLib/CJLibrary/CJStatusBar.cpp
Generated on Sun Oct 21 12:46:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJStatusBarPane Class Reference

#include <CJStatusBar.h>

Inheritance diagram for CCJStatusBarPane:

[legend]
Collaboration diagram for CCJStatusBarPane:

[legend]
List of all members.

Public Methods

CCJStatusBarPane ()
CCJStatusBarPane (CCJStatusBarPane &rPane)
virtual | ~CCJStatusBarPane ()
CCJStatusBarPane & | operator= (CCJStatusBarPane &rPane)

Public Attributes

UINT | m_nID
int | m_cxText
UINT | m_nStyle
UINT | m_nFlags
CString | m_strText

Constructor & Destructor Documentation

CCJStatusBarPane::CCJStatusBarPane ( )

Definition at line 55 of file CJStatusBar.cpp.

00056 {
00057     // TODO: add construction code here.
00058 }

CCJStatusBarPane::CCJStatusBarPane ( CCJStatusBarPane & rPane )

Definition at line 60 of file CJStatusBar.cpp.

00061 {
00062     m_nID     = rPane.m_nID;
00063     m_cxText  = rPane.m_cxText;
00064     m_nStyle  = rPane.m_nStyle;
00065     m_nFlags  = rPane.m_nFlags;
00066     m_strText = rPane.m_strText;
00067 }

CCJStatusBarPane::~CCJStatusBarPane ( ) [virtual]

Definition at line 69 of file CJStatusBar.cpp.

00070 {
00071     // TODO: add destruction code here.
00072 }

Member Function Documentation

CCJStatusBarPane & CCJStatusBarPane::operator= ( CCJStatusBarPane & rPane )

Definition at line 74 of file CJStatusBar.cpp.

00075 {
00076     m_nID     = rPane.m_nID;
00077     m_cxText  = rPane.m_cxText;
00078     m_nStyle  = rPane.m_nStyle;
00079     m_nFlags  = rPane.m_nFlags;
00080     m_strText = rPane.m_strText;
00081     return *this;
00082 }

Member Data Documentation

int CCJStatusBarPane::m_cxText

Definition at line 61 of file CJStatusBar.h.

Referenced by CCJStatusBarPane(), CCJStatusBar::GetStatusPane(), and operator=().

UINT CCJStatusBarPane::m_nFlags

Definition at line 63 of file CJStatusBar.h.

Referenced by CCJStatusBarPane(), and operator=().

UINT CCJStatusBarPane::m_nID

Definition at line 60 of file CJStatusBar.h.

Referenced by CCJStatusBar::AddIndicator(), CCJStatusBarPane(), CCJStatusBar::GetStatusPane(), CCJStatusBar::RemovePane(), and operator=().

UINT CCJStatusBarPane::m_nStyle

Definition at line 62 of file CJStatusBar.h.

Referenced by CCJStatusBarPane(), CCJStatusBar::GetStatusPane(), and operator=().

CString CCJStatusBarPane::m_strText

Definition at line 64 of file CJStatusBar.h.

Referenced by CCJStatusBarPane(), CCJStatusBar::GetStatusPane(), and operator=().

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJStatusBar.h
  • WinCvs/CJLib/CJLibrary/CJStatusBar.cpp
Generated on Sun Oct 21 12:46:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJStatusBarPaneControlInfo Class Reference

#include <CJStatusBar.h>

Inheritance diagram for CCJStatusBarPaneControlInfo:

[legend]
Collaboration diagram for CCJStatusBarPaneControlInfo:

[legend]
List of all members.

Public Methods

CCJStatusBarPaneControlInfo ()
virtual | ~CCJStatusBarPaneControlInfo ()

Public Attributes

CWnd * m_pWnd
int | m_nPaneID
BOOL | m_bAutodelete

Constructor & Destructor Documentation

CCJStatusBarPaneControlInfo::CCJStatusBarPaneControlInfo ( )

Definition at line 38 of file CJStatusBar.cpp.

00039 {
00040     m_pWnd        = NULL;
00041     m_bAutodelete = TRUE;
00042     m_nPaneID     = 0;
00043 }

CCJStatusBarPaneControlInfo::~CCJStatusBarPaneControlInfo ( ) [virtual]

Definition at line 45 of file CJStatusBar.cpp.

00046 {
00047     // TODO: add destruction code here.
00048 }

Member Data Documentation

BOOL CCJStatusBarPaneControlInfo::m_bAutodelete

Definition at line 44 of file CJStatusBar.h.

Referenced by CCJStatusBar::AddControl(), CCJStatusBar::RemovePane(), and CCJStatusBar::~CCJStatusBar().

int CCJStatusBarPaneControlInfo::m_nPaneID

Definition at line 43 of file CJStatusBar.h.

Referenced by CCJStatusBar::AddControl(), CCJStatusBar::GetPanControl(), and CCJStatusBar::RemovePane().

CWnd* CCJStatusBarPaneControlInfo::m_pWnd

Definition at line 42 of file CJStatusBar.h.

Referenced by CCJStatusBar::AddControl(), CCJStatusBar::PositionControls(), CCJStatusBar::RemovePane(), and CCJStatusBar::~CCJStatusBar().

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJStatusBar.h
  • WinCvs/CJLib/CJLibrary/CJStatusBar.cpp
Generated on Sun Oct 21 12:46:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJTabCtrl Class Reference

#include <CJTabCtrl.h>

Inheritance diagram for CCJTabCtrl:

[legend]
Collaboration diagram for CCJTabCtrl:

[legend]
List of all members.

Public Methods

CCJTabCtrl ()
virtual | ~CCJTabCtrl ()
virtual void | UpdateFont ()
virtual void | SetMenuID (UINT popupMenuID, UINT popToolbarID=0, int nPos=0)
virtual UINT | GetMenuID ()
virtual BOOL | Create (CWnd *pParentWnd, UINT nID=AFX_IDC_TAB_CONTROL, DWORD dwStyle=WS_VISIBLE|WS_CHILD|TCS_BOTTOM|TCS_TOOLTIPS|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, const CRect &rect=CRect(0, 0, 0, 0))

Public Attributes

UINT | m_popToolbarID
UINT | m_popupMenuID
CCJMenu m_popupMenu
int | m_nPos
CFont | m_Font

Protected Methods

afx_msg void | OnRButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnMeasureItem (int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
afx_msg LRESULT | OnMenuChar (UINT nChar, UINT nFlags, CMenu *pMenu)
afx_msg void | OnInitMenuPopup (CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnPaint ()

Constructor & Destructor Documentation

CCJTabCtrl::CCJTabCtrl ( )

Definition at line 110 of file CJTabCtrl.cpp.

00111 {
00112     m_popupMenuID   = 0;
00113     m_popToolbarID  = 0;
00114     m_nPos          = 0;
00115 }

CCJTabCtrl::~CCJTabCtrl ( ) [virtual]

Definition at line 117 of file CJTabCtrl.cpp.

00118 {
00119     // fix potential resource leak - KStowell - 10-22-99.
00120     m_Font.DeleteObject();
00121 }

Member Function Documentation

BOOL CCJTabCtrl::Create | ( | CWnd * | pParentWnd,
 |  | UINT | nID = AFX_IDC_TAB_CONTROL,
 |  | DWORD | dwStyle = WS_VISIBLE|WS_CHILD|TCS_BOTTOM|TCS_TOOLTIPS|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
 |  | const CRect & | rect = CRect(0,0,0,0)
 | ) | [virtual]

Definition at line 209 of file CJTabCtrl.cpp.

Referenced by CCJTabCtrlBar::OnCreate().

00210 {
00211     if (!CTabCtrl::Create(dwStyle, rect, pParentWnd, nID))
00212         return FALSE;
00213
00214     UpdateFont();
00215     return TRUE;
00216 }

_CJXLIB_INLINE UINT CCJTabCtrl::GetMenuID ( ) [virtual]

Definition at line 155 of file CJTabCtrl.h.

00156     { return m_popupMenuID; }

BOOL CCJTabCtrl::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 218 of file CJTabCtrl.cpp.

00219 {
00220     // KStowell - overridden for flicker-free drawing.
00221     UNUSED_ALWAYS(pDC);
00222     return TRUE;
00223 }

void CCJTabCtrl::OnInitMenuPopup | ( | CMenu * | pPopupMenu,
 |  | UINT | nIndex,
 |  | BOOL | bSysMenu
 | ) | [protected]

Definition at line 198 of file CJTabCtrl.cpp.

00199 {
00200     CTabCtrl::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
00201
00202     if(!bSysMenu) {
00203         if (m_popupMenu.IsMenu(pPopupMenu)) {
00204             CCJMenu::UpdateMenu(pPopupMenu);
00205         }
00206     }
00207 }

void CCJTabCtrl::OnMeasureItem | ( | int | nIDCtl,
 |  | LPMEASUREITEMSTRUCT | lpMeasureItemStruct
 | ) | [protected]

Definition at line 172 of file CJTabCtrl.cpp.

00173 {
00174     if (lpMeasureItemStruct->CtlType == ODT_MENU)
00175     {
00176         if (IsMenu((HMENU)lpMeasureItemStruct->itemID)) {
00177             CMenu* pMenu = CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
00178
00179             if (m_popupMenu.IsMenu(pMenu)) {
00180                 m_popupMenu.MeasureItem(lpMeasureItemStruct);
00181                 return;
00182             }
00183         }
00184     }
00185
00186     CTabCtrl::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
00187 }

LRESULT CCJTabCtrl::OnMenuChar | ( | UINT | nChar,
 |  | UINT | nFlags,
 |  | CMenu * | pMenu
 | ) | [protected]

Definition at line 189 of file CJTabCtrl.cpp.

00190 {
00191     if (m_popupMenu.IsMenu(pMenu)) {
00192         return CCJMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
00193     }
00194
00195     return CTabCtrl::OnMenuChar(nChar, nFlags, pMenu);
00196 }

void CCJTabCtrl::OnPaint ( ) [protected]

Definition at line 235 of file CJTabCtrl.cpp.

00236 {
00237     CPaintDC dc(this); // device context for painting
00238
00239
00240     // KStowell - Get the client rect.
00241     CRect rcClient;
00242     GetClientRect( &rcClient );
00243
00244     // KStowell - Create a memory device-context. This is done to help reduce
00245     // screen flicker, since we will paint the entire control to the
00246     // off screen device context first.
00247     CDC memDC;
00248     CBitmap bitmap;
00249     memDC.CreateCompatibleDC(&dc);
00250     bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
00251     CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
00252
00253     // KStowell - Repaint the background.
00254     memDC.FillSolidRect( rcClient, afxData.clrBtnFace );
00255
00256     // let the control do its default drawing.
00257     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00258
00259     // KStowell - Copy the memory device context back into the original DC via BitBlt().
00260     dc.BitBlt(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), &memDC, 0,0, SRCCOPY);
00261
00262     // KStowell - Cleanup resources.
00263     memDC.SelectObject(pOldBitmap);
00264     memDC.DeleteDC();
00265     bitmap.DeleteObject();
00266 }

void CCJTabCtrl::OnRButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 139 of file CJTabCtrl.cpp.

00140 {
00141     // No menu was defined...
00142     if (!m_popupMenuID) {
00143         TRACE0( "Warning: No menu resource was associated with CCJTabCtrl.\n" );
00144     }
00145
00146     else
00147     {
00148         // Since we are using the main window as the
00149         // parent, we need to convert the point to screen
00150         // coordinates...
00151         CPoint pt = point;
00152         ClientToScreen(&pt);
00153
00154         // Load the popup menu.
00155         VERIFY(m_popupMenu.LoadMenu(m_popupMenuID));
00156         CCJMenu* pPopup = (CCJMenu*)m_popupMenu.GetSubMenu(m_nPos);
00157         ASSERT(pPopup != NULL);
00158
00159         // Load toolbar resource if any for menu icons.
00160         if (m_popToolbarID) {
00161             pPopup->LoadToolbar(m_popToolbarID);
00162         }
00163
00164         // Display the popup menu, use the main window as its parent.
00165         pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
00166             pt.x, pt.y, AfxGetMainWnd());
00167
00168         m_popupMenu.DestroyMenu();
00169     }
00170 }

_CJXLIB_INLINE void CCJTabCtrl::SetMenuID | ( | UINT | popupMenuID,
 |  | UINT | popToolbarID = 0,
 |  | int | nPos = 0
 | ) | [virtual]

Definition at line 152 of file CJTabCtrl.h.

Referenced by CCJTabCtrlBar::SetTabMenuID().

00153     { m_popupMenuID = popupMenuID; m_popToolbarID = popToolbarID; m_nPos = nPos; }

void CCJTabCtrl::UpdateFont ( ) [virtual]

Definition at line 225 of file CJTabCtrl.cpp.

Referenced by Create().

00226 {
00227     m_Font.DeleteObject();
00228     NONCLIENTMETRICS ncm;
00229     ncm.cbSize = sizeof(ncm);
00230     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
00231     VERIFY(m_Font.CreateFontIndirect(&ncm.lfMessageFont));
00232     SetFont(&m_Font);
00233 }

Member Data Documentation

CFont CCJTabCtrl::m_Font

Definition at line 113 of file CJTabCtrl.h.

int CCJTabCtrl::m_nPos

Definition at line 112 of file CJTabCtrl.h.

UINT CCJTabCtrl::m_popToolbarID

Definition at line 107 of file CJTabCtrl.h.

CCJMenu CCJTabCtrl::m_popupMenu

Definition at line 111 of file CJTabCtrl.h.

UINT CCJTabCtrl::m_popupMenuID

Definition at line 110 of file CJTabCtrl.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJTabCtrl.h
  • WinCvs/CJLib/CJLibrary/CJTabCtrl.cpp
Generated on Sun Oct 21 12:46:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJTabCtrlBar Class Reference

#include <CJTabCtrlBar.h>

Inheritance diagram for CCJTabCtrlBar:

[legend]
Collaboration diagram for CCJTabCtrlBar:

[legend]
List of all members.

Public Methods

CCJTabCtrlBar ()
virtual | ~CCJTabCtrlBar ()
virtual BOOL | AddView (LPCTSTR lpszLabel, CRuntimeClass *pViewClass, CDocument *pDoc=NULL, UINT nIndex=-1, CCreateContext *pContext=NULL)
virtual void | RemoveView (int nView)
virtual void | SetActiveView (int nView)
virtual void | SetActiveView (CRuntimeClass *pViewClass)
virtual CView * | GetActiveView ()
virtual CView * | GetView (int nView)
virtual CView * | GetView (CRuntimeClass *pViewClass)
virtual CImageList * | SetTabImageList (CImageList *pImageList)
virtual BOOL | ModifyTabStyle (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
virtual LPCTSTR | GetViewName (int nView)
virtual LPCTSTR | GetViewName (CRuntimeClass *pViewClass)
virtual void | DeleteView (int nView)
virtual void | DeleteView (CRuntimeClass *pViewClass)
virtual void | SetViewToolTip (int nView, LPCTSTR lpszLabel)
virtual void | SetViewToolTip (CRuntimeClass *pViewClass, LPCTSTR lpszLabel)
virtual void | GetChildRect (CRect &rect)
virtual void | SetTabMenuID (UINT popupMenuID, UINT popToolbarID=0, int nPos=0)
virtual void | SetActiveView (CView *pUserView)
virtual void | AssociateImageIndexWithRuntimeClass (int nIndex, CRuntimeClass *pRuntimeClass)
void | AssociateImageIndexWithRuntimeClass (int nIndex, LPCTSTR lpszRuntimeClassName)
virtual BOOL | RemoveAllTabs ()
virtual int | GetTabFromPoint (CPoint point=CPoint(0, 0))
virtual BOOL | PreTranslateMessage (MSG *pMsg)

Protected Methods

virtual short | GetImageIndexFromRuntimeClass (CRuntimeClass *pRuntimeClass)
virtual void | RemoveListItem (POSITION pos)
virtual void | OverkillAssert (CRuntimeClass *pViewClass)
virtual void | SizeTabView (CWnd *pWnd)
virtual CToolTipCtrl * | GetToolTip ()
virtual void | AddToolTip (TCB_ITEM *pMember, LPCTSTR lpszLabel)
virtual void | ResetToolTips (CToolTipCtrl *pToolTip)
virtual TCB_ITEM * | CreateTabListItem (LPCTSTR lpszLabel)
virtual BOOL | CreateTabView (CRuntimeClass *pViewClass, CDocument *pDocument, CCreateContext *pContext)
virtual BOOL | EnableToolTips (BOOL bEnable)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnWindowPosChanged (WINDOWPOS *lpwndpos)
afx_msg void | OnTabSelChange (NMHDR *pNMHDR, LRESULT *pResult)

Protected Attributes

int | m_nPointTab
int | m_nActiveTab
int | m_nNextToolTipId
CView * m_pActiveView
CTabViews m_viewList
CCJTabCtrl m_TabCtrl
CMapStringToPtr | m_ClassNameToImageIndexMap
BOOL | m_bToolTipsEnabled

Constructor & Destructor Documentation

CCJTabCtrlBar::CCJTabCtrlBar ( )

Definition at line 198 of file CJTabCtrlBar.cpp.

00199 {
00200     m_nActiveTab        = 0;
00201     m_nNextToolTipId    = 0;
00202     m_bToolTipsEnabled  = TRUE;
00203 }

CCJTabCtrlBar::~CCJTabCtrlBar ( ) [virtual]

Definition at line 205 of file CJTabCtrlBar.cpp.

00206 {
00207     while(!m_viewList.IsEmpty())
00208     {
00209         TCB_ITEM *pMember = m_viewList.RemoveHead();
00210         _delete(pMember);
00211     }
00212 }

Member Function Documentation

void CCJTabCtrlBar::AddToolTip | ( | TCB_ITEM * | pMember,
 |  | LPCTSTR | lpszLabel
 | ) | [protected, virtual]

Definition at line 392 of file CJTabCtrlBar.cpp.

Referenced by CreateTabListItem().

00393 {
00394     // Get the tool tips for the tab control.
00395     CToolTipCtrl* pToolTip = GetToolTip();
00396
00397     // Add the tool tip.
00398     if( pMember->uiToolTipId == 0 ) {
00399         pToolTip->AddTool( &m_TabCtrl, lpszLabel,
00400             NULL, pMember->uiToolTipId );
00401     }
00402     else {
00403         pToolTip->AddTool( &m_TabCtrl, lpszLabel,
00404             CRect(0,0,0,0), pMember->uiToolTipId );
00405     }
00406 }

BOOL CCJTabCtrlBar::AddView | ( | LPCTSTR | lpszLabel,
 |  | CRuntimeClass * | pViewClass,
 |  | CDocument * | pDoc = NULL,
 |  | UINT | nIndex = -1,
 |  | CCreateContext * | pContext = NULL
 | ) | [virtual]

Definition at line 431 of file CJTabCtrlBar.cpp.

Referenced by CMainFrame::InitializeDockingWindows().

00433 {
00434     OverkillAssert(pViewClass);
00435
00436     // Create the view to be associate with tab.
00437     if (!CreateTabView(pViewClass, pDoc, pContext))
00438         return FALSE;
00439
00440     // Create the tab list item.
00441     if (CreateTabListItem(lpszLabel) == NULL)
00442         return FALSE;
00443
00444     // Since the tool tip count has changed,
00445     // re-initialize the tooltips.
00446     ResetToolTips(GetToolTip());
00447
00448     int nViews = ( nIndex == -1 )?m_viewList.GetCount():nIndex;
00449     if( nViews != 1 ) {
00450         m_pActiveView->EnableWindow(FALSE);
00451         m_pActiveView->ShowWindow(SW_HIDE);
00452     }
00453
00454     // Insert the new tab item.
00455     TC_ITEM tci;
00456     tci.mask    = TCIF_TEXT | TCIF_IMAGE;
00457     tci.pszText = (LPTSTR)(LPCTSTR)lpszLabel;
00458     tci.iImage  = nViews-1;
00459     m_TabCtrl.InsertItem(m_viewList.GetCount()-1, &tci);
00460
00461     // Resize the tab view.
00462     SizeTabView(m_pActiveView);
00463
00464     return TRUE;
00465 }

void CCJTabCtrlBar::AssociateImageIndexWithRuntimeClass | ( | int | nIndex,
 |  | LPCTSTR | lpszRuntimeClassName
 | ) |

Definition at line 791 of file CJTabCtrlBar.cpp.

00792 {
00793     CString szClassName(lpszRuntimeClassName);
00794     m_ClassNameToImageIndexMap[szClassName] = (short*)nIndex;
00795 }

void CCJTabCtrlBar::AssociateImageIndexWithRuntimeClass | ( | int | nIndex,
 |  | CRuntimeClass * | pRuntimeClass
 | ) | [virtual]

Definition at line 785 of file CJTabCtrlBar.cpp.

00786 {
00787     CString szClassName(pRuntimeClass->m_lpszClassName);
00788     m_ClassNameToImageIndexMap[szClassName] = (short*)nIndex;
00789 }

TCB_ITEM * CCJTabCtrlBar::CreateTabListItem ( LPCTSTR lpszLabel ) [protected, virtual]

Definition at line 359 of file CJTabCtrlBar.cpp.

Referenced by AddView().

00360 {
00361     // Allocate a new TCB_ITEM object.
00362     TCB_ITEM* pMember = new TCB_ITEM;
00363
00364     pMember->pWnd           = m_pActiveView;
00365     pMember->szTabLabel     = lpszLabel;
00366     pMember->szToolTipLabel = lpszLabel;
00367     pMember->uiToolTipId    = m_nNextToolTipId++;
00368
00369     // Add the new TCB_ITEM to the tab item list.
00370     m_viewList.AddTail(pMember);
00371
00372     // Create the ToolTip for the tab.
00373     AddToolTip(pMember, lpszLabel);
00374
00375     return pMember;
00376 }

BOOL CCJTabCtrlBar::CreateTabView | ( | CRuntimeClass * | pViewClass,
 |  | CDocument * | pDocument,
 |  | CCreateContext * | pContext
 | ) | [protected, virtual]

Definition at line 301 of file CJTabCtrlBar.cpp.

Referenced by AddView().

00302 {
00303     CWnd* pWnd = NULL;
00304
00305     // if no context specified, generate one
00306     // from the currently selected client if possible...
00307     if (pContext == NULL)
00308     {
00309         CCreateContext context;
00310
00311         context.m_pNewViewClass     = pViewClass;
00312         context.m_pCurrentDoc       = pDocument;
00313         context.m_pNewDocTemplate   = pDocument?pDocument->GetDocTemplate() : NULL;
00314         context.m_pLastView         = GetParentFrame()->GetActiveView();
00315         context.m_pCurrentFrame     = GetParentFrame();
00316
00317         pContext = &context;
00318     }
00319
00320     TRY
00321     {
00322         // Create the object.
00323         pWnd = DYNAMIC_DOWNCAST(CWnd, pViewClass->CreateObject());
00324         if (!pWnd) AfxThrowMemoryException();
00325     }
00326     CATCH_ALL(e)
00327     {
00328         TRACE0( "Out of memory creating a view.\n" );
00329         // Note: DELETE_EXCEPTION(e) not required
00330         return FALSE;
00331     }
00332     END_CATCH_ALL
00333
00334     ASSERT_KINDOF(CWnd, pWnd);
00335     ASSERT(pWnd->m_hWnd == NULL); // not yet created.
00336
00337     // Create with the right size and position
00338     if (!pWnd->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
00339         CRect(0,0,0,0), this, 0, pContext))
00340     {
00341         TRACE0( "Warning: couldn't create client pane for view.\n" );
00342         // pWnd will be cleaned up by PostNcDestroy
00343         return FALSE;
00344     }
00345
00346     // Set the newly create view as the active view.
00347     m_pActiveView = DYNAMIC_DOWNCAST(CView, pWnd);
00348     ASSERT_KINDOF(CView, m_pActiveView);
00349
00350     // If we were floating last, call OnInitialUpdate for the view
00351     // since CMiniDockFrameWnd does not do this for us.
00352     if( m_bFloating && m_pActiveView ) {
00353         m_pActiveView->OnInitialUpdate();
00354     }
00355
00356     return TRUE;
00357 }

void CCJTabCtrlBar::DeleteView ( CRuntimeClass * pViewClass ) [virtual]

Definition at line 559 of file CJTabCtrlBar.cpp.

00560 {
00561     OverkillAssert(pViewClass);
00562
00563     int nIndex = 0;
00564     for( POSITION pos = m_viewList.GetHeadPosition(); pos; m_viewList.GetNext( pos ))
00565     {
00566         TCB_ITEM *pMember = m_viewList.GetAt(pos);
00567         ASSERT(pMember);
00568
00569         if (pMember->pWnd->IsKindOf(pViewClass)) {
00570             DeleteView(nIndex);
00571             return;
00572         }
00573         nIndex++;
00574     }
00575 }

void CCJTabCtrlBar::DeleteView ( int nView ) [virtual]

Definition at line 514 of file CJTabCtrlBar.cpp.

Referenced by DeleteView().

00515 {
00516     ASSERT_VALID( this );
00517     ASSERT(( nView >= 0 ) && (m_TabCtrl.GetItemCount() > nView));
00518
00519     TRACE2("***DeleteView: %d ( /%d )\n", nView,m_viewList.GetCount());
00520
00521     // Now find the view we want to delete and remove it
00522     POSITION pos = m_viewList.FindIndex(nView);
00523     if( pos != NULL )
00524     {
00525         CView *pOldActiveView;
00526         pOldActiveView = m_pActiveView;
00527
00528         // Ensure that we get no dangling pointers
00529         // DO NOT (RE-)MOVE THIS CODE ! Gero Kuehn [gero.kuehn@isc-soft.de]
00530         if(GetParentFrame()->GetActiveView() == DYNAMIC_DOWNCAST( CView, m_viewList.GetAt(pos)->pWnd))
00531             GetParentFrame()->SetActiveView( NULL , FALSE);
00532
00533         // Remove item from list, and free memory.
00534         RemoveListItem( pos );
00535
00536         // Remove it from the tab control
00537         m_TabCtrl.DeleteItem(nView);
00538
00539         // Finally, if we have just deleted the active view, reset the
00540         // active tab to be the first view in the list
00541         if (nView == m_nActiveTab)
00542         {
00543             m_nActiveTab = -1;
00544             m_pActiveView = NULL; // Gero Kuehn [gero.kuehn@isc-soft.de]
00545         }
00546         else
00547         {
00548             // ** GK/ISC
00549             if((m_nActiveTab - 1)>=0) {
00550                 SetActiveView(m_nActiveTab - 1);
00551             }
00552         }
00553
00554         // Reset the tooltips for the views we have left...
00555         ResetToolTips(GetToolTip());
00556     }
00557 }

BOOL CCJTabCtrlBar::EnableToolTips ( BOOL bEnable ) [protected, virtual]

Definition at line 849 of file CJTabCtrlBar.cpp.

00850 {
00851     BOOL bPrev = m_bToolTipsEnabled;
00852
00853     m_bToolTipsEnabled = bEnable;
00854
00855     // Get the tool tips for the tab control.
00856     CToolTipCtrl* pToolTip = GetToolTip();
00857
00858     if (pToolTip)
00859         pToolTip->Activate(m_bToolTipsEnabled);
00860     else
00861         m_bToolTipsEnabled = bPrev;
00862
00863     return bPrev;
00864 }

_CJXLIB_INLINE CView * CCJTabCtrlBar::GetActiveView ( ) [virtual]

Definition at line 412 of file CJTabCtrlBar.h.

Referenced by CreateTabView(), and DeleteView().

00413     { return m_pActiveView; }

void CCJTabCtrlBar::GetChildRect ( CRect & rect ) [virtual]

Reimplemented from CCJControlBar.

Definition at line 292 of file CJTabCtrlBar.cpp.

Referenced by SizeTabView().

00293 {
00294     CCJControlBar::GetChildRect(rect);
00295
00296     if (IsFloating()) {
00297         rect.DeflateRect(2,2);
00298     }
00299 }

short CCJTabCtrlBar::GetImageIndexFromRuntimeClass ( CRuntimeClass * pRuntimeClass ) [protected, virtual]

Definition at line 797 of file CJTabCtrlBar.cpp.

00798 {
00799     ASSERT(m_ClassNameToImageIndexMap.GetCount() > 0);
00800     CString szClassName(pRuntimeClass->m_lpszClassName);
00801
00802     // Look for class name
00803     short* psValue;
00804     if (FALSE == m_ClassNameToImageIndexMap.Lookup(szClassName, (void*&)psValue))
00805         return -1;
00806
00807     // return the de-referenced pointer.
00808     return *psValue;
00809
00810 }

int CCJTabCtrlBar::GetTabFromPoint ( CPoint point = CPoint(0,0) ) [virtual]

Definition at line 826 of file CJTabCtrlBar.cpp.

00827 {
00828     TCHITTESTINFO tch;
00829     memset(&tch, 0, sizeof(TCHITTESTINFO));
00830
00831     if( point == CPoint(0,0) ) {
00832         CPoint pt;
00833         GetCursorPos(&pt);
00834         ScreenToClient(&pt);
00835         tch.pt = pt;
00836     } else {
00837         tch.pt = point;
00838     }
00839
00840     int iTab = m_TabCtrl.HitTest(&tch);
00841
00842     if( iTab != -1 ) {
00843         m_nPointTab = iTab ;
00844     }
00845
00846     return iTab;
00847 }

CToolTipCtrl * CCJTabCtrlBar::GetToolTip ( ) [protected, virtual]

Definition at line 378 of file CJTabCtrlBar.cpp.

Referenced by AddToolTip(), AddView(), DeleteView(), EnableToolTips(), and SetViewToolTip().

00379 {
00380     // Get a pointer to the tab control's CToolTipCtrl.
00381 #ifdef _VC_VERSION_5
00382     CToolTipCtrl* pToolTip = m_TabCtrl.GetTooltips();
00383     ASSERT(pToolTip != NULL);
00384 #else
00385     CToolTipCtrl* pToolTip = m_TabCtrl.GetToolTips();
00386     ASSERT(pToolTip != NULL);
00387 #endif // _VC_VERSION_5
00388
00389     return pToolTip;
00390 }

CView * CCJTabCtrlBar::GetView ( CRuntimeClass * pViewClass ) [virtual]

Definition at line 644 of file CJTabCtrlBar.cpp.

00645 {
00646     OverkillAssert(pViewClass);
00647
00648     for( POSITION pos = m_viewList.GetHeadPosition(); pos; m_viewList.GetNext( pos ))
00649     {
00650         TCB_ITEM *pMember = m_viewList.GetAt( pos );
00651         if( pMember->pWnd->IsKindOf( pViewClass )) {
00652             return (CView*)pMember->pWnd;
00653         }
00654     }
00655     return NULL;
00656 }

CView * CCJTabCtrlBar::GetView ( int nView ) [virtual]

Definition at line 624 of file CJTabCtrlBar.cpp.

Referenced by CMainFrame::GetBrowserView(), and CMainFrame::GetExplorerView().

00625 {
00626     ASSERT_VALID(this);
00627     ASSERT(( nView >= 0 ) && ( m_TabCtrl.GetItemCount() > nView ));
00628
00629     if( nView != -1 )
00630     {
00631         POSITION pos = m_viewList.FindIndex( nView );
00632         if( pos != NULL )
00633         {
00634             TCB_ITEM* pMember = m_viewList.GetAt( pos );
00635             return ( pMember )?(CView*)pMember->pWnd:NULL;
00636         }
00637
00638         return NULL;
00639     }
00640
00641     return NULL;
00642 }

LPCTSTR CCJTabCtrlBar::GetViewName ( CRuntimeClass * pViewClass ) [virtual]

Definition at line 678 of file CJTabCtrlBar.cpp.

00679 {
00680     OverkillAssert(pViewClass);
00681
00682     for( POSITION pos = m_viewList.GetHeadPosition(); pos; m_viewList.GetNext( pos ))
00683     {
00684         TCB_ITEM *pMember = m_viewList.GetAt( pos );
00685         if( pMember->pWnd->IsKindOf( pViewClass )) {
00686             return (LPCTSTR)pMember->szTabLabel;
00687         }
00688     }
00689     return NULL;
00690 }

LPCTSTR CCJTabCtrlBar::GetViewName ( int nView ) [virtual]

Definition at line 658 of file CJTabCtrlBar.cpp.

00659 {
00660     ASSERT_VALID(this);
00661     ASSERT(( nView >= 0 ) && ( m_TabCtrl.GetItemCount() > nView ));
00662
00663     if( nView != -1 )
00664     {
00665         POSITION pos = m_viewList.FindIndex( nView );
00666         if( pos != NULL )
00667         {
00668             TCB_ITEM* pMember = m_viewList.GetAt( pos );
00669             return ( pMember )?(LPCTSTR)pMember->szTabLabel:NULL;
00670         }
00671
00672         return NULL;
00673     }
00674
00675     return NULL;
00676 }

_CJXLIB_INLINE BOOL CCJTabCtrlBar::ModifyTabStyle | ( | DWORD | dwRemove,
 |  | DWORD | dwAdd,
 |  | UINT | nFlags = 0
 | ) | [virtual]

Definition at line 418 of file CJTabCtrlBar.h.

00419     { return m_TabCtrl.ModifyStyle(dwRemove, dwAdd, nFlags); }

int CCJTabCtrlBar::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Reimplemented from CCJControlBar.

Definition at line 253 of file CJTabCtrlBar.cpp.

00254 {
00255     if (CCJControlBar::OnCreate(lpCreateStruct) == -1)
00256         return -1;
00257
00258     // Create the Tab Control
00259     if (!m_TabCtrl.Create(this, IDC_TAB_CONTROL))
00260     {
00261         TRACE0( "Unable to create tab control bar\n" );
00262         return -1;
00263     }
00264
00265     // Associate the child window.
00266     SetChild(&m_TabCtrl);
00267
00268     return 0;
00269 }

void CCJTabCtrlBar::OnTabSelChange | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 287 of file CJTabCtrlBar.cpp.

00288 {
00289     SetActiveView(m_TabCtrl.GetCurSel());
00290 }

void CCJTabCtrlBar::OnWindowPosChanged ( WINDOWPOS * lpwndpos ) [protected]

Reimplemented from CCJControlBar.

Definition at line 227 of file CJTabCtrlBar.cpp.

00228 {
00229     // Get a pointer to the parent frame.
00230     CFrameWnd* pFrame = GetParentFrame();
00231     ASSERT(pFrame != NULL);
00232
00233     POSITION pos = m_viewList.GetHeadPosition();
00234     while( pos != NULL )
00235     {
00236         // Get the item for this position.
00237         TCB_ITEM *pItem = (TCB_ITEM*)m_viewList.GetNext(pos);
00238         ASSERT(pItem != NULL);
00239
00240         // To avoid mainwindow freezing, we must
00241         // deativate the view, it's not visible now.
00242         if (pFrame->GetActiveView() == pItem->pWnd) {
00243             pFrame->SetActiveView(NULL);
00244         }
00245
00246         // Resize the tab view.
00247         SizeTabView(pItem->pWnd);
00248     }
00249
00250     CCJControlBar::OnWindowPosChanged(lpwndpos);
00251 }

void CCJTabCtrlBar::OverkillAssert ( CRuntimeClass * pViewClass ) [protected, virtual]

Definition at line 481 of file CJTabCtrlBar.cpp.

Referenced by AddView(), DeleteView(), GetView(), GetViewName(), SetActiveView(), and SetViewToolTip().

00482 {
00483 #ifdef _DEBUG
00484     ASSERT_VALID(this);
00485     ASSERT(pViewClass != NULL);
00486     ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
00487     ASSERT(AfxIsValidAddress(pViewClass, sizeof(CRuntimeClass), FALSE));
00488 #else
00489     UNUSED_ALWAYS( pViewClass );
00490 #endif
00491 }

BOOL CCJTabCtrlBar::PreTranslateMessage ( MSG * pMsg ) [virtual]

Reimplemented from CCJControlBar.

Definition at line 271 of file CJTabCtrlBar.cpp.

00272 {
00273     if (pMsg->message == WM_KEYDOWN)
00274     {
00275         switch (pMsg->wParam)
00276         {
00277         case VK_RETURN:
00278             m_pActiveView->SendMessage(pMsg->message,
00279                 pMsg->wParam, pMsg->lParam);
00280             return TRUE;
00281         }
00282     }
00283
00284     return CCJControlBar::PreTranslateMessage(pMsg);
00285 }

BOOL CCJTabCtrlBar::RemoveAllTabs ( ) [virtual]

Definition at line 812 of file CJTabCtrlBar.cpp.

00813 {
00814     // Itterate the tab views
00815     while(!m_viewList.IsEmpty())
00816     {
00817         RemoveView(0);  // Remove the view from the bar
00818         m_TabCtrl.DeleteItem(0);
00819     }
00820     m_pActiveView = NULL;
00821     ((CFrameWnd *)GetParent())->SetActiveView(NULL);
00822     Invalidate();
00823     return TRUE;
00824 }

void CCJTabCtrlBar::RemoveListItem ( POSITION pos ) [protected, virtual]

Definition at line 493 of file CJTabCtrlBar.cpp.

Referenced by DeleteView(), and RemoveView().

00494 {
00495     if( pos != NULL )
00496     {
00497         // remove the page from internal list
00498         TCB_ITEM *pMember = m_viewList.GetAt(pos);
00499         ASSERT(pMember);
00500
00501         // And delete the member window, freeing our stored
00502         // values relating to it
00503         if (pMember->pWnd != NULL) {
00504             pMember->pWnd->DestroyWindow();
00505             pMember->pWnd = NULL;
00506         }
00507
00508         // Remove from list and free memory.
00509         m_viewList.RemoveAt(pos);
00510         _delete(pMember);
00511     }
00512 }

void CCJTabCtrlBar::RemoveView ( int nView ) [virtual]

Definition at line 577 of file CJTabCtrlBar.cpp.

Referenced by RemoveAllTabs().

00578 {
00579     ASSERT_VALID( this );
00580     ASSERT(( nView >= 0 ) && (m_TabCtrl.GetItemCount() > nView));
00581     RemoveListItem( m_viewList.FindIndex( nView ));
00582 }

void CCJTabCtrlBar::ResetToolTips ( CToolTipCtrl * pToolTip ) [protected, virtual]

Definition at line 408 of file CJTabCtrlBar.cpp.

Referenced by AddView(), and DeleteView().

00409 {
00410     if (pToolTip)
00411     {
00412         int nIndex = 0;
00413         POSITION pos;
00414         for( pos = m_viewList.GetHeadPosition(); pos; m_viewList.GetNext(pos) )
00415         {
00416             // Get the next item in the list.
00417             TCB_ITEM* pMember = m_viewList.GetAt( pos );
00418
00419             // Update the tooltip for the view
00420             pMember->uiToolTipId = nIndex;
00421             pToolTip->UpdateTipText( pMember->szToolTipLabel, &m_TabCtrl,
00422                 pMember->uiToolTipId );
00423
00424             nIndex++;
00425         }
00426
00427         m_nNextToolTipId = ( nIndex == 0 )?1:nIndex;
00428     }
00429 }

void CCJTabCtrlBar::SetActiveView ( CView * pUserView ) [virtual]

Definition at line 767 of file CJTabCtrlBar.cpp.

00768 {
00769     // Walk through the tabs
00770     for (POSITION pos=m_viewList.GetHeadPosition(); pos; m_viewList.GetNext(pos))
00771     {
00772         // Get the tab's view
00773         CView* pTabView = (CView *)(m_viewList.GetAt(pos)->pWnd);
00774
00775         // Does the tab view match the requested view?
00776         if (pTabView == pUserView)
00777         {
00778             // Change the active view
00779             m_pActiveView = pTabView;
00780             ((CFrameWnd *)GetParent())->SetActiveView((CView *)m_pActiveView);
00781         }
00782     }
00783 }

void CCJTabCtrlBar::SetActiveView ( CRuntimeClass * pViewClass ) [virtual]

Definition at line 734 of file CJTabCtrlBar.cpp.

00735 {
00736     OverkillAssert(pViewClass);
00737
00738     int nView = 0;
00739     for (POSITION pos=m_viewList.GetHeadPosition(); pos; m_viewList.GetNext(pos))
00740     {
00741         TCB_ITEM *pMember=m_viewList.GetAt(pos);
00742         if (pMember->pWnd->IsKindOf(pViewClass))
00743         {
00744             //first hide old first view
00745             m_pActiveView->EnableWindow(FALSE);
00746             m_pActiveView->ShowWindow(SW_HIDE);
00747
00748             // set new active view
00749             m_pActiveView = (CView*)pMember->pWnd;
00750
00751             // enable, show, set focus to new view
00752             m_pActiveView->EnableWindow(TRUE);
00753             m_pActiveView->ShowWindow(SW_SHOW);
00754             m_pActiveView->SetFocus();
00755
00756             m_nActiveTab = nView;
00757
00758             // select the tab
00759             m_TabCtrl.SetCurSel(m_nActiveTab);
00760
00761             break;
00762         }
00763         nView++;
00764     }
00765 }

void CCJTabCtrlBar::SetActiveView ( int nView ) [virtual]

Definition at line 692 of file CJTabCtrlBar.cpp.

Referenced by CWincvsApp::ActivateBrowserView(), DeleteView(), CMainFrame::InitializeDockingWindows(), and OnTabSelChange().

00693 {
00694     ASSERT_VALID(this);
00695     ASSERT(( nView >= 0 ) && ( m_TabCtrl.GetItemCount() > nView ));
00696
00697     if(( nView != -1 ) && ( nView != m_nActiveTab ))
00698     {
00699         POSITION pos = m_viewList.FindIndex( nView );
00700         if( pos != NULL )
00701         {
00702             // Hide the old view we are changing.
00703             // GK/ISC
00704             POSITION oldPos = NULL;
00705             if( m_nActiveTab >= 0) {
00706                 oldPos = m_viewList.FindIndex( m_nActiveTab );
00707             }
00708
00709             if( oldPos )
00710             {
00711                 TCB_ITEM* pOldItem = m_viewList.GetAt( oldPos );
00712                 pOldItem->pWnd->EnableWindow(FALSE);
00713                 pOldItem->pWnd->ShowWindow(SW_HIDE);
00714             }
00715
00716             // Show the newly selected view.
00717             TCB_ITEM* pMember = m_viewList.GetAt( pos );
00718             pMember->pWnd->EnableWindow(TRUE);
00719             pMember->pWnd->ShowWindow(SW_SHOW);
00720             pMember->pWnd->SetFocus();
00721
00722             // select the tab (if tab programmatically changed)
00723             m_nActiveTab = nView;
00724             m_TabCtrl.SetCurSel( m_nActiveTab );
00725
00726             // Set the active view.
00727             m_pActiveView = DYNAMIC_DOWNCAST( CView, pMember->pWnd );
00728             ASSERT_KINDOF( CView, m_pActiveView );
00729             GetParentFrame()->SetActiveView( m_pActiveView );
00730         }
00731     }
00732 }

_CJXLIB_INLINE CImageList * CCJTabCtrlBar::SetTabImageList ( CImageList * pImageList ) [virtual]

Definition at line 415 of file CJTabCtrlBar.h.

Referenced by CMainFrame::InitializeDockingWindows().

00416     { return m_TabCtrl.SetImageList (pImageList); }

_CJXLIB_INLINE void CCJTabCtrlBar::SetTabMenuID | ( | UINT | popupMenuID,
 |  | UINT | popToolbarID = 0,
 |  | int | nPos = 0
 | ) | [virtual]

Definition at line 409 of file CJTabCtrlBar.h.

00410     { m_TabCtrl.SetMenuID(popupMenuID, popToolbarID, nPos); }

void CCJTabCtrlBar::SetViewToolTip | ( | CRuntimeClass * | pViewClass,
 |  | LPCTSTR | lpszLabel
 | ) | [virtual]

Definition at line 606 of file CJTabCtrlBar.cpp.

00607 {
00608     OverkillAssert(pViewClass);
00609
00610     int nIndex=0;
00611     for (POSITION pos=m_viewList.GetHeadPosition(); pos; m_viewList.GetNext(pos))
00612     {
00613         TCB_ITEM *pMember=m_viewList.GetAt(pos);
00614         if (pMember->pWnd->IsKindOf(pViewClass))
00615         {
00616             SetViewToolTip(nIndex, lpszLabel);
00617             break;
00618         }
00619         nIndex++;
00620     }
00621     return;
00622 }

void CCJTabCtrlBar::SetViewToolTip | ( | int | nView,
 |  | LPCTSTR | lpszLabel
 | ) | [virtual]

Definition at line 584 of file CJTabCtrlBar.cpp.

Referenced by SetViewToolTip().

00585 {
00586     ASSERT_VALID(this);
00587     ASSERT(( nView >= 0 ) && (m_TabCtrl.GetItemCount() > nView));
00588
00589     // Find the view we want to change the tooltip for and
00590     // reset its tooltip text
00591     POSITION pos = m_viewList.FindIndex( nView );
00592     if( pos != NULL )
00593     {
00594         // Get the private data for the view
00595         TCB_ITEM *pMember = m_viewList.GetAt(pos);
00596
00597         // Reset the tooltip text to the new value
00598         pMember->szToolTipLabel = lpszLabel;
00599
00600         // Update the tooltip for the view
00601         GetToolTip()->UpdateTipText( pMember->szToolTipLabel,
00602             &m_TabCtrl, pMember->uiToolTipId );
00603     }
00604 }

void CCJTabCtrlBar::SizeTabView ( CWnd * pWnd ) [protected, virtual]

Definition at line 467 of file CJTabCtrlBar.cpp.

Referenced by AddView().

00468 {
00469     // Get the new window size.
00470     CRect rcChild;
00471     GetChildRect(rcChild);
00472     rcChild.DeflateRect(3,3);
00473     rcChild.bottom -= (21 * m_TabCtrl.GetRowCount());
00474
00475     // Resize the window.
00476     pWnd->MoveWindow(rcChild);
00477     pWnd->SetWindowPos(NULL, 0,0,0,0,
00478         SWP_NOSIZE|SWP_NOMOVE);
00479 }

Member Data Documentation

CMapStringToPtr CCJTabCtrlBar::m_ClassNameToImageIndexMap [protected]

Definition at line 205 of file CJTabCtrlBar.h.

CCJTabCtrl CCJTabCtrlBar::m_TabCtrl [protected]

Definition at line 204 of file CJTabCtrlBar.h.

BOOL CCJTabCtrlBar::m_bToolTipsEnabled [protected]

Definition at line 206 of file CJTabCtrlBar.h.

int CCJTabCtrlBar::m_nActiveTab [protected]

Definition at line 200 of file CJTabCtrlBar.h.

int CCJTabCtrlBar::m_nNextToolTipId [protected]

Definition at line 201 of file CJTabCtrlBar.h.

int CCJTabCtrlBar::m_nPointTab [protected]

Definition at line 199 of file CJTabCtrlBar.h.

CView* CCJTabCtrlBar::m_pActiveView [protected]

Definition at line 202 of file CJTabCtrlBar.h.

CTabViews CCJTabCtrlBar::m_viewList [protected]

Definition at line 203 of file CJTabCtrlBar.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJTabCtrlBar.h
  • WinCvs/CJLib/CJLibrary/CJTabCtrlBar.cpp
Generated on Sun Oct 21 12:46:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJTabView Class Reference

#include <CJTabView.h>

Inheritance diagram for CCJTabView:

[legend]
Collaboration diagram for CCJTabView:

[legend]
List of all members.

Public Methods

virtual BOOL | AddView (LPCTSTR lpszLabel, CRuntimeClass *pViewClass, CDocument *pDoc=NULL, CCreateContext *pContext=NULL)
virtual BOOL | ModifyTabStyle (DWORD dwRemove, DWORD dwAdd, UINT nFlags=0)
virtual void | SetActiveView (CRuntimeClass *pViewClass)
virtual void | SetActiveView (int nNewTab)
virtual void | RemoveView (int nView)
virtual CView * | GetView (CRuntimeClass *pViewClass)
virtual CView * | GetView (int nView)
virtual CView * | GetActiveView ()
virtual CImageList * | SetTabImageList (CImageList *pImageList)
virtual CTabCtrl * | GetTabCtrl ()
virtual void | GetChildRect (CRect &rect)

Protected Methods

CCJTabView ()
virtual | ~CCJTabView ()
afx_msg void | OnWindowPosChanged (WINDOWPOS *lpwndpos)
afx_msg void | OnSelchange (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)

Protected Attributes

CView * m_pActiveView
int | m_nActiveTab
CTabCtrl * m_pTabCtrl
CToolTipCtrl * | m_pToolTip
CFont | m_TabFont
CListViews m_views

Private Methods

void | CalcViewRect (CRect *pRect)

Constructor & Destructor Documentation

CCJTabView::CCJTabView ( ) [protected]

Definition at line 50 of file CJTabView.cpp.

00050                        : CCtrlView(_T("SysTabControl32"),
00051     TCS_TOOLTIPS | WS_VISIBLE | WS_CHILD | WS_BORDER)
00052 {
00053     m_pTabCtrl = (CTabCtrl*) this;
00054     m_nActiveTab = 0;
00055 }

CCJTabView::~CCJTabView ( ) [protected, virtual]

Definition at line 57 of file CJTabView.cpp.

00058 {
00059     while(!m_views.IsEmpty()) {
00060         CTV_ITEM *pMember=m_views.RemoveTail();
00061         _delete(pMember);
00062     }
00063
00064     // fix potential resource leak - KStowell - 10-22-99.
00065     m_TabFont.DeleteObject();
00066 }

Member Function Documentation

BOOL CCJTabView::AddView | ( | LPCTSTR | lpszLabel,
 |  | CRuntimeClass * | pViewClass,
 |  | CDocument * | pDoc = NULL,
 |  | CCreateContext * | pContext = NULL
 | ) | [virtual]

Definition at line 287 of file CJTabView.cpp.

00288 {
00289
00290 #ifdef _DEBUG
00291     ASSERT_VALID(this);
00292     ASSERT(pViewClass != NULL);
00293     ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
00294     ASSERT(AfxIsValidAddress(pViewClass, sizeof(CRuntimeClass), FALSE));
00295 #endif
00296
00297     CCreateContext context;
00298     if (pContext == NULL)
00299     {
00300         context.m_pCurrentDoc       = pDoc;
00301         context.m_pCurrentFrame     = GetParentFrame();
00302         context.m_pLastView         = NULL;
00303         context.m_pNewDocTemplate   = NULL;
00304         context.m_pNewViewClass     = pViewClass;
00305         pContext = &context;
00306     }
00307
00308     CWnd* pWnd;
00309     TRY {
00310         pWnd = (CWnd*)pViewClass->CreateObject();
00311         if (pWnd == NULL)
00312             AfxThrowMemoryException();
00313     }
00314     CATCH_ALL(e) {
00315         TRACE0( "Out of memory creating a view.\n" );
00316         // Note: DELETE_EXCEPTION(e) not required
00317         return FALSE;
00318     }
00319     END_CATCH_ALL
00320
00321     ASSERT_KINDOF(CWnd, pWnd);
00322     ASSERT(pWnd->m_hWnd == NULL);       // not yet created
00323
00324     DWORD dwStyle = AFX_WS_DEFAULT_VIEW;
00325     CRect rect;
00326
00327     // Create with the right size and position
00328     if (!pWnd->Create(NULL, NULL, dwStyle, rect, this, 0, pContext))
00329     {
00330         TRACE0( "Warning: couldn't create client pane for view.\n" );
00331         // pWnd will be cleaned up by PostNcDestroy
00332         return FALSE;
00333     }
00334     m_pActiveView = (CView*) pWnd;
00335
00336     CTV_ITEM* pMember = new CTV_ITEM;
00337
00338     pMember->pWnd = pWnd;
00339
00340     _tcscpy( pMember->szLabel, lpszLabel );
00341
00342     m_views.AddTail(pMember);
00343
00344     // ToolTip support for tabs.
00345     if((m_views.GetCount()-1)==0) {
00346         m_pToolTip->AddTool( m_pTabCtrl, lpszLabel,
00347             NULL, m_views.GetCount()-1 );
00348     }
00349     else {
00350         m_pToolTip->AddTool( m_pTabCtrl, lpszLabel,
00351             CRect(0,0,0,0), m_views.GetCount()-1 );
00352     }
00353
00354     int nViews = m_views.GetCount();
00355     if (nViews != 1) {
00356         pWnd->EnableWindow(FALSE);
00357         pWnd->ShowWindow(SW_HIDE);
00358     }
00359
00360     TC_ITEM tci;
00361     tci.mask = TCIF_TEXT | TCIF_IMAGE;
00362     tci.pszText = (LPTSTR)(LPCTSTR)lpszLabel;
00363     tci.iImage = nViews-1;
00364     m_pTabCtrl->InsertItem(nViews, &tci);
00365
00366     CRect rcChild;
00367     CalcViewRect(&rcChild);
00368     m_pActiveView->MoveWindow(rcChild);
00369
00370     return TRUE;
00371 }

void CCJTabView::CalcViewRect ( CRect * pRect ) [private]

Definition at line 151 of file CJTabView.cpp.

Referenced by AddView(), and OnWindowPosChanged().

00152 {
00153     GetChildRect((*pRect));
00154     DWORD dwStyle = GetStyle();
00155
00156     if ((dwStyle & TCS_BOTTOM) && !(dwStyle & TCS_VERTICAL)) {      // Bottom
00157         (*pRect).top    += TABVIEW_BORDER;
00158         (*pRect).left   += TABVIEW_BORDER;
00159         (*pRect).right  -= TABVIEW_BORDER;
00160         (*pRect).bottom -= 26;
00161     }
00162     else if ((dwStyle & TCS_RIGHT) && (dwStyle & TCS_VERTICAL)) {   // Right
00163         (*pRect).top    += TABVIEW_BORDER;
00164         (*pRect).left   += TABVIEW_BORDER;
00165         (*pRect).right  -= 26;
00166         (*pRect).bottom -= TABVIEW_BORDER;
00167     }
00168     else if (dwStyle & TCS_VERTICAL) {                              // Left
00169         (*pRect).top    += TABVIEW_BORDER;
00170         (*pRect).left   += 26;
00171         (*pRect).right  -= TABVIEW_BORDER;
00172         (*pRect).bottom -= TABVIEW_BORDER;
00173     }
00174     else {                                                          // Top
00175         (*pRect).top    += 26;
00176         (*pRect).left   += TABVIEW_BORDER;
00177         (*pRect).right  -= TABVIEW_BORDER;
00178         (*pRect).bottom -= TABVIEW_BORDER;
00179     }
00180 }

_CJXLIB_INLINE CView * CCJTabView::GetActiveView ( ) [virtual]

Definition at line 176 of file CJTabView.h.

Referenced by OnEraseBkgnd().

00177     { return m_pActiveView; }

void CCJTabView::GetChildRect ( CRect & rect ) [virtual]

Definition at line 80 of file CJTabView.cpp.

Referenced by CalcViewRect().

00081 {
00082     m_pTabCtrl->GetClientRect(&rect);
00083 }

_CJXLIB_INLINE CTabCtrl * CCJTabView::GetTabCtrl ( ) [virtual]

Definition at line 173 of file CJTabView.h.

00174     { return m_pTabCtrl; }

CView * CCJTabView::GetView ( int nView ) [virtual]

Definition at line 85 of file CJTabView.cpp.

00086 {
00087     ASSERT_VALID(this);
00088     ASSERT(nView >= 0);
00089
00090     if (nView!=-1) {
00091         CTV_ITEM *pMember=m_views.GetAt(m_views.FindIndex(nView));
00092         return (CView*)pMember->pWnd;
00093     }
00094     else
00095         return NULL;
00096 }

CView * CCJTabView::GetView ( CRuntimeClass * pViewClass ) [virtual]

Definition at line 98 of file CJTabView.cpp.

00099 {
00100     ASSERT_VALID(this);
00101     ASSERT(pViewClass != NULL);
00102     ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
00103     ASSERT(AfxIsValidAddress(pViewClass, sizeof(CRuntimeClass), FALSE));
00104
00105     for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos)) {
00106         CTV_ITEM *pMember=m_views.GetAt(pos);
00107         if (pMember->pWnd->IsKindOf(pViewClass)) {
00108             return (CView*)pMember->pWnd;
00109         }
00110     }
00111     return NULL;
00112 }

BOOL CCJTabView::ModifyTabStyle | ( | DWORD | dwRemove,
 |  | DWORD | dwAdd,
 |  | UINT | nFlags = 0
 | ) | [virtual]

Definition at line 114 of file CJTabView.cpp.

00115 {
00116     DWORD dwCurrentStyle = GetStyle();
00117
00118     // We are in horizontal mode...go vertical
00119     if ((dwAdd & TCS_VERTICAL) && !(dwCurrentStyle & TCS_VERTICAL)) {
00120         // Get the log font.
00121         NONCLIENTMETRICS ncm;
00122         ncm.cbSize = sizeof(NONCLIENTMETRICS);
00123         VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
00124             sizeof(NONCLIENTMETRICS), &ncm, 0));
00125         // fix potential resource leak - KStowell - 10-22-99.
00126         m_TabFont.DeleteObject();
00127         ncm.lfMessageFont.lfOrientation = (dwAdd & TCS_RIGHT) ? 2700 : 900;
00128         ncm.lfMessageFont.lfEscapement  = (dwAdd & TCS_RIGHT) ? 2700 : 900;
00129         m_TabFont.CreateFontIndirect(&ncm.lfMessageFont);
00130         m_pTabCtrl->SetFont(&m_TabFont);
00131     }
00132     // We are in vertical mode....go horizontal
00133     else if ((dwCurrentStyle & TCS_VERTICAL) && !(dwAdd & TCS_VERTICAL)) {
00134         // Get the log font.
00135         NONCLIENTMETRICS ncm;
00136         ncm.cbSize = sizeof(NONCLIENTMETRICS);
00137         VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
00138             sizeof(NONCLIENTMETRICS), &ncm, 0));
00139         // fix potential resource leak - KStowell - 10-22-99.
00140         m_TabFont.DeleteObject();
00141         ncm.lfMessageFont.lfOrientation = 0;
00142         ncm.lfMessageFont.lfEscapement  = 0;
00143         m_TabFont.CreateFontIndirect(&ncm.lfMessageFont);
00144         m_pTabCtrl->SetFont(&m_TabFont);
00145     }
00146
00147     return m_pTabCtrl->ModifyStyle(dwRemove, dwAdd, nFlags);
00148 }

int CCJTabView::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 381 of file CJTabView.cpp.

00382 {
00383     if (CCtrlView::OnCreate(lpCreateStruct) == -1)
00384         return -1;
00385
00386     ASSERT(m_pTabCtrl);         // Should already be constructed
00387
00389     // Fixed bug with set parent and modifystyle which would cause the
00390     // application to lock up. - Kevin [klussier@redcreek.com].
00392     m_pTabCtrl->SetParent(CWnd::FromHandle(lpCreateStruct->hwndParent));
00393     m_pTabCtrl->ModifyStyleEx(WS_EX_NOPARENTNOTIFY, 0);
00394
00395     // Get the log font.
00396     NONCLIENTMETRICS ncm;
00397     ncm.cbSize = sizeof(NONCLIENTMETRICS);
00398     VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
00399         sizeof(NONCLIENTMETRICS), &ncm, 0));
00400     m_TabFont.CreateFontIndirect(&ncm.lfMessageFont);
00401     m_pTabCtrl->SetFont(&m_TabFont);
00402
00403 #ifdef _VC_VERSION_5
00404     m_pToolTip = m_pTabCtrl->GetTooltips();
00405     m_pTabCtrl->SetTooltips(m_pToolTip);
00406 #else
00407     m_pToolTip = m_pTabCtrl->GetToolTips();
00408     m_pTabCtrl->SetToolTips(m_pToolTip);
00409 #endif // _VC_VERSION_5
00410
00411     return 0;
00412 }

BOOL CCJTabView::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 414 of file CJTabView.cpp.

00415 {
00416     CView *pView = GetActiveView();
00417     if ( pView )
00418     {
00419         // Exclude the embedded views
00420         // area from the erase - Andy
00421         CRect rectClient;
00422         pView->GetWindowRect( &rectClient );
00423         ScreenToClient( &rectClient );
00424         pDC->ExcludeClipRect( &rectClient );
00425     }
00426     return CCtrlView::OnEraseBkgnd(pDC);
00427 }

void CCJTabView::OnSelchange | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 374 of file CJTabView.cpp.

00375 {
00376     SetActiveView(m_pTabCtrl->GetCurSel());
00377
00378     *pResult = 0;
00379 }

void CCJTabView::OnWindowPosChanged ( WINDOWPOS * lpwndpos ) [protected]

Definition at line 182 of file CJTabView.cpp.

00183 {
00184     CRect rcChild;
00185     CWnd *pWnd;
00186
00187     CalcViewRect(&rcChild);
00188     for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos)) {
00189         pWnd = m_views.GetAt(pos)->pWnd;
00190         pWnd->MoveWindow(rcChild);
00191     }
00192
00193     // *** LiangYiBin.Donald
00194     if( lpwndpos->flags & SWP_HIDEWINDOW ) {
00195         CFrameWnd* pFrame = GetParentFrame();
00196         POSITION pos = m_views.GetHeadPosition();
00197         while ( pos != NULL ) {
00198             // check whether the views in the controlbar are focused
00199             CTV_ITEM *pItem = (CTV_ITEM *) m_views.GetNext(pos);
00200             if ( pFrame != NULL && pFrame->GetActiveView() == pItem->pWnd ) {
00201                 // To avoid mainwindow freezing, we must deativate the view,
00202                 // because it's not visible now.
00203                 pFrame->SetActiveView(NULL);
00204             }
00205         }
00206     }
00207
00208     CCtrlView::OnWindowPosChanged(lpwndpos);
00209 }

void CCJTabView::RemoveView ( int nView ) [virtual]

Definition at line 211 of file CJTabView.cpp.

00212 {
00213     ASSERT_VALID(this);
00214     ASSERT(nView >= 0);
00215
00216     // remove the page from internal list
00217     m_views.RemoveAt(m_views.FindIndex(nView));
00218 }

void CCJTabView::SetActiveView ( int nNewTab ) [virtual]

Definition at line 256 of file CJTabView.cpp.

00257 {
00258     ASSERT_VALID(this);
00259     ASSERT(nNewTab >= 0);
00260
00261     if (nNewTab!=-1 && nNewTab!=m_nActiveTab) {
00262         CTV_ITEM *newMember=m_views.GetAt(m_views.FindIndex(nNewTab));
00263         CTV_ITEM *oldMember=NULL;
00264
00265         if (m_nActiveTab!=-1) {
00266             oldMember=m_views.GetAt(m_views.FindIndex(m_nActiveTab));
00267             oldMember->pWnd->EnableWindow(FALSE);
00268             oldMember->pWnd->ShowWindow(SW_HIDE);
00269         }
00270         newMember->pWnd->EnableWindow(TRUE);
00271         newMember->pWnd->ShowWindow(SW_SHOW);
00272         newMember->pWnd->SetFocus();
00273
00274         m_pActiveView = (CView *)newMember->pWnd;
00275
00276         m_nActiveTab = nNewTab;
00277         // select the tab (if tab programmatically changed)
00278         m_pTabCtrl->SetCurSel(m_nActiveTab);
00279     }
00280 }

void CCJTabView::SetActiveView ( CRuntimeClass * pViewClass ) [virtual]

Definition at line 220 of file CJTabView.cpp.

Referenced by OnSelchange().

00221 {
00222     ASSERT_VALID(this);
00223     ASSERT(pViewClass != NULL);
00224     ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
00225     ASSERT(AfxIsValidAddress(pViewClass, sizeof(CRuntimeClass), FALSE));
00226
00227     int nNewTab = 0;
00228     for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos)) {
00229         CTV_ITEM *pMember=m_views.GetAt(pos);
00230         if (pMember->pWnd->IsKindOf(pViewClass)) {
00231             //first hide old first view
00232             m_pActiveView->EnableWindow(FALSE);
00233             m_pActiveView->ShowWindow(SW_HIDE);
00234
00235             // set new active view
00236             m_pActiveView = (CView*)pMember->pWnd;
00237             // enable, show, set focus to new view
00238             m_pActiveView->EnableWindow(TRUE);
00239             m_pActiveView->ShowWindow(SW_SHOW);
00240             m_pActiveView->SetFocus();
00241
00242             // *** LiangYiBin.Donald
00243             //((CFrameWnd *)GetParent())->SetActiveView(m_pActiveView);
00244             //GetParentFrame()->SetActiveView(m_pActiveView);
00245
00246             m_nActiveTab = nNewTab;
00247             // select the tab
00248             m_pTabCtrl->SetCurSel(m_nActiveTab);
00249
00250             break;
00251         }
00252         nNewTab++;
00253     }
00254 }

CImageList * CCJTabView::SetTabImageList ( CImageList * pImageList ) [virtual]

Definition at line 282 of file CJTabView.cpp.

00283 {
00284     return m_pTabCtrl->SetImageList (pImageList);
00285 }

Member Data Documentation

CFont CCJTabView::m_TabFont [protected]

Definition at line 79 of file CJTabView.h.

int CCJTabView::m_nActiveTab [protected]

Definition at line 76 of file CJTabView.h.

CView* CCJTabView::m_pActiveView [protected]

Definition at line 75 of file CJTabView.h.

CTabCtrl* CCJTabView::m_pTabCtrl [protected]

Definition at line 77 of file CJTabView.h.

CToolTipCtrl* CCJTabView::m_pToolTip [protected]

Definition at line 78 of file CJTabView.h.

CListViews CCJTabView::m_views [protected]

Definition at line 80 of file CJTabView.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJTabView.h
  • WinCvs/CJLib/CJLibrary/CJTabView.cpp
Generated on Sun Oct 21 12:46:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJTimeEdit Class Reference

#include <CJMaskEdit.h>

Inheritance diagram for CCJTimeEdit:

[legend]
Collaboration diagram for CCJTimeEdit:

[legend]
List of all members.

Public Methods

CCJTimeEdit ()
virtual void | SetHours (int nHours)
virtual void | SetMins (int nMins)
virtual bool | ProcessMask (UINT nChar, int nEndPos)
virtual void | FormatOleDateTime (CString &strData, COleDateTime dt)

Public Attributes

CString | m_strHours
CString | m_strMins

Constructor & Destructor Documentation

CCJTimeEdit::CCJTimeEdit ( )

Definition at line 511 of file CJMaskEdit.cpp.

00512 {
00513     m_bUseMask      = true;
00514     m_strMask       = _T("00:00");
00515     m_strLiteral    = _T("__:__");
00516     m_strHours      = _T("47");
00517     m_strMins       = _T("59");
00518 }

Member Function Documentation

void CCJTimeEdit::FormatOleDateTime | ( | CString & | strData,
 |  | COleDateTime | dt
 | ) | [virtual]

Reimplemented from CCJDateEdit.

Definition at line 520 of file CJMaskEdit.cpp.

00521 {
00522     if( dt.m_dt == 0 ) {
00523         strData = "00:00";
00524     }
00525     else {
00526         strData = dt.Format( _T("%H:%M"));
00527     }
00528 }

bool CCJTimeEdit::ProcessMask | ( | UINT | nChar,
 |  | int | nEndPos
 | ) | [virtual]

Reimplemented from CCJDateEdit.

Definition at line 530 of file CJMaskEdit.cpp.

00531 {
00532     // check the key against the mask
00533     switch( m_strMask.GetAt( nEndPos ))
00534     {
00535     case '0':       // digit only //completely changed this
00536         {
00537             bool bReturn = true;
00538
00539             if( isdigit( nChar ))
00540             {
00541                 if( nEndPos == 0 )
00542                 {
00543                     if(nChar > (UINT)m_strHours[0]) {
00544                         bReturn = false;
00545                     }
00546                 }
00547                 else if( nEndPos == 1 )
00548                 {
00549                     if(m_strWindowText.GetAt(0) == m_strHours[0])
00550                     {
00551                         if( nChar > (UINT)m_strHours[1] ) {
00552                             bReturn = false;
00553                         }
00554                     }
00555                 }
00556                 else if( nEndPos == 3 )
00557                 {
00558                     if( nChar > (UINT)m_strMins[0] ) {
00559                         bReturn = false;
00560                     }
00561                 }
00562                 else if( nEndPos == 4 )
00563                 {
00564                     if( m_strWindowText.GetAt(3) == m_strMins[0] )
00565                     {
00566                         if( nChar > (UINT)m_strMins[1] ) {
00567                             bReturn = false;
00568                         }
00569                     }
00570                 }
00571                 return bReturn;
00572             }
00573             break;
00574         }
00575     }
00576
00577     MessageBeep((UINT)-1);
00578     return false;
00579 }

void CCJTimeEdit::SetHours ( int nHours ) [virtual]

Definition at line 581 of file CJMaskEdit.cpp.

00582 {
00583     m_strHours.Format( _T("%d"), nHours);
00584 }

void CCJTimeEdit::SetMins ( int nMins ) [virtual]

Definition at line 586 of file CJMaskEdit.cpp.

00587 {
00588     m_strMins.Format( _T("%d"), nMins);
00589 }

Member Data Documentation

CString CCJTimeEdit::m_strHours

Definition at line 142 of file CJMaskEdit.h.

CString CCJTimeEdit::m_strMins

Definition at line 143 of file CJMaskEdit.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJMaskEdit.h
  • WinCvs/CJLib/CJLibrary/CJMaskEdit.cpp
Generated on Sun Oct 21 12:46:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJToolBar Class Reference

#include <CJToolBar.h>

Inheritance diagram for CCJToolBar:

[legend]
Collaboration diagram for CCJToolBar:

[legend]
List of all members.

Public Methods

CCJToolBar ()
virtual | ~CCJToolBar ()
virtual BOOL | Create (CWnd *pParentWnd, DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_TOP, UINT nID=AFX_IDW_TOOLBAR)
virtual BOOL | CreateEx (CWnd *pParentWnd, DWORD dwCtrlStyle=TBSTYLE_FLAT, DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_ALIGN_TOP, CRect rcBorders=CRect(0, 0, 0, 0), UINT nID=AFX_IDW_TOOLBAR)
CWnd * | InsertControl (CRuntimeClass *pClass, LPCTSTR lpszWindowName, CRect &rect, UINT nID, DWORD dwStyle)
CWnd * | InsertControl (CWnd *pCtrl, CRect &rect, UINT nID)
BOOL | AddDropDownButton (UINT nIDButton, UINT nIDMenu, BOOL bArrow=TRUE)
DROPDOWNBUTTON * | FindDropDownButton (UINT nID)
LRESULT | SendMessageC (UINT m, WPARAM wp=0, LPARAM lp=0) const
void | SetSizes (SIZE sizeButton, SIZE sizeImage)
void | SetHeight (int cyHeight)
BOOL | LoadToolBar (LPCTSTR lpszResourceName, TOOLBARINFO *pBarInfo=NULL)
BOOL | LoadToolBar (UINT nIDResource, TOOLBARINFO *pBarInfo=NULL)
BOOL | LoadBitmap (LPCTSTR lpszResourceName)
BOOL | LoadBitmap (UINT nIDResource)
BOOL | SetBitmap (HBITMAP hbmImageWell)
BOOL | SetButtons (const UINT *lpIDArray, int nIDCount)
int | CommandToIndex (UINT nIDFind) const
UINT | GetItemID (int nIndex) const
UINT | GetButtonStyle (int nIndex) const
void | SetButtonStyle (int nIndex, UINT nStyle)
void | SaveState ()
void | RestoreState ()
void | GetButtonInfo (int nIndex, UINT &nID, UINT &nStyle, int &iImage) const
void | SetButtonInfo (int nIndex, UINT nID, UINT nStyle, int iImage)
BOOL | SetButtonText (int nIndex, LPCTSTR lpszText)
CString | GetButtonText (int nIndex) const
void | GetButtonText (int nIndex, CString &rString) const
CCJToolBarCtrl & | GetToolBarCtrl () const
void | SetOwner (CWnd *pOwnerWnd)
BOOL | AddReplaceBitmap (HBITMAP hbmImageWell)
void | GetButton (int nIndex, TBBUTTON *pButton) const
void | SetButton (int nIndex, TBBUTTON *pButton)
BOOL | EnableButton (int nID, BOOL bEnable)
BOOL | CheckButton (int nID, BOOL bCheck)
BOOL | PressButton (int nID, BOOL bPress)
BOOL | HideButton (int nID, BOOL bHide)
BOOL | Indeterminate (int nID, BOOL bIndeterminate)
BOOL | IsButtonEnabled (int nID) const
BOOL | IsButtonChecked (int nID) const
BOOL | IsButtonPressed (int nID) const
BOOL | IsButtonHidden (int nID) const
BOOL | IsButtonIndeterminate (int nID) const
BOOL | SetState (int nID, UINT nState)
int | GetState (int nID) const
BOOL | AddButtons (int nNumButtons, LPTBBUTTON lpButtons)
BOOL | InsertButton (int nIndex, LPTBBUTTON lpButton)
BOOL | DeleteButton (int nIndex)
int | GetButtonCount () const
void | Customize ()
int | AddStrings (LPCTSTR lpszStrings)
void | SetButtonStructSize (int nSize)
BOOL | SetButtonSize (CSize sz)
BOOL | SetBitmapSize (CSize sz)
void | AutoSize ()
CToolTipCtrl * | GetToolTips () const
void | SetToolTips (CToolTipCtrl *pTip)
void | SetRows (int nRows, BOOL bLarger, LPRECT lpRect)
int | GetRows () const
BOOL | SetCmdID (int nIndex, UINT nID)
UINT | GetBitmapFlags () const
BOOL | SetIndent (int indent)
HIMAGELIST | GetImageList () const
HIMAGELIST | SetImageList (HIMAGELIST hImgList)
int | GetBitmap (UINT nIdButton) const
DWORD | SetExtendedStyle (DWORD dwStyle)
BOOL | GetRect (UINT nIdButton, RECT &rc) const
DWORD | GetToolbarStyle () const
void | SetToolbarStyle (DWORD dwStyle)
int | HitTest (CPoint p) const
int | GetHotItem () const
void | SetHotItem (int iHot)
BOOL | MapAccelerator (TCHAR ch, UINT &nID) const
CSize | GetPadding () const
CSize | SetPadding (CSize sz)
virtual CSize | CalcFixedLayout (BOOL bStretch, BOOL bHorz)
virtual CSize | CalcDynamicLayout (int nLength, DWORD nMode)
virtual void | OnUpdateCmdUI (CFrameWnd *pTarget, BOOL bDisableIfNoHndler)
virtual void | OnBarStyleChange (DWORD dwOldStyle, DWORD dwNewStyle)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
virtual int | OnToolHitTest (CPoint point, TOOLINFO *pTI) const
virtual void | GetItemRect (int nIndex, LPRECT lpRect) const
virtual void | InvalidateOldPos (const CRect &rcInvalid)
virtual CSize | GetButtonSize (TBBUTTON *pData, int iButton)
virtual void | OnDropDownButton (const NMTOOLBAR &nmtb, UINT nID, CRect rc)

Protected Methods

CSize | CalcLayout (DWORD nMode, int nLength=-1)
CSize | CalcSize (TBBUTTON *pData, int nCount)
int | WrapToolBar (TBBUTTON *pData, int nCount, int nWidth)
void | SizeToolBar (TBBUTTON *pData, int nCount, int nLength, BOOL bVert=FALSE)
void | Layout ()
LRESULT | OnSetSizeHelper (CSize &size, LPARAM lParam)
afx_msg UINT | OnNcHitTest (CPoint)
afx_msg void | OnNcPaint ()
afx_msg void | OnPaint ()
afx_msg void | OnNcCalcSize (BOOL, NCCALCSIZE_PARAMS *)
afx_msg void | OnWindowPosChanging (LPWINDOWPOS)
afx_msg void | OnWindowPosChanged (WINDOWPOS *lpwndpos)
afx_msg void | OnSysColorChange ()
afx_msg LRESULT | OnSetButtonSize (WPARAM, LPARAM)
afx_msg LRESULT | OnSetBitmapSize (WPARAM, LPARAM)
afx_msg BOOL | OnNcCreate (LPCREATESTRUCT)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnDestroy ()
afx_msg void | OnRButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnToolBarBtnDropDown (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnToolBarQueryDelete (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnToolBarQueryInsert (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnToolBarChange (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnToolBarBeginDrag (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnToolBarEndDrag (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnToolBarBeginAdjust (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnToolBarCustomHelp (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnToolBarEndAdjust (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnToolBarGetButtonInfo (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnToolBarReset (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg LRESULT | OnPreserveZeroBorderHelper (WPARAM, LPARAM)

Protected Attributes

TOOLBARINFO * m_pBarInfo
CObList * | m_pControls
bool | m_bShowDropArrow
HRSRC | m_hRsrcImageWell
HINSTANCE | m_hInstImageWell
HBITMAP m_hbmImageWell
BOOL | m_bDelayedButtonLayout
CRect | m_rcOldPos
int | m_nButtons
HKEY | m_hKeyRoot
CString | m_strSubKey
CString | m_strValueName
CSize | m_sizeImage
CSize | m_sizeButton
DROPDOWNBUTTON * m_pDropButtons
CMapStringToPtr * | m_pStringMap

Static Protected Attributes

int | m_nBarNumber = 0

Constructor & Destructor Documentation

CCJToolBar::CCJToolBar ( )

Definition at line 300 of file CJToolBar.cpp.

00301 {
00302     m_bShowDropArrow = false;
00303     m_pControls      = NULL;
00304     m_pDropButtons   = NULL;        // list of drop-down buttons
00305     m_nButtons       = 0;
00306     m_pBarInfo       = NULL;
00307     m_hKeyRoot       = HKEY_CURRENT_USER;
00308
00309     // get a pointer to the application.
00310     CWinApp* pApp = AfxGetApp();
00311     ASSERT( pApp );
00312
00313     ++m_nBarNumber;
00314     m_strValueName.Format( _T("CJToolBar %d"), m_nBarNumber );
00315     m_strSubKey.Format( _T("Software\\%s\\%s\\Settings"),
00316         pApp->m_pszRegistryKey, pApp->m_pszProfileName );
00317
00318     // initialize state
00319     m_pStringMap = NULL;
00320     m_hRsrcImageWell = NULL;
00321     m_hInstImageWell = NULL;
00322     m_hbmImageWell = NULL;
00323     m_bDelayedButtonLayout = TRUE;
00324
00325     // default image sizes
00326     m_sizeImage.cx = 16;
00327     m_sizeImage.cy = 15;
00328
00329     // default button sizes
00330     m_sizeButton.cx = 23;
00331     m_sizeButton.cy = 22;
00332
00333     // top and bottom borders are 1 larger than default for ease of grabbing
00334     m_cyTopBorder = 3;
00335     m_cyBottomBorder = 3;
00336     m_bExStyle = false;
00337 }

CCJToolBar::~CCJToolBar ( ) [virtual]

Definition at line 339 of file CJToolBar.cpp.

00340 {
00341     AfxDeleteObject((HGDIOBJ*)&m_hbmImageWell);
00342     delete m_pStringMap;
00343
00344     m_nCount = 0;
00345
00346     while (m_pDropButtons)
00347     {
00348         DROPDOWNBUTTON* pnext = m_pDropButtons->next;
00349         delete m_pDropButtons;
00350         m_pDropButtons = pnext;
00351     }
00352
00353     if( m_pControls ) {
00354         for( POSITION pos = m_pControls->GetHeadPosition() ; pos ; ) {
00355             delete m_pControls->GetNext(pos);
00356         }
00357         delete m_pControls;
00358     }
00359 }

Member Function Documentation

_CJXLIB_INLINE BOOL CCJToolBar::AddButtons | ( | int | nNumButtons,
 |  | LPTBBUTTON | lpButtons
 | ) |

Definition at line 403 of file CJToolBar.h.

Referenced by CCJMenuBar::LoadMenu().

00404     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_ADDBUTTONS, nNumButtons, (LPARAM)lpButtons); }

BOOL CCJToolBar::AddDropDownButton | ( | UINT | nIDButton,
 |  | UINT | nIDMenu,
 |  | BOOL | bArrow = TRUE
 | ) |

Definition at line 580 of file CJToolBar.cpp.

00581 {
00582     ASSERT_VALID(this);
00583
00584     DROPDOWNBUTTON* pb = FindDropDownButton(nIDButton);
00585     if (!pb) {
00586         pb = new DROPDOWNBUTTON;
00587         ASSERT(pb);
00588         pb->next = m_pDropButtons;
00589         m_pDropButtons = pb;
00590     }
00591     pb->idButton = nIDButton;
00592     pb->idMenu   = nIDMenu;
00593
00594     int iButton = CommandToIndex(nIDButton);
00595
00596     DWORD dwStyle = GetButtonStyle(iButton);
00597     dwStyle |= TBSTYLE_DROPDOWN;
00598     SetButtonStyle(iButton, dwStyle);
00599
00600     if (bArrow)
00601         SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
00602
00603     return TRUE;
00604 }

BOOL CCJToolBar::AddReplaceBitmap ( HBITMAP hbmImageWell )

Definition at line 1141 of file CJToolBar.cpp.

Referenced by LoadBitmap(), OnSysColorChange(), and SetBitmap().

01142 {
01143     // need complete bitmap size to determine number of images
01144     BITMAP bitmap;
01145     VERIFY(::GetObject(hbmImageWell, sizeof(BITMAP), &bitmap));
01146
01147     // add the bitmap to the common control toolbar
01148     BOOL bResult;
01149     if (m_hbmImageWell == NULL)
01150     {
01151         TBADDBITMAP addBitmap;
01152         addBitmap.hInst = NULL; // makes TBADDBITMAP::nID behave a HBITMAP
01153         addBitmap.nID = (UINT)hbmImageWell;
01154         bResult =  DefWindowProc(TB_ADDBITMAP,
01155             bitmap.bmWidth / m_sizeImage.cx, (LPARAM)&addBitmap) == 0;
01156     }
01157     else
01158     {
01159         TBREPLACEBITMAP replaceBitmap;
01160         replaceBitmap.hInstOld = NULL;
01161         replaceBitmap.nIDOld = (UINT)m_hbmImageWell;
01162         replaceBitmap.hInstNew = NULL;
01163         replaceBitmap.nIDNew = (UINT)hbmImageWell;
01164         replaceBitmap.nButtons = bitmap.bmWidth / m_sizeImage.cx;
01165         bResult = (BOOL)DefWindowProc(TB_REPLACEBITMAP, 0,
01166             (LPARAM)&replaceBitmap);
01167     }
01168     // remove old bitmap, if present
01169     if (bResult)
01170     {
01171         AfxDeleteObject((HGDIOBJ*)&m_hbmImageWell);
01172         m_hbmImageWell = hbmImageWell;
01173     }
01174
01175     return bResult;
01176 }

_CJXLIB_INLINE int CCJToolBar::AddStrings ( LPCTSTR lpszStrings )

Definition at line 418 of file CJToolBar.h.

Referenced by CCJMenuBar::LoadMenu().

00419     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_ADDSTRING, 0, (LPARAM)lpszStrings); }

_CJXLIB_INLINE void CCJToolBar::AutoSize ( )

Definition at line 430 of file CJToolBar.h.

Referenced by CCJMenuBar::LoadMenu().

00431     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_AUTOSIZE); }

CSize CCJToolBar::CalcDynamicLayout | ( | int | nLength,
 |  | DWORD | dwMode
 | ) | [virtual]

Definition at line 1687 of file CJToolBar.cpp.

Referenced by OnBarStyleChange().

01688 {
01689     if ((nLength == -1) && !(dwMode & LM_MRUWIDTH) && !(dwMode & LM_COMMIT) &&
01690         ((dwMode & LM_HORZDOCK) || (dwMode & LM_VERTDOCK)))
01691     {
01692         return CalcFixedLayout(dwMode & LM_STRETCH, dwMode & LM_HORZDOCK);
01693     }
01694     return CalcLayout(dwMode, nLength);
01695 }

CSize CCJToolBar::CalcFixedLayout | ( | BOOL | bStretch,
 |  | BOOL | bHorz
 | ) | [virtual]

Reimplemented in CCJMenuBar.

Definition at line 1679 of file CJToolBar.cpp.

Referenced by CalcDynamicLayout(), and CCJMenuBar::CalcFixedLayout().

01680 {
01681     DWORD dwMode = bStretch ? LM_STRETCH : 0;
01682     dwMode |= bHorz ? LM_HORZ : 0;
01683
01684     return CalcLayout(dwMode);
01685 }

CSize CCJToolBar::CalcLayout | ( | DWORD | dwMode,
 |  | int | nLength = -1
 | ) | [protected]

Definition at line 1553 of file CJToolBar.cpp.

Referenced by CalcDynamicLayout(), and CalcFixedLayout().

01554 {
01555     ASSERT_VALID(this);
01556     ASSERT(::IsWindow(m_hWnd));
01557     if (dwMode & LM_HORZDOCK)
01558         ASSERT(dwMode & LM_HORZ);
01559
01560     int nCount;
01561     TBBUTTON* pData = NULL;
01562     CSize sizeResult(0,0);
01563
01564     //BLOCK: Load Buttons
01565     {
01566         nCount = DefWindowProc(TB_BUTTONCOUNT, 0, 0);
01567         if (nCount != 0)
01568         {
01569             int i;
01570             pData = new TBBUTTON[nCount];
01571             for (i = 0; i < nCount; i++)
01572                 GetButton(i, &pData[i]);
01573         }
01574     }
01575
01576     if (nCount > 0)
01577     {
01578         if (!(m_dwStyle & CBRS_SIZE_FIXED))
01579         {
01580             BOOL bDynamic = m_dwStyle & CBRS_SIZE_DYNAMIC;
01581
01582             if (bDynamic && (dwMode & LM_MRUWIDTH))
01583                 SizeToolBar(pData, nCount, m_nMRUWidth);
01584             else if (bDynamic && (dwMode & LM_HORZDOCK))
01585                 SizeToolBar(pData, nCount, 32767);
01586             else if (bDynamic && (dwMode & LM_VERTDOCK))
01587                 SizeToolBar(pData, nCount, 0);
01588             else if (bDynamic && (nLength != -1))
01589             {
01590                 CRect rect; rect.SetRectEmpty();
01591                 CalcInsideRect(rect, (dwMode & LM_HORZ));
01592                 BOOL bVert = (dwMode & LM_LENGTHY);
01593                 int nLen = nLength + (bVert ? rect.Height() : rect.Width());
01594
01595                 SizeToolBar(pData, nCount, nLen, bVert);
01596             }
01597             else if (bDynamic && (m_dwStyle & CBRS_FLOATING))
01598                 SizeToolBar(pData, nCount, m_nMRUWidth);
01599             else
01600                 SizeToolBar(pData, nCount, (dwMode & LM_HORZ) ? 32767 : 0);
01601         }
01602
01603         sizeResult = CalcSize(pData, nCount);
01604
01605         if (dwMode & LM_COMMIT)
01606         {
01607             CJX_CONTROLPOS* pControl = NULL;
01608             int nControlCount = 0;
01609             BOOL bIsDelayed = m_bDelayedButtonLayout;
01610             m_bDelayedButtonLayout = FALSE;
01611
01612             for (int i = 0; i < nCount; i++)
01613                 if ((pData[i].fsStyle & TBSTYLE_SEP) && (pData[i].idCommand != 0))
01614                     nControlCount++;
01615
01616             if (nControlCount > 0)
01617             {
01618                 pControl = new CJX_CONTROLPOS[nControlCount];
01619                 nControlCount = 0;
01620
01621                 for(int i = 0; i < nCount; i++)
01622                 {
01623                     if ((pData[i].fsStyle & TBSTYLE_SEP) && (pData[i].idCommand != 0))
01624                     {
01625                         pControl[nControlCount].nIndex = i;
01626                         pControl[nControlCount].nID = pData[i].idCommand;
01627
01628                         CRect rect;
01629                         GetItemRect(i, &rect);
01630                         ClientToScreen(&rect);
01631                         pControl[nControlCount].rectOldPos = rect;
01632
01633                         nControlCount++;
01634                     }
01635                 }
01636             }
01637
01638             if ((m_dwStyle & CBRS_FLOATING) && (m_dwStyle & CBRS_SIZE_DYNAMIC))
01639                 m_nMRUWidth = sizeResult.cx;
01640             for (i = 0; i < nCount; i++)
01641                 SetButton(i, &pData[i]);
01642
01643             if (nControlCount > 0)
01644             {
01645                 for (int i = 0; i < nControlCount; i++)
01646                 {
01647                     CWnd* pWnd = GetDlgItem(pControl[i].nID);
01648                     if (pWnd != NULL)
01649                     {
01650                         CRect rect;
01651                         pWnd->GetWindowRect(&rect);
01652                         CPoint pt = rect.TopLeft() - pControl[i].rectOldPos.TopLeft();
01653                         GetItemRect(pControl[i].nIndex, &rect);
01654                         pt = rect.TopLeft() + pt;
01655                         pWnd->SetWindowPos(NULL, pt.x, pt.y, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
01656                     }
01657                 }
01658                 delete[] pControl;
01659             }
01660             m_bDelayedButtonLayout = bIsDelayed;
01661         }
01662         delete[] pData;
01663     }
01664
01665     //BLOCK: Adjust Margins
01666     {
01667         CRect rect; rect.SetRectEmpty();
01668         CalcInsideRect(rect, (dwMode & LM_HORZ));
01669         sizeResult.cy -= rect.Height();
01670         sizeResult.cx -= rect.Width();
01671
01672         CSize size = CCJToolBarBase::CalcFixedLayout((dwMode & LM_STRETCH), (dwMode & LM_HORZ));
01673         sizeResult.cx = max(sizeResult.cx, size.cx);
01674         sizeResult.cy = max(sizeResult.cy, size.cy);
01675     }
01676     return sizeResult;
01677 }

CSize CCJToolBar::CalcSize | ( | TBBUTTON * | pData,
 |  | int | nCount
 | ) | [protected]

Definition at line 1370 of file CJToolBar.cpp.

Referenced by CalcLayout(), and SizeToolBar().

01371 {
01372     ASSERT(pData != NULL && nCount > 0);
01373
01374     CPoint cur(0,0);
01375     CSize sizeResult(0,0);
01376     int cyTallestOnRow = 0;
01377
01378     for (int i = 0; i < nCount; i++)
01379     {
01380         if (pData[i].fsState & TBSTATE_HIDDEN)
01381             continue;
01382
01383         // **PD**
01384         // Load actual size of button into a local variable
01385         // called m_sizeButton. C++ will use this instead of
01386         // CToolBar::m_sizeButton.
01387         //
01388         CSize m_sizeButton = GetButtonSize(pData, i);
01389
01390         // **PD**
01391         // I also changed the logic below to be more correct.
01392         cyTallestOnRow = max(cyTallestOnRow, m_sizeButton.cy);
01393         sizeResult.cx = max(cur.x + m_sizeButton.cx, sizeResult.cx);
01394         sizeResult.cy = max(cur.y + m_sizeButton.cy, sizeResult.cy);
01395
01396         cur.x += m_sizeButton.cx - CX_OVERLAP;
01397
01398         if (pData[i].fsState & TBSTATE_WRAP)
01399         {
01400             cur.x = 0;
01401             cur.y += cyTallestOnRow;
01402             cyTallestOnRow = 0;
01403             if (pData[i].fsStyle & TBSTYLE_SEP)
01404                 cur.y += m_sizeButton.cy;
01405         }
01406     }
01407     return sizeResult;
01408 }

_CJXLIB_INLINE BOOL CCJToolBar::CheckButton | ( | int | nID,
 |  | BOOL | bCheck
 | ) |

Definition at line 370 of file CJToolBar.h.

00371     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_CHECKBUTTON, nID, MAKELPARAM(bCheck, 0)); }

int CCJToolBar::CommandToIndex ( UINT nIDFind ) const

Definition at line 1293 of file CJToolBar.cpp.

Referenced by AddDropDownButton(), and InsertControl().

01294 {
01295     ASSERT_VALID(this);
01296     ASSERT(::IsWindow(m_hWnd));
01297
01298     CCJToolBar* pBar = (CCJToolBar*)this;
01299     return (int)pBar->DefWindowProc(TB_COMMANDTOINDEX, nIDFind, 0);
01300 }

BOOL CCJToolBar::Create | ( | CWnd * | pParentWnd,
 |  | DWORD | dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP,
 |  | UINT | nID = AFX_IDW_TOOLBAR
 | ) | [virtual]

Reimplemented in CCJMenuBar.

Definition at line 361 of file CJToolBar.cpp.

00362 {
00363     return CreateEx(pParentWnd, NULL, dwStyle,
00364         CRect(m_cxLeftBorder, m_cyTopBorder, m_cxRightBorder, m_cyBottomBorder), nID);
00365 }

BOOL CCJToolBar::CreateEx | ( | CWnd * | pParentWnd,
 |  | DWORD | dwCtrlStyle = TBSTYLE_FLAT,
 |  | DWORD | dwStyle = WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP,
 |  | CRect | rcBorders = CRect(0, 0, 0, 0),
 |  | UINT | nID = AFX_IDW_TOOLBAR
 | ) | [virtual]

Reimplemented in CCJMenuBar.

Definition at line 367 of file CJToolBar.cpp.

Referenced by Create(), and CCJMenuBar::CreateEx().

00368 {
00369     ASSERT_VALID(pParentWnd);   // must have a parent
00370     ASSERT (!((dwStyle & CBRS_SIZE_FIXED) && (dwStyle & CBRS_SIZE_DYNAMIC)));
00371
00372     // KStowell - bool for drawing office style gripper.
00373     if( dwCtrlStyle != NULL )
00374         m_bExStyle = true;
00375
00376     SetBorders(rcBorders);
00377
00378     // save the style
00379     m_dwStyle = (dwStyle & CBRS_ALL)|( dwStyle & CBRS_GRIPPER );
00380     if (nID == AFX_IDW_TOOLBAR)
00381         m_dwStyle |= CBRS_HIDE_INPLACE;
00382
00383     dwStyle &= ~CBRS_ALL;
00384     dwStyle |= CCS_NOPARENTALIGN|CCS_NOMOVEY|CCS_NODIVIDER|CCS_NORESIZE;
00385     dwStyle |= dwCtrlStyle;
00386
00387     // initialize common controls
00388
00389 #ifdef _VC_VERSION_5
00390
00391     INITCOMMONCONTROLSEX icex;
00392     icex.dwSize = sizeof(icex);
00393     icex.dwICC = ICC_BAR_CLASSES;
00394     VERIFY(InitCommonControlsEx(&icex));
00395
00396 #else
00397
00398     VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_BAR_REG));
00399
00400 #endif
00401
00402     _GetComCtlVersion();
00403     ASSERT(_ComCtlVersion != -1);
00404     _GetDropDownWidth();
00405     ASSERT(_dropDownWidth != -1);
00406
00407     // create the HWND
00408     CRect rect; rect.SetRectEmpty();
00409     if (!CWnd::Create(TOOLBARCLASSNAME, NULL, dwStyle, rect, pParentWnd, nID))
00410         return FALSE;
00411
00412     // sync up the sizes
00413     SetSizes(m_sizeButton, m_sizeImage);
00414
00415     // Note: Parent must resize itself for control bar to be resized
00416
00417     return TRUE;
00418 }

_CJXLIB_INLINE void CCJToolBar::Customize ( )

Definition at line 415 of file CJToolBar.h.

Referenced by OnRButtonDown().

00416     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_CUSTOMIZE, 0, 0L); }

_CJXLIB_INLINE BOOL CCJToolBar::DeleteButton ( int nIndex )

Definition at line 409 of file CJToolBar.h.

Referenced by CCJMenuBar::LoadMenu().

00410     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_DELETEBUTTON, nIndex); }

_CJXLIB_INLINE BOOL CCJToolBar::EnableButton | ( | int | nID,
 |  | BOOL | bEnable
 | ) |

Definition at line 367 of file CJToolBar.h.

00368     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_ENABLEBUTTON, nID, MAKELPARAM(bEnable, 0)); }

DROPDOWNBUTTON * CCJToolBar::FindDropDownButton ( UINT nID )

Definition at line 610 of file CJToolBar.cpp.

Referenced by AddDropDownButton(), and OnDropDownButton().

00611 {
00612     for (DROPDOWNBUTTON* pb = m_pDropButtons; pb; pb = pb->next) {
00613         if (pb->idButton == nID)
00614             return pb;
00615     }
00616     return NULL;
00617 }

_CJXLIB_INLINE int CCJToolBar::GetBitmap ( UINT nIdButton ) const

Definition at line 461 of file CJToolBar.h.

00462     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETBITMAP, nIdButton); }

_CJXLIB_INLINE UINT CCJToolBar::GetBitmapFlags ( ) const

Definition at line 448 of file CJToolBar.h.

00449     { ASSERT(::IsWindow(m_hWnd)); return (UINT) SendMessageC(TB_GETBITMAPFLAGS); }

void CCJToolBar::GetButton | ( | int | nIndex,
 |  | TBBUTTON * | pButton
 | ) | const

Definition at line 1244 of file CJToolBar.cpp.

Referenced by CalcLayout(), GetButtonInfo(), GetButtonStyle(), GetButtonText(), GetItemID(), OnUpdateCmdUI(), SetButtonInfo(), SetButtonStyle(), and SetButtonText().

01245 {
01246     CCJToolBar* pBar = (CCJToolBar*)this;
01247     VERIFY(pBar->DefWindowProc(TB_GETBUTTON, nIndex, (LPARAM)pButton));
01248     // TBSTATE_ENABLED == TBBS_DISABLED so invert it
01249     pButton->fsState ^= TBSTATE_ENABLED;
01250 }

_CJXLIB_INLINE int CCJToolBar::GetButtonCount ( ) const

Definition at line 412 of file CJToolBar.h.

Referenced by CCJMenuBar::GetNextOrPrevButton(), CCJMenuBar::IsValidButton(), CCJMenuBar::LoadMenu(), LoadToolBar(), and CCJMenuBar::OnLButtonDown().

00413     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_BUTTONCOUNT); }

void CCJToolBar::GetButtonInfo | ( | int | nIndex,
 |  | UINT & | nID,
 |  | UINT & | nStyle,
 |  | int & | iImage
 | ) | const

Definition at line 1697 of file CJToolBar.cpp.

01698 {
01699     ASSERT_VALID(this);
01700     ASSERT(::IsWindow(m_hWnd));
01701
01702     TBBUTTON button;
01703     GetButton(nIndex, &button);
01704     nID = button.idCommand;
01705     nStyle = MAKELONG(button.fsStyle, button.fsState);
01706     iImage = button.iBitmap;
01707 }

CSize CCJToolBar::GetButtonSize | ( | TBBUTTON * | pData,
 |  | int | iButton
 | ) | [virtual]

Definition at line 718 of file CJToolBar.cpp.

Referenced by CalcSize(), and WrapToolBar().

00719 {
00720     ASSERT(_ComCtlVersion > 0);
00721
00722     // Get the actual size of the button, not what's in m_sizeButton.
00723     // Make sure to do SendMessage instead of calling MFC's GetItemRect,
00724     // which has all sorts of bad side-effects! (Go ahead, take a look at it.)
00725     //
00726     CRect rc;
00727     SendMessage(TB_GETITEMRECT, iButton, (LPARAM)&rc);
00728     CSize sz = rc.Size();
00729
00731     // Now must do special case for various versions of comctl32.dll,
00732     //
00733     DWORD dwStyle = pData[iButton].fsStyle;
00734     if ((pData[iButton].fsState & TBSTATE_WRAP)) {
00735         if (dwStyle & TBSTYLE_SEP) {
00736             // this is the last separator in the row (eg vertically docked)
00737             // fudge the height, and ignore the width. TB_GETITEMRECT will return
00738             // size = (8 x 22) even for a separator in vertical toolbar
00739             //
00740             if (_ComCtlVersion <= VERSION_IE3)
00741                 sz.cy -= 3;     // empircally good fudge factor
00742             else if (_ComCtlVersion != VERSION_IE4)
00743                 sz.cy = sz.cx;
00744             sz.cx = 0;          // separator takes no width if it's the last one
00745
00746         } else if (dwStyle & TBSTYLE_DROPDOWN && ( m_bShowDropArrow == false )) {
00747             // ignore width of dropdown
00748             sz.cx = 0;
00749         }
00750     }
00751     return sz;
00752 }

UINT CCJToolBar::GetButtonStyle ( int nIndex ) const

Definition at line 1342 of file CJToolBar.cpp.

Referenced by AddDropDownButton(), CCJToolCmdUI::Enable(), and CCJToolCmdUI::SetCheck().

01343 {
01344     ASSERT_VALID(this);
01345     ASSERT(::IsWindow(m_hWnd));
01346
01347     TBBUTTON button;
01348     GetButton(nIndex, &button);
01349     return MAKELONG(button.fsStyle, button.fsState);
01350 }

void CCJToolBar::GetButtonText | ( | int | nIndex,
 |  | CString & | rString
 | ) | const

Definition at line 1811 of file CJToolBar.cpp.

01812 {
01813     if (m_pStringMap != NULL)
01814     {
01815         // get button information (need button.iString)
01816         TBBUTTON button;
01817         GetButton(nIndex, &button);
01818
01819         // look in map for matching iString
01820         POSITION pos = m_pStringMap->GetStartPosition();
01821         CString str; void* p;
01822         while (pos)
01823         {
01824             m_pStringMap->GetNextAssoc(pos, str, p);
01825             if ((int)p == button.iString)
01826             {
01827                 rString = str;
01828                 return;
01829             }
01830         }
01831     }
01832     rString.Empty();
01833 }

CString CCJToolBar::GetButtonText ( int nIndex ) const

Definition at line 1804 of file CJToolBar.cpp.

01805 {
01806     CString strResult;
01807     GetButtonText(nIndex, strResult);
01808     return strResult;
01809 }

_CJXLIB_INLINE int CCJToolBar::GetHotItem ( ) const

Definition at line 479 of file CJToolBar.h.

Referenced by CCJMenuBar::TranslateFrameMessage().

00480     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETHOTITEM); }

_CJXLIB_INLINE HIMAGELIST CCJToolBar::GetImageList ( ) const

Definition at line 455 of file CJToolBar.h.

00456     { ASSERT(::IsWindow(m_hWnd)); return (HIMAGELIST)SendMessageC(TB_GETIMAGELIST); }

UINT CCJToolBar::GetItemID ( int nIndex ) const

Definition at line 1302 of file CJToolBar.cpp.

Referenced by OnToolHitTest().

01303 {
01304     ASSERT_VALID(this);
01305     ASSERT(::IsWindow(m_hWnd));
01306
01307     TBBUTTON button;
01308     GetButton(nIndex, &button);
01309     return button.idCommand;
01310 }

void CCJToolBar::GetItemRect | ( | int | nIndex,
 |  | LPRECT | lpRect
 | ) | const [virtual]

Definition at line 1312 of file CJToolBar.cpp.

Referenced by CalcLayout(), and InsertControl().

01313 {
01314     ASSERT_VALID(this);
01315     ASSERT(::IsWindow(m_hWnd));
01316
01317     // handle any delayed layout
01318     if (m_bDelayedButtonLayout)
01319         ((CCJToolBar*)this)->Layout();
01320
01321     // now it is safe to get the item rectangle
01322     CCJToolBar* pBar = (CCJToolBar*)this;
01323     if (!pBar->DefWindowProc(TB_GETITEMRECT, nIndex, (LPARAM)lpRect))
01324         SetRectEmpty(lpRect);
01325 }

_CJXLIB_INLINE CSize CCJToolBar::GetPadding ( ) const

Definition at line 488 of file CJToolBar.h.

00489     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETPADDING); }

_CJXLIB_INLINE BOOL CCJToolBar::GetRect | ( | UINT | nIdButton,
 |  | RECT & | rc
 | ) | const

Definition at line 467 of file CJToolBar.h.

Referenced by OnToolBarBtnDropDown(), and CCJMenuBar::TrackPopup().

00468     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETRECT, nIdButton, (LPARAM)&rc); }

_CJXLIB_INLINE int CCJToolBar::GetRows ( ) const

Definition at line 442 of file CJToolBar.h.

00443     { ASSERT(::IsWindow(m_hWnd)); return (int) SendMessageC(TB_GETROWS); }

_CJXLIB_INLINE int CCJToolBar::GetState ( int nID ) const

Definition at line 400 of file CJToolBar.h.

00401     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETSTATE, nID); }

_CJXLIB_INLINE CCJToolBarCtrl & CCJToolBar::GetToolBarCtrl ( ) const

Definition at line 355 of file CJToolBar.h.

Referenced by LoadToolBar(), OnRButtonDown(), RestoreState(), and SaveState().

00356     { ASSERT(::IsWindow(m_hWnd)); return *(CCJToolBarCtrl*)this; }

_CJXLIB_INLINE CToolTipCtrl * CCJToolBar::GetToolTips ( ) const

Definition at line 433 of file CJToolBar.h.

00434     { ASSERT(::IsWindow(m_hWnd)); return (CToolTipCtrl*)CWnd::FromHandle((HWND)SendMessageC(TB_GETTOOLTIPS)); }

_CJXLIB_INLINE DWORD CCJToolBar::GetToolbarStyle ( ) const

Definition at line 470 of file CJToolBar.h.

00471     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_GETSTYLE); }

_CJXLIB_INLINE BOOL CCJToolBar::HideButton | ( | int | nID,
 |  | BOOL | bHide
 | ) |

Definition at line 376 of file CJToolBar.h.

00377     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_HIDEBUTTON, nID, MAKELPARAM(bHide, 0)); }

_CJXLIB_INLINE int CCJToolBar::HitTest ( CPoint p ) const

Reimplemented in CCJMenuBar.

Definition at line 476 of file CJToolBar.h.

Referenced by CCJMenuBar::HitTest().

00477     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_HITTEST, 0, (LPARAM)&p); }

_CJXLIB_INLINE BOOL CCJToolBar::Indeterminate | ( | int | nID,
 |  | BOOL | bIndeterminate
 | ) |

Definition at line 379 of file CJToolBar.h.

00380     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_INDETERMINATE, nID, MAKELPARAM(bIndeterminate, 0)); }

_CJXLIB_INLINE BOOL CCJToolBar::InsertButton | ( | int | nIndex,
 |  | LPTBBUTTON | lpButton
 | ) |

Definition at line 406 of file CJToolBar.h.

00407     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_INSERTBUTTON, nIndex, (LPARAM)lpButton); }

CWnd * CCJToolBar::InsertControl | ( | CWnd * | pCtrl,
 |  | CRect & | rect,
 |  | UINT | nID
 | ) |

Definition at line 557 of file CJToolBar.cpp.

00558 {
00559     ASSERT_VALID( pCtrl );
00560
00561     // make sure the id is valid, and set the button
00562     // style for a seperator.
00563     ASSERT( CommandToIndex( nID ) >= 0 );
00564     SetButtonInfo( CommandToIndex( nID ), nID, TBBS_SEPARATOR, rect.Width());
00565
00566     // insert the control into the toolbar.
00567     GetItemRect( CommandToIndex(nID), &rect );
00568     pCtrl->SetWindowPos(0, rect.left, rect.top, 0, 0,
00569         SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS );
00570     pCtrl->SetFont( GetFont( ));
00571     pCtrl->ShowWindow( SW_SHOW );
00572
00573     return pCtrl;
00574 }

CWnd * CCJToolBar::InsertControl | ( | CRuntimeClass * | pClass,
 |  | LPCTSTR | lpszWindowName,
 |  | CRect & | rect,
 |  | UINT | nID,
 |  | DWORD | dwStyle
 | ) |

Definition at line 433 of file CJToolBar.cpp.

00434 {
00435     CWnd *pCtrl = NULL;
00436
00437     if( pClass->IsDerivedFrom( RUNTIME_CLASS( CCJComboBoxEx ))) // CCJComboBoxEx control.
00438     {
00439         pCtrl = new CCJComboBoxEx;
00440
00441         ASSERT_VALID( pCtrl );
00442
00443         if(((CCJComboBoxEx*)pCtrl)->Create( WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00444         {
00445             delete pCtrl;
00446             return NULL;
00447         }
00448     }
00449     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CCJFlatComboBox )))  // CCJFlatComboBox control.
00450     {
00451         pCtrl = new CCJFlatComboBox;
00452
00453         ASSERT_VALID( pCtrl );
00454
00455         if(((CCJFlatComboBox*)pCtrl)->Create( WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00456         {
00457             delete pCtrl;
00458             return NULL;
00459         }
00460     }
00461     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CCJFontCombo ))) // CCJFontCombo control.
00462     {
00463         pCtrl = new CCJFontCombo;
00464
00465         ASSERT_VALID( pCtrl );
00466
00467         if(((CCJFontCombo*)pCtrl)->Create( WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00468         {
00469             delete pCtrl;
00470             return NULL;
00471         }
00472     }
00473     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CComboBox )))    // CComboBox control.
00474     {
00475         pCtrl = new CComboBox;
00476
00477         ASSERT_VALID( pCtrl );
00478
00479         if(((CComboBox*)pCtrl)->Create( WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00480         {
00481             delete pCtrl;
00482             return NULL;
00483         }
00484     }
00485     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CEdit )))        // CEdit control.
00486     {
00487         pCtrl = new CEdit;
00488
00489         ASSERT_VALID( pCtrl );
00490
00491         if(((CEdit*)pCtrl)->Create( WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00492         {
00493             delete pCtrl;
00494             return NULL;
00495         }
00496     }
00497     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CButton )))      // CButton control.
00498     {
00499         pCtrl = new CButton;
00500
00501         ASSERT_VALID( pCtrl );
00502
00503         if(((CButton*)pCtrl)->Create( lpszWindowName, WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00504         {
00505             delete pCtrl;
00506             return NULL;
00507         }
00508     }
00509     else if( pClass->IsDerivedFrom( RUNTIME_CLASS( CWnd )))         // CWnd object.
00510     {
00511         pCtrl = new CWnd;
00512
00513         ASSERT_VALID( pCtrl );
00514
00515 #ifdef _UNICODE
00516         TCHAR szClassName[ 256 ];
00517
00518         MultiByteToWideChar( CP_ACP,
00519                              MB_PRECOMPOSED,
00520                              pClass->m_lpszClassName,
00521                              -1,
00522                              szClassName,
00523                              255 );
00524
00525         if(((CWnd*)pCtrl)->Create( szClassName, lpszWindowName, WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00526         {
00527             delete pCtrl;
00528             return NULL;
00529         }
00530 #else
00531         if(((CWnd*)pCtrl)->Create( pClass->m_lpszClassName, lpszWindowName, WS_CHILD|WS_VISIBLE|dwStyle, rect, this, nID ) == FALSE )
00532         {
00533             delete pCtrl;
00534             return NULL;
00535         }
00536 #endif
00537     }
00538     else                                                            // An invalid object was passed in
00539     {
00540         ASSERT( FALSE );
00541         return NULL;
00542     }
00543
00544     // if our object list has not been allocated, do it now...
00545     if( m_pControls == NULL )
00546     {
00547         m_pControls = new CObList();
00548         ASSERT( m_pControls );
00549     }
00550
00551     // we have to remember this control, so we can delete it later
00552     m_pControls->AddTail( pCtrl );
00553
00554     return InsertControl( pCtrl, rect, nID );
00555 }

void CCJToolBar::InvalidateOldPos ( const CRect & rcInvalid ) [virtual]

Definition at line 688 of file CJToolBar.cpp.

Referenced by OnWindowPosChanged().

00689 {
00690     // make parent paint the area beneath rectangle
00691     CWnd* pParent = GetParent();        // parent (dock bar/frame) window
00692     ASSERT_VALID(pParent);              // check
00693     CRect rc( rcInvalid );              // copy rectangle
00694     pParent->ScreenToClient(&rc);       // convert to parent client coords
00695     pParent->InvalidateRect(&rc);       // invalidate
00696
00697     // now do same for each sibling too
00698     for (CWnd* pSib = pParent->GetWindow(GW_CHILD);
00699           pSib;
00700           pSib=pSib->GetNextWindow(GW_HWNDNEXT)) {
00701
00702         CRect rc;                                       // window rect of sibling
00703         pSib->GetWindowRect(&rc);                   // ...
00704         if (rc.IntersectRect(rc, rcInvalid)) {  // if intersects invalid rect
00705             pSib->ScreenToClient(&rc);              // convert to sibling coords
00706             pSib->InvalidateRect(&rc);              // invalidate
00707             pSib->SendMessage(WM_NCPAINT);      // nonclient area too!
00708         }
00709     }
00710 }

_CJXLIB_INLINE BOOL CCJToolBar::IsButtonChecked ( int nID ) const

Definition at line 385 of file CJToolBar.h.

00386     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_ISBUTTONCHECKED, nID); }

_CJXLIB_INLINE BOOL CCJToolBar::IsButtonEnabled ( int nID ) const

Definition at line 382 of file CJToolBar.h.

00383     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_ISBUTTONENABLED, nID); }

_CJXLIB_INLINE BOOL CCJToolBar::IsButtonHidden ( int nID ) const

Definition at line 391 of file CJToolBar.h.

00392     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_ISBUTTONHIDDEN, nID); }

_CJXLIB_INLINE BOOL CCJToolBar::IsButtonIndeterminate ( int nID ) const

Definition at line 394 of file CJToolBar.h.

00395     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_ISBUTTONINDETERMINATE, nID); }

_CJXLIB_INLINE BOOL CCJToolBar::IsButtonPressed ( int nID ) const

Definition at line 388 of file CJToolBar.h.

00389     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_ISBUTTONPRESSED, nID); }

void CCJToolBar::Layout ( ) [protected]

Definition at line 1327 of file CJToolBar.cpp.

Referenced by OnPaint().

01328 {
01329     ASSERT(m_bDelayedButtonLayout);
01330
01331     m_bDelayedButtonLayout = FALSE;
01332
01333     BOOL bHorz = (m_dwStyle & CBRS_ORIENT_HORZ) != 0;
01334     if ((m_dwStyle & CBRS_FLOATING) && (m_dwStyle & CBRS_SIZE_DYNAMIC))
01335         ((CCJToolBar*)this)->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH | LM_COMMIT);
01336     else if (bHorz)
01337         ((CCJToolBar*)this)->CalcDynamicLayout(0, LM_HORZ | LM_HORZDOCK | LM_COMMIT);
01338     else
01339         ((CCJToolBar*)this)->CalcDynamicLayout(0, LM_VERTDOCK | LM_COMMIT);
01340 }

_CJXLIB_INLINE BOOL CCJToolBar::LoadBitmap ( UINT nIDResource )

Definition at line 358 of file CJToolBar.h.

00359     { return LoadBitmap(MAKEINTRESOURCE(nIDResource)); }

BOOL CCJToolBar::LoadBitmap ( LPCTSTR lpszResourceName )

Definition at line 1103 of file CJToolBar.cpp.

Referenced by LoadBitmap(), and LoadToolBar().

01104 {
01105     ASSERT_VALID(this);
01106     ASSERT(lpszResourceName != NULL);
01107
01108     // determine location of the bitmap in resource fork
01109     HINSTANCE hInstImageWell = AfxFindResourceHandle(lpszResourceName, RT_BITMAP);
01110     HRSRC hRsrcImageWell = ::FindResource(hInstImageWell, lpszResourceName, RT_BITMAP);
01111     if (hRsrcImageWell == NULL)
01112         return FALSE;
01113
01114     // load the bitmap
01115     HBITMAP hbmImageWell;
01116     hbmImageWell = _LoadSysColorBitmap(hInstImageWell, hRsrcImageWell);
01117
01118     // tell common control toolbar about the new bitmap
01119     if (!AddReplaceBitmap(hbmImageWell))
01120         return FALSE;
01121
01122     // remember the resource handles so the bitmap can be recolored if necessary
01123     m_hInstImageWell = hInstImageWell;
01124     m_hRsrcImageWell = hRsrcImageWell;
01125     return TRUE;
01126 }

_CJXLIB_INLINE BOOL CCJToolBar::LoadToolBar | ( | UINT | nIDResource,
 |  | TOOLBARINFO * | pBarInfo = NULL
 | ) |

Definition at line 361 of file CJToolBar.h.

00362     { return LoadToolBar(MAKEINTRESOURCE(nIDResource), pBarInfo); }

BOOL CCJToolBar::LoadToolBar | ( | LPCTSTR | lpszResourceName,
 |  | TOOLBARINFO * | pBarInfo = NULL
 | ) |

Definition at line 1049 of file CJToolBar.cpp.

Referenced by LoadToolBar().

01050 {
01051     ASSERT_VALID(this);
01052     ASSERT(lpszResourceName != NULL);
01053
01054     // determine location of the bitmap in resource fork
01055     HINSTANCE hInst = AfxFindResourceHandle(lpszResourceName, RT_TOOLBAR);
01056     HRSRC hRsrc = ::FindResource(hInst, lpszResourceName, RT_TOOLBAR);
01057     if (hRsrc == NULL)
01058         return FALSE;
01059
01060     HGLOBAL hGlobal = LoadResource(hInst, hRsrc);
01061     if (hGlobal == NULL)
01062         return FALSE;
01063
01064     CToolBarData* pData = (CToolBarData*)LockResource(hGlobal);
01065     if (pData == NULL)
01066         return FALSE;
01067     ASSERT(pData->wVersion == 1);
01068
01069     UINT* pItems = new UINT[pData->wItemCount];
01070     for (int i = 0; i < pData->wItemCount; i++)
01071         pItems[i] = pData->items()[i];
01072     BOOL bResult = SetButtons(pItems, pData->wItemCount);
01073     delete[] pItems;
01074
01075     if (bResult)
01076     {
01077         // set new sizes of the buttons
01078         CSize sizeImage(pData->wWidth, pData->wHeight);
01079         CSize sizeButton(pData->wWidth + 7, pData->wHeight + 7);
01080         SetSizes(sizeButton, sizeImage);
01081
01082         // load bitmap now that sizes are known by the toolbar control
01083         bResult = LoadBitmap(lpszResourceName);
01084     }
01085
01086     UnlockResource(hGlobal);
01087     FreeResource(hGlobal);
01088
01089     // is the toolbar is customizable?
01090     if(( pBarInfo ) && ( bResult )) {
01091         m_pBarInfo = pBarInfo;
01092         m_nButtons = GetToolBarCtrl().GetButtonCount();
01093
01094         // modify the style to include adjustable
01095         ModifyStyle(0, CCS_ADJUSTABLE);
01096         RestoreState();
01097     }
01098
01099
01100     return bResult;
01101 }

_CJXLIB_INLINE BOOL CCJToolBar::MapAccelerator | ( | TCHAR | ch,
 |  | UINT & | nID
 | ) | const

Definition at line 485 of file CJToolBar.h.

Referenced by CCJMenuBar::TranslateFrameMessage().

00486     { ASSERT(::IsWindow(m_hWnd)); return SendMessageC(TB_MAPACCELERATOR, (WPARAM)ch, (LPARAM)&nID); }

void CCJToolBar::OnBarStyleChange | ( | DWORD | dwOldStyle,
 |  | DWORD | dwNewStyle
 | ) | [virtual]

Reimplemented in CCJMenuBar.

Definition at line 1911 of file CJToolBar.cpp.

Referenced by CCJMenuBar::OnBarStyleChange().

01912 {
01913     // a dynamically resizeable toolbar can not have the CBRS_FLOAT_MULTI
01914     ASSERT(!((dwNewStyle & CBRS_SIZE_DYNAMIC) &&
01915         (m_dwDockStyle & CBRS_FLOAT_MULTI)));
01916
01917     // a toolbar can not be both dynamic and fixed in size
01918     ASSERT (!((dwNewStyle & CBRS_SIZE_FIXED) &&
01919         (dwNewStyle & CBRS_SIZE_DYNAMIC)));
01920
01921     // CBRS_SIZE_DYNAMIC can not be disabled once it has been enabled
01922     ASSERT (((dwOldStyle & CBRS_SIZE_DYNAMIC) == 0) ||
01923         ((dwNewStyle & CBRS_SIZE_DYNAMIC) != 0));
01924
01925     if (m_hWnd != NULL &&
01926         ((dwOldStyle & CBRS_BORDER_ANY) != (dwNewStyle & CBRS_BORDER_ANY)))
01927     {
01928         // recalc non-client area when border styles change
01929         SetWindowPos(NULL, 0, 0, 0, 0,
01930             SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DRAWFRAME);
01931     }
01932     m_bDelayedButtonLayout = TRUE;
01933
01934     if (dwOldStyle != dwNewStyle) {
01935         DWORD dwMode = 0;
01936         if ((dwNewStyle & CBRS_SIZE_DYNAMIC) && (dwNewStyle & CBRS_FLOATING))
01937             dwMode = LM_HORZ | LM_MRUWIDTH;
01938         else if (dwNewStyle & CBRS_ORIENT_HORZ)
01939             dwMode = LM_HORZ | LM_HORZDOCK;
01940         else
01941             dwMode =  LM_VERTDOCK;
01942
01943         CalcDynamicLayout(-1, dwMode | LM_COMMIT);
01944     }
01945 }

void CCJToolBar::OnDestroy ( void ) [protected]

Definition at line 899 of file CJToolBar.cpp.

00900 {
00901     // save the current state of the toolbar
00902     SaveState();
00903
00904     CCJToolBarBase::OnDestroy();
00905 }

void CCJToolBar::OnDropDownButton | ( | const NMTOOLBAR & | nmtb,
 |  | UINT | nID,
 |  | CRect | rc
 | ) | [virtual]

Definition at line 649 of file CJToolBar.cpp.

Referenced by OnToolBarBtnDropDown().

00650 {
00651     UNUSED_ALWAYS( nID );
00652
00653     DROPDOWNBUTTON* pb = FindDropDownButton(nmtb.iItem);
00654     if (pb && pb->idMenu) {
00655
00656         // load and display popup menu
00657         CCJMenu menu;
00658         VERIFY(menu.LoadMenu(pb->idMenu));
00659         CCJMenu* pPopup = (CCJMenu*)menu.GetSubMenu(0);
00660         ASSERT(pPopup);
00661         pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL,
00662             rc.left, rc.bottom, GetParentFrame(), &rc);
00663     }
00664 }

BOOL CCJToolBar::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 1872 of file CJToolBar.cpp.

01873 {
01874     return (BOOL)Default();
01875 }

void CCJToolBar::OnNcCalcSize | ( | BOOL | ,
 |  | NCCALCSIZE_PARAMS * | lpncsp
 | ) | [protected]

Definition at line 1885 of file CJToolBar.cpp.

01886 {
01887     // calculate border space (will add to top/bottom, subtract from right/bottom)
01888     CRect rect; rect.SetRectEmpty();
01889     BOOL bHorz = (m_dwStyle & CBRS_ORIENT_HORZ) != 0;
01890     CCJToolBarBase::CalcInsideRect(rect, bHorz);
01891     ASSERT(_ComCtlVersion != -1);
01892     ASSERT(_ComCtlVersion >= VERSION_IE4 || rect.top >= 2);
01893
01894     // adjust non-client area for border space
01895     lpncsp->rgrc[0].left += rect.left;
01896     lpncsp->rgrc[0].top += rect.top;
01897     // previous versions of COMCTL32.DLL had a built-in 2 pixel border
01898     if (_ComCtlVersion < VERSION_IE4)
01899         lpncsp->rgrc[0].top -= 2;
01900     lpncsp->rgrc[0].right += rect.right;
01901     lpncsp->rgrc[0].bottom += rect.bottom;
01902 }

BOOL CCJToolBar::OnNcCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 942 of file CJToolBar.cpp.

00943 {
00944     // If the toolbar is inside a ReBar, we need to make the parent frame
00945     // the owner so it will get notifications.
00946     CWnd* pParent = GetParent();
00947     ASSERT(pParent);
00948     TCHAR classname[64];
00949     GetClassName(pParent->m_hWnd, classname, _countof(classname));
00950     if (_tcscmp(classname, REBARCLASSNAME)==0)
00951     {
00952         CFrameWnd* pFrame = GetParentFrame();
00953         ASSERT_VALID(pFrame);
00954         SetOwner(pFrame);
00955         m_bInReBar = true;
00956         m_bExStyle = false;
00957     }
00958
00959     if (!CCJToolBarBase::OnNcCreate(lpCreateStruct))
00960         return FALSE;
00961
00962     // if the owner was set before the toolbar was created, set it now
00963     if (m_hWndOwner != NULL)
00964         DefWindowProc(TB_SETPARENT, (WPARAM)m_hWndOwner, 0);
00965
00966     DefWindowProc(TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
00967     return TRUE;
00968 }

UINT CCJToolBar::OnNcHitTest ( CPoint ) [protected]

Definition at line 1877 of file CJToolBar.cpp.

01878 {
01879     return HTCLIENT;
01880 }

void CCJToolBar::OnNcPaint ( ) [protected]

Definition at line 1947 of file CJToolBar.cpp.

01948 {
01949     EraseNonClient();
01950 }

void CCJToolBar::OnPaint ( ) [protected]

Reimplemented from CCJToolBarBase.

Definition at line 1961 of file CJToolBar.cpp.

01962 {
01963     if (m_bDelayedButtonLayout)
01964         Layout();
01965
01966     Default();
01967 }

LRESULT CCJToolBar::OnPreserveZeroBorderHelper | ( | WPARAM | ,
 |  | LPARAM | lParam
 | ) | [protected]

Definition at line 2009 of file CJToolBar.cpp.

02010 {
02011     UNUSED_ALWAYS( lParam );
02012
02013     BOOL bModify = FALSE;
02014     ASSERT(_ComCtlVersion != -1);
02015     DWORD dwStyle = 0;
02016     if (_ComCtlVersion >= VERSION_IE4)
02017     {
02018         dwStyle = GetStyle();
02019         bModify = ModifyStyle(0, TBSTYLE_TRANSPARENT|TBSTYLE_FLAT);
02020     }
02021
02022     LRESULT lResult = Default();
02023
02024     if (bModify)
02025         SetWindowLong(m_hWnd, GWL_STYLE, dwStyle);
02026
02027     return lResult;
02028 }

void CCJToolBar::OnRButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 907 of file CJToolBar.cpp.

00908 {
00909     if( m_pBarInfo )
00910     {
00911         CPoint pt( point );
00912         ClientToScreen( &pt );
00913
00914         // load and display popup menu
00915         CCJMenu popupMenu;
00916         VERIFY(popupMenu.CreatePopupMenu( ));
00917         popupMenu.InsertMenu(0, MF_BYPOSITION, IDC_CUSTOMIZE_BAR, _T("&Customize..."));
00918         int nResult = popupMenu.TrackPopupMenu(
00919             TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL|TPM_RETURNCMD,
00920             pt.x, pt.y, this );
00921
00922         if( nResult == IDC_CUSTOMIZE_BAR )
00923         {
00924             // open the customization dialog.
00925             GetToolBarCtrl().Customize();
00926         }
00927     }
00928
00929     else {
00930         CCJToolBarBase::OnRButtonDown(nFlags, point);
00931     }
00932 }

LRESULT CCJToolBar::OnSetBitmapSize | ( | WPARAM | ,
 |  | LPARAM | lParam
 | ) | [protected]

Definition at line 1974 of file CJToolBar.cpp.

01975 {
01976     return OnSetSizeHelper(m_sizeImage, lParam);
01977 }

LRESULT CCJToolBar::OnSetButtonSize | ( | WPARAM | ,
 |  | LPARAM | lParam
 | ) | [protected]

Definition at line 1969 of file CJToolBar.cpp.

01970 {
01971     return OnSetSizeHelper(m_sizeButton, lParam);
01972 }

LRESULT CCJToolBar::OnSetSizeHelper | ( | CSize & | size,
 |  | LPARAM | lParam
 | ) | [protected]

Definition at line 1979 of file CJToolBar.cpp.

Referenced by OnSetBitmapSize(), and OnSetButtonSize().

01980 {
01981     //WINBUG: The IE4 version of COMCTL32.DLL supports a zero border, but
01982     //  only if TBSTYLE_TRANSPARENT is on during the the TB_SETBITMAPSIZE
01983     //  and/or TB_SETBUTTONSIZE messages.  In order to enable this feature
01984     //  all the time (so we get consistent border behavior, dependent only
01985     //  on the version of COMCTL32.DLL) we turn on TBSTYLE_TRANSPARENT
01986     //  whenever these messages go through.  It would be nice that in a
01987     //  future version, the system toolbar would just allow you to set
01988     //  the top and left borders to anything you please.
01989
01990     BOOL bModify = FALSE;
01991     ASSERT(_ComCtlVersion != -1);
01992     DWORD dwStyle = 0;
01993     if (_ComCtlVersion >= VERSION_IE4)
01994     {
01995         dwStyle = GetStyle();
01996         bModify = ModifyStyle(0, TBSTYLE_TRANSPARENT|TBSTYLE_FLAT);
01997     }
01998
01999     LRESULT lResult = Default();
02000     if (lResult)
02001         size = lParam;
02002
02003     if (bModify)
02004         SetWindowLong(m_hWnd, GWL_STYLE, dwStyle);
02005
02006     return lResult;
02007 }

void CCJToolBar::OnSysColorChange ( ) [protected]

Definition at line 2030 of file CJToolBar.cpp.

02031 {
02032     // re-color bitmap for toolbar
02033     if (m_hInstImageWell != NULL && m_hbmImageWell != NULL)
02034     {
02035         HBITMAP hbmNew;
02036         hbmNew = _LoadSysColorBitmap(m_hInstImageWell, m_hRsrcImageWell);
02037         if (hbmNew != NULL)
02038             AddReplaceBitmap(hbmNew);
02039     }
02040 }

void CCJToolBar::OnToolBarBeginAdjust | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 832 of file CJToolBar.cpp.

00833 {
00834     UNUSED_ALWAYS( pNMHDR );
00835     UNUSED_ALWAYS( pResult );
00836 }

void CCJToolBar::OnToolBarBeginDrag | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 817 of file CJToolBar.cpp.

00818 {
00819     UNUSED_ALWAYS( pNMHDR );
00820     UNUSED_ALWAYS( pResult );
00821 }

void CCJToolBar::OnToolBarBtnDropDown | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pRes
 | ) | [protected]

Definition at line 629 of file CJToolBar.cpp.

00630 {
00631     UNUSED_ALWAYS( pRes );
00632
00633     const NMTOOLBAR& nmtb = *(NMTOOLBAR*)pNMHDR;
00634
00635     // get location of button
00636     CRect rc;
00637     GetRect(nmtb.iItem, rc);
00638     ClientToScreen(&rc);
00639
00640     // call virtual function to display dropdown menu
00641     OnDropDownButton(nmtb, nmtb.iItem, rc);
00642 }

void CCJToolBar::OnToolBarChange | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 807 of file CJToolBar.cpp.

00808 {
00809     UNUSED_ALWAYS( pNMHDR );
00810     UNUSED_ALWAYS( pResult );
00811
00812     // force the frame window to recalculate the size
00813     GetParentFrame()->RecalcLayout();
00814 }

void CCJToolBar::OnToolBarCustomHelp | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 840 of file CJToolBar.cpp.

00841 {
00842     UNUSED_ALWAYS( pNMHDR );
00843     UNUSED_ALWAYS( pResult );
00844 }

void CCJToolBar::OnToolBarEndAdjust | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 848 of file CJToolBar.cpp.

00849 {
00850     UNUSED_ALWAYS( pNMHDR );
00851     UNUSED_ALWAYS( pResult );
00852
00853     // save the state of the toolbar for reinitialization
00854     SaveState();
00855 }

void CCJToolBar::OnToolBarEndDrag | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 824 of file CJToolBar.cpp.

00825 {
00826     UNUSED_ALWAYS( pNMHDR );
00827     UNUSED_ALWAYS( pResult );
00828 }

void CCJToolBar::OnToolBarGetButtonInfo | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 859 of file CJToolBar.cpp.

00860 {
00861     UNUSED_ALWAYS( pResult );
00862
00863     TBNOTIFY* tbStruct;     // data needed by customize dialog box
00864
00865     // init the pointer
00866     tbStruct = (TBNOTIFY *)pNMHDR;
00867
00868     // if the index is valid
00869     if (0 <= tbStruct->iItem && tbStruct->iItem < m_nButtons)
00870     {
00871         // copy the stored button structure
00872         tbStruct->tbButton = m_pBarInfo[tbStruct->iItem].tbButton;
00873
00874         // copy the text for the button label in the dialog
00875         _tcscpy( tbStruct->pszText, m_pBarInfo[tbStruct->iItem].btnText );
00876
00877         // indicate valid data was sent
00878         *pResult = TRUE;
00879     }
00880
00881     // else there is no button for this index
00882     else
00883     {
00884         *pResult = FALSE;
00885     }
00886 }

void CCJToolBar::OnToolBarQueryDelete | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 783 of file CJToolBar.cpp.

00784 {
00785     UNUSED_ALWAYS( pNMHDR );
00786
00787     // if we're not floating - user can delete anything
00788     *pResult = !IsFloating();
00789 }

void CCJToolBar::OnToolBarQueryInsert | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 796 of file CJToolBar.cpp.

00797 {
00798     UNUSED_ALWAYS( pNMHDR );
00799
00800     // if we're not floating - user can insert anywhere
00801     *pResult = !IsFloating();
00802 }

void CCJToolBar::OnToolBarReset | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 890 of file CJToolBar.cpp.

00891 {
00892     UNUSED_ALWAYS( pNMHDR );
00893     UNUSED_ALWAYS( pResult );
00894
00895     // restore the toolbar to the way it was before entering customization
00896     RestoreState();
00897 }

int CCJToolBar::OnToolHitTest | ( | CPoint | point,
 |  | TOOLINFO * | pTI
 | ) | const [virtual]

Definition at line 1728 of file CJToolBar.cpp.

01729 {
01730     ASSERT_VALID(this);
01731     ASSERT(::IsWindow(m_hWnd));
01732
01733     // check child windows first by calling CCJToolBarBase
01734     int nHit = CCJToolBarBase::OnToolHitTest(point, pTI);
01735     if (nHit != -1)
01736         return nHit;
01737
01738     // now hit test against CCJToolBar buttons
01739     CCJToolBar* pBar = (CCJToolBar*)this;
01740     int nButtons = (int)pBar->DefWindowProc(TB_BUTTONCOUNT, 0, 0);
01741     for (int i = 0; i < nButtons; i++)
01742     {
01743         CRect rect;
01744         TBBUTTON button;
01745         if (pBar->DefWindowProc(TB_GETITEMRECT, i, (LPARAM)&rect))
01746         {
01747             ++rect.bottom;
01748             ++rect.right;
01749             if (rect.PtInRect(point) &&
01750                 pBar->DefWindowProc(TB_GETBUTTON, i, (LPARAM)&button) &&
01751                 !(button.fsStyle & TBSTYLE_SEP))
01752             {
01753                 int nHit = GetItemID(i);
01754                 if (pTI != NULL && pTI->cbSize >= sizeof(AFX_OLDTOOLINFO))
01755                 {
01756                     pTI->hwnd = m_hWnd;
01757                     pTI->rect = rect;
01758                     pTI->uId = nHit;
01759                     pTI->lpszText = LPSTR_TEXTCALLBACK;
01760                 }
01761                 // found matching rect, return the ID of the button
01762                 return nHit != 0 ? nHit : -1;
01763             }
01764         }
01765     }
01766     return -1;
01767 }

void CCJToolBar::OnUpdateCmdUI | ( | CFrameWnd * | pTarget,
 |  | BOOL | bDisableIfNoHndler
 | ) | [virtual]

Definition at line 2098 of file CJToolBar.cpp.

02099 {
02100     CCJToolCmdUI state;
02101     state.m_pOther = this;
02102
02103     state.m_nIndexMax = (UINT)DefWindowProc(TB_BUTTONCOUNT, 0, 0);
02104     for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax; state.m_nIndex++)
02105     {
02106         // get buttons state
02107         TBBUTTON button;
02108         GetButton(state.m_nIndex, &button);
02109         state.m_nID = button.idCommand;
02110
02111         // ignore separators
02112         if (!(button.fsStyle & TBSTYLE_SEP))
02113         {
02114             // allow reflections
02115             if (CWnd::OnCmdMsg(0,
02116                 MAKELONG((int)CN_UPDATE_COMMAND_UI, WM_COMMAND+WM_REFLECT_BASE),
02117                 &state, NULL))
02118                 continue;
02119
02120             // allow the toolbar itself to have update handlers
02121             if (CWnd::OnCmdMsg(state.m_nID, CN_UPDATE_COMMAND_UI, &state, NULL))
02122                 continue;
02123
02124             // allow the owner to process the update
02125             state.DoUpdate(pTarget, bDisableIfNoHndler);
02126         }
02127     }
02128
02129     // update the dialog controls added to the toolbar
02130     UpdateDialogControls(pTarget, bDisableIfNoHndler);
02131 }

void CCJToolBar::OnWindowPosChanged ( WINDOWPOS * lpwndpos ) [protected]

Definition at line 670 of file CJToolBar.cpp.

00671 {
00672     CCJToolBarBase::OnWindowPosChanged(lpwndpos);
00673     if (!(lpwndpos->flags & SWP_NOMOVE)) {   // if moved:
00674         InvalidateOldPos(m_rcOldPos);        // invalidate area of old position
00675
00676         // Now paint my non-client area at the new location.
00677         // Without this, you will still have a partial display bug (try it!)
00678         SendMessage(WM_NCPAINT);
00679     }
00680 }

void CCJToolBar::OnWindowPosChanging ( LPWINDOWPOS lpwndpos ) [protected]

Reimplemented from CCJToolBarBase.

Definition at line 1952 of file CJToolBar.cpp.

01953 {
01954     // not necessary to invalidate the borders
01955     DWORD dwStyle = m_dwStyle;
01956     m_dwStyle &= ~(CBRS_BORDER_ANY);
01957     CCJToolBarBase::OnWindowPosChanging(lpwndpos);
01958     m_dwStyle = dwStyle;
01959 }

BOOL CCJToolBar::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]

Definition at line 420 of file CJToolBar.cpp.

00421 {
00422     if( !CCJToolBarBase::PreCreateWindow(cs))
00423         return FALSE;
00424
00425     cs.style |= TBSTYLE_TRANSPARENT|TBSTYLE_FLAT;
00426
00427     return TRUE;
00428 }

_CJXLIB_INLINE BOOL CCJToolBar::PressButton | ( | int | nID,
 |  | BOOL | bPress
 | ) |

Definition at line 373 of file CJToolBar.h.

Referenced by CCJMenuBar::TrackPopup().

00374     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_PRESSBUTTON, nID, MAKELPARAM(bPress, 0)); }

void CCJToolBar::RestoreState ( )

Definition at line 768 of file CJToolBar.cpp.

Referenced by LoadToolBar(), and OnToolBarReset().

00769 {
00770     // if there is an associated registry subkey
00771     if (m_strSubKey.GetLength())
00772     {
00773         // restore the toolbar state from the registry
00774         GetToolBarCtrl().RestoreState( m_hKeyRoot, m_strSubKey, m_strValueName );
00775     }
00776 }

void CCJToolBar::SaveState ( )

Definition at line 756 of file CJToolBar.cpp.

Referenced by OnDestroy(), and OnToolBarEndAdjust().

00757 {
00758     // if there is an associated registry subkey
00759     if (m_strSubKey.GetLength())
00760     {
00761         // save the toolbar state to the registry
00762         GetToolBarCtrl().SaveState( m_hKeyRoot, m_strSubKey, m_strValueName );
00763     }
00764 }

_CJXLIB_INLINE LRESULT CCJToolBar::SendMessageC | ( | UINT | m,
 |  | WPARAM | wp = 0,
 |  | LPARAM | lp = 0
 | ) | const

Definition at line 364 of file CJToolBar.h.

Referenced by GetBitmap(), GetBitmapFlags(), GetButtonCount(), GetHotItem(), GetImageList(), GetPadding(), GetRect(), GetRows(), GetState(), GetToolTips(), GetToolbarStyle(), HitTest(), IsButtonChecked(), IsButtonEnabled(), IsButtonHidden(), IsButtonIndeterminate(), IsButtonPressed(), and MapAccelerator().

00365     { ASSERT(::IsWindow(m_hWnd)); return ((CCJToolBar*)this)->SendMessage(m, wp, lp); }

BOOL CCJToolBar::SetBitmap ( HBITMAP hbmImageWell )

Definition at line 1128 of file CJToolBar.cpp.

01129 {
01130     ASSERT_VALID(this);
01131     ASSERT(hbmImageWell != NULL);
01132
01133     // the caller must manage changing system colors
01134     m_hInstImageWell = NULL;
01135     m_hRsrcImageWell = NULL;
01136
01137     // tell common control toolbar about the new bitmap
01138     return AddReplaceBitmap(hbmImageWell);
01139 }

_CJXLIB_INLINE BOOL CCJToolBar::SetBitmapSize ( CSize sz )

Definition at line 427 of file CJToolBar.h.

00428     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETBITMAPSIZE, 0, MAKELPARAM(sz.cx, sz.cy)); }

void CCJToolBar::SetButton | ( | int | nIndex,
 |  | TBBUTTON * | pButton
 | ) |

Definition at line 1252 of file CJToolBar.cpp.

Referenced by CalcLayout(), SetButtonInfo(), SetButtonStyle(), and SetButtonText().

01253 {
01254     // get original button state
01255     TBBUTTON button;
01256     VERIFY(DefWindowProc(TB_GETBUTTON, nIndex, (LPARAM)&button));
01257
01258     // prepare for old/new button comparsion
01259     button.bReserved[0] = 0;
01260     button.bReserved[1] = 0;
01261     // TBSTATE_ENABLED == TBBS_DISABLED so invert it
01262     pButton->fsState ^= TBSTATE_ENABLED;
01263     pButton->bReserved[0] = 0;
01264     pButton->bReserved[1] = 0;
01265
01266     // nothing to do if they are the same
01267     if (memcmp(pButton, &button, sizeof(TBBUTTON)) != 0)
01268     {
01269         // don't redraw everything while setting the button
01270         DWORD dwStyle = GetStyle();
01271         ModifyStyle(WS_VISIBLE, 0);
01272         VERIFY(DefWindowProc(TB_DELETEBUTTON, nIndex, 0));
01273         VERIFY(DefWindowProc(TB_INSERTBUTTON, nIndex, (LPARAM)pButton));
01274         ModifyStyle(0, dwStyle & WS_VISIBLE);
01275
01276         // invalidate appropriate parts
01277         if (((pButton->fsStyle ^ button.fsStyle) & TBSTYLE_SEP) ||
01278             ((pButton->fsStyle & TBSTYLE_SEP) && pButton->iBitmap != button.iBitmap))
01279         {
01280             // changing a separator
01281             Invalidate();
01282         }
01283         else
01284         {
01285             // invalidate just the button
01286             CRect rect;
01287             if (DefWindowProc(TB_GETITEMRECT, nIndex, (LPARAM)&rect))
01288                 InvalidateRect(rect);
01289         }
01290     }
01291 }

void CCJToolBar::SetButtonInfo | ( | int | nIndex,
 |  | UINT | nID,
 |  | UINT | nStyle,
 |  | int | iImage
 | ) |

Definition at line 1709 of file CJToolBar.cpp.

Referenced by InsertControl().

01710 {
01711     ASSERT_VALID(this);
01712
01713     TBBUTTON button;
01714     GetButton(nIndex, &button);
01715     TBBUTTON save;
01716     memcpy(&save, &button, sizeof(save));
01717     button.idCommand = nID;
01718     button.iBitmap = iImage;
01719     button.fsStyle = (BYTE)LOWORD(nStyle);
01720     button.fsState = (BYTE)HIWORD(nStyle);
01721     if (memcmp(&save, &button, sizeof(save)) != 0)
01722     {
01723         SetButton(nIndex, &button);
01724         m_bDelayedButtonLayout = TRUE;
01725     }
01726 }

_CJXLIB_INLINE BOOL CCJToolBar::SetButtonSize ( CSize sz )

Definition at line 424 of file CJToolBar.h.

00425     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETBUTTONSIZE, 0, MAKELPARAM(sz.cx, sz.cy)); }

_CJXLIB_INLINE void CCJToolBar::SetButtonStructSize ( int nSize )

Definition at line 421 of file CJToolBar.h.

00422     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_BUTTONSTRUCTSIZE, nSize); }

void CCJToolBar::SetButtonStyle | ( | int | nIndex,
 |  | UINT | nStyle
 | ) |

Definition at line 1352 of file CJToolBar.cpp.

Referenced by AddDropDownButton(), CCJToolCmdUI::Enable(), and CCJToolCmdUI::SetCheck().

01353 {
01354     ASSERT_VALID(this);
01355     ASSERT(::IsWindow(m_hWnd));
01356
01357     TBBUTTON button;
01358     GetButton(nIndex, &button);
01359     if (button.fsStyle != (BYTE)LOWORD(nStyle) || button.fsState != (BYTE)HIWORD(nStyle))
01360     {
01361         button.fsStyle = (BYTE)LOWORD(nStyle);
01362         button.fsState = (BYTE)HIWORD(nStyle);
01363         SetButton(nIndex, &button);
01364         m_bDelayedButtonLayout = TRUE;
01365     }
01366 }

BOOL CCJToolBar::SetButtonText | ( | int | nIndex,
 |  | LPCTSTR | lpszText
 | ) |

Definition at line 1769 of file CJToolBar.cpp.

01770 {
01771     // attempt to lookup string index in map
01772     int nString = -1;
01773     void* p;
01774     if (m_pStringMap != NULL && m_pStringMap->Lookup(lpszText, p))
01775         nString = (int)p;
01776
01777     // add new string if not already in map
01778     if (nString == -1)
01779     {
01780         // initialize map if necessary
01781         if (m_pStringMap == NULL)
01782             m_pStringMap = new CMapStringToPtr;
01783
01784         // add new string to toolbar list
01785         CString strTemp(lpszText, lstrlen(lpszText)+1);
01786         nString = (int)DefWindowProc(TB_ADDSTRING, 0, (LPARAM)(LPCTSTR)strTemp);
01787         if (nString == -1)
01788             return FALSE;
01789
01790         // cache string away in string map
01791         m_pStringMap->SetAt(lpszText, (void*)nString);
01792         ASSERT(m_pStringMap->Lookup(lpszText, p));
01793     }
01794
01795     // change the toolbar button description
01796     TBBUTTON button;
01797     GetButton(nIndex, &button);
01798     button.iString = nString;
01799     SetButton(nIndex, &button);
01800
01801     return TRUE;
01802 }

BOOL CCJToolBar::SetButtons | ( | const UINT * | lpIDArray,
 |  | int | nIDCount
 | ) |

Definition at line 1178 of file CJToolBar.cpp.

Referenced by LoadToolBar().

01179 {
01180     ASSERT_VALID(this);
01181     ASSERT(nIDCount >= 1);  // must be at least one of them
01182     ASSERT(lpIDArray == NULL ||
01183         AfxIsValidAddress(lpIDArray, sizeof(UINT) * nIDCount, FALSE));
01184
01185     // delete all existing buttons
01186     int nCount = (int)DefWindowProc(TB_BUTTONCOUNT, 0, 0);
01187     while (nCount--)
01188         VERIFY(DefWindowProc(TB_DELETEBUTTON, 0, 0));
01189
01190     TBBUTTON button; memset(&button, 0, sizeof(TBBUTTON));
01191     button.iString = -1;
01192     if (lpIDArray != NULL)
01193     {
01194         // add new buttons to the common control
01195         int iImage = 0;
01196         for (int i = 0; i < nIDCount; i++)
01197         {
01198             button.fsState = TBSTATE_ENABLED;
01199             if ((button.idCommand = *lpIDArray++) == 0)
01200             {
01201                 // separator
01202                 button.fsStyle = TBSTYLE_SEP;
01203                 // width of separator includes 8 pixel overlap
01204                 ASSERT(_ComCtlVersion != -1);
01205                 if ((GetStyle() & TBSTYLE_FLAT) || _ComCtlVersion == VERSION_IE4)
01206                     button.iBitmap = 6;
01207                 else
01208                     button.iBitmap = 8;
01209             }
01210             else
01211             {
01212                 // a command button with image
01213                 button.fsStyle = TBSTYLE_BUTTON;
01214                 button.iBitmap = iImage++;
01215             }
01216             if (!DefWindowProc(TB_ADDBUTTONS, 1, (LPARAM)&button))
01217                 return FALSE;
01218         }
01219     }
01220     else
01221     {
01222         // add 'blank' buttons
01223         button.fsState = TBSTATE_ENABLED;
01224         for (int i = 0; i < nIDCount; i++)
01225         {
01226             ASSERT(button.fsStyle == TBSTYLE_BUTTON);
01227             if (!DefWindowProc(TB_ADDBUTTONS, 1, (LPARAM)&button))
01228                 return FALSE;
01229         }
01230     }
01231     m_nCount = (int)DefWindowProc(TB_BUTTONCOUNT, 0, 0);
01232     m_bDelayedButtonLayout = TRUE;
01233
01234     return TRUE;
01235 }

_CJXLIB_INLINE BOOL CCJToolBar::SetCmdID | ( | int | nIndex,
 |  | UINT | nID
 | ) |

Definition at line 445 of file CJToolBar.h.

00446     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETCMDID, nIndex, nID); }

_CJXLIB_INLINE DWORD CCJToolBar::SetExtendedStyle ( DWORD dwStyle )

Definition at line 464 of file CJToolBar.h.

Referenced by AddDropDownButton().

00465     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETEXTENDEDSTYLE, 0, dwStyle); }

void CCJToolBar::SetHeight ( int cyHeight )

Definition at line 1011 of file CJToolBar.cpp.

01012 {
01013     ASSERT_VALID(this);
01014
01015     int nHeight = cyHeight;
01016     if (m_dwStyle & CBRS_BORDER_TOP)
01017         cyHeight -= afxData.cyBorder2;
01018     if (m_dwStyle & CBRS_BORDER_BOTTOM)
01019         cyHeight -= afxData.cyBorder2;
01020     m_cyBottomBorder = (cyHeight - m_sizeButton.cy) / 2;
01021     // if there is an extra pixel, m_cyTopBorder will get it
01022     m_cyTopBorder = cyHeight - m_sizeButton.cy - m_cyBottomBorder;
01023     if (m_cyTopBorder < 0)
01024     {
01025         TRACE1("Warning: CCJToolBar::SetHeight(%d) is smaller than button.\n",
01026             nHeight);
01027         m_cyBottomBorder += m_cyTopBorder;
01028         m_cyTopBorder = 0;  // will clip at bottom
01029     }
01030
01031     // recalculate the non-client region
01032     SetWindowPos(NULL, 0, 0, 0, 0,
01033         SWP_DRAWFRAME|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOZORDER);
01034     Invalidate();   // just to be nice if called when toolbar is visible
01035 }

_CJXLIB_INLINE void CCJToolBar::SetHotItem ( int iHot )

Definition at line 482 of file CJToolBar.h.

Referenced by CCJMenuBar::OnMouseMove(), CCJMenuBar::SetTrackingState(), and CCJMenuBar::TranslateFrameMessage().

00483     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_SETHOTITEM, iHot); }

_CJXLIB_INLINE HIMAGELIST CCJToolBar::SetImageList ( HIMAGELIST hImgList )

Definition at line 458 of file CJToolBar.h.

Referenced by CCJMenuBar::LoadMenu().

00459     { ASSERT(::IsWindow(m_hWnd)); return (HIMAGELIST)SendMessage(TB_SETIMAGELIST, 0, (LPARAM)hImgList); }

_CJXLIB_INLINE BOOL CCJToolBar::SetIndent ( int indent )

Definition at line 452 of file CJToolBar.h.

00453     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETINDENT, indent); }

void CCJToolBar::SetOwner ( CWnd * pOwnerWnd )

Definition at line 970 of file CJToolBar.cpp.

Referenced by OnNcCreate().

00971 {
00972     ASSERT_VALID(this);
00973     if (m_hWnd != NULL)
00974     {
00975         ASSERT(::IsWindow(m_hWnd));
00976         DefWindowProc(TB_SETPARENT, (WPARAM)pOwnerWnd->GetSafeHwnd(), 0);
00977     }
00978     CCJToolBarBase::SetOwner(pOwnerWnd);
00979 }

_CJXLIB_INLINE CSize CCJToolBar::SetPadding ( CSize sz )

Definition at line 491 of file CJToolBar.h.

00492     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETPADDING, 0, MAKELPARAM(sz.cx,sz.cy)); }

_CJXLIB_INLINE void CCJToolBar::SetRows | ( | int | nRows,
 |  | BOOL | bLarger,
 |  | LPRECT | lpRect
 | ) |

Definition at line 439 of file CJToolBar.h.

00440     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_SETROWS, MAKELPARAM(nRows, bLarger), (LPARAM)lpRect); }

void CCJToolBar::SetSizes | ( | SIZE | sizeButton,
 |  | SIZE | sizeImage
 | ) |

Definition at line 981 of file CJToolBar.cpp.

Referenced by CreateEx(), and LoadToolBar().

00982 {
00983     ASSERT_VALID(this);
00984
00985     // sizes must be non-zero and positive
00986     ASSERT(sizeButton.cx > 0 && sizeButton.cy > 0);
00987     ASSERT(sizeImage.cx > 0 && sizeImage.cy > 0);
00988
00989     // button must be big enough to hold image
00990     //   + 7 pixels on x
00991     //   + 6 pixels on y
00992     ASSERT(sizeButton.cx >= sizeImage.cx + 7);
00993     ASSERT(sizeButton.cy >= sizeImage.cy + 6);
00994
00995     if (::IsWindow(m_hWnd))
00996     {
00997         // set the sizes via TB_SETBITMAPSIZE and TB_SETBUTTONSIZE
00998         VERIFY(SendMessage(TB_SETBITMAPSIZE, 0, MAKELONG(sizeImage.cx, sizeImage.cy)));
00999         VERIFY(SendMessage(TB_SETBUTTONSIZE, 0, MAKELONG(sizeButton.cx, sizeButton.cy)));
01000
01001         Invalidate();   // just to be nice if called when toolbar is visible
01002     }
01003     else
01004     {
01005         // just set our internal values for later
01006         m_sizeButton = sizeButton;
01007         m_sizeImage = sizeImage;
01008     }
01009 }

_CJXLIB_INLINE BOOL CCJToolBar::SetState | ( | int | nID,
 |  | UINT | nState
 | ) |

Definition at line 397 of file CJToolBar.h.

00398     { ASSERT(::IsWindow(m_hWnd)); return SendMessage(TB_SETSTATE, nID, MAKELPARAM(nState, 0)); }

_CJXLIB_INLINE void CCJToolBar::SetToolTips ( CToolTipCtrl * pTip )

Definition at line 436 of file CJToolBar.h.

00437     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_SETTOOLTIPS, (WPARAM)pTip->m_hWnd); }

_CJXLIB_INLINE void CCJToolBar::SetToolbarStyle ( DWORD dwStyle )

Definition at line 473 of file CJToolBar.h.

00474     { ASSERT(::IsWindow(m_hWnd)); SendMessage(TB_SETSTYLE, 0, dwStyle); }

void CCJToolBar::SizeToolBar | ( | TBBUTTON * | pData,
 |  | int | nCount,
 |  | int | nLength,
 |  | BOOL | bVert = FALSE
 | ) | [protected]

Definition at line 1479 of file CJToolBar.cpp.

Referenced by CalcLayout().

01480 {
01481     ASSERT(pData != NULL && nCount > 0);
01482
01483     if (!bVert)
01484     {
01485         int nMin, nMax, nTarget, nCurrent, nMid;
01486
01487         // Wrap ToolBar as specified
01488         nMax = nLength;
01489         nTarget = WrapToolBar(pData, nCount, nMax);
01490
01491         // Wrap ToolBar vertically
01492         nMin = 0;
01493         nCurrent = WrapToolBar(pData, nCount, nMin);
01494
01495         if (nCurrent != nTarget)
01496         {
01497             while (nMin < nMax)
01498             {
01499                 nMid = (nMin + nMax) / 2;
01500                 nCurrent = WrapToolBar(pData, nCount, nMid);
01501
01502                 if (nCurrent == nTarget)
01503                     nMax = nMid;
01504                 else
01505                 {
01506                     if (nMin == nMid)
01507                     {
01508                         WrapToolBar(pData, nCount, nMax);
01509                         break;
01510                     }
01511                     nMin = nMid;
01512                 }
01513             }
01514         }
01515         CSize size = CalcSize(pData, nCount);
01516         WrapToolBar(pData, nCount, size.cx);
01517     }
01518     else
01519     {
01520         CSize sizeMax, sizeMin, sizeMid;
01521
01522         // Wrap ToolBar vertically
01523         WrapToolBar(pData, nCount, 0);
01524         sizeMin = CalcSize(pData, nCount);
01525
01526         // Wrap ToolBar horizontally
01527         WrapToolBar(pData, nCount, 32767);
01528         sizeMax = CalcSize(pData, nCount);
01529
01530         while (sizeMin.cx < sizeMax.cx)
01531         {
01532             sizeMid.cx = (sizeMin.cx + sizeMax.cx) / 2;
01533             WrapToolBar(pData, nCount, sizeMid.cx);
01534             sizeMid = CalcSize(pData, nCount);
01535
01536             if (nLength < sizeMid.cy)
01537             {
01538                 if (sizeMin == sizeMid)
01539                 {
01540                     WrapToolBar(pData, nCount, sizeMax.cx);
01541                     return;
01542                 }
01543                 sizeMin = sizeMid;
01544             }
01545             else if (nLength > sizeMid.cy)
01546                 sizeMax = sizeMid;
01547             else
01548                 return;
01549         }
01550     }
01551 }

int CCJToolBar::WrapToolBar | ( | TBBUTTON * | pData,
 |  | int | nCount,
 |  | int | nWidth
 | ) | [protected]

Definition at line 1410 of file CJToolBar.cpp.

Referenced by SizeToolBar().

01411 {
01412     ASSERT(pData != NULL && nCount > 0);
01413
01414     int nResult = 0;
01415     int x = 0;
01416     for (int i = 0; i < nCount; i++)
01417     {
01418         pData[i].fsState &= ~TBSTATE_WRAP;
01419
01420         if (pData[i].fsState & TBSTATE_HIDDEN)
01421             continue;
01422
01423         int dx, dxNext;
01424
01425         // **PD**
01426         // Load actual size of button into a local variable
01427         // called m_sizeButton. C++ will use this instead of
01428         // CToolBar::m_sizeButton.
01429         //
01430         CSize m_sizeButton = GetButtonSize(pData, i);
01431
01432         dx = m_sizeButton.cx;
01433         dxNext = dx - CX_OVERLAP;
01434
01435         if (x + dx > nWidth)
01436         {
01437             BOOL bFound = FALSE;
01438             for (int j = i; j >= 0  &&  !(pData[j].fsState & TBSTATE_WRAP); j--)
01439             {
01440                 // Find last separator that isn't hidden
01441                 // a separator that has a command ID is not
01442                 // a separator, but a custom control.
01443                 if ((pData[j].fsStyle & TBSTYLE_SEP) &&
01444                     (pData[j].idCommand == 0) &&
01445                     !(pData[j].fsState & TBSTATE_HIDDEN))
01446                 {
01447                     bFound = TRUE; i = j; x = 0;
01448                     pData[j].fsState |= TBSTATE_WRAP;
01449                     nResult++;
01450                     break;
01451                 }
01452             }
01453             if (!bFound)
01454             {
01455                 for (int j = i - 1; j >= 0 && !(pData[j].fsState & TBSTATE_WRAP); j--)
01456                 {
01457                     // Never wrap anything that is hidden,
01458                     // or any custom controls
01459                     if ((pData[j].fsState & TBSTATE_HIDDEN) ||
01460                         ((pData[j].fsStyle & TBSTYLE_SEP) &&
01461                         (pData[j].idCommand != 0)))
01462                         continue;
01463
01464                     bFound = TRUE; i = j; x = 0;
01465                     pData[j].fsState |= TBSTATE_WRAP;
01466                     nResult++;
01467                     break;
01468                 }
01469                 if (!bFound)
01470                     x += dxNext;
01471             }
01472         }
01473         else
01474             x += dxNext;
01475     }
01476     return nResult + 1;
01477 }

Member Data Documentation

BOOL CCJToolBar::m_bDelayedButtonLayout [protected]

Definition at line 125 of file CJToolBar.h.

bool CCJToolBar::m_bShowDropArrow [protected]

Definition at line 121 of file CJToolBar.h.

HINSTANCE CCJToolBar::m_hInstImageWell [protected]

Definition at line 123 of file CJToolBar.h.

HKEY CCJToolBar::m_hKeyRoot [protected]

Definition at line 128 of file CJToolBar.h.

HRSRC CCJToolBar::m_hRsrcImageWell [protected]

Definition at line 122 of file CJToolBar.h.

HBITMAP CCJToolBar::m_hbmImageWell [protected]

Definition at line 124 of file CJToolBar.h.

int CCJToolBar::m_nBarNumber = 0 [static, protected]

Definition at line 298 of file CJToolBar.cpp.

int CCJToolBar::m_nButtons [protected]

Definition at line 127 of file CJToolBar.h.

TOOLBARINFO* CCJToolBar::m_pBarInfo [protected]

Definition at line 119 of file CJToolBar.h.

CObList* CCJToolBar::m_pControls [protected]

Definition at line 120 of file CJToolBar.h.

DROPDOWNBUTTON* CCJToolBar::m_pDropButtons [protected]

Definition at line 134 of file CJToolBar.h.

CMapStringToPtr* CCJToolBar::m_pStringMap [protected]

Definition at line 135 of file CJToolBar.h.

CRect CCJToolBar::m_rcOldPos [protected]

Definition at line 126 of file CJToolBar.h.

CSize CCJToolBar::m_sizeButton [protected]

Definition at line 133 of file CJToolBar.h.

CSize CCJToolBar::m_sizeImage [protected]

Definition at line 132 of file CJToolBar.h.

CString CCJToolBar::m_strSubKey [protected]

Definition at line 129 of file CJToolBar.h.

CString CCJToolBar::m_strValueName [protected]

Definition at line 130 of file CJToolBar.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJToolBar.h
  • WinCvs/CJLib/CJLibrary/CJToolBar.cpp
Generated on Sun Oct 21 12:46:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJToolBarBase Class Reference

#include <CJToolBarBase.h>

Inheritance diagram for CCJToolBarBase:

[legend]
Collaboration diagram for CCJToolBarBase:

[legend]
List of all members.

Public Methods

virtual | ~CCJToolBarBase ()
virtual void | DoPaint (CDC *pDC)
void | DrawGripper (CDC *pDC, const CRect &rect)
virtual LRESULT | WindowProc (UINT nMsg, WPARAM wParam, LPARAM lParam)
void | CalcInsideRect (CRect &rect, BOOL bHorz) const
void | EraseNonClient ()
void | DrawBorders (CDC *pDC, CRect &rect)
afx_msg void | OnPaint ()
afx_msg void | OnWindowPosChanging (LPWINDOWPOS lpWndPos)

Public Attributes

bool | m_bInReBar
bool | m_bExStyle

Protected Methods

CCJToolBarBase ()
void | SetBorders (LPCRECT lpRect)
void | SetBorders (int cxLeft=0, int cyTop=0, int cxRight=0, int cyBottom=0)
CRect | GetBorders () const

Constructor & Destructor Documentation

CCJToolBarBase::CCJToolBarBase ( ) [protected]

Definition at line 56 of file CJToolBarBase.cpp.

00057 {
00058     m_bInReBar = false;
00059     m_bExStyle = false;
00060 }

CCJToolBarBase::~CCJToolBarBase ( ) [virtual]

Definition at line 62 of file CJToolBarBase.cpp.

00063 {
00064
00065 }

Member Function Documentation

void CCJToolBarBase::CalcInsideRect | ( | CRect & | rect,
 |  | BOOL | bHorz
 | ) | const

Definition at line 413 of file CJToolBarBase.cpp.

Referenced by CCJReBar::CalcFixedLayout(), CCJToolBar::CalcLayout(), CCJToolBar::OnNcCalcSize(), and CCJReBar::OnNcCalcSize().

00414 {
00415     ASSERT_VALID(this);
00416     DWORD dwStyle = m_dwStyle;
00417
00418     if (dwStyle & CBRS_BORDER_LEFT)
00419         rect.left += afxData.cxBorder2;
00420     if (dwStyle & CBRS_BORDER_TOP)
00421         rect.top += afxData.cyBorder2;
00422     if (dwStyle & CBRS_BORDER_RIGHT)
00423         rect.right -= afxData.cxBorder2;
00424     if (dwStyle & CBRS_BORDER_BOTTOM)
00425         rect.bottom -= afxData.cyBorder2;
00426
00427     // inset the top and bottom.
00428     if (bHorz)
00429     {
00430         rect.left += m_cxLeftBorder;
00431         rect.top += m_cyTopBorder;
00432         rect.right -= m_cxRightBorder;
00433         rect.bottom -= m_cyBottomBorder;
00434         if ((m_dwStyle & (CBRS_GRIPPER|CBRS_FLOATING)) == CBRS_GRIPPER)
00435         {
00436             rect.left += CX_BORDER_GRIPPER+CX_GRIPPER+CX_BORDER_GRIPPER;
00437
00438             if( m_bExStyle == true ) {
00439                 rect.left += CX_GRIPPER;
00440             }
00441
00442             if(( m_bExStyle == false ) && ( m_bInReBar == false )) {
00443                 rect.left -= CX_BORDER_GRIPPER+CX_GRIPPER;
00444             }
00445         }
00446     }
00447     else
00448     {
00449         rect.left += m_cyTopBorder;
00450         rect.top += m_cxLeftBorder;
00451         rect.right -= m_cyBottomBorder;
00452         rect.bottom -= m_cxRightBorder;
00453         if ((m_dwStyle & (CBRS_GRIPPER|CBRS_FLOATING)) == CBRS_GRIPPER)
00454         {
00455             rect.top += CY_BORDER_GRIPPER+CY_GRIPPER+CY_BORDER_GRIPPER;
00456
00457             if( m_bExStyle == true ) {
00458                 rect.top += CY_GRIPPER;
00459             }
00460
00461             if(( m_bExStyle == false ) && ( m_bInReBar == false )) {
00462                 rect.top -= CY_BORDER_GRIPPER+CY_GRIPPER;
00463             }
00464         }
00465     }
00466 }

void CCJToolBarBase::DoPaint ( CDC * pDC ) [virtual]

Definition at line 206 of file CJToolBarBase.cpp.

Referenced by OnPaint().

00207 {
00208     ASSERT_VALID(this);
00209     ASSERT_VALID(pDC);
00210
00211     // paint inside client area
00212     CRect rect;
00213     GetClientRect(rect);
00214     DrawBorders(pDC, rect);
00215     DrawGripper(pDC, rect);
00216 }

void CCJToolBarBase::DrawBorders | ( | CDC * | pDC,
 |  | CRect & | rect
 | ) |

Definition at line 218 of file CJToolBarBase.cpp.

Referenced by DoPaint(), and EraseNonClient().

00219 {
00220     ASSERT_VALID(this);
00221     ASSERT_VALID(pDC);
00222
00223     DWORD dwStyle = m_dwStyle;
00224     if (!(dwStyle & CBRS_BORDER_ANY))
00225         return;
00226
00227     // prepare for dark lines
00228     ASSERT(rect.top == 0 && rect.left == 0);
00229     if(m_bInReBar)
00230     {
00231         CRect rect1, rect2;
00232         rect1 = rect;
00233         rect2 = rect;
00234         COLORREF clr = afxData.bWin4 ? afxData.clrBtnShadow : afxData.clrWindowFrame;
00235
00236         // draw dark line one pixel back/up
00237         if (dwStyle & CBRS_BORDER_3D)
00238         {
00239             rect1.right -= CX_BORDER;
00240             rect1.bottom -= CY_BORDER;
00241         }
00242         if (dwStyle & CBRS_BORDER_TOP)
00243             rect2.top += afxData.cyBorder2;
00244         if (dwStyle & CBRS_BORDER_BOTTOM)
00245             rect2.bottom -= afxData.cyBorder2;
00246
00247         // draw left and top
00248         if (dwStyle & CBRS_BORDER_LEFT)
00249             pDC->FillSolidRect(0, rect2.top, CX_BORDER, rect2.Height(), clr);
00250         if (dwStyle & CBRS_BORDER_TOP)
00251             pDC->FillSolidRect(0, 0, rect.right, CY_BORDER, clr);
00252
00253         // draw right and bottom
00254         if (dwStyle & CBRS_BORDER_RIGHT)
00255             pDC->FillSolidRect(rect1.right, rect2.top, -CX_BORDER, rect2.Height(), clr);
00256         if (dwStyle & CBRS_BORDER_BOTTOM)
00257             pDC->FillSolidRect(0, rect1.bottom, rect.right, -CY_BORDER, clr);
00258
00259         if (dwStyle & CBRS_BORDER_3D)
00260         {
00261             // prepare for hilite lines
00262             clr = afxData.clrBtnHilite;
00263
00264             // draw left and top
00265             if (dwStyle & CBRS_BORDER_LEFT)
00266                 pDC->FillSolidRect(1, rect2.top, CX_BORDER, rect2.Height(), clr);
00267             if (dwStyle & CBRS_BORDER_TOP)
00268                 pDC->FillSolidRect(0, 1, rect.right, CY_BORDER, clr);
00269
00270             // draw right and bottom
00271             if (dwStyle & CBRS_BORDER_RIGHT)
00272                 pDC->FillSolidRect(rect.right, rect2.top, -CX_BORDER, rect2.Height(), clr);
00273             if (dwStyle & CBRS_BORDER_BOTTOM)
00274                 pDC->FillSolidRect(0, rect.bottom, rect.right, -CY_BORDER, clr);
00275         }
00276
00277         if (dwStyle & CBRS_BORDER_LEFT)
00278             rect.left += afxData.cxBorder2;
00279         if (dwStyle & CBRS_BORDER_TOP)
00280             rect.top += afxData.cyBorder2;
00281         if (dwStyle & CBRS_BORDER_RIGHT)
00282             rect.right -= afxData.cxBorder2;
00283         if (dwStyle & CBRS_BORDER_BOTTOM)
00284             rect.bottom -= afxData.cyBorder2;
00285     }
00286     else
00287     {
00288         if(dwStyle & CBRS_BORDER_RIGHT) {
00289             pDC->FillSolidRect(rect.right-1, 0, rect.right, rect.bottom, afxData.clrBtnShadow);
00290             rect.right--;
00291         }
00292         if(dwStyle & CBRS_BORDER_BOTTOM) {
00293             pDC->FillSolidRect(0, rect.bottom-1, rect.right, rect.bottom, afxData.clrBtnShadow);
00294             rect.bottom--;
00295         }
00296         if(dwStyle & CBRS_BORDER_TOP) {
00297             pDC->FillSolidRect(0, 0, rect.right, 1, afxData.clrBtnHilite);
00298             rect.top++;
00299         }
00300         if(dwStyle & CBRS_BORDER_LEFT) {
00301             pDC->FillSolidRect(0, 0, 1, rect.bottom, afxData.clrBtnHilite);
00302             rect.left++;
00303         }
00304     }
00305 }

void CCJToolBarBase::DrawGripper | ( | CDC * | pDC,
 |  | const CRect & | rect
 | ) |

Definition at line 312 of file CJToolBarBase.cpp.

Referenced by DoPaint(), and EraseNonClient().

00313 {
00314     // if we are floating return.
00315     if( m_dwStyle & CBRS_FLOATING ) {
00316         return;
00317     }
00318
00319     // if we are to draw the extended "office" style gripper.
00320     if(( m_dwStyle & CBRS_GRIPPER ) && ( m_bExStyle == true ))
00321     {
00322         // draw the gripper in the border
00323         if (m_dwStyle & CBRS_ORIENT_HORZ)
00324         {
00325             // Draw the first gripper.
00326             pDC->Draw3dRect( rect.left+3, rect.top+2, 3, rect.Height()-4,
00327                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00328
00329             pDC->SetPixel( rect.left+3, rect.top+2+rect.Height()-5,
00330                 afxData.clrBtnHilite);
00331
00332             // Draw the second gripper.
00333             pDC->Draw3dRect( rect.left+6, rect.top+2, 3, rect.Height()-4,
00334                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00335
00336             pDC->SetPixel( rect.left+6, rect.top+2+rect.Height()-5,
00337                 afxData.clrBtnHilite);
00338         }
00339         else
00340         {
00341             // Draw the first gripper.
00342             pDC->Draw3dRect( rect.left+2, rect.top+3, rect.Width()-4, 3,
00343                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00344
00345             pDC->SetPixel( rect.left+2+rect.Width()-5, rect.top+3,
00346                 afxData.clrBtnHilite);
00347
00348             // Draw the second gripper.
00349             pDC->Draw3dRect( rect.left+2, rect.top+6, rect.Width()-4, 3,
00350                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00351
00352             pDC->SetPixel( rect.left+2+rect.Width()-5, rect.top+6,
00353                 afxData.clrBtnHilite);
00354         }
00355
00356         GdiFlush();
00357     }
00358
00359     // if we are to draw the "ReBar" style gripper.
00360     else
00361     if(( m_dwStyle & CBRS_GRIPPER ) && ( m_bInReBar == true ))
00362     {
00363         // draw the gripper in the border
00364         if (m_dwStyle & CBRS_ORIENT_HORZ)
00365         {
00366             // Draw the first gripper.
00367             pDC->Draw3dRect( rect.left+CX_BORDER_GRIPPER, rect.top+m_cyTopBorder,
00368                 CX_GRIPPER, rect.Height()-m_cyTopBorder-m_cyBottomBorder,
00369                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00370         }
00371         else
00372         {
00373             // Draw the first gripper.
00374             pDC->Draw3dRect( rect.left+m_cyTopBorder, rect.top+CY_BORDER_GRIPPER,
00375                 rect.Width()-m_cyTopBorder-m_cyBottomBorder, CY_GRIPPER,
00376                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00377         }
00378
00379         GdiFlush();
00380     }
00381
00382     // by default, we will draw the "visual studio" style gripper.
00383     else
00384     if( m_dwStyle & CBRS_GRIPPER )
00385     {
00386         // draw the gripper in the border
00387         if (m_dwStyle & CBRS_ORIENT_HORZ)
00388         {
00389             // Draw the first gripper.
00390             pDC->Draw3dRect( rect.left+1, rect.top+2, 3, rect.Height()-4,
00391                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00392
00393             // Draw the second gripper.
00394             pDC->Draw3dRect( rect.left+5, rect.top+2, 3, rect.Height()-4,
00395                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00396         }
00397         else
00398         {
00399             // Draw the first gripper.
00400             pDC->Draw3dRect( rect.left+2, rect.top+1, rect.Width()-4, 3,
00401                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00402
00403             // Draw the second gripper.
00404             pDC->Draw3dRect( rect.left+2, rect.top+5, rect.Width()-4, 3,
00405                 afxData.clrBtnHilite, afxData.clrBtnShadow);
00406         }
00407
00408         GdiFlush();
00409     }
00410 }

void CCJToolBarBase::EraseNonClient ( )

Definition at line 182 of file CJToolBarBase.cpp.

Referenced by CCJToolBar::OnNcPaint(), and CCJReBar::OnNcPaint().

00183 {
00184     // get window DC that is clipped to the non-client area
00185     CWindowDC dc(this);
00186     CRect rectClient;
00187     GetClientRect(rectClient);
00188     CRect rectWindow;
00189     GetWindowRect(rectWindow);
00190     ScreenToClient(rectWindow);
00191     rectClient.OffsetRect(-rectWindow.left, -rectWindow.top);
00192     dc.ExcludeClipRect(rectClient);
00193
00194     // draw borders in non-client area
00195     rectWindow.OffsetRect(-rectWindow.left, -rectWindow.top);
00196     DrawBorders(&dc, rectWindow);
00197
00198     // erase parts not drawn
00199     dc.IntersectClipRect(rectWindow);
00200     SendMessage(WM_ERASEBKGND, (WPARAM)dc.m_hDC);
00201
00202     // draw gripper in non-client area
00203     DrawGripper(&dc, rectWindow);
00204 }

CRect CCJToolBarBase::GetBorders ( ) const [protected]

void CCJToolBarBase::OnPaint ( )

Reimplemented in CCJReBar, and CCJToolBar.

Definition at line 172 of file CJToolBarBase.cpp.

00173 {
00174     // background is already filled in gray
00175     CPaintDC dc(this);
00176
00177     // erase background now
00178     if (IsVisible())
00179         DoPaint(&dc);       // delegate to paint helper
00180 }

void CCJToolBarBase::OnWindowPosChanging ( LPWINDOWPOS lpwndpos )

Reimplemented in CCJToolBar.

Definition at line 135 of file CJToolBarBase.cpp.

Referenced by CCJToolBar::OnWindowPosChanging().

00136 {
00137     // WINBUG: We call DefWindowProc here instead of CWnd::OnWindowPosChanging
00138     //  (which calls CWnd::Default, which calls through the super wndproc)
00139     //  because certain control bars that are system implemented (such as
00140     //  CToolBar with TBSTYLE_FLAT) do not implement WM_WINDOWPOSCHANGING
00141     //  correctly, causing repaint problems.  This code bypasses that whole
00142     //  mess.
00143     ::DefWindowProc(m_hWnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)lpWndPos);
00144
00145     if (lpWndPos->flags & SWP_NOSIZE)
00146         return;
00147
00148     // invalidate borders on the right
00149     CRect rect;
00150     GetWindowRect(&rect);
00151     CSize sizePrev = rect.Size();
00152     int cx = lpWndPos->cx;
00153     int cy = lpWndPos->cy;
00154     if (cx != sizePrev.cx && (m_dwStyle & CBRS_BORDER_RIGHT))
00155     {
00156         rect.SetRect(cx-afxData.cxBorder2, 0, cx, cy);
00157         InvalidateRect(&rect);
00158         rect.SetRect(sizePrev.cx-afxData.cxBorder2, 0, sizePrev.cx, cy);
00159         InvalidateRect(&rect);
00160     }
00161
00162     // invalidate borders on the bottom
00163     if (cy != sizePrev.cy && (m_dwStyle & CBRS_BORDER_BOTTOM))
00164     {
00165         rect.SetRect(0, cy-afxData.cyBorder2, cx, cy);
00166         InvalidateRect(&rect);
00167         rect.SetRect(0, sizePrev.cy-afxData.cyBorder2, cx, sizePrev.cy);
00168         InvalidateRect(&rect);
00169     }
00170 }

void CCJToolBarBase::SetBorders | ( | int | cxLeft = 0,
 |  | int | cyTop = 0,
 |  | int | cxRight = 0,
 |  | int | cyBottom = 0
 | ) | [protected]

Definition at line 74 of file CJToolBarBase.cpp.

00075 {
00076     ASSERT(cxLeft >= 0);
00077     ASSERT(cyTop >= 0);
00078     ASSERT(cxRight >= 0);
00079     ASSERT(cyBottom >= 0);
00080
00081     m_cxLeftBorder = cxLeft;
00082     m_cyTopBorder = cyTop;
00083     m_cxRightBorder = cxRight;
00084     m_cyBottomBorder = cyBottom;
00085 }

_CJXLIB_INLINE void CCJToolBarBase::SetBorders ( LPCRECT lpRect ) [protected]

Definition at line 113 of file CJToolBarBase.h.

Referenced by CCJToolBar::CreateEx().

00114     { SetBorders(lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); }

LRESULT CCJToolBarBase::WindowProc | ( | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) | [virtual]

Reimplemented in CCJReBar.

Definition at line 87 of file CJToolBarBase.cpp.

Referenced by CCJReBar::WindowProc().

00088 {
00089     ASSERT_VALID(this);
00090
00091     LRESULT lResult;
00092     switch (nMsg)
00093     {
00094     case WM_NOTIFY:
00095     case WM_COMMAND:
00096     case WM_DRAWITEM:
00097     case WM_MEASUREITEM:
00098     case WM_DELETEITEM:
00099     case WM_COMPAREITEM:
00100     case WM_VKEYTOITEM:
00101     case WM_CHARTOITEM:
00102         // send these messages to the owner if not handled
00103         if (OnWndMsg(nMsg, wParam, lParam, &lResult))
00104             return lResult;
00105         else
00106         {
00107             // try owner next
00108             lResult = GetOwner()->SendMessage(nMsg, wParam, lParam);
00109
00110             // special case for TTN_NEEDTEXTA and TTN_NEEDTEXTW
00111             if(nMsg == WM_NOTIFY)
00112             {
00113                 NMHDR* pNMHDR = (NMHDR*)lParam;
00114                 if (pNMHDR->code == TTN_NEEDTEXTA || pNMHDR->code == TTN_NEEDTEXTW)
00115                 {
00116                     TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
00117                     TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
00118                     if ((pNMHDR->code == TTN_NEEDTEXTA && (!pTTTA->lpszText || !*pTTTA->lpszText)) ||
00119                         (pNMHDR->code == TTN_NEEDTEXTW && (!pTTTW->lpszText || !*pTTTW->lpszText)))
00120                     {
00121                         // not handled by owner, so let bar itself handle it
00122                         lResult = CWnd::WindowProc(nMsg, wParam, lParam);
00123                     }
00124                 }
00125             }
00126             return lResult;
00127         }
00128     }
00129
00130     // otherwise, just handle in default way
00131     lResult = CWnd::WindowProc(nMsg, wParam, lParam);
00132     return lResult;
00133 }

Member Data Documentation

bool CCJToolBarBase::m_bExStyle

Definition at line 90 of file CJToolBarBase.h.

bool CCJToolBarBase::m_bInReBar

Definition at line 89 of file CJToolBarBase.h.

Referenced by CCJReBar::_AddBar().

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJToolBarBase.h
  • WinCvs/CJLib/CJLibrary/CJToolBarBase.cpp
Generated on Sun Oct 21 12:46:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJToolBarCtrl Class Reference

#include <CJToolBarCtrl.h>

Inheritance diagram for CCJToolBarCtrl:

[legend]
Collaboration diagram for CCJToolBarCtrl:

[legend]
List of all members.

Public Methods

CCJToolBarCtrl ()
BOOL | Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
DWORD | GetButtonSize () const
CImageList * | GetDisabledImageList () const
CImageList * | GetHotImageList () const
CImageList * | GetImageList () const
DWORD | GetStyle () const
int | GetMaxTextRows () const
BOOL | IsButtonHighlighted (int nID) const
BOOL | SetButtonWidth (int cxMin, int cxMax)
CImageList * | SetDisabledImageList (CImageList *pImageList)
CImageList * | SetHotImageList (CImageList *pImageList)
CImageList * | SetImageList (CImageList *pImageList)
HRESULT | GetDropTarget (IDropTarget **ppDropTarget) const
BOOL | SetIndent (int iIndent)
BOOL | SetMaxTextRows (int iMaxRows)
void | SetStyle (DWORD dwStyle)
BOOL | GetButtonInfo (int nID, TBBUTTONINFO *ptbbi) const
BOOL | SetButtonInfo (int nID, TBBUTTONINFO *ptbbi)
DWORD | SetDrawTextFlags (DWORD dwMask, DWORD dwDTFlags)
BOOL | GetAnchorHighlight () const
BOOL | SetAnchorHighlight (BOOL fAnchor=TRUE)
int | GetHotItem () const
int | SetHotItem (int nHot)
void | GetInsertMark (TBINSERTMARK *ptbim) const
void | SetInsertMark (TBINSERTMARK *ptbim)
BOOL | GetMaxSize (LPSIZE pSize) const
BOOL | InsertMarkHitTest (LPPOINT ppt, LPTBINSERTMARK ptbim) const
DWORD | GetExtendedStyle () const
DWORD | SetExtendedStyle (DWORD dwExStyle)
COLORREF | GetInsertMarkColor () const
COLORREF | SetInsertMarkColor (COLORREF clrNew)
BOOL | MapAccelerator (TCHAR chAccel, UINT *pIDBtn)
BOOL | MarkButton (int nID, BOOL bHighlight=TRUE)
BOOL | MoveButton (UINT nOldPos, UINT nNewPos)
int | HitTest (LPPOINT ppt) const
virtual | ~CCJToolBarCtrl ()

Protected Methods

afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)

Constructor & Destructor Documentation

CCJToolBarCtrl::CCJToolBarCtrl ( )

Definition at line 71 of file CJToolBarCtrl.cpp.

00072 {
00073   // initialize common controls
00074   INITCOMMONCONTROLSEX icex;
00075   icex.dwSize = sizeof(icex);
00076   icex.dwICC = ICC_BAR_CLASSES;
00077   VERIFY(InitCommonControlsEx(&icex));
00078 }

CCJToolBarCtrl::~CCJToolBarCtrl ( ) [virtual]

Definition at line 56 of file CJToolBarCtrl.cpp.

00057 {
00058   DestroyWindow();
00059 }

Member Function Documentation

BOOL CCJToolBarCtrl::Create | ( | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID
 | ) |

Definition at line 80 of file CJToolBarCtrl.cpp.

00082 {
00083   CWnd* pWnd = this;
00084   BOOL bCreated = pWnd->Create(TOOLBARCLASSNAME, NULL, dwStyle, rect, pParentWnd, nID);
00085
00086   return bCreated;
00087 }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::GetAnchorHighlight ( ) const

Definition at line 179 of file CJToolBarCtrl.h.

00180     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_GETANCHORHIGHLIGHT, 0, 0); }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::GetButtonInfo | ( | int | nID,
 |  | TBBUTTONINFO * | ptbbi
 | ) | const

Definition at line 170 of file CJToolBarCtrl.h.

00171     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_GETBUTTONINFO, nID, (LPARAM)ptbbi); }

_CJXLIB_INLINE DWORD CCJToolBarCtrl::GetButtonSize ( ) const

Definition at line 128 of file CJToolBarCtrl.h.

00129     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, TB_GETBUTTONSIZE, 0, 0L); }

_CJXLIB_INLINE CImageList * CCJToolBarCtrl::GetDisabledImageList ( ) const

Definition at line 131 of file CJToolBarCtrl.h.

00132     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_GETDISABLEDIMAGELIST, 0, 0)); }

HRESULT CCJToolBarCtrl::GetDropTarget ( IDropTarget ** ppDropTarget ) const

Definition at line 97 of file CJToolBarCtrl.cpp.

00098 {
00099   ASSERT(::IsWindow(m_hWnd));
00100   ASSERT(ppDropTarget);
00101   return (HRESULT) ::SendMessage(m_hWnd, TB_GETOBJECT, (WPARAM)&IID_IDropTarget, (LPARAM)ppDropTarget);
00102 }

_CJXLIB_INLINE DWORD CCJToolBarCtrl::GetExtendedStyle ( ) const

Definition at line 203 of file CJToolBarCtrl.h.

00204     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, TB_GETEXTENDEDSTYLE, 0, 0L); }

_CJXLIB_INLINE CImageList * CCJToolBarCtrl::GetHotImageList ( ) const

Definition at line 134 of file CJToolBarCtrl.h.

00135     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_GETHOTIMAGELIST, 0, 0)); }

_CJXLIB_INLINE int CCJToolBarCtrl::GetHotItem ( ) const

Definition at line 185 of file CJToolBarCtrl.h.

00186     { ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, TB_GETHOTITEM, 0, 0); }

_CJXLIB_INLINE CImageList * CCJToolBarCtrl::GetImageList ( ) const

Definition at line 137 of file CJToolBarCtrl.h.

00138     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_GETIMAGELIST, 0, 0)); }

_CJXLIB_INLINE void CCJToolBarCtrl::GetInsertMark ( TBINSERTMARK * ptbim ) const

Definition at line 191 of file CJToolBarCtrl.h.

00192     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, TB_GETINSERTMARK, 0, (LPARAM)ptbim); }

_CJXLIB_INLINE COLORREF CCJToolBarCtrl::GetInsertMarkColor ( ) const

Definition at line 209 of file CJToolBarCtrl.h.

00210     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, TB_GETINSERTMARKCOLOR, 0, 0); }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::GetMaxSize ( LPSIZE pSize ) const

Definition at line 197 of file CJToolBarCtrl.h.

00198     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_GETMAXSIZE, 0, (LPARAM)pSize); }

_CJXLIB_INLINE int CCJToolBarCtrl::GetMaxTextRows ( ) const

Definition at line 143 of file CJToolBarCtrl.h.

00144     { ASSERT(::IsWindow(m_hWnd)); return (INT) ::SendMessage(m_hWnd, TB_GETTEXTROWS, 0, 0L); }

_CJXLIB_INLINE DWORD CCJToolBarCtrl::GetStyle ( ) const

Definition at line 140 of file CJToolBarCtrl.h.

00141     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, TB_GETSTYLE, 0, 0L); }

_CJXLIB_INLINE int CCJToolBarCtrl::HitTest ( LPPOINT ppt ) const

Definition at line 224 of file CJToolBarCtrl.h.

00225     { ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, TB_HITTEST, 0, (LPARAM)ppt); }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::InsertMarkHitTest | ( | LPPOINT | ppt,
 |  | LPTBINSERTMARK | ptbim
 | ) | const

Definition at line 200 of file CJToolBarCtrl.h.

00201     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)ppt, (LPARAM)ptbim); }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::IsButtonHighlighted ( int nID ) const

Definition at line 146 of file CJToolBarCtrl.h.

00147     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_ISBUTTONHIGHLIGHTED, nID, 0); }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::MapAccelerator | ( | TCHAR | chAccel,
 |  | UINT * | pIDBtn
 | ) |

Definition at line 215 of file CJToolBarCtrl.h.

00216     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_MAPACCELERATOR, (WPARAM)chAccel, (LPARAM)pIDBtn); }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::MarkButton | ( | int | nID,
 |  | BOOL | bHighlight = TRUE
 | ) |

Definition at line 218 of file CJToolBarCtrl.h.

00219     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_MARKBUTTON, nID, MAKELPARAM(bHighlight, 0)); }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::MoveButton | ( | UINT | nOldPos,
 |  | UINT | nNewPos
 | ) |

Definition at line 221 of file CJToolBarCtrl.h.

00222     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_MOVEBUTTON, nOldPos, nNewPos); }

int CCJToolBarCtrl::OnCreate ( LPCREATESTRUCT lpcs ) [protected]

Definition at line 89 of file CJToolBarCtrl.cpp.

00090 {
00091   if (CWnd::OnCreate(lpcs) == -1)
00092     return -1;
00093   SetButtonStructSize(sizeof(TBBUTTON));
00094   return 0;
00095 }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::SetAnchorHighlight ( BOOL fAnchor = TRUE )

Definition at line 182 of file CJToolBarCtrl.h.

00183     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_SETANCHORHIGHLIGHT, fAnchor, 0); }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::SetButtonInfo | ( | int | nID,
 |  | TBBUTTONINFO * | ptbbi
 | ) |

Definition at line 173 of file CJToolBarCtrl.h.

00174     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)ptbbi); }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::SetButtonWidth | ( | int | cxMin,
 |  | int | cxMax
 | ) |

Definition at line 149 of file CJToolBarCtrl.h.

00150     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_SETBUTTONWIDTH, 0, MAKELPARAM(cxMin, cxMax)); }

_CJXLIB_INLINE CImageList * CCJToolBarCtrl::SetDisabledImageList ( CImageList * pImageList )

Definition at line 152 of file CJToolBarCtrl.h.

00153     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)pImageList->GetSafeHandle())); }

_CJXLIB_INLINE DWORD CCJToolBarCtrl::SetDrawTextFlags | ( | DWORD | dwMask,
 |  | DWORD | dwDTFlags
 | ) |

Definition at line 176 of file CJToolBarCtrl.h.

00177     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, TB_SETDRAWTEXTFLAGS, dwMask, dwDTFlags); }

_CJXLIB_INLINE DWORD CCJToolBarCtrl::SetExtendedStyle ( DWORD dwExStyle )

Definition at line 206 of file CJToolBarCtrl.h.

00207     { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, TB_SETEXTENDEDSTYLE, 0, dwExStyle); }

_CJXLIB_INLINE CImageList * CCJToolBarCtrl::SetHotImageList ( CImageList * pImageList )

Definition at line 155 of file CJToolBarCtrl.h.

00156     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_SETHOTIMAGELIST, 0, (LPARAM)pImageList->GetSafeHandle())); }

_CJXLIB_INLINE int CCJToolBarCtrl::SetHotItem ( int nHot )

Definition at line 188 of file CJToolBarCtrl.h.

00189     { ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, TB_SETHOTITEM, nHot, 0); }

_CJXLIB_INLINE CImageList * CCJToolBarCtrl::SetImageList ( CImageList * pImageList )

Definition at line 158 of file CJToolBarCtrl.h.

00159     { ASSERT(::IsWindow(m_hWnd)); return CImageList::FromHandle((HIMAGELIST) ::SendMessage(m_hWnd, TB_SETIMAGELIST, 0, (LPARAM)pImageList->GetSafeHandle())); }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::SetIndent ( int iIndent )

Definition at line 161 of file CJToolBarCtrl.h.

00162     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_SETINDENT, iIndent, 0L); }

_CJXLIB_INLINE void CCJToolBarCtrl::SetInsertMark ( TBINSERTMARK * ptbim )

Definition at line 194 of file CJToolBarCtrl.h.

00195     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, TB_SETINSERTMARK, 0, (LPARAM)ptbim); }

_CJXLIB_INLINE COLORREF CCJToolBarCtrl::SetInsertMarkColor ( COLORREF clrNew )

Definition at line 212 of file CJToolBarCtrl.h.

00213     { ASSERT(::IsWindow(m_hWnd)); return (COLORREF) ::SendMessage(m_hWnd, TB_SETINSERTMARKCOLOR, 0, (LPARAM) clrNew); }

_CJXLIB_INLINE BOOL CCJToolBarCtrl::SetMaxTextRows ( int iMaxRows )

Definition at line 164 of file CJToolBarCtrl.h.

00165     { ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, TB_SETMAXTEXTROWS, iMaxRows, 0L); }

_CJXLIB_INLINE void CCJToolBarCtrl::SetStyle ( DWORD dwStyle )

Definition at line 167 of file CJToolBarCtrl.h.

00168     { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, TB_SETSTYLE, 0, dwStyle); }

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJToolBarCtrl.h
  • WinCvs/CJLib/CJLibrary/CJToolBarCtrl.cpp
Generated on Sun Oct 21 12:47:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJToolCmdUI Class Reference

Inheritance diagram for CCJToolCmdUI:

[legend]
Collaboration diagram for CCJToolCmdUI:

[legend]
List of all members.

Public Methods

virtual void | Enable (BOOL bOn)
virtual void | SetCheck (int nCheck)
virtual void | SetText (LPCTSTR lpszText)

Member Function Documentation

void CCJToolCmdUI::Enable ( BOOL bOn ) [virtual]

Definition at line 2053 of file CJToolBar.cpp.

02054 {
02055     m_bEnableChanged = TRUE;
02056     CCJToolBar* pToolBar = (CCJToolBar*)m_pOther;
02057     ASSERT(pToolBar != NULL);
02058     ASSERT_KINDOF(CCJToolBar, pToolBar);
02059     ASSERT(m_nIndex < m_nIndexMax);
02060
02061     UINT nNewStyle = pToolBar->GetButtonStyle(m_nIndex) & ~TBBS_DISABLED;
02062     if (!bOn)
02063     {
02064         nNewStyle |= TBBS_DISABLED;
02065         // WINBUG: If a button is currently pressed and then is disabled
02066         // COMCTL32.DLL does not unpress the button, even after the mouse
02067         // button goes up!  We work around this bug by forcing TBBS_PRESSED
02068         // off when a button is disabled.
02069         nNewStyle &= ~TBBS_PRESSED;
02070     }
02071     ASSERT(!(nNewStyle & TBBS_SEPARATOR));
02072     pToolBar->SetButtonStyle(m_nIndex, nNewStyle);
02073 }

void CCJToolCmdUI::SetCheck ( int nCheck ) [virtual]

Definition at line 2075 of file CJToolBar.cpp.

02076 {
02077     ASSERT(nCheck >= 0 && nCheck <= 2); // 0=>off, 1=>on, 2=>indeterminate
02078     CCJToolBar* pToolBar = (CCJToolBar*)m_pOther;
02079     ASSERT(pToolBar != NULL);
02080     ASSERT_KINDOF(CCJToolBar, pToolBar);
02081     ASSERT(m_nIndex < m_nIndexMax);
02082
02083     UINT nNewStyle = pToolBar->GetButtonStyle(m_nIndex) &
02084                 ~(TBBS_CHECKED | TBBS_INDETERMINATE);
02085     if (nCheck == 1)
02086         nNewStyle |= TBBS_CHECKED;
02087     else if (nCheck == 2)
02088         nNewStyle |= TBBS_INDETERMINATE;
02089     ASSERT(!(nNewStyle & TBBS_SEPARATOR));
02090     pToolBar->SetButtonStyle(m_nIndex, nNewStyle | TBBS_CHECKBOX);
02091 }

void CCJToolCmdUI::SetText ( LPCTSTR lpszText ) [virtual]

Definition at line 2093 of file CJToolBar.cpp.

02094 {
02095     // ignore it
02096 }

The documentation for this class was generated from the following file:
  • WinCvs/CJLib/CJLibrary/CJToolBar.cpp
Generated on Sun Oct 21 12:47:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJTreeCtrl Class Reference

#include <CJTreeCtrl.h>

Inheritance diagram for CCJTreeCtrl:

[legend]
Collaboration diagram for CCJTreeCtrl:

[legend]
List of all members.

Public Methods

CCJTreeCtrl ()
virtual | ~CCJTreeCtrl ()
virtual HTREEITEM | GetNextItem (HTREEITEM hItem, UINT nCode)
virtual HTREEITEM | GetNextItem (HTREEITEM hItem)
virtual HTREEITEM | GetPrevItem (HTREEITEM hItem)
virtual HTREEITEM | GetLastItem (HTREEITEM hItem)
virtual HTREEITEM | GetPrevSelectedItem (HTREEITEM hItem)
virtual HTREEITEM | GetNextSelectedItem (HTREEITEM hItem)
virtual HTREEITEM | GetFirstSelectedItem ()
virtual COLORREF | GetItemColor (HTREEITEM hItem)
virtual void | ClearSelection ()
virtual void | SetItemFont (HTREEITEM hItem, LOGFONT &logfont)
virtual void | SetItemBold (HTREEITEM hItem, BOOL bBold=TRUE)
virtual void | SetItemColor (HTREEITEM hItem, COLORREF color)
virtual void | EnableMultiSelect (BOOL bMultiSelect=TRUE)
virtual BOOL | GetItemFont (HTREEITEM hItem, LOGFONT *plogfont)
virtual BOOL | GetItemBold (HTREEITEM hItem)
virtual BOOL | SelectItems (HTREEITEM hItemFrom, HTREEITEM hItemTo)
virtual HTREEITEM | FindItem (LPCTSTR lpszSearch, BOOL bCaseSensitive=FALSE, BOOL bDownDir=TRUE, BOOL bWholeWord=FALSE, HTREEITEM hItem=NULL)

Protected Methods

virtual BOOL | IsFindValid (HTREEITEM hti)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
afx_msg void | OnPaint ()
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)

Protected Attributes

HTREEITEM | m_hItemFirstSel
DWORD | m_dwDragStart
BOOL | m_bMultiSelect
CMap< void *, void *, Color_Font,
Color_Font & > 		m_mapColorFont

Constructor & Destructor Documentation

CCJTreeCtrl::CCJTreeCtrl ( )

Definition at line 63 of file CJTreeCtrl.cpp.

00064 {
00065     m_hItemFirstSel = NULL;
00066     m_dwDragStart   = NULL;
00067     m_bMultiSelect = FALSE;
00068 }

CCJTreeCtrl::~CCJTreeCtrl ( ) [virtual]

Definition at line 70 of file CJTreeCtrl.cpp.

00071 {
00072 }

Member Function Documentation

void CCJTreeCtrl::ClearSelection ( ) [virtual]

Definition at line 503 of file CJTreeCtrl.cpp.

Referenced by OnLButtonDown().

00504 {
00505     if(m_bMultiSelect)
00506     {
00507         // This can be time consuming for very large trees
00508         // and is called every time the user does a normal selection
00509         // If performance is an issue, it may be better to maintain
00510         // a list of selected items
00511         for ( HTREEITEM hItem=GetRootItem(); hItem!=NULL; hItem=GetNextItem( hItem ) )
00512             if ( GetItemState( hItem, TVIS_SELECTED ) & TVIS_SELECTED )
00513                 SetItemState( hItem, 0, TVIS_SELECTED );
00514     }
00515 }

_CJXLIB_INLINE void CCJTreeCtrl::EnableMultiSelect ( BOOL bMultiSelect = TRUE ) [virtual]

Definition at line 250 of file CJTreeCtrl.h.

00251     { m_bMultiSelect = bMultiSelect; }

HTREEITEM CCJTreeCtrl::FindItem | ( | LPCTSTR | lpszSearch,
 |  | BOOL | bCaseSensitive = FALSE,
 |  | BOOL | bDownDir = TRUE,
 |  | BOOL | bWholeWord = FALSE,
 |  | HTREEITEM | hItem = NULL
 | ) | [virtual]

Definition at line 168 of file CJTreeCtrl.cpp.

00173 {
00174     CString str = lpszSearch;
00175
00176     int lenSearchStr = str.GetLength();
00177     if( lenSearchStr == 0 ) return NULL;
00178
00179     // For the first pass, set the current item equal to the selection
00180     HTREEITEM htiSel = hItem ? hItem : GetSelectedItem();
00181     HTREEITEM htiCur = htiSel;
00182     CString sSearch = str;
00183
00184     // make sure it ends if we started with no selection
00185     if(( htiCur == NULL ) && ( htiSel != NULL ))
00186     {
00187         if( bDownDir )
00188             htiCur = GetRootItem();
00189         else
00190             htiCur = GetLastItem( NULL );
00191     }
00192
00193     if( !bCaseSensitive )
00194         sSearch.MakeLower();
00195
00196     // For the first pass only, we check to see if it
00197     // is the item we're looking for.
00198     BOOL bFirstPass = TRUE;
00199
00200     while( htiCur && (htiCur != htiSel || bFirstPass) )
00201     {
00202         bFirstPass = FALSE;
00203
00204         CString sItemText = GetItemText( htiCur );
00205         if( !bCaseSensitive )
00206             sItemText.MakeLower();
00207
00208         int n;
00209         while( (n = sItemText.Find( sSearch )) != -1 )
00210         {
00211             // Search string found
00212             if( bWholeWord )
00213             {
00214                 // Check preceding char
00215                 if( n != 0 )
00216                 {
00217                     if( isalpha(sItemText[n-1]) ||
00218                             sItemText[n-1] == '_' ){
00219                         // Not whole word
00220                         sItemText = sItemText.Right(
00221                             sItemText.GetLength() - n -
00222                             lenSearchStr );
00223                         continue;
00224                     }
00225                 }
00226
00227                 // Check succeeding char
00228                 if( sItemText.GetLength() > n + lenSearchStr
00229                     && ( isalpha(sItemText[n+lenSearchStr]) ||
00230                     sItemText[n+lenSearchStr] == '_' ) )
00231                 {
00232                     // Not whole word
00233                     sItemText = sItemText.Right( sItemText.GetLength()
00234                             - n - sSearch.GetLength() );
00235                     continue;
00236                 }
00237             }
00238
00239             if( IsFindValid( htiCur ) )
00240                 return htiCur;
00241             else break;
00242         }
00243
00244
00245         htiCur = bDownDir ? GetNextItem( htiCur ) : GetPrevItem( htiCur );
00246         if( htiCur == NULL )
00247         {
00248             if( bDownDir )  htiCur = GetRootItem();
00249             else htiCur = GetLastItem( NULL );
00250         }
00251     }
00252     return NULL;
00253 }

HTREEITEM CCJTreeCtrl::GetFirstSelectedItem ( ) [virtual]

Definition at line 569 of file CJTreeCtrl.cpp.

00570 {
00571     if(m_bMultiSelect)
00572     {
00573         for ( HTREEITEM hItem = GetRootItem(); hItem!=NULL; hItem = GetNextItem( hItem ) )
00574             if ( GetItemState( hItem, TVIS_SELECTED ) & TVIS_SELECTED )
00575                 return hItem;
00576     }
00577
00578     return NULL;
00579 }

BOOL CCJTreeCtrl::GetItemBold ( HTREEITEM hItem ) [virtual]

Definition at line 315 of file CJTreeCtrl.cpp.

Referenced by OnPaint().

00316 {
00317     return GetItemState( hItem, TVIS_BOLD ) & TVIS_BOLD;
00318 }

COLORREF CCJTreeCtrl::GetItemColor ( HTREEITEM hItem ) [virtual]

Definition at line 320 of file CJTreeCtrl.cpp.

00321 {
00322     // Returns (COLORREF)-1 if color was not set
00323     Color_Font cf;
00324     if( !m_mapColorFont.Lookup( hItem, cf ) )
00325         return (COLORREF)-1;
00326     return cf.color;
00327
00328 }

BOOL CCJTreeCtrl::GetItemFont | ( | HTREEITEM | hItem,
 |  | LOGFONT * | plogfont
 | ) | [virtual]

Definition at line 303 of file CJTreeCtrl.cpp.

00304 {
00305     Color_Font cf;
00306     if( !m_mapColorFont.Lookup( hItem, cf ) )
00307         return FALSE;
00308     if( cf.logfont.lfFaceName[0] == '\0' )
00309         return FALSE;
00310     *plogfont = cf.logfont;
00311     return TRUE;
00312
00313 }

HTREEITEM CCJTreeCtrl::GetLastItem ( HTREEITEM hItem ) [virtual]

Definition at line 134 of file CJTreeCtrl.cpp.

Referenced by FindItem(), and GetPrevItem().

00135 {
00136     //  Temporary used variable
00137     HTREEITEM   htiNext;
00138
00139     if( hItem == NULL ) {
00140         // Get the last item at the top level
00141         hItem = GetRootItem();
00142     }
00143
00144     while( ItemHasChildren( hItem ) != NULL ) {
00145         //  Find the last child of hItem
00146         htiNext = GetChildItem( hItem );
00147         while( htiNext != NULL ) {
00148             hItem = htiNext;
00149             htiNext = GetNextSiblingItem( htiNext );
00150         }
00151     }
00152
00153     return hItem;
00154
00155 }

HTREEITEM CCJTreeCtrl::GetNextItem ( HTREEITEM hItem ) [virtual]

Definition at line 93 of file CJTreeCtrl.cpp.

00094 {
00095     HTREEITEM hti = NULL;
00096
00097     if (ItemHasChildren(hItem))
00098         hti = GetChildItem(hItem);
00099
00100     if (hti == NULL) {
00101         while ((hti = GetNextSiblingItem(hItem)) == NULL) {
00102             if ((hItem = GetParentItem(hItem)) == NULL)
00103                 return NULL;
00104         }
00105     }
00106     return hti;
00107 }

_CJXLIB_INLINE HTREEITEM CCJTreeCtrl::GetNextItem | ( | HTREEITEM | hItem,
 |  | UINT | nCode
 | ) | [virtual]

Definition at line 247 of file CJTreeCtrl.h.

Referenced by ClearSelection(), FindItem(), GetFirstSelectedItem(), and GetNextSelectedItem().

00248     { return CTreeCtrl::GetNextItem( hItem, nCode ); }

HTREEITEM CCJTreeCtrl::GetNextSelectedItem ( HTREEITEM hItem ) [virtual]

Definition at line 581 of file CJTreeCtrl.cpp.

00582 {
00583     if(m_bMultiSelect)
00584     {
00585         for ( hItem = GetNextItem( hItem ); hItem!=NULL; hItem = GetNextItem( hItem ) )
00586             if ( GetItemState( hItem, TVIS_SELECTED ) & TVIS_SELECTED )
00587                 return hItem;
00588     }
00589
00590     return NULL;
00591 }

HTREEITEM CCJTreeCtrl::GetPrevItem ( HTREEITEM hItem ) [virtual]

Definition at line 115 of file CJTreeCtrl.cpp.

Referenced by FindItem(), and GetPrevSelectedItem().

00116 {
00117     HTREEITEM       hti;
00118
00119     hti = GetPrevSiblingItem(hItem);
00120     if( hti == NULL )
00121         hti = GetParentItem(hItem);
00122     else
00123         hti = GetLastItem(hti);
00124     return hti;
00125 }

HTREEITEM CCJTreeCtrl::GetPrevSelectedItem ( HTREEITEM hItem ) [virtual]

Definition at line 593 of file CJTreeCtrl.cpp.

00594 {
00595     if(m_bMultiSelect)
00596     {
00597         for ( hItem = GetPrevItem( hItem ); hItem!=NULL; hItem = GetPrevItem( hItem ) )
00598             if ( GetItemState( hItem, TVIS_SELECTED ) & TVIS_SELECTED )
00599                 return hItem;
00600     }
00601
00602     return NULL;
00603 }

BOOL CCJTreeCtrl::IsFindValid ( HTREEITEM hti ) [protected, virtual]

Definition at line 262 of file CJTreeCtrl.cpp.

Referenced by FindItem().

00263 {
00264     return TRUE;
00265 }

BOOL CCJTreeCtrl::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 605 of file CJTreeCtrl.cpp.

00606 {
00607     // KStowell - overridden for flicker-free drawing.
00608     UNUSED_ALWAYS(pDC);
00609     return TRUE;
00610 }

void CCJTreeCtrl::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 427 of file CJTreeCtrl.cpp.

00428 {
00429     if(m_bMultiSelect)
00430     {
00431         // Set focus to control if key strokes are needed.
00432         // Focus is not automatically given to control on lbuttondown
00433
00434         m_dwDragStart = GetTickCount();
00435
00436         if(nFlags & MK_CONTROL )
00437         {
00438             // Control key is down
00439             UINT flag;
00440             HTREEITEM hItem = HitTest( point, &flag );
00441             if( hItem )
00442             {
00443                 // Toggle selection state
00444                 UINT uNewSelState =
00445                     GetItemState(hItem, TVIS_SELECTED) & TVIS_SELECTED ?
00446                     0 : TVIS_SELECTED;
00447
00448                 // Get old selected (focus) item and state
00449                 HTREEITEM hItemOld = GetSelectedItem();
00450                 UINT uOldSelState  = hItemOld ?
00451                     GetItemState(hItemOld, TVIS_SELECTED) : 0;
00452
00453                 // Select new item
00454                 if( GetSelectedItem() == hItem )
00455                     SelectItem( NULL );     // to prevent edit
00456                 CTreeCtrl::OnLButtonDown(nFlags, point);
00457
00458                 // Set proper selection (highlight) state for new item
00459                 SetItemState(hItem, uNewSelState,  TVIS_SELECTED);
00460
00461                 // Restore state of old selected item
00462                 if (hItemOld && hItemOld != hItem)
00463                     SetItemState(hItemOld, uOldSelState, TVIS_SELECTED);
00464
00465                 m_hItemFirstSel = NULL;
00466
00467                 return;
00468             }
00469         }
00470         else if(nFlags & MK_SHIFT)
00471         {
00472             // Shift key is down
00473             UINT flag;
00474             HTREEITEM hItem = HitTest( point, &flag );
00475
00476             // Initialize the reference item if this is the first shift selection
00477             if( !m_hItemFirstSel )
00478                 m_hItemFirstSel = GetSelectedItem();
00479
00480             // Select new item
00481             if( GetSelectedItem() == hItem )
00482                 SelectItem( NULL );         // to prevent edit
00483             CTreeCtrl::OnLButtonDown(nFlags, point);
00484
00485             if( m_hItemFirstSel )
00486             {
00487                 SelectItems( m_hItemFirstSel, hItem );
00488                 return;
00489             }
00490         }
00491         else
00492         {
00493             // Normal - remove all selection and let default
00494             // handler do the rest
00495             ClearSelection();
00496             m_hItemFirstSel = NULL;
00497         }
00498     }
00499
00500     CTreeCtrl::OnLButtonDown(nFlags, point);
00501 }

void CCJTreeCtrl::OnPaint ( ) [protected]

Definition at line 330 of file CJTreeCtrl.cpp.

00331 {
00332     CPaintDC dc(this);
00333
00334     // Create a memory DC compatible with the paint DC
00335     CDC memDC;
00336     memDC.CreateCompatibleDC( &dc );
00337
00338     CRect rcClip, rcClient;
00339     dc.GetClipBox( &rcClip );
00340     GetClientRect(&rcClient);
00341
00342     // Select a compatible bitmap into the memory DC
00343     CBitmap bitmap;
00344     bitmap.CreateCompatibleBitmap( &dc, rcClient.Width(), rcClient.Height() );
00345     CBitmap* pOldBitmap = memDC.SelectObject( &bitmap );
00346
00347     // Set clip region to be same as that in paint DC
00348     CRgn rgn;
00349     rgn.CreateRectRgnIndirect( &rcClip );
00350     memDC.SelectClipRgn(&rgn);
00351     rgn.DeleteObject();
00352
00353     // First let the control do its default drawing.
00354     CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
00355
00356     HTREEITEM hItem = GetFirstVisibleItem();
00357
00358     int n = GetVisibleCount()+1;
00359     while( hItem && n--)
00360     {
00361         CRect rect;
00362
00363         // Do not meddle with selected items or drop highlighted items
00364         UINT selflag = TVIS_DROPHILITED | TVIS_SELECTED;
00365         Color_Font cf;
00366
00367         if ( !(GetItemState( hItem, selflag ) & selflag )
00368             && m_mapColorFont.Lookup( hItem, cf ))
00369         {
00370             CFont *pFontDC;
00371             CFont fontDC;
00372             LOGFONT logfont;
00373
00374             if( cf.logfont.lfFaceName[0] != '\0' )
00375             {
00376                 logfont = cf.logfont;
00377             }
00378             else
00379             {
00380                 // No font specified, so use window font
00381                 CFont *pFont = GetFont();
00382                 pFont->GetLogFont( &logfont );
00383             }
00384
00385             CString sItem = GetItemText( hItem );
00386             GetItemRect( hItem, &rect, TRUE );
00387
00388             // cover up over old font.
00389             CFont* pOldFont = memDC.SelectObject(GetFont());
00390             memDC.SetTextColor(::GetSysColor( COLOR_WINDOW ));
00391             memDC.SetBkColor( GetSysColor( COLOR_WINDOW ) );
00392             memDC.TextOut( rect.left+2, rect.top+1, sItem );
00393             memDC.SelectObject(pOldFont);
00394
00395             if( GetItemBold( hItem ) )
00396                 logfont.lfWeight = 700;
00397             fontDC.CreateFontIndirect( &logfont );
00398             pFontDC = memDC.SelectObject( &fontDC );
00399
00400             if( cf.color != (COLORREF)-1 )
00401                 memDC.SetTextColor( cf.color );
00402
00403             memDC.SetBkColor( GetSysColor( COLOR_WINDOW ) );
00404             memDC.TextOut( rect.left+2, rect.top+1, sItem );
00405
00406             memDC.SelectObject( pFontDC );
00407
00408             // fix potential resource leak - KStowell - 10-22-99.
00409             fontDC.DeleteObject();
00410         }
00411         hItem = GetNextVisibleItem( hItem );
00412     }
00413
00414
00415     dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC,
00416         rcClip.left, rcClip.top, SRCCOPY );
00417
00418     // fix potential resource leak - KStowell - 10-21-99
00419     memDC.SelectObject( pOldBitmap );
00420     memDC.DeleteDC();
00421     bitmap.DeleteObject();
00422 }

BOOL CCJTreeCtrl::PreCreateWindow ( CREATESTRUCT & cs ) [protected, virtual]

Definition at line 267 of file CJTreeCtrl.cpp.

00268 {
00269     if( !CTreeCtrl::PreCreateWindow(cs))
00270         return FALSE;
00271
00272     cs.style |= TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS;
00273
00274     return TRUE;
00275 }

BOOL CCJTreeCtrl::SelectItems | ( | HTREEITEM | hItemFrom,
 |  | HTREEITEM | hItemTo
 | ) | [virtual]

Definition at line 522 of file CJTreeCtrl.cpp.

Referenced by OnLButtonDown().

00523 {
00524     if(m_bMultiSelect)
00525     {
00526         HTREEITEM hItem = GetRootItem();
00527
00528         // Clear selection upto the first item
00529         while ( hItem && hItem!=hItemFrom && hItem!=hItemTo )
00530         {
00531             hItem = GetNextVisibleItem( hItem );
00532             SetItemState( hItem, 0, TVIS_SELECTED );
00533         }
00534
00535         if ( !hItem )
00536             return FALSE;   // Item is not visible
00537
00538         SelectItem( hItemTo );
00539
00540         // Rearrange hItemFrom and hItemTo so that hItemFirst is at top
00541         if( hItem == hItemTo )
00542         {
00543             hItemTo = hItemFrom;
00544             hItemFrom = hItem;
00545         }
00546
00547
00548         // Go through remaining visible items
00549         BOOL bSelect = TRUE;
00550         while ( hItem )
00551         {
00552             // Select or remove selection depending on whether item
00553             // is still within the range.
00554             SetItemState( hItem, bSelect ? TVIS_SELECTED : 0, TVIS_SELECTED );
00555
00556             // Do we need to start removing items from selection
00557             if( hItem == hItemTo )
00558                 bSelect = FALSE;
00559
00560             hItem = GetNextVisibleItem( hItem );
00561         }
00562
00563         return TRUE;
00564     }
00565
00566     return FALSE;
00567 }

void CCJTreeCtrl::SetItemBold | ( | HTREEITEM | hItem,
 |  | BOOL | bBold = TRUE
 | ) | [virtual]

Definition at line 289 of file CJTreeCtrl.cpp.

00290 {
00291     SetItemState( hItem, bBold ? TVIS_BOLD: 0, TVIS_BOLD );
00292 }

void CCJTreeCtrl::SetItemColor | ( | HTREEITEM | hItem,
 |  | COLORREF | color
 | ) | [virtual]

Definition at line 294 of file CJTreeCtrl.cpp.

00295 {
00296     Color_Font cf;
00297     if( !m_mapColorFont.Lookup( hItem, cf ) )
00298         cf.logfont.lfFaceName[0] = '\0';
00299     cf.color = color;
00300     m_mapColorFont[hItem] = cf;
00301 }

void CCJTreeCtrl::SetItemFont | ( | HTREEITEM | hItem,
 |  | LOGFONT & | logfont
 | ) | [virtual]

Definition at line 280 of file CJTreeCtrl.cpp.

00281 {
00282     Color_Font cf;
00283     if( !m_mapColorFont.Lookup( hItem, cf ) )
00284         cf.color = (COLORREF)-1;
00285     cf.logfont = logfont;
00286     m_mapColorFont[hItem] = cf;
00287 }

Member Data Documentation

BOOL CCJTreeCtrl::m_bMultiSelect [protected]

Definition at line 75 of file CJTreeCtrl.h.

DWORD CCJTreeCtrl::m_dwDragStart [protected]

Definition at line 74 of file CJTreeCtrl.h.

HTREEITEM CCJTreeCtrl::m_hItemFirstSel [protected]

Definition at line 73 of file CJTreeCtrl.h.

CMap< void*, void*, Color_Font, Color_Font& > CCJTreeCtrl::m_mapColorFont [protected]

Definition at line 78 of file CJTreeCtrl.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJTreeCtrl.h
  • WinCvs/CJLib/CJLibrary/CJTreeCtrl.cpp
Generated on Sun Oct 21 12:47:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJTreeCtrl::Color_Font Struct Reference

#include <CJTreeCtrl.h>

Collaboration diagram for CCJTreeCtrl::Color_Font:

[legend]
List of all members.

Public Attributes

COLORREF | color
LOGFONT | logfont

Member Data Documentation

COLORREF CCJTreeCtrl::Color_Font::color

Definition at line 77 of file CJTreeCtrl.h.

LOGFONT CCJTreeCtrl::Color_Font::logfont

Definition at line 77 of file CJTreeCtrl.h.

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/Include/CJTreeCtrl.h
Generated on Sun Oct 21 12:47:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCJWindowPlacement Class Reference

#include <CJWindowPlacement.h>

Inheritance diagram for CCJWindowPlacement:

[legend]
Collaboration diagram for CCJWindowPlacement:

[legend]
List of all members.

Public Methods

CCJWindowPlacement ()
virtual | ~CCJWindowPlacement ()
virtual BOOL | LoadWindowPos (CFrameWnd *pFrameWnd, LPCTSTR lpszFormat=NULL, LPCTSTR lpszSection=NULL, LPCTSTR lpszWndPos=NULL)
virtual void | SaveWindowPos (CFrameWnd *pFrameWnd)

Private Attributes

CString | m_strFormat
CString | m_strSection
CString | m_strWndPos

Constructor & Destructor Documentation

CCJWindowPlacement::CCJWindowPlacement ( )

Definition at line 60 of file CJWindowPlacement.cpp.

00061 {
00062     length                  = sizeof( WINDOWPLACEMENT );
00063     flags                   = NULL;
00064     showCmd                 = SW_SHOWMAXIMIZED;
00065     ptMinPosition.x         = 0;
00066     ptMinPosition.y         = 0;
00067     ptMaxPosition.x         = 0;
00068     ptMaxPosition.y         = 0;
00069     rcNormalPosition.left   = 0;
00070     rcNormalPosition.top    = 0;
00071     rcNormalPosition.right  = 0;
00072     rcNormalPosition.bottom = 0;
00073 }

CCJWindowPlacement::~CCJWindowPlacement ( ) [virtual]

Definition at line 75 of file CJWindowPlacement.cpp.

00076 {
00077 }

Member Function Documentation

BOOL CCJWindowPlacement::LoadWindowPos | ( | CFrameWnd * | pFrameWnd,
 |  | LPCTSTR | lpszFormat = NULL,
 |  | LPCTSTR | lpszSection = NULL,
 |  | LPCTSTR | lpszWndPos = NULL
 | ) | [virtual]

Definition at line 105 of file CJWindowPlacement.cpp.

Referenced by CMainFrame::OnCreate().

00106 {
00107     ASSERT_VALID( pFrameWnd ); // must be valid.
00108
00109     // load the strings for the registry.
00110     if( lpszFormat == NULL )
00111         m_strFormat.LoadString( IDS_WIN_PLACEMENT );
00112     else
00113         m_strFormat = lpszFormat;
00114
00115     if( lpszSection == NULL )
00116         m_strSection.LoadString( IDS_SETTINGS );
00117     else
00118         m_strSection = lpszSection;
00119
00120     if( lpszWndPos == NULL )
00121         m_strWndPos.LoadString( IDS_WNDPOS  );
00122     else
00123         m_strWndPos = lpszWndPos;
00124
00125     // Load the previous window placement settings.
00126     CString strBuffer = AfxGetApp()->GetProfileString( m_strSection, m_strWndPos, NULL );
00127
00128     int nRead = _stscanf( strBuffer, m_strFormat,
00129         &flags,
00130         &showCmd,
00131         &ptMinPosition.x,
00132         &ptMinPosition.y,
00133         &ptMaxPosition.x,
00134         &ptMaxPosition.y,
00135         &rcNormalPosition.left,
00136         &rcNormalPosition.top,
00137         &rcNormalPosition.right,
00138         &rcNormalPosition.bottom);
00139
00140     // Set the window position.
00141     if( nRead == 10 )
00142     {
00143         pFrameWnd->SetWindowPlacement( this );
00144         pFrameWnd->ShowWindow( showCmd );
00145         pFrameWnd->UpdateWindow();
00146         return TRUE;
00147     }
00148
00149     return FALSE;
00150 }

void CCJWindowPlacement::SaveWindowPos ( CFrameWnd * pFrameWnd ) [virtual]

Definition at line 81 of file CJWindowPlacement.cpp.

Referenced by CMainFrame::OnClose().

00082 {
00083     ASSERT_VALID( pFrameWnd ); // must be valid.
00084
00085     // Get the current window position.
00086     pFrameWnd->GetWindowPlacement( this );
00087
00088     // Save position to registry.
00089     CString strBuffer;
00090     strBuffer.Format( m_strFormat,
00091         flags,
00092         showCmd,
00093         ptMinPosition.x,
00094         ptMinPosition.y,
00095         ptMaxPosition.x,
00096         ptMaxPosition.y,
00097         rcNormalPosition.left,
00098         rcNormalPosition.top,
00099         rcNormalPosition.right,
00100         rcNormalPosition.bottom);
00101
00102     AfxGetApp()->WriteProfileString( m_strSection, m_strWndPos, strBuffer );
00103 }

Member Data Documentation

CString CCJWindowPlacement::m_strFormat [private]

Definition at line 71 of file CJWindowPlacement.h.

CString CCJWindowPlacement::m_strSection [private]

Definition at line 72 of file CJWindowPlacement.h.

CString CCJWindowPlacement::m_strWndPos [private]

Definition at line 73 of file CJWindowPlacement.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/CJWindowPlacement.h
  • WinCvs/CJLib/CJLibrary/CJWindowPlacement.cpp
Generated on Sun Oct 21 12:47:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cmd Struct Reference

Collaboration diagram for cmd:

[legend]
List of all members.

Public Attributes

char * | fullname
char * | nick1
char * | nick2
int(* | func )()

Member Data Documentation

char* cmd::fullname

Definition at line 73 of file main.c.

int(* cmd::func)()

char* cmd::nick1

Definition at line 95 of file main.c.

char* cmd::nick2

Definition at line 96 of file main.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/main.c
Generated on Sun Oct 21 12:47:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCmdTarget Class Reference

#include <umain.h>

Inheritance diagram for UCmdTarget:

[legend]
Collaboration diagram for UCmdTarget:

[legend]
List of all members.

Public Types

enum | UDispatchInfo { kUNoDispatchInfo, kUDispatchHandled = 0x01 }

Public Methods

UCmdTarget (int widid)
virtual | ~UCmdTarget ()
virtual int | UDispatchMessage (int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo)
dispatch an event using the static message table. More...

int | GetWidID (void) const

Protected Methods

virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Static Protected Attributes

const UMSGMAP | messageMap

Private Attributes

int | m_widid

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

enum UCmdTarget::UDispatchInfo

Enumeration values:
kUNoDispatchInfo
kUDispatchHandled

Definition at line 669 of file umain.h.

Referenced by UDispatchMessage().

00670     {
00671         kUNoDispatchInfo,
00672         kUDispatchHandled = 0x01
00673     } UDispatchInfo;

Constructor & Destructor Documentation

UCmdTarget::UCmdTarget ( int widid )

Definition at line 406 of file uevent.cpp.

00406                                 : m_widid(widid)
00407 {
00408     std::map<int, UCmdTarget *>::value_type val(widid, this);
00409     sAllTargets.Get().insert(val);
00410 }

UCmdTarget::~UCmdTarget ( ) [virtual]

Definition at line 412 of file uevent.cpp.

00413 {
00414     UEventRemoveWidID(m_widid);
00415 }

Member Function Documentation

const UMSGMAP * UCmdTarget::GetBaseMessageMap ( ) [static, protected]

Reimplemented in UPromptMessage, UEditMessage, UAuthen_SSH, UAuthen_Pserver, UAuthen_Rhosts, UAuthen_Kserver, USaveSettings, UCvsApp, UCvsConsole, UCvsFiles, UCvsFolders, UCvsFrame, UCvsGraph, UCvsMenubar, UCvsToolbar, UMacAppMenu, UMenu, UToolbar, and UWidget.

Definition at line 108 of file uevent.cpp.

00109     { return 0L; }

const UMSGMAP * UCmdTarget::GetMessageMap ( ) const [protected, virtual]

Reimplemented in UPromptMessage, UEditMessage, UAuthen_SSH, UAuthen_Pserver, UAuthen_Rhosts, UAuthen_Kserver, USaveSettings, UCvsApp, UCvsConsole, UCvsFiles, UCvsFolders, UCvsFrame, UCvsGraph, UCvsMenubar, UCvsToolbar, UMacAppMenu, UMenu, UToolbar, and UWidget.

Definition at line 112 of file uevent.cpp.

Referenced by UDispatchMessage().

00113     { return &UCmdTarget::messageMap; }

const UMSGMAP * UCmdTarget::GetThisMessageMap ( ) [static, protected]

Reimplemented in UPromptMessage, UEditMessage, UAuthen_SSH, UAuthen_Pserver, UAuthen_Rhosts, UAuthen_Kserver, USaveSettings, UCvsApp, UCvsConsole, UCvsFiles, UCvsFolders, UCvsFrame, UCvsGraph, UCvsMenubar, UCvsToolbar, UMacAppMenu, UMenu, UToolbar, and UWidget.

Definition at line 110 of file uevent.cpp.

00111     { return &UCmdTarget::messageMap; }

int UCmdTarget::GetWidID ( void ) const [inline]

Definition at line 678 of file umain.h.

Referenced by UWidget::AddPage(), AskCreatePersistentSettings(), UCvsGraph::CalcImageSize(), CompatGetCheckout(), CompatGetCommand(), CompatGetCommit(), CompatGetDiff(), CompatGetImport(), CompatGetLog(), CompatGetPassword(), CompatGetPrefs(), CompatGetUpdate(), CompatImportFilter(), CompatRtagBranch(), CompatRtagCreate(), CompatRtagDelete(), CompatTagBranch(), CompatTagCreate(), CompatTagDelete(), CvsAlert(), CvsLogParse(), UCvsFolders::DeleteAllItems(), UCvsFiles::DisableGeneric(), USaveSettings::DoDataExchange(), UAuthen_Kserver::DoDataExchange(), UAuthen_Rhosts::DoDataExchange(), UAuthen_Pserver::DoDataExchange(), UAuthen_SSH::DoDataExchange(), UEditMessage::DoDataExchange(), UWidget::DoModal(), TBrowserFill::ExitDirectory(), TBrowserFillDummy::ExitDirectory(), UCvsFolders::GetItemByLocation(), UWidget::HasFocus(), UAuthen_SSH::OnBtnName(), UAuthen_SSH::OnBtnRSA(), UAuthen_SSH::OnCheckName(), UAuthen_SSH::OnCheckOptions(), UAuthen_Kserver::OnCheckPort(), UAuthen_Rhosts::OnCheckPort(), UAuthen_Pserver::OnCheckPort(), UAuthen_Pserver::OnCheckProxy(), UAuthen_SSH::OnCheckRSA(), UAuthen_Rhosts::OnCheckRshName(), UAuthen_Rhosts::OnCheckServerName(), UCvsFolders::OnCmdAdd(), UCvsFiles::OnCmdAdd(), UCvsFiles::OnCmdAddb(), UCvsFolders::OnCmdCommit(), UCvsFiles::OnCmdCommit(), UCvsFolders::OnCmdDiff(), UCvsFiles::OnCmdDiff(), UCvsFolders::OnCmdEdit(), UCvsFiles::OnCmdEdit(), UCvsFolders::OnCmdEditors(), UCvsFiles::OnCmdEditors(), UCvsFiles::OnCmdEditsel(), UCvsFiles::OnCmdEditseldef(), UCvsFolders::OnCmdExplore(), UCvsFiles::OnCmdExplore(), UCvsFiles::OnCmdGraph(), UCvsFolders::OnCmdLock(), UCvsFiles::OnCmdLock(), UCvsFolders::OnCmdLog(), UCvsFiles::OnCmdLog(), UCvsFolders::OnCmdMacrosSel(), UCvsFolders::OnCmdQueryUpdate(), UCvsFiles::OnCmdQueryUpdate(), UCvsFolders::OnCmdRelease(), UCvsFiles::OnCmdRelease(), UCvsFiles::OnCmdRmv(), UCvsFolders::OnCmdStatus(), UCvsFiles::OnCmdStatus(), UCvsFolders::OnCmdTagBranch(), UCvsFiles::OnCmdTagBranch(), UCvsFolders::OnCmdTagDelete(), UCvsFiles::OnCmdTagDelete(), UCvsFolders::OnCmdTagNew(), UCvsFiles::OnCmdTagNew(), UCvsFiles::OnCmdTrash(), UCvsFiles::OnCmdUIAdd(), UCvsFiles::OnCmdUIAddB(), UCvsFiles::OnCmdUIEditseldef(), UCvsFolders::OnCmdUIExplore(), UCvsFiles::OnCmdUIExplore(), UCvsFiles::OnCmdUIGraph(), UCvsFiles::OnCmdUIMacroSel(), UCvsFolders::OnCmdUIMacrosSel(), UCvsFiles::OnCmdUIRelease(), UCvsFiles::OnCmdUIRmv(), UCvsFiles::OnCmdUITrash(), UCvsFiles::OnCmdUIUpdate(), UCvsFolders::OnCmdUnedit(), UCvsFiles::OnCmdUnedit(), UCvsFolders::OnCmdUnlock(), UCvsFiles::OnCmdUnlock(), UCvsFolders::OnCmdUpdate(), UCvsFiles::OnCmdUpdate(), UCvsFolders::OnCmdWatchOff(), UCvsFiles::OnCmdWatchOff(), UCvsFolders::OnCmdWatchOn(), UCvsFiles::OnCmdWatchOn(), UCvsFolders::OnCmdWatchers(), UCvsFiles::OnCmdWatchers(), UWidget::OnComboAppend(), UToolbar::OnCommands(), UMenu::OnCommands(), USaveSettings::OnCopyFrom(), UCvsGraph::OnCreate(), UCvsFiles::OnCreate(), UCvsFiles::OnDblClick(), TBrowserFill::OnDirectory(), TViewFill::OnDirectory(), UCvsGraph::OnDrawing(), TViewFill::OnFile(), CPseudoDlg::OnInitDialog(), UWidget::OnInitTabWidget(), UWidget::OnInitWidget(), UWidget::OnListNewRow(), UCvsFiles::OnMacroSel(), UWidget::OnPageChanged(), UToolbar::OnTbButton(), UToolbar::OnTbCheckBtn(), UToolbar::OnTbInit(), UCvsFolders::OnTreeExpanding(), UWidget::OnTreeInsert(), UCvsFolders::OnTreeSelecting(), UWidget::OnUpdateFocus(), UCvsFolders::OnUpdateGeneric(), UWidget::OnUpdateUI(), UToolbar::OnUpdateUI(), UMenu::OnUpdateUI(), UMacAppMenu::OnUpdateUI(), UCvsFolders::ResetBrowser(), UCvsFolders::ResetView(), UCvsFiles::ResetView(), UCvsFiles::Resort(), UCvsFolders::RetrievePath(), UCvsFiles::Search(), LPseudoWinAttachment::SearchWidID(), UCvsFolders::StepToLocation(), UCvsFolders::StoreExpanded(), UEventGiveTime(), UPPMenu::UPPMenu(), UWinPseudoWindowProc(), WinInitWidgets(), and CPseudoDlg::~CPseudoDlg().

00678 { return m_widid; }

int UCmdTarget::UDispatchMessage | ( | int | evt,
 |  | int | arg1,
 |  | void * | arg2,
 |  | UDispatchInfo & | dispatchInfo
 | ) | [virtual]

dispatch an event using the static message table.

Reimplemented in UToolbar, and UWidget.

Definition at line 323 of file uevent.cpp.

Referenced by UWidget::UDispatchMessage(), UEventNotifyMessage(), UEventSendMessage(), and UEventSendMessageExt().

00324 {
00325     const UMSGMAP* themap;
00326     const UMSGMAP_ENTRY *entries;
00327     for(themap = GetMessageMap(); themap != 0L; themap = themap->pBaseMap)
00328     {
00329         entries = themap->lpEntries;
00330         while(entries->nMessage != EV_NONE)
00331         {
00332             if(entries->ext == UMSG_RANGE)
00333             {
00334                 int cmd = (unsigned short)ULOWORD(arg1);
00335                 if(evt == entries->nMessage &&
00336                     cmd >= entries->ext1 &&
00337                     cmd <= entries->ext2)
00338                         goto dispatch;
00339             }
00340             else if(entries->nMessage == evt)
00341                 goto dispatch;
00342             entries++;
00343         }
00344     }
00345     return 0;
00346
00347 dispatch:
00348     union UMessageMapFunctions mmf;
00349     mmf.pfn = entries->pfn;
00350     int res = 0;
00351
00352     dispatchInfo = UDispatchInfo((int)dispatchInfo | UCmdTarget::kUDispatchHandled);
00353
00354     switch(entries->nSig)
00355     {
00356     case epV_V:
00357         (this->*mmf.pfnV_V)();
00358         break;
00359     case epV_VP:
00360         (this->*mmf.pfnV_VP)(arg2);
00361         break;
00362     case epV_iVP:
00363         (this->*mmf.pfnV_iVP)(arg1, arg2);
00364         break;
00365     case epV_IVP:
00366         (this->*mmf.pfnV_iVP)(UHIWORD(arg1), arg2);
00367         break;
00368     case epV_i:
00369         (this->*mmf.pfnV_i)(arg1);
00370         break;
00371     case epV_I:
00372         (this->*mmf.pfnV_i)(UHIWORD(arg1));
00373         break;
00374     case epV_ii:
00375         (this->*mmf.pfnV_ii)(ULOWORD(arg1), UHIWORD(arg1));
00376         break;
00377     case epV_iii:
00378         (this->*mmf.pfnV_iii)(ULOWORD(arg1), UHIWORD(arg1), (int)arg2);
00379         break;
00380     case epV_iiVP:
00381         (this->*mmf.pfnV_iiVP)(ULOWORD(arg1), UHIWORD(arg1), arg2);
00382         break;
00383     case epi_ii:
00384         res = (this->*mmf.pfni_ii)(ULOWORD(arg1), UHIWORD(arg1));
00385         break;
00386     case epi_i:
00387         res = (this->*mmf.pfni_i)(arg1);
00388         break;
00389     case epi_V:
00390         res = (this->*mmf.pfni_V)();
00391         break;
00392     case epi_iVP:
00393         res = (this->*mmf.pfni_iVP)(arg1, arg2);
00394         break;
00395     case epi_VP:
00396         res = (this->*mmf.pfni_VP)(arg2);
00397         break;
00398     default:
00399         UAppConsole("Unknown event cast : %d\n", entries->nSig);
00400         break;
00401     }
00402
00403     return res;
00404 }

Member Data Documentation

const UMSGMAP_ENTRY UCmdTarget::_messageEntries [static, private]

Initial value:

{
    {EV_NONE, epNone, UMSG_NOEXT, 0, 0, (UPMSG)0 }
}

Reimplemented in UPromptMessage, UEditMessage, UAuthen_SSH, UAuthen_Pserver, UAuthen_Rhosts, UAuthen_Kserver, USaveSettings, UCvsApp, UCvsConsole, UCvsFiles, UCvsFolders, UCvsFrame, UCvsGraph, UCvsMenubar, UCvsToolbar, UMacAppMenu, UMenu, UToolbar, and UWidget.

Definition at line 116 of file uevent.cpp.

int UCmdTarget::m_widid [private]

Definition at line 680 of file umain.h.

const UMSGMAP UCmdTarget::messageMap [static, protected]

Initial value:

{ 0L, &UCmdTarget::_messageEntries[0] }

Reimplemented in UPromptMessage, UEditMessage, UAuthen_SSH, UAuthen_Pserver, UAuthen_Rhosts, UAuthen_Kserver, USaveSettings, UCvsApp, UCvsConsole, UCvsFiles, UCvsFolders, UCvsFrame, UCvsGraph, UCvsMenubar, UCvsToolbar, UMacAppMenu, UMenu, UToolbar, and UWidget.

Definition at line 114 of file uevent.cpp.

The documentation for this class was generated from the following files:
  • rf/umain.h
  • rf/uevent.cpp
Generated on Sun Oct 21 12:47:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCmdUI Class Reference

Inheritance diagram for CCmdUI:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/CJLibrary/CJToolBar.cpp
Generated on Sun Oct 21 12:47:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCmdUI Class Reference

#include <umain.h>

Collaboration diagram for UCmdUI:

[legend]
List of all members.

Public Methods

UCmdUI (int id)
virtual | ~UCmdUI ()
virtual void | Enable (bool bOn=true)
virtual void | Check (bool bOn=true)
virtual void | SetText (const char *title)
void | SetContinue (bool state)
bool | CanContinue (void)
virtual void | SetTooltip (const char *tooltip)

Public Attributes

int | m_nID
void * | m_widget
bool | m_continue

Constructor & Destructor Documentation

UCmdUI::UCmdUI ( int id ) [inline]

Definition at line 690 of file umain.h.

00690                    : m_nID(id)
00691 #ifdef WIN32
00692     , pCmdUI(0L)
00693     , pNMHDR(0L)
00694 #endif
00695 #ifdef qMacPP
00696     , m_wrapper(0L)
00697 #endif
00698     , m_widget(0L)
00699     , m_continue(true)
00700         {}

virtual UCmdUI::~UCmdUI ( ) [inline, virtual]

Definition at line 701 of file umain.h.

00701 {}

Member Function Documentation

bool UCmdUI::CanContinue ( void ) [inline]

Definition at line 713 of file umain.h.

Referenced by LMainPseudoAttachment::ExecuteSelf(), UToolbar::OnUpdateUI(), UMenu::OnUpdateUI(), and UMacAppMenu::OnUpdateUI().

00713 { return m_continue; }

void UCmdUI::Check ( bool bOn = true ) [virtual]

Definition at line 482 of file uevent.cpp.

Referenced by UCvsFolders::OnCmdUIIgnore(), UCvsFiles::OnCmdUIIgnore(), and PyCmdUI::SetCheck().

00483 {
00484     m_continue = false;
00485
00486 #ifdef qMacAPP
00487     if((long)m_widget <= 2L)
00488     {
00489         // this is a menu
00490         if(m_widget == 0L)
00491         {
00492             UASSERT("You need to call UCmdUI::Enable before UCmdUI::Check !\n");
00493         }
00494         else
00495         {
00496             ::EnableCheck(m_nID, m_widget == (void *)1L, bOn);
00497         }
00498     }
00499     else
00500     {
00501         TView *view = (TView *)m_widget;
00502         if(MA_MEMBER(view, TCheckBox))
00503         {
00504             ((TCheckBox *)view)->SetState(bOn, kRedraw);
00505         }
00506         else if(MA_MEMBER(view, TRadio))
00507         {
00508             ((TRadio *)view)->SetState(bOn, kRedraw);
00509         }
00510     }
00511 #endif
00512 #ifdef qMacPP
00513     if(m_wrapper != 0L)
00514     {
00515         // this is a menu
00516         *m_wrapper->outUsesMark = true;
00517         *m_wrapper->outMark = bOn ? checkMark : noMark;
00518     }
00519     else
00520     {
00521         LPane *view = (LPane *)m_widget;
00522         if(dynamic_cast<LCheckBox*>(view) != 0L ||
00523             dynamic_cast<LRadioButton*>(view) != 0L ||
00524             dynamic_cast<LCheckBoxGroupBox*>(view) != 0L ||
00525             dynamic_cast<LBevelButton*>(view) != 0L)
00526         {
00527             USemaphore policeman(gTurnOffBroadcast);
00528
00529             view->SetValue(bOn ? Button_On : Button_Off);
00530         }
00531     }
00532 #endif
00533 #ifdef WIN32
00534     if(pCmdUI != 0L)
00535     {
00536         // this is a menu
00537         pCmdUI->SetCheck(bOn ? 1 : 0);
00538     }
00539     else if(m_widget)
00540     {
00541         CWnd *wnd = (CWnd *)m_widget;
00542         if(wnd->IsKindOf(RUNTIME_CLASS(CPseudoToggle)))
00543         {
00544             CPseudoToggle *btn = (CPseudoToggle *)wnd;
00545             btn->SetState(bOn);
00546         }
00547         else if(wnd->IsKindOf(RUNTIME_CLASS(CButton)))
00548         {
00549             CButton *btn = (CButton *)wnd;
00550             btn->SetCheck(bOn ? BST_CHECKED : BST_UNCHECKED);
00551         }
00552     }
00553 #endif
00554 #ifdef qGTK
00555     if(m_widget != 0L)
00556     {
00557         if(GTK_IS_TOGGLE_BUTTON(m_widget))
00558         {
00559             CTurnOffDispatching turnOff;
00560             gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), bOn);
00561         }
00562     }
00563 #endif
00564 }

void UCmdUI::Enable ( bool bOn = true ) [virtual]

Definition at line 417 of file uevent.cpp.

Referenced by PyCmdUI::Enable(), UCvsFiles::OnCmdUIAdd(), UCvsFiles::OnCmdUIAddB(), UCvsFrame::OnCmdUIAnytime(), UCvsFolders::OnCmdUICheckout(), UCvsFrame::OnCmdUICvsCmd(), UCvsFiles::OnCmdUIEditseldef(), UCvsFolders::OnCmdUIExplore(), UCvsFiles::OnCmdUIExplore(), UCvsFiles::OnCmdUIGraph(), UCvsFolders::OnCmdUIIgnore(), UCvsFiles::OnCmdUIIgnore(), UCvsFolders::OnCmdUIImport(), UCvsFrame::OnCmdUIMacroAdmin(), UCvsFiles::OnCmdUIMacroSel(), UCvsFolders::OnCmdUIMacrosSel(), UCvsFrame::OnCmdUIQuit(), UCvsFiles::OnCmdUIRelease(), UCvsFolders::OnCmdUIReload(), UCvsFiles::OnCmdUIReload(), UCvsFiles::OnCmdUIRmv(), UCvsFrame::OnCmdUIStopcvs(), UCvsFiles::OnCmdUITrash(), UCvsFiles::OnCmdUIUpdate(), UCvsFiles::OnCmdUIUpone(), UCvsFolders::OnUpdateGeneric(), UToolbar::OnUpdateUI(), UMenu::OnUpdateUI(), and UMacAppMenu::OnUpdateUI().

00418 {
00419     m_continue = false;
00420
00421 #ifdef qMacAPP
00422     if((long)m_widget <= 2L)
00423     {
00424         // this is a menu
00425         ::Enable(m_nID, bOn);
00426         m_widget = (void *)(bOn ? 1L : 2L);
00427             // see UCmdUI::Check
00428     }
00429     else
00430     {
00431         TView *view = (TView *)m_widget;
00432         if(MA_MEMBER(view, TView))
00433         {
00434             view->SetActiveState(bOn, kRedraw);
00435         }
00436     }
00437 #endif
00438 #ifdef qMacPP
00439     if(m_wrapper != 0L)
00440     {
00441         // this is a menu
00442         *m_wrapper->outEnabled = bOn;
00443     }
00444     else
00445     {
00446         LPane *view = (LPane *)m_widget;
00447         if(view != 0L)
00448         {
00449             if(bOn)
00450                 view->Enable();
00451             else
00452                 view->Disable();
00453         }
00454     }
00455 #endif
00456 #ifdef WIN32
00457     if(pCmdUI != 0L)
00458     {
00459         // this is a menu
00460         pCmdUI->Enable(bOn);
00461     }
00462     else if(m_widget)
00463     {
00464         // this something else
00465         CWnd *wid = (CWnd *)m_widget;
00466         BOOL state = bOn;
00467         if(state != wid->IsWindowEnabled())
00468             wid->EnableWindow(state);
00469     }
00470 #endif
00471 #ifdef qGTK
00472     if(m_widget != 0L)
00473     {
00474         if(GTK_IS_WIDGET(m_widget))
00475         {
00476             gtk_widget_set_sensitive(GTK_WIDGET(m_widget), bOn);
00477         }
00478     }
00479 #endif
00480 }

void UCmdUI::SetContinue ( bool state ) [inline]

Definition at line 712 of file umain.h.

00712 { m_continue = state; }

void UCmdUI::SetText ( const char * title ) [virtual]

Definition at line 566 of file uevent.cpp.

Referenced by UCvsFiles::OnCmdUIEditseldef(), and PyCmdUI::SetText().

00567 {
00568     m_continue = false;
00569
00570 #ifdef qMacAPP
00571     if((long)m_widget <= 2L)
00572     {
00573         // this is a menu
00574         CStr255_AC pstr(title);
00575         SetCommandName(m_nID, pstr);
00576     }
00577     else
00578     {
00579         TCtlMgr *view = (TCtlMgr *)m_widget;
00580         if(MA_MEMBER(view, TCtlMgr))
00581         {
00582             view->SetText(CStr255_AC(title), kRedraw);
00583         }
00584     }
00585 #endif
00586 #ifdef qGTK
00587     if(m_widget != 0L)
00588     {
00589         if(GTK_IS_TOGGLE_BUTTON(m_widget))
00590         {
00591             GtkLabel *label = getLabelFromContainer(GTK_CONTAINER(m_widget));
00592             if(label != 0L)
00593                 gtk_label_set_text(label, title);
00594         }
00595     }
00596 #endif
00597 #ifdef qMacPP
00598     if(m_wrapper != 0L)
00599     {
00600         // this is a menu
00601         LStr255 pstr(title);
00602         LString::CopyPStr(pstr, m_wrapper->outName);
00603     }
00604     else
00605     {
00606         LPane *view = (LPane *)m_widget;
00607         LEditText *edit;
00608         LStaticText *stat;
00609         if((edit = dynamic_cast<LEditText*>(view)) != 0L)
00610         {
00611             edit->SetText((Ptr)title, strlen(title));
00612         }
00613         else if((stat = dynamic_cast<LStaticText*>(view)) != 0L)
00614         {
00615             stat->SetText((Ptr)title, strlen(title));
00616         }
00617     }
00618 #endif
00619 #ifdef WIN32
00620     if(pCmdUI != 0L)
00621     {
00622         // this is a menu
00623         if(title != 0L && *title != '\0')
00624             pCmdUI->SetText(title);
00625     }
00626 #endif
00627 }

void UCmdUI::SetTooltip ( const char * tooltip ) [virtual]

Definition at line 629 of file uevent.cpp.

Referenced by UWidget::OnSetTooltip(), and UToolbar::OnSetTooltip().

00630 {
00631     if(tooltip == 0L)
00632         return;
00633
00634     char status[256] = {'\0'};
00635     char prompt[256] = {'\0'};
00636
00637     strcpy(status, tooltip);
00638     char *cr = strchr(status, '\n');
00639     if(cr != 0L)
00640     {
00641         strcpy(prompt, cr + 1);
00642         *cr = '\0';
00643     }
00644 #ifdef WIN32
00645 #   define _countof(array) (sizeof(array)/sizeof(array[0]))
00646     NMHDR *hdr = (NMHDR *)pNMHDR;
00647     ASSERT(hdr->code == TTN_NEEDTEXTA || hdr->code == TTN_NEEDTEXTW);
00648
00649     TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)hdr;
00650     TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)hdr;
00651 #   ifndef _UNICODE
00652     if (hdr->code == TTN_NEEDTEXTA)
00653         lstrcpyn(pTTTA->szText, prompt, _countof(pTTTA->szText));
00654     else
00655         _mbstowcsz(pTTTW->szText, prompt, _countof(pTTTW->szText));
00656 #   else
00657     if (hdr->code == TTN_NEEDTEXTA)
00658         _wcstombsz(pTTTA->szText, prompt, _countof(pTTTA->szText));
00659     else
00660         lstrcpyn(pTTTW->szText, prompt, _countof(pTTTW->szText));
00661 #   endif
00662 #endif
00663
00664     if(sTooltipHandler != 0L)
00665         sTooltipHandler(status);
00666 }

Member Data Documentation

bool UCmdUI::m_continue

Definition at line 725 of file umain.h.

int UCmdUI::m_nID

Definition at line 704 of file umain.h.

Referenced by LMainPseudoAttachment::ExecuteSelf(), UToolbar::OnUpdateUI(), UMenu::OnUpdateUI(), UMacAppMenu::OnUpdateUI(), and PyDoCmdUI().

void* UCmdUI::m_widget

Definition at line 724 of file umain.h.

Referenced by UToolbar::OnUpdateUI(), and UMenu::OnUpdateUI().

The documentation for this class was generated from the following files:
  • rf/umain.h
  • rf/uevent.cpp
Generated on Sun Oct 21 12:47:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCOLOR Struct Reference

#include <UCvsConsole.h>

Collaboration diagram for UCOLOR:

[legend]
List of all members.

Public Methods

UCOLOR ()
UCOLOR (char _r, char _g, char _b)

Public Attributes

unsigned char | r
unsigned char | g
unsigned char | b

Constructor & Destructor Documentation

UCOLOR::UCOLOR ( ) [inline]

Definition at line 33 of file UCvsConsole.h.

00033 {}

UCOLOR::UCOLOR | ( | char | _r,
 |  | char | _g,
 |  | char | _b
 | ) | [inline]

Definition at line 34 of file UCvsConsole.h.

00034 : r(_r), g(_g), b(_b) {}

Member Data Documentation

unsigned char UCOLOR::b

Definition at line 38 of file UCvsConsole.h.

Referenced by UCvsConsole::FeedThisLine(), and UCvsConsole::OutColor().

unsigned char UCOLOR::g

Definition at line 37 of file UCvsConsole.h.

Referenced by UCvsConsole::FeedThisLine(), and UCvsConsole::OutColor().

unsigned char UCOLOR::r

Definition at line 36 of file UCvsConsole.h.

Referenced by UCvsConsole::FeedThisLine(), and UCvsConsole::OutColor().

The documentation for this struct was generated from the following file:
  • common/UCvsConsole.h
Generated on Sun Oct 21 12:47:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UColor Struct Reference

portable color definition. More...

#include <uwidget.h>

Collaboration diagram for UColor:

[legend]
List of all members.

Public Attributes

unsigned char | r
unsigned char | g
unsigned char | b

Detailed Description

portable color definition.

Definition at line 80 of file uwidget.h.

Member Data Documentation

unsigned char UColor::b

Definition at line 82 of file uwidget.h.

unsigned char UColor::g

Definition at line 82 of file uwidget.h.

unsigned char UColor::r

Definition at line 82 of file uwidget.h.

The documentation for this struct was generated from the following file:
  • rf/uwidget.h
Generated on Sun Oct 21 12:47:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CColorConsole Class Reference

#include <AppConsole.h>

List of all members.

Public Methods

CColorConsole ()
virtual | ~CColorConsole ()
CColorConsole & | operator<< (char c)
CColorConsole & | operator<< (kConsoleColor color)
CColorConsole & | operator<< (const char *str)
CColorConsole & | operator<< (int value)

Constructor & Destructor Documentation

CColorConsole::CColorConsole ( )

Definition at line 195 of file AppConsole.cpp.

00196 {
00197 #ifdef WIN32
00198     fView = 0L;
00199     CWincvsView *view = GetView();
00200     if(view == 0L)
00201         return;
00202
00203     oldFormat = view->GetCurFormat();
00204 #else /* !WIN32 */
00205     *this << kNormal;
00206 #endif /* !WIN32 */
00207 }

CColorConsole::~CColorConsole ( ) [virtual]

Definition at line 221 of file AppConsole.cpp.

00222 {
00223     *this << kNormal;
00224 }

Member Function Documentation

CColorConsole & CColorConsole::operator<< ( int value )

Definition at line 330 of file AppConsole.cpp.

00331 {
00332 #ifdef WIN32
00333     CWincvsView *view = GetView();
00334     if(view == 0L)
00335         return *this;
00336
00337     char tmp[20] = {'\0'};
00338     sprintf(tmp, "%d", value);
00339     view->OutColor(tmp, strlen(tmp));
00340 #endif /* WIN32 */
00341 #ifdef qMacCvsPP
00342     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00343     if(log == 0L)
00344         return *this;
00345
00346     char tmp[20] = {'\0'};
00347     sprintf(tmp, "%d", value);
00348     log->OutColor(tmp, strlen(tmp));
00349 #endif /* qMacCvsPP */
00350 #ifdef qUnix
00351     UCvsConsole *log = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00352     if(log == 0L)
00353         return *this;
00354
00355     char tmp[20] = {'\0'};
00356     sprintf(tmp, "%d", value);
00357     log->OutColor(tmp, strlen(tmp));
00358 #endif /* qUnix */
00359
00360     return *this;
00361 }

CColorConsole & CColorConsole::operator<< ( const char * str )

Definition at line 303 of file AppConsole.cpp.

00304 {
00305 #ifdef WIN32
00306     CWincvsView *view = GetView();
00307     if(view == 0L)
00308         return *this;
00309
00310     view->OutColor(str, strlen(str));
00311 #endif /* WIN32 */
00312 #ifdef qMacCvsPP
00313     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00314     if(log == 0L)
00315         return *this;
00316
00317     log->OutColor(str, strlen(str));
00318 #endif /* qMacCvsPP */
00319 #ifdef qUnix
00320     UCvsConsole *log = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00321     if(log == 0L)
00322         return *this;
00323
00324     log->OutColor(str, strlen(str));
00325 #endif /* qUnix */
00326
00327     return *this;
00328 }

CColorConsole & CColorConsole::operator<< ( kConsoleColor color )

Definition at line 253 of file AppConsole.cpp.

00254 {
00255 #ifdef WIN32
00256     CWincvsView *view = GetView();
00257     if(view == 0L)
00258         return *this;
00259
00260     if(color == kNL)
00261     {
00262         char tmp[2] = {0x0a};
00263         view->OutColor(tmp, 1);
00264     }
00265     else if(color == kNormal)
00266     {
00267         oldFormat.dwMask = CFM_COLOR | CFM_BOLD | CFM_ITALIC | CFE_UNDERLINE;
00268         view->OutColor(oldFormat);
00269     }
00270     else
00271         view->OutColor(color);
00272 #endif /* WIN32 */
00273 #ifdef qMacCvsPP
00274     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00275     if(log == 0L)
00276         return *this;
00277
00278     if(color == kNL)
00279     {
00280         char tmp[1] = {0x0d};
00281         log->OutColor(tmp, 1);
00282     }
00283     else
00284         log->OutColor(color);
00285 #endif /* qMacCvsPP */
00286 #ifdef qUnix
00287     UCvsConsole *log = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00288     if(log == 0L)
00289         return *this;
00290
00291     if(color == kNL)
00292     {
00293         char tmp[1] = {0x0a};
00294         log->OutColor(tmp, 1);
00295     }
00296     else
00297         log->OutColor(color);
00298 #endif /* qUnix */
00299
00300     return *this;
00301 }

CColorConsole & CColorConsole::operator<< ( char c )

Definition at line 226 of file AppConsole.cpp.

00227 {
00228 #ifdef WIN32
00229     CWincvsView *view = GetView();
00230     if(view == 0L)
00231         return *this;
00232
00233     view->OutColor(&c, 1);
00234 #endif /* WIN32 */
00235 #ifdef qMacCvsPP
00236     CLogWindow *log = CMacCvsApp::app != 0L ? CMacCvsApp::app->GetLogWindow() : 0L;
00237     if(log == 0L)
00238         return *this;
00239
00240     log->OutColor(&c, 1);
00241 #endif /* qMacCvsPP */
00242 #ifdef qUnix
00243     UCvsConsole *log = (UCvsConsole *)::UEventQueryWidget(kUMainConsoleID);
00244     if(log == 0L)
00245         return *this;
00246
00247     log->OutColor(&c, 1);
00248 #endif /* qUnix */
00249
00250     return *this;
00251 }

The documentation for this class was generated from the following files:
  • common/AppConsole.h
  • common/AppConsole.cpp
Generated on Sun Oct 21 12:47:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CColorStatic Class Reference

#include <ColorStatic.h>

Inheritance diagram for CColorStatic:

[legend]
Collaboration diagram for CColorStatic:

[legend]
List of all members.

Public Methods

CColorStatic ()
COLORREF | GetColor ()
void | SetColor (COLORREF color)
virtual | ~CColorStatic ()

Protected Methods

afx_msg void | OnPaint ()

Private Attributes

COLORREF | m_color

Constructor & Destructor Documentation

CColorStatic::CColorStatic ( )

Definition at line 38 of file ColorStatic.cpp.

00039 {
00040     m_color = RGB(255, 255, 255);
00041 }

CColorStatic::~CColorStatic ( ) [virtual]

Definition at line 43 of file ColorStatic.cpp.

00044 {
00045 }

Member Function Documentation

COLORREF CColorStatic::GetColor ( )

Definition at line 66 of file ColorStatic.cpp.

00067 {
00068     return m_color;
00069 }

void CColorStatic::OnPaint ( ) [protected]

Definition at line 71 of file ColorStatic.cpp.

00072 {
00073     CPaintDC dc(this); // device context for painting
00074
00075     CRect rect;
00076     GetClientRect(rect);
00077     dc.FillSolidRect(rect, m_color);
00078
00079     // Do not call CStatic::OnPaint() for painting messages
00080 }

void CColorStatic::SetColor ( COLORREF color )

Definition at line 57 of file ColorStatic.cpp.

00058 {
00059     m_color = color;
00060     if( IsWindow(m_hWnd) )
00061     {
00062         RedrawWindow();
00063     }
00064 }

Member Data Documentation

COLORREF CColorStatic::m_color [private]

Definition at line 68 of file ColorStatic.h.

The documentation for this class was generated from the following files:
  • WinCvs/ColorStatic.h
  • WinCvs/ColorStatic.cpp
Generated on Sun Oct 21 12:47:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CComboBox Class Reference

Inheritance diagram for CComboBox:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJFlatComboBox.h
Generated on Sun Oct 21 12:47:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CComboBoxEx Class Reference

Inheritance diagram for CComboBoxEx:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/HistComboBoxEx.h
Generated on Sun Oct 21 12:47:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CComCoClass Class Reference

Inheritance diagram for CComCoClass:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CoWorker/CvsCoworker.h
Generated on Sun Oct 21 12:47:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


commit_info Struct Reference

Collaboration diagram for commit_info:

[legend]
List of all members.

Public Attributes

Ctype status
char * | rev
char * | tag
char * | options

Member Data Documentation

char* commit_info::options

Definition at line 64 of file commit.c.

char* commit_info::rev

Definition at line 62 of file commit.c.

Ctype commit_info::status

Definition at line 61 of file commit.c.

char* commit_info::tag

Definition at line 63 of file commit.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/commit.c
Generated on Sun Oct 21 12:47:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CComModule Class Reference

Inheritance diagram for CComModule:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/StdAfx.h
Generated on Sun Oct 21 12:47:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CComObjectRootEx Class Reference

Inheritance diagram for CComObjectRootEx:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CoWorker/CvsCoworker.h
Generated on Sun Oct 21 12:47:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


config_s Struct Reference

Collaboration diagram for config_s:

[legend]
List of all members.

Public Attributes

ush good_length
ush max_lazy
ush nice_length
ush max_chain
compress_func func

Member Data Documentation

compress_func config_s::func

Definition at line 120 of file deflate.c.

ush config_s::good_length

Definition at line 116 of file deflate.c.

ush config_s::max_chain

Definition at line 119 of file deflate.c.

ush config_s::max_lazy

Definition at line 117 of file deflate.c.

ush config_s::nice_length

Definition at line 118 of file deflate.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/zlib/deflate.c
Generated on Sun Oct 21 12:47:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CContentItems Class Reference

#include <CJOutlookBar.h>

Collaboration diagram for CContentItems:

[legend]
List of all members.

Public Methods

CContentItems (UINT nID, CString str)
void | operator= (CContentItems &pItems)
virtual UINT | GetImageID ()
virtual CString | GetText ()

Protected Attributes

UINT | m_nImageID
CString | m_csText

Constructor & Destructor Documentation

_CJXLIB_INLINE CContentItems::CContentItems | ( | UINT | nID,
 |  | CString | str
 | ) |

Definition at line 194 of file CJOutlookBar.h.

00195     { m_nImageID = nID; m_csText = str; }

Member Function Documentation

_CJXLIB_INLINE UINT CContentItems::GetImageID ( ) [virtual]

Definition at line 200 of file CJOutlookBar.h.

Referenced by CCJOutlookBar::DrawItem().

00201     { return m_nImageID; }

_CJXLIB_INLINE CString CContentItems::GetText ( ) [virtual]

Definition at line 197 of file CJOutlookBar.h.

Referenced by CCJOutlookBar::DrawItem().

00198     { return m_csText; }

_CJXLIB_INLINE void CContentItems::operator= ( CContentItems & pItems )

Definition at line 203 of file CJOutlookBar.h.

00204     { m_nImageID = pItems.m_nImageID; m_csText = pItems.m_csText; }

Member Data Documentation

CString CContentItems::m_csText [protected]

Definition at line 96 of file CJOutlookBar.h.

Referenced by operator=().

UINT CContentItems::m_nImageID [protected]

Definition at line 95 of file CJOutlookBar.h.

Referenced by operator=().

The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJOutlookBar.h
Generated on Sun Oct 21 12:47:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


context Struct Reference

Collaboration diagram for context:

[legend]
List of all members.

Public Attributes

FILE * | debuglog
char * | root
char * | local
SCC_outproc outproc

Member Data Documentation

FILE* context::debuglog

Definition at line 14 of file scc.c.

Referenced by SccAddFromScc(), SccCheckout(), SccCloseProject(), SccGet(), SccGetProjPath(), SccInitialize(), SccOpenProject(), and SccUninitialize().

char* context::local

Definition at line 20 of file scc.c.

Referenced by SccOpenProject().

SCC_outproc context::outproc

Definition at line 21 of file scc.c.

Referenced by SccOpenProject(), and malloc_error().

char* context::root

Definition at line 18 of file scc.c.

Referenced by SccCloseProject(), SccInitialize(), and SccOpenProject().

The documentation for this struct was generated from the following file:
  • cvs-1.10/windows-NT/SCC/scc.c
Generated on Sun Oct 21 12:47:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CControlBar Class Reference

Inheritance diagram for CControlBar:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJToolBarBase.h
Generated on Sun Oct 21 12:47:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ct_data_s Struct Reference

#include <deflate.h>

Collaboration diagram for ct_data_s:

[legend]
List of all members.

Public Attributes

ct_data_s:: { ... } | fc
ct_data_s:: { ... } | dl
ush freq
ush code
ush dad
ush len

Member Data Documentation

ush ct_data_s::code

Definition at line 53 of file deflate.h.

ush ct_data_s::dad

Definition at line 56 of file deflate.h.

union { ... } ct_data_s::dl

union { ... } ct_data_s::fc

ush ct_data_s::freq

Definition at line 52 of file deflate.h.

ush ct_data_s::len

Definition at line 57 of file deflate.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/zlib/deflate.h
Generated on Sun Oct 21 12:47:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCtrlView Class Reference

Inheritance diagram for CCtrlView:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJTabView.h
Generated on Sun Oct 21 12:47:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCustInvertTable Class Reference

Inheritance diagram for CCustInvertTable:

[legend]
Collaboration diagram for CCustInvertTable:

[legend]
List of all members.

Public Methods

CCustInvertTable ()
virtual | ~CCustInvertTable ()
void | Initialize ()

Protected Attributes

std::vector< char *> | m_garbage

Constructor & Destructor Documentation

CCustInvertTable::CCustInvertTable ( )

Definition at line 94 of file CustomizeMenus.cpp.

00095 {
00096     // init the cmd table with the static MFC commands
00097     const CustInvertTable *tmp = sInitInvTable;
00098     CustInvertTable newEntry;
00099     while(tmp->key != 0L)
00100     {
00101         newEntry = *tmp;
00102         push_back(newEntry);
00103         tmp++;
00104     }
00105 }

CCustInvertTable::~CCustInvertTable ( ) [virtual]

Definition at line 107 of file CustomizeMenus.cpp.

00108 {
00109     std::vector<char *>::iterator i;
00110     for(i = m_garbage.begin(); i != m_garbage.end(); ++i)
00111     {
00112         free(*i);
00113     }
00114 }

Member Function Documentation

void CCustInvertTable::Initialize ( )

Definition at line 116 of file CustomizeMenus.cpp.

00117 {
00118     if(m_garbage.size() != 0)
00119         return;
00120
00121 #if 0 // fix me, Python
00122     vector<CMacroEntry>::const_iterator i;
00123     int cnt;
00124     CustInvertTable newEntry;
00125     for(cnt = 0, i = gMacrosAdmin.entries.begin(); i != gMacrosAdmin.entries.end(); ++i, cnt++)
00126     {
00127         newEntry.cmd = ID_MACRO_ADMIN + cnt;
00128         char *name = strdup((*i).name);
00129         m_garbage.push_back(name);
00130         newEntry.key = name;
00131         newEntry.title = name;
00132         push_back(newEntry);
00133     }
00134     for(cnt = 0, i = gMacrosSel.entries.begin(); i != gMacrosSel.entries.end(); ++i, cnt++)
00135     {
00136         newEntry.cmd = ID_MACRO_SEL + cnt;
00137         char *name = strdup((*i).name);
00138         m_garbage.push_back(name);
00139         newEntry.key = name;
00140         newEntry.title = name;
00141         push_back(newEntry);
00142     }
00143 #endif
00144 }

Member Data Documentation

std::vector<char *> CCustInvertTable::m_garbage [protected]

Definition at line 91 of file CustomizeMenus.cpp.

The documentation for this class was generated from the following file:
  • WinCvs/CustomizeMenus.cpp
Generated on Sun Oct 21 12:47:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCustomizeMenus Class Reference

#include <CustomizeMenus.h>

Inheritance diagram for CCustomizeMenus:

[legend]
Collaboration diagram for CCustomizeMenus:

[legend]
List of all members.

Public Types

enum | { IDD = IDD_CUSTOMIZE }

Public Methods

CCustomizeMenus (CMMenuString *fromMenu, CWnd *pParent=NULL)

Public Attributes

CListCtrl m_menuList
CListCtrl m_cmdsList
CButton m_upbtn
CButton m_removebtn
CButton m_downbtn
CButton m_addbtn

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
void | OnMove (int offset)
virtual void | OnOK ()
int | GetIcon (const CustInvertTable *entry)
afx_msg void | OnRemove ()
afx_msg void | OnAdd ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnItemchangedAllcmds (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnDblclkMenulist (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnDblclkAllcmds (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnItemchangedMenulist (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnDown ()
afx_msg void | OnUp ()
afx_msg void | OnBegindragMenulist (NMHDR *pNMHDR, LRESULT *pResult)

Protected Attributes

CMMenuString * m_Menu
CImageList | m_SmallImageList

Member Enumeration Documentation

anonymous enum

Enumeration values:
IDD

Definition at line 78 of file CustomizeMenus.h.

00078 { IDD = IDD_CUSTOMIZE };

Constructor & Destructor Documentation

CCustomizeMenus::CCustomizeMenus | ( | CMMenuString * | fromMenu,
 |  | CWnd * | pParent = NULL
 | ) |

Definition at line 189 of file CustomizeMenus.cpp.

00190     : CDialog(CCustomizeMenus::IDD, pParent), m_Menu(fromMenu)
00191 {
00192     //{{AFX_DATA_INIT(CCustomizeMenus)
00193     //}}AFX_DATA_INIT
00194 }

Member Function Documentation

void CCustomizeMenus::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 197 of file CustomizeMenus.cpp.

00198 {
00199     CDialog::DoDataExchange(pDX);
00200     //{{AFX_DATA_MAP(CCustomizeMenus)
00201     DDX_Control(pDX, IDC_MENULIST, m_menuList);
00202     DDX_Control(pDX, IDC_ALLCMDS, m_cmdsList);
00203     DDX_Control(pDX, IDC_UP, m_upbtn);
00204     DDX_Control(pDX, IDC_REMOVE, m_removebtn);
00205     DDX_Control(pDX, IDC_DOWN, m_downbtn);
00206     DDX_Control(pDX, IDC_ADD, m_addbtn);
00207     //}}AFX_DATA_MAP
00208
00209     if(!pDX->m_bSaveAndValidate)
00210     {
00211         // initialize the buttons
00212         m_upbtn.EnableWindow(FALSE);
00213         m_downbtn.EnableWindow(FALSE);
00214         m_addbtn.EnableWindow(FALSE);
00215         m_removebtn.EnableWindow(FALSE);
00216         m_cmdsList.SetExtendedStyle(
00217             m_cmdsList.GetExtendedStyle() |
00218             LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
00219         m_menuList.SetExtendedStyle(
00220             m_menuList.GetExtendedStyle() |
00221             LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
00222     }
00223 }

int CCustomizeMenus::GetIcon ( const CustInvertTable * entry ) [protected]

Definition at line 510 of file CustomizeMenus.cpp.

Referenced by OnAdd(), OnInitDialog(), and OnMove().

00511 {
00512     if(entry->cmd == ID_SEPARATOR)
00513         return 0;
00514
00515     if(entry->cmd >= ID_MACRO_SEL && entry->cmd < (ID_MACRO_SEL + 100))
00516         return 2;
00517
00518     if(entry->cmd >= ID_MACRO_ADMIN && entry->cmd < (ID_MACRO_ADMIN + 100))
00519         return 2;
00520
00521     return 1;
00522 }

void CCustomizeMenus::OnAdd ( ) [protected]

Definition at line 270 of file CustomizeMenus.cpp.

Referenced by OnDblclkAllcmds().

00271 {
00272     int nItem = m_cmdsList.GetNextItem(-1, LVNI_SELECTED);
00273     if(nItem == -1)
00274         return;
00275
00276     const CustInvertTable *data = (const CustInvertTable *)
00277         m_cmdsList.GetItemData(nItem);
00278
00279     LV_ITEM lvi;
00280     lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
00281     lvi.iItem = m_menuList.GetItemCount();
00282     lvi.iSubItem = 0;
00283     lvi.lParam = (DWORD)data;
00284     lvi.pszText = GetInvString(data);
00285     lvi.iImage = GetIcon(data);
00286
00287     int newItem = m_menuList.InsertItem(&lvi);
00288     VERIFY(m_menuList.EnsureVisible(newItem, TRUE));
00289     VERIFY(m_menuList.SetItemState(newItem, LVIS_SELECTED, LVIS_SELECTED));
00290
00291     if(data->cmd != ID_SEPARATOR)
00292     {
00293         VERIFY(m_cmdsList.DeleteItem(nItem));
00294     }
00295 }

void CCustomizeMenus::OnBegindragMenulist | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 502 of file CustomizeMenus.cpp.

00503 {
00504     NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
00505     // TODO: Add your control notification handler code here
00506
00507     *pResult = 0;
00508 }

void CCustomizeMenus::OnDblclkAllcmds | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 426 of file CustomizeMenus.cpp.

00427 {
00428     OnAdd();
00429
00430     *pResult = 0;
00431 }

void CCustomizeMenus::OnDblclkMenulist | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 419 of file CustomizeMenus.cpp.

00420 {
00421     OnRemove();
00422
00423     *pResult = 0;
00424 }

void CCustomizeMenus::OnDown ( ) [protected]

Definition at line 492 of file CustomizeMenus.cpp.

00493 {
00494     OnMove(1);
00495 }

BOOL CCustomizeMenus::OnInitDialog ( ) [protected, virtual]

Definition at line 331 of file CustomizeMenus.cpp.

00332 {
00333     m_SmallImageList.Create(IDR_CUSTMENUS, 16, 1, RGB(255, 255, 255));
00334     sInvTable.Initialize();
00335
00336     CDialog::OnInitDialog();
00337
00338     LV_COLUMN lvc;
00339     int cnt;
00340     const std::vector<UStr> & list = m_Menu->GetList();
00341
00342     // Get the client rect of the list view control
00343     CRect rect;
00344     m_cmdsList.GetClientRect(&rect);
00345
00346     // Make the width of the column to the width of the client area minus
00347     // the width of a scroll bar
00348     int nWidth = rect.right - ::GetSystemMetrics(SM_CXVSCROLL);
00349
00350     // first the left list
00351     lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
00352     lvc.iSubItem = 0;
00353     lvc.cx = nWidth;
00354     lvc.fmt = LVCFMT_LEFT;
00355     m_cmdsList.InsertColumn(0, &lvc);
00356     m_cmdsList.SetImageList(&m_SmallImageList, LVSIL_SMALL);
00357
00358     std::vector<CustInvertTable>::const_iterator table;
00359     for(cnt = 0, table = sInvTable.begin(); table != sInvTable.end(); ++table, cnt++)
00360     {
00361         const CustInvertTable & tablEntry = *table;
00362         if(table->cmd != ID_SEPARATOR && IsInInvertList(&tablEntry, list))
00363             continue;
00364
00365         LV_ITEM lvi;
00366         lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
00367         lvi.iItem = cnt;
00368         lvi.iSubItem = 0;
00369         lvi.lParam = (DWORD)&tablEntry;
00370         lvi.pszText = GetInvString(&tablEntry);
00371         lvi.iImage = GetIcon(table);
00372
00373         m_cmdsList.InsertItem(&lvi);
00374     }
00375
00376     m_cmdsList.SortItems(_Compare, 0L);
00377
00378     // then the right one
00379     lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
00380     lvc.iSubItem = 0;
00381     lvc.cx = nWidth;
00382     lvc.fmt = LVCFMT_LEFT;
00383     m_menuList.InsertColumn(0, &lvc);
00384     m_menuList.SetImageList(&m_SmallImageList, LVSIL_SMALL);
00385
00386     std::vector<UStr>::const_iterator i;
00387
00388     for(cnt = 0, i = list.begin(); i != list.end(); ++i, cnt++)
00389     {
00390         const CustInvertTable *tab = CustGetByKey(*i);
00391         if(tab == 0L)
00392             continue;
00393
00394         LV_ITEM lvi;
00395         lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
00396         lvi.iItem = cnt;
00397         lvi.iSubItem = 0;
00398         lvi.lParam = (DWORD)tab;
00399         lvi.pszText = GetInvString(tab);
00400         lvi.iImage = GetIcon(tab);
00401
00402         m_menuList.InsertItem(&lvi);
00403     }
00404
00405     return TRUE;  // return TRUE unless you set the focus to a control
00406                   // EXCEPTION: OCX Property Pages should return FALSE
00407 }

void CCustomizeMenus::OnItemchangedAllcmds | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 409 of file CustomizeMenus.cpp.

00410 {
00411     NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
00412     // TODO: Add your control notification handler code here
00413
00414     *pResult = 0;
00415     int nItem = m_cmdsList.GetNextItem(-1, LVNI_SELECTED);
00416     m_addbtn.EnableWindow(nItem != -1);
00417 }

void CCustomizeMenus::OnItemchangedMenulist | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 433 of file CustomizeMenus.cpp.

00434 {
00435     NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
00436     // TODO: Add your control notification handler code here
00437
00438     *pResult = 0;
00439     int nItem = m_menuList.GetNextItem(-1, LVNI_SELECTED);
00440     m_removebtn.EnableWindow(nItem != -1);
00441
00442     if(nItem == -1)
00443     {
00444         m_upbtn.EnableWindow(FALSE);
00445         m_downbtn.EnableWindow(FALSE);
00446     }
00447     else if(nItem == 0)
00448     {
00449         m_upbtn.EnableWindow(FALSE);
00450         m_downbtn.EnableWindow(m_menuList.GetItemCount() > 1 ? TRUE : FALSE);
00451     }
00452     else if(nItem == m_menuList.GetItemCount() - 1)
00453     {
00454         m_upbtn.EnableWindow(TRUE);
00455         m_downbtn.EnableWindow(FALSE);
00456     }
00457     else
00458     {
00459         m_upbtn.EnableWindow(TRUE);
00460         m_downbtn.EnableWindow(TRUE);
00461     }
00462 }

void CCustomizeMenus::OnMove ( int offset ) [protected]

Definition at line 464 of file CustomizeMenus.cpp.

Referenced by OnDown(), and OnUp().

00465 {
00466     int nItem = m_menuList.GetNextItem(-1, LVNI_SELECTED);
00467     if(nItem == -1)
00468         return;
00469
00470     const CustInvertTable *data = (const CustInvertTable *)
00471         m_menuList.GetItemData(nItem);
00472
00473     int newPos = nItem + offset;
00474     if(newPos < 0 || newPos > m_menuList.GetItemCount())
00475         return;
00476
00477     VERIFY(m_menuList.DeleteItem(nItem));
00478
00479     LV_ITEM lvi;
00480     lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
00481     lvi.iItem = newPos;
00482     lvi.iSubItem = 0;
00483     lvi.lParam = (DWORD)data;
00484     lvi.pszText = GetInvString(data);
00485     lvi.iImage = GetIcon(data);
00486
00487     int newItem = m_menuList.InsertItem(&lvi);
00488     VERIFY(m_menuList.EnsureVisible(newItem, TRUE));
00489     VERIFY(m_menuList.SetItemState(newItem, LVIS_SELECTED, LVIS_SELECTED));
00490 }

void CCustomizeMenus::OnOK ( void ) [protected, virtual]

Definition at line 314 of file CustomizeMenus.cpp.

00315 {
00316     std::vector<UStr> & list = m_Menu->GetList();
00317     list.erase(list.begin(), list.end());
00318
00319     int nItem = -1;
00320     while((nItem = m_menuList.GetNextItem(nItem, LVNI_ALL)) != -1)
00321     {
00322         const CustInvertTable *data = (const CustInvertTable *)
00323             m_menuList.GetItemData(nItem);
00324
00325         list.push_back(data->key);
00326     }
00327
00328     CDialog::OnOK();
00329 }

void CCustomizeMenus::OnRemove ( ) [protected]

Definition at line 243 of file CustomizeMenus.cpp.

Referenced by OnDblclkMenulist().

00244 {
00245     int nItem = m_menuList.GetNextItem(-1, LVNI_SELECTED);
00246     if(nItem == -1)
00247         return;
00248
00249     const CustInvertTable *data = (const CustInvertTable *)
00250         m_menuList.GetItemData(nItem);
00251
00252     if(data->cmd != ID_SEPARATOR)
00253     {
00254         LV_ITEM lvi;
00255         lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
00256         lvi.iItem = m_cmdsList.GetItemCount();
00257         lvi.iSubItem = 0;
00258         lvi.lParam = (DWORD)data;
00259         lvi.pszText = GetInvString(data);
00260         lvi.iImage = GetIcon(data);
00261
00262         int newItem = m_cmdsList.InsertItem(&lvi);
00263         VERIFY(m_cmdsList.EnsureVisible(newItem, TRUE));
00264         VERIFY(m_cmdsList.SetItemState(newItem, LVIS_SELECTED, LVIS_SELECTED));
00265     }
00266
00267     VERIFY(m_menuList.DeleteItem(nItem));
00268 }

void CCustomizeMenus::OnUp ( ) [protected]

Definition at line 497 of file CustomizeMenus.cpp.

00498 {
00499     OnMove(-1);
00500 }

Member Data Documentation

CMMenuString* CCustomizeMenus::m_Menu [protected]

Definition at line 97 of file CustomizeMenus.h.

CImageList CCustomizeMenus::m_SmallImageList [protected]

Definition at line 98 of file CustomizeMenus.h.

CButton CCustomizeMenus::m_addbtn

Definition at line 84 of file CustomizeMenus.h.

CListCtrl CCustomizeMenus::m_cmdsList

Definition at line 80 of file CustomizeMenus.h.

CButton CCustomizeMenus::m_downbtn

Definition at line 83 of file CustomizeMenus.h.

CListCtrl CCustomizeMenus::m_menuList

Definition at line 79 of file CustomizeMenus.h.

CButton CCustomizeMenus::m_removebtn

Definition at line 82 of file CustomizeMenus.h.

CButton CCustomizeMenus::m_upbtn

Definition at line 81 of file CustomizeMenus.h.

The documentation for this class was generated from the following files:
  • WinCvs/CustomizeMenus.h
  • WinCvs/CustomizeMenus.cpp
Generated on Sun Oct 21 12:47:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCVS_CoworkerModule Class Reference

#include <StdAfx.h>

Inheritance diagram for CCVS_CoworkerModule:

[legend]
Collaboration diagram for CCVS_CoworkerModule:

[legend]
List of all members.

Public Methods

LONG | Unlock ()
LONG | Lock ()
LPCTSTR | FindOneOf (LPCTSTR p1, LPCTSTR p2)

Public Attributes

DWORD | dwThreadID

Member Function Documentation

LPCTSTR CCVS_CoworkerModule::FindOneOf | ( | LPCTSTR | p1,
 |  | LPCTSTR | p2
 | ) |

Definition at line 79 of file wincvs.cpp.

Referenced by CWincvsApp::InitATL().

00080 {
00081     while (*p1 != NULL)
00082     {
00083         LPCTSTR p = p2;
00084         while (*p != NULL)
00085         {
00086             if (*p1 == *p)
00087                 return CharNext(p1);
00088             p = CharNext(p);
00089         }
00090         p1++;
00091     }
00092     return NULL;
00093 }

LONG CCVS_CoworkerModule::Lock ( )

Definition at line 74 of file wincvs.cpp.

00075 {
00076     AfxOleLockApp();
00077     return 1;
00078 }

LONG CCVS_CoworkerModule::Unlock ( )

Definition at line 68 of file wincvs.cpp.

00069 {
00070     AfxOleUnlockApp();
00071     return 0;
00072 }

Member Data Documentation

DWORD CCVS_CoworkerModule::dwThreadID

Definition at line 50 of file StdAfx.h.

Referenced by CWincvsApp::InitATL().

The documentation for this class was generated from the following files:
  • WinCvs/StdAfx.h
  • WinCvs/wincvs.cpp
Generated on Sun Oct 21 12:47:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


cvs_MD5Context Struct Reference

#include <md5.h>

Collaboration diagram for cvs_MD5Context:

[legend]
List of all members.

Public Attributes

cvs_uint32 | buf [4]
cvs_uint32 | bits [2]
unsigned char | in [64]

Member Data Documentation

cvs_uint32 cvs_MD5Context::bits[2]

Definition at line 15 of file md5.h.

cvs_uint32 cvs_MD5Context::buf[4]

Definition at line 14 of file md5.h.

unsigned char cvs_MD5Context::in[64]

Definition at line 16 of file md5.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/lib/md5.h
Generated on Sun Oct 21 12:47:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsApp Class Reference

#include <UCvsApp.h>

Inheritance diagram for UCvsApp:

[legend]
Collaboration diagram for UCvsApp:

[legend]
List of all members.

Public Types

enum | { kProcessTimer = EV_COMMAND_START }

Public Methods

UCvsApp (int argc, char **argv)
virtual | ~UCvsApp ()
void | SayWelcome (void)
void | SetCvsRunning (bool state)
bool | IsCvsRunning (void)
void | SetCvsStopping (bool state)
bool | IsCvsStopping (void)
UCvsFolders * | GetBrowserView (void)
UCvsFiles * | GetFilesView (void)
const char * | GetAppName (void) const
const char * | GetAppLibFolder (void) const
const char * | GetAppVersion (void) const
void | Execute (int argc, char *const *argv)

Static Public Attributes

UCvsApp * | gApp = 0L
CvsProcess * | gCurCvs = 0L

Protected Methods

void | OnMainTimer (long time)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

bool | gCvsRunning
bool | gCvsStopping

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

anonymous enum

Enumeration values:
kProcessTimer

Definition at line 70 of file UCvsApp.h.

00071     {
00072         kProcessTimer = EV_COMMAND_START
00073     };

Constructor & Destructor Documentation

UCvsApp::UCvsApp | ( | int | argc,
 |  | char ** | argv
 | ) |

Definition at line 76 of file UCvsApp.cpp.

00076                                       : UWidget(::UEventGetWidID()), gCvsRunning(false), gCvsStopping(false)
00077 {
00078     gApp = this;
00079
00080 #if qGTK
00081     add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps");
00082     add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");
00083 #endif
00084
00085     // load the persistent values (i.e. preferences) and the locate the macros
00086     gCvsPrefs.load();
00087     MacrosReloadAll();
00088
00089     AddTimer(50, kProcessTimer);
00090
00091     if(argc > 0)
00092     {
00093         static struct option long_options[] =
00094         {
00095             {"root", required_argument, 0L, 1},
00096             {0, 0, 0, 0}
00097         };
00098         optind = 0;
00099         int option_index = 0, c;
00100         while ((c = getopt_long
00101                 (argc, argv, "+", long_options, &option_index)) != EOF)
00102         {
00103             switch (c)
00104             {
00105             case 1:
00106                 UCvsFolders::SetDefaultRoot(optarg);
00107                 break;
00108             default:
00109                 cvs_err("Warning : unknown option\n");
00110                 usage();
00111                 break;
00112             }
00113         }
00114
00115     }
00116 }

UCvsApp::~UCvsApp ( ) [virtual]

Definition at line 118 of file UCvsApp.cpp.

00119 {
00120 }

Member Function Documentation

void UCvsApp::Execute | ( | int | argc,
 |  | char *const * | argv
 | ) |

Definition at line 351 of file UCvsApp.cpp.

Referenced by UCvsFiles::EditSel(), UCvsFolders::OnCmdExplore(), and UCvsFiles::OnCmdExplore().

00352 {
00353 #if qUnix
00354     gnome_execute_async_with_env_fds(0L, argc, argv, 0, 0L, true);
00355 #endif
00356 }

const char * UCvsApp::GetAppLibFolder ( void ) const

Definition at line 197 of file UCvsApp.cpp.

00198 {
00199 #if qUnix
00200     return EXECLIB;
00201 #else
00202     return 0L;
00203 #endif
00204 }

const char * UCvsApp::GetAppName ( void ) const

Definition at line 175 of file UCvsApp.cpp.

Referenced by UCvsFrame::OnCopyrights(), and UCvsFrame::OnCredits().

00176 {
00177 #ifdef macintosh
00178     return "MacCvs";
00179 #elif defined(WIN32)
00180     return "WinCvs";
00181 #elif defined(qUnix)
00182     return PACKAGE;
00183 #endif
00184 }

const char * UCvsApp::GetAppVersion ( void ) const

Definition at line 186 of file UCvsApp.cpp.

Referenced by UCvsFrame::OnCredits().

00187 {
00188 #ifdef macintosh
00189
00190 #elif defined(WIN32)
00191
00192 #elif defined(qUnix)
00193     return VERSION;
00194 #endif
00195 }

const UMSGMAP* UCvsApp::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

UCvsFolders * UCvsApp::GetBrowserView ( void )

Definition at line 157 of file UCvsApp.cpp.

Referenced by UCvsFrame::OnBrowserPopup(), UCvsFrame::OnCmdSaveSettings(), UCvsFrame::OnComboSelDir(), UCvsFiles::ResetView(), and CvsPrefs::save().

00158 {
00159     UCmdTarget *cmd = UEventQueryWidget(kUCvsFoldersID);
00160     if(cmd != 0L && cmd->IsKindOf(URUNTIME_CLASS(UCvsFolders)))
00161         return (UCvsFolders *)cmd;
00162
00163     return 0L;
00164 }

UCvsFiles * UCvsApp::GetFilesView ( void )

Definition at line 166 of file UCvsApp.cpp.

Referenced by OnMainTimer(), UCvsFolders::ResetBrowser(), and UCvsFolders::ResetView().

00167 {
00168     UCmdTarget *cmd = UEventQueryWidget(kUCvsFilesID);
00169     if(cmd != 0L && cmd->IsKindOf(URUNTIME_CLASS(UCvsFiles)))
00170         return (UCvsFiles *)cmd;
00171
00172     return 0L;
00173 }

virtual const UMSGMAP* UCvsApp::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

const UMSGMAP* UCvsApp::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

bool UCvsApp::IsCvsRunning ( void ) [inline]

Definition at line 51 of file UCvsApp.h.

Referenced by UCvsFrame::AskForQuitting(), UCvsFolders::DisableGeneric(), UCvsFolders::OnCmdUICheckout(), UCvsFolders::OnCmdUIImport(), UCvsFolders::OnCmdUIReload(), and UCvsFrame::OnCmdUIStopcvs().

00051 { return gCvsRunning; }

bool UCvsApp::IsCvsStopping ( void ) [inline]

Definition at line 55 of file UCvsApp.h.

Referenced by UCvsFrame::OnCmdUIStopcvs().

00055 { return gCvsStopping; }

void UCvsApp::OnMainTimer ( long time ) [protected]

Definition at line 358 of file UCvsApp.cpp.

00359 {
00360     if(gCurCvs != 0L)
00361     {
00362         cvs_process_give_time();
00363         if(!cvs_process_is_active(gCurCvs))
00364         {
00365             UCvsApp::gApp->SetCvsRunning(false);
00366             gCurCvs = 0L;
00367             UWidget::DoValidUI(false);
00368             UCvsApp::gApp->GetFilesView()->ResetView();
00369         }
00370     }
00371 }

void UCvsApp::SayWelcome ( void )

Definition at line 122 of file UCvsApp.cpp.

00123 {
00124     // say hello from the application, optionnaly prompt for the CVSROOT
00125     cvs_out("Welcome to %s %s\n", PACKAGE, VERSION);
00126     if(gCvsPrefs.empty())
00127         CompatGetPrefs();
00128     else
00129         cvs_out("CVSROOT: %s (%s)\n", (const char *)gCvsPrefs, gAuthen.kindstr());
00130
00131     if(CTcl_Interp::IsAvail())
00132     {
00133         cvs_out("TCL is available, shell and macros are enabled : help (select and press enter)\n");
00134     }
00135     else
00136     {
00137         cvs_err("TCL is *not* available, shell and macros are disabled\n");
00138     }
00139 }

void UCvsApp::SetCvsRunning ( bool state )

Definition at line 141 of file UCvsApp.cpp.

Referenced by OnMainTimer().

00142 {
00143     if(state ^ gCvsRunning)
00144     {
00145         gCvsRunning = state;
00146     }
00147 }

void UCvsApp::SetCvsStopping ( bool state )

Definition at line 149 of file UCvsApp.cpp.

Referenced by UCvsFrame::OnCmdStopcvs().

00150 {
00151     if(state ^ gCvsStopping)
00152     {
00153         gCvsStopping = state;
00154     }
00155 }

Member Data Documentation

const UMSGMAP_ENTRY UCvsApp::_messageEntries[] [static, private]

Reimplemented from UWidget.

Definition at line 81 of file UCvsApp.h.

UCvsApp * UCvsApp::gApp = 0L [static]

Definition at line 68 of file UCvsApp.cpp.

CvsProcess * UCvsApp::gCurCvs = 0L [static]

Definition at line 69 of file UCvsApp.cpp.

bool UCvsApp::gCvsRunning [protected]

Definition at line 76 of file UCvsApp.h.

bool UCvsApp::gCvsStopping [protected]

Definition at line 77 of file UCvsApp.h.

const UMSGMAP UCvsApp::messageMap [static, protected]

Reimplemented from UWidget.

Definition at line 81 of file UCvsApp.h.

The documentation for this class was generated from the following files:
  • common/UCvsApp.h
  • common/UCvsApp.cpp
Generated on Sun Oct 21 12:47:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsConsole Class Reference

#include <UCvsConsole.h>

Inheritance diagram for UCvsConsole:

[legend]
Collaboration diagram for UCvsConsole:

[legend]
List of all members.

Public Methods

UCvsConsole ()
virtual | ~UCvsConsole ()
void | OutConsole (const char *txt, size_t len, bool isStderr=false)
void | OutColor (const char *txt, long len)
void | OutColor (kConsoleColor color)

Protected Types

enum | { MAX_CHAR_BY_LINE = 1024 }

Protected Methods

void | FeedThisLine (const char *buf, size_t numbuf, bool isStderr)
void | OnDestroy ()
void | OnCreate ()
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

char * | m_buf
size_t | m_numbuf
UCvsConsole:: { ... } | out
UCOLOR col
bool | bold
bool | italic
bool | underline

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

anonymous enum [protected]

Enumeration values:
MAX_CHAR_BY_LINE

Definition at line 56 of file UCvsConsole.h.

00057     {
00058         MAX_CHAR_BY_LINE = 1024
00059     };

Constructor & Destructor Documentation

UCvsConsole::UCvsConsole ( )

Definition at line 44 of file UCvsConsole.cpp.

00044                          : UWidget(kUMainConsoleID), m_buf(0L), m_numbuf(0)
00045 {
00046     out.col = UCOLOR(0, 0, 0);
00047     out.bold = false;
00048     out.italic = false;
00049     out.underline = false;
00050 }

UCvsConsole::~UCvsConsole ( ) [virtual]

Definition at line 52 of file UCvsConsole.cpp.

00053 {
00054     m_numbuf = 0;
00055     if(m_buf != 0L)
00056     {
00057         free(m_buf);
00058         m_buf = 0L;
00059     }
00060 }

Member Function Documentation

void UCvsConsole::FeedThisLine | ( | const char * | buf,
 |  | size_t | numbuf,
 |  | bool | isStderr
 | ) | [protected]

Definition at line 62 of file UCvsConsole.cpp.

Referenced by OutConsole().

00063 {
00064     void *wid = GetWidget(kUMainWidget);
00065     if(wid == 0L)
00066     {
00067         UAppConsole("The console is not here !\n");
00068         return;
00069     }
00070
00071 #if qGTK
00072     if(!GTK_IS_TEXT(wid))
00073     {
00074         g_warning("The pseudo-console is not here !\n");
00075         return;
00076     }
00077
00078     GtkText *w = GTK_TEXT(wid);
00079     gtk_text_set_point(w, gtk_text_get_length(w));
00080 #endif
00081
00082     UCOLOR color(0, 0, 0);
00083     bool colorChanged = false;
00084     UStr s;
00085     s.set(buf, numbuf);
00086
00087     if(s.length() >= 5 && s[1] == ' ' &&
00088         (s[0] == 'M' || s[0] == 'C' || s[0] == 'U' ||
00089         s[0] == 'P' || s[0] == 'N' || s[0] == 'A' ||
00090         s[0] == 'R' || s[0] == 'I' || s[0] == '?' ||
00091         s[0] == '<' || s[0] == '>'))
00092     {
00093         colorChanged = true;
00094         switch(s[0])
00095         {
00096         default:
00097         case '?' :
00098         case 'I' :
00099             color = UCOLOR(0x80, 0x80, 0x00);
00100             break;
00101         case 'U' :
00102         case 'N' :
00103             color = UCOLOR(0x00, 0xA0, 0x00);
00104             break;
00105         case 'M' :
00106         case 'A' :
00107         case 'R' :
00108             color = UCOLOR(0xFF, 0x00, 0xFF);
00109             break;
00110         case 'C' :
00111         case '<' :
00112             color = UCOLOR(0xFF, 0x00, 0x00);
00113             break;
00114         case '>' :
00115         case 'P' :
00116             color = UCOLOR(0x00, 0x00, 0xFF);
00117             break;
00118         }
00119     }
00120     else if(isStderr)
00121     {
00122         colorChanged = true;
00123         color = UCOLOR(0xFF, 0x80, 0x00);
00124     }
00125
00126 #if qGTK
00127     GdkColormap *cmap;
00128     GdkColor col;
00129     cmap = gdk_colormap_get_system();
00130     col.red = ((unsigned int)color.r) << 8;
00131     col.green = ((unsigned int)color.g) << 8;
00132     col.blue = ((unsigned int)color.b) << 8;
00133     if(color.r != 0 || color.g != 0 || color.b != 0)
00134     {
00135         if (!gdk_color_alloc(cmap, &col)) {
00136             g_error("Couldn't allocate color\n");
00137         }
00138         gtk_text_insert(w, NULL, &col, NULL, s, -1);
00139     }
00140     else
00141         gtk_text_insert(w, NULL, &GTK_WIDGET(w)->style->black, NULL, s, -1);
00142 #endif
00143 }

const UMSGMAP* UCvsConsole::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

virtual const UMSGMAP* UCvsConsole::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

const UMSGMAP* UCvsConsole::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

void UCvsConsole::OnCreate ( void ) [protected]

Definition at line 259 of file UCvsConsole.cpp.

00260 {
00261     void *wid = GetWidget(kUMainWidget);
00262     if(wid == 0L)
00263     {
00264         UAppConsole("The console is not here !\n");
00265         return;
00266     }
00267
00268 #if qGTK
00269     gtk_signal_connect (GTK_OBJECT (wid), "key_press_event",
00270                         GTK_SIGNAL_FUNC(gtkkeypress), (gpointer)this);
00271 #endif
00272 }

void UCvsConsole::OnDestroy ( void ) [protected]

Definition at line 181 of file UCvsConsole.cpp.

00182 {
00183     delete this;
00184 }

void UCvsConsole::OutColor ( kConsoleColor color )

Definition at line 311 of file UCvsConsole.cpp.

00312 {
00313     switch(color)
00314     {
00315     case kBrown :
00316         out.col = UCOLOR(0x80, 0x80, 0x00);
00317         break;
00318     case kGreen :
00319         out.col = UCOLOR(0x00, 0xA0, 0x00);
00320         break;
00321     case kMagenta :
00322         out.col = UCOLOR(0xFF, 0x00, 0xFF);
00323         break;
00324     case kRed :
00325         out.col = UCOLOR(0xFF, 0x00, 0x00);
00326         break;
00327     case kBlue :
00328         out.col = UCOLOR(0x00, 0x00, 0xFF);
00329         break;
00330     case kBold :
00331         out.bold = true;
00332         break;
00333     case kItalic :
00334         out.italic = true;
00335         break;
00336     case kUnderline :
00337         out.underline = true;
00338         break;
00339     case kNormal:
00340         out.col = UCOLOR(0, 0, 0);
00341         out.bold = false;
00342         out.italic = false;
00343         out.underline = false;
00344         break;
00345     case kNL :
00346         break;
00347     }
00348 }

void UCvsConsole::OutColor | ( | const char * | txt,
 |  | long | len
 | ) |

Definition at line 274 of file UCvsConsole.cpp.

Referenced by CColorConsole::operator<<().

00275 {
00276     void *wid = GetWidget(kUMainWidget);
00277     if(wid == 0L)
00278     {
00279         UAppConsole("The console is not here !\n");
00280         return;
00281     }
00282
00283 #if qGTK
00284     if(!GTK_IS_TEXT(wid))
00285     {
00286         g_warning("The pseudo-console is not here !\n");
00287         return;
00288     }
00289
00290     GtkText *w = GTK_TEXT(wid);
00291     gtk_text_set_point(w, gtk_text_get_length(w));
00292
00293     GdkColormap *cmap;
00294     GdkColor col;
00295     cmap = gdk_colormap_get_system();
00296     col.red = ((unsigned int)out.col.r) << 8;
00297     col.green = ((unsigned int)out.col.g) << 8;
00298     col.blue = ((unsigned int)out.col.b) << 8;
00299     if(out.col.r != 0 || out.col.g != 0 || out.col.b != 0)
00300     {
00301         if (!gdk_color_alloc(cmap, &col)) {
00302             g_error("Couldn't allocate color\n");
00303         }
00304         gtk_text_insert(w, NULL, &col, NULL, txt, len);
00305     }
00306     else
00307         gtk_text_insert(w, NULL, &GTK_WIDGET(w)->style->black, NULL, txt, len);
00308 #endif
00309 }

void UCvsConsole::OutConsole | ( | const char * | txt,
 |  | size_t | len,
 |  | bool | isStderr = false
 | ) |

Definition at line 145 of file UCvsConsole.cpp.

Referenced by cvs_err(), cvs_errstr(), cvs_out(), and cvs_outstr().

00146 {
00147     if(len == 0)
00148         return;
00149
00150     if(m_buf == 0L)
00151     {
00152         m_buf = (char *)malloc((MAX_CHAR_BY_LINE + 3) * sizeof(char));
00153         if(m_buf == 0L)
00154             return;
00155     }
00156
00157     size_t i = 0;
00158     char c = 0;
00159 once_again:
00160     for(; i < len && m_numbuf < MAX_CHAR_BY_LINE; m_numbuf++)
00161     {
00162         c = txt[i++];
00163         if(c == 0x0a)
00164             break;
00165         m_buf[m_numbuf] = c;
00166     }
00167
00168     if(c == 0x0a || m_numbuf == MAX_CHAR_BY_LINE)
00169     {
00170         m_buf[m_numbuf++] = 0x0a;
00171         m_buf[m_numbuf++] = 0x00;
00172
00173         FeedThisLine(m_buf, m_numbuf, isStderr);
00174         m_numbuf = 0;
00175     }
00176
00177     if(i != len)
00178         goto once_again;
00179 }

Member Data Documentation

const UMSGMAP_ENTRY UCvsConsole::_messageEntries[] [static, private]

Reimplemented from UWidget.

Definition at line 73 of file UCvsConsole.h.

bool UCvsConsole::bold [protected]

Definition at line 67 of file UCvsConsole.h.

UCOLOR UCvsConsole::col [protected]

Definition at line 66 of file UCvsConsole.h.

bool UCvsConsole::italic [protected]

Definition at line 67 of file UCvsConsole.h.

char* UCvsConsole::m_buf [protected]

Definition at line 61 of file UCvsConsole.h.

size_t UCvsConsole::m_numbuf [protected]

Definition at line 62 of file UCvsConsole.h.

const UMSGMAP UCvsConsole::messageMap [static, protected]

Reimplemented from UWidget.

Definition at line 73 of file UCvsConsole.h.

struct { ... } UCvsConsole::out [protected]

bool UCvsConsole::underline [protected]

Definition at line 67 of file UCvsConsole.h.

The documentation for this class was generated from the following files:
  • common/UCvsConsole.h
  • common/UCvsConsole.cpp
Generated on Sun Oct 21 12:47:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCvsConsole Class Reference

#include <AppGlue.h>

Inheritance diagram for CCvsConsole:

[legend]
List of all members.

Public Methods

virtual long | cvs_out (char *txt, long len)=0L
virtual long | cvs_err (char *txt, long len)=0L

Member Function Documentation

virtual long CCvsConsole::cvs_err | ( | char * | txt,
 |  | long | len
 | ) | [pure virtual]

Reimplemented in CStreamConsole, CPyCvsConsole, CTCLCvsConsole, CGraphConsole, and CRevisionConsole.

Referenced by glue_consoleerr().

virtual long CCvsConsole::cvs_out | ( | char * | txt,
 |  | long | len
 | ) | [pure virtual]

Reimplemented in CStreamConsole, CPyCvsConsole, CTCLCvsConsole, CGraphConsole, and CRevisionConsole.

Referenced by CTCLCvsConsole::cvs_err(), and glue_consoleout().

The documentation for this class was generated from the following file:
  • common/AppGlue.h
Generated on Sun Oct 21 12:47:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsFiles Class Reference

#include <UCvsFiles.h>

Inheritance diagram for UCvsFiles:

[legend]
Collaboration diagram for UCvsFiles:

[legend]
List of all members.

Public Methods

UCvsFiles ()
virtual | ~UCvsFiles ()
void | ResetView (const char *path, bool notifyBrowser=false)
void | ResetView (bool forceReload=false, bool notifyBrowser=false)
bool | IsSortAscendant (void)

Static Public Methods

void * | GetImageForEntry (EntnodeData *data)

Protected Methods

void | GetEntriesModTime (time_t &newEntriesMod, time_t &newEntriesLogMod)
void | EditSel (EntnodeData *data, bool useDefault=false)
void | Resort (void)
bool | DisableGeneric ()
int | Search (const char *title)
void | OnDestroy ()
void | OnCreate ()
int | OnCmdUpdate (void)
int | OnCmdAdd (void)
int | OnCmdAddb (void)
int | OnCmdCommit (void)
int | OnCmdRmv (void)
int | OnCmdQueryUpdate (void)
int | OnCmdReload (void)
int | OnCmdUpone (void)
int | OnCmdTrash (void)
int | OnCmdDiff (void)
int | OnCmdLog (void)
int | OnCmdGraph (void)
int | OnCmdStatus (void)
int | OnCmdLock (void)
int | OnCmdUnlock (void)
int | OnCmdWatchOn (void)
int | OnCmdWatchOff (void)
int | OnCmdEdit (void)
int | OnCmdUnedit (void)
int | OnCmdWatchers (void)
int | OnCmdEditors (void)
int | OnCmdRelease (void)
int | OnCmdTagNew (void)
int | OnCmdTagDelete (void)
int | OnCmdTagBranch (void)
int | OnCmdExplore (void)
int | OnCmdIgnore (void)
int | OnCmdEditsel (void)
int | OnCmdEditseldef (void)
int | OnMacroSel (int cmd)
void | OnCmdUIUpdate (UCmdUI *pCmdUI)
void | OnCmdUIAdd (UCmdUI *pCmdUI)
void | OnCmdUIAddB (UCmdUI *pCmdUI)
void | OnCmdUIRelease (UCmdUI *pCmdUI)
void | OnCmdUIRmv (UCmdUI *pCmdUI)
void | OnCmdUIGraph (UCmdUI *pCmdUI)
void | OnCmdUIEditseldef (UCmdUI *pCmdUI)
void | OnCmdUIReload (UCmdUI *pCmdUI)
void | OnCmdUIUpone (UCmdUI *pCmdUI)
void | OnCmdUITrash (UCmdUI *pCmdUI)
void | OnCmdUIExplore (UCmdUI *pCmdUI)
void | OnCmdUIIgnore (UCmdUI *pCmdUI)
void | OnCmdUIMacroSel (int cmd, UCmdUI *pCmdUI)
void | OnDblClick (void)
void | OnSelColumn (int column)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

CSortList< ENTNODE > m_entries
UStr m_path
time_t | m_entriesMod
time_t | m_entriesLogMod
int | m_sort
bool | m_ascendant

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Constructor & Destructor Documentation

UCvsFiles::UCvsFiles ( )

Definition at line 360 of file UCvsFiles.cpp.

00360                      : UWidget(kUCvsFilesID), m_entries(200, ENTNODE::Compare), m_entriesMod(0), m_entriesLogMod(0)
00361
00362 {
00363     m_sort = (int)gFileViewSort;
00364     m_ascendant = (bool)gFileViewSortAsc;
00365 }

UCvsFiles::~UCvsFiles ( ) [virtual]

Definition at line 367 of file UCvsFiles.cpp.

00368 {
00369     gFileViewSort = m_sort;
00370     gFileViewSortAsc = m_ascendant;
00371 }

Member Function Documentation

bool UCvsFiles::DisableGeneric ( ) [protected]

Definition at line 716 of file UCvsFiles.cpp.

Referenced by OnCmdUIAdd(), OnCmdUIAddB(), OnCmdUIEditseldef(), OnCmdUIExplore(), OnCmdUIGraph(), OnCmdUIIgnore(), OnCmdUIMacroSel(), OnCmdUIRelease(), OnCmdUIReload(), OnCmdUIRmv(), OnCmdUITrash(), OnCmdUIUpdate(), and OnCmdUIUpone().

00717 {
00718     return UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, -1), 0L) == -1 ||
00719         UCvsApp::gApp->IsCvsRunning() || gCvsPrefs.empty() || !HasFocus();
00720 }

void UCvsFiles::EditSel | ( | EntnodeData * | data,
 |  | bool | useDefault = false
 | ) | [protected]

Definition at line 1872 of file UCvsFiles.cpp.

Referenced by OnCmdEditsel(), OnCmdEditseldef(), and OnDblClick().

01873 {
01874     CStr fullpath;
01875     fullpath = m_path;
01876     if(!fullpath.endsWith(kPathDelimiter))
01877         fullpath << kPathDelimiter;
01878     fullpath << (*data)[EntnodeData::kName];
01879     if(data->GetType() == ENT_SUBDIR)
01880     {
01881         ResetView(fullpath, true);
01882     }
01883     else
01884     {
01885 #ifdef WIN32
01886         char viewer[_MAX_PATH];
01887         HINSTANCE hInst = FindExecutable((*data)[EntnodeData::kName],
01888             m_path, viewer);
01889         bool done = false;
01890         if(!useDefault && (UINT)hInst >= 32)
01891         {
01892             HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), "open", (*data)[EntnodeData::kName],
01893                 NULL, m_path, SW_SHOWDEFAULT);
01894             if((long)hInst < 32)
01895             {
01896                 cvs_err("Unable to open '%s' (error %d), using default viewer instead\n", (char *)fullpath, GetLastError());
01897             }
01898             else
01899                 done = true;
01900         }
01901
01902         if(!done)
01903         {
01904             const char * argv[3] = {0L, 0L, 0L};
01905             CStr program, file;
01906             if(strchr(gCvsPrefs.Viewer(), ' ') != 0L)
01907             {
01908                 program << '\"';
01909                 program << gCvsPrefs.Viewer();
01910                 program << '\"';
01911             }
01912             else
01913                 program = gCvsPrefs.Viewer();
01914             if(strchr(fullpath, ' ') != 0L)
01915             {
01916                 file << '\"';
01917                 file << fullpath;
01918                 file << '\"';
01919             }
01920             else
01921                 file = fullpath;
01922             argv[0] = program;
01923             argv[1] = file;
01924             int process = _spawnvp(_P_NOWAIT, gCvsPrefs.Viewer(), argv);
01925         }
01926 #endif
01927 #ifdef qUnix
01928         CStr fullpath;
01929         fullpath = m_path;
01930         if(!fullpath.endsWith(kPathDelimiter))
01931             fullpath << kPathDelimiter;
01932         fullpath << (*data)[EntnodeData::kName];
01933
01934         CvsArgs args(false);
01935         args.add(gCvsPrefs.Viewer());
01936         args.add(fullpath);
01937         UCvsApp::gApp->Execute(args.Argc(), args.Argv());
01938 #endif
01939     }
01940 }

const UMSGMAP* UCvsFiles::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

void UCvsFiles::GetEntriesModTime | ( | time_t & | newEntriesMod,
 |  | time_t & | newEntriesLogMod
 | ) | [protected]

Definition at line 425 of file UCvsFiles.cpp.

Referenced by ResetView().

00426 {
00427     newEntriesMod = 0;
00428     newEntriesLogMod = 0;
00429     if(chdir(m_path) != 0)
00430         return;
00431     if(chdir("CVS") != 0)
00432         return;
00433
00434     struct stat sb;
00435     if (stat("Entries", &sb) != -1)
00436         newEntriesMod = sb.st_mtime;
00437     if (stat("Entries.log", &sb) != -1)
00438         newEntriesLogMod = sb.st_mtime;
00439     chdir(m_path);
00440 }

void * UCvsFiles::GetImageForEntry ( EntnodeData * data ) [static]

Definition at line 568 of file UCvsFiles.cpp.

Referenced by TViewFill::OnDirectory(), TViewFill::OnFile(), and ResetView().

00569 {
00570     int result;
00571     void *resIcon = 0L;
00572
00573     if(data->GetType() == ENT_FILE)
00574     {
00575         const char *info = 0L;
00576         if(data->IsIgnored())
00577         {
00578             result = kFileIconIgnored;
00579         }
00580         else if(data->IsUnknown())
00581         {
00582             result = kFileIconUnknown;
00583         }
00584         else if(data->IsMissing())
00585         {
00586             result = data->IsRemoved() ? kFileIconRemoved : kFileIconMiss;
00587         }
00588         else if((*data)[EntnodeFile::kConflict] != 0L)
00589         {
00590             result = kFileIconConflict;
00591         }
00592         else if(data->IsRemoved())
00593         {
00594             result = kFileIconRemoved;
00595         }
00596         else if((info = (*data)[EntnodeFile::kOption]) != 0L && strcmp(info, "-kb") == 0)
00597         {
00598             result = data->IsUnmodified() ? kFileIconBinary : kFileIconBinaryMod;
00599         }
00600         else
00601         {
00602             result = data->IsUnmodified() ? kFileIconText : kFileIconTextMod;
00603         }
00604     }
00605     else
00606     {
00607         if(data->IsIgnored())
00608         {
00609             result = kFolderIconIgnored;
00610         }
00611         else if(data->IsUnknown())
00612         {
00613             result = kFolderIconUnknown;
00614         }
00615         else if(data->IsMissing())
00616         {
00617             result = kFolderIconMiss;
00618         }
00619         else
00620         {
00621             result = kFolderIcon;
00622         }
00623     }
00624
00625 #if qGTK
00626     void *pixmap = 0L;
00627     switch(result)
00628     {
00629     case kFileIconText:
00630         pixmap = sFileIconTextIcon;
00631         break;
00632     case kFileIconBinary:
00633         pixmap = sFileIconBinaryIcon;
00634         break;
00635     case kFileIconUnknown:
00636         pixmap = sFileIconUnknownIcon;
00637         break;
00638     case kFileIconAdded:
00639         pixmap = sFileIconAddedIcon;
00640         break;
00641     case kFileIconConflict:
00642         pixmap = sFileIconConflictIcon;
00643         break;
00644     case kFileIconMiss:
00645         pixmap = sFileIconMissIcon;
00646         break;
00647     case kFolderIcon:
00648         pixmap = sFolderIconIcon;
00649         break;
00650     case kFolderIconUnknown:
00651         pixmap = sFolderIconUnknownIcon;
00652         break;
00653     case kFolderIconMiss:
00654         pixmap = sFolderIconMissIcon;
00655         break;
00656     case kFileIconTextMod:
00657         pixmap = sFileIconTextModIcon;
00658         break;
00659     case kFileIconBinaryMod:
00660         pixmap = sFileIconBinaryModIcon;
00661         break;
00662     case kFileIconIgnored:
00663         pixmap = sFileIconIgnoredIcon;
00664         break;
00665     case kFolderIconIgnored:
00666         pixmap = sFolderIconIgnoredIcon;
00667         break;
00668     case kFileIconRemoved:
00669         pixmap = sFileIconRemovedIcon;
00670         break;
00671     }
00672     if(pixmap != 0L)
00673     {
00674         resIcon = gtk_pixmap_new (GTK_PIXMAP(pixmap)->pixmap, GTK_PIXMAP(pixmap)->mask);
00675     }
00676 #endif
00677
00678     return resIcon;
00679 }

virtual const UMSGMAP* UCvsFiles::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

const UMSGMAP* UCvsFiles::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

bool UCvsFiles::IsSortAscendant ( void ) [inline]

Definition at line 50 of file UCvsFiles.h.

Referenced by compareConflict(), compareName(), compareOption(), compareRevs(), compareStatus(), and compareTag().

00050 { return m_ascendant; }

int UCvsFiles::OnCmdAdd ( void ) [protected]

Definition at line 1029 of file UCvsFiles.cpp.

01030 {
01031     int nItem = -1;
01032
01033     MultiFiles mf;
01034     mf.newdir(m_path);
01035
01036     // first add the folders
01037     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01038     {
01039         EntnodeData *data;
01040         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01041
01042         if(data->GetType() == ENT_SUBDIR)
01043         {
01044             CStr fullpath;
01045             fullpath = m_path;
01046             if(!fullpath.endsWith(kPathDelimiter))
01047                 fullpath << kPathDelimiter;
01048             fullpath << (*data)[EntnodeData::kName];
01049             CvsCmdAddFolder(fullpath);
01050         }
01051         else
01052         {
01053             mf.newfile((*data)[EntnodeData::kName]);
01054         }
01055     }
01056     if(mf.NumFiles() != 0)
01057     {
01058         CvsCmdAddFiles(&mf);
01059     }
01060     return 0;
01061 }

int UCvsFiles::OnCmdAddb ( void ) [protected]

Definition at line 1063 of file UCvsFiles.cpp.

01064 {
01065     int nItem = -1;
01066
01067     MultiFiles mf;
01068     mf.newdir(m_path);
01069
01070     // first add the folders
01071     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01072     {
01073         EntnodeData *data;
01074         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01075
01076         if(data->GetType() == ENT_SUBDIR)
01077         {
01078             CStr fullpath;
01079             fullpath = m_path;
01080             if(!fullpath.endsWith(kPathDelimiter))
01081                 fullpath << kPathDelimiter;
01082             fullpath << (*data)[EntnodeData::kName];
01083             CvsCmdAddFolder(fullpath);
01084         }
01085         else
01086         {
01087             mf.newfile((*data)[EntnodeData::kName]);
01088         }
01089     }
01090     if(mf.NumFiles() != 0)
01091     {
01092         CvsCmdAddBinaryFiles(&mf);
01093     }
01094     return 0;
01095 }

int UCvsFiles::OnCmdCommit ( void ) [protected]

Definition at line 1097 of file UCvsFiles.cpp.

01098 {
01099     int nItem = -1;
01100
01101     MultiFiles mf;
01102     mf.newdir(m_path);
01103
01104     // first add the folders
01105     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01106     {
01107         EntnodeData *data;
01108         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01109
01110         if(data->GetType() == ENT_SUBDIR)
01111         {
01112             CStr fullpath;
01113             fullpath = m_path;
01114             if(!fullpath.endsWith(kPathDelimiter))
01115                 fullpath << kPathDelimiter;
01116             fullpath << (*data)[EntnodeData::kName];
01117             CvsCmdCommitFolder(fullpath);
01118         }
01119         else
01120         {
01121             mf.newfile((*data)[EntnodeData::kName]);
01122         }
01123     }
01124     if(mf.NumFiles() != 0)
01125     {
01126         CvsCmdCommitFiles(&mf);
01127     }
01128     return 0;
01129 }

int UCvsFiles::OnCmdDiff ( void ) [protected]

Definition at line 1260 of file UCvsFiles.cpp.

01261 {
01262     int nItem = -1;
01263
01264     MultiFiles mf;
01265     mf.newdir(m_path);
01266
01267     // first add the folders
01268     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01269     {
01270         EntnodeData *data;
01271         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01272
01273         if(data->GetType() == ENT_SUBDIR)
01274         {
01275             CStr fullpath;
01276             fullpath = m_path;
01277             if(!fullpath.endsWith(kPathDelimiter))
01278                 fullpath << kPathDelimiter;
01279             fullpath << (*data)[EntnodeData::kName];
01280             CvsCmdDiffFolder(fullpath);
01281         }
01282         else
01283         {
01284             mf.newfile((*data)[EntnodeData::kName]);
01285         }
01286     }
01287     if(mf.NumFiles() != 0)
01288     {
01289         CvsCmdDiffFiles(&mf);
01290     }
01291     return 0;
01292 }

int UCvsFiles::OnCmdEdit ( void ) [protected]

Definition at line 1523 of file UCvsFiles.cpp.

01524 {
01525     int nItem = -1;
01526
01527     MultiFiles mf;
01528     mf.newdir(m_path);
01529
01530     // first add the folders
01531     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01532     {
01533         EntnodeData *data;
01534         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01535
01536         if(data->GetType() == ENT_SUBDIR)
01537         {
01538             CStr fullpath;
01539             fullpath = m_path;
01540             if(!fullpath.endsWith(kPathDelimiter))
01541                 fullpath << kPathDelimiter;
01542             fullpath << (*data)[EntnodeData::kName];
01543             CvsCmdEditFolder(fullpath);
01544         }
01545         else
01546         {
01547             mf.newfile((*data)[EntnodeData::kName]);
01548         }
01549     }
01550     if(mf.NumFiles() != 0)
01551     {
01552         CvsCmdEditFiles(&mf);
01553     }
01554     return 0;
01555 }

int UCvsFiles::OnCmdEditors ( void ) [protected]

Definition at line 1625 of file UCvsFiles.cpp.

01626 {
01627     int nItem = -1;
01628
01629     MultiFiles mf;
01630     mf.newdir(m_path);
01631
01632     // first add the folders
01633     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01634     {
01635         EntnodeData *data;
01636         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01637
01638         if(data->GetType() == ENT_SUBDIR)
01639         {
01640             CStr fullpath;
01641             fullpath = m_path;
01642             if(!fullpath.endsWith(kPathDelimiter))
01643                 fullpath << kPathDelimiter;
01644             fullpath << (*data)[EntnodeData::kName];
01645             CvsCmdEditorsFolder(fullpath);
01646         }
01647         else
01648         {
01649             mf.newfile((*data)[EntnodeData::kName]);
01650         }
01651     }
01652     if(mf.NumFiles() != 0)
01653     {
01654         CvsCmdEditorsFiles(&mf);
01655     }
01656     return 0;
01657 }

int UCvsFiles::OnCmdEditsel ( void ) [protected]

Definition at line 1825 of file UCvsFiles.cpp.

01826 {
01827     int nItem = -1;
01828
01829     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01830     {
01831         EntnodeData *data;
01832         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01833         EditSel(data);
01834     }
01835     return 0;
01836 }

int UCvsFiles::OnCmdEditseldef ( void ) [protected]

Definition at line 1838 of file UCvsFiles.cpp.

01839 {
01840     int nItem = -1;
01841
01842     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01843     {
01844         EntnodeData *data;
01845         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01846         EditSel(data, true);
01847     }
01848     return 0;
01849 }

int UCvsFiles::OnCmdExplore ( void ) [protected]

Definition at line 1784 of file UCvsFiles.cpp.

01785 {
01786     int nItem = -1;
01787
01788     // first add the folders
01789     if((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01790     {
01791         EntnodeData *data;
01792         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01793
01794         CStr fullpath;
01795         fullpath = m_path;
01796         if(!fullpath.endsWith(kPathDelimiter))
01797             fullpath << kPathDelimiter;
01798         fullpath << (*data)[EntnodeData::kName];
01799
01800 #ifdef WIN32
01801         HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), "explore", fullpath,
01802                                        0L, 0L, SW_SHOWDEFAULT);
01803         if((long)hInst < 32)
01804         {
01805             cvs_err("Unable to explore '%s' (error %d)\n", (char *)m_path, GetLastError());
01806         }
01807 #endif
01808 #ifdef qUnix
01809         CvsArgs args(false);
01810         args.add(gCvsPrefs.Browser());
01811         args.add(fullpath);
01812         UCvsApp::gApp->Execute(args.Argc(), args.Argv());
01813 #endif
01814     }
01815     return 0;
01816 }

int UCvsFiles::OnCmdGraph ( void ) [protected]

Definition at line 1328 of file UCvsFiles.cpp.

01329 {
01330     int nItem = -1;
01331
01332     MultiFiles mf;
01333     mf.newdir(m_path);
01334
01335     // first add the folders
01336     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01337     {
01338         EntnodeData *data;
01339         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01340
01341         if(data->GetType() != ENT_FILE)
01342             continue;
01343
01344         mf.newfile((*data)[EntnodeData::kName]);
01345     }
01346     if(mf.NumFiles() != 0)
01347     {
01348         CvsCmdLogFiles(&mf, true);
01349     }
01350     return 0;
01351 }

int UCvsFiles::OnCmdIgnore ( void ) [protected]

Definition at line 1818 of file UCvsFiles.cpp.

01819 {
01820     gFileViewIgnore = !(bool)gFileViewIgnore;
01821     ResetView(true, true);
01822     return 0;
01823 }

int UCvsFiles::OnCmdLock ( void ) [protected]

Definition at line 1387 of file UCvsFiles.cpp.

01388 {
01389     int nItem = -1;
01390
01391     MultiFiles mf;
01392     mf.newdir(m_path);
01393
01394     // first add the folders
01395     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01396     {
01397         EntnodeData *data;
01398         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01399
01400         if(data->GetType() == ENT_SUBDIR)
01401         {
01402             CStr fullpath;
01403             fullpath = m_path;
01404             if(!fullpath.endsWith(kPathDelimiter))
01405                 fullpath << kPathDelimiter;
01406             fullpath << (*data)[EntnodeData::kName];
01407             CvsCmdLockFolder(fullpath);
01408         }
01409         else
01410         {
01411             mf.newfile((*data)[EntnodeData::kName]);
01412         }
01413     }
01414     if(mf.NumFiles() != 0)
01415     {
01416         CvsCmdLockFiles(&mf);
01417     }
01418     return 0;
01419 }

int UCvsFiles::OnCmdLog ( void ) [protected]

Definition at line 1294 of file UCvsFiles.cpp.

01295 {
01296     int nItem = -1;
01297
01298     MultiFiles mf;
01299     mf.newdir(m_path);
01300
01301     // first add the folders
01302     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01303     {
01304         EntnodeData *data;
01305         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01306
01307         if(data->GetType() == ENT_SUBDIR)
01308         {
01309             CStr fullpath;
01310             fullpath = m_path;
01311             if(!fullpath.endsWith(kPathDelimiter))
01312                 fullpath << kPathDelimiter;
01313             fullpath << (*data)[EntnodeData::kName];
01314             CvsCmdLogFolder(fullpath);
01315         }
01316         else
01317         {
01318             mf.newfile((*data)[EntnodeData::kName]);
01319         }
01320     }
01321     if(mf.NumFiles() != 0)
01322     {
01323         CvsCmdLogFiles(&mf);
01324     }
01325     return 0;
01326 }

int UCvsFiles::OnCmdQueryUpdate ( void ) [protected]

Definition at line 1156 of file UCvsFiles.cpp.

01157 {
01158     int nItem = -1;
01159
01160     MultiFiles mf;
01161     mf.newdir(m_path);
01162
01163     // first add the folders
01164     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01165     {
01166         EntnodeData *data;
01167         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01168
01169         if(data->GetType() == ENT_SUBDIR)
01170         {
01171             CStr fullpath;
01172             fullpath = m_path;
01173             if(!fullpath.endsWith(kPathDelimiter))
01174                 fullpath << kPathDelimiter;
01175             fullpath << (*data)[EntnodeData::kName];
01176             CvsCmdUpdateFolder(fullpath, true);
01177         }
01178         else
01179         {
01180             mf.newfile((*data)[EntnodeData::kName]);
01181         }
01182     }
01183     if(mf.NumFiles() != 0)
01184     {
01185         CvsCmdUpdateFiles(&mf, true);
01186     }
01187     return 0;
01188 }

int UCvsFiles::OnCmdRelease ( void ) [protected]

Definition at line 1659 of file UCvsFiles.cpp.

01660 {
01661     int nItem = -1;
01662
01663     // first add the folders
01664     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01665     {
01666         EntnodeData *data;
01667         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01668
01669         if(data->GetType() == ENT_SUBDIR)
01670         {
01671             CStr fullpath;
01672             fullpath = m_path;
01673             if(!fullpath.endsWith(kPathDelimiter))
01674                 fullpath << kPathDelimiter;
01675             fullpath << (*data)[EntnodeData::kName];
01676             CvsCmdReleaseFolder(fullpath);
01677         }
01678     }
01679     return 0;
01680 }

int UCvsFiles::OnCmdReload ( void ) [protected]

Definition at line 1190 of file UCvsFiles.cpp.

01191 {
01192     ResetView(true, true);
01193     return 0;
01194 }

int UCvsFiles::OnCmdRmv ( void ) [protected]

Definition at line 1131 of file UCvsFiles.cpp.

01132 {
01133     int nItem = -1;
01134
01135     MultiFiles mf;
01136     mf.newdir(m_path);
01137
01138     // first add the folders
01139     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01140     {
01141         EntnodeData *data;
01142         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01143
01144         if(data->GetType() != ENT_FILE)
01145             continue;
01146
01147         mf.newfile((*data)[EntnodeData::kName]);
01148     }
01149     if(mf.NumFiles() != 0)
01150     {
01151         CvsCmdRemoveFiles(&mf);
01152     }
01153     return 0;
01154 }

int UCvsFiles::OnCmdStatus ( void ) [protected]

Definition at line 1353 of file UCvsFiles.cpp.

01354 {
01355     int nItem = -1;
01356
01357     MultiFiles mf;
01358     mf.newdir(m_path);
01359
01360     // first add the folders
01361     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01362     {
01363         EntnodeData *data;
01364         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01365
01366         if(data->GetType() == ENT_SUBDIR)
01367         {
01368             CStr fullpath;
01369             fullpath = m_path;
01370             if(!fullpath.endsWith(kPathDelimiter))
01371                 fullpath << kPathDelimiter;
01372             fullpath << (*data)[EntnodeData::kName];
01373             CvsCmdStatusFolder(fullpath);
01374         }
01375         else
01376         {
01377             mf.newfile((*data)[EntnodeData::kName]);
01378         }
01379     }
01380     if(mf.NumFiles() != 0)
01381     {
01382         CvsCmdStatusFiles(&mf);
01383     }
01384     return 0;
01385 }

int UCvsFiles::OnCmdTagBranch ( void ) [protected]

Definition at line 1750 of file UCvsFiles.cpp.

01751 {
01752     int nItem = -1;
01753
01754     MultiFiles mf;
01755     mf.newdir(m_path);
01756
01757     // first add the folders
01758     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01759     {
01760         EntnodeData *data;
01761         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01762
01763         if(data->GetType() == ENT_SUBDIR)
01764         {
01765             CStr fullpath;
01766             fullpath = m_path;
01767             if(!fullpath.endsWith(kPathDelimiter))
01768                 fullpath << kPathDelimiter;
01769             fullpath << (*data)[EntnodeData::kName];
01770             CvsCmdTagBranchFolder(fullpath);
01771         }
01772         else
01773         {
01774             mf.newfile((*data)[EntnodeData::kName]);
01775         }
01776     }
01777     if(mf.NumFiles() != 0)
01778     {
01779         CvsCmdTagBranchFiles(&mf);
01780     }
01781     return 0;
01782 }

int UCvsFiles::OnCmdTagDelete ( void ) [protected]

Definition at line 1716 of file UCvsFiles.cpp.

01717 {
01718     int nItem = -1;
01719
01720     MultiFiles mf;
01721     mf.newdir(m_path);
01722
01723     // first add the folders
01724     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01725     {
01726         EntnodeData *data;
01727         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01728
01729         if(data->GetType() == ENT_SUBDIR)
01730         {
01731             CStr fullpath;
01732             fullpath = m_path;
01733             if(!fullpath.endsWith(kPathDelimiter))
01734                 fullpath << kPathDelimiter;
01735             fullpath << (*data)[EntnodeData::kName];
01736             CvsCmdTagDeleteFolder(fullpath);
01737         }
01738         else
01739         {
01740             mf.newfile((*data)[EntnodeData::kName]);
01741         }
01742     }
01743     if(mf.NumFiles() != 0)
01744     {
01745         CvsCmdTagDeleteFiles(&mf);
01746     }
01747     return 0;
01748 }

int UCvsFiles::OnCmdTagNew ( void ) [protected]

Definition at line 1682 of file UCvsFiles.cpp.

01683 {
01684     int nItem = -1;
01685
01686     MultiFiles mf;
01687     mf.newdir(m_path);
01688
01689     // first add the folders
01690     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01691     {
01692         EntnodeData *data;
01693         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01694
01695         if(data->GetType() == ENT_SUBDIR)
01696         {
01697             CStr fullpath;
01698             fullpath = m_path;
01699             if(!fullpath.endsWith(kPathDelimiter))
01700                 fullpath << kPathDelimiter;
01701             fullpath << (*data)[EntnodeData::kName];
01702             CvsCmdTagCreateFolder(fullpath);
01703         }
01704         else
01705         {
01706             mf.newfile((*data)[EntnodeData::kName]);
01707         }
01708     }
01709     if(mf.NumFiles() != 0)
01710     {
01711         CvsCmdTagCreateFiles(&mf);
01712     }
01713     return 0;
01714 }

int UCvsFiles::OnCmdTrash ( void ) [protected]

Definition at line 1204 of file UCvsFiles.cpp.

01205 {
01206     int nItem = -1;
01207
01208     MultiFiles mf;
01209     mf.newdir(m_path);
01210
01211     // first add the folders
01212     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01213     {
01214         EntnodeData *data;
01215         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01216
01217         if(data->GetType() != ENT_FILE)
01218             continue;
01219
01220         mf.newfile((*data)[EntnodeData::kName]);
01221     }
01222
01223     if(mf.NumFiles() != 0)
01224     {
01225         CvsArgs args(false);
01226         mf.next();
01227         const char *dir = mf.add(args);
01228         char * const *argv = args.Argv();
01229         int argc = args.Argc();
01230         for(int i = 0; i < argc; i++)
01231         {
01232             CStr fullpath(dir);
01233             if(!fullpath.empty() && !fullpath.endsWith(kPathDelimiter))
01234             {
01235                 fullpath << kPathDelimiter;
01236             }
01237             fullpath << argv[i];
01238
01239             if(chmod(fullpath, 0666) != 0)
01240             {
01241                 cvs_err("Unable to change permission on '%s' (error %d)\n", (const char *)fullpath, errno);
01242                 continue;
01243             }
01244
01245             if(!CompatMoveToTrash(argv[i], dir))
01246                 cvs_err("Unable to remove '%s' (error %d)\n", (const char *)fullpath, errno);
01247             else
01248 #ifdef WIN32
01249                 cvs_out("'%s' has been moved successfully to the recycle bin...\n", (const char *)fullpath);
01250 #else
01251                 cvs_out("'%s' has been deleted successfully...\n", (const char *)fullpath);
01252 #endif
01253             }
01254
01255         ResetView(true);
01256     }
01257     return 0;
01258 }

void UCvsFiles::OnCmdUIAdd ( UCmdUI * pCmdUI ) [protected]

Definition at line 760 of file UCvsFiles.cpp.

00761 {
00762     if(DisableGeneric())
00763     {
00764         pCmdUI->Enable(false);
00765         return;
00766     }
00767
00768     int nItem = -1;
00769     bool res = true;
00770     int numFiles = 0;
00771     int numFolders = 0;
00772
00773     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00774     {
00775         EntnodeData *data;
00776         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00777
00778         if(!(data->IsUnknown() || (data->IsRemoved() && data->IsMissing())))
00779         {
00780             res = false;
00781             break;
00782         }
00783         if(data->GetType() == ENT_FILE)
00784         {
00785             numFiles++;
00786         }
00787         else
00788             numFolders++;
00789
00790         if((numFiles != 0 && numFolders != 0) || numFolders > 1)
00791         {
00792             res = false;
00793             break;
00794         }
00795     }
00796
00797     pCmdUI->Enable(res);
00798 }

void UCvsFiles::OnCmdUIAddB ( UCmdUI * pCmdUI ) [protected]

Definition at line 800 of file UCvsFiles.cpp.

00801 {
00802     if(DisableGeneric())
00803     {
00804         pCmdUI->Enable(false);
00805         return;
00806     }
00807
00808     int nItem = -1;
00809     bool res = true;
00810
00811     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00812     {
00813         EntnodeData *data;
00814         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00815
00816         if(data->GetType() != ENT_FILE)
00817         {
00818             res = false;
00819             break;
00820         }
00821         if(!(data->IsUnknown() || (data->IsRemoved() && data->IsMissing())))
00822         {
00823             res = false;
00824             break;
00825         }
00826     }
00827
00828     pCmdUI->Enable(res);
00829 }

void UCvsFiles::OnCmdUIEditseldef ( UCmdUI * pCmdUI ) [protected]

Definition at line 917 of file UCvsFiles.cpp.

00918 {
00919     if(DisableGeneric())
00920     {
00921         pCmdUI->Enable(false);
00922         return;
00923     }
00924
00925     int nItem = -1;
00926     bool res = true;
00927
00928     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00929     {
00930         EntnodeData *data;
00931         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00932
00933         if(data->GetType() == ENT_SUBDIR || data->IsMissing())
00934         {
00935             res = false;
00936             break;
00937         }
00938     }
00939
00940     pCmdUI->Enable(res);
00941     if(gCvsPrefs.Viewer() != 0L)
00942     {
00943         CStr title("Edit with ");
00944         title << gCvsPrefs.Viewer();
00945         pCmdUI->SetText(title);
00946     }
00947 }

void UCvsFiles::OnCmdUIExplore ( UCmdUI * pCmdUI ) [protected]

Definition at line 984 of file UCvsFiles.cpp.

00985 {
00986     if(DisableGeneric())
00987     {
00988         pCmdUI->Enable(false);
00989         return;
00990     }
00991
00992     int nItem = -1;
00993     bool res = true;
00994     int numItem = 0;
00995
00996     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00997     {
00998         EntnodeData *data;
00999         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01000
01001         if(data->IsMissing() || ++numItem > 1)
01002         {
01003             res = false;
01004             break;
01005         }
01006     }
01007
01008     pCmdUI->Enable(res);
01009 }

void UCvsFiles::OnCmdUIGraph ( UCmdUI * pCmdUI ) [protected]

Definition at line 891 of file UCvsFiles.cpp.

00892 {
00893     if(DisableGeneric())
00894     {
00895         pCmdUI->Enable(false);
00896         return;
00897     }
00898
00899     int nItem = -1;
00900     bool res = true;
00901
00902     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00903     {
00904         EntnodeData *data;
00905         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00906
00907         if(data->IsUnknown() || data->GetType() == ENT_SUBDIR)
00908         {
00909             res = false;
00910             break;
00911         }
00912     }
00913
00914     pCmdUI->Enable(res);
00915 }

void UCvsFiles::OnCmdUIIgnore ( UCmdUI * pCmdUI ) [protected]

Definition at line 1011 of file UCvsFiles.cpp.

01012 {
01013     pCmdUI->Enable(!DisableGeneric());
01014     pCmdUI->Check(gFileViewIgnore);
01015 }

void UCvsFiles::OnCmdUIMacroSel | ( | int | cmd,
 |  | UCmdUI * | pCmdUI
 | ) | [protected]

Definition at line 1017 of file UCvsFiles.cpp.

01018 {
01019     if(DisableGeneric())
01020     {
01021         pCmdUI->Enable(false);
01022         return;
01023     }
01024
01025     int nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, -1), 0L);
01026     pCmdUI->Enable(nItem != -1 && CTcl_Interp::IsAvail());
01027 }

void UCvsFiles::OnCmdUIRelease ( UCmdUI * pCmdUI ) [protected]

Definition at line 831 of file UCvsFiles.cpp.

00832 {
00833     if(DisableGeneric())
00834     {
00835         pCmdUI->Enable(false);
00836         return;
00837     }
00838
00839     int nItem = -1;
00840     bool res = true;
00841     int numFolders = 0;
00842
00843     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00844     {
00845         EntnodeData *data;
00846         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00847
00848         if(data->IsUnknown() || data->GetType() != ENT_SUBDIR)
00849         {
00850             res = false;
00851             break;
00852         }
00853         numFolders++;
00854
00855         if(numFolders > 1)
00856         {
00857             res = false;
00858             break;
00859         }
00860     }
00861
00862     pCmdUI->Enable(res);
00863 }

void UCvsFiles::OnCmdUIReload ( UCmdUI * pCmdUI ) [protected]

Definition at line 949 of file UCvsFiles.cpp.

00950 {
00951     pCmdUI->Enable(!DisableGeneric());
00952 }

void UCvsFiles::OnCmdUIRmv ( UCmdUI * pCmdUI ) [protected]

Definition at line 865 of file UCvsFiles.cpp.

00866 {
00867     if(DisableGeneric())
00868     {
00869         pCmdUI->Enable(false);
00870         return;
00871     }
00872
00873     int nItem = -1;
00874     bool res = true;
00875
00876     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00877     {
00878         EntnodeData *data;
00879         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00880
00881         if(data->IsUnknown() || data->IsRemoved() || data->GetType() == ENT_SUBDIR)
00882         {
00883             res = false;
00884             break;
00885         }
00886     }
00887
00888     pCmdUI->Enable(res);
00889 }

void UCvsFiles::OnCmdUITrash ( UCmdUI * pCmdUI ) [protected]

Definition at line 959 of file UCvsFiles.cpp.

00960 {
00961     if(DisableGeneric())
00962     {
00963         pCmdUI->Enable(false);
00964         return;
00965     }
00966
00967     int nItem = -1;
00968     bool res = true;
00969
00970     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00971     {
00972         EntnodeData *data;
00973         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00974         if(data->GetType() == ENT_SUBDIR || data->IsMissing())
00975         {
00976             res = false;
00977             break;
00978         }
00979     }
00980
00981     pCmdUI->Enable(res);
00982 }

void UCvsFiles::OnCmdUIUpdate ( UCmdUI * pCmdUI ) [protected]

Definition at line 722 of file UCvsFiles.cpp.

00723 {
00724     if(DisableGeneric())
00725     {
00726         pCmdUI->Enable(false);
00727         return;
00728     }
00729
00730     int nItem = -1;
00731     bool res = true;
00732     int numFiles = 0;
00733     int numFolders = 0;
00734
00735     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00736     {
00737         EntnodeData *data;
00738         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00739
00740         if(data->IsUnknown())
00741         {
00742             res = false;
00743             break;
00744         }
00745         if(data->GetType() == ENT_FILE)
00746             numFiles++;
00747         else
00748             numFolders++;
00749
00750         if((numFiles != 0 && numFolders != 0) || numFolders > 1)
00751         {
00752             res = false;
00753             break;
00754         }
00755     }
00756
00757     pCmdUI->Enable(res);
00758 }

void UCvsFiles::OnCmdUIUpone ( UCmdUI * pCmdUI ) [protected]

Definition at line 954 of file UCvsFiles.cpp.

00955 {
00956     pCmdUI->Enable(!DisableGeneric());
00957 }

int UCvsFiles::OnCmdUnedit ( void ) [protected]

Definition at line 1557 of file UCvsFiles.cpp.

01558 {
01559     int nItem = -1;
01560
01561     MultiFiles mf;
01562     mf.newdir(m_path);
01563
01564     // first add the folders
01565     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01566     {
01567         EntnodeData *data;
01568         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01569
01570         if(data->GetType() == ENT_SUBDIR)
01571         {
01572             CStr fullpath;
01573             fullpath = m_path;
01574             if(!fullpath.endsWith(kPathDelimiter))
01575                 fullpath << kPathDelimiter;
01576             fullpath << (*data)[EntnodeData::kName];
01577             CvsCmdUneditFolder(fullpath);
01578         }
01579         else
01580         {
01581             mf.newfile((*data)[EntnodeData::kName]);
01582         }
01583     }
01584     if(mf.NumFiles() != 0)
01585     {
01586         CvsCmdUneditFiles(&mf);
01587     }
01588     return 0;
01589 }

int UCvsFiles::OnCmdUnlock ( void ) [protected]

Definition at line 1421 of file UCvsFiles.cpp.

01422 {
01423     int nItem = -1;
01424
01425     MultiFiles mf;
01426     mf.newdir(m_path);
01427
01428     // first add the folders
01429     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01430     {
01431         EntnodeData *data;
01432         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01433
01434         if(data->GetType() == ENT_SUBDIR)
01435         {
01436             CStr fullpath;
01437             fullpath = m_path;
01438             if(!fullpath.endsWith(kPathDelimiter))
01439                 fullpath << kPathDelimiter;
01440             fullpath << (*data)[EntnodeData::kName];
01441             CvsCmdUnlockFolder(fullpath);
01442         }
01443         else
01444         {
01445             mf.newfile((*data)[EntnodeData::kName]);
01446         }
01447     }
01448     if(mf.NumFiles() != 0)
01449     {
01450         CvsCmdUnlockFiles(&mf);
01451     }
01452     return 0;
01453 }

int UCvsFiles::OnCmdUpdate ( void ) [protected]

Definition at line 682 of file UCvsFiles.cpp.

00683 {
00684     int nItem = -1;
00685
00686     MultiFiles mf;
00687     mf.newdir(m_path);
00688
00689     // first add the folders
00690     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00691     {
00692         EntnodeData *data;
00693         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00694
00695         if(data->GetType() == ENT_SUBDIR)
00696         {
00697             CStr fullpath;
00698             fullpath = m_path;
00699             if(!fullpath.endsWith(kPathDelimiter))
00700                 fullpath << kPathDelimiter;
00701             fullpath << (*data)[EntnodeData::kName];
00702             CvsCmdUpdateFolder(fullpath);
00703         }
00704         else
00705         {
00706             mf.newfile((*data)[EntnodeData::kName]);
00707         }
00708     }
00709     if(mf.NumFiles() != 0)
00710     {
00711         CvsCmdUpdateFiles(&mf);
00712     }
00713     return 0;
00714 }

int UCvsFiles::OnCmdUpone ( void ) [protected]

Definition at line 1196 of file UCvsFiles.cpp.

01197 {
01198     UStr uppath, filename;
01199     SplitPath(m_path, uppath, filename);
01200     ResetView(uppath, true);
01201     return 0;
01202 }

int UCvsFiles::OnCmdWatchOff ( void ) [protected]

Definition at line 1489 of file UCvsFiles.cpp.

01490 {
01491     int nItem = -1;
01492
01493     MultiFiles mf;
01494     mf.newdir(m_path);
01495
01496     // first add the folders
01497     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01498     {
01499         EntnodeData *data;
01500         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01501
01502         if(data->GetType() == ENT_SUBDIR)
01503         {
01504             CStr fullpath;
01505             fullpath = m_path;
01506             if(!fullpath.endsWith(kPathDelimiter))
01507                 fullpath << kPathDelimiter;
01508             fullpath << (*data)[EntnodeData::kName];
01509             CvsCmdWatchOffFolder(fullpath);
01510         }
01511         else
01512         {
01513             mf.newfile((*data)[EntnodeData::kName]);
01514         }
01515     }
01516     if(mf.NumFiles() != 0)
01517     {
01518         CvsCmdWatchOffFiles(&mf);
01519     }
01520     return 0;
01521 }

int UCvsFiles::OnCmdWatchOn ( void ) [protected]

Definition at line 1455 of file UCvsFiles.cpp.

01456 {
01457     int nItem = -1;
01458
01459     MultiFiles mf;
01460     mf.newdir(m_path);
01461
01462     // first add the folders
01463     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01464     {
01465         EntnodeData *data;
01466         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01467
01468         if(data->GetType() == ENT_SUBDIR)
01469         {
01470             CStr fullpath;
01471             fullpath = m_path;
01472             if(!fullpath.endsWith(kPathDelimiter))
01473                 fullpath << kPathDelimiter;
01474             fullpath << (*data)[EntnodeData::kName];
01475             CvsCmdWatchOnFolder(fullpath);
01476         }
01477         else
01478         {
01479             mf.newfile((*data)[EntnodeData::kName]);
01480         }
01481     }
01482     if(mf.NumFiles() != 0)
01483     {
01484         CvsCmdWatchOnFiles(&mf);
01485     }
01486     return 0;
01487 }

int UCvsFiles::OnCmdWatchers ( void ) [protected]

Definition at line 1591 of file UCvsFiles.cpp.

01592 {
01593     int nItem = -1;
01594
01595     MultiFiles mf;
01596     mf.newdir(m_path);
01597
01598     // first add the folders
01599     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01600     {
01601         EntnodeData *data;
01602         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01603
01604         if(data->GetType() == ENT_SUBDIR)
01605         {
01606             CStr fullpath;
01607             fullpath = m_path;
01608             if(!fullpath.endsWith(kPathDelimiter))
01609                 fullpath << kPathDelimiter;
01610             fullpath << (*data)[EntnodeData::kName];
01611             CvsCmdWatchersFolder(fullpath);
01612         }
01613         else
01614         {
01615             mf.newfile((*data)[EntnodeData::kName]);
01616         }
01617     }
01618     if(mf.NumFiles() != 0)
01619     {
01620         CvsCmdWatchersFiles(&mf);
01621     }
01622     return 0;
01623 }

void UCvsFiles::OnCreate ( void ) [protected]

Definition at line 378 of file UCvsFiles.cpp.

00379 {
00380     if(sFileIconTextIcon == 0L)
00381     {
00382         sFileIconTextIcon = UCreate_pixmap(this, "cvsfile.xpm");
00383         sFileIconBinaryIcon = UCreate_pixmap(this, "binfile.xpm");
00384         sFileIconUnknownIcon = UCreate_pixmap(this, "unkfile.xpm");
00385         sFileIconAddedIcon = UCreate_pixmap(this, "addfile.xpm");
00386         sFileIconConflictIcon = UCreate_pixmap(this, "conflict.xpm");
00387         sFileIconMissIcon = UCreate_pixmap(this, "missfile.xpm");
00388         sFolderIconIcon = UCreate_pixmap(this, "folder.xpm");
00389         sFolderIconUnknownIcon = UCreate_pixmap(this, "foldunk.xpm");
00390         sFolderIconMissIcon = UCreate_pixmap(this, "foldmiss.xpm");
00391         sFileIconTextModIcon = UCreate_pixmap(this, "modfile.xpm");
00392         sFileIconBinaryModIcon = UCreate_pixmap(this, "modbin.xpm");
00393         sFileIconIgnoredIcon = UCreate_pixmap(this, "ignfile.xpm");
00394         sFolderIconIgnoredIcon = UCreate_pixmap(this, "foldign.xpm");
00395         sFileIconRemovedIcon = UCreate_pixmap(this, "delfile.xpm");
00396     }
00397
00398     UEventSendMessage(GetWidID(), EV_LIST_SETFEEDBACK, UMAKEINT(kUMainWidget, 0), 0L);
00399     UEventSendMessage(GetWidID(), EV_LIST_ADDCOLUMNS, UMAKEINT(kUMainWidget, NUM_COLUMNS), 0L);
00400     for(int i = 0; i < NUM_COLUMNS; i++)
00401     {
00402         UEventSendMessage(GetWidID(), EV_LIST_SETCOLTITLE, UMAKEINT(kUMainWidget, i), _gszColumnLabel[i]);
00403         UEventSendMessage(GetWidID(), EV_LIST_SETCOLWIDTH, UMAKEINT(kUMainWidget, i), (void *)_gnColumnWidth[i]);
00404     }
00405     UEventSendMessage(GetWidID(), EV_LIST_SETFEEDBACK, UMAKEINT(kUMainWidget, 1), 0L);
00406 }

void UCvsFiles::OnDblClick ( void ) [protected]

Definition at line 1942 of file UCvsFiles.cpp.

01943 {
01944     int nItem = -1;
01945
01946     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01947     {
01948         EntnodeData *data;
01949         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01950         EditSel(data);
01951     }
01952 }

void UCvsFiles::OnDestroy ( void ) [protected]

Definition at line 373 of file UCvsFiles.cpp.

00374 {
00375     delete this;
00376 }

int UCvsFiles::OnMacroSel ( int cmd ) [protected]

Definition at line 1851 of file UCvsFiles.cpp.

01852 {
01853     CTcl_Interp interp;
01854     CMacroEntry & entry = gMacrosSel.entries[cmd - cmdSELMACRO];
01855     CStr path = entry.path;
01856     CTcl_Interp::Unixfy(path);
01857
01858     TclBrowserReset();
01859
01860     int nItem = -1;
01861     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL, UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
01862     {
01863         EntnodeData *data;
01864         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
01865         TclBrowserAppend(m_path, data);
01866     }
01867
01868     interp.DoScriptVar("source \"%s\"", (const char *)path);
01869     return 0;
01870 }

void UCvsFiles::OnSelColumn ( int column ) [protected]

Definition at line 2103 of file UCvsFiles.cpp.

02104 {
02105     if(column == m_sort)
02106         m_ascendant = !m_ascendant;
02107     else
02108     {
02109         m_ascendant = true;
02110         switch(column)
02111         {
02112         case EntnodeData::kName:
02113         case EntnodeData::kStatus:
02114         case EntnodeFile::kOption:
02115         case EntnodeFile::kTag:
02116         case EntnodeFile::kConflict:
02117         case EntnodeFile::kVN:
02118             m_sort = column;
02119             break;
02120         }
02121     }
02122
02123     Resort();
02124 }

void UCvsFiles::ResetView | ( | bool | forceReload = false,
 |  | bool | notifyBrowser = false
 | ) |

Definition at line 466 of file UCvsFiles.cpp.

00467 {
00468     UWaitCursor wait;
00469
00470     static bool sSemaphore = false;
00471     USemaphore policeman(sSemaphore);
00472     if(policeman.IsEnteredTwice())
00473         return;
00474
00475     // - check if we really need to reload (forceReload == false)
00476     // - wait a bit for the watcher in order to let him tell us
00477     // if something was modified.
00478     time_t newEntriesMod;
00479     time_t newEntriesLogMod;
00480     GetEntriesModTime(newEntriesMod, newEntriesLogMod);
00481     if(!forceReload)
00482     {
00483         if(m_entriesMod == newEntriesMod && m_entriesLogMod == newEntriesLogMod)
00484             return;
00485     }
00486
00487     // reset all the watchers
00488     m_entriesMod = newEntriesMod;
00489     m_entriesLogMod = newEntriesLogMod;
00490
00491     // get the selection to later try to restore it
00492     CvsArgs selection(false);
00493     int nItem = -1;
00494
00495     while((nItem = UEventSendMessage(GetWidID(), EV_LIST_GETNEXTSEL,
00496                                      UMAKEINT(kUMainWidget, nItem), 0L)) != -1)
00497     {
00498         EntnodeData *data;
00499         UEventSendMessage(GetWidID(), EV_LIST_ROWGETDATA, UMAKEINT(kUMainWidget, nItem), &data);
00500         selection.add((*data)[EntnodeData::kName]);
00501     }
00502
00503     UEventSendMessage(GetWidID(), EV_LIST_RESETALL, kUMainWidget, 0L);
00504
00505     // refetch all items
00506     TViewFill traverse(this, m_entries);
00507     /*kTraversal res = */FileTraverse(m_path, traverse);
00508
00509     // add the missing files
00510     Entries_SetMissing(m_entries);
00511
00512     int numEntries = m_entries.NumOfElements();
00513     for(int i = 0; i < numEntries; i++)
00514     {
00515         const ENTNODE & theNode = m_entries.Get(i);
00516         EntnodeData *data = ((ENTNODE *)&theNode)->Data();
00517         if(!data->IsMissing())
00518             continue;
00519
00520         int rownum;
00521         UEventSendMessage(GetWidID(), EV_LIST_NEWROW, kUMainWidget, &rownum);
00522         UEventSendMessage(GetWidID(), EV_LIST_ROWSETDATA, UMAKEINT(kUMainWidget, rownum), data);
00523         ULIST_INSERT entry;
00524         entry.row = rownum;
00525
00526         entry.col = 0;
00527         entry.title = (*data)[EntnodeData::kName];
00528         entry.icon = UCvsFiles::GetImageForEntry(data);
00529         UEventSendMessage(GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00530
00531         entry.icon = 0L;
00532
00533         // set item text for additional columns
00534         for(int j = 1; j < NUM_COLUMNS; j++)
00535         {
00536             const char *info = (*data)[j];
00537             if(info != 0L)
00538             {
00539                 entry.col = j;
00540                 entry.title = info;
00541                 UEventSendMessage(GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00542             }
00543         }
00544         entry.col = EntnodeData::kStatus;
00545         entry.title = data->GetDesc();
00546         UEventSendMessage(GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00547     }
00548
00549     Resort();
00550
00551     // now restore the selection
00552     int argc = selection.Argc(), c;
00553     char * const *argv = selection.Argv();
00554     for(c = 0; c < argc; c++)
00555     {
00556         int row = Search(argv[c]);
00557         if(row != -1)
00558             UEventSendMessage(GetWidID(), EV_LIST_ADDSEL, UMAKEINT(kUMainWidget, row), 0L);
00559     }
00560
00561     if(notifyBrowser)
00562     {
00563         // notify the tree
00564         UCvsApp::gApp->GetBrowserView()->ResetView(forceReload);
00565     }
00566 }

void UCvsFiles::ResetView | ( | const char * | path,
 |  | bool | notifyBrowser = false
 | ) |

Definition at line 408 of file UCvsFiles.cpp.

Referenced by EditSel(), OnCmdIgnore(), OnCmdReload(), OnCmdTrash(), OnCmdUpone(), UCvsApp::OnMainTimer(), UCvsFolders::OnTreeSelecting(), UCvsFolders::ResetBrowser(), and UCvsFolders::ResetView().

00409 {
00410     m_path = path;
00411     ResetView(true);
00412
00413     UStr title(UCvsApp::gApp->GetAppName());
00414     title << ": ";
00415     title << m_path;
00416     UEventSendMessage(kUCvsFrameID, EV_SETTEXT, kUMainWidget, (void *)(const char *)title);
00417
00418     if(notifyBrowser)
00419     {
00420         // notify the tree
00421         UCvsApp::gApp->GetBrowserView()->StepToLocation(path);
00422     }
00423 }

void UCvsFiles::Resort ( void ) [protected]

Definition at line 2075 of file UCvsFiles.cpp.

Referenced by OnSelColumn(), and ResetView().

02076 {
02077     UListSorter fsort = 0L;
02078     switch(m_sort)
02079     {
02080     case EntnodeData::kName:
02081         fsort = compareName;
02082         break;
02083     case EntnodeFile::kVN:
02084         fsort = compareRevs;
02085         break;
02086     case EntnodeData::kStatus:
02087         fsort = compareStatus;
02088         break;
02089     case EntnodeFile::kOption:
02090         fsort = compareOption;
02091         break;
02092     case EntnodeFile::kTag:
02093         fsort = compareTag;
02094         break;
02095     case EntnodeFile::kConflict:
02096         fsort = compareConflict;
02097         break;
02098     }
02099     if(fsort != 0L)
02100         UEventSendMessage(GetWidID(), EV_LIST_RESORT, UMAKEINT(kUMainWidget, m_sort), (void *)fsort);
02101 }

int UCvsFiles::Search ( const char * title ) [protected]

Definition at line 442 of file UCvsFiles.cpp.

Referenced by ResetView().

00443 {
00444     int row = -1;
00445     while((row = UEventSendMessage(GetWidID(), EV_LIST_GETNEXT,
00446                                      UMAKEINT(kUMainWidget, row), 0L)) != -1)
00447     {
00448         ULIST_INFO info;
00449         info.col = 0;
00450         info.row = row;
00451         UEventSendMessage(GetWidID(), EV_LIST_GETINFO, kUMainWidget, &info);
00452         if(info.title == 0L)
00453             continue;
00454
00455 #if qUnix
00456         if(strcmp(title, info.title) == 0)
00457 #else
00458         if(stricmp(title, info.title) == 0)
00459 #endif
00460             return row;
00461     }
00462
00463     return -1;
00464 }

Member Data Documentation

const UMSGMAP_ENTRY UCvsFiles::_messageEntries[] [static, private]

Reimplemented from UWidget.

Definition at line 127 of file UCvsFiles.h.

bool UCvsFiles::m_ascendant [protected]

Definition at line 71 of file UCvsFiles.h.

CSortList<ENTNODE> UCvsFiles::m_entries [protected]

Definition at line 62 of file UCvsFiles.h.

time_t UCvsFiles::m_entriesLogMod [protected]

Definition at line 67 of file UCvsFiles.h.

time_t UCvsFiles::m_entriesMod [protected]

Definition at line 66 of file UCvsFiles.h.

UStr UCvsFiles::m_path [protected]

Definition at line 64 of file UCvsFiles.h.

int UCvsFiles::m_sort [protected]

Definition at line 69 of file UCvsFiles.h.

const UMSGMAP UCvsFiles::messageMap [static, protected]

Reimplemented from UWidget.

Definition at line 127 of file UCvsFiles.h.

The documentation for this class was generated from the following files:
  • common/UCvsFiles.h
  • common/UCvsFiles.cpp
Generated on Sun Oct 21 12:47:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsFolders Class Reference

#include <UCvsFolders.h>

Inheritance diagram for UCvsFolders:

[legend]
Collaboration diagram for UCvsFolders:

[legend]
List of all members.

Public Methods

UCvsFolders ()
virtual | ~UCvsFolders ()
void | ResetBrowser (const char *path, bool notifyView=false)
const char * | GetRoot (void) const
void | RetrievePath (UTREEITEM item, UStr &path)
void | StepToLocation (const char *path, bool notifyView=false)
void | DeleteAllItems (UTREEITEM root=0L)
void | ResetView (bool forceReload=false, bool notifyView=false)

Static Public Methods

void | SetDefaultRoot (const char *root)

Protected Methods

void | OnUpdateGeneric (UCmdUI *pCmdUI, bool needCvsInfos)
bool | DisableGeneric ()
void | StoreExpanded (std::vector< UStr > &allExpanded, UTREEITEM root=0L)
UTREEITEM | GetItemByLocation (const char *path)
void | OnDestroy ()
void | OnCreate ()
void | OnTreeExpanding (int collapse, UTREEITEM item)
void | OnTreeSelecting (int deselect, UTREEITEM item)
void | OnCmdUIMacrosSel (int cmd, UCmdUI *pCmdUI)
void | OnCmdUIUpdate (UCmdUI *pCmdUI)
void | OnCmdUIAdd (UCmdUI *pCmdUI)
void | OnCmdUIExplore (UCmdUI *pCmdUI)
void | OnCmdUIReload (UCmdUI *pCmdUI)
void | OnCmdUIIgnore (UCmdUI *pCmdUI)
void | OnCmdUICheckout (UCmdUI *pCmdUI)
void | OnCmdUIImport (UCmdUI *pCmdUI)
int | OnCmdUpdate (void)
int | OnCmdAdd (void)
int | OnCmdCommit (void)
int | OnCmdQueryUpdate (void)
int | OnCmdDiff (void)
int | OnCmdLog (void)
int | OnCmdStatus (void)
int | OnCmdLock (void)
int | OnCmdUnlock (void)
int | OnCmdWatchOn (void)
int | OnCmdWatchOff (void)
int | OnCmdEdit (void)
int | OnCmdUnedit (void)
int | OnCmdWatchers (void)
int | OnCmdEditors (void)
int | OnCmdRelease (void)
int | OnCmdTagNew (void)
int | OnCmdTagDelete (void)
int | OnCmdTagBranch (void)
int | OnCmdExplore (void)
int | OnCmdReload (void)
int | OnCmdIgnore (void)
int | OnCmdCheckout (void)
int | OnCmdImport (void)
int | OnCmdMacrosSel (int cmd)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

UStr m_root

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Constructor & Destructor Documentation

UCvsFolders::UCvsFolders ( )

Definition at line 431 of file UCvsFolders.cpp.

00431                          : UWidget(kUCvsFoldersID)
00432 {
00433 }

UCvsFolders::~UCvsFolders ( ) [virtual]

Definition at line 435 of file UCvsFolders.cpp.

00436 {
00437 }

Member Function Documentation

void UCvsFolders::DeleteAllItems ( UTREEITEM root = 0L )

Definition at line 868 of file UCvsFolders.cpp.

Referenced by OnTreeExpanding(), and ResetBrowser().

00869 {
00870     // we don't want the file view to be notified when things get deleted
00871     CTempToggleBool toggler(sTemporaryTurnOffNotify);
00872
00873     UTREE_INFO query;
00874     bool eraseRoot = false;
00875     query.item = root;
00876     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00877     if(root == 0L)
00878     {
00879         root = query.item;
00880         eraseRoot = true;
00881     }
00882
00883     if(root == 0L)
00884         return;
00885
00886     UTREEITEM childItem = query.child;
00887
00888     // erase all the childs
00889     while(childItem != 0L)
00890     {
00891         UTREE_INFO queryChild;
00892         queryChild.item = childItem;
00893         UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &queryChild);
00894
00895         EntnodeData *data = (EntnodeData *)queryChild.data;
00896         if(data != 0L)
00897         {
00898             queryChild.data = 0L; // So that subsequent references after UnRef() won't SEGV
00899             UEventSendMessage(GetWidID(), EV_TREE_SETDATA, kUMainWidget, &queryChild);
00900             data->UnRef();  // Or move this one after DeleteAllItems? so we don't loose one system call. For now, safe way
00901         }
00902
00903         DeleteAllItems(childItem);
00904
00905         UEventSendMessage(GetWidID(), EV_TREE_DELETE, kUMainWidget, childItem);
00906         childItem = queryChild.next;
00907     }
00908
00909     // erase the root only if initially root was 0L
00910     if(eraseRoot)
00911     {
00912         EntnodeData *data = (EntnodeData *)query.data;
00913         ASSERT(data == 0L);
00914
00915         UEventSendMessage(GetWidID(), EV_TREE_DELETE, kUMainWidget, root);
00916     }
00917 }

bool UCvsFolders::DisableGeneric ( ) [protected]

Definition at line 919 of file UCvsFolders.cpp.

Referenced by OnCmdUIExplore(), OnCmdUIIgnore(), OnCmdUIMacrosSel(), and OnUpdateGeneric().

00920 {
00921     UCvsApp *app = UCvsApp::gApp;
00922     return app->IsCvsRunning() || gCvsPrefs.empty() || !HasFocus();
00923 }

const UMSGMAP* UCvsFolders::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

UTREEITEM UCvsFolders::GetItemByLocation ( const char * path ) [protected]

Definition at line 677 of file UCvsFolders.cpp.

Referenced by ResetView().

00678 {
00679     UStr root(m_root);
00680     if(!root.endsWith(kPathDelimiter))
00681         root << kPathDelimiter;
00682     UStr subpath(path);
00683     if(!subpath.endsWith(kPathDelimiter))
00684         subpath << kPathDelimiter;
00685
00686     // check if it is a sub-path
00687     if(strncmp(root, subpath, root.length()) != 0)
00688         return 0L;
00689
00690     UTREE_INFO query;
00691     query.item = 0L;
00692     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00693     UTREEITEM item = query.item;
00694     if(item == 0L)
00695         return 0L;
00696
00697     // step inside synchronized
00698     const char *tmp = (const char *)subpath + root.length() - 1;
00699     while((tmp = strchr(tmp, kPathDelimiter)) != 0L)
00700     {
00701         const char *name = ++tmp;
00702         if(name[0] == '\0')
00703             break;
00704
00705         CStr subname;
00706         const char *tmp2 = strchr(name, kPathDelimiter);
00707         if(tmp2 == 0L)
00708             subname = name;
00709         else
00710             subname.set(name, tmp2 - name);
00711
00712         UTREEITEM childItem = query.child;
00713
00714         // find the subitem which matches this name
00715         while(childItem != 0L)
00716         {
00717             query.item = childItem;
00718             UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00719             EntnodeData *data = (EntnodeData *)query.data;
00720             if(data != 0L)
00721             {
00722 #if qUnix
00723                 if(strcmp((*data)[EntnodeData::kName], subname) == 0)
00724 #else
00725                 if(_stricmp((*data)[EntnodeData::kName], subname) == 0)
00726 #endif
00727                 {
00728                     item = childItem;
00729                     break;
00730                 }
00731             }
00732
00733             childItem = query.next;
00734         }
00735         if(childItem == 0L)
00736             return 0L;
00737     }
00738
00739     return item;
00740 }

virtual const UMSGMAP* UCvsFolders::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

const char* UCvsFolders::GetRoot ( void ) const [inline]

Definition at line 40 of file UCvsFolders.h.

Referenced by UCvsFrame::OnCmdSaveSettings(), and CvsPrefs::save().

00040 { return m_root; }

const UMSGMAP* UCvsFolders::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

int UCvsFolders::OnCmdAdd ( void ) [protected]

Definition at line 971 of file UCvsFolders.cpp.

00972 {
00973     UTREEITEM *item;
00974     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
00975     ASSERT(item != 0L);
00976
00977     UStr path;
00978     RetrievePath(item, path);
00979     CvsCmdAddFolder(path);
00980     return 0;
00981 }

int UCvsFolders::OnCmdCheckout ( void ) [protected]

Definition at line 1227 of file UCvsFolders.cpp.

01228 {
01229     CvsCmdCheckoutModule();
01230     return 0;
01231 }

int UCvsFolders::OnCmdCommit ( void ) [protected]

Definition at line 983 of file UCvsFolders.cpp.

00984 {
00985     UTREEITEM *item;
00986     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
00987     ASSERT(item != 0L);
00988
00989     UStr path;
00990     RetrievePath(item, path);
00991     CvsCmdCommitFolder(path);
00992     return 0;
00993 }

int UCvsFolders::OnCmdDiff ( void ) [protected]

Definition at line 1007 of file UCvsFolders.cpp.

01008 {
01009     UTREEITEM *item;
01010     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01011     ASSERT(item != 0L);
01012
01013     UStr path;
01014     RetrievePath(item, path);
01015     CvsCmdDiffFolder(path);
01016     return 0;
01017 }

int UCvsFolders::OnCmdEdit ( void ) [protected]

Definition at line 1091 of file UCvsFolders.cpp.

01092 {
01093     UTREEITEM *item;
01094     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01095     ASSERT(item != 0L);
01096
01097     UStr path;
01098     RetrievePath(item, path);
01099     CvsCmdEditFolder(path);
01100     return 0;
01101 }

int UCvsFolders::OnCmdEditors ( void ) [protected]

Definition at line 1127 of file UCvsFolders.cpp.

01128 {
01129     UTREEITEM *item;
01130     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01131     ASSERT(item != 0L);
01132
01133     UStr path;
01134     RetrievePath(item, path);
01135     CvsCmdEditorsFolder(path);
01136     return 0;
01137 }

int UCvsFolders::OnCmdExplore ( void ) [protected]

Definition at line 1187 of file UCvsFolders.cpp.

01188 {
01189     UTREEITEM *item;
01190     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01191     ASSERT(item != 0L);
01192
01193     UStr path;
01194     RetrievePath(item, path);
01195
01196 #ifdef WIN32
01197     HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), "explore", path,
01198             0L, 0L, SW_SHOWDEFAULT);
01199     if((long)hInst < 32)
01200     {
01201         cvs_err("Unable to explore '%s' (error %d)\n", (const char *)path, GetLastError());
01202     }
01203 #endif
01204 #ifdef qUnix
01205     CvsArgs args(false);
01206     args.add(gCvsPrefs.Browser());
01207     args.add(path);
01208     UCvsApp::gApp->Execute(args.Argc(), args.Argv());
01209 #endif
01210
01211     return 0;
01212 }

int UCvsFolders::OnCmdIgnore ( void ) [protected]

Definition at line 1220 of file UCvsFolders.cpp.

01221 {
01222     gFileViewIgnore = !(bool)gFileViewIgnore;
01223     ResetView(true, true);
01224     return 0;
01225 }

int UCvsFolders::OnCmdImport ( void ) [protected]

Definition at line 1233 of file UCvsFolders.cpp.

01234 {
01235     CvsCmdImportModule();
01236     return 0;
01237 }

int UCvsFolders::OnCmdLock ( void ) [protected]

Definition at line 1043 of file UCvsFolders.cpp.

01044 {
01045     UTREEITEM *item;
01046     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01047     ASSERT(item != 0L);
01048
01049     UStr path;
01050     RetrievePath(item, path);
01051     CvsCmdLockFolder(path);
01052     return 0;
01053 }

int UCvsFolders::OnCmdLog ( void ) [protected]

Definition at line 1019 of file UCvsFolders.cpp.

01020 {
01021     UTREEITEM *item;
01022     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01023     ASSERT(item != 0L);
01024
01025     UStr path;
01026     RetrievePath(item, path);
01027     CvsCmdLogFolder(path);
01028     return 0;
01029 }

int UCvsFolders::OnCmdMacrosSel ( int cmd ) [protected]

Definition at line 1292 of file UCvsFolders.cpp.

01293 {
01294     CTcl_Interp interp;
01295     CMacroEntry & entry = gMacrosSel.entries[cmd - cmdSELMACRO];
01296     CStr path = entry.path;
01297     CTcl_Interp::Unixfy(path);
01298
01299     UTREEITEM selItem;
01300     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &selItem);
01301
01302     CStr selPath;
01303     RetrievePath(selItem, selPath);
01304     CStr uppath, folder;
01305     SplitPath(selPath, uppath, folder);
01306
01307     UTREE_INFO query;
01308     query.item = selItem;
01309     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
01310     bool deleteData = false;
01311     EntnodeData *data = (EntnodeData *)query.data;
01312     if(data == 0L)
01313     {
01314         deleteData = true;
01315         EntnodePath *apath = new EntnodePath(uppath);
01316         data = new EntnodeFolder(folder, apath);
01317         apath->UnRef();
01318     }
01319
01320     TclBrowserReset();
01321     TclBrowserAppend(uppath, data);
01322
01323     interp.DoScriptVar("source \"%s\"", (const char *)path);
01324
01325     if(deleteData)
01326         data->UnRef();
01327
01328     return 0;
01329 }

int UCvsFolders::OnCmdQueryUpdate ( void ) [protected]

Definition at line 995 of file UCvsFolders.cpp.

00996 {
00997     UTREEITEM *item;
00998     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
00999     ASSERT(item != 0L);
01000
01001     UStr path;
01002     RetrievePath(item, path);
01003     CvsCmdUpdateFolder(path, true);
01004     return 0;
01005 }

int UCvsFolders::OnCmdRelease ( void ) [protected]

Definition at line 1139 of file UCvsFolders.cpp.

01140 {
01141     UTREEITEM *item;
01142     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01143     ASSERT(item != 0L);
01144
01145     UStr path;
01146     RetrievePath(item, path);
01147     CvsCmdReleaseFolder(path);
01148     return 0;
01149 }

int UCvsFolders::OnCmdReload ( void ) [protected]

Definition at line 1214 of file UCvsFolders.cpp.

01215 {
01216     ResetView(true);
01217     return 0;
01218 }

int UCvsFolders::OnCmdStatus ( void ) [protected]

Definition at line 1031 of file UCvsFolders.cpp.

01032 {
01033     UTREEITEM *item;
01034     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01035     ASSERT(item != 0L);
01036
01037     UStr path;
01038     RetrievePath(item, path);
01039     CvsCmdStatusFolder(path);
01040     return 0;
01041 }

int UCvsFolders::OnCmdTagBranch ( void ) [protected]

Definition at line 1175 of file UCvsFolders.cpp.

01176 {
01177     UTREEITEM *item;
01178     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01179     ASSERT(item != 0L);
01180
01181     UStr path;
01182     RetrievePath(item, path);
01183     CvsCmdTagBranchFolder(path);
01184     return 0;
01185 }

int UCvsFolders::OnCmdTagDelete ( void ) [protected]

Definition at line 1163 of file UCvsFolders.cpp.

01164 {
01165     UTREEITEM *item;
01166     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01167     ASSERT(item != 0L);
01168
01169     UStr path;
01170     RetrievePath(item, path);
01171     CvsCmdTagDeleteFolder(path);
01172     return 0;
01173 }

int UCvsFolders::OnCmdTagNew ( void ) [protected]

Definition at line 1151 of file UCvsFolders.cpp.

01152 {
01153     UTREEITEM *item;
01154     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01155     ASSERT(item != 0L);
01156
01157     UStr path;
01158     RetrievePath(item, path);
01159     CvsCmdTagCreateFolder(path);
01160     return 0;
01161 }

void UCvsFolders::OnCmdUIAdd ( UCmdUI * pCmdUI ) [protected]

Definition at line 1239 of file UCvsFolders.cpp.

01240 {
01241     OnUpdateGeneric(pCmdUI, false);
01242 }

void UCvsFolders::OnCmdUICheckout ( UCmdUI * pCmdUI ) [protected]

Definition at line 1268 of file UCvsFolders.cpp.

01269 {
01270     UCvsApp *app = UCvsApp::gApp;
01271     pCmdUI->Enable(!app->IsCvsRunning() && !gCvsPrefs.empty());
01272 }

void UCvsFolders::OnCmdUIExplore ( UCmdUI * pCmdUI ) [protected]

Definition at line 1244 of file UCvsFolders.cpp.

01245 {
01246     if(DisableGeneric())
01247     {
01248         pCmdUI->Enable(false);
01249         return;
01250     }
01251     UTREEITEM selItem;
01252     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &selItem);
01253     pCmdUI->Enable(selItem != 0L);
01254 }

void UCvsFolders::OnCmdUIIgnore ( UCmdUI * pCmdUI ) [protected]

Definition at line 1262 of file UCvsFolders.cpp.

01263 {
01264     pCmdUI->Enable(!DisableGeneric());
01265     pCmdUI->Check(gFileViewIgnore);
01266 }

void UCvsFolders::OnCmdUIImport ( UCmdUI * pCmdUI ) [protected]

Definition at line 1274 of file UCvsFolders.cpp.

01275 {
01276     UCvsApp *app = UCvsApp::gApp;
01277     pCmdUI->Enable(!app->IsCvsRunning() && !gCvsPrefs.empty());
01278 }

void UCvsFolders::OnCmdUIMacrosSel | ( | int | cmd,
 |  | UCmdUI * | pCmdUI
 | ) | [protected]

Definition at line 1280 of file UCvsFolders.cpp.

01281 {
01282     if(DisableGeneric())
01283     {
01284         pCmdUI->Enable(false);
01285         return;
01286     }
01287     UTREEITEM selItem;
01288     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &selItem);
01289     pCmdUI->Enable(selItem != 0L && CTcl_Interp::IsAvail());
01290 }

void UCvsFolders::OnCmdUIReload ( UCmdUI * pCmdUI ) [protected]

Definition at line 1256 of file UCvsFolders.cpp.

01257 {
01258     UCvsApp *app = UCvsApp::gApp;
01259     pCmdUI->Enable(!app->IsCvsRunning());
01260 }

void UCvsFolders::OnCmdUIUpdate ( UCmdUI * pCmdUI ) [protected]

Definition at line 966 of file UCvsFolders.cpp.

00967 {
00968     OnUpdateGeneric(pCmdUI, true);
00969 }

int UCvsFolders::OnCmdUnedit ( void ) [protected]

Definition at line 1103 of file UCvsFolders.cpp.

01104 {
01105     UTREEITEM *item;
01106     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01107     ASSERT(item != 0L);
01108
01109     UStr path;
01110     RetrievePath(item, path);
01111     CvsCmdUneditFolder(path);
01112     return 0;
01113 }

int UCvsFolders::OnCmdUnlock ( void ) [protected]

Definition at line 1055 of file UCvsFolders.cpp.

01056 {
01057     UTREEITEM *item;
01058     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01059     ASSERT(item != 0L);
01060
01061     UStr path;
01062     RetrievePath(item, path);
01063     CvsCmdUnlockFolder(path);
01064     return 0;
01065 }

int UCvsFolders::OnCmdUpdate ( void ) [protected]

Definition at line 954 of file UCvsFolders.cpp.

00955 {
00956     UTREEITEM *item;
00957     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
00958     ASSERT(item != 0L);
00959
00960     UStr path;
00961     RetrievePath(item, path);
00962     CvsCmdUpdateFolder(path);
00963     return 0;
00964 }

int UCvsFolders::OnCmdWatchOff ( void ) [protected]

Definition at line 1079 of file UCvsFolders.cpp.

01080 {
01081     UTREEITEM *item;
01082     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01083     ASSERT(item != 0L);
01084
01085     UStr path;
01086     RetrievePath(item, path);
01087     CvsCmdWatchOffFolder(path);
01088     return 0;
01089 }

int UCvsFolders::OnCmdWatchOn ( void ) [protected]

Definition at line 1067 of file UCvsFolders.cpp.

01068 {
01069     UTREEITEM *item;
01070     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01071     ASSERT(item != 0L);
01072
01073     UStr path;
01074     RetrievePath(item, path);
01075     CvsCmdWatchOnFolder(path);
01076     return 0;
01077 }

int UCvsFolders::OnCmdWatchers ( void ) [protected]

Definition at line 1115 of file UCvsFolders.cpp.

01116 {
01117     UTREEITEM *item;
01118     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
01119     ASSERT(item != 0L);
01120
01121     UStr path;
01122     RetrievePath(item, path);
01123     CvsCmdWatchersFolder(path);
01124     return 0;
01125 }

void UCvsFolders::OnCreate ( void ) [protected]

Definition at line 444 of file UCvsFolders.cpp.

00445 {
00446     if(sFolderIcon == 0L)
00447     {
00448         sFolderIcon = UCreate_pixmap(this, "folder.xpm");
00449         sFolderUnknownIcon = UCreate_pixmap(this, "foldunk.xpm");
00450         sFolderIgnoredIcon = UCreate_pixmap(this, "foldign.xpm");
00451         sFolderMissingIcon = UCreate_pixmap(this, "foldmiss.xpm");
00452     }
00453
00454     UStr newpath;
00455     newpath = (const char *)gOldLoc;
00456     if(newpath.empty())
00457         newpath = gCvsPrefs.Home();
00458
00459     // set the initial root
00460     ResetBrowser(newpath, true);
00461 }

void UCvsFolders::OnDestroy ( void ) [protected]

Definition at line 439 of file UCvsFolders.cpp.

00440 {
00441     delete this;
00442 }

void UCvsFolders::OnTreeExpanding | ( | int | collapse,
 |  | UTREEITEM | item
 | ) | [protected]

Definition at line 742 of file UCvsFolders.cpp.

00743 {
00744     // many situations make that we enter here twice. Fortunately enough
00745     // we only dare the first signal.
00746     static bool sSemaphore = false;
00747     USemaphore policeman(sSemaphore);
00748     if(policeman.IsEnteredTwice())
00749         return;
00750
00751     UWaitCursor wait;
00752
00753     UTREE_INFO query;
00754     query.item = item;
00755     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00756     EntnodeData *data = (EntnodeData *)query.data;
00757
00758     // we refuse to expand in this case cause the folder is not really here
00759     if(data != 0L && data->IsMissing())
00760     {
00761         UEventSendMessage(GetWidID(), EV_TREE_EXPAND, UMAKEINT(kUMainWidget, 1), item);
00762         return;
00763     }
00764
00765     // erase all the childs
00766     DeleteAllItems(item);
00767
00768     UStr path;
00769     RetrievePath(item, path);
00770
00771     if(collapse)
00772     {
00773         TBrowserFillDummy traverse(this, 0L, item, 0L);
00774         /*kTraversal res = */FileTraverse(path, traverse);
00775     }
00776     else
00777     {
00778         CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00779         TBrowserFill traverse(this, 0L, item, entries);
00780         /*kTraversal res = */FileTraverse(path, traverse);
00781
00782 #if qGTK
00783         // gtk is closing the tree when we removed everything in it
00784         UEventSendMessage(GetWidID(), EV_TREE_EXPAND, UMAKEINT(kUMainWidget, 0), item);
00785 #endif
00786
00787         // add the missing folders
00788         Entries_SetMissing(entries);
00789         int numEntries = entries.NumOfElements();
00790         for(int i = 0; i < numEntries; i++)
00791         {
00792             const ENTNODE & theNode = entries.Get(i);
00793             EntnodeData *data = ((ENTNODE *)&theNode)->Data();
00794             if(!data->IsMissing() || data->GetType() != ENT_SUBDIR)
00795                 continue;
00796
00797             UTREE_INSERT insert;
00798             insert.parent = item;
00799             insert.icon = GetIcon(this, item, false, false, data->Ref());
00800             insert.title = (*data)[EntnodeData::kName];
00801             insert.data = data;
00802             UEventSendMessage(GetWidID(), EV_TREE_INSERT, kUMainWidget, &insert);
00803         }
00804     }
00805 }

void UCvsFolders::OnTreeSelecting | ( | int | deselect,
 |  | UTREEITEM | item
 | ) | [protected]

Definition at line 807 of file UCvsFolders.cpp.

00808 {
00809     if(deselect)
00810         return;
00811
00812     UTREE_INFO query;
00813     query.item = item;
00814     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00815     EntnodeData *data = (EntnodeData *)query.data;
00816     if(data != 0L && data->IsMissing())
00817         return;
00818
00819     if(!sTemporaryTurnOffNotify)
00820     {
00821         UStr path;
00822         RetrievePath(item, path);
00823         UCvsFiles *fileView = (UCvsFiles *)UEventQueryWidget(kUCvsFilesID);
00824         if(fileView != 0L)
00825         {
00826             ASSERT(fileView->IsKindOf(URUNTIME_CLASS(UCvsFiles)));
00827             fileView->ResetView(path);
00828         }
00829     }
00830
00831 }

void UCvsFolders::OnUpdateGeneric | ( | UCmdUI * | pCmdUI,
 |  | bool | needCvsInfos
 | ) | [protected]

Definition at line 925 of file UCvsFolders.cpp.

Referenced by OnCmdUIAdd(), and OnCmdUIUpdate().

00926 {
00927     if(DisableGeneric())
00928     {
00929         pCmdUI->Enable(false);
00930         return;
00931     }
00932
00933     UTREEITEM *item;
00934     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &item);
00935     if(item == 0L)
00936     {
00937         pCmdUI->Enable(false);
00938         return;
00939     }
00940
00941     UStr path;
00942     RetrievePath(item, path);
00943     if(!path.endsWith(kPathDelimiter))
00944         path << kPathDelimiter;
00945     path << "CVS";
00946
00947     struct stat sb;
00948     if (stat(path, &sb) == -1 || !S_ISDIR(sb.st_mode))
00949         pCmdUI->Enable(!needCvsInfos);
00950     else
00951         pCmdUI->Enable(needCvsInfos);
00952 }

void UCvsFolders::ResetBrowser | ( | const char * | path,
 |  | bool | notifyView = false
 | ) |

Definition at line 463 of file UCvsFolders.cpp.

Referenced by UCvsFrame::OnBrowserPopup(), UCvsFrame::OnComboSelDir(), OnCreate(), and ResetView().

00464 {
00465     UWaitCursor wait;
00466
00467     DeleteAllItems();
00468     bool isReload = path != 0L && !m_root.empty() && stricmp(m_root, path) == 0;
00469
00470     m_root = path;
00471
00472     if(path == 0L)
00473         return;
00474
00475     if(!isReload)
00476     {
00477         if(HasPersistentSettings(m_root))
00478             LoadPersistentSettings(m_root);
00479         else
00480         {
00481             // check if the path has a CVS folder. If not,
00482             // we don't want the user to be prompted (like when
00483             // WinCvs is starting for the first time).
00484             UStr cvsFolder(m_root);
00485             if(!cvsFolder.endsWith(kPathDelimiter))
00486                 cvsFolder << kPathDelimiter;
00487             cvsFolder << "CVS";
00488             struct stat sb;
00489             if (stat(cvsFolder, &sb) != -1 && S_ISDIR(sb.st_mode))
00490                 AskCreatePersistentSettings(m_root);
00491         }
00492     }
00493
00494     if(stricmp(gOldLoc, m_root) != 0)
00495         gOldLoc = m_root;
00496
00497     // update the history combo
00498     gHistoryLocs.Insert(m_root);
00499     UEventSendMessage(kUCvsFrameID, EV_COMBO_RESETALL, UCvsFrame::kDirCombo, 0L);
00500     const std::vector<UStr> & list = gHistoryLocs.GetList();
00501     std::vector<UStr>::const_iterator i;
00502     int pos = 0;
00503     for(i = list.begin(); i != list.end(); ++i, pos++)
00504     {
00505         UEventSendMessage(kUCvsFrameID, EV_COMBO_APPEND,
00506                           UCvsFrame::kDirCombo, (void *)(const char *)*i);
00507     }
00508     UEventSendMessage(kUCvsFrameID, EV_COMBO_SETSEL, UMAKEINT(UCvsFrame::kDirCombo, 0), 0L);
00509
00510     // fill the browser
00511     TBrowserFillDummy traverse(this, 0L, 0L, 0L);
00512     /*kTraversal res = */FileTraverse(m_root, traverse);
00513
00514     if(traverse.m_item != 0L)
00515     {
00516         UEventSendMessage(GetWidID(), EV_TREE_EXPAND, UMAKEINT(kUMainWidget, 0), traverse.m_item);
00517         if(notifyView && UCvsApp::gApp->GetFilesView())
00518             UCvsApp::gApp->GetFilesView()->ResetView(path);
00519     }
00520 }

void UCvsFolders::ResetView | ( | bool | forceReload = false,
 |  | bool | notifyView = false
 | ) |

Definition at line 522 of file UCvsFolders.cpp.

Referenced by OnCmdIgnore(), OnCmdReload(), and UCvsFiles::ResetView().

00523 {
00524     UWaitCursor doWait;
00525
00526     std::vector<UStr> allExpanded;
00527     StoreExpanded(allExpanded);
00528
00529     bool contentChanged = false;
00530     UStr selPath;
00531     UTREEITEM selItem;
00532     UEventSendMessage(GetWidID(), EV_TREE_GETSEL, kUMainWidget, &selItem);
00533     if(selItem != 0L)
00534         RetrievePath(selItem, selPath);
00535
00536     if(forceReload)
00537     {
00538         ResetBrowser(m_root);
00539         contentChanged = true;
00540     }
00541
00542     if(contentChanged)
00543     {
00544         // restore the expanded paths and the selected item
00545         std::vector<UStr>::const_iterator i;
00546         for(i = allExpanded.begin(); i != allExpanded.end(); ++i)
00547         {
00548             StepToLocation(*i);
00549         }
00550         if(!selPath.empty())
00551         {
00552             selItem = GetItemByLocation(selPath);
00553             if(selItem != 0L)
00554                 UEventSendMessage(GetWidID(), EV_TREE_SELECT, UMAKEINT(kUMainWidget, 0), selItem);
00555         }
00556     }
00557
00558     // we don't need to notify the file view if we force the reload
00559     // because that's already done
00560     if(notifyView)
00561     {
00562         UCvsApp::gApp->GetFilesView()->ResetView(forceReload);
00563     }
00564     UEventSendMessage(GetWidID(), EV_CHGFOCUS, kUMainWidget, 0L);
00565 }

void UCvsFolders::RetrievePath | ( | UTREEITEM | item,
 |  | UStr & | path
 | ) |

Definition at line 846 of file UCvsFolders.cpp.

Referenced by OnCmdAdd(), OnCmdCommit(), OnCmdDiff(), OnCmdEdit(), OnCmdEditors(), OnCmdExplore(), OnCmdLock(), OnCmdLog(), OnCmdMacrosSel(), OnCmdQueryUpdate(), OnCmdRelease(), OnCmdStatus(), OnCmdTagBranch(), OnCmdTagDelete(), OnCmdTagNew(), OnCmdUnedit(), OnCmdUnlock(), OnCmdUpdate(), OnCmdWatchOff(), OnCmdWatchOn(), OnCmdWatchers(), OnTreeExpanding(), OnTreeSelecting(), OnUpdateGeneric(), ResetView(), and StoreExpanded().

00847 {
00848     UStr tmp, newPath;
00849     path = "";
00850
00851     do
00852     {
00853         UTREE_INFO query;
00854         query.item = item;
00855         UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00856
00857         item = query.parent;
00858
00859         tmp = path;
00860         newPath = item == 0L ? (const char *)m_root : query.title;
00861         if(!newPath.endsWith(kPathDelimiter))
00862             newPath << kPathDelimiter;
00863         newPath << path;
00864         path = newPath;
00865     } while(item != 0L);
00866 }

void UCvsFolders::SetDefaultRoot ( const char * root ) [static]

Definition at line 833 of file UCvsFolders.cpp.

Referenced by UCvsApp::UCvsApp().

00834 {
00835     struct stat sb;
00836
00837     if (stat(root, &sb) == -1 || !S_ISDIR(sb.st_mode))
00838     {
00839         cvs_err("Cannot access directory '%s' (error %d)\n", root, errno);
00840         return;
00841     }
00842
00843     gOldLoc = root;
00844 }

void UCvsFolders::StepToLocation | ( | const char * | path,
 |  | bool | notifyView = false
 | ) |

Definition at line 595 of file UCvsFolders.cpp.

Referenced by ResetView(), and UCvsFiles::ResetView().

00596 {
00597     UStr root(m_root);
00598     if(!root.endsWith(kPathDelimiter))
00599         root << kPathDelimiter;
00600     UStr subpath(path);
00601     if(!subpath.endsWith(kPathDelimiter))
00602         subpath << kPathDelimiter;
00603
00604     // check if it is a sub-path
00605     if(strncmp(root, subpath, root.length()) != 0)
00606         return;
00607
00608     UTREE_INFO query;
00609     query.item = 0L;
00610     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00611
00612     UTREEITEM item = query.item;
00613     UTREEITEM lastitem = 0L;
00614     if(item == 0L)
00615         return;
00616
00617     // step inside synchronized
00618     const char *tmp = (const char *)subpath + root.length() - 1;
00619     while((tmp = strchr(tmp, kPathDelimiter)) != 0L)
00620     {
00621         const char *name = ++tmp;
00622         if(name[0] == '\0')
00623             break;
00624
00625         UStr subname;
00626         const char *tmp2 = strchr(name, kPathDelimiter);
00627         if(tmp2 == 0L)
00628             subname = name;
00629         else
00630             subname.set(name, tmp2 - name);
00631
00632         query.item = item;
00633         UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00634         UTREEITEM childItem = query.child;
00635
00636         // find the subitem which matches this name
00637         while(childItem != 0L)
00638         {
00639             query.item = childItem;
00640             UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00641             EntnodeData *data = (EntnodeData *)query.data;
00642             if(data != 0L)
00643             {
00644 #ifdef qUnix
00645                 if(strcmp((*data)[EntnodeData::kName], subname) == 0)
00646 #else
00647                 if(_stricmp((*data)[EntnodeData::kName], subname) == 0)
00648 #endif
00649                 {
00650                     // found it !
00651                     lastitem = item = childItem;
00652                     UEventSendMessage(GetWidID(), EV_TREE_EXPAND, UMAKEINT(kUMainWidget, 0), item);
00653                     break;
00654                 }
00655             }
00656
00657             childItem = query.next;
00658         }
00659     }
00660
00661     // in case this is called by the view, turn off notifying
00662     // when the item gets selected
00663     if(lastitem != 0L)
00664     {
00665         if(!notifyView)
00666         {
00667             CTempToggleBool toggler(sTemporaryTurnOffNotify);
00668             UEventSendMessage(GetWidID(), EV_TREE_SELECT, UMAKEINT(kUMainWidget, 0), lastitem);
00669         }
00670         else
00671         {
00672             UEventSendMessage(GetWidID(), EV_TREE_SELECT, UMAKEINT(kUMainWidget, 0), lastitem);
00673         }
00674     }
00675 }

void UCvsFolders::StoreExpanded | ( | std::vector< UStr > & | allExpanded,
 |  | UTREEITEM | root = 0L
 | ) | [protected]

Definition at line 567 of file UCvsFolders.cpp.

Referenced by ResetView().

00568 {
00569     UTREE_INFO query;
00570     query.item = root;
00571     UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00572
00573     UTREEITEM item = query.item;
00574     if(item == 0L)
00575         return;
00576
00577     if(query.expanded)
00578     {
00579         UStr path;
00580         RetrievePath(item, path);
00581         allExpanded.push_back(path);
00582     }
00583
00584     UTREEITEM childItem = query.child;
00585
00586     while(childItem != 0L)
00587     {
00588         StoreExpanded(allExpanded, childItem);
00589         query.item = childItem;
00590         UEventSendMessage(GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00591         childItem = query.next;
00592     }
00593 }

Member Data Documentation

const UMSGMAP_ENTRY UCvsFolders::_messageEntries[] [static, private]

Reimplemented from UWidget.

Definition at line 111 of file UCvsFolders.h.

UStr UCvsFolders::m_root [protected]

Definition at line 62 of file UCvsFolders.h.

const UMSGMAP UCvsFolders::messageMap [static, protected]

Reimplemented from UWidget.

Definition at line 111 of file UCvsFolders.h.

The documentation for this class was generated from the following files:
  • common/UCvsFolders.h
  • common/UCvsFolders.cpp
Generated on Sun Oct 21 12:47:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsFrame Class Reference

#include <UCvsFrame.h>

Inheritance diagram for UCvsFrame:

[legend]
Collaboration diagram for UCvsFrame:

[legend]
List of all members.

Public Types

enum | { kDirCombo = EV_COMMAND_START, kBrowserPopup }

Public Methods

UCvsFrame ()
virtual | ~UCvsFrame ()
bool | AskForQuitting (void)

Protected Methods

void | OnCmdUIAnytime (int cmd, UCmdUI *pCmdUI)
void | OnCmdUIQuit (UCmdUI *pCmdUI)
void | OnCmdUIStopcvs (UCmdUI *pCmdUI)
void | OnCmdUICvsCmd (UCmdUI *pCmdUI)
void | OnCmdUIMacroAdmin (int cmd, UCmdUI *pCmdUI)
void | OnDestroy (void)
int | OnQuit (void)
int | OnCopyrights (void)
int | OnCredits (void)
void | OnComboSelDir (int pos, const char *txt)
int | OnBrowserPopup (void)
int | OnCmdPreferences (void)
int | OnCmdSaveSettings (void)
int | OnCmdRtagNew (void)
int | OnCmdRtagDelete (void)
int | OnCmdRtagBranch (void)
int | OnCmdCmdline (void)
int | OnCmdLogin (void)
int | OnCmdLogout (void)
int | OnCmdStopcvs (void)
int | OnCmdInit (void)
int | OnCmdMacroAdmin (int cmd)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

anonymous enum

Enumeration values:
kDirCombo
kBrowserPopup

Definition at line 41 of file UCvsFrame.h.

00042     {
00043         kDirCombo = EV_COMMAND_START,   // 0
00044         kBrowserPopup                   // 1
00045     };

Constructor & Destructor Documentation

UCvsFrame::UCvsFrame ( )

Definition at line 90 of file UCvsFrame.cpp.

00090                      : UWidget(kUCvsFrameID)
00091 {
00092 }

UCvsFrame::~UCvsFrame ( ) [virtual]

Definition at line 94 of file UCvsFrame.cpp.

00095 {
00096 }

Member Function Documentation

bool UCvsFrame::AskForQuitting ( void )

Definition at line 106 of file UCvsFrame.cpp.

Referenced by OnQuit().

00107 {
00108     bool res = true;
00109
00110     if(UCvsApp::gApp->IsCvsRunning())
00111         res = !CvsAlert("Cvs is currently running. Are-you sure you want to quit ?", "Cancel", "Quit");
00112
00113     gCvsPrefs.save();
00114
00115     return res;
00116 }

const UMSGMAP* UCvsFrame::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

virtual const UMSGMAP* UCvsFrame::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

const UMSGMAP* UCvsFrame::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

int UCvsFrame::OnBrowserPopup ( void ) [protected]

Definition at line 123 of file UCvsFrame.cpp.

00124 {
00125     const char *newPath =
00126         BrowserGetDirectory("Select a folder to open with the browser");
00127     if(newPath == 0L)
00128         return 0;
00129
00130     UCvsApp::gApp->GetBrowserView()->ResetBrowser(newPath, true);
00131
00132     return 0;
00133 }

int UCvsFrame::OnCmdCmdline ( void ) [protected]

Definition at line 258 of file UCvsFrame.cpp.

00259 {
00260     CvsCmdLine();
00261     return 0;
00262 }

int UCvsFrame::OnCmdInit ( void ) [protected]

Definition at line 288 of file UCvsFrame.cpp.

00289 {
00290     CvsCmdInit();
00291     return 0;
00292 }

int UCvsFrame::OnCmdLogin ( void ) [protected]

Definition at line 264 of file UCvsFrame.cpp.

00265 {
00266     CvsCmdLogin();
00267     return 0;
00268 }

int UCvsFrame::OnCmdLogout ( void ) [protected]

Definition at line 270 of file UCvsFrame.cpp.

00271 {
00272     CvsCmdLogout();
00273     return 0;
00274 }

int UCvsFrame::OnCmdMacroAdmin ( int cmd ) [protected]

Definition at line 294 of file UCvsFrame.cpp.

00295 {
00296     CMacroEntry & entry = gMacrosAdmin.entries[cmd - cmdMACROADMIN];
00297     CvsCmdMacrosAdmin(entry.path);
00298     return 0;
00299 }

int UCvsFrame::OnCmdPreferences ( void ) [protected]

Definition at line 226 of file UCvsFrame.cpp.

00227 {
00228     CompatGetPrefs();
00229     return 0;
00230 }

int UCvsFrame::OnCmdRtagBranch ( void ) [protected]

Definition at line 252 of file UCvsFrame.cpp.

00253 {
00254     CvsCmdRtagBranch();
00255     return 0;
00256 }

int UCvsFrame::OnCmdRtagDelete ( void ) [protected]

Definition at line 246 of file UCvsFrame.cpp.

00247 {
00248     CvsCmdRtagDelete();
00249     return 0;
00250 }

int UCvsFrame::OnCmdRtagNew ( void ) [protected]

Definition at line 240 of file UCvsFrame.cpp.

00241 {
00242     CvsCmdRtagCreate();
00243     return 0;
00244 }

int UCvsFrame::OnCmdSaveSettings ( void ) [protected]

Definition at line 232 of file UCvsFrame.cpp.

00233 {
00234     UCvsFolders *browser = UCvsApp::gApp->GetBrowserView();
00235     if(browser != 0L && browser->GetRoot() != 0L)
00236         AskCreatePersistentSettings(browser->GetRoot());
00237     return 0;
00238 }

int UCvsFrame::OnCmdStopcvs ( void ) [protected]

Definition at line 276 of file UCvsFrame.cpp.

00277 {
00278     UCvsApp::gApp->SetCvsStopping(true);
00279     if(UCvsApp::gCurCvs != 0L && cvs_process_is_active(UCvsApp::gCurCvs))
00280     {
00281         cvs_process_kill(UCvsApp::gCurCvs);
00282         cvs_out("*****CVS stopped on user request !!! *****\n\n");
00283     }
00284
00285     return 0;
00286 }

void UCvsFrame::OnCmdUIAnytime | ( | int | cmd,
 |  | UCmdUI * | pCmdUI
 | ) | [protected]

Definition at line 152 of file UCvsFrame.cpp.

00153 {
00154     pCmdUI->Enable(!UCvsApp::gApp->IsCvsRunning());
00155 }

void UCvsFrame::OnCmdUICvsCmd ( UCmdUI * pCmdUI ) [protected]

Definition at line 307 of file UCvsFrame.cpp.

00308 {
00309     pCmdUI->Enable(!UCvsApp::gApp->IsCvsRunning() && !gCvsPrefs.empty());
00310 }

void UCvsFrame::OnCmdUIMacroAdmin | ( | int | cmd,
 |  | UCmdUI * | pCmdUI
 | ) | [protected]

Definition at line 312 of file UCvsFrame.cpp.

00313 {
00314     pCmdUI->Enable(!UCvsApp::gApp->IsCvsRunning() && !gCvsPrefs.empty() && CTcl_Interp::IsAvail());
00315 }

void UCvsFrame::OnCmdUIQuit ( UCmdUI * pCmdUI ) [protected]

Definition at line 147 of file UCvsFrame.cpp.

00148 {
00149     pCmdUI->Enable(true);
00150 }

void UCvsFrame::OnCmdUIStopcvs ( UCmdUI * pCmdUI ) [protected]

Definition at line 301 of file UCvsFrame.cpp.

00302 {
00303     UCvsApp *app = UCvsApp::gApp;
00304     pCmdUI->Enable(app->IsCvsRunning() && !app->IsCvsStopping());
00305 }

void UCvsFrame::OnComboSelDir | ( | int | pos,
 |  | const char * | txt
 | ) | [protected]

Definition at line 118 of file UCvsFrame.cpp.

00119 {
00120     UCvsApp::gApp->GetBrowserView()->ResetBrowser(txt, true);
00121 }

int UCvsFrame::OnCopyrights ( void ) [protected]

Definition at line 157 of file UCvsFrame.cpp.

00158 {
00159     const char *appName = UCvsApp::gApp->GetAppName();
00160
00161     cvs_out("\nBoth %s and CVS are distributed under the terms of\n", appName);
00162     cvs_out("the GNU General Public Licence (GPL).\n\n");
00163     cvs_out("* %s : maintained by Alexandre Parenteau (aubonbeurre@hotmail.com)\n", appName);
00164     cvs_out("* CVS : Copyright © 1989-1998 Brian Berliner, david d `zoo' zuhn,\n");
00165     cvs_out("        Jeff Polk, and other authors\n");
00166 #ifdef macintosh
00167     printf("* MacCVS : Mike Ladwig, Matthias Neeracher, Alexandre Parenteau\n");
00168     printf("* GUSI : Copyright © 1992-1997 Matthias Neeracher\n");
00169     printf("* Waste : Copyright © 1993-1998 Marco Piovanelli\n");
00170     printf("* CWASTEEdit : Copyright © 1995-1997 Timothy Paustian\n");
00171     printf("* ABalloon : Freeware of James W. Walker (jwwalker@kagi.com)\n");
00172     printf("* Metrowerks Standard Library, PowerPlant & CodeWarrior :\n");
00173     printf("    Copyright © 1996-1997 Metrowerks Inc.\n");
00174     printf("* MPW, MoreFiles : Copyright © Apple Computer Inc.\n");
00175 #endif
00176 #ifdef WIN32
00177     cvs_out("* WinCvs documentation : Copyright © 1999 Don Harper <don@lamrc.com>.\n");
00178     cvs_out("* CJLIB : Copyright © 1998-99 Kirk Stowell <kstowell@codejockeys.com>\n");
00179     cvs_out("* MFC : Copyright © 1992-1997 Microsoft Corporation\n");
00180 #endif
00181     cvs_out("* Kerberos : Copyright © 1997 the Massachusetts Institute of Technology\n");
00182     cvs_out("* TCL : Copyright © Sun Microsystems Inc.\n");
00183     cvs_out("\nSome others copyrights may apply, check the source code for details.\n");
00184     return 0;
00185 }

int UCvsFrame::OnCredits ( void ) [protected]

Definition at line 187 of file UCvsFrame.cpp.

00188 {
00189     const char *appName = UCvsApp::gApp->GetAppName();
00190     const char *appVers = UCvsApp::gApp->GetAppVersion();
00191
00192 #ifndef macintosh
00193     cvs_out("\n%s %s - Client/Local\n", appName, appVers);
00194 #else
00195     cvs_out("\n%s %s - Client\n", appName, appVers);
00196 #endif
00197     cvs_out("%s is maintained by Alexandre Parenteau\n", appName);
00198     cvs_out("- WinCvs/MacCvs/gcvs page : http://www.wincvs.org\n");
00199     cvs_out("- cvs page : http://www.cyclic.com\n");
00200 #ifdef WIN32
00201     cvs_out("- WinCvs documentation : Don Harper <don@lamrc.com>.\n");
00202     cvs_out("- WinHelp cvs documentation : Norbert Klamann.\n");
00203 #endif
00204 #ifdef macintosh
00205     printf("- Mac port :\n");
00206     printf("\t* Mike Ladwig <mike@twinpeaks.prc.com>\n");
00207     printf("\t* Matthias Neeracher <neeri@iis.ee.ethz.ch>\n");
00208     printf("\t* Alexandre Parenteau <aubonbeurre@hotmail.com>\n");
00209     printf("- With contributions of :\n");
00210     printf("\t* Miro Jurisic <meeroh@mit.edu> (Kerberos)\n");
00211     printf("\t* Aleks Totic <atotic@netscape.com> (AppleSingle)\n");
00212     printf("\t* Jocelyn Houle <houlejo@IRO.UMontreal.CA> (Help balloons)\n");
00213 #endif
00214     cvs_out("- Special thanks to :\n");
00215     cvs_out("\t* Gary Bringhurst from C3D Digital who gives me time, resources,\n");
00216     cvs_out("\t  help and ideas for doing this project (http://www.3d.com)\n");
00217     cvs_out("\t* The Freeware community for providing cvs, Linux, Perl, GTK, gcc\n");
00218     cvs_out("\t  and so many others valuables tools\n");
00219     cvs_out("\t* The users of the CvsGui project (WinCvs, MacCvs, gcvs) who have\n");
00220     cvs_out("\t  defined all the functionnalities and help every day to enhance it\n");
00221     cvs_out("- Cvs contributors :\n");
00222     cvs_out("\t* Too many to be listed here, see the 'ChangeLog' instead !\n");
00223     return 0;
00224 }

void UCvsFrame::OnDestroy ( void ) [protected]

Definition at line 98 of file UCvsFrame.cpp.

00099 {
00100 #if qGTK
00101     gtk_main_quit();
00102 #endif /* qGTK */
00103     delete this;
00104 }

int UCvsFrame::OnQuit ( void ) [protected]

Definition at line 135 of file UCvsFrame.cpp.

00136 {
00137     if(!AskForQuitting())
00138         return 0;
00139
00140 #if qGTK
00141     gtk_main_quit();
00142 #endif /* qGTK */
00143
00144     return 0;
00145 }

Member Data Documentation

const UMSGMAP_ENTRY UCvsFrame::_messageEntries[] [static, private]

Reimplemented from UWidget.

Definition at line 71 of file UCvsFrame.h.

const UMSGMAP UCvsFrame::messageMap [static, protected]

Reimplemented from UWidget.

Definition at line 71 of file UCvsFrame.h.

The documentation for this class was generated from the following files:
  • common/UCvsFrame.h
  • common/UCvsFrame.cpp
Generated on Sun Oct 21 12:47:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsGraph Class Reference

#include <UCvsGraph.h>

Inheritance diagram for UCvsGraph:

[legend]
Collaboration diagram for UCvsGraph:

[legend]
List of all members.

Public Types

enum | { kDrawing = EV_COMMAND_START }

Public Methods

UCvsGraph (CLogNode *node, const char *dir)
virtual | ~UCvsGraph ()

Protected Methods

void | CalcImageSize (void)
void | OnDestroy ()
void | OnCreate ()
void | OnDrawing (void *info)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

CLogNode * m_node
UStr m_dir
UStr m_name
EntnodeData * m_data

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

anonymous enum

Enumeration values:
kDrawing

Definition at line 40 of file UCvsGraph.h.

00041     {
00042         kDrawing = EV_COMMAND_START // 0
00043     };

Constructor & Destructor Documentation

UCvsGraph::UCvsGraph | ( | CLogNode * | node,
 |  | const char * | dir
 | ) |

Definition at line 48 of file UCvsGraph.cpp.

00048                                                     :
00049     UWidget(::UEventGetWidID()), m_node(node), m_dir(dir), m_data(0L)
00050 {
00051     // get the CVS/Entries infos for this file
00052     CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00053     if(!Entries_Open (entries, dir))
00054     {
00055         cvs_err("Warning : Error while accessing the CVS folder in '%s'\n", dir);
00056     }
00057     else
00058     {
00059         if(node->GetType() != kNodeHeader)
00060         {
00061             cvs_err("Warning : Top node is not a RCS file description !\n");
00062         }
00063         else
00064         {
00065             const char *name = (**(CLogNodeHeader *)node).WorkingFile();
00066             struct stat sb;
00067             if (stat(name, &sb) == -1)
00068             {
00069                 cvs_err("Warning : Unknown file '%s'\n", name);
00070             }
00071             else
00072             {
00073                 m_data = Entries_SetVisited(dir, entries, name, sb, false);
00074                 m_data->Ref();
00075                 m_name = name;
00076             }
00077         }
00078     }
00079 }

UCvsGraph::~UCvsGraph ( ) [virtual]

Definition at line 81 of file UCvsGraph.cpp.

00082 {
00083     if(m_node != 0L)
00084         delete m_node;
00085     if(m_data != 0L)
00086         m_data->UnRef();
00087 }

Member Function Documentation

void UCvsGraph::CalcImageSize ( void ) [protected]

Definition at line 692 of file UCvsGraph.cpp.

Referenced by OnDrawing().

00693 {
00694     if(m_node == 0L)
00695         return;
00696
00697     // set all the bounds locations
00698     UDC dc(GetWidID(), kDrawing);
00699     CWinLogData *data = CWinLogData::CreateNewData(m_node);
00700     m_node->SetUserData(data);
00701     UPoint start(5, 5);
00702     data->ComputeBounds(start, dc, m_data);
00703
00704     // reoffset from (0, 0)
00705     URect bounds = data->Bounds();
00706     data->Offset(start - bounds.TopLeft());
00707     bounds = data->Bounds();
00708
00709 #if qGTK
00710     GtkWidget *layout = (GtkWidget *)GetWidget(kDrawing);
00711     gtk_layout_set_size (GTK_LAYOUT (layout), bounds.Width(), bounds.Height());
00712 #endif
00713 #if 0
00714     // set the scroll size
00715     SetScrollSizes(MM_TEXT, bounds.Size() + USize(5, 5));
00716 #endif
00717 }

const UMSGMAP* UCvsGraph::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

virtual const UMSGMAP* UCvsGraph::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

const UMSGMAP* UCvsGraph::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

void UCvsGraph::OnCreate ( void ) [protected]

Definition at line 94 of file UCvsGraph.cpp.

00095 {
00096     UStr title("Graph log : ");
00097     title << m_name;
00098     UEventSendMessage(GetWidID(), EV_SETTEXT, kUMainWidget, (void *)(const char *)title);
00099 }

void UCvsGraph::OnDestroy ( void ) [protected]

Definition at line 89 of file UCvsGraph.cpp.

00090 {
00091     delete this;
00092 }

void UCvsGraph::OnDrawing ( void * info ) [protected]

Definition at line 719 of file UCvsGraph.cpp.

00720 {
00721 #if qGTK
00722     GdkEventExpose *event = (GdkEventExpose *)info;
00723     GtkLayout *layout = GTK_LAYOUT(GetWidget(kDrawing));
00724     gdk_window_clear_area (layout->bin_window,
00725                            event->area.x, event->area.y,
00726                            event->area.width, event->area.height);
00727 #endif
00728     CalcImageSize();
00729
00730     if(m_node == 0L || m_node->GetUserData() == 0L)
00731         return;
00732
00733     UDC dc(GetWidID(), kDrawing);
00734     CWinLogData *data = (CWinLogData *)m_node->GetUserData();
00735     data->Update(dc, m_data);
00736
00737 /*  GtkWidget *widget = (GtkWidget *)GetWidget(kDrawing);
00738     if(widget == 0L)
00739         return;
00740
00741     GtkDrawingArea *darea;
00742     GdkDrawable *drawable;
00743     GdkGC *black_gc;
00744     GdkGC *gray_gc;
00745     GdkGC *white_gc;
00746     guint max_width;
00747     guint max_height;
00748
00749     g_return_if_fail (widget != NULL);
00750     g_return_if_fail (GTK_IS_DRAWING_AREA (widget));
00751
00752     darea = GTK_DRAWING_AREA (widget);
00753     drawable = widget->window;
00754     white_gc = widget->style->white_gc;
00755     gray_gc = widget->style->bg_gc[GTK_STATE_NORMAL];
00756     black_gc = widget->style->black_gc;
00757     max_width = widget->allocation.width;
00758     max_height = widget->allocation.height;
00759     gdk_draw_rectangle (drawable, black_gc,
00760                         TRUE,
00761                         0,
00762                         max_height / 2,
00763                         max_width,
00764                         max_height / 2);*/
00765 }

Member Data Documentation

const UMSGMAP_ENTRY UCvsGraph::_messageEntries[] [static, private]

Reimplemented from UWidget.

Definition at line 56 of file UCvsGraph.h.

EntnodeData* UCvsGraph::m_data [protected]

Definition at line 48 of file UCvsGraph.h.

UStr UCvsGraph::m_dir [protected]

Definition at line 46 of file UCvsGraph.h.

UStr UCvsGraph::m_name [protected]

Definition at line 47 of file UCvsGraph.h.

CLogNode* UCvsGraph::m_node [protected]

Definition at line 45 of file UCvsGraph.h.

const UMSGMAP UCvsGraph::messageMap [static, protected]

Reimplemented from UWidget.

Definition at line 56 of file UCvsGraph.h.

The documentation for this class was generated from the following files:
  • common/UCvsGraph.h
  • common/UCvsGraph.cpp
Generated on Sun Oct 21 12:47:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsMenubar Class Reference

#include <UCvsMenubar.h>

Inheritance diagram for UCvsMenubar:

[legend]
Collaboration diagram for UCvsMenubar:

[legend]
List of all members.

Public Methods

UCvsMenubar ()
virtual | ~UCvsMenubar ()

Protected Methods

void | OnDestroy ()
void | OnCreate ()
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Constructor & Destructor Documentation

UCvsMenubar::UCvsMenubar ( )

Definition at line 38 of file UCvsMenubar.cpp.

00038                          : UMenu(kUCvsMenubarID)
00039 {
00040 }

UCvsMenubar::~UCvsMenubar ( ) [virtual]

Definition at line 42 of file UCvsMenubar.cpp.

00043 {
00044 }

Member Function Documentation

const UMSGMAP* UCvsMenubar::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UMenu.

virtual const UMSGMAP* UCvsMenubar::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UMenu.

const UMSGMAP* UCvsMenubar::GetThisMessageMap ( ) [static, protected]

Reimplemented from UMenu.

void UCvsMenubar::OnCreate ( void ) [protected]

Definition at line 51 of file UCvsMenubar.cpp.

00052 {
00053 }

void UCvsMenubar::OnDestroy ( void ) [protected]

Definition at line 46 of file UCvsMenubar.cpp.

00047 {
00048     delete this;
00049 }

Member Data Documentation

const UMSGMAP_ENTRY UCvsMenubar::_messageEntries[] [static, private]

Reimplemented from UMenu.

Definition at line 42 of file UCvsMenubar.h.

const UMSGMAP UCvsMenubar::messageMap [static, protected]

Reimplemented from UMenu.

Definition at line 42 of file UCvsMenubar.h.

The documentation for this class was generated from the following files:
  • common/UCvsMenubar.h
  • common/UCvsMenubar.cpp
Generated on Sun Oct 21 12:47:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCvsStatusBar Class Reference

#include <CvsStatusBar.h>

Inheritance diagram for CCvsStatusBar:

[legend]
Collaboration diagram for CCvsStatusBar:

[legend]
List of all members.

Public Methods

CCvsStatusBar ()
virtual void | DrawItem (LPDRAWITEMSTRUCT)
virtual | ~CCvsStatusBar ()

Protected Methods

afx_msg void | OnTimer (UINT nIDEvent)

Protected Attributes

CBitmap | m_indic
int | m_step
bool | m_settimer

Constructor & Destructor Documentation

CCvsStatusBar::CCvsStatusBar ( )

Definition at line 18 of file CvsStatusBar.cpp.

00018                              : m_step(-1), m_settimer(false)
00019 {
00020     m_indic.LoadBitmap(IDB_IDLE);
00021 }

CCvsStatusBar::~CCvsStatusBar ( ) [virtual]

Definition at line 23 of file CvsStatusBar.cpp.

00024 {
00025 }

Member Function Documentation

void CCvsStatusBar::DrawItem ( LPDRAWITEMSTRUCT p ) [virtual]

Definition at line 27 of file CvsStatusBar.cpp.

00028 {
00029     if(!m_settimer)
00030     {
00031         SetTimer(999, 100, 0L);
00032         m_settimer = true;
00033     }
00034
00035     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00036     if(!app->gCvsRunning && !gCvsPrefs.IsTclFileRunning())
00037         return;
00038
00039     static int tab[12] = {
00040         -2, -1, 1, 4, 8, 11, 13, 11,
00041         8, 4, 1, -1};
00042     CDC hdc;
00043     CBrush b(RGB(0, 0, 0xFF));
00044
00045     hdc.Attach(p->hDC);
00046     CRect r(p->rcItem);
00047     hdc.FillRect(r, &b);
00048     CPoint off(r.TopLeft());
00049     off.x -= m_step;
00050     int cnt = 0;
00051     while(off.x < r.right)
00052     {
00053         CPoint offy(off);
00054         offy.y += tab[(m_step + cnt) % 12];
00055         hdc.DrawState(offy, CSize(16,16), m_indic, DSS_NORMAL);
00056         off.x += 24;
00057         cnt++;
00058     }
00059     hdc.Detach();
00060 }

void CCvsStatusBar::OnTimer ( UINT nIDEvent ) [protected]

Definition at line 62 of file CvsStatusBar.cpp.

00063 {
00064     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00065     if(app->gCvsRunning || gCvsPrefs.IsTclFileRunning())
00066     {
00067         if(++m_step == 24)
00068             m_step = 0;
00069
00070         CRect r;
00071         GetItemRect(1, r);
00072         InvalidateRect(r, FALSE);
00073     }
00074     else if(m_step != -1)
00075     {
00076         m_step = -1;
00077         CRect r;
00078         GetItemRect(1, r);
00079         InvalidateRect(r, FALSE);
00080     }
00081 }

Member Data Documentation

CBitmap CCvsStatusBar::m_indic [protected]

Definition at line 37 of file CvsStatusBar.h.

bool CCvsStatusBar::m_settimer [protected]

Definition at line 39 of file CvsStatusBar.h.

int CCvsStatusBar::m_step [protected]

Definition at line 38 of file CvsStatusBar.h.

The documentation for this class was generated from the following files:
  • WinCvs/CvsStatusBar.h
  • WinCvs/CvsStatusBar.cpp
Generated on Sun Oct 21 12:47:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CCvsThreadLock Class Reference

#include <wincvsView.h>

Collaboration diagram for CCvsThreadLock:

[legend]
List of all members.

Public Methods

CCvsThreadLock ()
~CCvsThreadLock ()

Static Public Attributes

CRITICAL_SECTION m_lock

Constructor & Destructor Documentation

CCvsThreadLock::CCvsThreadLock ( ) [inline]

Definition at line 42 of file wincvsView.h.

00043     {
00044         EnterCriticalSection(&m_lock);
00045     }

CCvsThreadLock::~CCvsThreadLock ( ) [inline]

Definition at line 46 of file wincvsView.h.

00047     {
00048         LeaveCriticalSection(&m_lock);
00049     }

Member Data Documentation

CRITICAL_SECTION CCvsThreadLock::m_lock [static]

Definition at line 45 of file wincvsView.cpp.

The documentation for this class was generated from the following files:
  • WinCvs/wincvsView.h
  • WinCvs/wincvsView.cpp
Generated on Sun Oct 21 12:47:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UCvsToolbar Class Reference

#include <UCvsToolbar.h>

Inheritance diagram for UCvsToolbar:

[legend]
Collaboration diagram for UCvsToolbar:

[legend]
List of all members.

Public Methods

UCvsToolbar ()
virtual | ~UCvsToolbar ()

Protected Methods

void | OnDestroy ()
void | OnCreate ()
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Constructor & Destructor Documentation

UCvsToolbar::UCvsToolbar ( )

Definition at line 37 of file UCvsToolbar.cpp.

00037                          : UToolbar(kUCvsToolbarID)
00038 {
00039 }

UCvsToolbar::~UCvsToolbar ( ) [virtual]

Definition at line 41 of file UCvsToolbar.cpp.

00042 {
00043 }

Member Function Documentation

const UMSGMAP* UCvsToolbar::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UToolbar.

virtual const UMSGMAP* UCvsToolbar::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UToolbar.

const UMSGMAP* UCvsToolbar::GetThisMessageMap ( ) [static, protected]

Reimplemented from UToolbar.

void UCvsToolbar::OnCreate ( void ) [protected]

Definition at line 50 of file UCvsToolbar.cpp.

00051 {
00052 }

void UCvsToolbar::OnDestroy ( void ) [protected]

Reimplemented from UToolbar.

Definition at line 45 of file UCvsToolbar.cpp.

00046 {
00047     delete this;
00048 }

Member Data Documentation

const UMSGMAP_ENTRY UCvsToolbar::_messageEntries[] [static, private]

Reimplemented from UToolbar.

Definition at line 42 of file UCvsToolbar.h.

const UMSGMAP UCvsToolbar::messageMap [static, protected]

Reimplemented from UToolbar.

Definition at line 42 of file UCvsToolbar.h.

The documentation for this class was generated from the following files:
  • common/UCvsToolbar.h
  • common/UCvsToolbar.cpp
Generated on Sun Oct 21 12:47:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


datelist Struct Reference

Collaboration diagram for datelist:

[legend]
List of all members.

Public Attributes

datelist * | next
char * | start
char * | end
int | inclusive

Member Data Documentation

char* datelist::end

Definition at line 60 of file log.c.

int datelist::inclusive

Definition at line 62 of file log.c.

struct datelist* datelist::next

Definition at line 56 of file log.c.

char* datelist::start

Definition at line 58 of file log.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/log.c
Generated on Sun Oct 21 12:47:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UDC Class Reference

#include <udraw.h>

Collaboration diagram for UDC:

[legend]
List of all members.

Public Methods

UDC (int widid, int cmdid)
~UDC ()
USize | GetTextExtent (const char *lpszString, int nCount) const
int | GetTextHeight (void) const
bool | TextOutClipped (int x, int y, const URECT *lpRect, const char *lpszString, int nCount)
void | MoveTo (int x, int y)
void | LineTo (int x, int y)
bool | DrawBitmap (void *bitmap, UPOINT where)
UPen * | SelectObject (UPen *pPen)
UBrush * | SelectObject (UBrush *pBrush)
bool | Rectangle (const URECT *lpRect)
bool | RoundRect (const URECT *lpRect, UPOINT point)

Protected Attributes

void * | m_wid
UPen * m_pen
UBrush * m_brush

Constructor & Destructor Documentation

UDC::UDC | ( | int | widid,
 |  | int | cmdid
 | ) |

Definition at line 160 of file udraw.cpp.

00160                              : m_wid(0L), m_pen(0L), m_brush(0L)
00161 #if qGTK
00162     , m_gc(0L), m_penloc(0, 0), m_drawable(0L), m_orig(0, 0)
00163 #endif
00164 {
00165     UCmdTarget *target = UEventQueryWidget(widid);
00166     if(target == 0L || !target->IsKindOf(URUNTIME_CLASS(UWidget)))
00167         return;
00168
00169     m_wid = ((UWidget *)target)->GetWidget(cmdid);
00170 #if qGTK
00171     if(m_wid != 0L)
00172     {
00173         GtkWidget *widget = GTK_WIDGET(m_wid);
00174         if(GTK_IS_LAYOUT(widget))
00175         {
00176             GtkLayout *layout = GTK_LAYOUT(widget);
00177             m_drawable = layout->bin_window;
00178             m_orig.x = -layout->xoffset;
00179             m_orig.y = -layout->yoffset;
00180         }
00181         else
00182             m_drawable = m_drawable;
00183         m_gc = gdk_gc_new(m_drawable);
00184         if(m_gc == 0L)
00185             m_wid = 0L;
00186         else
00187         {
00188             GdkGCValues values;
00189             gdk_gc_get_values(m_gc, &values);
00190             m_foreground = values.foreground;
00191             m_background = values.background;
00192             m_font = gdk_font_load ("-adobe-*-medium-r-normal--*-120-*-*-*-*-iso8859-*");
00193             if(m_font == 0L)
00194                 m_font = gdk_font_load ("-adobe-courier-medium-r-normal--*-120-*-*-*-*-*-*");
00195             if(m_font != 0L)
00196                 gdk_gc_set_font(m_gc, m_font);
00197         }
00198     }
00199 #endif
00200 }

UDC::~UDC ( )

Definition at line 238 of file udraw.cpp.

00239 {
00240 #if qGTK
00241     if(m_gc != 0L)
00242         gdk_gc_destroy(m_gc);
00243     if(m_font != 0L)
00244         gdk_font_unref (m_font);
00245 #endif
00246 }

Member Function Documentation

bool UDC::DrawBitmap | ( | void * | bitmap,
 |  | UPOINT | where
 | ) |

Definition at line 366 of file udraw.cpp.

Referenced by CWinLogRevData::UpdateSelf().

00367 {
00368     if(m_wid == 0L)
00369         return false;
00370
00371 #if qGTK
00372     if(m_font == 0L)
00373         return false;
00374
00375     gdk_draw_pixmap(m_drawable, m_gc, GTK_PIXMAP(bitmap)->pixmap,
00376                     0, 0, where.x + m_orig.x, where.y + m_orig.y, -1, -1);
00377 #endif
00378
00379     return true;
00380 }

USize UDC::GetTextExtent | ( | const char * | lpszString,
 |  | int | nCount
 | ) | const

Definition at line 312 of file udraw.cpp.

Referenced by CWinLogBranchData::GetBoundsSelf(), CWinLogTagData::GetBoundsSelf(), CWinLogRevData::GetBoundsSelf(), CWinLogHeaderData::GetBoundsSelf(), and TextOutClipped().

00313 {
00314     USize res(0, 0);
00315     if(m_wid == 0L)
00316         return res;
00317
00318 #if qGTK
00319     if(m_font == 0L)
00320         return res;
00321
00322     res.cx = gdk_text_width(m_font, lpszString, nCount);
00323     res.cy = gdk_text_height(m_font, lpszString, nCount);
00324 #endif
00325
00326     return res;
00327 }

int UDC::GetTextHeight ( void ) const

Definition at line 329 of file udraw.cpp.

Referenced by CWinLogBranchData::UpdateSelf(), CWinLogTagData::UpdateSelf(), CWinLogRevData::UpdateSelf(), and CWinLogHeaderData::UpdateSelf().

00330 {
00331     int res = 0;
00332     if(m_wid == 0L)
00333         return res;
00334
00335 #if qGTK
00336     if(m_font == 0L)
00337         return res;
00338
00339     res = m_font->ascent + m_font->descent;
00340 #endif
00341
00342     return res;
00343 }

void UDC::LineTo | ( | int | x,
 |  | int | y
 | ) |

Definition at line 299 of file udraw.cpp.

Referenced by CWinLogData::Update().

00300 {
00301     if(m_wid == 0L)
00302         return;
00303
00304 #if qGTK
00305     gdk_draw_line(m_drawable, m_gc,
00306                   m_penloc.x, m_penloc.y, x + m_orig.x, y + m_orig.y);
00307     m_penloc.x = x + m_orig.x;
00308     m_penloc.y = y + m_orig.y;
00309 #endif
00310 }

void UDC::MoveTo | ( | int | x,
 |  | int | y
 | ) |

Definition at line 288 of file udraw.cpp.

Referenced by CWinLogData::Update().

00289 {
00290     if(m_wid == 0L)
00291         return;
00292
00293 #if qGTK
00294     m_penloc.x = x + m_orig.x;
00295     m_penloc.y = y + m_orig.y;
00296 #endif
00297 }

bool UDC::Rectangle ( const URECT * lpRect )

Definition at line 248 of file udraw.cpp.

Referenced by DrawNode().

00249 {
00250     if(m_wid == 0L)
00251         return false;
00252
00253 #if qGTK
00254     URect r(*lpRect);
00255     if(m_brush != 0L && m_brush->m_set)
00256     {
00257         gdk_gc_set_foreground(m_gc, &m_brush->m_col);
00258         gdk_draw_rectangle (m_drawable, m_gc, TRUE,
00259                             r.left + m_orig.x, r.top + m_orig.y, r.Width(), r.Height());
00260         SelectObject(m_pen);
00261     }
00262     gdk_draw_rectangle (m_drawable, m_gc, FALSE,
00263                         r.left + m_orig.x, r.top + m_orig.y, r.Width(), r.Height());
00264 #endif
00265     return true;
00266 }

bool UDC::RoundRect | ( | const URECT * | lpRect,
 |  | UPOINT | point
 | ) |

Definition at line 268 of file udraw.cpp.

Referenced by DrawNode().

00269 {
00270     if(m_wid == 0L)
00271         return false;
00272
00273 #if qGTK
00274     URect r(*lpRect);
00275     if(m_brush != 0L && m_brush->m_set)
00276     {
00277         gdk_gc_set_foreground(m_gc, &m_brush->m_col);
00278         gdk_draw_rectangle (m_drawable, m_gc, TRUE,
00279                             r.left + m_orig.x, r.top + m_orig.y, r.Width(), r.Height());
00280         SelectObject(m_pen);
00281     }
00282     gdk_draw_rectangle (m_drawable, m_gc, FALSE,
00283                         r.left + m_orig.x, r.top + m_orig.y, r.Width(), r.Height());
00284 #endif
00285     return true;
00286 }

UBrush * UDC::SelectObject ( UBrush * pBrush )

Definition at line 220 of file udraw.cpp.

00221 {
00222     if(m_wid == 0L)
00223         return 0L;
00224
00225     UBrush *oldbrush = m_brush;
00226     m_brush = pBrush;
00227
00228 #if qGTK
00229     if(m_brush != 0L && m_brush->m_set)
00230         gdk_gc_set_background(m_gc, &m_brush->m_col);
00231     else
00232         gdk_gc_set_background(m_gc, &m_background);
00233 #endif
00234
00235     return oldbrush;
00236 }

UPen * UDC::SelectObject ( UPen * pPen )

Definition at line 202 of file udraw.cpp.

Referenced by DrawNode(), Rectangle(), RoundRect(), and CWinLogData::Update().

00203 {
00204     if(m_wid == 0L)
00205         return 0L;
00206
00207     UPen *oldpen = m_pen;
00208     m_pen = pPen;
00209
00210 #if qGTK
00211     if(m_pen != 0L && m_pen->m_set)
00212         gdk_gc_set_foreground(m_gc, &m_pen->m_col);
00213     else
00214         gdk_gc_set_foreground(m_gc, &m_foreground);
00215 #endif
00216
00217     return oldpen;
00218 }

bool UDC::TextOutClipped | ( | int | x,
 |  | int | y,
 |  | const URECT * | lpRect,
 |  | const char * | lpszString,
 |  | int | nCount
 | ) |

Definition at line 345 of file udraw.cpp.

Referenced by CWinLogBranchData::UpdateSelf(), CWinLogTagData::UpdateSelf(), CWinLogRevData::UpdateSelf(), and CWinLogHeaderData::UpdateSelf().

00347 {
00348     if(m_wid == 0L)
00349         return false;
00350
00351 #if qGTK
00352     if(m_font == 0L)
00353         return false;
00354
00355     USize size = GetTextExtent(lpszString, nCount);
00356     URect r(*lpRect);
00357     UPoint out(r.left, r.bottom);
00358     out += UPoint((r.Width() - size.cx) / 2, -(r.Height() - size.cy) / 2);
00359     gdk_draw_text(m_drawable, m_font, m_gc, out.x + m_orig.x, out.y + m_orig.y,
00360                   lpszString, nCount);
00361 #endif
00362
00363     return true;
00364 }

Member Data Documentation

UBrush* UDC::m_brush [protected]

Definition at line 525 of file udraw.h.

UPen* UDC::m_pen [protected]

Definition at line 524 of file udraw.h.

void* UDC::m_wid [protected]

Definition at line 523 of file udraw.h.

The documentation for this class was generated from the following files:
  • rf/udraw.h
  • rf/udraw.cpp
Generated on Sun Oct 21 12:47:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


deltatext Struct Reference

#include <rcs.h>

Collaboration diagram for deltatext:

[legend]
List of all members.

Public Attributes

char * | version
char * | log
char * | text
size_t | len
List * other

Member Data Documentation

size_t deltatext::len

Definition at line 131 of file rcs.h.

char* deltatext::log

Definition at line 124 of file rcs.h.

List* deltatext::other

Definition at line 135 of file rcs.h.

char* deltatext::text

Definition at line 130 of file rcs.h.

char* deltatext::version

Definition at line 119 of file rcs.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/rcs.h
Generated on Sun Oct 21 12:47:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CDestroyThreadLock Struct Reference

List of all members.

Public Methods

CDestroyThreadLock ()
~CDestroyThreadLock ()

Constructor & Destructor Documentation

CDestroyThreadLock::CDestroyThreadLock ( ) [inline]

Definition at line 117 of file cvsgui_process.cpp.

00118     {
00119     }

CDestroyThreadLock::~CDestroyThreadLock ( ) [inline]

Definition at line 120 of file cvsgui_process.cpp.

00121     {
00122     }

The documentation for this struct was generated from the following file:
  • common/cvsgui_process.cpp
Generated on Sun Oct 21 12:47:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CDialog Class Reference

Inheritance diagram for CDialog:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CustomizeMenus.h
Generated on Sun Oct 21 12:47:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


diff3_block Struct Reference

Collaboration diagram for diff3_block:

[legend]
List of all members.

Public Attributes

enum diff_type | correspond
int | ranges [3][2]
char ** | lines [3]
size_t * | lengths [3]
diff3_block * | next

Member Data Documentation

enum diff_type diff3_block::correspond

Definition at line 134 of file diff3.c.

size_t* diff3_block::lengths[3]

Definition at line 137 of file diff3.c.

char** diff3_block::lines[3]

Definition at line 136 of file diff3.c.

struct diff3_block* diff3_block::next

Definition at line 138 of file diff3.c.

int diff3_block::ranges[3][2]

Definition at line 135 of file diff3.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/diff/diff3.c
Generated on Sun Oct 21 12:47:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


diff_block Struct Reference

Collaboration diagram for diff_block:

[legend]
List of all members.

Public Attributes

int | ranges [2][2]
char ** | lines [2]
size_t * | lengths [2]
diff_block * | next

Member Data Documentation

size_t* diff_block::lengths[2]

Definition at line 127 of file diff3.c.

char** diff_block::lines[2]

Definition at line 126 of file diff3.c.

struct diff_block* diff_block::next

Definition at line 128 of file diff3.c.

int diff_block::ranges[2][2]

Definition at line 125 of file diff3.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/diff/diff3.c
Generated on Sun Oct 21 12:47:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


diff_callbacks Struct Reference

#include <diffrun.h>

Collaboration diagram for diff_callbacks:

[legend]
List of all members.

Public Attributes

void(* | write_output )()
void(* | flush_output )()
void(* | write_stdout )()
void(* | error )()

Member Data Documentation

void(* diff_callbacks::error)()

void(* diff_callbacks::flush_output)()

void(* diff_callbacks::write_output)()

void(* diff_callbacks::write_stdout)()

The documentation for this struct was generated from the following file:
  • cvs-1.10/diff/diffrun.h
Generated on Sun Oct 21 12:47:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dirdata Struct Reference

Collaboration diagram for dirdata:

[legend]
List of all members.

Public Attributes

char const ** | names
char * | data

Member Data Documentation

char* dirdata::data

Definition at line 28 of file dir.c.

Referenced by depth().

char const** dirdata::names

Definition at line 27 of file dir.c.

Referenced by depth().

The documentation for this struct was generated from the following file:
  • cvs-1.10/diff/dir.c
Generated on Sun Oct 21 12:47:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


direct Struct Reference

#include <ndir.h>

Collaboration diagram for direct:

[legend]
List of all members.

Public Attributes

long | d_ino
unsigned short | d_reclen
unsigned short | d_namlen
char | d_name [15+1]
ino_t | d_ino
int | d_reclen
int | d_namlen

Member Data Documentation

ino_t direct::d_ino

Definition at line 41 of file ndir.h.

ino_t direct::d_ino

Definition at line 41 of file ndir.h.

Referenced by readdir().

char direct::d_name

Definition at line 44 of file ndir.h.

Referenced by readdir().

int direct::d_namlen

Definition at line 43 of file ndir.h.

int direct::d_namlen

Definition at line 43 of file ndir.h.

Referenced by readdir().

int direct::d_reclen

Definition at line 42 of file ndir.h.

int direct::d_reclen

Definition at line 42 of file ndir.h.

Referenced by readdir().

The documentation for this struct was generated from the following files:
  • cvs-1.10/vms/ndir.h
  • cvs-1.10/windows-NT/ndir.h
  • WinCvs/ndir.h
Generated on Sun Oct 21 12:47:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


dirent Struct Reference

#include <dirent.h>

Collaboration diagram for dirent:

[legend]
List of all members.

Public Attributes

long | d_ino
long | d_off
unsigned short | d_namlen
char | d_name [1]

Member Data Documentation

long dirent::d_ino

Definition at line 25 of file dirent.h.

Referenced by opendir().

char dirent::d_name[1]

Definition at line 28 of file dirent.h.

Referenced by opendir().

unsigned short dirent::d_namlen

Definition at line 27 of file dirent.h.

Referenced by opendir().

long dirent::d_off

Definition at line 26 of file dirent.h.

Referenced by opendir().

The documentation for this struct was generated from the following file:
  • cvs-1.10/os2/dirent.h
Generated on Sun Oct 21 12:47:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CDockBar Class Reference

Inheritance diagram for CDockBar:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJSizeDockBar.h
Generated on Sun Oct 21 12:47:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CDockContext Class Reference

Inheritance diagram for CDockContext:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJDockContext.h
Generated on Sun Oct 21 12:47:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CDocument Class Reference

Inheritance diagram for CDocument:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/GraphDoc.h
Generated on Sun Oct 21 12:47:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


DROPDOWNBUTTON Struct Reference

#include <CJToolBar.h>

Collaboration diagram for DROPDOWNBUTTON:

[legend]
List of all members.

Public Attributes

DROPDOWNBUTTON * | next
UINT | idButton
UINT | idMenu

Member Data Documentation

UINT DROPDOWNBUTTON::idButton

Definition at line 89 of file CJToolBar.h.

Referenced by CCJToolBar::AddDropDownButton(), and CCJToolBar::FindDropDownButton().

UINT DROPDOWNBUTTON::idMenu

Definition at line 90 of file CJToolBar.h.

Referenced by CCJToolBar::AddDropDownButton(), and CCJToolBar::OnDropDownButton().

DROPDOWNBUTTON* DROPDOWNBUTTON::next

Definition at line 88 of file CJToolBar.h.

Referenced by CCJToolBar::AddDropDownButton(), CCJToolBar::FindDropDownButton(), and CCJToolBar::~CCJToolBar().

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/Include/CJToolBar.h
Generated on Sun Oct 21 12:47:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CDummyClass Class Reference

List of all members.

Public Methods

CDummyClass ()
CDummyClass ()

Constructor & Destructor Documentation

CDummyClass::CDummyClass ( ) [inline]

Definition at line 864 of file UPseudoSupport.cpp.

00865     {
00866         InitUSlider();
00867         if (!gUGridViewInitialized)
00868         {
00869             InitUGridView();
00870         }
00871         MA_REGISTER_CLASS(TPseudoAppBehavior);
00872         MA_REGISTER_CLASS(TPseudoIconButton);
00873         MA_REGISTER_CLASS(TPseudoIconPopup);
00874         MA_REGISTER_CLASS(TPseudoScrollBar);
00875         MA_REGISTER_CLASS(TPseudoRotateIconButton);
00876         MA_REGISTER_CLASS(TPseudoIconCheckBox);
00877         MA_REGISTER_CLASS(TBuggyPopup);
00878         MA_REGISTER_CLASS(TPseudoWinBehavior);
00879         MA_REGISTER_CLASS(TPseudoCustomView);
00880         MA_REGISTER_CLASS(TPseudoWinAdorner);
00881         MA_REGISTER_SIGNATURE(TPseudoTextListView,
00882                 TPseudoTextListView::kTextStringListViewSignature);
00883         MA_REGISTER_CLASS(TPseudoDoubleNumberText);
00884     }

CDummyClass::CDummyClass ( ) [inline]

Definition at line 1029 of file UPseudoSupport.cpp.

01030     {
01031         RegisterClass_(UPseudoRotButton);
01032         RegisterClass_(UPseudoPlaceHolder);
01033         RegisterClass_(UPseudoPageHider);
01034     }

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.cpp
  • rf/support/powerplant/UPseudoSupport.cpp
Generated on Sun Oct 21 12:47:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


DYN_LIST Struct Reference

Collaboration diagram for DYN_LIST:

[legend]
List of all members.

Public Attributes

int | numentries
int | defaultnumcells
int | sizeofcell
int | totpage
void * | first
DYN_LIST * | next
DYN_LIST * | current

Member Data Documentation

struct DYN_LIST* DYN_LIST::current

Definition at line 284 of file dll_garbage.c.

Referenced by listAddCell(), and listNew().

int DYN_LIST::defaultnumcells

Definition at line 278 of file dll_garbage.c.

Referenced by listAddCell(), and listNew().

void* DYN_LIST::first

Definition at line 282 of file dll_garbage.c.

struct DYN_LIST* DYN_LIST::next

Definition at line 283 of file dll_garbage.c.

Referenced by listAddCell(), listFree(), and listNew().

int DYN_LIST::numentries

Definition at line 277 of file dll_garbage.c.

Referenced by listAddCell(), and listNew().

int DYN_LIST::sizeofcell

Definition at line 279 of file dll_garbage.c.

Referenced by listAddCell(), and listNew().

int DYN_LIST::totpage

Definition at line 280 of file dll_garbage.c.

Referenced by listAddCell(), and listNew().

The documentation for this struct was generated from the following file:
  • common/dll_garbage.c
Generated on Sun Oct 21 12:47:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CEdit Class Reference

Inheritance diagram for CEdit:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJBrowseEdit.h
Generated on Sun Oct 21 12:47:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UEditMessage Class Reference

Inheritance diagram for UEditMessage:

[legend]
Collaboration diagram for UEditMessage:

[legend]
List of all members.

Public Types

enum | { kOK = EV_COMMAND_START, kCancel, kMsg, kEdit }

Public Methods

UEditMessage (const char *msg, const char *edit, const char *title, const char *def, const char *cncl)
virtual | ~UEditMessage ()
virtual void | DoDataExchange (bool fill)
while modaling, allows to fill/read the dialog content.
  • fill says if it expects to fill or read the dialog content.
 More...

Public Attributes

UStr m_edit

Protected Methods

virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

anonymous enum

Enumeration values:
kOK
kCancel
kMsg
kEdit

Definition at line 205 of file AskYesNo.cpp.

00206     {
00207         kOK = EV_COMMAND_START, // 0
00208         kCancel,                // 1
00209         kMsg,                   // 2
00210         kEdit                   // 3
00211     };

Constructor & Destructor Documentation

UEditMessage::UEditMessage | ( | const char * | msg,
 |  | const char * | edit,
 |  | const char * | title,
 |  | const char * | def,
 |  | const char * | cncl
 | ) | [inline]

Definition at line 198 of file AskYesNo.cpp.

Referenced by PromptEditMessage().

00199                           : m_edit(edit), UPromptMessage(msg, title, def, cncl)
00200     {
00201     }

virtual UEditMessage::~UEditMessage ( ) [inline, virtual]

Definition at line 203 of file AskYesNo.cpp.

00203 {}

Member Function Documentation

virtual void UEditMessage::DoDataExchange ( bool fill ) [inline, virtual]

while modaling, allows to fill/read the dialog content.

  • fill says if it expects to fill or read the dialog content.

Reimplemented from UPromptMessage.

Definition at line 213 of file AskYesNo.cpp.

00214     {
00215         UPromptMessage::DoDataExchange(fill);
00216
00217         if(fill)
00218         {
00219             UEventSendMessage(GetWidID(), EV_SETTEXT, kEdit, (void *)m_edit.c_str());
00220         }
00221         else
00222         {
00223             UEventSendMessage(GetWidID(), EV_GETTEXT, kEdit, &m_edit);
00224         }
00225     }

const UMSGMAP* UEditMessage::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UPromptMessage.

virtual const UMSGMAP* UEditMessage::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UPromptMessage.

const UMSGMAP* UEditMessage::GetThisMessageMap ( ) [static, protected]

Reimplemented from UPromptMessage.

Member Data Documentation

const UMSGMAP_ENTRY UEditMessage::_messageEntries[] [static, private]

Reimplemented from UPromptMessage.

Definition at line 231 of file AskYesNo.cpp.

UStr UEditMessage::m_edit

Definition at line 227 of file AskYesNo.cpp.

const UMSGMAP UEditMessage::messageMap [static, protected]

Reimplemented from UPromptMessage.

Definition at line 231 of file AskYesNo.cpp.

The documentation for this class was generated from the following file:
  • common/AskYesNo.cpp
Generated on Sun Oct 21 12:47:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ENTNODE Class Reference

#include <CvsEntries.h>

Collaboration diagram for ENTNODE:

[legend]
List of all members.

Public Methods

ENTNODE ()
ENTNODE (EntnodeData *data)
ENTNODE (EntnodeData &data)
ENTNODE (const ENTNODE &anode)
~ENTNODE ()
ENTNODE & | operator= (const ENTNODE &anode)
EntnodeData * | Data () const
operator EntnodeData * () const

Static Public Methods

int | Compare (const ENTNODE &node1, const ENTNODE &node2)

Protected Attributes

EntnodeData * shareData

Constructor & Destructor Documentation

ENTNODE::ENTNODE ( ) [inline]

Definition at line 269 of file CvsEntries.h.

00269 : shareData(0L) {}

ENTNODE::ENTNODE ( EntnodeData * data ) [inline]

Definition at line 270 of file CvsEntries.h.

00270 : shareData(data->Ref()) {}

ENTNODE::ENTNODE ( EntnodeData & data ) [inline]

Definition at line 271 of file CvsEntries.h.

00271 : shareData(data.Ref()) {}

ENTNODE::ENTNODE ( const ENTNODE & anode ) [inline]

Definition at line 272 of file CvsEntries.h.

00272                                    : shareData(0L)
00273     {
00274         *this = anode;
00275     }

ENTNODE::~ENTNODE ( ) [inline]

Definition at line 276 of file CvsEntries.h.

00277     {
00278         if(shareData != 0L)
00279             shareData->UnRef();
00280     }

Member Function Documentation

int ENTNODE::Compare | ( | const ENTNODE & | node1,
 |  | const ENTNODE & | node2
 | ) | [inline, static]

Definition at line 282 of file CvsEntries.h.

00283     {
00284         return EntnodeData::Compare(*node1.shareData, *node2.shareData);
00285     }

EntnodeData* ENTNODE::Data ( ) const [inline]

Definition at line 302 of file CvsEntries.h.

Referenced by Entries_SetMissing(), Entries_SetVisited(), TViewFill::ExitDirectory(), CTCLBrowserEnt::GetData(), CTCLBrowserEnt::GetNormalized(), CTCLBrowserEnt::IsSamePath(), CWinCvsBrowser::OnItemexpanding(), cvsgui_GetCvsEntries(), and tclCvsEntriesProc().

00302 { return shareData; }

ENTNODE::operator EntnodeData * ( ) const [inline]

Definition at line 303 of file CvsEntries.h.

00303 { return shareData; }

ENTNODE& ENTNODE::operator= ( const ENTNODE & anode ) [inline]

Definition at line 287 of file CvsEntries.h.

00288     {
00289         EntnodeData* oldData = shareData;
00290         shareData = anode.shareData;
00291         if(shareData != 0L)
00292         {
00293             shareData->Ref();
00294         }
00295         if(oldData != 0L)
00296         {
00297             oldData->UnRef();
00298         }
00299         return *this;
00300     }

Member Data Documentation

EntnodeData* ENTNODE::shareData [protected]

Definition at line 306 of file CvsEntries.h.

Referenced by Compare(), and operator=().

The documentation for this class was generated from the following file:
  • common/CvsEntries.h
Generated on Sun Oct 21 12:47:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


entnode Struct Reference

#include <cvs.h>

Collaboration diagram for entnode:

[legend]
List of all members.

Public Attributes

enum ent_type | type
char * | user
char * | version
char * | timestamp
char * | options
char * | tag
char * | date
char * | conflict

Member Data Documentation

char* entnode::conflict

Definition at line 310 of file cvs.h.

char* entnode::date

Definition at line 309 of file cvs.h.

char* entnode::options

Definition at line 306 of file cvs.h.

char* entnode::tag

Definition at line 308 of file cvs.h.

char* entnode::timestamp

Definition at line 303 of file cvs.h.

enum ent_type entnode::type

Definition at line 298 of file cvs.h.

char* entnode::user

Definition at line 299 of file cvs.h.

char* entnode::version

Definition at line 300 of file cvs.h.

Referenced by finfo().

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/cvs.h
Generated on Sun Oct 21 12:47:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


EntnodeData Class Reference

#include <CvsEntries.h>

Inheritance diagram for EntnodeData:

[legend]
Collaboration diagram for EntnodeData:

[legend]
List of all members.

Public Types

enum | { kName = 0, kStatus = 3, kPath = 7 }

Public Methods

virtual ent_type | GetType (void) const=0
EntnodeData * | Ref (void)
EntnodeData * | UnRef (void)
virtual const char * | operator[] (int index) const
void | SetMissing (bool state)
bool | IsMissing (void) const
void | SetVisited (bool state)
bool | IsVisited (void) const
void | SetUnknown (bool state)
bool | IsUnknown (void) const
void | SetIgnored (bool state)
bool | IsIgnored (void) const
void | SetLocked (bool state)
bool | IsLocked (void) const
void | SetRemoved (bool state)
bool | IsRemoved (void) const
void | SetDesc (const char *newdesc)
const char * | GetDesc (void) const
const char * | GetName (void) const
const char * | GetFullPathName (UStr &resPath) const
virtual const char * | GetConflict () const
void | SetUnmodified (bool state)
bool | IsUnmodified (void) const

Static Public Methods

int | Compare (const EntnodeData &node1, const EntnodeData &node2)

Protected Methods

EntnodeData (const char *name, EntnodePath *path)
virtual | ~EntnodeData ()

Protected Attributes

int | ref
int | missing: 1
int | visited: 1
int | unknown: 1
int | unmodified: 1
int | ignored: 1
int | locked: 1
int | removed: 1

Private Attributes

const char * | user
const char * | desc
EntnodePath * fullpathname

Static Private Attributes

UStr sbuffer

Member Enumeration Documentation

anonymous enum

Enumeration values:
kName
kStatus
kPath

Definition at line 78 of file CvsEntries.h.

00079     {
00080         kName = 0,
00081         kStatus = 3,
00082         kPath = 7
00083     };

Constructor & Destructor Documentation

EntnodeData::EntnodeData | ( | const char * | name,
 |  | EntnodePath * | path
 | ) | [protected]

Definition at line 110 of file CvsEntries.cpp.

00111     : ref(1), missing(false), visited(false), unknown(false),
00112       unmodified(true), ignored(false), locked(false), removed(false),
00113       user(0L), desc(0L), fullpathname(0L)
00114 {
00115 #ifdef macintosh
00116     macspec.vRefNum = 0;
00117     macspec.parID = 0;
00118     macspec.name[0] = '\0';
00119 #endif /* macintosh */
00120     user = cloneStr(name);
00121     fullpathname = path->Ref();
00122 }

EntnodeData::~EntnodeData ( ) [protected, virtual]

Definition at line 124 of file CvsEntries.cpp.

00125 {
00126     disposeStr(user);
00127     if(fullpathname)
00128         fullpathname->UnRef();
00129 }

Member Function Documentation

int EntnodeData::Compare | ( | const EntnodeData & | node1,
 |  | const EntnodeData & | node2
 | ) | [inline, static]

Definition at line 86 of file CvsEntries.h.

Referenced by ENTNODE::Compare().

00087     {
00088 #ifdef WIN32
00089         return stricmp(node1.user, node2.user);
00090 #else /* !WIN32 */
00091         return strcmp(node1.user, node2.user);
00092 #endif /* !WIN32 */
00093     }

virtual const char* EntnodeData::GetConflict ( ) const [inline, virtual]

Reimplemented in EntnodeFile.

Definition at line 144 of file CvsEntries.h.

Referenced by KoConflictColumn::Compare(), Entries_SetVisited(), PyCvsEntry::GetAttr(), CBrowseFileView::GetImageForEntry(), KoConflictColumn::GetText(), and KoFilterModel::IsMatch().

00145     {
00146         return 0L;
00147     }

const char* EntnodeData::GetDesc ( void ) const [inline]

Definition at line 129 of file CvsEntries.h.

Referenced by PyCvsEntry::GetAttr(), TViewFill::OnDirectory(), TViewFill::OnFile(), UCvsFiles::ResetView(), and tclCvsBrowserProc().

00129 {return desc;}

const char* EntnodeData::GetFullPathName ( UStr & resPath ) const [inline]

Definition at line 138 of file CvsEntries.h.

Referenced by CBrowseFileView::DoDrag(), CBrowseFileView::EditSel(), PyCvsEntry::GetAttr(), CTCLBrowserEnt::GetNormalized(), KoPathColumn::GetText(), CTCLBrowserEnt::IsSamePath(), CBrowseFileView::OnKeydown(), CBrowseFileView::OnViewExplore(), CBrowseFileView::ProcessSelectionCommand(), CBrowseFileView::ResetView(), and tclCvsBrowserProc().

00139     {
00140         return fullpathname->GetFullPathName(resPath, user);
00141     }

const char* EntnodeData::GetName ( void ) const [inline]

Definition at line 132 of file CvsEntries.h.

Referenced by KoNameColumn::Compare(), PyCvsEntry::GetAttr(), KoPathColumn::GetText(), KoNameColumn::GetText(), and KoFilterModel::IsMatch().

00133     {
00134         return user;
00135     }

virtual ent_type EntnodeData::GetType ( void ) const [pure virtual]

Reimplemented in EntnodeFile, and EntnodeFolder.

Referenced by CBrowseFileView::DoDrag(), CBrowseFileView::EditSel(), UCvsFiles::EditSel(), TViewFill::ExitDirectory(), PyCvsEntry::GetAttr(), CBrowseFileView::GetImageForEntry(), UCvsFiles::GetImageForEntry(), UCvsFiles::OnCmdAdd(), UCvsFiles::OnCmdAddb(), UCvsFiles::OnCmdCommit(), UCvsFiles::OnCmdDiff(), UCvsFiles::OnCmdEdit(), UCvsFiles::OnCmdEditors(), UCvsFiles::OnCmdGraph(), UCvsFiles::OnCmdLock(), UCvsFiles::OnCmdLog(), UCvsFiles::OnCmdQueryUpdate(), UCvsFiles::OnCmdRelease(), UCvsFiles::OnCmdRmv(), UCvsFiles::OnCmdStatus(), UCvsFiles::OnCmdTagBranch(), UCvsFiles::OnCmdTagDelete(), UCvsFiles::OnCmdTagNew(), UCvsFiles::OnCmdTrash(), UCvsFiles::OnCmdUIAdd(), UCvsFiles::OnCmdUIAddB(), UCvsFiles::OnCmdUIEditseldef(), UCvsFiles::OnCmdUIGraph(), UCvsFiles::OnCmdUIRelease(), UCvsFiles::OnCmdUIRmv(), UCvsFiles::OnCmdUITrash(), UCvsFiles::OnCmdUIUpdate(), UCvsFiles::OnCmdUnedit(), UCvsFiles::OnCmdUnlock(), UCvsFiles::OnCmdUpdate(), UCvsFiles::OnCmdWatchOff(), UCvsFiles::OnCmdWatchOn(), UCvsFiles::OnCmdWatchers(), CBrowseFileView::OnEditSelectAll(), CWinCvsBrowser::OnItemexpanding(), CBrowseFileView::OnKeydown(), UCvsFolders::OnTreeExpanding(), CBrowseFileView::OnUpdateQueryAnnotate(), CBrowseFileView::OnUpdateViewAdd(), CBrowseFileView::OnUpdateViewAddB(), CBrowseFileView::OnUpdateViewEditseldef(), CBrowseFileView::OnUpdateViewGraph(), CBrowseFileView::OnUpdateViewRelease(), CBrowseFileView::OnUpdateViewRmv(), CBrowseFileView::OnUpdateViewUpdate(), CBrowseFileView::OnViewExplore(), CBrowseFileView::ProcessSelectionCommand(), CBrowseFileView::ResetView(), and tclCvsBrowserProc().

bool EntnodeData::IsIgnored ( void ) const [inline]

Definition at line 123 of file CvsEntries.h.

Referenced by Entries_SetVisited(), PyCvsEntry::GetAttr(), CBrowseFileView::GetImageForEntry(), UCvsFiles::GetImageForEntry(), TBrowserFill::OnDirectory(), TViewFill::OnDirectory(), TViewFill::OnFile(), SetIcon(), CHistComboBoxEx::SetIcon(), and tclCvsBrowserProc().

00123 {return 0 != ignored;}

bool EntnodeData::IsLocked ( void ) const [inline]

Definition at line 125 of file CvsEntries.h.

Referenced by PyCvsEntry::GetAttr(), TViewFill::OnFile(), and tclCvsBrowserProc().

00125 {return 0 != locked;}

bool EntnodeData::IsMissing ( void ) const [inline]

Definition at line 117 of file CvsEntries.h.

Referenced by TViewFill::ExitDirectory(), PyCvsEntry::GetAttr(), UCvsFiles::GetImageForEntry(), KoFilterModel::IsMatch(), UCvsFiles::OnCmdUIAdd(), UCvsFiles::OnCmdUIAddB(), UCvsFiles::OnCmdUIEditseldef(), UCvsFiles::OnCmdUIExplore(), UCvsFiles::OnCmdUITrash(), TViewFill::OnDirectory(), CWinCvsBrowser::OnItemexpanding(), CWinCvsBrowser::OnSelchanging(), UCvsFolders::OnTreeExpanding(), UCvsFolders::OnTreeSelecting(), CBrowseFileView::OnUpdateViewAdd(), CBrowseFileView::OnUpdateViewAddB(), CBrowseFileView::OnUpdateViewEditseldef(), CBrowseFileView::OnUpdateViewExplore(), UCvsFiles::ResetView(), CHistComboBoxEx::SetIcon(), and tclCvsBrowserProc().

00117 {return 0 != missing;}

bool EntnodeData::IsRemoved ( void ) const [inline]

Definition at line 127 of file CvsEntries.h.

Referenced by Entries_SetMissing(), TViewFill::ExitDirectory(), PyCvsEntry::GetAttr(), CBrowseFileView::GetImageForEntry(), UCvsFiles::GetImageForEntry(), KoFilterModel::IsMatch(), UCvsFiles::OnCmdUIAdd(), UCvsFiles::OnCmdUIAddB(), UCvsFiles::OnCmdUIRmv(), CBrowseFileView::OnUpdateViewAdd(), CBrowseFileView::OnUpdateViewAddB(), and CBrowseFileView::OnUpdateViewRmv().

00127 {return 0 != removed;}

bool EntnodeData::IsUnknown ( void ) const [inline]

Definition at line 121 of file CvsEntries.h.

Referenced by Entries_SetVisited(), PyCvsEntry::GetAttr(), CBrowseFileView::GetImageForEntry(), UCvsFiles::GetImageForEntry(), KoFilterModel::IsMatch(), UCvsFiles::OnCmdUIAdd(), UCvsFiles::OnCmdUIAddB(), UCvsFiles::OnCmdUIGraph(), UCvsFiles::OnCmdUIRelease(), UCvsFiles::OnCmdUIRmv(), UCvsFiles::OnCmdUIUpdate(), TViewFill::OnDirectory(), CBrowseFileView::OnUpdateQueryAnnotate(), CBrowseFileView::OnUpdateViewAdd(), CBrowseFileView::OnUpdateViewAddB(), CBrowseFileView::OnUpdateViewGraph(), CBrowseFileView::OnUpdateViewRelease(), CBrowseFileView::OnUpdateViewRmv(), CBrowseFileView::OnUpdateViewUpdate(), SetIcon(), CHistComboBoxEx::SetIcon(), and tclCvsBrowserProc().

00121 {return 0 != unknown;}

bool EntnodeData::IsUnmodified ( void ) const [inline]

Definition at line 150 of file CvsEntries.h.

Referenced by Entries_SetVisited(), PyCvsEntry::GetAttr(), CBrowseFileView::GetImageForEntry(), UCvsFiles::GetImageForEntry(), KoFilterModel::IsMatch(), and tclCvsBrowserProc().

00150 {return 0 != unmodified;}

bool EntnodeData::IsVisited ( void ) const [inline]

Definition at line 119 of file CvsEntries.h.

Referenced by Entries_SetMissing().

00119 {return 0 != visited;}

EntnodeData* EntnodeData::Ref ( void ) [inline]

Definition at line 94 of file CvsEntries.h.

Referenced by TBrowserFillDummy::EnterDirectory(), TBrowserFillDummy::ExitDirectory(), TViewFill::InitItem(), CWinCvsBrowser::OnItemexpanding(), UCvsFolders::OnTreeExpanding(), CGraphDoc::SetNode(), and ENTNODE::operator=().

00094 {++ref; return this;}

void EntnodeData::SetDesc ( const char * newdesc )

Definition at line 131 of file CvsEntries.cpp.

Referenced by Entries_SetMissing(), and Entries_SetVisited().

00132 {
00133     desc = newdesc;
00134 }

void EntnodeData::SetIgnored ( bool state ) [inline]

Definition at line 122 of file CvsEntries.h.

Referenced by Entries_SetVisited().

00122 {ignored = state;}

void EntnodeData::SetLocked ( bool state ) [inline]

Definition at line 124 of file CvsEntries.h.

Referenced by Entries_SetVisited().

00124 {locked = state;}

void EntnodeData::SetMissing ( bool state ) [inline]

Definition at line 116 of file CvsEntries.h.

Referenced by Entries_SetMissing().

00116 {missing = state;}

void EntnodeData::SetRemoved ( bool state ) [inline]

Definition at line 126 of file CvsEntries.h.

Referenced by EntnodeFile::EntnodeFile().

00126 {removed = state;}

void EntnodeData::SetUnknown ( bool state ) [inline]

Definition at line 120 of file CvsEntries.h.

Referenced by Entries_SetVisited().

00120 {unknown = state;}

void EntnodeData::SetUnmodified ( bool state ) [inline]

Definition at line 149 of file CvsEntries.h.

Referenced by Entries_SetVisited().

00149 {unmodified = state;}

void EntnodeData::SetVisited ( bool state ) [inline]

Definition at line 118 of file CvsEntries.h.

Referenced by Entries_SetVisited().

00118 {visited = state;}

EntnodeData* EntnodeData::UnRef ( void ) [inline]

Definition at line 95 of file CvsEntries.h.

Referenced by CWinCvsBrowser::DeleteAllItems(), UCvsFolders::DeleteAllItems(), TBrowserFillDummy::EnterDirectory(), Entries_Open(), Entries_SetVisited(), TBrowserFillDummy::ExitDirectory(), UCvsFolders::OnCmdMacrosSel(), CBrowseFileView::OnDeleteitem(), CWinCvsBrowser::OnUpdateMacro(), CGraphDoc::PrepareNew(), ENTNODE::operator=(), ENTNODE::~ENTNODE(), and UCvsGraph::~UCvsGraph().

00096     {
00097         if(--ref == 0)
00098         {
00099             delete this;
00100             return 0L;
00101         }
00102         return this;
00103     }

virtual const char* EntnodeData::operator[] ( int index ) const [inline, virtual]

Reimplemented in EntnodeFile, and EntnodeFolder.

Definition at line 105 of file CvsEntries.h.

Referenced by EntnodeFolder::operator[](), and EntnodeFile::operator[]().

00106     {
00107         if(index == kName)
00108             return user;
00109         else if(index == kStatus)
00110             return desc;
00111         else if(index == kPath)
00112             return GetFullPathName(sbuffer);
00113         return 0L;
00114     }

Member Data Documentation

const char* EntnodeData::desc [private]

Definition at line 170 of file CvsEntries.h.

EntnodePath* EntnodeData::fullpathname [private]

Definition at line 171 of file CvsEntries.h.

int EntnodeData::ignored [protected]

Definition at line 162 of file CvsEntries.h.

int EntnodeData::locked [protected]

Definition at line 163 of file CvsEntries.h.

int EntnodeData::missing [protected]

Definition at line 158 of file CvsEntries.h.

int EntnodeData::ref [protected]

Definition at line 157 of file CvsEntries.h.

int EntnodeData::removed [protected]

Definition at line 164 of file CvsEntries.h.

UStr EntnodeData::sbuffer [static, private]

Definition at line 136 of file CvsEntries.cpp.

int EntnodeData::unknown [protected]

Definition at line 160 of file CvsEntries.h.

int EntnodeData::unmodified [protected]

Definition at line 161 of file CvsEntries.h.

const char* EntnodeData::user [private]

Definition at line 169 of file CvsEntries.h.

Referenced by Compare().

int EntnodeData::visited [protected]

Definition at line 159 of file CvsEntries.h.

The documentation for this class was generated from the following files:
  • common/CvsEntries.h
  • common/CvsEntries.cpp
Generated on Sun Oct 21 12:47:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


EntnodeFile Class Reference

#include <CvsEntries.h>

Inheritance diagram for EntnodeFile:

[legend]
Collaboration diagram for EntnodeFile:

[legend]
List of all members.

Public Types

enum {
kVN = 1, kTS = 5, kOption = 2, kTag = 4,
kConflict = 6
}

Public Methods

EntnodeFile (const char *name, EntnodePath *path, const char *newvn=0L, const char *newts=0L, const char *newoptions=0L, const char *newtag=0L, const char *newdate=0L, const char *newts_conflict=0L)
virtual const char * | operator[] (int index) const
virtual ent_type | GetType (void) const
virtual const char * | GetConflict () const

Protected Methods

virtual | ~EntnodeFile ()

Protected Attributes

const char * | vn
const char * | ts
const char * | option
const char * | tag
const char * | date
const char * | ts_conflict

Member Enumeration Documentation

anonymous enum

Enumeration values:
kVN
kTS
kOption
kTag
kConflict

Definition at line 190 of file CvsEntries.h.

00191     {
00192         kVN = 1,
00193         kTS = 5,
00194         kOption = 2,
00195         kTag = 4,
00196         kConflict = 6
00197     };

Constructor & Destructor Documentation

EntnodeFile::EntnodeFile | ( | const char * | name,
 |  | EntnodePath * | path,
 |  | const char * | newvn = 0L,
 |  | const char * | newts = 0L,
 |  | const char * | newoptions = 0L,
 |  | const char * | newtag = 0L,
 |  | const char * | newdate = 0L,
 |  | const char * | newts_conflict = 0L
 | ) |

Definition at line 148 of file CvsEntries.cpp.

00150                                                      : EntnodeData(name, path)
00151 {
00152     vn = 0L;
00153     ts = 0L;
00154     option = 0L;
00155     tag = 0L;
00156     date = 0L;
00157     ts_conflict = 0L;
00158
00159     vn = cloneStr(newvn);
00160     ts = cloneStr(newts);
00161     option = cloneStr(newoptions);
00162     tag = cloneStr(newtag);
00163     date = cloneStr(newdate);
00164     ts_conflict = cloneStr(newts_conflict);
00165
00166     if(newvn != 0L && newvn[0] == '-')
00167         SetRemoved(true);
00168 }

EntnodeFile::~EntnodeFile ( ) [protected, virtual]

Definition at line 138 of file CvsEntries.cpp.

00139 {
00140     disposeStr(vn);
00141     disposeStr(ts);
00142     disposeStr(option);
00143     disposeStr(tag);
00144     disposeStr(date);
00145     disposeStr(ts_conflict);
00146 }

Member Function Documentation

virtual const char* EntnodeFile::GetConflict ( ) const [inline, virtual]

Reimplemented from EntnodeData.

Definition at line 222 of file CvsEntries.h.

00223     {
00224         return ts_conflict;
00225     }

virtual ent_type EntnodeFile::GetType ( void ) const [inline, virtual]

Reimplemented from EntnodeData.

Definition at line 216 of file CvsEntries.h.

00217     {
00218         return ENT_FILE;
00219     }

virtual const char* EntnodeFile::operator[] ( int index ) const [inline, virtual]

Reimplemented from EntnodeData.

Definition at line 200 of file CvsEntries.h.

00201     {
00202         if(index == kVN)
00203             return vn;
00204         else if(index == kTS)
00205             return ts;
00206         else if(index == kOption)
00207             return option;
00208         else if(index == kTag)
00209             return tag != 0L ? tag : date;
00210         else if(index == kConflict)
00211             return ts_conflict;
00212
00213         return EntnodeData::operator[](index);
00214     }

Member Data Documentation

const char* EntnodeFile::date [protected]

Definition at line 232 of file CvsEntries.h.

const char* EntnodeFile::option [protected]

Definition at line 230 of file CvsEntries.h.

const char* EntnodeFile::tag [protected]

Definition at line 231 of file CvsEntries.h.

const char* EntnodeFile::ts [protected]

Definition at line 229 of file CvsEntries.h.

const char* EntnodeFile::ts_conflict [protected]

Definition at line 233 of file CvsEntries.h.

const char* EntnodeFile::vn [protected]

Definition at line 228 of file CvsEntries.h.

The documentation for this class was generated from the following files:
  • common/CvsEntries.h
  • common/CvsEntries.cpp
Generated on Sun Oct 21 12:47:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


EntnodeFolder Class Reference

#include <CvsEntries.h>

Inheritance diagram for EntnodeFolder:

[legend]
Collaboration diagram for EntnodeFolder:

[legend]
List of all members.

Public Methods

EntnodeFolder (const char *name, EntnodePath *path, const char *newvn=0L, const char *newts=0L, const char *newoptions=0L, const char *newtag=0L, const char *newdate=0L, const char *newts_conflict=0L)
virtual const char * | operator[] (int index) const
virtual ent_type | GetType (void) const

Protected Methods

virtual | ~EntnodeFolder ()

Constructor & Destructor Documentation

EntnodeFolder::EntnodeFolder | ( | const char * | name,
 |  | EntnodePath * | path,
 |  | const char * | newvn = 0L,
 |  | const char * | newts = 0L,
 |  | const char * | newoptions = 0L,
 |  | const char * | newtag = 0L,
 |  | const char * | newdate = 0L,
 |  | const char * | newts_conflict = 0L
 | ) |

Definition at line 174 of file CvsEntries.cpp.

00176                                                      : EntnodeData(name, path)
00177 {
00178 }

EntnodeFolder::~EntnodeFolder ( ) [protected, virtual]

Definition at line 170 of file CvsEntries.cpp.

00171 {
00172 }

Member Function Documentation

virtual ent_type EntnodeFolder::GetType ( void ) const [inline, virtual]

Reimplemented from EntnodeData.

Definition at line 256 of file CvsEntries.h.

00257     {
00258         return ENT_SUBDIR;
00259     }

virtual const char* EntnodeFolder::operator[] ( int index ) const [inline, virtual]

Reimplemented from EntnodeData.

Definition at line 251 of file CvsEntries.h.

00252     {
00253         return EntnodeData::operator[](index);
00254     }

The documentation for this class was generated from the following files:
  • common/CvsEntries.h
  • common/CvsEntries.cpp
Generated on Sun Oct 21 12:47:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


EntnodePath Class Reference

#include <CvsEntries.h>

Collaboration diagram for EntnodePath:

[legend]
List of all members.

Public Methods

EntnodePath (const char *path)
EntnodePath * | Ref (void)
EntnodePath * | UnRef (void)
const char * | GetFullPathName (UStr &resPath, const char *name) const

Protected Methods

~EntnodePath ()

Protected Attributes

const char * | fullpathname
int | ref

Constructor & Destructor Documentation

EntnodePath::~EntnodePath ( ) [protected]

Definition at line 95 of file CvsEntries.cpp.

00096 {
00097     disposeStr(fullpathname);
00098 }

EntnodePath::EntnodePath ( const char * path )

Definition at line 90 of file CvsEntries.cpp.

00090                                          : fullpathname(0L), ref(1)
00091 {
00092     fullpathname = cloneStr(path);
00093 }

Member Function Documentation

const char * EntnodePath::GetFullPathName | ( | UStr & | resPath,
 |  | const char * | name
 | ) | const

Definition at line 100 of file CvsEntries.cpp.

Referenced by EntnodeData::operator[]().

00101 {
00102     resPath = fullpathname;
00103     if(!resPath.endsWith(kPathDelimiter))
00104         resPath << kPathDelimiter;
00105     resPath << name;
00106
00107     return resPath;
00108 }

EntnodePath* EntnodePath::Ref ( void ) [inline]

Definition at line 48 of file CvsEntries.h.

00048 {++ref; return this;}

EntnodePath* EntnodePath::UnRef ( void ) [inline]

Definition at line 49 of file CvsEntries.h.

Referenced by Entries_SetVisited(), UCvsFolders::OnCmdMacrosSel(), CWinCvsBrowser::OnUpdateMacro(), fgetentent(), and EntnodeData::~EntnodeData().

00050     {
00051         if(--ref == 0)
00052         {
00053             delete this;
00054             return 0L;
00055         }
00056         return this;
00057     }

Member Data Documentation

const char* EntnodePath::fullpathname [protected]

Definition at line 62 of file CvsEntries.h.

int EntnodePath::ref [protected]

Definition at line 63 of file CvsEntries.h.

The documentation for this class was generated from the following files:
  • common/CvsEntries.h
  • common/CvsEntries.cpp
Generated on Sun Oct 21 12:47:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


equivclass Struct Reference

Collaboration diagram for equivclass:

[legend]
List of all members.

Public Attributes

int | next
unsigned | hash
char const * | line
size_t | length

Member Data Documentation

unsigned equivclass::hash

Definition at line 43 of file io.c.

size_t equivclass::length

Definition at line 45 of file io.c.

char const* equivclass::line

Definition at line 44 of file io.c.

int equivclass::next

Definition at line 42 of file io.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/diff/io.c
Generated on Sun Oct 21 12:47:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


err_strs Struct Reference

Collaboration diagram for err_strs:

[legend]
List of all members.

Public Attributes

char ** | strs
int | first
int | last

Member Data Documentation

int err_strs::first

Definition at line 21 of file sockerror.c.

Referenced by sock_strerror().

int err_strs::last

Definition at line 22 of file sockerror.c.

Referenced by sock_strerror().

char** err_strs::strs

Definition at line 20 of file sockerror.c.

Referenced by sock_strerror().

The documentation for this struct was generated from the following file:
  • cvs-1.10/windows-NT/sockerror.c
Generated on Sun Oct 21 12:47:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


error_info Struct Reference

Collaboration diagram for error_info:

[legend]
List of all members.

Public Attributes

int | value
char * | name

Member Data Documentation

char* error_info::name

Definition at line 63 of file strerror.c.

int error_info::value

Definition at line 62 of file strerror.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/lib/strerror.c
Generated on Sun Oct 21 12:47:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


EXHCB Struct Reference

#include <vms-types.h>

Collaboration diagram for EXHCB:

[legend]
List of all members.

Public Attributes

exhcb *exh | a_link
int(* | exh )()
long exh | l_argcount
long *exh | a_status
long exh | l_status

Member Data Documentation

struct exhcb* exh EXHCB::a_link

Definition at line 38 of file vms-types.h.

long* exh EXHCB::a_status

Definition at line 41 of file vms-types.h.

int(* EXHCB::exh)()

Referenced by piped_child_exit_handler_block().

long exh EXHCB::l_argcount

Definition at line 40 of file vms-types.h.

long exh EXHCB::l_status

Definition at line 42 of file vms-types.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/vms-types.h
Generated on Sun Oct 21 12:47:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CExploreBar Class Reference

#include <ExploreBar.h>

Inheritance diagram for CExploreBar:

[legend]
Collaboration diagram for CExploreBar:

[legend]
List of all members.

Public Methods

virtual BOOL | Create (LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL)

Public Attributes

CMyShellTree m_TreeCtrl

Protected Methods

CExploreBar ()
virtual void | OnDraw (CDC *pDC)
virtual | ~CExploreBar ()
void | OnUpdateCmd (CCmdUI *pCmdUI)
bool | DisableCommon ()
afx_msg void | OnWindowPosChanged (WINDOWPOS *lpwndpos)
afx_msg void | OnViewCheckout ()
afx_msg void | OnUpdateViewCheckout (CCmdUI *pCmdUI)
afx_msg void | OnViewImport ()
afx_msg void | OnUpdateViewImport (CCmdUI *pCmdUI)

Constructor & Destructor Documentation

CExploreBar::CExploreBar ( ) [protected]

Definition at line 106 of file ExploreBar.cpp.

00107 {
00108 }

CExploreBar::~CExploreBar ( ) [protected, virtual]

Definition at line 110 of file ExploreBar.cpp.

00111 {
00112 }

Member Function Documentation

BOOL CExploreBar::Create | ( | LPCTSTR | lpszClassName,
 |  | LPCTSTR | lpszWindowName,
 |  | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | CCreateContext * | pContext = NULL
 | ) | [virtual]

Definition at line 151 of file ExploreBar.cpp.

00152 {
00153     BOOL res = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
00154
00155     if(res)
00156     {
00157         if (!m_TreeCtrl.Create(
00158             WS_VISIBLE|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS,
00159             CRect(0,0,0,0), this, IDC_BAR_TREE))
00160         {
00161             TRACE0("Unable to create caption button.\n");
00162             return FALSE;
00163         }
00164     }
00165
00166     //m_TreeCtrl.EnableImages();
00167     //m_TreeCtrl.PopulateTree();
00168
00169     //SetChild(&m_TreeCtrl);
00170
00171     return res;
00172 }

bool CExploreBar::DisableCommon ( ) [protected]

Definition at line 201 of file ExploreBar.cpp.

Referenced by OnUpdateCmd().

00202 {
00203     CWincvsApp *app = (CWincvsApp *)AfxGetApp();
00204     return app->gCvsRunning || gCvsPrefs.empty();
00205 }

void CExploreBar::OnDraw ( CDC * pDC ) [protected, virtual]

Definition at line 128 of file ExploreBar.cpp.

00129 {
00130     CDocument* pDoc = GetDocument();
00131 }

void CExploreBar::OnUpdateCmd ( CCmdUI * pCmdUI ) [protected]

Definition at line 183 of file ExploreBar.cpp.

Referenced by OnUpdateViewCheckout(), and OnUpdateViewImport().

00184 {
00185     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00186     if(DisableCommon())
00187     {
00188         pCmdUI->Enable(FALSE);
00189         return;
00190     }
00191     CString folderPath;
00192     if(!m_TreeCtrl.GetSelectedFolderPath(folderPath) || folderPath.IsEmpty())
00193     {
00194         pCmdUI->Enable(FALSE);
00195         return;
00196     }
00197
00198     pCmdUI->Enable(TRUE);
00199 }

void CExploreBar::OnUpdateViewCheckout ( CCmdUI * pCmdUI ) [protected]

Definition at line 214 of file ExploreBar.cpp.

00215 {
00216     OnUpdateCmd(pCmdUI);
00217     pCmdUI->SetText("Chec&kout module to selection...");
00218 }

void CExploreBar::OnUpdateViewImport ( CCmdUI * pCmdUI ) [protected]

Definition at line 227 of file ExploreBar.cpp.

00228 {
00229     OnUpdateCmd(pCmdUI);
00230     pCmdUI->SetText("&Import module from selection...");
00231 }

void CExploreBar::OnViewCheckout ( ) [protected]

Definition at line 207 of file ExploreBar.cpp.

00208 {
00209     CString folderPath;
00210     if(m_TreeCtrl.GetSelectedFolderPath(folderPath) && !folderPath.IsEmpty())
00211         CvsCmdCheckoutModule(folderPath);
00212 }

void CExploreBar::OnViewImport ( ) [protected]

Definition at line 220 of file ExploreBar.cpp.

00221 {
00222     CString folderPath;
00223     if(m_TreeCtrl.GetSelectedFolderPath(folderPath) && !folderPath.IsEmpty())
00224         CvsCmdImportModule(folderPath);
00225 }

void CExploreBar::OnWindowPosChanged ( WINDOWPOS * wp ) [protected]

Definition at line 174 of file ExploreBar.cpp.

00175 {
00176     CView::OnWindowPosChanged(wp);
00177
00178     CRect r;
00179     GetClientRect(&r);
00180     m_TreeCtrl.SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER);
00181 }

Member Data Documentation

CMyShellTree CExploreBar::m_TreeCtrl

Definition at line 40 of file ExploreBar.h.

Referenced by CMainFrame::GetExplorerView().

The documentation for this class was generated from the following files:
  • WinCvs/ExploreBar.h
  • WinCvs/ExploreBar.cpp
Generated on Sun Oct 21 12:47:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


fatdef Struct Reference

#include <vmsmunch_private.h>

Collaboration diagram for fatdef:

[legend]
List of all members.

Public Attributes

fatdef:: { ... } | r_rtype_overlay
fatdef:: { ... } | r_rattrib_overlay
unsigned short int fat | w_rsize
fatdef:: { ... } | r_hiblk_overlay
fatdef:: { ... } | r_efblk_overlay
unsigned short int fat | w_ffbyte
unsigned char fat | b_bktsize
unsigned char fat | b_vfcsize
unsigned short int fat | w_maxrec
unsigned short int fat | w_defext
unsigned short int fat | w_gbc
char fat | fill [8]
unsigned short int fat | w_versions
unsigned char fat | b_rtype
unsigned fat | v_rtype: 4
unsigned fat | v_fileorg: 4
fatdef:: { ... } ::@46 | r_rtype_bits
unsigned char fat | b_rattrib
unsigned fat | v_fortrancc: 1
unsigned fat | v_impliedcc: 1
unsigned fat | v_printcc: 1
unsigned fat | v_nospan: 1
fatdef:: { ... } ::@47 | r_rattrib_bits
unsigned long int fat | l_hiblk
unsigned short int fat | w_hiblkh
unsigned short int fat | w_hiblkl
fatdef:: { ... } ::@48 | r_hiblk_fields
unsigned long int fat | l_efblk
unsigned short int fat | w_efblkh
unsigned short int fat | w_efblkl
fatdef:: { ... } ::@49 | r_efblk_fields

Member Data Documentation

unsigned char fat fatdef::b_bktsize

Definition at line 85 of file vmsmunch_private.h.

unsigned char fat fatdef::b_rattrib

Definition at line 49 of file vmsmunch_private.h.

unsigned char fat fatdef::b_rtype

Definition at line 27 of file vmsmunch_private.h.

unsigned char fat fatdef::b_vfcsize

Definition at line 86 of file vmsmunch_private.h.

char fat fatdef::fill[8]

Definition at line 90 of file vmsmunch_private.h.

unsigned long int fat fatdef::l_efblk

Definition at line 77 of file vmsmunch_private.h.

unsigned long int fat fatdef::l_hiblk

Definition at line 68 of file vmsmunch_private.h.

struct { ... } fatdef::r_efblk_fields

union { ... } fatdef::r_efblk_overlay

struct { ... } fatdef::r_hiblk_fields

union { ... } fatdef::r_hiblk_overlay

struct { ... } fatdef::r_rattrib_bits

union { ... } fatdef::r_rattrib_overlay

struct { ... } fatdef::r_rtype_bits

union { ... } fatdef::r_rtype_overlay

unsigned fat fatdef::v_fileorg

Definition at line 30 of file vmsmunch_private.h.

unsigned fat fatdef::v_fortrancc

Definition at line 51 of file vmsmunch_private.h.

unsigned fat fatdef::v_impliedcc

Definition at line 52 of file vmsmunch_private.h.

unsigned fat fatdef::v_nospan

Definition at line 54 of file vmsmunch_private.h.

unsigned fat fatdef::v_printcc

Definition at line 53 of file vmsmunch_private.h.

unsigned fat fatdef::v_rtype

Definition at line 29 of file vmsmunch_private.h.

unsigned short int fat fatdef::w_defext

Definition at line 88 of file vmsmunch_private.h.

unsigned short int fat fatdef::w_efblkh

Definition at line 80 of file vmsmunch_private.h.

unsigned short int fat fatdef::w_efblkl

Definition at line 81 of file vmsmunch_private.h.

unsigned short int fat fatdef::w_ffbyte

Definition at line 84 of file vmsmunch_private.h.

unsigned short int fat fatdef::w_gbc

Definition at line 89 of file vmsmunch_private.h.

unsigned short int fat fatdef::w_hiblkh

Definition at line 71 of file vmsmunch_private.h.

unsigned short int fat fatdef::w_hiblkl

Definition at line 72 of file vmsmunch_private.h.

unsigned short int fat fatdef::w_maxrec

Definition at line 87 of file vmsmunch_private.h.

unsigned short int fat fatdef::w_rsize

Definition at line 65 of file vmsmunch_private.h.

unsigned short int fat fatdef::w_versions

Definition at line 91 of file vmsmunch_private.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/vmsmunch_private.h
Generated on Sun Oct 21 12:47:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


fchdef Struct Reference

#include <vmsmunch_private.h>

Collaboration diagram for fchdef:

[legend]
List of all members.

Public Attributes

unsigned | __pad0__: 1
unsigned fch | v_nobackup: 1
unsigned fch | v_writeback: 1
unsigned fch | v_readcheck: 1
unsigned fch | v_writcheck: 1
unsigned fch | v_contigb: 1
unsigned fch | v_locked: 1
unsigned fch | v_contig: 1
unsigned | __pad1__: 3
unsigned fch | v_badacl: 1
unsigned fch | v_spool: 1
unsigned fch | v_directory: 1
unsigned fch | v_badblock: 1
unsigned fch | v_markdel: 1
unsigned fch | v_nocharge: 1
unsigned fch | v_erase: 1

Member Data Documentation

unsigned fchdef::__pad0__

Definition at line 133 of file vmsmunch_private.h.

unsigned fchdef::__pad1__

Definition at line 141 of file vmsmunch_private.h.

unsigned fch fchdef::v_badacl

Definition at line 142 of file vmsmunch_private.h.

unsigned fch fchdef::v_badblock

Definition at line 145 of file vmsmunch_private.h.

unsigned fch fchdef::v_contig

Definition at line 140 of file vmsmunch_private.h.

unsigned fch fchdef::v_contigb

Definition at line 138 of file vmsmunch_private.h.

unsigned fch fchdef::v_directory

Definition at line 144 of file vmsmunch_private.h.

unsigned fch fchdef::v_erase

Definition at line 148 of file vmsmunch_private.h.

unsigned fch fchdef::v_locked

Definition at line 139 of file vmsmunch_private.h.

unsigned fch fchdef::v_markdel

Definition at line 146 of file vmsmunch_private.h.

unsigned fch fchdef::v_nobackup

Definition at line 134 of file vmsmunch_private.h.

unsigned fch fchdef::v_nocharge

Definition at line 147 of file vmsmunch_private.h.

unsigned fch fchdef::v_readcheck

Definition at line 136 of file vmsmunch_private.h.

unsigned fch fchdef::v_spool

Definition at line 143 of file vmsmunch_private.h.

unsigned fch fchdef::v_writcheck

Definition at line 137 of file vmsmunch_private.h.

unsigned fch fchdef::v_writeback

Definition at line 135 of file vmsmunch_private.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/vmsmunch_private.h
Generated on Sun Oct 21 12:47:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


file_data Struct Reference

#include <diff.h>

Collaboration diagram for file_data:

[legend]
List of all members.

Public Attributes

int | desc
char const * | name
stat | stat
int | dir_p
char * | buffer
size_t | bufsize
size_t | buffered_chars
char const ** | linbuf
int | linbuf_base
int | buffered_lines
int | valid_lines
int | alloc_lines
char const * | prefix_end
int | prefix_lines
char const * | suffix_begin
int * | equivs
int * | undiscarded
int * | realindexes
int | nondiscarded_lines
char * | changed_flag
int | missing_newline
int | equiv_max

Member Data Documentation

int file_data::alloc_lines

Definition at line 233 of file diff.h.

char* file_data::buffer

Definition at line 220 of file diff.h.

size_t file_data::buffered_chars

Definition at line 224 of file diff.h.

int file_data::buffered_lines

Definition at line 233 of file diff.h.

size_t file_data::bufsize

Definition at line 222 of file diff.h.

char* file_data::changed_flag

Definition at line 264 of file diff.h.

int file_data::desc

Definition at line 214 of file diff.h.

int file_data::dir_p

Definition at line 217 of file diff.h.

int file_data::equiv_max

Definition at line 271 of file diff.h.

int* file_data::equivs

Definition at line 248 of file diff.h.

char const** file_data::linbuf

Definition at line 227 of file diff.h.

int file_data::linbuf_base

Definition at line 233 of file diff.h.

int file_data::missing_newline

Definition at line 267 of file diff.h.

char const* file_data::name

Definition at line 215 of file diff.h.

int file_data::nondiscarded_lines

Definition at line 259 of file diff.h.

char const* file_data::prefix_end

Definition at line 236 of file diff.h.

int file_data::prefix_lines

Definition at line 240 of file diff.h.

int* file_data::realindexes

Definition at line 256 of file diff.h.

struct stat file_data::stat

Definition at line 216 of file diff.h.

char const* file_data::suffix_begin

Definition at line 243 of file diff.h.

int* file_data::undiscarded

Definition at line 252 of file diff.h.

int file_data::valid_lines

Definition at line 233 of file diff.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/diff/diff.h
Generated on Sun Oct 21 12:47:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


file_info Struct Reference

#include <cvs.h>

Collaboration diagram for file_info:

[legend]
List of all members.

Public Attributes

char * | file
char * | update_dir
char * | fullname
char * | repository
List * entries
RCSNode * rcs

Member Data Documentation

List* file_info::entries

Definition at line 630 of file cvs.h.

char* file_info::file

Definition at line 611 of file cvs.h.

char* file_info::fullname

Definition at line 623 of file cvs.h.

RCSNode* file_info::rcs

Definition at line 632 of file cvs.h.

char* file_info::repository

Definition at line 627 of file cvs.h.

char* file_info::update_dir

Definition at line 618 of file cvs.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/cvs.h
Generated on Sun Oct 21 12:47:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


file_list_str Struct Reference

Collaboration diagram for file_list_str:

[legend]
List of all members.

Public Attributes

char * | l_file
char * | l_module

Member Data Documentation

char* file_list_str::l_file

Definition at line 266 of file history.c.

char* file_list_str::l_module

Definition at line 267 of file history.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/history.c
Generated on Sun Oct 21 12:47:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


FileEntry Class Reference

#include <MultiFiles.h>

Collaboration diagram for FileEntry:

[legend]
List of all members.

Public Methods

FileEntry ()
FileEntry (const char *filename, const FSSpec *macspec=0L)
FileEntry (const FileEntry &entry)
FileEntry & operator= (const FileEntry &entry)

Public Attributes

UStr file
FSSpec spec

Constructor & Destructor Documentation

FileEntry::FileEntry ( ) [inline]

Definition at line 47 of file MultiFiles.h.

00047 {}

FileEntry::FileEntry | ( | const char * | filename,
 |  | const FSSpec * | macspec = 0L
 | ) | [inline]

Definition at line 48 of file MultiFiles.h.

00049     {
00050         file = filename;
00051         if(macspec != 0L)
00052             spec = *macspec;
00053     }

FileEntry::FileEntry ( const FileEntry & entry ) [inline]

Definition at line 54 of file MultiFiles.h.

00055     {
00056         *this = entry;
00057     }

Member Function Documentation

FileEntry& FileEntry::operator= ( const FileEntry & entry ) [inline]

Definition at line 59 of file MultiFiles.h.

00060     {
00061         file = entry.file;
00062         spec = entry.spec;
00063         return *this;
00064     }

Member Data Documentation

UStr FileEntry::file

Definition at line 66 of file MultiFiles.h.

Referenced by operator=().

FSSpec FileEntry::spec

Definition at line 67 of file MultiFiles.h.

Referenced by operator=().

The documentation for this class was generated from the following file:
  • common/MultiFiles.h
Generated on Sun Oct 21 12:47:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CFillPyEntries Class Reference

Inheritance diagram for CFillPyEntries:

[legend]
Collaboration diagram for CFillPyEntries:

[legend]
List of all members.

Public Methods

CFillPyEntries (CSortList< ENTNODE > &entries)
virtual | ~CFillPyEntries ()
virtual kTraversal | EnterDirectory (const char *fullpath, const char *dirname, const FSSpec *macspec)
virtual kTraversal | ExitDirectory (const char *fullpath)
virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnIdle (const char *fullpath)
virtual kTraversal | OnDirectory (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
virtual kTraversal | OnAlias (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
virtual kTraversal | OnFile (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)

Public Attributes

CSortList< ENTNODE > & m_entries
std::vector< UStr > m_ignlist

Constructor & Destructor Documentation

CFillPyEntries::CFillPyEntries ( CSortList< ENTNODE > & entries ) [inline]

Definition at line 283 of file PythonGlue.cpp.

00283                                                  :
00284         m_entries(entries) {}

virtual CFillPyEntries::~CFillPyEntries ( ) [inline, virtual]

Definition at line 286 of file PythonGlue.cpp.

00286 {}

Member Function Documentation

virtual kTraversal CFillPyEntries::EnterDirectory | ( | const char * | fullpath,
 |  | const char * | dirname,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 288 of file PythonGlue.cpp.

00289     {
00290         Entries_Open (m_entries, fullpath);
00291         BuildIgnoredList(m_ignlist, fullpath);
00292         return kContinueTraversal;
00293     }

virtual kTraversal CFillPyEntries::ExitDirectory ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 295 of file PythonGlue.cpp.

00296     {
00297         m_ignlist.erase(m_ignlist.begin(), m_ignlist.end());
00298         return kContinueTraversal;
00299     }

virtual kTraversal CFillPyEntries::OnAlias | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 328 of file PythonGlue.cpp.

00332     {
00333         return OnFile(fullpath, fullname, name, dir, macspec);
00334     }

virtual kTraversal CFillPyEntries::OnDirectory | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 311 of file PythonGlue.cpp.

00315     {
00316 #if defined(WIN32) || defined(macintosh)
00317         if(stricmp(name, "CVS") == 0)
00318 #else
00319         if(strcmp(name, "CVS") == 0)
00320 #endif
00321             return kSkipFile;
00322
00323         /*EntnodeData *data = */Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00324
00325         return kSkipFile;
00326     }

virtual kTraversal CFillPyEntries::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 301 of file PythonGlue.cpp.

00302     {
00303         return kTraversalError;
00304     }

virtual kTraversal CFillPyEntries::OnFile | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 336 of file PythonGlue.cpp.

00340     {
00341         /*EntnodeData *data = */Entries_SetVisited(fullpath, m_entries, name, dir, false, &m_ignlist);
00342
00343         return kContinueTraversal;
00344     }

virtual kTraversal CFillPyEntries::OnIdle ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 306 of file PythonGlue.cpp.

00307     {
00308         return kContinueTraversal;
00309     }

Member Data Documentation

CSortList<ENTNODE>& CFillPyEntries::m_entries

Definition at line 280 of file PythonGlue.cpp.

std::vector< UStr > CFillPyEntries::m_ignlist

Definition at line 281 of file PythonGlue.cpp.

The documentation for this class was generated from the following file:
  • common/PythonGlue.cpp
Generated on Sun Oct 21 12:47:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CFillTclEntries Class Reference

Inheritance diagram for CFillTclEntries:

[legend]
Collaboration diagram for CFillTclEntries:

[legend]
List of all members.

Public Methods

CFillTclEntries (CSortList< ENTNODE > &entries)
virtual | ~CFillTclEntries ()
virtual kTraversal | EnterDirectory (const char *fullpath, const char *dirname, const FSSpec *macspec)
virtual kTraversal | ExitDirectory (const char *fullpath)
virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnIdle (const char *fullpath)
virtual kTraversal | OnDirectory (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
virtual kTraversal | OnAlias (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
virtual kTraversal | OnFile (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)

Public Attributes

CSortList< ENTNODE > & m_entries
std::vector< UStr > m_ignlist

Constructor & Destructor Documentation

CFillTclEntries::CFillTclEntries ( CSortList< ENTNODE > & entries ) [inline]

Definition at line 542 of file TclGlue.cpp.

00542                                                   :
00543         m_entries(entries) {}

virtual CFillTclEntries::~CFillTclEntries ( ) [inline, virtual]

Definition at line 545 of file TclGlue.cpp.

00545 {}

Member Function Documentation

virtual kTraversal CFillTclEntries::EnterDirectory | ( | const char * | fullpath,
 |  | const char * | dirname,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 547 of file TclGlue.cpp.

00548     {
00549         Entries_Open (m_entries, fullpath);
00550         BuildIgnoredList(m_ignlist, fullpath);
00551         return kContinueTraversal;
00552     }

virtual kTraversal CFillTclEntries::ExitDirectory ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 554 of file TclGlue.cpp.

00555     {
00556         m_ignlist.erase(m_ignlist.begin(), m_ignlist.end());
00557         return kContinueTraversal;
00558     }

virtual kTraversal CFillTclEntries::OnAlias | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 587 of file TclGlue.cpp.

00591     {
00592         return OnFile(fullpath, fullname, name, dir, macspec);
00593     }

virtual kTraversal CFillTclEntries::OnDirectory | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 570 of file TclGlue.cpp.

00574     {
00575 #if defined(WIN32) || defined(macintosh)
00576         if(stricmp(name, "CVS") == 0)
00577 #else
00578         if(strcmp(name, "CVS") == 0)
00579 #endif
00580             return kSkipFile;
00581
00582         /*EntnodeData *data = */Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00583
00584         return kSkipFile;
00585     }

virtual kTraversal CFillTclEntries::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 560 of file TclGlue.cpp.

00561     {
00562         return kTraversalError;
00563     }

virtual kTraversal CFillTclEntries::OnFile | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 595 of file TclGlue.cpp.

00599     {
00600         /*EntnodeData *data = */Entries_SetVisited(fullpath, m_entries, name, dir, false, &m_ignlist);
00601
00602         return kContinueTraversal;
00603     }

virtual kTraversal CFillTclEntries::OnIdle ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 565 of file TclGlue.cpp.

00566     {
00567         return kContinueTraversal;
00568     }

Member Data Documentation

CSortList<ENTNODE>& CFillTclEntries::m_entries

Definition at line 539 of file TclGlue.cpp.

std::vector< UStr > CFillTclEntries::m_ignlist

Definition at line 540 of file TclGlue.cpp.

The documentation for this class was generated from the following file:
  • common/TclGlue.cpp
Generated on Sun Oct 21 12:47:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CFindSettings Class Reference

Inheritance diagram for CFindSettings:

[legend]
Collaboration diagram for CFindSettings:

[legend]
List of all members.

Public Methods

CFindSettings (const char *findPath)
CFindSettings (std::map< UStr, UStr > &list)
virtual | ~CFindSettings ()
virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnFile (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)

Static Public Methods

bool | searchPath (const char *token, const char *value, void *data)
bool | searchAllPath (const char *token, const char *value, void *data)

Public Attributes

UStr m_pathToFind
UStr m_fullname
bool | m_foundIt
std::map< UStr, UStr > * | m_list

Constructor & Destructor Documentation

CFindSettings::CFindSettings ( const char * findPath ) [inline]

Definition at line 951 of file Persistent.cpp.

00951                                         : m_pathToFind(findPath), m_list(0L)
00952     {
00953         if(m_pathToFind.endsWith(kPathDelimiter))
00954             m_pathToFind[m_pathToFind.length() - 1] = '\0';
00955     }

CFindSettings::CFindSettings ( std::map< UStr, UStr > & list ) [inline]

Definition at line 957 of file Persistent.cpp.

00957                                              : m_list(&list)
00958     {
00959     }

virtual CFindSettings::~CFindSettings ( ) [inline, virtual]

Definition at line 961 of file Persistent.cpp.

00961 {}

Member Function Documentation

virtual kTraversal CFindSettings::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 963 of file Persistent.cpp.

00964     {
00965         cvs_err(err);
00966         cvs_err("\n");
00967         return kTraversalError;
00968     }

kTraversal CFindSettings::OnFile | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [virtual]

Reimplemented from TraversalReport.

Definition at line 1014 of file Persistent.cpp.

01018 {
01019     m_foundIt = false;
01020     if(m_list == 0L)
01021     {
01022         loadSettingsInternal(fullname, searchPath, this);
01023     }
01024     else
01025     {
01026         m_fullname = fullname;
01027         loadSettingsInternal(fullname, searchAllPath, this);
01028     }
01029     if(m_foundIt)
01030         m_fullname = fullname;
01031
01032     return m_foundIt ? kStopTraversal : kContinueTraversal;
01033 }

bool CFindSettings::searchAllPath | ( | const char * | token,
 |  | const char * | value,
 |  | void * | data
 | ) | [static]

Definition at line 1001 of file Persistent.cpp.

01002 {
01003     CFindSettings *loader = (CFindSettings *)data;
01004     if(strcmp(token, "PATH") == 0)
01005     {
01006         getSettingName(loader->m_fullname, loader->m_fullname);
01007         std::map<UStr, UStr>::value_type v(loader->m_fullname, UStr(value));
01008         loader->m_list->insert(v);
01009         return true;
01010     }
01011     return false;
01012 }

bool CFindSettings::searchPath | ( | const char * | token,
 |  | const char * | value,
 |  | void * | data
 | ) | [static]

Definition at line 984 of file Persistent.cpp.

00985 {
00986     CFindSettings *loader = (CFindSettings *)data;
00987     if(strcmp(token, "PATH") == 0 &&
00988 #if qUnix
00989         strncmp(value, loader->m_pathToFind, strlen(value)) == 0
00990 #else
00991         strnicmp(value, loader->m_pathToFind, strlen(value)) == 0
00992 #endif
00993         )
00994     {
00995         loader->m_foundIt = true;
00996         return true;
00997     }
00998     return false;
00999 }

Member Data Documentation

bool CFindSettings::m_foundIt

Definition at line 980 of file Persistent.cpp.

Referenced by searchPath().

UStr CFindSettings::m_fullname

Definition at line 979 of file Persistent.cpp.

Referenced by AskCreatePersistentSettings(), HasPersistentSettings(), LoadPersistentSettings(), SavePersistentSettings(), and searchAllPath().

std::map<UStr, UStr>* CFindSettings::m_list

Definition at line 981 of file Persistent.cpp.

Referenced by searchAllPath().

UStr CFindSettings::m_pathToFind

Definition at line 978 of file Persistent.cpp.

Referenced by searchPath().

The documentation for this class was generated from the following file:
  • common/Persistent.cpp
Generated on Sun Oct 21 12:47:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


fjndef Struct Reference

#include <vmsmunch_private.h>

Collaboration diagram for fjndef:

[legend]
List of all members.

Public Attributes

unsigned fjn | v_only_ru: 1
unsigned fjn | v_rujnl: 1
unsigned fjn | v_bijnl: 1
unsigned fjn | v_aijnl: 1
unsigned fjn | v_atjnl: 1
unsigned fjn | v_never_ru: 1
unsigned fjn | v_journal_file:1

Member Data Documentation

unsigned fjn fjndef::v_aijnl

Definition at line 172 of file vmsmunch_private.h.

unsigned fjn fjndef::v_atjnl

Definition at line 173 of file vmsmunch_private.h.

unsigned fjn fjndef::v_bijnl

Definition at line 171 of file vmsmunch_private.h.

unsigned fjn fjndef::v_journal_file

Definition at line 175 of file vmsmunch_private.h.

unsigned fjn fjndef::v_never_ru

Definition at line 174 of file vmsmunch_private.h.

unsigned fjn fjndef::v_only_ru

Definition at line 169 of file vmsmunch_private.h.

unsigned fjn fjndef::v_rujnl

Definition at line 170 of file vmsmunch_private.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/vmsmunch_private.h
Generated on Sun Oct 21 12:47:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CFormView Class Reference

Inheritance diagram for CFormView:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJHtmlView.h
Generated on Sun Oct 21 12:47:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


frame_and_entries Struct Reference

Collaboration diagram for frame_and_entries:

[legend]
List of all members.

Public Attributes

recursion_frame * frame
List * entries

Member Data Documentation

List* frame_and_entries::entries

Definition at line 58 of file recurse.c.

struct recursion_frame* frame_and_entries::frame

Definition at line 57 of file recurse.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/recurse.c
Generated on Sun Oct 21 12:47:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


frame_and_file Struct Reference

Collaboration diagram for frame_and_file:

[legend]
List of all members.

Public Attributes

recursion_frame * frame
file_info * finfo

Member Data Documentation

struct file_info* frame_and_file::finfo

Definition at line 51 of file recurse.c.

struct recursion_frame* frame_and_file::frame

Definition at line 50 of file recurse.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/recurse.c
Generated on Sun Oct 21 12:47:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CFrameWnd Class Reference

Inheritance diagram for CFrameWnd:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJFrameWnd.h
Generated on Sun Oct 21 12:47:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


garbyRec Struct Reference

Collaboration diagram for garbyRec:

[legend]
List of all members.

Public Attributes

poolRec pools [20]

Member Data Documentation

poolRec garbyRec::pools[ 20 ]

Definition at line 299 of file dll_garbage.c.

The documentation for this struct was generated from the following file:
  • common/dll_garbage.c
Generated on Sun Oct 21 12:47:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CGfxGroupEdit Class Reference

#include <GfxGroupEdit.h>

Inheritance diagram for CGfxGroupEdit:

[legend]
Collaboration diagram for CGfxGroupEdit:

[legend]
List of all members.

Public Methods

CGfxGroupEdit ()
virtual BOOL | PreTranslateMessage (MSG *pMsg)
virtual | ~CGfxGroupEdit ()

Public Attributes

BOOL | bEscapeKey
CString | text
WPARAM | msgSend
bool | bNoDown
int | iIndex

Protected Methods

virtual void | PostNcDestroy ()
afx_msg void | OnKillFocus (CWnd *pNewWnd)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)

Constructor & Destructor Documentation

CGfxGroupEdit::CGfxGroupEdit ( )

Definition at line 38 of file GfxGroupEdit.cpp.

00039 {
00040     bEscapeKey = FALSE;
00041     iIndex = -1;
00042     msgSend = NM_OB_ONGROUPENDEDIT;
00043     bNoDown = false;
00044 }

CGfxGroupEdit::~CGfxGroupEdit ( ) [virtual]

Definition at line 46 of file GfxGroupEdit.cpp.

00047 {
00048 }

Member Function Documentation

void CGfxGroupEdit::OnChar | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags
 | ) | [protected]

Definition at line 103 of file GfxGroupEdit.cpp.

00104 {
00105     if (msgSend == NM_OB_ONGROUPENDEDIT)
00106     {
00107         CEdit::OnChar(nChar, nRepCnt, nFlags);
00108         return;
00109     }
00110
00111     if (nChar == VK_ESCAPE || nChar == VK_RETURN)
00112     {
00113         if (nChar == VK_ESCAPE) bEscapeKey = TRUE;
00114         GetParent()->SetFocus();
00115         return;
00116     }
00117     CEdit::OnChar(nChar, nRepCnt, nFlags);
00118     CString str;
00119     CRect rect, parentrect;
00120     GetClientRect(&rect);
00121     GetParent()->GetClientRect(&parentrect);
00122     ClientToScreen(&rect);
00123     GetParent()->ScreenToClient(&rect);
00124     GetWindowText(str);
00125     CWindowDC dc(this);
00126     CFont *pFont = GetParent()->GetFont();
00127     CFont *pFontDC = dc.SelectObject(pFont);
00128     CRect szrc(rect);
00129     szrc.bottom = szrc.top;
00130
00131     if (bNoDown == true)
00132     {
00133         dc.DrawText(str, szrc, DT_CALCRECT);
00134         if (szrc.right >= parentrect.right - 1) rect.right = parentrect.right - 1;
00135         else rect.right = szrc.right;
00136         MoveWindow(&rect);
00137         return;
00138     }
00139
00140     dc.DrawText(str, szrc, DT_WORDBREAK|DT_CENTER|DT_CALCRECT);
00141     dc.SelectObject(pFontDC);
00142     CSize size = szrc.Size();
00143
00144     if (size.cx > rect.Width())
00145     {
00146         if (size.cx + rect.left < parentrect.right) rect.right = rect.left + size.cx;
00147         else rect.right = parentrect.right;
00148         MoveWindow(&rect);
00149     }
00150     else if (size.cy > rect.Height())
00151     {
00152         if (size.cy + rect.bottom < parentrect.bottom) rect.bottom = rect.top + size.cy;
00153         else rect.bottom = parentrect.bottom;
00154         MoveWindow(&rect);
00155     }
00156 }

int CGfxGroupEdit::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 94 of file GfxGroupEdit.cpp.

00095 {
00096     if (CEdit::OnCreate(lpCreateStruct) == -1)
00097         return -1;
00098
00099     SendMessage(WM_SETFONT,(WPARAM) GetStockObject(DEFAULT_GUI_FONT),MAKELPARAM(TRUE,0));
00100     return 0;
00101 }

void CGfxGroupEdit::OnKillFocus ( CWnd * pNewWnd ) [protected]

Definition at line 62 of file GfxGroupEdit.cpp.

00063 {
00064     PostMessage(WM_CLOSE, 0, 0);
00065     if (!bEscapeKey)
00066     {
00067         GetWindowText(text);
00068         if (text != "") GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, msgSend, (LPARAM) this);
00069     }
00070 }

void CGfxGroupEdit::PostNcDestroy ( ) [protected, virtual]

Definition at line 88 of file GfxGroupEdit.cpp.

00089 {
00090     CEdit::PostNcDestroy();
00091     delete this;
00092 }

BOOL CGfxGroupEdit::PreTranslateMessage ( MSG * pMsg ) [virtual]

Definition at line 72 of file GfxGroupEdit.cpp.

00073 {
00074     if (pMsg->wParam == VK_RETURN)
00075     {
00076         PostMessage(WM_CLOSE, 0, 0);
00077         return TRUE;
00078     }
00079     else if (pMsg->wParam == VK_ESCAPE)
00080     {
00081         PostMessage(WM_CLOSE, 0, 0);
00082         return bEscapeKey = TRUE;
00083     }
00084
00085     return CEdit::PreTranslateMessage(pMsg);
00086 }

Member Data Documentation

BOOL CGfxGroupEdit::bEscapeKey

Definition at line 43 of file GfxGroupEdit.h.

bool CGfxGroupEdit::bNoDown

Definition at line 46 of file GfxGroupEdit.h.

Referenced by CGfxOutBarCtrl::StartItemEdit().

int CGfxGroupEdit::iIndex

Definition at line 62 of file GfxGroupEdit.h.

Referenced by CGfxOutBarCtrl::OnEndLabelEdit(), CGfxOutBarCtrl::StartGroupEdit(), and CGfxOutBarCtrl::StartItemEdit().

WPARAM CGfxGroupEdit::msgSend

Definition at line 45 of file GfxGroupEdit.h.

Referenced by CGfxOutBarCtrl::StartGroupEdit(), and CGfxOutBarCtrl::StartItemEdit().

CString CGfxGroupEdit::text

Definition at line 44 of file GfxGroupEdit.h.

Referenced by CGfxOutBarCtrl::OnEndLabelEdit().

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/GfxGroupEdit.h
  • WinCvs/CJLib/CJLibrary/GfxGroupEdit.cpp
Generated on Sun Oct 21 12:47:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CGfxOutBarCtrl Class Reference

#include <GfxOutBarCtrl.h>

Inheritance diagram for CGfxOutBarCtrl:

[legend]
Collaboration diagram for CGfxOutBarCtrl:

[legend]
List of all members.

Public Types

enum {
fSmallIcon = 1 << 0, fLargeIcon = 1 << 1, fEditGroups = 1 << 2, fEditItems = 1 << 3,
fRemoveGroups = 1 << 4, fRemoveItems = 1 << 5, fAddGroups = 1 << 6, fDragItems = 1 << 7,
fAnimation = 1 << 8, fSelHighlight = 1 << 9
}
enum | { ircIcon = 1, ircLabel = 2, ircAll = 3 }
enum {
htNothing = -1, htFolder, htItem, htUpScroll,
htDownScroll
}

Public Methods

CGfxOutBarCtrl ()
virtual void | DrawAnimItem (const int xoffset, const int yoffset, const int index)
virtual void | SetAnimSelHighlight (const int iTime)
virtual DWORD | GetFolderData (int iFolder=-1)
virtual CWnd * | GetFolderChild (int iFolder=-1)
virtual int | AddFolderBar (LPCTSTR pFolder, CWnd *pSon, const DWORD exData=0)
virtual CString | GetItemText (const int index)
virtual void | SetAnimationTickCount (const long value)
virtual long | GetAnimationTickCount ()
virtual void | AnimateFolderScroll (const int iFrom, const int iTo)
virtual int | GetDragItemRect (const int index, CRect &rect)
virtual void | DrawDragArrow (CDC *pDC, const int iFrom, const int iTo)
virtual void | SetItemImage (const int index, const int iImage)
virtual void | SetItemData (const int index, const DWORD dwData)
virtual int | GetItemImage (const int index) const
virtual DWORD | GetItemData (const int index) const
virtual bool | IsValidItem (const int index) const
virtual void | RemoveItem (const int index)
virtual void | SetItemText (const int index, LPCTSTR text)
virtual void | StartItemEdit (const int index)
virtual void | SetFolderText (const int index, LPCTSTR text)
virtual void | StartGroupEdit (const int index)
virtual void | GetLabelRect (const int iFolder, const int iIndex, CRect &rect)
virtual void | GetIconRect (const int iFolder, const int iIndex, CRect &rect)
virtual void | HighlightItem (const int index, const bool bPressed=false)
virtual void | GetVisibleRange (const int iFolder, int &first, int &last)
virtual void | DrawItem (CDC *pDC, const int iFolder, CRect rc, const int index, const bool bOnlyImage=false)
virtual CImageList * | GetFolderImageList (const int index, const bool bSmall) const
virtual CSize | GetItemSize (const int iFolder, const int index, const int type)
virtual void | PaintItems (CDC *pDC, const int iFolder, CRect rc)
virtual CImageList * | GetImageList (CImageList *pImageList, int nImageList)
virtual CImageList * | SetFolderImageList (const int folder, CImageList *pImageList, int nImageList)
virtual CImageList * | SetImageList (CImageList *pImageList, int nImageList)
virtual int | GetCountPerPage () const
virtual void | RemoveFolder (const int index)
virtual int | GetSelFolder () const
virtual int | GetFolderCount () const
virtual void | SetSelFolder (const int index)
virtual int | GetItemCount () const
virtual int | InsertItem (const int folder, const int index, LPCTSTR text, const int image=-1, const DWORD exData=0)
virtual void | HighlightFolder (const int index)
virtual int | HitTestEx (const CPoint &point, int &index)
virtual void | GetInsideRect (CRect &rect) const
virtual int | AddFolder (LPCTSTR cFolderName, const DWORD exData)
virtual void | GetItemRect (const int iFolder, const int iIndex, CRect &rect)
virtual bool | GetFolderRect (const int iIndex, CRect &rect) const
virtual void | ModifyFlag (const DWORD &dwRemove, const DWORD &dwAdd, const UINT redraw=0)
virtual DWORD | GetFlag () const
virtual void | SetSmallIconView (const bool bSet)
virtual bool | IsSmallIconView () const
virtual BOOL | Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, const DWORD dwFlag=fDragItems|fEditGroups|fEditItems|fRemoveGroups|fRemoveItems|fAddGroups|fAnimation|fSelHighlight)
virtual | ~CGfxOutBarCtrl ()

Public Attributes

COLORREF | crBackGroundColor
COLORREF | crBackGroundColor1
COLORREF | crTextColor
COLORREF | cr3dFace
COLORREF | crLightBorder
COLORREF | crHilightBorder
COLORREF | crShadowBorder
COLORREF | crDkShadowBorder
int | iFolderHeight
int | xSmallIconLabelOffset
int | yLargeIconLabelOffset
int | ySmallIconSpacing
int | yLargeIconSpacing
int | xLeftMargin
int | yTopMargin
bool | bUpArrow
bool | bDownArrow
bool | bUpPressed
bool | bDownPressed
CRect | rcUpArrow
CRect | rcDownArrow
bool | bLooping
int | iHitInternal1
int | iHitInternal2
long | lAnimationTickCount
int | iLastSel
int | iSelAnimTiming
int | iSelAnimCount
DWORD | dwFlags
CPtrArray | arFolder
int | iLastFolderHighlighted
int | iLastSelectedFolder
int | iFirstItem
int | iLastItemHighlighted
bool | bPressedHighlight
int | iLastDragItemDraw
int | iLastDragItemDrawType
int | iSelFolder
CImageList * | pLargeImageList
CImageList * | pSmallImageList
HCURSOR | hHandCursor
HCURSOR | hDragCursor
HCURSOR | hNoDragCursor
CPen * | pBlackPen
CCJMenu m_popupMenu
CString | m_strRemoveItem
CString | m_strRenameItem

Protected Methods

void | DrawFolder (CDC *pDC, const int iIdx, CRect rect, const bool bSelected)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnTimer (UINT nIDEvent)
afx_msg void | OnPaint ()
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg BOOL | OnSetCursor (CWnd *pWnd, UINT nHitTest, UINT message)
afx_msg void | OnSize (UINT nType, int cx, int cy)
afx_msg void | OnRButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnGfxLargeicon ()
afx_msg void | OnUpdateGfxLargeicon (CCmdUI *pCmdUI)
afx_msg void | OnGfxSmallicon ()
afx_msg void | OnUpdateGfxSmallicon (CCmdUI *pCmdUI)
afx_msg void | OnGfxRemoveitem ()
afx_msg void | OnUpdateGfxRemoveitem (CCmdUI *pCmdUI)
afx_msg void | OnGfxRenameitem ()
afx_msg void | OnUpdateGfxRenameitem (CCmdUI *pCmdUI)
afx_msg void | OnSysColorChange ()
afx_msg long | OnEndLabelEdit (WPARAM wParam, LPARAM lParam)

Member Enumeration Documentation

anonymous enum

Enumeration values:
fSmallIcon
fLargeIcon
fEditGroups
fEditItems
fRemoveGroups
fRemoveItems
fAddGroups
fDragItems
fAnimation
fSelHighlight

Definition at line 66 of file GfxOutBarCtrl.h.

00066          {  fSmallIcon = 1 << 0, fLargeIcon = 1 << 1, fEditGroups = 1 << 2, fEditItems = 1 << 3,
00067             fRemoveGroups = 1 << 4, fRemoveItems = 1 << 5, fAddGroups = 1 << 6,
00068             fDragItems = 1 << 7, fAnimation = 1 << 8, fSelHighlight = 1 << 9 };

anonymous enum

Enumeration values:
ircIcon
ircLabel
ircAll

Definition at line 70 of file GfxOutBarCtrl.h.

00070 { ircIcon = 1, ircLabel = 2, ircAll = 3 };

anonymous enum

Enumeration values:
htNothing
htFolder
htItem
htUpScroll
htDownScroll

Definition at line 150 of file GfxOutBarCtrl.h.

00150 { htNothing = -1, htFolder, htItem, htUpScroll, htDownScroll};

Constructor & Destructor Documentation

CGfxOutBarCtrl::CGfxOutBarCtrl ( )

Definition at line 53 of file GfxOutBarCtrl.cpp.

00054 {
00055     crBackGroundColor   = ::GetSysColor(COLOR_3DSHADOW);//RGB(0,128,128);//
00056     crBackGroundColor1  = ::GetSysColor(COLOR_3DSHADOW);
00057     crTextColor         = ::GetSysColor(COLOR_WINDOW);
00058     cr3dFace            = ::GetSysColor(COLOR_3DFACE);
00059     crLightBorder       = ::GetSysColor(COLOR_3DLIGHT);
00060     crHilightBorder     = ::GetSysColor(COLOR_3DHILIGHT);
00061     crShadowBorder      = ::GetSysColor(COLOR_3DSHADOW);
00062     crDkShadowBorder    = ::GetSysColor(COLOR_3DDKSHADOW);
00063
00064     pBlackPen = new CPen(PS_SOLID, 1, RGB(0,0,0));
00065
00066     iFolderHeight = 22;
00067
00068     dwFlags = fDragItems|fEditGroups|fEditItems|fRemoveGroups|fRemoveItems|fAddGroups|fAnimation|fSelHighlight;
00069
00070     iSelFolder = 0;
00071
00072     iLastFolderHighlighted = -1;
00073     iLastSelectedFolder = -1;
00074
00075     pLargeImageList = NULL;
00076     pSmallImageList = NULL;
00077
00078     iFirstItem = 0;
00079
00080     xSmallIconLabelOffset = 4;
00081     yLargeIconLabelOffset = 3;
00082
00083     ySmallIconSpacing = 10;
00084     yLargeIconSpacing = 8;
00085
00086     xLeftMargin = 5;
00087     yTopMargin = 5;
00088
00089     bUpArrow = bDownArrow = false;
00090
00091     hHandCursor = AfxGetApp()->LoadCursor(IDC_HANDCUR);
00092     rcUpArrow = rcDownArrow = CRect(0,0,0,0);
00093
00094     bUpPressed = bDownPressed = false;
00095
00096     bLooping = false;
00097
00098     iLastItemHighlighted = -1;
00099     bPressedHighlight = false;
00100
00101     iLastDragItemDraw = -1;
00102
00103     lAnimationTickCount = 10;
00104
00105     hDragCursor = AfxGetApp()->LoadCursor(IDC_DRAGGING);
00106     hNoDragCursor = AfxGetApp()->LoadCursor(IDC_NODRAGGING);
00107
00108     iLastSel = -1;
00109     iSelAnimCount = 0;
00110
00111     iSelAnimTiming = 0;
00112
00113     m_strRemoveItem.LoadString(IDS_REMOVEITEM);
00114     m_strRenameItem.LoadString(IDS_RENAMEITEM);
00115 }

CGfxOutBarCtrl::~CGfxOutBarCtrl ( ) [virtual]

Definition at line 117 of file GfxOutBarCtrl.cpp.

00118 {
00119     for (int t = 0; t < arFolder.GetSize(); t++)
00120     {
00121         if (arFolder.GetAt(t)) delete (CBarFolder*) arFolder.GetAt(t);
00122     }
00123
00124     arFolder.RemoveAll();
00125
00126     delete pBlackPen;
00127 }

Member Function Documentation

int CGfxOutBarCtrl::AddFolder | ( | LPCTSTR | cFolderName,
 |  | const DWORD | exData
 | ) | [virtual]

Definition at line 590 of file GfxOutBarCtrl.cpp.

00591 {
00592     CBarFolder* pbf = new CBarFolder(cFolderName, exData);
00593
00594     ASSERT(pbf);
00595
00596     arFolder.Add((void *)pbf);
00597
00598     return arFolder.GetSize() - 1;
00599 }

int CGfxOutBarCtrl::AddFolderBar | ( | LPCTSTR | pFolder,
 |  | CWnd * | pSon,
 |  | const DWORD | exData = 0
 | ) | [virtual]

Definition at line 2307 of file GfxOutBarCtrl.cpp.

02308 {
02309     CBarFolder* pbf = new CBarFolder( pFolder, exData );
02310
02311     ASSERT( pbf );
02312
02313     pbf->pChild = pSon;
02314
02315     arFolder.Add((void*) pbf);
02316
02317     return arFolder.GetSize() - 1;
02318 }

void CGfxOutBarCtrl::AnimateFolderScroll | ( | const int | iFrom,
 |  | const int | iTo
 | ) | [virtual]

Definition at line 2166 of file GfxOutBarCtrl.cpp.

Referenced by SetSelFolder().

02167 {
02168     ASSERT(iFrom >= 0 && iFrom < GetFolderCount());
02169     ASSERT(iTo >= 0 && iTo < GetFolderCount());
02170
02171     CRect rc, rc1, frc, frc1;
02172     GetInsideRect(rc);
02173     rc1.SetRect(0,0,rc.Width(),rc.Height());
02174     GetFolderRect(iTo, frc);
02175     frc1 = frc;
02176
02177     CClientDC dc(this);
02178     CDC memDC;
02179     memDC.CreateCompatibleDC(&dc);
02180     CBitmap bmpFrom, bmpTo;
02181     bmpFrom.CreateCompatibleBitmap(&dc, rc1.Width(), rc1.Height() + frc.Height() * 2);
02182     bmpTo.CreateCompatibleBitmap(&dc, rc1.Width(), rc1.Height() + frc.Height() * 2);
02183     CDC * pDC = &memDC;
02184
02185     CWnd * pWnd1 = GetFolderChild(iFrom);
02186     CWnd * pWnd2 = GetFolderChild(iTo);
02187
02188     CBitmap * obmp = pDC->SelectObject(&bmpFrom);
02189     if (iTo > iFrom)
02190     {
02191         rc1.bottom += frc.Height() * 2;
02192         pDC->FillSolidRect(rc1, crBackGroundColor);
02193         if (pWnd1)
02194         {
02195             BOOL bPrev = pWnd1->ShowWindow(SW_SHOW);
02196             pWnd1->SendMessage(WM_ERASEBKGND, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02197             pWnd1->SendMessage(WM_PAINT, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02198             if (!bPrev) pWnd1->ShowWindow(SW_HIDE);
02199         }
02200         else PaintItems(pDC, iFrom, rc1);
02201
02202         pDC->SelectObject(&bmpTo);
02203         frc.SetRect(0,0,frc.Width(),frc.Height());
02204         rc1.SetRect(0,frc.Height(),rc.Width(), rc.Height()+frc.Height() * 2);
02205         pDC->FillSolidRect(rc1, crBackGroundColor);
02206
02207         if (pWnd2)
02208         {
02209             CPoint ovpt = pDC->SetViewportOrg(0, frc.Height());
02210             BOOL bPrev = pWnd2->ShowWindow(SW_SHOW);
02211             pWnd2->SendMessage(WM_ERASEBKGND, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02212             pWnd2->SendMessage(WM_PAINT, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02213             if (!bPrev) pWnd2->ShowWindow(SW_HIDE);
02214             pDC->SetViewportOrg(ovpt);
02215         }
02216         else PaintItems(pDC, iTo, rc1);
02217         DrawFolder(pDC, iTo, frc, false);
02218     }
02219     else
02220     {
02221         frc.SetRect(0,0,frc.Width(),frc.Height());
02222         rc1.top += frc.Height();
02223         rc1.bottom += frc.Height() * 2;
02224         pDC->FillSolidRect(rc1, crBackGroundColor);
02225         if (pWnd1)
02226         {
02227             CPoint ovpt = pDC->SetViewportOrg(0, frc.Height());
02228             BOOL bPrev = pWnd1->ShowWindow(SW_SHOW);
02229             pWnd1->SendMessage(WM_ERASEBKGND, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02230             pWnd1->SendMessage(WM_PAINT, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02231             if (!bPrev) pWnd1->ShowWindow(SW_HIDE);
02232             pDC->SetViewportOrg(ovpt);
02233         }
02234         else PaintItems(pDC, iFrom, rc1);
02235
02236         DrawFolder(pDC, iFrom, frc, false);
02237
02238         pDC->SelectObject(&bmpTo);
02239         rc1.SetRect(0,0,rc.Width(), rc.Height() + frc.Height() * 2);
02240         pDC->FillSolidRect(rc1, crBackGroundColor);
02241
02242         if (pWnd2)
02243         {
02244             BOOL bPrev = pWnd2->ShowWindow(SW_SHOW);
02245             pWnd2->SendMessage(WM_ERASEBKGND, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02246             pWnd2->SendMessage(WM_PAINT, (WPARAM) pDC->GetSafeHdc(), (LPARAM) 0);
02247             if (!bPrev) pWnd2->ShowWindow(SW_HIDE);
02248         }
02249         else PaintItems(pDC, iTo, rc1);
02250     }
02251
02252     if (iTo > iFrom)
02253     {
02254         CRect rcFrom, rcTo;
02255         GetFolderRect(iFrom, rcFrom);
02256         GetFolderRect(iTo, rcTo);
02257         int fh = rcFrom.Height();
02258         for (int y = rcTo.top - fh; y > rcFrom.bottom; y -= fh)
02259         {
02260             pDC->SelectObject(&bmpFrom);
02261             dc.BitBlt(rc.left, rcFrom.bottom + 1, rc.Width(), y - rcFrom.bottom - 1, pDC, 0,fh, SRCCOPY);
02262             pDC->SelectObject(&bmpTo);
02263             dc.BitBlt(rc.left, y, rc.Width(), rc.bottom - y + fh, pDC, 0,0, SRCCOPY);
02264             Sleep(lAnimationTickCount);
02265         }
02266     }
02267     else
02268     {
02269         CRect rcFrom, rcTo;
02270         GetFolderRect(iFrom, rcFrom);
02271         int fh = rcFrom.Height();
02272         rcTo.SetRect(rc.left, rc.bottom, rc.right, rc.bottom - fh);
02273         for (int y = rcFrom.top + 1; y < rcTo.top - fh; y += fh)
02274         {
02275             pDC->SelectObject(&bmpTo);
02276             dc.BitBlt(rc.left, rcFrom.top, rc.Width(), y - rcFrom.top - 1, pDC, 0, fh*2, SRCCOPY);
02277             pDC->SelectObject(&bmpFrom);
02278             dc.BitBlt(rc.left, y, rc.Width(), rc.bottom - y, pDC, 0,0, SRCCOPY);
02279             Sleep(lAnimationTickCount);
02280         }
02281     }
02282
02283     pDC->SelectObject(obmp);
02284     // fix potential resource leak - KStowell - 10-21-99
02285     memDC.DeleteDC();
02286     bmpFrom.DeleteObject();
02287     bmpTo.DeleteObject();
02288 }

BOOL CGfxOutBarCtrl::Create | ( | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | const DWORD | dwFlag = fDragItems|fEditGroups|fEditItems|fRemoveGroups|fRemoveItems|fAddGroups|fAnimation|fSelHighlight
 | ) | [virtual]

Definition at line 233 of file GfxOutBarCtrl.cpp.

00234 {
00235     dwFlags = dwFlag;
00236     return CWnd::CreateEx(WS_EX_STATICEDGE, NULL, NULL, dwStyle|WS_CHILD, rect, pParentWnd, nID);
00237     //GFXOUTBARCTRL_CLASSNAME
00238 }

void CGfxOutBarCtrl::DrawAnimItem | ( | const int | xoffset,
 |  | const int | yoffset,
 |  | const int | index
 | ) | [virtual]

Definition at line 331 of file GfxOutBarCtrl.cpp.

Referenced by OnLButtonDown(), and OnTimer().

00332 {
00333     CImageList * ima = GetFolderImageList(iSelFolder, IsSmallIconView());
00334
00335     CRect rc, irc;
00336     GetInsideRect(irc);
00337     GetItemRect(iSelFolder, iLastSel, rc);
00338
00339     if (iLastSel >= iFirstItem && irc.bottom > rc.bottom && irc.top < rc.top)
00340     {
00341         ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
00342         CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
00343
00344         ASSERT(index >= 0 && index < pbf->GetItemCount());
00345         CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
00346
00347         ASSERT(pi && ima);
00348
00349         CClientDC dc(this);
00350
00351         if (IsSmallIconView())
00352         {
00353             if (ima)
00354             {
00355                 IMAGEINFO ii;
00356                 ima->GetImageInfo(pi->iImageIndex, &ii);
00357                 CSize szImage = CRect(ii.rcImage).Size();
00358                 CPoint pt;
00359                 pt.x = rc.left + 2;
00360                 pt.y = rc.top + (rc.Height() - szImage.cy) / 2;
00361
00362                 CRect rcBck(pt.x-1, pt.y-1, pt.x + szImage.cx+2, pt.y + szImage.cy+2);
00363                 dc.FillSolidRect(rcBck, crBackGroundColor);
00364
00365                 pt.x += xoffset;
00366                 pt.y += yoffset;
00367
00368                 ima->Draw(&dc, pi->iImageIndex, pt, ILD_NORMAL);
00369
00370             }
00371         }
00372         else
00373         {
00374             if (ima)
00375             {
00376                 IMAGEINFO ii;
00377                 ima->GetImageInfo(pi->iImageIndex, &ii);
00378                 CSize szImage = CRect(ii.rcImage).Size();
00379                 CPoint pt;
00380                 pt.x = rc.left + (rc.Width() - szImage.cx) / 2;
00381                 pt.y = rc.top;
00382
00383                 CRect rcBck(pt.x-1, pt.y-1, pt.x + szImage.cx+2, pt.y + szImage.cy+2);
00384                 dc.FillSolidRect(rcBck, crBackGroundColor);
00385
00386                 pt.x += xoffset;
00387                 pt.y += yoffset;
00388
00389                 ima->Draw(&dc, pi->iImageIndex, pt, ILD_NORMAL);
00390             }
00391         }
00392     }
00393 }

void CGfxOutBarCtrl::DrawDragArrow | ( | CDC * | pDC,
 |  | const int | iFrom,
 |  | const int | iTo
 | ) | [virtual]

Definition at line 2058 of file GfxOutBarCtrl.cpp.

Referenced by OnLButtonDown().

02059 {
02060     if (iTo == iLastDragItemDraw) return;
02061     CRect rc1;
02062     if (iLastDragItemDraw >= 0)
02063     {
02064         GetDragItemRect(iLastDragItemDraw, rc1);
02065         if (iLastDragItemDrawType == 0) rc1.bottom = rc1.top + 5;
02066         else if (iLastDragItemDrawType == 1) { rc1.top -= 4; rc1.bottom = rc1.top + 9; }
02067         else if (iLastDragItemDrawType == 2) { rc1.top -= 4; rc1.bottom = rc1.top + 5; }
02068         InvalidateRect(rc1, true);
02069         UpdateWindow();
02070     }
02071     iLastDragItemDraw = iTo;
02072
02073     if (iLastDragItemDraw >= 0)
02074     {
02075         iLastDragItemDrawType = GetDragItemRect(iLastDragItemDraw, rc1);
02076
02077         CPen * op = pDC->SelectObject(pBlackPen);
02078
02079         pDC->MoveTo(rc1.left, rc1.top);
02080         pDC->LineTo(rc1.right, rc1.top);
02081
02082         if (iLastDragItemDrawType != 2)
02083         {
02084             pDC->MoveTo(rc1.left, rc1.top+1);
02085             pDC->LineTo(rc1.left + 7, rc1.top+1);
02086             pDC->MoveTo(rc1.left, rc1.top+2);
02087             pDC->LineTo(rc1.left + 5, rc1.top+2);
02088             pDC->MoveTo(rc1.left, rc1.top+3);
02089             pDC->LineTo(rc1.left + 3, rc1.top+3);
02090             pDC->MoveTo(rc1.left, rc1.top+4);
02091             pDC->LineTo(rc1.left + 1, rc1.top+4);
02092
02093             pDC->MoveTo(rc1.right-1, rc1.top+1);
02094             pDC->LineTo(rc1.right - 7, rc1.top+1);
02095             pDC->MoveTo(rc1.right-1, rc1.top+2);
02096             pDC->LineTo(rc1.right - 5, rc1.top+2);
02097             pDC->MoveTo(rc1.right-1, rc1.top+3);
02098             pDC->LineTo(rc1.right - 3, rc1.top+3);
02099         }
02100         if (iLastDragItemDrawType != 0)
02101         {
02102             pDC->MoveTo(rc1.left, rc1.top-1);
02103             pDC->LineTo(rc1.left + 7, rc1.top-1);
02104             pDC->MoveTo(rc1.left, rc1.top-2);
02105             pDC->LineTo(rc1.left + 5, rc1.top-2);
02106             pDC->MoveTo(rc1.left, rc1.top-3);
02107             pDC->LineTo(rc1.left + 3, rc1.top-3);
02108             pDC->MoveTo(rc1.left, rc1.top-4);
02109             pDC->LineTo(rc1.left + 1, rc1.top-4);
02110
02111             pDC->MoveTo(rc1.right-1, rc1.top-1);
02112             pDC->LineTo(rc1.right - 7, rc1.top-1);
02113             pDC->MoveTo(rc1.right-1, rc1.top-2);
02114             pDC->LineTo(rc1.right - 5, rc1.top-2);
02115             pDC->MoveTo(rc1.right-1, rc1.top-3);
02116             pDC->LineTo(rc1.right - 3, rc1.top-3);
02117             pDC->MoveTo(rc1.right-1, rc1.top-4);
02118             pDC->LineTo(rc1.right - 1, rc1.top-4);
02119         }
02120
02121         pDC->SelectObject(op);
02122     }
02123 }

void CGfxOutBarCtrl::DrawFolder | ( | CDC * | pDC,
 |  | const int | iIdx,
 |  | CRect | rect,
 |  | const bool | bSelected
 | ) | [protected]

Definition at line 536 of file GfxOutBarCtrl.cpp.

Referenced by AnimateFolderScroll(), OnLButtonDown(), and OnPaint().

00537 {
00538     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iIdx);
00539
00540     if (!bSelected)
00541     {
00542         CPen pn1(PS_SOLID, 1, crBackGroundColor1);
00543         CPen * op = pDC->SelectObject(&pn1);
00544         pDC->MoveTo(rect.left, rect.top);
00545         pDC->LineTo(rect.right, rect.top);
00546         pDC->SelectObject(op);
00547
00548         // fix potential resource leak - KStowell - 10-21-99
00549         pn1.DeleteObject();
00550
00551         rect.top ++;
00552
00553         pDC->Draw3dRect(rect, crHilightBorder, crBackGroundColor1);
00554         rect.InflateRect(-1,-1);
00555         pDC->FillSolidRect(rect, cr3dFace);
00556         int obk = pDC->SetBkMode(TRANSPARENT);
00557         CFont * of = pDC->SelectObject(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
00558         pDC->DrawText(CString(pbf->cName), rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
00559         pDC->SetBkMode(obk);
00560         pDC->SelectObject(of);
00561     }
00562     else
00563     {
00564         CPen pn1(PS_SOLID, 1, crBackGroundColor1);
00565         CPen * op = pDC->SelectObject(&pn1);
00566         pDC->MoveTo(rect.left+1, rect.top);
00567         pDC->LineTo(rect.right, rect.top);
00568         pDC->SelectObject(op);
00569
00570         // fix potential resource leak - KStowell - 10-21-99
00571         pn1.DeleteObject();
00572
00573         rect.top ++;
00574
00575         pDC->Draw3dRect(rect, crDkShadowBorder, crHilightBorder);
00576         rect.InflateRect(-1,-1);
00577         pDC->Draw3dRect(rect, crBackGroundColor1, cr3dFace);
00578         rect.InflateRect(-1,-1);
00579
00580         pDC->FillSolidRect(rect, cr3dFace);
00581
00582         int obk = pDC->SetBkMode(TRANSPARENT);
00583         CFont * of = pDC->SelectObject(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
00584         pDC->DrawText(CString(pbf->cName), rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
00585         pDC->SetBkMode(obk);
00586         pDC->SelectObject(of);
00587     }
00588 }

void CGfxOutBarCtrl::DrawItem | ( | CDC * | pDC,
 |  | const int | iFolder,
 |  | CRect | rc,
 |  | const int | index,
 |  | const bool | bOnlyImage = false
 | ) | [virtual]

Definition at line 1569 of file GfxOutBarCtrl.cpp.

Referenced by PaintItems().

01570 {
01571     CImageList * ima = GetFolderImageList(iFolder, IsSmallIconView());
01572
01573     ASSERT(iFolder >= 0 && iFolder < GetFolderCount());
01574     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
01575
01576     ASSERT(index >= 0 && index < pbf->GetItemCount());
01577     CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
01578
01579     ASSERT(pi && ima);
01580
01581     CFont * oft = (CFont *) pDC->SelectObject(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
01582     COLORREF ocr = pDC->SetTextColor(crTextColor);
01583     int obk = pDC->SetBkMode(TRANSPARENT);
01584
01585     if (IsSmallIconView())
01586     {
01587         if (ima)
01588         {
01589             IMAGEINFO ii;
01590             ima->GetImageInfo(pi->iImageIndex, &ii);
01591             CSize szImage = CRect(ii.rcImage).Size();
01592             CPoint pt;
01593             pt.x = rc.left + 2;
01594             pt.y = rc.top + (rc.Height() - szImage.cy) / 2;
01595             ima->Draw(pDC, pi->iImageIndex, pt, ILD_NORMAL);
01596
01597             if (!bOnlyImage)
01598             {
01599                 rc.left += szImage.cx + xSmallIconLabelOffset;
01600                 pDC->TextOut(rc.left, rc.top, CString(pi->cItem));
01601             }
01602
01603         }
01604     }
01605     else
01606     {
01607         if (ima)
01608         {
01609             IMAGEINFO ii;
01610             ima->GetImageInfo(pi->iImageIndex, &ii);
01611             CSize szImage = CRect(ii.rcImage).Size();
01612             CPoint pt;
01613             pt.x = rc.left + (rc.Width() - szImage.cx) / 2;
01614             pt.y = rc.top;// + (rc.Height() - szImage.cy) / 2;
01615             ima->Draw(pDC, pi->iImageIndex, pt, ILD_NORMAL);
01616             if (!bOnlyImage)
01617             {
01618                 rc.top += szImage.cy + yLargeIconLabelOffset;
01619                 pDC->DrawText(pi->cItem, lstrlen(pi->cItem), rc, DT_CENTER|DT_WORDBREAK);
01620             }
01621         }
01622     }
01623
01624     if (dwFlags&fSelHighlight && iLastSel == index && iLastSel >= 0)
01625     {
01626         CRect rc;
01627         GetIconRect(iSelFolder, iLastSel, rc);
01628         rc.InflateRect(1,1);
01629         pDC->Draw3dRect(rc, crDkShadowBorder, cr3dFace);
01630     }
01631
01632     pDC->SetTextColor(ocr);
01633     pDC->SelectObject(oft);
01634     pDC->SetBkMode(obk);
01635
01636 }

virtual long CGfxOutBarCtrl::GetAnimationTickCount ( ) [inline, virtual]

Definition at line 166 of file GfxOutBarCtrl.h.

00166 { return lAnimationTickCount; };

int CGfxOutBarCtrl::GetCountPerPage ( ) const [virtual]

Definition at line 1398 of file GfxOutBarCtrl.cpp.

01399 {
01400     return 0;
01401 }

int CGfxOutBarCtrl::GetDragItemRect | ( | const int | index,
 |  | CRect & | rect
 | ) | [virtual]

Definition at line 2125 of file GfxOutBarCtrl.cpp.

Referenced by DrawDragArrow().

02126 {
02127     CRect rc, crc;
02128     GetInsideRect(crc);
02129     crc.InflateRect(-2, 0);
02130
02131     GetItemRect(iSelFolder, index < GetItemCount() ? index : index - 1, rc);
02132     int line = 0;
02133     if (index < GetItemCount())
02134     {
02135         line = rc.top - 4;
02136     }
02137     else
02138     {
02139         line = rc.bottom + 6;
02140     }
02141     int tpe;
02142     if (index == 0)
02143     {
02144         rect.SetRect(crc.left, line+2, crc.right, line + 7);
02145         tpe = 0;
02146     }
02147     else if (index < GetItemCount())
02148     {
02149         rect.SetRect(crc.left, line - 9, crc.right, line);
02150         tpe = 1;
02151         if (IsSmallIconView())
02152         {
02153             rect.top += 8;
02154             rect.bottom += 8;
02155         }
02156     }
02157     else
02158     {
02159         rect.SetRect(crc.left, line, crc.right, line + 5);
02160         tpe = 2;
02161     }
02162     return tpe;
02163 }

DWORD CGfxOutBarCtrl::GetFlag ( ) const [virtual]

Definition at line 271 of file GfxOutBarCtrl.cpp.

00272 {
00273     return dwFlags;
00274 }

CWnd * CGfxOutBarCtrl::GetFolderChild ( int iFolder = -1 ) [virtual]

Definition at line 2320 of file GfxOutBarCtrl.cpp.

Referenced by AnimateFolderScroll(), OnPaint(), OnSize(), and SetSelFolder().

02321 {
02322     if (GetFolderCount())
02323     {
02324         if (iFolder < 0) iFolder = iSelFolder;
02325
02326         CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
02327         return pbf->pChild;
02328     }
02329     return NULL;
02330 }

int CGfxOutBarCtrl::GetFolderCount ( ) const [virtual]

Definition at line 1353 of file GfxOutBarCtrl.cpp.

Referenced by AnimateFolderScroll(), DrawAnimItem(), DrawItem(), GetFolderChild(), GetFolderImageList(), GetItemCount(), GetItemData(), GetItemImage(), GetItemSize(), GetItemText(), InsertItem(), IsValidItem(), OnSize(), PaintItems(), RemoveFolder(), RemoveItem(), SetFolderImageList(), SetFolderText(), SetItemData(), SetItemImage(), SetItemText(), SetSelFolder(), StartGroupEdit(), and StartItemEdit().

01354 {
01355     return arFolder.GetSize();
01356 }

DWORD CGfxOutBarCtrl::GetFolderData ( int iFolder = -1 ) [virtual]

Definition at line 2332 of file GfxOutBarCtrl.cpp.

02333 {
02334     if (iFolder < 0) iFolder = iSelFolder;
02335     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
02336     return pbf->dwData;
02337 }

CImageList * CGfxOutBarCtrl::GetFolderImageList | ( | const int | index,
 |  | const bool | bSmall
 | ) | const [virtual]

Definition at line 1558 of file GfxOutBarCtrl.cpp.

Referenced by DrawAnimItem(), DrawItem(), and GetItemSize().

01559 {
01560     ASSERT(index >= 0 && index < GetFolderCount());
01561     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(index);
01562     if (bSmall)
01563     {
01564         if (pbf->pSmallImageList) return pbf->pSmallImageList; else return pSmallImageList;
01565     }
01566     if (pbf->pLargeImageList) return pbf->pLargeImageList; else return pLargeImageList;
01567 }

bool CGfxOutBarCtrl::GetFolderRect | ( | const int | iIndex,
 |  | CRect & | rect
 | ) | const [virtual]

Definition at line 477 of file GfxOutBarCtrl.cpp.

Referenced by AnimateFolderScroll(), HighlightFolder(), HitTestEx(), OnLButtonDown(), OnPaint(), and StartGroupEdit().

00478 {
00479     int max = arFolder.GetSize();
00480     ASSERT(iIndex >= 0 && iIndex < max);
00481
00482     if (iIndex >= 0 && iIndex < max)
00483     {
00484         CRect rc;
00485         GetClientRect(rc);
00486         if (iIndex > iSelFolder)
00487             rect.SetRect(rc.left, rc.bottom - ((max - iIndex)) * iFolderHeight, rc.right,
00488             rc.bottom - (max - iIndex - 1) * iFolderHeight);
00489         else
00490             rect.SetRect(rc.left, rc.top + iIndex * iFolderHeight - 1, rc.right,
00491             rc.top + (1 + iIndex) * iFolderHeight - 1);
00492         return true;
00493     }
00494     return false;
00495 }

void CGfxOutBarCtrl::GetIconRect | ( | const int | iFolder,
 |  | const int | iIndex,
 |  | CRect & | rect
 | ) | [virtual]

Definition at line 1745 of file GfxOutBarCtrl.cpp.

Referenced by DrawItem(), HighlightItem(), HitTestEx(), OnLButtonDown(), and StartItemEdit().

01746 {
01747     CRect rc;
01748     GetInsideRect(rc);
01749     int top = rc.top;
01750     CSize sz(0,0);
01751     int y = 0;
01752     int spacing = IsSmallIconView() ? ySmallIconSpacing : yLargeIconSpacing;
01753
01754     for (int t = 0; t < iIndex; t++)
01755     {
01756         sz = GetItemSize(iFolder, t, ircAll);
01757         top += sz.cy;
01758         top += spacing;
01759         if (t == iFirstItem - 1) y = top - rc.top;
01760     }
01761     top += spacing;
01762
01763     sz = GetItemSize(iFolder, iIndex, ircIcon);
01764     if (IsSmallIconView())
01765     {
01766         rect.SetRect(rc.left, top, rc.left + sz.cx, top + sz.cy);
01767         rect.left += xLeftMargin + 2;
01768         rect.right += xLeftMargin + 2;
01769         rect.top -= yTopMargin;
01770         rect.bottom -= yTopMargin;
01771
01772         rect.top -= y;
01773         rect.bottom -= y;
01774     }
01775     else
01776     {
01777         rect.SetRect(rc.left + (rc.Width() - sz.cx)/2, top, rc.left + (rc.Width() - sz.cx)/2 + sz.cx, top + sz.cy);
01778         rect.top -= y + 3;
01779         rect.bottom -= y + 2;
01780     }
01781 }

CImageList * CGfxOutBarCtrl::GetImageList | ( | CImageList * | pImageList,
 |  | int | nImageList
 | ) | [virtual]

Definition at line 1419 of file GfxOutBarCtrl.cpp.

01420 {
01421     if (nImageList == fSmallIcon) return pSmallImageList;
01422     else if (nImageList == fLargeIcon) return pLargeImageList;
01423     return NULL;
01424 }

void CGfxOutBarCtrl::GetInsideRect ( CRect & rect ) const [virtual]

Definition at line 629 of file GfxOutBarCtrl.cpp.

Referenced by AnimateFolderScroll(), DrawAnimItem(), GetDragItemRect(), GetIconRect(), GetItemRect(), GetItemSize(), GetLabelRect(), GetVisibleRange(), HighlightItem(), HitTestEx(), OnLButtonDown(), OnPaint(), OnSize(), PaintItems(), RemoveItem(), SetSelFolder(), SetSmallIconView(), and StartItemEdit().

00630 {
00631     GetClientRect(rect);
00632     if (arFolder.GetSize() > 0)
00633     {
00634         int max = arFolder.GetSize();
00635         rect.top += iFolderHeight * (iSelFolder + 1) - 1;//+ 2;
00636         rect.bottom -= (max - iSelFolder - 1)*iFolderHeight;
00637         return;
00638     }
00639 }

int CGfxOutBarCtrl::GetItemCount ( ) const [virtual]

Definition at line 1315 of file GfxOutBarCtrl.cpp.

Referenced by DrawAnimItem(), DrawItem(), GetDragItemRect(), GetItemSize(), OnLButtonDown(), OnPaint(), RemoveItem(), and StartItemEdit().

01316 {
01317     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
01318     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
01319     return  pbf->GetItemCount();
01320 }

DWORD CGfxOutBarCtrl::GetItemData ( const int index ) const [virtual]

Definition at line 2012 of file GfxOutBarCtrl.cpp.

02013 {
02014     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02015     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02016     if (IsValidItem(index))
02017     {
02018         CBarItem * i = (CBarItem *) pbf->arItems.GetAt(index);
02019         return i->dwData;
02020     }
02021     return 0;
02022 }

int CGfxOutBarCtrl::GetItemImage ( const int index ) const [virtual]

Definition at line 2024 of file GfxOutBarCtrl.cpp.

02025 {
02026     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02027     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02028     if (IsValidItem(index))
02029     {
02030         CBarItem * i = (CBarItem *) pbf->arItems.GetAt(index);
02031         return i->iImageIndex;
02032     }
02033     return 0;
02034 }

void CGfxOutBarCtrl::GetItemRect | ( | const int | iFolder,
 |  | const int | iIndex,
 |  | CRect & | rect
 | ) | [virtual]

Definition at line 497 of file GfxOutBarCtrl.cpp.

Referenced by DrawAnimItem(), GetDragItemRect(), GetVisibleRange(), HitTestEx(), OnLButtonDown(), and PaintItems().

00498 {
00499     CRect rc;
00500     GetInsideRect(rc);
00501     int top = rc.top;
00502     CSize sz(0,0);
00503     int y = 0;
00504     for (int t = 0; t < iIndex; t++)
00505     {
00506         sz = GetItemSize(iFolder, t, ircAll);
00507         top += sz.cy;
00508
00509         if (IsSmallIconView())
00510         {
00511             top += ySmallIconSpacing;
00512         }
00513         else
00514         {
00515             top += yLargeIconSpacing;
00516         }
00517         if (t == iFirstItem - 1) y = top - rc.top;
00518     }
00519     sz = GetItemSize(iFolder, iIndex, ircAll);
00520     rect.SetRect(rc.left, top, rc.left + sz.cx, top + sz.cy);
00521
00522     rect.top -= y;
00523     rect.bottom -= y;
00524
00525     rect.left += xLeftMargin;
00526     rect.top  += yTopMargin;
00527     rect.bottom += yTopMargin;
00528
00529     if (!IsSmallIconView())
00530     {
00531         rect.left = rc.left;
00532         rect.right = rc.right;
00533     }
00534 }

CSize CGfxOutBarCtrl::GetItemSize | ( | const int | iFolder,
 |  | const int | index,
 |  | const int | type
 | ) | [virtual]

Definition at line 1493 of file GfxOutBarCtrl.cpp.

Referenced by GetIconRect(), GetItemRect(), and GetLabelRect().

01494 {
01495     ASSERT(iFolder >= 0 && iFolder < GetFolderCount());
01496     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
01497
01498     ASSERT(index >= 0 && index < pbf->GetItemCount());
01499     CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
01500
01501     CSize szImage(0,0);
01502     CSize szLabel(0,0);
01503     CSize szAll(0,0);
01504
01505     if (pi->iImageIndex >= 0)
01506     {
01507         if (type != ircLabel)
01508         {
01509             CImageList * il = GetFolderImageList(iFolder, IsSmallIconView());
01510             ASSERT(il);
01511             if (il)
01512             {
01513                 IMAGEINFO ii;
01514                 il->GetImageInfo(pi->iImageIndex, &ii);
01515                 szImage = CRect(ii.rcImage).Size();
01516             }
01517         }
01518     }
01519     if (pi->cItem)
01520     {
01521         if (type != ircIcon)
01522         {
01523             CClientDC dc(this);
01524             CFont * oft = (CFont *) dc.SelectObject(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
01525             if (IsSmallIconView())
01526             {
01527                 szLabel = dc.GetTextExtent(pi->cItem, lstrlen(pi->cItem));
01528             }
01529             else
01530             {
01531                 CRect rc;
01532                 GetInsideRect(rc);
01533                 rc.bottom = rc.top;
01534                 dc.DrawText(pi->cItem, lstrlen(pi->cItem), rc, DT_CALCRECT|DT_CENTER|DT_WORDBREAK);
01535                 szLabel = rc.Size();
01536             }
01537             dc.SelectObject(oft);
01538         }
01539     }
01540     if (IsSmallIconView())
01541     {
01542         if (type == ircIcon) szAll = szImage;
01543         else if (type == ircLabel) szAll = szLabel;
01544         else if (type == ircAll) szAll = CSize(szImage.cx + szLabel.cx + xSmallIconLabelOffset, szImage.cy > szLabel.cy ? szImage.cy : szLabel.cy);
01545     }
01546     else
01547     {
01548         if (type == ircIcon) szAll = szImage;
01549         else if (type == ircLabel) szAll = szLabel;
01550         else if (type == ircAll)
01551         {
01552             szAll = CSize(szImage.cx > szLabel.cx ? szImage.cx : szLabel.cx, szLabel.cy + szImage.cy + yLargeIconLabelOffset + yLargeIconSpacing);
01553         }
01554     }
01555     return szAll;
01556 }

CString CGfxOutBarCtrl::GetItemText ( const int index ) [virtual]

Definition at line 2293 of file GfxOutBarCtrl.cpp.

02294 {
02295     CString item;
02296
02297     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02298     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02299     if (IsValidItem(index))
02300     {
02301         CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
02302         if (pi->cItem) item = pi->cItem;
02303     }
02304     return item;
02305 }

void CGfxOutBarCtrl::GetLabelRect | ( | const int | iFolder,
 |  | const int | iIndex,
 |  | CRect & | rect
 | ) | [virtual]

Definition at line 1783 of file GfxOutBarCtrl.cpp.

Referenced by HitTestEx(), and StartItemEdit().

01784 {
01785     CRect rc;
01786     GetInsideRect(rc);
01787     int top = rc.top;
01788     CSize sz(0,0);
01789     int y = 0;
01790     int spacing = IsSmallIconView() ? ySmallIconSpacing : yLargeIconSpacing;
01791
01792     for (int t = 0; t < iIndex; t++)
01793     {
01794         sz = GetItemSize(iFolder, t, ircAll);
01795         top += sz.cy;
01796         top += spacing;
01797         if (t == iFirstItem - 1) y = top - rc.top;
01798     }
01799     top += spacing;
01800
01801     sz = GetItemSize(iFolder, iIndex, ircAll);
01802
01803     CSize szLabel = GetItemSize(iFolder, iIndex, ircLabel);
01804
01805     if (IsSmallIconView())
01806     {
01807         rect.SetRect(rc.left, top, rc.left + sz.cx, top + sz.cy);
01808         rect.left += xLeftMargin + 2;
01809         rect.right += xLeftMargin + 2;
01810         rect.top  += yTopMargin - 5;
01811         rect.bottom += yTopMargin - 5;
01812     }
01813     else
01814     {
01815         rect.SetRect(rc.left + (rc.Width() - sz.cx)/2, top, rc.left + (rc.Width() - sz.cx)/2 + sz.cx, top + sz.cy);
01816         rect.top -= y + 3;
01817         rect.bottom -= y + 2;
01818
01819         rect.bottom -=  yLargeIconSpacing;
01820         rect.top    = rect.bottom - szLabel.cy;
01821     }
01822 }

int CGfxOutBarCtrl::GetSelFolder ( ) const [virtual]

Definition at line 1358 of file GfxOutBarCtrl.cpp.

01359 {
01360     return iSelFolder;
01361 }

void CGfxOutBarCtrl::GetVisibleRange | ( | const int | iFolder,
 |  | int & | first,
 |  | int & | last
 | ) | [virtual]

Definition at line 1653 of file GfxOutBarCtrl.cpp.

Referenced by OnPaint().

01654 {
01655     first = iFirstItem;
01656     CRect rc;
01657     GetInsideRect(rc);
01658
01659     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
01660     int max = pbf->GetItemCount(), t;
01661     for (t = iFirstItem; t < max; t++)
01662     {
01663         CRect itemRc;
01664         GetItemRect(iFolder, t, itemRc);
01665         if (itemRc.bottom > rc.bottom)
01666         {
01667             last = t - 1;
01668             break;
01669         }
01670         else last = t;
01671     }
01672 }

void CGfxOutBarCtrl::HighlightFolder ( const int index ) [virtual]

Definition at line 718 of file GfxOutBarCtrl.cpp.

Referenced by OnMouseMove(), OnPaint(), and OnTimer().

00719 {
00720     CWnd * pf = GetFocus();
00721     if (pf != NULL && pf != this && IsChild(pf)) return;
00722
00723     if (iLastFolderHighlighted == index) return;
00724
00725     if (iLastFolderHighlighted >= 0)
00726     {
00727         CRect rc;
00728         if (GetFolderRect(iLastFolderHighlighted, rc))
00729         {
00730             CClientDC dc(this);
00731             CPen pn(PS_SOLID, 1, crBackGroundColor1);//crShadowBorder);
00732             CPen * op = dc.SelectObject(&pn);
00733             dc.MoveTo(rc.left, rc.bottom-1);
00734             dc.LineTo(rc.right-1, rc.bottom-1);
00735             dc.LineTo(rc.right-1, rc.top);
00736             CPen pn1(PS_SOLID, 1, cr3dFace);
00737             dc.SelectObject(&pn1);
00738             dc.MoveTo(rc.left+1, rc.bottom-2);
00739             dc.LineTo(rc.right-2, rc.bottom-2);
00740             dc.LineTo(rc.right-2, rc.top+1);
00741             dc.SelectObject(op);
00742
00743             // fix potential resource leak - KStowell - 10-21-99
00744             pn.DeleteObject();
00745         }
00746     }
00747     iLastFolderHighlighted = index;
00748     if (iLastFolderHighlighted >= 0)
00749     {
00750         CRect rc;
00751         if (GetFolderRect(iLastFolderHighlighted, rc))
00752         {
00753             CClientDC dc(this);
00754             CPen pn(PS_SOLID, 1, crDkShadowBorder);
00755             CPen * op = dc.SelectObject(&pn);
00756             dc.MoveTo(rc.left, rc.bottom-1);
00757             dc.LineTo(rc.right-1, rc.bottom-1);
00758             dc.LineTo(rc.right-1, rc.top);
00759             CPen pn1(PS_SOLID, 1, crBackGroundColor1);
00760             dc.SelectObject(&pn1);
00761             dc.MoveTo(rc.left+1, rc.bottom-2);
00762             dc.LineTo(rc.right-2, rc.bottom-2);
00763             dc.LineTo(rc.right-2, rc.top+1);
00764             dc.SelectObject(op);
00765
00766             // fix potential resource leak - KStowell - 10-21-99
00767             pn.DeleteObject();
00768         }
00769     }
00770 }

void CGfxOutBarCtrl::HighlightItem | ( | const int | index,
 |  | const bool | bPressed = false
 | ) | [virtual]

Definition at line 1691 of file GfxOutBarCtrl.cpp.

Referenced by OnLButtonDown(), OnMouseMove(), OnPaint(), and OnTimer().

01692 {
01693     CWnd * pf = GetFocus();
01694     if (pf != NULL && pf != this && IsChild(pf)) return;
01695
01696     static bool bOldPressed = false;
01697     if (iLastItemHighlighted == index && bOldPressed == bPressed) return;
01698
01699     bOldPressed = bPressed;
01700
01701     CClientDC dc(this);
01702
01703     CRect irc;
01704     GetInsideRect(irc);
01705     int isdc = dc.SaveDC();
01706     CRgn itemRegion;
01707     itemRegion.CreateRectRgnIndirect(&irc);
01708     dc.SelectClipRgn(&itemRegion);
01709     itemRegion.DeleteObject();
01710
01711
01712     if (iLastItemHighlighted >= 0 && IsValidItem(iLastItemHighlighted))
01713     {
01714         CRect rc;
01715         GetIconRect(iSelFolder, iLastItemHighlighted, rc);
01716         rc.InflateRect(1,1);
01717         dc.Draw3dRect(rc, crBackGroundColor, crBackGroundColor);
01718     }
01719     if (iSelAnimTiming > 0 && index == iLastSel)
01720     {
01721         iLastItemHighlighted = -1;
01722         return;
01723     }
01724     if (dwFlags&fSelHighlight && iLastSel == index)
01725     {
01726         iLastItemHighlighted = -1;
01727         return;
01728     }
01729
01730     iLastItemHighlighted = index;
01731     if (iLastItemHighlighted >= 0 && IsValidItem(iLastItemHighlighted))
01732     {
01733         CRect rc;
01734         GetIconRect(iSelFolder, iLastItemHighlighted, rc);
01735         rc.InflateRect(1,1);
01736         if (bPressed)
01737             dc.Draw3dRect(rc, crDkShadowBorder, cr3dFace);
01738         else
01739             dc.Draw3dRect(rc, cr3dFace, crDkShadowBorder);
01740     }
01741     dc.RestoreDC(isdc);
01742     GetOwner()->SendMessage(WM_OUTBAR_NOTIFY,NM_OB_ITEMHOVER,index);
01743 }

int CGfxOutBarCtrl::HitTestEx | ( | const CPoint & | point,
 |  | int & | index
 | ) | [virtual]

Definition at line 662 of file GfxOutBarCtrl.cpp.

Referenced by OnLButtonDown(), OnMouseMove(), OnRButtonDown(), and OnSetCursor().

00663 {
00664     if (bUpArrow && rcUpArrow.PtInRect(point)) return htUpScroll;
00665     if (bDownArrow && rcDownArrow.PtInRect(point)) return htDownScroll;
00666
00667     int max = arFolder.GetSize(), t;
00668
00669     CRect rc;
00670     for (t = 0; t < max; t++)
00671     {
00672         GetFolderRect(t, rc);
00673         if (rc.PtInRect(point))
00674         {
00675             index = t;
00676             return htFolder;
00677         }
00678     }
00679     GetInsideRect(rc);
00680     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
00681     max = pbf->GetItemCount();
00682     for (t = iFirstItem; t < max; t++)
00683     {
00684         CRect itemRc;
00685         if (!IsSmallIconView())
00686         {
00687             GetIconRect(iSelFolder, t, itemRc);
00688             if (itemRc.PtInRect(point))
00689             {
00690                 index = t;
00691                 return htItem;
00692             }
00693             else if (itemRc.top > rc.bottom) break;
00694             GetLabelRect(iSelFolder, t, itemRc);
00695             itemRc.top -= yLargeIconLabelOffset;
00696
00697             if (itemRc.PtInRect(point))
00698             {
00699                 index = t;
00700                 return htItem;
00701             }
00702             else if (itemRc.top > rc.bottom) break;
00703         }
00704         else
00705         {
00706             GetItemRect(iSelFolder, t, itemRc);
00707             if (itemRc.PtInRect(point))
00708             {
00709                 index = t;
00710                 return htItem;
00711             }
00712             else if (itemRc.top > rc.bottom) break;
00713         }
00714     }
00715     return htNothing;
00716 }

int CGfxOutBarCtrl::InsertItem | ( | const int | folder,
 |  | const int | index,
 |  | LPCTSTR | text,
 |  | const int | image = -1,
 |  | const DWORD | exData = 0
 | ) | [virtual]

Definition at line 1306 of file GfxOutBarCtrl.cpp.

01307 {
01308     ASSERT(folder >= 0 && folder < GetFolderCount());
01309
01310     CBarFolder* pbf = (CBarFolder*) arFolder.GetAt(folder);
01311
01312     return pbf->InsertItem(index, text, image, exData);
01313 }

bool CGfxOutBarCtrl::IsSmallIconView ( ) const [virtual]

Definition at line 240 of file GfxOutBarCtrl.cpp.

Referenced by DrawAnimItem(), DrawItem(), GetDragItemRect(), GetIconRect(), GetItemRect(), GetItemSize(), GetLabelRect(), HitTestEx(), OnUpdateGfxLargeicon(), OnUpdateGfxSmallicon(), SetSmallIconView(), and StartItemEdit().

00241 {
00242     return dwFlags&fSmallIcon;
00243 }

bool CGfxOutBarCtrl::IsValidItem ( const int index ) const [virtual]

Definition at line 2005 of file GfxOutBarCtrl.cpp.

Referenced by GetItemData(), GetItemImage(), GetItemText(), HighlightItem(), RemoveItem(), SetItemData(), and SetItemImage().

02006 {
02007     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02008     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02009     return (index >= 0 && index < pbf->GetItemCount());
02010 }

void CGfxOutBarCtrl::ModifyFlag | ( | const DWORD & | dwRemove,
 |  | const DWORD & | dwAdd,
 |  | const UINT | redraw = 0
 | ) | [virtual]

Definition at line 276 of file GfxOutBarCtrl.cpp.

00277 {
00278     if (dwRemove)   dwFlags &= ~(dwRemove);
00279     if (dwAdd)      dwFlags |= dwAdd;
00280
00281     if (GetSafeHwnd())
00282     {
00283         if (redraw != 0) SetWindowPos(0,0,0,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOMOVE|redraw);
00284         else Invalidate();
00285     }
00286 }

int CGfxOutBarCtrl::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 288 of file GfxOutBarCtrl.cpp.

00289 {
00290     if (CWnd::OnCreate(lpCreateStruct) == -1)
00291         return -1;
00292
00293     // TODO: Add your specialized creation code here
00294
00295     return 0;
00296 }

long CGfxOutBarCtrl::OnEndLabelEdit | ( | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) | [protected]

Definition at line 158 of file GfxOutBarCtrl.cpp.

00159 {
00160     if (wParam == NM_OB_ONGROUPENDEDIT)
00161     {
00162         CGfxGroupEdit* pEdit = (CGfxGroupEdit*) lParam;
00163
00164         OUTBAR_INFO ob;
00165
00166         ob.index = pEdit->iIndex;
00167         ob.cText = (LPCTSTR) pEdit->text;
00168
00169         if (GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_ONGROUPENDEDIT, (LPARAM) &ob))
00170         {
00171             SetFolderText(pEdit->iIndex, pEdit->text);
00172             CRect rc;
00173             GetFolderRect(pEdit->iIndex, rc);
00174             InvalidateRect(rc, false);
00175         }
00176     }
00177
00178     if (wParam == NM_OB_ONLABELENDEDIT)
00179     {
00180         CGfxGroupEdit * pEdit = (CGfxGroupEdit *) lParam;
00181         OUTBAR_INFO ob;
00182         ob.index = pEdit->iIndex;
00183         ob.cText = pEdit->text;
00184
00185         if (GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_ONLABELENDEDIT, (LPARAM) &ob))
00186         {
00187             SetItemText(pEdit->iIndex, pEdit->text);
00188             CRect rc;
00189             GetInsideRect(rc);
00190             InvalidateRect(rc, true);
00191         }
00192     }
00193
00194     return 0;
00195 }

BOOL CGfxOutBarCtrl::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 472 of file GfxOutBarCtrl.cpp.

00473 {
00474     return true;
00475 }

void CGfxOutBarCtrl::OnGfxLargeicon ( ) [protected]

Definition at line 1933 of file GfxOutBarCtrl.cpp.

01934 {
01935     SetSmallIconView(false);
01936     Invalidate();
01937 }

void CGfxOutBarCtrl::OnGfxRemoveitem ( ) [protected]

Definition at line 1955 of file GfxOutBarCtrl.cpp.

01956 {
01957     if (iHitInternal1 == htFolder)
01958     {
01959         RemoveFolder(iHitInternal2);
01960     }
01961     else if (iHitInternal1 == htItem)
01962     {
01963         RemoveItem(iHitInternal2);
01964     }
01965 }

void CGfxOutBarCtrl::OnGfxRenameitem ( ) [protected]

Definition at line 1972 of file GfxOutBarCtrl.cpp.

01973 {
01974     if (iHitInternal1 == htFolder)
01975     {
01976         StartGroupEdit(iHitInternal2);
01977     }
01978     else if (iHitInternal1 == htItem)
01979     {
01980         StartItemEdit(iHitInternal2);
01981     }
01982 }

void CGfxOutBarCtrl::OnGfxSmallicon ( ) [protected]

Definition at line 1944 of file GfxOutBarCtrl.cpp.

01945 {
01946     SetSmallIconView(true);
01947     Invalidate();
01948 }

void CGfxOutBarCtrl::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 772 of file GfxOutBarCtrl.cpp.

00773 {
00774     if (GetFocus() != this) SetFocus();
00775
00776     int index, ht = HitTestEx(point, index);
00777     iLastDragItemDrawType = -1;
00778
00779     CRect inRc;
00780     GetInsideRect(inRc);
00781
00782     if (ht == htFolder)
00783     {
00784         bool bHigh = true;
00785         CRect rc;
00786         GetFolderRect(index, rc);
00787
00788         if (::GetCapture() == NULL)
00789         {
00790             SetCapture();
00791             ASSERT(this == GetCapture());
00792             CClientDC dc(this);
00793             DrawFolder(&dc, index, rc, true);
00794             AfxLockTempMaps();
00795             for (;;)
00796             {
00797                 MSG msg;
00798                 VERIFY(::GetMessage(&msg, NULL, 0, 0));
00799
00800                 if (CWnd::GetCapture() != this) break;
00801
00802                 switch (msg.message)
00803                 {
00804                 case WM_MOUSEMOVE:
00805                     {
00806                         CPoint pt(msg.lParam);
00807                         int idx, ht1 = HitTestEx(pt, idx);
00808                         if (ht1 == htFolder && idx == index)
00809                         {
00810                             if (!bHigh)
00811                             {
00812                                 DrawFolder(&dc, index, rc, true);
00813                                 bHigh = true;
00814                             }
00815                         }
00816                         else
00817                         {
00818                             if (bHigh)
00819                             {
00820                                 DrawFolder(&dc, index, rc, false);
00821                                 bHigh = false;
00822                             }
00823                         }
00824                     }
00825                     break;
00826
00827                 case WM_LBUTTONUP:
00828                     {
00829                         if (bHigh)
00830                         {
00831                             DrawFolder(&dc, index, rc, false);
00832                             bHigh = false;
00833                         }
00834                         CPoint pt(msg.lParam);
00835                         int idx, ht1 = HitTestEx(pt, idx);
00836                         if (ht1 == htFolder && idx != iSelFolder)
00837                             SetSelFolder(idx);
00838                     }
00839
00840                     goto ExitLoop2;
00841
00842                 case WM_KEYDOWN:
00843                     if (msg.wParam != VK_ESCAPE)
00844                         break;
00845
00846                 default:
00847                     DispatchMessage(&msg);
00848                     break;
00849                 }
00850             }
00851
00852         ExitLoop2:
00853             ReleaseCapture();
00854             AfxUnlockTempMaps(FALSE);
00855         }
00856         if (bHigh) InvalidateRect(rc, false);
00857     }
00858     else iLastSelectedFolder = -1;
00859
00860     if (ht == htItem)
00861     {
00862         iLastDragItemDraw = -1;
00863         bool bHigh = true, bDragging = false;
00864         CRect rc;
00865         GetItemRect(iSelFolder, index, rc);
00866
00867         HCURSOR hCur = GetCursor();
00868
00869         if (::GetCapture() == NULL)
00870         {
00871             SetCapture();
00872             ASSERT(this == GetCapture());
00873             CClientDC dc(this);
00874             HighlightItem(index, true);
00875             AfxLockTempMaps();
00876             for (;;)
00877             {
00878                 MSG msg;
00879                 VERIFY(::GetMessage(&msg, NULL, 0, 0));
00880
00881                 if (CWnd::GetCapture() != this) break;
00882
00883                 switch (msg.message)
00884                 {
00885                 case WM_MOUSEMOVE:
00886                     {
00887                         CPoint pt(msg.lParam);
00888                         int idx, ht1 = HitTestEx(pt, idx);
00889                         if (bDragging)
00890                         {
00891                             if (ht1 == htItem)
00892                             {
00893                                 DrawDragArrow(&dc, index, idx);
00894                                 SetCursor(hDragCursor);
00895                                 hCur = hDragCursor;
00896                             }
00897                             else
00898                             {
00899                                 CRect rcItem;
00900                                 GetItemRect(iSelFolder, GetItemCount() - 1, rcItem);
00901                                 if (pt.y > rcItem.bottom && pt.y < inRc.bottom)
00902                                 {
00903                                     DrawDragArrow(&dc, index, GetItemCount());
00904                                     SetCursor(hDragCursor);
00905                                     hCur = hDragCursor;
00906                                 }
00907                                 else
00908                                 {
00909                                     DrawDragArrow(&dc, index, -1);
00910                                     SetCursor(hNoDragCursor);
00911                                     hCur = hNoDragCursor;
00912                                 }
00913                             }
00914                         }
00915                         else
00916                         {
00917                             if (ht1 == htItem && idx == index)
00918                             {
00919                                 if (!bHigh)
00920                                 {
00921                                     HighlightItem(index, true);
00922                                     bHigh = true;
00923                                     bPressedHighlight = true;
00924                                 }
00925                             }
00926                             else
00927                             {
00928                                 if (ht1 == htItem)
00929                                 {
00930                                     if (bHigh)
00931                                     {
00932                                         HighlightItem(index, false);
00933                                         bHigh = false;
00934                                         bPressedHighlight = false;
00935                                     }
00936                                 }
00937                                 else
00938                                 {
00939                                     if (dwFlags&fDragItems)
00940                                     {
00941                                         HighlightItem(index, true);
00942                                         bHigh = true;
00943                                         bDragging = true;
00944
00945                                         SetCursor(hDragCursor);
00946                                         hCur = hDragCursor;
00947
00948                                         bPressedHighlight = true;
00949                                     }
00950                                 }
00951                             }
00952                         }
00953                     }
00954                     break;
00955
00956                 case WM_SETCURSOR:
00957                     SetCursor(hCur);
00958                     break;
00959
00960                 case WM_LBUTTONUP:
00961                     {
00962                         if (bHigh)
00963                         {
00964                             HighlightItem(-1);
00965                             bHigh = false;
00966                         }
00967                         CPoint pt(msg.lParam);
00968                         int idx, ht1 = HitTestEx(pt, idx);
00969                         if (!bDragging)
00970                         {
00971                             if (ht1 == htItem && idx == index)
00972                             {
00973                                 if (iSelAnimTiming > 0 && index != iLastSel && iLastSel >= 0)
00974                                 {
00975                                     DrawAnimItem(0, 0, iLastSel);
00976                                 }
00977
00978                                 if (dwFlags&fSelHighlight && iLastSel >= 0)
00979                                 {
00980                                     CRect rc;
00981                                     GetIconRect(iSelFolder, iLastSel, rc);
00982                                     rc.InflateRect(1,1);
00983                                     InvalidateRect(rc);
00984                                 }
00985
00986                                 iLastSel = index;
00987
00988                                 if (dwFlags&fSelHighlight && iLastSel >= 0)
00989                                 {
00990                                     CRect rc;
00991                                     GetIconRect(iSelFolder, iLastSel, rc);
00992                                     rc.InflateRect(1,1);
00993                                     InvalidateRect(rc);
00994                                 }
00995
00996                                 GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_ITEMCLICK, idx);
00997                             }
00998                         }
00999                         else
01000                         {
01001                             if (ht1 == htItem)
01002                             {
01003                                 if (idx != index)
01004                                 {
01005                                     OUTBAR_INFO ob;
01006                                     ob.iDragFrom = iSelFolder;
01007                                     ob.iDragTo = index;
01008                                     if (GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_DRAGITEM, (LPARAM) &ob))
01009                                     {
01010                                         CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
01011                                         CBarItem * piFrom = (CBarItem *) pbf->arItems.GetAt(index);
01012                                         pbf->arItems.RemoveAt(index);
01013                                         if (idx > index) idx --;
01014                                         pbf->arItems.InsertAt(idx, piFrom);
01015                                     }
01016                                 }
01017                             }
01018                             else
01019                             {
01020                                 CRect rcItem;
01021                                 GetItemRect(iSelFolder, GetItemCount() - 1, rcItem);
01022                                 if (pt.y > rcItem.bottom && pt.y < inRc.bottom)
01023                                 {
01024                                     OUTBAR_INFO ob;
01025                                     ob.iDragFrom = iSelFolder;
01026                                     ob.iDragTo = index;
01027                                     if (GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_OB_DRAGITEM, (LPARAM) &ob))
01028                                     {
01029                                         CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
01030                                         CBarItem * piFrom = (CBarItem *) pbf->arItems.GetAt(index);
01031                                         pbf->arItems.RemoveAt(index);
01032                                         pbf->arItems.Add((void *) piFrom);
01033                                     }
01034                                 }
01035                             }
01036                         }
01037                     }
01038
01039                     goto ExitLoop4;
01040
01041                 default:
01042                     DispatchMessage(&msg);
01043                     break;
01044                 }
01045             }
01046
01047         ExitLoop4:
01048             ReleaseCapture();
01049             AfxUnlockTempMaps(FALSE);
01050             if (bDragging)
01051             {
01052                 Invalidate();
01053             }
01054         }
01055         bPressedHighlight = false;
01056         if (bHigh) InvalidateRect(rc, false);
01057     }
01058     else iLastItemHighlighted = -1;
01059
01060     if (ht == htDownScroll)
01061     {
01062         bLooping = true;
01063         bool bHigh = true;
01064
01065         if (::GetCapture() == NULL)
01066         {
01067             SetCapture();
01068             ASSERT(this == GetCapture());
01069             CClientDC dc(this);
01070             dc.DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN|DFCS_PUSHED);
01071             SetTimer(2,300,NULL);
01072             AfxLockTempMaps();
01073             for (;;)
01074             {
01075                 MSG msg;
01076                 VERIFY(::GetMessage(&msg, NULL, 0, 0));
01077
01078                 if (CWnd::GetCapture() != this) break;
01079
01080                 switch (msg.message)
01081                 {
01082                 case WM_MOUSEMOVE:
01083                     {
01084                         CPoint pt(msg.lParam);
01085                         if (rcDownArrow.PtInRect(pt))
01086                         {
01087                             if (bHigh == false)
01088                             {
01089                                 dc.DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN|DFCS_PUSHED);
01090                                 bHigh = true;
01091                                 bDownArrow = true;
01092                                 bDownPressed = true;
01093                             }
01094                         }
01095                         else
01096                         {
01097                             if (bHigh == true)
01098                             {
01099                                 dc.DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN);
01100                                 bHigh = false;
01101                                 bDownArrow = false;
01102                                 bDownPressed = false;
01103                             }
01104                         }
01105                     }
01106                     break;
01107
01108                 case WM_LBUTTONUP:
01109                     {
01110                         if (bHigh)
01111                         {
01112                             dc.DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN);
01113                             bHigh = false;
01114                         }
01115                         bDownArrow = false;
01116                         CPoint pt(msg.lParam);
01117                         if (rcDownArrow.PtInRect(pt))
01118                         {
01119                             CRect itrc;
01120                             GetItemRect(iSelFolder, GetItemCount() - 1, itrc);
01121                             CRect crc;
01122                             GetInsideRect(crc);
01123                             if (itrc.bottom > crc.bottom)
01124                             {
01125                                 iFirstItem ++;
01126                                 InvalidateRect(crc, true);
01127                             }
01128                         }
01129                     }
01130                     goto ExitLoop3;
01131
01132
01133                 case WM_TIMER:
01134                     {
01135                         if (msg.wParam == 2)
01136                         {
01137                             if (bHigh)
01138                             {
01139                                 CPoint pt(msg.pt);
01140                                 ScreenToClient(&pt);
01141                                 if (rcDownArrow.PtInRect(pt))
01142                                 {
01143                                     bDownPressed = true;
01144                                     CRect itrc;
01145                                     GetItemRect(iSelFolder, GetItemCount() - 1, itrc);
01146                                     CRect crc;
01147                                     GetInsideRect(crc);
01148                                     if (itrc.bottom > crc.bottom)
01149                                     {
01150                                         iFirstItem ++;
01151                                         InvalidateRect(crc, true);
01152                                     }
01153                                     else goto ExitLoop3;
01154                                 }
01155                                 else bDownPressed = false;
01156                             }
01157                         }
01158                         break;
01159                     }
01160
01161                 case WM_KEYDOWN:
01162                     if (msg.wParam != VK_ESCAPE)
01163                         break;
01164
01165                 default:
01166                     DispatchMessage(&msg);
01167                     break;
01168                 }
01169             }
01170
01171         ExitLoop3:
01172             KillTimer(2);
01173             ReleaseCapture();
01174             AfxUnlockTempMaps(FALSE);
01175             bLooping = false;
01176             bDownPressed = false;
01177             bDownArrow = false;
01178             CRect crc;
01179             GetInsideRect(crc);
01180             InvalidateRect(crc, true);
01181         }
01182     }
01183
01184     if (ht == htUpScroll)
01185     {
01186         bLooping = true;
01187         bool bHigh = true;
01188
01189         if (::GetCapture() == NULL)
01190         {
01191             SetCapture();
01192             ASSERT(this == GetCapture());
01193             CClientDC dc(this);
01194             dc.DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP|DFCS_PUSHED);
01195             SetTimer(2,300,NULL);
01196             AfxLockTempMaps();
01197             for (;;)
01198             {
01199                 MSG msg;
01200                 VERIFY(::GetMessage(&msg, NULL, 0, 0));
01201
01202                 if (CWnd::GetCapture() != this) break;
01203
01204                 switch (msg.message)
01205                 {
01206                 case WM_MOUSEMOVE:
01207                     {
01208                         CPoint pt(msg.lParam);
01209                         if (rcUpArrow.PtInRect(pt))
01210                         {
01211                             if (bHigh == false)
01212                             {
01213                                 dc.DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP|DFCS_PUSHED);
01214                                 bHigh = true;
01215                                 bUpArrow = true;
01216                                 bUpPressed = true;
01217                             }
01218                         }
01219                         else
01220                         {
01221                             if (bHigh == true)
01222                             {
01223                                 dc.DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP);
01224                                 bHigh = false;
01225                                 bUpArrow = false;
01226                                 bUpPressed = false;
01227                             }
01228                         }
01229                     }
01230                     break;
01231
01232                 case WM_LBUTTONUP:
01233                     {
01234                         if (bHigh)
01235                         {
01236                             dc.DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP);
01237                             bHigh = false;
01238                         }
01239                         bUpArrow = false;
01240                         CPoint pt(msg.lParam);
01241                         if (rcUpArrow.PtInRect(pt))
01242                         {
01243                             if (iFirstItem > 0 )
01244                             {
01245                                 iFirstItem --;
01246                                 CRect crc;
01247                                 GetInsideRect(crc);
01248                                 InvalidateRect(crc, true);
01249                             }
01250                         }
01251                     }
01252
01253                     goto ExitLoop;
01254
01255                 case WM_TIMER:
01256                     {
01257                         if (msg.wParam == 2)
01258                         {
01259                             if (bHigh)
01260                             {
01261                                 CPoint pt(msg.pt);
01262                                 ScreenToClient(&pt);
01263                                 if (rcUpArrow.PtInRect(pt))
01264                                 {
01265                                     bUpPressed = true;
01266                                     if (iFirstItem > 0)
01267                                     {
01268                                         iFirstItem --;
01269                                         CRect crc;
01270                                         GetInsideRect(crc);
01271                                         InvalidateRect(crc, true);
01272                                     }
01273                                     else goto ExitLoop;
01274                                 }
01275                                 else bUpPressed = false;
01276                             }
01277                         }
01278                         break;
01279                     }
01280                 case WM_KEYDOWN:
01281                     if (msg.wParam != VK_ESCAPE) break;
01282
01283                 default:
01284                     DispatchMessage(&msg);
01285                     break;
01286                 }
01287             }
01288
01289         ExitLoop:
01290             KillTimer(2);
01291             ReleaseCapture();
01292             AfxUnlockTempMaps(FALSE);
01293             bLooping = false;
01294             bUpPressed = false;
01295             bUpArrow = false;
01296             CRect crc;
01297             GetInsideRect(crc);
01298             InvalidateRect(crc, true);
01299         }
01300     }
01301
01302     CWnd::OnLButtonDown(nFlags, point);
01303 }

void CGfxOutBarCtrl::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 641 of file GfxOutBarCtrl.cpp.

00642 {
00643     int index, ht = HitTestEx(point, index);
00644
00645     if (ht != htFolder && iLastFolderHighlighted >= 0) HighlightFolder(-1);
00646     if (ht != htItem   && iLastItemHighlighted   >= 0) HighlightItem(-1);
00647
00648     if (ht == htFolder)
00649     {
00650         HighlightFolder(index);
00651         SetTimer(1,100,NULL);
00652     }
00653     else if (ht == htItem)
00654     {
00655         HighlightItem(index);
00656         SetTimer(1,100,NULL);
00657     }
00658
00659     CWnd::OnMouseMove(nFlags, point);
00660 }

void CGfxOutBarCtrl::OnPaint ( ) [protected]

Definition at line 395 of file GfxOutBarCtrl.cpp.

00396 {
00397     CRect clientRc;
00398     GetClientRect(&clientRc);
00399     CPaintDC dc(this);
00400     CDC memDC;
00401     memDC.CreateCompatibleDC(&dc);
00402     CBitmap bmp;
00403     bmp.CreateCompatibleBitmap(&dc, clientRc.Width(), clientRc.Height());
00404     CBitmap * obmp = memDC.SelectObject(&bmp);
00405
00406     CDC * pDC = &memDC;
00407
00408     CRect rc;
00409     GetInsideRect(rc);
00410     if (!GetFolderChild()) pDC->FillSolidRect(rc, crBackGroundColor);
00411
00412
00413     int max = arFolder.GetSize();
00414     CRect frc;
00415     for (int t = 0; t < max; t++)
00416     {
00417         GetFolderRect(t, frc);
00418         DrawFolder(pDC, t, frc, false);
00419     }
00420     if (!GetFolderChild())
00421     {
00422         int f,l;
00423         GetVisibleRange(iSelFolder, f,l);
00424         rcUpArrow.SetRect(0,0,GetSystemMetrics(SM_CXVSCROLL), GetSystemMetrics(SM_CXVSCROLL));
00425         rcDownArrow = rcUpArrow;
00426         rcUpArrow.OffsetRect(rc.right - 5 - GetSystemMetrics(SM_CXVSCROLL), rc.top +5);
00427         rcDownArrow.OffsetRect(rc.right - 5 - GetSystemMetrics(SM_CXVSCROLL), rc.bottom - 5 - GetSystemMetrics(SM_CXVSCROLL));
00428
00429         if (f > 0)
00430         {
00431             if (bUpPressed) pDC->DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP|DFCS_PUSHED);
00432             else pDC->DrawFrameControl(rcUpArrow, DFC_SCROLL, DFCS_SCROLLUP);
00433             bUpArrow = true;
00434             pDC->ExcludeClipRect(rcUpArrow);
00435         }
00436         else bUpArrow = false;
00437
00438         if (l < GetItemCount() - 1)
00439         {
00440             if (bDownPressed) pDC->DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN|DFCS_PUSHED);
00441             else pDC->DrawFrameControl(rcDownArrow, DFC_SCROLL, DFCS_SCROLLDOWN);
00442             bDownArrow = true;
00443             pDC->ExcludeClipRect(rcDownArrow);
00444         }
00445         else bDownArrow = false;
00446
00447         PaintItems(pDC, iSelFolder, rc);
00448     }
00449
00450     dc.BitBlt(clientRc.left, clientRc.top, clientRc.Width(), clientRc.Height(), &memDC, 0,0, SRCCOPY);
00451
00452     memDC.SelectObject(obmp);
00453
00454     if (iLastFolderHighlighted >= 0)
00455     {
00456         int i = iLastFolderHighlighted;
00457         iLastFolderHighlighted = -1;
00458         HighlightFolder(i);
00459     }
00460     if (iLastItemHighlighted >= 0)
00461     {
00462         int i = iLastItemHighlighted;
00463         iLastItemHighlighted = -1;
00464         HighlightItem(i, bPressedHighlight);
00465     }
00466
00467     // fix potential resource leak - KStowell - 10-21-99
00468     memDC.DeleteDC();
00469     bmp.DeleteObject();
00470 }

void CGfxOutBarCtrl::OnRButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 1880 of file GfxOutBarCtrl.cpp.

01881 {
01882     iHitInternal1 = HitTestEx(point, iHitInternal2);
01883
01884     SetCapture();
01885
01886     CPoint pt = point;
01887     ClientToScreen(&pt);
01888
01889     // Load the popup menu.
01890     VERIFY(m_popupMenu.LoadMenu(IDR_GFXOUTBAR));
01891     CCJMenu* pPopup = (CCJMenu*)m_popupMenu.GetSubMenu(0);
01892     ASSERT(pPopup != NULL);
01893
01894     // Load toolbar resource if any for menu icons.
01895     pPopup->LoadToolbar(IDR_GFXOUTBAR);
01896
01897     if (iHitInternal1 == htItem)
01898     {
01899         if (dwFlags&fRemoveItems || dwFlags&fEditItems)
01900         {
01901             pPopup->AppendMenu(MF_SEPARATOR);
01902             if (dwFlags&fRemoveItems)
01903                 ((CMenu*)pPopup)->AppendMenu(MF_STRING, ID_GFX_REMOVEITEM, m_strRemoveItem);
01904
01905             if (dwFlags&fEditItems)
01906                 ((CMenu*)pPopup)->AppendMenu(MF_STRING, ID_GFX_RENAMEITEM, m_strRenameItem);
01907         }
01908     }
01909     else if (iHitInternal1 == htFolder)
01910     {
01911         if (dwFlags&fRemoveGroups || dwFlags&fEditGroups)
01912         {
01913             ((CMenu*)pPopup)->AppendMenu(MF_SEPARATOR);
01914
01915             if (dwFlags&fRemoveGroups)
01916                 ((CMenu*)pPopup)->AppendMenu(MF_STRING, ID_GFX_REMOVEITEM, m_strRemoveItem);
01917
01918             if (dwFlags&fEditGroups)
01919                 ((CMenu*)pPopup)->AppendMenu(MF_STRING, ID_GFX_RENAMEITEM, m_strRenameItem);
01920         }
01921     }
01922
01923     // Display the popup menu, use the main window as its parent.
01924     pPopup->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON,
01925         pt.x, pt.y, this );
01926
01927     m_popupMenu.DestroyMenu();
01928     ReleaseCapture();
01929
01930     CWnd::OnRButtonDown(nFlags, point);
01931 }

BOOL CGfxOutBarCtrl::OnSetCursor | ( | CWnd * | pWnd,
 |  | UINT | nHitTest,
 |  | UINT | message
 | ) | [protected]

Definition at line 1639 of file GfxOutBarCtrl.cpp.

01640 {
01641     CPoint pt(GetMessagePos());
01642     ScreenToClient(&pt);
01643     int index, ht = HitTestEx(pt, index);
01644     if (ht == htFolder)
01645     {
01646         SetCursor(hHandCursor);
01647         return true;
01648     }
01649
01650     return CWnd::OnSetCursor(pWnd, nHitTest, message);
01651 }

void CGfxOutBarCtrl::OnSize | ( | UINT | nType,
 |  | int | cx,
 |  | int | cy
 | ) | [protected]

Definition at line 1674 of file GfxOutBarCtrl.cpp.

01675 {
01676     bUpArrow = bDownArrow = false;
01677
01678     CWnd::OnSize(nType, cx, cy);
01679
01680     int t, max = GetFolderCount();
01681     CRect rc;
01682     GetInsideRect(rc);
01683
01684     for (t = 0; t < max; t++)
01685     {
01686         CWnd * pc = GetFolderChild(t);
01687         if (pc) pc->SetWindowPos(0, rc.left, rc.top, rc.Width(), rc.Height(), SWP_NOZORDER);
01688     }
01689 }

void CGfxOutBarCtrl::OnSysColorChange ( ) [protected]

Definition at line 2346 of file GfxOutBarCtrl.cpp.

02347 {
02348     // TODO: Add your message handler code here
02349     crBackGroundColor   = ::GetSysColor(COLOR_3DSHADOW);//RGB(0,128,128);//
02350     crBackGroundColor1  = ::GetSysColor(COLOR_3DSHADOW);
02351     crTextColor         = ::GetSysColor(COLOR_WINDOW);
02352     cr3dFace            = ::GetSysColor(COLOR_3DFACE);
02353     crLightBorder       = ::GetSysColor(COLOR_3DLIGHT);
02354     crHilightBorder     = ::GetSysColor(COLOR_3DHILIGHT);
02355     crShadowBorder      = ::GetSysColor(COLOR_3DSHADOW);
02356     crDkShadowBorder    = ::GetSysColor(COLOR_3DDKSHADOW);
02357
02358     CWnd::OnSysColorChange();
02359 }

void CGfxOutBarCtrl::OnTimer ( UINT nIDEvent ) [protected]

Definition at line 298 of file GfxOutBarCtrl.cpp.

00299 {
00300     if (nIDEvent == 1)
00301     {
00302         CPoint pt(GetMessagePos());
00303
00304         ScreenToClient(&pt);
00305
00306         CRect rc;
00307         GetClientRect(&rc);
00308         if (!(rc.PtInRect(pt)))
00309         {
00310             HighlightFolder(-1);
00311             HighlightItem(-1);
00312             KillTimer(1);
00313         }
00314     }
00315     else if (nIDEvent == 3 && iLastSel >= 0)
00316     {
00317         iSelAnimCount ++;
00318         if (iSelAnimCount > 10) iSelAnimCount = -1;
00319         if (iSelAnimCount == 0)
00320             DrawAnimItem(-1, 1, iLastSel);
00321         if (iSelAnimCount == 1)
00322             DrawAnimItem(0, 0, iLastSel);
00323         if (iSelAnimCount == 2)
00324             DrawAnimItem(1, 1, iLastSel);
00325         if (iSelAnimCount == 3)
00326             DrawAnimItem(0, 0, iLastSel);
00327     }
00328     CWnd::OnTimer(nIDEvent);
00329 }

void CGfxOutBarCtrl::OnUpdateGfxLargeicon ( CCmdUI * pCmdUI ) [protected]

Definition at line 1939 of file GfxOutBarCtrl.cpp.

01940 {
01941     pCmdUI->Enable(IsSmallIconView());
01942 }

void CGfxOutBarCtrl::OnUpdateGfxRemoveitem ( CCmdUI * pCmdUI ) [protected]

Definition at line 1967 of file GfxOutBarCtrl.cpp.

01968 {
01969
01970 }

void CGfxOutBarCtrl::OnUpdateGfxRenameitem ( CCmdUI * pCmdUI ) [protected]

Definition at line 1984 of file GfxOutBarCtrl.cpp.

01985 {
01986 }

void CGfxOutBarCtrl::OnUpdateGfxSmallicon ( CCmdUI * pCmdUI ) [protected]

Definition at line 1950 of file GfxOutBarCtrl.cpp.

01951 {
01952     pCmdUI->Enable(!IsSmallIconView());
01953 }

void CGfxOutBarCtrl::PaintItems | ( | CDC * | pDC,
 |  | const int | iFolder,
 |  | CRect | rc
 | ) | [virtual]

Definition at line 1470 of file GfxOutBarCtrl.cpp.

Referenced by AnimateFolderScroll(), and OnPaint().

01471 {
01472     ASSERT(iFolder >= 0 && iFolder < GetFolderCount());
01473     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iFolder);
01474     int max = pbf->GetItemCount(), t;
01475     CRect irc;
01476     GetInsideRect(irc);
01477     int isdc = pDC->SaveDC();
01478     CRgn itemRegion;
01479     itemRegion.CreateRectRgnIndirect(&irc);
01480     pDC->SelectClipRgn(&itemRegion);
01481     itemRegion.DeleteObject();
01482     for (t = iFirstItem; t < max; t++)
01483     {
01484         CRect itemRc;
01485         GetItemRect(iFolder, t, itemRc);
01486         if (itemRc.top > rc.bottom) break;
01487         else DrawItem(pDC, iFolder, itemRc, t);
01488     }
01489     pDC->RestoreDC(isdc);
01490 }

void CGfxOutBarCtrl::RemoveFolder ( const int index ) [virtual]

Definition at line 1363 of file GfxOutBarCtrl.cpp.

Referenced by OnGfxRemoveitem().

01364 {
01365     ASSERT(index >= 0 && index < GetFolderCount());
01366     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(index);
01367     delete pbf;
01368     arFolder.RemoveAt(index);
01369     if (iSelFolder >= index) iSelFolder = index - 1;
01370     if (iSelFolder < 0 && GetFolderCount() > 0) iSelFolder = 0;
01371     Invalidate();
01372 }

void CGfxOutBarCtrl::RemoveItem ( const int index ) [virtual]

Definition at line 1988 of file GfxOutBarCtrl.cpp.

Referenced by OnGfxRemoveitem().

01989 {
01990     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
01991     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
01992     ASSERT(index >= 0 && index < pbf->GetItemCount());
01993     if (IsValidItem(index))
01994     {
01995         CBarItem * i = (CBarItem *) pbf->arItems.GetAt(index);
01996         delete i;
01997
01998         pbf->arItems.RemoveAt(index);
01999         CRect rc;
02000         GetInsideRect(rc);
02001         InvalidateRect(rc);
02002     }
02003 }

void CGfxOutBarCtrl::SetAnimSelHighlight ( const int iTime ) [virtual]

Definition at line 2339 of file GfxOutBarCtrl.cpp.

02340 {
02341     if (iTime <= 0) KillTimer(3);
02342     else SetTimer(3, iTime, NULL);
02343     iSelAnimTiming = iTime;
02344 }

virtual void CGfxOutBarCtrl::SetAnimationTickCount ( const long value ) [inline, virtual]

Definition at line 165 of file GfxOutBarCtrl.h.

00165 { lAnimationTickCount = value; };

CImageList * CGfxOutBarCtrl::SetFolderImageList | ( | const int | folder,
 |  | CImageList * | pImageList,
 |  | int | nImageList
 | ) | [virtual]

Definition at line 1426 of file GfxOutBarCtrl.cpp.

01427 {
01428     ASSERT(folder >= 0 && folder < GetFolderCount());
01429     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(folder);
01430     CImageList * o = NULL;
01431     if (nImageList == fSmallIcon)
01432     {
01433         o = pbf->pSmallImageList;
01434         pbf->pSmallImageList = pImageList;
01435     }
01436     else if (nImageList == fLargeIcon)
01437     {
01438         o = pbf->pLargeImageList;
01439         pbf->pLargeImageList = pImageList;
01440     }
01441     return o;
01442 }

void CGfxOutBarCtrl::SetFolderText | ( | const int | index,
 |  | LPCTSTR | text
 | ) | [virtual]

Definition at line 197 of file GfxOutBarCtrl.cpp.

00198 {
00199     ASSERT(index >= 0 && index < GetFolderCount());
00200
00201     CBarFolder* pbf = (CBarFolder *) arFolder.GetAt(index);
00202
00203     if( pbf->cName )
00204     {
00205         delete [] pbf->cName;
00206         pbf->cName = NULL;
00207     }
00208
00209     pbf->cName = new TCHAR[ _tcslen( text ) + 1 ];
00210
00211     _tcscpy( pbf->cName, text );
00212 }

CImageList * CGfxOutBarCtrl::SetImageList | ( | CImageList * | pImageList,
 |  | int | nImageList
 | ) | [virtual]

Definition at line 1403 of file GfxOutBarCtrl.cpp.

01404 {
01405     CImageList * o = NULL;
01406     if (nImageList == fSmallIcon)
01407     {
01408         o = pSmallImageList;
01409         pSmallImageList = pImageList;
01410     }
01411     else if (nImageList == fLargeIcon)
01412     {
01413         o = pLargeImageList;
01414         pLargeImageList = pImageList;
01415     }
01416     return o;
01417 }

void CGfxOutBarCtrl::SetItemData | ( | const int | index,
 |  | const DWORD | dwData
 | ) | [virtual]

Definition at line 2036 of file GfxOutBarCtrl.cpp.

02037 {
02038     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02039     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02040     if (IsValidItem(index))
02041     {
02042         CBarItem * i = (CBarItem *) pbf->arItems.GetAt(index);
02043         i->dwData = dwData;
02044     }
02045 }

void CGfxOutBarCtrl::SetItemImage | ( | const int | index,
 |  | const int | iImage
 | ) | [virtual]

Definition at line 2047 of file GfxOutBarCtrl.cpp.

02048 {
02049     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
02050     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
02051     if (IsValidItem(index))
02052     {
02053         CBarItem * i = (CBarItem *) pbf->arItems.GetAt(index);
02054         i->iImageIndex = iImage;
02055     }
02056 }

void CGfxOutBarCtrl::SetItemText | ( | const int | index,
 |  | LPCTSTR | text
 | ) | [virtual]

Definition at line 214 of file GfxOutBarCtrl.cpp.

00215 {
00216     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
00217
00218     CBarFolder* pbf = (CBarFolder*) arFolder.GetAt(iSelFolder);
00219
00220     CBarItem*   pi  = (CBarItem*) pbf->arItems.GetAt(index);
00221
00222     if (pi->cItem)
00223     {
00224         delete [] pi->cItem;
00225         pi->cItem = NULL;
00226     }
00227
00228     pi->cItem = new TCHAR[ _tcslen( text ) + 1 ];
00229
00230     _tcscpy( pi->cItem, text );
00231 }

void CGfxOutBarCtrl::SetSelFolder ( const int index ) [virtual]

Definition at line 1322 of file GfxOutBarCtrl.cpp.

Referenced by OnLButtonDown().

01323 {
01324     ASSERT(index >= 0 && index < GetFolderCount());
01325 //  if (index == iSelFolder) return;
01326
01327     CWnd * pc = GetFolderChild();
01328     if (pc) pc->ShowWindow(SW_HIDE);
01329
01330     if (index != iSelFolder)
01331     {
01332         if (dwFlags&fAnimation && lAnimationTickCount >= 0) AnimateFolderScroll(iSelFolder, index);
01333     }
01334
01335     iSelFolder = index;
01336     iFirstItem = 0;
01337     iLastSel = -1;
01338
01339     pc = GetFolderChild();
01340     if (pc)
01341     {
01342         CRect rc;
01343         GetInsideRect(rc);
01344         pc->MoveWindow(rc);
01345         pc->ShowWindow(SW_SHOW);
01346     }
01347
01348     GetOwner()->SendMessage(WM_OUTBAR_NOTIFY, NM_FOLDERCHANGE, (LPARAM) iSelFolder);
01349
01350     Invalidate();
01351 }

void CGfxOutBarCtrl::SetSmallIconView ( const bool bSet ) [virtual]

Definition at line 245 of file GfxOutBarCtrl.cpp.

Referenced by OnGfxLargeicon(), and OnGfxSmallicon().

00246 {
00247     iFirstItem = 0;
00248
00249     if (bSet)
00250     {
00251         if (!IsSmallIconView())
00252         {
00253             dwFlags |= fSmallIcon;
00254             CRect rc;
00255             GetInsideRect(rc);
00256             InvalidateRect(rc, false);
00257         }
00258     }
00259     else
00260     {
00261         if (IsSmallIconView())
00262         {
00263             dwFlags &= ~fSmallIcon;
00264             CRect rc;
00265             GetInsideRect(rc);
00266             InvalidateRect(rc, false);
00267         }
00268     }
00269 }

void CGfxOutBarCtrl::StartGroupEdit ( const int index ) [virtual]

Definition at line 1825 of file GfxOutBarCtrl.cpp.

Referenced by OnGfxRenameitem().

01826 {
01827     CGfxGroupEdit * pEdit = new CGfxGroupEdit;
01828     pEdit->iIndex = index;
01829     CRect rc;
01830     GetFolderRect(index, rc);
01831     rc.InflateRect(-2,-2);
01832     pEdit->Create(WS_CHILD|WS_VISIBLE|ES_CENTER|ES_MULTILINE,rc,this,1);
01833     pEdit->msgSend = NM_OB_ONGROUPENDEDIT;
01834     pEdit->ModifyStyleEx(0, WS_EX_CLIENTEDGE, SWP_FRAMECHANGED);
01835     ASSERT(index >= 0 && index < GetFolderCount());
01836     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(index);
01837     pEdit->SetWindowText(pbf->cName);
01838     pEdit->SetFocus();
01839 }

void CGfxOutBarCtrl::StartItemEdit ( const int index ) [virtual]

Definition at line 1841 of file GfxOutBarCtrl.cpp.

Referenced by OnGfxRenameitem().

01842 {
01843     ASSERT(iSelFolder >= 0 && iSelFolder < GetFolderCount());
01844     CBarFolder * pbf = (CBarFolder *) arFolder.GetAt(iSelFolder);
01845     ASSERT(index >= 0 && index < pbf->GetItemCount());
01846     CBarItem * pi = (CBarItem *) pbf->arItems.GetAt(index);
01847
01848     CGfxGroupEdit * pEdit = new CGfxGroupEdit;
01849     pEdit->iIndex = index;
01850     CRect rc, crc;
01851     GetLabelRect(iSelFolder, index, rc);
01852     GetInsideRect(crc);
01853
01854     DWORD dwFlag = WS_CHILD|WS_VISIBLE|WS_BORDER;
01855
01856     if (!IsSmallIconView())
01857     {
01858         rc.left = crc.left + 5;
01859         rc.right = crc.right - 5;
01860         rc.bottom += 5;
01861         dwFlag |= ES_CENTER|ES_MULTILINE;
01862     }
01863     else
01864     {
01865         CRect irc;
01866         GetIconRect(iSelFolder, index, irc);
01867         dwFlag |= ES_AUTOHSCROLL;
01868         rc.OffsetRect(irc.Width()+1, -6);
01869         pEdit->bNoDown = true;
01870     }
01871
01872     pEdit->Create(dwFlag, rc, this, 1);
01873     pEdit->msgSend = NM_OB_ONLABELENDEDIT;
01874
01875     pEdit->SetWindowText(pi->cItem);
01876     pEdit->SetFocus();
01877
01878 }

Member Data Documentation

CPtrArray CGfxOutBarCtrl::arFolder

Definition at line 97 of file GfxOutBarCtrl.h.

bool CGfxOutBarCtrl::bDownArrow

Definition at line 83 of file GfxOutBarCtrl.h.

bool CGfxOutBarCtrl::bDownPressed

Definition at line 83 of file GfxOutBarCtrl.h.

bool CGfxOutBarCtrl::bLooping

Definition at line 85 of file GfxOutBarCtrl.h.

bool CGfxOutBarCtrl::bPressedHighlight

Definition at line 104 of file GfxOutBarCtrl.h.

bool CGfxOutBarCtrl::bUpArrow

Definition at line 83 of file GfxOutBarCtrl.h.

bool CGfxOutBarCtrl::bUpPressed

Definition at line 83 of file GfxOutBarCtrl.h.

COLORREF CGfxOutBarCtrl::cr3dFace

Definition at line 76 of file GfxOutBarCtrl.h.

COLORREF CGfxOutBarCtrl::crBackGroundColor

Definition at line 74 of file GfxOutBarCtrl.h.

COLORREF CGfxOutBarCtrl::crBackGroundColor1

Definition at line 74 of file GfxOutBarCtrl.h.

COLORREF CGfxOutBarCtrl::crDkShadowBorder

Definition at line 76 of file GfxOutBarCtrl.h.

COLORREF CGfxOutBarCtrl::crHilightBorder

Definition at line 76 of file GfxOutBarCtrl.h.

COLORREF CGfxOutBarCtrl::crLightBorder

Definition at line 76 of file GfxOutBarCtrl.h.

COLORREF CGfxOutBarCtrl::crShadowBorder

Definition at line 76 of file GfxOutBarCtrl.h.

COLORREF CGfxOutBarCtrl::crTextColor

Definition at line 75 of file GfxOutBarCtrl.h.

DWORD CGfxOutBarCtrl::dwFlags

Definition at line 95 of file GfxOutBarCtrl.h.

HCURSOR CGfxOutBarCtrl::hDragCursor

Definition at line 139 of file GfxOutBarCtrl.h.

HCURSOR CGfxOutBarCtrl::hHandCursor

Definition at line 138 of file GfxOutBarCtrl.h.

HCURSOR CGfxOutBarCtrl::hNoDragCursor

Definition at line 140 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iFirstItem

Definition at line 101 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iFolderHeight

Definition at line 77 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iHitInternal1

Definition at line 87 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iHitInternal2

Definition at line 87 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iLastDragItemDraw

Definition at line 106 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iLastDragItemDrawType

Definition at line 106 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iLastFolderHighlighted

Definition at line 99 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iLastItemHighlighted

Definition at line 103 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iLastSel

Definition at line 91 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iLastSelectedFolder

Definition at line 100 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iSelAnimCount

Definition at line 92 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iSelAnimTiming

Definition at line 91 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::iSelFolder

Definition at line 133 of file GfxOutBarCtrl.h.

long CGfxOutBarCtrl::lAnimationTickCount

Definition at line 89 of file GfxOutBarCtrl.h.

CCJMenu CGfxOutBarCtrl::m_popupMenu

Definition at line 144 of file GfxOutBarCtrl.h.

CString CGfxOutBarCtrl::m_strRemoveItem

Definition at line 145 of file GfxOutBarCtrl.h.

CString CGfxOutBarCtrl::m_strRenameItem

Definition at line 146 of file GfxOutBarCtrl.h.

CPen* CGfxOutBarCtrl::pBlackPen

Definition at line 142 of file GfxOutBarCtrl.h.

CImageList* CGfxOutBarCtrl::pLargeImageList

Definition at line 135 of file GfxOutBarCtrl.h.

CImageList* CGfxOutBarCtrl::pSmallImageList

Definition at line 136 of file GfxOutBarCtrl.h.

CRect CGfxOutBarCtrl::rcDownArrow

Definition at line 84 of file GfxOutBarCtrl.h.

CRect CGfxOutBarCtrl::rcUpArrow

Definition at line 84 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::xLeftMargin

Definition at line 82 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::xSmallIconLabelOffset

Definition at line 79 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::yLargeIconLabelOffset

Definition at line 79 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::yLargeIconSpacing

Definition at line 80 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::ySmallIconSpacing

Definition at line 80 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::yTopMargin

Definition at line 82 of file GfxOutBarCtrl.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/GfxOutBarCtrl.h
  • WinCvs/CJLib/CJLibrary/GfxOutBarCtrl.cpp
Generated on Sun Oct 21 12:47:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CGfxOutBarCtrl::CBarFolder Class Reference

#include <GfxOutBarCtrl.h>

Collaboration diagram for CGfxOutBarCtrl::CBarFolder:

[legend]
List of all members.

Public Methods

CBarFolder (LPCTSTR name, DWORD exData)
virtual | ~CBarFolder ()
int | GetItemCount ()
int | InsertItem (int index, LPCTSTR text, const int image, const DWORD exData)

Public Attributes

LPTSTR | cName
DWORD | dwData
CImageList * | pLargeImageList
CImageList * | pSmallImageList
CPtrArray | arItems
CWnd * pChild

Constructor & Destructor Documentation

CGfxOutBarCtrl::CBarFolder::CBarFolder | ( | LPCTSTR | name,
 |  | DWORD | exData
 | ) |

Definition at line 601 of file GfxOutBarCtrl.cpp.

00602 {
00603     cName  = NULL;
00604     dwData = exData;
00605
00606     if( name )
00607     {
00608         cName = new TCHAR[ _tcslen( name ) + 1 ];
00609
00610         ASSERT(cName);
00611
00612         _tcscpy( cName, name );
00613     }
00614
00615     pLargeImageList = NULL;
00616     pSmallImageList = NULL;
00617     pChild          = NULL;
00618 }

CGfxOutBarCtrl::CBarFolder::~CBarFolder ( ) [virtual]

Definition at line 620 of file GfxOutBarCtrl.cpp.

00621 {
00622     if (cName) delete [] cName;
00623     for (int t = 0; t < arItems.GetSize(); t++)
00624         if (arItems.GetAt(t)) delete (CBarFolder*) arItems.GetAt(t);
00625
00626     arItems.RemoveAll();
00627 }

Member Function Documentation

int CGfxOutBarCtrl::CBarFolder::GetItemCount ( )

Definition at line 1465 of file GfxOutBarCtrl.cpp.

Referenced by InsertItem().

01466 {
01467     return arItems.GetSize();
01468 }

int CGfxOutBarCtrl::CBarFolder::InsertItem | ( | int | index,
 |  | LPCTSTR | text,
 |  | const int | image,
 |  | const DWORD | exData
 | ) |

Definition at line 1374 of file GfxOutBarCtrl.cpp.

01375 {
01376     if (index < 0 || index > GetItemCount()) index = GetItemCount();
01377
01378     int c = GetItemCount();
01379
01380     CBarItem* pbf = new CBarItem(text, image, exData);
01381
01382     ASSERT(pbf);
01383
01384     if( index < GetItemCount())
01385     {
01386         arItems.InsertAt(index, (void *) pbf);
01387     }
01388     else
01389     {
01390         arItems.Add((void *) pbf);
01391     }
01392
01393     c = GetItemCount();
01394
01395     return index;
01396 }

Member Data Documentation

CPtrArray CGfxOutBarCtrl::CBarFolder::arItems

Definition at line 129 of file GfxOutBarCtrl.h.

LPTSTR CGfxOutBarCtrl::CBarFolder::cName

Definition at line 125 of file GfxOutBarCtrl.h.

DWORD CGfxOutBarCtrl::CBarFolder::dwData

Definition at line 126 of file GfxOutBarCtrl.h.

CWnd* CGfxOutBarCtrl::CBarFolder::pChild

Definition at line 130 of file GfxOutBarCtrl.h.

CImageList* CGfxOutBarCtrl::CBarFolder::pLargeImageList

Definition at line 127 of file GfxOutBarCtrl.h.

CImageList* CGfxOutBarCtrl::CBarFolder::pSmallImageList

Definition at line 128 of file GfxOutBarCtrl.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/GfxOutBarCtrl.h
  • WinCvs/CJLib/CJLibrary/GfxOutBarCtrl.cpp
Generated on Sun Oct 21 12:47:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CGfxOutBarCtrl::CBarItem Class Reference

#include <GfxOutBarCtrl.h>

Collaboration diagram for CGfxOutBarCtrl::CBarItem:

[legend]
List of all members.

Public Methods

CBarItem (LPCTSTR name, const int image, DWORD exData)
virtual | ~CBarItem ()

Public Attributes

int | iImageIndex
LPTSTR | cItem
DWORD | dwData

Constructor & Destructor Documentation

CGfxOutBarCtrl::CBarItem::CBarItem | ( | LPCTSTR | name,
 |  | const int | image,
 |  | DWORD | exData
 | ) |

Definition at line 1444 of file GfxOutBarCtrl.cpp.

01445 {
01446     cItem       = NULL;
01447     iImageIndex = image;
01448     dwData      = exData;
01449
01450     if( name )
01451     {
01452         cItem = new TCHAR[ _tcslen( name ) + 1 ];
01453
01454         ASSERT(cItem);
01455
01456         _tcscpy( cItem, name );
01457     }
01458 }

CGfxOutBarCtrl::CBarItem::~CBarItem ( ) [virtual]

Definition at line 1460 of file GfxOutBarCtrl.cpp.

01461 {
01462     if (cItem) delete [] cItem;
01463 }

Member Data Documentation

LPTSTR CGfxOutBarCtrl::CBarItem::cItem

Definition at line 114 of file GfxOutBarCtrl.h.

DWORD CGfxOutBarCtrl::CBarItem::dwData

Definition at line 115 of file GfxOutBarCtrl.h.

int CGfxOutBarCtrl::CBarItem::iImageIndex

Definition at line 113 of file GfxOutBarCtrl.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/GfxOutBarCtrl.h
  • WinCvs/CJLib/CJLibrary/GfxOutBarCtrl.cpp
Generated on Sun Oct 21 12:47:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CGfxSplitterWnd Class Reference

#include <GfxSplitterWnd.h>

Inheritance diagram for CGfxSplitterWnd:

[legend]
Collaboration diagram for CGfxSplitterWnd:

[legend]
List of all members.

Public Methods

CGfxSplitterWnd ()
virtual | ~CGfxSplitterWnd ()
virtual void | OnDrawSplitter (CDC *pDC, ESplitType nType, const CRect &rectArg)
virtual void | OnInvertTracker (const CRect &rect)
virtual void | RecalcLayout ()

Public Attributes

int | m_upBorder
bool | bWhiteLine

Protected Methods

virtual void | GetInsideRect (CRect &rect) const
afx_msg BOOL | OnEraseBkgnd (CDC *pDC)
afx_msg void | OnPaint ()

Constructor & Destructor Documentation

CGfxSplitterWnd::CGfxSplitterWnd ( )

Definition at line 62 of file GfxSplitterWnd.cpp.

00063 {
00064     m_cxBorder = 0;
00065     m_cyBorder = 0;
00066     m_cxSplitter = m_cySplitter = 2 + 2;
00067     m_cxSplitterGap = m_cySplitterGap = 2 + 2;
00068
00069
00070     DWORD dwVersion = ::GetVersion();
00071     BOOL bWin4 = (BYTE)dwVersion >= 4;
00072     bNotWin4 = 1 - bWin4;   // for convenience
00073
00074     m_upBorder = 5;
00075     bWhiteLine = false;
00076 }

CGfxSplitterWnd::~CGfxSplitterWnd ( ) [virtual]

Definition at line 78 of file GfxSplitterWnd.cpp.

00079 {
00080
00081 }

Member Function Documentation

void CGfxSplitterWnd::GetInsideRect ( CRect & rect ) const [protected, virtual]

Definition at line 364 of file GfxSplitterWnd.cpp.

Referenced by RecalcLayout().

00365 {
00366     CSplitterWnd::GetInsideRect(rect);
00367     rect.top += m_upBorder;
00368 /*  ASSERT_VALID(this);
00369
00370     GetClientRect(rect);
00371     ASSERT(rect.left == 0 && rect.top == 0);
00372
00373     // subtract space for 3d borders
00374     rect.InflateRect(-m_cxBorder, -m_cyBorder);
00375     rect.top += m_upBorder;
00376
00377     // subtract scrollbar clearance
00378     if (m_bHasVScroll)
00379         rect.right -= GetSystemMetrics(SM_CXVSCROLL);
00380     if (m_bHasHScroll)
00381         rect.bottom -= GetSystemMetrics(SM_CYHSCROLL);*/
00382 }

void CGfxSplitterWnd::OnDrawSplitter | ( | CDC * | pDC,
 |  | ESplitType | nType,
 |  | const CRect & | rectArg
 | ) | [virtual]

Definition at line 83 of file GfxSplitterWnd.cpp.

00084 {
00085     if (pDC == NULL)
00086     {
00087         RedrawWindow(rectArg, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
00088         return;
00089     }
00090     ASSERT_VALID(pDC);
00091     CRect rect = rectArg;
00092     switch (nType)
00093     {
00094     case splitBorder:
00095         return;
00096     case splitBox:
00097         pDC->Draw3dRect(rect, GetSysColor(COLOR_3DFACE), GetSysColor(COLOR_WINDOWFRAME));
00098         rect.InflateRect(-CX_BORDER, -CY_BORDER);
00099         pDC->Draw3dRect(rect, GetSysColor(COLOR_BTNHIGHLIGHT), GetSysColor(COLOR_BTNSHADOW));
00100         rect.InflateRect(-CX_BORDER, -CY_BORDER);
00101         break;
00102     }
00103
00104     COLORREF clr = GetSysColor(COLOR_3DFACE);
00105     pDC->FillSolidRect(rect, clr);
00106 }

BOOL CGfxSplitterWnd::OnEraseBkgnd ( CDC * pDC ) [protected]

Definition at line 384 of file GfxSplitterWnd.cpp.

00385 {
00386 //  return CSplitterWnd::OnEraseBkgnd(pDC);
00387
00388     CRect rectClient;
00389     GetClientRect(rectClient);
00390     rectClient.InflateRect(-m_cxBorder, -m_cyBorder);
00391     rectClient.bottom = rectClient.top + m_upBorder;
00392     pDC->FillSolidRect(rectClient, GetSysColor(COLOR_3DFACE));
00393     return true;
00394 }

void CGfxSplitterWnd::OnInvertTracker ( const CRect & rect ) [virtual]

Definition at line 108 of file GfxSplitterWnd.cpp.

00109 {
00110     ASSERT_VALID(this);
00111     ASSERT(!rect.IsRectEmpty());
00112     ASSERT((GetStyle() & WS_CLIPCHILDREN) == 0);
00113
00114     CDC* pDC = GetDC();
00115     CBrush* pBrush = CDC::GetHalftoneBrush();
00116     CBrush* pOldBrush = NULL;
00117
00118     if (pBrush != NULL) {
00119         pOldBrush = pDC->SelectObject(pBrush);
00120     }
00121
00122     pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATINVERT);
00123
00124     if (pOldBrush != NULL) {
00125         pDC->SelectObject(pOldBrush);
00126     }
00127     ReleaseDC(pDC);
00128 }

void CGfxSplitterWnd::OnPaint ( ) [protected]

Definition at line 396 of file GfxSplitterWnd.cpp.

00397 {
00398     CSplitterWnd::OnPaint();
00399     if (bWhiteLine)
00400     {
00401         CClientDC dc(this);
00402         CRect rectClient;
00403         GetClientRect(rectClient);
00404         CPen pn(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
00405         CPen * op = dc.SelectObject(&pn);
00406         dc.MoveTo(rectClient.left, rectClient.top);
00407         dc.LineTo(rectClient.right, rectClient.top);
00408         CPen pn1(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
00409         dc.SelectObject(&pn1);
00410         dc.MoveTo(rectClient.left, rectClient.top+1);
00411         dc.LineTo(rectClient.right, rectClient.top+1);
00412         dc.SelectObject(op);
00413
00414         // fix potential resource leak - KStowell - 10-21-99
00415         pn.DeleteObject();
00416         pn1.DeleteObject();
00417     }
00418 }

void CGfxSplitterWnd::RecalcLayout ( ) [virtual]

Definition at line 256 of file GfxSplitterWnd.cpp.

00257 {
00258     ASSERT_VALID(this);
00259     ASSERT(m_nRows > 0 && m_nCols > 0); // must have at least one pane
00260
00261     CRect rectClient;
00262     GetClientRect(rectClient);
00263     rectClient.InflateRect(-m_cxBorder, -m_cyBorder);
00264     rectClient.top += m_upBorder;
00265
00266     CRect rectInside;
00267     GetInsideRect(rectInside);
00268
00269     // layout columns (restrict to possible sizes)
00270     LayoutRowCol(m_pColInfo, m_nCols, rectInside.Width(), m_cxSplitterGap);
00271     LayoutRowCol(m_pRowInfo, m_nRows, rectInside.Height(), m_cySplitterGap);
00272
00273     // adjust the panes (and optionally scroll bars)
00274
00275     // give the hint for the maximum number of HWNDs
00276     AFX_SIZEPARENTPARAMS layout;
00277     layout.hDWP = ::BeginDeferWindowPos((m_nCols + 1) * (m_nRows + 1) + 1);
00278
00279     // size of scrollbars
00280     int cx = (rectClient.right - rectInside.right - bNotWin4);// - afxData.bNotWin4;
00281     int cy = (rectClient.bottom - rectInside.bottom - bNotWin4);// - afxData.bNotWin4;
00282
00283     // reposition size box
00284     if (m_bHasHScroll && m_bHasVScroll)
00285     {
00286         CWnd* pScrollBar = GetDlgItem(AFX_IDW_SIZE_BOX);
00287         ASSERT(pScrollBar != NULL);
00288
00289         // fix style if necessary
00290         BOOL bSizingParent = (GetSizingParent() != NULL);
00291         // modifyStyle returns TRUE if style changes
00292         if (pScrollBar->ModifyStyle(SBS_SIZEGRIP|SBS_SIZEBOX,
00293                 bSizingParent ? SBS_SIZEGRIP : SBS_SIZEBOX))
00294             pScrollBar->Invalidate();
00295         pScrollBar->EnableWindow(bSizingParent);
00296
00297         // reposition the size box
00298         DeferClientPos(&layout, pScrollBar,
00299             rectInside.right + bNotWin4,
00300             rectInside.bottom + bNotWin4, cx, cy, TRUE);
00301     }
00302
00303     // reposition scroll bars
00304     if (m_bHasHScroll)
00305     {
00306         int cxSplitterBox = m_cxSplitter + bNotWin4;// split box bigger
00307         int x = rectClient.left;
00308         int y = rectInside.bottom + bNotWin4;
00309         for (int col = 0; col < m_nCols; col++)
00310         {
00311             CWnd* pScrollBar = GetDlgItem(AFX_IDW_HSCROLL_FIRST + col);
00312             ASSERT(pScrollBar != NULL);
00313             int cx = m_pColInfo[col].nCurSize;
00314             if (col == 0 && m_nCols < m_nMaxCols)
00315                 x += cxSplitterBox, cx -= cxSplitterBox;
00316             DeferClientPos(&layout, pScrollBar, x, y, cx, cy, TRUE);
00317             x += cx + m_cxSplitterGap;
00318         }
00319     }
00320
00321     if (m_bHasVScroll)
00322     {
00323         int cySplitterBox = m_cySplitter + bNotWin4;// split box bigger
00324         int x = rectInside.right + bNotWin4;
00325         int y = rectClient.top;
00326         for (int row = 0; row < m_nRows; row++)
00327         {
00328             CWnd* pScrollBar = GetDlgItem(AFX_IDW_VSCROLL_FIRST + row);
00329             ASSERT(pScrollBar != NULL);
00330             int cy = m_pRowInfo[row].nCurSize;
00331             if (row == 0 && m_nRows < m_nMaxRows)
00332                 y += cySplitterBox, cy -= cySplitterBox;
00333             DeferClientPos(&layout, pScrollBar, x, y, cx, cy, TRUE);
00334             y += cy + m_cySplitterGap;
00335         }
00336     }
00337
00338     //BLOCK: Reposition all the panes
00339     {
00340         int x = rectClient.left;
00341         for (int col = 0; col < m_nCols; col++)
00342         {
00343             int cx = m_pColInfo[col].nCurSize;
00344             int y = rectClient.top;
00345             for (int row = 0; row < m_nRows; row++)
00346             {
00347                 int cy = m_pRowInfo[row].nCurSize;
00348                 CWnd* pWnd = GetPane(row, col);
00349                 DeferClientPos(&layout, pWnd, x, y, cx, cy, FALSE);
00350                 y += cy + m_cySplitterGap;
00351             }
00352             x += cx + m_cxSplitterGap;
00353         }
00354     }
00355
00356     // move and resize all the windows at once!
00357     if (layout.hDWP == NULL || !::EndDeferWindowPos(layout.hDWP))
00358         TRACE0("Warning: DeferWindowPos failed - low system resources.\n");
00359
00360     // invalidate all the splitter bars (with NULL pDC)
00361     DrawAllSplitBars(NULL, rectInside.right, rectInside.bottom);
00362 }

Member Data Documentation

bool CGfxSplitterWnd::bWhiteLine

Definition at line 40 of file GfxSplitterWnd.h.

int CGfxSplitterWnd::m_upBorder

Definition at line 39 of file GfxSplitterWnd.h.

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/GfxSplitterWnd.h
  • WinCvs/CJLib/CJLibrary/GfxSplitterWnd.cpp
Generated on Sun Oct 21 12:47:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GPT_CONSOLE Struct Reference

#include <cvsgui_protocol.h>

Collaboration diagram for GPT_CONSOLE:

[legend]
List of all members.

Public Attributes

guint8 isStderr
guint32 len
char * str

Member Data Documentation

guint8 GPT_CONSOLE::isStderr

Definition at line 52 of file cvsgui_protocol.h.

Referenced by _gp_console_read(), _gp_console_write(), cvs_process_handle_message(), and gp_console_write().

guint32 GPT_CONSOLE::len

Definition at line 53 of file cvsgui_protocol.h.

Referenced by _gp_console_read(), _gp_console_write(), cvs_process_handle_message(), and gp_console_write().

char* GPT_CONSOLE::str

Definition at line 54 of file cvsgui_protocol.h.

Referenced by _gp_console_destroy(), _gp_console_read(), _gp_console_write(), cvs_process_handle_message(), and gp_console_write().

The documentation for this struct was generated from the following file:
  • common/cvsgui_protocol.h
Generated on Sun Oct 21 12:47:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GPT_GETENV Struct Reference

#include <cvsgui_protocol.h>

Collaboration diagram for GPT_GETENV:

[legend]
List of all members.

Public Attributes

guint8 empty
char * str

Member Data Documentation

guint8 GPT_GETENV::empty

Definition at line 46 of file cvsgui_protocol.h.

Referenced by _gp_getenv_read(), _gp_getenv_write(), gp_getenv_read(), and gp_getenv_write().

char* GPT_GETENV::str

Definition at line 47 of file cvsgui_protocol.h.

Referenced by _gp_getenv_destroy(), _gp_getenv_read(), _gp_getenv_write(), cvs_process_handle_message(), gp_getenv_read(), and gp_getenv_write().

The documentation for this struct was generated from the following file:
  • common/cvsgui_protocol.h
Generated on Sun Oct 21 12:47:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


GPT_QUIT Struct Reference

#include <cvsgui_protocol.h>

Collaboration diagram for GPT_QUIT:

[legend]
List of all members.

Public Attributes

gint32 code

Member Data Documentation

gint32 GPT_QUIT::code

Definition at line 41 of file cvsgui_protocol.h.

Referenced by _gp_quit_read(), _gp_quit_write(), cvs_process_handle_message(), and gp_quit_write().

The documentation for this struct was generated from the following file:
  • common/cvsgui_protocol.h
Generated on Sun Oct 21 12:47:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CGraphConsole Class Reference

Inheritance diagram for CGraphConsole:

[legend]
Collaboration diagram for CGraphConsole:

[legend]
List of all members.

Public Methods

CGraphConsole ()
virtual long | cvs_out (char *txt, long len)
virtual long | cvs_err (char *txt, long len)

Public Attributes

CWincvsView * view

Constructor & Destructor Documentation

CGraphConsole::CGraphConsole ( ) [inline]

Definition at line 1079 of file GraphView.cpp.

01080     {
01081         CWincvsApp *app = (CWincvsApp *)AfxGetApp();
01082         view = app->GetConsoleView();
01083     }

Member Function Documentation

virtual long CGraphConsole::cvs_err | ( | char * | txt,
 |  | long | len
 | ) | [inline, virtual]

Reimplemented from CCvsConsole.

Definition at line 1092 of file GraphView.cpp.

01093     {
01094         if(view != 0L)
01095             view->OutConsole(txt, len, true);
01096         return  len;
01097     }

virtual long CGraphConsole::cvs_out | ( | char * | txt,
 |  | long | len
 | ) | [inline, virtual]

Reimplemented from CCvsConsole.

Definition at line 1085 of file GraphView.cpp.

01086     {
01087         if(view != 0L)
01088             view->OutConsole(txt, len);
01089         return  len;
01090     }

Member Data Documentation

CWincvsView* CGraphConsole::view

Definition at line 1099 of file GraphView.cpp.

The documentation for this class was generated from the following file:
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:47:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CGraphDoc Class Reference

#include <GraphDoc.h>

Inheritance diagram for CGraphDoc:

[legend]
Collaboration diagram for CGraphDoc:

[legend]
List of all members.

Public Methods

void | SetNode (CLogNode *node, const char *dir)
CLogNode * | GetNode (void)
EntnodeData * | GetEntryInfo (void)
const char * | GetDir (void) const
const char * | GetName (void) const
CGraphView * | GetTreeView (void)
virtual BOOL | OnNewDocument ()
virtual void | Serialize (CArchive &ar)
virtual | ~CGraphDoc ()

Protected Methods

CGraphDoc ()
void | PrepareNew (void)
afx_msg long | NumNodes ()

Protected Attributes

CLogNode * fNode
CString | fDir
CString | fName
EntnodeData * fData

Constructor & Destructor Documentation

CGraphDoc::CGraphDoc ( ) [protected]

Definition at line 78 of file GraphDoc.cpp.

00079 {
00080     EnableAutomation();
00081
00082     AfxOleLockApp();
00083
00084     fNode = 0L;
00085     fData = 0L;
00086 }

CGraphDoc::~CGraphDoc ( ) [virtual]

Definition at line 88 of file GraphDoc.cpp.

00089 {
00090     AfxOleUnlockApp();
00091
00092     PrepareNew();
00093 }

Member Function Documentation

const char* CGraphDoc::GetDir ( void ) const [inline]

Definition at line 49 of file GraphDoc.h.

Referenced by CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnQueryAnnotate(), CGraphView::OnViewDelrev(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewReload(), CGraphView::OnViewRetrieve(), CGraphView::OnViewTag(), CGraphView::OnViewUnlockf(), and CGraphView::OnViewUpdate().

00049 { return fDir; }

EntnodeData* CGraphDoc::GetEntryInfo ( void ) [inline]

Definition at line 48 of file GraphDoc.h.

Referenced by CGraphView::CalcImageSize(), CGraphView::OnBeginPrinting(), CGraphView::OnDraw(), and CGraphView::OnPrint().

00048 { return fData; }

const char* CGraphDoc::GetName ( void ) const [inline]

Definition at line 50 of file GraphDoc.h.

Referenced by CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnQueryAnnotate(), CGraphView::OnViewDelrev(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewReload(), CGraphView::OnViewRetrieve(), CGraphView::OnViewTag(), CGraphView::OnViewUnlockf(), and CGraphView::OnViewUpdate().

00050 { return fName; }

CLogNode* CGraphDoc::GetNode ( void ) [inline]

Definition at line 47 of file GraphDoc.h.

Referenced by CGraphView::CalcImageSize(), CGraphView::DisableCommon(), CGraphView::IsSelSingleNode(), CGraphView::OnBeginPrinting(), CGraphView::OnContextMenu(), CGraphView::OnDraw(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnLButtonDown(), CGraphView::OnPrint(), CGraphView::OnQueryAnnotate(), CGraphView::OnUpdateViewDelrev(), CGraphView::OnUpdateViewDiff(), CGraphView::OnUpdateViewTag(), CGraphView::OnViewDelrev(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewReload(), CGraphView::OnViewRetrieve(), CGraphView::OnViewSelnonsig(), CGraphView::OnViewTag(), CGraphView::OnViewUnlockf(), and CGraphView::OnViewUpdate().

00047 { return fNode; }

CGraphView * CGraphDoc::GetTreeView ( void )

Definition at line 201 of file GraphDoc.cpp.

Referenced by SetNode().

00202 {
00203     POSITION posv = GetFirstViewPosition();
00204     CView* view;
00205     while(posv != NULL)
00206     {
00207         view = GetNextView(posv);
00208         if(view->IsKindOf(RUNTIME_CLASS(CGraphView)))
00209             return (CGraphView *)view;
00210     }
00211     return NULL;
00212 }

long CGraphDoc::NumNodes ( ) [protected]

Definition at line 232 of file GraphDoc.cpp.

00233 {
00234     return 0;
00235 }

BOOL CGraphDoc::OnNewDocument ( ) [virtual]

Definition at line 111 of file GraphDoc.cpp.

00112 {
00113     PrepareNew();
00114
00115     if (!CDocument::OnNewDocument())
00116         return FALSE;
00117
00118     return TRUE;
00119 }

void CGraphDoc::PrepareNew ( void ) [protected]

Definition at line 95 of file GraphDoc.cpp.

Referenced by OnNewDocument(), SetNode(), and ~CGraphDoc().

00096 {
00097     if(fNode != 0L)
00098     {
00099         delete fNode;
00100         fNode = 0L;
00101     }
00102     if(fData != 0L)
00103     {
00104         fData->UnRef();
00105         fData = 0L;
00106     }
00107     fDir.Empty();
00108     fName.Empty();
00109 }

void CGraphDoc::Serialize ( CArchive & ar ) [virtual]

Definition at line 189 of file GraphDoc.cpp.

00190 {
00191     if (ar.IsStoring())
00192     {
00193         // TODO: add storing code here
00194     }
00195     else
00196     {
00197         // TODO: add loading code here
00198     }
00199 }

void CGraphDoc::SetNode | ( | CLogNode * | node,
 |  | const char * | folder
 | ) |

Definition at line 134 of file GraphDoc.cpp.

Referenced by CvsLogParse().

00135 {
00136     PrepareNew();
00137
00138     // normalize folder/fname since the latter can be a path relative to folder
00139     const char *fn = (**(CLogNodeHeader *)node).WorkingFile();
00140     char dir[_MAX_PATH];
00141     char name[_MAX_PATH];
00142     NormalizeFn(folder, fn, dir, name);
00143
00144     fNode = node;
00145     fDir = dir;
00146
00147     // get the CVS/Entries infos for this file
00148     CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00149     if(!Entries_Open (entries, dir))
00150     {
00151         cvs_err("Warning : Error while accessing the CVS folder in '%s'\n", dir);
00152     }
00153     else
00154     {
00155         if(node->GetType() != kNodeHeader)
00156         {
00157             cvs_err("Warning : Top node is not a RCS file description !\n");
00158         }
00159         else
00160         {
00161             struct stat sb;
00162             if (stat(fn, &sb) == -1)    //JK - used to be "name", fix for the flat mode
00163             {
00164                 cvs_err("Warning : Unknown file '%s'\n", name);
00165             }
00166             else
00167             {
00168                 fData = Entries_SetVisited(dir, entries, name, sb, false);
00169                 fData->Ref();
00170                 fName = name;
00171             }
00172         }
00173     }
00174
00175     // create the graph and redraw
00176     CGraphView *view = GetTreeView();
00177     if(view != 0L)
00178     {
00179         view->CalcImageSize();
00180         view->Invalidate();
00181         SetTitle(fName);
00182     }
00183 }

Member Data Documentation

EntnodeData* CGraphDoc::fData [protected]

Definition at line 79 of file GraphDoc.h.

CString CGraphDoc::fDir [protected]

Definition at line 77 of file GraphDoc.h.

CString CGraphDoc::fName [protected]

Definition at line 78 of file GraphDoc.h.

CLogNode* CGraphDoc::fNode [protected]

Definition at line 76 of file GraphDoc.h.

The documentation for this class was generated from the following files:
  • WinCvs/GraphDoc.h
  • WinCvs/GraphDoc.cpp
Generated on Sun Oct 21 12:47:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CGraphFrame Class Reference

#include <GraphFrm.h>

Inheritance diagram for CGraphFrame:

[legend]
Collaboration diagram for CGraphFrame:

[legend]
List of all members.

Public Methods

CGraphFrame ()
virtual BOOL | OnCmdMsg (UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo)
virtual | ~CGraphFrame ()

Constructor & Destructor Documentation

CGraphFrame::CGraphFrame ( )

Definition at line 53 of file GraphFrm.cpp.

00054 {
00055     // TODO: add member initialization code here
00056
00057 }

CGraphFrame::~CGraphFrame ( ) [virtual]

Definition at line 59 of file GraphFrm.cpp.

00060 {
00061 }

Member Function Documentation

BOOL CGraphFrame::OnCmdMsg | ( | UINT | nID,
 |  | int | nCode,
 |  | void * | pExtra,
 |  | AFX_CMDHANDLERINFO * | pHandlerInfo
 | ) | [virtual]

Definition at line 82 of file GraphFrm.cpp.

00083 {
00084     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00085     if(app->GetMainFrame()->OnBroadcastCmdMsg(nID, nCode, pExtra, pHandlerInfo))
00086         return TRUE;
00087
00088     return CCJMDIChildWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
00089 }

The documentation for this class was generated from the following files:
  • WinCvs/GraphFrm.h
  • WinCvs/GraphFrm.cpp
Generated on Sun Oct 21 12:47:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CGraphRectTracker Class Reference

Inheritance diagram for CGraphRectTracker:

[legend]
Collaboration diagram for CGraphRectTracker:

[legend]
List of all members.

Public Methods

CGraphRectTracker (CGraphView *view)
virtual void OnChangedRect (const CRect &rectOld)

Protected Attributes

CGraphView * mView

Constructor & Destructor Documentation

CGraphRectTracker::CGraphRectTracker ( CGraphView * view ) [inline]

Definition at line 873 of file GraphView.cpp.

00873 : mView(view) {}

Member Function Documentation

void CGraphRectTracker::OnChangedRect ( const CRect & rectOld ) [virtual]

Definition at line 880 of file GraphView.cpp.

00881 {
00882 #if 0 // :-< doesn't work...
00883     CRect r;
00884     mView->GetClientRect(&r);
00885     CPoint rb = m_rect.BottomRight();
00886
00887     if(!r.PtInRect(rb))
00888     {
00889         CPoint orig = mView->GetDeviceScrollPosition();
00890         CPoint offset;
00891         if(rb.x >= r.right)
00892             offset.x += 10;
00893         if(rb.y >= r.bottom)
00894             offset.y += 10;
00895         orig += offset;
00896         m_rect -= offset;
00897         mView->ScrollToPosition(orig);
00898     }
00899 #endif
00900 }

Member Data Documentation

CGraphView* CGraphRectTracker::mView [protected]

Definition at line 877 of file GraphView.cpp.

The documentation for this class was generated from the following file:
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:47:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CGraphView Class Reference

#include <GraphView.h>

Inheritance diagram for CGraphView:

[legend]
Collaboration diagram for CGraphView:

[legend]
List of all members.

Public Methods

void | CalcImageSize (void)

Static Public Methods

CImageList & | GetImgList (void)

Protected Methods

CGraphView ()
virtual void | OnDraw (CDC *pDC)
virtual void | OnInitialUpdate ()
virtual void | OnBeginPrinting (CDC *pDC, CPrintInfo *pInfo)
virtual void | OnEndPrinting (CDC *pDC, CPrintInfo *pInfo)
virtual BOOL | OnPreparePrinting (CPrintInfo *pInfo)
virtual void | OnPrint (CDC *pDC, CPrintInfo *pInfo)
bool | DisableCommon ()
bool | IsSelSingleNode (kLogNode type, bool equal=true)
virtual | ~CGraphView ()
void | OnInitMenuPopup (CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnViewReload ()
afx_msg void | OnUpdateViewReload (CCmdUI *pCmdUI)
afx_msg void | OnViewDiff ()
afx_msg void | OnUpdateViewDiff (CCmdUI *pCmdUI)
afx_msg void | OnViewUpdate ()
afx_msg void | OnUpdateViewUpdate (CCmdUI *pCmdUI)
afx_msg void | OnViewTag ()
afx_msg void | OnUpdateViewTag (CCmdUI *pCmdUI)
afx_msg void | OnViewDelrev ()
afx_msg void | OnUpdateViewDelrev (CCmdUI *pCmdUI)
afx_msg void | OnViewSelnonsig ()
afx_msg void | OnUpdateViewSelnonsig (CCmdUI *pCmdUI)
afx_msg void | OnViewRetrieve ()
afx_msg void | OnUpdateViewRetrieve (CCmdUI *pCmdUI)
afx_msg void | DisableUpdate (CCmdUI *pCmdUI)
afx_msg void | OnContextMenu (CWnd *pWnd, CPoint point)
afx_msg void | OnQueryAnnotate ()
afx_msg void | OnUpdateQueryAnnotate (CCmdUI *pCmdUI)
afx_msg void | OnGraphGraphoptions ()
afx_msg void | OnUpdateGraphChangelogmessage (CCmdUI *pCmdUI)
afx_msg void | OnGraphChangelogmessage ()
afx_msg void | OnUpdateGraphSetdescription (CCmdUI *pCmdUI)
afx_msg void | OnGraphSetdescription ()
afx_msg void | OnGraphSetstate ()
afx_msg void | OnUpdateGraphSetstate (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewLockf (CCmdUI *pCmdUI)
afx_msg void | OnViewLockf ()
afx_msg void | OnUpdateViewUnlockf (CCmdUI *pCmdUI)
afx_msg void | OnViewUnlockf ()

Protected Attributes

bool | fFirstTime
int | m_numberOfPages
int | m_pageHeight

Static Protected Attributes

CImageList | m_ImageList

Constructor & Destructor Documentation

CGraphView::CGraphView ( ) [protected]

Definition at line 61 of file GraphView.cpp.

00062 {
00063     fFirstTime = true;
00064     if(m_ImageList.m_hImageList == 0L)
00065         m_ImageList.Create(IDB_SMALLICONS, 16, 1, RGB(255, 255, 255));
00066 }

CGraphView::~CGraphView ( ) [protected, virtual]

Definition at line 68 of file GraphView.cpp.

00069 {
00070 }

Member Function Documentation

void CGraphView::CalcImageSize ( void )

Definition at line 810 of file GraphView.cpp.

Referenced by OnEndPrinting(), and CGraphDoc::SetNode().

00811 {
00812     const CPoint startPoint(STARTPOINT_PT);
00813     CWindowDC dc(this);
00814     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
00815     CLogNode *root = pDoc->GetNode();
00816     if(root == 0L)
00817         return;
00818
00819     // set all the bounds locations
00820     CWinLogData *data = CWinLogData::CreateNewData(root);
00821     root->SetUserData(data);
00822     data->ComputeBounds(startPoint, dc, pDoc->GetEntryInfo());
00823
00824     // reoffset from (0, 0)
00825     CRect bounds = data->Bounds();
00826     data->Offset(startPoint - bounds.TopLeft());
00827     bounds = data->Bounds();
00828
00829     // set the scroll size, we add the margin of the start point offset on each side
00830     SetScrollSizes(MM_TEXT, bounds.Size() + CSize(startPoint)+CSize(startPoint)+CSize(SHADOW_OFFSET_PT));
00831 }

bool CGraphView::DisableCommon ( ) [protected]

Definition at line 1364 of file GraphView.cpp.

Referenced by OnContextMenu(), OnUpdateGraphChangelogmessage(), OnUpdateGraphSetdescription(), OnUpdateGraphSetstate(), OnUpdateQueryAnnotate(), OnUpdateViewDelrev(), OnUpdateViewDiff(), OnUpdateViewLockf(), OnUpdateViewReload(), OnUpdateViewRetrieve(), OnUpdateViewSelnonsig(), OnUpdateViewTag(), OnUpdateViewUnlockf(), and OnUpdateViewUpdate().

01365 {
01366     CWincvsApp *app = (CWincvsApp *)AfxGetApp();
01367     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01368     CLogNode *root = pDoc->GetNode();
01369     return root == 0L || root->GetUserData() == 0L || app->gCvsRunning || this != CWnd::GetFocus() || gCvsPrefs.empty();
01370 }

void CGraphView::DisableUpdate ( CCmdUI * pCmdUI ) [protected]

Definition at line 1591 of file GraphView.cpp.

01592 {
01593     pCmdUI->Enable(false);
01594 }

CImageList& CGraphView::GetImgList ( void ) [inline, static]

Definition at line 66 of file GraphView.h.

Referenced by CWinLogRevData::UpdateSelf().

00066 { return m_ImageList; }

bool CGraphView::IsSelSingleNode | ( | kLogNode | type,
 |  | bool | equal = true
 | ) | [protected]

Definition at line 1372 of file GraphView.cpp.

Referenced by OnUpdateGraphChangelogmessage(), OnUpdateGraphSetdescription(), OnUpdateGraphSetstate(), OnUpdateQueryAnnotate(), OnUpdateViewLockf(), OnUpdateViewRetrieve(), and OnUpdateViewUnlockf().

01373 {
01374     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01375     CLogNode *root = pDoc->GetNode();
01376
01377     TGraphCmdStatus trav;
01378     trav.TraverseGraph(root);
01379     return (trav.fCountSel == 1 &&
01380         (equal ? trav.fSel1->GetType() == type : trav.fSel1->GetType() != type));
01381 }

void CGraphView::OnBeginPrinting | ( | CDC * | pDC,
 |  | CPrintInfo * | pInfo
 | ) | [protected, virtual]

Definition at line 1297 of file GraphView.cpp.

01298 {
01299     // TODO: Add your specialized code here and/or call the base class
01300
01301     CScrollView::OnBeginPrinting(pDC, pInfo);
01302
01303     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01304     CLogNode *root = pDoc->GetNode();
01305     if(root == 0L)
01306         return;
01307
01308     // set all the bounds locations
01309     CWinLogData *data = CWinLogData::CreateNewData(root);
01310     root->SetUserData(data);
01311     CPoint start(0, 0);
01312     data->ComputeBounds(start, *pDC, pDoc->GetEntryInfo());
01313
01314     // compute the number of pages
01315     CRect bounds = data->Bounds();
01316     m_pageHeight = pDC->GetDeviceCaps(VERTRES);
01317     m_numberOfPages = bounds.Height() / m_pageHeight + 1;
01318
01319     pInfo->SetMaxPage(m_numberOfPages);
01320 }

void CGraphView::OnContextMenu | ( | CWnd * | pWnd,
 |  | CPoint | point
 | ) | [protected]

Definition at line 1596 of file GraphView.cpp.

01597 {
01598     //Comply with windows UI standard (Windows Explorer file view used as a reference),
01599     //change selections according to the state of Control and Shift keys
01600     BYTE abKeyboardState[256];
01601     BOOL bControlState = FALSE;
01602     BOOL bShiftState = FALSE;
01603     memset( abKeyboardState, 0, 256 );
01604
01605     if( GetKeyboardState(abKeyboardState) )
01606     {
01607         bControlState = abKeyboardState[VK_CONTROL] & 0x80;
01608         bShiftState = abKeyboardState[VK_SHIFT] & 0x80;
01609     }
01610
01611     if( (!bControlState || (bControlState && bShiftState)) && !DisableCommon() )
01612     {
01613         CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01614         CLogNode *root = pDoc->GetNode();
01615
01616         TGraphCmdStatus trav;
01617         trav.TraverseGraph(root);
01618
01619         CWinLogData *data = (CWinLogData *)root->GetUserData();
01620         CPoint hitPoint(point);
01621         ScreenToClient(&hitPoint);
01622         hitPoint += GetDeviceScrollPosition();
01623         CWinLogData *hit = data->HitTest(hitPoint);
01624
01625         if( hit != 0L )
01626         {
01627             if( trav.fCountSel == 0 )
01628             {
01629                 hit->SetSelected(this, true);
01630             }
01631             else if( trav.fCountSel >= 1 && trav.fSel1->GetType() != kNodeHeader )
01632             {
01633                 if( !(hit->Selected() && bShiftState) && !(bControlState && bShiftState && hit->Selected()) )
01634                 {
01635                     data->UnselectAll(this);
01636                 }
01637                 hit->SetSelected(this, true);
01638             }
01639         }
01640     }
01641
01642
01643
01644     // Get the menu to display from the main app window, which for graph view
01645     // will be IDR_GRAPH,  The submenu to display is the menu under "Graph".
01646     // Note that if the position of this menu changes, the index under
01647     // GetSubMenu must also change.
01648     CMenu* pMenu    = ::AfxGetMainWnd()->GetMenu();
01649     CMenu* pSubMenu = pMenu->GetSubMenu(5);
01650
01651     pSubMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,
01652         point.x, point.y, this);
01653 }

void CGraphView::OnDraw ( CDC * pDC ) [protected, virtual]

Definition at line 841 of file GraphView.cpp.

00842 {
00843     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
00844     CLogNode *root = pDoc->GetNode();
00845     if(root == 0L || root->GetUserData() == 0L)
00846         return;
00847
00848     CWinLogData *data = (CWinLogData *)root->GetUserData();
00849
00850     pDC->SetTextAlign(TA_CENTER);
00851     pDC->SetBkMode(TRANSPARENT);
00852     data->Update(*pDC, pDoc->GetEntryInfo());
00853 }

void CGraphView::OnEndPrinting | ( | CDC * | pDC,
 |  | CPrintInfo * | pInfo
 | ) | [protected, virtual]

Definition at line 1322 of file GraphView.cpp.

01323 {
01324     // TODO: Add your specialized code here and/or call the base class
01325
01326     CScrollView::OnEndPrinting(pDC, pInfo);
01327
01328     CalcImageSize();
01329     Invalidate();
01330 }

void CGraphView::OnGraphChangelogmessage ( ) [protected]

Definition at line 1808 of file GraphView.cpp.

01809 {
01810     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01811     CLogNode *root = pDoc->GetNode();
01812     if(root == 0L || root->GetUserData() == 0L)
01813         return;
01814
01815     TGraphCmdStatus trav;
01816     trav.TraverseGraph(root);
01817
01818     CLogNode *node = trav.fSel1->Node();
01819     ASSERT(node->GetType() == kNodeRev);
01820     CRevFile& rev = **(CLogNodeRev *)node;
01821
01822     CPStr msg = (const char*)rev.DescLog();
01823
01824     if( CompatGetAdminOptions(kChangeLog, msg) )
01825     {
01826         CvsArgs args;
01827         args.add("admin");
01828         args.add(CStr("-m") + trav.fSel1->GetStr() + CStr(":") + cleanUpLogMsg(msg));
01829
01830         args.add(pDoc->GetName());
01831         args.print(pDoc->GetDir());
01832
01833         CGraphConsole cons;
01834         launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01835         OnViewReload();
01836     }
01837 }

void CGraphView::OnGraphGraphoptions ( ) [protected]

Definition at line 1782 of file GraphView.cpp.

01783 {
01784     if( CompatGetGraphOptions(gGraphSelColor, gGraphShadowColor,
01785         gGraphHeaderColor, gGraphTagColor, gGraphBranchColor,
01786         gGraphNodeColor, gGraphDeadNodeColor, gGraphUserStateNodeColor) )
01787     {
01788         // add any additional processing here
01789     }
01790
01791     CWincvsApp* pApp = (CWincvsApp*)AfxGetApp();
01792     if( pApp )
01793     {
01794         pApp->UpdateAllDocsView();
01795     }
01796 }

void CGraphView::OnGraphSetdescription ( ) [protected]

Definition at line 1849 of file GraphView.cpp.

01850 {
01851     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01852     CLogNode *root = pDoc->GetNode();
01853     if(root == 0L || root->GetUserData() == 0L)
01854         return;
01855
01856     TGraphCmdStatus trav;
01857     trav.TraverseGraph(root);
01858
01859     CLogNode *node = trav.fSel1->Node();
01860     ASSERT(node->GetType() == kNodeHeader);
01861     CRcsFile& rev = **(CLogNodeHeader *)node;
01862
01863     CPStr msg = (const char*)rev.DescLog();
01864
01865     if( CompatGetAdminOptions(kSetDescription, msg) )
01866     {
01867         CvsArgs args;
01868         args.add("admin");
01869         args.add(CStr("-t-") + cleanUpLogMsg(msg));
01870
01871         args.add(pDoc->GetName());
01872         args.print(pDoc->GetDir());
01873
01874         CGraphConsole cons;
01875         launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01876         OnViewReload();
01877     }
01878 }

void CGraphView::OnGraphSetstate ( ) [protected]

Definition at line 1890 of file GraphView.cpp.

01891 {
01892     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01893     CLogNode *root = pDoc->GetNode();
01894     if(root == 0L || root->GetUserData() == 0L)
01895         return;
01896
01897     TGraphCmdStatus trav;
01898     trav.TraverseGraph(root);
01899
01900     CLogNode *node = trav.fSel1->Node();
01901     ASSERT(node->GetType() == kNodeRev);
01902     CRevFile& rev = **(CLogNodeRev *)node;
01903
01904     CPStr state = (const char*)rev.State();
01905
01906     if( strcmp("dead", (const char*)state ) == 0 &&
01907         CvsAlert("The revision state is: \"dead\". You should not alter it manually.\nAre you sure you want to continue?", "Cancel", "Continue") )
01908     {
01909         return;
01910     }
01911
01912     if( CompatGetAdminOptions(kSetState, state) )
01913     {
01914         CvsArgs args;
01915         args.add("admin");
01916         args.add("-s");
01917         args.add(cleanUpLogMsg(state) + CStr(":") + trav.fSel1->GetStr());
01918
01919         args.add(pDoc->GetName());
01920         args.print(pDoc->GetDir());
01921
01922         CGraphConsole cons;
01923         launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01924         OnViewReload();
01925     }
01926 }

void CGraphView::OnInitMenuPopup | ( | CMenu * | pPopupMenu,
 |  | UINT | nIndex,
 |  | BOOL | bSysMenu
 | ) | [protected]

Definition at line 1655 of file GraphView.cpp.

01656 {
01657     ASSERT(pPopupMenu != NULL);
01658     // Check the enabled state of various menu items.
01659
01660     CCmdUI state;
01661     state.m_pMenu = pPopupMenu;
01662     ASSERT(state.m_pOther == NULL);
01663     ASSERT(state.m_pParentMenu == NULL);
01664
01665     // Determine if menu is popup in top-level menu and set m_pOther to
01666     // it if so (m_pParentMenu == NULL indicates that it is secondary popup).
01667     HMENU hParentMenu;
01668     if (AfxGetThreadState()->m_hTrackingMenu == pPopupMenu->m_hMenu)
01669         state.m_pParentMenu = pPopupMenu;    // Parent == child for tracking popup.
01670     else if ((hParentMenu = ::GetMenu(m_hWnd)) != NULL)
01671     {
01672         CWnd* pParent = this;
01673            // Child windows don't have menus--need to go to the top!
01674         if (pParent != NULL &&
01675            (hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL)
01676         {
01677            int nIndexMax = ::GetMenuItemCount(hParentMenu);
01678            for (int nIndex = 0; nIndex < nIndexMax; nIndex++)
01679            {
01680             if (::GetSubMenu(hParentMenu, nIndex) == pPopupMenu->m_hMenu)
01681             {
01682                 // When popup is found, m_pParentMenu is containing menu.
01683                 state.m_pParentMenu = CMenu::FromHandle(hParentMenu);
01684                 break;
01685             }
01686            }
01687         }
01688     }
01689
01690     state.m_nIndexMax = pPopupMenu->GetMenuItemCount();
01691     for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
01692       state.m_nIndex++)
01693     {
01694         state.m_nID = pPopupMenu->GetMenuItemID(state.m_nIndex);
01695         if (state.m_nID == 0)
01696            continue; // Menu separator or invalid cmd - ignore it.
01697
01698         ASSERT(state.m_pOther == NULL);
01699         ASSERT(state.m_pMenu != NULL);
01700         if (state.m_nID == (UINT)-1)
01701         {
01702            // Possibly a popup menu, route to first item of that popup.
01703            state.m_pSubMenu = pPopupMenu->GetSubMenu(state.m_nIndex);
01704            if (state.m_pSubMenu == NULL ||
01705             (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
01706             state.m_nID == (UINT)-1)
01707            {
01708             continue;       // First item of popup can't be routed to.
01709            }
01710            state.DoUpdate(this, TRUE);   // Popups are never auto disabled.
01711         }
01712         else
01713         {
01714            // Normal menu item.
01715            // Auto enable/disable if frame window has m_bAutoMenuEnable
01716            // set and command is _not_ a system command.
01717            state.m_pSubMenu = NULL;
01718            state.DoUpdate(this, FALSE);
01719         }
01720
01721         // Adjust for menu deletions and additions.
01722         UINT nCount = pPopupMenu->GetMenuItemCount();
01723         if (nCount < state.m_nIndexMax)
01724         {
01725             state.m_nIndex -= (state.m_nIndexMax - nCount);
01726             while (state.m_nIndex < nCount &&
01727                 pPopupMenu->GetMenuItemID(state.m_nIndex) == state.m_nID)
01728             {
01729                 state.m_nIndex++;
01730             }
01731         }
01732         state.m_nIndexMax = nCount;
01733       }
01734
01735 }

void CGraphView::OnInitialUpdate ( ) [protected, virtual]

Definition at line 833 of file GraphView.cpp.

00834 {
00835     CScrollView::OnInitialUpdate();
00836
00837     SetScrollSizes(MM_TEXT, CSize(200, 100));
00838     //CalcImageSize();
00839 }

void CGraphView::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 990 of file GraphView.cpp.

00991 {
00992     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
00993     CLogNode *root = pDoc->GetNode();
00994     if(root == 0L || root->GetUserData() == 0L)
00995         return;
00996
00997     CWinLogData *data = (CWinLogData *)root->GetUserData();
00998
00999     if(nFlags & MK_LBUTTON)
01000     {
01001         if((nFlags & MK_SHIFT) == 0 && (nFlags & MK_CONTROL) == 0)
01002             data->UnselectAll(this);
01003         point += GetDeviceScrollPosition();
01004         CWinLogData *hit = data->HitTest(point);
01005
01006         if(hit != 0L)
01007         {
01008             if((nFlags & MK_SHIFT) == 0 && (nFlags & MK_CONTROL) == 0)
01009             {
01010                 if(!hit->Selected())
01011                 {
01012                     hit->SetSelected(this, true);
01013                     CWincvsApp *app = (CWincvsApp *)AfxGetApp();
01014                     CWincvsView *view = app->GetConsoleView();
01015                     if(view != 0L)
01016                     {
01017                         CColorConsole out(view);
01018                         CvsLogOutput(out, hit->Node());
01019                     }
01020                 }
01021             }
01022             else
01023             {
01024                 hit->SetSelected(this, !hit->Selected());
01025             }
01026         }
01027         else
01028         {
01029             CGraphRectTracker track(this);
01030             point -= GetDeviceScrollPosition();
01031             if(track.TrackRubberBand(this, point, true))
01032             {
01033                 // traverse and mark
01034                 track.m_rect.OffsetRect(GetDeviceScrollPosition());
01035                 track.m_rect.NormalizeRect();
01036                 TGraphRectSelect traversal((nFlags & MK_CONTROL) != 0, this,
01037                     track.m_rect);
01038                 traversal.TraverseGraph(root);
01039             }
01040         }
01041     }
01042     else if(nFlags & MK_RBUTTON)
01043     {
01044     }
01045
01046     CScrollView::OnLButtonDown(nFlags, point);
01047 }

BOOL CGraphView::OnPreparePrinting ( CPrintInfo * pInfo ) [protected, virtual]

Definition at line 1332 of file GraphView.cpp.

01333 {
01334     BOOL res = DoPreparePrinting(pInfo);
01335     if(!res)
01336         return res;
01337
01338     return TRUE;
01339 }

void CGraphView::OnPrint | ( | CDC * | pDC,
 |  | CPrintInfo * | pInfo
 | ) | [protected, virtual]

Definition at line 1341 of file GraphView.cpp.

01342 {
01343     if (!pDC->IsPrinting())
01344         return;
01345
01346     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01347     CLogNode *root = pDoc->GetNode();
01348     if(root == 0L || root->GetUserData() == 0L)
01349         return;
01350
01351     CWinLogData *data = (CWinLogData *)root->GetUserData();
01352
01353     // Orient the viewport so that the first row to be printed
01354     // has a viewport coordinate of (0,0).
01355     int yTopOfPage = (pInfo->m_nCurPage -1) * m_pageHeight;
01356     pDC->SetViewportOrg(0, -yTopOfPage);
01357     pDC->SetTextAlign(TA_CENTER);
01358     pDC->SetBkMode(TRANSPARENT);
01359     data->Update(*pDC, pDoc->GetEntryInfo());
01360
01361     //  CScrollView::OnPrint(pDC, pInfo);
01362 }

void CGraphView::OnQueryAnnotate ( ) [protected]

Definition at line 1747 of file GraphView.cpp.

01748 {
01749     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01750     CLogNode *root = pDoc->GetNode();
01751     if(root == 0L || root->GetUserData() == 0L)
01752         return;
01753
01754     TGraphCmdStatus trav;
01755     trav.TraverseGraph(root);
01756
01757     if(gCvsPrefs.ExtDiff() != 0L)
01758     {
01759         CStr file, prf, ext, base;
01760         CvsArgs args;
01761
01762         GetExtension(pDoc->GetName(), base, ext);
01763
01764         prf = base;
01765         prf << "_ann_";
01766         prf << trav.fSel1->GetStr();
01767         prf << '_';
01768         args.add("annotate");
01769         args.add("-r");
01770         args.add(trav.fSel1->GetStr());
01771         args.add(pDoc->GetName());
01772         args.print(pDoc->GetDir());
01773         file = launchCVS(pDoc->GetDir(), args, (const char *)prf, ext);
01774
01775         if(file.empty())
01776             return;
01777
01778         LaunchViewer(file);
01779     }
01780 }

void CGraphView::OnUpdateGraphChangelogmessage ( CCmdUI * pCmdUI ) [protected]

Definition at line 1798 of file GraphView.cpp.

01799 {
01800     BOOL enabled = FALSE;
01801     if(!DisableCommon())
01802     {
01803         enabled = IsSelSingleNode(kNodeRev);
01804     }
01805     pCmdUI->Enable(enabled);
01806 }

void CGraphView::OnUpdateGraphSetdescription ( CCmdUI * pCmdUI ) [protected]

Definition at line 1839 of file GraphView.cpp.

01840 {
01841     BOOL enabled = FALSE;
01842     if(!DisableCommon())
01843     {
01844         enabled = IsSelSingleNode(kNodeHeader);
01845     }
01846     pCmdUI->Enable(enabled);
01847 }

void CGraphView::OnUpdateGraphSetstate ( CCmdUI * pCmdUI ) [protected]

Definition at line 1880 of file GraphView.cpp.

01881 {
01882     BOOL enabled = FALSE;
01883     if(!DisableCommon())
01884     {
01885         enabled = IsSelSingleNode(kNodeRev);
01886     }
01887     pCmdUI->Enable(enabled);
01888 }

void CGraphView::OnUpdateQueryAnnotate ( CCmdUI * pCmdUI ) [protected]

Definition at line 1737 of file GraphView.cpp.

01738 {
01739     BOOL enabled = FALSE;
01740     if(!DisableCommon())
01741     {
01742         enabled = IsSelSingleNode(kNodeHeader, false);
01743     }
01744     pCmdUI->Enable(enabled);
01745 }

void CGraphView::OnUpdateViewDelrev ( CCmdUI * pCmdUI ) [protected]

Definition at line 1450 of file GraphView.cpp.

01451 {
01452     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01453     CLogNode *root = pDoc->GetNode();
01454     if(DisableCommon())
01455     {
01456         pCmdUI->Enable(FALSE);
01457         return;
01458     }
01459
01460     TGraphDelCmd trav;
01461     trav.TraverseGraph(root);
01462     BOOL outEnabled = trav.fCountSel >= 1 && trav.fOnlyRev;
01463     pCmdUI->Enable(outEnabled);
01464 }

void CGraphView::OnUpdateViewDiff ( CCmdUI * pCmdUI ) [protected]

Definition at line 1201 of file GraphView.cpp.

01202 {
01203     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01204     CLogNode *root = pDoc->GetNode();
01205     if(DisableCommon())
01206     {
01207         pCmdUI->Enable(FALSE);
01208         return;
01209     }
01210
01211     TGraphCmdStatus trav;
01212     trav.TraverseGraph(root);
01213     BOOL outEnabled = (trav.fCountSel == 2 && trav.fSel1->GetType() != kNodeHeader &&
01214         trav.fSel2->GetType() != kNodeHeader) ||
01215         (trav.fCountSel == 1 && trav.fSel1->GetType() != kNodeHeader);
01216     pCmdUI->Enable(outEnabled);
01217 }

void CGraphView::OnUpdateViewLockf ( CCmdUI * pCmdUI ) [protected]

Definition at line 1928 of file GraphView.cpp.

01929 {
01930     BOOL enabled = FALSE;
01931     if(!DisableCommon())
01932     {
01933         enabled = IsSelSingleNode(kNodeRev);
01934     }
01935     pCmdUI->Enable(enabled);
01936 }

void CGraphView::OnUpdateViewReload ( CCmdUI * pCmdUI ) [protected]

Definition at line 1117 of file GraphView.cpp.

01118 {
01119     if(DisableCommon())
01120         pCmdUI->Enable(FALSE);
01121     else
01122         pCmdUI->Enable(TRUE);
01123 }

void CGraphView::OnUpdateViewRetrieve ( CCmdUI * pCmdUI ) [protected]

Definition at line 1581 of file GraphView.cpp.

01582 {
01583     BOOL enabled = FALSE;
01584     if(!DisableCommon())
01585     {
01586         enabled = IsSelSingleNode(kNodeHeader, false);
01587     }
01588     pCmdUI->Enable(enabled);
01589 }

void CGraphView::OnUpdateViewSelnonsig ( CCmdUI * pCmdUI ) [protected]

Definition at line 1503 of file GraphView.cpp.

01504 {
01505     if(DisableCommon())
01506         pCmdUI->Enable(FALSE);
01507     else
01508         pCmdUI->Enable(TRUE);
01509 }

void CGraphView::OnUpdateViewTag ( CCmdUI * pCmdUI ) [protected]

Definition at line 1281 of file GraphView.cpp.

01282 {
01283     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01284     CLogNode *root = pDoc->GetNode();
01285     if(DisableCommon())
01286     {
01287         pCmdUI->Enable(FALSE);
01288         return;
01289     }
01290
01291     TGraphCmdStatus trav;
01292     trav.TraverseGraph(root);
01293     BOOL outEnabled = trav.fCountSel == 1;
01294     pCmdUI->Enable(outEnabled);
01295 }

void CGraphView::OnUpdateViewUnlockf ( CCmdUI * pCmdUI ) [protected]

Definition at line 1960 of file GraphView.cpp.

01961 {
01962     BOOL enabled = FALSE;
01963     if(!DisableCommon())
01964     {
01965         enabled = IsSelSingleNode(kNodeRev);
01966     }
01967     pCmdUI->Enable(enabled);
01968 }

void CGraphView::OnUpdateViewUpdate ( CCmdUI * pCmdUI ) [protected]

Definition at line 1237 of file GraphView.cpp.

01238 {
01239     if(DisableCommon())
01240         pCmdUI->Enable(FALSE);
01241     else
01242         pCmdUI->Enable(TRUE);
01243 }

void CGraphView::OnViewDelrev ( ) [protected]

Definition at line 1410 of file GraphView.cpp.

01411 {
01412     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01413     CLogNode *root = pDoc->GetNode();
01414     if(root == 0L || root->GetUserData() == 0L)
01415         return;
01416
01417     if(AfxMessageBox("Are you really sure you want to do that ? This will permanently remove the revisions on the server.",
01418         MB_OKCANCEL|MB_DEFBUTTON2|MB_ICONSTOP) != IDOK)
01419             return;
01420
01421     TGraphDelCmd trav;
01422     trav.TraverseGraph(root);
01423
01424     CProgress progress(true, "Deleting revisions...");
01425
01426     std::vector<CStr>::const_iterator i;
01427     int count = 0;
01428     for(i = trav.fAllRevs.begin(); i != trav.fAllRevs.end(); ++i, ++count)
01429     {
01430         progress.SetProgress(((float)count / (float)trav.fAllRevs.size()) * 100.0 + .5);
01431         if(progress.HasAborted())
01432             break;
01433
01434         CvsArgs args;
01435         args.add("admin");
01436         args.add("-o");
01437         args.add(*i);
01438         args.add(pDoc->GetName());
01439         args.print(pDoc->GetDir());
01440         CGraphConsole cons;
01441         launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01442     }
01443
01444     if(!progress.HasAborted())
01445         progress.SetProgress(100);
01446
01447     OnViewReload();
01448 }

void CGraphView::OnViewDiff ( ) [protected]

Definition at line 1125 of file GraphView.cpp.

01126 {
01127     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01128     CLogNode *root = pDoc->GetNode();
01129     if(root == 0L || root->GetUserData() == 0L)
01130         return;
01131
01132     TGraphCmdStatus trav;
01133     trav.TraverseGraph(root);
01134
01135     bool done = false;
01136     if(gCvsPrefs.ExtDiff() != 0L)
01137     {
01138         CStr f1, f2, prf1, prf2, ext, base;
01139         CvsArgs args1, args2;
01140
01141         GetExtension(pDoc->GetName(), base, ext);
01142
01143         prf1 = base;
01144         prf1 << '_';
01145         prf1 << trav.fSel1->GetStr();
01146         prf1 << '_';
01147         args1.add("update");
01148         args1.add("-p");
01149         args1.add("-r");
01150         args1.add(trav.fSel1->GetStr());
01151         args1.add(pDoc->GetName());
01152         args1.print(pDoc->GetDir());
01153         f1 = launchCVS(pDoc->GetDir(), args1, (const char *)prf1, ext);
01154
01155         if(trav.fCountSel == 2)
01156         {
01157             prf2 = base;
01158             prf2 << '_';
01159             prf2 << trav.fSel2->GetStr();
01160             prf2 << '_';
01161             args2.add("update");
01162             args2.add("-p");
01163             args2.add("-r");
01164             args2.add(trav.fSel2->GetStr());
01165             args2.add(pDoc->GetName());
01166             args2.print(pDoc->GetDir());
01167             f2 = launchCVS(pDoc->GetDir(), args2, (const char *)prf2, ext);
01168         }
01169         else
01170         {
01171             f2 = pDoc->GetDir();
01172             if(!f2.endsWith(kPathDelimiter))
01173                 f2 << kPathDelimiter;
01174             f2 << pDoc->GetName();
01175         }
01176
01177         if(f1.empty() || f2.empty())
01178             return;
01179
01180         done = LaunchDiff(f1, f2);
01181     }
01182
01183     if(!done)
01184     {
01185         CvsArgs args;
01186         CGraphConsole cons;
01187         args.add("diff");
01188         args.add("-r");
01189         args.add(trav.fSel1->GetStr());
01190         if(trav.fCountSel == 2)
01191         {
01192             args.add("-r");
01193             args.add(trav.fSel2->GetStr());
01194         }
01195         args.add(pDoc->GetName());
01196         args.print(pDoc->GetDir());
01197         launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01198     }
01199 }

void CGraphView::OnViewLockf ( ) [protected]

Definition at line 1938 of file GraphView.cpp.

01939 {
01940     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01941     CLogNode *root = pDoc->GetNode();
01942     if(root == 0L || root->GetUserData() == 0L)
01943         return;
01944
01945     TGraphCmdStatus trav;
01946     trav.TraverseGraph(root);
01947
01948     CvsArgs args;
01949     args.add("admin");
01950     args.add(CStr("-l") + trav.fSel1->GetStr());
01951
01952     args.add(pDoc->GetName());
01953     args.print(pDoc->GetDir());
01954
01955     CGraphConsole cons;
01956     launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01957     OnViewReload();
01958 }

void CGraphView::OnViewReload ( ) [protected]

Definition at line 1102 of file GraphView.cpp.

Referenced by OnGraphChangelogmessage(), OnGraphSetdescription(), OnGraphSetstate(), OnViewDelrev(), OnViewLockf(), OnViewTag(), OnViewUnlockf(), and OnViewUpdate().

01103 {
01104     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01105     CLogNode *root = pDoc->GetNode();
01106     if(root == 0L || root->GetUserData() == 0L)
01107         return;
01108
01109     CvsArgs args;
01110     args.add("log");
01111     args.add(pDoc->GetName());
01112     args.print(pDoc->GetDir());
01113     CStr dir(pDoc->GetDir());
01114     CvsLogParse(dir, args, true, pDoc);
01115 }

void CGraphView::OnViewRetrieve ( ) [protected]

Definition at line 1552 of file GraphView.cpp.

01553 {
01554     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01555     CLogNode *root = pDoc->GetNode();
01556     if(root == 0L || root->GetUserData() == 0L)
01557         return;
01558
01559     TGraphCmdStatus trav;
01560     trav.TraverseGraph(root);
01561
01562     CStr f1, prf1;
01563     CvsArgs args;
01564
01565     prf1 = pDoc->GetName();
01566     prf1 << ".#.";
01567     prf1 << trav.fSel1->GetStr();
01568     args.add("update");
01569     args.add("-p");
01570     args.add("-r");
01571     args.add(trav.fSel1->GetStr());
01572     args.add(pDoc->GetName());
01573     args.print(pDoc->GetDir());
01574
01575     CRevisionConsole console;
01576     console.init(pDoc->GetDir(), prf1);
01577
01578     int code = launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &console);
01579 }

void CGraphView::OnViewSelnonsig ( ) [protected]

Definition at line 1489 of file GraphView.cpp.

01490 {
01491     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01492     CLogNode *root = pDoc->GetNode();
01493     if(root == 0L || root->GetUserData() == 0L)
01494         return;
01495
01496     CWinLogData *data = (CWinLogData *)root->GetUserData();
01497     data->UnselectAll(this);
01498
01499     TGraphSelNonSig trav(this);
01500     trav.TraverseGraph(root);
01501 }

void CGraphView::OnViewTag ( ) [protected]

Definition at line 1245 of file GraphView.cpp.

01246 {
01247     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01248     CLogNode *root = pDoc->GetNode();
01249     if(root == 0L || root->GetUserData() == 0L)
01250         return;
01251
01252     TGraphCmdStatus trav;
01253     trav.TraverseGraph(root);
01254     CvsArgs args;
01255     args.add("update");
01256     CLogNode *node = trav.fSel1->Node();
01257     switch(node->GetType())
01258     {
01259         case kNodeHeader :
01260         {
01261             args.add("-A");
01262             break;
01263         }
01264         case kNodeRev :
01265         case kNodeBranch :
01266         case kNodeTag :
01267         {
01268             args.add("-r");
01269             args.add(trav.fSel1->GetStr());
01270             break;
01271         }
01272     }
01273     args.add(pDoc->GetName());
01274     args.print(pDoc->GetDir());
01275     CGraphConsole cons;
01276     launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01277
01278     OnViewReload();
01279 }

void CGraphView::OnViewUnlockf ( ) [protected]

Definition at line 1970 of file GraphView.cpp.

01971 {
01972     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01973     CLogNode *root = pDoc->GetNode();
01974     if(root == 0L || root->GetUserData() == 0L)
01975         return;
01976
01977     TGraphCmdStatus trav;
01978     trav.TraverseGraph(root);
01979
01980     CvsArgs args;
01981     args.add("admin");
01982     args.add(CStr("-u") + trav.fSel1->GetStr());
01983
01984     args.add(pDoc->GetName());
01985     args.print(pDoc->GetDir());
01986
01987     CGraphConsole cons;
01988     launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01989     OnViewReload();
01990 }

void CGraphView::OnViewUpdate ( ) [protected]

Definition at line 1219 of file GraphView.cpp.

01220 {
01221     CGraphDoc *pDoc = (CGraphDoc *)GetDocument();
01222     CLogNode *root = pDoc->GetNode();
01223     if(root == 0L || root->GetUserData() == 0L)
01224         return;
01225
01226     CvsArgs args;
01227     args.add("update");
01228     args.add("-A");
01229     args.add(pDoc->GetName());
01230     args.print(pDoc->GetDir());
01231     CGraphConsole cons;
01232     launchCVS(pDoc->GetDir(), args.Argc(), args.Argv(), &cons);
01233
01234     OnViewReload();
01235 }

Member Data Documentation

bool CGraphView::fFirstTime [protected]

Definition at line 86 of file GraphView.h.

CImageList CGraphView::m_ImageList [static, protected]

Definition at line 808 of file GraphView.cpp.

int CGraphView::m_numberOfPages [protected]

Definition at line 89 of file GraphView.h.

int CGraphView::m_pageHeight [protected]

Definition at line 90 of file GraphView.h.

The documentation for this class was generated from the following files:
  • WinCvs/GraphView.h
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:47:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


group Struct Reference

#include <pwd.h>

Collaboration diagram for group:

[legend]
List of all members.

Public Attributes

file_data const * | file
int | from
int | upto
char * | gr_name
char * | gr_passwd
gid_t | gr_gid
char ** | gr_mem
char * | gr_name
int | gr_gid
char * | gr_name

Member Data Documentation

struct file_data const* group::file

Definition at line 26 of file ifdef.c.

int group::from

Definition at line 27 of file ifdef.c.

int group::gr_gid

Definition at line 41 of file pwd.h.

int group::gr_gid

Definition at line 41 of file pwd.h.

Referenced by getgrgid().

char** group::gr_mem

Definition at line 24 of file pwd.h.

char* group::gr_name

Definition at line 40 of file pwd.h.

char* group::gr_name

Definition at line 40 of file pwd.h.

char* group::gr_name

Definition at line 21 of file pwd.h.

Referenced by getgrgid().

char* group::gr_passwd

Definition at line 22 of file pwd.h.

int group::upto

Definition at line 27 of file ifdef.c.

The documentation for this struct was generated from the following files:
  • cvs-1.10/diff/ifdef.c
  • cvs-1.10/macintosh/pwd.h
  • cvs-1.10/os2/pwd.h
  • cvs-1.10/windows-NT/pwd.h
Generated on Sun Oct 21 12:47:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


gusilsh_ctx Struct Reference

#include <GUSIlsh.h>

Collaboration diagram for gusilsh_ctx:

[legend]
List of all members.

Public Attributes

lshctx * lsh_ctx
sigaction | oldHandler
int | doAbort

Member Data Documentation

int gusilsh_ctx::doAbort

Definition at line 15 of file GUSIlsh.h.

lshctx* gusilsh_ctx::lsh_ctx

Definition at line 13 of file GUSIlsh.h.

struct sigaction gusilsh_ctx::oldHandler

Definition at line 14 of file GUSIlsh.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/macintosh/GUSIlsh.h
Generated on Sun Oct 21 12:47:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


gz_stream Struct Reference

Collaboration diagram for gz_stream:

[legend]
List of all members.

Public Attributes

z_stream stream
int | z_err
int | z_eof
FILE * | file
Byte * inbuf
Byte * outbuf
uLong crc
char * | msg
char * | path
int | transparent
char | mode

Member Data Documentation

uLong gz_stream::crc

Definition at line 36 of file gzio.c.

FILE* gz_stream::file

Definition at line 33 of file gzio.c.

Byte* gz_stream::inbuf

Definition at line 34 of file gzio.c.

char gz_stream::mode

Definition at line 40 of file gzio.c.

char* gz_stream::msg

Definition at line 37 of file gzio.c.

Byte* gz_stream::outbuf

Definition at line 35 of file gzio.c.

char* gz_stream::path

Definition at line 38 of file gzio.c.

z_stream gz_stream::stream

Definition at line 30 of file gzio.c.

int gz_stream::transparent

Definition at line 39 of file gzio.c.

int gz_stream::z_eof

Definition at line 32 of file gzio.c.

int gz_stream::z_err

Definition at line 31 of file gzio.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/zlib/gzio.c
Generated on Sun Oct 21 12:47:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


hardlink_info Struct Reference

#include <hardlink.h>

Collaboration diagram for hardlink_info:

[legend]
List of all members.

Public Attributes

Ctype status
int checked_out

Member Data Documentation

int hardlink_info::checked_out

Definition at line 23 of file hardlink.h.

Ctype hardlink_info::status

Definition at line 22 of file hardlink.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/hardlink.h
Generated on Sun Oct 21 12:47:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CHARFORMAT Class Reference

Inheritance diagram for CHARFORMAT:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/wincvsView.cpp
Generated on Sun Oct 21 12:47:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CHeaderCtrl Class Reference

Inheritance diagram for CHeaderCtrl:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/SortHeaderCtrl.h
Generated on Sun Oct 21 12:47:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CHistComboBoxEx Class Reference

#include <HistComboBoxEx.h>

Inheritance diagram for CHistComboBoxEx:

[legend]
Collaboration diagram for CHistComboBoxEx:

[legend]
List of all members.

Public Methods

CHistComboBoxEx ()
virtual BOOL | PreTranslateMessage (MSG *pMsg)
virtual | ~CHistComboBoxEx ()
int | AddString (LPCTSTR lpszString)
int | InsertString (int nIndex, LPCTSTR lpszString)
BOOL | SetIcon (COMBOBOXEXITEM cbi)
const char * | GetOldLoc ()
int | NewRoot (const char *root)

Protected Methods

afx_msg void | OnDropdown ()

Private Attributes

CImageList | m_ImageList

Constructor & Destructor Documentation

CHistComboBoxEx::CHistComboBoxEx ( )

Definition at line 63 of file HistComboBoxEx.cpp.

00064 {
00065 }

CHistComboBoxEx::~CHistComboBoxEx ( ) [virtual]

Definition at line 67 of file HistComboBoxEx.cpp.

00068 {
00069 }

Member Function Documentation

int CHistComboBoxEx::AddString ( LPCTSTR lpszString )

Definition at line 122 of file HistComboBoxEx.cpp.

00123 {
00124     return InsertString(-1, lpszString);
00125 }

const char * CHistComboBoxEx::GetOldLoc ( )

Definition at line 81 of file HistComboBoxEx.cpp.

Referenced by CWinCvsBrowser::Create().

00082 {
00083     return gOldLoc;
00084 }

int CHistComboBoxEx::InsertString | ( | int | nIndex,
 |  | LPCTSTR | lpszString
 | ) |

Definition at line 106 of file HistComboBoxEx.cpp.

Referenced by AddString(), and NewRoot().

00107 {
00108     int nRes = -1;
00109
00110     COMBOBOXEXITEM cbi;
00111     cbi.mask = CBEIF_TEXT;
00112     cbi.iItem = 0 > nIndex ? GetCount() : nIndex;
00113     cbi.pszText = (LPTSTR)lpszString;       //this cast is safe because we are Inserting item
00114     cbi.cchTextMax = 0;
00115
00116     nRes = InsertItem(&cbi);
00117     SetIcon(cbi);
00118
00119     return nRes;
00120 }

int CHistComboBoxEx::NewRoot ( const char * root )

Definition at line 86 of file HistComboBoxEx.cpp.

Referenced by CWinCvsBrowser::ResetBrowser().

00087 {
00088     if(stricmp(gOldLoc, root) != 0)
00089         gOldLoc = root;
00090
00091     // update the history combo
00092     gHistoryLocs.Insert(root);
00093     ResetContent();
00094     const std::vector<CStr> & list = gHistoryLocs.GetList();
00095     std::vector<CStr>::const_iterator i;
00096     for(i = list.begin(); i != list.end(); ++i)
00097     {
00098         InsertString(-1, *i);
00099     }
00100     SetCurSel(0);
00101     TRACE("Browse History has %d items\n", GetCount());
00102
00103     return GetCount();
00104 }

void CHistComboBoxEx::OnDropdown ( ) [protected]

Definition at line 235 of file HistComboBoxEx.cpp.

00236 {
00237     TraverseHistory(*this);
00238
00239     CClientDC ClientDC(this);
00240     int savedDc = ClientDC.SaveDC();
00241     ClientDC.SelectObject(GetFont());
00242
00243     CString strLBText;
00244     int maxSize = 0;
00245     for( int nIndex = 0; nIndex < GetCount(); nIndex++ )
00246     {
00247         GetLBText( nIndex, strLBText );
00248         CSize size = ClientDC.GetTextExtent(strLBText);
00249
00250         if( size.cx > maxSize )
00251         {
00252             maxSize = size.cx;
00253         }
00254     }
00255     ClientDC.RestoreDC(savedDc);
00256
00257     maxSize += ::GetSystemMetrics(SM_CXVSCROLL)     //vertical scroll bar
00258         + 4*::GetSystemMetrics(SM_CXEDGE)           //the border aroung the text and icon: Edge-Icon-Edge - Edge-Text-Edge
00259         + HISTLOC_IMAGE_CX                          //the icon width
00260         + 2;                                        //the focus frame width
00261
00262     CRect rect;
00263     GetWindowRect(rect);
00264     maxSize = min(ClientDC.GetDeviceCaps(HORZRES) - rect.TopLeft().x, maxSize);
00265
00266     SetDroppedWidth(maxSize);
00267 }

BOOL CHistComboBoxEx::PreTranslateMessage ( MSG * pMsg ) [virtual]

Definition at line 182 of file HistComboBoxEx.cpp.

00183 {
00184     if( pMsg->message == WM_KEYDOWN )
00185     {
00186         int nVirtKey = (int)pMsg->wParam;
00187         if( VK_DELETE == nVirtKey )
00188         {
00189             if( GetDroppedState() )
00190             {
00191                 int sel = GetCurSel();
00192                 if( CB_ERR < sel && GetCount() > 1 )
00193                 {
00194                     CString strItem;
00195                     GetLBText(sel, strItem);
00196                     CString strMessage = "Do you want to remove that item from the list?\nLocation";
00197                     strMessage += (0 == sel ? "(Current)" : "");
00198                     strMessage += ": " + strItem;
00199                     if( AfxMessageBox(strMessage, MB_YESNO | MB_ICONQUESTION) == IDYES )
00200                     {
00201                         if( gHistoryLocs.Remove(strItem) )
00202                         {
00203                             DeleteItem(sel);
00204                             if( GetCount() )
00205                             {
00206                                 int nNewSel = (0 == sel ? sel : (GetCount() ? 0 : -1));
00207                                 if( 0 != nNewSel || 0 == sel )
00208                                 {
00209                                     SetCurSel(nNewSel);
00210
00211                                     //trigger the location change for all views
00212                                     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00213                                     CMainFrame* mainFrm = app->GetMainFrame();
00214                                     mainFrm->ChangeLocation();
00215                                 }
00216                             }
00217                         }
00218                     }
00219                 }
00220                 else if( GetCount() == 1 )
00221                 {
00222                     AfxMessageBox("Can't remove the last item from the history.\n"
00223                         "Add a new location first to remove the current one.", MB_OK | MB_ICONSTOP);
00224                 }
00225
00226                 //we have to stop it going to another window
00227                 return TRUE;
00228             }
00229         }
00230     }
00231
00232     return CComboBoxEx::PreTranslateMessage(pMsg);
00233 }

BOOL CHistComboBoxEx::SetIcon ( COMBOBOXEXITEM cbi )

Definition at line 127 of file HistComboBoxEx.cpp.

Referenced by InsertString(), and TraverseHistory().

00128 {
00129     //initialize the image list if neccessary
00130     if( m_ImageList.m_hImageList == 0L )
00131     {
00132         m_ImageList.Create(IDB_HISTLOC, HISTLOC_IMAGE_CX, 1, RGB(255, 255, 255));
00133         SetImageList(&m_ImageList);
00134     }
00135
00136     cbi.mask = CBEIF_IMAGE | /*CBEIF_OVERLAY |*/ CBEIF_SELECTEDIMAGE;
00137     cbi.iImage = cbi.iSelectedImage = kLocationIconUnknown;
00138     //cbi.iOverlay = ;
00139
00140     CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00141     vector<CStr> ignlist;
00142     struct stat sb;
00143     const char *fullpath = cbi.pszText;
00144
00145     int statres = stat(fullpath, &sb);
00146     if( statres != -1 )
00147     {
00148         if( S_ISDIR(sb.st_mode) )
00149         {
00150             CStr uppath, folder;
00151             if( !SplitPath(fullpath, uppath, folder) || uppath.empty() )
00152             {
00153                 uppath = fullpath;
00154                 folder = ".";
00155             }
00156
00157             BuildIgnoredList(ignlist, uppath);
00158
00159             EntnodeData *data = Entries_SetVisited(uppath, entries, folder, sb, true, &ignlist);
00160             if( !data->IsUnknown() )
00161             {
00162                 cbi.iImage = cbi.iSelectedImage = kLocationIcon;
00163             }
00164             if( data->IsIgnored() )
00165             {
00166                 cbi.iImage = cbi.iSelectedImage = kLocationIconIgnored;
00167             }
00168             if( data->IsMissing() )
00169             {
00170                 cbi.iImage = cbi.iSelectedImage = kLocationIconMissing;
00171             }
00172         }
00173     }
00174     else
00175     {
00176         cbi.iImage = cbi.iSelectedImage = kLocationIconErased;
00177     }
00178
00179     return SetItem(&cbi);
00180 }

Member Data Documentation

CImageList CHistComboBoxEx::m_ImageList [private]

Definition at line 76 of file HistComboBoxEx.h.

The documentation for this class was generated from the following files:
  • WinCvs/HistComboBoxEx.h
  • WinCvs/HistComboBoxEx.cpp
Generated on Sun Oct 21 12:47:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


HQXDecodeVars Struct Reference

Collaboration diagram for HQXDecodeVars:

[legend]
List of all members.

Public Attributes

unsigned char | fInBuffer [4 *1024]
unsigned char | fOutBuffer [4 *1024]
unsigned char * | fInBufp
unsigned char * | fInBufMax
long | fBitBuffer
long | fBitBufferBits
long | fRLECount
unsigned char | fRLECharacter
Boolean | fInHqxData
unsigned short | fCRC
HQXSource fSource
long | fSourceRefCon

Member Data Documentation

long HQXDecodeVars::fBitBuffer

Definition at line 58 of file hqx.c.

long HQXDecodeVars::fBitBufferBits

Definition at line 58 of file hqx.c.

unsigned short HQXDecodeVars::fCRC

Definition at line 62 of file hqx.c.

unsigned char * HQXDecodeVars::fInBufMax

Definition at line 57 of file hqx.c.

unsigned char HQXDecodeVars::fInBuffer[4*1024]

Definition at line 55 of file hqx.c.

unsigned char* HQXDecodeVars::fInBufp

Definition at line 57 of file hqx.c.

Boolean HQXDecodeVars::fInHqxData

Definition at line 61 of file hqx.c.

unsigned char HQXDecodeVars::fOutBuffer[4*1024]

Definition at line 56 of file hqx.c.

unsigned char HQXDecodeVars::fRLECharacter

Definition at line 60 of file hqx.c.

long HQXDecodeVars::fRLECount

Definition at line 59 of file hqx.c.

HQXSource HQXDecodeVars::fSource

Definition at line 63 of file hqx.c.

long HQXDecodeVars::fSourceRefCon

Definition at line 64 of file hqx.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/macintosh/hqx.c
Generated on Sun Oct 21 12:47:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


HQXEncodeVars Struct Reference

Collaboration diagram for HQXEncodeVars:

[legend]
List of all members.

Public Attributes

unsigned char | fInBuffer [4 *1024]
unsigned char | fOutBuffer [4 *1024]
unsigned char * | fOutBufp
long | fBitBuffer
long | fBitBufferBits
long | fNOutChars
long | fRLECount
unsigned char | fRLECharacter
unsigned short | fCRC
HQXSink fSink
long | fSinkRefCon

Member Data Documentation

long HQXEncodeVars::fBitBuffer

Definition at line 45 of file hqx.c.

long HQXEncodeVars::fBitBufferBits

Definition at line 45 of file hqx.c.

unsigned short HQXEncodeVars::fCRC

Definition at line 49 of file hqx.c.

unsigned char HQXEncodeVars::fInBuffer[4*1024]

Definition at line 42 of file hqx.c.

long HQXEncodeVars::fNOutChars

Definition at line 46 of file hqx.c.

unsigned char HQXEncodeVars::fOutBuffer[4*1024]

Definition at line 43 of file hqx.c.

unsigned char* HQXEncodeVars::fOutBufp

Definition at line 44 of file hqx.c.

unsigned char HQXEncodeVars::fRLECharacter

Definition at line 48 of file hqx.c.

long HQXEncodeVars::fRLECount

Definition at line 47 of file hqx.c.

HQXSink HQXEncodeVars::fSink

Definition at line 50 of file hqx.c.

long HQXEncodeVars::fSinkRefCon

Definition at line 51 of file hqx.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/macintosh/hqx.c
Generated on Sun Oct 21 12:47:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


hrec Struct Reference

Collaboration diagram for hrec:

[legend]
List of all members.

Public Attributes

char * | type
char * | user
char * | dir
char * | repos
char * | rev
char * | file
char * | end
char * | mod
time_t | date
int | idx

Member Data Documentation

time_t hrec::date

Definition at line 193 of file history.c.

char* hrec::dir

Definition at line 187 of file history.c.

char* hrec::end

Definition at line 191 of file history.c.

char* hrec::file

Definition at line 190 of file history.c.

int hrec::idx

Definition at line 194 of file history.c.

char* hrec::mod

Definition at line 192 of file history.c.

char* hrec::repos

Definition at line 188 of file history.c.

char* hrec::rev

Definition at line 189 of file history.c.

char* hrec::type

Definition at line 185 of file history.c.

char* hrec::user

Definition at line 186 of file history.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/history.c
Generated on Sun Oct 21 12:47:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ICvsCoworker Class Reference

Inheritance diagram for ICvsCoworker:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CoWorker/CvsCoworker.h
Generated on Sun Oct 21 12:47:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ImportReport Class Reference

Inheritance diagram for ImportReport:

[legend]
Collaboration diagram for ImportReport:

[legend]
List of all members.

Public Methods

ImportReport (const char *path, ReportWarning *&w, ReportConflict *&c)
virtual | ~ImportReport ()
virtual kTraversal | EnterDirectory (const char *fullpath, const char *dirname, const FSSpec *macspec)
virtual kTraversal | ExitDirectory (const char *fullpath)
virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnIdle (const char *fullpath)
virtual kTraversal | OnDirectory (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
virtual kTraversal | OnFile (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
virtual kTraversal | OnAlias (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)

Public Attributes

ReportWarning *& warnings
ReportConflict *& conflicts
std::vector< UStr > m_Ignlist

Constructor & Destructor Documentation

ImportReport::ImportReport | ( | const char * | path,
 |  | ReportWarning *& | w,
 |  | ReportConflict *& | c
 | ) | [inline]

Definition at line 337 of file ImportFilter.cpp.

00337                                                                             : warnings(w), conflicts(c)
00338     {
00339         // MN - Apply ignore filter to import file list
00340         BuildIgnoredList(m_Ignlist, path);
00341     }

virtual ImportReport::~ImportReport ( ) [inline, virtual]

Definition at line 342 of file ImportFilter.cpp.

00342 {}

Member Function Documentation

virtual kTraversal ImportReport::EnterDirectory | ( | const char * | fullpath,
 |  | const char * | dirname,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 349 of file ImportFilter.cpp.

00350     {
00351         cvs_out("Filtering \'%s\'...\n", fullpath);
00352         return kContinueTraversal;
00353     }

virtual kTraversal ImportReport::ExitDirectory ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 355 of file ImportFilter.cpp.

00356     {
00357         return kContinueTraversal;
00358     }

virtual kTraversal ImportReport::OnAlias | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 424 of file ImportFilter.cpp.

00428     {
00429         list_add_warning(warnings, kFileIsAlias, fullname);
00430         return kContinueTraversal;
00431     }

virtual kTraversal ImportReport::OnDirectory | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 371 of file ImportFilter.cpp.

00375     {
00376 #if defined(WIN32) || defined(macintosh)
00377         if(stricmp(name, "CVS") == 0)
00378 #else
00379         if(strcmp(name, "CVS") == 0)
00380 #endif
00381             return kSkipFile;
00382         return kContinueTraversal;
00383     }

virtual kTraversal ImportReport::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 360 of file ImportFilter.cpp.

00361     {
00362         list_add_warning(warnings, kFileMissing, err);
00363         return kContinueTraversal;
00364     }

virtual kTraversal ImportReport::OnFile | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 385 of file ImportFilter.cpp.

00389     {
00390         int mac_type = 0;
00391         int mac_creator = 0;
00392 #ifdef macintosh
00393 #   define MACSPEC , &fsSpec
00394         GUSIFileSpec inspec(fullname);
00395         mac_type = inspec.CatInfo()->FileInfo().ioFlFndrInfo.fdType;
00396         mac_creator = inspec.CatInfo()->FileInfo().ioFlFndrInfo.fdCreator;
00397         FSSpec fsSpec = inspec;
00398 #else /* !macintosh */
00399 #   define MACSPEC
00400 #endif /* !macintosh */
00401
00402         kTextBinTYPE filetype = FileIsText(name, fullpath MACSPEC);
00403         if(filetype == kTextIsBinary || filetype == kTextWrongSig)
00404         {
00405             kTextBinTYPE bintype = FileIsBinary(name, fullpath MACSPEC);
00406             if(bintype != kFileIsOK)
00407                 list_add_warning(warnings, bintype, fullname);
00408             else if(filetype == kTextWrongSig)
00409             {
00410                 list_add_warning(warnings, filetype, fullname);
00411                 filetype = kTextIsBinary;
00412             }
00413         }
00414         else if(filetype != kFileIsOK)
00415             list_add_warning(warnings, filetype, fullname);
00416
00417         // add the type
00418         list_add_type(this, conflicts, filetype == kTextIsBinary,
00419                       name, fullname, mac_type, mac_creator);
00420
00421         return kContinueTraversal;
00422     }

virtual kTraversal ImportReport::OnIdle ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 366 of file ImportFilter.cpp.

00367     {
00368         return kContinueTraversal;
00369     }

Member Data Documentation

ReportConflict*& ImportReport::conflicts

Definition at line 345 of file ImportFilter.cpp.

std::vector< UStr > ImportReport::m_Ignlist

Definition at line 346 of file ImportFilter.cpp.

Referenced by list_add_type().

ReportWarning*& ImportReport::warnings

Definition at line 344 of file ImportFilter.cpp.

The documentation for this class was generated from the following file:
  • common/ImportFilter.cpp
Generated on Sun Oct 21 12:47:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


inflate_blocks_state Struct Reference

#include <infutil.h>

Collaboration diagram for inflate_blocks_state:

[legend]
List of all members.

Public Attributes

int | dummy
inflate_block_mode mode
inflate_blocks_state:: { ... } | sub
uInt last
uInt bitk
uLong bitb
Bytef * window
Bytef * end
Bytef * read
Bytef * write
check_func checkfn
uLong check
uInt left
uInt table
uInt index
uIntf * blens
uInt bb
inflate_huft * tb
inflate_blocks_state:: { ... } ::@63 | trees
inflate_huft * tl
inflate_huft * td
inflate_codes_statef * codes
inflate_blocks_state:: { ... } ::@64 | decode

Member Data Documentation

uInt inflate_blocks_state::bb

Definition at line 40 of file infutil.h.

uLong inflate_blocks_state::bitb

Definition at line 54 of file infutil.h.

uInt inflate_blocks_state::bitk

Definition at line 53 of file infutil.h.

uIntf* inflate_blocks_state::blens

Definition at line 39 of file infutil.h.

uLong inflate_blocks_state::check

Definition at line 60 of file infutil.h.

check_func inflate_blocks_state::checkfn

Definition at line 59 of file infutil.h.

inflate_codes_statef* inflate_blocks_state::codes

Definition at line 47 of file infutil.h.

struct { ... } inflate_blocks_state::decode

int inflate_blocks_state::dummy

Definition at line 9 of file inflate.c.

Bytef* inflate_blocks_state::end

Definition at line 56 of file infutil.h.

uInt inflate_blocks_state::index

Definition at line 38 of file infutil.h.

uInt inflate_blocks_state::last

Definition at line 50 of file infutil.h.

uInt inflate_blocks_state::left

Definition at line 35 of file infutil.h.

inflate_block_mode inflate_blocks_state::mode

Definition at line 31 of file infutil.h.

Bytef* inflate_blocks_state::read

Definition at line 57 of file infutil.h.

union { ... } inflate_blocks_state::sub

uInt inflate_blocks_state::table

Definition at line 37 of file infutil.h.

inflate_huft* inflate_blocks_state::tb

Definition at line 41 of file infutil.h.

inflate_huft* inflate_blocks_state::td

Definition at line 45 of file infutil.h.

inflate_huft* inflate_blocks_state::tl

Definition at line 44 of file infutil.h.

struct { ... } inflate_blocks_state::trees

Bytef* inflate_blocks_state::window

Definition at line 55 of file infutil.h.

Bytef* inflate_blocks_state::write

Definition at line 58 of file infutil.h.

The documentation for this struct was generated from the following files:
  • cvs-1.10/zlib/inflate.c
  • cvs-1.10/zlib/infutil.h
Generated on Sun Oct 21 12:48:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


inflate_codes_state Struct Reference

Collaboration diagram for inflate_codes_state:

[legend]
List of all members.

Public Types

enum {
START, LEN, LENEXT, DIST,
DISTEXT, COPY, LIT, WASH,
END, BADCODE
}

Public Attributes

int | dummy
enum inflate_codes_state:: { ... } | mode
uInt len
inflate_codes_state:: { ... } | sub
Byte lbits
Byte dbits
inflate_huft * ltree
inflate_huft * dtree
inflate_huft * tree
uInt need
inflate_codes_state:: { ... } ::@54 | code
uInt lit
uInt get
uInt dist
inflate_codes_state:: { ... } ::@55 | copy

Member Enumeration Documentation

anonymous enum

Enumeration values:
START
LEN
LENEXT
DIST
DISTEXT
COPY
LIT
WASH
END
BADCODE

Definition at line 23 of file infcodes.c.

00023        {        /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
00024       START,    /* x: set up for LEN */
00025       LEN,      /* i: get length/literal/eob next */
00026       LENEXT,   /* i: getting length extra (have base) */
00027       DIST,     /* i: get distance next */
00028       DISTEXT,  /* i: getting distance extra */
00029       COPY,     /* o: copying bytes in window, waiting for space */
00030       LIT,      /* o: got literal, waiting for output space */
00031       WASH,     /* o: got eob, possibly still output waiting */
00032       END,      /* x: got eob and all data flushed */
00033       BADCODE}  /* x: got error */

Member Data Documentation

struct { ... } inflate_codes_state::code

struct { ... } inflate_codes_state::copy

Byte inflate_codes_state::dbits

Definition at line 52 of file infcodes.c.

uInt inflate_codes_state::dist

Definition at line 46 of file infcodes.c.

inflate_huft* inflate_codes_state::dtree

Definition at line 54 of file infcodes.c.

int inflate_codes_state::dummy

Definition at line 12 of file infutil.c.

uInt inflate_codes_state::get

Definition at line 45 of file infcodes.c.

Byte inflate_codes_state::lbits

Definition at line 51 of file infcodes.c.

uInt inflate_codes_state::len

Definition at line 37 of file infcodes.c.

uInt inflate_codes_state::lit

Definition at line 43 of file infcodes.c.

inflate_huft* inflate_codes_state::ltree

Definition at line 53 of file infcodes.c.

enum { ... } inflate_codes_state::mode

uInt inflate_codes_state::need

Definition at line 41 of file infcodes.c.

union { ... } inflate_codes_state::sub

inflate_huft* inflate_codes_state::tree

Definition at line 40 of file infcodes.c.

The documentation for this struct was generated from the following files:
  • cvs-1.10/zlib/infblock.c
  • cvs-1.10/zlib/infcodes.c
  • cvs-1.10/zlib/inffast.c
  • cvs-1.10/zlib/infutil.c
Generated on Sun Oct 21 12:48:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


inflate_huft_s Struct Reference

#include <inftrees.h>

Collaboration diagram for inflate_huft_s:

[legend]
List of all members.

Public Attributes

inflate_huft_s:: { ... } | word
inflate_huft_s:: { ... } | more
Byte Exop
Byte Bits
inflate_huft_s:: { ... } ::@61 | what
Bytef * pad
uInt Base
inflate_huft * Next

Member Data Documentation

uInt inflate_huft_s::Base

Definition at line 25 of file inftrees.h.

Byte inflate_huft_s::Bits

Definition at line 20 of file inftrees.h.

Byte inflate_huft_s::Exop

Definition at line 19 of file inftrees.h.

inflate_huft* inflate_huft_s::Next

Definition at line 26 of file inftrees.h.

union { ... } inflate_huft_s::more

Referenced by r().

Bytef* inflate_huft_s::pad

Definition at line 22 of file inftrees.h.

struct { ... } inflate_huft_s::what

union { ... } inflate_huft_s::word

Referenced by r().

The documentation for this struct was generated from the following file:
  • cvs-1.10/zlib/inftrees.h
Generated on Sun Oct 21 12:48:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


internal_state Struct Reference

#include <deflate.h>

Collaboration diagram for internal_state:

[legend]
List of all members.

Public Types

enum {
METHOD, FLAG, DICT4, DICT3,
DICT2, DICT1, DICT0, BLOCKS,
CHECK4, CHECK3, CHECK2, CHECK1,
DONE, BAD
}

Public Attributes

z_streamp strm
int | status
Bytef * pending_buf
Bytef * pending_out
int | pending
int | noheader
Byte data_type
Byte method
int | last_flush
uInt w_size
uInt w_bits
uInt w_mask
Bytef * window
ulg window_size
Posf * prev
Posf * head
uInt ins_h
uInt hash_size
uInt hash_bits
uInt hash_mask
uInt hash_shift
long | block_start
uInt match_length
IPos prev_match
int | match_available
uInt strstart
uInt match_start
uInt lookahead
uInt prev_length
uInt max_chain_length
uInt max_lazy_match
int | level
int | strategy
uInt good_match
int | nice_match
ct_data_s | dyn_ltree [(2 *(256+1+29)+1)]
ct_data_s | dyn_dtree [2 *30+1]
ct_data_s | bl_tree [2 *19+1]
tree_desc_s l_desc
tree_desc_s d_desc
tree_desc_s bl_desc
ush | bl_count [15+1]
int | heap [2 *(256+1+29)+1]
int | heap_len
int | heap_max
uch | depth [2 *(256+1+29)+1]
uchf * l_buf
uInt lit_bufsize
uInt last_lit
ushf * d_buf
ulg opt_len
ulg static_len
ulg compressed_len
uInt matches
int | last_eob_len
ush bi_buf
int | bi_valid
int | dummy
enum internal_state:: { ... } | mode
internal_state:: { ... } | sub
int | nowrap
uInt wbits
inflate_blocks_statef * blocks
uInt method
uLong was
uLong need
internal_state:: { ... } ::@58 | check
uInt marker

Member Enumeration Documentation

anonymous enum

Enumeration values:
METHOD
FLAG
DICT4
DICT3
DICT2
DICT1
DICT0
BLOCKS
CHECK4
CHECK3
CHECK2
CHECK1
DONE
BAD

Definition at line 15 of file inflate.c.

00015        {
00016       METHOD,   /* waiting for method byte */
00017       FLAG,     /* waiting for flag byte */
00018       DICT4,    /* four dictionary check bytes to go */
00019       DICT3,    /* three dictionary check bytes to go */
00020       DICT2,    /* two dictionary check bytes to go */
00021       DICT1,    /* one dictionary check byte to go */
00022       DICT0,    /* waiting for inflateSetDictionary */
00023       BLOCKS,   /* decompressing blocks */
00024       CHECK4,   /* four check bytes to go */
00025       CHECK3,   /* three check bytes to go */
00026       CHECK2,   /* two check bytes to go */
00027       CHECK1,   /* one check byte to go */
00028       DONE,     /* finished check, done */
00029       BAD}      /* got an error--stay here */

Member Data Documentation

ush internal_state::bi_buf

Definition at line 240 of file deflate.h.

int internal_state::bi_valid

Definition at line 244 of file deflate.h.

ush internal_state::bl_count[ 15 +1]

Definition at line 186 of file deflate.h.

struct tree_desc_s internal_state::bl_desc

Definition at line 184 of file deflate.h.

struct ct_data_s internal_state::bl_tree[2* 19 +1]

Definition at line 180 of file deflate.h.

long internal_state::block_start

Definition at line 134 of file deflate.h.

inflate_blocks_statef* internal_state::blocks

Definition at line 46 of file inflate.c.

struct { ... } internal_state::check

ulg internal_state::compressed_len

Definition at line 232 of file deflate.h.

ushf* internal_state::d_buf

Definition at line 224 of file deflate.h.

struct tree_desc_s internal_state::d_desc

Definition at line 183 of file deflate.h.

Byte internal_state::data_type

Definition at line 89 of file deflate.h.

uch internal_state::depth[2* ( 256 +1+ 29 ) +1]

Definition at line 196 of file deflate.h.

int internal_state::dummy

Definition at line 12 of file zutil.c.

struct ct_data_s internal_state::dyn_dtree[2* 30 +1]

Definition at line 179 of file deflate.h.

struct ct_data_s internal_state::dyn_ltree[ (2* ( 256 +1+ 29 ) +1) ]

Definition at line 178 of file deflate.h.

uInt internal_state::good_match

Definition at line 171 of file deflate.h.

uInt internal_state::hash_bits

Definition at line 124 of file deflate.h.

uInt internal_state::hash_mask

Definition at line 125 of file deflate.h.

uInt internal_state::hash_shift

Definition at line 127 of file deflate.h.

uInt internal_state::hash_size

Definition at line 123 of file deflate.h.

Posf* internal_state::head

Definition at line 120 of file deflate.h.

int internal_state::heap[2* ( 256 +1+ 29 ) +1]

Definition at line 189 of file deflate.h.

int internal_state::heap_len

Definition at line 190 of file deflate.h.

int internal_state::heap_max

Definition at line 191 of file deflate.h.

uInt internal_state::ins_h

Definition at line 122 of file deflate.h.

uchf* internal_state::l_buf

Definition at line 200 of file deflate.h.

struct tree_desc_s internal_state::l_desc

Definition at line 182 of file deflate.h.

int internal_state::last_eob_len

Definition at line 234 of file deflate.h.

int internal_state::last_flush

Definition at line 91 of file deflate.h.

uInt internal_state::last_lit

Definition at line 222 of file deflate.h.

int internal_state::level

Definition at line 168 of file deflate.h.

uInt internal_state::lit_bufsize

Definition at line 202 of file deflate.h.

uInt internal_state::lookahead

Definition at line 144 of file deflate.h.

Referenced by flush().

uInt internal_state::marker

Definition at line 39 of file inflate.c.

int internal_state::match_available

Definition at line 141 of file deflate.h.

Referenced by flush().

uInt internal_state::match_length

Definition at line 139 of file deflate.h.

Referenced by flush().

uInt internal_state::match_start

Definition at line 143 of file deflate.h.

Referenced by flush().

uInt internal_state::matches

Definition at line 233 of file deflate.h.

uInt internal_state::max_chain_length

Definition at line 151 of file deflate.h.

uInt internal_state::max_lazy_match

Definition at line 157 of file deflate.h.

Referenced by flush().

uInt internal_state::method

Definition at line 34 of file inflate.c.

Byte internal_state::method

Definition at line 90 of file deflate.h.

enum { ... } internal_state::mode

uLong internal_state::need

Definition at line 37 of file inflate.c.

int internal_state::nice_match

Definition at line 174 of file deflate.h.

int internal_state::noheader

Definition at line 88 of file deflate.h.

int internal_state::nowrap

Definition at line 43 of file inflate.c.

ulg internal_state::opt_len

Definition at line 230 of file deflate.h.

int internal_state::pending

Definition at line 87 of file deflate.h.

Bytef* internal_state::pending_buf

Definition at line 85 of file deflate.h.

Bytef* internal_state::pending_out

Definition at line 86 of file deflate.h.

Posf* internal_state::prev

Definition at line 114 of file deflate.h.

uInt internal_state::prev_length

Definition at line 146 of file deflate.h.

Referenced by flush().

IPos internal_state::prev_match

Definition at line 140 of file deflate.h.

Referenced by flush().

ulg internal_state::static_len

Definition at line 231 of file deflate.h.

int internal_state::status

Definition at line 84 of file deflate.h.

int internal_state::strategy

Definition at line 169 of file deflate.h.

Referenced by flush().

z_streamp internal_state::strm

Definition at line 83 of file deflate.h.

Referenced by flush().

uInt internal_state::strstart

Definition at line 142 of file deflate.h.

Referenced by flush().

union { ... } internal_state::sub

uInt internal_state::w_bits

Definition at line 96 of file deflate.h.

uInt internal_state::w_mask

Definition at line 97 of file deflate.h.

uInt internal_state::w_size

Definition at line 95 of file deflate.h.

uLong internal_state::was

Definition at line 36 of file inflate.c.

uInt internal_state::wbits

Definition at line 44 of file inflate.c.

Bytef* internal_state::window

Definition at line 99 of file deflate.h.

Referenced by flush().

ulg internal_state::window_size

Definition at line 109 of file deflate.h.

The documentation for this struct was generated from the following files:
  • cvs-1.10/zlib/deflate.h
  • cvs-1.10/zlib/gzio.c
  • cvs-1.10/zlib/inflate.c
  • cvs-1.10/zlib/inftrees.c
  • cvs-1.10/zlib/infutil.h
  • cvs-1.10/zlib/zlib.h
  • cvs-1.10/zlib/zutil.c
Generated on Sun Oct 21 12:48:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


IOSB Struct Reference

#include <vms-types.h>

Collaboration diagram for IOSB:

[legend]
List of all members.

Public Attributes

short | status
short | count
long | devinfo

Member Data Documentation

short IOSB::count

Definition at line 14 of file vms-types.h.

long IOSB::devinfo

Definition at line 15 of file vms-types.h.

short IOSB::status

Definition at line 14 of file vms-types.h.

Referenced by evf().

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/vms-types.h
Generated on Sun Oct 21 12:48:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


irciiAttrCvt Class Reference

#include <CTCP2Parse.hpp>

Inheritance diagram for irciiAttrCvt:

[legend]
Collaboration diagram for irciiAttrCvt:

[legend]
List of all members.

Public Methods

void | ircii2ctcp (std::string *in)

Static Private Attributes

const char | tokens [5]

Member Function Documentation

void irciiAttrCvt::ircii2ctcp ( std::string * in )

Definition at line 507 of file CTCP2Parse.cpp.

Referenced by CTCP2Parse::ParseIt().

00508 {
00509     int pos, bold = 0, under = 0, rev = 0;
00510
00511     pos = in->find_first_of(tokens);
00512
00513     while (pos != std::string::npos)
00514     {
00515         switch (in->at(pos))
00516         {
00517         case CBOLD:
00518             bold = !bold;
00519             in->replace(pos, 1,
00520                 std::string("") + CCTCP2 + 'B' + (bold?'+':'-') + CCTCP2);
00521             pos += 3;   // consume the additions
00522             break;
00523
00524         case CUNDR:
00525             under = !under;
00526             in->replace(pos, 1,
00527                 std::string("") + CCTCP2 + 'U' + (under?'+':'-') + CCTCP2);
00528             pos += 3;   // consume the additions
00529             break;
00530
00531         case CREV:
00532             rev = !rev;
00533             in->replace(pos, 1,
00534                 std::string("") + CCTCP2 + 'V' + (rev?'+':'-') + CCTCP2);
00535             pos += 3;   // consume the additions
00536             break;
00537
00538         case CSTOP:
00539             bold = under = rev = 0;
00540             in->replace(pos, 1, std::string("") + CCTCP2 + 'N' + CCTCP2);
00541             pos += 2;   // consume the additions
00542         }
00543         pos = in->find_first_of(tokens,++pos);
00544     }
00545 }

Member Data Documentation

const char irciiAttrCvt::tokens [static, private]

Initial value:

 {
     (char)2 ,  (char)31 ,  (char)22 ,  (char)15 , 0
}

Definition at line 502 of file CTCP2Parse.cpp.

The documentation for this class was generated from the following files:
  • common/CTCP2Parse.hpp
  • common/CTCP2Parse.cpp
Generated on Sun Oct 21 12:48:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ISupportErrorInfo Class Reference

Inheritance diagram for ISupportErrorInfo:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CoWorker/CvsCoworker.h
Generated on Sun Oct 21 12:48:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJX_COLORMAP Struct Reference

Collaboration diagram for CJX_COLORMAP:

[legend]
List of all members.

Public Attributes

DWORD | rgbqFrom
int | iSysColorTo

Member Data Documentation

int CJX_COLORMAP::iSysColorTo

Definition at line 128 of file CJToolBar.cpp.

DWORD CJX_COLORMAP::rgbqFrom

Definition at line 127 of file CJToolBar.cpp.

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/CJLibrary/CJToolBar.cpp
Generated on Sun Oct 21 12:48:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CJX_CONTROLPOS Struct Reference

Collaboration diagram for CJX_CONTROLPOS:

[legend]
List of all members.

Public Attributes

int | nIndex
int | nID
CRect | rectOldPos

Member Data Documentation

int CJX_CONTROLPOS::nID

Definition at line 260 of file CJToolBar.cpp.

Referenced by CCJToolBar::CalcLayout().

int CJX_CONTROLPOS::nIndex

Definition at line 259 of file CJToolBar.cpp.

Referenced by CCJToolBar::CalcLayout().

CRect CJX_CONTROLPOS::rectOldPos

Definition at line 261 of file CJToolBar.cpp.

Referenced by CCJToolBar::CalcLayout().

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/CJLibrary/CJToolBar.cpp
Generated on Sun Oct 21 12:48:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CKeyString Class Reference

#include <MultiString.h>

Inheritance diagram for CKeyString:

[legend]
Collaboration diagram for CKeyString:

[legend]
List of all members.

Public Methods

CKeyString (unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass)
virtual | ~CKeyString ()

Static Public Methods

void | Concatenate (UStr &res, const char *key, const char *value)
void | Split (const char *str, UStr &key, UStr &value)

Protected Methods

virtual int | Compare (const char *s1, const char *s2) const

Constructor & Destructor Documentation

CKeyString::CKeyString | ( | unsigned int | maxstr,
 |  | const char * | uniqueName,
 |  | char *const * | defaultStr = 0L,
 |  | kClassPersistent | pclass = kNoClass
 | ) | [inline]

Definition at line 166 of file MultiString.h.

00167                                                                            :
00168         CMString(maxstr, uniqueName, defaultStr, pclass)
00169     {
00170     }

virtual CKeyString::~CKeyString ( ) [inline, virtual]

Definition at line 172 of file MultiString.h.

00173     {
00174     }

Member Function Documentation

int CKeyString::Compare | ( | const char * | s1,
 |  | const char * | s2
 | ) | const [protected, virtual]

Reimplemented from TMString.

Definition at line 207 of file MultiString.cpp.

00208 {
00209     UStr key1, key2, val1, val2;
00210     Split(s1, key1, val1);
00211     Split(s2, key2, val2);
00212     return strcmp(key1, key2);
00213 }

void CKeyString::Concatenate | ( | UStr & | res,
 |  | const char * | key,
 |  | const char * | value
 | ) | [static]

Definition at line 166 of file MultiString.cpp.

Referenced by CvsPrefs::SetWhichCvs(), and CvsPrefs::WhichCvs().

00167 {
00168     char c;
00169     while((c = *key++) != '\0')
00170     {
00171         if(c == '@' || c == '\\')
00172             res << '\\';
00173         res << c;
00174     }
00175     res << '@';
00176     while((c = *value++) != '\0')
00177     {
00178         if(c == '@' || c == '\\')
00179             res << '\\';
00180         res << c;
00181     }
00182 }

void CKeyString::Split | ( | const char * | str,
 |  | UStr & | key,
 |  | UStr & | value
 | ) | [static]

Definition at line 184 of file MultiString.cpp.

Referenced by Compare(), and CvsPrefs::WhichCvs().

00185 {
00186     key = "";
00187     value = "";
00188     char c;
00189     bool inKey = true;
00190     while((c = *str++) != 0)
00191     {
00192         if(c == '\\')
00193             c = *str++;
00194         else if(c == '@')
00195         {
00196             inKey = false;
00197             continue;
00198         }
00199
00200         if(inKey)
00201             key << c;
00202         else
00203             value << c;
00204     }
00205 }

The documentation for this class was generated from the following files:
  • common/MultiString.h
  • common/MultiString.cpp
Generated on Sun Oct 21 12:48:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KiColumn Class Reference

#include <BrowseViewColumn.h>

Inheritance diagram for KiColumn:

[legend]
List of all members.

Public Methods

virtual void | GetSetupData (LV_COLUMN *lvc) const=0
virtual bool | IsDefaultAscending () const=0
virtual void | GetText (KoColumnContext *context, EntnodeData *data, char *buffer, int buffersize) const=0
virtual int | Compare (KoColumnContext *context, EntnodeData *d1, EntnodeData *d2) const=0

Member Function Documentation

virtual int KiColumn::Compare | ( | KoColumnContext * | context,
 |  | EntnodeData * | d1,
 |  | EntnodeData * | d2
 | ) | const [pure virtual]

Reimplemented in KoNameColumn, KoPathColumn, KoRevisionColumn, KoOptionColumn, KoStatusColumn, KoTagColumn, KoDateColumn, and KoConflictColumn.

virtual void KiColumn::GetSetupData ( LV_COLUMN * lvc ) const [pure virtual]

Reimplemented in KoNameColumn, KoPathColumn, KoRevisionColumn, KoOptionColumn, KoStatusColumn, KoTagColumn, KoDateColumn, and KoConflictColumn.

virtual void KiColumn::GetText | ( | KoColumnContext * | context,
 |  | EntnodeData * | data,
 |  | char * | buffer,
 |  | int | bufferSize
 | ) | const [pure virtual]

Reimplemented in KoNameColumn, KoPathColumn, KoRevisionColumn, KoOptionColumn, KoStatusColumn, KoTagColumn, KoDateColumn, and KoConflictColumn.

Referenced by KoPathColumn::Compare().

virtual bool KiColumn::IsDefaultAscending ( ) const [pure virtual]

Reimplemented in KoNameColumn, KoPathColumn, KoRevisionColumn, KoOptionColumn, KoStatusColumn, KoTagColumn, KoDateColumn, and KoConflictColumn.

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.h
Generated on Sun Oct 21 12:48:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KiColumnModel Class Reference

#include <BrowseViewColumn.h>

Inheritance diagram for KiColumnModel:

[legend]
List of all members.

Public Methods

virtual const KiColumn * | GetAt (int pos) const=0
virtual int | GetType (int pos) const=0
virtual int | GetCount () const=0
virtual int | GetColumn (int type) const

Static Public Methods

KiColumnModel * | GetRecursiveModel ()
KiColumnModel * | GetRegularModel ()

Member Function Documentation

virtual const KiColumn* KiColumnModel::GetAt ( int pos ) const [pure virtual]

Reimplemented in KoRegularModel, and KoRecursiveModel.

Referenced by CBrowseFileView::AddColumns(), TViewFill::InitItem(), CBrowseFileView::OnColumnclick(), CBrowseFileView::OnPrint(), CBrowseFileView::ResetView(), and CBrowseFileView::Resort().

int KiColumnModel::GetColumn ( int type ) const [virtual]

Definition at line 598 of file BrowseViewColumn.cpp.

00599 {
00600     int numColumns = GetCount();
00601     for(int i = 0; i < numColumns; i++)
00602     {
00603         if(type == GetType(i))
00604             return i;
00605     }
00606     return 0;
00607 }

virtual int KiColumnModel::GetCount ( ) const [pure virtual]

Reimplemented in KoRegularModel, and KoRecursiveModel.

Referenced by CBrowseFileView::AddColumns(), CBrowseFileView::DeleteColumns(), GetColumn(), TViewFill::InitItem(), CBrowseFileView::OnPrint(), and CBrowseFileView::ResetView().

KiColumnModel * KiColumnModel::GetRecursiveModel ( ) [static]

Definition at line 588 of file BrowseViewColumn.cpp.

Referenced by CBrowseFileView::SetRecursive().

00589 {
00590     return &modelRecursive;
00591 }

KiColumnModel * KiColumnModel::GetRegularModel ( ) [static]

Definition at line 593 of file BrowseViewColumn.cpp.

Referenced by CBrowseFileView::SetRecursive().

00594 {
00595     return &modelRegular;
00596 }

virtual int KiColumnModel::GetType ( int pos ) const [pure virtual]

Reimplemented in KoRegularModel, and KoRecursiveModel.

Referenced by GetColumn().

The documentation for this class was generated from the following files:
  • common/BrowseViewColumn.h
  • common/BrowseViewColumn.cpp
Generated on Sun Oct 21 12:48:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KiFilterModel Class Reference

#include <BrowseViewModel.h>

Inheritance diagram for KiFilterModel:

[legend]
List of all members.

Public Methods

virtual bool | IsMatch (EntnodeData *data)=0
virtual NotificationManager * | GetNotificationManager ()=0

Member Function Documentation

virtual NotificationManager* KiFilterModel::GetNotificationManager ( ) [pure virtual]

Reimplemented in KoFilterModel.

Referenced by CBrowseFileView::OnDestroy(), and CBrowseFileView::OnInitialUpdate().

virtual bool KiFilterModel::IsMatch ( EntnodeData * data ) [pure virtual]

Reimplemented in KoFilterModel.

The documentation for this class was generated from the following file:
  • common/BrowseViewModel.h
Generated on Sun Oct 21 12:48:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KiIgnoreModel Class Reference

#include <BrowseViewModel.h>

Inheritance diagram for KiIgnoreModel:

[legend]
List of all members.

Public Methods

virtual bool | IsShowIgnored ()=0
virtual NotificationManager * | GetNotificationManager ()=0

Member Function Documentation

virtual NotificationManager* KiIgnoreModel::GetNotificationManager ( ) [pure virtual]

Reimplemented in KoIgnoreModel.

Referenced by CWinCvsBrowser::OnDestroy(), CBrowseFileView::OnDestroy(), CWinCvsBrowser::OnInitialUpdate(), and CBrowseFileView::OnInitialUpdate().

virtual bool KiIgnoreModel::IsShowIgnored ( ) [pure virtual]

Reimplemented in KoIgnoreModel.

Referenced by KoTraversalContext::KoTraversalContext(), and TBrowserFill::TBrowserFill().

The documentation for this class was generated from the following file:
  • common/BrowseViewModel.h
Generated on Sun Oct 21 12:48:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KiRecursionModel Class Reference

#include <BrowseViewModel.h>

Inheritance diagram for KiRecursionModel:

[legend]
List of all members.

Public Methods

virtual bool | IsShowRecursive ()=0
virtual NotificationManager * | GetNotificationManager ()=0

Member Function Documentation

virtual NotificationManager* KiRecursionModel::GetNotificationManager ( ) [pure virtual]

Reimplemented in KoRecursionModel.

Referenced by CBrowseFileView::OnDestroy(), and CBrowseFileView::OnInitialUpdate().

virtual bool KiRecursionModel::IsShowRecursive ( ) [pure virtual]

Reimplemented in KoRecursionModel.

Referenced by KoTraversalContext::KoTraversalContext().

The documentation for this class was generated from the following file:
  • common/BrowseViewModel.h
Generated on Sun Oct 21 12:48:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KiSelectionHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KiSelectionHandler:

[legend]
List of all members.

Public Methods

virtual void | OnFolder (const char *fullpath)=0
virtual void | OnFiles (MultiFiles *mf)=0

Member Function Documentation

virtual void KiSelectionHandler::OnFiles ( MultiFiles * pmf ) [pure virtual]

Reimplemented in KoMoveToTrashHandler, KoUpdateMoveToTrashHandler, KoCreateTagHandler, KoDeleteTagHandler, KoBranchTagHandler, KoEditHandler, KoUneditHandler, KoReleaseHandler, KoWatchersHandler, KoEditorsHandler, KoWatchOnHandler, KoWatchOffHandler, KoDiffHandler, KoLogHandler, KoGraphHandler, KoStatusHandler, KoFileRemoveHandler, KoLockHandler, KoUnlockHandler, KoAddHandler, KoAddBinaryHandler, KoCommitHandler, KoUpdateHandler, KoQueryUpdateHandler, and KoAnnotateHandler.

virtual void KiSelectionHandler::OnFolder ( const char * fullpath ) [pure virtual]

Reimplemented in KoMoveToTrashHandler, KoUpdateMoveToTrashHandler, KoCreateTagHandler, KoDeleteTagHandler, KoBranchTagHandler, KoEditHandler, KoUneditHandler, KoReleaseHandler, KoWatchersHandler, KoEditorsHandler, KoWatchOnHandler, KoWatchOffHandler, KoDiffHandler, KoLogHandler, KoGraphHandler, KoStatusHandler, KoFileRemoveHandler, KoLockHandler, KoUnlockHandler, KoAddHandler, KoAddBinaryHandler, KoCommitHandler, KoUpdateHandler, KoQueryUpdateHandler, and KoAnnotateHandler.

Referenced by CBrowseFileView::ProcessSelectionCommand().

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoAddBinaryHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoAddBinaryHandler:

[legend]
Collaboration diagram for KoAddBinaryHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoAddBinaryHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 360 of file BrowseViewHandlers.h.

00361     {
00362         CvsCmdAddBinaryFiles(pmf);
00363     }

virtual void KoAddBinaryHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 355 of file BrowseViewHandlers.h.

00356     {
00357         CvsCmdAddFolder(fullpath);
00358     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoAddHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoAddHandler:

[legend]
Collaboration diagram for KoAddHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoAddHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 346 of file BrowseViewHandlers.h.

00347     {
00348         CvsCmdAddFiles(pmf);
00349     }

virtual void KoAddHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 341 of file BrowseViewHandlers.h.

00342     {
00343         CvsCmdAddFolder(fullpath);
00344     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoAnnotateHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoAnnotateHandler:

[legend]
Collaboration diagram for KoAnnotateHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoAnnotateHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 416 of file BrowseViewHandlers.h.

00417     {
00418         CvsCmdAnnotateFiles(pmf);
00419     }

virtual void KoAnnotateHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 411 of file BrowseViewHandlers.h.

00412     {
00413         /*we avoid processing directory*/
00414     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoBranchTagHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoBranchTagHandler:

[legend]
Collaboration diagram for KoBranchTagHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoBranchTagHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 140 of file BrowseViewHandlers.h.

00141     {
00142         CvsCmdTagBranchFiles(pmf);
00143     }

virtual void KoBranchTagHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 135 of file BrowseViewHandlers.h.

00136     {
00137         CvsCmdTagBranchFolder(fullpath);
00138     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoColumnContext Class Reference

#include <BrowseViewColumn.h>

Collaboration diagram for KoColumnContext:

[legend]
List of all members.

Public Methods

KoColumnContext (const char *path)

Public Attributes

UStr m_path

Constructor & Destructor Documentation

KoColumnContext::KoColumnContext ( const char * path ) [inline]

Definition at line 33 of file BrowseViewColumn.h.

00034     : m_path(path)
00035     {}

Member Data Documentation

UStr KoColumnContext::m_path

Definition at line 29 of file BrowseViewColumn.h.

Referenced by KoPathColumn::GetText().

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.h
Generated on Sun Oct 21 12:48:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoCommitHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoCommitHandler:

[legend]
Collaboration diagram for KoCommitHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoCommitHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 374 of file BrowseViewHandlers.h.

00375     {
00376         CvsCmdCommitFiles(pmf);
00377     }

virtual void KoCommitHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 369 of file BrowseViewHandlers.h.

00370     {
00371         CvsCmdCommitFolder(fullpath);
00372     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoConflictColumn Class Reference

Inheritance diagram for KoConflictColumn:

[legend]
Collaboration diagram for KoConflictColumn:

[legend]
List of all members.

Public Methods

virtual void | GetSetupData (LV_COLUMN *lvc) const
virtual void | GetText (KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const
virtual int | Compare (KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const
virtual bool | IsDefaultAscending () const

Member Function Documentation

virtual int KoConflictColumn::Compare | ( | KoColumnContext * | context,
 |  | EntnodeData * | d1,
 |  | EntnodeData * | d2
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 496 of file BrowseViewColumn.cpp.

00497     {
00498         const char *s1 = d1->GetConflict();
00499         const char *s2 = d2->GetConflict();
00500         int res;
00501         if(s1 != 0L && s2 != 0L)
00502             res = strcmp(s1, s2);
00503         else
00504             res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
00505         return res;
00506     }

virtual void KoConflictColumn::GetSetupData ( LV_COLUMN * lvc ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 482 of file BrowseViewColumn.cpp.

00483     {
00484         lvc->name = "Conflict";
00485         lvc->width = 100;
00486     }

virtual void KoConflictColumn::GetText | ( | KoColumnContext * | context,
 |  | EntnodeData * | data,
 |  | char * | buffer,
 |  | int | bufferSize
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 490 of file BrowseViewColumn.cpp.

00491     {
00492         SafeCopy(buffer, data->GetConflict(), bufferSize);
00493     }

virtual bool KoConflictColumn::IsDefaultAscending ( ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 509 of file BrowseViewColumn.cpp.

00510     {
00511         return true;
00512     }

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.cpp
Generated on Sun Oct 21 12:48:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoCreateTagHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoCreateTagHandler:

[legend]
Collaboration diagram for KoCreateTagHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoCreateTagHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 112 of file BrowseViewHandlers.h.

00113     {
00114         CvsCmdTagCreateFiles(pmf);
00115     }

virtual void KoCreateTagHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 107 of file BrowseViewHandlers.h.

00108     {
00109         CvsCmdTagCreateFolder(fullpath);
00110     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoDateColumn Class Reference

Inheritance diagram for KoDateColumn:

[legend]
Collaboration diagram for KoDateColumn:

[legend]
List of all members.

Public Methods

virtual void | GetSetupData (LV_COLUMN *lvc) const
virtual void | GetText (KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const
virtual int | Compare (KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const
virtual bool | IsDefaultAscending () const

Member Function Documentation

virtual int KoDateColumn::Compare | ( | KoColumnContext * | context,
 |  | EntnodeData * | d1,
 |  | EntnodeData * | d2
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 441 of file BrowseViewColumn.cpp.

00442     {
00443         const char *s1 = (*d1)[EntnodeFile::kTS];
00444         const char *s2 = (*d2)[EntnodeFile::kTS];
00445         int res;
00446
00447         if(s1 != 0L && s2 != 0L) {
00448             time_t t1 = get_date(s1,(struct timeb *)NULL);
00449             time_t t2 = get_date(s2,(struct timeb *)NULL);
00450
00451             res = t1 < t2 ? -1 : (t1 > t2 ? 1 : 0);
00452         }
00453         else
00454             res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
00455         return res;
00456     }

virtual void KoDateColumn::GetSetupData ( LV_COLUMN * lvc ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 427 of file BrowseViewColumn.cpp.

00428     {
00429         lvc->name = "Date";
00430         lvc->width = 135;
00431     }

virtual void KoDateColumn::GetText | ( | KoColumnContext * | context,
 |  | EntnodeData * | data,
 |  | char * | buffer,
 |  | int | bufferSize
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 435 of file BrowseViewColumn.cpp.

00436     {
00437         SafeCopy(buffer, (*data)[EntnodeFile::kTS], bufferSize);
00438     }

virtual bool KoDateColumn::IsDefaultAscending ( ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 459 of file BrowseViewColumn.cpp.

00460     {
00461         return true;
00462     }

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.cpp
Generated on Sun Oct 21 12:48:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoDeleteTagHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoDeleteTagHandler:

[legend]
Collaboration diagram for KoDeleteTagHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoDeleteTagHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 126 of file BrowseViewHandlers.h.

00127     {
00128         CvsCmdTagDeleteFiles(pmf);
00129     }

virtual void KoDeleteTagHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 121 of file BrowseViewHandlers.h.

00122     {
00123         CvsCmdTagDeleteFolder(fullpath);
00124     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoDiffHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoDiffHandler:

[legend]
Collaboration diagram for KoDiffHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoDiffHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 250 of file BrowseViewHandlers.h.

00251     {
00252         CvsCmdDiffFiles(pmf);
00253     }

virtual void KoDiffHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 245 of file BrowseViewHandlers.h.

00246     {
00247         CvsCmdDiffFolder(fullpath);
00248     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoEditHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoEditHandler:

[legend]
Collaboration diagram for KoEditHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoEditHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 154 of file BrowseViewHandlers.h.

00155     {
00156         CvsCmdEditFiles(pmf);
00157     }

virtual void KoEditHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 149 of file BrowseViewHandlers.h.

00150     {
00151         CvsCmdEditFolder(fullpath);
00152     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoEditorsHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoEditorsHandler:

[legend]
Collaboration diagram for KoEditorsHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoEditorsHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 208 of file BrowseViewHandlers.h.

00209     {
00210         CvsCmdEditorsFiles(pmf);
00211     }

virtual void KoEditorsHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 203 of file BrowseViewHandlers.h.

00204     {
00205         CvsCmdEditorsFolder(fullpath);
00206     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoFileRemoveHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoFileRemoveHandler:

[legend]
Collaboration diagram for KoFileRemoveHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoFileRemoveHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 304 of file BrowseViewHandlers.h.

00305     {
00306         CvsCmdRemoveFiles(pmf);
00307     }

virtual void KoFileRemoveHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 301 of file BrowseViewHandlers.h.

00302     { /*folder cannot be removed */ }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoFilterModel Class Reference

#include <BrowseViewModel.h>

Inheritance diagram for KoFilterModel:

[legend]
Collaboration diagram for KoFilterModel:

[legend]
List of all members.

Public Methods

KoFilterModel ()
~KoFilterModel ()
virtual bool | IsMatch (EntnodeData *data)
virtual NotificationManager * | GetNotificationManager ()
bool | IsDefaultMode () const
void | ToggleModified ()
bool | IsModified () const
bool | SetMask (const char *mask)
void | ToggleConflict ()
bool | IsConflict () const
void | ToggleUnknown ()
bool | IsUnknown () const
void | ToggleHideUnknown ()
bool | IsHideUnknown () const
void | ToggleMissing ()
bool | IsMissing () const
void | ToggleChanged ()
bool | IsChanged () const
void | ToggleAdded ()
bool | IsAdded () const
void | ToggleRemoved ()
bool | IsRemoved () const

Protected Attributes

NotificationManager m_manager
UStr m_mask
std::vector< UStr > m_match
bool | m_isChanged
bool | m_isAdded
bool | m_isRemoved
bool | m_isConflicts
bool | m_isUnknown
bool | m_isHideUnknown
bool | m_isMissing

Constructor & Destructor Documentation

KoFilterModel::KoFilterModel ( )

Definition at line 37 of file BrowseViewModel.cpp.

00038 : m_isChanged(persistentChanged)
00039 , m_isAdded(persistentAdded)
00040 , m_isRemoved(persistentRemoved)
00041 , m_isConflicts(persistentConflicts)
00042 , m_isUnknown(persistentUnknown)
00043 , m_isMissing(persistentMissing)
00044 , m_isHideUnknown(persistentHideUnknown)
00045 {}

KoFilterModel::~KoFilterModel ( )

Definition at line 47 of file BrowseViewModel.cpp.

00048 {
00049     persistentChanged = m_isChanged;
00050     persistentAdded = m_isAdded;
00051     persistentRemoved = m_isRemoved;
00052     persistentConflicts = m_isConflicts;
00053     persistentUnknown = m_isUnknown;
00054     persistentMissing = m_isMissing;
00055     persistentHideUnknown = m_isHideUnknown;
00056 }

Member Function Documentation

NotificationManager * KoFilterModel::GetNotificationManager ( ) [virtual]

Reimplemented from KiFilterModel.

Definition at line 164 of file BrowseViewModel.cpp.

Referenced by CMainFrame::OnFilterMaskEntered(), CMainFrame::OnViewAdded(), CMainFrame::OnViewChanged(), CMainFrame::OnViewConflict(), CMainFrame::OnViewHideunknown(), CMainFrame::OnViewMissing(), CMainFrame::OnViewModified(), CMainFrame::OnViewRemoved(), and CMainFrame::OnViewUnknown().

00165 {
00166     return &m_manager;
00167 }

bool KoFilterModel::IsAdded ( ) const [inline]

Definition at line 257 of file BrowseViewModel.h.

Referenced by CMainFrame::OnUpdateViewAdded().

00258     {
00259         return m_isAdded;
00260     }

bool KoFilterModel::IsChanged ( ) const [inline]

Definition at line 247 of file BrowseViewModel.h.

Referenced by CMainFrame::OnUpdateViewChanged().

00248     {
00249         return m_isChanged;
00250     }

bool KoFilterModel::IsConflict ( ) const [inline]

Definition at line 206 of file BrowseViewModel.h.

Referenced by CMainFrame::OnUpdateViewConflict().

00207     {
00208         return m_isConflicts;
00209     }

bool KoFilterModel::IsDefaultMode ( ) const

Definition at line 58 of file BrowseViewModel.cpp.

Referenced by IsMatch(), and CMainFrame::OnUpdateViewHideunknown().

00059 {
00060     return !m_isConflicts && !m_isChanged && !m_isMissing && !m_isAdded && !m_isRemoved;
00061 }

bool KoFilterModel::IsHideUnknown ( ) const [inline]

Definition at line 224 of file BrowseViewModel.h.

Referenced by CMainFrame::OnUpdateViewHideunknown().

00225     {
00226         return m_isHideUnknown;
00227     }

bool KoFilterModel::IsMatch ( EntnodeData * data ) [virtual]

Reimplemented from KiFilterModel.

Definition at line 63 of file BrowseViewModel.cpp.

00064 {
00065     // check to see if file name matches
00066     if (m_match.size() && !MatchIgnoredList(data->GetName(), m_match))
00067     {
00068         return false;
00069     }
00070
00071     if (IsDefaultMode() && !m_isUnknown)
00072     {
00073         // check if unknown files are to be hidden
00074         if (data->IsUnknown() && m_isHideUnknown)
00075         {
00076             // unknown item match
00077             return false;
00078         }
00079
00080         return true;
00081     }
00082
00083     if (data->IsMissing() && data->IsRemoved() && m_isRemoved)
00084     {
00085         // removed item match
00086         return true;
00087     }
00088
00089     if (data->IsMissing() && !data->IsRemoved() && m_isMissing)
00090     {
00091         // missing item match
00092         return true;
00093     }
00094
00095     if (data->IsUnknown() && m_isUnknown)
00096     {
00097         // unknown item match
00098         return true;
00099     }
00100
00101     if ((data->GetConflict() != NULL) && m_isConflicts)
00102     {
00103         // conflict match
00104         return true;
00105     }
00106
00107     if (!data->IsUnmodified())
00108     {
00109         // can be either changed or added
00110         const char* vn = (*data)[EntnodeFile::kVN];
00111         bool isAdded = vn && (strcmp(vn, "0") == 0);
00112         if (isAdded && m_isAdded)
00113         {
00114             // added file match
00115             return true;
00116         }
00117         if (!isAdded && m_isChanged)
00118         {
00119             // changed file match
00120             return true;
00121         }
00122     }
00123
00124     // no match
00125     return false;
00126 }

bool KoFilterModel::IsMissing ( ) const [inline]

Definition at line 237 of file BrowseViewModel.h.

Referenced by CMainFrame::OnUpdateViewMissing().

00238     {
00239         return m_isMissing;
00240     }

bool KoFilterModel::IsModified ( ) const

Definition at line 158 of file BrowseViewModel.cpp.

Referenced by CMainFrame::OnUpdateViewModified(), and ToggleModified().

00159 {
00160     bool isModified = m_isAdded && m_isChanged && m_isRemoved && m_isConflicts;
00161     return isModified;
00162 }

bool KoFilterModel::IsRemoved ( ) const [inline]

Definition at line 267 of file BrowseViewModel.h.

Referenced by CMainFrame::OnUpdateViewRemoved().

00268     {
00269         return m_isRemoved;
00270     }

bool KoFilterModel::IsUnknown ( ) const [inline]

Definition at line 215 of file BrowseViewModel.h.

Referenced by CMainFrame::OnUpdateViewUnknown().

00216     {
00217         return m_isUnknown;
00218     }

bool KoFilterModel::SetMask ( const char * fileMask )

Definition at line 169 of file BrowseViewModel.cpp.

Referenced by CMainFrame::FreshenFileMask().

00170 {
00171     bool changed = m_mask.empty() || fileMask == 0L || stricmp(m_mask, fileMask) != 0;
00172     if (changed)
00173     {
00174         m_mask = fileMask;
00175         m_match.clear();
00176         if (!m_mask.empty())
00177         {
00178             // build match list
00179             UStr mask = fileMask;
00180             char * buffer = mask;
00181             static const char separators[] = " \t;";
00182             for (char * token = strtok(buffer, separators); token; token = strtok(NULL, separators))
00183             {
00184                 m_match.push_back(UStr(token));
00185             }
00186         }
00187     }
00188     return changed;
00189 }

void KoFilterModel::ToggleAdded ( ) [inline]

Definition at line 252 of file BrowseViewModel.h.

Referenced by CMainFrame::OnViewAdded().

00253     {
00254         m_isAdded = !m_isAdded;
00255     }

void KoFilterModel::ToggleChanged ( ) [inline]

Definition at line 242 of file BrowseViewModel.h.

Referenced by CMainFrame::OnViewChanged().

00243     {
00244         m_isChanged = !m_isChanged;
00245     }

void KoFilterModel::ToggleConflict ( ) [inline]

Definition at line 200 of file BrowseViewModel.h.

Referenced by CMainFrame::OnViewConflict().

00201     {
00202         m_isConflicts = !m_isConflicts;
00203     }

void KoFilterModel::ToggleHideUnknown ( )

Definition at line 129 of file BrowseViewModel.cpp.

Referenced by CMainFrame::OnViewHideunknown().

00130 {
00131     m_isHideUnknown = !m_isHideUnknown;
00132     if (m_isHideUnknown)
00133     {
00134         m_isUnknown = false;
00135     }
00136 }

void KoFilterModel::ToggleMissing ( ) [inline]

Definition at line 231 of file BrowseViewModel.h.

Referenced by CMainFrame::OnViewMissing().

00232     {
00233         m_isMissing = !m_isMissing;
00234     }

void KoFilterModel::ToggleModified ( )

Definition at line 149 of file BrowseViewModel.cpp.

Referenced by CMainFrame::OnViewModified().

00150 {
00151     m_isAdded =
00152     m_isChanged =
00153     m_isRemoved =
00154     m_isConflicts = !IsModified();
00155 }

void KoFilterModel::ToggleRemoved ( ) [inline]

Definition at line 262 of file BrowseViewModel.h.

Referenced by CMainFrame::OnViewRemoved().

00263     {
00264         m_isRemoved = !m_isRemoved;
00265     }

void KoFilterModel::ToggleUnknown ( )

Definition at line 139 of file BrowseViewModel.cpp.

Referenced by CMainFrame::OnViewUnknown().

00140 {
00141     m_isUnknown = !m_isUnknown;
00142     if (m_isUnknown)
00143     {
00144         m_isHideUnknown = false;
00145     }
00146 }

Member Data Documentation

bool KoFilterModel::m_isAdded [protected]

Definition at line 163 of file BrowseViewModel.h.

bool KoFilterModel::m_isChanged [protected]

Definition at line 162 of file BrowseViewModel.h.

bool KoFilterModel::m_isConflicts [protected]

Definition at line 165 of file BrowseViewModel.h.

bool KoFilterModel::m_isHideUnknown [protected]

Definition at line 168 of file BrowseViewModel.h.

bool KoFilterModel::m_isMissing [protected]

Definition at line 170 of file BrowseViewModel.h.

bool KoFilterModel::m_isRemoved [protected]

Definition at line 164 of file BrowseViewModel.h.

bool KoFilterModel::m_isUnknown [protected]

Definition at line 167 of file BrowseViewModel.h.

NotificationManager KoFilterModel::m_manager [protected]

Definition at line 159 of file BrowseViewModel.h.

UStr KoFilterModel::m_mask [protected]

Definition at line 160 of file BrowseViewModel.h.

std::vector<UStr> KoFilterModel::m_match [protected]

Definition at line 161 of file BrowseViewModel.h.

The documentation for this class was generated from the following files:
  • common/BrowseViewModel.h
  • common/BrowseViewModel.cpp
Generated on Sun Oct 21 12:48:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoGraphHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoGraphHandler:

[legend]
Collaboration diagram for KoGraphHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoGraphHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 278 of file BrowseViewHandlers.h.

00279     {
00280         CvsCmdLogFiles(pmf, true);
00281     }

virtual void KoGraphHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 273 of file BrowseViewHandlers.h.

00274     {
00275         /*we avoid processing directory*/
00276     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoIgnoreModel Class Reference

#include <BrowseViewModel.h>

Inheritance diagram for KoIgnoreModel:

[legend]
Collaboration diagram for KoIgnoreModel:

[legend]
List of all members.

Public Methods

KoIgnoreModel ()
~KoIgnoreModel ()
virtual bool | IsShowIgnored ()
virtual NotificationManager * | GetNotificationManager ()
void | ToggleIgnore ()

Private Attributes

NotificationManager m_manager
bool | m_isIgnore

Constructor & Destructor Documentation

KoIgnoreModel::KoIgnoreModel ( )

Definition at line 223 of file BrowseViewModel.cpp.

00224 : m_isIgnore(persistentIgnore)
00225 {}

KoIgnoreModel::~KoIgnoreModel ( )

Definition at line 227 of file BrowseViewModel.cpp.

00228 {
00229     persistentIgnore =  m_isIgnore;
00230 }

Member Function Documentation

NotificationManager * KoIgnoreModel::GetNotificationManager ( ) [virtual]

Reimplemented from KiIgnoreModel.

Definition at line 237 of file BrowseViewModel.cpp.

Referenced by CMainFrame::OnViewIgnore().

00238 {
00239     return &m_manager;
00240 }

bool KoIgnoreModel::IsShowIgnored ( ) [virtual]

Reimplemented from KiIgnoreModel.

Definition at line 232 of file BrowseViewModel.cpp.

Referenced by CMainFrame::OnUpdateViewIgnore().

00233 {
00234     return m_isIgnore;
00235 }

void KoIgnoreModel::ToggleIgnore ( )

Definition at line 242 of file BrowseViewModel.cpp.

Referenced by CMainFrame::OnViewIgnore().

00243 {
00244     m_isIgnore = !m_isIgnore;
00245 };

Member Data Documentation

bool KoIgnoreModel::m_isIgnore [private]

Definition at line 305 of file BrowseViewModel.h.

NotificationManager KoIgnoreModel::m_manager [private]

Definition at line 302 of file BrowseViewModel.h.

The documentation for this class was generated from the following files:
  • common/BrowseViewModel.h
  • common/BrowseViewModel.cpp
Generated on Sun Oct 21 12:48:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoLockHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoLockHandler:

[legend]
Collaboration diagram for KoLockHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoLockHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 318 of file BrowseViewHandlers.h.

00319     {
00320         CvsCmdLockFiles(pmf);
00321     }

virtual void KoLockHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 313 of file BrowseViewHandlers.h.

00314     {
00315         CvsCmdLockFolder(fullpath);
00316     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoLogHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoLogHandler:

[legend]
Collaboration diagram for KoLogHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoLogHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 264 of file BrowseViewHandlers.h.

00265     {
00266         CvsCmdLogFiles(pmf);
00267     }

virtual void KoLogHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 259 of file BrowseViewHandlers.h.

00260     {
00261         CvsCmdLogFolder(fullpath);
00262     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoMoveToTrashHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoMoveToTrashHandler:

[legend]
Collaboration diagram for KoMoveToTrashHandler:

[legend]
List of all members.

Public Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *mf)

Member Function Documentation

virtual void KoMoveToTrashHandler::OnFiles ( MultiFiles * mf ) [inline, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 43 of file BrowseViewHandlers.h.

00044     {
00045         if( !CvsAlert("Are you sure you want to erase selected files?", "Yes", "No") )
00046         {
00047             return;
00048         }
00049
00050         while(mf->next())
00051         {
00052             int count = mf->NumFiles();
00053             for (int i = 0; i < count; i++)
00054             {
00055                 CStr path, fileName;
00056                 if (mf->get(i, path, fileName))
00057                 {
00058                     char fn[_MAX_PATH];
00059                     _makepath(fn, NULL, path, fileName, NULL);
00060                     if(!CompatMoveToTrash(fn))
00061                     {
00062                         cvs_err("Unable to remove '%s' (error %d)\n", fn, errno);
00063                     }
00064                     else
00065                     {
00066                         cvs_out("'%s' has been moved successfully to the recycle bin...\n", fn);
00067                     }
00068                 }
00069             }
00070         }
00071     }

virtual void KoMoveToTrashHandler::OnFolder ( const char * fullpath ) [inline, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 39 of file BrowseViewHandlers.h.

00040     { /* ignore */ }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoNameColumn Class Reference

Inheritance diagram for KoNameColumn:

[legend]
Collaboration diagram for KoNameColumn:

[legend]
List of all members.

Public Methods

virtual void | GetSetupData (LV_COLUMN *lvc) const
virtual void | GetText (KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const
virtual int | Compare (KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const
virtual bool | IsDefaultAscending () const

Member Function Documentation

virtual int KoNameColumn::Compare | ( | KoColumnContext * | context,
 |  | EntnodeData * | d1,
 |  | EntnodeData * | d2
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 102 of file BrowseViewColumn.cpp.

00103     {
00104         int res = stricmp(d1->GetName(), d2->GetName());
00105         return res;
00106     }

virtual void KoNameColumn::GetSetupData ( LV_COLUMN * lvc ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 88 of file BrowseViewColumn.cpp.

00089     {
00090         lvc->name = "Name";
00091         lvc->width = 210;
00092     }

virtual void KoNameColumn::GetText | ( | KoColumnContext * | context,
 |  | EntnodeData * | data,
 |  | char * | buffer,
 |  | int | bufferSize
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 96 of file BrowseViewColumn.cpp.

00097     {
00098         SafeCopy(buffer, data->GetName(), bufferSize);
00099     }

virtual bool KoNameColumn::IsDefaultAscending ( ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 109 of file BrowseViewColumn.cpp.

00110     {
00111         return false;
00112     }

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.cpp
Generated on Sun Oct 21 12:48:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoOptionColumn Class Reference

Inheritance diagram for KoOptionColumn:

[legend]
Collaboration diagram for KoOptionColumn:

[legend]
List of all members.

Public Methods

virtual void | GetSetupData (LV_COLUMN *lvc) const
virtual void | GetText (KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const
virtual int | Compare (KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const
virtual bool | IsDefaultAscending () const

Member Function Documentation

virtual int KoOptionColumn::Compare | ( | KoColumnContext * | context,
 |  | EntnodeData * | d1,
 |  | EntnodeData * | d2
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 298 of file BrowseViewColumn.cpp.

00299     {
00300         const char *s1 = (*d1)[EntnodeFile::kOption];
00301         const char *s2 = (*d2)[EntnodeFile::kOption];
00302         int res;
00303         if(s1 != 0L && s2 != 0L)
00304             res = strcmp(s1, s2);
00305         else
00306             res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
00307         return res;
00308     }

virtual void KoOptionColumn::GetSetupData ( LV_COLUMN * lvc ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 284 of file BrowseViewColumn.cpp.

00285     {
00286         lvc->name = "Option";
00287         lvc->width = 55;
00288     }

virtual void KoOptionColumn::GetText | ( | KoColumnContext * | context,
 |  | EntnodeData * | data,
 |  | char * | buffer,
 |  | int | bufferSize
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 292 of file BrowseViewColumn.cpp.

00293     {
00294         SafeCopy(buffer, (*data)[EntnodeFile::kOption], bufferSize);
00295     }

virtual bool KoOptionColumn::IsDefaultAscending ( ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 311 of file BrowseViewColumn.cpp.

00312     {
00313         return true;
00314     }

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.cpp
Generated on Sun Oct 21 12:48:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoPathColumn Class Reference

Inheritance diagram for KoPathColumn:

[legend]
Collaboration diagram for KoPathColumn:

[legend]
List of all members.

Public Methods

virtual void | GetSetupData (LV_COLUMN *lvc) const
virtual void | GetText (KoColumnContext *context, EntnodeData *data, char *buffer, int bufferSize) const
virtual int | Compare (KoColumnContext *context, EntnodeData *d1, EntnodeData *d2) const
virtual bool | IsDefaultAscending () const

Member Function Documentation

virtual int KoPathColumn::Compare | ( | KoColumnContext * | context,
 |  | EntnodeData * | d1,
 |  | EntnodeData * | d2
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 167 of file BrowseViewColumn.cpp.

00168     {
00169         char text1[256];
00170         GetText(context, d1, text1, 256);
00171         char text2[256];
00172         GetText(context, d2, text2, 256);
00173         int res = stricmp(text1, text2);
00174         return res;
00175     }

virtual void KoPathColumn::GetSetupData ( LV_COLUMN * lvc ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 131 of file BrowseViewColumn.cpp.

00132     {
00133         lvc->name = "Path";
00134         lvc->width = 300;
00135     }

virtual void KoPathColumn::GetText | ( | KoColumnContext * | context,
 |  | EntnodeData * | data,
 |  | char * | buffer,
 |  | int | bufferSize
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 139 of file BrowseViewColumn.cpp.

00140     {
00141         UStr buf;
00142         const char *fullpath = data->GetFullPathName(buf);
00143         int len = context->m_path.length();
00144         fullpath += len;
00145         if (*fullpath == '\\')
00146         {
00147             fullpath++;
00148         }
00149         SafeCopy(buffer, fullpath, bufferSize);
00150         const char *name = data->GetName();
00151         if (name)
00152         {
00153             int lenName = strlen(name) + 1;
00154             int lenPath = strlen(buffer);
00155             if (lenPath <= lenName)
00156             {
00157                 strncpy(buffer, ".", bufferSize);
00158             }
00159             else
00160             {
00161                 buffer[lenPath - lenName] = 0;
00162             }
00163         }
00164     }

virtual bool KoPathColumn::IsDefaultAscending ( ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 178 of file BrowseViewColumn.cpp.

00179     {
00180         return false;
00181     }

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.cpp
Generated on Sun Oct 21 12:48:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoQueryUpdateHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoQueryUpdateHandler:

[legend]
Collaboration diagram for KoQueryUpdateHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoQueryUpdateHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 402 of file BrowseViewHandlers.h.

00403     {
00404         CvsCmdUpdateFiles(pmf, true);
00405     }

virtual void KoQueryUpdateHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 397 of file BrowseViewHandlers.h.

00398     {
00399         CvsCmdUpdateFolder(fullpath, true);
00400     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoRecursionModel Class Reference

#include <BrowseViewModel.h>

Inheritance diagram for KoRecursionModel:

[legend]
Collaboration diagram for KoRecursionModel:

[legend]
List of all members.

Public Methods

KoRecursionModel ()
~KoRecursionModel ()
virtual bool | IsShowRecursive ()
virtual NotificationManager * | GetNotificationManager ()
void | ToggleRecursion ()

Private Attributes

NotificationManager m_manager
bool | m_isRecursive

Constructor & Destructor Documentation

KoRecursionModel::KoRecursionModel ( )

Definition at line 195 of file BrowseViewModel.cpp.

00196 : m_isRecursive(persistentRecursive)
00197 {}

KoRecursionModel::~KoRecursionModel ( )

Definition at line 199 of file BrowseViewModel.cpp.

00200 {
00201     persistentRecursive = m_isRecursive;
00202 }

Member Function Documentation

NotificationManager * KoRecursionModel::GetNotificationManager ( ) [virtual]

Reimplemented from KiRecursionModel.

Definition at line 209 of file BrowseViewModel.cpp.

Referenced by CMainFrame::OnViewRecursive().

00210 {
00211     return &m_manager;
00212 }

bool KoRecursionModel::IsShowRecursive ( ) [virtual]

Reimplemented from KiRecursionModel.

Definition at line 204 of file BrowseViewModel.cpp.

Referenced by CMainFrame::OnUpdateViewRecursive().

00205 {
00206     return m_isRecursive;
00207 }

void KoRecursionModel::ToggleRecursion ( )

Definition at line 214 of file BrowseViewModel.cpp.

Referenced by CMainFrame::OnViewRecursive().

00215 {
00216     m_isRecursive = !m_isRecursive;
00217 };

Member Data Documentation

bool KoRecursionModel::m_isRecursive [private]

Definition at line 279 of file BrowseViewModel.h.

NotificationManager KoRecursionModel::m_manager [private]

Definition at line 276 of file BrowseViewModel.h.

The documentation for this class was generated from the following files:
  • common/BrowseViewModel.h
  • common/BrowseViewModel.cpp
Generated on Sun Oct 21 12:48:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoRecursiveModel Class Reference

Inheritance diagram for KoRecursiveModel:

[legend]
Collaboration diagram for KoRecursiveModel:

[legend]
List of all members.

Public Methods

virtual const KiColumn * | GetAt (int pos) const
virtual int | GetType (int pos) const
virtual int | GetCount () const

Member Function Documentation

virtual const KiColumn* KoRecursiveModel::GetAt ( int pos ) const [inline, virtual]

Reimplemented from KiColumnModel.

Definition at line 567 of file BrowseViewColumn.cpp.

00568     {
00569         return columnsRecursive[pos];
00570     }

virtual int KoRecursiveModel::GetCount ( ) const [inline, virtual]

Reimplemented from KiColumnModel.

Definition at line 579 of file BrowseViewColumn.cpp.

00580     {
00581         return _countof(columnsRecursive);
00582     }

virtual int KoRecursiveModel::GetType ( int pos ) const [inline, virtual]

Reimplemented from KiColumnModel.

Definition at line 573 of file BrowseViewColumn.cpp.

00574     {
00575         return typesRecursive[pos];
00576     }

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.cpp
Generated on Sun Oct 21 12:48:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoRegularModel Class Reference

Inheritance diagram for KoRegularModel:

[legend]
Collaboration diagram for KoRegularModel:

[legend]
List of all members.

Public Methods

virtual const KiColumn * | GetAt (int pos) const
virtual int | GetType (int pos) const
virtual int | GetCount () const

Member Function Documentation

virtual const KiColumn* KoRegularModel::GetAt ( int pos ) const [inline, virtual]

Reimplemented from KiColumnModel.

Definition at line 543 of file BrowseViewColumn.cpp.

00544     {
00545         return columnsRegular[pos];
00546     }

virtual int KoRegularModel::GetCount ( ) const [inline, virtual]

Reimplemented from KiColumnModel.

Definition at line 555 of file BrowseViewColumn.cpp.

00556     {
00557         return _countof(columnsRegular);
00558     }

virtual int KoRegularModel::GetType ( int pos ) const [inline, virtual]

Reimplemented from KiColumnModel.

Definition at line 549 of file BrowseViewColumn.cpp.

00550     {
00551         return typesRegular[pos];
00552     }

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.cpp
Generated on Sun Oct 21 12:48:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoReleaseHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoReleaseHandler:

[legend]
Collaboration diagram for KoReleaseHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *)

Member Function Documentation

virtual void KoReleaseHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 182 of file BrowseViewHandlers.h.

00183     {   }

virtual void KoReleaseHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 177 of file BrowseViewHandlers.h.

00178     {
00179         CvsCmdReleaseFolder(fullpath);
00180     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoRevisionColumn Class Reference

Inheritance diagram for KoRevisionColumn:

[legend]
Collaboration diagram for KoRevisionColumn:

[legend]
List of all members.

Public Methods

virtual void | GetSetupData (LV_COLUMN *lvc) const
virtual void | GetText (KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const
virtual int | Compare (KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const
virtual bool | IsDefaultAscending () const

Static Public Methods

int | revcmp (const char *rev1, const char *rev2)

Member Function Documentation

virtual int KoRevisionColumn::Compare | ( | KoColumnContext * | context,
 |  | EntnodeData * | d1,
 |  | EntnodeData * | d2
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 215 of file BrowseViewColumn.cpp.

00216     {
00217         const char *s1 = (*d1)[EntnodeFile::kVN];
00218         const char *s2 = (*d2)[EntnodeFile::kVN];
00219         int res;
00220         if(s1 != 0L && s2 != 0L)
00221             res = revcmp(s1, s2);
00222         else
00223             res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
00224         return res;
00225     }

virtual void KoRevisionColumn::GetSetupData ( LV_COLUMN * lvc ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 201 of file BrowseViewColumn.cpp.

00202     {
00203         lvc->name = "Rev.";
00204         lvc->width = 70;
00205     }

virtual void KoRevisionColumn::GetText | ( | KoColumnContext * | context,
 |  | EntnodeData * | data,
 |  | char * | buffer,
 |  | int | bufferSize
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 209 of file BrowseViewColumn.cpp.

00210     {
00211         SafeCopy(buffer, (*data)[EntnodeFile::kVN], bufferSize);
00212     }

virtual bool KoRevisionColumn::IsDefaultAscending ( ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 262 of file BrowseViewColumn.cpp.

00263     {
00264         return true;
00265     }

int KoRevisionColumn::revcmp | ( | const char * | rev1,
 |  | const char * | rev2
 | ) | [inline, static]

Definition at line 228 of file BrowseViewColumn.cpp.

00229     {
00230         if(rev1 == 0L && rev2 == 0L)
00231             return 0;
00232         else if(rev1 == 0L || rev2 == 0L)
00233             return rev1 == 0L ? -1 : 1;
00234
00235         CStr r1(rev1), r2(rev2);
00236         CStr q1, q2;
00237         char *tmp;
00238         int v1, v2;
00239
00240         if((tmp = strchr(r1, '.')) != 0L)
00241         {
00242             tmp[0] = '\0';
00243             q1 = tmp + 1;
00244         }
00245
00246         v1 = atoi(r1);
00247
00248         if((tmp = strchr(r2, '.')) != 0L)
00249         {
00250             tmp[0] = '\0';
00251             q2 = tmp + 1;
00252         }
00253         v2 = atoi(r2);
00254
00255         if(v1 == v2)
00256             return revcmp(q1.empty() ? (char *)0L : q1, q2.empty() ? (char *)0L : q2);
00257
00258         return v1 < v2 ? -1 : 1;
00259     }

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.cpp
Generated on Sun Oct 21 12:48:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoStatusColumn Class Reference

Inheritance diagram for KoStatusColumn:

[legend]
Collaboration diagram for KoStatusColumn:

[legend]
List of all members.

Public Methods

virtual void | GetSetupData (LV_COLUMN *lvc) const
virtual void | GetText (KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const
virtual int | Compare (KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const
virtual bool | IsDefaultAscending () const

Member Function Documentation

virtual int KoStatusColumn::Compare | ( | KoColumnContext * | context,
 |  | EntnodeData * | d1,
 |  | EntnodeData * | d2
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 347 of file BrowseViewColumn.cpp.

00348     {
00349         int res = stricmp((*d1)[EntnodeData::kStatus], (*d2)[EntnodeData::kStatus]);
00350         return res;
00351     }

virtual void KoStatusColumn::GetSetupData ( LV_COLUMN * lvc ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 333 of file BrowseViewColumn.cpp.

00334     {
00335         lvc->name = "Status";
00336         lvc->width = 70;
00337     }

virtual void KoStatusColumn::GetText | ( | KoColumnContext * | context,
 |  | EntnodeData * | data,
 |  | char * | buffer,
 |  | int | bufferSize
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 341 of file BrowseViewColumn.cpp.

00342     {
00343         SafeCopy(buffer, (*data)[EntnodeData::kStatus], bufferSize);
00344     }

virtual bool KoStatusColumn::IsDefaultAscending ( ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 354 of file BrowseViewColumn.cpp.

00355     {
00356         return true;
00357     }

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.cpp
Generated on Sun Oct 21 12:48:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoStatusHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoStatusHandler:

[legend]
Collaboration diagram for KoStatusHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoStatusHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 292 of file BrowseViewHandlers.h.

00293     {
00294         CvsCmdStatusFiles(pmf);
00295     }

virtual void KoStatusHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 287 of file BrowseViewHandlers.h.

00288     {
00289         CvsCmdStatusFolder(fullpath);
00290     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoTagColumn Class Reference

Inheritance diagram for KoTagColumn:

[legend]
Collaboration diagram for KoTagColumn:

[legend]
List of all members.

Public Methods

virtual void | GetSetupData (LV_COLUMN *lvc) const
virtual void | GetText (KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const
virtual int | Compare (KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const
virtual bool | IsDefaultAscending () const

Member Function Documentation

virtual int KoTagColumn::Compare | ( | KoColumnContext * | context,
 |  | EntnodeData * | d1,
 |  | EntnodeData * | d2
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 390 of file BrowseViewColumn.cpp.

00391     {
00392         const char *s1 = (*d1)[EntnodeFile::kTag];
00393         const char *s2 = (*d2)[EntnodeFile::kTag];
00394         int res;
00395         if(s1 != 0L && s2 != 0L)
00396             res = strcmp(s1, s2);
00397         else
00398             res = (long)s1 < (long)s2 ? -1 : ((long)s1 > (long)s2 ? 1 : 0);
00399         return res;
00400
00401     }

virtual void KoTagColumn::GetSetupData ( LV_COLUMN * lvc ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 376 of file BrowseViewColumn.cpp.

00377     {
00378         lvc->name = "Tag";
00379         lvc->width = 90;
00380     }

virtual void KoTagColumn::GetText | ( | KoColumnContext * | context,
 |  | EntnodeData * | data,
 |  | char * | buffer,
 |  | int | bufferSize
 | ) | const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 384 of file BrowseViewColumn.cpp.

00385     {
00386         SafeCopy(buffer, (*data)[EntnodeFile::kTag], bufferSize);
00387     }

virtual bool KoTagColumn::IsDefaultAscending ( ) const [inline, virtual]

Reimplemented from KiColumn.

Definition at line 404 of file BrowseViewColumn.cpp.

00405     {
00406         return true;
00407     }

The documentation for this class was generated from the following file:
  • common/BrowseViewColumn.cpp
Generated on Sun Oct 21 12:48:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoTraversalContext Class Reference

Collaboration diagram for KoTraversalContext:

[legend]
List of all members.

Public Methods

KoTraversalContext (CBrowseFileView *view)
bool | IsRecursive () const
bool | IsShowIgnored () const
bool | IsMatch (EntnodeData *data) const

Public Attributes

CBrowseFileView * m_view

Private Attributes

bool | m_isRecursive
bool | m_isShowIgnored
KiFilterModel * m_filter

Constructor & Destructor Documentation

KoTraversalContext::KoTraversalContext ( CBrowseFileView * view ) [inline]

Definition at line 181 of file BrowseFileView.cpp.

00182     : m_view(view), m_filter(NULL), m_isRecursive(false), m_isShowIgnored(false)
00183     {
00184         if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
00185         {
00186             m_filter = app->GetFilterModel();
00187             m_isRecursive = app->GetRecursionModel()->IsShowRecursive();
00188             m_isShowIgnored = app->GetIgnoreModel()->IsShowIgnored();
00189         }
00190     }

Member Function Documentation

bool KoTraversalContext::IsMatch ( EntnodeData * data ) const [inline]

Definition at line 202 of file BrowseFileView.cpp.

Referenced by TViewFill::ExitDirectory(), and TViewFill::OnFile().

00203     {
00204         return m_filter->IsMatch(data);
00205     }

bool KoTraversalContext::IsRecursive ( ) const [inline]

Definition at line 192 of file BrowseFileView.cpp.

Referenced by TViewFill::IsRecursive(), CBrowseFileView::OnInitialUpdate(), and CBrowseFileView::ResetView().

00193     {
00194         return m_isRecursive;
00195     }

bool KoTraversalContext::IsShowIgnored ( ) const [inline]

Definition at line 197 of file BrowseFileView.cpp.

Referenced by TViewFill::IsShowIgnored().

00198     {
00199         return m_isShowIgnored;
00200     }

Member Data Documentation

KiFilterModel* KoTraversalContext::m_filter [private]

Definition at line 175 of file BrowseFileView.cpp.

bool KoTraversalContext::m_isRecursive [private]

Definition at line 173 of file BrowseFileView.cpp.

bool KoTraversalContext::m_isShowIgnored [private]

Definition at line 174 of file BrowseFileView.cpp.

CBrowseFileView* KoTraversalContext::m_view

Definition at line 178 of file BrowseFileView.cpp.

Referenced by TViewFill::GetView().

The documentation for this class was generated from the following file:
  • WinCvs/BrowseFileView.cpp
Generated on Sun Oct 21 12:48:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoUneditHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoUneditHandler:

[legend]
Collaboration diagram for KoUneditHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoUneditHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 168 of file BrowseViewHandlers.h.

00169     {
00170         CvsCmdUneditFiles(pmf);
00171     }

virtual void KoUneditHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 163 of file BrowseViewHandlers.h.

00164     {
00165         CvsCmdUneditFolder(fullpath);
00166     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoUnlockHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoUnlockHandler:

[legend]
Collaboration diagram for KoUnlockHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoUnlockHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 332 of file BrowseViewHandlers.h.

00333     {
00334         CvsCmdUnlockFiles(pmf);
00335     }

virtual void KoUnlockHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 327 of file BrowseViewHandlers.h.

00328     {
00329         CvsCmdUnlockFolder(fullpath);
00330     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoUpdateHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoUpdateHandler:

[legend]
Collaboration diagram for KoUpdateHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoUpdateHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 388 of file BrowseViewHandlers.h.

00389     {
00390         CvsCmdUpdateFiles(pmf);
00391     }

virtual void KoUpdateHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 383 of file BrowseViewHandlers.h.

00384     {
00385         CvsCmdUpdateFolder(fullpath);
00386     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoUpdateMoveToTrashHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoUpdateMoveToTrashHandler:

[legend]
Collaboration diagram for KoUpdateMoveToTrashHandler:

[legend]
List of all members.

Public Methods

KoUpdateMoveToTrashHandler ()
virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *)
bool | IsEnabled () const

Private Attributes

bool | m_isFolders
bool | m_isFiles

Constructor & Destructor Documentation

KoUpdateMoveToTrashHandler::KoUpdateMoveToTrashHandler ( ) [inline]

Definition at line 82 of file BrowseViewHandlers.h.

00083     : m_isFolders(false), m_isFiles(false)
00084     {}

Member Function Documentation

bool KoUpdateMoveToTrashHandler::IsEnabled ( ) const [inline]

Definition at line 97 of file BrowseViewHandlers.h.

Referenced by CBrowseFileView::OnUpdateViewTrash().

00098     {
00099         return !m_isFolders && m_isFiles;
00100     }

virtual void KoUpdateMoveToTrashHandler::OnFiles ( MultiFiles * mf ) [inline, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 92 of file BrowseViewHandlers.h.

00093     {
00094         m_isFiles = true;
00095     }

virtual void KoUpdateMoveToTrashHandler::OnFolder ( const char * fullpath ) [inline, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 86 of file BrowseViewHandlers.h.

00087     {
00088         m_isFolders = true;
00089     }

Member Data Documentation

bool KoUpdateMoveToTrashHandler::m_isFiles [private]

Definition at line 79 of file BrowseViewHandlers.h.

bool KoUpdateMoveToTrashHandler::m_isFolders [private]

Definition at line 79 of file BrowseViewHandlers.h.

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoWatcher Class Reference

#include <FileViewWatcher.h>

Collaboration diagram for KoWatcher:

[legend]
List of all members.

Public Types

enum | { WM_FILECHANGE = WM_APP + 51 }

Public Methods

KoWatcher (HWND hWnd)
void | SignalStartWatch (LPCTSTR path, bool isRecursive)
void | SignalTerminate ()

Private Methods

~KoWatcher ()
UINT | Run ()
bool | StartWatch ()
void | StopWatch ()

Static Private Methods

UINT | DelegateRun (LPVOID p)

Private Attributes

CEvent | m_eventStartWatching
CEvent | m_eventTerminate
CCriticalSection | m_section
TCHAR | m_path [_MAX_PATH]
bool | m_isRecursive
HWND | m_hWnd
HANDLE | m_handles [3]
DWORD | m_count

Member Enumeration Documentation

anonymous enum

Enumeration values:
WM_FILECHANGE

Definition at line 61 of file FileViewWatcher.h.

00062     {
00063         WM_FILECHANGE = WM_APP + 51,
00064         // private message for delivering file change notification
00065     };

Constructor & Destructor Documentation

KoWatcher::KoWatcher ( HWND hWnd ) [inline]

Definition at line 70 of file FileViewWatcher.h.

00071     : m_isRecursive(false)
00072     , m_hWnd(hWnd)
00073     {
00074         m_handles[0] = m_eventStartWatching;
00075         m_handles[1] = m_eventTerminate;
00076         m_count = 2;
00077         *m_path = 0;
00078
00079         // start the thread immediately
00080         AfxBeginThread(DelegateRun, this);
00081     }

KoWatcher::~KoWatcher ( ) [inline, private]

Definition at line 85 of file FileViewWatcher.h.

00086     {}

Member Function Documentation

UINT KoWatcher::DelegateRun ( LPVOID p ) [inline, static, private]

Definition at line 110 of file FileViewWatcher.h.

00111     {
00112         KoWatcher* watcher = (KoWatcher*)p;
00113         return watcher->Run();
00114     }

UINT KoWatcher::Run ( ) [private]

Definition at line 35 of file FileViewWatcher.cpp.

Referenced by DelegateRun().

00036 {
00037     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00038
00039     for(;;)
00040     {
00041         // if a lot of changes happen suddenly in the folder, we
00042         // don't want WinCvs to die under the WM_FILECHANGE message,
00043         // so we need to slow down a bit.
00044         Sleep(app->m_isBackgroundProcess ? 2000 : 200);
00045
00046         DWORD dw = WaitForMultipleObjects(m_count, m_handles, FALSE, INFINITE);
00047         switch (dw)
00048         {
00049             case WAIT_OBJECT_0 :
00050             {
00051                 // process signal to start watching
00052                 StopWatch();
00053                 StartWatch();
00054                 m_eventStartWatching.Unlock();
00055                 break;
00056             }
00057             case WAIT_OBJECT_0 + 1 :
00058             {
00059                 // process signal to terminate
00060                 StopWatch();
00061                 delete this;
00062                 return 0;
00063             }
00064             case WAIT_OBJECT_0 + 2 :
00065             {
00066                 // process file change signal
00067                 StopWatch();
00068                 PostMessage(m_hWnd, WM_FILECHANGE, 0, 0);
00069                 break;
00070             }
00071
00072         }
00073     }
00074     return 0;
00075 }

void KoWatcher::SignalStartWatch | ( | LPCTSTR | path,
 |  | bool | isRecursive
 | ) | [inline]

Definition at line 91 of file FileViewWatcher.h.

Referenced by CBrowseFileView::ResetView().

00092     {
00093         // store parameters
00094         m_section.Lock();
00095         _tcscpy(m_path, path);
00096         m_isRecursive = isRecursive;
00097         m_section.Unlock();
00098         m_eventStartWatching.SetEvent();
00099     }

void KoWatcher::SignalTerminate ( ) [inline]

Definition at line 102 of file FileViewWatcher.h.

Referenced by CBrowseFileView::OnDestroy().

00103     {
00104         m_eventTerminate.SetEvent();
00105     }

bool KoWatcher::StartWatch ( ) [private]

Definition at line 77 of file FileViewWatcher.cpp.

Referenced by Run().

00078 {
00079     // retrieve parameters first
00080     TCHAR path[_MAX_PATH];
00081     bool isRecursive;
00082     m_section.Lock();
00083     lstrcpyn(path, m_path, _MAX_PATH);
00084     isRecursive = m_isRecursive;
00085     m_section.Unlock();
00086
00087     // start watching
00088     HANDLE h =  FindFirstChangeNotification(
00089                     path,
00090                     isRecursive,
00091                     FILE_NOTIFY_CHANGE_FILE_NAME |
00092                     FILE_NOTIFY_CHANGE_DIR_NAME |
00093                     //FILE_NOTIFY_CHANGE_SIZE |
00094                     FILE_NOTIFY_CHANGE_LAST_WRITE |
00095                     //FILE_NOTIFY_CHANGE_LAST_ACCESS |
00096 #if _MSC_VER >= 1200
00097                     //FILE_NOTIFY_CHANGE_CREATION | (makes Win98 fails)
00098 #endif
00099                     //FILE_NOTIFY_CHANGE_SECURITY |
00100                     FILE_NOTIFY_CHANGE_ATTRIBUTES
00101                 );
00102     if (h != INVALID_HANDLE_VALUE)
00103     {
00104         m_handles[2] = h;
00105         m_count = 3;
00106     }
00107     return m_count == 3;
00108 }

void KoWatcher::StopWatch ( ) [private]

Definition at line 111 of file FileViewWatcher.cpp.

Referenced by Run().

00112 {
00113     if (m_count == 3 && m_handles[2] != INVALID_HANDLE_VALUE)
00114     {
00115         // reset and close the handle
00116         FindNextChangeNotification(m_handles[2]);
00117         FindCloseChangeNotification(m_handles[2]);
00118         m_handles[2] = INVALID_HANDLE_VALUE;
00119         m_count = 2;
00120     }
00121 }

Member Data Documentation

DWORD KoWatcher::m_count [private]

Definition at line 56 of file FileViewWatcher.h.

CEvent KoWatcher::m_eventStartWatching [private]

Definition at line 35 of file FileViewWatcher.h.

CEvent KoWatcher::m_eventTerminate [private]

Definition at line 38 of file FileViewWatcher.h.

HWND KoWatcher::m_hWnd [private]

Definition at line 50 of file FileViewWatcher.h.

HANDLE KoWatcher::m_handles[3] [private]

Definition at line 53 of file FileViewWatcher.h.

bool KoWatcher::m_isRecursive [private]

Definition at line 47 of file FileViewWatcher.h.

TCHAR KoWatcher::m_path[_MAX_PATH] [private]

Definition at line 44 of file FileViewWatcher.h.

CCriticalSection KoWatcher::m_section [private]

Definition at line 41 of file FileViewWatcher.h.

The documentation for this class was generated from the following files:
  • WinCvs/FileViewWatcher.h
  • WinCvs/FileViewWatcher.cpp
Generated on Sun Oct 21 12:48:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoWatchersHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoWatchersHandler:

[legend]
Collaboration diagram for KoWatchersHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoWatchersHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 194 of file BrowseViewHandlers.h.

00195     {
00196         CvsCmdWatchersFiles(pmf);
00197     }

virtual void KoWatchersHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 189 of file BrowseViewHandlers.h.

00190     {
00191         CvsCmdWatchersFolder(fullpath);
00192     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoWatchOffHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoWatchOffHandler:

[legend]
Collaboration diagram for KoWatchOffHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoWatchOffHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 236 of file BrowseViewHandlers.h.

00237     {
00238         CvsCmdWatchOffFiles(pmf);
00239     }

virtual void KoWatchOffHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 231 of file BrowseViewHandlers.h.

00232     {
00233         CvsCmdWatchOffFolder(fullpath);
00234     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


KoWatchOnHandler Class Reference

#include <BrowseViewHandlers.h>

Inheritance diagram for KoWatchOnHandler:

[legend]
Collaboration diagram for KoWatchOnHandler:

[legend]
List of all members.

Private Methods

virtual void | OnFolder (const char *fullpath)
virtual void | OnFiles (MultiFiles *pmf)

Member Function Documentation

virtual void KoWatchOnHandler::OnFiles ( MultiFiles * pmf ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 222 of file BrowseViewHandlers.h.

00223     {
00224         CvsCmdWatchOnFiles(pmf);
00225     }

virtual void KoWatchOnHandler::OnFolder ( const char * fullpath ) [inline, private, virtual]

Reimplemented from KiSelectionHandler.

Definition at line 217 of file BrowseViewHandlers.h.

00218     {
00219         CvsCmdWatchOnFolder(fullpath);
00220     }

The documentation for this class was generated from the following file:
  • common/BrowseViewHandlers.h
Generated on Sun Oct 21 12:48:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LAttachment Class Reference

Inheritance diagram for LAttachment:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/powerplant/UPseudoSupport.cpp
Generated on Sun Oct 21 12:48:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LBevelButton Class Reference

Inheritance diagram for LBevelButton:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/powerplant/UPseudoSupport.h
Generated on Sun Oct 21 12:48:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LCommander Class Reference

Inheritance diagram for LCommander:

[legend]
The documentation for this class was generated from the following file:
  • common/MacBinEncoding.h
Generated on Sun Oct 21 12:48:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


linevector Struct Reference

Collaboration diagram for linevector:

[legend]
List of all members.

Public Attributes

unsigned int | nlines
unsigned int | lines_alloced
line ** vector

Member Data Documentation

unsigned int linevector::lines_alloced

Definition at line 6594 of file rcs.c.

unsigned int linevector::nlines

Definition at line 6592 of file rcs.c.

struct line** linevector::vector

Definition at line 6596 of file rcs.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/rcs.c
Generated on Sun Oct 21 12:48:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


list Struct Reference

#include <hash.h>

Collaboration diagram for list:

[legend]
List of all members.

Public Attributes

Node * list
Node * | hasharray [151]
list * | next

Member Data Documentation

Node* list::hasharray[ 151 ]

Definition at line 41 of file hash.h.

Node* list::list

Definition at line 40 of file hash.h.

struct list* list::next

Definition at line 42 of file hash.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/hash.h
Generated on Sun Oct 21 12:48:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


list3 Struct Reference

#include <vms-types.h>

Collaboration diagram for list3:

[legend]
List of all members.

Public Attributes

short | buflen
short | itemcode
void * | buffer
size_t * | retlen

Member Data Documentation

void* list3::buffer

Definition at line 23 of file vms-types.h.

short list3::buflen

Definition at line 21 of file vms-types.h.

short list3::itemcode

Definition at line 22 of file vms-types.h.

size_t* list3::retlen

Definition at line 24 of file vms-types.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/vms-types.h
Generated on Sun Oct 21 12:48:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ULIST_INFO Struct Reference

#include <umain.h>

Collaboration diagram for ULIST_INFO:

[legend]
List of all members.

Public Attributes

int | row
int | col
const char * | title
void * | data

Member Data Documentation

int ULIST_INFO::col

Definition at line 946 of file umain.h.

Referenced by UWidget::OnListGetInfo(), and UCvsFiles::Search().

void* ULIST_INFO::data

Definition at line 948 of file umain.h.

Referenced by UWidget::OnListGetInfo().

int ULIST_INFO::row

Definition at line 946 of file umain.h.

Referenced by UWidget::OnListGetInfo(), and UCvsFiles::Search().

const char* ULIST_INFO::title

Definition at line 947 of file umain.h.

Referenced by UWidget::OnListGetInfo(), and UCvsFiles::Search().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:48:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ULIST_INSERT Struct Reference

#include <umain.h>

Collaboration diagram for ULIST_INSERT:

[legend]
List of all members.

Public Attributes

int | row
int | col
const char * | title
void * | icon

Member Data Documentation

int ULIST_INSERT::col

Definition at line 937 of file umain.h.

Referenced by TViewFill::OnDirectory(), TViewFill::OnFile(), UWidget::OnListInsert(), and UCvsFiles::ResetView().

void* ULIST_INSERT::icon

Definition at line 939 of file umain.h.

Referenced by TViewFill::OnDirectory(), TViewFill::OnFile(), UWidget::OnListInsert(), and UCvsFiles::ResetView().

int ULIST_INSERT::row

Definition at line 937 of file umain.h.

Referenced by TViewFill::OnDirectory(), TViewFill::OnFile(), UWidget::OnListInsert(), and UCvsFiles::ResetView().

const char* ULIST_INSERT::title

Definition at line 938 of file umain.h.

Referenced by TViewFill::OnDirectory(), TViewFill::OnFile(), UWidget::OnListInsert(), and UCvsFiles::ResetView().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:48:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CListBox Class Reference

Inheritance diagram for CListBox:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJListBox.h
Generated on Sun Oct 21 12:48:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CListCtrl Class Reference

Inheritance diagram for CListCtrl:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJListCtrl.h
Generated on Sun Oct 21 12:48:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CListView Class Reference

Inheritance diagram for CListView:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/BrowseFileView.h
Generated on Sun Oct 21 12:48:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LListener Class Reference

Inheritance diagram for LListener:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/powerplant/UPseudoSupport.h
Generated on Sun Oct 21 12:48:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LMainPseudoAttachment Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for LMainPseudoAttachment:

[legend]
Collaboration diagram for LMainPseudoAttachment:

[legend]
List of all members.

Public Methods

LMainPseudoAttachment ()
virtual | ~LMainPseudoAttachment ()
virtual void | SpendTime (const EventRecord &inMacEvent)

Protected Methods

virtual void | ExecuteSelf (MessageT inMessage, void *ioParam)

Constructor & Destructor Documentation

LMainPseudoAttachment::LMainPseudoAttachment ( )

Definition at line 300 of file UPseudoSupport.cpp.

00300                                              : LAttachment(msg_AnyMessage)
00301 {
00302     StartIdling();
00303 }

LMainPseudoAttachment::~LMainPseudoAttachment ( ) [virtual]

Definition at line 305 of file UPseudoSupport.cpp.

00306 {
00307 }

Member Function Documentation

void LMainPseudoAttachment::ExecuteSelf | ( | MessageT | inMessage,
 |  | void * | ioParam
 | ) | [protected, virtual]

Definition at line 314 of file UPseudoSupport.cpp.

00315 {
00316     SetExecuteHost(true);
00317
00318     if(UPPMenu::sPPMenuWidID == -1)
00319     {
00320         NEW UPPMenu();
00321     }
00322
00323     if((inMessage > 0 && inMessage < 800) || inMessage >= EV_COMMAND_START)
00324     {
00325         int handledFlag;
00326         int res = UEventSendMessageExt(UPPMenu::sPPMenuWidID, EV_CMD,
00327             inMessage, 0L, &handledFlag);
00328         if(res == 0 && handledFlag)
00329         {
00330             SetExecuteHost(false);
00331             return;
00332         }
00333         else
00334             SetExecuteHost(true);
00335     }
00336
00337     switch (inMessage)
00338     {
00339         case msg_CommandStatus:
00340         {
00341             SCommandStatus *status = static_cast<SCommandStatus*> (ioParam);
00342             CommandT cmdid = status->command;
00343             UPseudoCmdStatusWrapper wrapper;
00344             wrapper.outEnabled = status->enabled;
00345             wrapper.outUsesMark = status->usesMark;
00346             wrapper.outMark = status->mark;
00347             wrapper.outName = status->name;
00348
00349             // first forward the command to the focused widget : if it doesn't want it
00350             // we give it to the next pseudo widget.
00351             int widFocus = UWidget::GetFocus();
00352             if(widFocus != -1)
00353             {
00354                 UCmdUI pUI(cmdid);
00355                 pUI.m_wrapper = &wrapper;
00356                 UEventSendMessage(widFocus, EV_UPDTCMD, pUI.m_nID, &pUI);
00357                 if(!pUI.CanContinue())
00358                 {
00359                     SetExecuteHost(false);
00360                     break;
00361                 }
00362             }
00363
00364             STD map<int, UCmdTarget *>::const_iterator i;
00365             const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00366             for(i = targets.begin(); i != targets.end(); ++i)
00367             {
00368                 int widid = (*i).first;
00369                 if(widid == widFocus)
00370                     continue;
00371
00372                 UCmdUI pUI(cmdid);
00373                 pUI.m_wrapper = &wrapper;
00374                 UEventSendMessage(widid, EV_UPDTCMD, pUI.m_nID, &pUI);
00375                 if(!pUI.CanContinue())
00376                     break;
00377             }
00378
00379             if(i != targets.end())
00380                 SetExecuteHost(false);
00381             break;
00382         }
00383
00384         case msg_Event:
00385         {
00386             EventRecord *ev = static_cast<EventRecord*> (ioParam);
00387
00388 #if 0
00389             if(ev->what == activateEvt)
00390             {
00391                 bool activate = (ev->modifiers & activeFlag) != 0;
00392                 LWindow *theWindow = LWindow::FetchWindowObject((WindowPtr)ev->message);
00393                 if(theWindow != 0L)
00394                 {
00395                     UEventNotifyMessage(EV_UPDATEFOCUS, !activate, theWindow);
00396                         // so the pseudo widget update its current widget.
00397                         // it's important for the menu handling.
00398                 }
00399             }
00400 #endif
00401             if(ev->what == activateEvt ||
00402                 ev->what == mouseDown ||
00403                 ev->what == mouseUp ||
00404                 ev->what == keyDown ||
00405                 ev->what == keyUp ||
00406                 ev->what == autoKey)
00407             {
00408                 UWidget::DoValidUI(false);
00409                 LCommander::SetUpdateCommandStatus(true);
00410             }
00411             break;
00412         }
00413     }
00414 }

void LMainPseudoAttachment::SpendTime ( const EventRecord & inMacEvent ) [virtual]

Definition at line 309 of file UPseudoSupport.cpp.

00310 {
00311     ::UEventGiveTime();
00312 }

The documentation for this class was generated from the following files:
  • rf/support/powerplant/UPseudoSupport.h
  • rf/support/powerplant/UPseudoSupport.cpp
Generated on Sun Oct 21 12:48:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LOCK Struct Reference

#include <vms-types.h>

Collaboration diagram for LOCK:

[legend]
List of all members.

Public Attributes

short | status
short | reserved
long | lockid
long | value [4]

Member Data Documentation

long LOCK::lockid

Definition at line 31 of file vms-types.h.

short LOCK::reserved

Definition at line 30 of file vms-types.h.

short LOCK::status

Definition at line 30 of file vms-types.h.

long LOCK::value[4]

Definition at line 32 of file vms-types.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/vms-types.h
Generated on Sun Oct 21 12:48:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


lock Struct Reference

Collaboration diagram for lock:

[legend]
List of all members.

Public Attributes

char * | repository
int | have_lckdir

Member Data Documentation

int lock::have_lckdir

Definition at line 87 of file lock.c.

char* lock::repository

Definition at line 85 of file lock.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/lock.c
Generated on Sun Oct 21 12:48:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


log_data Struct Reference

Collaboration diagram for log_data:

[legend]
List of all members.

Public Attributes

int | nameonly
int | header
int | long_header
int | notags
int | default_branch
option_revlist * revlist
datelist * | datelist
datelist * singledatelist
List * statelist
List * authorlist

Member Data Documentation

List* log_data::authorlist

Definition at line 97 of file log.c.

struct datelist* log_data::datelist

Definition at line 88 of file log.c.

int log_data::default_branch

Definition at line 82 of file log.c.

int log_data::header

Definition at line 73 of file log.c.

int log_data::long_header

Definition at line 76 of file log.c.

int log_data::nameonly

Definition at line 70 of file log.c.

int log_data::notags

Definition at line 79 of file log.c.

struct option_revlist* log_data::revlist

Definition at line 85 of file log.c.

struct datelist* log_data::singledatelist

Definition at line 91 of file log.c.

List* log_data::statelist

Definition at line 94 of file log.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/log.c
Generated on Sun Oct 21 12:48:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


log_data_and_rcs Struct Reference

Collaboration diagram for log_data_and_rcs:

[legend]
List of all members.

Public Attributes

log_data * | log_data
revlist * | revlist
RCSNode * rcs

Member Data Documentation

struct log_data* log_data_and_rcs::log_data

Definition at line 103 of file log.c.

RCSNode* log_data_and_rcs::rcs

Definition at line 105 of file log.c.

struct revlist* log_data_and_rcs::revlist

Definition at line 104 of file log.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/log.c
Generated on Sun Oct 21 12:48:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


logfile_info Struct Reference

#include <cvs.h>

Collaboration diagram for logfile_info:

[legend]
List of all members.

Public Attributes

enum classify_type | type
char * | tag
char * | rev_old
char * | rev_new

Member Data Documentation

char* logfile_info::rev_new

Definition at line 824 of file cvs.h.

char* logfile_info::rev_old

Definition at line 822 of file cvs.h.

char* logfile_info::tag

Definition at line 821 of file cvs.h.

enum classify_type logfile_info::type

Definition at line 820 of file cvs.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/cvs.h
Generated on Sun Oct 21 12:48:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CLogFrame Class Reference

#include <LogFrm.h>

Inheritance diagram for CLogFrame:

[legend]
Collaboration diagram for CLogFrame:

[legend]
List of all members.

Public Methods

CLogFrame ()
virtual BOOL | PreTranslateMessage (MSG *pMsg)
virtual BOOL | OnCmdMsg (UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo)
virtual | ~CLogFrame ()
virtual BOOL | OnCreateClient (LPCREATESTRUCT lpcs, CCreateContext *pContext)

Protected Methods

afx_msg void | OnClose ()

Constructor & Destructor Documentation

CLogFrame::CLogFrame ( )

Definition at line 66 of file LogFrm.cpp.

00067 {
00068     // TODO: add member initialization code here
00069
00070 }

CLogFrame::~CLogFrame ( ) [virtual]

Definition at line 72 of file LogFrm.cpp.

00073 {
00074 }

Member Function Documentation

void CLogFrame::OnClose ( ) [protected]

Definition at line 104 of file LogFrm.cpp.

00105 {
00106     // prevent from closing the main frame
00107     //CCJMDIChildWnd::OnClose();
00108 }

BOOL CLogFrame::OnCmdMsg | ( | UINT | nID,
 |  | int | nCode,
 |  | void * | pExtra,
 |  | AFX_CMDHANDLERINFO * | pHandlerInfo
 | ) | [virtual]

Definition at line 136 of file LogFrm.cpp.

00137 {
00138     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00139     if(app->GetMainFrame()->OnBroadcastCmdMsg(nID, nCode, pExtra, pHandlerInfo))
00140         return TRUE;
00141
00142     return CCJMDIChildWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
00143 }

BOOL CLogFrame::OnCreateClient | ( | LPCREATESTRUCT | lpcs,
 |  | CCreateContext * | pContext
 | ) | [virtual]

Definition at line 76 of file LogFrm.cpp.

00078 {
00079     BOOL res = CCJMDIChildWnd::OnCreateClient(lpcs, pContext);
00080     MDIMaximize();
00081
00082     return res;
00083 }

BOOL CLogFrame::PreTranslateMessage ( MSG * pMsg ) [virtual]

Definition at line 110 of file LogFrm.cpp.

00111 {
00112 /*  if (IsKeyMovingFocus(pMsg))
00113     {
00114         CWnd* pWnd;
00115         if (0x8000 & GetKeyState(VK_SHIFT))
00116             pWnd = FindPrevWindow(GetFocus());
00117         else
00118             pWnd = FindNextWindow(GetFocus());
00119         if(pWnd)
00120         {
00121             LRESULT DlgCode = ::SendMessage(pMsg->hwnd, WM_GETDLGCODE, 0, 0);
00122             if (!(DlgCode & (DLGC_WANTTAB | DLGC_WANTALLKEYS)))
00123             {
00124                 if (pWnd->IsKindOf(RUNTIME_CLASS(CView)))
00125                     SetActiveView((CView*)pWnd, TRUE);
00126                 else
00127                     pWnd->SetFocus();
00128             }
00129         }
00130         return TRUE;
00131     }*/
00132
00133     return CCJMDIChildWnd::PreTranslateMessage(pMsg);
00134 }

The documentation for this class was generated from the following files:
  • WinCvs/LogFrm.h
  • WinCvs/LogFrm.cpp
Generated on Sun Oct 21 12:48:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CLogNode Class Reference

#include <CvsLog.h>

Inheritance diagram for CLogNode:

[legend]
Collaboration diagram for CLogNode:

[legend]
List of all members.

Public Methods

CLogNode (CLogNode *root=0L)
virtual | ~CLogNode ()
virtual kLogNode | GetType (void) const=0
const std::vector< CLogNode *> & | Childs (void) const
std::vector< CLogNode *> & | Childs (void)
const CLogNode * | Root (void) const
CLogNode *& | Root (void)
const CLogNode * | Next (void) const
CLogNode *& | Next (void)
void | SetUserData (CLogNodeData *data)
CLogNodeData * | GetUserData (void)

Protected Attributes

std::vector< CLogNode *> | childs
CLogNode * | root
CLogNode * | next
CLogNodeData * user

Constructor & Destructor Documentation

CLogNode::CLogNode ( CLogNode * r = 0L )

Definition at line 506 of file CvsLog.cpp.

00507 {
00508     root = r;
00509     next = 0L;
00510     user = 0L;
00511 }

CLogNode::~CLogNode ( ) [virtual]

Definition at line 513 of file CvsLog.cpp.

00514 {
00515     if(Next() != 0L)
00516         delete Next();
00517     std::vector<CLogNode *>::iterator i;
00518     for(i = Childs().begin(); i != Childs().end(); ++i)
00519     {
00520         delete *i;
00521         *i = 0L;
00522     }
00523     if(user != 0L)
00524         delete user;
00525 }

Member Function Documentation

std::vector<CLogNode *>& CLogNode::Childs ( void ) [inline]

Definition at line 291 of file CvsLog.h.

00291 { return childs; }

const std::vector<CLogNode *>& CLogNode::Childs ( void ) const [inline]

Definition at line 290 of file CvsLog.h.

Referenced by CWinLogData::ComputeBounds(), CvsLogGraph(), CWinLogData::HitTest(), CWinLogData::Offset(), TGraphSelNonSig::TraverseNode(), CWinLogData::Update(), insertBranchName(), insertSymbName(), outputXML(), print(), and ~CLogNode().

00290 { return childs; }

virtual kLogNode CLogNode::GetType ( void ) const [pure virtual]

Reimplemented in CLogNodeHeader, CLogNodeRev, CLogNodeTag, and CLogNodeBranch.

Referenced by CWinLogData::CreateNewData(), CvsLogOutput(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnViewTag(), CGraphDoc::SetNode(), CWinLogData::Update(), insertBranchName(), insertSymbName(), outputXML(), and print().

CLogNodeData* CLogNode::GetUserData ( void ) [inline]

Definition at line 300 of file CvsLog.h.

Referenced by CWinLogData::CreateNewData(), CGraphView::DisableCommon(), CGraphView::OnContextMenu(), CGraphView::OnDraw(), UCvsGraph::OnDrawing(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnLButtonDown(), CGraphView::OnPrint(), CGraphView::OnQueryAnnotate(), CGraphView::OnViewDelrev(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewReload(), CGraphView::OnViewRetrieve(), CGraphView::OnViewSelnonsig(), CGraphView::OnViewTag(), CGraphView::OnViewUnlockf(), CGraphView::OnViewUpdate(), TGraphSelNonSig::TraverseNode(), TGraphDelCmd::TraverseNode(), TGraphCmdStatus::TraverseNode(), and TGraphRectSelect::TraverseNode().

00300 { return user; }

CLogNode* & CLogNode::Next ( void ) [inline]

Definition at line 297 of file CvsLog.h.

00297 { return next; }

const CLogNode* CLogNode::Next ( void ) const [inline]

Definition at line 296 of file CvsLog.h.

Referenced by CWinLogData::ComputeBounds(), CvsLogGraph(), CWinLogData::HitTest(), CWinLogData::Offset(), TGraphSelNonSig::TraverseNode(), CWinLogData::Update(), insertBranchName(), insertSymbName(), outputXML(), print(), and ~CLogNode().

00296 { return next; }

CLogNode* & CLogNode::Root ( void ) [inline]

Definition at line 294 of file CvsLog.h.

00294 { return root; }

const CLogNode* CLogNode::Root ( void ) const [inline]

Definition at line 293 of file CvsLog.h.

Referenced by CvsLogGraph().

00293 { return root; }

void CLogNode::SetUserData ( CLogNodeData * data ) [inline]

Definition at line 299 of file CvsLog.h.

Referenced by CGraphView::CalcImageSize(), UCvsGraph::CalcImageSize(), CWinLogData::CreateNewData(), and CGraphView::OnBeginPrinting().

00299 { user = data; }

Member Data Documentation

std::vector<CLogNode *> CLogNode::childs [protected]

Definition at line 302 of file CvsLog.h.

CLogNode* CLogNode::next [protected]

Definition at line 304 of file CvsLog.h.

CLogNode* CLogNode::root [protected]

Definition at line 303 of file CvsLog.h.

CLogNodeData* CLogNode::user [protected]

Definition at line 305 of file CvsLog.h.

The documentation for this class was generated from the following files:
  • cvstree/CvsLog.h
  • cvstree/CvsLog.cpp
Generated on Sun Oct 21 12:48:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CLogNodeBranch Class Reference

#include <CvsLog.h>

Inheritance diagram for CLogNodeBranch:

[legend]
Collaboration diagram for CLogNodeBranch:

[legend]
List of all members.

Public Methods

CLogNodeBranch (const CLogStr &b, CLogNode *r=0L)
virtual kLogNode | GetType (void) const
const CLogStr & | operator * () const
CLogStr & operator * ()

Protected Attributes

CLogStr branch

Constructor & Destructor Documentation

CLogNodeBranch::CLogNodeBranch | ( | const CLogStr & | b,
 |  | CLogNode * | r = 0L
 | ) | [inline]

Definition at line 356 of file CvsLog.h.

00356                                                          :
00357         CLogNode(r), branch(b) {}

Member Function Documentation

virtual kLogNode CLogNodeBranch::GetType ( void ) const [inline, virtual]

Reimplemented from CLogNode.

Definition at line 359 of file CvsLog.h.

00359 { return kNodeBranch; }

CLogStr& CLogNodeBranch::operator * ( ) [inline]

Definition at line 362 of file CvsLog.h.

00362 { return branch; }

const CLogStr& CLogNodeBranch::operator * ( ) const [inline]

Definition at line 361 of file CvsLog.h.

00361 { return branch; }

Member Data Documentation

CLogStr CLogNodeBranch::branch [protected]

Definition at line 365 of file CvsLog.h.

The documentation for this class was generated from the following file:
  • cvstree/CvsLog.h
Generated on Sun Oct 21 12:48:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CLogNodeData Class Reference

#include <CvsLog.h>

Inheritance diagram for CLogNodeData:

[legend]
Collaboration diagram for CLogNodeData:

[legend]
List of all members.

Public Methods

CLogNodeData (CLogNode *node)
virtual | ~CLogNodeData ()
CLogNode * | Node (void)

Protected Attributes

CLogNode * fNode

Constructor & Destructor Documentation

CLogNodeData::CLogNodeData ( CLogNode * node ) [inline]

Definition at line 274 of file CvsLog.h.

00274 { fNode = node; }

virtual CLogNodeData::~CLogNodeData ( ) [inline, virtual]

Definition at line 275 of file CvsLog.h.

00275 {}

Member Function Documentation

CLogNode* CLogNodeData::Node ( void ) [inline]

Definition at line 277 of file CvsLog.h.

Referenced by CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnLButtonDown(), and CGraphView::OnViewTag().

00277 { return fNode; }

Member Data Documentation

CLogNode* CLogNodeData::fNode [protected]

Definition at line 279 of file CvsLog.h.

The documentation for this class was generated from the following file:
  • cvstree/CvsLog.h
Generated on Sun Oct 21 12:48:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CLogNodeHeader Class Reference

#include <CvsLog.h>

Inheritance diagram for CLogNodeHeader:

[legend]
Collaboration diagram for CLogNodeHeader:

[legend]
List of all members.

Public Methods

CLogNodeHeader (const CRcsFile &h, CLogNode *r=0L)
virtual kLogNode | GetType (void) const
const CRcsFile & | operator * () const
CRcsFile & operator * ()

Protected Attributes

CRcsFile header

Constructor & Destructor Documentation

CLogNodeHeader::CLogNodeHeader | ( | const CRcsFile & | h,
 |  | CLogNode * | r = 0L
 | ) | [inline]

Definition at line 311 of file CvsLog.h.

00311                                                           :
00312         CLogNode(r), header(h) {}

Member Function Documentation

virtual kLogNode CLogNodeHeader::GetType ( void ) const [inline, virtual]

Reimplemented from CLogNode.

Definition at line 314 of file CvsLog.h.

00314 { return kNodeHeader; }

CRcsFile& CLogNodeHeader::operator * ( ) [inline]

Definition at line 317 of file CvsLog.h.

00317 { return header; }

const CRcsFile& CLogNodeHeader::operator * ( ) const [inline]

Definition at line 316 of file CvsLog.h.

00316 { return header; }

Member Data Documentation

CRcsFile CLogNodeHeader::header [protected]

Definition at line 320 of file CvsLog.h.

The documentation for this class was generated from the following file:
  • cvstree/CvsLog.h
Generated on Sun Oct 21 12:48:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CLogNodeRev Class Reference

#include <CvsLog.h>

Inheritance diagram for CLogNodeRev:

[legend]
Collaboration diagram for CLogNodeRev:

[legend]
List of all members.

Public Methods

CLogNodeRev (const CRevFile &r, CLogNode *root=0L)
virtual kLogNode | GetType (void) const
const CRevFile & | operator * () const
CRevFile & operator * ()

Protected Attributes

CRevFile rev

Constructor & Destructor Documentation

CLogNodeRev::CLogNodeRev | ( | const CRevFile & | r,
 |  | CLogNode * | root = 0L
 | ) | [inline]

Definition at line 326 of file CvsLog.h.

00326                                                           :
00327         CLogNode(root), rev(r) {}

Member Function Documentation

virtual kLogNode CLogNodeRev::GetType ( void ) const [inline, virtual]

Reimplemented from CLogNode.

Definition at line 329 of file CvsLog.h.

Referenced by CWinLogData::ComputeBounds(), and CWinLogData::Update().

00329 { return kNodeRev; }

CRevFile& CLogNodeRev::operator * ( ) [inline]

Definition at line 332 of file CvsLog.h.

00332 { return rev; }

const CRevFile& CLogNodeRev::operator * ( ) const [inline]

Definition at line 331 of file CvsLog.h.

00331 { return rev; }

Member Data Documentation

CRevFile CLogNodeRev::rev [protected]

Definition at line 335 of file CvsLog.h.

The documentation for this class was generated from the following file:
  • cvstree/CvsLog.h
Generated on Sun Oct 21 12:48:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CLogNodeTag Class Reference

#include <CvsLog.h>

Inheritance diagram for CLogNodeTag:

[legend]
Collaboration diagram for CLogNodeTag:

[legend]
List of all members.

Public Methods

CLogNodeTag (const CLogStr &t, CLogNode *r=0L)
virtual kLogNode | GetType (void) const
const CLogStr & | operator * () const
CLogStr & operator * ()

Protected Attributes

CLogStr tag

Constructor & Destructor Documentation

CLogNodeTag::CLogNodeTag | ( | const CLogStr & | t,
 |  | CLogNode * | r = 0L
 | ) | [inline]

Definition at line 341 of file CvsLog.h.

00341                                                       :
00342         CLogNode(r), tag(t) {}

Member Function Documentation

virtual kLogNode CLogNodeTag::GetType ( void ) const [inline, virtual]

Reimplemented from CLogNode.

Definition at line 344 of file CvsLog.h.

00344 { return kNodeTag; }

CLogStr& CLogNodeTag::operator * ( ) [inline]

Definition at line 347 of file CvsLog.h.

00347 { return tag; }

const CLogStr& CLogNodeTag::operator * ( ) const [inline]

Definition at line 346 of file CvsLog.h.

00346 { return tag; }

Member Data Documentation

CLogStr CLogNodeTag::tag [protected]

Definition at line 350 of file CvsLog.h.

The documentation for this class was generated from the following file:
  • cvstree/CvsLog.h
Generated on Sun Oct 21 12:48:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CLogoutThread Class Reference

Inheritance diagram for CLogoutThread:

[legend]
Collaboration diagram for CLogoutThread:

[legend]
List of all members.

Public Methods

CLogoutThread ()
virtual | ~CLogoutThread ()
virtual void | Delete ()
void | KillThread (void)

Protected Methods

virtual BOOL | InitInstance ()

Protected Attributes

bool | m_term

Constructor & Destructor Documentation

CLogoutThread::CLogoutThread ( )

Definition at line 126 of file wincvs.cpp.

00126                              : m_term(false)
00127 {
00128 }

CLogoutThread::~CLogoutThread ( ) [virtual]

Definition at line 130 of file wincvs.cpp.

00131 {
00132 }

Member Function Documentation

void CLogoutThread::Delete ( ) [virtual]

Definition at line 134 of file wincvs.cpp.

00135 {
00136     CWinThread::Delete();
00137 }

BOOL CLogoutThread::InitInstance ( ) [protected, virtual]

Definition at line 139 of file wincvs.cpp.

00140 {
00141     for(;;)
00142     {
00143         Sleep(1000);
00144
00145         if(m_term)
00146             return FALSE;
00147
00148         CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00149         if(gAuthen.kind() != pserver || !gCvsPrefs.HasLoogedIn() ||
00150             gCvsPrefs.LogoutTimeOut() <= 0 || app->gCvsRunning)
00151                 continue;
00152
00153         DWORD time = ::GetTickCount();
00154         if(app->GetIdleTime() != 0 &&
00155             (time - app->GetIdleTime()) >= (gCvsPrefs.LogoutTimeOut() * 60 * 1000))
00156         {
00157             app->ResetIdleTime();
00158             cvs_err("Making automatic logout after %d minute(s):\n", gCvsPrefs.LogoutTimeOut());
00159             CvsCmdLogout();
00160         }
00161     }
00162
00163     return FALSE;
00164 }

void CLogoutThread::KillThread ( void ) [inline]

Definition at line 105 of file wincvs.cpp.

00105 { m_term = true; }

Member Data Documentation

bool CLogoutThread::m_term [protected]

Definition at line 114 of file wincvs.cpp.

The documentation for this class was generated from the following file:
  • WinCvs/wincvs.cpp
Generated on Sun Oct 21 12:48:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CLogStr Class Reference

#include <CvsLog.h>

Collaboration diagram for CLogStr:

[legend]
List of all members.

Public Methods

CLogStr ()
CLogStr (const char *newstr)
CLogStr (const CLogStr &newstr)
virtual | ~CLogStr ()
bool | empty (void) const
unsigned int | length (void) const
const char * | operator= (const char *newstr)
const CLogStr & | operator= (const CLogStr &newstr)
const CLogStr & | set (const char *buf, unsigned int len)
bool | operator< (const char *newstr) const
operator const char * () const
const char * | c_str () const
CLogStr & | operator<< (const char *addToStr)
CLogStr & | operator<< (char addToStr)
CLogStr & | operator<< (int addToStr)
bool | endsWith (char c) const
const CLogStr & | replace (char which, char bywhich)

Protected Methods

void | flush (void)

Protected Attributes

char * | str

Constructor & Destructor Documentation

CLogStr::CLogStr ( ) [inline]

Definition at line 44 of file CvsLog.h.

00044 : str(0L) {}

CLogStr::CLogStr ( const char * newstr ) [inline]

Definition at line 45 of file CvsLog.h.

00046     {
00047         str = 0L;
00048         *this = newstr;
00049     }

CLogStr::CLogStr ( const CLogStr & newstr ) [inline]

Definition at line 50 of file CvsLog.h.

00051     {
00052         str = 0L;
00053         *this = newstr;
00054     }

virtual CLogStr::~CLogStr ( ) [inline, virtual]

Definition at line 55 of file CvsLog.h.

00055 { flush(); }

Member Function Documentation

const char* CLogStr::c_str ( ) const [inline]

Definition at line 70 of file CvsLog.h.

Referenced by outputXML().

00070 {return str == 0L ? "" : str;}

bool CLogStr::empty ( void ) const [inline]

Definition at line 57 of file CvsLog.h.

Referenced by main(), and print().

00057 {return str == 0L || str[0] == '\0';}

bool CLogStr::endsWith ( char c ) const [inline]

Definition at line 78 of file CvsLog.h.

00078 {return !length() ? false : str[length()-1] == c;}

void CLogStr::flush ( void ) [protected]

Definition at line 194 of file CvsLog.cpp.

Referenced by endsWith(), operator=(), set(), and ~CLogStr().

00195 {
00196     if(str == 0L)
00197         return;
00198     free(str);
00199     str = 0L;
00200 }

unsigned int CLogStr::length ( void ) const [inline]

Definition at line 58 of file CvsLog.h.

Referenced by endsWith(), and operator<<().

00058 {return str == 0L ? 0 : strlen(str);}

CLogStr::operator const char * ( ) const [inline]

Definition at line 69 of file CvsLog.h.

00069 {return str == 0L ? "" : str;}

bool CLogStr::operator< ( const char * newstr ) const

CLogStr & CLogStr::operator<< ( int addToStr )

Definition at line 290 of file CvsLog.cpp.

00291 {
00292     char astr[50];
00293     sprintf(astr, "%d", addToStr);
00294     return *this << astr;
00295 }

CLogStr & CLogStr::operator<< ( char addToStr )

Definition at line 283 of file CvsLog.cpp.

00284 {
00285     char astr[2] = {'\0', '\0'};
00286     astr[0] = addToStr;
00287     return *this << astr;
00288 }

CLogStr & CLogStr::operator<< ( const char * addToStr )

Definition at line 257 of file CvsLog.cpp.

00258 {
00259     if(addToStr == 0L)
00260         return *this;
00261
00262     if(str == 0L)
00263     {
00264         *this = addToStr;
00265         return *this;
00266     }
00267
00268     unsigned int len = strlen(addToStr);
00269     if(len == 0)
00270         return *this;
00271
00272     unsigned curlen = length();
00273     str = (char *)realloc(str, (len + curlen + 1) * sizeof(char));
00274     if(str == 0L)
00275         throw std::bad_alloc();
00276
00277     memcpy(str + curlen, addToStr, len * sizeof(char));
00278     str[len + curlen] = '\0';
00279
00280     return *this;
00281 }

const CLogStr & CLogStr::operator= ( const CLogStr & newstr )

Definition at line 218 of file CvsLog.cpp.

00219 {
00220     flush();
00221     *this = (const char *)newstr;
00222     return *this;
00223 }

const char * CLogStr::operator= ( const char * newstr )

Definition at line 202 of file CvsLog.cpp.

00203 {
00204     flush();
00205     if(newstr == 0L)
00206         return 0L;
00207
00208     int l = strlen(newstr);
00209     str = (char *)malloc((l + 1) * sizeof(char));
00210     if(str == 0L)
00211         throw std::bad_alloc();
00212
00213     strcpy(str, newstr);
00214
00215     return *this;
00216 }

const CLogStr & CLogStr::replace | ( | char | which,
 |  | char | bywhich
 | ) |

Definition at line 241 of file CvsLog.cpp.

Referenced by endsWith().

00242 {
00243     if(str == 0L)
00244         return *this;
00245
00246     char *buf = str;
00247     while(*buf)
00248     {
00249         if(*buf == which)
00250             *buf++ = bywhich;
00251         else
00252             buf++;
00253     }
00254     return *this;
00255 }

const CLogStr & CLogStr::set | ( | const char * | buf,
 |  | unsigned int | len
 | ) |

Definition at line 225 of file CvsLog.cpp.

00226 {
00227     flush();
00228     if(len == 0)
00229         return *this;
00230
00231     str = (char *)malloc((len + 1) * sizeof(char));
00232     if(str == 0L)
00233         throw std::bad_alloc();
00234
00235     memcpy(str, buf, len * sizeof(char));
00236     str[len] = '\0';
00237
00238     return *this;
00239 }

Member Data Documentation

char* CLogStr::str [protected]

Definition at line 85 of file CvsLog.h.

The documentation for this class was generated from the following files:
  • cvstree/CvsLog.h
  • cvstree/CvsLog.cpp
Generated on Sun Oct 21 12:48:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LOutlineItem Class Reference

Inheritance diagram for LOutlineItem:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/powerplant/UPseudoSupport.h
Generated on Sun Oct 21 12:48:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LOutlineTable Class Reference

Inheritance diagram for LOutlineTable:

[legend]
The documentation for this class was generated from the following file:
  • common/MacBinEncoding.h
Generated on Sun Oct 21 12:48:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LPane Class Reference

Inheritance diagram for LPane:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/powerplant/UPseudoSupport.h
Generated on Sun Oct 21 12:48:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LPeriodical Class Reference

Inheritance diagram for LPeriodical:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/powerplant/UPseudoSupport.h
Generated on Sun Oct 21 12:48:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LPlaceHolder Class Reference

Inheritance diagram for LPlaceHolder:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/powerplant/UPseudoSupport.h
Generated on Sun Oct 21 12:48:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LPseudoDrawAttachment Class Reference

Inheritance diagram for LPseudoDrawAttachment:

[legend]
Collaboration diagram for LPseudoDrawAttachment:

[legend]
List of all members.

Public Methods

LPseudoDrawAttachment (int widid, int cmdid)
virtual | ~LPseudoDrawAttachment ()

Protected Methods

virtual void | ExecuteSelf (MessageT inMessage, void *ioParam)

Protected Attributes

int | m_widid
int | m_cmdid

Constructor & Destructor Documentation

LPseudoDrawAttachment::LPseudoDrawAttachment | ( | int | widid,
 |  | int | cmdid
 | ) |

Definition at line 284 of file UPseudoSupport.cpp.

00284                                                                  : LAttachment(msg_DrawOrPrint),
00285     m_widid(widid), m_cmdid(cmdid)
00286 {
00287 }

LPseudoDrawAttachment::~LPseudoDrawAttachment ( ) [virtual]

Definition at line 289 of file UPseudoSupport.cpp.

00290 {
00291 }

Member Function Documentation

void LPseudoDrawAttachment::ExecuteSelf | ( | MessageT | inMessage,
 |  | void * | ioParam
 | ) | [protected, virtual]

Definition at line 293 of file UPseudoSupport.cpp.

00294 {
00295     SetExecuteHost(true);
00296     LView *view = dynamic_cast<LView*>(GetOwnerHost());
00297     UEventSendMessage(m_widid, EV_CUSTOM_DRAW, m_cmdid, view);
00298 }

Member Data Documentation

int LPseudoDrawAttachment::m_cmdid [protected]

Definition at line 63 of file UPseudoSupport.cpp.

int LPseudoDrawAttachment::m_widid [protected]

Definition at line 63 of file UPseudoSupport.cpp.

The documentation for this class was generated from the following file:
  • rf/support/powerplant/UPseudoSupport.cpp
Generated on Sun Oct 21 12:48:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LPseudoWinAttachment Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for LPseudoWinAttachment:

[legend]
Collaboration diagram for LPseudoWinAttachment:

[legend]
List of all members.

Public Methods

LPseudoWinAttachment (int widid)
virtual | ~LPseudoWinAttachment ()
int | GetPageValue (int cmdid) const
void | SetPageValue (int cmdid, int value)
void | CheckWindowSize (void)
int | SearchWidID (LPane *pane)
void | InvalidCache (UWidget *tab_wid)

Protected Methods

virtual void | ExecuteSelf (MessageT inMessage, void *ioParam)
virtual void | ListenToMessage (MessageT inMessage, void *ioParam)

Protected Attributes

int | m_widid
Rect | m_lastRect
std::map< int, int > | m_PageValues
std::map< LPane *, int > | m_CacheWidgets

Constructor & Destructor Documentation

LPseudoWinAttachment::LPseudoWinAttachment ( int widid )

Definition at line 416 of file UPseudoSupport.cpp.

00416                                                     : LAttachment(msg_GrowZone), m_widid(widid)
00417 {
00418     ::SetRect(&m_lastRect, 0, 0, 0, 0);
00419
00420     CheckWindowSize();
00421 }

LPseudoWinAttachment::~LPseudoWinAttachment ( ) [virtual]

Definition at line 423 of file UPseudoSupport.cpp.

00424 {
00425     UEventSendMessage(m_widid, EV_DESTROY, 0, 0L);
00426 }

Member Function Documentation

void LPseudoWinAttachment::CheckWindowSize ( void )

Definition at line 450 of file UPseudoSupport.cpp.

Referenced by UPseudoFakePane::AdaptToSuperFrameSize(), and LPseudoWinAttachment().

00451 {
00452     LWindow *wind = dynamic_cast<LWindow*>(GetOwnerHost());
00453     if(wind != 0L)
00454     {
00455         Rect r;
00456         wind->GetGlobalBounds(r);
00457         if(!::EqualRect(&r, &m_lastRect))
00458         {
00459             m_lastRect = r;
00460             URect ur(r);
00461             UEventSendMessage(m_widid, EV_RESIZE, kUMainWidget, &ur);
00462         }
00463     }
00464 }

void LPseudoWinAttachment::ExecuteSelf | ( | MessageT | inMessage,
 |  | void * | ioParam
 | ) | [protected, virtual]

Definition at line 443 of file UPseudoSupport.cpp.

00444 {
00445     SetExecuteHost(true);
00446
00447     // not used yet
00448 }

int LPseudoWinAttachment::GetPageValue ( int cmdid ) const

Definition at line 428 of file UPseudoSupport.cpp.

Referenced by ListenToMessage(), and UWidget::OnGetSliderProperty().

00429 {
00430     std::map<int, int>::const_iterator i = m_PageValues.find(cmdid);
00431     if(i != m_PageValues.end())
00432         return (*i).second;
00433     return 1;
00434 }

void LPseudoWinAttachment::InvalidCache ( UWidget * tab_wid )

Definition at line 503 of file UPseudoSupport.cpp.

Referenced by UWidget::OnPageChanged().

00504 {
00505     std::map<int, void *>::iterator s;
00506     for(s = tab_wid->m_widgets.begin(); s != tab_wid->m_widgets.end(); ++s)
00507     {
00508         std::map<LPane *, int>::iterator i = m_CacheWidgets.find((LPane *)(*s).second);
00509         if(i != m_CacheWidgets.end())
00510             m_CacheWidgets.erase(i);
00511     }
00512 }

void LPseudoWinAttachment::ListenToMessage | ( | MessageT | inMessage,
 |  | void * | ioParam
 | ) | [protected, virtual]

Definition at line 515 of file UPseudoSupport.cpp.

00518 {
00519     int cmdid;
00520     LPane *pane;
00521
00522     if(gTurnOffBroadcast)
00523         return;
00524
00525     if(macpp_getcmdid(inMessage, cmdid))
00526     {
00527         LWindow *wind = dynamic_cast<LWindow*>(GetOwnerHost());
00528         if(wind != 0L)
00529         {
00530             pane = wind->FindPaneByID(inMessage);
00531
00532             if(pane != 0L)
00533             {
00534                 int widid = SearchWidID(pane);
00535
00536                 LEditText *edit;
00537                 LControl *control;
00538                 LMenuController *popup;
00539                 LScrollBar *bar;
00540                 LSlider *slider;
00541                 LLittleArrows *arrows;
00542                 LCheckBoxGroupBox *groupbox;
00543
00544                 if((edit = dynamic_cast<LEditText*>(pane)) != 0L)
00545                     UEventSendMessage(widid, EV_EDITCHANGE, cmdid, 0L);
00546                 else if((popup = dynamic_cast<LMenuController*>(pane)) != 0L &&
00547                     popup->GetMacMenuH() != 0L)
00548                 {
00549                     SInt16 item = popup->GetCurrentMenuItem();
00550                     LStr255 pstr;
00551                     if(item > 0)
00552                         popup->GetMenuItemText(item, pstr);
00553                     UStr content(pstr);
00554                     UEventSendMessage(widid, EV_COMBO_SEL, UMAKEINT(cmdid, item - 1),
00555                         (void *)(const char *)content);
00556                 }
00557                 else if((bar = dynamic_cast<LScrollBar*>(pane)) != 0L)
00558                     UEventSendMessage(widid, EV_SCROLLCHANGE, cmdid, (void *)bar->GetValue());
00559                 else if((slider = dynamic_cast<LSlider*>(pane)) != 0L)
00560                     UEventSendMessage(widid, EV_SCROLLCHANGE, cmdid, (void *)slider->GetValue());
00561                 else if((arrows = dynamic_cast<LLittleArrows*>(pane)) != 0L)
00562                     UEventSendMessage(widid, EV_SCROLLCHANGE, cmdid, (void *)arrows->GetValue());
00563                 else if((control = dynamic_cast<LControl*>(pane)) != 0L)
00564                     UEventSendMessage(widid, EV_CMD, cmdid, 0L);
00565                 else if((groupbox = dynamic_cast<LCheckBoxGroupBox*>(pane)) != 0L)
00566                     UEventSendMessage(widid, EV_CMD, cmdid, 0L);
00567             }
00568         }
00569     }
00570     else switch (inMessage)
00571     {
00572         case msg_ScrollAction:
00573         {
00574             LScrollBar::SScrollMessage *message = static_cast<LScrollBar::SScrollMessage *>(ioParam);
00575             LScrollBar* scrollBar = message->scrollBar;
00576             int fPageStep = 1;
00577             if(macpp_getcmdid(scrollBar->GetPaneID(), cmdid))
00578                 fPageStep = GetPageValue(cmdid);
00579             int fButtonStep = 1;
00580             switch(message->hotSpot)
00581             {
00582             case kControlPageUpPart:
00583                 scrollBar->SetValue(scrollBar->GetValue() - fPageStep);
00584                 break;
00585             case kControlUpButtonPart:
00586                 scrollBar->SetValue(scrollBar->GetValue() - fButtonStep);
00587                 break;
00588             case kControlPageDownPart:
00589                 scrollBar->SetValue(scrollBar->GetValue() + fPageStep);
00590                 break;
00591             case kControlDownButtonPart:
00592                 scrollBar->SetValue(scrollBar->GetValue() + fButtonStep);
00593                 break;
00594             }
00595             break;
00596         }
00597         case UTextTableView_SingleClick:
00598         case UTextTableView_DoubleClick:
00599             pane = static_cast<LPane *>(ioParam);
00600
00601             if(pane != 0L && macpp_getcmdid(pane, cmdid))
00602             {
00603                 UStr name;
00604                 int entry = 0;
00605                 LTextTableView *table = dynamic_cast<LTextTableView *>(pane);
00606                 if(table != 0L)
00607                 {
00608                     STableCell cell = table->GetFirstSelectedCell();
00609                     if(!cell.IsNullCell())
00610                     {
00611                         char tmp[255];
00612                         UInt32 ioDataSize = 255;
00613                         table->GetCellData(cell, tmp, ioDataSize);
00614                         name.set(tmp, ioDataSize);
00615                         entry = cell.row;
00616                     }
00617                 }
00618
00619                 UEventSendMessage(SearchWidID(pane),
00620                     inMessage == UTextTableView_SingleClick ?
00621                     EV_LIST_SELECTING : EV_LIST_DBLCLICK, UMAKEINT(cmdid, entry - 1),
00622                     (void *)(const char *)name);
00623             }
00624             break;
00625     }
00626 }

int LPseudoWinAttachment::SearchWidID ( LPane * pane )

Definition at line 466 of file UPseudoSupport.cpp.

Referenced by ListenToMessage().

00467 {
00468     int res = m_widid;
00469
00470     // first ask the cache
00471     std::map<LPane *, int>::iterator i = m_CacheWidgets.find(pane);
00472     if(i != m_CacheWidgets.end())
00473         return (*i).second;
00474
00475     // then look if it belongs to a tab
00476     UCmdTarget *target = UEventQueryWidget(m_widid);
00477     UWidget *wid = UDYNAMIC_CAST(UWidget, target);
00478     if(wid == 0L)
00479         return res;
00480
00481     std::map<int, UWidget *>::iterator t;
00482     for(t = wid->m_tabs.begin(); t != wid->m_tabs.end(); ++t)
00483     {
00484         UWidget *tab = (*t).second;
00485         std::map<int, void *>::iterator s;
00486         for(s = tab->m_widgets.begin(); s != tab->m_widgets.end(); ++s)
00487         {
00488             if((*s).second == (void *)pane)
00489             {
00490                 res = tab->GetWidID();
00491                 break; // it's a tab widget
00492             }
00493         }
00494     }
00495
00496     // so we guess it's in the main widget !
00497     std::map<LPane *, int>::value_type val(pane, res);
00498     m_CacheWidgets.insert(val);
00499
00500     return res;
00501 }

void LPseudoWinAttachment::SetPageValue | ( | int | cmdid,
 |  | int | value
 | ) |

Definition at line 436 of file UPseudoSupport.cpp.

Referenced by UWidget::OnSetSliderProperty().

00437 {
00438     std::map<int, int>::value_type val(cmdid, value);
00439     m_PageValues.erase(cmdid);
00440     m_PageValues.insert(val);
00441 }

Member Data Documentation

std::map<LPane *, int> LPseudoWinAttachment::m_CacheWidgets [protected]

Definition at line 137 of file UPseudoSupport.h.

std::map<int, int> LPseudoWinAttachment::m_PageValues [protected]

Definition at line 136 of file UPseudoSupport.h.

Rect LPseudoWinAttachment::m_lastRect [protected]

Definition at line 135 of file UPseudoSupport.h.

int LPseudoWinAttachment::m_widid [protected]

Definition at line 134 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/powerplant/UPseudoSupport.h
  • rf/support/powerplant/UPseudoSupport.cpp
Generated on Sun Oct 21 12:48:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


LV_COLUMN Struct Reference

#include <BrowseViewColumn.h>

Collaboration diagram for LV_COLUMN:

[legend]
List of all members.

Public Attributes

int | width
const char * | name

Member Data Documentation

const char* LV_COLUMN::name

Definition at line 42 of file BrowseViewColumn.h.

Referenced by KoConflictColumn::GetSetupData(), KoDateColumn::GetSetupData(), KoTagColumn::GetSetupData(), KoStatusColumn::GetSetupData(), KoOptionColumn::GetSetupData(), KoRevisionColumn::GetSetupData(), KoPathColumn::GetSetupData(), and KoNameColumn::GetSetupData().

int LV_COLUMN::width

Definition at line 41 of file BrowseViewColumn.h.

Referenced by KoConflictColumn::GetSetupData(), KoDateColumn::GetSetupData(), KoTagColumn::GetSetupData(), KoStatusColumn::GetSetupData(), KoOptionColumn::GetSetupData(), KoRevisionColumn::GetSetupData(), KoPathColumn::GetSetupData(), and KoNameColumn::GetSetupData().

The documentation for this struct was generated from the following file:
  • common/BrowseViewColumn.h
Generated on Sun Oct 21 12:48:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UMacAppMenu Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for UMacAppMenu:

[legend]
Collaboration diagram for UMacAppMenu:

[legend]
List of all members.

Public Methods

UMacAppMenu ()
virtual | ~UMacAppMenu ()
void | OnUpdateUI (void)
EV_UPDATEUI is a notification sent to all the widgets when the user interface is invalid. the default is to send a EV_UPDTCMD to each sub-widget. More...

Static Public Attributes

int | sMAMenuWidID = -1

Protected Methods

virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Constructor & Destructor Documentation

UMacAppMenu::UMacAppMenu ( )

Definition at line 772 of file UPseudoSupport.cpp.

00772                          : UMenu(::UEventGetWidID())
00773 {
00774     sMAMenuWidID = GetWidID();
00775 }

UMacAppMenu::~UMacAppMenu ( ) [virtual]

Definition at line 777 of file UPseudoSupport.cpp.

00778 {
00779 }

Member Function Documentation

const UMSGMAP* UMacAppMenu::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UMenu.

virtual const UMSGMAP* UMacAppMenu::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UMenu.

const UMSGMAP* UMacAppMenu::GetThisMessageMap ( ) [static, protected]

Reimplemented from UMenu.

void UMacAppMenu::OnUpdateUI ( void )

EV_UPDATEUI is a notification sent to all the widgets when the user interface is invalid. the default is to send a EV_UPDTCMD to each sub-widget.

Reimplemented from UMenu.

Definition at line 789 of file UPseudoSupport.cpp.

00790 {
00791     static bool sSemaphore = false;
00792     USemaphore policeman(sSemaphore);
00793     if(policeman.IsEnteredTwice())
00794         return;
00795
00796     // this is the interesting thing about the toolbar : it resends the
00797     // update UI to other widgets according to the focus information and
00798     // allows the update to be handled several times if the handler asks for it
00799     // (by using UCmdUI::SetContinue)
00800
00801     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00802     std::map<int, void *>::iterator w;
00803     int cmdid;
00804     int widFocus = UWidget::GetFocus();
00805
00806     for(CMenuIterator iter; iter.Current(); ++iter)
00807     {
00808         MenuRef menu = iter;
00809         short menuID = (**menu).menuID;
00810
00811         // see UMenuMgr.cpp from MacApp
00812         if (menuID < kHierarchicalMin || menuID > kHierarchicalMax)
00813             continue;
00814
00815         short numitems = ::CountMItems(menu);
00816         for(int j = 1; j <= numitems; j++)
00817         {
00818             cmdid = CommandFromMenuItem(menuID, j);
00819             if(cmdid < 0)
00820             {
00821                 UAppConsole("The item %d of the menu %d has not a MacApp cmd\n", j, menuID);
00822             }
00823             else
00824             {
00825                 if(cmdid == kUMainWidget)
00826                     continue;
00827
00828                 // first forward the command to the focused widget : if it doesn't want it
00829                 // we give it to the next pseudo widget.
00830                 if(widFocus != -1 && widFocus != GetWidID())
00831                 {
00832                     UCmdUI pUI(cmdid);
00833                     UEventSendMessage(widFocus, EV_UPDTCMD, pUI.m_nID, &pUI);
00834                     if(!pUI.CanContinue())
00835                         continue;
00836                 }
00837
00838                 STD map<int, UCmdTarget *>::const_iterator i;
00839                 for(i = targets.begin(); i != targets.end(); ++i)
00840                 {
00841                     int widid = (*i).first;
00842                     if(widid == widFocus || widid == GetWidID())
00843                         continue;
00844
00845                     UCmdUI pUI(cmdid);
00846                     UEventSendMessage(widid, EV_UPDTCMD, pUI.m_nID, &pUI);
00847                     if(!pUI.CanContinue())
00848                         break;
00849                 }
00850                 if(i == targets.end())
00851                 {
00852                     //UAppConsole("The cmd %d of the menubar has no update handler, it's gonna be disabled\n", cmdid);
00853                     UCmdUI pUI(cmdid);
00854                     pUI.Enable(false);
00855                 }
00856             }
00857         }
00858     }
00859 }

Member Data Documentation

const UMSGMAP_ENTRY UMacAppMenu::_messageEntries[] [static, private]

Reimplemented from UMenu.

Definition at line 102 of file UPseudoSupport.h.

const UMSGMAP UMacAppMenu::messageMap [static, protected]

Reimplemented from UMenu.

Definition at line 102 of file UPseudoSupport.h.

int UMacAppMenu::sMAMenuWidID = -1 [static]

Definition at line 770 of file UPseudoSupport.cpp.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:48:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMacBinItem Class Reference

#include <MacBinEncoding.h>

Inheritance diagram for CMacBinItem:

[legend]
Collaboration diagram for CMacBinItem:

[legend]
List of all members.

Public Methods

CMacBinItem (const MACBINMAP &map)
virtual | ~CMacBinItem ()
virtual bool | EditCell (void)
virtual void | RemoveCell (void)

Protected Methods

virtual void | GetDrawContentsSelf (const STableCell &inCell, SOutlineDrawContents &ioDrawContents)
virtual void | DrawRowAdornments (const Rect &inLocalRowRect)
virtual void | DoubleClick (const STableCell &inCell, const SMouseDownEvent &inMouseDown, const SOutlineDrawContents &inDrawContents, Boolean inHitText)

Protected Attributes

MACBINMAP fMap

Private Methods

CMacBinItem ()
CMacBinItem (const CMacBinItem &inOriginal)
CMacBinItem & | operator= (const CMacBinItem &inOriginal)

Constructor & Destructor Documentation

CMacBinItem::CMacBinItem ( const MACBINMAP & map )

Definition at line 98 of file MacBinEncoding.cpp.

00098                                               :fMap(map)
00099 {
00100 }

CMacBinItem::~CMacBinItem ( ) [virtual]

Definition at line 102 of file MacBinEncoding.cpp.

00103 {
00104 }

CMacBinItem::CMacBinItem ( ) [private]

CMacBinItem::CMacBinItem ( const CMacBinItem & inOriginal ) [private]

Member Function Documentation

void CMacBinItem::DoubleClick | ( | const STableCell & | inCell,
 |  | const SMouseDownEvent & | inMouseDown,
 |  | const SOutlineDrawContents & | inDrawContents,
 |  | Boolean | inHitText
 | ) | [protected, virtual]

Definition at line 277 of file MacBinEncoding.cpp.

00282 {
00283     EditCell();
00284 }

void CMacBinItem::DrawRowAdornments ( const Rect & inLocalRowRect ) [protected, virtual]

Definition at line 164 of file MacBinEncoding.cpp.

00165 {
00166     ShadeRow(UGAColorRamp::GetColor(0), inLocalRowRect);
00167 }

bool CMacBinItem::EditCell ( void ) [virtual]

Definition at line 169 of file MacBinEncoding.cpp.

Referenced by DoubleClick().

00170 {
00171     StDialogHandler theHandler(dlg_MacBinEntry, LCommander::GetTopCommander());
00172     LWindow *theDialog = theHandler.GetDialog();
00173     ThrowIfNil_(theDialog);
00174
00175     LEditText *typ = dynamic_cast<LEditText*>
00176         (theDialog->FindPaneByID(item_MacBinType));
00177     LEditText *desc = dynamic_cast<LEditText*>
00178         (theDialog->FindPaneByID(item_MacBinDesc));
00179
00180     typ->SetText((Ptr)&fMap.sig, 4);
00181     desc->SetText((Ptr)fMap.desc, strlen(fMap.desc));
00182
00183     OSType oldsig = fMap.sig;
00184
00185     if(fMap.plainBin)
00186         theDialog->SetValueForPaneID (item_MacBinPlain, Button_On);
00187     else if(fMap.useDefault)
00188         theDialog->SetValueForPaneID (item_MacBinDefault, Button_On);
00189     else if(fMap.encod == MAC_HQX)
00190         theDialog->SetValueForPaneID (item_MacBinHQX, Button_On);
00191     else
00192         theDialog->SetValueForPaneID (item_MacBinAS, Button_On);
00193
00194     theDialog->Show();
00195     MessageT hitMessage;
00196     while (true)
00197     {       // Let DialogHandler process events
00198         hitMessage = theHandler.DoDialog();
00199
00200         if (hitMessage == msg_OK)
00201         {
00202             char buf[255];
00203             Size len;
00204             typ->GetText(buf, 254, &len);
00205             if(len != 4 || ((OSType *)buf)[0] == '????' || buf[0] == ';' || buf[1] == ';' ||
00206                 buf[2] == ';' || buf[3] == ';')
00207             {
00208                 SysBeep(10);
00209                 continue;
00210             }
00211
00212         }
00213
00214         if (hitMessage == msg_OK || hitMessage == msg_Cancel)
00215             break;
00216     }
00217     theDialog->Hide();
00218
00219     if(hitMessage == msg_OK)
00220     {
00221         char buf[255];
00222         Size len;
00223
00224         typ->GetText(buf, 254, &len);
00225         if(len == 4)
00226         {
00227             ((char *)&fMap.sig)[0] = buf[0];
00228             ((char *)&fMap.sig)[1] = buf[1];
00229             ((char *)&fMap.sig)[2] = buf[2];
00230             ((char *)&fMap.sig)[3] = buf[3];
00231         }
00232         desc->GetText(buf, 254, &len);
00233         buf[len] = '\0';
00234         strncpy(fMap.desc, buf, MAX_MACBIN_DESC);
00235
00236         fMap.useDefault = true;
00237         fMap.plainBin = false;
00238
00239         if(theDialog->GetValueForPaneID (item_MacBinPlain) == Button_On)
00240         {
00241             fMap.plainBin = true;
00242         }
00243         else if(theDialog->GetValueForPaneID (item_MacBinDefault) == Button_On)
00244         {
00245         }
00246         else if(theDialog->GetValueForPaneID (item_MacBinHQX) == Button_On)
00247         {
00248             fMap.useDefault = false;
00249             fMap.encod = MAC_HQX;
00250         }
00251         else
00252         {
00253             fMap.useDefault = false;
00254             fMap.encod = MAC_APPSINGLE;
00255         }
00256
00257         CMacBinTable *list = dynamic_cast<CMacBinTable*>(mOutlineTable);
00258         if(list != 0L)
00259         {
00260             list->GetCurrentMap()->RemoveEntry(oldsig);
00261             list->GetCurrentMap()->AddEntry(fMap.sig, fMap.desc, fMap.encod, fMap.plainBin, fMap.useDefault);
00262         }
00263         return true;
00264     }
00265     return false;
00266 }

void CMacBinItem::GetDrawContentsSelf | ( | const STableCell & | inCell,
 |  | SOutlineDrawContents & | ioDrawContents
 | ) | [protected, virtual]

Definition at line 109 of file MacBinEncoding.cpp.

00112 {
00113     CPStr desc;
00114
00115     switch (inCell.col)
00116     {
00117     case 1:
00118         ioDrawContents.outShowSelection = true;
00119         ioDrawContents.outHasIcon = false;
00120         //ioDrawContents.outIconSuite = ;
00121         ioDrawContents.outTextTraits.style = bold;
00122
00123         unsigned char *ptr = ioDrawContents.outTextString;
00124         *ptr++ = 4;
00125         *ptr++ = ((unsigned char *)&fMap.sig)[0];
00126         *ptr++ = ((unsigned char *)&fMap.sig)[1];
00127         *ptr++ = ((unsigned char *)&fMap.sig)[2];
00128         *ptr++ = ((unsigned char *)&fMap.sig)[3];
00129         break;
00130
00131     case 2:
00132         ioDrawContents.outShowSelection = true;
00133         ioDrawContents.outTextTraits.style = 0;
00134         c2pstrcpy(ioDrawContents.outTextString, fMap.desc);
00135         break;
00136     case 3:
00137         ioDrawContents.outShowSelection = true;
00138         ioDrawContents.outTextTraits.style = 0;
00139         if(fMap.plainBin)
00140         {
00141             ioDrawContents.outTextTraits.style = bold;
00142             LString::CopyPStr("\pPlain binary", ioDrawContents.outTextString);
00143         }
00144         else if(fMap.useDefault)
00145         {
00146             LString::CopyPStr("\pDefault encoding", ioDrawContents.outTextString);
00147         }
00148         else if(fMap.encod == MAC_HQX)
00149         {
00150             ioDrawContents.outTextTraits.style = bold;
00151             LString::CopyPStr("\pHQX encoding", ioDrawContents.outTextString);
00152         }
00153         else
00154         {
00155             ioDrawContents.outTextTraits.style = bold;
00156             LString::CopyPStr("\pAppleSingle encoding", ioDrawContents.outTextString);
00157         }
00158         break;
00159     }
00160 }

void CMacBinItem::RemoveCell ( void ) [virtual]

Definition at line 268 of file MacBinEncoding.cpp.

00269 {
00270     CMacBinTable *list = dynamic_cast<CMacBinTable*>(mOutlineTable);
00271     if(list != 0L)
00272     {
00273         list->GetCurrentMap()->RemoveEntry(fMap.sig);
00274     }
00275 }

CMacBinItem& CMacBinItem::operator= ( const CMacBinItem & inOriginal ) [private]

Member Data Documentation

MACBINMAP CMacBinItem::fMap [protected]

Definition at line 73 of file MacBinEncoding.h.

The documentation for this class was generated from the following files:
  • common/MacBinEncoding.h
  • common/MacBinEncoding.cpp
Generated on Sun Oct 21 12:48:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MACBINMAP Struct Reference

#include <MacBinMaps.h>

Collaboration diagram for MACBINMAP:

[legend]
List of all members.

Public Attributes

OSType | sig
char | desc [63+1]
MACENCODING encod
bool | plainBin
bool | useDefault

Member Data Documentation

char MACBINMAP::desc[ 63 + 1]

Definition at line 34 of file MacBinMaps.h.

Referenced by MacBinMaps::AddEntry(), CMacBinItem::EditCell(), CMacBinItem::GetDrawContentsSelf(), and MacBinMaps::operator=().

MACENCODING MACBINMAP::encod

Definition at line 35 of file MacBinMaps.h.

Referenced by MacBinMaps::AddEntry(), CMacBinItem::EditCell(), CMacBinItem::GetDrawContentsSelf(), MacBinMaps::GetEnvTypes(), and MacBinMaps::operator=().

bool MACBINMAP::plainBin

Definition at line 36 of file MacBinMaps.h.

Referenced by MacBinMaps::AddEntry(), CMacBinItem::EditCell(), CMacBinItem::GetDrawContentsSelf(), MacBinMaps::GetEnvPlainTypes(), MacBinMaps::GetEnvTypes(), and MacBinMaps::operator=().

OSType MACBINMAP::sig

Definition at line 33 of file MacBinMaps.h.

Referenced by MacBinMaps::AddEntry(), CMacBinItem::EditCell(), CMacBinItem::GetDrawContentsSelf(), MacBinMaps::GetEnvPlainTypes(), MacBinMaps::GetEnvTypes(), CMacBinItem::RemoveCell(), and MacBinMaps::operator=().

bool MACBINMAP::useDefault

Definition at line 37 of file MacBinMaps.h.

Referenced by MacBinMaps::AddEntry(), CMacBinItem::EditCell(), CMacBinItem::GetDrawContentsSelf(), MacBinMaps::GetEnvTypes(), and MacBinMaps::operator=().

The documentation for this struct was generated from the following file:
  • common/MacBinMaps.h
Generated on Sun Oct 21 12:48:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MACBINMAPENTRIES Struct Reference

#include <MacBinMaps.h>

Collaboration diagram for MACBINMAPENTRIES:

[legend]
List of all members.

Public Attributes

int | numMaps
MACBINMAP | maps [1]

Member Data Documentation

MACBINMAP MACBINMAPENTRIES::maps[1]

Definition at line 43 of file MacBinMaps.h.

Referenced by MacBinMaps::AddEntry(), CMacBinTable::FinishCreateSelf(), MacBinMaps::GetEnvPlainTypes(), MacBinMaps::GetEnvTypes(), MacBinMaps::RemoveEntry(), and MacBinMaps::operator=().

int MACBINMAPENTRIES::numMaps

Definition at line 42 of file MacBinMaps.h.

Referenced by MacBinMaps::AddEntry(), CMacBinTable::FinishCreateSelf(), MacBinMaps::GetEnvPlainTypes(), MacBinMaps::GetEnvTypes(), MacBinMaps::RemoveEntry(), MacBinMaps::Reset(), PMacBinMaps::SetData(), and MacBinMaps::operator=().

The documentation for this struct was generated from the following file:
  • common/MacBinMaps.h
Generated on Sun Oct 21 12:48:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MacBinMaps Class Reference

#include <MacBinMaps.h>

Inheritance diagram for MacBinMaps:

[legend]
Collaboration diagram for MacBinMaps:

[legend]
List of all members.

Public Methods

MacBinMaps ()
~MacBinMaps ()
void | LoadDefaults (void)
void | SaveDefaults (void)
const MACBINMAP * | AddEntry (OSType sig, const char *desc, MACENCODING encod, bool plainBin, bool useDefault)
void | RemoveEntry (OSType sig)
MacBinMaps & | operator= (const MacBinMaps &otherMap)
const MACBINMAPENTRIES * | Entries (void) const

Static Public Methods

const char * | GetEnvPlainTypes (void)
const char * | GetEnvTypes (MACENCODING type)

Protected Methods

void | Reset (void)

Protected Attributes

MACBINMAPENTRIES * entries

Constructor & Destructor Documentation

MacBinMaps::MacBinMaps ( )

Definition at line 85 of file MacBinMaps.cpp.

00086 {
00087     Reset();
00088 }

MacBinMaps::~MacBinMaps ( )

Definition at line 90 of file MacBinMaps.cpp.

00091 {
00092     if(entries != 0L)
00093         free(entries);
00094 }

Member Function Documentation

const MACBINMAP * MacBinMaps::AddEntry | ( | OSType | sig,
 |  | const char * | desc,
 |  | MACENCODING | encod,
 |  | bool | plainBin,
 |  | bool | useDefault
 | ) |

Definition at line 194 of file MacBinMaps.cpp.

Referenced by CMacBinItem::EditCell(), LoadDefaults(), and operator=().

00195 {
00196     if(entries == 0L)
00197         return 0L;
00198
00199     int i;
00200     for(i = 0; i < entries->numMaps; i++)
00201     {
00202         if(entries->maps[i].sig == sig)
00203             break;
00204     }
00205
00206     if(i != entries->numMaps)
00207     {
00208         MACBINMAP & curmap = entries->maps[i];
00209         curmap.sig = sig;
00210         curmap.desc[0] = '\0';
00211         if(desc != 0L)
00212             strncpy(curmap.desc, desc, MAX_MACBIN_DESC);
00213         curmap.encod = encod;
00214         curmap.plainBin = plainBin;
00215         curmap.useDefault = useDefault;
00216         return &curmap;
00217     }
00218
00219     entries = (MACBINMAPENTRIES *)realloc(entries, sizeof(MACBINMAPENTRIES) + entries->numMaps * sizeof(MACBINMAP));
00220     if(entries == 0L)
00221         return 0L;
00222
00223     MACBINMAP & newmap = entries->maps[entries->numMaps++];
00224     newmap.sig = sig;
00225     newmap.desc[0] = '\0';
00226     if(desc != 0L)
00227         strncpy(newmap.desc, desc, MAX_MACBIN_DESC);
00228     newmap.encod = encod;
00229     newmap.plainBin = plainBin;
00230     newmap.useDefault = useDefault;
00231     return &newmap;
00232 }

const MACBINMAPENTRIES* MacBinMaps::Entries ( void ) const [inline]

Definition at line 67 of file MacBinMaps.h.

Referenced by CMacBinTable::FinishCreateSelf(), and operator=().

00067 {return entries;}

const char * MacBinMaps::GetEnvPlainTypes ( void ) [static]

Definition at line 104 of file MacBinMaps.cpp.

Referenced by glue_getenv().

00105 {
00106     static CStr result;
00107     result = "";
00108     const MACBINMAPENTRIES * allEntries = gAllBinMaps.Entries();
00109     if(allEntries == 0L)
00110         return 0L;
00111
00112     int i;
00113     for(i = 0; i < allEntries->numMaps; i++)
00114     {
00115         const MACBINMAP & curmap = allEntries->maps[i];
00116         if(curmap.plainBin)
00117         {
00118             result << ((char *)&curmap.sig)[0];
00119             result << ((char *)&curmap.sig)[1];
00120             result << ((char *)&curmap.sig)[2];
00121             result << ((char *)&curmap.sig)[3];
00122             result << ';';
00123         }
00124     }
00125     return result;
00126 }

const char * MacBinMaps::GetEnvTypes ( MACENCODING type ) [static]

Definition at line 128 of file MacBinMaps.cpp.

Referenced by glue_getenv().

00129 {
00130     static CStr result;
00131     result = "";
00132     const MACBINMAPENTRIES * allEntries = gAllBinMaps.Entries();
00133     if(allEntries == 0L)
00134         return 0L;
00135
00136     int i;
00137     for(i = 0; i < allEntries->numMaps; i++)
00138     {
00139         const MACBINMAP & curmap = allEntries->maps[i];
00140         if(!curmap.plainBin && !curmap.useDefault && curmap.encod == type)
00141         {
00142             result << ((char *)&curmap.sig)[0];
00143             result << ((char *)&curmap.sig)[1];
00144             result << ((char *)&curmap.sig)[2];
00145             result << ((char *)&curmap.sig)[3];
00146             result << ';';
00147         }
00148     }
00149     return result;
00150 }

void MacBinMaps::LoadDefaults ( void )

Definition at line 152 of file MacBinMaps.cpp.

Referenced by CompatGetPrefs().

00153 {
00154     if(gAllBinMaps.SizeOf() == 0L)
00155     {
00156         short index = 1;
00157
00158         // take defaults from the '#bin' resource
00159         Handle  typesHandle = Get1Resource (kTypesListResType, kTypesListResID);
00160         if (typesHandle == nil)
00161             return;
00162
00163         HLock(typesHandle);
00164         Ptr typesPtr = *typesHandle;
00165
00166         short       typesCount = *(short*)typesPtr;
00167         typesPtr += (2 * sizeof(short)) / sizeof(char); // count + align
00168         OSType*     walker = (OSType *)typesPtr;
00169
00170         while (typesCount-- > 0)
00171         {
00172             Str255 theString;
00173             char theCString[256];
00174             theString[0] = '\0';
00175             GetIndString(theString, kTypesDescResID, index++);
00176             p2cstrcpy(theCString, theString);
00177
00178             AddEntry(*walker++, theCString[0] != '\0' ? theCString : "Default type",
00179                 MAC_HQX, true, true);
00180         }
00181         HUnlock(typesHandle);
00182     }
00183     else
00184     {
00185         *this = gAllBinMaps;
00186     }
00187 }

void MacBinMaps::RemoveEntry ( OSType sig )

Definition at line 234 of file MacBinMaps.cpp.

Referenced by CMacBinItem::EditCell(), and CMacBinItem::RemoveCell().

00235 {
00236     if(entries == 0L)
00237         return;
00238
00239     int i;
00240     for(i = 0; i < entries->numMaps; i++)
00241     {
00242         if(entries->maps[i].sig == sig)
00243             break;
00244     }
00245
00246     if(i == entries->numMaps)
00247         return;
00248
00249     memmove(&entries->maps[i], &entries->maps[i + 1],
00250         (entries->numMaps - i - 1) * sizeof(MACBINMAP));
00251     entries->numMaps--;
00252     entries = (MACBINMAPENTRIES *)realloc(entries, sizeof(MACBINMAPENTRIES) + (entries->numMaps - 1) * sizeof(MACBINMAP));
00253 }

void MacBinMaps::Reset ( void ) [protected]

Definition at line 96 of file MacBinMaps.cpp.

Referenced by MacBinMaps(), and operator=().

00097 {
00098     entries = (MACBINMAPENTRIES *)malloc(sizeof(int));
00099     if(entries == 0L)
00100         return;
00101     entries->numMaps = 0;
00102 }

void MacBinMaps::SaveDefaults ( void )

Definition at line 189 of file MacBinMaps.cpp.

Referenced by CompatGetPrefs().

00190 {
00191     *(MacBinMaps *)&gAllBinMaps = *this;
00192 }

MacBinMaps & MacBinMaps::operator= ( const MacBinMaps & otherMap )

Definition at line 255 of file MacBinMaps.cpp.

00256 {
00257     if(entries != 0L)
00258         free(entries);
00259     Reset();
00260     if(entries == 0L)
00261         return *this;
00262
00263     const MACBINMAPENTRIES *theseEntries = otherMap.Entries();
00264     if(theseEntries != 0L) for(int i = 0; i < theseEntries->numMaps; i++)
00265     {
00266         const MACBINMAP & newmap = theseEntries->maps[i];
00267         AddEntry(newmap.sig, newmap.desc, newmap.encod, newmap.plainBin, newmap.useDefault);
00268     }
00269     return *this;
00270 }

Member Data Documentation

MACBINMAPENTRIES* MacBinMaps::entries [protected]

Definition at line 80 of file MacBinMaps.h.

The documentation for this class was generated from the following files:
  • common/MacBinMaps.h
  • common/MacBinMaps.cpp
Generated on Sun Oct 21 12:48:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMacBinTable Class Reference

#include <MacBinEncoding.h>

Inheritance diagram for CMacBinTable:

[legend]
Collaboration diagram for CMacBinTable:

[legend]
List of all members.

Public Types

enum | { class_ID = 'MBTA' }

Public Methods

CMacBinTable (LStream *inStream)
virtual | ~CMacBinTable ()

Static Public Methods

void | SetCurrentMap (MacBinMaps *map)
MacBinMaps * | GetCurrentMap (void)

Protected Methods

virtual void | FinishCreateSelf ()

Static Protected Attributes

MacBinMaps * | gCurMacBinMap = 0L

Private Methods

CMacBinTable ()
CMacBinTable (const CMacBinTable &inOriginal)
CMacBinTable & | operator= (const CMacBinTable &inOriginal)

Member Enumeration Documentation

anonymous enum

Enumeration values:
class_ID

Definition at line 38 of file MacBinEncoding.h.

00038 { class_ID = 'MBTA' };

Constructor & Destructor Documentation

CMacBinTable::CMacBinTable ( LStream * inStream )

Definition at line 41 of file MacBinEncoding.cpp.

00041                                             : LOutlineTable(inStream)
00042 {
00043     // set the table geometry
00044     LTableMultiGeometry *geom = NEW LTableMultiGeometry(this, 50, 20);
00045     ThrowIfNil_(geom);
00046     SetTableGeometry(geom);
00047
00048     // set the table selector
00049     SetTableSelector(NEW LTableSingleSelector( this )/*LOutlineRowSelector*/ );
00050
00051     // and note that we don't set the table storage....
00052
00053     // most of the table classes not only maintain the graphical
00054     // representation of your data but also the data itself. But
00055     // LOutlineTable doesn't really do this...it mostly handles
00056     // graphical representation... you need to handle your data
00057     // maintenance elsewhere by yourself.
00058
00059     // insert a couple columns (name and size)
00060     InsertCols( 3, 0, nil, nil, false );
00061     geom->SetColWidth(60, 1, 1);
00062     geom->SetColWidth(237, 2, 2);
00063     geom->SetColWidth(120, 3, 3);
00064
00065     // Set up keyboard selection and scrolling.
00066     AddAttachment(NEW LOutlineKeySelector(this, msg_AnyMessage));
00067     AddAttachment(NEW LKeyScrollAttachment(this));
00068
00069     // Try to become default commander in the window.
00070     if (mSuperCommander != nil)
00071         mSuperCommander->SetLatentSub(this);
00072 }

CMacBinTable::~CMacBinTable ( ) [virtual]

Definition at line 74 of file MacBinEncoding.cpp.

00075 {
00076 }

CMacBinTable::CMacBinTable ( ) [private]

CMacBinTable::CMacBinTable ( const CMacBinTable & inOriginal ) [private]

Member Function Documentation

void CMacBinTable::FinishCreateSelf ( ) [protected, virtual]

Definition at line 78 of file MacBinEncoding.cpp.

00079 {
00080     // insert the root level of the disk into the table
00081     CMacBinItem *theItem = nil;
00082     CMacBinItem *lastItem = nil;
00083
00084     const MACBINMAPENTRIES * entries = gCurMacBinMap->Entries();
00085
00086     if(entries != 0L) for(int i = 0; i < entries->numMaps; i++)
00087     {
00088         // Store this information in the list view
00089         theItem = NEW CMacBinItem(entries->maps[i]);
00090         ThrowIfNil_(theItem);
00091
00092         // and insert it at the end of the table
00093         InsertItem( theItem, nil, lastItem );
00094         lastItem = theItem;
00095     }
00096 }

MacBinMaps* CMacBinTable::GetCurrentMap ( void ) [inline, static]

Definition at line 44 of file MacBinEncoding.h.

Referenced by CMacBinItem::EditCell(), and CMacBinItem::RemoveCell().

00044 {return gCurMacBinMap;}

void CMacBinTable::SetCurrentMap ( MacBinMaps * map ) [inline, static]

Definition at line 43 of file MacBinEncoding.h.

Referenced by CompatGetPrefs().

00043 {gCurMacBinMap = map;}

CMacBinTable& CMacBinTable::operator= ( const CMacBinTable & inOriginal ) [private]

Member Data Documentation

MacBinMaps * CMacBinTable::gCurMacBinMap = 0L [static, protected]

Definition at line 39 of file MacBinEncoding.cpp.

The documentation for this class was generated from the following files:
  • common/MacBinEncoding.h
  • common/MacBinEncoding.cpp
Generated on Sun Oct 21 12:48:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMacroEntry Class Reference

#include <MacrosSetup.h>

Collaboration diagram for CMacroEntry:

[legend]
List of all members.

Public Methods

CMacroEntry ()
CMacroEntry (const char *fullname, const char *dispname)
CMacroEntry (const CMacroEntry &anentry)
CMacroEntry & | operator= (const CMacroEntry &anentry)
bool | operator< (const CMacroEntry &anentry) const
bool | operator== (const CMacroEntry &anentry) const

Public Attributes

UStr path
UStr name

Constructor & Destructor Documentation

CMacroEntry::CMacroEntry ( ) [inline]

Definition at line 42 of file MacrosSetup.h.

00042 {}

CMacroEntry::CMacroEntry | ( | const char * | fullname,
 |  | const char * | dispname
 | ) | [inline]

Definition at line 43 of file MacrosSetup.h.

00044     {
00045         path = fullname;
00046         name = dispname;
00047     }

CMacroEntry::CMacroEntry ( const CMacroEntry & anentry ) [inline]

Definition at line 48 of file MacrosSetup.h.

00049     {
00050         *this = anentry;
00051     }

Member Function Documentation

bool CMacroEntry::operator< ( const CMacroEntry & anentry ) const [inline]

Definition at line 60 of file MacrosSetup.h.

00061     {
00062         return false;
00063     }

CMacroEntry& CMacroEntry::operator= ( const CMacroEntry & anentry ) [inline]

Definition at line 53 of file MacrosSetup.h.

00054     {
00055         path = anentry.path;
00056         name = anentry.name;
00057         return *this;
00058     }

bool CMacroEntry::operator== ( const CMacroEntry & anentry ) const [inline]

Definition at line 65 of file MacrosSetup.h.

00066     {
00067         return path.compare(anentry.path) == 0 && name.compare(anentry.name) == 0;
00068     }

Member Data Documentation

UStr CMacroEntry::name

Definition at line 71 of file MacrosSetup.h.

Referenced by operator=(), and operator==().

UStr CMacroEntry::path

Definition at line 70 of file MacrosSetup.h.

Referenced by UCvsFrame::OnCmdMacroAdmin(), UCvsFolders::OnCmdMacrosSel(), CWincvsDoc::OnMacroAdmin(), UCvsFiles::OnMacroSel(), operator=(), and operator==().

The documentation for this class was generated from the following file:
  • common/MacrosSetup.h
Generated on Sun Oct 21 12:48:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMacroSet Class Reference

#include <MacrosSetup.h>

Collaboration diagram for CMacroSet:

[legend]
List of all members.

Public Methods

CMacroSet ()
void | Flush (void)
void | Add (const char *fullname, const char *name)

Public Attributes

std::vector< CMacroEntry > entries
bool | invalFlag

Constructor & Destructor Documentation

CMacroSet::CMacroSet ( ) [inline]

Definition at line 78 of file MacrosSetup.h.

00079     {
00080         invalFlag = true;
00081     }

Member Function Documentation

void CMacroSet::Add | ( | const char * | fullname,
 |  | const char * | name
 | ) | [inline]

Definition at line 92 of file MacrosSetup.h.

Referenced by MacroTraversal::OnFile().

00093     {
00094         entries.push_back(CMacroEntry(fullname, name));
00095     }

void CMacroSet::Flush ( void ) [inline]

Definition at line 86 of file MacrosSetup.h.

Referenced by MacrosFlushAll().

00087     {
00088         entries.erase(entries.begin(), entries.end());
00089         invalFlag = true;
00090     }

Member Data Documentation

std::vector<CMacroEntry> CMacroSet::entries

Definition at line 83 of file MacrosSetup.h.

bool CMacroSet::invalFlag

Definition at line 84 of file MacrosSetup.h.

The documentation for this class was generated from the following file:
  • common/MacrosSetup.h
Generated on Sun Oct 21 12:48:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MacroTraversal Class Reference

Inheritance diagram for MacroTraversal:

[legend]
Collaboration diagram for MacroTraversal:

[legend]
List of all members.

Public Methods

virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnFile (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)

Member Function Documentation

virtual kTraversal MacroTraversal::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 180 of file MacrosSetup.cpp.

00181     {
00182         cvs_err(err);
00183         cvs_err("\n");
00184         return kTraversalError;
00185     }

kTraversal MacroTraversal::OnFile | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [virtual]

Reimplemented from TraversalReport.

Definition at line 193 of file MacrosSetup.cpp.

00197 {
00198     if(stricmp(name + strlen(name) - 4, ".tcl"))
00199         return kContinueTraversal;
00200
00201     FILE *fpin = fopen(fullname, "r");
00202     if(fpin == 0L)
00203     {
00204         cvs_err("Impossible to open '%s' (error %d)\n", fullname, errno);
00205         return kContinueTraversal;
00206     }
00207
00208     char *oldline = 0L;
00209     int line_length;
00210     size_t line_chars_allocated = 0;
00211     CvsArgs args(false);
00212     args.add("dummy");
00213
00214     if((line_length = getline (&oldline, &line_chars_allocated, fpin)) > 0 &&
00215         strnicmp(oldline, "#!CVSGUI1.0", strlen("#!CVSGUI1.0")) == 0)
00216     {
00217         char *line = oldline + strlen("#!CVSGUI1.0");
00218
00219         while(*line)
00220         {
00221             int hasQuote = 0;
00222             char *temp;
00223
00224             // Search for the non space char
00225             while(*line && isspace(*line))
00226                 ++line;
00227
00228             // handle the quote
00229             if((*line) == '"')
00230             {
00231                 hasQuote = 1;
00232                 line++;
00233             }
00234             for(temp=line;*line;++line)
00235             {
00236                 if((*line) == '"')
00237                 {
00238                     if(hasQuote)
00239                     {
00240                         hasQuote = 0; /* ok doc */
00241                         break;
00242                     }
00243                 }
00244                 if(isspace(*line) && !hasQuote)
00245                     break;
00246             }
00247             if(hasQuote) /* mismatch quote */
00248                 temp = line;
00249
00250             if(temp != line)
00251             {
00252                 CStr arg;
00253                 arg.set(temp, line - temp);
00254                 args.add(arg);
00255             }
00256         }
00257
00258         static struct option long_options[] =
00259         {
00260             {"admin", no_argument, 0L, 1},
00261             {"selection", no_argument, 0L, 2},
00262             {"name", required_argument, 0L, 3},
00263             {0, 0, 0, 0}
00264         };
00265         bool hasAdmin = false;
00266         bool hasSel = false;
00267         CStr dispname;
00268
00269         optind = 0;
00270         int option_index = 0, c;
00271         while ((c = getopt_long
00272             (args.Argc(), args.Argv(), "+", long_options, &option_index)) != EOF)
00273         {
00274             switch (c)
00275             {
00276             case 1:
00277                 hasAdmin = true;
00278                 break;
00279             case 2:
00280                 hasSel = true;
00281                 break;
00282             case 3:
00283                 dispname = optarg;
00284                 break;
00285             default:
00286                 cvs_err("Warning : unknown option in the file '%s'\n", fullname);
00287                 break;
00288             }
00289         }
00290
00291         if(dispname.empty())
00292         {
00293             dispname = name;
00294         }
00295
00296         if(hasAdmin)
00297         {
00298             gMacrosAdmin.Add(fullname, dispname);
00299         }
00300         else if(hasSel)
00301         {
00302             gMacrosSel.Add(fullname, dispname);
00303         }
00304         else
00305         {
00306             cvs_err("Warning : no option <admin|selection> in the file '%s'\n", fullname);
00307         }
00308     }
00309
00310     free (oldline);
00311
00312     fclose(fpin);
00313
00314     return kContinueTraversal;
00315 }

The documentation for this class was generated from the following file:
  • common/MacrosSetup.cpp
Generated on Sun Oct 21 12:48:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMainFrame Class Reference

#include <MainFrm.h>

Inheritance diagram for CMainFrame:

[legend]
Collaboration diagram for CMainFrame:

[legend]
List of all members.

Public Methods

CMainFrame ()
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
void | DropFiles (HDROP hDropInfo)
void | InitialShowWindow (int nCmdShow)
virtual | ~CMainFrame ()
CWinCvsBrowser * GetBrowserView ()
CCJShellTree * GetExplorerView ()
CCJTabCtrlBar * GetWorkspace ()
CMDIMenuList & | GetMenuList (void)
CWincvsView * GetConsoleView ()
CHistComboBoxEx & | GetBrowseHistory (void)
CStatusBar * GetStatusBar ()
BOOL | OnBroadcastCmdMsg (UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo)
char * | GetEnvMainThread (const char *name)
KiFilterModel * GetFilterModel ()
KiRecursionModel * GetRecursionModel ()
KiIgnoreModel * GetIgnoreModel ()
void | OnFilterMaskEntered ()
void | ChangeLocation ()

Protected Methods

BOOL | InitializeDockingWindows ()
afx_msg void | OnInitMenu (CMenu *pMenu)
void | DockControlBarLeftOf (CToolBar *Bar, CToolBar *LeftOf)
bool | FreshenFileMask ()
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnClose ()
afx_msg void | OnDropFiles (HDROP hDropInfo)
afx_msg void | OnHistorySelect ()
afx_msg void | OnActivate (UINT nState, CWnd *pWndOther, BOOL bMinimized)
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)
afx_msg void | OnViewRecursive ()
afx_msg void | OnViewModified ()
afx_msg void | OnUpdateViewModified (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewRecursive (CCmdUI *pCmdUI)
afx_msg void | OnViewConflict ()
afx_msg void | OnUpdateViewConflict (CCmdUI *pCmdUI)
afx_msg void | OnViewUnknown ()
afx_msg void | OnUpdateViewUnknown (CCmdUI *pCmdUI)
afx_msg void | OnViewMissing ()
afx_msg void | OnUpdateViewMissing (CCmdUI *pCmdUI)
afx_msg void | OnViewIgnore ()
afx_msg void | OnUpdateViewIgnore (CCmdUI *pCmdUI)
afx_msg void | OnUpdateFilterMask (CCmdUI *pCmdUI)
afx_msg void | OnUpdateHistory (CCmdUI *pCmdUI)
afx_msg void | OnViewAdded ()
afx_msg void | OnUpdateViewAdded (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewRemoved (CCmdUI *pCmdUI)
afx_msg void | OnViewRemoved ()
afx_msg void | OnViewChanged ()
afx_msg void | OnUpdateViewChanged (CCmdUI *pCmdUI)
afx_msg void | OnViewHideunknown ()
afx_msg void | OnUpdateViewHideunknown (CCmdUI *pCmdUI)
afx_msg void | OnTimer (UINT nIDEvent)

Protected Attributes

KoFilterModel m_filter
KoRecursionModel m_recursion
KoIgnoreModel m_ignore
CCvsStatusBar m_wndStatusBar
CToolBar | m_wndToolBar
CToolBar | m_wndBrowser
CToolBar | m_wndMultiUser
CToolBar | m_wndTags
CToolBar | m_wndList
CToolBar | m_wndFilter
CHistComboBoxEx m_browseHist
CToolbarCombo m_comboFilterMask
CFont | m_fontNormal
CBarConsole m_consolebar
CCJTabCtrlBar m_wndWorkspace
CImageList | m_TabImages
CCJWindowPlacement m_state

Private Attributes

BOOL | m_bRestoreFocus

Constructor & Destructor Documentation

CMainFrame::CMainFrame ( )

Definition at line 171 of file MainFrm.cpp.

00172 {
00173     m_bRestoreFocus = FALSE;
00174 }

CMainFrame::~CMainFrame ( ) [virtual]

Definition at line 176 of file MainFrm.cpp.

00177 {
00178 }

Member Function Documentation

void CMainFrame::ChangeLocation ( )

Definition at line 646 of file MainFrm.cpp.

Referenced by OnHistorySelect(), and CHistComboBoxEx::PreTranslateMessage().

00647 {
00648     int nCurSel = m_browseHist.GetCurSel();
00649     CString s;
00650     m_browseHist.GetLBText(nCurSel, s);
00651     if(!s.IsEmpty())
00652     {
00653         CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00654         app->GetBrowserView()->ResetBrowser(s, true);
00655         app->ActivateBrowserView();
00656     }
00657 }

void CMainFrame::DockControlBarLeftOf | ( | CToolBar * | Bar,
 |  | CToolBar * | LeftOf
 | ) | [protected]

Definition at line 419 of file MainFrm.cpp.

Referenced by OnCreate().

00420 {
00421     CRect rect;
00422     DWORD dw;
00423     UINT n;
00424
00425     // get MFC to adjust the dimensions of all docked ToolBars
00426     // so that GetWindowRect will be accurate
00427     RecalcLayout();
00428     LeftOf->GetWindowRect(&rect);
00429     rect.OffsetRect(1,0);
00430     dw=LeftOf->GetBarStyle();
00431     n = 0;
00432     n = (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n;
00433     n = (dw&CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n;
00434     n = (dw&CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n;
00435     n = (dw&CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n;
00436
00437     // When we take the default parameters on rect, DockControlBar will dock
00438     // each Toolbar on a seperate line.  By calculating a rectangle, we in effect
00439     // are simulating a Toolbar being dragged to that location and docked.
00440     DockControlBar(Bar,n,&rect);
00441 }

void CMainFrame::DropFiles ( HDROP hDropInfo )

Definition at line 698 of file MainFrm.cpp.

Referenced by CWincvsView::OnDropFiles().

00699 {
00700     OnDropFiles(hDropInfo);
00701 }

bool CMainFrame::FreshenFileMask ( ) [protected]

Definition at line 762 of file MainFrm.cpp.

Referenced by OnFilterMaskEntered(), OnViewAdded(), OnViewChanged(), OnViewConflict(), OnViewHideunknown(), OnViewMissing(), OnViewModified(), OnViewRemoved(), and OnViewUnknown().

00763 {
00764     CString strFileMask;
00765     m_comboFilterMask.GetWindowText(strFileMask);
00766     return m_filter.SetMask(strFileMask);
00767 }

CHistComboBoxEx& CMainFrame::GetBrowseHistory ( void ) [inline]

Definition at line 57 of file MainFrm.h.

Referenced by CWinCvsBrowser::Create(), and CWinCvsBrowser::ResetBrowser().

00057 { return m_browseHist; }

CWinCvsBrowser * CMainFrame::GetBrowserView ( void )

Definition at line 659 of file MainFrm.cpp.

Referenced by CWincvsApp::GetBrowserView().

00660 {
00661     CBrowserBar *bar = (CBrowserBar *)m_wndWorkspace.GetView(0);
00662     return bar->GetBrowserView();
00663 }

CWincvsView* CMainFrame::GetConsoleView ( ) [inline]

Definition at line 56 of file MainFrm.h.

Referenced by CWincvsApp::GetConsoleView().

00056 { return m_consolebar.m_view; }

char * CMainFrame::GetEnvMainThread ( const char * name )

Definition at line 909 of file MainFrm.cpp.

Referenced by CWincvsApp::GetEnvMainThread().

00910 {
00911     ASSERT(::GetCurrentThreadId() != AfxGetApp()->m_nThreadID);
00912
00913     sGetEnvResult = name;
00914     sAskingMainThread = true;
00915
00916     sGetEnv.Lock();
00917
00918     return sGetEnvResult;
00919 }

CCJShellTree * CMainFrame::GetExplorerView ( )

Definition at line 665 of file MainFrm.cpp.

Referenced by CWincvsApp::GetExplorerView().

00666 {
00667     CExploreBar *bar = (CExploreBar *)m_wndWorkspace.GetView(1);
00668     return &bar->m_TreeCtrl;
00669 }

KiFilterModel* CMainFrame::GetFilterModel ( ) [inline]

Definition at line 66 of file MainFrm.h.

Referenced by CWincvsApp::GetFilterModel().

00067     {
00068         return &m_filter;
00069     }

KiIgnoreModel* CMainFrame::GetIgnoreModel ( ) [inline]

Definition at line 78 of file MainFrm.h.

Referenced by CWincvsApp::GetIgnoreModel().

00079     {
00080         return &m_ignore;
00081     }

CMDIMenuList& CMainFrame::GetMenuList ( void ) [inline]

Definition at line 54 of file MainFrm.h.

00054 { return m_menuList; }

KiRecursionModel* CMainFrame::GetRecursionModel ( ) [inline]

Definition at line 72 of file MainFrm.h.

Referenced by CWincvsApp::GetRecursionModel().

00073     {
00074         return &m_recursion;
00075     }

CStatusBar* CMainFrame::GetStatusBar ( ) [inline]

Definition at line 58 of file MainFrm.h.

Referenced by CWincvsApp::GetStatusBar().

00058 { return &m_wndStatusBar; }

CCJTabCtrlBar* CMainFrame::GetWorkspace ( ) [inline]

Definition at line 53 of file MainFrm.h.

Referenced by CWincvsApp::ActivateBrowserView().

00053 { return &m_wndWorkspace; }

void CMainFrame::InitialShowWindow ( int nCmdShow )

Definition at line 624 of file MainFrm.cpp.

Referenced by CWincvsApp::InitInstance().

00625 {
00626     if (gMainPlacement.hasOne)
00627     {
00628         WINDOWPLACEMENT wp = gMainPlacement.placement;
00629         if (nCmdShow != SW_SHOWNORMAL)
00630             wp.showCmd = nCmdShow;
00631         else if (wp.showCmd & SW_SHOWMINIMIZED)
00632             wp.showCmd = (wp.flags & WPF_RESTORETOMAXIMIZED) ? SW_MAXIMIZE : SW_SHOWNORMAL;
00633         SetWindowPlacement(&wp);
00634     }
00635     else
00636     {
00637         ShowWindow(nCmdShow);
00638     }
00639 }

BOOL CMainFrame::InitializeDockingWindows ( ) [protected]

Definition at line 180 of file MainFrm.cpp.

Referenced by OnCreate().

00181 {
00182     // Initial size when docked: top, bottom, left, right.
00183     // ??? SetInitialSize(125,225,225,225);
00184
00185     if (!m_wndWorkspace.Create(this, ID_VIEW_WORKSPACE,
00186         _T("Workspace"), CSize(200,100), CBRS_LEFT))
00187     {
00188         TRACE0("Failed to create dialog bar (Workspace)\n");
00189         return -1;      // fail to create
00190     }
00191
00192     m_wndWorkspace.AddView(_T("Modules"), RUNTIME_CLASS(CBrowserBar));
00193 #ifndef NOEXPLOREVIEW
00194     m_wndWorkspace.AddView(_T("Explore"), RUNTIME_CLASS(CExploreBar));
00195 #endif
00196     m_wndWorkspace.SetActiveView(0);
00197     // Define the image list to use with the tab control
00198     m_TabImages.Create (IDR_WORKSPACE, 16, 1, RGB(255,255,255));
00199     m_wndWorkspace.SetTabImageList(&m_TabImages);
00200     //m_wndWorkspace.SetMenuID(IDR_POPUP);
00201     m_wndWorkspace.EnableDockingOnSizeBar(CBRS_ALIGN_ANY);
00202
00203     if (!m_consolebar.Create(this, ID_VIEW_CONSOLE_BAR,
00204         _T("Output"), CSize(300,100), CBRS_BOTTOM))
00205     {
00206         TRACE0("Failed to create dialog bar (Output)\n");
00207         return FALSE;       // fail to create
00208     }
00209
00210     //m_consolebar.SetMenuID(IDR_POPUP);
00211     m_consolebar.EnableDockingOnSizeBar(CBRS_ALIGN_ANY);
00212
00213     EnableDockingSizeBar(CBRS_ALIGN_ANY);
00214     DockSizeBar(&m_wndWorkspace);
00215     DockSizeBar(&m_consolebar);
00216
00217     return TRUE;
00218 }

void CMainFrame::OnActivate | ( | UINT | nState,
 |  | CWnd * | pWndOther,
 |  | BOOL | bMinimized
 | ) | [protected]

Definition at line 703 of file MainFrm.cpp.

00704 {
00705     CCJMDIFrameWnd::OnActivate(nState, pWndOther, bMinimized);
00706
00707     // TODO: Add your message handler code here
00708
00709     //JK - prevent the focus to be gone from FileView to the Workspace - for the Dialogs etc.
00710     CWincvsApp* pApp = (CWincvsApp*)AfxGetApp();
00711     ASSERT(pApp);
00712
00713     if( WA_INACTIVE == nState && !m_bRestoreFocus )
00714     {
00715         m_bRestoreFocus = BOOL( GetFocus() == pApp->GetFileView() );
00716         pApp->m_isBackgroundProcess = true;
00717     }
00718     else
00719     {
00720         pApp->m_isBackgroundProcess = false;
00721         if( !bMinimized && m_bRestoreFocus )
00722         {
00723             m_bRestoreFocus = FALSE;
00724             CBrowseFileView* pBrowseFileView = pApp->GetFileView();
00725             if(pBrowseFileView)
00726             {
00727                 pBrowseFileView->SetFocus();
00728             }
00729         }
00730     }
00731 }

BOOL CMainFrame::OnBroadcastCmdMsg | ( | UINT | nID,
 |  | int | nCode,
 |  | void * | pExtra,
 |  | AFX_CMDHANDLERINFO * | pHandlerInfo
 | ) |

Definition at line 671 of file MainFrm.cpp.

Referenced by CLogFrame::OnCmdMsg(), and CGraphFrame::OnCmdMsg().

00672 {
00673     CPushRoutingFrame push(this);
00674
00675     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00676
00677     // pump through dock bars FIRST
00678     CWinCvsBrowser *bView = app->GetBrowserView();
00679     if (bView != NULL && bView == CWnd::GetFocus() && bView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
00680         return TRUE;
00681 #ifndef NOEXPLOREVIEW
00682     // pump through dock bars FIRST
00683     CCJShellTree *eView = app->GetExplorerView();
00684     if (eView != NULL && eView == CWnd::GetFocus())
00685     {
00686         if(eView->GetParent()->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
00687             return TRUE;
00688     }
00689 #endif
00690
00691     CWincvsView *cView = app->GetConsoleView();
00692     if (cView != NULL && cView == CWnd::GetFocus() && cView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
00693         return TRUE;
00694
00695     return FALSE;
00696 }

void CMainFrame::OnClose ( ) [protected]

Reimplemented from CCJMDIFrameWnd.

Definition at line 470 of file MainFrm.cpp.

00471 {
00472     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00473     if(app->gCvsRunning)
00474     {
00475         AfxMessageBox("Cvs is currently running : stop cvs first before quitting", MB_OK | MB_ICONSTOP);
00476         return;
00477     }
00478
00479     // only way I found to notify the browser
00480     // and to prevent the memory leak support.
00481     app->GetBrowserView()->ResetBrowser(0L);
00482
00483     // Charybids Ltd's suggested fix:
00484     // Saving the window positions whilst iconic trashes the registry.
00485     if (!IsIconic())
00486     {
00487         m_state.SaveWindowPos(this);
00488         SaveBarState(_T("Bar State"));
00489
00490         WINDOWPLACEMENT wp;
00491         wp.length = sizeof wp;
00492         if (GetWindowPlacement(&wp)) {
00493             wp.flags &= WPF_RESTORETOMAXIMIZED;
00494             gMainPlacement = wp;
00495         }
00496     }
00497
00498     // write all the persistents to the .INI file
00499     gCvsPrefs.save();
00500
00501     CCJMDIFrameWnd::OnClose();
00502 }

int CMainFrame::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 225 of file MainFrm.cpp.

00226 {
00227     if (CCJMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
00228         return -1;
00229
00230     if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00231         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
00232         !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
00233     {
00234         TRACE0("Failed to create toolbar (Standard)\n");
00235         return -1;      // fail to create
00236     }
00237
00238     if (!m_wndBrowser.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00239         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0), ID_VIEW_BROWSER_BAR) ||
00240         !m_wndBrowser.LoadToolBar(IDR_BROWSER))
00241     {
00242         TRACE0("Failed to create toolbar (Browse)\n");
00243         return -1;      // fail to create
00244     }
00245
00246     m_wndBrowser.SetButtonInfo(3, ID_SEPARATOR, TBBS_SEPARATOR, 200);
00247     CRect rect;
00248     m_wndBrowser.GetItemRect(3, &rect);
00249     rect.bottom += HISTLOC_VISIBLEITEMS * HISTLOC_IMAGE_CX + rect.bottom % HISTLOC_IMAGE_CX;
00250
00251     if (!m_browseHist.Create(CBS_DROPDOWNLIST|WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|WS_HSCROLL,
00252             rect, &m_wndBrowser, ID_HISTORYBROWSE))
00253     {
00254         TRACE0("Failed to create combobox (Browse History)\n");
00255         return -1;      // fail to create
00256     }
00257
00258     // Older versions of Windows* (NT 3.51 for instance) fail with DEFAULT_GUI_FONT
00259     if (!m_fontNormal.CreateStockObject(DEFAULT_GUI_FONT))
00260     {
00261         if (!m_fontNormal.CreatePointFont(80, "MS Sans Serif"))
00262         {
00263             TRACE0("Failed to create default GUI font\n");
00264             return -1;
00265         }
00266     }
00267
00268     // Make browse history use default GUI font
00269     m_browseHist.SetFont(&m_fontNormal);
00270
00271     if (!m_wndList.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00272         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0), ID_VIEW_FILES_BAR) ||
00273         !m_wndList.LoadToolBar(IDR_FILELIST))
00274     {
00275         TRACE0("Failed to create toolbar (Files)\n");
00276         return -1;      // fail to create
00277     }
00278
00279     if (!m_wndFilter.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00280         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0), ID_VIEW_FILTER_BAR) ||
00281         !m_wndFilter.LoadToolBar(IDR_FILTER))
00282     {
00283         TRACE0("Failed to create toolbar (Filter)\n");
00284         return -1;      // fail to create
00285     }
00286
00287     if (!m_wndMultiUser.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00288         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0), ID_VIEW_MULTI_BAR) ||
00289         !m_wndMultiUser.LoadToolBar(IDR_MULTIUSER))
00290     {
00291         TRACE0("Failed to create toolbar (Multi-User)\n");
00292         return -1;      // fail to create
00293     }
00294
00295     if (!m_wndTags.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
00296         | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0), ID_VIEW_TAGS_BAR) ||
00297         !m_wndTags.LoadToolBar(IDR_TAGS))
00298     {
00299         TRACE0("Failed to create toolbar (Tags)\n");
00300         return -1;      // fail to create
00301     }
00302
00303     if (!m_wndStatusBar.Create(this) ||
00304         !m_wndStatusBar.SetIndicators(indicators,
00305           sizeof(indicators)/sizeof(UINT)))
00306     {
00307         TRACE0("Failed to create status bar\n");
00308         return -1;      // fail to create
00309     }
00310
00311     // rotating icon
00312     UINT nID, nStyle;
00313     int cxWidth;
00314     m_wndStatusBar.GetPaneInfo( 1, nID, nStyle, cxWidth);
00315     m_wndStatusBar.SetPaneInfo( 1, nID, nStyle|SBPS_OWNERDRAW, 100);
00316
00317     EnableDocking(CBRS_ALIGN_ANY);
00318
00319     // Set toolbar title (visible when toolbar is floating)
00320     // Adjust toolbar height (default of 26 pixels is a little bit too small)
00321     // Enable docking
00322     m_wndToolBar.SetWindowText("Standard");
00323     m_wndToolBar.SetHeight(28);
00324     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
00325         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00326     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
00327     DockControlBar(&m_wndToolBar,AFX_IDW_DOCKBAR_TOP);
00328
00329     m_wndBrowser.SetWindowText("Browse");
00330     m_wndBrowser.SetHeight(28);
00331     m_wndBrowser.SetBarStyle(m_wndBrowser.GetBarStyle() |
00332         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00333     m_wndBrowser.EnableDocking(CBRS_ALIGN_ANY);
00334     DockControlBarLeftOf(&m_wndBrowser,&m_wndToolBar);
00335
00336     m_wndList.SetWindowText("Files");
00337     m_wndList.SetHeight(28);
00338     m_wndList.SetBarStyle(m_wndList.GetBarStyle() |
00339         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00340     m_wndList.EnableDocking(CBRS_ALIGN_ANY);
00341     DockControlBarLeftOf(&m_wndList,&m_wndBrowser);
00342
00343     m_wndMultiUser.SetWindowText("Multi-Users");
00344     m_wndMultiUser.SetHeight(28);
00345     m_wndMultiUser.SetBarStyle(m_wndMultiUser.GetBarStyle() |
00346         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00347     m_wndMultiUser.EnableDocking(CBRS_ALIGN_ANY);
00348     DockControlBarLeftOf(&m_wndMultiUser,&m_wndList);
00349
00350     m_wndTags.SetWindowText("Tags");
00351     m_wndTags.SetHeight(28);
00352     m_wndTags.SetBarStyle(m_wndTags.GetBarStyle() |
00353         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00354     m_wndTags.EnableDocking(CBRS_ALIGN_ANY);
00355     DockControlBarLeftOf(&m_wndTags,&m_wndMultiUser);
00356
00357     m_wndFilter.SetWindowText("Filter");
00358     m_wndFilter.SetHeight(28);
00359     m_wndFilter.SetBarStyle(m_wndFilter.GetBarStyle() |
00360         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00361     m_wndFilter.EnableDocking(CBRS_ALIGN_ANY);
00362     DockControlBarLeftOf(&m_wndFilter,&m_wndTags);
00363
00364     m_wndFilter.SetButtonInfo(2, ID_SEPARATOR, TBBS_SEPARATOR, 200);
00365     m_wndFilter.GetItemRect(2, &rect);
00366     rect.bottom += 80;
00367
00368     if (!m_comboFilterMask.Create(CBS_DROPDOWN|WS_CHILD|WS_VISIBLE|WS_TABSTOP,
00369             rect, &m_wndFilter, ID_FILTERMASK))
00370     {
00371         TRACE0("Failed to create combobox (filter mask)\n");
00372         return -1;          // fail to create
00373     }
00374
00375     // Make browse history use default GUI font
00376     m_comboFilterMask.SetFont(&m_fontNormal);
00377     m_comboFilterMask.GetManager()->CheckIn(this, onFilterMaskEntered);
00378
00379
00380     if(!InitializeDockingWindows())
00381     {
00382         TRACE0("Failed to initialize docking windows\n");
00383         return -1;      // fail to create
00384     }
00385
00386 #if 1
00387     // load the dock state, but check the toolbar exists (MFC bug)
00388     CDockState state;
00389     state.LoadState(_T("Bar State"));
00390     for (int i = 0; i < state.m_arrBarInfo.GetSize(); i++)
00391     {
00392         CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
00393         ASSERT(pInfo != NULL);
00394         if (!pInfo->m_bFloating)
00395         {
00396             pInfo->m_pBar = GetControlBar(pInfo->m_nBarID);
00397             if(pInfo->m_pBar == NULL)
00398             {
00399                 delete (CControlBarInfo*)state.m_arrBarInfo[i];
00400                 state.m_arrBarInfo.RemoveAt(i);
00401                 i--;
00402             }
00403         }
00404     }
00405     SetDockState(state);
00406 #else
00407     LoadBarState(_T("Bar State"));
00408 #endif
00409     m_state.LoadWindowPos(this);
00410
00411     // CG: The following line was added by the Splash Screen component.
00412     CSplashWnd::ShowSplashScreen(this);
00413
00414     SetTimer(99, 200, 0L);
00415
00416     return 0;
00417 }

void CMainFrame::OnDropFiles ( HDROP hDropInfo ) [protected]

Definition at line 504 of file MainFrm.cpp.

Referenced by DropFiles().

00505 {
00506     SetActiveWindow();  // activate us first !
00507     UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
00508
00509     CWinApp* pApp = AfxGetApp();
00510     for (UINT iFile = 0; iFile < nFiles; iFile++)
00511     {
00512         TCHAR szFileName[_MAX_PATH];
00513         ::DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH);
00514
00515         if( iFile == 0 )
00516         {
00517             CColorConsole out;
00518             out << kBold << "Locating: " << kNormal << kUnderline << szFileName << kNormal <<  kNormal << kNL;
00519
00520             CWincvsApp* pApp = (CWincvsApp *)AfxGetApp();
00521             if( pApp )
00522             {
00523                 const TCHAR *p1, *p2 = szFileName;
00524
00525                 while( p2 )
00526                 {
00527                     p1 = ++p2;
00528                     p2 = strchr(p2, _T('\\'));
00529                 }
00530
00531                 CWinCvsBrowser* pBrowser = pApp->GetBrowserView();
00532                 if( pBrowser )
00533                 {
00534                     if( pBrowser->StepToLocation(szFileName, true) )
00535                     {
00536                         pApp->GetFileView()->ResetView(false, p1);
00537                     }
00538                 }
00539             }
00540         }
00541
00542         // replace \ by /
00543         TCHAR *tmp = szFileName;
00544         while( (tmp = strchr(tmp, '\\')) != 0L )
00545         {
00546             *tmp++ = '/';
00547         }
00548
00549         cvs_out("%s\n", szFileName);
00550
00551         //pApp->OpenDocumentFile(szFileName);
00552     }//end for
00553
00554     ::DragFinish(hDropInfo);
00555 }

void CMainFrame::OnFilterMaskEntered ( )

Definition at line 782 of file MainFrm.cpp.

Referenced by OnViewIgnore(), and OnViewRecursive().

00783 {
00784     if (FreshenFileMask())
00785     {
00786         m_filter.GetNotificationManager()->NotifyAll();
00787     }
00788 }

void CMainFrame::OnHistorySelect ( ) [protected]

Definition at line 641 of file MainFrm.cpp.

00642 {
00643     ChangeLocation();
00644 }

void CMainFrame::OnInitMenu ( CMenu * pMenu ) [protected]

Definition at line 557 of file MainFrm.cpp.

00558 {
00559     CCJMDIFrameWnd::OnInitMenu(pMenu);
00560
00561 #if 0 // now it's in the resources
00562     // CG: This block added by 'Tip of the Day' component.
00563     {
00564         // TODO: This code adds the "Tip of the Day" menu item
00565         // on the fly.  It may be removed after adding the menu
00566         // item to all applicable menu items using the resource
00567         // editor.
00568
00569         // Add Tip of the Day menu item on the fly!
00570         static CMenu* pSubMenu = NULL;
00571
00572         CString strHelp; strHelp.LoadString(CG_IDS_TIPOFTHEDAYHELP);
00573         CString strMenu;
00574         int nMenuCount = pMenu->GetMenuItemCount();
00575         BOOL bFound = FALSE;
00576         for (int i=0; i < nMenuCount; i++)
00577         {
00578             pMenu->GetMenuString(i, strMenu, MF_BYPOSITION);
00579             if (strMenu == strHelp)
00580             {
00581                 pSubMenu = pMenu->GetSubMenu(i);
00582                 bFound = TRUE;
00583                 ASSERT(pSubMenu != NULL);
00584             }
00585         }
00586
00587         CString strTipMenu;
00588         strTipMenu.LoadString(CG_IDS_TIPOFTHEDAYMENU);
00589         if (!bFound)
00590         {
00591             // Help menu is not available. Please add it!
00592             if (pSubMenu == NULL)
00593             {
00594                 // The same pop-up menu is shared between mainfrm and frame
00595                 // with the doc.
00596                 static CMenu popUpMenu;
00597                 pSubMenu = &popUpMenu;
00598                 pSubMenu->CreatePopupMenu();
00599                 pSubMenu->InsertMenu(0, MF_STRING|MF_BYPOSITION,
00600                     CG_IDS_TIPOFTHEDAY, strTipMenu);
00601             }
00602             pMenu->AppendMenu(MF_STRING|MF_BYPOSITION|MF_ENABLED|MF_POPUP,
00603                 (UINT)pSubMenu->m_hMenu, strHelp);
00604             DrawMenuBar();
00605         }
00606         else
00607         {
00608             // Check to see if the Tip of the Day menu has already been added.
00609             pSubMenu->GetMenuString(0, strMenu, MF_BYPOSITION);
00610
00611             if (strMenu != strTipMenu)
00612             {
00613                 // Tip of the Day submenu has not been added to the
00614                 // first position, so add it.
00615                 pSubMenu->InsertMenu(0, MF_BYPOSITION);  // Separator
00616                 pSubMenu->InsertMenu(0, MF_STRING|MF_BYPOSITION,
00617                     CG_IDS_TIPOFTHEDAY, strTipMenu);
00618             }
00619         }
00620     }
00621 #endif
00622 }

void CMainFrame::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam
 | ) | [protected]

Definition at line 733 of file MainFrm.cpp.

00734 {
00735     // TODO: Add your message handler code here and/or call default
00736
00737     //JK - prevent the focus to be gone from FileView to the Workspace - for the Minimize
00738     if( SC_MINIMIZE == nID )
00739     {
00740         CWincvsApp* pApp = (CWincvsApp*)AfxGetApp();
00741         ASSERT(pApp);
00742
00743         m_bRestoreFocus = BOOL( GetFocus() == pApp->GetFileView() );
00744     }
00745
00746     CCJMDIFrameWnd::OnSysCommand(nID, lParam);
00747 }

void CMainFrame::OnTimer ( UINT nIDEvent ) [protected]

Definition at line 921 of file MainFrm.cpp.

00922 {
00923     if(sAskingMainThread)
00924     {
00925         sAskingMainThread = false;
00926
00927         sGetEnvResult = glue_getenv(sGetEnvResult);
00928         sGetEnv.Unlock();
00929     }
00930 }

void CMainFrame::OnUpdateFilterMask ( CCmdUI * pCmdUI ) [protected]

Definition at line 842 of file MainFrm.cpp.

00843 {
00844     pCmdUI->Enable(IsAppEnabled());
00845 }

void CMainFrame::OnUpdateHistory ( CCmdUI * pCmdUI ) [protected]

Definition at line 847 of file MainFrm.cpp.

00848 {
00849     pCmdUI->Enable(IsAppEnabled());
00850 }

void CMainFrame::OnUpdateViewAdded ( CCmdUI * pCmdUI ) [protected]

Definition at line 859 of file MainFrm.cpp.

00860 {
00861     pCmdUI->Enable(IsAppEnabled());
00862     pCmdUI->SetCheck(m_filter.IsAdded());
00863 }

void CMainFrame::OnUpdateViewChanged ( CCmdUI * pCmdUI ) [protected]

Definition at line 885 of file MainFrm.cpp.

00886 {
00887     pCmdUI->Enable(IsAppEnabled());
00888     pCmdUI->SetCheck(m_filter.IsChanged());
00889 }

void CMainFrame::OnUpdateViewConflict ( CCmdUI * pCmdUI ) [protected]

Definition at line 797 of file MainFrm.cpp.

00798 {
00799     pCmdUI->Enable(IsAppEnabled());
00800     pCmdUI->SetCheck(m_filter.IsConflict());
00801 }

void CMainFrame::OnUpdateViewHideunknown ( CCmdUI * pCmdUI ) [protected]

Definition at line 898 of file MainFrm.cpp.

00899 {
00900     pCmdUI->Enable(IsAppEnabled() && m_filter.IsDefaultMode());
00901     pCmdUI->SetCheck(m_filter.IsHideUnknown());
00902 }

void CMainFrame::OnUpdateViewIgnore ( CCmdUI * pCmdUI ) [protected]

Definition at line 836 of file MainFrm.cpp.

00837 {
00838     pCmdUI->Enable(IsAppEnabled());
00839     pCmdUI->SetCheck(m_ignore.IsShowIgnored());
00840 }

void CMainFrame::OnUpdateViewMissing ( CCmdUI * pCmdUI ) [protected]

Definition at line 823 of file MainFrm.cpp.

00824 {
00825     pCmdUI->Enable(IsAppEnabled());
00826     pCmdUI->SetCheck(m_filter.IsMissing());
00827 }

void CMainFrame::OnUpdateViewModified ( CCmdUI * pCmdUI ) [protected]

Definition at line 776 of file MainFrm.cpp.

00777 {
00778     pCmdUI->Enable(IsAppEnabled());
00779     pCmdUI->SetCheck(m_filter.IsModified());
00780 }

void CMainFrame::OnUpdateViewRecursive ( CCmdUI * pCmdUI ) [protected]

Definition at line 756 of file MainFrm.cpp.

00757 {
00758     pCmdUI->Enable(IsAppEnabled());
00759     pCmdUI->SetCheck(m_recursion.IsShowRecursive());
00760 }

void CMainFrame::OnUpdateViewRemoved ( CCmdUI * pCmdUI ) [protected]

Definition at line 865 of file MainFrm.cpp.

00866 {
00867     pCmdUI->Enable(IsAppEnabled());
00868     pCmdUI->SetCheck(m_filter.IsRemoved());
00869 }

void CMainFrame::OnUpdateViewUnknown ( CCmdUI * pCmdUI ) [protected]

Definition at line 810 of file MainFrm.cpp.

00811 {
00812     pCmdUI->Enable(IsAppEnabled());
00813     pCmdUI->SetCheck(m_filter.IsUnknown());
00814 }

void CMainFrame::OnViewAdded ( ) [protected]

Definition at line 852 of file MainFrm.cpp.

00853 {
00854     m_filter.ToggleAdded();
00855     FreshenFileMask();
00856     m_filter.GetNotificationManager()->NotifyAll();
00857 }

void CMainFrame::OnViewChanged ( ) [protected]

Definition at line 878 of file MainFrm.cpp.

00879 {
00880     m_filter.ToggleChanged();
00881     FreshenFileMask();
00882     m_filter.GetNotificationManager()->NotifyAll();
00883 }

void CMainFrame::OnViewConflict ( ) [protected]

Definition at line 790 of file MainFrm.cpp.

00791 {
00792     m_filter.ToggleConflict();
00793     FreshenFileMask();
00794     m_filter.GetNotificationManager()->NotifyAll();
00795 }

void CMainFrame::OnViewHideunknown ( ) [protected]

Definition at line 891 of file MainFrm.cpp.

00892 {
00893     m_filter.ToggleHideUnknown();
00894     FreshenFileMask();
00895     m_filter.GetNotificationManager()->NotifyAll();
00896 }

void CMainFrame::OnViewIgnore ( ) [protected]

Definition at line 829 of file MainFrm.cpp.

00830 {
00831     m_ignore.ToggleIgnore();
00832     m_ignore.GetNotificationManager()->NotifyAll();
00833     OnFilterMaskEntered();
00834 }

void CMainFrame::OnViewMissing ( ) [protected]

Definition at line 816 of file MainFrm.cpp.

00817 {
00818     m_filter.ToggleMissing();
00819     FreshenFileMask();
00820     m_filter.GetNotificationManager()->NotifyAll();
00821 }

void CMainFrame::OnViewModified ( ) [protected]

Definition at line 769 of file MainFrm.cpp.

00770 {
00771     m_filter.ToggleModified();
00772     FreshenFileMask();
00773     m_filter.GetNotificationManager()->NotifyAll();
00774 }

void CMainFrame::OnViewRecursive ( ) [protected]

Definition at line 749 of file MainFrm.cpp.

00750 {
00751     m_recursion.ToggleRecursion();
00752     m_recursion.GetNotificationManager()->NotifyAll();
00753     OnFilterMaskEntered();
00754 }

void CMainFrame::OnViewRemoved ( ) [protected]

Definition at line 871 of file MainFrm.cpp.

00872 {
00873     m_filter.ToggleRemoved();
00874     FreshenFileMask();
00875     m_filter.GetNotificationManager()->NotifyAll();
00876 }

void CMainFrame::OnViewUnknown ( ) [protected]

Definition at line 803 of file MainFrm.cpp.

00804 {
00805     m_filter.ToggleUnknown();
00806     FreshenFileMask();
00807     m_filter.GetNotificationManager()->NotifyAll();
00808 }

BOOL CMainFrame::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]

Reimplemented from CCJMDIFrameWnd.

Definition at line 443 of file MainFrm.cpp.

00444 {
00445     // TODO: Modify the Window class or styles here by modifying
00446     //  the CREATESTRUCT cs
00447
00448     return CCJMDIFrameWnd::PreCreateWindow(cs);
00449 }

Member Data Documentation

CImageList CMainFrame::m_TabImages [protected]

Definition at line 105 of file MainFrm.h.

BOOL CMainFrame::m_bRestoreFocus [private]

Definition at line 149 of file MainFrm.h.

CHistComboBoxEx CMainFrame::m_browseHist [protected]

Definition at line 100 of file MainFrm.h.

CToolbarCombo CMainFrame::m_comboFilterMask [protected]

Definition at line 101 of file MainFrm.h.

CBarConsole CMainFrame::m_consolebar [protected]

Definition at line 103 of file MainFrm.h.

KoFilterModel CMainFrame::m_filter [protected]

Definition at line 31 of file MainFrm.h.

CFont CMainFrame::m_fontNormal [protected]

Definition at line 102 of file MainFrm.h.

KoIgnoreModel CMainFrame::m_ignore [protected]

Definition at line 33 of file MainFrm.h.

KoRecursionModel CMainFrame::m_recursion [protected]

Definition at line 32 of file MainFrm.h.

CCJWindowPlacement CMainFrame::m_state [protected]

Definition at line 106 of file MainFrm.h.

CToolBar CMainFrame::m_wndBrowser [protected]

Definition at line 95 of file MainFrm.h.

CToolBar CMainFrame::m_wndFilter [protected]

Definition at line 99 of file MainFrm.h.

CToolBar CMainFrame::m_wndList [protected]

Definition at line 98 of file MainFrm.h.

CToolBar CMainFrame::m_wndMultiUser [protected]

Definition at line 96 of file MainFrm.h.

CCvsStatusBar CMainFrame::m_wndStatusBar [protected]

Definition at line 93 of file MainFrm.h.

CToolBar CMainFrame::m_wndTags [protected]

Definition at line 97 of file MainFrm.h.

CToolBar CMainFrame::m_wndToolBar [protected]

Definition at line 94 of file MainFrm.h.

CCJTabCtrlBar CMainFrame::m_wndWorkspace [protected]

Definition at line 104 of file MainFrm.h.

The documentation for this class was generated from the following files:
  • WinCvs/MainFrm.h
  • WinCvs/MainFrm.cpp
Generated on Sun Oct 21 12:48:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMapPtrToPtr Class Reference

Inheritance diagram for CMapPtrToPtr:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/CJLibrary/Subclass.cpp
Generated on Sun Oct 21 12:48:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


master_lists Struct Reference

Collaboration diagram for master_lists:

[legend]
List of all members.

Public Attributes

List * ulist
List * cilist
List * tlist
List * tlist

Member Data Documentation

List* master_lists::cilist

Definition at line 69 of file commit.c.

List* master_lists::tlist

Definition at line 54 of file tag.c.

List* master_lists::tlist

Definition at line 48 of file rtag.c.

List* master_lists::ulist

Definition at line 68 of file commit.c.

The documentation for this struct was generated from the following files:
  • cvs-1.10/src/commit.c
  • cvs-1.10/src/rtag.c
  • cvs-1.10/src/tag.c
Generated on Sun Oct 21 12:48:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMDIChildWnd Class Reference

Inheritance diagram for CMDIChildWnd:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJMDIChildWnd.h
Generated on Sun Oct 21 12:48:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMDIFrameWnd Class Reference

Inheritance diagram for CMDIFrameWnd:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJMDIFrameWnd.h
Generated on Sun Oct 21 12:48:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMemFile Class Reference

Inheritance diagram for CMemFile:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJMemFile.h
Generated on Sun Oct 21 12:48:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMenu Class Reference

Inheritance diagram for CMenu:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJMenu.h
Generated on Sun Oct 21 12:48:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UMenu Class Reference

#include <umenu.h>

Inheritance diagram for UMenu:

[legend]
Collaboration diagram for UMenu:

[legend]
List of all members.

Public Methods

UMenu (int widid)
virtual | ~UMenu ()

Protected Methods

void | OnUpdateUI (void)
EV_UPDATEUI is a notification sent to all the widgets when the user interface is invalid. the default is to send a EV_UPDTCMD to each sub-widget. More...

int | OnCommands (int cmd)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Constructor & Destructor Documentation

UMenu::UMenu ( int widid )

Definition at line 81 of file umenu.cpp.

00081                       : UWidget(widid)
00082 #if qGTK
00083     , fAccelGroup(0L)
00084 #endif
00085 {
00086 #if qGTK
00087     fAccelGroup = gtk_accel_group_new ();
00088 #endif
00089 }

UMenu::~UMenu ( ) [virtual]

Definition at line 91 of file umenu.cpp.

00092 {
00093 }

Member Function Documentation

const UMSGMAP* UMenu::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

Reimplemented in UCvsMenubar, and UMacAppMenu.

virtual const UMSGMAP* UMenu::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

Reimplemented in UCvsMenubar, and UMacAppMenu.

const UMSGMAP* UMenu::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

Reimplemented in UCvsMenubar, and UMacAppMenu.

int UMenu::OnCommands ( int cmd ) [protected]

Definition at line 924 of file umenu.cpp.

00925 {
00926     static bool sSemaphore = false;
00927     USemaphore policeman(sSemaphore);
00928     if(policeman.IsEnteredTwice())
00929         return 1;
00930
00931     // this is the interesting thing about the toolbar : it resends the
00932     // commands to other widgets according to the focus information and
00933     // allows the command to be handled several times if the handler return 1
00934
00935     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00936     int res = 0;
00937     int handledFlag;
00938
00939     // first forward the command to the focused widget : if it doesn't want it
00940     // we give it to the next pseudo widget.
00941     if(sFocusWidID != -1 && sFocusWidID != GetWidID())
00942     {
00943         res = UEventSendMessageExt(sFocusWidID, EV_CMD, cmd, 0L, &handledFlag);
00944         if(res == 0 && handledFlag)
00945             return 0;
00946     }
00947
00948     STD map<int, UCmdTarget *>::const_iterator i;
00949     for(i = targets.begin(); i != targets.end(); ++i)
00950     {
00951         int widid = (*i).first;
00952         if(widid == sFocusWidID || widid == GetWidID())
00953             continue;
00954         res = UEventSendMessageExt(widid, EV_CMD, cmd, 0L, &handledFlag);
00955         if(res == 0 && handledFlag)
00956             return 0;
00957     }
00958
00959     //UAppConsole("The cmd %d of the menubar has no command handler\n", cmd);
00960
00961     return 1;
00962 }

void UMenu::OnUpdateUI ( void ) [protected]

EV_UPDATEUI is a notification sent to all the widgets when the user interface is invalid. the default is to send a EV_UPDTCMD to each sub-widget.

Reimplemented from UWidget.

Reimplemented in UMacAppMenu.

Definition at line 858 of file umenu.cpp.

00859 {
00860     // for WIN32, the UpdateUI on the menus is better handled by MFC
00861 #ifndef WIN32
00862     static bool sSemaphore = false;
00863     USemaphore policeman(sSemaphore);
00864     if(policeman.IsEnteredTwice())
00865         return;
00866
00867     // this is the interesting thing about the toolbar : it resends the
00868     // update UI to other widgets according to the focus information and
00869     // allows the update to be handled several times if the handler asks for it
00870     // (by using UCmdUI::SetContinue)
00871
00872     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00873     std::map<int, void *>::iterator w;
00874     int cmdid;
00875
00876     for(w = m_widgets.begin(); w != m_widgets.end(); ++w)
00877     {
00878         void *widget = (*w).second;
00879         cmdid = (*w).first;
00880
00881         if(cmdid == kUMainWidget)
00882             continue;
00883
00884 #if qGTK
00885         if(!GTK_IS_MENU_ITEM(widget))
00886             continue;
00887 #endif
00888
00889         // first forward the command to the focused widget : if it doesn't want it
00890         // we give it to the next pseudo widget.
00891         if(sFocusWidID != -1 && sFocusWidID != GetWidID())
00892         {
00893             UCmdUI pUI(cmdid);
00894             pUI.m_widget = widget;
00895             UEventSendMessage(sFocusWidID, EV_UPDTCMD, pUI.m_nID, &pUI);
00896             if(!pUI.CanContinue())
00897                 continue;
00898         }
00899
00900         STD map<int, UCmdTarget *>::const_iterator i;
00901         for(i = targets.begin(); i != targets.end(); ++i)
00902         {
00903             int widid = (*i).first;
00904             if(widid == sFocusWidID || widid == GetWidID())
00905                 continue;
00906
00907             UCmdUI pUI(cmdid);
00908             pUI.m_widget = widget;
00909             UEventSendMessage(widid, EV_UPDTCMD, pUI.m_nID, &pUI);
00910             if(!pUI.CanContinue())
00911                 break;
00912         }
00913         if(i == targets.end())
00914         {
00915             //UAppConsole("The cmd %d of the menubar has no update handler, it's gonna be disabled\n", cmdid);
00916             UCmdUI pUI(cmdid);
00917             pUI.m_widget = widget;
00918             pUI.Enable(false);
00919         }
00920     }
00921 #endif
00922 }

Member Data Documentation

const UMSGMAP_ENTRY UMenu::_messageEntries[] [static, private]

Reimplemented from UWidget.

Reimplemented in UCvsMenubar, and UMacAppMenu.

Definition at line 49 of file umenu.h.

const UMSGMAP UMenu::messageMap [static, protected]

Reimplemented from UWidget.

Reimplemented in UCvsMenubar, and UMacAppMenu.

Definition at line 49 of file umenu.h.

The documentation for this class was generated from the following files:
  • rf/umenu.h
  • rf/umenu.cpp
Generated on Sun Oct 21 12:48:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMenuItemInfo Struct Reference

#include <CJMenu.h>

Inheritance diagram for CMenuItemInfo:

[legend]
Collaboration diagram for CMenuItemInfo:

[legend]
List of all members.

Public Methods

CMenuItemInfo ()

Constructor & Destructor Documentation

CMenuItemInfo::CMenuItemInfo ( ) [inline]

Definition at line 72 of file CJMenu.h.

00073     { memset(this, 0, sizeof(MENUITEMINFO));
00074       cbSize = sizeof(MENUITEMINFO);
00075     }

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/Include/CJMenu.h
Generated on Sun Oct 21 12:48:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UMessageMapFunctions Union Reference

Collaboration diagram for UMessageMapFunctions:

[legend]
List of all members.

Public Attributes

UPMSG pfn
void(UCmdTarget::* | pfnV_V )(void)
void(UCmdTarget::* | pfnV_VP )(void *)
void(UCmdTarget::* | pfnV_iVP )(int, void *)
void(UCmdTarget::* | pfnV_i )(int)
void(UCmdTarget::* | pfnV_ii )(int, int)
void(UCmdTarget::* | pfnV_iii )(int, int, int)
void(UCmdTarget::* | pfnV_iiVP )(int, int, void *)
int(UCmdTarget::* | pfni_ii )(int, int)
int(UCmdTarget::* | pfni_i )(int)
int(UCmdTarget::* | pfni_V )()
int(UCmdTarget::* | pfni_iVP )(int, void *)
int(UCmdTarget::* | pfni_VP )(void *)

Member Data Documentation

UPMSG UMessageMapFunctions::pfn

Definition at line 182 of file uevent.cpp.

Referenced by UCmdTarget::UDispatchMessage().

void(UCmdTarget::* UMessageMapFunctions::pfnV_V)(void)

Referenced by UCmdTarget::UDispatchMessage().

void(UCmdTarget::* UMessageMapFunctions::pfnV_VP)(void *)

Referenced by UCmdTarget::UDispatchMessage().

void(UCmdTarget::* UMessageMapFunctions::pfnV_i)(int)

Referenced by UCmdTarget::UDispatchMessage().

void(UCmdTarget::* UMessageMapFunctions::pfnV_iVP)(int,void *)

Referenced by UCmdTarget::UDispatchMessage().

void(UCmdTarget::* UMessageMapFunctions::pfnV_ii)(int, int)

Referenced by UCmdTarget::UDispatchMessage().

void(UCmdTarget::* UMessageMapFunctions::pfnV_iiVP)(int, int, void *)

Referenced by UCmdTarget::UDispatchMessage().

void(UCmdTarget::* UMessageMapFunctions::pfnV_iii)(int, int, int)

Referenced by UCmdTarget::UDispatchMessage().

int(UCmdTarget::* UMessageMapFunctions::pfni_V)()

Referenced by UCmdTarget::UDispatchMessage().

int(UCmdTarget::* UMessageMapFunctions::pfni_VP)(void *)

Referenced by UCmdTarget::UDispatchMessage().

int(UCmdTarget::* UMessageMapFunctions::pfni_i)(int)

Referenced by UCmdTarget::UDispatchMessage().

int(UCmdTarget::* UMessageMapFunctions::pfni_iVP)(int,void *)

Referenced by UCmdTarget::UDispatchMessage().

int(UCmdTarget::* UMessageMapFunctions::pfni_ii)(int, int)

Referenced by UCmdTarget::UDispatchMessage().

The documentation for this union was generated from the following file:
  • rf/uevent.cpp
Generated on Sun Oct 21 12:48:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMiniDockFrameWnd Class Reference

Inheritance diagram for CMiniDockFrameWnd:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJMiniDockFrameWnd.h
Generated on Sun Oct 21 12:48:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


mircAttrCvt Class Reference

#include <CTCP2Parse.hpp>

Inheritance diagram for mircAttrCvt:

[legend]
Collaboration diagram for mircAttrCvt:

[legend]
List of all members.

Public Methods

void | mirc2ctcp (std::string *in)

Private Methods

int | extractcolor (std::string *in, int start, short *fg, short *bg)

Static Private Attributes

const char | tokens [2]
const char * | mirc2ctcpmap [17]

Member Function Documentation

int mircAttrCvt::extractcolor | ( | std::string * | in,
 |  | int | start,
 |  | short * | fg,
 |  | short * | bg
 | ) | [private]

Definition at line 445 of file CTCP2Parse.cpp.

Referenced by mirc2ctcp().

00446 {
00447     int ptr = start, len = in->length(), preColor;
00448
00449     if (ptr == len) return 0;
00450
00451     if (isn(in->at(ptr)))
00452     {
00453         // there's a foreground
00454
00455         if (ptr + 1 < len && isn(in->at(ptr + 1)))
00456         {
00457             // it's 2 digits
00458             preColor = (((in->at(ptr) - '0') * 10) + (in->at(ptr + 1) - '0'));
00459             if (preColor == 99) *fg = MIRC_TRANSPARENT;
00460             else *fg = preColor % 16;
00461             ptr += 2;
00462         }
00463         else
00464         {
00465             // it's 1 digit
00466             *fg = in->at(ptr) - '0';
00467             ptr++;
00468         }
00469         if (ptr + 1 < len && in->at(ptr) == ',' && isn(in->at(ptr + 1)))
00470         {
00471             // there's a background
00472             ptr++; // the comma
00473
00474             if (ptr + 1 < len && isn(in->at(ptr + 1)))
00475             {
00476                 // it's 2 digits
00477                 preColor = (((in->at(ptr) - '0') * 10) + (in->at(ptr + 1) - '0'));
00478                 if (preColor == 99) *bg = MIRC_TRANSPARENT;
00479                 else *bg = preColor % 16;
00480                 ptr += 2;
00481             }
00482             else
00483             {
00484                 // it's 1 digit
00485                 *bg = in->at(ptr) - '0';
00486                 ptr++;
00487             }
00488         }
00489     }
00490     return (ptr - start);
00491 };

void mircAttrCvt::mirc2ctcp ( std::string * in )

Definition at line 404 of file CTCP2Parse.cpp.

Referenced by CTCP2Parse::ParseIt().

00405 {
00406     int col;
00407     char f[20];
00408     bool eqf, eqb;
00409     short oldfg, oldbg, fg = -1, bg = -1;
00410     int pos;
00411
00412     pos = in->find_first_of(tokens);
00413
00414     while (pos != std::string::npos)
00415     {
00416         oldfg = fg;
00417         oldbg = bg;
00418         col = extractcolor(in, pos+1, &fg, &bg);
00419         eqf = (oldfg == fg);
00420         eqb = (oldbg == bg);
00421
00422         if (col && (!eqf || !eqb))
00423         {
00424             // if the color hasn't changed, we insert a - which means
00425             // basically "ignore me"
00426             sprintf(f, "C%s%s",
00427                 eqf ? "-" : mirc2ctcpmap[fg],
00428                 eqb ? (eqf ? 0 : "-") : mirc2ctcpmap[bg]);
00429
00430             in->replace(pos, col+1,
00431                 std::string("") + CCTCP2 + f + CCTCP2);
00432             pos += (2 + strlen(f));   // consume the additions
00433         }
00434         else
00435         {
00436             in->replace(pos, 1, std::string("") + CCTCP2 + 'C' + CCTCP2);
00437             pos += 2;   // consume the additions
00438         }
00439         pos = in->find_first_of(tokens, pos);
00440     }
00441 };

Member Data Documentation

const char * mircAttrCvt::mirc2ctcpmap [static, private]

Initial value:

 {
    "F",
    "0",
    "1",
    "2",
    "C",
    "#7F3F3F",
    "5",
    "#FF7F00",
    "E",
    "A",
    "3",
    "B",
    "9",
    "#FF7FC0",
    "8",
    "7",
    "."
}

Definition at line 382 of file CTCP2Parse.cpp.

const char mircAttrCvt::tokens [static, private]

Initial value:

 {
     (char)3 , 0
}

Definition at line 376 of file CTCP2Parse.cpp.

The documentation for this class was generated from the following files:
  • common/CTCP2Parse.hpp
  • common/CTCP2Parse.cpp
Generated on Sun Oct 21 12:48:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMMenuString Class Reference

#include <CustomizeMenus.h>

Inheritance diagram for CMMenuString:

[legend]
Collaboration diagram for CMMenuString:

[legend]
List of all members.

Public Methods

CMMenuString (unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L)
virtual | ~CMMenuString ()
virtual unsigned int | SizeOf (void) const
virtual const void * | GetData (void) const
virtual void | SetData (const void *ptr, unsigned int size)
void | Insert (const char *newstr)
const std::vector< UStr > & | GetList (void) const
std::vector< UStr > & | GetList (void)

Protected Attributes

std::vector< UStr > fAllStrs
CStaticAllocT< char > | fBuf
unsigned int | fMaxStr

Constructor & Destructor Documentation

CMMenuString::CMMenuString | ( | unsigned int | maxstr,
 |  | const char * | uniqueName,
 |  | char *const * | defaultStr = 0L
 | ) |

Definition at line 309 of file wincvs_winutil.cpp.

00309                                                                                                 :
00310     CPersistent(uniqueName, kNoClass), fMaxStr(maxstr)
00311 {
00312     if(defaultStr != 0L)
00313     {
00314         int i = 0;
00315         while(defaultStr[i] != 0L)
00316         {
00317             Insert(defaultStr[i++]);
00318         }
00319     }
00320 }

CMMenuString::~CMMenuString ( ) [virtual]

Definition at line 322 of file wincvs_winutil.cpp.

00323 {
00324 }

Member Function Documentation

const void * CMMenuString::GetData ( void ) const [virtual]

Reimplemented from CPersistent.

Definition at line 338 of file wincvs_winutil.cpp.

00339 {
00340     unsigned int thesize = SizeOf(), tmpsize;
00341     ((CMMenuString *)this)->fBuf.AdjustSize(thesize);
00342     char *tmp = ((CMMenuString *)this)->fBuf;
00343     *(int *)tmp = fAllStrs.size();
00344     tmp += sizeof(int) / sizeof(char);
00345
00346     NAMESPACE(std) vector<UStr>::const_iterator i;
00347     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00348     {
00349         tmpsize = (*i).length() + 1;
00350         memcpy(tmp, (const char *)(*i), tmpsize * sizeof(char));
00351         tmp += tmpsize;
00352     }
00353
00354     return (char *)fBuf;
00355 }

std::vector<UStr>& CMMenuString::GetList ( void ) [inline]

Definition at line 59 of file CustomizeMenus.h.

00059 { TouchTimeStamp(); return fAllStrs; }

const std::vector<UStr>& CMMenuString::GetList ( void ) const [inline]

Definition at line 58 of file CustomizeMenus.h.

Referenced by GetCustomMenu(), CCustomizeMenus::OnInitDialog(), and CCustomizeMenus::OnOK().

00058 { return fAllStrs; }

void CMMenuString::Insert ( const char * newstr )

Definition at line 371 of file wincvs_winutil.cpp.

Referenced by CMMenuString().

00372 {
00373     TouchTimeStamp();
00374     fAllStrs.push_back(UStr(newstr));
00375 }

void CMMenuString::SetData | ( | const void * | ptr,
 |  | unsigned int | size
 | ) | [virtual]

Reimplemented from CPersistent.

Definition at line 357 of file wincvs_winutil.cpp.

00358 {
00359     const char *tmp = (char *)ptr;
00360     unsigned int thesize;
00361     fAllStrs.erase(fAllStrs.begin(), fAllStrs.end());
00362     thesize = *(int *)tmp;
00363     tmp += sizeof(int) / sizeof(char);
00364     for(unsigned int i = 0; i < thesize && i < fMaxStr; i++)
00365     {
00366         fAllStrs.push_back(UStr(tmp));
00367         tmp += strlen(tmp) + 1;
00368     }
00369 }

unsigned int CMMenuString::SizeOf ( void ) const [virtual]

Reimplemented from CPersistent.

Definition at line 326 of file wincvs_winutil.cpp.

Referenced by GetData().

00327 {
00328     NAMESPACE(std) vector<UStr>::const_iterator i;
00329     unsigned int thesize = sizeof(int);
00330
00331     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00332     {
00333         thesize += (*i).length() + 1;
00334     }
00335     return thesize;
00336 }

Member Data Documentation

std::vector<UStr> CMMenuString::fAllStrs [protected]

Definition at line 62 of file CustomizeMenus.h.

CStaticAllocT<char> CMMenuString::fBuf [protected]

Definition at line 63 of file CustomizeMenus.h.

unsigned int CMMenuString::fMaxStr [protected]

Definition at line 64 of file CustomizeMenus.h.

The documentation for this class was generated from the following files:
  • WinCvs/CustomizeMenus.h
  • WinCvs/wincvs_winutil.cpp
Generated on Sun Oct 21 12:48:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMPString Class Reference

#include <MultiString.h>

Inheritance diagram for CMPString:

[legend]
Collaboration diagram for CMPString:

[legend]
List of all members.

Public Methods

CMPString (unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass)
virtual ~CMPString ()

Constructor & Destructor Documentation

CMPString::CMPString | ( | unsigned int | maxstr,
 |  | const char * | uniqueName,
 |  | char *const * | defaultStr = 0L,
 |  | kClassPersistent | pclass = kNoClass
 | ) | [inline]

Definition at line 151 of file MultiString.h.

00152                                                                            :
00153         TMString<CPStr>(maxstr, uniqueName, defaultStr, pclass)
00154     {
00155     }

virtual CMPString::~CMPString ( ) [inline, virtual]

Definition at line 157 of file MultiString.h.

00158     {
00159     }

The documentation for this class was generated from the following file:
  • common/MultiString.h
Generated on Sun Oct 21 12:48:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMsg Class Reference

Collaboration diagram for CMsg:

[legend]
List of all members.

Public Methods

CMsg (int wid, int ev, int arg1, void *arg2)
CMsg ()
CMsg (const CMsg &msg)
CMsg & | operator= (const CMsg &msg)

Public Attributes

int | m_wid
int | m_ev
int | m_arg1
void * | m_arg2

Constructor & Destructor Documentation

CMsg::CMsg | ( | int | wid,
 |  | int | ev,
 |  | int | arg1,
 |  | void * | arg2
 | ) | [inline]

Definition at line 150 of file uevent.cpp.

00150                                                 : m_wid(wid), m_ev(ev), m_arg1(arg1), m_arg2(arg2)
00151     {
00152     }

CMsg::CMsg ( ) [inline]

Definition at line 154 of file uevent.cpp.

00154            : m_wid(0), m_ev(0), m_arg1(0), m_arg2(0L)
00155     {
00156     }

CMsg::CMsg ( const CMsg & msg ) [inline]

Definition at line 158 of file uevent.cpp.

00158                            : m_wid(0), m_ev(0), m_arg1(0), m_arg2(0L)
00159     {
00160         *this = msg;
00161     }

Member Function Documentation

CMsg& CMsg::operator= ( const CMsg & msg ) [inline]

Definition at line 163 of file uevent.cpp.

00164     {
00165         m_wid = msg.m_wid;
00166         m_ev = msg.m_ev;
00167         m_arg1 = msg.m_arg1;
00168         m_arg2 = msg.m_arg2;
00169
00170         return *this;
00171     }

Member Data Documentation

int CMsg::m_arg1

Definition at line 173 of file uevent.cpp.

Referenced by UEventGiveTime(), and operator=().

void* CMsg::m_arg2

Definition at line 174 of file uevent.cpp.

Referenced by UEventGiveTime(), and operator=().

int CMsg::m_ev

Definition at line 173 of file uevent.cpp.

Referenced by UEventGiveTime(), and operator=().

int CMsg::m_wid

Definition at line 173 of file uevent.cpp.

Referenced by UEventGiveTime(), and operator=().

The documentation for this class was generated from the following file:
  • rf/uevent.cpp
Generated on Sun Oct 21 12:48:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


msg Struct Reference

Collaboration diagram for msg:

[legend]
List of all members.

Public Attributes

msg * | next
char const * | format
char const * | arg1
char const * | arg2
char const * | arg3
char const * | arg4

Member Data Documentation

char const* msg::arg1

Definition at line 37 of file util.c.

char const* msg::arg2

Definition at line 38 of file util.c.

char const* msg::arg3

Definition at line 39 of file util.c.

char const* msg::arg4

Definition at line 40 of file util.c.

char const* msg::format

Definition at line 36 of file util.c.

Referenced by arg4().

struct msg* msg::next

Definition at line 35 of file util.c.

Referenced by arg4().

The documentation for this struct was generated from the following file:
  • cvs-1.10/diff/util.c
Generated on Sun Oct 21 12:48:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UMSGMAP Struct Reference

#include <umain.h>

Collaboration diagram for UMSGMAP:

[legend]
List of all members.

Public Attributes

const UMSGMAP * | pBaseMap
const UMSGMAP_ENTRY * | lpEntries

Member Data Documentation

const UMSGMAP_ENTRY* UMSGMAP::lpEntries

Definition at line 632 of file umain.h.

Referenced by UCmdTarget::UDispatchMessage().

const UMSGMAP* UMSGMAP::pBaseMap

Definition at line 631 of file umain.h.

Referenced by UCmdTarget::UDispatchMessage().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:48:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UMSGMAP_ENTRY Struct Reference

#include <umain.h>

Collaboration diagram for UMSGMAP_ENTRY:

[legend]
List of all members.

Public Attributes

int | nMessage
UEventParam nSig
UMSG_EXT ext
int | ext1
int | ext2
UPMSG pfn

Member Data Documentation

UMSG_EXT UMSGMAP_ENTRY::ext

Definition at line 623 of file umain.h.

Referenced by UCmdTarget::UDispatchMessage().

int UMSGMAP_ENTRY::ext1

Definition at line 624 of file umain.h.

Referenced by UCmdTarget::UDispatchMessage().

int UMSGMAP_ENTRY::ext2

Definition at line 625 of file umain.h.

Referenced by UCmdTarget::UDispatchMessage().

int UMSGMAP_ENTRY::nMessage

Definition at line 621 of file umain.h.

Referenced by UCmdTarget::UDispatchMessage().

UEventParam UMSGMAP_ENTRY::nSig

Definition at line 622 of file umain.h.

Referenced by UCmdTarget::UDispatchMessage().

UPMSG UMSGMAP_ENTRY::pfn

Definition at line 626 of file umain.h.

Referenced by UCmdTarget::UDispatchMessage().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:48:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMString Class Reference

#include <MultiString.h>

Inheritance diagram for CMString:

[legend]
Collaboration diagram for CMString:

[legend]
List of all members.

Public Methods

CMString (unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass)
virtual ~CMString ()

Constructor & Destructor Documentation

CMString::CMString | ( | unsigned int | maxstr,
 |  | const char * | uniqueName,
 |  | char *const * | defaultStr = 0L,
 |  | kClassPersistent | pclass = kNoClass
 | ) | [inline]

Definition at line 136 of file MultiString.h.

00137                                                                            :
00138         TMString<CStr>(maxstr, uniqueName, defaultStr, pclass)
00139     {
00140     }

virtual CMString::~CMString ( ) [inline, virtual]

Definition at line 142 of file MultiString.h.

00143     {
00144     }

The documentation for this class was generated from the following file:
  • common/MultiString.h
Generated on Sun Oct 21 12:48:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MultiFiles Class Reference

#include <MultiFiles.h>

Collaboration diagram for MultiFiles:

[legend]
List of all members.

Public Methods

MultiFiles ()
void | newdir (const char *dir)
void | newfile (const char *file, const FSSpec *spec=0L)
void | rewind (void)
bool | next (void)
char * | add (CvsArgs &args)
bool | get (int index, UStr &path, UStr &fileName)
int | NumFiles (void) const
void | reset ()

Protected Attributes

int | pos
std::vector< MultiFilesEntry > dirs

Constructor & Destructor Documentation

MultiFiles::MultiFiles ( ) [inline]

Definition at line 101 of file MultiFiles.h.

00101 : pos(-1) {}

Member Function Documentation

int MultiFiles::NumFiles ( void ) const

Definition at line 109 of file MultiFiles.cpp.

Referenced by UCvsFiles::OnCmdAdd(), UCvsFiles::OnCmdAddb(), UCvsFiles::OnCmdCommit(), UCvsFiles::OnCmdDiff(), UCvsFiles::OnCmdEdit(), UCvsFiles::OnCmdEditors(), UCvsFiles::OnCmdGraph(), UCvsFiles::OnCmdLock(), UCvsFiles::OnCmdLog(), UCvsFiles::OnCmdQueryUpdate(), UCvsFiles::OnCmdRmv(), UCvsFiles::OnCmdStatus(), UCvsFiles::OnCmdTagBranch(), UCvsFiles::OnCmdTagDelete(), UCvsFiles::OnCmdTagNew(), UCvsFiles::OnCmdTrash(), UCvsFiles::OnCmdUnedit(), UCvsFiles::OnCmdUnlock(), UCvsFiles::OnCmdUpdate(), UCvsFiles::OnCmdWatchOff(), UCvsFiles::OnCmdWatchOn(), UCvsFiles::OnCmdWatchers(), KoMoveToTrashHandler::OnFiles(), and CBrowseFileView::ProcessSelectionCommand().

00110 {
00111     int locpos = pos;
00112     if(locpos == -1)
00113         locpos = 0;
00114     if((size_t)locpos >= dirs.size())
00115         return 0;
00116
00117     const MultiFilesEntry & entry = dirs[locpos];
00118     return entry.files.size();
00119 }

char * MultiFiles::add ( CvsArgs & args )

Definition at line 81 of file MultiFiles.cpp.

Referenced by CvsCmdAddBinaryFiles(), CvsCmdAddFiles(), CvsCmdCancelChangesFiles(), CvsCmdCommitFiles(), CvsCmdDiffFiles(), CvsCmdEditFiles(), CvsCmdEditorsFiles(), CvsCmdLockFiles(), CvsCmdLogFiles(), CvsCmdRemoveFiles(), CvsCmdStatusFiles(), CvsCmdTagBranchFiles(), CvsCmdTagCreateFiles(), CvsCmdTagDeleteFiles(), CvsCmdUneditFiles(), CvsCmdUnlockFiles(), CvsCmdUpdateFiles(), CvsCmdWatchOffFiles(), CvsCmdWatchOnFiles(), CvsCmdWatchersFiles(), UAuthen_SSH::OnBtnName(), UAuthen_SSH::OnBtnRSA(), and UCvsFiles::OnCmdTrash().

00082 {
00083     if(pos < 0 || (size_t)pos >= dirs.size())
00084         return 0L;
00085
00086     MultiFilesEntry & entry = dirs[pos];
00087     std::vector<FileEntry>::const_iterator i;
00088     for(i = entry.files.begin(); i != entry.files.end(); ++i)
00089     {
00090         args.addfile((*i).file, entry.dir, &(*i).spec);
00091     }
00092     return entry.dir;
00093 }

bool MultiFiles::get | ( | int | index,
 |  | UStr & | path,
 |  | UStr & | fileName
 | ) |

Definition at line 95 of file MultiFiles.cpp.

Referenced by CvsCmdAnnotateFiles(), CvsCmdCommitFiles(), CvsCmdDiffFiles(), and KoMoveToTrashHandler::OnFiles().

00096 {
00097     if(pos < 0 || (size_t)pos >= dirs.size())
00098         return false;
00099
00100     MultiFilesEntry & entry = dirs[pos];
00101     if(index < 0 || (size_t)index >= entry.files.size())
00102         return false;
00103
00104     path = entry.dir;
00105     fileName = entry.files[index].file;
00106     return true;
00107 }

void MultiFiles::newdir ( const char * dir )

Definition at line 56 of file MultiFiles.cpp.

Referenced by UCvsFiles::OnCmdAdd(), UCvsFiles::OnCmdAddb(), UCvsFiles::OnCmdCommit(), UCvsFiles::OnCmdDiff(), UCvsFiles::OnCmdEdit(), UCvsFiles::OnCmdEditors(), UCvsFiles::OnCmdGraph(), UCvsFiles::OnCmdLock(), UCvsFiles::OnCmdLog(), UCvsFiles::OnCmdQueryUpdate(), UCvsFiles::OnCmdRmv(), UCvsFiles::OnCmdStatus(), UCvsFiles::OnCmdTagBranch(), UCvsFiles::OnCmdTagDelete(), UCvsFiles::OnCmdTagNew(), UCvsFiles::OnCmdTrash(), UCvsFiles::OnCmdUnedit(), UCvsFiles::OnCmdUnlock(), UCvsFiles::OnCmdUpdate(), UCvsFiles::OnCmdWatchOff(), UCvsFiles::OnCmdWatchOn(), UCvsFiles::OnCmdWatchers(), and CBrowseFileView::ProcessSelectionCommand().

00057 {
00058     MultiFilesEntry entry(dir);
00059     dirs.push_back(dir);
00060 }

void MultiFiles::newfile | ( | const char * | file,
 |  | const FSSpec * | spec = 0L
 | ) |

Definition at line 62 of file MultiFiles.cpp.

Referenced by UCvsFiles::OnCmdAdd(), UCvsFiles::OnCmdAddb(), UCvsFiles::OnCmdCommit(), UCvsFiles::OnCmdDiff(), UCvsFiles::OnCmdEdit(), UCvsFiles::OnCmdEditors(), UCvsFiles::OnCmdGraph(), UCvsFiles::OnCmdLock(), UCvsFiles::OnCmdLog(), UCvsFiles::OnCmdQueryUpdate(), UCvsFiles::OnCmdRmv(), UCvsFiles::OnCmdStatus(), UCvsFiles::OnCmdTagBranch(), UCvsFiles::OnCmdTagDelete(), UCvsFiles::OnCmdTagNew(), UCvsFiles::OnCmdTrash(), UCvsFiles::OnCmdUnedit(), UCvsFiles::OnCmdUnlock(), UCvsFiles::OnCmdUpdate(), UCvsFiles::OnCmdWatchOff(), UCvsFiles::OnCmdWatchOn(), UCvsFiles::OnCmdWatchers(), and CBrowseFileView::ProcessSelectionCommand().

00063 {
00064     if(dirs.size() == 0)
00065         return;
00066
00067     MultiFilesEntry & entry = dirs[dirs.size() - 1];
00068     entry.add(file, spec);
00069 }

bool MultiFiles::next ( void )

Definition at line 71 of file MultiFiles.cpp.

Referenced by CvsCmdAddBinaryFiles(), CvsCmdAddFiles(), CvsCmdAnnotateFiles(), CvsCmdCancelChangesFiles(), CvsCmdCommitFiles(), CvsCmdDiffFiles(), CvsCmdEditFiles(), CvsCmdEditorsFiles(), CvsCmdLockFiles(), CvsCmdLogFiles(), CvsCmdRemoveFiles(), CvsCmdStatusFiles(), CvsCmdTagBranchFiles(), CvsCmdTagCreateFiles(), CvsCmdTagDeleteFiles(), CvsCmdUneditFiles(), CvsCmdUnlockFiles(), CvsCmdUpdateFiles(), CvsCmdWatchOffFiles(), CvsCmdWatchOnFiles(), CvsCmdWatchersFiles(), UAuthen_SSH::OnBtnName(), UAuthen_SSH::OnBtnRSA(), UCvsFiles::OnCmdTrash(), and KoMoveToTrashHandler::OnFiles().

00072 {
00073     if(pos == -1)
00074         pos = 0;
00075     else
00076         ++pos;
00077
00078     return (size_t)pos < dirs.size();
00079 }

void MultiFiles::reset ( )

Definition at line 121 of file MultiFiles.cpp.

00122 {
00123     dirs.erase(dirs.begin(), dirs.end());
00124     pos = -1;
00125 }

void MultiFiles::rewind ( void ) [inline]

Definition at line 108 of file MultiFiles.h.

00108 {pos = -1;}

Member Data Documentation

std::vector<MultiFilesEntry> MultiFiles::dirs [protected]

Definition at line 124 of file MultiFiles.h.

int MultiFiles::pos [protected]

Definition at line 123 of file MultiFiles.h.

The documentation for this class was generated from the following files:
  • common/MultiFiles.h
  • common/MultiFiles.cpp
Generated on Sun Oct 21 12:48:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


MultiFilesEntry Class Reference

#include <MultiFiles.h>

Collaboration diagram for MultiFilesEntry:

[legend]
List of all members.

Public Methods

MultiFilesEntry ()
MultiFilesEntry (const char *path)
MultiFilesEntry (const MultiFilesEntry &entries)
MultiFilesEntry & | operator= (const MultiFilesEntry &entries)
void | setdir (const char *newdir)
void | add (const char *file, const FSSpec *spec=0L)

Public Attributes

UStr dir
std::vector< FileEntry > files

Constructor & Destructor Documentation

MultiFilesEntry::MultiFilesEntry ( ) [inline]

Definition at line 74 of file MultiFiles.h.

00074 {}

MultiFilesEntry::MultiFilesEntry ( const char * path ) [inline]

Definition at line 75 of file MultiFiles.h.

00076     {
00077         dir = path;
00078     }

MultiFilesEntry::MultiFilesEntry ( const MultiFilesEntry & entries ) [inline]

Definition at line 79 of file MultiFiles.h.

00080     {
00081         *this = entries;
00082     }

Member Function Documentation

void MultiFilesEntry::add | ( | const char * | file,
 |  | const FSSpec * | spec = 0L
 | ) |

Definition at line 50 of file MultiFiles.cpp.

Referenced by MultiFiles::newfile().

00051 {
00052     FileEntry entry(file, spec);
00053     files.push_back(entry);
00054 }

MultiFilesEntry& MultiFilesEntry::operator= ( const MultiFilesEntry & entries ) [inline]

Definition at line 84 of file MultiFiles.h.

00085     {
00086         dir = entries.dir;
00087         files = entries.files;
00088         return *this;
00089     }

void MultiFilesEntry::setdir ( const char * newdir )

Definition at line 45 of file MultiFiles.cpp.

00046 {
00047     dir = newdir;
00048 }

Member Data Documentation

UStr MultiFilesEntry::dir

Definition at line 94 of file MultiFiles.h.

Referenced by MultiFiles::add(), MultiFiles::get(), and operator=().

std::vector<FileEntry> MultiFilesEntry::files

Definition at line 95 of file MultiFiles.h.

Referenced by MultiFiles::NumFiles(), MultiFiles::add(), MultiFiles::get(), and operator=().

The documentation for this class was generated from the following files:
  • common/MultiFiles.h
  • common/MultiFiles.cpp
Generated on Sun Oct 21 12:48:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CMyShellTree Class Reference

#include <ExploreBar.h>

Inheritance diagram for CMyShellTree:

[legend]
Collaboration diagram for CMyShellTree:

[legend]
List of all members.

Protected Methods

bool | DisableCommon ()
afx_msg void | OnRclick (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnDeleteitem (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnSelchanged (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnItemexpanding (NMHDR *pNMHDR, LRESULT *pResult)

Member Function Documentation

bool CMyShellTree::DisableCommon ( ) [protected]

Definition at line 30 of file ExploreBar.cpp.

Referenced by OnDeleteitem(), OnItemexpanding(), OnRclick(), and OnSelchanged().

00031 {
00032     CWincvsApp *app = (CWincvsApp *)AfxGetApp();
00033     return app->gCvsRunning || gCvsPrefs.empty();
00034 }

void CMyShellTree::OnDeleteitem | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 87 of file ExploreBar.cpp.

00088 {
00089     if(DisableCommon())
00090     {
00091         *pResult = 1;
00092         return;
00093     }
00094
00095     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00096     // TODO: Add your control notification handler code here
00097     CCJShellTree::OnDeleteitem(pNMHDR,pResult);
00098     *pResult = 0;
00099 }

void CMyShellTree::OnItemexpanding | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 36 of file ExploreBar.cpp.

00037 {
00038     if(DisableCommon())
00039     {
00040         *pResult = 1;
00041         return;
00042     }
00043
00044     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00045     CCJShellTree::OnItemexpanding(pNMHDR,pResult);
00046     CCJShellTree::Invalidate();
00047     *pResult = 0;
00048 }

void CMyShellTree::OnRclick | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 74 of file ExploreBar.cpp.

00075 {
00076     if(DisableCommon())
00077     {
00078         *pResult = 1;
00079         return;
00080     }
00081
00082     // TODO: Add your control notification handler code here
00083     CCJShellTree::OnRclick(pNMHDR,pResult);
00084     *pResult = 0;
00085 }

void CMyShellTree::OnSelchanged | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 50 of file ExploreBar.cpp.

00051 {
00052     if(DisableCommon())
00053     {
00054         *pResult = 1;
00055         return;
00056     }
00057
00058     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00059
00060     CString szPath;
00061     CCJShellTree::OnSelchanged(pNMHDR,pResult);
00062
00063     if(CCJShellTree::GetSelectedFolderPath(szPath))
00064     {
00065         CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00066         CBrowseFileView *view = app->GetFileView();
00067         if(view != 0L)
00068             view->ResetView(szPath);
00069     }
00070
00071     *pResult = 0;
00072 }

The documentation for this class was generated from the following files:
  • WinCvs/ExploreBar.h
  • WinCvs/ExploreBar.cpp
Generated on Sun Oct 21 12:48:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


node Struct Reference

#include <hash.h>

Collaboration diagram for node:

[legend]
List of all members.

Public Attributes

Ntype type
node * | next
node * | prev
node * | hashnext
node * | hashprev
char * | key
char * | data
void(* | delproc )()

Member Data Documentation

char* node::data

Definition at line 33 of file hash.h.

Referenced by finfo().

void(* node::delproc)()

struct node* node::hashnext

Definition at line 30 of file hash.h.

struct node* node::hashprev

Definition at line 31 of file hash.h.

char* node::key

Definition at line 32 of file hash.h.

Referenced by argstring().

struct node* node::next

Definition at line 28 of file hash.h.

struct node* node::prev

Definition at line 29 of file hash.h.

Ntype node::type

Definition at line 27 of file hash.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/hash.h
Generated on Sun Oct 21 12:48:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CNoPython Class Reference

#include <NoPython.h>

Inheritance diagram for CNoPython:

[legend]
Collaboration diagram for CNoPython:

[legend]
List of all members.

Public Types

enum | { IDD = IDD_NOPYTHON }

Public Methods

CNoPython (CWnd *pParent=NULL)

Public Attributes

CCJHyperLink m_url
BOOL | m_remind

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()

Member Enumeration Documentation

anonymous enum

Enumeration values:
IDD

Definition at line 23 of file NoPython.h.

00023 { IDD = IDD_NOPYTHON };

Constructor & Destructor Documentation

CNoPython::CNoPython ( CWnd * pParent = NULL )

Definition at line 22 of file NoPython.cpp.

00023     : CDialog(CNoPython::IDD, pParent)
00024 {
00025     //{{AFX_DATA_INIT(CNoPython)
00026     m_remind = TRUE;
00027     //}}AFX_DATA_INIT
00028 }

Member Function Documentation

void CNoPython::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 31 of file NoPython.cpp.

00032 {
00033     CDialog::DoDataExchange(pDX);
00034     //{{AFX_DATA_MAP(CNoPython)
00035     DDX_Control(pDX, IDC_PYTHONURL, m_url);
00036     DDX_Check(pDX, IDC_REMIND, m_remind);
00037     //}}AFX_DATA_MAP
00038 }

BOOL CNoPython::OnInitDialog ( ) [protected, virtual]

Definition at line 49 of file NoPython.cpp.

00050 {
00051     CDialog::OnInitDialog();
00052
00053     m_url.SetURL(_T("http://www.python.org"));
00054
00055     return TRUE;  // return TRUE unless you set the focus to a control
00056                   // EXCEPTION: OCX Property Pages should return FALSE
00057 }

Member Data Documentation

BOOL CNoPython::m_remind

Definition at line 25 of file NoPython.h.

Referenced by WarnNoPython().

CCJHyperLink CNoPython::m_url

Definition at line 24 of file NoPython.h.

The documentation for this class was generated from the following files:
  • WinCvs/NoPython.h
  • WinCvs/NoPython.cpp
Generated on Sun Oct 21 12:48:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


NotificationManager Class Reference

#include <BrowseViewModel.h>

Collaboration diagram for NotificationManager:

[legend]
List of all members.

Public Methods

NotificationManager ()
void | CheckIn (CObject *observer, FNOBSERVER handler)
void | CheckOut (CObject *observer)
void | NotifyAll ()

Private Attributes

std::vector< Node > m_nodes

Constructor & Destructor Documentation

NotificationManager::NotificationManager ( ) [inline]

Definition at line 82 of file BrowseViewModel.h.

00082 {}

Member Function Documentation

void NotificationManager::CheckIn | ( | CObject * | observer,
 |  | FNOBSERVER | handler
 | ) | [inline]

Definition at line 87 of file BrowseViewModel.h.

Referenced by CMainFrame::OnCreate().

00088     {
00089         m_nodes.push_back(Node(observer, handler));
00090     }

void NotificationManager::CheckOut ( CObject * observer ) [inline]

Definition at line 93 of file BrowseViewModel.h.

00094     {
00095         for (std::vector<Node>::iterator i = m_nodes.begin(); i != m_nodes.end(); i++)
00096         {
00097             if ((*i).observer == observer)
00098             {
00099                 m_nodes.erase(i);
00100                 break;
00101             }
00102         }
00103     }

void NotificationManager::NotifyAll ( ) [inline]

Definition at line 106 of file BrowseViewModel.h.

Referenced by CMainFrame::OnFilterMaskEntered(), CMainFrame::OnViewAdded(), CMainFrame::OnViewChanged(), CMainFrame::OnViewConflict(), CMainFrame::OnViewHideunknown(), CMainFrame::OnViewIgnore(), CMainFrame::OnViewMissing(), CMainFrame::OnViewModified(), CMainFrame::OnViewRecursive(), CMainFrame::OnViewRemoved(), CMainFrame::OnViewUnknown(), and CToolbarCombo::SetText().

00107     {
00108         for (std::vector<Node>::iterator i = m_nodes.begin(); i != m_nodes.end(); i++)
00109         {
00110             // make a local copy so that observers can freely unregister during the process
00111             Node & node = *i;
00112             node.handler(node.observer);
00113         }
00114     }

Member Data Documentation

std::vector<Node> NotificationManager::m_nodes [private]

Definition at line 78 of file BrowseViewModel.h.

The documentation for this class was generated from the following file:
  • common/BrowseViewModel.h
Generated on Sun Oct 21 12:48:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


NotificationManager::Node Struct Reference

Collaboration diagram for NotificationManager::Node:

[legend]
List of all members.

Public Methods

Node ()
Node (CObject *o, FNOBSERVER h)
Node (const Node &n)
Node & operator= (const Node &n)

Public Attributes

CObject * observer
FNOBSERVER handler

Constructor & Destructor Documentation

NotificationManager::Node::Node ( ) [inline]

Definition at line 52 of file BrowseViewModel.h.

00053         : observer(NULL), handler(NULL)
00054         {}

NotificationManager::Node::Node | ( | CObject * | o,
 |  | FNOBSERVER | h
 | ) | [inline]

Definition at line 57 of file BrowseViewModel.h.

00058         : observer(o), handler(h)
00059         {}

NotificationManager::Node::Node ( const Node & n ) [inline]

Definition at line 61 of file BrowseViewModel.h.

00062         {
00063             observer = n.observer;
00064             handler = n.handler;
00065         }

Member Function Documentation

Node& NotificationManager::Node::operator= ( const Node & n ) [inline]

Definition at line 67 of file BrowseViewModel.h.

00068         {
00069             observer = n.observer;
00070             handler = n.handler;
00071             return *this;
00072         }

Member Data Documentation

FNOBSERVER NotificationManager::Node::handler

Definition at line 48 of file BrowseViewModel.h.

CObject* NotificationManager::Node::observer

Definition at line 45 of file BrowseViewModel.h.

The documentation for this struct was generated from the following file:
  • common/BrowseViewModel.h
Generated on Sun Oct 21 12:48:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CObject Class Reference

Inheritance diagram for CObject:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJStatusBar.h
Generated on Sun Oct 21 12:48:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UObject Class Reference

#include <uobject.h>

Inheritance diagram for UObject:

[legend]
Collaboration diagram for UObject:

[legend]
List of all members.

Public Methods

virtual const URuntimeClass * | GetRuntimeClass () const
virtual | ~UObject ()
bool | IsKindOf (const URuntimeClass *pClass) const

Static Public Methods

const URuntimeClass * | rtUObject ()
const URuntimeClass * | _GetBaseClass ()
UObject * | CreateObject (const char *className)

Protected Methods

UObject ()

Static Protected Attributes

const URuntimeClass | classUObject

Constructor & Destructor Documentation

virtual UObject::~UObject ( ) [inline, virtual]

Definition at line 93 of file uobject.h.

00093 {}

UObject::UObject ( ) [inline, protected]

Definition at line 102 of file uobject.h.

00102 {}

Member Function Documentation

UObject * UObject::CreateObject ( const char * className ) [static]

Definition at line 40 of file uobject.cpp.

00041 {
00042     URuntimeClass *next = URuntimeClass::sAllURuntimeClass;
00043     while(next != 0L)
00044     {
00045         if(strcmp(next->m_lpszClassName, className) == 0)
00046             return next->CreateObject();
00047
00048         next = next->m_pNextClass;
00049     }
00050     return 0L;
00051 }

const URuntimeClass * UObject::GetRuntimeClass ( ) const [virtual]

Definition at line 53 of file uobject.cpp.

Referenced by IsKindOf().

00054 {
00055     return URUNTIME_CLASS(UObject);
00056 }

bool UObject::IsKindOf ( const URuntimeClass * pClass ) const

Definition at line 58 of file uobject.cpp.

Referenced by UCvsApp::GetBrowserView(), UCvsApp::GetFilesView(), UWidget::HasModal(), UCvsFolders::OnTreeSelecting(), UDC::UDC(), UEventGiveTime(), UMenuAddButton(), UMenuAddPulldown(), and UMenuAddToggle().

00059 {
00060     // simple SI case
00061     const URuntimeClass* pClassThis = GetRuntimeClass();
00062     return pClassThis->IsDerivedFrom(pClass);
00063 }

const URuntimeClass * UObject::_GetBaseClass ( ) [static]

Definition at line 33 of file uobject.cpp.

00034     { return 0L; }

const URuntimeClass * UObject::rtUObject ( ) [static]

Definition at line 37 of file uobject.cpp.

00038     { return &UObject::classUObject; }

Member Data Documentation

const URuntimeClass UObject::classUObject [static, protected]

The documentation for this class was generated from the following files:
  • rf/uobject.h
  • rf/uobject.cpp
Generated on Sun Oct 21 12:48:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ColorTableEntry Struct Reference

#include <CJColorPopup.h>

Collaboration diagram for ColorTableEntry:

[legend]
List of all members.

Public Attributes

COLORREF | crColor
TCHAR * | szName

Member Data Documentation

COLORREF ColorTableEntry::crColor

Definition at line 66 of file CJColorPopup.h.

TCHAR* ColorTableEntry::szName

Definition at line 67 of file CJColorPopup.h.

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/Include/CJColorPopup.h
Generated on Sun Oct 21 12:48:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


option Struct Reference

#include <getopt.h>

Collaboration diagram for option:

[legend]
List of all members.

Public Attributes

char * | name
int | has_arg
int * | flag
int | val
char * | name
int * | flag

Member Data Documentation

int* option::flag

Definition at line 83 of file getopt.h.

int* option::flag

Definition at line 89 of file getopt.h.

int option::has_arg

Definition at line 82 of file getopt.h.

char* option::name

Definition at line 78 of file getopt.h.

char* option::name

Definition at line 84 of file getopt.h.

int option::val

Definition at line 84 of file getopt.h.

The documentation for this struct was generated from the following files:
  • common/getopt.h
  • cvs-1.10/lib/getopt.h
Generated on Sun Oct 21 12:48:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


option_revlist Struct Reference

Collaboration diagram for option_revlist:

[legend]
List of all members.

Public Attributes

option_revlist * | next
char * | first
char * | last
int | branchhead

Member Data Documentation

int option_revlist::branchhead

Definition at line 32 of file log.c.

Referenced by default_branch().

char* option_revlist::first

Definition at line 25 of file log.c.

Referenced by default_branch().

char* option_revlist::last

Definition at line 29 of file log.c.

Referenced by default_branch().

struct option_revlist* option_revlist::next

Definition at line 22 of file log.c.

Referenced by default_branch().

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/log.c
Generated on Sun Oct 21 12:48:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


COptionalPropertySheet Class Reference

#include <OptionalPropertySheet.h>

Inheritance diagram for COptionalPropertySheet:

[legend]
Collaboration diagram for COptionalPropertySheet:

[legend]
List of all members.

Public Methods

COptionalPropertySheet (bool bOptionChecked, UINT nIDCaption, CWnd *pParentWnd=NULL, UINT iSelectPage=0)
COptionalPropertySheet (bool bOptionChecked, LPCTSTR pszCaption, CWnd *pParentWnd=NULL, UINT iSelectPage=0)
virtual int | DoModal ()
virtual | ~COptionalPropertySheet ()
bool | GetHideCommandDlg ()

Protected Methods

virtual BOOL | OnCommand (WPARAM wParam, LPARAM lParam)
virtual BOOL | OnInitDialog ()

Protected Attributes

bool | m_bOptionChecked
CButton m_optionCheck

Constructor & Destructor Documentation

COptionalPropertySheet::COptionalPropertySheet | ( | bool | bOptionChecked,
 |  | UINT | nIDCaption,
 |  | CWnd * | pParentWnd = NULL,
 |  | UINT | iSelectPage = 0
 | ) |

Definition at line 41 of file OptionalPropertySheet.cpp.

00042     :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
00043 {
00044     m_bOptionChecked = bOptionChecked;
00045 }

COptionalPropertySheet::COptionalPropertySheet | ( | bool | bOptionChecked,
 |  | LPCTSTR | pszCaption,
 |  | CWnd * | pParentWnd = NULL,
 |  | UINT | iSelectPage = 0
 | ) |

Definition at line 47 of file OptionalPropertySheet.cpp.

00048     :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
00049 {
00050     m_bOptionChecked = bOptionChecked;
00051 }

COptionalPropertySheet::~COptionalPropertySheet ( ) [virtual]

Definition at line 53 of file OptionalPropertySheet.cpp.

00054 {
00055 }

Member Function Documentation

int COptionalPropertySheet::DoModal ( ) [virtual]

Definition at line 95 of file OptionalPropertySheet.cpp.

00096 {
00097     bool bDisplayDlg = true;
00098
00099     // See if the option flag is set
00100     //m_bOptionChecked = !!AfxGetApp()->GetProfileInt(PROFILE_NAME, m_psh.pszCaption, (int)false);
00101
00102     if (m_bOptionChecked)
00103     {
00104         // See if the ctrl key is down
00105         bDisplayDlg = (::GetKeyState(gCvsPrefs.HideCommandDlgUseShift() ? VK_SHIFT : VK_CONTROL) < 0);
00106     }
00107
00108     if (bDisplayDlg)
00109         return CPropertySheet::DoModal();
00110     else
00111         return IDOK;
00112 }

bool COptionalPropertySheet::GetHideCommandDlg ( )

Definition at line 126 of file OptionalPropertySheet.cpp.

00127 {
00128     return m_bOptionChecked;
00129 }

BOOL COptionalPropertySheet::OnCommand | ( | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) | [protected, virtual]

Definition at line 114 of file OptionalPropertySheet.cpp.

00115 {
00116     if (wParam == IDOK)
00117     {
00118         // Save the check state of the display option
00119         m_bOptionChecked = (m_optionCheck.GetCheck() == 1);
00120         //AfxGetApp()->WriteProfileInt(PROFILE_NAME, m_psh.pszCaption, bChecked);
00121     }
00122
00123     return CPropertySheet::OnCommand(wParam, lParam);
00124 }

BOOL COptionalPropertySheet::OnInitDialog ( ) [protected, virtual]

Definition at line 66 of file OptionalPropertySheet.cpp.

00067 {
00068     CPropertySheet::OnInitDialog();
00069
00070     // Add the option check box
00071     CRect rectWnd;
00072     GetClientRect(rectWnd);
00073
00074     rectWnd.bottom -= 13;
00075     rectWnd.left   += 7;
00076     rectWnd.top     = rectWnd.bottom - 12;
00077     rectWnd.right   = rectWnd.left   + 180;
00078
00079     CString strOptionText;
00080     strOptionText.Format(_T("Display only if %s key is down"),
00081         gCvsPrefs.HideCommandDlgUseShift() ? "Shift" : "Ctrl");
00082     m_optionCheck.Create(strOptionText,
00083         WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX|WS_TABSTOP,
00084         rectWnd, this, 4);
00085
00086     m_optionCheck.SetFont( GetFont() );
00087
00088     // Set the checkbox
00089     m_optionCheck.SetCheck(m_bOptionChecked);
00090
00091     return TRUE;  // return TRUE unless you set the focus to a control
00092     // EXCEPTION: OCX Property Pages should return FALSE
00093 }

Member Data Documentation

bool COptionalPropertySheet::m_bOptionChecked [protected]

Definition at line 68 of file OptionalPropertySheet.h.

CButton COptionalPropertySheet::m_optionCheck [protected]

Definition at line 69 of file OptionalPropertySheet.h.

The documentation for this class was generated from the following files:
  • common/OptionalPropertySheet.h
  • common/OptionalPropertySheet.cpp
Generated on Sun Oct 21 12:48:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


OUTBAR_INFO Struct Reference

#include <GfxOutBarCtrl.h>

Collaboration diagram for OUTBAR_INFO:

[legend]
List of all members.

Public Attributes

int | index
int | iDragFrom
int | iDragTo
LPCTSTR | cText

Member Data Documentation

LPCTSTR OUTBAR_INFO::cText

Definition at line 56 of file GfxOutBarCtrl.h.

Referenced by CGfxOutBarCtrl::OnEndLabelEdit().

int OUTBAR_INFO::iDragFrom

Definition at line 53 of file GfxOutBarCtrl.h.

Referenced by CGfxOutBarCtrl::OnLButtonDown().

int OUTBAR_INFO::iDragTo

Definition at line 54 of file GfxOutBarCtrl.h.

Referenced by CGfxOutBarCtrl::OnLButtonDown().

int OUTBAR_INFO::index

Definition at line 52 of file GfxOutBarCtrl.h.

Referenced by CGfxOutBarCtrl::OnEndLabelEdit().

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/Include/GfxOutBarCtrl.h
Generated on Sun Oct 21 12:48:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


partition Struct Reference

Collaboration diagram for partition:

[legend]
List of all members.

Public Attributes

int | xmid
int | ymid
int | lo_minimal
int | hi_minimal

Member Data Documentation

int partition::hi_minimal

Definition at line 54 of file analyze.c.

int partition::lo_minimal

Definition at line 53 of file analyze.c.

int partition::xmid

Definition at line 52 of file analyze.c.

int partition::ymid

Definition at line 52 of file analyze.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/diff/analyze.c
Generated on Sun Oct 21 12:48:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


passwd Struct Reference

#include <pwd.h>

Collaboration diagram for passwd:

[legend]
List of all members.

Public Attributes

char * | pw_name
char * | pw_passwd
uid_t | pw_uid
gid_t | pw_gid
char * | pw_age
char * | pw_comment
char * | pw_gecos
char * | pw_dir
char * | pw_shell
char * | pw_name
char * | pw_dir
char * | pw_shell
int | pw_uid
char * | pw_name
char * | pw_name
char * | pw_dir
char * | pw_shell

Member Data Documentation

char* passwd::pw_age

Definition at line 32 of file pwd.h.

char* passwd::pw_comment

Definition at line 33 of file pwd.h.

char* passwd::pw_dir

Definition at line 30 of file pwd.h.

char* passwd::pw_dir

Definition at line 30 of file pwd.h.

char* passwd::pw_dir

Definition at line 35 of file pwd.h.

Referenced by getpwuid().

char* passwd::pw_gecos

Definition at line 34 of file pwd.h.

gid_t passwd::pw_gid

Definition at line 31 of file pwd.h.

char* passwd::pw_name

Definition at line 29 of file pwd.h.

char* passwd::pw_name

Definition at line 14 of file pwd.h.

char* passwd::pw_name

Definition at line 29 of file pwd.h.

char* passwd::pw_name

Definition at line 28 of file pwd.h.

Referenced by getpwuid().

char* passwd::pw_passwd

Definition at line 29 of file pwd.h.

char* passwd::pw_shell

Definition at line 31 of file pwd.h.

char* passwd::pw_shell

Definition at line 31 of file pwd.h.

char* passwd::pw_shell

Definition at line 36 of file pwd.h.

Referenced by getpwuid().

int passwd::pw_uid

Definition at line 32 of file pwd.h.

int passwd::pw_uid

Definition at line 32 of file pwd.h.

Referenced by getpwuid().

The documentation for this struct was generated from the following files:
  • cvs-1.10/macintosh/pwd.h
  • cvs-1.10/os2/pwd.h
  • cvs-1.10/vms/pwd.h
  • cvs-1.10/windows-NT/pwd.h
Generated on Sun Oct 21 12:48:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PCPStr Class Reference

#include <CPStr.h>

Inheritance diagram for PCPStr:

[legend]
Collaboration diagram for PCPStr:

[legend]
List of all members.

Public Methods

PCPStr (const char *uniqueName, const char *defValue=0L, kClassPersistent pclass=kNoClass)
virtual | ~PCPStr ()
virtual unsigned int | SizeOf (void) const
virtual const void * | GetData (void) const
virtual void | SetData (const void *ptr, unsigned int size)
operator const unsigned char * () const
as a P string. More...

operator unsigned char * ()
as a P string. More...

operator const char * () const
as a C string. More...

operator char * ()
as a C string. More...

const char * | operator= (const char *newstr)
set to a new C String (0L is OK). More...

const unsigned char * | operator= (const unsigned char *newstr)
set to a new P String (0L is OK). More...

Constructor & Destructor Documentation

PCPStr::PCPStr | ( | const char * | uniqueName,
 |  | const char * | defValue = 0L,
 |  | kClassPersistent | pclass = kNoClass
 | ) | [inline]

Definition at line 43 of file CPStr.h.

00043                                                                                                   : CPStr(),
00044         CPersistent(uniqueName, pclass)
00045     {
00046         if(defValue != 0L)
00047             *(CPStr *)this = defValue;
00048     }

virtual PCPStr::~PCPStr ( ) [inline, virtual]

Definition at line 49 of file CPStr.h.

00050     {
00051     }

Member Function Documentation

virtual const void* PCPStr::GetData ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 58 of file CPStr.h.

00059     {
00060         const void *res = (const char *)(*(CPStr *)this);
00061         return res == 0L ? "" : res;
00062     }

virtual void PCPStr::SetData | ( | const void * | ptr,
 |  | unsigned int | size
 | ) | [inline, virtual]

Reimplemented from CPersistent.

Definition at line 64 of file CPStr.h.

00065     {
00066         if(strlen((const char *)ptr) == (size - 1))
00067             *(CPStr *)this = (const char *)ptr;
00068     }

virtual unsigned int PCPStr::SizeOf ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 53 of file CPStr.h.

00054     {
00055         return str != 0L ? length() + 1 : 1;
00056     }

PCPStr::operator char * ( ) [inline]

as a C string.

Reimplemented from UPStr.

Definition at line 77 of file CPStr.h.

00077 { return *(CPStr *)this; }

PCPStr::operator const char * ( ) const [inline]

as a C string.

Reimplemented from UPStr.

Definition at line 76 of file CPStr.h.

00076 { return *(CPStr *)this; }

PCPStr::operator const unsigned char * ( ) const [inline]

as a P string.

Reimplemented from UPStr.

Definition at line 70 of file CPStr.h.

00071         { return *(CPStr *)this; }

PCPStr::operator unsigned char * ( ) [inline]

as a P string.

Reimplemented from UPStr.

Definition at line 72 of file CPStr.h.

00073         { return *(CPStr *)this; }

const unsigned char* PCPStr::operator= ( const unsigned char * newstr ) [inline]

set to a new P String (0L is OK).

Reimplemented from UPStr.

Definition at line 83 of file CPStr.h.

00084         { return ((CPStr *)this)->operator=(newstr); }

const char* PCPStr::operator= ( const char * newstr ) [inline]

set to a new C String (0L is OK).

Reimplemented from UPStr.

Definition at line 80 of file CPStr.h.

00081         { return ((CPStr *)this)->operator=(newstr); }

The documentation for this class was generated from the following file:
  • common/CPStr.h
Generated on Sun Oct 21 12:48:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PCStr Class Reference

#include <CPStr.h>

Inheritance diagram for PCStr:

[legend]
Collaboration diagram for PCStr:

[legend]
List of all members.

Public Methods

PCStr (const char *uniqueName, const char *defValue=0L, kClassPersistent pclass=kNoClass)
virtual | ~PCStr ()
virtual unsigned int | SizeOf (void) const
virtual const void * | GetData (void) const
virtual void | SetData (const void *ptr, unsigned int size)
operator const char * () const
as a C string. More...

operator char * ()
as a C string. More...

const char * | operator= (const char *newstr)
set from a C String (0L is OK). More...

const char * | operator= (const unsigned char *newstr)
set from a P String (0L is OK). More...

Constructor & Destructor Documentation

PCStr::PCStr | ( | const char * | uniqueName,
 |  | const char * | defValue = 0L,
 |  | kClassPersistent | pclass = kNoClass
 | ) | [inline]

Definition at line 92 of file CPStr.h.

00092                                                                                                  : CStr(),
00093         CPersistent(uniqueName, pclass)
00094     {
00095         if(defValue != 0L)
00096             *(CStr *)this = defValue;
00097     }

virtual PCStr::~PCStr ( ) [inline, virtual]

Definition at line 98 of file CPStr.h.

00099     {
00100     }

Member Function Documentation

virtual const void* PCStr::GetData ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 107 of file CPStr.h.

00108     {
00109         const void *res = (const char *)(*(CStr *)this);
00110         return res == 0L ? "" : res;
00111     }

virtual void PCStr::SetData | ( | const void * | ptr,
 |  | unsigned int | size
 | ) | [inline, virtual]

Reimplemented from CPersistent.

Definition at line 113 of file CPStr.h.

00114     {
00115         if(strlen((const char *)ptr) == (size - 1))
00116             *(CStr *)this = (const char *)ptr;
00117     }

virtual unsigned int PCStr::SizeOf ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 102 of file CPStr.h.

00103     {
00104         return str != 0L ? length() + 1 : 0;
00105     }

PCStr::operator char * ( ) [inline]

as a C string.

Reimplemented from UStr.

Definition at line 120 of file CPStr.h.

00120 { return *(CStr *)this; }

PCStr::operator const char * ( ) const [inline]

as a C string.

Reimplemented from UStr.

Definition at line 119 of file CPStr.h.

00119 { return *(CStr *)this; }

const char* PCStr::operator= ( const unsigned char * newstr ) [inline]

set from a P String (0L is OK).

Reimplemented from UStr.

Definition at line 129 of file CPStr.h.

00130     {
00131         TouchTimeStamp();
00132         return ((CStr *)this)->operator=(newstr);
00133     }

const char* PCStr::operator= ( const char * newstr ) [inline]

set from a C String (0L is OK).

Reimplemented from UStr.

Definition at line 123 of file CPStr.h.

00124     {
00125         TouchTimeStamp();
00126         return ((CStr *)this)->operator=(newstr);
00127     }

The documentation for this class was generated from the following file:
  • common/CPStr.h
Generated on Sun Oct 21 12:48:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPen Class Reference

#include <udraw.h>

Collaboration diagram for UPen:

[legend]
List of all members.

Public Methods

UPen ()
~UPen ()
bool | DeleteObject (void)
bool | CreatePen (int nPenStyle, int nWidth, UCOLORREF crColor)

Protected Attributes

int | m_width
int | m_style

Friends

class | UDC

Constructor & Destructor Documentation

UPen::UPen ( )

Definition at line 382 of file udraw.cpp.

00384     : m_set(false)
00385 #endif
00386 {
00387 }

UPen::~UPen ( )

Definition at line 389 of file udraw.cpp.

00390 {
00391     DeleteObject();
00392 }

Member Function Documentation

bool UPen::CreatePen | ( | int | nPenStyle,
 |  | int | nWidth,
 |  | UCOLORREF | crColor
 | ) |

Definition at line 414 of file udraw.cpp.

Referenced by DrawNode(), and CWinLogData::Update().

00415 {
00416     bool res = false;
00417
00418     m_width = nWidth;
00419     m_style = nPenStyle;
00420
00421 #if qGTK
00422     DeleteObject();
00423     GdkColormap *cmap = gdk_colormap_get_system();
00424     if(cmap != 0L)
00425     {
00426         m_col.red = UGetRValue(crColor) << 8;
00427         m_col.green = UGetGValue(crColor) << 8;
00428         m_col.blue = UGetBValue(crColor) << 8;
00429         if(gdk_color_alloc(cmap, &m_col))
00430             m_set = true;
00431     }
00432     res = m_set;
00433 #endif
00434     return res;
00435 }

bool UPen::DeleteObject ( void )

Definition at line 394 of file udraw.cpp.

Referenced by CreatePen(), DrawNode(), CWinLogData::Update(), UBrush::~UBrush(), and ~UPen().

00395 {
00396     bool res = false;
00397 #if qGTK
00398     if(m_set)
00399     {
00400         m_set = false;
00401         GdkColormap *cmap = gdk_colormap_get_system();
00402         if(cmap != 0L)
00403         {
00404             gdk_colormap_free_colors(cmap, &m_col, 1);
00405             res = true;
00406         }
00407     }
00408     else
00409         res = true;
00410 #endif
00411     return res;
00412 }

Friends And Related Function Documentation

friend class UDC [friend]

Definition at line 479 of file udraw.h.

Member Data Documentation

int UPen::m_style [protected]

Definition at line 473 of file udraw.h.

int UPen::m_width [protected]

Definition at line 472 of file udraw.h.

The documentation for this class was generated from the following files:
  • rf/udraw.h
  • rf/udraw.cpp
Generated on Sun Oct 21 12:48:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPersistent Class Reference

#include <Persistent.h>

Inheritance diagram for CPersistent:

[legend]
Collaboration diagram for CPersistent:

[legend]
List of all members.

Public Methods

CPersistent (const char *uniqueName, kClassPersistent pclass)
virtual | ~CPersistent ()
virtual unsigned int | SizeOf (void) const=0L
virtual const void * | GetData (void) const=0L
virtual void | SetData (const void *ptr, unsigned int size)=0L
void | ResetTimeStamp ()
long | GetTimeStamp () const
void | TouchTimeStamp ()

Static Public Methods

void | SaveAll (void)
bool | LoadAll (void)
bool | SaveAllSettings (const char *settingFileName, const char *forPath)
CPersistentEntry * | Find (const char *uniqueName)
bool | NeedSave (bool onlySettings=false)

Protected Attributes

long | fTimeStamp

Static Protected Attributes

std::vector< CPersistentEntry > * | fAllEntries = 0L

Static Private Methods

void | Register (CPersistent *value, const char *uniqueName, kClassPersistent pclass)
void | UnRegister (CPersistent *value)

Constructor & Destructor Documentation

CPersistent::CPersistent | ( | const char * | uniqueName,
 |  | kClassPersistent | pclass
 | ) |

Definition at line 105 of file Persistent.cpp.

00105                                                                         : fTimeStamp(0)
00106 {
00107     Register(this, uniqueName, pclass);
00108     TouchTimeStamp();
00109 }

CPersistent::~CPersistent ( ) [virtual]

Definition at line 111 of file Persistent.cpp.

00112 {
00113     UnRegister(this);
00114 }

Member Function Documentation

CPersistent::CPersistentEntry * CPersistent::Find ( const char * instr ) [static]

Definition at line 634 of file Persistent.cpp.

Referenced by LoadAll(), CvsPrefs::WhichCvs(), and _loadPersistentSettings().

00635 {
00636     std::vector<CPersistentEntry>::iterator i;
00637     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00638     {
00639         CPersistentEntry & entry = *i;
00640         if(!strcmp(uniqueName, entry.fUniqueName))
00641             return &entry;
00642     }
00643     return 0L;
00644 }

virtual const void* CPersistent::GetData ( void ) const [pure virtual]

Reimplemented in PCPStr, PCStr, PMacBinMaps, TMPersistent, TMString, CPersistentT, CMMenuString, and CWinPlacement.

long CPersistent::GetTimeStamp ( ) const [inline]

Definition at line 73 of file Persistent.h.

00073 { return fTimeStamp; }

bool CPersistent::LoadAll ( void ) [static]

Definition at line 499 of file Persistent.cpp.

Referenced by CvsPrefs::load().

00500 {
00501 #ifdef macintosh
00502     FSSpec thePrefFile;
00503     short FRef, oldRef;
00504     Handle hdl;
00505     OSErr err;
00506
00507     err = GetPreferencesFile(thePrefFile);
00508     if(err != noErr)
00509         return false;
00510
00511     oldRef = CurResFile();
00512     FRef = FSpOpenResFile(&thePrefFile, fsRdPerm);
00513     if(FRef < 0)
00514         return false;
00515
00516     CPStr name;
00517     UseResFile(FRef);
00518
00519     std::vector<CPersistentEntry>::iterator i;
00520     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00521     {
00522         CPersistentEntry & entry = *i;
00523         name = entry.fUniqueName;
00524
00525         Handle hdl = Get1NamedResource(kCVS_prefID, name);
00526         if(hdl == 0L)
00527             continue;
00528
00529         HLock(hdl);
00530         entry.fValue->SetData(*hdl, GetHandleSize(hdl));
00531         entry.fValue->ResetTimeStamp();
00532         HUnlock(hdl);
00533     }
00534
00535     CloseResFile (FRef);
00536     UseResFile(oldRef);
00537     return true;
00538 #endif /* macintosh */
00539 #ifdef WIN32
00540     bool found_one = false;
00541     std::vector<CPersistentEntry>::iterator i;
00542     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00543     {
00544         CPersistentEntry & entry = *i;
00545         BYTE* ppData;
00546         UINT pBytes;
00547
00548         if(!AfxGetApp()->GetProfileBinary(PROFILE_NAME, entry.fUniqueName,
00549             &ppData, &pBytes))
00550         {
00551             continue;
00552         }
00553         found_one = true;
00554         entry.fValue->SetData(ppData, pBytes);
00555         entry.fValue->ResetTimeStamp();
00556         delete ppData;
00557     }
00558     return found_one;
00559 #endif /* WIN32 */
00560 #ifdef qUnix
00561     CStr home;
00562     home = gCvsPrefs.Home();
00563     if(!home.endsWith(kPathDelimiter))
00564         home << kPathDelimiter;
00565     home << ".gcvsrc";
00566     FILE *out = fopen(home, "rb");
00567     if(out == 0L)
00568         return false;
00569
00570     int version;
00571     int numEntries;
00572     CStaticAllocT<char> alloc;
00573
00574     fread(&version, sizeof(int), 1, out);
00575     if(version != 1)
00576     {
00577         cvs_err("Unexpected version %d in the file '%s'\n", version, (char *)home);
00578         goto close;
00579     }
00580     fread(&numEntries, sizeof(int), 1, out);
00581     if(numEntries < 0)
00582     {
00583         cvs_err("Unexpected # %d in the file '%s'\n", numEntries, (char *)home);
00584         goto close;
00585     }
00586     for(int i = 0; i < numEntries; i++)
00587     {
00588         CStr name;
00589         while(!feof(out) && !ferror(out))
00590         {
00591             int c = getc(out);
00592             name << (char)c;
00593             if(c == '\0')
00594                 break;
00595         }
00596         if(feof(out))
00597         {
00598             cvs_err("Unexpected end of file in '%s'\n", (char *)home);
00599             goto close;
00600         }
00601         if(ferror(out))
00602         {
00603             cvs_err("Unexpected error %d in '%s'\n", errno, (char *)home);
00604             goto close;
00605         }
00606         CPersistentEntry * entry = CPersistent::Find(name);
00607         if(entry == 0L)
00608         {
00609             cvs_err("Unexpected token '%s' in '%s'\n", (char *)name, (char *)home);
00610         }
00611
00612         unsigned int size;
00613         fread(&size, sizeof(unsigned int), 1, out);
00614
00615         alloc.AdjustSize(size);
00616         fread((char *)alloc, 1, size, out);
00617         if(entry != 0L)
00618         {
00619             entry->fValue->SetData((char *)alloc, size);
00620             entry->fValue->ResetTimeStamp();
00621         }
00622     }
00623
00624     if(ferror(out))
00625         cvs_err("Error while reading '%s' (error %d)", (char *)home, errno);
00626     fclose(out);
00627     return true;
00628 close:
00629     fclose(out);
00630 #endif /* qUnix */
00631     return false;
00632 }

bool CPersistent::NeedSave ( bool onlySettings = false ) [static]

Definition at line 646 of file Persistent.cpp.

Referenced by CvsPrefs::save().

00647 {
00648     std::vector<CPersistentEntry>::const_iterator i;
00649     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00650     {
00651         const CPersistentEntry & entry = *i;
00652         if(onlySettings && (entry.fClass & kAddSettings) == 0)
00653             continue;
00654
00655         if(entry.fValue->fTimeStamp != 0)
00656             return true;
00657     }
00658     return false;
00659 }

void CPersistent::Register | ( | CPersistent * | value,
 |  | const char * | uniqueName,
 |  | kClassPersistent | pclass
 | ) | [static, private]

Definition at line 116 of file Persistent.cpp.

00117 {
00118     std::vector<CPersistentEntry>::const_iterator i;
00119     if(fAllEntries == 0L)
00120         fAllEntries = NEW std::vector<CPersistentEntry>;
00121     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00122     {
00123         if(strcmp(uniqueName, (*i).fUniqueName) == 0)
00124         {
00125             UAppConsole("Error : duplicate persistent %s !\n", uniqueName);
00126         }
00127     }
00128     CPersistentEntry newentry;
00129     newentry.fClass = pclass;
00130     newentry.fUniqueName = uniqueName;
00131     newentry.fValue = value;
00132     fAllEntries->push_back(newentry);
00133 }

void CPersistent::ResetTimeStamp ( ) [inline]

Definition at line 72 of file Persistent.h.

00072 { fTimeStamp = 0; }

void CPersistent::SaveAll ( void ) [static]

Definition at line 384 of file Persistent.cpp.

Referenced by CvsPrefs::save().

00385 {
00386 #ifdef macintosh
00387     FSSpec thePrefFile;
00388     short FRef, oldRef;
00389     Handle hdl;
00390     OSErr err;
00391
00392     err = GetPreferencesFile(thePrefFile);
00393     if(err != noErr)
00394     {
00395         cvs_err("Error while searching preference folder (error %d)!\n", err);
00396         return;
00397     }
00398
00399     oldRef = CurResFile();
00400     err = ::FSpDelete(&thePrefFile);
00401     Assert_(err == noErr || err == fnfErr);
00402     ::FSpCreateResFile (&thePrefFile, 'mCVS', 'pref', smRoman);
00403     FRef = FSpOpenResFile(&thePrefFile, fsRdWrPerm);
00404     if(FRef < 0)
00405     {
00406         cvs_err("Error while saving preferences (error %d)!\n", ResError());
00407         return;
00408     }
00409
00410     UseResFile (FRef);
00411     CPStr name;
00412
00413     std::vector<CPersistentEntry>::iterator i;
00414     int resnum = 0;
00415     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00416     {
00417         CPersistentEntry & entry = *i;
00418         int size = entry.fValue->SizeOf();
00419         if(size <= 0)
00420             continue;
00421
00422         //short id = Unique1ID(kCVS_prefID);
00423         name = entry.fUniqueName;
00424
00425         Handle hdl = NewHandle(size);
00426         Assert_(hdl != 0L);
00427         HLock(hdl);
00428         BlockMove(entry.fValue->GetData(), *hdl, size);
00429         HUnlock(hdl);
00430         AddResource(hdl, kCVS_prefID, resnum++, name);
00431         Assert_(ResError() == noErr);
00432         UpdateResFile(FRef);
00433         Assert_(ResError() == noErr);
00434         ReleaseResource(hdl);
00435         Assert_(ResError() == noErr);
00436     }
00437
00438     UseResFile(oldRef);
00439     Assert_(ResError() == noErr);
00440     CloseResFile (FRef);
00441     Assert_(ResError() == noErr);
00442 #endif /* macintosh */
00443 #ifdef WIN32
00444     std::vector<CPersistentEntry>::iterator i;
00445     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00446     {
00447         CPersistentEntry & entry = *i;
00448         unsigned int size = entry.fValue->SizeOf();
00449         if(size == 0)
00450             continue;
00451
00452         if(!AfxGetApp()->WriteProfileBinary(PROFILE_NAME, entry.fUniqueName,
00453             (BYTE *)entry.fValue->GetData(), size))
00454         {
00455             cvs_err("Error while saving preferences !\n");
00456             break;
00457         }
00458     }
00459 #endif /* WIN32 */
00460 #ifdef qUnix
00461     CStr home;
00462     home = gCvsPrefs.Home();
00463     if(!home.endsWith(kPathDelimiter))
00464         home << kPathDelimiter;
00465     home << ".gcvsrc";
00466     FILE *out = fopen(home, "wb");
00467     if(out == 0L)
00468     {
00469         cvs_err("Unable to open '%s' for writing (error %d)", (char *)home, errno);
00470         return;
00471     }
00472     int version = 1;
00473     fwrite(&version, sizeof(int), 1, out);
00474     int numEntries = fAllEntries->size();
00475     fwrite(&numEntries, sizeof(int), 1, out);
00476     std::vector<CPersistentEntry>::iterator i;
00477     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00478     {
00479         CPersistentEntry & entry = *i;
00480         unsigned int size = entry.fValue->SizeOf();
00481
00482         fwrite(entry.fUniqueName, sizeof(char), strlen(entry.fUniqueName) + 1, out);
00483         fwrite(&size, sizeof(unsigned int), 1, out);
00484         fwrite(entry.fValue->GetData(), 1, size, out);
00485     }
00486
00487     if(ferror(out))
00488         cvs_err("Error while writing '%s' (error %d)", (char *)home, errno);
00489     fclose(out);
00490 #endif /* qUnix */
00491
00492     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00493     {
00494         CPersistentEntry & entry = *i;
00495         entry.fValue->ResetTimeStamp();
00496     }
00497 }

bool CPersistent::SaveAllSettings | ( | const char * | settingFileName,
 |  | const char * | forPath
 | ) | [static]

Definition at line 299 of file Persistent.cpp.

Referenced by SaveAsPersistentSettings(), and SavePersistentSettings().

00300 {
00301     UStr tmpSettingsFile(settingFileName);
00302     tmpSettingsFile << "__";
00303     FILE *fd = fopen(tmpSettingsFile, "w");
00304     if(fd == 0L)
00305     {
00306         cvs_err("Failed to open the setting file '%s' for writing (error %d)",
00307             (const char *)tmpSettingsFile, errno);
00308         return false;
00309     }
00310
00311     fprintf(fd, "VERSION=%d\n", 1);
00312
00313     UStr path(forPath);
00314     if(path.endsWith(kPathDelimiter))
00315         path[path.length() - 1] = '\0';
00316     fprintf(fd, "PATH=%s\n", (const char *)path);
00317
00318     fprintf(fd, "AUTHENTICATION=%s\n",
00319         (const char *)Authen::kindToToken(gAuthen.kind()));
00320
00321     fprintf(fd, "CVSROOT=%s\n", (const char *)gCvsPrefs);
00322
00323     std::vector<CPersistentEntry>::const_iterator i;
00324     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00325     {
00326         const CPersistentEntry & entry = *i;
00327         if((entry.fClass & kAddSettings) == 0)
00328             continue;
00329
00330         if(entry.fValue->IsKindOf(URUNTIME_CLASS(CPersistentBool)))
00331         {
00332             CPersistentBool *pbool = (CPersistentBool *)entry.fValue;
00333             bool state = *pbool;
00334             fprintf(fd, "%s=%s\n", entry.fUniqueName, state ? "true" : "false");
00335         }
00336         else if(entry.fValue->IsKindOf(URUNTIME_CLASS(CPersistentInt)))
00337         {
00338             CPersistentInt *pint = (CPersistentInt *)entry.fValue;
00339             int val = *pint;
00340             fprintf(fd, "%s=%d\n", entry.fUniqueName, val);
00341         }
00342         else if(entry.fValue->IsKindOf(URUNTIME_CLASS(PCStr)))
00343         {
00344             PCStr *pstr = (PCStr *)entry.fValue;
00345             const char *str = *pstr;
00346             fprintf(fd, "%s=%s\n", entry.fUniqueName, (const char *)(str == 0L ? "" : str));
00347         }
00348         else if(entry.fValue->IsKindOf(URUNTIME_CLASS(PCPStr)))
00349         {
00350             PCPStr *pstr = (PCPStr *)entry.fValue;
00351             const char *str = *pstr;
00352             fprintf(fd, "%s=%s\n", entry.fUniqueName, (const char *)(str == 0L ? "" : str));
00353         }
00354         else
00355         {
00356             cvs_err("Unknown persistent value '%s'\n", entry.fUniqueName);
00357         }
00358     }
00359     fclose(fd);
00360
00361     if(simple_diff(tmpSettingsFile, settingFileName) == 0)
00362     {
00363         if(unlink(tmpSettingsFile) != 0 && errno != ENOENT)
00364             cvs_err("Could not remove file '%s' (error %d)\n", (const char *)tmpSettingsFile, errno);
00365
00366         return false;
00367     }
00368
00369     if(unlink(settingFileName) != 0 && errno != ENOENT)
00370     {
00371         cvs_err("Could not remove file '%s' (error %d)\n", (const char *)settingFileName, errno);
00372         return false;
00373     }
00374
00375     if(rename(tmpSettingsFile, settingFileName) != 0)
00376     {
00377         cvs_err("Could not rename file '%s' (error %d)\n", (const char *)tmpSettingsFile, errno);
00378         return false;
00379     }
00380
00381     return true;
00382 }

virtual void CPersistent::SetData | ( | const void * | ptr,
 |  | unsigned int | size
 | ) | [pure virtual]

Reimplemented in PCPStr, PCStr, PMacBinMaps, TMPersistent, TMString, CPersistentT, CMMenuString, and CWinPlacement.

virtual unsigned int CPersistent::SizeOf ( void ) const [pure virtual]

Reimplemented in PCPStr, PCStr, PMacBinMaps, TMPersistent, TMString, CPersistentT, CMMenuString, and CWinPlacement.

Referenced by TMPersistent::GetData().

void CPersistent::TouchTimeStamp ( ) [inline]

Definition at line 74 of file Persistent.h.

Referenced by CMMenuString::GetList(), CMMenuString::Insert(), TMString::Insert(), TMString::Remove(), CWinPlacement::operator=(), and PCStr::operator=().

00074 { fTimeStamp++; }

void CPersistent::UnRegister ( CPersistent * value ) [static, private]

Definition at line 135 of file Persistent.cpp.

Referenced by ~CPersistent().

00136 {
00137     std::vector<CPersistentEntry>::iterator i;
00138     for(i = fAllEntries->begin(); i != fAllEntries->end(); ++i)
00139     {
00140         if(value == (*i).fValue)
00141             break;
00142     }
00143
00144     if(i == fAllEntries->end())
00145     {
00146         UAppConsole("Error : Unknown persistent value !\n");
00147         return;
00148     }
00149
00150     fAllEntries->erase(i);
00151     if(fAllEntries->size() == 0)
00152     {
00153         delete fAllEntries;
00154         fAllEntries = 0L;
00155     }
00156 }

Member Data Documentation

std::vector< CPersistent::CPersistentEntry > * CPersistent::fAllEntries = 0L [static, protected]

Definition at line 97 of file Persistent.cpp.

long CPersistent::fTimeStamp [protected]

Definition at line 85 of file Persistent.h.

The documentation for this class was generated from the following files:
  • common/Persistent.h
  • common/Persistent.cpp
Generated on Sun Oct 21 12:48:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPersistent::CPersistentEntry Struct Reference

#include <Persistent.h>

Collaboration diagram for CPersistent::CPersistentEntry:

[legend]
List of all members.

Public Attributes

const char * fUniqueName
CPersistent * fValue
kClassPersistent fClass

Member Data Documentation

kClassPersistent CPersistent::CPersistentEntry::fClass

Definition at line 66 of file Persistent.h.

const char* CPersistent::CPersistentEntry::fUniqueName

Definition at line 64 of file Persistent.h.

Referenced by _loadPersistentSettings().

CPersistent* CPersistent::CPersistentEntry::fValue

Definition at line 65 of file Persistent.h.

Referenced by _loadPersistentSettings().

The documentation for this struct was generated from the following file:
  • common/Persistent.h
Generated on Sun Oct 21 12:48:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPersistentBool Class Reference

#include <Persistent.h>

Inheritance diagram for CPersistentBool:

[legend]
Collaboration diagram for CPersistentBool:

[legend]
List of all members.

Public Methods

CPersistentBool (const char *uniqueName, bool defValue, kClassPersistent pclass=kNoClass)
virtual | ~CPersistentBool ()
operator const bool & () const
const bool * | operator-> () const
bool & | operator= (const bool &val)
bool | operator== (const bool &val) const

Constructor & Destructor Documentation

CPersistentBool::CPersistentBool | ( | const char * | uniqueName,
 |  | bool | defValue,
 |  | kClassPersistent | pclass = kNoClass
 | ) | [inline]

Definition at line 127 of file Persistent.h.

00128                                             :
00129       CPersistentT<bool>(uniqueName, defValue, pclass)
00130     {
00131     }

virtual CPersistentBool::~CPersistentBool ( ) [inline, virtual]

Definition at line 132 of file Persistent.h.

00133     {
00134     }

Member Function Documentation

CPersistentBool::operator const bool & ( ) const [inline]

Definition at line 136 of file Persistent.h.

00139 : public CPersistentT<int>

const bool* CPersistentBool::operator-> ( ) const [inline]

Reimplemented from CPersistentT.

Definition at line 136 of file Persistent.h.

00139 : public CPersistentT<int>

bool& CPersistentBool::operator= ( const bool & val ) [inline]

Definition at line 136 of file Persistent.h.

00139 : public CPersistentT<int>

bool CPersistentBool::operator== ( const bool & val ) const [inline]

Definition at line 136 of file Persistent.h.

00139 : public CPersistentT<int>

The documentation for this class was generated from the following file:
  • common/Persistent.h
Generated on Sun Oct 21 12:48:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPersistentInt Class Reference

#include <Persistent.h>

Inheritance diagram for CPersistentInt:

[legend]
Collaboration diagram for CPersistentInt:

[legend]
List of all members.

Public Methods

CPersistentInt (const char *uniqueName, int defValue, kClassPersistent pclass=kNoClass)
virtual | ~CPersistentInt ()
operator const int & () const
const int * | operator-> () const
int & | operator= (const int &val)
bool | operator== (const int &val) const

Constructor & Destructor Documentation

CPersistentInt::CPersistentInt | ( | const char * | uniqueName,
 |  | int | defValue,
 |  | kClassPersistent | pclass = kNoClass
 | ) | [inline]

Definition at line 143 of file Persistent.h.

00144                                             :
00145             CPersistentT<int>(uniqueName, defValue, pclass)
00146     {
00147     }

virtual CPersistentInt::~CPersistentInt ( ) [inline, virtual]

Definition at line 148 of file Persistent.h.

00149     {
00150     }

Member Function Documentation

CPersistentInt::operator const int & ( ) const [inline]

Definition at line 152 of file Persistent.h.

const int* CPersistentInt::operator-> ( ) const [inline]

Reimplemented from CPersistentT.

Definition at line 152 of file Persistent.h.

int& CPersistentInt::operator= ( const int & val ) [inline]

Definition at line 152 of file Persistent.h.

bool CPersistentInt::operator== ( const int & val ) const [inline]

Definition at line 152 of file Persistent.h.

The documentation for this class was generated from the following file:
  • common/Persistent.h
Generated on Sun Oct 21 12:48:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TemplateCPersistentT class Reference

CPersistentT Class Template Reference

#include <Persistent.h>

Inheritance diagram for CPersistentT:

[legend]
Collaboration diagram for CPersistentT:

[legend]
List of all members.

Public Methods

CPersistentT (const char *uniqueName, T defValue, kClassPersistent pclass)
virtual | ~CPersistentT ()
operator const T & () const
const T * | operator-> () const
T & | operator= (const T &val)
bool | operator== (const T &val) const
virtual unsigned int | SizeOf (void) const
virtual const void * | GetData (void) const
virtual void | SetData (const void *ptr, unsigned int size)

Protected Attributes

T | fDefValue
T | fValue

template<class T>
class CPersistentT< T >

Constructor & Destructor Documentation

template<class T>
CPersistentT< T >::CPersistentT | ( | const char * | uniqueName,
 |  | T | defValue,
 |  | kClassPersistent | pclass
 | ) | [inline]

Definition at line 101 of file Persistent.h.

00101                                                                               : CPersistent(uniqueName, pclass)
00102     {
00103         fValue = fDefValue = defValue;
00104     }

template<class T>
virtual CPersistentT< T >::~CPersistentT ( ) [inline, virtual]

Definition at line 105 of file Persistent.h.

00106     {
00107     }

Member Function Documentation

template<class T>
virtual const void* CPersistentT< T >::GetData ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 112 of file Persistent.h.

00112 {return &fValue;}

template<class T>
virtual void CPersistentT< T >::SetData | ( | const void * | ptr,
 |  | unsigned int | size
 | ) | [inline, virtual]

Reimplemented from CPersistent.

Definition at line 113 of file Persistent.h.

00114     {
00115         if(size == sizeof(T))
00116             memcpy(&fValue, ptr, size);
00117     }

template<class T>
virtual unsigned int CPersistentT< T >::SizeOf ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 111 of file Persistent.h.

00111 {return sizeof(T);}

template<class T>
CPersistentT< T >::operator const T & ( ) const [inline]

Definition at line 109 of file Persistent.h.

00111 {return sizeof(T);}

template<class T>
const T* CPersistentT< T >::operator-> ( ) const [inline]

Reimplemented in CPersistentBool, and CPersistentInt.

Definition at line 109 of file Persistent.h.

00111 {return sizeof(T);}

template<class T>
T& CPersistentT< T >::operator= ( const T & val ) [inline]

Definition at line 109 of file Persistent.h.

00111 {return sizeof(T);}

template<class T>
bool CPersistentT< T >::operator== ( const T & val ) const [inline]

Definition at line 109 of file Persistent.h.

00111 {return sizeof(T);}

Member Data Documentation

template<class T>
T CPersistentT::fDefValue [protected]

Definition at line 120 of file Persistent.h.

template<class T>
T CPersistentT::fValue [protected]

Definition at line 120 of file Persistent.h.

The documentation for this class was generated from the following file:
  • common/Persistent.h
Generated on Sun Oct 21 12:48:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


pid_list Struct Reference

Collaboration diagram for pid_list:

[legend]
List of all members.

Public Attributes

HFILE | pid
ULONG | term_code
pid_list * | next

Member Data Documentation

struct pid_list* pid_list::next

Definition at line 38 of file popen.c.

Referenced by ll_delete().

HFILE pid_list::pid

Definition at line 36 of file popen.c.

Referenced by ll_insert().

ULONG pid_list::term_code

Definition at line 37 of file popen.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/os2/popen.c
Generated on Sun Oct 21 12:48:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PIPE Struct Reference

Collaboration diagram for PIPE:

[legend]
List of all members.

Public Attributes

PIPE * | next
PIPE * | prev
PIPE * | self
int | mode
long | status
IOSB iosb
FILE * | file
int | pid
short | chan
jmp_buf | jmpbuf
int | has_jmpbuf

Member Data Documentation

short PIPE::chan

Definition at line 71 of file pipe.c.

FILE* PIPE::file

Definition at line 69 of file pipe.c.

int PIPE::has_jmpbuf

Definition at line 73 of file pipe.c.

struct IOSB PIPE::iosb

Definition at line 68 of file pipe.c.

jmp_buf PIPE::jmpbuf

Definition at line 72 of file pipe.c.

int PIPE::mode

Definition at line 66 of file pipe.c.

struct PIPE* PIPE::next

Definition at line 63 of file pipe.c.

int PIPE::pid

Definition at line 70 of file pipe.c.

struct PIPE* PIPE::prev

Definition at line 64 of file pipe.c.

struct PIPE* PIPE::self

Definition at line 65 of file pipe.c.

long PIPE::status

Definition at line 67 of file pipe.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/pipe.c
Generated on Sun Oct 21 12:48:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PMacBinMaps Class Reference

Inheritance diagram for PMacBinMaps:

[legend]
Collaboration diagram for PMacBinMaps:

[legend]
List of all members.

Public Methods

PMacBinMaps (const char *uniqueName)
virtual | ~PMacBinMaps ()
virtual unsigned int | SizeOf (void) const
virtual const void * | GetData (void) const
virtual void | SetData (const void *ptr, unsigned int size)

Constructor & Destructor Documentation

PMacBinMaps::PMacBinMaps ( const char * uniqueName ) [inline]

Definition at line 39 of file MacBinMaps.cpp.

00039                                         : CPersistent(uniqueName, kNoClass)
00040     {
00041         if(entries != 0L)
00042         {
00043             free(entries);
00044             entries = 0L;
00045         }
00046     }

virtual PMacBinMaps::~PMacBinMaps ( ) [inline, virtual]

Definition at line 48 of file MacBinMaps.cpp.

00049     {
00050     }

Member Function Documentation

virtual const void* PMacBinMaps::GetData ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 59 of file MacBinMaps.cpp.

00060     {
00061         return entries;
00062     }

virtual void PMacBinMaps::SetData | ( | const void * | ptr,
 |  | unsigned int | size
 | ) | [inline, virtual]

Reimplemented from CPersistent.

Definition at line 63 of file MacBinMaps.cpp.

00064     {
00065         if(entries != 0L)
00066         {
00067             free(entries);
00068             entries = 0L;
00069         }
00070
00071         if(size < sizeof(int))
00072             return;
00073         MACBINMAPENTRIES *newEntries = (MACBINMAPENTRIES *)ptr;
00074         if((sizeof(MACBINMAPENTRIES) + (newEntries->numMaps - 1) * sizeof(MACBINMAP)) != size)
00075             return;
00076
00077         entries = (MACBINMAPENTRIES *)malloc(size);
00078         if(entries == 0L)
00079             return;
00080
00081         memcpy(entries, ptr, size);
00082     }

virtual unsigned int PMacBinMaps::SizeOf ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 52 of file MacBinMaps.cpp.

00053     {
00054         if(entries == 0L)
00055             return 0;
00056         return sizeof(MACBINMAPENTRIES) + (entries->numMaps - 1) * sizeof(MACBINMAP);
00057     }

The documentation for this class was generated from the following file:
  • common/MacBinMaps.cpp
Generated on Sun Oct 21 12:49:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPoint Class Reference

#include <udraw.h>

Inheritance diagram for UPoint:

[legend]
Collaboration diagram for UPoint:

[legend]
List of all members.

Public Methods

UPoint ()
UPoint (int initX, int initY)
UPoint (UPOINT initPt)
UPoint (USIZE initSize)
void | Offset (int xOffset, int yOffset)
void | Offset (UPOINT point)
void | Offset (USIZE size)
bool | operator== (UPOINT point) const
bool | operator!= (UPOINT point) const
void | operator+= (USIZE size)
void | operator-= (USIZE size)
void | operator+= (UPOINT point)
void | operator-= (UPOINT point)
UPoint | operator+ (USIZE size) const
UPoint | operator- (USIZE size) const
UPoint | operator- () const
UPoint | operator+ (UPOINT point) const
USize | operator- (UPOINT point) const
URect | operator+ (const URECT *lpRect) const
URect | operator- (const URECT *lpRect) const

Constructor & Destructor Documentation

UPoint::UPoint ( ) [inline]

Definition at line 282 of file udraw.h.

Referenced by operator+(), and operator-().

00283     { /* random filled */ }

UPoint::UPoint | ( | int | initX,
 |  | int | initY
 | ) | [inline]

Definition at line 284 of file udraw.h.

00285     { x = initX; y = initY; }

UPoint::UPoint ( UPOINT initPt ) [inline]

Definition at line 286 of file udraw.h.

00287     { *(UPOINT*)this = initPt; }

UPoint::UPoint ( USIZE initSize ) [inline]

Definition at line 288 of file udraw.h.

00289     { *(USIZE*)this = initSize; }

Member Function Documentation

void UPoint::Offset ( USIZE size ) [inline]

Definition at line 294 of file udraw.h.

00295     { x += size.cx; y += size.cy; }

void UPoint::Offset ( UPOINT point ) [inline]

Definition at line 292 of file udraw.h.

00293     { x += point.x; y += point.y; }

void UPoint::Offset | ( | int | xOffset,
 |  | int | yOffset
 | ) | [inline]

Definition at line 290 of file udraw.h.

00291     { x += xOffset; y += yOffset; }

bool UPoint::operator!= ( UPOINT point ) const [inline]

Definition at line 298 of file udraw.h.

00299     { return (x != point.x || y != point.y); }

URect UPoint::operator+ ( const URECT * lpRect ) const [inline]

Definition at line 318 of file udraw.h.

00319     { return URect(lpRect) + *this; }

UPoint UPoint::operator+ ( UPOINT point ) const [inline]

Definition at line 314 of file udraw.h.

00315     { return UPoint(x + point.x, y + point.y); }

UPoint UPoint::operator+ ( USIZE size ) const [inline]

Definition at line 308 of file udraw.h.

00309     { return UPoint(x + size.cx, y + size.cy); }

void UPoint::operator+= ( UPOINT point ) [inline]

Definition at line 304 of file udraw.h.

00305     { x += point.x; y += point.y; }

void UPoint::operator+= ( USIZE size ) [inline]

Definition at line 300 of file udraw.h.

00301     { x += size.cx; y += size.cy; }

URect UPoint::operator- ( const URECT * lpRect ) const [inline]

Definition at line 320 of file udraw.h.

00321     { return URect(lpRect) - *this; }

USize UPoint::operator- ( UPOINT point ) const [inline]

Definition at line 316 of file udraw.h.

00317     { return USize(x - point.x, y - point.y); }

UPoint UPoint::operator- ( ) const [inline]

Definition at line 312 of file udraw.h.

00313     { return UPoint(-x, -y); }

UPoint UPoint::operator- ( USIZE size ) const [inline]

Definition at line 310 of file udraw.h.

00311     { return UPoint(x - size.cx, y - size.cy); }

void UPoint::operator-= ( UPOINT point ) [inline]

Definition at line 306 of file udraw.h.

00307     { x -= point.x; y -= point.y; }

void UPoint::operator-= ( USIZE size ) [inline]

Definition at line 302 of file udraw.h.

00303     { x -= size.cx; y -= size.cy; }

bool UPoint::operator== ( UPOINT point ) const [inline]

Definition at line 296 of file udraw.h.

00297     { return (x == point.x && y == point.y); }

The documentation for this class was generated from the following file:
  • rf/udraw.h
Generated on Sun Oct 21 12:49:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPOINT Struct Reference

#include <umain.h>

Inheritance diagram for UPOINT:

[legend]
Collaboration diagram for UPOINT:

[legend]
List of all members.

Public Attributes

int | x
int | y

Member Data Documentation

int UPOINT::x

Definition at line 904 of file umain.h.

Referenced by CWinLogData::ComputeBounds(), UDC::DrawBitmap(), UPoint::Offset(), URect::OffsetRect(), UWidget::OnSetLoc(), PtInRect(), URect::SetRect(), URect::URect(), CWinLogData::Update(), CWinLogBranchData::UpdateSelf(), CWinLogTagData::UpdateSelf(), CWinLogRevData::UpdateSelf(), CWinLogHeaderData::UpdateSelf(), UPoint::operator!=(), URect::operator+(), UPoint::operator+(), USize::operator+(), URect::operator+=(), UPoint::operator+=(), URect::operator-(), UPoint::operator-(), USize::operator-(), URect::operator-=(), UPoint::operator-=(), and UPoint::operator==().

int UPOINT::y

Definition at line 904 of file umain.h.

Referenced by CWinLogData::ComputeBounds(), UDC::DrawBitmap(), UPoint::Offset(), URect::OffsetRect(), UWidget::OnSetLoc(), PtInRect(), URect::SetRect(), URect::URect(), CWinLogData::Update(), CWinLogBranchData::UpdateSelf(), CWinLogTagData::UpdateSelf(), CWinLogRevData::UpdateSelf(), CWinLogHeaderData::UpdateSelf(), UPoint::operator!=(), URect::operator+(), UPoint::operator+(), USize::operator+(), URect::operator+=(), UPoint::operator+=(), URect::operator-(), UPoint::operator-(), USize::operator-(), URect::operator-=(), UPoint::operator-=(), and UPoint::operator==().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:49:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


poolRec Struct Reference

Collaboration diagram for poolRec:

[legend]
List of all members.

Public Attributes

frameRec * firstentry
frameRec * firstfree
DYN_LIST * pool

Member Data Documentation

frameRec* poolRec::firstentry

Definition at line 292 of file dll_garbage.c.

frameRec* poolRec::firstfree

Definition at line 293 of file dll_garbage.c.

DYN_LIST* poolRec::pool

Definition at line 294 of file dll_garbage.c.

The documentation for this struct was generated from the following file:
  • common/dll_garbage.c
Generated on Sun Oct 21 12:49:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPPMenu Class Reference

Inheritance diagram for UPPMenu:

[legend]
Collaboration diagram for UPPMenu:

[legend]
List of all members.

Public Methods

UPPMenu ()
virtual | ~UPPMenu ()

Static Public Attributes

int | sPPMenuWidID = -1

Constructor & Destructor Documentation

UPPMenu::UPPMenu ( )

Definition at line 716 of file UPseudoSupport.cpp.

00716                  : UMenu(::UEventGetWidID())
00717 {
00718     sPPMenuWidID = GetWidID();
00719 }

UPPMenu::~UPPMenu ( ) [virtual]

Definition at line 721 of file UPseudoSupport.cpp.

00722 {
00723 }

Member Data Documentation

int UPPMenu::sPPMenuWidID = -1 [static]

Definition at line 714 of file UPseudoSupport.cpp.

The documentation for this class was generated from the following file:
  • rf/support/powerplant/UPseudoSupport.cpp
Generated on Sun Oct 21 12:49:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CProgress Class Reference

#include <ProgressDialog.h>

Collaboration diagram for CProgress:

[legend]
List of all members.

Public Methods

CProgress (bool interruptable, const char *title=0L)
~CProgress ()
bool | HasAborted (void) const
void | SetProgress (int percent)
void | DoAbort (void)

Protected Attributes

CProgressDialog * m_dlg
bool | m_abort

Constructor & Destructor Documentation

CProgress::CProgress | ( | bool | interruptable,
 |  | const char * | title = 0L
 | ) |

Definition at line 101 of file ProgressDialog.cpp.

00101                                                           : m_dlg(0L), m_abort(false)
00102 {
00103     m_dlg = new CProgressDialog(m_abort, interruptable);
00104     if (!m_dlg->Create())
00105     {
00106         TRACE0("Failed to create DlgBar\n");
00107         delete m_dlg;
00108         m_dlg = 0L;
00109         return;      // fail to create
00110     }
00111     if(title != 0L)
00112         m_dlg->SetWindowText(title);
00113     ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
00114 }

CProgress::~CProgress ( )

Definition at line 116 of file ProgressDialog.cpp.

00117 {
00118     if(m_dlg != 0L)
00119         m_dlg->DestroyWindow();
00120 }

Member Function Documentation

void CProgress::DoAbort ( void )

Definition at line 134 of file ProgressDialog.cpp.

00135 {
00136     if(m_dlg != 0L)
00137         m_dlg->DestroyWindow();
00138     m_dlg = 0L;
00139 }

bool CProgress::HasAborted ( void ) const [inline]

Definition at line 19 of file ProgressDialog.h.

Referenced by CGraphView::OnViewDelrev().

00019 { return m_abort; }

void CProgress::SetProgress ( int percent )

Definition at line 122 of file ProgressDialog.cpp.

Referenced by CGraphView::OnViewDelrev().

00123 {
00124     if(m_dlg == 0L)
00125         return;
00126
00127     m_dlg->m_progress.SetPos(percent);
00128     flushDisplay(m_dlg, m_abort);
00129     ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
00130     if(m_abort)
00131         m_dlg = 0L;
00132 }

Member Data Documentation

bool CProgress::m_abort [protected]

Definition at line 25 of file ProgressDialog.h.

CProgressDialog* CProgress::m_dlg [protected]

Definition at line 24 of file ProgressDialog.h.

The documentation for this class was generated from the following files:
  • WinCvs/ProgressDialog.h
  • WinCvs/ProgressDialog.cpp
Generated on Sun Oct 21 12:49:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CProgressDialog Class Reference

#include <ProgressDialog.h>

Inheritance diagram for CProgressDialog:

[legend]
Collaboration diagram for CProgressDialog:

[legend]
List of all members.

Public Types

enum | { IDD = IDD_PROGRESS }

Public Methods

CProgressDialog (bool &abort, bool interruptable, CWnd *pParent=NULL)
BOOL | Create ()

Public Attributes

CProgressCtrl | m_progress

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | PostNcDestroy ()
virtual void | OnOK ()
virtual BOOL | OnInitDialog ()

Protected Attributes

CWnd * m_pParent
bool & | m_abort
bool | m_stopable
HWND | hWndParent

Member Enumeration Documentation

anonymous enum

Enumeration values:
IDD

Definition at line 40 of file ProgressDialog.h.

00040 { IDD = IDD_PROGRESS };

Constructor & Destructor Documentation

CProgressDialog::CProgressDialog | ( | bool & | abort,
 |  | bool | interruptable,
 |  | CWnd * | pParent = NULL
 | ) |

Definition at line 18 of file ProgressDialog.cpp.

00019     : m_abort(abort), m_stopable(interruptable), m_pParent(pParent), hWndParent(0L),
00020     CDialog(CProgressDialog::IDD, pParent)
00021 {
00022     //{{AFX_DATA_INIT(CProgressDialog)
00023         // NOTE: the ClassWizard will add member initialization here
00024     //}}AFX_DATA_INIT
00025 }

Member Function Documentation

BOOL CProgressDialog::Create ( )

Definition at line 78 of file ProgressDialog.cpp.

Referenced by CProgress::CProgress().

00079 {
00080     hWndParent = PreModal();
00081     return CDialog::Create(CProgressDialog::IDD, m_pParent);
00082 }

void CProgressDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 28 of file ProgressDialog.cpp.

00029 {
00030     CDialog::DoDataExchange(pDX);
00031     //{{AFX_DATA_MAP(CProgressDialog)
00032     DDX_Control(pDX, IDC_PROGRESS, m_progress);
00033     //}}AFX_DATA_MAP
00034 }

BOOL CProgressDialog::OnInitDialog ( ) [protected, virtual]

Definition at line 62 of file ProgressDialog.cpp.

00063 {
00064     CenterWindow();
00065
00066     CDialog::OnInitDialog();
00067
00068     CWnd *wnd = GetDlgItem(IDOK);
00069     if(wnd != 0L && !m_stopable)
00070     {
00071         wnd->EnableWindow(FALSE);
00072     }
00073     ShowWindow(SW_SHOW);
00074
00075     return TRUE;  // return TRUE unless you set the focus to a control
00076 }

void CProgressDialog::OnOK ( void ) [protected, virtual]

Definition at line 56 of file ProgressDialog.cpp.

00057 {
00058     m_abort = true;
00059     DestroyWindow();
00060 }

void CProgressDialog::PostNcDestroy ( ) [protected, virtual]

Definition at line 45 of file ProgressDialog.cpp.

00046 {
00047     MSG msg;
00048     if (hWndParent != NULL && ::GetActiveWindow() == m_hWnd)
00049         ::SetActiveWindow(hWndParent);
00050     PostModal();
00051     while (PeekMessage(&msg, m_hWnd, 0, 0, PM_NOREMOVE) == TRUE)
00052         AfxGetApp()->PumpMessage();
00053     delete this;
00054 }

Member Data Documentation

HWND CProgressDialog::hWndParent [protected]

Definition at line 59 of file ProgressDialog.h.

bool& CProgressDialog::m_abort [protected]

Definition at line 57 of file ProgressDialog.h.

CWnd* CProgressDialog::m_pParent [protected]

Definition at line 56 of file ProgressDialog.h.

CProgressCtrl CProgressDialog::m_progress

Definition at line 41 of file ProgressDialog.h.

Referenced by CProgress::SetProgress().

bool CProgressDialog::m_stopable [protected]

Definition at line 58 of file ProgressDialog.h.

The documentation for this class was generated from the following files:
  • WinCvs/ProgressDialog.h
  • WinCvs/ProgressDialog.cpp
Generated on Sun Oct 21 12:49:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPromptMessage Class Reference

Inheritance diagram for UPromptMessage:

[legend]
Collaboration diagram for UPromptMessage:

[legend]
List of all members.

Public Types

enum | { kOK = EV_COMMAND_START, kCancel, kMsg }

Public Methods

UPromptMessage (const char *msg, const char *title, const char *def, const char *cncl)
virtual | ~UPromptMessage ()
virtual void | DoDataExchange (bool fill)
while modaling, allows to fill/read the dialog content.
  • fill says if it expects to fill or read the dialog content.
 More...

Protected Methods

int | OnOK (void)
int | OnCancel (void)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

UStr m_msg
UStr m_title
UStr m_ok
UStr m_cncl

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

anonymous enum

Enumeration values:
kOK
kCancel
kMsg

Definition at line 130 of file AskYesNo.cpp.

00131     {
00132         kOK = EV_COMMAND_START, // 0
00133         kCancel,                // 1
00134         kMsg                    // 2
00135     };

Constructor & Destructor Documentation

UPromptMessage::UPromptMessage | ( | const char * | msg,
 |  | const char * | title,
 |  | const char * | def,
 |  | const char * | cncl
 | ) | [inline]

Definition at line 122 of file AskYesNo.cpp.

00123                           : UWidget(UEventGetWidID()), m_msg(msg), m_title(title),
00124         m_ok(def), m_cncl(cncl)
00125     {
00126     }

virtual UPromptMessage::~UPromptMessage ( ) [inline, virtual]

Definition at line 128 of file AskYesNo.cpp.

00128 {}

Member Function Documentation

virtual void UPromptMessage::DoDataExchange ( bool fill ) [inline, virtual]

while modaling, allows to fill/read the dialog content.

  • fill says if it expects to fill or read the dialog content.

Reimplemented from UWidget.

Reimplemented in UEditMessage.

Definition at line 137 of file AskYesNo.cpp.

Referenced by UEditMessage::DoDataExchange().

00138     {
00139         if(fill)
00140         {
00141             UEventSendMessage(GetWidID(), EV_SETTEXT, kOK, (void *)m_ok.c_str());
00142             UEventSendMessage(GetWidID(), EV_SETTEXT, kUMainWidget, (void *)m_title.c_str());
00143             UEventSendMessage(GetWidID(), EV_SETTEXT, kCancel, (void *)m_cncl.c_str());
00144             UEventSendMessage(GetWidID(), EV_SETTEXT, kMsg, (void *)m_msg.c_str());
00145         }
00146         else
00147         {
00148         }
00149     }

const UMSGMAP* UPromptMessage::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

Reimplemented in UEditMessage.

virtual const UMSGMAP* UPromptMessage::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

Reimplemented in UEditMessage.

const UMSGMAP* UPromptMessage::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

Reimplemented in UEditMessage.

int UPromptMessage::OnCancel ( void ) [protected]

Definition at line 173 of file AskYesNo.cpp.

00174 {
00175     EndModal(false);
00176     return 0;
00177 }

int UPromptMessage::OnOK ( void ) [protected]

Definition at line 167 of file AskYesNo.cpp.

00168 {
00169     EndModal(true);
00170     return 0;
00171 }

Member Data Documentation

const UMSGMAP_ENTRY UPromptMessage::_messageEntries[] [static, private]

Reimplemented from UWidget.

Reimplemented in UEditMessage.

Definition at line 157 of file AskYesNo.cpp.

UStr UPromptMessage::m_cncl [protected]

Definition at line 152 of file AskYesNo.cpp.

UStr UPromptMessage::m_msg [protected]

Definition at line 152 of file AskYesNo.cpp.

UStr UPromptMessage::m_ok [protected]

Definition at line 152 of file AskYesNo.cpp.

UStr UPromptMessage::m_title [protected]

Definition at line 152 of file AskYesNo.cpp.

const UMSGMAP UPromptMessage::messageMap [static, protected]

Reimplemented from UWidget.

Reimplemented in UEditMessage.

Definition at line 157 of file AskYesNo.cpp.

The documentation for this class was generated from the following file:
  • common/AskYesNo.cpp
Generated on Sun Oct 21 12:49:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPropertySheet Class Reference

Inheritance diagram for CPropertySheet:

[legend]
The documentation for this class was generated from the following file:
  • common/OptionalPropertySheet.h
Generated on Sun Oct 21 12:49:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPseudoButton Class Reference

#include <PseudoButton.h>

Inheritance diagram for CPseudoButton:

[legend]
Collaboration diagram for CPseudoButton:

[legend]
List of all members.

Public Methods

CPseudoButton ()
virtual bool | LoadXPM (int rsrcid)
virtual void | DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
virtual | ~CPseudoButton ()

Static Public Methods

bool | loadIcon (CString &icon, int rsrcid)

Protected Methods

virtual void | DrawButtonBitmap (CDC *pDC, UINT nState, CRect &rcItem)

Protected Attributes

HBITMAP m_bitmap
HBITMAP m_disbitmap

Constructor & Destructor Documentation

CPseudoButton::CPseudoButton ( )

Definition at line 41 of file PseudoButton.cpp.

00041                              : m_bitmap(0L), m_disbitmap(0L)
00042 {
00043 }

CPseudoButton::~CPseudoButton ( ) [virtual]

Definition at line 45 of file PseudoButton.cpp.

00046 {
00047     if(m_bitmap != 0L)
00048         AfxDeleteObject((HGDIOBJ*)&m_bitmap);
00049     if(m_disbitmap != 0L)
00050         AfxDeleteObject((HGDIOBJ*)&m_disbitmap);
00051 }

Member Function Documentation

void CPseudoButton::DrawButtonBitmap | ( | CDC * | pDC,
 |  | UINT | nState,
 |  | CRect & | rcItem
 | ) | [protected, virtual]

Reimplemented from CCJFlatButton.

Definition at line 114 of file PseudoButton.cpp.

00115 {
00116     // get the handle to the bitmap (if any) associated
00117     // with this button.
00118     HBITMAP hBitmap = GetBitmap();
00119     if( hBitmap == NULL ) {
00120         return;
00121     }
00122
00123     CRect rc = rcItem;
00124
00125     // if the button is selected.
00126     if( nState & ODS_SELECTED ) {
00127         rcItem.OffsetRect(1,1);
00128     }
00129
00130     // draw the bitmap associated with this button.
00131     if((nState & ODS_DISABLED) != 0 && m_disbitmap != 0L)
00132         pDC->DrawState( rc.TopLeft(), rc.Size(), m_disbitmap,
00133             DSS_NORMAL, (HBRUSH)NULL );
00134     else if(m_bitmap != 0L)
00135         pDC->DrawState( rc.TopLeft(), rc.Size(), m_bitmap,
00136             DSS_NORMAL, (HBRUSH)NULL );
00137     else
00138         pDC->DrawState( rc.TopLeft(), rc.Size(), hBitmap,
00139             ( nState & ODS_DISABLED )?DSS_DISABLED:DSS_NORMAL, (HBRUSH)NULL );
00140 }

void CPseudoButton::DrawItem ( LPDRAWITEMSTRUCT lpDIS ) [virtual]

Reimplemented from CCJFlatButton.

Reimplemented in CPseudoToggle.

Definition at line 53 of file PseudoButton.cpp.

Referenced by CPseudoToggle::DrawItem().

00054 {
00055     BOOL oldFlag = m_bFlatLook;
00056     if(lpDIS->itemState & ODS_DISABLED)
00057         m_bFlatLook = true;
00058     CCJFlatButton::DrawItem(lpDIS);
00059     m_bFlatLook = oldFlag;
00060 }

bool CPseudoButton::LoadXPM ( int rsrcid ) [virtual]

Definition at line 85 of file PseudoButton.cpp.

00086 {
00087     CString sicon;
00088
00089     if(!CPseudoButton::loadIcon(sicon, rsrcid))
00090         return false;
00091
00092     COLORREF back = ::GetSysColor(COLOR_BTNFACE);
00093     COLORREF fore = ::GetSysColor(COLOR_GRAYTEXT);
00094
00095     int w, h;
00096     HBITMAP bmap = UMakeBitmap((const char *)sicon, w, h, DD_PIXMAP, back, fore);
00097     if(bmap == 0L)
00098         return false;
00099
00100     SetBitmap(bmap);
00101     if(m_bitmap != 0L)
00102         AfxDeleteObject((HGDIOBJ*)&m_bitmap);
00103     m_bitmap = bmap;
00104
00105     bmap = UMakeBitmap((const char *)sicon, w, h, DD_PIXMAP, back, fore, false);
00106     if(bmap == 0L)
00107         return false;
00108     if(m_disbitmap != 0L)
00109         AfxDeleteObject((HGDIOBJ*)&m_disbitmap);
00110     m_disbitmap = bmap;
00111     return true;
00112 }

bool CPseudoButton::loadIcon | ( | CString & | icon,
 |  | int | rsrcid
 | ) | [static]

Definition at line 62 of file PseudoButton.cpp.

Referenced by LoadXPM(), and CPseudoRotButton::LoadXPMs().

00063 {
00064     icon = "";
00065     bool res = false;
00066
00067     HINSTANCE inst = ::AfxGetResourceHandle();
00068     HRSRC hRsrc = FindResource(inst, MAKEINTRESOURCE(rsrcid), "CICN");
00069     if (hRsrc != 0L)
00070     {
00071         HGLOBAL hg = LoadResource(inst, hRsrc);
00072         if (hg != 0L)
00073         {
00074             DWORD size = SizeofResource(inst, hRsrc);
00075             char *rsrcptr = (char *)LockResource(hg);
00076             icon = CString(rsrcptr, size);
00077             FreeResource(hg);
00078             res = true;
00079         }
00080     }
00081
00082     return res;
00083 }

Member Data Documentation

HBITMAP CPseudoButton::m_bitmap [protected]

Definition at line 58 of file PseudoButton.h.

HBITMAP CPseudoButton::m_disbitmap [protected]

Definition at line 59 of file PseudoButton.h.

The documentation for this class was generated from the following files:
  • rf/support/mfc/PseudoButton.h
  • rf/support/mfc/PseudoButton.cpp
Generated on Sun Oct 21 12:49:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPseudoCmdStatusWrapper Struct Reference

#include <UPseudoSupport.h>

Collaboration diagram for UPseudoCmdStatusWrapper:

[legend]
List of all members.

Public Attributes

Boolean * | outEnabled
Boolean * | outUsesMark
UInt16 * | outMark
unsigned char * | outName

Member Data Documentation

Boolean* UPseudoCmdStatusWrapper::outEnabled

Definition at line 16 of file UPseudoSupport.h.

Referenced by LMainPseudoAttachment::ExecuteSelf().

UInt16* UPseudoCmdStatusWrapper::outMark

Definition at line 18 of file UPseudoSupport.h.

Referenced by LMainPseudoAttachment::ExecuteSelf().

unsigned char* UPseudoCmdStatusWrapper::outName

Definition at line 19 of file UPseudoSupport.h.

Referenced by LMainPseudoAttachment::ExecuteSelf().

Boolean* UPseudoCmdStatusWrapper::outUsesMark

Definition at line 17 of file UPseudoSupport.h.

Referenced by LMainPseudoAttachment::ExecuteSelf().

The documentation for this struct was generated from the following file:
  • rf/support/powerplant/UPseudoSupport.h
Generated on Sun Oct 21 12:49:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPseudoDlg Class Reference

#include <PseudoDlg.h>

Inheritance diagram for CPseudoDlg:

[legend]
Collaboration diagram for CPseudoDlg:

[legend]
List of all members.

Public Methods

CPseudoDlg (int dlgid, UWidget *pseudo, CWnd *pParent=NULL)
virtual | ~CPseudoDlg ()

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
virtual LRESULT | WindowProc (UINT message, WPARAM wParam, LPARAM lParam)
virtual BOOL | OnInitDialog ()

Protected Attributes

UWidget * m_pseudo

Constructor & Destructor Documentation

CPseudoDlg::CPseudoDlg | ( | int | dlgid,
 |  | UWidget * | pseudo,
 |  | CWnd * | pParent = NULL
 | ) |

Definition at line 41 of file PseudoDlg.cpp.

00042     : CDialog(dlgid, pParent), m_pseudo(pseudo)
00043 {
00044     //{{AFX_DATA_INIT(CPseudoDlg)
00045         // NOTE: the ClassWizard will add member initialization here
00046     //}}AFX_DATA_INIT
00047 }

CPseudoDlg::~CPseudoDlg ( ) [virtual]

Definition at line 49 of file PseudoDlg.cpp.

00050 {
00051     if(m_pseudo != 0L)
00052     {
00053         UEventSendMessage(m_pseudo->GetWidID(), EV_DESTROY, 0, 0L);
00054
00055         std::map<int, void *>::iterator k;
00056         for(k = m_pseudo->GetWidgets().begin(); k != m_pseudo->GetWidgets().end(); ++k)
00057         {
00058             CWnd *wnd = (CWnd *)(*k).second;
00059             if((*k).first != kUMainWidget)
00060                 delete wnd;
00061         }
00062     }
00063 }

Member Function Documentation

void CPseudoDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 65 of file PseudoDlg.cpp.

00066 {
00067     CDialog::DoDataExchange(pDX);
00068
00069     if(m_pseudo != 0L)
00070     {
00071         std::map<int, void *>::iterator i;
00072         for(i = m_pseudo->GetWidgets().begin(); i != m_pseudo->GetWidgets().end(); ++i)
00073         {
00074             if((*i).first != kUMainWidget)
00075                 DDX_Control(pDX, UCMD_to_WINCTL((*i).first), *(CWnd *)(*i).second);
00076         }
00077
00078         m_pseudo->DoDataExchange(!pDX->m_bSaveAndValidate);
00079     }
00080
00081     //{{AFX_DATA_MAP(CPseudoDlg)
00082     //}}AFX_DATA_MAP
00083 }

BOOL CPseudoDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 166 of file PseudoDlg.cpp.

00167 {
00168     if(m_pseudo != 0L)
00169     {
00170         WinInitWidgets(this, m_pseudo);
00171         UEventSendMessage(m_pseudo->GetWidID(), EV_CREATE, 0, 0L);
00172     }
00173
00174     CDialog::OnInitDialog();
00175
00176     return TRUE;  // return TRUE unless you set the focus to a control
00177                   // EXCEPTION: OCX Property Pages should return FALSE
00178 }

LRESULT CPseudoDlg::WindowProc | ( | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) | [protected, virtual]

Definition at line 485 of file PseudoDlg.cpp.

00486 {
00487     if(m_pseudo != 0L && !UWinPseudoWindowProc(this, m_pseudo, message, wParam, lParam))
00488         return 0;
00489
00490     return CDialog::WindowProc(message, wParam, lParam);
00491 }

Member Data Documentation

UWidget* CPseudoDlg::m_pseudo [protected]

Definition at line 56 of file PseudoDlg.h.

The documentation for this class was generated from the following files:
  • rf/support/mfc/PseudoDlg.h
  • rf/support/mfc/PseudoDlg.cpp
Generated on Sun Oct 21 12:49:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPseudoDraw Class Reference

#include <PseudoDraw.h>

Inheritance diagram for CPseudoDraw:

[legend]
Collaboration diagram for CPseudoDraw:

[legend]
List of all members.

Public Methods

CPseudoDraw (UWidget *pseudo, int cmdid)
virtual | ~CPseudoDraw ()

Public Attributes

UWidget * m_pseudo
int | m_cmdid

Protected Methods

afx_msg void | OnPaint ()

Constructor & Destructor Documentation

CPseudoDraw::CPseudoDraw | ( | UWidget * | pseudo,
 |  | int | cmdid
 | ) |

Definition at line 18 of file PseudoDraw.cpp.

00018                                                    : m_pseudo(pseudo), m_cmdid(cmdid)
00019 {
00020 }

CPseudoDraw::~CPseudoDraw ( ) [virtual]

Definition at line 22 of file PseudoDraw.cpp.

00023 {
00024 }

Member Function Documentation

void CPseudoDraw::OnPaint ( ) [protected]

Definition at line 36 of file PseudoDraw.cpp.

00037 {
00038     CPaintDC dc(this); // device context for painting
00039
00040     if(m_pseudo != 0L)
00041         UEventSendMessage(m_pseudo->GetWidID(), EV_CUSTOM_DRAW, m_cmdid, &dc);
00042 }

Member Data Documentation

int CPseudoDraw::m_cmdid

Definition at line 24 of file PseudoDraw.h.

UWidget* CPseudoDraw::m_pseudo

Definition at line 23 of file PseudoDraw.h.

The documentation for this class was generated from the following files:
  • rf/support/mfc/PseudoDraw.h
  • rf/support/mfc/PseudoDraw.cpp
Generated on Sun Oct 21 12:49:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPseudoFakePane Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for UPseudoFakePane:

[legend]
Collaboration diagram for UPseudoFakePane:

[legend]
List of all members.

Public Methods

UPseudoFakePane (const SPaneInfo &inPaneInfo, LPseudoWinAttachment *inAttach)
virtual | ~UPseudoFakePane ()
virtual void | AdaptToSuperFrameSize (SInt32 inSurrWidthDelta, SInt32 inSurrHeightDelta, Boolean inRefresh)

Protected Methods

virtual void | ActivateSelf ()
virtual void | DeactivateSelf ()

Protected Attributes

LPseudoWinAttachment * m_Attach

Constructor & Destructor Documentation

UPseudoFakePane::UPseudoFakePane | ( | const SPaneInfo & | inPaneInfo,
 |  | LPseudoWinAttachment * | inAttach
 | ) |

Definition at line 996 of file UPseudoSupport.cpp.

00996                                                                                              :
00997     LPane(inPaneInfo), m_Attach(inAttach)
00998 {
00999 }

UPseudoFakePane::~UPseudoFakePane ( ) [virtual]

Definition at line 1001 of file UPseudoSupport.cpp.

01002 {
01003 }

Member Function Documentation

void UPseudoFakePane::ActivateSelf ( ) [protected, virtual]

Definition at line 1005 of file UPseudoSupport.cpp.

01006 {
01007     UEventNotifyMessage(EV_UPDATEFOCUS, 0, dynamic_cast<LWindow *>(GetSuperView()));
01008 }

void UPseudoFakePane::AdaptToSuperFrameSize | ( | SInt32 | inSurrWidthDelta,
 |  | SInt32 | inSurrHeightDelta,
 |  | Boolean | inRefresh
 | ) | [virtual]

Definition at line 1015 of file UPseudoSupport.cpp.

01019 {
01020     LPane::AdaptToSuperFrameSize(inSurrWidthDelta, inSurrHeightDelta, inRefresh);
01021
01022     m_Attach->CheckWindowSize();
01023 }

void UPseudoFakePane::DeactivateSelf ( ) [protected, virtual]

Definition at line 1010 of file UPseudoSupport.cpp.

01011 {
01012     UEventNotifyMessage(EV_UPDATEFOCUS, 1, dynamic_cast<LWindow *>(GetSuperView()));
01013 }

Member Data Documentation

LPseudoWinAttachment* UPseudoFakePane::m_Attach [protected]

Definition at line 152 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/powerplant/UPseudoSupport.h
  • rf/support/powerplant/UPseudoSupport.cpp
Generated on Sun Oct 21 12:49:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPseudoItem Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for CPseudoItem:

[legend]
Collaboration diagram for CPseudoItem:

[legend]
List of all members.

Public Methods

CPseudoItem (int widid, int cmdid)
virtual | ~CPseudoItem ()

Public Attributes

std::map< int, UStr > | m_texts
void * | m_data

Protected Methods

virtual void | GetDrawContentsSelf (const STableCell &inCell, SOutlineDrawContents &ioDrawContents)
virtual void | DrawRowAdornments (const Rect &inLocalRowRect)
virtual void | DrawCell (const STableCell &inCell, const Rect &inLocalCellRect)
virtual void | DoubleClick (const STableCell &inCell, const SMouseDownEvent &inMouseDown, const SOutlineDrawContents &inDrawContents, Boolean inHitText)
virtual void | SingleClick (const STableCell &inCell, const SMouseDownEvent &inMouseDown, const SOutlineDrawContents &inDrawContents, Boolean inHitText)

Protected Attributes

int | m_widid
int | m_cmdid

Private Methods

CPseudoItem ()
CPseudoItem (const CPseudoItem &inOriginal)
CPseudoItem & | operator= (const CPseudoItem &inOriginal)

Constructor & Destructor Documentation

CPseudoItem::CPseudoItem | ( | int | widid,
 |  | int | cmdid
 | ) |

Definition at line 628 of file UPseudoSupport.cpp.

00628                                              : m_widid(widid), m_cmdid(cmdid), m_data(0L)
00629 {
00630 }

CPseudoItem::~CPseudoItem ( ) [virtual]

Definition at line 632 of file UPseudoSupport.cpp.

00633 {
00634 }

CPseudoItem::CPseudoItem ( ) [private]

CPseudoItem::CPseudoItem ( const CPseudoItem & inOriginal ) [private]

Member Function Documentation

void CPseudoItem::DoubleClick | ( | const STableCell & | inCell,
 |  | const SMouseDownEvent & | inMouseDown,
 |  | const SOutlineDrawContents & | inDrawContents,
 |  | Boolean | inHitText
 | ) | [protected, virtual]

Definition at line 695 of file UPseudoSupport.cpp.

00700 {
00701     UStr name;
00702     std::map<int, UStr>::iterator i = m_texts.find(inCell.col - 1);
00703     if(i != m_texts.end())
00704     {
00705         name = (*i).second;
00706     }
00707     UEventSendMessage(m_widid,
00708         EV_LIST_DBLCLICK, UMAKEINT(m_cmdid, inCell.row - 1),
00709         (void *)(const char *)name);
00710
00711     LOutlineItem::DoubleClick(inCell, inMouseDown, inDrawContents, inHitText);
00712 }

void CPseudoItem::DrawCell | ( | const STableCell & | inCell,
 |  | const Rect & | inLocalCellRect
 | ) | [protected, virtual]

Definition at line 665 of file UPseudoSupport.cpp.

00666 {
00667     LOutlineItem::DrawCell(inCell, inLocalCellRect);
00668
00669     RGBColor c = UGAColorRamp::GetColor(colorRamp_Gray2);
00670     RGBForeColor(&c);
00671     MoveTo(inLocalCellRect.right - 1, inLocalCellRect.top);
00672     LineTo(inLocalCellRect.right - 1, inLocalCellRect.bottom);
00673 }

void CPseudoItem::DrawRowAdornments ( const Rect & inLocalRowRect ) [protected, virtual]

Definition at line 655 of file UPseudoSupport.cpp.

00657 {
00658     ShadeRow(UGAColorRamp::GetColor(colorRamp_White), inLocalRowRect);
00659     RGBColor c = UGAColorRamp::GetColor(colorRamp_Gray2);
00660     RGBForeColor(&c);
00661     MoveTo(inLocalRowRect.right, inLocalRowRect.top);
00662     LineTo(inLocalRowRect.right, inLocalRowRect.bottom);
00663 }

void CPseudoItem::GetDrawContentsSelf | ( | const STableCell & | inCell,
 |  | SOutlineDrawContents & | ioDrawContents
 | ) | [protected, virtual]

Definition at line 639 of file UPseudoSupport.cpp.

00642 {
00643     std::map<int, UStr>::iterator i = m_texts.find(inCell.col);
00644     if(i != m_texts.end())
00645     {
00646         ioDrawContents.outShowSelection = true;
00647         LStr255 pstr((*i).second);
00648         LString::CopyPStr(pstr, ioDrawContents.outTextString);
00649     }
00650 }

void CPseudoItem::SingleClick | ( | const STableCell & | inCell,
 |  | const SMouseDownEvent & | inMouseDown,
 |  | const SOutlineDrawContents & | inDrawContents,
 |  | Boolean | inHitText
 | ) | [protected, virtual]

Definition at line 675 of file UPseudoSupport.cpp.

00680 {
00681     UStr name;
00682     std::map<int, UStr>::iterator i = m_texts.find(inCell.col - 1);
00683     if(i != m_texts.end())
00684     {
00685         name = (*i).second;
00686     }
00687     UEventSendMessage(m_widid,
00688         EV_LIST_SELECTING, UMAKEINT(m_cmdid, inCell.row - 1),
00689         (void *)(const char *)name);
00690
00691     LOutlineItem::SingleClick(inCell, inMouseDown, inDrawContents, inHitText);
00692 }

CPseudoItem& CPseudoItem::operator= ( const CPseudoItem & inOriginal ) [private]

Member Data Documentation

int CPseudoItem::m_cmdid [protected]

Definition at line 183 of file UPseudoSupport.h.

void* CPseudoItem::m_data

Definition at line 165 of file UPseudoSupport.h.

Referenced by UWidget::OnListGetInfo(), UWidget::OnListRowGetData(), and UWidget::OnListRowSetData().

std::map<int, UStr> CPseudoItem::m_texts

Definition at line 164 of file UPseudoSupport.h.

Referenced by UWidget::OnListGetInfo(), and UWidget::OnListInsert().

int CPseudoItem::m_widid [protected]

Definition at line 183 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/powerplant/UPseudoSupport.h
  • rf/support/powerplant/UPseudoSupport.cpp
Generated on Sun Oct 21 12:49:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPseudoList Class Reference

#include <pseudolist.h>

Inheritance diagram for CPseudoList:

[legend]
Collaboration diagram for CPseudoList:

[legend]
List of all members.

Public Methods

CPseudoList (int wid, int cmd)
virtual | ~CPseudoList ()

Protected Methods

afx_msg void | OnLButtonDblClk (UINT nFlags, CPoint point)

Protected Attributes

int | m_cmd
int | m_wid

Constructor & Destructor Documentation

CPseudoList::CPseudoList | ( | int | wid,
 |  | int | cmd
 | ) |

Definition at line 17 of file PseudoList.cpp.

00017                                          : m_wid(wid), m_cmd(cmd)
00018 {
00019 }

CPseudoList::~CPseudoList ( ) [virtual]

Definition at line 21 of file PseudoList.cpp.

00022 {
00023 }

Member Function Documentation

void CPseudoList::OnLButtonDblClk | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 35 of file PseudoList.cpp.

00036 {
00037     UINT pFlags;
00038     int nItem = HitTest(point, &pFlags);
00039     if(nItem != -1)
00040     {
00041         CString s = GetItemText(nItem, 0);
00042
00043         UEventSendMessage(m_wid, EV_LIST_DBLCLICK, UMAKEINT(m_cmd, nItem),
00044             (void *)(const char *)s);
00045     }
00046
00047     CListCtrl::OnLButtonDblClk(nFlags, point);
00048 }

Member Data Documentation

int CPseudoList::m_cmd [protected]

Definition at line 36 of file pseudolist.h.

int CPseudoList::m_wid [protected]

Definition at line 36 of file pseudolist.h.

The documentation for this class was generated from the following files:
  • rf/support/mfc/pseudolist.h
  • rf/support/mfc/PseudoList.cpp
Generated on Sun Oct 21 12:49:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPseudoPageHider Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for UPseudoPageHider:

[legend]
Collaboration diagram for UPseudoPageHider:

[legend]
List of all members.

Public Types

enum | { class_ID = FOUR_CHAR_CODE('UPPH') }

Public Methods

UPseudoPageHider (LStream *inStream)
virtual | ~UPseudoPageHider ()
void | SetWidID (int widid)
virtual void | ListenToMessage (MessageT inMessage, void *ioParam)

Protected Methods

void | DoRotate (int entry)
virtual void | ExecuteSelf (MessageT inMessage, void *ioParam)

Protected Attributes

std::vector< PaneIDT > | fViewSuite
int | fWidid
int | fCurSel
LPageController * | fPageCtrl

Member Enumeration Documentation

anonymous enum

Enumeration values:
class_ID

Definition at line 67 of file UPseudoSupport.h.

00067 { class_ID = FOUR_CHAR_CODE('UPPH') };

Constructor & Destructor Documentation

UPseudoPageHider::UPseudoPageHider ( LStream * inStream )

Definition at line 889 of file UPseudoSupport.cpp.

00889                                                     : LAttachment(inStream),
00890     fWidid(-1), fCurSel(-1), fPageCtrl(0L)
00891 {
00892     SetMessage(msg_FinishCreate);
00893
00894     LStr255 pstr;
00895     inStream->ReadPString(pstr);
00896
00897     UStr str(pstr);
00898     const char *ptr = str;
00899     while(ptr != 0L)
00900     {
00901         PaneIDT paneID;
00902         const char *tmp = strchr(ptr, ',');
00903         if(tmp != 0L)
00904         {
00905             UStr stmp;
00906             size_t offset = tmp - ptr;
00907             stmp.set(ptr, offset);
00908             ptr += offset + 1;
00909             if(stmp.length() == 4)
00910             {
00911                 paneID = *(PaneIDT *)(char *)stmp;
00912                 fViewSuite.push_back(paneID);
00913             }
00914         }
00915         else
00916         {
00917             if(strlen(ptr) == 4)
00918             {
00919                 paneID = *(PaneIDT *)ptr;
00920                 fViewSuite.push_back(paneID);
00921             }
00922             ptr = 0L;
00923         }
00924     }
00925 }

UPseudoPageHider::~UPseudoPageHider ( ) [virtual]

Definition at line 948 of file UPseudoSupport.cpp.

00949 {
00950 }

Member Function Documentation

void UPseudoPageHider::DoRotate ( int entry ) [protected]

Definition at line 952 of file UPseudoSupport.cpp.

Referenced by ListenToMessage().

00953 {
00954     if(fPageCtrl == 0L)
00955         return;
00956
00957     int cmdid;
00958     if(macpp_getcmdid(fPageCtrl->GetPaneID(), cmdid) && entry >= 0 && entry < fViewSuite.size() &&
00959         entry != fCurSel)
00960     {
00961         fCurSel = entry;
00962
00963         LWindow *win = macpp_findwindow(fPageCtrl);
00964         if(win == 0L)
00965             return;
00966
00967         LPane* samplePanel;
00968         std::vector<PaneIDT>::iterator i;
00969         for(i = fViewSuite.begin(); i != fViewSuite.end(); ++i)
00970         {
00971             samplePanel = win->FindPaneByID(*i);
00972             if(samplePanel != 0L)
00973                 samplePanel->Hide();
00974         }
00975
00976         samplePanel = win->FindPaneByID(fViewSuite[entry]);
00977         if(samplePanel == 0L)
00978             return;
00979
00980         samplePanel->Show();
00981
00982         if(fWidid != -1)
00983             UEventSendMessage(fWidid, EV_CMD, cmdid, (void *)entry);
00984     }
00985 }

void UPseudoPageHider::ExecuteSelf | ( | MessageT | inMessage,
 |  | void * | ioParam
 | ) | [protected, virtual]

Definition at line 927 of file UPseudoSupport.cpp.

00930 {
00931     if(inMessage == msg_FinishCreate)
00932     {
00933         LPane *pane = reinterpret_cast<LPane*>(ioParam);
00934         fPageCtrl = dynamic_cast<LPageController*>(pane);
00935         if(fPageCtrl == 0L)
00936         {
00937             UAppConsole("The UPseudoPageHider attachement does not have any LPageController to attach to.");
00938         }
00939         else
00940         {
00941             // add ourself to the broadcast so we receive the changes
00942             fPageCtrl->StartBroadcasting ();
00943             fPageCtrl->AddListener (this);
00944         }
00945     }
00946 }

void UPseudoPageHider::ListenToMessage | ( | MessageT | inMessage,
 |  | void * | ioParam
 | ) | [virtual]

Definition at line 987 of file UPseudoSupport.cpp.

00988 {
00989     if(fPageCtrl != 0L && inMessage == fPageCtrl->GetPaneID())
00990     {
00991         SInt32 currPageIndex = *static_cast<SInt32 *>(ioParam);
00992         DoRotate(currPageIndex - 1);
00993     }
00994 }

void UPseudoPageHider::SetWidID ( int widid ) [inline]

Definition at line 72 of file UPseudoSupport.h.

Referenced by macpp_fecthview().

00072 { fWidid = widid; }

Member Data Documentation

int UPseudoPageHider::fCurSel [protected]

Definition at line 87 of file UPseudoSupport.h.

class LPageController* UPseudoPageHider::fPageCtrl [protected]

Definition at line 88 of file UPseudoSupport.h.

std::vector<PaneIDT> UPseudoPageHider::fViewSuite [protected]

Definition at line 85 of file UPseudoSupport.h.

int UPseudoPageHider::fWidid [protected]

Definition at line 86 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/powerplant/UPseudoSupport.h
  • rf/support/powerplant/UPseudoSupport.cpp
Generated on Sun Oct 21 12:49:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPseudoPlaceHolder Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for UPseudoPlaceHolder:

[legend]
Collaboration diagram for UPseudoPlaceHolder:

[legend]
List of all members.

Public Types

enum | { class_ID = FOUR_CHAR_CODE('UPLH') }

Public Methods

UPseudoPlaceHolder (LStream *inStream)
virtual | ~UPseudoPlaceHolder ()
void | DoRotate (int entry)
void | SetWidID (int widid)
LView * | GetCurrentView (void)
virtual void | ListenToMessage (MessageT inMessage, void *ioParam)

Protected Methods

virtual void | FinishCreateSelf ()

Protected Attributes

std::vector< short > | fViewSuite
LView * | fCurrentView
PaneIDT | fController
int | fWidid

Member Enumeration Documentation

anonymous enum

Enumeration values:
class_ID

Definition at line 42 of file UPseudoSupport.h.

00042 { class_ID = FOUR_CHAR_CODE('UPLH') };

Constructor & Destructor Documentation

UPseudoPlaceHolder::UPseudoPlaceHolder ( LStream * inStream )

Definition at line 786 of file UPseudoSupport.cpp.

00786                                                         : LPlaceHolder(inStream),
00787     fCurrentView(0L), fWidid(-1)
00788 {
00789     LStr255 pstr;
00790     inStream->ReadPString(pstr);
00791     *inStream >> fController;
00792
00793     UStr str(pstr);
00794     const char *ptr = str;
00795     while(ptr != 0L)
00796     {
00797         int v;
00798         const char *tmp = strchr(ptr, ',');
00799         if(tmp != 0L)
00800         {
00801             UStr stmp;
00802             size_t offset = tmp - ptr;
00803             stmp.set(ptr, offset);
00804             ptr += offset + 1;
00805             if(sscanf(stmp, "%d", &v) == 1)
00806                 fViewSuite.push_back(v);
00807         }
00808         else
00809         {
00810             if(sscanf(ptr, "%d", &v) == 1)
00811                 fViewSuite.push_back(v);
00812             ptr = 0L;
00813         }
00814     }
00815 }

UPseudoPlaceHolder::~UPseudoPlaceHolder ( ) [virtual]

Definition at line 817 of file UPseudoSupport.cpp.

00818 {
00819 }

Member Function Documentation

void UPseudoPlaceHolder::DoRotate ( int entry )

Definition at line 821 of file UPseudoSupport.cpp.

Referenced by FinishCreateSelf(), and ListenToMessage().

00822 {
00823     int cmdid;
00824     if(macpp_getcmdid(GetPaneID(), cmdid) && entry >= 0 && entry < fViewSuite.size())
00825     {
00826         LWindow *win = macpp_findwindow(this);
00827         if(win == 0L)
00828             return;
00829
00830         LView* samplePanel = UReanimator::CreateView(fViewSuite[entry], this, win);
00831         if(samplePanel == 0L)
00832             return;
00833
00834         InstallOccupant (samplePanel);
00835
00836         LView *oldView = fCurrentView;
00837
00838         if (fCurrentView != 0L)
00839         {
00840             fCurrentView->Hide ();
00841             fCurrentView = nil;
00842         }
00843
00844         Refresh();
00845         fCurrentView = samplePanel;
00846
00847         if(fWidid != -1 && !gTurnOffBroadcast)
00848             UEventSendMessage(fWidid, EV_PAGE_CHANGED, UMAKEINT(cmdid, entry), 0L);
00849
00850         if (oldView != 0L)
00851         {
00852             delete oldView;
00853         }
00854
00855     }
00856 }

void UPseudoPlaceHolder::FinishCreateSelf ( void ) [protected, virtual]

Definition at line 867 of file UPseudoSupport.cpp.

00868 {
00869     DoRotate(0);
00870
00871     LWindow *win = macpp_findwindow(this);
00872     if(win == 0L)
00873         return;
00874
00875     LPageController *controller = dynamic_cast<LPageController*>(win->FindPaneByID(fController));
00876     if (controller != 0L)
00877     {
00878         controller->StartBroadcasting ();
00879         controller->AddListener (this);
00880     }
00881     LTabsControl *controller2 = dynamic_cast<LTabsControl*>(win->FindPaneByID(fController));
00882     if (controller2 != 0L)
00883     {
00884         controller2->StartBroadcasting ();
00885         controller2->AddListener (this);
00886     }
00887 }

LView* UPseudoPlaceHolder::GetCurrentView ( void ) [inline]

Definition at line 49 of file UPseudoSupport.h.

Referenced by UWidget::OnPageChanged().

00049 { return fCurrentView; }

void UPseudoPlaceHolder::ListenToMessage | ( | MessageT | inMessage,
 |  | void * | ioParam
 | ) | [virtual]

Definition at line 858 of file UPseudoSupport.cpp.

00859 {
00860     if(inMessage == fController)
00861     {
00862         SInt32 currPageIndex = *static_cast<SInt32 *>(ioParam);
00863         DoRotate(currPageIndex - 1);
00864     }
00865 }

void UPseudoPlaceHolder::SetWidID ( int widid ) [inline]

Definition at line 48 of file UPseudoSupport.h.

Referenced by macpp_fecthview().

00048 { fWidid = widid; }

Member Data Documentation

PaneIDT UPseudoPlaceHolder::fController [protected]

Definition at line 60 of file UPseudoSupport.h.

LView* UPseudoPlaceHolder::fCurrentView [protected]

Definition at line 59 of file UPseudoSupport.h.

std::vector<short> UPseudoPlaceHolder::fViewSuite [protected]

Definition at line 58 of file UPseudoSupport.h.

int UPseudoPlaceHolder::fWidid [protected]

Definition at line 61 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/powerplant/UPseudoSupport.h
  • rf/support/powerplant/UPseudoSupport.cpp
Generated on Sun Oct 21 12:49:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPseudoRotButton Class Reference

#include <PseudoButton.h>

Inheritance diagram for CPseudoRotButton:

[legend]
Collaboration diagram for CPseudoRotButton:

[legend]
List of all members.

Public Methods

CPseudoRotButton ()
virtual bool | LoadXPMs (const int *rsrcid, int numrsrc)
virtual void | DoRotate (int index)
int | GetCurrent (void) const
virtual | ~CPseudoRotButton ()

Protected Attributes

std::vector< HBITMAP > m_bitmaps
std::vector< HBITMAP > m_disbitmaps
int | m_curindex

Constructor & Destructor Documentation

CPseudoRotButton::CPseudoRotButton ( )

Definition at line 152 of file PseudoButton.cpp.

00152                                    : m_curindex(-1)
00153 {
00154 }

CPseudoRotButton::~CPseudoRotButton ( ) [virtual]

Definition at line 156 of file PseudoButton.cpp.

00157 {
00158     m_bitmap = 0L;
00159     m_disbitmap = 0L;
00160     std::vector<HBITMAP>::iterator i;
00161     for(i = m_bitmaps.begin(); i != m_bitmaps.end(); ++i)
00162     {
00163         HBITMAP bmap = *i;
00164         AfxDeleteObject((HGDIOBJ*)&bmap);
00165     }
00166     for(i = m_disbitmaps.begin(); i != m_disbitmaps.end(); ++i)
00167     {
00168         HBITMAP bmap = *i;
00169         AfxDeleteObject((HGDIOBJ*)&bmap);
00170     }
00171 }

Member Function Documentation

void CPseudoRotButton::DoRotate ( int index ) [virtual]

Definition at line 201 of file PseudoButton.cpp.

Referenced by LoadXPMs(), and UWidget::OnSetState().

00202 {
00203     if(index < 0 || index > m_bitmaps.size() || index > m_disbitmaps.size() ||
00204         m_curindex == index)
00205         return;
00206
00207     SetBitmap(m_bitmaps[index]);
00208     Invalidate(TRUE);
00209     m_curindex = index;
00210     m_bitmap = m_bitmaps[index];
00211     m_disbitmap = m_disbitmaps[index];
00212 }

int CPseudoRotButton::GetCurrent ( void ) const [inline]

Definition at line 104 of file PseudoButton.h.

Referenced by UWidget::OnGetState().

00104 { return m_curindex; }

bool CPseudoRotButton::LoadXPMs | ( | const int * | rsrcid,
 |  | int | numrsrc
 | ) | [virtual]

Definition at line 173 of file PseudoButton.cpp.

00174 {
00175     CString sicon;
00176     COLORREF back = ::GetSysColor(COLOR_BTNFACE);
00177     COLORREF fore = ::GetSysColor(COLOR_GRAYTEXT);
00178
00179     for(int i = 0; i < numrsrc; i++)
00180     {
00181         if(!CPseudoButton::loadIcon(sicon, rsrcid[i]))
00182             return false;
00183
00184         int w, h;
00185         HBITMAP bmap = UMakeBitmap((const char *)sicon, w, h, DD_PIXMAP, back, fore);
00186         if(bmap == 0L)
00187             return false;
00188
00189         HBITMAP disbmap = UMakeBitmap((const char *)sicon, w, h, DD_PIXMAP, back, fore, false);
00190         if(disbmap == 0L)
00191             return false;
00192
00193         m_bitmaps.push_back(bmap);
00194         m_disbitmaps.push_back(disbmap);
00195     }
00196
00197     DoRotate(0);
00198     return true;
00199 }

Member Data Documentation

std::vector<HBITMAP> CPseudoRotButton::m_bitmaps [protected]

Definition at line 95 of file PseudoButton.h.

int CPseudoRotButton::m_curindex [protected]

Definition at line 97 of file PseudoButton.h.

std::vector<HBITMAP> CPseudoRotButton::m_disbitmaps [protected]

Definition at line 96 of file PseudoButton.h.

The documentation for this class was generated from the following files:
  • rf/support/mfc/PseudoButton.h
  • rf/support/mfc/PseudoButton.cpp
Generated on Sun Oct 21 12:49:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPseudoRotButton Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for UPseudoRotButton:

[legend]
Collaboration diagram for UPseudoRotButton:

[legend]
List of all members.

Public Types

enum | { class_ID = FOUR_CHAR_CODE('UPRB') }

Public Methods

UPseudoRotButton (LStream *inStream, ClassIDT inImpID=LBevelButton::imp_class_ID)
virtual | ~UPseudoRotButton ()
virtual void | DoRotate (int icon, bool refresh=true)
int | GetCurrentState (void) const

Protected Methods

void | ReadIconsID (LStream *inStream, std::vector< short > &res)

Protected Attributes

std::vector< short > | fIconSuite
int | fCurrentIcon

Member Enumeration Documentation

anonymous enum

Enumeration values:
class_ID

Definition at line 25 of file UPseudoSupport.h.

00025 { class_ID = FOUR_CHAR_CODE('UPRB') };

Constructor & Destructor Documentation

UPseudoRotButton::UPseudoRotButton | ( | LStream * | inStream,
 |  | ClassIDT | inImpID = LBevelButton::imp_class_ID
 | ) |

Definition at line 725 of file UPseudoSupport.cpp.

00725                                                                       : LBevelButton(inStream, inImpID), fCurrentIcon(0)
00726 {
00727     ReadIconsID(inStream, fIconSuite);
00728
00729     if(fIconSuite.size() != 0)
00730         DoRotate(0, false);
00731 }

UPseudoRotButton::~UPseudoRotButton ( ) [virtual]

Definition at line 733 of file UPseudoSupport.cpp.

00734 {
00735 }

Member Function Documentation

void UPseudoRotButton::DoRotate | ( | int | icon,
 |  | bool | refresh = true
 | ) | [virtual]

Definition at line 766 of file UPseudoSupport.cpp.

Referenced by UWidget::OnSetState(), and UPseudoRotButton().

00767 {
00768     if(fCurrentIcon != icon && icon >= 0 && icon < fIconSuite.size())
00769     {
00770         fCurrentIcon = icon;
00771         ControlButtonContentInfo info;
00772         GetContentInfo(info);
00773         if(info.contentType == kControlContentCIconRes ||
00774             info.contentType == kControlContentIconSuiteRes ||
00775             info.contentType == kControlContentICONRes ||
00776             info.contentType == kControlContentPictRes)
00777         {
00778             info.u.resID = fIconSuite[icon];
00779             SetContentInfo(info);
00780         }
00781         if(refresh)
00782             Refresh();
00783     }
00784 }

int UPseudoRotButton::GetCurrentState ( void ) const [inline]

Definition at line 31 of file UPseudoSupport.h.

Referenced by UWidget::OnGetState().

00031 { return fCurrentIcon; }

void UPseudoRotButton::ReadIconsID | ( | LStream * | inStream,
 |  | std::vector< short > & | res
 | ) | [protected]

Definition at line 737 of file UPseudoSupport.cpp.

Referenced by UPseudoRotButton().

00738 {
00739     LStr255 pstr;
00740
00741     inStream->ReadPString(pstr);
00742     UStr str(pstr);
00743     const char *ptr = str;
00744     while(ptr != 0L)
00745     {
00746         int v;
00747         const char *tmp = strchr(ptr, ',');
00748         if(tmp != 0L)
00749         {
00750             UStr stmp;
00751             size_t offset = tmp - ptr;
00752             stmp.set(ptr, offset);
00753             ptr += offset + 1;
00754             if(sscanf(stmp, "%d", &v) == 1)
00755                 res.push_back(v);
00756         }
00757         else
00758         {
00759             if(sscanf(ptr, "%d", &v) == 1)
00760                 res.push_back(v);
00761             ptr = 0L;
00762         }
00763     }
00764 }

Member Data Documentation

int UPseudoRotButton::fCurrentIcon [protected]

Definition at line 36 of file UPseudoSupport.h.

std::vector<short> UPseudoRotButton::fIconSuite [protected]

Definition at line 35 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/powerplant/UPseudoSupport.h
  • rf/support/powerplant/UPseudoSupport.cpp
Generated on Sun Oct 21 12:49:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPseudoToggle Class Reference

#include <PseudoButton.h>

Inheritance diagram for CPseudoToggle:

[legend]
Collaboration diagram for CPseudoToggle:

[legend]
List of all members.

Public Methods

CPseudoToggle ()
~CPseudoToggle ()
virtual void | DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
virtual void | SetState (int state)
int | GetState (void) const
void | ToggleBtn ()
void | SetRadio (bool state)
bool | IsRadio (void) const
void | SetGroup (const char *group)
const char * | GetGroup (void) const
afx_msg void | OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point)
afx_msg void | OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)

Protected Attributes

int | m_flag
bool | m_radio
CString | m_group

Constructor & Destructor Documentation

CPseudoToggle::CPseudoToggle ( )

Definition at line 223 of file PseudoButton.cpp.

00224 {
00225     m_flag = 0;
00226     m_radio = false;
00227 }

CPseudoToggle::~CPseudoToggle ( )

Definition at line 229 of file PseudoButton.cpp.

00230 {
00231 }

Member Function Documentation

void CPseudoToggle::DrawItem ( LPDRAWITEMSTRUCT lpDIS ) [virtual]

Reimplemented from CPseudoButton.

Definition at line 260 of file PseudoButton.cpp.

00261 {
00262     if(m_flag)
00263         lpDIS->itemState |= ODS_SELECTED;
00264     CPseudoButton::DrawItem(lpDIS);
00265 }

const char* CPseudoToggle::GetGroup ( void ) const [inline]

Definition at line 153 of file PseudoButton.h.

Referenced by SetState().

00153 { return m_group; }

int CPseudoToggle::GetState ( void ) const [inline]

Definition at line 146 of file PseudoButton.h.

Referenced by UWidget::OnGetState().

00146 { return m_flag;}

bool CPseudoToggle::IsRadio ( void ) const [inline]

Definition at line 151 of file PseudoButton.h.

Referenced by SetState().

00151 { return m_radio; }

afx_msg void CPseudoToggle::OnChar | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags
 | ) |

afx_msg void CPseudoToggle::OnKeyDown | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags
 | ) |

void CPseudoToggle::OnLButtonUp | ( | UINT | nFlags,
 |  | CPoint | point
 | ) |

Reimplemented from CCJFlatButton.

Definition at line 267 of file PseudoButton.cpp.

00268 {
00269     CRect rect;
00270     GetClientRect(&rect);
00271
00272     //check you are still on the button
00273     if(PtInRect(rect, point))
00274         ToggleBtn();
00275
00276     CPseudoButton::OnLButtonUp(nFlags, point);
00277 }

void CPseudoToggle::SetGroup ( const char * group ) [inline]

Definition at line 152 of file PseudoButton.h.

00152 { m_group = group; }

void CPseudoToggle::SetRadio ( bool state ) [inline]

Definition at line 150 of file PseudoButton.h.

00150 { m_radio = state; }

void CPseudoToggle::SetState ( int state ) [virtual]

Definition at line 233 of file PseudoButton.cpp.

Referenced by UCmdUI::Check(), and UWidget::OnSetState().

00234 {
00235     int newstate = state ? 1 : 0;
00236     if(m_flag == newstate)
00237         return;
00238
00239     m_flag = newstate;
00240     Invalidate(TRUE);
00241
00242     if(state && IsRadio() && !m_group.IsEmpty())
00243     {
00244         CWnd *hwndChild, *parent = GetParent();
00245         for (hwndChild = parent->GetTopWindow(); hwndChild != 0L; hwndChild = hwndChild->GetNextWindow())
00246         {
00247             if(hwndChild != this && hwndChild->IsWindowEnabled() && hwndChild->IsKindOf(RUNTIME_CLASS(CPseudoToggle)))
00248             {
00249                 CPseudoToggle *btn = (CPseudoToggle *)hwndChild;
00250                 if(btn->IsRadio() && m_group == btn->GetGroup())
00251                 {
00252                     btn->SetState(0);
00253                     break;
00254                 }
00255             }
00256         }
00257     }
00258 }

void CPseudoToggle::ToggleBtn ( ) [inline]

Definition at line 147 of file PseudoButton.h.

Referenced by OnLButtonUp().

00147 { SetState(GetState() == 0 ? 1:0);}

Member Data Documentation

int CPseudoToggle::m_flag [protected]

Definition at line 135 of file PseudoButton.h.

CString CPseudoToggle::m_group [protected]

Definition at line 137 of file PseudoButton.h.

bool CPseudoToggle::m_radio [protected]

Definition at line 136 of file PseudoButton.h.

The documentation for this class was generated from the following files:
  • rf/support/mfc/PseudoButton.h
  • rf/support/mfc/PseudoButton.cpp
Generated on Sun Oct 21 12:49:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UPStr Class Reference

up to 255 characters pascal and C string. More...

#include <ustr.h>

Inheritance diagram for UPStr:

[legend]
Collaboration diagram for UPStr:

[legend]
List of all members.

Public Methods

UPStr ()
UPStr (const char *newstr)
UPStr (const unsigned char *newstr)
UPStr (const UPStr &newstr)
virtual | ~UPStr ()
bool | empty (void) const
unsigned int | length (void) const
const char * | operator= (const char *newstr)
set to a new C String (0L is OK). More...

const unsigned char * | operator= (const unsigned char *newstr)
set to a new P String (0L is OK). More...

const UPStr & | operator= (const UPStr &newstr)
set according to another UPStr. More...

const UPStr & | set (const char *buf, unsigned int len)
set from a buffer. More...

operator const char * () const
as a C string. More...

operator char * ()
as a C string. More...

const char * | c_str () const
as a C string. More...

operator const unsigned char * () const
as a P string. More...

operator unsigned char * ()
as a P string. More...

const unsigned char * | p_str () const
as a P string. More...

UPStr & | operator<< (const char *addToStr)
concatenate. More...

UPStr & | operator<< (char addToStr)
concatenate. More...

UPStr & | operator<< (int addToStr)
concatenate. More...

bool | endsWith (char c) const
const UPStr & | replace (char which, char bywhich)
replace a character. More...

Protected Methods

void | flush (void)

Protected Attributes

char * | str
the String. More...

Detailed Description

up to 255 characters pascal and C string.

Definition at line 39 of file ustr.h.

Constructor & Destructor Documentation

UPStr::UPStr ( ) [inline]

Definition at line 42 of file ustr.h.

00042 : str(0L) {}

UPStr::UPStr ( const char * newstr ) [inline]

Definition at line 43 of file ustr.h.

00044     {
00045         str = 0L;
00046         *this = newstr;
00047     }

UPStr::UPStr ( const unsigned char * newstr ) [inline]

Definition at line 48 of file ustr.h.

00049     {
00050         str = 0L;
00051         *this = newstr;
00052     }

UPStr::UPStr ( const UPStr & newstr ) [inline]

Definition at line 53 of file ustr.h.

00054     {
00055         str = 0L;
00056         *this = newstr;
00057     }

virtual UPStr::~UPStr ( ) [inline, virtual]

Definition at line 58 of file ustr.h.

00058 {flush();}

Member Function Documentation

const char* UPStr::c_str ( void ) const [inline]

as a C string.

Definition at line 77 of file ustr.h.

00077 {return str == 0L ? "" : str + 1;}

bool UPStr::empty ( void ) const [inline]

Definition at line 60 of file ustr.h.

Referenced by CvsPrefs::ServerName(), and CvsPrefs::empty().

00060 {return str == 0L || str[0] == '\0';}

bool UPStr::endsWith ( char c ) const [inline]

Definition at line 96 of file ustr.h.

00096 {return str == 0L ? false : str[str[0]] == c;}

void UPStr::flush ( void ) [protected]

Definition at line 46 of file ustr.cpp.

Referenced by operator=(), and set().

00047 {
00048     if(str == 0L)
00049         return;
00050     free(str);
00051     str = 0L;
00052 }

unsigned int UPStr::length ( void ) const [inline]

Definition at line 61 of file ustr.h.

Referenced by PCStr::SizeOf(), CvsPrefs::length(), and operator<<().

00061 {return str == 0L ? 0 : (unsigned char)str[0];}

UPStr::operator char * ( void ) [inline]

as a C string.

Reimplemented in PCPStr.

Definition at line 75 of file ustr.h.

00075 {return str == 0L ? 0L : str + 1;}

UPStr::operator const char * ( ) const [inline]

as a C string.

Reimplemented in PCPStr.

Definition at line 73 of file ustr.h.

00073 {return str == 0L ? "" : str + 1;}

UPStr::operator const unsigned char * ( ) const [inline]

as a P string.

Reimplemented in PCPStr.

Definition at line 80 of file ustr.h.

00081         {return str == 0L ? (unsigned char *)"" : (unsigned char *)str;}

UPStr::operator unsigned char * ( ) [inline]

as a P string.

Reimplemented in PCPStr.

Definition at line 83 of file ustr.h.

00084         {return str == 0L ? (unsigned char *)"" : (unsigned char *)str;}

UPStr & UPStr::operator<< ( int addToStr )

concatenate.

Definition at line 177 of file ustr.cpp.

00178 {
00179     char astr[50];
00180     sprintf(astr, "%d", addToStr);
00181     return *this << astr;
00182 }

UPStr & UPStr::operator<< ( char addToStr )

concatenate.

Definition at line 170 of file ustr.cpp.

00171 {
00172     char astr[2] = {'\0', '\0'};
00173     astr[0] = addToStr;
00174     return *this << astr;
00175 }

UPStr & UPStr::operator<< ( const char * addToStr )

concatenate.

Definition at line 144 of file ustr.cpp.

00145 {
00146     if(addToStr == 0L)
00147         return *this;
00148
00149     if(str == 0L)
00150     {
00151         *this = addToStr;
00152         return *this;
00153     }
00154
00155     size_t len = strlen(addToStr);
00156     unsigned curlen = length();
00157     if(len + length() > kMaxChar)
00158         len = kMaxChar - length();
00159     if(len == 0)
00160         return *this;
00161
00162     str = (char *)realloc(str, (len + curlen + 2) * sizeof(char));
00163     memcpy(str + curlen + 1, addToStr, len * sizeof(char));
00164     str[0] = len + curlen;
00165     str[len + curlen + 1] = '\0';
00166
00167     return *this;
00168 }

const UPStr & UPStr::operator= ( const UPStr & newstr )

set according to another UPStr.

Definition at line 97 of file ustr.cpp.

00098 {
00099     *this = (const char *)newstr;
00100     return *this;
00101 }

const unsigned char * UPStr::operator= ( const unsigned char * newstr )

set to a new P String (0L is OK).

Reimplemented in PCPStr.

Definition at line 77 of file ustr.cpp.

00078 {
00079     if(newstr == 0L)
00080         newstr = (unsigned char *)"";
00081
00082     int l = newstr[0];
00083     char *newvalue = (char *)malloc((l + 2) * sizeof(char));
00084     if(newvalue == 0L)
00085         UTHROW(std::bad_alloc());
00086
00087     memcpy(newvalue + 1, (char *)newstr + 1, l * sizeof(char));
00088     newvalue[0] = l;
00089     newvalue[l + 1] = '\0';
00090
00091     flush();
00092     str = newvalue;
00093
00094     return *this;
00095 }

const char * UPStr::operator= ( const char * newstr )

set to a new C String (0L is OK).

Reimplemented in PCPStr.

Definition at line 54 of file ustr.cpp.

00055 {
00056     if(newstr == 0L)
00057         newstr = "";
00058
00059     size_t l = strlen(newstr);
00060     if(l > kMaxChar)
00061         l = kMaxChar;
00062
00063     char *newvalue = (char *)malloc((l + 2) * sizeof(char));
00064     if(newvalue == 0L)
00065         UTHROW(std::bad_alloc());
00066
00067     strncpy(newvalue + 1, newstr, l);
00068     newvalue[0] = l;
00069     newvalue[l + 1] = '\0';
00070
00071     flush();
00072     str = newvalue;
00073
00074     return *this;
00075 }

const unsigned char* UPStr::p_str ( ) const [inline]

as a P string.

Definition at line 86 of file ustr.h.

00087         {return str == 0L ? (unsigned char *)"" : (unsigned char *)str;}

const UPStr & UPStr::replace | ( | char | which,
 |  | char | bywhich
 | ) |

replace a character.

Definition at line 128 of file ustr.cpp.

00129 {
00130     if(str == 0L)
00131         return *this;
00132
00133     char *buf = str + 1;
00134     while(*buf)
00135     {
00136         if(*buf == which)
00137             *buf++ = bywhich;
00138         else
00139             buf++;
00140     }
00141     return *this;
00142 }

const UPStr & UPStr::set | ( | const char * | buf,
 |  | unsigned int | len
 | ) |

set from a buffer.

Definition at line 103 of file ustr.cpp.

00104 {
00105     flush();
00106     if(len == 0)
00107     {
00108         *this = "";
00109         return *this;
00110     }
00111     if(len > kMaxChar)
00112         len = kMaxChar;
00113
00114     str = (char *)malloc((len + 2) * sizeof(char));
00115     if(str == 0L)
00116     {
00117         UAppConsole("Impossible to allocate %d bytes !\n", (len + 2) * sizeof(char));
00118         return *this;
00119     }
00120
00121     memcpy(str + 1, buf, len * sizeof(char));
00122     str[0] = len;
00123     str[len + 1] = '\0';
00124
00125     return *this;
00126 }

Member Data Documentation

char* UPStr::str [protected]

the String.

Definition at line 105 of file ustr.h.

The documentation for this class was generated from the following files:
  • rf/ustr.h
  • rf/ustr.cpp
Generated on Sun Oct 21 12:49:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TemplatePyAutoObject class Reference

PyAutoObject Class Template Reference

#include <PythonContainer.h>

Collaboration diagram for PyAutoObject:

[legend]
List of all members.

Public Methods

PyAutoObject ()
PyAutoObject (T *o)
PyAutoObject (PyObject *o)
PyAutoObject (PyAutoObject &obj)
operator T * () const
~PyAutoObject ()
PyAutoObject & | operator= (T *o)
PyAutoObject & | operator= (PyObject *o)
PyAutoObject & | operator= (PyAutoObject &obj)
PyObject * | CopyReturn (void)
bool | IsValid (void)
T * | operator-> (void)

Protected Methods

void | Ref (void)
void | UnRef (void)

Protected Attributes

T * | m_o

template<class T>
class PyAutoObject< T >

Constructor & Destructor Documentation

template<class T>
PyAutoObject< T >::PyAutoObject ( ) [inline]

Definition at line 99 of file PythonContainer.h.

00099                           : m_o(NULL)
00100     {
00101     }

template<class T>
PyAutoObject< T >::PyAutoObject ( T * o ) [inline]

Definition at line 103 of file PythonContainer.h.

00103                               : m_o(o)
00104     {
00105         Ref();
00106     }

template<class T>
PyAutoObject< T >::PyAutoObject ( PyObject * o ) [inline]

Definition at line 108 of file PythonContainer.h.

00108                                      : m_o((T *)o)
00109     {
00110         Ref();
00111     }

template<class T>
PyAutoObject< T >::PyAutoObject ( PyAutoObject< T > & obj ) [inline]

Definition at line 113 of file PythonContainer.h.

00113                                             : m_o((T *)obj.CopyReturn())
00114     {
00115     }

template<class T>
PyAutoObject< T >::~PyAutoObject ( ) [inline]

Definition at line 119 of file PythonContainer.h.

00120     {
00121         UnRef();
00122     }

Member Function Documentation

template<class T>
PyObject* PyAutoObject< T >::CopyReturn ( void ) [inline]

Definition at line 147 of file PythonContainer.h.

Referenced by PyMenuMgr::AddPulldown(), PyPersistent::Create(), PyCmdUI::Create(), PyMenuMgr::Create(), PyColorConsole::Create(), PyCvsEntry::Create(), cvsgui_GetCvsEntries(), cvsgui_GetSelection(), cvsgui_GetTopMacroAdminMenu(), cvsgui_GetTopMacroSelectionMenu(), and operator=().

00148     {
00149         Ref();
00150         return (PyObject *)m_o;
00151     }

template<class T>
bool PyAutoObject< T >::IsValid ( void ) [inline]

Definition at line 153 of file PythonContainer.h.

Referenced by PyMenuMgr::AddPulldown(), PyPersistent::Create(), PyCmdUI::Create(), PyMenuMgr::Create(), PyColorConsole::Create(), PyCvsEntry::Create(), cvsgui_GetCvsEntries(), cvsgui_GetSelection(), cvsgui_GetTopMacroAdminMenu(), and cvsgui_GetTopMacroSelectionMenu().

00154     {
00155         return m_o != 0L;
00156     }

template<class T>
void PyAutoObject< T >::Ref ( void ) [inline, protected]

Definition at line 164 of file PythonContainer.h.

Referenced by CopyReturn(), PyAutoObject(), and operator=().

00165     {
00166         if(m_o)
00167             Py_INCREF(m_o);
00168     }

template<class T>
void PyAutoObject< T >::UnRef ( void ) [inline, protected]

Definition at line 170 of file PythonContainer.h.

Referenced by operator=(), and ~PyAutoObject().

00171     {
00172         if(m_o)
00173         {
00174             Py_DECREF(m_o);
00175             m_o = NULL;
00176         }
00177     }

template<class T>
PyAutoObject< T >::operator T * ( void ) const [inline]

Definition at line 117 of file PythonContainer.h.

00117 { return m_o; }

template<class T>
T* PyAutoObject< T >::operator-> ( void ) [inline]

Definition at line 158 of file PythonContainer.h.

00159     {
00160         return m_o;
00161     }

template<class T>
PyAutoObject& PyAutoObject< T >::operator= ( PyAutoObject< T > & obj ) [inline]

Definition at line 140 of file PythonContainer.h.

00141     {
00142         UnRef();
00143         m_o = (T *)obj.CopyReturn();
00144         return *this;
00145     }

template<class T>
PyAutoObject& PyAutoObject< T >::operator= ( PyObject * o ) [inline]

Definition at line 132 of file PythonContainer.h.

00133     {
00134         UnRef();
00135         m_o = (T *)o;
00136         Ref();
00137         return *this;
00138     }

template<class T>
PyAutoObject& PyAutoObject< T >::operator= ( T * o ) [inline]

Definition at line 124 of file PythonContainer.h.

00125     {
00126         UnRef();
00127         m_o = o;
00128         Ref();
00129         return *this;
00130     }

Member Data Documentation

template<class T>
T* PyAutoObject::m_o [protected]

Definition at line 179 of file PythonContainer.h.

The documentation for this class was generated from the following file:
  • common/PythonContainer.h
Generated on Sun Oct 21 12:49:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyCmdUI Class Reference

#include <PythonImpl.h>

Inheritance diagram for PyCmdUI:

[legend]
Collaboration diagram for PyCmdUI:

[legend]
List of all members.

Public Methods

PyObject * | Enable (PyObject *args)
PyObject * | SetCheck (PyObject *args)
PyObject * | SetText (PyObject *args)
PyCmdUI (UCmdUI *cmdui)
virtual | ~PyCmdUI ()

Static Public Methods

void | dealloc (obj_t *self)
PyObject * | getattr (obj_t *self, char *name)
PyAutoObject< obj_t > | New (void)
PyTypeObject * | GetType (void)
PyObject * | Create (PyObject *selfptr, PyObject *args)
void | InitValues (PyObject *d)
PyObject * | FindMethod (PyObject *self, char *name)

Static Public Attributes

const char * | m_doc = "Class to update an interface object state"
PyMethodDef | m_methods []
PyRegistry m_registry

Static Protected Methods

PyObject * | _Enable (obj_t *self, PyObject *args)
PyObject * | _SetCheck (obj_t *self, PyObject *args)
PyObject * | _SetText (obj_t *self, PyObject *args)

Protected Attributes

UCmdUI * m_cmdui

Constructor & Destructor Documentation

PyCmdUI::PyCmdUI ( UCmdUI * cmdui ) [inline]

Definition at line 101 of file PythonImpl.h.

00101                            : m_cmdui(cmdui)
00102     {
00103     }

virtual PyCmdUI::~PyCmdUI ( ) [inline, virtual]

Definition at line 105 of file PythonImpl.h.

00106     {
00107     }

Member Function Documentation

PyObject * PyCmdUI::Create | ( | PyObject * | selfptr,
 |  | PyObject * | args
 | ) | [static]

Definition at line 335 of file PythonImpl.cpp.

00336 {
00337     UCmdUI *cmdui;
00338
00339     if (!PyArg_ParseTuple(args, "i:CCmdUI", &cmdui))
00340         return NULL;
00341
00342     PyAutoObject<PyCmdUI::obj_t> self = PyCmdUI::New();
00343     if (!self.IsValid())
00344         return NULL;
00345
00346     TRY
00347     {
00348         self->m_object = new PyCmdUI(cmdui);
00349     }
00350     CATCH_ALL(e)
00351     {
00352         PyHandleCvsguiError(e);
00353         return NULL;
00354     }
00355     END_CATCH_ALL
00356
00357     return self.CopyReturn();
00358 }

PyObject * PyCmdUI::Enable ( PyObject * args )

Definition at line 364 of file PythonImpl.cpp.

00365 {
00366     int state;
00367
00368     if (!PyArg_ParseTuple(args, "i", &state))
00369         return NULL;
00370
00371     m_cmdui->Enable(state != 0);
00372
00373     return Void();
00374 }

PyObject* PyCmdUI::FindMethod | ( | PyObject * | self,
 |  | char * | name
 | ) | [inline, static]

Definition at line 96 of file PythonImpl.h.

00100 :

PyTypeObject* PyCmdUI::GetType ( void ) [inline, static]

Definition at line 96 of file PythonImpl.h.

00100 :

void PyCmdUI::InitValues ( PyObject * d ) [static]

Definition at line 360 of file PythonImpl.cpp.

00361 {
00362 }

PyAutoObject< PyCmdUI::obj_t > PyCmdUI::New ( void ) [static]

Definition at line 327 of file PythonImpl.cpp.

Referenced by Create().

PyObject * PyCmdUI::SetCheck ( PyObject * args )

Definition at line 376 of file PythonImpl.cpp.

00377 {
00378     int state;
00379
00380     if (!PyArg_ParseTuple(args, "i", &state))
00381         return NULL;
00382
00383     m_cmdui->Check(state != 0);
00384
00385     return Void();
00386 }

PyObject * PyCmdUI::SetText ( PyObject * args )

Definition at line 388 of file PythonImpl.cpp.

00389 {
00390     char *text;
00391
00392     if (!PyArg_ParseTuple(args, "s", &text))
00393         return NULL;
00394
00395     m_cmdui->SetText(text);
00396
00397     return Void();
00398 }

PyObject* PyCmdUI::_Enable | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 97 of file PythonImpl.h.

00100 :

PyObject* PyCmdUI::_SetCheck | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 98 of file PythonImpl.h.

00100 :

PyObject* PyCmdUI::_SetText | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 99 of file PythonImpl.h.

00100 :

void PyCmdUI::dealloc ( obj_t * self ) [static]

Definition at line 327 of file PythonImpl.cpp.

PyObject * PyCmdUI::getattr | ( | obj_t * | self,
 |  | char * | name
 | ) | [static]

Definition at line 327 of file PythonImpl.cpp.

Member Data Documentation

UCmdUI* PyCmdUI::m_cmdui [protected]

Definition at line 110 of file PythonImpl.h.

const char * PyCmdUI::m_doc = "Class to update an interface object state" [static]

Definition at line 327 of file PythonImpl.cpp.

PyMethodDef PyCmdUI::m_methods [static]

Initial value:

   {
    {"Enable", (binaryfunc)PyCmdUI ::_Enable , METH_VARARGS, (char *) "Enable/Disable the object" },
    {"SetCheck", (binaryfunc)PyCmdUI ::_SetCheck , METH_VARARGS, (char *) "Check/uncheck the object" },
    {"SetText", (binaryfunc)PyCmdUI ::_SetText , METH_VARARGS, (char *) "Rename the object" },
 {NULL, NULL}   }

Definition at line 329 of file PythonImpl.cpp.

PyRegistry PyCmdUI::m_registry [static]

The documentation for this class was generated from the following files:
  • common/PythonImpl.h
  • common/PythonImpl.cpp
Generated on Sun Oct 21 12:49:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyCmdUI::obj_t Struct Reference

#include <PythonImpl.h>

Collaboration diagram for PyCmdUI::obj_t:

[legend]
List of all members.

Public Attributes

PyObject_HEAD PyCmdUI * m_object

Member Data Documentation

PyObject_HEAD PyCmdUI* PyCmdUI::obj_t::m_object

Definition at line 96 of file PythonImpl.h.

The documentation for this struct was generated from the following file:
  • common/PythonImpl.h
Generated on Sun Oct 21 12:49:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyColorConsole Class Reference

#include <PythonImpl.h>

Inheritance diagram for PyColorConsole:

[legend]
Collaboration diagram for PyColorConsole:

[legend]
List of all members.

Public Methods

PyObject * | Print (PyObject *args)
PyColorConsole ()
virtual | ~PyColorConsole ()

Static Public Methods

void | dealloc (obj_t *self)
PyObject * | getattr (obj_t *self, char *name)
PyAutoObject< obj_t > | New (void)
PyTypeObject * | GetType (void)
PyObject * | Create (PyObject *selfptr, PyObject *args)
void | InitValues (PyObject *d)
PyObject * | FindMethod (PyObject *self, char *name)

Static Public Attributes

const char * | m_doc = "Class printing in color in the console"
PyMethodDef | m_methods []
PyRegistry m_registry

Static Protected Methods

PyObject * | _Print (obj_t *self, PyObject *args)

Protected Attributes

CColorConsole m_console

Constructor & Destructor Documentation

PyColorConsole::PyColorConsole ( ) [inline]

Definition at line 57 of file PythonImpl.h.

00058     {
00059     }

virtual PyColorConsole::~PyColorConsole ( ) [inline, virtual]

Definition at line 61 of file PythonImpl.h.

00062     {
00063     }

Member Function Documentation

PyObject * PyColorConsole::Create | ( | PyObject * | selfptr,
 |  | PyObject * | args
 | ) | [static]

Definition at line 124 of file PythonImpl.cpp.

00125 {
00126     if (!PyArg_ParseTuple(args, ":CColorConsole"))
00127         return NULL;
00128
00129     PyAutoObject<PyColorConsole::obj_t> self = PyColorConsole::New();
00130     if (!self.IsValid())
00131         return NULL;
00132
00133     TRY
00134     {
00135         self->m_object = new PyColorConsole();
00136     }
00137     CATCH_ALL(e)
00138     {
00139         PyHandleCvsguiError(e);
00140         return NULL;
00141     }
00142     END_CATCH_ALL
00143
00144     return self.CopyReturn();
00145 }

PyObject* PyColorConsole::FindMethod | ( | PyObject * | self,
 |  | char * | name
 | ) | [inline, static]

Definition at line 54 of file PythonImpl.h.

00056 :

PyTypeObject* PyColorConsole::GetType ( void ) [inline, static]

Definition at line 54 of file PythonImpl.h.

00056 :

void PyColorConsole::InitValues ( PyObject * d ) [static]

Definition at line 148 of file PythonImpl.cpp.

00149 {
00150     RegisterValue(d, "kNormal", kNormal);
00151     RegisterValue(d, "kBrown", kBrown);
00152     RegisterValue(d, "kGreen", kGreen);
00153     RegisterValue(d, "kMagenta", kMagenta);
00154     RegisterValue(d, "kRed", kRed);
00155     RegisterValue(d, "kBlue", kBlue);
00156     RegisterValue(d, "kBold", kBold);
00157     RegisterValue(d, "kItalic", kItalic);
00158     RegisterValue(d, "kUnderline", kUnderline);
00159     RegisterValue(d, "kNL", kNL);
00160 }

PyAutoObject< PyColorConsole::obj_t > PyColorConsole::New ( void ) [static]

Definition at line 118 of file PythonImpl.cpp.

Referenced by Create().

PyObject * PyColorConsole::Print ( PyObject * args )

Definition at line 162 of file PythonImpl.cpp.

00163 {
00164     int style;
00165
00166     if(PyArg_ParseTuple(args, "i", &style))
00167     {
00168         m_console << kConsoleColor(style);
00169         return Void();
00170     }
00171
00172     PyErr_Clear();
00173
00174     char *str;
00175     if(PyArg_ParseTuple(args, "s", &str))
00176     {
00177         m_console << str;
00178         return Void();
00179     }
00180
00181     return NULL;
00182 }

PyObject* PyColorConsole::_Print | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 55 of file PythonImpl.h.

00056 :

void PyColorConsole::dealloc ( obj_t * self ) [static]

Definition at line 118 of file PythonImpl.cpp.

PyObject * PyColorConsole::getattr | ( | obj_t * | self,
 |  | char * | name
 | ) | [static]

Definition at line 118 of file PythonImpl.cpp.

Member Data Documentation

CColorConsole PyColorConsole::m_console [protected]

Definition at line 66 of file PythonImpl.h.

const char * PyColorConsole::m_doc = "Class printing in color in the console" [static]

Definition at line 118 of file PythonImpl.cpp.

PyMethodDef PyColorConsole::m_methods [static]

Initial value:

   {
    {"Print", (binaryfunc)PyColorConsole ::_Print , METH_VARARGS, (char *) "Print in color" },
 {NULL, NULL}   }

Definition at line 120 of file PythonImpl.cpp.

PyRegistry PyColorConsole::m_registry [static]

The documentation for this class was generated from the following files:
  • common/PythonImpl.h
  • common/PythonImpl.cpp
Generated on Sun Oct 21 12:49:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyColorConsole::obj_t Struct Reference

#include <PythonImpl.h>

Collaboration diagram for PyColorConsole::obj_t:

[legend]
List of all members.

Public Attributes

PyObject_HEAD PyColorConsole * m_object

Member Data Documentation

PyObject_HEAD PyColorConsole* PyColorConsole::obj_t::m_object

Definition at line 54 of file PythonImpl.h.

The documentation for this struct was generated from the following file:
  • common/PythonImpl.h
Generated on Sun Oct 21 12:49:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyContainer Class Reference

#include <PythonContainer.h>

Inheritance diagram for PyContainer:

[legend]
List of all members.

Public Methods

PyContainer ()
virtual | ~PyContainer ()
virtual PyObject * | GetAttr (char *name)

Static Public Methods

PyObject * | True ()
PyObject * | False ()
PyObject * | Void ()
void | RegisterValue (PyObject *d, char *name, int value)

Constructor & Destructor Documentation

PyContainer::PyContainer ( ) [inline]

Definition at line 79 of file PythonContainer.h.

00079 {}

virtual PyContainer::~PyContainer ( ) [inline, virtual]

Definition at line 80 of file PythonContainer.h.

00080 {}

Member Function Documentation

PyObject* PyContainer::False ( ) [inline, static]

Definition at line 86 of file PythonContainer.h.

Referenced by PyCvsEntry::GetAttr(), and cvsgui_PromptMessage().

00086 { Py_INCREF(GetPyFalse()); return GetPyFalse(); }

virtual PyObject* PyContainer::GetAttr ( char * name ) [inline, virtual]

Reimplemented in PyCvsEntry.

Definition at line 82 of file PythonContainer.h.

00082 { return NULL; }

void PyContainer::RegisterValue | ( | PyObject * | d,
 |  | char * | name,
 |  | int | value
 | ) | [static]

Definition at line 96 of file PythonContainer.cpp.

Referenced by PyColorConsole::InitValues().

00097 {
00098     PyObject *v = PyInt_FromLong((long) value);
00099     if (v == NULL) {
00100         /* Don't bother reporting this error */
00101         PyErr_Clear();
00102     }
00103     else {
00104         PyDict_SetItemString(d, name, v);
00105         Py_DECREF(v);
00106     }
00107 }

PyObject* PyContainer::True ( ) [inline, static]

Definition at line 85 of file PythonContainer.h.

Referenced by PyCvsEntry::GetAttr(), and cvsgui_PromptMessage().

00085 { Py_INCREF(GetPyTrue()); return GetPyTrue(); }

PyObject* PyContainer::Void ( ) [inline, static]

Definition at line 87 of file PythonContainer.h.

Referenced by PyMenuMgr::AddButton(), PyMenuMgr::AddSeparator(), PyMenuMgr::AddToggle(), PyMenuMgr::Delete(), PyMenuMgr::DeleteByCmd(), PyCmdUI::Enable(), PyColorConsole::Print(), PyCmdUI::SetCheck(), PyCmdUI::SetText(), PyPersistent::SetValue(), cvsgui_GetHistoryAsXML(), cvsgui_LaunchBrowser(), cvsgui_LaunchTclMacro(), and cvsgui_write().

00087 { Py_INCREF(GetPyNone()); return GetPyNone(); }

The documentation for this class was generated from the following files:
  • common/PythonContainer.h
  • common/PythonContainer.cpp
Generated on Sun Oct 21 12:49:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPyCvsConsole Class Reference

Inheritance diagram for CPyCvsConsole:

[legend]
Collaboration diagram for CPyCvsConsole:

[legend]
List of all members.

Public Methods

CPyCvsConsole ()
virtual | ~CPyCvsConsole ()
virtual long | cvs_out (char *txt, long len)
virtual long | cvs_err (char *txt, long len)

Public Attributes

CBuffer m_out
CBuffer m_err

Constructor & Destructor Documentation

CPyCvsConsole::CPyCvsConsole ( ) [inline]

Definition at line 507 of file PythonGlue.cpp.

00507 {}

virtual CPyCvsConsole::~CPyCvsConsole ( ) [inline, virtual]

Definition at line 508 of file PythonGlue.cpp.

00508 {}

Member Function Documentation

virtual long CPyCvsConsole::cvs_err | ( | char * | txt,
 |  | long | len
 | ) | [inline, virtual]

Reimplemented from CCvsConsole.

Definition at line 516 of file PythonGlue.cpp.

00517     {
00518         m_err.append(txt, len);
00519         return len;
00520     }

virtual long CPyCvsConsole::cvs_out | ( | char * | txt,
 |  | long | len
 | ) | [inline, virtual]

Reimplemented from CCvsConsole.

Definition at line 510 of file PythonGlue.cpp.

00511     {
00512         m_out.append(txt, len);
00513         return len;
00514     }

Member Data Documentation

CBuffer CPyCvsConsole::m_err

Definition at line 523 of file PythonGlue.cpp.

Referenced by cvsgui_RunCvs().

CBuffer CPyCvsConsole::m_out

Definition at line 522 of file PythonGlue.cpp.

Referenced by cvsgui_RunCvs().

The documentation for this class was generated from the following file:
  • common/PythonGlue.cpp
Generated on Sun Oct 21 12:49:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyCvsEntry Class Reference

#include <PythonImpl.h>

Inheritance diagram for PyCvsEntry:

[legend]
Collaboration diagram for PyCvsEntry:

[legend]
List of all members.

Public Methods

PyCvsEntry (EntnodeData *data)
virtual | ~PyCvsEntry ()
virtual PyObject * | GetAttr (char *name)
operator EntnodeData * (void) const

Static Public Methods

void | dealloc (obj_t *self)
PyObject * | getattr (obj_t *self, char *name)
PyAutoObject< obj_t > | New (void)
PyTypeObject * | GetType (void)
PyObject * | Create (PyObject *selfptr, PyObject *args)
void | InitValues (PyObject *d)
PyObject * | FindMethod (PyObject *self, char *name)

Static Public Attributes

const char * | m_doc = "Class for an entry in CVS/Entries"
PyMethodDef | m_methods []
PyRegistry m_registry

Protected Attributes

ENTNODE m_data

Constructor & Destructor Documentation

PyCvsEntry::PyCvsEntry ( EntnodeData * data ) [inline]

Definition at line 36 of file PythonImpl.h.

00036                                   : m_data(data)
00037     {
00038     }

virtual PyCvsEntry::~PyCvsEntry ( ) [inline, virtual]

Definition at line 40 of file PythonImpl.h.

00041     {
00042     }

Member Function Documentation

PyObject * PyCvsEntry::Create | ( | PyObject * | selfptr,
 |  | PyObject * | args
 | ) | [static]

Definition at line 34 of file PythonImpl.cpp.

00035 {
00036     if (!PyArg_ParseTuple(args, ":CCvsEntry"))
00037         return NULL;
00038
00039     PyAutoObject<PyCvsEntry::obj_t> self = PyCvsEntry::New();
00040     if (!self.IsValid())
00041         return NULL;
00042
00043     TRY
00044     {
00045         self->m_object = new PyCvsEntry(0L);
00046     }
00047     CATCH_ALL(e)
00048     {
00049         PyHandleCvsguiError(e);
00050         return NULL;
00051     }
00052     END_CATCH_ALL
00053
00054     return self.CopyReturn();
00055 }

PyObject* PyCvsEntry::FindMethod | ( | PyObject * | self,
 |  | char * | name
 | ) | [inline, static]

Definition at line 34 of file PythonImpl.h.

00035 :

PyObject * PyCvsEntry::GetAttr ( char * name ) [virtual]

Reimplemented from PyContainer.

Definition at line 61 of file PythonImpl.cpp.

00062 {
00063     UStr buf;
00064     EntnodeData *data = m_data;
00065
00066     if(strcmp(name, "name") == 0)
00067         return PyString_FromString(data->GetName());
00068     else if(strcmp(name, "fullname") == 0)
00069         return PyString_FromString(data->GetFullPathName(buf));
00070     else if(strcmp(name, "version") == 0)
00071     {
00072         const char *str = (*data)[EntnodeFile::kVN];
00073         return PyString_FromString(str ? str : "");
00074     }
00075     else if(strcmp(name, "timeutc") == 0)
00076     {
00077         const char *str = (*data)[EntnodeFile::kTS];
00078         return PyString_FromString(str ? str : "");
00079     }
00080     else if(strcmp(name, "keyword") == 0)
00081     {
00082         const char *str = (*data)[EntnodeFile::kOption];
00083         return PyString_FromString(str ? str : "");
00084     }
00085     else if(strcmp(name, "tag") == 0)
00086     {
00087         const char *str = (*data)[EntnodeFile::kTag];
00088         return PyString_FromString(str ? str : "");
00089     }
00090     else if(strcmp(name, "isfile") == 0)
00091         return data->GetType() == ENT_FILE ? True() : False();
00092     else if(strcmp(name, "modified") == 0)
00093         return data->IsUnmodified() ? False() : True();
00094     else if(strcmp(name, "missing") == 0)
00095         return data->IsMissing() ? True() : False();
00096     else if(strcmp(name, "unknown") == 0)
00097         return data->IsUnknown() ? True() : False();
00098     else if(strcmp(name, "ignored") == 0)
00099         return data->IsIgnored() ? True() : False();
00100     else if(strcmp(name, "readonly") == 0)
00101         return data->IsLocked() ? True() : False();
00102     else if(strcmp(name, "removed") == 0)
00103         return data->IsRemoved() ? True() : False();
00104     else if(strcmp(name, "added") == 0)
00105     {
00106         const char* vn = (*data)[EntnodeFile::kVN];
00107         bool isAdded = vn && (strcmp(vn, "0") == 0);
00108         return isAdded ? True() : False();
00109     }
00110     else if(strcmp(name, "desc") == 0)
00111         return PyString_FromString(data->GetDesc() ? data->GetDesc() : "");
00112     else if(strcmp(name, "conflict") == 0)
00113         return PyString_FromString(data->GetConflict() ? data->GetConflict() : "");
00114
00115     return NULL;
00116 }

PyTypeObject* PyCvsEntry::GetType ( void ) [inline, static]

Definition at line 34 of file PythonImpl.h.

00035 :

void PyCvsEntry::InitValues ( PyObject * d ) [static]

Definition at line 57 of file PythonImpl.cpp.

00058 {
00059 }

PyAutoObject< PyCvsEntry::obj_t > PyCvsEntry::New ( void ) [static]

Definition at line 29 of file PythonImpl.cpp.

Referenced by Create(), cvsgui_GetCvsEntries(), and cvsgui_GetSelection().

void PyCvsEntry::dealloc ( obj_t * self ) [static]

Definition at line 29 of file PythonImpl.cpp.

PyObject * PyCvsEntry::getattr | ( | obj_t * | self,
 |  | char * | name
 | ) | [static]

Definition at line 29 of file PythonImpl.cpp.

PyCvsEntry::operator EntnodeData * ( void ) const [inline]

Definition at line 46 of file PythonImpl.h.

00046 { return m_data; }

Member Data Documentation

ENTNODE PyCvsEntry::m_data [protected]

Definition at line 49 of file PythonImpl.h.

const char * PyCvsEntry::m_doc = "Class for an entry in CVS/Entries" [static]

Definition at line 29 of file PythonImpl.cpp.

PyMethodDef PyCvsEntry::m_methods [static]

Initial value:

   {
 {NULL, NULL}   }

Definition at line 31 of file PythonImpl.cpp.

PyRegistry PyCvsEntry::m_registry [static]

The documentation for this class was generated from the following files:
  • common/PythonImpl.h
  • common/PythonImpl.cpp
Generated on Sun Oct 21 12:49:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyCvsEntry::obj_t Struct Reference

#include <PythonImpl.h>

Collaboration diagram for PyCvsEntry::obj_t:

[legend]
List of all members.

Public Attributes

PyObject_HEAD PyCvsEntry * m_object

Member Data Documentation

PyObject_HEAD PyCvsEntry* PyCvsEntry::obj_t::m_object

Definition at line 34 of file PythonImpl.h.

The documentation for this struct was generated from the following file:
  • common/PythonImpl.h
Generated on Sun Oct 21 12:49:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyMenuMgr Class Reference

#include <PythonImpl.h>

Inheritance diagram for PyMenuMgr:

[legend]
Collaboration diagram for PyMenuMgr:

[legend]
List of all members.

Public Methods

PyObject * | AddPulldown (PyObject *args)
PyObject * | AddToggle (PyObject *args)
PyObject * | AddButton (PyObject *args)
PyObject * | AddSeparator (PyObject *args)
PyObject * | Delete (PyObject *args)
PyObject * | DeleteByCmd (PyObject *args)
PyObject * | Count (PyObject *args)
PyMenuMgr (UMENU menu)
virtual | ~PyMenuMgr ()
operator UMENU () const

Static Public Methods

void | dealloc (obj_t *self)
PyObject * | getattr (obj_t *self, char *name)
PyAutoObject< obj_t > | New (void)
PyTypeObject * | GetType (void)
PyObject * | Create (PyObject *selfptr, PyObject *args)
void | InitValues (PyObject *d)
PyObject * | FindMethod (PyObject *self, char *name)

Static Public Attributes

const char * | m_doc = "Class to manipulate menus"
PyMethodDef | m_methods []
PyRegistry m_registry

Static Protected Methods

PyObject * | _AddPulldown (obj_t *self, PyObject *args)
PyObject * | _AddToggle (obj_t *self, PyObject *args)
PyObject * | _AddButton (obj_t *self, PyObject *args)
PyObject * | _AddSeparator (obj_t *self, PyObject *args)
PyObject * | _Delete (obj_t *self, PyObject *args)
PyObject * | _DeleteByCmd (obj_t *self, PyObject *args)
PyObject * | _Count (obj_t *self, PyObject *args)

Protected Attributes

UMENU m_menu

Constructor & Destructor Documentation

PyMenuMgr::PyMenuMgr ( UMENU menu ) [inline]

Definition at line 81 of file PythonImpl.h.

Referenced by AddPulldown(), and Create().

00081                           : m_menu(menu)
00082     {
00083     }

virtual PyMenuMgr::~PyMenuMgr ( ) [inline, virtual]

Definition at line 85 of file PythonImpl.h.

00086     {
00087     }

Member Function Documentation

PyObject * PyMenuMgr::AddButton ( PyObject * args )

Definition at line 266 of file PythonImpl.cpp.

00267 {
00268     int widid, cmd;
00269     char *name, *pixmap = 0L;
00270
00271     if (!PyArg_ParseTuple(args, "isi|s", &widid, &name, &cmd, &pixmap))
00272         return NULL;
00273
00274     UMenuAddButton(widid, name, m_menu, pixmap, cmd);
00275
00276     return Void();
00277 }

PyObject * PyMenuMgr::AddPulldown ( PyObject * args )

Definition at line 236 of file PythonImpl.cpp.

00237 {
00238     int widid;
00239     char *name;
00240
00241     if (!PyArg_ParseTuple(args, "is", &widid, &name))
00242         return NULL;
00243
00244     PyAutoObject<PyMenuMgr::obj_t> res = PyMenuMgr::New();
00245     if (!res.IsValid())
00246         return NULL;
00247
00248     res->m_object = new PyMenuMgr(UMenuAddPulldown(widid, name, m_menu));
00249
00250     return res.CopyReturn();
00251 }

PyObject * PyMenuMgr::AddSeparator ( PyObject * args )

Definition at line 279 of file PythonImpl.cpp.

00280 {
00281     int widid;
00282
00283     if (!PyArg_ParseTuple(args, "i", &widid))
00284         return NULL;
00285
00286     UMenuAddSeparator(widid, m_menu);
00287
00288     return Void();
00289 }

PyObject * PyMenuMgr::AddToggle ( PyObject * args )

Definition at line 253 of file PythonImpl.cpp.

00254 {
00255     int widid, cmd;
00256     char *name, *pixmap = 0L;
00257
00258     if (!PyArg_ParseTuple(args, "isi|s", &widid, &name, &cmd, &pixmap))
00259         return NULL;
00260
00261     UMenuAddToggle(widid, name, m_menu, pixmap, cmd);
00262
00263     return Void();
00264 }

PyObject * PyMenuMgr::Count ( PyObject * args )

Definition at line 315 of file PythonImpl.cpp.

00316 {
00317     int res;
00318
00319     if (!PyArg_ParseTuple(args, ""))
00320         return NULL;
00321
00322     res = UMenuCount(m_menu);
00323
00324     return PyInt_FromLong(res);
00325 }

PyObject * PyMenuMgr::Create | ( | PyObject * | selfptr,
 |  | PyObject * | args
 | ) | [static]

Definition at line 207 of file PythonImpl.cpp.

00208 {
00209     UMENU menu;
00210
00211     if (!PyArg_ParseTuple(args, "i:CMenuMgr", &menu))
00212         return NULL;
00213
00214     PyAutoObject<PyMenuMgr::obj_t> self = PyMenuMgr::New();
00215     if (!self.IsValid())
00216         return NULL;
00217
00218     TRY
00219     {
00220         self->m_object = new PyMenuMgr(menu);
00221     }
00222     CATCH_ALL(e)
00223     {
00224         PyHandleCvsguiError(e);
00225         return NULL;
00226     }
00227     END_CATCH_ALL
00228
00229     return self.CopyReturn();
00230 }

PyObject * PyMenuMgr::Delete ( PyObject * args )

Definition at line 291 of file PythonImpl.cpp.

00292 {
00293     int afterIndex;
00294
00295     if (!PyArg_ParseTuple(args, "i", &afterIndex))
00296         return NULL;
00297
00298     UMenuDelete(m_menu, afterIndex);
00299
00300     return Void();
00301 }

PyObject * PyMenuMgr::DeleteByCmd ( PyObject * args )

Definition at line 303 of file PythonImpl.cpp.

00304 {
00305     int cmd;
00306
00307     if (!PyArg_ParseTuple(args, "i", &cmd))
00308         return NULL;
00309
00310     UMenuDeleteByCmd(m_menu, cmd);
00311
00312     return Void();
00313 }

PyObject* PyMenuMgr::FindMethod | ( | PyObject * | self,
 |  | char * | name
 | ) | [inline, static]

Definition at line 71 of file PythonImpl.h.

00080 :

PyTypeObject* PyMenuMgr::GetType ( void ) [inline, static]

Definition at line 71 of file PythonImpl.h.

Referenced by ParseUMENU().

00080 :

void PyMenuMgr::InitValues ( PyObject * d ) [static]

Definition at line 232 of file PythonImpl.cpp.

00233 {
00234 }

PyAutoObject< PyMenuMgr::obj_t > PyMenuMgr::New ( void ) [static]

Definition at line 184 of file PythonImpl.cpp.

Referenced by AddPulldown(), Create(), cvsgui_GetTopMacroAdminMenu(), and cvsgui_GetTopMacroSelectionMenu().

00197 {

PyObject* PyMenuMgr::_AddButton | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 74 of file PythonImpl.h.

00080 :

PyObject* PyMenuMgr::_AddPulldown | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 72 of file PythonImpl.h.

00080 :

PyObject* PyMenuMgr::_AddSeparator | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 75 of file PythonImpl.h.

00080 :

PyObject* PyMenuMgr::_AddToggle | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 73 of file PythonImpl.h.

00080 :

PyObject* PyMenuMgr::_Count | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 78 of file PythonImpl.h.

00080 :

PyObject* PyMenuMgr::_Delete | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 76 of file PythonImpl.h.

00080 :

PyObject* PyMenuMgr::_DeleteByCmd | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 77 of file PythonImpl.h.

00080 :

void PyMenuMgr::dealloc ( obj_t * self ) [static]

Definition at line 184 of file PythonImpl.cpp.

00197 {

PyObject * PyMenuMgr::getattr | ( | obj_t * | self,
 |  | char * | name
 | ) | [static]

Definition at line 184 of file PythonImpl.cpp.

00197 {

PyMenuMgr::operator UMENU ( ) const [inline]

Definition at line 89 of file PythonImpl.h.

00089 { return m_menu; }

Member Data Documentation

const char * PyMenuMgr::m_doc = "Class to manipulate menus" [static]

Definition at line 184 of file PythonImpl.cpp.

UMENU PyMenuMgr::m_menu [protected]

Definition at line 91 of file PythonImpl.h.

PyMethodDef PyMenuMgr::m_methods [static]

Initial value:

   {
    {"AddPulldown", (binaryfunc)PyMenuMgr ::_AddPulldown , METH_VARARGS, (char *) "Add a new menu" },
    {"AddToggle", (binaryfunc)PyMenuMgr ::_AddToggle , METH_VARARGS, (char *) "Add a toggle menu entry" },
    {"AddButton", (binaryfunc)PyMenuMgr ::_AddButton , METH_VARARGS, (char *) "Add a regular menu entry" },
    {"AddSeparator", (binaryfunc)PyMenuMgr ::_AddSeparator , METH_VARARGS, (char *) "Add a separator menu entry" },
    {"Delete", (binaryfunc)PyMenuMgr ::_Delete , METH_VARARGS, (char *) "Delete a menu entry by index" },
    {"DeleteByCmd", (binaryfunc)PyMenuMgr ::_DeleteByCmd , METH_VARARGS, (char *) "Delete a menu entry by command" },
    {"Count", (binaryfunc)PyMenuMgr ::_Count , METH_VARARGS, (char *) "Count the number of entries in the menu" },
 {NULL, NULL}   }

Definition at line 186 of file PythonImpl.cpp.

PyRegistry PyMenuMgr::m_registry [static]

The documentation for this class was generated from the following files:
  • common/PythonImpl.h
  • common/PythonImpl.cpp
Generated on Sun Oct 21 12:49:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyMenuMgr::obj_t Struct Reference

#include <PythonImpl.h>

Collaboration diagram for PyMenuMgr::obj_t:

[legend]
List of all members.

Public Attributes

PyObject_HEAD PyMenuMgr * m_object

Member Data Documentation

PyObject_HEAD PyMenuMgr* PyMenuMgr::obj_t::m_object

Definition at line 71 of file PythonImpl.h.

The documentation for this struct was generated from the following file:
  • common/PythonImpl.h
Generated on Sun Oct 21 12:49:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyPersistent Class Reference

#include <PythonImpl.h>

Inheritance diagram for PyPersistent:

[legend]
Collaboration diagram for PyPersistent:

[legend]
List of all members.

Public Methods

PyObject * | GetValue (PyObject *args)
PyObject * | SetValue (PyObject *args)
PyPersistent (const char *uniqueName, const char *defValue, kClassPersistent pclass)
virtual | ~PyPersistent ()

Static Public Methods

void | dealloc (obj_t *self)
PyObject * | getattr (obj_t *self, char *name)
PyAutoObject< obj_t > | New (void)
PyTypeObject * | GetType (void)
PyObject * | Create (PyObject *selfptr, PyObject *args)
void | InitValues (PyObject *d)
PyObject * | FindMethod (PyObject *self, char *name)

Static Public Attributes

const char * | m_doc = "Class to store persistent values on disk"
PyMethodDef | m_methods []
PyRegistry m_registry

Static Protected Methods

PyObject * | _GetValue (obj_t *self, PyObject *args)
PyObject * | _SetValue (obj_t *self, PyObject *args)

Protected Attributes

PCStr m_cstr

Constructor & Destructor Documentation

PyPersistent::PyPersistent | ( | const char * | uniqueName,
 |  | const char * | defValue,
 |  | kClassPersistent | pclass
 | ) | [inline]

Definition at line 119 of file PythonImpl.h.

00119                                                                                         :
00120         m_cstr(uniqueName, defValue, pclass)
00121     {
00122     }

virtual PyPersistent::~PyPersistent ( ) [inline, virtual]

Definition at line 124 of file PythonImpl.h.

00125     {
00126     }

Member Function Documentation

PyObject * PyPersistent::Create | ( | PyObject * | selfptr,
 |  | PyObject * | args
 | ) | [static]

Definition at line 407 of file PythonImpl.cpp.

00408 {
00409     char *uniqueName, *defValue = 0L;
00410     int addToSettings = 0;
00411
00412     if (!PyArg_ParseTuple(args, "s|si:CPersistent", &uniqueName, &defValue,
00413         &addToSettings))
00414         return NULL;
00415
00416     PyAutoObject<PyPersistent::obj_t> self = PyPersistent::New();
00417     if (!self.IsValid())
00418         return NULL;
00419
00420     TRY
00421     {
00422         self->m_object = new PyPersistent(uniqueName, defValue,
00423             addToSettings ? kAddSettings : kNoClass);
00424     }
00425     CATCH_ALL(e)
00426     {
00427         PyHandleCvsguiError(e);
00428         return NULL;
00429     }
00430     END_CATCH_ALL
00431
00432     return self.CopyReturn();
00433 }

PyObject* PyPersistent::FindMethod | ( | PyObject * | self,
 |  | char * | name
 | ) | [inline, static]

Definition at line 115 of file PythonImpl.h.

00118 :

PyTypeObject* PyPersistent::GetType ( void ) [inline, static]

Definition at line 115 of file PythonImpl.h.

00118 :

PyObject * PyPersistent::GetValue ( PyObject * args )

Definition at line 452 of file PythonImpl.cpp.

00453 {
00454     if (!PyArg_ParseTuple(args, ""))
00455         return NULL;
00456
00457     return PyString_FromString(m_cstr);
00458 }

void PyPersistent::InitValues ( PyObject * d ) [static]

Definition at line 435 of file PythonImpl.cpp.

00436 {
00437 }

PyAutoObject< PyPersistent::obj_t > PyPersistent::New ( void ) [static]

Definition at line 400 of file PythonImpl.cpp.

Referenced by Create().

PyObject * PyPersistent::SetValue ( PyObject * args )

Definition at line 439 of file PythonImpl.cpp.

00440 {
00441     char *s;
00442
00443     if (!PyArg_ParseTuple(args, "s", &s))
00444         return NULL;
00445
00446     m_cstr = s;
00447     gCvsPrefs.save();
00448
00449     return Void();
00450 }

PyObject* PyPersistent::_GetValue | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 116 of file PythonImpl.h.

00118 :

PyObject* PyPersistent::_SetValue | ( | obj_t * | self,
 |  | PyObject * | args
 | ) | [inline, static, protected]

Definition at line 117 of file PythonImpl.h.

00118 :

void PyPersistent::dealloc ( obj_t * self ) [static]

Definition at line 400 of file PythonImpl.cpp.

PyObject * PyPersistent::getattr | ( | obj_t * | self,
 |  | char * | name
 | ) | [static]

Definition at line 400 of file PythonImpl.cpp.

Member Data Documentation

PCStr PyPersistent::m_cstr [protected]

Definition at line 129 of file PythonImpl.h.

const char * PyPersistent::m_doc = "Class to store persistent values on disk" [static]

Definition at line 400 of file PythonImpl.cpp.

PyMethodDef PyPersistent::m_methods [static]

Initial value:

   {
    {"GetValue", (binaryfunc)PyPersistent ::_GetValue , METH_VARARGS, (char *) "Get the persistent value" },
    {"SetValue", (binaryfunc)PyPersistent ::_SetValue , METH_VARARGS, (char *) "Set the persistent value" },
 {NULL, NULL}   }

Definition at line 402 of file PythonImpl.cpp.

PyRegistry PyPersistent::m_registry [static]

The documentation for this class was generated from the following files:
  • common/PythonImpl.h
  • common/PythonImpl.cpp
Generated on Sun Oct 21 12:49:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyPersistent::obj_t Struct Reference

#include <PythonImpl.h>

Collaboration diagram for PyPersistent::obj_t:

[legend]
List of all members.

Public Attributes

PyObject_HEAD PyPersistent * m_object

Member Data Documentation

PyObject_HEAD PyPersistent* PyPersistent::obj_t::m_object

Definition at line 115 of file PythonImpl.h.

The documentation for this struct was generated from the following file:
  • common/PythonImpl.h
Generated on Sun Oct 21 12:49:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


PyRegistry Class Reference

#include <PythonContainer.h>

Collaboration diagram for PyRegistry:

[legend]
List of all members.

Public Methods

PyRegistry (const char *name, size_t size, destructor d, getattrfunc g, PyRegistry_InitValues v, PyCFunction c, const char *doc)
~PyRegistry ()

Static Public Methods

void | RegisterAllObjects (std::vector< PyMethodDef > &methods)
void | CallInitValues (PyObject *dict)

Public Attributes

PyTypeObject | m_type

Protected Attributes

PyRegistry * | m_next
PyRegistry_InitValues m_v
PyCFunction | m_c
const char * | m_doc

Static Protected Attributes

PyRegistry * | m_all = NULL

Constructor & Destructor Documentation

PyRegistry::PyRegistry | ( | const char * | name,
 |  | size_t | size,
 |  | destructor | d,
 |  | getattrfunc | g,
 |  | PyRegistry_InitValues | v,
 |  | PyCFunction | c,
 |  | const char * | doc
 | ) |

Definition at line 32 of file PythonContainer.cpp.

00033                                                              : m_v(v), m_c(c), m_doc(doc)
00034 {
00035     m_next = m_all;
00036     m_all = this;
00037
00038     PyTypeObject deftype =
00039     {
00040         PyObject_HEAD_INIT(0)
00041         0,
00042         (char *)name,
00043         size,
00044         0, \
00045         d,                           /*tp_dealloc*/
00046         0,                              /*tp_print*/
00047         g,                            /*tp_getattr*/
00048         0,                              /*tp_setattr*/
00049         0,                              /*tp_compare*/
00050         0,                              /*tp_repr*/
00051         0,                              /*tp_as_number*/
00052         0,                              /*tp_as_sequence*/
00053         0,                              /*tp_as_mapping*/
00054     };
00055
00056     m_type = deftype;
00057     m_type.ob_type = GetPyType_Type();
00058 }

PyRegistry::~PyRegistry ( )

Definition at line 60 of file PythonContainer.cpp.

00061 {
00062 }

Member Function Documentation

void PyRegistry::CallInitValues ( PyObject * d ) [static]

Definition at line 84 of file PythonContainer.cpp.

Referenced by InitializeInterp().

00085 {
00086     PyRegistry *tmp = m_all;
00087     while(tmp != 0L)
00088     {
00089         tmp->m_v(d);
00090         tmp = tmp->m_next;
00091     }
00092 }

void PyRegistry::RegisterAllObjects ( std::vector< PyMethodDef > & methods ) [static]

Definition at line 64 of file PythonContainer.cpp.

Referenced by InitializeInterp().

00065 {
00066     PyRegistry *tmp = m_all;
00067     PyMethodDef def;
00068     while(tmp != 0L)
00069     {
00070         def.ml_name = tmp->m_type.tp_name;
00071         def.ml_meth = tmp->m_c;
00072         def.ml_flags = METH_VARARGS;
00073         def.ml_doc = (char *)tmp->m_doc;
00074
00075         methods.push_back(def);
00076
00077         tmp = tmp->m_next;
00078     }
00079
00080     memset(&def, 0, sizeof(def));
00081     methods.push_back(def);
00082 }

Member Data Documentation

PyRegistry * PyRegistry::m_all = NULL [static, protected]

Definition at line 30 of file PythonContainer.cpp.

PyCFunction PyRegistry::m_c [protected]

Definition at line 66 of file PythonContainer.h.

Referenced by RegisterAllObjects().

const char* PyRegistry::m_doc [protected]

Definition at line 67 of file PythonContainer.h.

Referenced by RegisterAllObjects().

PyRegistry* PyRegistry::m_next [protected]

Definition at line 64 of file PythonContainer.h.

Referenced by CallInitValues(), and RegisterAllObjects().

PyTypeObject PyRegistry::m_type

Definition at line 54 of file PythonContainer.h.

Referenced by RegisterAllObjects().

PyRegistry_InitValues PyRegistry::m_v [protected]

Definition at line 65 of file PythonContainer.h.

Referenced by CallInitValues().

The documentation for this class was generated from the following files:
  • common/PythonContainer.h
  • common/PythonContainer.cpp
Generated on Sun Oct 21 12:49:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPython_Interp Class Reference

#include <PythonGlue.h>

Collaboration diagram for CPython_Interp:

[legend]
List of all members.

Public Methods

CPython_Interp (bool mainInterp=true)
~CPython_Interp ()
int | DoScriptVar (const char *format,...)
int | DoScript (const char *script)
int | DoFile (const char *file)
operator PyThreadState * (void)

Static Public Methods

bool | IsAvail (void)
void | InitPythonSupport (void)
void | ClosePythonSupport (void)

Protected Attributes

PyThreadState * fInterp

Static Protected Attributes

PyThreadState * | m_mainInterpreter = 0L

Constructor & Destructor Documentation

CPython_Interp::CPython_Interp ( bool mainInterp = true )

Definition at line 938 of file PythonGlue.cpp.

00939 {
00940     fInterp = 0L;
00941
00942 #if USE_PYTHON
00943     if(!CPython_Interp::IsAvail())
00944     {
00945         cvs_err("Python is not available !\n");
00946         return;
00947     }
00948
00949     if(mainInterp)
00950     {
00951         fInterp = m_mainInterpreter;
00952         gCvsPrefs.SetTclFileRunning(true);
00953         return;
00954     }
00955
00956     {
00957         CPyThreadState lock(0L);
00958
00959         fInterp = Py_NewInterpreter();
00960         if(fInterp == NULL)
00961             return;
00962     }
00963
00964     InitializeInterp(fInterp);
00965     gCvsPrefs.SetTclFileRunning(true);
00966 #endif
00967 }

CPython_Interp::~CPython_Interp ( )

Definition at line 969 of file PythonGlue.cpp.

00970 {
00971 #if USE_PYTHON
00972     if(fInterp != 0L)
00973     {
00974         gCvsPrefs.SetTclFileRunning(false);
00975
00976         if(fInterp != m_mainInterpreter)
00977         {
00978             CPyThreadState lock(fInterp);
00979
00980             Py_EndInterpreter(fInterp);
00981         }
00982     }
00983 #endif
00984 }

Member Function Documentation

void CPython_Interp::ClosePythonSupport ( void ) [static]

Definition at line 1157 of file PythonGlue.cpp.

Referenced by CWincvsView::~CWincvsView().

01158 {
01159 #if USE_PYTHON
01160     if(!CPython_Interp::IsAvail())
01161         return;
01162
01163     PyThreadState_Swap(m_mainInterpreter);
01164 //  PyEval_ReleaseLock();
01165
01166     PyInvalUICache();
01167
01168     Py_Finalize();
01169 #endif
01170 }

int CPython_Interp::DoFile ( const char * file )

Definition at line 1112 of file PythonGlue.cpp.

01113 {
01114 #if USE_PYTHON
01115     if(fInterp == 0L)
01116         return -1;
01117
01118     CPyThreadState lock(fInterp);
01119
01120     FILE *f = fopen(file, "r");
01121     if(f)
01122     {
01123         PyRun_SimpleFile(f, (char *)file);
01124         fclose(f);
01125     }
01126
01127     return 0;
01128 #else
01129     return -1;
01130 #endif
01131 }

int CPython_Interp::DoScript ( const char * script )

Definition at line 1077 of file PythonGlue.cpp.

Referenced by DoScriptVar(), and CWincvsView::OnKeyDown().

01078 {
01079 #if USE_PYTHON
01080     if(fInterp == 0L)
01081         return -1;
01082
01083     CPyThreadState lock(fInterp);
01084
01085     PyRun_SimpleString((char *)script);
01086
01087     return 0;
01088 #else
01089     return -1;
01090 #endif
01091 }

int CPython_Interp::DoScriptVar | ( | const char * | format,
 |  | ... |
 | ) |

Definition at line 1093 of file PythonGlue.cpp.

Referenced by PyDoCmdUI(), PyDoPython(), and PyMacrosReloadAll().

01094 {
01095 #if USE_PYTHON
01096     if(fInterp == 0L)
01097         return -1;
01098
01099     va_list args;
01100     char script[1024] = {'\0'};
01101
01102     va_start (args, format);
01103     vsprintf (script, format, args);
01104     va_end (args);
01105
01106     return DoScript(script);
01107 #else
01108     return -1;
01109 #endif
01110 }

void CPython_Interp::InitPythonSupport ( void ) [static]

Definition at line 1133 of file PythonGlue.cpp.

Referenced by CWincvsView::OnInitialUpdate().

01134 {
01135 #if USE_PYTHON
01136     if(!CPython_Interp::IsAvail())
01137         return;
01138
01139 #ifdef WIN32
01140     Py_SetProgramName("wincvs");
01141     Py_Initialize();
01142 #elif qMacCvsPP
01143     Py_SetProgramName("maccvs");
01144     PyMac_Initialize();
01145 #else
01146     Py_SetProgramName("gcvs");
01147     Py_Initialize();
01148 #endif
01149
01150     PyEval_InitThreads();
01151     m_mainInterpreter = PyThreadState_Swap(NULL);
01152
01153     InitializeInterp(m_mainInterpreter);
01154 #endif
01155 }

bool CPython_Interp::IsAvail ( void ) [static]

Definition at line 986 of file PythonGlue.cpp.

Referenced by CPython_Interp(), ClosePythonSupport(), CWincvsApp::InitInstance(), InitPythonSupport(), and CWincvsView::OnKeyDown().

00987 {
00988 #if USE_PYTHON
00989 #   if qMacCvsPP
00990     return PyThreadState_Swap != 0L;
00991 #   elif defined(WIN32) && !qCvsDebug /* || qCarbon */
00992     static bool firstTime = true;
00993     static bool pyAvail = false;
00994     if(firstTime)
00995     {
00996 #   if defined(WIN32) || qCarbon
00997         CompatConnectID connID;
00998 #   endif
00999
01000 #   ifdef WIN32
01001         if(!pyAvail)
01002             pyAvail = CompatLoadLibrary(&connID, "python21.dll") != 0 ||
01003                 CompatLoadLibrary(&connID, "python22.dll") != 0;
01004 #   endif
01005
01006 #   if qCarbon
01007         if (UEnvironment::GetOSVersion() >= 0x1000)
01008             pyAvail = CompatLoadLibrary(&connID, "/System/Library/Frameworks/Tcl.framework");
01009         else
01010             pyAvail = CompatLoadLibrary(&connID, "tcl8.3");
01011 #   endif
01012
01013 #   if defined(WIN32) || qCarbon
01014 #   define LOAD_CODEFRAG(name) \
01015         if(pyAvail) \
01016             pyAvail = (*(void **)&name##_glue = \
01017                 _CompatCallLibrary(connID, #name)) != 0L
01018 #   endif
01019 #   if defined(WIN32) || TARGET_API_MAC_CARBON
01020         LOAD_CODEFRAG(PyThreadState_Swap);
01021         LOAD_CODEFRAG(PyDict_SetItemString);
01022         LOAD_CODEFRAG(PyErr_Clear);
01023         LOAD_CODEFRAG(PyInt_FromLong);
01024         LOAD_CODEFRAG(PyErr_SetString);
01025         LOAD_CODEFRAG(PyArg_ParseTuple);
01026         LOAD_CODEFRAG(PyTuple_New);
01027         LOAD_CODEFRAG(Py_BuildValue);
01028         LOAD_CODEFRAG(PyFile_AsFile);
01029         LOAD_CODEFRAG(PyString_AsString);
01030         LOAD_CODEFRAG(PyTuple_Size);
01031         LOAD_CODEFRAG(PyRun_SimpleString);
01032         LOAD_CODEFRAG(PyRun_SimpleFile);
01033         LOAD_CODEFRAG(Py_SetProgramName);
01034         LOAD_CODEFRAG(Py_Initialize);
01035         LOAD_CODEFRAG(Py_Finalize);
01036         LOAD_CODEFRAG(Py_IsInitialized);
01037         LOAD_CODEFRAG(Py_NewInterpreter);
01038         LOAD_CODEFRAG(Py_EndInterpreter);
01039         LOAD_CODEFRAG(PyString_FromString);
01040         LOAD_CODEFRAG(PyErr_NewException);
01041         LOAD_CODEFRAG(PyModule_GetDict);
01042         LOAD_CODEFRAG(Py_InitModule4);
01043         LOAD_CODEFRAG(PyEval_InitThreads);
01044         LOAD_CODEFRAG(Py_FindMethod);
01045         LOAD_CODEFRAG(_PyObject_New);
01046         LOAD_CODEFRAG(_PyObject_Del);
01047         LOAD_CODEFRAG(PySys_SetPath);
01048         LOAD_CODEFRAG(Py_GetPath);
01049
01050         LOAD_CODEFRAG(PyType_Type);
01051         LOAD_CODEFRAG(PyFile_Type);
01052         LOAD_CODEFRAG(PyString_Type);
01053         LOAD_CODEFRAG(PyTuple_Type);
01054         LOAD_CODEFRAG(PyInt_Type);
01055         LOAD_CODEFRAG(_Py_NoneStruct);
01056         LOAD_CODEFRAG(_Py_ZeroStruct);
01057         LOAD_CODEFRAG(_Py_TrueStruct);
01058
01059         if(!pyAvail)
01060         {
01061             WarnNoPython();
01062         }
01063 #   endif /* WIN32 */
01064
01065         firstTime = false;
01066     }
01067
01068     return pyAvail;
01069 #   else
01070     return true;
01071 #   endif
01072 #else // !USE_PYTHON
01073     return false;
01074 #endif // !USE_PYTHON
01075 }

CPython_Interp::operator PyThreadState * ( void ) [inline]

Definition at line 49 of file PythonGlue.h.

00049 {return fInterp;}

Member Data Documentation

PyThreadState* CPython_Interp::fInterp [protected]

Definition at line 52 of file PythonGlue.h.

PyThreadState * CPython_Interp::m_mainInterpreter = 0L [static, protected]

Definition at line 79 of file PythonGlue.cpp.

The documentation for this class was generated from the following files:
  • common/PythonGlue.h
  • common/PythonGlue.cpp
Generated on Sun Oct 21 12:49:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CPyThreadState Class Reference

Collaboration diagram for CPyThreadState:

[legend]
List of all members.

Public Methods

CPyThreadState (PyThreadState *p)
~CPyThreadState ()

Protected Attributes

PyThreadState * m_p

Constructor & Destructor Documentation

CPyThreadState::CPyThreadState ( PyThreadState * p ) [inline]

Definition at line 87 of file PythonGlue.cpp.

00087                                      : m_p(p)
00088     {
00089         m_p = PyThreadState_Swap(p);
00090     }

CPyThreadState::~CPyThreadState ( ) [inline]

Definition at line 91 of file PythonGlue.cpp.

00092     {
00093         PyThreadState_Swap(m_p);
00094     }

Member Data Documentation

PyThreadState* CPyThreadState::m_p [protected]

Definition at line 96 of file PythonGlue.cpp.

The documentation for this class was generated from the following file:
  • common/PythonGlue.cpp
Generated on Sun Oct 21 12:49:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcsbuffer Struct Reference

Collaboration diagram for rcsbuffer:

[legend]
List of all members.

Public Attributes

char * | ptr
char * | ptrend
FILE * | fp
const char * | filename
unsigned long | pos
size_t | vlen
int | at_string
int | embedded_at

Member Data Documentation

int rcsbuffer::at_string

Definition at line 46 of file rcs.c.

int rcsbuffer::embedded_at

Definition at line 50 of file rcs.c.

const char* rcsbuffer::filename

Definition at line 39 of file rcs.c.

FILE* rcsbuffer::fp

Definition at line 37 of file rcs.c.

unsigned long rcsbuffer::pos

Definition at line 41 of file rcs.c.

char* rcsbuffer::ptr

Definition at line 33 of file rcs.c.

char* rcsbuffer::ptrend

Definition at line 35 of file rcs.c.

size_t rcsbuffer::vlen

Definition at line 43 of file rcs.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/rcs.c
Generated on Sun Oct 21 12:49:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CRcsFile Class Reference

#include <CvsLog.h>

Collaboration diagram for CRcsFile:

[legend]
List of all members.

Public Methods

CRcsFile ()
CRcsFile (const CRcsFile &afile)
virtual | ~CRcsFile ()
CRcsFile & | operator= (const CRcsFile &afile)
bool | operator< (const CRcsFile &afile) const
bool | operator== (const CRcsFile &afile) const
void | sort (void)
void | print (ostream &out) const
const CLogStr & | RcsFile (void) const
CLogStr & | RcsFile (void)
const CLogStr & | WorkingFile (void) const
CLogStr & | WorkingFile (void)
const CRevNumber & | HeadRev (void) const
CRevNumber & | HeadRev (void)
const CRevNumber & | BranchRev (void) const
CRevNumber & | BranchRev (void)
const CLogStr & | KeywordSubst (void) const
CLogStr & | KeywordSubst (void)
int | SelRevisions (void) const
int & | SelRevisions (void)
int | TotRevisions (void) const
int & | TotRevisions (void)
const std::vector< CLogStr > & | AccessList (void) const
std::vector< CLogStr > & | AccessList (void)
CLogStr & | LastAccess (void)
const std::vector< CRevNumber > & | SymbolicList (void) const
std::vector< CRevNumber > & | SymbolicList (void)
CRevNumber & | LastSymbName (void)
const std::vector< CRevNumber > & | LocksList (void) const
std::vector< CRevNumber > & | LocksList (void)
CRevNumber & | LastLock (void)
bool | LockStrict (void) const
bool & | LockStrict (void)
const std::vector< CRevFile > & | AllRevs (void) const
std::vector< CRevFile > & | AllRevs (void)
CRevFile & | LastRev (void)
const CLogStr & | DescLog (void) const
CLogStr & | DescLog (void)

Protected Attributes

CLogStr rcsFile
CLogStr workingFile
CRevNumber headRev
CRevNumber branchRev
CLogStr keywordSubst
std::vector< CLogStr > accessList
std::vector< CRevNumber > symbolicList
std::vector< CRevNumber > locksList
int | selRevisions
int | totRevisions
bool | lockStrict
std::vector< CRevFile > allRevs
CLogStr descLog

Constructor & Destructor Documentation

CRcsFile::CRcsFile ( )

Definition at line 301 of file CvsLog.cpp.

00302 {
00303     selRevisions = 0;
00304     totRevisions = 0;
00305     lockStrict = false;
00306 }

CRcsFile::CRcsFile ( const CRcsFile & afile )

Definition at line 308 of file CvsLog.cpp.

00309 {
00310     *this = afile;
00311 }

CRcsFile::~CRcsFile ( ) [virtual]

Definition at line 313 of file CvsLog.cpp.

00314 {
00315 }

Member Function Documentation

std::vector<CLogStr>& CRcsFile::AccessList ( void ) [inline]

Definition at line 222 of file CvsLog.h.

00222 { return accessList; }

const std::vector<CLogStr>& CRcsFile::AccessList ( void ) const [inline]

Definition at line 221 of file CvsLog.h.

Referenced by outputXML(), and print().

00221 { return accessList; }

std::vector<CRevFile>& CRcsFile::AllRevs ( void ) [inline]

Definition at line 237 of file CvsLog.h.

00237 { return allRevs; }

const std::vector<CRevFile>& CRcsFile::AllRevs ( void ) const [inline]

Definition at line 236 of file CvsLog.h.

Referenced by CvsLogGraph(), print(), sort(), and yygraph().

00236 { return allRevs; }

CRevNumber& CRcsFile::BranchRev ( void ) [inline]

Definition at line 210 of file CvsLog.h.

00210 { return branchRev; }

const CRevNumber& CRcsFile::BranchRev ( void ) const [inline]

Definition at line 209 of file CvsLog.h.

Referenced by outputXML(), and print().

00209 { return branchRev; }

CLogStr& CRcsFile::DescLog ( void ) [inline]

Definition at line 241 of file CvsLog.h.

00241 { return descLog; }

const CLogStr& CRcsFile::DescLog ( void ) const [inline]

Definition at line 240 of file CvsLog.h.

Referenced by CGraphView::OnGraphSetdescription(), outputXML(), and print().

00240 { return descLog; }

CRevNumber& CRcsFile::HeadRev ( void ) [inline]

Definition at line 207 of file CvsLog.h.

00207 { return headRev; }

const CRevNumber& CRcsFile::HeadRev ( void ) const [inline]

Definition at line 206 of file CvsLog.h.

Referenced by outputXML(), and print().

00206 { return headRev; }

CLogStr& CRcsFile::KeywordSubst ( void ) [inline]

Definition at line 213 of file CvsLog.h.

00213 { return keywordSubst; }

const CLogStr& CRcsFile::KeywordSubst ( void ) const [inline]

Definition at line 212 of file CvsLog.h.

Referenced by outputXML(), and print().

00212 { return keywordSubst; }

CLogStr& CRcsFile::LastAccess ( void ) [inline]

Definition at line 223 of file CvsLog.h.

00223 { return accessList[accessList.size() - 1]; }

CRevNumber& CRcsFile::LastLock ( void ) [inline]

Definition at line 231 of file CvsLog.h.

00231 { return locksList[locksList.size() - 1]; }

CRevFile& CRcsFile::LastRev ( void ) [inline]

Definition at line 238 of file CvsLog.h.

00238 { return allRevs[allRevs.size() - 1]; }

CRevNumber& CRcsFile::LastSymbName ( void ) [inline]

Definition at line 227 of file CvsLog.h.

00227 { return symbolicList[symbolicList.size() - 1]; }

bool& CRcsFile::LockStrict ( void ) [inline]

Definition at line 234 of file CvsLog.h.

00234 { return lockStrict; }

bool CRcsFile::LockStrict ( void ) const [inline]

Definition at line 233 of file CvsLog.h.

Referenced by outputXML(), and print().

00233 { return lockStrict; }

std::vector<CRevNumber>& CRcsFile::LocksList ( void ) [inline]

Definition at line 230 of file CvsLog.h.

00230 { return locksList; }

const std::vector<CRevNumber>& CRcsFile::LocksList ( void ) const [inline]

Definition at line 229 of file CvsLog.h.

Referenced by outputXML(), and print().

00229 { return locksList; }

CLogStr& CRcsFile::RcsFile ( void ) [inline]

Definition at line 201 of file CvsLog.h.

00201 { return rcsFile; }

const CLogStr& CRcsFile::RcsFile ( void ) const [inline]

Definition at line 200 of file CvsLog.h.

Referenced by outputXML(), and print().

00200 { return rcsFile; }

int& CRcsFile::SelRevisions ( void ) [inline]

Definition at line 216 of file CvsLog.h.

00216 { return selRevisions; }

int CRcsFile::SelRevisions ( void ) const [inline]

Definition at line 215 of file CvsLog.h.

Referenced by outputXML(), and print().

00215 { return selRevisions; }

std::vector<CRevNumber>& CRcsFile::SymbolicList ( void ) [inline]

Definition at line 226 of file CvsLog.h.

00226 { return symbolicList; }

const std::vector<CRevNumber>& CRcsFile::SymbolicList ( void ) const [inline]

Definition at line 225 of file CvsLog.h.

Referenced by CvsLogGraph(), outputXML(), and print().

00225 { return symbolicList; }

int& CRcsFile::TotRevisions ( void ) [inline]

Definition at line 219 of file CvsLog.h.

00219 { return totRevisions; }

int CRcsFile::TotRevisions ( void ) const [inline]

Definition at line 218 of file CvsLog.h.

Referenced by outputXML(), and print().

00218 { return totRevisions; }

CLogStr& CRcsFile::WorkingFile ( void ) [inline]

Definition at line 204 of file CvsLog.h.

00204 { return workingFile; }

const CLogStr& CRcsFile::WorkingFile ( void ) const [inline]

Definition at line 203 of file CvsLog.h.

Referenced by CvsLogParse(), outputXML(), and print().

00203 { return workingFile; }

bool CRcsFile::operator< ( const CRcsFile & afile ) const

CRcsFile & CRcsFile::operator= ( const CRcsFile & afile )

Definition at line 317 of file CvsLog.cpp.

00318 {
00319     rcsFile = afile.rcsFile;
00320     workingFile = afile.workingFile;
00321     headRev = afile.headRev;
00322     branchRev = afile.branchRev;
00323     keywordSubst = afile.keywordSubst;
00324     accessList = afile.accessList;
00325     symbolicList = afile.symbolicList;
00326     locksList = afile.locksList;
00327     selRevisions = afile.selRevisions;
00328     totRevisions = afile.totRevisions;
00329     lockStrict = afile.lockStrict;
00330     allRevs = afile.allRevs;
00331     descLog = afile.descLog;
00332     return *this;
00333 }

bool CRcsFile::operator== ( const CRcsFile & afile ) const

void CRcsFile::print ( ostream & out ) const

Referenced by yyoutput().

void CRcsFile::sort ( void )

Definition at line 393 of file CvsLog.cpp.

Referenced by CvsLogGraph().

00394 {
00395 #ifndef __MWERKS__
00396     qsort(AllRevs().begin(), AllRevs().size(), sizeof(CRevFile), sortRevs);
00397 #else /* __MWERKS__ */
00398     qsort(&*AllRevs().begin(), AllRevs().size(), sizeof(CRevFile), sortRevs);
00399 #endif /* __MWERKS__ */
00400 }

Member Data Documentation

std::vector<CLogStr> CRcsFile::accessList [protected]

Definition at line 249 of file CvsLog.h.

Referenced by operator=().

std::vector<CRevFile> CRcsFile::allRevs [protected]

Definition at line 255 of file CvsLog.h.

Referenced by operator=().

CRevNumber CRcsFile::branchRev [protected]

Definition at line 247 of file CvsLog.h.

Referenced by operator=().

CLogStr CRcsFile::descLog [protected]

Definition at line 256 of file CvsLog.h.

Referenced by operator=().

CRevNumber CRcsFile::headRev [protected]

Definition at line 246 of file CvsLog.h.

Referenced by operator=().

CLogStr CRcsFile::keywordSubst [protected]

Definition at line 248 of file CvsLog.h.

Referenced by operator=().

bool CRcsFile::lockStrict [protected]

Definition at line 254 of file CvsLog.h.

Referenced by operator=().

std::vector<CRevNumber> CRcsFile::locksList [protected]

Definition at line 251 of file CvsLog.h.

Referenced by operator=().

CLogStr CRcsFile::rcsFile [protected]

Definition at line 244 of file CvsLog.h.

Referenced by operator=().

int CRcsFile::selRevisions [protected]

Definition at line 252 of file CvsLog.h.

Referenced by operator=().

std::vector<CRevNumber> CRcsFile::symbolicList [protected]

Definition at line 250 of file CvsLog.h.

Referenced by operator=().

int CRcsFile::totRevisions [protected]

Definition at line 253 of file CvsLog.h.

Referenced by operator=().

CLogStr CRcsFile::workingFile [protected]

Definition at line 245 of file CvsLog.h.

Referenced by operator=().

The documentation for this class was generated from the following files:
  • cvstree/CvsLog.h
  • cvstree/CvsLog.cpp
Generated on Sun Oct 21 12:49:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcsnode Struct Reference

#include <rcs.h>

Collaboration diagram for rcsnode:

[legend]
List of all members.

Public Attributes

int | refcount
int | flags
char * | path
char * | head
char * | branch
char * | symbols_data
char * | expand
List * symbols
List * versions
char * | access
char * | locks_data
List * locks
int | strict_locks
char * | comment
char * | desc
long | delta_pos
List * other

Member Data Documentation

char* rcsnode::access

Definition at line 87 of file rcs.h.

char* rcsnode::branch

Definition at line 67 of file rcs.h.

char* rcsnode::comment

Definition at line 102 of file rcs.h.

long rcsnode::delta_pos

Definition at line 108 of file rcs.h.

char* rcsnode::desc

Definition at line 105 of file rcs.h.

char* rcsnode::expand

Definition at line 74 of file rcs.h.

int rcsnode::flags

Definition at line 55 of file rcs.h.

char* rcsnode::head

Definition at line 64 of file rcs.h.

List* rcsnode::locks

Definition at line 95 of file rcs.h.

char* rcsnode::locks_data

Definition at line 91 of file rcs.h.

List* rcsnode::other

Definition at line 113 of file rcs.h.

char* rcsnode::path

Definition at line 61 of file rcs.h.

int rcsnode::refcount

Definition at line 52 of file rcs.h.

int rcsnode::strict_locks

Definition at line 98 of file rcs.h.

List* rcsnode::symbols

Definition at line 78 of file rcs.h.

char* rcsnode::symbols_data

Definition at line 71 of file rcs.h.

List* rcsnode::versions

Definition at line 82 of file rcs.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/rcs.h
Generated on Sun Oct 21 12:49:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


rcsversnode Struct Reference

#include <rcs.h>

Collaboration diagram for rcsversnode:

[legend]
List of all members.

Public Attributes

char * | version
char * | date
char * | author
char * | state
char * | next
int | dead
int | outdated
Deltatext * text
List * branches
List * other
List * other_delta

Member Data Documentation

char* rcsversnode::author

Definition at line 145 of file rcs.h.

List* rcsversnode::branches

Definition at line 151 of file rcs.h.

char* rcsversnode::date

Definition at line 144 of file rcs.h.

int rcsversnode::dead

Definition at line 148 of file rcs.h.

char* rcsversnode::next

Definition at line 147 of file rcs.h.

List* rcsversnode::other

Definition at line 156 of file rcs.h.

List* rcsversnode::other_delta

Definition at line 158 of file rcs.h.

int rcsversnode::outdated

Definition at line 149 of file rcs.h.

char* rcsversnode::state

Definition at line 146 of file rcs.h.

Deltatext* rcsversnode::text

Definition at line 150 of file rcs.h.

char* rcsversnode::version

Definition at line 142 of file rcs.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/rcs.h
Generated on Sun Oct 21 12:49:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


re_pattern_buffer Struct Reference

#include <regex.h>

Collaboration diagram for re_pattern_buffer:

[legend]
List of all members.

Public Attributes

unsigned char * | buffer
unsigned long | allocated
unsigned long | used
reg_syntax_t syntax
char * | fastmap
char * | translate
size_t | re_nsub
unsigned | can_be_null: 1
unsigned | regs_allocated: 2
unsigned | fastmap_accurate: 1
unsigned | no_sub: 1
unsigned | not_bol: 1
unsigned | not_eol: 1
unsigned | newline_anchor: 1
unsigned | multibyte: 1

Member Data Documentation

unsigned long re_pattern_buffer::allocated

Definition at line 305 of file regex.h.

unsigned char* re_pattern_buffer::buffer

Definition at line 302 of file regex.h.

unsigned re_pattern_buffer::can_be_null

Definition at line 332 of file regex.h.

char* re_pattern_buffer::fastmap

Definition at line 316 of file regex.h.

unsigned re_pattern_buffer::fastmap_accurate

Definition at line 345 of file regex.h.

unsigned re_pattern_buffer::multibyte

Definition at line 363 of file regex.h.

unsigned re_pattern_buffer::newline_anchor

Definition at line 359 of file regex.h.

unsigned re_pattern_buffer::no_sub

Definition at line 349 of file regex.h.

unsigned re_pattern_buffer::not_bol

Definition at line 353 of file regex.h.

unsigned re_pattern_buffer::not_eol

Definition at line 356 of file regex.h.

size_t re_pattern_buffer::re_nsub

Definition at line 325 of file regex.h.

unsigned re_pattern_buffer::regs_allocated

Definition at line 341 of file regex.h.

reg_syntax_t re_pattern_buffer::syntax

Definition at line 311 of file regex.h.

char* re_pattern_buffer::translate

Definition at line 322 of file regex.h.

unsigned long re_pattern_buffer::used

Definition at line 308 of file regex.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/lib/regex.h
Generated on Sun Oct 21 12:49:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


re_registers Struct Reference

#include <regex.h>

Collaboration diagram for re_registers:

[legend]
List of all members.

Public Attributes

unsigned num_regs
regoff_t * start
regoff_t * end

Member Data Documentation

regoff_t* re_registers::end

Definition at line 380 of file regex.h.

unsigned re_registers::num_regs

Definition at line 378 of file regex.h.

regoff_t* re_registers::start

Definition at line 379 of file regex.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/lib/regex.h
Generated on Sun Oct 21 12:49:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


URECT Struct Reference

#include <umain.h>

Inheritance diagram for URECT:

[legend]
Collaboration diagram for URECT:

[legend]
List of all members.

Public Attributes

int | left
int | top
int | right
int | bottom

Member Data Documentation

int URECT::bottom

Definition at line 909 of file umain.h.

Referenced by EqualRect(), InflateRect(), IntersectRect(), IsRectEmpty(), OffsetRect(), UWidget::OnGetLoc(), UWidget::OnSetLoc(), PtInRect(), SetRect(), SetRectEmpty(), UDC::TextOutClipped(), UnionRect(), and TPseudoWinAdorner::ViewChangedFrame().

int URECT::left

Definition at line 909 of file umain.h.

Referenced by EqualRect(), InflateRect(), IntersectRect(), IsRectEmpty(), OffsetRect(), UWidget::OnGetLoc(), UWidget::OnSetLoc(), PtInRect(), UDC::Rectangle(), UDC::RoundRect(), SetRect(), SetRectEmpty(), UDC::TextOutClipped(), UnionRect(), CWinLogRevData::UpdateSelf(), and TPseudoWinAdorner::ViewChangedFrame().

int URECT::right

Definition at line 909 of file umain.h.

Referenced by EqualRect(), InflateRect(), IntersectRect(), IsRectEmpty(), OffsetRect(), UWidget::OnGetLoc(), UWidget::OnSetLoc(), PtInRect(), SetRect(), SetRectEmpty(), UnionRect(), and TPseudoWinAdorner::ViewChangedFrame().

int URECT::top

Definition at line 909 of file umain.h.

Referenced by EqualRect(), InflateRect(), IntersectRect(), IsRectEmpty(), OffsetRect(), UWidget::OnGetLoc(), UWidget::OnSetLoc(), PtInRect(), UDC::Rectangle(), UDC::RoundRect(), SetRect(), SetRectEmpty(), UnionRect(), and TPseudoWinAdorner::ViewChangedFrame().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:49:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


URect Class Reference

#include <udraw.h>

Inheritance diagram for URect:

[legend]
Collaboration diagram for URect:

[legend]
List of all members.

Public Methods

URect ()
URect (int l, int t, int r, int b)
URect (const URECT &srURect)
URect (const URECT *lpSrURect)
URect (UPOINT point, USIZE size)
URect (UPOINT topLeft, UPOINT bottomRight)
int | Width () const
int | Height () const
USize | Size () const
UPoint & TopLeft ()
UPoint & BottomRight ()
const UPoint & | TopLeft () const
const UPoint & | BottomRight () const
UPoint | CenterPoint () const
operator URECT * ()
operator const URECT * () const
bool | IsRectEmpty () const
bool | IsRectNull () const
bool | PtInRect (UPOINT point) const
void | SetRect (int x1, int y1, int x2, int y2)
void | SetRect (UPOINT topLeft, UPOINT bottomRight)
void | SetRectEmpty ()
void | CopyRect (const URECT *lpSrURect)
bool | EqualRect (const URECT *lpRect) const
void | InflateRect (int x, int y)
void | InflateRect (USIZE size)
void | InflateRect (const URECT *lpRect)
void | InflateRect (int l, int t, int r, int b)
void | DeflateRect (int x, int y)
void | DeflateRect (USIZE size)
void | DeflateRect (const URECT *lpRect)
void | DeflateRect (int l, int t, int r, int b)
void | OffsetRect (int x, int y)
void | OffsetRect (USIZE size)
void | OffsetRect (UPOINT point)
void | NormalizeRect ()
bool | IntersectRect (const URECT *lpRect1, const URECT *lpRect2)
bool | UnionRect (const URECT *lpRect1, const URECT *lpRect2)
void | operator= (const URECT &srURect)
bool | operator== (const URECT &rect) const
bool | operator!= (const URECT &rect) const
void | operator+= (UPOINT point)
void | operator+= (USIZE size)
void | operator+= (const URECT *lpRect)
void | operator-= (UPOINT point)
void | operator-= (USIZE size)
void | operator-= (const URECT *lpRect)
void | operator &= (const URECT &rect)
void | operator|= (const URECT &rect)
URect | operator+ (UPOINT point) const
URect | operator- (UPOINT point) const
URect | operator+ (const URECT *lpRect) const
URect | operator+ (USIZE size) const
URect | operator- (USIZE size) const
URect | operator- (const URECT *lpRect) const
URect | operator & (const URECT &rect2) const
URect | operator| (const URECT &rect2) const
URect | MulDiv (int nMultiplier, int nDivisor) const

Constructor & Destructor Documentation

URect::URect ( ) [inline]

Definition at line 324 of file udraw.h.

00325     { /* random filled */ }

URect::URect | ( | int | l,
 |  | int | t,
 |  | int | r,
 |  | int | b
 | ) | [inline]

Definition at line 326 of file udraw.h.

00327     { left = l; top = t; right = r; bottom = b; }

URect::URect ( const URECT & srURect ) [inline]

Definition at line 328 of file udraw.h.

00329     { ::CopyRect(this, &srURect); }

URect::URect ( const URECT * lpSrURect ) [inline]

Definition at line 330 of file udraw.h.

00331     { ::CopyRect(this, lpSrURect); }

URect::URect | ( | UPOINT | point,
 |  | USIZE | size
 | ) | [inline]

Definition at line 332 of file udraw.h.

00333     { right = (left = point.x) + size.cx; bottom = (top = point.y) + size.cy; }

URect::URect | ( | UPOINT | topLeft,
 |  | UPOINT | bottomRight
 | ) | [inline]

Definition at line 334 of file udraw.h.

00335     { left = topLeft.x; top = topLeft.y;
00336         right = bottomRight.x; bottom = bottomRight.y; }

Member Function Documentation

const UPoint & URect::BottomRight ( ) const [inline]

Definition at line 357 of file udraw.h.

00358     { return *((UPoint*)this+1); }

UPoint & URect::BottomRight ( ) [inline]

Definition at line 353 of file udraw.h.

Referenced by CWinLogData::ComputeBounds(), and CWinLogData::Update().

00354     { return *((UPoint*)this+1); }

UPoint URect::CenterPoint ( ) const [inline]

Definition at line 359 of file udraw.h.

Referenced by CWinLogData::Update(), CWinLogBranchData::UpdateSelf(), CWinLogTagData::UpdateSelf(), CWinLogRevData::UpdateSelf(), and CWinLogHeaderData::UpdateSelf().

00360     { return UPoint((left+right)/2, (top+bottom)/2); }

void URect::CopyRect ( const URECT * lpSrURect ) [inline]

Definition at line 389 of file udraw.h.

00390     { ::CopyRect(this, lpSrURect); }

void URect::DeflateRect | ( | int | l,
 |  | int | t,
 |  | int | r,
 |  | int | b
 | ) |

void URect::DeflateRect ( const URECT * lpRect )

void URect::DeflateRect ( USIZE size ) [inline]

Definition at line 399 of file udraw.h.

00400     { ::InflateRect(this, -size.cx, -size.cy); }

void URect::DeflateRect | ( | int | x,
 |  | int | y
 | ) | [inline]

Definition at line 397 of file udraw.h.

Referenced by operator-=().

00398     { ::InflateRect(this, -x, -y); }

bool URect::EqualRect ( const URECT * lpRect ) const [inline]

Definition at line 391 of file udraw.h.

00392     { return ::EqualRect(this, lpRect); }

int URect::Height ( ) const [inline]

Definition at line 347 of file udraw.h.

Referenced by UCvsGraph::CalcImageSize(), CWinLogData::ComputeBounds(), UWidget::OnSetLoc(), UDC::Rectangle(), UDC::RoundRect(), UDC::TextOutClipped(), and CWinLogRevData::UpdateSelf().

00348     { return bottom - top; }

void URect::InflateRect | ( | int | l,
 |  | int | t,
 |  | int | r,
 |  | int | b
 | ) |

void URect::InflateRect ( const URECT * lpRect )

void URect::InflateRect ( USIZE size ) [inline]

Definition at line 395 of file udraw.h.

00396     { ::InflateRect(this, size.cx, size.cy); }

void URect::InflateRect | ( | int | x,
 |  | int | y
 | ) | [inline]

Definition at line 393 of file udraw.h.

Referenced by operator+=().

00394     { ::InflateRect(this, x, y); }

bool URect::IntersectRect | ( | const URECT * | lpRect1,
 |  | const URECT * | lpRect2
 | ) | [inline]

Definition at line 407 of file udraw.h.

00408     { return ::IntersectRect(this, lpRect1, lpRect2);}

bool URect::IsRectEmpty ( ) const [inline]

Definition at line 377 of file udraw.h.

00378     { return left == right || top == bottom; }

bool URect::IsRectNull ( ) const [inline]

Definition at line 379 of file udraw.h.

00380     { return (left == 0 && right == 0 && top == 0 && bottom == 0); }

URect URect::MulDiv | ( | int | nMultiplier,
 |  | int | nDivisor
 | ) | const

void URect::NormalizeRect ( )

void URect::OffsetRect ( UPOINT point ) [inline]

Definition at line 403 of file udraw.h.

00404     { ::OffsetRect(this, point.x, point.y); }

void URect::OffsetRect ( USIZE size ) [inline]

Definition at line 405 of file udraw.h.

00406     { ::OffsetRect(this, size.cx, size.cy); }

void URect::OffsetRect | ( | int | x,
 |  | int | y
 | ) | [inline]

Definition at line 401 of file udraw.h.

Referenced by CWinLogData::ComputeBounds(), DrawNode(), CWinLogData::Offset(), and CWinLogData::SetSelected().

00402     { ::OffsetRect(this, x, y); }

bool URect::PtInRect ( UPOINT point ) const [inline]

Definition at line 381 of file udraw.h.

Referenced by CWinLogData::HitTest().

00382     { return ::PtInRect(this, point); }

void URect::SetRect | ( | UPOINT | topLeft,
 |  | UPOINT | bottomRight
 | ) | [inline]

Definition at line 385 of file udraw.h.

00386     { ::SetRect(this, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); }

void URect::SetRect | ( | int | x1,
 |  | int | y1,
 |  | int | x2,
 |  | int | y2
 | ) | [inline]

Definition at line 383 of file udraw.h.

Referenced by CWinLogData::ComputeBounds().

00384     { ::SetRect(this, x1, y1, x2, y2); }

void URect::SetRectEmpty ( ) [inline]

Definition at line 387 of file udraw.h.

Referenced by CWinLogData::CWinLogData(), and CWinLogData::ComputeBounds().

00388     { ::SetRectEmpty(this); }

USize URect::Size ( ) const [inline]

Definition at line 349 of file udraw.h.

Referenced by UCvsGraph::CalcImageSize().

00350     { return USize(right - left, bottom - top); }

const UPoint & URect::TopLeft ( ) const [inline]

Definition at line 355 of file udraw.h.

00356     { return *((UPoint*)this); }

UPoint & URect::TopLeft ( ) [inline]

Definition at line 351 of file udraw.h.

Referenced by UCvsGraph::CalcImageSize(), CWinLogData::ComputeBounds(), UWidget::OnSetLoc(), CWinLogData::Update(), and CWinLogRevData::UpdateSelf().

00352     { return *((UPoint*)this); }

bool URect::UnionRect | ( | const URECT * | lpRect1,
 |  | const URECT * | lpRect2
 | ) | [inline]

Definition at line 409 of file udraw.h.

Referenced by CWinLogData::ComputeBounds().

00410     { return ::UnionRect(this, lpRect1, lpRect2); }

int URect::Width ( ) const [inline]

Definition at line 345 of file udraw.h.

Referenced by UCvsGraph::CalcImageSize(), CWinLogData::ComputeBounds(), UWidget::OnSetLoc(), UDC::Rectangle(), UDC::RoundRect(), UDC::TextOutClipped(), and CWinLogData::Update().

00346     { return right - left; }

URect URect::operator & ( const URECT & rect2 ) const [inline]

Definition at line 445 of file udraw.h.

00446     { URect rect; ::IntersectRect(&rect, this, &rect2);
00447         return rect; }

void URect::operator &= ( const URECT & rect ) [inline]

Definition at line 429 of file udraw.h.

00430     { ::IntersectRect(this, this, &rect); }

URect::operator URECT * ( ) [inline]

Definition at line 361 of file udraw.h.

00362     { return this; }

URect::operator const URECT * ( ) const [inline]

Definition at line 363 of file udraw.h.

00364     { return this; }

bool URect::operator!= ( const URECT & rect ) const [inline]

Definition at line 415 of file udraw.h.

00416     { return !::EqualRect(this, &rect); }

URect URect::operator+ ( USIZE size ) const [inline]

Definition at line 437 of file udraw.h.

00438     { URect rect(*this); ::OffsetRect(&rect, size.cx, size.cy); return rect; }

URect URect::operator+ ( const URECT * lpRect ) const [inline]

Definition at line 441 of file udraw.h.

00442     { URect rect(this); rect.InflateRect(lpRect); return rect; }

URect URect::operator+ ( UPOINT pt ) const [inline]

Definition at line 433 of file udraw.h.

00434     { URect rect(*this); ::OffsetRect(&rect, pt.x, pt.y); return rect; }

void URect::operator+= ( const URECT * lpRect ) [inline]

Definition at line 421 of file udraw.h.

00422     { InflateRect(lpRect); }

void URect::operator+= ( USIZE size ) [inline]

Definition at line 419 of file udraw.h.

00420     { ::OffsetRect(this, size.cx, size.cy); }

void URect::operator+= ( UPOINT point ) [inline]

Definition at line 417 of file udraw.h.

00418     { ::OffsetRect(this, point.x, point.y); }

URect URect::operator- ( const URECT * lpRect ) const [inline]

Definition at line 443 of file udraw.h.

00444     { URect rect(this); rect.DeflateRect(lpRect); return rect; }

URect URect::operator- ( USIZE size ) const [inline]

Definition at line 439 of file udraw.h.

00440     { URect rect(*this); ::OffsetRect(&rect, -size.cx, -size.cy); return rect; }

URect URect::operator- ( UPOINT pt ) const [inline]

Definition at line 435 of file udraw.h.

00436     { URect rect(*this); ::OffsetRect(&rect, -pt.x, -pt.y); return rect; }

void URect::operator-= ( const URECT * lpRect ) [inline]

Definition at line 427 of file udraw.h.

00428     { DeflateRect(lpRect); }

void URect::operator-= ( USIZE size ) [inline]

Definition at line 425 of file udraw.h.

00426     { ::OffsetRect(this, -size.cx, -size.cy); }

void URect::operator-= ( UPOINT point ) [inline]

Definition at line 423 of file udraw.h.

00424     { ::OffsetRect(this, -point.x, -point.y); }

void URect::operator= ( const URECT & srURect ) [inline]

Definition at line 411 of file udraw.h.

00412     { ::CopyRect(this, &srURect); }

bool URect::operator== ( const URECT & rect ) const [inline]

Definition at line 413 of file udraw.h.

00414     { return ::EqualRect(this, &rect); }

URect URect::operator| ( const URECT & rect2 ) const [inline]

Definition at line 448 of file udraw.h.

00449     { URect rect; ::UnionRect(&rect, this, &rect2);
00450         return rect; }

void URect::operator|= ( const URECT & rect ) [inline]

Definition at line 431 of file udraw.h.

00432     { ::UnionRect(this, this, &rect); }

The documentation for this class was generated from the following file:
  • rf/udraw.h
Generated on Sun Oct 21 12:49:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CRectTracker Class Reference

Inheritance diagram for CRectTracker:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:49:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


recursion_frame Struct Reference

Collaboration diagram for recursion_frame:

[legend]
List of all members.

Public Attributes

FILEPROC fileproc
FILESDONEPROC filesdoneproc
DIRENTPROC direntproc
DIRLEAVEPROC dirleaveproc
void * | callerdat
Dtype flags
int | which
int | aflag
int | readlock
int | dosrcs

Member Data Documentation

int recursion_frame::aflag

Definition at line 35 of file recurse.c.

void* recursion_frame::callerdat

Definition at line 32 of file recurse.c.

DIRENTPROC recursion_frame::direntproc

Definition at line 30 of file recurse.c.

DIRLEAVEPROC recursion_frame::dirleaveproc

Definition at line 31 of file recurse.c.

int recursion_frame::dosrcs

Definition at line 37 of file recurse.c.

FILEPROC recursion_frame::fileproc

Definition at line 28 of file recurse.c.

FILESDONEPROC recursion_frame::filesdoneproc

Definition at line 29 of file recurse.c.

Dtype recursion_frame::flags

Definition at line 33 of file recurse.c.

int recursion_frame::readlock

Definition at line 36 of file recurse.c.

int recursion_frame::which

Definition at line 34 of file recurse.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/recurse.c
Generated on Sun Oct 21 12:49:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CRecursionLock Class Reference

Collaboration diagram for CRecursionLock:

[legend]
List of all members.

Public Methods

CRecursionLock (bool &semaphore)
~CRecursionLock ()

Private Attributes

bool & m_semaphore

Constructor & Destructor Documentation

CRecursionLock::CRecursionLock ( bool & semaphore ) [inline]

Definition at line 586 of file BrowseFileView.cpp.

00587     : m_semaphore(semaphore)
00588     {
00589         m_semaphore = true;
00590     }

CRecursionLock::~CRecursionLock ( ) [inline]

Definition at line 592 of file BrowseFileView.cpp.

00593     {
00594         m_semaphore = false;
00595     }

Member Data Documentation

bool& CRecursionLock::m_semaphore [private]

Definition at line 584 of file BrowseFileView.cpp.

The documentation for this class was generated from the following file:
  • WinCvs/BrowseFileView.cpp
Generated on Sun Oct 21 12:49:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


regexp_list Struct Reference

#include <diff.h>

Collaboration diagram for regexp_list:

[legend]
List of all members.

Public Attributes

re_pattern_buffer buf
regexp_list * next

Member Data Documentation

struct re_pattern_buffer regexp_list::buf

Definition at line 101 of file diff.h.

Referenced by inserts(), and linep().

struct regexp_list* regexp_list::next

Definition at line 102 of file diff.h.

Referenced by inserts(), and linep().

The documentation for this struct was generated from the following file:
  • cvs-1.10/diff/diff.h
Generated on Sun Oct 21 12:49:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


regmatch_t Struct Reference

#include <regex.h>

Collaboration diagram for regmatch_t:

[legend]
List of all members.

Public Attributes

regoff_t rm_so
regoff_t rm_eo

Member Data Documentation

regoff_t regmatch_t::rm_eo

Definition at line 398 of file regex.h.

regoff_t regmatch_t::rm_so

Definition at line 397 of file regex.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/lib/regex.h
Generated on Sun Oct 21 12:49:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


RemoveCvsArgs Class Reference

Inheritance diagram for RemoveCvsArgs:

[legend]
Collaboration diagram for RemoveCvsArgs:

[legend]
List of all members.

Public Methods

virtual void addfile (const char *arg, const char *dir=0L, const FSSpec *spec=0L)

Member Function Documentation

void RemoveCvsArgs::addfile | ( | const char * | arg,
 |  | const char * | dir = 0L,
 |  | const FSSpec * | spec = 0L
 | ) | [virtual]

Reimplemented from CvsArgs.

Definition at line 1248 of file CvsCommands.cpp.

01249 {
01250     CvsArgs::addfile(arg, dir, spec);
01251
01252     CStr fullpath(dir);
01253     if(!fullpath.endsWith(kPathDelimiter))
01254         fullpath << kPathDelimiter;
01255     fullpath << arg;
01256
01257     // check the file is not already deleted
01258     struct stat sb;
01259     if (stat(dir, &sb) != -1 && S_ISDIR(sb.st_mode) &&
01260         stat(fullpath, &sb) == -1 && errno == ENOENT)
01261     {
01262         return;
01263     }
01264
01265     if(!CompatMoveToTrash(arg, dir, spec))
01266 #ifdef WIN32
01267         cvs_err("Unable to send \'%s\' to the recycle bin\n", arg);
01268     else
01269         cvs_out("\'%s\' has been moved successfully to the recycle bin...\n", arg);
01270 #elif !defined(macintosh)
01271         cvs_err("Unable to send \'%s\' to the trash\n", arg);
01272     else
01273         cvs_out("\'%s\' has been moved successfully to trash...\n", arg);
01274 #else
01275     {}
01276 #endif
01277 }

The documentation for this class was generated from the following file:
  • common/CvsCommands.cpp
Generated on Sun Oct 21 12:49:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ReportConflict Class Reference

#include <ImportFilter.h>

Collaboration diagram for ReportConflict:

[legend]
List of all members.

Public Types

enum {
noConflict = 0x00, hasConflict = 0x01, hasExtension = 0x02, isBinary = 0x04,
forceBinary = 0x08, forceText = 0x10, hasIgnore = 0x20, hasTypeCreatorConflict = 0x40,
forceNoKeywords = 0x80, userFlags = forceText | forceBinary | hasIgnore | forceNoKeywords
}

Public Methods

ReportConflict (int mac_type, int mac_creator)
~ReportConflict ()
void | AddPattern (const char *newpat, bool isBinary, bool isExtension, const char *sample)
void | SetConflict (const char *sample)
void | SetTypeCreatorConflict (const char *sample)
bool | Match (const char *pat)
bool | HasConflict (void) const
bool | HasTypeCreatorConflict (void) const
bool | IsBinary (void) const
bool | IsExtension (void) const
const char * | GetPattern (void) const
int | GetMacType (void) const
int | GetMacCreator (void) const
void | ForceBinary (void)
void | ForceText (void)
void | Ignore (void)
void | ForceNoKeywords (void)
bool | HasForceBinary (void) const
bool | HasForceText (void) const
bool | HasIgnore (void) const
bool | HasForceNoKeywords (void) const
void | DisableUserSettings (void)
void | PrintOut (UStr &out) const

Public Attributes

ReportConflict * | next

Protected Attributes

int | status
UStr pattern
UStr sample1
UStr sample2
int | ftype
int | fcreator

Member Enumeration Documentation

anonymous enum

Enumeration values:
noConflict
hasConflict
hasExtension
isBinary
forceBinary
forceText
hasIgnore
hasTypeCreatorConflict
forceNoKeywords
userFlags

Definition at line 52 of file ImportFilter.h.

00053     {
00054         noConflict =        0x00,
00055         hasConflict =       0x01,
00056         hasExtension =      0x02,
00057         isBinary =          0x04,
00058         forceBinary =       0x08,
00059         forceText =         0x10,
00060         hasIgnore =         0x20,
00061         hasTypeCreatorConflict = 0x40, /* mac only */
00062         forceNoKeywords =   0x80,
00063         userFlags =     forceText | forceBinary | hasIgnore | forceNoKeywords
00064     };

Constructor & Destructor Documentation

ReportConflict::ReportConflict | ( | int | mac_type,
 |  | int | mac_creator
 | ) |

Definition at line 75 of file ImportFilter.cpp.

00076 {
00077     next = 0L;
00078     status = noConflict;
00079     ftype = mac_type;
00080     fcreator = mac_creator;
00081 }

ReportConflict::~ReportConflict ( )

Definition at line 137 of file ImportFilter.cpp.

00138 {
00139 }

Member Function Documentation

void ReportConflict::AddPattern | ( | const char * | newpat,
 |  | bool | isBin,
 |  | bool | isExt,
 |  | const char * | sample
 | ) |

Definition at line 141 of file ImportFilter.cpp.

Referenced by list_add_type().

00143 {
00144     pattern = newpat;
00145     sample1 = sample;
00146     if(isBin)
00147         status |= isBinary;
00148     if(isExt)
00149         status |= hasExtension;
00150 }

void ReportConflict::DisableUserSettings ( void ) [inline]

Definition at line 92 of file ImportFilter.h.

00093         {status &= ~(int)userFlags;}

void ReportConflict::ForceBinary ( void ) [inline]

Definition at line 80 of file ImportFilter.h.

00081         {status &= ~(int)userFlags; status |= (int)forceBinary;}

void ReportConflict::ForceNoKeywords ( void ) [inline]

Definition at line 86 of file ImportFilter.h.

00087         {status &= ~(int)userFlags; status |= (int)forceNoKeywords;}

void ReportConflict::ForceText ( void ) [inline]

Definition at line 82 of file ImportFilter.h.

00083         {status &= ~(int)userFlags; status |= (int)forceText;}

int ReportConflict::GetMacCreator ( void ) const [inline]

Definition at line 78 of file ImportFilter.h.

Referenced by list_add_type().

00078 {return fcreator;} /* mac only */

int ReportConflict::GetMacType ( void ) const [inline]

Definition at line 77 of file ImportFilter.h.

Referenced by list_add_type().

00077 {return ftype;} /* mac only */

const char* ReportConflict::GetPattern ( void ) const [inline]

Definition at line 76 of file ImportFilter.h.

Referenced by CvsCmdImportModule().

00076 {return pattern;}

bool ReportConflict::HasConflict ( void ) const [inline]

Definition at line 72 of file ImportFilter.h.

Referenced by PrintOut(), SetConflict(), SetTypeCreatorConflict(), and list_add_type().

00072 {return (status & hasConflict) != 0;}

bool ReportConflict::HasForceBinary ( void ) const [inline]

Definition at line 88 of file ImportFilter.h.

Referenced by CvsCmdImportModule().

00088 {return (status & forceBinary) != 0;}

bool ReportConflict::HasForceNoKeywords ( void ) const [inline]

Definition at line 91 of file ImportFilter.h.

Referenced by CvsCmdImportModule().

00091 {return (status & forceNoKeywords) != 0;}

bool ReportConflict::HasForceText ( void ) const [inline]

Definition at line 89 of file ImportFilter.h.

Referenced by CvsCmdImportModule().

00089 {return (status & forceText) != 0;}

bool ReportConflict::HasIgnore ( void ) const [inline]

Definition at line 90 of file ImportFilter.h.

Referenced by CvsCmdImportModule().

00090 {return (status & hasIgnore) != 0;}

bool ReportConflict::HasTypeCreatorConflict ( void ) const [inline]

Definition at line 73 of file ImportFilter.h.

Referenced by PrintOut(), and SetTypeCreatorConflict().

00073 {return (status & hasTypeCreatorConflict) != 0;} /* mac only */

void ReportConflict::Ignore ( void ) [inline]

Definition at line 84 of file ImportFilter.h.

Referenced by list_add_type().

00085         {status &= ~(int)userFlags; status |= (int)hasIgnore;}

bool ReportConflict::IsBinary ( void ) const [inline]

Definition at line 74 of file ImportFilter.h.

Referenced by CvsCmdImportModule(), and list_add_type().

00074 {return (status & isBinary) != 0;}

bool ReportConflict::IsExtension ( void ) const [inline]

Definition at line 75 of file ImportFilter.h.

Referenced by CvsCmdImportModule().

00075 {return (status & hasExtension) != 0;}

bool ReportConflict::Match ( const char * pat )

Definition at line 152 of file ImportFilter.cpp.

Referenced by list_add_type().

00153 {
00154     if(pat == 0L || pattern.empty())
00155         return false;
00156
00157     int len = strlen(pat);
00158     int patlen = pattern.length();
00159
00160     if(status & hasExtension)
00161     {
00162         if(len < patlen)
00163             return false;
00164         // since it is the server who compares against the pattern,
00165         // that might be a case compare
00166 #if 0 //def WIN32
00167         return stricmp(pattern, pat + len - patlen) == 0;
00168 #else /* !WIN32 */
00169         return strcmp(pattern, pat + len - patlen) == 0;
00170 #endif /* !WIN32 */
00171     }
00172
00173 #if 0 //def WIN32
00174     return stricmp(pattern, pat) == 0;
00175 #else /* !WIN32 */
00176     return strcmp(pattern, pat) == 0;
00177 #endif /* !WIN32 */
00178 }

void ReportConflict::PrintOut ( UStr & out ) const

Definition at line 83 of file ImportFilter.cpp.

00084 {
00085     out = "";
00086     if(HasConflict())
00087     {
00088         out << "Text/Binary conflict, at least these files :";
00089         out << lf;
00090         if(!sample1.empty() && !sample2.empty())
00091         {
00092             out << "    ";
00093             out << sample1;
00094             out << " and ";
00095             out << sample2;
00096             out << lf;
00097         }
00098     }
00099     else if(HasTypeCreatorConflict())
00100     {
00101         out << "Mac signature mismatch for this type, at least these files :";
00102         out << lf;
00103         if(!sample1.empty() && !sample2.empty())
00104         {
00105             out << "    ";
00106             out << sample1;
00107             out << " and ";
00108             out << sample2;
00109             out << lf;
00110         }
00111     }
00112 }

void ReportConflict::SetConflict ( const char * sample )

Definition at line 180 of file ImportFilter.cpp.

Referenced by list_add_type().

00181 {
00182     // one is enough !
00183     if(HasConflict())
00184         return;
00185
00186     sample2 = sample;
00187     status |= hasConflict;
00188 }

void ReportConflict::SetTypeCreatorConflict ( const char * sample )

Definition at line 190 of file ImportFilter.cpp.

Referenced by list_add_type().

00191 {
00192     // one is enough !
00193     if(HasTypeCreatorConflict() || HasConflict())
00194         return;
00195
00196     sample2 = sample;
00197     status |= hasTypeCreatorConflict;
00198 }

Member Data Documentation

int ReportConflict::fcreator [protected]

Definition at line 110 of file ImportFilter.h.

int ReportConflict::ftype [protected]

Definition at line 110 of file ImportFilter.h.

ReportConflict* ReportConflict::next

Definition at line 50 of file ImportFilter.h.

Referenced by CvsCmdImportModule(), free_list_types(), and list_add_type().

UStr ReportConflict::pattern [protected]

Definition at line 103 of file ImportFilter.h.

UStr ReportConflict::sample1 [protected]

Definition at line 105 of file ImportFilter.h.

UStr ReportConflict::sample2 [protected]

Definition at line 107 of file ImportFilter.h.

int ReportConflict::status [protected]

Definition at line 101 of file ImportFilter.h.

The documentation for this class was generated from the following files:
  • common/ImportFilter.h
  • common/ImportFilter.cpp
Generated on Sun Oct 21 12:49:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


ReportWarning Class Reference

#include <ImportFilter.h>

Collaboration diagram for ReportWarning:

[legend]
List of all members.

Public Methods

ReportWarning (kTextBinTYPE akind)
~ReportWarning ()
void | AddWarning (const char *sample)
kTextBinTYPE | Kind (void) const
void | PrintOut (UStr &out) const

Public Attributes

ReportWarning * | next

Static Public Attributes

const size_t | maxWarnings = 10

Protected Attributes

kTextBinTYPE kind
std::vector< UStr > samples
bool | tooMuchWarnings

Constructor & Destructor Documentation

ReportWarning::ReportWarning ( kTextBinTYPE akind )

Definition at line 202 of file ImportFilter.cpp.

00203 {
00204     kind = akind;
00205     next = 0L;
00206     tooMuchWarnings = false;
00207 }

ReportWarning::~ReportWarning ( )

Definition at line 209 of file ImportFilter.cpp.

00210 {
00211 }

Member Function Documentation

void ReportWarning::AddWarning ( const char * sample )

Definition at line 281 of file ImportFilter.cpp.

Referenced by list_add_warning().

00282 {
00283     // it's enough !
00284     if(samples.size() >= maxWarnings)
00285     {
00286         tooMuchWarnings = true;
00287         return;
00288     }
00289
00290     samples.push_back(CStr(sample));
00291 }

kTextBinTYPE ReportWarning::Kind ( void ) const [inline]

Definition at line 127 of file ImportFilter.h.

Referenced by list_add_warning().

00127 {return kind;}

void ReportWarning::PrintOut ( UStr & out ) const

Definition at line 213 of file ImportFilter.cpp.

00214 {
00215     out = "";
00216
00217     if(samples.size() == 0)
00218         return;
00219
00220     out = "Warning : ";
00221     switch(kind)
00222     {
00223     default:
00224     case kFileIsOK: out << "Files are OK"; break;
00225     case kFileMissing: out << "Files are missing or unreadable"; break;
00226     case kFileIsAlias: out << "Files are aliases"; break;
00227     case kFileInvalidName: out << "Files have invalid name"; break;
00228     case kTextWrongLF: out << "Files have the wrong line feed"; break;
00229     case kTextIsBinary: out << "Files are binary"; break;
00230     case kTextEscapeChar: out << "Files have escape characters in it"; break;
00231     case kTextWrongSig: out << "Text files have the wrong signature"; break;
00232     case kBinIsText: out << "Files are text, should be binary"; break;
00233     case kBinWrongSig: out << "Binary files have the wrong signature"; break;
00234     }
00235     out << lf;
00236     std::vector<CStr>::const_iterator i;
00237     for(i = samples.begin(); i != samples.end(); ++i)
00238     {
00239         out << "    ";
00240         out << *i;
00241         out << lf;
00242     }
00243     if(tooMuchWarnings)
00244     {
00245         out << "    More files follow";
00246         out << lf;
00247     }
00248 }

Member Data Documentation

kTextBinTYPE ReportWarning::kind [protected]

Definition at line 135 of file ImportFilter.h.

const size_t ReportWarning::maxWarnings = 10 [static]

Definition at line 200 of file ImportFilter.cpp.

ReportWarning* ReportWarning::next

Definition at line 123 of file ImportFilter.h.

Referenced by free_list_types(), and list_add_warning().

std::vector< UStr > ReportWarning::samples [protected]

Definition at line 137 of file ImportFilter.h.

bool ReportWarning::tooMuchWarnings [protected]

Definition at line 138 of file ImportFilter.h.

The documentation for this class was generated from the following files:
  • common/ImportFilter.h
  • common/ImportFilter.cpp
Generated on Sun Oct 21 12:49:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


request Struct Reference

#include <server.h>

Collaboration diagram for request:

[legend]
List of all members.

Public Attributes

char * | name
int | flags

Member Data Documentation

int request::flags

Definition at line 153 of file server.h.

char* request::name

Definition at line 142 of file server.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/server.h
Generated on Sun Oct 21 12:49:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


response Struct Reference

#include <client.h>

Collaboration diagram for response:

[legend]
List of all members.

Public Types

enum | { rs_essential, rs_optional, rs_supported, rs_not_supported }

Public Attributes

char * | name
enum response:: { ... } | status

Member Enumeration Documentation

anonymous enum

Enumeration values:
rs_essential
rs_optional
rs_supported
rs_not_supported

Definition at line 159 of file client.h.

00159          {
00160       /*
00161        * Failure to implement this response can imply a fatal
00162        * error.  This should be set only for responses which were in the
00163        * original version of the protocol; it should not be set for new
00164        * responses.
00165        */
00166       rs_essential,
00167
00168       /* Some clients might not understand this response.  */
00169       rs_optional,
00170
00171       /*
00172        * Set by the server to one of the following based on what this
00173        * client actually supports.
00174        */
00175       rs_supported,
00176       rs_not_supported
00177       } status;

Member Data Documentation

char* response::name

Definition at line 137 of file client.h.

enum { ... } response::status

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/client.h
Generated on Sun Oct 21 12:49:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CRevFile Class Reference

#include <CvsLog.h>

Collaboration diagram for CRevFile:

[legend]
List of all members.

Public Methods

CRevFile ()
CRevFile (const CRevFile &afile)
virtual | ~CRevFile ()
CRevFile & | operator= (const CRevFile &afile)
bool | operator< (const CRevFile &afile) const
bool | operator== (const CRevFile &afile) const
void | print (ostream &out) const
const CRevNumber & | RevNum (void) const
CRevNumber & | RevNum (void)
const struct tm & | RevTime (void) const
tm & | RevTime (void)
const CLogStr & | Locker (void) const
CLogStr & | Locker (void)
const std::vector< CRevNumber > & | BranchesList (void) const
std::vector< CRevNumber > & | BranchesList (void)
CRevNumber & | LastBranche (void)
const CLogStr & | Author (void) const
CLogStr & | Author (void)
const CLogStr & | State (void) const
CLogStr & | State (void)
int | ChgPos (void) const
int & | ChgPos (void)
int | ChgNeg (void) const
int & | ChgNeg (void)
const CLogStr & | DescLog (void) const
CLogStr & | DescLog (void)

Protected Attributes

CRevNumber revNum
tm | revTime
CLogStr locker
std::vector< CRevNumber > branchesList
CLogStr author
CLogStr state
int | chgPos
int | chgNeg
CLogStr descLog

Constructor & Destructor Documentation

CRevFile::CRevFile ( )

Definition at line 406 of file CvsLog.cpp.

00407 {
00408     chgPos = 0;
00409     chgNeg = 0;
00410     memset(&revTime, 0, sizeof(revTime));
00411 }

CRevFile::CRevFile ( const CRevFile & afile )

Definition at line 413 of file CvsLog.cpp.

00414 {
00415     *this = afile;
00416 }

CRevFile::~CRevFile ( ) [virtual]

Definition at line 418 of file CvsLog.cpp.

00419 {
00420 }

Member Function Documentation

CLogStr& CRevFile::Author ( void ) [inline]

Definition at line 158 of file CvsLog.h.

00158 { return author; }

const CLogStr& CRevFile::Author ( void ) const [inline]

Definition at line 157 of file CvsLog.h.

Referenced by outputXML(), and print().

00157 { return author; }

std::vector<CRevNumber>& CRevFile::BranchesList ( void ) [inline]

Definition at line 154 of file CvsLog.h.

00154 { return branchesList; }

const std::vector<CRevNumber>& CRevFile::BranchesList ( void ) const [inline]

Definition at line 153 of file CvsLog.h.

Referenced by outputXML(), and print().

00153 { return branchesList; }

int& CRevFile::ChgNeg ( void ) [inline]

Definition at line 167 of file CvsLog.h.

00167 { return chgNeg; }

int CRevFile::ChgNeg ( void ) const [inline]

Definition at line 166 of file CvsLog.h.

Referenced by outputXML(), and print().

00166 { return chgNeg; }

int& CRevFile::ChgPos ( void ) [inline]

Definition at line 164 of file CvsLog.h.

00164 { return chgPos; }

int CRevFile::ChgPos ( void ) const [inline]

Definition at line 163 of file CvsLog.h.

Referenced by outputXML(), and print().

00163 { return chgPos; }

CLogStr& CRevFile::DescLog ( void ) [inline]

Definition at line 170 of file CvsLog.h.

00170 { return descLog; }

const CLogStr& CRevFile::DescLog ( void ) const [inline]

Definition at line 169 of file CvsLog.h.

Referenced by CGraphView::OnGraphChangelogmessage(), outputXML(), and print().

00169 { return descLog; }

CRevNumber& CRevFile::LastBranche ( void ) [inline]

Definition at line 155 of file CvsLog.h.

00155 { return branchesList[branchesList.size() - 1]; }

CLogStr& CRevFile::Locker ( void ) [inline]

Definition at line 151 of file CvsLog.h.

00151 { return locker; }

const CLogStr& CRevFile::Locker ( void ) const [inline]

Definition at line 150 of file CvsLog.h.

Referenced by print().

00150 { return locker; }

CRevNumber& CRevFile::RevNum ( void ) [inline]

Definition at line 145 of file CvsLog.h.

00145 { return revNum; }

const CRevNumber& CRevFile::RevNum ( void ) const [inline]

Definition at line 144 of file CvsLog.h.

Referenced by CvsLogGraph(), outputXML(), and print().

00144 { return revNum; }

struct tm& CRevFile::RevTime ( void ) [inline]

Definition at line 148 of file CvsLog.h.

00148 { return revTime; }

const struct tm& CRevFile::RevTime ( void ) const [inline]

Definition at line 147 of file CvsLog.h.

Referenced by print().

00147 { return revTime; }

CLogStr& CRevFile::State ( void ) [inline]

Definition at line 161 of file CvsLog.h.

00161 { return state; }

const CLogStr& CRevFile::State ( void ) const [inline]

Definition at line 160 of file CvsLog.h.

Referenced by CGraphView::OnGraphSetstate(), outputXML(), and print().

00160 { return state; }

bool CRevFile::operator< ( const CRevFile & afile ) const

CRevFile & CRevFile::operator= ( const CRevFile & afile )

Definition at line 422 of file CvsLog.cpp.

00423 {
00424     revNum = afile.revNum;
00425     revTime = afile.revTime;
00426     locker = afile.locker;
00427     branchesList = afile.branchesList;
00428     author = afile.author;
00429     state = afile.state;
00430     chgPos = afile.chgPos;
00431     chgNeg = afile.chgNeg;
00432     descLog = afile.descLog;
00433     return *this;
00434 }

bool CRevFile::operator== ( const CRevFile & afile ) const

void CRevFile::print ( ostream & out ) const

Member Data Documentation

CLogStr CRevFile::author [protected]

Definition at line 177 of file CvsLog.h.

Referenced by operator=().

std::vector<CRevNumber> CRevFile::branchesList [protected]

Definition at line 176 of file CvsLog.h.

Referenced by operator=().

int CRevFile::chgNeg [protected]

Definition at line 180 of file CvsLog.h.

Referenced by operator=().

int CRevFile::chgPos [protected]

Definition at line 179 of file CvsLog.h.

Referenced by operator=().

CLogStr CRevFile::descLog [protected]

Definition at line 181 of file CvsLog.h.

Referenced by operator=().

CLogStr CRevFile::locker [protected]

Definition at line 175 of file CvsLog.h.

Referenced by operator=().

CRevNumber CRevFile::revNum [protected]

Definition at line 173 of file CvsLog.h.

Referenced by operator=().

struct tm CRevFile::revTime [protected]

Definition at line 174 of file CvsLog.h.

Referenced by operator=().

CLogStr CRevFile::state [protected]

Definition at line 178 of file CvsLog.h.

Referenced by operator=().

The documentation for this class was generated from the following files:
  • cvstree/CvsLog.h
  • cvstree/CvsLog.cpp
Generated on Sun Oct 21 12:49:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CRevisionConsole Class Reference

Inheritance diagram for CRevisionConsole:

[legend]
Collaboration diagram for CRevisionConsole:

[legend]
List of all members.

Public Methods

CRevisionConsole ()
~CRevisionConsole ()
BOOL | init (LPCTSTR path, LPCTSTR fname)
virtual long | cvs_out (char *txt, long len)
virtual long | cvs_err (char *txt, long len)

Protected Attributes

FILE * | fOut

Constructor & Destructor Documentation

CRevisionConsole::CRevisionConsole ( ) [inline]

Definition at line 1515 of file GraphView.cpp.

01516     : fOut(NULL)
01517     {}

CRevisionConsole::~CRevisionConsole ( ) [inline]

Definition at line 1519 of file GraphView.cpp.

01520     {
01521         if (fOut)
01522         {
01523             fclose(fOut);
01524         }
01525     }

Member Function Documentation

virtual long CRevisionConsole::cvs_err | ( | char * | txt,
 |  | long | len
 | ) | [inline, virtual]

Reimplemented from CCvsConsole.

Definition at line 1541 of file GraphView.cpp.

01542     {
01543         cvs_errstr(txt, len);
01544         return len;
01545     }

virtual long CRevisionConsole::cvs_out | ( | char * | txt,
 |  | long | len
 | ) | [inline, virtual]

Reimplemented from CCvsConsole.

Definition at line 1535 of file GraphView.cpp.

01536     {
01537         fwrite(txt, sizeof(char), len, fOut);
01538         return len;
01539     }

BOOL CRevisionConsole::init | ( | LPCTSTR | path,
 |  | LPCTSTR | fname
 | ) | [inline]

Definition at line 1527 of file GraphView.cpp.

Referenced by CGraphView::OnViewRetrieve().

01528     {
01529         TCHAR buf[_MAX_PATH];
01530         _tmakepath(buf, NULL, path, fname, NULL);
01531         fOut = fopen(buf, "w+");
01532         return fOut != NULL;
01533     }

Member Data Documentation

FILE* CRevisionConsole::fOut [protected]

Definition at line 1548 of file GraphView.cpp.

The documentation for this class was generated from the following file:
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:49:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


revlist Struct Reference

Collaboration diagram for revlist:

[legend]
List of all members.

Public Attributes

revlist * | next
char * | first
char * | last
int | fields

Member Data Documentation

int revlist::fields

Definition at line 48 of file log.c.

Referenced by default_branch().

char* revlist::first

Definition at line 43 of file log.c.

Referenced by default_branch().

char* revlist::last

Definition at line 45 of file log.c.

Referenced by default_branch().

struct revlist* revlist::next

Definition at line 41 of file log.c.

Referenced by default_branch().

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/log.c
Generated on Sun Oct 21 12:49:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CRevNumber Class Reference

#include <CvsLog.h>

Collaboration diagram for CRevNumber:

[legend]
List of all members.

Public Methods

CRevNumber ()
virtual | ~CRevNumber ()
void | reset (void)
int | size () const
int | cmp (const CRevNumber &arev) const
CRevNumber & | operator+= (int adigit)
CRevNumber & | operator= (const CRevNumber &arev)
bool | operator== (const CRevNumber &arev) const
int | operator[] (int index) const
bool | operator< (const CRevNumber &arev) const
bool | ischildof (const CRevNumber &arev) const
bool | issamebranch (const CRevNumber &arev) const
bool | ispartof (const CRevNumber &arev) const
bool | issubbranchof (const CRevNumber &arev) const
const std::vector< int > & | IntList (void) const
std::vector< int > & | IntList (void)
const CLogStr & | Tag (void) const
CLogStr & | Tag (void)
const char * | c_str (void) const

Protected Attributes

std::vector< int > | allDigits
CLogStr tagName

Constructor & Destructor Documentation

CRevNumber::CRevNumber ( ) [inline]

Definition at line 92 of file CvsLog.h.

00092 {}

virtual CRevNumber::~CRevNumber ( ) [inline, virtual]

Definition at line 93 of file CvsLog.h.

00093 { reset(); }

Member Function Documentation

std::vector<int>& CRevNumber::IntList ( void ) [inline]

Definition at line 119 of file CvsLog.h.

00119 { return allDigits; }

const std::vector<int>& CRevNumber::IntList ( void ) const [inline]

Definition at line 118 of file CvsLog.h.

Referenced by cmp(), ischildof(), ispartof(), issamebranch(), issubbranchof(), and operator==().

00118 { return allDigits; }

CLogStr& CRevNumber::Tag ( void ) [inline]

Definition at line 122 of file CvsLog.h.

00122 { return tagName; }

const CLogStr& CRevNumber::Tag ( void ) const [inline]

Definition at line 121 of file CvsLog.h.

Referenced by insertBranchName(), insertSymbName(), operator=(), and print().

00121 { return tagName; }

const char * CRevNumber::c_str ( void ) const

Definition at line 71 of file CvsLog.cpp.

Referenced by outputXML(), and print().

00072 {
00073     static CLogStr str;
00074     str = "";
00075     if(allDigits.empty())
00076         return str;
00077     std::vector<int>::const_iterator i = allDigits.begin();
00078     str << *i;
00079     ++i;
00080     for(; i != allDigits.end(); ++i)
00081     {
00082         str << '.' << *i;
00083     }
00084     return str;
00085 }

int CRevNumber::cmp ( const CRevNumber & arev ) const

Definition at line 87 of file CvsLog.cpp.

Referenced by sortRevFile(), and sortRevs().

00088 {
00089     const std::vector<int> & rev1 = IntList();
00090     const std::vector<int> & rev2 = arev.IntList();
00091
00092     std::vector<int>::const_iterator i = rev1.begin();
00093     std::vector<int>::const_iterator j = rev2.begin();
00094     while(i != rev1.end() && j != rev2.end())
00095     {
00096         if((*i) != (*j))
00097             return (*i) < (*j) ? -1 : 1;
00098         ++i;
00099         ++j;
00100     }
00101     if(i == rev1.end() && j != rev2.end())
00102         return -1;
00103     if(i != rev1.end() && j == rev2.end())
00104         return 1;
00105     return 0;
00106 }

bool CRevNumber::ischildof ( const CRevNumber & arev ) const

Definition at line 120 of file CvsLog.cpp.

Referenced by CvsLogGraph().

00121 {
00122     if((arev.size() + 2) != size())
00123         return false;
00124     const std::vector<int> & rev1 = IntList();
00125     const std::vector<int> & rev2 = arev.IntList();
00126     std::vector<int>::const_iterator i = rev1.begin();
00127     std::vector<int>::const_iterator j = rev2.begin();
00128     return memcmp(&*i, &*j, arev.size() * sizeof(int)) == 0;
00129 }

bool CRevNumber::ispartof ( const CRevNumber & arev ) const

Definition at line 142 of file CvsLog.cpp.

00143 {
00144     const std::vector<int> & rev1 = IntList();
00145     const std::vector<int> & rev2 = arev.IntList();
00146     std::vector<int>::const_iterator i = rev1.begin();
00147     std::vector<int>::const_iterator j = rev2.begin();
00148
00149     if((arev.size() & 1) != 0)
00150     {
00151         // special case for "1.1.1"
00152         if((arev.size() + 1) != size())
00153             return false;
00154         return memcmp(&*i, &*j, arev.size() * sizeof(int)) == 0;
00155     }
00156
00157     // case for 1.1.1.1.2.4 is part of 1.1.1.1.0.2
00158     if(arev.size() != size() || size() < 2)
00159         return false;
00160
00161     if(memcmp(&*i, &*j, (size() - 2) * sizeof(int)) != 0)
00162         return false;
00163
00164     return arev.IntList()[size() - 2] == 0 &&
00165         IntList()[size() - 2] == arev.IntList()[size() - 1];
00166 }

bool CRevNumber::issamebranch ( const CRevNumber & arev ) const

Definition at line 131 of file CvsLog.cpp.

Referenced by CvsLogGraph().

00132 {
00133     if(arev.size() != size())
00134         return false;
00135     const std::vector<int> & rev1 = IntList();
00136     const std::vector<int> & rev2 = arev.IntList();
00137     std::vector<int>::const_iterator i = rev1.begin();
00138     std::vector<int>::const_iterator j = rev2.begin();
00139     return memcmp(&*i, &*j, (size() - 1) * sizeof(int)) == 0;
00140 }

bool CRevNumber::issubbranchof ( const CRevNumber & arev ) const

Definition at line 168 of file CvsLog.cpp.

Referenced by insertBranchName().

00169 {
00170     const std::vector<int> & rev1 = IntList();
00171     const std::vector<int> & rev2 = arev.IntList();
00172     std::vector<int>::const_iterator i = rev1.begin();
00173     std::vector<int>::const_iterator j = rev2.begin();
00174
00175     if((size() & 1) != 0)
00176     {
00177         // special case for "1.1.1"
00178         if((arev.size() + 1) != size())
00179             return false;
00180         return memcmp(&*i, &*j, arev.size() * sizeof(int)) == 0;
00181     }
00182
00183     // case for 1.4.0.2 is subbranch of 1.4
00184     if((arev.size() + 2) != size() || IntList()[arev.size()] != 0)
00185         return false;
00186
00187     return memcmp(&*i, &*j, arev.size() * sizeof(int)) == 0;
00188 }

CRevNumber & CRevNumber::operator+= ( int adigit )

Definition at line 47 of file CvsLog.cpp.

00048 {
00049     allDigits.push_back(adigit);
00050     return *this;
00051 }

bool CRevNumber::operator< ( const CRevNumber & arev ) const

CRevNumber & CRevNumber::operator= ( const CRevNumber & arev )

Definition at line 53 of file CvsLog.cpp.

00054 {
00055     reset();
00056     for(int i = 0; i < arev.size(); i++)
00057     {
00058         *this += arev[i];
00059     }
00060     tagName = arev.Tag();
00061     return *this;
00062 }

bool CRevNumber::operator== ( const CRevNumber & arev ) const

Definition at line 108 of file CvsLog.cpp.

00109 {
00110     if(size() != arev.size())
00111         return false;
00112
00113     const std::vector<int> & rev1 = IntList();
00114     const std::vector<int> & rev2 = arev.IntList();
00115     std::vector<int>::const_iterator i = rev1.begin();
00116     std::vector<int>::const_iterator j = rev2.begin();
00117     return memcmp(&*i, &*j, size() * sizeof(int)) == 0;
00118 }

int CRevNumber::operator[] ( int index ) const

Definition at line 64 of file CvsLog.cpp.

00065 {
00066     if(index < 0 || index >= size())
00067         return -1;
00068     return allDigits[index];
00069 }

void CRevNumber::reset ( void )

Definition at line 41 of file CvsLog.cpp.

Referenced by operator=(), yylex(), and yyreset().

00042 {
00043     allDigits.erase(allDigits.begin(), allDigits.end());
00044     tagName = "";
00045 }

int CRevNumber::size ( ) const [inline]

Definition at line 96 of file CvsLog.h.

Referenced by ischildof(), ispartof(), issamebranch(), issubbranchof(), operator=(), operator==(), and operator[]().

00096 {return allDigits.size();}

Member Data Documentation

std::vector<int> CRevNumber::allDigits [protected]

Definition at line 126 of file CvsLog.h.

CLogStr CRevNumber::tagName [protected]

Definition at line 127 of file CvsLog.h.

The documentation for this class was generated from the following files:
  • cvstree/CvsLog.h
  • cvstree/CvsLog.cpp
Generated on Sun Oct 21 12:49:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CRichEditView Class Reference

Inheritance diagram for CRichEditView:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/wincvsView.h
Generated on Sun Oct 21 12:49:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


URuntimeClass Class Reference

#include <uobject.h>

Collaboration diagram for URuntimeClass:

[legend]
List of all members.

Public Methods

URuntimeClass (const char *lpszClassName, int nObjectSize, UObject *(*pfnCreateObject)(), const URuntimeClass *(*pfnGetBaseClass)())
~URuntimeClass ()
UObject * CreateObject ()
bool | IsDerivedFrom (const URuntimeClass *pBaseClass) const

Public Attributes

const char * | m_lpszClassName
int | m_nObjectSize
UObject *(* m_pfnCreateObject )()
const URuntimeClass *(* | m_pfnGetBaseClass )()
URuntimeClass * | m_pNextClass

Static Public Attributes

URuntimeClass * | sAllURuntimeClass = 0L

Constructor & Destructor Documentation

URuntimeClass::URuntimeClass | ( | const char * | lpszClassName,
 |  | int | nObjectSize,
 |  | UObject *(* | pfnCreateObject)(),
 |  | const URuntimeClass *(* | pfnGetBaseClass)()
 | ) |

Definition at line 65 of file uobject.cpp.

00067 {
00068     m_lpszClassName = lpszClassName;
00069     m_nObjectSize = nObjectSize;
00070     m_pfnCreateObject = pfnCreateObject;
00071     m_pfnGetBaseClass = pfnGetBaseClass;
00072     m_pNextClass = sAllURuntimeClass;
00073
00074     sAllURuntimeClass = this;
00075 }

URuntimeClass::~URuntimeClass ( )

Definition at line 77 of file uobject.cpp.

00078 {
00079     URuntimeClass *next = sAllURuntimeClass;
00080     URuntimeClass *prev = 0L;
00081     while(next != 0L)
00082     {
00083         if(next == this)
00084         {
00085             if(prev == 0L)
00086                 sAllURuntimeClass = m_pNextClass;
00087             else
00088                 prev->m_pNextClass = m_pNextClass;
00089             break;
00090         }
00091
00092         prev = next;
00093         next = next->m_pNextClass;
00094     }
00095 }

Member Function Documentation

UObject * URuntimeClass::CreateObject ( )

Definition at line 97 of file uobject.cpp.

Referenced by UObject::CreateObject().

00098 {
00099     if (m_pfnCreateObject == 0L)
00100     {
00101         return 0L;
00102     }
00103
00104     UObject* pObject = 0L;
00105     try
00106     {
00107         pObject = (*m_pfnCreateObject)();
00108     }
00109     catch(...)
00110     {
00111     }
00112
00113     return pObject;
00114 }

bool URuntimeClass::IsDerivedFrom ( const URuntimeClass * pBaseClass ) const

Definition at line 116 of file uobject.cpp.

Referenced by UObject::IsKindOf().

00117 {
00118     // simple SI case
00119     const URuntimeClass* pClassThis = this;
00120     while (pClassThis != 0L)
00121     {
00122         if (pClassThis == pBaseClass)
00123             return true;
00124         pClassThis = (*pClassThis->m_pfnGetBaseClass)();
00125     }
00126     return false;       // walked to the top, no match
00127 }

Member Data Documentation

const char* URuntimeClass::m_lpszClassName

Definition at line 38 of file uobject.h.

Referenced by UObject::CreateObject().

int URuntimeClass::m_nObjectSize

Definition at line 39 of file uobject.h.

URuntimeClass* URuntimeClass::m_pNextClass

Definition at line 48 of file uobject.h.

Referenced by UObject::CreateObject(), and ~URuntimeClass().

UObject*(* URuntimeClass::m_pfnCreateObject)()

const URuntimeClass*(* URuntimeClass::m_pfnGetBaseClass)()

Referenced by IsDerivedFrom().

URuntimeClass * URuntimeClass::sAllURuntimeClass = 0L [static]

Definition at line 31 of file uobject.cpp.

The documentation for this class was generated from the following files:
  • rf/uobject.h
  • rf/uobject.cpp
Generated on Sun Oct 21 12:49:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


S_Dir Struct Reference

#include <dirent.h>

Collaboration diagram for S_Dir:

[legend]
List of all members.

Public Attributes

char * | dirname
int | max_ent
int | tot_ent
int | cur_ent
dirent ** entp

Member Data Documentation

int S_Dir::cur_ent

Definition at line 37 of file dirent.h.

char* S_Dir::dirname

Definition at line 34 of file dirent.h.

struct dirent** S_Dir::entp

Definition at line 38 of file dirent.h.

int S_Dir::max_ent

Definition at line 35 of file dirent.h.

int S_Dir::tot_ent

Definition at line 36 of file dirent.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/os2/dirent.h
Generated on Sun Oct 21 12:49:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


S_NAME Struct Reference

#include <ndir.h>

Collaboration diagram for S_NAME:

[legend]
List of all members.

Public Attributes

int | dd_fd
int | dd_loc
int | dd_size
char | dd_buf [512]

Member Data Documentation

char S_NAME::dd_buf[ 512 ]

Definition at line 49 of file ndir.h.

int S_NAME::dd_fd

Definition at line 46 of file ndir.h.

int S_NAME::dd_loc

Definition at line 47 of file ndir.h.

int S_NAME::dd_size

Definition at line 48 of file ndir.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/ndir.h
Generated on Sun Oct 21 12:49:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


saved_cwd Struct Reference

#include <savecwd.h>

Collaboration diagram for saved_cwd:

[legend]
List of all members.

Public Attributes

int | desc
char * | name

Member Data Documentation

int saved_cwd::desc

Definition at line 6 of file savecwd.h.

char* saved_cwd::name

Definition at line 7 of file savecwd.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/lib/savecwd.h
Generated on Sun Oct 21 12:49:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


USaveSettings Class Reference

Inheritance diagram for USaveSettings:

[legend]
Collaboration diagram for USaveSettings:

[legend]
List of all members.

Public Types

enum | { kSettingName = EV_COMMAND_START, kCopyPath, kCopyFrom, kCopyList }

Public Methods

USaveSettings (const char *path, const char *oldname)
virtual | ~USaveSettings ()
virtual void | DoDataExchange (bool fill)
while modaling, allows to fill/read the dialog content.
  • fill says if it expects to fill or read the dialog content.
 More...

Public Attributes

UStr m_settingName
UStr m_copyFromPath

Protected Methods

int | OnCopyFrom (void)
virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

UStr m_path
UStr m_oldname
std::map< UStr, UStr > | m_list

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Member Enumeration Documentation

anonymous enum

Enumeration values:
kSettingName
kCopyPath
kCopyFrom
kCopyList

Definition at line 742 of file Persistent.cpp.

00743     {
00744 #if qUnix
00745         kOK = EV_COMMAND_START,
00746         kCancel,
00747         kSettingName,
00748 #else
00749         kSettingName = EV_COMMAND_START,
00750 #endif
00751         kCopyPath,
00752         kCopyFrom,
00753         kCopyList
00754     };

Constructor & Destructor Documentation

USaveSettings::USaveSettings | ( | const char * | path,
 |  | const char * | oldname
 | ) |

Definition at line 797 of file Persistent.cpp.

00797                                                                   :
00798     UWidget(::UEventGetWidID()), m_path(path), m_oldname(oldname)
00799 {
00800 }

USaveSettings::~USaveSettings ( ) [virtual]

Definition at line 802 of file Persistent.cpp.

00803 {
00804 }

Member Function Documentation

void USaveSettings::DoDataExchange ( bool fill ) [virtual]

while modaling, allows to fill/read the dialog content.

  • fill says if it expects to fill or read the dialog content.

Reimplemented from UWidget.

Definition at line 808 of file Persistent.cpp.

00809 {
00810     if(fill)
00811     {
00812         UEventSendMessage(GetWidID(), EV_SETTEXT, kCopyPath,
00813             (void *)(const char *)m_path);
00814
00815         UStr defname;
00816         if(m_oldname.empty())
00817         {
00818             UStr uppath;
00819             SplitPath(m_path, uppath, defname);
00820         }
00821         else
00822             defname = m_oldname;
00823
00824         UEventSendMessage(GetWidID(), EV_SETTEXT, kSettingName,
00825             (void *)(const char *)defname);
00826
00827         UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kCopyList, 0), 0L);
00828
00829         UEventSendMessage(GetWidID(), EV_COMBO_RESETALL, kCopyList, 0L);
00830
00831         if(GetAllPersistentSettings(m_list))
00832         {
00833             std::map<UStr, UStr>::const_iterator i;
00834             for(i = m_list.begin(); i != m_list.end(); ++i)
00835             {
00836                 UEventSendMessage(GetWidID(), EV_COMBO_APPEND, kCopyList,
00837                     (void *)(const char *)(*i).first);
00838             }
00839         }
00840     }
00841     else
00842     {
00843         UEventSendMessage(GetWidID(), EV_GETTEXT, kSettingName,
00844             &m_settingName);
00845         int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCopyFrom, 0L);
00846         if(state)
00847         {
00848             UStr what;
00849             UEventSendMessage(GetWidID(), EV_COMBO_GETSEL, kCopyList, &what);
00850
00851             std::map<UStr, UStr>::const_iterator i;
00852             i = m_list.find(what);
00853             if(i != m_list.end())
00854             {
00855                 m_copyFromPath = (*i).second;
00856             }
00857         }
00858     }
00859 }

const UMSGMAP* USaveSettings::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

virtual const UMSGMAP* USaveSettings::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

const UMSGMAP* USaveSettings::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

int USaveSettings::OnCopyFrom ( void ) [protected]

Definition at line 861 of file Persistent.cpp.

00862 {
00863     int state = UEventSendMessage(GetWidID(), EV_QUERYSTATE, kCopyFrom, 0L);
00864     UEventSendMessage(GetWidID(), EV_ENABLECMD, UMAKEINT(kCopyList, state), 0L);
00865     return 1;
00866 }

Member Data Documentation

const UMSGMAP_ENTRY USaveSettings::_messageEntries[] [static, private]

Reimplemented from UWidget.

Definition at line 770 of file Persistent.cpp.

UStr USaveSettings::m_copyFromPath

Definition at line 757 of file Persistent.cpp.

Referenced by AskCreatePersistentSettings().

std::map<UStr, UStr> USaveSettings::m_list [protected]

Definition at line 762 of file Persistent.cpp.

UStr USaveSettings::m_oldname [protected]

Definition at line 761 of file Persistent.cpp.

UStr USaveSettings::m_path [protected]

Definition at line 760 of file Persistent.cpp.

UStr USaveSettings::m_settingName

Definition at line 756 of file Persistent.cpp.

Referenced by AskCreatePersistentSettings().

const UMSGMAP USaveSettings::messageMap [static, protected]

Reimplemented from UWidget.

Definition at line 770 of file Persistent.cpp.

The documentation for this class was generated from the following file:
  • common/Persistent.cpp
Generated on Sun Oct 21 12:49:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CScrollView Class Reference

Inheritance diagram for CScrollView:

[legend]
List of all members.

Public Methods

UPoint GetDeviceScrollPosition ()
void InvalidateRect (const URECT *r)

Member Function Documentation

UPoint CScrollView::GetDeviceScrollPosition ( ) [inline]

Definition at line 104 of file UCvsGraph.cpp.

Referenced by CGraphRectTracker::OnChangedRect(), CGraphView::OnContextMenu(), CGraphView::OnLButtonDown(), and CWinLogData::SetSelected().

00104 { return UPoint(0, 0); }

void CScrollView::InvalidateRect ( const URECT * r ) [inline]

Definition at line 105 of file UCvsGraph.cpp.

Referenced by CWinLogData::SetSelected().

00105 {}

The documentation for this class was generated from the following file:
  • common/UCvsGraph.cpp
Generated on Sun Oct 21 12:49:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


USemaphore Class Reference

#include <umain.h>

Collaboration diagram for USemaphore:

[legend]
List of all members.

Public Methods

USemaphore (bool &semaphore)
~USemaphore ()
bool | IsEnteredTwice () const

Protected Attributes

bool & | m_semaphore
bool | m_didSetSemaphore
bool | m_enteredTwice

Constructor & Destructor Documentation

USemaphore::USemaphore ( bool & semaphore ) [inline]

Definition at line 731 of file umain.h.

00731                                  : m_semaphore(semaphore), m_didSetSemaphore(false),
00732         m_enteredTwice(false)
00733     {
00734         if(m_semaphore)
00735         {
00736             m_enteredTwice = true;
00737             return;
00738         }
00739         m_semaphore = true;
00740         m_didSetSemaphore = true;
00741     }

USemaphore::~USemaphore ( ) [inline]

Definition at line 743 of file umain.h.

00744     {
00745         if(m_didSetSemaphore)
00746             m_semaphore = false;
00747     }

Member Function Documentation

bool USemaphore::IsEnteredTwice ( ) const [inline]

Definition at line 749 of file umain.h.

Referenced by FileTraverse(), UToolbar::OnCommands(), UMenu::OnCommands(), UWidget::OnInitWidget(), UCvsFolders::OnTreeExpanding(), UToolbar::OnUpdateUI(), UMenu::OnUpdateUI(), UMacAppMenu::OnUpdateUI(), and UCvsFiles::ResetView().

00749 { return m_enteredTwice; }

Member Data Documentation

bool USemaphore::m_didSetSemaphore [protected]

Definition at line 753 of file umain.h.

bool USemaphore::m_enteredTwice [protected]

Definition at line 754 of file umain.h.

bool& USemaphore::m_semaphore [protected]

Definition at line 752 of file umain.h.

The documentation for this class was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:49:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


SIG_hlist Struct Reference

Collaboration diagram for SIG_hlist:

[legend]
List of all members.

Public Attributes

RETSIGTYPE(* | handler )()
SIG_hlist * | next

Member Data Documentation

RETSIGTYPE(* SIG_hlist::handler)()

struct SIG_hlist* SIG_hlist::next

Definition at line 69 of file sighandle.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/lib/sighandle.c
Generated on Sun Oct 21 12:49:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


USIZE Struct Reference

#include <umain.h>

Inheritance diagram for USIZE:

[legend]
Collaboration diagram for USIZE:

[legend]
List of all members.

Public Attributes

int | cx
int | cy

Member Data Documentation

int USIZE::cx

Definition at line 899 of file umain.h.

Referenced by CWinLogData::ComputeBounds(), URect::DeflateRect(), CWinLogRevData::GetBoundsSelf(), UDC::GetTextExtent(), URect::InflateRect(), UPoint::Offset(), URect::OffsetRect(), UDC::TextOutClipped(), URect::URect(), USize::operator!=(), URect::operator+(), UPoint::operator+(), USize::operator+(), URect::operator+=(), UPoint::operator+=(), USize::operator+=(), URect::operator-(), UPoint::operator-(), USize::operator-(), URect::operator-=(), UPoint::operator-=(), USize::operator-=(), and USize::operator==().

int USIZE::cy

Definition at line 899 of file umain.h.

Referenced by CWinLogData::ComputeBounds(), URect::DeflateRect(), CWinLogRevData::GetBoundsSelf(), UDC::GetTextExtent(), URect::InflateRect(), UPoint::Offset(), URect::OffsetRect(), UDC::TextOutClipped(), URect::URect(), USize::operator!=(), URect::operator+(), UPoint::operator+(), USize::operator+(), URect::operator+=(), UPoint::operator+=(), USize::operator+=(), URect::operator-(), UPoint::operator-(), USize::operator-(), URect::operator-=(), UPoint::operator-=(), USize::operator-=(), and USize::operator==().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:49:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


USize Class Reference

#include <udraw.h>

Inheritance diagram for USize:

[legend]
Collaboration diagram for USize:

[legend]
List of all members.

Public Methods

USize ()
USize (int initCX, int initCY)
USize (USIZE initSize)
USize (UPOINT initPt)
bool | operator== (USIZE size) const
bool | operator!= (USIZE size) const
void | operator+= (USIZE size)
void | operator-= (USIZE size)
USize | operator+ (USIZE size) const
USize | operator- (USIZE size) const
USize | operator- () const
UPoint | operator+ (UPOINT point) const
UPoint | operator- (UPOINT point) const
URect | operator+ (const URECT *lpRect) const
URect | operator- (const URECT *lpRect) const

Constructor & Destructor Documentation

USize::USize ( ) [inline]

Definition at line 250 of file udraw.h.

Referenced by operator+(), and operator-().

00251     { /* random filled */ }

USize::USize | ( | int | initCX,
 |  | int | initCY
 | ) | [inline]

Definition at line 252 of file udraw.h.

00253     { cx = initCX; cy = initCY; }

USize::USize ( USIZE initSize ) [inline]

Definition at line 254 of file udraw.h.

00255     { *(USIZE*)this = initSize; }

USize::USize ( UPOINT initPt ) [inline]

Definition at line 256 of file udraw.h.

00257     { *(UPOINT*)this = initPt; }

Member Function Documentation

bool USize::operator!= ( USIZE size ) const [inline]

Definition at line 260 of file udraw.h.

00261     { return (cx != size.cx || cy != size.cy); }

URect USize::operator+ ( const URECT * lpRect ) const [inline]

Definition at line 276 of file udraw.h.

00277     { return URect(lpRect) + *this; }

UPoint USize::operator+ ( UPOINT point ) const [inline]

Definition at line 272 of file udraw.h.

00273     { return UPoint(cx + point.x, cy + point.y); }

USize USize::operator+ ( USIZE size ) const [inline]

Definition at line 266 of file udraw.h.

00267     { return USize(cx + size.cx, cy + size.cy); }

void USize::operator+= ( USIZE size ) [inline]

Definition at line 262 of file udraw.h.

00263     { cx += size.cx; cy += size.cy; }

URect USize::operator- ( const URECT * lpRect ) const [inline]

Definition at line 278 of file udraw.h.

00279     { return URect(lpRect) - *this; }

UPoint USize::operator- ( UPOINT point ) const [inline]

Definition at line 274 of file udraw.h.

00275     { return UPoint(cx - point.x, cy - point.y); }

USize USize::operator- ( ) const [inline]

Definition at line 270 of file udraw.h.

00271     { return USize(-cx, -cy); }

USize USize::operator- ( USIZE size ) const [inline]

Definition at line 268 of file udraw.h.

00269     { return USize(cx - size.cx, cy - size.cy); }

void USize::operator-= ( USIZE size ) [inline]

Definition at line 264 of file udraw.h.

00265     { cx -= size.cx; cy -= size.cy; }

bool USize::operator== ( USIZE size ) const [inline]

Definition at line 258 of file udraw.h.

00259     { return (cx == size.cx && cy == size.cy); }

The documentation for this class was generated from the following file:
  • rf/udraw.h
Generated on Sun Oct 21 12:49:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


USLIDER Struct Reference

#include <umain.h>

Collaboration diagram for USLIDER:

[legend]
List of all members.

Public Attributes

int | max
int | min
int | inc
int | pos

Member Data Documentation

int USLIDER::inc

Definition at line 887 of file umain.h.

Referenced by UWidget::OnGetSliderProperty(), and UWidget::OnSetSliderProperty().

int USLIDER::max

Definition at line 885 of file umain.h.

Referenced by UWidget::OnGetSliderProperty(), and UWidget::OnSetSliderProperty().

int USLIDER::min

Definition at line 886 of file umain.h.

Referenced by UWidget::OnGetSliderProperty(), and UWidget::OnSetSliderProperty().

int USLIDER::pos

Definition at line 888 of file umain.h.

Referenced by UWidget::OnGetSliderProperty(), and UWidget::OnSetSliderProperty().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:49:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CSortHeaderCtrl Class Reference

#include <SortHeaderCtrl.h>

Inheritance diagram for CSortHeaderCtrl:

[legend]
Collaboration diagram for CSortHeaderCtrl:

[legend]
List of all members.

Public Methods

CSortHeaderCtrl ()
virtual void | DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
virtual int | SetSortImage (int nCol, BOOL bAsc)
virtual | ~CSortHeaderCtrl ()

Protected Attributes

int | m_nSortCol
BOOL | m_bSortAsc

Constructor & Destructor Documentation

CSortHeaderCtrl::CSortHeaderCtrl ( )

Definition at line 14 of file SortHeaderCtrl.cpp.

00015 {
00016     m_bSortAsc  = TRUE;
00017     m_nSortCol  = -1;
00018 }

CSortHeaderCtrl::~CSortHeaderCtrl ( ) [virtual]

Definition at line 20 of file SortHeaderCtrl.cpp.

00021 {
00022 }

Member Function Documentation

void CSortHeaderCtrl::DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct ) [virtual]

Definition at line 45 of file SortHeaderCtrl.cpp.

00046 {
00047     CDC dc;
00048
00049     dc.Attach( lpDrawItemStruct->hDC );
00050
00051     // Get the column rect
00052     CRect rcLabel( lpDrawItemStruct->rcItem );
00053
00054     // Save DC
00055     int nSavedDC = dc.SaveDC();
00056
00057     // Set clipping region to limit drawing within column
00058     CRgn rgn;
00059     rgn.CreateRectRgnIndirect( &rcLabel );
00060     dc.SelectObject( &rgn );
00061     rgn.DeleteObject();
00062
00063     // Draw the background
00064     dc.FillRect(rcLabel, &CBrush(::GetSysColor(COLOR_3DFACE)));
00065
00066     // Labels are offset by a certain amount
00067     // This offset is related to the width of a space character
00068     int offset = dc.GetTextExtent(_T(" "), 1 ).cx*2;
00069
00070     // Get the column text and format
00071     TCHAR buf[256];
00072     HD_ITEM hditem;
00073
00074     hditem.mask = HDI_TEXT | HDI_FORMAT;
00075     hditem.pszText = buf;
00076     hditem.cchTextMax = 255;
00077
00078     GetItem( lpDrawItemStruct->itemID, &hditem );
00079
00080     // Determine format for drawing column label
00081     UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP
00082                         | DT_VCENTER | DT_END_ELLIPSIS ;
00083
00084     if( hditem.fmt & HDF_CENTER)
00085         uFormat |= DT_CENTER;
00086     else if( hditem.fmt & HDF_RIGHT)
00087         uFormat |= DT_RIGHT;
00088     else
00089         uFormat |= DT_LEFT;
00090
00091     // Adjust the rect if the mouse button is pressed on it
00092     if( lpDrawItemStruct->itemState == ODS_SELECTED )
00093     {
00094         rcLabel.left++;
00095         rcLabel.top += 2;
00096         rcLabel.right++;
00097     }
00098
00099     // Adjust the rect further if Sort arrow is to be displayed
00100     if( lpDrawItemStruct->itemID == (UINT)m_nSortCol )
00101     {
00102         rcLabel.right -= 3 * offset;
00103     }
00104
00105     rcLabel.left += offset;
00106     rcLabel.right -= offset;
00107
00108     // Draw column label
00109     if( rcLabel.left < rcLabel.right )
00110         dc.DrawText(buf,-1,rcLabel, uFormat);
00111
00112     // Draw the Sort arrow
00113     if( lpDrawItemStruct->itemID == (UINT)m_nSortCol )
00114     {
00115         CRect rcIcon( lpDrawItemStruct->rcItem );
00116
00117         // Set up pens to use for drawing the triangle
00118         CPen penLight(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
00119         CPen penShadow(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
00120         CPen *pOldPen = dc.SelectObject( &penLight );
00121
00122         offset = (rcIcon.bottom - rcIcon.top) / 4;
00123         if (m_bSortAsc)
00124         {
00125             // Draw triangle pointing upwards
00126             dc.MoveTo( rcIcon.right - 2* offset, offset);
00127             dc.LineTo( rcIcon.right - offset, rcIcon.bottom - offset-1 );
00128             dc.LineTo( rcIcon.right - 3*offset-2, rcIcon.bottom - offset-1 );
00129             dc.MoveTo( rcIcon.right - 3*offset-1, rcIcon.bottom - offset-1 );
00130             dc.SelectObject( &penShadow );
00131             dc.LineTo( rcIcon.right - 2*offset, offset-1);
00132         }
00133         else
00134         {
00135             // Draw triangle pointing downwards
00136             dc.MoveTo( rcIcon.right - offset-1, offset);
00137             dc.LineTo( rcIcon.right - 2*offset-1, rcIcon.bottom - offset );
00138             dc.MoveTo( rcIcon.right - 2*offset-2, rcIcon.bottom - offset );
00139             dc.SelectObject( &penShadow );
00140             dc.LineTo( rcIcon.right - 3*offset-1, offset );
00141             dc.LineTo( rcIcon.right - offset-1, offset);
00142         }
00143
00144         // Restore the pen
00145         dc.SelectObject( pOldPen );
00146     }
00147
00148     // Restore dc
00149     dc.RestoreDC( nSavedDC );
00150
00151     // Detach the dc before returning
00152     dc.Detach();
00153 }

int CSortHeaderCtrl::SetSortImage | ( | int | nCol,
 |  | BOOL | bAsc
 | ) | [virtual]

Definition at line 24 of file SortHeaderCtrl.cpp.

Referenced by CBrowseFileView::Resort().

00025 {
00026     int nPrevCol = m_nSortCol;
00027
00028     m_nSortCol = nCol;
00029     m_bSortAsc = bAsc;
00030
00031     // Change the item to ownder drawn
00032     HD_ITEM hditem;
00033
00034     hditem.mask = HDI_FORMAT;
00035     GetItem( nCol, &hditem );
00036     hditem.fmt |= HDF_OWNERDRAW;
00037     SetItem( nCol, &hditem );
00038
00039     // Invalidate header control so that it gets redrawn
00040     Invalidate();
00041
00042     return nPrevCol;
00043 }

Member Data Documentation

BOOL CSortHeaderCtrl::m_bSortAsc [protected]

Definition at line 19 of file SortHeaderCtrl.h.

int CSortHeaderCtrl::m_nSortCol [protected]

Definition at line 18 of file SortHeaderCtrl.h.

The documentation for this class was generated from the following files:
  • WinCvs/SortHeaderCtrl.h
  • WinCvs/SortHeaderCtrl.cpp
Generated on Sun Oct 21 12:49:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TemplateCSortList class Reference

CSortList Class Template Reference

#include <SortList.h>

Inheritance diagram for CSortList:

[legend]
Collaboration diagram for CSortList:

[legend]
List of all members.

Public Types

typedef int(* | QsortMethod )(const T &, const T &)

Public Methods

CSortList (int def_size, QsortMethod method_sort)
~CSortList ()
int | Insert (const T &entry, bool replaceIfAlreadyExists=false)
bool | Inside (const T &entry, int *indexptr=0L) const
bool | InsideAndInsert (const T &entry, int *indexptr=0L, bool replaceIfAlreadyExists=false)
bool | Delete (const T &entry)
T * | Result (int *num_elem)
const T & | Get (int index) const
void | Reset (void)
int | NumOfElements (void)

Private Methods

const T & | Entry (int num_elem) const
int | Location (const T &entry)

Private Attributes

QsortMethod fMethod
int | fDef
int | fNum
int | fMax
T * | fElems
bool | fNewOne

template<class T>
class CSortList< T >

Member Typedef Documentation

template<class T>
typedef int(* CSortList::QsortMethod)(const T &, const T &)

Constructor & Destructor Documentation

template<class T>
CSortList< T >::CSortList | ( | int | def_size,
 |  | QsortMethod | method_sort
 | ) | [inline]

Definition at line 50 of file SortList.h.

00051     {
00052         assert(def_size > 1 && method_sort != 0L);
00053
00054         fDef = def_size;
00055         fMethod = method_sort;
00056         fMax = fNum = 0;
00057         fElems = 0L;
00058         fNewOne = false;
00059     }

template<class T>
CSortList< T >::~CSortList ( ) [inline]

Definition at line 61 of file SortList.h.

00062     {
00063         Reset();
00064     }

Member Function Documentation

template<class T>
bool CSortList< T >::Delete ( const T & entry ) [inline]

Definition at line 151 of file SortList.h.

Referenced by Entries_Open().

00152     {
00153         int index = Location(entry), i;
00154
00155         if(fNewOne)
00156             return false;
00157
00158         if(fNum == 1)
00159         {
00160             Reset();
00161             return true;
00162         }
00163
00164         for(i = index; i < fNum - 1; i++)
00165         {
00166             fElems[i] = fElems[i + 1];
00167         }
00168         --fNum;
00169         return true;
00170     }

template<class T>
const T& CSortList< T >::Entry ( int num_elem ) const [inline, private]

Definition at line 217 of file SortList.h.

Referenced by Get(), and Location().

00218     {
00219         assert(num_elem >= 0 && num_elem < fNum);
00220
00221         return fElems[num_elem];
00222     }

template<class T>
const T& CSortList< T >::Get ( int index ) const [inline]

Definition at line 191 of file SortList.h.

Referenced by Entries_SetMissing(), Entries_SetVisited(), TViewFill::ExitDirectory(), CWinCvsBrowser::OnItemexpanding(), UCvsFolders::OnTreeExpanding(), UCvsFiles::ResetView(), cvsgui_GetCvsEntries(), and tclCvsEntriesProc().

00192     {
00193         return Entry(index);
00194     }

template<class T>
int CSortList< T >::Insert | ( | const T & | entry,
 |  | bool | replaceIfAlreadyExists = false
 | ) | [inline]

Definition at line 68 of file SortList.h.

Referenced by InsideAndInsert().

00069     {
00070         int index = Location(entry), i;
00071
00072         if(!fNewOne)
00073         {
00074             if(replaceIfAlreadyExists)
00075                 fElems[index] = entry;
00076
00077             return index;
00078         }
00079
00080         // check memory
00081         if(fNum == fMax)
00082         {
00083             T *newElems = 0L;
00084
00085             try
00086             {
00087                 newElems = new T[fMax + fDef];
00088
00089                 for(i = 0; i < fNum + 1; i++)
00090                 {
00091                     if(i < index)
00092                         newElems[i] = fElems[i];
00093                     else if(i == index)
00094                         newElems[i] = entry;
00095                     else
00096                         newElems[i] = fElems[i - 1];
00097                 }
00098             }
00099             catch(...)
00100             {
00101                 if(newElems != 0L)
00102                     delete[] newElems;
00103                 throw;
00104             }
00105
00106             fMax += fDef;
00107             fNum++;
00108             if(fElems != 0L)
00109                 delete[] fElems;
00110             fElems = newElems;
00111             return index;
00112         }
00113
00114         for(i = fNum - 1; i >= index; i--)
00115         {
00116             fElems[i + 1] = fElems[i];
00117         }
00118
00119         fElems[index] = entry;
00120         fNum++;
00121         return index;
00122     }

template<class T>
bool CSortList< T >::Inside | ( | const T & | entry,
 |  | int * | indexptr = 0L
 | ) | const [inline]

Definition at line 127 of file SortList.h.

00128     {
00129         int index = ((CSortList*)this)->Location(entry);
00130
00131         if(indexptr != 0L)
00132             *indexptr = fNewOne ? -1 : index;
00133
00134         return !fNewOne;
00135     }

template<class T>
bool CSortList< T >::InsideAndInsert | ( | const T & | entry,
 |  | int * | indexptr = 0L,
 |  | bool | replaceIfAlreadyExists = false
 | ) | [inline]

Definition at line 139 of file SortList.h.

Referenced by Entries_Open(), and Entries_SetVisited().

00141     {
00142         int index = Insert(entry, replaceIfAlreadyExists);
00143         if(indexptr != 0L)
00144             *indexptr = index;
00145
00146         return !fNewOne;
00147     }

template<class T>
int CSortList< T >::Location ( const T & entry ) [inline, private]

Definition at line 226 of file SortList.h.

Referenced by Delete(), and Insert().

00227     {
00228         int left, right, cmp_left = 0, cmp_right = 0;
00229         int cmp_middle, middle;
00230         computeSort compute;
00231
00232         if(fNum == 0)
00233         {
00234             fNewOne = true;
00235             return 0;
00236         }
00237
00238         fNewOne = false;
00239         left = 0;
00240         right = fNum - 1;
00241         compute = computeLR;
00242
00243         while(1)
00244         {
00245             middle = (left + right) / 2;
00246
00247             if(compute == computeLR)
00248             {
00249                 // firstime only
00250                 cmp_left = fMethod(Entry(left), entry);
00251                 cmp_right = fMethod(Entry(right), entry);
00252             }
00253             cmp_middle = fMethod(Entry(middle), entry);
00254
00255             // entry already exist (E == L || E == R)
00256             if(cmp_left == 0 || cmp_right == 0)
00257             {
00258                 return cmp_left == 0 ? left : right;
00259             }
00260
00261             // found an entry superior to the right (E > R && E < R + 1)
00262             if(cmp_right < 0)
00263             {
00264                 fNewOne = true;
00265                 return right + 1;
00266             }
00267
00268             // found an entry inferior to the left (L - 1 < E < L)
00269             if(cmp_left > 0)
00270             {
00271                 fNewOne = true;
00272                 return left;
00273             }
00274
00275             // found an entry inferior to the right (E > R - 1 && E < R)
00276             if(middle == left)
00277             {
00278                 fNewOne = true;
00279                 return right;
00280             }
00281
00282             // entry already exist (E == M)
00283             if(cmp_middle == 0)
00284                 return middle;
00285             // restart search (E > M && E < R)
00286             else if(cmp_middle < 0)
00287             {
00288                 compute = computeNone;
00289                 left = middle;
00290                 cmp_left = cmp_middle;
00291                 cmp_right = 1;
00292             }
00293             // restart search (E > L && E < M)
00294             else
00295             {
00296                 compute = computeNone;
00297                 right = middle;
00298                 cmp_right = cmp_middle;
00299                 cmp_left = -1;
00300             }
00301         }
00302         assert(0);
00303         return 0;
00304     }

template<class T>
int CSortList< T >::NumOfElements ( void ) [inline]

Definition at line 207 of file SortList.h.

Referenced by Entries_SetMissing(), TViewFill::ExitDirectory(), CWinCvsBrowser::OnItemexpanding(), UCvsFolders::OnTreeExpanding(), UCvsFiles::ResetView(), cvsgui_GetCvsEntries(), and tclCvsEntriesProc().

00207 {return fNum;}

template<class T>
void CSortList< T >::Reset ( void ) [inline]

Definition at line 198 of file SortList.h.

Referenced by Delete(), Entries_Open(), and ~CSortList().

00199     {
00200         if(fElems != 0L)
00201             delete[] fElems;
00202         fMax = fNum = 0;
00203         fElems = 0L;
00204     }

template<class T>
T* CSortList< T >::Result ( int * num_elem ) [inline]

Definition at line 173 of file SortList.h.

00174     {
00175         *num_elem = 0;
00176
00177         if(fNum == 0)
00178             return 0L;
00179
00180         *num_elem = fNum;
00181         T *res = new T[fNum];
00182         for(int i = 0; i < fNum; i++)
00183         {
00184             res[i] = fElems[i];
00185         }
00186
00187         return res;
00188     }

Member Data Documentation

template<class T>
int CSortList::fDef [private]

Definition at line 210 of file SortList.h.

template<class T>
T* CSortList::fElems [private]

Definition at line 213 of file SortList.h.

template<class T>
int CSortList::fMax [private]

Definition at line 212 of file SortList.h.

template<class T>
QsortMethod CSortList::fMethod [private]

Definition at line 209 of file SortList.h.

Referenced by Location().

template<class T>
bool CSortList::fNewOne [private]

Definition at line 214 of file SortList.h.

template<class T>
int CSortList::fNum [private]

Definition at line 211 of file SortList.h.

The documentation for this class was generated from the following file:
  • common/SortList.h
Generated on Sun Oct 21 12:49:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CSortParam Struct Reference

#include <BrowseViewColumn.h>

Collaboration diagram for CSortParam:

[legend]
List of all members.

Public Methods

CSortParam (bool fAccendant, bool fGroupSubDir, const KiColumn *column, const KiColumn *columnAlt, KoColumnContext *context)

Public Attributes

const KiColumn * | m_column
const KiColumn * | m_columnAlt
KoColumnContext * m_context
bool | m_fAccendant
bool | m_fGroupSubDir

Constructor & Destructor Documentation

CSortParam::CSortParam | ( | bool | fAccendant,
 |  | bool | fGroupSubDir,
 |  | const KiColumn * | column,
 |  | const KiColumn * | columnAlt,
 |  | KoColumnContext * | context
 | ) | [inline]

Definition at line 89 of file BrowseViewColumn.h.

00090     : m_fAccendant(fAccendant)
00091     , m_fGroupSubDir(fGroupSubDir)
00092     , m_column(column)
00093     , m_columnAlt(columnAlt)
00094     , m_context(context)
00095     {};

Member Data Documentation

const KiColumn* CSortParam::m_column

Definition at line 97 of file BrowseViewColumn.h.

const KiColumn* CSortParam::m_columnAlt

Definition at line 98 of file BrowseViewColumn.h.

KoColumnContext* CSortParam::m_context

Definition at line 99 of file BrowseViewColumn.h.

bool CSortParam::m_fAccendant

Definition at line 100 of file BrowseViewColumn.h.

bool CSortParam::m_fGroupSubDir

Definition at line 101 of file BrowseViewColumn.h.

The documentation for this struct was generated from the following file:
  • common/BrowseViewColumn.h
Generated on Sun Oct 21 12:49:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


sortrec Struct Reference

Collaboration diagram for sortrec:

[legend]
List of all members.

Public Attributes

char * | modname
char * | status
char * | rest
char * | comment

Member Data Documentation

char* sortrec::comment

Definition at line 50 of file modules.c.

char* sortrec::modname

Definition at line 41 of file modules.c.

char* sortrec::rest

Definition at line 49 of file modules.c.

char* sortrec::status

Definition at line 45 of file modules.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/modules.c
Generated on Sun Oct 21 12:49:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CSplashWnd Class Reference

#include <Splash.h>

Inheritance diagram for CSplashWnd:

[legend]
Collaboration diagram for CSplashWnd:

[legend]
List of all members.

Public Methods

~CSplashWnd ()
virtual void | PostNcDestroy ()

Static Public Methods

void | EnableSplashScreen (BOOL bEnable=TRUE)
void | ShowSplashScreen (CWnd *pParentWnd=NULL)
BOOL | PreTranslateAppMessage (MSG *pMsg)
void | CloseSplashScreen ()

Public Attributes

CBitmap | m_bitmap

Protected Methods

CSplashWnd ()
BOOL | Create (CWnd *pParentWnd=NULL)
void | HideSplashScreen ()
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnPaint ()
afx_msg void | OnTimer (UINT nIDEvent)

Static Protected Attributes

BOOL | c_bShowSplashWnd
CSplashWnd * | c_pSplashWnd

Constructor & Destructor Documentation

CSplashWnd::CSplashWnd ( ) [protected]

Definition at line 29 of file Splash.cpp.

00030 {
00031 }

CSplashWnd::~CSplashWnd ( )

Definition at line 33 of file Splash.cpp.

00034 {
00035     // Clear the static window pointer.
00036     ASSERT(c_pSplashWnd == this);
00037     c_pSplashWnd = NULL;
00038 }

Member Function Documentation

void CSplashWnd::CloseSplashScreen ( ) [static]

Definition at line 108 of file Splash.cpp.

Referenced by WarnNoPython().

00109 {
00110     if(c_pSplashWnd)
00111     {
00112         c_pSplashWnd->HideSplashScreen();
00113     }
00114 }

BOOL CSplashWnd::Create ( CWnd * pParentWnd = NULL ) [protected]

Definition at line 88 of file Splash.cpp.

Referenced by ShowSplashScreen().

00089 {
00090     if (!m_bitmap.LoadBitmap(IDB_SPLASH))
00091         return FALSE;
00092
00093     BITMAP bm;
00094     m_bitmap.GetBitmap(&bm);
00095
00096     return CreateEx(0,
00097         AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)),
00098         NULL, WS_POPUP | WS_VISIBLE, 0, 0, bm.bmWidth, bm.bmHeight, pParentWnd->GetSafeHwnd(), NULL);
00099 }

void CSplashWnd::EnableSplashScreen ( BOOL bEnable = TRUE ) [static]

Definition at line 48 of file Splash.cpp.

Referenced by CWincvsApp::InitInstance().

00049 {
00050     c_bShowSplashWnd = bEnable;
00051 }

void CSplashWnd::HideSplashScreen ( ) [protected]

Definition at line 101 of file Splash.cpp.

Referenced by CloseSplashScreen(), OnTimer(), and PreTranslateAppMessage().

00102 {
00103     // Destroy the window, and update the mainframe.
00104     DestroyWindow();
00105     AfxGetMainWnd()->UpdateWindow();
00106 }

int CSplashWnd::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 122 of file Splash.cpp.

00123 {
00124     if (CWnd::OnCreate(lpCreateStruct) == -1)
00125         return -1;
00126
00127     // Center the window.
00128     CenterWindow();
00129
00130     // Set a timer to destroy the splash screen.
00131     SetTimer(1, 750, NULL);
00132
00133     return 0;
00134 }

void CSplashWnd::OnPaint ( ) [protected]

Definition at line 136 of file Splash.cpp.

00137 {
00138     CPaintDC dc(this);
00139
00140     CDC dcImage;
00141     if (!dcImage.CreateCompatibleDC(&dc))
00142         return;
00143
00144     BITMAP bm;
00145     m_bitmap.GetBitmap(&bm);
00146
00147     // Paint the image.
00148     CBitmap* pOldBitmap = dcImage.SelectObject(&m_bitmap);
00149     dc.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &dcImage, 0, 0, SRCCOPY);
00150     dcImage.SelectObject(pOldBitmap);
00151
00152     // Get version information from the application
00153     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00154     CStr vers;
00155
00156     if(app->GetAppVersion(vers))
00157     {
00158         dc.SetBkMode(TRANSPARENT);
00159         dc.SetTextAlign(TA_RIGHT | TA_TOP);
00160         dc.TextOut(bm.bmWidth - gc_nBitmapRightMargin - 10, 219, vers, vers.length());
00161     }
00162 }

void CSplashWnd::OnTimer ( UINT nIDEvent ) [protected]

Definition at line 164 of file Splash.cpp.

00165 {
00166     // Destroy the splash screen window.
00167     HideSplashScreen();
00168 }

void CSplashWnd::PostNcDestroy ( ) [virtual]

Definition at line 116 of file Splash.cpp.

00117 {
00118     // Free the C++ class.
00119     delete this;
00120 }

BOOL CSplashWnd::PreTranslateAppMessage ( MSG * pMsg ) [static]

Definition at line 66 of file Splash.cpp.

Referenced by CWincvsApp::PreTranslateMessage().

00067 {
00068     if (c_pSplashWnd == NULL)
00069         return FALSE;
00070
00071     // If we get a keyboard or mouse message, hide the splash screen.
00072     if (pMsg->message == WM_KEYDOWN ||
00073         pMsg->message == WM_SYSKEYDOWN ||
00074         pMsg->message == WM_LBUTTONDOWN ||
00075         pMsg->message == WM_RBUTTONDOWN ||
00076         pMsg->message == WM_MBUTTONDOWN ||
00077         pMsg->message == WM_NCLBUTTONDOWN ||
00078         pMsg->message == WM_NCRBUTTONDOWN ||
00079         pMsg->message == WM_NCMBUTTONDOWN)
00080     {
00081         c_pSplashWnd->HideSplashScreen();
00082         return TRUE;    // message handled here
00083     }
00084
00085     return FALSE;   // message not handled
00086 }

void CSplashWnd::ShowSplashScreen ( CWnd * pParentWnd = NULL ) [static]

Definition at line 53 of file Splash.cpp.

Referenced by CMainFrame::OnCreate().

00054 {
00055     if (!c_bShowSplashWnd || c_pSplashWnd != NULL)
00056         return;
00057
00058     // Allocate a new splash screen, and create the window.
00059     c_pSplashWnd = new CSplashWnd;
00060     if (!c_pSplashWnd->Create(pParentWnd))
00061         delete c_pSplashWnd;
00062     else
00063         c_pSplashWnd->UpdateWindow();
00064 }

Member Data Documentation

BOOL CSplashWnd::c_bShowSplashWnd [static, protected]

Definition at line 27 of file Splash.cpp.

CSplashWnd * CSplashWnd::c_pSplashWnd [static, protected]

Definition at line 28 of file Splash.cpp.

CBitmap CSplashWnd::m_bitmap

Definition at line 20 of file Splash.h.

The documentation for this class was generated from the following files:
  • WinCvs/Splash.h
  • WinCvs/Splash.cpp
Generated on Sun Oct 21 12:49:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CSplitterWnd Class Reference

Inheritance diagram for CSplitterWnd:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/GfxSplitterWnd.h
Generated on Sun Oct 21 12:49:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CStackThreadLock Struct Reference

List of all members.

Public Methods

CStackThreadLock ()
~CStackThreadLock ()

Constructor & Destructor Documentation

CStackThreadLock::CStackThreadLock ( ) [inline]

Definition at line 127 of file cvsgui_process.cpp.

00128     {
00129     }

CStackThreadLock::~CStackThreadLock ( ) [inline]

Definition at line 130 of file cvsgui_process.cpp.

00131     {
00132     }

The documentation for this struct was generated from the following file:
  • common/cvsgui_process.cpp
Generated on Sun Oct 21 12:49:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CStatic Class Reference

Inheritance diagram for CStatic:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/mfc/PseudoDraw.h
Generated on Sun Oct 21 12:49:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


static_tree_desc_s Struct Reference

Collaboration diagram for static_tree_desc_s:

[legend]
List of all members.

Public Attributes

int | dummy
ct_data * static_tree
intf * extra_bits
int | extra_base
int | elems
int | max_length

Member Data Documentation

int static_tree_desc_s::dummy

Definition at line 145 of file deflate.c.

int static_tree_desc_s::elems

Definition at line 114 of file trees.c.

int static_tree_desc_s::extra_base

Definition at line 113 of file trees.c.

intf* static_tree_desc_s::extra_bits

Definition at line 112 of file trees.c.

int static_tree_desc_s::max_length

Definition at line 115 of file trees.c.

ct_data* static_tree_desc_s::static_tree

Definition at line 111 of file trees.c.

The documentation for this struct was generated from the following files:
  • cvs-1.10/zlib/deflate.c
  • cvs-1.10/zlib/trees.c
Generated on Sun Oct 21 12:49:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TemplateCStaticAllocT class Reference

CStaticAllocT Class Template Reference

#include <CPStr.h>

Inheritance diagram for CStaticAllocT:

[legend]
Collaboration diagram for CStaticAllocT:

[legend]
List of all members.

Public Methods

CStaticAllocT ()
~CStaticAllocT ()
void | AdjustSize (size_t size)
operator T * (void) const
operator const T * (void) const
size_t | size () const

Protected Attributes

T * | buf
size_t | numbuf

template<class T>
class CStaticAllocT< T >

Constructor & Destructor Documentation

template<class T>
CStaticAllocT< T >::CStaticAllocT ( ) [inline]

Definition at line 142 of file CPStr.h.

00143     {
00144         buf = 0L;
00145         numbuf = 0;
00146     }

template<class T>
CStaticAllocT< T >::~CStaticAllocT ( ) [inline]

Definition at line 148 of file CPStr.h.

00149     {
00150         if(buf != 0L)
00151             free(buf);
00152     }

Member Function Documentation

template<class T>
void CStaticAllocT< T >::AdjustSize ( size_t size ) [inline]

Definition at line 154 of file CPStr.h.

Referenced by FillBuffer(), CMMenuString::GetData(), TMPersistent::GetData(), TMString::GetData(), CPersistent::LoadAll(), CBuffer::append(), cleanUpLogMsg(), expandLF(), and reduceString().

00155     {
00156         if(numbuf < size)
00157         {
00158             if(buf == 0L)
00159                 buf = (T *)malloc(size * sizeof(T));
00160             else
00161                 buf = (T *)realloc(buf, size * sizeof(T));
00162             if(buf == 0L)
00163                 throw std::bad_alloc();
00164             numbuf = size;
00165         }
00166     }

template<class T>
CStaticAllocT< T >::operator T * ( void ) const [inline]

Definition at line 168 of file CPStr.h.

00168 { return buf; }

template<class T>
CStaticAllocT< T >::operator const T * ( void ) const [inline]

Definition at line 169 of file CPStr.h.

00169 { return buf; }

template<class T>
size_t CStaticAllocT< T >::size ( ) const [inline]

Definition at line 175 of file CPStr.h.

Referenced by CBuffer::append().

00175 { return numbuf; }

Member Data Documentation

template<class T>
T* CStaticAllocT::buf [protected]

Definition at line 177 of file CPStr.h.

template<class T>
size_t CStaticAllocT::numbuf [protected]

Definition at line 178 of file CPStr.h.

The documentation for this class was generated from the following file:
  • common/CPStr.h
Generated on Sun Oct 21 12:49:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CStatusBar Class Reference

Inheritance diagram for CStatusBar:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CvsStatusBar.h
Generated on Sun Oct 21 12:49:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


stickydirtag Struct Reference

#include <cvs.h>

Collaboration diagram for stickydirtag:

[legend]
List of all members.

Public Attributes

int | aflag
char * | tag
char * | date
int | nonbranch
int | subdirs

Member Data Documentation

int stickydirtag::aflag

Definition at line 328 of file cvs.h.

char* stickydirtag::date

Definition at line 330 of file cvs.h.

int stickydirtag::nonbranch

Definition at line 331 of file cvs.h.

int stickydirtag::subdirs

Definition at line 336 of file cvs.h.

char* stickydirtag::tag

Definition at line 329 of file cvs.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/cvs.h
Generated on Sun Oct 21 12:49:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UStr Class Reference

C string class. More...

#include <ustr.h>

Inheritance diagram for UStr:

[legend]
Collaboration diagram for UStr:

[legend]
List of all members.

Public Methods

UStr ()
UStr (const char *newstr)
UStr (const unsigned char *newstr)
UStr (const UStr &newstr)
virtual | ~UStr ()
bool | empty (void) const
unsigned int | length (void) const
const char * | operator= (const char *newstr)
set from a C String (0L is OK). More...

const char * | operator= (const unsigned char *newstr)
set from a P String (0L is OK). More...

const UStr & | operator= (const UStr &newstr)
set according to another UStr. More...

const UStr & | set (const char *buf, unsigned int len)
set from a buffer. More...

bool | operator< (const UStr &str) const
compare, provided to compile with STL. More...

bool | operator> (const UStr &str) const
compare, provided to compile with STL. More...

bool | operator== (const UStr &str) const
compare, provided to compile with STL. More...

bool | operator== (const char *str) const
compare, provided to compile with STL. More...

bool | operator!= (const UStr &str) const
compare, provided to compile with STL. More...

bool | operator!= (const char *str) const
compare, provided to compile with STL. More...

operator const char * () const
as a C string. More...

operator char * ()
as a C string. More...

const char * | c_str () const
as a C string. More...

UStr & | operator<< (const char *addToStr)
concatenate. More...

UStr & | operator<< (char addToStr)
concatenate. More...

UStr & | operator<< (int addToStr)
concatenate. More...

int | compare (const char *thestr) const
compare. More...

bool | endsWith (char c) const
const UStr & | replace (char which, char bywhich)
replace a character. More...

Protected Methods

void | flush (void)

Protected Attributes

char * | str
the String. More...

Detailed Description

C string class.

Definition at line 113 of file ustr.h.

Constructor & Destructor Documentation

UStr::UStr ( ) [inline]

Definition at line 116 of file ustr.h.

00116 : str(0L) {}

UStr::UStr ( const char * newstr ) [inline]

Definition at line 117 of file ustr.h.

00118     {
00119         str = 0L;
00120         *this = newstr;
00121     }

UStr::UStr ( const unsigned char * newstr ) [inline]

Definition at line 122 of file ustr.h.

00123     {
00124         str = 0L;
00125         set((const char *)newstr + 1, newstr[0]);
00126     }

UStr::UStr ( const UStr & newstr ) [inline]

Definition at line 127 of file ustr.h.

00128     {
00129         str = 0L;
00130         *this = newstr;
00131     }

virtual UStr::~UStr ( ) [inline, virtual]

Definition at line 132 of file ustr.h.

00132 {flush();}

Member Function Documentation

const char* UStr::c_str ( void ) const [inline]

as a C string.

Definition at line 169 of file ustr.h.

Referenced by UAuthen_Rhosts::DoDataExchange(), UAuthen_SSH::DoDataExchange(), UEditMessage::DoDataExchange(), AuthenSSH::GetSettingsDesc(), UAuthen_SSH::OnBtnName(), UAuthen_SSH::OnBtnRSA(), AuthenSSH::OnGetEnv(), AuthenSSH::OnSetupEnv(), PyMacrosReloadAll(), CvsPrefs::WhichCvs(), and cvsgui_PromptEditMessage().

00169 { return str == 0L ? "" : str; }

int UStr::compare ( const char * thestr ) const [inline]

compare.

Definition at line 179 of file ustr.h.

Referenced by CMacroEntry::operator==().

00179 { return strcmp(*this, thestr); }

bool UStr::empty ( void ) const [inline]

Definition at line 134 of file ustr.h.

Referenced by AskCreatePersistentSettings(), CvsPrefs::Browser(), USaveSettings::DoDataExchange(), UAuthen_Rhosts::DoDataExchange(), UAuthen_SSH::DoDataExchange(), TBrowserFillDummy::EnterDirectory(), CvsPrefs::ExtDiff(), GetAllPersistentSettings(), AuthenSSH::GetSettingsDesc(), HasPersistentSettings(), CvsPrefs::Helper(), CvsPrefs::Home(), CvsPrefs::LastWorkingDir(), LoadPersistentSettings(), ReportConflict::Match(), UCvsFolders::OnCreate(), AuthenSSH::OnGetEnv(), AuthenSSH::OnSetupEnv(), ReportConflict::PrintOut(), CWinCvsBrowser::ResetBrowser(), UCvsFolders::ResetBrowser(), UCvsFolders::ResetView(), AuthenSSH::RsaIdentityFile(), CvsPrefs::RshName(), SaveAsPersistentSettings(), SavePersistentSettings(), CvsPrefs::SetHome(), KoFilterModel::SetMask(), CvsPrefs::SetWhichCvs(), SettingsGetLoc(), CvsPrefs::Viewer(), CvsPrefs::WhichCvs(), cvsgui_PromptEditMessage(), and getLoc().

00134 {return str == 0L || str[0] == '\0';}

bool UStr::endsWith ( char c ) const [inline]

Definition at line 181 of file ustr.h.

Referenced by BuildIgnoredList(), CFindSettings::CFindSettings(), Entries_Open(), EntnodePath::GetFullPathName(), UCvsFolders::GetItemByLocation(), CvsPrefs::Home(), UAuthen_SSH::OnBtnName(), UAuthen_SSH::OnBtnRSA(), UCvsFolders::OnUpdateGeneric(), CWinCvsBrowser::ResetBrowser(), UCvsFolders::ResetBrowser(), UCvsFolders::RetrievePath(), CPersistent::SaveAllSettings(), SaveAsPersistentSettings(), CvsPrefs::SetHome(), SettingsGetLoc(), UCvsFolders::StepToLocation(), CvsPrefs::WhichCvs(), and getLoc().

00181 {return !length() ? false : str[length()-1] == c;}

void UStr::flush ( void ) [protected]

Definition at line 184 of file ustr.cpp.

Referenced by operator=(), and set().

00185 {
00186     if(str == 0L)
00187         return;
00188     free(str);
00189     str = 0L;
00190 }

unsigned int UStr::length ( void ) const [inline]

Definition at line 135 of file ustr.h.

Referenced by CFindSettings::CFindSettings(), CompatGetPassword(), UCvsConsole::FeedThisLine(), UCvsFolders::GetItemByLocation(), GetMenuTitle(), CvsPrefs::Home(), ReportConflict::Match(), CPersistent::SaveAllSettings(), CvsPrefs::SetHome(), UCvsFolders::StepToLocation(), UPseudoPageHider::UPseudoPageHider(), and operator<<().

00135 {return str == 0L ? 0 : strlen(str);}

UStr::operator char * ( void ) [inline]

as a C string.

Reimplemented in PCStr.

Definition at line 167 of file ustr.h.

00167 { return str == 0L ? 0L : str; }

UStr::operator const char * ( ) const [inline]

as a C string.

Reimplemented in PCStr.

Definition at line 165 of file ustr.h.

00165 { return str == 0L ? "" : str; }

bool UStr::operator!= ( const char * str ) const

compare, provided to compile with STL.

Definition at line 339 of file ustr.cpp.

00340 {
00341     return strcmp(*this, str) != 0;
00342 }

bool UStr::operator!= ( const UStr & str ) const

compare, provided to compile with STL.

Definition at line 334 of file ustr.cpp.

00335 {
00336     return strcmp(*this, str) != 0;
00337 }

bool UStr::operator< ( const UStr & str ) const

compare, provided to compile with STL.

Definition at line 314 of file ustr.cpp.

00315 {
00316     return strcmp(*this, str) < 0;
00317 }

UStr & UStr::operator<< ( int addToStr )

concatenate.

Definition at line 307 of file ustr.cpp.

00308 {
00309     char astr[50];
00310     sprintf(astr, "%d", addToStr);
00311     return *this << astr;
00312 }

UStr & UStr::operator<< ( char addToStr )

concatenate.

Definition at line 300 of file ustr.cpp.

00301 {
00302     char astr[2] = {'\0', '\0'};
00303     astr[0] = addToStr;
00304     return *this << astr;
00305 }

UStr & UStr::operator<< ( const char * addToStr )

concatenate.

Definition at line 270 of file ustr.cpp.

00271 {
00272     if(addToStr == 0L)
00273         return *this;
00274
00275     if(str == 0L)
00276     {
00277         *this = addToStr;
00278         return *this;
00279     }
00280
00281     unsigned int len = strlen(addToStr);
00282     if(len == 0)
00283         return *this;
00284
00285     unsigned int curlen = length();
00286     char *newstr = (char *)malloc((len + curlen + 1) * sizeof(char));
00287     if(newstr == 0L)
00288         UTHROW(std::bad_alloc());
00289     memcpy(newstr, str, curlen * sizeof(char));
00290     memcpy(newstr + curlen, addToStr, len * sizeof(char));
00291     newstr[len + curlen] = '\0';
00292
00293     if(str != 0L)
00294         free(str);
00295     str = newstr;
00296
00297     return *this;
00298 }

const UStr & UStr::operator= ( const UStr & newstr )

set according to another UStr.

Definition at line 229 of file ustr.cpp.

00230 {
00231     *this = (const char *)newstr;
00232     return *this;
00233 }

const char * UStr::operator= ( const unsigned char * newstr )

set from a P String (0L is OK).

Reimplemented in PCStr.

Definition at line 210 of file ustr.cpp.

00211 {
00212     if(newstr == 0L)
00213         newstr = (unsigned char *)"";
00214
00215     int l = newstr[0];
00216     char *newvalue = (char *)malloc((l + 1) * sizeof(char));
00217     if(newvalue == 0L)
00218         UTHROW(std::bad_alloc());
00219
00220     memcpy(newvalue, newstr + 1, l * sizeof(char));
00221     newvalue[l] = '\0';
00222
00223     flush();
00224     str = newvalue;
00225
00226     return *this;
00227 }

const char * UStr::operator= ( const char * newstr )

set from a C String (0L is OK).

Reimplemented in PCStr.

Definition at line 192 of file ustr.cpp.

00193 {
00194     if(newstr == 0L)
00195         newstr = "";
00196
00197     int l = strlen(newstr);
00198     char *newvalue = (char *)malloc((l + 1) * sizeof(char));
00199     if(newvalue == 0L)
00200         UTHROW(std::bad_alloc());
00201
00202     strcpy(newvalue, newstr);
00203
00204     flush();
00205     str = newvalue;
00206
00207     return *this;
00208 }

bool UStr::operator== ( const char * str ) const

compare, provided to compile with STL.

Definition at line 329 of file ustr.cpp.

00330 {
00331     return strcmp(*this, str) == 0;
00332 }

bool UStr::operator== ( const UStr & str ) const

compare, provided to compile with STL.

Definition at line 324 of file ustr.cpp.

00325 {
00326     return strcmp(*this, str) == 0;
00327 }

bool UStr::operator> ( const UStr & str ) const

compare, provided to compile with STL.

Definition at line 319 of file ustr.cpp.

00320 {
00321     return strcmp(*this, str) > 0;
00322 }

const UStr & UStr::replace | ( | char | which,
 |  | char | bywhich
 | ) |

replace a character.

Definition at line 254 of file ustr.cpp.

00255 {
00256     if(str == 0L)
00257         return *this;
00258
00259     char *buf = str;
00260     while(*buf)
00261     {
00262         if(*buf == which)
00263             *buf++ = bywhich;
00264         else
00265             buf++;
00266     }
00267     return *this;
00268 }

const UStr & UStr::set | ( | const char * | buf,
 |  | unsigned int | len
 | ) |

set from a buffer.

Definition at line 235 of file ustr.cpp.

Referenced by UCvsConsole::FeedThisLine(), GetEnvValue(), UCvsFolders::GetItemByLocation(), LPseudoWinAttachment::ListenToMessage(), UWidget::OnGetText(), UWidget::OnListGetInfo(), UPseudoRotButton::ReadIconsID(), UCvsFolders::StepToLocation(), UPseudoPageHider::UPseudoPageHider(), UPseudoPlaceHolder::UPseudoPlaceHolder(), cvsgui_RunCvs(), and loadSettingsInternal().

00236 {
00237     flush();
00238     if(len == 0)
00239         return *this;
00240
00241     str = (char *)malloc((len + 1) * sizeof(char));
00242     if(str == 0L)
00243     {
00244         UAppConsole("Impossible to allocate %d bytes !\n", (len + 1) * sizeof(char));
00245         return *this;
00246     }
00247
00248     memcpy(str, buf, len * sizeof(char));
00249     str[len] = '\0';
00250
00251     return *this;
00252 }

Member Data Documentation

char* UStr::str [protected]

the String.

Definition at line 189 of file ustr.h.

The documentation for this class was generated from the following files:
  • rf/ustr.h
  • rf/ustr.cpp
Generated on Sun Oct 21 12:49:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CStreamConsole Class Reference

Inheritance diagram for CStreamConsole:

[legend]
Collaboration diagram for CStreamConsole:

[legend]
List of all members.

Public Methods

CStreamConsole (FILE *out)
virtual long | cvs_out (char *txt, long len)
virtual long | cvs_err (char *txt, long len)

Protected Attributes

FILE * | fOut

Constructor & Destructor Documentation

CStreamConsole::CStreamConsole ( FILE * out ) [inline]

Definition at line 579 of file AppGlue.cpp.

00579 : fOut(out) {}

Member Function Documentation

virtual long CStreamConsole::cvs_err | ( | char * | txt,
 |  | long | len
 | ) | [inline, virtual]

Reimplemented from CCvsConsole.

Definition at line 586 of file AppGlue.cpp.

00587     {
00588         cvs_errstr(txt, len);
00589         return len;
00590     }

virtual long CStreamConsole::cvs_out | ( | char * | txt,
 |  | long | len
 | ) | [inline, virtual]

Reimplemented from CCvsConsole.

Definition at line 581 of file AppGlue.cpp.

00582     {
00583         fwrite(txt, sizeof(char), len, fOut);
00584         return len;
00585     }

Member Data Documentation

FILE* CStreamConsole::fOut [protected]

Definition at line 592 of file AppGlue.cpp.

The documentation for this class was generated from the following file:
  • common/AppGlue.cpp
Generated on Sun Oct 21 12:49:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CSubclassWnd Class Reference

#include <Subclass.h>

Inheritance diagram for CSubclassWnd:

[legend]
Collaboration diagram for CSubclassWnd:

[legend]
List of all members.

Public Methods

CSubclassWnd ()
~CSubclassWnd ()
virtual BOOL | HookWindow (HWND hwnd)
virtual BOOL | HookWindow (CWnd *pWnd)
virtual BOOL | IsHooked ()

Protected Methods

virtual LRESULT | WindowProc (UINT msg, WPARAM wp, LPARAM lp)
virtual LRESULT | Default ()

Protected Attributes

HWND | m_hWnd
WNDPROC | m_pOldWndProc
CSubclassWnd * | m_pNext

Friends

class | CSubclassWndMap
LRESULT CALLBACK | HookWndProc (HWND, UINT, WPARAM, LPARAM)

Constructor & Destructor Documentation

CSubclassWnd::CSubclassWnd ( )

Definition at line 59 of file Subclass.cpp.

00060 {
00061     m_pNext = NULL;
00062     m_pOldWndProc = NULL;
00063     m_hWnd  = NULL;
00064 }

CSubclassWnd::~CSubclassWnd ( )

Definition at line 66 of file Subclass.cpp.

00067 {
00068     if (m_hWnd)
00069         HookWindow((HWND)NULL);     // unhook window
00070 }

Member Function Documentation

LRESULT CSubclassWnd::Default ( ) [protected, virtual]

Definition at line 115 of file Subclass.cpp.

00116 {
00117     // MFC stores current MSG in thread state
00118     MSG& curMsg = AfxGetThreadState()->m_lastSentMsg;
00119     // Note: must explicitly call CSubclassWnd::WindowProc to avoid infinte
00120     // recursion on virtual function
00121     return CSubclassWnd::WindowProc(curMsg.message, curMsg.wParam, curMsg.lParam);
00122 }

virtual BOOL CSubclassWnd::HookWindow ( CWnd * pWnd ) [inline, virtual]

Definition at line 61 of file Subclass.h.

00061 { return HookWindow(pWnd->GetSafeHwnd()); }

BOOL CSubclassWnd::HookWindow ( HWND hwnd ) [virtual]

Definition at line 77 of file Subclass.cpp.

Referenced by HookWindow(), CCJMenuBarFrameHook::Install(), CSubclassWndMap::RemoveAll(), CCJMenuBarFrameHook::~CCJMenuBarFrameHook(), and ~CSubclassWnd().

00078 {
00079     ASSERT_VALID(this);
00080     if (hwnd) {
00081         // Hook the window
00082         ASSERT(m_hWnd==NULL);
00083         ASSERT(::IsWindow(hwnd));
00084         theHookMap.Add(hwnd, this);         // Add to map of hooks
00085
00086     } else if (m_hWnd) {
00087         // Unhook the window
00088         theHookMap.Remove(this);                // Remove from map
00089         m_pOldWndProc = NULL;
00090     }
00091     m_hWnd = hwnd;
00092     return TRUE;
00093 }

virtual BOOL CSubclassWnd::IsHooked ( ) [inline, virtual]

Definition at line 62 of file Subclass.h.

00062 { return m_hWnd!=NULL; }

LRESULT CSubclassWnd::WindowProc | ( | UINT | msg,
 |  | WPARAM | wp,
 |  | LPARAM | lp
 | ) | [protected, virtual]

Reimplemented in CCJMenuBarFrameHook.

Definition at line 103 of file Subclass.cpp.

Referenced by CCJMenuBarFrameHook::WindowProc().

00104 {
00105 //  ASSERT_VALID(this);  // removed for speed
00106     ASSERT(m_pOldWndProc);
00107     return m_pNext ? m_pNext->WindowProc(msg, wp, lp) :
00108         ::CallWindowProc(m_pOldWndProc, m_hWnd, msg, wp, lp);
00109 }

Friends And Related Function Documentation

friend class CSubclassWndMap [friend]

Definition at line 65 of file Subclass.h.

LRESULT CALLBACK HookWndProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wp,
 |  | LPARAM | lp
 | ) | [friend]

Definition at line 150 of file Subclass.cpp.

00151 {
00152 #ifdef _USRDLL
00153     // If this is a DLL, need to set up MFC state
00154     AFX_MANAGE_STATE(AfxGetStaticModuleState());
00155 #endif
00156
00157     // Set up MFC message state just in case anyone wants it
00158     // This is just like AfxCallWindowProc, but we can't use that because
00159     // a CSubclassWnd is not a CWnd.
00160     //
00161     MSG& curMsg = AfxGetThreadState()->m_lastSentMsg;
00162     MSG  oldMsg = curMsg;   // save for nesting
00163     curMsg.hwnd     = hwnd;
00164     curMsg.message = msg;
00165     curMsg.wParam  = wp;
00166     curMsg.lParam  = lp;
00167
00168     // Get hook object for this window. Get from hook map
00169     CSubclassWnd* pSubclassWnd = theHookMap.Lookup(hwnd);
00170     ASSERT(pSubclassWnd);
00171
00172     LRESULT lr;
00173     if (msg==WM_NCDESTROY) {
00174         // Window is being destroyed: unhook all hooks (for this window)
00175         // and pass msg to orginal window proc
00176         //
00177         WNDPROC wndproc = pSubclassWnd->m_pOldWndProc;
00178         theHookMap.RemoveAll(hwnd);
00179         lr = ::CallWindowProc(wndproc, hwnd, msg, wp, lp);
00180
00181     } else {
00182         // pass to msg hook
00183         lr = pSubclassWnd->WindowProc(msg, wp, lp);
00184     }
00185     curMsg = oldMsg;            // pop state
00186     return lr;
00187 }

Member Data Documentation

HWND CSubclassWnd::m_hWnd [protected]

Definition at line 73 of file Subclass.h.

Referenced by CSubclassWndMap::Remove().

CSubclassWnd* CSubclassWnd::m_pNext [protected]

Definition at line 75 of file Subclass.h.

Referenced by CSubclassWndMap::Add(), and CSubclassWndMap::Remove().

WNDPROC CSubclassWnd::m_pOldWndProc [protected]

Definition at line 74 of file Subclass.h.

Referenced by CSubclassWndMap::Add(), and CSubclassWndMap::Remove().

The documentation for this class was generated from the following files:
  • WinCvs/CJLib/Include/Subclass.h
  • WinCvs/CJLib/CJLibrary/Subclass.cpp
Generated on Sun Oct 21 12:49:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CSubclassWndMap Class Reference

Inheritance diagram for CSubclassWndMap:

[legend]
Collaboration diagram for CSubclassWndMap:

[legend]
List of all members.

Public Methods

CSubclassWndMap ()
~CSubclassWndMap ()
void | Add (HWND hwnd, CSubclassWnd *pSubclassWnd)
void | Remove (CSubclassWnd *pSubclassWnd)
void | RemoveAll (HWND hwnd)
CSubclassWnd * | Lookup (HWND hwnd)

Static Public Methods

CSubclassWndMap & | GetHookMap ()

Constructor & Destructor Documentation

CSubclassWndMap::CSubclassWndMap ( )

Definition at line 192 of file Subclass.cpp.

00193 {
00194 }

CSubclassWndMap::~CSubclassWndMap ( )

Definition at line 196 of file Subclass.cpp.

00197 {
00198 // This assert bombs when posting WM_QUIT, so I've deleted it.
00199 //  ASSERT(IsEmpty());  // all hooks should be removed!
00200 }

Member Function Documentation

void CSubclassWndMap::Add | ( | HWND | hwnd,
 |  | CSubclassWnd * | pSubclassWnd
 | ) |

Definition at line 218 of file Subclass.cpp.

00219 {
00220     ASSERT(hwnd && ::IsWindow(hwnd));
00221
00222     // Add to front of list
00223     pSubclassWnd->m_pNext = Lookup(hwnd);
00224     SetAt(hwnd, pSubclassWnd);
00225
00226     if (pSubclassWnd->m_pNext==NULL) {
00227         // If this is the first hook added, subclass the window
00228         pSubclassWnd->m_pOldWndProc =
00229             (WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (DWORD)HookWndProc);
00230
00231     } else {
00232         // just copy wndproc from next hook
00233         pSubclassWnd->m_pOldWndProc = pSubclassWnd->m_pNext->m_pOldWndProc;
00234     }
00235     ASSERT(pSubclassWnd->m_pOldWndProc);
00236 }

CSubclassWndMap & CSubclassWndMap::GetHookMap ( ) [static]

Definition at line 205 of file Subclass.cpp.

00206 {
00207     // By creating theMap here, C++ doesn't instantiate it until/unless
00208     // it's ever used! This is a good trick to use in C++, to
00209     // instantiate/initialize a static object the first time it's used.
00210     //
00211     static CSubclassWndMap theMap;
00212     return theMap;
00213 }

CSubclassWnd * CSubclassWndMap::Lookup ( HWND hwnd )

Definition at line 279 of file Subclass.cpp.

Referenced by Add(), Remove(), and RemoveAll().

00280 {
00281     CSubclassWnd* pFound = NULL;
00282     if (!CMapPtrToPtr::Lookup(hwnd, (void*&)pFound))
00283         return NULL;
00284     ASSERT_KINDOF(CSubclassWnd, pFound);
00285     return pFound;
00286 }

void CSubclassWndMap::Remove ( CSubclassWnd * pUnHook )

Definition at line 241 of file Subclass.cpp.

00242 {
00243     HWND hwnd = pUnHook->m_hWnd;
00244     ASSERT(hwnd && ::IsWindow(hwnd));
00245
00246     CSubclassWnd* pHook = Lookup(hwnd);
00247     ASSERT(pHook);
00248     if (pHook==pUnHook) {
00249         // hook to remove is the one in the hash table: replace w/next
00250         if (pHook->m_pNext)
00251             SetAt(hwnd, pHook->m_pNext);
00252         else {
00253             // This is the last hook for this window: restore wnd proc
00254             RemoveKey(hwnd);
00255             SetWindowLong(hwnd, GWL_WNDPROC, (DWORD)pHook->m_pOldWndProc);
00256         }
00257     } else {
00258         // Hook to remove is in the middle: just remove from linked list
00259         while (pHook->m_pNext!=pUnHook)
00260             pHook = pHook->m_pNext;
00261         ASSERT(pHook && pHook->m_pNext==pUnHook);
00262         pHook->m_pNext = pUnHook->m_pNext;
00263     }
00264 }

void CSubclassWndMap::RemoveAll ( HWND hwnd )

Definition at line 269 of file Subclass.cpp.

00270 {
00271     CSubclassWnd* pSubclassWnd;
00272     while ((pSubclassWnd = Lookup(hwnd))!=NULL)
00273         pSubclassWnd->HookWindow((HWND)NULL);   // (unhook)
00274 }

The documentation for this class was generated from the following file:
  • WinCvs/CJLib/CJLibrary/Subclass.cpp
Generated on Sun Oct 21 12:49:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTabCtrl Class Reference

Inheritance diagram for CTabCtrl:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJTabCtrl.h
Generated on Sun Oct 21 12:49:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TAdorner Class Reference

Inheritance diagram for TAdorner:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/macapp/UPseudoSupport.h
Generated on Sun Oct 21 12:49:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


tag_info Struct Reference

Collaboration diagram for tag_info:

[legend]
List of all members.

Public Attributes

Ctype status
char * | rev
char * | tag
char * | options
char * | rev
char * | tag
char * | options

Member Data Documentation

char* tag_info::options

Definition at line 49 of file tag.c.

char* tag_info::options

Definition at line 43 of file rtag.c.

char* tag_info::rev

Definition at line 47 of file tag.c.

char* tag_info::rev

Definition at line 41 of file rtag.c.

Ctype tag_info::status

Definition at line 46 of file tag.c.

char* tag_info::tag

Definition at line 48 of file tag.c.

char* tag_info::tag

Definition at line 42 of file rtag.c.

The documentation for this struct was generated from the following files:
  • cvs-1.10/src/rtag.c
  • cvs-1.10/src/tag.c
Generated on Sun Oct 21 12:49:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


tagAFX_OLDTOOLINFO Struct Reference

#include <CJToolBarBase.h>

Collaboration diagram for tagAFX_OLDTOOLINFO:

[legend]
List of all members.

Public Attributes

UINT | cbSize
UINT | uFlags
HWND | hwnd
UINT | uId
RECT | rect
HINSTANCE | hinst
LPTSTR | lpszText

Member Data Documentation

UINT tagAFX_OLDTOOLINFO::cbSize

Definition at line 60 of file CJToolBarBase.h.

HINSTANCE tagAFX_OLDTOOLINFO::hinst

Definition at line 65 of file CJToolBarBase.h.

HWND tagAFX_OLDTOOLINFO::hwnd

Definition at line 62 of file CJToolBarBase.h.

LPTSTR tagAFX_OLDTOOLINFO::lpszText

Definition at line 66 of file CJToolBarBase.h.

RECT tagAFX_OLDTOOLINFO::rect

Definition at line 64 of file CJToolBarBase.h.

UINT tagAFX_OLDTOOLINFO::uFlags

Definition at line 61 of file CJToolBarBase.h.

UINT tagAFX_OLDTOOLINFO::uId

Definition at line 63 of file CJToolBarBase.h.

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/Include/CJToolBarBase.h
Generated on Sun Oct 21 12:49:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


tagCTV_ITEM Struct Reference

#include <CJTabView.h>

Collaboration diagram for tagCTV_ITEM:

[legend]
List of all members.

Public Attributes

CWnd * pWnd
TCHAR szLabel [32]

Member Data Documentation

CWnd* tagCTV_ITEM::pWnd

Definition at line 48 of file CJTabView.h.

Referenced by CCJTabView::AddView(), CCJTabView::GetView(), CCJTabView::OnWindowPosChanged(), and CCJTabView::SetActiveView().

TCHAR tagCTV_ITEM::szLabel[32]

Definition at line 49 of file CJTabView.h.

Referenced by CCJTabView::AddView().

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/Include/CJTabView.h
Generated on Sun Oct 21 12:49:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


tagMENUITEMINFOA Class Reference

Inheritance diagram for tagMENUITEMINFOA:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJMenu.h
Generated on Sun Oct 21 12:49:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


tagTCB_ITEM Struct Reference

#include <CJTabCtrlBar.h>

Collaboration diagram for tagTCB_ITEM:

[legend]
List of all members.

Public Attributes

CWnd * pWnd
CString | szTabLabel
CString | szToolTipLabel
UINT | uiToolTipId

Member Data Documentation

CWnd* tagTCB_ITEM::pWnd

Definition at line 169 of file CJTabCtrlBar.h.

Referenced by CCJTabCtrlBar::CreateTabListItem(), CCJTabCtrlBar::DeleteView(), CCJTabCtrlBar::GetView(), CCJTabCtrlBar::GetViewName(), CCJTabCtrlBar::OnWindowPosChanged(), CCJTabCtrlBar::RemoveListItem(), CCJTabCtrlBar::SetActiveView(), and CCJTabCtrlBar::SetViewToolTip().

CString tagTCB_ITEM::szTabLabel

Definition at line 170 of file CJTabCtrlBar.h.

Referenced by CCJTabCtrlBar::CreateTabListItem(), and CCJTabCtrlBar::GetViewName().

CString tagTCB_ITEM::szToolTipLabel

Definition at line 171 of file CJTabCtrlBar.h.

Referenced by CCJTabCtrlBar::CreateTabListItem(), CCJTabCtrlBar::ResetToolTips(), and CCJTabCtrlBar::SetViewToolTip().

UINT tagTCB_ITEM::uiToolTipId

Definition at line 172 of file CJTabCtrlBar.h.

Referenced by CCJTabCtrlBar::AddToolTip(), CCJTabCtrlBar::CreateTabListItem(), CCJTabCtrlBar::ResetToolTips(), and CCJTabCtrlBar::SetViewToolTip().

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/Include/CJTabCtrlBar.h
Generated on Sun Oct 21 12:49:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UTB_BUTTON Struct Reference

#include <umain.h>

Collaboration diagram for UTB_BUTTON:

[legend]
List of all members.

Public Attributes

const void * | icon
int | cmd
UTB_VAR varcode
UTB_DROP drop
const char * | tooltip

Member Data Documentation

int UTB_BUTTON::cmd

Definition at line 871 of file umain.h.

Referenced by UToolbar::OnTbButton(), UToolbar::OnTbCheckBtn(), and UToolbar::OnTbDropDown().

UTB_DROP UTB_BUTTON::drop

Definition at line 873 of file umain.h.

const void* UTB_BUTTON::icon

Definition at line 870 of file umain.h.

Referenced by UToolbar::OnTbButton(), UToolbar::OnTbCheckBtn(), and UToolbar::OnTbDropDown().

const char* UTB_BUTTON::tooltip

Definition at line 874 of file umain.h.

Referenced by UToolbar::OnTbButton(), UToolbar::OnTbCheckBtn(), and UToolbar::OnTbDropDown().

UTB_VAR UTB_BUTTON::varcode

Definition at line 872 of file umain.h.

Referenced by UToolbar::OnTbButton(), UToolbar::OnTbCheckBtn(), and UToolbar::OnTbDropDown().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:49:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UTB_DROPDOWN Struct Reference

#include <umain.h>

Collaboration diagram for UTB_DROPDOWN:

[legend]
List of all members.

Public Attributes

int initialcmd
UTB_BUTTON * btns

Member Data Documentation

UTB_BUTTON* UTB_DROPDOWN::btns

Definition at line 880 of file umain.h.

Referenced by UToolbar::OnTbDropDown().

int UTB_DROPDOWN::initialcmd

Definition at line 879 of file umain.h.

Referenced by UToolbar::OnTbDropDown().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:49:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UTB_INIT Struct Reference

#include <umain.h>

Collaboration diagram for UTB_INIT:

[legend]
List of all members.

Public Attributes

int | widthbtn
int | heightbtn
const char * | title

Member Data Documentation

int UTB_INIT::heightbtn

Definition at line 851 of file umain.h.

Referenced by CreateMainToolbar(), and UToolbar::OnTbInit().

const char* UTB_INIT::title

Definition at line 852 of file umain.h.

Referenced by CreateMainToolbar(), and UToolbar::OnTbInit().

int UTB_INIT::widthbtn

Definition at line 851 of file umain.h.

Referenced by CreateMainToolbar(), and UToolbar::OnTbInit().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:49:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTbEdit Class Reference

#include <TbEdit.h>

Inheritance diagram for CTbEdit:

[legend]
Collaboration diagram for CTbEdit:

[legend]
List of all members.

Public Types

enum | { WM_CONTENTCHANGE = WM_APP + 56 }

Public Methods

CTbEdit ()
virtual BOOL | PreTranslateMessage (MSG *pMsg)
virtual | ~CTbEdit ()

Member Enumeration Documentation

anonymous enum

Enumeration values:
WM_CONTENTCHANGE

Definition at line 21 of file TbEdit.h.

00021 { WM_CONTENTCHANGE = WM_APP + 56};

Constructor & Destructor Documentation

CTbEdit::CTbEdit ( )

Definition at line 17 of file TbEdit.cpp.

00018 {
00019 }

CTbEdit::~CTbEdit ( ) [virtual]

Definition at line 21 of file TbEdit.cpp.

00022 {
00023 }

Member Function Documentation

BOOL CTbEdit::PreTranslateMessage ( MSG * pMsg ) [virtual]

Definition at line 35 of file TbEdit.cpp.

00036 {
00037     if (pMsg->message == WM_KEYDOWN)
00038     {
00039         int nVirtKey = (int) pMsg->wParam;
00040         switch (nVirtKey)
00041         {
00042             case VK_ESCAPE:
00043                 GetOwner()->PostMessage(WM_CONTENTCHANGE, FALSE);
00044                 break;
00045             case VK_RETURN:
00046                 GetOwner()->PostMessage(WM_CONTENTCHANGE, TRUE);
00047                 break;
00048         }
00049     }
00050     return CEdit::PreTranslateMessage(pMsg);
00051 }

The documentation for this class was generated from the following files:
  • WinCvs/TbEdit.h
  • WinCvs/TbEdit.cpp
Generated on Sun Oct 21 12:49:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TBehavior Class Reference

Inheritance diagram for TBehavior:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/macapp/UPseudoSupport.h
Generated on Sun Oct 21 12:49:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TbEntry Class Reference

Inheritance diagram for TbEntry:

[legend]
Collaboration diagram for TbEntry:

[legend]
List of all members.

Public Methods

TbEntry (tbeKind k)
virtual ~TbEntry ()

Public Attributes

tbeKind kind

Constructor & Destructor Documentation

TbEntry::TbEntry ( tbeKind k ) [inline]

Definition at line 82 of file utoolbar.cpp.

00082 : kind(k) {}

virtual TbEntry::~TbEntry ( ) [inline, virtual]

Definition at line 83 of file utoolbar.cpp.

00083 {}

Member Data Documentation

tbeKind TbEntry::kind

Definition at line 85 of file utoolbar.cpp.

Referenced by UToolbar::OnSetTooltip(), UToolbar::OnUpdateUI(), WININFO::Search(), and UToolbar::UDispatchMessage().

The documentation for this class was generated from the following file:
  • rf/utoolbar.cpp
Generated on Sun Oct 21 12:49:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TbEntryButton Class Reference

Inheritance diagram for TbEntryButton:

[legend]
Collaboration diagram for TbEntryButton:

[legend]
List of all members.

Public Methods

TbEntryButton (HBITMAP b, int c, const char *t, UTB_VAR v)
virtual | ~TbEntryButton ()

Public Attributes

awidget wid
bool | ischeck

Constructor & Destructor Documentation

TbEntryButton::TbEntryButton | ( | HBITMAP | b,
 |  | int | c,
 |  | const char * | t,
 |  | UTB_VAR | v
 | ) | [inline]

Definition at line 192 of file utoolbar.cpp.

00192                                                               :
00193         TbEntry(tbeButton), wid(b, c, t, v), ischeck(false)
00194     {
00195     }

virtual TbEntryButton::~TbEntryButton ( ) [inline, virtual]

Definition at line 196 of file utoolbar.cpp.

00197     {
00198     }

Member Data Documentation

bool TbEntryButton::ischeck

Definition at line 201 of file utoolbar.cpp.

awidget TbEntryButton::wid

Definition at line 200 of file utoolbar.cpp.

Referenced by UToolbar::OnSetTooltip(), UToolbar::OnUpdateUI(), and WININFO::Search().

The documentation for this class was generated from the following file:
  • rf/utoolbar.cpp
Generated on Sun Oct 21 12:49:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TbEntryChkButton Class Reference

Inheritance diagram for TbEntryChkButton:

[legend]
Collaboration diagram for TbEntryChkButton:

[legend]
List of all members.

Public Methods

TbEntryChkButton (HBITMAP b, int c, const char *t, UTB_VAR v)
virtual ~TbEntryChkButton ()

Constructor & Destructor Documentation

TbEntryChkButton::TbEntryChkButton | ( | HBITMAP | b,
 |  | int | c,
 |  | const char * | t,
 |  | UTB_VAR | v
 | ) | [inline]

Definition at line 207 of file utoolbar.cpp.

00207                                                                  :
00208         TbEntryButton(b, c, t, v)
00209     {
00210         ischeck = true;
00211     }

virtual TbEntryChkButton::~TbEntryChkButton ( ) [inline, virtual]

Definition at line 212 of file utoolbar.cpp.

00213     {
00214     }

The documentation for this class was generated from the following file:
  • rf/utoolbar.cpp
Generated on Sun Oct 21 12:49:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TbEntryDropDown Class Reference

Inheritance diagram for TbEntryDropDown:

[legend]
Collaboration diagram for TbEntryDropDown:

[legend]
List of all members.

Public Methods

TbEntryDropDown ()
virtual | ~TbEntryDropDown ()

Public Attributes

std::vector< awidget > icons
int | current

Constructor & Destructor Documentation

TbEntryDropDown::TbEntryDropDown ( ) [inline]

Definition at line 220 of file utoolbar.cpp.

00220 : TbEntry(tbeDropDown), current(0) {}

virtual TbEntryDropDown::~TbEntryDropDown ( ) [inline, virtual]

Definition at line 221 of file utoolbar.cpp.

00222     {
00223     }

Member Data Documentation

int TbEntryDropDown::current

Definition at line 226 of file utoolbar.cpp.

Referenced by UToolbar::OnTbDropDown(), and UToolbar::UDispatchMessage().

std::vector<awidget> TbEntryDropDown::icons

Definition at line 225 of file utoolbar.cpp.

Referenced by UToolbar::OnSetTooltip(), UToolbar::OnTbDropDown(), and WININFO::Search().

The documentation for this class was generated from the following file:
  • rf/utoolbar.cpp
Generated on Sun Oct 21 12:49:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TbEntrySeparator Class Reference

Inheritance diagram for TbEntrySeparator:

[legend]
Collaboration diagram for TbEntrySeparator:

[legend]
List of all members.

Public Methods

TbEntrySeparator ()
virtual ~TbEntrySeparator ()

Constructor & Destructor Documentation

TbEntrySeparator::TbEntrySeparator ( ) [inline]

Definition at line 232 of file utoolbar.cpp.

00232 : TbEntry(tbeSeparator) {}

virtual TbEntrySeparator::~TbEntrySeparator ( ) [inline, virtual]

Definition at line 233 of file utoolbar.cpp.

00234     {
00235     }

The documentation for this class was generated from the following file:
  • rf/utoolbar.cpp
Generated on Sun Oct 21 12:49:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TBrowserFill Class Reference

Inheritance diagram for TBrowserFill:

[legend]
Collaboration diagram for TBrowserFill:

[legend]
List of all members.

Public Methods

TBrowserFill (UCvsFolders *treeCtrl, UTREEITEM root, UTREEITEM item, CSortList< ENTNODE > &entries)
virtual | ~TBrowserFill ()
virtual kTraversal | EnterDirectory (const char *fullpath, const char *dirname, const FSSpec *macspec)
virtual kTraversal | ExitDirectory (const char *fullpath)
virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnIdle (const char *fullpath)
virtual kTraversal | OnDirectory (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
TBrowserFill (CTreeCtrl &treeCtrl, HTREEITEM root, HTREEITEM item, CSortList< ENTNODE > &entries)
virtual kTraversal | EnterDirectory (const char *fullpath, const char *dirname, const FSSpec *macspec)
virtual kTraversal | ExitDirectory (const char *fullpath)
virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnIdle (const char *fullpath)
virtual kTraversal | OnDirectory (const char *fullpath, const char *fullname, const char *name, const struct wnt_stat &dir, const FSSpec *macspec)

Public Attributes

UTREEITEM m_root
UTREEITEM m_item
UCvsFolders * m_treeCtrl
CSortList< ENTNODE > & m_entries
vector< UStr > | m_ignlist
HTREEITEM | m_root
HTREEITEM | m_item
CTreeCtrl & m_treeCtrl
CSortList< ENTNODE > & m_entries
bool | m_isShowIgnored

Constructor & Destructor Documentation

TBrowserFill::TBrowserFill | ( | UCvsFolders * | treeCtrl,
 |  | UTREEITEM | root,
 |  | UTREEITEM | item,
 |  | CSortList< ENTNODE > & | entries
 | ) | [inline]

Definition at line 357 of file UCvsFolders.cpp.

00357                                                                                                       :
00358             m_root(root), m_item(item), m_treeCtrl(treeCtrl),
00359             m_entries(entries) {}

virtual TBrowserFill::~TBrowserFill ( ) [inline, virtual]

Definition at line 361 of file UCvsFolders.cpp.

00361 {}

TBrowserFill::TBrowserFill | ( | CTreeCtrl & | treeCtrl,
 |  | HTREEITEM | root,
 |  | HTREEITEM | item,
 |  | CSortList< ENTNODE > & | entries
 | ) | [inline]

Definition at line 387 of file WinCvsBrowser.cpp.

00387                                                                                                      :
00388             m_root(root), m_item(item), m_treeCtrl(treeCtrl),
00389             m_entries(entries), m_isShowIgnored(false)
00390     {
00391         if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
00392         {
00393             m_isShowIgnored = app->GetIgnoreModel()->IsShowIgnored();
00394         }
00395     }

Member Function Documentation

virtual kTraversal TBrowserFill::EnterDirectory | ( | const char * | fullpath,
 |  | const char * | dirname,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 397 of file WinCvsBrowser.cpp.

00398     {
00399         ASSERT(m_item != 0L);
00400
00401         Entries_Open (m_entries, fullpath);
00402         BuildIgnoredList(m_ignlist, fullpath);
00403
00404         return kContinueTraversal;
00405     }

virtual kTraversal TBrowserFill::EnterDirectory | ( | const char * | fullpath,
 |  | const char * | dirname,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 363 of file UCvsFolders.cpp.

00364     {
00365         ASSERT(m_item != 0L);
00366
00367         // assign the entries to this item
00368         Entries_Open (m_entries, fullpath);
00369         BuildIgnoredList(m_ignlist, fullpath);
00370
00371         return kContinueTraversal;
00372     }

virtual kTraversal TBrowserFill::ExitDirectory ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 407 of file WinCvsBrowser.cpp.

00408     {
00409         m_ignlist.erase(m_ignlist.begin(), m_ignlist.end());
00410         SetIcon(m_treeCtrl, m_item, true /*ignored*/, true,
00411             (EntnodeData *)m_treeCtrl.GetItemData(m_item));
00412         return kContinueTraversal;
00413     }

virtual kTraversal TBrowserFill::ExitDirectory ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 374 of file UCvsFolders.cpp.

00375     {
00376         m_ignlist.erase(m_ignlist.begin(), m_ignlist.end());
00377
00378         UTREE_INFO query;
00379         query.item = m_item;
00380         UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00381         query.icon = GetIcon(m_treeCtrl, m_item, true /*ignored*/, true, (EntnodeData *)query.data);
00382         UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_SETICON, kUMainWidget, &query);
00383
00384         return kContinueTraversal;
00385     }

virtual kTraversal TBrowserFill::OnDirectory | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct wnt_stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Definition at line 425 of file WinCvsBrowser.cpp.

00429     {
00430         if(stricmp(name, "cvs") == 0)
00431             return kSkipFile;
00432
00433         // is the sub-directory ignored ?
00434         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00435         if(!m_isShowIgnored && data->IsIgnored())
00436             return kSkipFile;
00437
00438         // create the item for the sub-directory
00439         TBrowserFillDummy traverse(m_treeCtrl, m_item, 0L, data);
00440         kTraversal res = FileTraverse(fullname, traverse);
00441
00442         // assign the icon regarding our Entries info
00443         if(traverse.m_item != 0L)
00444         {
00445             SetIcon(m_treeCtrl, traverse.m_item, true /*ignored*/, false, data);
00446         }
00447
00448         return kSkipFile;
00449     }

virtual kTraversal TBrowserFill::OnDirectory | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 397 of file UCvsFolders.cpp.

00401     {
00402 #if qUnix
00403         if(strcmp(name, "CVS") == 0)
00404 #else
00405         if(stricmp(name, "cvs") == 0)
00406 #endif
00407             return kSkipFile;
00408
00409         // is the sub-directory ignored ?
00410         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00411         if(!(bool)gFileViewIgnore && data->IsIgnored())
00412             return kSkipFile;
00413
00414         // create the item for the sub-directory
00415         TBrowserFillDummy traverse(m_treeCtrl, m_item, 0L, data);
00416         /*kTraversal res = */FileTraverse(fullname, traverse);
00417
00418         // assign the icon regarding our Entries info
00419         if(traverse.m_item != 0L)
00420         {
00421             UTREE_INFO query;
00422             query.item = traverse.m_item;
00423             query.icon = GetIcon(m_treeCtrl, m_item, true /*ignored*/, false, data);
00424             UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_SETICON, kUMainWidget, &query);
00425         }
00426
00427         return kSkipFile;
00428     }

virtual kTraversal TBrowserFill::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 415 of file WinCvsBrowser.cpp.

00416     {
00417         return kTraversalError;
00418     }

virtual kTraversal TBrowserFill::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 387 of file UCvsFolders.cpp.

00388     {
00389         return kTraversalError;
00390     }

virtual kTraversal TBrowserFill::OnIdle ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 420 of file WinCvsBrowser.cpp.

00421     {
00422         return kContinueTraversal;
00423     }

virtual kTraversal TBrowserFill::OnIdle ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 392 of file UCvsFolders.cpp.

00393     {
00394         return kContinueTraversal;
00395     }

Member Data Documentation

CSortList<ENTNODE>& TBrowserFill::m_entries

Definition at line 383 of file WinCvsBrowser.cpp.

CSortList<ENTNODE>& TBrowserFill::m_entries

Definition at line 354 of file UCvsFolders.cpp.

vector< UStr > TBrowserFill::m_ignlist

Definition at line 384 of file WinCvsBrowser.cpp.

bool TBrowserFill::m_isShowIgnored

Definition at line 385 of file WinCvsBrowser.cpp.

HTREEITEM TBrowserFill::m_item

Definition at line 381 of file WinCvsBrowser.cpp.

UTREEITEM TBrowserFill::m_item

Definition at line 352 of file UCvsFolders.cpp.

HTREEITEM TBrowserFill::m_root

Definition at line 380 of file WinCvsBrowser.cpp.

UTREEITEM TBrowserFill::m_root

Definition at line 351 of file UCvsFolders.cpp.

CTreeCtrl& TBrowserFill::m_treeCtrl

Definition at line 382 of file WinCvsBrowser.cpp.

UCvsFolders* TBrowserFill::m_treeCtrl

Definition at line 353 of file UCvsFolders.cpp.

The documentation for this class was generated from the following files:
  • common/UCvsFolders.cpp
  • WinCvs/WinCvsBrowser.cpp
Generated on Sun Oct 21 12:49:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TBrowserFillDummy Class Reference

Inheritance diagram for TBrowserFillDummy:

[legend]
Collaboration diagram for TBrowserFillDummy:

[legend]
List of all members.

Public Methods

TBrowserFillDummy (UCvsFolders *treeCtrl, UTREEITEM root, UTREEITEM item, EntnodeData *data)
virtual | ~TBrowserFillDummy ()
virtual kTraversal | EnterDirectory (const char *fullpath, const char *dirname, const FSSpec *macspec)
virtual kTraversal | ExitDirectory (const char *fullpath)
virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnIdle (const char *fullpath)
virtual kTraversal | OnDirectory (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
TBrowserFillDummy (CTreeCtrl &treeCtrl, HTREEITEM root, HTREEITEM item, EntnodeData *data)
virtual kTraversal | EnterDirectory (const char *fullpath, const char *dirname, const FSSpec *macspec)
virtual kTraversal | ExitDirectory (const char *fullpath)
virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnIdle (const char *fullpath)
virtual kTraversal | OnDirectory (const char *fullpath, const char *fullname, const char *name, const struct wnt_stat &dir, const FSSpec *macspec)

Public Attributes

UTREEITEM m_root
UTREEITEM m_item
UCvsFolders * m_treeCtrl
bool | m_empty
bool | m_hascvs
EntnodeData * m_data
UStr m_dirname
HTREEITEM | m_root
HTREEITEM | m_item
CTreeCtrl & m_treeCtrl
EntnodeData * m_data

Constructor & Destructor Documentation

TBrowserFillDummy::TBrowserFillDummy | ( | UCvsFolders * | treeCtrl,
 |  | UTREEITEM | root,
 |  | UTREEITEM | item,
 |  | EntnodeData * | data
 | ) | [inline]

Definition at line 248 of file UCvsFolders.cpp.

00248                                                                                                 :
00249         m_root(root), m_item(item), m_treeCtrl(treeCtrl), m_empty(true),
00250         m_hascvs(false), m_data(data) {}

virtual TBrowserFillDummy::~TBrowserFillDummy ( ) [inline, virtual]

Definition at line 252 of file UCvsFolders.cpp.

00252 {}

TBrowserFillDummy::TBrowserFillDummy | ( | CTreeCtrl & | treeCtrl,
 |  | HTREEITEM | root,
 |  | HTREEITEM | item,
 |  | EntnodeData * | data
 | ) | [inline]

Definition at line 295 of file WinCvsBrowser.cpp.

00295                                                                                                :
00296         m_root(root), m_item(item), m_treeCtrl(treeCtrl), m_empty(true),
00297         m_data(data), m_hascvs(false) {}

Member Function Documentation

virtual kTraversal TBrowserFillDummy::EnterDirectory | ( | const char * | fullpath,
 |  | const char * | dirname,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 299 of file WinCvsBrowser.cpp.

00300     {
00301         if(m_item == 0L)
00302         {
00303             TV_INSERTSTRUCT tvstruct;
00304             tvstruct.hParent = m_root;
00305             tvstruct.hInsertAfter = TVI_SORT;
00306             tvstruct.item.iImage = kIconFolderClosed;
00307             tvstruct.item.iSelectedImage = kIconFolderClosed;
00308             tvstruct.item.pszText = (char *)dirname;
00309             tvstruct.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT;
00310             m_item = m_treeCtrl.InsertItem(&tvstruct);
00311         }
00312
00313         // assign the entries to this item
00314         if(m_data != 0L)
00315         {
00316             EntnodeData *data = (EntnodeData *)m_treeCtrl.GetItemData(m_item);
00317
00318             if(m_data != 0L)
00319                 m_data->Ref();
00320             m_treeCtrl.SetItemData(m_item, (long)m_data);
00321
00322             if(data != 0L)
00323                 data->UnRef();
00324         }
00325         else
00326             m_data = (EntnodeData *)m_treeCtrl.GetItemData(m_item);
00327
00328         return kContinueTraversal;
00329     }

virtual kTraversal TBrowserFillDummy::EnterDirectory | ( | const char * | fullpath,
 |  | const char * | dirname,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 254 of file UCvsFolders.cpp.

00255     {
00256         m_dirname = dirname;
00257 #if qUnix
00258         if(m_dirname.empty())
00259             m_dirname = fullpath; // '/'
00260 #endif
00261         return kContinueTraversal;
00262     }

virtual kTraversal TBrowserFillDummy::ExitDirectory ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 331 of file WinCvsBrowser.cpp.

00332     {
00333         SetIcon(m_treeCtrl, m_item, m_hascvs, false, m_data);
00334
00335         if(m_empty)
00336             return kContinueTraversal;
00337
00338         // add a dummy item to simulate the folder
00339         // is not empty. This dummy item will be
00340         // replaced by a complete listing when the
00341         // node is expanding...
00342         TV_INSERTSTRUCT tvstruct;
00343         tvstruct.hParent = m_item;
00344         tvstruct.hInsertAfter = TVI_SORT;
00345         tvstruct.item.pszText = (char *)gDummyFile;
00346         tvstruct.item.mask = TVIF_TEXT;
00347         m_treeCtrl.InsertItem(&tvstruct);
00348
00349         return kContinueTraversal;
00350     }

virtual kTraversal TBrowserFillDummy::ExitDirectory ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 264 of file UCvsFolders.cpp.

00265     {
00266         if(m_item == 0L)
00267         {
00268             UTREE_INSERT insert;
00269             insert.parent = m_root;
00270             insert.icon = GetIcon(m_treeCtrl, m_item, m_hascvs, false, m_data);
00271             insert.title = m_dirname;
00272             insert.data = 0L;
00273             UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_INSERT, kUMainWidget, &insert);
00274             m_item = insert.result;
00275         }
00276
00277         // assign the entries to this item
00278         UTREE_INFO query;
00279         query.item = m_item;
00280         if(m_data != 0L)
00281         {
00282             UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00283             EntnodeData *data = (EntnodeData *)query.data;
00284
00285             if(m_data != 0L)
00286                 m_data->Ref();
00287
00288             query.data = m_data;
00289             UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_SETDATA, kUMainWidget, &query);
00290
00291             if(data != 0L)
00292                 data->UnRef();
00293         }
00294         else
00295         {
00296             UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_GETINFO, kUMainWidget, &query);
00297             m_data = (EntnodeData *)query.data;
00298         }
00299
00300         if(m_empty)
00301             return kContinueTraversal;
00302
00303         // add a dummy item to simulate the folder
00304         // is not empty. This dummy item will be
00305         // replaced by a complete listing when the
00306         // node is expanding...
00307
00308         UTREE_INSERT insert;
00309         insert.parent = m_item;
00310         insert.icon = 0L;
00311         insert.title = gDummyFile;
00312         insert.data = 0L;
00313         UEventSendMessage(m_treeCtrl->GetWidID(), EV_TREE_INSERT, kUMainWidget, &insert);
00314
00315         return kContinueTraversal;
00316     }

virtual kTraversal TBrowserFillDummy::OnDirectory | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct wnt_stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Definition at line 362 of file WinCvsBrowser.cpp.

00366     {
00367         if(stricmp(name, "cvs") == 0)
00368             m_hascvs = true;
00369         else
00370             m_empty = false;
00371         return kSkipFile;
00372     }

virtual kTraversal TBrowserFillDummy::OnDirectory | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 328 of file UCvsFolders.cpp.

00332     {
00333 #if qUnix
00334         if(strcmp(name, "CVS") == 0)
00335 #else
00336         if(stricmp(name, "cvs") == 0)
00337 #endif
00338             m_hascvs = true;
00339         else
00340             m_empty = false;
00341
00342         return kSkipFile;
00343     }

virtual kTraversal TBrowserFillDummy::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 352 of file WinCvsBrowser.cpp.

00353     {
00354         return kTraversalError;
00355     }

virtual kTraversal TBrowserFillDummy::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 318 of file UCvsFolders.cpp.

00319     {
00320         return kTraversalError;
00321     }

virtual kTraversal TBrowserFillDummy::OnIdle ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 357 of file WinCvsBrowser.cpp.

00358     {
00359         return kContinueTraversal;
00360     }

virtual kTraversal TBrowserFillDummy::OnIdle ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 323 of file UCvsFolders.cpp.

00324     {
00325         return kContinueTraversal;
00326     }

Member Data Documentation

EntnodeData* TBrowserFillDummy::m_data

Definition at line 293 of file WinCvsBrowser.cpp.

EntnodeData* TBrowserFillDummy::m_data

Definition at line 245 of file UCvsFolders.cpp.

UStr TBrowserFillDummy::m_dirname

Definition at line 246 of file UCvsFolders.cpp.

bool TBrowserFillDummy::m_empty

Definition at line 291 of file WinCvsBrowser.cpp.

bool TBrowserFillDummy::m_hascvs

Definition at line 292 of file WinCvsBrowser.cpp.

HTREEITEM TBrowserFillDummy::m_item

Definition at line 289 of file WinCvsBrowser.cpp.

UTREEITEM TBrowserFillDummy::m_item

Definition at line 241 of file UCvsFolders.cpp.

Referenced by TBrowserFill::OnDirectory(), and UCvsFolders::ResetBrowser().

HTREEITEM TBrowserFillDummy::m_root

Definition at line 288 of file WinCvsBrowser.cpp.

UTREEITEM TBrowserFillDummy::m_root

Definition at line 240 of file UCvsFolders.cpp.

CTreeCtrl& TBrowserFillDummy::m_treeCtrl

Definition at line 290 of file WinCvsBrowser.cpp.

UCvsFolders* TBrowserFillDummy::m_treeCtrl

Definition at line 242 of file UCvsFolders.cpp.

The documentation for this class was generated from the following files:
  • common/UCvsFolders.cpp
  • WinCvs/WinCvsBrowser.cpp
Generated on Sun Oct 21 12:49:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TBuggyPopup Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TBuggyPopup:

[legend]
Collaboration diagram for TBuggyPopup:

[legend]
List of all members.

Protected Attributes

int | fRealWidth

Private Methods

TBuggyPopup ()
virtual | ~TBuggyPopup ()
virtual void | ReadFields (CStream_AC *aStream)
virtual void | WriteFields (CStream_AC *aStream) const
virtual void | DoPostCreate (TDocument *itsDocument)

Private Attributes

MA_DECLARE_CLASS

Constructor & Destructor Documentation

TBuggyPopup::TBuggyPopup ( ) [private]

Definition at line 541 of file UPseudoSupport.cpp.

00542 {
00543 }

TBuggyPopup::~TBuggyPopup ( ) [private, virtual]

Definition at line 545 of file UPseudoSupport.cpp.

00546 {
00547 }

Member Function Documentation

void TBuggyPopup::DoPostCreate ( TDocument * itsDocument ) [private, virtual]

Definition at line 563 of file UPseudoSupport.cpp.

00564 {
00565     if(fRealWidth > 0)
00566     {
00567         CViewRect r = GetExtent();
00568         Resize(CViewPoint(fRealWidth, r.Height()), true);
00569     }
00570 }

void TBuggyPopup::ReadFields ( CStream_AC * aStream ) [private, virtual]

Definition at line 549 of file UPseudoSupport.cpp.

00550 {
00551     Inherited::ReadFields(aStream);
00552
00553     *aStream >> fRealWidth;
00554 }

void TBuggyPopup::WriteFields ( CStream_AC * aStream ) const [private, virtual]

Definition at line 556 of file UPseudoSupport.cpp.

00557 {
00558     Inherited::WriteFields(aStream);
00559
00560     *aStream << fRealWidth;
00561 }

Member Data Documentation

TBuggyPopup::MA_DECLARE_CLASS [private]

Definition at line 15 of file UPseudoSupport.h.

int TBuggyPopup::fRealWidth [protected]

Definition at line 24 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:49:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTcl_Interp Class Reference

#include <TclGlue.h>

Collaboration diagram for CTcl_Interp:

[legend]
List of all members.

Public Methods

CTcl_Interp ()
~CTcl_Interp ()
kTclRes | DoScriptVar (const char *format,...)
kTclRes | DoScript (const char *script)
kTclRes | DoFile (const char *file)
operator Tcl_Interp * (void)
int | GetCvsLastErrorCode ()
void | SetCvsLastErrorCode (int value)
bool | GetCvsExitOnError ()
void | SetCvsExitOnError (bool value)

Static Public Methods

bool | IsAvail (void)
void | Unixfy (UStr &path)
void | Deunixfy (UStr &path)

Protected Attributes

Tcl_Interp * | fInterp
int | fLastErrorCode
bool | fExitOnError

Constructor & Destructor Documentation

CTcl_Interp::CTcl_Interp ( )

Definition at line 935 of file TclGlue.cpp.

00936 {
00937     fInterp = 0L;
00938
00939     fExitOnError = true;
00940     fLastErrorCode = 0;
00941
00942 #if USE_TCL
00943     if(!CTcl_Interp::IsAvail())
00944     {
00945         cvs_err("TCL is not available !\n");
00946         return;
00947     }
00948
00949     fInterp = myTcl_CreateInterp();
00950     if(fInterp == 0L)
00951     {
00952         cvs_err("Unable to create a new TCL interpreter !\n");
00953         return;
00954     }
00955
00956     Tcl_Command cmd;
00957
00958     // this parameter is used to get access to CTcl_Interp::SetCvsLastErrorCode
00959     // in tclCvsProc method
00960     cmd = Tcl_CreateCommand (fInterp, "cvs", _TCL_CALLBACK(tclCvsProc),
00961         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00962
00963     cmd = Tcl_CreateCommand (fInterp, "help", _TCL_CALLBACK(tclHelpProc),
00964         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00965     cmd = Tcl_CreateCommand (fInterp, "cvsout", _TCL_CALLBACK(tclCvsOutProc),
00966         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00967     cmd = Tcl_CreateCommand (fInterp, "cvserr", _TCL_CALLBACK(tclCvsErrProc),
00968         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00969     cmd = Tcl_CreateCommand (fInterp, "cvsbrowser", _TCL_CALLBACK(tclCvsBrowserProc),
00970         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00971     cmd = Tcl_CreateCommand (fInterp, "cvsentries", _TCL_CALLBACK(tclCvsEntriesProc),
00972         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00973 #ifdef WIN32
00974     cmd = Tcl_CreateCommand (fInterp, "ls", _TCL_CALLBACK(tclDirProc),
00975         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00976     cmd = Tcl_CreateCommand (fInterp, "dir", _TCL_CALLBACK(tclDirProc),
00977         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00978 #endif /* WIN32 */
00979     cmd = Tcl_CreateCommand (fInterp, "trash", _TCL_CALLBACK(tclSafeRemove),
00980         (ClientData)0L, (Tcl_CmdDeleteProc *)0L);
00981
00982     cmd = Tcl_CreateCommand (fInterp, "cvsexitonerror", _TCL_CALLBACK(tclCvsExitOnErrorProc),
00983         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00984
00985     cmd = Tcl_CreateCommand (fInterp, "cvslasterrorcode", _TCL_CALLBACK(tclCvsLastErrorCodeProc),
00986         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00987 #if defined(WIN32)
00988     cmd = Tcl_CreateCommand (fInterp, "cvssetdebugmask", _TCL_CALLBACK(tclSetDebugMaskProc),
00989         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00990     cmd = Tcl_CreateCommand (fInterp, "cvsgetdebugmask", _TCL_CALLBACK(tclGetDebugMaskProc),
00991         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00992     cmd = Tcl_CreateCommand (fInterp, "cvsfilemodtime", _TCL_CALLBACK(tclGetFileModTimeProc),
00993         (ClientData)this, (Tcl_CmdDeleteProc *)0L);
00994 #endif  // defined(WIN32)
00995
00996     CStr rcfile;
00997     MacrosGetLoc(rcfile);
00998     if(!rcfile.endsWith(kPathDelimiter))
00999         rcfile << kPathDelimiter;
01000     rcfile << "startup.tcl";
01001     Tcl_SetVar(fInterp, "tcl_rcFileName", rcfile, TCL_GLOBAL_ONLY);
01002     Tcl_SetVar(fInterp, "tcl_interactive", "1", TCL_GLOBAL_ONLY);
01003     Tcl_Init(fInterp);
01004     Tcl_SourceRCFile(fInterp);
01005 #endif
01006 }

CTcl_Interp::~CTcl_Interp ( )

Definition at line 1008 of file TclGlue.cpp.

01009 {
01010 #if USE_TCL
01011     if(fInterp != 0L)
01012         Tcl_DeleteInterp(fInterp);
01013 #endif
01014 }

Member Function Documentation

void CTcl_Interp::Deunixfy ( UStr & path ) [static]

Definition at line 1220 of file TclGlue.cpp.

Referenced by CTCLBrowserEnt::GetNormalized(), CTCLBrowserEnt::IsSamePath(), tclCvsEntriesProc(), and tclSafeRemove().

01221 {
01222     char *ptr = path;
01223     while((ptr = strchr(ptr, kTCLPathDelimiter)) != 0L)
01224     {
01225         *ptr++ = kPathDelimiter;
01226     }
01227 }

kTclRes CTcl_Interp::DoFile ( const char * file )

Definition at line 1179 of file TclGlue.cpp.

01180 {
01181 #if USE_TCL
01182     if(fInterp == 0L)
01183         return false;
01184
01185     int exitc = Tcl_EvalFile(fInterp, (char *)file);
01186     size_t len = strlen(fInterp->result);
01187     if(exitc == TCL_ERROR)
01188     {
01189         cvs_errstr(fInterp->result, len);
01190         if(len != 0 && fInterp->result[len - 1] != '\n')
01191             cvs_errstr("\n", 1);
01192     }
01193     else
01194     {
01195         cvs_outstr(fInterp->result, len);
01196         if(len != 0 && fInterp->result[len - 1] != '\n')
01197             cvs_outstr("\n", 1);
01198     }
01199
01200     return exitc;
01201 #else
01202     return false;
01203 #endif
01204 }

kTclRes CTcl_Interp::DoScript ( const char * script )

Definition at line 1121 of file TclGlue.cpp.

Referenced by DoScriptVar(), and CWincvsView::OnKeyDown().

01122 {
01123 #if USE_TCL
01124     bool bTclFileStarted;
01125
01126     if(fInterp == 0L)
01127         return false;
01128
01129     // If script cmd begins with "source " then this
01130     // must be TCL file execution.
01131     bTclFileStarted = (strncmp(script, "source ", 7) == 0);
01132     if(bTclFileStarted)
01133         gCvsPrefs.SetTclFileRunning(true);
01134
01135     int exitc = Tcl_Eval(fInterp, (char *)script);
01136
01137     if(bTclFileStarted)
01138         gCvsPrefs.SetTclFileRunning(false);
01139
01140     size_t len = strlen(fInterp->result);
01141     if(exitc == TCL_ERROR)
01142     {
01143         cvs_errstr(fInterp->result, len);
01144         if(len != 0 && fInterp->result[len - 1] != '\n')
01145             cvs_errstr("\n", 1);
01146     }
01147     else
01148     {
01149         cvs_outstr(fInterp->result, len);
01150         if(len != 0 && fInterp->result[len - 1] != '\n')
01151             cvs_outstr("\n", 1);
01152     }
01153
01154     return exitc;
01155 #else
01156     return false;
01157 #endif
01158 }

kTclRes CTcl_Interp::DoScriptVar | ( | const char * | format,
 |  | ... |
 | ) |

Definition at line 1160 of file TclGlue.cpp.

Referenced by CvsCmdMacrosAdmin(), UCvsFolders::OnCmdMacrosSel(), UCvsFiles::OnMacroSel(), and cvsgui_LaunchTclMacro().

01161 {
01162 #if USE_TCL
01163     if(fInterp == 0L)
01164         return false;
01165
01166     va_list args;
01167     char script[1024] = {'\0'};
01168
01169     va_start (args, format);
01170     vsprintf (script, format, args);
01171     va_end (args);
01172
01173     return DoScript(script);
01174 #else
01175     return false;
01176 #endif
01177 }

bool CTcl_Interp::GetCvsExitOnError ( ) [inline]

Definition at line 68 of file TclGlue.h.

Referenced by tclCvsProc().

00068 { return fExitOnError; }

int CTcl_Interp::GetCvsLastErrorCode ( ) [inline]

Definition at line 65 of file TclGlue.h.

Referenced by tclCvsLastErrorCodeProc().

00065 { return fLastErrorCode; }

bool CTcl_Interp::IsAvail ( void ) [static]

Definition at line 1016 of file TclGlue.cpp.

Referenced by CTcl_Interp(), CvsCmdMacrosAdmin(), CWincvsApp::InitInstance(), UCvsFrame::OnCmdUIMacroAdmin(), CWincvsView::OnKeyDown(), CWincvsDoc::OnUpdateMacroAdmin(), and UCvsApp::SayWelcome().

01017 {
01018 #if USE_TCL
01019 #if defined(macintosh) && !qCarbon
01020     return Tcl_CreateInterp != 0L;
01021 #else /* !macintosh */
01022     static bool firstTime = true;
01023     static bool tclAvail = false;
01024     if(firstTime)
01025     {
01026 #   if defined(WIN32) || qCarbon
01027         CompatConnectID connID;
01028 #   endif
01029
01030 #   ifdef WIN32
01031         extern char *findTcl (char *_minVer, int _exact, int _dbgOnly);
01032         char *tclver = 0L;
01033         try
01034         {
01035             tclver = findTcl("8.1", 0, 0);
01036         }
01037         catch(...)
01038         {
01039         }
01040
01041         if(tclver != 0L)
01042             tclAvail = CompatLoadLibrary(&connID, tclver) != 0;
01043
01044         if(!tclAvail)
01045             tclAvail = CompatLoadLibrary(&connID, "tcl87.dll") != 0 ||
01046             CompatLoadLibrary(&connID, "tcl86.dll") != 0 ||
01047             CompatLoadLibrary(&connID, "tcl85.dll") != 0 ||
01048             CompatLoadLibrary(&connID, "tcl84.dll") != 0 ||
01049             CompatLoadLibrary(&connID, "tcl83.dll") != 0 ||
01050             CompatLoadLibrary(&connID, "tcl82.dll") != 0 ||
01051             CompatLoadLibrary(&connID, "tcl81.dll") != 0;
01052 #   endif
01053
01054 #   if qCarbon
01055         if (UEnvironment::GetOSVersion() >= 0x1000)
01056             tclAvail = CompatLoadLibrary(&connID, "/System/Library/Frameworks/Tcl.framework");
01057         else
01058             tclAvail = CompatLoadLibrary(&connID, "tcl8.3");
01059 #   endif
01060
01061 #   if defined(WIN32) || qCarbon
01062 #   define LOAD_CODEFRAG(name) \
01063         if(tclAvail) \
01064             tclAvail = (*(void **)&name##_glue = \
01065                 _CompatCallLibrary(connID, #name)) != 0L
01066 #   endif
01067 #   if defined(WIN32) || TARGET_API_MAC_CARBON
01068         LOAD_CODEFRAG(Tcl_CreateCommand);
01069         LOAD_CODEFRAG(Tcl_CreateInterp);
01070         LOAD_CODEFRAG(Tcl_AppendResult);
01071         LOAD_CODEFRAG(Tcl_SetResult);
01072         LOAD_CODEFRAG(Tcl_DeleteInterp);
01073         LOAD_CODEFRAG(Tcl_Eval);
01074         LOAD_CODEFRAG(Tcl_EvalFile);
01075         LOAD_CODEFRAG(Tcl_Alloc);
01076         LOAD_CODEFRAG(Tcl_Free);
01077         LOAD_CODEFRAG(Tcl_Realloc);
01078         LOAD_CODEFRAG(Tcl_ExprLong);
01079         LOAD_CODEFRAG(Tcl_Concat);
01080         LOAD_CODEFRAG(Tcl_SetVar2);
01081         LOAD_CODEFRAG(Tcl_DStringStartSublist);
01082         LOAD_CODEFRAG(Tcl_DStringEndSublist);
01083         LOAD_CODEFRAG(Tcl_DStringFree);
01084         LOAD_CODEFRAG(Tcl_DStringInit);
01085         LOAD_CODEFRAG(Tcl_DStringResult);
01086         LOAD_CODEFRAG(Tcl_DStringAppendElement);
01087         LOAD_CODEFRAG(TclFreeObj);
01088         LOAD_CODEFRAG(Tcl_SetObjResult);
01089         LOAD_CODEFRAG(Tcl_NewStringObj);
01090         LOAD_CODEFRAG(Tcl_NewListObj);
01091         LOAD_CODEFRAG(Tcl_ListObjAppendElement);
01092         LOAD_CODEFRAG(Tcl_SourceRCFile);
01093         LOAD_CODEFRAG(Tcl_Init);
01094         LOAD_CODEFRAG(Tcl_SetVar);
01095         LOAD_CODEFRAG(Tcl_FindExecutable);
01096
01097         if(!tclAvail)
01098             return false;
01099 #   endif /* WIN32 */
01100
01101         Tcl_Interp *interp = myTcl_CreateInterp();
01102         tclAvail = interp != 0L;
01103         if (!tclAvail)
01104             return false;
01105
01106         Tcl_Init(interp);
01107
01108         /* Destroy the interp we needed just for this */
01109         Tcl_DeleteInterp(interp);
01110
01111         firstTime = false;
01112     }
01113
01114     return tclAvail;
01115 #endif /* !macintosh */
01116 #else
01117     return false;
01118 #endif
01119 }

void CTcl_Interp::SetCvsExitOnError ( bool value ) [inline]

Definition at line 69 of file TclGlue.h.

Referenced by tclCvsExitOnErrorProc().

00069 { fExitOnError = value; }

void CTcl_Interp::SetCvsLastErrorCode ( int value ) [inline]

Definition at line 66 of file TclGlue.h.

Referenced by tclCvsLastErrorCodeProc(), and tclCvsProc().

00066 { fLastErrorCode = value; }

void CTcl_Interp::Unixfy ( UStr & path ) [static]

Definition at line 1206 of file TclGlue.cpp.

Referenced by CvsCmdMacrosAdmin(), UCvsFolders::OnCmdMacrosSel(), UCvsFiles::OnMacroSel(), cvsgui_LaunchTclMacro(), and tclCvsBrowserProc().

01207 {
01208     char *ptr = path;
01209     while((ptr = strchr(ptr, kPathDelimiter)) != 0L)
01210     {
01211         *ptr++ = kTCLPathDelimiter;
01212     }
01213     ptr = (char *)path + path.length() - 1;
01214     if(*ptr == kTCLPathDelimiter)
01215     {
01216         *ptr = '\0';
01217     }
01218 }

CTcl_Interp::operator Tcl_Interp * ( void ) [inline]

Definition at line 63 of file TclGlue.h.

00063 {return fInterp;}

Member Data Documentation

bool CTcl_Interp::fExitOnError [protected]

Definition at line 78 of file TclGlue.h.

Tcl_Interp* CTcl_Interp::fInterp [protected]

Definition at line 75 of file TclGlue.h.

int CTcl_Interp::fLastErrorCode [protected]

Definition at line 77 of file TclGlue.h.

The documentation for this class was generated from the following files:
  • common/TclGlue.h
  • common/TclGlue.cpp
Generated on Sun Oct 21 12:50:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTCLBrowserEnt Class Reference

Collaboration diagram for CTCLBrowserEnt:

[legend]
List of all members.

Public Methods

CTCLBrowserEnt ()
CTCLBrowserEnt (EntnodeData *data)
CTCLBrowserEnt (const CTCLBrowserEnt &ent)
~CTCLBrowserEnt ()
CTCLBrowserEnt & | operator= (const CTCLBrowserEnt &ent)
bool | IsSamePath (const char *pathstr) const
EntnodeData * | GetData () const
void | GetNormalized (UStr &path, UStr &fname) const

Private Attributes

ENTNODE node

Constructor & Destructor Documentation

CTCLBrowserEnt::CTCLBrowserEnt ( ) [inline]

Definition at line 228 of file TclGlue.cpp.

00229     {}

CTCLBrowserEnt::CTCLBrowserEnt ( EntnodeData * data ) [inline]

Definition at line 231 of file TclGlue.cpp.

00232     : node(data)
00233     {}

CTCLBrowserEnt::CTCLBrowserEnt ( const CTCLBrowserEnt & ent ) [inline]

Definition at line 235 of file TclGlue.cpp.

00236     : node(ent.node)
00237     {}

CTCLBrowserEnt::~CTCLBrowserEnt ( ) [inline]

Definition at line 239 of file TclGlue.cpp.

00240     {}

Member Function Documentation

EntnodeData* CTCLBrowserEnt::GetData ( void ) const [inline]

Definition at line 260 of file TclGlue.cpp.

Referenced by tclCvsBrowserProc().

00261     {
00262         return node.Data();
00263     }

void CTCLBrowserEnt::GetNormalized | ( | UStr & | path,
 |  | UStr & | fname
 | ) | const [inline]

Definition at line 266 of file TclGlue.cpp.

Referenced by tclCvsBrowserProc().

00267     {
00268         CStr file;
00269         node.Data()->GetFullPathName(file);
00270         CTcl_Interp::Deunixfy(file);
00271         SplitPath(file, path, fname);
00272     }

bool CTCLBrowserEnt::IsSamePath ( const char * pathstr ) const [inline]

Definition at line 248 of file TclGlue.cpp.

Referenced by tclCvsBrowserProc().

00249     {
00250         CStr path = pathstr;
00251         CTcl_Interp::Deunixfy(path);
00252
00253         CStr file;
00254         node.Data()->GetFullPathName(file);
00255         CTcl_Interp::Deunixfy(file);
00256
00257         return path.compare(file) == 0;
00258     }

CTCLBrowserEnt& CTCLBrowserEnt::operator= ( const CTCLBrowserEnt & ent ) [inline]

Definition at line 242 of file TclGlue.cpp.

00243     {
00244         node = ent.node;
00245         return *this;
00246     }

Member Data Documentation

ENTNODE CTCLBrowserEnt::node [private]

Definition at line 275 of file TclGlue.cpp.

Referenced by operator=().

The documentation for this class was generated from the following file:
  • common/TclGlue.cpp
Generated on Sun Oct 21 12:50:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTCLCvsConsole Class Reference

Inheritance diagram for CTCLCvsConsole:

[legend]
Collaboration diagram for CTCLCvsConsole:

[legend]
List of all members.

Public Methods

CTCLCvsConsole (Tcl_Interp *interp)
virtual | ~CTCLCvsConsole ()
virtual long | cvs_out (char *txt, long len)
virtual long | cvs_err (char *txt, long len)

Protected Attributes

Tcl_Interp * | fInterp
int | fLen
char * | fAlloc

Constructor & Destructor Documentation

CTCLCvsConsole::CTCLCvsConsole ( Tcl_Interp * interp ) [inline]

Definition at line 283 of file TclGlue.cpp.

00283                                        : fInterp(interp)
00284     {
00285         fLen = 100;
00286         fAlloc = (char *)malloc((fLen + 1) * sizeof(char));
00287     }

virtual CTCLCvsConsole::~CTCLCvsConsole ( ) [inline, virtual]

Definition at line 288 of file TclGlue.cpp.

00289     {
00290         if(fAlloc != 0L)
00291             free(fAlloc);
00292     }

Member Function Documentation

virtual long CTCLCvsConsole::cvs_err | ( | char * | txt,
 |  | long | len
 | ) | [inline, virtual]

Reimplemented from CCvsConsole.

Definition at line 314 of file TclGlue.cpp.

00315     {
00316         return cvs_out(txt, len);
00317     }

virtual long CTCLCvsConsole::cvs_out | ( | char * | txt,
 |  | long | len
 | ) | [inline, virtual]

Reimplemented from CCvsConsole.

Definition at line 294 of file TclGlue.cpp.

00295     {
00296         if(fAlloc == 0L)
00297             return 0;
00298
00299         if(len > fLen)
00300         {
00301             fLen = len;
00302             fAlloc = (char *)realloc(fAlloc, (fLen + 1) * sizeof(char));
00303         }
00304         if(fAlloc == 0L)
00305             return 0;
00306
00307         memcpy(fAlloc, txt, len * sizeof(char));
00308         fAlloc[len] = '\0';
00309
00310         Tcl_AppendResult(fInterp, fAlloc, 0L);
00311         return len;
00312     }

Member Data Documentation

char* CTCLCvsConsole::fAlloc [protected]

Definition at line 321 of file TclGlue.cpp.

Tcl_Interp* CTCLCvsConsole::fInterp [protected]

Definition at line 319 of file TclGlue.cpp.

int CTCLCvsConsole::fLen [protected]

Definition at line 320 of file TclGlue.cpp.

The documentation for this class was generated from the following file:
  • common/TclGlue.cpp
Generated on Sun Oct 21 12:50:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTCP2Parse Class Reference

#include <CTCP2Parse.hpp>

Inheritance diagram for CTCP2Parse:

[legend]
Collaboration diagram for CTCP2Parse:

[legend]
List of all members.

Protected Types

enum EncodingType {
iso8859_1, iso8859_2, iso8859_3, iso8859_4,
iso8859_5, iso8859_6, iso8859_7, iso8859_8,
iso8859_9, UTF_8
}
enum | CharSpacingType { Fixed, Proportional }
enum ColorType {
Black = 0x000000, Blue = 0x00007F, Green = 0x007F00, Cyan = 0x007F7F,
Red = 0x7F0000, Magenta = 0x7F007F, Yellow = 0x7F7F00, Lt_Grey = 0xC0C0C0,
Grey = 0x7F7F7F, Lt_Blue = 0x0000FF, Lt_Green = 0x00FF00, Lt_Cyan = 0x00FFFF,
Lt_Red = 0xFF0000, Lt_Magenta = 0xFF00FF, Lt_Yellow = 0xFFFF00, White = 0xFFFFFF
}

Protected Methods

CTCP2Parse ()
void | SetDefaults (unsigned char fgR=(unsigned char)((Lt_Grey &0xFF0000) >> 16), unsigned char fgG=(unsigned char)((Lt_Grey &0x00FF00) >> 8), unsigned char fgB=(unsigned char)(Lt_Grey &0x0000FF), unsigned char bgR=(unsigned char)((Black &0xFF0000) >> 16), unsigned char bgG=(unsigned char)((Black &0x00FF00) >> 8), unsigned char bgB=(unsigned char)(Black &0x0000FF), CharSpacingType cpDef_=Fixed, EncodingType encDef_=iso8859_1)
void | ParseIt (std::string *line)
virtual void | PushStart ()=0
virtual void | PushBold (bool)=0
virtual void | PushReverse (bool)=0
virtual void | PushUnderline (bool)=0
virtual void | PushOverstrike (bool)=0
virtual void | PushItalic (bool)=0
virtual void | PushBlink (bool)=0
virtual void | PushURL (bool)=0
virtual void | PushEncoding (EncodingType)=0
virtual void | PushSpacing (CharSpacingType)=0
virtual void | PushFontSize (int)=0
virtual void | PushForegroundColor (unsigned char R, unsigned char G, unsigned char B)=0
virtual void | PushBackgroundColor (unsigned char R, unsigned char G, unsigned char B)=0
virtual void | PushTextSegment (std::string *)=0

Private Methods

void | decodeToggle (std::string *line, int *parseFrmChar, int *parseEndChar, int *varCnt)
int | decodeColor (std::string *line, int *parseFrmChar, int *parseEndChar, RGBColor *c)
int | fromHex (unsigned char h, unsigned char *val)
void | PushOut (void)

Private Attributes

EncodingType enc
EncodingType encLast
EncodingType encDef
int | boldCnt
int | revCnt
int | overCnt
int | underCnt
int | italicCnt
int | blinkCnt
int | urlCnt
int | boldLast
int | revLast
int | overLast
int | underLast
int | italicLast
int | blinkLast
int | urlLast
int | fntSize
int | fntLast
CharSpacingType cp
CharSpacingType cpLast
CharSpacingType cpDef
RGBColor fg
RGBColor fgLast
RGBColor fgDef
RGBColor bg
RGBColor bgLast
RGBColor bgDef
std::string * segment

Static Private Attributes

const RGBColor | indexColor [16]

Member Enumeration Documentation

enum CTCP2Parse::CharSpacingType [protected]

Enumeration values:
Fixed
Proportional

Definition at line 111 of file CTCP2Parse.hpp.

00111 { Fixed, Proportional };

enum CTCP2Parse::ColorType [protected]

Enumeration values:
Black
Blue
Green
Cyan
Red
Magenta
Yellow
Lt_Grey
Grey
Lt_Blue
Lt_Green
Lt_Cyan
Lt_Red
Lt_Magenta
Lt_Yellow
White

Definition at line 114 of file CTCP2Parse.hpp.

00115     {
00116         Black      = 0x000000,
00117         Blue       = 0x00007F,
00118         Green      = 0x007F00,
00119         Cyan       = 0x007F7F,
00120         Red        = 0x7F0000,
00121         Magenta    = 0x7F007F,
00122         Yellow     = 0x7F7F00,
00123         Lt_Grey    = 0xC0C0C0,
00124         Grey       = 0x7F7F7F,
00125         Lt_Blue    = 0x0000FF,
00126         Lt_Green   = 0x00FF00,
00127         Lt_Cyan    = 0x00FFFF,
00128         Lt_Red     = 0xFF0000,
00129         Lt_Magenta = 0xFF00FF,
00130         Lt_Yellow  = 0xFFFF00,
00131         White      = 0xFFFFFF
00132     };

enum CTCP2Parse::EncodingType [protected]

Enumeration values:
iso8859_1
iso8859_2
iso8859_3
iso8859_4
iso8859_5
iso8859_6
iso8859_7
iso8859_8
iso8859_9
UTF_8

Definition at line 104 of file CTCP2Parse.hpp.

00105     {
00106         iso8859_1, iso8859_2, iso8859_3, iso8859_4, iso8859_5, iso8859_6,
00107         iso8859_7, iso8859_8, iso8859_9, UTF_8
00108     };

Constructor & Destructor Documentation

CTCP2Parse::CTCP2Parse ( ) [protected]

Definition at line 31 of file CTCP2Parse.cpp.

00032 {
00033     boldCnt = revCnt = overCnt = underCnt = italicCnt = blinkCnt = urlCnt = 0;
00034     boldLast = revLast = overLast = underLast = italicLast = blinkLast = urlLast = 0;
00035     fntSize = fntLast = 0;
00036
00037     fg.RGB = fgLast.RGB = fgDef.RGB = Lt_Grey;
00038     bg.RGB = bgLast.RGB = bgDef.RGB = Black;
00039
00040     cp = cpLast = cpDef = Fixed;
00041     enc = encLast = encDef = iso8859_1;
00042 }

Member Function Documentation

void CTCP2Parse::ParseIt ( std::string * line ) [protected]

Definition at line 65 of file CTCP2Parse.cpp.

00066 {
00067     int parseFrmChar = 0, parseEndChar = 0, parseStart = 0;
00068     int fntVal, fntDir = 1;
00069     int rollBack;
00070
00071     // Pre-parse and replace other attribute standards with
00072     // the ctcp2 equivalents for display.
00073     mirc2ctcp(line);
00074     ircii2ctcp(line);
00075     ansi2ctcp(line);
00076
00077
00078     // find an opening ctcp/2 format character (^F)
00079     parseFrmChar = line->find_first_of("\006");
00080
00081     // do we have any?
00082     while (parseFrmChar != std::string::npos)
00083     {
00084         // find the closing ctcp/2 format character (^F)
00085         parseEndChar = line->find_first_of("\006", parseFrmChar+1);
00086
00087         if (parseEndChar == std::string::npos)
00088         {
00089             // an opening without a closing is bogus
00090             // so remove it and fallout of the while loop
00091             line->replace(parseFrmChar, 1, "");
00092             break;
00093         }
00094
00095         // check for text before this format character
00096         // and after the last format character (or index 0 for
00097         // the first iteration.
00098         if (parseFrmChar > parseStart)
00099         {
00100             // yes.. we got a text segment ready to push.
00101             segment = new std::string(line->substr(parseStart, (parseFrmChar - parseStart)));
00102             PushOut();
00103             delete segment;
00104         }
00105
00106         // now, interpret this format code and decode this attribute
00107         // (and options, if any).
00108
00109
00110         parseFrmChar++;  // consume the first ^F.
00111
00112
00113         switch (line->at(parseFrmChar)) {
00114
00115 #   define CTCP2_TOGGLE(ch, var)  \
00116         case (ch): \
00117         decodeToggle(line, &parseFrmChar, &parseEndChar, &(var)); \
00118             break;
00119
00120         // bold
00121         CTCP2_TOGGLE('B', boldCnt);
00122
00123         // reverse
00124         CTCP2_TOGGLE('V', revCnt);
00125
00126         // underline
00127         CTCP2_TOGGLE('U', underCnt);
00128
00129         // over-strike
00130         CTCP2_TOGGLE('S', overCnt);
00131
00132         // italics
00133         CTCP2_TOGGLE('I', italicCnt);
00134
00135         // blink
00136         CTCP2_TOGGLE('K', blinkCnt);
00137
00138         // URL
00139         CTCP2_TOGGLE('L', urlCnt);
00140
00141 #   undef CTCP2_TOGGLE
00142
00143         // color
00144         case 'C':
00145             parseFrmChar++;   // consume the 'C'
00146             if (parseFrmChar < parseEndChar)
00147             {
00148                 if (line->at(parseFrmChar) == '.')
00149                 {
00150                     // reset to default
00151                     fg.RGB = fgDef.RGB;
00152                     parseFrmChar++;  // consume the '.'
00153                 }
00154                 else if (line->at(parseFrmChar) == '-')
00155                 {
00156                     // ignore
00157                     parseFrmChar++;   // consume the '-'
00158                 }
00159                 else
00160                 {
00161                     if (rollBack = decodeColor(line, &parseFrmChar, &parseEndChar, &fg))
00162                     {
00163                         // rollback the error to the 'C'
00164                         parseFrmChar -= rollBack;
00165                         fg.RGB = fgDef.RGB;
00166                         break;
00167                     }
00168                 }
00169
00170
00171                 // background color?
00172                 if (parseFrmChar < parseEndChar)
00173                 {
00174                     if (line->at(parseFrmChar) == '.')
00175                     {
00176                         bg.RGB = bgDef.RGB;
00177                         parseFrmChar++;  // consume the '.'
00178                     }
00179                     else if (line->at(parseFrmChar) == '-')
00180                     {
00181                         // ignore
00182                         parseFrmChar++;   // consume the '-'
00183                     }
00184                     else
00185                     {
00186                         if (rollBack = decodeColor(line, &parseFrmChar, &parseEndChar, &bg))
00187                         {
00188                             // rollback the error to the 'C'
00189                             parseFrmChar -= rollBack;
00190                             bg.RGB = bgDef.RGB;
00191                             break;
00192                         }
00193                     }
00194                 }
00195                 else
00196                     parseFrmChar--;   // rollback one
00197             }
00198             else
00199             {
00200                 // no colors were specified: reset to normal
00201                 fg.RGB = fgDef.RGB;
00202                 bg.RGB = bgDef.RGB;
00203             }
00204
00205             // if fg/bg are too similar, reset to defaults.
00206             // (this is in the ctcp2 draft).  These calculations
00207             // are DIRECTLY from ctcp2's draft.
00208             if ((fg.R >= bg.R - 8) && (fg.R <= bg.R + 8) &&
00209                 (fg.G >= bg.G - 8) && (fg.G <= bg.G + 8) &&
00210                 (fg.B >= bg.B - 8) && (fg.B <= bg.B + 8))
00211             {
00212                 fg.RGB = fgDef.RGB;
00213                 bg.RGB = bgDef.RGB;
00214             }
00215             break;
00216
00217         // font size
00218         case 'F':
00219             parseFrmChar++;
00220             if (parseFrmChar < parseEndChar)
00221             {
00222                 if (line->at(parseFrmChar) == '+') fntDir = 1;
00223                 else fntDir = -1;
00224                 parseFrmChar++;
00225                 if (parseFrmChar < parseEndChar)
00226                 {
00227                     fntVal = line->at(parseFrmChar) - 48;
00228                     if (fntVal > 4) fntVal = 4;
00229                 } else {
00230                     // no amount -- assume 1
00231                     fntVal = 1;
00232                     parseFrmChar--;
00233                 }
00234                 fntSize += (fntDir*fntVal);
00235             } else {
00236                 // no parameters -- reset to normal
00237                 fntSize = 0;
00238                 parseFrmChar--;
00239             }
00240             break;
00241
00242         // character spacing
00243         case 'P':
00244             parseFrmChar++;   // consume it
00245             if (parseFrmChar < parseEndChar)
00246             {
00247                 switch (line->at(parseFrmChar))
00248                 {
00249                 case 'P':
00250                     cp = Proportional; parseFrmChar++; break;
00251                 case 'F':
00252                     cp = Fixed; parseFrmChar++; break;
00253                 default:
00254                     // rollback to show the error.
00255                     parseFrmChar -= 2;
00256                 }
00257             } else {
00258                 // no parameters -- reset to normal
00259                 cp = cpDef;
00260             }
00261             break;
00262
00263         // text encoding
00264         case 'E':
00265             parseFrmChar++;   // consume it
00266             switch (line->at(parseFrmChar))
00267             {
00268             case '1':
00269                 if (line->at(parseFrmChar+1) == '0') parseFrmChar++; // what's iso8859-10 ???
00270                 enc = iso8859_1; parseFrmChar++; break;
00271             case '2':
00272                 enc = iso8859_2; parseFrmChar++; break;
00273             case '3':
00274                 enc = iso8859_3; parseFrmChar++; break;
00275             case '4':
00276                 enc = iso8859_4; parseFrmChar++; break;
00277             case '5':
00278                 enc = iso8859_5; parseFrmChar++; break;
00279             case '6':
00280                 enc = iso8859_6; parseFrmChar++; break;
00281             case '7':
00282                 enc = iso8859_7; parseFrmChar++; break;
00283             case '8':
00284                 enc = iso8859_8; parseFrmChar++; break;
00285             case '9':
00286                 enc = iso8859_9; parseFrmChar++; break;
00287             case 'U':
00288                 enc = UTF_8; parseFrmChar++; break;
00289             default:
00290                 // rollback to show the error.
00291                 parseFrmChar -= 2;
00292             }
00293             break;
00294
00295         // revert to normal
00296         case 'N':
00297             parseFrmChar++;   // consume it
00298             boldCnt = revCnt = overCnt = underCnt = italicCnt = blinkCnt = urlCnt = 0;
00299             enc = encDef;
00300             fg.RGB = fgDef.RGB;
00301             bg.RGB = bgDef.RGB;
00302             cp = cpDef;
00303             break;
00304
00305         // client extensions
00306         case 'X':
00307             //  no extensions are defined at this time.
00308             /*
00309             parseFrmChar++;
00310             switch (line->at(parseFrmChar)) {
00311             case '':
00312             default:
00313                  rollback to show the error.
00314                 parseFrmChar -= 2;
00315             }
00316             */
00317             parseFrmChar--;
00318             break;
00319
00320         // error condition...
00321         default:
00322             // rollback one.  unrecognized format specifier.
00323             parseFrmChar--;
00324         }
00325
00326         // extra params? include them in the text surrounded by "[ ]"
00327         // (This is recommended, in case someone chooses to "hide" a
00328         //    message by doing "^FNsell yoyodyne stocks!^F" -- this code
00329         //    effectively "unhides" it, and is [yet again] recommended
00330         //    by the CTCP2 draft.)
00331
00332         parseFrmChar++;
00333         if (parseFrmChar < parseEndChar)
00334         {
00335             line->replace(parseFrmChar, parseEndChar - parseFrmChar,
00336                 std::string("\006[") +
00337                 line->substr(parseFrmChar, parseEndChar-parseFrmChar) +
00338                 std::string("]"));
00339
00340             parseEndChar = parseFrmChar;
00341         }
00342
00343         // save old end position
00344         parseStart = parseEndChar+1;
00345
00346         // got any more?
00347         parseFrmChar = line->find_first_of("\006", parseStart);
00348     };
00349
00350
00351
00352     // anything left?
00353     if (parseStart < line->length())
00354     {
00355         // last text segment is ready to push.
00356         segment = new std::string(line->substr(parseStart));
00357         PushOut();
00358         delete segment;
00359     }
00360 };

virtual void CTCP2Parse::PushBackgroundColor | ( | unsigned char | R,
 |  | unsigned char | G,
 |  | unsigned char | B
 | ) | [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushBlink ( bool ) [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushBold ( bool ) [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushEncoding ( EncodingType ) [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushFontSize ( int ) [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushForegroundColor | ( | unsigned char | R,
 |  | unsigned char | G,
 |  | unsigned char | B
 | ) | [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushItalic ( bool ) [protected, pure virtual]

Referenced by PushOut().

void CTCP2Parse::PushOut ( void ) [inline, private]

Definition at line 275 of file CTCP2Parse.hpp.

Referenced by ParseIt().

00276     {
00277         // notify the derived class, we are about to start a new attribute set.
00278         PushStart();
00279
00280         // never push-out ALL the attributes -- only the CHANGED ones.
00281
00282         if ((boldCnt > 0) ^ boldLast) PushBold (boldLast = !boldLast ? true : false);
00283         if ((revCnt > 0) ^ revLast) PushReverse (revLast = !revLast ? true : false);
00284         if ((underCnt > 0) ^ underLast) PushUnderline (underLast = !underLast ? true : false);
00285         if ((overCnt > 0) ^ overLast) PushOverstrike (overLast = !overLast ? true : false);
00286         if ((italicCnt > 0) ^ italicLast) PushItalic (italicLast = !italicLast ? true : false);
00287         if ((blinkCnt > 0) ^ blinkLast) PushBlink (blinkLast = !blinkLast ? true : false);
00288         if ((urlCnt > 0) ^ urlLast) PushURL (urlLast = !urlLast ? true : false);
00289         if (enc ^ encLast) PushEncoding (encLast = enc);
00290         if (cp ^ cpLast) PushSpacing (cpLast = cp);
00291         if (fntSize ^ fntLast) PushFontSize (fntLast = fntSize);
00292
00293         if (fg.RGB ^ fgLast.RGB)
00294         {
00295             fgLast.RGB = fg.RGB;
00296             PushForegroundColor(fg.R, fg.G, fg.B);
00297         }
00298         if (bg.RGB ^ bgLast.RGB)
00299         {
00300             bgLast.RGB = bg.RGB;
00301             PushBackgroundColor(bg.R, bg.G, bg.B);
00302         }
00303
00304         PushTextSegment(segment);
00305     }

virtual void CTCP2Parse::PushOverstrike ( bool ) [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushReverse ( bool ) [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushSpacing ( CharSpacingType ) [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushStart ( ) [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushTextSegment ( std::string * ) [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushURL ( bool ) [protected, pure virtual]

Referenced by PushOut().

virtual void CTCP2Parse::PushUnderline ( bool ) [protected, pure virtual]

Referenced by PushOut().

void CTCP2Parse::SetDefaults | ( | unsigned char | fgR = (unsigned char) ((Lt_Grey & 0xFF0000) >> 16),
 |  | unsigned char | fgG = (unsigned char) ((Lt_Grey & 0x00FF00) >> 8),
 |  | unsigned char | fgB = (unsigned char) (Lt_Grey & 0x0000FF),
 |  | unsigned char | bgR = (unsigned char) ((Black & 0xFF0000) >> 16),
 |  | unsigned char | bgG = (unsigned char) ((Black & 0x00FF00) >> 8),
 |  | unsigned char | bgB = (unsigned char) (Black & 0x0000FF),
 |  | CharSpacingType | cpDef_ = Fixed,
 |  | EncodingType | encDef_ = iso8859_1
 | ) | [protected]

Definition at line 44 of file CTCP2Parse.cpp.

00049 {
00050
00051     // reassemble the seperate RGB values into our internal rep.
00052
00053     fg.R = fgLast.R = fgDef.R = fgR;
00054     fg.G = fgLast.G = fgDef.G = fgG;
00055     fg.B = fgLast.B = fgDef.B = fgB;
00056
00057     bg.R = bgLast.R = bgDef.R = bgR;
00058     bg.G = bgLast.G = bgDef.G = bgG;
00059     bg.B = bgLast.B = bgDef.B = bgB;
00060
00061     cp = cpLast = cpDef = cpDef_;
00062     enc = encLast = encDef = encDef_;
00063 }

int CTCP2Parse::decodeColor | ( | std::string * | line,
 |  | int * | parseFrmChar,
 |  | int * | parseEndChar,
 |  | RGBColor * | c
 | ) | [inline, private]

Definition at line 212 of file CTCP2Parse.hpp.

Referenced by ParseIt().

00213     {
00214         if (line->at(*parseFrmChar) == '#')
00215         {
00216             (*parseFrmChar)++;   // consume it
00217             if (*parseFrmChar + 6 <= *parseEndChar)
00218             {
00219                 unsigned char C = 0;
00220
00221                 c->RGB = 0;     // start with a clean plate
00222
00223                 // hi-byte red
00224                 if (!fromHex(line->at(*parseFrmChar), &C)) return 3;
00225                 (*parseFrmChar)++;  // consume the hex character
00226                 c->R |= (C << 4);
00227
00228                 // lo-byte red
00229                 if (!fromHex(line->at(*parseFrmChar), &C)) return 4;
00230                 (*parseFrmChar)++;  // consume the hex character
00231                 c->R |= C;
00232
00233                 // hi-byte green
00234                 if (!fromHex(line->at(*parseFrmChar), &C)) return 5;
00235                 (*parseFrmChar)++;  // consume the hex character
00236                 c->G |= (C << 4);
00237
00238                 // lo-byte green
00239                 if (!fromHex(line->at(*parseFrmChar), &C)) return 6;
00240                 (*parseFrmChar)++;  // consume the hex character
00241                 c->G |= C;
00242
00243                 // hi-byte blue
00244                 if (!fromHex(line->at(*parseFrmChar), &C)) return 7;
00245                 (*parseFrmChar)++;  // consume the hex character
00246                 c->B |= (C << 4);
00247
00248                 // lo-byte blue
00249                 if (!fromHex(line->at(*parseFrmChar), &C)) return 8;
00250                 (*parseFrmChar)++;  // consume the hex character
00251                 c->B |= C;
00252             } else {
00253                 // rollback the error...
00254                 return 3;
00255             }
00256         } else {
00257             unsigned char index = 0;
00258             if (!fromHex(line->at(*parseFrmChar), &index)) return 3;
00259             (*parseFrmChar)++;  // consume the hex character
00260             c->RGB = indexColor[index].RGB;
00261         }
00262         return 0;
00263     }

void CTCP2Parse::decodeToggle | ( | std::string * | line,
 |  | int * | parseFrmChar,
 |  | int * | parseEndChar,
 |  | int * | varCnt
 | ) | [inline, private]

Definition at line 190 of file CTCP2Parse.hpp.

00191     {
00192         (*parseFrmChar)++;   // consume the attribute
00193         if (*parseFrmChar < *parseEndChar)
00194         {
00195             if (line->at(*parseFrmChar) == '+')
00196             {
00197                 (*varCnt)++;
00198                 (*parseFrmChar)++;   // consume the '+'
00199             }
00200             else if (line->at(*parseFrmChar) == '-')
00201             {
00202                 if ((*varCnt) > 0)
00203                     (*varCnt)--;
00204                 (*parseFrmChar)++;   // consume the '-'
00205             }
00206         }
00207         else
00208             (*varCnt)++;  // default to a '+'
00209     }

int CTCP2Parse::fromHex | ( | unsigned char | h,
 |  | unsigned char * | val
 | ) | [inline, private]

Definition at line 265 of file CTCP2Parse.hpp.

Referenced by decodeColor().

00266     {
00267         // 0 - 9
00268         if (h > 47 && h < 58) *val = (h - 48);
00269         // A - F
00270         else if (h > 64 && h < 71) *val = (h - 55);
00271         else return 0;   // throw a little conversion exception
00272         return 1;
00273     }

Member Data Documentation

RGBColor CTCP2Parse::bg [private]

Definition at line 317 of file CTCP2Parse.hpp.

RGBColor CTCP2Parse::bgDef [private]

Definition at line 317 of file CTCP2Parse.hpp.

RGBColor CTCP2Parse::bgLast [private]

Definition at line 317 of file CTCP2Parse.hpp.

int CTCP2Parse::blinkCnt [private]

Definition at line 311 of file CTCP2Parse.hpp.

int CTCP2Parse::blinkLast [private]

Definition at line 312 of file CTCP2Parse.hpp.

int CTCP2Parse::boldCnt [private]

Definition at line 311 of file CTCP2Parse.hpp.

int CTCP2Parse::boldLast [private]

Definition at line 312 of file CTCP2Parse.hpp.

CharSpacingType CTCP2Parse::cp [private]

Definition at line 315 of file CTCP2Parse.hpp.

CharSpacingType CTCP2Parse::cpDef [private]

Definition at line 315 of file CTCP2Parse.hpp.

CharSpacingType CTCP2Parse::cpLast [private]

Definition at line 315 of file CTCP2Parse.hpp.

EncodingType CTCP2Parse::enc [private]

Definition at line 308 of file CTCP2Parse.hpp.

EncodingType CTCP2Parse::encDef [private]

Definition at line 308 of file CTCP2Parse.hpp.

EncodingType CTCP2Parse::encLast [private]

Definition at line 308 of file CTCP2Parse.hpp.

RGBColor CTCP2Parse::fg [private]

Definition at line 317 of file CTCP2Parse.hpp.

RGBColor CTCP2Parse::fgDef [private]

Definition at line 317 of file CTCP2Parse.hpp.

RGBColor CTCP2Parse::fgLast [private]

Definition at line 317 of file CTCP2Parse.hpp.

int CTCP2Parse::fntLast [private]

Definition at line 313 of file CTCP2Parse.hpp.

int CTCP2Parse::fntSize [private]

Definition at line 313 of file CTCP2Parse.hpp.

const CTCP2Parse::RGBColor CTCP2Parse::indexColor [static, private]

Initial value:

 {
    Black, Blue, Green, Cyan, Red, Magenta, Yellow, Lt_Grey, Grey,
    Lt_Blue, Lt_Green, Lt_Cyan, Lt_Red, Lt_Magenta, Lt_Yellow, White
}

Definition at line 362 of file CTCP2Parse.cpp.

int CTCP2Parse::italicCnt [private]

Definition at line 311 of file CTCP2Parse.hpp.

int CTCP2Parse::italicLast [private]

Definition at line 312 of file CTCP2Parse.hpp.

int CTCP2Parse::overCnt [private]

Definition at line 311 of file CTCP2Parse.hpp.

int CTCP2Parse::overLast [private]

Definition at line 312 of file CTCP2Parse.hpp.

int CTCP2Parse::revCnt [private]

Definition at line 311 of file CTCP2Parse.hpp.

int CTCP2Parse::revLast [private]

Definition at line 312 of file CTCP2Parse.hpp.

std::string* CTCP2Parse::segment [private]

Definition at line 319 of file CTCP2Parse.hpp.

int CTCP2Parse::underCnt [private]

Definition at line 311 of file CTCP2Parse.hpp.

int CTCP2Parse::underLast [private]

Definition at line 312 of file CTCP2Parse.hpp.

int CTCP2Parse::urlCnt [private]

Definition at line 311 of file CTCP2Parse.hpp.

int CTCP2Parse::urlLast [private]

Definition at line 312 of file CTCP2Parse.hpp.

The documentation for this class was generated from the following files:
  • common/CTCP2Parse.hpp
  • common/CTCP2Parse.cpp
Generated on Sun Oct 21 12:50:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTCP2Parse::RGBColor Struct Reference

Collaboration diagram for CTCP2Parse::RGBColor:

[legend]
List of all members.

Member Data Documentation

unsigned char CTCP2Parse::RGBColor::B

Definition at line 184 of file CTCP2Parse.hpp.

Referenced by CTCP2Parse::ParseIt(), CTCP2Parse::PushOut(), and CTCP2Parse::SetDefaults().

unsigned char CTCP2Parse::RGBColor::G

Definition at line 183 of file CTCP2Parse.hpp.

Referenced by CTCP2Parse::ParseIt(), CTCP2Parse::PushOut(), and CTCP2Parse::SetDefaults().

unsigned char CTCP2Parse::RGBColor::R

Definition at line 182 of file CTCP2Parse.hpp.

Referenced by CTCP2Parse::ParseIt(), CTCP2Parse::PushOut(), and CTCP2Parse::SetDefaults().

__int32 CTCP2Parse::RGBColor::RGB

Definition at line 172 of file CTCP2Parse.hpp.

Referenced by CTCP2Parse::CTCP2Parse(), CTCP2Parse::ParseIt(), CTCP2Parse::PushOut(), and CTCP2Parse::decodeColor().

unsigned char CTCP2Parse::RGBColor::nul_void_ignore

Definition at line 181 of file CTCP2Parse.hpp.

The documentation for this struct was generated from the following file:
  • common/CTCP2Parse.hpp
Generated on Sun Oct 21 12:50:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TEditText Class Reference

Inheritance diagram for TEditText:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/macapp/UPseudoSupport.h
Generated on Sun Oct 21 12:50:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTempToggleBool Class Reference

Collaboration diagram for CTempToggleBool:

[legend]
List of all members.

Public Methods

CTempToggleBool (bool &value)
~CTempToggleBool ()

Protected Attributes

bool & | m_value
bool | m_didSetIt

Constructor & Destructor Documentation

CTempToggleBool::CTempToggleBool ( bool & value ) [inline]

Definition at line 148 of file UCvsFolders.cpp.

00148                                   : m_value(value), m_didSetIt(false)
00149     {
00150         if(!m_value)
00151         {
00152             m_didSetIt = true;
00153             m_value = true;
00154         }
00155     }

CTempToggleBool::~CTempToggleBool ( ) [inline]

Definition at line 157 of file UCvsFolders.cpp.

00158     {
00159         if(m_didSetIt)
00160             m_value = false;
00161     }

Member Data Documentation

bool CTempToggleBool::m_didSetIt [protected]

Definition at line 164 of file UCvsFolders.cpp.

bool& CTempToggleBool::m_value [protected]

Definition at line 163 of file UCvsFolders.cpp.

The documentation for this class was generated from the following file:
  • common/UCvsFolders.cpp
Generated on Sun Oct 21 12:50:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TGraph Class Reference

Inheritance diagram for TGraph:

[legend]
List of all members.

Public Methods

kTGraph TraverseGraph (CLogNode *node)
virtual kTGraph TraverseNode (CLogNode *node)=0

Member Function Documentation

kTGraph TGraph::TraverseGraph ( CLogNode * node )

Definition at line 920 of file GraphView.cpp.

Referenced by CGraphView::IsSelSingleNode(), CGraphView::OnContextMenu(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnQueryAnnotate(), CGraphView::OnUpdateViewDelrev(), CGraphView::OnUpdateViewDiff(), CGraphView::OnUpdateViewTag(), CGraphView::OnViewDelrev(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewRetrieve(), CGraphView::OnViewSelnonsig(), CGraphView::OnViewTag(), and CGraphView::OnViewUnlockf().

00921 {
00922     kTGraph res;
00923
00924     res = TraverseNode(node);
00925     if(res == kTStop)
00926         return kTStop;
00927
00928     if(res == kTGetDown)
00929     {
00930         vector<CLogNode *>::iterator i;
00931         for(i = node->Childs().begin(); i != node->Childs().end(); ++i)
00932         {
00933             res = TraverseGraph(*i);
00934             if(res == kTStop)
00935                 return kTStop;
00936         }
00937     }
00938
00939     if(node->Next() != 0L)
00940     {
00941         res = TraverseGraph(node->Next());
00942         if(res == kTStop)
00943             return kTStop;
00944     }
00945
00946     return kTContinue;
00947 };

virtual kTGraph TGraph::TraverseNode ( CLogNode * node ) [pure virtual]

Reimplemented in TGraphRectSelect, TGraphCmdStatus, TGraphDelCmd, and TGraphSelNonSig.

Referenced by TraverseGraph().

The documentation for this class was generated from the following file:
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:50:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TGraphCmdStatus Class Reference

Inheritance diagram for TGraphCmdStatus:

[legend]
Collaboration diagram for TGraphCmdStatus:

[legend]
List of all members.

Public Methods

TGraphCmdStatus ()
virtual kTGraph | TraverseNode (CLogNode *node)

Public Attributes

CWinLogData * fSel1
CWinLogData * fSel2
int | fCountSel

Constructor & Destructor Documentation

TGraphCmdStatus::TGraphCmdStatus ( ) [inline]

Definition at line 1052 of file GraphView.cpp.

01052                       :
01053         fSel1(0L), fSel2(0L), fCountSel(0) {}

Member Function Documentation

virtual kTGraph TGraphCmdStatus::TraverseNode ( CLogNode * node ) [inline, virtual]

Reimplemented from TGraph.

Definition at line 1055 of file GraphView.cpp.

01056     {
01057         CWinLogData *data = (CWinLogData *)node->GetUserData();
01058
01059         if(data->Selected())
01060         {
01061             if(fSel1 == 0L)
01062                 fSel1 = data;
01063             else if(fSel2 == 0L)
01064                 fSel2 = data;
01065             fCountSel++;
01066         }
01067
01068         return kTGetDown;
01069     }

Member Data Documentation

int TGraphCmdStatus::fCountSel

Definition at line 1073 of file GraphView.cpp.

Referenced by CGraphView::IsSelSingleNode(), CGraphView::OnContextMenu(), CGraphView::OnUpdateViewDiff(), CGraphView::OnUpdateViewTag(), and CGraphView::OnViewDiff().

CWinLogData* TGraphCmdStatus::fSel1

Definition at line 1071 of file GraphView.cpp.

Referenced by CGraphView::IsSelSingleNode(), CGraphView::OnContextMenu(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnQueryAnnotate(), CGraphView::OnUpdateViewDiff(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewRetrieve(), CGraphView::OnViewTag(), and CGraphView::OnViewUnlockf().

CWinLogData* TGraphCmdStatus::fSel2

Definition at line 1072 of file GraphView.cpp.

Referenced by CGraphView::OnUpdateViewDiff(), and CGraphView::OnViewDiff().

The documentation for this class was generated from the following file:
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:50:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TGraphDelCmd Class Reference

Inheritance diagram for TGraphDelCmd:

[legend]
Collaboration diagram for TGraphDelCmd:

[legend]
List of all members.

Public Methods

TGraphDelCmd ()
virtual kTGraph | TraverseNode (CLogNode *node)

Public Attributes

int | fCountSel
bool | fOnlyRev
std::vector< UStr > fAllRevs

Constructor & Destructor Documentation

TGraphDelCmd::TGraphDelCmd ( ) [inline]

Definition at line 1386 of file GraphView.cpp.

01386                    :
01387         fCountSel(0), fOnlyRev(true) {}

Member Function Documentation

virtual kTGraph TGraphDelCmd::TraverseNode ( CLogNode * node ) [inline, virtual]

Reimplemented from TGraph.

Definition at line 1389 of file GraphView.cpp.

01390     {
01391         CWinLogData *data = (CWinLogData *)node->GetUserData();
01392
01393         if(data->Selected())
01394         {
01395             if(data->GetType() != kNodeRev)
01396                 fOnlyRev = false;
01397             else
01398                 fAllRevs.push_back(CStr(data->GetStr()));
01399             fCountSel++;
01400         }
01401
01402         return kTGetDown;
01403     }

Member Data Documentation

std::vector< UStr > TGraphDelCmd::fAllRevs

Definition at line 1407 of file GraphView.cpp.

Referenced by CGraphView::OnViewDelrev().

int TGraphDelCmd::fCountSel

Definition at line 1405 of file GraphView.cpp.

Referenced by CGraphView::OnUpdateViewDelrev().

bool TGraphDelCmd::fOnlyRev

Definition at line 1406 of file GraphView.cpp.

Referenced by CGraphView::OnUpdateViewDelrev().

The documentation for this class was generated from the following file:
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:50:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TGraphRectSelect Class Reference

Inheritance diagram for TGraphRectSelect:

[legend]
Collaboration diagram for TGraphRectSelect:

[legend]
List of all members.

Public Methods

TGraphRectSelect (bool shiftOn, CGraphView *view, CRect &r)
virtual kTGraph | TraverseNode (CLogNode *node)

Protected Attributes

bool | mShiftOn
CGraphView * mView
CRect & | mR

Constructor & Destructor Documentation

TGraphRectSelect::TGraphRectSelect | ( | bool | shiftOn,
 |  | CGraphView * | view,
 |  | CRect & | r
 | ) | [inline]

Definition at line 952 of file GraphView.cpp.

00952                                                                 :
00953         mShiftOn(shiftOn), mView(view), mR(r) {}

Member Function Documentation

virtual kTGraph TGraphRectSelect::TraverseNode ( CLogNode * node ) [inline, virtual]

Reimplemented from TGraph.

Definition at line 955 of file GraphView.cpp.

00956     {
00957         CWinLogData *data = (CWinLogData *)node->GetUserData();
00958
00959         // no need to go further
00960         CRect inter;
00961         if(!inter.IntersectRect(mR, data->Bounds()))
00962         {
00963             return kTContinue;
00964         }
00965         // self enclosed in the tracker ?
00966         CRect & b = data->SelfBounds();
00967         if(mR.PtInRect(b.TopLeft()) && mR.PtInRect(b.BottomRight()))
00968         {
00969             if(!mShiftOn)
00970             {
00971                 if(!data->Selected())
00972                     data->SetSelected(mView, true);
00973             }
00974             else
00975                 data->SetSelected(mView, !data->Selected());
00976         }
00977         // traverse childrens
00978         return kTGetDown;
00979     }

Member Data Documentation

CRect& TGraphRectSelect::mR [protected]

Definition at line 984 of file GraphView.cpp.

bool TGraphRectSelect::mShiftOn [protected]

Definition at line 982 of file GraphView.cpp.

CGraphView* TGraphRectSelect::mView [protected]

Definition at line 983 of file GraphView.cpp.

The documentation for this class was generated from the following file:
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:50:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TGraphSelNonSig Class Reference

Inheritance diagram for TGraphSelNonSig:

[legend]
Collaboration diagram for TGraphSelNonSig:

[legend]
List of all members.

Public Methods

TGraphSelNonSig (CGraphView *view)
virtual kTGraph TraverseNode (CLogNode *node)

Public Attributes

CGraphView * fView

Constructor & Destructor Documentation

TGraphSelNonSig::TGraphSelNonSig ( CGraphView * view ) [inline]

Definition at line 1469 of file GraphView.cpp.

01469                                       : fView(view)
01470     {
01471     }

Member Function Documentation

virtual kTGraph TGraphSelNonSig::TraverseNode ( CLogNode * node ) [inline, virtual]

Reimplemented from TGraph.

Definition at line 1473 of file GraphView.cpp.

01474     {
01475         CWinLogData *data = (CWinLogData *)node->GetUserData();
01476
01477         if(data->GetType() == kNodeRev)
01478         {
01479             if(node->Next() != 0L && node->Childs().size() == 0)
01480                 data->SetSelected(fView, true);
01481         }
01482
01483         return kTGetDown;
01484     }

Member Data Documentation

CGraphView* TGraphSelNonSig::fView

Definition at line 1486 of file GraphView.cpp.

The documentation for this class was generated from the following file:
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:50:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TIconButton Class Reference

Inheritance diagram for TIconButton:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/macapp/UPseudoSupport.h
Generated on Sun Oct 21 12:50:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TIconCheckBox Class Reference

Inheritance diagram for TIconCheckBox:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/macapp/UPseudoSupport.h
Generated on Sun Oct 21 12:50:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TIconPopup Class Reference

Inheritance diagram for TIconPopup:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/macapp/UPseudoSupport.h
Generated on Sun Oct 21 12:50:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


timeb Struct Reference

#include <system.h>

Collaboration diagram for timeb:

[legend]
List of all members.

Public Attributes

time_t | time
unsigned short | millitm
short | timezone
short | dstflag

Member Data Documentation

short timeb::dstflag

Definition at line 189 of file system.h.

unsigned short timeb::millitm

Definition at line 187 of file system.h.

time_t timeb::time

Definition at line 186 of file system.h.

Referenced by get_date().

short timeb::timezone

Definition at line 188 of file system.h.

Referenced by get_date().

The documentation for this struct was generated from the following files:
  • cvs-1.10/lib/getdate.c
  • cvs-1.10/lib/system.h
Generated on Sun Oct 21 12:50:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UTimer Class Reference

used by the UWidget class to implement timers/repeaters. More...

#include <uwidget.h>

Collaboration diagram for UTimer:

[legend]
List of all members.

Public Methods

UTimer (int lap, int lastlap, int cmd)
UTimer ()
UTimer (const UTimer &src)
UTimer & | operator= (const UTimer &src)

Public Attributes

long | m_lap
long | m_lastlap
int | m_cmd

Detailed Description

used by the UWidget class to implement timers/repeaters.

Definition at line 55 of file uwidget.h.

Constructor & Destructor Documentation

UTimer::UTimer | ( | int | lap,
 |  | int | lastlap,
 |  | int | cmd
 | ) | [inline]

Definition at line 58 of file uwidget.h.

00058 : m_lap(lap), m_lastlap(lastlap), m_cmd(cmd) {}

UTimer::UTimer ( ) [inline]

Definition at line 59 of file uwidget.h.

00059 : m_lap(0), m_lastlap(0), m_cmd(0) {}

UTimer::UTimer ( const UTimer & src ) [inline]

Definition at line 60 of file uwidget.h.

00060 : m_lap(src.m_lap), m_lastlap(src.m_lastlap), m_cmd(src.m_cmd) {}

Member Function Documentation

UTimer& UTimer::operator= ( const UTimer & src ) [inline]

Definition at line 62 of file uwidget.h.

00063     {
00064         m_lastlap = src.m_lastlap;
00065         m_lap = src.m_lap;
00066         m_cmd = src.m_cmd;
00067
00068         return *this;
00069     }

Member Data Documentation

int UTimer::m_cmd

Definition at line 72 of file uwidget.h.

Referenced by UEventGiveTime(), and operator=().

long UTimer::m_lap

Definition at line 70 of file uwidget.h.

Referenced by UEventGiveTime(), and operator=().

long UTimer::m_lastlap

Definition at line 71 of file uwidget.h.

Referenced by UEventGiveTime(), and operator=().

The documentation for this class was generated from the following file:
  • rf/uwidget.h
Generated on Sun Oct 21 12:50:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTipDlg Class Reference

#include <TipDlg.h>

Inheritance diagram for CTipDlg:

[legend]
Collaboration diagram for CTipDlg:

[legend]
List of all members.

Public Methods

CTipDlg (CWnd *pParent=NULL)
virtual | ~CTipDlg ()

Public Attributes

BOOL | m_bStartup
CString | m_strTip
FILE * | m_pStream

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnNextTip ()
afx_msg HBRUSH | OnCtlColor (CDC *pDC, CWnd *pWnd, UINT nCtlColor)
virtual void | OnOK ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnPaint ()
void | GetNextTipString (CString &strNext)

Constructor & Destructor Documentation

CTipDlg::CTipDlg ( CWnd * pParent = NULL )

Definition at line 29 of file TipDlg.cpp.

00030     : CDialog(IDD_TIP, pParent)
00031 {
00032     //{{AFX_DATA_INIT(CTipDlg)
00033     m_bStartup = TRUE;
00034     //}}AFX_DATA_INIT
00035
00036     // We need to find out what the startup and file position parameters are
00037     // If startup does not exist, we assume that the Tips on startup is checked TRUE.
00038     CWincvsApp* pApp = (CWincvsApp *)AfxGetApp();
00039     m_bStartup = !pApp->GetProfileInt(szSection, szIntStartup, 0);
00040     UINT iFilePos = pApp->GetProfileInt(szSection, szIntFilePos, 0);
00041     CStr tips;
00042     pApp->GetAppPath(tips);
00043     if(!tips.empty() && !tips.endsWith(kPathDelimiter))
00044     {
00045         tips << kPathDelimiter;
00046     }
00047     tips << "tips.txt";
00048
00049     // Now try to open the tips file
00050     m_pStream = fopen(tips, "r");
00051 #if qCvsDebug
00052     if(m_pStream == 0L)
00053         m_pStream = fopen("c:\\cvsgui\\wincvs\\hlp\\tips.txt", "r");
00054     if(m_pStream == 0L)
00055         m_pStream = fopen("d:\\cvsgui\\wincvs\\hlp\\tips.txt", "r");
00056     if(m_pStream == 0L)
00057         m_pStream = fopen("e:\\cvsgui\\wincvs\\hlp\\tips.txt", "r");
00058     if(m_pStream == 0L)
00059         m_pStream = fopen("f:\\cvsgui\\wincvs\\hlp\\tips.txt", "r");
00060 #endif
00061     if (m_pStream == NULL)
00062     {
00063         m_strTip.LoadString(CG_IDS_FILE_ABSENT);
00064         return;
00065     }
00066
00067     // If the timestamp in the INI file is different from the timestamp of
00068     // the tips file, then we know that the tips file has been modified
00069     // Reset the file position to 0 and write the latest timestamp to the
00070     // ini file
00071     struct _stat buf;
00072     _fstat(_fileno(m_pStream), &buf);
00073     CString strCurrentTime = ctime(&buf.st_ctime);
00074     strCurrentTime.TrimRight();
00075     CString strStoredTime =
00076         pApp->GetProfileString(szSection, szTimeStamp, NULL);
00077     if (strCurrentTime != strStoredTime)
00078     {
00079         iFilePos = 0;
00080         pApp->WriteProfileString(szSection, szTimeStamp, strCurrentTime);
00081     }
00082
00083     if (fseek(m_pStream, iFilePos, SEEK_SET) != 0)
00084     {
00085         AfxMessageBox(CG_IDP_FILE_CORRUPT);
00086     }
00087     else
00088     {
00089         GetNextTipString(m_strTip);
00090     }
00091 }

CTipDlg::~CTipDlg ( ) [virtual]

Definition at line 93 of file TipDlg.cpp.

00094 {
00095     // This destructor is executed whether the user had pressed the escape key
00096     // or clicked on the close button. If the user had pressed the escape key,
00097     // it is still required to update the filepos in the ini file with the
00098     // latest position so that we don't repeat the tips!
00099
00100     // But make sure the tips file existed in the first place....
00101     if (m_pStream != NULL)
00102     {
00103         CWinApp* pApp = AfxGetApp();
00104         pApp->WriteProfileInt(szSection, szIntFilePos, ftell(m_pStream));
00105         fclose(m_pStream);
00106     }
00107 }

Member Function Documentation

void CTipDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 109 of file TipDlg.cpp.

00110 {
00111     CDialog::DoDataExchange(pDX);
00112     //{{AFX_DATA_MAP(CTipDlg)
00113     DDX_Check(pDX, IDC_STARTUP, m_bStartup);
00114     DDX_Text(pDX, IDC_TIPSTRING, m_strTip);
00115     //}}AFX_DATA_MAP
00116 }

void CTipDlg::GetNextTipString ( CString & strNext ) [protected]

Definition at line 135 of file TipDlg.cpp.

Referenced by CTipDlg().

00136 {
00137     LPTSTR lpsz = strNext.GetBuffer(MAX_BUFLEN);
00138
00139     // This routine identifies the next string that needs to be
00140     // read from the tips file
00141     BOOL bStop = FALSE;
00142     while (!bStop)
00143     {
00144         if (_fgetts(lpsz, MAX_BUFLEN, m_pStream) == NULL)
00145         {
00146             // We have either reached EOF or enocuntered some problem
00147             // In both cases reset the pointer to the beginning of the file
00148             // This behavior is same as VC++ Tips file
00149             if (fseek(m_pStream, 0, SEEK_SET) != 0)
00150                 AfxMessageBox(CG_IDP_FILE_CORRUPT);
00151         }
00152         else
00153         {
00154             if (*lpsz != ' ' && *lpsz != '\t' &&
00155                 *lpsz != '\n' && *lpsz != ';')
00156             {
00157                 // There should be no space at the beginning of the tip
00158                 // This behavior is same as VC++ Tips file
00159                 // Comment lines are ignored and they start with a semicolon
00160                 bStop = TRUE;
00161             }
00162         }
00163     }
00164     strNext.ReleaseBuffer();
00165 }

HBRUSH CTipDlg::OnCtlColor | ( | CDC * | pDC,
 |  | CWnd * | pWnd,
 |  | UINT | nCtlColor
 | ) | [protected]

Definition at line 167 of file TipDlg.cpp.

00168 {
00169     if (pWnd->GetDlgCtrlID() == IDC_TIPSTRING)
00170         return (HBRUSH)GetStockObject(WHITE_BRUSH);
00171
00172     return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
00173 }

BOOL CTipDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 184 of file TipDlg.cpp.

00185 {
00186     CDialog::OnInitDialog();
00187
00188     // If Tips file does not exist then disable NextTip
00189     if (m_pStream == NULL)
00190         GetDlgItem(IDC_NEXTTIP)->EnableWindow(FALSE);
00191
00192     return TRUE;  // return TRUE unless you set the focus to a control
00193 }

void CTipDlg::OnNextTip ( ) [protected]

Definition at line 129 of file TipDlg.cpp.

00130 {
00131     GetNextTipString(m_strTip);
00132     UpdateData(FALSE);
00133 }

void CTipDlg::OnOK ( void ) [protected, virtual]

Definition at line 175 of file TipDlg.cpp.

00176 {
00177     CDialog::OnOK();
00178
00179     // Update the startup information stored in the INI file
00180     CWinApp* pApp = AfxGetApp();
00181     pApp->WriteProfileInt(szSection, szIntStartup, !m_bStartup);
00182 }

void CTipDlg::OnPaint ( ) [protected]

Definition at line 195 of file TipDlg.cpp.

00196 {
00197     CPaintDC dc(this); // device context for painting
00198
00199     // Get paint area for the big static control
00200     CWnd* pStatic = GetDlgItem(IDC_BULB);
00201     CRect rect;
00202     pStatic->GetWindowRect(&rect);
00203     ScreenToClient(&rect);
00204
00205     // Paint the background white.
00206     CBrush brush;
00207     brush.CreateStockObject(WHITE_BRUSH);
00208     dc.FillRect(rect, &brush);
00209
00210     // Load bitmap and get dimensions of the bitmap
00211     CBitmap bmp;
00212     bmp.LoadBitmap(IDB_LIGHTBULB);
00213     BITMAP bmpInfo;
00214     bmp.GetBitmap(&bmpInfo);
00215
00216     // Draw bitmap in top corner and validate only top portion of window
00217     CDC dcTmp;
00218     dcTmp.CreateCompatibleDC(&dc);
00219     dcTmp.SelectObject(&bmp);
00220     rect.bottom = bmpInfo.bmHeight + rect.top;
00221     dc.BitBlt(rect.left, rect.top, rect.Width(), rect.Height(),
00222         &dcTmp, 0, 0, SRCCOPY);
00223
00224     // Draw out "Did you know..." message next to the bitmap
00225     CString strMessage;
00226     strMessage.LoadString(CG_IDS_DIDYOUKNOW);
00227     rect.left += bmpInfo.bmWidth;
00228     dc.DrawText(strMessage, rect, DT_VCENTER | DT_SINGLELINE);
00229
00230     // Do not call CDialog::OnPaint() for painting messages
00231 }

Member Data Documentation

BOOL CTipDlg::m_bStartup

Definition at line 18 of file TipDlg.h.

FILE* CTipDlg::m_pStream

Definition at line 22 of file TipDlg.h.

CString CTipDlg::m_strTip

Definition at line 19 of file TipDlg.h.

The documentation for this class was generated from the following files:
  • WinCvs/TipDlg.h
  • WinCvs/TipDlg.cpp
Generated on Sun Oct 21 12:50:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TemplateTMPersistent class Reference

TMPersistent Class Template Reference

#include <MultiString.h>

Inheritance diagram for TMPersistent:

[legend]
Collaboration diagram for TMPersistent:

[legend]
List of all members.

Public Types

typedef ::vector< T > | list_t

Public Methods

TMPersistent (const char *uniqueName, kClassPersistent pclass=kNoClass)
virtual | ~TMPersistent ()
virtual unsigned int | SizeOf (void) const
virtual const void * | GetData (void) const
virtual void | SetData (const void *ptr, unsigned int size)
const list_t & | GetList (void) const
list_t & | GetList (void)

Protected Attributes

list_t fAllItems
CStaticAllocT< char > | fBuf

template<class T>
class TMPersistent< T >

Member Typedef Documentation

template<class T>
typedef :: vector<T> TMPersistent::list_t

Definition at line 45 of file MultiString.h.

Constructor & Destructor Documentation

template<class T>
TMPersistent< T >::TMPersistent | ( | const char * | uniqueName,
 |  | kClassPersistent | pclass = kNoClass
 | ) | [inline]

Definition at line 47 of file MultiString.h.

00048     : CPersistent(uniqueName, pclass) {};

template<class T>
virtual TMPersistent< T >::~TMPersistent ( ) [inline, virtual]

Definition at line 50 of file MultiString.h.

00050 {};

Member Function Documentation

template<class T>
virtual const void* TMPersistent< T >::GetData ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 53 of file MultiString.h.

00054         {
00055             fBuf.AdjustSize(SizeOf());
00056             char *tmp = fBuf;
00057             *(int *) tmp = fAllItems.size();
00058             tmp += sizeof(int) / sizeof(char);
00059
00060             for(list_t::const_iterator i = fAllItems.begin(); i != fAllItems.end(); ++i)
00061             {
00062                 memcpy(tmp, (const char *)(&*i), sizeof (T));
00063                 tmp += sizeof (T);
00064             }
00065
00066             return (char *)fBuf;
00067         };

template<class T>
list_t& TMPersistent< T >::GetList ( void ) [inline]

Definition at line 84 of file MultiString.h.

00084 { return fAllItems; }

template<class T>
const list_t& TMPersistent< T >::GetList ( void ) const [inline]

Definition at line 83 of file MultiString.h.

00083 { return fAllItems; }

template<class T>
virtual void TMPersistent< T >::SetData | ( | const void * | ptr,
 |  | unsigned int | size
 | ) | [inline, virtual]

Reimplemented from CPersistent.

Definition at line 69 of file MultiString.h.

00070         {
00071             const char *tmp = (char *)ptr;
00072             fAllItems.erase(fAllItems.begin(), fAllItems.end());
00073             unsigned int thesize = *(int *)tmp;
00074             tmp += sizeof(int) / sizeof(char);
00075             for(unsigned int i = 0; i < thesize; ++i)
00076             {
00077                 fAllItems.push_back(*((T*)tmp));
00078                 tmp += sizeof (T);
00079             }
00080         };

template<class T>
virtual unsigned int TMPersistent< T >::SizeOf ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 52 of file MultiString.h.

00052 {return sizeof (int) + sizeof (T) * fAllItems.size ();};

Member Data Documentation

template<class T>
list_t TMPersistent::fAllItems [protected]

Definition at line 87 of file MultiString.h.

template<class T>
CStaticAllocT<char> TMPersistent::fBuf [protected]

Definition at line 88 of file MultiString.h.

The documentation for this class was generated from the following file:
  • common/MultiString.h
Generated on Sun Oct 21 12:50:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTmpFiles Class Reference

Collaboration diagram for CTmpFiles:

[legend]
List of all members.

Public Methods

~CTmpFiles ()
const char * push_back (const char *file)

Protected Attributes

std::vector< UStr > allfiles

Constructor & Destructor Documentation

CTmpFiles::~CTmpFiles ( ) [inline]

Definition at line 620 of file AppGlue.cpp.

00621     {
00622         std::vector<CStr>::const_iterator i;
00623         for(i = allfiles.begin(); i != allfiles.end(); ++i)
00624         {
00625             const char *file = *i;
00626             unlink((char *)file);
00627         }
00628     }

Member Function Documentation

const char* CTmpFiles::push_back ( const char * file ) [inline]

Definition at line 630 of file AppGlue.cpp.

00631     {
00632         allfiles.push_back(file);
00633         return allfiles[allfiles.size() - 1];
00634     }

Member Data Documentation

std::vector< UStr > CTmpFiles::allfiles [protected]

Definition at line 636 of file AppGlue.cpp.

The documentation for this class was generated from the following file:
  • common/AppGlue.cpp
Generated on Sun Oct 21 12:50:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TemplateTMString class Reference

TMString Class Template Reference

#include <MultiString.h>

Inheritance diagram for TMString:

[legend]
Collaboration diagram for TMString:

[legend]
List of all members.

Public Types

typedef ::vector< T > | list_t

Public Methods

TMString (unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass)
virtual | ~TMString ()
virtual unsigned int | SizeOf (void) const
virtual const void * | GetData (void) const
virtual void | SetData (const void *ptr, unsigned int size)
void | Insert (const char *newstr)
bool | Remove (const char *newstr)
list_t::const_iterator | Find (const char *instr) const
const list_t & | GetList (void) const
list_t::const_iterator | begin () const
list_t::const_iterator | end () const

Protected Methods

virtual int | Compare (const char *s1, const char *s2) const

Protected Attributes

list_t fAllStrs
CStaticAllocT< char > | fBuf
unsigned int | fMaxStr

template<class T>
class TMString< T >

Member Typedef Documentation

template<class T>
typedef :: vector<T> TMString::list_t

Definition at line 95 of file MultiString.h.

Constructor & Destructor Documentation

template<class T>
TMString< T >::TMString | ( | unsigned int | maxstr,
 |  | const char * | uniqueName,
 |  | char *const * | defaultStr = 0L,
 |  | kClassPersistent | pclass = kNoClass
 | ) |

Definition at line 43 of file MultiString.cpp.

00044                              : CPersistent(uniqueName, pclass), fMaxStr(maxstr)
00045 {
00046     if(defaultStr != 0L)
00047     {
00048         int i = 0;
00049         while(defaultStr[i] != 0L)
00050         {
00051             Insert(defaultStr[i++]);
00052         }
00053     }
00054 }

template<class T>
TMString< T >::~TMString ( ) [virtual]

Definition at line 57 of file MultiString.cpp.

00058 {
00059 }

Member Function Documentation

template<class T>
virtual int TMString< T >::Compare | ( | const char * | s1,
 |  | const char * | s2
 | ) | const [inline, protected, virtual]

Reimplemented in CKeyString.

Definition at line 122 of file MultiString.h.

Referenced by Find(), Insert(), and Remove().

00123     {
00124         return strcmp(s1, s2);
00125     }

template<class T>
TMString< T >::list_t::const_iterator TMString< T >::Find ( const char * instr ) const

Definition at line 111 of file MultiString.cpp.

00112 {
00113     TMString<T>::list_t::const_iterator i;
00114     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00115         if(Compare(*i, instr) == 0) break;
00116
00117     return i;
00118 }

template<class T>
const void * TMString< T >::GetData ( void ) const [virtual]

Reimplemented from CPersistent.

Definition at line 75 of file MultiString.cpp.

00076 {
00077     unsigned int thesize = SizeOf(), tmpsize;
00078     ((TMString *)this)->fBuf.AdjustSize(thesize);
00079     char *tmp = ((TMString *)this)->fBuf;
00080     *(int *)tmp = fAllStrs.size();
00081     tmp += sizeof(int) / sizeof(char);
00082
00083     NAMESPACE(std) vector<T>::const_iterator i;
00084     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00085     {
00086         tmpsize = (*i).length() + 1;
00087         memcpy(tmp, (const char *)(*i), tmpsize * sizeof(char));
00088         tmp += tmpsize;
00089     }
00090
00091     return (char *)fBuf;
00092 }

template<class T>
const list_t& TMString< T >::GetList ( void ) const [inline]

Definition at line 117 of file MultiString.h.

Referenced by begin(), and end().

00117 { return fAllStrs; }

template<class T>
void TMString< T >::Insert ( const char * newstr )

Definition at line 121 of file MultiString.cpp.

Referenced by TMString().

00122 {
00123     TouchTimeStamp();
00124
00125     NAMESPACE(std) vector<T>::iterator i;
00126     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00127     {
00128         if(Compare(*i, newstr) == 0)
00129         {
00130             fAllStrs.erase(i);
00131             fAllStrs.insert(fAllStrs.begin(), T(newstr));
00132             return;
00133         }
00134     }
00135     fAllStrs.insert(fAllStrs.begin(), T(newstr));
00136     if(fAllStrs.size() > fMaxStr)
00137     {
00138         fAllStrs.erase(fAllStrs.begin() + fMaxStr, fAllStrs.end());
00139     }
00140 }

template<class T>
bool TMString< T >::Remove ( const char * newstr )

Definition at line 143 of file MultiString.cpp.

00144 {
00145
00146     NAMESPACE(std) vector<T>::iterator i;
00147     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00148     {
00149         if(Compare(*i, newstr) == 0)
00150         {
00151             TouchTimeStamp();
00152             fAllStrs.erase(i);
00153             return true;
00154         }
00155     }
00156
00157     return false;
00158 }

template<class T>
void TMString< T >::SetData | ( | const void * | ptr,
 |  | unsigned int | size
 | ) | [virtual]

Reimplemented from CPersistent.

Definition at line 95 of file MultiString.cpp.

00096 {
00097     const char *tmp = (char *)ptr;
00098     unsigned int thesize;
00099     fAllStrs.erase(fAllStrs.begin(), fAllStrs.end());
00100     thesize = *(int *)tmp;
00101     tmp += sizeof(int) / sizeof(char);
00102     for(unsigned int i = 0; i < thesize && i < fMaxStr; i++)
00103     {
00104         fAllStrs.push_back(T(tmp));
00105         tmp += strlen(tmp) + 1;
00106     }
00107 }

template<class T>
unsigned int TMString< T >::SizeOf ( void ) const [virtual]

Reimplemented from CPersistent.

Definition at line 62 of file MultiString.cpp.

Referenced by GetData().

00063 {
00064     NAMESPACE(std) vector<T>::const_iterator i;
00065     unsigned int thesize = sizeof(int);
00066
00067     for(i = fAllStrs.begin(); i != fAllStrs.end(); ++i)
00068     {
00069         thesize += (*i).length() + 1;
00070     }
00071     return thesize;
00072 }

template<class T>
list_t::const_iterator TMString< T >::begin ( ) const [inline]

Definition at line 118 of file MultiString.h.

00118 { return GetList ().begin ();};

template<class T>
list_t::const_iterator TMString< T >::end ( ) const [inline]

Definition at line 119 of file MultiString.h.

00119 { return GetList ().end ();};

Member Data Documentation

template<class T>
list_t TMString::fAllStrs [protected]

Definition at line 127 of file MultiString.h.

template<class T>
CStaticAllocT<char> TMString::fBuf [protected]

Definition at line 128 of file MultiString.h.

template<class T>
unsigned int TMString::fMaxStr [protected]

Definition at line 129 of file MultiString.h.

The documentation for this class was generated from the following files:
  • common/MultiString.h
  • common/MultiString.cpp
Generated on Sun Oct 21 12:50:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UToolbar Class Reference

#include <utoolbar.h>

Inheritance diagram for UToolbar:

[legend]
Collaboration diagram for UToolbar:

[legend]
List of all members.

Public Methods

UToolbar (int widid)
virtual | ~UToolbar ()
virtual int | UDispatchMessage (int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo)
this is overided in order to broadcast to the listeners. More...

Protected Methods

void | OnDestroy ()
void | OnTbInit (UTB_INIT *info)
void | OnTbEnd (void)
void | OnTbButton (UTB_BUTTON *info)
void | OnTbDropDown (UTB_DROPDOWN *info)
void | OnTbCheckBtn (UTB_BUTTON *info)
void | OnTbSeparator (void)
void | OnSetTooltip (int cmd, UCmdUI *pCmdUI)
EV_USETTOOLTIP message handling
Warning:
not documented.
 More...

int | OnCommands (int cmd)
void | OnUpdateUI (void)
EV_UPDATEUI is a notification sent to all the widgets when the user interface is invalid. the default is to send a EV_UPDTCMD to each sub-widget. More...

virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

WININFO * m_winInfo

Static Protected Attributes

const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Constructor & Destructor Documentation

UToolbar::UToolbar ( int widid )

Definition at line 424 of file utoolbar.cpp.

00424                             : UWidget(widid), m_winInfo(0L)
00425 #ifdef WIN32
00426     , m_wndToolBar(0L)
00427 #endif
00428 {
00429 }

UToolbar::~UToolbar ( ) [virtual]

Definition at line 431 of file utoolbar.cpp.

00432 {
00433 }

Member Function Documentation

const UMSGMAP* UToolbar::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UWidget.

Reimplemented in UCvsToolbar.

virtual const UMSGMAP* UToolbar::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UWidget.

Reimplemented in UCvsToolbar.

const UMSGMAP* UToolbar::GetThisMessageMap ( ) [static, protected]

Reimplemented from UWidget.

Reimplemented in UCvsToolbar.

int UToolbar::OnCommands ( int cmd ) [protected]

Definition at line 794 of file utoolbar.cpp.

00795 {
00796     static bool sSemaphore = false;
00797     USemaphore policeman(sSemaphore);
00798     if(policeman.IsEnteredTwice())
00799         return 1;
00800
00801     // this is the interesting thing about the toolbar : it resends the
00802     // commands to other widgets according to the focus information and
00803     // allows the command to be handled several times if the handler return 1
00804
00805     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00806     int res = 0;
00807     int handledFlag;
00808
00809     // first forward the command to the focused widget : if it soesn't want it
00810     // we give it to the next pseudo widget.
00811     if(sFocusWidID != -1 && sFocusWidID != GetWidID())
00812     {
00813         res = UEventSendMessageExt(sFocusWidID, EV_CMD, cmd, 0L, &handledFlag);
00814         if(res == 0 && handledFlag)
00815             return 0;
00816     }
00817
00818     STD map<int, UCmdTarget *>::const_iterator i;
00819     for(i = targets.begin(); i != targets.end(); ++i)
00820     {
00821         int widid = (*i).first;
00822         if(widid == sFocusWidID || widid == GetWidID())
00823             continue;
00824         res = UEventSendMessageExt(widid, EV_CMD, cmd, 0L, &handledFlag);
00825         if(res == 0 && handledFlag)
00826             return 0;
00827     }
00828
00829     UAppConsole("The cmd %d of the toolbar has no command handler\n", cmd);
00830
00831     return 0;
00832 }

void UToolbar::OnDestroy ( void ) [protected]

Reimplemented in UCvsToolbar.

Definition at line 733 of file utoolbar.cpp.

00734 {
00735     if(m_winInfo != 0L)
00736         delete m_winInfo;
00737 }

void UToolbar::OnSetTooltip | ( | int | cmd,
 |  | UCmdUI * | pCmdUI
 | ) | [protected]

EV_USETTOOLTIP message handling

Warning:
not documented.

Reimplemented from UWidget.

Definition at line 769 of file utoolbar.cpp.

00770 {
00771     WININFO *info = m_winInfo;
00772     if(info == 0L)
00773         return;
00774
00775     int index;
00776     std::vector<TbEntry *>::iterator f = info->Search(cmd, &index);
00777     if(f == info->entries.end())
00778         return;
00779
00780     TbEntry * entry = *f;
00781     if(entry->kind == tbeDropDown)
00782     {
00783         TbEntryDropDown *drop = (TbEntryDropDown *)entry;
00784         awidget & wid = drop->icons[index];
00785         pCmdUI->SetTooltip(wid.tooltip);
00786     }
00787     else if(entry->kind == tbeButton)
00788     {
00789         TbEntryButton *btn = (TbEntryButton *)entry;
00790         pCmdUI->SetTooltip(btn->wid.tooltip);
00791     }
00792 }

void UToolbar::OnTbButton ( UTB_BUTTON * info ) [protected]

Definition at line 624 of file utoolbar.cpp.

00625 {
00626 #ifdef WIN32
00627     ASSERT(m_wndToolBar != 0L);
00628 #endif
00629
00630     WININFO & tb = *m_winInfo;
00631     HBITMAP bitmap = UMakeBitmap((char **)info->icon);
00632     TbEntryButton *btn = NEW TbEntryButton(bitmap, info->cmd,
00633         info->tooltip, info->varcode);
00634     tb.entries.push_back(btn);
00635
00636 #ifdef qGTK
00637     char status[256] = {'\0'};
00638     char prompt[256] = {'\0'};
00639
00640     strcpy(status, info->tooltip);
00641     char *cr = strchr(status, '\n');
00642     if(cr != 0L)
00643     {
00644         strcpy(prompt, cr + 1);
00645         *cr = '\0';
00646     }
00647     GtkToolbar *toolbar = GTK_TOOLBAR(GetWidget(kUMainWidget));
00648     GtkWidget *tmp_toolbar_icon = info->icon != 0L ?
00649         create_pixmap(GTK_WIDGET(toolbar), (const char *)info->icon) : 0L;
00650     GtkWidget *wid = gtk_toolbar_append_element(toolbar, GTK_TOOLBAR_CHILD_BUTTON, 0L,
00651                                                 prompt, status, 0L,
00652                                                 tmp_toolbar_icon, 0L, 0L);
00653     UEventSendMessage(GetWidID(), EV_INIT_WIDGET, info->cmd, wid);
00654 #endif
00655 }

void UToolbar::OnTbCheckBtn ( UTB_BUTTON * info ) [protected]

Definition at line 699 of file utoolbar.cpp.

00700 {
00701 #ifdef WIN32
00702     ASSERT(m_wndToolBar != 0L);
00703 #endif
00704
00705     WININFO & tb = *m_winInfo;
00706     HBITMAP bitmap = UMakeBitmap((char **)info->icon);
00707     TbEntryButton *btn = NEW TbEntryChkButton(bitmap, info->cmd,
00708         info->tooltip, info->varcode);
00709     tb.entries.push_back(btn);
00710
00711 #ifdef qGTK
00712     char status[256] = {'\0'};
00713     char prompt[256] = {'\0'};
00714
00715     strcpy(status, info->tooltip);
00716     char *cr = strchr(status, '\n');
00717     if(cr != 0L)
00718     {
00719         strcpy(prompt, cr + 1);
00720         *cr = '\0';
00721     }
00722     GtkToolbar *toolbar = GTK_TOOLBAR(GetWidget(kUMainWidget));
00723     GtkWidget *tmp_toolbar_icon = info->icon != 0L ?
00724         create_pixmap(GTK_WIDGET(toolbar), (const char *)info->icon) : 0L;
00725     GtkWidget *wid = gtk_toolbar_append_element(toolbar, GTK_TOOLBAR_CHILD_TOGGLEBUTTON, 0L,
00726                                                 prompt, status, 0L,
00727                                                 tmp_toolbar_icon, 0L, 0L);
00728     UEventSendMessage(GetWidID(), EV_INIT_WIDGET, info->cmd, wid);
00729 #endif
00730 }

void UToolbar::OnTbDropDown ( UTB_DROPDOWN * info ) [protected]

Definition at line 675 of file utoolbar.cpp.

00676 {
00677 #ifdef WIN32
00678     ASSERT(m_wndToolBar != 0L);
00679 #endif
00680
00681     WININFO & tb = *m_winInfo;
00682     TbEntryDropDown *drop = NEW TbEntryDropDown();
00683     tb.entries.push_back(drop);
00684     int current = 0;
00685
00686     UTB_BUTTON *btns = info->btns;
00687     while(btns->icon != 0L)
00688     {
00689         HBITMAP bitmap = UMakeBitmap((char **)btns->icon);
00690         awidget ad(bitmap, btns->cmd, btns->tooltip, btns->varcode);
00691         drop->icons.push_back(ad);
00692         if(btns->cmd == info->initialcmd)
00693             drop->current = current;
00694         btns++;
00695         current++;
00696     }
00697 }

void UToolbar::OnTbEnd ( void ) [protected]

Definition at line 617 of file utoolbar.cpp.

00618 {
00619 #ifdef WIN32
00620     RebuildBar(false);
00621 #endif
00622 }

void UToolbar::OnTbInit ( UTB_INIT * info ) [protected]

Definition at line 435 of file utoolbar.cpp.

00436 {
00437     m_winInfo = NEW WININFO(info->widthbtn, info->heightbtn);
00438
00439 #ifdef WIN32
00440     WININFO & tb = *m_winInfo;
00441     m_wndToolBar = new CDynToolBar;
00442     CFrameWnd *f = m_wndToolBar->GetMainFrame();
00443     VERIFY(m_wndToolBar->Create(f, WS_CHILD | WS_VISIBLE | CBRS_TOP, info->winid));
00444     m_wndToolBar->SetBarStyle(m_wndToolBar->GetBarStyle() |
00445         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
00446     m_wndToolBar->EnableDocking(CBRS_ALIGN_ANY);
00447     m_wndToolBar->SetWinInfo(m_winInfo);
00448     m_wndToolBar->SetPseudoID(GetWidID());
00449     f->DockControlBar(m_wndToolBar);
00450
00451     // configure the Win32 toolbar
00452     if(info->title != 0L)
00453         m_wndToolBar->SetWindowText(info->title);
00454     m_wndToolBar->SetSizes(CSize(info->widthbtn+7,info->heightbtn+6),
00455         CSize(info->widthbtn,info->heightbtn));
00456 #endif
00457 #ifdef qGTK
00458     void *wid = GetWidget(kUMainWidget);
00459     g_assert(wid != 0L && GTK_IS_TOOLBAR(wid));
00460 #endif
00461 }

void UToolbar::OnTbSeparator ( void ) [protected]

Definition at line 657 of file utoolbar.cpp.

00658 {
00659 #ifdef WIN32
00660     ASSERT(m_wndToolBar != 0L);
00661 #endif
00662
00663     WININFO & tb = *m_winInfo;
00664     TbEntrySeparator *btn = NEW TbEntrySeparator();
00665     tb.entries.push_back(btn);
00666
00667 #ifdef qGTK
00668     GtkToolbar *toolbar = GTK_TOOLBAR(GetWidget(kUMainWidget));
00669     /*GtkWidget *wid = */gtk_toolbar_append_element(toolbar, GTK_TOOLBAR_CHILD_SPACE, 0L,
00670                                                 0L, 0L, 0L,
00671                                                 0L, 0L, 0L);
00672 #endif
00673 }

void UToolbar::OnUpdateUI ( void ) [protected]

EV_UPDATEUI is a notification sent to all the widgets when the user interface is invalid. the default is to send a EV_UPDTCMD to each sub-widget.

Reimplemented from UWidget.

Definition at line 834 of file utoolbar.cpp.

00835 {
00836 // on Windows the update UI is sent by MFC
00837 #ifndef WIN32
00838     WININFO *info = m_winInfo;
00839     if(info == 0L)
00840         return;
00841
00842     static bool sSemaphore = false;
00843     USemaphore policeman(sSemaphore);
00844     if(policeman.IsEnteredTwice())
00845         return;
00846
00847     // this is the interesting thing about the toolbar : it resends the
00848     // update UI to other widgets according to the focus information and
00849     // allows the update to be handled several times if the handler asks for it
00850     // (by using UCmdUI::SetContinue)
00851
00852     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
00853     std::vector<TbEntry *>::const_iterator f;
00854     int cmdid;
00855
00856     for(f = info->entries.begin(); f != info->entries.end(); ++f)
00857     {
00858         TbEntry * entry = *f;
00859         if(entry->kind == tbeButton)
00860         {
00861             TbEntryButton *btn = (TbEntryButton *)entry;
00862             cmdid = btn->wid.cmd;
00863         }
00864         else
00865             continue;
00866
00867         void *widget = GetWidget(cmdid);
00868         if(widget == 0L)
00869             continue;
00870
00871         // first forward the command to the focused widget : if it doesn't want it
00872         // we give it to the next pseudo widget.
00873         if(sFocusWidID != -1 && sFocusWidID != GetWidID())
00874         {
00875             UCmdUI pUI(cmdid);
00876             pUI.m_widget = widget;
00877             UEventSendMessage(sFocusWidID, EV_UPDTCMD, pUI.m_nID, &pUI);
00878             if(!pUI.CanContinue())
00879                 continue;
00880         }
00881
00882         STD map<int, UCmdTarget *>::const_iterator i;
00883         for(i = targets.begin(); i != targets.end(); ++i)
00884         {
00885             int widid = (*i).first;
00886             if(widid == sFocusWidID || widid == GetWidID())
00887                 continue;
00888
00889             UCmdUI pUI(cmdid);
00890             pUI.m_widget = widget;
00891             UEventSendMessage(widid, EV_UPDTCMD, pUI.m_nID, &pUI);
00892             if(!pUI.CanContinue())
00893                 break;
00894         }
00895         if(i == targets.end())
00896         {
00897             //UAppConsole("The cmd %d of the toolbar has no update handler, it's gonna be disabled\n", cmdid);
00898             UCmdUI pUI(cmdid);
00899             pUI.m_widget = widget;
00900             pUI.Enable(false);
00901         }
00902     }
00903 #endif // !WIN32
00904 }

int UToolbar::UDispatchMessage | ( | int | evt,
 |  | int | arg1,
 |  | void * | arg2,
 |  | UDispatchInfo & | dispatchInfo
 | ) | [virtual]

this is overided in order to broadcast to the listeners.

Reimplemented from UWidget.

Definition at line 739 of file utoolbar.cpp.

00740 {
00741     if(evt == EV_CMD)
00742     {
00743         WININFO *info = m_winInfo;
00744         if(info != 0L)
00745         {
00746             int index;
00747             std::vector<TbEntry *>::iterator f = info->Search(arg1, &index);
00748             if(f != info->entries.end())
00749             {
00750                 TbEntryDropDown *entry = (TbEntryDropDown *)*f;
00751                 if(entry->kind == tbeDropDown)
00752                 {
00753                     // toggle the current bitmap
00754                     if(entry->current != index)
00755                     {
00756                         entry->current = index;
00757 #ifdef WIN32
00758                         RebuildBar();
00759 #endif
00760                     }
00761                 }
00762             }
00763         }
00764     }
00765
00766     return UWidget::UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00767 }

Member Data Documentation

const UMSGMAP_ENTRY UToolbar::_messageEntries[] [static, private]

Reimplemented from UWidget.

Reimplemented in UCvsToolbar.

Definition at line 110 of file utoolbar.h.

WININFO* UToolbar::m_winInfo [protected]

Definition at line 102 of file utoolbar.h.

const UMSGMAP UToolbar::messageMap [static, protected]

Reimplemented from UWidget.

Reimplemented in UCvsToolbar.

Definition at line 110 of file utoolbar.h.

The documentation for this class was generated from the following files:
  • rf/utoolbar.h
  • rf/utoolbar.cpp
Generated on Sun Oct 21 12:50:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CToolbarCombo Class Reference

#include <ToolbarCombo.h>

Inheritance diagram for CToolbarCombo:

[legend]
Collaboration diagram for CToolbarCombo:

[legend]
List of all members.

Public Methods

CToolbarCombo ()
BOOL | Create (DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
NotificationManager * GetManager ()
const CString & | GetText ()
void | GetItemText (int pos, LPTSTR buffer, int count)
virtual | ~CToolbarCombo ()

Protected Methods

void | SetText (const CString &text)
void | ResetText ()
afx_msg void | OnSelendok ()
afx_msg void | OnSelendcancel ()
afx_msg LRESULT | OnContentChange (WPARAM wp, LPARAM lp)

Private Attributes

CTbEdit m_edit
NotificationManager m_manager
CString | m_text

Constructor & Destructor Documentation

CToolbarCombo::CToolbarCombo ( )

Definition at line 26 of file ToolbarCombo.cpp.

00027 {
00028 }

CToolbarCombo::~CToolbarCombo ( ) [virtual]

Definition at line 30 of file ToolbarCombo.cpp.

00031 {
00032 }

Member Function Documentation

BOOL CToolbarCombo::Create | ( | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID
 | ) |

Definition at line 34 of file ToolbarCombo.cpp.

Referenced by CMainFrame::OnCreate().

00035 {
00036     if (!CComboBoxEx::Create(dwStyle, rect, pParentWnd, nID))
00037     {
00038         return FALSE;
00039     }
00040     SetExtendedStyle(CBES_EX_CASESENSITIVE, CBES_EX_CASESENSITIVE);
00041     m_edit.SubclassWindow(GetEditCtrl()->m_hWnd);
00042     m_edit.SetOwner(this);
00043     return TRUE;
00044 }

void CToolbarCombo::GetItemText | ( | int | pos,
 |  | LPTSTR | buffer,
 |  | int | count
 | ) |

Definition at line 101 of file ToolbarCombo.cpp.

Referenced by OnSelendok(), and SetText().

00102 {
00103     COMBOBOXEXITEM item;
00104     item.mask = CBEIF_TEXT;
00105     item.pszText = buffer;
00106     item.cchTextMax = count;
00107     item.iItem = pos;
00108     VERIFY(GetItem(&item));
00109 }

NotificationManager* CToolbarCombo::GetManager ( ) [inline]

Definition at line 32 of file ToolbarCombo.h.

Referenced by CMainFrame::OnCreate().

00033     {
00034         return &m_manager;
00035     }

const CString& CToolbarCombo::GetText ( ) [inline]

Definition at line 37 of file ToolbarCombo.h.

00038     {
00039         return m_text;
00040     }

LRESULT CToolbarCombo::OnContentChange | ( | WPARAM | wp,
 |  | LPARAM | lp
 | ) | [protected]

Definition at line 46 of file ToolbarCombo.cpp.

00047 {
00048     bool complete = wp != 0;
00049     if (complete)
00050     {
00051         CString text;
00052         m_edit.GetWindowText(text);
00053         SetText(text);
00054     }
00055     else
00056     {
00057         // restore previous text
00058         ResetText();
00059     }
00060     return 0;
00061 }

void CToolbarCombo::OnSelendcancel ( ) [protected]

Definition at line 124 of file ToolbarCombo.cpp.

00125 {
00126     ResetText();
00127 }

void CToolbarCombo::OnSelendok ( ) [protected]

Definition at line 111 of file ToolbarCombo.cpp.

00112 {
00113     CComboBox* combo = GetComboBoxCtrl();
00114     int pos = combo->GetCurSel();
00115     if (pos >= 0)
00116     {
00117         TCHAR buffer[256];
00118         GetItemText(pos, buffer, 256);
00119         SetText(buffer);
00120         ResetText();
00121     }
00122 }

void CToolbarCombo::ResetText ( ) [protected]

Definition at line 63 of file ToolbarCombo.cpp.

Referenced by OnContentChange(), OnSelendcancel(), and OnSelendok().

00064 {
00065     m_edit.SetWindowText(m_text);
00066 }

void CToolbarCombo::SetText ( const CString & text ) [protected]

Definition at line 68 of file ToolbarCombo.cpp.

Referenced by OnContentChange(), and OnSelendok().

00069 {
00070     if (m_text.Compare(text) != 0)
00071     {
00072         m_text = text;
00073
00074         // append selection to combo box
00075         int count = GetCount();
00076         for (int i = count - 1; i >= 0 ; i--)
00077         {
00078             TCHAR buffer[256];
00079             GetItemText(i, buffer, 256);
00080             if (text.Compare(buffer) == 0)
00081             {
00082                 DeleteItem(i);
00083             }
00084         }
00085         COMBOBOXEXITEM item;
00086         item.mask = CBEIF_TEXT;
00087         item.iItem = 0;
00088         item.pszText = (LPTSTR)(LPCTSTR)text;
00089         InsertItem(&item);
00090         count = GetCount();
00091         while (count > 8)
00092         {
00093             count--;
00094             DeleteItem(count);
00095         }
00096
00097         m_manager.NotifyAll();
00098     }
00099 }

Member Data Documentation

CTbEdit CToolbarCombo::m_edit [private]

Definition at line 24 of file ToolbarCombo.h.

NotificationManager CToolbarCombo::m_manager [private]

Definition at line 25 of file ToolbarCombo.h.

CString CToolbarCombo::m_text [private]

Definition at line 26 of file ToolbarCombo.h.

The documentation for this class was generated from the following files:
  • WinCvs/ToolbarCombo.h
  • WinCvs/ToolbarCombo.cpp
Generated on Sun Oct 21 12:50:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CToolBarCtrl Class Reference

Inheritance diagram for CToolBarCtrl:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJToolBarCtrl.h
Generated on Sun Oct 21 12:50:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CToolBarData Struct Reference

Collaboration diagram for CToolBarData:

[legend]
List of all members.

Public Methods

WORD * | items ()

Public Attributes

WORD | wVersion
WORD | wWidth
WORD | wHeight
WORD | wItemCount

Member Function Documentation

WORD* CToolBarData::items ( ) [inline]

Definition at line 1045 of file CJToolBar.cpp.

Referenced by CCJToolBar::LoadToolBar().

01046         { return (WORD*)(this+1); }

Member Data Documentation

WORD CToolBarData::wHeight

Definition at line 1041 of file CJToolBar.cpp.

Referenced by CCJToolBar::LoadToolBar().

WORD CToolBarData::wItemCount

Definition at line 1042 of file CJToolBar.cpp.

Referenced by CCJToolBar::LoadToolBar().

WORD CToolBarData::wVersion

Definition at line 1039 of file CJToolBar.cpp.

Referenced by CCJToolBar::LoadToolBar().

WORD CToolBarData::wWidth

Definition at line 1040 of file CJToolBar.cpp.

Referenced by CCJToolBar::LoadToolBar().

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/CJLibrary/CJToolBar.cpp
Generated on Sun Oct 21 12:50:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TOOLBARINFO Struct Reference

#include <CJToolBar.h>

Collaboration diagram for TOOLBARINFO:

[legend]
List of all members.

Public Attributes

TBBUTTON | tbButton
LPCTSTR | btnText

Member Data Documentation

LPCTSTR TOOLBARINFO::btnText

Definition at line 95 of file CJToolBar.h.

TBBUTTON TOOLBARINFO::tbButton

Definition at line 94 of file CJToolBar.h.

Referenced by CCJToolBar::OnToolBarGetButtonInfo().

The documentation for this struct was generated from the following file:
  • WinCvs/CJLib/Include/CJToolBar.h
Generated on Sun Oct 21 12:50:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPopup Class Reference

Inheritance diagram for TPopup:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/macapp/UPseudoSupport.h
Generated on Sun Oct 21 12:50:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPseudoAppBehavior Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TPseudoAppBehavior:

[legend]
Collaboration diagram for TPseudoAppBehavior:

[legend]
List of all members.

Public Methods

TPseudoAppBehavior ()
virtual | ~TPseudoAppBehavior ()
virtual bool | DoIdle (IdlePhase phase)
virtual void | DoMenuCommand (CommandNumber aCommandNumber)
virtual void | DoSetupMenus ()
virtual bool | DoToolboxEvent (TToolboxEvent *event)

Private Attributes

MA_DECLARE_CLASS

Constructor & Destructor Documentation

TPseudoAppBehavior::TPseudoAppBehavior ( )

Definition at line 453 of file UPseudoSupport.cpp.

00453                                        : TBehavior()
00454 {
00455     SetIdleFreq(0); // ASAP
00456 }

TPseudoAppBehavior::~TPseudoAppBehavior ( ) [virtual]

Definition at line 458 of file UPseudoSupport.cpp.

00459 {
00460 }

Member Function Documentation

bool TPseudoAppBehavior::DoIdle ( IdlePhase phase ) [virtual]

Definition at line 462 of file UPseudoSupport.cpp.

00463 {
00464     ::UEventGiveTime();
00465     return false;
00466 }

void TPseudoAppBehavior::DoMenuCommand ( CommandNumber aCommandNumber ) [virtual]

Definition at line 468 of file UPseudoSupport.cpp.

00469 {
00470     if(UMacAppMenu::sMAMenuWidID != -1)
00471     {
00472         int handledFlag;
00473         int res = UEventSendMessageExt(UMacAppMenu::sMAMenuWidID, EV_CMD,
00474             aCommandNumber, 0L, &handledFlag);
00475         if(res == 0 && handledFlag)
00476             return;
00477     }
00478
00479     // regular MacApp handling
00480     Inherited::DoMenuCommand(aCommandNumber);
00481 }

void TPseudoAppBehavior::DoSetupMenus ( ) [virtual]

Definition at line 483 of file UPseudoSupport.cpp.

00484 {
00485     UWidget::DoValidUI(false);
00486     ::UEventGiveTime();
00487
00488     Inherited::DoSetupMenus();
00489 }

bool TPseudoAppBehavior::DoToolboxEvent ( TToolboxEvent * event ) [virtual]

Definition at line 491 of file UPseudoSupport.cpp.

00492 {
00493     if(event && event->GetIdentifier() == activateEvt)
00494     {
00495         bool activate = ((event->GetModifiers()) & activeFlag) != 0;
00496         TWindow * aWindow = TWindow::WMgrToWindow((WindowRef)(event->GetMessage()));
00497         if(aWindow)
00498         {
00499             UEventNotifyMessage(EV_UPDATEFOCUS, !activate, aWindow);
00500                 // so the pseudo widget update its current widget.
00501                 // it's important for the menu handling.
00502         }
00503     }
00504
00505     return Inherited::DoToolboxEvent(event);
00506 }

Member Data Documentation

TPseudoAppBehavior::MA_DECLARE_CLASS [private]

Definition at line 107 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPseudoCustomView Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TPseudoCustomView:

[legend]
Collaboration diagram for TPseudoCustomView:

[legend]
List of all members.

Public Methods

TPseudoCustomView ()
virtual | ~TPseudoCustomView ()
virtual void | Draw (const CViewRect &area)

Private Attributes

MA_DECLARE_CLASS

Constructor & Destructor Documentation

TPseudoCustomView::TPseudoCustomView ( )

Definition at line 324 of file UPseudoSupport.cpp.

00325 {
00326 }

TPseudoCustomView::~TPseudoCustomView ( ) [virtual]

Definition at line 328 of file UPseudoSupport.cpp.

00329 {
00330 }

Member Function Documentation

void TPseudoCustomView::Draw ( const CViewRect & area ) [virtual]

Definition at line 332 of file UPseudoSupport.cpp.

00333 {
00334     TWindow *wind = GetWindow();
00335     if(wind != 0L)
00336     {
00337         TPseudoWinBehavior *pseudo = dynamic_cast_AC(TPseudoWinBehavior*,
00338             wind->GetBehaviorWithIdentifier(TPseudoWinBehavior::kPseudoWinBehavior));
00339         if(pseudo != 0L)
00340         {
00341             int cmdid = UEventSendMessage(pseudo->GetWidID(), EV_FETCHCMD, 0, this);
00342             if(cmdid != -1)
00343                 UEventSendMessage(pseudo->GetWidID(), EV_CUSTOM_DRAW, cmdid, this);
00344         }
00345     }
00346 }

Member Data Documentation

TPseudoCustomView::MA_DECLARE_CLASS [private]

Definition at line 172 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPseudoDoubleNumberText Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TPseudoDoubleNumberText:

[legend]
Collaboration diagram for TPseudoDoubleNumberText:

[legend]
List of all members.

Public Types

enum | { kDefaultPrecision = 5, kStdDoubleNumberText = 'dNum' }

Public Methods

TPseudoDoubleNumberText ()
virtual | ~TPseudoDoubleNumberText ()
virtual IDType | GetStandardSignature () const
virtual void | ReadFields (CStream_AC *aStream)
virtual void | WriteFields (CStream_AC *aStream) const
virtual long | GetValidationError ()
virtual double | GetValue ()
virtual void | SetValue (double newValue, bool redraw)

Protected Attributes

double | fMinimum
double | fMaximum
short | fPrecision

Private Attributes

MA_DECLARE_CLASS

Member Enumeration Documentation

anonymous enum

Enumeration values:
kDefaultPrecision
kStdDoubleNumberText

Definition at line 224 of file UPseudoSupport.h.

00225     {
00226         kDefaultPrecision = 5,
00227         kStdDoubleNumberText = 'dNum'
00228     };

Constructor & Destructor Documentation

TPseudoDoubleNumberText::TPseudoDoubleNumberText ( )

Definition at line 354 of file UPseudoSupport.cpp.

00354                                                  : fMaximum(DBL_MAX), fMinimum(DBL_MIN),
00355     fPrecision(kDefaultPrecision)
00356 {
00357 }

TPseudoDoubleNumberText::~TPseudoDoubleNumberText ( ) [virtual]

Definition at line 359 of file UPseudoSupport.cpp.

00360 {
00361 }

Member Function Documentation

IDType TPseudoDoubleNumberText::GetStandardSignature ( void ) const [virtual]

Definition at line 363 of file UPseudoSupport.cpp.

00364 {
00365     return kStdDoubleNumberText;
00366 }

long TPseudoDoubleNumberText::GetValidationError ( ) [virtual]

Definition at line 428 of file UPseudoSupport.cpp.

00429 {
00430     CStr255_AC theString = GetText();
00431
00432     if (!theString.IsEmpty())
00433     {
00434         double extValue;
00435         bool valid = sscanf(CChar255_AC(theString), "%lf", &extValue) == 1;
00436
00437         if (!valid)
00438             return kNonNumericCharacters;
00439         else if (extValue < fMinimum)
00440             return kValueTooSmall;
00441         else if (extValue > fMaximum)
00442             return kValueTooLarge;
00443     }
00444
00445     return kValidValue;
00446 }

double TPseudoDoubleNumberText::GetValue ( ) [virtual]

Definition at line 393 of file UPseudoSupport.cpp.

Referenced by UWidget::OnGetFloat().

00394 {
00395     double theValue = 0.0;
00396     CStr255_AC theString = GetText();
00397
00398     if (!theString.IsEmpty())
00399     {
00400         sscanf(CChar255_AC(theString), "%lf", &theValue);
00401     }
00402
00403     return theValue;
00404 }

void TPseudoDoubleNumberText::ReadFields ( CStream_AC * aStream ) [virtual]

Definition at line 368 of file UPseudoSupport.cpp.

00369 {
00370     Inherited::ReadFields(aStream);
00371
00372     CStr255_AC theString;
00373     theString = aStream->ReadString(255);
00374     sscanf(CChar255_AC(theString), "%lf", &fMinimum);
00375     theString = aStream->ReadString(255);
00376     sscanf(CChar255_AC(theString), "%lf", &fMaximum);
00377     fPrecision = aStream->ReadInteger();
00378 }

void TPseudoDoubleNumberText::SetValue | ( | double | newValue,
 |  | bool | redraw
 | ) | [virtual]

Definition at line 416 of file UPseudoSupport.cpp.

Referenced by UWidget::OnSetFloat(), and UWidget::OnSetState().

00417 {
00418     newValue = fMinimum >= newValue ? fMinimum : newValue;
00419     newValue = newValue <= fMaximum ? newValue : fMaximum;
00420
00421     UStr aString;
00422     NumberToString_US(newValue, aString, fPrecision);
00423
00424     CStr255_AC tempString = aString;
00425     SetText(tempString, redraw);
00426 }

void TPseudoDoubleNumberText::WriteFields ( CStream_AC * aStream ) const [virtual]

Definition at line 380 of file UPseudoSupport.cpp.

00381 {
00382     Inherited::WriteFields(aStream);
00383
00384     char tmp[255];
00385     sprintf(tmp, "%lf", fMinimum);
00386     aStream->WriteString(CStr255_AC(tmp));
00387     sprintf(tmp, "%lf", fMaximum);
00388     aStream->WriteString(CStr255_AC(tmp));
00389     aStream->WriteLong(fPrecision);
00390 }

Member Data Documentation

TPseudoDoubleNumberText::MA_DECLARE_CLASS [private]

Definition at line 221 of file UPseudoSupport.h.

double TPseudoDoubleNumberText::fMaximum [protected]

Definition at line 243 of file UPseudoSupport.h.

double TPseudoDoubleNumberText::fMinimum [protected]

Definition at line 242 of file UPseudoSupport.h.

short TPseudoDoubleNumberText::fPrecision [protected]

Definition at line 244 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPseudoIconButton Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TPseudoIconButton:

[legend]
Collaboration diagram for TPseudoIconButton:

[legend]
List of all members.

Private Methods

TPseudoIconButton ()
virtual | ~TPseudoIconButton ()
virtual void | ReadFields (CStream_AC *aStream)
virtual void | WriteFields (CStream_AC *aStream) const

Private Attributes

MA_DECLARE_CLASS

Constructor & Destructor Documentation

TPseudoIconButton::TPseudoIconButton ( ) [private]

Definition at line 513 of file UPseudoSupport.cpp.

00514 {
00515 }

TPseudoIconButton::~TPseudoIconButton ( ) [private, virtual]

Definition at line 517 of file UPseudoSupport.cpp.

00518 {
00519 }

Member Function Documentation

void TPseudoIconButton::ReadFields ( CStream_AC * aStream ) [private, virtual]

Reimplemented in TPseudoRotateIconButton.

Definition at line 521 of file UPseudoSupport.cpp.

00522 {
00523     Inherited::ReadFields(aStream);
00524
00525     *aStream >> fContentType;
00526     SetContentRsrcID(fContentType, fRsrcID);
00527 }

void TPseudoIconButton::WriteFields ( CStream_AC * aStream ) const [private, virtual]

Reimplemented in TPseudoRotateIconButton.

Definition at line 529 of file UPseudoSupport.cpp.

00530 {
00531     Inherited::WriteFields(aStream);
00532
00533     *aStream << fContentType;
00534 }

Member Data Documentation

TPseudoIconButton::MA_DECLARE_CLASS [private]

Reimplemented in TPseudoRotateIconButton.

Definition at line 53 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPseudoIconCheckBox Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TPseudoIconCheckBox:

[legend]
Collaboration diagram for TPseudoIconCheckBox:

[legend]
List of all members.

Private Methods

TPseudoIconCheckBox ()
virtual | ~TPseudoIconCheckBox ()
virtual void | ReadFields (CStream_AC *aStream)
virtual void | WriteFields (CStream_AC *aStream) const

Private Attributes

MA_DECLARE_CLASS

Constructor & Destructor Documentation

TPseudoIconCheckBox::TPseudoIconCheckBox ( ) [private]

Definition at line 704 of file UPseudoSupport.cpp.

00705 {
00706 }

TPseudoIconCheckBox::~TPseudoIconCheckBox ( ) [private, virtual]

Definition at line 708 of file UPseudoSupport.cpp.

00709 {
00710 }

Member Function Documentation

void TPseudoIconCheckBox::ReadFields ( CStream_AC * aStream ) [private, virtual]

Definition at line 712 of file UPseudoSupport.cpp.

00713 {
00714     Inherited::ReadFields(aStream);
00715
00716     *aStream >> fContentType;
00717     SetContentRsrcID(fContentType, fRsrcID);
00718 }

void TPseudoIconCheckBox::WriteFields ( CStream_AC * aStream ) const [private, virtual]

Definition at line 720 of file UPseudoSupport.cpp.

00721 {
00722     Inherited::WriteFields(aStream);
00723
00724     *aStream << fContentType;
00725 }

Member Data Documentation

TPseudoIconCheckBox::MA_DECLARE_CLASS [private]

Definition at line 81 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPseudoIconPopup Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TPseudoIconPopup:

[legend]
Collaboration diagram for TPseudoIconPopup:

[legend]
List of all members.

Private Methods

TPseudoIconPopup ()
virtual | ~TPseudoIconPopup ()
virtual void | ReadFields (CStream_AC *aStream)
virtual void | WriteFields (CStream_AC *aStream) const

Private Attributes

MA_DECLARE_CLASS

Constructor & Destructor Documentation

TPseudoIconPopup::TPseudoIconPopup ( ) [private]

Definition at line 577 of file UPseudoSupport.cpp.

00578 {
00579 }

TPseudoIconPopup::~TPseudoIconPopup ( ) [private, virtual]

Definition at line 581 of file UPseudoSupport.cpp.

00582 {
00583 }

Member Function Documentation

void TPseudoIconPopup::ReadFields ( CStream_AC * aStream ) [private, virtual]

Definition at line 585 of file UPseudoSupport.cpp.

00586 {
00587     Inherited::ReadFields(aStream);
00588
00589     *aStream >> fContentType;
00590     SetContentRsrcID(fContentType, fRsrcID);
00591 }

void TPseudoIconPopup::WriteFields ( CStream_AC * aStream ) const [private, virtual]

Definition at line 593 of file UPseudoSupport.cpp.

00594 {
00595     Inherited::WriteFields(aStream);
00596
00597     *aStream << fContentType;
00598 }

Member Data Documentation

TPseudoIconPopup::MA_DECLARE_CLASS [private]

Definition at line 42 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPseudoRotateIconButton Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TPseudoRotateIconButton:

[legend]
Collaboration diagram for TPseudoRotateIconButton:

[legend]
List of all members.

Protected Attributes

std::vector< short > | fIconSuite
int | fCurrentIcon

Private Methods

TPseudoRotateIconButton ()
virtual | ~TPseudoRotateIconButton ()
virtual void | ReadFields (CStream_AC *aStream)
virtual void | WriteFields (CStream_AC *aStream) const
void | DoRotate (int icon)

Private Attributes

MA_DECLARE_CLASS

Constructor & Destructor Documentation

TPseudoRotateIconButton::TPseudoRotateIconButton ( ) [private]

Definition at line 641 of file UPseudoSupport.cpp.

00641                                                  : fCurrentIcon(0)
00642 {
00643 }

TPseudoRotateIconButton::~TPseudoRotateIconButton ( ) [private, virtual]

Definition at line 645 of file UPseudoSupport.cpp.

00646 {
00647 }

Member Function Documentation

void TPseudoRotateIconButton::DoRotate ( int icon ) [private]

Definition at line 689 of file UPseudoSupport.cpp.

Referenced by UWidget::OnSetState().

00690 {
00691     if(fCurrentIcon != icon && icon >= 0 && icon < fIconSuite.size())
00692     {
00693         fCurrentIcon = icon;
00694         SetContentRsrcID(fContentType, fIconSuite[fCurrentIcon]);
00695         ForceRedraw();
00696     }
00697 }

void TPseudoRotateIconButton::ReadFields ( CStream_AC * aStream ) [private, virtual]

Reimplemented from TPseudoIconButton.

Definition at line 649 of file UPseudoSupport.cpp.

00650 {
00651     Inherited::ReadFields(aStream);
00652
00653     CChar255_AC str(aStream->ReadString(255));
00654     const char *ptr = str;
00655     while(ptr != 0L)
00656     {
00657         int v;
00658         const char *tmp = strchr(ptr, ',');
00659         if(tmp != 0L)
00660         {
00661             CChar255_AC stmp;
00662             size_t offset = tmp - ptr;
00663             stmp.CopyFrom(ptr, offset);
00664             ptr += offset + 1;
00665             if(sscanf(stmp, "%d", &v) == 1)
00666                 fIconSuite.push_back(v);
00667         }
00668         else
00669         {
00670             if(sscanf(ptr, "%d", &v) == 1)
00671                 fIconSuite.push_back(v);
00672             ptr = 0;
00673         }
00674     }
00675
00676     if(fIconSuite.size() != 0)
00677         SetContentRsrcID(fContentType, fIconSuite[0]);
00678 }

void TPseudoRotateIconButton::WriteFields ( CStream_AC * aStream ) const [private, virtual]

Reimplemented from TPseudoIconButton.

Definition at line 680 of file UPseudoSupport.cpp.

00681 {
00682     Inherited::WriteFields(aStream);
00683
00684     // do we really need to write ?
00685     *aStream << "";
00686     UASSERT(0);
00687 }

Member Data Documentation

TPseudoRotateIconButton::MA_DECLARE_CLASS [private]

Reimplemented from TPseudoIconButton.

Definition at line 64 of file UPseudoSupport.h.

int TPseudoRotateIconButton::fCurrentIcon [protected]

Definition at line 76 of file UPseudoSupport.h.

std::vector<short> TPseudoRotateIconButton::fIconSuite [protected]

Definition at line 75 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPseudoScrollBar Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TPseudoScrollBar:

[legend]
Collaboration diagram for TPseudoScrollBar:

[legend]
List of all members.

Private Methods

TPseudoScrollBar ()
virtual | ~TPseudoScrollBar ()
virtual void | TrackScrollBar (short partCode)

Private Attributes

MA_DECLARE_CLASS
int | fPageStep
int | fButtonStep

Constructor & Destructor Documentation

TPseudoScrollBar::TPseudoScrollBar ( ) [private]

Definition at line 605 of file UPseudoSupport.cpp.

00605                                    : fPageStep(1), fButtonStep(1)
00606 {
00607 }

TPseudoScrollBar::~TPseudoScrollBar ( ) [private, virtual]

Definition at line 609 of file UPseudoSupport.cpp.

00610 {
00611 }

Member Function Documentation

void TPseudoScrollBar::TrackScrollBar ( short partCode ) [private, virtual]

Definition at line 613 of file UPseudoSupport.cpp.

00614 {
00615     switch (partCode)
00616     {
00617         case kControlPageUpPart:
00618             if (GetValue() > GetMinimum())
00619                 DeltaValue(-fPageStep);
00620             break;
00621         case kControlUpButtonPart:
00622             if (GetValue() > GetMinimum())
00623                 DeltaValue(-fButtonStep);
00624             break;
00625         case kControlPageDownPart:
00626             if (GetValue() < GetMaximum())
00627                 DeltaValue(fPageStep);
00628             break;
00629         case kControlDownButtonPart:
00630             if (GetValue() < GetMaximum())
00631                 DeltaValue(fButtonStep);
00632             break;
00633     }
00634 }

Member Data Documentation

TPseudoScrollBar::MA_DECLARE_CLASS [private]

Definition at line 29 of file UPseudoSupport.h.

int TPseudoScrollBar::fButtonStep [private]

Definition at line 37 of file UPseudoSupport.h.

int TPseudoScrollBar::fPageStep [private]

Definition at line 36 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPseudoTextListView Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TPseudoTextListView:

[legend]
Collaboration diagram for TPseudoTextListView:

[legend]
List of all members.

Public Types

enum | { kTextStringListViewSignature = 'TxLv', kSelectionChanged = 'TxSC', kMultiClickSelection = 'TxMu' }

Public Methods

TPseudoTextListView ()
virtual | ~TPseudoTextListView ()
virtual IDType | GetStandardSignature (void) const
virtual CStr255_AC | GetItemText (GridCoordinate) const
virtual void | InsStringBefore (short anItem, const char *string)
virtual void | InsStringFirst (const char *string)
virtual void | InsStringLast (const char *string)
virtual void | DelItemAt (GridCoordinate anItem, GridCoordinate numOfItems)
virtual void | RemoveAll (void)
virtual void | DoKeyEvent (TToolboxEvent *event)
virtual void | DoMouseCommand (CViewPoint &theMouse, TToolboxEvent *event, CPoint_AC)
virtual void | SetSelection (const TGridViewDesignator *cellsToSelect, bool extendSelection, bool highlight, bool select)

Protected Methods

virtual bool | DoMouseCommand_SelectCells (GridCell whichCell, class TToolboxEvent *event)

Protected Attributes

std::vector< CStr255_AC > | fStringContainer

Private Attributes

MA_DECLARE_CLASS

Member Enumeration Documentation

anonymous enum

Enumeration values:
kTextStringListViewSignature
kSelectionChanged
kMultiClickSelection

Definition at line 186 of file UPseudoSupport.h.

00187     {
00188         kTextStringListViewSignature = 'TxLv',
00189
00190         kSelectionChanged = 'TxSC',
00191         kMultiClickSelection = 'TxMu'
00192     };

Constructor & Destructor Documentation

TPseudoTextListView::TPseudoTextListView ( )

Definition at line 127 of file UPseudoSupport.cpp.

00128 {
00129 }

TPseudoTextListView::~TPseudoTextListView ( ) [virtual]

Definition at line 133 of file UPseudoSupport.cpp.

00134 {
00135 }

Member Function Documentation

void TPseudoTextListView::DelItemAt | ( | GridCoordinate | anItem,
 |  | GridCoordinate | numOfItems
 | ) | [virtual]

Definition at line 186 of file UPseudoSupport.cpp.

00187 {
00188     this->fStringContainer.erase(
00189             this->fStringContainer.begin() + (anItem - 1),
00190             this->fStringContainer.begin() + (anItem - 1 + numOfItems));
00191
00192     this->Inherited::DelItemAt(anItem, numOfItems);
00193 }

void TPseudoTextListView::DoKeyEvent ( TToolboxEvent * event ) [virtual]

Definition at line 277 of file UPseudoSupport.cpp.

00278 {
00279     Boolean handledCharacter = false;
00280
00281     if (this->IsEnabled() && this->Focus())     // if view is not enabled then we don't take ANY keystrokes
00282     {
00283         GridCell selected;
00284         unsigned char ch = event->GetText()[1];
00285
00286         if (ch == chUp)
00287         {
00288             selected = this->FirstSelectedCell();
00289             selected.v -= 1;
00290
00291             this->DoMouseCommand_SelectCells(selected, event);
00292
00293             handledCharacter = true;
00294         }
00295         else if (ch == chDown)
00296         {
00297             selected = this->LastSelectedCell();
00298             selected.v += 1;
00299
00300             this->DoMouseCommand_SelectCells(selected, event);
00301
00302             handledCharacter = true;
00303         }
00304     }
00305
00306     if (!handledCharacter)
00307         Inherited::DoKeyEvent(event);
00308 }

void TPseudoTextListView::DoMouseCommand | ( | CViewPoint & | theMouse,
 |  | TToolboxEvent * | event,
 |  | CPoint_AC |
 | ) | [virtual]

Definition at line 261 of file UPseudoSupport.cpp.

00262 {
00263     GridCell aCell;
00264
00265     if (badChoice != this->IdentifyPoint(theMouse, aCell))
00266     {
00267         this->DoMouseCommand_SelectCells(aCell, event);
00268             // First be sure to select/deselect the cell they clicked on.
00269
00270         if (event->GetClickCount() > 1)
00271         {
00272             this->HandleEvent(kMultiClickSelection, this, event);
00273         }
00274     }
00275 }

bool TPseudoTextListView::DoMouseCommand_SelectCells | ( | GridCell | whichCell,
 |  | class TToolboxEvent * | event
 | ) | [protected, virtual]

Definition at line 200 of file UPseudoSupport.cpp.

Referenced by DoMouseCommand().

00201 {
00202     MA_CHECK(nil != event);
00203
00204     bool selectionChanged = false;
00205         // Will be true if the selection changed.
00206
00207     if (this->CanSelectCell(whichCell))
00208     {
00209         bool shifted = event->IsShiftKeyPressed();
00210         bool commandKey = event->IsCommandKeyPressed();
00211
00212         if (commandKey)
00213         {
00214             this->SelectCell(whichCell, !this->fSingleSelection,
00215                     kHighlight, !this->IsCellSelected(whichCell));
00216
00217             selectionChanged = true;
00218         }
00219         else if (shifted && !this->fSingleSelection)
00220         {
00221             GridCell runner = whichCell;
00222
00223             if (this->IsCellSelected(whichCell))
00224             {
00225                 for ( ; runner.v <= this->fNumOfRows; runner.v++)
00226                 {
00227                     if (!this->IsCellSelected(runner))
00228                     {
00229                         break;
00230                     }
00231
00232                     this->SelectCell(runner, kExtend, kHighlight, kDeSelect);
00233                 }
00234             }
00235             else
00236             {
00237                 for ( ; runner.v > 0; runner.v--)
00238                 {
00239                     if (this->IsCellSelected(runner))
00240                     {
00241                         break;
00242                     }
00243
00244                     this->SelectCell(runner, kExtend, kHighlight, kSelect);
00245                 }
00246             }
00247
00248             selectionChanged = true;
00249         }
00250         else if (!this->IsCellSelected(whichCell))
00251         {
00252             this->SelectCell(whichCell, kDontExtend, kHighlight, kSelect);
00253
00254             selectionChanged = true;
00255         }
00256     }
00257
00258     return selectionChanged;
00259 }

CStr255_AC TPseudoTextListView::GetItemText ( GridCoordinate anItem ) const [virtual]

Definition at line 143 of file UPseudoSupport.cpp.

Referenced by TPseudoWinBehavior::DoEvent().

00144 {
00145     MA_CHECK(this->fNumOfRows == this->fStringContainer.size());
00146     MA_CHECK(1 <= anItem && this->fStringContainer.size() >= anItem);
00147
00148     CStr255_AC aString = this->fStringContainer[anItem - 1];
00149     return aString;
00150 }

IDType TPseudoTextListView::GetStandardSignature ( void ) const [virtual]

Definition at line 138 of file UPseudoSupport.cpp.

00139 {
00140     return TPseudoTextListView::kTextStringListViewSignature;
00141 }

void TPseudoTextListView::InsStringBefore | ( | short | anItem,
 |  | const char * | string
 | ) | [virtual]

Definition at line 152 of file UPseudoSupport.cpp.

Referenced by InsStringFirst(), and InsStringLast().

00153 {
00154     MA_CHECK(1 <= anItem && this->fStringContainer.size() >= anItem - 1);
00155
00156     std::vector<CStr255_AC>::iterator iter = this->fStringContainer.end();
00157
00158     try
00159     {
00160         iter = this->fStringContainer.insert(
00161                     this->fStringContainer.begin() + (anItem - 1), string);
00162     }
00163     catch(CException_AC& theException)
00164     {
00165         if (iter != this->fStringContainer.end())
00166         {
00167             this->fStringContainer.erase(iter);
00168                 // Put it back like it was.  This will maintain internal consistency.
00169         }
00170         throw;
00171     }
00172
00173     this->InsItemBefore(anItem, 1);
00174 }

void TPseudoTextListView::InsStringFirst ( const char * string ) [virtual]

Definition at line 176 of file UPseudoSupport.cpp.

00177 {
00178     this->InsStringBefore(1, string);
00179 }

void TPseudoTextListView::InsStringLast ( const char * string ) [virtual]

Definition at line 181 of file UPseudoSupport.cpp.

00182 {
00183     this->InsStringBefore(this->fNumOfRows + 1, string);
00184 }

void TPseudoTextListView::RemoveAll ( void ) [virtual]

Definition at line 195 of file UPseudoSupport.cpp.

00196 {
00197     this->DelItemFirst(this->fNumOfRows);
00198 }

void TPseudoTextListView::SetSelection | ( | const TGridViewDesignator * | cellsToSelect,
 |  | bool | extendSelection,
 |  | bool | highlight,
 |  | bool | select
 | ) | [virtual]

Definition at line 310 of file UPseudoSupport.cpp.

00312 {
00313     this->Inherited::SetSelection(cellsToSelect, extendSelection, highlight, select);
00314
00315     this->Changed(kSelectionChanged, this);
00316     this->HandleEvent(kSelectionChanged, this, nil);
00317 }

Member Data Documentation

TPseudoTextListView::MA_DECLARE_CLASS [private]

Definition at line 183 of file UPseudoSupport.h.

std::vector<CStr255_AC> TPseudoTextListView::fStringContainer [protected]

Definition at line 216 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPseudoWinAdorner Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TPseudoWinAdorner:

[legend]
Collaboration diagram for TPseudoWinAdorner:

[legend]
List of all members.

Public Types

enum | { kPseudoWinAdorner = 'pswa' }

Public Methods

TPseudoWinAdorner ()
virtual | ~TPseudoWinAdorner ()
virtual void | ViewChangedFrame (TView *itsView, const CViewRect &oldFrame, const CViewRect &newFrame, bool invalidate)

Protected Methods

void | SetPseudoWidget (int widid)

Protected Attributes

int | fWidID

Private Attributes

MA_DECLARE_CLASS

Friends

class | UWidget

Member Enumeration Documentation

anonymous enum

Enumeration values:
kPseudoWinAdorner

Definition at line 149 of file UPseudoSupport.h.

00150     {
00151         kPseudoWinAdorner = 'pswa'
00152     };

Constructor & Destructor Documentation

TPseudoWinAdorner::TPseudoWinAdorner ( )

Definition at line 732 of file UPseudoSupport.cpp.

00732                                      : TAdorner(kPseudoWinAdorner), fWidID(-1)
00733 {
00734 }

TPseudoWinAdorner::~TPseudoWinAdorner ( ) [virtual]

Definition at line 736 of file UPseudoSupport.cpp.

00737 {
00738     if(fWidID != -1)
00739         UEventSendMessage(fWidID, EV_DESTROY, 0, 0L);
00740 }

Member Function Documentation

void TPseudoWinAdorner::SetPseudoWidget ( int widid ) [inline, protected]

Definition at line 163 of file UPseudoSupport.h.

Referenced by UWidget::OnInitWidget().

00163 { fWidID = widid; }

void TPseudoWinAdorner::ViewChangedFrame | ( | TView * | itsView,
 |  | const CViewRect & | oldFrame,
 |  | const CViewRect & | newFrame,
 |  | bool | invalidate
 | ) | [virtual]

Definition at line 742 of file UPseudoSupport.cpp.

00746 {
00747     TWindow *wind = itsView->GetWindow();
00748     if(wind != 0L && fWidID != -1)
00749     {
00750         int cmdid = UEventSendMessage(fWidID, EV_FETCHCMD, 0, itsView);
00751         if(cmdid != -1)
00752         {
00753             URECT r;
00754             r.left = newFrame.left;
00755             r.right = newFrame.right;
00756             r.top = newFrame.top;
00757             r.bottom = newFrame.bottom;
00758
00759             UEventSendMessage(fWidID, EV_RESIZE, cmdid, &r);
00760         }
00761     }
00762 }

Friends And Related Function Documentation

friend class UWidget [friend]

Definition at line 167 of file UPseudoSupport.h.

Member Data Documentation

TPseudoWinAdorner::MA_DECLARE_CLASS [private]

Definition at line 146 of file UPseudoSupport.h.

int TPseudoWinAdorner::fWidID [protected]

Definition at line 165 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TPseudoWinBehavior Class Reference

#include <UPseudoSupport.h>

Inheritance diagram for TPseudoWinBehavior:

[legend]
Collaboration diagram for TPseudoWinBehavior:

[legend]
List of all members.

Public Types

enum | { kPseudoWinBehavior = 'pswb' }

Public Methods

TPseudoWinBehavior ()
virtual | ~TPseudoWinBehavior ()
virtual void | DoEvent (EventNumber eventNumber, TEventHandler *source, TEvent *event)
int | GetWidID () const

Protected Methods

void | SetPseudoWidget (int widid)

Protected Attributes

int | fWidID

Private Attributes

MA_DECLARE_CLASS

Friends

class | UWidget

Member Enumeration Documentation

anonymous enum

Enumeration values:
kPseudoWinBehavior

Definition at line 125 of file UPseudoSupport.h.

00126     {
00127         kPseudoWinBehavior = 'pswb'
00128     };

Constructor & Destructor Documentation

TPseudoWinBehavior::TPseudoWinBehavior ( )

Definition at line 35 of file UPseudoSupport.cpp.

00035                                        : TBehavior(kPseudoWinBehavior), fWidID(-1)
00036 {
00037 }

TPseudoWinBehavior::~TPseudoWinBehavior ( ) [virtual]

Definition at line 39 of file UPseudoSupport.cpp.

00040 {
00041 }

Member Function Documentation

void TPseudoWinBehavior::DoEvent | ( | EventNumber | eventNumber,
 |  | TEventHandler * | source,
 |  | TEvent * | event
 | ) | [virtual]

Definition at line 43 of file UPseudoSupport.cpp.

00044 {
00045     // find out the command who fired the event (if any)
00046     int cmdid = -1;
00047
00048     // the typing event is originated by a sub-view of an TEditText field
00049     TEventHandler* ourSource = source;
00050     if(eventNumber == cTyping && MA_MEMBER(ourSource, TDialogTEView))
00051     {
00052         ourSource = ((TDialogTEView *)ourSource)->fEditText;
00053     }
00054
00055     if(fWidID != -1)
00056         cmdid = UEventSendMessage(fWidID, EV_FETCHCMD, 0, ourSource);
00057
00058     if(cmdid != -1) switch(eventNumber)
00059     {
00060         case mBecameTarget:
00061         case mResignedTarget:
00062             UEventNotifyMessage(EV_UPDATEFOCUS, eventNumber == mResignedTarget, ourSource);
00063             break;
00064         case mButtonHit:
00065         case mRadioHit:
00066         case mCheckBoxHit:
00067             UEventSendMessage(fWidID, EV_CMD, cmdid, 0L);
00068             break;
00069         case mHScrollBarHit:
00070         case mVScrollBarHit:
00071             if(MA_MEMBER(ourSource, TSlider) || MA_MEMBER(ourSource, TScrollBar))
00072             {
00073                 TCtlMgr *slider = (TCtlMgr *)ourSource;
00074                 UEventSendMessage(fWidID, EV_SCROLLCHANGE, cmdid, (void *)slider->GetValue());
00075             }
00076             break;
00077         case mPopupHit:
00078             if(MA_MEMBER(ourSource, TPopup))
00079             {
00080                 TPopup *popup = (TPopup *)ourSource;
00081                 short cur = popup->GetCurrentItem();
00082                 CStr255_AC pstr = popup->GetItemText(cur);
00083                 UPStr content(pstr);
00084                 UEventSendMessage(fWidID, EV_COMBO_SEL, UMAKEINT(cmdid, cur - 1),
00085                     (void *)(const char *)content);
00086             }
00087             break;
00088         case mControlHit:
00089             if(MA_MEMBER(ourSource, TSlider))
00090             {
00091                 TSlider *slider = (TSlider *)ourSource;
00092                 UEventSendMessage(fWidID, EV_SCROLLCHANGE, cmdid, (void *)slider->GetValue());
00093             }
00094             break;
00095         case cTyping:
00096             if(MA_MEMBER(ourSource, TEditText))
00097             {
00098                 UEventSendMessage(fWidID, EV_EDITCHANGE, cmdid, 0L);
00099             }
00100             break;
00101         case TPseudoTextListView::kSelectionChanged:
00102         case TPseudoTextListView::kMultiClickSelection:
00103             if(MA_MEMBER(ourSource, TPseudoTextListView))
00104             {
00105                 TPseudoTextListView *txt = (TPseudoTextListView *)ourSource;
00106                 short entry = txt->FirstSelectedItem();
00107                 CChar255_AC name;
00108                 if(entry > 0)
00109                     name = txt->GetItemText(entry);
00110
00111                 UEventSendMessage(fWidID,
00112                     eventNumber == TPseudoTextListView::kSelectionChanged ?
00113                     EV_LIST_SELECTING : EV_LIST_DBLCLICK, UMAKEINT(cmdid, entry - 1),
00114                     (void *)(const char *)name);
00115             }
00116             break;
00117     }
00118
00119     Inherited::DoEvent(eventNumber, source, event);
00120 }

int TPseudoWinBehavior::GetWidID ( ) const [inline]

Definition at line 135 of file UPseudoSupport.h.

Referenced by TPseudoCustomView::Draw().

00135 { return fWidID; }

void TPseudoWinBehavior::SetPseudoWidget ( int widid ) [inline, protected]

Definition at line 137 of file UPseudoSupport.h.

Referenced by UWidget::OnInitWidget().

00137 { fWidID = widid; }

Friends And Related Function Documentation

friend class UWidget [friend]

Definition at line 141 of file UPseudoSupport.h.

Member Data Documentation

TPseudoWinBehavior::MA_DECLARE_CLASS [private]

Definition at line 122 of file UPseudoSupport.h.

int TPseudoWinBehavior::fWidID [protected]

Definition at line 139 of file UPseudoSupport.h.

The documentation for this class was generated from the following files:
  • rf/support/macapp/UPseudoSupport.h
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TraversalReport Class Reference

#include <FileTraversal.h>

Inheritance diagram for TraversalReport:

[legend]
Collaboration diagram for TraversalReport:

[legend]
List of all members.

Public Methods

virtual kTraversal | EnterDirectory (const char *fullpath, const char *dirname, const FSSpec *macspec)
virtual kTraversal | ExitDirectory (const char *fullpath)
virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnIdle (const char *fullpath)
virtual kTraversal | OnAnyDevice (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
virtual kTraversal | OnDirectory (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
virtual kTraversal | OnFile (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
virtual kTraversal | OnAlias (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)

Static Public Attributes

bool | gRunning = false

Member Function Documentation

virtual kTraversal TraversalReport::EnterDirectory | ( | const char * | fullpath,
 |  | const char * | dirname,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented in ImportReport, CFillPyEntries, CFillTclEntries, TViewFill, TBrowserFillDummy, TBrowserFill, TViewFill, TBrowserFillDummy, and TBrowserFill.

Definition at line 97 of file FileTraversal.h.

Referenced by FileTraverse().

00098     {
00099         return kContinueTraversal;
00100     }

virtual kTraversal TraversalReport::ExitDirectory ( const char * fullpath ) [inline, virtual]

Reimplemented in ImportReport, CFillPyEntries, CFillTclEntries, TViewFill, TBrowserFillDummy, TBrowserFill, TViewFill, TBrowserFillDummy, and TBrowserFill.

Definition at line 102 of file FileTraversal.h.

Referenced by FileTraverse().

00103     {
00104         return kContinueTraversal;
00105     }

virtual kTraversal TraversalReport::OnAlias | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented in ImportReport, CFillPyEntries, CFillTclEntries, and TViewFill.

Definition at line 141 of file FileTraversal.h.

Referenced by FileTraverse().

00145     {
00146         return OnAnyDevice(fullpath, fullname, name, dir, macspec);
00147     }

virtual kTraversal TraversalReport::OnAnyDevice | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Definition at line 117 of file FileTraversal.h.

Referenced by OnAlias(), OnDirectory(), and OnFile().

00121     {
00122         return kContinueTraversal;
00123     }

virtual kTraversal TraversalReport::OnDirectory | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented in ImportReport, CFillPyEntries, CFillTclEntries, TViewFill, TBrowserFillDummy, and TBrowserFill.

Definition at line 125 of file FileTraversal.h.

Referenced by FileTraverse().

00129     {
00130         return OnAnyDevice(fullpath, fullname, name, dir, macspec);
00131     }

virtual kTraversal TraversalReport::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented in ImportReport, MacroTraversal, CFindSettings, CFillPyEntries, CFillTclEntries, TViewFill, TBrowserFillDummy, TBrowserFill, TViewFill, TBrowserFillDummy, and TBrowserFill.

Definition at line 107 of file FileTraversal.h.

Referenced by FileTraverse().

00108     {
00109         return kTraversalError;
00110     }

virtual kTraversal TraversalReport::OnFile | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented in ImportReport, MacroTraversal, CFindSettings, CFillPyEntries, CFillTclEntries, and TViewFill.

Definition at line 133 of file FileTraversal.h.

Referenced by FileTraverse(), TViewFill::OnAlias(), CFillTclEntries::OnAlias(), and CFillPyEntries::OnAlias().

00137     {
00138         return OnAnyDevice(fullpath, fullname, name, dir, macspec);
00139     }

virtual kTraversal TraversalReport::OnIdle ( const char * fullpath ) [inline, virtual]

Reimplemented in ImportReport, CFillPyEntries, CFillTclEntries, TViewFill, TBrowserFillDummy, TBrowserFill, TViewFill, TBrowserFillDummy, and TBrowserFill.

Definition at line 112 of file FileTraversal.h.

Referenced by FileTraverse().

00113     {
00114         return kContinueTraversal;
00115     }

Member Data Documentation

bool TraversalReport::gRunning = false [static]

Definition at line 93 of file FileTraversal.cpp.

The documentation for this class was generated from the following files:
  • common/FileTraversal.h
  • common/FileTraversal.cpp
Generated on Sun Oct 21 12:50:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


tree_desc_s Struct Reference

#include <deflate.h>

Collaboration diagram for tree_desc_s:

[legend]
List of all members.

Public Attributes

ct_data * dyn_tree
int max_code
static_tree_desc * stat_desc

Member Data Documentation

ct_data* tree_desc_s::dyn_tree

Definition at line 69 of file deflate.h.

int tree_desc_s::max_code

Definition at line 70 of file deflate.h.

static_tree_desc* tree_desc_s::stat_desc

Definition at line 71 of file deflate.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/zlib/deflate.h
Generated on Sun Oct 21 12:50:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UTREE_INFO Struct Reference

#include <umain.h>

Collaboration diagram for UTREE_INFO:

[legend]
List of all members.

Public Attributes

UTREEITEM item
UTREEITEM parent
UTREEITEM next
UTREEITEM child
void * | data
char * | title
void * | icon
int | expanded

Member Data Documentation

UTREEITEM UTREE_INFO::child

Definition at line 928 of file umain.h.

Referenced by UCvsFolders::DeleteAllItems(), UCvsFolders::GetItemByLocation(), UWidget::OnTreeGetInfo(), UCvsFolders::StepToLocation(), and UCvsFolders::StoreExpanded().

void* UTREE_INFO::data

Definition at line 929 of file umain.h.

Referenced by UCvsFolders::DeleteAllItems(), TBrowserFill::ExitDirectory(), TBrowserFillDummy::ExitDirectory(), UCvsFolders::GetItemByLocation(), UCvsFolders::OnCmdMacrosSel(), UCvsFolders::OnTreeExpanding(), UWidget::OnTreeGetInfo(), UCvsFolders::OnTreeSelecting(), UWidget::OnTreeSetData(), and UCvsFolders::StepToLocation().

int UTREE_INFO::expanded

Definition at line 932 of file umain.h.

Referenced by UWidget::OnTreeGetInfo(), and UCvsFolders::StoreExpanded().

void* UTREE_INFO::icon

Definition at line 931 of file umain.h.

Referenced by TBrowserFill::ExitDirectory(), TBrowserFill::OnDirectory(), UWidget::OnTreeGetInfo(), and UWidget::OnTreeSetIcon().

UTREEITEM UTREE_INFO::item

Definition at line 925 of file umain.h.

Referenced by UCvsFolders::DeleteAllItems(), TBrowserFill::ExitDirectory(), TBrowserFillDummy::ExitDirectory(), UCvsFolders::GetItemByLocation(), UCvsFolders::OnCmdMacrosSel(), TBrowserFill::OnDirectory(), UCvsFolders::OnTreeExpanding(), UWidget::OnTreeGetInfo(), UCvsFolders::OnTreeSelecting(), UWidget::OnTreeSetData(), UWidget::OnTreeSetIcon(), UCvsFolders::RetrievePath(), UCvsFolders::StepToLocation(), and UCvsFolders::StoreExpanded().

UTREEITEM UTREE_INFO::next

Definition at line 927 of file umain.h.

Referenced by UCvsFolders::DeleteAllItems(), UCvsFolders::GetItemByLocation(), UWidget::OnTreeGetInfo(), UCvsFolders::StepToLocation(), and UCvsFolders::StoreExpanded().

UTREEITEM UTREE_INFO::parent

Definition at line 926 of file umain.h.

Referenced by UWidget::OnTreeGetInfo(), and UCvsFolders::RetrievePath().

char* UTREE_INFO::title

Definition at line 930 of file umain.h.

Referenced by UWidget::OnTreeGetInfo(), and UCvsFolders::RetrievePath().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:50:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UTREE_INSERT Struct Reference

#include <umain.h>

Collaboration diagram for UTREE_INSERT:

[legend]
List of all members.

Public Attributes

const char * | title
UTREEITEM parent
UTREEITEM result
void * | icon
void * | data

Member Data Documentation

void* UTREE_INSERT::data

Definition at line 920 of file umain.h.

Referenced by TBrowserFillDummy::ExitDirectory(), UCvsFolders::OnTreeExpanding(), and UWidget::OnTreeInsert().

void* UTREE_INSERT::icon

Definition at line 919 of file umain.h.

Referenced by TBrowserFillDummy::ExitDirectory(), UCvsFolders::OnTreeExpanding(), and UWidget::OnTreeInsert().

UTREEITEM UTREE_INSERT::parent

Definition at line 917 of file umain.h.

Referenced by TBrowserFillDummy::ExitDirectory(), UCvsFolders::OnTreeExpanding(), and UWidget::OnTreeInsert().

UTREEITEM UTREE_INSERT::result

Definition at line 918 of file umain.h.

Referenced by TBrowserFillDummy::ExitDirectory(), and UWidget::OnTreeInsert().

const char* UTREE_INSERT::title

Definition at line 916 of file umain.h.

Referenced by TBrowserFillDummy::ExitDirectory(), UCvsFolders::OnTreeExpanding(), and UWidget::OnTreeInsert().

The documentation for this struct was generated from the following file:
  • rf/umain.h
Generated on Sun Oct 21 12:50:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTreeCtrl Class Reference

Inheritance diagram for CTreeCtrl:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJTreeCtrl.h
Generated on Sun Oct 21 12:50:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTreeView Class Reference

Inheritance diagram for CTreeView:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/WinCvsBrowser.h
Generated on Sun Oct 21 12:50:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TScrollBar Class Reference

Inheritance diagram for TScrollBar:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/macapp/UPseudoSupport.h
Generated on Sun Oct 21 12:50:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TTextListView Class Reference

Inheritance diagram for TTextListView:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/macapp/UPseudoSupport.h
Generated on Sun Oct 21 12:50:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CTurnOffDispatching Class Reference

Collaboration diagram for CTurnOffDispatching:

[legend]
List of all members.

Public Methods

CTurnOffDispatching ()
~CTurnOffDispatching ()

Protected Attributes

bool m_didSetIt

Constructor & Destructor Documentation

CTurnOffDispatching::CTurnOffDispatching ( ) [inline]

Definition at line 126 of file uevent.cpp.

00126                           : m_didSetIt(false)
00127     {
00128         if(!sTurnOffDispatching)
00129         {
00130             m_didSetIt = true;
00131             sTurnOffDispatching = true;
00132         }
00133     }

CTurnOffDispatching::~CTurnOffDispatching ( ) [inline]

Definition at line 135 of file uevent.cpp.

00136     {
00137         if(m_didSetIt)
00138             sTurnOffDispatching = false;
00139     }

Member Data Documentation

bool CTurnOffDispatching::m_didSetIt [protected]

Definition at line 141 of file uevent.cpp.

The documentation for this class was generated from the following file:
  • rf/uevent.cpp
Generated on Sun Oct 21 12:50:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TView Class Reference

Inheritance diagram for TView:

[legend]
The documentation for this class was generated from the following file:
  • rf/support/macapp/UPseudoSupport.h
Generated on Sun Oct 21 12:50:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


TViewFill Class Reference

Inheritance diagram for TViewFill:

[legend]
Collaboration diagram for TViewFill:

[legend]
List of all members.

Public Methods

TViewFill (UCvsFiles *listCtrl, CSortList< ENTNODE > &entries)
virtual | ~TViewFill ()
virtual kTraversal | EnterDirectory (const char *fullpath, const char *dirname, const FSSpec *macspec)
virtual kTraversal | ExitDirectory (const char *fullpath)
virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnIdle (const char *fullpath)
virtual kTraversal | OnDirectory (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
virtual kTraversal | OnAlias (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
virtual kTraversal | OnFile (const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec)
TViewFill (const KoTraversalContext *context)
CBrowseFileView * | GetView () const
CListCtrl & | GetListCtrl () const
bool | IsRecursive () const
bool | IsShowIgnored () const
virtual kTraversal | EnterDirectory (const char *fullpath, const char *dirname, const FSSpec *macspec)
virtual kTraversal | ExitDirectory (const char *fullpath)
int | InitItem (EntnodeData *data, int iImage, const char *tag=0L)
virtual kTraversal | OnError (const char *err, int errcode)
virtual kTraversal | OnIdle (const char *fullpath)
virtual kTraversal | OnDirectory (const char *fullpath, const char *fullname, const char *name, const struct wnt_stat &dir, const FSSpec *macspec)
virtual kTraversal | OnAlias (const char *fullpath, const char *fullname, const char *name, const struct wnt_stat &dir, const FSSpec *macspec)
virtual kTraversal | OnFile (const char *fullpath, const char *fullname, const char *name, const struct wnt_stat &dir, const FSSpec *macspec)

Public Attributes

UCvsFiles * m_listCtrl
CSortList< ENTNODE > & m_entries
vector< UStr > | m_ignlist
CSortList< ENTNODE > m_entries
const KoTraversalContext * | m_context

Constructor & Destructor Documentation

TViewFill::TViewFill | ( | UCvsFiles * | listCtrl,
 |  | CSortList< ENTNODE > & | entries
 | ) | [inline]

Definition at line 215 of file UCvsFiles.cpp.

00215                                                                  :
00216         m_listCtrl(listCtrl), m_entries(entries) {}

virtual TViewFill::~TViewFill ( ) [inline, virtual]

Definition at line 218 of file UCvsFiles.cpp.

00218 {}

TViewFill::TViewFill ( const KoTraversalContext * context ) [inline]

Definition at line 215 of file BrowseFileView.cpp.

00216     : m_context(context)
00217     , m_entries(200, ENTNODE::Compare)
00218     { }

Member Function Documentation

virtual kTraversal TViewFill::EnterDirectory | ( | const char * | fullpath,
 |  | const char * | dirname,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 240 of file BrowseFileView.cpp.

00241     {
00242         Entries_Open (m_entries, fullpath);
00243         BuildIgnoredList(m_ignlist, fullpath);
00244         return kContinueTraversal;
00245     }

virtual kTraversal TViewFill::EnterDirectory | ( | const char * | fullpath,
 |  | const char * | dirname,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 220 of file UCvsFiles.cpp.

00221     {
00222         Entries_Open (m_entries, fullpath);
00223         BuildIgnoredList(m_ignlist, fullpath);
00224
00225         return kContinueTraversal;
00226     }

virtual kTraversal TViewFill::ExitDirectory ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 247 of file BrowseFileView.cpp.

00248     {
00249         // add the missing files
00250         Entries_SetMissing(m_entries);
00251
00252         int numEntries = m_entries.NumOfElements();
00253         for(int i = 0; i < numEntries; i++)
00254         {
00255             const ENTNODE & theNode = m_entries.Get(i);
00256             EntnodeData *data = theNode.Data();
00257             if (data->IsMissing() && m_context->IsMatch(data))
00258             {
00259                 if (!IsRecursive() || data->GetType() == ENT_FILE)
00260                 {
00261                     int iImage = data->GetType() == ENT_FILE ?
00262                                 (data->IsRemoved() ? kFileIconRemoved : kFileIconMiss) : kFolderIconMiss;
00263                     InitItem(data, iImage);
00264                 }
00265             }
00266         }
00267
00268         m_ignlist.clear();
00269         return kContinueTraversal;
00270     }

virtual kTraversal TViewFill::ExitDirectory ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 228 of file UCvsFiles.cpp.

00229     {
00230         m_ignlist.erase(m_ignlist.begin(), m_ignlist.end());
00231         return kContinueTraversal;
00232     }

CListCtrl& TViewFill::GetListCtrl ( ) const [inline]

Definition at line 225 of file BrowseFileView.cpp.

Referenced by InitItem(), and OnFile().

00226     {
00227         return GetView()->GetListCtrl();
00228     }

CBrowseFileView* TViewFill::GetView ( ) const [inline]

Definition at line 220 of file BrowseFileView.cpp.

Referenced by GetListCtrl(), and InitItem().

00221     {
00222         return m_context->m_view;
00223     }

int TViewFill::InitItem | ( | EntnodeData * | data,
 |  | int | iImage,
 |  | const char * | tag = 0L
 | ) | [inline]

Definition at line 273 of file BrowseFileView.cpp.

Referenced by ExitDirectory(), OnDirectory(), and OnFile().

00274     {
00275         CListCtrl& listCtrl = GetListCtrl();
00276         KoColumnContext context(GetView()->GetPath());
00277         TCHAR buf[256];
00278         GetView()->GetColumnModel()->GetAt(0)->GetText(&context, data, buf, 256);
00279
00280         LV_ITEM lvi;
00281         lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
00282         lvi.iItem = listCtrl.GetItemCount();
00283         lvi.iSubItem = 0;
00284         lvi.pszText = buf;
00285         lvi.iImage = iImage;
00286         lvi.lParam = (LPARAM)(LPVOID)data;
00287         int pos = listCtrl.InsertItem(&lvi);
00288         if (pos >= 0)
00289         {
00290             // note ownership addition
00291             data->Ref();
00292
00293             // set item text for additional columns
00294             KiColumnModel* model = GetView()->GetColumnModel();
00295             int columnCount = model->GetCount();
00296             for(int j = 1; j < columnCount; j++)
00297             {
00298                 TCHAR buf[256];
00299                 model->GetAt(j)->GetText(&context, data, buf, 256);
00300                 listCtrl.SetItemText(pos, j, buf);
00301             }
00302
00303             if(tag != 0L && tag[0] != '\0' && !IsRecursive())
00304                 listCtrl.SetItemText(pos, EntnodeFile::kTag, tag);
00305         }
00306         return pos;
00307     }

bool TViewFill::IsRecursive ( ) const [inline]

Definition at line 230 of file BrowseFileView.cpp.

Referenced by ExitDirectory(), InitItem(), and OnDirectory().

00231     {
00232         return m_context->IsRecursive();
00233     }

bool TViewFill::IsShowIgnored ( ) const [inline]

Definition at line 235 of file BrowseFileView.cpp.

Referenced by OnDirectory(), and OnFile().

00236     {
00237         return m_context->IsShowIgnored();
00238     }

virtual kTraversal TViewFill::OnAlias | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct wnt_stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Definition at line 357 of file BrowseFileView.cpp.

00361     {
00362         return OnFile(fullpath, fullname, name, dir, macspec);
00363     }

virtual kTraversal TViewFill::OnAlias | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 306 of file UCvsFiles.cpp.

00310     {
00311         return OnFile(fullpath, fullname, name, dir, macspec);
00312     }

virtual kTraversal TViewFill::OnDirectory | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct wnt_stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Definition at line 320 of file BrowseFileView.cpp.

00324     {
00325         if(stricmp(name, "CVS") == 0)
00326             return kSkipFile;
00327
00328         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00329         if (!IsShowIgnored() && data->IsIgnored())
00330         {
00331             return kSkipFile;
00332         }
00333
00334         if (IsRecursive())
00335         {
00336             if (!data->IsIgnored() && !data->IsUnknown() && !data->IsMissing())
00337             {
00338                 TViewFill traverse(m_context);
00339                 FileTraverse(fullname, traverse);
00340             }
00341             return kSkipFile;
00342         }
00343
00344         // get the tag
00345         CStr subCVS;
00346         CStr tagName;
00347         subCVS = fullname;
00348         if(!subCVS.endsWith(kPathDelimiter))
00349             subCVS << kPathDelimiter;
00350         subCVS << "CVS";
00351         Tag_Open(tagName, subCVS);
00352
00353         InitItem(data, CBrowseFileView::GetImageForEntry(data), tagName);
00354         return kSkipFile;
00355     }

virtual kTraversal TViewFill::OnDirectory | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 244 of file UCvsFiles.cpp.

00248     {
00249 #if qUnix
00250         if(strcmp(name, "CVS") == 0)
00251 #else
00252         if(stricmp(name, "CVS") == 0)
00253 #endif
00254             return kSkipFile;
00255
00256         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, true, &m_ignlist);
00257         if(!(bool)gFileViewIgnore && data->IsIgnored())
00258             return kSkipFile;
00259
00260         // get the tag
00261         CStr subCVS;
00262         CStr tagName;
00263         subCVS = fullname;
00264         if(!subCVS.endsWith(kPathDelimiter))
00265             subCVS << kPathDelimiter;
00266         subCVS << "CVS";
00267         if(chdir(subCVS) == 0)
00268             Tag_Open(tagName, subCVS);
00269         if(chdir(fullpath) != 0)
00270             return kTraversalError;
00271
00272         int rownum;
00273         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_NEWROW, kUMainWidget, &rownum);
00274         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_ROWSETDATA, UMAKEINT(kUMainWidget, rownum), data);
00275         ULIST_INSERT entry;
00276         entry.row = rownum;
00277
00278         entry.col = 0;
00279         entry.title = name;
00280         entry.icon = UCvsFiles::GetImageForEntry(data);
00281         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00282
00283         entry.icon = 0L;
00284
00285         // set item text for additional columns
00286         for(int j = 1; j < NUM_COLUMNS; j++)
00287         {
00288             const char *info = (*data)[j];
00289             if(info != 0L)
00290             {
00291                 entry.col = j;
00292                 entry.title = info;
00293                 UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00294             }
00295         }
00296         entry.col = EntnodeData::kStatus;
00297         entry.title = data->GetDesc();
00298         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00299         entry.col = EntnodeFile::kTag;
00300         entry.title = tagName.empty() ? "" : (const char *)tagName;
00301         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00302
00303         return kSkipFile;
00304     }

virtual kTraversal TViewFill::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 310 of file BrowseFileView.cpp.

00311     {
00312         return kTraversalError;
00313     }

virtual kTraversal TViewFill::OnError | ( | const char * | err,
 |  | int | errcode
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 234 of file UCvsFiles.cpp.

00235     {
00236         return kTraversalError;
00237     }

virtual kTraversal TViewFill::OnFile | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct wnt_stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Definition at line 365 of file BrowseFileView.cpp.

00369     {
00370         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, false, &m_ignlist);
00371         if(!IsShowIgnored() && data->IsIgnored())
00372             return kContinueTraversal;
00373
00374         if (m_context->IsMatch(data))
00375         {
00376             int pos = InitItem(data, CBrowseFileView::GetImageForEntry(data));
00377             if (pos >=  0)
00378             {
00379                 UINT state = data->IsLocked() ? INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1);
00380                 CListCtrl& listCtrl = GetListCtrl();
00381                 listCtrl.SetItemState(pos, state, LVIS_STATEIMAGEMASK);
00382             }
00383         }
00384         return kContinueTraversal;
00385     }

virtual kTraversal TViewFill::OnFile | ( | const char * | fullpath,
 |  | const char * | fullname,
 |  | const char * | name,
 |  | const struct stat & | dir,
 |  | const FSSpec * | macspec
 | ) | [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 314 of file UCvsFiles.cpp.

00318     {
00319         EntnodeData *data = Entries_SetVisited(fullpath, m_entries, name, dir, false, &m_ignlist);
00320         if(!(bool)gFileViewIgnore && data->IsIgnored())
00321             return kContinueTraversal;
00322
00323         int rownum;
00324         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_NEWROW, kUMainWidget, &rownum);
00325         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_ROWSETDATA, UMAKEINT(kUMainWidget, rownum), data);
00326         ULIST_INSERT entry;
00327         entry.row = rownum;
00328
00329         entry.col = 0;
00330         entry.title = name;
00331         entry.icon = UCvsFiles::GetImageForEntry(data);
00332         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00333
00334         entry.icon = 0L;
00335
00336 #if 0 /* TODO */
00337         lvi.state = data->IsLocked() ?
00338             INDEXTOSTATEIMAGEMASK(2) : INDEXTOSTATEIMAGEMASK(1);
00339 #endif
00340
00341         // set item text for additional columns
00342         for(int j = 1; j < NUM_COLUMNS; j++)
00343         {
00344             const char *info = (*data)[j];
00345             if(info != 0L)
00346             {
00347                 entry.col = j;
00348                 entry.title = info;
00349                 UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00350             }
00351         }
00352         entry.col = EntnodeData::kStatus;
00353         entry.title = data->GetDesc();
00354         UEventSendMessage(m_listCtrl->GetWidID(), EV_LIST_INSERT, kUMainWidget, &entry);
00355
00356         return kContinueTraversal;
00357     }

virtual kTraversal TViewFill::OnIdle ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 315 of file BrowseFileView.cpp.

00316     {
00317         return kContinueTraversal;
00318     }

virtual kTraversal TViewFill::OnIdle ( const char * fullpath ) [inline, virtual]

Reimplemented from TraversalReport.

Definition at line 239 of file UCvsFiles.cpp.

00240     {
00241         return kContinueTraversal;
00242     }

Member Data Documentation

const KoTraversalContext* TViewFill::m_context

Definition at line 213 of file BrowseFileView.cpp.

CSortList<ENTNODE> TViewFill::m_entries

Definition at line 211 of file BrowseFileView.cpp.

CSortList<ENTNODE>& TViewFill::m_entries

Definition at line 212 of file UCvsFiles.cpp.

vector< UStr > TViewFill::m_ignlist

Definition at line 212 of file BrowseFileView.cpp.

UCvsFiles* TViewFill::m_listCtrl

Definition at line 211 of file UCvsFiles.cpp.

The documentation for this class was generated from the following files:
  • common/UCvsFiles.cpp
  • WinCvs/BrowseFileView.cpp
Generated on Sun Oct 21 12:50:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


unreaped Struct Reference

Collaboration diagram for unreaped:

[legend]
List of all members.

Public Attributes

pid_t | pid
int | status

Member Data Documentation

pid_t unreaped::pid

Definition at line 11 of file waitpid.c.

Referenced by options().

int unreaped::status

Definition at line 12 of file waitpid.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/lib/waitpid.c
Generated on Sun Oct 21 12:50:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


unrecog Struct Reference

Collaboration diagram for unrecog:

[legend]
List of all members.

Public Attributes

char * | line
unrecog * | next

Member Data Documentation

char* unrecog::line

Definition at line 37 of file fileattr.c.

struct unrecog* unrecog::next

Definition at line 38 of file fileattr.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/fileattr.c
Generated on Sun Oct 21 12:50:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CustInvertTable Struct Reference

#include <CustomizeMenus.h>

Collaboration diagram for CustInvertTable:

[legend]
List of all members.

Public Attributes

const char * | title
const char * | key
int | cmd

Member Data Documentation

int CustInvertTable::cmd

Definition at line 37 of file CustomizeMenus.h.

Referenced by GetCustomMenu(), CCustomizeMenus::GetIcon(), CCustInvertTable::Initialize(), CCustomizeMenus::OnAdd(), CCustomizeMenus::OnRemove(), and _Compare().

const char* CustInvertTable::key

Definition at line 36 of file CustomizeMenus.h.

Referenced by CCustInvertTable::CCustInvertTable(), CCustInvertTable::Initialize(), IsInInvertList(), and CCustomizeMenus::OnOK().

const char* CustInvertTable::title

Definition at line 35 of file CustomizeMenus.h.

Referenced by GetCustomMenu(), GetInvString(), and CCustInvertTable::Initialize().

The documentation for this struct was generated from the following file:
  • WinCvs/CustomizeMenus.h
Generated on Sun Oct 21 12:50:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


utimbuf Struct Reference

#include <system.h>

Collaboration diagram for utimbuf:

[legend]
List of all members.

Public Attributes

long | actime
long | modtime

Member Data Documentation

long utimbuf::actime

Definition at line 10 of file utime.c.

long utimbuf::modtime

Definition at line 11 of file utime.c.

The documentation for this struct was generated from the following files:
  • cvs-1.10/lib/system.h
  • cvs-1.10/vms/utime.c
Generated on Sun Oct 21 12:50:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


std::vector Class Reference

Inheritance diagram for std::vector:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CustomizeMenus.cpp
Generated on Sun Oct 21 12:50:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


vers_ts Struct Reference

#include <cvs.h>

Collaboration diagram for vers_ts:

[legend]
List of all members.

Public Attributes

char * | vn_user
char * | vn_rcs
char * | vn_tag
char * | ts_user
char * | ts_rcs
char * | options
char * | ts_conflict
char * | tag
char * | date
int | nonbranch
Entnode * entdata
RCSNode * srcfile

Member Data Documentation

char* vers_ts::date

Definition at line 754 of file cvs.h.

Entnode* vers_ts::entdata

Definition at line 760 of file cvs.h.

int vers_ts::nonbranch

Definition at line 757 of file cvs.h.

char* vers_ts::options

Definition at line 741 of file cvs.h.

RCSNode* vers_ts::srcfile

Definition at line 763 of file cvs.h.

char* vers_ts::tag

Definition at line 751 of file cvs.h.

char* vers_ts::ts_conflict

Definition at line 747 of file cvs.h.

char* vers_ts::ts_rcs

Definition at line 737 of file cvs.h.

char* vers_ts::ts_user

Definition at line 732 of file cvs.h.

char* vers_ts::vn_rcs

Definition at line 721 of file cvs.h.

char* vers_ts::vn_tag

Definition at line 726 of file cvs.h.

char* vers_ts::vn_user

Definition at line 717 of file cvs.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/cvs.h
Generated on Sun Oct 21 12:50:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CView Class Reference

Inheritance diagram for CView:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/BrowserBar.h
Generated on Sun Oct 21 12:50:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CViewInfo Struct Reference

Collaboration diagram for CViewInfo:

[legend]
List of all members.

Public Attributes

TView * view

Member Data Documentation

TView* CViewInfo::view

Definition at line 890 of file UPseudoSupport.cpp.

Referenced by extractInfos().

The documentation for this struct was generated from the following file:
  • rf/support/macapp/UPseudoSupport.cpp
Generated on Sun Oct 21 12:50:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


VMS_DIR Struct Reference

Collaboration diagram for VMS_DIR:

[legend]
List of all members.

Public Attributes

S_NAME s_dir
unsigned long | context
unsigned long | uflags
dsc descriptor_s | dir_spec
dsc descriptor_s | file_spec
int | version_flag
unsigned long | status

Member Data Documentation

unsigned long VMS_DIR::context

Definition at line 86 of file ndir.c.

struct dsc descriptor_s VMS_DIR::dir_spec

Definition at line 88 of file ndir.c.

struct dsc descriptor_s VMS_DIR::file_spec

Definition at line 89 of file ndir.c.

S_NAME VMS_DIR::s_dir

Definition at line 85 of file ndir.c.

unsigned long VMS_DIR::status

Definition at line 91 of file ndir.c.

unsigned long VMS_DIR::uflags

Definition at line 87 of file ndir.c.

int VMS_DIR::version_flag

Definition at line 90 of file ndir.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/ndir.c
Generated on Sun Oct 21 12:50:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


VMStimbuf Struct Reference

#include <vmsmunch.h>

Collaboration diagram for VMStimbuf:

[legend]
List of all members.

Public Attributes

char * | actime
char * | modtime

Member Data Documentation

char* VMStimbuf::actime

Definition at line 28 of file vmsmunch.h.

char* VMStimbuf::modtime

Definition at line 29 of file vmsmunch.h.

The documentation for this struct was generated from the following file:
  • cvs-1.10/vms/vmsmunch.h
Generated on Sun Oct 21 12:50:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsArgs Class Reference

#include <CvsArgs.h>

Inheritance diagram for CvsArgs:

[legend]
Collaboration diagram for CvsArgs:

[legend]
List of all members.

Public Methods

CvsArgs (bool defargs=true)
CvsArgs (char *const *fromargv, int fromargc)
virtual | ~CvsArgs ()
virtual void | add (const char *arg)
virtual void | addfile (const char *arg, const char *dir=0L, const FSSpec *spec=0L)
void | reset (bool defargs=true)
void | print (const char *indirectory=0L)
char *const * | Argv (void) const
int | Argc (void) const

Protected Attributes

char ** | argv
int | argc

Constructor & Destructor Documentation

CvsArgs::CvsArgs ( bool defargs = true )

Definition at line 56 of file CvsArgs.cpp.

00057 {
00058     argv = NULL;
00059     argc = 0;
00060
00061     reset(defargs);
00062 }

CvsArgs::CvsArgs | ( | char *const * | fromargv,
 |  | int | fromargc
 | ) |

Definition at line 64 of file CvsArgs.cpp.

00065 {
00066     argv = NULL;
00067     argc = 0;
00068
00069     reset(false);
00070
00071     for(int i = 0; i < fromargc; i++)
00072     {
00073         add(fromargv[i]);
00074     }
00075 }

CvsArgs::~CvsArgs ( ) [virtual]

Definition at line 77 of file CvsArgs.cpp.

00078 {
00079     reset(false);
00080 }

Member Function Documentation

int CvsArgs::Argc ( void ) const [inline]

Definition at line 55 of file CvsArgs.h.

Referenced by CvsCmdAddBinaryFiles(), CvsCmdAddFiles(), CvsCmdAddFolder(), CvsCmdCancelChangesFiles(), CvsCmdCheckoutModule(), CvsCmdCommitFiles(), CvsCmdCommitFolder(), CvsCmdDiffFiles(), CvsCmdDiffFolder(), CvsCmdEditFiles(), CvsCmdEditFolder(), CvsCmdEditorsFiles(), CvsCmdEditorsFolder(), CvsCmdImportModule(), CvsCmdInit(), CvsCmdLine(), CvsCmdLockFiles(), CvsCmdLockFolder(), CvsCmdLogin(), CvsCmdLogout(), CvsCmdReleaseFolder(), CvsCmdRemoveFiles(), CvsCmdRtagBranch(), CvsCmdRtagCreate(), CvsCmdRtagDelete(), CvsCmdStatusFiles(), CvsCmdStatusFolder(), CvsCmdTagBranchFiles(), CvsCmdTagBranchFolder(), CvsCmdTagCreateFiles(), CvsCmdTagCreateFolder(), CvsCmdTagDeleteFiles(), CvsCmdTagDeleteFolder(), CvsCmdUneditFiles(), CvsCmdUneditFolder(), CvsCmdUnlockFiles(), CvsCmdUnlockFolder(), CvsCmdUpdateFiles(), CvsCmdUpdateFolder(), CvsCmdWatchOffFiles(), CvsCmdWatchOffFolder(), CvsCmdWatchOnFiles(), CvsCmdWatchOnFolder(), CvsCmdWatchersFiles(), CvsCmdWatchersFolder(), UCvsFiles::EditSel(), LaunchDiff(), UCvsFolders::OnCmdExplore(), UCvsFiles::OnCmdExplore(), UCvsFiles::OnCmdTrash(), MacroTraversal::OnFile(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnViewDelrev(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewRetrieve(), CGraphView::OnViewTag(), CGraphView::OnViewUnlockf(), CGraphView::OnViewUpdate(), CBrowseFileView::ResetView(), UCvsFiles::ResetView(), cvsgui_RunCvs(), launchCVS(), and tclCvsProc().

00055 {return argc;}

char* const* CvsArgs::Argv ( void ) const [inline]

Definition at line 54 of file CvsArgs.h.

Referenced by CvsCmdAddBinaryFiles(), CvsCmdAddFiles(), CvsCmdAddFolder(), CvsCmdCancelChangesFiles(), CvsCmdCheckoutModule(), CvsCmdCommitFiles(), CvsCmdCommitFolder(), CvsCmdDiffFiles(), CvsCmdDiffFolder(), CvsCmdEditFiles(), CvsCmdEditFolder(), CvsCmdEditorsFiles(), CvsCmdEditorsFolder(), CvsCmdImportModule(), CvsCmdInit(), CvsCmdLine(), CvsCmdLockFiles(), CvsCmdLockFolder(), CvsCmdLogin(), CvsCmdLogout(), CvsCmdReleaseFolder(), CvsCmdRemoveFiles(), CvsCmdRtagBranch(), CvsCmdRtagCreate(), CvsCmdRtagDelete(), CvsCmdStatusFiles(), CvsCmdStatusFolder(), CvsCmdTagBranchFiles(), CvsCmdTagBranchFolder(), CvsCmdTagCreateFiles(), CvsCmdTagCreateFolder(), CvsCmdTagDeleteFiles(), CvsCmdTagDeleteFolder(), CvsCmdUneditFiles(), CvsCmdUneditFolder(), CvsCmdUnlockFiles(), CvsCmdUnlockFolder(), CvsCmdUpdateFiles(), CvsCmdUpdateFolder(), CvsCmdWatchOffFiles(), CvsCmdWatchOffFolder(), CvsCmdWatchOnFiles(), CvsCmdWatchOnFolder(), CvsCmdWatchersFiles(), CvsCmdWatchersFolder(), UCvsFiles::EditSel(), LaunchDiff(), UAuthen_SSH::OnBtnName(), UAuthen_SSH::OnBtnRSA(), UCvsFolders::OnCmdExplore(), UCvsFiles::OnCmdExplore(), UCvsFiles::OnCmdTrash(), MacroTraversal::OnFile(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnViewDelrev(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewRetrieve(), CGraphView::OnViewTag(), CGraphView::OnViewUnlockf(), CGraphView::OnViewUpdate(), CBrowseFileView::ResetView(), UCvsFiles::ResetView(), cvsgui_RunCvs(), launchCVS(), and tclCvsProc().

00054 {return argv;}

void CvsArgs::add ( const char * arg ) [virtual]

Definition at line 219 of file CvsArgs.cpp.

Referenced by CompatGetCommand(), CvsArgs(), CvsCmdAddBinaryFiles(), CvsCmdAddFiles(), CvsCmdAddFolder(), CvsCmdAnnotateFiles(), CvsCmdCancelChangesFiles(), CvsCmdCheckoutModule(), CvsCmdCommitFiles(), CvsCmdCommitFolder(), CvsCmdDiffFiles(), CvsCmdDiffFolder(), CvsCmdEditFiles(), CvsCmdEditFolder(), CvsCmdEditorsFiles(), CvsCmdEditorsFolder(), CvsCmdImportModule(), CvsCmdInit(), CvsCmdLockFiles(), CvsCmdLockFolder(), CvsCmdLogFiles(), CvsCmdLogFolder(), CvsCmdLogin(), CvsCmdLogout(), CvsCmdReleaseFolder(), CvsCmdRemoveFiles(), CvsCmdRtagBranch(), CvsCmdRtagCreate(), CvsCmdRtagDelete(), CvsCmdStatusFiles(), CvsCmdStatusFolder(), CvsCmdTagBranchFiles(), CvsCmdTagBranchFolder(), CvsCmdTagCreateFiles(), CvsCmdTagCreateFolder(), CvsCmdTagDeleteFiles(), CvsCmdTagDeleteFolder(), CvsCmdUneditFiles(), CvsCmdUneditFolder(), CvsCmdUnlockFiles(), CvsCmdUnlockFolder(), CvsCmdUpdateFiles(), CvsCmdUpdateFolder(), CvsCmdWatchOffFiles(), CvsCmdWatchOffFolder(), CvsCmdWatchOnFiles(), CvsCmdWatchOnFolder(), CvsCmdWatchersFiles(), CvsCmdWatchersFolder(), UCvsFiles::EditSel(), LaunchDiff(), UCvsFolders::OnCmdExplore(), UCvsFiles::OnCmdExplore(), MacroTraversal::OnFile(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnQueryAnnotate(), CGraphView::OnViewDelrev(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewReload(), CGraphView::OnViewRetrieve(), CGraphView::OnViewTag(), CGraphView::OnViewUnlockf(), CGraphView::OnViewUpdate(), CBrowseFileView::ResetView(), UCvsFiles::ResetView(), addfile(), cvsgui_RunCvs(), and tclCvsProc().

00220 {
00221     if(argv == 0L)
00222         argv = (char **)malloc(2 * sizeof(char *));
00223     else
00224         argv = (char **)realloc(argv, (argc + 2) * sizeof(char *));
00225     argv[argc++] = arg != 0L ? mystrdup(arg) : 0L;
00226     argv[argc] = 0L;
00227 }

void CvsArgs::addfile | ( | const char * | arg,
 |  | const char * | dir = 0L,
 |  | const FSSpec * | spec = 0L
 | ) | [virtual]

Reimplemented in AddCvsArgs, AddBinCvsArgs, and RemoveCvsArgs.

Definition at line 229 of file CvsArgs.cpp.

Referenced by MultiFiles::add(), RemoveCvsArgs::addfile(), AddBinCvsArgs::addfile(), and AddCvsArgs::addfile().

00230 {
00231     add(arg);
00232 }

void CvsArgs::print ( const char * indirectory = 0L )

Definition at line 189 of file CvsArgs.cpp.

Referenced by CvsCmdAddBinaryFiles(), CvsCmdAddFiles(), CvsCmdAddFolder(), CvsCmdAnnotateFiles(), CvsCmdCancelChangesFiles(), CvsCmdCheckoutModule(), CvsCmdCommitFiles(), CvsCmdCommitFolder(), CvsCmdDiffFiles(), CvsCmdDiffFolder(), CvsCmdEditFiles(), CvsCmdEditFolder(), CvsCmdEditorsFiles(), CvsCmdEditorsFolder(), CvsCmdImportModule(), CvsCmdInit(), CvsCmdLine(), CvsCmdLockFiles(), CvsCmdLockFolder(), CvsCmdLogFiles(), CvsCmdLogFolder(), CvsCmdLogin(), CvsCmdLogout(), CvsCmdReleaseFolder(), CvsCmdRemoveFiles(), CvsCmdRtagBranch(), CvsCmdRtagCreate(), CvsCmdRtagDelete(), CvsCmdStatusFiles(), CvsCmdStatusFolder(), CvsCmdTagBranchFiles(), CvsCmdTagBranchFolder(), CvsCmdTagCreateFiles(), CvsCmdTagCreateFolder(), CvsCmdTagDeleteFiles(), CvsCmdTagDeleteFolder(), CvsCmdUneditFiles(), CvsCmdUneditFolder(), CvsCmdUnlockFiles(), CvsCmdUnlockFolder(), CvsCmdUpdateFiles(), CvsCmdUpdateFolder(), CvsCmdWatchOffFiles(), CvsCmdWatchOffFolder(), CvsCmdWatchOnFiles(), CvsCmdWatchOnFolder(), CvsCmdWatchersFiles(), CvsCmdWatchersFolder(), CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetdescription(), CGraphView::OnGraphSetstate(), CGraphView::OnQueryAnnotate(), CGraphView::OnViewDelrev(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewReload(), CGraphView::OnViewRetrieve(), CGraphView::OnViewTag(), CGraphView::OnViewUnlockf(), and CGraphView::OnViewUpdate().

00190 {
00191     static CStaticAllocT<char> buf;
00192
00193     for(int i = 0; i < argc; i++)
00194     {
00195         CStr newarg;
00196         newarg = argv[i];
00197         bool hasLF = strchr(newarg, '\n') != 0L;
00198         size_t len = newarg.length();
00199
00200         if(len > MAX_PRINT_ARG)
00201             newarg = reduceString(newarg, buf);
00202
00203         if(hasLF)
00204             newarg = expandLF(newarg, buf);
00205
00206         bool hasSpace = strchr(newarg, ' ') != 0L;
00207         if(hasSpace)
00208             cvs_out("\"");
00209         cvs_outstr(newarg, newarg.length());
00210         if(hasSpace)
00211             cvs_out("\"");
00212         cvs_out(" ");
00213     }
00214     if(indirectory != NULL)
00215         cvs_out("(in directory %s)", indirectory);
00216     cvs_out("\n");
00217 }

void CvsArgs::reset ( bool defargs = true )

Definition at line 82 of file CvsArgs.cpp.

Referenced by CvsArgs(), CBrowseFileView::ResetView(), and ~CvsArgs().

00083 {
00084     if(argv != 0L)
00085     {
00086         for(int i = 0; i < argc; i++)
00087         {
00088             if(argv[i] != 0L)
00089                 free(argv[i]);
00090         }
00091         free(argv);
00092     }
00093
00094     argc = 0;
00095     argv = NULL;
00096
00097     if(defargs)
00098     {
00099         int numargs = 1;
00100
00101         if(gCvsPrefs.Z9Option())
00102             numargs++;
00103         if(gCvsPrefs.QuietOption())
00104             numargs++;
00105         if(gCvsPrefs.AlwaysUseCvsroot())
00106             numargs += 2;
00107
00108         argv = (char **)malloc(numargs * sizeof(char *));
00109         argv[argc++] = mystrdup("cvs");
00110         if(gCvsPrefs.AlwaysUseCvsroot())
00111         {
00112             argv[argc++] = mystrdup("-d");
00113             CStr root;
00114             const char *ccvsroot = gCvsPrefs;
00115             ccvsroot = Authen::skiptoken(ccvsroot);
00116             root = gAuthen.token();
00117             root << ccvsroot;
00118             argv[argc++] = mystrdup(root);
00119         }
00120         if(gCvsPrefs.Z9Option())
00121         {
00122             CStr zlev("-z");
00123             zlev << gCvsPrefs.ZLevel();
00124             argv[argc++] = mystrdup(zlev);
00125         }
00126         if(gCvsPrefs.QuietOption())
00127             argv[argc++] = mystrdup("-q");
00128     }
00129 }

Member Data Documentation

int CvsArgs::argc [protected]

Definition at line 58 of file CvsArgs.h.

char** CvsArgs::argv [protected]

Definition at line 57 of file CvsArgs.h.

The documentation for this class was generated from the following files:
  • common/CvsArgs.h
  • common/CvsArgs.cpp
Generated on Sun Oct 21 12:50:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsCoworker Class Reference

#include <CvsCoworker.h>

Inheritance diagram for CvsCoworker:

[legend]
Collaboration diagram for CvsCoworker:

[legend]
List of all members.

Public Methods

CvsCoworker ()
HRESULT | InterfaceSupportsErrorInfo (REFIID riid)
HRESULT | GetErrorMessage (int handle, int iError, int cbErrorBuffer, unsigned char *sError)
HRESULT | GetLastError (int handle, int *piError)
HRESULT | OpenProject (int *pHandle, const unsigned char *sUsername, const unsigned char *sProjectName, const unsigned char *sProjectHome)
HRESULT | GetProject (int *pHandle, const unsigned char *sUsername, int cbProjectNameBuffer, unsigned char *sProjectName, int cbProjectHomeBuffer, unsigned char *sProjectHome, BOOL bAllowPathChange, BOOL bAllowNewProject, BOOL *pbNewProject)
HRESULT | CloseProject (int handle)
HRESULT | UpdateFiles (int handle, const unsigned char *sFilenames, BOOL bDirectories, BOOL bRecurse)
HRESULT | CheckoutFiles (int handle, const unsigned char *sFilenames)
HRESULT | CheckinFiles (int handle, const unsigned char *sFilenames, BOOL bKeepCheckedOut)
HRESULT | UncheckoutFiles (int handle, const unsigned char *sFilenames)
HRESULT | AddFiles (int handle, const unsigned char *sOptionsAndFilenames, const unsigned char *sComment)
HRESULT | RemoveFiles (int handle, const unsigned char *sFilenames)
HRESULT | RenameFile (int handle, const unsigned char *sOldFilename, const unsigned char *sNewFilename)
HRESULT | DiffFile (int handle, const unsigned char *sFilename, BOOL bIgnoreCase, BOOL bIgnoreWhitespace)
HRESULT | ShowFileHistory (int handle, const unsigned char *sFilenames)
HRESULT | ShowFileProperties (int handle, const unsigned char *sFilename)
HRESULT | ShowUserInterface (int handle, const unsigned char *sFilenames)
HRESULT | HasAdvancedOptionsForCommand (int handle, CvsCommand command, BOOL *pbAdvancedOptions)
HRESULT | ShowAdvancedOptionsForCommand (int handle, CvsCommand command)
HRESULT | GetFileChanges (int handle, int cbFilenameBuffer, unsigned char *sFilenameBuffer)
HRESULT | GetFilesToAdd (int handle, int cbFilenamesBuffer, unsigned char *sFilenamesBuffer)

Constructor & Destructor Documentation

CvsCoworker::CvsCoworker ( ) [inline]

Definition at line 17 of file CvsCoworker.h.

00018     {
00019         qTRACE_FN(CvsCoworker);
00020     }

Member Function Documentation

STDMETHODIMP CvsCoworker::AddFiles | ( | int | handle,
 |  | const unsigned char * | sOptionsAndFilenames,
 |  | const unsigned char * | sComment
 | ) |

Definition at line 312 of file CvsCoworker.cpp.

00317 {
00318     LOG_API_FN(AddFiles);
00319     LOG_API_S(sOptionsAndFilenames);
00320     LOG_API_S(sComment);
00321     ASSERT(sOptionsAndFilenames);
00322     PREAMBLE(handle);
00323     try {
00324         bool bOK = pProject->addFiles(
00325             CvsFilenames(sOptionsAndFilenames),
00326             (const char*)sComment
00327             );
00328         LOG_API_N(bOK);
00329         if (!bOK) {
00330             return CVS_E_FAILED;
00331         }
00332         return S_OK;
00333     }
00334     CATCH_EXCEPTIONS(AddFiles);
00335 }

STDMETHODIMP CvsCoworker::CheckinFiles | ( | int | handle,
 |  | const unsigned char * | sFilenames,
 |  | BOOL | bKeepCheckedOut
 | ) |

Definition at line 265 of file CvsCoworker.cpp.

00270 {
00271     LOG_API_FN(CheckinFiles);
00272     LOG_API_S(sFilenames);
00273     LOG_API_N(bKeepCheckedOut);
00274     ASSERT(sFilenames);
00275     PREAMBLE(handle);
00276     try {
00277         bool bOK = pProject->checkinFiles(
00278             CvsFilenames(sFilenames),
00279             bKeepCheckedOut
00280             );
00281         LOG_API_N(bOK);
00282         if (!bOK) {
00283             return CVS_E_FAILED;
00284         }
00285         return S_OK;
00286     }
00287     CATCH_EXCEPTIONS(CheckinFiles);
00288 }

STDMETHODIMP CvsCoworker::CheckoutFiles | ( | int | handle,
 |  | const unsigned char * | sFilenames
 | ) |

Definition at line 243 of file CvsCoworker.cpp.

00247 {
00248     LOG_API_FN(CheckoutFiles);
00249     LOG_API_S(sFilenames);
00250     ASSERT(sFilenames);
00251     PREAMBLE(handle);
00252     try {
00253         bool bOK = pProject->checkoutFiles(
00254             CvsFilenames(sFilenames)
00255             );
00256         LOG_API_N(bOK);
00257         if (!bOK) {
00258             return CVS_E_FAILED;
00259         }
00260         return S_OK;
00261     }
00262     CATCH_EXCEPTIONS(CheckoutFiles);
00263 }

STDMETHODIMP CvsCoworker::CloseProject ( int handle )

Definition at line 198 of file CvsCoworker.cpp.

00201 {
00202     LOG_API_FN(CloseProject);
00203     PREAMBLE(handle);
00204     try {
00205         bool bOK = pProject->closeProject();
00206         LOG_API_N(bOK);
00207         if (!bOK) {
00208             return CVS_E_FAILED_CLOSE_PROJECT;
00209         }
00210         return S_OK;
00211     }
00212     CATCH_EXCEPTIONS(CloseProject);
00213 }

STDMETHODIMP CvsCoworker::DiffFile | ( | int | handle,
 |  | const unsigned char * | sFilename,
 |  | BOOL | bIgnoreCase,
 |  | BOOL | bIgnoreWhitespace
 | ) |

Definition at line 385 of file CvsCoworker.cpp.

00391 {
00392     LOG_API_FN(DiffFiles);
00393     LOG_API_S(sFilename);
00394     LOG_API_N(bIgnoreCase);
00395     LOG_API_N(bIgnoreWhitespace);
00396     ASSERT(sFilename);
00397     PREAMBLE(handle);
00398     try {
00399         bool bOK = pProject->diffFile(
00400             (const char*)sFilename,
00401             bIgnoreCase,
00402             bIgnoreWhitespace
00403             );
00404         LOG_API_N(bOK);
00405         if (!bOK) {
00406             return CVS_E_FAILED;
00407         }
00408         return S_OK;
00409     }
00410     CATCH_EXCEPTIONS(DiffFile);
00411 }

STDMETHODIMP CvsCoworker::GetErrorMessage | ( | int | handle,
 |  | int | iError,
 |  | int | cbErrorBuffer,
 |  | unsigned char * | sErrorBuffer
 | ) |

Definition at line 81 of file CvsCoworker.cpp.

00087 {
00088     LOG_API_FN(GetErrorMessage);
00089     LOG_API_N(iError);
00090     ASSERT(sErrorBuffer);
00091     ASSERT(0 < cbErrorBuffer);
00092     if (sErrorBuffer) {
00093         *sErrorBuffer = 0;
00094     }
00095     CvsProject* pProject = CvsProject::FindProject(handle);
00096     if (!pProject) {
00097         return CVS_E_FAILED_PROJECT_INVALID;
00098     }
00099     CvsString sError;
00100     if (!pProject->getErrorMessage(iError,sError)) {
00101         return S_FALSE;
00102     }
00103     CopyString(sErrorBuffer,sError,cbErrorBuffer);
00104     LOG_API_S(sErrorBuffer);
00105     return S_OK;
00106 }

STDMETHODIMP CvsCoworker::GetFileChanges | ( | int | handle,
 |  | int | cbFilenameBuffer,
 |  | unsigned char * | sFilenameBuffer
 | ) |

Definition at line 525 of file CvsCoworker.cpp.

00530 {
00531     LOG_API_FN(GetFileChanges);
00532     ASSERT(0<cbFilenameBuffer);
00533     ASSERT(sFilenameBuffer);
00534     PREAMBLE(handle);
00535     CvsString sFilename;
00536     try {
00537         bool bOK = pProject->getFileChanges(
00538             sFilename
00539             );
00540         CopyString(sFilenameBuffer,sFilename,cbFilenameBuffer);
00541         LOG_API_N(bOK);
00542         LOG_API_S(sFilenameBuffer);
00543         if (!bOK) {
00544             return CVS_E_FAILED;
00545         }
00546         return S_OK;
00547     }
00548     CATCH_EXCEPTIONS(GetFileChanges);
00549 }

STDMETHODIMP CvsCoworker::GetFilesToAdd | ( | int | handle,
 |  | int | cbFilenamesBuffer,
 |  | unsigned char * | sFilenamesBuffer
 | ) |

Definition at line 551 of file CvsCoworker.cpp.

00556 {
00557     LOG_API_FN(GetFilesToAdd);
00558     ASSERT(0<cbFilenamesBuffer);
00559     ASSERT(sFilenamesBuffer);
00560     PREAMBLE(handle);
00561     CvsString sFilenames;
00562     try {
00563         bool bOK = pProject->getFilesToAdd(
00564             sFilenames
00565             );
00566         CopyString(sFilenamesBuffer,sFilenames,cbFilenamesBuffer);
00567         LOG_API_N(bOK);
00568         LOG_API_S(sFilenamesBuffer);
00569         if (!bOK) {
00570             return CVS_E_FAILED;
00571         }
00572         return S_OK;
00573     }
00574     CATCH_EXCEPTIONS(GetFilesToAdd);
00575 }

STDMETHODIMP CvsCoworker::GetLastError | ( | int | handle,
 |  | int * | piError
 | ) |

Definition at line 66 of file CvsCoworker.cpp.

00070 {
00071     ASSERT(piError);
00072     *piError = 0;
00073     CvsProject* pProject = CvsProject::FindProject(handle);
00074     if (!pProject) {
00075         return CVS_E_FAILED_PROJECT_INVALID;
00076     }
00077     *piError = pProject->getLastError();
00078     return S_OK;
00079 }

STDMETHODIMP CvsCoworker::GetProject | ( | int * | pHandle,
 |  | const unsigned char * | sUsername,
 |  | int | cbProjectNameBuffer,
 |  | unsigned char * | sProjectNameBuffer,
 |  | int | cbProjectHomeBuffer,
 |  | unsigned char * | sProjectHomeBuffer,
 |  | BOOL | bAllowPathChange,
 |  | BOOL | bAllowNewProject,
 |  | BOOL * | pbNewProject
 | ) |

Definition at line 108 of file CvsCoworker.cpp.

00119 {
00120     LOG_API_FN(GetProject);
00121     LOG_API_S(sUsername);
00122     LOG_API_S(sProjectNameBuffer);
00123     LOG_API_S(sProjectHomeBuffer);
00124     LOG_API_N(bAllowPathChange);
00125     LOG_API_N(bAllowNewProject);
00126     ASSERT(pHandle);
00127     ASSERT(sUsername);
00128     ASSERT(0 < cbProjectNameBuffer);
00129     ASSERT(sProjectNameBuffer);
00130     ASSERT(0 < cbProjectHomeBuffer);
00131     ASSERT(sProjectHomeBuffer);
00132     ASSERT(pbNewProject);
00133     try {
00134         *pHandle = 0;
00135         *pbNewProject = false;
00136         CvsProject* pProject = new CvsProject;
00137         *pHandle = pProject->getProjectHandle();
00138         bool bOK = pProject->getProject(
00139             (char*)sUsername,
00140             (char*)sProjectNameBuffer,
00141             (char*)sProjectHomeBuffer,
00142             bAllowPathChange,
00143             bAllowNewProject,
00144             *pbNewProject
00145             );
00146         CopyString(sProjectNameBuffer,pProject->getProjectName(),cbProjectNameBuffer);
00147         CopyString(sProjectHomeBuffer,pProject->getProjectHome(),cbProjectHomeBuffer);
00148         LOG_API_N(bOK);
00149         LOG_API_S(sProjectNameBuffer);
00150         LOG_API_S(sProjectHomeBuffer);
00151         if (!bOK) {
00152             return CVS_E_FAILED_OPEN_PROJECT;
00153         }
00154         return S_OK;
00155     }
00156     CATCH_EXCEPTIONS(GetProject);
00157 }

STDMETHODIMP CvsCoworker::HasAdvancedOptionsForCommand | ( | int | handle,
 |  | CvsCommand | command,
 |  | BOOL * | pbAdvancedOptions
 | ) |

Definition at line 479 of file CvsCoworker.cpp.

00484 {
00485     LOG_API_FN(HasAdvancedOptionsForCommand);
00486     LOG_API_N(command);
00487     ASSERT(pbAdvancedOptions);
00488     PREAMBLE(handle);
00489     try {
00490         bool bOK = pProject->hasAdvancedOptionsForCommand(
00491             command,
00492             *pbAdvancedOptions
00493             );
00494         LOG_API_N(bOK);
00495         LOG_API_N(*pbAdvancedOptions);
00496         if (!bOK) {
00497             return CVS_E_FAILED;
00498         }
00499         return S_OK;
00500     }
00501     CATCH_EXCEPTIONS(HasAdvancedOptionsForCommand);
00502 }

STDMETHODIMP CvsCoworker::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 51 of file CvsCoworker.cpp.

00052 {
00053     qTRACE_FN(CvsCoworker::InterfaceSupportsErrorInfo);
00054     static const IID* arr[] = {
00055         &IID_ICvsCoworker,
00056         0
00057     };
00058     for (int i=0; arr[i]; ++i) {
00059         if (::ATL::InlineIsEqualGUID(*arr[i],riid)) {   //Jerzy[6/13/2001] - fix according to Q243298 at MSDN
00060             return S_OK;
00061         }
00062     }
00063     return S_FALSE;
00064 }

STDMETHODIMP CvsCoworker::OpenProject | ( | int * | pHandle,
 |  | const unsigned char * | sUsername,
 |  | const unsigned char * | sProjectName,
 |  | const unsigned char * | sProjectHome
 | ) |

Definition at line 159 of file CvsCoworker.cpp.

00165 {
00166     LOG_API_FN(OpenProject);
00167     LOG_API_S(sUsername);
00168     LOG_API_S(sProjectName);
00169     LOG_API_S(sProjectHome);
00170     ASSERT(pHandle);
00171     ASSERT(sUsername);
00172     ASSERT(sProjectName);
00173     ASSERT(sProjectHome);
00174     try {
00175         *pHandle = 0;
00176         CvsProject* pProject = new CvsProject;
00177         *pHandle = pProject->getProjectHandle();
00178         bool bOK = pProject->openProject(
00179             (const char*)sUsername,
00180             (const char*)sProjectName,
00181             (const char*)sProjectHome
00182             );
00183         LOG_API_N(bOK);
00184         if (!bOK) {
00185             return CVS_E_FAILED_OPEN_PROJECT;
00186         }
00187         return S_OK;
00188     }
00189     CATCH_EXCEPTIONS(OpenProject);
00190 }

STDMETHODIMP CvsCoworker::RemoveFiles | ( | int | handle,
 |  | const unsigned char * | sFilenames
 | ) |

Definition at line 337 of file CvsCoworker.cpp.

00341 {
00342     LOG_API_FN(RemoveFiles);
00343     LOG_API_S(sFilenames);
00344     ASSERT(sFilenames);
00345     PREAMBLE(handle);
00346     try {
00347         bool bOK = pProject->removeFiles(
00348             CvsFilenames(sFilenames)
00349             );
00350         LOG_API_N(bOK);
00351         if (!bOK) {
00352             return CVS_E_FAILED;
00353         }
00354         return S_OK;
00355     }
00356     CATCH_EXCEPTIONS(RemoveFiles);
00357 }

STDMETHODIMP CvsCoworker::RenameFile | ( | int | handle,
 |  | const unsigned char * | sOldFilename,
 |  | const unsigned char * | sNewFilename
 | ) |

Definition at line 359 of file CvsCoworker.cpp.

00364 {
00365     LOG_API_FN(RenameFiles);
00366     LOG_API_S(sOldFilename);
00367     LOG_API_S(sNewFilename);
00368     ASSERT(sOldFilename);
00369     ASSERT(sNewFilename);
00370     PREAMBLE(handle);
00371     try {
00372         bool bOK = pProject->renameFile(
00373             (const char*)sOldFilename,
00374             (const char*)sNewFilename
00375             );
00376         LOG_API_N(bOK);
00377         if (!bOK) {
00378             return CVS_E_FAILED;
00379         }
00380         return S_OK;
00381     }
00382     CATCH_EXCEPTIONS(RenameFile);
00383 }

STDMETHODIMP CvsCoworker::ShowAdvancedOptionsForCommand | ( | int | handle,
 |  | CvsCommand | command
 | ) |

Definition at line 504 of file CvsCoworker.cpp.

00508 {
00509     LOG_API_FN(ShowAdvancedOptionsForCommand);
00510     LOG_API_N(command);
00511     PREAMBLE(handle);
00512     try {
00513         bool bOK = pProject->showAdvancedOptionsForCommand(
00514             command
00515             );
00516         LOG_API_N(bOK);
00517         if (!bOK) {
00518             return CVS_E_FAILED;
00519         }
00520         return S_OK;
00521     }
00522     CATCH_EXCEPTIONS(ShowAdvancedOptionsForCommand);
00523 }

STDMETHODIMP CvsCoworker::ShowFileHistory | ( | int | handle,
 |  | const unsigned char * | sFilenames
 | ) |

Definition at line 413 of file CvsCoworker.cpp.

00417 {
00418     LOG_API_FN(ShowFileHistory);
00419     LOG_API_S(sFilenames);
00420     ASSERT(sFilenames);
00421     PREAMBLE(handle);
00422     try {
00423         bool bOK = pProject->showFileHistory(
00424             CvsFilenames(sFilenames)
00425             );
00426         LOG_API_N(bOK);
00427         if (!bOK) {
00428             return CVS_E_FAILED;
00429         }
00430         return S_OK;
00431     }
00432     CATCH_EXCEPTIONS(ShowFileHistory);
00433 }

STDMETHODIMP CvsCoworker::ShowFileProperties | ( | int | handle,
 |  | const unsigned char * | sFilename
 | ) |

Definition at line 435 of file CvsCoworker.cpp.

00439 {
00440     LOG_API_FN(ShowFileProperties);
00441     LOG_API_S(sFilename);
00442     ASSERT(sFilename);
00443     PREAMBLE(handle);
00444     try {
00445         bool bOK = pProject->showFileProperties(
00446             (const char*)sFilename
00447             );
00448         LOG_API_N(bOK);
00449         if (!bOK) {
00450             return CVS_E_FAILED;
00451         }
00452         return S_OK;
00453     }
00454     CATCH_EXCEPTIONS(ShowFileProperties);
00455 }

STDMETHODIMP CvsCoworker::ShowUserInterface | ( | int | handle,
 |  | const unsigned char * | sFilenames
 | ) |

Definition at line 457 of file CvsCoworker.cpp.

00461 {
00462     LOG_API_FN(ShowUserInterface);
00463     LOG_API_S(sFilenames);
00464     ASSERT(sFilenames);
00465     PREAMBLE(handle);
00466     try {
00467         bool bOK = pProject->showUserInterface(
00468             CvsFilenames(sFilenames)
00469             );
00470         LOG_API_N(bOK);
00471         if (!bOK) {
00472             return CVS_E_FAILED;
00473         }
00474         return S_OK;
00475     }
00476     CATCH_EXCEPTIONS(ShowUserInterface);
00477 }

STDMETHODIMP CvsCoworker::UncheckoutFiles | ( | int | handle,
 |  | const unsigned char * | sFilenames
 | ) |

Definition at line 290 of file CvsCoworker.cpp.

00294 {
00295     LOG_API_FN(UncheckoutFiles);
00296     LOG_API_S(sFilenames);
00297     ASSERT(sFilenames);
00298     PREAMBLE(handle);
00299     try {
00300         bool bOK = pProject->uncheckoutFiles(
00301             CvsFilenames(sFilenames)
00302             );
00303         LOG_API_N(bOK);
00304         if (!bOK) {
00305             return CVS_E_FAILED;
00306         }
00307         return S_OK;
00308     }
00309     CATCH_EXCEPTIONS(UncheckoutFiles);
00310 }

STDMETHODIMP CvsCoworker::UpdateFiles | ( | int | handle,
 |  | const unsigned char * | sFilenames,
 |  | BOOL | bDirectories,
 |  | BOOL | bRecurse
 | ) |

Definition at line 215 of file CvsCoworker.cpp.

00221 {
00222     LOG_API_FN(UpdateFiles);
00223     LOG_API_S(sFilenames);
00224     LOG_API_N(bDirectories);
00225     LOG_API_N(bRecurse);
00226     ASSERT(sFilenames);
00227     PREAMBLE(handle);
00228     try {
00229         bool bOK = pProject->updateFiles(
00230             CvsFilenames(sFilenames),
00231             bDirectories,
00232             bRecurse
00233             );
00234         LOG_API_N(bOK);
00235         if (!bOK) {
00236             return CVS_E_FAILED;
00237         }
00238         return S_OK;
00239     }
00240     CATCH_EXCEPTIONS(UpdateFiles);
00241 }

The documentation for this class was generated from the following files:
  • WinCvs/CoWorker/CvsCoworker.h
  • WinCvs/CoWorker/CvsCoworker.cpp
Generated on Sun Oct 21 12:50:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsFilenames Class Reference

#include <CvsFilenames.h>

Collaboration diagram for CvsFilenames:

[legend]
List of all members.

Public Methods

CvsFilenames (const unsigned char *)
~CvsFilenames ()
bool | getOptionsAndFilename (int i, CvsString &, CvsString &)
const char * | getFilename (int)
int | getNumberOfFilenames ()

Protected Attributes

CvsString m_sBuffer
int | m_nFilenames
int * | m_arrayOffsetName

Constructor & Destructor Documentation

CvsFilenames::CvsFilenames ( const unsigned char * sFilenames )

Definition at line 13 of file CvsFilenames.cpp.

00014 :   m_sBuffer((const char*)sFilenames),
00015     m_nFilenames(0),
00016     m_arrayOffsetName(0)
00017 {
00018     qTRACE_FN(CvsFilenames);
00019     qTRACE(("* strlen(sFilenames) = %d",strlen((const char*)sFilenames)));
00020
00021     char* sBase = m_sBuffer.getBuffer();
00022
00023     // count \n separators
00024     int nNames = 0;
00025     char* sName = sBase;
00026     for (;;) {
00027         char* s = strchr(sName,'\n');
00028         if (!s) break;
00029         ++nNames;
00030         sName = s + 1;
00031     }
00032
00033     qTRACE(("* found %d names",nNames));
00034
00035     // set name offsets and replace \n with \0
00036     m_arrayOffsetName = new int[nNames];
00037     int iName = 0;
00038     sName = sBase;
00039     for (;;) {
00040         char* s = strchr(sName,'\n');
00041         if (!s) break;
00042         m_arrayOffsetName[iName++] = (int)(sName - sBase);
00043         *s++ = 0;
00044         sName = s;
00045     }
00046     ASSERT(iName == nNames);
00047     ASSERT((0 == iName) || !*sName);
00048 }

CvsFilenames::~CvsFilenames ( )

Definition at line 50 of file CvsFilenames.cpp.

00051 {
00052     delete [] m_arrayOffsetName;
00053 }

Member Function Documentation

const char * CvsFilenames::getFilename ( int i )

Definition at line 59 of file CvsFilenames.cpp.

00060 {
00061     if ((i < 0) || (m_nFilenames <= i)) return "";
00062     int iOffset = m_arrayOffsetName[i];
00063     ASSERT(0 <= iOffset);
00064     ASSERT(iOffset < m_sBuffer.getBufferMax());
00065     const char* p = m_sBuffer;
00066     return p + iOffset;
00067 }

int CvsFilenames::getNumberOfFilenames ( ) [inline]

Definition at line 22 of file CvsFilenames.h.

00022 { return m_nFilenames; }

bool CvsFilenames::getOptionsAndFilename | ( | int | i,
 |  | CvsString & | sOptions,
 |  | CvsString & | sFilename
 | ) |

Definition at line 73 of file CvsFilenames.cpp.

00074 {
00075     if ((i < 0) || (m_nFilenames <= i)) {
00076         sOptions.strcpy("");
00077         sFilename.strcpy("");
00078         return false;
00079     }
00080     int iOffset = m_arrayOffsetName[i];
00081     ASSERT(0 <= iOffset);
00082     ASSERT(iOffset < m_sBuffer.getBufferMax());
00083     const char* pBase = m_sBuffer + iOffset;
00084     const char* pTab  = strchr(pBase,'\t');
00085     if (pTab) {
00086         sOptions.strncpy(pBase,(int)(pTab - pBase));
00087         sFilename.strcpy(pTab+1);
00088     } else {
00089         sOptions.strcpy("");
00090         sFilename.strcpy(pBase);
00091     }
00092     return true;
00093 }

Member Data Documentation

int* CvsFilenames::m_arrayOffsetName [protected]

Definition at line 26 of file CvsFilenames.h.

int CvsFilenames::m_nFilenames [protected]

Definition at line 25 of file CvsFilenames.h.

CvsString CvsFilenames::m_sBuffer [protected]

Definition at line 24 of file CvsFilenames.h.

The documentation for this class was generated from the following files:
  • WinCvs/CoWorker/CvsFilenames.h
  • WinCvs/CoWorker/CvsFilenames.cpp
Generated on Sun Oct 21 12:50:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsPrefs Class Reference

#include <CvsPrefs.h>

Collaboration diagram for CvsPrefs:

[legend]
List of all members.

Public Methods

CvsPrefs ()
~CvsPrefs ()
bool | empty (void) const
int | length (void) const
const char * | operator= (const char *newstr)
const unsigned char * | operator= (const unsigned char *newstr)
operator const char * () const
operator const unsigned char * () const
bool | CheckoutRO (void) const
bool | Z9Option (void) const
bool | PruneOption (void) const
bool | QuietOption (void) const
ISO8559 | IsoConvert (void) const
bool | ICTextOption (void) const
bool | AddControl (void) const
bool | UseViewerAlways (void) const
MACENCODING | MacBinEncoding (void) const
int | KserverPort (void) const
int | PserverPort (void) const
int | RhostPort (void) const
const char * | ServerName (void) const
const char * | RshName (void) const
const char * | Home (void) const
const char * | Viewer (void) const
const char * | ExtDiff (void) const
const char * | Helper (void) const
const char * | Browser (void) const
bool | DirtySupport (void) const
int | LogoutTimeOut (void) const
bool | AlwaysUseCvsroot (void) const
bool | UseProxy (void) const
const char * | ProxyHost (void) const
int | ProxyPort (void) const
bool | UnixLF (void) const
int | ZLevel (void) const
int | CvsVersion (void) const
bool | CvsConsole (void) const
int | WordWrapLogMsg (void) const
const char * | LastWorkingDir (void) const
bool | UseKeyChain (void) const
bool | HideCommandDlgUpdate (void) const
bool | HideCommandDlgDiff (void) const
bool | HideCommandDlgLog (void) const
bool | HideCommandDlgGraph (void) const
bool | HideCommandDlgAnnotate (void) const
bool | HideCommandDlgUseShift (void) const
SHELL_KIND | GetUseShell (void) const
void | SetCheckoutRO (bool newState)
void | SetZ9Option (bool newState)
void | SetPruneOption (bool newState)
void | SetQuietOption (bool newState)
void | SetIsoConvert (ISO8559 newState)
void | SetICTextOption (bool newState)
void | SetAddControl (bool newState)
void | SetUseViewerAlways (bool newState)
void | SetMacBinEncoding (MACENCODING newState)
void | SetKserverPort (int newState)
void | SetPserverPort (int newState)
void | SetRhostPort (int newState)
void | SetServerName (const char *newservername)
void | SetRshName (const char *newrshname)
void | SetHome (const char *newhome)
void | SetViewer (const char *newviewer)
void | SetExtDiff (const char *newdiff)
void | SetHelper (const char *newhelper)
void | SetBrowser (const char *newbrowser)
void | SetDirtySupport (bool newState)
void | SetLogoutTimeOut (int newTimeout)
void | SetAlwaysUseCvsroot (bool newState)
void | SetUseProxy (bool useit)
void | SetProxyHost (const char *newhost)
void | SetProxyPort (int newport)
void | SetUnixLF (bool useit)
void | SetZLevel (int level)
void | SetCvsVersion (int version)
void | SetCvsConsole (bool console)
void | SetWordWrapLogMsg (int wordwrap)
void | SetLastWorkingDir (const char *workdir)
void | SetHideCommandDlgUpdate (bool newState)
void | SetHideCommandDlgDiff (bool newState)
void | SetHideCommandDlgLog (bool newState)
void | SetHideCommandDlgGraph (bool newState)
void | SetHideCommandDlgAnnotate (bool newState)
void | SetHideCommandDlgUseShift (bool newState)
void | SetUseShell (SHELL_KIND shell)
const char * | WhichCvs (UStr &path, bool userOnly=false) const
void | SetWhichCvs (const char *cvsPath)
bool | HasLoogedIn (void) const
void | SetHasLoogedIn (bool newstate)
bool | IsCvsRunning (void) const
int | SetCvsRunning (bool launched)
bool | IsTclFileRunning (void) const
int | SetTclFileRunning (bool launched)
void | save (void)
void | load (void)
const UPStr & | get_cvsroot_list (int entry) const

Protected Methods

UPStr & | get_cvsroot_list (int entry)
bool | has_cvsroot_in_list (const char *cvsroot, int &entry)
void | insert_cvsroot_in_list (const char *cvsroot)
void | flush_list (void)

Protected Attributes

bool | fHasLoggedIn
int | fCvsRunningCounter
int | fTclFileRunningCounter

Constructor & Destructor Documentation

CvsPrefs::CvsPrefs ( ) [inline]

Definition at line 82 of file CvsPrefs.h.

00082                       : fHasLoggedIn(false),
00083         fCvsRunningCounter(0), fTclFileRunningCounter(0) {}

CvsPrefs::~CvsPrefs ( ) [inline]

Definition at line 84 of file CvsPrefs.h.

00084 {}

Member Function Documentation

bool CvsPrefs::AddControl ( void ) const

Definition at line 167 of file CvsPrefs.cpp.

00167 {return gAddBinControl;}

bool CvsPrefs::AlwaysUseCvsroot ( void ) const

Definition at line 231 of file CvsPrefs.cpp.

00231 {return gAlwaysUseCvsroot;}

const char * CvsPrefs::Browser ( void ) const

Definition at line 221 of file CvsPrefs.cpp.

00222 {
00223     return gBrowser.empty() ? 0L : (const char *)gBrowser;
00224 }

bool CvsPrefs::CheckoutRO ( void ) const

Definition at line 154 of file CvsPrefs.cpp.

00154 {return gCheckoutRO;}

bool CvsPrefs::CvsConsole ( void ) const

Definition at line 238 of file CvsPrefs.cpp.

00238 {return gCvsConsole;}

int CvsPrefs::CvsVersion ( void ) const

Definition at line 237 of file CvsPrefs.cpp.

00237 {return gCvsVersion;}

bool CvsPrefs::DirtySupport ( void ) const

Definition at line 229 of file CvsPrefs.cpp.

00229 {return gDirtySupport;}

const char * CvsPrefs::ExtDiff ( void ) const

Definition at line 225 of file CvsPrefs.cpp.

Referenced by LaunchDiff().

00226 {
00227     return gExtdiff.empty() ? 0L : (const char *)gExtdiff;
00228 }

SHELL_KIND CvsPrefs::GetUseShell ( void ) const

Definition at line 240 of file CvsPrefs.cpp.

00240 {return (SHELL_KIND)(int)gUseShell;}

bool CvsPrefs::HasLoogedIn ( void ) const [inline]

Definition at line 189 of file CvsPrefs.h.

00189 { return fHasLoggedIn; }

const char * CvsPrefs::Helper ( void ) const

Definition at line 217 of file CvsPrefs.cpp.

00218 {
00219     return gHelper.empty() ? 0L : (const char *)gHelper;
00220 }

bool CvsPrefs::HideCommandDlgAnnotate ( void ) const

Definition at line 254 of file CvsPrefs.cpp.

00254 {return gHideCommandDlgAnnotate;}

bool CvsPrefs::HideCommandDlgDiff ( void ) const

Definition at line 251 of file CvsPrefs.cpp.

00251 {return gHideCommandDlgDiff;}

bool CvsPrefs::HideCommandDlgGraph ( void ) const

Definition at line 253 of file CvsPrefs.cpp.

00253 {return gHideCommandDlgGraph;}

bool CvsPrefs::HideCommandDlgLog ( void ) const

Definition at line 252 of file CvsPrefs.cpp.

00252 {return gHideCommandDlgLog;}

bool CvsPrefs::HideCommandDlgUpdate ( void ) const

Definition at line 250 of file CvsPrefs.cpp.

00250 {return gHideCommandDlgUpdate;}

bool CvsPrefs::HideCommandDlgUseShift ( void ) const

Definition at line 255 of file CvsPrefs.cpp.

00255 {return gHideCommandDlgUseShift;}

const char * CvsPrefs::Home ( void ) const

Definition at line 184 of file CvsPrefs.cpp.

00185 {
00186 #ifndef qUnix
00187 #   ifdef WIN32
00188     // Windows 98 doesn't like C:\/.cvspass
00189     if(!gHome.empty() && gHome.endsWith(kPathDelimiter))
00190     {
00191         gHome[gHome.length() - 1] = '\0';
00192     }
00193 #   endif
00194     return gHome.empty() ? 0L : (const char *)gHome;
00195 #else /* qUnix */
00196     static CStr home;
00197     if (!home.empty())
00198         return home;
00199
00200     char *env = getenv ("HOME");
00201     struct passwd *pw;
00202     if (env)
00203         home = env;
00204     else if ((pw = (struct passwd *) getpwuid (getuid ()))
00205              && pw->pw_dir)
00206         home = pw->pw_dir;
00207     else
00208         return 0L;
00209
00210     return home;
00211 #endif /* qUnix */
00212 }

bool CvsPrefs::ICTextOption ( void ) const

Definition at line 166 of file CvsPrefs.cpp.

00166 {return gICTextOption;}

bool CvsPrefs::IsCvsRunning ( void ) const

Definition at line 646 of file CvsPrefs.cpp.

00647 {
00648     return(fCvsRunningCounter > 0);
00649 }

bool CvsPrefs::IsTclFileRunning ( void ) const

Definition at line 661 of file CvsPrefs.cpp.

00662 {
00663     return(fTclFileRunningCounter > 0);
00664 }

ISO8559 CvsPrefs::IsoConvert ( void ) const

Definition at line 165 of file CvsPrefs.cpp.

00165 {return (ISO8559)(int)gIsoConvert;}

int CvsPrefs::KserverPort ( void ) const

Definition at line 170 of file CvsPrefs.cpp.

00170 {return gKserverPort;}

const char * CvsPrefs::LastWorkingDir ( void ) const

Definition at line 245 of file CvsPrefs.cpp.

00246 {
00247     return gLastWorkingDir.empty() ? 0L : (const char *)gLastWorkingDir;
00248 }

int CvsPrefs::LogoutTimeOut ( void ) const

Definition at line 230 of file CvsPrefs.cpp.

00230 {return gLogoutTimeOut;}

MACENCODING CvsPrefs::MacBinEncoding ( void ) const

Definition at line 169 of file CvsPrefs.cpp.

00169 {return (MACENCODING)(int)gMacBinEncoding;}

const char * CvsPrefs::ProxyHost ( void ) const

Definition at line 232 of file CvsPrefs.cpp.

00232 {return gProxyHost;}

int CvsPrefs::ProxyPort ( void ) const

Definition at line 233 of file CvsPrefs.cpp.

00233 {return gProxyPort;}

bool CvsPrefs::PruneOption ( void ) const

Definition at line 163 of file CvsPrefs.cpp.

00163 {return gPruneOption;}

int CvsPrefs::PserverPort ( void ) const

Definition at line 171 of file CvsPrefs.cpp.

00171 {return gPserverPort;}

bool CvsPrefs::QuietOption ( void ) const

Definition at line 164 of file CvsPrefs.cpp.

00164 {return gQuietOption;}

int CvsPrefs::RhostPort ( void ) const

Definition at line 172 of file CvsPrefs.cpp.

00172 {return gRhostPort;}

const char * CvsPrefs::RshName ( void ) const

Definition at line 180 of file CvsPrefs.cpp.

00181 {
00182     return gRshName.empty() ? 0L : (const char *)gRshName;
00183 }

const char * CvsPrefs::ServerName ( void ) const

Definition at line 176 of file CvsPrefs.cpp.

00177 {
00178     return gServerName.empty() ? 0L : (const char *)gServerName;
00179 }

void CvsPrefs::SetAddControl ( bool newState )

Definition at line 263 of file CvsPrefs.cpp.

Referenced by load().

00263 {gAddBinControl = newState;}

void CvsPrefs::SetAlwaysUseCvsroot ( bool newState )

Definition at line 290 of file CvsPrefs.cpp.

00290 {gAlwaysUseCvsroot = newState;}

void CvsPrefs::SetBrowser ( const char * newviewer )

Definition at line 285 of file CvsPrefs.cpp.

00285 {gBrowser = newviewer;}

void CvsPrefs::SetCheckoutRO ( bool newState )

Definition at line 257 of file CvsPrefs.cpp.

Referenced by load().

00257 {gCheckoutRO = newState;}

void CvsPrefs::SetCvsConsole ( bool console )

Definition at line 297 of file CvsPrefs.cpp.

00297 {gCvsConsole = console;}

int CvsPrefs::SetCvsRunning ( bool launched )

Definition at line 651 of file CvsPrefs.cpp.

00652 {
00653     if(launched)
00654         fCvsRunningCounter++;
00655     else if(fCvsRunningCounter > 0)
00656         fCvsRunningCounter--;
00657
00658     return fCvsRunningCounter;
00659 }

void CvsPrefs::SetCvsVersion ( int vers )

Definition at line 296 of file CvsPrefs.cpp.

00296 {gCvsVersion = vers;}

void CvsPrefs::SetDirtySupport ( bool newState )

Definition at line 288 of file CvsPrefs.cpp.

00288 {gDirtySupport = newState;}

void CvsPrefs::SetExtDiff ( const char * newdiff )

Definition at line 287 of file CvsPrefs.cpp.

00287 {gExtdiff = newdiff;}

void CvsPrefs::SetHasLoogedIn ( bool newstate ) [inline]

Definition at line 190 of file CvsPrefs.h.

00190 { fHasLoggedIn = newstate; }

void CvsPrefs::SetHelper ( const char * newviewer )

Definition at line 286 of file CvsPrefs.cpp.

00286 {gHelper = newviewer;}

void CvsPrefs::SetHideCommandDlgAnnotate ( bool newState )

Definition at line 306 of file CvsPrefs.cpp.

00306 {gHideCommandDlgAnnotate = newState;}

void CvsPrefs::SetHideCommandDlgDiff ( bool newState )

Definition at line 303 of file CvsPrefs.cpp.

00303 {gHideCommandDlgDiff = newState;}

void CvsPrefs::SetHideCommandDlgGraph ( bool newState )

Definition at line 305 of file CvsPrefs.cpp.

00305 {gHideCommandDlgGraph = newState;}

void CvsPrefs::SetHideCommandDlgLog ( bool newState )

Definition at line 304 of file CvsPrefs.cpp.

00304 {gHideCommandDlgLog = newState;}

void CvsPrefs::SetHideCommandDlgUpdate ( bool newState )

Definition at line 302 of file CvsPrefs.cpp.

00302 {gHideCommandDlgUpdate = newState;}

void CvsPrefs::SetHideCommandDlgUseShift ( bool newState )

Definition at line 307 of file CvsPrefs.cpp.

00307 {gHideCommandDlgUseShift = newState;}

void CvsPrefs::SetHome ( const char * newhome )

Definition at line 271 of file CvsPrefs.cpp.

00272 {
00273 #ifndef qUnix
00274     gHome = newhome;
00275 #   ifdef WIN32
00276     // Windows 98 doesn't like C:\/.cvspass
00277     if(!gHome.empty() && gHome.endsWith(kPathDelimiter))
00278     {
00279         gHome[gHome.length() - 1] = '\0';
00280     }
00281 #   endif
00282 #endif /* !qUnix */
00283 }

void CvsPrefs::SetICTextOption ( bool newState )

Definition at line 262 of file CvsPrefs.cpp.

Referenced by load().

00262 {gICTextOption = newState;}

void CvsPrefs::SetIsoConvert ( ISO8559 newState )

Definition at line 261 of file CvsPrefs.cpp.

Referenced by load().

00261 {gIsoConvert = (int)newState;}

void CvsPrefs::SetKserverPort ( int newState )

Definition at line 266 of file CvsPrefs.cpp.

00266 {gKserverPort = newState;}

void CvsPrefs::SetLastWorkingDir ( const char * workdir )

Definition at line 299 of file CvsPrefs.cpp.

00299 {gLastWorkingDir = workdir;}

void CvsPrefs::SetLogoutTimeOut ( int newTimeout )

Definition at line 289 of file CvsPrefs.cpp.

00289 {gLogoutTimeOut = newTimeout;}

void CvsPrefs::SetMacBinEncoding ( MACENCODING newState )

Definition at line 265 of file CvsPrefs.cpp.

00265 {gMacBinEncoding = (int)newState;}

void CvsPrefs::SetProxyHost ( const char * newhost )

Definition at line 294 of file CvsPrefs.cpp.

00294 {gProxyHost = newhost;}

void CvsPrefs::SetProxyPort ( int newport )

Definition at line 295 of file CvsPrefs.cpp.

00295 {gProxyPort = newport;}

void CvsPrefs::SetPruneOption ( bool newState )

Definition at line 259 of file CvsPrefs.cpp.

Referenced by load().

00259 {gPruneOption = newState;}

void CvsPrefs::SetPserverPort ( int newState )

Definition at line 267 of file CvsPrefs.cpp.

00267 {gPserverPort = newState;}

void CvsPrefs::SetQuietOption ( bool newState )

Definition at line 260 of file CvsPrefs.cpp.

Referenced by load().

00260 {gQuietOption = newState;}

void CvsPrefs::SetRhostPort ( int newState )

Definition at line 268 of file CvsPrefs.cpp.

00268 {gRhostPort = newState;}

void CvsPrefs::SetRshName ( const char * newrshname )

Definition at line 270 of file CvsPrefs.cpp.

00270 {gRshName = newrshname;}

void CvsPrefs::SetServerName ( const char * newservername )

Definition at line 269 of file CvsPrefs.cpp.

00269 {gServerName = newservername;}

int CvsPrefs::SetTclFileRunning ( bool launched )

Definition at line 666 of file CvsPrefs.cpp.

00667 {
00668     if(launched)
00669         fTclFileRunningCounter++;
00670     else if(fTclFileRunningCounter > 0)
00671         fTclFileRunningCounter--;
00672
00673     return fTclFileRunningCounter;
00674 }

void CvsPrefs::SetUnixLF ( bool useit )

Definition at line 292 of file CvsPrefs.cpp.

00292 {gUnixLF = useit;}

void CvsPrefs::SetUseProxy ( bool useit )

Definition at line 291 of file CvsPrefs.cpp.

00291 {gUseProxy = useit;}

void CvsPrefs::SetUseShell ( SHELL_KIND shell )

Definition at line 300 of file CvsPrefs.cpp.

00300 {gUseShell = shell;}

void CvsPrefs::SetUseViewerAlways ( bool newState )

Definition at line 264 of file CvsPrefs.cpp.

00264 {gUseViewerAlways = newState;}

void CvsPrefs::SetViewer ( const char * newviewer )

Definition at line 284 of file CvsPrefs.cpp.

00284 {gViewer = newviewer;}

void CvsPrefs::SetWhichCvs ( const char * cvsPath )

Definition at line 1002 of file CvsPrefs.cpp.

01003 {
01004     UStr appPath;
01005
01006 #ifdef WIN32
01007     HINSTANCE hInst = ::AfxGetInstanceHandle();
01008     char apath[512];
01009     DWORD len;
01010     if(hInst != 0L && (len = ::GetModuleFileName(hInst, apath, 512)) > 0)
01011     {
01012         CString tmp(apath);
01013         tmp.MakeLower();
01014         appPath = tmp;
01015     }
01016 #endif
01017
01018     if(!appPath.empty())
01019     {
01020         UStr value;
01021         gWhichCvs.Concatenate(value, appPath, cvsPath);
01022         gWhichCvs.Insert(value);
01023     }
01024 }

void CvsPrefs::SetWordWrapLogMsg ( int wordwrap )

Definition at line 298 of file CvsPrefs.cpp.

00298 {gWordWrapLogMsg = wordwrap;}

void CvsPrefs::SetZ9Option ( bool newState )

Definition at line 258 of file CvsPrefs.cpp.

Referenced by load().

00258 {gZ9Option = newState;}

void CvsPrefs::SetZLevel ( int level )

Definition at line 293 of file CvsPrefs.cpp.

00293 {gZLevel = level;}

bool CvsPrefs::UnixLF ( void ) const

Definition at line 235 of file CvsPrefs.cpp.

00235 {return gUnixLF;}

bool CvsPrefs::UseKeyChain ( void ) const

Definition at line 931 of file Authen.cpp.

00932 {
00933 #if qMacCvsPP
00934     return (bool)AuthenLSH::gLSHKeychain;
00935 #else
00936     return false;
00937 #endif
00938 }

bool CvsPrefs::UseProxy ( void ) const

Definition at line 234 of file CvsPrefs.cpp.

00234 {return gUseProxy;}

bool CvsPrefs::UseViewerAlways ( void ) const

Definition at line 168 of file CvsPrefs.cpp.

Referenced by LaunchViewer().

00168 {return gUseViewerAlways;}

const char * CvsPrefs::Viewer ( void ) const

Definition at line 213 of file CvsPrefs.cpp.

Referenced by LaunchEditor(), and LaunchViewer().

00214 {
00215     return gViewer.empty() ? 0L : (const char *)gViewer;
00216 }

const char * CvsPrefs::WhichCvs | ( | UStr & | path,
 |  | bool | userOnly = false
 | ) | const

Definition at line 1026 of file CvsPrefs.cpp.

01027 {
01028     path = "";
01029
01030     UStr appPath;
01031
01032 #ifdef WIN32
01033     HINSTANCE hInst = ::AfxGetInstanceHandle();
01034     char apath[512];
01035     DWORD len;
01036     if(hInst != 0L && (len = ::GetModuleFileName(hInst, apath, 512)) > 0)
01037     {
01038         CString tmp(apath);
01039         tmp.MakeLower();
01040         appPath = tmp;
01041     }
01042 #endif
01043
01044     // search if beside the default cvs, the user defined one to use
01045     // with this application only.
01046     UStr candidate;
01047     if(!appPath.empty())
01048     {
01049         UStr value;
01050         gWhichCvs.Concatenate(value, appPath, "");
01051         TMString<UStr>::list_t::const_iterator i = gWhichCvs.Find(value);
01052         if(i != gWhichCvs.end())
01053         {
01054             UStr key;
01055             gWhichCvs.Split(*i, key, candidate);
01056         }
01057     }
01058
01059     // verify this cvs exe is still there
01060     struct stat sb;
01061     if(!candidate.empty() && stat(candidate, &sb) != -1 && S_ISREG(sb.st_mode))
01062     {
01063         path = candidate;
01064         return path.c_str();
01065     }
01066
01067     // fallback to the default one.
01068     if(userOnly)
01069         return 0L;
01070
01071 #ifdef WIN32
01072     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01073
01074     app->GetAppPath(path);
01075     if(!path.endsWith(kPathDelimiter))
01076         path << kPathDelimiter;
01077     path << (gCvsPrefs.WhichVersion() == kWin32 ? "cvs95.exe" : "cvs.exe");
01078 #endif
01079
01080     return path.c_str();
01081 }

int CvsPrefs::WordWrapLogMsg ( void ) const

Definition at line 239 of file CvsPrefs.cpp.

00239 {return gWordWrapLogMsg;}

bool CvsPrefs::Z9Option ( void ) const

Definition at line 155 of file CvsPrefs.cpp.

00156 {
00157 #ifdef macintosh
00158     // because of the problem with LSH...
00159     return true;
00160 #endif
00161     return gZ9Option;
00162 }

int CvsPrefs::ZLevel ( void ) const

Definition at line 236 of file CvsPrefs.cpp.

00236 {return gZLevel;}

bool CvsPrefs::empty ( void ) const

Definition at line 309 of file CvsPrefs.cpp.

Referenced by save().

00310 {
00311     return gCvsroot.empty();
00312 }

void CvsPrefs::flush_list ( void ) [protected]

Definition at line 447 of file CvsPrefs.cpp.

Referenced by load().

00448 {
00449     for(int i = 0; i < NUM_CVSROOT; i++)
00450     {
00451         get_cvsroot_list(i) = "";
00452     }
00453 }

UPStr & CvsPrefs::get_cvsroot_list ( int entry ) [protected]

Definition at line 339 of file CvsPrefs.cpp.

00340 {
00341     switch(entry)
00342     {
00343     case 0:
00344         return gCvsroot1;
00345         break;
00346     case 1:
00347         return gCvsroot2;
00348         break;
00349     case 2:
00350         return gCvsroot3;
00351         break;
00352     case 3:
00353         return gCvsroot4;
00354         break;
00355     case 4:
00356         return gCvsroot5;
00357         break;
00358         break;
00359     case 5:
00360         return gCvsroot6;
00361         break;
00362     case 6:
00363         return gCvsroot7;
00364         break;
00365     case 7:
00366         return gCvsroot8;
00367         break;
00368     case 8:
00369         return gCvsroot9;
00370         break;
00371     case 9:
00372         return gCvsroot10;
00373         break;
00374     case 10:
00375         return gCvsroot11;
00376         break;
00377     case 11:
00378         return gCvsroot12;
00379         break;
00380     case 12:
00381         return gCvsroot13;
00382         break;
00383     case 13:
00384         return gCvsroot14;
00385         break;
00386     case 14:
00387         return gCvsroot15;
00388         break;
00389     case 15:
00390         return gCvsroot16;
00391         break;
00392     case 16:
00393         return gCvsroot17;
00394         break;
00395     case 17:
00396         return gCvsroot18;
00397         break;
00398     case 18:
00399         return gCvsroot19;
00400         break;
00401     case 19:
00402         return gCvsroot20;
00403         break;
00404     }
00405     return gCvsroot1;
00406 }

const UPStr& CvsPrefs::get_cvsroot_list ( int entry ) const [inline]

Definition at line 205 of file CvsPrefs.h.

Referenced by flush_list(), has_cvsroot_in_list(), insert_cvsroot_in_list(), and load().

00206         {return ((CvsPrefs *)this)->get_cvsroot_list(entry);}

bool CvsPrefs::has_cvsroot_in_list | ( | const char * | cvsroot,
 |  | int & | entry
 | ) | [protected]

Definition at line 408 of file CvsPrefs.cpp.

Referenced by insert_cvsroot_in_list().

00409 {
00410     for(int i = 0; i < NUM_CVSROOT; i++)
00411     {
00412         CPStr & str = get_cvsroot_list(i);
00413         if(str.empty())
00414             continue;
00415         if(strcmp(str, cvsroot) == 0)
00416         {
00417             entry = i;
00418             return true;
00419         }
00420     }
00421     return false;
00422 }

void CvsPrefs::insert_cvsroot_in_list ( const char * cvsroot ) [protected]

Definition at line 424 of file CvsPrefs.cpp.

Referenced by save().

00425 {
00426     int entry;
00427
00428     if(has_cvsroot_in_list(cvsroot, entry))
00429     {
00430         // move to the first entry
00431         CPStr tmp;
00432         tmp = get_cvsroot_list(0);
00433         get_cvsroot_list(0) = get_cvsroot_list(entry);
00434         get_cvsroot_list(entry) = tmp;
00435     }
00436     else
00437     {
00438         // push back the entry
00439         for(int i = (NUM_CVSROOT - 1); i >= 1; i--)
00440         {
00441             get_cvsroot_list(i) = get_cvsroot_list(i - 1);
00442         }
00443         get_cvsroot_list(0) = cvsroot;
00444     }
00445 }

int CvsPrefs::length ( void ) const

Definition at line 314 of file CvsPrefs.cpp.

00315 {
00316     return gCvsroot.length();
00317 }

void CvsPrefs::load ( void )

Definition at line 487 of file CvsPrefs.cpp.

00488 {
00489     // flush the CVSROOT list, it will be filled later
00490     flush_list();
00491
00492     bool loaded = CPersistent::LoadAll();
00493
00494     if( loaded )
00495         return;
00496
00497     // backward compatibility
00498 #ifdef WIN32
00499     UINT value;
00500
00501     CString cstr = AfxGetApp()->GetProfileString(PROFILE_NAME, "CVSROOT");
00502     if(!cstr.IsEmpty())
00503         *this = (const char *)cstr;
00504
00505     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "CheckoutRO", -1)) != -1)
00506         SetCheckoutRO(value ? 1 : 0);
00507     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "Z9Option", -1)) != -1)
00508         SetZ9Option(value ? 1 : 0);
00509     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "QuietOption", -1)) != -1)
00510         SetQuietOption(value ? 1 : 0);
00511     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "PruneOption", -1)) != -1)
00512         SetPruneOption(value ? 1 : 0);
00513     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "Authentication", -1)) != -1)
00514         gAuthen.setkind((AuthenKind)value);
00515     if((value = AfxGetApp()->GetProfileInt(PROFILE_NAME, "AddControl", -1)) != -1)
00516         SetAddControl(value ? 1 : 0);
00517
00518     char tmp[20];
00519     for(int i = 0; i < NUM_CVSROOT; i++)
00520     {
00521         sprintf(tmp, "CVSROOTLIST%d", i);
00522         cstr = AfxGetApp()->GetProfileString(PROFILE_NAME, tmp);
00523         if(!cstr.IsEmpty())
00524             get_cvsroot_list(i) = (const char *)cstr;
00525     }
00526 #endif /* WIN32 */
00527
00528 #if defined(macintosh) && !TARGET_API_MAC_CARBON
00529     FSSpec theFolder;
00530     short FRef;
00531     Handle hdl;
00532     OSErr err;
00533     Str255 thePath;
00534
00535     err = MacGetPrefsFolder(theFolder, thePath);
00536     if(err != noErr)
00537         return;
00538
00539     err = HSetVol(NULL, theFolder.vRefNum, theFolder.parID);
00540     FRef = OpenResFile(PCVS);
00541     if(FRef < 0)
00542         return;
00543
00544     hdl = GetResource('CVS ', 128);
00545     if(hdl != NULL)
00546     {
00547         Str255 str;
00548         HLock(hdl);
00549         BlockMove(*hdl, str, (*hdl)[0] + 1);
00550         str[str[0] + 1] = '\0';
00551         *this = (const char *)str + 1;
00552         HUnlock(hdl);
00553     }
00554     hdl = GetResource('CHRO', 128);
00555     if(hdl != NULL)
00556     {
00557         SetCheckoutRO(**hdl);
00558     }
00559     hdl = GetResource('Z9OP', 128);
00560     if(hdl != NULL)
00561     {
00562         SetZ9Option(**hdl);
00563     }
00564     hdl = GetResource('QUIE', 128);
00565     if(hdl != NULL)
00566     {
00567         SetQuietOption(**hdl);
00568     }
00569     hdl = GetResource('POPT', 128);
00570     if(hdl != NULL)
00571     {
00572         SetPruneOption(**hdl);
00573     }
00574     hdl = GetResource('AUTH', 128);
00575     if(hdl != NULL)
00576     {
00577         gAuthen.setkind((AuthenKind)**hdl);
00578     }
00579     hdl = GetResource('ISOC', 128);
00580     if(hdl != NULL)
00581     {
00582         SetIsoConvert((ISO8559)**hdl);
00583     }
00584     hdl = GetResource('ICTO', 128);
00585     if(hdl != NULL)
00586     {
00587         SetICTextOption(**hdl);
00588     }
00589     hdl = GetResource('ACTL', 128);
00590     if(hdl != NULL)
00591     {
00592         SetAddControl(**hdl);
00593     }
00594
00595     for(int i = 0; i < NUM_CVSROOT; i++)
00596     {
00597         hdl = GetResource('CROL', 128 + i);
00598         if(hdl != NULL)
00599         {
00600             HLock(hdl);
00601             get_cvsroot_list(i) = (const char *)*hdl;
00602             HUnlock(hdl);
00603         }
00604     }
00605     CloseResFile (FRef);
00606 #endif /* macintosh && !TARGET_API_MAC_CARBON */
00607 }

CvsPrefs::operator const char * ( ) const

Definition at line 319 of file CvsPrefs.cpp.

00320 {
00321     return (const char *)gCvsroot;
00322 }

CvsPrefs::operator const unsigned char * ( ) const

Definition at line 324 of file CvsPrefs.cpp.

00325 {
00326     return (const unsigned char *)gCvsroot;
00327 }

const unsigned char * CvsPrefs::operator= ( const unsigned char * newstr )

Definition at line 334 of file CvsPrefs.cpp.

00335 {
00336     return gCvsroot = newstr;
00337 }

const char * CvsPrefs::operator= ( const char * newstr )

Definition at line 329 of file CvsPrefs.cpp.

00330 {
00331     return gCvsroot = newstr;
00332 }

void CvsPrefs::save ( void )

Definition at line 455 of file CvsPrefs.cpp.

00456 {
00457     if(empty())
00458         return;
00459
00460     bool needSave = CPersistent::NeedSave();
00461     bool needSaveSettings = CPersistent::NeedSave(true);
00462     if(!needSave)
00463         return;
00464
00465     // update the CVSROOT list
00466     insert_cvsroot_in_list((const char *)*this);
00467
00468     CPersistent::SaveAll();
00469
00470     if(!needSaveSettings)
00471         return;
00472
00473 #ifdef WIN32
00474     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00475     SavePersistentSettings(app->GetBrowserView()->GetRoot());
00476 #endif
00477 #ifdef qMacCvsPP
00478     CMacCvsApp::SavePersistentSettings();
00479 #endif /* qMacCvsPP */
00480 #if qUnix
00481     UCvsFolders *browser = UCvsApp::gApp->GetBrowserView();
00482     if(browser != 0L && browser->GetRoot() != 0L)
00483         SavePersistentSettings(browser->GetRoot());
00484 #endif
00485 }

Member Data Documentation

int CvsPrefs::fCvsRunningCounter [protected]

Definition at line 210 of file CvsPrefs.h.

bool CvsPrefs::fHasLoggedIn [protected]

Definition at line 208 of file CvsPrefs.h.

int CvsPrefs::fTclFileRunningCounter [protected]

Definition at line 211 of file CvsPrefs.h.

The documentation for this class was generated from the following files:
  • common/CvsPrefs.h
  • common/Authen.cpp
  • common/CvsPrefs.cpp
Generated on Sun Oct 21 12:50:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsProcessCallbacks Struct Reference

#include <cvsgui_process.h>

Collaboration diagram for CvsProcessCallbacks:

[legend]
List of all members.

Public Attributes

long(* | consoleout )(char *txt, long len)
long(* | consoleerr )(char *txt, long len)
const char *(* | getenv )(char *name)
void(* | exit )(int code)

Member Data Documentation

long(* CvsProcessCallbacks::consoleerr)(char *txt, long len)

long(* CvsProcessCallbacks::consoleout)(char *txt, long len)

void(* CvsProcessCallbacks::exit)(int code)

const char*(* CvsProcessCallbacks::getenv)(char *name)

The documentation for this struct was generated from the following file:
  • common/cvsgui_process.h
Generated on Sun Oct 21 12:50:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsProject Class Reference

#include <CvsProject.h>

Collaboration diagram for CvsProject:

[legend]
List of all members.

Public Methods

CvsProject ()
~CvsProject ()
int | getProjectHandle ()
int | getLastError ()
const char * | getProjectName ()
const char * | getProjectHome ()
bool | getErrorMessage (int, CvsString &)
bool | getFilesToAdd (CvsString &)
bool | getFileChanges (CvsString &)
bool | showAdvancedOptionsForCommand (CvsCommand)
bool | hasAdvancedOptionsForCommand (CvsCommand, BOOL &)
bool | showUserInterface (CvsFilenames &)
bool | showFileProperties (const char *)
bool | showFileHistory (CvsFilenames &)
bool | isFileDifferent (const char *, CvsOption, BOOL &)
bool | diffFile (const char *, BOOL, BOOL)
bool | renameFile (const char *, const char *)
bool | removeFiles (CvsFilenames &)
bool | addFiles (CvsFilenames &, const char *)
bool | uncheckoutFiles (CvsFilenames &)
bool | checkinFiles (CvsFilenames &, BOOL)
bool | checkoutFiles (CvsFilenames &)
bool | updateFiles (CvsFilenames &, BOOL, BOOL)
bool | getProject (const char *, const char *, const char *, BOOL, BOOL, BOOL &)
bool | openProject (const char *, const char *, const char *)
bool | closeProject ()

Static Public Methods

CvsProject * | FindProject (int)

Protected Attributes

CvsProject * | m_pNextProject
int | m_hProject
int | m_iLastError
CvsString m_sProjectName
CvsString m_sProjectHome
CvsString m_sUsername

Constructor & Destructor Documentation

CvsProject::CvsProject ( )

Definition at line 20 of file CvsProject.cpp.

00021 :   m_hProject(g_hNextProject++),
00022     m_pNextProject(g_pProjects),
00023     m_iLastError(0)
00024 {
00025     g_pProjects = this;
00026 }

CvsProject::~CvsProject ( )

Definition at line 28 of file CvsProject.cpp.

00029 {
00030     ASSERT(!m_pNextProject);
00031     // Not freed immediately for error catching.
00032 }

Member Function Documentation

CvsProject * CvsProject::FindProject ( int h ) [static]

Definition at line 38 of file CvsProject.cpp.

Referenced by CvsCoworker::GetErrorMessage(), and CvsCoworker::GetLastError().

00039 {
00040     CvsProject* pProject = g_pProjects;
00041     while (pProject) {
00042         if (h == pProject->getProjectHandle()) {
00043             return pProject;
00044         }
00045         pProject = pProject->m_pNextProject;
00046     }
00047     return 0;
00048 }

bool CvsProject::addFiles | ( | CvsFilenames & | sOptionsAndFilenames,
 |  | const char * | sComment
 | ) |

Definition at line 135 of file CvsProject.cpp.

Referenced by CvsCoworker::AddFiles().

00139 {
00140     // TODO: Add your implementation code here
00141     return true;
00142 }

bool CvsProject::checkinFiles | ( | CvsFilenames & | filenames,
 |  | BOOL | bKeepCheckedOut
 | ) |

Definition at line 118 of file CvsProject.cpp.

Referenced by CvsCoworker::CheckinFiles().

00122 {
00123     // TODO: Add your implementation code here
00124     return true;
00125 }

bool CvsProject::checkoutFiles ( CvsFilenames & filenames )

Definition at line 110 of file CvsProject.cpp.

Referenced by CvsCoworker::CheckoutFiles().

00113 {
00114     // TODO: Add your implementation code here
00115     return true;
00116 }

bool CvsProject::closeProject ( )

Definition at line 94 of file CvsProject.cpp.

Referenced by CvsCoworker::CloseProject().

00095 {
00096     // TODO: Add your implementation code here
00097     return true;
00098 }

bool CvsProject::diffFile | ( | const char * | sFilename,
 |  | BOOL | bIgnoreCase,
 |  | BOOL | bIgnoreWhitespace
 | ) |

Definition at line 161 of file CvsProject.cpp.

Referenced by CvsCoworker::DiffFile().

00166 {
00167     // TODO: Add your implementation code here
00168     return true;
00169 }

bool CvsProject::getErrorMessage | ( | int | iError,
 |  | CvsString & | sError
 | ) |

Definition at line 54 of file CvsProject.cpp.

Referenced by CvsCoworker::GetErrorMessage().

00055 {
00056     // TODO: Add your implementation code here
00057     sError = "No error";
00058     return true;
00059 }

bool CvsProject::getFileChanges ( CvsString & sFilenames )

Definition at line 231 of file CvsProject.cpp.

Referenced by CvsCoworker::GetFileChanges().

00234 {
00235     // TODO: Add your implementation code here
00236     return true;
00237 }

bool CvsProject::getFilesToAdd ( CvsString & sFilenames )

Definition at line 239 of file CvsProject.cpp.

Referenced by CvsCoworker::GetFilesToAdd().

00242 {
00243     // TODO: Add your implementation code here
00244     return true;
00245 }

int CvsProject::getLastError ( ) [inline]

Definition at line 27 of file CvsProject.h.

Referenced by CvsCoworker::GetLastError().

00027 { return m_iLastError; }

bool CvsProject::getProject | ( | const char * | sUsername,
 |  | const char * | sProjectName,
 |  | const char * | sProjectHome,
 |  | BOOL | bAllowPathChange,
 |  | BOOL | bAllowNewProject,
 |  | BOOL & | bNewProject
 | ) |

Definition at line 65 of file CvsProject.cpp.

Referenced by CvsCoworker::GetProject().

00073 {
00074     m_sUsername     = sUsername;
00075     m_sProjectName  = sProjectName;
00076     m_sProjectHome  = sProjectHome;
00077     // TODO: Add your implementation code here
00078     return false;
00079 }

int CvsProject::getProjectHandle ( ) [inline]

Definition at line 26 of file CvsProject.h.

Referenced by FindProject(), CvsCoworker::GetProject(), and CvsCoworker::OpenProject().

00026 { return m_hProject; }

const char* CvsProject::getProjectHome ( ) [inline]

Definition at line 29 of file CvsProject.h.

Referenced by CvsCoworker::GetProject().

00029 { return m_sProjectHome; }

const char* CvsProject::getProjectName ( ) [inline]

Definition at line 28 of file CvsProject.h.

Referenced by CvsCoworker::GetProject().

00028 { return m_sProjectName; }

bool CvsProject::hasAdvancedOptionsForCommand | ( | CvsCommand | command,
 |  | BOOL & | bAdvancedOptions
 | ) |

Definition at line 214 of file CvsProject.cpp.

Referenced by CvsCoworker::HasAdvancedOptionsForCommand().

00218 {
00219     // TODO: Add your implementation code here
00220     return true;
00221 }

bool CvsProject::isFileDifferent | ( | const char * | sFilename,
 |  | CvsOption | option,
 |  | BOOL & | bFileIsDifferent
 | ) |

Definition at line 171 of file CvsProject.cpp.

00176 {
00177     bFileIsDifferent = false;
00178     // TODO: Add your implementation code here
00179     return true;
00180 }

bool CvsProject::openProject | ( | const char * | sUsername,
 |  | const char * | sProjectName,
 |  | const char * | sProjectHome
 | ) |

Definition at line 81 of file CvsProject.cpp.

Referenced by CvsCoworker::OpenProject().

00086 {
00087     m_sUsername     = sUsername;
00088     m_sProjectName  = sProjectName;
00089     m_sProjectHome  = sProjectHome;
00090     // TODO: Add your implementation code here
00091     return true;
00092 }

bool CvsProject::removeFiles ( CvsFilenames & filenames )

Definition at line 144 of file CvsProject.cpp.

Referenced by CvsCoworker::RemoveFiles().

00147 {
00148     // TODO: Add your implementation code here
00149     return true;
00150 }

bool CvsProject::renameFile | ( | const char * | sOldFilename,
 |  | const char * | sNewFilename
 | ) |

Definition at line 152 of file CvsProject.cpp.

Referenced by CvsCoworker::RenameFile().

00156 {
00157     // TODO: Add your implementation code here
00158     return true;
00159 }

bool CvsProject::showAdvancedOptionsForCommand ( CvsCommand command )

Definition at line 223 of file CvsProject.cpp.

Referenced by CvsCoworker::ShowAdvancedOptionsForCommand().

00226 {
00227     // TODO: Add your implementation code here
00228     return true;
00229 }

bool CvsProject::showFileHistory ( CvsFilenames & filenames )

Definition at line 182 of file CvsProject.cpp.

Referenced by CvsCoworker::ShowFileHistory().

00185 {
00186     // TODO: Add your implementation code here
00187     return true;
00188 }

bool CvsProject::showFileProperties ( const char * sFilename )

Definition at line 190 of file CvsProject.cpp.

Referenced by CvsCoworker::ShowFileProperties().

00193 {
00194     // TODO: Add your implementation code here
00195     return true;
00196 }

bool CvsProject::showUserInterface ( CvsFilenames & filenames )

Definition at line 198 of file CvsProject.cpp.

Referenced by CvsCoworker::ShowUserInterface().

00201 {
00202     CWnd* pMainWnd = AfxGetMainWnd();
00203     if (pMainWnd) {
00204         pMainWnd->ShowWindow(SW_SHOWDEFAULT);
00205     }
00206     CWinApp* pApp = AfxGetApp();
00207     if (pApp) {
00208          // TBD
00209     }
00210     // TODO: Add your implementation code here
00211     return true;
00212 }

bool CvsProject::uncheckoutFiles ( CvsFilenames & filenames )

Definition at line 127 of file CvsProject.cpp.

Referenced by CvsCoworker::UncheckoutFiles().

00130 {
00131     // TODO: Add your implementation code here
00132     return true;
00133 }

bool CvsProject::updateFiles | ( | CvsFilenames & | filenames,
 |  | BOOL | bDirectories,
 |  | BOOL | bRecurse
 | ) |

Definition at line 100 of file CvsProject.cpp.

Referenced by CvsCoworker::UpdateFiles().

00105 {
00106     // TODO: Add your implementation code here
00107     return true;
00108 }

Member Data Documentation

int CvsProject::m_hProject [protected]

Definition at line 56 of file CvsProject.h.

int CvsProject::m_iLastError [protected]

Definition at line 57 of file CvsProject.h.

CvsProject* CvsProject::m_pNextProject [protected]

Definition at line 55 of file CvsProject.h.

Referenced by FindProject().

CvsString CvsProject::m_sProjectHome [protected]

Definition at line 59 of file CvsProject.h.

CvsString CvsProject::m_sProjectName [protected]

Definition at line 58 of file CvsProject.h.

CvsString CvsProject::m_sUsername [protected]

Definition at line 60 of file CvsProject.h.

The documentation for this class was generated from the following files:
  • WinCvs/CoWorker/CvsProject.h
  • WinCvs/CoWorker/CvsProject.cpp
Generated on Sun Oct 21 12:50:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsString Class Reference

#include <CvsString.h>

Collaboration diagram for CvsString:

[legend]
List of all members.

Public Methods

void | requireSize (int)
int | strlen () const
void | strcpy (const char *)
void | strncpy (const char *, int)
void | strcat (const char *)
char & | operator[] (int i)
CvsString & | operator= (const char *s)
CvsString & | operator= (const CvsString &s)
CvsString & | operator+= (const char *s)
CvsString | operator+ (const char *s) const
int | operator== (const char *s) const
operator const char * () const
int | getBufferMax () const
char * | getBuffer ()
CvsString ()
CvsString (const char *s)
CvsString (const CvsString &s)
~CvsString ()

Protected Methods

void | resize (int)

Static Protected Methods

void | recycle (char *, int)

Protected Attributes

char * | m_sBuffer
int | m_cbBufferMax

Constructor & Destructor Documentation

CvsString::CvsString ( ) [inline]

Definition at line 41 of file CvsString.h.

00041 : m_sBuffer(0), m_cbBufferMax(0) { strcpy(""); }

CvsString::CvsString ( const char * s ) [inline]

Definition at line 42 of file CvsString.h.

00042 : m_sBuffer(0), m_cbBufferMax(0) { strcpy(s); }

CvsString::CvsString ( const CvsString & s ) [inline]

Definition at line 43 of file CvsString.h.

00043 : m_sBuffer(0), m_cbBufferMax(0) { strcpy(s); }

CvsString::~CvsString ( )

Definition at line 50 of file CvsString.cpp.

00051 {
00052     if (m_sBuffer) {
00053         char* p = m_sBuffer;
00054         m_sBuffer = 0;
00055         recycle(p,m_cbBufferMax);
00056     }
00057 }

Member Function Documentation

char* CvsString::getBuffer ( ) [inline]

Definition at line 39 of file CvsString.h.

Referenced by CvsFilenames::CvsFilenames().

00039 { return m_sBuffer; }

int CvsString::getBufferMax ( ) const [inline]

Definition at line 38 of file CvsString.h.

Referenced by CvsFilenames::getFilename(), and CvsFilenames::getOptionsAndFilename().

00038 { return m_cbBufferMax; }

CvsString::operator const char * ( ) const [inline]

Definition at line 36 of file CvsString.h.

00036 { return m_sBuffer; }

CvsString CvsString::operator+ ( const char * s ) const [inline]

Definition at line 32 of file CvsString.h.

00032 { CvsString v(m_sBuffer); v.strcat(s); return v; }

CvsString& CvsString::operator+= ( const char * s ) [inline]

Definition at line 31 of file CvsString.h.

00031 { strcat(s); return *this; }

CvsString& CvsString::operator= ( const CvsString & s ) [inline]

Definition at line 30 of file CvsString.h.

00030 { strcpy(s); return *this; }

CvsString& CvsString::operator= ( const char * s ) [inline]

Definition at line 29 of file CvsString.h.

00029 { strcpy(s); return *this; }

int CvsString::operator== ( const char * s ) const [inline]

Definition at line 34 of file CvsString.h.

00034 { return 0 == strcmp(m_sBuffer,s); }

char& CvsString::operator[] ( int i ) [inline]

Definition at line 24 of file CvsString.h.

00024                              {
00025         if ((i < 0) || ((int)strlen() <= i)) { static char c; return c; }
00026         return m_sBuffer[i];
00027     }

void CvsString::recycle | ( | char * | p,
 |  | int | cb
 | ) | [static, protected]

Definition at line 32 of file CvsString.cpp.

Referenced by resize(), and ~CvsString().

00033 {
00034     CheckBuffer(p,cb);
00035     --p;
00036     if (cbQuanta == cb) {
00037         *(char**)p = g_pListOfFreeBuffers;
00038         g_pListOfFreeBuffers = p;
00039         qTRACE(("* recycle %08lx (%d bytes)",(int)p,cb));
00040     } else {
00041         delete p;
00042         qTRACE(("* recycle %08lx (%d bytes) DELETE",(int)p,cb));
00043     }
00044 }

void CvsString::requireSize ( int cbNew ) [inline]

Definition at line 54 of file CvsString.h.

Referenced by strcat(), strcpy(), and strncpy().

00055 {
00056     if (m_cbBufferMax < cbNew) {
00057         resize(cbNew);
00058     }
00059 }

void CvsString::resize ( int cbNew ) [protected]

Definition at line 63 of file CvsString.cpp.

Referenced by requireSize().

00064 {
00065     char* sOld      = m_sBuffer;
00066     int cbOld       = m_cbBufferMax;
00067
00068     // upsize to 256 byte quanta
00069     cbNew = (cbNew+255)&~255;
00070
00071     char* pNew = g_pListOfFreeBuffers;
00072     if ((cbQuanta == cbNew) && pNew) {
00073         qTRACE(("* resize %08lx (%d bytes) RECYCLED",(int)pNew,cbNew));
00074         g_pListOfFreeBuffers = *(char**)pNew;
00075         *pNew++         = (char)cBOB;
00076     } else {
00077         pNew = new char[cbNew+2];
00078         qTRACE(("* resize %08lx (%d bytes) NEW",(int)pNew,cbNew));
00079         *pNew++         = (char)cBOB;
00080         *(pNew+cbNew)   = (char)cEOB;
00081     }
00082     memset(pNew,0,cbNew);
00083     CheckBuffer(pNew,cbNew);
00084
00085     m_cbBufferMax   = cbNew;
00086     m_sBuffer       = pNew;
00087
00088     if (sOld) {
00089         ASSERT(cbOld <= cbNew);
00090         memcpy(m_sBuffer,sOld,cbOld);
00091         recycle(sOld,cbOld);
00092     }
00093 }

void CvsString::strcat ( const char * s ) [inline]

Definition at line 86 of file CvsString.h.

Referenced by operator+(), and operator+=().

00087 {
00088     requireSize(strlen()+::strlen(s)+1);
00089     ::strcat(m_sBuffer,s);
00090 }

void CvsString::strcpy ( const char * s ) [inline]

Definition at line 65 of file CvsString.h.

Referenced by CvsString(), CvsFilenames::getOptionsAndFilename(), and operator=().

00066 {
00067     requireSize(::strlen(s)+1);
00068     ::strcpy(m_sBuffer,s);
00069 }

int CvsString::strlen ( ) const [inline]

Definition at line 17 of file CvsString.h.

Referenced by operator[](), strcat(), and strcpy().

00017 { return ::strlen(m_sBuffer); }

void CvsString::strncpy | ( | const char * | s,
 |  | int | n
 | ) | [inline]

Definition at line 75 of file CvsString.h.

Referenced by CvsFilenames::getOptionsAndFilename().

00076 {
00077     requireSize(n+1);
00078     ::strncpy(m_sBuffer,s,n);
00079     m_sBuffer[n] = 0;
00080 }

Member Data Documentation

int CvsString::m_cbBufferMax [protected]

Definition at line 47 of file CvsString.h.

char* CvsString::m_sBuffer [protected]

Definition at line 46 of file CvsString.h.

The documentation for this class was generated from the following files:
  • WinCvs/CoWorker/CvsString.h
  • WinCvs/CoWorker/CvsString.cpp
Generated on Sun Oct 21 12:50:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CvsTrace Class Reference

#include <CvsTrace.h>

Collaboration diagram for CvsTrace:

[legend]
List of all members.

Public Methods

CvsTrace (const char *)
~CvsTrace ()

Private Attributes

const char * m_sOuter

Constructor & Destructor Documentation

CvsTrace::CvsTrace ( const char * s )

Definition at line 188 of file CvsTrace.cpp.

00189 :   m_sOuter(0)
00190 {
00191     // skip if not logging
00192     if (!IS_LOGGING()) {
00193         return;
00194     }
00195     Log_printf("> > %s",s);
00196     {
00197         m_sOuter = g_sCurrent;
00198         g_sCurrent = s;
00199         ++g_nLevel;
00200     }
00201 }

CvsTrace::~CvsTrace ( )

Definition at line 203 of file CvsTrace.cpp.

00204 {
00205     // skip if not logging
00206     if (!IS_LOGGING()) {
00207         return;
00208     }
00209     const char* s;
00210     {
00211         --g_nLevel;
00212         s = g_sCurrent;
00213         g_sCurrent = m_sOuter;
00214     }
00215     Log_printf("< < %s",s);
00216 }

Member Data Documentation

const char* CvsTrace::m_sOuter [private]

Definition at line 36 of file CvsTrace.h.

The documentation for this class was generated from the following files:
  • WinCvs/CoWorker/CvsTrace.h
  • WinCvs/CoWorker/CvsTrace.cpp
Generated on Sun Oct 21 12:50:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Vstring Struct Reference

Collaboration diagram for Vstring:

[legend]
List of all members.

Public Attributes

short | length
char | body [NAM$C_MAXRSS+1]

Member Data Documentation

char Vstring::body

Definition at line 58 of file piped_child.c.

short Vstring::length

Definition at line 57 of file piped_child.c.

The documentation for this struct was generated from the following files:
  • cvs-1.10/vms/pipe.c
  • cvs-1.10/vms/piped_child.c
Generated on Sun Oct 21 12:50:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UWaitCursor Class Reference

#include <UCvsFrame.h>

List of all members.

Public Methods

UWaitCursor ()
virtual ~UWaitCursor ()

Constructor & Destructor Documentation

UWaitCursor::UWaitCursor ( ) [inline]

Definition at line 78 of file UCvsFrame.h.

00079     {
00080         UEventSendMessage(kUCvsFrameID, EV_CHGCURSOR, UMAKEINT(kUMainWidget, uCursWatch), 0L);
00081     }

virtual UWaitCursor::~UWaitCursor ( ) [inline, virtual]

Definition at line 82 of file UCvsFrame.h.

00083     {
00084         UEventSendMessage(kUCvsFrameID, EV_CHGCURSOR, UMAKEINT(kUMainWidget, uCursArrow), 0L);
00085     }

The documentation for this class was generated from the following file:
  • common/UCvsFrame.h
Generated on Sun Oct 21 12:50:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


UWidget Class Reference

This is the pseudo widget class. The pseudo widget class allows to access mapped widgets (using the event EV_INIT_WIDGET) and to manipulate them (i.e. set the caption, visible state...). By derivating this class, you can also take advantage of features like modaling dialogs, timers... More...

#include <uwidget.h>

Inheritance diagram for UWidget:

[legend]
Collaboration diagram for UWidget:

[legend]
List of all members.

Public Methods

UWidget (int widid)
  • widid unique pseudo widget identifier.
 More...

virtual | ~UWidget ()
virtual void | AddListener (UCmdTarget *listener)
  • listener has the widget events broadcasted to it.
Note:
listener gets destroyed by the widget when it is destroyed.
 More...

virtual int | UDispatchMessage (int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo)
this is overided in order to broadcast to the listeners. More...

void * | GetWidget (int cmd) const
return a sub-widget as inserted by EV_INIT_WIDGET
  • cmd the sub-widget identifier.
Returns:
a native pointer for the sub-widget.
Note:
the native pointer type depends on the platform implementation.
for example on Windows it's a derivated CWnd *.
 More...

std::map< int, void *> & | GetWidgets (void)
return all the sub-widgets inserted by EV_INIT_WIDGET
Returns:
a STL map with a pair of id and native pointer.
 More...

bool | WidgetIsActive (int cmd) const
return true if a widget has the focus ...
  • cmd the sub-widget identifier.
Warning:
only on Win32.
 More...

const char * | GetTooltip (int cmd) const
return the tooltip (i.e. status/nprompt) or 0L if no tooltip associated with this command
  • cmd the sub-widget identifier.
 More...

void | AddTooltip (int cmd, const char *tooltipID)
associate a tooltip with a sub-widget
  • cmd the sub-widget identifier.
  • tooltipID a string.
 More...

void | AddTimer (long lap, int cmd)
timer handling - add a timer.
  • lap in milliseconds.
  • cmd to fire to the pseudo-widget each time the lap expires.
 More...

void | RemoveTimer (int cmd)
timer handling - remove a timer.
  • cmd associated with the timer.
 More...

std::vector< UTimer > & | GetTimers (void)
timer handling - get the timers. Used internally by the event mamanger. More...

bool | DoModal (int id=0)
modality : works only on the top widget and if it is a window
  • id associated dialog id.
Returns:
true -> OK, false -> Cancel.
Note:
the 'id' is significant by platform (on Mac, that is the id view).
 More...

void | EndModal (bool result)
while modaling, allows to quit the interaction
  • result set the return value for DoModal.
 More...

virtual void | DoDataExchange (bool)
while modaling, allows to fill/read the dialog content.
  • fill says if it expects to fill or read the dialog content.
 More...

virtual void | Dismiss (void)
while modaling, allows to detect when the user cancels the dialog. More...

virtual void | BeforeUpdateUI (void)
update user interface handling : before the EV_UPDATEUI get fired, give a chance to all the widgets to cache some computations used for the handling of the event. More...

bool | HasFocus (void)
tells if the pseudo-widget has the focus. More...

bool | HasFocus (int cmdid)
tells if the pseudo-widget and the sub-widget have the focus. More...

void | AddPage (UWidget *page, int pagecmd, int num_page)
map the widgets inside a pseudo tab-page and the pseudo tab-page to the pseudo-widget.
Warning:
not implemented yet on Win32.
 More...

Static Public Methods

bool | HasModal (void)
tells if any other widget is currently modaling. More...

bool | IsUIValid ()
update user interface handling : check validation says if at this moment the UI is valid (i.e. menus, widgets states are correct). More...

void | DoValidUI (bool how)
update user interface handling : invalidate/validate UI
  • how determines if the UI will be valid.
Note:
if the UI is not valid, the event manager will fire a EV_UPDATEUI event next time it spends time.
Warning:
you generally don't have to use this function since
the pseudo-widgets detect the UI validity automatically.
 More...

int | GetFocus (void)
returns the current pseudo-widget which has the focus
Note:
it is important cause it is used by the event manager
in order to decide which routing for the events.
 More...

int | GetFocusCmd (void)

Protected Methods

int | OnGetState (int cmd)
EV_QUERYSTATE message handling
  • cmd the sub-widget
Returns:
0 or 1 if the widget is checked/pushed...
 More...

void | OnSetState (int cmd, int state)
EV_SETSTATE message handling
  • cmd the sub-widget
  • state of the widget to set (pushed/checked...).
 More...

void | OnEnableCmd (int cmd, int state)
EV_ENABLECMD message handling
  • cmd the sub-widget
  • state of the widget to enable/disable (grayed).
 More...

void | OnChgFocus (int cmd)
EV_CHGFOCUS UWidget message handling
  • cmd the sub-widget to change focus to.
 More...

void | OnInvalidate (int cmd)
EV_INVALIDATE UWidget message handling
  • cmd the sub-widget to redraw (delayed).
 More...

void | OnRedraw (int cmd)
EV_REDRAW UWidget message handling
  • cmd the sub-widget to redraw *now*.
 More...

void | OnSetText (int cmd, const char *text)
EV_SETTEXT message handling
  • cmd the sub-widget
  • text the c-string caption to set.
 More...

void | OnGetText (int cmd, UStr *text)
EV_GETTEXT message handling
  • cmd the sub-widget
  • text is filled with the widget caption.
 More...

void | OnSetFloat (int cmd, const float *f)
EV_SETFLOAT UWidget message handling
  • cmd the sub-widget
  • f the float value the to set.
 More...

void | OnGetFloat (int cmd, float *f)
EV_GETFLOAT UWidget message handling
  • cmd the sub-widget
  • f the float value the to get.
 More...

void | OnInitWidget (int cmd, void *widget)
EV_INIT_WIDGET UWidget message handling
  • cmd the sub-widget
  • widget the native pointer/handle for the sub-widget.
 More...

void | OnInitTabWidget (int cmd, int page, void *widget)
EV_INIT_TAB_WIDGET UWidget message handling
  • cmd the sub-widget page holder
  • page the location for the page insertion
  • widget the native pointer/handle for the sub-widget page
Warning:
not implemented yet on Win32.
 More...

void | OnShowWidget (int cmd, int state)
EV_SHOW message handling
  • cmd the sub-widget
  • state of the widget to show/hide.
 More...

void | OnSetSlider (int cmd, int pos)
EV_SET_SLIDER UWidget message handling
  • cmd the sub-widget
  • pos is the position to set.
 More...

void | OnGetSliderProperty (int cmd, USLIDER *prop)
EV_GET_SLIDERPROP UWidget message handling
  • cmd the sub-widget
  • prop get the informations about this scroller/slider.
 More...

void | OnSetSliderProperty (int cmd, const USLIDER *prop)
EV_SET_SLIDERPROP UWidget message handling
  • cmd the sub-widget
  • prop set the informations about this scroller/slider.
 More...

void | OnSetTooltip (int cmd, UCmdUI *pCmdUI)
EV_USETTOOLTIP message handling
Warning:
not documented.
 More...

void | OnGetLoc (int cmd, URECT *r)
EV_UGETLLOC message handling
  • cmd the sub-widget
  • r get the position of the widget relative to its parent.
 More...

void | OnSetLoc (int cmd, const URECT *r)
EV_USETLLOC message handling
  • cmd the sub-widget
  • r set the position of the widget relative to its parent.
 More...

void | OnChgCursor (int cmd, UCURSOR cursor)
EV_CHGCURSOR UWidget message handling
  • cmd the sub-widget
  • cursor to use in this sub-widget
Warning:
GTK only and limited implementation.
 More...

void | OnUpdateUI (void)
EV_UPDATEUI is a notification sent to all the widgets when the user interface is invalid. the default is to send a EV_UPDTCMD to each sub-widget. More...

void | OnTreeResetAll (int cmd)
EV_TREE_RESETALL UWidget message handling. More...

void | OnTreeInsert (int cmd, UTREE_INSERT *data)
EV_TREE_INSERT UWidget message handling. More...

void | OnTreeGetInfo (int cmd, UTREE_INFO *data)
EV_TREE_GETINFO UWidget message handling. More...

void | OnTreeSetData (int cmd, UTREE_INFO *data)
EV_TREE_SETDATA UWidget message handling. More...

void | OnTreeSetIcon (int cmd, UTREE_INFO *data)
EV_TREE_SETICON UWidget message handling. More...

void | OnTreeDelete (int cmd, UTREEITEM item)
EV_TREE_DELETE UWidget message handling. More...

void | OnTreeExpand (int cmd, int collapse, UTREEITEM item)
EV_TREE_EXPAND UWidget message handling. More...

void | OnTreeSelect (int cmd, int deselect, UTREEITEM item)
EV_TREE_SELECT UWidget message handling. More...

void | OnTreeGetSel (int cmd, UTREEITEM *item)
EV_TREE_GETSEL UWidget message handling. More...

void | OnListAddColumns (int cmd, int num)
EV_LIST_ADDCOLUMNS UWidget message handling. More...

void | OnListSetColTitle (int cmd, int num, const char *title)
EV_LIST_SETCOLTITLE UWidget message handling. More...

void | OnListSetColWidth (int cmd, int num, int width)
EV_LIST_SETCOLWIDTH UWidget message handling. More...

void | OnListResetAll (int cmd)
EV_LIST_RESETALL UWidget message handling. More...

void | OnListAddSel (int cmd, int entry)
EV_LIST_ADDSEL UWidget message handling. More...

void | OnListDelRow (int cmd, int row)
EV_LIST_DELROW UWidget message handling. More...

void | OnListSetFeedback (int cmd, int turnOn)
EV_LIST_SETFEEDBACK UWidget message handling. More...

void | OnListNewRow (int cmd, int *num)
EV_LIST_NEWROW UWidget message handling. More...

void | OnListRowSetData (int cmd, int row, void *data)
EV_LIST_ROWSETDATA UWidget message handling. More...

void | OnListRowGetData (int cmd, int row, void **data)
EV_LIST_ROWGETDATA UWidget message handling. More...

void | OnListInsert (int cmd, ULIST_INSERT *data)
EV_LIST_INSERT UWidget message handling. More...

void | OnListGetInfo (int cmd, ULIST_INFO *desc)
EV_LIST_GETINFO UWidget message handling. More...

int | OnListGetNextSel (int cmd, int selectedCell)
EV_LIST_GETNEXTSEL UWidget message handling. More...

int | OnListGetNext (int cmd, int whichCell)
EV_LIST_GETNEXT UWidget message handling. More...

void | OnListResort (int cmd, int column, UListSorter s)
EV_LIST_RESORT UWidget message handling. More...

void | OnComboResetAll (int cmd)
EV_COMBO_RESETALL UWidget message handling. More...

void | OnComboAppend (int cmd, const char *txt)
EV_COMBO_APPEND UWidget message handling. More...

void | OnComboSetPos (int cmd, int sel)
EV_COMBO_SETSEL UWidget message handling. More...

int | OnComboGetPos (int cmd, UStr *txt)
EV_COMBO_GETSEL UWidget message handling. More...

int | OnComboGetCount (int cmd)
EV_COMBO_GETCOUNT UWidget message handling. More...

void | OnComboDelSel (int cmd, int sel)
EV_COMBO_DELSEL UWidget message handling. More...

void | OnComboEnableSel (int cmd, int sel, int state)
EV_COMBO_ENABLESEL UWidget message handling
Warning:
not implemented on Win32.
 More...

void | OnComboGetMenu (int cmd, UMENU *menu)
EV_COMBO_ENABLESEL UWidget message handling. More...

int | OnUpdateFocus (int leave, void *widget)
EV_UPDATEFOCUS UWidget message handling. More...

int | OnFetchCmd (int cmd, void *widget)
EV_FETCHCMD UWidget message handling. More...

void | OnPageChanged (int cmd, int pagenum)
EV_PAGE UWidget message handling. More...

virtual const UMSGMAP * | GetMessageMap () const

Static Protected Methods

const UMSGMAP * | GetBaseMessageMap ()
const UMSGMAP * | GetThisMessageMap ()

Protected Attributes

std::vector< UCmdTarget *> m_listeners
std::map< int, void *> | m_widgets
std::map< int, UStr > | m_tooltips
std::vector< UTimer > m_timers
std::map< int, UWidget *> | m_tabs
bool | m_modalRes
int | m_currentPage

Static Protected Attributes

bool | sValidMenu = false
int | sFocusWidID = -1
int | sFocusCmdID
const UMSGMAP | messageMap

Static Private Attributes

const UMSGMAP_ENTRY | _messageEntries []

Detailed Description

This is the pseudo widget class. The pseudo widget class allows to access mapped widgets (using the event EV_INIT_WIDGET) and to manipulate them (i.e. set the caption, visible state...). By derivating this class, you can also take advantage of features like modaling dialogs, timers...

Definition at line 106 of file uwidget.h.

Constructor & Destructor Documentation

UWidget::UWidget ( int widid )

  • widid unique pseudo widget identifier.

Definition at line 693 of file uwidget.cpp.

00693                           : UCmdTarget(widid), m_currentPage(-1)
00694 #if qGTK || qMacPP
00695     , m_modalLoop(false)
00696 #endif
00697 #ifdef WIN32
00698     , m_curModal(0L), m_noDispatch(false)
00699 #endif
00700 {
00701 #if qMacAPP
00702     static bool firstTime = true;
00703     if(firstTime)
00704     {
00705         firstTime = false;
00706         gDispatcher->AddBehavior(new TPseudoAppBehavior);
00707             // this behavior takes care about menu routing and giving time
00708             // to the pseudo-events.
00709         new UMacAppMenu();
00710             // for MacApp, we can create automatically the pseudo menu handling.
00711     }
00712 #endif
00713 #if qMacPP
00714     static bool firstTime = true;
00715     if(firstTime && LCommander::GetTopCommander() != 0L)
00716     {
00717         firstTime = false;
00718         LCommander::GetTopCommander()->AddAttachment(NEW LMainPseudoAttachment());
00719     }
00720 #endif
00721 }

UWidget::~UWidget ( ) [virtual]

Definition at line 723 of file uwidget.cpp.

00724 {
00725     std::vector<UCmdTarget *>::iterator i;
00726     for(i = m_listeners.begin(); i != m_listeners.end(); ++i)
00727     {
00728         delete *i;
00729     }
00730     std::map<int, UWidget *>::iterator j;
00731     for(j = m_tabs.begin(); j != m_tabs.end(); ++j)
00732     {
00733         delete (*j).second;
00734     }
00735     if(HasFocus())
00736         sFocusWidID = -1;
00737 }

Member Function Documentation

void UWidget::AddListener ( UCmdTarget * listener ) [virtual]

  • listener has the widget events broadcasted to it.
Note:
listener gets destroyed by the widget when it is destroyed.

Definition at line 739 of file uwidget.cpp.

00740 {
00741     m_listeners.push_back(listener);
00742 }

void UWidget::AddPage | ( | UWidget * | page,
 |  | int | pagecmd,
 |  | int | num_page
 | ) |

map the widgets inside a pseudo tab-page and the pseudo tab-page to the pseudo-widget.

Warning:
not implemented yet on Win32.

Definition at line 3487 of file uwidget.cpp.

Referenced by CompatGetCheckout(), CompatGetCommand(), CompatGetCommit(), CompatGetDiff(), CompatGetImport(), CompatGetLog(), CompatGetUpdate(), CompatRtagBranch(), CompatRtagCreate(), CompatRtagDelete(), CompatTagBranch(), CompatTagCreate(), and CompatTagDelete().

03488 {
03489     void *wid = GetWidget(kUMainWidget);
03490     if(wid == 0L)
03491         return;
03492
03493     UEventSendMessage(page->GetWidID(), EV_INIT_TAB_WIDGET, UMAKEINT(pagecmd, num_page), wid);
03494     std::map<int, UWidget *>::value_type val(UMAKEINT(pagecmd, num_page), page);
03495     m_tabs.insert(val);
03496
03497 #if qMacPP
03498     // emulate the click in tab 1
03499     if(num_page == 0)
03500     {
03501         // emulate the click in tab 1
03502         UEventSendMessage(GetWidID(), EV_PAGE_CHANGED, UMAKEINT(pagecmd, num_page), 0L);
03503     }
03504 #endif /* qMacPP */
03505 }

void UWidget::AddTimer | ( | long | lap,
 |  | int | cmd
 | ) |

timer handling - add a timer.

  • lap in milliseconds.
  • cmd to fire to the pseudo-widget each time the lap expires.

Definition at line 1888 of file uwidget.cpp.

Referenced by UCvsApp::UCvsApp().

01889 {
01890     UTimer timer(lap, ::UTickCount(), cmd);
01891     m_timers.push_back(timer);
01892 }

void UWidget::AddTooltip | ( | int | cmd,
 |  | const char * | tooltipID
 | ) |

associate a tooltip with a sub-widget

  • cmd the sub-widget identifier.
  • tooltipID a string.

Definition at line 885 of file uwidget.cpp.

00886 {
00887     std::map<int, UStr>::value_type val(cmd, UStr(tooltipID));
00888     m_tooltips.insert(val);
00889 }

virtual void UWidget::BeforeUpdateUI ( void ) [inline, virtual]

update user interface handling : before the EV_UPDATEUI get fired, give a chance to all the widgets to cache some computations used for the handling of the event.

Definition at line 196 of file uwidget.h.

Referenced by UEventGiveTime().

00196 {}

virtual void UWidget::Dismiss ( void ) [inline, virtual]

while modaling, allows to detect when the user cancels the dialog.

Definition at line 175 of file uwidget.h.

Referenced by DoModal().

00175 {}

virtual void UWidget::DoDataExchange ( bool fill ) [inline, virtual]

while modaling, allows to fill/read the dialog content.

  • fill says if it expects to fill or read the dialog content.

Reimplemented in UPromptMessage, UEditMessage, UAuthen_SSH, UAuthen_Pserver, UAuthen_Rhosts, UAuthen_Kserver, and USaveSettings.

Definition at line 172 of file uwidget.h.

Referenced by CPseudoDlg::DoDataExchange(), DoModal(), and OnPageChanged().

00172 {}

bool UWidget::DoModal ( int id = 0 )

modality : works only on the top widget and if it is a window

  • id associated dialog id.
Returns:
true -> OK, false -> Cancel.
Note:
the 'id' is significant by platform (on Mac, that is the id view).

Definition at line 1934 of file uwidget.cpp.

Referenced by AskCreatePersistentSettings(), CompatGetCheckout(), CompatGetCommand(), CompatGetCommit(), CompatGetDiff(), CompatGetImport(), CompatGetLog(), CompatGetPassword(), CompatGetUpdate(), CompatImportFilter(), CompatRtagBranch(), CompatRtagCreate(), CompatRtagDelete(), CompatTagBranch(), CompatTagCreate(), CompatTagDelete(), CvsAlert(), AuthenKserver::DoSettings(), AuthenRhosts::DoSettings(), AuthenPserver::DoSettings(), and AuthenSSH::DoSettings().

01935 {
01936     bool result = false;
01937
01938 #if !defined(qMacAPP) && !defined(qMacPP) && !defined(WIN32)
01939     void *w = GetWidget(kUMainWidget);
01940     if(w == 0L)
01941     {
01942         UAppConsole("Unable to find widget id : %d (file %s:%d)\n", kUMainWidget, __FILE__, __LINE__);
01943         return result;
01944     }
01945 #endif // !qMacAPP && !WIN32
01946
01947 #if qGTK || qMacPP
01948     if(m_modalLoop)
01949     {
01950         UAppConsole("Trying to break a modal state\n");
01951         return result;
01952     }
01953 #endif
01954
01955 #ifdef WIN32
01956     CPseudoDlg dlg(id, this);
01957     m_curModal = &dlg;
01958     result = dlg.DoModal() == IDOK;
01959     if(!result)
01960         Dismiss();
01961     m_curModal = 0L;
01962 #endif
01963 #if qMacAPP
01964     TWindow *view = gViewServer->NewTemplateWindow(id, nil);
01965     ThrowIfNULL_AC(view);
01966
01967     UEventSendMessage(GetWidID(), EV_INIT_WIDGET, kUMainWidget, view);
01968
01969     DoDataExchange(true);
01970     IDType resid = view->PoseModally();
01971
01972     TDialogBehavior* dlgb;
01973     if((dlgb = view->GetDialogBehavior()) != 0L)
01974     {
01975         result = resid == dlgb->fDefaultItem;
01976     }
01977
01978     if(result)
01979         DoDataExchange(false);
01980     else
01981         Dismiss();
01982
01983     view->Close();
01984 #endif
01985 #if qMacPP
01986     StDialogHandler theHandler(id, LCommander::GetTopCommander());
01987     LWindow *theDialog = theHandler.GetDialog();
01988
01989     if(theDialog != 0L)
01990     {
01991         UEventSendMessage(GetWidID(), EV_INIT_WIDGET, kUMainWidget, theDialog);
01992
01993         DoDataExchange(true);
01994         theDialog->Show();
01995         theHandler.SetSleepTime(0);
01996
01997         m_modalLoop = true;
01998         MessageT hitMessage;
01999         while (m_modalLoop)
02000         {       // Let DialogHandler process events
02001             hitMessage = theHandler.DoDialog();
02002
02003             if (hitMessage == msg_OK || hitMessage == msg_Cancel)
02004                 break;
02005         }
02006
02007         result = m_modalLoop ? hitMessage == msg_OK : m_modalRes;
02008
02009         if(result)
02010             DoDataExchange(false);
02011         else
02012             Dismiss();
02013
02014         //theDialog->Hide();
02015         //theDialog->DoClose();
02016     }
02017 #endif
02018 #if qGTK
02019     if(GTK_IS_WINDOW(w))
02020     {
02021         // emulate the click in tab 1
02022         std::map<int, UWidget *>::iterator i;
02023         for(i = m_tabs.begin(); i != m_tabs.end(); ++i)
02024         {
02025             int cmdid = ULOWORD((*i).first);
02026             int pagenum = UHIWORD((*i).first);
02027             if(pagenum == 0)
02028             {
02029                 UEventSendMessage(GetWidID(), EV_PAGE_CHANGED, UMAKEINT(cmdid, pagenum), 0L);
02030                 break;
02031             }
02032         }
02033         gtk_signal_connect(GTK_OBJECT(w),"delete_event", GTK_SIGNAL_FUNC(gtkcancel), this);
02034         DoDataExchange(true);
02035         gtk_widget_show(GTK_WIDGET(w));
02036         m_modalLoop = true;
02037         gtk_grab_add (GTK_WIDGET(w));
02038         while (m_modalLoop)
02039         {
02040             gtk_main_iteration_do(TRUE);
02041         }
02042         gtk_grab_remove (GTK_WIDGET(w));
02043         result = m_modalRes;
02044         if(result)
02045         {
02046             UEventSendMessage(GetWidID(), EV_PAGE_CHANGED, UMAKEINT(0, -1), 0L);
02047             DoDataExchange(false);
02048         }
02049         else
02050             Dismiss();
02051         gtk_widget_destroy(GTK_WIDGET(w));
02052     }
02053     else
02054         g_warning("Trying to modal on a non-window\n");
02055 #endif
02056
02057     return result;
02058 }

void UWidget::DoValidUI ( bool how ) [static]

update user interface handling : invalidate/validate UI

  • how determines if the UI will be valid.
Note:
if the UI is not valid, the event manager will fire a EV_UPDATEUI event next time it spends time.
Warning:
you generally don't have to use this function since
the pseudo-widgets detect the UI validity automatically.

Definition at line 149 of file uwidget.cpp.

Referenced by TPseudoAppBehavior::DoSetupMenus(), LMainPseudoAttachment::ExecuteSelf(), UCvsApp::OnMainTimer(), UEventGiveTime(), and UWinPseudoWindowProc().

00149 { sValidMenu = how; }

void UWidget::EndModal ( bool result )

while modaling, allows to quit the interaction

  • result set the return value for DoModal.

Definition at line 2060 of file uwidget.cpp.

Referenced by UPromptMessage::OnCancel(), and USaveSettings::messageMap().

02061 {
02062     m_modalRes = result;
02063 #if qGTK || qMacPP
02064     if(!m_modalLoop)
02065         UAppConsole("EndModal called twice\n");
02066
02067     m_modalLoop = false;
02068 #endif
02069 #if qMacAPP
02070     void *w = GetWidget(kUMainWidget);
02071     if(w == 0L)
02072         return;
02073
02074     TWindow *wind = (TWindow *)w;
02075     TDialogBehavior* dlgb;
02076     if(MA_MEMBER(wind, TWindow) && (dlgb = wind->GetDialogBehavior()) != 0L)
02077     {
02078         wind->Dismiss(result ? dlgb->fDefaultItem : dlgb->fCancelItem, result);
02079     }
02080 #endif
02081 #ifdef WIN32
02082     if(m_curModal != 0L)
02083     {
02084         if (result && !m_curModal->UpdateData(TRUE))
02085         {
02086             TRACE0("UpdateData failed during dialog termination.\n");
02087             // the UpdateData routine will set focus to correct item
02088             return;
02089         }
02090         m_curModal->EndDialog(result ? IDOK : IDCANCEL);
02091     }
02092 #endif
02093 }

const UMSGMAP* UWidget::GetBaseMessageMap ( ) [static, protected]

Reimplemented from UCmdTarget.

Reimplemented in UPromptMessage, UEditMessage, UAuthen_SSH, UAuthen_Pserver, UAuthen_Rhosts, UAuthen_Kserver, USaveSettings, UCvsApp, UCvsConsole, UCvsFiles, UCvsFolders, UCvsFrame, UCvsGraph, UCvsMenubar, UCvsToolbar, UMacAppMenu, UMenu, and UToolbar.

int UWidget::GetFocus ( void ) [static]

returns the current pseudo-widget which has the focus

Note:
it is important cause it is used by the event manager
in order to decide which routing for the events.

Definition at line 150 of file uwidget.cpp.

Referenced by LMainPseudoAttachment::ExecuteSelf(), and UMacAppMenu::OnUpdateUI().

00150 { return sFocusWidID; }

int UWidget::GetFocusCmd ( void ) [static]

Definition at line 151 of file uwidget.cpp.

00151 { return sFocusCmdID; }

virtual const UMSGMAP* UWidget::GetMessageMap ( ) const [protected, virtual]

Reimplemented from UCmdTarget.

Reimplemented in UPromptMessage, UEditMessage, UAuthen_SSH, UAuthen_Pserver, UAuthen_Rhosts, UAuthen_Kserver, USaveSettings, UCvsApp, UCvsConsole, UCvsFiles, UCvsFolders, UCvsFrame, UCvsGraph, UCvsMenubar, UCvsToolbar, UMacAppMenu, UMenu, and UToolbar.

const UMSGMAP* UWidget::GetThisMessageMap ( ) [static, protected]

Reimplemented from UCmdTarget.

Reimplemented in UPromptMessage, UEditMessage, UAuthen_SSH, UAuthen_Pserver, UAuthen_Rhosts, UAuthen_Kserver, USaveSettings, UCvsApp, UCvsConsole, UCvsFiles, UCvsFolders, UCvsFrame, UCvsGraph, UCvsMenubar, UCvsToolbar, UMacAppMenu, UMenu, and UToolbar.

std::vector< UTimer > & UWidget::GetTimers ( void )

timer handling - get the timers. Used internally by the event mamanger.

Definition at line 1907 of file uwidget.cpp.

Referenced by UEventGiveTime().

01908 {
01909     // removed the delayed items
01910     std::vector<UTimer>::iterator i;
01911     for(i = m_timers.begin(); i != m_timers.end(); ++i)
01912     {
01913         if((*i).m_cmd == 0)
01914         {
01915             m_timers.erase(i);
01916             break;
01917         }
01918     }
01919
01920     return m_timers;
01921 }

const char * UWidget::GetTooltip ( int cmd ) const

return the tooltip (i.e. status/nprompt) or 0L if no tooltip associated with this command

  • cmd the sub-widget identifier.

Definition at line 765 of file uwidget.cpp.

Referenced by OnSetTooltip().

00766 {
00767     std::map<int, UStr>::const_iterator i = m_tooltips.find(cmd);
00768     if(i == m_tooltips.end())
00769     {
00770         UAppConsole("Unable to find widget id : %d (file %s:%d)\n", cmd, __FILE__, __LINE__);
00771         return 0L;
00772     }
00773     return (*i).second;
00774 }

void * UWidget::GetWidget ( int cmd ) const

return a sub-widget as inserted by EV_INIT_WIDGET

  • cmd the sub-widget identifier.
Returns:
a native pointer for the sub-widget.
Note:
the native pointer type depends on the platform implementation.
for example on Windows it's a derivated CWnd *.

Definition at line 754 of file uwidget.cpp.

Referenced by AddPage(), UCvsGraph::CalcImageSize(), DoModal(), EndModal(), UCvsConsole::FeedThisLine(), OnChgCursor(), OnChgFocus(), OnComboAppend(), OnComboDelSel(), OnComboEnableSel(), OnComboGetCount(), OnComboGetMenu(), OnComboGetPos(), OnComboResetAll(), OnComboSetPos(), UCvsConsole::OnCreate(), UCvsGraph::OnDrawing(), OnEnableCmd(), OnGetFloat(), OnGetLoc(), OnGetSliderProperty(), OnGetState(), OnGetText(), OnInvalidate(), OnListAddColumns(), OnListAddSel(), OnListDelRow(), OnListGetInfo(), OnListGetNext(), OnListGetNextSel(), OnListInsert(), OnListNewRow(), OnListResetAll(), OnListResort(), OnListRowGetData(), OnListRowSetData(), OnListSetColTitle(), OnListSetColWidth(), OnListSetFeedback(), OnPageChanged(), OnRedraw(), OnSetFloat(), OnSetLoc(), OnSetSlider(), OnSetSliderProperty(), OnSetState(), OnSetText(), OnShowWidget(), UToolbar::OnTbButton(), UToolbar::OnTbCheckBtn(), UToolbar::OnTbInit(), UToolbar::OnTbSeparator(), OnTreeDelete(), OnTreeExpand(), OnTreeGetInfo(), OnTreeGetSel(), OnTreeInsert(), OnTreeResetAll(), OnTreeSelect(), OnTreeSetData(), OnTreeSetIcon(), UToolbar::OnUpdateUI(), UCvsConsole::OutColor(), UMenuAddPulldown(), UWinPseudoWindowProc(), WidgetIsActive(), and macpp_getattachwindow().

00755 {
00756     std::map<int, void *>::const_iterator i = m_widgets.find(cmd);
00757     if(i == m_widgets.end())
00758     {
00759         UAppConsole("Unable to find widget id : %d (file %s:%d)\n", cmd, __FILE__, __LINE__);
00760         return 0L;
00761     }
00762     return (*i).second;
00763 }

std::map<int, void *>& UWidget::GetWidgets ( void ) [inline]

return all the sub-widgets inserted by EV_INIT_WIDGET

Returns:
a STL map with a pair of id and native pointer.

Definition at line 130 of file uwidget.h.

Referenced by CPseudoDlg::DoDataExchange(), UWinPseudoWindowProc(), findIdForWnd(), and CPseudoDlg::~CPseudoDlg().

00130 { return m_widgets; }

bool UWidget::HasFocus ( int cmdid ) [inline]

tells if the pseudo-widget and the sub-widget have the focus.

Definition at line 208 of file uwidget.h.

00208 { return GetFocus() == GetWidID() && GetFocusCmd() == cmdid; }

bool UWidget::HasFocus ( void ) [inline]

tells if the pseudo-widget has the focus.

Definition at line 205 of file uwidget.h.

Referenced by UCvsFolders::DisableGeneric(), UCvsFiles::DisableGeneric(), and ~UWidget().

00205 { return GetFocus() == GetWidID(); }

bool UWidget::HasModal ( void ) [static]

tells if any other widget is currently modaling.

Definition at line 3457 of file uwidget.cpp.

03458 {
03459 #if qGTK
03460     const STD map<int, UCmdTarget *> & targets = UEventGetTargets();
03461     STD map<int, UCmdTarget *>::const_iterator i;
03462     for(i = targets.begin(); i != targets.end(); ++i)
03463     {
03464         UCmdTarget *target = (*i).second;
03465         if(!target->IsKindOf(URUNTIME_CLASS(UWidget)))
03466             continue;
03467
03468         UWidget *wid = (UWidget *)target;
03469         if(wid->m_modalLoop)
03470             return true;
03471     }
03472 #endif
03473     return false;
03474 }

bool UWidget::IsUIValid ( ) [static]

update user interface handling : check validation says if at this moment the UI is valid (i.e. menus, widgets states are correct).

Definition at line 148 of file uwidget.cpp.

Referenced by UEventGiveTime().

00148 { return sValidMenu; }

void UWidget::OnChgCursor | ( | int | cmd,
 |  | UCURSOR | cursor
 | ) | [protected]

EV_CHGCURSOR UWidget message handling

  • cmd the sub-widget
  • cursor to use in this sub-widget
Warning:
GTK only and limited implementation.

Definition at line 2095 of file uwidget.cpp.

02096 {
02097     void *w = GetWidget(cmd);
02098     if(w == 0L)
02099         return;
02100
02101 #if qGTK
02102     if(GTK_IS_WIDGET(w) && GTK_WIDGET(w)->window != 0L)
02103     {
02104         static GdkCursor *cursor_arrow;
02105         static GdkCursor *cursor_watch;
02106         if(cursor_arrow == 0L)
02107         {
02108             cursor_arrow = gdk_cursor_new (GDK_ARROW);
02109             cursor_watch = gdk_cursor_new (GDK_WATCH);
02110         }
02111         if(cursor == uCursArrow)
02112             gdk_window_set_cursor (GTK_WIDGET(w)->window, cursor_arrow);
02113         else if(cursor == uCursWatch)
02114             gdk_window_set_cursor (GTK_WIDGET(w)->window, cursor_watch);
02115     }
02116 #endif
02117 }

void UWidget::OnChgFocus ( int cmd ) [protected]

EV_CHGFOCUS UWidget message handling

  • cmd the sub-widget to change focus to.

Definition at line 1433 of file uwidget.cpp.

01434 {
01435     void *w = GetWidget(cmd);
01436     if(w == 0L)
01437         return;
01438
01439 #if qMacPP
01440     LPane *pane = (LPane *)w;
01441     LCommander *target = dynamic_cast<LCommander *>(pane);
01442     if(target != 0L)
01443     {
01444         LCommander::SwitchTarget(target);
01445     }
01446 #endif
01447 #if qMacAPP
01448     TView *view = (TView *)w;
01449     if(MA_MEMBER(view, TView))
01450     {
01451         if(view->GetWindow() != 0L)
01452             view->GetWindow()->SetWindowTarget(view);
01453     }
01454 #endif
01455 #if qGTK
01456     if(GTK_IS_WIDGET(w))
01457     {
01458         gtk_widget_grab_focus(GTK_WIDGET(w)); // TODO doesn't work
01459     }
01460 #endif
01461 #ifdef WIN32
01462     CWnd *wnd = (CWnd *)w;
01463
01464     wnd->SetFocus();
01465 #endif
01466 }

void UWidget::OnComboAppend | ( | int | cmd,
 |  | const char * | txt
 | ) | [protected]

EV_COMBO_APPEND UWidget message handling.

Definition at line 2422 of file uwidget.cpp.

02423 {
02424     void *w = GetWidget(cmd);
02425     if(w == 0L)
02426         return;
02427
02428 #ifdef WIN32
02429     CWnd *wnd = (CWnd *)w;
02430
02431     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02432     {
02433         CComboBox *combo = (CComboBox *)wnd;
02434         combo->InsertString(-1, txt);
02435     }
02436 #endif
02437 #if qGTK
02438     if(GTK_IS_COMBO(w))
02439     {
02440         GtkWidget *list = GTK_COMBO(w)->list;
02441         GtkWidget *list_item = gtk_list_item_new_with_label(txt);
02442         gtk_container_add( GTK_CONTAINER(list), list_item );
02443         gtk_widget_show( list_item );
02444
02445         gtk_signal_connect( GTK_OBJECT(list_item), "select",
02446                             GTK_SIGNAL_FUNC(gtkcomboclicked), (gpointer)UMAKEINT(GetWidID(), cmd) );
02447     }
02448     else if(GTK_IS_OPTION_MENU(w))
02449     {
02450         GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(w));
02451         GtkWidget *item = gtk_menu_item_new_with_label(txt);
02452         // fix me: where to find the label of the item ?
02453         gtk_object_set_data_full(GTK_OBJECT(item), "rf_menuitemtext", strdup(txt), (GtkDestroyNotify)free);
02454         gtk_signal_connect (GTK_OBJECT(item), "activate",
02455             GTK_SIGNAL_FUNC(gtkmenuactivated), (gpointer)UMAKEINT(GetWidID(), cmd));
02456         gtk_widget_show(item);
02457         gtk_menu_append(GTK_MENU(menu), item);
02458     }
02459 #endif
02460 #if qMacPP
02461     LPane *view = (LPane *)w;
02462     LMenuController *popup;
02463     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02464     {
02465         USemaphore policeman(gTurnOffBroadcast);
02466
02467         if(strcmp(txt, "-") == 0)
02468             popup->InsertMenuItem("\p(-", max_Int16, false);
02469         else
02470             popup->InsertMenuItem(LStr255(txt), max_Int16);
02471     }
02472 #endif
02473 #if qMacAPP
02474     TView *view = (TView *)w;
02475     if(MA_MEMBER(view, TPopup))
02476     {
02477         TPopup *popup = (TPopup *)view;
02478         if(strcmp(txt, "-") == 0)
02479             popup->AddSeparator();
02480         else
02481             popup->AddItem(CStr255_AC(txt));
02482     }
02483 #endif
02484 }

void UWidget::OnComboDelSel | ( | int | cmd,
 |  | int | sel
 | ) | [protected]

EV_COMBO_DELSEL UWidget message handling.

Definition at line 2533 of file uwidget.cpp.

02534 {
02535     void *w = GetWidget(cmd);
02536     if(w == 0L)
02537         return;
02538
02539 #ifdef WIN32
02540     CWnd *wnd = (CWnd *)w;
02541
02542     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02543     {
02544         CComboBox *combo = (CComboBox *)wnd;
02545         combo->DeleteString(sel);
02546     }
02547 #endif
02548 #if qMacPP
02549     LPane *view = (LPane *)w;
02550     LMenuController *popup;
02551     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02552     {
02553         USemaphore policeman(gTurnOffBroadcast);
02554
02555         popup->DeleteMenuItem(sel + 1);
02556     }
02557 #endif
02558 }

void UWidget::OnComboEnableSel | ( | int | cmd,
 |  | int | sel,
 |  | int | state
 | ) | [protected]

EV_COMBO_ENABLESEL UWidget message handling

Warning:
not implemented on Win32.

Definition at line 2560 of file uwidget.cpp.

02561 {
02562     void *w = GetWidget(cmd);
02563     if(w == 0L)
02564         return;
02565
02566 #ifdef WIN32
02567     CWnd *wnd = (CWnd *)w;
02568
02569     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02570     {
02571     }
02572 #endif
02573 #if qMacPP
02574     LPane *view = (LPane *)w;
02575     LMenuController *popup;
02576     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02577     {
02578         if(state)
02579             ::EnableMenuItem(popup->GetMacMenuH(), sel + 1);
02580         else
02581             ::DisableMenuItem(popup->GetMacMenuH(), sel + 1);
02582     }
02583 #endif
02584 }

int UWidget::OnComboGetCount ( int cmd ) [protected]

EV_COMBO_GETCOUNT UWidget message handling.

Definition at line 2673 of file uwidget.cpp.

02674 {
02675     int res = 0; // sanity
02676
02677     void *w = GetWidget(cmd);
02678     if(w == 0L)
02679         return res;
02680
02681 #ifdef WIN32
02682     CWnd *wnd = (CWnd *)w;
02683
02684     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02685     {
02686         CComboBox *combo = (CComboBox *)wnd;
02687         res = combo->GetCount();
02688     }
02689 #endif
02690 #if qMacAPP
02691     TView *view = (TView *)w;
02692     if(MA_MEMBER(view, TPopup))
02693     {
02694         TPopup *popup = (TPopup *)view;
02695         res = popup->GetNumberOfItems();
02696     }
02697 #endif
02698 #if qMacPP
02699     LPane *view = (LPane *)w;
02700     LMenuController *popup;
02701     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02702     {
02703         res = ::CountMenuItems(popup->GetMacMenuH());
02704     }
02705 #endif
02706
02707     return res;
02708 }

void UWidget::OnComboGetMenu | ( | int | cmd,
 |  | UMENU * | menu
 | ) | [protected]

EV_COMBO_ENABLESEL UWidget message handling.

Definition at line 2586 of file uwidget.cpp.

02587 {
02588     *menu = UMENU_NULL; // sanity
02589
02590     void *w = GetWidget(cmd);
02591     if(w == 0L)
02592         return;
02593
02594 #ifdef WIN32
02595     CWnd *wnd = (CWnd *)w;
02596
02597     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02598     {
02599     }
02600 #endif
02601 #if qMacPP
02602     LPane *view = (LPane *)w;
02603     LMenuController *popup;
02604     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02605     {
02606         MenuHandle hdl = popup->GetMacMenuH();
02607         if(hdl != 0L)
02608 #   if ACCESSOR_CALLS_ARE_FUNCTIONS
02609             *menu = GetMenuID(hdl);
02610 #   else
02611             *menu = (**hdl).menuID;
02612 #   endif
02613     }
02614 #endif
02615 }

int UWidget::OnComboGetPos | ( | int | cmd,
 |  | UStr * | txt
 | ) | [protected]

EV_COMBO_GETSEL UWidget message handling.

Definition at line 2617 of file uwidget.cpp.

02618 {
02619     int res = -1; // sanity
02620     if(txt != 0L)
02621         *txt = "";
02622
02623     void *w = GetWidget(cmd);
02624     if(w == 0L)
02625         return res;
02626
02627 #ifdef WIN32
02628     CWnd *wnd = (CWnd *)w;
02629
02630     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02631     {
02632         CComboBox *combo = (CComboBox *)wnd;
02633         res = combo->GetCurSel();
02634         if(res != -1 && txt != 0L)
02635         {
02636             CString s;
02637             combo->GetLBText(res, s);
02638             *txt = s;
02639         }
02640     }
02641 #endif
02642 #if qMacAPP
02643     TView *view = (TView *)w;
02644     if(MA_MEMBER(view, TPopup))
02645     {
02646         TPopup *popup = (TPopup *)view;
02647         res = popup->GetCurrentItem() - 1;
02648         if(txt != 0L)
02649         {
02650             CStr255_AC pstr = popup->GetItemText(res + 1);
02651             *txt = pstr;
02652         }
02653     }
02654 #endif
02655 #if qMacPP
02656     LPane *view = (LPane *)w;
02657     LMenuController *popup;
02658     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02659     {
02660         res = popup->GetCurrentMenuItem() - 1;
02661         if(txt != 0L)
02662         {
02663             LStr255 pstr;
02664             popup->GetMenuItemText(res + 1, pstr);
02665             *txt = pstr;
02666         }
02667     }
02668 #endif
02669
02670     return res;
02671 }

void UWidget::OnComboResetAll ( int cmd ) [protected]

EV_COMBO_RESETALL UWidget message handling.

Definition at line 2365 of file uwidget.cpp.

02366 {
02367     void *w = GetWidget(cmd);
02368     if(w == 0L)
02369         return;
02370
02371 #ifdef WIN32
02372     CWnd *wnd = (CWnd *)w;
02373
02374     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02375     {
02376         CComboBox *combo = (CComboBox *)wnd;
02377         combo->ResetContent();
02378     }
02379 #endif
02380 #if qGTK
02381     if(GTK_IS_COMBO(w))
02382     {
02383         GtkList *listbox = GTK_LIST( GTK_COMBO(w)->list );
02384         if(listbox && listbox->children != 0L)
02385             gtk_list_remove_items( listbox, g_list_copy(listbox->children));
02386     }
02387     else if(GTK_IS_OPTION_MENU(w))
02388     {
02389         GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(w));
02390         GList *list = g_list_copy(GTK_MENU_SHELL(menu)->children);
02391         GList *head = list;
02392         while(list != 0L)
02393         {
02394             GtkWidget *wid = GTK_WIDGET(list->data);
02395             gtk_container_remove(GTK_CONTAINER(menu), wid);
02396             list = (GList *)g_list_next(list);
02397         }
02398         g_list_free(head);
02399     }
02400 #endif
02401 #if qMacPP
02402     LPane *view = (LPane *)w;
02403     LMenuController *popup;
02404     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02405     {
02406         USemaphore policeman(gTurnOffBroadcast);
02407
02408         popup->DeleteAllMenuItems();
02409     }
02410 #endif
02411 #if qMacAPP
02412     TView *view = (TView *)w;
02413     if(MA_MEMBER(view, TPopup))
02414     {
02415         TPopup *popup = (TPopup *)view;
02416         while(popup->GetNumberOfItems() > 0)
02417             popup->DeleteItem(1);
02418     }
02419 #endif
02420 }

void UWidget::OnComboSetPos | ( | int | cmd,
 |  | int | sel
 | ) | [protected]

EV_COMBO_SETSEL UWidget message handling.

Definition at line 2486 of file uwidget.cpp.

02487 {
02488     void *w = GetWidget(cmd);
02489     if(w == 0L)
02490         return;
02491
02492 #ifdef WIN32
02493     CWnd *wnd = (CWnd *)w;
02494
02495     if(wnd->IsKindOf(RUNTIME_CLASS(CComboBox)))
02496     {
02497         CComboBox *combo = (CComboBox *)wnd;
02498         combo->SetCurSel(sel);
02499     }
02500 #endif
02501 #if qGTK
02502     if(GTK_IS_COMBO(w))
02503     {
02504         GtkWidget *list = GTK_COMBO(w)->list;
02505         gtk_list_select_item(GTK_LIST(list), sel);
02506     }
02507     else if(GTK_IS_OPTION_MENU(w))
02508     {
02509         gtk_option_menu_set_history (GTK_OPTION_MENU(w), sel);
02510     }
02511
02512 #endif
02513 #if qMacAPP
02514     TView *view = (TView *)w;
02515     if(MA_MEMBER(view, TPopup))
02516     {
02517         TPopup *popup = (TPopup *)view;
02518         popup->SetCurrentItem(sel + 1, true);
02519     }
02520 #endif
02521 #if qMacPP
02522     LPane *view = (LPane *)w;
02523     LMenuController *popup;
02524     if((popup = dynamic_cast<LMenuController *>(view)) != 0L)
02525     {
02526         USemaphore policeman(gTurnOffBroadcast);
02527
02528         popup->SetCurrentMenuItem(sel + 1);
02529     }
02530 #endif
02531 }

void UWidget::OnEnableCmd | ( | int | cmd,
 |  | int | state
 | ) | [protected]

EV_ENABLECMD message handling

  • cmd the sub-widget
  • state of the widget to enable/disable (grayed).

Definition at line 1400 of file uwidget.cpp.

01401 {
01402     void *w = GetWidget(cmd);
01403     if(w == 0L)
01404         return;
01405
01406 #if qMacPP
01407     LPane *view = (LPane *)w;
01408     if(state)
01409         view->Enable();
01410     else
01411         view->Disable();
01412 #endif
01413 #if qMacAPP
01414     TView *view = (TView *)w;
01415     if(MA_MEMBER(view, TView))
01416     {
01417         view->SetActiveState(state != 0, true);
01418     }
01419 #endif
01420 #if qGTK
01421     if(GTK_IS_WIDGET(w))
01422     {
01423         gtk_widget_set_sensitive(GTK_WIDGET(w), state != 0);
01424     }
01425 #endif
01426 #ifdef WIN32
01427     CWnd *wnd = (CWnd *)w;
01428
01429     wnd->EnableWindow(state != 0);
01430 #endif
01431 }

int UWidget::OnFetchCmd | ( | int | cmd,
 |  | void * | widget
 | ) | [protected]

EV_FETCHCMD UWidget message handling.

Definition at line 3476 of file uwidget.cpp.

03477 {
03478     std::map<int, void *>::const_iterator i;
03479     for(i = m_widgets.begin(); i != m_widgets.end(); ++i)
03480     {
03481         if(widget == (*i).second)
03482             return (*i).first;
03483     }
03484     return -1;
03485 }

void UWidget::OnGetFloat | ( | int | cmd,
 |  | float * | f
 | ) | [protected]

EV_GETFLOAT UWidget message handling

  • cmd the sub-widget
  • f the float value the to get.

Definition at line 1191 of file uwidget.cpp.

01192 {
01193     *f = 0.0; // sanity
01194
01195     void *w = GetWidget(cmd);
01196     if(w == 0L)
01197         return;
01198
01199 #if qMacPP
01200     LPane *view = (LPane *)w;
01201     LEditText *edit;
01202     LStaticText *stat;
01203     if((edit = dynamic_cast<LEditText *>(view)) != 0L)
01204     {
01205         LStr255 pstr;
01206         edit->GetText(pstr);
01207         *f = (double)pstr;
01208     }
01209     else if((stat = dynamic_cast<LStaticText *>(view)) != 0L)
01210     {
01211         LStr255 pstr;
01212         stat->GetText(pstr);
01213         *f = (double)pstr;
01214     }
01215 #endif
01216 #if qMacAPP
01217     TView *view = (TView *)w;
01218     if(MA_MEMBER(view, TPseudoDoubleNumberText))
01219     {
01220         TPseudoDoubleNumberText *num = (TPseudoDoubleNumberText *)view;
01221         *f = num->GetValue();
01222     }
01223 #endif
01224 #ifdef WIN32
01225     CWnd *wnd = (CWnd *)w;
01226
01227     CString s;
01228     wnd->GetWindowText(s);
01229     sscanf(s, "%f", f);
01230 #endif
01231 }

void UWidget::OnGetLoc | ( | int | cmd,
 |  | URECT * | r
 | ) | [protected]

EV_UGETLLOC message handling

  • cmd the sub-widget
  • r get the position of the widget relative to its parent.

Definition at line 776 of file uwidget.cpp.

00777 {
00778     r->left = 0; // sanity
00779     r->right = 0;
00780     r->top = 0;
00781     r->bottom = 0;
00782
00783     void *w = GetWidget(cmd);
00784     if(w == 0L)
00785         return;
00786
00787 #if qMacAPP
00788     TView *view = (TView *)w;
00789     CViewRect mr = view->GetFrame();
00790     view->SuperViewToLocal(mr);
00791     view->LocalToRootView(mr);
00792     r->left = mr.left;
00793     r->right = mr.right;
00794     r->top = mr.top;
00795     r->bottom = mr.bottom;
00796 #endif
00797 #if qMacPP
00798     LPane *view = (LPane *)w;
00799     SPoint32 outLocation;
00800     SDimension16 outSize;
00801     view->GetFrameLocation(outLocation);
00802     view->GetFrameSize(outSize);
00803
00804     *r = URect(UPoint(outLocation.h, outLocation.v), USize(outSize.width, outSize.height));
00805 #endif
00806 #ifdef WIN32
00807     CRect mr;
00808     CWnd *wnd = (CWnd *)w;
00809     wnd->GetClientRect(mr);
00810     CWnd *parent = wnd->GetParent();
00811     if(parent != 0L)
00812     {
00813         wnd->ClientToScreen(mr);
00814         parent->ScreenToClient(mr);
00815     }
00816     r->left = mr.left;
00817     r->right = mr.right;
00818     r->top = mr.top;
00819     r->bottom = mr.bottom;
00820 #endif
00821 }

void UWidget::OnGetSliderProperty | ( | int | cmd,
 |  | USLIDER * | prop
 | ) | [protected]

EV_GET_SLIDERPROP UWidget message handling

  • cmd the sub-widget
  • prop get the informations about this scroller/slider.

Definition at line 1771 of file uwidget.cpp.

01772 {
01773     void *w = GetWidget(cmd);
01774     if(w == 0L)
01775         return;
01776
01777 #ifdef WIN32
01778     CWnd *wnd = (CWnd *)w;
01779
01780     if(wnd->IsKindOf(RUNTIME_CLASS(CSliderCtrl)))
01781     {
01782         CSliderCtrl *slider = (CSliderCtrl *)wnd;
01783         prop->max = slider->GetRangeMax();
01784         prop->min = slider->GetRangeMin();
01785         prop->inc = slider->GetPageSize();
01786         prop->pos = slider->GetPos();
01787     }
01788     else if(wnd->IsKindOf(RUNTIME_CLASS(CScrollBar)))
01789     {
01790         SCROLLINFO info;
01791         CScrollBar *scroll = (CScrollBar *)wnd;
01792         VERIFY(scroll->GetScrollInfo(&info));
01793         prop->max = info.nMax;
01794         prop->min = info.nMin;
01795         prop->inc = info.nPage;
01796         prop->pos = info.nPos;
01797     }
01798 #endif
01799 #if qMacAPP
01800     TView *view = (TView *)w;
01801     if(MA_MEMBER(view, TSlider) || MA_MEMBER(view, TScrollBar))
01802     {
01803         TCtlMgr *ctrl = (TCtlMgr *)view;
01804         prop->max = ctrl->GetMaximum();
01805         prop->min = ctrl->GetMinimum();
01806         if(MA_MEMBER(ctrl, TPseudoScrollBar))
01807             prop->inc = ((TPseudoScrollBar *)ctrl)->fPageStep;
01808         else
01809             prop->inc = 1;
01810         prop->pos = ctrl->GetValue();
01811     }
01812 #endif
01813 #if qMacPP
01814     LPane *view = (LPane *)w;
01815     LControl *ctrl;
01816     if((ctrl = dynamic_cast<LControl *>(view)) != 0L)
01817     {
01818         prop->max = ctrl->GetMaxValue();
01819         prop->min = ctrl->GetMinValue();
01820         LPseudoWinAttachment *attach = macpp_getattachwindow(this);
01821         prop->inc = attach != 0L ? attach->GetPageValue(cmd) : 1;
01822         prop->pos = ctrl->GetValue();
01823     }
01824 #endif
01825 }

int UWidget::OnGetState ( int cmd ) [protected]

EV_QUERYSTATE message handling

  • cmd the sub-widget
Returns:
0 or 1 if the widget is checked/pushed...

Definition at line 1068 of file uwidget.cpp.

01069 {
01070     void *w = GetWidget(cmd);
01071     if(w == 0L)
01072         return 0;
01073
01074     int state = 0; // sanity
01075
01076 #ifdef WIN32
01077     CWnd *wnd = (CWnd *)w;
01078
01079     if(wnd->IsKindOf(RUNTIME_CLASS(CPseudoRotButton)))
01080     {
01081         CPseudoRotButton *btn = (CPseudoRotButton *)wnd;
01082         state = btn->GetCurrent();
01083     }
01084     else if(wnd->IsKindOf(RUNTIME_CLASS(CPseudoToggle)))
01085     {
01086         CPseudoToggle *btn = (CPseudoToggle *)wnd;
01087         state = btn->GetState();
01088     }
01089     else if(wnd->IsKindOf(RUNTIME_CLASS(CButton)))
01090     {
01091         CButton *btn = (CButton *)wnd;
01092         state = btn->GetCheck() != 0;
01093     }
01094     else
01095     {
01096         CString s;
01097         wnd->GetWindowText(s);
01098         sscanf(s, "%d", &state);
01099     }
01100 #endif
01101 #if qGTK
01102     if(GTK_IS_TOGGLE_BUTTON(w))
01103     {
01104         state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)) != 0;
01105     }
01106     else if(GTK_IS_ENTRY(w))
01107     {
01108         gchar *text = gtk_entry_get_text(GTK_ENTRY(w));
01109         sscanf(text, "%d", &state);
01110     }
01111 #endif
01112 #if qMacPP
01113     LPane *view = (LPane *)w;
01114     LCheckBox *check;
01115     LRadioButton *rad;
01116     LEditText *edit;
01117     LStaticText *stat;
01118     LBevelButton *bevel;
01119     UPseudoRotButton *rot;
01120     LCheckBoxGroupBox *groupbox;
01121     LPageController *tabctrl;
01122     LTabsControl *tabctrl2;
01123     LControl *ctrl;
01124     if((check = dynamic_cast<LCheckBox *>(view)) != 0L)
01125     {
01126         state = check->GetValue() == Button_On ? 1 : 0;
01127     }
01128     else if((rad = dynamic_cast<LRadioButton *>(view)) != 0L)
01129     {
01130         state = rad->GetValue() == Button_On ? 1 : 0;
01131     }
01132     else if((edit = dynamic_cast<LEditText *>(view)) != 0L)
01133     {
01134         LStr255 pstr;
01135         edit->GetText(pstr);
01136         state = (SInt32)pstr;
01137     }
01138     else if((stat = dynamic_cast<LStaticText *>(view)) != 0L)
01139     {
01140         LStr255 pstr;
01141         stat->GetText(pstr);
01142         state = (SInt32)pstr;
01143     }
01144     else if((groupbox = dynamic_cast<LCheckBoxGroupBox *>(view)) != 0L)
01145     {
01146         state = groupbox->GetValue() == Button_On ? 1 : 0;
01147     }
01148     else if((rot = dynamic_cast<UPseudoRotButton *>(view)) != 0L)
01149     {
01150         state = rot->GetCurrentState();
01151     }
01152     else if((bevel = dynamic_cast<LBevelButton *>(view)) != 0L)
01153     {
01154         state = bevel->GetValue() == Button_On ? 1 : 0;
01155     }
01156     else if((tabctrl = dynamic_cast<LPageController *>(view)) != 0L)
01157     {
01158         state = tabctrl->GetCurrentPageIndex() - 1;
01159     }
01160     else if((tabctrl2 = dynamic_cast<LTabsControl *>(view)) != 0L)
01161     {
01162         state = tabctrl2->GetValue() - 1;
01163     }
01164     else if((ctrl = dynamic_cast<LControl *>(view)) != 0L)
01165     {
01166         state = ctrl->GetValue();
01167     }
01168 #endif
01169 #if qMacAPP
01170     TView *view = (TView *)w;
01171     if(MA_MEMBER(view, TCheckBox))
01172     {
01173         TCheckBox *check = (TCheckBox *)view;
01174         state = check->GetState();
01175     }
01176     else if(MA_MEMBER(view, TRadio))
01177     {
01178         TRadio *rad = (TRadio *)view;
01179         state = rad->GetState();
01180     }
01181     else if(MA_MEMBER(view, TNumberText))
01182     {
01183         TNumberText *num = (TNumberText *)view;
01184         state = num->GetValue();
01185     }
01186 #endif
01187
01188     return state;
01189 }

void UWidget::OnGetText | ( | int | cmd,
 |  | UStr * | text
 | ) | [protected]

EV_GETTEXT message handling

  • cmd the sub-widget
  • text is filled with the widget caption.

Definition at line 1602 of file uwidget.cpp.

01603 {
01604     *text = ""; // sanity
01605
01606     void *w = GetWidget(cmd);
01607     if(w == 0L)
01608         return;
01609
01610 #ifdef WIN32
01611     CWnd *wnd = (CWnd *)w;
01612
01613     CString s;
01614     wnd->GetWindowText(s);
01615     *text = s;
01616 #endif
01617 #if qGTK
01618     if(GTK_IS_WINDOW(w))
01619     {
01620         *text = GTK_WINDOW(w)->title;
01621     }
01622     else if(GTK_IS_BUTTON(w))
01623     {
01624         GtkLabel *label = getLabelFromContainer(GTK_CONTAINER(w));
01625         if(label != 0L)
01626         {
01627             gchar *str;
01628             gtk_label_get(label, &str);
01629             if(str != 0L)
01630                 *text = str;
01631         }
01632         else
01633             g_warning("Cannot find the label of '%s'\n", gtk_widget_get_name(GTK_WIDGET(w)));
01634     }
01635     else if(GTK_IS_ENTRY(w))
01636     {
01637         *text = gtk_entry_get_text(GTK_ENTRY(w));
01638     }
01639     else if(GTK_IS_COMBO(w))
01640     {
01641         *text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w)->entry));
01642     }
01643     else if(GTK_IS_TEXT(w))
01644     {
01645         GtkText *t = GTK_TEXT(w);
01646         size_t size = gtk_text_get_length(t);
01647         if(size > 0)
01648             text->set((char *)t->text.ch, size);
01649     }
01650     else if(GTK_IS_LABEL(w))
01651     {
01652         GtkLabel *t = GTK_LABEL(w);
01653         gchar *str;
01654         gtk_label_get(t, &str);
01655         if(str != 0L)
01656             *text = str;
01657     }
01658 #endif
01659 #if qMacPP
01660     LPane *view = (LPane *)w;
01661     LTextEditView *txt;
01662     if((txt = dynamic_cast<LTextEditView *>(view)) != 0L)
01663     {
01664         LStr255 pstr;
01665         Handle hdl = txt->GetTextHandle();
01666         text->set((const char *)*hdl, ::GetHandleSize(hdl));
01667     }
01668     else
01669     {
01670         LStr255 pstr;
01671         view->GetDescriptor(pstr);
01672         *text = pstr;
01673     }
01674 #endif
01675 #if qMacAPP
01676     TView *view = (TView *)w;
01677     if(MA_MEMBER(view, TCtlMgr))
01678     {
01679         TCtlMgr *ctrl = (TCtlMgr *)view;
01680         CStr255_AC pstr = ctrl->GetText();
01681         *text = pstr;
01682     }
01683     else if(MA_MEMBER(view, TStaticText))
01684     {
01685         TStaticText *ctrl = (TStaticText *)view;
01686         CStr255_AC pstr = ctrl->GetText();
01687         *text = pstr;
01688     }
01689     else if(MA_MEMBER(view, TWindow))
01690     {
01691         TWindow *ctrl = (TWindow *)view;
01692         CStr255_AC pstr = ctrl->GetTitle();
01693         *text = pstr;
01694     }
01695 #endif
01696 }

void UWidget::OnInitTabWidget | ( | int | cmd,
 |  | int | page,
 |  | void * | widget
 | ) | [protected]

EV_INIT_TAB_WIDGET UWidget message handling

  • cmd the sub-widget page holder
  • page the location for the page insertion
  • widget the native pointer/handle for the sub-widget page
Warning:
not implemented yet on Win32.

Definition at line 1056 of file uwidget.cpp.

01057 {
01058 #if qGTK
01059     if(GTK_IS_WIDGET(widget))
01060     {
01061         // extract and map to the pseudo widget the sub-widgets begining with 'kUgtkPrefixToken'
01062         _dataTabForeach data = {GetWidID(), cmd, page};
01063         g_datalist_foreach (&GTK_OBJECT(widget)->object_data, dataTabForeach, (gpointer)&data);
01064     }
01065 #endif /* qGTK */
01066 }

void UWidget::OnInitWidget | ( | int | cmd,
 |  | void * | widget
 | ) | [protected]

EV_INIT_WIDGET UWidget message handling

  • cmd the sub-widget
  • widget the native pointer/handle for the sub-widget.

Definition at line 891 of file uwidget.cpp.

00892 {
00893     std::map<int, void *>::value_type val(cmd, widget);
00894     m_widgets.insert(val);
00895
00896 #ifdef WIN32
00897
00898 #endif
00899 #if qMacPP
00900     LPane *view = (LPane *)widget;
00901     if(view != 0L)
00902     {
00903         // fetch the inside widgets and add them the the widget list
00904         static bool sSemaphore = false;
00905         USemaphore policeman(sSemaphore);
00906         if(!policeman.IsEnteredTwice())
00907         {
00908             macpp_fecthview(GetWidID(), view);
00909         }
00910
00911         LWindow *wind = dynamic_cast<LWindow*>(view);
00912         if(wind != 0L)
00913         {
00914             LPseudoWinAttachment *attach = NEW LPseudoWinAttachment(GetWidID());
00915             wind->AddAttachment(attach);
00916             macpp_linkbroadcasters(wind, attach);
00917
00918             SPaneInfo inPaneInfo;
00919             memset(&inPaneInfo, 0, sizeof(SPaneInfo));
00920             inPaneInfo.superView = wind;
00921             NEW UPseudoFakePane(inPaneInfo, attach);
00922
00923             // call the create callback
00924             UEventSendMessage(GetWidID(), EV_CREATE, 0, 0L);
00925         }
00926     }
00927 #endif
00928 #if qMacAPP
00929     TView *view = (TView *)widget;
00930     if(MA_MEMBER(view, TView))
00931     {
00932         // fetch the inside widgets and add them the the widget list
00933         static bool sSemaphore = false;
00934         USemaphore policeman(sSemaphore);
00935         if(!policeman.IsEnteredTwice())
00936         {
00937             macapp_fecthview(GetWidID(), view);
00938             //macapp_workaround_adlib_bug(view);
00939         }
00940
00941         if(MA_MEMBER(view, TWindow))
00942         {
00943             // add the pseudo behaviour which re-routes the events to the pseudo-widget
00944             TPseudoWinBehavior *psbehavior = dynamic_cast_AC(TPseudoWinBehavior*,
00945                 view->GetBehaviorWithIdentifier(TPseudoWinBehavior::kPseudoWinBehavior));
00946
00947             if(psbehavior == 0L)
00948             {
00949                 psbehavior = TH_new TPseudoWinBehavior;
00950                 view->AddBehavior(psbehavior);
00951             }
00952             psbehavior->SetPseudoWidget(GetWidID());
00953
00954             // add the pseudo adorner which intercepts the frame size changes
00955             TPseudoWinAdorner *psadorner = dynamic_cast_AC(TPseudoWinAdorner*,
00956                 view->AdornerWithID(TPseudoWinAdorner::kPseudoWinAdorner));
00957
00958             if(psadorner == 0L)
00959             {
00960                 psadorner = TH_new TPseudoWinAdorner;
00961                 view->AddAdorner(psadorner, kAdornLast, false);
00962             }
00963             psadorner->SetPseudoWidget(GetWidID());
00964
00965             // call the create callback
00966             UEventSendMessage(GetWidID(), EV_CREATE, 0, 0L);
00967         }
00968     }
00969 #endif
00970 #if qGTK
00971     static bool firstTime = true;
00972     if(firstTime)
00973     {
00974         // for the disable/enable handling notification (EV_UPDATEUI)
00975         gdk_event_handler_set((GdkEventFunc)gtkmaindoevent, NULL, NULL);
00976
00977         // listen focus events
00978         focus_in_signal_id = gtk_signal_lookup ("focus_in_event", GTK_TYPE_WIDGET);
00979         gtk_signal_add_emission_hook (focus_in_signal_id, gtkeventwatcher, NULL);
00980         focus_out_signal_id = gtk_signal_lookup ("focus_out_event", GTK_TYPE_WIDGET);
00981         gtk_signal_add_emission_hook (focus_out_signal_id, gtkeventwatcher, NULL);
00982
00983         firstTime = false;
00984     }
00985
00986     // so for every widget mapped, we'll be able to find the pseudo-widget associated with.
00987     gtk_object_set_data(GTK_OBJECT(widget), kUgtkDataToken, (gpointer)UMAKEINT(GetWidID(), cmd));
00988
00989     // we are only interesting about the main widgets here
00990     if(GTK_IS_WIDGET(widget))
00991     {
00992         if(cmd == kUMainWidget)
00993         {
00994             // extract and map to the pseudo widget the sub-widgets begining with 'kUgtkPrefixToken'
00995             g_datalist_foreach (&GTK_OBJECT(widget)->object_data, dataForeach, (gpointer)GetWidID());
00996
00997             // map the destroy callback
00998             gtk_signal_connect (GTK_OBJECT(widget), "destroy",
00999                                 GTK_SIGNAL_FUNC(gtkdestroy), (gpointer)this);
01000
01001             gtk_signal_connect (GTK_OBJECT (widget), "key_press_event",
01002                                 GTK_SIGNAL_FUNC(gtkkeypress), (gpointer)this);
01003
01004             // call the create callback
01005             UEventSendMessage(GetWidID(), EV_CREATE, 0, 0L);
01006         }
01007     }
01008
01009     if(GTK_IS_NOTEBOOK(widget))
01010     {
01011         gtk_signal_connect (GTK_OBJECT (widget), "switch_page",
01012                             GTK_SIGNAL_FUNC(gtkswitchpage),
01013                             (gpointer)UMAKEINT(GetWidID(), cmd));
01014     }
01015
01016     if(GTK_IS_BUTTON(widget))
01017     {
01018         gtk_signal_connect (GTK_OBJECT(widget), "clicked",
01019             GTK_SIGNAL_FUNC(gtkclicked), (gpointer)UMAKEINT(GetWidID(), cmd));
01020     }
01021
01022     if(GTK_IS_MENU_ITEM(widget))
01023     {
01024         gtk_signal_connect(GTK_OBJECT(widget), "activate",
01025             GTK_SIGNAL_FUNC(gtkmenuitemactivate), (gpointer)UMAKEINT(GetWidID(), cmd));
01026     }
01027
01028     if(GTK_IS_CLIST(widget))
01029     {
01030         gtk_signal_connect (GTK_OBJECT(widget), "select_row",
01031             GTK_SIGNAL_FUNC(gtkselectclist), (gpointer)UMAKEINT(GetWidID(), cmd));
01032
01033         gtk_signal_connect (GTK_OBJECT(widget), "click_column",
01034             GTK_SIGNAL_FUNC(gtkselectclistcolumn), (gpointer)UMAKEINT(GetWidID(), cmd));
01035
01036         gtk_signal_connect_after (GTK_OBJECT (widget), "button_press_event",
01037                                   GTK_SIGNAL_FUNC (gtkclistdblclick), (gpointer)UMAKEINT(GetWidID(), cmd));
01038     }
01039
01040     if(GTK_IS_DRAWING_AREA(widget))
01041     {
01042         gtk_signal_connect (GTK_OBJECT(widget), "expose_event",
01043                             GTK_SIGNAL_FUNC (gtkexposeevent), (gpointer)UMAKEINT(GetWidID(), cmd));
01044         gtk_widget_set_events (GTK_WIDGET(widget), GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
01045     }
01046
01047     if(GTK_IS_LAYOUT(widget))
01048     {
01049         gtk_signal_connect (GTK_OBJECT(widget), "expose_event",
01050                             GTK_SIGNAL_FUNC (gtkexposeevent), (gpointer)UMAKEINT(GetWidID(), cmd));
01051         gtk_widget_set_events (GTK_WIDGET(widget), GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
01052     }
01053 #endif /* qGTK */
01054 }

void UWidget::OnInvalidate ( int cmd ) [protected]

EV_INVALIDATE UWidget message handling

  • cmd the sub-widget to redraw (delayed).

Definition at line 1468 of file uwidget.cpp.

01469 {
01470     void *w = GetWidget(cmd);
01471     if(w == 0L)
01472         return;
01473
01474 #if qMacAPP
01475     TView *view = (TView *)w;
01476     if(MA_MEMBER(view, TView))
01477     {
01478         view->ForceRedraw();
01479     }
01480 #endif
01481 #if qMacPP
01482     LPane *pane = (LPane *)w;
01483     pane->Refresh();
01484 #endif
01485 #ifdef WIN32
01486     CWnd *wnd = (CWnd *)w;
01487
01488     wnd->Invalidate();
01489 #endif
01490 }

void UWidget::OnListAddColumns | ( | int | cmd,
 |  | int | num
 | ) | [protected]

EV_LIST_ADDCOLUMNS UWidget message handling.

Definition at line 2710 of file uwidget.cpp.

02711 {
02712     void *w = GetWidget(cmd);
02713     if(w == 0L)
02714         return;
02715
02716 #if qGTK
02717     if(!GTK_IS_CLIST(w))
02718         return;
02719
02720     //GtkCList *list = GTK_CLIST(w);
02721     // don't know how to do that, for now it relies on glade settings
02722 #endif
02723 #ifdef WIN32
02724     CWnd *wnd = (CWnd *)w;
02725
02726     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02727     {
02728         CListCtrl *list = (CListCtrl *)wnd;
02729         DWORD dwExStyle = ListView_GetExtendedListViewStyle(list->m_hWnd);
02730         dwExStyle |= LVS_EX_FULLROWSELECT;
02731         ListView_SetExtendedListViewStyle(list->m_hWnd, dwExStyle);
02732
02733         while(num--)
02734             list->InsertColumn(0, "", LVCFMT_LEFT, 80);
02735     }
02736 #endif
02737 #if qMacPP
02738     LPane *view = (LPane *)w;
02739     LOutlineTable *table;
02740     LTextTableView *tabtext;
02741     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
02742     {
02743         macpp_preparetable(table);
02744         table->InsertCols( num, 0, nil, nil, false );
02745     }
02746     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
02747     {
02748         macpp_preparetable(GetWidget(kUMainWidget), tabtext);
02749         tabtext->InsertCols( num, 0, nil, nil, false );
02750     }
02751 #endif
02752 }

void UWidget::OnListAddSel | ( | int | cmd,
 |  | int | entry
 | ) | [protected]

EV_LIST_ADDSEL UWidget message handling.

Definition at line 2884 of file uwidget.cpp.

02885 {
02886     void *w = GetWidget(cmd);
02887     if(w == 0L)
02888         return;
02889
02890 #if qMacAPP
02891     TView *view = (TView *)w;
02892     if(MA_MEMBER(view, TPseudoTextListView))
02893     {
02894         TPseudoTextListView *txt = (TPseudoTextListView *)view;
02895         txt->SelectItem(entry + 1, false, true, true);
02896     }
02897 #endif
02898 #if qGTK
02899     if(!GTK_IS_CLIST(w))
02900         return;
02901
02902     GtkCList *list = GTK_CLIST(w);
02903     gtk_clist_select_row(list, entry, 0);
02904 #endif
02905 #ifdef WIN32
02906     CWnd *wnd = (CWnd *)w;
02907
02908     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02909     {
02910         CListCtrl *list = (CListCtrl *)wnd;
02911         VERIFY(list->SetItemState(entry, LVIS_SELECTED, LVIS_SELECTED));
02912         VERIFY(list->EnsureVisible(entry, true));
02913     }
02914 #endif
02915 #if qMacPP
02916     LPane *view = (LPane *)w;
02917     LTableView *table;
02918     if((table = dynamic_cast<LTableView *>(view)) != 0L)
02919     {
02920         STableCell cell(entry + 1, 1);
02921         table->SelectCell(cell);
02922         table->ScrollCellIntoFrame(cell);
02923     }
02924 #endif
02925 }

void UWidget::OnListDelRow | ( | int | cmd,
 |  | int | entry
 | ) | [protected]

EV_LIST_DELROW UWidget message handling.

Definition at line 2927 of file uwidget.cpp.

02928 {
02929     void *w = GetWidget(cmd);
02930     if(w == 0L)
02931         return;
02932
02933 #if qMacAPP
02934     TView *view = (TView *)w;
02935     if(MA_MEMBER(view, TPseudoTextListView))
02936     {
02937         TPseudoTextListView *txt = (TPseudoTextListView *)view;
02938         txt->DelItemAt(entry + 1, 1);
02939     }
02940 #endif
02941 #if qGTK
02942     if(!GTK_IS_CLIST(w))
02943         return;
02944
02945     GtkCList *list = GTK_CLIST(w);
02946     gtk_clist_remove(list, entry);
02947 #endif
02948 #ifdef WIN32
02949     CWnd *wnd = (CWnd *)w;
02950
02951     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02952     {
02953         CListCtrl *list = (CListCtrl *)wnd;
02954         VERIFY(list->DeleteItem(entry));
02955     }
02956 #endif
02957 #if qMacPP
02958     LPane *view = (LPane *)w;
02959     LOutlineTable *table;
02960     LTextTableView *tabtext;
02961     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
02962     {
02963         LOutlineItem* item = table->FindItemForRow(entry + 1);
02964         if(item != 0L)
02965         {
02966             table->RemoveItem(item);
02967         }
02968     }
02969     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
02970     {
02971         tabtext->RemoveRows(1, entry + 1, true);
02972     }
02973 #endif
02974 }

void UWidget::OnListGetInfo | ( | int | cmd,
 |  | ULIST_INFO * | desc
 | ) | [protected]

EV_LIST_GETINFO UWidget message handling.

Definition at line 3336 of file uwidget.cpp.

03337 {
03338     // sanity
03339     desc->data = 0L;
03340     desc->title = 0L;
03341
03342     void *w = GetWidget(cmd);
03343     if(w == 0L)
03344         return;
03345
03346 #if qMacAPP
03347     TView *view = (TView *)w;
03348     if(MA_MEMBER(view, TPseudoTextListView))
03349     {
03350         static UStr cstr; // no good
03351
03352         TPseudoTextListView *txt = (TPseudoTextListView *)view;
03353         CStr255_AC name = txt->GetItemText(desc->row + 1);
03354         cstr = name;
03355         desc->title = cstr;
03356     }
03357 #endif
03358 #if qGTK
03359     if(!GTK_IS_CLIST(w))
03360         return;
03361
03362     GtkCList *list = GTK_CLIST(w);
03363     desc->data = gtk_clist_get_row_data(list, desc->row);
03364     gtk_clist_get_text_is_buggy(list, desc->row, desc->col, (gchar **)&desc->title);
03365 #endif
03366 #ifdef WIN32
03367     CWnd *wnd = (CWnd *)w;
03368
03369     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
03370     {
03371         CListCtrl *list = (CListCtrl *)wnd;
03372
03373         desc->data = (void *)list->GetItemData(desc->row);
03374         static CString s;
03375         s = list->GetItemText(desc->row, desc->col);
03376         desc->title = s;
03377     }
03378 #endif
03379 #if qMacPP
03380     LPane *view = (LPane *)w;
03381     LOutlineTable *table;
03382     LTextTableView *tabtext;
03383     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
03384     {
03385         LOutlineItem *item = table->FindItemForRow(desc->row + 1);
03386         CPseudoItem *theItem;
03387         if((theItem = dynamic_cast<CPseudoItem *>(item)) != 0L)
03388         {
03389             std::map<int, UStr>::iterator i = theItem->m_texts.find(desc->col + 1);
03390             if(i != theItem->m_texts.end())
03391             {
03392                 desc->title = (*i).second;
03393             }
03394             desc->data = theItem->m_data;
03395         }
03396     }
03397     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
03398     {
03399         STableCell cell(desc->row + 1, desc->col + 1);
03400         UInt32 ioDataSize = 255;
03401         char tmp[255];
03402         tabtext->GetCellData(cell, tmp, ioDataSize);
03403         static UStr res;
03404         res.set(tmp, ioDataSize);
03405         desc->title = res;
03406     }
03407 #endif
03408 }

int UWidget::OnListGetNext | ( | int | cmd,
 |  | int | whichCell
 | ) | [protected]

EV_LIST_GETNEXT UWidget message handling.

Definition at line 3200 of file uwidget.cpp.

03201 {
03202     void *w = GetWidget(cmd);
03203     if(w == 0L)
03204         return -1;
03205
03206 #if qGTK
03207     if(!GTK_IS_CLIST(w))
03208         return -1;
03209
03210     if(whichCell == -1)
03211         whichCell = 0;
03212     else
03213         whichCell++;
03214
03215     if(whichCell >= GTK_CLIST(w)->rows)
03216         whichCell = -1;
03217
03218     return whichCell;
03219 #endif
03220 #ifdef WIN32
03221     CWnd *wnd = (CWnd *)w;
03222
03223     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
03224     {
03225         CListCtrl *list = (CListCtrl *)wnd;
03226         return list->GetNextItem(whichCell, LVNI_ALL);
03227     }
03228 #endif
03229 #if qMacPP
03230     LPane *view = (LPane *)w;
03231     LTableView *table;
03232     if((table = dynamic_cast<LTableView *>(view)) != 0L)
03233     {
03234         STableCell sel;
03235
03236         if(whichCell != -1)
03237         {
03238             sel.row = whichCell + 1;
03239             sel.col = 1;
03240         }
03241
03242         while(table->GetNextCell(sel))
03243         {
03244             if(sel.row != whichCell + 1)
03245                 return sel.row - 1;
03246         }
03247     }
03248 #endif
03249
03250     return -1;
03251 }

int UWidget::OnListGetNextSel | ( | int | cmd,
 |  | int | selectedCell
 | ) | [protected]

EV_LIST_GETNEXTSEL UWidget message handling.

Definition at line 3117 of file uwidget.cpp.

03118 {
03119     void *w = GetWidget(cmd);
03120     if(w == 0L)
03121         return -1;
03122
03123 #if qGTK
03124     if(!GTK_IS_CLIST(w))
03125         return -1;
03126
03127     GList *sel = GTK_CLIST(w)->selection;
03128     if(sel == 0L)
03129         return -1;
03130
03131     while(sel != 0L)
03132     {
03133         gint row = GPOINTER_TO_INT(sel->data);
03134         if(selectedCell == -1)
03135             return row;
03136
03137         sel = (GList *)g_list_next(sel);
03138
03139         if(selectedCell == row)
03140         {
03141             return sel == 0L ? -1 : GPOINTER_TO_INT(sel->data);
03142         }
03143     }
03144 #endif
03145 #if qMacAPP
03146     TView *view = (TView *)w;
03147     if(MA_MEMBER(view, TPseudoTextListView))
03148     {
03149         TPseudoTextListView *txt = (TPseudoTextListView *)view;
03150         if(txt->FirstSelectedItem() == 0)
03151             return -1;
03152
03153         for(GridCoordinate c = 0; c < txt->GetNumOfRows(); ++c)
03154         {
03155             if(!txt->IsItemSelected(c + 1))
03156                 continue;
03157
03158             if(selectedCell == -1)
03159                 return c;
03160
03161             if(selectedCell == c)
03162                 selectedCell = -1; // so the next pick is the one
03163         }
03164     }
03165 #endif
03166 #ifdef WIN32
03167     CWnd *wnd = (CWnd *)w;
03168
03169     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
03170     {
03171         CListCtrl *list = (CListCtrl *)wnd;
03172         return list->GetNextItem(selectedCell, LVNI_SELECTED);
03173     }
03174 #endif
03175 #if qMacPP
03176     LPane *view = (LPane *)w;
03177     LTableView *table;
03178     if((table = dynamic_cast<LTableView *>(view)) != 0L)
03179     {
03180         STableCell sel;
03181         if(selectedCell == -1)
03182         {
03183             sel = table->GetFirstSelectedCell();
03184             return sel.row - 1;
03185         }
03186
03187         sel.row = selectedCell + 1;
03188         sel.col = 1;
03189         while(table->GetNextSelectedCell(sel))
03190         {
03191             if(sel.row != selectedCell + 1)
03192                 return sel.row - 1;
03193         }
03194     }
03195 #endif
03196
03197     return -1;
03198 }

void UWidget::OnListInsert | ( | int | cmd,
 |  | ULIST_INSERT * | data
 | ) | [protected]

EV_LIST_INSERT UWidget message handling.

Definition at line 3253 of file uwidget.cpp.

03254 {
03255     void *w = GetWidget(cmd);
03256     if(w == 0L)
03257         return;
03258
03259 #if qGTK
03260     if(!GTK_IS_CLIST(w))
03261         return;
03262
03263     GtkCList *list = GTK_CLIST(w);
03264
03265     if(data->title == 0L && data->icon == 0L)
03266         g_warning("Got an empty cell !\n");
03267     else if(data->title == 0L)
03268     {
03269         GtkPixmap *pix = GTK_PIXMAP(data->icon);
03270         gtk_clist_set_pixmap(list, data->row, data->col, pix->pixmap, pix->mask);
03271     }
03272     else if(data->icon == 0L)
03273     {
03274         gtk_clist_set_text(list, data->row, data->col, data->title);
03275     }
03276     else
03277     {
03278         GtkPixmap *pix = GTK_PIXMAP(data->icon);
03279         gtk_clist_set_pixtext(list, data->row, data->col, data->title, 2, pix->pixmap, pix->mask);
03280     }
03281 #endif
03282 #if qMacAPP
03283     TView *view = (TView *)w;
03284     if(MA_MEMBER(view, TPseudoTextListView))
03285     {
03286         TPseudoTextListView *txt = (TPseudoTextListView *)view;
03287         //txt->InsStringBefore(data->row + 1, data->title);
03288         txt->InsStringLast(data->title);
03289     }
03290 #endif
03291 #ifdef WIN32
03292     CWnd *wnd = (CWnd *)w;
03293
03294     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
03295     {
03296         CListCtrl *list = (CListCtrl *)wnd;
03297         if(data->col == 0)
03298         {
03299             LV_ITEM lvi;
03300             memset(&lvi, 0, sizeof(lvi));
03301             lvi.mask = LVIF_TEXT;
03302             lvi.iItem = data->row;
03303             lvi.iSubItem = 0;
03304             lvi.pszText = (char *)data->title;
03305
03306             list->InsertItem(&lvi);
03307         }
03308         else
03309         {
03310             list->SetItemText(data->row, data->col, data->title);
03311         }
03312     }
03313 #endif
03314 #if qMacPP
03315     LPane *view = (LPane *)w;
03316     LOutlineTable *table;
03317     LTextTableView *tabtext;
03318     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
03319     {
03320         LOutlineItem *item = table->FindItemForRow(data->row + 1);
03321         CPseudoItem *theItem;
03322         if((theItem = dynamic_cast<CPseudoItem *>(item)) != 0L)
03323         {
03324             std::map<int, UStr>::value_type val(data->col + 1, UStr(data->title));
03325             theItem->m_texts.insert(val);
03326         }
03327     }
03328     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
03329     {
03330         STableCell cell(data->row + 1, data->col + 1);
03331         tabtext->SetCellData(cell, data->title, strlen(data->title));
03332     }
03333 #endif
03334 }

void UWidget::OnListNewRow | ( | int | cmd,
 |  | int * | num
 | ) | [protected]

EV_LIST_NEWROW UWidget message handling.

Definition at line 2994 of file uwidget.cpp.

02995 {
02996     *num = 0; // sanity
02997
02998     void *w = GetWidget(cmd);
02999     if(w == 0L)
03000         return;
03001
03002 #if qGTK
03003     if(!GTK_IS_CLIST(w))
03004         return;
03005
03006     gchar *emptyTxts[] = {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
03007
03008     GtkCList *list = GTK_CLIST(w);
03009     *num = gtk_clist_append  (list, emptyTxts);
03010 #endif
03011 #if qMacAPP
03012     TView *view = (TView *)w;
03013     if(MA_MEMBER(view, TPseudoTextListView))
03014     {
03015         TPseudoTextListView *txt = (TPseudoTextListView *)view;
03016         *num = txt->GetNumOfRows();
03017     }
03018 #endif
03019 #ifdef WIN32
03020     CWnd *wnd = (CWnd *)w;
03021
03022     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
03023     {
03024         CListCtrl *list = (CListCtrl *)wnd;
03025         *num = list->GetItemCount();
03026     }
03027 #endif
03028 #if qMacPP
03029     LPane *view = (LPane *)w;
03030     LOutlineTable *table;
03031     LTextTableView *tabtext;
03032     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
03033     {
03034         // Store this information in the list view
03035         CPseudoItem *theItem = NEW CPseudoItem(GetWidID(), cmd);
03036         if(theItem != 0L)
03037         {
03038             TableIndexT outRows, outCols;
03039             table->GetTableSize(outRows, outCols);
03040             // and insert it at the end of the table
03041             LOutlineItem *lastItem = table->FindItemForRow(outRows);
03042             table->InsertItem( theItem, nil, lastItem );
03043             *num = outRows;
03044         }
03045     }
03046     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
03047     {
03048         TableIndexT outRows, outCols;
03049         tabtext->GetTableSize(outRows, outCols);
03050         tabtext->InsertRows(1, outRows);
03051         tabtext->AdjustImageSize(false);
03052         *num = outRows;
03053     }
03054 #endif
03055 }

void UWidget::OnListResetAll ( int cmd ) [protected]

EV_LIST_RESETALL UWidget message handling.

Definition at line 2829 of file uwidget.cpp.

02830 {
02831     void *w = GetWidget(cmd);
02832     if(w == 0L)
02833         return;
02834
02835 #if qGTK
02836     if(!GTK_IS_CLIST(w))
02837         return;
02838
02839     GtkCList *list = GTK_CLIST(w);
02840     gtk_clist_clear(list);
02841 #endif
02842 #if qMacAPP
02843     TView *view = (TView *)w;
02844     if(MA_MEMBER(view, TPseudoTextListView))
02845     {
02846         TPseudoTextListView *txt = (TPseudoTextListView *)view;
02847         txt->RemoveAll();
02848     }
02849 #endif
02850 #if qMacPP
02851     LPane *view = (LPane *)w;
02852     LOutlineTable *table;
02853     LTextTableView *tabtext;
02854     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
02855     {
02856         macpp_preparetable(table);
02857         LArrayIterator iter(table->GetFirstLevelItems());
02858         LOutlineItem* item;
02859         while (iter.Next(&item))
02860         {
02861             table->RemoveItem(item, false, false);
02862         }
02863         table->AdjustImageSize(false);
02864         table->Refresh();
02865     }
02866     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
02867     {
02868         macpp_preparetable(GetWidget(kUMainWidget), tabtext);
02869         tabtext->RemoveAllRows(false);
02870         tabtext->Refresh();
02871     }
02872 #endif
02873 #ifdef WIN32
02874     CWnd *wnd = (CWnd *)w;
02875
02876     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02877     {
02878         CListCtrl *list = (CListCtrl *)wnd;
02879         VERIFY(list->DeleteAllItems());
02880     }
02881 #endif
02882 }

void UWidget::OnListResort | ( | int | cmd,
 |  | int | column,
 |  | UListSorter | s
 | ) | [protected]

EV_LIST_RESORT UWidget message handling.

Definition at line 3410 of file uwidget.cpp.

03411 {
03412     void *w = GetWidget(cmd);
03413     if(w == 0L)
03414         return;
03415
03416 #if qGTK
03417     if(!GTK_IS_CLIST(w))
03418         return;
03419
03420     GtkCList *list = GTK_CLIST(w);
03421
03422     sGtkClistDiff = s;
03423     sGtkClistWid = this;
03424     gtk_clist_set_compare_func(list, gtkclistdefcompare);
03425     gtk_clist_set_sort_column(list, column);
03426     gtk_clist_sort(list);
03427     gtk_clist_set_compare_func(list, 0L);
03428 #endif
03429 }

void UWidget::OnListRowGetData | ( | int | cmd,
 |  | int | row,
 |  | void ** | data
 | ) | [protected]

EV_LIST_ROWGETDATA UWidget message handling.

Definition at line 3086 of file uwidget.cpp.

03087 {
03088     *data = 0L; // sanity
03089
03090     void *w = GetWidget(cmd);
03091     if(w == 0L)
03092         return;
03093
03094 #if qGTK
03095     if(!GTK_IS_CLIST(w))
03096         return;
03097
03098     GtkCList *list = GTK_CLIST(w);
03099     *data = gtk_clist_get_row_data(list, row);
03100 #endif
03101 #if qMacPP
03102     LPane *view = (LPane *)w;
03103     LOutlineTable *table;
03104     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
03105     {
03106         // Store this information in the list view
03107         LOutlineItem *item = table->FindItemForRow(row + 1);
03108         CPseudoItem *theItem;
03109         if((theItem = dynamic_cast<CPseudoItem *>(item)) != 0L)
03110         {
03111             *data = theItem->m_data;
03112         }
03113     }
03114 #endif
03115 }

void UWidget::OnListRowSetData | ( | int | cmd,
 |  | int | num,
 |  | void * | data
 | ) | [protected]

EV_LIST_ROWSETDATA UWidget message handling.

Definition at line 3057 of file uwidget.cpp.

03058 {
03059     void *w = GetWidget(cmd);
03060     if(w == 0L)
03061         return;
03062
03063 #if qGTK
03064     if(!GTK_IS_CLIST(w))
03065         return;
03066
03067     GtkCList *list = GTK_CLIST(w);
03068     gtk_clist_set_row_data(list, num, data);
03069 #endif
03070 #if qMacPP
03071     LPane *view = (LPane *)w;
03072     LOutlineTable *table;
03073     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
03074     {
03075         // Store this information in the list view
03076         LOutlineItem *item = table->FindItemForRow(num + 1);
03077         CPseudoItem *theItem;
03078         if((theItem = dynamic_cast<CPseudoItem *>(item)) != 0L)
03079         {
03080             theItem->m_data = data;
03081         }
03082     }
03083 #endif
03084 }

void UWidget::OnListSetColTitle | ( | int | cmd,
 |  | int | num,
 |  | const char * | title
 | ) | [protected]

EV_LIST_SETCOLTITLE UWidget message handling.

Definition at line 2754 of file uwidget.cpp.

02755 {
02756     void *w = GetWidget(cmd);
02757     if(w == 0L)
02758         return;
02759
02760 #if qGTK
02761     if(!GTK_IS_CLIST(w))
02762         return;
02763
02764     GtkCList *list = GTK_CLIST(w);
02765     gtk_clist_set_column_title (list, num, title);
02766 #endif
02767 #ifdef WIN32
02768     CWnd *wnd = (CWnd *)w;
02769
02770     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02771     {
02772         CListCtrl *list = (CListCtrl *)wnd;
02773         LVCOLUMN col;
02774         memset(&col, 0, sizeof(col));
02775         col.mask = LVCF_TEXT;
02776         col.pszText = (char *)title;
02777         VERIFY(list->SetColumn(num, &col));
02778     }
02779 #endif
02780 }

void UWidget::OnListSetColWidth | ( | int | cmd,
 |  | int | num,
 |  | int | width
 | ) | [protected]

EV_LIST_SETCOLWIDTH UWidget message handling.

Definition at line 2782 of file uwidget.cpp.

02783 {
02784     void *w = GetWidget(cmd);
02785     if(w == 0L)
02786         return;
02787
02788 #if qGTK
02789     if(!GTK_IS_CLIST(w))
02790         return;
02791
02792     GtkCList *list = GTK_CLIST(w);
02793     gtk_clist_set_column_width(list, num, width);
02794 #endif
02795 #ifdef WIN32
02796     CWnd *wnd = (CWnd *)w;
02797
02798     if(wnd->IsKindOf(RUNTIME_CLASS(CListCtrl)))
02799     {
02800         CListCtrl *list = (CListCtrl *)wnd;
02801         LVCOLUMN col;
02802         memset(&col, 0, sizeof(col));
02803         col.mask = LVCF_WIDTH;
02804         col.cx = width;
02805         VERIFY(list->SetColumn(num, &col));
02806     }
02807 #endif
02808 #if qMacPP
02809     LPane *view = (LPane *)w;
02810     LOutlineTable *table;
02811     LTextTableView *tabtext;
02812     if((table = dynamic_cast<LOutlineTable *>(view)) != 0L)
02813     {
02814         macpp_preparetable(table);
02815         LTableGeometry *geom = table->GetTableGeometry();
02816         if(geom != 0L)
02817             geom->SetColWidth(width, num + 1, num + 1);
02818     }
02819     else if((tabtext = dynamic_cast<LTextTableView *>(view)) != 0L)
02820     {
02821         macpp_preparetable(GetWidget(kUMainWidget), tabtext);
02822         LTableGeometry *geom = tabtext->GetTableGeometry();
02823         if(geom != 0L)
02824             geom->SetColWidth(width, num + 1, num + 1);
02825     }
02826 #endif
02827 }

void UWidget::OnListSetFeedback | ( | int | cmd,
 |  | int | turnOn
 | ) | [protected]

EV_LIST_SETFEEDBACK UWidget message handling.

Definition at line 2976 of file uwidget.cpp.

02977 {
02978     void *w = GetWidget(cmd);
02979     if(w == 0L)
02980         return;
02981
02982 #if qGTK
02983     if(!GTK_IS_CLIST(w))
02984         return;
02985
02986     GtkCList *list = GTK_CLIST(w);
02987     if(turnOn)
02988         gtk_clist_thaw(list);
02989     else
02990         gtk_clist_freeze(list);
02991 #endif
02992 }

void UWidget::OnPageChanged | ( | int | cmdid,
 |  | int | num_page
 | ) | [protected]

EV_PAGE UWidget message handling.

Definition at line 3507 of file uwidget.cpp.

03508 {
03509     if(m_currentPage == UMAKEINT(cmdid, num_page))
03510         return;
03511
03512     std::map<int, UWidget *>::iterator i;
03513     if(m_currentPage != -1)
03514     {
03515         i = m_tabs.find(m_currentPage);
03516         if(i != m_tabs.end())
03517         {
03518             UWidget *tab = (*i).second;
03519             tab->DoDataExchange(false);
03520
03521 #if qMacPP
03522             LPseudoWinAttachment *attach = macpp_getattachwindow(this);
03523             if(attach != 0L)
03524             {
03525                 attach->InvalidCache(tab);
03526             }
03527
03528             tab->m_widgets.erase(tab->m_widgets.begin(), tab->m_widgets.end());
03529 #endif /* qMacPP */
03530         }
03531     }
03532
03533     if(num_page == -1)
03534     {
03535         m_currentPage = -1;
03536         return;
03537     }
03538
03539     i = m_tabs.find(UMAKEINT(cmdid, num_page));
03540     if(i != m_tabs.end())
03541     {
03542         UWidget *tab = (*i).second;
03543
03544 #if qMacPP
03545         UPseudoPlaceHolder *holder = dynamic_cast<UPseudoPlaceHolder *>((LPane *)GetWidget(cmdid));
03546         if(holder != 0L)
03547         {
03548             macpp_fecthview(tab->GetWidID(), holder->GetCurrentView());
03549
03550             LPseudoWinAttachment *attach = macpp_getattachwindow(this);
03551             if(attach != 0L)
03552             {
03553                 macpp_linkbroadcasters(holder->GetCurrentView(), attach);
03554             }
03555         }
03556 #endif /* qMacPP */
03557
03558         tab->DoDataExchange(true);
03559     }
03560     m_currentPage = UMAKEINT(cmdid, num_page);
03561 }

void UWidget::OnRedraw ( int cmd ) [protected]

EV_REDRAW UWidget message handling

  • cmd the sub-widget to redraw *now*.

Definition at line 1492 of file uwidget.cpp.

01493 {
01494     void *w = GetWidget(cmd);
01495     if(w == 0L)
01496         return;
01497
01498 #if qMacAPP
01499     TView *view = (TView *)w;
01500     if(MA_MEMBER(view, TView))
01501     {
01502         view->ForceRedraw();
01503     }
01504 #endif
01505 #if qMacPP
01506     LPane *pane = (LPane *)w;
01507     pane->Draw(nil);
01508 #endif
01509 #ifdef WIN32
01510     CWnd *wnd = (CWnd *)w;
01511
01512     wnd->Invalidate();
01513 #endif
01514 }

void UWidget::OnSetFloat | ( | int | cmd,
 |  | const float * | f
 | ) | [protected]

EV_SETFLOAT UWidget message handling

  • cmd the sub-widget
  • f the float value the to set.

Definition at line 1359 of file uwidget.cpp.

01360 {
01361     void *w = GetWidget(cmd);
01362     if(w == 0L)
01363         return;
01364
01365 #if qMacAPP
01366     TView *view = (TView *)w;
01367     if(MA_MEMBER(view, TPseudoDoubleNumberText))
01368     {
01369         TPseudoDoubleNumberText *num = (TPseudoDoubleNumberText *)view;
01370         num->SetValue(*f, true);
01371     }
01372 #endif
01373 #if qMacPP
01374     USemaphore policeman(gTurnOffBroadcast);
01375
01376     LPane *view = (LPane *)w;
01377     LEditText *edit;
01378     LStaticText *stat;
01379     if((edit = dynamic_cast<LEditText *>(view)) != 0L)
01380     {
01381         LStr255 pstr((long double)*f, "\p#####.##");
01382         edit->SetText(pstr);
01383     }
01384     else if((stat = dynamic_cast<LStaticText *>(view)) != 0L)
01385     {
01386         LStr255 pstr((long double)*f, "\p#####.##");
01387         stat->SetText(pstr);
01388     }
01389 #endif
01390 #ifdef WIN32
01391     USemaphore policeman(m_noDispatch);
01392     CWnd *wnd = (CWnd *)w;
01393
01394     char tmp[100];
01395     sprintf(tmp, "%f", *f);
01396     wnd->SetWindowText(tmp);
01397 #endif
01398 }

void UWidget::OnSetLoc | ( | int | cmd,
 |  | const URECT * | r
 | ) | [protected]

EV_USETLLOC message handling

  • cmd the sub-widget
  • r set the position of the widget relative to its parent.

Definition at line 823 of file uwidget.cpp.

00824 {
00825     void *w = GetWidget(cmd);
00826     if(w == 0L)
00827         return;
00828
00829 #if qMacAPP
00830     TView *view = (TView *)w;
00831     CViewRect mr(r->left, r->top, r->right, r->bottom);
00832     if(mr.right < mr.left)
00833         mr.right = mr.left;
00834     if(mr.bottom < mr.top)
00835         mr.bottom = mr.top;
00836     view->RootViewToLocal(mr);
00837     view->LocalToSuperView(mr);
00838     view->SetFrame(mr, true);
00839 #endif
00840 #if qMacPP
00841     LPane *view = (LPane *)w;
00842     SPoint32 oldLocation;
00843     view->GetFrameLocation(oldLocation);
00844     URect newDim(*r);
00845     UPoint offset = newDim.TopLeft() - UPoint(oldLocation.h, oldLocation.v);
00846     view->ResizeFrameTo(newDim.Width(), newDim.Height(), true);
00847     view->MoveBy(offset.x, offset.y, true);
00848 #endif
00849 #ifdef WIN32
00850     CRect wr(r->left, r->top, r->right, r->bottom);
00851     CWnd *wnd = (CWnd *)w;
00852     wnd->MoveWindow(wr, TRUE);
00853 #endif
00854 }

void UWidget::OnSetSlider | ( | int | cmd,
 |  | int | pos
 | ) | [protected]

EV_SET_SLIDER UWidget message handling

  • cmd the sub-widget
  • pos is the position to set.

Definition at line 1730 of file uwidget.cpp.

01731 {
01732     void *w = GetWidget(cmd);
01733     if(w == 0L)
01734         return;
01735
01736 #ifdef WIN32
01737     CWnd *wnd = (CWnd *)w;
01738
01739     if(wnd->IsKindOf(RUNTIME_CLASS(CSliderCtrl)))
01740     {
01741         CSliderCtrl *slider = (CSliderCtrl *)wnd;
01742         slider->SetPos(pos);
01743     }
01744     else if(wnd->IsKindOf(RUNTIME_CLASS(CScrollBar)))
01745     {
01746         CScrollBar *scroll = (CScrollBar *)wnd;
01747         scroll->SetScrollPos(pos);
01748     }
01749 #endif
01750 #if qMacAPP
01751     TView *view = (TView *)w;
01752     if(MA_MEMBER(view, TSlider) || MA_MEMBER(view, TScrollBar))
01753     {
01754         TCtlMgr *ctrl = (TCtlMgr *)view;
01755         ctrl->SetValue(pos, true);
01756     }
01757 #endif
01758 #if qMacPP
01759     USemaphore policeman(gTurnOffBroadcast);
01760
01761     LPane *view = (LPane *)w;
01762     LControl *ctrl;
01763     if((ctrl = dynamic_cast<LControl *>(view)) != 0L)
01764     {
01765         ctrl->SetValue(pos);
01766     }
01767 #endif
01768 }

void UWidget::OnSetSliderProperty | ( | int | cmd,
 |  | const USLIDER * | prop
 | ) | [protected]

EV_SET_SLIDERPROP UWidget message handling

  • cmd the sub-widget
  • prop set the informations about this scroller/slider.

Definition at line 1827 of file uwidget.cpp.

01828 {
01829     void *w = GetWidget(cmd);
01830     if(w == 0L)
01831         return;
01832
01833 #ifdef WIN32
01834     CWnd *wnd = (CWnd *)w;
01835
01836     if(wnd->IsKindOf(RUNTIME_CLASS(CSliderCtrl)))
01837     {
01838         CSliderCtrl *slider = (CSliderCtrl *)wnd;
01839         slider->SetRange(prop->min, prop->max);
01840         slider->SetPos(prop->pos);
01841         slider->SetPageSize(prop->inc);
01842     }
01843     else if(wnd->IsKindOf(RUNTIME_CLASS(CScrollBar)))
01844     {
01845         SCROLLINFO info;
01846         memset(&info, 0, sizeof(info));
01847         info.cbSize = sizeof(info);
01848         info.fMask = SIF_DISABLENOSCROLL | SIF_PAGE | SIF_POS | SIF_RANGE;
01849         info.nMax = prop->max;
01850         info.nMin = prop->min;
01851         info.nPos = prop->pos;
01852         info.nPage = prop->inc;
01853         if(info.nPage > (info.nMax - info.nMin))
01854             info.nPage = (info.nMax - info.nMin) / 2;
01855         CScrollBar *scroll = (CScrollBar *)wnd;
01856         VERIFY(scroll->SetScrollInfo(&info));
01857         if(prop->max != prop->min)
01858             scroll->EnableWindow(TRUE);
01859     }
01860 #endif
01861 #if qMacAPP
01862     TView *view = (TView *)w;
01863     if(MA_MEMBER(view, TSlider) || MA_MEMBER(view, TScrollBar))
01864     {
01865         TCtlMgr *ctrl = (TCtlMgr *)view;
01866         ctrl->SetValues(prop->pos, prop->min, prop->max, true);
01867         if(MA_MEMBER(ctrl, TPseudoScrollBar))
01868             ((TPseudoScrollBar *)ctrl)->fPageStep = prop->inc;
01869     }
01870 #endif
01871 #if qMacPP
01872     USemaphore policeman(gTurnOffBroadcast);
01873
01874     LPane *view = (LPane *)w;
01875     LControl *ctrl;
01876     if((ctrl = dynamic_cast<LControl *>(view)) != 0L)
01877     {
01878         ctrl->SetMaxValue(prop->max);
01879         ctrl->SetMinValue(prop->min);
01880         ctrl->SetValue(prop->pos);
01881         LPseudoWinAttachment *attach = macpp_getattachwindow(this);
01882         if(attach != 0L)
01883             attach->SetPageValue(cmd, prop->inc);
01884     }
01885 #endif
01886 }

void UWidget::OnSetState | ( | int | cmd,
 |  | int | state
 | ) | [protected]

EV_SETSTATE message handling

  • cmd the sub-widget
  • state of the widget to set (pushed/checked...).

Definition at line 1233 of file uwidget.cpp.

01234 {
01235     void *w = GetWidget(cmd);
01236     if(w == 0L)
01237         return;
01238
01239 #ifdef WIN32
01240     CWnd *wnd = (CWnd *)w;
01241
01242     if(wnd->IsKindOf(RUNTIME_CLASS(CPseudoRotButton)))
01243     {
01244         CPseudoRotButton *btn = (CPseudoRotButton *)wnd;
01245         btn->DoRotate(state);
01246     }
01247     else if(wnd->IsKindOf(RUNTIME_CLASS(CPseudoToggle)))
01248     {
01249         CPseudoToggle *btn = (CPseudoToggle *)wnd;
01250         btn->SetState(state);
01251     }
01252     else if(wnd->IsKindOf(RUNTIME_CLASS(CButton)))
01253     {
01254         CButton *btn = (CButton *)wnd;
01255         btn->SetCheck(state != 0);
01256     }
01257     else
01258     {
01259         USemaphore policeman(m_noDispatch);
01260         char tmp[100];
01261         sprintf(tmp, "%d", state);
01262         wnd->SetWindowText(tmp);
01263     }
01264 #endif
01265 #if qGTK
01266     if(GTK_IS_TOGGLE_BUTTON(w))
01267     {
01268         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), state != 0);
01269     }
01270     else if(GTK_IS_ENTRY(w))
01271     {
01272         char tmp[20];
01273         sprintf(tmp, "%d", state);
01274         gtk_entry_set_text(GTK_ENTRY(w), tmp);
01275     }
01276 #endif
01277 #if qMacPP
01278     USemaphore policeman(gTurnOffBroadcast);
01279
01280     LPane *view = (LPane *)w;
01281     LCheckBox *check;
01282     LRadioButton *rad;
01283     LEditText *edit;
01284     LStaticText *stat;
01285     UPseudoRotButton *rot;
01286     LCheckBoxGroupBox *groupbox;
01287     LPageController *tabctrl;
01288     LTabsControl *tabctrl2;
01289     LControl *ctrl;
01290     if((check = dynamic_cast<LCheckBox *>(view)) != 0L)
01291     {
01292         check->SetValue(state ? Button_On : Button_Off);
01293     }
01294     else if((rad = dynamic_cast<LRadioButton *>(view)) != 0L)
01295     {
01296         rad->SetValue(state ? Button_On : Button_Off);
01297     }
01298     else if((groupbox = dynamic_cast<LCheckBoxGroupBox *>(view)) != 0L)
01299     {
01300         groupbox->SetValue(state ? Button_On : Button_Off);
01301     }
01302     else if((edit = dynamic_cast<LEditText *>(view)) != 0L)
01303     {
01304         LStr255 pstr((SInt32)state);
01305         edit->SetText(pstr);
01306     }
01307     else if((stat = dynamic_cast<LStaticText *>(view)) != 0L)
01308     {
01309         LStr255 pstr((SInt32)state);
01310         stat->SetText(pstr);
01311     }
01312     else if((rot = dynamic_cast<UPseudoRotButton *>(view)) != 0L)
01313     {
01314         rot->DoRotate(state);
01315     }
01316     else if((tabctrl = dynamic_cast<LPageController *>(view)) != 0L)
01317     {
01318         tabctrl->SetSelectedPageButtonByIndex(state + 1, false);
01319     }
01320     else if((tabctrl2 = dynamic_cast<LTabsControl *>(view)) != 0L)
01321     {
01322         tabctrl2->SetValue(state + 1);
01323     }
01324     else if((ctrl = dynamic_cast<LControl *>(view)) != 0L)
01325     {
01326         ctrl->SetValue(state);
01327     }
01328 #endif
01329 #if qMacAPP
01330     TView *view = (TView *)w;
01331     if(MA_MEMBER(view, TCheckBox))
01332     {
01333         TCheckBox *check = (TCheckBox *)view;
01334         check->SetState(state, true);
01335     }
01336     else if(MA_MEMBER(view, TRadio))
01337     {
01338         TRadio *rad = (TRadio *)view;
01339         rad->SetState(state, true);
01340     }
01341     else if(MA_MEMBER(view, TNumberText))
01342     {
01343         TNumberText *num = (TNumberText *)view;
01344         num->SetValue(state, true);
01345     }
01346     else if(MA_MEMBER(view, TPseudoRotateIconButton))
01347     {
01348         TPseudoRotateIconButton *rot = (TPseudoRotateIconButton *)view;
01349         rot->DoRotate(state);
01350     }
01351     else if(MA_MEMBER(view, TProgressIndicator))
01352     {
01353         TProgressIndicator *progress = (TProgressIndicator *)view;
01354         progress->SetValue(state, true);
01355     }
01356 #endif
01357 }

void UWidget::OnSetText | ( | int | cmd,
 |  | const char * | text
 | ) | [protected]

EV_SETTEXT message handling

  • cmd the sub-widget
  • text the c-string caption to set.

Definition at line 1516 of file uwidget.cpp.

01517 {
01518     void *w = GetWidget(cmd);
01519     if(w == 0L)
01520         return;
01521
01522 #ifdef WIN32
01523     USemaphore policeman(m_noDispatch);
01524     CWnd *wnd = (CWnd *)w;
01525     wnd->SetWindowText(text);
01526 #endif
01527 #if qGTK
01528     if(GTK_IS_WINDOW(w))
01529     {
01530         gtk_window_set_title(GTK_WINDOW(w), text);
01531     }
01532     else if(GTK_IS_BUTTON(w))
01533     {
01534         GtkLabel *label = getLabelFromContainer(GTK_CONTAINER(w));
01535         if(label != 0L)
01536             gtk_label_set_text(label, text);
01537         else
01538             g_warning("Cannot find the label of '%s'\n", gtk_widget_get_name(GTK_WIDGET(w)));
01539     }
01540     else if(GTK_IS_TEXT(w))
01541     {
01542         GtkText *t = GTK_TEXT(w);
01543         gtk_text_set_point(t, 0);
01544         gtk_text_forward_delete(t, gtk_text_get_length(t));
01545         gtk_text_insert(t, 0L, 0L, 0L, text, -1);
01546     }
01547     else if(GTK_IS_ENTRY(w))
01548     {
01549         gtk_entry_set_text(GTK_ENTRY(w), text);
01550     }
01551     else if(GTK_IS_COMBO(w))
01552     {
01553         gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(w)->entry), text);
01554     }
01555     else if(GTK_IS_LABEL(w))
01556     {
01557         GtkLabel *t = GTK_LABEL(w);
01558         gtk_label_set_text(t, text);
01559     }
01560 #endif
01561 #if qMacPP
01562     USemaphore policeman(gTurnOffBroadcast);
01563
01564     LPane *view = (LPane *)w;
01565     LTextEditView *txt;
01566     if((txt = dynamic_cast<LTextEditView *>(view)) != 0L)
01567     {
01568         txt->SetTextPtr((Ptr)text, strlen(text));
01569     }
01570     else
01571     {
01572         LStr255 pstr(text);
01573         LStr255 oldstr;
01574         view->GetDescriptor(oldstr);
01575         if(oldstr != pstr)
01576             view->SetDescriptor(pstr);
01577     }
01578 #endif
01579 #if qMacAPP
01580     TView *view = (TView *)w;
01581     if(MA_MEMBER(view, TCtlMgr))
01582     {
01583         TCtlMgr *ctrl = (TCtlMgr *)view;
01584         CStr255_AC pstr(text);
01585         ctrl->SetText(pstr, true);
01586     }
01587     else if(MA_MEMBER(view, TStaticText))
01588     {
01589         TStaticText *ctrl = (TStaticText *)view;
01590         CStr255_AC pstr(text);
01591         ctrl->SetText(pstr, true);
01592     }
01593     else if(MA_MEMBER(view, TWindow))
01594     {
01595         TWindow *ctrl = (TWindow *)view;
01596         CStr255_AC pstr(text);
01597         ctrl->SetTitle(pstr);
01598     }
01599 #endif
01600 }

void UWidget::OnSetTooltip | ( | int | cmd,
 |  | UCmdUI * | pCmdUI
 | ) | [protected]

EV_USETTOOLTIP message handling

Warning:
not documented.

Reimplemented in UToolbar.

Definition at line 856 of file uwidget.cpp.

00857 {
00858     const char *tooltip = GetTooltip(cmd);
00859     if(tooltip == 0L)
00860         return;
00861
00862     pCmdUI->SetTooltip(tooltip);
00863 }

void UWidget::OnShowWidget | ( | int | cmd,
 |  | int | state
 | ) | [protected]

EV_SHOW message handling

  • cmd the sub-widget
  • state of the widget to show/hide.

Definition at line 1698 of file uwidget.cpp.

01699 {
01700     void *w = GetWidget(cmd);
01701     if(w == 0L)
01702         return;
01703
01704 #ifdef WIN32
01705     CWnd *wnd = (CWnd *)w;
01706
01707     wnd->ShowWindow(state ? SW_SHOWNORMAL : SW_HIDE);
01708 #endif
01709 #if qGTK
01710     GtkWidget *wid = (GtkWidget *)w;
01711     if(state)
01712         gtk_widget_show(wid);
01713     else
01714         gtk_widget_hide(wid);
01715 #endif
01716 #if qMacAPP
01717     TView *view = (TView *)w;
01718     view->Show(state != 0, true);
01719 #endif
01720 #if qMacPP
01721     LPane *view = (LPane *)w;
01722     if(state)
01723         view->Show();
01724     else
01725         view->Hide();
01726 #endif
01727 }

void UWidget::OnTreeDelete | ( | int | cmd,
 |  | UTREEITEM | item
 | ) | [protected]

EV_TREE_DELETE UWidget message handling.

Definition at line 2293 of file uwidget.cpp.

02294 {
02295     // sanity
02296     void *w = GetWidget(cmd);
02297     if(w == 0L)
02298         return;
02299
02300 #if qGTK
02301     if(!GTK_IS_TREE(w) || item == 0L)
02302         return;
02303
02304     GtkTreeItem *i = GTK_TREE_ITEM(item);
02305
02306     GtkTree *parent = GTK_TREE(GTK_WIDGET(i)->parent);
02307     if (parent == 0L)
02308         return;
02309
02310     gtk_container_remove(GTK_CONTAINER(parent), GTK_WIDGET(i));
02311 #endif
02312 }

void UWidget::OnTreeExpand | ( | int | cmd,
 |  | int | collapse,
 |  | UTREEITEM | item
 | ) | [protected]

EV_TREE_EXPAND UWidget message handling.

Definition at line 2314 of file uwidget.cpp.

02315 {
02316     // sanity
02317     void *w = GetWidget(cmd);
02318     if(w == 0L)
02319         return;
02320
02321 #if qGTK
02322     if(!GTK_IS_TREE(w) || item == 0L)
02323         return;
02324
02325     GtkTreeItem *i = GTK_TREE_ITEM(item);
02326     int collapsed = !i->expanded;
02327     if((collapsed != 0) ^ (collapse != 0))
02328     {
02329         if(!collapse)
02330             gtk_tree_item_expand(i);
02331         else
02332             gtk_tree_item_collapse(i);
02333     }
02334 #endif
02335 }

void UWidget::OnTreeGetInfo | ( | int | cmd,
 |  | UTREE_INFO * | desc
 | ) | [protected]

EV_TREE_GETINFO UWidget message handling.

Definition at line 2236 of file uwidget.cpp.

02237 {
02238     // sanity
02239     desc->parent = 0L;
02240     desc->next = 0L;
02241     desc->child = 0L;
02242     desc->data = 0L;
02243     desc->title = 0L;
02244     desc->icon = 0L;
02245     desc->expanded = 0;
02246
02247     void *w = GetWidget(cmd);
02248     if(w == 0L)
02249         return;
02250
02251 #if qGTK
02252     if(!GTK_IS_TREE(w))
02253         return;
02254
02255     GtkTreeItem *item;
02256     if(desc->item == 0L)
02257     {
02258         GList *list = g_list_first(GTK_TREE(w)->children);
02259         GList *next = g_list_next(list);
02260         item = list != 0L ? GTK_TREE_ITEM(list->data) : 0L;
02261         desc->item = item;
02262         desc->next = next != 0L ? GTK_TREE_ITEM(next->data) : 0L;
02263     }
02264     else
02265     {
02266         GtkTree *parent = GTK_TREE(GTK_WIDGET(desc->item)->parent);
02267         GList *list = g_list_find(GTK_TREE(parent)->children, desc->item);
02268         GList *next = g_list_next(list);
02269         item = list != 0L ? GTK_TREE_ITEM(list->data) : 0L;
02270         desc->item = item;
02271         // the only way I found to guess the TREE_ITEM parent
02272         desc->parent = parent == w ? 0L : GTK_TREE_ITEM(gtk_object_get_data(GTK_OBJECT(parent), "rf_treeparent"));
02273         g_assert(desc->parent == 0L || GTK_IS_TREE_ITEM(desc->parent));
02274         desc->next = next != 0L ? GTK_TREE_ITEM(next->data) : 0L;
02275     }
02276     if(item != 0L)
02277     {
02278         if(item->subtree != 0L)
02279         {
02280             GtkTree *subtree = GTK_TREE(item->subtree);
02281             GList *list = g_list_first(GTK_TREE(subtree)->children);
02282             desc->child = list != 0L ? GTK_TREE_ITEM(list->data) : 0L;
02283         }
02284         desc->data = gtk_object_get_data(GTK_OBJECT(item), "rf_treeitemdata");
02285         GtkLabel *label = gtktreegetlabel(GTK_WIDGET(item));
02286         if(label != 0L)
02287             gtk_label_get(label, &desc->title);
02288         desc->expanded = item->expanded;
02289     }
02290 #endif
02291 }

void UWidget::OnTreeGetSel | ( | int | cmd,
 |  | UTREEITEM * | item
 | ) | [protected]

EV_TREE_GETSEL UWidget message handling.

Definition at line 2216 of file uwidget.cpp.

02217 {
02218     *item = 0L; // sanity
02219
02220     void *w = GetWidget(cmd);
02221     if(w == 0L)
02222         return;
02223
02224 #if qGTK
02225     if(!GTK_IS_TREE(w))
02226         return;
02227
02228     GList *sel = GTK_TREE(w)->selection;
02229     if(sel == 0L || !GTK_IS_TREE_ITEM(sel->data))
02230         return;
02231
02232     *item = sel->data;
02233 #endif
02234 }

void UWidget::OnTreeInsert | ( | int | cmd,
 |  | UTREE_INSERT * | data
 | ) | [protected]

EV_TREE_INSERT UWidget message handling.

Definition at line 2142 of file uwidget.cpp.

02143 {
02144     data->result = 0L; // sanity
02145
02146     void *w = GetWidget(cmd);
02147     if(w == 0L)
02148         return;
02149
02150 #if qGTK
02151     if(!GTK_IS_TREE(w))
02152         return;
02153
02154     GtkTree *root;
02155     if(data->parent == 0L)
02156         root = GTK_TREE(w);
02157     else
02158     {
02159         GtkTreeItem *item = GTK_TREE_ITEM(data->parent);
02160
02161         if(item->subtree != 0L)
02162             root = GTK_TREE(item->subtree);
02163         else
02164         {
02165             root = GTK_TREE(gtk_tree_new());
02166             gtk_object_set_data(GTK_OBJECT(root), "rf_treeparent", item);
02167             gtk_tree_set_selection_mode (root, GTK_SELECTION_BROWSE); // TODO : find out it with the root
02168             gtk_tree_set_view_mode (root, GTK_TREE_VIEW_ITEM); // TODO : find out it with the root
02169             gtk_tree_item_set_subtree (item, GTK_WIDGET(root));
02170         }
02171     }
02172     GtkTreeItem *item = gtknewtreeitem(data->title, data->icon == 0L ? 0L : GTK_PIXMAP(data->icon));
02173     gtk_object_set_data(GTK_OBJECT(item), "rf_treeitemdata", data->data);
02174     gtk_signal_connect(GTK_OBJECT(item), "select",
02175                        GTK_SIGNAL_FUNC(gtktreeselect), (gpointer)UMAKEINT(GetWidID(), cmd));
02176     gtk_signal_connect(GTK_OBJECT(item), "deselect",
02177                        GTK_SIGNAL_FUNC(gtktreedeselect), (gpointer)UMAKEINT(GetWidID(), cmd));
02178     gtk_signal_connect (GTK_OBJECT(item), "expand",
02179                         GTK_SIGNAL_FUNC(gtktreeexpand), (gpointer)UMAKEINT(GetWidID(), cmd));
02180     gtk_signal_connect (GTK_OBJECT(item), "collapse",
02181                         GTK_SIGNAL_FUNC(gtktreecollapse), (gpointer)UMAKEINT(GetWidID(), cmd));
02182     gtk_tree_append (GTK_TREE(root), GTK_WIDGET(item));
02183     gtk_widget_show (GTK_WIDGET(item));
02184     data->result = (UTREEITEM)item;
02185 #endif
02186 }

void UWidget::OnTreeResetAll ( int cmd ) [protected]

EV_TREE_RESETALL UWidget message handling.

Definition at line 2119 of file uwidget.cpp.

02120 {
02121     void *w = GetWidget(cmd);
02122     if(w == 0L)
02123         return;
02124
02125 #if qGTK
02126     if(!GTK_IS_TREE(w))
02127         return;
02128
02129     GtkTree *tree = GTK_TREE(w);
02130     GList *list = g_list_copy(tree->children);
02131     GList *head = list;
02132     while(list != 0L)
02133     {
02134         GtkWidget *wid = GTK_WIDGET(list->data);
02135         gtk_container_remove(GTK_CONTAINER(tree), wid);
02136         list = (GList *)g_list_next(list);
02137     }
02138     g_list_free(head);
02139 #endif
02140 }

void UWidget::OnTreeSelect | ( | int | cmd,
 |  | int | deselect,
 |  | UTREEITEM | item
 | ) | [protected]

EV_TREE_SELECT UWidget message handling.

Definition at line 2337 of file uwidget.cpp.

02338 {
02339     // sanity
02340     void *w = GetWidget(cmd);
02341     if(w == 0L)
02342         return;
02343
02344 #if qGTK
02345     if(!GTK_IS_TREE(w) || item == 0L)
02346         return;
02347
02348 #if 0 // FIXME ! GTK is behaving strangely
02349     GList *sel = GTK_TREE(w)->selection;
02350     while(sel)
02351     {
02352         gtk_tree_item_deselect(GTK_TREE_ITEM(sel->data));
02353         sel = g_list_next(sel);
02354     }
02355
02356     GtkTreeItem *i = GTK_TREE_ITEM(item);
02357     if(!deselect)
02358         gtk_tree_item_select(i);
02359     else
02360         gtk_tree_item_deselect(i);
02361 #endif
02362 #endif
02363 }

void UWidget::OnTreeSetData | ( | int | cmd,
 |  | UTREE_INFO * | data
 | ) | [protected]

EV_TREE_SETDATA UWidget message handling.

Definition at line 2188 of file uwidget.cpp.

02189 {
02190     void *w = GetWidget(cmd);
02191     if(w == 0L)
02192         return;
02193
02194 #if qGTK
02195     if(!GTK_IS_TREE(w))
02196         return;
02197
02198     gtk_object_set_data(GTK_OBJECT(data->item), "rf_treeitemdata", data->data);
02199 #endif
02200 }

void UWidget::OnTreeSetIcon | ( | int | cmd,
 |  | UTREE_INFO * | data
 | ) | [protected]

EV_TREE_SETICON UWidget message handling.

Definition at line 2202 of file uwidget.cpp.

02203 {
02204     void *w = GetWidget(cmd);
02205     if(w == 0L)
02206         return;
02207
02208 #if qGTK
02209     if(!GTK_IS_TREE(w))
02210         return;
02211
02212     gtksettreeitemicon(GTK_TREE_ITEM(data->item), GTK_PIXMAP(data->icon));
02213 #endif
02214 }

int UWidget::OnUpdateFocus | ( | int | leave,
 |  | void * | widget
 | ) | [protected]

EV_UPDATEFOCUS UWidget message handling.

Definition at line 3431 of file uwidget.cpp.

03432 {
03433     std::map<int, void *>::const_iterator i;
03434
03435     for(i = m_widgets.begin(); i != m_widgets.end(); ++i)
03436     {
03437         if((*i).second == widget)
03438             break;
03439     }
03440     if(i == m_widgets.end())
03441         return 0; // continue notification
03442
03443     if(leave)
03444     {
03445         if(sFocusWidID == GetWidID())
03446             sFocusWidID = -1;
03447     }
03448     else
03449     {
03450         sFocusWidID = GetWidID();
03451         sFocusCmdID = (*i).first;
03452     }
03453
03454     return 1; // stop notification
03455 }

void UWidget::OnUpdateUI ( void ) [protected]

EV_UPDATEUI is a notification sent to all the widgets when the user interface is invalid. the default is to send a EV_UPDTCMD to each sub-widget.

Reimplemented in UMacAppMenu, UMenu, and UToolbar.

Definition at line 1923 of file uwidget.cpp.

01924 {
01925     std::map<int, void *>::const_iterator i;
01926     for(i = m_widgets.begin(); i != m_widgets.end(); ++i)
01927     {
01928         UCmdUI pUI((*i).first);
01929         pUI.m_widget = (*i).second;
01930         UEventSendMessage(GetWidID(), EV_UPDTCMD, pUI.m_nID, &pUI);
01931     }
01932 }

void UWidget::RemoveTimer ( int cmd )

timer handling - remove a timer.

  • cmd associated with the timer.

Definition at line 1894 of file uwidget.cpp.

01895 {
01896     std::vector<UTimer>::iterator i;
01897     for(i = m_timers.begin(); i != m_timers.end(); i++)
01898     {
01899         if((*i).m_cmd == cmd)
01900         {
01901             (*i).m_cmd = 0; // delay removing
01902             break;
01903         }
01904     }
01905 }

int UWidget::UDispatchMessage | ( | int | evt,
 |  | int | arg1,
 |  | void * | arg2,
 |  | UDispatchInfo & | dispatchInfo
 | ) | [virtual]

this is overided in order to broadcast to the listeners.

Reimplemented from UCmdTarget.

Reimplemented in UToolbar.

Definition at line 744 of file uwidget.cpp.

Referenced by UToolbar::UDispatchMessage().

00745 {
00746     std::vector<UCmdTarget *>::iterator i;
00747     for(i = m_listeners.begin(); i != m_listeners.end(); ++i)
00748     {
00749         (*i)->UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00750     }
00751     return UCmdTarget::UDispatchMessage(evt, arg1, arg2, dispatchInfo);
00752 }

bool UWidget::WidgetIsActive ( int cmd ) const

return true if a widget has the focus ...

  • cmd the sub-widget identifier.
Warning:
only on Win32.

Definition at line 865 of file uwidget.cpp.

00866 {
00867     void *w = GetWidget(cmd);
00868     if(w == 0L)
00869         return false;
00870
00871 #ifdef WIN32
00872     CWnd *wnd = (CWnd *)w;
00873
00874     bool res = false;
00875
00876     CWnd* parent = wnd->GetOwner();
00877     if(parent && (HWND)*parent->GetFocus() == (HWND)*wnd)
00878         res = true;
00879
00880     return res;
00881 #endif
00882     return false;
00883 }

Member Data Documentation

const UMSGMAP_ENTRY UWidget::_messageEntries[] [static, private]

Reimplemented from UCmdTarget.

Reimplemented in UPromptMessage, UEditMessage, UAuthen_SSH, UAuthen_Pserver, UAuthen_Rhosts, UAuthen_Kserver, USaveSettings, UCvsApp, UCvsConsole, UCvsFiles, UCvsFolders, UCvsFrame, UCvsGraph, UCvsMenubar, UCvsToolbar, UMacAppMenu, UMenu, and UToolbar.

Definition at line 407 of file uwidget.h.

int UWidget::m_currentPage [protected]

Definition at line 237 of file uwidget.h.

std::vector<UCmdTarget *> UWidget::m_listeners [protected]

Definition at line 230 of file uwidget.h.

bool UWidget::m_modalRes [protected]

Definition at line 236 of file uwidget.h.

std::map<int, UWidget *> UWidget::m_tabs [protected]

Definition at line 234 of file uwidget.h.

Referenced by LPseudoWinAttachment::SearchWidID().

std::vector<UTimer> UWidget::m_timers [protected]

Definition at line 233 of file uwidget.h.

std::map<int, UStr> UWidget::m_tooltips [protected]

Definition at line 232 of file uwidget.h.

std::map<int, void *> UWidget::m_widgets [protected]

Definition at line 231 of file uwidget.h.

Referenced by LPseudoWinAttachment::InvalidCache(), OnPageChanged(), and LPseudoWinAttachment::SearchWidID().

const UMSGMAP UWidget::messageMap [static, protected]

Reimplemented from UCmdTarget.

Reimplemented in UPromptMessage, UEditMessage, UAuthen_SSH, UAuthen_Pserver, UAuthen_Rhosts, UAuthen_Kserver, USaveSettings, UCvsApp, UCvsConsole, UCvsFiles, UCvsFolders, UCvsFrame, UCvsGraph, UCvsMenubar, UCvsToolbar, UMacAppMenu, UMenu, and UToolbar.

Definition at line 407 of file uwidget.h.

int UWidget::sFocusCmdID [static, protected]

Definition at line 146 of file uwidget.cpp.

int UWidget::sFocusWidID = -1 [static, protected]

Definition at line 145 of file uwidget.cpp.

bool UWidget::sValidMenu = false [static, protected]

Definition at line 144 of file uwidget.cpp.

The documentation for this class was generated from the following files:
  • rf/uwidget.h
  • rf/uwidget.cpp
Generated on Sun Oct 21 12:50:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Win32wstring Class Reference

#include <Win32wstring.hpp>

Inheritance diagram for Win32wstring:

[legend]
Collaboration diagram for Win32wstring:

[legend]
List of all members.

Public Methods

Win32wstring (unsigned int codepage, std::string *s)
Win32wstring (unsigned int codepage, std::string &s)

Private Methods

void convert (unsigned int codepage, const char *s, int inLen)

Constructor & Destructor Documentation

Win32wstring::Win32wstring | ( | unsigned int | codepage,
 |  | std::string * | s
 | ) | [inline]

Definition at line 11 of file Win32wstring.hpp.

00012     {
00013         convert(codepage, s->c_str(), s->length());
00014     }

Win32wstring::Win32wstring | ( | unsigned int | codepage,
 |  | std::string & | s
 | ) | [inline]

Definition at line 16 of file Win32wstring.hpp.

00017     {
00018         convert(codepage, s.c_str(), s.length());
00019     }

Member Function Documentation

void Win32wstring::convert | ( | unsigned int | codepage,
 |  | const char * | s,
 |  | int | inLen
 | ) | [inline, private]

Definition at line 22 of file Win32wstring.hpp.

Referenced by Win32wstring().

00023     {
00024         register int outLen;
00025         register wchar_t *buff = NULL;
00026
00027         // I read this in the msdn docs:
00028         // "Windows NT 4.0 and Windows 2000: Translate using UTF-8.
00029         //  When this is set, dwFlags must be zero."
00030         //
00031         // Does this mean UTF-8 conversions don't work on win 95/98 ???
00032         //
00033         DWORD flags = (codepage == CP_UTF8 ? 0 : MB_USEGLYPHCHARS);
00034
00035         // calc size needed
00036         outLen = ::MultiByteToWideChar(codepage, flags, s, inLen, buff, 0);
00037
00038         buff = new wchar_t [outLen];
00039
00040         // do it
00041         ::MultiByteToWideChar(codepage, flags, s, inLen, buff, outLen);
00042
00043         // set the string into our base class.
00044         assign(buff, outLen);
00045
00046         // discard the scratch space.
00047         delete [] buff;
00048     }

The documentation for this class was generated from the following file:
  • WinCvs/Win32wstring.hpp
Generated on Sun Oct 21 12:50:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWinApp Class Reference

Inheritance diagram for CWinApp:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/wincvs.h
Generated on Sun Oct 21 12:50:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWincvsApp Class Reference

#include <wincvs.h>

Inheritance diagram for CWincvsApp:

[legend]
Collaboration diagram for CWincvsApp:

[legend]
List of all members.

Public Methods

virtual BOOL | PreTranslateMessage (MSG *pMsg)
CWincvsApp ()
CWincvsView * | GetConsoleView (void)
CWinCvsBrowser * | GetBrowserView (void)
void | ActivateBrowserView (void)
CCJShellTree * | GetExplorerView (void)
CBrowseFileView * | GetFileView (void)
CDocument * | GetDocument (void)
CStatusBar * GetStatusBar ()
CString | GetRoot ()
CMainFrame * | GetMainFrame (void)
void | UpdateAllDocsView ()
void | GetAppPath (UStr &path) const
void | GetAppModule (UStr &module) const
bool | GetAppVersion (UStr &vers) const
DWORD | GetIdleTime (void) const
void | ResetIdleTime (void)
void | IdleCvsProgress (void)
KiFilterModel * | GetFilterModel () const
KiRecursionModel * | GetRecursionModel () const
KiIgnoreModel * | GetIgnoreModel () const
char * | GetEnvMainThread (const char *name)
virtual BOOL | InitInstance ()
virtual int | ExitInstance ()
virtual BOOL | SaveAllModified ()

Public Attributes

bool | gCvsRunning
bool | gCvsStopping
int | gLastCvsResult
CMultiDocTemplate * | gLogTempl
CMultiDocTemplate * | gLogGraph
CMultiDocTemplate * | gLogHtml
_CvsProcess * gCvsProcess
bool | m_isBackgroundProcess

Protected Methods

BOOL | InitATL ()
void | LookForResourceFile (const char *what, UStr &path)
afx_msg void | OnFileNew ()
afx_msg void | OnAppAbout ()
afx_msg void | OnAppCopyrights ()
afx_msg void | OnAppCredits ()
afx_msg void | OnLogWindowIsPresent (CCmdUI *pCmdUI)
afx_msg void | OnHelpCvs ()
afx_msg void | OnHelpCvsclient ()

Protected Attributes

DWORD | m_idletime
CMainFrame * m_mainFrame
BOOL | m_bATLInited
COleTemplateServer | m_server

Private Methods

void | ShowTipAtStartup (void)
void | ShowTipOfTheDay (void)

Constructor & Destructor Documentation

CWincvsApp::CWincvsApp ( )

Definition at line 200 of file wincvs.cpp.

00200                        : m_isBackgroundProcess(false)
00201 {
00202     gCvsRunning = false;
00203     gCvsStopping = false;
00204     gLastCvsResult = 0;
00205     m_idletime = 0;
00206     m_bATLInited = FALSE;
00207     gCvsProcess = 0L;
00208 }

Member Function Documentation

void CWincvsApp::ActivateBrowserView ( void )

Definition at line 738 of file wincvs.cpp.

Referenced by CMainFrame::ChangeLocation().

00739 {
00740     if(m_mainFrame == 0L)
00741         return;
00742
00743     m_mainFrame->GetWorkspace()->SetActiveView(RUNTIME_CLASS(CBrowserBar));
00744 }

int CWincvsApp::ExitInstance ( ) [virtual]

Definition at line 912 of file wincvs.cpp.

00913 {
00914     // Save existing preferences. This will save, for example,
00915     // the current working directory as "LastWorkingDir" property.
00916     gCvsPrefs.save();
00917
00918     DeleteCriticalSection(&CCvsThreadLock::m_lock);
00919
00920     if (m_bATLInited)
00921     {
00922         LogCleanup();
00923         _Module.RevokeClassObjects();
00924         _Module.Term();
00925         CoUninitialize();
00926     }
00927
00928     return CWinApp::ExitInstance();
00929 }

void CWincvsApp::GetAppModule ( UStr & module ) const

Definition at line 1042 of file wincvs.cpp.

Referenced by myTcl_CreateInterp().

01043 {
01044     module = "";
01045     HINSTANCE hInst = ::AfxGetInstanceHandle();
01046     if(hInst != 0L)
01047     {
01048         char apath[512];
01049         DWORD len = ::GetModuleFileName(hInst, apath, 512);
01050         if(len > 0)
01051         {
01052             module = apath;
01053         }
01054     }
01055 }

void CWincvsApp::GetAppPath ( UStr & path ) const

Definition at line 1025 of file wincvs.cpp.

Referenced by CTipDlg::CTipDlg(), LookForResourceFile(), SettingsGetLoc(), CvsPrefs::WhichCvs(), and getLoc().

01026 {
01027     path = "";
01028     HINSTANCE hInst = ::AfxGetInstanceHandle();
01029     if(hInst != 0L)
01030     {
01031         char apath[512];
01032         DWORD len = ::GetModuleFileName(hInst, apath, 512);
01033         CStr uppath;
01034         CStr exefile;
01035         if(len > 0 && ::SplitPath(apath, uppath, exefile))
01036         {
01037             path = uppath;
01038         }
01039     }
01040 }

bool CWincvsApp::GetAppVersion ( UStr & vers ) const

Definition at line 1109 of file wincvs.cpp.

Referenced by CAboutDlg::CAboutDlg(), InitInstance(), OnAppCredits(), and CSplashWnd::OnPaint().

01110 {
01111     bool bRet=false;
01112     char  szFullPath[_MAX_PATH];
01113     DWORD len = ::GetModuleFileName(AfxGetInstanceHandle(), szFullPath, sizeof(szFullPath));
01114     DWORD dwVerHnd;
01115     DWORD dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
01116     if (dwVerInfoSize && len)
01117     {
01118         // If we were able to get the information, process it:
01119         HANDLE  hMem;
01120         LPVOID  lpvMem;
01121         char    szGetName[256];
01122         int     cchRoot;
01123
01124         hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
01125         lpvMem = GlobalLock(hMem);
01126         GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpvMem);
01127         lstrcpy(szGetName, "\\StringFileInfo\\040904b0\\");
01128         cchRoot = lstrlen(szGetName);
01129
01130         BOOL  fRet;
01131         UINT  cchVer = 0;
01132         LPVOID lszVer = NULL;
01133
01134         lstrcpy(&szGetName[cchRoot], "ProductVersion");
01135         fRet = VerQueryValue(lpvMem, szGetName, &lszVer, &cchVer);
01136
01137         if (fRet && cchVer && lszVer)
01138         {
01139             vers = (char *)lszVer;
01140             bRet = true;
01141         }
01142         GlobalUnlock(hMem);
01143         GlobalFree(hMem);
01144     }
01145     return bRet;
01146 }

CWinCvsBrowser * CWincvsApp::GetBrowserView ( void )

Definition at line 719 of file wincvs.cpp.

Referenced by CMainFrame::ChangeLocation(), GetRoot(), InitInstance(), CMainFrame::OnBroadcastCmdMsg(), CWincvsDoc::OnBrowserOpen(), CMainFrame::OnClose(), CMainFrame::OnDropFiles(), CWincvsDoc::OnSavesettings(), CBrowseFileView::ResetView(), and CvsPrefs::save().

00720 {
00721     if(m_mainFrame == 0L)
00722         return 0L;
00723
00724     return m_mainFrame->GetBrowserView();
00725 }

CWincvsView * CWincvsApp::GetConsoleView ( void )

Definition at line 703 of file wincvs.cpp.

Referenced by CGraphConsole::CGraphConsole(), CMainFrame::OnBroadcastCmdMsg(), CGraphView::OnLButtonDown(), and OnLogWindowIsPresent().

00704 {
00705     if(m_mainFrame == 0L)
00706         return 0L;
00707
00708     return m_mainFrame->GetConsoleView();
00709 }

CDocument * CWincvsApp::GetDocument ( void )

Definition at line 783 of file wincvs.cpp.

Referenced by InitInstance(), and CBrowseFileView::ResetView().

00784 {
00785     CWinApp *app = AfxGetApp();
00786     POSITION post = app->GetFirstDocTemplatePosition();
00787     CDocTemplate* tmpl;
00788     while(post != NULL)
00789     {
00790         tmpl = app->GetNextDocTemplate(post);
00791         POSITION posd = tmpl->GetFirstDocPosition();
00792         CDocument* doc;
00793         while(posd != NULL)
00794         {
00795             doc = tmpl->GetNextDoc(posd);
00796             if(!doc->IsKindOf(RUNTIME_CLASS(CWincvsDoc)))
00797                 continue;
00798             return doc;
00799         }
00800     }
00801     ASSERT(0);
00802     return 0L;
00803 }

char * CWincvsApp::GetEnvMainThread ( const char * name )

Definition at line 1178 of file wincvs.cpp.

Referenced by glue_getenv().

01179 {
01180     return m_mainFrame->GetEnvMainThread(name);
01181 }

CCJShellTree * CWincvsApp::GetExplorerView ( void )

Definition at line 746 of file wincvs.cpp.

Referenced by CMainFrame::OnBroadcastCmdMsg().

00747 {
00748     if(m_mainFrame == 0L)
00749         return 0L;
00750
00751     return m_mainFrame->GetExplorerView();
00752 }

CBrowseFileView * CWincvsApp::GetFileView ( void )

Definition at line 754 of file wincvs.cpp.

Referenced by IdleCvsProgress(), InitInstance(), CWinCvsBrowser::NotifySelectionChange(), CMainFrame::OnActivate(), CMainFrame::OnDropFiles(), CMyShellTree::OnSelchanged(), CMainFrame::OnSysCommand(), CWinCvsBrowser::ResetBrowser(), and CWinCvsBrowser::ResetView().

00755 {
00756     POSITION post = GetFirstDocTemplatePosition();
00757     CDocTemplate* tmpl;
00758     while(post != NULL)
00759     {
00760         tmpl = GetNextDocTemplate(post);
00761         if(!tmpl->IsKindOf(RUNTIME_CLASS(CMultiDocTemplate)))
00762             continue;
00763         POSITION posd = tmpl->GetFirstDocPosition();
00764         CDocument* doc;
00765         while(posd != NULL)
00766         {
00767             doc = tmpl->GetNextDoc(posd);
00768             if(!doc->IsKindOf(RUNTIME_CLASS(CWincvsDoc)))
00769                 continue;
00770             POSITION posv = doc->GetFirstViewPosition();
00771             CView* view;
00772             while(posv != NULL)
00773             {
00774                 view = doc->GetNextView(posv);
00775                 if(view->IsKindOf(RUNTIME_CLASS(CBrowseFileView)))
00776                     return (CBrowseFileView *)view;
00777             }
00778         }
00779     }
00780     return NULL;
00781 }

KiFilterModel * CWincvsApp::GetFilterModel ( ) const

Definition at line 1321 of file wincvs.cpp.

Referenced by KoTraversalContext::KoTraversalContext(), CBrowseFileView::OnDestroy(), and CBrowseFileView::OnInitialUpdate().

01322 {
01323     return m_mainFrame->GetFilterModel();
01324 }

DWORD CWincvsApp::GetIdleTime ( void ) const [inline]

Definition at line 112 of file wincvs.h.

Referenced by CLogoutThread::InitInstance().

00112 { return m_idletime; }

KiIgnoreModel * CWincvsApp::GetIgnoreModel ( ) const

Definition at line 1332 of file wincvs.cpp.

Referenced by KoTraversalContext::KoTraversalContext(), CWinCvsBrowser::OnDestroy(), CBrowseFileView::OnDestroy(), CWinCvsBrowser::OnInitialUpdate(), CBrowseFileView::OnInitialUpdate(), and TBrowserFill::TBrowserFill().

01333 {
01334     return m_mainFrame->GetIgnoreModel();
01335 }

CMainFrame* CWincvsApp::GetMainFrame ( void ) [inline]

Definition at line 81 of file wincvs.h.

Referenced by CWinCvsBrowser::Create(), CLogFrame::OnCmdMsg(), CGraphFrame::OnCmdMsg(), CHistComboBoxEx::PreTranslateMessage(), CWinCvsBrowser::ResetBrowser(), and CBrowseFileView::ResetView().

00081 { return m_mainFrame; }

KiRecursionModel * CWincvsApp::GetRecursionModel ( ) const

Definition at line 1327 of file wincvs.cpp.

Referenced by KoTraversalContext::KoTraversalContext(), CBrowseFileView::OnDestroy(), and CBrowseFileView::OnInitialUpdate().

01328 {
01329     return m_mainFrame->GetRecursionModel();
01330 }

CString CWincvsApp::GetRoot ( void )

Definition at line 727 of file wincvs.cpp.

Referenced by GetRoot().

00728 {
00729     CString root;
00730     CWinCvsBrowser* view = GetBrowserView();
00731     if (view)
00732     {
00733         root = view->GetRoot();
00734     }
00735     return root;
00736 }

CStatusBar * CWincvsApp::GetStatusBar ( )

Definition at line 711 of file wincvs.cpp.

Referenced by IdleCvsProgress().

00712 {
00713     if(m_mainFrame == 0L)
00714         return 0L;
00715
00716     return m_mainFrame->GetStatusBar();
00717 }

void CWincvsApp::IdleCvsProgress ( void )

Definition at line 1183 of file wincvs.cpp.

Referenced by PreTranslateMessage().

01184 {
01185     static bool bWasCvsRunning = false; //to restore the idle message once CVS has stoped
01186
01187     if(!gCvsRunning)
01188     {
01189         if( bWasCvsRunning )
01190         {
01191             bWasCvsRunning = false;
01192
01193             CString strIdleString;
01194             strIdleString.LoadString(AFX_IDS_IDLEMESSAGE);
01195
01196             CStatusBar *bar = GetStatusBar();
01197             if(bar != 0L)
01198                 bar->SetWindowText(strIdleString);
01199         }
01200         return;
01201     }
01202
01203     if(gCvsProcess != 0L)
01204     {
01205         if(!cvs_process_is_active(gCvsProcess))
01206         {
01207             gCvsRunning = false;
01208             gCvsStopping = false;
01209             gCvsProcess = 0L;
01210             GetFileView()->CheckChanges();
01211         }
01212     }
01213
01214     bWasCvsRunning = true;
01215
01216     DWORD whatTimeIsIt = ::GetTickCount();
01217     static DWORD lastTime = 0;
01218     // let's make some stuff every second while cvs is idling
01219     if((whatTimeIsIt - lastTime) < 1000)
01220         return;
01221
01222     lastTime = whatTimeIsIt;
01223     char path[_MAX_PATH];
01224     getcwd(path, _MAX_PATH);
01225     CStatusBar *bar = GetStatusBar();
01226     if(bar != 0L)
01227         bar->SetWindowText(path);
01228 }

BOOL CWincvsApp::InitATL ( ) [protected]

Definition at line 1256 of file wincvs.cpp.

Referenced by InitInstance().

01257 {
01258     m_bATLInited = TRUE;
01259
01260 #if _WIN32_WINNT >= 0x0400
01261     HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
01262 #else
01263     HRESULT hRes = CoInitialize(NULL);
01264 #endif
01265
01266     if (FAILED(hRes))
01267     {
01268         m_bATLInited = FALSE;
01269         return FALSE;
01270     }
01271
01272     _Module.Init(ObjectMap, AfxGetInstanceHandle());
01273     _Module.dwThreadID = GetCurrentThreadId();
01274
01275     LPTSTR lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
01276     TCHAR szTokens[] = _T("-/");
01277
01278     BOOL bRun = TRUE;
01279     LPCTSTR lpszToken = _Module.FindOneOf(lpCmdLine, szTokens);
01280     while (lpszToken != NULL)
01281     {
01282         if (MatchToken(lpszToken,_T("UnregServer"))) {
01283             _Module.UpdateRegistryFromResource(IDR_CVS_COWORKER, FALSE);
01284             _Module.UnregisterServer(TRUE); //TRUE means typelib is unreg'd
01285             bRun = FALSE;
01286             DEBUG_MESSAGE(_T("Now UNREGISTERED"));
01287             break;
01288         }
01289         if (MatchToken(lpszToken,_T("RegServer"))) {
01290             //RegisterLogging();  // specific to CVS_Coworker
01291             _Module.UpdateRegistryFromResource(IDR_CVS_COWORKER, TRUE);
01292             _Module.RegisterServer(TRUE);
01293             bRun = FALSE;
01294             DEBUG_MESSAGE(_T("REGISTERED"));
01295             break;
01296         }
01297         lpszToken = _Module.FindOneOf(lpszToken, szTokens);
01298     }
01299
01300     if (!bRun)
01301     {
01302         m_bATLInited = FALSE;
01303         _Module.Term();
01304         CoUninitialize();
01305         return FALSE;
01306     }
01307
01308     //StartLogging();         // specific to CVS_Coworker
01309     hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,REGCLS_MULTIPLEUSE);
01310     if (FAILED(hRes))
01311     {
01312         m_bATLInited = FALSE;
01313         CoUninitialize();
01314         return FALSE;
01315     }
01316
01317     return TRUE;
01318 }

BOOL CWincvsApp::InitInstance ( ) [virtual]

Definition at line 290 of file wincvs.cpp.

00291 {
00292 #if qCvsDebug
00293     int tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
00294     tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF;
00295     _CrtSetDbgFlag(tmpDbgFlag);
00296 #endif
00297     CStr lastWorkingDir;
00298
00299     // David Gravereaux <davygrvy@interwoven.com> suggests this might
00300     // be a work around to the bug #42 (I love the bug number,
00301     // really fits the bug description ;-))
00302 #if 0
00303     if (!IsValidHandle(GetStdHandle(STD_OUTPUT_HANDLE)))
00304     {
00305         SetStdHandle(STD_OUTPUT_HANDLE, 0L);
00306     }
00307 #endif
00308
00309     // CG: The following block was added by the Splash Screen component.
00310     {
00311         CCommandLineInfo cmdInfo;
00312         ParseCommandLine(cmdInfo);
00313
00314         CSplashWnd::EnableSplashScreen(
00315             (!(m_nCmdShow & SW_SHOWMINIMIZED)) && cmdInfo.m_bShowSplash);
00316     }
00317
00318     if (!AfxSocketInit())
00319     {
00320         AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
00321         return FALSE;
00322     }
00323
00324     if (!InitATL())
00325         return FALSE;
00326
00327     // Initialize OLE libraries
00328     if (!AfxOleInit())
00329     {
00330         AfxMessageBox(IDP_OLE_INIT_FAILED);
00331         return FALSE;
00332     }
00333
00334     AfxEnableControlContainer();
00335
00336     // Standard initialization
00337     // If you are not using these features and wish to reduce the size
00338     //  of your final executable, you should remove from the following
00339     //  the specific initialization routines you do not need.
00340
00341 #ifdef _AFXDLL
00342     Enable3dControls();         // Call this when using MFC in a shared DLL
00343 #else
00344     Enable3dControlsStatic();   // Call this when linking to MFC statically
00345 #endif
00346
00347     InitializeCriticalSection(&CCvsThreadLock::m_lock);
00348
00349     // Change the registry key under which our settings are stored.
00350     // You should modify this string to be something appropriate
00351     // such as the name of your company or organization.
00352     SetRegistryKey(_T("WinCvs"));
00353
00354     LoadStdProfileSettings(5);  // Load standard INI file options (including MRU)
00355     gCvsPrefs.load();
00356
00357     CStr strVersion;
00358     GetAppVersion(strVersion);
00359     WriteProfileString(_T(""), _T("Current Version"), strVersion);
00360
00361     //
00362     // We need to make a temp local copy of LastWorkingDir property here,
00363     // because CWinCvsBrowser::OnSelchanging event would override
00364     // LastWorkingDir preference when browser window is created.
00365     //
00366     lastWorkingDir = gCvsPrefs.LastWorkingDir();
00367
00368     // Register the application's document templates.  Document templates
00369     //  serve as the connection between documents, frame windows and views.
00370
00371     gLogTempl = new CMultiDocTemplate(
00372         IDR_MAINFRAME,
00373         RUNTIME_CLASS(CWincvsDoc),
00374         RUNTIME_CLASS(CLogFrame),
00375         RUNTIME_CLASS(CBrowseFileView));
00376     AddDocTemplate(gLogTempl);
00377
00378     gLogGraph = new CMultiDocTemplate(
00379         IDR_GRAPH,
00380         RUNTIME_CLASS(CGraphDoc),
00381         RUNTIME_CLASS(CGraphFrame),
00382         RUNTIME_CLASS(CGraphView));
00383     AddDocTemplate(gLogGraph);
00384
00385     /*gLogHtml = new CMultiDocTemplate(
00386         IDR_GRAPH,
00387         RUNTIME_CLASS(CDocument),
00388         RUNTIME_CLASS(CMDIChildWnd),
00389         RUNTIME_CLASS(CGraphView));
00390     AddDocTemplate(gLogGraph);*/
00391
00392     // Connect the COleTemplateServer to the document template.
00393     //  The COleTemplateServer creates new documents on behalf
00394     //  of requesting OLE containers by using information
00395     //  specified in the document template.
00396     m_server.ConnectTemplate(clsid, gLogTempl, TRUE);
00397         // Note: SDI applications register server objects only if /Embedding
00398         //   or /Automation is present on the command line.
00399
00400     // Register all OLE server factories as running.  This enables the
00401     //  OLE libraries to create objects from other applications.
00402     COleTemplateServer::RegisterAll();
00403         // Note: MDI applications register all server objects without regard
00404         //  to the /Embedding or /Automation on the command line.
00405
00406     // create main MDI Frame window
00407     m_mainFrame = new CMainFrame;
00408     if (!m_mainFrame->LoadFrame(IDR_CNTR_INPLACE))
00409         return FALSE;
00410     m_pMainWnd = m_mainFrame;
00411
00412     // Initialize the cool menus...
00413 #if 0
00414     UINT barIds[] = {IDR_BROWSER, IDR_MAINFRAME, IDR_MULTIUSER, IDR_TAGS, IDR_FILELIST, IDR_FILTER};
00415     m_mainFrame->InitializeMenu(gLogTempl,
00416         IDR_MAINFRAME, barIds, _countof(barIds), IDR_MAINFRAME);
00417     m_mainFrame->InitializeMenu(gLogGraph,
00418         IDR_GRAPH, barIds, _countof(barIds), IDR_GRAPH);
00419 #endif
00420
00421     // Parse command line for standard shell commands, DDE, file open
00422     CCommandLineInfo cmdInfo;
00423     ParseCommandLine(cmdInfo);
00424
00425     // Check to see if launched as OLE server
00426     if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
00427     {
00428 #if 0
00429         // Register all OLE server (factories) as running.  This enables the
00430         //  OLE libraries to create objects from other applications.
00431         COleTemplateServer::RegisterAll();
00432 #endif
00433
00434         // Application was run with /Embedding or /Automation.  Don't show the
00435         //  main window in this case.
00436         return TRUE;
00437     }
00438
00439     // When a server application is launched stand-alone, it is a good idea
00440     //  to update the system registry in case it has been damaged.
00441     m_server.UpdateRegistry(OAT_DISPATCH_OBJECT);
00442     COleObjectFactory::UpdateRegistryAll();
00443
00444     //JK - try to resolve the long filename if the argument passed is the short filename (like when it's a call thru SendTo shell menu)
00445     if( -1 != cmdInfo.m_strFileName.Find('~') )
00446     {
00447         CString strLongFileName;
00448         CString strTempTileName = cmdInfo.m_strFileName;
00449
00450         SHFILEINFO sFileInfo;
00451         int nSlashPos = -1;
00452
00453         BOOL bError = FALSE;
00454
00455         while( -1 != (nSlashPos = strTempTileName.ReverseFind(kPathDelimiter)) )
00456         {
00457             if( SHGetFileInfo((LPCTSTR)strTempTileName, 0, &sFileInfo, sizeof(sFileInfo), SHGFI_DISPLAYNAME) )
00458             {
00459                 CString strFileNameBit = strTempTileName.Mid(nSlashPos + 1);
00460
00461                 strLongFileName = sFileInfo.szDisplayName + strLongFileName;
00462                 strLongFileName = kPathDelimiter + strLongFileName;
00463                 strTempTileName = strTempTileName.Left(nSlashPos);
00464             }
00465             else
00466             {
00467                 bError = TRUE;
00468                 break;  //we need it or we get the dead loop
00469             }
00470         }//end while
00471
00472         if( !bError )
00473         {
00474             cmdInfo.m_strFileName = strTempTileName + strLongFileName;
00475         }
00476     }
00477
00478     //JK - open in the directory, so remove the file
00479     CString strOpenDirectory;
00480     CString strSelectFile;
00481     if( !cmdInfo.m_strFileName.IsEmpty() )
00482     {
00483         TCHAR fullpath[_MAX_PATH];
00484         _tfullpath(fullpath, cmdInfo.m_strFileName, _MAX_PATH);
00485         struct stat sb;
00486         if(stat(fullpath, &sb) == -1 || !S_ISDIR(sb.st_mode))
00487         {
00488             TCHAR drive[_MAX_DRIVE];
00489             TCHAR dir[_MAX_DIR];
00490             _tsplitpath(fullpath, drive, dir, NULL, NULL);
00491             strSelectFile = fullpath;
00492             _tmakepath(fullpath, drive, dir, NULL, NULL);
00493             strOpenDirectory = fullpath;
00494         }
00495     }
00496
00497     // Dispatch commands specified on the command line
00498     //JK - we need to trick the ProcessShellCommand a bit
00499     //because we might get a directory as a parameter we don't want it to check after the file...
00500     cmdInfo.m_nShellCommand = CCommandLineInfo::FileNew;
00501     if (!ProcessShellCommand(cmdInfo))
00502         return FALSE;
00503
00504     // The one and only window has been initialized, so show and update it.
00505     m_mainFrame/*m_pMainWnd*/->InitialShowWindow(m_nCmdShow);
00506     m_mainFrame/*m_pMainWnd*/->UpdateWindow();
00507
00508     m_mainFrame/*m_pMainWnd*/->DragAcceptFiles();
00509     //CWincvsView *cons = GetConsoleView();
00510     //if(cons != 0L)
00511     //  cons->DragAcceptFiles();
00512
00513
00514     CWinCvsBrowser *browser = GetBrowserView();
00515     CWincvsDoc *doc = (CWincvsDoc *)GetDocument();
00516     if(doc != 0L && browser != 0L)
00517         doc->SetTitle(browser->GetRoot());
00518     CBrowseFileView *fileView = GetFileView();
00519     if(fileView != 0L)
00520     {
00521         if( strOpenDirectory.IsEmpty() )
00522         {
00523             // Goto the last working directory, which was selected
00524             // when WinCVS was closed
00525             if( !lastWorkingDir.empty() && browser->StepToLocation(lastWorkingDir) )
00526             {
00527                 fileView->ResetView(lastWorkingDir, false, (LPCTSTR) 0L);
00528                 gCvsPrefs.SetLastWorkingDir(lastWorkingDir);
00529             }
00530             else
00531                 fileView->ResetView(browser->GetRoot());
00532         }
00533         else
00534         {
00535             CColorConsole out;
00536             out << kBold << "Locating: " << kNormal << kUnderline << cmdInfo.m_strFileName << kNormal <<  kNormal << kNL;
00537
00538             if( browser->StepToLocation((LPCTSTR)strOpenDirectory) )
00539             {
00540                 fileView->ResetView( (LPCTSTR)strOpenDirectory, false, (LPCTSTR)strSelectFile );
00541             }
00542             else
00543             {
00544                 fileView->ResetView( browser->GetRoot() );
00545             }
00546         }
00547     }
00548
00549     //MacrosReloadAll();
00550     PyMacrosReloadAll();
00551
00552     //JK - if you launch WinCvs with the file or directory as a parameter you obviously don't need a "tip of the day" because you're in a hurry
00553     if( strOpenDirectory.IsEmpty() )
00554     {
00555         // CG: This line inserted by 'Tip of the Day' component.
00556         ShowTipAtStartup();
00557     }
00558
00559     // auto-logout thread
00560     sLogout = new CLogoutThread();
00561     if (sLogout == 0L)
00562     {
00563         cvs_err("Impossible to create the auto-logout thread !\n");
00564     }
00565     else
00566     {
00567         ASSERT_VALID(sLogout);
00568
00569         // Create Thread in a suspended state so we can set the Priority
00570         // before it starts getting away from us
00571         if (!sLogout->CreateThread(CREATE_SUSPENDED))
00572         {
00573             cvs_err("Impossible to start the auto-logout thread (error %d)!\n", GetLastError());
00574             delete sLogout;
00575             sLogout = 0L;
00576         }
00577
00578         if(sLogout != 0L)
00579         {
00580             // If you want to make the sample more sprightly, set the thread priority here
00581             // a little higher. It has been set at idle priority to keep from bogging down
00582             // other apps that may also be running.
00583             VERIFY(sLogout->SetThreadPriority(THREAD_PRIORITY_NORMAL));
00584             // Now the thread can run wild
00585             sLogout->ResumeThread();
00586         }
00587     }
00588
00589     // load preferences. If CVSROOT is not defined
00590     // then prompt first preferences dialog.
00591     if(gCvsPrefs.empty())
00592         SendMessage(*m_mainFrame, WM_COMMAND, ID_APP_PREFERENCES, 0L);
00593         //doc->OnAppPreferences();
00594     else
00595         cvs_out("CVSROOT: %s (%s)\n", (const char *)gCvsPrefs, gAuthen.kindstr());
00596
00597     bool hasTCL = CTcl_Interp::IsAvail();
00598     bool hasPY = CPython_Interp::IsAvail();
00599
00600     if(gCvsPrefs.GetUseShell() == SHELL_PYTHON && !hasPY && hasTCL)
00601     {
00602         gCvsPrefs.SetUseShell(SHELL_TCL);
00603     }
00604     else if(gCvsPrefs.GetUseShell() == SHELL_TCL && hasPY && !hasTCL)
00605     {
00606         gCvsPrefs.SetUseShell(SHELL_PYTHON);
00607     }
00608
00609     if(gCvsPrefs.GetUseShell() == SHELL_TCL)
00610     {
00611         cvs_out("TCL is available, shell is enabled : help (select and press enter)\n");
00612     }
00613
00614     if(!hasTCL && !hasPY)
00615     {
00616         cvs_err("TCL or Python are *not* available, shell is disabled\n");
00617     }
00618
00619     //make sure the current directory is properly setup
00620     if( 0L != fileView )
00621     {
00622         chdir( fileView->GetPath() );
00623     }
00624
00625     return TRUE;
00626 }

void CWincvsApp::LookForResourceFile | ( | const char * | what,
 |  | UStr & | path
 | ) | [protected]

Definition at line 1057 of file wincvs.cpp.

Referenced by OnHelpCvs(), and OnHelpCvsclient().

01058 {
01059     path = "";
01060     GetAppPath(path);
01061
01062     CString appPath = path;
01063     // first the macro folder may be ./macro
01064     CString test = appPath;
01065     test.TrimRight('\\');
01066     test += "\\";
01067     test += what;
01068
01069     struct stat sb;
01070     if(stat(test, &sb) != -1 && S_ISREG(sb.st_mode))
01071     {
01072         path = test;
01073         return;
01074     }
01075
01076     CStr uppath, file;
01077     while(SplitPath(appPath, uppath, file) && !uppath.empty())
01078     {
01079         test = uppath;
01080         test.TrimRight('\\');
01081         test += "\\";
01082         test += what;
01083
01084         if(stat(test, &sb) != -1 && S_ISREG(sb.st_mode))
01085         {
01086             path = test;
01087             return;
01088         }
01089         appPath = uppath;
01090     }
01091     path = test;
01092 }

void CWincvsApp::OnAppAbout ( ) [protected]

Definition at line 697 of file wincvs.cpp.

00698 {
00699     CAboutDlg aboutDlg;
00700     aboutDlg.DoModal();
00701 }

void CWincvsApp::OnAppCopyrights ( ) [protected]

Definition at line 931 of file wincvs.cpp.

00932 {
00933     cvs_out("\nBoth WinCVS and CVS are distributed under the terms of\n");
00934     cvs_out("the GNU General Public Licence (GPL).\n\n");
00935     cvs_out("* MacCVS/WinCvs : maintained by Alexandre Parenteau (aubonbeurre@hotmail.com)\n");
00936     cvs_out("* WinCvs documentation : Copyright © 1999 Don Harper <don@lamrc.com>.\n");
00937     cvs_out("* CVS : Copyright © 1989-1998 Brian Berliner, david d `zoo' zuhn,\n");
00938     cvs_out("        Jeff Polk, and other authors\n");
00939     cvs_out("* CJLIB : Copyright © 1998-99 Kirk Stowell <kstowell@codejockeys.com>\n");
00940     cvs_out("* Kerberos : Copyright © 1997 the Massachusetts Institute of Technology\n");
00941     cvs_out("* TCL : Copyright © Sun Microsystems Inc.\n");
00942     cvs_out("* Python : Copyright © Guido van Rossum\n");
00943     cvs_out("* MFC : Copyright © 1992-1997 Microsoft Corporation\n");
00944     cvs_out("\nSome others copyrights may apply, check the source code for details.\n");
00945 }

void CWincvsApp::OnAppCredits ( ) [protected]

Definition at line 947 of file wincvs.cpp.

00948 {
00949     CStr vers;
00950
00951     if(GetAppVersion(vers))
00952         cvs_out("\n%s - Client/Local\n", (const char *)vers);
00953     else
00954         cvs_out("\nWinCvs 1.2 - Client/Local/\n");
00955     cvs_out("- WinCvs is developed by (alphabetically):\n");
00956     cvs_out("\t* V.Antonevich <v_antonevich@hotmail.com>\n");
00957     cvs_out("\t* Jerzy Kaczorowski  <kaczoroj@hotmail.com>\n");
00958     cvs_out("\t* Alexandre Parenteau <aubonbeurre@hotmail.com>\n");
00959     cvs_out("\t* Others contributors (see the ChangeLog)\n");
00960     cvs_out("- WinCvs page : http://www.cvsgui.org\n");
00961     cvs_out("- cvs page : http://www.cvshome.org\n");
00962     cvs_out("- WinCvs documentation : Don Harper <don@lamrc.com>.\n");
00963     cvs_out("- WinHelp cvs documentation : Norbert Klamann.\n");
00964     cvs_out("- Special thanks to :\n");
00965     cvs_out("\t* The Strata Inc. developpers who are so patients with WinCvs\n");
00966     cvs_out("\t  and help to identify a lot of problems.\n");
00967     cvs_out("\t* All the people who are submitting bugs, patches and\n");
00968     cvs_out("\t  answer the cvsgui mailing list.\n");
00969     cvs_out("- Bug reports, suggestions :\n");
00970     cvs_out("\t* Richard Wesley, Alain Aslag Roy, Eric Aubourg and many others\n");
00971     cvs_out("- Cvs contributors :\n");
00972     cvs_out("\t* Too many to be listed here, see the 'ChangeLog' instead !\n");
00973 }

void CWincvsApp::OnFileNew ( ) [protected]

Definition at line 215 of file wincvs.cpp.

00216 {
00217     gLogTempl->OpenDocumentFile(NULL);
00218 }

void CWincvsApp::OnHelpCvs ( ) [protected]

Definition at line 1095 of file wincvs.cpp.

01096 {
01097     CStr hlp;
01098     LookForResourceFile("cvs.hlp", hlp);
01099     ::WinHelp(*AfxGetMainWnd(), hlp, HELP_CONTENTS, 0L);
01100 }

void CWincvsApp::OnHelpCvsclient ( ) [protected]

Definition at line 1102 of file wincvs.cpp.

01103 {
01104     CStr hlp;
01105     LookForResourceFile("cvscli.hlp", hlp);
01106     ::WinHelp(*AfxGetMainWnd(), hlp, HELP_CONTENTS, 0L);
01107 }

void CWincvsApp::OnLogWindowIsPresent ( CCmdUI * pCmdUI ) [protected]

Definition at line 210 of file wincvs.cpp.

00211 {
00212     pCmdUI->Enable(GetConsoleView() != 0L);
00213 }

BOOL CWincvsApp::PreTranslateMessage ( MSG * pMsg ) [virtual]

Definition at line 999 of file wincvs.cpp.

01000 {
01001     // CG: The following lines were added by the Splash Screen component.
01002     if (CSplashWnd::PreTranslateAppMessage(pMsg))
01003         return TRUE;
01004
01005     DWORD time = ::GetTickCount();
01006     if (m_idletime == 0 ||
01007         pMsg->message == WM_KEYDOWN ||
01008         pMsg->message == WM_SYSKEYDOWN ||
01009         pMsg->message == WM_LBUTTONDOWN ||
01010         pMsg->message == WM_RBUTTONDOWN ||
01011         pMsg->message == WM_MBUTTONDOWN ||
01012         pMsg->message == WM_NCLBUTTONDOWN ||
01013         pMsg->message == WM_NCRBUTTONDOWN ||
01014         pMsg->message == WM_NCMBUTTONDOWN)
01015     {
01016         m_idletime = time;
01017         PyInvalUICache();
01018     }
01019
01020     IdleCvsProgress();
01021
01022     return CWinApp::PreTranslateMessage(pMsg);
01023 }

void CWincvsApp::ResetIdleTime ( void ) [inline]

Definition at line 113 of file wincvs.h.

Referenced by CLogoutThread::InitInstance().

00113 { m_idletime = 0; }

BOOL CWincvsApp::SaveAllModified ( ) [virtual]

Definition at line 1148 of file wincvs.cpp.

01149 {
01150     // prevent from exiting when cvs is running
01151     if(gCvsRunning)
01152     {
01153         gCvsStopping = true;
01154         return TRUE;
01155     }
01156
01157     if(sLogout != 0L)
01158     {
01159         HANDLE hdl = sLogout->m_hThread;
01160         sLogout->KillThread();
01161         WaitForSingleObject(hdl, INFINITE);
01162         //delete sLogout;
01163         sLogout = 0L;
01164     }
01165
01166     // auto-logout
01167     if(gAuthen.kind() == pserver && gCvsPrefs.HasLoogedIn() &&
01168         gCvsPrefs.LogoutTimeOut() > 0)
01169     {
01170         cvs_err("Making automatic logout before quitting:\n");
01171         CvsCmdLogout();
01172         WaitForCvs();
01173     }
01174
01175     return CWinApp::SaveAllModified();
01176 }

void CWincvsApp::ShowTipAtStartup ( void ) [private]

Definition at line 975 of file wincvs.cpp.

Referenced by InitInstance().

00976 {
00977     // CG: This function added by 'Tip of the Day' component.
00978
00979     CCommandLineInfo cmdInfo;
00980     ParseCommandLine(cmdInfo);
00981     if (cmdInfo.m_bShowSplash)
00982     {
00983         CTipDlg dlg( IsWindow(m_pMainWnd->GetSafeHwnd()) ? m_pMainWnd : NULL );
00984         if (dlg.m_bStartup)
00985             dlg.DoModal();
00986     }
00987
00988 }

void CWincvsApp::ShowTipOfTheDay ( void ) [private]

Definition at line 990 of file wincvs.cpp.

00991 {
00992     // CG: This function added by 'Tip of the Day' component.
00993
00994     CTipDlg dlg;
00995     dlg.DoModal();
00996
00997 }

void CWincvsApp::UpdateAllDocsView ( )

Definition at line 1337 of file wincvs.cpp.

Referenced by CGraphView::OnGraphGraphoptions().

01338 {
01339     POSITION pos = GetFirstDocTemplatePosition();
01340     while( pos )
01341     {
01342         CDocTemplate* pTemplate = GetNextDocTemplate(pos);
01343         POSITION pos2 = pTemplate->GetFirstDocPosition();
01344         while(pos2)
01345         {
01346             CDocument* pDocument;
01347             if(pDocument = pTemplate->GetNextDoc(pos2))
01348             {
01349                 pDocument->UpdateAllViews(NULL);
01350             }
01351         }
01352     }
01353 }

Member Data Documentation

struct _CvsProcess* CWincvsApp::gCvsProcess

Definition at line 100 of file wincvs.h.

Referenced by CWincvsDoc::OnStopcvs(), and launchCVS().

bool CWincvsApp::gCvsRunning

Definition at line 84 of file wincvs.h.

Referenced by CWinCvsBrowser::DisableCommon(), CGraphView::DisableCommon(), CExploreBar::DisableCommon(), CMyShellTree::DisableCommon(), CBrowseFileView::DisableCommon(), CCvsStatusBar::DrawItem(), CLogoutThread::InitInstance(), IsAppEnabled(), CMainFrame::OnClose(), CWinCvsBrowser::OnItemexpanding(), CBrowseFileView::OnKeydown(), CBrowseFileView::OnLButtonDblClk(), CWinCvsBrowser::OnRButtonDown(), CWinCvsBrowser::OnSelchanging(), CWinCvsBrowser::OnSetCursor(), CBrowseFileView::OnSetCursor(), CCvsStatusBar::OnTimer(), CBrowseFileView::OnTimer(), CWincvsDoc::OnUpdateCvsCmd(), CWincvsDoc::OnUpdateMacroAdmin(), CWincvsDoc::OnUpdatePrefs(), CWincvsDoc::OnUpdateSavesettings(), CWincvsDoc::OnUpdateStopcvs(), CWinCvsBrowser::OnUpdateViewReload(), CBrowseFileView::OnUpdateViewReload(), CBrowseFileView::OnUpdateViewUpone(), and launchCVS().

bool CWincvsApp::gCvsStopping

Definition at line 87 of file wincvs.h.

Referenced by CWincvsDoc::OnStopcvs(), CWincvsDoc::OnUpdateStopcvs(), and launchCVS().

int CWincvsApp::gLastCvsResult

Definition at line 90 of file wincvs.h.

CMultiDocTemplate* CWincvsApp::gLogGraph

Definition at line 94 of file wincvs.h.

Referenced by CvsLogParse().

CMultiDocTemplate* CWincvsApp::gLogHtml

Definition at line 95 of file wincvs.h.

CMultiDocTemplate* CWincvsApp::gLogTempl

Definition at line 93 of file wincvs.h.

BOOL CWincvsApp::m_bATLInited [protected]

Definition at line 151 of file wincvs.h.

DWORD CWincvsApp::m_idletime [protected]

Definition at line 149 of file wincvs.h.

bool CWincvsApp::m_isBackgroundProcess

Definition at line 140 of file wincvs.h.

Referenced by CMainFrame::OnActivate(), and KoWatcher::Run().

CMainFrame* CWincvsApp::m_mainFrame [protected]

Definition at line 150 of file wincvs.h.

COleTemplateServer CWincvsApp::m_server [protected]

Definition at line 154 of file wincvs.h.

The documentation for this class was generated from the following files:
  • WinCvs/wincvs.h
  • WinCvs/wincvs.cpp
Generated on Sun Oct 21 12:50:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWinCvsBrowser Class Reference

#include <WinCvsBrowser.h>

Inheritance diagram for CWinCvsBrowser:

[legend]
Collaboration diagram for CWinCvsBrowser:

[legend]
List of all members.

Public Methods

void | NotifySelectionChange ()
void | SetNewStyle (long lStyleMask, BOOL bSetBits)
void | DeleteAllItems (HTREEITEM root=0L)
void | ResetBrowser (const char *path, bool notifyView=false)
void | RetrievePath (HTREEITEM item, UStr &path)
bool | StepToLocation (const char *path, bool notifyView=false)
void | ResetView (bool forceReload=false, bool notifyView=false)
const char * | GetRoot (void) const
void | OnIgnoreChanged ()
virtual BOOL | Create (LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL)
virtual void | OnInitialUpdate ()

Public Attributes

friend | CSelectionChangeNotifier

Protected Methods

CWinCvsBrowser ()
virtual void | OnDraw (CDC *pDC)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
void | StoreExpanded (std::vector< UStr > &allExpanded, HTREEITEM root=0L)
bool | DisableCommon ()
HTREEITEM | GetItemByLocation (const char *path)
virtual | ~CWinCvsBrowser ()
void | OnUpdateCmd (CCmdUI *pCmdUI, BOOL needCvsInfos)
afx_msg void | OnItemexpanding (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnRButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnSelchanging (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnUpdateViewAdd (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewUpdate (CCmdUI *pCmdUI)
afx_msg void | OnViewAdd ()
afx_msg void | OnViewCommit ()
afx_msg void | OnViewUpdate ()
afx_msg void | OnViewQueryUpdate ()
afx_msg void | OnViewDiff ()
afx_msg void | OnViewLog ()
afx_msg void | OnViewStatus ()
afx_msg void | OnViewLock ()
afx_msg void | OnViewUnlock ()
afx_msg void | OnViewWatchOn ()
afx_msg void | OnViewWatchOff ()
afx_msg void | OnViewEdit ()
afx_msg void | OnViewUnedit ()
afx_msg void | OnViewWatchers ()
afx_msg void | OnViewEditors ()
afx_msg void | OnViewRelease ()
afx_msg void | OnViewTagNew ()
afx_msg void | OnViewTagDelete ()
afx_msg void | OnViewTagBranch ()
afx_msg void | OnViewExplore ()
afx_msg void | OnUpdateViewExplore (CCmdUI *pCmdUI)
afx_msg void | OnUpdateViewReload (CCmdUI *pCmdUI)
afx_msg void | OnViewReload ()
afx_msg void | OnViewCheckout ()
afx_msg void | OnUpdateViewCheckout (CCmdUI *pCmdUI)
afx_msg void | OnViewImport ()
afx_msg void | OnUpdateViewImport (CCmdUI *pCmdUI)
afx_msg BOOL | OnSetCursor (CWnd *pWnd, UINT nHitTest, UINT message)
afx_msg void | OnSelchanged (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnDestroy ()
afx_msg void | OnUpdateMacro (CCmdUI *pCmdUI)
afx_msg BOOL | OnMacro (UINT nID)
afx_msg void | OnUpdateCustomize (CCmdUI *pCmdUI)
afx_msg BOOL | OnCustomize (UINT nID)
afx_msg LRESULT | OnResetView (WPARAM, LPARAM)

Protected Attributes

bool | m_isSelectionNotificationLocked
bool | m_isSelectionChanged
bool | m_isResetViewPending
UStr m_root

Static Protected Attributes

CImageList | m_Imagelist

Constructor & Destructor Documentation

CWinCvsBrowser::CWinCvsBrowser ( ) [protected]

Definition at line 114 of file WinCvsBrowser.cpp.

00115 : m_isSelectionNotificationLocked(false)
00116 , m_isSelectionChanged(false)
00117 , m_isResetViewPending(false)
00118 {
00119 }

CWinCvsBrowser::~CWinCvsBrowser ( ) [protected, virtual]

Definition at line 121 of file WinCvsBrowser.cpp.

00122 { }

Member Function Documentation

BOOL CWinCvsBrowser::Create | ( | LPCTSTR | lpszClassName,
 |  | LPCTSTR | lpszWindowName,
 |  | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | CCreateContext * | pContext = NULL
 | ) | [virtual]

Definition at line 150 of file WinCvsBrowser.cpp.

Referenced by CBrowserBar::Create().

00151 {
00152     if (!CTreeView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext))
00153     {
00154         return FALSE;
00155     }
00156
00157     if(m_Imagelist.m_hImageList == 0L)
00158         m_Imagelist.Create(16, 16, ILC_MASK, 1, 1);
00159     m_Imagelist.SetBkColor(GetSysColor(COLOR_WINDOW));
00160
00161     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00162     HICON hIcon = app->LoadIcon(IDI_FOLDER);
00163     m_Imagelist.Add(hIcon);
00164     hIcon = app->LoadIcon(IDI_FOLDERO);
00165     m_Imagelist.Add(hIcon);
00166     hIcon = app->LoadIcon(IDI_FOLDERCVS);
00167     m_Imagelist.Add(hIcon);
00168     hIcon = app->LoadIcon(IDI_FOLDEROCVS);
00169     m_Imagelist.Add(hIcon);
00170     hIcon = app->LoadIcon(IDI_FOLDERIGN);
00171     m_Imagelist.Add(hIcon);
00172     hIcon = app->LoadIcon(IDI_FOLDEROIGN);
00173     m_Imagelist.Add(hIcon);
00174     hIcon = app->LoadIcon(IDI_FOLDERLOST);
00175     m_Imagelist.Add(hIcon);
00176
00177     CTreeCtrl& treeCtrl = GetTreeCtrl();
00178     treeCtrl.SetImageList(&m_Imagelist, TVSIL_NORMAL);
00179
00180     // set the initial root
00181     CMainFrame* mainFrm = app->GetMainFrame();
00182     CHistComboBoxEx& hist = mainFrm->GetBrowseHistory();
00183     CStr newpath((const char *)hist.GetOldLoc());
00184     ResetBrowser(newpath, true);
00185
00186     SetNewStyle(TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT, TRUE);
00187
00188     return TRUE;
00189 }

void CWinCvsBrowser::DeleteAllItems ( HTREEITEM root = 0L )

Definition at line 191 of file WinCvsBrowser.cpp.

Referenced by OnItemexpanding(), and ResetBrowser().

00192 {
00193     // we don't want the file view to be notified when things get deleted
00194     // process selection after we are done with all that jazz below
00195     CSelectionChangeNotifier notifier(this, true);
00196
00197     CTreeCtrl& treeCtrl = GetTreeCtrl();
00198     bool eraseRoot = false;
00199     if(root == 0L)
00200     {
00201         root = treeCtrl.GetRootItem( );
00202         eraseRoot = true;
00203     }
00204     if(root == 0L)
00205         return;
00206
00207     HTREEITEM childItem = treeCtrl.GetNextItem(root, TVGN_CHILD);
00208
00209     // erase all the childs
00210     while(childItem != 0L)
00211     {
00212         EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(childItem);
00213         if(data != 0L) {
00214             treeCtrl.SetItemData(childItem,0L); //So that subsequent references after UnRef() won't SEGV
00215             data->UnRef();  //Or move this one after DeleteAllItems? so we don't loose one system call. For now, safe way
00216         }
00217
00218         DeleteAllItems(childItem);
00219
00220         HTREEITEM nextItem = treeCtrl.GetNextItem(childItem, TVGN_NEXT);
00221         VERIFY(treeCtrl.DeleteItem(childItem));
00222         childItem = nextItem;
00223     }
00224
00225     // erase the root only if initially root was 0L
00226     if(eraseRoot)
00227     {
00228         EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(root);
00229         ASSERT(data == 0L);
00230
00231         VERIFY(treeCtrl.DeleteItem(root));
00232     }
00233 }

bool CWinCvsBrowser::DisableCommon ( ) [protected]

Definition at line 1272 of file WinCvsBrowser.cpp.

Referenced by OnUpdateCmd(), OnUpdateMacro(), OnUpdateViewCheckout(), OnUpdateViewExplore(), and OnUpdateViewImport().

01273 {
01274     CWincvsApp *app = (CWincvsApp *)AfxGetApp();
01275     return app->gCvsRunning || gCvsPrefs.empty();
01276 }

HTREEITEM CWinCvsBrowser::GetItemByLocation ( const char * path ) [protected]

Definition at line 1067 of file WinCvsBrowser.cpp.

Referenced by ResetView().

01068 {
01069     CStr root(m_root);
01070     if(!root.endsWith(kPathDelimiter))
01071         root << kPathDelimiter;
01072     CStr subpath(path);
01073     if(!subpath.endsWith(kPathDelimiter))
01074         subpath << kPathDelimiter;
01075
01076     // check if it is a sub-path
01077     if(strncmp(root, subpath, root.length()) != 0)
01078         return 0L;
01079
01080     CTreeCtrl& treeCtrl = GetTreeCtrl();
01081     HTREEITEM item = treeCtrl.GetRootItem();
01082     if(item == 0L)
01083         return 0L;
01084
01085     // step inside synchronized
01086     const char *tmp = (const char *)subpath + root.length() - 1;
01087     while((tmp = strchr(tmp, kPathDelimiter)) != 0L)
01088     {
01089         const char *name = ++tmp;
01090         if(name[0] == '\0')
01091             break;
01092
01093         CStr subname;
01094         const char *tmp2 = strchr(name, kPathDelimiter);
01095         if(tmp2 == 0L)
01096             subname = name;
01097         else
01098             subname.set(name, tmp2 - name);
01099
01100         HTREEITEM childItem = treeCtrl.GetNextItem(item, TVGN_CHILD);
01101
01102         // find the subitem which matches this name
01103         while(childItem != 0L)
01104         {
01105             EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(childItem);
01106             if(data != 0L)
01107             {
01108                 if(_stricmp((*data)[EntnodeData::kName], subname) == 0)
01109                 {
01110                     item = childItem;
01111                     break;
01112                 }
01113             }
01114
01115             childItem = treeCtrl.GetNextItem(childItem, TVGN_NEXT);
01116         }
01117         if(childItem == 0L)
01118             return 0L;
01119     }
01120
01121     return item;
01122 }

const char* CWinCvsBrowser::GetRoot ( void ) const [inline]

Definition at line 110 of file WinCvsBrowser.h.

Referenced by CWincvsApp::GetRoot(), CWincvsApp::InitInstance(), CWincvsDoc::OnSavesettings(), and CvsPrefs::save().

00110 { return m_root; }

void CWinCvsBrowser::NotifySelectionChange ( )

Definition at line 708 of file WinCvsBrowser.cpp.

Referenced by OnSelchanged(), and CWinCvsBrowser::CSelectionChangeNotifier::~CSelectionChangeNotifier().

00709 {
00710     if(!m_isSelectionNotificationLocked)
00711     {
00712         if (m_isSelectionChanged)
00713         {
00714             CStr path;
00715             HTREEITEM item = GetTreeCtrl().GetSelectedItem();
00716             if (item)
00717             {
00718                 RetrievePath(item, path);
00719                 CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00720                 CBrowseFileView *fileView = app->GetFileView();
00721                 if (fileView)
00722                 {
00723                     fileView->ResetView(path);
00724                 }
00725                 gCvsPrefs.SetLastWorkingDir(path);
00726             }
00727         }
00728     }
00729 }

BOOL CWinCvsBrowser::OnCustomize ( UINT nID ) [protected]

Definition at line 1311 of file WinCvsBrowser.cpp.

01312 {
01313     CustomizeMenus(nID == ID_CUST_FILES_MENU ? kCustomFilesMenu : kCustomBrowserMenu);
01314     return TRUE;
01315 }

void CWinCvsBrowser::OnDestroy ( void ) [protected]

Definition at line 1334 of file WinCvsBrowser.cpp.

01335 {
01336     if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
01337     {
01338         app->GetIgnoreModel()->GetNotificationManager()->CheckOut(this);
01339     }
01340
01341     CTreeView::OnDestroy();
01342 }

void CWinCvsBrowser::OnDraw ( CDC * pDC ) [protected, virtual]

Definition at line 127 of file WinCvsBrowser.cpp.

00128 {
00129     // TODO: add draw code here
00130 }

void CWinCvsBrowser::OnIgnoreChanged ( )

Definition at line 1344 of file WinCvsBrowser.cpp.

01345 {
01346     if (!m_isResetViewPending)
01347     {
01348         m_isResetViewPending = true;
01349         PostMessage(WM_RESETVIEW);
01350     }
01351 }

void CWinCvsBrowser::OnInitialUpdate ( ) [virtual]

Definition at line 936 of file WinCvsBrowser.cpp.

00937 {
00938     CTreeView::OnInitialUpdate();
00939
00940     CTreeCtrl& treeCtrl = GetTreeCtrl();
00941     HTREEITEM root = treeCtrl.GetRootItem( );
00942     if(root != 0L)
00943     {
00944         treeCtrl.Expand(root, TVE_EXPAND);
00945         VERIFY(treeCtrl.Select(root, TVGN_CARET));
00946     }
00947
00948     if (CWincvsApp* app = (CWincvsApp *)AfxGetApp())
00949     {
00950         app->GetIgnoreModel()->GetNotificationManager()->CheckIn(this, onIgnoreChanged);
00951     }
00952 }

void CWinCvsBrowser::OnItemexpanding | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 553 of file WinCvsBrowser.cpp.

00554 {
00555     // prevent from changing directory if cvs is running
00556     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00557     if(app->gCvsRunning)
00558     {
00559         *pResult = TRUE;
00560         return;
00561     }
00562
00563     CTreeCtrl& treeCtrl = GetTreeCtrl();
00564     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00565
00566     HTREEITEM item = pNMTreeView->itemNew.hItem;
00567
00568     EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(item);
00569     if(data != 0L && data->IsMissing())
00570     {
00571         *pResult = TRUE;
00572         return;
00573     }
00574
00575     // erase all the childs
00576     DeleteAllItems(item);
00577
00578     CStr path;
00579     RetrievePath(item, path);
00580
00581     if(pNMTreeView->action & TVE_COLLAPSE)
00582     {
00583         TBrowserFillDummy traverse(treeCtrl, 0L, item, 0L);
00584         kTraversal res = FileTraverse(path, traverse);
00585     }
00586     else if(pNMTreeView->action & TVE_EXPAND)
00587     {
00588         CSortList<ENTNODE> entries(200, ENTNODE::Compare);
00589         TBrowserFill traverse(treeCtrl, 0L, item, entries);
00590         kTraversal res = FileTraverse(path, traverse);
00591
00592         // add the missing folders
00593         Entries_SetMissing(entries);
00594         int numEntries = entries.NumOfElements();
00595         for(int i = 0; i < numEntries; i++)
00596         {
00597             const ENTNODE & theNode = entries.Get(i);
00598             EntnodeData *data = theNode.Data();
00599             if(!data->IsMissing() || data->GetType() != ENT_SUBDIR)
00600                 continue;
00601
00602             TV_INSERTSTRUCT tvstruct;
00603             tvstruct.hParent = item;
00604             tvstruct.hInsertAfter = TVI_SORT;
00605             tvstruct.item.iImage = kIconFolderIgnoreLost;
00606             tvstruct.item.iSelectedImage = kIconFolderIgnoreLost;
00607             tvstruct.item.pszText = (char *)(*data)[EntnodeData::kName];
00608             tvstruct.item.lParam = (long)data->Ref();
00609             tvstruct.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT | TVIF_PARAM;
00610             treeCtrl.InsertItem(&tvstruct);
00611
00612         }
00613     }
00614
00615     *pResult = 0;
00616 }

BOOL CWinCvsBrowser::OnMacro ( UINT nID ) [protected]

Definition at line 1216 of file WinCvsBrowser.cpp.

01217 {
01218     PyDoPython(WINCMD_to_UCMD(nID));
01219
01220     return 1;
01221 }

void CWinCvsBrowser::OnRButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 647 of file WinCvsBrowser.cpp.

00648 {
00649     // prevent from changing directory if cvs is running
00650     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00651     if(app->gCvsRunning)
00652         return;
00653
00654     // prompt a menu when hitting a selection
00655     // with the right button...
00656     CTreeCtrl& treeCtrl = GetTreeCtrl();
00657     UINT pFlags;
00658     HTREEITEM testItem = treeCtrl.HitTest(point, &pFlags);
00659     if(testItem != 0L && (pFlags & (TVHT_ONITEM|TVHT_ONITEMBUTTON)) != 0)
00660     {
00661         treeCtrl.SelectItem(testItem);
00662         // Locate the submenu AFTER item selection
00663         CMenu* pMyMenu=::GetCustomMenu(kCustomBrowserMenu,this);
00664         if (pMyMenu)
00665         {
00666             ClientToScreen(&point);
00667             pMyMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x, point.y, this);
00668             delete pMyMenu;
00669             return;
00670         }
00671     }
00672     CTreeView::OnRButtonDown(nFlags, point);    //L->R
00673 }

LRESULT CWinCvsBrowser::OnResetView | ( | WPARAM | ,
 |  | LPARAM |
 | ) | [protected]

Definition at line 1353 of file WinCvsBrowser.cpp.

01354 {
01355     ResetView(true, false);
01356     return 0;
01357 }

void CWinCvsBrowser::OnSelchanged | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 699 of file WinCvsBrowser.cpp.

00700 {
00701     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00702     m_isSelectionChanged = true;
00703     NotifySelectionChange();
00704
00705     *pResult = 0;
00706 }

void CWinCvsBrowser::OnSelchanging | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Definition at line 675 of file WinCvsBrowser.cpp.

00676 {
00677     // prevent from changing directory if cvs is running
00678     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00679     if(app->gCvsRunning)
00680     {
00681         *pResult = TRUE;
00682         return;
00683     }
00684
00685     CTreeCtrl& treeCtrl = GetTreeCtrl();
00686     NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
00687     HTREEITEM item = pNMTreeView->itemNew.hItem;
00688
00689     EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(item);
00690     if(data != 0L && data->IsMissing())
00691     {
00692         *pResult = TRUE;
00693         return;
00694     }
00695
00696     *pResult = 0;
00697 }

BOOL CWinCvsBrowser::OnSetCursor | ( | CWnd * | pWnd,
 |  | UINT | nHitTest,
 |  | UINT | message
 | ) | [protected]

Definition at line 1322 of file WinCvsBrowser.cpp.

01323 {
01324     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01325     if(app->gCvsRunning)
01326     {
01327         SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
01328         return TRUE;
01329     }
01330
01331     return CTreeView::OnSetCursor(pWnd, nHitTest, message);
01332 }

void CWinCvsBrowser::OnUpdateCmd | ( | CCmdUI * | pCmdUI,
 |  | BOOL | needCvsInfos
 | ) | [protected]

Definition at line 618 of file WinCvsBrowser.cpp.

Referenced by OnUpdateViewAdd(), and OnUpdateViewUpdate().

00619 {
00620     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00621     if(DisableCommon())
00622     {
00623         pCmdUI->Enable(FALSE);
00624         return;
00625     }
00626     CTreeCtrl& treeCtrl = GetTreeCtrl();
00627     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00628     if(selItem == 0L)
00629     {
00630         pCmdUI->Enable(FALSE);
00631         return;
00632     }
00633
00634     CStr path;
00635     RetrievePath(selItem, path);
00636     if(!path.endsWith(kPathDelimiter))
00637         path << kPathDelimiter;
00638     path << "CVS";
00639
00640     struct stat sb;
00641     if (stat(path, &sb) == -1 || !S_ISDIR(sb.st_mode))
00642         pCmdUI->Enable(!needCvsInfos);
00643     else
00644         pCmdUI->Enable(needCvsInfos);
00645 }

void CWinCvsBrowser::OnUpdateCustomize ( CCmdUI * pCmdUI ) [protected]

Definition at line 1317 of file WinCvsBrowser.cpp.

01318 {
01319     pCmdUI->Enable(TRUE);
01320 }

void CWinCvsBrowser::OnUpdateMacro ( CCmdUI * pCmdUI ) [protected]

Definition at line 1223 of file WinCvsBrowser.cpp.

01224 {
01225     if(DisableCommon())
01226     {
01227         pCmdUI->Enable(FALSE);
01228         return;
01229     }
01230
01231     // fill the cache with current selection
01232     if(!PyIsUICacheValid())
01233     {
01234         CTreeCtrl& treeCtrl = GetTreeCtrl();
01235         HTREEITEM selItem = treeCtrl.GetSelectedItem();
01236         if(selItem != 0L)
01237         {
01238             CStr selPath;
01239             RetrievePath(selItem, selPath);
01240             CStr uppath, folder;
01241             SplitPath(selPath, uppath, folder);
01242
01243             bool deleteData = false;
01244             EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(selItem);
01245             if(data == 0L)
01246             {
01247                 deleteData = true;
01248                 EntnodePath *thePath = new EntnodePath(uppath);
01249                 data = new EntnodeFolder(folder, thePath);
01250                 thePath->UnRef();
01251             }
01252
01253             PyAppendCache(data);
01254
01255             if(deleteData)
01256                 data->UnRef();
01257         }
01258     }
01259
01260     UCmdUI ucmdui(WINCMD_to_UCMD(pCmdUI->m_nID));
01261     ucmdui.pCmdUI = pCmdUI;
01262     PyDoCmdUI(&ucmdui);
01263 }

void CWinCvsBrowser::OnUpdateViewAdd ( CCmdUI * pCmdUI ) [protected]

Definition at line 731 of file WinCvsBrowser.cpp.

00732 {
00733     OnUpdateCmd(pCmdUI, FALSE);
00734 }

void CWinCvsBrowser::OnUpdateViewCheckout ( CCmdUI * pCmdUI ) [protected]

Definition at line 1284 of file WinCvsBrowser.cpp.

01285 {
01286     if(DisableCommon())
01287     {
01288         pCmdUI->Enable(FALSE);
01289         return;
01290     }
01291     pCmdUI->Enable(TRUE);
01292     pCmdUI->SetText("Chec&kout module...");
01293 }

void CWinCvsBrowser::OnUpdateViewExplore ( CCmdUI * pCmdUI ) [protected]

Definition at line 969 of file WinCvsBrowser.cpp.

00970 {
00971     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00972     if(DisableCommon())
00973     {
00974         pCmdUI->Enable(FALSE);
00975         return;
00976     }
00977     CTreeCtrl& treeCtrl = GetTreeCtrl();
00978     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00979     if(selItem == 0L)
00980     {
00981         pCmdUI->Enable(FALSE);
00982         return;
00983     }
00984     pCmdUI->Enable(TRUE);
00985 }

void CWinCvsBrowser::OnUpdateViewImport ( CCmdUI * pCmdUI ) [protected]

Definition at line 1300 of file WinCvsBrowser.cpp.

01301 {
01302     if(DisableCommon())
01303     {
01304         pCmdUI->Enable(FALSE);
01305         return;
01306     }
01307     pCmdUI->Enable(TRUE);
01308     pCmdUI->SetText("&Import module...");
01309 }

void CWinCvsBrowser::OnUpdateViewReload ( CCmdUI * pCmdUI ) [protected]

Definition at line 1205 of file WinCvsBrowser.cpp.

01206 {
01207     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01208     pCmdUI->Enable(!app->gCvsRunning);
01209 }

void CWinCvsBrowser::OnUpdateViewUpdate ( CCmdUI * pCmdUI ) [protected]

Definition at line 736 of file WinCvsBrowser.cpp.

00737 {
00738     OnUpdateCmd(pCmdUI, TRUE);
00739 }

void CWinCvsBrowser::OnViewAdd ( ) [protected]

Definition at line 741 of file WinCvsBrowser.cpp.

00742 {
00743     CTreeCtrl& treeCtrl = GetTreeCtrl();
00744     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00745
00746     CStr path;
00747     RetrievePath(selItem, path);
00748     CvsCmdAddFolder(path);
00749 }

void CWinCvsBrowser::OnViewCheckout ( ) [protected]

Definition at line 1279 of file WinCvsBrowser.cpp.

01280 {
01281     CvsCmdCheckoutModule();
01282 }

void CWinCvsBrowser::OnViewCommit ( ) [protected]

Definition at line 751 of file WinCvsBrowser.cpp.

00752 {
00753     CTreeCtrl& treeCtrl = GetTreeCtrl();
00754     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00755
00756     CStr path;
00757     RetrievePath(selItem, path);
00758     CvsCmdCommitFolder(path);
00759 }

void CWinCvsBrowser::OnViewDiff ( ) [protected]

Definition at line 781 of file WinCvsBrowser.cpp.

00782 {
00783     CTreeCtrl& treeCtrl = GetTreeCtrl();
00784     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00785
00786     CStr path;
00787     RetrievePath(selItem, path);
00788     CvsCmdDiffFolder(path);
00789 }

void CWinCvsBrowser::OnViewEdit ( ) [protected]

Definition at line 851 of file WinCvsBrowser.cpp.

00852 {
00853     CTreeCtrl& treeCtrl = GetTreeCtrl();
00854     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00855
00856     CStr path;
00857     RetrievePath(selItem, path);
00858     CvsCmdEditFolder(path);
00859 }

void CWinCvsBrowser::OnViewEditors ( ) [protected]

Definition at line 881 of file WinCvsBrowser.cpp.

00882 {
00883     CTreeCtrl& treeCtrl = GetTreeCtrl();
00884     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00885
00886     CStr path;
00887     RetrievePath(selItem, path);
00888     CvsCmdEditorsFolder(path);
00889 }

void CWinCvsBrowser::OnViewExplore ( ) [protected]

Definition at line 954 of file WinCvsBrowser.cpp.

00955 {
00956     CTreeCtrl& treeCtrl = GetTreeCtrl();
00957     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00958
00959     CStr path;
00960     RetrievePath(selItem, path);
00961     HINSTANCE hInst = ShellExecute(*AfxGetMainWnd(), "explore", path,
00962             0L, 0L, SW_SHOWDEFAULT);
00963     if((long)hInst < 32)
00964     {
00965         cvs_err("Unable to explore '%s' (error %d)\n", (char *)path, GetLastError());
00966     }
00967 }

void CWinCvsBrowser::OnViewImport ( ) [protected]

Definition at line 1295 of file WinCvsBrowser.cpp.

01296 {
01297     CvsCmdImportModule();
01298 }

void CWinCvsBrowser::OnViewLock ( ) [protected]

Definition at line 811 of file WinCvsBrowser.cpp.

00812 {
00813     CTreeCtrl& treeCtrl = GetTreeCtrl();
00814     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00815
00816     CStr path;
00817     RetrievePath(selItem, path);
00818     CvsCmdLockFolder(path);
00819 }

void CWinCvsBrowser::OnViewLog ( ) [protected]

Definition at line 791 of file WinCvsBrowser.cpp.

00792 {
00793     CTreeCtrl& treeCtrl = GetTreeCtrl();
00794     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00795
00796     CStr path;
00797     RetrievePath(selItem, path);
00798     CvsCmdLogFolder(path);
00799 }

void CWinCvsBrowser::OnViewQueryUpdate ( ) [protected]

Definition at line 771 of file WinCvsBrowser.cpp.

00772 {
00773     CTreeCtrl& treeCtrl = GetTreeCtrl();
00774     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00775
00776     CStr path;
00777     RetrievePath(selItem, path);
00778     CvsCmdUpdateFolder(path, true);
00779 }

void CWinCvsBrowser::OnViewRelease ( ) [protected]

Definition at line 891 of file WinCvsBrowser.cpp.

00892 {
00893     CTreeCtrl& treeCtrl = GetTreeCtrl();
00894     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00895
00896     CStr path;
00897     RetrievePath(selItem, path);
00898     CvsCmdReleaseFolder(path);
00899 }

void CWinCvsBrowser::OnViewReload ( ) [protected]

Definition at line 1211 of file WinCvsBrowser.cpp.

01212 {
01213     ResetView(true, true);
01214 }

void CWinCvsBrowser::OnViewStatus ( ) [protected]

Definition at line 801 of file WinCvsBrowser.cpp.

00802 {
00803     CTreeCtrl& treeCtrl = GetTreeCtrl();
00804     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00805
00806     CStr path;
00807     RetrievePath(selItem, path);
00808     CvsCmdStatusFolder(path);
00809 }

void CWinCvsBrowser::OnViewTagBranch ( ) [protected]

Definition at line 921 of file WinCvsBrowser.cpp.

00922 {
00923     CTreeCtrl& treeCtrl = GetTreeCtrl();
00924     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00925
00926     CStr path;
00927     RetrievePath(selItem, path);
00928     CvsCmdTagBranchFolder(path);
00929 }

void CWinCvsBrowser::OnViewTagDelete ( ) [protected]

Definition at line 911 of file WinCvsBrowser.cpp.

00912 {
00913     CTreeCtrl& treeCtrl = GetTreeCtrl();
00914     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00915
00916     CStr path;
00917     RetrievePath(selItem, path);
00918     CvsCmdTagDeleteFolder(path);
00919 }

void CWinCvsBrowser::OnViewTagNew ( ) [protected]

Definition at line 901 of file WinCvsBrowser.cpp.

00902 {
00903     CTreeCtrl& treeCtrl = GetTreeCtrl();
00904     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00905
00906     CStr path;
00907     RetrievePath(selItem, path);
00908     CvsCmdTagCreateFolder(path);
00909 }

void CWinCvsBrowser::OnViewUnedit ( ) [protected]

Definition at line 861 of file WinCvsBrowser.cpp.

00862 {
00863     CTreeCtrl& treeCtrl = GetTreeCtrl();
00864     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00865
00866     CStr path;
00867     RetrievePath(selItem, path);
00868     CvsCmdUneditFolder(path);
00869 }

void CWinCvsBrowser::OnViewUnlock ( ) [protected]

Definition at line 821 of file WinCvsBrowser.cpp.

00822 {
00823     CTreeCtrl& treeCtrl = GetTreeCtrl();
00824     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00825
00826     CStr path;
00827     RetrievePath(selItem, path);
00828     CvsCmdUnlockFolder(path);
00829 }

void CWinCvsBrowser::OnViewUpdate ( ) [protected]

Definition at line 761 of file WinCvsBrowser.cpp.

00762 {
00763     CTreeCtrl& treeCtrl = GetTreeCtrl();
00764     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00765
00766     CStr path;
00767     RetrievePath(selItem, path);
00768     CvsCmdUpdateFolder(path);
00769 }

void CWinCvsBrowser::OnViewWatchOff ( ) [protected]

Definition at line 841 of file WinCvsBrowser.cpp.

00842 {
00843     CTreeCtrl& treeCtrl = GetTreeCtrl();
00844     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00845
00846     CStr path;
00847     RetrievePath(selItem, path);
00848     CvsCmdWatchOffFolder(path);
00849 }

void CWinCvsBrowser::OnViewWatchOn ( ) [protected]

Definition at line 831 of file WinCvsBrowser.cpp.

00832 {
00833     CTreeCtrl& treeCtrl = GetTreeCtrl();
00834     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00835
00836     CStr path;
00837     RetrievePath(selItem, path);
00838     CvsCmdWatchOnFolder(path);
00839 }

void CWinCvsBrowser::OnViewWatchers ( ) [protected]

Definition at line 871 of file WinCvsBrowser.cpp.

00872 {
00873     CTreeCtrl& treeCtrl = GetTreeCtrl();
00874     HTREEITEM selItem = treeCtrl.GetSelectedItem();
00875
00876     CStr path;
00877     RetrievePath(selItem, path);
00878     CvsCmdWatchersFolder(path);
00879 }

BOOL CWinCvsBrowser::PreCreateWindow ( CREATESTRUCT & cs ) [protected, virtual]

Definition at line 1265 of file WinCvsBrowser.cpp.

01266 {
01267     cs.style |= WS_TABSTOP | TVS_SHOWSELALWAYS;
01268
01269     return CTreeView::PreCreateWindow(cs);
01270 }

void CWinCvsBrowser::ResetBrowser | ( | const char * | path,
 |  | bool | notifyView = false
 | ) |

Definition at line 453 of file WinCvsBrowser.cpp.

Referenced by CMainFrame::ChangeLocation(), CWincvsDoc::OnBrowserOpen(), CMainFrame::OnClose(), and ResetView().

00454 {
00455     CWaitCursor doWait;
00456
00457     // Must make a copy of 'path' before calling DeleteAllItems(), since
00458     // this function may have been called with 'm_root' passed as the first
00459     // parameter (in fact it is in several places in the code) whose value
00460     // gets deleted by the call to DeleteAllItems() below, making 'path'
00461     // point to an invalid memory location
00462     CStr pathCopy(path);
00463     DeleteAllItems();
00464     bool isReload = !pathCopy.empty() && !m_root.empty() && stricmp(m_root, pathCopy) == 0;
00465
00466     m_root = pathCopy;
00467
00468     if(pathCopy.empty())
00469         return;
00470
00471     if(!isReload)
00472     {
00473         if(HasPersistentSettings(m_root))
00474             LoadPersistentSettings(m_root);
00475         else
00476         {
00477             // check if the path has a CVS folder. If not,
00478             // we don't want the user to be prompted (like when
00479             // WinCvs is starting for the first time).
00480             UStr cvsFolder(m_root);
00481             if(!cvsFolder.endsWith(kPathDelimiter))
00482                 cvsFolder << kPathDelimiter;
00483             cvsFolder << "CVS";
00484             struct stat sb;
00485             if (stat(cvsFolder, &sb) != -1 && S_ISDIR(sb.st_mode))
00486                 AskCreatePersistentSettings(m_root);
00487         }
00488     }
00489
00490     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00491     CMainFrame* mainFrm = app->GetMainFrame();
00492     CHistComboBoxEx& hist = mainFrm->GetBrowseHistory();
00493     hist.NewRoot(m_root);
00494
00495     CTreeCtrl& treeCtrl = GetTreeCtrl();
00496     TBrowserFillDummy traverse(treeCtrl, 0L, 0L, 0L);
00497     kTraversal res = FileTraverse(m_root, traverse);
00498
00499     CBrowseFileView *fileView = app->GetFileView();
00500     if(fileView != 0L)
00501     {
00502         HTREEITEM root = treeCtrl.GetRootItem( );
00503         if(root != 0L)
00504         {
00505             treeCtrl.Expand(root, TVE_EXPAND);
00506             if(notifyView)
00507             {
00508                 VERIFY(treeCtrl.Select(root, TVGN_CARET));
00509             }
00510         }
00511     }
00512 }

void CWinCvsBrowser::ResetView | ( | bool | forceReload = false,
 |  | bool | notifyView = false
 | ) |

Definition at line 1154 of file WinCvsBrowser.cpp.

Referenced by OnResetView(), OnViewReload(), and CBrowseFileView::ResetView().

01155 {
01156     // no outstanding request to reset the view any more
01157     m_isResetViewPending = false;
01158
01159     CWaitCursor doWait;
01160     CWndRedrawMngr redrawMngr(this);
01161
01162     bool contentChanged = false;
01163     vector<CStr> allExpanded;
01164     StoreExpanded(allExpanded);
01165     CTreeCtrl& treeCtrl = GetTreeCtrl();
01166     CStr selPath;
01167     HTREEITEM selItem = treeCtrl.GetSelectedItem();
01168     if(selItem != 0L)
01169         RetrievePath(selItem, selPath);
01170
01171     if(forceReload)
01172     {
01173         ResetBrowser(m_root);
01174         contentChanged = true;
01175     }
01176
01177     if(contentChanged)
01178     {
01179         // restore the expanded paths and the selected item
01180         vector<CStr>::const_iterator i;
01181         for(i = allExpanded.begin(); i != allExpanded.end(); ++i)
01182         {
01183             StepToLocation(*i);
01184         }
01185         if(!selPath.empty())
01186         {
01187             selItem = GetItemByLocation(selPath);
01188             if(selItem != 0L)
01189             {
01190                 VERIFY(treeCtrl.Select(selItem, TVGN_CARET));
01191                 treeCtrl.EnsureVisible(selItem);
01192             }
01193         }
01194     }
01195
01196     // we don't need to notify the file view if we force the reload
01197     // because that's already done
01198     if(notifyView)
01199     {
01200         CWincvsApp* app = (CWincvsApp *)AfxGetApp();
01201         app->GetFileView()->ResetView();
01202     }
01203 }

void CWinCvsBrowser::RetrievePath | ( | HTREEITEM | item,
 |  | UStr & | path
 | ) |

Definition at line 527 of file WinCvsBrowser.cpp.

Referenced by NotifySelectionChange(), OnItemexpanding(), OnUpdateCmd(), OnUpdateMacro(), OnViewAdd(), OnViewCommit(), OnViewDiff(), OnViewEdit(), OnViewEditors(), OnViewExplore(), OnViewLock(), OnViewLog(), OnViewQueryUpdate(), OnViewRelease(), OnViewStatus(), OnViewTagBranch(), OnViewTagDelete(), OnViewTagNew(), OnViewUnedit(), OnViewUnlock(), OnViewUpdate(), OnViewWatchOff(), OnViewWatchOn(), OnViewWatchers(), ResetView(), and StoreExpanded().

00528 {
00529     CTreeCtrl& treeCtrl = GetTreeCtrl();
00530     CStr tmp, newPath;
00531     path = "";
00532     TV_ITEM pItem;
00533     char name[512];
00534     do
00535     {
00536         pItem.hItem = item;
00537         pItem.pszText = name;
00538         pItem.cchTextMax = 512;
00539         pItem.mask = TVIF_HANDLE | TVIF_TEXT;
00540
00541         VERIFY(treeCtrl.GetItem(&pItem));
00542         item = treeCtrl.GetParentItem(item);
00543
00544         tmp = path;
00545         newPath = item == 0L ? (const char *)m_root : pItem.pszText;
00546         if(!newPath.endsWith(kPathDelimiter))
00547             newPath << kPathDelimiter;
00548         newPath << path;
00549         path = newPath;
00550     } while(item != 0L);
00551 }

void CWinCvsBrowser::SetNewStyle | ( | long | lStyleMask,
 |  | BOOL | bSetBits
 | ) |

Definition at line 514 of file WinCvsBrowser.cpp.

00515 {
00516     long        lStyleOld;
00517
00518     lStyleOld = GetWindowLong(m_hWnd, GWL_STYLE);
00519     lStyleOld &= ~lStyleMask;
00520     if (bSetBits)
00521         lStyleOld |= lStyleMask;
00522
00523     SetWindowLong(m_hWnd, GWL_STYLE, lStyleOld);
00524     SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
00525 }

bool CWinCvsBrowser::StepToLocation | ( | const char * | path,
 |  | bool | notifyView = false
 | ) |

Definition at line 987 of file WinCvsBrowser.cpp.

Referenced by CWincvsApp::InitInstance(), CMainFrame::OnDropFiles(), ResetView(), and CBrowseFileView::ResetView().

00988 {
00989     bool bRes = false;  //return
00990
00991     CStr root(m_root);
00992     if(!root.endsWith(kPathDelimiter))
00993         root << kPathDelimiter;
00994     CStr subpath(path);
00995     if(!subpath.endsWith(kPathDelimiter))
00996         subpath << kPathDelimiter;
00997
00998     // check if it is a sub-path
00999
01000     //JK - for windows case insensitive seems better
01001     if(strnicmp(root, subpath, root.length()) != 0)
01002         return false;
01003
01004     CTreeCtrl& treeCtrl = GetTreeCtrl();
01005     HTREEITEM item = treeCtrl.GetRootItem();
01006     HTREEITEM lastitem = 0L;
01007     if(item == 0L)
01008         return false;
01009
01010     if (stricmp(root, subpath) == 0)
01011     {
01012         // must select root node
01013         lastitem = item;
01014         treeCtrl.Expand(item, TVE_EXPAND);
01015     }
01016     else
01017     {
01018         // step inside synchronized
01019         const char *tmp = (const char *)subpath + root.length() - 1;
01020         while((tmp = strchr(tmp, kPathDelimiter)) != 0L)
01021         {
01022             const char *name = ++tmp;
01023             if(name[0] == '\0')
01024                 break;
01025
01026             CStr subname;
01027             const char *tmp2 = strchr(name, kPathDelimiter);
01028             if(tmp2 == 0L)
01029                 subname = name;
01030             else
01031                 subname.set(name, tmp2 - name);
01032
01033             HTREEITEM childItem = treeCtrl.GetNextItem(item, TVGN_CHILD);
01034
01035             // find the subitem which matches this name
01036             while(childItem != 0L)
01037             {
01038                 EntnodeData *data = (EntnodeData *)treeCtrl.GetItemData(childItem);
01039                 if(data != 0L)
01040                 {
01041                     if(_stricmp((*data)[EntnodeData::kName], subname) == 0)
01042                     {
01043                         // found it !
01044                         lastitem = item = childItem;
01045                         treeCtrl.Expand(item, TVE_EXPAND);
01046                         break;
01047                     }
01048                 }
01049
01050                 childItem = treeCtrl.GetNextItem(childItem, TVGN_NEXT);
01051             }
01052         }
01053     }
01054
01055     // in case this is called by the view, turn off notifying
01056     // when the item gets selected
01057     // JK - {!= 0} is for: Compiler Warning (level 3) C4800
01058     if(lastitem != 0L)
01059     {
01060         CSelectionChangeNotifier notifier(this, notifyView);
01061         VERIFY( bRes = (treeCtrl.Select(lastitem, TVGN_CARET) != 0) );
01062     }
01063
01064     return bRes;
01065 }

void CWinCvsBrowser::StoreExpanded | ( | std::vector< UStr > & | allExpanded,
 |  | HTREEITEM | root = 0L
 | ) | [protected]

Definition at line 1124 of file WinCvsBrowser.cpp.

Referenced by ResetView().

01125 {
01126     HTREEITEM item = root;
01127     CTreeCtrl& treeCtrl = GetTreeCtrl();
01128     if(item == 0L)
01129         item = treeCtrl.GetRootItem();
01130     if(item == 0L)
01131         return;
01132
01133     TV_ITEM pItem;
01134     pItem.hItem = item;
01135     pItem.mask = TVIF_STATE;
01136     VERIFY(treeCtrl.GetItem(&pItem));
01137
01138     if(pItem.state & TVIS_EXPANDED)
01139     {
01140         CStr path;
01141         RetrievePath(item, path);
01142         allExpanded.push_back(path);
01143     }
01144
01145     HTREEITEM childItem = treeCtrl.GetNextItem(item, TVGN_CHILD);
01146
01147     while(childItem != 0L)
01148     {
01149         StoreExpanded(allExpanded, childItem);
01150         childItem = treeCtrl.GetNextItem(childItem, TVGN_NEXT);
01151     }
01152 }

Member Data Documentation

friend CWinCvsBrowser::CSelectionChangeNotifier

Definition at line 62 of file WinCvsBrowser.h.

CImageList CWinCvsBrowser::m_Imagelist [static, protected]

Definition at line 110 of file WinCvsBrowser.cpp.

bool CWinCvsBrowser::m_isResetViewPending [protected]

Definition at line 78 of file WinCvsBrowser.h.

bool CWinCvsBrowser::m_isSelectionChanged [protected]

Definition at line 74 of file WinCvsBrowser.h.

Referenced by CWinCvsBrowser::CSelectionChangeNotifier::CSelectionChangeNotifier(), and CWinCvsBrowser::CSelectionChangeNotifier::~CSelectionChangeNotifier().

bool CWinCvsBrowser::m_isSelectionNotificationLocked [protected]

Definition at line 71 of file WinCvsBrowser.h.

Referenced by CWinCvsBrowser::CSelectionChangeNotifier::CSelectionChangeNotifier(), and CWinCvsBrowser::CSelectionChangeNotifier::~CSelectionChangeNotifier().

UStr CWinCvsBrowser::m_root [protected]

Definition at line 127 of file WinCvsBrowser.h.

The documentation for this class was generated from the following files:
  • WinCvs/WinCvsBrowser.h
  • WinCvs/WinCvsBrowser.cpp
Generated on Sun Oct 21 12:51:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWinCvsBrowser::CSelectionChangeNotifier Class Reference

#include <WinCvsBrowser.h>

Collaboration diagram for CWinCvsBrowser::CSelectionChangeNotifier:

[legend]
List of all members.

Public Methods

CSelectionChangeNotifier (CWinCvsBrowser *view, bool notify)
~CSelectionChangeNotifier ()

Protected Attributes

bool | m_notify
bool | m_wasLocked
CWinCvsBrowser * m_view

Constructor & Destructor Documentation

CWinCvsBrowser::CSelectionChangeNotifier::CSelectionChangeNotifier | ( | CWinCvsBrowser * | view,
 |  | bool | notify
 | ) | [inline]

Definition at line 37 of file WinCvsBrowser.h.

00038         : m_notify(notify)
00039         , m_view(view)
00040         , m_wasLocked(view->m_isSelectionNotificationLocked)
00041         {
00042             if (!m_wasLocked)
00043             {
00044                 m_view->m_isSelectionChanged = false;
00045                 m_view->m_isSelectionNotificationLocked = true;
00046             }
00047         }

CWinCvsBrowser::CSelectionChangeNotifier::~CSelectionChangeNotifier ( ) [inline]

Definition at line 49 of file WinCvsBrowser.h.

00050         {
00051             m_view->m_isSelectionNotificationLocked = m_wasLocked;
00052             if (!m_wasLocked)
00053             {
00054                 if (m_notify)
00055                 {
00056                     m_view->NotifySelectionChange();
00057                 }
00058                 m_view->m_isSelectionChanged = false;
00059             }
00060         }

Member Data Documentation

bool CWinCvsBrowser::CSelectionChangeNotifier::m_notify [protected]

Definition at line 25 of file WinCvsBrowser.h.

CWinCvsBrowser* CWinCvsBrowser::CSelectionChangeNotifier::m_view [protected]

Definition at line 31 of file WinCvsBrowser.h.

bool CWinCvsBrowser::CSelectionChangeNotifier::m_wasLocked [protected]

Definition at line 28 of file WinCvsBrowser.h.

The documentation for this class was generated from the following file:
  • WinCvs/WinCvsBrowser.h
Generated on Sun Oct 21 12:51:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWincvsDoc Class Reference

#include <wincvsDoc.h>

Inheritance diagram for CWincvsDoc:

[legend]
Collaboration diagram for CWincvsDoc:

[legend]
List of all members.

Public Methods

CWincvsDoc ()
virtual BOOL | OnNewDocument ()
virtual void | Serialize (CArchive &ar)
virtual | ~CWincvsDoc ()

Protected Methods

afx_msg void | OnAppPreferences ()
afx_msg void | OnAppRtagNew ()
afx_msg void | OnAppRtagDelete ()
afx_msg void | OnAppRtagBranch ()
afx_msg void | OnAppCmdline ()
afx_msg void | OnUpdateCvsCmd (CCmdUI *pCmdUI)
afx_msg void | OnUpdatePrefs (CCmdUI *pCmdUI)
afx_msg void | OnStopcvs ()
afx_msg void | OnUpdateStopcvs (CCmdUI *pCmdUI)
afx_msg void | OnBrowserOpen ()
afx_msg void | OnAppLogin ()
afx_msg BOOL | OnMacroAdmin (UINT nID)
afx_msg void | OnUpdateMacroAdmin (CCmdUI *pCmdUI)
afx_msg void | OnAppLogout ()
afx_msg void | OnViewInit ()
afx_msg void | OnSavesettings ()
afx_msg void | OnUpdateSavesettings (CCmdUI *pCmdUI)
afx_msg void | OnViewBrowselocationRemoveunwanted ()
afx_msg void | OnUsePyshell ()
afx_msg void | OnUpdateUsePyshell (CCmdUI *pCmdUI)
afx_msg void | OnUseTclshell ()
afx_msg void | OnUpdateUseTclshell (CCmdUI *pCmdUI)
afx_msg void | OnViewPathChanged ()

Protected Attributes

CString | m_viewPath

Constructor & Destructor Documentation

CWincvsDoc::CWincvsDoc ( )

Definition at line 112 of file wincvsDoc.cpp.

00113 {
00114     // Use OLE compound files
00115     //EnableCompoundFile();
00116
00117     // TODO: add one-time construction code here
00118
00119     //EnableAutomation();
00120
00121     //AfxOleLockApp();
00122 }

CWincvsDoc::~CWincvsDoc ( ) [virtual]

Definition at line 124 of file wincvsDoc.cpp.

00125 {
00126     //AfxOleUnlockApp();
00127 }

Member Function Documentation

void CWincvsDoc::OnAppCmdline ( ) [protected]

Definition at line 240 of file wincvsDoc.cpp.

00241 {
00242     CvsCmdLine();
00243 }

void CWincvsDoc::OnAppLogin ( ) [protected]

Definition at line 245 of file wincvsDoc.cpp.

00246 {
00247     CvsCmdLogin();
00248 }

void CWincvsDoc::OnAppLogout ( ) [protected]

Definition at line 345 of file wincvsDoc.cpp.

00346 {
00347     CvsCmdLogout();
00348 }

void CWincvsDoc::OnAppPreferences ( ) [protected]

Definition at line 235 of file wincvsDoc.cpp.

00236 {
00237     CompatGetPrefs();
00238 }

void CWincvsDoc::OnAppRtagBranch ( ) [protected]

Definition at line 303 of file wincvsDoc.cpp.

00304 {
00305     CvsCmdRtagBranch();
00306 }

void CWincvsDoc::OnAppRtagDelete ( ) [protected]

Definition at line 298 of file wincvsDoc.cpp.

00299 {
00300     CvsCmdRtagDelete();
00301 }

void CWincvsDoc::OnAppRtagNew ( ) [protected]

Definition at line 293 of file wincvsDoc.cpp.

00294 {
00295     CvsCmdRtagCreate();
00296 }

void CWincvsDoc::OnBrowserOpen ( ) [protected]

Definition at line 276 of file wincvsDoc.cpp.

00277 {
00278     const char *newPath =
00279         BrowserGetDirectory("Select a folder to open with the browser");
00280     if(newPath == 0L)
00281         return;
00282
00283     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00284     app->GetBrowserView()->ResetBrowser(newPath, true);
00285 }

BOOL CWincvsDoc::OnMacroAdmin ( UINT nID ) [protected]

Definition at line 308 of file wincvsDoc.cpp.

00309 {
00310     CMacroEntry & entry = gMacrosAdmin.entries[nID - ID_MACRO_ADMIN];
00311     CvsCmdMacrosAdmin(entry.path);
00312
00313     return 1;
00314 }

BOOL CWincvsDoc::OnNewDocument ( ) [virtual]

Definition at line 134 of file wincvsDoc.cpp.

00135 {
00136     if (!CDocument::OnNewDocument())
00137         return FALSE;
00138
00139     return TRUE;
00140 }

void CWincvsDoc::OnSavesettings ( ) [protected]

Definition at line 355 of file wincvsDoc.cpp.

00356 {
00357     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00358     AskCreatePersistentSettings(app->GetBrowserView()->GetRoot());
00359 }

void CWincvsDoc::OnStopcvs ( ) [protected]

Definition at line 262 of file wincvsDoc.cpp.

00263 {
00264     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00265     app->gCvsStopping = true;
00266     cvs_process_kill(app->gCvsProcess);
00267     cvs_out("*****CVS stopped on user request !!! *****\n\n");
00268 }

void CWincvsDoc::OnUpdateCvsCmd ( CCmdUI * pCmdUI ) [protected]

Definition at line 250 of file wincvsDoc.cpp.

00251 {
00252     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00253     pCmdUI->Enable(app->gCvsRunning || gCvsPrefs.empty() ? FALSE : TRUE);
00254 }

void CWincvsDoc::OnUpdateMacroAdmin ( CCmdUI * pCmdUI ) [protected]

Definition at line 316 of file wincvsDoc.cpp.

00317 {
00318     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00319     if(app->gCvsRunning || gCvsPrefs.empty() || !CTcl_Interp::IsAvail())
00320     {
00321         pCmdUI->Enable(FALSE);
00322         return;
00323     }
00324
00325     if(pCmdUI->m_pSubMenu != 0L || pCmdUI->m_pMenu == 0L)
00326         return;
00327
00328     int iMRUMax = pCmdUI->m_pMenu->GetMenuItemCount();
00329     for (int iMRU = 0; iMRU < iMRUMax; iMRU++)
00330         pCmdUI->m_pMenu->DeleteMenu(pCmdUI->m_nID + iMRU, MF_BYCOMMAND);
00331
00332     vector<CMacroEntry>::const_iterator i;
00333     for(i = gMacrosAdmin.entries.begin(); i != gMacrosAdmin.entries.end(); ++i)
00334     {
00335         pCmdUI->m_pMenu->InsertMenu(pCmdUI->m_nIndex++,
00336             MF_STRING | MF_BYPOSITION, pCmdUI->m_nID++,
00337             (*i).name);
00338     }
00339
00340     pCmdUI->m_nIndexMax = pCmdUI->m_pMenu->GetMenuItemCount();
00341     pCmdUI->m_nIndex--; // point to last menu added
00342     pCmdUI->m_bEnableChanged = TRUE;    // all the added items are enabled
00343 }

void CWincvsDoc::OnUpdatePrefs ( CCmdUI * pCmdUI ) [protected]

Definition at line 256 of file wincvsDoc.cpp.

00257 {
00258     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00259     pCmdUI->Enable(app->gCvsRunning ? FALSE : TRUE);
00260 }

void CWincvsDoc::OnUpdateSavesettings ( CCmdUI * pCmdUI ) [protected]

Definition at line 361 of file wincvsDoc.cpp.

00362 {
00363     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00364     pCmdUI->Enable(!app->gCvsRunning && !gCvsPrefs.empty());
00365 }

void CWincvsDoc::OnUpdateStopcvs ( CCmdUI * pCmdUI ) [protected]

Definition at line 270 of file wincvsDoc.cpp.

00271 {
00272     CWincvsApp* app = (CWincvsApp *)AfxGetApp();
00273     pCmdUI->Enable(app->gCvsRunning && !app->gCvsStopping ? TRUE : FALSE);
00274 }

void CWincvsDoc::OnUpdateUsePyshell ( CCmdUI * pCmdUI ) [protected]

Definition at line 378 of file wincvsDoc.cpp.

00379 {
00380     pCmdUI->Enable(CPython_Interp::IsAvail());
00381     pCmdUI->SetRadio(gCvsPrefs.GetUseShell() == SHELL_PYTHON);
00382 }

void CWincvsDoc::OnUpdateUseTclshell ( CCmdUI * pCmdUI ) [protected]

Definition at line 390 of file wincvsDoc.cpp.

00391 {
00392     pCmdUI->Enable(CTcl_Interp::IsAvail());
00393     pCmdUI->SetRadio(gCvsPrefs.GetUseShell() == SHELL_TCL);
00394 }

void CWincvsDoc::OnUsePyshell ( ) [protected]

Definition at line 372 of file wincvsDoc.cpp.

00373 {
00374     gCvsPrefs.SetUseShell(SHELL_PYTHON);
00375     cvs_out("Switching the shell to Python...\n");
00376 }

void CWincvsDoc::OnUseTclshell ( ) [protected]

Definition at line 384 of file wincvsDoc.cpp.

00385 {
00386     gCvsPrefs.SetUseShell(SHELL_TCL);
00387     cvs_out("Switching the shell to TCL...\n");
00388 }

void CWincvsDoc::OnViewBrowselocationRemoveunwanted ( ) [protected]

Definition at line 367 of file wincvsDoc.cpp.

00368 {
00369     AfxMessageBox("To remove the unwanted location history items click DEL key when selecting from the combo box list.", MB_OK | MB_ICONINFORMATION);
00370 }

void CWincvsDoc::OnViewInit ( ) [protected]

Definition at line 350 of file wincvsDoc.cpp.

00351 {
00352     CvsCmdInit();
00353 }

void CWincvsDoc::OnViewPathChanged ( ) [protected]

Definition at line 287 of file wincvsDoc.cpp.

00288 {
00289     // TODO: Add notification handler code
00290
00291 }

void CWincvsDoc::Serialize ( CArchive & ar ) [virtual]

Definition at line 186 of file wincvsDoc.cpp.

00187 {
00188     if (ar.IsStoring())
00189     {
00190         POSITION pos = GetFirstViewPosition();
00191         CView* view;
00192         while((view = GetNextView(pos)) != NULL)
00193         {
00194             if(view->IsKindOf(RUNTIME_CLASS(CRichEditView)))
00195             {
00196                 int nFormat = SF_TEXT;
00197                 EDITSTREAM es = {0, 0, (EDITSTREAMCALLBACK)EditStreamCallBack};
00198                 _afxRichEditCookie cookie(ar);
00199                 es.dwCookie = (DWORD)&cookie;
00200                 ((CRichEditView *)view)->GetRichEditCtrl().StreamOut(nFormat, es);
00201                 break;
00202             }
00203         }
00204     }
00205     else
00206     {
00207         // We don't load right now
00208     }
00209
00210     // Calling the base class CDocument enables serialization
00211     //  of the container document's COleClientItem objects.
00212     // (but we don't have COleClientItem)
00213     CDocument::Serialize(ar);
00214 }

Member Data Documentation

CString CWincvsDoc::m_viewPath [protected]

Definition at line 93 of file wincvsDoc.h.

The documentation for this class was generated from the following files:
  • WinCvs/wincvsDoc.h
  • WinCvs/wincvsDoc.cpp
Generated on Sun Oct 21 12:51:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWincvsView Class Reference

#include <wincvsView.h>

Inheritance diagram for CWincvsView:

[legend]
Collaboration diagram for CWincvsView:

[legend]
List of all members.

Public Methods

CWincvsDoc * GetDocument ()
void | OutConsole (const char *txt, long len, bool isStderr=false)
void | OutColor (const char *txt, long len)
void | OutColor (kConsoleColor color)
void | OutColor (CHARFORMAT &format)
CHARFORMAT | GetCurFormat (bool jumpEnd=true)
BOOL | CanPaste () const
virtual void | OnDraw (CDC *pDC)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
virtual | ~CWincvsView ()

Protected Methods

CWincvsView ()
virtual void | OnInitialUpdate ()
virtual BOOL | OnPreparePrinting (CPrintInfo *pInfo)
virtual void | OnBeginPrinting (CDC *pDC, CPrintInfo *pInfo)
virtual void | OnEndPrinting (CDC *pDC, CPrintInfo *pInfo)
virtual BOOL | IsSelected (const CObject *pDocItem) const
void | FeedThisLine (const char *buf, int numbuf, bool isStderr)
virtual HRESULT | QueryAcceptData (LPDATAOBJECT, CLIPFORMAT *, DWORD, BOOL, HGLOBAL)
afx_msg void | OnDestroy ()
afx_msg void | OnSetFocus (CWnd *pOldWnd)
afx_msg void | OnSize (UINT nType, int cx, int cy)
afx_msg void | OnMyFormatFont ()
afx_msg void | OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg void | OnDropFiles (HDROP hDropInfo)
afx_msg void | OnEditClearAll ()
afx_msg void | OnRButtonDown (UINT nFlags, CPoint point)
afx_msg UINT | OnGetDlgCode ()

Protected Attributes

UINT | fRtfFormat

Static Protected Attributes

char * | sbuf = 0L
int | snumbuf = 0

Constructor & Destructor Documentation

CWincvsView::CWincvsView ( ) [protected]

Definition at line 109 of file wincvsView.cpp.

00110 {
00111     fRtfFormat = ::RegisterClipboardFormat(_T("Rich Text Format"));
00112 }

CWincvsView::~CWincvsView ( ) [virtual]

Definition at line 114 of file wincvsView.cpp.

00115 {
00116     snumbuf = 0;
00117     if(sbuf != 0L)
00118     {
00119         free(sbuf);
00120         sbuf = 0L;
00121     }
00122     PyInvalUICache();
00123     CPython_Interp::ClosePythonSupport();
00124 }

Member Function Documentation

BOOL CWincvsView::CanPaste ( ) const

Definition at line 604 of file wincvsView.cpp.

00605 {
00606     return (CountClipboardFormats() != 0) &&
00607         (IsClipboardFormatAvailable(CF_TEXT) ||
00608         IsClipboardFormatAvailable(fRtfFormat) ||
00609         //IsClipboardFormatAvailable(_oleData.cfEmbedSource) ||
00610         //IsClipboardFormatAvailable(_oleData.cfEmbeddedObject) ||
00611         //IsClipboardFormatAvailable(_oleData.cfFileName) ||
00612         //IsClipboardFormatAvailable(_oleData.cfFileNameW) ||
00613         //IsClipboardFormatAvailable(CF_METAFILEPICT) ||
00614         //IsClipboardFormatAvailable(CF_DIB) ||
00615         //IsClipboardFormatAvailable(CF_BITMAP) ||
00616         GetRichEditCtrl().CanPaste());
00617 }

void CWincvsView::FeedThisLine | ( | const char * | buf,
 |  | int | numbuf,
 |  | bool | isStderr
 | ) | [protected]

Definition at line 269 of file wincvsView.cpp.

Referenced by OutConsole().

00270 {
00271     CRichEditCtrl& edit = GetRichEditCtrl();
00272     edit.SetSel(-1, -1);
00273
00274     CHARFORMAT cf;
00275     cf.cbSize = sizeof(CHARFORMAT);
00276     cf = GetCharFormatSelection();
00277
00278     bool colorChanged = false;
00279     COLORREF oldColor = cf.crTextColor;
00280     DWORD oldEffect = cf.dwEffects;
00281     CString s(buf, numbuf);
00282
00283     if(s.GetLength() >= 5 && s[1] == ' ' &&
00284         (s[0] == 'M' || s[0] == 'C' || s[0] == 'U' ||
00285         s[0] == 'P' || s[0] == 'N' || s[0] == 'A' ||
00286         s[0] == 'R' || s[0] == 'I' || s[0] == '?' ||
00287         s[0] == '<' || s[0] == '>'))
00288     {
00289         colorChanged = true;
00290         switch(s[0])
00291         {
00292         default:
00293         case '?' :
00294         case 'I' :
00295             cf.crTextColor = RGB(0x80, 0x80, 0x00);
00296             break;
00297         case 'U' :
00298         case 'N' :
00299             cf.crTextColor = RGB(0x00, 0xA0, 0x00);
00300             break;
00301         case 'M' :
00302         case 'A' :
00303         case 'R' :
00304             cf.crTextColor = RGB(0xFF, 0x00, 0xFF);
00305             break;
00306         case 'C' :
00307         case '<' :
00308             cf.crTextColor = RGB(0xFF, 0x00, 0x00);
00309             break;
00310         case '>' :
00311         case 'P' :
00312             cf.crTextColor = RGB(0x00, 0x00, 0xFF);
00313             break;
00314         }
00315         cf.dwMask = CFM_COLOR;
00316         cf.dwEffects = 0;
00317         SetCharFormat(cf);
00318     }
00319     else if(isStderr)
00320     {
00321         colorChanged = true;
00322         cf.crTextColor = RGB(0xFF, 0x80, 0x00);
00323         cf.dwMask = CFM_COLOR;
00324         cf.dwEffects = 0;
00325         SetCharFormat(cf);
00326     }
00327
00328     edit.ReplaceSel(s);
00329
00330     if(colorChanged)
00331     {
00332         cf.dwMask = CFM_COLOR;
00333         cf.crTextColor = oldColor;
00334         cf.dwEffects = oldEffect;
00335         SetCharFormat(cf);
00336     }
00337 }

CHARFORMAT CWincvsView::GetCurFormat ( bool jumpEnd = true )

Definition at line 339 of file wincvsView.cpp.

Referenced by CColorConsole::CColorConsole(), and OutColor().

00340 {
00341     CRichEditCtrl& edit = GetRichEditCtrl();
00342     if(jumpEnd)
00343         edit.SetSel(-1, -1);
00344
00345     CHARFORMAT cf;
00346     cf.cbSize = sizeof(CHARFORMAT);
00347     return GetCharFormatSelection();
00348 }

CWincvsDoc * CWincvsView::GetDocument ( void ) [inline]

Definition at line 128 of file wincvsView.h.

00129    { return (CWincvsDoc*)m_pDocument; }

BOOL CWincvsView::IsSelected ( const CObject * pDocItem ) const [protected, virtual]

Definition at line 213 of file wincvsView.cpp.

00214 {
00215     // The implementation below is adequate if your selection consists of
00216     //  only CWincvsCntrItem objects.  To handle different selection
00217     //  mechanisms, the implementation here should be replaced.
00218
00219     // TODO: implement this function that tests for a selected OLE client item
00220
00221     //return pDocItem == m_pSelection;
00222     return CRichEditView::IsSelected(pDocItem);
00223 }

void CWincvsView::OnBeginPrinting | ( | CDC * | pDC,
 |  | CPrintInfo * | pInfo
 | ) | [protected, virtual]

Definition at line 184 of file wincvsView.cpp.

00185 {
00186     // TODO: add extra initialization before printing
00187     CRichEditView::OnBeginPrinting(pDC, pInfo);
00188 }

void CWincvsView::OnDestroy ( void ) [protected]

Definition at line 196 of file wincvsView.cpp.

00197 {
00198     // Deactivate the item on destruction; this is important
00199     // when a splitter view is being used.
00200     CRichEditView::OnDestroy();
00201     //COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
00202     //if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
00203     //{
00204     //  pActiveItem->Deactivate();
00205     //  ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
00206     //}
00207 }

void CWincvsView::OnDraw ( CDC * pDC ) [virtual]

Definition at line 139 of file wincvsView.cpp.

00140 {
00141     //CWincvsDoc* pDoc = GetDocument();
00142     //ASSERT_VALID(pDoc);
00143
00144     // TODO: add draw code for native data here
00145     // TODO: also draw all OLE items in the document
00146
00147     // Draw the selection at an arbitrary position.  This code should be
00148     //  removed once your real drawing code is implemented.  This position
00149     //  corresponds exactly to the rectangle returned by CWincvsCntrItem,
00150     //  to give the effect of in-place editing.
00151
00152     // TODO: remove this code when final draw code is complete.
00153
00154     //if (m_pSelection == NULL)
00155     //{
00156     //  POSITION pos = pDoc->GetStartPosition();
00157     //  m_pSelection = (CWincvsCntrItem*)pDoc->GetNextClientItem(pos);
00158     //}
00159     //if (m_pSelection != NULL)
00160     //  m_pSelection->Draw(pDC, CRect(10, 10, 210, 210));
00161 }

void CWincvsView::OnDropFiles ( HDROP hDropInfo ) [protected]

Definition at line 619 of file wincvsView.cpp.

00620 {
00621     CWnd* pWnd = AfxGetMainWnd();   //look in InitInstance m_pMainWnd = m_mainFrame;
00622
00623     if( pWnd )
00624     {
00625         CMainFrame* pMainFrame = (CMainFrame*)pWnd;
00626
00627         if( pMainFrame->GetSafeHwnd() != NULL )
00628         {
00629             pMainFrame->DropFiles( hDropInfo );
00630         }
00631     }
00632
00633     //this cause the crash, remove
00634     //CRichEditView::OnDropFiles(hDropInfo);
00635 }

void CWincvsView::OnEditClearAll ( ) [protected]

Definition at line 637 of file wincvsView.cpp.

00638 {
00639     CRichEditCtrl& edit = GetRichEditCtrl();
00640     edit.SetSel(0, -1);
00641     edit.ReplaceSel("", TRUE);
00642 }

void CWincvsView::OnEndPrinting | ( | CDC * | pDC,
 |  | CPrintInfo * | pInfo
 | ) | [protected, virtual]

Definition at line 190 of file wincvsView.cpp.

00191 {
00192     // TODO: add cleanup after printing
00193     CRichEditView::OnEndPrinting(pDC, pInfo);
00194 }

UINT CWincvsView::OnGetDlgCode ( ) [protected]

Definition at line 655 of file wincvsView.cpp.

00656 {
00657     LRESULT DlgCode;
00658     DlgCode = CRichEditView::OnGetDlgCode();
00659     if (0x8000 & GetKeyState(VK_TAB))
00660         return  DlgCode & ~(DLGC_WANTTAB | DLGC_WANTALLKEYS | DLGC_WANTCHARS);
00661     else
00662         return DlgCode;
00663 }

void CWincvsView::OnInitialUpdate ( ) [protected, virtual]

Definition at line 163 of file wincvsView.cpp.

00164 {
00165     CRichEditView::OnInitialUpdate();
00166
00167     CRichEditCtrl& edit = GetRichEditCtrl();
00168     edit.SetSel(0, -1);
00169     SetCharFormat((CCharFormat)gViewFont);
00170     edit.SetSel(-1, -1);
00171
00172     CPython_Interp::InitPythonSupport();
00173 }

void CWincvsView::OnKeyDown | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags
 | ) | [protected]

Definition at line 513 of file wincvsView.cpp.

00514 {
00515     CRichEditView::OnKeyDown(nChar, nRepCnt, nFlags);
00516
00517     if(nChar != VK_RETURN)
00518     {
00519         return;
00520     }
00521
00522     long len = GetTextLength();
00523     if(len == 0)
00524         return;
00525
00526     TCHAR *buf = (char *)malloc((len + 1) * sizeof(TCHAR));
00527     if(buf == 0L)
00528         return;
00529
00530     TEXTRANGE textRange;
00531     textRange.chrg.cpMin = 0;
00532     textRange.chrg.cpMax = len;
00533     textRange.lpstrText = buf;
00534     GetRichEditCtrl().SendMessage(EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
00535
00536     long nStartChar, nEndChar;
00537     GetRichEditCtrl().GetSel(nStartChar, nEndChar);
00538
00539     if (nStartChar == nEndChar) // i.e. there is no selection
00540     {
00541         // get the end and the beginning of the line
00542         if(nStartChar > 0 && buf[nStartChar] == '\r')
00543             nStartChar--;
00544         while(nStartChar > 0 && buf[nStartChar] != '\n' && buf[nStartChar] != '\r')
00545             nStartChar--;
00546         if(buf[nStartChar] == '\n' || buf[nStartChar] == '\r')
00547             nStartChar++;
00548         while(nEndChar < len && buf[nEndChar] != '\n' && buf[nEndChar] != '\r')
00549             nEndChar++;
00550     }
00551
00552     long length = nEndChar - nStartChar;
00553     if(length > 0 && nStartChar < len)
00554     {
00555         OutConsole("\n", 1);
00556         buf[nEndChar] = '\0';
00557         if(gCvsPrefs.GetUseShell() == SHELL_PYTHON && CPython_Interp::IsAvail())
00558         {
00559             CPython_Interp interp;
00560             interp.DoScript(buf + nStartChar);
00561         }
00562         else if(gCvsPrefs.GetUseShell() == SHELL_TCL && CTcl_Interp::IsAvail())
00563         {
00564             CTcl_Interp interp;
00565             interp.DoScript(buf + nStartChar);
00566         }
00567     }
00568
00569     free(buf);
00570 }

void CWincvsView::OnMyFormatFont ( ) [protected]

Definition at line 503 of file wincvsView.cpp.

00504 {
00505     CRichEditCtrl& edit = GetRichEditCtrl();
00506     edit.SetSel(0, -1);
00507     CRichEditView::OnFormatFont();
00508     edit.SetSel(-1, -1);
00509     gViewFont = CCharFormat(GetCharFormatSelection());
00510     gCvsPrefs.save();
00511 }

BOOL CWincvsView::OnPreparePrinting ( CPrintInfo * pInfo ) [protected, virtual]

Definition at line 178 of file wincvsView.cpp.

00179 {
00180     return DoPreparePrinting(pInfo);
00181     //return CRichEditView::OnPreparePrinting(pInfo);
00182 }

void CWincvsView::OnRButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) | [protected]

Definition at line 644 of file wincvsView.cpp.

00645 {
00646     CWincvsApp* pApp=static_cast<CWincvsApp*>(AfxGetApp());
00647     CMenu* pSubMenu=::GetSubCMenu(ID_EDIT_UNDO,this);
00648     if (pSubMenu) {
00649         ClientToScreen(&point);
00650         pSubMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x, point.y, this);
00651     }
00652 //  CRichEditView::OnRButtonDown(nFlags, point);
00653 }

void CWincvsView::OnSetFocus ( CWnd * pOldWnd ) [protected]

Definition at line 243 of file wincvsView.cpp.

00244 {
00245 //  COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
00246 //  if (pActiveItem != NULL &&
00247 //      pActiveItem->GetItemState() == COleClientItem::activeUIState)
00248 //  {
00249         // need to set focus to this item if it is in the same view
00250 //      CWnd* pWnd = pActiveItem->GetInPlaceWindow();
00251 //      if (pWnd != NULL)
00252 //      {
00253 //          pWnd->SetFocus();   // don't call the base class
00254 //          return;
00255 //      }
00256 //  }
00257
00258     CRichEditView::OnSetFocus(pOldWnd);
00259 }

void CWincvsView::OnSize | ( | UINT | nType,
 |  | int | cx,
 |  | int | cy
 | ) | [protected]

Definition at line 261 of file wincvsView.cpp.

00262 {
00263     CRichEditView::OnSize(nType, cx, cy);
00264 //  COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
00265 //  if (pActiveItem != NULL)
00266 //      pActiveItem->SetItemRects();
00267 }

void CWincvsView::OutColor ( CHARFORMAT & format )

Definition at line 426 of file wincvsView.cpp.

00427 {
00428     CCvsThreadLock threadLock;
00429
00430     CRichEditCtrl& edit = GetRichEditCtrl();
00431     SetCharFormat(format);
00432 }

void CWincvsView::OutColor ( kConsoleColor color )

Definition at line 375 of file wincvsView.cpp.

00376 {
00377     CCvsThreadLock threadLock;
00378
00379     CRichEditCtrl& edit = GetRichEditCtrl();
00380
00381     CHARFORMAT cf = GetCurFormat(false);
00382     cf.dwEffects = 0;
00383
00384     switch(color)
00385     {
00386         default:
00387             return;
00388             break;
00389         case kBrown :
00390             cf.dwMask = CFM_COLOR;
00391             cf.crTextColor = RGB(0x80, 0x80, 0x00);
00392             break;
00393         case kGreen :
00394             cf.dwMask = CFM_COLOR;
00395             cf.crTextColor = RGB(0x00, 0xA0, 0x00);
00396             break;
00397         case kMagenta :
00398             cf.dwMask = CFM_COLOR;
00399             cf.crTextColor = RGB(0xFF, 0x00, 0xFF);
00400             break;
00401         case kRed :
00402             cf.dwMask = CFM_COLOR;
00403             cf.crTextColor = RGB(0xFF, 0x00, 0x00);
00404             break;
00405         case kBlue :
00406             cf.dwMask = CFM_COLOR;
00407             cf.crTextColor = RGB(0x00, 0x00, 0xFF);
00408             break;
00409         case kBold :
00410             cf.dwMask = CFM_BOLD;
00411             cf.dwEffects = CFE_BOLD;
00412             break;
00413         case kItalic :
00414             cf.dwMask = CFM_ITALIC;
00415             cf.dwEffects = CFE_ITALIC;
00416             break;
00417         case kUnderline :
00418             cf.dwMask = CFM_UNDERLINE;
00419             cf.dwEffects = CFE_UNDERLINE;
00420             break;
00421     }
00422
00423     SetCharFormat(cf);
00424 }

void CWincvsView::OutColor | ( | const char * | txt,
 |  | long | len
 | ) |

Definition at line 350 of file wincvsView.cpp.

Referenced by CColorConsole::operator<<().

00351 {
00352     // synchonize it since the thread calls it
00353     CCvsThreadLock threadLock;
00354
00355     CString s;
00356     for(int i = 0; i < len; i++)
00357     {
00358         char c = *txt++;
00359         if(c == 0x0d || c == 0x0a)
00360         {
00361             s += (char)0x0d;
00362             s += (char)0x0a;
00363             // special case if we got already \r\n
00364             if((i+1) < len && c == 0x0d && txt[0] == 0x0a)
00365                 i++;
00366         }
00367         else
00368             s += c;
00369     }
00370
00371     CRichEditCtrl& edit = GetRichEditCtrl();
00372     edit.ReplaceSel(s);
00373 }

void CWincvsView::OutConsole | ( | const char * | txt,
 |  | long | len,
 |  | bool | isStderr = false
 | ) |

Definition at line 434 of file wincvsView.cpp.

Referenced by OnKeyDown(), cvs_err(), cvs_errstr(), cvs_out(), and cvs_outstr().

00435 {
00436     // synchonize it since the thread calls it
00437     CCvsThreadLock threadLock;
00438
00439     if(len == 0)
00440         return;
00441
00442     if(sbuf == 0L)
00443     {
00444         sbuf = (char *)malloc((MAX_CHAR_BY_LINE + 3) * sizeof(char));
00445         if(sbuf == 0L)
00446             return;
00447     }
00448
00449     int i = 0;
00450     char c;
00451 once_again:
00452     for(; i < len && snumbuf < MAX_CHAR_BY_LINE; snumbuf++)
00453     {
00454         c = txt[i++];
00455         if(c == 0x0d || c == 0x0a)
00456             break;
00457         sbuf[snumbuf] = c;
00458     }
00459
00460     // special case if we got already \r\n
00461     if(i < len && c == 0x0d && txt[i] == 0x0a)
00462         i++;
00463
00464     if(c == 0x0d || c == 0x0a || snumbuf == MAX_CHAR_BY_LINE)
00465     {
00466         sbuf[snumbuf++] = 0x0d;
00467         sbuf[snumbuf++] = 0x0a;
00468         sbuf[snumbuf++] = 0x00;
00469
00470         FeedThisLine(sbuf, snumbuf, isStderr);
00471         snumbuf = 0;
00472     }
00473
00474     if(i != len)
00475         goto once_again;
00476 }

BOOL CWincvsView::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]

Definition at line 126 of file wincvsView.cpp.

00127 {
00128     // TODO: Modify the Window class or styles here by modifying
00129     //  the CREATESTRUCT cs
00130
00131     BOOL bRet = CRichEditView::PreCreateWindow(cs);
00132     cs.style |= WS_TABSTOP | ES_MULTILINE;
00133     return  bRet;
00134 }

HRESULT CWincvsView::QueryAcceptData | ( | LPDATAOBJECT | lpdataobj,
 |  | CLIPFORMAT * | lpcfFormat,
 |  | DWORD | dwReco,
 |  | BOOL | bReally,
 |  | HGLOBAL | hMetaPict
 | ) | [protected, virtual]

Definition at line 572 of file wincvsView.cpp.

00574 {
00575     ASSERT(lpcfFormat != NULL);
00576     if (!bReally) // not actually pasting
00577         return S_OK;
00578     // if direct pasting a particular native format allow it
00579     if (IsRichEditFormat(*lpcfFormat))
00580         return S_OK;
00581
00582     COleDataObject dataobj;
00583     dataobj.Attach(lpdataobj, FALSE);
00584     // if format is 0, then force particular formats if available
00585     if (*lpcfFormat == 0 && (m_nPasteType == 0))
00586     {
00587         if (fRtfFormat != 0 && dataobj.IsDataAvailable(fRtfFormat)) // native avail, let richedit do as it wants
00588         {
00589             *lpcfFormat = fRtfFormat;
00590             return S_OK;
00591         }
00592         else if (dataobj.IsDataAvailable(CF_TEXT))
00593         {
00594             *lpcfFormat = CF_TEXT;
00595             return S_OK;
00596         }
00597     }
00598     // *DO NOT* paste OLE formats
00599     // crash reported by Gerhard Möller
00600     //DoPaste(dataobj, *lpcfFormat, hMetaPict);
00601     return S_FALSE;
00602 }

Member Data Documentation

UINT CWincvsView::fRtfFormat [protected]

Definition at line 104 of file wincvsView.h.

char * CWincvsView::sbuf = 0L [static, protected]

Definition at line 106 of file wincvsView.cpp.

int CWincvsView::snumbuf = 0 [static, protected]

Definition at line 107 of file wincvsView.cpp.

The documentation for this class was generated from the following files:
  • WinCvs/wincvsView.h
  • WinCvs/wincvsView.cpp
Generated on Sun Oct 21 12:51:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WINDOWPLACEMENT Class Reference

Inheritance diagram for WINDOWPLACEMENT:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/CJWindowPlacement.h
Generated on Sun Oct 21 12:51:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WININFO Class Reference

Collaboration diagram for WININFO:

[legend]
List of all members.

Public Methods

WININFO (int w, int h)
virtual | ~WININFO ()
std::vector< TbEntry *>::iterator | Search (int cmd, int *dropindex=0L)

Public Attributes

std::vector< TbEntry *> entries
int | width
int | height

Constructor & Destructor Documentation

WININFO::WININFO | ( | int | w,
 |  | int | h
 | ) | [inline]

Definition at line 241 of file utoolbar.cpp.

00241 : width(w), height(h) {}

virtual WININFO::~WININFO ( ) [inline, virtual]

Definition at line 242 of file utoolbar.cpp.

00243     {
00244         std::vector<TbEntry *>::iterator i;
00245         for(i = entries.begin(); i != entries.end(); ++i)
00246         {
00247             delete (*i);
00248         }
00249     }

Member Function Documentation

std::vector<TbEntry *>::iterator WININFO::Search | ( | int | cmd,
 |  | int * | dropindex = 0L
 | ) | [inline]

Definition at line 251 of file utoolbar.cpp.

Referenced by UToolbar::OnSetTooltip(), and UToolbar::UDispatchMessage().

00252     {
00253         std::vector<TbEntry *>::iterator i;
00254         for(i = entries.begin(); i != entries.end(); ++i)
00255         {
00256             TbEntry * entry = (*i);
00257             if(entry->kind == tbeDropDown)
00258             {
00259                 TbEntryDropDown *drop = (TbEntryDropDown *)entry;
00260                 std::vector<awidget>::iterator j;
00261                 int index;
00262
00263                 for(j = drop->icons.begin(), index = 0; j != drop->icons.end(); ++j, index++)
00264                 {
00265                     if((*j).cmd == cmd)
00266                     {
00267                         if(dropindex != 0L)
00268                             *dropindex = index;
00269                         return i;
00270                     }
00271                 }
00272             }
00273             else if(entry->kind == tbeButton)
00274             {
00275                 TbEntryButton *btn = (TbEntryButton *)entry;
00276                 if(btn->wid.cmd == cmd)
00277                     return i;
00278             }
00279         }
00280         return i;
00281     }

Member Data Documentation

std::vector<TbEntry *> WININFO::entries

Definition at line 283 of file utoolbar.cpp.

Referenced by UToolbar::OnSetTooltip(), UToolbar::OnTbButton(), UToolbar::OnTbCheckBtn(), UToolbar::OnTbDropDown(), UToolbar::OnTbSeparator(), UToolbar::OnUpdateUI(), and UToolbar::UDispatchMessage().

int WININFO::height

Definition at line 284 of file utoolbar.cpp.

int WININFO::width

Definition at line 284 of file utoolbar.cpp.

The documentation for this class was generated from the following file:
  • rf/utoolbar.cpp
Generated on Sun Oct 21 12:51:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWinLogBranchData Class Reference

Inheritance diagram for CWinLogBranchData:

[legend]
Collaboration diagram for CWinLogBranchData:

[legend]
List of all members.

Public Methods

CWinLogBranchData (CLogNode *node)
virtual | ~CWinLogBranchData ()
CWinLogBranchData (CLogNode *node)
virtual | ~CWinLogBranchData ()

Protected Methods

virtual void | UpdateSelf (UDC &hdc, EntnodeData *entryInfo)
virtual USize | GetBoundsSelf (UDC &hdc, EntnodeData *entryInfo)
virtual void | UpdateSelf (CDC &hdc, EntnodeData *entryInfo)
virtual CSize | GetBoundsSelf (CDC &hdc, EntnodeData *entryInfo)

Constructor & Destructor Documentation

CWinLogBranchData::CWinLogBranchData ( CLogNode * node ) [inline]

Definition at line 182 of file UCvsGraph.cpp.

00182 : CWinLogData(node) {}

virtual CWinLogBranchData::~CWinLogBranchData ( ) [inline, virtual]

Definition at line 183 of file UCvsGraph.cpp.

00183 {}

CWinLogBranchData::CWinLogBranchData ( CLogNode * node ) [inline]

Definition at line 197 of file GraphView.cpp.

00197 : CWinLogData(node) {}

virtual CWinLogBranchData::~CWinLogBranchData ( ) [inline, virtual]

Definition at line 198 of file GraphView.cpp.

00198 {}

Member Function Documentation

CSize CWinLogBranchData::GetBoundsSelf | ( | CDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 434 of file GraphView.cpp.

00435 {
00436     CLogNodeBranch & branch = *(CLogNodeBranch *)fNode;
00437     return hdc.GetTextExtent(*branch, (*branch).length());
00438 }

USize CWinLogBranchData::GetBoundsSelf | ( | UDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 369 of file UCvsGraph.cpp.

00370 {
00371     CLogNodeBranch & branch = *(CLogNodeBranch *)fNode;
00372     return hdc.GetTextExtent(*branch, (*branch).length());
00373 }

void CWinLogBranchData::UpdateSelf | ( | CDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 440 of file GraphView.cpp.

00441 {
00442     // draw the node
00443     ::DrawNode(hdc, selfB, gGraphBranchColor, kOctangle, sel);
00444
00445     // draw the content of the node
00446     TEXTMETRIC tm;
00447     hdc.GetTextMetrics(&tm);
00448     CPoint center = selfB.CenterPoint();
00449     int nCenterX = center.x;
00450     int nCenterY = center.y - tm.tmHeight/2;
00451     CLogNodeBranch & branch = *(CLogNodeBranch *)fNode;
00452     hdc.ExtTextOut(nCenterX, nCenterY, ETO_CLIPPED, selfB,
00453         *branch, (*branch).length(), NULL);
00454 }

void CWinLogBranchData::UpdateSelf | ( | UDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 375 of file UCvsGraph.cpp.

00376 {
00377     // draw the node
00378     ::DrawNode(hdc, selfB, URGB(0, 0, 255), URGB(0, 0, 120), true, sel);
00379
00380     // draw the content of the node
00381     UPoint center = selfB.CenterPoint();
00382     int nCenterX = center.x;
00383     int nCenterY = center.y - hdc.GetTextHeight()/2;
00384     CLogNodeBranch & branch = *(CLogNodeBranch *)fNode;
00385     hdc.TextOutClipped(nCenterX, nCenterY, selfB,
00386         *branch, (*branch).length());
00387 }

The documentation for this class was generated from the following files:
  • common/UCvsGraph.cpp
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:51:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWinLogData Class Reference

Inheritance diagram for CWinLogData:

[legend]
Collaboration diagram for CWinLogData:

[legend]
List of all members.

Public Methods

CWinLogData (CLogNode *node)
virtual | ~CWinLogData ()
kLogNode | GetType (void) const
const char * | GetStr (void)
void | ComputeBounds (const UPoint &topLeft, UDC &hdc, EntnodeData *entryInfo=0L)
void | Offset (UPoint o)
void | Update (UDC &hdc, EntnodeData *entryInfo=0L)
URect & | Bounds (void)
URect & | SelfBounds (void)
bool | Selected (void) const
void | SetSelected (CScrollView *view, bool state)
void | UnselectAll (CScrollView *view)
CWinLogData * | HitTest (UPoint point)
bool | IsDiskNode (EntnodeData *entryInfo)
CWinLogData (CLogNode *node)
virtual | ~CWinLogData ()
kLogNode | GetType (void) const
const char * | GetStr (void)
void | ComputeBounds (const CPoint &topLeft, CDC &hdc, EntnodeData *entryInfo=0L)
void | Offset (CPoint o)
void | Update (CDC &hdc, EntnodeData *entryInfo=0L)
CRect & | Bounds (void)
CRect & | SelfBounds (void)
bool | Selected (void) const
void | SetSelected (CScrollView *view, bool state)
void | UnselectAll (CScrollView *view)
CWinLogData * | HitTest (CPoint point)
bool | IsDiskNode (EntnodeData *entryInfo)
bool | IsDeadNode ()
bool | IsUserState ()

Static Public Methods

CWinLogData * | CreateNewData (CLogNode *node)
CWinLogData * | CreateNewData (CLogNode *node)

Protected Methods

virtual void | UpdateSelf (UDC &hdc, EntnodeData *entryInfo)=0
virtual USize | GetBoundsSelf (UDC &hdc, EntnodeData *entryInfo)=0
CWinLogData * | GetData (CLogNode *node)
virtual void | UpdateSelf (CDC &hdc, EntnodeData *entryInfo)=0
virtual CSize | GetBoundsSelf (CDC &hdc, EntnodeData *entryInfo)=0
CWinLogData * | GetData (CLogNode *node)

Protected Attributes

URect selfB
URect totB
bool | sel
CRect | selfB
CRect | totB

Constructor & Destructor Documentation

CWinLogData::CWinLogData ( CLogNode * node )

Definition at line 389 of file UCvsGraph.cpp.

00389                                        : CLogNodeData(node)
00390 {
00391     selfB.SetRectEmpty();
00392     totB.SetRectEmpty();
00393     sel = false;
00394 }

CWinLogData::~CWinLogData ( ) [virtual]

Definition at line 396 of file UCvsGraph.cpp.

00397 {
00398 }

CWinLogData::CWinLogData ( CLogNode * node )

virtual CWinLogData::~CWinLogData ( ) [virtual]

Member Function Documentation

CRect& CWinLogData::Bounds ( void ) [inline]

Definition at line 135 of file GraphView.cpp.

00135 { return totB; }

URect& CWinLogData::Bounds ( void ) [inline]

Definition at line 122 of file UCvsGraph.cpp.

Referenced by CGraphView::CalcImageSize(), UCvsGraph::CalcImageSize(), CGraphView::OnBeginPrinting(), and TGraphRectSelect::TraverseNode().

00122 { return totB; }

void CWinLogData::ComputeBounds | ( | const CPoint & | topLeft,
 |  | CDC & | hdc,
 |  | EntnodeData * | entryInfo = 0L
 | ) |

Definition at line 725 of file GraphView.cpp.

00727 {
00728     CLogNode *subNode;
00729     CLogNode *nextNode = fNode->Next();
00730
00731     // first compute childrens bounds
00732     vector<CLogNode *>::iterator i;
00733     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00734     {
00735         subNode = *i;
00736         CWinLogData::CreateNewData(subNode);
00737         GetData(subNode)->ComputeBounds(topLeft, hdc, entryInfo);
00738     }
00739     if(nextNode != 0L)
00740         CWinLogData::CreateNewData(nextNode);
00741
00742     // compute self place
00743     selfB.SetRectEmpty();
00744     CSize size = GetBoundsSelf(hdc, entryInfo);
00745     size.cx += kInflateNodeSpace;
00746     size.cy += kInflateNodeSpace;
00747     selfB.SetRect(0, 0, size.cx, size.cy);
00748
00749     // offset to the place assigned to this node
00750     selfB.OffsetRect(topLeft - selfB.TopLeft());
00751
00752     // calculate the total height of the childrens
00753     int vSize = 0;
00754     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00755     {
00756         subNode = *i;
00757         CRect & b = GetData(subNode)->Bounds();
00758         vSize += b.Height();
00759     }
00760     if(!fNode->Childs().empty())
00761         vSize += (fNode->Childs().size() - 1) * kVChildSpace;
00762
00763     // offset the children relative to self
00764     CPoint startChilds(topLeft.x + selfB.Width() + kHChildSpace,
00765         /*selfB.CenterPoint().y - vSize / 2*/topLeft.y);
00766
00767     //place the first child at the bottom of the header node so it won't take so much space for long filenames
00768     if( fNode->GetType() == kNodeHeader )
00769     {
00770         startChilds = CPoint(topLeft.x + kHChildSpace, topLeft.y + selfB.Height() + kVChildSpace);
00771     }
00772
00773     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00774     {
00775         subNode = *i;
00776         CRect curPos = GetData(subNode)->Bounds();
00777         GetData(subNode)->Offset(startChilds - curPos.TopLeft());
00778         startChilds.y += curPos.Height() + kVChildSpace;
00779     }
00780
00781     // calculate the total bounds of the childrens
00782     CRect bc;
00783     bc.SetRectEmpty();
00784     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00785     {
00786         subNode = *i;
00787         CRect & b = GetData(subNode)->Bounds();
00788         bc.UnionRect(bc, b);
00789     }
00790
00791     // now we got the complete size
00792     totB.UnionRect(selfB, bc);
00793
00794     if(nextNode != 0L)
00795     {
00796         CPoint nextTopLeft;
00797         nextTopLeft.x = totB.TopLeft().x;
00798         nextTopLeft.y = totB.BottomRight().y + kVChildSpace;
00799         GetData(nextNode)->ComputeBounds(nextTopLeft, hdc, entryInfo);
00800
00801         totB.UnionRect(totB, GetData(nextNode)->Bounds());
00802     }
00803 }

void CWinLogData::ComputeBounds | ( | const UPoint & | topLeft,
 |  | UDC & | hdc,
 |  | EntnodeData * | entryInfo = 0L
 | ) |

Definition at line 619 of file UCvsGraph.cpp.

Referenced by CGraphView::CalcImageSize(), UCvsGraph::CalcImageSize(), and CGraphView::OnBeginPrinting().

00621 {
00622     CLogNode *subNode;
00623     CLogNode *nextNode = fNode->Next();
00624
00625     // first compute childrens bounds
00626     vector<CLogNode *>::iterator i;
00627     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00628     {
00629         subNode = *i;
00630         CWinLogData::CreateNewData(subNode);
00631         GetData(subNode)->ComputeBounds(topLeft, hdc, entryInfo);
00632     }
00633     if(nextNode != 0L)
00634         CWinLogData::CreateNewData(nextNode);
00635
00636     // compute self place
00637     selfB.SetRectEmpty();
00638     USize size = GetBoundsSelf(hdc, entryInfo);
00639     size.cx += kInflateNodeSpace;
00640     size.cy += kInflateNodeSpace;
00641     selfB.SetRect(0, 0, size.cx, size.cy);
00642
00643     // offset to the place assigned to this node
00644     selfB.OffsetRect(topLeft - selfB.TopLeft());
00645
00646     // calculate the total height of the childrens
00647     int vSize = 0;
00648     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00649     {
00650         subNode = *i;
00651         URect & b = GetData(subNode)->Bounds();
00652         vSize += b.Height();
00653     }
00654     if(!fNode->Childs().empty())
00655         vSize += (fNode->Childs().size() - 1) * kVChildSpace;
00656
00657     // offset the children relative to self
00658     UPoint startChilds(topLeft.x + selfB.Width() + kHChildSpace,
00659         /*selfB.CenterPoint().y - vSize / 2*/topLeft.y);
00660     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00661     {
00662         subNode = *i;
00663         URect curPos = GetData(subNode)->Bounds();
00664         GetData(subNode)->Offset(startChilds - curPos.TopLeft());
00665         startChilds.y += curPos.Height() + kVChildSpace;
00666     }
00667
00668     // calculate the total bounds of the childrens
00669     URect bc;
00670     bc.SetRectEmpty();
00671     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00672     {
00673         subNode = *i;
00674         URect & b = GetData(subNode)->Bounds();
00675         bc.UnionRect(bc, b);
00676     }
00677
00678     // now we got the complete size
00679     totB.UnionRect(selfB, bc);
00680
00681     if(nextNode != 0L)
00682     {
00683         UPoint nextTopLeft;
00684         nextTopLeft.x = totB.TopLeft().x;
00685         nextTopLeft.y = totB.BottomRight().y + kVChildSpace;
00686         GetData(nextNode)->ComputeBounds(nextTopLeft, hdc, entryInfo);
00687
00688         totB.UnionRect(totB, GetData(nextNode)->Bounds());
00689     }
00690 }

CWinLogData* CWinLogData::CreateNewData ( CLogNode * node ) [static]

CWinLogData * CWinLogData::CreateNewData ( CLogNode * node ) [static]

Definition at line 432 of file UCvsGraph.cpp.

Referenced by CGraphView::CalcImageSize(), UCvsGraph::CalcImageSize(), ComputeBounds(), and CGraphView::OnBeginPrinting().

00433 {
00434     if(node->GetUserData() != 0L)
00435         return (CWinLogData *)node->GetUserData();
00436
00437     CWinLogData *res = 0L;
00438     switch(node->GetType())
00439     {
00440     case kNodeHeader :
00441         res = new CWinLogHeaderData(node);
00442         break;
00443     case kNodeBranch :
00444         res = new CWinLogBranchData(node);
00445         break;
00446     case kNodeRev :
00447         res = new CWinLogRevData(node);
00448         break;
00449     case kNodeTag :
00450         res = new CWinLogTagData(node);
00451         break;
00452     }
00453     node->SetUserData(res);
00454     return res;
00455 }

virtual CSize CWinLogData::GetBoundsSelf | ( | CDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, pure virtual]

Reimplemented in CWinLogHeaderData, CWinLogRevData, CWinLogTagData, and CWinLogBranchData.

virtual USize CWinLogData::GetBoundsSelf | ( | UDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, pure virtual]

Reimplemented in CWinLogHeaderData, CWinLogRevData, CWinLogTagData, and CWinLogBranchData.

Referenced by ComputeBounds().

CWinLogData* CWinLogData::GetData ( CLogNode * node ) [inline, protected]

Definition at line 153 of file GraphView.cpp.

00154         { return (CWinLogData *)node->GetUserData(); }

CWinLogData* CWinLogData::GetData ( CLogNode * node ) [inline, protected]

Definition at line 138 of file UCvsGraph.cpp.

Referenced by ComputeBounds(), HitTest(), Offset(), UnselectAll(), and Update().

00139         { return (CWinLogData *)node->GetUserData(); }

const char* CWinLogData::GetStr ( void )

const char * CWinLogData::GetStr ( void )

Definition at line 400 of file UCvsGraph.cpp.

Referenced by CGraphView::OnGraphChangelogmessage(), CGraphView::OnGraphSetstate(), CGraphView::OnQueryAnnotate(), CGraphView::OnViewDiff(), CGraphView::OnViewLockf(), CGraphView::OnViewRetrieve(), CGraphView::OnViewTag(), CGraphView::OnViewUnlockf(), and TGraphDelCmd::TraverseNode().

00401 {
00402     switch(GetType())
00403     {
00404         case kNodeHeader :
00405         {
00406             CLogNodeHeader & header = *(CLogNodeHeader *)fNode;
00407             return (*header).WorkingFile();
00408             break;
00409         }
00410         case kNodeBranch :
00411         {
00412             CLogNodeBranch & branch = *(CLogNodeBranch *)fNode;
00413             return *branch;
00414             break;
00415         }
00416         case kNodeRev :
00417         {
00418             CLogNodeRev & rev = *(CLogNodeRev *)fNode;
00419             return (*rev).RevNum().str();
00420             break;
00421         }
00422         case kNodeTag :
00423         {
00424             CLogNodeTag & tag = *(CLogNodeTag *)fNode;
00425             return *tag;
00426             break;
00427         }
00428     }
00429     return 0L;
00430 }

kLogNode CWinLogData::GetType ( void ) const [inline]

Definition at line 127 of file GraphView.cpp.

00127 { return fNode->GetType(); }

kLogNode CWinLogData::GetType ( void ) const [inline]

Definition at line 114 of file UCvsGraph.cpp.

Referenced by GetStr(), IsDeadNode(), IsDiskNode(), CGraphView::IsSelSingleNode(), IsUserState(), CGraphView::OnContextMenu(), CGraphView::OnUpdateViewDiff(), TGraphSelNonSig::TraverseNode(), and TGraphDelCmd::TraverseNode().

00114 { return fNode->GetType(); }

CWinLogData * CWinLogData::HitTest ( CPoint point )

Definition at line 596 of file GraphView.cpp.

00597 {
00598     if(!totB.PtInRect(point))
00599         return 0L;
00600     if(selfB.PtInRect(point))
00601         return this;
00602
00603     CWinLogData *result;
00604     vector<CLogNode *>::iterator i;
00605     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00606     {
00607         CLogNode *subNode = *i;
00608         result = GetData(subNode)->HitTest(point);
00609         if(result != 0L)
00610             return result;
00611     }
00612     if(fNode->Next() != 0L)
00613     {
00614         result = GetData(fNode->Next())->HitTest(point);
00615         if(result != 0L)
00616             return result;
00617     }
00618     return 0L;
00619 }

CWinLogData * CWinLogData::HitTest ( UPoint point )

Definition at line 512 of file UCvsGraph.cpp.

Referenced by CGraphView::OnContextMenu(), and CGraphView::OnLButtonDown().

00513 {
00514     if(!totB.PtInRect(point))
00515         return 0L;
00516     if(selfB.PtInRect(point))
00517         return this;
00518
00519     CWinLogData *result;
00520     vector<CLogNode *>::iterator i;
00521     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00522     {
00523         CLogNode *subNode = *i;
00524         result = GetData(subNode)->HitTest(point);
00525         if(result != 0L)
00526             return result;
00527     }
00528     if(fNode->Next() != 0L)
00529     {
00530         result = GetData(fNode->Next())->HitTest(point);
00531         if(result != 0L)
00532             return result;
00533     }
00534     return 0L;
00535 }

bool CWinLogData::IsDeadNode ( )

Definition at line 535 of file GraphView.cpp.

Referenced by CWinLogRevData::UpdateSelf().

00536 {
00537     if(GetType() != kNodeRev)
00538         return false;
00539
00540     return strcmp("dead", (**(CLogNodeRev *)fNode).State()) == 0;
00541 }

bool CWinLogData::IsDiskNode ( EntnodeData * entryInfo )

bool CWinLogData::IsDiskNode ( EntnodeData * entryInfo )

Definition at line 457 of file UCvsGraph.cpp.

Referenced by CWinLogRevData::GetBoundsSelf(), and CWinLogRevData::UpdateSelf().

00458 {
00459     if(entryInfo == 0L || GetType() != kNodeRev)
00460         return false;
00461     const char *vn = (*entryInfo)[EntnodeFile::kVN];
00462     if(vn == 0L)
00463         return false;
00464
00465     return strcmp(vn, (**(CLogNodeRev *)fNode).RevNum().str()) == 0;
00466 }

bool CWinLogData::IsUserState ( )

Definition at line 543 of file GraphView.cpp.

Referenced by CWinLogRevData::UpdateSelf().

00544 {
00545     if(GetType() != kNodeRev)
00546         return false;
00547
00548     return !(strcmp("dead", (**(CLogNodeRev *)fNode).State()) == 0 ||
00549         strcmp("Exp", (**(CLogNodeRev *)fNode).State()) == 0);
00550 }

void CWinLogData::Offset ( CPoint o )

Definition at line 556 of file GraphView.cpp.

00557 {
00558     selfB.OffsetRect(o);
00559     totB.OffsetRect(o);
00560     vector<CLogNode *>::iterator i;
00561     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00562     {
00563         CLogNode *subNode = *i;
00564         GetData(subNode)->Offset(o);
00565     }
00566     if(fNode->Next() != 0L)
00567         GetData(fNode->Next())->Offset(o);
00568 }

void CWinLogData::Offset ( UPoint o )

Definition at line 472 of file UCvsGraph.cpp.

Referenced by CGraphView::CalcImageSize(), and UCvsGraph::CalcImageSize().

00473 {
00474     selfB.OffsetRect(o);
00475     totB.OffsetRect(o);
00476     vector<CLogNode *>::iterator i;
00477     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00478     {
00479         CLogNode *subNode = *i;
00480         GetData(subNode)->Offset(o);
00481     }
00482     if(fNode->Next() != 0L)
00483         GetData(fNode->Next())->Offset(o);
00484 }

bool CWinLogData::Selected ( void ) const [inline]

Definition at line 138 of file GraphView.cpp.

00138 { return sel; }

bool CWinLogData::Selected ( void ) const [inline]

Definition at line 125 of file UCvsGraph.cpp.

Referenced by CGraphView::OnContextMenu(), CGraphView::OnLButtonDown(), TGraphDelCmd::TraverseNode(), TGraphCmdStatus::TraverseNode(), and TGraphRectSelect::TraverseNode().

00125 { return sel; }

CRect& CWinLogData::SelfBounds ( void ) [inline]

Definition at line 136 of file GraphView.cpp.

00136 { return selfB; }

URect& CWinLogData::SelfBounds ( void ) [inline]

Definition at line 123 of file UCvsGraph.cpp.

Referenced by TGraphRectSelect::TraverseNode().

00123 { return selfB; }

void CWinLogData::SetSelected | ( | CScrollView * | view,
 |  | bool | state
 | ) |

void CWinLogData::SetSelected | ( | CScrollView * | view,
 |  | bool | state
 | ) |

Definition at line 486 of file UCvsGraph.cpp.

Referenced by CGraphView::OnContextMenu(), CGraphView::OnLButtonDown(), TGraphSelNonSig::TraverseNode(), TGraphRectSelect::TraverseNode(), and UnselectAll().

00487 {
00488     sel = state;
00489
00490     URect invalR = selfB;
00491     invalR.OffsetRect(-view->GetDeviceScrollPosition());
00492     view->InvalidateRect(invalR);
00493 }

void CWinLogData::UnselectAll ( CScrollView * view )

void CWinLogData::UnselectAll ( CScrollView * view )

Definition at line 495 of file UCvsGraph.cpp.

Referenced by CGraphView::OnContextMenu(), CGraphView::OnLButtonDown(), and CGraphView::OnViewSelnonsig().

00496 {
00497     if(sel)
00498     {
00499         SetSelected(view, false);
00500     }
00501
00502     vector<CLogNode *>::iterator i;
00503     for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i)
00504     {
00505         CLogNode *subNode = *i;
00506         GetData(subNode)->UnselectAll(view);
00507     }
00508     if(fNode->Next() != 0L)
00509         GetData(fNode->Next())->UnselectAll(view);
00510 }

void CWinLogData::Update | ( | CDC & | hdc,
 |  | EntnodeData * | entryInfo = 0L
 | ) |

Definition at line 621 of file GraphView.cpp.

00622 {
00623     CLogNode *subNode;
00624     CLogNode *nextNode = fNode->Next();
00625     CPen *pOldPen = 0L;
00626     CBrush *pOldBrush = 0L;
00627     CPen pen, pen2;
00628     CBrush brush;
00629
00630     UpdateSelf(hdc, entryInfo);
00631
00632     TRY
00633     {
00634         pen.CreatePen(PS_SOLID, 2, RGB(0, 0, 255));
00635         pen2.CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
00636         pOldPen = hdc.SelectObject(&pen);
00637
00638         int topY = selfB.TopLeft().y + 2;
00639         int botY = selfB.BottomRight().y - 2;
00640         int lefX = selfB.BottomRight().x + 4;
00641
00642         int count = 1;
00643         int tot = fNode->Childs().size() + 1;
00644
00645         // draw the children
00646         vector<CLogNode *>::iterator i;
00647         for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i, ++count)
00648         {
00649             subNode = *i;
00650
00651             // draw the link
00652             CRect & cb = GetData(subNode)->SelfBounds();
00653             if(subNode->GetType() == kNodeRev || subNode->GetType() == kNodeBranch)
00654                 hdc.SelectObject(&pen);
00655             else
00656                 hdc.SelectObject(&pen2);
00657             float y = (float)topY + (float)(botY - topY) *
00658                 (float)count / (float)tot;
00659             int rigX = cb.TopLeft().x - 4;
00660             float x = (float)rigX - (float)(rigX - lefX) *
00661                 (float)count / (float)tot;
00662
00663             //special drawing for the header node
00664             if( count == 1 && fNode->GetType() == kNodeHeader )
00665             {
00666                 hdc.MoveTo(selfB.TopLeft().x + kHChildSpace/2, selfB.BottomRight().y);
00667                 hdc.LineTo(selfB.TopLeft().x + kHChildSpace/2, cb.CenterPoint().y);
00668                 hdc.LineTo(cb.TopLeft().x, cb.CenterPoint().y);
00669             }
00670             else
00671             {
00672                 //int halfX = (cb.TopLeft().x - selfB.BottomRight().x) / 2;
00673                 hdc.MoveTo(selfB.BottomRight().x, (int)y);
00674                 hdc.LineTo(x, (int)y);
00675                 hdc.LineTo(x, cb.CenterPoint().y);
00676                 hdc.LineTo(cb.TopLeft().x, cb.CenterPoint().y);
00677             }
00678
00679             // draw the sub-node
00680             GetData(subNode)->Update(hdc, entryInfo);
00681         }
00682
00683         // draw the next node
00684         if(nextNode != 0L)
00685         {
00686             // draw the link
00687             CRect & nb = GetData(nextNode)->SelfBounds();
00688             if(nextNode->GetType() == kNodeRev || nextNode->GetType() == kNodeBranch)
00689                 hdc.SelectObject(&pen);
00690             else
00691                 hdc.SelectObject(&pen2);
00692             int centerX = selfB.Width() < nb.Width() ?
00693                 selfB.CenterPoint().x : nb.CenterPoint().x;
00694             hdc.MoveTo(centerX, selfB.BottomRight().y);
00695             hdc.LineTo(centerX, nb.TopLeft().y);
00696
00697             // draw the next node
00698             GetData(nextNode)->Update(hdc, entryInfo);
00699         }
00700
00701         if (pOldPen != 0L)
00702         {
00703             hdc.SelectObject(pOldPen);
00704             pOldPen = 0L;
00705         }
00706         if (pOldBrush != 0L)
00707         {
00708             hdc.SelectObject(pOldBrush);
00709             pOldBrush = 0L;
00710         }
00711
00712         pen.DeleteObject();
00713         pen2.DeleteObject();
00714     }
00715     CATCH_ALL(e)
00716     {
00717         if (pOldPen != 0L)
00718             hdc.SelectObject(pOldPen);
00719         if (pOldBrush != 0L)
00720             hdc.SelectObject(pOldBrush);
00721     }
00722     END_CATCH_ALL
00723 }

void CWinLogData::Update | ( | UDC & | hdc,
 |  | EntnodeData * | entryInfo = 0L
 | ) |

Definition at line 537 of file UCvsGraph.cpp.

Referenced by CGraphView::OnDraw(), UCvsGraph::OnDrawing(), and CGraphView::OnPrint().

00538 {
00539     CLogNode *subNode;
00540     CLogNode *nextNode = fNode->Next();
00541     UPen *pOldPen = 0L;
00542     UPen pen, pen2;
00543
00544     UpdateSelf(hdc, entryInfo);
00545
00546     try
00547     {
00548         pen.CreatePen(UPS_SOLID, 2, URGB(0, 0, 255));
00549         pen2.CreatePen(UPS_SOLID, 1, URGB(0, 0, 0));
00550         pOldPen = hdc.SelectObject(&pen);
00551
00552         int topY = selfB.TopLeft().y + 2;
00553         int botY = selfB.BottomRight().y - 2;
00554         int lefX = selfB.BottomRight().x + 4;
00555         int count = 1;
00556         int tot = fNode->Childs().size() + 1;
00557
00558         // draw the children
00559         vector<CLogNode *>::iterator i;
00560         for(i = fNode->Childs().begin(); i != fNode->Childs().end(); ++i, ++count)
00561         {
00562             subNode = *i;
00563
00564             // draw the link
00565             URect & cb = GetData(subNode)->SelfBounds();
00566             if(subNode->GetType() == kNodeRev || subNode->GetType() == kNodeBranch)
00567                 hdc.SelectObject(&pen);
00568             else
00569                 hdc.SelectObject(&pen2);
00570             float y = (float)topY + (float)(botY - topY) *
00571                 (float)count / (float)tot;
00572             int rigX = cb.TopLeft().x - 4;
00573             float x = (float)rigX - (float)(rigX - lefX) *
00574                 (float)count / (float)tot;
00575             //int halfX = (cb.TopLeft().x - selfB.BottomRight().x) / 2;
00576             hdc.MoveTo(selfB.BottomRight().x, (int)y);
00577             hdc.LineTo((int)x, (int)y);
00578             hdc.LineTo((int)x, cb.CenterPoint().y);
00579             hdc.LineTo(cb.TopLeft().x, cb.CenterPoint().y);
00580
00581             // draw the sub-node
00582             GetData(subNode)->Update(hdc, entryInfo);
00583         }
00584
00585         // draw the next node
00586         if(nextNode != 0L)
00587         {
00588             // draw the link
00589             URect & nb = GetData(nextNode)->SelfBounds();
00590             if(nextNode->GetType() == kNodeRev || nextNode->GetType() == kNodeBranch)
00591                 hdc.SelectObject(&pen);
00592             else
00593                 hdc.SelectObject(&pen2);
00594             int centerX = selfB.Width() < nb.Width() ?
00595                 selfB.CenterPoint().x : nb.CenterPoint().x;
00596             hdc.MoveTo(centerX, selfB.BottomRight().y);
00597             hdc.LineTo(centerX, nb.TopLeft().y);
00598
00599             // draw the next node
00600             GetData(nextNode)->Update(hdc, entryInfo);
00601         }
00602
00603         if (pOldPen != 0L)
00604         {
00605             hdc.SelectObject(pOldPen);
00606             pOldPen = 0L;
00607         }
00608
00609         pen.DeleteObject();
00610         pen2.DeleteObject();
00611     }
00612     catch(...)
00613     {
00614         if (pOldPen != 0L)
00615             hdc.SelectObject(pOldPen);
00616     }
00617 }

virtual void CWinLogData::UpdateSelf | ( | CDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, pure virtual]

Reimplemented in CWinLogHeaderData, CWinLogRevData, CWinLogTagData, and CWinLogBranchData.

virtual void CWinLogData::UpdateSelf | ( | UDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, pure virtual]

Reimplemented in CWinLogHeaderData, CWinLogRevData, CWinLogTagData, and CWinLogBranchData.

Referenced by Update().

Member Data Documentation

bool CWinLogData::sel [protected]

Definition at line 158 of file GraphView.cpp.

CRect CWinLogData::selfB [protected]

Definition at line 156 of file GraphView.cpp.

URect CWinLogData::selfB [protected]

Definition at line 141 of file UCvsGraph.cpp.

CRect CWinLogData::totB [protected]

Definition at line 157 of file GraphView.cpp.

URect CWinLogData::totB [protected]

Definition at line 142 of file UCvsGraph.cpp.

The documentation for this class was generated from the following files:
  • common/UCvsGraph.cpp
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:51:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWinLogHeaderData Class Reference

Inheritance diagram for CWinLogHeaderData:

[legend]
Collaboration diagram for CWinLogHeaderData:

[legend]
List of all members.

Public Methods

CWinLogHeaderData (CLogNode *node)
virtual | ~CWinLogHeaderData ()
CWinLogHeaderData (CLogNode *node)
virtual | ~CWinLogHeaderData ()

Protected Methods

virtual void | UpdateSelf (UDC &hdc, EntnodeData *entryInfo)
virtual USize | GetBoundsSelf (UDC &hdc, EntnodeData *entryInfo)
virtual void | UpdateSelf (CDC &hdc, EntnodeData *entryInfo)
virtual CSize | GetBoundsSelf (CDC &hdc, EntnodeData *entryInfo)

Constructor & Destructor Documentation

CWinLogHeaderData::CWinLogHeaderData ( CLogNode * node ) [inline]

Definition at line 149 of file UCvsGraph.cpp.

00149 : CWinLogData(node) {}

virtual CWinLogHeaderData::~CWinLogHeaderData ( ) [inline, virtual]

Definition at line 150 of file UCvsGraph.cpp.

00150 {}

CWinLogHeaderData::CWinLogHeaderData ( CLogNode * node ) [inline]

Definition at line 164 of file GraphView.cpp.

00164 : CWinLogData(node) {}

virtual CWinLogHeaderData::~CWinLogHeaderData ( ) [inline, virtual]

Definition at line 165 of file GraphView.cpp.

00165 {}

Member Function Documentation

CSize CWinLogHeaderData::GetBoundsSelf | ( | CDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 205 of file GraphView.cpp.

00206 {
00207     CLogNodeHeader & header = *(CLogNodeHeader *)fNode;
00208     return hdc.GetTextExtent((*header).WorkingFile(),
00209         (*header).WorkingFile().length());
00210 }

USize CWinLogHeaderData::GetBoundsSelf | ( | UDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 190 of file UCvsGraph.cpp.

00191 {
00192     CLogNodeHeader & header = *(CLogNodeHeader *)fNode;
00193     return hdc.GetTextExtent((*header).WorkingFile(),
00194         (*header).WorkingFile().length());
00195 }

void CWinLogHeaderData::UpdateSelf | ( | CDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 335 of file GraphView.cpp.

00336 {
00337     // draw the node
00338     ::DrawNode(hdc, selfB, gGraphHeaderColor, kRoundRect, sel);
00339
00340     // draw the content of the node
00341     TEXTMETRIC tm;
00342     hdc.GetTextMetrics(&tm);
00343     CPoint center = selfB.CenterPoint();
00344     int nCenterX = center.x;
00345     int nCenterY = center.y - tm.tmHeight/2;
00346     CLogNodeHeader & header = *(CLogNodeHeader *)fNode;
00347     hdc.ExtTextOut(nCenterX, nCenterY, ETO_CLIPPED, selfB,
00348         (*header).WorkingFile(), (*header).WorkingFile().length(), NULL);
00349 }

void CWinLogHeaderData::UpdateSelf | ( | UDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 292 of file UCvsGraph.cpp.

00293 {
00294     // draw the node
00295     ::DrawNode(hdc, selfB, URGB(255, 0, 0), URGB(120, 0, 0), true, sel);
00296
00297     // draw the content of the node
00298     UPoint center = selfB.CenterPoint();
00299     int nCenterX = center.x;
00300     int nCenterY = center.y - hdc.GetTextHeight()/2;
00301     CLogNodeHeader & header = *(CLogNodeHeader *)fNode;
00302     hdc.TextOutClipped(nCenterX, nCenterY, selfB,
00303         (*header).WorkingFile(), (*header).WorkingFile().length());
00304 }

The documentation for this class was generated from the following files:
  • common/UCvsGraph.cpp
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:51:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWinLogRevData Class Reference

Inheritance diagram for CWinLogRevData:

[legend]
Collaboration diagram for CWinLogRevData:

[legend]
List of all members.

Public Methods

CWinLogRevData (CLogNode *node)
virtual | ~CWinLogRevData ()
CWinLogRevData (CLogNode *node)
virtual | ~CWinLogRevData ()

Protected Methods

virtual void | UpdateSelf (UDC &hdc, EntnodeData *entryInfo)
virtual USize | GetBoundsSelf (UDC &hdc, EntnodeData *entryInfo)
virtual void | UpdateSelf (CDC &hdc, EntnodeData *entryInfo)
virtual CSize | GetBoundsSelf (CDC &hdc, EntnodeData *entryInfo)

Constructor & Destructor Documentation

CWinLogRevData::CWinLogRevData ( CLogNode * node ) [inline]

Definition at line 160 of file UCvsGraph.cpp.

00160 : CWinLogData(node) {}

virtual CWinLogRevData::~CWinLogRevData ( ) [inline, virtual]

Definition at line 161 of file UCvsGraph.cpp.

00161 {}

CWinLogRevData::CWinLogRevData ( CLogNode * node ) [inline]

Definition at line 175 of file GraphView.cpp.

00175 : CWinLogData(node) {}

virtual CWinLogRevData::~CWinLogRevData ( ) [inline, virtual]

Definition at line 176 of file GraphView.cpp.

00176 {}

Member Function Documentation

CSize CWinLogRevData::GetBoundsSelf | ( | CDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 351 of file GraphView.cpp.

00352 {
00353     CLogNodeRev & rev = *(CLogNodeRev *)fNode;
00354     CSize size = hdc.GetTextExtent((*rev).RevNum().c_str(),
00355         strlen((*rev).RevNum().c_str()));
00356     if(IsDiskNode(entryInfo))
00357     {
00358         size.cx += 2 + 16 + 2;
00359         size.cy = max(16, size.cy);
00360     }
00361     return size;
00362 }

USize CWinLogRevData::GetBoundsSelf | ( | UDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 306 of file UCvsGraph.cpp.

00307 {
00308     CLogNodeRev & rev = *(CLogNodeRev *)fNode;
00309     USize size = hdc.GetTextExtent((*rev).RevNum().str(),
00310         strlen((*rev).RevNum().str()));
00311     if(IsDiskNode(entryInfo))
00312     {
00313         size.cx += 2 + 16 + 2;
00314         size.cy = max(16, size.cy);
00315     }
00316     return size;
00317 }

void CWinLogRevData::UpdateSelf | ( | CDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 364 of file GraphView.cpp.

00365 {
00366     CRect txtRect = selfB;
00367
00368     if(IsDiskNode(entryInfo))
00369     {
00370         txtRect.left += 2 + 16 + 2;
00371     }
00372
00373     // draw the node
00374     COLORREF contour = gGraphNodeColor;
00375     int penStyle = PS_SOLID;
00376
00377     if(IsDeadNode())
00378     {
00379         contour = (COLORREF)gGraphDeadNodeColor;
00380         penStyle = STYLE_DEADNODE;
00381     }
00382     else if(IsUserState())
00383     {
00384         contour = (COLORREF)gGraphUserStateNodeColor;
00385         penStyle = STYLE_USERSTATENODE;
00386     }
00387
00388     ::DrawNode(hdc, selfB, contour, kRectangle, sel, penStyle);
00389
00390     // draw the state icon if it is the rev. of the disk
00391     if(IsDiskNode(entryInfo))
00392     {
00393         CImageList & list = CGraphView::GetImgList();
00394         CPoint w(selfB.TopLeft());
00395         w.x += 2;
00396         w.y += (selfB.Height() - 16) / 2;
00397         list.Draw(&hdc, CBrowseFileView::GetImageForEntry(entryInfo),
00398             w, ILD_TRANSPARENT);
00399     }
00400
00401     // draw the content of the node
00402     TEXTMETRIC tm;
00403     hdc.GetTextMetrics(&tm);
00404     CPoint center = txtRect.CenterPoint();
00405     int nCenterX = center.x;
00406     int nCenterY = center.y - tm.tmHeight/2;
00407     CLogNodeRev & rev = *(CLogNodeRev *)fNode;
00408     hdc.ExtTextOut(nCenterX, nCenterY, ETO_CLIPPED, txtRect,
00409             (*rev).RevNum().c_str(), strlen((*rev).RevNum().c_str()), NULL);
00410 }

void CWinLogRevData::UpdateSelf | ( | UDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 319 of file UCvsGraph.cpp.

00320 {
00321     URect txtRect = selfB;
00322
00323     if(IsDiskNode(entryInfo))
00324     {
00325         txtRect.left += 2 + 16 + 2;
00326     }
00327
00328     // draw the node
00329     ::DrawNode(hdc, selfB, URGB(0, 0, 255), URGB(0, 0, 0), false, sel);
00330
00331     // draw the state icon if it is the rev. of the disk
00332     if(IsDiskNode(entryInfo))
00333     {
00334         UPoint w(selfB.TopLeft());
00335         w.x += 2;
00336         w.y += (selfB.Height() - 16) / 2;
00337         hdc.DrawBitmap(UCvsFiles::GetImageForEntry(entryInfo), w);
00338     }
00339
00340     // draw the content of the node
00341     UPoint center = txtRect.CenterPoint();
00342     int nCenterX = center.x;
00343     int nCenterY = center.y - hdc.GetTextHeight()/2;
00344     CLogNodeRev & rev = *(CLogNodeRev *)fNode;
00345     hdc.TextOutClipped(nCenterX, nCenterY, txtRect,
00346             (*rev).RevNum().str(), strlen((*rev).RevNum().str()));
00347 }

The documentation for this class was generated from the following files:
  • common/UCvsGraph.cpp
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:51:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWinLogTagData Class Reference

Inheritance diagram for CWinLogTagData:

[legend]
Collaboration diagram for CWinLogTagData:

[legend]
List of all members.

Public Methods

CWinLogTagData (CLogNode *node)
virtual | ~CWinLogTagData ()
CWinLogTagData (CLogNode *node)
virtual | ~CWinLogTagData ()

Protected Methods

virtual void | UpdateSelf (UDC &hdc, EntnodeData *entryInfo)
virtual USize | GetBoundsSelf (UDC &hdc, EntnodeData *entryInfo)
virtual void | UpdateSelf (CDC &hdc, EntnodeData *entryInfo)
virtual CSize | GetBoundsSelf (CDC &hdc, EntnodeData *entryInfo)

Constructor & Destructor Documentation

CWinLogTagData::CWinLogTagData ( CLogNode * node ) [inline]

Definition at line 171 of file UCvsGraph.cpp.

00171 : CWinLogData(node) {}

virtual CWinLogTagData::~CWinLogTagData ( ) [inline, virtual]

Definition at line 172 of file UCvsGraph.cpp.

00172 {}

CWinLogTagData::CWinLogTagData ( CLogNode * node ) [inline]

Definition at line 186 of file GraphView.cpp.

00186 : CWinLogData(node) {}

virtual CWinLogTagData::~CWinLogTagData ( ) [inline, virtual]

Definition at line 187 of file GraphView.cpp.

00187 {}

Member Function Documentation

CSize CWinLogTagData::GetBoundsSelf | ( | CDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 412 of file GraphView.cpp.

00413 {
00414     CLogNodeTag & tag = *(CLogNodeTag *)fNode;
00415     return hdc.GetTextExtent(*tag, (*tag).length());
00416 }

USize CWinLogTagData::GetBoundsSelf | ( | UDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 349 of file UCvsGraph.cpp.

00350 {
00351     CLogNodeTag & tag = *(CLogNodeTag *)fNode;
00352     return hdc.GetTextExtent(*tag, (*tag).length());
00353 }

void CWinLogTagData::UpdateSelf | ( | CDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 418 of file GraphView.cpp.

00419 {
00420     // draw the node
00421     ::DrawNode(hdc, selfB, gGraphTagColor, kRoundRect, sel);
00422
00423     // draw the content of the node
00424     TEXTMETRIC tm;
00425     hdc.GetTextMetrics(&tm);
00426     CPoint center = selfB.CenterPoint();
00427     int nCenterX = center.x;
00428     int nCenterY = center.y - tm.tmHeight/2;
00429     CLogNodeTag & tag = *(CLogNodeTag *)fNode;
00430     hdc.ExtTextOut(nCenterX, nCenterY, ETO_CLIPPED, selfB,
00431         *tag, (*tag).length(), NULL);
00432 }

void CWinLogTagData::UpdateSelf | ( | UDC & | hdc,
 |  | EntnodeData * | entryInfo
 | ) | [protected, virtual]

Reimplemented from CWinLogData.

Definition at line 355 of file UCvsGraph.cpp.

00356 {
00357     // draw the node
00358     ::DrawNode(hdc, selfB, URGB(0, 0, 0), URGB(120, 120, 120), true, sel);
00359
00360     // draw the content of the node
00361     UPoint center = selfB.CenterPoint();
00362     int nCenterX = center.x;
00363     int nCenterY = center.y - hdc.GetTextHeight()/2;
00364     CLogNodeTag & tag = *(CLogNodeTag *)fNode;
00365     hdc.TextOutClipped(nCenterX, nCenterY, selfB,
00366         *tag, (*tag).length());
00367 }

The documentation for this class was generated from the following files:
  • common/UCvsGraph.cpp
  • WinCvs/GraphView.cpp
Generated on Sun Oct 21 12:51:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWinPlacement Class Reference

Inheritance diagram for CWinPlacement:

[legend]
Collaboration diagram for CWinPlacement:

[legend]
List of all members.

Public Methods

CWinPlacement (const char *uniqueName)
virtual | ~CWinPlacement ()
virtual unsigned int | SizeOf (void) const
virtual const void * | GetData (void) const
virtual void | SetData (const void *ptr, unsigned int size)
CWinPlacement & | operator= (const WINDOWPLACEMENT &newplace)

Public Attributes

WINDOWPLACEMENT placement
bool | hasOne

Constructor & Destructor Documentation

CWinPlacement::CWinPlacement ( const char * uniqueName ) [inline]

Definition at line 62 of file MainFrm.cpp.

00062                                           : CPersistent(uniqueName, kNoClass)
00063     {
00064         hasOne = false;
00065     }

virtual CWinPlacement::~CWinPlacement ( ) [inline, virtual]

Definition at line 66 of file MainFrm.cpp.

00067     {
00068     }

Member Function Documentation

virtual const void* CWinPlacement::GetData ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 75 of file MainFrm.cpp.

00076     {
00077         return hasOne ? &placement : 0L;
00078     }

virtual void CWinPlacement::SetData | ( | const void * | ptr,
 |  | unsigned int | size
 | ) | [inline, virtual]

Reimplemented from CPersistent.

Definition at line 80 of file MainFrm.cpp.

00081     {
00082         if(size == sizeof(WINDOWPLACEMENT))
00083         {
00084             memcpy(&placement, ptr, sizeof(WINDOWPLACEMENT));
00085             hasOne = true;
00086         }
00087     }

virtual unsigned int CWinPlacement::SizeOf ( void ) const [inline, virtual]

Reimplemented from CPersistent.

Definition at line 70 of file MainFrm.cpp.

00071     {
00072         return hasOne ? sizeof(WINDOWPLACEMENT) : 0;
00073     }

CWinPlacement& CWinPlacement::operator= ( const WINDOWPLACEMENT & newplace ) [inline]

Definition at line 89 of file MainFrm.cpp.

00090     {
00091         TouchTimeStamp();
00092         memcpy(&placement, &newplace, sizeof(WINDOWPLACEMENT));
00093         hasOne = true;
00094         return *this;
00095     }

Member Data Documentation

bool CWinPlacement::hasOne

Definition at line 60 of file MainFrm.cpp.

Referenced by CMainFrame::InitialShowWindow().

WINDOWPLACEMENT CWinPlacement::placement

Definition at line 59 of file MainFrm.cpp.

Referenced by CMainFrame::InitialShowWindow().

The documentation for this class was generated from the following file:
  • WinCvs/MainFrm.cpp
Generated on Sun Oct 21 12:51:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWinThread Class Reference

Inheritance diagram for CWinThread:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/wincvs.cpp
Generated on Sun Oct 21 12:51:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWnd Class Reference

Inheritance diagram for CWnd:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/CJLib/Include/GfxOutBarCtrl.h
Generated on Sun Oct 21 12:51:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


CWndRedrawMngr Class Reference

CWndRedrawManager supports efficient drawing of CWnd based windows,. More...

#include <wincvs_winutil.h>

Collaboration diagram for CWndRedrawMngr:

[legend]
List of all members.

Public Methods

CWndRedrawMngr (CWnd *pWnd, BOOL bRedraw=FALSE)
Constructor sets the redraw to FALSE unless overrriden by bRedraw flag. More...

virtual | ~CWndRedrawMngr ()
Destructor will make sure that Redraw is set to TRUE when object goes out of scope. More...

void | SetRedraw (BOOL bRedraw)
Basic manupulation of the Redraw state. More...

Private Attributes

CWnd * m_pWnd

Detailed Description

CWndRedrawManager supports efficient drawing of CWnd based windows,.

Definition at line 30 of file wincvs_winutil.h.

Constructor & Destructor Documentation

CWndRedrawMngr::CWndRedrawMngr | ( | CWnd * | pWnd,
 |  | BOOL | bRedraw = FALSE
 | ) |

Constructor sets the redraw to FALSE unless overrriden by bRedraw flag.

Definition at line 536 of file wincvs_winutil.cpp.

00537 {
00538     ASSERT(pWnd != NULL);
00539     m_pWnd = pWnd;
00540
00541     if( m_pWnd )
00542     {
00543         m_pWnd->SetRedraw(bRedraw);
00544     }
00545 }

CWndRedrawMngr::~CWndRedrawMngr ( ) [virtual]

Destructor will make sure that Redraw is set to TRUE when object goes out of scope.

Definition at line 548 of file wincvs_winutil.cpp.

00549 {
00550     if( m_pWnd )
00551     {
00552         m_pWnd->SetRedraw(TRUE);
00553     }
00554 }

Member Function Documentation

void CWndRedrawMngr::SetRedraw ( BOOL bRedraw )

Basic manupulation of the Redraw state.

Definition at line 557 of file wincvs_winutil.cpp.

00558 {
00559     if( m_pWnd )
00560     {
00561         m_pWnd->SetRedraw(bRedraw);
00562     }
00563 }

Member Data Documentation

CWnd* CWndRedrawMngr::m_pWnd [private]

Definition at line 33 of file wincvs_winutil.h.

The documentation for this class was generated from the following files:
  • WinCvs/wincvs_winutil.h
  • WinCvs/wincvs_winutil.cpp
Generated on Sun Oct 21 12:51:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


wnt_stat Struct Reference

#include <config.h>

Collaboration diagram for wnt_stat:

[legend]
List of all members.

Public Attributes

_dev_t | st_dev
_ino_t | st_ino
unsigned short | st_mode
short | st_nlink
short | st_uid
short | st_gid
_dev_t | st_rdev
_off_t | st_size
time_t | st_atime
time_t | st_mtime
time_t | st_ctime

Member Data Documentation

time_t wnt_stat::st_atime

Definition at line 84 of file StdAfx.h.

time_t wnt_stat::st_ctime

Definition at line 86 of file StdAfx.h.

_dev_t wnt_stat::st_dev

Definition at line 76 of file StdAfx.h.

short wnt_stat::st_gid

Definition at line 81 of file StdAfx.h.

_ino_t wnt_stat::st_ino

Definition at line 77 of file StdAfx.h.

unsigned short wnt_stat::st_mode

Definition at line 78 of file StdAfx.h.

time_t wnt_stat::st_mtime

Definition at line 85 of file StdAfx.h.

short wnt_stat::st_nlink

Definition at line 79 of file StdAfx.h.

_dev_t wnt_stat::st_rdev

Definition at line 82 of file StdAfx.h.

_off_t wnt_stat::st_size

Definition at line 83 of file StdAfx.h.

short wnt_stat::st_uid

Definition at line 80 of file StdAfx.h.

The documentation for this struct was generated from the following files:
  • cvs-1.10/windows-NT/config.h
  • WinCvs/StdAfx.h
Generated on Sun Oct 21 12:51:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


WrapperEntry Struct Reference

Collaboration diagram for WrapperEntry:

[legend]
List of all members.

Public Attributes

char * | wildCard
char * | tocvsFilter
char * | fromcvsFilter
char * | rcsOption
WrapMergeMethod mergeMethod

Member Data Documentation

char* WrapperEntry::fromcvsFilter

Definition at line 48 of file wrapper.c.

Referenced by has().

WrapMergeMethod WrapperEntry::mergeMethod

Definition at line 50 of file wrapper.c.

char* WrapperEntry::rcsOption

Definition at line 49 of file wrapper.c.

Referenced by has().

char* WrapperEntry::tocvsFilter

Definition at line 47 of file wrapper.c.

Referenced by has().

char* WrapperEntry::wildCard

Definition at line 46 of file wrapper.c.

The documentation for this struct was generated from the following file:
  • cvs-1.10/src/wrapper.c
Generated on Sun Oct 21 12:51:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


std::wstring Class Reference

Inheritance diagram for std::wstring:

[legend]
The documentation for this class was generated from the following file:
  • WinCvs/Win32wstring.hpp
Generated on Sun Oct 21 12:51:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


yy_buffer_state Struct Reference

Collaboration diagram for yy_buffer_state:

[legend]
List of all members.

Public Attributes

FILE * | yy_input_file
char * | yy_ch_buf
char * | yy_buf_pos
yy_size_t yy_buf_size
int | yy_n_chars
int | yy_is_our_buffer
int | yy_is_interactive
int | yy_at_bol
int | yy_fill_buffer
int | yy_buffer_status

Member Data Documentation

int yy_buffer_state::yy_at_bol

Definition at line 178 of file lexer.cc.

char* yy_buffer_state::yy_buf_pos

Definition at line 149 of file lexer.cc.

Referenced by yy_switch_to_buffer().

yy_size_t yy_buffer_state::yy_buf_size

Definition at line 154 of file lexer.cc.

Referenced by yy_get_next_buffer(), and yyunput().

int yy_buffer_state::yy_buffer_status

Definition at line 185 of file lexer.cc.

Referenced by yy_get_next_buffer(), and yylex().

char* yy_buffer_state::yy_ch_buf

Definition at line 148 of file lexer.cc.

Referenced by yy_get_next_buffer(), yyinput(), yylex(), and yyunput().

int yy_buffer_state::yy_fill_buffer

Definition at line 183 of file lexer.cc.

Referenced by yy_get_next_buffer().

FILE* yy_buffer_state::yy_input_file

Definition at line 146 of file lexer.cc.

Referenced by yylex().

int yy_buffer_state::yy_is_interactive

Definition at line 172 of file lexer.cc.

int yy_buffer_state::yy_is_our_buffer

Definition at line 165 of file lexer.cc.

Referenced by yy_get_next_buffer().

int yy_buffer_state::yy_n_chars

Definition at line 159 of file lexer.cc.

Referenced by yy_get_next_buffer(), yy_switch_to_buffer(), yylex(), and yyunput().

The documentation for this struct was generated from the following file:
  • cvstree/lexer.cc
Generated on Sun Oct 21 12:51:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


yystack Struct Reference

Collaboration diagram for yystack:

[legend]
List of all members.

Public Attributes

short * | ssp
YYSTYPE * vsp
short * | ss
YYSTYPE * vs
int | stacksize
short * | sslim

Member Data Documentation

short* yystack::ss

Definition at line 417 of file getdate.c.

Referenced by getdate_yyparse().

short* yystack::sslim

Definition at line 420 of file getdate.c.

Referenced by getdate_yyparse().

short* yystack::ssp

Definition at line 415 of file getdate.c.

Referenced by getdate_yyparse().

int yystack::stacksize

Definition at line 419 of file getdate.c.

YYSTYPE* yystack::vs

Definition at line 418 of file getdate.c.

YYSTYPE* yystack::vsp

Definition at line 416 of file getdate.c.

Referenced by getdate_yyparse().

The documentation for this struct was generated from the following file:
  • cvs-1.10/lib/getdate.c
Generated on Sun Oct 21 12:51:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


YYSTYPE Union Reference

#include <parser.h>

Collaboration diagram for YYSTYPE:

[legend]
List of all members.

Public Attributes

time_t | Number
enum _MERIDIAN | Meridian
char * | string
int | aint
char * | string

Member Data Documentation

enum _MERIDIAN YYSTYPE::Meridian

Definition at line 147 of file getdate.c.

Referenced by LookupWord(), and getdate_yyparse().

time_t YYSTYPE::Number

Definition at line 146 of file getdate.c.

Referenced by LookupWord(), getdate_yylex(), and getdate_yyparse().

int YYSTYPE::aint

Definition at line 3 of file parser.h.

Referenced by yylval_set().

char* YYSTYPE::string

Definition at line 2 of file parser.h.

char* YYSTYPE::string

Definition at line 74 of file parser.cc.

Referenced by yylval_set().

The documentation for this union was generated from the following files:
  • cvs-1.10/lib/getdate.c
  • cvs-1.10/os2/getdate.c
  • cvstree/parser.cc
  • cvstree/parser.h
Generated on Sun Oct 21 12:51:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


yytoktype Struct Reference

Collaboration diagram for yytoktype:

[legend]
List of all members.

Public Attributes

char * | t_name
int | t_val

Member Data Documentation

char* yytoktype::t_name

Definition at line 856 of file getdate.c.

int yytoktype::t_val

Definition at line 856 of file getdate.c.

Referenced by getdate_yyparse().

The documentation for this struct was generated from the following file:
  • cvs-1.10/os2/getdate.c
Generated on Sun Oct 21 12:51:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


z_stream_s Struct Reference

#include <zlib.h>

Collaboration diagram for z_stream_s:

[legend]
List of all members.

Public Attributes

Bytef * next_in
uInt avail_in
uLong total_in
Bytef * next_out
uInt avail_out
uLong total_out
char * | msg
internal_state * state
alloc_func zalloc
free_func zfree
voidpf opaque
int | data_type
uLong adler
uLong reserved

Member Data Documentation

uLong z_stream_s::adler

Definition at line 272 of file zlib.h.

uInt z_stream_s::avail_in

Definition at line 257 of file zlib.h.

uInt z_stream_s::avail_out

Definition at line 261 of file zlib.h.

Referenced by flush(), and len().

int z_stream_s::data_type

Definition at line 271 of file zlib.h.

char* z_stream_s::msg

Definition at line 264 of file zlib.h.

Bytef* z_stream_s::next_in

Definition at line 256 of file zlib.h.

Bytef* z_stream_s::next_out

Definition at line 260 of file zlib.h.

Referenced by flush(), and len().

voidpf z_stream_s::opaque

Definition at line 269 of file zlib.h.

Referenced by td().

uLong z_stream_s::reserved

Definition at line 273 of file zlib.h.

struct internal_state* z_stream_s::state

Definition at line 265 of file zlib.h.

uLong z_stream_s::total_in

Definition at line 258 of file zlib.h.

uLong z_stream_s::total_out

Definition at line 262 of file zlib.h.

alloc_func z_stream_s::zalloc

Definition at line 267 of file zlib.h.

Referenced by td().

free_func z_stream_s::zfree

Definition at line 268 of file zlib.h.

Referenced by td().

The documentation for this struct was generated from the following file:
  • cvs-1.10/zlib/zlib.h
Generated on Sun Oct 21 12:51:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Hierarchical Index

WinCvs 1.3b6 Source Doc Class Hierarchy

Go to the graphical class hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:

  • _afxRichEditCookie
  • _CvsProcess
  • _dircontents
  • _dirdesc
  • _frameRec
  • _IID
  • _linkname
  • _MIDL_PROC_FORMAT_STRING
  • _MIDL_TYPE_FORMAT_STRING
  • _name
  • _SUBIO
  • _TABLE
  • _version
  • _WireHandler
  • _WireMessage
  • addremove_args
  • admin_data
  • admin_file
  • AFX_DLLVERSIONINFO
  • CAllHandlers
  • CAllTargets
  • ansiAttrCvt
    • CTCP2Parse
  • ansiAttrCvt::AnsiSeq
  • AREF
  • aref
  • ASEntry
  • ASFileDates
  • ASFinderInfo
  • ASHeader
  • ASMacInfo
  • Authen
  • AuthenModel
    • AuthenKserver
    • AuthenLocal
    • AuthenNtserver
    • AuthenPserver
    • AuthenRhosts
    • AuthenSSH
  • CAuthenSetUp
  • awidget
  • UBrush
  • CBuffer
  • CButton
    • CCJBrowseButton
    • CCJColorPicker
    • CCJFlatButton
      • CCJCaptionButton
      • CCJCBarButton
      • CPseudoButton
        • CPseudoRotButton
        • CPseudoToggle
    • CCJMetaFileButton
  • change
  • CCJMenuData
  • CCJShellTree
    • CMyShellTree
  • CCJSortClass
  • CCJSortClass::CSortItem
  • CCJTreeCtrl::Color_Font
  • cmd
  • CCmdUI
    • CCJToolCmdUI
  • UCmdUI
  • UCOLOR
  • UColor
  • CColorConsole
  • CComboBox
    • CCJComboBoxEx
    • CCJFlatComboBox
    • CCJFontCombo
  • CComboBoxEx
    • CHistComboBoxEx
    • CToolbarCombo
  • CComCoClass
    • CvsCoworker
  • commit_info
  • CComModule
    • CCVS_CoworkerModule
  • CComObjectRootEx
    • CvsCoworker
  • config_s
  • CContentItems
  • context
  • CControlBar
    • CCJControlBar
      • CBarConsole
      • CCJExplorerBar
      • CCJTabCtrlBar
    • CCJToolBarBase
      • CCJReBar
      • CCJToolBar
        • CCJMenuBar
  • ct_data_s
  • CCtrlView
    • CCJTabView
  • cvs_MD5Context
  • CCvsConsole
    • CGraphConsole
    • CPyCvsConsole
    • CRevisionConsole
    • CStreamConsole
    • CTCLCvsConsole
  • CCvsThreadLock
  • datelist
  • UDC
  • deltatext
  • CDestroyThreadLock
  • CDialog
    • CAboutDlg
    • CCustomizeMenus
    • CNoPython
    • CProgressDialog
    • CPseudoDlg
    • CTipDlg
  • diff3_block
  • diff_block
  • diff_callbacks
  • dirdata
  • direct
  • dirent
  • CDockBar
    • CCJDockBar
    • CCJSizeDockBar
  • CDockContext
    • CCJDockContext
  • CDocument
    • CGraphDoc
    • CWincvsDoc
  • DROPDOWNBUTTON
  • CDummyClass
  • DYN_LIST
  • CEdit
    • CCJBrowseEdit
    • CCJHexEdit
    • CCJMaskEdit
      • CCJDateEdit
        • CCJTimeEdit
    • CGfxGroupEdit
    • CTbEdit
  • ENTNODE
  • entnode
  • EntnodeData
    • EntnodeFile
    • EntnodeFolder
  • EntnodePath
  • equivclass
  • err_strs
  • error_info
  • EXHCB
  • fatdef
  • fchdef
  • file_data
  • file_info
  • file_list_str
  • FileEntry
  • fjndef
  • CFormView
    • CCJHtmlView
  • frame_and_entries
  • frame_and_file
  • CFrameWnd
    • CCJFrameWnd
  • garbyRec
  • CGfxOutBarCtrl::CBarFolder
  • CGfxOutBarCtrl::CBarItem
  • GPT_CONSOLE
  • GPT_GETENV
  • GPT_QUIT
  • group
  • gusilsh_ctx
  • gz_stream
  • hardlink_info
  • CHARFORMAT
    • CCharFormat
  • CHeaderCtrl
    • CCJFlatHeaderCtrl
    • CSortHeaderCtrl
  • HQXDecodeVars
  • HQXEncodeVars
  • hrec
  • ICvsCoworker
    • CvsCoworker
  • inflate_blocks_state
  • inflate_codes_state
  • inflate_huft_s
  • internal_state
  • IOSB
  • irciiAttrCvt
    • CTCP2Parse
  • ISupportErrorInfo
    • CvsCoworker
  • CJX_COLORMAP
  • CJX_CONTROLPOS
  • KiColumn
    • KoConflictColumn
    • KoDateColumn
    • KoNameColumn
    • KoOptionColumn
    • KoPathColumn
    • KoRevisionColumn
    • KoStatusColumn
    • KoTagColumn
  • KiColumnModel
    • KoRecursiveModel
    • KoRegularModel
  • KiFilterModel
    • KoFilterModel
  • KiIgnoreModel
    • KoIgnoreModel
  • KiRecursionModel
    • KoRecursionModel
  • KiSelectionHandler
    • KoAddBinaryHandler
    • KoAddHandler
    • KoAnnotateHandler
    • KoBranchTagHandler
    • KoCommitHandler
    • KoCreateTagHandler
    • KoDeleteTagHandler
    • KoDiffHandler
    • KoEditHandler
    • KoEditorsHandler
    • KoFileRemoveHandler
    • KoGraphHandler
    • KoLockHandler
    • KoLogHandler
    • KoMoveToTrashHandler
    • KoQueryUpdateHandler
    • KoReleaseHandler
    • KoStatusHandler
    • KoUneditHandler
    • KoUnlockHandler
    • KoUpdateHandler
    • KoUpdateMoveToTrashHandler
    • KoWatchersHandler
    • KoWatchOffHandler
    • KoWatchOnHandler
  • KoColumnContext
  • KoTraversalContext
  • KoWatcher
  • LAttachment
    • LMainPseudoAttachment
    • LPseudoDrawAttachment
    • LPseudoWinAttachment
    • UPseudoPageHider
  • LBevelButton
    • UPseudoRotButton
  • LCommander
    • CMacBinTable
  • linevector
  • list
  • list3
  • ULIST_INFO
  • ULIST_INSERT
  • CListBox
    • CCJListBox
    • CCJOutlookBar
  • CListCtrl
    • CCJListCtrl
    • CPseudoList
  • CListView
    • CBrowseFileView
    • CCJListView
  • LListener
    • LPseudoWinAttachment
    • UPseudoPageHider
    • UPseudoPlaceHolder
  • LOCK
  • lock
  • log_data
  • log_data_and_rcs
  • logfile_info
  • CLogNode
    • CLogNodeBranch
    • CLogNodeHeader
    • CLogNodeRev
    • CLogNodeTag
  • CLogNodeData
    • CWinLogData
      • CWinLogBranchData
      • CWinLogBranchData
      • CWinLogHeaderData
      • CWinLogHeaderData
      • CWinLogRevData
      • CWinLogRevData
      • CWinLogTagData
      • CWinLogTagData
    • CWinLogData
  • CLogStr
  • LOutlineItem
    • CMacBinItem
    • CPseudoItem
  • LOutlineTable
    • CMacBinTable
  • LPane
    • UPseudoFakePane
  • LPeriodical
    • LMainPseudoAttachment
  • LPlaceHolder
    • UPseudoPlaceHolder
  • LV_COLUMN
  • MACBINMAP
  • MACBINMAPENTRIES
  • MacBinMaps
    • PMacBinMaps
  • CMacroEntry
  • CMacroSet
  • CMapPtrToPtr
    • CSubclassWndMap
  • master_lists
  • CMDIChildWnd
    • CCJMDIChildWnd
      • CGraphFrame
      • CLogFrame
  • CMDIFrameWnd
    • CCJMDIFrameWnd
      • CMainFrame
  • CMemFile
    • CCJMemFile
  • CMenu
    • CCJMenu
  • UMessageMapFunctions
  • CMiniDockFrameWnd
    • CCJMiniDockFrameWnd
  • mircAttrCvt
    • CTCP2Parse
  • CMsg
  • msg
  • UMSGMAP
  • UMSGMAP_ENTRY
  • MultiFiles
  • MultiFilesEntry
  • node
  • NotificationManager
  • NotificationManager::Node
  • CObject
    • CCJStatusBarPane
    • CCJStatusBarPaneControlInfo
    • CSubclassWnd
      • CCJMenuBarFrameHook
  • UObject
    • CPersistent
      • CMMenuString
      • CPersistentT< T >
      • CPersistentT< bool >
        • CPersistentBool
      • CPersistentT< int >
        • CPersistentInt
      • CWinPlacement
      • PCPStr
      • PCStr
      • PMacBinMaps
      • TMPersistent< T >
      • TMString< T >
      • TMString< UPStr >
        • CMPString
      • TMString< UStr >
        • CMString
          • CKeyString
    • UCmdTarget
      • UWidget
        • UAuthen_Kserver
        • UAuthen_Pserver
        • UAuthen_Rhosts
        • UAuthen_SSH
        • UCvsApp
        • UCvsConsole
        • UCvsFiles
        • UCvsFolders
        • UCvsFrame
        • UCvsGraph
        • UMenu
          • UCvsMenubar
          • UMacAppMenu
          • UPPMenu
        • UPromptMessage
          • UEditMessage
        • USaveSettings
        • UToolbar
          • UCvsToolbar
  • ColorTableEntry
  • option
  • option_revlist
  • OUTBAR_INFO
  • partition
  • passwd
  • UPen
  • CPersistent::CPersistentEntry
  • pid_list
  • PIPE
  • UPOINT
    • UPoint
  • poolRec
  • CProgress
  • CPropertySheet
    • COptionalPropertySheet
  • UPseudoCmdStatusWrapper
  • UPStr
    • PCPStr
  • PyAutoObject< T >
  • PyCmdUI::obj_t
  • PyColorConsole::obj_t
  • PyContainer
    • PyCmdUI
    • PyColorConsole
    • PyCvsEntry
    • PyMenuMgr
    • PyPersistent
  • PyCvsEntry::obj_t
  • PyMenuMgr::obj_t
  • PyPersistent::obj_t
  • PyRegistry
  • CPython_Interp
  • CPyThreadState
  • rcsbuffer
  • CRcsFile
  • rcsnode
  • rcsversnode
  • re_pattern_buffer
  • re_registers
  • URECT
    • URect
  • CRectTracker
    • CGraphRectTracker
  • recursion_frame
  • CRecursionLock
  • regexp_list
  • regmatch_t
  • ReportConflict
  • ReportWarning
  • request
  • response
  • CRevFile
  • revlist
  • CRevNumber
  • CRichEditView
    • CWincvsView
  • URuntimeClass
  • S_Dir
  • S_NAME
  • saved_cwd
  • CScrollView
    • CGraphView
  • USemaphore
  • SIG_hlist
  • USIZE
    • USize
  • USLIDER
  • CSortList< T >
  • CSortParam
  • sortrec
  • CSplitterWnd
    • CCJFlatSplitterWnd
    • CGfxSplitterWnd
  • CStackThreadLock
  • CStatic
    • CCJCaption
    • CCJHyperLink
    • CColorStatic
    • CPseudoDraw
  • static_tree_desc_s
  • CStaticAllocT< T >
  • CStaticAllocT< char >
  • CStatusBar
    • CCJStatusBar
    • CCvsStatusBar
  • stickydirtag
  • UStr
    • PCStr
  • CTabCtrl
    • CCJTabCtrl
  • TAdorner
    • TPseudoWinAdorner
  • tag_info
  • tagAFX_OLDTOOLINFO
  • tagCTV_ITEM
  • tagMENUITEMINFOA
    • CMenuItemInfo
  • tagTCB_ITEM
  • UTB_BUTTON
  • UTB_DROPDOWN
  • UTB_INIT
  • TBehavior
    • TPseudoAppBehavior
    • TPseudoWinBehavior
  • TbEntry
    • TbEntryButton
      • TbEntryChkButton
    • TbEntryDropDown
    • TbEntrySeparator
  • CTcl_Interp
  • CTCLBrowserEnt
  • CTCP2Parse::RGBColor
  • TEditText
    • TPseudoDoubleNumberText
  • CTempToggleBool
  • TGraph
    • TGraphCmdStatus
    • TGraphDelCmd
    • TGraphRectSelect
    • TGraphSelNonSig
  • TIconButton
    • TPseudoIconButton
      • TPseudoRotateIconButton
  • TIconCheckBox
    • TPseudoIconCheckBox
  • TIconPopup
    • TPseudoIconPopup
  • timeb
  • UTimer
  • CTmpFiles
  • CToolBarCtrl
    • CCJToolBarCtrl
  • CToolBarData
  • TOOLBARINFO
  • TPopup
    • TBuggyPopup
  • TraversalReport
    • CFillPyEntries
    • CFillTclEntries
    • CFindSettings
    • ImportReport
    • MacroTraversal
    • TBrowserFill
    • TBrowserFill
    • TBrowserFillDummy
    • TBrowserFillDummy
    • TViewFill
    • TViewFill
  • tree_desc_s
  • UTREE_INFO
  • UTREE_INSERT
  • CTreeCtrl
    • CCJTreeCtrl
  • CTreeView
    • CWinCvsBrowser
  • TScrollBar
    • TPseudoScrollBar
  • TTextListView
    • TPseudoTextListView
  • CTurnOffDispatching
  • TView
    • TPseudoCustomView
  • unreaped
  • unrecog
  • CustInvertTable
  • utimbuf
  • vector
    • CCustInvertTable
  • vers_ts
  • CView
    • CBrowserBar
    • CExploreBar
  • CViewInfo
  • VMS_DIR
  • VMStimbuf
  • CvsArgs
    • AddBinCvsArgs
    • AddCvsArgs
    • RemoveCvsArgs
  • CvsFilenames
  • CvsPrefs
  • CvsProcessCallbacks
  • CvsProject
  • CvsString
  • CvsTrace
  • Vstring
  • UWaitCursor
  • CWinApp
    • CWincvsApp
  • CWinCvsBrowser::CSelectionChangeNotifier
  • WINDOWPLACEMENT
    • CCJWindowPlacement
  • WININFO
  • CWinThread
    • CLogoutThread
  • CWnd
    • CCJCaptionPopupWnd
    • CCJColorPopup
    • CCJDateTimeCtrl
    • CCJFlatTabCtrl
    • CCJLogoPane
    • CCJMonthCalCtrl
    • CCJPagerCtrl
    • CCJReBarCtrl
    • CGfxOutBarCtrl
    • CSplashWnd
  • CWndRedrawMngr
  • wnt_stat
  • WrapperEntry
  • wstring
    • Win32wstring
  • yy_buffer_state
  • yystack
  • YYSTYPE
  • yytoktype
  • z_stream_s
Generated on Sun Oct 21 12:45:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Compound Member Index

WinCvs 1.3b6 Source Doc Compound Members

_ | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z | ~

Here is a list of all class members with links to the class documentation for each member:

- _ -

  • __pad0__ : fchdef
  • __pad1__ : fchdef
  • _AddBar() : CCJReBar
  • _AddButton() : PyMenuMgr
  • _AddPulldown() : PyMenuMgr
  • _AddSeparator() : PyMenuMgr
  • _AddToggle() : PyMenuMgr
  • _afxRichEditCookie() : _afxRichEditCookie
  • _Count() : PyMenuMgr
  • _d_entry : _dircontents
  • _d_next : _dircontents
  • _Delete() : PyMenuMgr
  • _DeleteByCmd() : PyMenuMgr
  • _Enable() : PyCmdUI
  • _GetBaseClass() : UObject
  • _GetValue() : PyPersistent
  • _in : ansiAttrCvt
  • _messageEntries : UWidget, UToolbar, UMenu, UCmdTarget, UMacAppMenu, UCvsToolbar, UCvsMenubar, UCvsGraph, UCvsFrame, UCvsFolders, UCvsFiles, UCvsConsole, UCvsApp, USaveSettings, UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver, UAuthen_SSH, UEditMessage, UPromptMessage
  • _notOf : ansiAttrCvt::AnsiSeq
  • _params : ansiAttrCvt::AnsiSeq
  • _Print() : PyColorConsole
  • _seq : ansiAttrCvt, ansiAttrCvt::AnsiSeq
  • _SetCheck() : PyCmdUI
  • _SetText() : PyCmdUI
  • _SetValue() : PyPersistent
  • _verb : ansiAttrCvt::AnsiSeq

- a -
  • a_link : EXHCB
  • a_status : EXHCB
  • ac : admin_data
  • access : rcsnode, ASFileDates
  • AccessList() : CRcsFile
  • accessList : CRcsFile
  • actime : VMStimbuf, utimbuf
  • ActivateBrowserView() : CWincvsApp
  • ActivateSelf() : UPseudoFakePane
  • AdaptToSuperFrameSize() : UPseudoFakePane
  • Add() : CSubclassWndMap, CMacroSet
  • add() : MultiFiles, MultiFilesEntry, CvsArgs
  • add_tcommit : addremove_args
  • add_tedit : addremove_args
  • add_tunedit : addremove_args
  • AddBar() : CCJReBar
  • AddBinCvsArgs() : AddBinCvsArgs
  • AddBitmapToImageList() : CCJMenu
  • AddButton() : PyMenuMgr
  • AddButtons() : CCJToolBar
  • AddColumn() : CCJListView, CCJListCtrl
  • AddColumns() : CBrowseFileView
  • AddControl() : CCJStatusBar, CvsPrefs
  • AddCvsArgs() : AddCvsArgs
  • AddDropDownButton() : CCJToolBar
  • AddEntry() : MacBinMaps
  • addfile() : RemoveCvsArgs, AddBinCvsArgs, AddCvsArgs, CvsArgs
  • AddFiles() : CvsCoworker
  • addFiles() : CvsProject
  • AddFolder() : CGfxOutBarCtrl
  • AddFolderBar() : CGfxOutBarCtrl
  • AddFromToolBar() : CCJMenu
  • AddIndicator() : CCJStatusBar
  • adding : addremove_args
  • AddListener() : UWidget
  • AddPage() : UWidget
  • AddPattern() : ReportConflict
  • AddPulldown() : PyMenuMgr
  • AddReplaceBitmap() : CCJToolBar
  • AddSeparator() : PyMenuMgr
  • AddString() : CHistComboBoxEx, CCJComboBoxEx
  • AddStrings() : CCJToolBar
  • AddTimer() : UWidget
  • AddToggle() : PyMenuMgr
  • AddTooltip() : UWidget
  • AddToolTip() : CCJTabCtrlBar
  • AddView() : CCJTabView, CCJTabCtrlBar
  • AddWarning() : ReportWarning
  • AdjustSize() : CStaticAllocT< T >
  • adler : z_stream_s
  • aflag : recursion_frame, stickydirtag
  • aint : YYSTYPE
  • allDigits : CRevNumber
  • allfiles : CTmpFiles
  • alloc_lines : file_data
  • allocated : re_pattern_buffer
  • AllRevs() : CRcsFile
  • allRevs : CRcsFile
  • AlwaysUseCvsroot() : CvsPrefs
  • AnimateFolderScroll() : CGfxOutBarCtrl
  • ansi2ctcp() : ansiAttrCvt
  • AnsiSeq() : ansiAttrCvt::AnsiSeq
  • append() : CBuffer
  • Append() : CCJMemFile
  • AppendMenuA() : CCJMenu
  • AppendMenuW() : CCJMenu
  • AppendODMenuA() : CCJMenu
  • AppendODMenuW() : CCJMenu
  • AppendODPopupMenuA() : CCJMenu
  • AppendODPopupMenuW() : CCJMenu
  • aref() : aref
  • arFolder : CGfxOutBarCtrl
  • arg1 : msg
  • arg2 : msg
  • arg3 : msg
  • arg4 : msg
  • argc : _CvsProcess, CvsArgs
  • Argc() : CvsArgs
  • args : _CvsProcess
  • argv : CvsArgs
  • Argv() : CvsArgs
  • arItems : CGfxOutBarCtrl::CBarFolder
  • AskForQuitting() : UCvsFrame
  • AssociateImageIndexWithRuntimeClass() : CCJTabCtrlBar
  • at_string : rcsbuffer
  • Authen() : Authen
  • AuthenKserver() : AuthenKserver
  • AuthenLocal() : AuthenLocal
  • AuthenModel() : AuthenModel
  • AuthenNtserver() : AuthenNtserver
  • AuthenPserver() : AuthenPserver
  • AuthenRhosts() : AuthenRhosts
  • AuthenSSH() : AuthenSSH
  • author : CRevFile, rcsversnode
  • Author() : CRevFile
  • authorlist : log_data
  • AutoSaveColumns() : CCJListView, CCJListCtrl
  • AutoSize() : CCJToolBar
  • AutoSizeColumn() : CCJListView, CCJListCtrl
  • av : admin_data
  • av_alloc : admin_data
  • avail_in : z_stream_s
  • avail_out : z_stream_s
  • awidget() : awidget

- b -
  • b : UColor, UCOLOR
  • B : CTCP2Parse::RGBColor
  • b_bktsize : fatdef
  • b_namecount : _name
  • b_rattrib : fatdef
  • b_rtype : fatdef
  • b_vfcsize : fatdef
  • backup : ASFileDates
  • BAD : internal_state
  • BADCODE : inflate_codes_state
  • Base : inflate_huft_s
  • bb : inflate_blocks_state
  • bDownArrow : CGfxOutBarCtrl
  • bDownPressed : CGfxOutBarCtrl
  • BeforeNavigate2() : CCJHtmlView
  • BeforeUpdateUI() : UWidget
  • begin() : TMString< T >
  • BeginDrag() : CCJReBarCtrl
  • bEscapeKey : CGfxGroupEdit
  • bg : CTCP2Parse
  • bgColorMap : ansiAttrCvt
  • bgDef : CTCP2Parse
  • bgLast : CTCP2Parse
  • bi_buf : internal_state
  • bi_valid : internal_state
  • bitb : inflate_blocks_state
  • bitk : inflate_blocks_state
  • bitmap : CCJMenuData, awidget, AREF
  • bits : cvs_MD5Context
  • Bits : inflate_huft_s
  • bl_count : internal_state
  • bl_desc : internal_state
  • bl_tree : internal_state
  • Black : CTCP2Parse
  • blens : inflate_blocks_state
  • blink : ansiAttrCvt
  • blinkCnt : CTCP2Parse
  • blinkLast : CTCP2Parse
  • block_start : internal_state
  • blocks : internal_state
  • BLOCKS : internal_state
  • bLooping : CGfxOutBarCtrl
  • Blue : CTCP2Parse
  • bNoDown : CGfxGroupEdit
  • body : Vstring
  • bold : UCvsConsole, ansiAttrCvt
  • boldCnt : CTCP2Parse
  • boldLast : CTCP2Parse
  • bottom : URECT
  • BottomRight() : URect
  • Bounds() : CWinLogData
  • bPressedHighlight : CGfxOutBarCtrl
  • branch : CLogNodeBranch, rcsnode, admin_data
  • branches : rcsversnode
  • BranchesList() : CRevFile
  • branchesList : CRevFile
  • branchhead : option_revlist
  • BranchRev() : CRcsFile
  • branchRev : CRcsFile
  • brdrAllRaised : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • brdrFlatAll : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • brdrFlatBottom : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • brdrFlatHorizontal : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • brdrFlatLeft : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • brdrFlatRight : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • brdrFlatTop : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • brdrFlatVertical : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • Browser() : CvsPrefs
  • btns : UTB_DROPDOWN
  • btnText : TOOLBARINFO
  • bTRACE : CCJMenuBar
  • buf : cvs_MD5Context, regexp_list, CStaticAllocT< T >
  • buffer : list3, re_pattern_buffer, file_data
  • buffered_chars : file_data
  • buffered_lines : file_data
  • buflen : list3
  • bufsize : file_data
  • BuildColumns() : CCJListView, CCJListCtrl
  • bUpArrow : CGfxOutBarCtrl
  • bUpPressed : CGfxOutBarCtrl
  • bWhiteLine : CGfxSplitterWnd

- c -
  • c : _IID
  • c_bShowSplashWnd : CSplashWnd
  • c_pSplashWnd : CSplashWnd
  • c_str() : UStr, UPStr, CRevNumber, CLogStr
  • CAboutDlg() : CAboutDlg
  • CalcDynamicLayout() : CCJToolBar, CCJSizeDockBar, CCJReBar, CCJControlBar
  • CalcFixedLayout() : CCJToolBar, CCJReBar, CCJMenuBar, CCJDockBar
  • CalcImageSize() : CGraphView, UCvsGraph
  • CalcInsideRect() : CCJToolBarBase
  • CalcLayout() : CCJToolBar
  • CalcPos() : CCJHexEdit
  • CalcSize() : CCJToolBar
  • CalcSizeBarLayout() : CCJSizeDockBar
  • CalcViewRect() : CCJTabView
  • callbacks : _CvsProcess
  • callerdat : recursion_frame
  • CAllHandlers() : CAllHandlers
  • CallInitValues() : PyRegistry
  • CAllTargets() : CAllTargets
  • can_be_null : re_pattern_buffer
  • CancelMenuAndTrackNewOne() : CCJMenuBar
  • CanContinue() : UCmdUI
  • CanDockDockBar() : CCJDockContext
  • CanPaste() : CWincvsView
  • CAuthenSetUp() : CAuthenSetUp
  • CBarConsole() : CBarConsole
  • CBarFolder() : CGfxOutBarCtrl::CBarFolder
  • CBarItem() : CGfxOutBarCtrl::CBarItem
  • CBrowseFileView() : CBrowseFileView
  • CBrowserBar() : CBrowserBar
  • cbSize : tagAFX_OLDTOOLINFO, AFX_DLLVERSIONINFO
  • CBuffer() : CBuffer
  • CCharFormat() : CCharFormat
  • CCJBrowseButton() : CCJBrowseButton
  • CCJBrowseEdit() : CCJBrowseEdit
  • CCJCaption() : CCJCaption
  • CCJCaptionPopupWnd() : CCJCaptionPopupWnd
  • CCJColorPicker() : CCJColorPicker
  • CCJColorPopup() : CCJColorPopup
  • CCJComboBoxEx() : CCJComboBoxEx
  • CCJControlBar() : CCJControlBar
  • CCJDateEdit() : CCJDateEdit
  • CCJDateTimeCtrl() : CCJDateTimeCtrl
  • CCJDockBar() : CCJDockBar
  • CCJDockContext() : CCJDockContext
  • CCJExplorerBar() : CCJExplorerBar
  • CCJFlatButton() : CCJFlatButton
  • CCJFlatComboBox() : CCJFlatComboBox
  • CCJFlatHeaderCtrl() : CCJFlatHeaderCtrl
  • CCJFlatHeaderCtrl::GetItemCount() : CCJFlatHeaderCtrl
  • CCJFlatSplitterWnd() : CCJFlatSplitterWnd
  • CCJFlatTabCtrl() : CCJFlatTabCtrl
  • CCJFontCombo() : CCJFontCombo
  • CCJFrameWnd() : CCJFrameWnd
  • CCJHexEdit() : CCJHexEdit
  • CCJHtmlView() : CCJHtmlView
  • CCJHyperLink() : CCJHyperLink
  • CCJListBox() : CCJListBox
  • CCJListCtrl() : CCJListCtrl
  • CCJListView() : CCJListView
  • CCJLogoPane() : CCJLogoPane
  • CCJMaskEdit() : CCJMaskEdit
  • CCJMDIChildWnd() : CCJMDIChildWnd
  • CCJMDIFrameWnd() : CCJMDIFrameWnd
  • CCJMDIFrameWnd::InitializeMenu() : CCJMDIFrameWnd
  • CCJMemFile() : CCJMemFile
  • CCJMenu() : CCJMenu
  • CCJMenu::DeleteMenuList() : CCJMenu
  • CCJMenu::FindMenuList() : CCJMenu
  • CCJMenu::InitializeMenuList() : CCJMenu
  • CCJMenuBar : CCJMenuBar, CCJMenuBarFrameHook
  • CCJMenuBarFrameHook : CCJMenuBarFrameHook, CCJMenuBar
  • CCJMenuData() : CCJMenuData
  • CCJMetaFileButton() : CCJMetaFileButton
  • CCJMiniDockFrameWnd() : CCJMiniDockFrameWnd
  • CCJMonthCalCtrl() : CCJMonthCalCtrl
  • CCJOutlookBar() : CCJOutlookBar
  • CCJPagerCtrl() : CCJPagerCtrl
  • CCJReBar() : CCJReBar
  • CCJReBarCtrl() : CCJReBarCtrl
  • CCJSizeDockBar() : CCJSizeDockBar
  • CCJSortClass() : CCJSortClass
  • CCJStatusBar() : CCJStatusBar
  • CCJStatusBarPane() : CCJStatusBarPane
  • CCJStatusBarPaneControlInfo() : CCJStatusBarPaneControlInfo
  • CCJTabCtrl() : CCJTabCtrl
  • CCJTabCtrlBar() : CCJTabCtrlBar
  • CCJTabView() : CCJTabView
  • CCJTimeEdit() : CCJTimeEdit
  • CCJToolBar() : CCJToolBar
  • CCJToolBarBase() : CCJToolBarBase
  • CCJToolBarCtrl() : CCJToolBarCtrl
  • CCJTreeCtrl() : CCJTreeCtrl
  • CCJWindowPlacement() : CCJWindowPlacement
  • CColorConsole() : CColorConsole
  • CColorStatic() : CColorStatic
  • CContentItems() : CContentItems
  • CCustInvertTable() : CCustInvertTable
  • CCustomizeMenus() : CCustomizeMenus
  • CCvsStatusBar() : CCvsStatusBar
  • CCvsThreadLock() : CCvsThreadLock
  • CDestroyThreadLock() : CDestroyThreadLock
  • CDockBar : CCJMiniDockFrameWnd
  • CDummyClass() : CDummyClass
  • CenterPoint() : URect
  • CExploreBar() : CExploreBar
  • CFillPyEntries() : CFillPyEntries
  • CFillTclEntries() : CFillTclEntries
  • CFindSettings() : CFindSettings
  • CGfxGroupEdit() : CGfxGroupEdit
  • CGfxOutBarCtrl() : CGfxOutBarCtrl
  • CGfxSplitterWnd() : CGfxSplitterWnd
  • CGraphConsole() : CGraphConsole
  • CGraphDoc() : CGraphDoc
  • CGraphFrame() : CGraphFrame
  • CGraphRectTracker() : CGraphRectTracker
  • CGraphView() : CGraphView
  • chan : PIPE
  • changed_flag : file_data
  • ChangeLocation() : CMainFrame
  • ChangeSelection() : CCJColorPopup
  • char : _name
  • CharSpacingType : CTCP2Parse
  • Check() : UCmdUI
  • check : inflate_blocks_state, internal_state
  • CHECK1 : internal_state
  • CHECK2 : internal_state
  • CHECK3 : internal_state
  • CHECK4 : internal_state
  • CheckButton() : CCJToolBar
  • CheckChanges() : CBrowseFileView
  • CheckChar() : CCJMaskEdit
  • checked_out : hardlink_info
  • checkfn : inflate_blocks_state
  • CheckIn() : NotificationManager
  • CheckinFiles() : CvsCoworker
  • checkinFiles() : CvsProject
  • checkmaps : CCJMenu
  • checkmapsshare : CCJMenu
  • CheckOut() : NotificationManager
  • CheckoutFiles() : CvsCoworker
  • checkoutFiles() : CvsProject
  • CheckoutRO() : CvsPrefs
  • CheckTextColor() : CCJColorPicker
  • CheckWindowSize() : LPseudoWinAttachment
  • ChgNeg() : CRevFile
  • chgNeg : CRevFile
  • ChgPos() : CRevFile
  • chgPos : CRevFile
  • child : UTREE_INFO
  • Childs() : CLogNode
  • childs : CLogNode
  • CHistComboBoxEx() : CHistComboBoxEx
  • cilist : master_lists
  • cItem : CGfxOutBarCtrl::CBarItem
  • CKeyString() : CKeyString
  • class_ID : UPseudoPageHider, UPseudoPlaceHolder, UPseudoRotButton, CMacBinTable
  • classUObject : UObject
  • ClearSelection() : CCJTreeCtrl
  • CLogFrame() : CLogFrame
  • CLogNode() : CLogNode
  • CLogNodeBranch() : CLogNodeBranch
  • CLogNodeData() : CLogNodeData
  • CLogNodeHeader() : CLogNodeHeader
  • CLogNodeRev() : CLogNodeRev
  • CLogNodeTag() : CLogNodeTag
  • CLogoutThread() : CLogoutThread
  • CLogStr() : CLogStr
  • Close() : CCJMemFile
  • CloseProject() : CvsCoworker
  • closeProject() : CvsProject
  • ClosePythonSupport() : CPython_Interp
  • CloseSplashScreen() : CSplashWnd
  • CMacBinItem() : CMacBinItem
  • CMacBinTable() : CMacBinTable
  • CMacroEntry() : CMacroEntry
  • CMacroSet() : CMacroSet
  • CMainFrame() : CMainFrame
  • cmd : CustInvertTable, awidget, UTB_BUTTON
  • CMenuItemInfo() : CMenuItemInfo
  • CMMenuString() : CMMenuString
  • cmp() : CRevNumber
  • CMPString() : CMPString
  • CMsg() : CMsg
  • CMString() : CMString
  • cName : CGfxOutBarCtrl::CBarFolder
  • CNoPython() : CNoPython
  • cnt : AREF
  • code : inflate_codes_state, ct_data_s, GPT_QUIT
  • codes : inflate_blocks_state
  • col : ULIST_INFO, ULIST_INSERT, UCvsConsole
  • color : CCJTreeCtrl::Color_Font
  • ColorType : CTCP2Parse
  • CommandToIndex() : CCJToolBar
  • comment : rcsnode, sortrec, admin_data
  • commit : addremove_args
  • compare() : UStr
  • Compare() : CCJSortClass, CKeyString, TMString< T >, ENTNODE, EntnodeData, KiColumn, KoConflictColumn, KoDateColumn, KoTagColumn, KoStatusColumn, KoOptionColumn, KoRevisionColumn, KoPathColumn, KoNameColumn
  • compressed_len : internal_state
  • ComputeBounds() : CWinLogData
  • ComputeMenuTrackPoint() : CCJMenuBar
  • Concatenate() : CKeyString
  • conflict : entnode
  • conflicts : ImportReport
  • consoleerr : CvsProcessCallbacks
  • consoleout : CvsProcessCallbacks
  • contents : admin_file
  • context : VMS_DIR
  • convert() : Win32wstring
  • COptionalPropertySheet() : COptionalPropertySheet
  • copy : inflate_codes_state
  • COPY : inflate_codes_state
  • CopyRect() : URect
  • CopyReturn() : PyAutoObject< T >
  • CopyRow() : CCJListView, CCJListCtrl
  • correspond : diff3_block
  • Count() : PyMenuMgr
  • count : IOSB
  • cp : CTCP2Parse
  • cpDef : CTCP2Parse
  • CPersistent() : CPersistent
  • CPersistentBool() : CPersistentBool
  • CPersistentInt() : CPersistentInt
  • CPersistentT() : CPersistentT< T >
  • cpLast : CTCP2Parse
  • CProgress() : CProgress
  • CProgressDialog() : CProgressDialog
  • CPseudoButton() : CPseudoButton
  • CPseudoDlg() : CPseudoDlg
  • CPseudoDraw() : CPseudoDraw
  • CPseudoItem() : CPseudoItem
  • CPseudoList() : CPseudoList
  • CPseudoRotButton() : CPseudoRotButton
  • CPseudoToggle() : CPseudoToggle
  • CPyCvsConsole() : CPyCvsConsole
  • CPython_Interp() : CPython_Interp
  • CPyThreadState() : CPyThreadState
  • cr3dFace : CGfxOutBarCtrl
  • crBackGroundColor : CGfxOutBarCtrl
  • crBackGroundColor1 : CGfxOutBarCtrl
  • crc : gz_stream
  • crColor : ColorTableEntry
  • CRcsFile() : CRcsFile
  • crDkShadowBorder : CGfxOutBarCtrl
  • Create() : CWinCvsBrowser, CToolbarCombo, CSplashWnd, CProgressDialog, CExploreBar, CGfxOutBarCtrl, CCJToolBarCtrl, CCJToolBar, CCJTabCtrl, CCJReBarCtrl, CCJReBar, CCJPagerCtrl, CCJMiniDockFrameWnd, CCJMenuBar, CCJLogoPane, CCJHtmlView, CCJHexEdit, CCJExplorerBar, CCJMonthCalCtrl, CCJDateTimeCtrl, CCJControlBar, CCJComboBoxEx, CCJColorPopup, CCJCaptionPopupWnd, CCJCaption, CCJBrowseButton, CBrowserBar, PyPersistent, PyCmdUI, PyMenuMgr, PyColorConsole, PyCvsEntry
  • create : ASFileDates
  • CreateAddressCaret() : CCJHexEdit
  • CreateEditCaret() : CCJHexEdit
  • CreateEx() : CCJToolBar, CCJMenuBar
  • CreateNewData() : CWinLogData
  • CreateObject() : UObject, URuntimeClass
  • CreatePen() : UPen
  • CreateSolidBrush() : UBrush
  • CreateTabFont() : CCJFlatTabCtrl
  • CreateTabListItem() : CCJTabCtrlBar
  • CreateTabView() : CCJTabCtrlBar
  • CreateToolTips() : CCJColorPopup
  • CRecursionLock() : CRecursionLock
  • CRevFile() : CRevFile
  • CRevisionConsole() : CRevisionConsole
  • CRevNumber() : CRevNumber
  • crHilightBorder : CGfxOutBarCtrl
  • crLightBorder : CGfxOutBarCtrl
  • crShadowBorder : CGfxOutBarCtrl
  • crTextColor : CGfxOutBarCtrl
  • CSelectionChangeNotifier : CWinCvsBrowser::CSelectionChangeNotifier, CWinCvsBrowser
  • CSortHeaderCtrl() : CSortHeaderCtrl
  • CSortItem() : CCJSortClass::CSortItem
  • CSortList() : CSortList< T >
  • CSortParam() : CSortParam
  • CSplashWnd() : CSplashWnd
  • CStackThreadLock() : CStackThreadLock
  • CStaticAllocT() : CStaticAllocT< T >
  • CStreamConsole() : CStreamConsole
  • CSubclassWnd() : CSubclassWnd
  • CSubclassWndMap : CSubclassWndMap, CSubclassWnd
  • CTbEdit() : CTbEdit
  • CTcl_Interp() : CTcl_Interp
  • CTCLBrowserEnt() : CTCLBrowserEnt
  • CTCLCvsConsole() : CTCLCvsConsole
  • CTCP2Parse() : CTCP2Parse
  • CTempToggleBool() : CTempToggleBool
  • cText : OUTBAR_INFO
  • CTipDlg() : CTipDlg
  • CtlColor() : CCJHyperLink
  • CToolbarCombo() : CToolbarCombo
  • CTurnOffDispatching() : CTurnOffDispatching
  • cur_ent : S_Dir
  • current : TbEntryDropDown, DYN_LIST
  • Customize() : CCJToolBar
  • cvs_err() : CRevisionConsole, CGraphConsole, CTCLCvsConsole, CPyCvsConsole, CCvsConsole, CStreamConsole
  • cvs_out() : CRevisionConsole, CGraphConsole, CTCLCvsConsole, CPyCvsConsole, CCvsConsole, CStreamConsole
  • CvsArgs() : CvsArgs
  • CvsConsole() : CvsPrefs
  • CvsCoworker() : CvsCoworker
  • CvsFilenames() : CvsFilenames
  • CvsPrefs() : CvsPrefs
  • CvsProject() : CvsProject
  • CvsString() : CvsString
  • CvsTrace() : CvsTrace
  • CvsVersion() : CvsPrefs
  • CWincvsApp() : CWincvsApp
  • CWinCvsBrowser() : CWinCvsBrowser
  • CWincvsDoc() : CWincvsDoc
  • CWincvsView() : CWincvsView
  • CWinLogBranchData() : CWinLogBranchData
  • CWinLogData() : CWinLogData
  • CWinLogHeaderData() : CWinLogHeaderData
  • CWinLogRevData() : CWinLogRevData
  • CWinLogTagData() : CWinLogTagData
  • CWinPlacement() : CWinPlacement
  • CWndRedrawMngr() : CWndRedrawMngr
  • cx : USIZE
  • cy : USIZE
  • Cyan : CTCP2Parse

- d -
  • d_buf : internal_state
  • d_desc : internal_state
  • d_ino : direct, dirent
  • d_name : direct, dirent
  • d_namlen : direct, dirent
  • d_off : dirent
  • d_reclen : direct
  • dad : ct_data_s
  • data : ULIST_INFO, UTREE_INFO, UTREE_INSERT, node, dirdata, _WireMessage
  • Data() : ENTNODE
  • data_type : z_stream_s, internal_state
  • date : rcsversnode, hrec, vers_ts, stickydirtag, entnode, EntnodeFile
  • datelist : log_data
  • dbits : inflate_codes_state
  • dd_buf : S_NAME
  • dd_contents : _dirdesc
  • dd_cp : _dirdesc
  • dd_fd : S_NAME
  • dd_id : _dirdesc
  • dd_loc : _dirdesc, S_NAME
  • dd_size : S_NAME
  • DeactivateSelf() : UPseudoFakePane
  • dead : rcsversnode
  • dealloc() : PyPersistent, PyCmdUI, PyMenuMgr, PyColorConsole, PyCvsEntry
  • debuglog : context
  • decode : inflate_blocks_state
  • decodeColor() : CTCP2Parse
  • decodeToggle() : CTCP2Parse
  • Default() : CSubclassWnd
  • default_branch : log_data
  • defaultnumcells : DYN_LIST
  • DeflateRect() : URect
  • DelegateRun() : KoWatcher
  • Delete() : CLogoutThread, CSortList< T >, PyMenuMgr
  • delete_revs : admin_data
  • DeleteAllItems() : CWinCvsBrowser, CCJFlatTabCtrl, UCvsFolders
  • DeleteBand() : CCJReBarCtrl
  • DeleteButton() : CCJToolBar
  • DeleteByCmd() : PyMenuMgr
  • DeleteColumns() : CBrowseFileView
  • deleted : change
  • DeleteItem() : CCJFlatTabCtrl, CCJComboBoxEx
  • DeleteMenu() : CCJMenu
  • DeleteObject() : UBrush, UPen
  • DeleteView() : CCJTabCtrlBar
  • DelItemAt() : TPseudoTextListView
  • delproc : node
  • delta_pos : rcsnode
  • depth : internal_state
  • desc : rcsnode, admin_data, saved_cwd, file_data, MACBINMAP, EntnodeData
  • DescLog() : CRcsFile, CRevFile
  • descLog : CRcsFile, CRevFile
  • destroy : _CvsProcess
  • destroy_func : _WireHandler
  • DestroyMenu() : CCJMenu
  • Deunixfy() : CTcl_Interp
  • devinfo : IOSB
  • DICT0 : internal_state
  • DICT1 : internal_state
  • DICT2 : internal_state
  • DICT3 : internal_state
  • DICT4 : internal_state
  • DiffFile() : CvsCoworker
  • diffFile() : CvsProject
  • dir : hrec, MultiFilesEntry
  • Dir() : CCJComboBoxEx
  • dir___b_flags : _name
  • dir___w_fid_rvn : _version
  • dir__b_flags : _name
  • dir__w_fid_rvn : _version
  • dir_b_fid_nmx : _version
  • dir_b_fid_rvn : _version
  • dir_b_flags : _name
  • dir_p : file_data
  • dir_spec : VMS_DIR
  • dir_v_nextrec : _name
  • dir_v_prevrec : _name
  • dir_v_type : _name
  • dir_w_fid_rvn : _version
  • direntproc : recursion_frame
  • dirleaveproc : recursion_frame
  • dirname : S_Dir
  • dirs : MultiFiles
  • DirtySupport() : CvsPrefs
  • disable_old_style : CCJMenu
  • DisableColumnSizing() : CCJListView, CCJListCtrl
  • DisableCommon() : CWinCvsBrowser, CGraphView, CExploreBar, CMyShellTree, CBrowseFileView
  • DisableFlatLook() : CCJFlatButton
  • DisableFlatStyle() : CCJFlatSplitterWnd
  • DisableGeneric() : UCvsFolders, UCvsFiles
  • DisableUpdate() : CGraphView
  • DisableUserSettings() : ReportConflict
  • Discard() : CCJMemFile
  • Dismiss() : UWidget
  • dist : inflate_codes_state
  • DIST : inflate_codes_state
  • DISTEXT : inflate_codes_state
  • DitherBlt() : CCJMenu
  • DitherBlt2() : CCJMenu
  • dl : ct_data_s
  • do_C() : ansiAttrCvt
  • do_m() : ansiAttrCvt
  • doAbort : gusilsh_ctx
  • DoAbort() : CProgress
  • DockControlBarLeftOf() : CMainFrame, CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • DockFlatBorders : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • DockSizeBar() : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd, CCJDockContext
  • DocumentComplete() : CCJHtmlView
  • DoDataExchange() : CAboutDlg, CTipDlg, CProgressDialog, CNoPython, CCustomizeMenus, UWidget, CPseudoDlg, USaveSettings, UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver, UAuthen_SSH, UEditMessage, UPromptMessage
  • DoDrag() : CBrowseFileView
  • DoEvent() : TPseudoWinBehavior
  • DoFile() : CTcl_Interp, CPython_Interp
  • DoIdle() : TPseudoAppBehavior
  • DoKeyEvent() : TPseudoTextListView
  • DoMenuCommand() : TPseudoAppBehavior
  • DoModal() : UWidget, COptionalPropertySheet
  • DoMouseCommand() : TPseudoTextListView
  • DoMouseCommand_SelectCells() : TPseudoTextListView
  • DONE : internal_state
  • DoPaint() : CCJToolBarBase, CCJSizeDockBar
  • DoPostCreate() : TBuggyPopup
  • DoRotate() : UPseudoPageHider, UPseudoPlaceHolder, UPseudoRotButton, CPseudoRotButton, TPseudoRotateIconButton
  • DoScript() : CTcl_Interp, CPython_Interp
  • DoScriptVar() : CTcl_Interp, CPython_Interp
  • DoSettings() : AuthenModel, AuthenKserver, AuthenRhosts, AuthenPserver, AuthenSSH
  • DoSetupMenus() : TPseudoAppBehavior
  • dosrcs : recursion_frame
  • DoToolboxEvent() : TPseudoAppBehavior
  • DoubleClick() : CPseudoItem, CMacBinItem
  • DoValidUI() : UWidget
  • DragMove() : CCJReBarCtrl
  • Draw() : TPseudoCustomView
  • Draw3DCheckmark() : CCJMenu
  • DrawAnimItem() : CGfxOutBarCtrl
  • DrawBitmap() : UDC
  • DrawBorders() : CCJToolBarBase, CCJSizeDockBar, CCJControlBar
  • DrawButtonBitmap() : CCJFlatButton, CPseudoButton
  • DrawButtonIcon() : CCJFlatButton, CCJCBarButton
  • DrawButtonText() : CCJFlatButton, CCJCaptionButton
  • DrawCaptionBack() : CCJCaption
  • DrawCaptionIcon() : CCJCaption
  • DrawCaptionText() : CCJCaption
  • DrawCell() : CCJColorPopup, CPseudoItem
  • DrawCheckMark() : CCJMenu
  • DrawCombo() : CCJFlatComboBox
  • DrawDragArrow() : CGfxOutBarCtrl
  • DrawFlatBorder() : CCJFlatHeaderCtrl
  • DrawFolder() : CGfxOutBarCtrl
  • DrawGriperCaption() : CCJControlBar
  • DrawGripper() : CCJToolBarBase, CCJControlBar
  • DrawItem() : CSortHeaderCtrl, CCvsStatusBar, CGfxOutBarCtrl, CCJOutlookBar, CCJMetaFileButton, CCJMenu, CCJFontCombo, CCJFlatHeaderCtrl, CCJFlatButton, CCJColorPicker, CPseudoToggle, CPseudoButton
  • DrawRadioDot() : CCJMenu
  • DrawRowAdornments() : CPseudoItem, CMacBinItem
  • DrawTab() : CCJFlatTabCtrl
  • drop : UTB_BUTTON
  • DropFiles() : CMainFrame
  • dstflag : timeb
  • dtree : inflate_codes_state
  • dummy : inflate_blocks_state, inflate_codes_state, internal_state, static_tree_desc_s
  • Duplicate() : CCJMemFile
  • dwBuildNumber : AFX_DLLVERSIONINFO
  • dwData : CGfxOutBarCtrl::CBarFolder, CGfxOutBarCtrl::CBarItem
  • dwDockBarMap : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • dwFlags : CGfxOutBarCtrl
  • dwMajorVersion : AFX_DLLVERSIONINFO
  • dwMinorVersion : AFX_DLLVERSIONINFO
  • dwPlatformID : AFX_DLLVERSIONINFO
  • dwThreadID : CCVS_CoworkerModule
  • dyn_dtree : internal_state
  • dyn_ltree : internal_state
  • dyn_tree : tree_desc_s

- e -
  • edit : addremove_args
  • EDIT_ASCII : CCJHexEdit
  • EDIT_HIGH : CCJHexEdit
  • EDIT_LOW : CCJHexEdit
  • EDIT_NONE : CCJHexEdit
  • EditCell() : CMacBinItem
  • EDITMODE : CCJHexEdit
  • EditSel() : CBrowseFileView, UCvsFiles
  • elems : static_tree_desc_s
  • embedded_at : rcsbuffer
  • empty : UStr, UPStr, CLogStr, CvsPrefs, GPT_GETENV
  • Enable() : CCJToolCmdUI, UCmdUI, PyCmdUI
  • EnableAutoCompletion() : CCJFlatComboBox
  • EnableButton() : CCJToolBar
  • EnableButtons() : CCJFlatTabCtrl
  • EnableDocking() : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • EnableDockingOnSizeBar() : CCJControlBar
  • EnableDockingSizeBar() : CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • EnableFlatLook() : CCJControlBar
  • EnableMultiSelect() : CCJTreeCtrl
  • EnableSaveState() : CCJControlBar
  • EnableSplashScreen() : CSplashWnd
  • EnableToolTips() : CCJTabCtrlBar
  • enc : CTCP2Parse
  • encDef : CTCP2Parse
  • encLast : CTCP2Parse
  • encod : MACBINMAP
  • EncodingType : CTCP2Parse
  • END : inflate_codes_state
  • end : TMString< T >, inflate_blocks_state, datelist, hrec, re_registers
  • EndDrag() : CCJReBarCtrl
  • EndDragDockBar() : CCJDockContext
  • EndModal() : UWidget
  • EndSelection() : CCJColorPopup
  • endsWith() : UStr, UPStr, CLogStr
  • entdata : vers_ts
  • EnterDirectory() : TBrowserFill, TBrowserFillDummy, TViewFill, TBrowserFill, TBrowserFillDummy, TViewFill, CFillTclEntries, CFillPyEntries, ImportReport, TraversalReport
  • ENTNODE() : ENTNODE
  • EntnodeData() : EntnodeData
  • EntnodeFile() : EntnodeFile
  • EntnodeFolder() : EntnodeFolder
  • EntnodePath() : EntnodePath
  • entp : S_Dir
  • Entries() : MacBinMaps
  • entries : WININFO, frame_and_entries, file_info, CMacroSet, MacBinMaps
  • Entry() : CSortList< T >
  • entry : _frameRec
  • entryID : ASEntry
  • entryLength : ASEntry
  • entryOffset : ASEntry
  • EnumFontProc() : CCJFontCombo
  • EqualRect() : URect
  • equiv_max : file_data
  • equivs : file_data
  • EraseNonClient() : CCJToolBarBase, CCJSizeDockBar, CCJControlBar
  • error : diff_callbacks
  • errormsg : admin_file
  • escSeq : ansiAttrCvt
  • event_flag : _SUBIO
  • event_flag_byte : _SUBIO
  • Execute() : UCvsApp
  • ExecuteSelf() : LPseudoWinAttachment, LMainPseudoAttachment, UPseudoPageHider, LPseudoDrawAttachment
  • ExecWB() : CCJHtmlView
  • exh : EXHCB
  • exit : CvsProcessCallbacks
  • ExitDirectory() : TBrowserFill, TBrowserFillDummy, TViewFill, TBrowserFill, TBrowserFillDummy, TViewFill, CFillTclEntries, CFillPyEntries, ImportReport, TraversalReport
  • ExitInstance() : CWincvsApp
  • Exop : inflate_huft_s
  • expand : rcsnode
  • expanded : UTREE_INFO
  • ext : UMSGMAP_ENTRY
  • ext1 : UMSGMAP_ENTRY
  • ext2 : UMSGMAP_ENTRY
  • ExtDiff() : CvsPrefs
  • extra_base : static_tree_desc_s
  • extra_bits : static_tree_desc_s
  • Extract() : CCJMemFile
  • extractcolor() : mircAttrCvt

- f -
  • fAddGroups : CGfxOutBarCtrl
  • fAllEntries : CPersistent
  • fAllItems : TMPersistent< T >
  • fAlloc : CTCLCvsConsole
  • fAllRevs : TGraphDelCmd
  • fAllStrs : CMMenuString, TMString< T >
  • False() : PyContainer
  • fAnimation : CGfxOutBarCtrl
  • fastmap : re_pattern_buffer
  • fastmap_accurate : re_pattern_buffer
  • fBitBuffer : HQXDecodeVars, HQXEncodeVars
  • fBitBufferBits : HQXDecodeVars, HQXEncodeVars
  • fBuf : CMMenuString, TMString< T >, TMPersistent< T >
  • fButtonStep : TPseudoScrollBar
  • fc : ct_data_s
  • fClass : CPersistent::CPersistentEntry
  • fController : UPseudoPlaceHolder
  • fCountSel : TGraphDelCmd, TGraphCmdStatus
  • fCRC : HQXDecodeVars, HQXEncodeVars
  • fcreator : ReportConflict
  • fCurrentIcon : UPseudoRotButton, TPseudoRotateIconButton
  • fCurrentView : UPseudoPlaceHolder
  • fCurSel : UPseudoPageHider
  • fCvsRunningCounter : CvsPrefs
  • fData : CGraphDoc
  • fDef : CSortList< T >
  • fDefValue : CPersistentT< T >
  • fDir : CGraphDoc
  • fDragItems : CGfxOutBarCtrl
  • fEditGroups : CGfxOutBarCtrl
  • fEditItems : CGfxOutBarCtrl
  • FeedThisLine() : CWincvsView, UCvsConsole
  • fElems : CSortList< T >
  • fExitOnError : CTcl_Interp
  • fFirstTime : CGraphView
  • fg : CTCP2Parse
  • fgColorMap : ansiAttrCvt
  • fgDef : CTCP2Parse
  • fgLast : CTCP2Parse
  • fHasLoggedIn : CvsPrefs
  • fIconSuite : UPseudoRotButton, TPseudoRotateIconButton
  • fields : revlist
  • file : gz_stream, PIPE, hrec, file_info, group, FileEntry
  • file_spec : VMS_DIR
  • FileEntry() : FileEntry
  • filename : rcsbuffer, admin_file
  • fileproc : recursion_frame
  • files : MultiFilesEntry
  • filesdoneproc : recursion_frame
  • fill : fatdef
  • filler : ASMacInfo, ASHeader
  • fInBuffer : HQXDecodeVars, HQXEncodeVars
  • fInBufMax : HQXDecodeVars
  • fInBufp : HQXDecodeVars
  • Find() : CPersistent, TMString< T >
  • FindCellFromColor() : CCJColorPopup
  • FindData() : CCJMemFile
  • FindDropDownButton() : CCJToolBar
  • FindItem() : CCJTreeCtrl
  • FindKeyboardShortcut() : CCJMenu
  • FindMenuOption() : CCJMenu
  • FindMethod() : PyPersistent, PyCmdUI, PyMenuMgr, PyColorConsole, PyCvsEntry
  • FindOneOf() : CCVS_CoworkerModule
  • FindProject() : CvsProject
  • FindString() : CCJComboBoxEx
  • finfo : frame_and_file
  • fInHqxData : HQXDecodeVars
  • FinishCreateSelf() : UPseudoPlaceHolder, CMacBinTable
  • fInterp : CTcl_Interp, CTCLCvsConsole, CPython_Interp
  • first : err_strs, revlist, option_revlist, DYN_LIST
  • firstentry : poolRec
  • firstfree : poolRec
  • Fixed : CTCP2Parse
  • FLAG : internal_state
  • flag : option
  • flags : request, recursion_frame, rcsnode
  • fLargeIcon : CGfxOutBarCtrl
  • fLastErrorCode : CTcl_Interp
  • FlatBorder() : CCJSizeDockBar
  • fLen : CTCLCvsConsole
  • Flush() : CCJMemFile, CMacroSet
  • flush() : UStr, UPStr, CLogStr
  • flush_list() : CvsPrefs
  • flush_output : diff_callbacks
  • fMap : CMacBinItem
  • fMax : CSortList< T >
  • fMaximum : TPseudoDoubleNumberText
  • fMaxStr : CMMenuString, TMString< T >
  • fMethod : CSortList< T >
  • fMinimum : TPseudoDoubleNumberText
  • fName : CGraphDoc
  • fNewOne : CSortList< T >
  • fNode : CGraphDoc, CLogNodeData
  • fNOutChars : HQXEncodeVars
  • fntLast : CTCP2Parse
  • fntSize : CTCP2Parse
  • fNum : CSortList< T >
  • fOnlyRev : TGraphDelCmd
  • forceBinary : ReportConflict
  • ForceBinary() : ReportConflict
  • forceNoKeywords : ReportConflict
  • ForceNoKeywords() : ReportConflict
  • forceText : ReportConflict
  • ForceText() : ReportConflict
  • Format : _MIDL_PROC_FORMAT_STRING, _MIDL_TYPE_FORMAT_STRING
  • format : msg
  • FormatOleDateTime() : CCJTimeEdit, CCJDateEdit
  • ForwardMouse() : CCJPagerCtrl
  • fOut : CRevisionConsole, CStreamConsole
  • fOutBuffer : HQXDecodeVars, HQXEncodeVars
  • fOutBufp : HQXEncodeVars
  • fp : rcsbuffer
  • fPageCtrl : UPseudoPageHider
  • fPageStep : TPseudoScrollBar
  • fPrecision : TPseudoDoubleNumberText
  • frame : frame_and_entries, frame_and_file
  • fRealWidth : TBuggyPopup
  • fRemoveGroups : CGfxOutBarCtrl
  • fRemoveItems : CGfxOutBarCtrl
  • freq : ct_data_s
  • FreshenFileMask() : CMainFrame
  • fRLECharacter : HQXDecodeVars, HQXEncodeVars
  • fRLECount : HQXDecodeVars, HQXEncodeVars
  • from : group
  • fromcvsFilter : WrapperEntry
  • fromHex() : CTCP2Parse
  • fRtfFormat : CWincvsView
  • fSel1 : TGraphCmdStatus
  • fSel2 : TGraphCmdStatus
  • fSelHighlight : CGfxOutBarCtrl
  • fSink : HQXEncodeVars
  • fSinkRefCon : HQXEncodeVars
  • fSmallIcon : CGfxOutBarCtrl
  • fSource : HQXDecodeVars
  • fSourceRefCon : HQXDecodeVars
  • fStringContainer : TPseudoTextListView
  • fTclFileRunningCounter : CvsPrefs
  • fTimeStamp : CPersistent
  • ftype : ReportConflict
  • fullname : cmd, file_info
  • fullpathname : EntnodeData, EntnodePath
  • func : config_s, cmd
  • fUniqueName : CPersistent::CPersistentEntry
  • fValue : CPersistentT< T >, CPersistent::CPersistentEntry
  • fView : TGraphSelNonSig
  • fViewSuite : UPseudoPageHider, UPseudoPlaceHolder
  • fWidID : TPseudoWinAdorner, TPseudoWinBehavior
  • fWidid : UPseudoPageHider, UPseudoPlaceHolder

- g -
  • g : UColor, UCOLOR
  • G : CTCP2Parse::RGBColor
  • gApp : UCvsApp
  • gCurCvs : UCvsApp
  • gCurMacBinMap : CMacBinTable
  • gCurRsaIdentity : AuthenSSH
  • gCvsProcess : CWincvsApp
  • gCvsRunning : CWincvsApp, UCvsApp
  • gCvsStopping : CWincvsApp, UCvsApp
  • Get() : CAllTargets, CSortList< T >
  • get : MultiFiles, inflate_codes_state
  • get_cvsroot_list() : CvsPrefs
  • GetActiveView() : CCJTabView, CCJTabCtrlBar
  • GetAddressBar() : CCJHtmlView
  • GetAllInstances() : AuthenModel
  • GetAnchorHighlight() : CCJToolBarCtrl
  • GetAnimationTickCount() : CGfxOutBarCtrl
  • GetAppLibFolder() : UCvsApp
  • GetApplication() : CCJHtmlView
  • GetAppModule() : CWincvsApp
  • GetAppName() : UCvsApp
  • GetAppPath() : CWincvsApp
  • GetAppVersion() : CWincvsApp, UCvsApp
  • GetAt() : KiColumnModel, KoRecursiveModel, KoRegularModel
  • GetAttr() : PyCvsEntry, PyContainer
  • getattr() : PyPersistent, PyCmdUI, PyMenuMgr, PyColorConsole, PyCvsEntry
  • GetAutoSize() : CCJHyperLink
  • GetAvailableRect() : CCJSizeDockBar
  • GetBandBorders() : CCJReBarCtrl
  • GetBandCount() : CCJReBarCtrl
  • GetBandInfo() : CCJReBarCtrl
  • GetBarHeight() : CCJReBarCtrl
  • GetBarInfo() : CCJReBarCtrl
  • GetBaseMessageMap() : UWidget, UToolbar, UMenu, UCmdTarget, UMacAppMenu, UCvsToolbar, UCvsMenubar, UCvsGraph, UCvsFrame, UCvsFolders, UCvsFiles, UCvsConsole, UCvsApp, USaveSettings, UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver, UAuthen_SSH, UEditMessage, UPromptMessage
  • GetBitmap() : CCJToolBar
  • GetBitmapFlags() : CCJToolBar
  • GetBitmapFromImageList() : CCJMenu
  • GetBkColor() : CCJReBarCtrl, CCJPagerCtrl, CCJColorPicker
  • GetBorder() : CCJPagerCtrl
  • GetBorders() : CCJToolBarBase
  • GetBoundsSelf() : CWinLogBranchData, CWinLogTagData, CWinLogRevData, CWinLogHeaderData, CWinLogData, CWinLogBranchData, CWinLogTagData, CWinLogRevData, CWinLogHeaderData, CWinLogData
  • GetBrowseHistory() : CMainFrame
  • GetBrowserView() : CWincvsApp, CMainFrame, CBrowserBar, UCvsApp
  • getBuffer() : CvsString
  • getBufferMax() : CvsString
  • GetBusy() : CCJHtmlView
  • GetButton() : CCJToolBar
  • GetButtonCount() : CCJToolBar
  • GetButtonInfo() : CCJToolBarCtrl, CCJToolBar
  • GetButtonRect() : CCJControlBar
  • GetButtonSize() : CCJToolBarCtrl, CCJToolBar, CCJPagerCtrl
  • GetButtonState() : CCJPagerCtrl
  • GetButtonStyle() : CCJToolBar
  • GetButtonText() : CCJToolBar
  • GetCellRect() : CCJColorPopup
  • GetChildRect() : CCJTabView, CCJTabCtrlBar, CCJExplorerBar, CCJControlBar
  • GetColor() : CColorStatic, CCJMonthCalCtrl, CCJColorPopup, CCJColorPicker
  • GetColorName() : CCJColorPopup
  • GetColorScheme() : CCJReBarCtrl
  • GetColumn() : CCJColorPopup, KiColumnModel
  • GetColumnCount() : CCJListView, CCJListCtrl
  • GetColumnModel() : CBrowseFileView
  • GetComboBoxCtrl() : CCJComboBoxEx
  • GetConflict() : EntnodeFile, EntnodeData
  • GetConsoleView() : CWincvsApp, CMainFrame
  • GetContainer() : CCJHtmlView
  • GetCount() : KiColumnModel, KoRecursiveModel, KoRegularModel
  • GetCountPerPage() : CGfxOutBarCtrl
  • GetCurFormat() : CWincvsView
  • GetCurrent() : CPseudoRotButton
  • GetCurrentMap() : CMacBinTable
  • GetCurrentState() : UPseudoRotButton
  • GetCurrentView() : UPseudoPlaceHolder
  • GetCurSel() : CCJFlatTabCtrl, CCJMonthCalCtrl
  • GetCvsExitOnError() : CTcl_Interp
  • GetCvsLastErrorCode() : CTcl_Interp
  • GetData() : CWinPlacement, CWinLogData, CMMenuString, CCJHexEdit, CWinLogData, CTCLBrowserEnt, CPersistentT< T >, CPersistent, TMString< T >, TMPersistent< T >, PMacBinMaps, PCStr, PCPStr
  • GetDateTime() : CCJDateEdit
  • GetDesc() : EntnodeData
  • GetDeviceScrollPosition() : CScrollView
  • GetDir() : CGraphDoc
  • GetDisabledImageList() : CCJToolBarCtrl
  • GetDisableOldStyle() : CCJMenu
  • GetDockBar() : CCJDockContext
  • GetDockedSizeBar() : CCJSizeDockBar
  • GetDocument() : CWincvsView, CWincvsApp
  • GetDragItemRect() : CGfxOutBarCtrl
  • GetDrawContentsSelf() : CPseudoItem, CMacBinItem
  • GetDropTarget() : CCJToolBarCtrl, CCJReBarCtrl, CCJPagerCtrl
  • GetEditCtrl() : CCJComboBoxEx
  • GetEntriesModTime() : CBrowseFileView, UCvsFiles
  • GetEntryInfo() : CGraphDoc
  • getenv : CvsProcessCallbacks
  • GetEnvMainThread() : CWincvsApp, CMainFrame
  • GetEnvPlainTypes() : MacBinMaps
  • GetEnvTypes() : MacBinMaps
  • GetErrorMessage() : CvsCoworker
  • getErrorMessage() : CvsProject
  • GetExplorerView() : CWincvsApp, CMainFrame
  • GetExtendedStyle() : CCJToolBarCtrl, CCJListView, CCJListCtrl, CCJComboBoxEx
  • GetFileChanges() : CvsCoworker
  • getFileChanges() : CvsProject
  • getFilename() : CvsFilenames
  • getFilesToAdd() : CvsProject
  • GetFilesToAdd() : CvsCoworker
  • GetFilesView() : UCvsApp
  • GetFileView() : CWincvsApp
  • GetFilterModel() : CWincvsApp, CMainFrame
  • GetFirstDayOfWeek() : CCJMonthCalCtrl
  • GetFirstSelectedItem() : CCJTreeCtrl
  • GetFlag() : CGfxOutBarCtrl
  • GetFocus() : UWidget
  • GetFocusCmd() : UWidget
  • GetFolderChild() : CGfxOutBarCtrl
  • GetFolderCount() : CGfxOutBarCtrl
  • GetFolderData() : CGfxOutBarCtrl
  • GetFolderImageList() : CGfxOutBarCtrl
  • GetFolderRect() : CGfxOutBarCtrl
  • GetFullName() : CCJHtmlView
  • GetFullPathName() : EntnodeData, EntnodePath
  • GetFullScreen() : CCJHtmlView
  • GetGripperRect() : CCJControlBar
  • GetGroup() : CPseudoToggle
  • GetHeight() : CCJHtmlView
  • GetHideCommandDlg() : COptionalPropertySheet
  • GetHookMap() : CSubclassWndMap
  • GetHorzSize() : CCJControlBar
  • GetHotImageList() : CCJToolBarCtrl
  • GetHotItem() : CCJToolBarCtrl, CCJToolBar
  • GetHoverColor() : CCJHyperLink
  • GetHtmlDocument() : CCJHtmlView
  • GetIcon() : CCustomizeMenus
  • GetIconRect() : CGfxOutBarCtrl
  • GetIdleTime() : CWincvsApp
  • GetIgnoreModel() : CWincvsApp, CMainFrame
  • GetImageForEntry() : CBrowseFileView, UCvsFiles
  • GetImageID() : CContentItems
  • GetImageIndexFromRuntimeClass() : CCJTabCtrlBar
  • GetImageList() : CGfxOutBarCtrl, CCJToolBarCtrl, CCJToolBar, CCJReBarCtrl, CCJComboBoxEx
  • GetImgList() : CGraphView
  • GetIndex() : CCJColorPopup
  • GetInitializedMenu() : CCJMDIChildWnd
  • GetInsertMark() : CCJToolBarCtrl
  • GetInsertMarkColor() : CCJToolBarCtrl
  • GetInsideRect() : CGfxSplitterWnd, CGfxOutBarCtrl
  • GetInstance() : AuthenModel
  • GetItem() : CCJComboBoxEx
  • GetItemBold() : CCJTreeCtrl
  • GetItemByLocation() : CWinCvsBrowser, UCvsFolders
  • GetItemColor() : CCJTreeCtrl
  • GetItemCount() : CGfxOutBarCtrl, CGfxOutBarCtrl::CBarFolder, CCJFlatTabCtrl
  • GetItemData() : CGfxOutBarCtrl
  • GetItemFont() : CCJTreeCtrl
  • GetItemID() : CCJToolBar
  • GetItemImage() : CGfxOutBarCtrl
  • GetItemRect() : CGfxOutBarCtrl, CCJToolBar, CCJFlatTabCtrl
  • GetItemSize() : CGfxOutBarCtrl
  • GetItemText() : CToolbarCombo, CGfxOutBarCtrl, TPseudoTextListView
  • GetKind() : AuthenModel, AuthenNtserver, AuthenKserver, AuthenRhosts, AuthenPserver, AuthenSSH, AuthenLocal
  • GetLabelRect() : CGfxOutBarCtrl
  • GetLastError() : CvsCoworker
  • getLastError() : CvsProject
  • GetLastItem() : CCJTreeCtrl
  • GetLeft() : CCJHtmlView
  • GetLinkColor() : CCJHyperLink
  • GetLinkCursor() : CCJHyperLink
  • GetList() : CMMenuString, TMString< T >, TMPersistent< T >
  • GetListCtrl() : TViewFill
  • GetLocationName() : CCJHtmlView
  • GetLocationURL() : CCJHtmlView
  • GetLogoText() : CCJLogoPane
  • GetMacCreator() : ReportConflict
  • GetMacType() : ReportConflict
  • GetMainFrame() : CWincvsApp, CBrowseFileView
  • GetManager() : CToolbarCombo
  • GetMaxSelCount() : CCJMonthCalCtrl
  • GetMaxSize() : CCJToolBarCtrl
  • GetMaxTextRows() : CCJToolBarCtrl
  • GetMenu() : CCJMenuBar
  • GetMenuBar() : CCJHtmlView
  • GetMenuID() : CCJTabCtrl, CCJMDIChildWnd, CCJFlatHeaderCtrl, CCJControlBar
  • GetMenuList() : CMainFrame
  • GetMenuText() : CCJMenu
  • GetMessageMap() : UWidget, UToolbar, UMenu, UCmdTarget, UMacAppMenu, UCvsToolbar, UCvsMenubar, UCvsGraph, UCvsFrame, UCvsFolders, UCvsFiles, UCvsConsole, UCvsApp, USaveSettings, UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver, UAuthen_SSH, UEditMessage, UPromptMessage
  • GetMinExt() : CCJControlBar
  • GetMinReqRect() : CCJMonthCalCtrl
  • GetMonthCalColor() : CCJDateTimeCtrl
  • GetMonthCalCtrl() : CCJDateTimeCtrl
  • GetMonthCalFont() : CCJDateTimeCtrl
  • GetMonthDelta() : CCJMonthCalCtrl
  • GetMonthRange() : CCJMonthCalCtrl
  • GetName() : CGraphDoc, EntnodeData
  • GetNextID() : CCJBrowseButton
  • GetNextItem() : CCJTreeCtrl
  • GetNextOrPrevButton() : CCJMenuBar
  • GetNextSelectedItem() : CCJTreeCtrl
  • GetNextTipString() : CTipDlg
  • GetNode() : CGraphDoc
  • GetNormalized() : CTCLBrowserEnt
  • GetNotificationManager() : KoIgnoreModel, KoRecursionModel, KoFilterModel, KiIgnoreModel, KiRecursionModel, KiFilterModel
  • getNumberOfFilenames() : CvsFilenames
  • GetOffline() : CCJHtmlView
  • GetOldLoc() : CHistComboBoxEx
  • getOptionsAndFilename() : CvsFilenames
  • GetOrderArray() : CCJFlatHeaderCtrl
  • GetPadding() : CCJToolBar
  • GetPageValue() : LPseudoWinAttachment
  • GetPalette() : CCJReBarCtrl
  • GetPanControl() : CCJStatusBar
  • GetParentBrowser() : CCJHtmlView
  • GetPath() : CBrowseFileView
  • GetPattern() : ReportConflict
  • GetPos() : CCJPagerCtrl
  • GetPrevItem() : CCJTreeCtrl
  • GetPrevSelectedItem() : CCJTreeCtrl
  • GetProject() : CvsCoworker
  • getProject() : CvsProject
  • getProjectHandle() : CvsProject
  • getProjectHome() : CvsProject
  • getProjectName() : CvsProject
  • GetProperty() : CCJHtmlView
  • GetRange() : CCJMonthCalCtrl, CCJDateTimeCtrl
  • GetReadyState() : CCJHtmlView
  • GetReBarCtrl() : CCJReBar
  • GetRect() : CCJToolBar, CCJReBarCtrl
  • GetRecursionModel() : CWincvsApp, CMainFrame
  • GetRecursiveModel() : KiColumnModel
  • GetRegisterAsBrowser() : CCJHtmlView
  • GetRegisterAsDropTarget() : CCJHtmlView
  • GetRegKey() : CCJHyperLink
  • GetRegularModel() : KiColumnModel
  • GetRoot() : CWinCvsBrowser, CWincvsApp, UCvsFolders
  • GetRow() : CCJColorPopup
  • GetRowCount() : CCJReBarCtrl
  • GetRowHeight() : CCJReBarCtrl
  • GetRows() : CCJToolBar
  • GetRuntimeClass() : UObject
  • GetSel() : CCJHexEdit
  • GetSelectionMode() : CCJColorPicker
  • GetSelFolder() : CGfxOutBarCtrl
  • GetSelFont() : CCJFontCombo
  • GetSelRange() : CCJMonthCalCtrl
  • GetSettingsDesc() : AuthenModel, AuthenKserver, AuthenRhosts, AuthenPserver, AuthenSSH
  • GetSetupData() : KiColumn, KoConflictColumn, KoDateColumn, KoTagColumn, KoStatusColumn, KoOptionColumn, KoRevisionColumn, KoPathColumn, KoNameColumn
  • GetSilent() : CCJHtmlView
  • GetStandardSignature() : TPseudoDoubleNumberText, TPseudoTextListView
  • GetState() : CCJToolBar, CPseudoToggle
  • GetStatusBar() : CWincvsApp, CMainFrame, CCJHtmlView
  • GetStatusPane() : CCJStatusBar
  • GetStoredWidth() : CCJListView, CCJListCtrl
  • GetStr() : CWinLogData
  • GetString() : CCJMenuData
  • GetStyle() : CCJToolBarCtrl
  • GetTabCtrl() : CCJTabView
  • GetTabFromPoint() : CCJTabCtrlBar
  • GetTabWidth() : CCJFlatTabCtrl
  • GetText() : CToolbarCombo, CContentItems, KiColumn, KoConflictColumn, KoDateColumn, KoTagColumn, KoStatusColumn, KoOptionColumn, KoRevisionColumn, KoPathColumn, KoNameColumn
  • GetTextColor() : CCJReBarCtrl, CCJColorPicker
  • GetTextExtent() : UDC
  • GetTextHeight() : UDC
  • GetTheaterMode() : CCJHtmlView
  • GetThisMessageMap() : UWidget, UToolbar, UMenu, UCmdTarget, UMacAppMenu, UCvsToolbar, UCvsMenubar, UCvsGraph, UCvsFrame, UCvsFolders, UCvsFiles, UCvsConsole, UCvsApp, USaveSettings, UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver, UAuthen_SSH, UEditMessage, UPromptMessage
  • GetTime() : CCJDateTimeCtrl
  • GetTimers() : UWidget
  • GetTimeStamp() : CPersistent
  • GetTipText() : CCJFlatTabCtrl
  • GetToday() : CCJMonthCalCtrl
  • GetToken() : AuthenModel, AuthenNtserver, AuthenKserver, AuthenRhosts, AuthenPserver, AuthenSSH, AuthenLocal
  • GetToolBar() : CCJHtmlView
  • GetToolBarCtrl() : CCJToolBar
  • GetToolBarID() : CCJMDIChildWnd
  • GetToolBarIDs() : CCJMDIChildWnd
  • GetToolbarStyle() : CCJToolBar
  • GetTooltip() : UWidget
  • GetToolTip() : CCJTabCtrlBar
  • GetToolTips() : CCJToolBar, CCJReBarCtrl
  • GetTop() : CCJHtmlView
  • GetTopLevelContainer() : CCJHtmlView
  • GetTotalArrowWidth() : CCJFlatTabCtrl
  • GetTotalTabWidth() : CCJFlatTabCtrl
  • GetTrackingState() : CCJMenuBar
  • GetTrackSelection() : CCJColorPicker
  • GetTreeView() : CGraphDoc
  • GetType() : CWinLogData, CCJHtmlView, CLogNodeBranch, CLogNodeTag, CLogNodeRev, CLogNodeHeader, CLogNode, CWinLogData, PyPersistent, PyCmdUI, PyMenuMgr, PyColorConsole, PyCvsEntry, EntnodeFolder, EntnodeFile, EntnodeData, KiColumnModel, KoRecursiveModel, KoRegularModel
  • GetUnderline() : CCJHyperLink
  • GetURL() : CCJHyperLink
  • GetUserData() : CLogNode
  • GetUseShell() : CvsPrefs
  • GetValidationError() : TPseudoDoubleNumberText
  • GetValue() : TPseudoDoubleNumberText, PyPersistent
  • GetVertSize() : CCJControlBar
  • GetView() : CCJTabView, CCJTabCtrlBar, TViewFill
  • GetViewName() : CCJTabCtrlBar
  • GetViewType() : CBrowseFileView
  • GetVisible() : CCJHtmlView
  • GetVisibleRange() : CGfxOutBarCtrl
  • GetVisited() : CCJHyperLink
  • GetVisitedColor() : CCJHyperLink
  • GetWideString() : CCJMenuData
  • GetWidget() : UWidget
  • GetWidgets() : UWidget
  • GetWidID() : UCmdTarget, TPseudoWinBehavior
  • GetWindowDateTime() : CCJDateEdit
  • GetWorkspace() : CMainFrame
  • gLastCvsResult : CWincvsApp
  • gLogGraph : CWincvsApp
  • gLogHtml : CWincvsApp
  • gLogTempl : CWincvsApp
  • GoBack() : CCJHtmlView
  • GoForward() : CCJHtmlView
  • GoHome() : CCJHtmlView
  • good_length : config_s
  • good_match : internal_state
  • GoSearch() : CCJHtmlView
  • GotoURL() : CCJHyperLink
  • gotProblem : AddBinCvsArgs, AddCvsArgs
  • gr_gid : group
  • gr_mem : group
  • gr_name : group
  • gr_passwd : group
  • Green : CTCP2Parse
  • Grey : CTCP2Parse
  • gRsaIdentity : AuthenSSH
  • gRsaIdentityFile : AuthenSSH
  • gRunning : TraversalReport
  • gSSHName : AuthenSSH
  • gSSHOptions : AuthenSSH

- h -
  • handler : SIG_hlist, NotificationManager::Node
  • has_arg : option
  • has_cvsroot_in_list() : CvsPrefs
  • has_jmpbuf : PIPE
  • HasAborted() : CProgress
  • HasAdvancedOptionsForCommand() : CvsCoworker
  • hasAdvancedOptionsForCommand() : CvsProject
  • hasConflict : ReportConflict
  • HasConflict() : ReportConflict
  • HasEditChanged() : CCJComboBoxEx
  • hasExtension : ReportConflict
  • HasFocus() : UWidget
  • HasForceBinary() : ReportConflict
  • HasForceNoKeywords() : ReportConflict
  • HasForceText() : ReportConflict
  • hash : equivclass
  • hash_bits : internal_state
  • hash_mask : internal_state
  • hash_shift : internal_state
  • hash_size : internal_state
  • hasharray : list
  • hashnext : node
  • HasHost() : AuthenModel, AuthenNtserver, AuthenKserver, AuthenRhosts, AuthenPserver, AuthenSSH
  • hashprev : node
  • hasIgnore : ReportConflict
  • HasIgnore() : ReportConflict
  • HasLoogedIn() : CvsPrefs
  • HasModal() : UWidget
  • hasOne : CWinPlacement
  • HasProblem() : AddBinCvsArgs, AddCvsArgs
  • HasSettings() : AuthenModel, AuthenNtserver, AuthenKserver, AuthenRhosts, AuthenPserver, AuthenSSH
  • HasTypeCreatorConflict() : ReportConflict
  • hasTypeCreatorConflict : ReportConflict
  • HasUser() : AuthenModel, AuthenNtserver, AuthenKserver, AuthenRhosts, AuthenPserver, AuthenSSH
  • have_lckdir : lock
  • hDragCursor : CGfxOutBarCtrl
  • head : internal_state, rcsnode
  • header : CLogNodeHeader, log_data
  • HeadRev() : CRcsFile
  • headRev : CRcsFile
  • heap : internal_state
  • heap_len : internal_state
  • heap_max : internal_state
  • height : WININFO
  • Height() : URect
  • heightbtn : UTB_INIT
  • Helper() : CvsPrefs
  • hHandCursor : CGfxOutBarCtrl
  • hi_minimal : partition
  • HideButton() : CCJToolBar
  • HideColumn() : CCJFlatSplitterWnd
  • HideCommandDlgAnnotate() : CvsPrefs
  • HideCommandDlgDiff() : CvsPrefs
  • HideCommandDlgGraph() : CvsPrefs
  • HideCommandDlgLog() : CvsPrefs
  • HideCommandDlgUpdate() : CvsPrefs
  • HideCommandDlgUseShift() : CvsPrefs
  • HideRow() : CCJFlatSplitterWnd
  • HideSplashScreen() : CSplashWnd
  • HighlightFolder() : CGfxOutBarCtrl
  • HighlightItem() : CGfxOutBarCtrl
  • hinst : tagAFX_OLDTOOLINFO
  • his_read : _CvsProcess
  • his_write : _CvsProcess
  • HitTest() : CWinLogData, CCJToolBarCtrl, CCJToolBar, CCJSizeDockBar, CCJReBarCtrl, CCJMenuBar, CCJFlatTabCtrl, CCJMonthCalCtrl, CCJControlBar, CWinLogData
  • HitTestEx() : CGfxOutBarCtrl, CCJListView, CCJListCtrl
  • hNoDragCursor : CGfxOutBarCtrl
  • Home() : CCJFlatTabCtrl, CvsPrefs
  • HookWindow() : CSubclassWnd
  • HookWndProc : CSubclassWnd
  • htDownScroll : CGfxOutBarCtrl
  • htFolder : CGfxOutBarCtrl
  • htItem : CGfxOutBarCtrl
  • htNothing : CGfxOutBarCtrl
  • htUpScroll : CGfxOutBarCtrl
  • hwnd : tagAFX_OLDTOOLINFO
  • hWndParent : CProgressDialog

- i -
  • icon : ULIST_INSERT, UTREE_INFO, UTREE_INSERT, UTB_BUTTON
  • icons : TbEntryDropDown
  • ICTextOption() : CvsPrefs
  • idButton : DROPDOWNBUTTON
  • IDD : CAboutDlg, CProgressDialog, CNoPython, CCustomizeMenus
  • IdleCvsProgress() : CWincvsApp
  • idMenu : DROPDOWNBUTTON
  • iDragFrom : OUTBAR_INFO
  • iDragTo : OUTBAR_INFO
  • IDToIndex() : CCJReBarCtrl
  • idx : hrec
  • iFirstItem : CGfxOutBarCtrl
  • iFolderHeight : CGfxOutBarCtrl
  • ignore : change
  • Ignore() : ReportConflict
  • ignored : EntnodeData
  • iHitInternal1 : CGfxOutBarCtrl
  • iHitInternal2 : CGfxOutBarCtrl
  • iImageIndex : CGfxOutBarCtrl::CBarItem
  • iIndex : CGfxGroupEdit
  • iLastDragItemDraw : CGfxOutBarCtrl
  • iLastDragItemDrawType : CGfxOutBarCtrl
  • iLastFolderHighlighted : CGfxOutBarCtrl
  • iLastItemHighlighted : CGfxOutBarCtrl
  • iLastSel : CGfxOutBarCtrl
  • iLastSelectedFolder : CGfxOutBarCtrl
  • Import() : CCJMemFile
  • ImportReport() : ImportReport
  • in : cvs_MD5Context
  • inbuf : gz_stream
  • inc : USLIDER
  • inclusive : datelist
  • Indeterminate() : CCJToolBar
  • index : OUTBAR_INFO, inflate_blocks_state
  • indexColor : CTCP2Parse
  • InflateRect() : URect
  • init() : CRevisionConsole
  • InitATL() : CWincvsApp
  • initialcmd : UTB_DROPDOWN
  • Initialise() : CCJColorPopup
  • Initialize() : CCustInvertTable
  • InitializeControl() : CCJBrowseEdit
  • InitializeDockingWindows() : CMainFrame
  • InitializeFonts() : CCJFontCombo
  • InitializeHeader() : CCJFlatHeaderCtrl
  • InitializeMenu() : CCJMDIFrameWnd, CCJFrameWnd
  • InitialShowWindow() : CMainFrame
  • InitInstance() : CWincvsApp, CLogoutThread
  • InitItem() : TViewFill
  • InitPythonSupport() : CPython_Interp
  • InitValues() : PyPersistent, PyCmdUI, PyMenuMgr, PyColorConsole, PyCvsEntry
  • ins_h : internal_state
  • Insert() : CMMenuString, CCJMemFile, CSortList< T >, TMString< T >
  • insert_cvsroot_in_list() : CvsPrefs
  • InsertBand() : CCJReBarCtrl
  • InsertButton() : CCJToolBar
  • InsertControl() : CCJToolBar
  • inserted : change
  • InsertItem() : CGfxOutBarCtrl, CGfxOutBarCtrl::CBarFolder, CCJFlatTabCtrl, CCJComboBoxEx
  • InsertMarkHitTest() : CCJToolBarCtrl
  • InsertMenuA() : CCJMenu
  • InsertMenuW() : CCJMenu
  • InsertODMenuA() : CCJMenu
  • InsertODMenuW() : CCJMenu
  • InsertSpaces() : CCJMenu
  • InsertString() : CHistComboBoxEx, CCJComboBoxEx
  • Inside() : CSortList< T >
  • InsideAndInsert() : CSortList< T >
  • InsStringBefore() : TPseudoTextListView
  • InsStringFirst() : TPseudoTextListView
  • InsStringLast() : TPseudoTextListView
  • Install() : CCJMenuBarFrameHook
  • interactive : admin_data
  • InterfaceSupportsErrorInfo() : CvsCoworker
  • IntersectRect() : URect
  • IntList() : CRevNumber
  • invalFlag : CMacroSet
  • InvalidateOldPos() : CCJToolBar
  • InvalidateRect() : CScrollView
  • InvalidateTabs() : CCJFlatTabCtrl
  • InvalidateView() : CBrowseFileView
  • InvalidCache() : LPseudoWinAttachment
  • ioFlAttrib : ASMacInfo
  • ioFlFndrInfo : ASFinderInfo
  • ioFlXFndrInfo : ASFinderInfo
  • iosb : PIPE
  • ircAll : CGfxOutBarCtrl
  • ircIcon : CGfxOutBarCtrl
  • ircii2ctcp() : irciiAttrCvt
  • ircLabel : CGfxOutBarCtrl
  • IsAdded() : KoFilterModel
  • IsAvail() : CTcl_Interp, CPython_Interp
  • isBinary : ReportConflict
  • IsBinary() : ReportConflict
  • IsBottomDocked() : CCJControlBar
  • IsButtonChecked() : CCJToolBar
  • IsButtonEnabled() : CCJToolBar
  • IsButtonHidden() : CCJToolBar
  • IsButtonHighlighted() : CCJToolBarCtrl
  • IsButtonIndeterminate() : CCJToolBar
  • IsButtonPressed() : CCJToolBar
  • IsChanged() : KoFilterModel
  • ischeck : TbEntryButton
  • ischildof() : CRevNumber
  • IsConflict() : KoFilterModel
  • IsCvsRunning() : UCvsApp, CvsPrefs
  • IsCvsStopping() : UCvsApp
  • IsDeadNode() : CWinLogData
  • IsDefaultAscending() : KiColumn, KoConflictColumn, KoDateColumn, KoTagColumn, KoStatusColumn, KoOptionColumn, KoRevisionColumn, KoPathColumn, KoNameColumn
  • IsDefaultMode() : KoFilterModel
  • IsDerivedFrom() : URuntimeClass
  • IsDiskNode() : CWinLogData
  • IsDockBar() : CCJSizeDockBar
  • IsDockSizeBar() : CCJSizeDockBar
  • iSelAnimCount : CGfxOutBarCtrl
  • iSelAnimTiming : CGfxOutBarCtrl
  • iSelFolder : CGfxOutBarCtrl
  • IsEnabled() : KoUpdateMoveToTrashHandler
  • IsEnteredTwice() : USemaphore
  • IsExtension() : ReportConflict
  • isFileDifferent() : CvsProject
  • IsFindValid() : CCJTreeCtrl
  • IsFloating() : CCJControlBar
  • IsHideUnknown() : KoFilterModel
  • IsHooked() : CSubclassWnd
  • IsHorzDocked() : CCJControlBar
  • IsIgnored() : EntnodeData
  • IsKindOf() : UObject
  • IsLastControlBar() : CCJSizeDockBar
  • IsLeftDocked() : CCJControlBar
  • IsLocked() : EntnodeData
  • IsMatch() : KoTraversalContext, KoFilterModel, KiFilterModel
  • IsMenu() : CCJMenu
  • IsMissing() : EntnodeData, KoFilterModel
  • IsModified() : KoFilterModel
  • IsNewShell() : CCJMenu
  • iso8859_1 : CTCP2Parse
  • iso8859_2 : CTCP2Parse
  • iso8859_3 : CTCP2Parse
  • iso8859_4 : CTCP2Parse
  • iso8859_5 : CTCP2Parse
  • iso8859_6 : CTCP2Parse
  • iso8859_7 : CTCP2Parse
  • iso8859_8 : CTCP2Parse
  • iso8859_9 : CTCP2Parse
  • IsoConvert() : CvsPrefs
  • ispartof() : CRevNumber
  • IsRadio() : CPseudoToggle
  • IsRectEmpty() : URect
  • IsRectNull() : URect
  • IsRecursive() : TViewFill, KoTraversalContext
  • IsRemoved() : EntnodeData, KoFilterModel
  • IsRightDocked() : CCJControlBar
  • issamebranch() : CRevNumber
  • IsSamePath() : CTCLBrowserEnt
  • IsSelected() : CWincvsView, CCJHexEdit
  • IsSelSingleNode() : CGraphView
  • IsShowIgnored() : TViewFill, KoTraversalContext, KoIgnoreModel, KiIgnoreModel
  • IsShowRecursive() : KoRecursionModel, KiRecursionModel
  • IsSmallIconView() : CGfxOutBarCtrl
  • IsSortAscendant() : UCvsFiles
  • isStderr : GPT_CONSOLE
  • issubbranchof() : CRevNumber
  • IsTclFileRunning() : CvsPrefs
  • IsTopDocked() : CCJControlBar
  • IsUIValid() : UWidget
  • IsUnknown() : EntnodeData, KoFilterModel
  • IsUnmodified() : EntnodeData
  • IsUserState() : CWinLogData
  • IsValid() : PyAutoObject< T >
  • IsValidButton() : CCJMenuBar
  • IsValidItem() : CGfxOutBarCtrl
  • IsVertDocked() : CCJControlBar
  • IsVisited() : EntnodeData
  • IsWin95() : CCJFlatComboBox
  • iSysColorTo : CJX_COLORMAP
  • italic : UCvsConsole, ansiAttrCvt
  • italicCnt : CTCP2Parse
  • italicLast : CTCP2Parse
  • item : UTREE_INFO
  • itemcode : list3
  • items() : CToolBarData

- j -
  • jmpbuf : PIPE

- k -
  • kBrowserPopup : UCvsFrame
  • kCancel : UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver, UAuthen_SSH, UEditMessage, UPromptMessage
  • kCheckPort : UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver
  • kCheckProxy : UAuthen_Pserver
  • kCheckRSHName : UAuthen_Rhosts
  • kCheckServerName : UAuthen_Rhosts
  • kConflict : EntnodeFile
  • kCopyFrom : USaveSettings
  • kCopyList : USaveSettings
  • kCopyPath : USaveSettings
  • kDefaultPrecision : TPseudoDoubleNumberText
  • kDirCombo : UCvsFrame
  • kDrawing : UCvsGraph
  • kEdit : UEditMessage
  • kEditPort : UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver
  • kEditProxy : UAuthen_Pserver
  • kEditRSHName : UAuthen_Rhosts
  • kEditServerName : UAuthen_Rhosts
  • key : CustInvertTable, node
  • KeywordSubst() : CRcsFile
  • keywordSubst : CRcsFile
  • kflag : admin_data
  • KillChildWindow() : CCJCaption
  • KillThread() : CLogoutThread
  • Kind() : ReportWarning
  • kind : Authen, TbEntry, ReportWarning
  • kindstr() : Authen
  • kindToNum() : Authen
  • kindToToken() : Authen
  • kMsg : UEditMessage, UPromptMessage
  • kMultiClickSelection : TPseudoTextListView
  • kName : EntnodeData
  • kNameProxy : UAuthen_Pserver
  • KoColumnContext() : KoColumnContext
  • KoFilterModel() : KoFilterModel
  • KoIgnoreModel() : KoIgnoreModel
  • kOK : UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver, UAuthen_SSH, UEditMessage, UPromptMessage
  • kOption : EntnodeFile
  • kOptionsCheck : UAuthen_SSH
  • kOptionsEdit : UAuthen_SSH
  • kOptionsText : UAuthen_SSH
  • KoRecursionModel() : KoRecursionModel
  • KoTraversalContext() : KoTraversalContext
  • KoUpdateMoveToTrashHandler() : KoUpdateMoveToTrashHandler
  • KoWatcher() : KoWatcher
  • kPath : EntnodeData
  • kProcessTimer : UCvsApp
  • kPseudoWinAdorner : TPseudoWinAdorner
  • kPseudoWinBehavior : TPseudoWinBehavior
  • kRSABtn : UAuthen_SSH
  • kRSACheck : UAuthen_SSH
  • kRSAEdit : UAuthen_SSH
  • kSelectionChanged : TPseudoTextListView
  • KserverPort() : CvsPrefs
  • kSettingName : USaveSettings
  • kSSHBtn : UAuthen_SSH
  • kSSHCheck : UAuthen_SSH
  • kSSHName : UAuthen_SSH
  • kStatus : EntnodeData
  • kStdDoubleNumberText : TPseudoDoubleNumberText
  • kTag : EntnodeFile
  • kTextStringListViewSignature : TPseudoTextListView
  • kTS : EntnodeFile
  • kUDispatchHandled : UCmdTarget
  • kUNoDispatchInfo : UCmdTarget
  • kVN : EntnodeFile

- l -
  • l_argcount : EXHCB
  • l_buf : internal_state
  • l_desc : internal_state
  • l_efblk : fatdef
  • l_file : file_list_str
  • l_hiblk : fatdef
  • l_module : file_list_str
  • l_status : EXHCB
  • lAnimationTickCount : CGfxOutBarCtrl
  • last : inflate_blocks_state, err_strs, revlist, option_revlist
  • last_eob_len : internal_state
  • last_flush : internal_state
  • last_lit : internal_state
  • LastAccess() : CRcsFile
  • LastBranche() : CRevFile
  • LastLock() : CRcsFile
  • LastRev() : CRcsFile
  • LastSymbName() : CRcsFile
  • LastWorkingDir() : CvsPrefs
  • Layout() : CCJToolBar
  • lbits : inflate_codes_state
  • left : URECT, inflate_blocks_state
  • len : inflate_codes_state, ct_data_s, deltatext, GPT_CONSOLE
  • LEN : inflate_codes_state
  • LENEXT : inflate_codes_state
  • length : UStr, UPStr, CLogStr, CvsPrefs, Vstring, equivclass
  • lengths : diff3_block, diff_block
  • level : internal_state
  • linbuf : file_data
  • linbuf_base : file_data
  • line : unrecog, equivclass
  • line0 : change
  • line1 : change
  • lines : diff3_block, diff_block
  • lines_alloced : linevector
  • LineTo() : UDC
  • link : change
  • list : list
  • list_t : TMString< T >, TMPersistent< T >
  • ListenToMessage() : LPseudoWinAttachment, UPseudoPageHider, UPseudoPlaceHolder
  • lit : inflate_codes_state
  • LIT : inflate_codes_state
  • lit_bufsize : internal_state
  • LMainPseudoAttachment() : LMainPseudoAttachment
  • lo_minimal : partition
  • Load() : CCJMemFile
  • load() : CvsPrefs
  • LoadAll() : CPersistent
  • LoadBarState() : CCJMDIFrameWnd, CCJFrameWnd, CCJControlBar
  • LoadBitmap() : CCJToolBar
  • LoadCheckmarkBitmap() : CCJMenu
  • LoadColumns() : CBrowseFileView
  • LoadColumnWidths() : CCJListView, CCJListCtrl
  • LoadDefaults() : MacBinMaps
  • LoadFromResource() : CCJHtmlView
  • LoadFromToolBar() : CCJMenu
  • loadIcon() : CPseudoButton
  • LoadMenu() : CCJMenuBar, CCJMenu
  • LoadSysColorBitmap() : CCJMenu
  • LoadToolBar() : CCJToolBar
  • LoadToolbar() : CCJMenu
  • LoadToolbars() : CCJMenu
  • LoadWindowPos() : CCJWindowPlacement
  • LoadXPM() : CPseudoButton
  • LoadXPMs() : CPseudoRotButton
  • local : context
  • Location() : CSortList< T >
  • Lock() : CCVS_CoworkerModule
  • locked : EntnodeData
  • Locker() : CRevFile
  • locker : CRevFile
  • lockid : LOCK
  • locks : rcsnode
  • locks_data : rcsnode
  • LocksList() : CRcsFile
  • locksList : CRcsFile
  • LockStrict() : CRcsFile
  • lockStrict : CRcsFile
  • log : deltatext
  • log_data : log_data_and_rcs
  • logfont : CCJTreeCtrl::Color_Font
  • LogoutTimeOut() : CvsPrefs
  • long_header : log_data
  • lookahead : internal_state
  • LookForResourceFile() : CWincvsApp
  • Lookup() : CSubclassWndMap
  • lpEntries : UMSGMAP
  • LPseudoDrawAttachment() : LPseudoDrawAttachment
  • LPseudoWinAttachment() : LPseudoWinAttachment
  • lpszText : tagAFX_OLDTOOLINFO
  • lsh_ctx : gusilsh_ctx
  • Lt_Blue : CTCP2Parse
  • Lt_Cyan : CTCP2Parse
  • Lt_Green : CTCP2Parse
  • Lt_Grey : CTCP2Parse
  • Lt_Magenta : CTCP2Parse
  • Lt_Red : CTCP2Parse
  • Lt_Yellow : CTCP2Parse
  • ltree : inflate_codes_state

- m -
  • m_abort : CProgressDialog, CProgress
  • m_addbtn : CCustomizeMenus
  • m_all : PyRegistry
  • m_AllSubMenus : CCJMenu
  • m_aPans : CCJStatusBar
  • m_ar : _afxRichEditCookie
  • m_arg1 : CMsg
  • m_arg2 : CMsg
  • m_arrayOffsetName : CvsFilenames
  • m_ArrowRect : CCJColorPicker
  • m_arStrings : CCJMenuBar
  • m_ascendant : CBrowseFileView, UCvsFiles
  • m_Attach : UPseudoFakePane
  • m_bActive : CCJColorPicker
  • m_bAddressIsWide : CCJHexEdit
  • m_bAdjustToFit : CCJHyperLink
  • m_bAltColor : CCJFlatButton
  • m_bAscending : CCJListView, CCJListCtrl
  • m_bATLInited : CWincvsApp
  • m_bAutoComp : CCJFlatComboBox
  • m_bAutodelete : CCJStatusBarPaneControlInfo
  • m_bAutoRemoveFrameMenu : CCJMenuBar
  • m_bAutoSave : CCJListView, CCJListCtrl, CCJControlBar
  • m_bBoldFont : CCJFlatHeaderCtrl
  • m_bButtons : CCJControlBar
  • m_bDelayedButtonLayout : CCJToolBar
  • m_bDragging : CCJSizeDockBar, CCJControlBar
  • m_bEscapeWasPressed : CCJMenuBar
  • m_bExStyle : CCJToolBarBase
  • m_bFlatBorder : CCJSizeDockBar, CCJControlBar
  • m_bFlatGripper : CCJControlBar
  • m_bFlatLook : CCJFlatButton
  • m_bFlatSplitter : CCJFlatSplitterWnd
  • m_bFloating : CCJControlBar
  • m_bGripper : CCJControlBar
  • m_bHalfPage : CCJHexEdit
  • m_bHasArrows : CCJFlatTabCtrl
  • m_bHasFocus : CCJFlatComboBox
  • m_bHasHomeEnd : CCJFlatTabCtrl
  • m_bHilight : CCJOutlookBar
  • m_bInReBar : CCJToolBarBase
  • m_bIsDockBar : CCJSizeDockBar
  • m_bitmap : CSplashWnd, CPseudoButton
  • m_bitmapBackground : CCJMenu
  • m_bitmapBackgroundFlag : CCJMenu
  • m_bitmaps : CPseudoRotButton
  • m_bLBDown : CCJOutlookBar
  • m_bLBtnDown : CCJFlatHeaderCtrl, CCJFlatComboBox, CCJFlatButton, CCJColorPicker
  • m_bMaskKeyInProgress : CCJMaskEdit
  • m_bMaximized : CCJControlBar
  • m_bMouseOver : CCJFlatButton
  • m_bMultiSelect : CCJTreeCtrl
  • m_bNoAddressChange : CCJHexEdit
  • m_bNoColSizing : CCJListView, CCJListCtrl
  • m_bOkToDrag : CCJSizeDockBar, CCJControlBar
  • m_BoldFont : CCJFlatTabCtrl
  • m_bOpen : CCJMemFile
  • m_bOpenFileDialog : CCJBrowseButton
  • m_bOptionChecked : COptionalPropertySheet
  • m_bOverControl : CCJHyperLink
  • m_bPainted : CCJFlatComboBox, CCJFlatButton
  • m_bpr : CCJHexEdit
  • m_bProcessLeftArrow : CCJMenuBar
  • m_bProcessRightArrow : CCJMenuBar
  • m_bRestoreFocus : CMainFrame
  • m_browseHist : CMainFrame
  • m_browser : CBrowserBar
  • m_brush : UDC
  • m_bShowAddress : CCJHexEdit
  • m_bShowAscii : CCJHexEdit
  • m_bShowDropArrow : CCJToolBar
  • m_bShowHex : CCJHexEdit
  • m_bSortAsc : CSortHeaderCtrl, CCJFlatHeaderCtrl
  • m_bStartup : CTipDlg
  • m_bTabsOnBottom : CCJFlatTabCtrl
  • m_btnBrowse : CCJBrowseEdit
  • m_btnClose : CCJControlBar
  • m_btnMinim : CCJControlBar
  • m_bToFit : CCJControlBar
  • m_bToolTipsEnabled : CCJTabCtrlBar
  • m_bTrackSelection : CCJColorPicker
  • m_buf : UCvsConsole, CBuffer
  • m_bUnderline : CCJHyperLink
  • m_bUnique : CCJControlBar
  • m_bUpdate : CCJHexEdit
  • m_bUseMask : CCJMaskEdit
  • m_bVisited : CCJHyperLink
  • m_c : PyRegistry
  • m_CacheWidgets : LPseudoWinAttachment
  • m_Caption : CCJExplorerBar, CCJCaptionPopupWnd
  • m_CaptionButton : CCJExplorerBar, CCJCaptionPopupWnd, CCJCaption
  • m_cbBufferMax : CvsString
  • m_checkChanges : CBrowseFileView
  • m_ClassNameToImageIndexMap : CCJTabCtrlBar
  • m_clrAltHilite : CCJFlatButton
  • m_clrAltNormal : CCJFlatButton
  • m_clrAltShadow : CCJFlatButton
  • m_clrAltTextNm : CCJFlatButton
  • m_clrBackgnd : CCJCaption
  • m_clrBkgnd : CCJFontCombo
  • m_clrBorder : CCJCaption
  • m_clrBtnFace : CCJCaption
  • m_clrBtnHilite : CCJCaption
  • m_clrBtnShadow : CCJCaption
  • m_clrDkShad : CCJOutlookBar, CCJFlatButton
  • m_clrFont : CCJCaption
  • m_clrHilight : CCJFontCombo
  • m_clrHilightText : CCJFontCombo
  • m_clrHilite : CCJOutlookBar, CCJFlatComboBox, CCJFlatButton
  • m_clrNormal : CCJOutlookBar, CCJFlatComboBox, CCJFlatButton
  • m_clrNormalText : CCJFontCombo
  • m_clrShadow : CCJOutlookBar, CCJFlatComboBox, CCJFlatButton
  • m_clrText : CCJListView, CCJListCtrl
  • m_clrTextBk : CCJListView, CCJListCtrl
  • m_clrTextGy : CCJFlatButton
  • m_clrTextNm : CCJOutlookBar, CCJFlatButton
  • m_cmd : UTimer, CPseudoList
  • m_cmdid : CPseudoItem, LPseudoDrawAttachment, CPseudoDraw
  • m_cmdsList : CCustomizeMenus
  • m_cmdui : PyCmdUI
  • m_cncl : UPromptMessage
  • m_color : CColorStatic
  • m_column : CSortParam
  • m_columnAlt : CSortParam
  • m_comboFilterMask : CMainFrame
  • m_console : PyColorConsole
  • m_consolebar : CMainFrame
  • m_context : TViewFill, CSortParam
  • m_continue : UCmdUI
  • m_copyFromPath : USaveSettings
  • m_count : KoWatcher
  • m_crColor : CCJColorPopup
  • m_crColorBk : CCJColorPicker
  • m_crColors : CCJColorPopup
  • m_crColorText : CCJColorPicker
  • m_crHoverColor : CCJHyperLink
  • m_crInitialColor : CCJColorPopup
  • m_crLinkColor : CCJHyperLink
  • m_crVisitedColor : CCJHyperLink
  • m_csText : CContentItems
  • m_cstr : PyPersistent
  • m_ctrlHeader : CBrowseFileView
  • m_curHSplitBar : CCJSizeDockBar
  • m_curindex : CPseudoRotButton
  • m_currentAddress : CCJHexEdit
  • m_currentMode : CCJHexEdit
  • m_currentPage : UWidget
  • m_curSize : CBuffer
  • m_curVSplitBar : CCJSizeDockBar
  • m_CustomTextRect : CCJColorPopup
  • m_cx : CCJCaption
  • m_cxOffset : CCJControlBar
  • m_cxText : CCJStatusBarPane
  • m_cy : CCJCaption
  • m_cyOffset : CCJControlBar
  • m_data : TBrowserFillDummy, CPseudoItem, UCvsGraph, TBrowserFillDummy, PyCvsEntry
  • m_DefaultTextRect : CCJColorPopup
  • m_didSetIt : CTurnOffDispatching, CTempToggleBool
  • m_didSetSemaphore : USemaphore
  • m_dir : UCvsGraph
  • m_dirname : TBrowserFillDummy
  • m_disbitmap : CPseudoButton
  • m_disbitmaps : CPseudoRotButton
  • m_dlg : CProgress
  • m_doc : PyPersistent, PyCmdUI, PyMenuMgr, PyColorConsole, PyCvsEntry, PyRegistry
  • m_downbtn : CCustomizeMenus
  • m_dwData : CCJSortClass::CSortItem
  • m_dwDragStart : CCJTreeCtrl
  • m_dwError : _afxRichEditCookie
  • m_dwExStyle : CCJCaption
  • m_dwFlags : CCJBrowseButton
  • m_dwTextStyle : CCJCaption
  • m_eAuxIndex : CCJControlBar
  • m_eChildBorder : CCJControlBar
  • m_edit : CToolbarCombo, UEditMessage
  • m_editPos : CCJHexEdit
  • m_empty : TBrowserFillDummy
  • m_enteredTwice : USemaphore
  • m_entries : TBrowserFill, TViewFill, TBrowserFill, UCvsFiles, TViewFill, CFillTclEntries, CFillPyEntries
  • m_entriesLogMod : CBrowseFileView, UCvsFiles
  • m_entriesMod : CBrowseFileView, UCvsFiles
  • m_err : CPyCvsConsole
  • m_eType : CCJBrowseEdit, CCJBrowseButton
  • m_ev : CMsg
  • m_eventStartWatching : KoWatcher
  • m_eventTerminate : KoWatcher
  • m_fAccendant : CSortParam
  • m_fGroupSubDir : CSortParam
  • m_File : CCJMemFile
  • m_filter : CMainFrame, KoTraversalContext
  • m_flag : CPseudoToggle
  • m_Font : CCJTabCtrl, CCJOutlookBar, CCJMenuBar, CCJMaskEdit, CCJLogoPane, CCJHyperLink, CCJHexEdit, CCJFlatTabCtrl, CCJFlatHeaderCtrl, CCJFlatButton, CCJColorPopup, CCJCaption, CCJBrowseButton
  • m_fontNormal : CMainFrame
  • m_foundIt : CFindSettings
  • m_frameHook : CCJMenuBar
  • m_fullname : CFindSettings
  • m_garbage : CCustInvertTable
  • m_group : CPseudoToggle
  • m_handles : KoWatcher
  • m_hascvs : TBrowserFillDummy
  • m_hAuxIcon : CCJControlBar
  • m_hbmImageWell : CCJToolBar
  • m_hCursor : CCJFlatButton
  • m_heightOfLines : CBrowseFileView
  • m_hEndArrow : CCJFlatTabCtrl
  • m_hEndArrowDisabled : CCJFlatTabCtrl
  • m_hEnhMetaFile : CCJMetaFileButton
  • m_hEnhMetaFileDisabled : CCJMetaFileButton
  • m_hEnhMetaFileFocus : CCJMetaFileButton
  • m_hEnhMetaFileSel : CCJMetaFileButton
  • m_hHomeArrow : CCJFlatTabCtrl
  • m_hHomeArrowDisabled : CCJFlatTabCtrl
  • m_hIcon : CCJExplorerBar, CCJControlBar, CCJCaption, CCJBrowseButton
  • m_hIconOff : CCJCaptionPopupWnd
  • m_hIconOn : CCJCaptionPopupWnd
  • m_hInstImageWell : CCJToolBar
  • m_hItemFirstSel : CCJTreeCtrl
  • m_hKeyRoot : CCJToolBar
  • m_hLeftArrow : CCJFlatTabCtrl
  • m_hLeftArrowDisabled : CCJFlatTabCtrl
  • m_hLinkCursor : CCJHyperLink
  • m_hMenu : CCJMDIChildWnd
  • m_hMenuTracking : CCJMenuBar
  • m_hProject : CvsProject
  • m_hPushed : CCJFlatButton
  • m_hRightArrow : CCJFlatTabCtrl
  • m_hRightArrowDisabled : CCJFlatTabCtrl
  • m_hRsrcImageWell : CCJToolBar
  • m_hWnd : KoWatcher, CSubclassWnd
  • m_iActualSize : CCJSizeDockBar
  • m_iClientHeight : CCJFlatTabCtrl
  • m_iClientWidth : CCJFlatTabCtrl
  • m_iconX : CCJMenu
  • m_iconY : CCJMenu
  • m_iCurSel : CCJFlatTabCtrl
  • m_idletime : CWincvsApp
  • m_ignlist : TBrowserFill, TViewFill, CFillTclEntries, CFillPyEntries
  • m_Ignlist : ImportReport
  • m_ignore : CMainFrame
  • m_iLastError : CvsProject
  • m_ImageList : CHistComboBoxEx, CGraphView, CCJControlBar
  • m_Imagelist : CWinCvsBrowser
  • m_indic : CCvsStatusBar
  • m_iNewPopup : CCJMenuBar
  • m_instances : AuthenModel
  • m_iPopupTracking : CCJMenuBar
  • m_isAdded : KoFilterModel
  • m_iSafeSpace : CCJSizeDockBar
  • m_isBackgroundProcess : CWincvsApp
  • m_isChanged : KoFilterModel
  • m_isConflicts : KoFilterModel
  • m_isFiles : KoUpdateMoveToTrashHandler
  • m_isFilesChange : CBrowseFileView
  • m_isFolders : KoUpdateMoveToTrashHandler
  • m_isHideUnknown : KoFilterModel
  • m_isIgnore : KoIgnoreModel
  • m_isMissing : KoFilterModel
  • m_isRecursive : KoWatcher, CBrowseFileView, KoTraversalContext, KoRecursionModel
  • m_isRemoved : KoFilterModel
  • m_isResetViewLocked : CBrowseFileView
  • m_isResetViewPending : CWinCvsBrowser, CBrowseFileView
  • m_isSelectionChanged : CWinCvsBrowser
  • m_isSelectionNotificationLocked : CWinCvsBrowser
  • m_isShowIgnored : TBrowserFill, KoTraversalContext
  • m_isUnknown : KoFilterModel
  • m_item : TBrowserFill, TBrowserFillDummy, TBrowserFill, TBrowserFillDummy
  • m_iTotalTabWidth : CCJFlatTabCtrl
  • m_iTrackingState : CCJMenuBar
  • m_iXOffset : CCJFlatTabCtrl
  • m_lap : UTimer
  • m_lastlap : UTimer
  • m_lastRect : LPseudoWinAttachment
  • m_length : CCJHexEdit
  • m_lineHeight : CCJHexEdit
  • m_list : CFindSettings, USaveSettings
  • m_listCtrl : TViewFill
  • m_listeners : UWidget
  • m_lock : CCvsThreadLock
  • m_lpp : CCJHexEdit
  • m_lpszClassName : URuntimeClass
  • m_mainFrame : CWincvsApp
  • m_mainInterpreter : CPython_Interp
  • m_manager : CToolbarCombo, KoIgnoreModel, KoRecursionModel, KoFilterModel
  • m_mapColorFont : CCJTreeCtrl
  • m_mask : KoFilterModel
  • m_match : KoFilterModel
  • m_menu : CCJFrameWnd, PyMenuMgr
  • m_Menu : CCustomizeMenus
  • m_menuList : CCustomizeMenus, CCJMDIFrameWnd
  • m_MenuList : CCJMenu
  • m_methods : PyPersistent, PyCmdUI, PyMenuMgr, PyColorConsole, PyCvsEntry
  • m_modalRes : UWidget
  • m_modelColumns : CBrowseFileView
  • m_msg : UPromptMessage
  • m_nActiveTab : CCJTabView, CCJTabCtrlBar
  • m_name : UCvsGraph
  • m_nBarNumber : CCJToolBar
  • m_nBorder : CCJCaption
  • m_nBoxSize : CCJColorPopup
  • m_nButtons : CCJToolBar
  • m_nChosenColorSel : CCJColorPopup
  • m_nCount : CCJMDIChildWnd
  • m_nCurrentSel : CCJColorPopup
  • m_next : PyRegistry
  • m_nFilenames : CvsFilenames
  • m_nFlags : CCJStatusBarPane
  • m_nHeight : CCJPagerCtrl
  • m_nHiddenCol : CCJFlatSplitterWnd
  • m_nHiddenRow : CCJFlatSplitterWnd
  • m_nID : CCJStatusBarPane, CCJControlBar, CCJBrowseButton, UCmdUI
  • m_nImageID : CContentItems
  • m_nIndex : CCJOutlookBar
  • m_nMargin : CCJColorPopup
  • m_nMaxColWidth : CCJListView, CCJListCtrl
  • m_nMenu : CCJBrowseEdit, CCJBrowseButton
  • m_nMenuID : CCJMenuBar, CCJMDIChildWnd
  • m_nMinColWidth : CCJListView, CCJListCtrl
  • m_nMinSize : CCJListView, CCJListCtrl
  • m_nNextToolTipId : CCJTabCtrlBar
  • m_nNumColors : CCJColorPopup
  • m_nNumColumns : CCJColorPopup
  • m_nNumItems : CCJOutlookBar
  • m_nNumRows : CCJColorPopup
  • m_nObjectSize : URuntimeClass
  • m_node : UCvsGraph
  • m_nodes : NotificationManager
  • m_nOffset : CCJFlatHeaderCtrl, CCJCaption
  • m_notify : CWinCvsBrowser::CSelectionChangeNotifier
  • m_nPaneID : CCJStatusBarPaneControlInfo
  • m_nPointTab : CCJTabCtrlBar
  • m_nPos : CCJTabCtrl, CCJFlatHeaderCtrl, CCJControlBar
  • m_nSelectionMode : CCJColorPicker
  • m_nSortCol : CSortHeaderCtrl, CCJFlatHeaderCtrl
  • m_nSortedCol : CCJListView, CCJListCtrl
  • m_nStyle : CCJStatusBarPane
  • m_nSubMenuIndx : CCJBrowseEdit, CCJBrowseButton
  • m_nToolBarID : CCJMDIChildWnd
  • m_nToolBarIDs : CCJMDIChildWnd
  • m_nullWidth : CCJHexEdit
  • m_numberByPages : CBrowseFileView
  • m_numberOfLines : CBrowseFileView
  • m_numberOfPages : CGraphView, CBrowseFileView
  • m_numbuf : UCvsConsole
  • m_nWidth : CCJPagerCtrl
  • m_o : PyAutoObject< T >
  • m_object : PyPersistent::obj_t, PyCmdUI::obj_t, PyMenuMgr::obj_t, PyColorConsole::obj_t, PyCvsEntry::obj_t
  • m_offAddress : CCJHexEdit
  • m_offAscii : CCJHexEdit
  • m_offHex : CCJHexEdit
  • m_ok : UPromptMessage
  • m_oldname : USaveSettings
  • m_optionCheck : COptionalPropertySheet
  • m_options : UAuthen_SSH
  • m_out : CPyCvsConsole
  • m_p : CPyThreadState
  • m_pActiveView : CCJTabView, CCJTabCtrlBar
  • m_pageHeight : CGraphView
  • m_PageValues : LPseudoWinAttachment
  • m_Palette : CCJColorPopup
  • m_path : KoWatcher, CBrowseFileView, UCvsFiles, USaveSettings, KoColumnContext
  • m_pathToFind : CFindSettings
  • m_pBarInfo : CCJToolBar
  • m_pBrowserApp : CCJHtmlView
  • m_pChildParent : CCJCaptionPopupWnd
  • m_pChildWnd : CCJControlBar, CCJCaptionPopupWnd, CCJCaption
  • m_pContents : CCJOutlookBar
  • m_pControls : CCJToolBar
  • m_pData : CCJHexEdit
  • m_pDropButtons : CCJToolBar
  • m_pEditWnd : CCJBrowseButton
  • m_pen : UDC
  • m_pEndButton : CCJFlatTabCtrl
  • m_pError : CCJMemFile
  • m_pfnCreateObject : URuntimeClass
  • m_pfnGetBaseClass : URuntimeClass
  • m_pFont : CCJFlatButton, CCJCaption
  • m_pHeaderCtrl : CCJListView, CCJListCtrl
  • m_pHomeButton : CCJFlatTabCtrl
  • m_pImageListLarge : CCJOutlookBar
  • m_pImageListSmall : CCJOutlookBar
  • m_pLeftButton : CCJFlatTabCtrl
  • m_pListCtrl : CCJListView, CCJListCtrl
  • m_pMenuBar : CCJMenuBarFrameHook
  • m_pname : UAuthen_Pserver
  • m_pNext : CSubclassWnd
  • m_pNextClass : URuntimeClass
  • m_pNextProject : CvsProject
  • m_pNotifyWnd : CCJCaption
  • m_point : CCJOutlookBar
  • m_pOldWndProc : CSubclassWnd
  • m_popToolbarID : CCJTabCtrl, CCJFlatHeaderCtrl, CCJControlBar
  • m_popupMenu : CGfxOutBarCtrl, CCJTabCtrl, CCJMenuBar, CCJFlatHeaderCtrl, CCJControlBar
  • m_popupMenuID : CCJTabCtrl, CCJFlatHeaderCtrl, CCJControlBar
  • m_port : UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver
  • m_pOwner : CCJOutlookBar
  • m_pParent : CProgressDialog, CCJColorPopup
  • m_pParentWnd : CCJFlatHeaderCtrl, CCJColorPicker, CCJCaptionPopupWnd, CCJBrowseButton
  • m_pport : UAuthen_Pserver
  • m_pRightButton : CCJFlatTabCtrl
  • m_progress : CProgressDialog
  • m_pseudo : CPseudoDraw, CPseudoDlg
  • m_pStream : CTipDlg
  • m_pStringMap : CCJToolBar
  • m_pTabCtrl : CCJTabView
  • m_ptCurDrag : CCJSizeDockBar, CCJControlBar
  • m_ptCurrent : CCJSizeDockBar
  • m_ptMouse : CCJMenuBar
  • m_pToolTip : CCJTabView
  • m_ptOrig : CCJDockContext
  • m_ptStartDrag : CCJSizeDockBar, CCJControlBar
  • m_pWnd : CWndRedrawMngr, CCJStatusBarPaneControlInfo, CCJSortClass
  • m_pWndPopDown : CCJCaption
  • m_radio : CPseudoToggle
  • m_rcChild : CCJCaption
  • m_rcClient : CCJCaption
  • m_rcOldPos : CCJToolBar
  • m_rcOldSize : CCJFlatHeaderCtrl
  • m_rcTrack : CCJSizeDockBar, CCJControlBar
  • m_recursion : CMainFrame
  • m_registry : PyPersistent, PyCmdUI, PyMenuMgr, PyColorConsole, PyCvsEntry
  • m_remind : CNoPython
  • m_removebtn : CCustomizeMenus
  • m_root : CWinCvsBrowser, TBrowserFill, TBrowserFillDummy, UCvsFolders, TBrowserFill, TBrowserFillDummy
  • m_rsaidentity : UAuthen_SSH
  • m_rsaidentityfile : UAuthen_SSH
  • m_rshname : UAuthen_Rhosts
  • m_sBuffer : CvsString, CvsFilenames
  • m_section : KoWatcher
  • m_selectcheck : CCJMenu
  • m_selEnd : CCJHexEdit
  • m_selStart : CCJHexEdit
  • m_semaphore : CRecursionLock, USemaphore
  • m_server : CWincvsApp
  • m_servername : UAuthen_Rhosts
  • m_settimer : CCvsStatusBar
  • m_settingName : USaveSettings
  • m_sizeButton : CCJToolBar
  • m_sizeDesired : CCJControlBar
  • m_sizeFloat : CCJControlBar
  • m_sizeHorz : CCJControlBar
  • m_sizeIcon : CCJFlatButton
  • m_sizeImage : CCJToolBar
  • m_sizeNormal : CCJControlBar
  • m_sizeVert : CCJControlBar
  • m_SmallImageList : CCustomizeMenus, CBrowseFileView
  • m_sort : CBrowseFileView, UCvsFiles
  • m_sOuter : CvsTrace
  • m_sProjectHome : CvsProject
  • m_sProjectName : CvsProject
  • m_state : CMainFrame
  • m_StateImageList : CBrowseFileView
  • m_step : CCvsStatusBar
  • m_stopable : CProgressDialog
  • m_strCaption : CCJExplorerBar
  • m_strCustomText : CCJColorPopup, CCJColorPicker
  • m_strDefault : CCJListView, CCJListCtrl
  • m_strDefaultText : CCJColorPopup, CCJColorPicker
  • m_strDefExt : CCJBrowseButton
  • m_strEntry : CCJListView, CCJListCtrl
  • m_strFileName : CCJBrowseButton
  • m_strFilter : CCJBrowseButton
  • m_strFormat : CCJWindowPlacement
  • m_strHours : CCJTimeEdit
  • m_strItemText : CCJSortClass::CSortItem
  • m_strLiteral : CCJMaskEdit
  • m_strLogoText : CCJLogoPane
  • m_strMask : CCJMaskEdit
  • m_strMaskLiteral : CCJMaskEdit
  • m_strMins : CCJTimeEdit
  • m_strRemoveItem : CGfxOutBarCtrl
  • m_strRenameItem : CGfxOutBarCtrl
  • m_strSection : CCJWindowPlacement, CCJListView, CCJListCtrl, CCJControlBar
  • m_strSubKey : CCJToolBar
  • m_strText : CCJStatusBarPane
  • m_strTip : CTipDlg
  • m_strTitle : CCJBrowseButton
  • m_strURL : CCJHyperLink
  • m_strValid : CCJMaskEdit
  • m_strValueName : CCJToolBar
  • m_strWindowText : CCJMaskEdit
  • m_strWindText : CCJCaption
  • m_strWndPos : CCJWindowPlacement
  • m_style : UPen
  • m_SubMenus : CCJMenu
  • m_sUsername : CvsProject
  • m_szMenuText : CCJMenuData
  • m_TabCtrl : CCJTabCtrlBar
  • m_TabFont : CCJTabView
  • m_TabImages : CMainFrame
  • m_TabList : CCJFlatTabCtrl
  • m_tabs : UWidget
  • m_TabTipList : CCJFlatTabCtrl
  • m_term : CLogoutThread
  • m_text : CToolbarCombo
  • m_texts : CPseudoItem
  • m_timers : UWidget
  • m_title : UPromptMessage
  • m_ToolTip : CCJHyperLink, CCJFlatTabCtrl, CCJControlBar, CCJColorPopup
  • m_tooltips : UWidget
  • m_topindex : CCJHexEdit
  • m_TreeCtrl : CExploreBar
  • m_treeCtrl : TBrowserFill, TBrowserFillDummy, TBrowserFill, TBrowserFillDummy
  • m_type : PyRegistry
  • m_uiFilechangeTimer : CBrowseFileView
  • m_uiOpenFlags : CCJMemFile
  • m_unselectcheck : CCJMenu
  • m_upBorder : CGfxSplitterWnd
  • m_upbtn : CCustomizeMenus
  • m_url : CAboutDlg, CNoPython
  • m_v : PyRegistry
  • m_value : CTempToggleBool
  • m_vers : CAboutDlg
  • m_view : CWinCvsBrowser::CSelectionChangeNotifier, CBarConsole, KoTraversalContext
  • m_viewList : CCJTabCtrlBar
  • m_viewPath : CWincvsDoc
  • m_views : CCJTabView
  • m_wasLocked : CWinCvsBrowser::CSelectionChangeNotifier
  • m_watch : CBrowseFileView
  • m_wid : CMsg, UDC, CPseudoList
  • m_widget : UCmdUI
  • m_widgets : UWidget
  • m_widid : UCmdTarget, CPseudoItem, LPseudoWinAttachment, LPseudoDrawAttachment
  • m_width : UPen
  • m_WindowRect : CCJColorPopup
  • m_winInfo : UToolbar
  • m_wndBrowser : CMainFrame, CCJHtmlView
  • m_wndFilter : CMainFrame
  • m_wndList : CMainFrame
  • m_wndMenuBar : CCJMDIFrameWnd, CCJFrameWnd
  • m_wndMultiUser : CMainFrame
  • m_wndStatusBar : CMainFrame
  • m_wndTags : CMainFrame
  • m_wndToolBar : CMainFrame
  • m_wndWorkspace : CMainFrame
  • MA_DECLARE_CLASS : TPseudoDoubleNumberText, TPseudoTextListView, TPseudoCustomView, TPseudoWinAdorner, TPseudoWinBehavior, TPseudoAppBehavior, TPseudoIconCheckBox, TPseudoRotateIconButton, TPseudoIconButton, TPseudoIconPopup, TPseudoScrollBar, TBuggyPopup
  • MacBinEncoding() : CvsPrefs
  • MacBinMaps() : MacBinMaps
  • Magenta : CTCP2Parse
  • magicNum : ASHeader
  • MapAccelerator() : CCJToolBarCtrl, CCJToolBar
  • maps : MACBINMAPENTRIES
  • MarkButton() : CCJToolBarCtrl
  • marker : internal_state
  • Match() : ReportConflict
  • match_available : internal_state
  • match_length : internal_state
  • match_start : internal_state
  • matches : internal_state
  • max : USLIDER
  • max_chain : config_s
  • max_chain_length : internal_state
  • MAX_CHAR_BY_LINE : UCvsConsole
  • max_code : tree_desc_s
  • max_ent : S_Dir
  • max_lazy : config_s
  • max_lazy_match : internal_state
  • max_length : static_tree_desc_s
  • Maximize() : CCJSizeDockBar, CCJControlBar
  • MaximizeBand() : CCJReBarCtrl
  • maxWarnings : ReportWarning
  • MeasureItem() : CCJOutlookBar, CCJMenu, CCJFontCombo
  • menuIconNormal : CCJMenuData
  • MenuInputFilter() : CCJMenuBar
  • mergeMethod : WrapperEntry
  • Meridian : YYSTYPE
  • messageMap : UWidget, UToolbar, UMenu, UCmdTarget, UMacAppMenu, UCvsToolbar, UCvsMenubar, UCvsGraph, UCvsFrame, UCvsFolders, UCvsFiles, UCvsConsole, UCvsApp, USaveSettings, UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver, UAuthen_SSH, UEditMessage, UPromptMessage
  • METHOD : internal_state
  • method : internal_state
  • millitm : timeb
  • min : USLIDER
  • Minimize() : CCJControlBar
  • MinimizeBand() : CCJReBarCtrl
  • mirc2ctcp() : mircAttrCvt
  • mirc2ctcpmap : mircAttrCvt
  • missing : EntnodeData
  • missing_newline : file_data
  • mod : hrec
  • mode : inflate_blocks_state, internal_state, inflate_codes_state, gz_stream, PIPE
  • modify : ASFileDates
  • ModifyCaptionStyle() : CCJCaption
  • ModifyFlag() : CGfxOutBarCtrl
  • ModifyODMenuA() : CCJMenu
  • ModifyODMenuW() : CCJMenu
  • ModifyTabStyle() : CCJTabView, CCJTabCtrlBar
  • modname : sortrec
  • modtime : VMStimbuf, utimbuf
  • more : inflate_huft_s
  • Move() : CCJHexEdit
  • MoveBand() : CCJReBarCtrl
  • MoveButton() : CCJToolBarCtrl
  • MoveDockBar() : CCJDockContext
  • MoveRow() : CCJListView, CCJListCtrl
  • MoveTo() : UDC
  • mR : TGraphRectSelect
  • msg : z_stream_s, gz_stream
  • msgSend : CGfxGroupEdit
  • mShiftOn : TGraphRectSelect
  • MulDiv() : URect
  • multibyte : re_pattern_buffer
  • MultiFiles() : MultiFiles
  • MultiFilesEntry() : MultiFilesEntry
  • mView : TGraphRectSelect, CGraphRectTracker
  • my_read : _CvsProcess
  • my_write : _CvsProcess

- n -
  • name : request, response, _TABLE, error_info, saved_cwd, option, _TABLE, file_data, CMacroEntry, option, LV_COLUMN
  • nameonly : log_data
  • names : dirdata
  • Navigate() : CCJHtmlView
  • Navigate2() : CCJHtmlView
  • NavigateComplete2() : CCJHtmlView
  • need : internal_state, inflate_codes_state
  • NeedSave() : CPersistent
  • New() : PyPersistent, PyCmdUI, PyMenuMgr, PyColorConsole, PyCvsEntry
  • newdir() : MultiFiles
  • newfile() : MultiFiles
  • newline_anchor : re_pattern_buffer
  • NewMenu() : CCJMDIFrameWnd, CCJFrameWnd
  • NewODMenu() : CCJMenu
  • NewRoot() : CHistComboBoxEx
  • next : MultiFiles, DROPDOWNBUTTON, UTREE_INFO, CLogNode, _SUBIO, PIPE, rcsversnode, datelist, revlist, option_revlist, list, node, unrecog, pid_list, SIG_hlist, msg, equivclass, diff3_block, diff_block, regexp_list, ReportWarning, ReportConflict, DYN_LIST, _frameRec
  • Next : CLogNode, inflate_huft_s
  • next_in : z_stream_s
  • next_out : z_stream_s
  • nFlags : CCJMenuData
  • nice_length : config_s
  • nice_match : internal_state
  • nick1 : cmd
  • nick2 : cmd
  • nID : CCJMenuData, CJX_CONTROLPOS
  • nIndex : CJX_CONTROLPOS
  • nlines : linevector
  • nMessage : UMSGMAP_ENTRY
  • no_sub : re_pattern_buffer
  • noConflict : ReportConflict
  • node : CTCLBrowserEnt
  • Node() : CLogNodeData, NotificationManager::Node
  • noheader : internal_state
  • nonbranch : vers_ts, stickydirtag
  • nondiscarded_lines : file_data
  • NORMAL : CCJFlatComboBox
  • Normalize() : CCJSizeDockBar, CCJControlBar
  • NormalizeRect() : URect
  • NormalizeSel() : CCJHexEdit
  • not_bol : re_pattern_buffer
  • not_eol : re_pattern_buffer
  • notags : log_data
  • NotificationManager() : NotificationManager
  • NotifyAll() : NotificationManager
  • NotifySelectionChange() : CWinCvsBrowser
  • nowrap : internal_state
  • nSig : UMSGMAP_ENTRY
  • nul_void_ignore : CTCP2Parse::RGBColor
  • num_regs : re_registers
  • Number : YYSTYPE
  • numbuf : CStaticAllocT< T >
  • numentries : DYN_LIST
  • numEntries : ASHeader
  • NumFiles() : MultiFiles
  • numMaps : MACBINMAPENTRIES
  • NumNodes() : CGraphDoc
  • NumOfElements() : CSortList< T >
  • numToKind() : Authen

- o -
  • observer : NotificationManager::Node
  • Offset() : CWinLogData, UPoint, CWinLogData
  • OffsetRect() : URect
  • oldHandler : gusilsh_ctx
  • OnActivate() : CMainFrame
  • OnActivateApp() : CCJColorPopup
  • OnAdd() : CCustomizeMenus
  • OnAlias() : TViewFill, CFillTclEntries, CFillPyEntries, ImportReport, TraversalReport
  • OnAnyDevice() : TraversalReport
  • OnAppAbout() : CWincvsApp
  • OnAppCmdline() : CWincvsDoc
  • OnAppCopyrights() : CWincvsApp
  • OnAppCredits() : CWincvsApp
  • OnAppLogin() : CWincvsDoc
  • OnAppLogout() : CWincvsDoc
  • OnAppPreferences() : CWincvsDoc
  • OnAppRtagBranch() : CWincvsDoc
  • OnAppRtagDelete() : CWincvsDoc
  • OnAppRtagNew() : CWincvsDoc
  • OnBarStyleChange() : CCJToolBar, CCJMenuBar
  • OnBeforeNavigate2() : CCJHtmlView
  • OnBegindrag() : CBrowseFileView
  • OnBegindragMenulist() : CCustomizeMenus
  • OnBeginPrinting() : CWincvsView, CGraphView, CBrowseFileView
  • OnBeginrdrag() : CBrowseFileView
  • OnBroadcastCmdMsg() : CMainFrame
  • OnBrowserOpen() : CWincvsDoc
  • OnBrowserPopup() : UCvsFrame
  • OnBtnName() : UAuthen_SSH
  • OnBtnRSA() : UAuthen_SSH
  • OnButtonClose() : CCJExplorerBar, CCJControlBar
  • OnButtonMinimize() : CCJControlBar
  • OnCancel() : UPromptMessage
  • OnCaptButton() : CCJCaptionPopupWnd, CCJCaption
  • OnChangedRect() : CGraphRectTracker
  • OnChar() : CGfxGroupEdit, CCJMaskEdit, CCJHexEdit, CPseudoToggle
  • OnCheckName() : UAuthen_SSH
  • OnCheckOptions() : UAuthen_SSH
  • OnCheckPort() : UAuthen_Kserver, UAuthen_Rhosts, UAuthen_Pserver
  • OnCheckProxy() : UAuthen_Pserver
  • OnCheckRSA() : UAuthen_SSH
  • OnCheckRshName() : UAuthen_Rhosts
  • OnCheckServerName() : UAuthen_Rhosts
  • OnChgCursor() : UWidget
  • OnChgFocus() : UWidget
  • OnClicked() : CCJHyperLink, CCJColorPicker, CCJBrowseButton
  • OnClose() : CMainFrame, CLogFrame, CCJMDIFrameWnd, CCJFrameWnd
  • OnCmdAdd() : UCvsFolders, UCvsFiles
  • OnCmdAddb() : UCvsFiles
  • OnCmdCheckout() : UCvsFolders
  • OnCmdCmdline() : UCvsFrame
  • OnCmdCommit() : UCvsFolders, UCvsFiles
  • OnCmdDiff() : UCvsFolders, UCvsFiles
  • OnCmdEdit() : UCvsFolders, UCvsFiles
  • OnCmdEditors() : UCvsFolders, UCvsFiles
  • OnCmdEditsel() : UCvsFiles
  • OnCmdEditseldef() : UCvsFiles
  • OnCmdExplore() : UCvsFolders, UCvsFiles
  • OnCmdGraph() : UCvsFiles
  • OnCmdIgnore() : UCvsFolders, UCvsFiles
  • OnCmdImport() : UCvsFolders
  • OnCmdInit() : UCvsFrame
  • OnCmdLock() : UCvsFolders, UCvsFiles
  • OnCmdLog() : UCvsFolders, UCvsFiles
  • OnCmdLogin() : UCvsFrame
  • OnCmdLogout() : UCvsFrame
  • OnCmdMacroAdmin() : UCvsFrame
  • OnCmdMacrosSel() : UCvsFolders
  • OnCmdMsg() : CLogFrame, CGraphFrame
  • OnCmdPreferences() : UCvsFrame
  • OnCmdQueryUpdate() : UCvsFolders, UCvsFiles
  • OnCmdRelease() : UCvsFolders, UCvsFiles
  • OnCmdReload() : UCvsFolders, UCvsFiles
  • OnCmdRmv() : UCvsFiles
  • OnCmdRtagBranch() : UCvsFrame
  • OnCmdRtagDelete() : UCvsFrame
  • OnCmdRtagNew() : UCvsFrame
  • OnCmdSaveSettings() : UCvsFrame
  • OnCmdStatus() : UCvsFolders, UCvsFiles
  • OnCmdStopcvs() : UCvsFrame
  • OnCmdTagBranch() : UCvsFolders, UCvsFiles
  • OnCmdTagDelete() : UCvsFolders, UCvsFiles
  • OnCmdTagNew() : UCvsFolders, UCvsFiles
  • OnCmdTrash() : UCvsFiles
  • OnCmdUIAdd() : UCvsFolders, UCvsFiles
  • OnCmdUIAddB() : UCvsFiles
  • OnCmdUIAnytime() : UCvsFrame
  • OnCmdUICheckout() : UCvsFolders
  • OnCmdUICvsCmd() : UCvsFrame
  • OnCmdUIEditseldef() : UCvsFiles
  • OnCmdUIExplore() : UCvsFolders, UCvsFiles
  • OnCmdUIGraph() : UCvsFiles
  • OnCmdUIIgnore() : UCvsFolders, UCvsFiles
  • OnCmdUIImport() : UCvsFolders
  • OnCmdUIMacroAdmin() : UCvsFrame
  • OnCmdUIMacroSel() : UCvsFiles
  • OnCmdUIMacrosSel() : UCvsFolders
  • OnCmdUIQuit() : UCvsFrame
  • OnCmdUIRelease() : UCvsFiles
  • OnCmdUIReload() : UCvsFolders, UCvsFiles
  • OnCmdUIRmv() : UCvsFiles
  • OnCmdUIStopcvs() : UCvsFrame
  • OnCmdUITrash() : UCvsFiles
  • OnCmdUIUpdate() : UCvsFolders, UCvsFiles
  • OnCmdUIUpone() : UCvsFiles
  • OnCmdUnedit() : UCvsFolders, UCvsFiles
  • OnCmdUnlock() : UCvsFolders, UCvsFiles
  • OnCmdUpdate() : UCvsFolders, UCvsFiles
  • OnCmdUpone() : UCvsFiles
  • OnCmdWatchers() : UCvsFolders, UCvsFiles
  • OnCmdWatchOff() : UCvsFolders, UCvsFiles
  • OnCmdWatchOn() : UCvsFolders, UCvsFiles
  • OnColumnclick() : CBrowseFileView
  • OnComboAppend() : UWidget
  • OnComboDelSel() : UWidget
  • OnComboEnableSel() : UWidget
  • OnComboGetCount() : UWidget
  • OnComboGetMenu() : UWidget
  • OnComboGetPos() : UWidget
  • OnComboResetAll() : UWidget
  • OnComboSelDir() : UCvsFrame
  • OnComboSetPos() : UWidget
  • OnCommand() : COptionalPropertySheet
  • OnCommands() : UToolbar, UMenu
  • OnCommandStateChange() : CCJHtmlView
  • OnContentChange() : CToolbarCombo
  • OnContextMenu() : CGraphView, CCJHexEdit
  • OnCopyFrom() : USaveSettings
  • OnCopyrights() : UCvsFrame
  • OnCreate() : CSplashWnd, CMainFrame, CBarConsole, CGfxOutBarCtrl, CGfxGroupEdit, CCJToolBarCtrl, CCJTabView, CCJTabCtrlBar, CCJFontCombo, CCJFlatTabCtrl, CCJFlatHeaderCtrl, CCJExplorerBar, CCJControlBar, CCJColorPicker, CCJBrowseEdit, UCvsToolbar, UCvsMenubar, UCvsGraph, UCvsFolders, UCvsFiles, UCvsConsole
  • OnCreateClient() : CLogFrame
  • OnCredits() : UCvsFrame
  • OnCtlColor() : CTipDlg
  • OnCustomDraw() : CCJListView, CCJListCtrl
  • OnCustomize() : CWinCvsBrowser, CBrowseFileView
  • OnDblClick() : UCvsFiles
  • OnDblclkAllcmds() : CCustomizeMenus
  • OnDblclkMenulist() : CCustomizeMenus
  • OnDeleteitem() : CMyShellTree, CBrowseFileView
  • OnDestroy() : CWincvsView, CWinCvsBrowser, CCJToolBar, CCJListView, CCJListCtrl, CCJHtmlView, CCJFontCombo, CCJCaptionPopupWnd, CBrowserBar, CBrowseFileView, UToolbar, UCvsToolbar, UCvsMenubar, UCvsGraph, UCvsFrame, UCvsFolders, UCvsFiles, UCvsConsole
  • OnDirectory() : TBrowserFill, TBrowserFillDummy, TViewFill, TBrowserFill, TBrowserFillDummy, TViewFill, CFillTclEntries, CFillPyEntries, ImportReport, TraversalReport
  • OnDocumentComplete() : CCJHtmlView
  • OnDown() : CCustomizeMenus
  • OnDownloadBegin() : CCJHtmlView
  • OnDownloadComplete() : CCJHtmlView
  • OnDraw() : CWincvsView, CWinCvsBrowser, CGraphView, CExploreBar, CCJListView, CCJHtmlView, CBrowserBar
  • OnDrawing() : UCvsGraph
  • OnDrawSplitter() : CGfxSplitterWnd, CCJFlatSplitterWnd
  • OnDropdown() : CHistComboBoxEx
  • OnDropDownButton() : CCJToolBar
  • OnDropFiles() : CWincvsView, CMainFrame
  • OnEditClear() : CCJHexEdit
  • OnEditClearAll() : CWincvsView
  • OnEditCopy() : CCJHexEdit
  • OnEditCut() : CCJHexEdit
  • OnEditPaste() : CCJHexEdit
  • OnEditSelectAll() : CCJHexEdit, CBrowseFileView
  • OnEditUndo() : CCJHexEdit
  • OnEditUpdate() : CCJFlatComboBox
  • OnEnable() : CCJBrowseEdit
  • OnEnableCmd() : UWidget
  • OnEndArrow() : CCJFlatTabCtrl
  • OnEndLabelEdit() : CGfxOutBarCtrl
  • OnEndPrinting() : CWincvsView, CGraphView
  • OnEraseBkgnd() : CGfxSplitterWnd, CGfxOutBarCtrl, CCJTreeCtrl, CCJToolBar, CCJTabView, CCJTabCtrl, CCJReBar, CCJOutlookBar, CCJMetaFileButton, CCJMDIChildWnd, CCJMaskEdit, CCJListView, CCJListCtrl, CCJListBox, CCJHtmlView, CCJHexEdit, CCJFontCombo, CCJFlatHeaderCtrl, CCJFlatComboBox, CCJFlatButton, CCJExplorerBar, CCJControlBar, CCJColorPopup, CCJColorPicker, CCJCaption
  • OnError() : TBrowserFill, TBrowserFillDummy, TViewFill, TBrowserFill, TBrowserFillDummy, TViewFill, CFillTclEntries, CFillPyEntries, CFindSettings, MacroTraversal, ImportReport, TraversalReport
  • OnFetchCmd() : UWidget
  • OnFile() : TViewFill, CFillTclEntries, CFillPyEntries, CFindSettings, MacroTraversal, ImportReport, TraversalReport
  • OnFileChange() : CBrowseFileView
  • OnFileNew() : CWincvsApp
  • OnFilePrint() : CCJHtmlView
  • OnFiles() : KoAnnotateHandler, KoQueryUpdateHandler, KoUpdateHandler, KoCommitHandler, KoAddBinaryHandler, KoAddHandler, KoUnlockHandler, KoLockHandler, KoFileRemoveHandler, KoStatusHandler, KoGraphHandler, KoLogHandler, KoDiffHandler, KoWatchOffHandler, KoWatchOnHandler, KoEditorsHandler, KoWatchersHandler, KoReleaseHandler, KoUneditHandler, KoEditHandler, KoBranchTagHandler, KoDeleteTagHandler, KoCreateTagHandler, KoUpdateMoveToTrashHandler, KoMoveToTrashHandler, KiSelectionHandler
  • OnFilteringChanged() : CBrowseFileView
  • OnFilterMaskEntered() : CMainFrame
  • OnFolder() : KoAnnotateHandler, KoQueryUpdateHandler, KoUpdateHandler, KoCommitHandler, KoAddBinaryHandler, KoAddHandler, KoUnlockHandler, KoLockHandler, KoFileRemoveHandler, KoStatusHandler, KoGraphHandler, KoLogHandler, KoDiffHandler, KoWatchOffHandler, KoWatchOnHandler, KoEditorsHandler, KoWatchersHandler, KoReleaseHandler, KoUneditHandler, KoEditHandler, KoBranchTagHandler, KoDeleteTagHandler, KoCreateTagHandler, KoUpdateMoveToTrashHandler, KoMoveToTrashHandler, KiSelectionHandler
  • OnFullScreen() : CCJHtmlView
  • OnGetDlgCode() : CWincvsView, CCJHexEdit
  • OnGetEnv() : AuthenModel, AuthenNtserver, AuthenKserver, AuthenRhosts, AuthenPserver, AuthenSSH
  • OnGetFloat() : UWidget
  • OnGetLoc() : UWidget
  • OnGetSliderProperty() : UWidget
  • OnGetState() : UWidget
  • OnGetText() : UWidget
  • OnGfxLargeicon() : CGfxOutBarCtrl
  • OnGfxRemoveitem() : CGfxOutBarCtrl
  • OnGfxRenameitem() : CGfxOutBarCtrl
  • OnGfxSmallicon() : CGfxOutBarCtrl
  • OnGraphChangelogmessage() : CGraphView
  • OnGraphGraphoptions() : CGraphView
  • OnGraphSetdescription() : CGraphView
  • OnGraphSetstate() : CGraphView
  • OnHeightChange() : CCJReBar
  • OnHelpCvs() : CWincvsApp
  • OnHelpCvsclient() : CWincvsApp
  • OnHistorySelect() : CMainFrame
  • OnHomeArrow() : CCJFlatTabCtrl
  • OnHScroll() : CCJHexEdit
  • OnIdle() : TBrowserFill, TBrowserFillDummy, TViewFill, TBrowserFill, TBrowserFillDummy, TViewFill, CFillTclEntries, CFillPyEntries, ImportReport, TraversalReport
  • OnIgnoreChanged() : CWinCvsBrowser
  • OnInitDialog() : CAboutDlg, CTipDlg, CProgressDialog, CNoPython, CCustomizeMenus, CPseudoDlg, COptionalPropertySheet
  • OnInitialUpdate() : CWincvsView, CWinCvsBrowser, CGraphView, CCJListView, CBrowseFileView
  • OnInitMenu() : CMainFrame
  • OnInitMenuPopup() : CGraphView, CCJTabCtrl, CCJMDIFrameWnd, CCJFrameWnd, CCJFlatHeaderCtrl, CCJControlBar
  • OnInitTabWidget() : UWidget
  • OnInitWidget() : UWidget
  • OnInvalidate() : UWidget
  • OnInvertTracker() : CGfxSplitterWnd, CCJSizeDockBar, CCJControlBar
  • OnItemchangedAllcmds() : CCustomizeMenus
  • OnItemchangedMenulist() : CCustomizeMenus
  • OnItemexpanding() : CWinCvsBrowser, CMyShellTree
  • OnKeyDown() : CWincvsView, CCJMaskEdit, CCJHexEdit, CCJColorPopup, CPseudoToggle
  • OnKeydown() : CBrowseFileView
  • OnKillFocus() : CGfxGroupEdit, CCJHexEdit, CCJFlatComboBox, CCJColorPopup
  • OnLButtonDblClk() : CCJMetaFileButton, CCJHexEdit, CCJFlatButton, CBrowseFileView, CPseudoList
  • OnLButtonDown() : CGraphView, CGfxOutBarCtrl, CCJTreeCtrl, CCJOutlookBar, CCJMenuBar, CCJHexEdit, CCJFlatTabCtrl, CCJFlatComboBox, CCJFlatButton, CCJExplorerBar, CCJControlBar, CBrowseFileView
  • OnLButtonUp() : CCJSizeDockBar, CCJOutlookBar, CCJHexEdit, CCJFlatComboBox, CCJFlatButton, CCJExplorerBar, CCJControlBar, CCJColorPopup, CPseudoToggle
  • OnLeftArrow() : CCJFlatTabCtrl
  • OnListAddColumns() : UWidget
  • OnListAddSel() : UWidget
  • OnListDelRow() : UWidget
  • OnListGetInfo() : UWidget
  • OnListGetNext() : UWidget
  • OnListGetNextSel() : UWidget
  • OnListInsert() : UWidget
  • OnListNewRow() : UWidget
  • OnListResetAll() : UWidget
  • OnListResort() : UWidget
  • OnListRowGetData() : UWidget
  • OnListRowSetData() : UWidget
  • OnListSetColTitle() : UWidget
  • OnListSetColWidth() : UWidget
  • OnListSetFeedback() : UWidget
  • OnLogWindowIsPresent() : CWincvsApp
  • OnMacro() : CWinCvsBrowser, CBrowseFileView
  • OnMacroAdmin() : CWincvsDoc
  • OnMacroSel() : UCvsFiles
  • OnMainTimer() : UCvsApp
  • OnMeasureItem() : CCJTabCtrl, CCJMDIFrameWnd, CCJFrameWnd, CCJFlatHeaderCtrl, CCJControlBar
  • OnMenuBar() : CCJHtmlView
  • OnMenuChar() : CCJTabCtrl, CCJMDIFrameWnd, CCJFrameWnd, CCJFlatHeaderCtrl, CCJControlBar
  • OnMenuInput() : CCJMenuBar
  • OnMenuSelect() : CCJMenuBar
  • OnMouseMove() : CGfxOutBarCtrl, CCJSizeDockBar, CCJOutlookBar, CCJMenuBar, CCJHyperLink, CCJHexEdit, CCJFlatComboBox, CCJFlatButton, CCJControlBar, CCJColorPopup
  • OnMove() : CCustomizeMenus
  • OnMyFormatFont() : CWincvsView
  • OnNavigateComplete2() : CCJHtmlView
  • OnNcCalcSize() : CCJToolBar, CCJSizeDockBar, CCJReBar
  • OnNcCreate() : CCJToolBar, CCJReBar
  • OnNcDestroy() : CCJColorPopup
  • OnNcHitTest() : CCJToolBar, CCJSizeDockBar, CCJControlBar
  • OnNcLButtonDblClk() : CCJMiniDockFrameWnd
  • OnNcLButtonDown() : CCJSizeDockBar, CCJMiniDockFrameWnd
  • OnNcPaint() : CCJToolBar, CCJSizeDockBar, CCJReBar, CCJControlBar
  • OnNewDocument() : CWincvsDoc, CGraphDoc
  • OnNewWindow2() : CCJHtmlView
  • OnNextTip() : CTipDlg
  • OnNotify() : CCJListView, CCJListCtrl
  • OnOK() : CTipDlg, CProgressDialog, CCustomizeMenus, UPromptMessage
  • OnPageChanged() : UWidget
  • OnPagerCalcSize() : CCJPagerCtrl
  • OnPagerScroll() : CCJPagerCtrl
  • OnPaint() : CTipDlg, CSplashWnd, CColorStatic, CGfxSplitterWnd, CGfxOutBarCtrl, CCJTreeCtrl, CCJToolBarBase, CCJToolBar, CCJTabCtrl, CCJReBar, CCJOutlookBar, CCJMetaFileButton, CCJMaskEdit, CCJLogoPane, CCJListCtrl, CCJListBox, CCJHtmlView, CCJHexEdit, CCJFontCombo, CCJFlatTabCtrl, CCJFlatSplitterWnd, CCJFlatHeaderCtrl, CCJFlatComboBox, CCJFlatButton, CCJControlBar, CCJColorPopup, CCJColorPicker, CCJCaptionPopupWnd, CCJCaption, CBrowserBar, CPseudoDraw
  • OnPaletteChanged() : CCJColorPopup
  • OnPreparePrinting() : CWincvsView, CGraphView, CBrowseFileView
  • OnPreserveZeroBorderHelper() : CCJToolBar
  • OnPrint() : CGraphView, CBrowseFileView
  • OnProgressChange() : CCJHtmlView
  • OnPropertyChange() : CCJHtmlView
  • OnPushPinButton() : CCJCaption
  • OnPushPinCancel() : CCJCaption
  • OnQueryAnnotate() : CGraphView, CBrowseFileView
  • OnQueryNewPalette() : CCJColorPopup
  • OnQuit() : CCJHtmlView, UCvsFrame
  • OnRButtonDown() : CWincvsView, CWinCvsBrowser, CGfxOutBarCtrl, CCJToolBar, CCJTabCtrl, CCJFlatHeaderCtrl, CCJControlBar, CBrowseFileView
  • OnRclick() : CMyShellTree
  • OnRecalcParent() : CCJReBar
  • OnRedraw() : UWidget
  • OnRemove() : CCustomizeMenus
  • OnResetView() : CWinCvsBrowser, CBrowseFileView
  • OnRestoreEnv() : AuthenModel, AuthenRhosts, AuthenPserver, AuthenSSH
  • OnRightArrow() : CCJFlatTabCtrl
  • OnSavesettings() : CWincvsDoc
  • OnSelChange() : CCJColorPicker
  • OnSelchange() : CCJTabView
  • OnSelchanged() : CWinCvsBrowser, CMyShellTree
  • OnSelchanging() : CWinCvsBrowser
  • OnSelColumn() : UCvsFiles
  • OnSelEndCancel() : CCJColorPicker
  • OnSelendcancel() : CToolbarCombo
  • OnSelendok() : CToolbarCombo
  • OnSelEndOK() : CCJColorPicker
  • OnSetBitmapSize() : CCJToolBar
  • OnSetButtonSize() : CCJToolBar
  • OnSetCursor() : CWinCvsBrowser, CGfxOutBarCtrl, CCJSizeDockBar, CCJHyperLink, CCJFlatButton, CCJControlBar, CBrowseFileView
  • OnSetFloat() : UWidget
  • OnSetFocus() : CWincvsView, CCJHexEdit, CCJFlatComboBox
  • OnSetLoc() : UWidget
  • OnSetSizeHelper() : CCJToolBar
  • OnSetSlider() : UWidget
  • OnSetSliderProperty() : UWidget
  • OnSetState() : UWidget
  • OnSetText() : UWidget
  • OnSetTooltip() : UWidget, UToolbar
  • OnSetupEnv() : AuthenModel, AuthenRhosts, AuthenPserver, AuthenSSH
  • OnShowBand() : CCJReBar
  • OnShowWidget() : UWidget
  • OnShowWindow() : CCJBrowseEdit
  • OnSize() : CWincvsView, CGfxOutBarCtrl, CCJStatusBar, CCJMenuBar, CCJHtmlView, CCJFlatTabCtrl, CCJCaption
  • OnStatusBar() : CCJHtmlView
  • OnStatusTextChange() : CCJHtmlView
  • OnStopcvs() : CWincvsDoc
  • OnSysColorChange() : CGfxOutBarCtrl, CCJToolBar, CCJOutlookBar, CCJFlatComboBox, CCJFlatButton, CCJCaption, CCJCaptionButton
  • OnSysCommand() : CMainFrame
  • OnTabSelChange() : CCJTabCtrlBar
  • OnTbButton() : UToolbar
  • OnTbCheckBtn() : UToolbar
  • OnTbDropDown() : UToolbar
  • OnTbEnd() : UToolbar
  • OnTbInit() : UToolbar
  • OnTbSeparator() : UToolbar
  • OnTheaterMode() : CCJHtmlView
  • OnTimer() : CSplashWnd, CMainFrame, CCvsStatusBar, CGfxOutBarCtrl, CCJOutlookBar, CCJFlatComboBox, CCJFlatButton, CCJCaptionPopupWnd, CBrowseFileView
  • OnTitleChange() : CCJHtmlView
  • OnToolBar() : CCJHtmlView
  • OnToolBarBeginAdjust() : CCJToolBar
  • OnToolBarBeginDrag() : CCJToolBar
  • OnToolBarBtnDropDown() : CCJToolBar
  • OnToolBarChange() : CCJToolBar
  • OnToolBarCustomHelp() : CCJToolBar
  • OnToolBarEndAdjust() : CCJToolBar
  • OnToolBarEndDrag() : CCJToolBar
  • OnToolBarGetButtonInfo() : CCJToolBar
  • OnToolBarQueryDelete() : CCJToolBar
  • OnToolBarQueryInsert() : CCJToolBar
  • OnToolBarReset() : CCJToolBar
  • OnToolHitTest() : CCJToolBar, CCJReBar
  • OnTreeDelete() : UWidget
  • OnTreeExpand() : UWidget
  • OnTreeExpanding() : UCvsFolders
  • OnTreeGetInfo() : UWidget
  • OnTreeGetSel() : UWidget
  • OnTreeInsert() : UWidget
  • OnTreeResetAll() : UWidget
  • OnTreeSelect() : UWidget
  • OnTreeSelecting() : UCvsFolders
  • OnTreeSetData() : UWidget
  • OnTreeSetIcon() : UWidget
  • OnUp() : CCustomizeMenus
  • OnUpdateButtonClose() : CCJExplorerBar, CCJControlBar
  • OnUpdateButtonMinimize() : CCJControlBar
  • OnUpdateCmd() : CWinCvsBrowser, CExploreBar
  • OnUpdateCmdUI() : CCJToolBar, CCJReBar, CCJControlBar
  • OnUpdateCustomize() : CWinCvsBrowser, CBrowseFileView
  • OnUpdateCvsCmd() : CWincvsDoc
  • OnUpdateFilterMask() : CMainFrame
  • OnUpdateFocus() : UWidget
  • OnUpdateGeneric() : UCvsFolders
  • OnUpdateGfxLargeicon() : CGfxOutBarCtrl
  • OnUpdateGfxRemoveitem() : CGfxOutBarCtrl
  • OnUpdateGfxRenameitem() : CGfxOutBarCtrl
  • OnUpdateGfxSmallicon() : CGfxOutBarCtrl
  • OnUpdateGraphChangelogmessage() : CGraphView
  • OnUpdateGraphSetdescription() : CGraphView
  • OnUpdateGraphSetstate() : CGraphView
  • OnUpdateHistory() : CMainFrame
  • OnUpdateMacro() : CWinCvsBrowser, CBrowseFileView
  • OnUpdateMacroAdmin() : CWincvsDoc
  • OnUpdateMenuButton() : CCJMenuBar
  • OnUpdatePrefs() : CWincvsDoc
  • OnUpdateQueryAnnotate() : CGraphView, CBrowseFileView
  • OnUpdateSavesettings() : CWincvsDoc
  • OnUpdateStopcvs() : CWincvsDoc
  • OnUpdateUI() : UWidget, UToolbar, UMenu, UMacAppMenu
  • OnUpdateUsePyshell() : CWincvsDoc
  • OnUpdateUseTclshell() : CWincvsDoc
  • OnUpdateViewAdd() : CWinCvsBrowser, CBrowseFileView
  • OnUpdateViewAddB() : CBrowseFileView
  • OnUpdateViewAdded() : CMainFrame
  • OnUpdateViewChanged() : CMainFrame
  • OnUpdateViewCheckout() : CWinCvsBrowser, CExploreBar, CBrowseFileView
  • OnUpdateViewConflict() : CMainFrame
  • OnUpdateViewDelrev() : CGraphView
  • OnUpdateViewDiff() : CGraphView
  • OnUpdateViewEditseldef() : CBrowseFileView
  • OnUpdateViewExplore() : CWinCvsBrowser, CBrowseFileView
  • OnUpdateViewFullRowDetails() : CBrowseFileView
  • OnUpdateViewGraph() : CBrowseFileView
  • OnUpdateViewHideunknown() : CMainFrame
  • OnUpdateViewIgnore() : CMainFrame
  • OnUpdateViewImport() : CWinCvsBrowser, CExploreBar, CBrowseFileView
  • OnUpdateViewList() : CBrowseFileView
  • OnUpdateViewLockf() : CGraphView
  • OnUpdateViewMissing() : CMainFrame
  • OnUpdateViewModified() : CMainFrame
  • OnUpdateViewRecursive() : CMainFrame
  • OnUpdateViewRelease() : CBrowseFileView
  • OnUpdateViewReload() : CWinCvsBrowser, CGraphView, CBrowseFileView
  • OnUpdateViewRemoved() : CMainFrame
  • OnUpdateViewRetrieve() : CGraphView
  • OnUpdateViewRmv() : CBrowseFileView
  • OnUpdateViewSelnonsig() : CGraphView
  • OnUpdateViewSmallIcons() : CBrowseFileView
  • OnUpdateViewTag() : CGraphView
  • OnUpdateViewTrash() : CBrowseFileView
  • OnUpdateViewUnknown() : CMainFrame
  • OnUpdateViewUnlockf() : CGraphView
  • OnUpdateViewUpdate() : CWinCvsBrowser, CGraphView, CBrowseFileView
  • OnUpdateViewUpone() : CBrowseFileView
  • OnUsePyshell() : CWincvsDoc
  • OnUseTclshell() : CWincvsDoc
  • OnViewAdd() : CWinCvsBrowser, CBrowseFileView
  • OnViewAddb() : CBrowseFileView
  • OnViewAdded() : CMainFrame
  • OnViewBrowselocationRemoveunwanted() : CWincvsDoc
  • OnViewChanged() : CMainFrame
  • OnViewCheckout() : CWinCvsBrowser, CExploreBar, CBrowseFileView
  • OnViewCommit() : CWinCvsBrowser, CBrowseFileView
  • OnViewConflict() : CMainFrame
  • OnViewDelrev() : CGraphView
  • OnViewDiff() : CWinCvsBrowser, CGraphView, CBrowseFileView
  • OnViewEdit() : CWinCvsBrowser, CBrowseFileView
  • OnViewEditors() : CWinCvsBrowser, CBrowseFileView
  • OnViewEditsel() : CBrowseFileView
  • OnViewEditseldef() : CBrowseFileView
  • OnViewExplore() : CWinCvsBrowser, CBrowseFileView
  • OnViewFullRowDetails() : CBrowseFileView
  • OnViewGraph() : CBrowseFileView
  • OnViewHideunknown() : CMainFrame
  • OnViewIgnore() : CMainFrame
  • OnViewImport() : CWinCvsBrowser, CExploreBar, CBrowseFileView
  • OnViewInit() : CWincvsDoc
  • OnViewList() : CBrowseFileView
  • OnViewLock() : CWinCvsBrowser, CBrowseFileView
  • OnViewLockf() : CGraphView
  • OnViewLog() : CWinCvsBrowser, CBrowseFileView
  • OnViewMissing() : CMainFrame
  • OnViewModified() : CMainFrame
  • OnViewPathChanged() : CWincvsDoc
  • OnViewQueryUpdate() : CWinCvsBrowser, CBrowseFileView
  • OnViewRecursive() : CMainFrame
  • OnViewRelease() : CWinCvsBrowser, CBrowseFileView
  • OnViewReload() : CWinCvsBrowser, CGraphView, CBrowseFileView
  • OnViewRemoved() : CMainFrame
  • OnViewRetrieve() : CGraphView
  • OnViewRmv() : CBrowseFileView
  • OnViewSelnonsig() : CGraphView
  • OnViewSmallIcons() : CBrowseFileView
  • OnViewStatus() : CWinCvsBrowser, CBrowseFileView
  • OnViewTag() : CGraphView
  • OnViewTagBranch() : CWinCvsBrowser, CBrowseFileView
  • OnViewTagDelete() : CWinCvsBrowser, CBrowseFileView
  • OnViewTagNew() : CWinCvsBrowser, CBrowseFileView
  • OnViewTrash() : CBrowseFileView
  • OnViewUnedit() : CWinCvsBrowser, CBrowseFileView
  • OnViewUnknown() : CMainFrame
  • OnViewUnlock() : CWinCvsBrowser, CBrowseFileView
  • OnViewUnlockf() : CGraphView
  • OnViewUpdate() : CWinCvsBrowser, CGraphView, CBrowseFileView
  • OnViewUpone() : CBrowseFileView
  • OnViewWatchers() : CWinCvsBrowser, CBrowseFileView
  • OnViewWatchOff() : CWinCvsBrowser, CBrowseFileView
  • OnViewWatchOn() : CWinCvsBrowser, CBrowseFileView
  • OnVisible() : CCJHtmlView
  • OnVScroll() : CCJHexEdit
  • OnWindowPosChanged() : CExploreBar, CCJToolBar, CCJTabView, CCJTabCtrlBar, CCJFlatHeaderCtrl, CCJExplorerBar, CCJControlBar, CBrowserBar
  • OnWindowPosChanging() : CCJToolBarBase, CCJToolBar
  • opaque : z_stream_s
  • open : _CvsProcess
  • Open() : CCJMemFile
  • openProject() : CvsProject
  • OpenProject() : CvsCoworker
  • operator &() : URect
  • operator &=() : URect
  • operator *() : CLogNodeBranch, CLogNodeTag, CLogNodeRev, CLogNodeHeader
  • operator char *() : UStr, UPStr, CBuffer, PCStr, PCPStr
  • operator CHARFORMAT &() : CCharFormat
  • operator const bool &() : CPersistentBool
  • operator const char *() : CvsString, UStr, UPStr, CLogStr, CvsPrefs, PCStr, PCPStr
  • operator const int &() : CPersistentInt
  • operator const T &() : CPersistentT< T >
  • operator const T *() : CStaticAllocT< T >
  • operator const unsigned char *() : UPStr, CvsPrefs, PCPStr
  • operator const URECT *() : URect
  • operator EntnodeData *() : PyCvsEntry, ENTNODE
  • operator HBITMAP() : aref
  • operator PyThreadState *() : CPython_Interp
  • operator T *() : PyAutoObject< T >, CStaticAllocT< T >
  • operator Tcl_Interp *() : CTcl_Interp
  • operator UMENU() : PyMenuMgr
  • operator unsigned char *() : UPStr, PCPStr
  • operator URECT *() : URect
  • operator!=() : UStr, URect, UPoint, USize
  • operator+() : CvsString, URect, UPoint, USize
  • operator+=() : CvsString, CCJMemFile, URect, UPoint, USize, CRevNumber
  • operator-() : URect, UPoint, USize
  • operator-=() : URect, UPoint, USize
  • operator->() : PyAutoObject< T >, CPersistentInt, CPersistentBool, CPersistentT< T >
  • operator<() : UStr, CRcsFile, CRevFile, CRevNumber, CLogStr, CMacroEntry
  • operator<<() : UStr, UPStr, CLogStr, CColorConsole
  • operator=() : CWinPlacement, CvsString, CCJStatusBarPane, CContentItems, CCJMemFile, UTimer, awidget, aref, UStr, UPStr, CMsg, URect, CPseudoItem, CRcsFile, CRevFile, CRevNumber, CLogStr, CTCLBrowserEnt, PyAutoObject< T >, CPersistentInt, CPersistentBool, CPersistentT< T >, MultiFilesEntry, FileEntry, CMacroEntry, MacBinMaps, CMacBinItem, CMacBinTable, CvsPrefs, ENTNODE, PCStr, PCPStr, NotificationManager::Node
  • operator==() : CvsString, UStr, URect, UPoint, USize, CRcsFile, CRevFile, CRevNumber, CPersistentInt, CPersistentBool, CPersistentT< T >, CMacroEntry
  • operator>() : UStr
  • operator[]() : CvsString, CCJMemFile, CRevNumber, EntnodeFolder, EntnodeFile, EntnodeData
  • operator|() : URect
  • operator|=() : URect
  • opt_len : internal_state
  • option : EntnodeFile
  • options : tag_info, vers_ts, entnode, commit_info
  • other : rcsversnode, deltatext, rcsnode
  • other_delta : rcsversnode
  • out : UCvsConsole
  • outbuf : gz_stream
  • OutColor() : CWincvsView, UCvsConsole
  • OutConsole() : CWincvsView, UCvsConsole
  • outdated : rcsversnode
  • outEnabled : UPseudoCmdStatusWrapper
  • outMark : UPseudoCmdStatusWrapper
  • outName : UPseudoCmdStatusWrapper
  • outproc : context
  • outUsesMark : UPseudoCmdStatusWrapper
  • overCnt : CTCP2Parse
  • OverkillAssert() : CCJTabCtrlBar
  • overLast : CTCP2Parse

- p -
  • p_str() : UPStr
  • pad : inflate_huft_s
  • Pad : _MIDL_PROC_FORMAT_STRING, _MIDL_TYPE_FORMAT_STRING
  • PaintItems() : CGfxOutBarCtrl
  • param() : ansiAttrCvt::AnsiSeq
  • paramc() : ansiAttrCvt::AnsiSeq
  • parent : UTREE_INFO, UTREE_INSERT
  • parse_cvsroot() : Authen
  • ParseIt() : CTCP2Parse
  • path : gz_stream, rcsnode, CMacroEntry
  • pattern : ReportConflict
  • pBaseMap : UMSGMAP
  • pBlackPen : CGfxOutBarCtrl
  • pChild : CGfxOutBarCtrl::CBarFolder
  • PCPStr() : PCPStr
  • PCStr() : PCStr
  • pending : internal_state
  • pending_buf : internal_state
  • pending_out : internal_state
  • pfn : UMSGMAP_ENTRY, UMessageMapFunctions
  • pfni_i : UMessageMapFunctions
  • pfni_ii : UMessageMapFunctions
  • pfni_iVP : UMessageMapFunctions
  • pfni_V : UMessageMapFunctions
  • pfni_VP : UMessageMapFunctions
  • pfnV_i : UMessageMapFunctions
  • pfnV_ii : UMessageMapFunctions
  • pfnV_iii : UMessageMapFunctions
  • pfnV_iiVP : UMessageMapFunctions
  • pfnV_iVP : UMessageMapFunctions
  • pfnV_V : UMessageMapFunctions
  • pfnV_VP : UMessageMapFunctions
  • pid : _SUBIO, PIPE, pid_list, unreaped, _CvsProcess
  • placement : CWinPlacement
  • plainBin : MACBINMAP
  • pLargeImageList : CGfxOutBarCtrl, CGfxOutBarCtrl::CBarFolder
  • PMacBinMaps() : PMacBinMaps
  • PointInRect() : CCJFlatComboBox
  • pool : poolRec
  • pools : garbyRec
  • pos : USLIDER, rcsbuffer, MultiFiles, ansiAttrCvt
  • PositionControls() : CCJStatusBar
  • PositionWindow() : CCJHyperLink
  • PostNcDestroy() : CSplashWnd, CProgressDialog, CGfxGroupEdit
  • PreCreateWindow() : CWincvsView, CWinCvsBrowser, CMainFrame, CCJTreeCtrl, CCJToolBar, CCJMDIFrameWnd, CCJHexEdit, CCJFrameWnd, CCJFlatTabCtrl, CBrowseFileView
  • prefix_end : file_data
  • prefix_lines : file_data
  • PrepareNew() : CGraphDoc
  • PressButton() : CCJToolBar
  • PRESSED : CCJFlatComboBox
  • PreSubclassWindow() : CCJHyperLink, CCJFontCombo, CCJFlatHeaderCtrl, CCJColorPicker, CCJBrowseEdit
  • PreTranslateAppMessage() : CSplashWnd
  • PreTranslateMessage() : CWincvsApp, CTbEdit, CLogFrame, CHistComboBoxEx, CGfxGroupEdit, CCJTabCtrlBar, CCJHyperLink, CCJFrameWnd, CCJFlatTabCtrl, CCJFlatComboBox, CCJControlBar, CCJColorPopup
  • prev : internal_state, _SUBIO, PIPE, node
  • prev_length : internal_state
  • prev_match : internal_state
  • Print() : PyColorConsole
  • print() : CRcsFile, CRevFile, CvsArgs
  • PrintOut() : ReportWarning, ReportConflict
  • ProcessMask() : CCJTimeEdit, CCJDateEdit, CCJMaskEdit
  • ProcessSelectionCommand() : CBrowseFileView
  • Proportional : CTCP2Parse
  • ProxyHost() : CvsPrefs
  • ProxyPort() : CvsPrefs
  • PruneOption() : CvsPrefs
  • PserverPort() : CvsPrefs
  • pSmallImageList : CGfxOutBarCtrl, CGfxOutBarCtrl::CBarFolder
  • pstderr : _CvsProcess
  • pstdin : _CvsProcess
  • pstdout : _CvsProcess
  • PtInRect() : URect
  • ptr : rcsbuffer
  • ptrend : rcsbuffer
  • push_back() : CTmpFiles
  • PushBackgroundColor() : CTCP2Parse
  • PushBlink() : CTCP2Parse
  • PushBold() : CTCP2Parse
  • PushEncoding() : CTCP2Parse
  • PushFontSize() : CTCP2Parse
  • PushForegroundColor() : CTCP2Parse
  • PushItalic() : CTCP2Parse
  • PushOut() : CTCP2Parse
  • PushOverstrike() : CTCP2Parse
  • PushReverse() : CTCP2Parse
  • PushSpacing() : CTCP2Parse
  • PushStart() : CTCP2Parse
  • PushTextSegment() : CTCP2Parse
  • PushUnderline() : CTCP2Parse
  • PushURL() : CTCP2Parse
  • PutProperty() : CCJHtmlView
  • pw_age : passwd
  • pw_comment : passwd
  • pw_dir : passwd
  • pw_gecos : passwd
  • pw_gid : passwd
  • pw_name : passwd
  • pw_passwd : passwd
  • pw_shell : passwd
  • pw_uid : passwd
  • pWnd : tagCTV_ITEM, tagTCB_ITEM
  • PyAutoObject() : PyAutoObject< T >
  • PyCmdUI() : PyCmdUI
  • PyColorConsole() : PyColorConsole
  • PyContainer() : PyContainer
  • PyCvsEntry() : PyCvsEntry
  • PyMenuMgr() : PyMenuMgr
  • PyPersistent() : PyPersistent
  • PyRegistry() : PyRegistry

- q -
  • QsortMethod : CSortList< T >
  • QueryAcceptData() : CWincvsView
  • QueryStatusWB() : CCJHtmlView
  • quiet : admin_data
  • QuietOption() : CvsPrefs

- r -
  • r : UColor, UCOLOR
  • R : CTCP2Parse::RGBColor
  • r_efblk_fields : fatdef
  • r_efblk_overlay : fatdef
  • r_hiblk_fields : fatdef
  • r_hiblk_overlay : fatdef
  • r_rattrib_bits : fatdef
  • r_rattrib_overlay : fatdef
  • r_rtype_bits : fatdef
  • r_rtype_overlay : fatdef
  • RAISED : CCJFlatComboBox
  • ranges : diff3_block, diff_block
  • rcDownArrow : CGfxOutBarCtrl
  • rcs : log_data_and_rcs, file_info
  • RcsFile() : CRcsFile
  • rcsFile : CRcsFile
  • rcsOption : WrapperEntry
  • rcUpArrow : CGfxOutBarCtrl
  • re_nsub : re_pattern_buffer
  • read : inflate_blocks_state
  • read_chan : _SUBIO
  • read_fp : _SUBIO
  • read_func : _WireHandler
  • read_iosb : _SUBIO
  • ReadFields() : TPseudoDoubleNumberText, TPseudoIconCheckBox, TPseudoRotateIconButton, TPseudoIconButton, TPseudoIconPopup, TBuggyPopup
  • ReadIconsID() : UPseudoRotButton
  • readlock : recursion_frame
  • ReadOleDateTime() : CCJDateEdit
  • ReadString() : CCJMemFile
  • realindexes : file_data
  • RecalcAllExcept() : CCJSizeDockBar, CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • RecalcLayout() : CGfxSplitterWnd, CCJMDIFrameWnd, CCJMDIChildWnd, CCJFrameWnd
  • RecalcSize() : CCJPagerCtrl
  • RecomputeMenuLayout() : CCJMenuBar
  • RecomputeToolbarSize() : CCJMenuBar
  • rect : tagAFX_OLDTOOLINFO
  • Rectangle() : UDC
  • rectOldPos : CJX_CONTROLPOS
  • recycle() : CvsString
  • Red : CTCP2Parse
  • ref : aref, EntnodeData, EntnodePath
  • Ref() : aref, PyAutoObject< T >, EntnodeData, EntnodePath
  • refcount : rcsnode
  • Refresh() : CCJHtmlView
  • Refresh2() : CCJHtmlView
  • Register() : CPersistent
  • RegisterAllObjects() : PyRegistry
  • RegisterValue() : PyContainer
  • regs_allocated : re_pattern_buffer
  • Remove() : CSubclassWndMap, TMString< T >
  • remove_temp : addremove_args
  • RemoveAll() : CSubclassWndMap, TPseudoTextListView
  • RemoveAllTabs() : CCJTabCtrlBar
  • RemoveCell() : CMacBinItem
  • removed : EntnodeData
  • RemoveEntry() : MacBinMaps
  • RemoveFiles() : CvsCoworker
  • removeFiles() : CvsProject
  • RemoveFolder() : CGfxOutBarCtrl
  • RemoveItem() : CGfxOutBarCtrl
  • RemoveListItem() : CCJTabCtrlBar
  • RemoveMenu() : CCJMenu
  • RemovePane() : CCJStatusBar
  • RemoveTimer() : UWidget
  • RemoveView() : CCJTabView, CCJTabCtrlBar
  • RenameFile() : CvsCoworker
  • renameFile() : CvsProject
  • replace() : UStr, UPStr, CLogStr
  • ReplaceView() : CCJFlatSplitterWnd
  • ReportConflict() : ReportConflict
  • ReportError() : CCJHyperLink
  • ReportWarning() : ReportWarning
  • repos : hrec
  • RepositionCaret() : CCJHexEdit
  • repository : lock, file_info
  • requireSize() : CvsString
  • reserved : z_stream_s, LOCK
  • Reset() : CSortList< T >, MacBinMaps
  • reset() : CRevNumber, MultiFiles, CvsArgs
  • ResetBrowser() : CWinCvsBrowser, UCvsFolders
  • ResetIdleTime() : CWincvsApp
  • ResetText() : CToolbarCombo
  • ResetTimeStamp() : CPersistent
  • ResetToolTips() : CCJTabCtrlBar
  • ResetView() : CWinCvsBrowser, CBrowseFileView, UCvsFolders, UCvsFiles
  • resize() : CvsString
  • ResizeWindow() : CCJFlatHeaderCtrl
  • Resort() : CBrowseFileView, UCvsFiles
  • rest : sortrec
  • RestoreState() : CCJToolBar
  • result : UTREE_INSERT
  • Result() : CSortList< T >
  • retlen : list3
  • RetrievePath() : CWinCvsBrowser, UCvsFolders
  • return_status : _SUBIO
  • rev : CLogNodeRev, tag_info, hrec, commit_info
  • rev_new : logfile_info
  • rev_old : logfile_info
  • revcmp() : KoRevisionColumn
  • revCnt : CTCP2Parse
  • reverse : ansiAttrCvt
  • revLast : CTCP2Parse
  • revlist : log_data_and_rcs, log_data
  • RevNum() : CRevFile
  • revNum : CRevFile
  • RevTime() : CRevFile
  • revTime : CRevFile
  • rewind() : MultiFiles
  • RGB : CTCP2Parse::RGBColor
  • rgbqFrom : CJX_COLORMAP
  • RhostPort() : CvsPrefs
  • right : URECT
  • rm_eo : regmatch_t
  • rm_so : regmatch_t
  • Root() : CLogNode
  • root : CLogNode, context
  • RoundRect() : UDC
  • row : ULIST_INFO, ULIST_INSERT
  • rs_essential : response
  • rs_not_supported : response
  • rs_optional : response
  • rs_supported : response
  • RsaIdentityFile() : AuthenSSH
  • RshName() : CvsPrefs
  • rtUObject() : UObject
  • Run() : KoWatcher

- s -
  • s1 : _IID
  • s2 : _IID
  • s_dir : VMS_DIR
  • sAllURuntimeClass : URuntimeClass
  • sample1 : ReportConflict
  • sample2 : ReportConflict
  • samples : ReportWarning
  • Save() : CCJMemFile
  • save() : CvsPrefs
  • SaveAll() : CPersistent
  • SaveAllModified() : CWincvsApp
  • SaveAllSettings() : CPersistent
  • SaveBarState() : CCJMDIFrameWnd, CCJFrameWnd, CCJControlBar
  • SaveColumns() : CBrowseFileView
  • SaveColumnWidths() : CCJListView, CCJListCtrl
  • SaveDefaults() : MacBinMaps
  • SaveState() : CCJToolBar
  • SaveWindowPos() : CCJWindowPlacement
  • SayWelcome() : UCvsApp
  • sbuf : CWincvsView
  • sbuffer : EntnodeData
  • ScrollIntoView() : CCJHexEdit
  • Search() : WININFO, UCvsFiles
  • searchAllPath() : CFindSettings
  • searchPath() : CFindSettings
  • SearchWidID() : LPseudoWinAttachment
  • segment : CTCP2Parse
  • sel : CWinLogData
  • SelDelete() : CCJHexEdit
  • Selected() : CWinLogData
  • SelectItems() : CCJTreeCtrl
  • SelectObject() : UDC
  • self : _SUBIO, PIPE
  • selfB : CWinLogData
  • SelfBounds() : CWinLogData
  • SelInsert() : CCJHexEdit
  • SelRevisions() : CRcsFile
  • selRevisions : CRcsFile
  • SendChar() : CCJMaskEdit
  • SendMessageC() : CCJToolBar
  • seq() : ansiAttrCvt::AnsiSeq
  • Serialize() : CWincvsDoc, CGraphDoc
  • ServerName() : CvsPrefs
  • set() : UStr, UPStr, CLogStr
  • set_nonstrict : admin_data
  • set_strict : admin_data
  • SetActiveView() : CCJTabView, CCJTabCtrlBar
  • SetActualSize() : CCJSizeDockBar
  • SetAddControl() : CvsPrefs
  • SetAddressBar() : CCJHtmlView
  • SetAlternateColors() : CCJFlatButton
  • SetAlwaysUseCvsroot() : CvsPrefs
  • SetAnchorHighlight() : CCJToolBarCtrl
  • SetAnimationTickCount() : CGfxOutBarCtrl
  • SetAnimSelHighlight() : CGfxOutBarCtrl
  • SetAnsiString() : CCJMenuData
  • SetAutoSize() : CCJHyperLink
  • SetBandInfo() : CCJReBarCtrl
  • SetBarInfo() : CCJReBarCtrl
  • SetBitmap() : CCJToolBar
  • SetBitmapBackground() : CCJMenu
  • SetBitmapSize() : CCJToolBar
  • SetBkColor() : CCJReBarCtrl, CCJPagerCtrl, CCJColorPicker
  • SetBorder() : CCJPagerCtrl
  • SetBorders() : CCJToolBarBase
  • SetBPR() : CCJHexEdit
  • SetBrowser() : CvsPrefs
  • SetButton() : CCJToolBar
  • SetButtonFont() : CCJFlatButton
  • SetButtonInfo() : CCJToolBarCtrl, CCJToolBar
  • SetButtons() : CCJToolBar
  • SetButtonSize() : CCJToolBar, CCJPagerCtrl
  • SetButtonStructSize() : CCJToolBar
  • SetButtonStyle() : CCJToolBar, CCJCaptionButton
  • SetButtonText() : CCJToolBar
  • SetButtonWidth() : CCJToolBarCtrl
  • SetCaptionColors() : CCJCaption
  • SetCheck() : CCJToolCmdUI, PyCmdUI
  • SetCheckoutRO() : CvsPrefs
  • SetChild() : CCJPagerCtrl, CCJControlBar
  • SetChildWindow() : CCJCaption
  • SetCmdID() : CCJToolBar
  • SetColor() : CColorStatic, CCJMonthCalCtrl, CCJColorPicker
  • SetColors() : CCJHyperLink
  • SetColorScheme() : CCJReBarCtrl
  • SetColumnWidth() : CCJListView, CCJListCtrl
  • SetConflict() : ReportConflict
  • SetContinue() : UCmdUI
  • SetCurrentMap() : CMacBinTable
  • SetCurSel() : CCJFlatTabCtrl, CCJMonthCalCtrl
  • SetCustomText() : CCJColorPicker
  • SetCvsConsole() : CvsPrefs
  • SetCvsExitOnError() : CTcl_Interp
  • SetCvsLastErrorCode() : CTcl_Interp
  • SetCvsRunning() : UCvsApp, CvsPrefs
  • SetCvsStopping() : UCvsApp
  • SetCvsVersion() : CvsPrefs
  • SetData() : CWinPlacement, CMMenuString, CCJHexEdit, CPersistentT< T >, CPersistent, TMString< T >, TMPersistent< T >, PMacBinMaps, PCStr, PCPStr
  • SetDateTime() : CCJDateEdit
  • SetDayState() : CCJMonthCalCtrl
  • SetDefaultCursor() : CCJHyperLink
  • SetDefaultRoot() : UCvsFolders
  • SetDefaults() : CTCP2Parse
  • SetDefaultText() : CCJColorPicker
  • SetDesc() : EntnodeData
  • setdir() : MultiFilesEntry
  • SetDirtySupport() : CvsPrefs
  • SetDisabledImageList() : CCJToolBarCtrl
  • SetDisableOldStyle() : CCJMenu
  • SetDlgDefExt() : CCJBrowseEdit
  • SetDlgFileName() : CCJBrowseEdit
  • SetDlgFilter() : CCJBrowseEdit
  • SetDlgOpenFile() : CCJBrowseEdit
  • SetDlgOwner() : CCJBrowseEdit
  • SetDlgStyle() : CCJBrowseEdit
  • SetDlgTitle() : CCJBrowseEdit
  • SetDrawTextFlags() : CCJToolBarCtrl
  • SetEditMask() : CCJMaskEdit
  • SetEditSel() : CCJComboBoxEx
  • SetExtDiff() : CvsPrefs
  • SetExtendedStyle() : CCJToolBarCtrl, CCJToolBar, CCJListView, CCJListCtrl, CCJComboBoxEx
  • SetFirstDayOfWeek() : CCJMonthCalCtrl
  • SetFolderImageList() : CGfxOutBarCtrl
  • SetFolderText() : CGfxOutBarCtrl
  • SetFontBold() : CCJFlatHeaderCtrl
  • SetFormat() : CCJDateTimeCtrl
  • SetFullRowSel() : CBrowseFileView
  • SetFullScreen() : CCJHtmlView
  • SetGroup() : CPseudoToggle
  • SetHasLoogedIn() : CvsPrefs
  • SetHeight() : CCJToolBar, CCJHtmlView
  • SetHelper() : CvsPrefs
  • SetHideCommandDlgAnnotate() : CvsPrefs
  • SetHideCommandDlgDiff() : CvsPrefs
  • SetHideCommandDlgGraph() : CvsPrefs
  • SetHideCommandDlgLog() : CvsPrefs
  • SetHideCommandDlgUpdate() : CvsPrefs
  • SetHideCommandDlgUseShift() : CvsPrefs
  • SetHilightColors() : CCJFontCombo
  • SetHome() : CvsPrefs
  • SetHotImageList() : CCJToolBarCtrl
  • SetHotItem() : CCJToolBarCtrl, CCJToolBar
  • SetHours() : CCJTimeEdit
  • SetIcon() : CHistComboBoxEx, CCJFlatButton
  • SetIconSize() : CCJMenu
  • SetICTextOption() : CvsPrefs
  • SetIgnored() : EntnodeData
  • SetImageList() : CGfxOutBarCtrl, CCJToolBarCtrl, CCJToolBar, CCJReBarCtrl, CCJComboBoxEx
  • SetImageLists() : CCJOutlookBar
  • SetIndent() : CCJToolBarCtrl, CCJToolBar
  • SetInsertMark() : CCJToolBarCtrl
  • SetInsertMarkColor() : CCJToolBarCtrl
  • SetIsoConvert() : CvsPrefs
  • SetItem() : CCJComboBoxEx
  • SetItemBold() : CCJTreeCtrl
  • SetItemColor() : CCJTreeCtrl
  • SetItemData() : CGfxOutBarCtrl
  • SetItemFont() : CCJTreeCtrl
  • SetItemImage() : CGfxOutBarCtrl
  • SetItems() : CCJOutlookBar
  • SetItemText() : CGfxOutBarCtrl
  • setkind() : Authen
  • SetKserverPort() : CvsPrefs
  • SetLastWorkingDir() : CvsPrefs
  • SetLeft() : CCJHtmlView
  • SetLinkCursor() : CCJHyperLink
  • SetLocked() : EntnodeData
  • SetLogoFont() : CCJLogoPane
  • SetLogoText() : CCJLogoPane
  • SetLogoutTimeOut() : CvsPrefs
  • SetMacBinEncoding() : CvsPrefs
  • SetMask() : KoFilterModel
  • SetMaxSelCount() : CCJMonthCalCtrl
  • SetMaxTextRows() : CCJToolBarCtrl
  • SetMenuBar() : CCJHtmlView
  • SetMenuID() : CCJTabCtrl, CCJFlatHeaderCtrl, CCJControlBar
  • SetMetaFiles() : CCJMetaFileButton
  • SetMinimumColSize() : CCJListView, CCJListCtrl
  • SetMins() : CCJTimeEdit
  • SetMissing() : EntnodeData
  • SetMonthCalColor() : CCJDateTimeCtrl
  • SetMonthCalFont() : CCJDateTimeCtrl
  • SetMonthDelta() : CCJMonthCalCtrl
  • SetNewStyle() : CWinCvsBrowser
  • SetNode() : CGraphDoc
  • SetNormalColors() : CCJFontCombo
  • SetNormalSize() : CCJControlBar
  • SetOffline() : CCJHtmlView
  • SetOptions() : CCJHexEdit
  • SetOwner() : CCJToolBar, CCJReBarCtrl, CCJOutlookBar
  • SetPadding() : CCJToolBar
  • SetPageValue() : LPseudoWinAttachment
  • SetPalette() : CCJReBarCtrl
  • SetPaneWidth() : CCJStatusBar
  • SetPos() : CCJPagerCtrl
  • SetProgress() : CProgress
  • SetProxyHost() : CvsPrefs
  • SetProxyPort() : CvsPrefs
  • SetPruneOption() : CvsPrefs
  • SetPserverPort() : CvsPrefs
  • SetPseudoWidget() : TPseudoWinAdorner, TPseudoWinBehavior
  • SetQuietOption() : CvsPrefs
  • SetRadio() : CPseudoToggle
  • SetRange() : CCJMonthCalCtrl, CCJDateTimeCtrl
  • SetRect() : URect
  • SetRectEmpty() : URect
  • SetRecursive() : CBrowseFileView
  • SetRedraw() : CWndRedrawMngr
  • SetRegisterAsBrowser() : CCJHtmlView
  • SetRegisterAsDropTarget() : CCJHtmlView
  • SetRemoved() : EntnodeData
  • SetResourceIDs() : CCJMDIChildWnd
  • SetRhostPort() : CvsPrefs
  • SetRowColors() : CCJListView, CCJListCtrl
  • SetRows() : CCJToolBar
  • SetRshName() : CvsPrefs
  • SetScrollArea() : CCJPagerCtrl
  • SetSearchType() : CCJBrowseEdit
  • SetSel() : CCJHexEdit
  • SetSelected() : CWinLogData
  • SetSelection() : TPseudoTextListView
  • SetSelectionMode() : CCJColorPicker
  • SetSelFolder() : CGfxOutBarCtrl
  • SetSelRange() : CCJMonthCalCtrl
  • SetServerName() : CvsPrefs
  • SetSilent() : CCJHtmlView
  • SetSizes() : CCJToolBar
  • SetSmallIconView() : CGfxOutBarCtrl
  • SetSortImage() : CSortHeaderCtrl, CCJFlatHeaderCtrl
  • SetState() : CCJToolBar, CPseudoToggle
  • SetStatusBar() : CCJHtmlView
  • SetStyle() : CCJToolBarCtrl
  • SetTabImageList() : CCJTabView, CCJTabCtrlBar
  • SetTabMenuID() : CCJTabCtrlBar
  • SetTclFileRunning() : CvsPrefs
  • SetText() : CToolbarCombo, CCJToolCmdUI, UCmdUI, PyCmdUI
  • SetTextColor() : CCJReBarCtrl, CCJColorPicker
  • SetTextStyle() : CCJCaption
  • SetTheaterMode() : CCJHtmlView
  • SetTime() : CCJDateTimeCtrl
  • setting_default : addremove_args
  • SetTipText() : CCJFlatTabCtrl
  • SetToday() : CCJMonthCalCtrl
  • SetToolBar() : CCJHtmlView
  • SetToolbarStyle() : CCJToolBar
  • SetTooltip() : UCmdUI
  • SetToolTips() : CCJToolBar, CCJReBarCtrl
  • SetTop() : CCJHtmlView
  • SetTrackingState() : CCJMenuBar
  • SetTrackSelection() : CCJColorPicker
  • SetTypeCreatorConflict() : ReportConflict
  • SetUnderline() : CCJHyperLink
  • SetUnixLF() : CvsPrefs
  • SetUnknown() : EntnodeData
  • SetUnmodified() : EntnodeData
  • SetURL() : CCJHyperLink
  • SetUseProxy() : CvsPrefs
  • SetUserData() : CLogNode
  • SetUseShell() : CvsPrefs
  • SetUseViewerAlways() : CvsPrefs
  • SetValue() : TPseudoDoubleNumberText, PyPersistent
  • SetViewer() : CvsPrefs
  • SetViewToolTip() : CCJTabCtrlBar
  • SetViewType() : CBrowseFileView
  • SetVisible() : CCJHtmlView
  • SetVisited() : CCJHyperLink, EntnodeData
  • SetWhichCvs() : CvsPrefs
  • SetWideString() : CCJMenuData
  • SetWidID() : UPseudoPageHider, UPseudoPlaceHolder
  • SetWindowSize() : CCJColorPopup, CCJColorPicker
  • SetWordWrapLogMsg() : CvsPrefs
  • SetZ9Option() : CvsPrefs
  • SetZLevel() : CvsPrefs
  • sFocusCmdID : UWidget
  • sFocusWidID : UWidget
  • shareData : ENTNODE
  • showAdvancedOptionsForCommand() : CvsProject
  • ShowAdvancedOptionsForCommand() : CvsCoworker
  • ShowBand() : CCJReBarCtrl
  • ShowColumn() : CCJFlatSplitterWnd
  • showFileHistory() : CvsProject
  • ShowFileHistory() : CvsCoworker
  • showFileProperties() : CvsProject
  • ShowFileProperties() : CvsCoworker
  • ShowFrameControls() : CCJControlBar
  • ShowRow() : CCJFlatSplitterWnd
  • ShowSplashScreen() : CSplashWnd
  • ShowTipAtStartup() : CWincvsApp
  • ShowTipOfTheDay() : CWincvsApp
  • showUserInterface() : CvsProject
  • ShowUserInterface() : CvsCoworker
  • sig : MACBINMAP
  • SignalStartWatch() : KoWatcher
  • SignalTerminate() : KoWatcher
  • SingleClick() : CPseudoItem
  • singledatelist : log_data
  • size() : CRevNumber, CBuffer, CStaticAllocT< T >
  • Size() : URect
  • SizeMinReq() : CCJMonthCalCtrl
  • SizeOf() : CWinPlacement, CMMenuString, CPersistentT< T >, CPersistent, TMString< T >, TMPersistent< T >, PMacBinMaps, PCStr, PCPStr
  • sizeofcell : DYN_LIST
  • SizeTabView() : CCJTabCtrlBar
  • SizeToolBar() : CCJToolBar
  • SizeToRect() : CCJReBarCtrl
  • skiptoken() : Authen
  • sMAMenuWidID : UMacAppMenu
  • snumbuf : CWincvsView
  • Sort() : CCJSortClass
  • sort() : CRcsFile
  • SortList() : CCJListView, CCJListCtrl
  • spec : FileEntry
  • SpendTime() : LMainPseudoAttachment
  • Split() : CKeyString
  • sPPMenuWidID : UPPMenu
  • srcfile : vers_ts
  • ss : yystack
  • sslim : yystack
  • ssp : yystack
  • st_atime : wnt_stat
  • st_ctime : wnt_stat
  • st_dev : wnt_stat
  • st_gid : wnt_stat
  • st_ino : wnt_stat
  • st_mode : wnt_stat
  • st_mtime : wnt_stat
  • st_nlink : wnt_stat
  • st_rdev : wnt_stat
  • st_size : wnt_stat
  • st_uid : wnt_stat
  • stacksize : yystack
  • START : inflate_codes_state
  • start : datelist, re_registers
  • StartDragDockBar() : CCJDockContext
  • StartGroupEdit() : CGfxOutBarCtrl
  • StartItemEdit() : CGfxOutBarCtrl
  • StartResize() : CCJDockContext
  • StartWatch() : KoWatcher
  • stat : file_data
  • stat_desc : tree_desc_s
  • state : CRevFile, z_stream_s, rcsversnode
  • State() : CRevFile
  • STATE : CCJFlatComboBox
  • statelist : log_data
  • static_len : internal_state
  • static_tree : static_tree_desc_s
  • status : internal_state, LOCK, IOSB, PIPE, VMS_DIR, tag_info, sortrec, hardlink_info, commit_info, response, unreaped, ReportConflict
  • StepToLocation() : CWinCvsBrowser, UCvsFolders
  • Stop() : CCJHtmlView
  • StopWatch() : KoWatcher
  • StoreExpanded() : CWinCvsBrowser, UCvsFolders
  • str : UStr, UPStr, CLogStr, GPT_CONSOLE, GPT_GETENV
  • strategy : internal_state
  • strcat() : CvsString
  • strcpy() : CvsString
  • stream : gz_stream
  • Stretch() : CCJDockContext
  • strict_locks : rcsnode
  • string : YYSTYPE
  • strlen() : CvsString
  • strm : internal_state
  • strncpy() : CvsString
  • strs : err_strs
  • strstart : internal_state
  • sub : inflate_blocks_state, internal_state, inflate_codes_state
  • SubclassHeader() : CCJListView, CCJListCtrl
  • subdirs : stickydirtag
  • suffix_begin : file_data
  • sValidMenu : UWidget
  • SwitchView() : CCJFlatSplitterWnd
  • SymbolicList() : CRcsFile
  • symbolicList : CRcsFile
  • symbols : rcsnode
  • symbols_data : rcsnode
  • syncflag : CCJMenuData
  • SynchronizeMenu() : CCJMenu
  • syntax : re_pattern_buffer
  • szLabel : tagCTV_ITEM
  • szName : ColorTableEntry
  • szTabLabel : tagTCB_ITEM
  • szToolTipLabel : tagTCB_ITEM

- t -
  • t_linkname : _linkname
  • t_name : _name, yytoktype
  • t_val : yytoktype
  • table : inflate_blocks_state
  • tag : CLogNodeTag, tag_info, logfile_info, vers_ts, stickydirtag, entnode, commit_info, EntnodeFile
  • Tag() : CRevNumber
  • tagName : CRevNumber
  • targets : CAllTargets
  • tb : inflate_blocks_state
  • tbButton : TOOLBARINFO
  • TbEntry() : TbEntry
  • TbEntryButton() : TbEntryButton
  • TbEntryChkButton() : TbEntryChkButton
  • TbEntryDropDown() : TbEntryDropDown
  • TbEntrySeparator() : TbEntrySeparator
  • TBrowserFill() : TBrowserFill
  • TBrowserFillDummy() : TBrowserFillDummy
  • TBuggyPopup() : TBuggyPopup
  • td : inflate_blocks_state
  • term_code : pid_list
  • text : CGfxGroupEdit, rcsversnode, deltatext
  • TextOutClipped() : UDC
  • TGraphCmdStatus() : TGraphCmdStatus
  • TGraphDelCmd() : TGraphDelCmd
  • TGraphRectSelect() : TGraphRectSelect
  • TGraphSelNonSig() : TGraphSelNonSig
  • time : timeb
  • timestamp : entnode
  • timezone : timeb
  • title : CustInvertTable, ULIST_INFO, ULIST_INSERT, UTREE_INFO, UTREE_INSERT, UTB_INIT
  • tl : inflate_blocks_state
  • tlist : master_lists
  • TMPersistent() : TMPersistent< T >
  • TMString() : TMString< T >
  • tocvsFilter : WrapperEntry
  • ToggleAdded() : KoFilterModel
  • ToggleBtn() : CPseudoToggle
  • ToggleChanged() : KoFilterModel
  • ToggleConflict() : KoFilterModel
  • ToggleDocking() : CCJDockContext
  • ToggleHideUnknown() : KoFilterModel
  • ToggleIgnore() : KoIgnoreModel
  • ToggleMissing() : KoFilterModel
  • ToggleModified() : KoFilterModel
  • ToggleRecursion() : KoRecursionModel
  • ToggleRemoved() : KoFilterModel
  • ToggleTrackButtonMode() : CCJMenuBar
  • ToggleUnknown() : KoFilterModel
  • token() : Authen
  • tokens : irciiAttrCvt, mircAttrCvt
  • tokenToKind() : Authen
  • tooltip : awidget, UTB_BUTTON
  • tooMuchWarnings : ReportWarning
  • top : URECT
  • TopLeft() : URect
  • tot_ent : S_Dir
  • total_in : z_stream_s
  • total_out : z_stream_s
  • totB : CWinLogData
  • totpage : DYN_LIST
  • totRevisions : CRcsFile
  • TotRevisions() : CRcsFile
  • TouchTimeStamp() : CPersistent
  • TPseudoAppBehavior() : TPseudoAppBehavior
  • TPseudoCustomView() : TPseudoCustomView
  • TPseudoDoubleNumberText() : TPseudoDoubleNumberText
  • TPseudoIconButton() : TPseudoIconButton
  • TPseudoIconCheckBox() : TPseudoIconCheckBox
  • TPseudoIconPopup() : TPseudoIconPopup
  • TPseudoRotateIconButton() : TPseudoRotateIconButton
  • TPseudoScrollBar() : TPseudoScrollBar
  • TPseudoTextListView() : TPseudoTextListView
  • TPseudoWinAdorner() : TPseudoWinAdorner
  • TPseudoWinBehavior() : TPseudoWinBehavior
  • TrackDockBar() : CCJDockContext
  • TrackPopup() : CCJMenuBar
  • TrackScrollBar() : TPseudoScrollBar
  • translate : re_pattern_buffer
  • TranslateFrameMessage() : CCJMenuBar
  • transparent : gz_stream
  • TraverseGraph() : TGraph
  • TraverseNode() : TGraphSelNonSig, TGraphDelCmd, TGraphCmdStatus, TGraphRectSelect, TGraph
  • tree : inflate_codes_state
  • trees : inflate_blocks_state
  • True() : PyContainer
  • ts : EntnodeFile
  • ts_conflict : vers_ts, EntnodeFile
  • ts_rcs : vers_ts
  • ts_user : vers_ts
  • TViewFill() : TViewFill
  • type : hrec, node, logfile_info, entnode, _TABLE, _WireMessage, _WireHandler

- u -
  • UAuthen_Kserver() : UAuthen_Kserver
  • UAuthen_Pserver() : UAuthen_Pserver
  • UAuthen_Rhosts() : UAuthen_Rhosts
  • UAuthen_SSH() : UAuthen_SSH
  • UBrush() : UBrush
  • UCmdTarget() : UCmdTarget
  • UCmdUI() : UCmdUI
  • UCOLOR() : UCOLOR
  • UCvsApp() : UCvsApp
  • UCvsConsole() : UCvsConsole
  • UCvsFiles() : UCvsFiles
  • UCvsFolders() : UCvsFolders
  • UCvsFrame() : UCvsFrame
  • UCvsGraph() : UCvsGraph
  • UCvsMenubar() : UCvsMenubar
  • UCvsToolbar() : UCvsToolbar
  • UDC : UDC, UBrush, UPen
  • UDispatchInfo : UCmdTarget
  • UDispatchMessage() : UWidget, UToolbar, UCmdTarget
  • UEditMessage() : UEditMessage
  • uflags : VMS_DIR
  • uFlags : tagAFX_OLDTOOLINFO
  • uId : tagAFX_OLDTOOLINFO
  • uiToolTipId : tagTCB_ITEM
  • ulist : master_lists
  • UMacAppMenu() : UMacAppMenu
  • UMenu() : UMenu
  • uncheckoutFiles() : CvsProject
  • UncheckoutFiles() : CvsCoworker
  • underCnt : CTCP2Parse
  • underLast : CTCP2Parse
  • underline : UCvsConsole, ansiAttrCvt
  • undiscarded : file_data
  • unedit : addremove_args
  • UnionRect() : URect
  • Unixfy() : CTcl_Interp
  • UnixLF() : CvsPrefs
  • unknown : EntnodeData
  • Unlock() : CCVS_CoworkerModule
  • unmodified : EntnodeData
  • UnRef() : aref, PyAutoObject< T >, EntnodeData, EntnodePath
  • UnRegister() : CPersistent
  • UnselectAll() : CWinLogData
  • UnSetBitmapBackground() : CCJMenu
  • UnSetDisableOldStyle() : CCJMenu
  • UObject() : UObject
  • Update() : CWinLogData
  • update_dir : file_info
  • UpdateAllDocsView() : CWincvsApp
  • UpdateCaption() : CCJCaption
  • UpdateCaptionBack() : CCJCaption
  • UpdateCaptionText() : CCJCaption
  • updateFiles() : CvsProject
  • UpdateFiles() : CvsCoworker
  • UpdateFont() : CCJTabCtrl, CCJOutlookBar, CCJMenuBar, CCJMaskEdit, CCJFlatButton, CCJColorPopup, CCJCaption, CCJBrowseButton
  • UpdateMenu() : CCJMenu
  • UpdateScrollbars() : CCJHexEdit
  • UpdateSelf() : CWinLogBranchData, CWinLogTagData, CWinLogRevData, CWinLogHeaderData, CWinLogData, CWinLogBranchData, CWinLogTagData, CWinLogRevData, CWinLogHeaderData, CWinLogData
  • UPen() : UPen
  • UPoint() : UPoint
  • UPPMenu() : UPPMenu
  • UPromptMessage() : UPromptMessage
  • UPseudoFakePane() : UPseudoFakePane
  • UPseudoPageHider() : UPseudoPageHider
  • UPseudoPlaceHolder() : UPseudoPlaceHolder
  • UPseudoRotButton() : UPseudoRotButton
  • UPStr() : UPStr
  • upto : group
  • URect() : URect
  • urlCnt : CTCP2Parse
  • urlLast : CTCP2Parse
  • URuntimeClass() : URuntimeClass
  • USaveSettings() : USaveSettings
  • used : re_pattern_buffer
  • useDefault : MACBINMAP
  • UseKeyChain() : CvsPrefs
  • USemaphore() : USemaphore
  • UseProxy() : CvsPrefs
  • user : CLogNode, hrec, entnode, EntnodeData
  • userFlags : ReportConflict
  • UseViewerAlways() : CvsPrefs
  • USize() : USize
  • UStr() : UStr
  • UTF_8 : CTCP2Parse
  • UTimer() : UTimer
  • UToolbar() : UToolbar
  • UWaitCursor() : UWaitCursor
  • UWidget : UWidget, TPseudoWinAdorner, TPseudoWinBehavior

- v -
  • v_aijnl : fjndef
  • v_atjnl : fjndef
  • v_badacl : fchdef
  • v_badblock : fchdef
  • v_bijnl : fjndef
  • v_contig : fchdef
  • v_contigb : fchdef
  • v_directory : fchdef
  • v_erase : fchdef
  • v_fileorg : fatdef
  • v_fortrancc : fatdef
  • v_impliedcc : fatdef
  • v_journal_file : fjndef
  • v_locked : fchdef
  • v_markdel : fchdef
  • v_never_ru : fjndef
  • v_nobackup : fchdef
  • v_nocharge : fchdef
  • v_nospan : fatdef
  • v_only_ru : fjndef
  • v_printcc : fatdef
  • v_readcheck : fchdef
  • v_rtype : fatdef
  • v_rujnl : fjndef
  • v_spool : fchdef
  • v_writcheck : fchdef
  • v_writeback : fchdef
  • val : option
  • valid_lines : file_data
  • value : LOCK, error_info, _TABLE
  • var : awidget
  • varcode : UTB_BUTTON
  • vector : linevector
  • verb() : ansiAttrCvt::AnsiSeq
  • version : rcsversnode, deltatext, entnode
  • version_flag : VMS_DIR
  • versionNum : ASHeader
  • versions : rcsnode
  • view : CGraphConsole, CViewInfo
  • ViewChangedFrame() : TPseudoWinAdorner
  • Viewer() : CvsPrefs
  • visited : EntnodeData
  • vlen : rcsbuffer
  • vn : EntnodeFile
  • vn_rcs : vers_ts
  • vn_tag : vers_ts
  • vn_user : vers_ts
  • Void() : PyContainer
  • vs : yystack
  • vsp : yystack

- w -
  • w_bits : internal_state
  • w_defext : fatdef
  • w_efblkh : fatdef
  • w_efblkl : fatdef
  • w_ffbyte : fatdef
  • w_fid_num : _version
  • w_fid_seq : _version
  • w_gbc : fatdef
  • w_hiblkh : fatdef
  • w_hiblkl : fatdef
  • w_mask : internal_state
  • w_maxrec : fatdef
  • w_rsize : fatdef
  • w_size : internal_state
  • w_verlimit : _name
  • w_version : _version
  • w_versions : fatdef
  • warnings : ImportReport
  • was : internal_state
  • WASH : inflate_codes_state
  • wbits : internal_state
  • what : inflate_huft_s
  • wHeight : CToolBarData
  • which : recursion_frame
  • WhichCvs() : CvsPrefs
  • White : CTCP2Parse
  • wid : TbEntryButton
  • WidgetIsActive() : UWidget
  • width : WININFO, LV_COLUMN
  • Width() : URect
  • widthbtn : UTB_INIT
  • wildCard : WrapperEntry
  • Win32wstring() : Win32wstring
  • window : inflate_blocks_state, internal_state
  • window_size : internal_state
  • WindowProc() : CSubclassWnd, CCJToolBarBase, CCJReBar, CCJMenuBarFrameHook, CPseudoDlg
  • WININFO() : WININFO
  • wire_ht : CAllHandlers
  • wItemCount : CToolBarData
  • WM_CONTENTCHANGE : CTbEdit
  • WM_FILECHANGE : KoWatcher
  • word : inflate_huft_s
  • WordWrapLogMsg() : CvsPrefs
  • WorkingFile() : CRcsFile
  • workingFile : CRcsFile
  • WrapToolBar() : CCJToolBar
  • write : inflate_blocks_state
  • write_buffer : _CvsProcess
  • write_buffer_index : _CvsProcess
  • write_chan : _SUBIO
  • write_fp : _SUBIO
  • write_func : _WireHandler
  • write_iosb : _SUBIO
  • write_output : diff_callbacks
  • write_stdout : diff_callbacks
  • WriteFields() : TPseudoDoubleNumberText, TPseudoIconCheckBox, TPseudoRotateIconButton, TPseudoIconButton, TPseudoIconPopup, TBuggyPopup
  • WriteString() : CCJMemFile
  • wVersion : CToolBarData
  • wWidth : CToolBarData

- x -
  • x : _IID, UPOINT
  • xLeftMargin : CGfxOutBarCtrl
  • xmid : partition
  • xoffset : CCJMenuData
  • xSmallIconLabelOffset : CGfxOutBarCtrl

- y -
  • y : UPOINT
  • Yellow : CTCP2Parse
  • yLargeIconLabelOffset : CGfxOutBarCtrl
  • yLargeIconSpacing : CGfxOutBarCtrl
  • ymid : partition
  • ySmallIconSpacing : CGfxOutBarCtrl
  • yTopMargin : CGfxOutBarCtrl
  • yy_at_bol : yy_buffer_state
  • yy_buf_pos : yy_buffer_state
  • yy_buf_size : yy_buffer_state
  • yy_buffer_status : yy_buffer_state
  • yy_ch_buf : yy_buffer_state
  • yy_fill_buffer : yy_buffer_state
  • yy_input_file : yy_buffer_state
  • yy_is_interactive : yy_buffer_state
  • yy_is_our_buffer : yy_buffer_state
  • yy_n_chars : yy_buffer_state

- z -
  • Z9Option() : CvsPrefs
  • z_eof : gz_stream
  • z_err : gz_stream
  • zalloc : z_stream_s
  • zfree : z_stream_s
  • ZLevel() : CvsPrefs

- ~ -
  • ~AnsiSeq() : ansiAttrCvt::AnsiSeq
  • ~aref() : aref
  • ~AuthenKserver() : AuthenKserver
  • ~AuthenLocal() : AuthenLocal
  • ~AuthenModel() : AuthenModel
  • ~AuthenNtserver() : AuthenNtserver
  • ~AuthenPserver() : AuthenPserver
  • ~AuthenRhosts() : AuthenRhosts
  • ~AuthenSSH() : AuthenSSH
  • ~awidget() : awidget
  • ~CAllHandlers() : CAllHandlers
  • ~CAllTargets() : CAllTargets
  • ~CAuthenSetUp() : CAuthenSetUp
  • ~CBarConsole() : CBarConsole
  • ~CBarFolder() : CGfxOutBarCtrl::CBarFolder
  • ~CBarItem() : CGfxOutBarCtrl::CBarItem
  • ~CBrowseFileView() : CBrowseFileView
  • ~CBrowserBar() : CBrowserBar
  • ~CCJBrowseButton() : CCJBrowseButton
  • ~CCJBrowseEdit() : CCJBrowseEdit
  • ~CCJCaption() : CCJCaption
  • ~CCJCaptionPopupWnd() : CCJCaptionPopupWnd
  • ~CCJColorPicker() : CCJColorPicker
  • ~CCJColorPopup() : CCJColorPopup
  • ~CCJComboBoxEx() : CCJComboBoxEx
  • ~CCJControlBar() : CCJControlBar
  • ~CCJDateTimeCtrl() : CCJDateTimeCtrl
  • ~CCJDockBar() : CCJDockBar
  • ~CCJDockContext() : CCJDockContext
  • ~CCJExplorerBar() : CCJExplorerBar
  • ~CCJFlatButton() : CCJFlatButton
  • ~CCJFlatComboBox() : CCJFlatComboBox
  • ~CCJFlatHeaderCtrl() : CCJFlatHeaderCtrl
  • ~CCJFlatSplitterWnd() : CCJFlatSplitterWnd
  • ~CCJFlatTabCtrl() : CCJFlatTabCtrl
  • ~CCJFontCombo() : CCJFontCombo
  • ~CCJFrameWnd() : CCJFrameWnd
  • ~CCJHexEdit() : CCJHexEdit
  • ~CCJHtmlView() : CCJHtmlView
  • ~CCJHyperLink() : CCJHyperLink
  • ~CCJListBox() : CCJListBox
  • ~CCJListCtrl() : CCJListCtrl
  • ~CCJListView() : CCJListView
  • ~CCJLogoPane() : CCJLogoPane
  • ~CCJMaskEdit() : CCJMaskEdit
  • ~CCJMDIChildWnd() : CCJMDIChildWnd
  • ~CCJMDIFrameWnd() : CCJMDIFrameWnd
  • ~CCJMemFile() : CCJMemFile
  • ~CCJMenu() : CCJMenu
  • ~CCJMenuBar() : CCJMenuBar
  • ~CCJMenuBarFrameHook() : CCJMenuBarFrameHook
  • ~CCJMenuData() : CCJMenuData
  • ~CCJMetaFileButton() : CCJMetaFileButton
  • ~CCJMiniDockFrameWnd() : CCJMiniDockFrameWnd
  • ~CCJMonthCalCtrl() : CCJMonthCalCtrl
  • ~CCJOutlookBar() : CCJOutlookBar
  • ~CCJPagerCtrl() : CCJPagerCtrl
  • ~CCJSizeDockBar() : CCJSizeDockBar
  • ~CCJSortClass() : CCJSortClass
  • ~CCJStatusBar() : CCJStatusBar
  • ~CCJStatusBarPane() : CCJStatusBarPane
  • ~CCJStatusBarPaneControlInfo() : CCJStatusBarPaneControlInfo
  • ~CCJTabCtrl() : CCJTabCtrl
  • ~CCJTabCtrlBar() : CCJTabCtrlBar
  • ~CCJTabView() : CCJTabView
  • ~CCJToolBar() : CCJToolBar
  • ~CCJToolBarBase() : CCJToolBarBase
  • ~CCJToolBarCtrl() : CCJToolBarCtrl
  • ~CCJTreeCtrl() : CCJTreeCtrl
  • ~CCJWindowPlacement() : CCJWindowPlacement
  • ~CColorConsole() : CColorConsole
  • ~CColorStatic() : CColorStatic
  • ~CCustInvertTable() : CCustInvertTable
  • ~CCvsStatusBar() : CCvsStatusBar
  • ~CCvsThreadLock() : CCvsThreadLock
  • ~CDestroyThreadLock() : CDestroyThreadLock
  • ~CExploreBar() : CExploreBar
  • ~CFillPyEntries() : CFillPyEntries
  • ~CFillTclEntries() : CFillTclEntries
  • ~CFindSettings() : CFindSettings
  • ~CGfxGroupEdit() : CGfxGroupEdit
  • ~CGfxOutBarCtrl() : CGfxOutBarCtrl
  • ~CGfxSplitterWnd() : CGfxSplitterWnd
  • ~CGraphDoc() : CGraphDoc
  • ~CGraphFrame() : CGraphFrame
  • ~CGraphView() : CGraphView
  • ~CHistComboBoxEx() : CHistComboBoxEx
  • ~CKeyString() : CKeyString
  • ~CLogFrame() : CLogFrame
  • ~CLogNode() : CLogNode
  • ~CLogNodeData() : CLogNodeData
  • ~CLogoutThread() : CLogoutThread
  • ~CLogStr() : CLogStr
  • ~CMacBinItem() : CMacBinItem
  • ~CMacBinTable() : CMacBinTable
  • ~CMainFrame() : CMainFrame
  • ~CMMenuString() : CMMenuString
  • ~CMPString() : CMPString
  • ~CMString() : CMString
  • ~COptionalPropertySheet() : COptionalPropertySheet
  • ~CPersistent() : CPersistent
  • ~CPersistentBool() : CPersistentBool
  • ~CPersistentInt() : CPersistentInt
  • ~CPersistentT() : CPersistentT< T >
  • ~CProgress() : CProgress
  • ~CPseudoButton() : CPseudoButton
  • ~CPseudoDlg() : CPseudoDlg
  • ~CPseudoDraw() : CPseudoDraw
  • ~CPseudoItem() : CPseudoItem
  • ~CPseudoList() : CPseudoList
  • ~CPseudoRotButton() : CPseudoRotButton
  • ~CPseudoToggle() : CPseudoToggle
  • ~CPyCvsConsole() : CPyCvsConsole
  • ~CPython_Interp() : CPython_Interp
  • ~CPyThreadState() : CPyThreadState
  • ~CRcsFile() : CRcsFile
  • ~CRecursionLock() : CRecursionLock
  • ~CRevFile() : CRevFile
  • ~CRevisionConsole() : CRevisionConsole
  • ~CRevNumber() : CRevNumber
  • ~CSelectionChangeNotifier() : CWinCvsBrowser::CSelectionChangeNotifier
  • ~CSortHeaderCtrl() : CSortHeaderCtrl
  • ~CSortList() : CSortList< T >
  • ~CSplashWnd() : CSplashWnd
  • ~CStackThreadLock() : CStackThreadLock
  • ~CStaticAllocT() : CStaticAllocT< T >
  • ~CSubclassWnd() : CSubclassWnd
  • ~CSubclassWndMap() : CSubclassWndMap
  • ~CTbEdit() : CTbEdit
  • ~CTcl_Interp() : CTcl_Interp
  • ~CTCLBrowserEnt() : CTCLBrowserEnt
  • ~CTCLCvsConsole() : CTCLCvsConsole
  • ~CTempToggleBool() : CTempToggleBool
  • ~CTipDlg() : CTipDlg
  • ~CTmpFiles() : CTmpFiles
  • ~CToolbarCombo() : CToolbarCombo
  • ~CTurnOffDispatching() : CTurnOffDispatching
  • ~CvsArgs() : CvsArgs
  • ~CvsFilenames() : CvsFilenames
  • ~CvsPrefs() : CvsPrefs
  • ~CvsProject() : CvsProject
  • ~CvsString() : CvsString
  • ~CvsTrace() : CvsTrace
  • ~CWinCvsBrowser() : CWinCvsBrowser
  • ~CWincvsDoc() : CWincvsDoc
  • ~CWincvsView() : CWincvsView
  • ~CWinLogBranchData() : CWinLogBranchData
  • ~CWinLogData() : CWinLogData
  • ~CWinLogHeaderData() : CWinLogHeaderData
  • ~CWinLogRevData() : CWinLogRevData
  • ~CWinLogTagData() : CWinLogTagData
  • ~CWinPlacement() : CWinPlacement
  • ~CWndRedrawMngr() : CWndRedrawMngr
  • ~ENTNODE() : ENTNODE
  • ~EntnodeData() : EntnodeData
  • ~EntnodeFile() : EntnodeFile
  • ~EntnodeFolder() : EntnodeFolder
  • ~EntnodePath() : EntnodePath
  • ~ImportReport() : ImportReport
  • ~KoFilterModel() : KoFilterModel
  • ~KoIgnoreModel() : KoIgnoreModel
  • ~KoRecursionModel() : KoRecursionModel
  • ~KoWatcher() : KoWatcher
  • ~LMainPseudoAttachment() : LMainPseudoAttachment
  • ~LPseudoDrawAttachment() : LPseudoDrawAttachment
  • ~LPseudoWinAttachment() : LPseudoWinAttachment
  • ~MacBinMaps() : MacBinMaps
  • ~PCPStr() : PCPStr
  • ~PCStr() : PCStr
  • ~PMacBinMaps() : PMacBinMaps
  • ~PyAutoObject() : PyAutoObject< T >
  • ~PyCmdUI() : PyCmdUI
  • ~PyColorConsole() : PyColorConsole
  • ~PyContainer() : PyContainer
  • ~PyCvsEntry() : PyCvsEntry
  • ~PyMenuMgr() : PyMenuMgr
  • ~PyPersistent() : PyPersistent
  • ~PyRegistry() : PyRegistry
  • ~ReportConflict() : ReportConflict
  • ~ReportWarning() : ReportWarning
  • ~TbEntry() : TbEntry
  • ~TbEntryButton() : TbEntryButton
  • ~TbEntryChkButton() : TbEntryChkButton
  • ~TbEntryDropDown() : TbEntryDropDown
  • ~TbEntrySeparator() : TbEntrySeparator
  • ~TBrowserFill() : TBrowserFill
  • ~TBrowserFillDummy() : TBrowserFillDummy
  • ~TBuggyPopup() : TBuggyPopup
  • ~TMPersistent() : TMPersistent< T >
  • ~TMString() : TMString< T >
  • ~TPseudoAppBehavior() : TPseudoAppBehavior
  • ~TPseudoCustomView() : TPseudoCustomView
  • ~TPseudoDoubleNumberText() : TPseudoDoubleNumberText
  • ~TPseudoIconButton() : TPseudoIconButton
  • ~TPseudoIconCheckBox() : TPseudoIconCheckBox
  • ~TPseudoIconPopup() : TPseudoIconPopup
  • ~TPseudoRotateIconButton() : TPseudoRotateIconButton
  • ~TPseudoScrollBar() : TPseudoScrollBar
  • ~TPseudoTextListView() : TPseudoTextListView
  • ~TPseudoWinAdorner() : TPseudoWinAdorner
  • ~TPseudoWinBehavior() : TPseudoWinBehavior
  • ~TViewFill() : TViewFill
  • ~UAuthen_Kserver() : UAuthen_Kserver
  • ~UAuthen_Pserver() : UAuthen_Pserver
  • ~UAuthen_Rhosts() : UAuthen_Rhosts
  • ~UAuthen_SSH() : UAuthen_SSH
  • ~UBrush() : UBrush
  • ~UCmdTarget() : UCmdTarget
  • ~UCmdUI() : UCmdUI
  • ~UCvsApp() : UCvsApp
  • ~UCvsConsole() : UCvsConsole
  • ~UCvsFiles() : UCvsFiles
  • ~UCvsFolders() : UCvsFolders
  • ~UCvsFrame() : UCvsFrame
  • ~UCvsGraph() : UCvsGraph
  • ~UCvsMenubar() : UCvsMenubar
  • ~UCvsToolbar() : UCvsToolbar
  • ~UDC() : UDC
  • ~UEditMessage() : UEditMessage
  • ~UMacAppMenu() : UMacAppMenu
  • ~UMenu() : UMenu
  • ~UObject() : UObject
  • ~UPen() : UPen
  • ~UPPMenu() : UPPMenu
  • ~UPromptMessage() : UPromptMessage
  • ~UPseudoFakePane() : UPseudoFakePane
  • ~UPseudoPageHider() : UPseudoPageHider
  • ~UPseudoPlaceHolder() : UPseudoPlaceHolder
  • ~UPseudoRotButton() : UPseudoRotButton
  • ~UPStr() : UPStr
  • ~URuntimeClass() : URuntimeClass
  • ~USaveSettings() : USaveSettings
  • ~USemaphore() : USemaphore
  • ~UStr() : UStr
  • ~UToolbar() : UToolbar
  • ~UWaitCursor() : UWaitCursor
  • ~UWidget() : UWidget
  • ~WININFO() : WININFO
Generated on Sun Oct 21 12:45:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


File Member Index

WinCvs 1.3b6 Source Doc File Members

_ | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z

Here is a list of all file members with links to the files they belong to:

- _ -

  • __Assert() : CvsTrace.h
  • __attribute__ : error.h
  • __cvs_initialize() : dll_glue.c
  • __cvs_terminate() : dll_glue.c
  • __FNM_FLAGS : fnmatch.h
  • __format__ : error.h
  • __glue_consoleerr : dll_glue.c
  • __glue_consolein : dll_glue.c
  • __glue_consoleout : dll_glue.c
  • __glue_eventdispatch : dll_glue.c
  • __glue_exit_code : dll_glue.c
  • __glue_getenv : dll_glue.c
  • __initialize() : dll_glue.c
  • __MIDL_itf_cvs_coworker_0000_v0_0_c_ifspec : cvs_coworker.h
  • __MIDL_itf_CVS_Coworker_0000_v0_0_c_ifspec : CVS_Coworker_i.h
  • __MIDL_itf_cvs_coworker_0000_v0_0_s_ifspec : cvs_coworker.h
  • __MIDL_itf_CVS_Coworker_0000_v0_0_s_ifspec : CVS_Coworker_i.h
  • __MIDL_ProcFormatString : CVS_Coworker_p.c
  • __MIDL_TypeFormatString : CVS_Coworker_p.c
  • __pad0__ : getdate.y
  • __pad10__ : getdate.y
  • __pad11__ : getdate.y
  • __pad12__ : getdate.y
  • __pad13__ : cvs_coworker.h
  • __pad14__ : CVS_Coworker_i.h
  • __pad1__ : getdate.y
  • __pad2__ : getdate.y
  • __pad3__ : getdate.y
  • __pad4__ : getdate.y
  • __pad5__ : getdate.y
  • __pad6__ : getdate.y
  • __pad7__ : getdate.y
  • __pad8__ : getdate.y
  • __pad9__ : getdate.y
  • __printf__ : error.h
  • __PROTO : savecwd.c, savecwd.h, getline.h
  • __REQUIRED_RPCNDR_H_VERSION__ : CVS_Coworker_i.h, cvs_coworker.h
  • __REQUIRED_RPCPROXY_H_VERSION__ : CVS_Coworker_p.c
  • __STDC__ : config.h
  • __terminate() : dll_glue.c
  • __types_loaded__ : vms-types.h
  • __yy_memcpy() : parser.cc
  • _AfxRelease() : CJHtmlView.cpp
  • _ATL_APARTMENT_THREADED : StdAfx.h
  • _CarbonCompatCallLibrary() : TclGlue.mac.h
  • _CJX_COMMENT : CJLibrary.h
  • _CJX_MESSAGE : CJLibrary.h
  • _CjxChildWindowFromPoint() : CJReBar.cpp
  • _CjxGetDlgCtrlID : CJReBar.cpp
  • _CJXLIB_INLINE : CJLibrary.h, StdAfx.h
  • _close_on_exec_list : mac_run.c
  • _close_on_exec_num : mac_run.c
  • _CLR_TO_RGBQUAD : CJToolBar.cpp
  • _ComCtlVersion : CJToolBar.h, CJToolBar.cpp
  • _COMMON_PY_DECL_CLASS : PythonMacros.h
  • _Compare() : CustomizeMenus.cpp, BrowseViewColumn.h, BrowseViewColumn.cpp
  • _CompatCallLibrary() : dll_loader.h, dll_loader.c
  • _countof : BrowseViewColumn.cpp
  • _cvs_coworker_CHECK_IID : CVS_Coworker_p.c
  • _cvs_coworker_IID_Lookup() : CVS_Coworker_p.c
  • _cvs_coworker_InterfaceNamesList : CVS_Coworker_p.c
  • _cvs_coworker_ProxyVtblList : CVS_Coworker_p.c
  • _cvs_coworker_StubVtblList : CVS_Coworker_p.c
  • _cvsgui_readfd : cvsgui_protocol.h, cvsgui.c
  • _cvsgui_writefd : cvsgui_protocol.h, cvsgui.c
  • _delete : CJLibrary.h, StdAfx.h
  • _destroyIcon : StdAfx.h
  • _dirdef : dir.h
  • _dirdef1 : dir.h
  • _dirdef2 : dir.h
  • _dosmaperr() : Stat.cpp, win32.c
  • _dropDownWidth : CJToolBar.cpp
  • _DSTMODE : getdate.c
  • _FNM_IGNORECASE : system.c
  • _FNM_OS2 : system.c
  • _FNMATCH_H : fnmatch.h
  • _GetComCtlVersion() : CJToolBar.h, CJToolBar.cpp
  • _GetDropDownWidth() : CJToolBar.cpp
  • _getline_h_ : getline.h
  • _GetMenuEntryRecurs() : wincvs_winutil.cpp
  • _GETOPT_H : getopt.h
  • _getopt_internal() : getopt.h
  • _glue_buf : dll_glue.c
  • _gnColumnWidth : UCvsFiles.cpp
  • _GNU_SOURCE : regex.c
  • _gp_console_destroy() : cvsgui_process.cpp
  • _gp_console_read() : cvsgui_process.cpp
  • _gp_console_write() : cvsgui_process.cpp
  • _gp_getenv_destroy() : cvsgui_process.cpp
  • _gp_getenv_read() : cvsgui_process.cpp
  • _gp_getenv_write() : cvsgui_process.cpp
  • _gp_quit_destroy() : cvsgui_process.cpp
  • _gp_quit_read() : cvsgui_process.cpp
  • _gp_quit_write() : cvsgui_process.cpp
  • _gszColumnLabel : UCvsFiles.cpp
  • _ICvsCoworkerStubVtbl : CVS_Coworker_p.c
  • _loadPersistentSettings() : Persistent.cpp
  • _LoadSysColorBitmap() : CJToolBar.h, CJToolBar.cpp
  • _MERIDIAN : getdate.c
  • _Module : wincvs.cpp, StdAfx.h
  • _PATH_RLOGIN : pathnames.h
  • _RE_ARGS : regex.h
  • _RE_SYNTAX_POSIX_COMMON : regex.h
  • _REGEX_RE_COMP : config.h
  • _RGB_TO_RGBQUAD : CJToolBar.cpp
  • _statcore() : Stat.cpp, win32.c
  • _stderr_style : PythonGlue.cpp
  • _stdout_style : PythonGlue.cpp
  • _sysColorMap : CJToolBar.cpp
  • _TCL_CALLBACK : TclGlue.cpp
  • _tcl_cfm_macho() : TclGlue.mac.h
  • _tr_align() : deflate.h
  • _tr_flush_block() : deflate.h
  • _tr_init() : trees.c, deflate.h
  • _tr_stored_block() : deflate.h
  • _tr_tally() : deflate.h
  • _trace_style : PythonGlue.cpp
  • _VC_VERSION_5 : CJLibrary.h, StdAfx.h

- a -
  • a : util.c, context.c
  • a1 : rcscmds.c, error.c
  • a2 : rcscmds.c, error.c
  • a3 : error.c
  • a4 : error.c
  • a5 : error.c
  • a6 : error.c
  • a7 : error.c
  • a8 : error.c
  • abs() : vasprintf.c
  • accept_hrec() : history.c
  • access : config.h
  • action : vmsmunch.c
  • add() : cvs.h, add.c
  • ADD : diff3.c
  • add_change() : analyze.c
  • add_directory() : add.c
  • add_entries_proc() : find_names.c
  • add_exclude() : diff.c
  • add_exclude_file() : diff.c
  • add_log() : import.c
  • add_logfp : import.c
  • add_regexp() : diff.c
  • add_rev() : import.c
  • add_subdir_proc() : find_names.c
  • add_tags() : import.c
  • add_usage : add.c
  • add_vbranch : import.c
  • add_vhead : import.c
  • AddEntryNode() : entries.c
  • addfile() : recurse.c
  • AddFiles() : CVS_Coworker_i.h, cvs_coworker.h
  • AddIndent() : CvsTrace.cpp
  • adding : update.c
  • addlist() : recurse.c
  • AddPrefix() : CvsTrace.cpp
  • addr : md5.c
  • addremove_fileproc() : watch.c
  • addremove_filesdoneproc() : watch.c
  • addvers : rcs.c
  • AdjustRectangle() : CJDockContext.cpp
  • adler32() : zlib.h, adler32.c
  • admin() : cvs.h
  • admin_dirproc() : admin.c
  • admin_fileproc() : admin.c
  • admin_usage : admin.c
  • aflag : update.c, tag.c, recurse.c, lock.c, find_names.c, commit.c, classify.c, checkout.c
  • AFX_ADMINOPTIONDLG_H__C9A89564_F0A4_4294_8C6C_18469D18BCB3__INCLUDED_ : AdminOptionDlg.h
  • AFX_ANNOTATEDLG_H__864729EE_838B_473D_8723_E1269829F781__INCLUDED_ : AnnotateDlg.h
  • AFX_ASKYESNO_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_ : AskYesNo.h
  • AFX_BROWSEFILEVIEW_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : BrowseFileView.h
  • AFX_BROWSERBAR_H__64721953_F9A8_11D2_BDEC_000000000000__INCLUDED_ : BrowserBar.h
  • AFX_CHECKOUTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : CheckoutDlg.h
  • AFX_CHILDFRM_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_ : LogFrm.h
  • AFX_COLORSTATIC_H__4D2B055E_F042_428F_A662_09ABEA902DCE__INCLUDED_ : ColorStatic.h
  • AFX_COMMITDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : CommitDlg.h
  • AFX_CUSTOMIZEMENUS_H__28A6AE7E_C54B_47A5_A8F5_A127E2E9F3BF__INCLUDED_ : CustomizeMenus.h
  • AFX_CVSALERT_H__ACFE8C41_9836_11D1_AE50_00C0F0067852__INCLUDED_ : CvsAlert.h
  • AFX_CVSFILENAMES_H__582FF616_FAA5_11D2_B442_0080C6F9179D__INCLUDED_ : CvsFilenames.h
  • AFX_CVSPROJECT_H__582FF611_FAA5_11D2_B442_0080C6F9179D__INCLUDED_ : CvsProject.h
  • AFX_CVSSTATUSBAR_H__F549ACF2_ECFE_4933_A05D_5FC8248C3CD4__INCLUDED_ : CvsStatusBar.h
  • AFX_DIFFDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : DiffDlg.h
  • AFX_EDITORMONDLG_H__5146BF16_567B_4017_A1FD_619A7BD07906__INCLUDED_ : EditorMonDlg.h
  • AFX_EXPLOREBAR_H__A132A164_1A90_11D3_B1A1_004095463819__INCLUDED_ : ExploreBar.h
  • AFX_FILETRAVERSAL_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : FileTraversal.h
  • AFX_GETPASSWORD_H__5946A8C4_8517_11D1_8949_444553540000__INCLUDED_ : GetPassword.h
  • AFX_GETPREFS_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : GetPrefs.h
  • AFX_GETVALUE_H__5946A8C3_8517_11D1_8949_444553540000__INCLUDED_ : GetValue.h
  • AFX_GRAPHDOC_H__09F456C1_0018_11D2_BCAA_000000000000__INCLUDED_ : GraphDoc.h
  • AFX_GRAPHFRM_H__09F456BF_0018_11D2_BCAA_000000000000__INCLUDED_ : GraphFrm.h
  • AFX_GRAPHOPTDLG_H__E05908EC_20A6_43FE_93C7_0964E6ABB6B1__INCLUDED_ : GraphOptDlg.h
  • AFX_GRAPHVIEW_H__7A07C311_03F9_11D2_BCB2_000000000000__INCLUDED_ : GraphView.h
  • AFX_HISTCOMBOBOXEX_H__E330E7B9_8C79_44CB_8F07_01D395975365__INCLUDED_ : HistComboBoxEx.h
  • AFX_IDW_DIALOGBAR : CJReBar.h
  • AFX_IDW_REBAR : CJReBar.h
  • AFX_IDW_SIZEBAR_BOTTOM : CJControlBar.h
  • AFX_IDW_SIZEBAR_LEFT : CJControlBar.h
  • AFX_IDW_SIZEBAR_RIGHT : CJControlBar.h
  • AFX_IDW_SIZEBAR_TOP : CJControlBar.h
  • AFX_IMPORTDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : ImportDlg.h
  • AFX_IMPORTFILDERDLG_H__CFB7AA41_BDDB_11D1_B965_0020AF51D9DA__INCLUDED_ : ImportFilterDlg.h
  • AFX_IMPORTFILTER_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : ImportFilter.h
  • AFX_INITDLG_H__155D02C3_2323_11D3_B1A6_004095463819__INCLUDED_ : InitDlg.h
  • AFX_LINECMD_H__5946A8C5_8517_11D1_8949_444553540000__INCLUDED_ : LineCmd.h
  • AFX_LOGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : LogParse.h, LogDlg.h
  • AFX_MAINFRM_H__D2D77DCC_8299_11D1_8949_444553540000__INCLUDED_ : MainFrm.h
  • AFX_NOPYTHON_H__F675DE42_0FA7_4785_8946_E8FC861BBA57__INCLUDED_ : NoPython.h
  • AFX_OLDTOOLINFO : CJToolBarBase.h
  • AFX_OPTIONALPROPERTYSHEET_H__F82DC8BB_73CD_4AEA_8635_1A0932F24C7D__INCLUDED_ : OptionalPropertySheet.h
  • AFX_PROGRESSDIALOG_H__09D80542_6467_11D3_85F5_00609419FCC1__INCLUDED_ : ProgressDialog.h
  • AFX_PSEUDODLG_H__9EDC5FE5_21FD_4ACE_9AEB_7A521350A2EE__INCLUDED_ : PseudoDlg.h
  • AFX_PSEUDOLIST_H__49AF86B3_E6AB_4885_843C_1CE5AC8C4980__INCLUDED_ : pseudolist.h
  • AFX_RELEASEDLG_H__12B5FA97_703E_4616_B361_F2917D45E54A__INCLUDED_ : ReleaseDlg.h
  • AFX_RTAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : RtagDlg.h
  • AFX_STATICDRAW_H__8DCC3165_D42E_4FAA_BCCF_F4328685535E__INCLUDED_ : PseudoDraw.h
  • AFX_STDAFX_H__D2D77DCA_8299_11D1_8949_444553540000__INCLUDED_ : StdAfx.h
  • AFX_STDAFX_H__EDF5958A_92F6_11D3_9365_00C0F00AE104__INCLUDED_ : StdAfx.h
  • AFX_STDAFX_H__F235A078_2921_11D3_8733_000000000000__INCLUDED_ : StdAfx.h
  • AFX_TAGDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : TagDlg.h
  • AFX_TBEDIT_H__AEA5EC19_1292_4A30_93EA_E209A6BAE000__INCLUDED_ : TbEdit.h
  • AFX_TOOLBARCOMBO_H__3AE857F3_B4BD_11D4_8200_005004D6EF6C__INCLUDED_ : ToolbarCombo.h
  • AFX_UPDATEDLG_H__98CCBD22_845B_11D1_8949_444553540000__INCLUDED_ : UpdateDlg.h
  • AFX_WINCVS_H__D2D77DC7_8299_11D1_8949_444553540000__INCLUDED_ : wincvs.h
  • AFX_WINCVSBROWSER_H__144A4971_CAB4_11D1_BC80_000000000000__INCLUDED_ : WinCvsBrowser.h
  • AFX_WINCVSDOC_H__D2D77DCE_8299_11D1_8949_444553540000__INCLUDED_ : wincvsDoc.h
  • AFX_WINCVSVIEW_H__D2D77DD0_8299_11D1_8949_444553540000__INCLUDED_ : wincvsView.h
  • all : parseinfo.c
  • ALL_FILES : filesubr.c
  • ALL_REC_TYPES : history.c
  • all_users : history.c
  • ALLOC : gzio.c
  • alloc_func : zlib.h
  • alloca() : mac_run.c
  • ALLOCATE : diff3.c
  • ALT_STROKE : umenu.cpp
  • always_text : diff3.c
  • always_text_flag : diff.h
  • analyze_hunk() : diff.h
  • annotate() : rcs.c, cvs.h
  • annotate_fileproc() : rcs.c
  • anonymous : pwd.c
  • ANSI_SGM_BC_BLK : CTCP2Parse.cpp
  • ANSI_SGM_BC_BLU : CTCP2Parse.cpp
  • ANSI_SGM_BC_CYN : CTCP2Parse.cpp
  • ANSI_SGM_BC_DEFAULT : CTCP2Parse.cpp
  • ANSI_SGM_BC_GRN : CTCP2Parse.cpp
  • ANSI_SGM_BC_MAG : CTCP2Parse.cpp
  • ANSI_SGM_BC_RED : CTCP2Parse.cpp
  • ANSI_SGM_BC_WHT : CTCP2Parse.cpp
  • ANSI_SGM_BC_YEL : CTCP2Parse.cpp
  • ANSI_SGM_FC_BLK : CTCP2Parse.cpp
  • ANSI_SGM_FC_BLU : CTCP2Parse.cpp
  • ANSI_SGM_FC_CYN : CTCP2Parse.cpp
  • ANSI_SGM_FC_DEFAULT : CTCP2Parse.cpp
  • ANSI_SGM_FC_GRN : CTCP2Parse.cpp
  • ANSI_SGM_FC_MAG : CTCP2Parse.cpp
  • ANSI_SGM_FC_RED : CTCP2Parse.cpp
  • ANSI_SGM_FC_WHT : CTCP2Parse.cpp
  • ANSI_SGM_FC_YEL : CTCP2Parse.cpp
  • ANSI_SGM_TA_BLINK : CTCP2Parse.cpp
  • ANSI_SGM_TA_BLINK_OFF : CTCP2Parse.cpp
  • ANSI_SGM_TA_BOLD : CTCP2Parse.cpp
  • ANSI_SGM_TA_CONSEAL : CTCP2Parse.cpp
  • ANSI_SGM_TA_FAINT : CTCP2Parse.cpp
  • ANSI_SGM_TA_ITALIC : CTCP2Parse.cpp
  • ANSI_SGM_TA_ITALIC_OFF : CTCP2Parse.cpp
  • ANSI_SGM_TA_NORMAL : CTCP2Parse.cpp
  • ANSI_SGM_TA_RESET : CTCP2Parse.cpp
  • ANSI_SGM_TA_REV : CTCP2Parse.cpp
  • ANSI_SGM_TA_REV_OFF : CTCP2Parse.cpp
  • ANSI_SGM_TA_ULINE : CTCP2Parse.cpp
  • ANSI_SGM_TA_ULINE_OFF : CTCP2Parse.cpp
  • anychar : regex.c
  • AppendMenu : CJMenu.h
  • AppendODMenu : CJMenu.h
  • AppendODPopupMenu : CJMenu.h
  • AppendWinCvsDebugMask() : WinCvsDebug.h, WinCvsDebug.cpp
  • APPLESINGLE_WANTED_ENTRIES : cvs_hqx.cpp
  • apply_rcs_changes() : rcs.c
  • aptr : util.c
  • arg : rcs.c, admin.c, util.c
  • arg1 : util.c
  • arg2 : util.c
  • arg3 : util.c
  • arg4 : util.c
  • arg_add() : admin.c
  • argc : tag.c, subr.c, recurse.c
  • argmatch() : argmatch.c
  • args : vasprintf.c
  • argstring : log.c
  • argv : minigzip.c, example.c, filesubr.c, pc.c, filesubr.c, watch.c, version.c, update.c, tag.c, subr.c, status.c, rtag.c, remove.c, release.c, recurse.c, rcs.c, patch.c, mkmodules.c, main.c, log.c, lock.c, import.c, history.c, filesubr.c, edit.c, diff.c, cvsrc.c, commit.c, checkout.c, admin.c, add.c, filesubr.c, mac_filesubr.c, getopt1.c, getopt.c, filesubr.c, diff3.c, diff.c, getopt1.c, getopt.c
  • ARGV0_NOT_PROGRAM_NAME : config.h
  • argvconcat() : misc.h, misc.c
  • argvp : diff3.c, diff.c
  • AS_AFPDIRID : apsingle.h
  • AS_AFPDIRID_BIT : apsingle.h
  • AS_AFPINFO : apsingle.h
  • AS_AFPINFO_BIT : apsingle.h
  • AS_AFPNAME : apsingle.h
  • AS_AFPNAME_BIT : apsingle.h
  • AS_COMMENT : apsingle.h
  • AS_COMMENT_BIT : apsingle.h
  • AS_DATA : apsingle.h
  • AS_DATA_BIT : apsingle.h
  • AS_DEFAULT_CREATOR : apsingle.h
  • AS_DEFAULT_TYPE : apsingle.h
  • AS_FILEDATES : apsingle.h
  • AS_FILEDATES_BIT : apsingle.h
  • AS_FINDERINFO : apsingle.h
  • AS_FINDERINFO_BIT : apsingle.h
  • AS_ICONBW : apsingle.h
  • AS_ICONBW_BIT : apsingle.h
  • AS_ICONCOLOR : apsingle.h
  • AS_ICONCOLOR_BIT : apsingle.h
  • AS_MACINFO : apsingle.h
  • AS_MACINFO_BIT : apsingle.h
  • AS_MAGIC_NUM : apsingle.h
  • AS_MSDOSINFO : apsingle.h
  • AS_MSDOSINFO_BIT : apsingle.h
  • AS_PRODOSINFO : apsingle.h
  • AS_PRODOSINFO_BIT : apsingle.h
  • AS_REALNAME : apsingle.h
  • AS_REALNAME_BIT : apsingle.h
  • AS_RESOURCE : apsingle.h
  • AS_RESOURCE_BIT : apsingle.h
  • ASCII_FLAG : gzio.c
  • asctim() : vmsmunch.c
  • ASCTIMEMAX : utime.c
  • ASEntry : apsingle.c
  • asEntryToMacFile() : apsingle.c
  • ASFileDates : apsingle.c
  • ASFinderInfo : apsingle.c
  • asflag : wrapper.c
  • ASHeader : apsingle.c
  • AskCreatePersistentSettings() : Persistent.h, Persistent.cpp
  • AskYesNo() : AskYesNo.h, AskYesNo.cpp
  • ASMacInfo : apsingle.c
  • Assert : zutil.h
  • ASSERT : CvsTrace.h
  • assert : regex.c
  • AT_STRINGS_BEG : regex.c
  • AT_STRINGS_END : regex.c
  • attic_too : rtag.c
  • attr_read_attempted : fileattr.c
  • ATTRIBUTES : ndir.c
  • attrlist : fileattr.c
  • attrname : fileattr.c
  • attrs : fileattr.c
  • attrs_modified : fileattr.c
  • attrval : fileattr.c
  • AUTH_CLIENT_SUPPORT : options.h
  • AuthenKind : Authen.h
  • AUTO_INITALIZE : dll_garbage.c

- b -
  • b : deflate.c, getdate.c, util.c, context.c
  • back : PseudoButton.cpp
  • backto : history.c
  • backup_file() : cvs.h
  • BAD : infutil.h
  • BAKPREFIX : cvs.h
  • BASE : adler32.c
  • base : strtoul.c, inftrees.c, inffast.c, infcodes.c
  • base_deregister() : cvs.h
  • base_dist : trees.c
  • base_get() : cvs.h
  • BASE_LEADING_CODE_P : regex.c
  • base_length : trees.c
  • base_register() : cvs.h
  • base_walk() : entries.c
  • bb : inftrees.c
  • bd : inftrees.c
  • bdiag : analyze.c
  • beg0 : ifdef.c
  • beg1 : ifdef.c
  • begbuf : regex.c
  • BEGIN : lexer.cc
  • begin_output() : diff.h
  • begline : regex.c
  • BFT_BITMAP : dib.h
  • bi_flush() : trees.c
  • bi_reverse() : trees.c
  • bi_windup() : trees.c
  • biBits : dib.c
  • binary_file_p : io.c
  • bind_and_connect() : rcmd.c
  • BINHEX_STUFF : config.h
  • bintim() : vmsmunch.c
  • binval : vmsmunch.c
  • bits : inftrees.c, inffast.c, infcodes.c
  • bl : inftrees.c
  • BL_CODES : deflate.h
  • bl_count : trees.c
  • bl_order : trees.c
  • blcodes : trees.c
  • block_done : deflate.c
  • block_state : deflate.c
  • BM_ALLOC : dib.h
  • BM_FREE : dib.h
  • BMAX : inftrees.c
  • bNotWin4 : GfxSplitterWnd.cpp
  • boolean : regex.c
  • border : infblock.c
  • bptr : util.c
  • branch : rcs.c, commit.c
  • branch_mode : tag.c, rtag.c
  • briefly_report() : analyze.c
  • BROKEN_READWRITE_CONVERSION : config.h
  • BROWSE_TYPE : CJBrowseEdit.h
  • BrowserGetDirectory() : PromptFiles.h
  • BrowserGetMultiFiles() : PromptFiles.h
  • BT_DIRECTORY : CJBrowseEdit.h
  • BT_FILE : CJBrowseEdit.h
  • BT_POPUPMENU : CJBrowseEdit.h
  • BTN_IMG_INDEX : CJControlBar.h
  • BTREE : infutil.h
  • buckets : io.c
  • buf : trees.c, gzio.c, deflate.c, crc32.c, adler32.c, filesubr.c, utime.c, filesubr.c, subr.c, rcs.c, filesubr.c, mac_filesubr.c, md5.c, filesubr.c, CvsArgs.cpp
  • BUF_PUSH : regex.c
  • BUF_PUSH_2 : regex.c
  • BUF_PUSH_3 : regex.c
  • Buf_size : trees.c
  • BUF_SIZE : cvsgui.c
  • buffer : stat.c, rcs.c, system.c
  • buffer_lcm() : cmpbuf.c
  • BUFFER_SIZE : apsingle.c
  • BUFFWrite() : hqx.c
  • BUFFWriteEnd() : hqx.c
  • BUFLEN : minigzip.c
  • bufsize : subr.c
  • build_bl_tree() : trees.c
  • build_command() : run.c
  • build_dirs_and_chdir() : checkout.c
  • build_entry() : add.c
  • build_one_dir() : checkout.c
  • build_reverse_script() : analyze.c
  • build_script() : analyze.c
  • build_tree() : trees.c
  • BuildCRCTable() : hqx.c
  • BuildIgnoredList() : CvsIgnore.h, CvsIgnore.cpp
  • buildTail() : findtcl.cpp
  • buildWildTail() : findtcl.cpp
  • BUSY_STATE : deflate.h
  • Byte : zlib.h, zconf.h
  • Bytef : zlib.h, zconf.h
  • bytes : subr.c
  • BYTEWIDTH : regex.c

- c -
  • c : inftrees.c, infblock.c
  • C0 : inftrees.c
  • C2 : inftrees.c
  • c2pstrcpy() : cvs_hqx.cpp
  • C4 : inftrees.c
  • cached_rcsbuf : rcs.c
  • call_diff() : rcscmds.c
  • call_diff3() : rcscmds.c
  • call_diff_add_arg() : rcscmds.c
  • call_diff_argc : rcscmds.c
  • call_diff_argc_allocated : rcscmds.c
  • call_diff_argv : rcscmds.c
  • call_diff_error() : rcscmds.c
  • call_diff_file_callbacks : rcscmds.c
  • call_diff_flush_output() : rcscmds.c
  • call_diff_setup() : rcscmds.c
  • call_diff_write_output() : rcscmds.c
  • call_diff_write_stdout() : rcscmds.c
  • callback_proc : modules.c
  • CALLBACKPROC : cvs.h
  • callbacks : diff3.c, diff.h
  • callbacks_arg : diff3.c, diff.c
  • callerdat : recurse.c, rcs.c
  • calloc : system.h, sighandle.c, dll_garbage.h
  • CALLPROC : cvs.h
  • callproc : parseinfo.c
  • CarbonCompatCloseLibrary() : TclGlue.mac.h
  • CarbonCompatLoadLibrary() : TclGlue.mac.h
  • cat_module() : cvs.h
  • CATCH_ALL : PythonMacros.h
  • CATCH_EXCEPTIONS : CvsCoworker.cpp
  • cBOB : CvsString.cpp
  • CBOLD : CTCP2Parse.cpp
  • cbQuanta : CvsString.cpp
  • CBRS_GRIPPER : CJToolBarBase.h
  • CCOLOR : CTCP2Parse.cpp
  • CCTCP2 : CTCP2Parse.cpp
  • cEOB : CvsString.cpp
  • CG_IDP_FILE_CORRUPT : resource.h
  • CG_IDS_DIDYOUKNOW : resource.h
  • CG_IDS_FILE_ABSENT : resource.h
  • CG_IDS_TIPOFTHEDAY : resource.h
  • CG_IDS_TIPOFTHEDAYHELP : resource.h
  • CG_IDS_TIPOFTHEDAYMENU : resource.h
  • CHANGE : diff3.c
  • change_letter() : diff.h
  • CHANGE_RTYPE : vmsmunch.h
  • CHANGED : diff.h
  • changes : logmsg.c
  • CHAR_BIT : system.h
  • CHAR_CLASS_MAX_LENGTH : regex.c
  • CHAR_HEAD_P : regex.c
  • CHAR_SET_SIZE : regex.c
  • charf : zlib.h, zconf.h
  • charset : regex.c
  • CHARSET_BITMAP_SIZE : regex.c
  • CHARSET_LOOKUP_BITMAP : regex.c
  • CHARSET_LOOKUP_RANGE_TABLE : regex.c
  • CHARSET_LOOKUP_RANGE_TABLE_RAW : regex.c
  • charset_not : regex.c
  • CHARSET_RANGE_TABLE : regex.c
  • CHARSET_RANGE_TABLE_END : regex.c
  • CHARSET_RANGE_TABLE_EXISTS_P : regex.c
  • chdir : config.h
  • check_direntproc() : commit.c
  • check_entries() : cvs.h
  • CHECK_ERR : example.c
  • check_fileproc() : tag.c, rtag.c, commit.c
  • check_filesdoneproc() : tag.c, rtag.c, commit.c
  • check_func : zutil.h
  • check_header() : gzio.c
  • check_match : deflate.c
  • check_numeric() : cvs.h
  • check_output() : diff3.c, diff.c
  • check_uptodate : tag.c
  • checkaddfile() : commit.c
  • checkadm : find_names.c
  • CheckBuffer() : CvsString.cpp
  • Checkin() : cvs.h, checkin.c
  • CheckinFiles() : CVS_Coworker_i.h, cvs_coworker.h
  • checkmagic_proc() : rcs.c
  • checkout() : cvs.h, checkout.c
  • CHECKOUT : cvs.h
  • checkout_file() : update.c, mkmodules.c
  • checkout_proc() : checkout.c
  • checkout_prune_dirs : checkout.c
  • checkout_usage : checkout.c
  • CheckoutFiles() : CVS_Coworker_i.h, cvs_coworker.h
  • checkoutlist_contents : mkmodules.c
  • CHILD_BORDER : CJControlBar.h
  • chmod : config.h
  • CHMOD_BROKEN : config.h
  • chr : getopt.c
  • ci_delproc() : commit.c
  • CINTERFACE_PROXY_VTABLE() : CVS_Coworker_p.c
  • CJLibraryDLL : CJLibrary.cpp
  • ck_atoi() : diff.c
  • Classify_File() : cvs.h, classify.c
  • classify_type : cvs.h
  • cleanUpLogMsg() : CvsCommands.h, CvsCommands.cpp
  • CLEAR_HASH : deflate.c
  • clear_lock() : lock.c
  • CLEAR_RANGE_TABLE_WORK_USED : regex.c
  • client_active : root.c, cvs.h
  • CLIENT_ONLY : config.h
  • CLIENT_SERVER_STR : server.h
  • CLIENT_SUPPORT : config.h
  • CListViews : CJTabView.h
  • cloneStr() : CvsEntries.cpp
  • close() : dup2.c
  • close_consoles() : cvsgui.c
  • close_module() : modules.c, cvs.h
  • close_on_exec() : cvs.h, mac_run.c
  • CLOSE_ON_EXEC_MAX : mac_run.c
  • closedir() : ndir.h, ndir.c, ndir.h, ndir.c, ndir.h, dirent.h, dirent.c
  • CloseProject() : CVS_Coworker_i.h, cvs_coworker.h
  • closesocket : rcmd.c
  • closure : update.c, tag.c, status.c, rtag.c, recurse.c, rcs.c, logmsg.c, log.c, lock.c, hash.c, find_names.c, entries.c, commit.c
  • CLSID : CVS_Coworker_i.c
  • clsid : wincvs.cpp
  • CLSID_CvsCoworker : CVS_Coworker_i.h, CVS_Coworker_i.c, cvs_coworker.h
  • CM_ONPUSHPINBUTTON : CJCaptionPopupWnd.h
  • CM_ONPUSHPINCANCEL : CJCaptionPopupWnd.h
  • cmd : entries.c
  • cmd_usage : main.cpp, main.c
  • cmdABOUT : UCvsCommands.h
  • cmdADD : UCvsCommands.h
  • cmdADDB : UCvsCommands.h
  • cmdARRANGE : UCvsCommands.h
  • cmdBROWSER_BAR : UCvsCommands.h
  • cmdCASCADE : UCvsCommands.h
  • cmdCHECKOUT : UCvsCommands.h
  • cmdCLEAR_ALL : UCvsCommands.h
  • cmdCMDLINE : UCvsCommands.h
  • cmdCOMMIT : UCvsCommands.h
  • cmdCONSOLE_BAR : UCvsCommands.h
  • cmdCOPY : UCvsCommands.h
  • cmdCOPYRIGHTS : UCvsCommands.h
  • cmdCREDITS : UCvsCommands.h
  • cmdCUT : UCvsCommands.h
  • cmdCVS : UCvsCommands.h
  • cmdCVSCLIENT : UCvsCommands.h
  • cmdDIFF : UCvsCommands.h
  • cmdEDIT : UCvsCommands.h
  • cmdEDITORS : UCvsCommands.h
  • cmdEDITSEL : UCvsCommands.h
  • cmdEDITSELDEF : UCvsCommands.h
  • cmdEXIT : UCvsCommands.h
  • cmdEXPLORE : UCvsCommands.h
  • cmdFILES_BAR : UCvsCommands.h
  • cmdFIND : UCvsCommands.h
  • cmdFINDER : UCvsCommands.h
  • cmdFONT : UCvsCommands.h
  • cmdGRAPH : UCvsCommands.h
  • cmdIGNORE : UCvsCommands.h
  • CMDIMenuList : CJMDIFrameWnd.h
  • cmdIMPORT : UCvsCommands.h
  • cmdINIT : UCvsCommands.h
  • cmdLOCKF : UCvsCommands.h
  • cmdLOG : UCvsCommands.h
  • cmdLOGIN : UCvsCommands.h
  • cmdLOGOUT : UCvsCommands.h
  • cmdMACROADMIN : UCvsCommands.h
  • cmdMACROADMINEND : UCvsCommands.h
  • cmdMULTI_BAR : UCvsCommands.h
  • cmdname : cvsrc.c
  • cmdOPEN : UCvsCommands.h
  • cmdPASTE : UCvsCommands.h
  • cmdPREFERENCES : UCvsCommands.h
  • cmdPRINT : UCvsCommands.h
  • cmdPRINT_PREVIEW : UCvsCommands.h
  • cmdPRINT_SETUP : UCvsCommands.h
  • cmdQUERYUPDATE : UCvsCommands.h
  • cmdRELEASE : UCvsCommands.h
  • cmdRELOAD : UCvsCommands.h
  • cmdREPEAT : UCvsCommands.h
  • cmdRMV : UCvsCommands.h
  • cmdRTAGBRANCH : UCvsCommands.h
  • cmdRTAGCREATE : UCvsCommands.h
  • cmdRTAGDELETE : UCvsCommands.h
  • cmds : main.c
  • cmdSAVE : UCvsCommands.h
  • cmdSAVE_AS : UCvsCommands.h
  • cmdSAVESETTINGS : UCvsCommands.h
  • cmdSELECT_ALL : UCvsCommands.h
  • cmdSELMACRO : UCvsCommands.h
  • cmdSELMACROEND : UCvsCommands.h
  • cmdSEND_MAIL : UCvsCommands.h
  • cmdSTATUS : UCvsCommands.h
  • cmdSTATUS_BAR : UCvsCommands.h
  • cmdSTOPCVS : UCvsCommands.h
  • cmdTAGBRANCH : UCvsCommands.h
  • cmdTAGDELETE : UCvsCommands.h
  • cmdTAGNEW : UCvsCommands.h
  • cmdTAGS_BAR : UCvsCommands.h
  • cmdTILE_HORZ : UCvsCommands.h
  • cmdTOOLBAR : UCvsCommands.h
  • cmdTRASH : UCvsCommands.h
  • cmdUNDO : UCvsCommands.h
  • cmdUNEDIT : UCvsCommands.h
  • cmdUNLOCKF : UCvsCommands.h
  • cmdUPDATE : UCvsCommands.h
  • cmdUPFOLDER : UCvsCommands.h
  • cmdWATCHERS : UCvsCommands.h
  • cmdWATCHOFF : UCvsCommands.h
  • cmdWATCHON : UCvsCommands.h
  • cmdWORKSPACE : UCvsCommands.h
  • CMP_BUF_SIZE : rcs.c
  • cmp_file_buffer() : rcs.c
  • Code : deflate.h
  • CODES : infutil.h
  • col : logmsg.c
  • COLOR_BLACK : CJControlBar.cpp
  • COLOR_WHITE : CJControlBar.cpp
  • columnsRecursive : BrowseViewColumn.cpp
  • columnsRegular : BrowseViewColumn.cpp
  • combozify() : CommitDlg.h, CommitDlg.cpp
  • command : startserver.c
  • command_name : main.c, cvs.h
  • COMMENT : gzio.c
  • commit() : cvs.h, commit.c
  • commit_direntproc() : commit.c
  • commit_dirleaveproc() : commit.c
  • commit_fileproc() : commit.c
  • commit_filesdoneproc() : commit.c
  • commit_usage : commit.c
  • commitinfo_contents : mkmodules.c
  • comp : hash.c
  • compare_files() : diff.c
  • compare_line_list() : diff3.c
  • compare_names() : dir.c
  • compare_revnums() : cvs.h
  • compareConflict() : UCvsFiles.cpp
  • compareName() : UCvsFiles.cpp
  • compareOption() : UCvsFiles.cpp
  • compareRevs() : UCvsFiles.cpp
  • compareseq() : analyze.c
  • compareStatus() : UCvsFiles.cpp
  • compareTag() : UCvsFiles.cpp
  • CompareTargetDate() : Stat.cpp, win32.c
  • CompatBeginMoveToTrash() : MoveToTrash.h, MoveToTrash.cpp
  • CompatCallLibrary1 : dll_loader.h
  • CompatCallLibrary2 : dll_loader.h
  • CompatCallLibrary3 : dll_loader.h
  • CompatCloseLibrary() : dll_loader.h, dll_loader.c
  • CompatConnectID : dll_loader.h
  • CompatEndMoveToTrash() : MoveToTrash.h, MoveToTrash.cpp
  • CompatFuncArg : dll_loader.h
  • CompatGetAdminOptions() : AdminOptionDlg.h, AdminOptionDlg.cpp
  • CompatGetAnnotate() : AnnotateDlg.h, AnnotateDlg.cpp
  • CompatGetCheckout() : CheckoutDlg.h, CheckoutDlg.cpp
  • CompatGetCommand() : LineCmd.h, LineCmd.cpp
  • CompatGetCommit() : CommitDlg.h, CommitDlg.cpp
  • CompatGetDiff() : DiffDlg.h, DiffDlg.cpp
  • CompatGetEditorMsg() : EditorMonDlg.h, EditorMonDlg.cpp
  • CompatGetGraphOptions() : GraphOptDlg.h, GraphOptDlg.cpp
  • CompatGetImport() : ImportDlg.h, ImportDlg.cpp
  • CompatGetInit() : InitDlg.h, InitDlg.cpp
  • CompatGetLog() : LogDlg.h, LogDlg.cpp
  • CompatGetPassword() : GetPassword.h, GetPassword.cpp
  • CompatGetPrefs() : GetPrefs.h, GetPrefs.cpp
  • CompatGetRelease() : ReleaseDlg.h, ReleaseDlg.cpp
  • CompatGetUpdate() : UpdateDlg.h, UpdateDlg.cpp
  • CompatGetValue() : GetValue.h, GetValue.cpp
  • CompatImportFilter() : ImportFilterDlg.h, ImportFilterDlg.cpp
  • CompatLoadLibrary() : dll_loader.h, dll_loader.c
  • CompatMakeSurePathExists() : MakeSurePathExists.h, MakeSurePathExists.cpp
  • CompatMoveToTrash() : MoveToTrash.h, MoveToTrash.cpp
  • CompatRtagBranch() : RtagDlg.h, RtagDlg.cpp
  • CompatRtagCreate() : RtagDlg.h, RtagDlg.cpp
  • CompatRtagDelete() : RtagDlg.h, RtagDlg.cpp
  • CompatTagBranch() : TagDlg.h, TagDlg.cpp
  • CompatTagCreate() : TagDlg.h, TagDlg.cpp
  • CompatTagDelete() : TagDlg.h, TagDlg.cpp
  • COMPILE_STACK_EMPTY : regex.c
  • COMPILE_STACK_FULL : regex.c
  • COMPILE_STACK_TOP : regex.c
  • compress() : zlib.h, compress.c
  • compress_block() : trees.c
  • compress_func : deflate.c
  • comprLen : example.c
  • computeLR : SortList.h
  • computeNone : SortList.h
  • computeSort : SortList.h
  • comtable : import.c
  • concat() : diff.h
  • config : deflate.c
  • config_contents : mkmodules.c
  • config_string : version.c
  • configuration_table : deflate.c
  • conflictColumn : BrowseViewColumn.cpp
  • conflicts : import.c
  • context : diff.h
  • Convert() : getdate.y, getdate.c
  • convert_apsingle_file() : apsingle.h
  • convert_blocks : system.h
  • convert_file() : macos_filesys.c
  • convert_hqx_file() : cvs_hqx.h, cvs_hqx.cpp
  • convert_iso() : cvs_hqx.h, cvs_hqx.cpp
  • copy_block() : trees.c
  • copy_file() : filesubr.c, cvs.h, filesubr.c, mac_filesubr.c, filesubr.c
  • copy_stringlist() : diff3.c
  • copynum : diff3.c
  • CopyRect() : udraw.h
  • CopyScreenToBitmap() : dib.h, dib.c
  • CopyString() : CvsCoworker.cpp
  • count : diff.c
  • count_delta_actions() : rcs.c
  • cp : logmsg.c
  • CP_MODE_BK : CJColorPicker.h
  • CP_MODE_TEXT : CJColorPicker.h
  • cpdext : inftrees.c
  • cpdist : inftrees.c
  • CPInfo : CJMenu.cpp
  • cplens : inftrees.c
  • cplext : inftrees.c
  • CPN_CLOSEUP : CJColorPopup.h
  • CPN_DROPDOWN : CJColorPopup.h
  • CPN_SELCHANGE : CJColorPopup.h
  • CPN_SELENDCANCEL : CJColorPopup.h
  • CPN_SELENDOK : CJColorPopup.h
  • CPStr : CPStr.h
  • CR : hqx.c
  • crc32() : zlib.h, crc32.c
  • crc_byte() : hqx.c
  • crc_run() : hqx.c
  • crc_table : crc32.c
  • CRCRead() : hqx.c
  • CRCReadEnd() : hqx.c
  • CRCReadInit() : hqx.c
  • crctab : hqx.c
  • CRCWrite() : hqx.c
  • CRCWriteEnd() : hqx.c
  • CRCWriteInit() : hqx.c
  • creat : config.h
  • Create_Admin() : cvs.h, create_adm.c
  • create_diff3_block() : diff3.c
  • Create_Root() : cvs.h
  • CreateDIB() : dib.h, dib.c
  • CreateFolder() : MakeSurePathExists.h, MakeSurePathExists.cpp
  • CreateMainMenubar() : UCvsMenubar.h, UCvsMenubar.cpp
  • CreateMainToolbar() : UCvsToolbar.h, UCvsToolbar.cpp
  • CREV : CTCP2Parse.cpp
  • CSTOP : CTCP2Parse.cpp
  • CStr : CPStr.h
  • ct_data : deflate.h
  • CTabList : CJFlatTabCtrl.h
  • CTabViews : CJTabCtrlBar.h
  • CTCP2_TOGGLE : CTCP2Parse.cpp
  • CTRL_STROKE : umenu.cpp
  • CTRLALT_STROKE : umenu.cpp
  • CTV_ITEM : CJTabView.h
  • ctx : md5.c
  • Ctype : cvs.h
  • CTYPE_DOMAIN : system.h
  • CUNDR : CTCP2Parse.cpp
  • cur_match : deflate.c
  • CurDir : main.c, cvs.h
  • current_cvs_process : cvsgui_process.cpp
  • current_depth : util.c
  • current_name1 : util.c
  • current_root : main.c, cvs.h
  • current_write_buffer : cvsgui_process.cpp
  • current_write_buffer_index : cvsgui_process.cpp
  • currentLineNumber : lexer.cc, common.h
  • CustGetByKey() : CustomizeMenus.h, CustomizeMenus.cpp
  • CUSTOM_BOX_VALUE : CJColorPopup.cpp
  • CustomizeMenus() : wincvs_winutil.h, wincvs_winutil.cpp
  • CVS_ACCESS : config.h, system.h
  • CVS_ADMIN_GROUP : options.h
  • CVS_CHANGES : hqx.c
  • CVS_CHDIR : config.h, system.h, config.h
  • CVS_CHMOD : config.h
  • CVS_CMD_IGNORE_ADMROOT : cvs.h
  • CVS_CMD_MODIFIES_REPOSITORY : cvs.h
  • CVS_CMD_USES_WORK_DIR : cvs.h
  • cvs_coworker_ProxyFileInfo : CVS_Coworker_p.c
  • CVS_CREAT : config.h, system.h
  • CVS_E_FAILED : CvsCoworkerErrors.h
  • CVS_E_FAILED_CHECKIN_DISALLOWED : CvsCoworkerErrors.h
  • CVS_E_FAILED_CHECKIN_FILES : CvsCoworkerErrors.h
  • CVS_E_FAILED_CHECKIN_NEED_UPDATE : CvsCoworkerErrors.h
  • CVS_E_FAILED_CHECKIN_NOT_IN_CVS : CvsCoworkerErrors.h
  • CVS_E_FAILED_CHECKOUT_DISALLOWED : CvsCoworkerErrors.h
  • CVS_E_FAILED_CHECKOUT_FILES : CvsCoworkerErrors.h
  • CVS_E_FAILED_CHECKOUT_NOT_IN_CVS : CvsCoworkerErrors.h
  • CVS_E_FAILED_CLOSE_PROJECT : CvsCoworkerErrors.h
  • CVS_E_FAILED_OPEN_BAD_PATH : CvsCoworkerErrors.h
  • CVS_E_FAILED_OPEN_CREATE : CvsCoworkerErrors.h
  • CVS_E_FAILED_OPEN_DISALLOWED : CvsCoworkerErrors.h
  • CVS_E_FAILED_OPEN_INVALID_USER : CvsCoworkerErrors.h
  • CVS_E_FAILED_OPEN_PROJECT : CvsCoworkerErrors.h
  • CVS_E_FAILED_PROJECT_INVALID : CvsCoworkerErrors.h
  • CVS_E_FAILED_UPDATE_DISALLOWED : CvsCoworkerErrors.h
  • CVS_E_FAILED_UPDATE_FILES : CvsCoworkerErrors.h
  • CVS_E_FAILED_UPDATE_NOT_IN_CVS : CvsCoworkerErrors.h
  • cvs_err() : AppConsole.h, AppConsole.cpp
  • cvs_errstr() : AppConsole.h, AppConsole.cpp
  • CVS_EXTERN_C : AppGlue.cpp
  • cvs_flusherr() : cvs.h
  • cvs_flushout() : cvs.h
  • CVS_FNMATCH : system.h, config.h
  • CVS_FOPEN : config.h, system.h
  • CVS_LSTAT : config.h, system.h
  • cvs_max : filesubr.c
  • CVS_MKDIR : config.h, system.h
  • CVS_OPEN : config.h, system.h
  • CVS_OPENDIR : config.h, system.h
  • cvs_out() : AppConsole.h, AppConsole.cpp
  • cvs_outerr() : cvs.h
  • cvs_output() : server.c, cvs.h
  • cvs_output_binary() : cvs.h
  • cvs_output_tagged() : cvs.h
  • cvs_outstr() : AppConsole.h, AppConsole.cpp
  • cvs_process_close() : cvsgui_process.cpp
  • cvs_process_destroy() : cvsgui_process.cpp
  • cvs_process_flush() : cvsgui_process.cpp
  • cvs_process_give_time() : cvsgui_process.h, cvsgui_process.cpp
  • cvs_process_handle_message() : cvsgui_process.cpp
  • cvs_process_init() : cvsgui_process.h, cvsgui_process.cpp
  • cvs_process_is_active() : cvsgui_process.h, cvsgui_process.cpp
  • cvs_process_kill() : cvsgui_process.h, cvsgui_process.cpp
  • cvs_process_new() : cvsgui_process.cpp
  • cvs_process_open() : cvsgui_process.h, cvsgui_process.cpp
  • cvs_process_pop() : cvsgui_process.cpp
  • cvs_process_push() : cvsgui_process.cpp
  • cvs_process_recv_message() : cvsgui_process.cpp
  • cvs_process_stack : cvsgui_process.cpp
  • cvs_process_write() : cvsgui_process.cpp
  • CVS_RENAME : config.h, system.h
  • CVS_RMDIR : config.h, system.h
  • cvs_server : startserver.c
  • CVS_STAT : config.h, system.h, config.h
  • cvs_temp_name() : filesubr.c, cvs.h, filesubr.c, diff3.c
  • cvs_uint32 : md5.h
  • CVS_UNLINK : config.h, system.h
  • CVSADM : cvs.h
  • CVSADM_BASE : cvs.h
  • CVSADM_BASEREV : cvs.h
  • CVSADM_BASEREVTMP : cvs.h
  • CVSADM_CIPROG : cvs.h
  • CVSADM_ENT : cvs.h
  • CVSADM_ENTBAK : cvs.h
  • CVSADM_ENTLOG : cvs.h
  • CVSADM_ENTSTAT : cvs.h
  • CVSADM_NOTIFY : cvs.h
  • CVSADM_NOTIFYTMP : cvs.h
  • CVSADM_REP : cvs.h
  • CVSADM_ROOT : cvs.h
  • CVSADM_TAG : cvs.h
  • CVSADM_TEMPLATE : cvs.h
  • CVSADM_UPROG : cvs.h
  • cvsadmin_root : cvs.h
  • CvsAlert() : CvsAlert.h, CvsAlert.cpp
  • CVSATTIC : cvs.h
  • CVSBRANCH : cvs.h
  • CvsCmdAddBinaryFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdAddFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdAddFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdAnnotateFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdCancelChangesFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdCheckoutModule() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdCommitFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdCommitFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdDiffFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdDiffFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdEditFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdEditFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdEditorsFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdEditorsFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdImportModule() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdInit() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdLine() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdLockFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdLockFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdLogFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdLogFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdLogin() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdLogout() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdMacrosAdmin() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdReleaseFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdRemoveFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdRtagBranch() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdRtagCreate() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdRtagDelete() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdStatusFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdStatusFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdTagBranchFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdTagBranchFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdTagCreateFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdTagCreateFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdTagDeleteFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdTagDeleteFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdUneditFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdUneditFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdUnlockFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdUnlockFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdUpdateFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdUpdateFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdWatchersFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdWatchersFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdWatchOffFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdWatchOffFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdWatchOnFiles() : CvsCommands.h, CvsCommands.cpp
  • CvsCmdWatchOnFolder() : CvsCommands.h, CvsCommands.cpp
  • CvsCommand : CVS_Coworker_i.h, cvs_coworker.h, CVS_Coworker_i.h, cvs_coworker.h
  • cvsCommandAdd : CVS_Coworker_i.h, cvs_coworker.h
  • cvsCommandCheckin : CVS_Coworker_i.h, cvs_coworker.h
  • cvsCommandCheckout : CVS_Coworker_i.h, cvs_coworker.h
  • cvsCommandDiff : CVS_Coworker_i.h, cvs_coworker.h
  • cvsCommandHistory : CVS_Coworker_i.h, cvs_coworker.h
  • cvsCommandOptions : CVS_Coworker_i.h, cvs_coworker.h
  • cvsCommandProperties : CVS_Coworker_i.h, cvs_coworker.h
  • cvsCommandRemove : CVS_Coworker_i.h, cvs_coworker.h
  • cvsCommandRename : CVS_Coworker_i.h, cvs_coworker.h
  • cvsCommandUncheckout : CVS_Coworker_i.h, cvs_coworker.h
  • cvsCommandUpdate : CVS_Coworker_i.h, cvs_coworker.h
  • CvsCoworker : CVS_Coworker_i.h, cvs_coworker.h
  • CVSDOTIGNORE : cvs.h
  • CVSDOTWRAPPER : cvs.h
  • CVSEDITPREFIX : cvs.h
  • CVSEDITPREFIXLEN : cvs.h
  • CVSEXT_LOG : cvs.h
  • cvsgui_GetCvsEntries() : PythonGlue.cpp
  • cvsgui_GetHistoryAsXML() : PythonGlue.cpp
  • cvsgui_GetMainMenuWidget() : PythonGlue.cpp
  • cvsgui_GetSelection() : PythonGlue.cpp
  • cvsgui_GetTopMacroAdminMenu() : PythonGlue.cpp
  • cvsgui_GetTopMacroSelectionMenu() : PythonGlue.cpp
  • cvsgui_LaunchBrowser() : PythonGlue.cpp
  • cvsgui_LaunchTclMacro() : PythonGlue.cpp
  • cvsgui_methods : PythonGlue.cpp
  • cvsgui_PromptEditMessage() : PythonGlue.cpp
  • cvsgui_PromptMessage() : PythonGlue.cpp
  • cvsgui_RunCvs() : PythonGlue.cpp
  • cvsgui_write() : PythonGlue.cpp
  • cvsguiglue_exit() : cvsgui.h, cvsgui.c
  • cvsguiglue_flushconsole() : cvsgui.h, cvsgui.c
  • cvsguiglue_getenv() : cvsgui.h, cvsgui.c
  • cvsguiglue_getpass() : cvsgui.h, cvsgui.c
  • cvsguiglue_main() : cvsgui.h
  • CVSLCK : cvs.h
  • CVSLCKAGE : cvs.h
  • CVSLCKSLEEP : cvs.h
  • cvslog() : log.c, cvs.h
  • CvsLogGraph() : CvsLog.h, CvsLog.cpp
  • CvsLogOutput() : LogParse.h, LogParse.cpp
  • CvsLogParse() : CvsLog.h, CvsLog.cpp, LogParse.h, LogParse.cpp
  • CvsLogReset() : CvsLog.h, CvsLog.cpp
  • CVSmethod : cvs.h
  • CVSMODULE_OPTS : modules.c
  • CVSMODULE_SPEC : modules.c
  • CVSNTDOS_BUILD : version_no.h
  • CVSNTDOS_FILE_MAJOR : version_no.h
  • CVSNTDOS_FILE_MINOR : version_no.h
  • CVSNTDOS_FILE_PATCHLEVEL : version_no.h
  • CVSNTDOS_FILEVERSION : version_fu.h
  • CVSNTDOS_FILEVERSION_STRING : version_fu.h
  • CVSNULLREPOS : cvs.h
  • CvsOption : CVS_Coworker_i.h, cvs_coworker.h, CVS_Coworker_i.h, cvs_coworker.h
  • cvsOptionCompareChecksum : CVS_Coworker_i.h, cvs_coworker.h
  • cvsOptionCompareContents : CVS_Coworker_i.h, cvs_coworker.h
  • cvsOptionCompareTimestamp : CVS_Coworker_i.h, cvs_coworker.h
  • CVSPREFIX : cvs.h
  • CvsProcess : cvsgui_process.h
  • cvsrc : cvsrc.c
  • CVSRC_FILENAME : cvsrc.c
  • CVSREAD_DFLT : cvs.h
  • CVSREAD_ENV : cvs.h
  • cvsremove() : remove.c, cvs.h
  • CVSREP : cvs.h
  • CVSREP_FILEATTR : fileattr.h
  • CVSRFL : cvs.h
  • CVSRFLPAT : cvs.h
  • CVSroot_cmdline : cvs.h
  • CVSROOT_DFLT : cvs.h
  • CVSroot_directory : root.c, cvs.h
  • CVSROOT_ENV : cvs.h
  • CVSroot_hostname : root.c, cvs.h
  • CVSroot_method : root.c, cvs.h
  • CVSroot_original : root.c, cvs.h
  • CVSroot_port : root.c, cvs.h
  • CVSroot_proxy : root.c, cvs.h
  • CVSroot_proxy_port : root.c, cvs.h
  • CVSroot_username : root.c, cvs.h
  • CVSROOTADM : cvs.h
  • CVSROOTADM_CHECKOUTLIST : cvs.h
  • CVSROOTADM_COMMITINFO : cvs.h
  • CVSROOTADM_CONFIG : cvs.h
  • CVSROOTADM_EDITINFO : cvs.h
  • CVSROOTADM_HISTORY : cvs.h
  • CVSROOTADM_IGNORE : cvs.h
  • CVSROOTADM_LOGINFO : cvs.h
  • CVSROOTADM_MODULES : cvs.h
  • CVSROOTADM_NOTIFY : cvs.h
  • CVSROOTADM_PASSWD : cvs.h
  • CVSROOTADM_RCSINFO : cvs.h
  • CVSROOTADM_READERS : cvs.h
  • CVSROOTADM_TAGINFO : cvs.h
  • CVSROOTADM_USERS : cvs.h
  • CVSROOTADM_VALTAGS : cvs.h
  • CVSROOTADM_VERIFYMSG : cvs.h
  • CVSROOTADM_WRAPPER : cvs.h
  • CVSROOTADM_WRITERS : cvs.h
  • cvsstatus() : status.c, cvs.h
  • cvstag() : tag.c, cvs.h
  • cvsumask : main.c, cvs.h
  • CVSUMASK_ENV : cvs.h
  • CVSWFL : cvs.h
  • cvswrappers_contents : mkmodules.c
  • cvswrite : main.c, cvs.h
  • CX_BORDER : GfxSplitterWnd.cpp
  • CX_BORDER_GRIPPER : CJToolBarBase.cpp
  • CX_GRIPPER : CJToolBarBase.cpp
  • CX_OVERLAP : CJToolBar.cpp
  • CY_BORDER : GfxSplitterWnd.cpp
  • CY_BORDER_GRIPPER : CJToolBarBase.cpp
  • CY_GRIPPER : CJToolBarBase.cpp

- d -
  • d : inftrees.c, infblock.c, rcs.c, modules.c
  • D3_TYPE : diff3.c
  • d_code : trees.c
  • D_CODES : deflate.h
  • D_HIGH_MAPLINE : diff3.c
  • D_HIGHLINE : diff3.c
  • D_LENARRAY : diff3.c
  • D_LINEARRAY : diff3.c
  • D_LOW_MAPLINE : diff3.c
  • D_LOWLINE : diff3.c
  • D_NEXT : diff3.c
  • D_NUMLINES : diff3.c
  • D_RELLEN : diff3.c
  • D_RELNUM : diff3.c
  • Dad : deflate.h
  • data : hardlink.c, fileattr.c
  • DATA_TYPE : CJSortClass.h
  • datap : rcs.c
  • date : vers_ts.c, update.c, tag.c, rtag.c, rcs.c, entries.c, create_adm.c, classify.c, checkout.c
  • date1 : patch.c
  • date2 : rcs.c, patch.c
  • date_from_time_t() : cvs.h
  • date_rev1 : update.c
  • date_rev2 : update.c
  • date_to_internet() : cvs.h
  • dateColumn : BrowseViewColumn.cpp
  • DATEFORM : rcs.h
  • datep : entries.c
  • Day : getdate.c
  • DayNumber : getdate.c
  • DayOrdinal : getdate.c
  • db : diff3.c
  • dbgOnly : findtcl.cpp
  • DBLKSIZ : mkmodules.c
  • dcodes : trees.c
  • DD_BMAP : PseudoButton.h
  • DD_END : PseudoButton.h
  • DD_PIXMAP : PseudoButton.h
  • DD_RGB : PseudoButton.h
  • DDBtoDIB() : dib.h
  • DDD_NONE : umain.h
  • DDV_CheckCVSROOT() : wincvs.h, wincvs.cpp
  • DDV_CJMinMaxDateTime() : CJDateTimeCtrl.h, CJDateTimeCtrl.cpp
  • DDV_CJMinMaxMonth() : CJDateTimeCtrl.h, CJDateTimeCtrl.cpp
  • DDV_MinChars() : wincvs.h, wincvs.cpp
  • DDV_NONE : umain.h
  • DDX_CJColorPicker() : CJColorPicker.h, CJColorPicker.cpp
  • DDX_CJDateTimeCtrl() : CJDateTimeCtrl.h, CJDateTimeCtrl.cpp
  • DDX_CJMonthCalCtrl() : CJDateTimeCtrl.h, CJDateTimeCtrl.cpp
  • DDX_ComboMString() : wincvs.h, wincvs.cpp
  • DDX_OleDateTime() : CJMaskEdit.h, CJMaskEdit.cpp
  • DEBUG_MESSAGE : wincvs.cpp
  • DEBUG_POP : regex.c
  • DEBUG_PRINT1 : regex.c
  • DEBUG_PRINT2 : regex.c
  • DEBUG_PRINT3 : regex.c
  • DEBUG_PRINT4 : regex.c
  • DEBUG_PRINT_COMPILED_PATTERN : regex.c
  • DEBUG_PRINT_DOUBLE_STRING : regex.c
  • DEBUG_PUSH : regex.c
  • debug_script() : diff.h
  • DEBUG_STATEMENT : regex.c
  • DECLC : TclGlue.cpp
  • DECLSPEC_UUID() : CVS_Coworker_i.h, cvs_coworker.h
  • decode_file() : macos_filesys.c
  • decodeAppleSingle() : apsingle.h, apsingle.c
  • decodeComment() : apsingle.c
  • decodeCVS() : AppGlue.mac.h, AppGlue.mac.cpp
  • decodeDataFork() : apsingle.c
  • decodeFileDates() : apsingle.c
  • decodeFinderInfo() : apsingle.c
  • decodeMacInfo() : apsingle.c
  • decodeRealName() : apsingle.c
  • decodeResourceFork() : apsingle.c
  • deep_remove_dir() : filesubr.c
  • DEF_MEM_LEVEL : zutil.h
  • def_status : modules.c
  • DEF_WBITS : zutil.h
  • DEFAULT_BOX_VALUE : CJColorPopup.cpp
  • default_branch : log.c
  • DEFAULT_WIDTH : diff.c
  • DeferClientPos() : GfxSplitterWnd.cpp
  • deflate() : zlib.h
  • deflate_copyright : deflate.c
  • deflate_fast() : deflate.c
  • deflate_slow() : deflate.c
  • deflate_state : deflate.h
  • deflate_stored() : deflate.c
  • deflateCopy() : zlib.h
  • deflateEnd() : zlib.h
  • deflateInit : zlib.h
  • deflateInit2 : zlib.h
  • deflateInit2_() : zlib.h
  • deflateInit_() : zlib.h, deflate.c
  • deflateParams() : zlib.h
  • deflateReset() : zlib.h
  • deflateSetDictionary() : zlib.h
  • DELETE : diff3.c
  • delete_flag : tag.c, rtag.c
  • deleted : analyze.c
  • deletes : util.c
  • Deltatext : rcs.h
  • delvers : rcs.c
  • depth : util.c, dir.c, diff.c, analyze.c
  • desc : trees.c
  • desclen : import.c
  • desctext : import.c
  • dest : savecwd.c
  • destLen : uncompr.c, compress.c
  • destroy() : gzio.c
  • determineEncodingPolicy() : cvs_hqx.cpp
  • DEVNULL : config.h, cvs.h, config.h
  • diag() : analyze.c
  • DIAGNOSTIC : popen.c
  • DIB_HEADER_MARKER : dib.h
  • DibCopyPalette() : dib.h, dib.c
  • DibGetPaletteSize() : dib.h, dib.c
  • DibNumColors() : dib.h, dib.c
  • DIBToBitmap() : dib.h, dib.c
  • dictId : example.c
  • dictionary : inflate.c, example.c, deflate.c
  • dictLength : inflate.c, deflate.c
  • diff : cvs.h, diff3.c
  • DIFF3_ABORT : diff3.c
  • diff3_abort_buf : diff3.c
  • diff3_fatal() : diff3.c
  • diff3_perror_with_exit() : diff3.c
  • diff3_run() : diffrun.h, diff3.c
  • DIFF_1ST : diff3.c
  • diff_2_files() : diff.h
  • DIFF_2ND : diff3.c
  • DIFF_3RD : diff3.c
  • DIFF_ABORT : diff.h
  • diff_abort_buf : diff.h
  • DIFF_ADDED : diff.c
  • DIFF_ALL : diff3.c
  • diff_contents : diff3.c
  • diff_date1 : diff.c
  • diff_date2 : diff.c
  • DIFF_DIFFERENT : diff.c
  • diff_dirleaveproc() : diff.c
  • diff_dirproc() : diff.c
  • diff_dirs() : diff.h
  • diff_error() : diff3.c, diff.h
  • DIFF_ERROR : diff.c
  • diff_errors : diff.c
  • diff_exec() : cvs.h
  • diff_execv() : cvs.h
  • diff_file : diff.c
  • diff_file_nodiff() : diff.c
  • diff_fileproc() : diff.c
  • diff_filesdoneproc() : diff.c
  • diff_mark_errors() : diff.c
  • diff_program_name : diff3.c, diff.h
  • DIFF_REMOVED : diff.c
  • diff_rev1 : diff.c
  • diff_rev2 : diff.c
  • diff_run() : diffrun.h, diff.c
  • DIFF_SAME : diff.c
  • diff_type : diff3.c
  • diff_usage : diff.c
  • diff_version_string : version.c, diff3.c, diff.h
  • diffbuf : rcs.c
  • DiffFile() : CVS_Coworker_i.h, cvs_coworker.h
  • difflen : rcs.c
  • DIFFPARAMS : diffrun.h
  • difftm() : getdate.y, getdate.c
  • DIR : ndir.h, dirent.h, ndir.h, dir.h
  • dir : update.c, tag.c, status.c, rtag.c, remove.c, recurse.c, patch.c, log.c, import.c, entries.c, diff.c, commit.c, admin.c, dir.h
  • dir1 : diff.c
  • dir_file_pathname() : diff.h
  • dir_ign_current : ignore.c
  • dir_ign_max : ignore.c
  • dir_sort() : dir.c
  • dir_start_file : diff.h
  • DIRBLKSIZ : ndir.h
  • dirdata : dir.c
  • directory_file_name() : filutils.h
  • dirent : system.h
  • DIRENT_INCR : dirent.c
  • direnter_type : cvs.h
  • DIRENTPROC : cvs.h
  • direntproc : recurse.c
  • DIRLEAVEPROC : cvs.h
  • dirleaveproc : recurse.c
  • dirlist : recurse.c
  • dirpath : checkout.c
  • DIRS : hash.h
  • DIRTY_MODDATE : config.h
  • discard_confusing_lines() : analyze.c
  • disposeStr() : CvsEntries.cpp
  • dist : trees.c
  • dist_code : trees.c
  • dllglue_consoleerr() : dll_glue.h, dll_glue.c
  • dllglue_consolein() : dll_glue.h, dll_glue.c
  • dllglue_consolein_func : dll_process.h
  • dllglue_consoleout() : dll_glue.h, dll_glue.c
  • dllglue_consoleout_func : dll_process.h
  • dllglue_decode_file() : dll_glue.h, dll_glue.c
  • dllglue_dispatchevent() : dll_glue.h, dll_glue.c
  • dllglue_exit() : dll_glue.h, dll_glue.c
  • dllglue_flushconsole() : dll_glue.h, dll_glue.c
  • dllglue_getenv() : dll_glue.h, dll_glue.c
  • dllglue_getenv_func : dll_process.h
  • dllglue_main() : dll_glue.h, dll_glue.c
  • dllglue_main_func : dll_process.h
  • dllglue_setconsoleerr() : dll_glue.h, dll_glue.c
  • dllglue_setconsolein() : dll_glue.h, dll_glue.c
  • dllglue_setconsoleout() : dll_glue.h, dll_glue.c
  • dllglue_seteventdispatch() : dll_glue.h, dll_glue.c
  • dllglue_setgetenv() : dll_glue.h, dll_glue.c
  • dllglue_setglue_func : dll_process.h
  • DllMain() : CJLibrary.cpp
  • dmode : mkdir.c
  • DO1 : crc32.c, adler32.c
  • DO16 : adler32.c
  • DO2 : crc32.c, adler32.c
  • DO4 : crc32.c, adler32.c
  • DO8 : crc32.c, adler32.c
  • do_branches() : rcs.c
  • do_dir_proc() : recurse.c
  • do_editor() : cvs.h
  • do_file_proc() : recurse.c
  • do_locks() : rcs.c
  • do_module() : cvs.h
  • DO_NOT_LOCK_DIRTY : config.h
  • do_recursion() : recurse.c
  • do_symbols() : rcs.c
  • do_verify() : cvs.h
  • DONE : infutil.h
  • DONT_USE_PATCH : config.h
  • dos : Stat.cpp, win32.c
  • dosrcs : recurse.c
  • dotemplate : create_adm.c
  • dotlines() : diff3.c
  • downcase() : misc.h, misc.c
  • DrawNode() : GraphView.cpp, UCvsGraph.cpp
  • DrawOctangle() : GraphView.cpp
  • DRY : infutil.h
  • ds : modules.c
  • dst : filutils.c
  • DSTcorrect() : getdate.y, getdate.c
  • DSTmaybe : getdate.c
  • DSTMODE : getdate.c
  • DSTmode : getdate.c
  • DSToff : getdate.c
  • DSTon : getdate.c
  • DT_DATETIME : CJSortClass.h
  • DT_DEC : CJSortClass.h
  • DT_INT : CJSortClass.h
  • DT_STRING : CJSortClass.h
  • dtree : trees.c
  • DTREE : infutil.h
  • Dtype : cvs.h
  • dummy_failure_jump : regex.c
  • dummy_fileproc() : edit.c
  • DUMPBITS : infutil.h
  • dup2() : dup2.c
  • duplicate : regex.c
  • dwSizeBarMap : CJControlBar.h
  • DYN_LIST : dll_garbage.c
  • DYN_TREES : zutil.h

- e -
  • e : inftrees.c
  • EACCES : config.h
  • ECHO : lexer.cc
  • EchoOff() : getpass.c
  • EchoOn() : getpass.c
  • edit() : edit.c, cvs.h
  • edit_fileproc() : edit.c
  • editinfo_contents : mkmodules.c
  • editinfo_editor : logmsg.c
  • editinfo_proc() : logmsg.c
  • Editor : main.c, cvs.h
  • editor : edit.c
  • EDITOR1_ENV : cvs.h
  • EDITOR2_ENV : cvs.h
  • EDITOR3_ENV : cvs.h
  • EDITOR_DFLT : options.h
  • editors() : cvs.h
  • editors_fileproc() : edit.c
  • EditStreamCallBack() : wincvsDoc.cpp
  • edscript : diff3.c
  • eEncodeAppleSingle : cvs_hqx.cpp
  • eEncodeDefault : cvs_hqx.cpp
  • eEncodeHQX : cvs_hqx.cpp
  • eEncodePlainBinary : cvs_hqx.cpp
  • EGCS_CONST : ustr.h
  • elem2 : hash.c
  • empty_file : diff.c
  • empty_files : diff.c
  • emptydir_name() : cvs.h
  • enable_dirty : cvs.h
  • encodeAppleSingle() : apsingle.h, apsingle.c
  • encodeComment() : apsingle.c
  • encodeDataFork() : apsingle.c
  • encodeFileDates() : apsingle.c
  • encodeFinderInfo() : apsingle.c
  • encodeMacInfo() : apsingle.c
  • encodeRealName() : apsingle.c
  • encodeResourceFork() : apsingle.c
  • encodingPolicy : cvs_hqx.cpp
  • END : diff3.c
  • end0 : ifdef.c
  • end1 : ifdef.c
  • END_BLOCK : trees.c
  • END_CATCH_ALL : PythonMacros.h
  • endbuf : regex.c
  • endchar : ifdef.c
  • endgrent() : pwd.h, pwd.c, pwd.h, pwd.c
  • endline : regex.c
  • endpwent() : pwd.h, pwd.c, pwd.h, pwd.c
  • ENT_FILE : cvs.h, CvsEntries.h
  • ENT_SUBDIR : cvs.h, CvsEntries.h
  • ent_type : cvs.h, CvsEntries.h
  • entdata : entries.c
  • entfile : entries.c
  • entfilename : entries.c
  • entire_new_file_flag : diff.h
  • Entnode : cvs.h
  • Entnode_Create() : entries.c
  • Entnode_Destroy() : entries.c
  • entries : watch.c, update.c, tag.c, status.c, rtag.c, remove.c, patch.c, log.c, lock.c, ignore.c, find_names.c, edit.c, diff.c, commit.c, admin.c, add.c
  • ENTRIES : hash.h
  • Entries_Close() : cvs.h
  • Entries_Open() : cvs.h, CvsEntries.h, CvsEntries.cpp
  • Entries_SetMissing() : CvsEntries.h, CvsEntries.cpp
  • Entries_SetVisited() : CvsEntries.h, CvsEntries.cpp
  • ENTRY : strerror.c
  • entsep : fileattr.c
  • ENUMS_CAN_BE_TROUBLE : config.h
  • EOB_ACT_CONTINUE_SCAN : lexer.cc
  • EOB_ACT_END_OF_FILE : lexer.cc
  • EOB_ACT_LAST_MATCH : lexer.cc
  • eof : trees.c
  • epi_i : umain.h
  • epi_ii : umain.h
  • epi_iVP : umain.h
  • epi_V : umain.h
  • epi_VP : umain.h
  • epNone : umain.h
  • EPOCH : getdate.c, getdate.y, getdate.c
  • epV_i : umain.h
  • epV_I : umain.h
  • epV_ii : umain.h
  • epV_iii : umain.h
  • epV_iiVP : umain.h
  • epV_iVP : umain.h
  • epV_IVP : umain.h
  • epV_V : umain.h
  • epV_VP : umain.h
  • EQUAL : deflate.c
  • EqualRect() : udraw.h, udraw.cpp
  • equivs : io.c
  • equivs_alloc : io.c
  • equivs_index : io.c
  • err : Stat.cpp, win32.c, watch.c, update.c, tag.c, rtag.c, lock.c, edit.c, diff.c, commit.c
  • ERR_MSG : zutil.h
  • ERR_RETURN : zutil.h
  • errInternal : AppGlue.h
  • errlog : cvsgui.c
  • errname : cvsgui.c
  • errno : zutil.h, cvs.h, xgetwd.c, system.h, strtoul.c, savecwd.c, rename.c, mkdir.c, fnmatch.c, savecwd.c, system.h, fnmatch.c
  • errno_max() : strerror.c
  • errnum : gzio.c, error.c
  • error() : minigzip.c, error.h, error.c
  • ERROR : diff3.c
  • error_exit() : error.h, error.c
  • error_names : strerror.c
  • error_table : strerror.c
  • error_use_protocol : error.h, error.c
  • errors : Stat.cpp, win32.c
  • errs1 : sockerror.c
  • errs2 : sockerror.c
  • errs3 : sockerror.c
  • errs4 : sockerror.c
  • errs5 : sockerror.c
  • errs6 : sockerror.c
  • errs7 : sockerror.c
  • errs9 : sockerror.c
  • errseek : cvsgui.c
  • errThreadRunning : AppGlue.h
  • ErrUnknownBuf : porttcp.c
  • escape_keyword_value() : rcs.c
  • EV_BTNDBLDOWN : umain.h
  • EV_BTNDOWN : umain.h
  • EV_BTNUP : umain.h
  • EV_CHGCURSOR : umain.h
  • EV_CHGFOCUS : umain.h
  • EV_CMD : umain.h
  • EV_COMBO_APPEND : umain.h
  • EV_COMBO_DELSEL : umain.h
  • EV_COMBO_ENABLESEL : umain.h
  • EV_COMBO_GETCOUNT : umain.h
  • EV_COMBO_GETMENU : umain.h
  • EV_COMBO_GETSEL : umain.h
  • EV_COMBO_RESETALL : umain.h
  • EV_COMBO_SEL : umain.h
  • EV_COMBO_SETSEL : umain.h
  • EV_COMMAND_START : umain.h
  • EV_CREATE : umain.h
  • EV_CUSTOM_DRAW : umain.h
  • EV_DESTROY : umain.h
  • EV_DRAGQUERY : umain.h
  • EV_DROPIT : umain.h
  • EV_DROPQUERY : umain.h
  • EV_DROPQUERY_CMDID : umain.h
  • EV_DROPREF : umain.h
  • EV_EDITACTIVATE : umain.h
  • EV_EDITCHANGE : umain.h
  • EV_ENABLECMD : umain.h
  • EV_ENTER : umain.h
  • EV_EXPOSE : umain.h
  • EV_FETCHCMD : umain.h
  • EV_GET_SLIDERPROP : umain.h
  • EV_GETFLOAT : umain.h
  • EV_GETINTEGER : umain.h
  • EV_GETLOC : umain.h
  • EV_GETTEXT : umain.h
  • EV_INIT_TAB_WIDGET : umain.h
  • EV_INIT_WIDGET : umain.h
  • EV_INVALIDATE : umain.h
  • EV_KEYDOWN : umain.h
  • EV_LEAVE : umain.h
  • EV_LIST_ADDCOLUMNS : umain.h
  • EV_LIST_ADDSEL : umain.h
  • EV_LIST_DBLCLICK : umain.h
  • EV_LIST_DELROW : umain.h
  • EV_LIST_GETINFO : umain.h
  • EV_LIST_GETNEXT : umain.h
  • EV_LIST_GETNEXTSEL : umain.h
  • EV_LIST_INSERT : umain.h
  • EV_LIST_NEWROW : umain.h
  • EV_LIST_RESETALL : umain.h
  • EV_LIST_RESORT : umain.h
  • EV_LIST_ROWGETDATA : umain.h
  • EV_LIST_ROWSETDATA : umain.h
  • EV_LIST_SELCOLUMN : umain.h
  • EV_LIST_SELECTING : umain.h
  • EV_LIST_SETCOLTITLE : umain.h
  • EV_LIST_SETCOLWIDTH : umain.h
  • EV_LIST_SETFEEDBACK : umain.h
  • EV_MMOVE : umain.h
  • ev_msg : umain.h
  • EV_NONE : umain.h
  • EV_NOTIFY : umain.h
  • EV_PAGE_CHANGED : umain.h
  • EV_QUERYSTATE : umain.h
  • EV_REDRAW : umain.h
  • EV_RESIZE : umain.h
  • EV_SCROLLCHANGE : umain.h
  • EV_SET_SLIDER : umain.h
  • EV_SET_SLIDERPROP : umain.h
  • EV_SETCURSOR : umain.h
  • EV_SETFLOAT : umain.h
  • EV_SETINTEGER : umain.h
  • EV_SETLOC : umain.h
  • EV_SETSTATE : umain.h
  • EV_SETTEXT : umain.h
  • EV_SETTOOLTIP : umain.h
  • EV_SHOW_WIDGET : umain.h
  • EV_TB_BUTTON : umain.h
  • EV_TB_CHECKBTN : umain.h
  • EV_TB_DROPDOWN : umain.h
  • EV_TB_END : umain.h
  • EV_TB_GETCOLOR : umain.h
  • EV_TB_INIT : umain.h
  • EV_TB_SEPARATOR : umain.h
  • EV_TIMER : umain.h
  • EV_TREE_DELETE : umain.h
  • EV_TREE_EXPAND : umain.h
  • EV_TREE_EXPANDING : umain.h
  • EV_TREE_GETINFO : umain.h
  • EV_TREE_GETSEL : umain.h
  • EV_TREE_INSERT : umain.h
  • EV_TREE_RESETALL : umain.h
  • EV_TREE_SELECT : umain.h
  • EV_TREE_SELECTING : umain.h
  • EV_TREE_SETDATA : umain.h
  • EV_TREE_SETICON : umain.h
  • EV_UPDATEFOCUS : umain.h
  • EV_UPDATEUI : umain.h
  • EV_UPDTCMD : umain.h
  • EVER_MATCHED_SOMETHING : regex.c
  • evf : pipe.c
  • exact : findtcl.cpp
  • exactn : regex.c
  • exchange() : getopt.c
  • exclude_alloc : diff.c
  • exclude_count : diff.c
  • excluded_filename() : diff.h, diff.c
  • execvp() : run.c
  • existence_error : system.h
  • existing_files : remove.c
  • exit : options.h, error.c, cvs.h, options.h, dll_glue.h, cvsgui.h
  • EXIT_FAILURE : system.h
  • exop : inftrees.c, inffast.c, infcodes.c
  • expand : rcs.c
  • expand_at_signs() : cvs.h
  • expand_keywords() : rcs.c
  • expand_modules() : history.c
  • expand_path() : cvs.h
  • expand_string() : cvs.h
  • expand_variable() : expand_path.c
  • expand_wild() : cvs.h
  • expandLF() : CvsArgs.cpp
  • expect() : parser.cc
  • expectToken : lexer.cc, common.h
  • EXPORT : cvs.h, zconf.h
  • export_usage : checkout.c
  • ext_method : cvs.h
  • EXTEND_BUFFER : regex.c
  • EXTEND_RANGE_TABLE_WORK_AREA : regex.c
  • EXTERN : diff.h
  • extra_arg : modules.c
  • extra_blbits : trees.c
  • extra_dbits : trees.c
  • EXTRA_FIELD : gzio.c
  • extra_lbits : trees.c
  • extract : history.c
  • EXTRACT_CHARACTER : regex.c
  • EXTRACT_NUMBER : regex.c
  • EXTRACT_NUMBER_AND_INCR : regex.c
  • extractInfos() : UPseudoSupport.cpp

- f -
  • f : inflate.c
  • F1 : md5.c
  • F2 : md5.c
  • F3 : md5.c
  • F4 : md5.c
  • F_OK : config.h, system.h
  • FAIL_STACK_EMPTY : regex.c
  • FAIL_STACK_FULL : regex.c
  • FAIL_STACK_GROWTH_FACTOR : regex.c
  • FAIL_STACK_PTR_EMPTY : regex.c
  • falloc() : inftrees.c
  • FALSE : misc.c, cvsgui_wire.h
  • false : regex.c
  • FAT : vmsmunch_private.h
  • fatal() : diff.h
  • FC : diff3.c
  • FCH : vmsmunch_private.h
  • fchdir : savecwd.c
  • fd : gzio.c
  • fdiag : analyze.c
  • fgetentent() : entries.c, CvsEntries.cpp
  • file : recurse.c, expand_path.c, util.c
  • file0 : diff3.c
  • FILE0 : diff3.c
  • file1 : diff3.c
  • FILE1 : diff3.c
  • file2 : filesubr.c, rcscmds.c, filesubr.c, mac_filesubr.c, filesubr.c, dir.c, diff3.c
  • FILE2 : diff3.c
  • file2_file : filesubr.c
  • file_compress() : minigzip.c
  • file_count : history.c
  • file_gzip_level : client.h
  • file_has_markers() : cvs.h
  • FILE_INCREMENT : history.c
  • file_label : diff.h
  • file_list : history.c
  • file_max : history.c
  • file_name_as_directory() : filutils.h, filutils.c
  • file_sort : history.c
  • file_uncompress() : minigzip.c
  • FILEATTR : hash.h
  • fileattr_default_attrs : fileattr.c
  • FILEATTR_H : fileattr.h
  • fileattr_read() : fileattr.c
  • fileattr_startdir() : fileattr.c
  • fileattr_stored_repos : fileattr.c
  • fileb : diff3.c
  • FILEC : diff3.c
  • FILECHANGE_TIMER : BrowseFileView.cpp
  • FileIsBinary() : TextBinary.h, TextBinary.cpp
  • FileIsText() : TextBinary.h, TextBinary.cpp
  • fileLess() : findtcl.cpp
  • filelist : recurse.c, mkmodules.c, find_names.c
  • filename : rcs.c, edit.c
  • filename_cmp : system.h
  • filename_lastdirchar : system.h
  • FILENAMES_CASE_INSENSITIVE : config.h
  • filenum : diff3.c
  • filepattern : ndir.c
  • FILEPROC : cvs.h
  • fileRemove() : findtcl.cpp
  • files : diff.h
  • FILES : hash.h
  • FILESDONEPROC : cvs.h
  • filesdoneproc : recurse.c
  • FileTimeToUnixTime() : Stat.cpp, win32.c
  • FileTraverse() : FileTraversal.h, FileTraversal.cpp
  • filetype() : diff.c
  • filevec : analyze.c
  • fill_hrec() : history.c
  • fill_window() : deflate.c
  • FillBuffer() : TextBinary.cpp
  • fillSemiColonTypes() : cvs_hqx.cpp
  • filter : tag.c, rtag.c, logmsg.c, edit.c, commit.c
  • filter_stream_through_program() : run.c, mac_run.c
  • fin : rcs.c
  • finaladd() : commit.c
  • finalwrite : diff3.c
  • find_and_hash_each_line() : io.c
  • find_change() : diff.h
  • Find_Directories() : cvs.h
  • find_dirs() : find_names.c
  • find_function() : context.c
  • find_function_last_match : context.c
  • find_function_last_search : context.c
  • find_hunk() : context.c
  • find_identical_ends() : io.c
  • Find_Names() : cvs.h
  • find_rcs() : find_names.c
  • find_reverse_change() : diff.h
  • find_type() : logmsg.c
  • findIdForWnd() : PseudoDlg.cpp
  • findmaxrev() : commit.c
  • findmostright() : UPseudoSupport.cpp
  • FindNextChildWindow() : wincvs_winutil.cpp
  • FindNextSiblingWindow() : wincvs_winutil.cpp
  • FindNextWindow() : wincvs_winutil.h, wincvs_winutil.cpp
  • FindPrevSiblingWindow() : wincvs_winutil.cpp
  • FindPrevWindow() : wincvs_winutil.h, wincvs_winutil.cpp
  • findslash() : checkout.c
  • findtag() : rcs.c
  • findTcl() : findtcl.cpp
  • finfo : watch.c, update.c, tag.c, status.c, rtag.c, remove.c, rcs.c, patch.c, log.c, entries.c, edit.c, diff.c, commit.c, checkin.c, admin.c
  • finish_done : deflate.c
  • finish_output() : diff.h
  • finish_started : deflate.c
  • FINISH_STATE : deflate.h
  • first0 : util.c
  • first1 : util.c
  • FIRST_STRING_P : regex.c
  • fixaddfile() : commit.c
  • fixbranch() : commit.c
  • fixed_bd : inftrees.c
  • fixed_bl : inftrees.c
  • fixed_mem : inftrees.c
  • fixed_td : inftrees.c
  • fixed_tl : inftrees.c
  • FIXEDH : inftrees.c
  • fixpath() : misc.h, misc.c
  • FJN : vmsmunch_private.h
  • flag_format : util.c
  • flagging : diff3.c
  • flags : run.c, rcs.c, run.c, fnmatch.c, system.c, fnmatch.c
  • FlatenSubFolders : CvsCommands.cpp
  • FLEX_SCANNER : lexer.cc
  • FLUSH : infutil.h
  • flush : gzio.c, deflate.c
  • flush_all() : dll_glue.c
  • FLUSH_BLOCK : deflate.c
  • FLUSH_BLOCK_ONLY : deflate.c
  • flush_output() : diff3.c, diff.h
  • flush_pending() : deflate.c
  • flushDisplay() : ProgressDialog.cpp
  • FlushRLE() : hqx.c
  • fmt_proc() : logmsg.c
  • fn : sighandle.c
  • fname : import.c, entries.c
  • fncmp : filesubr.c, config.h, filesubr.c, config.h, filesubr.c, config.h, system.h
  • fnfold : filesubr.c, config.h, filesubr.c, config.h, filesubr.c, config.h, system.h
  • FNM_NOESCAPE : fnmatch.h
  • FNM_NOMATCH : fnmatch.h
  • FNM_PATHNAME : fnmatch.h
  • FNM_PERIOD : fnmatch.h
  • fnmatch() : vms.h, fnmatch.h, fnmatch.c, fnmatch.h, fnmatch.c
  • FNOBSERVER : BrowseViewModel.h
  • FO : diff3.c
  • FOLD_FN_CHAR : config.h, system.h, config.h, fnmatch.c
  • foo : log.c
  • FOPEN : zutil.h
  • fopen : config.h
  • FOPEN_BINARY_READ : system.h
  • FOPEN_BINARY_WRITE : system.h
  • force : remove.c
  • force_ci : commit.c
  • force_tag_match : vers_ts.c, update.c, tag.c, rtag.c, rcs.c, patch.c, classify.c, checkout.c
  • force_tag_move : tag.c, rtag.c
  • fore : PseudoButton.cpp
  • fork : vms.h
  • fork_method : cvs.h
  • format : vasprintf.c, ifdef.c
  • format_group() : ifdef.c
  • format_ifdef() : ifdef.c
  • FormatMenuString() : wincvs_winutil.h, wincvs_winutil.cpp
  • fout : rcs.c
  • fp : rcs.c, logmsg.c, import.c
  • fparg : rcs.c
  • fperrmsg() : cvs.h
  • fprintf() : logmsg.c
  • fputentent() : entries.c
  • frameRec : dll_garbage.c
  • free : logmsg.c, ndir.c, dll_garbage.h
  • free_cwd() : savecwd.h
  • free_diff3_blocks() : diff3.c
  • free_diff_blocks() : diff3.c
  • free_dircontents() : ndir.c
  • free_func : zlib.h
  • free_list_types() : ImportFilter.h, ImportFilter.cpp
  • free_names() : cvs.h
  • FREE_RANGE_TABLE_WORK_AREA : regex.c
  • free_rcsnode_contents() : rcs.c
  • free_rcsvers_contents() : rcs.c
  • FREE_STACK_RETURN : regex.c
  • free_value : rcs.c
  • FREE_VAR : regex.c
  • FREE_VARIABLES : regex.c
  • freedeltatext() : rcs.c
  • freenode_mem() : hash.c
  • freevers_ts() : cvs.h
  • Freq : deflate.h
  • from : rcs.c
  • fromfdp : piped_child.c, run.c
  • fromlengths : diff3.c
  • FSMakeFSSpecCompat() : MacMisc.h, MacMisc.cpp
  • FSSpec : TextBinary.h, MultiFiles.h, MoveToTrash.h, FileTraversal.h, CvsArgs.h
  • fstat : StdAfx.h, config.h
  • ftruncate() : ftruncate.c
  • FTS_BOTTOM : CJFlatTabCtrl.h
  • FTS_HASARROWS : CJFlatTabCtrl.h
  • FTS_HASHOMEEND : CJFlatTabCtrl.h
  • fudge : rcs.c
  • fullname : subr.c
  • function_regexp_list : diff.h
  • Future : getdate.c

- g -
  • g_bLogUnbuffered : CvsTrace.cpp
  • g_hLogFile : CvsTrace.cpp
  • g_hMsgHook : CJMenuBar.cpp
  • g_hNextProject : CvsProject.cpp
  • g_nLevel : CvsTrace.cpp
  • g_pListOfFreeBuffers : CvsString.cpp
  • g_pMenuBar : CJMenuBar.cpp
  • g_pProjects : CvsProject.cpp
  • g_sCurrent : CvsTrace.cpp
  • g_sFilter : CvsTrace.cpp
  • g_Shell : CJMenu.cpp
  • gAddBinControl() : CvsPrefs.cpp
  • gAllMethods : PythonGlue.cpp
  • gAlwaysUseCvsroot() : CvsPrefs.cpp
  • GAP : CJMenu.cpp
  • garby_alloc() : dll_garbage.c
  • GARBY_DEF_ALLOC : dll_garbage.c
  • GARBY_DEF_POOL : dll_garbage.c
  • garby_free() : dll_garbage.c
  • garby_realloc() : dll_garbage.c
  • garbyAlloc : dll_garbage.c
  • garbyFree : dll_garbage.c
  • garbyNew() : dll_garbage.h
  • garbyPtr : dll_garbage.c
  • garbyRealloc : dll_garbage.c
  • garbyRemove() : dll_garbage.h
  • gAuthen : Authen.h, Authen.cpp
  • gAuthenKind() : Authen.cpp
  • gboolean : cvsgui_wire.h
  • gBrowser() : CvsPrefs.cpp
  • gBrowserMenu() : wincvs_winutil.cpp
  • gc_nBitmapRightMargin() : Splash.cpp
  • gca() : cvs.h
  • gchar : cvsgui_wire.h
  • gCheckoutRO() : CvsPrefs.cpp
  • gCommitLogs() : CommitDlg.cpp
  • gConsole : AppGlue.h, AppGlue.cpp
  • gconstpointer : cvsgui_wire.h
  • gCvsConsole() : CvsPrefs.cpp
  • gCvsguiErr : PythonContainer.h, PythonContainer.cpp
  • gCvsPrefs : CvsPrefs.h, CvsPrefs.cpp
  • gCvsroot() : CvsPrefs.cpp
  • gCvsroot1() : CvsPrefs.cpp
  • gCvsroot10() : CvsPrefs.cpp
  • gCvsroot11() : CvsPrefs.cpp
  • gCvsroot12() : CvsPrefs.cpp
  • gCvsroot13() : CvsPrefs.cpp
  • gCvsroot14() : CvsPrefs.cpp
  • gCvsroot15() : CvsPrefs.cpp
  • gCvsroot16() : CvsPrefs.cpp
  • gCvsroot17() : CvsPrefs.cpp
  • gCvsroot18() : CvsPrefs.cpp
  • gCvsroot19() : CvsPrefs.cpp
  • gCvsroot2() : CvsPrefs.cpp
  • gCvsroot20() : CvsPrefs.cpp
  • gCvsroot3() : CvsPrefs.cpp
  • gCvsroot4() : CvsPrefs.cpp
  • gCvsroot5() : CvsPrefs.cpp
  • gCvsroot6() : CvsPrefs.cpp
  • gCvsroot7() : CvsPrefs.cpp
  • gCvsroot8() : CvsPrefs.cpp
  • gCvsroot9() : CvsPrefs.cpp
  • gCvsVersion() : CvsPrefs.cpp
  • gDateNames : UpdateDlg.cpp, UpdateDlg.h, AnnotateDlg.h
  • gDateOrRevNames : UpdateDlg.cpp, UpdateDlg.h
  • gDestFile : cvs_hqx.cpp
  • gDestFileSpec : cvs_hqx.cpp
  • GDIFF_MAIN : diff.c
  • gDirtySupport() : CvsPrefs.cpp
  • gdouble : cvsgui_wire.h
  • gDummyFile : WinCvsBrowser.cpp, UCvsFolders.cpp
  • gen_bitlen() : trees.c
  • gen_codes() : trees.c
  • GET_BUFFER_SPACE : regex.c
  • get_byte() : gzio.c
  • GET_CHAR_AFTER_2 : regex.c
  • GET_CHAR_BEFORE_2 : regex.c
  • get_comment() : import.c
  • get_crc_table() : zlib.h, crc32.c
  • get_date() : cvs.h, getdate.y, getdate.c, BrowseViewColumn.cpp
  • get_file() : cvs.h
  • get_homedir() : cvs.h
  • GET_RTYPE : vmsmunch.h
  • GET_TIMES : vmsmunch.h
  • GET_UNSIGNED_NUMBER : regex.c
  • GetAllPersistentSettings() : Persistent.cpp
  • GetAsSystemTime() : CJDateTimeCtrl.cpp
  • getcaller() : cvs.h
  • GetCustomMenu() : wincvs_winutil.h, wincvs_winutil.cpp
  • getcwd() : system.h
  • getdate_yychar : getdate.c
  • getdate_yydebug : getdate.c
  • getdate_yyerror() : getdate.c, getdate.y, getdate.c
  • getdate_yylex() : getdate.c, getdate.y, getdate.c
  • getdate_yylval : getdate.c
  • getdate_yynerrs : getdate.c
  • getdate_yyparse() : getdate.c
  • getDefaultEncodingPolicy() : cvs_hqx.cpp
  • getdelta() : rcs.c
  • GetDItemCtrlHdl() : MacMisc.h, MacMisc.cpp
  • GetDItemHdl() : MacMisc.h, MacMisc.cpp
  • GetDItemMenuSel() : MacMisc.h, MacMisc.cpp
  • getegid() : pwd.h, pwd.c, pwd.h, pwd.c
  • GetEndOfDecendantWindow() : wincvs_winutil.cpp
  • getenv : cvs.h, system.h, getopt1.c, getopt.c, system.h, getopt1.c, getopt.c, dll_glue.h, cvsgui.h
  • GetEnvValue() : TextBinary.h, TextBinary.cpp
  • GetErrorMessage() : CVS_Coworker_i.h, cvs_coworker.h
  • geteuid() : pwd.h, pwd.c, pwd.h, pwd.c
  • GetExtension() : TextBinary.h, TextBinary.cpp
  • GetFileChanges() : CVS_Coworker_i.h, cvs_coworker.h
  • GetFilesToAdd() : CVS_Coworker_i.h, cvs_coworker.h
  • getgid() : pwd.h, pwd.c, pwd.h, pwd.c
  • getgr_name() : pwd.h, pwd.c, pwd.h, pwd.c
  • getgrgid() : pwd.h, pwd.c, pwd.h, pwd.c
  • getgrnam() : pwd.h, pwd.c, pwd.h, pwd.c
  • getgroups() : pwd.h, pwd.c, pwd.h, pwd.c
  • gethostname() : main.c, hostname.c
  • GetIcon() : UCvsFolders.cpp
  • GetInvString() : CustomizeMenus.cpp
  • getLabelFromContainer() : stdafx.h
  • getline() : getline.h, getline.c, getline.h, getline.c
  • GETLINE_NO_LIMIT : getline.h
  • getline_safe() : getline.h, getline.c
  • getLoc() : MacrosSetup.cpp
  • getlogin() : pwd.h, pwd.c, pwd.h, pwd.c, subr.c, pwd.h, pwd.c
  • getLong() : gzio.c
  • GetMenuEntry() : wincvs_winutil.h, wincvs_winutil.cpp
  • GetMenuTitle() : umenu.cpp
  • GetNextCharacter() : hqx.c
  • GetNextParentWindow() : wincvs_winutil.cpp
  • getopt : getopt.h, config.h
  • getopt_long() : getopt1.c, getopt.h, getopt1.c, getopt.h
  • getopt_long_only() : getopt.h
  • getpagesize : valloc.c
  • getpass : win32.c, getpass.c, options.h, getpass.c, mac_run.c, cvsgui.h
  • getpassfunc : lsh_dll.h
  • getpassphrase : cvsgui.h
  • GetPathLength() : BrowseFileView.cpp
  • getpid() : win32.c, config.h, pwd.c, config.h
  • GetPrevParentWindow() : wincvs_winutil.cpp
  • GetProject() : CVS_Coworker_i.h, cvs_coworker.h
  • getpwent() : pwd.h, pwd.c, pwd.h, pwd.c
  • getpwnam() : pwd.h, pwd.c, pwd.h, pwd.c, config.h
  • GETPWNAM_MISSING : config.h
  • getpwuid() : pwd.h, pwd.c, pwd.h, pwd.c, pwd.h, pwd.c
  • GetPyFalse() : PythonGlue.impl.h
  • GetPyFile_Type() : PythonGlue.impl.h
  • GetPyInt_Type() : PythonGlue.impl.h
  • GetPyNone() : PythonGlue.impl.h
  • GetPyString_Type() : PythonGlue.impl.h
  • GetPyTrue() : PythonGlue.impl.h
  • GetPyTuple_Type() : PythonGlue.impl.h
  • GetPyType_Type() : PythonGlue.impl.h
  • GetRoot() : BrowseFileView.cpp
  • getSettingName() : Persistent.cpp
  • getstr() : getline.h, getline.c, getline.h, getline.c
  • GetSubCMenu() : wincvs_winutil.h, wincvs_winutil.cpp
  • gettext : regex.c
  • gettext_noop : regex.c
  • GetTimeZoneBias() : Stat.cpp, win32.c
  • getu32() : md5.c
  • getuid() : pwd.h, pwd.c, pwd.h, pwd.c
  • GetWinCvsDebugMask() : WinCvsDebug.h, WinCvsDebug.cpp
  • GetWinCvsDebugMaskBit() : WinCvsDebug.h, WinCvsDebug.cpp
  • gExtdiff() : CvsPrefs.cpp
  • gFilesMenu() : wincvs_winutil.cpp
  • gFileViewIgnore : UCvsFiles.cpp, UCvsFiles.h
  • gFileViewSort() : BrowseFileView.cpp, UCvsFiles.cpp
  • gFileViewSortAsc() : BrowseFileView.cpp, UCvsFiles.cpp
  • gfloat : cvsgui_wire.h
  • gGarbage : dll_garbage.c
  • gGraphBranchColor() : GraphView.cpp
  • gGraphDeadNodeColor() : GraphView.cpp
  • gGraphHeaderColor() : GraphView.cpp
  • gGraphNodeColor() : GraphView.cpp
  • gGraphSelColor() : GraphView.cpp
  • gGraphShadowColor() : GraphView.cpp
  • gGraphTagColor() : GraphView.cpp
  • gGraphUserStateNodeColor() : GraphView.cpp
  • gHelper() : CvsPrefs.cpp
  • gHideCommandDlgAnnotate() : CvsPrefs.cpp
  • gHideCommandDlgDiff() : CvsPrefs.cpp
  • gHideCommandDlgGraph() : CvsPrefs.cpp
  • gHideCommandDlgLog() : CvsPrefs.cpp
  • gHideCommandDlgUpdate() : CvsPrefs.cpp
  • gHideCommandDlgUseShift() : CvsPrefs.cpp
  • gHistoryLocs() : HistComboBoxEx.cpp, UCvsFolders.cpp
  • gHome() : CvsPrefs.cpp
  • gHQX : hqx.c
  • gHQXinited : hqx.c
  • gICTextOption() : CvsPrefs.cpp
  • gid_t : config.h
  • gImportModuleNames() : ImportDlg.cpp
  • gint : cvsgui_wire.h
  • gint16 : cvsgui_wire.h
  • gint32 : cvsgui_wire.h
  • gint8 : cvsgui_wire.h
  • gIsoConvert() : CvsPrefs.cpp
  • gKserverPort() : CvsPrefs.cpp
  • gLastWorkingDir() : CvsPrefs.cpp
  • global_readlock : lock.c
  • gLogDateNames() : LogDlg.cpp
  • gLogoutTimeOut() : CvsPrefs.cpp
  • gLogRevNames() : LogDlg.cpp
  • gLogStateNames() : LogDlg.cpp
  • gLogUserNames() : LogDlg.cpp
  • glong : cvsgui_wire.h
  • glue_consoleerr() : AppGlue.h, AppGlue.cpp
  • glue_consolein() : AppGlue.h, AppGlue.cpp
  • glue_consoleout() : AppGlue.h, AppGlue.cpp
  • glue_eventdispatcher() : AppGlue.mac.h, AppGlue.mac.cpp
  • glue_exit() : AppGlue.h, AppGlue.cpp
  • glue_getenv() : AppGlue.h, AppGlue.cpp
  • gMacBinEncoding() : CvsPrefs.cpp
  • gMacrosAdmin : MacrosSetup.h, MacrosSetup.cpp
  • gMacrosSel : MacrosSetup.h, MacrosSetup.cpp
  • gMainPlacement() : MainFrm.cpp
  • GMT_FS : win32.c
  • gmtime() : getdate.c
  • gOldLoc() : HistComboBoxEx.cpp
  • gOldModules : CheckoutDlg.cpp, CheckoutDlg.h
  • got_message : commit.c
  • GP_CONSOLE : cvsgui_protocol.h
  • gp_console_write() : cvsgui_protocol.h, cvsgui_process.cpp
  • GP_GETENV : cvsgui_protocol.h
  • gp_getenv_read() : cvsgui_protocol.h, cvsgui_process.cpp
  • gp_getenv_write() : cvsgui_protocol.h, cvsgui_process.cpp
  • gp_init() : cvsgui_process.cpp
  • GP_QUIT : cvsgui_protocol.h
  • gp_quit_write() : cvsgui_protocol.h, cvsgui_process.cpp
  • gpointer : cvsgui_wire.h
  • gProxyHost() : CvsPrefs.cpp
  • gProxyPort() : CvsPrefs.cpp
  • gPruneOption() : CvsPrefs.cpp
  • gPserverPort() : CvsPrefs.cpp
  • gQuietOption() : CvsPrefs.cpp
  • gr : pwd.c
  • GRABBITS : inffast.c
  • gRcsFile : CvsLog.cpp, common.h
  • gRcsFiles : CvsLog.cpp, common.h
  • gReleasesNames() : ImportDlg.cpp
  • gRevFile : CvsLog.cpp, common.h
  • gRevNames : UpdateDlg.cpp, UpdateDlg.h, CommitDlg.h, AnnotateDlg.h
  • gRhostPort() : CvsPrefs.cpp
  • GRIP_INTRASPACING : CJControlBar.cpp
  • GRIP_SIZE : CJControlBar.cpp
  • GRIP_START : CJControlBar.cpp
  • group : pwd.c, ifdef.c
  • group_format : diff.h
  • group_strings : pwd.c
  • groups : pwd.h, ifdef.c
  • groups_letter_value() : ifdef.c
  • GROW : cvsrc.c
  • GROW_FAIL_STACK : regex.c
  • gRshName() : CvsPrefs.cpp
  • gserver_method : cvs.h
  • gServerName() : CvsPrefs.cpp
  • gshort : cvsgui_wire.h
  • gSrcFile : cvs_hqx.cpp
  • gTurnOffBroadcast : UPseudoSupport.h, UPseudoSupport.cpp
  • guchar : cvsgui_wire.h
  • GUESS_LINES : io.c
  • gUICache : PythonGlue.cpp
  • gUICacheObj : PythonGlue.cpp
  • gUICacheValid : PythonGlue.cpp
  • guint : cvsgui_wire.h
  • guint16 : cvsgui_wire.h
  • guint32 : cvsgui_wire.h
  • guint8 : cvsgui_wire.h
  • gulong : cvsgui_wire.h
  • gUnixLF() : CvsPrefs.cpp
  • gUseExtDiff() : DiffDlg.cpp
  • gUseProxy() : CvsPrefs.cpp
  • gUseShell() : CvsPrefs.cpp
  • gUseViewerAlways() : CvsPrefs.cpp
  • gushort : cvsgui_wire.h
  • GUSILSH_cleanup() : GUSIlsh.h
  • GUSILSH_hdlevt() : GUSIlsh.h
  • GUSILSH_set_context() : GUSIlsh.h
  • GUSIMSL_HandleEventHook() : AppGlue.mac.h, AppGlue.mac.cpp
  • GUSIMSL_WriteConsoleHook() : AppGlue.mac.h, AppGlue.mac.cpp
  • GUSIMSL_WriteErrHook() : AppGlue.mac.h, AppGlue.mac.cpp
  • GUSIwithLSHSockets() : GUSIlsh.h
  • GUSIwithoutLSHSockets() : GUSIlsh.h
  • GUTTER_WIDTH_MINIMUM : diff.c
  • gVendorNames() : ImportDlg.cpp
  • gViewer() : CvsPrefs.cpp
  • gViewFont() : wincvsView.cpp
  • gWarnPython() : NoPython.cpp
  • gWhichCvs() : CvsPrefs.cpp
  • gWordWrapLogMsg() : CvsPrefs.cpp
  • gZ9Option() : CvsPrefs.cpp
  • gz_compress() : minigzip.c
  • gz_magic : gzio.c
  • gz_open() : gzio.c
  • gz_stream : gzio.c
  • GZ_SUFFIX : minigzip.c
  • gz_uncompress() : minigzip.c
  • gzclose() : zlib.h
  • gzdopen() : zlib.h
  • gzerror() : zlib.h
  • gzFile : zlib.h
  • gzflush() : zlib.h
  • gzip_level : client.h
  • gZLevel() : CvsPrefs.cpp
  • gzopen() : zlib.h
  • gzread() : zlib.h
  • gzwrite() : zlib.h

- h -
  • HALF_SECOND : CJDateTimeCtrl.cpp
  • handle_file : dir.c
  • hardlist : hardlink.h, hardlink.c
  • has : wrapper.c
  • HasAdvancedOptionsForCommand() : CVS_Coworker_i.h, cvs_coworker.h
  • HASH : io.c
  • hashp() : hash.c
  • HASHSIZE : hash.h
  • HasPersistentSettings() : Persistent.h, Persistent.cpp
  • HAVE_CONNECT : config.h
  • HAVE_CRYPT : config.h
  • HAVE_DIRECT_H : config.h
  • HAVE_DIRENT_H : config.h
  • HAVE_ERRNO_H : config.h
  • HAVE_FCNTL_H : config.h
  • HAVE_FORK : system.h
  • HAVE_FSYNC : config.h
  • HAVE_FTIME : config.h
  • HAVE_FTRUNCATE : config.h
  • HAVE_GETPAGESIZE : config.h
  • HAVE_IO_H : config.h
  • HAVE_KRB_GET_ERR_TEXT : kclient_if.h
  • HAVE_LIBCRYPT : config.h
  • HAVE_LIBNSL : config.h
  • HAVE_LIBSOCKET : config.h
  • HAVE_LIMITS_H : config.h
  • HAVE_LONG_FILE_NAMES : config.h
  • HAVE_MEMCPY : zutil.h
  • HAVE_MEMORY_H : config.h
  • HAVE_MKDIR : config.h
  • HAVE_NDIR_H : config.h
  • HAVE_PUTENV : config.h
  • HAVE_READLINK : config.h
  • HAVE_RENAME : config.h
  • have_rev1_label : diff.c
  • have_rev2_label : diff.c
  • HAVE_RMDIR : config.h
  • HAVE_SETMODE : config.h, system.h
  • HAVE_SIGACTION : config.h
  • HAVE_SIGPROCMASK : config.h
  • HAVE_ST_BLKSIZE : config.h
  • HAVE_STRING_H : config.h
  • HAVE_SYS_DIR_H : config.h
  • HAVE_SYS_PARAM_H : config.h
  • HAVE_SYS_RESOURCE_H : config.h
  • HAVE_SYS_SELECT_H : config.h
  • HAVE_SYS_TIME_H : config.h
  • HAVE_SYS_TIMEB_H : config.h
  • HAVE_SYS_UTIME_H : config.h
  • HAVE_SYS_WAIT_H : config.h
  • HAVE_TIME_H : system.h
  • HAVE_TIMEB_H : config.h
  • HAVE_TIMEZONE : config.h
  • HAVE_TZSET : config.h
  • HAVE_UNISTD_H : config.h
  • HAVE_UTIME_H : config.h
  • HAVE_UTIME_NULL : config.h
  • HAVE_VFORK : config.h
  • HAVE_VPRINTF : config.h
  • HAVE_WINSOCK_H : config.h
  • HBITMAP : utoolbar.cpp
  • hdlevtfunc : lsh_dll.h
  • HEAD_CRC : gzio.c
  • header : trees.c
  • HEADER : hash.h
  • HEAP_SIZE : deflate.h
  • height : PseudoButton.cpp
  • hello : example.c
  • heuristic : diff.h
  • hextable : CJHexEdit.cpp
  • HIDE_CONTRLBAR : CJControlBar.h
  • high0 : diff3.c
  • high1 : diff3.c
  • high2 : diff3.c
  • high_thread : diff3.c
  • HIGHLIGHTSTYLE : CJMenu.h
  • histfile : history.c
  • HISTLOC_IMAGE_CX : HistComboBoxEx.h
  • HISTLOC_VISIBLEITEMS : HistComboBoxEx.h
  • history() : cvs.h
  • history_name : checkout.c
  • history_usg : history.c
  • history_write() : cvs.h
  • hold : ignore.c
  • home_dir : pwd.c
  • HookWndProc() : Subclass.cpp
  • horizon_lines : diff3.c, diff.h
  • HORZF : CJDockContext.cpp
  • hostname : main.c, cvs.h
  • HostStrError() : porttcp.c
  • HOUR : getdate.c, getdate.y, getdate.c
  • Hours : getdate.c
  • HOWMUCH_WORDS : CommitDlg.cpp
  • hPal : dib.c
  • HQXDecode() : hqx.h, hqx.c
  • HQXDecVarsPtr : hqx.c
  • HQXEncode() : hqx.h, hqx.c
  • HQXEncVarsPtr : hqx.c
  • HQXInit() : hqx.c
  • HQXNameFilter : hqx.h
  • HQXRead() : hqx.c
  • HQXSink : hqx.h
  • HQXSource : hqx.h
  • hqxtab : hqx.c
  • HQXWrite() : hqx.c
  • HQXWriteEnd() : hqx.c
  • hr : history.c
  • hrec_count : history.c
  • hrec_head : history.c
  • HREC_INCREMENT : history.c
  • hrec_max : history.c
  • HRESULT() : CJToolBar.cpp
  • HT : hqx.c
  • huft_build() : inftrees.c
  • hunkfun : util.c

- i -
  • ICvsCoworker : CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_AddFiles_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_AddFiles_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_CheckinFiles_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_CheckinFiles_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_CheckoutFiles_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_CheckoutFiles_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_CloseProject_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_CloseProject_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_DiffFile_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_DiffFile_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_GetErrorMessage_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_GetErrorMessage_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_GetFileChanges_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_GetFileChanges_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_GetFilesToAdd_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_GetFilesToAdd_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_GetLastError_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_GetLastError_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_GetProject_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_GetProject_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_HasAdvancedOptionsForCommand_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_HasAdvancedOptionsForCommand_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_OpenProject_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_OpenProject_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_RemoveFiles_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_RemoveFiles_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_RenameFile_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_RenameFile_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_ShowAdvancedOptionsForCommand_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_ShowAdvancedOptionsForCommand_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_ShowFileHistory_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_ShowFileHistory_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_ShowFileProperties_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_ShowFileProperties_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_ShowUserInterface_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_ShowUserInterface_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_table : CVS_Coworker_p.c
  • ICvsCoworker_UncheckoutFiles_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_UncheckoutFiles_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_UpdateFiles_Proxy() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ICvsCoworker_UpdateFiles_Stub() : CVS_Coworker_p.c, CVS_Coworker_i.h, cvs_coworker.h
  • ID_ACCEL32911 : resource.h
  • ID_ACCESS : parser.h, parser.cc
  • ID_ADDBF : resource.h
  • ID_ANYBUTSEP : parser.h, parser.cc
  • ID_APP_CMDLINE : resource.h
  • ID_APP_COPYRIGHTS : resource.h
  • ID_APP_CREDITS : resource.h
  • ID_APP_LOGIN : resource.h
  • ID_APP_LOGOUT : resource.h
  • ID_APP_PREFERENCES : resource.h
  • ID_APP_RTAGBRANCH : resource.h
  • ID_APP_RTAGCREATE : resource.h
  • ID_APP_RTAGDELETE : resource.h
  • ID_AUTHOR : parser.h, parser.cc
  • ID_BRANCH : parser.h, parser.cc
  • ID_BRANCHES : parser.h, parser.cc
  • ID_BROWSER_OPEN : resource.h
  • ID_BUTTON32918 : resource.h
  • ID_BUTTON32919 : resource.h
  • ID_BUTTON32920 : resource.h
  • ID_BUTTON32921 : resource.h
  • ID_BUTTON32940 : resource.h
  • ID_CANCEL_EDIT_CNTR : resource.h
  • ID_CHAR : parser.h, parser.cc
  • ID_COMMITBF : resource.h
  • ID_CUST_FILES_MENU : resource.h
  • ID_CUST_FOLDER_MENU : resource.h
  • ID_DATE : parser.h, parser.cc
  • ID_DESCRIPTION : parser.h, parser.cc
  • ID_ENDFOLLOW : parser.h, parser.cc
  • ID_FILTERMASK : resource.h
  • ID_GFX_LARGEICON : CJResource.h
  • ID_GFX_REMOVEITEM : CJResource.h
  • ID_GFX_RENAMEITEM : CJResource.h
  • ID_GFX_SMALLICON : CJResource.h
  • ID_GRAPH_ADMINOPTIONS_CHANGELOGMESSAGE : resource.h
  • ID_GRAPH_ADMINOPTIONS_SETDESCRIPTION : resource.h
  • ID_GRAPH_ADMINOPTIONS_SETSTATE : resource.h
  • ID_GRAPH_CHANGELOGMESSAGE : resource.h
  • ID_GRAPH_CLOSE : resource.h
  • ID_GRAPH_GRAPHOPTIONS : resource.h
  • ID_GRAPH_SETDESCRIPTION : resource.h
  • ID_GRAPH_SETSTATE : resource.h
  • ID_HEAD : parser.h, parser.cc
  • ID_HELP_CVS : resource.h
  • ID_HELP_CVSCLIENT : resource.h
  • ID_HISTORYBROWSE : resource.h
  • ID_KEYWORD : parser.h, parser.cc
  • ID_LINES : parser.h, parser.cc
  • ID_LOCKEDBY : parser.h, parser.cc
  • ID_LOCKS : parser.h, parser.cc
  • ID_MACRO_ADMIN : resource.h
  • ID_MACRO_END : resource.h
  • ID_MACRO_SEL : resource.h
  • ID_MACRO_START : resource.h
  • ID_MENUBAR : resource.h
  • ID_MENUITEM32840 : resource.h
  • ID_POPUP_CUSTOMIZE : CJResource.h
  • ID_QUERY_ANNOTATE : resource.h
  • ID_RCS : parser.h, parser.cc
  • ID_REVFOLLOW : parser.h, parser.cc
  • ID_REVISION : parser.h, parser.cc
  • ID_SAVESETTINGS : resource.h
  • ID_SELREVISIONS : parser.h, parser.cc
  • ID_STATE : parser.h, parser.cc
  • ID_STOPCVS : resource.h
  • ID_STRICT : parser.h, parser.cc
  • ID_SYMBOLIC : parser.h, parser.cc
  • ID_TOTREVISIONS : parser.h, parser.cc
  • ID_UPDATEBF : resource.h
  • ID_USE_PYSHELL : resource.h
  • ID_USE_TCLSHELL : resource.h
  • ID_VIEW_ADD : resource.h
  • ID_VIEW_ADDB : resource.h
  • ID_VIEW_ADDED : resource.h
  • ID_VIEW_BROWSELOCATION_REMOVEUNWANTED : resource.h
  • ID_VIEW_BROWSER_BAR : resource.h
  • ID_VIEW_CHANGED : resource.h
  • ID_VIEW_CHECKOUT : resource.h
  • ID_VIEW_COMMIT : resource.h
  • ID_VIEW_CONFLICT : resource.h
  • ID_VIEW_CONSOLE_BAR : resource.h
  • ID_VIEW_DELREV : resource.h
  • ID_VIEW_DIFF : resource.h
  • ID_VIEW_EDIT : resource.h
  • ID_VIEW_EDITORS : resource.h
  • ID_VIEW_EDITSEL : resource.h
  • ID_VIEW_EDITSELDEF : resource.h
  • ID_VIEW_EXPLORE : resource.h
  • ID_VIEW_FILES_BAR : resource.h
  • ID_VIEW_FILTER_BAR : resource.h
  • ID_VIEW_FULLLIST : resource.h
  • ID_VIEW_GRAPH : resource.h
  • ID_VIEW_HIDEUNKNOWN : resource.h
  • ID_VIEW_IGNORE : resource.h
  • ID_VIEW_IMPORT : resource.h
  • ID_VIEW_INIT : resource.h
  • ID_VIEW_LOCKF : resource.h
  • ID_VIEW_LOG : resource.h
  • ID_VIEW_MISSING : resource.h
  • ID_VIEW_MODIFIED : resource.h
  • ID_VIEW_MULTI_BAR : resource.h
  • ID_VIEW_QUERYUPDATE : resource.h
  • ID_VIEW_RECURSIVE : resource.h
  • ID_VIEW_RELEASE : resource.h
  • ID_VIEW_RELOAD : resource.h
  • ID_VIEW_REMOVED : resource.h
  • ID_VIEW_RETRIEVE : resource.h
  • ID_VIEW_RMV : resource.h
  • ID_VIEW_ROWDETAILS : resource.h
  • ID_VIEW_SELNONSIG : resource.h
  • ID_VIEW_SMALLICONS : resource.h
  • ID_VIEW_STATUS : resource.h
  • ID_VIEW_TAG : resource.h
  • ID_VIEW_TAGBRANCH : resource.h
  • ID_VIEW_TAGDELETE : resource.h
  • ID_VIEW_TAGNEW : resource.h
  • ID_VIEW_TAGS_BAR : resource.h
  • ID_VIEW_TRASH : resource.h
  • ID_VIEW_UNEDIT : resource.h
  • ID_VIEW_UNKNOWN : resource.h
  • ID_VIEW_UNLOCKF : resource.h
  • ID_VIEW_UPDATE : resource.h
  • ID_VIEW_UPONE : resource.h
  • ID_VIEW_WATCHERS : resource.h
  • ID_VIEW_WATCHOFF : resource.h
  • ID_VIEW_WATCHON : resource.h
  • ID_VIEW_WORKSPACE : resource.h
  • ID_VIEWW_INIT : resource.h
  • ID_WORKING : parser.h, parser.cc
  • IDB_ABOUT : resource.h
  • IDB_BTN_ARROW : CJResource.h
  • IDB_BTN_EXPLORER : CJResource.h
  • IDB_BUTTON_IMAGES : CJResource.h
  • IDB_HISTLOC : resource.h
  • IDB_IDLE : resource.h
  • IDB_LIGHTBULB : resource.h
  • IDB_LOCATE : resource.h
  • IDB_PUSHPIN : CJResource.h
  • IDB_PYTHON : resource.h
  • IDB_SMALLICONS : resource.h
  • IDB_SPLASH : resource.h
  • IDC_ADD : resource.h
  • IDC_ALERTCAPTION : resource.h
  • IDC_ALLCMDS : resource.h
  • IDC_ALRTMSG : resource.h
  • IDC_ALTCVSCHK : resource.h
  • IDC_ALTCVSPROG : resource.h
  • IDC_ALTCVSSEL : resource.h
  • IDC_ALWAYSROOT : resource.h
  • IDC_APPLY : resource.h
  • IDC_ATTIC : resource.h
  • IDC_AUTHEN : resource.h
  • IDC_AUTHENDESC : resource.h
  • IDC_BAR_BUTTON : CJResource.h
  • IDC_BAR_CAPTION : CJResource.h
  • IDC_BAR_TREE : resource.h
  • IDC_BRANCH : resource.h
  • IDC_BTNHOME : resource.h
  • IDC_BTNPATH : resource.h
  • IDC_BTNPATH2 : resource.h
  • IDC_BTNPROGRAM : resource.h
  • IDC_BULB : resource.h
  • IDC_BUTTON_HIDE : CJResource.h
  • IDC_BUTTON_MINI : CJResource.h
  • IDC_CAPT_BUTTON : CJResource.h
  • IDC_CHECK1 : resource.h
  • IDC_CHECK2 : resource.h
  • IDC_CHECK_OVERRIDECHECKOUTDIR : resource.h
  • IDC_CHECKANNOTATE : resource.h
  • IDC_CHECKDIFF : resource.h
  • IDC_CHECKGRAPH : resource.h
  • IDC_CHECKKSERVERPORT : resource.h
  • IDC_CHECKLOG : resource.h
  • IDC_CHECKOUTRO : resource.h
  • IDC_CHECKPATH : resource.h
  • IDC_CHECKPROXY : resource.h
  • IDC_CHECKPSERVERPORT : resource.h
  • IDC_CHECKRHOSTPORT : resource.h
  • IDC_CHECKRSHNAME : resource.h
  • IDC_CHECKSERVERNAME : resource.h
  • IDC_CHECKUNIXLF : resource.h
  • IDC_CHECKUNMOD : resource.h
  • IDC_CHECKUPDATE : resource.h
  • IDC_CLEANCOPY : resource.h
  • IDC_CMDLINE : resource.h
  • IDC_CMDMENU : resource.h
  • IDC_COMBO : resource.h
  • IDC_COMBO1 : resource.h
  • IDC_COMBO2 : resource.h
  • IDC_COMBO_REV : resource.h
  • IDC_COMBODATE : resource.h
  • IDC_COMBOMODNAME : resource.h
  • IDC_COMBOREV : resource.h
  • IDC_COMBOREV2 : resource.h
  • IDC_COMBOROOT : resource.h
  • IDC_COMBORSAIDENTITY : resource.h
  • IDC_COMBORTAG : resource.h
  • IDC_COMBOSTATE : resource.h
  • IDC_COMBOUSER : resource.h
  • IDC_COMBOVTAG : resource.h
  • IDC_CONSOLE : resource.h
  • IDC_CREATEMISSDIR : resource.h
  • IDC_CTNLADD : resource.h
  • IDC_CUSTOMIZE_BAR : CJToolBar.cpp
  • IDC_CVSROOT : resource.h
  • IDC_CVSVERS : resource.h
  • IDC_DATE : resource.h
  • IDC_DEAD : resource.h
  • IDC_DEFBRANCH : resource.h
  • IDC_DELETED : resource.h
  • IDC_DELSTICKY : resource.h
  • IDC_DIFF : resource.h
  • IDC_DIFF1 : resource.h
  • IDC_DIFF2 : resource.h
  • IDC_DIFF3 : resource.h
  • IDC_DIFFPROG : resource.h
  • IDC_DIRECTORY : resource.h
  • IDC_DIRTYSUPPORT : resource.h
  • IDC_DOWN : resource.h
  • IDC_DRAGGING : CJResource.h
  • IDC_EDIT_CHECKOUTDIR : resource.h
  • IDC_EDIT_POSITION : resource.h
  • IDC_EDITENTRY : resource.h
  • IDC_EDITHOST : resource.h
  • IDC_EDITLOGOUT : resource.h
  • IDC_EDITPORT : resource.h
  • IDC_ENDBUTTON : CJResource.h
  • IDC_ENTRYSTATE : resource.h
  • IDC_ENTRYSTATE2 : resource.h
  • IDC_ENTRYSTATE3 : resource.h
  • IDC_ENTRYSTATE4 : resource.h
  • IDC_ENTRYSTATE5 : resource.h
  • IDC_EXPORT : resource.h
  • IDC_EXTDIFF : resource.h
  • IDC_EXTDIFFSEL : resource.h
  • IDC_FILETODIFF : resource.h
  • IDC_FOLDERLOC : resource.h
  • IDC_FORCE : resource.h
  • IDC_FORCECOMMIT : resource.h
  • IDC_FORCERECURSE : resource.h
  • IDC_FORCEREVISION : resource.h
  • IDC_FORCEROOT : resource.h
  • IDC_HANDCUR : CJResource.h
  • IDC_HEADER : resource.h
  • IDC_HELPINIT : resource.h
  • IDC_HOME : resource.h
  • IDC_HOMEBUTTON : CJResource.h
  • IDC_HOST : resource.h
  • IDC_HSPLITBAR : CJResource.h
  • IDC_IGNORECASE : resource.h
  • IDC_IGNOREWHITESPACE : resource.h
  • IDC_ISDATE : resource.h
  • IDC_KSERVER : resource.h
  • IDC_KSERVERPORT : resource.h
  • IDC_LAUNCHEDITOR : resource.h
  • IDC_LEFTBUTTON : CJResource.h
  • IDC_LISTENTRIES : resource.h
  • IDC_LOCATE : resource.h
  • IDC_LOGIN : resource.h
  • IDC_LOGMSG : resource.h
  • IDC_LOGMSG_WRAP : resource.h
  • IDC_LOGOUT : resource.h
  • IDC_MATCH : resource.h
  • IDC_MENULIST : resource.h
  • IDC_MERGE : resource.h
  • IDC_MERGE1 : resource.h
  • IDC_MERGE2 : resource.h
  • IDC_MODNAME : resource.h
  • IDC_NEXTTIP : resource.h
  • IDC_NODE : resource.h
  • IDC_NODRAGGING : CJResource.h
  • IDC_NOMODULEPROGRAM : resource.h
  • IDC_NORECURS : resource.h
  • IDC_NOTAGS : resource.h
  • IDC_NOUSERS : resource.h
  • IDC_ONLYRCS : resource.h
  • IDC_OPTIONDESC : resource.h
  • IDC_OPTIONSTRING : resource.h
  • IDC_OPTIONSTRING_SL : resource.h
  • IDC_OVERWRITE : resource.h
  • IDC_PASSWD : resource.h
  • IDC_PATH : resource.h
  • IDC_PROGRAM : resource.h
  • IDC_PROGRESS : resource.h
  • IDC_PROMPTEDIT : resource.h
  • IDC_PRUNE : resource.h
  • IDC_PSERVER : resource.h
  • IDC_PSERVERPORT : resource.h
  • IDC_PYTHONURL : resource.h
  • IDC_QUIET : resource.h
  • IDC_RADIOCONTROL : resource.h
  • IDC_RADIOSHIFT : resource.h
  • IDC_REMIND : resource.h
  • IDC_REMOVE : resource.h
  • IDC_RESET : resource.h
  • IDC_REV : resource.h
  • IDC_RGBBRANCH : resource.h
  • IDC_RGBDEAD : resource.h
  • IDC_RGBHEADER : resource.h
  • IDC_RGBNODE : resource.h
  • IDC_RGBSELECTION : resource.h
  • IDC_RGBSHADOW : resource.h
  • IDC_RGBSTATE : resource.h
  • IDC_RGBTAG : resource.h
  • IDC_RHOSTPORT : resource.h
  • IDC_RHOSTS : resource.h
  • IDC_RIGHTBUTTON : CJResource.h
  • IDC_RSAIDENTITY : resource.h
  • IDC_RSAIDENTITYSEL : resource.h
  • IDC_RSHNAME : resource.h
  • IDC_RTAG : resource.h
  • IDC_SELECTION : resource.h
  • IDC_SELFOLDER : resource.h
  • IDC_SERVERNAME : resource.h
  • IDC_SERVERNAME2 : resource.h
  • IDC_SETTINGS : resource.h
  • IDC_SHADOW : resource.h
  • IDC_SPECIFY_REV : resource.h
  • IDC_SPINLOGOUT : resource.h
  • IDC_STARTUP : resource.h
  • IDC_STATE : resource.h
  • IDC_STDOUT : resource.h
  • IDC_TAB_CONTROL : CJResource.h
  • IDC_TAG : resource.h
  • IDC_TAGNAME : resource.h
  • IDC_TCPIP : resource.h
  • IDC_TEMPFILE : resource.h
  • IDC_TIPSTRING : resource.h
  • IDC_UP : resource.h
  • IDC_URL_CODEJOCKEY : CJResource.h
  • IDC_USE_VIEWER_ALWAYS : resource.h
  • IDC_USEDEFIGNORE : resource.h
  • IDC_USER : resource.h
  • IDC_VSPLITBAR : CJResource.h
  • IDC_VTAG : resource.h
  • IDC_WARNINGDESC : resource.h
  • IDC_WINCVSURL : resource.h
  • IDC_WINCVSVER : resource.h
  • IDC_WORDWRAP : resource.h
  • IDC_ZLEVEL : resource.h
  • IDC_ZSPIN : resource.h
  • IDD_ABOUTBOX : resource.h
  • IDD_ADMINOPTION : resource.h
  • IDD_ALERT : resource.h
  • IDD_ANNOTATE_MAIN : resource.h
  • IDD_CHECKOUT_MAIN : resource.h
  • IDD_CHECKOUT_OPTIONS : resource.h
  • IDD_CMDLINE : resource.h
  • IDD_CMDLINE_MAIN : resource.h
  • IDD_COMMIT_MAIN : resource.h
  • IDD_COMMIT_OPTIONS : resource.h
  • IDD_CUSTOMIZE : resource.h
  • IDD_DIFF_MAIN : resource.h
  • IDD_DIFF_OPTIONS : resource.h
  • IDD_EDITMESSAGE : resource.h
  • IDD_EDITORMON : resource.h
  • IDD_ENTRYDESC : resource.h
  • IDD_GRAPH_OPTIONS : resource.h
  • IDD_IMPORT_MAIN : resource.h
  • IDD_IMPORT_TAGS : resource.h
  • IDD_IMPORTFILTER : resource.h
  • IDD_INIT_MAIN : resource.h
  • IDD_LOG_FILTERS : resource.h
  • IDD_LOG_MAIN : resource.h
  • IDD_NOPYTHON : resource.h
  • IDD_PASSWRD : resource.h
  • IDD_PREFERENCES : resource.h
  • IDD_PREFS_CVSCMD_DIALOGS : resource.h
  • IDD_PREFS_CVSROOT : resource.h
  • IDD_PREFS_GLOBALS : resource.h
  • IDD_PREFS_WINCVS : resource.h
  • IDD_PROGRESS : resource.h
  • IDD_PROMPTMESSAGE : resource.h
  • IDD_PSERVER : resource.h
  • IDD_RELEASE : resource.h
  • IDD_RSH : resource.h
  • IDD_RTAG_BRANCH : resource.h
  • IDD_RTAG_CREATE : resource.h
  • IDD_RTAG_DELETE : resource.h
  • IDD_SAVESETTINGS : resource.h
  • IDD_SSH : resource.h
  • IDD_TAG_BRANCH : resource.h
  • IDD_TAG_CREATE : resource.h
  • IDD_TAG_DELETE : resource.h
  • IDD_TIP : resource.h
  • IDD_UPDATE_MAIN : resource.h
  • IDD_UPDATE_MERGE : resource.h
  • IDD_UPDATE_STICKY : resource.h
  • IDD_WARNINGDESC : resource.h
  • IDD_YESNO : resource.h
  • IDI_CVSERROR : resource.h
  • IDI_CVSWARNING : resource.h
  • IDI_FOLDER : resource.h
  • IDI_FOLDERCVS : resource.h
  • IDI_FOLDERIGN : resource.h
  • IDI_FOLDERLOST : resource.h
  • IDI_FOLDERO : resource.h
  • IDI_FOLDEROCVS : resource.h
  • IDI_FOLDEROIGN : resource.h
  • IDM_CBAR_MENU : CJResource.h
  • IDP_FAILED_TO_CREATE : resource.h
  • IDP_OLE_INIT_FAILED : resource.h
  • IDP_SOCKETS_INIT_FAILED : resource.h
  • IDR_BROWSER : resource.h
  • IDR_CBAR_POPUP : CJResource.h
  • IDR_CNTR_INPLACE : resource.h
  • IDR_CUSTMENUS : resource.h
  • IDR_CVS_COWORKER : resource.h
  • IDR_CVSCOWORKER : resource.h
  • IDR_CVSGETOPTION : resource.h
  • IDR_FILELIST : resource.h
  • IDR_FILTER : resource.h
  • IDR_GFXOUTBAR : CJResource.h
  • IDR_GRAPH : resource.h
  • IDR_MAINFRAME : resource.h
  • IDR_MENUICONS : resource.h
  • IDR_MULTIUSER : resource.h
  • IDR_POPUP_HEX_EDIT : CJResource.h
  • IDR_POPUP_TOOLBAR : CJResource.h
  • IDR_STATEICONS : resource.h
  • IDR_TAGS : resource.h
  • IDR_WINCVSTYPE : resource.h
  • IDR_WORKSPACE : resource.h
  • IDS_COLOR_AUTO : CJResource.h
  • IDS_COLOR_CUST : CJResource.h
  • IDS_COMBOBROWSER : resource.h
  • IDS_CONTRACT : CJResource.h
  • IDS_DEFFONT : resource.h
  • IDS_ENTRY : CJResource.h
  • IDS_EXPAND : CJResource.h
  • IDS_HIDE : CJResource.h
  • IDS_INVALID_VER : CJResource.h
  • IDS_MODIFIED : CJResource.h
  • IDS_NAME : CJResource.h
  • IDS_REGKEY : CJResource.h
  • IDS_REMOVEITEM : CJResource.h
  • IDS_RENAMEITEM : CJResource.h
  • IDS_SECTION : CJResource.h
  • IDS_SETTINGS : CJResource.h
  • IDS_SIZE : CJResource.h
  • IDS_TBAR_SETTINGS : CJResource.h
  • IDS_TYPE : CJResource.h
  • IDS_WIN_PLACEMENT : CJResource.h
  • IDS_WNDPOS : CJResource.h
  • if() : logmsg.c
  • ign_add() : cvs.h, CvsIgnore.cpp
  • ign_add_file() : ignore.c, cvs.h
  • ign_case : cvs.h
  • ign_count : ignore.c
  • ign_default : ignore.c
  • ign_dir_add() : ignore.c, cvs.h
  • IGN_GROW : ignore.c
  • ign_hold : ignore.c
  • ign_inhibit_server : ignore.c, cvs.h
  • ign_list : ignore.c
  • ign_name() : ignore.c, cvs.h
  • ign_setup() : ignore.c, cvs.h
  • ign_size : ignore.c
  • ignlist : update.c
  • ignore : rcs.c
  • ignore_all_space_flag : diff.h
  • ignore_blank_lines_flag : diff.h
  • ignore_case_flag : diff.h
  • ignore_directory() : cvs.h
  • IGNORE_ENV : cvs.h
  • ignore_files() : cvs.h
  • Ignore_proc : cvs.h
  • ignore_regexp_list : diff.h
  • ignore_some_changes : diff.h
  • ignore_some_line_changes : diff.h
  • ignore_space_change_flag : diff.h
  • ignored : main.c
  • ihqxtab : hqx.c
  • IID : CVS_Coworker_i.c
  • IID_ICvsCoworker : CVS_Coworker_i.h, CVS_Coworker_i.c, cvs_coworker.h
  • IID_ITest : GraphDoc.cpp
  • IID_IWincvs : wincvsDoc.cpp
  • import() : import.c, cvs.h
  • import_descend() : import.c
  • import_descend_dir() : import.c
  • import_usage : import.c
  • in : example.c, memmove.c
  • IN_TCPIP_H : tcpip.h
  • inattic : import.c
  • INATTIC : rcs.h
  • InBetweenVSide() : UPseudoSupport.cpp
  • INCL_BASE : os2inc.h
  • INCL_DOSERRORS : dirent.c
  • INCL_DOSFILEMGR : dirent.c
  • INCL_KBD : os2inc.h
  • INCL_SUB : os2inc.h
  • inclusive : rcs.c
  • increment_revnum() : cvs.h
  • indent : side.c
  • index() : system.h
  • indicators : MainFrm.cpp
  • inf : context.c
  • InFilter() : CvsTrace.cpp
  • inflate() : zlib.h
  • inflate_block_mode : infutil.h
  • inflate_blocks_reset() : infblock.c
  • inflate_blocks_statef : infblock.h
  • inflate_codes_new() : infcodes.c
  • inflate_codes_statef : infcodes.h
  • inflate_copyright : inftrees.c
  • inflate_fast() : inffast.c
  • inflate_flush() : infutil.c
  • inflate_huft : inftrees.h
  • inflate_mask : infutil.h, infutil.c
  • inflateEnd() : zlib.h
  • inflateInit : zlib.h
  • inflateInit2 : zlib.h
  • inflateInit2_() : zlib.h
  • inflateInit_() : zlib.h
  • InflateRect() : udraw.h, udraw.cpp
  • inflateReset() : zlib.h, inflate.c
  • inflateSetDictionary() : zlib.h
  • inflateSync() : zlib.h
  • Inherited : UPseudoSupport.cpp
  • init() : mkmodules.c, cvs.h
  • init_block() : trees.c
  • INIT_BUF_SIZE : regex.c
  • INIT_COMPILE_STACK_SIZE : regex.c
  • init_error_tables() : strerror.c
  • INIT_FAIL_STACK : regex.c
  • INIT_FAILURE_ALLOC : regex.c
  • init_si() : run.c
  • init_sockets() : rcmd.c, config.h
  • INIT_STATE : deflate.h
  • init_syntax_once() : regex.c
  • init_winsock() : win32.c, config.h
  • INITIAL : lexer.cc
  • initial_crc() : hqx.c
  • initialize_all() : dll_glue.c
  • initialize_main : diff3.c, diff.c, system.h
  • InitializeInterp() : PythonGlue.cpp
  • inraw : md5.c
  • INSERT_JUMP : regex.c
  • INSERT_JUMP2 : regex.c
  • INSERT_STRING : deflate.c
  • insertBranchName() : CvsLog.cpp
  • inserted : analyze.c
  • InsertMenu : CJMenu.h
  • InsertODMenu : CJMenu.h
  • insertpt : rcs.c
  • inserts : util.c
  • insertSymbName() : CvsLog.cpp
  • INT_MAX : system.h
  • INT_STRLEN_BOUND : diff3.c
  • int_vasprintf() : vasprintf.c
  • INTEGER : parser.h, parser.cc
  • IntersectRect() : udraw.h, udraw.cpp
  • intf : zlib.h, zconf.h
  • intptr : ifdef.c
  • INVALID_Color : CJColorPopup.cpp
  • INVALID_SEQUENCE : CTCP2Parse.cpp
  • INVALID_SOCKET : rcmd.c
  • INVTAB : CustomizeMenus.cpp
  • IPos : deflate.h
  • IS_ACTIVE : regex.c
  • IS_CHAR_CLASS : regex.c
  • IS_LOGGING : CvsTrace.cpp
  • IS_PSEUDO_CTL : PseudoDlg.cpp
  • isabsolute() : filesubr.c, cvs.h, filesubr.c
  • isaccessible() : cvs.h
  • ISALNUM : regex.c
  • ISALPHA : regex.c
  • IsAppEnabled() : MainFrm.cpp
  • ISASCII : regex.c
  • ISBLANK : regex.c
  • ISCNTRL : regex.c
  • isdevice() : cvs.h
  • ISDIGIT : regex.c, system.h
  • isdir() : cvs.h
  • ISDIRSEP : config.h, system.h, config.h
  • isdirty_file() : cvs.h
  • IsDST() : Stat.cpp, win32.c
  • isfile() : cvs.h
  • ISGRAPH : regex.c
  • IsInInvertList() : CustomizeMenus.cpp
  • IsKeyMovingFocus() : LogFrm.cpp
  • IsLeapYear() : Stat.cpp, win32.c
  • islink() : cvs.h
  • ISLOWER : regex.c
  • isn : CTCP2Parse.cpp
  • ISO8559 : CvsPrefs.h
  • ISO8559_1 : CvsPrefs.h
  • ISO8559_10 : CvsPrefs.h
  • ISO8559_2 : CvsPrefs.h
  • ISO8559_3 : CvsPrefs.h
  • ISO8559_4 : CvsPrefs.h
  • ISO8559_5 : CvsPrefs.h
  • ISO8559_6 : CvsPrefs.h
  • ISO8559_7 : CvsPrefs.h
  • ISO8559_8 : CvsPrefs.h
  • ISO8559_9 : CvsPrefs.h
  • ISO8559_none : CvsPrefs.h
  • isPlainBinary() : cvs_hqx.cpp
  • ISPRINT : regex.c, system.h
  • ISPUNCT : regex.c
  • isreadable() : cvs.h
  • IsRectEmpty() : udraw.cpp
  • isremoved() : update.c
  • IsSamePath() : BrowseFileView.cpp
  • IsShellType() : CJMenu.cpp
  • ISSPACE : regex.c, system.h
  • IsTargetWindow() : wincvs_winutil.cpp
  • isTemp : wrapper.c
  • ISUPPER : regex.c, system.h
  • IsValidHandle() : wincvs.cpp
  • iswritable() : cvs.h
  • ISXDIGIT : regex.c
  • items : zutil.c

- j -
  • jmpbuf : pipe.c
  • join_file() : update.c
  • join_rev1 : update.c, checkout.c
  • join_rev2 : update.c, checkout.c
  • join_tags_validated : checkout.c
  • jump : regex.c
  • jump_n : regex.c
  • jump_past_alt : regex.c

- k -
  • k : trees.c
  • kAddSettings : Persistent.h
  • kAdminOptionDlgType : AdminOptionDlg.h
  • kAnyButSep : common.h
  • kBinHexMagic : hqx.c
  • kBinIsText : TextBinary.h
  • kBinWrongSig : TextBinary.h
  • kBlue : AppConsole.h
  • kBold : AppConsole.h
  • kBrown : AppConsole.h
  • kChangeLog : AdminOptionDlg.h
  • kClassPersistent : Persistent.h
  • kConsoleColor : AppConsole.h
  • kContinueTraversal : FileTraversal.h
  • kCopyBufLen : hqx.c
  • kCustomBrowserMenu : wincvs_winutil.h
  • kCustomFilesMenu : wincvs_winutil.h
  • kDate : common.h
  • key : recurse.c, hash.c
  • key_opt : import.c
  • keyp : rcs.c
  • keyword : rcs.c
  • KEYWORD_AUTHOR : rcs.c
  • KEYWORD_DATE : rcs.c
  • KEYWORD_HEADER : rcs.c
  • KEYWORD_ID : rcs.c
  • KEYWORD_INIT : rcs.c
  • KEYWORD_LOCKER : rcs.c
  • KEYWORD_LOG : rcs.c
  • KEYWORD_NAME : rcs.c
  • keyword_opt : import.c
  • KEYWORD_RCSFILE : rcs.c
  • KEYWORD_REVISION : rcs.c
  • KEYWORD_SOURCE : rcs.c
  • KEYWORD_STATE : rcs.c
  • keywords : rcs.c
  • KFAILURE : kclient_if.h
  • KFF_DEBUG : config.h
  • kFileIconAdded : BrowseFileView.h, UCvsFiles.cpp
  • kFileIconBinary : BrowseFileView.h, UCvsFiles.cpp
  • kFileIconBinaryAdded : BrowseFileView.h
  • kFileIconBinaryMod : BrowseFileView.h, UCvsFiles.cpp
  • kFileIconConflict : BrowseFileView.h, UCvsFiles.cpp
  • kFileIconIgnored : BrowseFileView.h, UCvsFiles.cpp
  • kFileIconMiss : BrowseFileView.h, UCvsFiles.cpp
  • kFileIconRemoved : BrowseFileView.h, UCvsFiles.cpp
  • kFileIconText : BrowseFileView.h, UCvsFiles.cpp
  • kFileIconTextMod : BrowseFileView.h, UCvsFiles.cpp
  • kFileIconUnknown : BrowseFileView.h, UCvsFiles.cpp
  • kFileInvalidName : TextBinary.h
  • kFileIsAlias : TextBinary.h
  • kFileIsOK : TextBinary.h
  • kFileMissing : TextBinary.h
  • kflag : rcs.c
  • KFLAG_B : rcs.c
  • KFLAG_K : rcs.c
  • KFLAG_KV : rcs.c
  • KFLAG_KVL : rcs.c
  • KFLAG_O : rcs.c
  • KFLAG_V : rcs.c
  • kflags : rcs.c
  • kFolderIcon : BrowseFileView.h, UCvsFiles.cpp
  • kFolderIconIgnored : BrowseFileView.h, UCvsFiles.cpp
  • kFolderIconMiss : BrowseFileView.h, UCvsFiles.cpp
  • kFolderIconUnknown : BrowseFileView.h, UCvsFiles.cpp
  • kGreen : AppConsole.h
  • kHChildSpace : GraphView.cpp, UCvsGraph.cpp
  • kHierarchicalMax : UPseudoSupport.cpp
  • kHierarchicalMin : UPseudoSupport.cpp
  • kIconFolderClosed : WinCvsBrowser.cpp, UCvsFolders.cpp
  • kIconFolderCVSClosed : WinCvsBrowser.cpp, UCvsFolders.cpp
  • kIconFolderCVSOpened : WinCvsBrowser.cpp, UCvsFolders.cpp
  • kIconFolderIgnoreClosed : WinCvsBrowser.cpp, UCvsFolders.cpp
  • kIconFolderIgnoreLost : WinCvsBrowser.cpp, UCvsFolders.cpp
  • kIconFolderIgnoreOpened : WinCvsBrowser.cpp, UCvsFolders.cpp
  • kIconFolderOpened : WinCvsBrowser.cpp, UCvsFolders.cpp
  • kind : PseudoButton.cpp
  • kInflateNodeSpace : GraphView.cpp, UCvsGraph.cpp
  • kInt : common.h
  • kItalic : AppConsole.h
  • kLocationIcon : HistComboBoxEx.h
  • kLocationIconErased : HistComboBoxEx.h
  • kLocationIconIgnored : HistComboBoxEx.h
  • kLocationIconMissing : HistComboBoxEx.h
  • kLocationIconUnknown : HistComboBoxEx.h
  • kLogNode : CvsLog.h
  • kMagenta : AppConsole.h
  • kMaxChar : ustr.cpp
  • kNL : AppConsole.h
  • kNoClass : Persistent.h
  • kNodeBranch : CvsLog.h
  • kNodeHeader : CvsLog.h
  • kNodeRev : CvsLog.h
  • kNodeShape : GraphView.h
  • kNodeTag : CvsLog.h
  • kNone : common.h
  • kNormal : AppConsole.h
  • kOctangle : GraphView.h
  • KOPT_DO_MUTUAL : kclient_if.h
  • kPathDelimiter : TextBinary.h
  • krb_get_err_text() : kclient_if.h
  • krb_sendauth() : kclient_if.h
  • kRectangle : GraphView.h
  • kRed : AppConsole.h
  • kRevnum : common.h
  • kRevnumOrNil : common.h
  • kRLEFlag : hqx.c
  • kRoundRect : GraphView.h
  • ks : modules.c
  • kserver : Authen.h
  • kserver_method : cvs.h
  • kserverInstance : Authen.cpp
  • KSession : kclient_if.h
  • kSetDescription : AdminOptionDlg.h
  • kSetState : AdminOptionDlg.h
  • kSkipFile : FileTraversal.h
  • kSpc : BrowseFileView.cpp
  • kStopTraversal : FileTraversal.h
  • kString : common.h
  • KSUCCESS : kclient_if.h
  • kTCLPathDelimiter : TclGlue.h
  • kTclRes : TclGlue.h
  • kTContinue : GraphView.cpp
  • kTextBinTYPE : TextBinary.h
  • kTextEscapeChar : TextBinary.h
  • kTextIsBinary : TextBinary.h
  • kTextWrongLF : TextBinary.h
  • kTextWrongSig : TextBinary.h
  • kTGetDown : GraphView.cpp
  • kTGraph : GraphView.cpp
  • kTokens : common.h
  • kTraversal : FileTraversal.h
  • kTraversalError : FileTraversal.h
  • kTStop : GraphView.cpp
  • kTypesDescResID : MacBinMaps.cpp
  • kTypesListResID : MacBinMaps.cpp
  • kTypesListResType : MacBinMaps.cpp
  • kUCvsFilesID : UCvsCommands.h
  • kUCvsFoldersID : UCvsCommands.h
  • kUCvsFrameID : UCvsCommands.h
  • kUCvsMenubarID : UCvsCommands.h
  • kUCvsToolbarID : UCvsCommands.h
  • kUMainConsoleID : UCvsCommands.h
  • kUMainWidget : uwidget.h
  • kUnderline : AppConsole.h
  • kVChildSpace : GraphView.cpp, UCvsGraph.cpp

- l -
  • L_CODES : deflate.h
  • L_ERROR : lock.c
  • L_LOCKED : lock.c
  • L_OK : lock.c
  • L_tmpnam : filesubr.c
  • label : context.c
  • label1 : rcscmds.c
  • label2 : rcscmds.c
  • LARGEST_FWRITE : rcs.c
  • last0 : util.c
  • last1 : util.c
  • last_backto : history.c
  • last_block : diff3.c
  • last_component() : cvs.h
  • last_diff3 : diff3.c
  • last_entry : history.c
  • last_nonopt : getopt.c
  • last_register_time : update.c, commit.c
  • last_since_tag : history.c
  • last_using : diff3.c
  • launchCVS() : AppGlue.h, AppGlue.cpp
  • LaunchDiff() : CvsPrefs.h, CvsPrefs.cpp
  • LaunchEditor() : CvsPrefs.h, CvsPrefs.cpp
  • LaunchViewer() : CvsPrefs.h, CvsPrefs.cpp
  • LayoutRowCol() : GfxSplitterWnd.cpp
  • lc : trees.c
  • lcodes : trees.c
  • leadingchar : diff3.c
  • LEAVE : infutil.h
  • len : trees.c, gzio.c, crc32.c, adler32.c, subr.c, server.c, rcscmds.c, rcs.c, log.c, md5.c, util.c
  • Len : deflate.h
  • length : memmove.c, ftruncate.c
  • length_code : trees.c
  • LENGTH_CODES : deflate.h
  • lengths1 : diff3.c
  • lengths2 : diff3.c
  • lenp : rcs.c, diff.c, context.c
  • LENS : infutil.h
  • letter : update.c, ifdef.c
  • level : deflate.c
  • lf : ImportFilter.cpp
  • LF : hqx.c
  • LIBID_CVS_COWORKERLib : CVS_Coworker_i.h, CVS_Coworker_i.c, cvs_coworker.h
  • limit : util.c, diff3.c
  • limit1 : side.c
  • line : subr.c, expand_path.c, util.c
  • line1 : analyze.c
  • line2argv() : cvs.h
  • line_class : diff.h
  • line_cmp() : diff.h
  • line_flag : util.c
  • line_format : diff.h
  • linenum : context.c
  • linep : context.c
  • linevector_add() : rcs.c
  • linevector_copy() : rcs.c
  • linevector_delete() : rcs.c
  • linevector_free() : rcs.c
  • linevector_init() : rcs.c
  • link() : vms.h, unlink.c
  • links2 : hardlink.c
  • List : hash.h
  • list : find_names.c
  • LIST : hash.h
  • list2 : diff3.c
  • list_add_type() : ImportFilter.cpp
  • list_add_warning() : ImportFilter.cpp
  • list_all_types_recur() : ImportFilter.h, ImportFilter.cpp
  • listAddCell() : dll_garbage.c
  • listcache : hash.c
  • listFree() : dll_garbage.c
  • listNew() : dll_garbage.c
  • LITERALS : deflate.h
  • ll_delete() : popen.c
  • ll_insert() : popen.c
  • LL_KEY : popen.c
  • ll_lookup() : popen.c
  • LL_VAL : popen.c
  • lm_init() : deflate.c
  • lnum : util.c
  • LOAD : infutil.h
  • loadCVS() : AppGlue.mac.h, AppGlue.mac.cpp
  • LoadDIB() : dib.h, dib.c
  • LOADIN : infutil.h
  • LOADOUT : infutil.h
  • LoadPersistentSettings() : Persistent.h, Persistent.cpp
  • loadSettingsInternal() : Persistent.cpp
  • local : Authen.h, update.c, tag.c, status.c, rtag.c, remove.c, recurse.c, patch.c, lock.c, edit.c, zutil.h, minigzip.c, crc32.c
  • local_method : cvs.h
  • local_specified : rtag.c, patch.c, modules.c, checkout.c
  • localInstance : Authen.cpp
  • LocalSystemTimeToUtcSystemTime() : Stat.cpp, win32.c
  • localtime() : getdate.c
  • locate_rcs() : commit.c
  • LOCK : hash.h
  • Lock_Cleanup() : cvs.h
  • lock_dir : lock.c, cvs.h
  • lock_dir_for_write() : cvs.h
  • lock_error : lock.c
  • lock_filesdoneproc() : lock.c
  • lock_name() : lock.c
  • lock_obtained() : lock.c
  • lock_quiet : rcs.c
  • lock_RCS() : commit.c
  • lock_simple_remove() : lock.c
  • lock_tree_for_write() : cvs.h
  • lock_tree_list : lock.c
  • lock_wait() : lock.c
  • locked_dir : lock.c
  • locked_list : lock.c
  • lockers_name : lock.c
  • locklist : lock.c
  • log : rcs.c
  • log_abranch() : log.c
  • LOG_API_FN : CvsTrace.h
  • LOG_API_N : CvsTrace.h
  • LOG_API_S : CvsTrace.h
  • LOG_API_X : CvsTrace.h
  • log_branch() : log.c
  • LOG_BUFFER : CvsTrace.h
  • log_count() : log.c
  • log_count_print() : log.c
  • log_dirproc() : log.c
  • log_expand_revlist() : log.c
  • log_fileproc() : log.c
  • log_fix_singledate() : log.c
  • log_free_revlist() : log.c
  • log_parse_date() : log.c
  • log_parse_list() : log.c
  • log_parse_revlist() : log.c
  • Log_printf() : CvsTrace.h, CvsTrace.cpp
  • log_symbol() : log.c
  • log_tree() : log.c
  • log_usage : log.c
  • log_version() : log.c
  • log_version_requested() : log.c
  • LogAttach() : CvsTrace.h
  • LogBuffer() : CvsTrace.h, CvsTrace.cpp
  • LogCleanup() : CvsTrace.h, CvsTrace.cpp
  • logfile : commit.c
  • logfile_write() : logmsg.c
  • logfp : logmsg.c, import.c
  • logfunc : lsh_dll.h
  • logHistory : parseinfo.c, history.c
  • login : pwd.c
  • login_shell : pwd.c
  • login_strings : pwd.c
  • loginfo_contents : mkmodules.c
  • LogInitialize() : CvsTrace.h, CvsTrace.cpp
  • loglen : rcs.c
  • logoff : main.c, cvs.h
  • LogSetFilter() : CvsTrace.h, CvsTrace.cpp
  • LogString() : CvsTrace.h, CvsTrace.cpp
  • LogWrite() : CvsTrace.cpp
  • long_format : status.c
  • long_only : getopt.c
  • long_options : main.cpp, getopt1.c
  • longest_match() : deflate.c
  • longind : getopt.c
  • longopts : diff.c, getopt.c, diff3.c, getopt.c
  • lookup_command_attribute() : cvs.h
  • lookup_env() : pwd.c
  • lookup_file_by_inode() : hardlink.c
  • LookupWord() : getdate.y, getdate.c
  • low1 : diff3.c
  • low2 : diff3.c
  • low_thread : diff3.c
  • lr : history.c
  • lseek() : system.h
  • lsh_canread() : lsh_dll.h
  • lsh_canwrite() : lsh_dll.h
  • lsh_current() : lsh_dll.h
  • lsh_delete() : lsh_dll.h
  • lsh_getprefsd() : lsh_dll.h
  • lsh_init() : lsh_dll.h
  • lsh_new() : lsh_dll.h
  • lsh_read() : lsh_dll.h
  • lsh_running() : lsh_dll.h
  • lsh_terminate() : lsh_dll.h
  • lsh_write() : lsh_dll.h
  • lsh_yield() : lsh_dll.h
  • lshctx : lsh_dll.h
  • lstat : StdAfx.h, config.h, system.h
  • ltree : trees.c

- m -
  • m : inftrees.c
  • m_rectActualFrameSize : CJDockContext.cpp
  • m_rectActualSize : CJDockContext.cpp
  • m_rectFrameBorders : CJDockContext.cpp
  • m_rectRequestedSize : CJDockContext.cpp
  • m_type : modules.c, checkout.c
  • MA_CHECK : UPseudoSupport.cpp
  • MA_DEFINE_CLASS_M0() : UPseudoSupport.cpp
  • MA_DEFINE_CLASS_M1() : UPseudoSupport.cpp
  • MAC_APPSINGLE : CvsPrefs.h
  • mac_duplicate() : cvs_hqx.h, cvs_hqx.cpp
  • MAC_HQX : CvsPrefs.h
  • macapp_workaround_adlib_bug() : UPseudoSupport.h, UPseudoSupport.cpp
  • MACENCODING : CvsPrefs.h
  • macFileToFileStream() : apsingle.c
  • macos_access() : macos_filesys.c, config.h
  • macos_chdir() : macos_filesys.c, config.h
  • macos_chmod() : macos_filesys.c, config.h
  • macos_cleanup() : mac_run.c, config.h
  • macos_creat() : macos_filesys.c, config.h
  • macos_fixpath() : macos_filesys.c, cvs_hqx.cpp
  • macos_fopen() : macos_filesys.c, config.h
  • macos_initialize() : mac_run.c, config.h
  • macos_lstat() : macos_filesys.c, config.h
  • macos_mkdir() : macos_filesys.c, config.h
  • macos_open() : macos_filesys.c, config.h
  • macos_opendir() : macos_filesys.c, config.h
  • macos_rename() : macos_filesys.c, config.h
  • macos_rmdir() : macos_filesys.c, config.h
  • macos_shutdown_server() : server_if.c, config.h
  • macos_start_server() : server_if.c, config.h
  • macos_stat() : macos_filesys.c, config.h
  • macos_unlink() : macos_filesys.c, config.h
  • macpp_fecthview() : UPseudoSupport.h, UPseudoSupport.cpp
  • macpp_findwindow() : UPseudoSupport.cpp
  • macpp_getattachwindow() : UPseudoSupport.h, UPseudoSupport.cpp
  • macpp_getcmdid() : UPseudoSupport.cpp
  • macpp_linkbroadcasters() : UPseudoSupport.h, UPseudoSupport.cpp
  • macpp_preparetable() : UPseudoSupport.h, UPseudoSupport.cpp
  • MACROS_FOLDER : MacrosSetup.h
  • MacrosFlushAll() : MacrosSetup.cpp
  • MacrosGetLoc() : MacrosSetup.h, MacrosSetup.cpp
  • MacrosReloadAll() : MacrosSetup.h, MacrosSetup.cpp
  • MACSPEC : ImportFilter.cpp
  • main : main.cpp, minigzip.c, example.c, pc.c, dll_glue.c, cvsgui.c, cvsgui.h
  • make_3way_diff() : diff3.c
  • Make_Date() : cvs.h
  • make_directories() : cvs.h
  • make_directory() : cvs.h
  • make_message_rcslegal() : cvs.h
  • make_tempfile() : mkmodules.c
  • MakeOleVariant() : CJHtmlView.cpp
  • MakeTmpFile() : TextBinary.h, TextBinary.cpp
  • malloc : vasprintf.c, system.h, strerror.c, sighandle.c, regex.c, getline.c, system.h, getline.c, ndir.c, dll_garbage.h
  • malloc_error() : scc.c
  • mapping : diff3.c
  • mark_ignorable() : context.c
  • marker : hash.c
  • masterlist_delproc() : tag.c, rtag.c, commit.c
  • masterlock : lock.c
  • MATCH_MAY_ALLOCATE : regex.c
  • MATCH_NULL_UNSET_VALUE : regex.c
  • MATCHED_SOMETHING : regex.c
  • MatchIgnoredList() : CvsIgnore.h, CvsIgnore.cpp
  • MATCHING_IN_FIRST_STRING : regex.c
  • MatchToken() : wincvs.cpp
  • MAX : udraw.cpp, trees.c, strerror.c, regex.c
  • max : system.h
  • MAX_ARGS : TextBinary.h
  • MAX_BITS : deflate.h
  • MAX_BL_BITS : trees.c
  • MAX_BUF_SIZE : regex.c
  • MAX_BUFLEN : TipDlg.cpp
  • MAX_CHAR_BY_LINE : wincvsView.h
  • MAX_CMD_LEN : TextBinary.h
  • max_code : trees.c
  • MAX_ColorS : CJColorPopup.cpp
  • MAX_DATE : CJDateTimeCtrl.cpp
  • MAX_DIST : deflate.h
  • MAX_INCR : subr.c
  • max_insert_length : deflate.h
  • MAX_MACBIN_DESC : MacBinMaps.h
  • MAX_MATCH : zutil.h
  • MAX_MEM_LEVEL : zconf.h
  • MAX_NAME_LEN : minigzip.c
  • MAX_PATH : FileTraversal.h
  • MAX_PRINT_ARG : CvsArgs.cpp
  • MAX_REGNUM : regex.c
  • max_rev() : rcs.c
  • MAX_TEST_SIZE : TextBinary.cpp
  • MAX_TIME_BUFFER_SIZE : CJDateTimeCtrl.cpp
  • MAX_VALUE_LEN : GetValue.h
  • MAX_WBITS : zconf.h
  • MAXDATELEN : cvs.h
  • MAXHOSTNAMELEN : main.c
  • MAXI_H_DISABLE : CJControlBar.h
  • MAXI_H_ENABLED : CJControlBar.h
  • MAXI_V_DISABLE : CJControlBar.h
  • MAXI_V_ENABLED : CJControlBar.h
  • MAXNAMLEN : ndir.h
  • maybe_pop_jump : regex.c
  • MD5STEP : md5.c
  • memchr() : system.h
  • memcmp : system.h
  • memcpy : system.h
  • memLevel : deflate.c
  • memmove() : memmove.c
  • memset() : strerror.c
  • MER24 : getdate.c
  • MERam : getdate.c
  • merge : diff3.c
  • merge_file() : update.c
  • merging : update.c
  • MERIDIAN : getdate.c
  • Meridian : getdate.c
  • MERpm : getdate.c
  • message : diff.h, rcs.c, logmsg.c, error.c, commit.c, checkin.c, add.c
  • message5() : diff.h
  • messagep : logmsg.c
  • method : deflate.c
  • method_names : root.c, cvs.h
  • mfile : rtag.c, patch.c, checkout.c
  • MIDL_PROC_FORMAT_STRING : CVS_Coworker_p.c
  • MIDL_TYPE_FORMAT_STRING : CVS_Coworker_p.c
  • MIDL_user_allocate() : CVS_Coworker_i.h, cvs_coworker.h
  • MIDL_user_free() : CVS_Coworker_i.h, cvs_coworker.h
  • might_not_exist : update.c
  • MilitaryTable : getdate.c, getdate.y, getdate.c
  • MIN : udraw.cpp, regex.c
  • min : system.h
  • MIN_CHUNK : getline.c
  • MIN_DATE : CJDateTimeCtrl.cpp
  • MIN_IDLE : uevent.cpp
  • MIN_INCR : subr.c
  • MIN_LOOKAHEAD : deflate.h, deflate.c
  • MIN_MATCH : zutil.h
  • minimal : analyze.c
  • Minutes : getdate.c
  • minVer : findtcl.cpp
  • MIRC_TRANSPARENT : CTCP2Parse.cpp
  • mkdir : mkdir.c, config.h
  • mkdir_if_needed() : cvs.h
  • mkmodules() : mkmodules.c, cvs.h
  • mname : rtag.c, patch.c, modules.c
  • mod_count : history.c
  • mod_list : history.c
  • mod_max : history.c
  • mode : gzio.c, run.c, filesubr.c, pipe.c, filesubr.c, subr.c, run.c, filesubr.c, run.c, filesubr.c, mac_filesubr.c, filesubr.c
  • mode_t : config.h, vms.h, config.h
  • modelRecursive : BrowseViewColumn.cpp
  • modelRegular : BrowseViewColumn.cpp
  • modified : history.c
  • ModifyODMenu : CJMenu.h
  • module : history.c
  • MODULE : pipe.c
  • MODULE_INCREMENT : history.c
  • module_report : history.c
  • MODULE_SIZE : dll_garbage.c
  • module_sort : history.c
  • modules_contents : mkmodules.c
  • month_len : Stat.cpp, win32.c
  • month_names : Stat.cpp
  • month_printname() : rcs.c
  • MonthDayTable : getdate.c, getdate.y, getdate.c
  • msg : rtag.c, patch.c, modules.c, checkout.c
  • msg_chain : util.c
  • msg_chain_end : util.c
  • mtlist : tag.c, rtag.c
  • mtype : cvs.h
  • mulist : commit.c
  • MULTIBYTE_FORM_LENGTH : regex.c
  • mwhere : rtag.c, patch.c, checkout.c
  • my_index() : getopt.c
  • my_pipe() : run.c
  • my_whitespace : rcs.c
  • MyDest() : cvs_hqx.cpp
  • myflush() : cvsgui.c
  • MyNameFilter() : cvs_hqx.cpp
  • myread() : diff3.c
  • MySource() : cvs_hqx.cpp
  • mystrdup() : CvsArgs.cpp
  • myTcl_CreateInterp() : TclGlue.cpp

- n -
  • n : inftrees.c, infblock.c, subr.c, waitpid.c
  • N_MAX : inftrees.c
  • name : rcs.c, lock.c, history.c, system.c
  • name0 : diff.c
  • name1 : diff.c
  • Name_Repository() : repos.c, cvs.h
  • Name_Root() : root.c, cvs.h
  • nameColumn : BrowseViewColumn.cpp
  • namelen : hostname.c
  • NAMESPACE : MultiString.h
  • nametag : rcs.c
  • namevalsep : fileattr.c
  • NAMLEN : system.h
  • nbuckets : io.c
  • nchars : filesubr.c, mac_filesubr.c, filesubr.c
  • ncheck_fileproc() : edit.c
  • NCOLORSHADES : CJControlBar.cpp
  • nd : inftrees.c
  • NDBMNODE : hash.h
  • NDIR_H : ndir.h
  • NEED_DECOY_PERMISSIONS : config.h
  • need_more : deflate.c
  • NEEDBITS : infutil.h
  • NEEDBYTE : infutil.h, inflate.c
  • NEEDOUT : infutil.h
  • NEW : diff.h, uwidget.cpp, utoolbar.cpp, UPseudoSupport.cpp, CvsLog.cpp, TclGlue.cpp, PythonGlue.cpp, Persistent.cpp, ImportFilter.cpp, CvsEntries.cpp
  • newdtext : rcs.c
  • newfd : dup2.c
  • newsize : subr.c
  • next : inftrees.c, inffast.c, infcodes.c
  • next0 : side.c
  • next1 : side.c
  • NEXT_BAR : history.c
  • next_line : ifdef.c
  • NEXTBYTE : infutil.h, inflate.c
  • nextchar : getopt.c
  • nextLine() : PseudoButton.cpp
  • ngroups : pwd.h
  • NIL : deflate.c
  • nl : diff3.c
  • nlines : rcs.c
  • NM_FOLDERCHANGE : GfxOutBarCtrl.h
  • NM_OB_DRAGITEM : GfxOutBarCtrl.h
  • NM_OB_ITEMCLICK : GfxOutBarCtrl.h
  • NM_OB_ITEMHOVER : GfxOutBarCtrl.h
  • NM_OB_ONGROUPENDEDIT : GfxOutBarCtrl.h
  • NM_OB_ONLABELENDEDIT : GfxOutBarCtrl.h
  • NMAX : adler32.c
  • nMonthDays : CJDateTimeCtrl.cpp
  • no_argument : getopt.h
  • NO_CLIENT_GZIP_PROCESS : config.h
  • no_details_flag : diff.h
  • no_diff_means_no_output : diff.h
  • No_Difference() : no_diff.c, cvs.h
  • no_discards : diff.c, analyze.c
  • NO_EXT_METHOD : config.h
  • NO_HIGHEST_ACTIVE_REG : regex.c
  • NO_LOWEST_ACTIVE_REG : regex.c
  • no_op : regex.c
  • NO_SLASH_AFTER_HOME : config.h
  • NO_SOCKET_TO_FD : config.h, options.h, config.h
  • NODE : lexer.cc
  • Node : hash.h
  • nodecache : hash.c
  • nodetypestring() : hash.c
  • noexec : main.c, cvs.h
  • nonbranch : update.c, entries.c, create_adm.c
  • nonbranchp : entries.c
  • NONE : CJControlBar.h
  • NORM_H_DISABLE : CJControlBar.h
  • NORM_H_ENABLED : CJControlBar.h
  • NORM_V_DISABLE : CJControlBar.h
  • NORM_V_ENABLED : CJControlBar.h
  • Normal : CJMenu.h
  • NormalizeFn() : GraphDoc.cpp
  • notify_args : edit.c
  • notify_contents : mkmodules.c
  • notify_proc() : edit.c
  • notwordbound : regex.c
  • notwordchar : regex.c
  • now : getdate.c
  • NT_UNKNOWN : hash.h
  • ntserver : Authen.h
  • ntype : hash.h
  • Ntype : hash.h
  • NULL : regex.c, getopt1.c
  • num : diff3.c
  • NUM_COLUMNS : CJColorPopup.cpp, UCvsFiles.cpp
  • NUM_CVSROOT : CvsPrefs.h
  • num_error_names : strerror.c
  • NUM_FAILURE_ITEMS : regex.c
  • NUM_FILES : scc.c
  • NUM_NONREG_ITEMS : regex.c
  • NUM_REG_ITEMS : regex.c
  • NumberToString_US() : UPseudoSupport.cpp
  • numdots() : cvs.h
  • numtag : tag.c, rtag.c
  • numtag_validated : rtag.c

- o -
  • O_BINARY : config.h
  • O_RDONLY : system.h
  • OB_CYBUTTON : CJOutlookBar.h
  • Object_StubDesc : CVS_Coworker_p.c
  • OBM_CHECK : CJMenu.cpp
  • OBN_SELENDOK : CJOutlookBar.h
  • OCTANGLE_COUNT : GraphView.h
  • OF : infutil.h, inftrees.h, inffast.h, infcodes.h, infblock.h, zconf.h
  • OFFSET : UPseudoSupport.cpp
  • OffsetRect() : udraw.h, udraw.cpp
  • OLD : diff.h
  • old : analyze.c
  • omodule : checkout.c
  • ON_CHGCURSOR : umain.h
  • ON_CHGFOCUS : umain.h
  • ON_COMBO_APPEND : umain.h
  • ON_COMBO_DELSEL : umain.h
  • ON_COMBO_ENABLESEL : umain.h
  • ON_COMBO_GETCOUNT : umain.h
  • ON_COMBO_GETMENU : umain.h
  • ON_COMBO_GETSEL : umain.h
  • ON_COMBO_RESETALL : umain.h
  • ON_COMBO_SEL : umain.h
  • ON_COMBO_SEL_RANGE : umain.h
  • ON_COMBO_SETSEL : umain.h
  • ON_CUSTOM_DRAW : umain.h
  • ON_CUSTOM_DRAW_RANGE : umain.h
  • ON_DRAGQUERY : umain.h
  • ON_DRAGQUERY_RANGE : umain.h
  • ON_DROPIT : umain.h
  • ON_DROPIT_RANGE : umain.h
  • ON_DROPQUERY : umain.h
  • ON_DROPQUERY_CMDID : umain.h
  • ON_DROPQUERY_RANGE : umain.h
  • ON_DROPREF : umain.h
  • ON_EDITACTIVATE : umain.h
  • ON_EDITACTIVATE_RANGE : umain.h
  • ON_EDITCHANGE : umain.h
  • ON_EDITCHANGE_RANGE : umain.h
  • ON_ENABLECMD : umain.h
  • on_failure_jump : regex.c
  • on_failure_keep_string_jump : regex.c
  • ON_FETCHCMD : umain.h
  • ON_GET_SLIDERPROP : umain.h
  • ON_GETFLOAT : umain.h
  • ON_GETTEXT : umain.h
  • ON_INIT_TAB_WIDGET : umain.h
  • ON_INIT_WIDGET : umain.h
  • ON_INVALIDATE : umain.h
  • ON_KEYDOWN : umain.h
  • ON_LIST_ADDCOLUMNS : umain.h
  • ON_LIST_ADDSEL : umain.h
  • ON_LIST_DBLCLICK : umain.h
  • ON_LIST_DELROW : umain.h
  • ON_LIST_GETINFO : umain.h
  • ON_LIST_GETNEXT : umain.h
  • ON_LIST_GETNEXTSEL : umain.h
  • ON_LIST_INSERT : umain.h
  • ON_LIST_NEWROW : umain.h
  • ON_LIST_RESETALL : umain.h
  • ON_LIST_RESORT : umain.h
  • ON_LIST_ROWGETDATA : umain.h
  • ON_LIST_ROWSETDATA : umain.h
  • ON_LIST_SELCOLUMN : umain.h
  • ON_LIST_SELECTING : umain.h
  • ON_LIST_SETCOLTITLE : umain.h
  • ON_LIST_SETCOLWIDTH : umain.h
  • ON_LIST_SETFEEDBACK : umain.h
  • ON_PAGE_CHANGED : umain.h
  • ON_QUERYSTATE : umain.h
  • ON_REDRAW : umain.h
  • ON_RESIZE : umain.h
  • ON_SCROLLCHANGE : umain.h
  • ON_SCROLLCHANGE_RANGE : umain.h
  • ON_SET_SLIDER : umain.h
  • ON_SET_SLIDERPROP : umain.h
  • ON_SETCURSOR : umain.h
  • ON_SETFLOAT : umain.h
  • ON_SETSTATE : umain.h
  • ON_SETTEXT : umain.h
  • ON_SHOW_WIDGET : umain.h
  • ON_SHOW_WIDGET_RANGE : umain.h
  • ON_TB_BUTTON : umain.h
  • ON_TB_CHECKBTN : umain.h
  • ON_TB_DROPDOWN : umain.h
  • ON_TB_END : umain.h
  • ON_TB_GETCOLOR : umain.h
  • ON_TB_INIT : umain.h
  • ON_TB_SEPARATOR : umain.h
  • ON_TIMER : umain.h
  • ON_TREE_DELETE : umain.h
  • ON_TREE_EXPAND : umain.h
  • ON_TREE_EXPANDING : umain.h
  • ON_TREE_GETINFO : umain.h
  • ON_TREE_GETSEL : umain.h
  • ON_TREE_INSERT : umain.h
  • ON_TREE_RESETALL : umain.h
  • ON_TREE_SELECT : umain.h
  • ON_TREE_SELECTING : umain.h
  • ON_TREE_SETDATA : umain.h
  • ON_TREE_SETICON : umain.h
  • ON_UBTNDBLDOWN : umain.h
  • ON_UBTNDOWN : umain.h
  • ON_UBTNUP : umain.h
  • ON_UCOMMAND : umain.h
  • ON_UCOMMAND_RANGE : umain.h
  • ON_UCOMMAND_RANGEEX : umain.h
  • ON_UCREATE : umain.h
  • ON_UDESTROY : umain.h
  • ON_UENTER : umain.h
  • ON_UEXPOSE : umain.h
  • ON_UGETLLOC : umain.h
  • ON_ULEAVE : umain.h
  • ON_UMMOVE : umain.h
  • ON_UNOTIFY : umain.h
  • ON_UPDATEFOCUS : umain.h
  • ON_UPDATEUI : umain.h
  • ON_USETLLOC : umain.h
  • ON_USETTOOLTIP : umain.h
  • ON_UUPDATECMD : umain.h
  • ON_UUPDATECMD_RANGE : umain.h
  • onFilteringChanged() : BrowseFileView.cpp
  • onFilterMaskEntered() : MainFrm.cpp
  • onIgnoreChanged() : WinCvsBrowser.cpp
  • onoff_fileproc() : edit.c
  • onoff_filesdoneproc() : edit.c
  • op : rcs.c
  • open : config.h
  • OPEN_BINARY : system.h
  • open_cvs_process : cvsgui_process.cpp
  • open_file() : cvs.h
  • open_module() : modules.c, cvs.h
  • opendir : ndir.h, ndir.c, ndir.h, ndir.c, ndir.h, ndir.c, dirent.h, dirent.c, config.h
  • opened_a_socket : startserver.c
  • OpenProject() : CVS_Coworker_i.h, cvs_coworker.h
  • opt : admin.c
  • opt_index : getopt1.c
  • opt_usage : main.c
  • optarg : getopt.h, getopt.c, getopt.h, getopt.c, config.h
  • optentries : find_names.c
  • opterr : getopt.h, getopt.c, getopt.h, getopt.c, config.h
  • optind : getopt.h, getopt.c, getopt.h, getopt.c, config.h
  • option_list() : diff.c
  • optional_argument : getopt.h
  • optionColumn : BrowseViewColumn.cpp
  • options : waitpid.c, vers_ts.c, update.c, rcscmds.c, rcs.c, patch.c, entries.c, diff.c, commit.c, classify.c, checkout.c, checkin.c, add.c, waitpid.c, getopt1.c
  • optlist : argmatch.c
  • optopt : getopt.h, getopt.c, getopt.h, getopt.c, config.h
  • opts : rcscmds.c, diff.c
  • opts_allocated : diff.c
  • optstring : getopt.c
  • ordering : getopt.c
  • ORIG_NAME : gzio.c
  • os2_chdir() : config.h
  • OS2_filename_classes : config.h
  • os2_fnmatch() : config.h
  • os2_initialize() : system.c, config.h
  • os2_mkdir() : mkdir.c, config.h
  • os2_shutdown_server() : startserver.c, config.h
  • os2_start_server() : startserver.c, config.h
  • os2_stat() : config.h
  • OS_CODE : zutil.h
  • OSTREAM : CvsLog.h
  • OtherTable : getdate.c, getdate.y, getdate.c
  • out : minigzip.c, rcscmds.c, diff3.c, diff.c
  • out_bound : side.c
  • OUTBYTE : infutil.h
  • outfile : diff3.c, diff.h
  • OUTLINE : CJControlBar.h
  • outlog : cvsgui.c
  • outname : cvsgui.c
  • output_1_line() : diff.h
  • OUTPUT_CONTEXT : diff.h
  • output_diff3() : diff3.c
  • output_diff3_edscript() : diff3.c
  • output_diff3_merge() : diff3.c
  • OUTPUT_ED : diff.h
  • OUTPUT_FORWARD_ED : diff.h
  • OUTPUT_IFDEF : diff.h
  • output_in_progress : util.c
  • OUTPUT_NORMAL : diff.h
  • output_placement : diff3.c
  • OUTPUT_RCS : diff.h
  • OUTPUT_SDIFF : diff.h
  • output_style : diff.h
  • OUTPUT_UNIFIED : diff.h
  • outputXML() : PythonGlue.cpp
  • outseek : cvsgui.c
  • overlap_only : diff3.c

- p -
  • p : hash.c, entries.c, checkout.c
  • p2cstrcpy() : cvs_hqx.cpp
  • P_MacBinMaps : MacBinMaps.cpp
  • paginate_flag : diff.h
  • PaletteSize() : dib.h, dib.c
  • PARAMS : cmpbuf.h, system.h
  • parent : entries.c
  • pargc : filesubr.c, mac_filesubr.c, filesubr.c
  • pargv : filesubr.c, mac_filesubr.c, system.c, filesubr.c
  • parse_config() : cvs.h
  • parse_cvsroot() : root.c, cvs.h
  • Parse_Info() : parseinfo.c, cvs.h
  • ParseTag() : cvs.h
  • ParseUMENU() : PythonImpl.cpp
  • part : analyze.c
  • PARTIAL : rcs.h
  • patch() : patch.c, cvs.h
  • PATCH : cvs.h
  • patch_cleanup() : patch.c
  • patch_dirproc() : patch.c
  • patch_fileproc() : patch.c
  • patch_proc() : patch.c
  • PATCH_PROGRAM : options.h
  • patch_short : patch.c
  • patch_usage : patch.c
  • PATFETCH : regex.c
  • PATFETCH_RAW : regex.c
  • path : rcscmds.c
  • PATH_INCR : xgetwd.c
  • PATH_MAX : cvs.h, system.h
  • pathColumn : BrowseViewColumn.cpp
  • pathname_levels() : cvs.h
  • PathNameFromDirID() : VolsPaths.h, VolsPaths.c
  • PathNameFromWD() : VolsPaths.h, VolsPaths.c
  • pattern : diff.c
  • PATUNFETCH : regex.c
  • pclose : pipe.h, popen.h, popen.c, mac_run.c, config.h
  • PERMUTE : getopt.c
  • perror_with_name() : util.c, diff3.c, diff.h
  • PERSISTENT_CAST : Persistent.h
  • persistentAdded() : BrowseViewModel.cpp
  • persistentChanged() : BrowseViewModel.cpp
  • persistentConflicts() : BrowseViewModel.cpp
  • persistentHideUnknown() : BrowseViewModel.cpp
  • persistentIgnore() : BrowseViewModel.cpp
  • persistentMissing() : BrowseViewModel.cpp
  • persistentRecursive() : BrowseViewModel.cpp
  • persistentRemoved() : BrowseViewModel.cpp
  • persistentUnknown() : BrowseViewModel.cpp
  • pfatal_with_name() : diff.h
  • pfn : rcs.c
  • pfp : rcs.c
  • phead : pipe.c
  • pid_ll : popen.c
  • pid_t : config.h, pwd.h, config.h
  • pidp : run.c
  • piError : CVS_Coworker_i.h, cvs_coworker.h
  • pipe_t : cvsgui_wire.h
  • piped_child() : run.c, pc.c, cvs.h, mac_run.c
  • piped_child_done() : piped_child.c
  • piped_child_exit_handler_block : piped_child.c
  • piped_child_exith() : piped_child.c
  • piped_child_shutdown() : pc.c
  • pipeout : update.c, classify.c, checkout.c
  • pipestatus : logmsg.c
  • platform_calloc : dll_garbage.c
  • platform_free : dll_garbage.c
  • platform_malloc : dll_garbage.c
  • platform_realloc : dll_garbage.c
  • pointer : ndir.c
  • POINTER_TO_OFFSET : regex.c
  • polish : rcs.c
  • poolPtr : dll_garbage.c
  • POP_FAILURE_ELT : regex.c
  • POP_FAILURE_INT : regex.c
  • pop_failure_jump : regex.c
  • POP_FAILURE_POINT : regex.c
  • POP_FAILURE_POINTER : regex.c
  • popen : pipe.h, pipe.c, popen.h, popen.c, config.h
  • popenRW() : popen.h, popen.c
  • pos : rcs.c
  • Pos : deflate.h
  • POS_ADDR_VSTRING : regex.c
  • pos_repos : diff.c
  • Posf : deflate.h
  • posixly_correct : getopt.c
  • PP_PASTE : version_fu.h, win32.c
  • PP_STRINGIZE : version_fu.h, win32.c
  • pqdownheap() : trees.c
  • pqremove : trees.c
  • pr_context_hunk() : context.c
  • pr_forward_ed_hunk() : ed.c
  • pr_forward_ed_script() : diff.h
  • pr_unidiff_hunk() : context.c
  • prcsbuf : rcs.c
  • PREAMBLE : CvsCoworker.cpp
  • precommit_list_proc() : commit.c
  • precommit_proc() : commit.c
  • PREFETCH : regex.c
  • prefix : logmsg.c
  • preload_update_dir : update.c, checkout.c
  • prepare_text_end() : io.c
  • preserve_perms : rcs.h, rcs.c
  • PRESET_DICT : zutil.h
  • pretag_list_proc() : tag.c, rtag.c
  • pretag_proc() : tag.c, rtag.c
  • pretend_binary : io.c
  • print() : LogParse.cpp
  • print_1_line() : diff.h
  • print_1sdiff_line() : side.c
  • print_context_header() : diff.h
  • print_context_label() : context.c
  • print_context_number_range() : context.c
  • print_context_script() : diff.h
  • print_ed_hunk() : ed.c
  • print_ed_script() : ed.c, diff.h
  • print_file_same_flag : diff.h
  • print_half_line() : side.c
  • print_ifdef_hunk() : ifdef.c
  • print_ifdef_lines() : ifdef.c
  • print_ifdef_script() : ifdef.c, diff.h
  • print_message_queue() : diff.h
  • print_normal_hunk() : normal.c
  • print_normal_script() : normal.c, diff.h
  • print_number_range() : diff.h
  • print_rcs_hunk() : ed.c
  • print_rcs_script() : diff.h
  • print_script() : diff.h
  • print_sdiff_common_lines() : side.c
  • print_sdiff_hunk() : side.c
  • print_sdiff_script() : side.c, diff.h
  • print_unidiff_number_range() : context.c
  • printable_date() : rcs.c
  • printf_output() : diff3.c, diff.h
  • printfun : util.c
  • printlist() : hash.c
  • printlock_proc() : log.c
  • printnode() : hash.c
  • problem : argmatch.c
  • proc : ignore.c, hash.c
  • PROC_FORMAT_STRING_SIZE : CVS_Coworker_p.c
  • procedure : ndir.c
  • process_diff() : diff3.c
  • process_diff_control() : diff3.c
  • process_import_file() : import.c
  • process_write_buffer : cvsgui_process.cpp
  • processASEntry() : apsingle.c
  • prog : minigzip.c, run.c
  • program_name : main.c, cvs.h, argmatch.c
  • program_path : main.c, cvs.h
  • PromptEditMessage() : AskYesNo.h, AskYesNo.cpp
  • PromptMessage() : AskYesNo.h, AskYesNo.cpp
  • PROTO : run.c, filesubr.c, watch.h, update.h, server.h, rcs.h, hash.h, hardlink.h, fileattr.h, edit.h, client.h, run.c, filesubr.c, mac_filesubr.c, md5.h, filesubr.c, rcs.h, error.h, cvs.h, sighandle.c, md5.c
  • pserver : Authen.h
  • pserver_method : cvs.h
  • pserverInstance : Authen.cpp
  • ptail : pipe.c
  • PtInRect() : udraw.h, udraw.cpp
  • PTR : cvs.h
  • ptr : zutil.c, rcs.c, strtoul.c, diff3.c
  • PTR_TO_OFFSET : regex.c
  • push_dummy_failure : regex.c
  • PUSH_FAILURE_ELT : regex.c
  • PUSH_FAILURE_INT : regex.c
  • PUSH_FAILURE_POINT : regex.c
  • PUSH_FAILURE_POINTER : regex.c
  • PUSH_PATTERN_OP : regex.c
  • put_byte : deflate.h
  • put_short : trees.c
  • putdelta() : rcs.c
  • putdeltatext() : rcs.c
  • putlock_proc() : rcs.c
  • putLong() : gzio.c
  • putrcsfield_proc() : rcs.c
  • putShortMSB() : deflate.c
  • putsymbol_proc() : rcs.c
  • pw : pwd.c
  • pwait() : pipe.c
  • PY_BEGIN_IMPL_METHOD : PythonMacros.h
  • PY_DECL_CLASS : PythonMacros.h
  • PY_DECL_CLASS_INHERITED : PythonMacros.h
  • PY_DECL_METHOD : PythonMacros.h
  • PY_END_IMPL_METHOD : PythonMacros.h
  • PY_IMPL_CLASS : PythonMacros.h
  • PY_IMPL_METHOD : PythonMacros.h
  • PyAppendCache() : PythonGlue.h, PythonGlue.cpp
  • PyDoCmdUI() : PythonGlue.h, PythonGlue.cpp
  • PyDoPython() : PythonGlue.h, PythonGlue.cpp
  • PyHandleCvsguiError() : PythonMacros.h, PythonContainer.cpp
  • PyInvalUICache() : PythonGlue.h, PythonGlue.cpp
  • PyIsUICacheValid() : PythonGlue.h, PythonGlue.cpp
  • PyMacrosReloadAll() : PythonGlue.h, PythonGlue.cpp
  • PyRegistry_InitValues : PythonContainer.h
  • PYTHONGLUE_EXTERN : PythonGlue.impl.h
  • PYTHONLIB_FOLDER : MacrosSetup.h
  • PythonLibGetLoc() : MacrosSetup.h, MacrosSetup.cpp
  • PyThreadState : PythonGlue.h
  • PyValidUICache() : PythonGlue.h, PythonGlue.cpp

- q -
  • q : hash.c
  • qCvsDebug : StdAfx.h
  • qDebug : StdAfx.h
  • qMacAPP : stdafx.h
  • qMacPP : stdafx.h
  • qRangeCheck : stdafx.h, dll_garbage.c
  • qRelease : stdafx.h
  • qReleaseBuild : stdafx.h
  • qsort_comp() : hash.c
  • qTRACE : CvsTrace.h
  • qTRACE_FN : CvsTrace.h
  • qTRACE_N : CvsTrace.h
  • qTRACE_S : CvsTrace.h
  • qTRACE_X : CvsTrace.h
  • quiet : main.c, cvs.h

- r -
  • r : infutil.c, infcodes.c, infblock.c, modules.c, history.c
  • R_OK : config.h, system.h
  • R_PROCESS : cvs.h
  • R_SKIP_ALL : cvs.h
  • R_SKIP_DIRS : cvs.h
  • R_SKIP_FILES : cvs.h
  • RAISED : CJControlBar.h
  • RANGE_TABLE_WORK_ELT : regex.c
  • RANGE_TABLE_WORK_USED : regex.c
  • RATTRIB : vmsmunch.c
  • rcmd() : rcmd.h, rcmd.c, rcmd.h, rcmd.c, rcmd.h
  • rcmd_authenticate() : rcmd.c
  • RCS : getdate.c
  • rcs : rcs.c, log.c, import.c, commit.c, checkin.c
  • RCS_addbranch() : rcs.c
  • RCS_ANNOTATE : rcs.c
  • RCS_cmp_file() : rcs.c
  • RCS_copydeltas() : rcs.c
  • rcs_delta_op : rcs.c
  • RCS_deltas() : rcs.c
  • RCS_exec_rcsdiff() : cvs.h
  • RCS_FETCH : rcs.c
  • RCS_findlock_or_tip() : rcs.c
  • RCS_FLAGS_DEAD : cvs.h
  • RCS_FLAGS_FORCE : cvs.h
  • RCS_FLAGS_KEEPFILE : cvs.h
  • RCS_FLAGS_MODTIME : cvs.h
  • RCS_FLAGS_QUIET : cvs.h
  • RCS_getdatebranch() : rcs.c
  • RCS_getdeltatext() : rcs.c
  • rcs_internal_lockfile() : rcs.c
  • rcs_internal_unlockfile() : rcs.c
  • rcs_lockfd : rcs.c
  • rcs_lockfile : rcs.c
  • rcs_lockfilename() : rcs.c
  • RCS_MAGIC_BRANCH : rcs.h
  • RCS_magicrev() : rcs.c
  • RCS_merge() : cvs.h
  • RCS_MERGE_PAT_1 : rcs.h
  • RCS_MERGE_PAT_2 : rcs.h
  • RCS_MERGE_PAT_3 : rcs.h
  • RCS_output_diff_options() : rcscmds.c
  • RCS_parse() : rcs.c
  • RCS_parsercsfile_i() : rcs.c
  • RCS_putadmin() : rcs.c
  • RCS_putdesc() : rcs.c
  • RCS_putdtree() : rcs.c
  • RCSBRANCH : rcs.h
  • rcsbuf : rcs.c
  • rcsbuf_buffer_size : rcs.c
  • RCSBUF_BUFSIZE : rcs.c
  • rcsbuf_cache() : rcs.c
  • rcsbuf_cache_close() : rcs.c
  • rcsbuf_cache_open() : rcs.c
  • rcsbuf_close() : rcs.c
  • rcsbuf_fill() : rcs.c
  • rcsbuf_ftell() : rcs.c
  • rcsbuf_get_buffered() : rcs.c
  • rcsbuf_getkey() : rcs.c
  • rcsbuf_getrevnum() : rcs.c
  • rcsbuf_inuse : rcs.c
  • rcsbuf_open() : rcs.c
  • rcsbuf_valcmp() : rcs.c
  • rcsbuf_valcopy() : rcs.c
  • rcsbuf_valpolish() : rcs.c
  • rcsbuf_valpolish_internal() : rcs.c
  • rcsbufin : rcs.c
  • rcsbufp : rcs.c
  • RCSCMPFLD : hash.h
  • RCSDATE : rcs.h
  • RCSDEAD : rcs.h
  • RCSDESC : rcs.h
  • RCSEXPAND : rcs.h
  • RCSEXT : rcs.h
  • RCSFIELD : hash.h
  • rcsfile : rcs.c
  • RCSHEAD : rcs.h
  • rcsinfo_contents : mkmodules.c
  • rcsinfo_proc() : logmsg.c
  • RCSNODE : hash.h
  • RCSNode : rcs.h
  • rcsnode : commit.c
  • RCSPAT : rcs.h
  • RCSSYMBOLS : rcs.h
  • RCSVERS : hash.h
  • RCSVers : rcs.h
  • rcsvers_delproc() : rcs.c
  • RE_BACKSLASH_ESCAPE_IN_LISTS : regex.h
  • RE_BK_PLUS_QM : regex.h
  • RE_CHAR_CLASSES : regex.h
  • re_compile_fastmap() : regex.h
  • re_compile_pattern() : regex.h
  • RE_CONTEXT_INDEP_ANCHORS : regex.h
  • RE_CONTEXT_INDEP_OPS : regex.h
  • RE_CONTEXT_INVALID_OPS : regex.h
  • RE_DOT_NEWLINE : regex.h
  • RE_DOT_NOT_NULL : regex.h
  • RE_DUP_MAX : regex.h
  • RE_HAT_LISTS_NOT_NEWLINE : regex.h
  • RE_INTERVALS : regex.h
  • RE_LIMITED_OPS : regex.h
  • re_match() : regex.h
  • re_match_2() : regex.h
  • re_match_2_internal() : regex.c
  • RE_NEWLINE_ALT : regex.h
  • RE_NO_BK_BRACES : regex.h
  • RE_NO_BK_PARENS : regex.h
  • RE_NO_BK_REFS : regex.h
  • RE_NO_BK_VBAR : regex.h
  • RE_NO_EMPTY_RANGES : regex.h
  • RE_NO_POSIX_BACKTRACKING : regex.h
  • RE_NREGS : regex.h
  • re_opcode_t : regex.c
  • re_search() : regex.h
  • re_search_2() : regex.h
  • re_set_registers() : regex.h
  • re_set_syntax() : regex.h, regex.c
  • RE_SYNTAX_AWK : regex.h
  • RE_SYNTAX_ED : regex.h
  • RE_SYNTAX_EGREP : regex.h
  • RE_SYNTAX_EMACS : regex.h
  • RE_SYNTAX_GREP : regex.h
  • re_syntax_options : regex.h, regex.c
  • RE_SYNTAX_POSIX_AWK : regex.h
  • RE_SYNTAX_POSIX_BASIC : regex.h
  • RE_SYNTAX_POSIX_EGREP : regex.h
  • RE_SYNTAX_POSIX_EXTENDED : regex.h
  • RE_SYNTAX_POSIX_MINIMAL_BASIC : regex.h
  • RE_SYNTAX_POSIX_MINIMAL_EXTENDED : regex.h
  • RE_SYNTAX_SED : regex.h
  • re_syntax_table : regex.c
  • RE_TRANSLATE : regex.h
  • RE_TRANSLATE_P : regex.h
  • RE_TRANSLATE_TYPE : regex.h
  • RE_UNMATCHED_RIGHT_PAREN_ORD : regex.h
  • read_buf() : deflate.c
  • read_cvsrc() : cvsrc.c, cvs.h
  • read_diff() : diff3.c
  • read_fd : server_if.c
  • read_files() : io.c, diff.h
  • read_hrecs() : history.c
  • ReadDIBFile() : dib.h, dib.c
  • ReadDIBRsrc() : dib.h
  • readdir() : ndir.h, ndir.c, ndir.h, ndir.c, ndir.h, dirent.h, dirent.c
  • Reader_Lock() : cvs.h
  • readers_exist() : lock.c
  • ReadIgnoredFile() : CvsIgnore.cpp
  • readlink() : config.h, readlink.c, config.h
  • readlock : recurse.c, lock.c
  • READNUM : diff3.c
  • real : mkmodules.c
  • realloc : system.h, regex.c, system.h, dll_garbage.h
  • really_quiet : main.c, cvs.h
  • rec_types : history.c
  • recursive : diff.c
  • reduceString() : CvsArgs.cpp
  • REG_BADBR : regex.h
  • REG_BADPAT : regex.h
  • REG_BADRPT : regex.h
  • REG_EBRACE : regex.h
  • REG_EBRACK : regex.h
  • REG_ECOLLATE : regex.h
  • REG_ECTYPE : regex.h
  • REG_EEND : regex.h
  • REG_EESCAPE : regex.h
  • REG_EPAREN : regex.h
  • REG_ERANGE : regex.h
  • REG_ERPAREN : regex.h
  • reg_errcode_t : regex.h
  • REG_ESIZE : regex.h
  • REG_ESPACE : regex.h
  • REG_ESUBREG : regex.h
  • REG_EXTENDED : regex.h
  • REG_ICASE : regex.h
  • REG_MATCH_NULL_STRING_P : regex.c
  • REG_NEWLINE : regex.h
  • REG_NOERROR : regex.h
  • REG_NOMATCH : regex.h
  • REG_NOSUB : regex.h
  • REG_NOTBOL : regex.h
  • REG_NOTEOL : regex.h
  • reg_syntax_t : regex.h
  • REG_UNSET : regex.c
  • REG_UNSET_VALUE : regex.c
  • regcomp() : regex.h
  • regerror() : regex.h
  • REGEX_ALLOCATE : regex.c
  • REGEX_ALLOCATE_STACK : regex.c
  • REGEX_FREE : regex.c
  • REGEX_FREE_STACK : regex.c
  • REGEX_MALLOC : config.h
  • REGEX_REALLOCATE : regex.c
  • REGEX_REALLOCATE_STACK : regex.c
  • regex_t : regex.h
  • REGEX_TALLOC : regex.c
  • regexec() : regex.h
  • regfree() : regex.h
  • Register() : cvs.h
  • register_subdir_proc() : find_names.c
  • regoff_t : regex.h
  • REGS_FIXED : regex.h
  • REGS_REALLOCATE : regex.h
  • REGS_UNALLOCATED : regex.h
  • REJECT : lexer.cc
  • RELATIVE_REPOS : options.h
  • RelativeDate() : getdate.y, getdate.c
  • RelativeMonth() : getdate.y, getdate.c
  • release() : release.c, cvs.h
  • RELEASE : CJHtmlView.cpp
  • release_usage : release.c
  • RelMonth : getdate.c
  • relunit : getdate.y
  • REMAINING_AVAIL_SLOTS : regex.c
  • remove_dirproc() : remove.c
  • remove_file() : commit.c
  • remove_fileproc() : remove.c
  • remove_locks() : lock.c
  • remove_usage : remove.c
  • removed_files : remove.c
  • RemoveFiles() : CVS_Coworker_i.h, cvs_coworker.h
  • rename : rename.c, config.h
  • rename_dbmfile() : mkmodules.c
  • rename_file() : cvs.h
  • rename_rcsfile() : mkmodules.c
  • RenameFile() : CVS_Coworker_i.h, cvs_coworker.h
  • reopen_consoles() : cvsgui.c
  • REP_3_6 : trees.c
  • report_count : history.c
  • report_hrecs() : history.c
  • repos : tag.c, status.c, rtag.c, remove.c, rcs.c, patch.c, diff.c, commit.c, admin.c
  • repos_len : import.c
  • repos_sort : history.c
  • REPOS_STRIP : cvs.h
  • repository : watch.c, update.c, tag.c, recurse.c, parseinfo.c, logmsg.c, log.c, lock.c, import.c, history.c, entries.c, edit.c, create_adm.c, commit.c
  • REPZ_11_138 : trees.c
  • REPZ_3_10 : trees.c
  • requests : server.h
  • REQUIRE_ORDER : getopt.c
  • required_argument : getopt.h
  • RESERVED : gzio.c
  • RESET_FAIL_STACK : regex.c
  • resolve_address() : rcmd.c
  • resolve_symlink() : cvs.h
  • responses : client.h
  • restore_cwd() : savecwd.h
  • RESTORE_RTYPE : vmsmunch.h
  • RETALLOC : regex.c
  • RETALLOC_IF : regex.c
  • retbuf : rcs.c
  • retlen : rcs.c
  • RETSIGTYPE : config.h
  • return() : logmsg.c
  • RETURN_IN_ORDER : getopt.c
  • rev : rcs.c, entries.c, commit.c, checkin.c
  • rev1 : update.c, rcscmds.c, patch.c
  • rev1_validated : patch.c
  • rev2 : update.c, subr.c, rcscmds.c, patch.c
  • rev2_validated : patch.c
  • rev_mapping : diff3.c
  • revcmp() : UCvsFiles.cpp
  • reverse_diff3_blocklist() : diff3.c
  • revisionColumn : BrowseViewColumn.cpp
  • revlist : log.c
  • REVNUM : parser.h, parser.cc
  • revnumber : lexer.cc
  • revp : rcs.c
  • revs : history.c
  • rewinddir : dirent.h, dirent.c, ndir.h
  • rewrite_tag : update.c
  • RGB_DEF_BRANCH : GraphView.h
  • RGB_DEF_DEADNODE : GraphView.h
  • RGB_DEF_HEADER : GraphView.h
  • RGB_DEF_NODE : GraphView.h
  • RGB_DEF_SEL : GraphView.h
  • RGB_DEF_SHADOW : GraphView.h
  • RGB_DEF_TAG : GraphView.h
  • RGB_DEF_USERSTATENODE : GraphView.h
  • rhosts : Authen.h
  • rhostsInstance : Authen.cpp
  • right : side.c
  • RLERead() : hqx.c
  • RLEWrite() : hqx.c
  • RLEWriteEnd() : hqx.c
  • rmdir : rmdir.c, config.h
  • ROBUST_OUTPUT_STYLE : diff.h
  • ROL : io.c
  • root_allow_add() : root.c, cvs.h
  • root_allow_free() : cvs.h
  • root_allow_ok() : cvs.h
  • root_allow_size : root.c
  • root_allow_vector : root.c
  • root_directories : main.c, cvs.h
  • rootdir : root.c
  • ROUND_RECT_PT : GraphView.h
  • RQ_ENABLEME : server.h
  • RQ_ESSENTIAL : server.h
  • RQ_ROOTLESS : server.h
  • RQ_SUPPORTED : server.h
  • RSA_IDENTITY_SUPPORT : options.h
  • RSH_NEEDS_BINARY_FLAG : config.h
  • RSH_NOT_TRANSPARENT : config.h
  • rtag() : rtag.c, cvs.h
  • rtag_delete() : rtag.c
  • rtag_dirproc() : rtag.c
  • rtag_fileproc() : rtag.c
  • rtag_filesdoneproc() : rtag.c
  • rtag_proc() : rtag.c
  • rtag_usage : rtag.c
  • RTYPE : vmsmunch.c
  • run_add_arg() : run.c
  • run_arg() : run.c, cvs.h, run.c, mac_run.c
  • run_argc : run.c
  • run_argc_allocated : run.c
  • run_args() : mac_run.c
  • run_argv : run.c
  • RUN_COMBINED : cvs.h
  • run_exec() : cvs.h, mac_run.c
  • run_module_prog : modules.c, commit.c
  • RUN_NORMAL : cvs.h
  • run_pclose : cvs.h
  • run_popen() : cvs.h, mac_run.c
  • run_print() : cvs.h, mac_run.c
  • RUN_REALLY : cvs.h
  • run_setup() : run.c, cvs.h, run.c, mac_run.c
  • RUN_SIGIGNORE : cvs.h
  • RUN_STDERR_APPEND : cvs.h
  • RUN_STDOUT_APPEND : cvs.h
  • RUN_TTY : cvs.h

- s -
  • s : inftrees.c, inffast.c, rcs.c
  • s2 : util.c
  • s3 : util.c
  • s_count : modules.c
  • s_ign_count : ignore.c
  • s_ign_list : ignore.c
  • S_IRGRP : system.h
  • S_IROTH : system.h
  • S_IRUSR : system.h
  • S_IRWXG : system.h
  • S_IRWXO : system.h
  • S_IRWXU : system.h
  • S_ISDIR : system.h
  • S_ISREG : system.h
  • S_IWGRP : system.h
  • S_IWOTH : system.h
  • S_IWRITE : system.h
  • S_IWUSR : system.h
  • S_IXGRP : system.h
  • S_IXOTH : system.h
  • S_IXUSR : system.h
  • s_max : modules.c
  • safe_location() : cvs.h
  • SafeCopy() : BrowseViewColumn.cpp
  • sAllTargets : uevent.cpp
  • SAME_CHARSET_P : regex.c
  • same_file : config.h, system.h
  • Sanitize_Repository_Name() : cvs.h
  • sAskingMainThread : MainFrm.cpp
  • save_cwd() : savecwd.h, savecwd.c
  • SAVE_CWD_H : savecwd.h
  • save_d() : modules.c
  • save_file() : history.c
  • save_module() : history.c
  • save_user() : history.c
  • SaveAsPersistentSettings() : Persistent.cpp
  • SaveBmpFromDDB() : dib.h, dib.c
  • saved_message : commit.c
  • saved_tag : commit.c
  • saved_ulist : commit.c
  • SaveDIB() : dib.h, dib.c
  • SavePersistentSettings() : Persistent.h, Persistent.cpp
  • sawdir : entries.c
  • sbranch : commit.c
  • sBuf : TextBinary.cpp
  • sBufSize : TextBinary.cpp
  • scan_char_literal() : ifdef.c
  • scan_diff_line() : diff3.c
  • scan_printf_spec() : ifdef.c
  • scan_tree() : trees.c
  • SCC_cap_AddFromScc : pubscc.h
  • SCC_cap_GetProjPath : pubscc.h
  • SCC_cap_QueryInfo : pubscc.h
  • SCC_cap_want_outproc : pubscc.h
  • SCC_cmdopt_auto : pubscc.h
  • SCC_cmdopt_binary : pubscc.h
  • SCC_cmdopt_case_insensitive : pubscc.h
  • SCC_cmdopt_compare_files : pubscc.h
  • SCC_cmdopt_consult_checksum : pubscc.h
  • SCC_cmdopt_consult_timestamp : pubscc.h
  • SCC_cmdopt_dir : pubscc.h
  • SCC_cmdopt_ignore_all_space : pubscc.h
  • SCC_cmdopt_no_unedit : pubscc.h
  • SCC_cmdopt_only_one : pubscc.h
  • SCC_cmdopt_recurse : pubscc.h
  • SCC_cmdopt_retain_local : pubscc.h
  • SCC_cmdopt_text : pubscc.h
  • SCC_command : pubscc.h
  • SCC_command_add : pubscc.h
  • SCC_command_checkin : pubscc.h
  • SCC_command_checkout : pubscc.h
  • SCC_command_diff : pubscc.h
  • SCC_command_get : pubscc.h
  • SCC_command_history : pubscc.h
  • SCC_command_options : pubscc.h
  • SCC_command_properties : pubscc.h
  • SCC_command_remove : pubscc.h
  • SCC_command_rename : pubscc.h
  • SCC_command_uncheckout : pubscc.h
  • SCC_max_init_path : pubscc.h
  • SCC_max_name : pubscc.h
  • SCC_max_path : pubscc.h
  • SCC_open_autocreate : pubscc.h
  • SCC_open_may_prompt : pubscc.h
  • SCC_option_background : pubscc.h
  • SCC_option_background_no : pubscc.h
  • SCC_option_background_yes : pubscc.h
  • SCC_option_cancel : pubscc.h
  • SCC_option_cancel_off : pubscc.h
  • SCC_option_cancel_on : pubscc.h
  • SCC_outproc : pubscc.h
  • SCC_outproc_cancel_off : pubscc.h
  • SCC_outproc_cancel_on : pubscc.h
  • SCC_outproc_error : pubscc.h
  • SCC_outproc_info : pubscc.h
  • SCC_outproc_nostatus : pubscc.h
  • SCC_outproc_return_cancelled : pubscc.h
  • SCC_outproc_return_success : pubscc.h
  • SCC_outproc_status : pubscc.h
  • SCC_outproc_warning : pubscc.h
  • SCC_popul_proc : pubscc.h
  • SCC_return : pubscc.h
  • SCC_return_non_scc_file : pubscc.h
  • SCC_return_non_specific_error : pubscc.h
  • SCC_return_not_supported : pubscc.h
  • SCC_return_success : pubscc.h
  • SCC_return_unknown_project : pubscc.h
  • SCC_status_error : pubscc.h
  • SCC_status_had_conflicts : pubscc.h
  • SCC_status_munged : pubscc.h
  • SCC_status_needs_update : pubscc.h
  • SCC_status_no_checkins : pubscc.h
  • SCC_status_nonreserved : pubscc.h
  • SCC_status_not_pertinent : pubscc.h
  • SCC_status_out_here : pubscc.h
  • SCC_status_out_me : pubscc.h
  • SCC_status_out_someoneelse : pubscc.h
  • SCC_status_reserved : pubscc.h
  • SCC_status_several_projects : pubscc.h
  • SCC_status_stuck : pubscc.h
  • SccAdd() : scc.c, pubscc.h
  • SccAddFromScc() : scc.c, pubscc.h
  • SccCheckin() : scc.c, pubscc.h
  • SccCheckout() : scc.c, pubscc.h
  • SccCloseProject() : scc.c, pubscc.h
  • SccDiff() : scc.c, pubscc.h
  • SccGet() : scc.c, pubscc.h
  • SccGetCommandOptions() : scc.c, pubscc.h
  • SccGetEvents() : scc.c, pubscc.h
  • SccGetProjPath() : scc.c, pubscc.h
  • SccGetVersion() : scc.c, pubscc.h
  • SccHistory() : scc.c, pubscc.h
  • SccInitialize() : scc.c, pubscc.h
  • SccOpenProject() : scc.c, pubscc.h
  • SccPopulateList() : scc.c, pubscc.h
  • SccProperties() : scc.c, pubscc.h
  • SccQueryInfo() : scc.c, pubscc.h
  • SccRemove() : scc.c, pubscc.h
  • SccRename() : scc.c, pubscc.h
  • SccRunScc() : scc.c, pubscc.h
  • SccSetOption() : scc.c, pubscc.h
  • SccUncheckout() : scc.c, pubscc.h
  • SccUninitialize() : scc.c, pubscc.h
  • sCompatProc : dll_loader.h, dll_loader.c
  • Scratch_Entry() : cvs.h
  • scratch_file() : update.c
  • scratchPath : macos_filesys.c
  • script : logmsg.c
  • sCvsContainerFileSpec : dll_glue.c
  • SDATEFORM : rcs.h
  • sDefBrowserMenu : wincvs_winutil.cpp
  • sDefDateNames : UpdateDlg.cpp
  • sDefFilesMenu : wincvs_winutil.cpp
  • sDefLogDateNames : LogDlg.cpp
  • sDefLogStateNames : LogDlg.cpp
  • sDefLogTagNames : LogDlg.cpp
  • sDefLogUserNames : LogDlg.cpp
  • sDefModuleNames : ImportDlg.cpp
  • sDefReleases : ImportDlg.cpp
  • sDefRevDateNames : UpdateDlg.cpp
  • sDefTagNames : UpdateDlg.cpp
  • sDefVendors : ImportDlg.cpp
  • sdiff_column2_offset : diff.h
  • sdiff_half_width : diff.h
  • sdiff_help_sdiff : diff.h
  • sdiff_left_only : diff.h
  • sdiff_skip_common_lines : diff.h
  • sDummyStarter : UPseudoSupport.cpp
  • Seconds : getdate.c
  • SECSPERDAY : getdate.c, getdate.y, getdate.c
  • SEEK_CUR : system.h
  • SEEK_END : system.h
  • SEEK_SET : system.h
  • seekdir() : ndir.h, ndir.c, ndir.h, ndir.c, ndir.h, dirent.h, dirent.c
  • select_hrec() : history.c
  • send_all_trees() : trees.c
  • send_bits : trees.c
  • send_code : trees.c
  • SEND_NEVER_PARTIAL : config.h
  • send_notifications() : edit.c
  • send_tree() : trees.c
  • sep : side.c
  • sepchars : subr.c
  • SERVER_FLOWCONTROL : options.h
  • SERVER_HI_WATER : options.h
  • SERVER_LO_WATER : options.h
  • server_method : cvs.h
  • SET_BINARY_MODE : minigzip.c
  • set_data_type() : trees.c
  • set_file_type() : cvs_hqx.h, cvs_hqx.cpp
  • set_length : diff3.c
  • SET_LIST_BIT : regex.c
  • set_local_cvsroot() : cvs.h
  • set_lock() : lock.c
  • set_lockers_name() : lock.c
  • set_number_at : regex.c
  • SET_RANGE_TABLE_WORK_AREA : regex.c
  • SET_REGS_MATCHED : regex.c
  • set_root_directory() : main.c
  • set_start : diff3.c
  • set_time : vers_ts.c
  • SET_TIMES : vmsmunch.h
  • set_writelock_proc() : lock.c
  • SetDItemMenuSel() : MacMisc.h, MacMisc.cpp
  • SetIcon() : WinCvsBrowser.cpp
  • setpwent() : pwd.h, pwd.c, pwd.h, pwd.c
  • SetRect() : udraw.h, udraw.cpp
  • SetRectEmpty() : udraw.h, udraw.cpp
  • setting_default : edit.c
  • setting_tcommit : edit.c
  • setting_tedit : edit.c
  • setting_tunedit : edit.c
  • SETTINGS_FOLDER : Persistent.cpp
  • SettingsGetLoc() : Persistent.cpp
  • setup_output() : util.c, diff.h
  • setup_tmpfile() : logmsg.c
  • SetWinCvsDebugMask() : WinCvsDebug.h, WinCvsDebug.cpp
  • SetWinCvsDebugMaskBit() : WinCvsDebug.h, WinCvsDebug.cpp
  • sFileIconAddedIcon : UCvsFiles.cpp
  • sFileIconBinaryIcon : UCvsFiles.cpp
  • sFileIconBinaryModIcon : UCvsFiles.cpp
  • sFileIconConflictIcon : UCvsFiles.cpp
  • sFileIconIgnoredIcon : UCvsFiles.cpp
  • sFileIconMissIcon : UCvsFiles.cpp
  • sFileIconRemovedIcon : UCvsFiles.cpp
  • sFileIconTextIcon : UCvsFiles.cpp
  • sFileIconTextModIcon : UCvsFiles.cpp
  • sFileIconUnknownIcon : UCvsFiles.cpp
  • sFolderIcon : UCvsFolders.cpp
  • sFolderIconIcon : UCvsFiles.cpp
  • sFolderIconIgnoredIcon : UCvsFiles.cpp
  • sFolderIconMissIcon : UCvsFiles.cpp
  • sFolderIconUnknownIcon : UCvsFiles.cpp
  • sFolderIgnoredIcon : UCvsFolders.cpp
  • sFolderMissingIcon : UCvsFolders.cpp
  • sFolderUnknownIcon : UCvsFolders.cpp
  • sGetEnv() : MainFrm.cpp
  • sGetEnvResult : MainFrm.cpp
  • SHADOW_OFFSET_PT : GraphView.h
  • sHandlers : cvsgui_wire.cpp
  • SHELL_KIND : CvsPrefs.h
  • SHELL_PYTHON : CvsPrefs.h
  • SHELL_TCL : CvsPrefs.h
  • sHex : CvsTrace.cpp
  • shift_boundaries() : analyze.c
  • shl_calloc() : dll_garbage.h, dll_garbage.c
  • shl_free() : dll_garbage.h, dll_garbage.c
  • shl_malloc() : dll_garbage.h, dll_garbage.c
  • shl_realloc() : dll_garbage.h, dll_garbage.c
  • Short_Repository() : cvs.h
  • shorten : rtag.c, patch.c, modules.c, checkout.c
  • show_2nd : diff3.c
  • ShowAdvancedOptionsForCommand() : CVS_Coworker_i.h, cvs_coworker.h
  • ShowFileHistory() : CVS_Coworker_i.h, cvs_coworker.h
  • ShowFileProperties() : CVS_Coworker_i.h, cvs_coworker.h
  • ShowUserInterface() : CVS_Coworker_i.h, cvs_coworker.h
  • SHUTDOWN_SERVER : config.h
  • SIG_beginCrSect() : cvs.h
  • SIG_crSectMask : sighandle.c
  • SIG_crSectNest : sighandle.c
  • SIG_defaults : sighandle.c
  • SIG_endCrSect() : cvs.h
  • SIG_handle() : sighandle.c
  • SIG_handlers : sighandle.c
  • SIG_inCrSect() : cvs.h
  • SIG_init() : sighandle.c
  • SIG_register() : cvs.h
  • SIGCLEANUPPROC : cvs.h
  • SIGMAX : sighandle.c
  • SIGN_EXTEND_CHAR : regex.c
  • simple_diff() : Persistent.cpp
  • simple_only : diff3.c
  • simple_tag : rcs.c
  • since_date : history.c
  • since_rev : history.c
  • since_tag : history.c
  • SINGLE_BYTE_CHAR_P : regex.c
  • sInitInvTable : CustomizeMenus.cpp
  • sInt : parser.cc
  • sInvTable : CustomizeMenus.cpp
  • siop_head : piped_child.c
  • siop_tail : piped_child.c
  • sip() : io.c, diff.h
  • size : zutil.c, deflate.c, import.c, diff3.c
  • size_t : memmove.c
  • SIZEOF_BITMAPFILEHEADER_PACKED : dib.h
  • skip_test : io.c
  • SKIPWHITE : diff3.c
  • sLastExitCode : AppGlue.cpp
  • sLastIdle : uevent.cpp
  • sleep : win32.c, config.h
  • sLogout : wincvs.cpp
  • slurp() : diff.h
  • smaller : trees.c
  • SMALLEST : trees.c
  • SNAKE_LIMIT : analyze.c
  • sock_errlist : sockerror.c
  • SOCK_ERRNO : rcmd.c, config.h, rcmd.c
  • sock_strerror() : sockerror.c, config.h
  • SOCK_STRERROR : rcmd.c, config.h, rcmd.c
  • SOCKET : rcmd.c
  • SOCKET_ERROR : rcmd.c
  • SockStrError() : porttcp.c
  • sort_order() : modules.c, history.c
  • sortRevFile() : main.cpp
  • sortRevs() : CvsLog.cpp
  • source : uncompr.c, deflate.c, compress.c, main.c
  • sourceLen : uncompr.c, compress.c
  • sout : rcs.c
  • spacetab : rcs.c
  • special_file_mismatch() : cvs.h
  • specify_format() : diff.c
  • specify_style() : diff.c
  • SplitPath() : TextBinary.h, TextBinary.cpp
  • src : diff.c
  • sRetainedMsgs : uevent.cpp
  • sRev : parser.cc
  • SS : vmsmunch.c
  • ssh : Authen.h
  • sshInstance : Authen.cpp
  • sStr : parser.cc
  • ST_ANYBUTSEP : lexer.cc
  • ST_DATE : lexer.cc
  • ST_INREV : lexer.cc
  • ST_INT : lexer.cc
  • ST_REV : lexer.cc
  • ST_REVORNIL : lexer.cc
  • ST_STRING : lexer.cc
  • ST_TAG : lexer.cc
  • start : diff3.c
  • START : diff3.c
  • start_child() : run.c
  • start_memory : regex.c
  • start_recursion() : recurse.c, cvs.h
  • START_RSH_WITH_POPEN_RW : config.h
  • START_SERVER : config.h
  • START_SERVER_RETURNS_SOCKET : config.h
  • STARTPOINT_PT : GraphView.h
  • stat : StdAfx.h, config.h, vms.h, config.h
  • STAT_BLOCKSIZE : history.c, system.h
  • stat_loc : waitpid.c
  • STAT_MACROS_BROKEN : config.h
  • static_bl_desc : trees.c
  • static_d_desc : trees.c
  • static_dtree : trees.c
  • static_l_desc : trees.c
  • static_ltree : trees.c
  • static_tree_desc : deflate.h
  • STATIC_TREES : zutil.h
  • status : error.c, waitpid.c
  • Status : modules.c
  • status_dirproc() : status.c
  • status_fileproc() : status.c
  • status_usage : status.c
  • statusColumn : BrowseViewColumn.cpp
  • statusp : waitpid.c
  • sTclBrowser : TclGlue.cpp
  • STD : umain.h
  • STDC : zconf.h
  • STDC_HEADERS : config.h
  • STDERR : run.c, popen.c
  • STDERR_FILENO : vms.h, server.h, system.h
  • STDIN : run.c, popen.c
  • STDIN_FILENO : vms.h, server.h, system.h
  • STDOUT : run.c, popen.c
  • STDOUT_FILENO : vms.h, server.h, system.h
  • sTemporaryTurnOffNotify : UCvsFolders.cpp
  • sterr : run.c
  • sticky : checkout.c
  • sticky_ck() : classify.c
  • sTmpList : AppGlue.cpp
  • sTooltipHandler : uevent.cpp
  • STOP_ADDR_VSTRING : regex.c
  • stop_memory : regex.c
  • STORE_CHARACTER_AND_INCR : regex.c
  • STORE_JUMP : regex.c
  • STORE_JUMP2 : regex.c
  • STORE_NUMBER : regex.c
  • STORE_NUMBER_AND_INCR : regex.c
  • STORED : infutil.h
  • STORED_BLOCK : zutil.h
  • stored_len : trees.c
  • stout : run.c
  • str_list : logmsg.c
  • str_list_format : logmsg.c
  • STRATA_HACK : config.h
  • strategy : deflate.c
  • strcat_and_allocate() : diff.c
  • strchr : system.h
  • strcmp() : fncase.c
  • strdup() : UPseudoSupport.cpp, stdafx.h, UPseudoSupport.cpp, stdafx.h
  • stream_size : inflate.c, deflate.c
  • STREQ : rcs.c, regex.c
  • strerror() : error.c, strerror.c, util.c
  • stricmp() : MacMisc.h, MacMisc.cpp
  • STRING : parser.h, parser.cc
  • string : history.c, fnmatch.c
  • STRING_CHAR : regex.c
  • STRING_CHAR_AND_LENGTH : regex.c
  • StringToArgv() : TextBinary.h, TextBinary.cpp
  • strip_trailing_newlines() : cvs.h
  • strip_trailing_slashes() : stripslash.c, cvs.h, stripslash.c
  • strndup() : misc.h, misc.c
  • strnicmp() : MacMisc.h, MacMisc.cpp
  • strrchr : system.h
  • strstr() : strstr.c
  • strtok() : run.c, cvsrc.c, run.c
  • strtoul() : vasprintf.c, strtoul.c
  • STRUCT_DIRENT : FileTraversal.h
  • sTurnOffDispatching : uevent.cpp
  • STYLE_DEADNODE : GraphView.h
  • STYLE_USERSTATENODE : GraphView.h
  • Subdir_Deregister() : cvs.h
  • subdir_record() : entries.c
  • Subdir_Register() : cvs.h
  • Subdirs_Known() : cvs.h
  • SUBIO : piped_child.c
  • succeed : regex.c
  • succeed_n : regex.c
  • suffix : subr.c
  • SUFFIX_LEN : minigzip.c
  • SUNKEN : CJControlBar.h
  • SWITCH_ENUM_CAST : regex.c
  • switch_string : diff.h
  • Sword : regex.c
  • symtag : tag.c, rtag.c, rcs.c
  • SYNTAX : regex.c
  • sys_errlist : strerror.c
  • sys_nerr : strerror.c
  • SYS_SOCKET_H_DEFINES_SELECT : config.h
  • SYSTEM_CLEANUP : config.h
  • SYSTEM_GETCALLER : config.h
  • SYSTEM_INITIALIZE : config.h
  • SYSTEM_QUOTE_ARG : system.h
  • systemtime_second : Stat.cpp, win32.c
  • szIntFilePos : TipDlg.cpp
  • szIntStartup : TipDlg.cpp
  • szSection : TipDlg.cpp
  • szTimeStamp : TipDlg.cpp

- t -
  • t : inftrees.c
  • T_ADDED : cvs.h
  • T_CHECKOUT : cvs.h
  • T_CONFLICT : cvs.h
  • T_MODIFIED : cvs.h
  • T_NEEDS_MERGE : cvs.h
  • T_REMOVE_ENTRY : cvs.h
  • T_REMOVED : cvs.h
  • T_TITLE : cvs.h
  • T_UNKNOWN : cvs.h
  • T_UPTODATE : cvs.h
  • tab_align_flag : diff3.c, diff.h
  • tab_expand_flag : diff.h
  • tab_from_to() : side.c
  • TAB_WIDTH : diff.h
  • TABLE : infutil.h, getdate.c
  • TABVIEW_BORDER : CJTabView.h
  • TAG : cvs.h, parser.h, parser.cc
  • tag : vers_ts.c, update.c, rcs.c, logmsg.c, entries.c, create_adm.c, commit.c, classify.c, checkout.c, checkin.c, add.c
  • tag1 : rcs.c
  • tag2 : rcs.c
  • TAG_BASE : cvs.h
  • tag_check_valid() : cvs.h
  • tag_check_valid_join() : cvs.h
  • tag_delproc() : tag.c, rtag.c
  • tag_dirproc() : tag.c
  • tag_fileproc() : tag.c
  • tag_filesdoneproc() : tag.c
  • TAG_HEAD : cvs.h
  • tag_list_proc() : status.c
  • Tag_Open() : CvsEntries.h, CvsEntries.cpp
  • tag_report : history.c
  • tag_update_dir : update.c
  • tag_usage : tag.c
  • tag_validated : checkout.c
  • tagColumn : BrowseViewColumn.cpp
  • taginfo_contents : mkmodules.c
  • tAGO : getdate.c
  • TALLOC : regex.c
  • targc : import.c
  • target : rcs.c
  • targv : import.c
  • tb : inftrees.c
  • TBBS_AUTOSIZE : CJToolBar.h
  • TBBS_BUTTON : CJToolBar.h
  • TBBS_CHECKBOX : CJToolBar.h
  • TBBS_CHECKED : CJToolBar.h
  • TBBS_CHECKGROUP : CJToolBar.h
  • TBBS_DISABLED : CJToolBar.h
  • TBBS_DROPDOWN : CJToolBar.h
  • TBBS_ELLIPSES : CJToolBar.h
  • TBBS_GROUP : CJToolBar.h
  • TBBS_HIDDEN : CJToolBar.h
  • TBBS_INDETERMINATE : CJToolBar.h
  • TBBS_MARKED : CJToolBar.h
  • TBBS_NOPREFIX : CJToolBar.h
  • TBBS_PRESSED : CJToolBar.h
  • TBBS_SEPARATOR : CJToolBar.h
  • TBBS_WRAPPED : CJToolBar.h
  • tbeButton : utoolbar.cpp
  • tbeDropDown : utoolbar.cpp
  • tbeKind : utoolbar.cpp
  • tbeSeparator : utoolbar.cpp
  • TCB_ITEM : CJTabCtrlBar.h
  • TCL_BREAK : TclGlue.h
  • TCL_CONTINUE : TclGlue.h
  • TCL_ERROR : TclGlue.h
  • TCL_OK : TclGlue.h
  • TCL_RETURN : TclGlue.h
  • TclBrowserAppend() : TclGlue.h, TclGlue.cpp
  • TclBrowserReset() : TclGlue.h, TclGlue.cpp
  • tclCvsBrowserProc() : TclGlue.cpp
  • tclCvsEntriesDeleteProc() : TclGlue.cpp
  • tclCvsEntriesProc() : TclGlue.cpp
  • tclCvsErrProc() : TclGlue.cpp
  • tclCvsExitOnErrorProc() : TclGlue.cpp
  • tclCvsLastErrorCodeProc() : TclGlue.cpp
  • tclCvsOutProc() : TclGlue.cpp
  • tclCvsProc() : TclGlue.cpp
  • tclHelpProc() : TclGlue.cpp
  • tclSafeRemove() : TclGlue.cpp
  • tclSetDebugLevelProc() : TclGlue.cpp
  • TCPIP_IBM_NOHIDE : porttcp.c
  • td : inftrees.c, inffast.c, infcodes.c
  • tDAY : getdate.y, getdate.c
  • tDAYZONE : getdate.c
  • tDST : getdate.c
  • telldir() : ndir.h, ndir.c, ndir.h, ndir.c, ndir.h, dirent.h, dirent.c
  • temp : wrapper.c, mkmodules.c
  • template : logmsg.c
  • test_compress() : example.c
  • test_deflate() : example.c
  • test_dict_deflate() : example.c
  • test_dict_inflate() : example.c
  • test_flush() : example.c
  • test_gzio() : example.c
  • test_inflate() : example.c
  • test_large_deflate() : example.c
  • test_large_inflate() : example.c
  • test_sync() : example.c
  • testAppleSingleEncoding() : cvs_hqx.cpp
  • TestBuffer() : TextBinary.cpp
  • TestFileIsAlias() : TextBinary.cpp
  • testHQXEncoding() : cvs_hqx.cpp
  • TestValidName() : TextBinary.cpp
  • text : server.c, rcs.c
  • textbuf : rcs.c
  • textlen : rcs.c
  • TextOnly : CJMenu.h
  • the_args : watch.c
  • theApp : wincvs.cpp
  • theHookMap : Subclass.cpp
  • thread1 : diff3.c
  • tID : getdate.c
  • time_stamp() : cvs.h
  • TIME_WITH_SYS_TIME : config.h
  • timezone : system.h
  • TimezoneTable : getdate.c, getdate.y, getdate.c
  • TIPDLG_H_INCLUDED_ : TipDlg.h
  • title_proc() : logmsg.c
  • tl : inftrees.c, inffast.c, infcodes.c
  • tlist : tag.c, rtag.c
  • TM_YEAR_ORIGIN : getdate.c, getdate.y, getdate.c
  • tMERIDIAN : getdate.c
  • TmFromOleDate() : CJDateTimeCtrl.cpp
  • tMINUTE_UNIT : getdate.c
  • tMONTH : getdate.c
  • tMONTH_UNIT : getdate.c
  • Tmpdir : main.c, cvs.h
  • TMPDIR_DFLT : options.h
  • TMPDIR_ENV : cvs.h
  • tmpfile1 : patch.c
  • tmpfile2 : patch.c
  • tmpfile3 : patch.c
  • TMString< UPStr > : MultiString.cpp
  • TMString< UStr > : MultiString.cpp
  • to : filesubr.c, rcs.c, filesubr.c, mac_filesubr.c, rename.c, filesubr.c, side.c
  • to_file : filesubr.c
  • toattic : rcs.c
  • tofdp : piped_child.c, run.c
  • TOHEX : CJHexEdit.cpp
  • tolengths : diff3.c
  • too_expensive : analyze.c
  • TOO_FAR : deflate.c
  • TOOLTIP_ID : CJHyperLink.cpp
  • top_level_admin : main.c, cvs.h
  • toptrs : diff3.c
  • toptwo_diffs : patch.c
  • ToSeconds() : getdate.y, getdate.c
  • toss_local_changes : update.c
  • tr_static_init() : trees.c
  • trace : startserver.c, piped_child.c, pc.c, main.c, cvs.h, startserver.c
  • TRACE : macos_filesys.c
  • Trace : zutil.h
  • Tracec : zutil.h
  • Tracecv : zutil.h
  • Tracev : zutil.h
  • Tracevv : zutil.h
  • TRACK_BORDER_SIZE : CJSizeDockBar.cpp, CJControlBar.cpp
  • TRACK_BUTTON : CJMenuBar.h
  • TRACK_NONE : CJMenuBar.h
  • TRACK_POPUP : CJMenuBar.h
  • TRACKINGSTATE : CJMenuBar.h
  • TRANSLATE : regex.c
  • translate_line_number() : diff.h
  • translate_range() : diff.h
  • translate_symtag() : rcs.c
  • TraverseHistory() : HistComboBoxEx.cpp
  • tree : trees.c
  • tree_desc : deflate.h
  • TrimRight() : wincvs.cpp
  • TRUE : misc.c, cvsgui_wire.h
  • true : regex.c
  • truncate_revnum() : rcs.c
  • truncate_revnum_in_place() : rcs.c
  • trunk : log.c
  • TRY : PythonMacros.h
  • TRY_FREE : zutil.h
  • try_help() : diff3.c, diff.c
  • TRYFREE : gzio.c
  • ts : entries.c
  • ts_conflict : entries.c
  • tSEC_UNIT : getdate.c
  • tSNUMBER : getdate.c
  • tUNUMBER : getdate.c
  • turning_on : edit.c
  • TYPE : infutil.h
  • type : logmsg.c
  • TYPE_FORMAT_STRING_SIZE : CVS_Coworker_p.c
  • typesRecursive : BrowseViewColumn.cpp
  • typesRegular : BrowseViewColumn.cpp
  • TYPICAL_FAILURE_SIZE : regex.c
  • tz_local : history.c
  • tz_name : history.c
  • tz_seconds_east_of_GMT : history.c
  • tZONE : getdate.c

- u -
  • ualloc() : waitpid.c
  • UAppConsole() : uconsole.h, uconsole.cpp
  • UASSERT : StdAfx.h, stdafx.h, StdAfx.h, stdafx.h
  • UBEGIN_MESSAGE_MAP : umain.h
  • uch : zutil.h
  • uchf : zutil.h
  • UCOLORREF : udraw.h
  • UCreate_AskYesNo() : UCvsDialogs.h
  • UCreate_BranchDlg() : UCvsDialogs.h
  • UCreate_BranchModDlg() : UCvsDialogs.h
  • UCreate_CheckoutDlg() : UCvsDialogs.h
  • UCreate_CmdlineDlg() : UCvsDialogs.h
  • UCreate_CommitDlg() : UCvsDialogs.h
  • UCreate_DiffDlg() : UCvsDialogs.h
  • UCreate_gcvs_Settings() : UCvsDialogs.h
  • UCreate_GraphWindow() : UCvsDialogs.h
  • UCreate_ImpEntryDlg() : UCvsDialogs.h
  • UCreate_ImportDlg() : UCvsDialogs.h
  • UCreate_ImportFilterDlg() : UCvsDialogs.h
  • UCreate_ImpWarningDlg() : UCvsDialogs.h
  • UCreate_LogDlg() : UCvsDialogs.h
  • UCreate_MainWindow() : UCvsDialogs.h
  • UCreate_PasswdDlg() : UCvsDialogs.h
  • UCreate_pixmap() : UCvsDialogs.h, UCvsApp.cpp
  • UCreate_SettingsDlg() : UCvsDialogs.h
  • UCreate_TagDlg() : UCvsDialogs.h
  • UCreate_TagModDlg() : UCvsDialogs.h
  • UCreate_UntagDlg() : UCvsDialogs.h
  • UCreate_UntagModDlg() : UCvsDialogs.h
  • UCreate_UpdateDlg() : UCvsDialogs.h
  • uCursArrow : umain.h
  • UCURSOR : umain.h
  • uCursWatch : umain.h
  • UDECLARE_DYNAMIC : uobject.h
  • UDECLARE_DYNCREATE : uobject.h
  • UDECLARE_MESSAGE_MAP : umain.h
  • UDYNAMIC_CAST : uobject.h
  • UEND_MESSAGE_MAP : umain.h
  • UEventGetTargets() : umain.h, uevent.cpp
  • UEventGetWidID() : umain.h, uevent.cpp
  • UEventGiveTime() : umain.h, uevent.cpp
  • UEventNotifyMessage() : umain.h, uevent.cpp
  • UEventParam : umain.h
  • UEventPostMessage() : umain.h, uevent.cpp
  • UEventQueryWidget() : umain.h, uevent.cpp
  • UEventRemoveWidID() : umain.h, uevent.cpp
  • UEventSendMessage() : umain.h, uevent.cpp
  • UEventSendMessageExt() : umain.h, uevent.cpp
  • UEventSetTooltipHandler() : umain.h, uevent.cpp
  • UEventType : umain.h
  • UEXPORT : uconfig.h
  • UGetBValue : udraw.h
  • UGetGValue : udraw.h
  • UGetRValue : udraw.h
  • UHIWORD : umain.h
  • uid_t : config.h
  • UIMPLEMENT_DYNAMIC : uobject.h
  • UIMPLEMENT_DYNCREATE : uobject.h
  • UIMPLEMENT_RUNTIMECLASS : uobject.h
  • uInt : zlib.h, zconf.h
  • UINT_BIT : io.c
  • uIntf : zlib.h, zconf.h
  • UK_ADD : umain.h
  • UK_ALT : umain.h
  • UK_BACK : umain.h
  • UK_CANCEL : umain.h
  • UK_CLEAR : umain.h
  • UK_CONTROL : umain.h
  • UK_DECIMAL : umain.h
  • UK_DELETE : umain.h
  • UK_DIVIDE : umain.h
  • UK_DOWN : umain.h
  • UK_END : umain.h
  • UK_ESCAPE : umain.h
  • UK_F1 : umain.h
  • UK_F10 : umain.h
  • UK_F11 : umain.h
  • UK_F12 : umain.h
  • UK_F13 : umain.h
  • UK_F14 : umain.h
  • UK_F15 : umain.h
  • UK_F16 : umain.h
  • UK_F17 : umain.h
  • UK_F18 : umain.h
  • UK_F19 : umain.h
  • UK_F2 : umain.h
  • UK_F20 : umain.h
  • UK_F21 : umain.h
  • UK_F22 : umain.h
  • UK_F23 : umain.h
  • UK_F24 : umain.h
  • UK_F3 : umain.h
  • UK_F4 : umain.h
  • UK_F5 : umain.h
  • UK_F6 : umain.h
  • UK_F7 : umain.h
  • UK_F8 : umain.h
  • UK_F9 : umain.h
  • UK_HELP : umain.h
  • UK_HOME : umain.h
  • UK_INSERT : umain.h
  • UK_LBUTTON : umain.h
  • UK_LEFT : umain.h
  • UK_MBUTTON : umain.h
  • UK_MINUS : umain.h
  • UK_MULTIPLY : umain.h
  • UK_NEXT : umain.h
  • UK_NUMPAD0 : umain.h
  • UK_NUMPAD1 : umain.h
  • UK_NUMPAD2 : umain.h
  • UK_NUMPAD3 : umain.h
  • UK_NUMPAD4 : umain.h
  • UK_NUMPAD5 : umain.h
  • UK_NUMPAD6 : umain.h
  • UK_NUMPAD7 : umain.h
  • UK_NUMPAD8 : umain.h
  • UK_NUMPAD9 : umain.h
  • UK_PLUS : umain.h
  • UK_PRIOR : umain.h
  • UK_RBUTTON : umain.h
  • UK_RETURN : umain.h
  • UK_RIGHT : umain.h
  • UK_SEPARATOR : umain.h
  • UK_SHIFT : umain.h
  • UK_SPACE : umain.h
  • UK_SUBTRACT : umain.h
  • UK_TAB : umain.h
  • UK_UP : umain.h
  • ulg : zutil.h
  • UListSorter : umain.h
  • uLong : zlib.h, zconf.h
  • ULONG_MAX : strtoul.c
  • uLongf : zlib.h, zconf.h
  • ULOWORD : umain.h
  • UMakeBitmap : PseudoButton.h, umain.h
  • UMAKEINT : umain.h
  • UMASK_DFLT : options.h
  • UMENU : umain.h
  • UMENU_NULL : umain.h
  • UMenuAddButton() : umenu.h, umenu.cpp
  • UMenuAddPulldown() : umenu.h, umenu.cpp
  • UMenuAddSeparator() : umenu.h, umenu.cpp
  • UMenuAddToggle() : umenu.h, umenu.cpp
  • UMenuCount() : umenu.h, umenu.cpp
  • UMenuDelete() : umenu.h, umenu.cpp
  • UMenuDeleteByCmd() : umenu.h, umenu.cpp
  • UMSG_EXT : umain.h
  • UMSG_NOEXT : umain.h
  • UMSG_RANGE : umain.h
  • UNCHANGED : diff.h
  • UncheckoutFiles() : CVS_Coworker_i.h, cvs_coworker.h
  • uncompr : example.c
  • uncompress() : zlib.h, uncompr.c
  • uncomprLen : example.c
  • undotlines() : diff3.c
  • unedit() : edit.c, cvs.h
  • unedit_fileproc() : edit.c
  • UNGRAB : inffast.c
  • unidiff : patch.c
  • unidiff_flag : context.c
  • unidirectional_new_file_flag : diff.h
  • UnionRect() : udraw.h, udraw.cpp
  • UnitsTable : getdate.c, getdate.y, getdate.c
  • unlink : minigzip.c, vms.h, unlink.c, config.h
  • unlink_file() : cvs.h
  • unlink_file_dir() : cvs.h
  • unloadCVS() : AppGlue.mac.h, AppGlue.mac.cpp
  • unlock_proc() : lock.c
  • unlock_quiet : rcs.c
  • unlockrcs() : commit.c
  • unmodified() : CvsEntries.cpp
  • unput : lexer.cc
  • unreaped : waitpid.c
  • unrecog_head : fileattr.c
  • unroll_files_proc() : recurse.c
  • update() : update.c, cvs.h
  • UPDATE : hash.h, infutil.h
  • update_build_dirs : update.c
  • update_delproc() : cvs.h
  • update_dir : watch.c, update.c, tag.c, status.c, rtag.c, root.c, repos.c, remove.c, recurse.c, patch.c, log.c, lock.c, ignore.c, history.c, entries.c, edit.c, diff.c, create_adm.c, commit.c, admin.c
  • update_dirent_proc() : update.c
  • update_dirleave_proc() : update.c
  • update_fileproc() : update.c
  • update_filesdone_proc() : update.c
  • UPDATE_HASH : deflate.c
  • update_ignproc() : update.c
  • Update_Logfile() : logmsg.c, cvs.h
  • update_logfile_proc() : logmsg.c
  • update_preload : recurse.c
  • update_prune_dirs : update.c
  • update_rcs_file() : import.c
  • update_server : update.c
  • update_usage : update.c
  • UpdateFiles() : CVS_Coworker_i.h, cvs_coworker.h
  • updateUIMenu() : wincvs_winutil.cpp
  • UPDBITS : infutil.h
  • UPDIN : infutil.h
  • UPDOUT : infutil.h
  • UPMSG : umain.h
  • UPS_SOLID : udraw.h
  • URGB : udraw.h
  • URUNTIME_CLASS : uobject.h
  • usage() : main.cpp, cvs.h, diff3.c, diff.c, UCvsApp.cpp
  • use_cvsrc : main.c
  • use_editor : main.c, cvs.h
  • use_file_modtime : import.c
  • USE_OWN_POPEN : config.h
  • USE_OWN_TCPIP_H : config.h
  • USE_PROTOTYPES : config.h
  • USE_PYTHON : PythonContainer.h
  • use_rev1 : diff.c
  • use_rev2 : diff.c
  • USE_SETMODE_BINARY : config.h
  • USE_SETMODE_STDOUT : config.h
  • USE_TCL : TclGlue.cpp
  • USE_VMS_FILENAMES : config.h
  • user : rcs.c, import.c, entries.c, add.c
  • user_count : history.c
  • user_file_rev : diff.c
  • USER_INCREMENT : history.c
  • user_list : history.c
  • user_max : history.c
  • user_sort : history.c
  • usg : main.c
  • ush : zutil.h
  • ushf : zutil.h
  • using_to_diff3_block() : diff3.c
  • UTB_DROP : umain.h
  • UTB_KIND : PseudoButton.h
  • UTB_SEPARATOR : umain.h
  • UTB_VAR : umain.h
  • UTextTableView_DoubleClick : UPseudoSupport.h
  • UTextTableView_SingleClick : UPseudoSupport.h
  • UTHROW : uconsole.h, stdafx.h
  • UTickCount() : umain.h, uevent.cpp
  • utime() : utime.c, system.h
  • UTIME_EXPECTS_WRITABLE : config.h
  • UTREEITEM : umain.h
  • UWinPseudoWindowProc() : PseudoDlg.cpp
  • UWinToUMod() : PseudoDlg.cpp

- v -
  • v2 : log.c
  • v_checkout : history.c
  • va_alist : error.c
  • va_dcl : error.c
  • VA_START : util.c
  • val : rcs.c, edit.c
  • val_direntproc() : tag.c
  • val_fileproc() : tag.c
  • VALID : rcs.h
  • valloc() : cvs.h, valloc.c
  • valp : rcs.c
  • value : argmatch.c, diff.c
  • VARIABLE : hash.h
  • variable_delproc() : expand_path.c
  • variable_list : expand_path.c, cvs.h
  • variable_set() : cvs.h
  • vbranch : import.c
  • VC_EXTRALEAN : StdAfx.h
  • ver : rcs.c, log.c
  • VERIFY : CvsTrace.h
  • verifymsg_contents : mkmodules.c
  • verifymsg_proc() : logmsg.c
  • verifymsg_script : logmsg.c
  • verLess() : findtcl.cpp
  • verRemove() : findtcl.cpp
  • vers : update.c, rcs.c, no_diff.c, import.c, diff.c, commit.c, classify.c
  • Vers_TS : cvs.h
  • vers_ts : update.c
  • version : version.c, cvs.h, inflate.c, deflate.c, rcs.c
  • VERSION : pipe.c
  • version_compare() : log.c
  • VERSION_IE3 : CJToolBar.h
  • VERSION_IE4 : CJToolBar.h
  • VERSION_IE401 : CJToolBar.h
  • version_string : version.c
  • Version_TS() : vers_ts.c, cvs.h
  • version_usage : version.c
  • VERSION_WIN4 : CJToolBar.h
  • versp : classify.c
  • VERTF : CJDockContext.cpp
  • vfile : import.c
  • vfp : rcs.c
  • vhead : import.c
  • VMS_filename_classes : config.h
  • vms_low_readdir() : ndir.c
  • vms_start_server() : startserver.c
  • VMSmunch() : vmsmunch.h, vmsmunch.c
  • vn : entries.c
  • vnode : log.c
  • void() : fncase.c
  • VOID : system.h
  • voidp : zlib.h, zconf.h
  • voidpf : zlib.h, zconf.h
  • VolName2VRef() : VolsPaths.h, VolsPaths.c
  • VOLSPATHS_C : VolsPaths.c
  • VRef2VolName() : VolsPaths.h, VolsPaths.c
  • vtag : import.c

- w -
  • w : inflate.c, infblock.c
  • W_ATTIC : cvs.h
  • W_LOCAL : cvs.h
  • W_OK : config.h, system.h
  • W_REPOS : cvs.h
  • waited_pid : waitpid.c
  • waited_status : waitpid.c
  • WaitForCvs : AppGlue.h
  • waitpid() : waitpid.c, cvs.h, waitpid.c, pwd.c
  • WAITPID_CHILDREN : waitpid.c
  • wantDebugging : stdafx.h
  • warn : create_adm.c
  • WarnNoPython() : NoPython.h, NoPython.cpp
  • watch() : cvs.h
  • watch_addremove() : watch.c
  • watch_modify_watchers() : watch.c
  • watch_onoff() : edit.c
  • watch_usage : watch.h, watch.c
  • watchers() : cvs.h
  • watchers_fileproc() : watch.c
  • watches : edit.c
  • WAVAIL : infutil.h
  • WCVS_DEBUG_BUILD_STRING_PREFIX : version_fu.h
  • WCVS_DEBUG_FLAG : version_fu.h
  • wcvs_debug_mask_bits : WinCvsDebug.h
  • wcvs_debug_mask_flags : WinCvsDebug.h
  • WCVS_PATCHED_FLAG : version_fu.h
  • WCVS_PRERELEASE_BUILD_STRING_PREFIX : version_fu.h
  • WCVS_PRERELEASE_FLAG : version_fu.h
  • WCVS_PRIVATE_BUILD_FLAG : version_fu.h
  • WCVS_PRIVATE_BUILD_STRING : version_fu.h
  • WCVS_PRIVATE_BUILD_STRING_PREFIX : version_fu.h
  • WCVS_SPECIAL_BUILD_FLAG : version_fu.h
  • WCVS_SPECIAL_BUILD_STRING : version_fu.h
  • WCVS_SPECIAL_BUILD_STRING_PREFIX : version_fu.h
  • WCVS_UNICODE_BUILD_STRING_PREFIX : version_fu.h
  • wcvsdbg_one_shot : WinCvsDebug.h
  • wcvsdbg_one_shot_bit : WinCvsDebug.h
  • wcvsdbg_trace_dst_checks : WinCvsDebug.h
  • wcvsdbg_trace_dst_checks_bit : WinCvsDebug.h
  • wcvsdbg_trace_modified_checks : WinCvsDebug.h
  • wcvsdbg_trace_modified_checks_bit : WinCvsDebug.h
  • wcvsdbg_trace_stat : WinCvsDebug.h
  • wcvsdbg_trace_stat_bit : WinCvsDebug.h
  • wcvsdbg_verbose : WinCvsDebug.h
  • wcvsdbg_verbose_bit : WinCvsDebug.h
  • WEXITSTATUS : wait.h, system.h
  • What : strstr.c
  • what : watch.c
  • where : modules.c
  • where_orig : checkout.c
  • which : update.c, recurse.c, find_names.c
  • whitespace : rcs.c
  • who : edit.c
  • width : PseudoButton.cpp
  • WIDTHBYTES : dib.h
  • WIDTHBYTES16 : dib.h
  • WIDTHBYTES8 : dib.h
  • WIFEXITED : wait.h, system.h
  • WIFSIGNALED : wait.h
  • WIFSTOPPED : wait.h
  • will_wait : lock.c
  • WIN32_LEAN_AND_MEAN : win32.c, run.c
  • win32getlogin() : win32.c, pwd.c
  • Win32s : CJMenu.cpp
  • Win32Type : CJMenu.cpp
  • WINCVS_BETA_RELEASE : version_no.h
  • WINCVS_BUILD : version_no.h
  • wincvs_debug_mask : WinCvsDebug.cpp
  • WINCVS_FILE_MAJOR : version_no.h
  • WINCVS_FILE_MINOR : version_no.h
  • WINCVS_FILE_PATCHLEVEL : version_no.h
  • WINCVS_FILEVERSION : version_fu.h
  • WINCVS_FILEVERSION_STRING : version_fu.h
  • WINCVS_PRIVATE_BUILD : version_no.h
  • WINCVS_PRODUCT_MAJOR : version_no.h
  • WINCVS_PRODUCT_MINOR : version_no.h
  • WINCVS_PRODUCT_PATCHLEVEL : version_no.h
  • WINCVS_PRODUCTVERSION : version_fu.h
  • WINCVS_PRODUCTVERSION_STRING : version_fu.h
  • WINCVSDEBUG_H_INCLUDED : WinCvsDebug.h
  • windowBits : deflate.c
  • Windoze95 : CJMenu.cpp
  • WinInitWidgets() : PseudoDlg.cpp
  • WinNT3 : CJMenu.cpp
  • WinNT4orHigher : CJMenu.cpp
  • wire_clear_error() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_destroy() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_error() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_error_val : cvsgui_wire.cpp
  • wire_flush() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_flush_func : cvsgui_wire.cpp
  • wire_read() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_read_double() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_read_func : cvsgui_wire.cpp
  • wire_read_int16() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_read_int32() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_read_int8() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_read_msg() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_read_string() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_register() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_set_flusher() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_set_reader() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_set_writer() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_write() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_write_double() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_write_func : cvsgui_wire.cpp
  • wire_write_int16() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_write_int32() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_write_int8() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_write_msg() : cvsgui_wire.h, cvsgui_wire.cpp
  • wire_write_string() : cvsgui_wire.h, cvsgui_wire.cpp
  • WireDestroyFunc : cvsgui_wire.h
  • WireFlushFunc : cvsgui_wire.h
  • WireHandler : cvsgui_wire.cpp
  • WireIOFunc : cvsgui_wire.h
  • WireMessage : cvsgui_wire.h
  • WireReadFunc : cvsgui_wire.h
  • WireWriteFunc : cvsgui_wire.h
  • within() : history.c
  • WM_OUTBAR_NOTIFY : GfxOutBarCtrl.h
  • WM_RESETVIEW : WinCvsBrowser.cpp, BrowseFileView.cpp
  • wnt_asctime() : win32.c
  • wnt_cleanup() : win32.c, config.h
  • wnt_ctime() : win32.c
  • WNT_filename_classes : fncase.c
  • wnt_fstat() : StdAfx.h, Stat.cpp, win32.c, config.h
  • wnt_lstat() : StdAfx.h, Stat.cpp, win32.c, config.h
  • wnt_mkdir() : mkdir.c, config.h
  • wnt_rename() : config.h
  • wnt_shutdown_server() : startserver.c, config.h
  • wnt_start_server() : startserver.c, config.h
  • wnt_stat() : StdAfx.h, Stat.cpp, win32.c, config.h
  • word : io.c
  • WORD_BOUNDARY_P : regex.c
  • wordbeg : regex.c
  • wordbound : regex.c
  • wordchar : regex.c
  • WORDCHAR_P : regex.c
  • wordend : regex.c
  • workfile : rcscmds.c, rcs.c
  • working : history.c
  • working_dir : hardlink.h, hardlink.c
  • WRAP : infutil.h
  • wrap_add() : cvs.h
  • wrap_add_entry() : wrapper.c
  • wrap_add_file() : wrapper.c, cvs.h
  • WRAP_COPY : cvs.h
  • wrap_count : wrapper.c
  • wrap_free_entry() : wrapper.c
  • wrap_free_entry_internal() : wrapper.c
  • WRAP_FROMCVS : cvs.h
  • wrap_fromcvs_process_file() : cvs.h
  • wrap_kill() : wrapper.c
  • wrap_kill_temp() : wrapper.c
  • wrap_list : wrapper.c
  • wrap_matching_entry() : wrapper.c
  • WRAP_MERGE : cvs.h
  • wrap_merge_is_copy() : cvs.h
  • wrap_name_has() : cvs.h
  • WRAP_RCSOPTION : cvs.h
  • wrap_rcsoption() : cvs.h
  • wrap_restore_saved() : wrapper.c
  • wrap_saved_count : wrapper.c
  • wrap_saved_list : wrapper.c
  • wrap_saved_tempcount : wrapper.c
  • wrap_send() : cvs.h
  • wrap_setup() : wrapper.c, cvs.h
  • wrap_size : wrapper.c
  • wrap_tempcount : wrapper.c
  • WRAP_TOCVS : cvs.h
  • wrap_tocvs_process_file() : cvs.h
  • WrapMergeHas : cvs.h
  • WrapMergeMethod : cvs.h
  • wrapped_stat() : stat.c
  • WRAPPER_ENV : cvs.h
  • WRAPPER_GROW : wrapper.c
  • writable : filesubr.c, mac_filesubr.c, filesubr.c
  • WRITE_BUFFER_SIZE : cvsgui_process.h
  • write_dbmfile() : mkmodules.c
  • write_dirnonbranch : commit.c
  • write_dirtag : commit.c
  • write_ent_proc() : entries.c
  • write_fd : server_if.c
  • write_letter() : update.c
  • write_lock() : lock.c
  • write_output() : diff3.c, diff.h
  • writeattr_proc() : fileattr.c
  • writelock : lock.c
  • WriteMapFileHeaderandConvertFromDwordAlignToPacked() : dib.h, dib.c
  • Writer_Lock() : lock.c
  • WriterInit() : hqx.c
  • WriteTag() : cvs.h
  • WS_EX_FLATEDGE : CJCaption.h
  • WSAEADDRINUSE : rcmd.c
  • WSTOPSIG : wait.h
  • WTERMSIG : wait.h

- x -
  • x : gzio.c
  • x_free() : misc.h, misc.c
  • X_OK : config.h, system.h
  • xaflag : update.c
  • xbuild : update.c
  • xchanges : logmsg.c
  • xchmod() : cvs.h
  • xcmp() : cvs.h
  • xdate : update.c
  • xforce : update.c
  • xfree : misc.h
  • xgetwd() : getwd.c, cvs.h, xgetwd.c, savecwd.c
  • xjoin_rev1 : update.c
  • xjoin_rev2 : update.c
  • xlim : analyze.c
  • xlogfp : logmsg.c
  • xmalloc() : subr.c, cvs.h, xgetwd.c, diff3.c, diff.h
  • xmessage : logmsg.c
  • xoptions : update.c
  • xpipeout : update.c
  • xprefix : logmsg.c
  • xprune : update.c
  • xrcsnode : status.c
  • xreadlink() : cvs.h
  • xrealloc() : cvs.h, xgetwd.c, diff3.c, diff.h
  • xstrdup() : cvs.h
  • xtag : update.c
  • xvec : analyze.c
  • xwhere : rtag.c, patch.c

- y -
  • Year : getdate.c
  • yesno() : cvs.h, yesno.c
  • yesornofunc : lsh_dll.h
  • ylim : analyze.c
  • yoff : analyze.c
  • YR_2000_SECONDS : apsingle.c
  • yvec : analyze.c
  • yy_accept : lexer.cc
  • YY_AT_BOL : lexer.cc
  • yy_base : lexer.cc
  • YY_BREAK : lexer.cc
  • YY_BUF_SIZE : lexer.cc
  • YY_BUFFER_EOF_PENDING : lexer.cc
  • YY_BUFFER_NEW : lexer.cc
  • YY_BUFFER_NORMAL : lexer.cc
  • YY_BUFFER_STATE : lexer.cc
  • yy_c_buf_p : lexer.cc
  • YY_CHAR : lexer.cc
  • yy_chk : lexer.cc
  • yy_create_buffer() : lexer.cc
  • yy_current_buffer : lexer.cc
  • YY_CURRENT_BUFFER : lexer.cc
  • YY_DECL : lexer.cc
  • yy_def : lexer.cc
  • yy_delete_buffer() : lexer.cc
  • yy_did_buffer_switch_on_eof : lexer.cc
  • YY_DO_BEFORE_ACTION : lexer.cc
  • yy_ec : lexer.cc
  • YY_END_OF_BUFFER : lexer.cc
  • YY_END_OF_BUFFER_CHAR : lexer.cc
  • YY_EXIT_FAILURE : lexer.cc
  • YY_FATAL_ERROR : lexer.cc
  • yy_fatal_error() : lexer.cc
  • yy_flex_alloc() : lexer.cc
  • yy_flex_debug : CvsLog.cpp, common.h
  • yy_flex_free() : lexer.cc
  • YY_FLEX_MAJOR_VERSION : lexer.cc
  • YY_FLEX_MINOR_VERSION : lexer.cc
  • yy_flex_realloc() : lexer.cc
  • YY_FLUSH_BUFFER : lexer.cc
  • yy_flush_buffer() : lexer.cc
  • yy_get_next_buffer() : lexer.cc
  • yy_get_previous_state() : lexer.cc
  • yy_hold_char : lexer.cc
  • yy_init : lexer.cc
  • yy_init_buffer() : lexer.cc
  • YY_INPUT : lexer.cc
  • yy_last_accepting_cpos : lexer.cc
  • yy_last_accepting_state : lexer.cc
  • yy_load_buffer_state() : lexer.cc
  • yy_meta : lexer.cc
  • YY_MORE_ADJ : lexer.cc
  • yy_n_chars : lexer.cc
  • YY_NEVER_INTERACTIVE : common.h
  • yy_new_buffer : lexer.cc
  • YY_NEW_FILE : lexer.cc
  • YY_NO_POP_STATE : lexer.cc
  • YY_NO_PUSH_STATE : lexer.cc
  • YY_NO_TOP_STATE : lexer.cc
  • YY_NULL : lexer.cc
  • YY_NUM_RULES : lexer.cc
  • yy_nxt : lexer.cc
  • YY_PROTO : lexer.cc
  • YY_READ_BUF_SIZE : lexer.cc
  • YY_RESTORE_YY_MORE_OFFSET : lexer.cc
  • YY_RULE_SETUP : lexer.cc
  • YY_SC_TO_UI : lexer.cc
  • yy_scan_buffer() : lexer.cc
  • yy_scan_bytes() : lexer.cc
  • yy_scan_string() : lexer.cc
  • yy_set_bol : lexer.cc
  • yy_set_interactive : lexer.cc
  • yy_size_t : lexer.cc
  • YY_START : lexer.cc
  • yy_start : lexer.cc
  • YY_START_STACK_INCR : lexer.cc
  • YY_STATE_EOF : lexer.cc
  • yy_state_type : lexer.cc
  • yy_switch_to_buffer() : lexer.cc
  • yy_try_NUL_trans() : lexer.cc
  • YY_USE_CONST : lexer.cc
  • YY_USE_PROTOS : lexer.cc
  • YYABORT : parser.cc, getdate.c
  • YYACCEPT : parser.cc, getdate.c
  • yyact : getdate.c
  • YYBACKUP : parser.cc, getdate.c
  • YYBISON : parser.cc
  • YYBYACC : getdate.c
  • yychar : parser.cc, getdate.c, getdate.y, getdate.c
  • yycheck : parser.cc, getdate.c
  • yychk : getdate.c
  • yyclearin : parser.cc, getdate.c
  • yyconst : lexer.cc
  • yyDay : getdate.c, getdate.y, getdate.c
  • yyDayNumber : getdate.c, getdate.y, getdate.c
  • yyDayOrdinal : getdate.c
  • yydebug : getdate.c, getdate.y, getdate.c
  • YYDEBUG : parser.cc, getdate.c
  • yydef : getdate.c
  • yydefact : parser.cc
  • yydefgoto : parser.cc
  • yydefred : getdate.c
  • yydgoto : getdate.c
  • yyDSTmode : getdate.c, getdate.y, getdate.c
  • YYEMPTY : parser.cc, getdate.c
  • YYEOF : parser.cc
  • YYERRCODE : parser.cc, getdate.c
  • yyerrflag : getdate.c
  • yyerrok : parser.cc, getdate.c
  • yyerror : parser.cc, common.h, getdate.c, getdate.y, getdate.c
  • YYERROR : parser.cc, getdate.c
  • YYFAIL : parser.cc
  • YYFINAL : parser.cc, getdate.c
  • YYFLAG : parser.cc, getdate.c
  • YYFREESTACK : getdate.c
  • yygindex : getdate.c
  • yygraph() : main.cpp
  • yygrowstack() : getdate.c
  • yyHaveDate : getdate.c
  • yyHaveDay : getdate.c
  • yyHaveRel : getdate.c
  • yyHaveTime : getdate.c
  • yyHaveZone : getdate.c
  • yyHour : getdate.c
  • yyin : lexer.cc, common.h
  • YYINITDEPTH : parser.cc
  • yyinitstack() : getdate.c
  • YYINITSTACKSIZE : getdate.c
  • yyinput() : lexer.cc
  • yyInput : getdate.c
  • YYLAST : parser.cc, getdate.c
  • yylen : getdate.c
  • yyleng : lexer.cc
  • yyless : lexer.cc
  • yylex : lexer.cc, common.h, getdate.c, getdate.y, getdate.c
  • YYLEX : parser.cc, getdate.c
  • yylhs : getdate.c
  • yylval : parser.h, parser.cc, getdate.c, getdate.y, getdate.c
  • yylval_set() : parser.cc, common.h
  • YYMAJOR : getdate.c
  • YYMAXDEPTH : parser.cc, getdate.c
  • YYMAXTOKEN : getdate.c
  • yyMeridian : getdate.c, getdate.y, getdate.c
  • YYMINOR : getdate.c
  • yyMinutes : getdate.c, getdate.y, getdate.c
  • yyMonth : getdate.c
  • yymore : lexer.cc
  • yynerrs : parser.cc, getdate.c, getdate.y, getdate.c
  • YYNPROD : getdate.c
  • YYNTBASE : parser.cc
  • yyout : lexer.cc
  • yyoutput() : main.cpp
  • yypact : parser.cc, getdate.c
  • yyparse : parser.cc, common.h, getdate.c, getdate.y, getdate.c
  • YYPARSE_PARAM_ARG : parser.cc
  • YYPARSE_PARAM_DECL : parser.cc
  • yypgo : getdate.c
  • yypgoto : parser.cc
  • YYPOPSTACK : parser.cc
  • YYPREFIX : getdate.c
  • yyps : getdate.c
  • yypv : getdate.c
  • yyr1 : parser.cc, getdate.c
  • yyr2 : parser.cc, getdate.c
  • YYRECOVERING : parser.cc, getdate.c
  • YYREJECT : getdate.c
  • yyRelMonth : getdate.c, getdate.y, getdate.c
  • yyRelSeconds : getdate.c
  • yyreset() : parser.cc, common.h
  • yyrestart() : lexer.cc, common.h
  • yyrindex : getdate.c
  • yys : getdate.c
  • yysccsid : getdate.c
  • yySeconds : getdate.c, getdate.y, getdate.c
  • yysindex : getdate.c
  • YYSTACK_ALLOC : parser.cc
  • YYSTACKSIZE : getdate.c
  • yystate : getdate.c
  • YYSTATE : lexer.cc
  • yytable : parser.cc, getdate.c
  • YYTABLESIZE : getdate.c
  • yyterminate : lexer.cc
  • YYTERROR : parser.cc
  • yytext : lexer.cc
  • yytext_ptr : lexer.cc
  • yyTimezone : getdate.c, getdate.y, getdate.c
  • yytmp : getdate.c
  • yytranslate : parser.cc
  • YYTRANSLATE : parser.cc
  • yyunput() : lexer.cc
  • yyv : getdate.c
  • yyval : getdate.c
  • yywrap() : lexer.cc
  • yyYear : getdate.c

- z -
  • z : infutil.c, inftrees.c, inffast.c, infcodes.c, infblock.c
  • Z_ASCII : zlib.h
  • Z_BEST_COMPRESSION : zlib.h
  • Z_BEST_SPEED : zlib.h
  • Z_BINARY : zlib.h
  • Z_BUF_ERROR : zlib.h
  • Z_BUFSIZE : gzio.c
  • Z_DATA_ERROR : zlib.h
  • Z_DEFAULT_COMPRESSION : zlib.h
  • Z_DEFAULT_STRATEGY : zlib.h
  • Z_DEFLATED : zlib.h
  • z_errmsg : zutil.h, zutil.c
  • Z_ERRNO : zlib.h
  • Z_FILTERED : zlib.h
  • Z_FINISH : zlib.h
  • Z_FULL_FLUSH : zlib.h
  • Z_HUFFMAN_ONLY : zlib.h
  • Z_MEM_ERROR : zlib.h
  • Z_NEED_DICT : zlib.h
  • Z_NO_COMPRESSION : zlib.h
  • Z_NO_FLUSH : zlib.h
  • Z_NULL : zlib.h
  • Z_OK : zlib.h
  • Z_PARTIAL_FLUSH : zlib.h
  • z_stream : zlib.h
  • Z_STREAM_END : zlib.h
  • Z_STREAM_ERROR : zlib.h
  • z_streamp : zlib.h
  • Z_SYNC_FLUSH : zlib.h
  • Z_UNKNOWN : zlib.h
  • Z_VERSION_ERROR : zlib.h
  • ZALLOC : zutil.h
  • zcalloc() : zutil.h, zutil.c
  • zcfree() : zutil.h
  • ZFREE : zutil.h
  • ZLIB_VERSION : zlib.h
  • zlib_version : zlib.h
  • zlibVersion() : zutil.c, zlib.h
  • zmemcmp : zutil.h
  • zmemcpy : zutil.h
  • zmemzero : zutil.h
  • zs : inftrees.c
  • zstrerror : zutil.h
Generated on Sun Oct 21 12:51:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Graphical Class Hierarchy

WinCvs 1.3b6 Source Doc Graphical Class Hierarchy

Go to the textual class hierarchy

Generated on Sun Oct 21 12:51:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CColorConsole Member List

This is the complete list of members for CColorConsole, including all inherited members.
  • CColorConsole()
  • operator<<(char c)
  • operator<<(kConsoleColor color)
  • operator<<(const char *str)
  • operator<<(int value)
  • ~CColorConsole() [virtual]
Generated on Sun Oct 21 12:47:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CAuthenSetUp Member List

This is the complete list of members for CAuthenSetUp, including all inherited members.
  • CAuthenSetUp() [inline]
  • ~CAuthenSetUp() [inline]
Generated on Sun Oct 21 12:45:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CStreamConsole Member List

This is the complete list of members for CStreamConsole, including all inherited members.
  • CStreamConsole(FILE *out) [inline]
  • cvs_err(char *txt, long len) [inline, virtual]
  • cvs_out(char *txt, long len) [inline, virtual]
  • fOut [protected]
Generated on Sun Oct 21 12:49:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CTmpFiles Member List

This is the complete list of members for CTmpFiles, including all inherited members.
  • allfiles [protected]
  • push_back(const char *file) [inline]
  • ~CTmpFiles() [inline]
Generated on Sun Oct 21 12:50:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCvsConsole Member List

This is the complete list of members for CCvsConsole, including all inherited members.
  • cvs_err(char *txt, long len)=0L [pure virtual]
  • cvs_out(char *txt, long len)=0L [pure virtual]
Generated on Sun Oct 21 12:47:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UPromptMessage Member List

This is the complete list of members for UPromptMessage, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool fill) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kCancel enum value
  • kMsg enum value
  • kOK enum value
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_cncl [protected]
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_msg [protected]
  • m_ok [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_title [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnCancel(void) [protected]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnOK(void) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UPromptMessage(const char *msg, const char *title, const char *def, const char *cncl) [inline]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UObject() [inline, virtual]
  • ~UPromptMessage() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:49:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UEditMessage Member List

This is the complete list of members for UEditMessage, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool fill) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kCancel enum value
  • kEdit enum value
  • kMsg enum value
  • kOK enum value
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_cncl [protected]
  • m_currentPage [protected]
  • m_edit
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_msg [protected]
  • m_ok [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_title [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnCancel(void) [protected]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnOK(void) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UEditMessage(const char *msg, const char *edit, const char *title, const char *def, const char *cncl) [inline]
  • UObject() [inline, protected]
  • UPromptMessage(const char *msg, const char *title, const char *def, const char *cncl) [inline]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UEditMessage() [inline, virtual]
  • ~UObject() [inline, virtual]
  • ~UPromptMessage() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:47:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

AuthenLocal Member List

This is the complete list of members for AuthenLocal, including all inherited members.
  • AuthenLocal() [inline]
  • AuthenModel()
  • DoSettings(void) [inline, virtual]
  • GetAllInstances(void) [static]
  • GetInstance(AuthenKind k) [static]
  • GetKind(void) const [inline, virtual]
  • GetSettingsDesc(UStr &desc) [inline, virtual]
  • GetToken(void) const [inline, virtual]
  • HasHost(void) const [inline, virtual]
  • HasSettings(void) const [inline, virtual]
  • HasUser(void) const [inline, virtual]
  • m_instances [protected, static]
  • OnGetEnv(char *env) [inline, virtual]
  • OnRestoreEnv(void) [virtual]
  • OnSetupEnv(void) [virtual]
  • ~AuthenLocal() [inline, virtual]
  • ~AuthenModel() [virtual]
Generated on Sun Oct 21 12:45:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

AuthenSSH Member List

This is the complete list of members for AuthenSSH, including all inherited members.
  • AuthenModel()
  • AuthenSSH() [inline]
  • DoSettings(void) [virtual]
  • gCurRsaIdentity [static]
  • GetAllInstances(void) [static]
  • GetInstance(AuthenKind k) [static]
  • GetKind(void) const [inline, virtual]
  • GetSettingsDesc(UStr &desc) [virtual]
  • GetToken(void) const [inline, virtual]
  • gRsaIdentity [static]
  • gRsaIdentityFile [static]
  • gSSHName [static]
  • gSSHOptions [static]
  • HasHost(void) const [inline, virtual]
  • HasSettings(void) const [inline, virtual]
  • HasUser(void) const [inline, virtual]
  • m_instances [protected, static]
  • OnGetEnv(char *env) [virtual]
  • OnRestoreEnv(void) [virtual]
  • OnSetupEnv(void) [virtual]
  • RsaIdentityFile(void) [static]
  • ~AuthenModel() [virtual]
  • ~AuthenSSH() [inline, virtual]
Generated on Sun Oct 21 12:45:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UAuthen_SSH Member List

This is the complete list of members for UAuthen_SSH, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool fill) [virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kCancel enum value
  • kOK enum value
  • kOptionsCheck enum value
  • kOptionsEdit enum value
  • kOptionsText enum value
  • kRSABtn enum value
  • kRSACheck enum value
  • kRSAEdit enum value
  • kSSHBtn enum value
  • kSSHCheck enum value
  • kSSHName enum value
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_options [protected]
  • m_rsaidentity [protected]
  • m_rsaidentityfile [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnBtnName(void) [protected]
  • OnBtnRSA(void) [protected]
  • OnCheckName(void) [protected]
  • OnCheckOptions(void) [protected]
  • OnCheckRSA(void) [protected]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UAuthen_SSH()
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UAuthen_SSH() [inline, virtual]
  • ~UCmdTarget() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:45:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

AuthenPserver Member List

This is the complete list of members for AuthenPserver, including all inherited members.
  • AuthenModel()
  • AuthenPserver() [inline]
  • DoSettings(void) [virtual]
  • GetAllInstances(void) [static]
  • GetInstance(AuthenKind k) [static]
  • GetKind(void) const [inline, virtual]
  • GetSettingsDesc(UStr &desc) [virtual]
  • GetToken(void) const [inline, virtual]
  • HasHost(void) const [inline, virtual]
  • HasSettings(void) const [inline, virtual]
  • HasUser(void) const [inline, virtual]
  • m_instances [protected, static]
  • OnGetEnv(char *env) [virtual]
  • OnRestoreEnv(void) [virtual]
  • OnSetupEnv(void) [virtual]
  • ~AuthenModel() [virtual]
  • ~AuthenPserver() [inline, virtual]
Generated on Sun Oct 21 12:45:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UAuthen_Pserver Member List

This is the complete list of members for UAuthen_Pserver, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool fill) [virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kCancel enum value
  • kCheckPort enum value
  • kCheckProxy enum value
  • kEditPort enum value
  • kEditProxy enum value
  • kNameProxy enum value
  • kOK enum value
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_pname [protected]
  • m_port [protected]
  • m_pport [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnCheckPort(void) [protected]
  • OnCheckProxy(void) [protected]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UAuthen_Pserver()
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UAuthen_Pserver() [inline, virtual]
  • ~UCmdTarget() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:45:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

AuthenRhosts Member List

This is the complete list of members for AuthenRhosts, including all inherited members.
  • AuthenModel()
  • AuthenRhosts() [inline]
  • DoSettings(void) [virtual]
  • GetAllInstances(void) [static]
  • GetInstance(AuthenKind k) [static]
  • GetKind(void) const [inline, virtual]
  • GetSettingsDesc(UStr &desc) [virtual]
  • GetToken(void) const [inline, virtual]
  • HasHost(void) const [inline, virtual]
  • HasSettings(void) const [inline, virtual]
  • HasUser(void) const [inline, virtual]
  • m_instances [protected, static]
  • OnGetEnv(char *env) [virtual]
  • OnRestoreEnv(void) [virtual]
  • OnSetupEnv(void) [virtual]
  • ~AuthenModel() [virtual]
  • ~AuthenRhosts() [inline, virtual]
Generated on Sun Oct 21 12:45:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UAuthen_Rhosts Member List

This is the complete list of members for UAuthen_Rhosts, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool fill) [virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kCancel enum value
  • kCheckPort enum value
  • kCheckRSHName enum value
  • kCheckServerName enum value
  • kEditPort enum value
  • kEditRSHName enum value
  • kEditServerName enum value
  • kOK enum value
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_port [protected]
  • m_rshname [protected]
  • m_servername [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnCheckPort(void) [protected]
  • OnCheckRshName(void) [protected]
  • OnCheckServerName(void) [protected]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UAuthen_Rhosts()
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UAuthen_Rhosts() [inline, virtual]
  • ~UCmdTarget() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:45:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

AuthenKserver Member List

This is the complete list of members for AuthenKserver, including all inherited members.
  • AuthenKserver() [inline]
  • AuthenModel()
  • DoSettings(void) [virtual]
  • GetAllInstances(void) [static]
  • GetInstance(AuthenKind k) [static]
  • GetKind(void) const [inline, virtual]
  • GetSettingsDesc(UStr &desc) [virtual]
  • GetToken(void) const [inline, virtual]
  • HasHost(void) const [inline, virtual]
  • HasSettings(void) const [inline, virtual]
  • HasUser(void) const [inline, virtual]
  • m_instances [protected, static]
  • OnGetEnv(char *env) [virtual]
  • OnRestoreEnv(void) [virtual]
  • OnSetupEnv(void) [virtual]
  • ~AuthenKserver() [inline, virtual]
  • ~AuthenModel() [virtual]
Generated on Sun Oct 21 12:45:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UAuthen_Kserver Member List

This is the complete list of members for UAuthen_Kserver, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool fill) [virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kCancel enum value
  • kCheckPort enum value
  • kEditPort enum value
  • kOK enum value
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_port [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnCheckPort(void) [protected]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UAuthen_Kserver()
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UAuthen_Kserver() [inline, virtual]
  • ~UCmdTarget() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:45:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

AuthenNtserver Member List

This is the complete list of members for AuthenNtserver, including all inherited members.
  • AuthenModel()
  • AuthenNtserver() [inline]
  • DoSettings(void) [inline, virtual]
  • GetAllInstances(void) [static]
  • GetInstance(AuthenKind k) [static]
  • GetKind(void) const [inline, virtual]
  • GetSettingsDesc(UStr &desc) [inline, virtual]
  • GetToken(void) const [inline, virtual]
  • HasHost(void) const [inline, virtual]
  • HasSettings(void) const [inline, virtual]
  • HasUser(void) const [inline, virtual]
  • m_instances [protected, static]
  • OnGetEnv(char *env) [virtual]
  • OnRestoreEnv(void) [virtual]
  • OnSetupEnv(void) [virtual]
  • ~AuthenModel() [virtual]
  • ~AuthenNtserver() [inline, virtual]
Generated on Sun Oct 21 12:45:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

Authen Member List

This is the complete list of members for Authen, including all inherited members.
  • Authen() [inline]
  • kind(void)
  • kindstr(void)
  • kindToNum(AuthenKind k) [static]
  • kindToToken(AuthenKind k) [static]
  • numToKind(short num) [static]
  • parse_cvsroot(const char *CVSroot, UStr &theMethod, UStr &theUser, UStr &theHost, UStr &thePath) [static]
  • setkind(AuthenKind newkind)
  • skiptoken(const char *cvsroot) [static]
  • token(void)
  • tokenToKind(const char *t) [static]
Generated on Sun Oct 21 12:45:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

AuthenModel Member List

This is the complete list of members for AuthenModel, including all inherited members.
  • AuthenModel()
  • DoSettings(void) [inline, virtual]
  • GetAllInstances(void) [static]
  • GetInstance(AuthenKind k) [static]
  • GetKind(void) const=0 [pure virtual]
  • GetSettingsDesc(UStr &desc) [inline, virtual]
  • GetToken(void) const=0 [pure virtual]
  • HasHost(void) const [inline, virtual]
  • HasSettings(void) const [inline, virtual]
  • HasUser(void) const [inline, virtual]
  • m_instances [protected, static]
  • OnGetEnv(char *env) [inline, virtual]
  • OnRestoreEnv(void) [virtual]
  • OnSetupEnv(void) [virtual]
  • ~AuthenModel() [virtual]
Generated on Sun Oct 21 12:45:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoNameColumn Member List

This is the complete list of members for KoNameColumn, including all inherited members.
  • Compare(KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const [inline, virtual]
  • GetSetupData(LV_COLUMN *lvc) const [inline, virtual]
  • GetText(KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const [inline, virtual]
  • IsDefaultAscending() const [inline, virtual]
Generated on Sun Oct 21 12:48:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoPathColumn Member List

This is the complete list of members for KoPathColumn, including all inherited members.
  • Compare(KoColumnContext *context, EntnodeData *d1, EntnodeData *d2) const [inline, virtual]
  • GetSetupData(LV_COLUMN *lvc) const [inline, virtual]
  • GetText(KoColumnContext *context, EntnodeData *data, char *buffer, int bufferSize) const [inline, virtual]
  • IsDefaultAscending() const [inline, virtual]
Generated on Sun Oct 21 12:48:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoRevisionColumn Member List

This is the complete list of members for KoRevisionColumn, including all inherited members.
  • Compare(KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const [inline, virtual]
  • GetSetupData(LV_COLUMN *lvc) const [inline, virtual]
  • GetText(KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const [inline, virtual]
  • IsDefaultAscending() const [inline, virtual]
  • revcmp(const char *rev1, const char *rev2) [inline, static]
Generated on Sun Oct 21 12:48:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoOptionColumn Member List

This is the complete list of members for KoOptionColumn, including all inherited members.
  • Compare(KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const [inline, virtual]
  • GetSetupData(LV_COLUMN *lvc) const [inline, virtual]
  • GetText(KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const [inline, virtual]
  • IsDefaultAscending() const [inline, virtual]
Generated on Sun Oct 21 12:48:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoStatusColumn Member List

This is the complete list of members for KoStatusColumn, including all inherited members.
  • Compare(KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const [inline, virtual]
  • GetSetupData(LV_COLUMN *lvc) const [inline, virtual]
  • GetText(KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const [inline, virtual]
  • IsDefaultAscending() const [inline, virtual]
Generated on Sun Oct 21 12:48:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoTagColumn Member List

This is the complete list of members for KoTagColumn, including all inherited members.
  • Compare(KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const [inline, virtual]
  • GetSetupData(LV_COLUMN *lvc) const [inline, virtual]
  • GetText(KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const [inline, virtual]
  • IsDefaultAscending() const [inline, virtual]
Generated on Sun Oct 21 12:48:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoDateColumn Member List

This is the complete list of members for KoDateColumn, including all inherited members.
  • Compare(KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const [inline, virtual]
  • GetSetupData(LV_COLUMN *lvc) const [inline, virtual]
  • GetText(KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const [inline, virtual]
  • IsDefaultAscending() const [inline, virtual]
Generated on Sun Oct 21 12:48:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoConflictColumn Member List

This is the complete list of members for KoConflictColumn, including all inherited members.
  • Compare(KoColumnContext *, EntnodeData *d1, EntnodeData *d2) const [inline, virtual]
  • GetSetupData(LV_COLUMN *lvc) const [inline, virtual]
  • GetText(KoColumnContext *, EntnodeData *data, char *buffer, int bufferSize) const [inline, virtual]
  • IsDefaultAscending() const [inline, virtual]
Generated on Sun Oct 21 12:48:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoRegularModel Member List

This is the complete list of members for KoRegularModel, including all inherited members.
  • GetAt(int pos) const [inline, virtual]
  • GetColumn(int type) const [virtual]
  • GetCount() const [inline, virtual]
  • GetRecursiveModel() [static]
  • GetRegularModel() [static]
  • GetType(int pos) const [inline, virtual]
Generated on Sun Oct 21 12:48:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoRecursiveModel Member List

This is the complete list of members for KoRecursiveModel, including all inherited members.
  • GetAt(int pos) const [inline, virtual]
  • GetColumn(int type) const [virtual]
  • GetCount() const [inline, virtual]
  • GetRecursiveModel() [static]
  • GetRegularModel() [static]
  • GetType(int pos) const [inline, virtual]
Generated on Sun Oct 21 12:48:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoColumnContext Member List

This is the complete list of members for KoColumnContext, including all inherited members.
  • KoColumnContext(const char *path) [inline]
  • m_path
Generated on Sun Oct 21 12:48:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

LV_COLUMN Member List

This is the complete list of members for LV_COLUMN, including all inherited members.
  • name
  • width
Generated on Sun Oct 21 12:48:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KiColumn Member List

This is the complete list of members for KiColumn, including all inherited members.
  • Compare(KoColumnContext *context, EntnodeData *d1, EntnodeData *d2) const=0 [pure virtual]
  • GetSetupData(LV_COLUMN *lvc) const=0 [pure virtual]
  • GetText(KoColumnContext *context, EntnodeData *data, char *buffer, int buffersize) const=0 [pure virtual]
  • IsDefaultAscending() const=0 [pure virtual]
Generated on Sun Oct 21 12:48:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KiColumnModel Member List

This is the complete list of members for KiColumnModel, including all inherited members.
  • GetAt(int pos) const=0 [pure virtual]
  • GetColumn(int type) const [virtual]
  • GetCount() const=0 [pure virtual]
  • GetRecursiveModel() [static]
  • GetRegularModel() [static]
  • GetType(int pos) const=0 [pure virtual]
Generated on Sun Oct 21 12:48:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CSortParam Member List

This is the complete list of members for CSortParam, including all inherited members.
  • CSortParam(bool fAccendant, bool fGroupSubDir, const KiColumn *column, const KiColumn *columnAlt, KoColumnContext *context) [inline]
  • m_column
  • m_columnAlt
  • m_context
  • m_fAccendant
  • m_fGroupSubDir
Generated on Sun Oct 21 12:49:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KiSelectionHandler Member List

This is the complete list of members for KiSelectionHandler, including all inherited members.
  • OnFiles(MultiFiles *mf)=0 [pure virtual]
  • OnFolder(const char *fullpath)=0 [pure virtual]
Generated on Sun Oct 21 12:48:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoMoveToTrashHandler Member List

This is the complete list of members for KoMoveToTrashHandler, including all inherited members.
  • OnFiles(MultiFiles *mf) [inline, virtual]
  • OnFolder(const char *fullpath) [inline, virtual]
Generated on Sun Oct 21 12:48:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoUpdateMoveToTrashHandler Member List

This is the complete list of members for KoUpdateMoveToTrashHandler, including all inherited members.
  • IsEnabled() const [inline]
  • KoUpdateMoveToTrashHandler() [inline]
  • m_isFiles [private]
  • m_isFolders [private]
  • OnFiles(MultiFiles *) [inline, virtual]
  • OnFolder(const char *fullpath) [inline, virtual]
Generated on Sun Oct 21 12:48:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoCreateTagHandler Member List

This is the complete list of members for KoCreateTagHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoDeleteTagHandler Member List

This is the complete list of members for KoDeleteTagHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoBranchTagHandler Member List

This is the complete list of members for KoBranchTagHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoEditHandler Member List

This is the complete list of members for KoEditHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoUneditHandler Member List

This is the complete list of members for KoUneditHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoReleaseHandler Member List

This is the complete list of members for KoReleaseHandler, including all inherited members.
  • OnFiles(MultiFiles *) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoWatchersHandler Member List

This is the complete list of members for KoWatchersHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoEditorsHandler Member List

This is the complete list of members for KoEditorsHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoWatchOnHandler Member List

This is the complete list of members for KoWatchOnHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoWatchOffHandler Member List

This is the complete list of members for KoWatchOffHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoDiffHandler Member List

This is the complete list of members for KoDiffHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoLogHandler Member List

This is the complete list of members for KoLogHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoGraphHandler Member List

This is the complete list of members for KoGraphHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *) [inline, private, virtual]
Generated on Sun Oct 21 12:48:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoStatusHandler Member List

This is the complete list of members for KoStatusHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoFileRemoveHandler Member List

This is the complete list of members for KoFileRemoveHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoLockHandler Member List

This is the complete list of members for KoLockHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoUnlockHandler Member List

This is the complete list of members for KoUnlockHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoAddHandler Member List

This is the complete list of members for KoAddHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoAddBinaryHandler Member List

This is the complete list of members for KoAddBinaryHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoCommitHandler Member List

This is the complete list of members for KoCommitHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoUpdateHandler Member List

This is the complete list of members for KoUpdateHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoQueryUpdateHandler Member List

This is the complete list of members for KoQueryUpdateHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *fullpath) [inline, private, virtual]
Generated on Sun Oct 21 12:48:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoAnnotateHandler Member List

This is the complete list of members for KoAnnotateHandler, including all inherited members.
  • OnFiles(MultiFiles *pmf) [inline, private, virtual]
  • OnFolder(const char *) [inline, private, virtual]
Generated on Sun Oct 21 12:48:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

NotificationManager Member List

This is the complete list of members for NotificationManager, including all inherited members.
  • CheckIn(CObject *observer, FNOBSERVER handler) [inline]
  • CheckOut(CObject *observer) [inline]
  • m_nodes [private]
  • NotificationManager() [inline]
  • NotifyAll() [inline]
Generated on Sun Oct 21 12:48:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

NotificationManager::Node Member List

This is the complete list of members for NotificationManager::Node, including all inherited members.
  • handler
  • Node() [inline]
  • Node(CObject *o, FNOBSERVER h) [inline]
  • Node(const Node &n) [inline]
  • observer
  • operator=(const Node &n) [inline]
Generated on Sun Oct 21 12:48:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KiFilterModel Member List

This is the complete list of members for KiFilterModel, including all inherited members.
  • GetNotificationManager()=0 [pure virtual]
  • IsMatch(EntnodeData *data)=0 [pure virtual]
Generated on Sun Oct 21 12:48:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KiRecursionModel Member List

This is the complete list of members for KiRecursionModel, including all inherited members.
  • GetNotificationManager()=0 [pure virtual]
  • IsShowRecursive()=0 [pure virtual]
Generated on Sun Oct 21 12:48:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KiIgnoreModel Member List

This is the complete list of members for KiIgnoreModel, including all inherited members.
  • GetNotificationManager()=0 [pure virtual]
  • IsShowIgnored()=0 [pure virtual]
Generated on Sun Oct 21 12:48:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoFilterModel Member List

This is the complete list of members for KoFilterModel, including all inherited members.
  • GetNotificationManager() [virtual]
  • IsAdded() const [inline]
  • IsChanged() const [inline]
  • IsConflict() const [inline]
  • IsDefaultMode() const
  • IsHideUnknown() const [inline]
  • IsMatch(EntnodeData *data) [virtual]
  • IsMissing() const [inline]
  • IsModified() const
  • IsRemoved() const [inline]
  • IsUnknown() const [inline]
  • KoFilterModel()
  • m_isAdded [protected]
  • m_isChanged [protected]
  • m_isConflicts [protected]
  • m_isHideUnknown [protected]
  • m_isMissing [protected]
  • m_isRemoved [protected]
  • m_isUnknown [protected]
  • m_manager [protected]
  • m_mask [protected]
  • m_match [protected]
  • SetMask(const char *mask)
  • ToggleAdded() [inline]
  • ToggleChanged() [inline]
  • ToggleConflict() [inline]
  • ToggleHideUnknown()
  • ToggleMissing() [inline]
  • ToggleModified()
  • ToggleRemoved() [inline]
  • ToggleUnknown()
  • ~KoFilterModel()
Generated on Sun Oct 21 12:48:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoRecursionModel Member List

This is the complete list of members for KoRecursionModel, including all inherited members.
  • GetNotificationManager() [virtual]
  • IsShowRecursive() [virtual]
  • KoRecursionModel()
  • m_isRecursive [private]
  • m_manager [private]
  • ToggleRecursion()
  • ~KoRecursionModel()
Generated on Sun Oct 21 12:48:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoIgnoreModel Member List

This is the complete list of members for KoIgnoreModel, including all inherited members.
  • GetNotificationManager() [virtual]
  • IsShowIgnored() [virtual]
  • KoIgnoreModel()
  • m_isIgnore [private]
  • m_manager [private]
  • ToggleIgnore()
  • ~KoIgnoreModel()
Generated on Sun Oct 21 12:48:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PCPStr Member List

This is the complete list of members for PCPStr, including all inherited members.
  • _GetBaseClass() [static]
  • c_str() const [inline]
  • classUObject [protected, static]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CreateObject(const char *className) [static]
  • empty(void) const [inline]
  • endsWith(char c) const [inline]
  • fAllEntries [protected, static]
  • Find(const char *uniqueName) [static]
  • flush(void) [protected]
  • fTimeStamp [protected]
  • GetData(void) const [inline, virtual]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • IsKindOf(const URuntimeClass *pClass) const
  • length(void) const [inline]
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • operator char *() [inline]
  • operator const char *() const [inline]
  • operator const unsigned char *() const [inline]
  • operator unsigned char *() [inline]
  • operator<<(const char *addToStr)
  • operator<<(char addToStr)
  • operator<<(int addToStr)
  • operator=(const char *newstr) [inline]
  • operator=(const unsigned char *newstr) [inline]
  • UPStr::operator=(const UPStr &newstr)
  • p_str() const [inline]
  • PCPStr(const char *uniqueName, const char *defValue=0L, kClassPersistent pclass=kNoClass) [inline]
  • replace(char which, char bywhich)
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • set(const char *buf, unsigned int len)
  • SetData(const void *ptr, unsigned int size) [inline, virtual]
  • SizeOf(void) const [inline, virtual]
  • str [protected]
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • UPStr() [inline]
  • UPStr(const char *newstr) [inline]
  • UPStr(const unsigned char *newstr) [inline]
  • UPStr(const UPStr &newstr) [inline]
  • ~CPersistent() [virtual]
  • ~PCPStr() [inline, virtual]
  • ~UObject() [inline, virtual]
  • ~UPStr() [inline, virtual]
Generated on Sun Oct 21 12:48:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PCStr Member List

This is the complete list of members for PCStr, including all inherited members.
  • _GetBaseClass() [static]
  • c_str() const [inline]
  • classUObject [protected, static]
  • compare(const char *thestr) const [inline]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CreateObject(const char *className) [static]
  • empty(void) const [inline]
  • endsWith(char c) const [inline]
  • fAllEntries [protected, static]
  • Find(const char *uniqueName) [static]
  • flush(void) [protected]
  • fTimeStamp [protected]
  • GetData(void) const [inline, virtual]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • IsKindOf(const URuntimeClass *pClass) const
  • length(void) const [inline]
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • operator char *() [inline]
  • operator const char *() const [inline]
  • operator!=(const UStr &str) const
  • operator!=(const char *str) const
  • operator<(const UStr &str) const
  • operator<<(const char *addToStr)
  • operator<<(char addToStr)
  • operator<<(int addToStr)
  • operator=(const char *newstr) [inline]
  • operator=(const unsigned char *newstr) [inline]
  • UStr::operator=(const UStr &newstr)
  • operator==(const UStr &str) const
  • operator==(const char *str) const
  • operator>(const UStr &str) const
  • PCStr(const char *uniqueName, const char *defValue=0L, kClassPersistent pclass=kNoClass) [inline]
  • replace(char which, char bywhich)
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • set(const char *buf, unsigned int len)
  • SetData(const void *ptr, unsigned int size) [inline, virtual]
  • SizeOf(void) const [inline, virtual]
  • str [protected]
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • UStr() [inline]
  • UStr(const char *newstr) [inline]
  • UStr(const unsigned char *newstr) [inline]
  • UStr(const UStr &newstr) [inline]
  • ~CPersistent() [virtual]
  • ~PCStr() [inline, virtual]
  • ~UObject() [inline, virtual]
  • ~UStr() [inline, virtual]
Generated on Sun Oct 21 12:48:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CStaticAllocT Member List

This is the complete list of members for CStaticAllocT, including all inherited members.
  • AdjustSize(size_t size) [inline]
  • buf [protected]
  • CStaticAllocT() [inline]
  • numbuf [protected]
  • operator const T *(void) const [inline]
  • operator T *(void) const [inline]
  • size() const [inline]
  • ~CStaticAllocT() [inline]
Generated on Sun Oct 21 12:49:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

mircAttrCvt Member List

This is the complete list of members for mircAttrCvt, including all inherited members.
  • extractcolor(std::string *in, int start, short *fg, short *bg) [private]
  • mirc2ctcp(std::string *in)
  • mirc2ctcpmap [private, static]
  • tokens [private, static]
Generated on Sun Oct 21 12:48:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

irciiAttrCvt Member List

This is the complete list of members for irciiAttrCvt, including all inherited members.
  • ircii2ctcp(std::string *in)
  • tokens [private, static]
Generated on Sun Oct 21 12:48:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ansiAttrCvt Member List

This is the complete list of members for ansiAttrCvt, including all inherited members.
  • _in [private]
  • _seq [private]
  • ansi2ctcp(std::string *in)
  • bgColorMap [private, static]
  • blink [private]
  • bold [private]
  • do_C() [private]
  • do_m() [private]
  • escSeq [private, static]
  • fgColorMap [private, static]
  • italic [private]
  • pos [private]
  • reverse [private]
  • underline [private]
Generated on Sun Oct 21 12:45:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ansiAttrCvt::AnsiSeq Member List

This is the complete list of members for ansiAttrCvt::AnsiSeq, including all inherited members.
  • _notOf [private, static]
  • _params [private]
  • _seq [private]
  • _verb [private]
  • AnsiSeq(std::string *in, int pos)
  • param(int index) [inline]
  • paramc() [inline]
  • seq() [inline]
  • verb() [inline]
  • ~AnsiSeq()
Generated on Sun Oct 21 12:45:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CTCP2Parse Member List

This is the complete list of members for CTCP2Parse, including all inherited members.
  • ansi2ctcp(std::string *in) [private]
  • bg [private]
  • bgDef [private]
  • bgLast [private]
  • Black enum value [protected]
  • blinkCnt [private]
  • blinkLast [private]
  • Blue enum value [protected]
  • boldCnt [private]
  • boldLast [private]
  • CharSpacingType enum name [protected]
  • ColorType enum name [protected]
  • cp [private]
  • cpDef [private]
  • cpLast [private]
  • CTCP2Parse() [protected]
  • Cyan enum value [protected]
  • decodeColor(std::string *line, int *parseFrmChar, int *parseEndChar, RGBColor *c) [inline, private]
  • decodeToggle(std::string *line, int *parseFrmChar, int *parseEndChar, int *varCnt) [inline, private]
  • enc [private]
  • encDef [private]
  • encLast [private]
  • EncodingType enum name [protected]
  • fg [private]
  • fgDef [private]
  • fgLast [private]
  • Fixed enum value [protected]
  • fntLast [private]
  • fntSize [private]
  • fromHex(unsigned char h, unsigned char *val) [inline, private]
  • Green enum value [protected]
  • Grey enum value [protected]
  • indexColor [private, static]
  • ircii2ctcp(std::string *in) [private]
  • iso8859_1 enum value [protected]
  • iso8859_2 enum value [protected]
  • iso8859_3 enum value [protected]
  • iso8859_4 enum value [protected]
  • iso8859_5 enum value [protected]
  • iso8859_6 enum value [protected]
  • iso8859_7 enum value [protected]
  • iso8859_8 enum value [protected]
  • iso8859_9 enum value [protected]
  • italicCnt [private]
  • italicLast [private]
  • Lt_Blue enum value [protected]
  • Lt_Cyan enum value [protected]
  • Lt_Green enum value [protected]
  • Lt_Grey enum value [protected]
  • Lt_Magenta enum value [protected]
  • Lt_Red enum value [protected]
  • Lt_Yellow enum value [protected]
  • Magenta enum value [protected]
  • mirc2ctcp(std::string *in) [protected]
  • overCnt [private]
  • overLast [private]
  • ParseIt(std::string *line) [protected]
  • Proportional enum value [protected]
  • PushBackgroundColor(unsigned char R, unsigned char G, unsigned char B)=0 [protected, pure virtual]
  • PushBlink(bool)=0 [protected, pure virtual]
  • PushBold(bool)=0 [protected, pure virtual]
  • PushEncoding(EncodingType)=0 [protected, pure virtual]
  • PushFontSize(int)=0 [protected, pure virtual]
  • PushForegroundColor(unsigned char R, unsigned char G, unsigned char B)=0 [protected, pure virtual]
  • PushItalic(bool)=0 [protected, pure virtual]
  • PushOut(void) [inline, private]
  • PushOverstrike(bool)=0 [protected, pure virtual]
  • PushReverse(bool)=0 [protected, pure virtual]
  • PushSpacing(CharSpacingType)=0 [protected, pure virtual]
  • PushStart()=0 [protected, pure virtual]
  • PushTextSegment(std::string *)=0 [protected, pure virtual]
  • PushUnderline(bool)=0 [protected, pure virtual]
  • PushURL(bool)=0 [protected, pure virtual]
  • Red enum value [protected]
  • revCnt [private]
  • revLast [private]
  • segment [private]
  • SetDefaults(unsigned char fgR=(unsigned char)((Lt_Grey &0xFF0000) >> 16), unsigned char fgG=(unsigned char)((Lt_Grey &0x00FF00) >> 8), unsigned char fgB=(unsigned char)(Lt_Grey &0x0000FF), unsigned char bgR=(unsigned char)((Black &0xFF0000) >> 16), unsigned char bgG=(unsigned char)((Black &0x00FF00) >> 8), unsigned char bgB=(unsigned char)(Black &0x0000FF), CharSpacingType cpDef_=Fixed, EncodingType encDef_=iso8859_1) [protected]
  • underCnt [private]
  • underLast [private]
  • urlCnt [private]
  • urlLast [private]
  • UTF_8 enum value [protected]
  • White enum value [protected]
  • Yellow enum value [protected]
Generated on Sun Oct 21 12:50:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CTCP2Parse::RGBColor Member List

This is the complete list of members for CTCP2Parse::RGBColor, including all inherited members.
  • B
  • G
  • nul_void_ignore
  • R
  • RGB
Generated on Sun Oct 21 12:50:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CvsArgs Member List

This is the complete list of members for CvsArgs, including all inherited members.
  • add(const char *arg) [virtual]
  • addfile(const char *arg, const char *dir=0L, const FSSpec *spec=0L) [virtual]
  • argc [protected]
  • Argc(void) const [inline]
  • Argv(void) const [inline]
  • argv [protected]
  • CvsArgs(bool defargs=true)
  • CvsArgs(char *const *fromargv, int fromargc)
  • print(const char *indirectory=0L)
  • reset(bool defargs=true)
  • ~CvsArgs() [virtual]
Generated on Sun Oct 21 12:50:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

AddCvsArgs Member List

This is the complete list of members for AddCvsArgs, including all inherited members.
  • add(const char *arg) [virtual]
  • AddCvsArgs() [inline]
  • addfile(const char *arg, const char *dir=0L, const FSSpec *spec=0L) [virtual]
  • Argc(void) const [inline]
  • argc [protected]
  • Argv(void) const [inline]
  • argv [protected]
  • CvsArgs(bool defargs=true)
  • CvsArgs(char *const *fromargv, int fromargc)
  • gotProblem [protected]
  • HasProblem(void) [inline]
  • print(const char *indirectory=0L)
  • reset(bool defargs=true)
  • ~CvsArgs() [virtual]
Generated on Sun Oct 21 12:45:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

AddBinCvsArgs Member List

This is the complete list of members for AddBinCvsArgs, including all inherited members.
  • add(const char *arg) [virtual]
  • AddBinCvsArgs() [inline]
  • addfile(const char *arg, const char *dir=0L, const FSSpec *spec=0L) [virtual]
  • Argc(void) const [inline]
  • argc [protected]
  • Argv(void) const [inline]
  • argv [protected]
  • CvsArgs(bool defargs=true)
  • CvsArgs(char *const *fromargv, int fromargc)
  • gotProblem [protected]
  • HasProblem(void) [inline]
  • print(const char *indirectory=0L)
  • reset(bool defargs=true)
  • ~CvsArgs() [virtual]
Generated on Sun Oct 21 12:45:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

RemoveCvsArgs Member List

This is the complete list of members for RemoveCvsArgs, including all inherited members.
  • add(const char *arg) [virtual]
  • addfile(const char *arg, const char *dir=0L, const FSSpec *spec=0L) [virtual]
  • argc [protected]
  • Argc(void) const [inline]
  • Argv(void) const [inline]
  • argv [protected]
  • CvsArgs(bool defargs=true)
  • CvsArgs(char *const *fromargv, int fromargc)
  • print(const char *indirectory=0L)
  • reset(bool defargs=true)
  • ~CvsArgs() [virtual]
Generated on Sun Oct 21 12:49:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

EntnodePath Member List

This is the complete list of members for EntnodePath, including all inherited members.
  • EntnodePath(const char *path)
  • fullpathname [protected]
  • GetFullPathName(UStr &resPath, const char *name) const
  • ref [protected]
  • Ref(void) [inline]
  • UnRef(void) [inline]
  • ~EntnodePath() [protected]
Generated on Sun Oct 21 12:47:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

EntnodeData Member List

This is the complete list of members for EntnodeData, including all inherited members.
  • Compare(const EntnodeData &node1, const EntnodeData &node2) [inline, static]
  • desc [private]
  • EntnodeData(const char *name, EntnodePath *path) [protected]
  • fullpathname [private]
  • GetConflict() const [inline, virtual]
  • GetDesc(void) const [inline]
  • GetFullPathName(UStr &resPath) const [inline]
  • GetName(void) const [inline]
  • GetType(void) const=0 [pure virtual]
  • ignored [protected]
  • IsIgnored(void) const [inline]
  • IsLocked(void) const [inline]
  • IsMissing(void) const [inline]
  • IsRemoved(void) const [inline]
  • IsUnknown(void) const [inline]
  • IsUnmodified(void) const [inline]
  • IsVisited(void) const [inline]
  • kName enum value
  • kPath enum value
  • kStatus enum value
  • locked [protected]
  • missing [protected]
  • operator[](int index) const [inline, virtual]
  • Ref(void) [inline]
  • ref [protected]
  • removed [protected]
  • sbuffer [private, static]
  • SetDesc(const char *newdesc)
  • SetIgnored(bool state) [inline]
  • SetLocked(bool state) [inline]
  • SetMissing(bool state) [inline]
  • SetRemoved(bool state) [inline]
  • SetUnknown(bool state) [inline]
  • SetUnmodified(bool state) [inline]
  • SetVisited(bool state) [inline]
  • unknown [protected]
  • unmodified [protected]
  • UnRef(void) [inline]
  • user [private]
  • visited [protected]
  • ~EntnodeData() [protected, virtual]
Generated on Sun Oct 21 12:47:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

EntnodeFile Member List

This is the complete list of members for EntnodeFile, including all inherited members.
  • Compare(const EntnodeData &node1, const EntnodeData &node2) [inline, static]
  • date [protected]
  • EntnodeData(const char *name, EntnodePath *path) [protected]
  • EntnodeFile(const char *name, EntnodePath *path, const char *newvn=0L, const char *newts=0L, const char *newoptions=0L, const char *newtag=0L, const char *newdate=0L, const char *newts_conflict=0L)
  • GetConflict() const [inline, virtual]
  • GetDesc(void) const [inline]
  • GetFullPathName(UStr &resPath) const [inline]
  • GetName(void) const [inline]
  • GetType(void) const [inline, virtual]
  • ignored [protected]
  • IsIgnored(void) const [inline]
  • IsLocked(void) const [inline]
  • IsMissing(void) const [inline]
  • IsRemoved(void) const [inline]
  • IsUnknown(void) const [inline]
  • IsUnmodified(void) const [inline]
  • IsVisited(void) const [inline]
  • kConflict enum value
  • kName enum value
  • kOption enum value
  • kPath enum value
  • kStatus enum value
  • kTag enum value
  • kTS enum value
  • kVN enum value
  • locked [protected]
  • missing [protected]
  • operator[](int index) const [inline, virtual]
  • option [protected]
  • ref [protected]
  • Ref(void) [inline]
  • removed [protected]
  • SetDesc(const char *newdesc)
  • SetIgnored(bool state) [inline]
  • SetLocked(bool state) [inline]
  • SetMissing(bool state) [inline]
  • SetRemoved(bool state) [inline]
  • SetUnknown(bool state) [inline]
  • SetUnmodified(bool state) [inline]
  • SetVisited(bool state) [inline]
  • tag [protected]
  • ts [protected]
  • ts_conflict [protected]
  • unknown [protected]
  • unmodified [protected]
  • UnRef(void) [inline]
  • visited [protected]
  • vn [protected]
  • ~EntnodeData() [protected, virtual]
  • ~EntnodeFile() [protected, virtual]
Generated on Sun Oct 21 12:47:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

EntnodeFolder Member List

This is the complete list of members for EntnodeFolder, including all inherited members.
  • Compare(const EntnodeData &node1, const EntnodeData &node2) [inline, static]
  • EntnodeData(const char *name, EntnodePath *path) [protected]
  • EntnodeFolder(const char *name, EntnodePath *path, const char *newvn=0L, const char *newts=0L, const char *newoptions=0L, const char *newtag=0L, const char *newdate=0L, const char *newts_conflict=0L)
  • GetConflict() const [inline, virtual]
  • GetDesc(void) const [inline]
  • GetFullPathName(UStr &resPath) const [inline]
  • GetName(void) const [inline]
  • GetType(void) const [inline, virtual]
  • ignored [protected]
  • IsIgnored(void) const [inline]
  • IsLocked(void) const [inline]
  • IsMissing(void) const [inline]
  • IsRemoved(void) const [inline]
  • IsUnknown(void) const [inline]
  • IsUnmodified(void) const [inline]
  • IsVisited(void) const [inline]
  • kName enum value
  • kPath enum value
  • kStatus enum value
  • locked [protected]
  • missing [protected]
  • operator[](int index) const [inline, virtual]
  • Ref(void) [inline]
  • ref [protected]
  • removed [protected]
  • SetDesc(const char *newdesc)
  • SetIgnored(bool state) [inline]
  • SetLocked(bool state) [inline]
  • SetMissing(bool state) [inline]
  • SetRemoved(bool state) [inline]
  • SetUnknown(bool state) [inline]
  • SetUnmodified(bool state) [inline]
  • SetVisited(bool state) [inline]
  • unknown [protected]
  • unmodified [protected]
  • UnRef(void) [inline]
  • visited [protected]
  • ~EntnodeData() [protected, virtual]
  • ~EntnodeFolder() [protected, virtual]
Generated on Sun Oct 21 12:47:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ENTNODE Member List

This is the complete list of members for ENTNODE, including all inherited members.
  • Compare(const ENTNODE &node1, const ENTNODE &node2) [inline, static]
  • Data() const [inline]
  • ENTNODE() [inline]
  • ENTNODE(EntnodeData *data) [inline]
  • ENTNODE(EntnodeData &data) [inline]
  • ENTNODE(const ENTNODE &anode) [inline]
  • operator EntnodeData *() const [inline]
  • operator=(const ENTNODE &anode) [inline]
  • shareData [protected]
  • ~ENTNODE() [inline]
Generated on Sun Oct 21 12:47:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CDestroyThreadLock Member List

This is the complete list of members for CDestroyThreadLock, including all inherited members.
  • CDestroyThreadLock() [inline]
  • ~CDestroyThreadLock() [inline]
Generated on Sun Oct 21 12:47:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CStackThreadLock Member List

This is the complete list of members for CStackThreadLock, including all inherited members.
  • CStackThreadLock() [inline]
  • ~CStackThreadLock() [inline]
Generated on Sun Oct 21 12:49:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CvsProcessCallbacks Member List

This is the complete list of members for CvsProcessCallbacks, including all inherited members.
  • consoleerr
  • consoleout
  • exit
  • getenv
Generated on Sun Oct 21 12:50:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_CvsProcess Member List

This is the complete list of members for _CvsProcess, including all inherited members.
  • argc
  • args
  • callbacks
  • destroy
  • his_read
  • his_write
  • my_read
  • my_write
  • open
  • pid
  • pstderr
  • pstdin
  • pstdout
  • write_buffer
  • write_buffer_index
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

GPT_QUIT Member List

This is the complete list of members for GPT_QUIT, including all inherited members.
  • code
Generated on Sun Oct 21 12:47:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

GPT_GETENV Member List

This is the complete list of members for GPT_GETENV, including all inherited members.
  • empty
  • str
Generated on Sun Oct 21 12:47:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

GPT_CONSOLE Member List

This is the complete list of members for GPT_CONSOLE, including all inherited members.
  • isStderr
  • len
  • str
Generated on Sun Oct 21 12:47:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_WireHandler Member List

This is the complete list of members for _WireHandler, including all inherited members.
  • destroy_func
  • read_func
  • type
  • write_func
Generated on Sun Oct 21 12:45:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CAllHandlers Member List

This is the complete list of members for CAllHandlers, including all inherited members.
  • CAllHandlers() [inline]
  • wire_ht
  • ~CAllHandlers() [inline]
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_WireMessage Member List

This is the complete list of members for _WireMessage, including all inherited members.
  • data
  • type
Generated on Sun Oct 21 12:45:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CvsPrefs Member List

This is the complete list of members for CvsPrefs, including all inherited members.
  • AddControl(void) const
  • AlwaysUseCvsroot(void) const
  • Browser(void) const
  • CheckoutRO(void) const
  • CvsConsole(void) const
  • CvsPrefs() [inline]
  • CvsVersion(void) const
  • DirtySupport(void) const
  • empty(void) const
  • ExtDiff(void) const
  • fCvsRunningCounter [protected]
  • fHasLoggedIn [protected]
  • flush_list(void) [protected]
  • fTclFileRunningCounter [protected]
  • get_cvsroot_list(int entry) const [inline]
  • get_cvsroot_list(int entry) [protected]
  • GetUseShell(void) const
  • has_cvsroot_in_list(const char *cvsroot, int &entry) [protected]
  • HasLoogedIn(void) const [inline]
  • Helper(void) const
  • HideCommandDlgAnnotate(void) const
  • HideCommandDlgDiff(void) const
  • HideCommandDlgGraph(void) const
  • HideCommandDlgLog(void) const
  • HideCommandDlgUpdate(void) const
  • HideCommandDlgUseShift(void) const
  • Home(void) const
  • ICTextOption(void) const
  • insert_cvsroot_in_list(const char *cvsroot) [protected]
  • IsCvsRunning(void) const
  • IsoConvert(void) const
  • IsTclFileRunning(void) const
  • KserverPort(void) const
  • LastWorkingDir(void) const
  • length(void) const
  • load(void)
  • LogoutTimeOut(void) const
  • MacBinEncoding(void) const
  • operator const char *() const
  • operator const unsigned char *() const
  • operator=(const char *newstr)
  • operator=(const unsigned char *newstr)
  • ProxyHost(void) const
  • ProxyPort(void) const
  • PruneOption(void) const
  • PserverPort(void) const
  • QuietOption(void) const
  • RhostPort(void) const
  • RshName(void) const
  • save(void)
  • ServerName(void) const
  • SetAddControl(bool newState)
  • SetAlwaysUseCvsroot(bool newState)
  • SetBrowser(const char *newbrowser)
  • SetCheckoutRO(bool newState)
  • SetCvsConsole(bool console)
  • SetCvsRunning(bool launched)
  • SetCvsVersion(int version)
  • SetDirtySupport(bool newState)
  • SetExtDiff(const char *newdiff)
  • SetHasLoogedIn(bool newstate) [inline]
  • SetHelper(const char *newhelper)
  • SetHideCommandDlgAnnotate(bool newState)
  • SetHideCommandDlgDiff(bool newState)
  • SetHideCommandDlgGraph(bool newState)
  • SetHideCommandDlgLog(bool newState)
  • SetHideCommandDlgUpdate(bool newState)
  • SetHideCommandDlgUseShift(bool newState)
  • SetHome(const char *newhome)
  • SetICTextOption(bool newState)
  • SetIsoConvert(ISO8559 newState)
  • SetKserverPort(int newState)
  • SetLastWorkingDir(const char *workdir)
  • SetLogoutTimeOut(int newTimeout)
  • SetMacBinEncoding(MACENCODING newState)
  • SetProxyHost(const char *newhost)
  • SetProxyPort(int newport)
  • SetPruneOption(bool newState)
  • SetPserverPort(int newState)
  • SetQuietOption(bool newState)
  • SetRhostPort(int newState)
  • SetRshName(const char *newrshname)
  • SetServerName(const char *newservername)
  • SetTclFileRunning(bool launched)
  • SetUnixLF(bool useit)
  • SetUseProxy(bool useit)
  • SetUseShell(SHELL_KIND shell)
  • SetUseViewerAlways(bool newState)
  • SetViewer(const char *newviewer)
  • SetWhichCvs(const char *cvsPath)
  • SetWordWrapLogMsg(int wordwrap)
  • SetZ9Option(bool newState)
  • SetZLevel(int level)
  • UnixLF(void) const
  • UseKeyChain(void) const
  • UseProxy(void) const
  • UseViewerAlways(void) const
  • Viewer(void) const
  • WhichCvs(UStr &path, bool userOnly=false) const
  • WordWrapLogMsg(void) const
  • Z9Option(void) const
  • ZLevel(void) const
  • ~CvsPrefs() [inline]
Generated on Sun Oct 21 12:50:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_frameRec Member List

This is the complete list of members for _frameRec, including all inherited members.
  • entry
  • next
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

DYN_LIST Member List

This is the complete list of members for DYN_LIST, including all inherited members.
  • current
  • defaultnumcells
  • first
  • next
  • numentries
  • sizeofcell
  • totpage
Generated on Sun Oct 21 12:47:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

poolRec Member List

This is the complete list of members for poolRec, including all inherited members.
  • firstentry
  • firstfree
  • pool
Generated on Sun Oct 21 12:49:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

garbyRec Member List

This is the complete list of members for garbyRec, including all inherited members.
  • pools
Generated on Sun Oct 21 12:47:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TraversalReport Member List

This is the complete list of members for TraversalReport, including all inherited members.
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • gRunning [static]
  • OnAlias(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnAnyDevice(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnFile(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
Generated on Sun Oct 21 12:50:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

option Member List

This is the complete list of members for option, including all inherited members.
  • flag
  • flag
  • has_arg
  • name
  • name
  • val
Generated on Sun Oct 21 12:48:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ImportReport Member List

This is the complete list of members for ImportReport, including all inherited members.
  • conflicts
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • gRunning [static]
  • ImportReport(const char *path, ReportWarning *&w, ReportConflict *&c) [inline]
  • m_Ignlist
  • OnAlias(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnAnyDevice(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnFile(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
  • warnings
  • ~ImportReport() [inline, virtual]
Generated on Sun Oct 21 12:47:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ReportConflict Member List

This is the complete list of members for ReportConflict, including all inherited members.
  • AddPattern(const char *newpat, bool isBinary, bool isExtension, const char *sample)
  • DisableUserSettings(void) [inline]
  • fcreator [protected]
  • ForceBinary(void) [inline]
  • forceBinary enum value
  • forceNoKeywords enum value
  • ForceNoKeywords(void) [inline]
  • ForceText(void) [inline]
  • forceText enum value
  • ftype [protected]
  • GetMacCreator(void) const [inline]
  • GetMacType(void) const [inline]
  • GetPattern(void) const [inline]
  • hasConflict enum value
  • HasConflict(void) const [inline]
  • hasExtension enum value
  • HasForceBinary(void) const [inline]
  • HasForceNoKeywords(void) const [inline]
  • HasForceText(void) const [inline]
  • HasIgnore(void) const [inline]
  • hasIgnore enum value
  • HasTypeCreatorConflict(void) const [inline]
  • hasTypeCreatorConflict enum value
  • Ignore(void) [inline]
  • isBinary enum value
  • IsBinary(void) const [inline]
  • IsExtension(void) const [inline]
  • Match(const char *pat)
  • next
  • noConflict enum value
  • pattern [protected]
  • PrintOut(UStr &out) const
  • ReportConflict(int mac_type, int mac_creator)
  • sample1 [protected]
  • sample2 [protected]
  • SetConflict(const char *sample)
  • SetTypeCreatorConflict(const char *sample)
  • status [protected]
  • userFlags enum value
  • ~ReportConflict()
Generated on Sun Oct 21 12:49:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ReportWarning Member List

This is the complete list of members for ReportWarning, including all inherited members.
  • AddWarning(const char *sample)
  • Kind(void) const [inline]
  • kind [protected]
  • maxWarnings [static]
  • next
  • PrintOut(UStr &out) const
  • ReportWarning(kTextBinTYPE akind)
  • samples [protected]
  • tooMuchWarnings [protected]
  • ~ReportWarning()
Generated on Sun Oct 21 12:49:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CMacBinTable Member List

This is the complete list of members for CMacBinTable, including all inherited members.
  • class_ID enum value
  • CMacBinTable(LStream *inStream)
  • CMacBinTable() [private]
  • CMacBinTable(const CMacBinTable &inOriginal) [private]
  • FinishCreateSelf() [protected, virtual]
  • gCurMacBinMap [protected, static]
  • GetCurrentMap(void) [inline, static]
  • operator=(const CMacBinTable &inOriginal) [private]
  • SetCurrentMap(MacBinMaps *map) [inline, static]
  • ~CMacBinTable() [virtual]
Generated on Sun Oct 21 12:48:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CMacBinItem Member List

This is the complete list of members for CMacBinItem, including all inherited members.
  • CMacBinItem(const MACBINMAP &map)
  • CMacBinItem() [private]
  • CMacBinItem(const CMacBinItem &inOriginal) [private]
  • DoubleClick(const STableCell &inCell, const SMouseDownEvent &inMouseDown, const SOutlineDrawContents &inDrawContents, Boolean inHitText) [protected, virtual]
  • DrawRowAdornments(const Rect &inLocalRowRect) [protected, virtual]
  • EditCell(void) [virtual]
  • fMap [protected]
  • GetDrawContentsSelf(const STableCell &inCell, SOutlineDrawContents &ioDrawContents) [protected, virtual]
  • operator=(const CMacBinItem &inOriginal) [private]
  • RemoveCell(void) [virtual]
  • ~CMacBinItem() [virtual]
Generated on Sun Oct 21 12:48:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PMacBinMaps Member List

This is the complete list of members for PMacBinMaps, including all inherited members.
  • _GetBaseClass() [static]
  • AddEntry(OSType sig, const char *desc, MACENCODING encod, bool plainBin, bool useDefault)
  • classUObject [protected, static]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CreateObject(const char *className) [static]
  • entries [protected]
  • Entries(void) const [inline]
  • fAllEntries [protected, static]
  • Find(const char *uniqueName) [static]
  • fTimeStamp [protected]
  • GetData(void) const [inline, virtual]
  • GetEnvPlainTypes(void) [static]
  • GetEnvTypes(MACENCODING type) [static]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • IsKindOf(const URuntimeClass *pClass) const
  • LoadAll(void) [static]
  • LoadDefaults(void)
  • MacBinMaps()
  • NeedSave(bool onlySettings=false) [static]
  • operator=(const MacBinMaps &otherMap)
  • PMacBinMaps(const char *uniqueName) [inline]
  • RemoveEntry(OSType sig)
  • Reset(void) [protected]
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SaveDefaults(void)
  • SetData(const void *ptr, unsigned int size) [inline, virtual]
  • SizeOf(void) const [inline, virtual]
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • ~CPersistent() [virtual]
  • ~MacBinMaps()
  • ~PMacBinMaps() [inline, virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:49:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

MACBINMAP Member List

This is the complete list of members for MACBINMAP, including all inherited members.
  • desc
  • encod
  • plainBin
  • sig
  • useDefault
Generated on Sun Oct 21 12:48:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

MACBINMAPENTRIES Member List

This is the complete list of members for MACBINMAPENTRIES, including all inherited members.
  • maps
  • numMaps
Generated on Sun Oct 21 12:48:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

MacBinMaps Member List

This is the complete list of members for MacBinMaps, including all inherited members.
  • AddEntry(OSType sig, const char *desc, MACENCODING encod, bool plainBin, bool useDefault)
  • Entries(void) const [inline]
  • entries [protected]
  • GetEnvPlainTypes(void) [static]
  • GetEnvTypes(MACENCODING type) [static]
  • LoadDefaults(void)
  • MacBinMaps()
  • operator=(const MacBinMaps &otherMap)
  • RemoveEntry(OSType sig)
  • Reset(void) [protected]
  • SaveDefaults(void)
  • ~MacBinMaps()
Generated on Sun Oct 21 12:48:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

MacroTraversal Member List

This is the complete list of members for MacroTraversal, including all inherited members.
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • gRunning [static]
  • OnAlias(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnAnyDevice(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnFile(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
Generated on Sun Oct 21 12:48:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CMacroEntry Member List

This is the complete list of members for CMacroEntry, including all inherited members.
  • CMacroEntry() [inline]
  • CMacroEntry(const char *fullname, const char *dispname) [inline]
  • CMacroEntry(const CMacroEntry &anentry) [inline]
  • name
  • operator<(const CMacroEntry &anentry) const [inline]
  • operator=(const CMacroEntry &anentry) [inline]
  • operator==(const CMacroEntry &anentry) const [inline]
  • path
Generated on Sun Oct 21 12:48:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CMacroSet Member List

This is the complete list of members for CMacroSet, including all inherited members.
  • Add(const char *fullname, const char *name) [inline]
  • CMacroSet() [inline]
  • entries
  • Flush(void) [inline]
  • invalFlag
Generated on Sun Oct 21 12:48:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

FileEntry Member List

This is the complete list of members for FileEntry, including all inherited members.
  • file
  • FileEntry() [inline]
  • FileEntry(const char *filename, const FSSpec *macspec=0L) [inline]
  • FileEntry(const FileEntry &entry) [inline]
  • operator=(const FileEntry &entry) [inline]
  • spec
Generated on Sun Oct 21 12:47:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

MultiFilesEntry Member List

This is the complete list of members for MultiFilesEntry, including all inherited members.
  • add(const char *file, const FSSpec *spec=0L)
  • dir
  • files
  • MultiFilesEntry() [inline]
  • MultiFilesEntry(const char *path) [inline]
  • MultiFilesEntry(const MultiFilesEntry &entries) [inline]
  • operator=(const MultiFilesEntry &entries) [inline]
  • setdir(const char *newdir)
Generated on Sun Oct 21 12:48:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

MultiFiles Member List

This is the complete list of members for MultiFiles, including all inherited members.
  • add(CvsArgs &args)
  • dirs [protected]
  • get(int index, UStr &path, UStr &fileName)
  • MultiFiles() [inline]
  • newdir(const char *dir)
  • newfile(const char *file, const FSSpec *spec=0L)
  • next(void)
  • NumFiles(void) const
  • pos [protected]
  • reset()
  • rewind(void) [inline]
Generated on Sun Oct 21 12:48:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TMPersistent Member List

This is the complete list of members for TMPersistent, including all inherited members.
  • _GetBaseClass() [static]
  • classUObject [protected, static]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CreateObject(const char *className) [static]
  • fAllEntries [protected, static]
  • fAllItems [protected]
  • fBuf [protected]
  • Find(const char *uniqueName) [static]
  • fTimeStamp [protected]
  • GetData(void) const [inline, virtual]
  • GetList(void) const [inline]
  • GetList(void) [inline]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • IsKindOf(const URuntimeClass *pClass) const
  • list_t typedef
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SetData(const void *ptr, unsigned int size) [inline, virtual]
  • SizeOf(void) const [inline, virtual]
  • TMPersistent(const char *uniqueName, kClassPersistent pclass=kNoClass) [inline]
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • ~CPersistent() [virtual]
  • ~TMPersistent() [inline, virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:50:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TMString Member List

This is the complete list of members for TMString, including all inherited members.
  • _GetBaseClass() [static]
  • begin() const [inline]
  • classUObject [protected, static]
  • Compare(const char *s1, const char *s2) const [inline, protected, virtual]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CreateObject(const char *className) [static]
  • end() const [inline]
  • fAllEntries [protected, static]
  • fAllStrs [protected]
  • fBuf [protected]
  • Find(const char *instr) const
  • CPersistent::Find(const char *uniqueName) [static]
  • fMaxStr [protected]
  • fTimeStamp [protected]
  • GetData(void) const [virtual]
  • GetList(void) const [inline]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • Insert(const char *newstr)
  • IsKindOf(const URuntimeClass *pClass) const
  • list_t typedef
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • Remove(const char *newstr)
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SetData(const void *ptr, unsigned int size) [virtual]
  • SizeOf(void) const [virtual]
  • TMString(unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass)
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • ~CPersistent() [virtual]
  • ~TMString() [virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:50:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CMString Member List

This is the complete list of members for CMString, including all inherited members.
  • _GetBaseClass() [static]
  • begin() const [inline]
  • classUObject [protected, static]
  • CMString(unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass) [inline]
  • Compare(const char *s1, const char *s2) const [inline, protected, virtual]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CreateObject(const char *className) [static]
  • end() const [inline]
  • fAllEntries [protected, static]
  • fAllStrs [protected]
  • fBuf [protected]
  • Find(const char *instr) const
  • fMaxStr [protected]
  • fTimeStamp [protected]
  • GetData(void) const [virtual]
  • CPersistent::GetData(void) const=0L [pure virtual]
  • GetList(void) const [inline]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • Insert(const char *newstr)
  • IsKindOf(const URuntimeClass *pClass) const
  • list_t typedef
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • Remove(const char *newstr)
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SetData(const void *ptr, unsigned int size) [virtual]
  • SizeOf(void) const [virtual]
  • CPersistent::SizeOf(void) const=0L [pure virtual]
  • TMString(unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass)
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • ~CMString() [inline, virtual]
  • ~CPersistent() [virtual]
  • ~TMString() [virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:48:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CMPString Member List

This is the complete list of members for CMPString, including all inherited members.
  • _GetBaseClass() [static]
  • begin() const [inline]
  • classUObject [protected, static]
  • CMPString(unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass) [inline]
  • Compare(const char *s1, const char *s2) const [inline, protected, virtual]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CreateObject(const char *className) [static]
  • end() const [inline]
  • fAllEntries [protected, static]
  • fAllStrs [protected]
  • fBuf [protected]
  • Find(const char *instr) const
  • fMaxStr [protected]
  • fTimeStamp [protected]
  • GetData(void) const [virtual]
  • CPersistent::GetData(void) const=0L [pure virtual]
  • GetList(void) const [inline]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • Insert(const char *newstr)
  • IsKindOf(const URuntimeClass *pClass) const
  • list_t typedef
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • Remove(const char *newstr)
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SetData(const void *ptr, unsigned int size) [virtual]
  • SizeOf(void) const [virtual]
  • CPersistent::SizeOf(void) const=0L [pure virtual]
  • TMString(unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass)
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • ~CMPString() [inline, virtual]
  • ~CPersistent() [virtual]
  • ~TMString() [virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:48:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CKeyString Member List

This is the complete list of members for CKeyString, including all inherited members.
  • _GetBaseClass() [static]
  • begin() const [inline]
  • CKeyString(unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass) [inline]
  • classUObject [protected, static]
  • CMString(unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass) [inline]
  • Compare(const char *s1, const char *s2) const [protected, virtual]
  • CMString::Compare(const char *s1, const char *s2) const [inline, virtual]
  • Concatenate(UStr &res, const char *key, const char *value) [static]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CreateObject(const char *className) [static]
  • end() const [inline]
  • fAllEntries [protected, static]
  • fAllStrs [protected]
  • fBuf [protected]
  • Find(const char *instr) const
  • fMaxStr [protected]
  • fTimeStamp [protected]
  • GetData(void) const [virtual]
  • CPersistent::GetData(void) const=0L [pure virtual]
  • GetList(void) const [inline]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • Insert(const char *newstr)
  • IsKindOf(const URuntimeClass *pClass) const
  • list_t typedef
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • Remove(const char *newstr)
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SetData(const void *ptr, unsigned int size) [virtual]
  • SizeOf(void) const [virtual]
  • CPersistent::SizeOf(void) const=0L [pure virtual]
  • Split(const char *str, UStr &key, UStr &value) [static]
  • TMString(unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L, kClassPersistent pclass=kNoClass)
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • ~CKeyString() [inline, virtual]
  • ~CMString() [inline, virtual]
  • ~CPersistent() [virtual]
  • ~TMString() [virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:48:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

COptionalPropertySheet Member List

This is the complete list of members for COptionalPropertySheet, including all inherited members.
  • COptionalPropertySheet(bool bOptionChecked, UINT nIDCaption, CWnd *pParentWnd=NULL, UINT iSelectPage=0)
  • COptionalPropertySheet(bool bOptionChecked, LPCTSTR pszCaption, CWnd *pParentWnd=NULL, UINT iSelectPage=0)
  • DoModal() [virtual]
  • GetHideCommandDlg()
  • m_bOptionChecked [protected]
  • m_optionCheck [protected]
  • OnCommand(WPARAM wParam, LPARAM lParam) [protected, virtual]
  • OnInitDialog() [protected, virtual]
  • ~COptionalPropertySheet() [virtual]
Generated on Sun Oct 21 12:48:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

USaveSettings Member List

This is the complete list of members for USaveSettings, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool fill) [virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kCopyFrom enum value
  • kCopyList enum value
  • kCopyPath enum value
  • kSettingName enum value
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_copyFromPath
  • m_currentPage [protected]
  • m_list [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_oldname [protected]
  • m_path [protected]
  • m_settingName
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCopyFrom(void) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • USaveSettings(const char *path, const char *oldname)
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UObject() [inline, virtual]
  • ~USaveSettings() [virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:49:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CFindSettings Member List

This is the complete list of members for CFindSettings, including all inherited members.
  • CFindSettings(const char *findPath) [inline]
  • CFindSettings(std::map< UStr, UStr > &list) [inline]
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • gRunning [static]
  • m_foundIt
  • m_fullname
  • m_list
  • m_pathToFind
  • OnAlias(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnAnyDevice(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnFile(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
  • searchAllPath(const char *token, const char *value, void *data) [static]
  • searchPath(const char *token, const char *value, void *data) [static]
  • ~CFindSettings() [inline, virtual]
Generated on Sun Oct 21 12:47:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPersistent Member List

This is the complete list of members for CPersistent, including all inherited members.
  • _GetBaseClass() [static]
  • classUObject [protected, static]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CreateObject(const char *className) [static]
  • fAllEntries [protected, static]
  • Find(const char *uniqueName) [static]
  • fTimeStamp [protected]
  • GetData(void) const=0L [pure virtual]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • IsKindOf(const URuntimeClass *pClass) const
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • Register(CPersistent *value, const char *uniqueName, kClassPersistent pclass) [private, static]
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SetData(const void *ptr, unsigned int size)=0L [pure virtual]
  • SizeOf(void) const=0L [pure virtual]
  • TouchTimeStamp() [inline]
  • UnRegister(CPersistent *value) [private, static]
  • UObject() [inline, protected]
  • ~CPersistent() [virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:48:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPersistent::CPersistentEntry Member List

This is the complete list of members for CPersistent::CPersistentEntry, including all inherited members.
  • fClass
  • fUniqueName
  • fValue
Generated on Sun Oct 21 12:48:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPersistentT Member List

This is the complete list of members for CPersistentT, including all inherited members.
  • _GetBaseClass() [static]
  • classUObject [protected, static]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CPersistentT(const char *uniqueName, T defValue, kClassPersistent pclass) [inline]
  • CreateObject(const char *className) [static]
  • fAllEntries [protected, static]
  • fDefValue [protected]
  • Find(const char *uniqueName) [static]
  • fTimeStamp [protected]
  • fValue [protected]
  • GetData(void) const [inline, virtual]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • IsKindOf(const URuntimeClass *pClass) const
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • operator const T &() const [inline]
  • operator->() const [inline]
  • operator=(const T &val) [inline]
  • operator==(const T &val) const [inline]
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SetData(const void *ptr, unsigned int size) [inline, virtual]
  • SizeOf(void) const [inline, virtual]
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • ~CPersistent() [virtual]
  • ~CPersistentT() [inline, virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:48:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPersistentBool Member List

This is the complete list of members for CPersistentBool, including all inherited members.
  • _GetBaseClass() [static]
  • classUObject [protected, static]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CPersistentBool(const char *uniqueName, bool defValue, kClassPersistent pclass=kNoClass) [inline]
  • CPersistentT(const char *uniqueName, bool defValue, kClassPersistent pclass) [inline]
  • CreateObject(const char *className) [static]
  • fAllEntries [protected, static]
  • fDefValue [protected]
  • Find(const char *uniqueName) [static]
  • fTimeStamp [protected]
  • fValue [protected]
  • GetData(void) const [inline, virtual]
  • CPersistent::GetData(void) const=0L [pure virtual]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • IsKindOf(const URuntimeClass *pClass) const
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • operator const bool &() const [inline]
  • operator const T &() const [inline]
  • operator->() const [inline]
  • CPersistentT< bool >::operator->() const [inline]
  • operator=(const bool &val) [inline]
  • CPersistentT< bool >::operator=(const bool &val) [inline]
  • operator==(const bool &val) const [inline]
  • CPersistentT< bool >::operator==(const bool &val) const [inline]
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SetData(const void *ptr, unsigned int size) [inline, virtual]
  • SizeOf(void) const [inline, virtual]
  • CPersistent::SizeOf(void) const=0L [pure virtual]
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • ~CPersistent() [virtual]
  • ~CPersistentBool() [inline, virtual]
  • ~CPersistentT() [inline, virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:48:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPersistentInt Member List

This is the complete list of members for CPersistentInt, including all inherited members.
  • _GetBaseClass() [static]
  • classUObject [protected, static]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CPersistentInt(const char *uniqueName, int defValue, kClassPersistent pclass=kNoClass) [inline]
  • CPersistentT(const char *uniqueName, int defValue, kClassPersistent pclass) [inline]
  • CreateObject(const char *className) [static]
  • fAllEntries [protected, static]
  • fDefValue [protected]
  • Find(const char *uniqueName) [static]
  • fTimeStamp [protected]
  • fValue [protected]
  • GetData(void) const [inline, virtual]
  • CPersistent::GetData(void) const=0L [pure virtual]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • IsKindOf(const URuntimeClass *pClass) const
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • operator const int &() const [inline]
  • operator const T &() const [inline]
  • operator->() const [inline]
  • CPersistentT< int >::operator->() const [inline]
  • operator=(const int &val) [inline]
  • CPersistentT< int >::operator=(const int &val) [inline]
  • operator==(const int &val) const [inline]
  • CPersistentT< int >::operator==(const int &val) const [inline]
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SetData(const void *ptr, unsigned int size) [inline, virtual]
  • SizeOf(void) const [inline, virtual]
  • CPersistent::SizeOf(void) const=0L [pure virtual]
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • ~CPersistent() [virtual]
  • ~CPersistentInt() [inline, virtual]
  • ~CPersistentT() [inline, virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:48:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyRegistry Member List

This is the complete list of members for PyRegistry, including all inherited members.
  • CallInitValues(PyObject *dict) [static]
  • m_all [protected, static]
  • m_c [protected]
  • m_doc [protected]
  • m_next [protected]
  • m_type
  • m_v [protected]
  • PyRegistry(const char *name, size_t size, destructor d, getattrfunc g, PyRegistry_InitValues v, PyCFunction c, const char *doc)
  • RegisterAllObjects(std::vector< PyMethodDef > &methods) [static]
  • ~PyRegistry()
Generated on Sun Oct 21 12:49:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyContainer Member List

This is the complete list of members for PyContainer, including all inherited members.
  • False() [inline, static]
  • GetAttr(char *name) [inline, virtual]
  • PyContainer() [inline]
  • RegisterValue(PyObject *d, char *name, int value) [static]
  • True() [inline, static]
  • Void() [inline, static]
  • ~PyContainer() [inline, virtual]
Generated on Sun Oct 21 12:49:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyAutoObject Member List

This is the complete list of members for PyAutoObject, including all inherited members.
  • CopyReturn(void) [inline]
  • IsValid(void) [inline]
  • m_o [protected]
  • operator T *() const [inline]
  • operator->(void) [inline]
  • operator=(T *o) [inline]
  • operator=(PyObject *o) [inline]
  • operator=(PyAutoObject &obj) [inline]
  • PyAutoObject() [inline]
  • PyAutoObject(T *o) [inline]
  • PyAutoObject(PyObject *o) [inline]
  • PyAutoObject(PyAutoObject &obj) [inline]
  • Ref(void) [inline, protected]
  • UnRef(void) [inline, protected]
  • ~PyAutoObject() [inline]
Generated on Sun Oct 21 12:49:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPyThreadState Member List

This is the complete list of members for CPyThreadState, including all inherited members.
  • CPyThreadState(PyThreadState *p) [inline]
  • m_p [protected]
  • ~CPyThreadState() [inline]
Generated on Sun Oct 21 12:49:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CFillPyEntries Member List

This is the complete list of members for CFillPyEntries, including all inherited members.
  • CFillPyEntries(CSortList< ENTNODE > &entries) [inline]
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • gRunning [static]
  • m_entries
  • m_ignlist
  • OnAlias(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnAnyDevice(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnFile(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
  • ~CFillPyEntries() [inline, virtual]
Generated on Sun Oct 21 12:47:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CBuffer Member List

This is the complete list of members for CBuffer, including all inherited members.
  • append(const char *ptr, size_t s) [inline]
  • CBuffer() [inline]
  • m_buf [protected]
  • m_curSize [protected]
  • operator char *(void) const [inline]
  • size() const [inline]
Generated on Sun Oct 21 12:46:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPyCvsConsole Member List

This is the complete list of members for CPyCvsConsole, including all inherited members.
  • CPyCvsConsole() [inline]
  • cvs_err(char *txt, long len) [inline, virtual]
  • cvs_out(char *txt, long len) [inline, virtual]
  • m_err
  • m_out
  • ~CPyCvsConsole() [inline, virtual]
Generated on Sun Oct 21 12:49:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPython_Interp Member List

This is the complete list of members for CPython_Interp, including all inherited members.
  • ClosePythonSupport(void) [static]
  • CPython_Interp(bool mainInterp=true)
  • DoFile(const char *file)
  • DoScript(const char *script)
  • DoScriptVar(const char *format,...)
  • fInterp [protected]
  • InitPythonSupport(void) [static]
  • IsAvail(void) [static]
  • m_mainInterpreter [protected, static]
  • operator PyThreadState *(void) [inline]
  • ~CPython_Interp()
Generated on Sun Oct 21 12:49:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyCvsEntry Member List

This is the complete list of members for PyCvsEntry, including all inherited members.
  • Create(PyObject *selfptr, PyObject *args) [static]
  • dealloc(obj_t *self) [static]
  • False() [inline, static]
  • FindMethod(PyObject *self, char *name) [inline, static]
  • GetAttr(char *name) [virtual]
  • getattr(obj_t *self, char *name) [static]
  • GetType(void) [inline, static]
  • InitValues(PyObject *d) [static]
  • m_data [protected]
  • m_doc [static]
  • m_methods [static]
  • m_registry [static]
  • New(void) [static]
  • operator EntnodeData *(void) const [inline]
  • PyContainer() [inline]
  • PyCvsEntry(EntnodeData *data) [inline]
  • RegisterValue(PyObject *d, char *name, int value) [static]
  • True() [inline, static]
  • Void() [inline, static]
  • ~PyContainer() [inline, virtual]
  • ~PyCvsEntry() [inline, virtual]
Generated on Sun Oct 21 12:49:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyCvsEntry::obj_t Member List

This is the complete list of members for PyCvsEntry::obj_t, including all inherited members.
  • m_object
Generated on Sun Oct 21 12:49:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyColorConsole Member List

This is the complete list of members for PyColorConsole, including all inherited members.
  • _Print(obj_t *self, PyObject *args) [inline, protected, static]
  • Create(PyObject *selfptr, PyObject *args) [static]
  • dealloc(obj_t *self) [static]
  • False() [inline, static]
  • FindMethod(PyObject *self, char *name) [inline, static]
  • GetAttr(char *name) [inline, virtual]
  • getattr(obj_t *self, char *name) [static]
  • GetType(void) [inline, static]
  • InitValues(PyObject *d) [static]
  • m_console [protected]
  • m_doc [static]
  • m_methods [static]
  • m_registry [static]
  • New(void) [static]
  • Print(PyObject *args)
  • PyColorConsole() [inline]
  • PyContainer() [inline]
  • RegisterValue(PyObject *d, char *name, int value) [static]
  • True() [inline, static]
  • Void() [inline, static]
  • ~PyColorConsole() [inline, virtual]
  • ~PyContainer() [inline, virtual]
Generated on Sun Oct 21 12:49:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyColorConsole::obj_t Member List

This is the complete list of members for PyColorConsole::obj_t, including all inherited members.
  • m_object
Generated on Sun Oct 21 12:49:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyMenuMgr Member List

This is the complete list of members for PyMenuMgr, including all inherited members.
  • _AddButton(obj_t *self, PyObject *args) [inline, protected, static]
  • _AddPulldown(obj_t *self, PyObject *args) [inline, protected, static]
  • _AddSeparator(obj_t *self, PyObject *args) [inline, protected, static]
  • _AddToggle(obj_t *self, PyObject *args) [inline, protected, static]
  • _Count(obj_t *self, PyObject *args) [inline, protected, static]
  • _Delete(obj_t *self, PyObject *args) [inline, protected, static]
  • _DeleteByCmd(obj_t *self, PyObject *args) [inline, protected, static]
  • AddButton(PyObject *args)
  • AddPulldown(PyObject *args)
  • AddSeparator(PyObject *args)
  • AddToggle(PyObject *args)
  • Count(PyObject *args)
  • Create(PyObject *selfptr, PyObject *args) [static]
  • dealloc(obj_t *self) [static]
  • Delete(PyObject *args)
  • DeleteByCmd(PyObject *args)
  • False() [inline, static]
  • FindMethod(PyObject *self, char *name) [inline, static]
  • getattr(obj_t *self, char *name) [static]
  • GetAttr(char *name) [inline, virtual]
  • GetType(void) [inline, static]
  • InitValues(PyObject *d) [static]
  • m_doc [static]
  • m_menu [protected]
  • m_methods [static]
  • m_registry [static]
  • New(void) [static]
  • operator UMENU() const [inline]
  • PyContainer() [inline]
  • PyMenuMgr(UMENU menu) [inline]
  • RegisterValue(PyObject *d, char *name, int value) [static]
  • True() [inline, static]
  • Void() [inline, static]
  • ~PyContainer() [inline, virtual]
  • ~PyMenuMgr() [inline, virtual]
Generated on Sun Oct 21 12:49:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyMenuMgr::obj_t Member List

This is the complete list of members for PyMenuMgr::obj_t, including all inherited members.
  • m_object
Generated on Sun Oct 21 12:49:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyCmdUI Member List

This is the complete list of members for PyCmdUI, including all inherited members.
  • _Enable(obj_t *self, PyObject *args) [inline, protected, static]
  • _SetCheck(obj_t *self, PyObject *args) [inline, protected, static]
  • _SetText(obj_t *self, PyObject *args) [inline, protected, static]
  • Create(PyObject *selfptr, PyObject *args) [static]
  • dealloc(obj_t *self) [static]
  • Enable(PyObject *args)
  • False() [inline, static]
  • FindMethod(PyObject *self, char *name) [inline, static]
  • getattr(obj_t *self, char *name) [static]
  • GetAttr(char *name) [inline, virtual]
  • GetType(void) [inline, static]
  • InitValues(PyObject *d) [static]
  • m_cmdui [protected]
  • m_doc [static]
  • m_methods [static]
  • m_registry [static]
  • New(void) [static]
  • PyCmdUI(UCmdUI *cmdui) [inline]
  • PyContainer() [inline]
  • RegisterValue(PyObject *d, char *name, int value) [static]
  • SetCheck(PyObject *args)
  • SetText(PyObject *args)
  • True() [inline, static]
  • Void() [inline, static]
  • ~PyCmdUI() [inline, virtual]
  • ~PyContainer() [inline, virtual]
Generated on Sun Oct 21 12:49:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyCmdUI::obj_t Member List

This is the complete list of members for PyCmdUI::obj_t, including all inherited members.
  • m_object
Generated on Sun Oct 21 12:49:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyPersistent Member List

This is the complete list of members for PyPersistent, including all inherited members.
  • _GetValue(obj_t *self, PyObject *args) [inline, protected, static]
  • _SetValue(obj_t *self, PyObject *args) [inline, protected, static]
  • Create(PyObject *selfptr, PyObject *args) [static]
  • dealloc(obj_t *self) [static]
  • False() [inline, static]
  • FindMethod(PyObject *self, char *name) [inline, static]
  • GetAttr(char *name) [inline, virtual]
  • getattr(obj_t *self, char *name) [static]
  • GetType(void) [inline, static]
  • GetValue(PyObject *args)
  • InitValues(PyObject *d) [static]
  • m_cstr [protected]
  • m_doc [static]
  • m_methods [static]
  • m_registry [static]
  • New(void) [static]
  • PyContainer() [inline]
  • PyPersistent(const char *uniqueName, const char *defValue, kClassPersistent pclass) [inline]
  • RegisterValue(PyObject *d, char *name, int value) [static]
  • SetValue(PyObject *args)
  • True() [inline, static]
  • Void() [inline, static]
  • ~PyContainer() [inline, virtual]
  • ~PyPersistent() [inline, virtual]
Generated on Sun Oct 21 12:49:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PyPersistent::obj_t Member List

This is the complete list of members for PyPersistent::obj_t, including all inherited members.
  • m_object
Generated on Sun Oct 21 12:49:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CSortList Member List

This is the complete list of members for CSortList, including all inherited members.
  • CSortList(int def_size, QsortMethod method_sort) [inline]
  • Delete(const T &entry) [inline]
  • Entry(int num_elem) const [inline, private]
  • fDef [private]
  • fElems [private]
  • fMax [private]
  • fMethod [private]
  • fNewOne [private]
  • fNum [private]
  • Get(int index) const [inline]
  • Insert(const T &entry, bool replaceIfAlreadyExists=false) [inline]
  • Inside(const T &entry, int *indexptr=0L) const [inline]
  • InsideAndInsert(const T &entry, int *indexptr=0L, bool replaceIfAlreadyExists=false) [inline]
  • Location(const T &entry) [inline, private]
  • NumOfElements(void) [inline]
  • QsortMethod typedef
  • Reset(void) [inline]
  • Result(int *num_elem) [inline]
  • ~CSortList() [inline]
Generated on Sun Oct 21 12:49:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CTCLBrowserEnt Member List

This is the complete list of members for CTCLBrowserEnt, including all inherited members.
  • CTCLBrowserEnt() [inline]
  • CTCLBrowserEnt(EntnodeData *data) [inline]
  • CTCLBrowserEnt(const CTCLBrowserEnt &ent) [inline]
  • GetData() const [inline]
  • GetNormalized(UStr &path, UStr &fname) const [inline]
  • IsSamePath(const char *pathstr) const [inline]
  • node [private]
  • operator=(const CTCLBrowserEnt &ent) [inline]
  • ~CTCLBrowserEnt() [inline]
Generated on Sun Oct 21 12:50:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CTCLCvsConsole Member List

This is the complete list of members for CTCLCvsConsole, including all inherited members.
  • CTCLCvsConsole(Tcl_Interp *interp) [inline]
  • cvs_err(char *txt, long len) [inline, virtual]
  • cvs_out(char *txt, long len) [inline, virtual]
  • fAlloc [protected]
  • fInterp [protected]
  • fLen [protected]
  • ~CTCLCvsConsole() [inline, virtual]
Generated on Sun Oct 21 12:50:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CFillTclEntries Member List

This is the complete list of members for CFillTclEntries, including all inherited members.
  • CFillTclEntries(CSortList< ENTNODE > &entries) [inline]
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • gRunning [static]
  • m_entries
  • m_ignlist
  • OnAlias(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnAnyDevice(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnFile(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
  • ~CFillTclEntries() [inline, virtual]
Generated on Sun Oct 21 12:47:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CTcl_Interp Member List

This is the complete list of members for CTcl_Interp, including all inherited members.
  • CTcl_Interp()
  • Deunixfy(UStr &path) [static]
  • DoFile(const char *file)
  • DoScript(const char *script)
  • DoScriptVar(const char *format,...)
  • fExitOnError [protected]
  • fInterp [protected]
  • fLastErrorCode [protected]
  • GetCvsExitOnError() [inline]
  • GetCvsLastErrorCode() [inline]
  • IsAvail(void) [static]
  • operator Tcl_Interp *(void) [inline]
  • SetCvsExitOnError(bool value) [inline]
  • SetCvsLastErrorCode(int value) [inline]
  • Unixfy(UStr &path) [static]
  • ~CTcl_Interp()
Generated on Sun Oct 21 12:50:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UCvsApp Member List

This is the complete list of members for UCvsApp, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • Execute(int argc, char *const *argv)
  • gApp [static]
  • gCurCvs [static]
  • gCvsRunning [protected]
  • gCvsStopping [protected]
  • GetAppLibFolder(void) const
  • GetAppName(void) const
  • GetAppVersion(void) const
  • GetBaseMessageMap() [protected, static]
  • GetBrowserView(void)
  • GetFilesView(void)
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsCvsRunning(void) [inline]
  • IsCvsStopping(void) [inline]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kProcessTimer enum value
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnMainTimer(long time) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • SayWelcome(void)
  • SetCvsRunning(bool state)
  • SetCvsStopping(bool state)
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UCvsApp(int argc, char **argv)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UCvsApp() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:47:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UCOLOR Member List

This is the complete list of members for UCOLOR, including all inherited members.
  • b
  • g
  • r
  • UCOLOR() [inline]
  • UCOLOR(char _r, char _g, char _b) [inline]
Generated on Sun Oct 21 12:47:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UCvsConsole Member List

This is the complete list of members for UCvsConsole, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • bold [protected]
  • classUObject [protected, static]
  • col [protected]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • FeedThisLine(const char *buf, size_t numbuf, bool isStderr) [protected]
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • italic [protected]
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_buf [protected]
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_numbuf [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • MAX_CHAR_BY_LINE enum value [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCreate() [protected]
  • OnDestroy() [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • out [protected]
  • OutColor(const char *txt, long len)
  • OutColor(kConsoleColor color)
  • OutConsole(const char *txt, size_t len, bool isStderr=false)
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UCvsConsole()
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • underline [protected]
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UCvsConsole() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:47:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TViewFill Member List

This is the complete list of members for TViewFill, including all inherited members.
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • GetListCtrl() const [inline]
  • GetView() const [inline]
  • gRunning [static]
  • InitItem(EntnodeData *data, int iImage, const char *tag=0L) [inline]
  • IsRecursive() const [inline]
  • IsShowIgnored() const [inline]
  • m_context
  • m_entries
  • m_entries
  • m_ignlist
  • m_listCtrl
  • OnAlias(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnAlias(const char *fullpath, const char *fullname, const char *name, const struct wnt_stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnAnyDevice(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct wnt_stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnFile(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnFile(const char *fullpath, const char *fullname, const char *name, const struct wnt_stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
  • TViewFill(UCvsFiles *listCtrl, CSortList< ENTNODE > &entries) [inline]
  • TViewFill(const KoTraversalContext *context) [inline]
  • ~TViewFill() [inline, virtual]
Generated on Sun Oct 21 12:50:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UCvsFiles Member List

This is the complete list of members for UCvsFiles, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • DisableGeneric() [protected]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EditSel(EntnodeData *data, bool useDefault=false) [protected]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetEntriesModTime(time_t &newEntriesMod, time_t &newEntriesLogMod) [protected]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetImageForEntry(EntnodeData *data) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsSortAscendant(void) [inline]
  • IsUIValid() [static]
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_ascendant [protected]
  • m_currentPage [protected]
  • m_entries [protected]
  • m_entriesLogMod [protected]
  • m_entriesMod [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_path [protected]
  • m_sort [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnCmdAdd(void) [protected]
  • OnCmdAddb(void) [protected]
  • OnCmdCommit(void) [protected]
  • OnCmdDiff(void) [protected]
  • OnCmdEdit(void) [protected]
  • OnCmdEditors(void) [protected]
  • OnCmdEditsel(void) [protected]
  • OnCmdEditseldef(void) [protected]
  • OnCmdExplore(void) [protected]
  • OnCmdGraph(void) [protected]
  • OnCmdIgnore(void) [protected]
  • OnCmdLock(void) [protected]
  • OnCmdLog(void) [protected]
  • OnCmdQueryUpdate(void) [protected]
  • OnCmdRelease(void) [protected]
  • OnCmdReload(void) [protected]
  • OnCmdRmv(void) [protected]
  • OnCmdStatus(void) [protected]
  • OnCmdTagBranch(void) [protected]
  • OnCmdTagDelete(void) [protected]
  • OnCmdTagNew(void) [protected]
  • OnCmdTrash(void) [protected]
  • OnCmdUIAdd(UCmdUI *pCmdUI) [protected]
  • OnCmdUIAddB(UCmdUI *pCmdUI) [protected]
  • OnCmdUIEditseldef(UCmdUI *pCmdUI) [protected]
  • OnCmdUIExplore(UCmdUI *pCmdUI) [protected]
  • OnCmdUIGraph(UCmdUI *pCmdUI) [protected]
  • OnCmdUIIgnore(UCmdUI *pCmdUI) [protected]
  • OnCmdUIMacroSel(int cmd, UCmdUI *pCmdUI) [protected]
  • OnCmdUIRelease(UCmdUI *pCmdUI) [protected]
  • OnCmdUIReload(UCmdUI *pCmdUI) [protected]
  • OnCmdUIRmv(UCmdUI *pCmdUI) [protected]
  • OnCmdUITrash(UCmdUI *pCmdUI) [protected]
  • OnCmdUIUpdate(UCmdUI *pCmdUI) [protected]
  • OnCmdUIUpone(UCmdUI *pCmdUI) [protected]
  • OnCmdUnedit(void) [protected]
  • OnCmdUnlock(void) [protected]
  • OnCmdUpdate(void) [protected]
  • OnCmdUpone(void) [protected]
  • OnCmdWatchers(void) [protected]
  • OnCmdWatchOff(void) [protected]
  • OnCmdWatchOn(void) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCreate() [protected]
  • OnDblClick(void) [protected]
  • OnDestroy() [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnMacroSel(int cmd) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSelColumn(int column) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • ResetView(const char *path, bool notifyBrowser=false)
  • ResetView(bool forceReload=false, bool notifyBrowser=false)
  • Resort(void) [protected]
  • rtUObject() [static]
  • Search(const char *title) [protected]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UCvsFiles()
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UCvsFiles() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:47:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CTempToggleBool Member List

This is the complete list of members for CTempToggleBool, including all inherited members.
  • CTempToggleBool(bool &value) [inline]
  • m_didSetIt [protected]
  • m_value [protected]
  • ~CTempToggleBool() [inline]
Generated on Sun Oct 21 12:50:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TBrowserFillDummy Member List

This is the complete list of members for TBrowserFillDummy, including all inherited members.
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • gRunning [static]
  • m_data
  • m_data
  • m_dirname
  • m_empty
  • m_hascvs
  • m_item
  • m_item
  • m_root
  • m_root
  • m_treeCtrl
  • m_treeCtrl
  • OnAlias(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnAnyDevice(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct wnt_stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnFile(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
  • TBrowserFillDummy(UCvsFolders *treeCtrl, UTREEITEM root, UTREEITEM item, EntnodeData *data) [inline]
  • TBrowserFillDummy(CTreeCtrl &treeCtrl, HTREEITEM root, HTREEITEM item, EntnodeData *data) [inline]
  • ~TBrowserFillDummy() [inline, virtual]
Generated on Sun Oct 21 12:49:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TBrowserFill Member List

This is the complete list of members for TBrowserFill, including all inherited members.
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • EnterDirectory(const char *fullpath, const char *dirname, const FSSpec *macspec) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • ExitDirectory(const char *fullpath) [inline, virtual]
  • gRunning [static]
  • m_entries
  • m_entries
  • m_ignlist
  • m_isShowIgnored
  • m_item
  • m_item
  • m_root
  • m_root
  • m_treeCtrl
  • m_treeCtrl
  • OnAlias(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnAnyDevice(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnDirectory(const char *fullpath, const char *fullname, const char *name, const struct wnt_stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnError(const char *err, int errcode) [inline, virtual]
  • OnFile(const char *fullpath, const char *fullname, const char *name, const struct stat &dir, const FSSpec *macspec) [inline, virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
  • OnIdle(const char *fullpath) [inline, virtual]
  • TBrowserFill(UCvsFolders *treeCtrl, UTREEITEM root, UTREEITEM item, CSortList< ENTNODE > &entries) [inline]
  • TBrowserFill(CTreeCtrl &treeCtrl, HTREEITEM root, HTREEITEM item, CSortList< ENTNODE > &entries) [inline]
  • ~TBrowserFill() [inline, virtual]
Generated on Sun Oct 21 12:49:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UCvsFolders Member List

This is the complete list of members for UCvsFolders, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • DeleteAllItems(UTREEITEM root=0L)
  • DisableGeneric() [protected]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetItemByLocation(const char *path) [protected]
  • GetMessageMap() const [protected, virtual]
  • GetRoot(void) const [inline]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_root [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnCmdAdd(void) [protected]
  • OnCmdCheckout(void) [protected]
  • OnCmdCommit(void) [protected]
  • OnCmdDiff(void) [protected]
  • OnCmdEdit(void) [protected]
  • OnCmdEditors(void) [protected]
  • OnCmdExplore(void) [protected]
  • OnCmdIgnore(void) [protected]
  • OnCmdImport(void) [protected]
  • OnCmdLock(void) [protected]
  • OnCmdLog(void) [protected]
  • OnCmdMacrosSel(int cmd) [protected]
  • OnCmdQueryUpdate(void) [protected]
  • OnCmdRelease(void) [protected]
  • OnCmdReload(void) [protected]
  • OnCmdStatus(void) [protected]
  • OnCmdTagBranch(void) [protected]
  • OnCmdTagDelete(void) [protected]
  • OnCmdTagNew(void) [protected]
  • OnCmdUIAdd(UCmdUI *pCmdUI) [protected]
  • OnCmdUICheckout(UCmdUI *pCmdUI) [protected]
  • OnCmdUIExplore(UCmdUI *pCmdUI) [protected]
  • OnCmdUIIgnore(UCmdUI *pCmdUI) [protected]
  • OnCmdUIImport(UCmdUI *pCmdUI) [protected]
  • OnCmdUIMacrosSel(int cmd, UCmdUI *pCmdUI) [protected]
  • OnCmdUIReload(UCmdUI *pCmdUI) [protected]
  • OnCmdUIUpdate(UCmdUI *pCmdUI) [protected]
  • OnCmdUnedit(void) [protected]
  • OnCmdUnlock(void) [protected]
  • OnCmdUpdate(void) [protected]
  • OnCmdWatchers(void) [protected]
  • OnCmdWatchOff(void) [protected]
  • OnCmdWatchOn(void) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCreate() [protected]
  • OnDestroy() [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeExpanding(int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSelecting(int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateGeneric(UCmdUI *pCmdUI, bool needCvsInfos) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • ResetBrowser(const char *path, bool notifyView=false)
  • ResetView(bool forceReload=false, bool notifyView=false)
  • RetrievePath(UTREEITEM item, UStr &path)
  • rtUObject() [static]
  • SetDefaultRoot(const char *root) [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • StepToLocation(const char *path, bool notifyView=false)
  • StoreExpanded(std::vector< UStr > &allExpanded, UTREEITEM root=0L) [protected]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UCvsFolders()
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UCvsFolders() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:47:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UCvsFrame Member List

This is the complete list of members for UCvsFrame, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • AskForQuitting(void)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kBrowserPopup enum value
  • kDirCombo enum value
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnBrowserPopup(void) [protected]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnCmdCmdline(void) [protected]
  • OnCmdInit(void) [protected]
  • OnCmdLogin(void) [protected]
  • OnCmdLogout(void) [protected]
  • OnCmdMacroAdmin(int cmd) [protected]
  • OnCmdPreferences(void) [protected]
  • OnCmdRtagBranch(void) [protected]
  • OnCmdRtagDelete(void) [protected]
  • OnCmdRtagNew(void) [protected]
  • OnCmdSaveSettings(void) [protected]
  • OnCmdStopcvs(void) [protected]
  • OnCmdUIAnytime(int cmd, UCmdUI *pCmdUI) [protected]
  • OnCmdUICvsCmd(UCmdUI *pCmdUI) [protected]
  • OnCmdUIMacroAdmin(int cmd, UCmdUI *pCmdUI) [protected]
  • OnCmdUIQuit(UCmdUI *pCmdUI) [protected]
  • OnCmdUIStopcvs(UCmdUI *pCmdUI) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSelDir(int pos, const char *txt) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCopyrights(void) [protected]
  • OnCredits(void) [protected]
  • OnDestroy(void) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnQuit(void) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UCvsFrame()
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UCvsFrame() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:47:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UWaitCursor Member List

This is the complete list of members for UWaitCursor, including all inherited members.
  • UWaitCursor() [inline]
  • ~UWaitCursor() [inline, virtual]
Generated on Sun Oct 21 12:50:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CScrollView Member List

This is the complete list of members for CScrollView, including all inherited members.
  • GetDeviceScrollPosition() [inline]
  • InvalidateRect(const URECT *r) [inline]
Generated on Sun Oct 21 12:49:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWinLogData Member List

This is the complete list of members for CWinLogData, including all inherited members.
  • Bounds(void) [inline]
  • Bounds(void) [inline]
  • CLogNodeData(CLogNode *node) [inline]
  • ComputeBounds(const UPoint &topLeft, UDC &hdc, EntnodeData *entryInfo=0L)
  • ComputeBounds(const CPoint &topLeft, CDC &hdc, EntnodeData *entryInfo=0L)
  • CreateNewData(CLogNode *node) [static]
  • CreateNewData(CLogNode *node) [static]
  • CWinLogData(CLogNode *node)
  • CWinLogData(CLogNode *node)
  • fNode [protected]
  • GetBoundsSelf(UDC &hdc, EntnodeData *entryInfo)=0 [protected, pure virtual]
  • GetBoundsSelf(CDC &hdc, EntnodeData *entryInfo)=0 [protected, pure virtual]
  • GetData(CLogNode *node) [inline, protected]
  • GetData(CLogNode *node) [inline, protected]
  • GetStr(void)
  • GetStr(void)
  • GetType(void) const [inline]
  • GetType(void) const [inline]
  • HitTest(UPoint point)
  • HitTest(CPoint point)
  • IsDeadNode()
  • IsDiskNode(EntnodeData *entryInfo)
  • IsDiskNode(EntnodeData *entryInfo)
  • IsUserState()
  • Node(void) [inline]
  • Offset(UPoint o)
  • Offset(CPoint o)
  • sel [protected]
  • Selected(void) const [inline]
  • Selected(void) const [inline]
  • selfB [protected]
  • selfB [protected]
  • SelfBounds(void) [inline]
  • SelfBounds(void) [inline]
  • SetSelected(CScrollView *view, bool state)
  • SetSelected(CScrollView *view, bool state)
  • totB [protected]
  • totB [protected]
  • UnselectAll(CScrollView *view)
  • UnselectAll(CScrollView *view)
  • Update(UDC &hdc, EntnodeData *entryInfo=0L)
  • Update(CDC &hdc, EntnodeData *entryInfo=0L)
  • UpdateSelf(UDC &hdc, EntnodeData *entryInfo)=0 [protected, pure virtual]
  • UpdateSelf(CDC &hdc, EntnodeData *entryInfo)=0 [protected, pure virtual]
  • ~CLogNodeData() [inline, virtual]
  • ~CWinLogData() [virtual]
  • ~CWinLogData() [virtual]
Generated on Sun Oct 21 12:51:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWinLogHeaderData Member List

This is the complete list of members for CWinLogHeaderData, including all inherited members.
  • Bounds(void) [inline]
  • Bounds(void) [inline]
  • CLogNodeData(CLogNode *node) [inline]
  • ComputeBounds(const UPoint &topLeft, UDC &hdc, EntnodeData *entryInfo=0L)
  • ComputeBounds(const CPoint &topLeft, CDC &hdc, EntnodeData *entryInfo=0L)
  • CreateNewData(CLogNode *node) [static]
  • CreateNewData(CLogNode *node) [static]
  • CWinLogData(CLogNode *node)
  • CWinLogData(CLogNode *node)
  • CWinLogHeaderData(CLogNode *node) [inline]
  • CWinLogHeaderData(CLogNode *node) [inline]
  • fNode [protected]
  • GetBoundsSelf(UDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • GetBoundsSelf(CDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • GetData(CLogNode *node) [inline, protected]
  • GetData(CLogNode *node) [inline, protected]
  • GetStr(void)
  • GetStr(void)
  • GetType(void) const [inline]
  • GetType(void) const [inline]
  • HitTest(UPoint point)
  • HitTest(CPoint point)
  • IsDeadNode()
  • IsDiskNode(EntnodeData *entryInfo)
  • IsDiskNode(EntnodeData *entryInfo)
  • IsUserState()
  • Node(void) [inline]
  • Offset(UPoint o)
  • Offset(CPoint o)
  • sel [protected]
  • Selected(void) const [inline]
  • Selected(void) const [inline]
  • selfB [protected]
  • selfB [protected]
  • SelfBounds(void) [inline]
  • SelfBounds(void) [inline]
  • SetSelected(CScrollView *view, bool state)
  • SetSelected(CScrollView *view, bool state)
  • totB [protected]
  • totB [protected]
  • UnselectAll(CScrollView *view)
  • UnselectAll(CScrollView *view)
  • Update(UDC &hdc, EntnodeData *entryInfo=0L)
  • Update(CDC &hdc, EntnodeData *entryInfo=0L)
  • UpdateSelf(UDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • UpdateSelf(CDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • ~CLogNodeData() [inline, virtual]
  • ~CWinLogData() [virtual]
  • ~CWinLogData() [virtual]
  • ~CWinLogHeaderData() [inline, virtual]
  • ~CWinLogHeaderData() [inline, virtual]
Generated on Sun Oct 21 12:51:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWinLogRevData Member List

This is the complete list of members for CWinLogRevData, including all inherited members.
  • Bounds(void) [inline]
  • Bounds(void) [inline]
  • CLogNodeData(CLogNode *node) [inline]
  • ComputeBounds(const UPoint &topLeft, UDC &hdc, EntnodeData *entryInfo=0L)
  • ComputeBounds(const CPoint &topLeft, CDC &hdc, EntnodeData *entryInfo=0L)
  • CreateNewData(CLogNode *node) [static]
  • CreateNewData(CLogNode *node) [static]
  • CWinLogData(CLogNode *node)
  • CWinLogData(CLogNode *node)
  • CWinLogRevData(CLogNode *node) [inline]
  • CWinLogRevData(CLogNode *node) [inline]
  • fNode [protected]
  • GetBoundsSelf(UDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • GetBoundsSelf(CDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • GetData(CLogNode *node) [inline, protected]
  • GetData(CLogNode *node) [inline, protected]
  • GetStr(void)
  • GetStr(void)
  • GetType(void) const [inline]
  • GetType(void) const [inline]
  • HitTest(UPoint point)
  • HitTest(CPoint point)
  • IsDeadNode()
  • IsDiskNode(EntnodeData *entryInfo)
  • IsDiskNode(EntnodeData *entryInfo)
  • IsUserState()
  • Node(void) [inline]
  • Offset(UPoint o)
  • Offset(CPoint o)
  • sel [protected]
  • Selected(void) const [inline]
  • Selected(void) const [inline]
  • selfB [protected]
  • selfB [protected]
  • SelfBounds(void) [inline]
  • SelfBounds(void) [inline]
  • SetSelected(CScrollView *view, bool state)
  • SetSelected(CScrollView *view, bool state)
  • totB [protected]
  • totB [protected]
  • UnselectAll(CScrollView *view)
  • UnselectAll(CScrollView *view)
  • Update(UDC &hdc, EntnodeData *entryInfo=0L)
  • Update(CDC &hdc, EntnodeData *entryInfo=0L)
  • UpdateSelf(UDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • UpdateSelf(CDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • ~CLogNodeData() [inline, virtual]
  • ~CWinLogData() [virtual]
  • ~CWinLogData() [virtual]
  • ~CWinLogRevData() [inline, virtual]
  • ~CWinLogRevData() [inline, virtual]
Generated on Sun Oct 21 12:51:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWinLogTagData Member List

This is the complete list of members for CWinLogTagData, including all inherited members.
  • Bounds(void) [inline]
  • Bounds(void) [inline]
  • CLogNodeData(CLogNode *node) [inline]
  • ComputeBounds(const UPoint &topLeft, UDC &hdc, EntnodeData *entryInfo=0L)
  • ComputeBounds(const CPoint &topLeft, CDC &hdc, EntnodeData *entryInfo=0L)
  • CreateNewData(CLogNode *node) [static]
  • CreateNewData(CLogNode *node) [static]
  • CWinLogData(CLogNode *node)
  • CWinLogData(CLogNode *node)
  • CWinLogTagData(CLogNode *node) [inline]
  • CWinLogTagData(CLogNode *node) [inline]
  • fNode [protected]
  • GetBoundsSelf(UDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • GetBoundsSelf(CDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • GetData(CLogNode *node) [inline, protected]
  • GetData(CLogNode *node) [inline, protected]
  • GetStr(void)
  • GetStr(void)
  • GetType(void) const [inline]
  • GetType(void) const [inline]
  • HitTest(UPoint point)
  • HitTest(CPoint point)
  • IsDeadNode()
  • IsDiskNode(EntnodeData *entryInfo)
  • IsDiskNode(EntnodeData *entryInfo)
  • IsUserState()
  • Node(void) [inline]
  • Offset(UPoint o)
  • Offset(CPoint o)
  • sel [protected]
  • Selected(void) const [inline]
  • Selected(void) const [inline]
  • selfB [protected]
  • selfB [protected]
  • SelfBounds(void) [inline]
  • SelfBounds(void) [inline]
  • SetSelected(CScrollView *view, bool state)
  • SetSelected(CScrollView *view, bool state)
  • totB [protected]
  • totB [protected]
  • UnselectAll(CScrollView *view)
  • UnselectAll(CScrollView *view)
  • Update(UDC &hdc, EntnodeData *entryInfo=0L)
  • Update(CDC &hdc, EntnodeData *entryInfo=0L)
  • UpdateSelf(UDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • UpdateSelf(CDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • ~CLogNodeData() [inline, virtual]
  • ~CWinLogData() [virtual]
  • ~CWinLogData() [virtual]
  • ~CWinLogTagData() [inline, virtual]
  • ~CWinLogTagData() [inline, virtual]
Generated on Sun Oct 21 12:51:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWinLogBranchData Member List

This is the complete list of members for CWinLogBranchData, including all inherited members.
  • Bounds(void) [inline]
  • Bounds(void) [inline]
  • CLogNodeData(CLogNode *node) [inline]
  • ComputeBounds(const UPoint &topLeft, UDC &hdc, EntnodeData *entryInfo=0L)
  • ComputeBounds(const CPoint &topLeft, CDC &hdc, EntnodeData *entryInfo=0L)
  • CreateNewData(CLogNode *node) [static]
  • CreateNewData(CLogNode *node) [static]
  • CWinLogBranchData(CLogNode *node) [inline]
  • CWinLogBranchData(CLogNode *node) [inline]
  • CWinLogData(CLogNode *node)
  • CWinLogData(CLogNode *node)
  • fNode [protected]
  • GetBoundsSelf(UDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • GetBoundsSelf(CDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • GetData(CLogNode *node) [inline, protected]
  • GetData(CLogNode *node) [inline, protected]
  • GetStr(void)
  • GetStr(void)
  • GetType(void) const [inline]
  • GetType(void) const [inline]
  • HitTest(UPoint point)
  • HitTest(CPoint point)
  • IsDeadNode()
  • IsDiskNode(EntnodeData *entryInfo)
  • IsDiskNode(EntnodeData *entryInfo)
  • IsUserState()
  • Node(void) [inline]
  • Offset(UPoint o)
  • Offset(CPoint o)
  • sel [protected]
  • Selected(void) const [inline]
  • Selected(void) const [inline]
  • selfB [protected]
  • selfB [protected]
  • SelfBounds(void) [inline]
  • SelfBounds(void) [inline]
  • SetSelected(CScrollView *view, bool state)
  • SetSelected(CScrollView *view, bool state)
  • totB [protected]
  • totB [protected]
  • UnselectAll(CScrollView *view)
  • UnselectAll(CScrollView *view)
  • Update(UDC &hdc, EntnodeData *entryInfo=0L)
  • Update(CDC &hdc, EntnodeData *entryInfo=0L)
  • UpdateSelf(UDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • UpdateSelf(CDC &hdc, EntnodeData *entryInfo) [protected, virtual]
  • ~CLogNodeData() [inline, virtual]
  • ~CWinLogBranchData() [inline, virtual]
  • ~CWinLogBranchData() [inline, virtual]
  • ~CWinLogData() [virtual]
  • ~CWinLogData() [virtual]
Generated on Sun Oct 21 12:51:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UCvsGraph Member List

This is the complete list of members for UCvsGraph, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • CalcImageSize(void) [protected]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kDrawing enum value
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_data [protected]
  • m_dir [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_name [protected]
  • m_node [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCreate() [protected]
  • OnDestroy() [protected]
  • OnDrawing(void *info) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UCvsGraph(CLogNode *node, const char *dir)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UCvsGraph() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:47:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UCvsMenubar Member List

This is the complete list of members for UCvsMenubar, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCommands(int cmd) [protected]
  • OnCreate() [protected]
  • OnDestroy() [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UCvsMenubar()
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UMenu(int widid)
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UCvsMenubar() [virtual]
  • ~UMenu() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:47:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UCvsToolbar Member List

This is the complete list of members for UCvsToolbar, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • m_winInfo [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCommands(int cmd) [protected]
  • OnCreate() [protected]
  • OnDestroy() [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTbButton(UTB_BUTTON *info) [protected]
  • OnTbCheckBtn(UTB_BUTTON *info) [protected]
  • OnTbDropDown(UTB_DROPDOWN *info) [protected]
  • OnTbEnd(void) [protected]
  • OnTbInit(UTB_INIT *info) [protected]
  • OnTbSeparator(void) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UCvsToolbar()
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UToolbar(int widid)
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UCvsToolbar() [virtual]
  • ~UObject() [inline, virtual]
  • ~UToolbar() [virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:47:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

partition Member List

This is the complete list of members for partition, including all inherited members.
  • hi_minimal
  • lo_minimal
  • xmid
  • ymid
Generated on Sun Oct 21 12:48:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

regexp_list Member List

This is the complete list of members for regexp_list, including all inherited members.
  • buf
  • next
Generated on Sun Oct 21 12:49:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

change Member List

This is the complete list of members for change, including all inherited members.
  • deleted
  • ignore
  • inserted
  • line0
  • line1
  • link
Generated on Sun Oct 21 12:46:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

file_data Member List

This is the complete list of members for file_data, including all inherited members.
  • alloc_lines
  • buffer
  • buffered_chars
  • buffered_lines
  • bufsize
  • changed_flag
  • desc
  • dir_p
  • equiv_max
  • equivs
  • linbuf
  • linbuf_base
  • missing_newline
  • name
  • nondiscarded_lines
  • prefix_end
  • prefix_lines
  • realindexes
  • stat
  • suffix_begin
  • undiscarded
  • valid_lines
Generated on Sun Oct 21 12:47:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

diff_block Member List

This is the complete list of members for diff_block, including all inherited members.
  • lengths
  • lines
  • next
  • ranges
Generated on Sun Oct 21 12:47:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

diff3_block Member List

This is the complete list of members for diff3_block, including all inherited members.
  • correspond
  • lengths
  • lines
  • next
  • ranges
Generated on Sun Oct 21 12:47:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

diff_callbacks Member List

This is the complete list of members for diff_callbacks, including all inherited members.
  • error
  • flush_output
  • write_output
  • write_stdout
Generated on Sun Oct 21 12:47:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

dirdata Member List

This is the complete list of members for dirdata, including all inherited members.
  • data
  • names
Generated on Sun Oct 21 12:47:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

group Member List

This is the complete list of members for group, including all inherited members.
  • file
  • from
  • gr_gid
  • gr_gid
  • gr_mem
  • gr_name
  • gr_name
  • gr_name
  • gr_passwd
  • upto
Generated on Sun Oct 21 12:47:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

equivclass Member List

This is the complete list of members for equivclass, including all inherited members.
  • hash
  • length
  • line
  • next
Generated on Sun Oct 21 12:47:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

msg Member List

This is the complete list of members for msg, including all inherited members.
  • arg1
  • arg2
  • arg3
  • arg4
  • format
  • next
Generated on Sun Oct 21 12:48:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

timeb Member List

This is the complete list of members for timeb, including all inherited members.
  • dstflag
  • millitm
  • time
  • timezone
Generated on Sun Oct 21 12:50:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_TABLE Member List

This is the complete list of members for _TABLE, including all inherited members.
  • name
  • name
  • type
  • value
Generated on Sun Oct 21 12:45:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

YYSTYPE Member List

This is the complete list of members for YYSTYPE, including all inherited members.
  • aint
  • Meridian
  • Number
  • string
  • string
Generated on Sun Oct 21 12:51:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

yystack Member List

This is the complete list of members for yystack, including all inherited members.
  • ss
  • sslim
  • ssp
  • stacksize
  • vs
  • vsp
Generated on Sun Oct 21 12:51:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

cvs_MD5Context Member List

This is the complete list of members for cvs_MD5Context, including all inherited members.
  • bits
  • buf
  • in
Generated on Sun Oct 21 12:47:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

re_pattern_buffer Member List

This is the complete list of members for re_pattern_buffer, including all inherited members.
  • allocated
  • buffer
  • can_be_null
  • fastmap
  • fastmap_accurate
  • multibyte
  • newline_anchor
  • no_sub
  • not_bol
  • not_eol
  • re_nsub
  • regs_allocated
  • syntax
  • translate
  • used
Generated on Sun Oct 21 12:49:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

re_registers Member List

This is the complete list of members for re_registers, including all inherited members.
  • end
  • num_regs
  • start
Generated on Sun Oct 21 12:49:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

regmatch_t Member List

This is the complete list of members for regmatch_t, including all inherited members.
  • rm_eo
  • rm_so
Generated on Sun Oct 21 12:49:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

saved_cwd Member List

This is the complete list of members for saved_cwd, including all inherited members.
  • desc
  • name
Generated on Sun Oct 21 12:49:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

SIG_hlist Member List

This is the complete list of members for SIG_hlist, including all inherited members.
  • handler
  • next
Generated on Sun Oct 21 12:49:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

error_info Member List

This is the complete list of members for error_info, including all inherited members.
  • name
  • value
Generated on Sun Oct 21 12:47:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

utimbuf Member List

This is the complete list of members for utimbuf, including all inherited members.
  • actime
  • modtime
Generated on Sun Oct 21 12:50:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

unreaped Member List

This is the complete list of members for unreaped, including all inherited members.
  • pid
  • status
Generated on Sun Oct 21 12:50:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ASHeader Member List

This is the complete list of members for ASHeader, including all inherited members.
  • filler
  • magicNum
  • numEntries
  • versionNum
Generated on Sun Oct 21 12:45:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ASEntry Member List

This is the complete list of members for ASEntry, including all inherited members.
  • entryID
  • entryLength
  • entryOffset
Generated on Sun Oct 21 12:45:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ASFinderInfo Member List

This is the complete list of members for ASFinderInfo, including all inherited members.
  • ioFlFndrInfo
  • ioFlXFndrInfo
Generated on Sun Oct 21 12:45:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ASMacInfo Member List

This is the complete list of members for ASMacInfo, including all inherited members.
  • filler
  • ioFlAttrib
Generated on Sun Oct 21 12:45:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ASFileDates Member List

This is the complete list of members for ASFileDates, including all inherited members.
  • access
  • backup
  • create
  • modify
Generated on Sun Oct 21 12:45:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

gusilsh_ctx Member List

This is the complete list of members for gusilsh_ctx, including all inherited members.
  • doAbort
  • lsh_ctx
  • oldHandler
Generated on Sun Oct 21 12:47:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

HQXEncodeVars Member List

This is the complete list of members for HQXEncodeVars, including all inherited members.
  • fBitBuffer
  • fBitBufferBits
  • fCRC
  • fInBuffer
  • fNOutChars
  • fOutBuffer
  • fOutBufp
  • fRLECharacter
  • fRLECount
  • fSink
  • fSinkRefCon
Generated on Sun Oct 21 12:47:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

HQXDecodeVars Member List

This is the complete list of members for HQXDecodeVars, including all inherited members.
  • fBitBuffer
  • fBitBufferBits
  • fCRC
  • fInBuffer
  • fInBufMax
  • fInBufp
  • fInHqxData
  • fOutBuffer
  • fRLECharacter
  • fRLECount
  • fSource
  • fSourceRefCon
Generated on Sun Oct 21 12:47:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

passwd Member List

This is the complete list of members for passwd, including all inherited members.
  • pw_age
  • pw_comment
  • pw_dir
  • pw_dir
  • pw_dir
  • pw_gecos
  • pw_gid
  • pw_name
  • pw_name
  • pw_name
  • pw_name
  • pw_passwd
  • pw_shell
  • pw_shell
  • pw_shell
  • pw_uid
  • pw_uid
Generated on Sun Oct 21 12:48:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

dirent Member List

This is the complete list of members for dirent, including all inherited members.
  • d_ino
  • d_name
  • d_namlen
  • d_off
Generated on Sun Oct 21 12:47:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

S_Dir Member List

This is the complete list of members for S_Dir, including all inherited members.
  • cur_ent
  • dirname
  • entp
  • max_ent
  • tot_ent
Generated on Sun Oct 21 12:49:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

yytoktype Member List

This is the complete list of members for yytoktype, including all inherited members.
  • t_name
  • t_val
Generated on Sun Oct 21 12:51:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

pid_list Member List

This is the complete list of members for pid_list, including all inherited members.
  • next
  • pid
  • term_code
Generated on Sun Oct 21 12:48:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

admin_data Member List

This is the complete list of members for admin_data, including all inherited members.
  • ac
  • av
  • av_alloc
  • branch
  • comment
  • delete_revs
  • desc
  • interactive
  • kflag
  • quiet
  • set_nonstrict
  • set_strict
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

response Member List

This is the complete list of members for response, including all inherited members.
  • name
  • rs_essential enum value
  • rs_not_supported enum value
  • rs_optional enum value
  • rs_supported enum value
  • status
Generated on Sun Oct 21 12:49:36 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

commit_info Member List

This is the complete list of members for commit_info, including all inherited members.
  • options
  • rev
  • status
  • tag
Generated on Sun Oct 21 12:47:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

master_lists Member List

This is the complete list of members for master_lists, including all inherited members.
  • cilist
  • tlist
  • tlist
  • ulist
Generated on Sun Oct 21 12:48:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

entnode Member List

This is the complete list of members for entnode, including all inherited members.
  • conflict
  • date
  • options
  • tag
  • timestamp
  • type
  • user
  • version
Generated on Sun Oct 21 12:47:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

stickydirtag Member List

This is the complete list of members for stickydirtag, including all inherited members.
  • aflag
  • date
  • nonbranch
  • subdirs
  • tag
Generated on Sun Oct 21 12:49:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

file_info Member List

This is the complete list of members for file_info, including all inherited members.
  • entries
  • file
  • fullname
  • rcs
  • repository
  • update_dir
Generated on Sun Oct 21 12:47:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

vers_ts Member List

This is the complete list of members for vers_ts, including all inherited members.
  • date
  • entdata
  • nonbranch
  • options
  • srcfile
  • tag
  • ts_conflict
  • ts_rcs
  • ts_user
  • vn_rcs
  • vn_tag
  • vn_user
Generated on Sun Oct 21 12:50:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

logfile_info Member List

This is the complete list of members for logfile_info, including all inherited members.
  • rev_new
  • rev_old
  • tag
  • type
Generated on Sun Oct 21 12:48:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

unrecog Member List

This is the complete list of members for unrecog, including all inherited members.
  • line
  • next
Generated on Sun Oct 21 12:50:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

hardlink_info Member List

This is the complete list of members for hardlink_info, including all inherited members.
  • checked_out
  • status
Generated on Sun Oct 21 12:47:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

node Member List

This is the complete list of members for node, including all inherited members.
  • data
  • delproc
  • hashnext
  • hashprev
  • key
  • next
  • prev
  • type
Generated on Sun Oct 21 12:48:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

list Member List

This is the complete list of members for list, including all inherited members.
  • hasharray
  • list
  • next
Generated on Sun Oct 21 12:48:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

hrec Member List

This is the complete list of members for hrec, including all inherited members.
  • date
  • dir
  • end
  • file
  • idx
  • mod
  • repos
  • rev
  • type
  • user
Generated on Sun Oct 21 12:47:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

file_list_str Member List

This is the complete list of members for file_list_str, including all inherited members.
  • l_file
  • l_module
Generated on Sun Oct 21 12:47:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

lock Member List

This is the complete list of members for lock, including all inherited members.
  • have_lckdir
  • repository
Generated on Sun Oct 21 12:48:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

option_revlist Member List

This is the complete list of members for option_revlist, including all inherited members.
  • branchhead
  • first
  • last
  • next
Generated on Sun Oct 21 12:48:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

revlist Member List

This is the complete list of members for revlist, including all inherited members.
  • fields
  • first
  • last
  • next
Generated on Sun Oct 21 12:49:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

datelist Member List

This is the complete list of members for datelist, including all inherited members.
  • end
  • inclusive
  • next
  • start
Generated on Sun Oct 21 12:47:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

log_data Member List

This is the complete list of members for log_data, including all inherited members.
  • authorlist
  • datelist
  • default_branch
  • header
  • long_header
  • nameonly
  • notags
  • revlist
  • singledatelist
  • statelist
Generated on Sun Oct 21 12:48:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

log_data_and_rcs Member List

This is the complete list of members for log_data_and_rcs, including all inherited members.
  • log_data
  • rcs
  • revlist
Generated on Sun Oct 21 12:48:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

cmd Member List

This is the complete list of members for cmd, including all inherited members.
  • fullname
  • func
  • nick1
  • nick2
Generated on Sun Oct 21 12:47:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

admin_file Member List

This is the complete list of members for admin_file, including all inherited members.
  • contents
  • errormsg
  • filename
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

sortrec Member List

This is the complete list of members for sortrec, including all inherited members.
  • comment
  • modname
  • rest
  • status
Generated on Sun Oct 21 12:49:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

rcsbuffer Member List

This is the complete list of members for rcsbuffer, including all inherited members.
  • at_string
  • embedded_at
  • filename
  • fp
  • pos
  • ptr
  • ptrend
  • vlen
Generated on Sun Oct 21 12:49:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

linevector Member List

This is the complete list of members for linevector, including all inherited members.
  • lines_alloced
  • nlines
  • vector
Generated on Sun Oct 21 12:48:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

rcsnode Member List

This is the complete list of members for rcsnode, including all inherited members.
  • access
  • branch
  • comment
  • delta_pos
  • desc
  • expand
  • flags
  • head
  • locks
  • locks_data
  • other
  • path
  • refcount
  • strict_locks
  • symbols
  • symbols_data
  • versions
Generated on Sun Oct 21 12:49:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

deltatext Member List

This is the complete list of members for deltatext, including all inherited members.
  • len
  • log
  • other
  • text
  • version
Generated on Sun Oct 21 12:47:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

rcsversnode Member List

This is the complete list of members for rcsversnode, including all inherited members.
  • author
  • branches
  • date
  • dead
  • next
  • other
  • other_delta
  • outdated
  • state
  • text
  • version
Generated on Sun Oct 21 12:49:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

recursion_frame Member List

This is the complete list of members for recursion_frame, including all inherited members.
  • aflag
  • callerdat
  • direntproc
  • dirleaveproc
  • dosrcs
  • fileproc
  • filesdoneproc
  • flags
  • readlock
  • which
Generated on Sun Oct 21 12:49:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

frame_and_file Member List

This is the complete list of members for frame_and_file, including all inherited members.
  • finfo
  • frame
Generated on Sun Oct 21 12:47:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

frame_and_entries Member List

This is the complete list of members for frame_and_entries, including all inherited members.
  • entries
  • frame
Generated on Sun Oct 21 12:47:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

tag_info Member List

This is the complete list of members for tag_info, including all inherited members.
  • options
  • options
  • rev
  • rev
  • status
  • tag
  • tag
Generated on Sun Oct 21 12:49:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

request Member List

This is the complete list of members for request, including all inherited members.
  • flags
  • name
Generated on Sun Oct 21 12:49:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

addremove_args Member List

This is the complete list of members for addremove_args, including all inherited members.
  • add_tcommit
  • add_tedit
  • add_tunedit
  • adding
  • commit
  • edit
  • remove_temp
  • setting_default
  • unedit
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

WrapperEntry Member List

This is the complete list of members for WrapperEntry, including all inherited members.
  • fromcvsFilter
  • mergeMethod
  • rcsOption
  • tocvsFilter
  • wildCard
Generated on Sun Oct 21 12:51:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_name Member List

This is the complete list of members for _name, including all inherited members.
  • b_namecount
  • char
  • dir___b_flags
  • dir__b_flags
  • dir_b_flags
  • dir_v_nextrec
  • dir_v_prevrec
  • dir_v_type
  • t_name
  • w_verlimit
Generated on Sun Oct 21 12:45:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_version Member List

This is the complete list of members for _version, including all inherited members.
  • dir___w_fid_rvn
  • dir__w_fid_rvn
  • dir_b_fid_nmx
  • dir_b_fid_rvn
  • dir_w_fid_rvn
  • w_fid_num
  • w_fid_seq
  • w_version
Generated on Sun Oct 21 12:45:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_linkname Member List

This is the complete list of members for _linkname, including all inherited members.
  • t_linkname
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

VMS_DIR Member List

This is the complete list of members for VMS_DIR, including all inherited members.
  • context
  • dir_spec
  • file_spec
  • s_dir
  • status
  • uflags
  • version_flag
Generated on Sun Oct 21 12:50:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

direct Member List

This is the complete list of members for direct, including all inherited members.
  • d_ino
  • d_ino
  • d_name
  • d_namlen
  • d_namlen
  • d_reclen
  • d_reclen
Generated on Sun Oct 21 12:47:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

S_NAME Member List

This is the complete list of members for S_NAME, including all inherited members.
  • dd_buf
  • dd_fd
  • dd_loc
  • dd_size
Generated on Sun Oct 21 12:49:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

PIPE Member List

This is the complete list of members for PIPE, including all inherited members.
  • chan
  • file
  • has_jmpbuf
  • iosb
  • jmpbuf
  • mode
  • next
  • pid
  • prev
  • self
  • status
Generated on Sun Oct 21 12:48:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

Vstring Member List

This is the complete list of members for Vstring, including all inherited members.
  • body
  • length
Generated on Sun Oct 21 12:50:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_SUBIO Member List

This is the complete list of members for _SUBIO, including all inherited members.
  • event_flag
  • event_flag_byte
  • next
  • pid
  • prev
  • read_chan
  • read_fp
  • read_iosb
  • return_status
  • self
  • write_chan
  • write_fp
  • write_iosb
Generated on Sun Oct 21 12:45:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

IOSB Member List

This is the complete list of members for IOSB, including all inherited members.
  • count
  • devinfo
  • status
Generated on Sun Oct 21 12:48:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

list3 Member List

This is the complete list of members for list3, including all inherited members.
  • buffer
  • buflen
  • itemcode
  • retlen
Generated on Sun Oct 21 12:48:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

LOCK Member List

This is the complete list of members for LOCK, including all inherited members.
  • lockid
  • reserved
  • status
  • value
Generated on Sun Oct 21 12:48:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

EXHCB Member List

This is the complete list of members for EXHCB, including all inherited members.
  • a_link
  • a_status
  • exh
  • l_argcount
  • l_status
Generated on Sun Oct 21 12:47:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

VMStimbuf Member List

This is the complete list of members for VMStimbuf, including all inherited members.
  • actime
  • modtime
Generated on Sun Oct 21 12:50:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

fatdef Member List

This is the complete list of members for fatdef, including all inherited members.
  • b_bktsize
  • b_rattrib
  • b_rtype
  • b_vfcsize
  • fill
  • l_efblk
  • l_hiblk
  • r_efblk_fields
  • r_efblk_overlay
  • r_hiblk_fields
  • r_hiblk_overlay
  • r_rattrib_bits
  • r_rattrib_overlay
  • r_rtype_bits
  • r_rtype_overlay
  • v_fileorg
  • v_fortrancc
  • v_impliedcc
  • v_nospan
  • v_printcc
  • v_rtype
  • w_defext
  • w_efblkh
  • w_efblkl
  • w_ffbyte
  • w_gbc
  • w_hiblkh
  • w_hiblkl
  • w_maxrec
  • w_rsize
  • w_versions
Generated on Sun Oct 21 12:47:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

fchdef Member List

This is the complete list of members for fchdef, including all inherited members.
  • __pad0__
  • __pad1__
  • v_badacl
  • v_badblock
  • v_contig
  • v_contigb
  • v_directory
  • v_erase
  • v_locked
  • v_markdel
  • v_nobackup
  • v_nocharge
  • v_readcheck
  • v_spool
  • v_writcheck
  • v_writeback
Generated on Sun Oct 21 12:47:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

fjndef Member List

This is the complete list of members for fjndef, including all inherited members.
  • v_aijnl
  • v_atjnl
  • v_bijnl
  • v_journal_file
  • v_never_ru
  • v_only_ru
  • v_rujnl
Generated on Sun Oct 21 12:47:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

wnt_stat Member List

This is the complete list of members for wnt_stat, including all inherited members.
  • st_atime
  • st_ctime
  • st_dev
  • st_gid
  • st_ino
  • st_mode
  • st_mtime
  • st_nlink
  • st_rdev
  • st_size
  • st_uid
Generated on Sun Oct 21 12:51:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_dircontents Member List

This is the complete list of members for _dircontents, including all inherited members.
  • _d_entry
  • _d_entry
  • _d_next
  • _d_next
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_dirdesc Member List

This is the complete list of members for _dirdesc, including all inherited members.
  • dd_contents
  • dd_contents
  • dd_cp
  • dd_cp
  • dd_id
  • dd_loc
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

context Member List

This is the complete list of members for context, including all inherited members.
  • debuglog
  • local
  • outproc
  • root
Generated on Sun Oct 21 12:47:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

err_strs Member List

This is the complete list of members for err_strs, including all inherited members.
  • first
  • last
  • strs
Generated on Sun Oct 21 12:47:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

config_s Member List

This is the complete list of members for config_s, including all inherited members.
  • func
  • good_length
  • max_chain
  • max_lazy
  • nice_length
Generated on Sun Oct 21 12:47:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

static_tree_desc_s Member List

This is the complete list of members for static_tree_desc_s, including all inherited members.
  • dummy
  • elems
  • extra_base
  • extra_bits
  • max_length
  • static_tree
Generated on Sun Oct 21 12:49:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ct_data_s Member List

This is the complete list of members for ct_data_s, including all inherited members.
  • code
  • dad
  • dl
  • fc
  • freq
  • len
Generated on Sun Oct 21 12:47:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

tree_desc_s Member List

This is the complete list of members for tree_desc_s, including all inherited members.
  • dyn_tree
  • max_code
  • stat_desc
Generated on Sun Oct 21 12:50:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

internal_state Member List

This is the complete list of members for internal_state, including all inherited members.
  • BAD enum value
  • bi_buf
  • bi_valid
  • bl_count
  • bl_desc
  • bl_tree
  • block_start
  • BLOCKS enum value
  • blocks
  • check
  • CHECK1 enum value
  • CHECK2 enum value
  • CHECK3 enum value
  • CHECK4 enum value
  • compressed_len
  • d_buf
  • d_desc
  • data_type
  • depth
  • DICT0 enum value
  • DICT1 enum value
  • DICT2 enum value
  • DICT3 enum value
  • DICT4 enum value
  • DONE enum value
  • dummy
  • dyn_dtree
  • dyn_ltree
  • FLAG enum value
  • good_match
  • hash_bits
  • hash_mask
  • hash_shift
  • hash_size
  • head
  • heap
  • heap_len
  • heap_max
  • ins_h
  • l_buf
  • l_desc
  • last_eob_len
  • last_flush
  • last_lit
  • level
  • lit_bufsize
  • lookahead
  • marker
  • match_available
  • match_length
  • match_start
  • matches
  • max_chain_length
  • max_lazy_match
  • method
  • method
  • METHOD enum value
  • mode
  • need
  • nice_match
  • noheader
  • nowrap
  • opt_len
  • pending
  • pending_buf
  • pending_out
  • prev
  • prev_length
  • prev_match
  • static_len
  • status
  • strategy
  • strm
  • strstart
  • sub
  • w_bits
  • w_mask
  • w_size
  • was
  • wbits
  • window
  • window_size
Generated on Sun Oct 21 12:48:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

gz_stream Member List

This is the complete list of members for gz_stream, including all inherited members.
  • crc
  • file
  • inbuf
  • mode
  • msg
  • outbuf
  • path
  • stream
  • transparent
  • z_eof
  • z_err
Generated on Sun Oct 21 12:47:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

inflate_codes_state Member List

This is the complete list of members for inflate_codes_state, including all inherited members.
  • BADCODE enum value
  • code
  • COPY enum value
  • copy
  • dbits
  • dist
  • DIST enum value
  • DISTEXT enum value
  • dtree
  • dummy
  • END enum value
  • get
  • lbits
  • len
  • LEN enum value
  • LENEXT enum value
  • LIT enum value
  • lit
  • ltree
  • mode
  • need
  • START enum value
  • sub
  • tree
  • WASH enum value
Generated on Sun Oct 21 12:48:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

inflate_blocks_state Member List

This is the complete list of members for inflate_blocks_state, including all inherited members.
  • bb
  • bitb
  • bitk
  • blens
  • check
  • checkfn
  • codes
  • decode
  • dummy
  • end
  • index
  • last
  • left
  • mode
  • read
  • sub
  • table
  • tb
  • td
  • tl
  • trees
  • window
  • write
Generated on Sun Oct 21 12:48:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

inflate_huft_s Member List

This is the complete list of members for inflate_huft_s, including all inherited members.
  • Base
  • Bits
  • Exop
  • more
  • Next
  • pad
  • what
  • word
Generated on Sun Oct 21 12:48:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

z_stream_s Member List

This is the complete list of members for z_stream_s, including all inherited members.
  • adler
  • avail_in
  • avail_out
  • data_type
  • msg
  • next_in
  • next_out
  • opaque
  • reserved
  • state
  • total_in
  • total_out
  • zalloc
  • zfree
Generated on Sun Oct 21 12:51:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CLogStr Member List

This is the complete list of members for CLogStr, including all inherited members.
  • c_str() const [inline]
  • CLogStr() [inline]
  • CLogStr(const char *newstr) [inline]
  • CLogStr(const CLogStr &newstr) [inline]
  • empty(void) const [inline]
  • endsWith(char c) const [inline]
  • flush(void) [protected]
  • length(void) const [inline]
  • operator const char *() const [inline]
  • operator<(const char *newstr) const
  • operator<<(const char *addToStr)
  • operator<<(char addToStr)
  • operator<<(int addToStr)
  • operator=(const char *newstr)
  • operator=(const CLogStr &newstr)
  • replace(char which, char bywhich)
  • set(const char *buf, unsigned int len)
  • str [protected]
  • ~CLogStr() [inline, virtual]
Generated on Sun Oct 21 12:48:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CRevNumber Member List

This is the complete list of members for CRevNumber, including all inherited members.
  • allDigits [protected]
  • c_str(void) const
  • cmp(const CRevNumber &arev) const
  • CRevNumber() [inline]
  • IntList(void) const [inline]
  • IntList(void) [inline]
  • ischildof(const CRevNumber &arev) const
  • ispartof(const CRevNumber &arev) const
  • issamebranch(const CRevNumber &arev) const
  • issubbranchof(const CRevNumber &arev) const
  • operator+=(int adigit)
  • operator<(const CRevNumber &arev) const
  • operator=(const CRevNumber &arev)
  • operator==(const CRevNumber &arev) const
  • operator[](int index) const
  • reset(void)
  • size() const [inline]
  • Tag(void) const [inline]
  • Tag(void) [inline]
  • tagName [protected]
  • ~CRevNumber() [inline, virtual]
Generated on Sun Oct 21 12:49:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CRevFile Member List

This is the complete list of members for CRevFile, including all inherited members.
  • Author(void) const [inline]
  • Author(void) [inline]
  • author [protected]
  • branchesList [protected]
  • BranchesList(void) const [inline]
  • BranchesList(void) [inline]
  • ChgNeg(void) const [inline]
  • ChgNeg(void) [inline]
  • chgNeg [protected]
  • chgPos [protected]
  • ChgPos(void) const [inline]
  • ChgPos(void) [inline]
  • CRevFile()
  • CRevFile(const CRevFile &afile)
  • DescLog(void) const [inline]
  • DescLog(void) [inline]
  • descLog [protected]
  • LastBranche(void) [inline]
  • Locker(void) const [inline]
  • Locker(void) [inline]
  • locker [protected]
  • operator<(const CRevFile &afile) const
  • operator=(const CRevFile &afile)
  • operator==(const CRevFile &afile) const
  • print(ostream &out) const
  • revNum [protected]
  • RevNum(void) const [inline]
  • RevNum(void) [inline]
  • revTime [protected]
  • RevTime(void) const [inline]
  • RevTime(void) [inline]
  • State(void) const [inline]
  • State(void) [inline]
  • state [protected]
  • ~CRevFile() [virtual]
Generated on Sun Oct 21 12:49:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CRcsFile Member List

This is the complete list of members for CRcsFile, including all inherited members.
  • AccessList(void) const [inline]
  • AccessList(void) [inline]
  • accessList [protected]
  • allRevs [protected]
  • AllRevs(void) const [inline]
  • AllRevs(void) [inline]
  • BranchRev(void) const [inline]
  • BranchRev(void) [inline]
  • branchRev [protected]
  • CRcsFile()
  • CRcsFile(const CRcsFile &afile)
  • DescLog(void) const [inline]
  • DescLog(void) [inline]
  • descLog [protected]
  • HeadRev(void) const [inline]
  • HeadRev(void) [inline]
  • headRev [protected]
  • KeywordSubst(void) const [inline]
  • KeywordSubst(void) [inline]
  • keywordSubst [protected]
  • LastAccess(void) [inline]
  • LastLock(void) [inline]
  • LastRev(void) [inline]
  • LastSymbName(void) [inline]
  • LocksList(void) const [inline]
  • LocksList(void) [inline]
  • locksList [protected]
  • LockStrict(void) const [inline]
  • LockStrict(void) [inline]
  • lockStrict [protected]
  • operator<(const CRcsFile &afile) const
  • operator=(const CRcsFile &afile)
  • operator==(const CRcsFile &afile) const
  • print(ostream &out) const
  • RcsFile(void) const [inline]
  • RcsFile(void) [inline]
  • rcsFile [protected]
  • selRevisions [protected]
  • SelRevisions(void) const [inline]
  • SelRevisions(void) [inline]
  • sort(void)
  • SymbolicList(void) const [inline]
  • SymbolicList(void) [inline]
  • symbolicList [protected]
  • TotRevisions(void) const [inline]
  • TotRevisions(void) [inline]
  • totRevisions [protected]
  • WorkingFile(void) const [inline]
  • WorkingFile(void) [inline]
  • workingFile [protected]
  • ~CRcsFile() [virtual]
Generated on Sun Oct 21 12:49:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CLogNodeData Member List

This is the complete list of members for CLogNodeData, including all inherited members.
  • CLogNodeData(CLogNode *node) [inline]
  • fNode [protected]
  • Node(void) [inline]
  • ~CLogNodeData() [inline, virtual]
Generated on Sun Oct 21 12:48:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CLogNode Member List

This is the complete list of members for CLogNode, including all inherited members.
  • Childs(void) const [inline]
  • Childs(void) [inline]
  • childs [protected]
  • CLogNode(CLogNode *root=0L)
  • GetType(void) const=0 [pure virtual]
  • GetUserData(void) [inline]
  • Next(void) const [inline]
  • Next(void) [inline]
  • next [protected]
  • root [protected]
  • Root(void) const [inline]
  • Root(void) [inline]
  • SetUserData(CLogNodeData *data) [inline]
  • user [protected]
  • ~CLogNode() [virtual]
Generated on Sun Oct 21 12:48:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CLogNodeHeader Member List

This is the complete list of members for CLogNodeHeader, including all inherited members.
  • Childs(void) const [inline]
  • Childs(void) [inline]
  • childs [protected]
  • CLogNode(CLogNode *root=0L)
  • CLogNodeHeader(const CRcsFile &h, CLogNode *r=0L) [inline]
  • GetType(void) const [inline, virtual]
  • GetUserData(void) [inline]
  • header [protected]
  • Next(void) const [inline]
  • Next(void) [inline]
  • next [protected]
  • operator *() const [inline]
  • operator *() [inline]
  • Root(void) const [inline]
  • Root(void) [inline]
  • root [protected]
  • SetUserData(CLogNodeData *data) [inline]
  • user [protected]
  • ~CLogNode() [virtual]
Generated on Sun Oct 21 12:48:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CLogNodeRev Member List

This is the complete list of members for CLogNodeRev, including all inherited members.
  • Childs(void) const [inline]
  • Childs(void) [inline]
  • childs [protected]
  • CLogNode(CLogNode *root=0L)
  • CLogNodeRev(const CRevFile &r, CLogNode *root=0L) [inline]
  • GetType(void) const [inline, virtual]
  • GetUserData(void) [inline]
  • Next(void) const [inline]
  • Next(void) [inline]
  • next [protected]
  • operator *() const [inline]
  • operator *() [inline]
  • rev [protected]
  • Root(void) const [inline]
  • Root(void) [inline]
  • root [protected]
  • SetUserData(CLogNodeData *data) [inline]
  • user [protected]
  • ~CLogNode() [virtual]
Generated on Sun Oct 21 12:48:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CLogNodeTag Member List

This is the complete list of members for CLogNodeTag, including all inherited members.
  • Childs(void) const [inline]
  • Childs(void) [inline]
  • childs [protected]
  • CLogNode(CLogNode *root=0L)
  • CLogNodeTag(const CLogStr &t, CLogNode *r=0L) [inline]
  • GetType(void) const [inline, virtual]
  • GetUserData(void) [inline]
  • Next(void) const [inline]
  • Next(void) [inline]
  • next [protected]
  • operator *() const [inline]
  • operator *() [inline]
  • Root(void) const [inline]
  • Root(void) [inline]
  • root [protected]
  • SetUserData(CLogNodeData *data) [inline]
  • tag [protected]
  • user [protected]
  • ~CLogNode() [virtual]
Generated on Sun Oct 21 12:48:30 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CLogNodeBranch Member List

This is the complete list of members for CLogNodeBranch, including all inherited members.
  • branch [protected]
  • Childs(void) const [inline]
  • Childs(void) [inline]
  • childs [protected]
  • CLogNode(CLogNode *root=0L)
  • CLogNodeBranch(const CLogStr &b, CLogNode *r=0L) [inline]
  • GetType(void) const [inline, virtual]
  • GetUserData(void) [inline]
  • Next(void) const [inline]
  • Next(void) [inline]
  • next [protected]
  • operator *() const [inline]
  • operator *() [inline]
  • root [protected]
  • Root(void) const [inline]
  • Root(void) [inline]
  • SetUserData(CLogNodeData *data) [inline]
  • user [protected]
  • ~CLogNode() [virtual]
Generated on Sun Oct 21 12:48:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

yy_buffer_state Member List

This is the complete list of members for yy_buffer_state, including all inherited members.
  • yy_at_bol
  • yy_buf_pos
  • yy_buf_size
  • yy_buffer_status
  • yy_ch_buf
  • yy_fill_buffer
  • yy_input_file
  • yy_is_interactive
  • yy_is_our_buffer
  • yy_n_chars
Generated on Sun Oct 21 12:51:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CDummyClass Member List

This is the complete list of members for CDummyClass, including all inherited members.
  • CDummyClass() [inline]
  • CDummyClass() [inline]
Generated on Sun Oct 21 12:47:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CViewInfo Member List

This is the complete list of members for CViewInfo, including all inherited members.
  • view
Generated on Sun Oct 21 12:50:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TBuggyPopup Member List

This is the complete list of members for TBuggyPopup, including all inherited members.
  • DoPostCreate(TDocument *itsDocument) [private, virtual]
  • fRealWidth [protected]
  • MA_DECLARE_CLASS [private]
  • ReadFields(CStream_AC *aStream) [private, virtual]
  • TBuggyPopup() [private]
  • WriteFields(CStream_AC *aStream) const [private, virtual]
  • ~TBuggyPopup() [private, virtual]
Generated on Sun Oct 21 12:49:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TPseudoScrollBar Member List

This is the complete list of members for TPseudoScrollBar, including all inherited members.
  • fButtonStep [private]
  • fPageStep [private]
  • MA_DECLARE_CLASS [private]
  • TPseudoScrollBar() [private]
  • TrackScrollBar(short partCode) [private, virtual]
  • ~TPseudoScrollBar() [private, virtual]
Generated on Sun Oct 21 12:50:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TPseudoIconPopup Member List

This is the complete list of members for TPseudoIconPopup, including all inherited members.
  • MA_DECLARE_CLASS [private]
  • ReadFields(CStream_AC *aStream) [private, virtual]
  • TPseudoIconPopup() [private]
  • WriteFields(CStream_AC *aStream) const [private, virtual]
  • ~TPseudoIconPopup() [private, virtual]
Generated on Sun Oct 21 12:50:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TPseudoIconButton Member List

This is the complete list of members for TPseudoIconButton, including all inherited members.
  • MA_DECLARE_CLASS [private]
  • ReadFields(CStream_AC *aStream) [private, virtual]
  • TPseudoIconButton() [private]
  • WriteFields(CStream_AC *aStream) const [private, virtual]
  • ~TPseudoIconButton() [private, virtual]
Generated on Sun Oct 21 12:50:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TPseudoRotateIconButton Member List

This is the complete list of members for TPseudoRotateIconButton, including all inherited members.
  • DoRotate(int icon) [private]
  • fCurrentIcon [protected]
  • fIconSuite [protected]
  • MA_DECLARE_CLASS [private]
  • ReadFields(CStream_AC *aStream) [private, virtual]
  • TPseudoRotateIconButton() [private]
  • WriteFields(CStream_AC *aStream) const [private, virtual]
  • ~TPseudoRotateIconButton() [private, virtual]
Generated on Sun Oct 21 12:50:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TPseudoIconCheckBox Member List

This is the complete list of members for TPseudoIconCheckBox, including all inherited members.
  • MA_DECLARE_CLASS [private]
  • ReadFields(CStream_AC *aStream) [private, virtual]
  • TPseudoIconCheckBox() [private]
  • WriteFields(CStream_AC *aStream) const [private, virtual]
  • ~TPseudoIconCheckBox() [private, virtual]
Generated on Sun Oct 21 12:50:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UMacAppMenu Member List

This is the complete list of members for UMacAppMenu, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCommands(int cmd) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void)
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sMAMenuWidID [static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UMacAppMenu()
  • UMenu(int widid)
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UMacAppMenu() [virtual]
  • ~UMenu() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:48:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TPseudoAppBehavior Member List

This is the complete list of members for TPseudoAppBehavior, including all inherited members.
  • DoIdle(IdlePhase phase) [virtual]
  • DoMenuCommand(CommandNumber aCommandNumber) [virtual]
  • DoSetupMenus() [virtual]
  • DoToolboxEvent(TToolboxEvent *event) [virtual]
  • MA_DECLARE_CLASS [private]
  • TPseudoAppBehavior()
  • ~TPseudoAppBehavior() [virtual]
Generated on Sun Oct 21 12:50:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TPseudoWinBehavior Member List

This is the complete list of members for TPseudoWinBehavior, including all inherited members.
  • DoEvent(EventNumber eventNumber, TEventHandler *source, TEvent *event) [virtual]
  • fWidID [protected]
  • GetWidID() const [inline]
  • kPseudoWinBehavior enum value
  • MA_DECLARE_CLASS [private]
  • SetPseudoWidget(int widid) [inline, protected]
  • TPseudoWinBehavior()
  • UWidget class [friend]
  • ~TPseudoWinBehavior() [virtual]
Generated on Sun Oct 21 12:50:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TPseudoWinAdorner Member List

This is the complete list of members for TPseudoWinAdorner, including all inherited members.
  • fWidID [protected]
  • kPseudoWinAdorner enum value
  • MA_DECLARE_CLASS [private]
  • SetPseudoWidget(int widid) [inline, protected]
  • TPseudoWinAdorner()
  • UWidget class [friend]
  • ViewChangedFrame(TView *itsView, const CViewRect &oldFrame, const CViewRect &newFrame, bool invalidate) [virtual]
  • ~TPseudoWinAdorner() [virtual]
Generated on Sun Oct 21 12:50:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TPseudoCustomView Member List

This is the complete list of members for TPseudoCustomView, including all inherited members.
  • Draw(const CViewRect &area) [virtual]
  • MA_DECLARE_CLASS [private]
  • TPseudoCustomView()
  • ~TPseudoCustomView() [virtual]
Generated on Sun Oct 21 12:50:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TPseudoTextListView Member List

This is the complete list of members for TPseudoTextListView, including all inherited members.
  • DelItemAt(GridCoordinate anItem, GridCoordinate numOfItems) [virtual]
  • DoKeyEvent(TToolboxEvent *event) [virtual]
  • DoMouseCommand(CViewPoint &theMouse, TToolboxEvent *event, CPoint_AC) [virtual]
  • DoMouseCommand_SelectCells(GridCell whichCell, class TToolboxEvent *event) [protected, virtual]
  • fStringContainer [protected]
  • GetItemText(GridCoordinate) const [virtual]
  • GetStandardSignature(void) const [virtual]
  • InsStringBefore(short anItem, const char *string) [virtual]
  • InsStringFirst(const char *string) [virtual]
  • InsStringLast(const char *string) [virtual]
  • kMultiClickSelection enum value
  • kSelectionChanged enum value
  • kTextStringListViewSignature enum value
  • MA_DECLARE_CLASS [private]
  • RemoveAll(void) [virtual]
  • SetSelection(const TGridViewDesignator *cellsToSelect, bool extendSelection, bool highlight, bool select) [virtual]
  • TPseudoTextListView()
  • ~TPseudoTextListView() [virtual]
Generated on Sun Oct 21 12:50:23 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TPseudoDoubleNumberText Member List

This is the complete list of members for TPseudoDoubleNumberText, including all inherited members.
  • fMaximum [protected]
  • fMinimum [protected]
  • fPrecision [protected]
  • GetStandardSignature() const [virtual]
  • GetValidationError() [virtual]
  • GetValue() [virtual]
  • kDefaultPrecision enum value
  • kStdDoubleNumberText enum value
  • MA_DECLARE_CLASS [private]
  • ReadFields(CStream_AC *aStream) [virtual]
  • SetValue(double newValue, bool redraw) [virtual]
  • TPseudoDoubleNumberText()
  • WriteFields(CStream_AC *aStream) const [virtual]
  • ~TPseudoDoubleNumberText() [virtual]
Generated on Sun Oct 21 12:50:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPseudoButton Member List

This is the complete list of members for CPseudoButton, including all inherited members.
  • CCJFlatButton()
  • CPseudoButton()
  • DisableFlatLook(BOOL bDisable=FALSE) [virtual]
  • DrawButtonBitmap(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonIcon(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonText(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • loadIcon(CString &icon, int rsrcid) [static]
  • LoadXPM(int rsrcid) [virtual]
  • m_bAltColor [protected]
  • m_bFlatLook [protected]
  • m_bitmap [protected]
  • m_bLBtnDown [protected]
  • m_bMouseOver [protected]
  • m_bPainted [protected]
  • m_clrAltHilite [protected]
  • m_clrAltNormal [protected]
  • m_clrAltShadow [protected]
  • m_clrAltTextNm [protected]
  • m_clrDkShad [protected]
  • m_clrHilite [protected]
  • m_clrNormal [protected]
  • m_clrShadow [protected]
  • m_clrTextGy [protected]
  • m_clrTextNm [protected]
  • m_disbitmap [protected]
  • m_Font [protected]
  • m_hCursor [protected]
  • m_hPushed [protected]
  • m_pFont [protected]
  • m_sizeIcon [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnLButtonDblClk(UINT nFlags, CPoint point) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnSysColorChange() [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • SetAlternateColors(COLORREF clrAltNormal, COLORREF clrAltHilite, COLORREF clrAltShadow, COLORREF clrAltTextNm) [virtual]
  • SetButtonFont(CFont *pFont) [virtual]
  • SetIcon(HICON hIcon, CSize size) [virtual]
  • SetIcon(HICON hIcon, HICON hPushed, CSize size) [virtual]
  • UpdateFont() [protected, virtual]
  • ~CCJFlatButton() [virtual]
  • ~CPseudoButton() [virtual]
Generated on Sun Oct 21 12:49:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPseudoRotButton Member List

This is the complete list of members for CPseudoRotButton, including all inherited members.
  • CCJFlatButton()
  • CPseudoButton()
  • CPseudoRotButton()
  • DisableFlatLook(BOOL bDisable=FALSE) [virtual]
  • DoRotate(int index) [virtual]
  • DrawButtonBitmap(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonIcon(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonText(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • GetCurrent(void) const [inline]
  • loadIcon(CString &icon, int rsrcid) [static]
  • LoadXPM(int rsrcid) [virtual]
  • LoadXPMs(const int *rsrcid, int numrsrc) [virtual]
  • m_bAltColor [protected]
  • m_bFlatLook [protected]
  • m_bitmap [protected]
  • m_bitmaps [protected]
  • m_bLBtnDown [protected]
  • m_bMouseOver [protected]
  • m_bPainted [protected]
  • m_clrAltHilite [protected]
  • m_clrAltNormal [protected]
  • m_clrAltShadow [protected]
  • m_clrAltTextNm [protected]
  • m_clrDkShad [protected]
  • m_clrHilite [protected]
  • m_clrNormal [protected]
  • m_clrShadow [protected]
  • m_clrTextGy [protected]
  • m_clrTextNm [protected]
  • m_curindex [protected]
  • m_disbitmap [protected]
  • m_disbitmaps [protected]
  • m_Font [protected]
  • m_hCursor [protected]
  • m_hPushed [protected]
  • m_pFont [protected]
  • m_sizeIcon [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnLButtonDblClk(UINT nFlags, CPoint point) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnSysColorChange() [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • SetAlternateColors(COLORREF clrAltNormal, COLORREF clrAltHilite, COLORREF clrAltShadow, COLORREF clrAltTextNm) [virtual]
  • SetButtonFont(CFont *pFont) [virtual]
  • SetIcon(HICON hIcon, CSize size) [virtual]
  • SetIcon(HICON hIcon, HICON hPushed, CSize size) [virtual]
  • UpdateFont() [protected, virtual]
  • ~CCJFlatButton() [virtual]
  • ~CPseudoButton() [virtual]
  • ~CPseudoRotButton() [virtual]
Generated on Sun Oct 21 12:49:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPseudoToggle Member List

This is the complete list of members for CPseudoToggle, including all inherited members.
  • CCJFlatButton()
  • CPseudoButton()
  • CPseudoToggle()
  • DisableFlatLook(BOOL bDisable=FALSE) [virtual]
  • DrawButtonBitmap(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonIcon(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonText(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • GetGroup(void) const [inline]
  • GetState(void) const [inline]
  • IsRadio(void) const [inline]
  • loadIcon(CString &icon, int rsrcid) [static]
  • LoadXPM(int rsrcid) [virtual]
  • m_bAltColor [protected]
  • m_bFlatLook [protected]
  • m_bitmap [protected]
  • m_bLBtnDown [protected]
  • m_bMouseOver [protected]
  • m_bPainted [protected]
  • m_clrAltHilite [protected]
  • m_clrAltNormal [protected]
  • m_clrAltShadow [protected]
  • m_clrAltTextNm [protected]
  • m_clrDkShad [protected]
  • m_clrHilite [protected]
  • m_clrNormal [protected]
  • m_clrShadow [protected]
  • m_clrTextGy [protected]
  • m_clrTextNm [protected]
  • m_disbitmap [protected]
  • m_flag [protected]
  • m_Font [protected]
  • m_group [protected]
  • m_hCursor [protected]
  • m_hPushed [protected]
  • m_pFont [protected]
  • m_radio [protected]
  • m_sizeIcon [protected]
  • OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
  • OnLButtonDblClk(UINT nFlags, CPoint point) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point)
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnSysColorChange() [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • SetAlternateColors(COLORREF clrAltNormal, COLORREF clrAltHilite, COLORREF clrAltShadow, COLORREF clrAltTextNm) [virtual]
  • SetButtonFont(CFont *pFont) [virtual]
  • SetGroup(const char *group) [inline]
  • SetIcon(HICON hIcon, CSize size) [virtual]
  • SetIcon(HICON hIcon, HICON hPushed, CSize size) [virtual]
  • SetRadio(bool state) [inline]
  • SetState(int state) [virtual]
  • ToggleBtn() [inline]
  • UpdateFont() [protected, virtual]
  • ~CCJFlatButton() [virtual]
  • ~CPseudoButton() [virtual]
  • ~CPseudoToggle()
Generated on Sun Oct 21 12:49:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPseudoDlg Member List

This is the complete list of members for CPseudoDlg, including all inherited members.
  • CPseudoDlg(int dlgid, UWidget *pseudo, CWnd *pParent=NULL)
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • m_pseudo [protected]
  • OnInitDialog() [protected, virtual]
  • WindowProc(UINT message, WPARAM wParam, LPARAM lParam) [protected, virtual]
  • ~CPseudoDlg() [virtual]
Generated on Sun Oct 21 12:49:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPseudoDraw Member List

This is the complete list of members for CPseudoDraw, including all inherited members.
  • CPseudoDraw(UWidget *pseudo, int cmdid)
  • m_cmdid
  • m_pseudo
  • OnPaint() [protected]
  • ~CPseudoDraw() [virtual]
Generated on Sun Oct 21 12:49:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPseudoList Member List

This is the complete list of members for CPseudoList, including all inherited members.
  • CPseudoList(int wid, int cmd)
  • m_cmd [protected]
  • m_wid [protected]
  • OnLButtonDblClk(UINT nFlags, CPoint point) [protected]
  • ~CPseudoList() [virtual]
Generated on Sun Oct 21 12:49:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UPPMenu Member List

This is the complete list of members for UPPMenu, including all inherited members.
  • _GetBaseClass() [static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCommands(int cmd) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sPPMenuWidID [static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UMenu(int widid)
  • UObject() [inline, protected]
  • UPPMenu()
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UMenu() [virtual]
  • ~UObject() [inline, virtual]
  • ~UPPMenu() [virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:49:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

LPseudoDrawAttachment Member List

This is the complete list of members for LPseudoDrawAttachment, including all inherited members.
  • ExecuteSelf(MessageT inMessage, void *ioParam) [protected, virtual]
  • LPseudoDrawAttachment(int widid, int cmdid)
  • m_cmdid [protected]
  • m_widid [protected]
  • ~LPseudoDrawAttachment() [virtual]
Generated on Sun Oct 21 12:48:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UPseudoCmdStatusWrapper Member List

This is the complete list of members for UPseudoCmdStatusWrapper, including all inherited members.
  • outEnabled
  • outMark
  • outName
  • outUsesMark
Generated on Sun Oct 21 12:49:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UPseudoRotButton Member List

This is the complete list of members for UPseudoRotButton, including all inherited members.
  • class_ID enum value
  • DoRotate(int icon, bool refresh=true) [virtual]
  • fCurrentIcon [protected]
  • fIconSuite [protected]
  • GetCurrentState(void) const [inline]
  • ReadIconsID(LStream *inStream, std::vector< short > &res) [protected]
  • UPseudoRotButton(LStream *inStream, ClassIDT inImpID=LBevelButton::imp_class_ID)
  • ~UPseudoRotButton() [virtual]
Generated on Sun Oct 21 12:49:11 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UPseudoPlaceHolder Member List

This is the complete list of members for UPseudoPlaceHolder, including all inherited members.
  • class_ID enum value
  • DoRotate(int entry)
  • fController [protected]
  • fCurrentView [protected]
  • FinishCreateSelf() [protected, virtual]
  • fViewSuite [protected]
  • fWidid [protected]
  • GetCurrentView(void) [inline]
  • ListenToMessage(MessageT inMessage, void *ioParam) [virtual]
  • SetWidID(int widid) [inline]
  • UPseudoPlaceHolder(LStream *inStream)
  • ~UPseudoPlaceHolder() [virtual]
Generated on Sun Oct 21 12:49:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UPseudoPageHider Member List

This is the complete list of members for UPseudoPageHider, including all inherited members.
  • class_ID enum value
  • DoRotate(int entry) [protected]
  • ExecuteSelf(MessageT inMessage, void *ioParam) [protected, virtual]
  • fCurSel [protected]
  • fPageCtrl [protected]
  • fViewSuite [protected]
  • fWidid [protected]
  • ListenToMessage(MessageT inMessage, void *ioParam) [virtual]
  • SetWidID(int widid) [inline]
  • UPseudoPageHider(LStream *inStream)
  • ~UPseudoPageHider() [virtual]
Generated on Sun Oct 21 12:49:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

LMainPseudoAttachment Member List

This is the complete list of members for LMainPseudoAttachment, including all inherited members.
  • ExecuteSelf(MessageT inMessage, void *ioParam) [protected, virtual]
  • LMainPseudoAttachment()
  • SpendTime(const EventRecord &inMacEvent) [virtual]
  • ~LMainPseudoAttachment() [virtual]
Generated on Sun Oct 21 12:48:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

LPseudoWinAttachment Member List

This is the complete list of members for LPseudoWinAttachment, including all inherited members.
  • CheckWindowSize(void)
  • ExecuteSelf(MessageT inMessage, void *ioParam) [protected, virtual]
  • GetPageValue(int cmdid) const
  • InvalidCache(UWidget *tab_wid)
  • ListenToMessage(MessageT inMessage, void *ioParam) [protected, virtual]
  • LPseudoWinAttachment(int widid)
  • m_CacheWidgets [protected]
  • m_lastRect [protected]
  • m_PageValues [protected]
  • m_widid [protected]
  • SearchWidID(LPane *pane)
  • SetPageValue(int cmdid, int value)
  • ~LPseudoWinAttachment() [virtual]
Generated on Sun Oct 21 12:48:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UPseudoFakePane Member List

This is the complete list of members for UPseudoFakePane, including all inherited members.
  • ActivateSelf() [protected, virtual]
  • AdaptToSuperFrameSize(SInt32 inSurrWidthDelta, SInt32 inSurrHeightDelta, Boolean inRefresh) [virtual]
  • DeactivateSelf() [protected, virtual]
  • m_Attach [protected]
  • UPseudoFakePane(const SPaneInfo &inPaneInfo, LPseudoWinAttachment *inAttach)
  • ~UPseudoFakePane() [virtual]
Generated on Sun Oct 21 12:49:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CPseudoItem Member List

This is the complete list of members for CPseudoItem, including all inherited members.
  • CPseudoItem(int widid, int cmdid)
  • CPseudoItem() [private]
  • CPseudoItem(const CPseudoItem &inOriginal) [private]
  • DoubleClick(const STableCell &inCell, const SMouseDownEvent &inMouseDown, const SOutlineDrawContents &inDrawContents, Boolean inHitText) [protected, virtual]
  • DrawCell(const STableCell &inCell, const Rect &inLocalCellRect) [protected, virtual]
  • DrawRowAdornments(const Rect &inLocalRowRect) [protected, virtual]
  • GetDrawContentsSelf(const STableCell &inCell, SOutlineDrawContents &ioDrawContents) [protected, virtual]
  • m_cmdid [protected]
  • m_data
  • m_texts
  • m_widid [protected]
  • operator=(const CPseudoItem &inOriginal) [private]
  • SingleClick(const STableCell &inCell, const SMouseDownEvent &inMouseDown, const SOutlineDrawContents &inDrawContents, Boolean inHitText) [protected, virtual]
  • ~CPseudoItem() [virtual]
Generated on Sun Oct 21 12:49:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

USize Member List

This is the complete list of members for USize, including all inherited members.
  • cx
  • cy
  • operator!=(USIZE size) const [inline]
  • operator+(USIZE size) const [inline]
  • operator+(UPOINT point) const [inline]
  • operator+(const URECT *lpRect) const [inline]
  • operator+=(USIZE size) [inline]
  • operator-(USIZE size) const [inline]
  • operator-() const [inline]
  • operator-(UPOINT point) const [inline]
  • operator-(const URECT *lpRect) const [inline]
  • operator-=(USIZE size) [inline]
  • operator==(USIZE size) const [inline]
  • USize() [inline]
  • USize(int initCX, int initCY) [inline]
  • USize(USIZE initSize) [inline]
  • USize(UPOINT initPt) [inline]
Generated on Sun Oct 21 12:49:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UPoint Member List

This is the complete list of members for UPoint, including all inherited members.
  • Offset(int xOffset, int yOffset) [inline]
  • Offset(UPOINT point) [inline]
  • Offset(USIZE size) [inline]
  • operator!=(UPOINT point) const [inline]
  • operator+(USIZE size) const [inline]
  • operator+(UPOINT point) const [inline]
  • operator+(const URECT *lpRect) const [inline]
  • operator+=(USIZE size) [inline]
  • operator+=(UPOINT point) [inline]
  • operator-(USIZE size) const [inline]
  • operator-() const [inline]
  • operator-(UPOINT point) const [inline]
  • operator-(const URECT *lpRect) const [inline]
  • operator-=(USIZE size) [inline]
  • operator-=(UPOINT point) [inline]
  • operator==(UPOINT point) const [inline]
  • UPoint() [inline]
  • UPoint(int initX, int initY) [inline]
  • UPoint(UPOINT initPt) [inline]
  • UPoint(USIZE initSize) [inline]
  • x
  • y
Generated on Sun Oct 21 12:49:00 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

URect Member List

This is the complete list of members for URect, including all inherited members.
  • bottom
  • BottomRight() [inline]
  • BottomRight() const [inline]
  • CenterPoint() const [inline]
  • CopyRect(const URECT *lpSrURect) [inline]
  • DeflateRect(int x, int y) [inline]
  • DeflateRect(USIZE size) [inline]
  • DeflateRect(const URECT *lpRect)
  • DeflateRect(int l, int t, int r, int b)
  • EqualRect(const URECT *lpRect) const [inline]
  • Height() const [inline]
  • InflateRect(int x, int y) [inline]
  • InflateRect(USIZE size) [inline]
  • InflateRect(const URECT *lpRect)
  • InflateRect(int l, int t, int r, int b)
  • IntersectRect(const URECT *lpRect1, const URECT *lpRect2) [inline]
  • IsRectEmpty() const [inline]
  • IsRectNull() const [inline]
  • left
  • MulDiv(int nMultiplier, int nDivisor) const
  • NormalizeRect()
  • OffsetRect(int x, int y) [inline]
  • OffsetRect(USIZE size) [inline]
  • OffsetRect(UPOINT point) [inline]
  • operator &(const URECT &rect2) const [inline]
  • operator &=(const URECT &rect) [inline]
  • operator const URECT *() const [inline]
  • operator URECT *() [inline]
  • operator!=(const URECT &rect) const [inline]
  • operator+(UPOINT point) const [inline]
  • operator+(const URECT *lpRect) const [inline]
  • operator+(USIZE size) const [inline]
  • operator+=(UPOINT point) [inline]
  • operator+=(USIZE size) [inline]
  • operator+=(const URECT *lpRect) [inline]
  • operator-(UPOINT point) const [inline]
  • operator-(USIZE size) const [inline]
  • operator-(const URECT *lpRect) const [inline]
  • operator-=(UPOINT point) [inline]
  • operator-=(USIZE size) [inline]
  • operator-=(const URECT *lpRect) [inline]
  • operator=(const URECT &srURect) [inline]
  • operator==(const URECT &rect) const [inline]
  • operator|(const URECT &rect2) const [inline]
  • operator|=(const URECT &rect) [inline]
  • PtInRect(UPOINT point) const [inline]
  • right
  • SetRect(int x1, int y1, int x2, int y2) [inline]
  • SetRect(UPOINT topLeft, UPOINT bottomRight) [inline]
  • SetRectEmpty() [inline]
  • Size() const [inline]
  • top
  • TopLeft() [inline]
  • TopLeft() const [inline]
  • UnionRect(const URECT *lpRect1, const URECT *lpRect2) [inline]
  • URect() [inline]
  • URect(int l, int t, int r, int b) [inline]
  • URect(const URECT &srURect) [inline]
  • URect(const URECT *lpSrURect) [inline]
  • URect(UPOINT point, USIZE size) [inline]
  • URect(UPOINT topLeft, UPOINT bottomRight) [inline]
  • Width() const [inline]
Generated on Sun Oct 21 12:49:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UPen Member List

This is the complete list of members for UPen, including all inherited members.
  • CreatePen(int nPenStyle, int nWidth, UCOLORREF crColor)
  • DeleteObject(void)
  • m_style [protected]
  • m_width [protected]
  • UDC class [friend]
  • UPen()
  • ~UPen()
Generated on Sun Oct 21 12:48:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UBrush Member List

This is the complete list of members for UBrush, including all inherited members.
  • CreateSolidBrush(UCOLORREF crColor)
  • DeleteObject(void)
  • UBrush()
  • UDC class [friend]
  • ~UBrush()
Generated on Sun Oct 21 12:46:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UDC Member List

This is the complete list of members for UDC, including all inherited members.
  • DrawBitmap(void *bitmap, UPOINT where)
  • GetTextExtent(const char *lpszString, int nCount) const
  • GetTextHeight(void) const
  • LineTo(int x, int y)
  • m_brush [protected]
  • m_pen [protected]
  • m_wid [protected]
  • MoveTo(int x, int y)
  • Rectangle(const URECT *lpRect)
  • RoundRect(const URECT *lpRect, UPOINT point)
  • SelectObject(UPen *pPen)
  • SelectObject(UBrush *pBrush)
  • TextOutClipped(int x, int y, const URECT *lpRect, const char *lpszString, int nCount)
  • UDC(int widid, int cmdid)
  • ~UDC()
Generated on Sun Oct 21 12:47:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CAllTargets Member List

This is the complete list of members for CAllTargets, including all inherited members.
  • CAllTargets() [inline]
  • Get(void) [inline]
  • Get(void) const [inline]
  • targets [protected]
  • ~CAllTargets() [inline]
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CTurnOffDispatching Member List

This is the complete list of members for CTurnOffDispatching, including all inherited members.
  • CTurnOffDispatching() [inline]
  • m_didSetIt [protected]
  • ~CTurnOffDispatching() [inline]
Generated on Sun Oct 21 12:50:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CMsg Member List

This is the complete list of members for CMsg, including all inherited members.
  • CMsg(int wid, int ev, int arg1, void *arg2) [inline]
  • CMsg() [inline]
  • CMsg(const CMsg &msg) [inline]
  • m_arg1
  • m_arg2
  • m_ev
  • m_wid
  • operator=(const CMsg &msg) [inline]
Generated on Sun Oct 21 12:48:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UMessageMapFunctions Member List

This is the complete list of members for UMessageMapFunctions, including all inherited members.
  • pfn
  • pfni_i
  • pfni_ii
  • pfni_iVP
  • pfni_V
  • pfni_VP
  • pfnV_i
  • pfnV_ii
  • pfnV_iii
  • pfnV_iiVP
  • pfnV_iVP
  • pfnV_V
  • pfnV_VP
Generated on Sun Oct 21 12:48:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UMSGMAP_ENTRY Member List

This is the complete list of members for UMSGMAP_ENTRY, including all inherited members.
  • ext
  • ext1
  • ext2
  • nMessage
  • nSig
  • pfn
Generated on Sun Oct 21 12:48:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UMSGMAP Member List

This is the complete list of members for UMSGMAP, including all inherited members.
  • lpEntries
  • pBaseMap
Generated on Sun Oct 21 12:48:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UCmdTarget Member List

This is the complete list of members for UCmdTarget, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • GetBaseMessageMap() [protected, static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetWidID(void) const [inline]
  • IsKindOf(const URuntimeClass *pClass) const
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_widid [private]
  • messageMap [protected, static]
  • rtUObject() [static]
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • ~UCmdTarget() [virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:47:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UCmdUI Member List

This is the complete list of members for UCmdUI, including all inherited members.
  • CanContinue(void) [inline]
  • Check(bool bOn=true) [virtual]
  • Enable(bool bOn=true) [virtual]
  • m_continue
  • m_nID
  • m_widget
  • SetContinue(bool state) [inline]
  • SetText(const char *title) [virtual]
  • SetTooltip(const char *tooltip) [virtual]
  • UCmdUI(int id) [inline]
  • ~UCmdUI() [inline, virtual]
Generated on Sun Oct 21 12:47:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

USemaphore Member List

This is the complete list of members for USemaphore, including all inherited members.
  • IsEnteredTwice() const [inline]
  • m_didSetSemaphore [protected]
  • m_enteredTwice [protected]
  • m_semaphore [protected]
  • USemaphore(bool &semaphore) [inline]
  • ~USemaphore() [inline]
Generated on Sun Oct 21 12:49:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UTB_INIT Member List

This is the complete list of members for UTB_INIT, including all inherited members.
  • heightbtn
  • title
  • widthbtn
Generated on Sun Oct 21 12:49:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UTB_BUTTON Member List

This is the complete list of members for UTB_BUTTON, including all inherited members.
  • cmd
  • drop
  • icon
  • tooltip
  • varcode
Generated on Sun Oct 21 12:49:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UTB_DROPDOWN Member List

This is the complete list of members for UTB_DROPDOWN, including all inherited members.
  • btns
  • initialcmd
Generated on Sun Oct 21 12:49:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

USLIDER Member List

This is the complete list of members for USLIDER, including all inherited members.
  • inc
  • max
  • min
  • pos
Generated on Sun Oct 21 12:49:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

USIZE Member List

This is the complete list of members for USIZE, including all inherited members.
  • cx
  • cy
Generated on Sun Oct 21 12:49:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UPOINT Member List

This is the complete list of members for UPOINT, including all inherited members.
  • x
  • y
Generated on Sun Oct 21 12:49:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

URECT Member List

This is the complete list of members for URECT, including all inherited members.
  • bottom
  • left
  • right
  • top
Generated on Sun Oct 21 12:49:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UTREE_INSERT Member List

This is the complete list of members for UTREE_INSERT, including all inherited members.
  • data
  • icon
  • parent
  • result
  • title
Generated on Sun Oct 21 12:50:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UTREE_INFO Member List

This is the complete list of members for UTREE_INFO, including all inherited members.
  • child
  • data
  • expanded
  • icon
  • item
  • next
  • parent
  • title
Generated on Sun Oct 21 12:50:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ULIST_INSERT Member List

This is the complete list of members for ULIST_INSERT, including all inherited members.
  • col
  • icon
  • row
  • title
Generated on Sun Oct 21 12:48:25 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ULIST_INFO Member List

This is the complete list of members for ULIST_INFO, including all inherited members.
  • col
  • data
  • row
  • title
Generated on Sun Oct 21 12:48:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UMenu Member List

This is the complete list of members for UMenu, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCommands(int cmd) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UMenu(int widid)
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UMenu() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:48:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

URuntimeClass Member List

This is the complete list of members for URuntimeClass, including all inherited members.
  • CreateObject()
  • IsDerivedFrom(const URuntimeClass *pBaseClass) const
  • m_lpszClassName
  • m_nObjectSize
  • m_pfnCreateObject
  • m_pfnGetBaseClass
  • m_pNextClass
  • sAllURuntimeClass [static]
  • URuntimeClass(const char *lpszClassName, int nObjectSize, UObject *(*pfnCreateObject)(), const URuntimeClass *(*pfnGetBaseClass)())
  • ~URuntimeClass()
Generated on Sun Oct 21 12:49:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UObject Member List

This is the complete list of members for UObject, including all inherited members.
  • _GetBaseClass() [static]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • GetRuntimeClass() const [virtual]
  • IsKindOf(const URuntimeClass *pClass) const
  • rtUObject() [static]
  • UObject() [inline, protected]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:48:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UPStr Member List

This is the complete list of members for UPStr, including all inherited members.
  • c_str() const [inline]
  • empty(void) const [inline]
  • endsWith(char c) const [inline]
  • flush(void) [protected]
  • length(void) const [inline]
  • operator char *() [inline]
  • operator const char *() const [inline]
  • operator const unsigned char *() const [inline]
  • operator unsigned char *() [inline]
  • operator<<(const char *addToStr)
  • operator<<(char addToStr)
  • operator<<(int addToStr)
  • operator=(const char *newstr)
  • operator=(const unsigned char *newstr)
  • operator=(const UPStr &newstr)
  • p_str() const [inline]
  • replace(char which, char bywhich)
  • set(const char *buf, unsigned int len)
  • str [protected]
  • UPStr() [inline]
  • UPStr(const char *newstr) [inline]
  • UPStr(const unsigned char *newstr) [inline]
  • UPStr(const UPStr &newstr) [inline]
  • ~UPStr() [inline, virtual]
Generated on Sun Oct 21 12:49:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UStr Member List

This is the complete list of members for UStr, including all inherited members.
  • c_str() const [inline]
  • compare(const char *thestr) const [inline]
  • empty(void) const [inline]
  • endsWith(char c) const [inline]
  • flush(void) [protected]
  • length(void) const [inline]
  • operator char *() [inline]
  • operator const char *() const [inline]
  • operator!=(const UStr &str) const
  • operator!=(const char *str) const
  • operator<(const UStr &str) const
  • operator<<(const char *addToStr)
  • operator<<(char addToStr)
  • operator<<(int addToStr)
  • operator=(const char *newstr)
  • operator=(const unsigned char *newstr)
  • operator=(const UStr &newstr)
  • operator==(const UStr &str) const
  • operator==(const char *str) const
  • operator>(const UStr &str) const
  • replace(char which, char bywhich)
  • set(const char *buf, unsigned int len)
  • str [protected]
  • UStr() [inline]
  • UStr(const char *newstr) [inline]
  • UStr(const unsigned char *newstr) [inline]
  • UStr(const UStr &newstr) [inline]
  • ~UStr() [inline, virtual]
Generated on Sun Oct 21 12:49:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TbEntry Member List

This is the complete list of members for TbEntry, including all inherited members.
  • kind
  • TbEntry(tbeKind k) [inline]
  • ~TbEntry() [inline, virtual]
Generated on Sun Oct 21 12:49:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

AREF Member List

This is the complete list of members for AREF, including all inherited members.
  • bitmap
  • cnt
Generated on Sun Oct 21 12:45:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

aref Member List

This is the complete list of members for aref, including all inherited members.
  • aref() [inline]
  • aref(HBITMAP b) [inline]
  • aref(const aref &src) [inline]
  • operator HBITMAP() [inline]
  • operator=(const aref &src) [inline]
  • ref [protected]
  • Ref(void) const [inline]
  • UnRef(void) const [inline]
  • ~aref() [inline, virtual]
Generated on Sun Oct 21 12:45:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

awidget Member List

This is the complete list of members for awidget, including all inherited members.
  • awidget(HBITMAP b, int c, const char *t, UTB_VAR v) [inline]
  • awidget() [inline]
  • awidget(const awidget &src) [inline]
  • bitmap
  • cmd
  • operator=(const awidget &src) [inline]
  • tooltip
  • var
  • ~awidget() [inline, virtual]
Generated on Sun Oct 21 12:45:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TbEntryButton Member List

This is the complete list of members for TbEntryButton, including all inherited members.
  • ischeck
  • kind
  • TbEntry(tbeKind k) [inline]
  • TbEntryButton(HBITMAP b, int c, const char *t, UTB_VAR v) [inline]
  • wid
  • ~TbEntry() [inline, virtual]
  • ~TbEntryButton() [inline, virtual]
Generated on Sun Oct 21 12:49:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TbEntryChkButton Member List

This is the complete list of members for TbEntryChkButton, including all inherited members.
  • ischeck
  • kind
  • TbEntry(tbeKind k) [inline]
  • TbEntryButton(HBITMAP b, int c, const char *t, UTB_VAR v) [inline]
  • TbEntryChkButton(HBITMAP b, int c, const char *t, UTB_VAR v) [inline]
  • wid
  • ~TbEntry() [inline, virtual]
  • ~TbEntryButton() [inline, virtual]
  • ~TbEntryChkButton() [inline, virtual]
Generated on Sun Oct 21 12:49:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TbEntryDropDown Member List

This is the complete list of members for TbEntryDropDown, including all inherited members.
  • current
  • icons
  • kind
  • TbEntry(tbeKind k) [inline]
  • TbEntryDropDown() [inline]
  • ~TbEntry() [inline, virtual]
  • ~TbEntryDropDown() [inline, virtual]
Generated on Sun Oct 21 12:49:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TbEntrySeparator Member List

This is the complete list of members for TbEntrySeparator, including all inherited members.
  • kind
  • TbEntry(tbeKind k) [inline]
  • TbEntrySeparator() [inline]
  • ~TbEntry() [inline, virtual]
  • ~TbEntrySeparator() [inline, virtual]
Generated on Sun Oct 21 12:49:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

WININFO Member List

This is the complete list of members for WININFO, including all inherited members.
  • entries
  • height
  • Search(int cmd, int *dropindex=0L) [inline]
  • width
  • WININFO(int w, int h) [inline]
  • ~WININFO() [inline, virtual]
Generated on Sun Oct 21 12:51:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UToolbar Member List

This is the complete list of members for UToolbar, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • m_winInfo [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnCommands(int cmd) [protected]
  • OnDestroy() [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTbButton(UTB_BUTTON *info) [protected]
  • OnTbCheckBtn(UTB_BUTTON *info) [protected]
  • OnTbDropDown(UTB_DROPDOWN *info) [protected]
  • OnTbEnd(void) [protected]
  • OnTbInit(UTB_INIT *info) [protected]
  • OnTbSeparator(void) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UToolbar(int widid)
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UObject() [inline, virtual]
  • ~UToolbar() [virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:50:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UTimer Member List

This is the complete list of members for UTimer, including all inherited members.
  • m_cmd
  • m_lap
  • m_lastlap
  • operator=(const UTimer &src) [inline]
  • UTimer(int lap, int lastlap, int cmd) [inline]
  • UTimer() [inline]
  • UTimer(const UTimer &src) [inline]
Generated on Sun Oct 21 12:50:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UColor Member List

This is the complete list of members for UColor, including all inherited members.
  • b
  • g
  • r
Generated on Sun Oct 21 12:47:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

UWidget Member List

This is the complete list of members for UWidget, including all inherited members.
  • _GetBaseClass() [static]
  • _messageEntries [private, static]
  • AddListener(UCmdTarget *listener) [virtual]
  • AddPage(UWidget *page, int pagecmd, int num_page)
  • AddTimer(long lap, int cmd)
  • AddTooltip(int cmd, const char *tooltipID)
  • BeforeUpdateUI(void) [inline, virtual]
  • classUObject [protected, static]
  • CreateObject(const char *className) [static]
  • Dismiss(void) [inline, virtual]
  • DoDataExchange(bool) [inline, virtual]
  • DoModal(int id=0)
  • DoValidUI(bool how) [static]
  • EndModal(bool result)
  • GetBaseMessageMap() [protected, static]
  • GetFocus(void) [static]
  • GetFocusCmd(void) [static]
  • GetMessageMap() const [protected, virtual]
  • GetRuntimeClass() const [virtual]
  • GetThisMessageMap() [protected, static]
  • GetTimers(void)
  • GetTooltip(int cmd) const
  • GetWidget(int cmd) const
  • GetWidgets(void) [inline]
  • GetWidID(void) const [inline]
  • HasFocus(void) [inline]
  • HasFocus(int cmdid) [inline]
  • HasModal(void) [static]
  • IsKindOf(const URuntimeClass *pClass) const
  • IsUIValid() [static]
  • kUDispatchHandled enum value
  • kUNoDispatchInfo enum value
  • m_currentPage [protected]
  • m_listeners [protected]
  • m_modalRes [protected]
  • m_tabs [protected]
  • m_timers [protected]
  • m_tooltips [protected]
  • m_widgets [protected]
  • messageMap [protected, static]
  • OnChgCursor(int cmd, UCURSOR cursor) [protected]
  • OnChgFocus(int cmd) [protected]
  • OnComboAppend(int cmd, const char *txt) [protected]
  • OnComboDelSel(int cmd, int sel) [protected]
  • OnComboEnableSel(int cmd, int sel, int state) [protected]
  • OnComboGetCount(int cmd) [protected]
  • OnComboGetMenu(int cmd, UMENU *menu) [protected]
  • OnComboGetPos(int cmd, UStr *txt) [protected]
  • OnComboResetAll(int cmd) [protected]
  • OnComboSetPos(int cmd, int sel) [protected]
  • OnEnableCmd(int cmd, int state) [protected]
  • OnFetchCmd(int cmd, void *widget) [protected]
  • OnGetFloat(int cmd, float *f) [protected]
  • OnGetLoc(int cmd, URECT *r) [protected]
  • OnGetSliderProperty(int cmd, USLIDER *prop) [protected]
  • OnGetState(int cmd) [protected]
  • OnGetText(int cmd, UStr *text) [protected]
  • OnInitTabWidget(int cmd, int page, void *widget) [protected]
  • OnInitWidget(int cmd, void *widget) [protected]
  • OnInvalidate(int cmd) [protected]
  • OnListAddColumns(int cmd, int num) [protected]
  • OnListAddSel(int cmd, int entry) [protected]
  • OnListDelRow(int cmd, int row) [protected]
  • OnListGetInfo(int cmd, ULIST_INFO *desc) [protected]
  • OnListGetNext(int cmd, int whichCell) [protected]
  • OnListGetNextSel(int cmd, int selectedCell) [protected]
  • OnListInsert(int cmd, ULIST_INSERT *data) [protected]
  • OnListNewRow(int cmd, int *num) [protected]
  • OnListResetAll(int cmd) [protected]
  • OnListResort(int cmd, int column, UListSorter s) [protected]
  • OnListRowGetData(int cmd, int row, void **data) [protected]
  • OnListRowSetData(int cmd, int row, void *data) [protected]
  • OnListSetColTitle(int cmd, int num, const char *title) [protected]
  • OnListSetColWidth(int cmd, int num, int width) [protected]
  • OnListSetFeedback(int cmd, int turnOn) [protected]
  • OnPageChanged(int cmd, int pagenum) [protected]
  • OnRedraw(int cmd) [protected]
  • OnSetFloat(int cmd, const float *f) [protected]
  • OnSetLoc(int cmd, const URECT *r) [protected]
  • OnSetSlider(int cmd, int pos) [protected]
  • OnSetSliderProperty(int cmd, const USLIDER *prop) [protected]
  • OnSetState(int cmd, int state) [protected]
  • OnSetText(int cmd, const char *text) [protected]
  • OnSetTooltip(int cmd, UCmdUI *pCmdUI) [protected]
  • OnShowWidget(int cmd, int state) [protected]
  • OnTreeDelete(int cmd, UTREEITEM item) [protected]
  • OnTreeExpand(int cmd, int collapse, UTREEITEM item) [protected]
  • OnTreeGetInfo(int cmd, UTREE_INFO *data) [protected]
  • OnTreeGetSel(int cmd, UTREEITEM *item) [protected]
  • OnTreeInsert(int cmd, UTREE_INSERT *data) [protected]
  • OnTreeResetAll(int cmd) [protected]
  • OnTreeSelect(int cmd, int deselect, UTREEITEM item) [protected]
  • OnTreeSetData(int cmd, UTREE_INFO *data) [protected]
  • OnTreeSetIcon(int cmd, UTREE_INFO *data) [protected]
  • OnUpdateFocus(int leave, void *widget) [protected]
  • OnUpdateUI(void) [protected]
  • RemoveTimer(int cmd)
  • rtUObject() [static]
  • sFocusCmdID [protected, static]
  • sFocusWidID [protected, static]
  • sValidMenu [protected, static]
  • UCmdTarget(int widid)
  • UDispatchInfo enum name
  • UDispatchMessage(int evt, int arg1, void *arg2, UDispatchInfo &dispatchInfo) [virtual]
  • UObject() [inline, protected]
  • UWidget(int widid)
  • WidgetIsActive(int cmd) const
  • ~UCmdTarget() [virtual]
  • ~UObject() [inline, virtual]
  • ~UWidget() [virtual]
Generated on Sun Oct 21 12:50:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoTraversalContext Member List

This is the complete list of members for KoTraversalContext, including all inherited members.
  • IsMatch(EntnodeData *data) const [inline]
  • IsRecursive() const [inline]
  • IsShowIgnored() const [inline]
  • KoTraversalContext(CBrowseFileView *view) [inline]
  • m_filter [private]
  • m_isRecursive [private]
  • m_isShowIgnored [private]
  • m_view
Generated on Sun Oct 21 12:48:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CRecursionLock Member List

This is the complete list of members for CRecursionLock, including all inherited members.
  • CRecursionLock(bool &semaphore) [inline]
  • m_semaphore [private]
  • ~CRecursionLock() [inline]
Generated on Sun Oct 21 12:49:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CBrowseFileView Member List

This is the complete list of members for CBrowseFileView, including all inherited members.
  • AddColumns()
  • CBrowseFileView() [protected]
  • CheckChanges(void) [inline]
  • DeleteColumns()
  • DisableCommon(bool bCheckSelection=true) [protected]
  • DoDrag() [protected]
  • EditSel(EntnodeData *data, bool useDefault=false) [protected]
  • GetColumnModel() const [inline]
  • GetEntriesModTime(time_t &newEntriesMod, time_t &newEntriesLogMod) [protected]
  • GetImageForEntry(EntnodeData *data) [static]
  • GetMainFrame() [inline]
  • GetPath() const [inline]
  • GetViewType()
  • InvalidateView(void)
  • LoadColumns()
  • m_ascendant [protected]
  • m_checkChanges [protected]
  • m_ctrlHeader [protected]
  • m_entriesLogMod [protected]
  • m_entriesMod [protected]
  • m_heightOfLines [protected]
  • m_isFilesChange [protected]
  • m_isRecursive [protected]
  • m_isResetViewLocked [protected]
  • m_isResetViewPending [protected]
  • m_modelColumns [protected]
  • m_numberByPages [protected]
  • m_numberOfLines [protected]
  • m_numberOfPages [protected]
  • m_path [protected]
  • m_SmallImageList [protected, static]
  • m_sort [protected]
  • m_StateImageList [protected, static]
  • m_uiFilechangeTimer [protected]
  • m_watch [protected]
  • OnBegindrag(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo) [protected, virtual]
  • OnBeginrdrag(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnColumnclick(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnCustomize(UINT nID) [protected]
  • OnDeleteitem(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnDestroy() [protected]
  • OnEditSelectAll() [protected]
  • OnFileChange(WPARAM, LPARAM) [protected]
  • OnFilteringChanged()
  • OnInitialUpdate() [protected, virtual]
  • OnKeydown(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnLButtonDblClk(UINT nFlags, CPoint point) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnMacro(UINT nID) [protected]
  • OnPreparePrinting(CPrintInfo *pInfo) [protected, virtual]
  • OnPrint(CDC *pDC, CPrintInfo *pInfo) [protected, virtual]
  • OnQueryAnnotate() [protected]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • OnResetView(WPARAM, LPARAM) [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • OnUpdateCustomize(CCmdUI *pCmdUI) [protected]
  • OnUpdateMacro(CCmdUI *pCmdUI) [protected]
  • OnUpdateQueryAnnotate(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewAdd(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewAddB(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewCheckout(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewEditseldef(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewExplore(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewFullRowDetails(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewGraph(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewImport(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewList(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewRelease(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewReload(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewRmv(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewSmallIcons(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewTrash(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewUpdate(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewUpone(CCmdUI *pCmdUI) [protected]
  • OnViewAdd() [protected]
  • OnViewAddb() [protected]
  • OnViewCheckout() [protected]
  • OnViewCommit() [protected]
  • OnViewDiff() [protected]
  • OnViewEdit() [protected]
  • OnViewEditors() [protected]
  • OnViewEditsel() [protected]
  • OnViewEditseldef() [protected]
  • OnViewExplore() [protected]
  • OnViewFullRowDetails() [protected]
  • OnViewGraph() [protected]
  • OnViewImport() [protected]
  • OnViewList() [protected]
  • OnViewLock() [protected]
  • OnViewLog() [protected]
  • OnViewQueryUpdate() [protected]
  • OnViewRelease() [protected]
  • OnViewReload() [protected]
  • OnViewRmv() [protected]
  • OnViewSmallIcons() [protected]
  • OnViewStatus() [protected]
  • OnViewTagBranch() [protected]
  • OnViewTagDelete() [protected]
  • OnViewTagNew() [protected]
  • OnViewTrash() [protected]
  • OnViewUnedit() [protected]
  • OnViewUnlock() [protected]
  • OnViewUpdate() [protected]
  • OnViewUpone() [protected]
  • OnViewWatchers() [protected]
  • OnViewWatchOff() [protected]
  • OnViewWatchOn() [protected]
  • PreCreateWindow(CREATESTRUCT &cs) [virtual]
  • ProcessSelectionCommand(KiSelectionHandler *handler)
  • ResetView(const char *path, bool notifyBrowser=false, const char *selectFile=0L)
  • ResetView(bool notifyBrowser=false, const char *selectFile=0L)
  • Resort(void)
  • SaveColumns()
  • SetFullRowSel(BOOL bFullRowSel) [protected]
  • SetRecursive(bool isRecursive) [protected]
  • SetViewType(DWORD dwViewType)
  • ~CBrowseFileView() [virtual]
Generated on Sun Oct 21 12:46:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CBrowserBar Member List

This is the complete list of members for CBrowserBar, including all inherited members.
  • CBrowserBar() [protected]
  • Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL) [virtual]
  • GetBrowserView() [inline]
  • m_browser [protected]
  • OnDestroy() [protected]
  • OnDraw(CDC *pDC) [protected, virtual]
  • OnPaint() [protected]
  • OnWindowPosChanged(WINDOWPOS *lpwndpos) [protected]
  • ~CBrowserBar() [virtual]
Generated on Sun Oct 21 12:46:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CJX_COLORMAP Member List

This is the complete list of members for CJX_COLORMAP, including all inherited members.
  • iSysColorTo
  • rgbqFrom
Generated on Sun Oct 21 12:48:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

AFX_DLLVERSIONINFO Member List

This is the complete list of members for AFX_DLLVERSIONINFO, including all inherited members.
  • cbSize
  • dwBuildNumber
  • dwMajorVersion
  • dwMinorVersion
  • dwPlatformID
Generated on Sun Oct 21 12:45:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CJX_CONTROLPOS Member List

This is the complete list of members for CJX_CONTROLPOS, including all inherited members.
  • nID
  • nIndex
  • rectOldPos
Generated on Sun Oct 21 12:48:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CToolBarData Member List

This is the complete list of members for CToolBarData, including all inherited members.
  • items() [inline]
  • wHeight
  • wItemCount
  • wVersion
  • wWidth
Generated on Sun Oct 21 12:50:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJToolCmdUI Member List

This is the complete list of members for CCJToolCmdUI, including all inherited members.
  • Enable(BOOL bOn) [virtual]
  • SetCheck(int nCheck) [virtual]
  • SetText(LPCTSTR lpszText) [virtual]
Generated on Sun Oct 21 12:47:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CSubclassWndMap Member List

This is the complete list of members for CSubclassWndMap, including all inherited members.
  • Add(HWND hwnd, CSubclassWnd *pSubclassWnd)
  • CSubclassWndMap()
  • GetHookMap() [static]
  • Lookup(HWND hwnd)
  • Remove(CSubclassWnd *pSubclassWnd)
  • RemoveAll(HWND hwnd)
  • ~CSubclassWndMap()
Generated on Sun Oct 21 12:49:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJBrowseButton Member List

This is the complete list of members for CCJBrowseButton, including all inherited members.
  • CCJBrowseButton()
  • Create(CWnd *pWnd, BROWSE_TYPE eType, UINT nMenu, UINT nSubMenuIndx) [virtual]
  • GetNextID(CWnd *pWnd) const [virtual]
  • m_bOpenFileDialog
  • m_dwFlags
  • m_eType [protected]
  • m_Font [protected]
  • m_hIcon [protected]
  • m_nID [protected]
  • m_nMenu [protected]
  • m_nSubMenuIndx [protected]
  • m_pEditWnd [protected]
  • m_pParentWnd
  • m_strDefExt
  • m_strFileName
  • m_strFilter
  • m_strTitle
  • OnClicked() [protected]
  • UpdateFont() [virtual]
  • ~CCJBrowseButton() [virtual]
Generated on Sun Oct 21 12:46:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJBrowseEdit Member List

This is the complete list of members for CCJBrowseEdit, including all inherited members.
  • CCJBrowseEdit()
  • InitializeControl() [virtual]
  • m_btnBrowse [protected]
  • m_eType [protected]
  • m_nMenu [protected]
  • m_nSubMenuIndx [protected]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnEnable(BOOL bEnable) [protected]
  • OnShowWindow(BOOL bShow, UINT nStatus) [protected]
  • PreSubclassWindow() [protected, virtual]
  • SetDlgDefExt(LPCTSTR strDefExt) [virtual]
  • SetDlgFileName(LPCTSTR strFileName) [virtual]
  • SetDlgFilter(LPCTSTR strFilter) [virtual]
  • SetDlgOpenFile(BOOL bOpenFileDialog) [virtual]
  • SetDlgOwner(CWnd *pParentWnd) [virtual]
  • SetDlgStyle(DWORD dwFlags) [virtual]
  • SetDlgTitle(LPCTSTR strTitle) [virtual]
  • SetSearchType(BROWSE_TYPE eType, UINT nMenu=0, int nSubMenuIndx=0) [virtual]
  • ~CCJBrowseEdit() [virtual]
Generated on Sun Oct 21 12:46:05 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJCaptionButton Member List

This is the complete list of members for CCJCaptionButton, including all inherited members.
  • CCJFlatButton()
  • DisableFlatLook(BOOL bDisable=FALSE) [virtual]
  • DrawButtonBitmap(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonIcon(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonText(CDC *pDC, UINT nState, CRect &rcItem) [virtual]
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • m_bAltColor [protected]
  • m_bFlatLook [protected]
  • m_bLBtnDown [protected]
  • m_bMouseOver [protected]
  • m_bPainted [protected]
  • m_clrAltHilite [protected]
  • m_clrAltNormal [protected]
  • m_clrAltShadow [protected]
  • m_clrAltTextNm [protected]
  • m_clrDkShad [protected]
  • m_clrHilite [protected]
  • m_clrNormal [protected]
  • m_clrShadow [protected]
  • m_clrTextGy [protected]
  • m_clrTextNm [protected]
  • m_Font [protected]
  • m_hCursor [protected]
  • m_hPushed [protected]
  • m_pFont [protected]
  • m_sizeIcon [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnLButtonDblClk(UINT nFlags, CPoint point) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnSysColorChange() [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • SetAlternateColors(COLORREF clrAltNormal, COLORREF clrAltHilite, COLORREF clrAltShadow, COLORREF clrAltTextNm) [virtual]
  • SetButtonFont(CFont *pFont) [virtual]
  • SetButtonStyle(CFont *pFont, COLORREF clrBackground, COLORREF clrFont) [virtual]
  • SetIcon(HICON hIcon, CSize size) [virtual]
  • SetIcon(HICON hIcon, HICON hPushed, CSize size) [virtual]
  • UpdateFont() [protected, virtual]
  • ~CCJFlatButton() [virtual]
Generated on Sun Oct 21 12:46:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJCaption Member List

This is the complete list of members for CCJCaption, including all inherited members.
  • CCJCaption()
  • Create(CWnd *pParentWnd, LPCTSTR lpszWindowName, DWORD dwExStyle=0x01, DWORD dwStyle=WS_VISIBLE|SS_CENTER|SS_CENTERIMAGE, const CRect &rect=CRect(0, 0, 0, 0), UINT nID=0xffff) [virtual]
  • DrawCaptionBack(CDC *pDC, CRect &rcItem) [virtual]
  • DrawCaptionIcon(CDC *pDC, CRect &rcItem) [virtual]
  • DrawCaptionText(CDC *pDC, CRect &rcItem) [virtual]
  • KillChildWindow() [virtual]
  • m_CaptionButton [protected]
  • m_clrBackgnd [protected]
  • m_clrBorder [protected]
  • m_clrBtnFace [protected]
  • m_clrBtnHilite [protected]
  • m_clrBtnShadow [protected]
  • m_clrFont [protected]
  • m_cx [protected]
  • m_cy [protected]
  • m_dwExStyle [protected]
  • m_dwTextStyle [protected]
  • m_Font [protected]
  • m_hIcon [protected]
  • m_nBorder [protected]
  • m_nOffset [protected]
  • m_pChildWnd [protected]
  • m_pFont [protected]
  • m_pNotifyWnd [protected]
  • m_pWndPopDown [protected]
  • m_rcChild [protected]
  • m_rcClient [protected]
  • m_strWindText [protected]
  • ModifyCaptionStyle(int nBorderSize, CFont *pFont=NULL, LPCTSTR lpszWindText=NULL, HICON hIcon=NULL) [virtual]
  • OnCaptButton() [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnPaint() [protected]
  • OnPushPinButton(UINT lParam, LONG wParam) [protected]
  • OnPushPinCancel(UINT lParam, LONG wParam) [protected]
  • OnSize(UINT nType, int cx, int cy) [protected]
  • OnSysColorChange() [protected]
  • SetCaptionColors(COLORREF clrBorder, COLORREF clrBackground, COLORREF clrFont) [virtual]
  • SetChildWindow(CWnd *pChild, CWnd *pNotifyWnd) [virtual]
  • SetTextStyle(DWORD dwStyle) [virtual]
  • UpdateCaption(LPCTSTR lpszWindowText, HICON hIcon) [virtual]
  • UpdateCaptionBack(CDC *pDC, CRect &rcItem) [virtual]
  • UpdateCaptionText(CDC *pDC, CRect &rcItem) [virtual]
  • UpdateFont() [virtual]
  • ~CCJCaption() [virtual]
Generated on Sun Oct 21 12:46:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJCaptionPopupWnd Member List

This is the complete list of members for CCJCaptionPopupWnd, including all inherited members.
  • CCJCaptionPopupWnd()
  • Create(const CRect &rect, CWnd *pParentWnd, CWnd *pChildWnd) [virtual]
  • m_Caption [protected]
  • m_CaptionButton [protected]
  • m_hIconOff [protected]
  • m_hIconOn [protected]
  • m_pChildParent
  • m_pChildWnd
  • m_pParentWnd
  • OnCaptButton() [protected]
  • OnDestroy() [protected]
  • OnPaint() [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • ~CCJCaptionPopupWnd() [virtual]
Generated on Sun Oct 21 12:46:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJColorPicker Member List

This is the complete list of members for CCJColorPicker, including all inherited members.
  • CCJColorPicker()
  • CheckTextColor(COLORREF crColor) [virtual]
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • GetBkColor() [inline, virtual]
  • GetColor() [virtual]
  • GetSelectionMode() [inline, virtual]
  • GetTextColor() [inline, virtual]
  • GetTrackSelection() [inline, virtual]
  • m_ArrowRect [protected]
  • m_bActive [protected]
  • m_bLBtnDown [protected]
  • m_bTrackSelection [protected]
  • m_crColorBk [protected]
  • m_crColorText [protected]
  • m_nSelectionMode [protected]
  • m_pParentWnd [protected]
  • m_strCustomText [protected]
  • m_strDefaultText [protected]
  • OnClicked() [protected]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnPaint() [protected]
  • OnSelChange(UINT lParam, LONG wParam) [protected]
  • OnSelEndCancel(UINT lParam, LONG wParam) [protected]
  • OnSelEndOK(UINT lParam, LONG wParam) [protected]
  • PreSubclassWindow() [protected, virtual]
  • SetBkColor(COLORREF crColorBk) [virtual]
  • SetColor(COLORREF crColor) [virtual]
  • SetCustomText(LPCTSTR szCustomText) [virtual]
  • SetDefaultText(LPCTSTR szDefaultText) [virtual]
  • SetSelectionMode(UINT nMode) [inline, virtual]
  • SetTextColor(COLORREF crColorText) [virtual]
  • SetTrackSelection(BOOL bTracking=TRUE) [inline, virtual]
  • SetWindowSize() [protected]
  • ~CCJColorPicker() [virtual]
Generated on Sun Oct 21 12:46:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

ColorTableEntry Member List

This is the complete list of members for ColorTableEntry, including all inherited members.
  • crColor
  • szName
Generated on Sun Oct 21 12:48:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJColorPopup Member List

This is the complete list of members for CCJColorPopup, including all inherited members.
  • CCJColorPopup()
  • CCJColorPopup(CPoint p, COLORREF crColor, CWnd *pParentWnd, LPCTSTR szDefaultText=NULL, LPCTSTR szCustomText=NULL)
  • ChangeSelection(int nIndex) [protected, virtual]
  • Create(CPoint p, COLORREF crColor, CWnd *pParentWnd, LPCTSTR szDefaultText=NULL, LPCTSTR szCustomText=NULL) [virtual]
  • CreateToolTips() [protected, virtual]
  • DrawCell(CDC *pDC, int nIndex) [protected, virtual]
  • EndSelection(int nMessage) [protected, virtual]
  • FindCellFromColor(COLORREF crColor) [protected, virtual]
  • GetCellRect(int nIndex, const LPRECT &rect) [protected, virtual]
  • GetColor(int nIndex) [inline, protected, virtual]
  • GetColorName(int nIndex) [inline, protected, virtual]
  • GetColumn(int nIndex) const [protected, virtual]
  • GetIndex(int row, int col) const [protected, virtual]
  • GetRow(int nIndex) const [protected, virtual]
  • Initialise() [virtual]
  • m_crColor [protected]
  • m_crColors [protected, static]
  • m_crInitialColor [protected]
  • m_CustomTextRect [protected]
  • m_DefaultTextRect [protected]
  • m_Font [protected]
  • m_nBoxSize [protected]
  • m_nChosenColorSel [protected]
  • m_nCurrentSel [protected]
  • m_nMargin [protected]
  • m_nNumColors [protected]
  • m_nNumColumns [protected]
  • m_nNumRows [protected]
  • m_Palette [protected]
  • m_pParent [protected]
  • m_strCustomText [protected]
  • m_strDefaultText [protected]
  • m_ToolTip [protected]
  • m_WindowRect [protected]
  • OnActivateApp(BOOL bActive, HTASK hTask) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) [protected]
  • OnKillFocus(CWnd *pNewWnd) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnNcDestroy() [protected]
  • OnPaint() [protected]
  • OnPaletteChanged(CWnd *pFocusWnd) [protected]
  • OnQueryNewPalette() [protected]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • SetWindowSize() [protected, virtual]
  • UpdateFont() [virtual]
  • ~CCJColorPopup() [virtual]
Generated on Sun Oct 21 12:46:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJComboBoxEx Member List

This is the complete list of members for CCJComboBoxEx, including all inherited members.
  • AddString(LPCTSTR lpszString)
  • CCJComboBoxEx()
  • Create(DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
  • DeleteItem(int iIndex)
  • Dir(UINT attr, LPCTSTR lpszWildCard)
  • FindString(int nIndexStart, LPCTSTR lpszFind) const
  • GetComboBoxCtrl()
  • GetEditCtrl()
  • GetExtendedStyle() const
  • GetImageList() const
  • GetItem(COMBOBOXEXITEM *pCBItem)
  • HasEditChanged()
  • InsertItem(const COMBOBOXEXITEM *pCBItem)
  • InsertItem(int iItem, UINT nStringID, int iIndent=0, int iImage=0, int iSelectedImage=0, UINT mask=CBEIF_TEXT|CBEIF_IMAGE|CBEIF_SELECTEDIMAGE|CBEIF_INDENT)
  • InsertItem(int iItem, LPCTSTR lpszItem, int iIndent=0, int iImage=0, int iSelectedImage=0, UINT mask=CBEIF_TEXT|CBEIF_IMAGE|CBEIF_SELECTEDIMAGE|CBEIF_INDENT)
  • InsertString(int nIndex, LPCTSTR lpszString)
  • SetEditSel(int nStartChar, int nEndChar)
  • SetExtendedStyle(DWORD dwExMask, DWORD dwExStyles)
  • SetImageList(CImageList *pImageList)
  • SetItem(const COMBOBOXEXITEM *pCBItem)
  • ~CCJComboBoxEx() [virtual]
Generated on Sun Oct 21 12:46:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJCBarButton Member List

This is the complete list of members for CCJCBarButton, including all inherited members.
  • CCJFlatButton()
  • DisableFlatLook(BOOL bDisable=FALSE) [virtual]
  • DrawButtonBitmap(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonIcon(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonText(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • m_bAltColor [protected]
  • m_bFlatLook [protected]
  • m_bLBtnDown [protected]
  • m_bMouseOver [protected]
  • m_bPainted [protected]
  • m_clrAltHilite [protected]
  • m_clrAltNormal [protected]
  • m_clrAltShadow [protected]
  • m_clrAltTextNm [protected]
  • m_clrDkShad [protected]
  • m_clrHilite [protected]
  • m_clrNormal [protected]
  • m_clrShadow [protected]
  • m_clrTextGy [protected]
  • m_clrTextNm [protected]
  • m_Font [protected]
  • m_hCursor [protected]
  • m_hPushed [protected]
  • m_pFont [protected]
  • m_sizeIcon [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnLButtonDblClk(UINT nFlags, CPoint point) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnSysColorChange() [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • SetAlternateColors(COLORREF clrAltNormal, COLORREF clrAltHilite, COLORREF clrAltShadow, COLORREF clrAltTextNm) [virtual]
  • SetButtonFont(CFont *pFont) [virtual]
  • SetIcon(HICON hIcon, CSize size) [virtual]
  • SetIcon(HICON hIcon, HICON hPushed, CSize size) [virtual]
  • UpdateFont() [protected, virtual]
  • ~CCJFlatButton() [virtual]
Generated on Sun Oct 21 12:46:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJControlBar Member List

This is the complete list of members for CCJControlBar, including all inherited members.
  • CalcDynamicLayout(int nLength, DWORD nMode) [virtual]
  • CCJControlBar()
  • Create(CWnd *pParentWnd, UINT nID, LPCTSTR lpszWindowName=NULL, CSize sizeDefault=CSize(200, 100), DWORD dwStyle=CBRS_LEFT, BOOL bFlatBorders=FALSE) [virtual]
  • DrawBorders(CDC *pDC, CRect &rect) [protected, virtual]
  • DrawGriperCaption(CDC *pDC, LPRECT pRect) [protected, virtual]
  • DrawGripper(CDC *pDC) [protected, virtual]
  • EnableDockingOnSizeBar(DWORD dwDockStyle) [virtual]
  • EnableFlatLook(BOOL bFlat=TRUE) [virtual]
  • EnableFlatLook(BOOL bGripper, BOOL bBorder, BOOL bButtons) [virtual]
  • EnableSaveState(bool bAutoSave=true) [virtual]
  • EraseNonClient() [protected, virtual]
  • GetButtonRect() [protected, virtual]
  • GetChildRect(CRect &rect) [virtual]
  • GetGripperRect() [protected, virtual]
  • GetHorzSize() [virtual]
  • GetMenuID() [virtual]
  • GetMinExt() [virtual]
  • GetVertSize() [virtual]
  • HitTest(CPoint &point) [protected, virtual]
  • IsBottomDocked() const [virtual]
  • IsFloating() const [virtual]
  • IsHorzDocked() const [virtual]
  • IsLeftDocked() const [virtual]
  • IsRightDocked() const [virtual]
  • IsTopDocked() const [virtual]
  • IsVertDocked() const [virtual]
  • LoadBarState(CSize &size, int nID) [protected, virtual]
  • m_bAutoSave [protected]
  • m_bButtons [protected]
  • m_bDragging [protected]
  • m_bFlatBorder [protected]
  • m_bFlatGripper [protected]
  • m_bFloating [protected]
  • m_bGripper [protected]
  • m_bMaximized [protected]
  • m_bOkToDrag [protected]
  • m_btnClose [protected]
  • m_btnMinim [protected]
  • m_bToFit
  • m_bUnique
  • m_cxOffset [protected]
  • m_cyOffset [protected]
  • m_eAuxIndex [protected]
  • m_eChildBorder
  • m_hAuxIcon [protected]
  • m_hIcon [protected]
  • m_ImageList [protected]
  • m_nID [protected]
  • m_nPos [protected]
  • m_pChildWnd [protected]
  • m_popToolbarID [protected]
  • m_popupMenu [protected]
  • m_popupMenuID [protected]
  • m_ptCurDrag [protected]
  • m_ptStartDrag [protected]
  • m_rcTrack [protected]
  • m_sizeDesired [protected]
  • m_sizeFloat [protected]
  • m_sizeHorz [protected]
  • m_sizeNormal [protected]
  • m_sizeVert [protected]
  • m_strSection [protected]
  • m_ToolTip [protected]
  • Maximize(int size) [virtual]
  • Minimize() [virtual]
  • Normalize() [virtual]
  • OnButtonClose() [protected]
  • OnButtonMinimize() [protected]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu) [protected]
  • OnInvertTracker(const CRect &rect) [protected, virtual]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) [protected]
  • OnMenuChar(UINT nChar, UINT nFlags, CMenu *pMenu) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnNcHitTest(CPoint point) [protected]
  • OnNcPaint() [protected]
  • OnPaint() [protected]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnUpdateButtonClose(CCmdUI *pCmdUI) [protected]
  • OnUpdateButtonMinimize(CCmdUI *pCmdUI) [protected]
  • OnUpdateCmdUI(CFrameWnd *pTarget, BOOL bDisableIfNoHndler) [virtual]
  • OnWindowPosChanged(WINDOWPOS *lpwndpos) [protected]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • SaveBarState(CSize &size) [protected, virtual]
  • SetChild(CWnd *pWnd) [protected, virtual]
  • SetMenuID(UINT popupMenuID, UINT popToolbarID=0, int nPos=0) [virtual]
  • SetNormalSize(const CSize &cs) [virtual]
  • ShowFrameControls(BOOL bGripper=TRUE, BOOL bButtons=TRUE) [virtual]
  • ~CCJControlBar() [virtual]
Generated on Sun Oct 21 12:46:12 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJDateTimeCtrl Member List

This is the complete list of members for CCJDateTimeCtrl, including all inherited members.
  • CCJDateTimeCtrl()
  • Create(DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
  • GetMonthCalColor(int iColor) const
  • GetMonthCalCtrl() const
  • GetMonthCalFont() const
  • GetRange(COleDateTime *pMinRange, COleDateTime *pMaxRange) const
  • GetRange(CTime *pMinRange, CTime *pMaxRange) const
  • GetTime(CTime &timeDest) const
  • GetTime(COleDateTime &timeDest) const
  • GetTime(LPSYSTEMTIME pTimeDest) const
  • SetFormat(LPCTSTR pstrFormat)
  • SetMonthCalColor(int iColor, COLORREF ref)
  • SetMonthCalFont(HFONT hFont, BOOL bRedraw=TRUE)
  • SetRange(const COleDateTime *pMinRange, const COleDateTime *pMaxRange)
  • SetRange(const CTime *pMinRange, const CTime *pMaxRange)
  • SetTime(const CTime *pTimeNew)
  • SetTime(const COleDateTime &timeNew)
  • SetTime(LPSYSTEMTIME pTimeNew=NULL)
  • ~CCJDateTimeCtrl() [virtual]
Generated on Sun Oct 21 12:46:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJMonthCalCtrl Member List

This is the complete list of members for CCJMonthCalCtrl, including all inherited members.
  • CCJMonthCalCtrl()
  • Create(DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
  • Create(DWORD dwStyle, const POINT &pt, CWnd *pParentWnd, UINT nID)
  • GetColor(int nRegion) const
  • GetCurSel(LPSYSTEMTIME pDateTime) const
  • GetCurSel(CTime &refDateTime) const
  • GetCurSel(COleDateTime &refDateTime) const
  • GetFirstDayOfWeek(BOOL *pbLocal=NULL) const
  • GetMaxSelCount() const
  • GetMinReqRect(RECT *pRect) const
  • GetMonthDelta() const
  • GetMonthRange(COleDateTime &refMinRange, COleDateTime &refMaxRange, DWORD dwFlags) const
  • GetMonthRange(CTime &refMinRange, CTime &refMaxRange, DWORD dwFlags) const
  • GetMonthRange(LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange, DWORD dwFlags) const
  • GetRange(COleDateTime *pMinRange, COleDateTime *pMaxRange) const
  • GetRange(CTime *pMinRange, CTime *pMaxRange) const
  • GetRange(LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange) const
  • GetSelRange(COleDateTime &refMinRange, COleDateTime &refMaxRange) const
  • GetSelRange(CTime &refMinRange, CTime &refMaxRange) const
  • GetSelRange(LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange) const
  • GetToday(CTime &refTime) const
  • GetToday(COleDateTime &refDateTime) const
  • GetToday(LPSYSTEMTIME pDateTime) const
  • HitTest(PMCHITTESTINFO pMCHitTest)
  • SetColor(int nRegion, COLORREF ref)
  • SetCurSel(const LPSYSTEMTIME pDateTime)
  • SetCurSel(const CTime &refDateTime)
  • SetCurSel(const COleDateTime &refDateTime)
  • SetDayState(int nMonths, LPMONTHDAYSTATE pStates)
  • SetFirstDayOfWeek(int iDay, int *lpnOld=NULL)
  • SetMaxSelCount(int nMax)
  • SetMonthDelta(int iDelta)
  • SetRange(const COleDateTime *pMinRange, const COleDateTime *pMaxRange)
  • SetRange(const CTime *pMinRange, const CTime *pMaxRange)
  • SetRange(const LPSYSTEMTIME pMinRange, const LPSYSTEMTIME pMaxRange)
  • SetSelRange(const COleDateTime &pMinRange, const COleDateTime &pMaxRange)
  • SetSelRange(const CTime &pMinRange, const CTime &pMaxRange)
  • SetSelRange(const LPSYSTEMTIME pMinRange, const LPSYSTEMTIME pMaxRange)
  • SetToday(const COleDateTime &refDateTime)
  • SetToday(const CTime *pDateTime)
  • SetToday(const LPSYSTEMTIME pDateTime)
  • SizeMinReq(BOOL bRepaint=TRUE)
  • ~CCJMonthCalCtrl() [virtual]
Generated on Sun Oct 21 12:46:42 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJDockBar Member List

This is the complete list of members for CCJDockBar, including all inherited members.
  • CalcFixedLayout(BOOL bStretch, BOOL bHorz) [virtual]
  • CCJDockBar()
  • ~CCJDockBar() [virtual]
Generated on Sun Oct 21 12:46:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJDockContext Member List

This is the complete list of members for CCJDockContext, including all inherited members.
  • CanDockDockBar()
  • CanDockDockBar(CRect rect, DWORD dwDockStyle, CDockBar **ppDockBar=NULL)
  • CCJDockContext(CControlBar *pBar)
  • DockSizeBar(CControlBar *, CCJSizeDockBar *=NULL, LPRECT=NULL)
  • EndDragDockBar()
  • GetDockBar(DWORD dwOverDockStyle)
  • m_ptOrig
  • MoveDockBar(CPoint pt)
  • StartDragDockBar(CPoint pt)
  • StartResize(int nHitTest, CPoint pt) [virtual]
  • Stretch(CPoint pt)
  • ToggleDocking() [virtual]
  • TrackDockBar()
  • ~CCJDockContext() [virtual]
Generated on Sun Oct 21 12:46:14 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJExplorerBar Member List

This is the complete list of members for CCJExplorerBar, including all inherited members.
  • CalcDynamicLayout(int nLength, DWORD nMode) [virtual]
  • CCJControlBar()
  • CCJExplorerBar()
  • Create(CWnd *pParentWnd, UINT nID, LPCTSTR lpszWindowName=NULL, CSize sizeDefault=CSize(200, 100), DWORD dwStyle=CBRS_LEFT) [virtual]
  • CCJControlBar::Create(CWnd *pParentWnd, UINT nID, LPCTSTR lpszWindowName=NULL, CSize sizeDefault=CSize(200, 100), DWORD dwStyle=CBRS_LEFT, BOOL bFlatBorders=FALSE) [virtual]
  • DrawBorders(CDC *pDC, CRect &rect) [protected, virtual]
  • DrawGriperCaption(CDC *pDC, LPRECT pRect) [protected, virtual]
  • DrawGripper(CDC *pDC) [protected, virtual]
  • EnableDockingOnSizeBar(DWORD dwDockStyle) [virtual]
  • EnableFlatLook(BOOL bFlat=TRUE) [virtual]
  • EnableFlatLook(BOOL bGripper, BOOL bBorder, BOOL bButtons) [virtual]
  • EnableSaveState(bool bAutoSave=true) [virtual]
  • EraseNonClient() [protected, virtual]
  • GetButtonRect() [protected, virtual]
  • GetChildRect(CRect &rect) [virtual]
  • GetGripperRect() [protected, virtual]
  • GetHorzSize() [virtual]
  • GetMenuID() [virtual]
  • GetMinExt() [virtual]
  • GetVertSize() [virtual]
  • HitTest(CPoint &point) [protected, virtual]
  • IsBottomDocked() const [virtual]
  • IsFloating() const [virtual]
  • IsHorzDocked() const [virtual]
  • IsLeftDocked() const [virtual]
  • IsRightDocked() const [virtual]
  • IsTopDocked() const [virtual]
  • IsVertDocked() const [virtual]
  • LoadBarState(CSize &size, int nID) [protected, virtual]
  • m_bAutoSave [protected]
  • m_bButtons [protected]
  • m_bDragging [protected]
  • m_bFlatBorder [protected]
  • m_bFlatGripper [protected]
  • m_bFloating [protected]
  • m_bGripper [protected]
  • m_bMaximized [protected]
  • m_bOkToDrag [protected]
  • m_btnClose [protected]
  • m_btnMinim [protected]
  • m_bToFit
  • m_bUnique
  • m_Caption [protected]
  • m_CaptionButton [protected]
  • m_cxOffset [protected]
  • m_cyOffset [protected]
  • m_eAuxIndex [protected]
  • m_eChildBorder
  • m_hAuxIcon [protected]
  • m_hIcon [protected]
  • m_ImageList [protected]
  • m_nID [protected]
  • m_nPos [protected]
  • m_pChildWnd [protected]
  • m_popToolbarID [protected]
  • m_popupMenu [protected]
  • m_popupMenuID [protected]
  • m_ptCurDrag [protected]
  • m_ptStartDrag [protected]
  • m_rcTrack [protected]
  • m_sizeDesired [protected]
  • m_sizeFloat [protected]
  • m_sizeHorz [protected]
  • m_sizeNormal [protected]
  • m_sizeVert [protected]
  • m_strCaption [protected]
  • m_strSection [protected]
  • m_ToolTip [protected]
  • Maximize(int size) [virtual]
  • Minimize() [virtual]
  • Normalize() [virtual]
  • OnButtonClose() [protected]
  • OnButtonMinimize() [protected]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu) [protected]
  • OnInvertTracker(const CRect &rect) [protected, virtual]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) [protected]
  • OnMenuChar(UINT nChar, UINT nFlags, CMenu *pMenu) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnNcHitTest(CPoint point) [protected]
  • OnNcPaint() [protected]
  • OnPaint() [protected]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnUpdateButtonClose(CCmdUI *pCmdUI) [protected]
  • OnUpdateButtonMinimize(CCmdUI *pCmdUI) [protected]
  • OnUpdateCmdUI(CFrameWnd *pTarget, BOOL bDisableIfNoHndler) [virtual]
  • OnWindowPosChanged(WINDOWPOS *lpwndpos) [protected]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • SaveBarState(CSize &size) [protected, virtual]
  • SetChild(CWnd *pWnd) [protected, virtual]
  • SetMenuID(UINT popupMenuID, UINT popToolbarID=0, int nPos=0) [virtual]
  • SetNormalSize(const CSize &cs) [virtual]
  • ShowFrameControls(BOOL bGripper=TRUE, BOOL bButtons=TRUE) [virtual]
  • ~CCJControlBar() [virtual]
  • ~CCJExplorerBar() [virtual]
Generated on Sun Oct 21 12:46:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJFlatButton Member List

This is the complete list of members for CCJFlatButton, including all inherited members.
  • CCJFlatButton()
  • DisableFlatLook(BOOL bDisable=FALSE) [virtual]
  • DrawButtonBitmap(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonIcon(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawButtonText(CDC *pDC, UINT nState, CRect &rcItem) [protected, virtual]
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • m_bAltColor [protected]
  • m_bFlatLook [protected]
  • m_bLBtnDown [protected]
  • m_bMouseOver [protected]
  • m_bPainted [protected]
  • m_clrAltHilite [protected]
  • m_clrAltNormal [protected]
  • m_clrAltShadow [protected]
  • m_clrAltTextNm [protected]
  • m_clrDkShad [protected]
  • m_clrHilite [protected]
  • m_clrNormal [protected]
  • m_clrShadow [protected]
  • m_clrTextGy [protected]
  • m_clrTextNm [protected]
  • m_Font [protected]
  • m_hCursor [protected]
  • m_hPushed [protected]
  • m_pFont [protected]
  • m_sizeIcon [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnLButtonDblClk(UINT nFlags, CPoint point) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnSysColorChange() [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • SetAlternateColors(COLORREF clrAltNormal, COLORREF clrAltHilite, COLORREF clrAltShadow, COLORREF clrAltTextNm) [virtual]
  • SetButtonFont(CFont *pFont) [virtual]
  • SetIcon(HICON hIcon, CSize size) [virtual]
  • SetIcon(HICON hIcon, HICON hPushed, CSize size) [virtual]
  • UpdateFont() [protected, virtual]
  • ~CCJFlatButton() [virtual]
Generated on Sun Oct 21 12:46:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJFlatComboBox Member List

This is the complete list of members for CCJFlatComboBox, including all inherited members.
  • CCJFlatComboBox()
  • DrawCombo(STATE eState, COLORREF clrTopLeft, COLORREF clrBottomRight, CDC *pDC=NULL) [protected, virtual]
  • EnableAutoCompletion(BOOL bEnable=TRUE) [virtual]
  • IsWin95()
  • m_bAutoComp [protected]
  • m_bHasFocus [protected]
  • m_bLBtnDown [protected]
  • m_bPainted [protected]
  • m_clrHilite [protected]
  • m_clrNormal [protected]
  • m_clrShadow [protected]
  • NORMAL enum value [protected]
  • OnEditUpdate() [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnKillFocus() [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • OnSetFocus() [protected]
  • OnSysColorChange() [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • PointInRect() [virtual]
  • PRESSED enum value [protected]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • RAISED enum value [protected]
  • STATE enum name [protected]
  • ~CCJFlatComboBox() [virtual]
Generated on Sun Oct 21 12:46:17 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJFlatHeaderCtrl Member List

This is the complete list of members for CCJFlatHeaderCtrl, including all inherited members.
  • CCJFlatHeaderCtrl()
  • CCJFlatHeaderCtrl::GetItemCount() const [protected, virtual]
  • DrawFlatBorder(CDC *pDC) [protected, virtual]
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • GetMenuID() [virtual]
  • GetOrderArray(LPINT piArray, int iCount=-1) [protected, virtual]
  • InitializeHeader(bool bBoldFont) [virtual]
  • m_bBoldFont [protected]
  • m_bLBtnDown [protected]
  • m_bSortAsc [protected]
  • m_Font [protected]
  • m_nOffset [protected]
  • m_nPos [protected]
  • m_nSortCol [protected]
  • m_popToolbarID [protected]
  • m_popupMenu [protected]
  • m_popupMenuID [protected]
  • m_pParentWnd [protected]
  • m_rcOldSize [protected]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu) [protected]
  • OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) [protected]
  • OnMenuChar(UINT nChar, UINT nFlags, CMenu *pMenu) [protected]
  • OnPaint() [protected]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • OnWindowPosChanged(WINDOWPOS *lpwndpos) [protected]
  • PreSubclassWindow() [protected, virtual]
  • ResizeWindow() [protected, virtual]
  • SetFontBold(BOOL bBoldFont=TRUE) [virtual]
  • SetMenuID(UINT popupMenuID, UINT popToolbarID=0, int nPos=0) [virtual]
  • SetSortImage(int nCol, BOOL bAsc) [virtual]
  • ~CCJFlatHeaderCtrl() [virtual]
Generated on Sun Oct 21 12:46:18 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJFlatSplitterWnd Member List

This is the complete list of members for CCJFlatSplitterWnd, including all inherited members.
  • CCJFlatSplitterWnd()
  • DisableFlatStyle(BOOL bDisable=TRUE) [virtual]
  • HideColumn(int nColHide) [virtual]
  • HideRow(int nRowHide) [virtual]
  • m_bFlatSplitter [protected]
  • m_nHiddenCol [protected]
  • m_nHiddenRow [protected]
  • OnDrawSplitter(CDC *pDC, ESplitType nType, const CRect &rect) [virtual]
  • OnPaint() [protected]
  • ReplaceView(int nRow, int nCol, CRuntimeClass *pViewClass) [virtual]
  • ShowColumn() [virtual]
  • ShowRow() [virtual]
  • SwitchView(int nRow, int nCol, CView *pNewView) [virtual]
  • ~CCJFlatSplitterWnd() [virtual]
Generated on Sun Oct 21 12:46:19 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJFlatTabCtrl Member List

This is the complete list of members for CCJFlatTabCtrl, including all inherited members.
  • CCJFlatTabCtrl()
  • CreateTabFont(const int iTabHeight) [private]
  • DeleteAllItems() [virtual]
  • DeleteItem(int nItem) [virtual]
  • DrawTab(CDC &dc, const int x, const int y, const int iHeight, bool bSelected, bool bBottom, LPCTSTR lpszTab) const [private]
  • EnableButtons(void) [private]
  • GetCurSel() const [inline, virtual]
  • GetItemCount() const [inline, virtual]
  • GetItemRect(int nItem, LPRECT lpRect) [virtual]
  • GetTabWidth(const int nItem) const [private]
  • GetTipText(int nItem) [virtual]
  • GetTotalArrowWidth(void) const [private]
  • GetTotalTabWidth(void) const [private]
  • HitTest(TCHITTESTINFO *pHitTestInfo) const [virtual]
  • Home() [virtual]
  • InsertItem(const int nItem, LPCTSTR lpszItem) [virtual]
  • InvalidateTabs(void) [private]
  • m_bHasArrows [private]
  • m_bHasHomeEnd [private]
  • m_BoldFont [private]
  • m_bTabsOnBottom [private]
  • m_Font [private]
  • m_hEndArrow [private]
  • m_hEndArrowDisabled [private]
  • m_hHomeArrow [private]
  • m_hHomeArrowDisabled [private]
  • m_hLeftArrow [private]
  • m_hLeftArrowDisabled [private]
  • m_hRightArrow [private]
  • m_hRightArrowDisabled [private]
  • m_iClientHeight [private]
  • m_iClientWidth [private]
  • m_iCurSel [private]
  • m_iTotalTabWidth [private]
  • m_iXOffset [private]
  • m_pEndButton [private]
  • m_pHomeButton [private]
  • m_pLeftButton [private]
  • m_pRightButton [private]
  • m_TabList [private]
  • m_TabTipList [private]
  • m_ToolTip [private]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnEndArrow() [protected]
  • OnHomeArrow() [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLeftArrow() [protected]
  • OnPaint() [protected]
  • OnRightArrow() [protected]
  • OnSize(UINT nType, int cx, int cy) [protected]
  • PreCreateWindow(CREATESTRUCT &cs) [protected, virtual]
  • PreTranslateMessage(MSG *pMsg) [protected, virtual]
  • SetCurSel(int nItem) [virtual]
  • SetTipText(int nItem, LPCTSTR lpszTabTip) [virtual]
  • ~CCJFlatTabCtrl() [virtual]
Generated on Sun Oct 21 12:46:20 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJFontCombo Member List

This is the complete list of members for CCJFontCombo, including all inherited members.
  • CCJFontCombo()
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • EnumFontProc(LPLOGFONT lpLogFont, LPTEXTMETRIC lpTextMetric, short nFontType, LPHANDLE lpData) [static]
  • GetSelFont(LOGFONT &logFont) [virtual]
  • InitializeFonts() [protected, virtual]
  • m_clrBkgnd [protected]
  • m_clrHilight [protected]
  • m_clrHilightText [protected]
  • m_clrNormalText [protected]
  • MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) [virtual]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnDestroy() [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnPaint() [protected]
  • PreSubclassWindow() [protected, virtual]
  • SetHilightColors(COLORREF clrHilight, COLORREF clrHilightText) [virtual]
  • SetNormalColors(COLORREF clrBkgnd, COLORREF clrNormalText) [virtual]
  • ~CCJFontCombo() [virtual]
Generated on Sun Oct 21 12:46:21 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJFrameWnd Member List

This is the complete list of members for CCJFrameWnd, including all inherited members.
  • brdrAllRaised enum value [protected]
  • brdrFlatAll enum value [protected]
  • brdrFlatBottom enum value [protected]
  • brdrFlatHorizontal enum value [protected]
  • brdrFlatLeft enum value [protected]
  • brdrFlatRight enum value [protected]
  • brdrFlatTop enum value [protected]
  • brdrFlatVertical enum value [protected]
  • CCJFrameWnd()
  • DockControlBarLeftOf(CControlBar *Bar, CControlBar *LeftOf) [virtual]
  • DockFlatBorders enum name [protected]
  • DockSizeBar(CControlBar *pBar, CCJSizeDockBar *pDockBar=NULL, LPRECT lpRect=NULL) [virtual]
  • dwDockBarMap [protected, static]
  • EnableDocking(DWORD dwDockStyle) [virtual]
  • EnableDockingSizeBar(DWORD dwDockStyle, DockFlatBorders FlatFlags=brdrAllRaised) [virtual]
  • InitializeMenu(UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=0) [virtual]
  • InitializeMenu(UINT nMenuID, UINT nToolbarID=NULL) [virtual]
  • LoadBarState(LPCTSTR lpszProfileName) [virtual]
  • m_menu [protected]
  • m_wndMenuBar [protected]
  • NewMenu(UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=0) [protected, virtual]
  • NewMenu(UINT nMenuID, UINT nToolbarID=NULL) [protected, virtual]
  • OnClose() [protected]
  • OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu) [protected]
  • OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) [protected]
  • OnMenuChar(UINT nChar, UINT nFlags, CMenu *pMenu) [protected]
  • PreCreateWindow(CREATESTRUCT &cs) [protected, virtual]
  • PreCreateWindow(CREATESTRUCT &cs, UINT nIconID) [protected, virtual]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • RecalcAllExcept(CCJSizeDockBar *pBar) [virtual]
  • RecalcLayout(BOOL bNotify=TRUE) [virtual]
  • SaveBarState(LPCTSTR lpszProfileName) const [virtual]
  • ~CCJFrameWnd() [virtual]
Generated on Sun Oct 21 12:46:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJHexEdit Member List

This is the complete list of members for CCJHexEdit, including all inherited members.
  • CalcPos(int x, int y) [protected, virtual]
  • CCJHexEdit()
  • Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL) [virtual]
  • CreateAddressCaret(void) [protected, virtual]
  • CreateEditCaret(void) [protected, virtual]
  • EDIT_ASCII enum value
  • EDIT_HIGH enum value
  • EDIT_LOW enum value
  • EDIT_NONE enum value
  • EDITMODE enum name
  • GetData(LPBYTE p, int len) [virtual]
  • GetSel(void) [virtual]
  • IsSelected(void) [protected, virtual]
  • m_bAddressIsWide
  • m_bHalfPage
  • m_bNoAddressChange
  • m_bpr
  • m_bShowAddress
  • m_bShowAscii
  • m_bShowHex
  • m_bUpdate
  • m_currentAddress
  • m_currentMode
  • m_editPos
  • m_Font
  • m_length
  • m_lineHeight
  • m_lpp
  • m_nullWidth
  • m_offAddress
  • m_offAscii
  • m_offHex
  • m_pData
  • m_selEnd
  • m_selStart
  • m_topindex
  • Move(int x, int y) [protected, virtual]
  • NormalizeSel(void) [protected, virtual]
  • OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) [protected]
  • OnContextMenu(CWnd *, CPoint point) [protected]
  • OnEditClear() [protected]
  • OnEditCopy() [protected]
  • OnEditCut() [protected]
  • OnEditPaste() [protected]
  • OnEditSelectAll() [protected]
  • OnEditUndo() [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnGetDlgCode() [protected]
  • OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar) [protected]
  • OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) [protected]
  • OnKillFocus(CWnd *pNewWnd) [protected]
  • OnLButtonDblClk(UINT nFlags, CPoint point) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • OnSetFocus(CWnd *pOldWnd) [protected]
  • OnVScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar) [protected]
  • PreCreateWindow(CREATESTRUCT &cs) [protected, virtual]
  • RepositionCaret(int p) [protected, virtual]
  • ScrollIntoView(int p) [protected, virtual]
  • SelDelete(int s, int e) [protected, virtual]
  • SelInsert(int s, int l) [protected, virtual]
  • SetBPR(int bpr) [virtual]
  • SetData(LPBYTE p, int len) [virtual]
  • SetOptions(BOOL a, BOOL h, BOOL c, BOOL w) [virtual]
  • SetSel(int s, int e) [virtual]
  • UpdateScrollbars(void) [protected, virtual]
  • ~CCJHexEdit() [virtual]
Generated on Sun Oct 21 12:46:24 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJHtmlView Member List

This is the complete list of members for CCJHtmlView, including all inherited members.
  • BeforeNavigate2(LPDISPATCH pDisp, VARIANT *URL, VARIANT *Flags, VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers, BOOL *Cancel) [protected, virtual]
  • CCJHtmlView() [protected]
  • Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL) [virtual]
  • DocumentComplete(LPDISPATCH pDisp, VARIANT *URL) [protected, virtual]
  • ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
  • GetAddressBar() const
  • GetApplication() const
  • GetBusy() const
  • GetContainer() const
  • GetFullName() const
  • GetFullScreen() const
  • GetHeight() const
  • GetHtmlDocument() const
  • GetLeft() const
  • GetLocationName() const
  • GetLocationURL() const
  • GetMenuBar() const
  • GetOffline() const
  • GetParentBrowser() const
  • GetProperty(LPCTSTR lpszProperty, CString &strValue)
  • GetProperty(LPCTSTR lpszProperty)
  • GetReadyState() const
  • GetRegisterAsBrowser() const
  • GetRegisterAsDropTarget() const
  • GetSilent() const
  • GetStatusBar() const
  • GetTheaterMode() const
  • GetToolBar() const
  • GetTop() const
  • GetTopLevelContainer() const
  • GetType() const
  • GetVisible() const
  • GoBack()
  • GoForward()
  • GoHome()
  • GoSearch()
  • LoadFromResource(LPCTSTR lpszResource)
  • LoadFromResource(UINT nRes)
  • m_pBrowserApp [protected]
  • m_wndBrowser
  • Navigate(LPCTSTR URL, DWORD dwFlags=0, LPCTSTR lpszTargetFrameName=NULL, LPCTSTR lpszHeaders=NULL, LPVOID lpvPostData=NULL, DWORD dwPostDataLen=0)
  • Navigate2(LPITEMIDLIST pIDL, DWORD dwFlags=0, LPCTSTR lpszTargetFrameName=NULL)
  • Navigate2(LPCTSTR lpszURL, DWORD dwFlags=0, LPCTSTR lpszTargetFrameName=NULL, LPCTSTR lpszHeaders=NULL, LPVOID lpvPostData=NULL, DWORD dwPostDataLen=0)
  • Navigate2(LPCTSTR lpszURL, DWORD dwFlags, CByteArray &baPostedData, LPCTSTR lpszTargetFrameName=NULL, LPCTSTR lpszHeader=NULL)
  • NavigateComplete2(LPDISPATCH pDisp, VARIANT *URL) [protected, virtual]
  • OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray &baPostedData, LPCTSTR lpszHeaders, BOOL *pbCancel) [virtual]
  • OnCommandStateChange(long nCommand, BOOL bEnable) [virtual]
  • OnDestroy() [protected]
  • OnDocumentComplete(LPCTSTR lpszURL) [virtual]
  • OnDownloadBegin() [virtual]
  • OnDownloadComplete() [virtual]
  • OnDraw(CDC *pDC) [virtual]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnFilePrint() [protected]
  • OnFullScreen(BOOL bFullScreen) [virtual]
  • OnMenuBar(BOOL bMenuBar) [virtual]
  • OnNavigateComplete2(LPCTSTR strURL) [virtual]
  • OnNewWindow2(LPDISPATCH *ppDisp, BOOL *Cancel) [virtual]
  • OnPaint() [protected]
  • OnProgressChange(long nProgress, long nProgressMax) [virtual]
  • OnPropertyChange(LPCTSTR lpszProperty) [virtual]
  • OnQuit() [virtual]
  • OnSize(UINT nType, int cx, int cy) [protected]
  • OnStatusBar(BOOL bStatusBar) [virtual]
  • OnStatusTextChange(LPCTSTR lpszText) [virtual]
  • OnTheaterMode(BOOL bTheaterMode) [virtual]
  • OnTitleChange(LPCTSTR lpszText) [virtual]
  • OnToolBar(BOOL bToolBar) [virtual]
  • OnVisible(BOOL bVisible) [virtual]
  • PutProperty(LPCTSTR lpszProperty, const VARIANT &vtValue)
  • PutProperty(LPCTSTR lpszPropertyName, double dValue)
  • PutProperty(LPCTSTR lpszPropertyName, LPCTSTR lpszValue)
  • PutProperty(LPCTSTR lpszPropertyName, long lValue)
  • PutProperty(LPCTSTR lpszPropertyName, short nValue)
  • QueryStatusWB(OLECMDID cmdID) const
  • Refresh()
  • Refresh2(int nLevel)
  • SetAddressBar(BOOL bNewValue)
  • SetFullScreen(BOOL bNewValue)
  • SetHeight(long nNewValue)
  • SetLeft(long nNewValue)
  • SetMenuBar(BOOL bNewValue)
  • SetOffline(BOOL bNewValue)
  • SetRegisterAsBrowser(BOOL bNewValue)
  • SetRegisterAsDropTarget(BOOL bNewValue)
  • SetSilent(BOOL bNewValue)
  • SetStatusBar(BOOL bNewValue)
  • SetTheaterMode(BOOL bNewValue)
  • SetToolBar(int nNewValue)
  • SetTop(long nNewValue)
  • SetVisible(BOOL bNewValue)
  • Stop()
  • ~CCJHtmlView() [protected, virtual]
Generated on Sun Oct 21 12:46:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJHyperLink Member List

This is the complete list of members for CCJHyperLink, including all inherited members.
  • CCJHyperLink()
  • CtlColor(CDC *pDC, UINT nCtlColor) [protected]
  • GetAutoSize() const [virtual]
  • GetHoverColor() const [virtual]
  • GetLinkColor() const [virtual]
  • GetLinkCursor() const [virtual]
  • GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata) [protected, virtual]
  • GetUnderline() const [virtual]
  • GetURL() const [virtual]
  • GetVisited() const [virtual]
  • GetVisitedColor() const [virtual]
  • GotoURL(LPCTSTR url, int showcmd) [virtual]
  • m_bAdjustToFit [protected]
  • m_bOverControl [protected]
  • m_bUnderline [protected]
  • m_bVisited [protected]
  • m_crHoverColor [protected]
  • m_crLinkColor [protected]
  • m_crVisitedColor [protected]
  • m_Font [protected]
  • m_hLinkCursor [protected]
  • m_strURL [protected]
  • m_ToolTip [protected]
  • OnClicked() [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • PositionWindow() [protected, virtual]
  • PreSubclassWindow() [protected, virtual]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • ReportError(int nError) [protected, virtual]
  • SetAutoSize(BOOL bAutoSize=TRUE) [virtual]
  • SetColors(COLORREF crLinkColor, COLORREF crVisitedColor, COLORREF crHoverColor=-1) [virtual]
  • SetDefaultCursor() [protected, virtual]
  • SetLinkCursor(HCURSOR hCursor) [virtual]
  • SetUnderline(BOOL bUnderline=TRUE) [virtual]
  • SetURL(CString strURL) [virtual]
  • SetVisited(BOOL bVisited=TRUE) [virtual]
  • ~CCJHyperLink() [virtual]
Generated on Sun Oct 21 12:46:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJListBox Member List

This is the complete list of members for CCJListBox, including all inherited members.
  • CCJListBox()
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnPaint() [protected]
  • ~CCJListBox() [virtual]
Generated on Sun Oct 21 12:46:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJListCtrl Member List

This is the complete list of members for CCJListCtrl, including all inherited members.
  • AddColumn(LPCTSTR lpszColHeading, int nWidth=-1, int nFormat=LVCFMT_LEFT) [virtual]
  • AutoSaveColumns(LPCTSTR lpszSection=NULL, LPCTSTR lpszEntry=NULL, LPCTSTR lpszDefault=NULL) [virtual]
  • AutoSizeColumn(int nCol=-1) [virtual]
  • BuildColumns(int nCols, int *nWidth, CString *strColString) [virtual]
  • BuildColumns(int nCols, int *nWidth, int *nColString) [virtual]
  • CCJListCtrl()
  • CopyRow(int nFrom, int nTo) [virtual]
  • DisableColumnSizing(bool bDisable) [virtual]
  • GetColumnCount() const [virtual]
  • GetExtendedStyle() [virtual]
  • GetStoredWidth(int nCol) [virtual]
  • HitTestEx(CPoint &point, int *col) const [virtual]
  • LoadColumnWidths() [virtual]
  • m_bAscending [protected]
  • m_bAutoSave [private]
  • m_bNoColSizing [protected]
  • m_clrText [protected]
  • m_clrTextBk [protected]
  • m_nMaxColWidth [protected]
  • m_nMinColWidth [protected]
  • m_nMinSize [protected]
  • m_nSortedCol [protected]
  • m_pHeaderCtrl [protected]
  • m_pListCtrl [protected]
  • m_strDefault [protected]
  • m_strEntry [protected]
  • m_strSection [protected]
  • MoveRow(int nFrom, int nTo) [virtual]
  • OnCustomDraw(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnDestroy() [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult) [protected, virtual]
  • OnPaint() [protected]
  • SaveColumnWidths() [virtual]
  • SetColumnWidth(int nCol) [virtual]
  • SetExtendedStyle(DWORD dwExStyle) [virtual]
  • SetMinimumColSize(int nSize) [virtual]
  • SetRowColors(COLORREF clrText, COLORREF clrTextBk) [virtual]
  • SortList(int nCol, bool bAscending) [virtual]
  • SubclassHeader(bool bBoldFont=false) [virtual]
  • ~CCJListCtrl() [virtual]
Generated on Sun Oct 21 12:46:29 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJListView Member List

This is the complete list of members for CCJListView, including all inherited members.
  • AddColumn(LPCTSTR lpszColHeading, int nWidth=-1, int nFormat=LVCFMT_LEFT) [virtual]
  • AutoSaveColumns(LPCTSTR lpszSection=NULL, LPCTSTR lpszEntry=NULL, LPCTSTR lpszDefault=NULL) [virtual]
  • AutoSizeColumn(int nCol=-1) [virtual]
  • BuildColumns(int nCols, int *nWidth, CString *strColString) [virtual]
  • BuildColumns(int nCols, int *nWidth, int *nColString) [virtual]
  • CCJListView()
  • CopyRow(int nFrom, int nTo) [virtual]
  • DisableColumnSizing(bool bDisable) [virtual]
  • GetColumnCount() const [virtual]
  • GetExtendedStyle() [virtual]
  • GetStoredWidth(int nCol) [virtual]
  • HitTestEx(CPoint &point, int *col) const [virtual]
  • LoadColumnWidths() [virtual]
  • m_bAscending [private]
  • m_bAutoSave [private]
  • m_bNoColSizing [protected]
  • m_clrText [protected]
  • m_clrTextBk [protected]
  • m_nMaxColWidth [protected]
  • m_nMinColWidth [protected]
  • m_nMinSize [protected]
  • m_nSortedCol [protected]
  • m_pHeaderCtrl [protected]
  • m_pListCtrl [protected]
  • m_strDefault [protected]
  • m_strEntry [protected]
  • m_strSection [protected]
  • MoveRow(int nFrom, int nTo) [virtual]
  • OnCustomDraw(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnDestroy() [protected]
  • OnDraw(CDC *pDC) [protected, virtual]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnInitialUpdate() [virtual]
  • OnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult) [protected, virtual]
  • SaveColumnWidths() [virtual]
  • SetColumnWidth(int nCol) [virtual]
  • SetExtendedStyle(DWORD dwExStyle) [virtual]
  • SetMinimumColSize(int nSize) [virtual]
  • SetRowColors(COLORREF clrText, COLORREF clrTextBk) [virtual]
  • SortList(int nCol, bool bAscending) [virtual]
  • SubclassHeader(bool bBoldFont=false) [virtual]
  • ~CCJListView() [virtual]
Generated on Sun Oct 21 12:46:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJLogoPane Member List

This is the complete list of members for CCJLogoPane, including all inherited members.
  • CCJLogoPane()
  • Create(LPCTSTR lpszWindowName, DWORD dwStyle, CWnd *pParentWnd, UINT nID) [virtual]
  • GetLogoText() [virtual]
  • m_Font
  • m_strLogoText
  • OnPaint() [protected]
  • SetLogoFont(LPCTSTR lpszFontName, int nHeight=24, int nWeight=FW_BOLD, BOOL bItalic=TRUE, BOOL bUnderline=FALSE) [virtual]
  • SetLogoText(LPCTSTR lpszLogoText) [virtual]
  • ~CCJLogoPane() [virtual]
Generated on Sun Oct 21 12:46:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJMaskEdit Member List

This is the complete list of members for CCJMaskEdit, including all inherited members.
  • CCJMaskEdit()
  • CheckChar(UINT nChar) [virtual]
  • m_bMaskKeyInProgress
  • m_bUseMask
  • m_Font
  • m_strLiteral
  • m_strMask
  • m_strMaskLiteral
  • m_strValid
  • m_strWindowText
  • OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) [protected]
  • OnPaint() [protected]
  • ProcessMask(UINT nChar, int nEndPos) [virtual]
  • SendChar(UINT nChar) [virtual]
  • SetEditMask(LPCTSTR lpszMask, LPCTSTR lpszLiteral, LPCTSTR lpszWindowText) [virtual]
  • UpdateFont() [virtual]
  • ~CCJMaskEdit() [virtual]
Generated on Sun Oct 21 12:46:32 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJDateEdit Member List

This is the complete list of members for CCJDateEdit, including all inherited members.
  • CCJDateEdit()
  • CCJMaskEdit()
  • CheckChar(UINT nChar) [virtual]
  • FormatOleDateTime(CString &strData, COleDateTime dt) [virtual]
  • GetDateTime() [virtual]
  • GetWindowDateTime() [virtual]
  • m_bMaskKeyInProgress
  • m_bUseMask
  • m_Font
  • m_strLiteral
  • m_strMask
  • m_strMaskLiteral
  • m_strValid
  • m_strWindowText
  • OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) [protected]
  • OnPaint() [protected]
  • ProcessMask(UINT nChar, int nEndPos) [virtual]
  • ReadOleDateTime(LPCTSTR lpszData) [virtual]
  • SendChar(UINT nChar) [virtual]
  • SetDateTime(COleDateTime &dt) [virtual]
  • SetDateTime(CString strDate) [virtual]
  • SetEditMask(LPCTSTR lpszMask, LPCTSTR lpszLiteral, LPCTSTR lpszWindowText) [virtual]
  • UpdateFont() [virtual]
  • ~CCJMaskEdit() [virtual]
Generated on Sun Oct 21 12:46:13 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJTimeEdit Member List

This is the complete list of members for CCJTimeEdit, including all inherited members.
  • CCJDateEdit()
  • CCJMaskEdit()
  • CCJTimeEdit()
  • CheckChar(UINT nChar) [virtual]
  • FormatOleDateTime(CString &strData, COleDateTime dt) [virtual]
  • GetDateTime() [virtual]
  • GetWindowDateTime() [virtual]
  • m_bMaskKeyInProgress
  • m_bUseMask
  • m_Font
  • m_strHours
  • m_strLiteral
  • m_strMask
  • m_strMaskLiteral
  • m_strMins
  • m_strValid
  • m_strWindowText
  • OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) [protected]
  • OnPaint() [protected]
  • ProcessMask(UINT nChar, int nEndPos) [virtual]
  • ReadOleDateTime(LPCTSTR lpszData) [virtual]
  • SendChar(UINT nChar) [virtual]
  • SetDateTime(COleDateTime &dt) [virtual]
  • SetDateTime(CString strDate) [virtual]
  • SetEditMask(LPCTSTR lpszMask, LPCTSTR lpszLiteral, LPCTSTR lpszWindowText) [virtual]
  • SetHours(int nHours) [virtual]
  • SetMins(int nMins) [virtual]
  • UpdateFont() [virtual]
  • ~CCJMaskEdit() [virtual]
Generated on Sun Oct 21 12:46:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJMDIChildWnd Member List

This is the complete list of members for CCJMDIChildWnd, including all inherited members.
  • brdrAllRaised enum value [protected]
  • brdrFlatAll enum value [protected]
  • brdrFlatBottom enum value [protected]
  • brdrFlatHorizontal enum value [protected]
  • brdrFlatLeft enum value [protected]
  • brdrFlatRight enum value [protected]
  • brdrFlatTop enum value [protected]
  • brdrFlatVertical enum value [protected]
  • CCJMDIChildWnd()
  • DockControlBarLeftOf(CControlBar *Bar, CControlBar *LeftOf) [protected, virtual]
  • DockFlatBorders enum name [protected]
  • DockSizeBar(CControlBar *pBar, CCJSizeDockBar *pDockBar=NULL, LPRECT lpRect=NULL) [protected, virtual]
  • dwDockBarMap [protected, static]
  • EnableDocking(DWORD dwDockStyle) [protected, virtual]
  • EnableDockingSizeBar(DWORD dwDockStyle, DockFlatBorders FlatFlags=brdrAllRaised) [protected, virtual]
  • GetInitializedMenu(UINT nMenuID, UINT nToolBarID) [virtual]
  • GetInitializedMenu(UINT nMenuID, UINT *nToolbarIDs, int nSize) [virtual]
  • GetMenuID() [virtual]
  • GetToolBarID() [virtual]
  • GetToolBarIDs(int &nCount) [virtual]
  • m_hMenu [protected]
  • m_nCount [protected]
  • m_nMenuID [protected]
  • m_nToolBarID [protected]
  • m_nToolBarIDs [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • RecalcAllExcept(CCJSizeDockBar *pBar) [protected, virtual]
  • RecalcLayout(BOOL bNotify=TRUE) [virtual]
  • SetResourceIDs(UINT nMenuID, UINT nToolBarID) [virtual]
  • SetResourceIDs(UINT nMenuID, UINT *nToolBarIDs, int nCount) [virtual]
  • ~CCJMDIChildWnd() [virtual]
Generated on Sun Oct 21 12:46:33 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJMDIFrameWnd Member List

This is the complete list of members for CCJMDIFrameWnd, including all inherited members.
  • brdrAllRaised enum value [protected]
  • brdrFlatAll enum value [protected]
  • brdrFlatBottom enum value [protected]
  • brdrFlatHorizontal enum value [protected]
  • brdrFlatLeft enum value [protected]
  • brdrFlatRight enum value [protected]
  • brdrFlatTop enum value [protected]
  • brdrFlatVertical enum value [protected]
  • CCJMDIFrameWnd()
  • CCJMDIFrameWnd::InitializeMenu(HMENU *phMenu, UINT nMenuID, UINT nToolbarID=NULL) [virtual]
  • DockControlBarLeftOf(CControlBar *Bar, CControlBar *LeftOf) [virtual]
  • DockFlatBorders enum name [protected]
  • DockSizeBar(CControlBar *pBar, CCJSizeDockBar *pDockBar=NULL, LPRECT lpRect=NULL) [virtual]
  • dwDockBarMap [protected, static]
  • EnableDocking(DWORD dwDockStyle) [virtual]
  • EnableDockingSizeBar(DWORD dwDockStyle, DockFlatBorders FlatFlags=brdrAllRaised) [virtual]
  • InitializeMenu(CMultiDocTemplate *pDocTemplate, UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=0, UINT nDefaultMenuID=NULL) [virtual]
  • InitializeMenu(CMultiDocTemplate *pDocTemplate, UINT nMenuID, UINT nToolbarID=NULL, UINT nDefaultMenuID=NULL) [virtual]
  • InitializeMenu(HMENU *phMenu, UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=NULL) [virtual]
  • LoadBarState(LPCTSTR lpszProfileName) [virtual]
  • m_menuList [protected]
  • m_wndMenuBar [protected]
  • NewMenu(UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=0) [protected, virtual]
  • NewMenu(UINT nMenuID, UINT nToolbarID=NULL) [protected, virtual]
  • OnClose() [protected]
  • OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu) [protected]
  • OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) [protected]
  • OnMenuChar(UINT nChar, UINT nFlags, CMenu *pMenu) [protected]
  • PreCreateWindow(CREATESTRUCT &cs) [protected, virtual]
  • PreCreateWindow(CREATESTRUCT &cs, UINT nIconID) [protected, virtual]
  • RecalcAllExcept(CCJSizeDockBar *pBar) [virtual]
  • RecalcLayout(BOOL bNotify=TRUE) [virtual]
  • SaveBarState(LPCTSTR lpszProfileName) const [virtual]
  • ~CCJMDIFrameWnd() [virtual]
Generated on Sun Oct 21 12:46:34 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJMemFile Member List

This is the complete list of members for CCJMemFile, including all inherited members.
  • Append(CFile *fApp) [protected, virtual]
  • CCJMemFile(UINT nGrowBytes=1024)
  • CCJMemFile(BYTE *lpBuffer, UINT nBufferSize, UINT nGrowBytes=0)
  • CCJMemFile(LPCTSTR lpstFilename, UINT uiOpenFlags)
  • Close() [virtual]
  • Discard() [virtual]
  • Duplicate(CFile *fDuplicate) [virtual]
  • Duplicate(CString strDup) [virtual]
  • Extract(CFile *fDest, DWORD dwStartPos, DWORD dwBytes) [virtual]
  • Extract(CString strDest, DWORD dwStartPos, DWORD dwBytes) [virtual]
  • FindData(void *pData, DWORD dwDataLen, LONG lStartPos)
  • Flush() [virtual]
  • Import(CFile *fImp) [protected, virtual]
  • Insert(CFile *fSrc, DWORD dwSourcePos, DWORD dwDestPos, DWORD dwBytes) [virtual]
  • Insert(CString strSrc, DWORD dwSourcePos, DWORD dwDestPos, DWORD dwBytes) [virtual]
  • Load() [protected, virtual]
  • m_bOpen [private]
  • m_File [private]
  • m_pError [private]
  • m_uiOpenFlags [private]
  • Open(CString strFilename, UINT uiOpenFlags, CFileException *pError=NULL) [virtual]
  • operator+=(CFile *fApp)
  • operator+=(CString strApp)
  • operator=(CFile *fDup)
  • operator=(CString strDup)
  • operator=(DWORD dwFilePos)
  • operator[](DWORD dwFilePos)
  • ReadString(CString &rString) [virtual]
  • Save() [protected, virtual]
  • WriteString(LPCTSTR lpsz) [virtual]
  • ~CCJMemFile() [virtual]
Generated on Sun Oct 21 12:46:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJMenuData Member List

This is the complete list of members for CCJMenuData, including all inherited members.
  • bitmap
  • CCJMenuData() [inline]
  • GetString(void)
  • GetWideString(void) [inline]
  • m_szMenuText [private]
  • menuIconNormal
  • nFlags
  • nID
  • SetAnsiString(LPCSTR szAnsiString)
  • SetWideString(const wchar_t *szWideString)
  • syncflag
  • xoffset
  • ~CCJMenuData()
Generated on Sun Oct 21 12:46:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CMenuItemInfo Member List

This is the complete list of members for CMenuItemInfo, including all inherited members.
  • CMenuItemInfo() [inline]
Generated on Sun Oct 21 12:48:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJMenu Member List

This is the complete list of members for CCJMenu, including all inherited members.
  • AddBitmapToImageList(CImageList *list, UINT nResourceID)
  • AddFromToolBar(CToolBar *pToolBar, int nResourceID)
  • AppendMenuA(UINT nFlags, UINT nIDNewItem=0, LPCTSTR lpszNewItem=NULL) [inline]
  • AppendMenuA(UINT nFlags, UINT nIDNewItem, const CBitmap *pBmp) [inline]
  • AppendMenuA(UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, int nIconNormal=-1)
  • AppendMenuA(UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, CImageList *il, int xoffset)
  • AppendMenuA(UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, CBitmap *bmp)
  • AppendMenuW(UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, int nIconNormal=-1)
  • AppendMenuW(UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, CImageList *il, int xoffset)
  • AppendMenuW(UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, CBitmap *bmp)
  • AppendODMenuA(LPCSTR lpstrText, UINT nFlags=MF_OWNERDRAW, UINT nID=0, int nIconNormal=-1)
  • AppendODMenuA(LPCSTR lpstrText, UINT nFlags, UINT nID, CImageList *il, int xoffset)
  • AppendODMenuW(wchar_t *lpstrText, UINT nFlags=MF_OWNERDRAW, UINT nID=0, int nIconNormal=-1)
  • AppendODMenuW(wchar_t *lpstrText, UINT nFlags, UINT nID, CImageList *il, int xoffset)
  • AppendODPopupMenuA(LPCSTR lpstrText)
  • AppendODPopupMenuW(wchar_t *lpstrText)
  • CCJMenu()
  • CCJMenu::DeleteMenuList(void)
  • CCJMenu::FindMenuList(UINT nID)
  • CCJMenu::InitializeMenuList(int value)
  • checkmaps
  • checkmapsshare
  • DeleteMenu(UINT uiId, UINT nFlags)
  • DestroyMenu() [virtual]
  • disable_old_style [protected]
  • DitherBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HBITMAP hbm, int nXSrc, int nYSrc)
  • DitherBlt2(CDC *drawdc, int nXDest, int nYDest, int nWidth, int nHeight, CBitmap &bmp, int nXSrc, int nYSrc)
  • Draw3DCheckmark(CDC *dc, const CRect &rc, BOOL bSelected, HBITMAP hbmCheck)
  • DrawCheckMark(CDC *pDC, int x, int y, COLORREF color)
  • DrawItem(LPDRAWITEMSTRUCT) [virtual]
  • DrawRadioDot(CDC *pDC, int x, int y, COLORREF color)
  • FindKeyboardShortcut(UINT nChar, UINT nFlags, CMenu *pMenu) [static]
  • FindMenuOption(int nId, int &nLoc)
  • FindMenuOption(wchar_t *lpstrText)
  • GetBitmapFromImageList(CDC *pDC, CImageList *imglist, int nIndex, CBitmap &bmp)
  • GetDisableOldStyle(void)
  • GetMenuText(UINT id, CString &string, UINT nFlags=MF_BYPOSITION)
  • InsertMenuA(UINT nPosition, UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, int nIconNormal=-1)
  • InsertMenuA(UINT nPosition, UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, CImageList *il, int xoffset)
  • InsertMenuA(UINT nPosition, UINT nFlags, UINT nIDNewItem, const char *lpszNewItem, CBitmap *bmp)
  • InsertMenuW(UINT nPosition, UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, int nIconNormal=-1)
  • InsertMenuW(UINT nPosition, UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, CImageList *il, int xoffset)
  • InsertMenuW(UINT nPosition, UINT nFlags, UINT nIDNewItem, wchar_t *lpszNewItem, CBitmap *bmp)
  • InsertODMenuA(UINT nPosition, LPCSTR lpstrText, UINT nFlags=MF_OWNERDRAW, UINT nID=0, int nIconNormal=-1)
  • InsertODMenuA(UINT nPosition, LPCSTR lpstrText, UINT nFlags, UINT nID, CImageList *il, int xoffset)
  • InsertODMenuW(UINT nPosition, wchar_t *lpstrText, UINT nFlags=MF_OWNERDRAW, UINT nID=0, int nIconNormal=-1)
  • InsertODMenuW(UINT nPosition, wchar_t *lpstrText, UINT nFlags, UINT nID, CImageList *il, int xoffset)
  • InsertSpaces(void)
  • IsMenu(CMenu *submenu) [static]
  • IsMenu(HMENU submenu) [static]
  • IsNewShell(void) [static]
  • LoadCheckmarkBitmap(int unselect, int select)
  • LoadFromToolBar(UINT nID, UINT nToolBar, int &xoffset)
  • LoadMenu(LPCTSTR lpszResourceName) [virtual]
  • LoadMenu(int nResource) [virtual]
  • LoadSysColorBitmap(int nResourceId) [static]
  • LoadToolbar(UINT nToolBar)
  • LoadToolbars(const UINT *arID, int n)
  • m_AllSubMenus [protected, static]
  • m_bitmapBackground [protected]
  • m_bitmapBackgroundFlag [protected]
  • m_iconX [protected]
  • m_iconY [protected]
  • m_MenuList [protected]
  • m_selectcheck
  • m_SubMenus [protected]
  • m_unselectcheck
  • MeasureItem(LPMEASUREITEMSTRUCT) [virtual]
  • ModifyODMenuA(const char *lpstrText, UINT nID=0, int nIconNormal=-1)
  • ModifyODMenuA(const char *lpstrText, UINT nID, CImageList *il, int xoffset)
  • ModifyODMenuA(const char *lpstrText, UINT nID, CBitmap *bmp)
  • ModifyODMenuA(const char *lpstrText, const char *OptionText, int nIconNormal)
  • ModifyODMenuW(wchar_t *lpstrText, UINT nID=0, int nIconNormal=-1)
  • ModifyODMenuW(wchar_t *lpstrText, UINT nID, CImageList *il, int xoffset)
  • ModifyODMenuW(wchar_t *lpstrText, UINT nID, CBitmap *bmp)
  • ModifyODMenuW(wchar_t *lpstrText, wchar_t *OptionText, int nIconNormal)
  • NewODMenu(UINT pos, UINT nFlags, UINT nID, CString string)
  • RemoveMenu(UINT uiId, UINT nFlags)
  • SetBitmapBackground(COLORREF color)
  • SetDisableOldStyle(void)
  • SetIconSize(int, int)
  • SynchronizeMenu(void)
  • UnSetBitmapBackground(void)
  • UnSetDisableOldStyle(void)
  • UpdateMenu(CMenu *pmenu) [static]
  • ~CCJMenu() [virtual]
Generated on Sun Oct 21 12:46:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJMenuBarFrameHook Member List

This is the complete list of members for CCJMenuBarFrameHook, including all inherited members.
  • CCJMenuBar class [friend]
  • CCJMenuBarFrameHook() [protected]
  • CSubclassWnd()
  • CSubclassWndMap class [friend]
  • Default() [protected, virtual]
  • HookWindow(HWND hwnd) [virtual]
  • HookWindow(CWnd *pWnd) [inline, virtual]
  • HookWndProc(HWND, UINT, WPARAM, LPARAM) [friend]
  • Install(CCJMenuBar *pMenuBar, HWND hWndToHook) [protected]
  • IsHooked() [inline, virtual]
  • m_hWnd [protected]
  • m_pMenuBar [protected]
  • m_pNext [protected]
  • m_pOldWndProc [protected]
  • WindowProc(UINT msg, WPARAM wp, LPARAM lp) [protected, virtual]
  • ~CCJMenuBarFrameHook() [protected]
  • ~CSubclassWnd()
Generated on Sun Oct 21 12:46:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJMenuBar Member List

This is the complete list of members for CCJMenuBar, including all inherited members.
  • AddButtons(int nNumButtons, LPTBBUTTON lpButtons)
  • AddDropDownButton(UINT nIDButton, UINT nIDMenu, BOOL bArrow=TRUE)
  • AddReplaceBitmap(HBITMAP hbmImageWell)
  • AddStrings(LPCTSTR lpszStrings)
  • AutoSize()
  • bTRACE [static]
  • CalcDynamicLayout(int nLength, DWORD nMode) [virtual]
  • CalcFixedLayout(BOOL bStretch, BOOL bHorz) [protected, virtual]
  • CalcInsideRect(CRect &rect, BOOL bHorz) const
  • CalcLayout(DWORD nMode, int nLength=-1) [protected]
  • CalcSize(TBBUTTON *pData, int nCount) [protected]
  • CancelMenuAndTrackNewOne(int iButton) [protected]
  • CCJMenuBar()
  • CCJMenuBarFrameHook class [friend]
  • CCJToolBar()
  • CCJToolBarBase() [protected]
  • CheckButton(int nID, BOOL bCheck)
  • CommandToIndex(UINT nIDFind) const
  • ComputeMenuTrackPoint(const CRect &rcButn, TPMPARAMS &tpm) [protected]
  • Create(CWnd *pParentWnd, DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_TOP, UINT nID=AFX_IDW_TOOLBAR) [virtual]
  • CreateEx(CWnd *pParentWnd, DWORD dwCtrlStyle=TBSTYLE_FLAT, DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_ALIGN_TOP, CRect rcBorders=CRect(0, 0, 0, 0), UINT nID=AFX_IDW_TOOLBAR) [virtual]
  • Customize()
  • DeleteButton(int nIndex)
  • DoPaint(CDC *pDC) [virtual]
  • DrawBorders(CDC *pDC, CRect &rect)
  • DrawGripper(CDC *pDC, const CRect &rect)
  • EnableButton(int nID, BOOL bEnable)
  • EraseNonClient()
  • FindDropDownButton(UINT nID)
  • GetBitmap(UINT nIdButton) const
  • GetBitmapFlags() const
  • GetBorders() const [protected]
  • GetButton(int nIndex, TBBUTTON *pButton) const
  • GetButtonCount() const
  • GetButtonInfo(int nIndex, UINT &nID, UINT &nStyle, int &iImage) const
  • GetButtonSize(TBBUTTON *pData, int iButton) [virtual]
  • GetButtonStyle(int nIndex) const
  • GetButtonText(int nIndex) const
  • GetButtonText(int nIndex, CString &rString) const
  • GetHotItem() const
  • GetImageList() const
  • GetItemID(int nIndex) const
  • GetItemRect(int nIndex, LPRECT lpRect) const [virtual]
  • GetMenu()
  • GetNextOrPrevButton(int iButton, BOOL bPrev) [protected]
  • GetPadding() const
  • GetRect(UINT nIdButton, RECT &rc) const
  • GetRows() const
  • GetState(int nID) const
  • GetToolBarCtrl() const
  • GetToolbarStyle() const
  • GetToolTips() const
  • GetTrackingState(int &iPopup)
  • HideButton(int nID, BOOL bHide)
  • HitTest(CPoint p) const [protected]
  • Indeterminate(int nID, BOOL bIndeterminate)
  • InsertButton(int nIndex, LPTBBUTTON lpButton)
  • InsertControl(CRuntimeClass *pClass, LPCTSTR lpszWindowName, CRect &rect, UINT nID, DWORD dwStyle)
  • InsertControl(CWnd *pCtrl, CRect &rect, UINT nID)
  • InvalidateOldPos(const CRect &rcInvalid) [virtual]
  • IsButtonChecked(int nID) const
  • IsButtonEnabled(int nID) const
  • IsButtonHidden(int nID) const
  • IsButtonIndeterminate(int nID) const
  • IsButtonPressed(int nID) const
  • IsValidButton(int iButton) const [protected]
  • Layout() [protected]
  • LoadBitmap(LPCTSTR lpszResourceName)
  • LoadBitmap(UINT nIDResource)
  • LoadMenu(UINT nID)
  • LoadToolBar(LPCTSTR lpszResourceName, TOOLBARINFO *pBarInfo=NULL)
  • LoadToolBar(UINT nIDResource, TOOLBARINFO *pBarInfo=NULL)
  • m_arStrings [protected]
  • m_bAutoRemoveFrameMenu
  • m_bDelayedButtonLayout [protected]
  • m_bEscapeWasPressed [protected]
  • m_bExStyle
  • m_bInReBar
  • m_bProcessLeftArrow [protected]
  • m_bProcessRightArrow [protected]
  • m_bShowDropArrow [protected]
  • m_Font [protected]
  • m_frameHook [protected]
  • m_hbmImageWell [protected]
  • m_hInstImageWell [protected]
  • m_hKeyRoot [protected]
  • m_hMenuTracking [protected]
  • m_hRsrcImageWell [protected]
  • m_iNewPopup [protected]
  • m_iPopupTracking [protected]
  • m_iTrackingState [protected]
  • m_nBarNumber [protected, static]
  • m_nButtons [protected]
  • m_nMenuID [protected]
  • m_pBarInfo [protected]
  • m_pControls [protected]
  • m_pDropButtons [protected]
  • m_popupMenu [protected]
  • m_pStringMap [protected]
  • m_ptMouse [protected]
  • m_rcOldPos [protected]
  • m_sizeButton [protected]
  • m_sizeImage [protected]
  • m_strSubKey [protected]
  • m_strValueName [protected]
  • MapAccelerator(TCHAR ch, UINT &nID) const
  • MenuInputFilter(int code, WPARAM wp, LPARAM lp) [protected, static]
  • OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle) [protected, virtual]
  • OnDestroy() [protected]
  • OnDropDownButton(const NMTOOLBAR &nmtb, UINT nID, CRect rc) [virtual]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnMenuInput(MSG &m) [protected, virtual]
  • OnMenuSelect(HMENU hmenu, UINT nItemID) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnNcCalcSize(BOOL, NCCALCSIZE_PARAMS *) [protected]
  • OnNcCreate(LPCREATESTRUCT) [protected]
  • OnNcHitTest(CPoint) [protected]
  • OnNcPaint() [protected]
  • OnPaint() [protected]
  • OnPreserveZeroBorderHelper(WPARAM, LPARAM) [protected]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • OnSetBitmapSize(WPARAM, LPARAM) [protected]
  • OnSetButtonSize(WPARAM, LPARAM) [protected]
  • OnSetSizeHelper(CSize &size, LPARAM lParam) [protected]
  • OnSize(UINT nType, int cx, int cy) [protected]
  • OnSysColorChange() [protected]
  • OnToolBarBeginAdjust(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarBeginDrag(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarBtnDropDown(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarChange(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarCustomHelp(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarEndAdjust(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarEndDrag(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarGetButtonInfo(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarQueryDelete(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarQueryInsert(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarReset(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolHitTest(CPoint point, TOOLINFO *pTI) const [virtual]
  • OnUpdateCmdUI(CFrameWnd *pTarget, BOOL bDisableIfNoHndler) [virtual]
  • OnUpdateMenuButton(CCmdUI *pCmdUI) [protected]
  • OnWindowPosChanged(WINDOWPOS *lpwndpos) [protected]
  • OnWindowPosChanging(LPWINDOWPOS) [protected]
  • PreCreateWindow(CREATESTRUCT &cs) [virtual]
  • PressButton(int nID, BOOL bPress)
  • RecomputeMenuLayout() [protected]
  • RecomputeToolbarSize() [protected]
  • RestoreState()
  • SaveState()
  • SendMessageC(UINT m, WPARAM wp=0, LPARAM lp=0) const
  • SetBitmap(HBITMAP hbmImageWell)
  • SetBitmapSize(CSize sz)
  • SetBorders(LPCRECT lpRect) [protected]
  • SetBorders(int cxLeft=0, int cyTop=0, int cxRight=0, int cyBottom=0) [protected]
  • SetButton(int nIndex, TBBUTTON *pButton)
  • SetButtonInfo(int nIndex, UINT nID, UINT nStyle, int iImage)
  • SetButtons(const UINT *lpIDArray, int nIDCount)
  • SetButtonSize(CSize sz)
  • SetButtonStructSize(int nSize)
  • SetButtonStyle(int nIndex, UINT nStyle)
  • SetButtonText(int nIndex, LPCTSTR lpszText)
  • SetCmdID(int nIndex, UINT nID)
  • SetExtendedStyle(DWORD dwStyle)
  • SetHeight(int cyHeight)
  • SetHotItem(int iHot)
  • SetImageList(HIMAGELIST hImgList)
  • SetIndent(int indent)
  • SetOwner(CWnd *pOwnerWnd)
  • SetPadding(CSize sz)
  • SetRows(int nRows, BOOL bLarger, LPRECT lpRect)
  • SetSizes(SIZE sizeButton, SIZE sizeImage)
  • SetState(int nID, UINT nState)
  • SetToolbarStyle(DWORD dwStyle)
  • SetToolTips(CToolTipCtrl *pTip)
  • SetTrackingState(TRACKINGSTATE iState, int iButton=-1) [protected]
  • SizeToolBar(TBBUTTON *pData, int nCount, int nLength, BOOL bVert=FALSE) [protected]
  • ToggleTrackButtonMode() [protected]
  • TrackPopup(int iButton) [protected]
  • TranslateFrameMessage(MSG *pMsg) [virtual]
  • UpdateFont() [protected]
  • WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam) [virtual]
  • WrapToolBar(TBBUTTON *pData, int nCount, int nWidth) [protected]
  • ~CCJMenuBar() [virtual]
  • ~CCJToolBar() [virtual]
  • ~CCJToolBarBase() [virtual]
Generated on Sun Oct 21 12:46:39 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJMetaFileButton Member List

This is the complete list of members for CCJMetaFileButton, including all inherited members.
  • CCJMetaFileButton()
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • m_hEnhMetaFile [private]
  • m_hEnhMetaFileDisabled [private]
  • m_hEnhMetaFileFocus [private]
  • m_hEnhMetaFileSel [private]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnLButtonDblClk(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • SetMetaFiles(HENHMETAFILE hMetaFile, HENHMETAFILE hMetaFileSel=NULL, HENHMETAFILE hMetaFileFocus=NULL, HENHMETAFILE hMetaFileDisabled=NULL) [virtual]
  • ~CCJMetaFileButton() [virtual]
Generated on Sun Oct 21 12:46:40 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJMiniDockFrameWnd Member List

This is the complete list of members for CCJMiniDockFrameWnd, including all inherited members.
  • CCJMiniDockFrameWnd()
  • CDockBar class [friend]
  • Create(CWnd *pParent, DWORD dwBarStyle) [virtual]
  • OnNcLButtonDblClk(UINT nHitTest, CPoint point) [protected]
  • OnNcLButtonDown(UINT nHitTest, CPoint point) [protected]
  • ~CCJMiniDockFrameWnd() [virtual]
Generated on Sun Oct 21 12:46:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CContentItems Member List

This is the complete list of members for CContentItems, including all inherited members.
  • CContentItems(UINT nID, CString str)
  • GetImageID() [virtual]
  • GetText() [virtual]
  • m_csText [protected]
  • m_nImageID [protected]
  • operator=(CContentItems &pItems)
Generated on Sun Oct 21 12:47:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJOutlookBar Member List

This is the complete list of members for CCJOutlookBar, including all inherited members.
  • CCJOutlookBar()
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • m_bHilight [protected]
  • m_bLBDown [protected]
  • m_clrDkShad [protected]
  • m_clrHilite [protected]
  • m_clrNormal [protected]
  • m_clrShadow [protected]
  • m_clrTextNm [protected]
  • m_Font [protected]
  • m_nIndex [protected]
  • m_nNumItems [protected]
  • m_pContents [protected]
  • m_pImageListLarge [protected]
  • m_pImageListSmall [protected]
  • m_point [protected]
  • m_pOwner [protected]
  • MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) [virtual]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • OnSysColorChange() [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • SetImageLists(CImageList *pImageListSmall=NULL, CImageList *pImageListLarge=NULL) [virtual]
  • SetItems(CContentItems *pItems, int nNumItems) [virtual]
  • SetOwner(CWnd *pWnd) [virtual]
  • UpdateFont() [virtual]
  • ~CCJOutlookBar() [virtual]
Generated on Sun Oct 21 12:46:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJPagerCtrl Member List

This is the complete list of members for CCJPagerCtrl, including all inherited members.
  • CCJPagerCtrl()
  • Create(DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID) [virtual]
  • ForwardMouse(BOOL bForward)
  • GetBkColor()
  • GetBorder()
  • GetButtonSize()
  • GetButtonState(int iButton)
  • GetDropTarget(IDropTarget **ppdt)
  • GetPos()
  • m_nHeight [protected]
  • m_nWidth [protected]
  • OnPagerCalcSize(NMPGCALCSIZE *pNMPGCalcSize, LRESULT *pResult) [protected, virtual]
  • OnPagerScroll(NMPGSCROLL *pNMPGScroll, LRESULT *pResult) [protected, virtual]
  • RecalcSize()
  • SetBkColor(COLORREF clr)
  • SetBorder(int iBorder)
  • SetButtonSize(int iSize)
  • SetChild(HWND hwndChild)
  • SetPos(int iPos)
  • SetScrollArea(int nWidth, int nHeight)
  • ~CCJPagerCtrl() [virtual]
Generated on Sun Oct 21 12:46:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJReBar Member List

This is the complete list of members for CCJReBar, including all inherited members.
  • _AddBar(CWnd *pBar, REBARBANDINFO *pRBBI) [protected]
  • AddBar(CWnd *pBar, LPCTSTR pszText=NULL, CBitmap *pbmp=NULL, DWORD dwStyle=RBBS_GRIPPERALWAYS|RBBS_FIXEDBMP)
  • AddBar(CWnd *pBar, COLORREF clrFore, COLORREF clrBack, LPCTSTR pszText=NULL, DWORD dwStyle=RBBS_GRIPPERALWAYS)
  • CalcDynamicLayout(int nLength, DWORD nMode) [virtual]
  • CalcFixedLayout(BOOL bStretch, BOOL bHorz) [virtual]
  • CalcInsideRect(CRect &rect, BOOL bHorz) const
  • CCJReBar()
  • CCJToolBarBase() [protected]
  • Create(CWnd *pParentWnd, DWORD dwCtrlStyle=RBS_BANDBORDERS, DWORD dwStyle=WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|CBRS_TOP, UINT nID=0xE804)
  • DoPaint(CDC *pDC) [virtual]
  • DrawBorders(CDC *pDC, CRect &rect)
  • DrawGripper(CDC *pDC, const CRect &rect)
  • EraseNonClient()
  • GetBorders() const [protected]
  • GetReBarCtrl() const
  • m_bExStyle
  • m_bInReBar
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnHeightChange(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnNcCalcSize(BOOL, NCCALCSIZE_PARAMS *) [protected]
  • OnNcCreate(LPCREATESTRUCT) [protected]
  • OnNcPaint() [protected]
  • OnPaint() [protected]
  • OnRecalcParent() [protected]
  • OnShowBand(WPARAM wParam, LPARAM lParam) [protected]
  • OnToolHitTest(CPoint point, TOOLINFO *pTI) const [virtual]
  • OnUpdateCmdUI(CFrameWnd *pTarget, BOOL bDisableIfNoHndler) [virtual]
  • OnWindowPosChanging(LPWINDOWPOS lpWndPos)
  • SetBorders(LPCRECT lpRect) [protected]
  • SetBorders(int cxLeft=0, int cyTop=0, int cxRight=0, int cyBottom=0) [protected]
  • WindowProc(UINT message, WPARAM wParam, LPARAM lParam) [protected, virtual]
  • ~CCJToolBarBase() [virtual]
Generated on Sun Oct 21 12:46:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJReBarCtrl Member List

This is the complete list of members for CCJReBarCtrl, including all inherited members.
  • BeginDrag(UINT uBand, DWORD dwPos=(DWORD)-1)
  • CCJReBarCtrl()
  • Create(DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
  • DeleteBand(UINT uBand)
  • DragMove(DWORD dwPos=(DWORD)-1)
  • EndDrag()
  • GetBandBorders(UINT uBand, LPRECT prc) const
  • GetBandCount() const
  • GetBandInfo(UINT uBand, REBARBANDINFO *prbbi) const
  • GetBarHeight() const
  • GetBarInfo(REBARINFO *prbi) const
  • GetBkColor() const
  • GetColorScheme(COLORSCHEME *lpcs)
  • GetDropTarget() const
  • GetImageList() const
  • GetPalette() const
  • GetRect(UINT uBand, LPRECT prc) const
  • GetRowCount() const
  • GetRowHeight(UINT uRow) const
  • GetTextColor() const
  • GetToolTips() const
  • HitTest(RBHITTESTINFO *prbht)
  • IDToIndex(UINT uBandID) const
  • InsertBand(UINT uIndex, REBARBANDINFO *prbbi)
  • MaximizeBand(UINT uBand)
  • MinimizeBand(UINT uBand)
  • MoveBand(UINT uFrom, UINT uTo)
  • SetBandInfo(UINT uBand, REBARBANDINFO *prbbi)
  • SetBarInfo(REBARINFO *prbi)
  • SetBkColor(COLORREF clr)
  • SetColorScheme(const COLORSCHEME *lpcs)
  • SetImageList(CImageList *pImageList)
  • SetOwner(CWnd *pWnd)
  • SetPalette(HPALETTE hPal)
  • SetTextColor(COLORREF clr)
  • SetToolTips(CToolTipCtrl *pToolTip)
  • ShowBand(UINT uBand, BOOL fShow=TRUE)
  • SizeToRect(CRect &rect)
Generated on Sun Oct 21 12:46:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJSizeDockBar Member List

This is the complete list of members for CCJSizeDockBar, including all inherited members.
  • CalcDynamicLayout(int nLength, DWORD nMode) [virtual]
  • CalcSizeBarLayout()
  • CCJSizeDockBar()
  • DoPaint(CDC *pDC) [virtual]
  • DrawBorders(CDC *pDC, CRect &rect)
  • EraseNonClient()
  • FlatBorder(BOOL bFlat=TRUE)
  • GetAvailableRect(CRect &rect) [protected]
  • GetDockedSizeBar(int nPos)
  • HitTest(const CPoint &point) [virtual]
  • IsDockBar() const [virtual]
  • IsDockSizeBar() const [virtual]
  • IsLastControlBar(int index) [protected]
  • m_bDragging [protected]
  • m_bFlatBorder [protected]
  • m_bIsDockBar [static]
  • m_bOkToDrag [protected]
  • m_curHSplitBar [protected]
  • m_curVSplitBar [protected]
  • m_iActualSize [protected]
  • m_iSafeSpace [protected]
  • m_ptCurDrag [protected]
  • m_ptCurrent [protected]
  • m_ptStartDrag [protected]
  • m_rcTrack [protected]
  • Maximize(CCJControlBar *)
  • Normalize(CCJControlBar *)
  • OnInvertTracker(const CRect &) [virtual]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS *lpncsp) [protected]
  • OnNcHitTest(CPoint point) [protected]
  • OnNcLButtonDown(UINT nHitTest, CPoint point) [protected]
  • OnNcPaint() [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • RecalcAllExcept(CCJSizeDockBar *pBar)
  • SetActualSize(int iSize)
  • ~CCJSizeDockBar() [virtual]
Generated on Sun Oct 21 12:46:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJSortClass Member List

This is the complete list of members for CCJSortClass, including all inherited members.
  • CCJSortClass(CListCtrl *pWnd, const int nCol)
  • Compare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) [protected, static]
  • m_pWnd [protected]
  • Sort(bool bAsc, DATA_TYPE eType) [virtual]
  • ~CCJSortClass() [virtual]
Generated on Sun Oct 21 12:46:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJSortClass::CSortItem Member List

This is the complete list of members for CCJSortClass::CSortItem, including all inherited members.
  • CSortItem(const DWORD dwData, const CString &strItemText)
  • m_dwData
  • m_strItemText
Generated on Sun Oct 21 12:46:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJStatusBarPaneControlInfo Member List

This is the complete list of members for CCJStatusBarPaneControlInfo, including all inherited members.
  • CCJStatusBarPaneControlInfo()
  • m_bAutodelete
  • m_nPaneID
  • m_pWnd
  • ~CCJStatusBarPaneControlInfo() [virtual]
Generated on Sun Oct 21 12:46:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJStatusBarPane Member List

This is the complete list of members for CCJStatusBarPane, including all inherited members.
  • CCJStatusBarPane()
  • CCJStatusBarPane(CCJStatusBarPane &rPane)
  • m_cxText
  • m_nFlags
  • m_nID
  • m_nStyle
  • m_strText
  • operator=(CCJStatusBarPane &rPane)
  • ~CCJStatusBarPane() [virtual]
Generated on Sun Oct 21 12:46:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJStatusBar Member List

This is the complete list of members for CCJStatusBar, including all inherited members.
  • AddControl(CWnd *pWnd, int nPaneID, BOOL bAutodeleteControl=TRUE) [virtual]
  • AddIndicator(int position, UINT paneID) [virtual]
  • CCJStatusBar()
  • GetPanControl(int nPaneID) [virtual]
  • GetStatusPane(int nIndex, CCJStatusBarPane &xfxpane) [virtual]
  • m_aPans [private]
  • OnSize(UINT nType, int cx, int cy) [protected]
  • PositionControls() [virtual]
  • RemovePane(int nPaneID) [virtual]
  • SetPaneWidth(int index, int cxWidth) [virtual]
  • ~CCJStatusBar() [virtual]
Generated on Sun Oct 21 12:46:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJTabCtrl Member List

This is the complete list of members for CCJTabCtrl, including all inherited members.
  • CCJTabCtrl()
  • Create(CWnd *pParentWnd, UINT nID=AFX_IDC_TAB_CONTROL, DWORD dwStyle=WS_VISIBLE|WS_CHILD|TCS_BOTTOM|TCS_TOOLTIPS|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, const CRect &rect=CRect(0, 0, 0, 0)) [virtual]
  • GetMenuID() [virtual]
  • m_Font
  • m_nPos
  • m_popToolbarID
  • m_popupMenu
  • m_popupMenuID
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu) [protected]
  • OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) [protected]
  • OnMenuChar(UINT nChar, UINT nFlags, CMenu *pMenu) [protected]
  • OnPaint() [protected]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • SetMenuID(UINT popupMenuID, UINT popToolbarID=0, int nPos=0) [virtual]
  • UpdateFont() [virtual]
  • ~CCJTabCtrl() [virtual]
Generated on Sun Oct 21 12:46:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

tagTCB_ITEM Member List

This is the complete list of members for tagTCB_ITEM, including all inherited members.
  • pWnd
  • szTabLabel
  • szToolTipLabel
  • uiToolTipId
Generated on Sun Oct 21 12:49:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJTabCtrlBar Member List

This is the complete list of members for CCJTabCtrlBar, including all inherited members.
  • AddToolTip(TCB_ITEM *pMember, LPCTSTR lpszLabel) [protected, virtual]
  • AddView(LPCTSTR lpszLabel, CRuntimeClass *pViewClass, CDocument *pDoc=NULL, UINT nIndex=-1, CCreateContext *pContext=NULL) [virtual]
  • AssociateImageIndexWithRuntimeClass(int nIndex, CRuntimeClass *pRuntimeClass) [virtual]
  • AssociateImageIndexWithRuntimeClass(int nIndex, LPCTSTR lpszRuntimeClassName)
  • CalcDynamicLayout(int nLength, DWORD nMode) [virtual]
  • CCJControlBar()
  • CCJTabCtrlBar()
  • Create(CWnd *pParentWnd, UINT nID, LPCTSTR lpszWindowName=NULL, CSize sizeDefault=CSize(200, 100), DWORD dwStyle=CBRS_LEFT, BOOL bFlatBorders=FALSE) [virtual]
  • CreateTabListItem(LPCTSTR lpszLabel) [protected, virtual]
  • CreateTabView(CRuntimeClass *pViewClass, CDocument *pDocument, CCreateContext *pContext) [protected, virtual]
  • DeleteView(int nView) [virtual]
  • DeleteView(CRuntimeClass *pViewClass) [virtual]
  • DrawBorders(CDC *pDC, CRect &rect) [protected, virtual]
  • DrawGriperCaption(CDC *pDC, LPRECT pRect) [protected, virtual]
  • DrawGripper(CDC *pDC) [protected, virtual]
  • EnableDockingOnSizeBar(DWORD dwDockStyle) [virtual]
  • EnableFlatLook(BOOL bFlat=TRUE) [virtual]
  • EnableFlatLook(BOOL bGripper, BOOL bBorder, BOOL bButtons) [virtual]
  • EnableSaveState(bool bAutoSave=true) [virtual]
  • EnableToolTips(BOOL bEnable) [protected, virtual]
  • EraseNonClient() [protected, virtual]
  • GetActiveView() [virtual]
  • GetButtonRect() [protected, virtual]
  • GetChildRect(CRect &rect) [virtual]
  • GetGripperRect() [protected, virtual]
  • GetHorzSize() [virtual]
  • GetImageIndexFromRuntimeClass(CRuntimeClass *pRuntimeClass) [protected, virtual]
  • GetMenuID() [virtual]
  • GetMinExt() [virtual]
  • GetTabFromPoint(CPoint point=CPoint(0, 0)) [virtual]
  • GetToolTip() [protected, virtual]
  • GetVertSize() [virtual]
  • GetView(int nView) [virtual]
  • GetView(CRuntimeClass *pViewClass) [virtual]
  • GetViewName(int nView) [virtual]
  • GetViewName(CRuntimeClass *pViewClass) [virtual]
  • HitTest(CPoint &point) [protected, virtual]
  • IsBottomDocked() const [virtual]
  • IsFloating() const [virtual]
  • IsHorzDocked() const [virtual]
  • IsLeftDocked() const [virtual]
  • IsRightDocked() const [virtual]
  • IsTopDocked() const [virtual]
  • IsVertDocked() const [virtual]
  • LoadBarState(CSize &size, int nID) [protected, virtual]
  • m_bAutoSave [protected]
  • m_bButtons [protected]
  • m_bDragging [protected]
  • m_bFlatBorder [protected]
  • m_bFlatGripper [protected]
  • m_bFloating [protected]
  • m_bGripper [protected]
  • m_bMaximized [protected]
  • m_bOkToDrag [protected]
  • m_btnClose [protected]
  • m_btnMinim [protected]
  • m_bToFit
  • m_bToolTipsEnabled [protected]
  • m_bUnique
  • m_ClassNameToImageIndexMap [protected]
  • m_cxOffset [protected]
  • m_cyOffset [protected]
  • m_eAuxIndex [protected]
  • m_eChildBorder
  • m_hAuxIcon [protected]
  • m_hIcon [protected]
  • m_ImageList [protected]
  • m_nActiveTab [protected]
  • m_nID [protected]
  • m_nNextToolTipId [protected]
  • m_nPointTab [protected]
  • m_nPos [protected]
  • m_pActiveView [protected]
  • m_pChildWnd [protected]
  • m_popToolbarID [protected]
  • m_popupMenu [protected]
  • m_popupMenuID [protected]
  • m_ptCurDrag [protected]
  • m_ptStartDrag [protected]
  • m_rcTrack [protected]
  • m_sizeDesired [protected]
  • m_sizeFloat [protected]
  • m_sizeHorz [protected]
  • m_sizeNormal [protected]
  • m_sizeVert [protected]
  • m_strSection [protected]
  • m_TabCtrl [protected]
  • m_ToolTip [protected]
  • m_viewList [protected]
  • Maximize(int size) [virtual]
  • Minimize() [virtual]
  • ModifyTabStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags=0) [virtual]
  • Normalize() [virtual]
  • OnButtonClose() [protected]
  • OnButtonMinimize() [protected]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu) [protected]
  • OnInvertTracker(const CRect &rect) [protected, virtual]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) [protected]
  • OnMenuChar(UINT nChar, UINT nFlags, CMenu *pMenu) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnNcHitTest(CPoint point) [protected]
  • OnNcPaint() [protected]
  • OnPaint() [protected]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnTabSelChange(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnUpdateButtonClose(CCmdUI *pCmdUI) [protected]
  • OnUpdateButtonMinimize(CCmdUI *pCmdUI) [protected]
  • OnUpdateCmdUI(CFrameWnd *pTarget, BOOL bDisableIfNoHndler) [virtual]
  • OnWindowPosChanged(WINDOWPOS *lpwndpos) [protected]
  • OverkillAssert(CRuntimeClass *pViewClass) [protected, virtual]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • RemoveAllTabs() [virtual]
  • RemoveListItem(POSITION pos) [protected, virtual]
  • RemoveView(int nView) [virtual]
  • ResetToolTips(CToolTipCtrl *pToolTip) [protected, virtual]
  • SaveBarState(CSize &size) [protected, virtual]
  • SetActiveView(int nView) [virtual]
  • SetActiveView(CRuntimeClass *pViewClass) [virtual]
  • SetActiveView(CView *pUserView) [virtual]
  • SetChild(CWnd *pWnd) [protected, virtual]
  • SetMenuID(UINT popupMenuID, UINT popToolbarID=0, int nPos=0) [virtual]
  • SetNormalSize(const CSize &cs) [virtual]
  • SetTabImageList(CImageList *pImageList) [virtual]
  • SetTabMenuID(UINT popupMenuID, UINT popToolbarID=0, int nPos=0) [virtual]
  • SetViewToolTip(int nView, LPCTSTR lpszLabel) [virtual]
  • SetViewToolTip(CRuntimeClass *pViewClass, LPCTSTR lpszLabel) [virtual]
  • ShowFrameControls(BOOL bGripper=TRUE, BOOL bButtons=TRUE) [virtual]
  • SizeTabView(CWnd *pWnd) [protected, virtual]
  • ~CCJControlBar() [virtual]
  • ~CCJTabCtrlBar() [virtual]
Generated on Sun Oct 21 12:46:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

tagCTV_ITEM Member List

This is the complete list of members for tagCTV_ITEM, including all inherited members.
  • pWnd
  • szLabel
Generated on Sun Oct 21 12:49:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJTabView Member List

This is the complete list of members for CCJTabView, including all inherited members.
  • AddView(LPCTSTR lpszLabel, CRuntimeClass *pViewClass, CDocument *pDoc=NULL, CCreateContext *pContext=NULL) [virtual]
  • CalcViewRect(CRect *pRect) [private]
  • CCJTabView() [protected]
  • GetActiveView() [virtual]
  • GetChildRect(CRect &rect) [virtual]
  • GetTabCtrl() [virtual]
  • GetView(CRuntimeClass *pViewClass) [virtual]
  • GetView(int nView) [virtual]
  • m_nActiveTab [protected]
  • m_pActiveView [protected]
  • m_pTabCtrl [protected]
  • m_pToolTip [protected]
  • m_TabFont [protected]
  • m_views [protected]
  • ModifyTabStyle(DWORD dwRemove, DWORD dwAdd, UINT nFlags=0) [virtual]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnSelchange(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnWindowPosChanged(WINDOWPOS *lpwndpos) [protected]
  • RemoveView(int nView) [virtual]
  • SetActiveView(CRuntimeClass *pViewClass) [virtual]
  • SetActiveView(int nNewTab) [virtual]
  • SetTabImageList(CImageList *pImageList) [virtual]
  • ~CCJTabView() [protected, virtual]
Generated on Sun Oct 21 12:46:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

DROPDOWNBUTTON Member List

This is the complete list of members for DROPDOWNBUTTON, including all inherited members.
  • idButton
  • idMenu
  • next
Generated on Sun Oct 21 12:47:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TOOLBARINFO Member List

This is the complete list of members for TOOLBARINFO, including all inherited members.
  • btnText
  • tbButton
Generated on Sun Oct 21 12:50:16 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJToolBar Member List

This is the complete list of members for CCJToolBar, including all inherited members.
  • AddButtons(int nNumButtons, LPTBBUTTON lpButtons)
  • AddDropDownButton(UINT nIDButton, UINT nIDMenu, BOOL bArrow=TRUE)
  • AddReplaceBitmap(HBITMAP hbmImageWell)
  • AddStrings(LPCTSTR lpszStrings)
  • AutoSize()
  • CalcDynamicLayout(int nLength, DWORD nMode) [virtual]
  • CalcFixedLayout(BOOL bStretch, BOOL bHorz) [virtual]
  • CalcInsideRect(CRect &rect, BOOL bHorz) const
  • CalcLayout(DWORD nMode, int nLength=-1) [protected]
  • CalcSize(TBBUTTON *pData, int nCount) [protected]
  • CCJToolBar()
  • CCJToolBarBase() [protected]
  • CheckButton(int nID, BOOL bCheck)
  • CommandToIndex(UINT nIDFind) const
  • Create(CWnd *pParentWnd, DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_TOP, UINT nID=AFX_IDW_TOOLBAR) [virtual]
  • CreateEx(CWnd *pParentWnd, DWORD dwCtrlStyle=TBSTYLE_FLAT, DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_ALIGN_TOP, CRect rcBorders=CRect(0, 0, 0, 0), UINT nID=AFX_IDW_TOOLBAR) [virtual]
  • Customize()
  • DeleteButton(int nIndex)
  • DoPaint(CDC *pDC) [virtual]
  • DrawBorders(CDC *pDC, CRect &rect)
  • DrawGripper(CDC *pDC, const CRect &rect)
  • EnableButton(int nID, BOOL bEnable)
  • EraseNonClient()
  • FindDropDownButton(UINT nID)
  • GetBitmap(UINT nIdButton) const
  • GetBitmapFlags() const
  • GetBorders() const [protected]
  • GetButton(int nIndex, TBBUTTON *pButton) const
  • GetButtonCount() const
  • GetButtonInfo(int nIndex, UINT &nID, UINT &nStyle, int &iImage) const
  • GetButtonSize(TBBUTTON *pData, int iButton) [virtual]
  • GetButtonStyle(int nIndex) const
  • GetButtonText(int nIndex) const
  • GetButtonText(int nIndex, CString &rString) const
  • GetHotItem() const
  • GetImageList() const
  • GetItemID(int nIndex) const
  • GetItemRect(int nIndex, LPRECT lpRect) const [virtual]
  • GetPadding() const
  • GetRect(UINT nIdButton, RECT &rc) const
  • GetRows() const
  • GetState(int nID) const
  • GetToolBarCtrl() const
  • GetToolbarStyle() const
  • GetToolTips() const
  • HideButton(int nID, BOOL bHide)
  • HitTest(CPoint p) const
  • Indeterminate(int nID, BOOL bIndeterminate)
  • InsertButton(int nIndex, LPTBBUTTON lpButton)
  • InsertControl(CRuntimeClass *pClass, LPCTSTR lpszWindowName, CRect &rect, UINT nID, DWORD dwStyle)
  • InsertControl(CWnd *pCtrl, CRect &rect, UINT nID)
  • InvalidateOldPos(const CRect &rcInvalid) [virtual]
  • IsButtonChecked(int nID) const
  • IsButtonEnabled(int nID) const
  • IsButtonHidden(int nID) const
  • IsButtonIndeterminate(int nID) const
  • IsButtonPressed(int nID) const
  • Layout() [protected]
  • LoadBitmap(LPCTSTR lpszResourceName)
  • LoadBitmap(UINT nIDResource)
  • LoadToolBar(LPCTSTR lpszResourceName, TOOLBARINFO *pBarInfo=NULL)
  • LoadToolBar(UINT nIDResource, TOOLBARINFO *pBarInfo=NULL)
  • m_bDelayedButtonLayout [protected]
  • m_bExStyle
  • m_bInReBar
  • m_bShowDropArrow [protected]
  • m_hbmImageWell [protected]
  • m_hInstImageWell [protected]
  • m_hKeyRoot [protected]
  • m_hRsrcImageWell [protected]
  • m_nBarNumber [protected, static]
  • m_nButtons [protected]
  • m_pBarInfo [protected]
  • m_pControls [protected]
  • m_pDropButtons [protected]
  • m_pStringMap [protected]
  • m_rcOldPos [protected]
  • m_sizeButton [protected]
  • m_sizeImage [protected]
  • m_strSubKey [protected]
  • m_strValueName [protected]
  • MapAccelerator(TCHAR ch, UINT &nID) const
  • OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle) [virtual]
  • OnDestroy() [protected]
  • OnDropDownButton(const NMTOOLBAR &nmtb, UINT nID, CRect rc) [virtual]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnNcCalcSize(BOOL, NCCALCSIZE_PARAMS *) [protected]
  • OnNcCreate(LPCREATESTRUCT) [protected]
  • OnNcHitTest(CPoint) [protected]
  • OnNcPaint() [protected]
  • OnPaint() [protected]
  • OnPreserveZeroBorderHelper(WPARAM, LPARAM) [protected]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • OnSetBitmapSize(WPARAM, LPARAM) [protected]
  • OnSetButtonSize(WPARAM, LPARAM) [protected]
  • OnSetSizeHelper(CSize &size, LPARAM lParam) [protected]
  • OnSysColorChange() [protected]
  • OnToolBarBeginAdjust(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarBeginDrag(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarBtnDropDown(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarChange(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarCustomHelp(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarEndAdjust(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarEndDrag(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarGetButtonInfo(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarQueryDelete(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarQueryInsert(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolBarReset(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnToolHitTest(CPoint point, TOOLINFO *pTI) const [virtual]
  • OnUpdateCmdUI(CFrameWnd *pTarget, BOOL bDisableIfNoHndler) [virtual]
  • OnWindowPosChanged(WINDOWPOS *lpwndpos) [protected]
  • OnWindowPosChanging(LPWINDOWPOS) [protected]
  • PreCreateWindow(CREATESTRUCT &cs) [virtual]
  • PressButton(int nID, BOOL bPress)
  • RestoreState()
  • SaveState()
  • SendMessageC(UINT m, WPARAM wp=0, LPARAM lp=0) const
  • SetBitmap(HBITMAP hbmImageWell)
  • SetBitmapSize(CSize sz)
  • SetBorders(LPCRECT lpRect) [protected]
  • SetBorders(int cxLeft=0, int cyTop=0, int cxRight=0, int cyBottom=0) [protected]
  • SetButton(int nIndex, TBBUTTON *pButton)
  • SetButtonInfo(int nIndex, UINT nID, UINT nStyle, int iImage)
  • SetButtons(const UINT *lpIDArray, int nIDCount)
  • SetButtonSize(CSize sz)
  • SetButtonStructSize(int nSize)
  • SetButtonStyle(int nIndex, UINT nStyle)
  • SetButtonText(int nIndex, LPCTSTR lpszText)
  • SetCmdID(int nIndex, UINT nID)
  • SetExtendedStyle(DWORD dwStyle)
  • SetHeight(int cyHeight)
  • SetHotItem(int iHot)
  • SetImageList(HIMAGELIST hImgList)
  • SetIndent(int indent)
  • SetOwner(CWnd *pOwnerWnd)
  • SetPadding(CSize sz)
  • SetRows(int nRows, BOOL bLarger, LPRECT lpRect)
  • SetSizes(SIZE sizeButton, SIZE sizeImage)
  • SetState(int nID, UINT nState)
  • SetToolbarStyle(DWORD dwStyle)
  • SetToolTips(CToolTipCtrl *pTip)
  • SizeToolBar(TBBUTTON *pData, int nCount, int nLength, BOOL bVert=FALSE) [protected]
  • WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam) [virtual]
  • WrapToolBar(TBBUTTON *pData, int nCount, int nWidth) [protected]
  • ~CCJToolBar() [virtual]
  • ~CCJToolBarBase() [virtual]
Generated on Sun Oct 21 12:46:58 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

tagAFX_OLDTOOLINFO Member List

This is the complete list of members for tagAFX_OLDTOOLINFO, including all inherited members.
  • cbSize
  • hinst
  • hwnd
  • lpszText
  • rect
  • uFlags
  • uId
Generated on Sun Oct 21 12:49:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJToolBarBase Member List

This is the complete list of members for CCJToolBarBase, including all inherited members.
  • CalcInsideRect(CRect &rect, BOOL bHorz) const
  • CCJToolBarBase() [protected]
  • DoPaint(CDC *pDC) [virtual]
  • DrawBorders(CDC *pDC, CRect &rect)
  • DrawGripper(CDC *pDC, const CRect &rect)
  • EraseNonClient()
  • GetBorders() const [protected]
  • m_bExStyle
  • m_bInReBar
  • OnPaint()
  • OnWindowPosChanging(LPWINDOWPOS lpWndPos)
  • SetBorders(LPCRECT lpRect) [protected]
  • SetBorders(int cxLeft=0, int cyTop=0, int cxRight=0, int cyBottom=0) [protected]
  • WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam) [virtual]
  • ~CCJToolBarBase() [virtual]
Generated on Sun Oct 21 12:46:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJToolBarCtrl Member List

This is the complete list of members for CCJToolBarCtrl, including all inherited members.
  • CCJToolBarCtrl()
  • Create(DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
  • GetAnchorHighlight() const
  • GetButtonInfo(int nID, TBBUTTONINFO *ptbbi) const
  • GetButtonSize() const
  • GetDisabledImageList() const
  • GetDropTarget(IDropTarget **ppDropTarget) const
  • GetExtendedStyle() const
  • GetHotImageList() const
  • GetHotItem() const
  • GetImageList() const
  • GetInsertMark(TBINSERTMARK *ptbim) const
  • GetInsertMarkColor() const
  • GetMaxSize(LPSIZE pSize) const
  • GetMaxTextRows() const
  • GetStyle() const
  • HitTest(LPPOINT ppt) const
  • InsertMarkHitTest(LPPOINT ppt, LPTBINSERTMARK ptbim) const
  • IsButtonHighlighted(int nID) const
  • MapAccelerator(TCHAR chAccel, UINT *pIDBtn)
  • MarkButton(int nID, BOOL bHighlight=TRUE)
  • MoveButton(UINT nOldPos, UINT nNewPos)
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • SetAnchorHighlight(BOOL fAnchor=TRUE)
  • SetButtonInfo(int nID, TBBUTTONINFO *ptbbi)
  • SetButtonWidth(int cxMin, int cxMax)
  • SetDisabledImageList(CImageList *pImageList)
  • SetDrawTextFlags(DWORD dwMask, DWORD dwDTFlags)
  • SetExtendedStyle(DWORD dwExStyle)
  • SetHotImageList(CImageList *pImageList)
  • SetHotItem(int nHot)
  • SetImageList(CImageList *pImageList)
  • SetIndent(int iIndent)
  • SetInsertMark(TBINSERTMARK *ptbim)
  • SetInsertMarkColor(COLORREF clrNew)
  • SetMaxTextRows(int iMaxRows)
  • SetStyle(DWORD dwStyle)
  • ~CCJToolBarCtrl() [virtual]
Generated on Sun Oct 21 12:47:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJTreeCtrl Member List

This is the complete list of members for CCJTreeCtrl, including all inherited members.
  • CCJTreeCtrl()
  • ClearSelection() [virtual]
  • EnableMultiSelect(BOOL bMultiSelect=TRUE) [virtual]
  • FindItem(LPCTSTR lpszSearch, BOOL bCaseSensitive=FALSE, BOOL bDownDir=TRUE, BOOL bWholeWord=FALSE, HTREEITEM hItem=NULL) [virtual]
  • GetFirstSelectedItem() [virtual]
  • GetItemBold(HTREEITEM hItem) [virtual]
  • GetItemColor(HTREEITEM hItem) [virtual]
  • GetItemFont(HTREEITEM hItem, LOGFONT *plogfont) [virtual]
  • GetLastItem(HTREEITEM hItem) [virtual]
  • GetNextItem(HTREEITEM hItem, UINT nCode) [virtual]
  • GetNextItem(HTREEITEM hItem) [virtual]
  • GetNextSelectedItem(HTREEITEM hItem) [virtual]
  • GetPrevItem(HTREEITEM hItem) [virtual]
  • GetPrevSelectedItem(HTREEITEM hItem) [virtual]
  • IsFindValid(HTREEITEM hti) [protected, virtual]
  • m_bMultiSelect [protected]
  • m_dwDragStart [protected]
  • m_hItemFirstSel [protected]
  • m_mapColorFont [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • PreCreateWindow(CREATESTRUCT &cs) [protected, virtual]
  • SelectItems(HTREEITEM hItemFrom, HTREEITEM hItemTo) [virtual]
  • SetItemBold(HTREEITEM hItem, BOOL bBold=TRUE) [virtual]
  • SetItemColor(HTREEITEM hItem, COLORREF color) [virtual]
  • SetItemFont(HTREEITEM hItem, LOGFONT &logfont) [virtual]
  • ~CCJTreeCtrl() [virtual]
Generated on Sun Oct 21 12:47:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJTreeCtrl::Color_Font Member List

This is the complete list of members for CCJTreeCtrl::Color_Font, including all inherited members.
  • color
  • logfont
Generated on Sun Oct 21 12:47:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCJWindowPlacement Member List

This is the complete list of members for CCJWindowPlacement, including all inherited members.
  • CCJWindowPlacement()
  • LoadWindowPos(CFrameWnd *pFrameWnd, LPCTSTR lpszFormat=NULL, LPCTSTR lpszSection=NULL, LPCTSTR lpszWndPos=NULL) [virtual]
  • m_strFormat [private]
  • m_strSection [private]
  • m_strWndPos [private]
  • SaveWindowPos(CFrameWnd *pFrameWnd) [virtual]
  • ~CCJWindowPlacement() [virtual]
Generated on Sun Oct 21 12:47:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CGfxGroupEdit Member List

This is the complete list of members for CGfxGroupEdit, including all inherited members.
  • bEscapeKey
  • bNoDown
  • CGfxGroupEdit()
  • iIndex
  • msgSend
  • OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) [protected]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnKillFocus(CWnd *pNewWnd) [protected]
  • PostNcDestroy() [protected, virtual]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • text
  • ~CGfxGroupEdit() [virtual]
Generated on Sun Oct 21 12:47:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

OUTBAR_INFO Member List

This is the complete list of members for OUTBAR_INFO, including all inherited members.
  • cText
  • iDragFrom
  • iDragTo
  • index
Generated on Sun Oct 21 12:48:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CGfxOutBarCtrl Member List

This is the complete list of members for CGfxOutBarCtrl, including all inherited members.
  • AddFolder(LPCTSTR cFolderName, const DWORD exData) [virtual]
  • AddFolderBar(LPCTSTR pFolder, CWnd *pSon, const DWORD exData=0) [virtual]
  • AnimateFolderScroll(const int iFrom, const int iTo) [virtual]
  • arFolder
  • bDownArrow
  • bDownPressed
  • bLooping
  • bPressedHighlight
  • bUpArrow
  • bUpPressed
  • CGfxOutBarCtrl()
  • cr3dFace
  • crBackGroundColor
  • crBackGroundColor1
  • crDkShadowBorder
  • Create(DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, const DWORD dwFlag=fDragItems|fEditGroups|fEditItems|fRemoveGroups|fRemoveItems|fAddGroups|fAnimation|fSelHighlight) [virtual]
  • crHilightBorder
  • crLightBorder
  • crShadowBorder
  • crTextColor
  • DrawAnimItem(const int xoffset, const int yoffset, const int index) [virtual]
  • DrawDragArrow(CDC *pDC, const int iFrom, const int iTo) [virtual]
  • DrawFolder(CDC *pDC, const int iIdx, CRect rect, const bool bSelected) [protected]
  • DrawItem(CDC *pDC, const int iFolder, CRect rc, const int index, const bool bOnlyImage=false) [virtual]
  • dwFlags
  • fAddGroups enum value
  • fAnimation enum value
  • fDragItems enum value
  • fEditGroups enum value
  • fEditItems enum value
  • fLargeIcon enum value
  • fRemoveGroups enum value
  • fRemoveItems enum value
  • fSelHighlight enum value
  • fSmallIcon enum value
  • GetAnimationTickCount() [inline, virtual]
  • GetCountPerPage() const [virtual]
  • GetDragItemRect(const int index, CRect &rect) [virtual]
  • GetFlag() const [virtual]
  • GetFolderChild(int iFolder=-1) [virtual]
  • GetFolderCount() const [virtual]
  • GetFolderData(int iFolder=-1) [virtual]
  • GetFolderImageList(const int index, const bool bSmall) const [virtual]
  • GetFolderRect(const int iIndex, CRect &rect) const [virtual]
  • GetIconRect(const int iFolder, const int iIndex, CRect &rect) [virtual]
  • GetImageList(CImageList *pImageList, int nImageList) [virtual]
  • GetInsideRect(CRect &rect) const [virtual]
  • GetItemCount() const [virtual]
  • GetItemData(const int index) const [virtual]
  • GetItemImage(const int index) const [virtual]
  • GetItemRect(const int iFolder, const int iIndex, CRect &rect) [virtual]
  • GetItemSize(const int iFolder, const int index, const int type) [virtual]
  • GetItemText(const int index) [virtual]
  • GetLabelRect(const int iFolder, const int iIndex, CRect &rect) [virtual]
  • GetSelFolder() const [virtual]
  • GetVisibleRange(const int iFolder, int &first, int &last) [virtual]
  • hDragCursor
  • hHandCursor
  • HighlightFolder(const int index) [virtual]
  • HighlightItem(const int index, const bool bPressed=false) [virtual]
  • HitTestEx(const CPoint &point, int &index) [virtual]
  • hNoDragCursor
  • htDownScroll enum value
  • htFolder enum value
  • htItem enum value
  • htNothing enum value
  • htUpScroll enum value
  • iFirstItem
  • iFolderHeight
  • iHitInternal1
  • iHitInternal2
  • iLastDragItemDraw
  • iLastDragItemDrawType
  • iLastFolderHighlighted
  • iLastItemHighlighted
  • iLastSel
  • iLastSelectedFolder
  • InsertItem(const int folder, const int index, LPCTSTR text, const int image=-1, const DWORD exData=0) [virtual]
  • ircAll enum value
  • ircIcon enum value
  • ircLabel enum value
  • iSelAnimCount
  • iSelAnimTiming
  • iSelFolder
  • IsSmallIconView() const [virtual]
  • IsValidItem(const int index) const [virtual]
  • lAnimationTickCount
  • m_popupMenu
  • m_strRemoveItem
  • m_strRenameItem
  • ModifyFlag(const DWORD &dwRemove, const DWORD &dwAdd, const UINT redraw=0) [virtual]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnEndLabelEdit(WPARAM wParam, LPARAM lParam) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnGfxLargeicon() [protected]
  • OnGfxRemoveitem() [protected]
  • OnGfxRenameitem() [protected]
  • OnGfxSmallicon() [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnPaint() [protected]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnSize(UINT nType, int cx, int cy) [protected]
  • OnSysColorChange() [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • OnUpdateGfxLargeicon(CCmdUI *pCmdUI) [protected]
  • OnUpdateGfxRemoveitem(CCmdUI *pCmdUI) [protected]
  • OnUpdateGfxRenameitem(CCmdUI *pCmdUI) [protected]
  • OnUpdateGfxSmallicon(CCmdUI *pCmdUI) [protected]
  • PaintItems(CDC *pDC, const int iFolder, CRect rc) [virtual]
  • pBlackPen
  • pLargeImageList
  • pSmallImageList
  • rcDownArrow
  • rcUpArrow
  • RemoveFolder(const int index) [virtual]
  • RemoveItem(const int index) [virtual]
  • SetAnimationTickCount(const long value) [inline, virtual]
  • SetAnimSelHighlight(const int iTime) [virtual]
  • SetFolderImageList(const int folder, CImageList *pImageList, int nImageList) [virtual]
  • SetFolderText(const int index, LPCTSTR text) [virtual]
  • SetImageList(CImageList *pImageList, int nImageList) [virtual]
  • SetItemData(const int index, const DWORD dwData) [virtual]
  • SetItemImage(const int index, const int iImage) [virtual]
  • SetItemText(const int index, LPCTSTR text) [virtual]
  • SetSelFolder(const int index) [virtual]
  • SetSmallIconView(const bool bSet) [virtual]
  • StartGroupEdit(const int index) [virtual]
  • StartItemEdit(const int index) [virtual]
  • xLeftMargin
  • xSmallIconLabelOffset
  • yLargeIconLabelOffset
  • yLargeIconSpacing
  • ySmallIconSpacing
  • yTopMargin
  • ~CGfxOutBarCtrl() [virtual]
Generated on Sun Oct 21 12:47:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CGfxOutBarCtrl::CBarItem Member List

This is the complete list of members for CGfxOutBarCtrl::CBarItem, including all inherited members.
  • CBarItem(LPCTSTR name, const int image, DWORD exData)
  • cItem
  • dwData
  • iImageIndex
  • ~CBarItem() [virtual]
Generated on Sun Oct 21 12:47:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CGfxOutBarCtrl::CBarFolder Member List

This is the complete list of members for CGfxOutBarCtrl::CBarFolder, including all inherited members.
  • arItems
  • CBarFolder(LPCTSTR name, DWORD exData)
  • cName
  • dwData
  • GetItemCount()
  • InsertItem(int index, LPCTSTR text, const int image, const DWORD exData)
  • pChild
  • pLargeImageList
  • pSmallImageList
  • ~CBarFolder() [virtual]
Generated on Sun Oct 21 12:47:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CGfxSplitterWnd Member List

This is the complete list of members for CGfxSplitterWnd, including all inherited members.
  • bWhiteLine
  • CGfxSplitterWnd()
  • GetInsideRect(CRect &rect) const [protected, virtual]
  • m_upBorder
  • OnDrawSplitter(CDC *pDC, ESplitType nType, const CRect &rectArg) [virtual]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnInvertTracker(const CRect &rect) [virtual]
  • OnPaint() [protected]
  • RecalcLayout() [virtual]
  • ~CGfxSplitterWnd() [virtual]
Generated on Sun Oct 21 12:47:50 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CSubclassWnd Member List

This is the complete list of members for CSubclassWnd, including all inherited members.
  • CSubclassWnd()
  • CSubclassWndMap class [friend]
  • Default() [protected, virtual]
  • HookWindow(HWND hwnd) [virtual]
  • HookWindow(CWnd *pWnd) [inline, virtual]
  • HookWndProc(HWND, UINT, WPARAM, LPARAM) [friend]
  • IsHooked() [inline, virtual]
  • m_hWnd [protected]
  • m_pNext [protected]
  • m_pOldWndProc [protected]
  • WindowProc(UINT msg, WPARAM wp, LPARAM lp) [protected, virtual]
  • ~CSubclassWnd()
Generated on Sun Oct 21 12:49:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CColorStatic Member List

This is the complete list of members for CColorStatic, including all inherited members.
  • CColorStatic()
  • GetColor()
  • m_color [private]
  • OnPaint() [protected]
  • SetColor(COLORREF color)
  • ~CColorStatic() [virtual]
Generated on Sun Oct 21 12:47:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CBarConsole Member List

This is the complete list of members for CBarConsole, including all inherited members.
  • CalcDynamicLayout(int nLength, DWORD nMode) [virtual]
  • CBarConsole()
  • CCJControlBar()
  • Create(CWnd *pParentWnd, UINT nID, LPCTSTR lpszWindowName=NULL, CSize sizeDefault=CSize(200, 100), DWORD dwStyle=CBRS_LEFT, BOOL bFlatBorders=FALSE) [virtual]
  • DrawBorders(CDC *pDC, CRect &rect) [protected, virtual]
  • DrawGriperCaption(CDC *pDC, LPRECT pRect) [protected, virtual]
  • DrawGripper(CDC *pDC) [protected, virtual]
  • EnableDockingOnSizeBar(DWORD dwDockStyle) [virtual]
  • EnableFlatLook(BOOL bFlat=TRUE) [virtual]
  • EnableFlatLook(BOOL bGripper, BOOL bBorder, BOOL bButtons) [virtual]
  • EnableSaveState(bool bAutoSave=true) [virtual]
  • EraseNonClient() [protected, virtual]
  • GetButtonRect() [protected, virtual]
  • GetChildRect(CRect &rect) [virtual]
  • GetGripperRect() [protected, virtual]
  • GetHorzSize() [virtual]
  • GetMenuID() [virtual]
  • GetMinExt() [virtual]
  • GetVertSize() [virtual]
  • HitTest(CPoint &point) [protected, virtual]
  • IsBottomDocked() const [virtual]
  • IsFloating() const [virtual]
  • IsHorzDocked() const [virtual]
  • IsLeftDocked() const [virtual]
  • IsRightDocked() const [virtual]
  • IsTopDocked() const [virtual]
  • IsVertDocked() const [virtual]
  • LoadBarState(CSize &size, int nID) [protected, virtual]
  • m_bAutoSave [protected]
  • m_bButtons [protected]
  • m_bDragging [protected]
  • m_bFlatBorder [protected]
  • m_bFlatGripper [protected]
  • m_bFloating [protected]
  • m_bGripper [protected]
  • m_bMaximized [protected]
  • m_bOkToDrag [protected]
  • m_btnClose [protected]
  • m_btnMinim [protected]
  • m_bToFit
  • m_bUnique
  • m_cxOffset [protected]
  • m_cyOffset [protected]
  • m_eAuxIndex [protected]
  • m_eChildBorder
  • m_hAuxIcon [protected]
  • m_hIcon [protected]
  • m_ImageList [protected]
  • m_nID [protected]
  • m_nPos [protected]
  • m_pChildWnd [protected]
  • m_popToolbarID [protected]
  • m_popupMenu [protected]
  • m_popupMenuID [protected]
  • m_ptCurDrag [protected]
  • m_ptStartDrag [protected]
  • m_rcTrack [protected]
  • m_sizeDesired [protected]
  • m_sizeFloat [protected]
  • m_sizeHorz [protected]
  • m_sizeNormal [protected]
  • m_sizeVert [protected]
  • m_strSection [protected]
  • m_ToolTip [protected]
  • m_view
  • Maximize(int size) [virtual]
  • Minimize() [virtual]
  • Normalize() [virtual]
  • OnButtonClose() [protected]
  • OnButtonMinimize() [protected]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu) [protected]
  • OnInvertTracker(const CRect &rect) [protected, virtual]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnLButtonUp(UINT nFlags, CPoint point) [protected]
  • OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) [protected]
  • OnMenuChar(UINT nChar, UINT nFlags, CMenu *pMenu) [protected]
  • OnMouseMove(UINT nFlags, CPoint point) [protected]
  • OnNcHitTest(CPoint point) [protected]
  • OnNcPaint() [protected]
  • OnPaint() [protected]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnUpdateButtonClose(CCmdUI *pCmdUI) [protected]
  • OnUpdateButtonMinimize(CCmdUI *pCmdUI) [protected]
  • OnUpdateCmdUI(CFrameWnd *pTarget, BOOL bDisableIfNoHndler) [virtual]
  • OnWindowPosChanged(WINDOWPOS *lpwndpos) [protected]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • SaveBarState(CSize &size) [protected, virtual]
  • SetChild(CWnd *pWnd) [protected, virtual]
  • SetMenuID(UINT popupMenuID, UINT popToolbarID=0, int nPos=0) [virtual]
  • SetNormalSize(const CSize &cs) [virtual]
  • ShowFrameControls(BOOL bGripper=TRUE, BOOL bButtons=TRUE) [virtual]
  • ~CBarConsole() [virtual]
  • ~CCJControlBar() [virtual]
Generated on Sun Oct 21 12:45:59 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_IID Member List

This is the complete list of members for _IID, including all inherited members.
  • c
  • s1
  • s2
  • x
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_MIDL_TYPE_FORMAT_STRING Member List

This is the complete list of members for _MIDL_TYPE_FORMAT_STRING, including all inherited members.
  • Format
  • Pad
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_MIDL_PROC_FORMAT_STRING Member List

This is the complete list of members for _MIDL_PROC_FORMAT_STRING, including all inherited members.
  • Format
  • Pad
Generated on Sun Oct 21 12:45:46 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CvsCoworker Member List

This is the complete list of members for CvsCoworker, including all inherited members.
  • AddFiles(int handle, const unsigned char *sOptionsAndFilenames, const unsigned char *sComment)
  • CheckinFiles(int handle, const unsigned char *sFilenames, BOOL bKeepCheckedOut)
  • CheckoutFiles(int handle, const unsigned char *sFilenames)
  • CloseProject(int handle)
  • CvsCoworker() [inline]
  • DiffFile(int handle, const unsigned char *sFilename, BOOL bIgnoreCase, BOOL bIgnoreWhitespace)
  • GetErrorMessage(int handle, int iError, int cbErrorBuffer, unsigned char *sError)
  • GetFileChanges(int handle, int cbFilenameBuffer, unsigned char *sFilenameBuffer)
  • GetFilesToAdd(int handle, int cbFilenamesBuffer, unsigned char *sFilenamesBuffer)
  • GetLastError(int handle, int *piError)
  • GetProject(int *pHandle, const unsigned char *sUsername, int cbProjectNameBuffer, unsigned char *sProjectName, int cbProjectHomeBuffer, unsigned char *sProjectHome, BOOL bAllowPathChange, BOOL bAllowNewProject, BOOL *pbNewProject)
  • HasAdvancedOptionsForCommand(int handle, CvsCommand command, BOOL *pbAdvancedOptions)
  • InterfaceSupportsErrorInfo(REFIID riid)
  • OpenProject(int *pHandle, const unsigned char *sUsername, const unsigned char *sProjectName, const unsigned char *sProjectHome)
  • RemoveFiles(int handle, const unsigned char *sFilenames)
  • RenameFile(int handle, const unsigned char *sOldFilename, const unsigned char *sNewFilename)
  • ShowAdvancedOptionsForCommand(int handle, CvsCommand command)
  • ShowFileHistory(int handle, const unsigned char *sFilenames)
  • ShowFileProperties(int handle, const unsigned char *sFilename)
  • ShowUserInterface(int handle, const unsigned char *sFilenames)
  • UncheckoutFiles(int handle, const unsigned char *sFilenames)
  • UpdateFiles(int handle, const unsigned char *sFilenames, BOOL bDirectories, BOOL bRecurse)
Generated on Sun Oct 21 12:50:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CvsFilenames Member List

This is the complete list of members for CvsFilenames, including all inherited members.
  • CvsFilenames(const unsigned char *)
  • getFilename(int)
  • getNumberOfFilenames() [inline]
  • getOptionsAndFilename(int i, CvsString &, CvsString &)
  • m_arrayOffsetName [protected]
  • m_nFilenames [protected]
  • m_sBuffer [protected]
  • ~CvsFilenames()
Generated on Sun Oct 21 12:50:35 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CvsProject Member List

This is the complete list of members for CvsProject, including all inherited members.
  • addFiles(CvsFilenames &, const char *)
  • checkinFiles(CvsFilenames &, BOOL)
  • checkoutFiles(CvsFilenames &)
  • closeProject()
  • CvsProject()
  • diffFile(const char *, BOOL, BOOL)
  • FindProject(int) [static]
  • getErrorMessage(int, CvsString &)
  • getFileChanges(CvsString &)
  • getFilesToAdd(CvsString &)
  • getLastError() [inline]
  • getProject(const char *, const char *, const char *, BOOL, BOOL, BOOL &)
  • getProjectHandle() [inline]
  • getProjectHome() [inline]
  • getProjectName() [inline]
  • hasAdvancedOptionsForCommand(CvsCommand, BOOL &)
  • isFileDifferent(const char *, CvsOption, BOOL &)
  • m_hProject [protected]
  • m_iLastError [protected]
  • m_pNextProject [protected]
  • m_sProjectHome [protected]
  • m_sProjectName [protected]
  • m_sUsername [protected]
  • openProject(const char *, const char *, const char *)
  • removeFiles(CvsFilenames &)
  • renameFile(const char *, const char *)
  • showAdvancedOptionsForCommand(CvsCommand)
  • showFileHistory(CvsFilenames &)
  • showFileProperties(const char *)
  • showUserInterface(CvsFilenames &)
  • uncheckoutFiles(CvsFilenames &)
  • updateFiles(CvsFilenames &, BOOL, BOOL)
  • ~CvsProject()
Generated on Sun Oct 21 12:50:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CvsString Member List

This is the complete list of members for CvsString, including all inherited members.
  • CvsString() [inline]
  • CvsString(const char *s) [inline]
  • CvsString(const CvsString &s) [inline]
  • getBuffer() [inline]
  • getBufferMax() const [inline]
  • m_cbBufferMax [protected]
  • m_sBuffer [protected]
  • operator const char *() const [inline]
  • operator+(const char *s) const [inline]
  • operator+=(const char *s) [inline]
  • operator=(const char *s) [inline]
  • operator=(const CvsString &s) [inline]
  • operator==(const char *s) const [inline]
  • operator[](int i) [inline]
  • recycle(char *, int) [protected, static]
  • requireSize(int) [inline]
  • resize(int) [protected]
  • strcat(const char *) [inline]
  • strcpy(const char *) [inline]
  • strlen() const [inline]
  • strncpy(const char *, int) [inline]
  • ~CvsString()
Generated on Sun Oct 21 12:50:43 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CvsTrace Member List

This is the complete list of members for CvsTrace, including all inherited members.
  • CvsTrace(const char *)
  • m_sOuter [private]
  • ~CvsTrace()
Generated on Sun Oct 21 12:50:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCustInvertTable Member List

This is the complete list of members for CCustInvertTable, including all inherited members.
  • CCustInvertTable()
  • Initialize()
  • m_garbage [protected]
  • ~CCustInvertTable() [virtual]
Generated on Sun Oct 21 12:47:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CustInvertTable Member List

This is the complete list of members for CustInvertTable, including all inherited members.
  • cmd
  • key
  • title
Generated on Sun Oct 21 12:50:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CMMenuString Member List

This is the complete list of members for CMMenuString, including all inherited members.
  • _GetBaseClass() [static]
  • classUObject [protected, static]
  • CMMenuString(unsigned int maxstr, const char *uniqueName, char *const *defaultStr=0L)
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CreateObject(const char *className) [static]
  • fAllEntries [protected, static]
  • fAllStrs [protected]
  • fBuf [protected]
  • Find(const char *uniqueName) [static]
  • fMaxStr [protected]
  • fTimeStamp [protected]
  • GetData(void) const [virtual]
  • GetList(void) const [inline]
  • GetList(void) [inline]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • Insert(const char *newstr)
  • IsKindOf(const URuntimeClass *pClass) const
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SetData(const void *ptr, unsigned int size) [virtual]
  • SizeOf(void) const [virtual]
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • ~CMMenuString() [virtual]
  • ~CPersistent() [virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:48:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCustomizeMenus Member List

This is the complete list of members for CCustomizeMenus, including all inherited members.
  • CCustomizeMenus(CMMenuString *fromMenu, CWnd *pParent=NULL)
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • GetIcon(const CustInvertTable *entry) [protected]
  • IDD enum value
  • m_addbtn
  • m_cmdsList
  • m_downbtn
  • m_Menu [protected]
  • m_menuList
  • m_removebtn
  • m_SmallImageList [protected]
  • m_upbtn
  • OnAdd() [protected]
  • OnBegindragMenulist(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnDblclkAllcmds(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnDblclkMenulist(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnDown() [protected]
  • OnInitDialog() [protected, virtual]
  • OnItemchangedAllcmds(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnItemchangedMenulist(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnMove(int offset) [protected]
  • OnOK() [protected, virtual]
  • OnRemove() [protected]
  • OnUp() [protected]
Generated on Sun Oct 21 12:47:09 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCvsStatusBar Member List

This is the complete list of members for CCvsStatusBar, including all inherited members.
  • CCvsStatusBar()
  • DrawItem(LPDRAWITEMSTRUCT) [virtual]
  • m_indic [protected]
  • m_settimer [protected]
  • m_step [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • ~CCvsStatusBar() [virtual]
Generated on Sun Oct 21 12:47:26 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CMyShellTree Member List

This is the complete list of members for CMyShellTree, including all inherited members.
  • DisableCommon() [protected]
  • OnDeleteitem(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnItemexpanding(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnRclick(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnSelchanged(NMHDR *pNMHDR, LRESULT *pResult) [protected]
Generated on Sun Oct 21 12:48:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CExploreBar Member List

This is the complete list of members for CExploreBar, including all inherited members.
  • CExploreBar() [protected]
  • Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL) [virtual]
  • DisableCommon() [protected]
  • m_TreeCtrl
  • OnDraw(CDC *pDC) [protected, virtual]
  • OnUpdateCmd(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewCheckout(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewImport(CCmdUI *pCmdUI) [protected]
  • OnViewCheckout() [protected]
  • OnViewImport() [protected]
  • OnWindowPosChanged(WINDOWPOS *lpwndpos) [protected]
  • ~CExploreBar() [protected, virtual]
Generated on Sun Oct 21 12:47:38 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

KoWatcher Member List

This is the complete list of members for KoWatcher, including all inherited members.
  • DelegateRun(LPVOID p) [inline, private, static]
  • KoWatcher(HWND hWnd) [inline]
  • m_count [private]
  • m_eventStartWatching [private]
  • m_eventTerminate [private]
  • m_handles [private]
  • m_hWnd [private]
  • m_isRecursive [private]
  • m_path [private]
  • m_section [private]
  • Run() [private]
  • SignalStartWatch(LPCTSTR path, bool isRecursive) [inline]
  • SignalTerminate() [inline]
  • StartWatch() [private]
  • StopWatch() [private]
  • WM_FILECHANGE enum value
  • ~KoWatcher() [inline, private]
Generated on Sun Oct 21 12:48:22 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CGraphDoc Member List

This is the complete list of members for CGraphDoc, including all inherited members.
  • CGraphDoc() [protected]
  • fData [protected]
  • fDir [protected]
  • fName [protected]
  • fNode [protected]
  • GetDir(void) const [inline]
  • GetEntryInfo(void) [inline]
  • GetName(void) const [inline]
  • GetNode(void) [inline]
  • GetTreeView(void)
  • NumNodes() [protected]
  • OnNewDocument() [virtual]
  • PrepareNew(void) [protected]
  • Serialize(CArchive &ar) [virtual]
  • SetNode(CLogNode *node, const char *dir)
  • ~CGraphDoc() [virtual]
Generated on Sun Oct 21 12:47:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CGraphFrame Member List

This is the complete list of members for CGraphFrame, including all inherited members.
  • brdrAllRaised enum value [protected]
  • brdrFlatAll enum value [protected]
  • brdrFlatBottom enum value [protected]
  • brdrFlatHorizontal enum value [protected]
  • brdrFlatLeft enum value [protected]
  • brdrFlatRight enum value [protected]
  • brdrFlatTop enum value [protected]
  • brdrFlatVertical enum value [protected]
  • CCJMDIChildWnd()
  • CGraphFrame()
  • DockControlBarLeftOf(CControlBar *Bar, CControlBar *LeftOf) [protected, virtual]
  • DockFlatBorders enum name [protected]
  • DockSizeBar(CControlBar *pBar, CCJSizeDockBar *pDockBar=NULL, LPRECT lpRect=NULL) [protected, virtual]
  • dwDockBarMap [protected, static]
  • EnableDocking(DWORD dwDockStyle) [protected, virtual]
  • EnableDockingSizeBar(DWORD dwDockStyle, DockFlatBorders FlatFlags=brdrAllRaised) [protected, virtual]
  • GetInitializedMenu(UINT nMenuID, UINT nToolBarID) [virtual]
  • GetInitializedMenu(UINT nMenuID, UINT *nToolbarIDs, int nSize) [virtual]
  • GetMenuID() [virtual]
  • GetToolBarID() [virtual]
  • GetToolBarIDs(int &nCount) [virtual]
  • m_hMenu [protected]
  • m_nCount [protected]
  • m_nMenuID [protected]
  • m_nToolBarID [protected]
  • m_nToolBarIDs [protected]
  • OnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo) [virtual]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • RecalcAllExcept(CCJSizeDockBar *pBar) [protected, virtual]
  • RecalcLayout(BOOL bNotify=TRUE) [virtual]
  • SetResourceIDs(UINT nMenuID, UINT nToolBarID) [virtual]
  • SetResourceIDs(UINT nMenuID, UINT *nToolBarIDs, int nCount) [virtual]
  • ~CCJMDIChildWnd() [virtual]
  • ~CGraphFrame() [virtual]
Generated on Sun Oct 21 12:47:52 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CGraphRectTracker Member List

This is the complete list of members for CGraphRectTracker, including all inherited members.
  • CGraphRectTracker(CGraphView *view) [inline]
  • mView [protected]
  • OnChangedRect(const CRect &rectOld) [virtual]
Generated on Sun Oct 21 12:47:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TGraph Member List

This is the complete list of members for TGraph, including all inherited members.
  • TraverseGraph(CLogNode *node)
  • TraverseNode(CLogNode *node)=0 [pure virtual]
Generated on Sun Oct 21 12:50:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TGraphRectSelect Member List

This is the complete list of members for TGraphRectSelect, including all inherited members.
  • mR [protected]
  • mShiftOn [protected]
  • mView [protected]
  • TGraphRectSelect(bool shiftOn, CGraphView *view, CRect &r) [inline]
  • TraverseGraph(CLogNode *node)
  • TraverseNode(CLogNode *node) [inline, virtual]
Generated on Sun Oct 21 12:50:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TGraphCmdStatus Member List

This is the complete list of members for TGraphCmdStatus, including all inherited members.
  • fCountSel
  • fSel1
  • fSel2
  • TGraphCmdStatus() [inline]
  • TraverseGraph(CLogNode *node)
  • TraverseNode(CLogNode *node) [inline, virtual]
Generated on Sun Oct 21 12:50:06 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CGraphConsole Member List

This is the complete list of members for CGraphConsole, including all inherited members.
  • CGraphConsole() [inline]
  • cvs_err(char *txt, long len) [inline, virtual]
  • cvs_out(char *txt, long len) [inline, virtual]
  • view
Generated on Sun Oct 21 12:47:51 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TGraphDelCmd Member List

This is the complete list of members for TGraphDelCmd, including all inherited members.
  • fAllRevs
  • fCountSel
  • fOnlyRev
  • TGraphDelCmd() [inline]
  • TraverseGraph(CLogNode *node)
  • TraverseNode(CLogNode *node) [inline, virtual]
Generated on Sun Oct 21 12:50:07 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

TGraphSelNonSig Member List

This is the complete list of members for TGraphSelNonSig, including all inherited members.
  • fView
  • TGraphSelNonSig(CGraphView *view) [inline]
  • TraverseGraph(CLogNode *node)
  • TraverseNode(CLogNode *node) [inline, virtual]
Generated on Sun Oct 21 12:50:08 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CRevisionConsole Member List

This is the complete list of members for CRevisionConsole, including all inherited members.
  • CRevisionConsole() [inline]
  • cvs_err(char *txt, long len) [inline, virtual]
  • cvs_out(char *txt, long len) [inline, virtual]
  • fOut [protected]
  • init(LPCTSTR path, LPCTSTR fname) [inline]
  • ~CRevisionConsole() [inline]
Generated on Sun Oct 21 12:49:37 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CGraphView Member List

This is the complete list of members for CGraphView, including all inherited members.
  • CalcImageSize(void)
  • CGraphView() [protected]
  • DisableCommon() [protected]
  • DisableUpdate(CCmdUI *pCmdUI) [protected]
  • fFirstTime [protected]
  • GetDeviceScrollPosition() [inline]
  • GetImgList(void) [inline, static]
  • InvalidateRect(const URECT *r) [inline]
  • IsSelSingleNode(kLogNode type, bool equal=true) [protected]
  • m_ImageList [protected, static]
  • m_numberOfPages [protected]
  • m_pageHeight [protected]
  • OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo) [protected, virtual]
  • OnContextMenu(CWnd *pWnd, CPoint point) [protected]
  • OnDraw(CDC *pDC) [protected, virtual]
  • OnEndPrinting(CDC *pDC, CPrintInfo *pInfo) [protected, virtual]
  • OnGraphChangelogmessage() [protected]
  • OnGraphGraphoptions() [protected]
  • OnGraphSetdescription() [protected]
  • OnGraphSetstate() [protected]
  • OnInitialUpdate() [protected, virtual]
  • OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu) [protected]
  • OnLButtonDown(UINT nFlags, CPoint point) [protected]
  • OnPreparePrinting(CPrintInfo *pInfo) [protected, virtual]
  • OnPrint(CDC *pDC, CPrintInfo *pInfo) [protected, virtual]
  • OnQueryAnnotate() [protected]
  • OnUpdateGraphChangelogmessage(CCmdUI *pCmdUI) [protected]
  • OnUpdateGraphSetdescription(CCmdUI *pCmdUI) [protected]
  • OnUpdateGraphSetstate(CCmdUI *pCmdUI) [protected]
  • OnUpdateQueryAnnotate(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewDelrev(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewDiff(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewLockf(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewReload(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewRetrieve(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewSelnonsig(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewTag(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewUnlockf(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewUpdate(CCmdUI *pCmdUI) [protected]
  • OnViewDelrev() [protected]
  • OnViewDiff() [protected]
  • OnViewLockf() [protected]
  • OnViewReload() [protected]
  • OnViewRetrieve() [protected]
  • OnViewSelnonsig() [protected]
  • OnViewTag() [protected]
  • OnViewUnlockf() [protected]
  • OnViewUpdate() [protected]
  • ~CGraphView() [protected, virtual]
Generated on Sun Oct 21 12:47:55 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CHistComboBoxEx Member List

This is the complete list of members for CHistComboBoxEx, including all inherited members.
  • AddString(LPCTSTR lpszString)
  • CHistComboBoxEx()
  • GetOldLoc()
  • InsertString(int nIndex, LPCTSTR lpszString)
  • m_ImageList [private]
  • NewRoot(const char *root)
  • OnDropdown() [protected]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • SetIcon(COMBOBOXEXITEM cbi)
  • ~CHistComboBoxEx() [virtual]
Generated on Sun Oct 21 12:47:57 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CLogFrame Member List

This is the complete list of members for CLogFrame, including all inherited members.
  • brdrAllRaised enum value [protected]
  • brdrFlatAll enum value [protected]
  • brdrFlatBottom enum value [protected]
  • brdrFlatHorizontal enum value [protected]
  • brdrFlatLeft enum value [protected]
  • brdrFlatRight enum value [protected]
  • brdrFlatTop enum value [protected]
  • brdrFlatVertical enum value [protected]
  • CCJMDIChildWnd()
  • CLogFrame()
  • DockControlBarLeftOf(CControlBar *Bar, CControlBar *LeftOf) [protected, virtual]
  • DockFlatBorders enum name [protected]
  • DockSizeBar(CControlBar *pBar, CCJSizeDockBar *pDockBar=NULL, LPRECT lpRect=NULL) [protected, virtual]
  • dwDockBarMap [protected, static]
  • EnableDocking(DWORD dwDockStyle) [protected, virtual]
  • EnableDockingSizeBar(DWORD dwDockStyle, DockFlatBorders FlatFlags=brdrAllRaised) [protected, virtual]
  • GetInitializedMenu(UINT nMenuID, UINT nToolBarID) [virtual]
  • GetInitializedMenu(UINT nMenuID, UINT *nToolbarIDs, int nSize) [virtual]
  • GetMenuID() [virtual]
  • GetToolBarID() [virtual]
  • GetToolBarIDs(int &nCount) [virtual]
  • m_hMenu [protected]
  • m_nCount [protected]
  • m_nMenuID [protected]
  • m_nToolBarID [protected]
  • m_nToolBarIDs [protected]
  • OnClose() [protected]
  • OnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo) [virtual]
  • OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext) [virtual]
  • OnEraseBkgnd(CDC *pDC) [protected]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • RecalcAllExcept(CCJSizeDockBar *pBar) [protected, virtual]
  • RecalcLayout(BOOL bNotify=TRUE) [virtual]
  • SetResourceIDs(UINT nMenuID, UINT nToolBarID) [virtual]
  • SetResourceIDs(UINT nMenuID, UINT *nToolBarIDs, int nCount) [virtual]
  • ~CCJMDIChildWnd() [virtual]
  • ~CLogFrame() [virtual]
Generated on Sun Oct 21 12:48:28 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWinPlacement Member List

This is the complete list of members for CWinPlacement, including all inherited members.
  • _GetBaseClass() [static]
  • classUObject [protected, static]
  • CPersistent(const char *uniqueName, kClassPersistent pclass)
  • CreateObject(const char *className) [static]
  • CWinPlacement(const char *uniqueName) [inline]
  • fAllEntries [protected, static]
  • Find(const char *uniqueName) [static]
  • fTimeStamp [protected]
  • GetData(void) const [inline, virtual]
  • GetRuntimeClass() const [virtual]
  • GetTimeStamp() const [inline]
  • hasOne
  • IsKindOf(const URuntimeClass *pClass) const
  • LoadAll(void) [static]
  • NeedSave(bool onlySettings=false) [static]
  • operator=(const WINDOWPLACEMENT &newplace) [inline]
  • placement
  • ResetTimeStamp() [inline]
  • rtUObject() [static]
  • SaveAll(void) [static]
  • SaveAllSettings(const char *settingFileName, const char *forPath) [static]
  • SetData(const void *ptr, unsigned int size) [inline, virtual]
  • SizeOf(void) const [inline, virtual]
  • TouchTimeStamp() [inline]
  • UObject() [inline, protected]
  • ~CPersistent() [virtual]
  • ~CWinPlacement() [inline, virtual]
  • ~UObject() [inline, virtual]
Generated on Sun Oct 21 12:51:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CMainFrame Member List

This is the complete list of members for CMainFrame, including all inherited members.
  • brdrAllRaised enum value [protected]
  • brdrFlatAll enum value [protected]
  • brdrFlatBottom enum value [protected]
  • brdrFlatHorizontal enum value [protected]
  • brdrFlatLeft enum value [protected]
  • brdrFlatRight enum value [protected]
  • brdrFlatTop enum value [protected]
  • brdrFlatVertical enum value [protected]
  • CCJMDIFrameWnd()
  • CCJMDIFrameWnd::InitializeMenu(HMENU *phMenu, UINT nMenuID, UINT nToolbarID=NULL) [virtual]
  • ChangeLocation()
  • CMainFrame()
  • DockControlBarLeftOf(CToolBar *Bar, CToolBar *LeftOf) [protected]
  • CCJMDIFrameWnd::DockControlBarLeftOf(CControlBar *Bar, CControlBar *LeftOf) [virtual]
  • DockFlatBorders enum name [protected]
  • DockSizeBar(CControlBar *pBar, CCJSizeDockBar *pDockBar=NULL, LPRECT lpRect=NULL) [virtual]
  • DropFiles(HDROP hDropInfo)
  • dwDockBarMap [protected, static]
  • EnableDocking(DWORD dwDockStyle) [virtual]
  • EnableDockingSizeBar(DWORD dwDockStyle, DockFlatBorders FlatFlags=brdrAllRaised) [virtual]
  • FreshenFileMask() [protected]
  • GetBrowseHistory(void) [inline]
  • GetBrowserView()
  • GetConsoleView() [inline]
  • GetEnvMainThread(const char *name)
  • GetExplorerView()
  • GetFilterModel() [inline]
  • GetIgnoreModel() [inline]
  • GetMenuList(void) [inline]
  • GetRecursionModel() [inline]
  • GetStatusBar() [inline]
  • GetWorkspace() [inline]
  • InitializeDockingWindows() [protected]
  • InitializeMenu(CMultiDocTemplate *pDocTemplate, UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=0, UINT nDefaultMenuID=NULL) [virtual]
  • InitializeMenu(CMultiDocTemplate *pDocTemplate, UINT nMenuID, UINT nToolbarID=NULL, UINT nDefaultMenuID=NULL) [virtual]
  • InitializeMenu(HMENU *phMenu, UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=NULL) [virtual]
  • InitialShowWindow(int nCmdShow)
  • LoadBarState(LPCTSTR lpszProfileName) [virtual]
  • m_bRestoreFocus [private]
  • m_browseHist [protected]
  • m_comboFilterMask [protected]
  • m_consolebar [protected]
  • m_filter [protected]
  • m_fontNormal [protected]
  • m_ignore [protected]
  • m_menuList [protected]
  • m_recursion [protected]
  • m_state [protected]
  • m_TabImages [protected]
  • m_wndBrowser [protected]
  • m_wndFilter [protected]
  • m_wndList [protected]
  • m_wndMenuBar [protected]
  • m_wndMultiUser [protected]
  • m_wndStatusBar [protected]
  • m_wndTags [protected]
  • m_wndToolBar [protected]
  • m_wndWorkspace [protected]
  • NewMenu(UINT nMenuID, UINT *nToolbarIDs=NULL, int nSize=0) [protected, virtual]
  • NewMenu(UINT nMenuID, UINT nToolbarID=NULL) [protected, virtual]
  • OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized) [protected]
  • OnBroadcastCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo)
  • OnClose() [protected]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnDropFiles(HDROP hDropInfo) [protected]
  • OnFilterMaskEntered()
  • OnHistorySelect() [protected]
  • OnInitMenu(CMenu *pMenu) [protected]
  • OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu) [protected]
  • OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) [protected]
  • OnMenuChar(UINT nChar, UINT nFlags, CMenu *pMenu) [protected]
  • OnSysCommand(UINT nID, LPARAM lParam) [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • OnUpdateFilterMask(CCmdUI *pCmdUI) [protected]
  • OnUpdateHistory(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewAdded(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewChanged(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewConflict(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewHideunknown(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewIgnore(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewMissing(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewModified(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewRecursive(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewRemoved(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewUnknown(CCmdUI *pCmdUI) [protected]
  • OnViewAdded() [protected]
  • OnViewChanged() [protected]
  • OnViewConflict() [protected]
  • OnViewHideunknown() [protected]
  • OnViewIgnore() [protected]
  • OnViewMissing() [protected]
  • OnViewModified() [protected]
  • OnViewRecursive() [protected]
  • OnViewRemoved() [protected]
  • OnViewUnknown() [protected]
  • PreCreateWindow(CREATESTRUCT &cs) [virtual]
  • CCJMDIFrameWnd::PreCreateWindow(CREATESTRUCT &cs, UINT nIconID) [virtual]
  • RecalcAllExcept(CCJSizeDockBar *pBar) [virtual]
  • RecalcLayout(BOOL bNotify=TRUE) [virtual]
  • SaveBarState(LPCTSTR lpszProfileName) const [virtual]
  • ~CCJMDIFrameWnd() [virtual]
  • ~CMainFrame() [virtual]
Generated on Sun Oct 21 12:48:41 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CNoPython Member List

This is the complete list of members for CNoPython, including all inherited members.
  • CNoPython(CWnd *pParent=NULL)
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • IDD enum value
  • m_remind
  • m_url
  • OnInitDialog() [protected, virtual]
Generated on Sun Oct 21 12:48:49 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CProgress Member List

This is the complete list of members for CProgress, including all inherited members.
  • CProgress(bool interruptable, const char *title=0L)
  • DoAbort(void)
  • HasAborted(void) const [inline]
  • m_abort [protected]
  • m_dlg [protected]
  • SetProgress(int percent)
  • ~CProgress()
Generated on Sun Oct 21 12:49:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CProgressDialog Member List

This is the complete list of members for CProgressDialog, including all inherited members.
  • CProgressDialog(bool &abort, bool interruptable, CWnd *pParent=NULL)
  • Create()
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • hWndParent [protected]
  • IDD enum value
  • m_abort [protected]
  • m_pParent [protected]
  • m_progress
  • m_stopable [protected]
  • OnInitDialog() [protected, virtual]
  • OnOK() [protected, virtual]
  • PostNcDestroy() [protected, virtual]
Generated on Sun Oct 21 12:49:02 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CSortHeaderCtrl Member List

This is the complete list of members for CSortHeaderCtrl, including all inherited members.
  • CSortHeaderCtrl()
  • DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) [virtual]
  • m_bSortAsc [protected]
  • m_nSortCol [protected]
  • SetSortImage(int nCol, BOOL bAsc) [virtual]
  • ~CSortHeaderCtrl() [virtual]
Generated on Sun Oct 21 12:49:44 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CSplashWnd Member List

This is the complete list of members for CSplashWnd, including all inherited members.
  • c_bShowSplashWnd [protected, static]
  • c_pSplashWnd [protected, static]
  • CloseSplashScreen() [static]
  • Create(CWnd *pParentWnd=NULL) [protected]
  • CSplashWnd() [protected]
  • EnableSplashScreen(BOOL bEnable=TRUE) [static]
  • HideSplashScreen() [protected]
  • m_bitmap
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnPaint() [protected]
  • OnTimer(UINT nIDEvent) [protected]
  • PostNcDestroy() [virtual]
  • PreTranslateAppMessage(MSG *pMsg) [static]
  • ShowSplashScreen(CWnd *pParentWnd=NULL) [static]
  • ~CSplashWnd()
Generated on Sun Oct 21 12:49:47 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCVS_CoworkerModule Member List

This is the complete list of members for CCVS_CoworkerModule, including all inherited members.
  • dwThreadID
  • FindOneOf(LPCTSTR p1, LPCTSTR p2)
  • Lock()
  • Unlock()
Generated on Sun Oct 21 12:47:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CTbEdit Member List

This is the complete list of members for CTbEdit, including all inherited members.
  • CTbEdit()
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • WM_CONTENTCHANGE enum value
  • ~CTbEdit() [virtual]
Generated on Sun Oct 21 12:49:54 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CTipDlg Member List

This is the complete list of members for CTipDlg, including all inherited members.
  • CTipDlg(CWnd *pParent=NULL)
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • GetNextTipString(CString &strNext) [protected]
  • m_bStartup
  • m_pStream
  • m_strTip
  • OnCtlColor(CDC *pDC, CWnd *pWnd, UINT nCtlColor) [protected]
  • OnInitDialog() [protected, virtual]
  • OnNextTip() [protected]
  • OnOK() [protected, virtual]
  • OnPaint() [protected]
  • ~CTipDlg() [virtual]
Generated on Sun Oct 21 12:50:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CToolbarCombo Member List

This is the complete list of members for CToolbarCombo, including all inherited members.
  • Create(DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
  • CToolbarCombo()
  • GetItemText(int pos, LPTSTR buffer, int count)
  • GetManager() [inline]
  • GetText() [inline]
  • m_edit [private]
  • m_manager [private]
  • m_text [private]
  • OnContentChange(WPARAM wp, LPARAM lp) [protected]
  • OnSelendcancel() [protected]
  • OnSelendok() [protected]
  • ResetText() [protected]
  • SetText(const CString &text) [protected]
  • ~CToolbarCombo() [virtual]
Generated on Sun Oct 21 12:50:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

Win32wstring Member List

This is the complete list of members for Win32wstring, including all inherited members.
  • convert(unsigned int codepage, const char *s, int inLen) [inline, private]
  • Win32wstring(unsigned int codepage, std::string *s) [inline]
  • Win32wstring(unsigned int codepage, std::string &s) [inline]
Generated on Sun Oct 21 12:50:53 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CLogoutThread Member List

This is the complete list of members for CLogoutThread, including all inherited members.
  • CLogoutThread()
  • Delete() [virtual]
  • InitInstance() [protected, virtual]
  • KillThread(void) [inline]
  • m_term [protected]
  • ~CLogoutThread() [virtual]
Generated on Sun Oct 21 12:48:31 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CAboutDlg Member List

This is the complete list of members for CAboutDlg, including all inherited members.
  • CAboutDlg()
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • IDD enum value
  • m_url
  • m_vers
  • OnInitDialog() [protected, virtual]
Generated on Sun Oct 21 12:45:48 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWincvsApp Member List

This is the complete list of members for CWincvsApp, including all inherited members.
  • ActivateBrowserView(void)
  • CWincvsApp()
  • ExitInstance() [virtual]
  • gCvsProcess
  • gCvsRunning
  • gCvsStopping
  • GetAppModule(UStr &module) const
  • GetAppPath(UStr &path) const
  • GetAppVersion(UStr &vers) const
  • GetBrowserView(void)
  • GetConsoleView(void)
  • GetDocument(void)
  • GetEnvMainThread(const char *name)
  • GetExplorerView(void)
  • GetFileView(void)
  • GetFilterModel() const
  • GetIdleTime(void) const [inline]
  • GetIgnoreModel() const
  • GetMainFrame(void) [inline]
  • GetRecursionModel() const
  • GetRoot()
  • GetStatusBar()
  • gLastCvsResult
  • gLogGraph
  • gLogHtml
  • gLogTempl
  • IdleCvsProgress(void)
  • InitATL() [protected]
  • InitInstance() [virtual]
  • LookForResourceFile(const char *what, UStr &path) [protected]
  • m_bATLInited [protected]
  • m_idletime [protected]
  • m_isBackgroundProcess
  • m_mainFrame [protected]
  • m_server [protected]
  • OnAppAbout() [protected]
  • OnAppCopyrights() [protected]
  • OnAppCredits() [protected]
  • OnFileNew() [protected]
  • OnHelpCvs() [protected]
  • OnHelpCvsclient() [protected]
  • OnLogWindowIsPresent(CCmdUI *pCmdUI) [protected]
  • PreTranslateMessage(MSG *pMsg) [virtual]
  • ResetIdleTime(void) [inline]
  • SaveAllModified() [virtual]
  • ShowTipAtStartup(void) [private]
  • ShowTipOfTheDay(void) [private]
  • UpdateAllDocsView()
Generated on Sun Oct 21 12:50:56 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWndRedrawMngr Member List

This is the complete list of members for CWndRedrawMngr, including all inherited members.
  • CWndRedrawMngr(CWnd *pWnd, BOOL bRedraw=FALSE)
  • m_pWnd [private]
  • SetRedraw(BOOL bRedraw)
  • ~CWndRedrawMngr() [virtual]
Generated on Sun Oct 21 12:51:10 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWinCvsBrowser Member List

This is the complete list of members for CWinCvsBrowser, including all inherited members.
  • Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL) [virtual]
  • CSelectionChangeNotifier
  • CWinCvsBrowser() [protected]
  • DeleteAllItems(HTREEITEM root=0L)
  • DisableCommon() [protected]
  • GetItemByLocation(const char *path) [protected]
  • GetRoot(void) const [inline]
  • m_Imagelist [protected, static]
  • m_isResetViewPending [protected]
  • m_isSelectionChanged [protected]
  • m_isSelectionNotificationLocked [protected]
  • m_root [protected]
  • NotifySelectionChange()
  • OnCustomize(UINT nID) [protected]
  • OnDestroy() [protected]
  • OnDraw(CDC *pDC) [protected, virtual]
  • OnIgnoreChanged()
  • OnInitialUpdate() [virtual]
  • OnItemexpanding(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnMacro(UINT nID) [protected]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • OnResetView(WPARAM, LPARAM) [protected]
  • OnSelchanged(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnSelchanging(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) [protected]
  • OnUpdateCmd(CCmdUI *pCmdUI, BOOL needCvsInfos) [protected]
  • OnUpdateCustomize(CCmdUI *pCmdUI) [protected]
  • OnUpdateMacro(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewAdd(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewCheckout(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewExplore(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewImport(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewReload(CCmdUI *pCmdUI) [protected]
  • OnUpdateViewUpdate(CCmdUI *pCmdUI) [protected]
  • OnViewAdd() [protected]
  • OnViewCheckout() [protected]
  • OnViewCommit() [protected]
  • OnViewDiff() [protected]
  • OnViewEdit() [protected]
  • OnViewEditors() [protected]
  • OnViewExplore() [protected]
  • OnViewImport() [protected]
  • OnViewLock() [protected]
  • OnViewLog() [protected]
  • OnViewQueryUpdate() [protected]
  • OnViewRelease() [protected]
  • OnViewReload() [protected]
  • OnViewStatus() [protected]
  • OnViewTagBranch() [protected]
  • OnViewTagDelete() [protected]
  • OnViewTagNew() [protected]
  • OnViewUnedit() [protected]
  • OnViewUnlock() [protected]
  • OnViewUpdate() [protected]
  • OnViewWatchers() [protected]
  • OnViewWatchOff() [protected]
  • OnViewWatchOn() [protected]
  • PreCreateWindow(CREATESTRUCT &cs) [protected, virtual]
  • ResetBrowser(const char *path, bool notifyView=false)
  • ResetView(bool forceReload=false, bool notifyView=false)
  • RetrievePath(HTREEITEM item, UStr &path)
  • SetNewStyle(long lStyleMask, BOOL bSetBits)
  • StepToLocation(const char *path, bool notifyView=false)
  • StoreExpanded(std::vector< UStr > &allExpanded, HTREEITEM root=0L) [protected]
  • ~CWinCvsBrowser() [protected, virtual]
Generated on Sun Oct 21 12:51:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWinCvsBrowser::CSelectionChangeNotifier Member List

This is the complete list of members for CWinCvsBrowser::CSelectionChangeNotifier, including all inherited members.
  • CSelectionChangeNotifier(CWinCvsBrowser *view, bool notify) [inline]
  • m_notify [protected]
  • m_view [protected]
  • m_wasLocked [protected]
  • ~CSelectionChangeNotifier() [inline]
Generated on Sun Oct 21 12:51:01 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

_afxRichEditCookie Member List

This is the complete list of members for _afxRichEditCookie, including all inherited members.
  • _afxRichEditCookie(CArchive &ar) [inline]
  • m_ar
  • m_dwError
Generated on Sun Oct 21 12:45:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWincvsDoc Member List

This is the complete list of members for CWincvsDoc, including all inherited members.
  • CWincvsDoc()
  • m_viewPath [protected]
  • OnAppCmdline() [protected]
  • OnAppLogin() [protected]
  • OnAppLogout() [protected]
  • OnAppPreferences() [protected]
  • OnAppRtagBranch() [protected]
  • OnAppRtagDelete() [protected]
  • OnAppRtagNew() [protected]
  • OnBrowserOpen() [protected]
  • OnMacroAdmin(UINT nID) [protected]
  • OnNewDocument() [virtual]
  • OnSavesettings() [protected]
  • OnStopcvs() [protected]
  • OnUpdateCvsCmd(CCmdUI *pCmdUI) [protected]
  • OnUpdateMacroAdmin(CCmdUI *pCmdUI) [protected]
  • OnUpdatePrefs(CCmdUI *pCmdUI) [protected]
  • OnUpdateSavesettings(CCmdUI *pCmdUI) [protected]
  • OnUpdateStopcvs(CCmdUI *pCmdUI) [protected]
  • OnUpdateUsePyshell(CCmdUI *pCmdUI) [protected]
  • OnUpdateUseTclshell(CCmdUI *pCmdUI) [protected]
  • OnUsePyshell() [protected]
  • OnUseTclshell() [protected]
  • OnViewBrowselocationRemoveunwanted() [protected]
  • OnViewInit() [protected]
  • OnViewPathChanged() [protected]
  • Serialize(CArchive &ar) [virtual]
  • ~CWincvsDoc() [virtual]
Generated on Sun Oct 21 12:51:03 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCharFormat Member List

This is the complete list of members for CCharFormat, including all inherited members.
  • CCharFormat() [inline]
  • CCharFormat(const CHARFORMAT &newf) [inline]
  • operator CHARFORMAT &() [inline]
Generated on Sun Oct 21 12:46:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CCvsThreadLock Member List

This is the complete list of members for CCvsThreadLock, including all inherited members.
  • CCvsThreadLock() [inline]
  • m_lock [static]
  • ~CCvsThreadLock() [inline]
Generated on Sun Oct 21 12:47:27 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Member List

CWincvsView Member List

This is the complete list of members for CWincvsView, including all inherited members.
  • CanPaste() const
  • CWincvsView() [protected]
  • FeedThisLine(const char *buf, int numbuf, bool isStderr) [protected]
  • fRtfFormat [protected]
  • GetCurFormat(bool jumpEnd=true)
  • GetDocument() [inline]
  • IsSelected(const CObject *pDocItem) const [protected, virtual]
  • OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo) [protected, virtual]
  • OnDestroy() [protected]
  • OnDraw(CDC *pDC) [virtual]
  • OnDropFiles(HDROP hDropInfo) [protected]
  • OnEditClearAll() [protected]
  • OnEndPrinting(CDC *pDC, CPrintInfo *pInfo) [protected, virtual]
  • OnGetDlgCode() [protected]
  • OnInitialUpdate() [protected, virtual]
  • OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) [protected]
  • OnMyFormatFont() [protected]
  • OnPreparePrinting(CPrintInfo *pInfo) [protected, virtual]
  • OnRButtonDown(UINT nFlags, CPoint point) [protected]
  • OnSetFocus(CWnd *pOldWnd) [protected]
  • OnSize(UINT nType, int cx, int cy) [protected]
  • OutColor(const char *txt, long len)
  • OutColor(kConsoleColor color)
  • OutColor(CHARFORMAT &format)
  • OutConsole(const char *txt, long len, bool isStderr=false)
  • PreCreateWindow(CREATESTRUCT &cs) [virtual]
  • QueryAcceptData(LPDATAOBJECT, CLIPFORMAT *, DWORD, BOOL, HGLOBAL) [protected, virtual]
  • sbuf [protected, static]
  • snumbuf [protected, static]
  • ~CWincvsView() [virtual]
Generated on Sun Oct 21 12:51:04 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Alphabetical index

WinCvs 1.3b6 Source Doc Compound Index

_
CCJWindowPlacement CJX_COLORMAP
N
tag_info
_afxRichEditCookie cmd CJX_CONTROLPOS node tagAFX_OLDTOOLINFO
_CvsProcess UCmdTarget
K
CNoPython tagCTV_ITEM
_dircontents CCmdUI CKeyString NotificationManager tagMENUITEMINFOA
_dirdesc UCmdUI KiColumn NotificationManager::Node tagTCB_ITEM
_frameRec UCOLOR KiColumnModel
O
UTB_BUTTON
_IID UColor KiFilterModel CObject UTB_DROPDOWN
_linkname CColorConsole KiIgnoreModel UObject UTB_INIT
_MIDL_PROC_FORMAT_STRING CColorStatic KiRecursionModel ColorTableEntry CTbEdit
_MIDL_TYPE_FORMAT_STRING CComboBox KiSelectionHandler option TBehavior
_name CComboBoxEx KoAddBinaryHandler option_revlist TbEntry
_SUBIO CComCoClass KoAddHandler COptionalPropertySheet TbEntryButton
_TABLE commit_info KoAnnotateHandler OUTBAR_INFO TbEntryChkButton
_version CComModule KoBranchTagHandler
P
TbEntryDropDown
_WireHandler CComObjectRootEx KoColumnContext partition TbEntrySeparator
_WireMessage config_s KoCommitHandler passwd TBrowserFill
A
CContentItems KoConflictColumn PCPStr TBrowserFillDummy
CAboutDlg context KoCreateTagHandler PCStr TBuggyPopup
AddBinCvsArgs CControlBar KoDateColumn UPen CTcl_Interp
AddCvsArgs ct_data_s KoDeleteTagHandler CPersistent CTCLBrowserEnt
addremove_args CCtrlView KoDiffHandler CPersistent::CPersistentEntry CTCLCvsConsole
admin_data CCustInvertTable KoEditHandler CPersistentBool CTCP2Parse
admin_file CCustomizeMenus KoEditorsHandler CPersistentInt CTCP2Parse::RGBColor
AFX_DLLVERSIONINFO CCVS_CoworkerModule KoFileRemoveHandler CPersistentT TEditText
CAllHandlers cvs_MD5Context KoFilterModel pid_list CTempToggleBool
CAllTargets UCvsApp KoGraphHandler PIPE TGraph
ansiAttrCvt UCvsConsole KoIgnoreModel PMacBinMaps TGraphCmdStatus
ansiAttrCvt::AnsiSeq CCvsConsole KoLockHandler UPoint TGraphDelCmd
AREF UCvsFiles KoLogHandler UPOINT TGraphRectSelect
aref UCvsFolders KoMoveToTrashHandler poolRec TGraphSelNonSig
ASEntry UCvsFrame KoNameColumn UPPMenu TIconButton
ASFileDates UCvsGraph KoOptionColumn CProgress TIconCheckBox
ASFinderInfo UCvsMenubar KoPathColumn CProgressDialog TIconPopup
ASHeader CCvsStatusBar KoQueryUpdateHandler UPromptMessage timeb
ASMacInfo CCvsThreadLock KoRecursionModel CPropertySheet UTimer
Authen UCvsToolbar KoRecursiveModel CPseudoButton CTipDlg
UAuthen_Kserver
D
KoRegularModel UPseudoCmdStatusWrapper TMPersistent
UAuthen_Pserver datelist KoReleaseHandler CPseudoDlg CTmpFiles
UAuthen_Rhosts UDC KoRevisionColumn CPseudoDraw TMString
UAuthen_SSH deltatext KoStatusColumn UPseudoFakePane UToolbar
AuthenKserver CDestroyThreadLock KoStatusHandler CPseudoItem CToolbarCombo
AuthenLocal CDialog KoTagColumn CPseudoList CToolBarCtrl
AuthenModel diff3_block KoTraversalContext UPseudoPageHider CToolBarData
AuthenNtserver diff_block KoUneditHandler UPseudoPlaceHolder TOOLBARINFO
AuthenPserver diff_callbacks KoUnlockHandler CPseudoRotButton TPopup
AuthenRhosts dirdata KoUpdateHandler UPseudoRotButton TPseudoAppBehavior
CAuthenSetUp direct KoUpdateMoveToTrashHandler CPseudoToggle TPseudoCustomView
AuthenSSH dirent KoWatcher UPStr TPseudoDoubleNumberText
awidget CDockBar KoWatchersHandler PyAutoObject TPseudoIconButton
B
CDockContext KoWatchOffHandler PyCmdUI TPseudoIconCheckBox
CBarConsole CDocument KoWatchOnHandler PyCmdUI::obj_t TPseudoIconPopup
CBrowseFileView DROPDOWNBUTTON
L
PyColorConsole TPseudoRotateIconButton
CBrowserBar CDummyClass LAttachment PyColorConsole::obj_t TPseudoScrollBar
UBrush DYN_LIST LBevelButton PyContainer TPseudoTextListView
CBuffer
E
LCommander CPyCvsConsole TPseudoWinAdorner
CButton CEdit linevector PyCvsEntry TPseudoWinBehavior
C
UEditMessage list PyCvsEntry::obj_t TraversalReport
change ENTNODE list3 PyMenuMgr tree_desc_s
CCharFormat entnode ULIST_INFO PyMenuMgr::obj_t UTREE_INFO
CCJBrowseButton EntnodeData ULIST_INSERT PyPersistent UTREE_INSERT
CCJBrowseEdit EntnodeFile CListBox PyPersistent::obj_t CTreeCtrl
CCJCaption EntnodeFolder CListCtrl PyRegistry CTreeView
CCJCaptionButton EntnodePath CListView CPython_Interp TScrollBar
CCJCaptionPopupWnd equivclass LListener CPyThreadState TTextListView
CCJCBarButton err_strs LMainPseudoAttachment
R
CTurnOffDispatching
CCJColorPicker error_info LOCK rcsbuffer TView
CCJColorPopup EXHCB lock CRcsFile TViewFill
CCJComboBoxEx CExploreBar log_data rcsnode
U
CCJControlBar
F
log_data_and_rcs rcsversnode unreaped
CCJDateEdit fatdef logfile_info re_pattern_buffer unrecog
CCJDateTimeCtrl fchdef CLogFrame re_registers CustInvertTable
CCJDockBar file_data CLogNode URECT utimbuf
CCJDockContext file_info CLogNodeBranch URect
V
CCJExplorerBar file_list_str CLogNodeData CRectTracker vector
CCJFlatButton FileEntry CLogNodeHeader recursion_frame vers_ts
CCJFlatComboBox CFillPyEntries CLogNodeRev CRecursionLock CView
CCJFlatHeaderCtrl CFillTclEntries CLogNodeTag regexp_list CViewInfo
CCJFlatSplitterWnd CFindSettings CLogoutThread regmatch_t VMS_DIR
CCJFlatTabCtrl fjndef CLogStr RemoveCvsArgs VMStimbuf
CCJFontCombo CFormView LOutlineItem ReportConflict CvsArgs
CCJFrameWnd frame_and_entries LOutlineTable ReportWarning CvsCoworker
CCJHexEdit frame_and_file LPane request CvsFilenames
CCJHtmlView CFrameWnd LPeriodical response CvsPrefs
CCJHyperLink
G
LPlaceHolder CRevFile CvsProcessCallbacks
CCJListBox garbyRec LPseudoDrawAttachment CRevisionConsole CvsProject
CCJListCtrl CGfxGroupEdit LPseudoWinAttachment revlist CvsString
CCJListView CGfxOutBarCtrl LV_COLUMN CRevNumber CvsTrace
CCJLogoPane CGfxOutBarCtrl::CBarFolder
M
CRichEditView Vstring
CCJMaskEdit CGfxOutBarCtrl::CBarItem UMacAppMenu URuntimeClass
W
CCJMDIChildWnd CGfxSplitterWnd CMacBinItem
S
UWaitCursor
CCJMDIFrameWnd GPT_CONSOLE MACBINMAP S_Dir UWidget
CCJMemFile GPT_GETENV MACBINMAPENTRIES S_NAME Win32wstring
CCJMenu GPT_QUIT MacBinMaps saved_cwd CWinApp
CCJMenuBar CGraphConsole CMacBinTable USaveSettings CWincvsApp
CCJMenuBarFrameHook CGraphDoc CMacroEntry CScrollView CWinCvsBrowser
CCJMenuData CGraphFrame CMacroSet USemaphore CWinCvsBrowser::CSelectionChangeNotifier
CCJMetaFileButton CGraphRectTracker MacroTraversal SIG_hlist CWincvsDoc
CCJMiniDockFrameWnd CGraphView CMainFrame USIZE CWincvsView
CCJMonthCalCtrl group CMapPtrToPtr USize WINDOWPLACEMENT
CCJOutlookBar gusilsh_ctx master_lists USLIDER WININFO
CCJPagerCtrl gz_stream CMDIChildWnd CSortHeaderCtrl CWinLogBranchData
CCJReBar
H
CMDIFrameWnd CSortList CWinLogData
CCJReBarCtrl hardlink_info CMemFile CSortParam CWinLogHeaderData
CCJShellTree CHARFORMAT CMenu sortrec CWinLogRevData
CCJSizeDockBar CHeaderCtrl UMenu CSplashWnd CWinLogTagData
CCJSortClass CHistComboBoxEx CMenuItemInfo CSplitterWnd CWinPlacement
CCJSortClass::CSortItem HQXDecodeVars UMessageMapFunctions CStackThreadLock CWinThread
CCJStatusBar HQXEncodeVars CMiniDockFrameWnd CStatic CWnd
CCJStatusBarPane hrec mircAttrCvt static_tree_desc_s CWndRedrawMngr
CCJStatusBarPaneControlInfo
I
CMMenuString CStaticAllocT wnt_stat
CCJTabCtrl ICvsCoworker CMPString CStatusBar WrapperEntry
CCJTabCtrlBar ImportReport CMsg stickydirtag wstring
CCJTabView inflate_blocks_state msg UStr
Y
CCJTimeEdit inflate_codes_state UMSGMAP CStreamConsole yy_buffer_state
CCJToolBar inflate_huft_s UMSGMAP_ENTRY CSubclassWnd yystack
CCJToolBarBase internal_state CMString CSubclassWndMap YYSTYPE
CCJToolBarCtrl IOSB MultiFiles
T
yytoktype
CCJToolCmdUI irciiAttrCvt MultiFilesEntry CTabCtrl
Z
CCJTreeCtrl ISupportErrorInfo CMyShellTree TAdorner z_stream_s
CCJTreeCtrl::Color_Font
J
Generated on Sun Oct 21 12:45:45 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001


Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

Consider the following example:

/*! Invisible class because of truncation */
class Invisible { };

/*! Truncated class, inheritance relation is hidden */
class Truncated : public Invisible { };

/* Class not documented with doxygen comments */
class Undocumented { };

/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };

/*! Class that is inherited using protected inheritance */
class ProtectedBase { };

/*! Class that is inherited using private inheritance */
class PrivateBase { };

/*! Class that is used by the Inherited class */
class Used { };

/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,
                  protected ProtectedBase,
                  private PrivateBase,
                  public Undocumented
{
  private:
    Used *m_usedClass;
};
If the MAX_DOT_GRAPH_HEIGHT tag in the configuration file is set to 200 this will result in the following graph:

The boxes in the above graph have the following meaning:

  • A filled black box represents the struct or class for which the graph is generated.
  • A box with a black border denotes a documented struct or class.
  • A box with a grey border denotes an undocumented struct or class.
  • A box with a red border denotes a documented struct or class for which not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
The arrows have the following meaning:
  • A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • A dark green arrow is used for protected inheritance.
  • A dark red arrow is used for private inheritance.
  • A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
Generated on Sun Oct 21 12:51:15 2001 for WinCvs 1.3b6 Source Doc by doxygen 1.2.11 written by Dimitri van Heesch, © 1997-2001